From d7ccb42582f85acf30568913610ccf4d602023fb Mon Sep 17 00:00:00 2001 From: Taco Hoekwater Date: Wed, 1 Jun 2011 08:54:21 +0000 Subject: commit context 2011.05.18 git-svn-id: svn://tug.org/texlive/trunk@22719 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/texlive/context/luatools | 8314 +--------- Build/source/texk/texlive/context/mtxrun | 13162 +++++++++------- Master/bin/win32/mtxrun.dll | Bin 8192 -> 9216 bytes Master/bin/win32/mtxrun.lua | 13162 +++++++++------- Master/bin/win32/pstopdf.exe | Bin 0 -> 6144 bytes .../colors/icc/context/colorprofiles.lua | 14 + .../colors/icc/context/colorprofiles.xml | 427 + .../context/data/scite/cont-cs-scite.properties | 2 +- .../context/data/scite/cont-de-scite.properties | 2 +- .../context/data/scite/cont-fr-scite.properties | 2 +- .../context/data/scite/cont-it-scite.properties | 2 +- .../context/data/scite/cont-nl-scite.properties | 2 +- .../context/data/scite/cont-pe-scite.properties | 2 +- .../context/data/scite/cont-ro-scite.properties | 2 +- .../context/data/scite/context.properties | 2 +- .../data/textpad/textpad-context-template.txt | 54 + Master/texmf-dist/fonts/afm/jmn/hans/hans-sh.afm | 304 +- Master/texmf-dist/fonts/afm/jmn/hans/hans.afm | 28 +- Master/texmf-dist/fonts/data/tests/texmfhome.otf | Bin 0 -> 1884 bytes Master/texmf-dist/fonts/enc/dvips/jmn/hans.enc | 66 +- Master/texmf-dist/fonts/map/dvips/jmn/hans.map | 2 +- Master/texmf-dist/fonts/tfm/jmn/hans/hans-sh.tfm | Bin 1656 -> 1536 bytes Master/texmf-dist/fonts/tfm/jmn/hans/hans.tfm | Bin 1600 -> 1512 bytes Master/texmf-dist/fonts/type1/jmn/hans/hans-sh.pfb | Bin 30755 -> 25050 bytes Master/texmf-dist/fonts/type1/jmn/hans/hans.pfb | Bin 19762 -> 17187 bytes Master/texmf-dist/metapost/context/base/mp-base.mp | 2 +- Master/texmf-dist/metapost/context/base/mp-core.mp | 531 +- Master/texmf-dist/metapost/context/base/mp-form.mp | 11 +- Master/texmf-dist/metapost/context/base/mp-grid.mp | 7 +- Master/texmf-dist/metapost/context/base/mp-grph.mp | 34 +- Master/texmf-dist/metapost/context/base/mp-mlib.mp | 425 +- Master/texmf-dist/metapost/context/base/mp-page.mp | 8 +- Master/texmf-dist/metapost/context/base/mp-spec.mp | 32 +- Master/texmf-dist/metapost/context/base/mp-tool.mp | 1 + .../metapost/context/font/punkfont-bold.mp | 4 + .../metapost/context/font/punkfont-boldslanted.mp | 5 + .../metapost/context/font/punkfont-characters.mp | 726 + .../metapost/context/font/punkfont-definitions.mp | 115 + .../metapost/context/font/punkfont-slanted.mp | 4 + .../texmf-dist/metapost/context/font/punkfont.mp | 865 +- .../texmf-dist/scripts/context/lua/mtx-babel.lua | 36 +- Master/texmf-dist/scripts/context/lua/mtx-base.lua | 118 + .../texmf-dist/scripts/context/lua/mtx-cache.lua | 141 +- .../texmf-dist/scripts/context/lua/mtx-chars.lua | 50 +- .../texmf-dist/scripts/context/lua/mtx-check.lua | 168 +- .../texmf-dist/scripts/context/lua/mtx-colors.lua | 57 + .../texmf-dist/scripts/context/lua/mtx-context.lua | 1385 +- .../texmf-dist/scripts/context/lua/mtx-convert.lua | 33 +- Master/texmf-dist/scripts/context/lua/mtx-epub.lua | 177 + Master/texmf-dist/scripts/context/lua/mtx-flac.lua | 216 + .../texmf-dist/scripts/context/lua/mtx-fonts.lua | 231 +- Master/texmf-dist/scripts/context/lua/mtx-grep.lua | 28 +- .../scripts/context/lua/mtx-interface.lua | 423 +- .../scripts/context/lua/mtx-metapost.lua | 177 + .../texmf-dist/scripts/context/lua/mtx-metatex.lua | 43 +- .../texmf-dist/scripts/context/lua/mtx-modules.lua | 35 +- .../texmf-dist/scripts/context/lua/mtx-mptopdf.lua | 127 - .../texmf-dist/scripts/context/lua/mtx-package.lua | 36 +- .../scripts/context/lua/mtx-patterns.lua | 660 +- .../texmf-dist/scripts/context/lua/mtx-profile.lua | 38 +- .../texmf-dist/scripts/context/lua/mtx-scite.lua | 56 +- .../context/lua/mtx-server-ctx-fonttest.lua | 56 +- .../scripts/context/lua/mtx-server-ctx-help.lua | 18 +- .../scripts/context/lua/mtx-server-ctx-startup.lua | 4 +- .../texmf-dist/scripts/context/lua/mtx-server.lua | 83 +- .../scripts/context/lua/mtx-texworks.lua | 48 +- .../texmf-dist/scripts/context/lua/mtx-timing.lua | 40 +- .../texmf-dist/scripts/context/lua/mtx-tools.lua | 68 +- .../texmf-dist/scripts/context/lua/mtx-unzip.lua | 41 +- .../texmf-dist/scripts/context/lua/mtx-update.lua | 152 +- .../texmf-dist/scripts/context/lua/mtx-watch.lua | 64 +- Master/texmf-dist/scripts/context/lua/mtxrun.lua | 13162 +++++++++------- Master/texmf-dist/scripts/context/lua/x-ldx.lua | 322 - Master/texmf-dist/scripts/context/perl/mptopdf.pl | 30 +- .../texmf-dist/scripts/context/ruby/base/kpse.rb | 18 +- Master/texmf-dist/scripts/context/ruby/base/tex.rb | 200 +- Master/texmf-dist/scripts/context/ruby/ctxtools.rb | 9 +- .../texmf-dist/scripts/context/ruby/fcd_start.rb | 2 + Master/texmf-dist/scripts/context/ruby/mtxtools.rb | 475 - .../texmf-dist/scripts/context/ruby/rslibtool.rb | 114 + Master/texmf-dist/scripts/context/ruby/texexec.rb | 19 +- .../texmf-dist/scripts/context/ruby/texmfstart.rb | 8 +- .../scripts/context/stubs/mswin/metatex.exe | Bin 6144 -> 0 bytes .../scripts/context/stubs/mswin/mtxrun.dll | Bin 8192 -> 9216 bytes .../scripts/context/stubs/mswin/mtxrun.lua | 13162 +++++++++------- .../scripts/context/stubs/source/mtxrun_dll.c | 104 +- .../texmf-dist/scripts/context/stubs/unix/luatools | 8314 +--------- .../texmf-dist/scripts/context/stubs/unix/metatex | 2 - .../texmf-dist/scripts/context/stubs/unix/mtxrun | 13162 +++++++++------- Master/texmf-dist/tex/context/base/anch-pgr.mkii | 8 +- Master/texmf-dist/tex/context/base/anch-pgr.mkiv | 475 +- Master/texmf-dist/tex/context/base/anch-pos.lua | 368 +- Master/texmf-dist/tex/context/base/anch-pos.mkii | 8 +- Master/texmf-dist/tex/context/base/anch-pos.mkiv | 210 +- Master/texmf-dist/tex/context/base/attr-col.lua | 516 + Master/texmf-dist/tex/context/base/attr-col.mkiv | 82 + Master/texmf-dist/tex/context/base/attr-eff.lua | 97 + Master/texmf-dist/tex/context/base/attr-eff.mkiv | 74 + Master/texmf-dist/tex/context/base/attr-ini.lua | 690 +- Master/texmf-dist/tex/context/base/attr-ini.mkiv | 175 +- Master/texmf-dist/tex/context/base/attr-lay.lua | 191 + Master/texmf-dist/tex/context/base/attr-lay.mkiv | 106 + Master/texmf-dist/tex/context/base/attr-neg.lua | 95 + Master/texmf-dist/tex/context/base/attr-neg.mkiv | 30 + Master/texmf-dist/tex/context/base/back-exp.lua | 1381 ++ Master/texmf-dist/tex/context/base/back-exp.mkiv | 127 + Master/texmf-dist/tex/context/base/back-ini.lua | 144 +- Master/texmf-dist/tex/context/base/back-ini.mkiv | 28 +- Master/texmf-dist/tex/context/base/back-pdf.lua | 267 +- Master/texmf-dist/tex/context/base/back-pdf.mkiv | 327 +- Master/texmf-dist/tex/context/base/back-u3d.mkiv | 25 +- Master/texmf-dist/tex/context/base/bibl-bib.lua | 115 +- Master/texmf-dist/tex/context/base/bibl-bib.mkiv | 51 +- Master/texmf-dist/tex/context/base/bibl-tra.lua | 85 +- Master/texmf-dist/tex/context/base/bibl-tra.mkii | 2 + Master/texmf-dist/tex/context/base/bibl-tra.mkiv | 168 +- Master/texmf-dist/tex/context/base/blob-ini.lua | 112 +- .../tex/context/base/buff-imp-default.lua | 42 + .../tex/context/base/buff-imp-default.mkiv | 43 + .../tex/context/base/buff-imp-escaped.lua | 14 + .../tex/context/base/buff-imp-escaped.mkiv | 18 + .../texmf-dist/tex/context/base/buff-imp-lua.lua | 208 + .../texmf-dist/tex/context/base/buff-imp-lua.mkiv | 69 + Master/texmf-dist/tex/context/base/buff-imp-mp.lua | 176 + .../texmf-dist/tex/context/base/buff-imp-mp.mkiv | 76 + .../tex/context/base/buff-imp-nested.lua | 80 + .../tex/context/base/buff-imp-nested.mkiv | 21 + .../tex/context/base/buff-imp-parsed-xml.lua | 101 + .../tex/context/base/buff-imp-parsed-xml.mkiv | 70 + .../texmf-dist/tex/context/base/buff-imp-tex.lua | 130 + .../texmf-dist/tex/context/base/buff-imp-tex.mkiv | 51 + .../texmf-dist/tex/context/base/buff-imp-xml.lua | 133 + .../texmf-dist/tex/context/base/buff-imp-xml.mkiv | 71 + Master/texmf-dist/tex/context/base/buff-ini.lua | 855 +- Master/texmf-dist/tex/context/base/buff-ini.mkiv | 355 +- Master/texmf-dist/tex/context/base/buff-par.lua | 179 + Master/texmf-dist/tex/context/base/buff-par.mkiv | 151 + Master/texmf-dist/tex/context/base/buff-ver.lua | 670 + Master/texmf-dist/tex/context/base/buff-ver.mkii | 1 - Master/texmf-dist/tex/context/base/buff-ver.mkiv | 1334 +- Master/texmf-dist/tex/context/base/catc-act.mkii | 65 + Master/texmf-dist/tex/context/base/catc-act.mkiv | 65 + Master/texmf-dist/tex/context/base/catc-act.tex | 61 - Master/texmf-dist/tex/context/base/catc-ctx.mkii | 76 + Master/texmf-dist/tex/context/base/catc-ctx.mkiv | 131 + Master/texmf-dist/tex/context/base/catc-ctx.tex | 250 - Master/texmf-dist/tex/context/base/catc-def.mkii | 142 + Master/texmf-dist/tex/context/base/catc-def.mkiv | 143 + Master/texmf-dist/tex/context/base/catc-def.tex | 142 - Master/texmf-dist/tex/context/base/catc-ini.mkii | 50 +- Master/texmf-dist/tex/context/base/catc-ini.mkiv | 191 +- Master/texmf-dist/tex/context/base/catc-sym.mkii | 187 + Master/texmf-dist/tex/context/base/catc-sym.mkiv | 187 + Master/texmf-dist/tex/context/base/catc-sym.tex | 187 - Master/texmf-dist/tex/context/base/catc-xml.mkii | 114 + Master/texmf-dist/tex/context/base/catc-xml.mkiv | 133 + Master/texmf-dist/tex/context/base/char-act.mkiv | 64 +- Master/texmf-dist/tex/context/base/char-cjk.lua | 366 + Master/texmf-dist/tex/context/base/char-cmp.lua | 268 - Master/texmf-dist/tex/context/base/char-def.lua | 4035 ++++- Master/texmf-dist/tex/context/base/char-enc.lua | 42 +- Master/texmf-dist/tex/context/base/char-ini.lua | 1074 +- Master/texmf-dist/tex/context/base/char-ini.mkiv | 58 +- Master/texmf-dist/tex/context/base/char-map.lua | 2 + Master/texmf-dist/tex/context/base/char-tex.lua | 147 +- Master/texmf-dist/tex/context/base/char-utf.lua | 436 +- Master/texmf-dist/tex/context/base/char-utf.mkiv | 17 +- Master/texmf-dist/tex/context/base/chem-ini.lua | 56 +- Master/texmf-dist/tex/context/base/chem-ini.mkiv | 2 +- Master/texmf-dist/tex/context/base/chem-str.lua | 132 +- Master/texmf-dist/tex/context/base/chem-str.mkiv | 37 +- Master/texmf-dist/tex/context/base/cldf-com.lua | 105 + Master/texmf-dist/tex/context/base/cldf-com.mkiv | 19 + Master/texmf-dist/tex/context/base/cldf-ini.lua | 755 + Master/texmf-dist/tex/context/base/cldf-ini.mkiv | 40 + Master/texmf-dist/tex/context/base/cldf-int.lua | 189 + Master/texmf-dist/tex/context/base/cldf-int.mkiv | 24 + Master/texmf-dist/tex/context/base/cldf-ver.lua | 73 + Master/texmf-dist/tex/context/base/cldf-ver.mkiv | 18 + Master/texmf-dist/tex/context/base/colo-ema.mkii | 590 + Master/texmf-dist/tex/context/base/colo-ema.tex | 590 - Master/texmf-dist/tex/context/base/colo-ext.mkiv | 15 +- Master/texmf-dist/tex/context/base/colo-hex.mkiv | 28 - Master/texmf-dist/tex/context/base/colo-hex.tex | 3 - Master/texmf-dist/tex/context/base/colo-icc.lua | 120 + .../texmf-dist/tex/context/base/colo-imp-ema.mkiv | 590 + .../texmf-dist/tex/context/base/colo-imp-rgb.mkiv | 530 + .../texmf-dist/tex/context/base/colo-imp-x11.mkiv | 677 + .../texmf-dist/tex/context/base/colo-imp-xwi.mkiv | 142 + Master/texmf-dist/tex/context/base/colo-ini.lua | 406 +- Master/texmf-dist/tex/context/base/colo-ini.mkii | 6 +- Master/texmf-dist/tex/context/base/colo-ini.mkiv | 171 +- Master/texmf-dist/tex/context/base/colo-rgb.mkii | 530 + Master/texmf-dist/tex/context/base/colo-rgb.tex | 530 - Master/texmf-dist/tex/context/base/colo-run.mkii | 257 + Master/texmf-dist/tex/context/base/colo-run.mkiv | 257 + Master/texmf-dist/tex/context/base/colo-run.tex | 257 - Master/texmf-dist/tex/context/base/colo-x11.mkii | 677 + Master/texmf-dist/tex/context/base/colo-x11.tex | 677 - Master/texmf-dist/tex/context/base/colo-xwi.mkii | 142 + Master/texmf-dist/tex/context/base/colo-xwi.tex | 142 - Master/texmf-dist/tex/context/base/cont-cs.mkii | 21 + Master/texmf-dist/tex/context/base/cont-cs.mkiv | 21 + Master/texmf-dist/tex/context/base/cont-cs.tex | 39 - Master/texmf-dist/tex/context/base/cont-de.mkii | 21 + Master/texmf-dist/tex/context/base/cont-de.mkiv | 21 + Master/texmf-dist/tex/context/base/cont-de.tex | 44 - Master/texmf-dist/tex/context/base/cont-en.mkii | 21 + Master/texmf-dist/tex/context/base/cont-en.mkiv | 21 + Master/texmf-dist/tex/context/base/cont-en.tex | 46 - Master/texmf-dist/tex/context/base/cont-err.mkii | 18 + Master/texmf-dist/tex/context/base/cont-err.tex | 18 - Master/texmf-dist/tex/context/base/cont-fil.mkii | 124 + Master/texmf-dist/tex/context/base/cont-fil.mkiv | 96 + Master/texmf-dist/tex/context/base/cont-fil.tex | 124 - Master/texmf-dist/tex/context/base/cont-fr.mkii | 21 + Master/texmf-dist/tex/context/base/cont-fr.mkiv | 21 + Master/texmf-dist/tex/context/base/cont-fr.tex | 42 - Master/texmf-dist/tex/context/base/cont-gb.mkii | 21 + Master/texmf-dist/tex/context/base/cont-gb.mkiv | 21 + Master/texmf-dist/tex/context/base/cont-gb.tex | 42 - Master/texmf-dist/tex/context/base/cont-it.mkii | 21 + Master/texmf-dist/tex/context/base/cont-it.mkiv | 21 + Master/texmf-dist/tex/context/base/cont-it.tex | 41 - Master/texmf-dist/tex/context/base/cont-log.mkii | 304 + Master/texmf-dist/tex/context/base/cont-log.mkiv | 253 + Master/texmf-dist/tex/context/base/cont-log.tex | 359 - Master/texmf-dist/tex/context/base/cont-mtx.tex | 25 - Master/texmf-dist/tex/context/base/cont-new.mkii | 925 +- Master/texmf-dist/tex/context/base/cont-new.mkiv | 580 +- Master/texmf-dist/tex/context/base/cont-new.tex | 992 -- Master/texmf-dist/tex/context/base/cont-nl.mkii | 21 + Master/texmf-dist/tex/context/base/cont-nl.mkiv | 21 + Master/texmf-dist/tex/context/base/cont-nl.tex | 42 - Master/texmf-dist/tex/context/base/cont-old.tex | 48 - Master/texmf-dist/tex/context/base/cont-pe.mkiv | 22 + Master/texmf-dist/tex/context/base/cont-pe.tex | 45 - Master/texmf-dist/tex/context/base/cont-ro.mkii | 22 + Master/texmf-dist/tex/context/base/cont-ro.mkiv | 21 + Master/texmf-dist/tex/context/base/cont-ro.tex | 38 - Master/texmf-dist/tex/context/base/cont-sys.ori | 4 + Master/texmf-dist/tex/context/base/cont-usr.ori | 109 - Master/texmf-dist/tex/context/base/context.lus | 71 + Master/texmf-dist/tex/context/base/context.mkii | 149 +- Master/texmf-dist/tex/context/base/context.mkiv | 237 +- Master/texmf-dist/tex/context/base/context.rme | 102 +- Master/texmf-dist/tex/context/base/context.tex | 225 - Master/texmf-dist/tex/context/base/context.todo | 6 + Master/texmf-dist/tex/context/base/core-con.lua | 858 +- Master/texmf-dist/tex/context/base/core-con.mkiv | 420 +- Master/texmf-dist/tex/context/base/core-ctx.lua | 17 +- Master/texmf-dist/tex/context/base/core-ctx.mkiv | 6 +- Master/texmf-dist/tex/context/base/core-def.mkii | 2 +- Master/texmf-dist/tex/context/base/core-def.mkiv | 33 +- Master/texmf-dist/tex/context/base/core-env.lua | 101 + Master/texmf-dist/tex/context/base/core-env.mkiv | 261 +- Master/texmf-dist/tex/context/base/core-fil.mkii | 8 +- Master/texmf-dist/tex/context/base/core-fil.mkiv | 61 +- Master/texmf-dist/tex/context/base/core-fnt.mkiv | 21 +- Master/texmf-dist/tex/context/base/core-ini.mkiv | 14 +- Master/texmf-dist/tex/context/base/core-job.lua | 44 +- Master/texmf-dist/tex/context/base/core-job.mkii | 58 +- Master/texmf-dist/tex/context/base/core-job.mkiv | 144 +- Master/texmf-dist/tex/context/base/core-mis.mkii | 15 +- Master/texmf-dist/tex/context/base/core-mis.mkiv | 237 +- Master/texmf-dist/tex/context/base/core-sys.lua | 3 + Master/texmf-dist/tex/context/base/core-sys.mkiv | 131 +- Master/texmf-dist/tex/context/base/core-two.lua | 19 +- Master/texmf-dist/tex/context/base/core-two.mkiv | 28 +- Master/texmf-dist/tex/context/base/core-uti.lua | 224 +- Master/texmf-dist/tex/context/base/core-uti.mkiv | 39 +- Master/texmf-dist/tex/context/base/core-var.mkiv | 23 +- Master/texmf-dist/tex/context/base/data-aux.lua | 29 +- Master/texmf-dist/tex/context/base/data-bin.lua | 16 +- Master/texmf-dist/tex/context/base/data-con.lua | 89 +- Master/texmf-dist/tex/context/base/data-crl.lua | 65 +- Master/texmf-dist/tex/context/base/data-ctx.lua | 24 +- Master/texmf-dist/tex/context/base/data-env.lua | 289 + Master/texmf-dist/tex/context/base/data-exp.lua | 330 + Master/texmf-dist/tex/context/base/data-fil.lua | 112 + Master/texmf-dist/tex/context/base/data-ini.lua | 229 + Master/texmf-dist/tex/context/base/data-inp.lua | 22 +- Master/texmf-dist/tex/context/base/data-lst.lua | 68 +- Master/texmf-dist/tex/context/base/data-lua.lua | 61 +- Master/texmf-dist/tex/context/base/data-met.lua | 128 + Master/texmf-dist/tex/context/base/data-out.lua | 10 +- Master/texmf-dist/tex/context/base/data-pre.lua | 117 +- Master/texmf-dist/tex/context/base/data-res.lua | 2631 ++-- Master/texmf-dist/tex/context/base/data-sch.lua | 148 +- Master/texmf-dist/tex/context/base/data-tex.lua | 306 +- Master/texmf-dist/tex/context/base/data-tmf.lua | 108 +- Master/texmf-dist/tex/context/base/data-tmp.lua | 389 +- Master/texmf-dist/tex/context/base/data-tre.lua | 51 +- Master/texmf-dist/tex/context/base/data-use.lua | 58 +- Master/texmf-dist/tex/context/base/data-vir.lua | 81 + Master/texmf-dist/tex/context/base/data-zip.lua | 180 +- Master/texmf-dist/tex/context/base/enco-agr.mkii | 2 + Master/texmf-dist/tex/context/base/enco-ans.mkii | 2 +- Master/texmf-dist/tex/context/base/enco-ec.mkii | 2 +- Master/texmf-dist/tex/context/base/enco-fde.mkii | 2 - Master/texmf-dist/tex/context/base/enco-ffr.mkii | 2 - Master/texmf-dist/tex/context/base/enco-ini.mkii | 10 +- Master/texmf-dist/tex/context/base/enco-ini.mkiv | 384 +- Master/texmf-dist/tex/context/base/enco-l7x.mkii | 16 +- Master/texmf-dist/tex/context/base/enco-qx.mkii | 2 + Master/texmf-dist/tex/context/base/enco-t5.mkii | 6 +- Master/texmf-dist/tex/context/base/enco-x5.mkii | 6 +- Master/texmf-dist/tex/context/base/font-afm.lua | 1296 +- Master/texmf-dist/tex/context/base/font-age.lua | 3744 +++++ Master/texmf-dist/tex/context/base/font-agl.lua | 3958 +---- Master/texmf-dist/tex/context/base/font-aux.lua | 104 + Master/texmf-dist/tex/context/base/font-chk.lua | 23 +- Master/texmf-dist/tex/context/base/font-cid.lua | 116 +- Master/texmf-dist/tex/context/base/font-col.lua | 86 +- Master/texmf-dist/tex/context/base/font-col.mkiv | 19 +- Master/texmf-dist/tex/context/base/font-con.lua | 1135 ++ Master/texmf-dist/tex/context/base/font-ctx.lua | 1159 +- Master/texmf-dist/tex/context/base/font-def.lua | 621 +- Master/texmf-dist/tex/context/base/font-dum.lua | 301 - Master/texmf-dist/tex/context/base/font-enc.lua | 67 +- Master/texmf-dist/tex/context/base/font-enh.lua | 326 +- Master/texmf-dist/tex/context/base/font-ext.lua | 468 +- Master/texmf-dist/tex/context/base/font-fbk.lua | 402 +- Master/texmf-dist/tex/context/base/font-gds.lua | 383 +- Master/texmf-dist/tex/context/base/font-gds.mkiv | 5 +- Master/texmf-dist/tex/context/base/font-ini.lua | 95 +- Master/texmf-dist/tex/context/base/font-ini.mkii | 159 +- Master/texmf-dist/tex/context/base/font-ini.mkiv | 1256 +- Master/texmf-dist/tex/context/base/font-ldr.lua | 70 + Master/texmf-dist/tex/context/base/font-log.lua | 74 +- Master/texmf-dist/tex/context/base/font-lua.lua | 46 + Master/texmf-dist/tex/context/base/font-map.lua | 236 +- Master/texmf-dist/tex/context/base/font-mis.lua | 36 +- Master/texmf-dist/tex/context/base/font-ota.lua | 196 +- Master/texmf-dist/tex/context/base/font-otb.lua | 772 +- Master/texmf-dist/tex/context/base/font-otc.lua | 405 +- Master/texmf-dist/tex/context/base/font-otd.lua | 217 +- Master/texmf-dist/tex/context/base/font-otf.lua | 2869 ++-- Master/texmf-dist/tex/context/base/font-oth.lua | 51 + Master/texmf-dist/tex/context/base/font-oti.lua | 91 +- Master/texmf-dist/tex/context/base/font-otn.lua | 1865 ++- Master/texmf-dist/tex/context/base/font-otp.lua | 799 +- Master/texmf-dist/tex/context/base/font-ott.lua | 1417 +- Master/texmf-dist/tex/context/base/font-pat.lua | 145 +- Master/texmf-dist/tex/context/base/font-run.mkiv | 94 +- Master/texmf-dist/tex/context/base/font-syn.lua | 597 +- Master/texmf-dist/tex/context/base/font-tfm.lua | 784 +- Master/texmf-dist/tex/context/base/font-tra.mkiv | 10 +- Master/texmf-dist/tex/context/base/font-uni.mkiv | 3 +- Master/texmf-dist/tex/context/base/font-vf.lua | 268 +- Master/texmf-dist/tex/context/base/font-xtx.lua | 122 - Master/texmf-dist/tex/context/base/font-xtx.mkii | 93 +- Master/texmf-dist/tex/context/base/grph-epd.lua | 26 + Master/texmf-dist/tex/context/base/grph-epd.mkiv | 56 + Master/texmf-dist/tex/context/base/grph-fig.mkiv | 41 +- Master/texmf-dist/tex/context/base/grph-fil.lua | 49 +- Master/texmf-dist/tex/context/base/grph-inc.lua | 891 +- Master/texmf-dist/tex/context/base/grph-inc.mkiv | 77 +- Master/texmf-dist/tex/context/base/grph-raw.lua | 39 + Master/texmf-dist/tex/context/base/grph-raw.mkiv | 64 + Master/texmf-dist/tex/context/base/grph-swf.lua | 82 +- Master/texmf-dist/tex/context/base/grph-u3d.lua | 26 +- Master/texmf-dist/tex/context/base/grph-wnd.lua | 47 + Master/texmf-dist/tex/context/base/hand-ini.mkiv | 4 +- Master/texmf-dist/tex/context/base/java-ans.mkii | 28 + Master/texmf-dist/tex/context/base/java-ans.tex | 28 - Master/texmf-dist/tex/context/base/java-exa.mkii | 395 + Master/texmf-dist/tex/context/base/java-exa.tex | 395 - Master/texmf-dist/tex/context/base/java-fil.mkii | 48 + Master/texmf-dist/tex/context/base/java-fil.tex | 48 - Master/texmf-dist/tex/context/base/java-fld.mkii | 475 + Master/texmf-dist/tex/context/base/java-fld.tex | 282 - .../texmf-dist/tex/context/base/java-imp-exa.mkiv | 395 + .../texmf-dist/tex/context/base/java-imp-fil.mkiv | 52 + .../texmf-dist/tex/context/base/java-imp-fld.mkiv | 536 + .../texmf-dist/tex/context/base/java-imp-stp.mkiv | 123 + Master/texmf-dist/tex/context/base/java-ini.lua | 168 +- Master/texmf-dist/tex/context/base/java-ini.mkii | 32 +- Master/texmf-dist/tex/context/base/java-ini.mkiv | 40 +- Master/texmf-dist/tex/context/base/java-stp.mkii | 121 + Master/texmf-dist/tex/context/base/java-stp.tex | 121 - Master/texmf-dist/tex/context/base/l-aux.lua | 254 +- Master/texmf-dist/tex/context/base/l-boolean.lua | 23 +- Master/texmf-dist/tex/context/base/l-dimen.lua | 432 - Master/texmf-dist/tex/context/base/l-dir.lua | 266 +- Master/texmf-dist/tex/context/base/l-file.lua | 279 +- Master/texmf-dist/tex/context/base/l-io.lua | 115 +- Master/texmf-dist/tex/context/base/l-lpeg.lua | 480 +- Master/texmf-dist/tex/context/base/l-math.lua | 27 +- Master/texmf-dist/tex/context/base/l-md5.lua | 7 +- Master/texmf-dist/tex/context/base/l-number.lua | 76 +- Master/texmf-dist/tex/context/base/l-os.lua | 139 +- Master/texmf-dist/tex/context/base/l-pdfview.lua | 35 +- Master/texmf-dist/tex/context/base/l-set.lua | 7 +- Master/texmf-dist/tex/context/base/l-string.lua | 278 +- Master/texmf-dist/tex/context/base/l-table.lua | 583 +- Master/texmf-dist/tex/context/base/l-unicode.lua | 365 +- Master/texmf-dist/tex/context/base/l-url.lua | 225 +- Master/texmf-dist/tex/context/base/l-utils.lua | 172 +- Master/texmf-dist/tex/context/base/lang-alt.mkii | 152 + Master/texmf-dist/tex/context/base/lang-alt.tex | 152 - Master/texmf-dist/tex/context/base/lang-ana.mkii | 24 + Master/texmf-dist/tex/context/base/lang-ana.tex | 24 - Master/texmf-dist/tex/context/base/lang-ara.mkiv | 150 - Master/texmf-dist/tex/context/base/lang-art.mkii | 26 + Master/texmf-dist/tex/context/base/lang-art.tex | 26 - Master/texmf-dist/tex/context/base/lang-bal.mkii | 118 + Master/texmf-dist/tex/context/base/lang-bal.tex | 118 - Master/texmf-dist/tex/context/base/lang-cel.mkii | 26 + Master/texmf-dist/tex/context/base/lang-cel.tex | 26 - Master/texmf-dist/tex/context/base/lang-cjk.mkiv | 328 - Master/texmf-dist/tex/context/base/lang-cyr.mkii | 371 + Master/texmf-dist/tex/context/base/lang-cyr.tex | 371 - Master/texmf-dist/tex/context/base/lang-def.lua | 416 + Master/texmf-dist/tex/context/base/lang-def.mkiv | 689 + Master/texmf-dist/tex/context/base/lang-frd.mkii | 140 + Master/texmf-dist/tex/context/base/lang-frd.tex | 140 - Master/texmf-dist/tex/context/base/lang-frq.mkii | 207 + Master/texmf-dist/tex/context/base/lang-frq.tex | 207 - Master/texmf-dist/tex/context/base/lang-ger.mkii | 744 + Master/texmf-dist/tex/context/base/lang-ger.tex | 738 - Master/texmf-dist/tex/context/base/lang-grk.mkii | 99 + Master/texmf-dist/tex/context/base/lang-grk.tex | 94 - Master/texmf-dist/tex/context/base/lang-ind.mkii | 26 + Master/texmf-dist/tex/context/base/lang-ind.tex | 26 - Master/texmf-dist/tex/context/base/lang-ini.lua | 485 +- Master/texmf-dist/tex/context/base/lang-ini.mkii | 2 +- Master/texmf-dist/tex/context/base/lang-ini.mkiv | 245 +- Master/texmf-dist/tex/context/base/lang-ita.mkii | 518 + Master/texmf-dist/tex/context/base/lang-ita.tex | 518 - Master/texmf-dist/tex/context/base/lang-lab.lua | 130 + Master/texmf-dist/tex/context/base/lang-lab.mkiv | 309 +- Master/texmf-dist/tex/context/base/lang-mis.mkiv | 14 +- Master/texmf-dist/tex/context/base/lang-sla.mkii | 457 +- Master/texmf-dist/tex/context/base/lang-sla.mkiv | 17 - Master/texmf-dist/tex/context/base/lang-sla.tex | 497 - Master/texmf-dist/tex/context/base/lang-spa.mkii | 74 + Master/texmf-dist/tex/context/base/lang-spa.mkiv | 76 + Master/texmf-dist/tex/context/base/lang-spa.tex | 74 - Master/texmf-dist/tex/context/base/lang-txt.lua | 2510 +++ Master/texmf-dist/tex/context/base/lang-ura.mkii | 158 + Master/texmf-dist/tex/context/base/lang-ura.tex | 158 - Master/texmf-dist/tex/context/base/lang-url.lua | 24 +- Master/texmf-dist/tex/context/base/lang-url.mkiv | 14 +- Master/texmf-dist/tex/context/base/lang-vn.mkii | 92 + Master/texmf-dist/tex/context/base/lang-vn.tex | 92 - Master/texmf-dist/tex/context/base/lang-wrd.lua | 381 +- Master/texmf-dist/tex/context/base/lang-wrd.mkiv | 30 +- Master/texmf-dist/tex/context/base/layo-ini.lua | 61 + Master/texmf-dist/tex/context/base/layo-ini.mkiv | 31 + Master/texmf-dist/tex/context/base/lpdf-ano.lua | 429 +- Master/texmf-dist/tex/context/base/lpdf-col.lua | 172 +- Master/texmf-dist/tex/context/base/lpdf-enc.lua | 157 + Master/texmf-dist/tex/context/base/lpdf-epa.lua | 193 + Master/texmf-dist/tex/context/base/lpdf-epd.lua | 308 + Master/texmf-dist/tex/context/base/lpdf-fld.lua | 899 +- Master/texmf-dist/tex/context/base/lpdf-fmt.lua | 758 + Master/texmf-dist/tex/context/base/lpdf-grp.lua | 94 +- Master/texmf-dist/tex/context/base/lpdf-ini.lua | 420 +- Master/texmf-dist/tex/context/base/lpdf-ini.mkiv | 271 - Master/texmf-dist/tex/context/base/lpdf-mis.lua | 156 +- Master/texmf-dist/tex/context/base/lpdf-nod.lua | 23 +- Master/texmf-dist/tex/context/base/lpdf-pda.xml | 171 + Master/texmf-dist/tex/context/base/lpdf-pdx.lua | 139 - Master/texmf-dist/tex/context/base/lpdf-pdx.mkiv | 71 - Master/texmf-dist/tex/context/base/lpdf-pdx.xml | 45 + Master/texmf-dist/tex/context/base/lpdf-ren.lua | 184 +- Master/texmf-dist/tex/context/base/lpdf-swf.lua | 216 +- Master/texmf-dist/tex/context/base/lpdf-tag.lua | 308 + Master/texmf-dist/tex/context/base/lpdf-u3d.lua | 52 +- Master/texmf-dist/tex/context/base/lpdf-wid.lua | 700 +- Master/texmf-dist/tex/context/base/lpdf-xmp.lua | 82 +- Master/texmf-dist/tex/context/base/lpdf-xmp.xml | 43 - Master/texmf-dist/tex/context/base/luat-bas.mkiv | 29 +- Master/texmf-dist/tex/context/base/luat-bwc.lua | 32 + Master/texmf-dist/tex/context/base/luat-cbk.lua | 101 +- Master/texmf-dist/tex/context/base/luat-cnf.lua | 167 +- Master/texmf-dist/tex/context/base/luat-cod.lua | 167 + Master/texmf-dist/tex/context/base/luat-cod.mkiv | 132 +- Master/texmf-dist/tex/context/base/luat-dum.lua | 126 - Master/texmf-dist/tex/context/base/luat-env.lua | 147 +- Master/texmf-dist/tex/context/base/luat-exe.lua | 91 +- Master/texmf-dist/tex/context/base/luat-fio.lua | 91 +- Master/texmf-dist/tex/context/base/luat-fmt.lua | 139 + Master/texmf-dist/tex/context/base/luat-ini.lua | 116 +- Master/texmf-dist/tex/context/base/luat-ini.mkiv | 62 +- Master/texmf-dist/tex/context/base/luat-iop.lua | 46 +- Master/texmf-dist/tex/context/base/luat-lib.mkiv | 102 +- Master/texmf-dist/tex/context/base/luat-lua.lua | 12 +- Master/texmf-dist/tex/context/base/luat-mac.lua | 271 + Master/texmf-dist/tex/context/base/luat-run.lua | 137 +- Master/texmf-dist/tex/context/base/luat-sta.lua | 51 +- Master/texmf-dist/tex/context/base/luat-sto.lua | 118 +- Master/texmf-dist/tex/context/base/lxml-aux.lua | 364 +- Master/texmf-dist/tex/context/base/lxml-ctx.lua | 10 +- Master/texmf-dist/tex/context/base/lxml-dir.lua | 18 +- Master/texmf-dist/tex/context/base/lxml-ent.lua | 12 +- Master/texmf-dist/tex/context/base/lxml-inf.lua | 5 +- Master/texmf-dist/tex/context/base/lxml-ini.mkiv | 222 +- Master/texmf-dist/tex/context/base/lxml-lpt.lua | 329 +- Master/texmf-dist/tex/context/base/lxml-mis.lua | 18 +- Master/texmf-dist/tex/context/base/lxml-sor.lua | 2 + Master/texmf-dist/tex/context/base/lxml-sor.mkiv | 10 +- Master/texmf-dist/tex/context/base/lxml-tab.lua | 94 +- Master/texmf-dist/tex/context/base/lxml-tex.lua | 331 +- Master/texmf-dist/tex/context/base/lxml-xml.lua | 74 +- Master/texmf-dist/tex/context/base/m-arabtex.mkii | 450 + Master/texmf-dist/tex/context/base/m-arabtex.tex | 450 - Master/texmf-dist/tex/context/base/m-barcodes.mkiv | 26 +- Master/texmf-dist/tex/context/base/m-chart.mkii | 1269 +- Master/texmf-dist/tex/context/base/m-chart.mkiv | 2530 ++- Master/texmf-dist/tex/context/base/m-chart.tex | 1269 +- Master/texmf-dist/tex/context/base/m-chemic.tex | 17 - Master/texmf-dist/tex/context/base/m-database.lua | 108 + Master/texmf-dist/tex/context/base/m-database.mkii | 421 + Master/texmf-dist/tex/context/base/m-database.mkiv | 241 + Master/texmf-dist/tex/context/base/m-database.tex | 421 - .../texmf-dist/tex/context/base/m-directives.mkiv | 3 + .../texmf-dist/tex/context/base/m-directives.tex | 5 - Master/texmf-dist/tex/context/base/m-dratex.mkii | 21 + Master/texmf-dist/tex/context/base/m-dratex.tex | 21 - Master/texmf-dist/tex/context/base/m-edtsnc.mkii | 207 + Master/texmf-dist/tex/context/base/m-edtsnc.tex | 207 - Master/texmf-dist/tex/context/base/m-fields.mkiv | 70 + Master/texmf-dist/tex/context/base/m-graph.mkii | 161 +- Master/texmf-dist/tex/context/base/m-graph.mkiv | 109 +- Master/texmf-dist/tex/context/base/m-graph.tex | 175 - Master/texmf-dist/tex/context/base/m-level.mkii | 94 + Master/texmf-dist/tex/context/base/m-level.tex | 94 - .../tex/context/base/m-logcategories.mkiv | 3 + Master/texmf-dist/tex/context/base/m-mathcrap.mkiv | 76 + Master/texmf-dist/tex/context/base/m-mkii.mkiv | 2 +- .../texmf-dist/tex/context/base/m-mkivhacks.mkiv | 50 + Master/texmf-dist/tex/context/base/m-mkivhacks.tex | 52 - Master/texmf-dist/tex/context/base/m-morse.mkvi | 264 + Master/texmf-dist/tex/context/base/m-newmat.tex | 269 +- Master/texmf-dist/tex/context/base/m-obsolete.mkii | 5 + Master/texmf-dist/tex/context/base/m-obsolete.mkiv | 5 + Master/texmf-dist/tex/context/base/m-obsolete.tex | 5 - Master/texmf-dist/tex/context/base/m-pdfsnc.mkii | 200 + Master/texmf-dist/tex/context/base/m-pdfsnc.tex | 200 - Master/texmf-dist/tex/context/base/m-pictex.tex | 2 +- Master/texmf-dist/tex/context/base/m-plus.tex | 30 - Master/texmf-dist/tex/context/base/m-pstricks.lua | 15 +- Master/texmf-dist/tex/context/base/m-pstricks.mkiv | 6 +- Master/texmf-dist/tex/context/base/m-pstricks.tex | 16 - Master/texmf-dist/tex/context/base/m-punk.mkiv | 354 +- Master/texmf-dist/tex/context/base/m-punk.tex | 3 - .../texmf-dist/tex/context/base/m-spreadsheet.mkiv | 265 + Master/texmf-dist/tex/context/base/m-steps.mkii | 83 - Master/texmf-dist/tex/context/base/m-steps.mkiv | 20 - Master/texmf-dist/tex/context/base/m-steps.tex | 4 +- Master/texmf-dist/tex/context/base/m-tex4ht.mkii | 9 + Master/texmf-dist/tex/context/base/m-tex4ht.tex | 9 - Master/texmf-dist/tex/context/base/m-timing.mkiv | 100 + Master/texmf-dist/tex/context/base/m-timing.tex | 102 - Master/texmf-dist/tex/context/base/m-trackers.mkiv | 3 + Master/texmf-dist/tex/context/base/m-trackers.tex | 5 - .../texmf-dist/tex/context/base/m-translate.mkiv | 96 + Master/texmf-dist/tex/context/base/m-translate.tex | 88 - Master/texmf-dist/tex/context/base/m-tryout.tex | 55 - Master/texmf-dist/tex/context/base/m-units.mkii | 904 ++ Master/texmf-dist/tex/context/base/m-units.mkiv | 912 ++ Master/texmf-dist/tex/context/base/m-units.tex | 825 - Master/texmf-dist/tex/context/base/m-zint.mkiv | 87 + Master/texmf-dist/tex/context/base/math-act.lua | 142 + Master/texmf-dist/tex/context/base/math-ali.mkiv | 44 +- Master/texmf-dist/tex/context/base/math-arr.mkiv | 14 +- Master/texmf-dist/tex/context/base/math-def.mkiv | 16 +- Master/texmf-dist/tex/context/base/math-dim.lua | 50 +- Master/texmf-dist/tex/context/base/math-ent.lua | 5 +- Master/texmf-dist/tex/context/base/math-ext.lua | 105 +- Master/texmf-dist/tex/context/base/math-frc.mkii | 195 +- Master/texmf-dist/tex/context/base/math-frc.mkiv | 215 +- Master/texmf-dist/tex/context/base/math-ini.lua | 197 +- Master/texmf-dist/tex/context/base/math-ini.mkii | 4 +- Master/texmf-dist/tex/context/base/math-ini.mkiv | 215 +- Master/texmf-dist/tex/context/base/math-int.mkiv | 53 +- Master/texmf-dist/tex/context/base/math-lbr.mkii | 42 +- Master/texmf-dist/tex/context/base/math-map.lua | 53 +- Master/texmf-dist/tex/context/base/math-noa.lua | 518 +- Master/texmf-dist/tex/context/base/math-pln.mkiv | 53 +- Master/texmf-dist/tex/context/base/math-scr.mkiv | 65 +- Master/texmf-dist/tex/context/base/math-tag.lua | 252 + Master/texmf-dist/tex/context/base/math-vfu.lua | 626 +- Master/texmf-dist/tex/context/base/meta-clp.mkii | 164 + Master/texmf-dist/tex/context/base/meta-clp.tex | 164 - Master/texmf-dist/tex/context/base/meta-dum.mkii | 123 + Master/texmf-dist/tex/context/base/meta-dum.tex | 123 - Master/texmf-dist/tex/context/base/meta-fig.mkiv | 15 +- Master/texmf-dist/tex/context/base/meta-fun.lua | 9 +- Master/texmf-dist/tex/context/base/meta-fun.mkiv | 5 + .../texmf-dist/tex/context/base/meta-imp-clp.mkiv | 164 + .../texmf-dist/tex/context/base/meta-imp-dum.mkiv | 147 + .../texmf-dist/tex/context/base/meta-imp-mis.mkiv | 54 + .../texmf-dist/tex/context/base/meta-imp-nav.mkiv | 65 + .../texmf-dist/tex/context/base/meta-imp-pre.mkiv | 68 + .../texmf-dist/tex/context/base/meta-imp-txt.mkiv | 304 + Master/texmf-dist/tex/context/base/meta-ini.lua | 29 + Master/texmf-dist/tex/context/base/meta-ini.mkii | 18 +- Master/texmf-dist/tex/context/base/meta-ini.mkiv | 185 +- Master/texmf-dist/tex/context/base/meta-mis.mkii | 54 + Master/texmf-dist/tex/context/base/meta-mis.tex | 54 - Master/texmf-dist/tex/context/base/meta-nav.mkii | 65 + Master/texmf-dist/tex/context/base/meta-nav.tex | 65 - Master/texmf-dist/tex/context/base/meta-pdf.lua | 71 +- Master/texmf-dist/tex/context/base/meta-pdf.mkii | 8 +- Master/texmf-dist/tex/context/base/meta-pdf.mkiv | 2 +- Master/texmf-dist/tex/context/base/meta-pdh.lua | 25 +- Master/texmf-dist/tex/context/base/meta-pdh.mkiv | 16 +- Master/texmf-dist/tex/context/base/meta-pre.mkii | 68 + Master/texmf-dist/tex/context/base/meta-pre.tex | 68 - Master/texmf-dist/tex/context/base/meta-tex.lua | 38 + Master/texmf-dist/tex/context/base/meta-tex.mkiv | 117 +- Master/texmf-dist/tex/context/base/meta-txt.mkii | 304 + Master/texmf-dist/tex/context/base/meta-txt.tex | 304 - Master/texmf-dist/tex/context/base/meta-xml.mkii | 29 + Master/texmf-dist/tex/context/base/meta-xml.mkiv | 20 + Master/texmf-dist/tex/context/base/meta-xml.tex | 29 - Master/texmf-dist/tex/context/base/metatex.lus | 9 + Master/texmf-dist/tex/context/base/metatex.tex | 25 +- Master/texmf-dist/tex/context/base/mlib-ctx.lua | 36 +- Master/texmf-dist/tex/context/base/mlib-pdf.lua | 275 +- Master/texmf-dist/tex/context/base/mlib-pdf.mkiv | 11 +- Master/texmf-dist/tex/context/base/mlib-pps.lua | 1058 +- Master/texmf-dist/tex/context/base/mlib-pps.mkiv | 40 +- Master/texmf-dist/tex/context/base/mlib-run.lua | 313 +- .../tex/context/base/mtx-context-arrange.tex | 5 - .../tex/context/base/mtx-context-listing.tex | 16 +- .../tex/context/base/mtx-context-select.tex | 109 + Master/texmf-dist/tex/context/base/mult-aux.lua | 147 + Master/texmf-dist/tex/context/base/mult-aux.mkii | 152 + Master/texmf-dist/tex/context/base/mult-aux.mkiv | 269 + Master/texmf-dist/tex/context/base/mult-chk.lua | 47 +- Master/texmf-dist/tex/context/base/mult-chk.mkiv | 3 +- Master/texmf-dist/tex/context/base/mult-cld.lua | 212 - Master/texmf-dist/tex/context/base/mult-cld.mkiv | 29 - Master/texmf-dist/tex/context/base/mult-clm.lua | 184 - Master/texmf-dist/tex/context/base/mult-com.mkii | 31 + Master/texmf-dist/tex/context/base/mult-com.tex | 31 - Master/texmf-dist/tex/context/base/mult-con.mkii | 53 + Master/texmf-dist/tex/context/base/mult-con.tex | 53 - Master/texmf-dist/tex/context/base/mult-de.mkii | 1715 ++ Master/texmf-dist/tex/context/base/mult-de.tex | 1693 -- Master/texmf-dist/tex/context/base/mult-def.lua | 151 +- Master/texmf-dist/tex/context/base/mult-def.mkii | 31 + Master/texmf-dist/tex/context/base/mult-def.mkiv | 33 + Master/texmf-dist/tex/context/base/mult-def.tex | 35 - Master/texmf-dist/tex/context/base/mult-en.mkii | 1715 ++ Master/texmf-dist/tex/context/base/mult-en.tex | 1693 -- Master/texmf-dist/tex/context/base/mult-fr.mkii | 1715 ++ Master/texmf-dist/tex/context/base/mult-fr.tex | 1693 -- Master/texmf-dist/tex/context/base/mult-fst.mkii | 36 + Master/texmf-dist/tex/context/base/mult-fst.mkiv | 41 + Master/texmf-dist/tex/context/base/mult-fst.tex | 53 - Master/texmf-dist/tex/context/base/mult-ini.lua | 240 +- Master/texmf-dist/tex/context/base/mult-ini.mkiv | 104 +- Master/texmf-dist/tex/context/base/mult-it.mkii | 1715 ++ Master/texmf-dist/tex/context/base/mult-it.tex | 1693 -- Master/texmf-dist/tex/context/base/mult-mcs.mkii | 210 + Master/texmf-dist/tex/context/base/mult-mcs.tex | 208 - Master/texmf-dist/tex/context/base/mult-mde.mkii | 210 + Master/texmf-dist/tex/context/base/mult-mde.tex | 208 - Master/texmf-dist/tex/context/base/mult-men.mkii | 210 + Master/texmf-dist/tex/context/base/mult-men.tex | 208 - Master/texmf-dist/tex/context/base/mult-mes.lua | 3783 ++--- Master/texmf-dist/tex/context/base/mult-mfr.mkii | 210 + Master/texmf-dist/tex/context/base/mult-mfr.tex | 208 - Master/texmf-dist/tex/context/base/mult-mit.mkii | 210 + Master/texmf-dist/tex/context/base/mult-mit.tex | 208 - Master/texmf-dist/tex/context/base/mult-mnl.mkii | 210 + Master/texmf-dist/tex/context/base/mult-mnl.tex | 208 - Master/texmf-dist/tex/context/base/mult-mno.mkii | 210 + Master/texmf-dist/tex/context/base/mult-mno.tex | 208 - Master/texmf-dist/tex/context/base/mult-mpe.mkii | 210 + Master/texmf-dist/tex/context/base/mult-mpe.tex | 208 - Master/texmf-dist/tex/context/base/mult-mro.mkii | 210 + Master/texmf-dist/tex/context/base/mult-mro.tex | 208 - Master/texmf-dist/tex/context/base/mult-nl.mkii | 1715 ++ Master/texmf-dist/tex/context/base/mult-nl.tex | 1693 -- Master/texmf-dist/tex/context/base/mult-pe.mkii | 1715 ++ Master/texmf-dist/tex/context/base/mult-ro.mkii | 1715 ++ Master/texmf-dist/tex/context/base/mult-ro.tex | 1693 -- Master/texmf-dist/tex/context/base/mult-sys.mkii | 892 ++ Master/texmf-dist/tex/context/base/mult-sys.mkiv | 912 ++ Master/texmf-dist/tex/context/base/mult-sys.tex | 882 -- Master/texmf-dist/tex/context/base/node-acc.lua | 113 + Master/texmf-dist/tex/context/base/node-aux.lua | 248 +- Master/texmf-dist/tex/context/base/node-bck.lua | 31 +- Master/texmf-dist/tex/context/base/node-bck.mkiv | 108 +- Master/texmf-dist/tex/context/base/node-dir.lua | 33 +- Master/texmf-dist/tex/context/base/node-dum.lua | 19 - Master/texmf-dist/tex/context/base/node-fin.lua | 108 +- Master/texmf-dist/tex/context/base/node-fin.mkiv | 10 +- Master/texmf-dist/tex/context/base/node-fnt.lua | 245 +- Master/texmf-dist/tex/context/base/node-ini.lua | 303 +- Master/texmf-dist/tex/context/base/node-ini.mkiv | 41 +- Master/texmf-dist/tex/context/base/node-inj.lua | 241 +- Master/texmf-dist/tex/context/base/node-mig.lua | 39 +- Master/texmf-dist/tex/context/base/node-mig.mkiv | 9 +- Master/texmf-dist/tex/context/base/node-pag.lua | 2 +- Master/texmf-dist/tex/context/base/node-par.lua | 63 +- Master/texmf-dist/tex/context/base/node-par.mkiv | 10 +- Master/texmf-dist/tex/context/base/node-pro.lua | 115 +- Master/texmf-dist/tex/context/base/node-ref.lua | 257 +- Master/texmf-dist/tex/context/base/node-res.lua | 288 +- Master/texmf-dist/tex/context/base/node-rul.lua | 247 +- Master/texmf-dist/tex/context/base/node-rul.mkiv | 159 +- Master/texmf-dist/tex/context/base/node-seq.lua | 186 - Master/texmf-dist/tex/context/base/node-ser.lua | 97 +- Master/texmf-dist/tex/context/base/node-shp.lua | 42 +- Master/texmf-dist/tex/context/base/node-spl.lua | 619 + Master/texmf-dist/tex/context/base/node-spl.mkiv | 114 + Master/texmf-dist/tex/context/base/node-tex.lua | 4 +- Master/texmf-dist/tex/context/base/node-tra.lua | 425 +- Master/texmf-dist/tex/context/base/node-tsk.lua | 207 +- Master/texmf-dist/tex/context/base/node-tst.lua | 75 +- Master/texmf-dist/tex/context/base/node-typ.lua | 25 +- Master/texmf-dist/tex/context/base/norm-alo.mkii | 36 + Master/texmf-dist/tex/context/base/norm-alo.tex | 36 - Master/texmf-dist/tex/context/base/norm-ctx.mkii | 16 + Master/texmf-dist/tex/context/base/norm-ctx.mkiv | 16 + Master/texmf-dist/tex/context/base/norm-ctx.tex | 16 - Master/texmf-dist/tex/context/base/norm-etx.mkii | 79 + Master/texmf-dist/tex/context/base/norm-etx.tex | 79 - Master/texmf-dist/tex/context/base/norm-ltx.mkii | 177 + Master/texmf-dist/tex/context/base/norm-ltx.tex | 177 - Master/texmf-dist/tex/context/base/norm-ptx.mkii | 132 + Master/texmf-dist/tex/context/base/norm-ptx.tex | 130 - Master/texmf-dist/tex/context/base/norm-tex.mkii | 351 + Master/texmf-dist/tex/context/base/norm-tex.tex | 351 - Master/texmf-dist/tex/context/base/norm-xtx.mkii | 18 + Master/texmf-dist/tex/context/base/norm-xtx.tex | 18 - Master/texmf-dist/tex/context/base/pack-box.mkii | 15 +- Master/texmf-dist/tex/context/base/pack-box.mkiv | 30 +- Master/texmf-dist/tex/context/base/pack-lyr.mkiv | 152 +- Master/texmf-dist/tex/context/base/pack-mis.mkvi | 84 + Master/texmf-dist/tex/context/base/pack-obj.lua | 18 +- Master/texmf-dist/tex/context/base/pack-obj.mkiv | 84 +- Master/texmf-dist/tex/context/base/pack-pos.mkiv | 151 + Master/texmf-dist/tex/context/base/pack-rul.lua | 37 +- Master/texmf-dist/tex/context/base/pack-rul.mkiv | 631 +- Master/texmf-dist/tex/context/base/page-app.mkiv | 70 +- Master/texmf-dist/tex/context/base/page-bck.mkiv | 29 +- Master/texmf-dist/tex/context/base/page-com.mkiv | 116 + Master/texmf-dist/tex/context/base/page-flt.lua | 115 +- Master/texmf-dist/tex/context/base/page-flt.mkiv | 95 +- Master/texmf-dist/tex/context/base/page-imp.mkii | 362 +- Master/texmf-dist/tex/context/base/page-imp.mkiv | 1134 +- Master/texmf-dist/tex/context/base/page-ini.mkiv | 135 +- Master/texmf-dist/tex/context/base/page-lay.mkii | 30 +- Master/texmf-dist/tex/context/base/page-lay.mkiv | 371 +- Master/texmf-dist/tex/context/base/page-lin.lua | 196 +- Master/texmf-dist/tex/context/base/page-lin.mkiv | 237 +- Master/texmf-dist/tex/context/base/page-mak.mkii | 4 - Master/texmf-dist/tex/context/base/page-mak.mkiv | 14 +- Master/texmf-dist/tex/context/base/page-mar.mkiv | 104 +- Master/texmf-dist/tex/context/base/page-mis.mkiv | 2 +- Master/texmf-dist/tex/context/base/page-mul.mkii | 8 +- Master/texmf-dist/tex/context/base/page-mul.mkiv | 110 +- Master/texmf-dist/tex/context/base/page-one.mkiv | 28 +- Master/texmf-dist/tex/context/base/page-par.mkiv | 10 +- Master/texmf-dist/tex/context/base/page-plg.mkiv | 2 +- Master/texmf-dist/tex/context/base/page-run.mkiv | 422 +- Master/texmf-dist/tex/context/base/page-sel.mkiv | 347 + Master/texmf-dist/tex/context/base/page-set.mkii | 15 + Master/texmf-dist/tex/context/base/page-set.mkiv | 122 +- Master/texmf-dist/tex/context/base/page-sid.mkii | 2 +- Master/texmf-dist/tex/context/base/page-sid.mkiv | 24 +- Master/texmf-dist/tex/context/base/page-spr.mkiv | 6 +- Master/texmf-dist/tex/context/base/page-str.lua | 39 +- Master/texmf-dist/tex/context/base/page-str.mkii | 45 - Master/texmf-dist/tex/context/base/page-str.mkiv | 12 +- Master/texmf-dist/tex/context/base/page-txt.mkiv | 114 +- Master/texmf-dist/tex/context/base/ppchtex.mkiv | 62 +- Master/texmf-dist/tex/context/base/pret-lua.lua | 319 - Master/texmf-dist/tex/context/base/pret-mp.lua | 236 - Master/texmf-dist/tex/context/base/pret-tex.lua | 87 - Master/texmf-dist/tex/context/base/pret-xml.lua | 136 - Master/texmf-dist/tex/context/base/prop-ini.mkiv | 140 +- Master/texmf-dist/tex/context/base/prop-lay.mkiv | 140 - Master/texmf-dist/tex/context/base/prop-mis.mkiv | 74 - Master/texmf-dist/tex/context/base/regi-8859-1.lua | 34 +- .../texmf-dist/tex/context/base/regi-8859-10.lua | 34 +- .../texmf-dist/tex/context/base/regi-8859-11.lua | 34 +- .../texmf-dist/tex/context/base/regi-8859-13.lua | 34 +- .../texmf-dist/tex/context/base/regi-8859-14.lua | 34 +- .../texmf-dist/tex/context/base/regi-8859-15.lua | 34 +- .../texmf-dist/tex/context/base/regi-8859-16.lua | 34 +- Master/texmf-dist/tex/context/base/regi-8859-2.lua | 34 +- Master/texmf-dist/tex/context/base/regi-8859-3.lua | 34 +- Master/texmf-dist/tex/context/base/regi-8859-4.lua | 34 +- Master/texmf-dist/tex/context/base/regi-8859-5.lua | 34 +- Master/texmf-dist/tex/context/base/regi-8859-6.lua | 34 +- Master/texmf-dist/tex/context/base/regi-8859-7.lua | 34 +- Master/texmf-dist/tex/context/base/regi-8859-8.lua | 34 +- Master/texmf-dist/tex/context/base/regi-8859-9.lua | 34 +- Master/texmf-dist/tex/context/base/regi-cp1250.lua | 34 +- Master/texmf-dist/tex/context/base/regi-cp1251.lua | 34 +- Master/texmf-dist/tex/context/base/regi-cp1252.lua | 34 +- Master/texmf-dist/tex/context/base/regi-cp1253.lua | 34 +- Master/texmf-dist/tex/context/base/regi-cp1254.lua | 34 +- Master/texmf-dist/tex/context/base/regi-cp1255.lua | 34 +- Master/texmf-dist/tex/context/base/regi-cp1256.lua | 34 +- Master/texmf-dist/tex/context/base/regi-cp1257.lua | 34 +- Master/texmf-dist/tex/context/base/regi-cp1258.lua | 34 +- Master/texmf-dist/tex/context/base/regi-demo.lua | 22 + Master/texmf-dist/tex/context/base/regi-ini.lua | 234 +- Master/texmf-dist/tex/context/base/regi-ini.mkiv | 66 +- Master/texmf-dist/tex/context/base/regi-syn.mkii | 73 + Master/texmf-dist/tex/context/base/regi-syn.tex | 73 - Master/texmf-dist/tex/context/base/s-abr-01.tex | 64 +- Master/texmf-dist/tex/context/base/s-abr-04.tex | 321 + Master/texmf-dist/tex/context/base/s-cdr-01.tex | 30 +- Master/texmf-dist/tex/context/base/s-chi-00.mkii | 76 + Master/texmf-dist/tex/context/base/s-chi-00.tex | 76 - Master/texmf-dist/tex/context/base/s-def-01.mkiv | 10 + Master/texmf-dist/tex/context/base/s-fnt-01.mkii | 61 + Master/texmf-dist/tex/context/base/s-fnt-01.tex | 61 - Master/texmf-dist/tex/context/base/s-fnt-02.mkii | 133 + Master/texmf-dist/tex/context/base/s-fnt-02.tex | 133 - Master/texmf-dist/tex/context/base/s-fnt-10.mkiv | 163 + Master/texmf-dist/tex/context/base/s-fnt-10.tex | 163 - Master/texmf-dist/tex/context/base/s-fnt-11.mkiv | 73 + Master/texmf-dist/tex/context/base/s-fnt-11.tex | 61 - Master/texmf-dist/tex/context/base/s-fnt-20.mkiv | 140 + Master/texmf-dist/tex/context/base/s-fnt-20.tex | 140 - Master/texmf-dist/tex/context/base/s-fnt-21.mkiv | 46 + Master/texmf-dist/tex/context/base/s-fnt-21.tex | 46 - Master/texmf-dist/tex/context/base/s-fnt-23.mkiv | 290 + Master/texmf-dist/tex/context/base/s-fnt-23.tex | 272 - Master/texmf-dist/tex/context/base/s-fnt-24.mkiv | 83 + Master/texmf-dist/tex/context/base/s-fnt-24.tex | 83 - Master/texmf-dist/tex/context/base/s-fnt-25.mkiv | 198 + Master/texmf-dist/tex/context/base/s-fnt-25.tex | 194 - Master/texmf-dist/tex/context/base/s-fnt-26.mkiv | 74 + Master/texmf-dist/tex/context/base/s-fnt-26.tex | 73 - Master/texmf-dist/tex/context/base/s-fnt-28.mkiv | 46 + Master/texmf-dist/tex/context/base/s-fnt-29.mkiv | 71 + Master/texmf-dist/tex/context/base/s-fnt-30.mkiv | 54 + Master/texmf-dist/tex/context/base/s-fnt-30.tex | 42 - Master/texmf-dist/tex/context/base/s-fnt-31.mkiv | 166 + Master/texmf-dist/tex/context/base/s-fnt-32.mkiv | 60 + Master/texmf-dist/tex/context/base/s-grk-00.mkii | 77 + Master/texmf-dist/tex/context/base/s-grk-00.tex | 77 - Master/texmf-dist/tex/context/base/s-inf-01.mkvi | 244 + Master/texmf-dist/tex/context/base/s-inf-01.tex | 203 - Master/texmf-dist/tex/context/base/s-inf-02.mkiv | 27 + Master/texmf-dist/tex/context/base/s-inf-02.tex | 27 - Master/texmf-dist/tex/context/base/s-inf-03.mkiv | 353 + Master/texmf-dist/tex/context/base/s-jap-00.mkii | 23 + Master/texmf-dist/tex/context/base/s-jap-00.tex | 23 - Master/texmf-dist/tex/context/base/s-lan-03.mkiv | 40 + Master/texmf-dist/tex/context/base/s-lan-04.mkiv | 153 + Master/texmf-dist/tex/context/base/s-map-10.mkii | 488 + Master/texmf-dist/tex/context/base/s-map-10.mkiv | 567 + Master/texmf-dist/tex/context/base/s-map-10.tex | 488 - Master/texmf-dist/tex/context/base/s-mod-00.mkii | 511 + Master/texmf-dist/tex/context/base/s-mod-00.mkiv | 481 + Master/texmf-dist/tex/context/base/s-mod-00.tex | 512 - Master/texmf-dist/tex/context/base/s-mod-01.mkii | 155 + Master/texmf-dist/tex/context/base/s-mod-01.mkiv | 146 + Master/texmf-dist/tex/context/base/s-mod-01.tex | 157 - Master/texmf-dist/tex/context/base/s-mod-02.mkii | 421 + Master/texmf-dist/tex/context/base/s-mod-02.mkiv | 423 + Master/texmf-dist/tex/context/base/s-mod-02.tex | 420 - Master/texmf-dist/tex/context/base/s-pre-14.tex | 1 - Master/texmf-dist/tex/context/base/s-pre-18.tex | 114 +- Master/texmf-dist/tex/context/base/s-pre-22.tex | 102 +- Master/texmf-dist/tex/context/base/s-pre-30.mkii | 258 + Master/texmf-dist/tex/context/base/s-pre-30.mkiv | 257 + Master/texmf-dist/tex/context/base/s-pre-30.tex | 258 - Master/texmf-dist/tex/context/base/s-pre-50.tex | 2 +- Master/texmf-dist/tex/context/base/s-pre-60.mkii | 143 + Master/texmf-dist/tex/context/base/s-pre-60.mkiv | 134 + Master/texmf-dist/tex/context/base/s-pre-60.tex | 159 - Master/texmf-dist/tex/context/base/s-pre-61.tex | 2 +- Master/texmf-dist/tex/context/base/s-pre-62.tex | 39 +- Master/texmf-dist/tex/context/base/s-pre-63.tex | 7 +- Master/texmf-dist/tex/context/base/s-pre-64.tex | 53 +- Master/texmf-dist/tex/context/base/s-pre-66.tex | 28 + Master/texmf-dist/tex/context/base/s-pre-67.tex | 15 +- Master/texmf-dist/tex/context/base/s-pre-68.tex | 150 + Master/texmf-dist/tex/context/base/s-pre-69.mkiv | 335 + Master/texmf-dist/tex/context/base/s-pre-70.mkiv | 172 + Master/texmf-dist/tex/context/base/s-pre-70.tex | 170 - Master/texmf-dist/tex/context/base/s-pre-71.lua | 63 + Master/texmf-dist/tex/context/base/s-pre-71.mkii | 213 + Master/texmf-dist/tex/context/base/s-pre-71.mkiv | 170 + Master/texmf-dist/tex/context/base/s-pre-71.tex | 210 - Master/texmf-dist/tex/context/base/s-pre-93.tex | 2 - Master/texmf-dist/tex/context/base/s-pre-96.tex | 188 + Master/texmf-dist/tex/context/base/s-reg-01.mkiv | 60 + Master/texmf-dist/tex/context/base/s-reg-01.tex | 50 - Master/texmf-dist/tex/context/base/s-set-31.mkiv | 118 + Master/texmf-dist/tex/context/base/s-sys-01.tex | 61 - Master/texmf-dist/tex/context/base/scrn-bar.mkiv | 398 - Master/texmf-dist/tex/context/base/scrn-bar.mkvi | 405 + Master/texmf-dist/tex/context/base/scrn-but.lua | 19 + Master/texmf-dist/tex/context/base/scrn-but.mkiv | 127 - Master/texmf-dist/tex/context/base/scrn-but.mkvi | 995 ++ Master/texmf-dist/tex/context/base/scrn-fld.lua | 76 + Master/texmf-dist/tex/context/base/scrn-fld.mkiv | 686 - Master/texmf-dist/tex/context/base/scrn-fld.mkvi | 972 ++ Master/texmf-dist/tex/context/base/scrn-hlp.lua | 120 + Master/texmf-dist/tex/context/base/scrn-hlp.mkiv | 179 - Master/texmf-dist/tex/context/base/scrn-hlp.mkvi | 162 + Master/texmf-dist/tex/context/base/scrn-ini.lua | 30 + Master/texmf-dist/tex/context/base/scrn-ini.mkvi | 178 + Master/texmf-dist/tex/context/base/scrn-int.lua | 111 - Master/texmf-dist/tex/context/base/scrn-int.mkiv | 610 - Master/texmf-dist/tex/context/base/scrn-men.mkiv | 615 - Master/texmf-dist/tex/context/base/scrn-nav.mkiv | 256 - Master/texmf-dist/tex/context/base/scrn-pag.lua | 27 + Master/texmf-dist/tex/context/base/scrn-pag.mkvi | 249 + Master/texmf-dist/tex/context/base/scrn-ref.lua | 65 + Master/texmf-dist/tex/context/base/scrn-ref.mkvi | 90 + Master/texmf-dist/tex/context/base/scrn-wid.lua | 194 + Master/texmf-dist/tex/context/base/scrn-wid.mkvi | 702 + Master/texmf-dist/tex/context/base/scrp-cjk.lua | 237 +- Master/texmf-dist/tex/context/base/scrp-eth.lua | 151 + Master/texmf-dist/tex/context/base/scrp-ini.lua | 250 +- Master/texmf-dist/tex/context/base/scrp-ini.mkiv | 79 +- Master/texmf-dist/tex/context/base/sort-ini.lua | 815 +- Master/texmf-dist/tex/context/base/sort-lan.lua | 1091 +- Master/texmf-dist/tex/context/base/spac-ali.lua | 132 + Master/texmf-dist/tex/context/base/spac-ali.mkiv | 209 +- Master/texmf-dist/tex/context/base/spac-gen.mkii | 15 + Master/texmf-dist/tex/context/base/spac-grd.mkiv | 66 +- Master/texmf-dist/tex/context/base/spac-hor.lua | 1 - Master/texmf-dist/tex/context/base/spac-hor.mkiv | 139 +- Master/texmf-dist/tex/context/base/spac-pag.mkiv | 16 +- Master/texmf-dist/tex/context/base/spac-par.lua | 59 + Master/texmf-dist/tex/context/base/spac-par.mkiv | 31 +- Master/texmf-dist/tex/context/base/spac-ver.lua | 839 +- Master/texmf-dist/tex/context/base/spac-ver.mkiv | 398 +- Master/texmf-dist/tex/context/base/spec-dpm.mkii | 4 +- Master/texmf-dist/tex/context/base/spec-dpx.mkii | 4 +- Master/texmf-dist/tex/context/base/spec-dvi.mkii | 4 +- Master/texmf-dist/tex/context/base/spec-mis.mkii | 4 +- Master/texmf-dist/tex/context/base/spec-pdf.mkii | 4 +- Master/texmf-dist/tex/context/base/spec-tst.mkii | 4 - Master/texmf-dist/tex/context/base/spec-win.mkii | 4 +- Master/texmf-dist/tex/context/base/spec-xtx.mkii | 4 +- .../texmf-dist/tex/context/base/status-files.pdf | Bin 0 -> 23577 bytes Master/texmf-dist/tex/context/base/status-lua.pdf | Bin 0 -> 154401 bytes Master/texmf-dist/tex/context/base/strc-bkm.lua | 153 +- Master/texmf-dist/tex/context/base/strc-bkm.mkiv | 60 +- Master/texmf-dist/tex/context/base/strc-blk.lua | 72 +- Master/texmf-dist/tex/context/base/strc-blk.mkiv | 21 +- Master/texmf-dist/tex/context/base/strc-def.mkiv | 28 +- Master/texmf-dist/tex/context/base/strc-des.mkiv | 125 +- Master/texmf-dist/tex/context/base/strc-doc.lua | 307 +- Master/texmf-dist/tex/context/base/strc-doc.mkiv | 50 +- Master/texmf-dist/tex/context/base/strc-flt.mkii | 48 +- Master/texmf-dist/tex/context/base/strc-flt.mkiv | 280 +- Master/texmf-dist/tex/context/base/strc-ini.lua | 143 +- Master/texmf-dist/tex/context/base/strc-ini.mkiv | 14 +- Master/texmf-dist/tex/context/base/strc-itm.lua | 7 +- Master/texmf-dist/tex/context/base/strc-itm.mkiv | 163 +- Master/texmf-dist/tex/context/base/strc-lev.lua | 46 + Master/texmf-dist/tex/context/base/strc-lev.mkiv | 92 + Master/texmf-dist/tex/context/base/strc-lnt.mkiv | 73 +- Master/texmf-dist/tex/context/base/strc-lst.lua | 296 +- Master/texmf-dist/tex/context/base/strc-lst.mkiv | 315 +- Master/texmf-dist/tex/context/base/strc-mar.lua | 613 +- Master/texmf-dist/tex/context/base/strc-mar.mkiv | 549 +- Master/texmf-dist/tex/context/base/strc-mat.lua | 22 +- Master/texmf-dist/tex/context/base/strc-mat.mkiv | 123 +- Master/texmf-dist/tex/context/base/strc-not.lua | 156 +- Master/texmf-dist/tex/context/base/strc-not.mkii | 4 +- Master/texmf-dist/tex/context/base/strc-not.mkiv | 306 +- Master/texmf-dist/tex/context/base/strc-num.lua | 227 +- Master/texmf-dist/tex/context/base/strc-num.mkiv | 110 +- Master/texmf-dist/tex/context/base/strc-pag.lua | 131 +- Master/texmf-dist/tex/context/base/strc-pag.mkiv | 60 +- Master/texmf-dist/tex/context/base/strc-prc.mkiv | 4 +- Master/texmf-dist/tex/context/base/strc-ref.lua | 849 +- Master/texmf-dist/tex/context/base/strc-ref.mkii | 18 +- Master/texmf-dist/tex/context/base/strc-ref.mkiv | 804 +- Master/texmf-dist/tex/context/base/strc-reg.lua | 699 +- Master/texmf-dist/tex/context/base/strc-reg.mkiv | 616 +- Master/texmf-dist/tex/context/base/strc-ren.mkiv | 174 +- Master/texmf-dist/tex/context/base/strc-sbe.mkiv | 18 +- Master/texmf-dist/tex/context/base/strc-sec.mkiv | 387 +- Master/texmf-dist/tex/context/base/strc-syn.lua | 87 +- Master/texmf-dist/tex/context/base/strc-syn.mkiv | 62 +- Master/texmf-dist/tex/context/base/strc-tag.lua | 251 + Master/texmf-dist/tex/context/base/strc-tag.mkiv | 220 + Master/texmf-dist/tex/context/base/strc-xml.mkiv | 8 +- Master/texmf-dist/tex/context/base/supp-ali.mkii | 173 + Master/texmf-dist/tex/context/base/supp-ali.mkiv | 173 + Master/texmf-dist/tex/context/base/supp-ali.tex | 173 - Master/texmf-dist/tex/context/base/supp-box.lua | 110 + Master/texmf-dist/tex/context/base/supp-box.mkii | 3126 ++++ Master/texmf-dist/tex/context/base/supp-box.mkiv | 2501 +++ Master/texmf-dist/tex/context/base/supp-box.tex | 3126 ---- Master/texmf-dist/tex/context/base/supp-dir.mkiv | 11 + Master/texmf-dist/tex/context/base/supp-fil.lua | 243 +- Master/texmf-dist/tex/context/base/supp-fil.mkiv | 66 +- Master/texmf-dist/tex/context/base/supp-fun.mkii | 746 + Master/texmf-dist/tex/context/base/supp-fun.mkiv | 746 + Master/texmf-dist/tex/context/base/supp-fun.tex | 746 - Master/texmf-dist/tex/context/base/supp-lat.mkii | 59 + Master/texmf-dist/tex/context/base/supp-mat.mkiv | 150 +- Master/texmf-dist/tex/context/base/supp-mpe.mkii | 2 +- Master/texmf-dist/tex/context/base/supp-num.mkii | 422 + Master/texmf-dist/tex/context/base/supp-num.mkiv | 504 + Master/texmf-dist/tex/context/base/supp-num.tex | 443 - Master/texmf-dist/tex/context/base/supp-pat.mkii | 4 - Master/texmf-dist/tex/context/base/supp-pdf.mkii | 10 +- Master/texmf-dist/tex/context/base/supp-ran.lua | 9 +- Master/texmf-dist/tex/context/base/supp-ran.mkiv | 16 +- Master/texmf-dist/tex/context/base/supp-vis.mkii | 1907 +++ Master/texmf-dist/tex/context/base/supp-vis.mkiv | 1907 +++ Master/texmf-dist/tex/context/base/supp-vis.tex | 1907 --- Master/texmf-dist/tex/context/base/symb-cow.mkii | 132 + Master/texmf-dist/tex/context/base/symb-cow.mkiv | 130 + Master/texmf-dist/tex/context/base/symb-cow.tex | 132 - Master/texmf-dist/tex/context/base/symb-eur.mkii | 64 + Master/texmf-dist/tex/context/base/symb-eur.mkiv | 52 + Master/texmf-dist/tex/context/base/symb-eur.tex | 64 - Master/texmf-dist/tex/context/base/symb-glm.mkii | 79 + Master/texmf-dist/tex/context/base/symb-glm.tex | 79 - Master/texmf-dist/tex/context/base/symb-ini.lua | 38 + Master/texmf-dist/tex/context/base/symb-ini.mkii | 13 +- Master/texmf-dist/tex/context/base/symb-ini.mkiv | 56 +- Master/texmf-dist/tex/context/base/symb-jmn.mkii | 199 + Master/texmf-dist/tex/context/base/symb-jmn.mkiv | 196 + Master/texmf-dist/tex/context/base/symb-jmn.tex | 204 - Master/texmf-dist/tex/context/base/symb-mis.mkii | 139 + Master/texmf-dist/tex/context/base/symb-mis.mkiv | 76 + Master/texmf-dist/tex/context/base/symb-mis.tex | 139 - Master/texmf-dist/tex/context/base/symb-mvs.mkii | 217 + Master/texmf-dist/tex/context/base/symb-mvs.mkiv | 263 + Master/texmf-dist/tex/context/base/symb-mvs.tex | 217 - Master/texmf-dist/tex/context/base/symb-nav.mkii | 122 + Master/texmf-dist/tex/context/base/symb-nav.mkiv | 129 + Master/texmf-dist/tex/context/base/symb-nav.tex | 126 - Master/texmf-dist/tex/context/base/symb-run.mkiv | 75 +- Master/texmf-dist/tex/context/base/symb-uni.mkii | 1123 ++ Master/texmf-dist/tex/context/base/symb-uni.tex | 1123 -- Master/texmf-dist/tex/context/base/symb-was.mkii | 207 + Master/texmf-dist/tex/context/base/symb-was.tex | 205 - Master/texmf-dist/tex/context/base/syst-aux.mkiv | 1503 +- Master/texmf-dist/tex/context/base/syst-con.lua | 26 +- Master/texmf-dist/tex/context/base/syst-con.mkiv | 34 +- Master/texmf-dist/tex/context/base/syst-ext.mkii | 12 +- Master/texmf-dist/tex/context/base/syst-ini.mkii | 923 ++ Master/texmf-dist/tex/context/base/syst-ini.mkiv | 933 ++ Master/texmf-dist/tex/context/base/syst-ini.tex | 888 -- Master/texmf-dist/tex/context/base/syst-ltx.tex | 56 - Master/texmf-dist/tex/context/base/syst-lua.lua | 52 +- Master/texmf-dist/tex/context/base/syst-lua.mkiv | 18 +- Master/texmf-dist/tex/context/base/syst-mes.mkiv | 22 + Master/texmf-dist/tex/context/base/syst-pln.mkii | 118 + Master/texmf-dist/tex/context/base/syst-pln.mkiv | 120 + Master/texmf-dist/tex/context/base/syst-pln.tex | 118 - Master/texmf-dist/tex/context/base/syst-str.mkiv | 36 - Master/texmf-dist/tex/context/base/tabl-ltb.mkiv | 100 +- Master/texmf-dist/tex/context/base/tabl-ntb.mkii | 8 +- Master/texmf-dist/tex/context/base/tabl-ntb.mkiv | 188 +- Master/texmf-dist/tex/context/base/tabl-nte.mkiv | 8 +- Master/texmf-dist/tex/context/base/tabl-pln.mkiv | 8 +- Master/texmf-dist/tex/context/base/tabl-tab.mkiv | 3509 ++--- Master/texmf-dist/tex/context/base/tabl-tbl.lua | 37 + Master/texmf-dist/tex/context/base/tabl-tbl.mkiv | 1433 +- Master/texmf-dist/tex/context/base/tabl-tsp.mkiv | 55 +- Master/texmf-dist/tex/context/base/task-ini.lua | 211 +- Master/texmf-dist/tex/context/base/thrd-pic.mkii | 3694 +++++ Master/texmf-dist/tex/context/base/thrd-pic.tex | 3694 ----- Master/texmf-dist/tex/context/base/thrd-tab.mkii | 2006 +++ Master/texmf-dist/tex/context/base/thrd-tab.tex | 2006 --- Master/texmf-dist/tex/context/base/toks-ini.lua | 294 +- Master/texmf-dist/tex/context/base/toks-ini.mkiv | 20 +- Master/texmf-dist/tex/context/base/trac-deb.lua | 283 +- Master/texmf-dist/tex/context/base/trac-deb.mkiv | 26 +- Master/texmf-dist/tex/context/base/trac-inf.lua | 189 +- Master/texmf-dist/tex/context/base/trac-lmx.lua | 18 +- Master/texmf-dist/tex/context/base/trac-log.lua | 687 +- Master/texmf-dist/tex/context/base/trac-pro.lua | 208 + Master/texmf-dist/tex/context/base/trac-set.lua | 330 + Master/texmf-dist/tex/context/base/trac-tex.lua | 74 + Master/texmf-dist/tex/context/base/trac-tex.mkiv | 21 +- Master/texmf-dist/tex/context/base/trac-tim.lua | 22 +- Master/texmf-dist/tex/context/base/trac-tra.lua | 341 - Master/texmf-dist/tex/context/base/trac-vis.mkiv | 8 +- Master/texmf-dist/tex/context/base/type-ghz.mkiv | 24 +- Master/texmf-dist/tex/context/base/type-ini.lua | 31 + Master/texmf-dist/tex/context/base/type-ini.mkii | 9 +- Master/texmf-dist/tex/context/base/type-ini.mkiv | 173 +- Master/texmf-dist/tex/context/base/type-one.mkii | 6 +- Master/texmf-dist/tex/context/base/type-otf.mkii | 476 +- Master/texmf-dist/tex/context/base/type-otf.mkiv | 417 +- Master/texmf-dist/tex/context/base/type-run.mkiv | 2 +- Master/texmf-dist/tex/context/base/type-set.mkii | 8 +- Master/texmf-dist/tex/context/base/type-set.mkiv | 14 +- Master/texmf-dist/tex/context/base/type-siz.mkiv | 2 +- Master/texmf-dist/tex/context/base/typo-brk.lua | 128 +- Master/texmf-dist/tex/context/base/typo-brk.mkiv | 14 +- Master/texmf-dist/tex/context/base/typo-cap.lua | 203 +- Master/texmf-dist/tex/context/base/typo-cap.mkiv | 18 +- Master/texmf-dist/tex/context/base/typo-cln.lua | 91 + Master/texmf-dist/tex/context/base/typo-cln.mkiv | 30 + Master/texmf-dist/tex/context/base/typo-dig.lua | 142 +- Master/texmf-dist/tex/context/base/typo-dig.mkiv | 25 +- Master/texmf-dist/tex/context/base/typo-dir.lua | 455 + Master/texmf-dist/tex/context/base/typo-dir.mkiv | 143 + Master/texmf-dist/tex/context/base/typo-ini.lua | 9 + Master/texmf-dist/tex/context/base/typo-ini.mkiv | 7 + Master/texmf-dist/tex/context/base/typo-krn.lua | 204 +- Master/texmf-dist/tex/context/base/typo-krn.mkiv | 22 +- Master/texmf-dist/tex/context/base/typo-mar.lua | 579 + Master/texmf-dist/tex/context/base/typo-mar.mkiv | 351 + Master/texmf-dist/tex/context/base/typo-mir.lua | 419 - Master/texmf-dist/tex/context/base/typo-mir.mkiv | 144 - Master/texmf-dist/tex/context/base/typo-rep.lua | 79 +- Master/texmf-dist/tex/context/base/typo-rep.mkiv | 8 +- Master/texmf-dist/tex/context/base/typo-spa.lua | 138 +- Master/texmf-dist/tex/context/base/typo-spa.mkiv | 16 +- Master/texmf-dist/tex/context/base/unic-003.mkii | 2 +- Master/texmf-dist/tex/context/base/unic-004.mkii | 6 +- Master/texmf-dist/tex/context/base/unic-ini.lua | 19 + Master/texmf-dist/tex/context/base/unic-ini.mkii | 12 +- Master/texmf-dist/tex/context/base/unic-ini.mkiv | 20 +- Master/texmf-dist/tex/context/base/unic-run.mkii | 12 +- Master/texmf-dist/tex/context/base/util-deb.lua | 157 + Master/texmf-dist/tex/context/base/util-dim.lua | 436 + Master/texmf-dist/tex/context/base/util-fmt.lua | 96 + Master/texmf-dist/tex/context/base/util-lua.lua | 48 + Master/texmf-dist/tex/context/base/util-mrg.lua | 138 + Master/texmf-dist/tex/context/base/util-pck.lua | 142 + Master/texmf-dist/tex/context/base/util-prs.lua | 229 + Master/texmf-dist/tex/context/base/util-seq.lua | 276 + Master/texmf-dist/tex/context/base/util-sto.lua | 168 + Master/texmf-dist/tex/context/base/util-str.lua | 107 + Master/texmf-dist/tex/context/base/util-tab.lua | 105 + Master/texmf-dist/tex/context/base/x-asciimath.lua | 21 +- .../texmf-dist/tex/context/base/x-asciimath.mkiv | 8 +- Master/texmf-dist/tex/context/base/x-calcmath.lua | 19 +- Master/texmf-dist/tex/context/base/x-calcmath.mkiv | 29 +- Master/texmf-dist/tex/context/base/x-cals.lua | 6 +- Master/texmf-dist/tex/context/base/x-cals.mkiv | 6 +- Master/texmf-dist/tex/context/base/x-chemml.lua | 51 + Master/texmf-dist/tex/context/base/x-chemml.mkiv | 88 +- Master/texmf-dist/tex/context/base/x-chemml.tex | 16 - Master/texmf-dist/tex/context/base/x-css.lua | 94 + Master/texmf-dist/tex/context/base/x-css.mkiv | 39 + Master/texmf-dist/tex/context/base/x-ct.mkiv | 2 +- Master/texmf-dist/tex/context/base/x-dir-05.mkiv | 2 + Master/texmf-dist/tex/context/base/x-fdf-00.mkii | 41 + Master/texmf-dist/tex/context/base/x-fdf-00.tex | 41 - Master/texmf-dist/tex/context/base/x-fig-00.mkii | 252 + Master/texmf-dist/tex/context/base/x-fig-00.tex | 252 - Master/texmf-dist/tex/context/base/x-fig-01.mkii | 461 + Master/texmf-dist/tex/context/base/x-fig-01.tex | 461 - Master/texmf-dist/tex/context/base/x-fig-02.mkii | 78 + Master/texmf-dist/tex/context/base/x-fig-02.tex | 78 - Master/texmf-dist/tex/context/base/x-fig-03.mkii | 44 + Master/texmf-dist/tex/context/base/x-fig-03.tex | 44 - Master/texmf-dist/tex/context/base/x-fo.mkii | 2 - Master/texmf-dist/tex/context/base/x-ldx.lua | 326 + Master/texmf-dist/tex/context/base/x-ldx.mkiv | 186 + Master/texmf-dist/tex/context/base/x-ldx.tex | 191 - Master/texmf-dist/tex/context/base/x-mathml.lua | 520 +- Master/texmf-dist/tex/context/base/x-mathml.mkiv | 304 +- Master/texmf-dist/tex/context/base/x-mathml.tex | 16 - Master/texmf-dist/tex/context/base/x-newcml.mkii | 456 + Master/texmf-dist/tex/context/base/x-newcml.tex | 456 - Master/texmf-dist/tex/context/base/x-newmme.mkii | 423 + Master/texmf-dist/tex/context/base/x-newmme.tex | 423 - Master/texmf-dist/tex/context/base/x-newmml.tex | 16 - Master/texmf-dist/tex/context/base/x-newmmo.mkii | 210 + Master/texmf-dist/tex/context/base/x-newmmo.tex | 210 - Master/texmf-dist/tex/context/base/x-newpml.mkii | 250 + Master/texmf-dist/tex/context/base/x-newpml.tex | 250 - Master/texmf-dist/tex/context/base/x-openmath.mkii | 4 + Master/texmf-dist/tex/context/base/x-openmath.tex | 4 - Master/texmf-dist/tex/context/base/x-pending.mkiv | 39 - Master/texmf-dist/tex/context/base/x-physml.tex | 16 - Master/texmf-dist/tex/context/base/x-res-00.mkii | 67 + Master/texmf-dist/tex/context/base/x-res-00.tex | 67 - Master/texmf-dist/tex/context/base/x-res-01.mkii | 487 + Master/texmf-dist/tex/context/base/x-res-01.mkiv | 428 + Master/texmf-dist/tex/context/base/x-res-01.tex | 487 - Master/texmf-dist/tex/context/base/x-res-02.mkii | 72 + Master/texmf-dist/tex/context/base/x-res-02.tex | 72 - Master/texmf-dist/tex/context/base/x-res-03.mkii | 44 + Master/texmf-dist/tex/context/base/x-res-03.tex | 44 - Master/texmf-dist/tex/context/base/x-res-04.mkii | 336 + Master/texmf-dist/tex/context/base/x-res-04.tex | 336 - Master/texmf-dist/tex/context/base/x-res-08.mkii | 129 + Master/texmf-dist/tex/context/base/x-res-08.tex | 131 - Master/texmf-dist/tex/context/base/x-res-09.mkii | 69 + Master/texmf-dist/tex/context/base/x-res-09.tex | 69 - Master/texmf-dist/tex/context/base/x-res-10.mkii | 75 + Master/texmf-dist/tex/context/base/x-res-10.tex | 75 - Master/texmf-dist/tex/context/base/x-res-11.mkii | 110 + Master/texmf-dist/tex/context/base/x-res-11.tex | 110 - Master/texmf-dist/tex/context/base/x-res-12.mkii | 53 + Master/texmf-dist/tex/context/base/x-res-12.tex | 53 - Master/texmf-dist/tex/context/base/x-res-20.mkii | 231 + Master/texmf-dist/tex/context/base/x-res-20.tex | 231 - Master/texmf-dist/tex/context/base/x-res-50.mkii | 427 + Master/texmf-dist/tex/context/base/x-res-50.mkiv | 431 + Master/texmf-dist/tex/context/base/x-res-50.tex | 425 - Master/texmf-dist/tex/context/base/x-sch-00.mkii | 382 + Master/texmf-dist/tex/context/base/x-sch-00.tex | 382 - Master/texmf-dist/tex/context/base/x-sch-01.mkii | 122 + Master/texmf-dist/tex/context/base/x-sch-01.tex | 122 - Master/texmf-dist/tex/context/base/x-set-01.mkii | 79 + Master/texmf-dist/tex/context/base/x-set-01.tex | 79 - Master/texmf-dist/tex/context/base/x-set-02.mkii | 30 + Master/texmf-dist/tex/context/base/x-set-02.tex | 30 - Master/texmf-dist/tex/context/base/x-set-11.mkii | 266 +- Master/texmf-dist/tex/context/base/x-set-11.mkiv | 305 +- Master/texmf-dist/tex/context/base/x-set-11.tex | 110 - Master/texmf-dist/tex/context/base/x-set-12.mkii | 258 + Master/texmf-dist/tex/context/base/x-set-12.mkiv | 258 + Master/texmf-dist/tex/context/base/x-set-12.tex | 258 - Master/texmf-dist/tex/context/base/x-set-99.tex | 283 - Master/texmf-dist/tex/context/base/x-steps.mkii | 85 + Master/texmf-dist/tex/context/base/x-steps.mkiv | 99 + Master/texmf-dist/tex/context/base/x-xml-01.mkii | 91 + Master/texmf-dist/tex/context/base/x-xml-01.tex | 91 - Master/texmf-dist/tex/context/base/x-xml-02.mkii | 91 + Master/texmf-dist/tex/context/base/x-xml-02.tex | 91 - Master/texmf-dist/tex/context/base/x-xml-11.mkii | 134 + Master/texmf-dist/tex/context/base/x-xml-11.tex | 134 - Master/texmf-dist/tex/context/base/x-xtag.mkiv | 19 +- Master/texmf-dist/tex/context/base/xetx-utf.mkii | 5 + Master/texmf-dist/tex/context/base/xtag-cml.mkii | 228 + Master/texmf-dist/tex/context/base/xtag-cml.tex | 228 - Master/texmf-dist/tex/context/base/xtag-ent.mkii | 117 + Master/texmf-dist/tex/context/base/xtag-ent.tex | 117 - Master/texmf-dist/tex/context/base/xtag-exp.mkii | 88 + Master/texmf-dist/tex/context/base/xtag-exp.tex | 88 - Master/texmf-dist/tex/context/base/xtag-ext.mkii | 439 + Master/texmf-dist/tex/context/base/xtag-ext.tex | 439 - Master/texmf-dist/tex/context/base/xtag-hyp.mkii | 69 + Master/texmf-dist/tex/context/base/xtag-hyp.tex | 69 - Master/texmf-dist/tex/context/base/xtag-ini.mkii | 3023 ++++ Master/texmf-dist/tex/context/base/xtag-ini.tex | 2999 ---- Master/texmf-dist/tex/context/base/xtag-map.mkii | 746 + Master/texmf-dist/tex/context/base/xtag-map.tex | 746 - Master/texmf-dist/tex/context/base/xtag-mea.mkii | 152 + Master/texmf-dist/tex/context/base/xtag-mea.tex | 152 - Master/texmf-dist/tex/context/base/xtag-meb.mkii | 124 + Master/texmf-dist/tex/context/base/xtag-meb.tex | 124 - Master/texmf-dist/tex/context/base/xtag-mec.mkii | 28 + Master/texmf-dist/tex/context/base/xtag-mec.tex | 28 - Master/texmf-dist/tex/context/base/xtag-meh.mkii | 166 + Master/texmf-dist/tex/context/base/xtag-meh.tex | 166 - Master/texmf-dist/tex/context/base/xtag-men.mkii | 98 + Master/texmf-dist/tex/context/base/xtag-men.tex | 98 - Master/texmf-dist/tex/context/base/xtag-meo.mkii | 58 + Master/texmf-dist/tex/context/base/xtag-meo.tex | 58 - Master/texmf-dist/tex/context/base/xtag-mer.mkii | 185 + Master/texmf-dist/tex/context/base/xtag-mer.tex | 185 - Master/texmf-dist/tex/context/base/xtag-mmc.mkii | 1265 ++ Master/texmf-dist/tex/context/base/xtag-mmc.tex | 1265 -- Master/texmf-dist/tex/context/base/xtag-mml.mkii | 515 + Master/texmf-dist/tex/context/base/xtag-mml.tex | 515 - Master/texmf-dist/tex/context/base/xtag-mmp.mkii | 553 + Master/texmf-dist/tex/context/base/xtag-mmp.tex | 553 - Master/texmf-dist/tex/context/base/xtag-mxa.mkii | 101 + Master/texmf-dist/tex/context/base/xtag-mxa.tex | 101 - Master/texmf-dist/tex/context/base/xtag-mxb.mkii | 55 + Master/texmf-dist/tex/context/base/xtag-mxb.tex | 55 - Master/texmf-dist/tex/context/base/xtag-mxc.mkii | 10 + Master/texmf-dist/tex/context/base/xtag-mxc.tex | 10 - Master/texmf-dist/tex/context/base/xtag-mxh.mkii | 67 + Master/texmf-dist/tex/context/base/xtag-mxh.tex | 67 - Master/texmf-dist/tex/context/base/xtag-mxn.mkii | 84 + Master/texmf-dist/tex/context/base/xtag-mxn.tex | 84 - Master/texmf-dist/tex/context/base/xtag-mxo.mkii | 14 + Master/texmf-dist/tex/context/base/xtag-mxo.tex | 14 - Master/texmf-dist/tex/context/base/xtag-mxr.mkii | 112 + Master/texmf-dist/tex/context/base/xtag-mxr.tex | 112 - Master/texmf-dist/tex/context/base/xtag-pml.mkii | 85 + Master/texmf-dist/tex/context/base/xtag-pml.tex | 85 - Master/texmf-dist/tex/context/base/xtag-pmu.mkii | 188 + Master/texmf-dist/tex/context/base/xtag-pmu.tex | 188 - Master/texmf-dist/tex/context/base/xtag-pre.mkii | 435 + Master/texmf-dist/tex/context/base/xtag-pre.tex | 435 - Master/texmf-dist/tex/context/base/xtag-prs.mkii | 42 + Master/texmf-dist/tex/context/base/xtag-prs.tex | 42 - Master/texmf-dist/tex/context/base/xtag-raw.mkii | 37 + Master/texmf-dist/tex/context/base/xtag-raw.tex | 37 - Master/texmf-dist/tex/context/base/xtag-rng.mkii | 28 + Master/texmf-dist/tex/context/base/xtag-rng.tex | 28 - Master/texmf-dist/tex/context/base/xtag-run.mkii | 319 + Master/texmf-dist/tex/context/base/xtag-run.tex | 319 - Master/texmf-dist/tex/context/base/xtag-stk.mkii | 230 + Master/texmf-dist/tex/context/base/xtag-stk.tex | 230 - Master/texmf-dist/tex/context/base/xtag-utf.mkii | 21 + Master/texmf-dist/tex/context/base/xtag-utf.tex | 21 - Master/texmf-dist/tex/context/base/xtag-xsd.mkii | 28 + Master/texmf-dist/tex/context/base/xtag-xsd.tex | 28 - Master/texmf-dist/tex/context/base/xtag-xsl.mkii | 224 + Master/texmf-dist/tex/context/base/xtag-xsl.tex | 224 - Master/texmf-dist/tex/context/bib/bibl-apa.tex | 34 +- Master/texmf-dist/tex/context/bib/sample.bib | 38 + Master/texmf-dist/tex/context/config/cont-de.ini | 2 +- Master/texmf-dist/tex/context/config/cont-en.ini | 2 +- Master/texmf-dist/tex/context/config/cont-fr.ini | 2 +- Master/texmf-dist/tex/context/config/cont-it.ini | 2 +- Master/texmf-dist/tex/context/config/cont-nl.ini | 2 +- Master/texmf-dist/tex/context/config/cont-ro.ini | 2 +- Master/texmf-dist/tex/context/config/cont-usr.tex | 109 - .../tex/context/fonts/antykwapoltawskiego.lfg | 245 + Master/texmf-dist/tex/context/fonts/asana-math.lfg | 52 + .../texmf-dist/tex/context/fonts/cambria-math.lfg | 26 + Master/texmf-dist/tex/context/fonts/demo.lfg | 52 + Master/texmf-dist/tex/context/fonts/dingbats.lfg | 213 + Master/texmf-dist/tex/context/fonts/husayni.lfg | 36 +- .../texmf-dist/tex/context/fonts/hvmath-math.lfg | 2 +- .../texmf-dist/tex/context/fonts/informal-math.lfg | 12 +- Master/texmf-dist/tex/context/fonts/lm-math.lfg | 51 +- .../texmf-dist/tex/context/fonts/lucida-math.lfg | 34 +- Master/texmf-dist/tex/context/fonts/px-math.lfg | 6 + Master/texmf-dist/tex/context/fonts/tx-math.lfg | 4 + Master/texmf-dist/tex/context/fonts/xits-math.lfg | 25 + .../texmf-dist/tex/context/interface/cont-cs.xml | 106 +- .../texmf-dist/tex/context/interface/cont-de.xml | 106 +- .../texmf-dist/tex/context/interface/cont-en.xml | 102 +- .../texmf-dist/tex/context/interface/cont-fr.xml | 106 +- .../texmf-dist/tex/context/interface/cont-it.xml | 106 +- .../texmf-dist/tex/context/interface/cont-nl.xml | 106 +- .../texmf-dist/tex/context/interface/cont-pe.xml | 106 +- .../texmf-dist/tex/context/interface/cont-ro.xml | 106 +- .../texmf-dist/tex/context/interface/keys-cs.xml | 26 +- .../texmf-dist/tex/context/interface/keys-de.xml | 26 +- .../texmf-dist/tex/context/interface/keys-en.xml | 26 +- .../texmf-dist/tex/context/interface/keys-fr.xml | 28 +- .../texmf-dist/tex/context/interface/keys-it.xml | 26 +- .../texmf-dist/tex/context/interface/keys-nl.xml | 26 +- .../texmf-dist/tex/context/interface/keys-pe.xml | 26 +- .../texmf-dist/tex/context/interface/keys-ro.xml | 26 +- Master/texmf-dist/tex/context/patterns/lang-af.hyp | 8 + Master/texmf-dist/tex/context/patterns/lang-af.lua | 47 + Master/texmf-dist/tex/context/patterns/lang-af.pat | 10349 ++++++++++++ Master/texmf-dist/tex/context/patterns/lang-af.rme | 28 + .../texmf-dist/tex/context/patterns/lang-agr.hyp | 34 +- .../texmf-dist/tex/context/patterns/lang-agr.lua | 56 + .../texmf-dist/tex/context/patterns/lang-agr.pat | 225 +- .../texmf-dist/tex/context/patterns/lang-agr.rme | 39 + Master/texmf-dist/tex/context/patterns/lang-bg.lua | 64 + Master/texmf-dist/tex/context/patterns/lang-bg.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-ca.lua | 148 + Master/texmf-dist/tex/context/patterns/lang-ca.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-cs.lua | 108 + Master/texmf-dist/tex/context/patterns/lang-cs.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-cy.lua | 85 + Master/texmf-dist/tex/context/patterns/lang-cy.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-da.lua | 95 + Master/texmf-dist/tex/context/patterns/lang-da.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-de.lua | 53 + Master/texmf-dist/tex/context/patterns/lang-de.rme | 5 + .../texmf-dist/tex/context/patterns/lang-deo.lua | 53 + .../texmf-dist/tex/context/patterns/lang-deo.rme | 5 + Master/texmf-dist/tex/context/patterns/lang-es.lua | 47 + Master/texmf-dist/tex/context/patterns/lang-es.rme | 5 + Master/texmf-dist/tex/context/patterns/lang-et.lua | 101 + Master/texmf-dist/tex/context/patterns/lang-et.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-eu.lua | 66 + Master/texmf-dist/tex/context/patterns/lang-eu.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-fi.lua | 99 + Master/texmf-dist/tex/context/patterns/lang-fi.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-fr.lua | 127 + Master/texmf-dist/tex/context/patterns/lang-fr.pat | 69 +- Master/texmf-dist/tex/context/patterns/lang-fr.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-gb.lua | 83 + Master/texmf-dist/tex/context/patterns/lang-gb.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-hr.lua | 91 + Master/texmf-dist/tex/context/patterns/lang-hr.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-hu.lua | 32 + Master/texmf-dist/tex/context/patterns/lang-hu.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-is.lua | 100 + Master/texmf-dist/tex/context/patterns/lang-is.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-it.lua | 75 + Master/texmf-dist/tex/context/patterns/lang-it.pat | 31 +- Master/texmf-dist/tex/context/patterns/lang-it.rme | 52 +- Master/texmf-dist/tex/context/patterns/lang-la.lua | 127 + Master/texmf-dist/tex/context/patterns/lang-la.rme | 11 +- Master/texmf-dist/tex/context/patterns/lang-lt.lua | 68 + Master/texmf-dist/tex/context/patterns/lang-lt.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-lv.hyp | 8 + Master/texmf-dist/tex/context/patterns/lang-lv.lua | 36 + Master/texmf-dist/tex/context/patterns/lang-lv.pat | 11590 ++++++++++++++ Master/texmf-dist/tex/context/patterns/lang-lv.rme | 19 + Master/texmf-dist/tex/context/patterns/lang-mn.lua | 107 + Master/texmf-dist/tex/context/patterns/lang-mn.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-nb.hyp | 49 +- Master/texmf-dist/tex/context/patterns/lang-nb.lua | 58 + Master/texmf-dist/tex/context/patterns/lang-nb.pat | 1 + Master/texmf-dist/tex/context/patterns/lang-nb.rme | 117 +- Master/texmf-dist/tex/context/patterns/lang-nl.lua | 121 + Master/texmf-dist/tex/context/patterns/lang-nl.rhl | 2907 ---- Master/texmf-dist/tex/context/patterns/lang-nl.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-nl.rpl | 12948 --------------- Master/texmf-dist/tex/context/patterns/lang-nn.hyp | 49 +- Master/texmf-dist/tex/context/patterns/lang-nn.lua | 58 + Master/texmf-dist/tex/context/patterns/lang-nn.pat | 1 + Master/texmf-dist/tex/context/patterns/lang-nn.rme | 117 +- Master/texmf-dist/tex/context/patterns/lang-pl.lua | 112 + Master/texmf-dist/tex/context/patterns/lang-pl.rme | 5 + Master/texmf-dist/tex/context/patterns/lang-pt.lua | 109 + Master/texmf-dist/tex/context/patterns/lang-pt.pat | 5 +- Master/texmf-dist/tex/context/patterns/lang-pt.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-ro.lua | 131 + Master/texmf-dist/tex/context/patterns/lang-ro.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-ru.lua | 100 + Master/texmf-dist/tex/context/patterns/lang-ru.pat | 2217 ++- Master/texmf-dist/tex/context/patterns/lang-ru.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-sk.lua | 106 + Master/texmf-dist/tex/context/patterns/lang-sk.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-sl.lua | 115 + Master/texmf-dist/tex/context/patterns/lang-sl.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-sr.lua | 103 + Master/texmf-dist/tex/context/patterns/lang-sr.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-sv.lua | 133 + Master/texmf-dist/tex/context/patterns/lang-sv.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-tk.lua | 39 + Master/texmf-dist/tex/context/patterns/lang-tk.pat | 3 +- Master/texmf-dist/tex/context/patterns/lang-tk.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-tr.lua | 47 + Master/texmf-dist/tex/context/patterns/lang-tr.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-uk.lua | 91 + Master/texmf-dist/tex/context/patterns/lang-uk.pat | 2444 ++- Master/texmf-dist/tex/context/patterns/lang-uk.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-us.lua | 63 + Master/texmf-dist/tex/context/patterns/lang-us.rme | 6 +- Master/texmf-dist/tex/context/patterns/lang-zh.lua | 109 + Master/texmf-dist/tex/context/patterns/lang-zh.pat | 7 +- Master/texmf-dist/tex/context/patterns/lang-zh.rme | 6 +- Master/texmf-dist/tex/context/sample/cow.pdf | Bin 0 -> 5526 bytes Master/texmf-dist/tex/context/sample/douglas.tex | 26 +- Master/texmf-dist/tex/context/sample/hacker.jpg | Bin 0 -> 36148 bytes Master/texmf-dist/tex/context/sample/khatt-ar.tex | 4 + Master/texmf-dist/tex/context/sample/khatt-en.tex | 4 + Master/texmf-dist/tex/context/sample/mill.png | Bin 0 -> 154867 bytes Master/texmf-dist/tex/context/sample/spider.eps | 2843 ++++ .../texmf-dist/tex/context/test/pdf-a1a-2005.mkiv | 43 + .../texmf-dist/tex/context/test/pdf-a1b-2005.mkiv | 42 + .../texmf-dist/tex/context/test/pdf-x-common.mkiv | 30 + .../texmf-dist/tex/context/test/pdf-x1a-2001.mkiv | 9 + .../texmf-dist/tex/context/test/pdf-x1a-2003.mkiv | 10 + .../texmf-dist/tex/context/test/pdf-x3-2002.mkiv | 10 + .../texmf-dist/tex/context/test/pdf-x3-2003.mkiv | 9 + Master/texmf-dist/tex/context/test/pdf-x4.mkiv | 11 + Master/texmf-dist/tex/context/test/pdf-x4p.mkiv | 10 + Master/texmf-dist/tex/context/user/cont-sys.rme | 11 +- .../tex/generic/context/luatex-basics-gen.lua | 226 + .../tex/generic/context/luatex-basics-nod.lua | 95 + .../tex/generic/context/luatex-fonts-cbk.lua | 68 + .../tex/generic/context/luatex-fonts-def.lua | 97 + .../tex/generic/context/luatex-fonts-demo-vf-1.lua | 38 + .../tex/generic/context/luatex-fonts-enc.lua | 28 + .../tex/generic/context/luatex-fonts-ext.lua | 276 + .../tex/generic/context/luatex-fonts-lua.lua | 33 + .../tex/generic/context/luatex-fonts-merged.lua | 15777 +++++++++---------- .../tex/generic/context/luatex-fonts-syn.lua | 83 + .../tex/generic/context/luatex-fonts-tfm.lua | 38 + .../tex/generic/context/luatex-fonts.lua | 163 +- .../tex/generic/context/luatex-fonts.tex | 3 +- .../tex/generic/context/luatex-mplib.lua | 86 +- .../tex/generic/context/luatex-mplib.tex | 3 +- .../tex/generic/context/luatex-plain.tex | 25 - .../generic/context/luatex-preprocessor-test.tex | 30 + .../tex/generic/context/luatex-preprocessor.lua | 163 + .../tex/generic/context/luatex-preprocessor.tex | 14 + .../texmf-dist/tex/generic/context/luatex-test.tex | 22 +- Master/texmf-dist/tex/generic/context/mptopdf.tex | 4 +- Master/texmf/web2c/texmfcnf.lua | 190 +- Master/tlpkg/tlpsrc/context.tlpsrc | 3 +- 1476 files changed, 266569 insertions(+), 188964 deletions(-) create mode 100755 Master/bin/win32/pstopdf.exe create mode 100644 Master/texmf-dist/colors/icc/context/colorprofiles.lua create mode 100644 Master/texmf-dist/colors/icc/context/colorprofiles.xml create mode 100644 Master/texmf-dist/context/data/textpad/textpad-context-template.txt create mode 100644 Master/texmf-dist/fonts/data/tests/texmfhome.otf create mode 100644 Master/texmf-dist/metapost/context/font/punkfont-bold.mp create mode 100644 Master/texmf-dist/metapost/context/font/punkfont-boldslanted.mp create mode 100644 Master/texmf-dist/metapost/context/font/punkfont-characters.mp create mode 100644 Master/texmf-dist/metapost/context/font/punkfont-definitions.mp create mode 100644 Master/texmf-dist/metapost/context/font/punkfont-slanted.mp create mode 100644 Master/texmf-dist/scripts/context/lua/mtx-base.lua create mode 100644 Master/texmf-dist/scripts/context/lua/mtx-colors.lua create mode 100644 Master/texmf-dist/scripts/context/lua/mtx-epub.lua create mode 100644 Master/texmf-dist/scripts/context/lua/mtx-flac.lua create mode 100644 Master/texmf-dist/scripts/context/lua/mtx-metapost.lua delete mode 100644 Master/texmf-dist/scripts/context/lua/mtx-mptopdf.lua delete mode 100644 Master/texmf-dist/scripts/context/lua/x-ldx.lua delete mode 100644 Master/texmf-dist/scripts/context/ruby/mtxtools.rb create mode 100644 Master/texmf-dist/scripts/context/ruby/rslibtool.rb delete mode 100755 Master/texmf-dist/scripts/context/stubs/mswin/metatex.exe delete mode 100755 Master/texmf-dist/scripts/context/stubs/unix/metatex create mode 100644 Master/texmf-dist/tex/context/base/attr-col.lua create mode 100644 Master/texmf-dist/tex/context/base/attr-col.mkiv create mode 100644 Master/texmf-dist/tex/context/base/attr-eff.lua create mode 100644 Master/texmf-dist/tex/context/base/attr-eff.mkiv create mode 100644 Master/texmf-dist/tex/context/base/attr-lay.lua create mode 100644 Master/texmf-dist/tex/context/base/attr-lay.mkiv create mode 100644 Master/texmf-dist/tex/context/base/attr-neg.lua create mode 100644 Master/texmf-dist/tex/context/base/attr-neg.mkiv create mode 100644 Master/texmf-dist/tex/context/base/back-exp.lua create mode 100644 Master/texmf-dist/tex/context/base/back-exp.mkiv create mode 100644 Master/texmf-dist/tex/context/base/buff-imp-default.lua create mode 100644 Master/texmf-dist/tex/context/base/buff-imp-default.mkiv create mode 100644 Master/texmf-dist/tex/context/base/buff-imp-escaped.lua create mode 100644 Master/texmf-dist/tex/context/base/buff-imp-escaped.mkiv create mode 100644 Master/texmf-dist/tex/context/base/buff-imp-lua.lua create mode 100644 Master/texmf-dist/tex/context/base/buff-imp-lua.mkiv create mode 100644 Master/texmf-dist/tex/context/base/buff-imp-mp.lua create mode 100644 Master/texmf-dist/tex/context/base/buff-imp-mp.mkiv create mode 100644 Master/texmf-dist/tex/context/base/buff-imp-nested.lua create mode 100644 Master/texmf-dist/tex/context/base/buff-imp-nested.mkiv create mode 100644 Master/texmf-dist/tex/context/base/buff-imp-parsed-xml.lua create mode 100644 Master/texmf-dist/tex/context/base/buff-imp-parsed-xml.mkiv create mode 100644 Master/texmf-dist/tex/context/base/buff-imp-tex.lua create mode 100644 Master/texmf-dist/tex/context/base/buff-imp-tex.mkiv create mode 100644 Master/texmf-dist/tex/context/base/buff-imp-xml.lua create mode 100644 Master/texmf-dist/tex/context/base/buff-imp-xml.mkiv create mode 100644 Master/texmf-dist/tex/context/base/buff-par.lua create mode 100644 Master/texmf-dist/tex/context/base/buff-par.mkiv create mode 100644 Master/texmf-dist/tex/context/base/buff-ver.lua create mode 100644 Master/texmf-dist/tex/context/base/catc-act.mkii create mode 100644 Master/texmf-dist/tex/context/base/catc-act.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/catc-act.tex create mode 100644 Master/texmf-dist/tex/context/base/catc-ctx.mkii create mode 100644 Master/texmf-dist/tex/context/base/catc-ctx.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/catc-ctx.tex create mode 100644 Master/texmf-dist/tex/context/base/catc-def.mkii create mode 100644 Master/texmf-dist/tex/context/base/catc-def.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/catc-def.tex create mode 100644 Master/texmf-dist/tex/context/base/catc-sym.mkii create mode 100644 Master/texmf-dist/tex/context/base/catc-sym.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/catc-sym.tex create mode 100644 Master/texmf-dist/tex/context/base/catc-xml.mkii create mode 100644 Master/texmf-dist/tex/context/base/catc-xml.mkiv create mode 100644 Master/texmf-dist/tex/context/base/char-cjk.lua delete mode 100644 Master/texmf-dist/tex/context/base/char-cmp.lua create mode 100644 Master/texmf-dist/tex/context/base/cldf-com.lua create mode 100644 Master/texmf-dist/tex/context/base/cldf-com.mkiv create mode 100644 Master/texmf-dist/tex/context/base/cldf-ini.lua create mode 100644 Master/texmf-dist/tex/context/base/cldf-ini.mkiv create mode 100644 Master/texmf-dist/tex/context/base/cldf-int.lua create mode 100644 Master/texmf-dist/tex/context/base/cldf-int.mkiv create mode 100644 Master/texmf-dist/tex/context/base/cldf-ver.lua create mode 100644 Master/texmf-dist/tex/context/base/cldf-ver.mkiv create mode 100644 Master/texmf-dist/tex/context/base/colo-ema.mkii delete mode 100644 Master/texmf-dist/tex/context/base/colo-ema.tex delete mode 100644 Master/texmf-dist/tex/context/base/colo-hex.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/colo-hex.tex create mode 100644 Master/texmf-dist/tex/context/base/colo-icc.lua create mode 100644 Master/texmf-dist/tex/context/base/colo-imp-ema.mkiv create mode 100644 Master/texmf-dist/tex/context/base/colo-imp-rgb.mkiv create mode 100644 Master/texmf-dist/tex/context/base/colo-imp-x11.mkiv create mode 100644 Master/texmf-dist/tex/context/base/colo-imp-xwi.mkiv create mode 100644 Master/texmf-dist/tex/context/base/colo-rgb.mkii delete mode 100644 Master/texmf-dist/tex/context/base/colo-rgb.tex create mode 100644 Master/texmf-dist/tex/context/base/colo-run.mkii create mode 100644 Master/texmf-dist/tex/context/base/colo-run.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/colo-run.tex create mode 100644 Master/texmf-dist/tex/context/base/colo-x11.mkii delete mode 100644 Master/texmf-dist/tex/context/base/colo-x11.tex create mode 100644 Master/texmf-dist/tex/context/base/colo-xwi.mkii delete mode 100644 Master/texmf-dist/tex/context/base/colo-xwi.tex create mode 100644 Master/texmf-dist/tex/context/base/cont-cs.mkii create mode 100644 Master/texmf-dist/tex/context/base/cont-cs.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/cont-cs.tex create mode 100644 Master/texmf-dist/tex/context/base/cont-de.mkii create mode 100644 Master/texmf-dist/tex/context/base/cont-de.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/cont-de.tex create mode 100644 Master/texmf-dist/tex/context/base/cont-en.mkii create mode 100644 Master/texmf-dist/tex/context/base/cont-en.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/cont-en.tex create mode 100644 Master/texmf-dist/tex/context/base/cont-err.mkii delete mode 100644 Master/texmf-dist/tex/context/base/cont-err.tex create mode 100644 Master/texmf-dist/tex/context/base/cont-fil.mkii create mode 100644 Master/texmf-dist/tex/context/base/cont-fil.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/cont-fil.tex create mode 100644 Master/texmf-dist/tex/context/base/cont-fr.mkii create mode 100644 Master/texmf-dist/tex/context/base/cont-fr.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/cont-fr.tex create mode 100644 Master/texmf-dist/tex/context/base/cont-gb.mkii create mode 100644 Master/texmf-dist/tex/context/base/cont-gb.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/cont-gb.tex create mode 100644 Master/texmf-dist/tex/context/base/cont-it.mkii create mode 100644 Master/texmf-dist/tex/context/base/cont-it.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/cont-it.tex create mode 100644 Master/texmf-dist/tex/context/base/cont-log.mkii create mode 100644 Master/texmf-dist/tex/context/base/cont-log.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/cont-log.tex delete mode 100644 Master/texmf-dist/tex/context/base/cont-mtx.tex delete mode 100644 Master/texmf-dist/tex/context/base/cont-new.tex create mode 100644 Master/texmf-dist/tex/context/base/cont-nl.mkii create mode 100644 Master/texmf-dist/tex/context/base/cont-nl.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/cont-nl.tex delete mode 100644 Master/texmf-dist/tex/context/base/cont-old.tex create mode 100644 Master/texmf-dist/tex/context/base/cont-pe.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/cont-pe.tex create mode 100644 Master/texmf-dist/tex/context/base/cont-ro.mkii create mode 100644 Master/texmf-dist/tex/context/base/cont-ro.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/cont-ro.tex delete mode 100644 Master/texmf-dist/tex/context/base/cont-usr.ori create mode 100644 Master/texmf-dist/tex/context/base/context.lus delete mode 100644 Master/texmf-dist/tex/context/base/context.tex create mode 100644 Master/texmf-dist/tex/context/base/context.todo create mode 100644 Master/texmf-dist/tex/context/base/core-env.lua create mode 100644 Master/texmf-dist/tex/context/base/data-env.lua create mode 100644 Master/texmf-dist/tex/context/base/data-exp.lua create mode 100644 Master/texmf-dist/tex/context/base/data-fil.lua create mode 100644 Master/texmf-dist/tex/context/base/data-ini.lua create mode 100644 Master/texmf-dist/tex/context/base/data-met.lua create mode 100644 Master/texmf-dist/tex/context/base/data-vir.lua create mode 100644 Master/texmf-dist/tex/context/base/font-age.lua create mode 100644 Master/texmf-dist/tex/context/base/font-aux.lua create mode 100644 Master/texmf-dist/tex/context/base/font-con.lua delete mode 100644 Master/texmf-dist/tex/context/base/font-dum.lua create mode 100644 Master/texmf-dist/tex/context/base/font-ldr.lua create mode 100644 Master/texmf-dist/tex/context/base/font-lua.lua create mode 100644 Master/texmf-dist/tex/context/base/font-oth.lua delete mode 100644 Master/texmf-dist/tex/context/base/font-xtx.lua create mode 100644 Master/texmf-dist/tex/context/base/grph-epd.lua create mode 100644 Master/texmf-dist/tex/context/base/grph-epd.mkiv create mode 100644 Master/texmf-dist/tex/context/base/grph-raw.lua create mode 100644 Master/texmf-dist/tex/context/base/grph-raw.mkiv create mode 100644 Master/texmf-dist/tex/context/base/grph-wnd.lua create mode 100644 Master/texmf-dist/tex/context/base/java-ans.mkii delete mode 100644 Master/texmf-dist/tex/context/base/java-ans.tex create mode 100644 Master/texmf-dist/tex/context/base/java-exa.mkii delete mode 100644 Master/texmf-dist/tex/context/base/java-exa.tex create mode 100644 Master/texmf-dist/tex/context/base/java-fil.mkii delete mode 100644 Master/texmf-dist/tex/context/base/java-fil.tex create mode 100644 Master/texmf-dist/tex/context/base/java-fld.mkii delete mode 100644 Master/texmf-dist/tex/context/base/java-fld.tex create mode 100644 Master/texmf-dist/tex/context/base/java-imp-exa.mkiv create mode 100644 Master/texmf-dist/tex/context/base/java-imp-fil.mkiv create mode 100644 Master/texmf-dist/tex/context/base/java-imp-fld.mkiv create mode 100644 Master/texmf-dist/tex/context/base/java-imp-stp.mkiv create mode 100644 Master/texmf-dist/tex/context/base/java-stp.mkii delete mode 100644 Master/texmf-dist/tex/context/base/java-stp.tex delete mode 100644 Master/texmf-dist/tex/context/base/l-dimen.lua create mode 100644 Master/texmf-dist/tex/context/base/lang-alt.mkii delete mode 100644 Master/texmf-dist/tex/context/base/lang-alt.tex create mode 100644 Master/texmf-dist/tex/context/base/lang-ana.mkii delete mode 100644 Master/texmf-dist/tex/context/base/lang-ana.tex delete mode 100644 Master/texmf-dist/tex/context/base/lang-ara.mkiv create mode 100644 Master/texmf-dist/tex/context/base/lang-art.mkii delete mode 100644 Master/texmf-dist/tex/context/base/lang-art.tex create mode 100644 Master/texmf-dist/tex/context/base/lang-bal.mkii delete mode 100644 Master/texmf-dist/tex/context/base/lang-bal.tex create mode 100644 Master/texmf-dist/tex/context/base/lang-cel.mkii delete mode 100644 Master/texmf-dist/tex/context/base/lang-cel.tex delete mode 100644 Master/texmf-dist/tex/context/base/lang-cjk.mkiv create mode 100644 Master/texmf-dist/tex/context/base/lang-cyr.mkii delete mode 100644 Master/texmf-dist/tex/context/base/lang-cyr.tex create mode 100644 Master/texmf-dist/tex/context/base/lang-def.lua create mode 100644 Master/texmf-dist/tex/context/base/lang-def.mkiv create mode 100644 Master/texmf-dist/tex/context/base/lang-frd.mkii delete mode 100644 Master/texmf-dist/tex/context/base/lang-frd.tex create mode 100644 Master/texmf-dist/tex/context/base/lang-frq.mkii delete mode 100644 Master/texmf-dist/tex/context/base/lang-frq.tex create mode 100644 Master/texmf-dist/tex/context/base/lang-ger.mkii delete mode 100644 Master/texmf-dist/tex/context/base/lang-ger.tex create mode 100644 Master/texmf-dist/tex/context/base/lang-grk.mkii delete mode 100644 Master/texmf-dist/tex/context/base/lang-grk.tex create mode 100644 Master/texmf-dist/tex/context/base/lang-ind.mkii delete mode 100644 Master/texmf-dist/tex/context/base/lang-ind.tex create mode 100644 Master/texmf-dist/tex/context/base/lang-ita.mkii delete mode 100644 Master/texmf-dist/tex/context/base/lang-ita.tex create mode 100644 Master/texmf-dist/tex/context/base/lang-lab.lua delete mode 100644 Master/texmf-dist/tex/context/base/lang-sla.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/lang-sla.tex create mode 100644 Master/texmf-dist/tex/context/base/lang-spa.mkii create mode 100644 Master/texmf-dist/tex/context/base/lang-spa.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/lang-spa.tex create mode 100644 Master/texmf-dist/tex/context/base/lang-txt.lua create mode 100644 Master/texmf-dist/tex/context/base/lang-ura.mkii delete mode 100644 Master/texmf-dist/tex/context/base/lang-ura.tex create mode 100644 Master/texmf-dist/tex/context/base/lang-vn.mkii delete mode 100644 Master/texmf-dist/tex/context/base/lang-vn.tex create mode 100644 Master/texmf-dist/tex/context/base/layo-ini.lua create mode 100644 Master/texmf-dist/tex/context/base/layo-ini.mkiv create mode 100644 Master/texmf-dist/tex/context/base/lpdf-enc.lua create mode 100644 Master/texmf-dist/tex/context/base/lpdf-epa.lua create mode 100644 Master/texmf-dist/tex/context/base/lpdf-epd.lua create mode 100644 Master/texmf-dist/tex/context/base/lpdf-fmt.lua delete mode 100644 Master/texmf-dist/tex/context/base/lpdf-ini.mkiv create mode 100644 Master/texmf-dist/tex/context/base/lpdf-pda.xml delete mode 100644 Master/texmf-dist/tex/context/base/lpdf-pdx.lua delete mode 100644 Master/texmf-dist/tex/context/base/lpdf-pdx.mkiv create mode 100644 Master/texmf-dist/tex/context/base/lpdf-pdx.xml create mode 100644 Master/texmf-dist/tex/context/base/lpdf-tag.lua delete mode 100644 Master/texmf-dist/tex/context/base/lpdf-xmp.xml create mode 100644 Master/texmf-dist/tex/context/base/luat-bwc.lua create mode 100644 Master/texmf-dist/tex/context/base/luat-cod.lua delete mode 100644 Master/texmf-dist/tex/context/base/luat-dum.lua create mode 100644 Master/texmf-dist/tex/context/base/luat-fmt.lua create mode 100644 Master/texmf-dist/tex/context/base/luat-mac.lua create mode 100644 Master/texmf-dist/tex/context/base/m-arabtex.mkii delete mode 100644 Master/texmf-dist/tex/context/base/m-arabtex.tex delete mode 100644 Master/texmf-dist/tex/context/base/m-chemic.tex create mode 100644 Master/texmf-dist/tex/context/base/m-database.lua create mode 100644 Master/texmf-dist/tex/context/base/m-database.mkii create mode 100644 Master/texmf-dist/tex/context/base/m-database.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/m-database.tex create mode 100644 Master/texmf-dist/tex/context/base/m-directives.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/m-directives.tex create mode 100644 Master/texmf-dist/tex/context/base/m-dratex.mkii delete mode 100644 Master/texmf-dist/tex/context/base/m-dratex.tex create mode 100644 Master/texmf-dist/tex/context/base/m-edtsnc.mkii delete mode 100644 Master/texmf-dist/tex/context/base/m-edtsnc.tex create mode 100644 Master/texmf-dist/tex/context/base/m-fields.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/m-graph.tex create mode 100644 Master/texmf-dist/tex/context/base/m-level.mkii delete mode 100644 Master/texmf-dist/tex/context/base/m-level.tex create mode 100644 Master/texmf-dist/tex/context/base/m-logcategories.mkiv create mode 100644 Master/texmf-dist/tex/context/base/m-mathcrap.mkiv create mode 100644 Master/texmf-dist/tex/context/base/m-mkivhacks.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/m-mkivhacks.tex create mode 100644 Master/texmf-dist/tex/context/base/m-morse.mkvi create mode 100644 Master/texmf-dist/tex/context/base/m-obsolete.mkii create mode 100644 Master/texmf-dist/tex/context/base/m-obsolete.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/m-obsolete.tex create mode 100644 Master/texmf-dist/tex/context/base/m-pdfsnc.mkii delete mode 100644 Master/texmf-dist/tex/context/base/m-pdfsnc.tex delete mode 100644 Master/texmf-dist/tex/context/base/m-plus.tex delete mode 100644 Master/texmf-dist/tex/context/base/m-pstricks.tex delete mode 100644 Master/texmf-dist/tex/context/base/m-punk.tex create mode 100644 Master/texmf-dist/tex/context/base/m-spreadsheet.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/m-steps.mkii delete mode 100644 Master/texmf-dist/tex/context/base/m-steps.mkiv create mode 100644 Master/texmf-dist/tex/context/base/m-tex4ht.mkii delete mode 100644 Master/texmf-dist/tex/context/base/m-tex4ht.tex create mode 100644 Master/texmf-dist/tex/context/base/m-timing.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/m-timing.tex create mode 100644 Master/texmf-dist/tex/context/base/m-trackers.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/m-trackers.tex create mode 100644 Master/texmf-dist/tex/context/base/m-translate.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/m-translate.tex delete mode 100644 Master/texmf-dist/tex/context/base/m-tryout.tex create mode 100644 Master/texmf-dist/tex/context/base/m-units.mkii create mode 100644 Master/texmf-dist/tex/context/base/m-units.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/m-units.tex create mode 100644 Master/texmf-dist/tex/context/base/m-zint.mkiv create mode 100644 Master/texmf-dist/tex/context/base/math-act.lua create mode 100644 Master/texmf-dist/tex/context/base/math-tag.lua create mode 100644 Master/texmf-dist/tex/context/base/meta-clp.mkii delete mode 100644 Master/texmf-dist/tex/context/base/meta-clp.tex create mode 100644 Master/texmf-dist/tex/context/base/meta-dum.mkii delete mode 100644 Master/texmf-dist/tex/context/base/meta-dum.tex create mode 100644 Master/texmf-dist/tex/context/base/meta-imp-clp.mkiv create mode 100644 Master/texmf-dist/tex/context/base/meta-imp-dum.mkiv create mode 100644 Master/texmf-dist/tex/context/base/meta-imp-mis.mkiv create mode 100644 Master/texmf-dist/tex/context/base/meta-imp-nav.mkiv create mode 100644 Master/texmf-dist/tex/context/base/meta-imp-pre.mkiv create mode 100644 Master/texmf-dist/tex/context/base/meta-imp-txt.mkiv create mode 100644 Master/texmf-dist/tex/context/base/meta-ini.lua create mode 100644 Master/texmf-dist/tex/context/base/meta-mis.mkii delete mode 100644 Master/texmf-dist/tex/context/base/meta-mis.tex create mode 100644 Master/texmf-dist/tex/context/base/meta-nav.mkii delete mode 100644 Master/texmf-dist/tex/context/base/meta-nav.tex create mode 100644 Master/texmf-dist/tex/context/base/meta-pre.mkii delete mode 100644 Master/texmf-dist/tex/context/base/meta-pre.tex create mode 100644 Master/texmf-dist/tex/context/base/meta-tex.lua create mode 100644 Master/texmf-dist/tex/context/base/meta-txt.mkii delete mode 100644 Master/texmf-dist/tex/context/base/meta-txt.tex create mode 100644 Master/texmf-dist/tex/context/base/meta-xml.mkii create mode 100644 Master/texmf-dist/tex/context/base/meta-xml.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/meta-xml.tex create mode 100644 Master/texmf-dist/tex/context/base/metatex.lus create mode 100644 Master/texmf-dist/tex/context/base/mtx-context-select.tex create mode 100644 Master/texmf-dist/tex/context/base/mult-aux.lua create mode 100644 Master/texmf-dist/tex/context/base/mult-aux.mkii create mode 100644 Master/texmf-dist/tex/context/base/mult-aux.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/mult-cld.lua delete mode 100644 Master/texmf-dist/tex/context/base/mult-cld.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/mult-clm.lua create mode 100644 Master/texmf-dist/tex/context/base/mult-com.mkii delete mode 100644 Master/texmf-dist/tex/context/base/mult-com.tex create mode 100644 Master/texmf-dist/tex/context/base/mult-con.mkii delete mode 100644 Master/texmf-dist/tex/context/base/mult-con.tex create mode 100644 Master/texmf-dist/tex/context/base/mult-de.mkii delete mode 100644 Master/texmf-dist/tex/context/base/mult-de.tex create mode 100644 Master/texmf-dist/tex/context/base/mult-def.mkii create mode 100644 Master/texmf-dist/tex/context/base/mult-def.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/mult-def.tex create mode 100644 Master/texmf-dist/tex/context/base/mult-en.mkii delete mode 100644 Master/texmf-dist/tex/context/base/mult-en.tex create mode 100644 Master/texmf-dist/tex/context/base/mult-fr.mkii delete mode 100644 Master/texmf-dist/tex/context/base/mult-fr.tex create mode 100644 Master/texmf-dist/tex/context/base/mult-fst.mkii create mode 100644 Master/texmf-dist/tex/context/base/mult-fst.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/mult-fst.tex create mode 100644 Master/texmf-dist/tex/context/base/mult-it.mkii delete mode 100644 Master/texmf-dist/tex/context/base/mult-it.tex create mode 100644 Master/texmf-dist/tex/context/base/mult-mcs.mkii delete mode 100644 Master/texmf-dist/tex/context/base/mult-mcs.tex create mode 100644 Master/texmf-dist/tex/context/base/mult-mde.mkii delete mode 100644 Master/texmf-dist/tex/context/base/mult-mde.tex create mode 100644 Master/texmf-dist/tex/context/base/mult-men.mkii delete mode 100644 Master/texmf-dist/tex/context/base/mult-men.tex create mode 100644 Master/texmf-dist/tex/context/base/mult-mfr.mkii delete mode 100644 Master/texmf-dist/tex/context/base/mult-mfr.tex create mode 100644 Master/texmf-dist/tex/context/base/mult-mit.mkii delete mode 100644 Master/texmf-dist/tex/context/base/mult-mit.tex create mode 100644 Master/texmf-dist/tex/context/base/mult-mnl.mkii delete mode 100644 Master/texmf-dist/tex/context/base/mult-mnl.tex create mode 100644 Master/texmf-dist/tex/context/base/mult-mno.mkii delete mode 100644 Master/texmf-dist/tex/context/base/mult-mno.tex create mode 100644 Master/texmf-dist/tex/context/base/mult-mpe.mkii delete mode 100644 Master/texmf-dist/tex/context/base/mult-mpe.tex create mode 100644 Master/texmf-dist/tex/context/base/mult-mro.mkii delete mode 100644 Master/texmf-dist/tex/context/base/mult-mro.tex create mode 100644 Master/texmf-dist/tex/context/base/mult-nl.mkii delete mode 100644 Master/texmf-dist/tex/context/base/mult-nl.tex create mode 100644 Master/texmf-dist/tex/context/base/mult-pe.mkii create mode 100644 Master/texmf-dist/tex/context/base/mult-ro.mkii delete mode 100644 Master/texmf-dist/tex/context/base/mult-ro.tex create mode 100644 Master/texmf-dist/tex/context/base/mult-sys.mkii create mode 100644 Master/texmf-dist/tex/context/base/mult-sys.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/mult-sys.tex create mode 100644 Master/texmf-dist/tex/context/base/node-acc.lua delete mode 100644 Master/texmf-dist/tex/context/base/node-dum.lua delete mode 100644 Master/texmf-dist/tex/context/base/node-seq.lua create mode 100644 Master/texmf-dist/tex/context/base/node-spl.lua create mode 100644 Master/texmf-dist/tex/context/base/node-spl.mkiv create mode 100644 Master/texmf-dist/tex/context/base/norm-alo.mkii delete mode 100644 Master/texmf-dist/tex/context/base/norm-alo.tex create mode 100644 Master/texmf-dist/tex/context/base/norm-ctx.mkii create mode 100644 Master/texmf-dist/tex/context/base/norm-ctx.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/norm-ctx.tex create mode 100644 Master/texmf-dist/tex/context/base/norm-etx.mkii delete mode 100644 Master/texmf-dist/tex/context/base/norm-etx.tex create mode 100644 Master/texmf-dist/tex/context/base/norm-ltx.mkii delete mode 100644 Master/texmf-dist/tex/context/base/norm-ltx.tex create mode 100644 Master/texmf-dist/tex/context/base/norm-ptx.mkii delete mode 100644 Master/texmf-dist/tex/context/base/norm-ptx.tex create mode 100644 Master/texmf-dist/tex/context/base/norm-tex.mkii delete mode 100644 Master/texmf-dist/tex/context/base/norm-tex.tex create mode 100644 Master/texmf-dist/tex/context/base/norm-xtx.mkii delete mode 100644 Master/texmf-dist/tex/context/base/norm-xtx.tex create mode 100644 Master/texmf-dist/tex/context/base/pack-mis.mkvi create mode 100644 Master/texmf-dist/tex/context/base/pack-pos.mkiv create mode 100644 Master/texmf-dist/tex/context/base/page-com.mkiv create mode 100644 Master/texmf-dist/tex/context/base/page-sel.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/pret-lua.lua delete mode 100644 Master/texmf-dist/tex/context/base/pret-mp.lua delete mode 100644 Master/texmf-dist/tex/context/base/pret-tex.lua delete mode 100644 Master/texmf-dist/tex/context/base/pret-xml.lua delete mode 100644 Master/texmf-dist/tex/context/base/prop-lay.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/prop-mis.mkiv create mode 100644 Master/texmf-dist/tex/context/base/regi-demo.lua create mode 100644 Master/texmf-dist/tex/context/base/regi-syn.mkii delete mode 100644 Master/texmf-dist/tex/context/base/regi-syn.tex create mode 100644 Master/texmf-dist/tex/context/base/s-abr-04.tex create mode 100644 Master/texmf-dist/tex/context/base/s-chi-00.mkii delete mode 100644 Master/texmf-dist/tex/context/base/s-chi-00.tex create mode 100644 Master/texmf-dist/tex/context/base/s-def-01.mkiv create mode 100644 Master/texmf-dist/tex/context/base/s-fnt-01.mkii delete mode 100644 Master/texmf-dist/tex/context/base/s-fnt-01.tex create mode 100644 Master/texmf-dist/tex/context/base/s-fnt-02.mkii delete mode 100644 Master/texmf-dist/tex/context/base/s-fnt-02.tex create mode 100644 Master/texmf-dist/tex/context/base/s-fnt-10.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/s-fnt-10.tex create mode 100644 Master/texmf-dist/tex/context/base/s-fnt-11.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/s-fnt-11.tex create mode 100644 Master/texmf-dist/tex/context/base/s-fnt-20.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/s-fnt-20.tex create mode 100644 Master/texmf-dist/tex/context/base/s-fnt-21.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/s-fnt-21.tex create mode 100644 Master/texmf-dist/tex/context/base/s-fnt-23.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/s-fnt-23.tex create mode 100644 Master/texmf-dist/tex/context/base/s-fnt-24.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/s-fnt-24.tex create mode 100644 Master/texmf-dist/tex/context/base/s-fnt-25.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/s-fnt-25.tex create mode 100644 Master/texmf-dist/tex/context/base/s-fnt-26.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/s-fnt-26.tex create mode 100644 Master/texmf-dist/tex/context/base/s-fnt-28.mkiv create mode 100644 Master/texmf-dist/tex/context/base/s-fnt-29.mkiv create mode 100644 Master/texmf-dist/tex/context/base/s-fnt-30.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/s-fnt-30.tex create mode 100644 Master/texmf-dist/tex/context/base/s-fnt-31.mkiv create mode 100644 Master/texmf-dist/tex/context/base/s-fnt-32.mkiv create mode 100644 Master/texmf-dist/tex/context/base/s-grk-00.mkii delete mode 100644 Master/texmf-dist/tex/context/base/s-grk-00.tex create mode 100644 Master/texmf-dist/tex/context/base/s-inf-01.mkvi delete mode 100644 Master/texmf-dist/tex/context/base/s-inf-01.tex create mode 100644 Master/texmf-dist/tex/context/base/s-inf-02.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/s-inf-02.tex create mode 100644 Master/texmf-dist/tex/context/base/s-inf-03.mkiv create mode 100644 Master/texmf-dist/tex/context/base/s-jap-00.mkii delete mode 100644 Master/texmf-dist/tex/context/base/s-jap-00.tex create mode 100644 Master/texmf-dist/tex/context/base/s-lan-03.mkiv create mode 100644 Master/texmf-dist/tex/context/base/s-lan-04.mkiv create mode 100644 Master/texmf-dist/tex/context/base/s-map-10.mkii create mode 100644 Master/texmf-dist/tex/context/base/s-map-10.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/s-map-10.tex create mode 100644 Master/texmf-dist/tex/context/base/s-mod-00.mkii create mode 100644 Master/texmf-dist/tex/context/base/s-mod-00.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/s-mod-00.tex create mode 100644 Master/texmf-dist/tex/context/base/s-mod-01.mkii create mode 100644 Master/texmf-dist/tex/context/base/s-mod-01.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/s-mod-01.tex create mode 100644 Master/texmf-dist/tex/context/base/s-mod-02.mkii create mode 100644 Master/texmf-dist/tex/context/base/s-mod-02.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/s-mod-02.tex create mode 100644 Master/texmf-dist/tex/context/base/s-pre-30.mkii create mode 100644 Master/texmf-dist/tex/context/base/s-pre-30.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/s-pre-30.tex create mode 100644 Master/texmf-dist/tex/context/base/s-pre-60.mkii create mode 100644 Master/texmf-dist/tex/context/base/s-pre-60.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/s-pre-60.tex create mode 100644 Master/texmf-dist/tex/context/base/s-pre-68.tex create mode 100644 Master/texmf-dist/tex/context/base/s-pre-69.mkiv create mode 100644 Master/texmf-dist/tex/context/base/s-pre-70.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/s-pre-70.tex create mode 100644 Master/texmf-dist/tex/context/base/s-pre-71.lua create mode 100644 Master/texmf-dist/tex/context/base/s-pre-71.mkii create mode 100644 Master/texmf-dist/tex/context/base/s-pre-71.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/s-pre-71.tex create mode 100644 Master/texmf-dist/tex/context/base/s-pre-96.tex create mode 100644 Master/texmf-dist/tex/context/base/s-reg-01.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/s-reg-01.tex create mode 100644 Master/texmf-dist/tex/context/base/s-set-31.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/s-sys-01.tex delete mode 100644 Master/texmf-dist/tex/context/base/scrn-bar.mkiv create mode 100644 Master/texmf-dist/tex/context/base/scrn-bar.mkvi create mode 100644 Master/texmf-dist/tex/context/base/scrn-but.lua delete mode 100644 Master/texmf-dist/tex/context/base/scrn-but.mkiv create mode 100644 Master/texmf-dist/tex/context/base/scrn-but.mkvi create mode 100644 Master/texmf-dist/tex/context/base/scrn-fld.lua delete mode 100644 Master/texmf-dist/tex/context/base/scrn-fld.mkiv create mode 100644 Master/texmf-dist/tex/context/base/scrn-fld.mkvi create mode 100644 Master/texmf-dist/tex/context/base/scrn-hlp.lua delete mode 100644 Master/texmf-dist/tex/context/base/scrn-hlp.mkiv create mode 100644 Master/texmf-dist/tex/context/base/scrn-hlp.mkvi create mode 100644 Master/texmf-dist/tex/context/base/scrn-ini.lua create mode 100644 Master/texmf-dist/tex/context/base/scrn-ini.mkvi delete mode 100644 Master/texmf-dist/tex/context/base/scrn-int.lua delete mode 100644 Master/texmf-dist/tex/context/base/scrn-int.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/scrn-men.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/scrn-nav.mkiv create mode 100644 Master/texmf-dist/tex/context/base/scrn-pag.lua create mode 100644 Master/texmf-dist/tex/context/base/scrn-pag.mkvi create mode 100644 Master/texmf-dist/tex/context/base/scrn-ref.lua create mode 100644 Master/texmf-dist/tex/context/base/scrn-ref.mkvi create mode 100644 Master/texmf-dist/tex/context/base/scrn-wid.lua create mode 100644 Master/texmf-dist/tex/context/base/scrn-wid.mkvi create mode 100644 Master/texmf-dist/tex/context/base/scrp-eth.lua create mode 100644 Master/texmf-dist/tex/context/base/spac-ali.lua create mode 100644 Master/texmf-dist/tex/context/base/spac-par.lua create mode 100644 Master/texmf-dist/tex/context/base/status-files.pdf create mode 100644 Master/texmf-dist/tex/context/base/status-lua.pdf create mode 100644 Master/texmf-dist/tex/context/base/strc-lev.lua create mode 100644 Master/texmf-dist/tex/context/base/strc-lev.mkiv create mode 100644 Master/texmf-dist/tex/context/base/strc-tag.lua create mode 100644 Master/texmf-dist/tex/context/base/strc-tag.mkiv create mode 100644 Master/texmf-dist/tex/context/base/supp-ali.mkii create mode 100644 Master/texmf-dist/tex/context/base/supp-ali.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/supp-ali.tex create mode 100644 Master/texmf-dist/tex/context/base/supp-box.lua create mode 100644 Master/texmf-dist/tex/context/base/supp-box.mkii create mode 100644 Master/texmf-dist/tex/context/base/supp-box.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/supp-box.tex create mode 100644 Master/texmf-dist/tex/context/base/supp-fun.mkii create mode 100644 Master/texmf-dist/tex/context/base/supp-fun.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/supp-fun.tex create mode 100644 Master/texmf-dist/tex/context/base/supp-lat.mkii create mode 100644 Master/texmf-dist/tex/context/base/supp-num.mkii create mode 100644 Master/texmf-dist/tex/context/base/supp-num.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/supp-num.tex create mode 100644 Master/texmf-dist/tex/context/base/supp-vis.mkii create mode 100644 Master/texmf-dist/tex/context/base/supp-vis.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/supp-vis.tex create mode 100644 Master/texmf-dist/tex/context/base/symb-cow.mkii create mode 100644 Master/texmf-dist/tex/context/base/symb-cow.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/symb-cow.tex create mode 100644 Master/texmf-dist/tex/context/base/symb-eur.mkii create mode 100644 Master/texmf-dist/tex/context/base/symb-eur.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/symb-eur.tex create mode 100644 Master/texmf-dist/tex/context/base/symb-glm.mkii delete mode 100644 Master/texmf-dist/tex/context/base/symb-glm.tex create mode 100644 Master/texmf-dist/tex/context/base/symb-ini.lua create mode 100644 Master/texmf-dist/tex/context/base/symb-jmn.mkii create mode 100644 Master/texmf-dist/tex/context/base/symb-jmn.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/symb-jmn.tex create mode 100644 Master/texmf-dist/tex/context/base/symb-mis.mkii create mode 100644 Master/texmf-dist/tex/context/base/symb-mis.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/symb-mis.tex create mode 100644 Master/texmf-dist/tex/context/base/symb-mvs.mkii create mode 100644 Master/texmf-dist/tex/context/base/symb-mvs.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/symb-mvs.tex create mode 100644 Master/texmf-dist/tex/context/base/symb-nav.mkii create mode 100644 Master/texmf-dist/tex/context/base/symb-nav.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/symb-nav.tex create mode 100644 Master/texmf-dist/tex/context/base/symb-uni.mkii delete mode 100644 Master/texmf-dist/tex/context/base/symb-uni.tex create mode 100644 Master/texmf-dist/tex/context/base/symb-was.mkii delete mode 100644 Master/texmf-dist/tex/context/base/symb-was.tex create mode 100644 Master/texmf-dist/tex/context/base/syst-ini.mkii create mode 100644 Master/texmf-dist/tex/context/base/syst-ini.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/syst-ini.tex delete mode 100644 Master/texmf-dist/tex/context/base/syst-ltx.tex create mode 100644 Master/texmf-dist/tex/context/base/syst-mes.mkiv create mode 100644 Master/texmf-dist/tex/context/base/syst-pln.mkii create mode 100644 Master/texmf-dist/tex/context/base/syst-pln.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/syst-pln.tex delete mode 100644 Master/texmf-dist/tex/context/base/syst-str.mkiv create mode 100644 Master/texmf-dist/tex/context/base/tabl-tbl.lua create mode 100644 Master/texmf-dist/tex/context/base/thrd-pic.mkii delete mode 100644 Master/texmf-dist/tex/context/base/thrd-pic.tex create mode 100644 Master/texmf-dist/tex/context/base/thrd-tab.mkii delete mode 100644 Master/texmf-dist/tex/context/base/thrd-tab.tex create mode 100644 Master/texmf-dist/tex/context/base/trac-pro.lua create mode 100644 Master/texmf-dist/tex/context/base/trac-set.lua create mode 100644 Master/texmf-dist/tex/context/base/trac-tex.lua delete mode 100644 Master/texmf-dist/tex/context/base/trac-tra.lua create mode 100644 Master/texmf-dist/tex/context/base/type-ini.lua create mode 100644 Master/texmf-dist/tex/context/base/typo-cln.lua create mode 100644 Master/texmf-dist/tex/context/base/typo-cln.mkiv create mode 100644 Master/texmf-dist/tex/context/base/typo-dir.lua create mode 100644 Master/texmf-dist/tex/context/base/typo-dir.mkiv create mode 100644 Master/texmf-dist/tex/context/base/typo-ini.lua create mode 100644 Master/texmf-dist/tex/context/base/typo-mar.lua create mode 100644 Master/texmf-dist/tex/context/base/typo-mar.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/typo-mir.lua delete mode 100644 Master/texmf-dist/tex/context/base/typo-mir.mkiv create mode 100644 Master/texmf-dist/tex/context/base/unic-ini.lua create mode 100644 Master/texmf-dist/tex/context/base/util-deb.lua create mode 100644 Master/texmf-dist/tex/context/base/util-dim.lua create mode 100644 Master/texmf-dist/tex/context/base/util-fmt.lua create mode 100644 Master/texmf-dist/tex/context/base/util-lua.lua create mode 100644 Master/texmf-dist/tex/context/base/util-mrg.lua create mode 100644 Master/texmf-dist/tex/context/base/util-pck.lua create mode 100644 Master/texmf-dist/tex/context/base/util-prs.lua create mode 100644 Master/texmf-dist/tex/context/base/util-seq.lua create mode 100644 Master/texmf-dist/tex/context/base/util-sto.lua create mode 100644 Master/texmf-dist/tex/context/base/util-str.lua create mode 100644 Master/texmf-dist/tex/context/base/util-tab.lua create mode 100644 Master/texmf-dist/tex/context/base/x-chemml.lua delete mode 100644 Master/texmf-dist/tex/context/base/x-chemml.tex create mode 100644 Master/texmf-dist/tex/context/base/x-css.lua create mode 100644 Master/texmf-dist/tex/context/base/x-css.mkiv create mode 100644 Master/texmf-dist/tex/context/base/x-fdf-00.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-fdf-00.tex create mode 100644 Master/texmf-dist/tex/context/base/x-fig-00.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-fig-00.tex create mode 100644 Master/texmf-dist/tex/context/base/x-fig-01.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-fig-01.tex create mode 100644 Master/texmf-dist/tex/context/base/x-fig-02.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-fig-02.tex create mode 100644 Master/texmf-dist/tex/context/base/x-fig-03.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-fig-03.tex create mode 100644 Master/texmf-dist/tex/context/base/x-ldx.lua create mode 100644 Master/texmf-dist/tex/context/base/x-ldx.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/x-ldx.tex delete mode 100644 Master/texmf-dist/tex/context/base/x-mathml.tex create mode 100644 Master/texmf-dist/tex/context/base/x-newcml.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-newcml.tex create mode 100644 Master/texmf-dist/tex/context/base/x-newmme.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-newmme.tex delete mode 100644 Master/texmf-dist/tex/context/base/x-newmml.tex create mode 100644 Master/texmf-dist/tex/context/base/x-newmmo.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-newmmo.tex create mode 100644 Master/texmf-dist/tex/context/base/x-newpml.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-newpml.tex create mode 100644 Master/texmf-dist/tex/context/base/x-openmath.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-openmath.tex delete mode 100644 Master/texmf-dist/tex/context/base/x-pending.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/x-physml.tex create mode 100644 Master/texmf-dist/tex/context/base/x-res-00.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-res-00.tex create mode 100644 Master/texmf-dist/tex/context/base/x-res-01.mkii create mode 100644 Master/texmf-dist/tex/context/base/x-res-01.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/x-res-01.tex create mode 100644 Master/texmf-dist/tex/context/base/x-res-02.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-res-02.tex create mode 100644 Master/texmf-dist/tex/context/base/x-res-03.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-res-03.tex create mode 100644 Master/texmf-dist/tex/context/base/x-res-04.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-res-04.tex create mode 100644 Master/texmf-dist/tex/context/base/x-res-08.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-res-08.tex create mode 100644 Master/texmf-dist/tex/context/base/x-res-09.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-res-09.tex create mode 100644 Master/texmf-dist/tex/context/base/x-res-10.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-res-10.tex create mode 100644 Master/texmf-dist/tex/context/base/x-res-11.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-res-11.tex create mode 100644 Master/texmf-dist/tex/context/base/x-res-12.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-res-12.tex create mode 100644 Master/texmf-dist/tex/context/base/x-res-20.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-res-20.tex create mode 100644 Master/texmf-dist/tex/context/base/x-res-50.mkii create mode 100644 Master/texmf-dist/tex/context/base/x-res-50.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/x-res-50.tex create mode 100644 Master/texmf-dist/tex/context/base/x-sch-00.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-sch-00.tex create mode 100644 Master/texmf-dist/tex/context/base/x-sch-01.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-sch-01.tex create mode 100644 Master/texmf-dist/tex/context/base/x-set-01.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-set-01.tex create mode 100644 Master/texmf-dist/tex/context/base/x-set-02.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-set-02.tex delete mode 100644 Master/texmf-dist/tex/context/base/x-set-11.tex create mode 100644 Master/texmf-dist/tex/context/base/x-set-12.mkii create mode 100644 Master/texmf-dist/tex/context/base/x-set-12.mkiv delete mode 100644 Master/texmf-dist/tex/context/base/x-set-12.tex delete mode 100644 Master/texmf-dist/tex/context/base/x-set-99.tex create mode 100644 Master/texmf-dist/tex/context/base/x-steps.mkii create mode 100644 Master/texmf-dist/tex/context/base/x-steps.mkiv create mode 100644 Master/texmf-dist/tex/context/base/x-xml-01.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-xml-01.tex create mode 100644 Master/texmf-dist/tex/context/base/x-xml-02.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-xml-02.tex create mode 100644 Master/texmf-dist/tex/context/base/x-xml-11.mkii delete mode 100644 Master/texmf-dist/tex/context/base/x-xml-11.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-cml.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-cml.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-ent.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-ent.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-exp.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-exp.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-ext.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-ext.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-hyp.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-hyp.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-ini.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-ini.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-map.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-map.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-mea.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-mea.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-meb.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-meb.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-mec.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-mec.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-meh.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-meh.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-men.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-men.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-meo.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-meo.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-mer.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-mer.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-mmc.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-mmc.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-mml.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-mml.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-mmp.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-mmp.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-mxa.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-mxa.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-mxb.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-mxb.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-mxc.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-mxc.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-mxh.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-mxh.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-mxn.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-mxn.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-mxo.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-mxo.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-mxr.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-mxr.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-pml.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-pml.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-pmu.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-pmu.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-pre.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-pre.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-prs.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-prs.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-raw.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-raw.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-rng.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-rng.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-run.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-run.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-stk.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-stk.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-utf.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-utf.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-xsd.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-xsd.tex create mode 100644 Master/texmf-dist/tex/context/base/xtag-xsl.mkii delete mode 100644 Master/texmf-dist/tex/context/base/xtag-xsl.tex create mode 100644 Master/texmf-dist/tex/context/bib/sample.bib delete mode 100644 Master/texmf-dist/tex/context/config/cont-usr.tex create mode 100644 Master/texmf-dist/tex/context/fonts/antykwapoltawskiego.lfg create mode 100644 Master/texmf-dist/tex/context/fonts/asana-math.lfg create mode 100644 Master/texmf-dist/tex/context/fonts/cambria-math.lfg create mode 100644 Master/texmf-dist/tex/context/fonts/demo.lfg create mode 100644 Master/texmf-dist/tex/context/fonts/dingbats.lfg create mode 100644 Master/texmf-dist/tex/context/fonts/xits-math.lfg create mode 100644 Master/texmf-dist/tex/context/patterns/lang-af.hyp create mode 100644 Master/texmf-dist/tex/context/patterns/lang-af.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-af.pat create mode 100644 Master/texmf-dist/tex/context/patterns/lang-af.rme create mode 100644 Master/texmf-dist/tex/context/patterns/lang-agr.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-agr.rme create mode 100644 Master/texmf-dist/tex/context/patterns/lang-bg.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-ca.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-cs.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-cy.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-da.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-de.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-deo.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-es.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-et.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-eu.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-fi.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-fr.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-gb.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-hr.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-hu.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-is.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-it.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-la.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-lt.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-lv.hyp create mode 100644 Master/texmf-dist/tex/context/patterns/lang-lv.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-lv.pat create mode 100644 Master/texmf-dist/tex/context/patterns/lang-lv.rme create mode 100644 Master/texmf-dist/tex/context/patterns/lang-mn.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-nb.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-nl.lua delete mode 100644 Master/texmf-dist/tex/context/patterns/lang-nl.rhl delete mode 100644 Master/texmf-dist/tex/context/patterns/lang-nl.rpl create mode 100644 Master/texmf-dist/tex/context/patterns/lang-nn.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-pl.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-pt.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-ro.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-ru.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-sk.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-sl.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-sr.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-sv.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-tk.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-tr.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-uk.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-us.lua create mode 100644 Master/texmf-dist/tex/context/patterns/lang-zh.lua create mode 100644 Master/texmf-dist/tex/context/sample/cow.pdf create mode 100644 Master/texmf-dist/tex/context/sample/hacker.jpg create mode 100644 Master/texmf-dist/tex/context/sample/khatt-ar.tex create mode 100644 Master/texmf-dist/tex/context/sample/khatt-en.tex create mode 100644 Master/texmf-dist/tex/context/sample/mill.png create mode 100644 Master/texmf-dist/tex/context/sample/spider.eps create mode 100644 Master/texmf-dist/tex/context/test/pdf-a1a-2005.mkiv create mode 100644 Master/texmf-dist/tex/context/test/pdf-a1b-2005.mkiv create mode 100644 Master/texmf-dist/tex/context/test/pdf-x-common.mkiv create mode 100644 Master/texmf-dist/tex/context/test/pdf-x1a-2001.mkiv create mode 100644 Master/texmf-dist/tex/context/test/pdf-x1a-2003.mkiv create mode 100644 Master/texmf-dist/tex/context/test/pdf-x3-2002.mkiv create mode 100644 Master/texmf-dist/tex/context/test/pdf-x3-2003.mkiv create mode 100644 Master/texmf-dist/tex/context/test/pdf-x4.mkiv create mode 100644 Master/texmf-dist/tex/context/test/pdf-x4p.mkiv create mode 100644 Master/texmf-dist/tex/generic/context/luatex-basics-gen.lua create mode 100644 Master/texmf-dist/tex/generic/context/luatex-basics-nod.lua create mode 100644 Master/texmf-dist/tex/generic/context/luatex-fonts-cbk.lua create mode 100644 Master/texmf-dist/tex/generic/context/luatex-fonts-def.lua create mode 100644 Master/texmf-dist/tex/generic/context/luatex-fonts-demo-vf-1.lua create mode 100644 Master/texmf-dist/tex/generic/context/luatex-fonts-enc.lua create mode 100644 Master/texmf-dist/tex/generic/context/luatex-fonts-ext.lua create mode 100644 Master/texmf-dist/tex/generic/context/luatex-fonts-lua.lua create mode 100644 Master/texmf-dist/tex/generic/context/luatex-fonts-syn.lua create mode 100644 Master/texmf-dist/tex/generic/context/luatex-fonts-tfm.lua delete mode 100644 Master/texmf-dist/tex/generic/context/luatex-plain.tex create mode 100644 Master/texmf-dist/tex/generic/context/luatex-preprocessor-test.tex create mode 100644 Master/texmf-dist/tex/generic/context/luatex-preprocessor.lua create mode 100644 Master/texmf-dist/tex/generic/context/luatex-preprocessor.tex diff --git a/Build/source/texk/texlive/context/luatools b/Build/source/texk/texlive/context/luatools index c060beff8fe..c17b483be53 100755 --- a/Build/source/texk/texlive/context/luatools +++ b/Build/source/texk/texlive/context/luatools @@ -1,8312 +1,2 @@ -#!/usr/bin/env texlua - -if not modules then modules = { } end modules ['luatools'] = { - version = 1.001, - comment = "companion to context.tex", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local format = string.format - --- one can make a stub: --- --- #!/bin/sh --- env LUATEXDIR=/....../texmf/scripts/context/lua texlua luatools.lua "$@" - --- Although this script is part of the ConTeXt distribution it is --- relatively indepent of ConTeXt. The same is true for some of --- the luat files. We may may make them even less dependent in --- the future. As long as Luatex is under development the --- interfaces and names of functions may change. - --- For the sake of independence we optionally can merge the library --- code here. It's too much code, but that does not harm. Much of the --- library code is used elsewhere. We don't want dependencies on --- Lua library paths simply because these scripts are located in the --- texmf tree and not in some Lua path. Normally this merge is not --- needed when texmfstart is used, or when the proper stub is used or --- when (windows) suffix binding is active. - -texlua = true - --- begin library merge - - - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-string'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local sub, gsub, find, match, gmatch, format, char, byte, rep, lower = string.sub, string.gsub, string.find, string.match, string.gmatch, string.format, string.char, string.byte, string.rep, string.lower -local lpegmatch = lpeg.match - --- some functions may disappear as they are not used anywhere - -if not string.split then - - -- this will be overloaded by a faster lpeg variant - - function string:split(pattern) - if #self > 0 then - local t = { } - for s in gmatch(self..pattern,"(.-)"..pattern) do - t[#t+1] = s - end - return t - else - return { } - end - end - -end - -local chr_to_esc = { - ["%"] = "%%", - ["."] = "%.", - ["+"] = "%+", ["-"] = "%-", ["*"] = "%*", - ["^"] = "%^", ["$"] = "%$", - ["["] = "%[", ["]"] = "%]", - ["("] = "%(", [")"] = "%)", - ["{"] = "%{", ["}"] = "%}" -} - -string.chr_to_esc = chr_to_esc - -function string:esc() -- variant 2 - return (gsub(self,"(.)",chr_to_esc)) -end - -function string:unquote() - return (gsub(self,"^([\"\'])(.*)%1$","%2")) -end - ---~ function string:unquote() ---~ if find(self,"^[\'\"]") then ---~ return sub(self,2,-2) ---~ else ---~ return self ---~ end ---~ end - -function string:quote() -- we could use format("%q") - return format("%q",self) -end - -function string:count(pattern) -- variant 3 - local n = 0 - for _ in gmatch(self,pattern) do - n = n + 1 - end - return n -end - -function string:limit(n,sentinel) - if #self > n then - sentinel = sentinel or " ..." - return sub(self,1,(n-#sentinel)) .. sentinel - else - return self - end -end - ---~ function string:strip() -- the .- is quite efficient ---~ -- return match(self,"^%s*(.-)%s*$") or "" ---~ -- return match(self,'^%s*(.*%S)') or '' -- posted on lua list ---~ return find(s,'^%s*$') and '' or match(s,'^%s*(.*%S)') ---~ end - -do -- roberto's variant: - local space = lpeg.S(" \t\v\n") - local nospace = 1 - space - local stripper = space^0 * lpeg.C((space^0 * nospace^1)^0) - function string.strip(str) - return lpegmatch(stripper,str) or "" - end -end - -function string:is_empty() - return not find(self,"%S") -end - -function string:enhance(pattern,action) - local ok, n = true, 0 - while ok do - ok = false - self = gsub(self,pattern, function(...) - ok, n = true, n + 1 - return action(...) - end) - end - return self, n -end - -local chr_to_hex, hex_to_chr = { }, { } - -for i=0,255 do - local c, h = char(i), format("%02X",i) - chr_to_hex[c], hex_to_chr[h] = h, c -end - -function string:to_hex() - return (gsub(self or "","(.)",chr_to_hex)) -end - -function string:from_hex() - return (gsub(self or "","(..)",hex_to_chr)) -end - -if not string.characters then - - local function nextchar(str, index) - index = index + 1 - return (index <= #str) and index or nil, sub(str,index,index) - end - function string:characters() - return nextchar, self, 0 - end - local function nextbyte(str, index) - index = index + 1 - return (index <= #str) and index or nil, byte(sub(str,index,index)) - end - function string:bytes() - return nextbyte, self, 0 - end - -end - --- we can use format for this (neg n) - -function string:rpadd(n,chr) - local m = n-#self - if m > 0 then - return self .. rep(chr or " ",m) - else - return self - end -end - -function string:lpadd(n,chr) - local m = n-#self - if m > 0 then - return rep(chr or " ",m) .. self - else - return self - end -end - -string.padd = string.rpadd - -function is_number(str) -- tonumber - return find(str,"^[%-%+]?[%d]-%.?[%d+]$") == 1 -end - ---~ print(is_number("1")) ---~ print(is_number("1.1")) ---~ print(is_number(".1")) ---~ print(is_number("-0.1")) ---~ print(is_number("+0.1")) ---~ print(is_number("-.1")) ---~ print(is_number("+.1")) - -function string:split_settings() -- no {} handling, see l-aux for lpeg variant - if find(self,"=") then - local t = { } - for k,v in gmatch(self,"(%a+)=([^%,]*)") do - t[k] = v - end - return t - else - return nil - end -end - -local patterns_escapes = { - ["-"] = "%-", - ["."] = "%.", - ["+"] = "%+", - ["*"] = "%*", - ["%"] = "%%", - ["("] = "%)", - [")"] = "%)", - ["["] = "%[", - ["]"] = "%]", -} - -function string:pattesc() - return (gsub(self,".",patterns_escapes)) -end - -local simple_escapes = { - ["-"] = "%-", - ["."] = "%.", - ["?"] = ".", - ["*"] = ".*", -} - -function string:simpleesc() - return (gsub(self,".",simple_escapes)) -end - -function string:tohash() - local t = { } - for s in gmatch(self,"([^, ]+)") do -- lpeg - t[s] = true - end - return t -end - -local pattern = lpeg.Ct(lpeg.C(1)^0) - -function string:totable() - return lpegmatch(pattern,self) -end - ---~ local t = { ---~ "1234567123456712345671234567", ---~ "a\tb\tc", ---~ "aa\tbb\tcc", ---~ "aaa\tbbb\tccc", ---~ "aaaa\tbbbb\tcccc", ---~ "aaaaa\tbbbbb\tccccc", ---~ "aaaaaa\tbbbbbb\tcccccc", ---~ } ---~ for k,v do ---~ print(string.tabtospace(t[k])) ---~ end - -function string.tabtospace(str,tab) - -- we don't handle embedded newlines - while true do - local s = find(str,"\t") - if s then - if not tab then tab = 7 end -- only when found - local d = tab-(s-1) % tab - if d > 0 then - str = gsub(str,"\t",rep(" ",d),1) - else - str = gsub(str,"\t","",1) - end - else - break - end - end - return str -end - -function string:compactlong() -- strips newlines and leading spaces - self = gsub(self,"[\n\r]+ *","") - self = gsub(self,"^ *","") - return self -end - -function string:striplong() -- strips newlines and leading spaces - self = gsub(self,"^%s*","") - self = gsub(self,"[\n\r]+ *","\n") - return self -end - -function string:topattern(lowercase,strict) - if lowercase then - self = lower(self) - end - self = gsub(self,".",simple_escapes) - if self == "" then - self = ".*" - elseif strict then - self = "^" .. self .. "$" - end - return self -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-lpeg'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local lpeg = require("lpeg") - -lpeg.patterns = lpeg.patterns or { } -- so that we can share -local patterns = lpeg.patterns - -local P, R, S, Ct, C, Cs, Cc, V = lpeg.P, lpeg.R, lpeg.S, lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.V -local match = lpeg.match - -local digit, sign = R('09'), S('+-') -local cr, lf, crlf = P("\r"), P("\n"), P("\r\n") -local utf8byte = R("\128\191") - -patterns.utf8byte = utf8byte -patterns.utf8one = R("\000\127") -patterns.utf8two = R("\194\223") * utf8byte -patterns.utf8three = R("\224\239") * utf8byte * utf8byte -patterns.utf8four = R("\240\244") * utf8byte * utf8byte * utf8byte - -patterns.digit = digit -patterns.sign = sign -patterns.cardinal = sign^0 * digit^1 -patterns.integer = sign^0 * digit^1 -patterns.float = sign^0 * digit^0 * P('.') * digit^1 -patterns.number = patterns.float + patterns.integer -patterns.oct = P("0") * R("07")^1 -patterns.octal = patterns.oct -patterns.HEX = P("0x") * R("09","AF")^1 -patterns.hex = P("0x") * R("09","af")^1 -patterns.hexadecimal = P("0x") * R("09","AF","af")^1 -patterns.lowercase = R("az") -patterns.uppercase = R("AZ") -patterns.letter = patterns.lowercase + patterns.uppercase -patterns.space = S(" ") -patterns.eol = S("\n\r") -patterns.spacer = S(" \t\f\v") -- + string.char(0xc2, 0xa0) if we want utf (cf mail roberto) -patterns.newline = crlf + cr + lf -patterns.nonspace = 1 - patterns.space -patterns.nonspacer = 1 - patterns.spacer -patterns.whitespace = patterns.eol + patterns.spacer -patterns.nonwhitespace = 1 - patterns.whitespace -patterns.utf8 = patterns.utf8one + patterns.utf8two + patterns.utf8three + patterns.utf8four -patterns.utfbom = P('\000\000\254\255') + P('\255\254\000\000') + P('\255\254') + P('\254\255') + P('\239\187\191') - -function lpeg.anywhere(pattern) --slightly adapted from website - return P { P(pattern) + 1 * V(1) } -- why so complex? -end - -function lpeg.splitter(pattern, action) - return (((1-P(pattern))^1)/action+1)^0 -end - -local spacing = patterns.spacer^0 * patterns.newline -- sort of strip -local empty = spacing * Cc("") -local nonempty = Cs((1-spacing)^1) * spacing^-1 -local content = (empty + nonempty)^1 - -local capture = Ct(content^0) - -function string:splitlines() - return match(capture,self) -end - -patterns.textline = content - ---~ local p = lpeg.splitat("->",false) print(match(p,"oeps->what->more")) -- oeps what more ---~ local p = lpeg.splitat("->",true) print(match(p,"oeps->what->more")) -- oeps what->more ---~ local p = lpeg.splitat("->",false) print(match(p,"oeps")) -- oeps ---~ local p = lpeg.splitat("->",true) print(match(p,"oeps")) -- oeps - -local splitters_s, splitters_m = { }, { } - -local function splitat(separator,single) - local splitter = (single and splitters_s[separator]) or splitters_m[separator] - if not splitter then - separator = P(separator) - if single then - local other, any = C((1 - separator)^0), P(1) - splitter = other * (separator * C(any^0) + "") -- ? - splitters_s[separator] = splitter - else - local other = C((1 - separator)^0) - splitter = other * (separator * other)^0 - splitters_m[separator] = splitter - end - end - return splitter -end - -lpeg.splitat = splitat - -local cache = { } - -function lpeg.split(separator,str) - local c = cache[separator] - if not c then - c = Ct(splitat(separator)) - cache[separator] = c - end - return match(c,str) -end - -function string:split(separator) - local c = cache[separator] - if not c then - c = Ct(splitat(separator)) - cache[separator] = c - end - return match(c,self) -end - -lpeg.splitters = cache - -local cache = { } - -function lpeg.checkedsplit(separator,str) - local c = cache[separator] - if not c then - separator = P(separator) - local other = C((1 - separator)^0) - c = Ct(separator^0 * other * (separator^1 * other)^0) - cache[separator] = c - end - return match(c,str) -end - -function string:checkedsplit(separator) - local c = cache[separator] - if not c then - separator = P(separator) - local other = C((1 - separator)^0) - c = Ct(separator^0 * other * (separator^1 * other)^0) - cache[separator] = c - end - return match(c,self) -end - ---~ function lpeg.append(list,pp) ---~ local p = pp ---~ for l=1,#list do ---~ if p then ---~ p = p + P(list[l]) ---~ else ---~ p = P(list[l]) ---~ end ---~ end ---~ return p ---~ end - ---~ from roberto's site: - -local f1 = string.byte - -local function f2(s) local c1, c2 = f1(s,1,2) return c1 * 64 + c2 - 12416 end -local function f3(s) local c1, c2, c3 = f1(s,1,3) return (c1 * 64 + c2) * 64 + c3 - 925824 end -local function f4(s) local c1, c2, c3, c4 = f1(s,1,4) return ((c1 * 64 + c2) * 64 + c3) * 64 + c4 - 63447168 end - -patterns.utf8byte = patterns.utf8one/f1 + patterns.utf8two/f2 + patterns.utf8three/f3 + patterns.utf8four/f4 - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-table'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -table.join = table.concat - -local concat, sort, insert, remove = table.concat, table.sort, table.insert, table.remove -local format, find, gsub, lower, dump, match = string.format, string.find, string.gsub, string.lower, string.dump, string.match -local getmetatable, setmetatable = getmetatable, setmetatable -local type, next, tostring, tonumber, ipairs = type, next, tostring, tonumber, ipairs - --- Starting with version 5.2 Lua no longer provide ipairs, which makes --- sense. As we already used the for loop and # in most places the --- impact on ConTeXt was not that large; the remaining ipairs already --- have been replaced. In a similar fashio we also hardly used pairs. --- --- Just in case, we provide the fallbacks as discussed in Programming --- in Lua (http://www.lua.org/pil/7.3.html): - -if not ipairs then - - -- for k, v in ipairs(t) do ... end - -- for k=1,#t do local v = t[k] ... end - - local function iterate(a,i) - i = i + 1 - local v = a[i] - if v ~= nil then - return i, v --, nil - end - end - - function ipairs(a) - return iterate, a, 0 - end - -end - -if not pairs then - - -- for k, v in pairs(t) do ... end - -- for k, v in next, t do ... end - - function pairs(t) - return next, t -- , nil - end - -end - --- Also, unpack has been moved to the table table, and for compatiility --- reasons we provide both now. - -if not table.unpack then - table.unpack = _G.unpack -elseif not unpack then - _G.unpack = table.unpack -end - --- extra functions, some might go (when not used) - -function table.strip(tab) - local lst = { } - for i=1,#tab do - local s = gsub(tab[i],"^%s*(.-)%s*$","%1") - if s == "" then - -- skip this one - else - lst[#lst+1] = s - end - end - return lst -end - -function table.keys(t) - local k = { } - for key, _ in next, t do - k[#k+1] = key - end - return k -end - -local function compare(a,b) - return (tostring(a) < tostring(b)) -end - -local function sortedkeys(tab) - local srt, kind = { }, 0 -- 0=unknown 1=string, 2=number 3=mixed - for key,_ in next, tab do - srt[#srt+1] = key - if kind == 3 then - -- no further check - else - local tkey = type(key) - if tkey == "string" then - -- if kind == 2 then kind = 3 else kind = 1 end - kind = (kind == 2 and 3) or 1 - elseif tkey == "number" then - -- if kind == 1 then kind = 3 else kind = 2 end - kind = (kind == 1 and 3) or 2 - else - kind = 3 - end - end - end - if kind == 0 or kind == 3 then - sort(srt,compare) - else - sort(srt) - end - return srt -end - -local function sortedhashkeys(tab) -- fast one - local srt = { } - for key,_ in next, tab do - srt[#srt+1] = key - end - sort(srt) - return srt -end - -table.sortedkeys = sortedkeys -table.sortedhashkeys = sortedhashkeys - -function table.sortedhash(t) - local s = sortedhashkeys(t) -- maybe just sortedkeys - local n = 0 - local function kv(s) - n = n + 1 - local k = s[n] - return k, t[k] - end - return kv, s -end - -table.sortedpairs = table.sortedhash - -function table.append(t, list) - for _,v in next, list do - insert(t,v) - end -end - -function table.prepend(t, list) - for k,v in next, list do - insert(t,k,v) - end -end - -function table.merge(t, ...) -- first one is target - t = t or {} - local lst = {...} - for i=1,#lst do - for k, v in next, lst[i] do - t[k] = v - end - end - return t -end - -function table.merged(...) - local tmp, lst = { }, {...} - for i=1,#lst do - for k, v in next, lst[i] do - tmp[k] = v - end - end - return tmp -end - -function table.imerge(t, ...) - local lst = {...} - for i=1,#lst do - local nst = lst[i] - for j=1,#nst do - t[#t+1] = nst[j] - end - end - return t -end - -function table.imerged(...) - local tmp, lst = { }, {...} - for i=1,#lst do - local nst = lst[i] - for j=1,#nst do - tmp[#tmp+1] = nst[j] - end - end - return tmp -end - -local function fastcopy(old) -- fast one - if old then - local new = { } - for k,v in next, old do - if type(v) == "table" then - new[k] = fastcopy(v) -- was just table.copy - else - new[k] = v - end - end - -- optional second arg - local mt = getmetatable(old) - if mt then - setmetatable(new,mt) - end - return new - else - return { } - end -end - -local function copy(t, tables) -- taken from lua wiki, slightly adapted - tables = tables or { } - local tcopy = {} - if not tables[t] then - tables[t] = tcopy - end - for i,v in next, t do -- brrr, what happens with sparse indexed - if type(i) == "table" then - if tables[i] then - i = tables[i] - else - i = copy(i, tables) - end - end - if type(v) ~= "table" then - tcopy[i] = v - elseif tables[v] then - tcopy[i] = tables[v] - else - tcopy[i] = copy(v, tables) - end - end - local mt = getmetatable(t) - if mt then - setmetatable(tcopy,mt) - end - return tcopy -end - -table.fastcopy = fastcopy -table.copy = copy - --- roughly: copy-loop : unpack : sub == 0.9 : 0.4 : 0.45 (so in critical apps, use unpack) - -function table.sub(t,i,j) - return { unpack(t,i,j) } -end - -function table.replace(a,b) - for k,v in next, b do - a[k] = v - end -end - --- slower than #t on indexed tables (#t only returns the size of the numerically indexed slice) - -function table.is_empty(t) -- obolete, use inline code instead - return not t or not next(t) -end - -function table.one_entry(t) -- obolete, use inline code instead - local n = next(t) - return n and not next(t,n) -end - ---~ function table.starts_at(t) -- obsolete, not nice anyway ---~ return ipairs(t,1)(t,0) ---~ end - -function table.tohash(t,value) - local h = { } - if t then - if value == nil then value = true end - for _, v in next, t do -- no ipairs here - h[v] = value - end - end - return h -end - -function table.fromhash(t) - local h = { } - for k, v in next, t do -- no ipairs here - if v then h[#h+1] = k end - end - return h -end - ---~ print(table.serialize(t), "\n") ---~ print(table.serialize(t,"name"), "\n") ---~ print(table.serialize(t,false), "\n") ---~ print(table.serialize(t,true), "\n") ---~ print(table.serialize(t,"name",true), "\n") ---~ print(table.serialize(t,"name",true,true), "\n") - -table.serialize_functions = true -table.serialize_compact = true -table.serialize_inline = true - -local noquotes, hexify, handle, reduce, compact, inline, functions - -local reserved = table.tohash { -- intercept a language flaw, no reserved words as key - 'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', 'if', - 'in', 'local', 'nil', 'not', 'or', 'repeat', 'return', 'then', 'true', 'until', 'while', -} - -local function simple_table(t) - if #t > 0 then - local n = 0 - for _,v in next, t do - n = n + 1 - end - if n == #t then - local tt = { } - for i=1,#t do - local v = t[i] - local tv = type(v) - if tv == "number" then - if hexify then - tt[#tt+1] = format("0x%04X",v) - else - tt[#tt+1] = tostring(v) -- tostring not needed - end - elseif tv == "boolean" then - tt[#tt+1] = tostring(v) - elseif tv == "string" then - tt[#tt+1] = format("%q",v) - else - tt = nil - break - end - end - return tt - end - end - return nil -end - --- Because this is a core function of mkiv I moved some function calls --- inline. --- --- twice as fast in a test: --- --- local propername = lpeg.P(lpeg.R("AZ","az","__") * lpeg.R("09","AZ","az", "__")^0 * lpeg.P(-1) ) - --- problem: there no good number_to_string converter with the best resolution - -local function do_serialize(root,name,depth,level,indexed) - if level > 0 then - depth = depth .. " " - if indexed then - handle(format("%s{",depth)) - elseif name then - --~ handle(format("%s%s={",depth,key(name))) - if type(name) == "number" then -- or find(k,"^%d+$") then - if hexify then - handle(format("%s[0x%04X]={",depth,name)) - else - handle(format("%s[%s]={",depth,name)) - end - elseif noquotes and not reserved[name] and find(name,"^%a[%w%_]*$") then - handle(format("%s%s={",depth,name)) - else - handle(format("%s[%q]={",depth,name)) - end - else - handle(format("%s{",depth)) - end - end - -- we could check for k (index) being number (cardinal) - if root and next(root) then - local first, last = nil, 0 -- #root cannot be trusted here (will be ok in 5.2 when ipairs is gone) - if compact then - -- NOT: for k=1,#root do (we need to quit at nil) - for k,v in ipairs(root) do -- can we use next? - if not first then first = k end - last = last + 1 - end - end - local sk = sortedkeys(root) - for i=1,#sk do - local k = sk[i] - local v = root[k] - --~ if v == root then - -- circular - --~ else - local t = type(v) - if compact and first and type(k) == "number" and k >= first and k <= last then - if t == "number" then - if hexify then - handle(format("%s 0x%04X,",depth,v)) - else - handle(format("%s %s,",depth,v)) -- %.99g - end - elseif t == "string" then - if reduce and tonumber(v) then - handle(format("%s %s,",depth,v)) - else - handle(format("%s %q,",depth,v)) - end - elseif t == "table" then - if not next(v) then - handle(format("%s {},",depth)) - elseif inline then -- and #t > 0 - local st = simple_table(v) - if st then - handle(format("%s { %s },",depth,concat(st,", "))) - else - do_serialize(v,k,depth,level+1,true) - end - else - do_serialize(v,k,depth,level+1,true) - end - elseif t == "boolean" then - handle(format("%s %s,",depth,tostring(v))) - elseif t == "function" then - if functions then - handle(format('%s loadstring(%q),',depth,dump(v))) - else - handle(format('%s "function",',depth)) - end - else - handle(format("%s %q,",depth,tostring(v))) - end - elseif k == "__p__" then -- parent - if false then - handle(format("%s __p__=nil,",depth)) - end - elseif t == "number" then - --~ if hexify then - --~ handle(format("%s %s=0x%04X,",depth,key(k),v)) - --~ else - --~ handle(format("%s %s=%s,",depth,key(k),v)) -- %.99g - --~ end - if type(k) == "number" then -- or find(k,"^%d+$") then - if hexify then - handle(format("%s [0x%04X]=0x%04X,",depth,k,v)) - else - handle(format("%s [%s]=%s,",depth,k,v)) -- %.99g - end - elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then - if hexify then - handle(format("%s %s=0x%04X,",depth,k,v)) - else - handle(format("%s %s=%s,",depth,k,v)) -- %.99g - end - else - if hexify then - handle(format("%s [%q]=0x%04X,",depth,k,v)) - else - handle(format("%s [%q]=%s,",depth,k,v)) -- %.99g - end - end - elseif t == "string" then - if reduce and tonumber(v) then - --~ handle(format("%s %s=%s,",depth,key(k),v)) - if type(k) == "number" then -- or find(k,"^%d+$") then - if hexify then - handle(format("%s [0x%04X]=%s,",depth,k,v)) - else - handle(format("%s [%s]=%s,",depth,k,v)) - end - elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then - handle(format("%s %s=%s,",depth,k,v)) - else - handle(format("%s [%q]=%s,",depth,k,v)) - end - else - --~ handle(format("%s %s=%q,",depth,key(k),v)) - if type(k) == "number" then -- or find(k,"^%d+$") then - if hexify then - handle(format("%s [0x%04X]=%q,",depth,k,v)) - else - handle(format("%s [%s]=%q,",depth,k,v)) - end - elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then - handle(format("%s %s=%q,",depth,k,v)) - else - handle(format("%s [%q]=%q,",depth,k,v)) - end - end - elseif t == "table" then - if not next(v) then - --~ handle(format("%s %s={},",depth,key(k))) - if type(k) == "number" then -- or find(k,"^%d+$") then - if hexify then - handle(format("%s [0x%04X]={},",depth,k)) - else - handle(format("%s [%s]={},",depth,k)) - end - elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then - handle(format("%s %s={},",depth,k)) - else - handle(format("%s [%q]={},",depth,k)) - end - elseif inline then - local st = simple_table(v) - if st then - --~ handle(format("%s %s={ %s },",depth,key(k),concat(st,", "))) - if type(k) == "number" then -- or find(k,"^%d+$") then - if hexify then - handle(format("%s [0x%04X]={ %s },",depth,k,concat(st,", "))) - else - handle(format("%s [%s]={ %s },",depth,k,concat(st,", "))) - end - elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then - handle(format("%s %s={ %s },",depth,k,concat(st,", "))) - else - handle(format("%s [%q]={ %s },",depth,k,concat(st,", "))) - end - else - do_serialize(v,k,depth,level+1) - end - else - do_serialize(v,k,depth,level+1) - end - elseif t == "boolean" then - --~ handle(format("%s %s=%s,",depth,key(k),tostring(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then - if hexify then - handle(format("%s [0x%04X]=%s,",depth,k,tostring(v))) - else - handle(format("%s [%s]=%s,",depth,k,tostring(v))) - end - elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then - handle(format("%s %s=%s,",depth,k,tostring(v))) - else - handle(format("%s [%q]=%s,",depth,k,tostring(v))) - end - elseif t == "function" then - if functions then - --~ handle(format('%s %s=loadstring(%q),',depth,key(k),dump(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then - if hexify then - handle(format("%s [0x%04X]=loadstring(%q),",depth,k,dump(v))) - else - handle(format("%s [%s]=loadstring(%q),",depth,k,dump(v))) - end - elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then - handle(format("%s %s=loadstring(%q),",depth,k,dump(v))) - else - handle(format("%s [%q]=loadstring(%q),",depth,k,dump(v))) - end - end - else - --~ handle(format("%s %s=%q,",depth,key(k),tostring(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then - if hexify then - handle(format("%s [0x%04X]=%q,",depth,k,tostring(v))) - else - handle(format("%s [%s]=%q,",depth,k,tostring(v))) - end - elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then - handle(format("%s %s=%q,",depth,k,tostring(v))) - else - handle(format("%s [%q]=%q,",depth,k,tostring(v))) - end - end - --~ end - end - end - if level > 0 then - handle(format("%s},",depth)) - end -end - --- replacing handle by a direct t[#t+1] = ... (plus test) is not much --- faster (0.03 on 1.00 for zapfino.tma) - -local function serialize(root,name,_handle,_reduce,_noquotes,_hexify) - noquotes = _noquotes - hexify = _hexify - handle = _handle or print - reduce = _reduce or false - compact = table.serialize_compact - inline = compact and table.serialize_inline - functions = table.serialize_functions - local tname = type(name) - if tname == "string" then - if name == "return" then - handle("return {") - else - handle(name .. "={") - end - elseif tname == "number" then - if hexify then - handle(format("[0x%04X]={",name)) - else - handle("[" .. name .. "]={") - end - elseif tname == "boolean" then - if name then - handle("return {") - else - handle("{") - end - else - handle("t={") - end - if root and next(root) then - do_serialize(root,name,"",0,indexed) - end - handle("}") -end - ---~ name: ---~ ---~ true : return { } ---~ false : { } ---~ nil : t = { } ---~ string : string = { } ---~ 'return' : return { } ---~ number : [number] = { } - -function table.serialize(root,name,reduce,noquotes,hexify) - local t = { } - local function flush(s) - t[#t+1] = s - end - serialize(root,name,flush,reduce,noquotes,hexify) - return concat(t,"\n") -end - -function table.tohandle(handle,root,name,reduce,noquotes,hexify) - serialize(root,name,handle,reduce,noquotes,hexify) -end - --- sometimes tables are real use (zapfino extra pro is some 85M) in which --- case a stepwise serialization is nice; actually, we could consider: --- --- for line in table.serializer(root,name,reduce,noquotes) do --- ...(line) --- end --- --- so this is on the todo list - -table.tofile_maxtab = 2*1024 - -function table.tofile(filename,root,name,reduce,noquotes,hexify) - local f = io.open(filename,'w') - if f then - local maxtab = table.tofile_maxtab - if maxtab > 1 then - local t = { } - local function flush(s) - t[#t+1] = s - if #t > maxtab then - f:write(concat(t,"\n"),"\n") -- hm, write(sometable) should be nice - t = { } - end - end - serialize(root,name,flush,reduce,noquotes,hexify) - f:write(concat(t,"\n"),"\n") - else - local function flush(s) - f:write(s,"\n") - end - serialize(root,name,flush,reduce,noquotes,hexify) - end - f:close() - end -end - -local function flatten(t,f,complete) -- is this used? meybe a variant with next, ... - for i=1,#t do - local v = t[i] - if type(v) == "table" then - if complete or type(v[1]) == "table" then - flatten(v,f,complete) - else - f[#f+1] = v - end - else - f[#f+1] = v - end - end -end - -function table.flatten(t) - local f = { } - flatten(t,f,true) - return f -end - -function table.unnest(t) -- bad name - local f = { } - flatten(t,f,false) - return f -end - -table.flatten_one_level = table.unnest - --- a better one: - -local function flattened(t,f) - if not f then - f = { } - end - for k, v in next, t do - if type(v) == "table" then - flattened(v,f) - else - f[k] = v - end - end - return f -end - -table.flattened = flattened - --- the next three may disappear - -function table.remove_value(t,value) -- todo: n - if value then - for i=1,#t do - if t[i] == value then - remove(t,i) - -- remove all, so no: return - end - end - end -end - -function table.insert_before_value(t,value,str) - if str then - if value then - for i=1,#t do - if t[i] == value then - insert(t,i,str) - return - end - end - end - insert(t,1,str) - elseif value then - insert(t,1,value) - end -end - -function table.insert_after_value(t,value,str) - if str then - if value then - for i=1,#t do - if t[i] == value then - insert(t,i+1,str) - return - end - end - end - t[#t+1] = str - elseif value then - t[#t+1] = value - end -end - -local function are_equal(a,b,n,m) -- indexed - if a and b and #a == #b then - n = n or 1 - m = m or #a - for i=n,m do - local ai, bi = a[i], b[i] - if ai==bi then - -- same - elseif type(ai)=="table" and type(bi)=="table" then - if not are_equal(ai,bi) then - return false - end - else - return false - end - end - return true - else - return false - end -end - -local function identical(a,b) -- assumes same structure - for ka, va in next, a do - local vb = b[k] - if va == vb then - -- same - elseif type(va) == "table" and type(vb) == "table" then - if not identical(va,vb) then - return false - end - else - return false - end - end - return true -end - -table.are_equal = are_equal -table.identical = identical - --- maybe also make a combined one - -function table.compact(t) - if t then - for k,v in next, t do - if not next(v) then - t[k] = nil - end - end - end -end - -function table.contains(t, v) - if t then - for i=1, #t do - if t[i] == v then - return i - end - end - end - return false -end - -function table.count(t) - local n, e = 0, next(t) - while e do - n, e = n + 1, next(t,e) - end - return n -end - -function table.swapped(t) - local s = { } - for k, v in next, t do - s[v] = k - end - return s -end - ---~ function table.are_equal(a,b) ---~ return table.serialize(a) == table.serialize(b) ---~ end - -function table.clone(t,p) -- t is optional or nil or table - if not p then - t, p = { }, t or { } - elseif not t then - t = { } - end - setmetatable(t, { __index = function(_,key) return p[key] end }) -- why not __index = p ? - return t -end - -function table.hexed(t,seperator) - local tt = { } - for i=1,#t do tt[i] = format("0x%04X",t[i]) end - return concat(tt,seperator or " ") -end - -function table.reverse_hash(h) - local r = { } - for k,v in next, h do - r[v] = lower(gsub(k," ","")) - end - return r -end - -function table.reverse(t) - local tt = { } - if #t > 0 then - for i=#t,1,-1 do - tt[#tt+1] = t[i] - end - end - return tt -end - -function table.insert_before_value(t,value,extra) - for i=1,#t do - if t[i] == extra then - remove(t,i) - end - end - for i=1,#t do - if t[i] == value then - insert(t,i,extra) - return - end - end - insert(t,1,extra) -end - -function table.insert_after_value(t,value,extra) - for i=1,#t do - if t[i] == extra then - remove(t,i) - end - end - for i=1,#t do - if t[i] == value then - insert(t,i+1,extra) - return - end - end - insert(t,#t+1,extra) -end - - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-io'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local byte, find, gsub = string.byte, string.find, string.gsub - -if string.find(os.getenv("PATH"),";") then - io.fileseparator, io.pathseparator = "\\", ";" -else - io.fileseparator, io.pathseparator = "/" , ":" -end - -function io.loaddata(filename,textmode) - local f = io.open(filename,(textmode and 'r') or 'rb') - if f then - -- collectgarbage("step") -- sometimes makes a big difference in mem consumption - local data = f:read('*all') - -- garbagecollector.check(data) - f:close() - return data - else - return nil - end -end - -function io.savedata(filename,data,joiner) - local f = io.open(filename,"wb") - if f then - if type(data) == "table" then - f:write(table.join(data,joiner or "")) - elseif type(data) == "function" then - data(f) - else - f:write(data or "") - end - f:close() - return true - else - return false - end -end - -function io.exists(filename) - local f = io.open(filename) - if f == nil then - return false - else - assert(f:close()) - return true - end -end - -function io.size(filename) - local f = io.open(filename) - if f == nil then - return 0 - else - local s = f:seek("end") - assert(f:close()) - return s - end -end - -function io.noflines(f) - local n = 0 - for _ in f:lines() do - n = n + 1 - end - f:seek('set',0) - return n -end - -local nextchar = { - [ 4] = function(f) - return f:read(1,1,1,1) - end, - [ 2] = function(f) - return f:read(1,1) - end, - [ 1] = function(f) - return f:read(1) - end, - [-2] = function(f) - local a, b = f:read(1,1) - return b, a - end, - [-4] = function(f) - local a, b, c, d = f:read(1,1,1,1) - return d, c, b, a - end -} - -function io.characters(f,n) - if f then - return nextchar[n or 1], f - else - return nil, nil - end -end - -local nextbyte = { - [4] = function(f) - local a, b, c, d = f:read(1,1,1,1) - if d then - return byte(a), byte(b), byte(c), byte(d) - else - return nil, nil, nil, nil - end - end, - [2] = function(f) - local a, b = f:read(1,1) - if b then - return byte(a), byte(b) - else - return nil, nil - end - end, - [1] = function (f) - local a = f:read(1) - if a then - return byte(a) - else - return nil - end - end, - [-2] = function (f) - local a, b = f:read(1,1) - if b then - return byte(b), byte(a) - else - return nil, nil - end - end, - [-4] = function(f) - local a, b, c, d = f:read(1,1,1,1) - if d then - return byte(d), byte(c), byte(b), byte(a) - else - return nil, nil, nil, nil - end - end -} - -function io.bytes(f,n) - if f then - return nextbyte[n or 1], f - else - return nil, nil - end -end - -function io.ask(question,default,options) - while true do - io.write(question) - if options then - io.write(string.format(" [%s]",table.concat(options,"|"))) - end - if default then - io.write(string.format(" [%s]",default)) - end - io.write(string.format(" ")) - local answer = io.read() - answer = gsub(answer,"^%s*(.*)%s*$","%1") - if answer == "" and default then - return default - elseif not options then - return answer - else - for k=1,#options do - if options[k] == answer then - return answer - end - end - local pattern = "^" .. answer - for k=1,#options do - local v = options[k] - if find(v,pattern) then - return v - end - end - end - end -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-number'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local tostring = tostring -local format, floor, insert, match = string.format, math.floor, table.insert, string.match -local lpegmatch = lpeg.match - -number = number or { } - --- a,b,c,d,e,f = number.toset(100101) - -function number.toset(n) - return match(tostring(n),"(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)") -end - -function number.toevenhex(n) - local s = format("%X",n) - if #s % 2 == 0 then - return s - else - return "0" .. s - end -end - --- the lpeg way is slower on 8 digits, but faster on 4 digits, some 7.5% --- on --- --- for i=1,1000000 do --- local a,b,c,d,e,f,g,h = number.toset(12345678) --- local a,b,c,d = number.toset(1234) --- local a,b,c = number.toset(123) --- end --- --- of course dedicated "(.)(.)(.)(.)" matches are even faster - -local one = lpeg.C(1-lpeg.S(''))^1 - -function number.toset(n) - return lpegmatch(one,tostring(n)) -end - -function number.bits(n,zero) - local t, i = { }, (zero and 0) or 1 - while n > 0 do - local m = n % 2 - if m > 0 then - insert(t,1,i) - end - n = floor(n/2) - i = i + 1 - end - return t -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-set'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -set = set or { } - -local nums = { } -local tabs = { } -local concat = table.concat -local next, type = next, type - -set.create = table.tohash - -function set.tonumber(t) - if next(t) then - local s = "" - -- we could save mem by sorting, but it slows down - for k, v in next, t do - if v then - -- why bother about the leading space - s = s .. " " .. k - end - end - local n = nums[s] - if not n then - n = #tabs + 1 - tabs[n] = t - nums[s] = n - end - return n - else - return 0 - end -end - -function set.totable(n) - if n == 0 then - return { } - else - return tabs[n] or { } - end -end - -function set.tolist(n) - if n == 0 or not tabs[n] then - return "" - else - local t = { } - for k, v in next, tabs[n] do - if v then - t[#t+1] = k - end - end - return concat(t," ") - end -end - -function set.contains(n,s) - if type(n) == "table" then - return n[s] - elseif n == 0 then - return false - else - local t = tabs[n] - return t and t[s] - end -end - ---~ local c = set.create{'aap','noot','mies'} ---~ local s = set.tonumber(c) ---~ local t = set.totable(s) ---~ print(t['aap']) ---~ local c = set.create{'zus','wim','jet'} ---~ local s = set.tonumber(c) ---~ local t = set.totable(s) ---~ print(t['aap']) ---~ print(t['jet']) ---~ print(set.contains(t,'jet')) ---~ print(set.contains(t,'aap')) - - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-os'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- maybe build io.flush in os.execute - -local find, format, gsub = string.find, string.format, string.gsub -local random, ceil = math.random, math.ceil - -local execute, spawn, exec, ioflush = os.execute, os.spawn or os.execute, os.exec or os.execute, io.flush - -function os.execute(...) ioflush() return execute(...) end -function os.spawn (...) ioflush() return spawn (...) end -function os.exec (...) ioflush() return exec (...) end - -function os.resultof(command) - ioflush() -- else messed up logging - local handle = io.popen(command,"r") - if not handle then - -- print("unknown command '".. command .. "' in os.resultof") - return "" - else - return handle:read("*all") or "" - end -end - ---~ os.type : windows | unix (new, we already guessed os.platform) ---~ os.name : windows | msdos | linux | macosx | solaris | .. | generic (new) ---~ os.platform : extended os.name with architecture - -if not io.fileseparator then - if find(os.getenv("PATH"),";") then - io.fileseparator, io.pathseparator, os.type = "\\", ";", os.type or "mswin" - else - io.fileseparator, io.pathseparator, os.type = "/" , ":", os.type or "unix" - end -end - -os.type = os.type or (io.pathseparator == ";" and "windows") or "unix" -os.name = os.name or (os.type == "windows" and "mswin" ) or "linux" - -if os.type == "windows" then - os.libsuffix, os.binsuffix = 'dll', 'exe' -else - os.libsuffix, os.binsuffix = 'so', '' -end - -function os.launch(str) - if os.type == "windows" then - os.execute("start " .. str) -- os.spawn ? - else - os.execute(str .. " &") -- os.spawn ? - end -end - -if not os.times then - -- utime = user time - -- stime = system time - -- cutime = children user time - -- cstime = children system time - function os.times() - return { - utime = os.gettimeofday(), -- user - stime = 0, -- system - cutime = 0, -- children user - cstime = 0, -- children system - } - end -end - -os.gettimeofday = os.gettimeofday or os.clock - -local startuptime = os.gettimeofday() - -function os.runtime() - return os.gettimeofday() - startuptime -end - ---~ print(os.gettimeofday()-os.time()) ---~ os.sleep(1.234) ---~ print (">>",os.runtime()) ---~ print(os.date("%H:%M:%S",os.gettimeofday())) ---~ print(os.date("%H:%M:%S",os.time())) - --- no need for function anymore as we have more clever code and helpers now --- this metatable trickery might as well disappear - -os.resolvers = os.resolvers or { } - -local resolvers = os.resolvers - -local osmt = getmetatable(os) or { __index = function(t,k) t[k] = "unset" return "unset" end } -- maybe nil -local osix = osmt.__index - -osmt.__index = function(t,k) - return (resolvers[k] or osix)(t,k) -end - -setmetatable(os,osmt) - -if not os.setenv then - - -- we still store them but they won't be seen in - -- child processes although we might pass them some day - -- using command concatination - - local env, getenv = { }, os.getenv - - function os.setenv(k,v) - env[k] = v - end - - function os.getenv(k) - return env[k] or getenv(k) - end - -end - --- we can use HOSTTYPE on some platforms - -local name, platform = os.name or "linux", os.getenv("MTX_PLATFORM") or "" - -local function guess() - local architecture = os.resultof("uname -m") or "" - if architecture ~= "" then - return architecture - end - architecture = os.getenv("HOSTTYPE") or "" - if architecture ~= "" then - return architecture - end - return os.resultof("echo $HOSTTYPE") or "" -end - -if platform ~= "" then - - os.platform = platform - -elseif os.type == "windows" then - - -- we could set the variable directly, no function needed here - - function os.resolvers.platform(t,k) - local platform, architecture = "", os.getenv("PROCESSOR_ARCHITECTURE") or "" - if find(architecture,"AMD64") then - platform = "mswin-64" - else - platform = "mswin" - end - os.setenv("MTX_PLATFORM",platform) - os.platform = platform - return platform - end - -elseif name == "linux" then - - function os.resolvers.platform(t,k) - -- we sometims have HOSTTYPE set so let's check that first - local platform, architecture = "", os.getenv("HOSTTYPE") or os.resultof("uname -m") or "" - if find(architecture,"x86_64") then - platform = "linux-64" - elseif find(architecture,"ppc") then - platform = "linux-ppc" - else - platform = "linux" - end - os.setenv("MTX_PLATFORM",platform) - os.platform = platform - return platform - end - -elseif name == "macosx" then - - --[[ - Identifying the architecture of OSX is quite a mess and this - is the best we can come up with. For some reason $HOSTTYPE is - a kind of pseudo environment variable, not known to the current - environment. And yes, uname cannot be trusted either, so there - is a change that you end up with a 32 bit run on a 64 bit system. - Also, some proper 64 bit intel macs are too cheap (low-end) and - therefore not permitted to run the 64 bit kernel. - ]]-- - - function os.resolvers.platform(t,k) - -- local platform, architecture = "", os.getenv("HOSTTYPE") or "" - -- if architecture == "" then - -- architecture = os.resultof("echo $HOSTTYPE") or "" - -- end - local platform, architecture = "", os.resultof("echo $HOSTTYPE") or "" - if architecture == "" then - -- print("\nI have no clue what kind of OSX you're running so let's assume an 32 bit intel.\n") - platform = "osx-intel" - elseif find(architecture,"i386") then - platform = "osx-intel" - elseif find(architecture,"x86_64") then - platform = "osx-64" - else - platform = "osx-ppc" - end - os.setenv("MTX_PLATFORM",platform) - os.platform = platform - return platform - end - -elseif name == "sunos" then - - function os.resolvers.platform(t,k) - local platform, architecture = "", os.resultof("uname -m") or "" - if find(architecture,"sparc") then - platform = "solaris-sparc" - else -- if architecture == 'i86pc' - platform = "solaris-intel" - end - os.setenv("MTX_PLATFORM",platform) - os.platform = platform - return platform - end - -elseif name == "freebsd" then - - function os.resolvers.platform(t,k) - local platform, architecture = "", os.resultof("uname -m") or "" - if find(architecture,"amd64") then - platform = "freebsd-amd64" - else - platform = "freebsd" - end - os.setenv("MTX_PLATFORM",platform) - os.platform = platform - return platform - end - -elseif name == "kfreebsd" then - - function os.resolvers.platform(t,k) - -- we sometims have HOSTTYPE set so let's check that first - local platform, architecture = "", os.getenv("HOSTTYPE") or os.resultof("uname -m") or "" - if find(architecture,"x86_64") then - platform = "kfreebsd-64" - else - platform = "kfreebsd-i386" - end - os.setenv("MTX_PLATFORM",platform) - os.platform = platform - return platform - end - -else - - -- platform = "linux" - -- os.setenv("MTX_PLATFORM",platform) - -- os.platform = platform - - function os.resolvers.platform(t,k) - local platform = "linux" - os.setenv("MTX_PLATFORM",platform) - os.platform = platform - return platform - end - -end - --- beware, we set the randomseed - --- from wikipedia: Version 4 UUIDs use a scheme relying only on random numbers. This algorithm sets the --- version number as well as two reserved bits. All other bits are set using a random or pseudorandom --- data source. Version 4 UUIDs have the form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx with hexadecimal --- digits x and hexadecimal digits 8, 9, A, or B for y. e.g. f47ac10b-58cc-4372-a567-0e02b2c3d479. --- --- as we don't call this function too often there is not so much risk on repetition - -local t = { 8, 9, "a", "b" } - -function os.uuid() - return format("%04x%04x-4%03x-%s%03x-%04x-%04x%04x%04x", - random(0xFFFF),random(0xFFFF), - random(0x0FFF), - t[ceil(random(4))] or 8,random(0x0FFF), - random(0xFFFF), - random(0xFFFF),random(0xFFFF),random(0xFFFF) - ) -end - -local d - -function os.timezone(delta) - d = d or tonumber(tonumber(os.date("%H")-os.date("!%H"))) - if delta then - if d > 0 then - return format("+%02i:00",d) - else - return format("-%02i:00",-d) - end - else - return 1 - end -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-file'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- needs a cleanup - -file = file or { } - -local concat = table.concat -local find, gmatch, match, gsub, sub, char = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char -local lpegmatch = lpeg.match - -function file.removesuffix(filename) - return (gsub(filename,"%.[%a%d]+$","")) -end - -function file.addsuffix(filename, suffix) - if not suffix or suffix == "" then - return filename - elseif not find(filename,"%.[%a%d]+$") then - return filename .. "." .. suffix - else - return filename - end -end - -function file.replacesuffix(filename, suffix) - return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix -end - -function file.dirname(name,default) - return match(name,"^(.+)[/\\].-$") or (default or "") -end - -function file.basename(name) - return match(name,"^.+[/\\](.-)$") or name -end - -function file.nameonly(name) - return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) -end - -function file.extname(name,default) - return match(name,"^.+%.([^/\\]-)$") or default or "" -end - -file.suffix = file.extname - ---~ function file.join(...) ---~ local pth = concat({...},"/") ---~ pth = gsub(pth,"\\","/") ---~ local a, b = match(pth,"^(.*://)(.*)$") ---~ if a and b then ---~ return a .. gsub(b,"//+","/") ---~ end ---~ a, b = match(pth,"^(//)(.*)$") ---~ if a and b then ---~ return a .. gsub(b,"//+","/") ---~ end ---~ return (gsub(pth,"//+","/")) ---~ end - -local trick_1 = char(1) -local trick_2 = "^" .. trick_1 .. "/+" - -function file.join(...) - local lst = { ... } - local a, b = lst[1], lst[2] - if a == "" then - lst[1] = trick_1 - elseif b and find(a,"^/+$") and find(b,"^/") then - lst[1] = "" - lst[2] = gsub(b,"^/+","") - end - local pth = concat(lst,"/") - pth = gsub(pth,"\\","/") - local a, b = match(pth,"^(.*://)(.*)$") - if a and b then - return a .. gsub(b,"//+","/") - end - a, b = match(pth,"^(//)(.*)$") - if a and b then - return a .. gsub(b,"//+","/") - end - pth = gsub(pth,trick_2,"") - return (gsub(pth,"//+","/")) -end - ---~ print(file.join("//","/y")) ---~ print(file.join("/","/y")) ---~ print(file.join("","/y")) ---~ print(file.join("/x/","/y")) ---~ print(file.join("x/","/y")) ---~ print(file.join("http://","/y")) ---~ print(file.join("http://a","/y")) ---~ print(file.join("http:///a","/y")) ---~ print(file.join("//nas-1","/y")) - -function file.iswritable(name) - local a = lfs.attributes(name) or lfs.attributes(file.dirname(name,".")) - return a and sub(a.permissions,2,2) == "w" -end - -function file.isreadable(name) - local a = lfs.attributes(name) - return a and sub(a.permissions,1,1) == "r" -end - -file.is_readable = file.isreadable -file.is_writable = file.iswritable - --- todo: lpeg - ---~ function file.split_path(str) ---~ local t = { } ---~ str = gsub(str,"\\", "/") ---~ str = gsub(str,"(%a):([;/])", "%1\001%2") ---~ for name in gmatch(str,"([^;:]+)") do ---~ if name ~= "" then ---~ t[#t+1] = gsub(name,"\001",":") ---~ end ---~ end ---~ return t ---~ end - -local checkedsplit = string.checkedsplit - -function file.split_path(str,separator) - str = gsub(str,"\\","/") - return checkedsplit(str,separator or io.pathseparator) -end - -function file.join_path(tab) - return concat(tab,io.pathseparator) -- can have trailing // -end - --- we can hash them weakly - - -local insert = table.insert - -function file.collapse_path(str,anchor) - if anchor and not find(str,"^/") and not find(str,"^%a:") then - str = getcurrentdir() .. "/" .. str - end - if str == "" or str =="." then - return "." - elseif find(str,"^%.%.") then - str = gsub(str,"\\","/") - return str - elseif not find(str,"%.") then - str = gsub(str,"\\","/") - return str - end - str = gsub(str,"\\","/") - local starter, rest = match(str,"^(%a+:/*)(.-)$") - if starter then - str = rest - end - local oldelements = checkedsplit(str,"/") - local newelements = { } - local i = #oldelements - while i > 0 do - local element = oldelements[i] - if element == '.' then - -- do nothing - elseif element == '..' then - local n = i -1 - while n > 0 do - local element = oldelements[n] - if element ~= '..' and element ~= '.' then - oldelements[n] = '.' - break - else - n = n - 1 - end - end - if n < 1 then - insert(newelements,1,'..') - end - elseif element ~= "" then - insert(newelements,1,element) - end - i = i - 1 - end - if #newelements == 0 then - return starter or "." - elseif starter then - return starter .. concat(newelements, '/') - elseif find(str,"^/") then - return "/" .. concat(newelements,'/') - else - return concat(newelements, '/') - end -end -function file.xcollapse_path(str) - print('collapse', str) - if str == "" or str =="." then - return "." - elseif find(str,"^%.%.") then - return str - elseif not find(str,"%.") then - return str - end - str = gsub(str,"^%./",lfs.currentdir() .. "/") -- ./xx in qualified - str = gsub(str,"\\","/") - local oldelements = checkedsplit(str,"/") - local newelements = { } - local i = #oldelements - while i > 0 do - local element = oldelements[i] - if element == '.' then - -- do nothing - elseif element == '..' then - local n = i -1 - while n > 0 do - local element = oldelements[n] - if element ~= '..' and element ~= '.' then - oldelements[n] = '.' - break - else - n = n - 1 - end - end - if n<1 then - insert(newelements,1,'..') - end - elseif element ~= "" then - insert(newelements,1,element) - end - i = i - 1 - end - if #newelements == 0 then - return "." - elseif find(str,"^/") then - return "/" .. concat(newelements,'/') - else - return concat(newelements, '/') - end -end - ---~ print(file.collapse_path("/a")) ---~ print(file.collapse_path("a/./b/..")) ---~ print(file.collapse_path("a/aa/../b/bb")) ---~ print(file.collapse_path("a/../..")) ---~ print(file.collapse_path("a/.././././b/..")) ---~ print(file.collapse_path("a/./././b/..")) ---~ print(file.collapse_path("a/b/c/../..")) - -function file.robustname(str) - return (gsub(str,"[^%a%d%/%-%.\\]+","-")) -end - -file.readdata = io.loaddata -file.savedata = io.savedata - -function file.copy(oldname,newname) - file.savedata(newname,io.loaddata(oldname)) -end - --- lpeg variants, slightly faster, not always - ---~ local period = lpeg.P(".") ---~ local slashes = lpeg.S("\\/") ---~ local noperiod = 1-period ---~ local noslashes = 1-slashes ---~ local name = noperiod^1 - ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.C(noperiod^1) * -1 - ---~ function file.extname(name) ---~ return lpegmatch(pattern,name) or "" ---~ end - ---~ local pattern = lpeg.Cs(((period * noperiod^1 * -1)/"" + 1)^1) - ---~ function file.removesuffix(name) ---~ return lpegmatch(pattern,name) ---~ end - ---~ local pattern = (noslashes^0 * slashes)^1 * lpeg.C(noslashes^1) * -1 - ---~ function file.basename(name) ---~ return lpegmatch(pattern,name) or name ---~ end - ---~ local pattern = (noslashes^0 * slashes)^1 * lpeg.Cp() * noslashes^1 * -1 - ---~ function file.dirname(name) ---~ local p = lpegmatch(pattern,name) ---~ if p then ---~ return sub(name,1,p-2) ---~ else ---~ return "" ---~ end ---~ end - ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.Cp() * noperiod^1 * -1 - ---~ function file.addsuffix(name, suffix) ---~ local p = lpegmatch(pattern,name) ---~ if p then ---~ return name ---~ else ---~ return name .. "." .. suffix ---~ end ---~ end - ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.Cp() * noperiod^1 * -1 - ---~ function file.replacesuffix(name,suffix) ---~ local p = lpegmatch(pattern,name) ---~ if p then ---~ return sub(name,1,p-2) .. "." .. suffix ---~ else ---~ return name .. "." .. suffix ---~ end ---~ end - ---~ local pattern = (noslashes^0 * slashes)^0 * lpeg.Cp() * ((noperiod^1 * period)^1 * lpeg.Cp() + lpeg.P(true)) * noperiod^1 * -1 - ---~ function file.nameonly(name) ---~ local a, b = lpegmatch(pattern,name) ---~ if b then ---~ return sub(name,a,b-2) ---~ elseif a then ---~ return sub(name,a) ---~ else ---~ return name ---~ end ---~ end - ---~ local test = file.extname ---~ local test = file.basename ---~ local test = file.dirname ---~ local test = file.addsuffix ---~ local test = file.replacesuffix ---~ local test = file.nameonly - ---~ print(1,test("./a/b/c/abd.def.xxx","!!!")) ---~ print(2,test("./../b/c/abd.def.xxx","!!!")) ---~ print(3,test("a/b/c/abd.def.xxx","!!!")) ---~ print(4,test("a/b/c/def.xxx","!!!")) ---~ print(5,test("a/b/c/def","!!!")) ---~ print(6,test("def","!!!")) ---~ print(7,test("def.xxx","!!!")) - ---~ local tim = os.clock() for i=1,250000 do local ext = test("abd.def.xxx","!!!") end print(os.clock()-tim) - --- also rewrite previous - -local letter = lpeg.R("az","AZ") + lpeg.S("_-+") -local separator = lpeg.P("://") - -local qualified = lpeg.P(".")^0 * lpeg.P("/") + letter*lpeg.P(":") + letter^1*separator + letter^1 * lpeg.P("/") -local rootbased = lpeg.P("/") + letter*lpeg.P(":") - --- ./name ../name /name c: :// name/name - -function file.is_qualified_path(filename) - return lpegmatch(qualified,filename) ~= nil -end - -function file.is_rootbased_path(filename) - return lpegmatch(rootbased,filename) ~= nil -end - -local slash = lpeg.S("\\/") -local period = lpeg.P(".") -local drive = lpeg.C(lpeg.R("az","AZ")) * lpeg.P(":") -local path = lpeg.C(((1-slash)^0 * slash)^0) -local suffix = period * lpeg.C(lpeg.P(1-period)^0 * lpeg.P(-1)) -local base = lpeg.C((1-suffix)^0) - -local pattern = (drive + lpeg.Cc("")) * (path + lpeg.Cc("")) * (base + lpeg.Cc("")) * (suffix + lpeg.Cc("")) - -function file.splitname(str) -- returns drive, path, base, suffix - return lpegmatch(pattern,str) -end - --- function test(t) for k, v in next, t do print(v, "=>", file.splitname(v)) end end --- --- test { "c:", "c:/aa", "c:/aa/bb", "c:/aa/bb/cc", "c:/aa/bb/cc.dd", "c:/aa/bb/cc.dd.ee" } --- test { "c:", "c:aa", "c:aa/bb", "c:aa/bb/cc", "c:aa/bb/cc.dd", "c:aa/bb/cc.dd.ee" } --- test { "/aa", "/aa/bb", "/aa/bb/cc", "/aa/bb/cc.dd", "/aa/bb/cc.dd.ee" } --- test { "aa", "aa/bb", "aa/bb/cc", "aa/bb/cc.dd", "aa/bb/cc.dd.ee" } - ---~ -- todo: ---~ ---~ if os.type == "windows" then ---~ local currentdir = lfs.currentdir ---~ function lfs.currentdir() ---~ return (gsub(currentdir(),"\\","/")) ---~ end ---~ end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-md5'] = { - version = 1.001, - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- This also provides file checksums and checkers. - -local gsub, format, byte = string.gsub, string.format, string.byte - -local function convert(str,fmt) - return (gsub(md5.sum(str),".",function(chr) return format(fmt,byte(chr)) end)) -end - -if not md5.HEX then function md5.HEX(str) return convert(str,"%02X") end end -if not md5.hex then function md5.hex(str) return convert(str,"%02x") end end -if not md5.dec then function md5.dec(str) return convert(str,"%03i") end end - ---~ if not md5.HEX then ---~ local function remap(chr) return format("%02X",byte(chr)) end ---~ function md5.HEX(str) return (gsub(md5.sum(str),".",remap)) end ---~ end ---~ if not md5.hex then ---~ local function remap(chr) return format("%02x",byte(chr)) end ---~ function md5.hex(str) return (gsub(md5.sum(str),".",remap)) end ---~ end ---~ if not md5.dec then ---~ local function remap(chr) return format("%03i",byte(chr)) end ---~ function md5.dec(str) return (gsub(md5.sum(str),".",remap)) end ---~ end - -file.needs_updating_threshold = 1 - -function file.needs_updating(oldname,newname) -- size modification access change - local oldtime = lfs.attributes(oldname, modification) - local newtime = lfs.attributes(newname, modification) - if newtime >= oldtime then - return false - elseif oldtime - newtime < file.needs_updating_threshold then - return false - else - return true - end -end - -function file.checksum(name) - if md5 then - local data = io.loaddata(name) - if data then - return md5.HEX(data) - end - end - return nil -end - -function file.loadchecksum(name) - if md5 then - local data = io.loaddata(name .. ".md5") - return data and (gsub(data,"%s","")) - end - return nil -end - -function file.savechecksum(name, checksum) - if not checksum then checksum = file.checksum(name) end - if checksum then - io.savedata(name .. ".md5",checksum) - return checksum - end - return nil -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-url'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local char, gmatch, gsub = string.char, string.gmatch, string.gsub -local tonumber, type = tonumber, type -local lpegmatch = lpeg.match - --- from the spec (on the web): --- --- foo://example.com:8042/over/there?name=ferret#nose --- \_/ \______________/\_________/ \_________/ \__/ --- | | | | | --- scheme authority path query fragment --- | _____________________|__ --- / \ / \ --- urn:example:animal:ferret:nose - -url = url or { } - -local function tochar(s) - return char(tonumber(s,16)) -end - -local colon, qmark, hash, slash, percent, endofstring = lpeg.P(":"), lpeg.P("?"), lpeg.P("#"), lpeg.P("/"), lpeg.P("%"), lpeg.P(-1) - -local hexdigit = lpeg.R("09","AF","af") -local plus = lpeg.P("+") -local escaped = (plus / " ") + (percent * lpeg.C(hexdigit * hexdigit) / tochar) - --- we assume schemes with more than 1 character (in order to avoid problems with windows disks) - -local scheme = lpeg.Cs((escaped+(1-colon-slash-qmark-hash))^2) * colon + lpeg.Cc("") -local authority = slash * slash * lpeg.Cs((escaped+(1- slash-qmark-hash))^0) + lpeg.Cc("") -local path = slash * lpeg.Cs((escaped+(1- qmark-hash))^0) + lpeg.Cc("") -local query = qmark * lpeg.Cs((escaped+(1- hash))^0) + lpeg.Cc("") -local fragment = hash * lpeg.Cs((escaped+(1- endofstring))^0) + lpeg.Cc("") - -local parser = lpeg.Ct(scheme * authority * path * query * fragment) - --- todo: reconsider Ct as we can as well have five return values (saves a table) --- so we can have two parsers, one with and one without - -function url.split(str) - return (type(str) == "string" and lpegmatch(parser,str)) or str -end - --- todo: cache them - -function url.hashed(str) - local s = url.split(str) - local somescheme = s[1] ~= "" - return { - scheme = (somescheme and s[1]) or "file", - authority = s[2], - path = s[3], - query = s[4], - fragment = s[5], - original = str, - noscheme = not somescheme, - } -end - -function url.hasscheme(str) - return url.split(str)[1] ~= "" -end - -function url.addscheme(str,scheme) - return (url.hasscheme(str) and str) or ((scheme or "file:///") .. str) -end - -function url.construct(hash) - local fullurl = hash.sheme .. "://".. hash.authority .. hash.path - if hash.query then - fullurl = fullurl .. "?".. hash.query - end - if hash.fragment then - fullurl = fullurl .. "?".. hash.fragment - end - return fullurl -end - -function url.filename(filename) - local t = url.hashed(filename) - return (t.scheme == "file" and (gsub(t.path,"^/([a-zA-Z])([:|])/)","%1:"))) or filename -end - -function url.query(str) - if type(str) == "string" then - local t = { } - for k, v in gmatch(str,"([^&=]*)=([^&=]*)") do - t[k] = v - end - return t - else - return str - end -end - ---~ print(url.filename("file:///c:/oeps.txt")) ---~ print(url.filename("c:/oeps.txt")) ---~ print(url.filename("file:///oeps.txt")) ---~ print(url.filename("file:///etc/test.txt")) ---~ print(url.filename("/oeps.txt")) - ---~ from the spec on the web (sort of): ---~ ---~ function test(str) ---~ print(table.serialize(url.hashed(str))) ---~ end ---~ ---~ test("%56pass%20words") ---~ test("file:///c:/oeps.txt") ---~ test("file:///c|/oeps.txt") ---~ test("file:///etc/oeps.txt") ---~ test("file://./etc/oeps.txt") ---~ test("file:////etc/oeps.txt") ---~ test("ftp://ftp.is.co.za/rfc/rfc1808.txt") ---~ test("http://www.ietf.org/rfc/rfc2396.txt") ---~ test("ldap://[2001:db8::7]/c=GB?objectClass?one#what") ---~ test("mailto:John.Doe@example.com") ---~ test("news:comp.infosystems.www.servers.unix") ---~ test("tel:+1-816-555-1212") ---~ test("telnet://192.0.2.16:80/") ---~ test("urn:oasis:names:specification:docbook:dtd:xml:4.1.2") ---~ test("/etc/passwords") ---~ test("http://www.pragma-ade.com/spaced%20name") - ---~ test("zip:///oeps/oeps.zip#bla/bla.tex") ---~ test("zip:///oeps/oeps.zip?bla/bla.tex") - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-dir'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- dir.expand_name will be merged with cleanpath and collapsepath - -local type = type -local find, gmatch, match, gsub = string.find, string.gmatch, string.match, string.gsub -local lpegmatch = lpeg.match - -dir = dir or { } - --- handy - -function dir.current() - return (gsub(lfs.currentdir(),"\\","/")) -end - --- optimizing for no string.find (*) does not save time - -local attributes = lfs.attributes -local walkdir = lfs.dir - -local function glob_pattern(path,patt,recurse,action) - local ok, scanner - if path == "/" then - ok, scanner = xpcall(function() return walkdir(path..".") end, function() end) -- kepler safe - else - ok, scanner = xpcall(function() return walkdir(path) end, function() end) -- kepler safe - end - if ok and type(scanner) == "function" then - if not find(path,"/$") then path = path .. '/' end - for name in scanner do - local full = path .. name - local mode = attributes(full,'mode') - if mode == 'file' then - if find(full,patt) then - action(full) - end - elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then - glob_pattern(full,patt,recurse,action) - end - end - end -end - -dir.glob_pattern = glob_pattern - -local function collect_pattern(path,patt,recurse,result) - local ok, scanner - result = result or { } - if path == "/" then - ok, scanner = xpcall(function() return walkdir(path..".") end, function() end) -- kepler safe - else - ok, scanner = xpcall(function() return walkdir(path) end, function() end) -- kepler safe - end - if ok and type(scanner) == "function" then - if not find(path,"/$") then path = path .. '/' end - for name in scanner do - local full = path .. name - local attr = attributes(full) - local mode = attr.mode - if mode == 'file' then - if find(full,patt) then - result[name] = attr - end - elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then - attr.list = collect_pattern(full,patt,recurse) - result[name] = attr - end - end - end - return result -end - -dir.collect_pattern = collect_pattern - -local P, S, R, C, Cc, Cs, Ct, Cv, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cv, lpeg.V - -local pattern = Ct { - [1] = (C(P(".") + P("/")^1) + C(R("az","AZ") * P(":") * P("/")^0) + Cc("./")) * V(2) * V(3), - [2] = C(((1-S("*?/"))^0 * P("/"))^0), - [3] = C(P(1)^0) -} - -local filter = Cs ( ( - P("**") / ".*" + - P("*") / "[^/]*" + - P("?") / "[^/]" + - P(".") / "%%." + - P("+") / "%%+" + - P("-") / "%%-" + - P(1) -)^0 ) - -local function glob(str,t) - if type(t) == "function" then - if type(str) == "table" then - for s=1,#str do - glob(str[s],t) - end - elseif lfs.isfile(str) then - t(str) - else - local split = lpegmatch(pattern,str) - if split then - local root, path, base = split[1], split[2], split[3] - local recurse = find(base,"%*%*") - local start = root .. path - local result = lpegmatch(filter,start .. base) - glob_pattern(start,result,recurse,t) - end - end - else - if type(str) == "table" then - local t = t or { } - for s=1,#str do - glob(str[s],t) - end - return t - elseif lfs.isfile(str) then - local t = t or { } - t[#t+1] = str - return t - else - local split = lpegmatch(pattern,str) - if split then - local t = t or { } - local action = action or function(name) t[#t+1] = name end - local root, path, base = split[1], split[2], split[3] - local recurse = find(base,"%*%*") - local start = root .. path - local result = lpegmatch(filter,start .. base) - glob_pattern(start,result,recurse,action) - return t - else - return { } - end - end - end -end - -dir.glob = glob - ---~ list = dir.glob("**/*.tif") ---~ list = dir.glob("/**/*.tif") ---~ list = dir.glob("./**/*.tif") ---~ list = dir.glob("oeps/**/*.tif") ---~ list = dir.glob("/oeps/**/*.tif") - -local function globfiles(path,recurse,func,files) -- func == pattern or function - if type(func) == "string" then - local s = func -- alas, we need this indirect way - func = function(name) return find(name,s) end - end - files = files or { } - for name in walkdir(path) do - if find(name,"^%.") then - --- skip - else - local mode = attributes(name,'mode') - if mode == "directory" then - if recurse then - globfiles(path .. "/" .. name,recurse,func,files) - end - elseif mode == "file" then - if func then - if func(name) then - files[#files+1] = path .. "/" .. name - end - else - files[#files+1] = path .. "/" .. name - end - end - end - end - return files -end - -dir.globfiles = globfiles - --- t = dir.glob("c:/data/develop/context/sources/**/????-*.tex") --- t = dir.glob("c:/data/develop/tex/texmf/**/*.tex") --- t = dir.glob("c:/data/develop/context/texmf/**/*.tex") --- t = dir.glob("f:/minimal/tex/**/*") --- print(dir.ls("f:/minimal/tex/**/*")) --- print(dir.ls("*.tex")) - -function dir.ls(pattern) - return table.concat(glob(pattern),"\n") -end - ---~ mkdirs("temp") ---~ mkdirs("a/b/c") ---~ mkdirs(".","/a/b/c") ---~ mkdirs("a","b","c") - -local make_indeed = true -- false - -if string.find(os.getenv("PATH"),";") then -- os.type == "windows" - - function dir.mkdirs(...) - local str, pth, t = "", "", { ... } - for i=1,#t do - local s = t[i] - if s ~= "" then - if str ~= "" then - str = str .. "/" .. s - else - str = s - end - end - end - local first, middle, last - local drive = false - first, middle, last = match(str,"^(//)(//*)(.*)$") - if first then - -- empty network path == local path - else - first, last = match(str,"^(//)/*(.-)$") - if first then - middle, last = match(str,"([^/]+)/+(.-)$") - if middle then - pth = "//" .. middle - else - pth = "//" .. last - last = "" - end - else - first, middle, last = match(str,"^([a-zA-Z]:)(/*)(.-)$") - if first then - pth, drive = first .. middle, true - else - middle, last = match(str,"^(/*)(.-)$") - if not middle then - last = str - end - end - end - end - for s in gmatch(last,"[^/]+") do - if pth == "" then - pth = s - elseif drive then - pth, drive = pth .. s, false - else - pth = pth .. "/" .. s - end - if make_indeed and not lfs.isdir(pth) then - lfs.mkdir(pth) - end - end - return pth, (lfs.isdir(pth) == true) - end - ---~ print(dir.mkdirs("","","a","c")) ---~ print(dir.mkdirs("a")) ---~ print(dir.mkdirs("a:")) ---~ print(dir.mkdirs("a:/b/c")) ---~ print(dir.mkdirs("a:b/c")) ---~ print(dir.mkdirs("a:/bbb/c")) ---~ print(dir.mkdirs("/a/b/c")) ---~ print(dir.mkdirs("/aaa/b/c")) ---~ print(dir.mkdirs("//a/b/c")) ---~ print(dir.mkdirs("///a/b/c")) ---~ print(dir.mkdirs("a/bbb//ccc/")) - - function dir.expand_name(str) -- will be merged with cleanpath and collapsepath - local first, nothing, last = match(str,"^(//)(//*)(.*)$") - if first then - first = dir.current() .. "/" - end - if not first then - first, last = match(str,"^(//)/*(.*)$") - end - if not first then - first, last = match(str,"^([a-zA-Z]:)(.*)$") - if first and not find(last,"^/") then - local d = lfs.currentdir() - if lfs.chdir(first) then - first = dir.current() - end - lfs.chdir(d) - end - end - if not first then - first, last = dir.current(), str - end - last = gsub(last,"//","/") - last = gsub(last,"/%./","/") - last = gsub(last,"^/*","") - first = gsub(first,"/*$","") - if last == "" then - return first - else - return first .. "/" .. last - end - end - -else - - function dir.mkdirs(...) - local str, pth, t = "", "", { ... } - for i=1,#t do - local s = t[i] - if s ~= "" then - if str ~= "" then - str = str .. "/" .. s - else - str = s - end - end - end - str = gsub(str,"/+","/") - if find(str,"^/") then - pth = "/" - for s in gmatch(str,"[^/]+") do - local first = (pth == "/") - if first then - pth = pth .. s - else - pth = pth .. "/" .. s - end - if make_indeed and not first and not lfs.isdir(pth) then - lfs.mkdir(pth) - end - end - else - pth = "." - for s in gmatch(str,"[^/]+") do - pth = pth .. "/" .. s - if make_indeed and not lfs.isdir(pth) then - lfs.mkdir(pth) - end - end - end - return pth, (lfs.isdir(pth) == true) - end - ---~ print(dir.mkdirs("","","a","c")) ---~ print(dir.mkdirs("a")) ---~ print(dir.mkdirs("/a/b/c")) ---~ print(dir.mkdirs("/aaa/b/c")) ---~ print(dir.mkdirs("//a/b/c")) ---~ print(dir.mkdirs("///a/b/c")) ---~ print(dir.mkdirs("a/bbb//ccc/")) - - function dir.expand_name(str) -- will be merged with cleanpath and collapsepath - if not find(str,"^/") then - str = lfs.currentdir() .. "/" .. str - end - str = gsub(str,"//","/") - str = gsub(str,"/%./","/") - return str - end - -end - -dir.makedirs = dir.mkdirs - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-boolean'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -boolean = boolean or { } - -local type, tonumber = type, tonumber - -function boolean.tonumber(b) - if b then return 1 else return 0 end -end - -function toboolean(str,tolerant) - if tolerant then - local tstr = type(str) - if tstr == "string" then - return str == "true" or str == "yes" or str == "on" or str == "1" or str == "t" - elseif tstr == "number" then - return tonumber(str) ~= 0 - elseif tstr == "nil" then - return false - else - return str - end - elseif str == "true" then - return true - elseif str == "false" then - return false - else - return str - end -end - -function string.is_boolean(str) - if type(str) == "string" then - if str == "true" or str == "yes" or str == "on" or str == "t" then - return true - elseif str == "false" or str == "no" or str == "off" or str == "f" then - return false - end - end - return nil -end - -function boolean.alwaystrue() - return true -end - -function boolean.falsetrue() - return false -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-unicode'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -if not unicode then - - unicode = { utf8 = { } } - - local floor, char = math.floor, string.char - - function unicode.utf8.utfchar(n) - if n < 0x80 then - return char(n) - elseif n < 0x800 then - return char(0xC0 + floor(n/0x40)) .. char(0x80 + (n % 0x40)) - elseif n < 0x10000 then - return char(0xE0 + floor(n/0x1000)) .. char(0x80 + (floor(n/0x40) % 0x40)) .. char(0x80 + (n % 0x40)) - elseif n < 0x40000 then - return char(0xF0 + floor(n/0x40000)) .. char(0x80 + floor(n/0x1000)) .. char(0x80 + (floor(n/0x40) % 0x40)) .. char(0x80 + (n % 0x40)) - else -- wrong: - -- return char(0xF1 + floor(n/0x1000000)) .. char(0x80 + floor(n/0x40000)) .. char(0x80 + floor(n/0x1000)) .. char(0x80 + (floor(n/0x40) % 0x40)) .. char(0x80 + (n % 0x40)) - return "?" - end - end - -end - -utf = utf or unicode.utf8 - -local concat, utfchar, utfgsub = table.concat, utf.char, utf.gsub -local char, byte, find, bytepairs = string.char, string.byte, string.find, string.bytepairs - --- 0 EF BB BF UTF-8 --- 1 FF FE UTF-16-little-endian --- 2 FE FF UTF-16-big-endian --- 3 FF FE 00 00 UTF-32-little-endian --- 4 00 00 FE FF UTF-32-big-endian - -unicode.utfname = { - [0] = 'utf-8', - [1] = 'utf-16-le', - [2] = 'utf-16-be', - [3] = 'utf-32-le', - [4] = 'utf-32-be' -} - --- \000 fails in <= 5.0 but is valid in >=5.1 where %z is depricated - -function unicode.utftype(f) - local str = f:read(4) - if not str then - f:seek('set') - return 0 - -- elseif find(str,"^%z%z\254\255") then -- depricated - -- elseif find(str,"^\000\000\254\255") then -- not permitted and bugged - elseif find(str,"\000\000\254\255",1,true) then -- seems to work okay (TH) - return 4 - -- elseif find(str,"^\255\254%z%z") then -- depricated - -- elseif find(str,"^\255\254\000\000") then -- not permitted and bugged - elseif find(str,"\255\254\000\000",1,true) then -- seems to work okay (TH) - return 3 - elseif find(str,"^\254\255") then - f:seek('set',2) - return 2 - elseif find(str,"^\255\254") then - f:seek('set',2) - return 1 - elseif find(str,"^\239\187\191") then - f:seek('set',3) - return 0 - else - f:seek('set') - return 0 - end -end - -function unicode.utf16_to_utf8(str, endian) -- maybe a gsub is faster or an lpeg - local result, tmp, n, m, p = { }, { }, 0, 0, 0 - -- lf | cr | crlf / (cr:13, lf:10) - local function doit() - if n == 10 then - if p ~= 13 then - result[#result+1] = concat(tmp) - tmp = { } - p = 0 - end - elseif n == 13 then - result[#result+1] = concat(tmp) - tmp = { } - p = n - else - tmp[#tmp+1] = utfchar(n) - p = 0 - end - end - for l,r in bytepairs(str) do - if r then - if endian then - n = l*256 + r - else - n = r*256 + l - end - if m > 0 then - n = (m-0xD800)*0x400 + (n-0xDC00) + 0x10000 - m = 0 - doit() - elseif n >= 0xD800 and n <= 0xDBFF then - m = n - else - doit() - end - end - end - if #tmp > 0 then - result[#result+1] = concat(tmp) - end - return result -end - -function unicode.utf32_to_utf8(str, endian) - local result = { } - local tmp, n, m, p = { }, 0, -1, 0 - -- lf | cr | crlf / (cr:13, lf:10) - local function doit() - if n == 10 then - if p ~= 13 then - result[#result+1] = concat(tmp) - tmp = { } - p = 0 - end - elseif n == 13 then - result[#result+1] = concat(tmp) - tmp = { } - p = n - else - tmp[#tmp+1] = utfchar(n) - p = 0 - end - end - for a,b in bytepairs(str) do - if a and b then - if m < 0 then - if endian then - m = a*256*256*256 + b*256*256 - else - m = b*256 + a - end - else - if endian then - n = m + a*256 + b - else - n = m + b*256*256*256 + a*256*256 - end - m = -1 - doit() - end - else - break - end - end - if #tmp > 0 then - result[#result+1] = concat(tmp) - end - return result -end - -local function little(c) - local b = byte(c) -- b = c:byte() - if b < 0x10000 then - return char(b%256,b/256) - else - b = b - 0x10000 - local b1, b2 = b/1024 + 0xD800, b%1024 + 0xDC00 - return char(b1%256,b1/256,b2%256,b2/256) - end -end - -local function big(c) - local b = byte(c) - if b < 0x10000 then - return char(b/256,b%256) - else - b = b - 0x10000 - local b1, b2 = b/1024 + 0xD800, b%1024 + 0xDC00 - return char(b1/256,b1%256,b2/256,b2%256) - end -end - -function unicode.utf8_to_utf16(str,littleendian) - if littleendian then - return char(255,254) .. utfgsub(str,".",little) - else - return char(254,255) .. utfgsub(str,".",big) - end -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-math'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local floor, sin, cos, tan = math.floor, math.sin, math.cos, math.tan - -if not math.round then - function math.round(x) - return floor(x + 0.5) - end -end - -if not math.div then - function math.div(n,m) - return floor(n/m) - end -end - -if not math.mod then - function math.mod(n,m) - return n % m - end -end - -local pipi = 2*math.pi/360 - -function math.sind(d) - return sin(d*pipi) -end - -function math.cosd(d) - return cos(d*pipi) -end - -function math.tand(d) - return tan(d*pipi) -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-utils'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- hm, quite unreadable - -local gsub = string.gsub -local concat = table.concat -local type, next = type, next - -if not utils then utils = { } end -if not utils.merger then utils.merger = { } end -if not utils.lua then utils.lua = { } end - -utils.merger.m_begin = "begin library merge" -utils.merger.m_end = "end library merge" -utils.merger.pattern = - "%c+" .. - "%-%-%s+" .. utils.merger.m_begin .. - "%c+(.-)%c+" .. - "%-%-%s+" .. utils.merger.m_end .. - "%c+" - -function utils.merger._self_fake_() - return - "-- " .. "created merged file" .. "\n\n" .. - "-- " .. utils.merger.m_begin .. "\n\n" .. - "-- " .. utils.merger.m_end .. "\n\n" -end - -function utils.report(...) - print(...) -end - -utils.merger.strip_comment = true - -function utils.merger._self_load_(name) - local f, data = io.open(name), "" - if f then - utils.report("reading merge from %s",name) - data = f:read("*all") - f:close() - else - utils.report("unknown file to merge %s",name) - end - if data and utils.merger.strip_comment then - -- saves some 20K - data = gsub(data,"%-%-~[^\n\r]*[\r\n]", "") - end - return data or "" -end - -function utils.merger._self_save_(name, data) - if data ~= "" then - local f = io.open(name,'w') - if f then - utils.report("saving merge from %s",name) - f:write(data) - f:close() - end - end -end - -function utils.merger._self_swap_(data,code) - if data ~= "" then - return (gsub(data,utils.merger.pattern, function(s) - return "\n\n" .. "-- "..utils.merger.m_begin .. "\n" .. code .. "\n" .. "-- "..utils.merger.m_end .. "\n\n" - end, 1)) - else - return "" - end -end - ---~ stripper: ---~ ---~ data = gsub(data,"%-%-~[^\n]*\n","") ---~ data = gsub(data,"\n\n+","\n") - -function utils.merger._self_libs_(libs,list) - local result, f, frozen = { }, nil, false - result[#result+1] = "\n" - if type(libs) == 'string' then libs = { libs } end - if type(list) == 'string' then list = { list } end - local foundpath = nil - for i=1,#libs do - local lib = libs[i] - for j=1,#list do - local pth = gsub(list[j],"\\","/") -- file.clean_path - utils.report("checking library path %s",pth) - local name = pth .. "/" .. lib - if lfs.isfile(name) then - foundpath = pth - end - end - if foundpath then break end - end - if foundpath then - utils.report("using library path %s",foundpath) - local right, wrong = { }, { } - for i=1,#libs do - local lib = libs[i] - local fullname = foundpath .. "/" .. lib - if lfs.isfile(fullname) then - -- right[#right+1] = lib - utils.report("merging library %s",fullname) - result[#result+1] = "do -- create closure to overcome 200 locals limit" - result[#result+1] = io.loaddata(fullname,true) - result[#result+1] = "end -- of closure" - else - -- wrong[#wrong+1] = lib - utils.report("no library %s",fullname) - end - end - if #right > 0 then - utils.report("merged libraries: %s",concat(right," ")) - end - if #wrong > 0 then - utils.report("skipped libraries: %s",concat(wrong," ")) - end - else - utils.report("no valid library path found") - end - return concat(result, "\n\n") -end - -function utils.merger.selfcreate(libs,list,target) - if target then - utils.merger._self_save_( - target, - utils.merger._self_swap_( - utils.merger._self_fake_(), - utils.merger._self_libs_(libs,list) - ) - ) - end -end - -function utils.merger.selfmerge(name,libs,list,target) - utils.merger._self_save_( - target or name, - utils.merger._self_swap_( - utils.merger._self_load_(name), - utils.merger._self_libs_(libs,list) - ) - ) -end - -function utils.merger.selfclean(name) - utils.merger._self_save_( - name, - utils.merger._self_swap_( - utils.merger._self_load_(name), - "" - ) - ) -end - -function utils.lua.compile(luafile, lucfile, cleanup, strip) -- defaults: cleanup=false strip=true - -- utils.report("compiling",luafile,"into",lucfile) - os.remove(lucfile) - local command = "-o " .. string.quote(lucfile) .. " " .. string.quote(luafile) - if strip ~= false then - command = "-s " .. command - end - local done = (os.spawn("texluac " .. command) == 0) or (os.spawn("luac " .. command) == 0) - if done and cleanup == true and lfs.isfile(lucfile) and lfs.isfile(luafile) then - -- utils.report("removing",luafile) - os.remove(luafile) - end - return done -end - - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-aux'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- for inline, no store split : for s in string.gmatch(str,",* *([^,]+)") do .. end - -aux = aux or { } - -local concat, format, gmatch = table.concat, string.format, string.gmatch -local tostring, type = tostring, type -local lpegmatch = lpeg.match - -local P, R, V = lpeg.P, lpeg.R, lpeg.V - -local escape, left, right = P("\\"), P('{'), P('}') - -lpeg.patterns.balanced = P { - [1] = ((escape * (left+right)) + (1 - (left+right)) + V(2))^0, - [2] = left * V(1) * right -} - -local space = lpeg.P(' ') -local equal = lpeg.P("=") -local comma = lpeg.P(",") -local lbrace = lpeg.P("{") -local rbrace = lpeg.P("}") -local nobrace = 1 - (lbrace+rbrace) -local nested = lpeg.P { lbrace * (nobrace + lpeg.V(1))^0 * rbrace } -local spaces = space^0 - -local value = lpeg.P(lbrace * lpeg.C((nobrace + nested)^0) * rbrace) + lpeg.C((nested + (1-comma))^0) - -local key = lpeg.C((1-equal-comma)^1) -local pattern_a = (space+comma)^0 * (key * equal * value + key * lpeg.C("")) -local pattern_c = (space+comma)^0 * (key * equal * value) - -local key = lpeg.C((1-space-equal-comma)^1) -local pattern_b = spaces * comma^0 * spaces * (key * ((spaces * equal * spaces * value) + lpeg.C(""))) - --- "a=1, b=2, c=3, d={a{b,c}d}, e=12345, f=xx{a{b,c}d}xx, g={}" : outer {} removes, leading spaces ignored - -local hash = { } - -local function set(key,value) -- using Carg is slower here - hash[key] = value -end - -local pattern_a_s = (pattern_a/set)^1 -local pattern_b_s = (pattern_b/set)^1 -local pattern_c_s = (pattern_c/set)^1 - -aux.settings_to_hash_pattern_a = pattern_a_s -aux.settings_to_hash_pattern_b = pattern_b_s -aux.settings_to_hash_pattern_c = pattern_c_s - -function aux.make_settings_to_hash_pattern(set,how) - if how == "strict" then - return (pattern_c/set)^1 - elseif how == "tolerant" then - return (pattern_b/set)^1 - else - return (pattern_a/set)^1 - end -end - -function aux.settings_to_hash(str,existing) - if str and str ~= "" then - hash = existing or { } - if moretolerant then - lpegmatch(pattern_b_s,str) - else - lpegmatch(pattern_a_s,str) - end - return hash - else - return { } - end -end - -function aux.settings_to_hash_tolerant(str,existing) - if str and str ~= "" then - hash = existing or { } - lpegmatch(pattern_b_s,str) - return hash - else - return { } - end -end - -function aux.settings_to_hash_strict(str,existing) - if str and str ~= "" then - hash = existing or { } - lpegmatch(pattern_c_s,str) - return next(hash) and hash - else - return nil - end -end - -local separator = comma * space^0 -local value = lpeg.P(lbrace * lpeg.C((nobrace + nested)^0) * rbrace) + lpeg.C((nested + (1-comma))^0) -local pattern = lpeg.Ct(value*(separator*value)^0) - --- "aap, {noot}, mies" : outer {} removes, leading spaces ignored - -aux.settings_to_array_pattern = pattern - --- we could use a weak table as cache - -function aux.settings_to_array(str) - if not str or str == "" then - return { } - else - return lpegmatch(pattern,str) - end -end - -local function set(t,v) - t[#t+1] = v -end - -local value = lpeg.P(lpeg.Carg(1)*value) / set -local pattern = value*(separator*value)^0 * lpeg.Carg(1) - -function aux.add_settings_to_array(t,str) - return lpegmatch(pattern,str,nil,t) -end - -function aux.hash_to_string(h,separator,yes,no,strict,omit) - if h then - local t, s = { }, table.sortedkeys(h) - omit = omit and table.tohash(omit) - for i=1,#s do - local key = s[i] - if not omit or not omit[key] then - local value = h[key] - if type(value) == "boolean" then - if yes and no then - if value then - t[#t+1] = key .. '=' .. yes - elseif not strict then - t[#t+1] = key .. '=' .. no - end - elseif value or not strict then - t[#t+1] = key .. '=' .. tostring(value) - end - else - t[#t+1] = key .. '=' .. value - end - end - end - return concat(t,separator or ",") - else - return "" - end -end - -function aux.array_to_string(a,separator) - if a then - return concat(a,separator or ",") - else - return "" - end -end - -function aux.settings_to_set(str,t) - t = t or { } - for s in gmatch(str,"%s*([^,]+)") do - t[s] = true - end - return t -end - -local value = lbrace * lpeg.C((nobrace + nested)^0) * rbrace -local pattern = lpeg.Ct((space + value)^0) - -function aux.arguments_to_table(str) - return lpegmatch(pattern,str) -end - --- temporary here - -function aux.getparameters(self,class,parentclass,settings) - local sc = self[class] - if not sc then - sc = table.clone(self[parent]) - self[class] = sc - end - aux.settings_to_hash(settings,sc) -end - --- temporary here - -local digit = lpeg.R("09") -local period = lpeg.P(".") -local zero = lpeg.P("0") -local trailingzeros = zero^0 * -digit -- suggested by Roberto R -local case_1 = period * trailingzeros / "" -local case_2 = period * (digit - trailingzeros)^1 * (trailingzeros / "") -local number = digit^1 * (case_1 + case_2) -local stripper = lpeg.Cs((number + 1)^0) - ---~ local sample = "bla 11.00 bla 11 bla 0.1100 bla 1.00100 bla 0.00 bla 0.001 bla 1.1100 bla 0.100100100 bla 0.00100100100" ---~ collectgarbage("collect") ---~ str = string.rep(sample,10000) ---~ local ts = os.clock() ---~ lpegmatch(stripper,str) ---~ print(#str, os.clock()-ts, lpegmatch(stripper,sample)) - -lpeg.patterns.strip_zeros = stripper - -function aux.strip_zeros(str) - return lpegmatch(stripper,str) -end - -function aux.definetable(target) -- defines undefined tables - local composed, t = nil, { } - for name in gmatch(target,"([^%.]+)") do - if composed then - composed = composed .. "." .. name - else - composed = name - end - t[#t+1] = format("%s = %s or { }",composed,composed) - end - return concat(t,"\n") -end - -function aux.accesstable(target) - local t = _G - for name in gmatch(target,"([^%.]+)") do - t = t[name] - end - return t -end - ---~ function string.commaseparated(str) ---~ return gmatch(str,"([^,%s]+)") ---~ end - --- as we use this a lot ... - ---~ function aux.cachefunction(action,weak) ---~ local cache = { } ---~ if weak then ---~ setmetatable(cache, { __mode = "kv" } ) ---~ end ---~ local function reminder(str) ---~ local found = cache[str] ---~ if not found then ---~ found = action(str) ---~ cache[str] = found ---~ end ---~ return found ---~ end ---~ return reminder, cache ---~ end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['trac-tra'] = { - version = 1.001, - comment = "companion to trac-tra.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- the tag is kind of generic and used for functions that are not --- bound to a variable, like node.new, node.copy etc (contrary to for instance --- node.has_attribute which is bound to a has_attribute local variable in mkiv) - -local debug = require "debug" - -local getinfo = debug.getinfo -local type, next = type, next -local concat = table.concat -local format, find, lower, gmatch, gsub = string.format, string.find, string.lower, string.gmatch, string.gsub - -debugger = debugger or { } - -local counters = { } -local names = { } - --- one - -local function hook() - local f = getinfo(2,"f").func - local n = getinfo(2,"Sn") --- if n.what == "C" and n.name then print (n.namewhat .. ': ' .. n.name) end - if f then - local cf = counters[f] - if cf == nil then - counters[f] = 1 - names[f] = n - else - counters[f] = cf + 1 - end - end -end -local function getname(func) - local n = names[func] - if n then - if n.what == "C" then - return n.name or '' - else - -- source short_src linedefined what name namewhat nups func - local name = n.name or n.namewhat or n.what - if not name or name == "" then name = "?" end - return format("%s : %s : %s", n.short_src or "unknown source", n.linedefined or "--", name) - end - else - return "unknown" - end -end -function debugger.showstats(printer,threshold) - printer = printer or texio.write or print - threshold = threshold or 0 - local total, grandtotal, functions = 0, 0, 0 - printer("\n") -- ugly but ok - -- table.sort(counters) - for func, count in next, counters do - if count > threshold then - local name = getname(func) - if not find(name,"for generator") then - printer(format("%8i %s", count, name)) - total = total + count - end - end - grandtotal = grandtotal + count - functions = functions + 1 - end - printer(format("functions: %s, total: %s, grand total: %s, threshold: %s\n", functions, total, grandtotal, threshold)) -end - --- two - ---~ local function hook() ---~ local n = getinfo(2) ---~ if n.what=="C" and not n.name then ---~ local f = tostring(debug.traceback()) ---~ local cf = counters[f] ---~ if cf == nil then ---~ counters[f] = 1 ---~ names[f] = n ---~ else ---~ counters[f] = cf + 1 ---~ end ---~ end ---~ end ---~ function debugger.showstats(printer,threshold) ---~ printer = printer or texio.write or print ---~ threshold = threshold or 0 ---~ local total, grandtotal, functions = 0, 0, 0 ---~ printer("\n") -- ugly but ok ---~ -- table.sort(counters) ---~ for func, count in next, counters do ---~ if count > threshold then ---~ printer(format("%8i %s", count, func)) ---~ total = total + count ---~ end ---~ grandtotal = grandtotal + count ---~ functions = functions + 1 ---~ end ---~ printer(format("functions: %s, total: %s, grand total: %s, threshold: %s\n", functions, total, grandtotal, threshold)) ---~ end - --- rest - -function debugger.savestats(filename,threshold) - local f = io.open(filename,'w') - if f then - debugger.showstats(function(str) f:write(str) end,threshold) - f:close() - end -end - -function debugger.enable() - debug.sethook(hook,"c") -end - -function debugger.disable() - debug.sethook() ---~ counters[debug.getinfo(2,"f").func] = nil -end - -function debugger.tracing() - local n = tonumber(os.env['MTX.TRACE.CALLS']) or tonumber(os.env['MTX_TRACE_CALLS']) or 0 - if n > 0 then - function debugger.tracing() return true end ; return true - else - function debugger.tracing() return false end ; return false - end -end - ---~ debugger.enable() - ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) - ---~ debugger.disable() - ---~ print("") ---~ debugger.showstats() ---~ print("") ---~ debugger.showstats(print,3) - -setters = setters or { } -setters.data = setters.data or { } - ---~ local function set(t,what,value) ---~ local data, done = t.data, t.done ---~ if type(what) == "string" then ---~ what = aux.settings_to_array(what) -- inefficient but ok ---~ end ---~ for i=1,#what do ---~ local w = what[i] ---~ for d, f in next, data do ---~ if done[d] then ---~ -- prevent recursion due to wildcards ---~ elseif find(d,w) then ---~ done[d] = true ---~ for i=1,#f do ---~ f[i](value) ---~ end ---~ end ---~ end ---~ end ---~ end - -local function set(t,what,value) - local data, done = t.data, t.done - if type(what) == "string" then - what = aux.settings_to_hash(what) -- inefficient but ok - end - for w, v in next, what do - if v == "" then - v = value - else - v = toboolean(v) - end - for d, f in next, data do - if done[d] then - -- prevent recursion due to wildcards - elseif find(d,w) then - done[d] = true - for i=1,#f do - f[i](v) - end - end - end - end -end - -local function reset(t) - for d, f in next, t.data do - for i=1,#f do - f[i](false) - end - end -end - -local function enable(t,what) - set(t,what,true) -end - -local function disable(t,what) - local data = t.data - if not what or what == "" then - t.done = { } - reset(t) - else - set(t,what,false) - end -end - -function setters.register(t,what,...) - local data = t.data - what = lower(what) - local w = data[what] - if not w then - w = { } - data[what] = w - end - for _, fnc in next, { ... } do - local typ = type(fnc) - if typ == "function" then - w[#w+1] = fnc - elseif typ == "string" then - w[#w+1] = function(value) set(t,fnc,value,nesting) end - end - end -end - -function setters.enable(t,what) - local e = t.enable - t.enable, t.done = enable, { } - enable(t,string.simpleesc(tostring(what))) - t.enable, t.done = e, { } -end - -function setters.disable(t,what) - local e = t.disable - t.disable, t.done = disable, { } - disable(t,string.simpleesc(tostring(what))) - t.disable, t.done = e, { } -end - -function setters.reset(t) - t.done = { } - reset(t) -end - -function setters.list(t) -- pattern - local list = table.sortedkeys(t.data) - local user, system = { }, { } - for l=1,#list do - local what = list[l] - if find(what,"^%*") then - system[#system+1] = what - else - user[#user+1] = what - end - end - return user, system -end - -function setters.show(t) - commands.writestatus("","") - local list = setters.list(t) - for k=1,#list do - commands.writestatus(t.name,list[k]) - end - commands.writestatus("","") -end - --- we could have used a bit of oo and the trackers:enable syntax but --- there is already a lot of code around using the singular tracker - --- we could make this into a module - -function setters.new(name) - local t - t = { - data = { }, - name = name, - enable = function(...) setters.enable (t,...) end, - disable = function(...) setters.disable (t,...) end, - register = function(...) setters.register(t,...) end, - list = function(...) setters.list (t,...) end, - show = function(...) setters.show (t,...) end, - } - setters.data[name] = t - return t -end - -trackers = setters.new("trackers") -directives = setters.new("directives") -experiments = setters.new("experiments") - --- nice trick: we overload two of the directives related functions with variants that --- do tracing (itself using a tracker) .. proof of concept - -local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end) -local trace_experiments = false local trace_experiments = false trackers.register("system.experiments", function(v) trace_experiments = v end) - -local e = directives.enable -local d = directives.disable - -function directives.enable(...) - commands.writestatus("directives","enabling: %s",concat({...}," ")) - e(...) -end - -function directives.disable(...) - commands.writestatus("directives","disabling: %s",concat({...}," ")) - d(...) -end - -local e = experiments.enable -local d = experiments.disable - -function experiments.enable(...) - commands.writestatus("experiments","enabling: %s",concat({...}," ")) - e(...) -end - -function experiments.disable(...) - commands.writestatus("experiments","disabling: %s",concat({...}," ")) - d(...) -end - --- a useful example - -directives.register("system.nostatistics", function(v) - statistics.enable = not v -end) - - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['luat-env'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- A former version provided functionality for non embeded core --- scripts i.e. runtime library loading. Given the amount of --- Lua code we use now, this no longer makes sense. Much of this --- evolved before bytecode arrays were available and so a lot of --- code has disappeared already. - -local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) - -local format, sub, match, gsub, find = string.format, string.sub, string.match, string.gsub, string.find -local unquote, quote = string.unquote, string.quote - --- precautions - -os.setlocale(nil,nil) -- useless feature and even dangerous in luatex - -function os.setlocale() - -- no way you can mess with it -end - --- dirty tricks - -if arg and (arg[0] == 'luatex' or arg[0] == 'luatex.exe') and arg[1] == "--luaonly" then - arg[-1]=arg[0] arg[0]=arg[2] for k=3,#arg do arg[k-2]=arg[k] end arg[#arg]=nil arg[#arg]=nil -end - -if profiler and os.env["MTX_PROFILE_RUN"] == "YES" then - profiler.start("luatex-profile.log") -end - --- environment - -environment = environment or { } -environment.arguments = { } -environment.files = { } -environment.sortedflags = nil - -if not environment.jobname or environment.jobname == "" then if tex then environment.jobname = tex.jobname end end -if not environment.version or environment.version == "" then environment.version = "unknown" end -if not environment.jobname then environment.jobname = "unknown" end - -function environment.initialize_arguments(arg) - local arguments, files = { }, { } - environment.arguments, environment.files, environment.sortedflags = arguments, files, nil - for index=1,#arg do - local argument = arg[index] - if index > 0 then - local flag, value = match(argument,"^%-+(.-)=(.-)$") - if flag then - arguments[flag] = unquote(value or "") - else - flag = match(argument,"^%-+(.+)") - if flag then - arguments[flag] = true - else - files[#files+1] = argument - end - end - end - end - environment.ownname = environment.ownname or arg[0] or 'unknown.lua' -end - -function environment.setargument(name,value) - environment.arguments[name] = value -end - --- todo: defaults, better checks e.g on type (boolean versus string) --- --- tricky: too many hits when we support partials unless we add --- a registration of arguments so from now on we have 'partial' - -function environment.argument(name,partial) - local arguments, sortedflags = environment.arguments, environment.sortedflags - if arguments[name] then - return arguments[name] - elseif partial then - if not sortedflags then - sortedflags = table.sortedkeys(arguments) - for k=1,#sortedflags do - sortedflags[k] = "^" .. sortedflags[k] - end - environment.sortedflags = sortedflags - end - -- example of potential clash: ^mode ^modefile - for k=1,#sortedflags do - local v = sortedflags[k] - if find(name,v) then - return arguments[sub(v,2,#v)] - end - end - end - return nil -end - -environment.argument("x",true) - -function environment.split_arguments(separator) -- rather special, cut-off before separator - local done, before, after = false, { }, { } - local original_arguments = environment.original_arguments - for k=1,#original_arguments do - local v = original_arguments[k] - if not done and v == separator then - done = true - elseif done then - after[#after+1] = v - else - before[#before+1] = v - end - end - return before, after -end - -function environment.reconstruct_commandline(arg,noquote) - arg = arg or environment.original_arguments - if noquote and #arg == 1 then - local a = arg[1] - a = resolvers.resolve(a) - a = unquote(a) - return a - elseif #arg > 0 then - local result = { } - for i=1,#arg do - local a = arg[i] - a = resolvers.resolve(a) - a = unquote(a) - a = gsub(a,'"','\\"') -- tricky - if find(a," ") then - result[#result+1] = quote(a) - else - result[#result+1] = a - end - end - return table.join(result," ") - else - return "" - end -end - -if arg then - - -- new, reconstruct quoted snippets (maybe better just remove the " then and add them later) - local newarg, instring = { }, false - - for index=1,#arg do - local argument = arg[index] - if find(argument,"^\"") then - newarg[#newarg+1] = gsub(argument,"^\"","") - if not find(argument,"\"$") then - instring = true - end - elseif find(argument,"\"$") then - newarg[#newarg] = newarg[#newarg] .. " " .. gsub(argument,"\"$","") - instring = false - elseif instring then - newarg[#newarg] = newarg[#newarg] .. " " .. argument - else - newarg[#newarg+1] = argument - end - end - for i=1,-5,-1 do - newarg[i] = arg[i] - end - - environment.initialize_arguments(newarg) - environment.original_arguments = newarg - environment.raw_arguments = arg - - arg = { } -- prevent duplicate handling - -end - --- weird place ... depends on a not yet loaded module - -function environment.texfile(filename) - return resolvers.find_file(filename,'tex') -end - -function environment.luafile(filename) - local resolved = resolvers.find_file(filename,'tex') or "" - if resolved ~= "" then - return resolved - end - resolved = resolvers.find_file(filename,'texmfscripts') or "" - if resolved ~= "" then - return resolved - end - return resolvers.find_file(filename,'luatexlibs') or "" -end - -environment.loadedluacode = loadfile -- can be overloaded - ---~ function environment.loadedluacode(name) ---~ if os.spawn("texluac -s -o texluac.luc " .. name) == 0 then ---~ local chunk = loadstring(io.loaddata("texluac.luc")) ---~ os.remove("texluac.luc") ---~ return chunk ---~ else ---~ environment.loadedluacode = loadfile -- can be overloaded ---~ return loadfile(name) ---~ end ---~ end - -function environment.luafilechunk(filename) -- used for loading lua bytecode in the format - filename = file.replacesuffix(filename, "lua") - local fullname = environment.luafile(filename) - if fullname and fullname ~= "" then - if trace_locating then - logs.report("fileio","loading file %s", fullname) - end - return environment.loadedluacode(fullname) - else - if trace_locating then - logs.report("fileio","unknown file %s", filename) - end - return nil - end -end - --- the next ones can use the previous ones / combine - -function environment.loadluafile(filename, version) - local lucname, luaname, chunk - local basename = file.removesuffix(filename) - if basename == filename then - lucname, luaname = basename .. ".luc", basename .. ".lua" - else - lucname, luaname = nil, basename -- forced suffix - end - -- when not overloaded by explicit suffix we look for a luc file first - local fullname = (lucname and environment.luafile(lucname)) or "" - if fullname ~= "" then - if trace_locating then - logs.report("fileio","loading %s", fullname) - end - chunk = loadfile(fullname) -- this way we don't need a file exists check - end - if chunk then - assert(chunk)() - if version then - -- we check of the version number of this chunk matches - local v = version -- can be nil - if modules and modules[filename] then - v = modules[filename].version -- new method - elseif versions and versions[filename] then - v = versions[filename] -- old method - end - if v == version then - return true - else - if trace_locating then - logs.report("fileio","version mismatch for %s: lua=%s, luc=%s", filename, v, version) - end - environment.loadluafile(filename) - end - else - return true - end - end - fullname = (luaname and environment.luafile(luaname)) or "" - if fullname ~= "" then - if trace_locating then - logs.report("fileio","loading %s", fullname) - end - chunk = loadfile(fullname) -- this way we don't need a file exists check - if not chunk then - if trace_locating then - logs.report("fileio","unknown file %s", filename) - end - else - assert(chunk)() - return true - end - end - return false -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['trac-inf'] = { - version = 1.001, - comment = "companion to trac-inf.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local format = string.format - -local statusinfo, n, registered = { }, 0, { } - -statistics = statistics or { } - -statistics.enable = true -statistics.threshold = 0.05 - --- timing functions - -local clock = os.gettimeofday or os.clock - -local notimer - -function statistics.hastimer(instance) - return instance and instance.starttime -end - -function statistics.resettiming(instance) - if not instance then - notimer = { timing = 0, loadtime = 0 } - else - instance.timing, instance.loadtime = 0, 0 - end -end - -function statistics.starttiming(instance) - if not instance then - notimer = { } - instance = notimer - end - local it = instance.timing - if not it then - it = 0 - end - if it == 0 then - instance.starttime = clock() - if not instance.loadtime then - instance.loadtime = 0 - end - else ---~ logs.report("system","nested timing (%s)",tostring(instance)) - end - instance.timing = it + 1 -end - -function statistics.stoptiming(instance, report) - if not instance then - instance = notimer - end - if instance then - local it = instance.timing - if it > 1 then - instance.timing = it - 1 - else - local starttime = instance.starttime - if starttime then - local stoptime = clock() - local loadtime = stoptime - starttime - instance.stoptime = stoptime - instance.loadtime = instance.loadtime + loadtime - if report then - statistics.report("load time %0.3f",loadtime) - end - instance.timing = 0 - return loadtime - end - end - end - return 0 -end - -function statistics.elapsedtime(instance) - if not instance then - instance = notimer - end - return format("%0.3f",(instance and instance.loadtime) or 0) -end - -function statistics.elapsedindeed(instance) - if not instance then - instance = notimer - end - local t = (instance and instance.loadtime) or 0 - return t > statistics.threshold -end - -function statistics.elapsedseconds(instance,rest) -- returns nil if 0 seconds - if statistics.elapsedindeed(instance) then - return format("%s seconds %s", statistics.elapsedtime(instance),rest or "") - end -end - --- general function - -function statistics.register(tag,fnc) - if statistics.enable and type(fnc) == "function" then - local rt = registered[tag] or (#statusinfo + 1) - statusinfo[rt] = { tag, fnc } - registered[tag] = rt - if #tag > n then n = #tag end - end -end - -function statistics.show(reporter) - if statistics.enable then - if not reporter then reporter = function(tag,data,n) texio.write_nl(tag .. " " .. data) end end - -- this code will move - local register = statistics.register - register("luatex banner", function() - return string.lower(status.banner) - end) - register("control sequences", function() - return format("%s of %s", status.cs_count, status.hash_size+status.hash_extra) - end) - register("callbacks", function() - local total, indirect = status.callbacks or 0, status.indirect_callbacks or 0 - return format("direct: %s, indirect: %s, total: %s", total-indirect, indirect, total) - end) - register("current memory usage", statistics.memused) - register("runtime",statistics.runtime) --- -- - for i=1,#statusinfo do - local s = statusinfo[i] - local r = s[2]() - if r then - reporter(s[1],r,n) - end - end - texio.write_nl("") -- final newline - statistics.enable = false - end -end - -function statistics.show_job_stat(tag,data,n) - texio.write_nl(format("%-15s: %s - %s","mkiv lua stats",tag:rpadd(n," "),data)) -end - -function statistics.memused() -- no math.round yet -) - local round = math.round or math.floor - return format("%s MB (ctx: %s MB)",round(collectgarbage("count")/1000), round(status.luastate_bytes/1000000)) -end - -if statistics.runtime then - -- already loaded and set -elseif luatex and luatex.starttime then - statistics.starttime = luatex.starttime - statistics.loadtime = 0 - statistics.timing = 0 -else - statistics.starttiming(statistics) -end - -function statistics.runtime() - statistics.stoptiming(statistics) - return statistics.formatruntime(statistics.elapsedtime(statistics)) -end - -function statistics.formatruntime(runtime) - return format("%s seconds", statistics.elapsedtime(statistics)) -end - -function statistics.timed(action,report) - local timer = { } - report = report or logs.simple - statistics.starttiming(timer) - action() - statistics.stoptiming(timer) - report("total runtime: %s",statistics.elapsedtime(timer)) -end - --- where, not really the best spot for this: - -commands = commands or { } - -local timer - -function commands.resettimer() - statistics.resettiming(timer) - statistics.starttiming(timer) -end - -function commands.elapsedtime() - statistics.stoptiming(timer) - tex.sprint(statistics.elapsedtime(timer)) -end - -commands.resettimer() - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['trac-log'] = { - version = 1.001, - comment = "companion to trac-log.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- this is old code that needs an overhaul - ---~ io.stdout:setvbuf("no") ---~ io.stderr:setvbuf("no") - -local write_nl, write = texio.write_nl or print, texio.write or io.write -local format, gmatch = string.format, string.gmatch -local texcount = tex and tex.count - -if texlua then - write_nl = print - write = io.write -end - ---[[ldx-- -

This is a prelude to a more extensive logging module. For the sake -of parsing log files, in addition to the standard logging we will -provide an structured file. Actually, any logging that -is hooked into callbacks will be \XML\ by default.

---ldx]]-- - -logs = logs or { } -logs.xml = logs.xml or { } -logs.tex = logs.tex or { } - ---[[ldx-- -

This looks pretty ugly but we need to speed things up a bit.

---ldx]]-- - -logs.moreinfo = [[ -more information about ConTeXt and the tools that come with it can be found at: - -maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context -webpage : http://www.pragma-ade.nl / http://tex.aanhet.net -wiki : http://contextgarden.net -]] - -logs.levels = { - ['error'] = 1, - ['warning'] = 2, - ['info'] = 3, - ['debug'] = 4, -} - -logs.functions = { - 'report', 'start', 'stop', 'push', 'pop', 'line', 'direct', - 'start_run', 'stop_run', - 'start_page_number', 'stop_page_number', - 'report_output_pages', 'report_output_log', - 'report_tex_stat', 'report_job_stat', - 'show_open', 'show_close', 'show_load', -} - -logs.tracers = { -} - -logs.level = 0 -logs.mode = string.lower((os.getenv("MTX.LOG.MODE") or os.getenv("MTX_LOG_MODE") or "tex")) - -function logs.set_level(level) - logs.level = logs.levels[level] or level -end - -function logs.set_method(method) - for _, v in next, logs.functions do - logs[v] = logs[method][v] or function() end - end -end - --- tex logging - -function logs.tex.report(category,fmt,...) -- new - if fmt then - write_nl(category .. " | " .. format(fmt,...)) - else - write_nl(category .. " |") - end -end - -function logs.tex.line(fmt,...) -- new - if fmt then - write_nl(format(fmt,...)) - else - write_nl("") - end -end - ---~ function logs.tex.start_page_number() ---~ local real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno ---~ if real > 0 then ---~ if user > 0 then ---~ if sub > 0 then ---~ write(format("[%s.%s.%s",real,user,sub)) ---~ else ---~ write(format("[%s.%s",real,user)) ---~ end ---~ else ---~ write(format("[%s",real)) ---~ end ---~ else ---~ write("[-") ---~ end ---~ end - ---~ function logs.tex.stop_page_number() ---~ write("]") ---~ end - -local real, user, sub - -function logs.tex.start_page_number() - real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno -end - -function logs.tex.stop_page_number() - if real > 0 then - if user > 0 then - if sub > 0 then - logs.report("pages", "flushing realpage %s, userpage %s, subpage %s",real,user,sub) - else - logs.report("pages", "flushing realpage %s, userpage %s",real,user) - end - else - logs.report("pages", "flushing realpage %s",real) - end - else - logs.report("pages", "flushing page") - end - io.flush() -end - -logs.tex.report_job_stat = statistics.show_job_stat - --- xml logging - -function logs.xml.report(category,fmt,...) -- new - if fmt then - write_nl(format("%s",category,format(fmt,...))) - else - write_nl(format("",category)) - end -end -function logs.xml.line(fmt,...) -- new - if fmt then - write_nl(format("%s",format(fmt,...))) - else - write_nl("") - end -end - -function logs.xml.start() if logs.level > 0 then tw("<%s>" ) end end -function logs.xml.stop () if logs.level > 0 then tw("") end end -function logs.xml.push () if logs.level > 0 then tw("" ) end end - -function logs.xml.start_run() - write_nl("") - write_nl("") -- xmlns='www.pragma-ade.com/luatex/schemas/context-job.rng' - write_nl("") -end - -function logs.xml.stop_run() - write_nl("") -end - -function logs.xml.start_page_number() - write_nl(format("

") - write_nl("") -end - -function logs.xml.report_output_pages(p,b) - write_nl(format("", p)) - write_nl(format("", b)) - write_nl("") -end - -function logs.xml.report_output_log() -end - -function logs.xml.report_tex_stat(k,v) - texiowrite_nl("log",""..tostring(v).."") -end - -local level = 0 - -function logs.xml.show_open(name) - level = level + 1 - texiowrite_nl(format("",level,name)) -end - -function logs.xml.show_close(name) - texiowrite(" ") - level = level - 1 -end - -function logs.xml.show_load(name) - texiowrite_nl(format("",level+1,name)) -end - --- - -local name, banner = 'report', 'context' - -local function report(category,fmt,...) - if fmt then - write_nl(format("%s | %s: %s",name,category,format(fmt,...))) - elseif category then - write_nl(format("%s | %s",name,category)) - else - write_nl(format("%s |",name)) - end -end - -local function simple(fmt,...) - if fmt then - write_nl(format("%s | %s",name,format(fmt,...))) - else - write_nl(format("%s |",name)) - end -end - -function logs.setprogram(_name_,_banner_,_verbose_) - name, banner = _name_, _banner_ - if _verbose_ then - trackers.enable("resolvers.locating") - end - logs.set_method("tex") - logs.report = report -- also used in libraries - logs.simple = simple -- only used in scripts ! - if utils then - utils.report = simple - end - logs.verbose = _verbose_ -end - -function logs.setverbose(what) - if what then - trackers.enable("resolvers.locating") - else - trackers.disable("resolvers.locating") - end - logs.verbose = what or false -end - -function logs.extendbanner(_banner_,_verbose_) - banner = banner .. " | ".. _banner_ - if _verbose_ ~= nil then - logs.setverbose(what) - end -end - -logs.verbose = false -logs.report = logs.tex.report -logs.simple = logs.tex.report - -function logs.reportlines(str) -- todo: - for line in gmatch(str,"(.-)[\n\r]") do - logs.report(line) - end -end - -function logs.reportline() -- for scripts too - logs.report() -end - -logs.simpleline = logs.reportline - -function logs.reportbanner() -- for scripts too - logs.report(banner) -end - -function logs.help(message,option) - logs.reportbanner() - logs.reportline() - logs.reportlines(message) - local moreinfo = logs.moreinfo or "" - if moreinfo ~= "" and option ~= "nomoreinfo" then - logs.reportline() - logs.reportlines(moreinfo) - end -end - -logs.set_level('error') -logs.set_method('tex') - -function logs.system(whereto,process,jobname,category,...) - for i=1,10 do - local f = io.open(whereto,"a") - if f then - f:write(format("%s %s => %s => %s => %s\r",os.date("%d/%m/%y %H:%m:%S"),process,jobname,category,format(...))) - f:close() - break - else - sleep(0.1) - end - end -end - ---~ local syslogname = "oeps.xxx" ---~ ---~ for i=1,10 do ---~ logs.system(syslogname,"context","test","fonts","font %s recached due to newer version (%s)","blabla","123") ---~ end - -function logs.fatal(where,...) - logs.report(where,"fatal error: %s, aborting now",format(...)) - os.exit() -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['data-inp'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files", -} - --- After a few years using the code the large luat-inp.lua file --- has been split up a bit. In the process some functionality was --- dropped: --- --- * support for reading lsr files --- * selective scanning (subtrees) --- * some public auxiliary functions were made private --- --- TODO: os.getenv -> os.env[] --- TODO: instances.[hashes,cnffiles,configurations,522] --- TODO: check escaping in find etc, too much, too slow - --- This lib is multi-purpose and can be loaded again later on so that --- additional functionality becomes available. We will split thislogs.report("fileio", --- module in components once we're done with prototyping. This is the --- first code I wrote for LuaTeX, so it needs some cleanup. Before changing --- something in this module one can best check with Taco or Hans first; there --- is some nasty trickery going on that relates to traditional kpse support. - --- To be considered: hash key lowercase, first entry in table filename --- (any case), rest paths (so no need for optimization). Or maybe a --- separate table that matches lowercase names to mixed case when --- present. In that case the lower() cases can go away. I will do that --- only when we run into problems with names ... well ... Iwona-Regular. - --- Beware, loading and saving is overloaded in luat-tmp! - -local format, gsub, find, lower, upper, match, gmatch = string.format, string.gsub, string.find, string.lower, string.upper, string.match, string.gmatch -local concat, insert, sortedkeys = table.concat, table.insert, table.sortedkeys -local next, type = next, type -local lpegmatch = lpeg.match - -local trace_locating, trace_detail, trace_expansions = false, false, false - -trackers.register("resolvers.locating", function(v) trace_locating = v end) -trackers.register("resolvers.details", function(v) trace_detail = v end) -trackers.register("resolvers.expansions", function(v) trace_expansions = v end) -- todo - -if not resolvers then - resolvers = { - suffixes = { }, - formats = { }, - dangerous = { }, - suffixmap = { }, - alternatives = { }, - locators = { }, -- locate databases - hashers = { }, -- load databases - generators = { }, -- generate databases - } -end - -local resolvers = resolvers - -resolvers.locators .notfound = { nil } -resolvers.hashers .notfound = { nil } -resolvers.generators.notfound = { nil } - -resolvers.cacheversion = '1.0.1' -resolvers.cnfname = 'texmf.cnf' -resolvers.luaname = 'texmfcnf.lua' -resolvers.homedir = os.env[os.type == "windows" and 'USERPROFILE'] or os.env['HOME'] or '~' -resolvers.cnfdefault = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c}' - -local dummy_path_expr = "^!*unset/*$" - -local formats = resolvers.formats -local suffixes = resolvers.suffixes -local dangerous = resolvers.dangerous -local suffixmap = resolvers.suffixmap -local alternatives = resolvers.alternatives - -formats['afm'] = 'AFMFONTS' suffixes['afm'] = { 'afm' } -formats['enc'] = 'ENCFONTS' suffixes['enc'] = { 'enc' } -formats['fmt'] = 'TEXFORMATS' suffixes['fmt'] = { 'fmt' } -formats['map'] = 'TEXFONTMAPS' suffixes['map'] = { 'map' } -formats['mp'] = 'MPINPUTS' suffixes['mp'] = { 'mp' } -formats['ocp'] = 'OCPINPUTS' suffixes['ocp'] = { 'ocp' } -formats['ofm'] = 'OFMFONTS' suffixes['ofm'] = { 'ofm', 'tfm' } -formats['otf'] = 'OPENTYPEFONTS' suffixes['otf'] = { 'otf' } -- 'ttf' -formats['opl'] = 'OPLFONTS' suffixes['opl'] = { 'opl' } -formats['otp'] = 'OTPINPUTS' suffixes['otp'] = { 'otp' } -formats['ovf'] = 'OVFFONTS' suffixes['ovf'] = { 'ovf', 'vf' } -formats['ovp'] = 'OVPFONTS' suffixes['ovp'] = { 'ovp' } -formats['tex'] = 'TEXINPUTS' suffixes['tex'] = { 'tex' } -formats['tfm'] = 'TFMFONTS' suffixes['tfm'] = { 'tfm' } -formats['ttf'] = 'TTFONTS' suffixes['ttf'] = { 'ttf', 'ttc', 'dfont' } -formats['pfb'] = 'T1FONTS' suffixes['pfb'] = { 'pfb', 'pfa' } -formats['vf'] = 'VFFONTS' suffixes['vf'] = { 'vf' } - -formats['fea'] = 'FONTFEATURES' suffixes['fea'] = { 'fea' } -formats['cid'] = 'FONTCIDMAPS' suffixes['cid'] = { 'cid', 'cidmap' } - -formats ['texmfscripts'] = 'TEXMFSCRIPTS' -- new -suffixes['texmfscripts'] = { 'rb', 'pl', 'py' } -- 'lua' - -formats ['lua'] = 'LUAINPUTS' -- new -suffixes['lua'] = { 'lua', 'luc', 'tma', 'tmc' } - --- backward compatible ones - -alternatives['map files'] = 'map' -alternatives['enc files'] = 'enc' -alternatives['cid maps'] = 'cid' -- great, why no cid files -alternatives['font feature files'] = 'fea' -- and fea files here -alternatives['opentype fonts'] = 'otf' -alternatives['truetype fonts'] = 'ttf' -alternatives['truetype collections'] = 'ttc' -alternatives['truetype dictionary'] = 'dfont' -alternatives['type1 fonts'] = 'pfb' - --- obscure ones - -formats ['misc fonts'] = '' -suffixes['misc fonts'] = { } - -formats ['sfd'] = 'SFDFONTS' -suffixes ['sfd'] = { 'sfd' } -alternatives['subfont definition files'] = 'sfd' - --- lib paths - -formats ['lib'] = 'CLUAINPUTS' -- new (needs checking) -suffixes['lib'] = (os.libsuffix and { os.libsuffix }) or { 'dll', 'so' } - --- In practice we will work within one tds tree, but i want to keep --- the option open to build tools that look at multiple trees, which is --- why we keep the tree specific data in a table. We used to pass the --- instance but for practical pusposes we now avoid this and use a --- instance variable. - --- here we catch a few new thingies (todo: add these paths to context.tmf) --- --- FONTFEATURES = .;$TEXMF/fonts/fea// --- FONTCIDMAPS = .;$TEXMF/fonts/cid// - --- we always have one instance active - -resolvers.instance = resolvers.instance or nil -- the current one (slow access) -local instance = resolvers.instance or nil -- the current one (fast access) - -function resolvers.newinstance() - - -- store once, freeze and faster (once reset we can best use - -- instance.environment) maybe better have a register suffix - -- function - - for k, v in next, suffixes do - for i=1,#v do - local vi = v[i] - if vi then - suffixmap[vi] = k - end - end - end - - -- because vf searching is somewhat dangerous, we want to prevent - -- too liberal searching esp because we do a lookup on the current - -- path anyway; only tex (or any) is safe - - for k, v in next, formats do - dangerous[k] = true - end - dangerous.tex = nil - - -- the instance - - local newinstance = { - rootpath = '', - treepath = '', - progname = 'context', - engine = 'luatex', - format = '', - environment = { }, - variables = { }, - expansions = { }, - files = { }, - remap = { }, - configuration = { }, - setup = { }, - order = { }, - found = { }, - foundintrees = { }, - kpsevars = { }, - hashes = { }, - cnffiles = { }, - luafiles = { }, - lists = { }, - remember = true, - diskcache = true, - renewcache = false, - scandisk = true, - cachepath = nil, - loaderror = false, - sortdata = false, - savelists = true, - cleanuppaths = true, - allresults = false, - pattern = nil, -- lists - data = { }, -- only for loading - force_suffixes = true, - fakepaths = { }, - } - - local ne = newinstance.environment - - for k,v in next, os.env do - ne[k] = resolvers.bare_variable(v) - end - - return newinstance - -end - -function resolvers.setinstance(someinstance) - instance = someinstance - resolvers.instance = someinstance - return someinstance -end - -function resolvers.reset() - return resolvers.setinstance(resolvers.newinstance()) -end - -local function reset_hashes() - instance.lists = { } - instance.found = { } -end - -local function check_configuration() -- not yet ok, no time for debugging now - if os.env["OSFONTDIR"] then - -- ok - elseif os.type == "windows" then - os.setenv("OSFONTDIR","c:/windows/fonts//") - elseif os.type == "macosx" then - os.setenv("OSFONTDIR","$HOME/Library/Fonts//;/Library/Fonts//;/System/Library/Fonts//") - end -end - -function resolvers.bare_variable(str) -- assumes str is a string - return (gsub(str,"\s*([\"\']?)(.+)%1\s*", "%2")) -end - -function resolvers.settrace(n) -- no longer number but: 'locating' or 'detail' - if n then - trackers.disable("resolvers.*") - trackers.enable("resolvers."..n) - end -end - -resolvers.settrace(os.getenv("MTX_INPUT_TRACE")) - -function resolvers.osenv(key) - local ie = instance.environment - local value = ie[key] - if value == nil then - -- local e = os.getenv(key) - local e = os.env[key] - if e == nil then - -- value = "" -- false - else - value = resolvers.bare_variable(e) - end - ie[key] = value - end - return value or "" -end - -function resolvers.env(key) - return instance.environment[key] or resolvers.osenv(key) -end - --- - -local function expand_vars(lst) -- simple vars - local variables, env = instance.variables, resolvers.env - local function resolve(a) - return variables[a] or env(a) - end - for k=1,#lst do - lst[k] = gsub(lst[k],"%$([%a%d%_%-]+)",resolve) - end -end - -local function expanded_var(var) -- simple vars - local function resolve(a) - return instance.variables[a] or resolvers.env(a) - end - return (gsub(var,"%$([%a%d%_%-]+)",resolve)) -end - -local function entry(entries,name) - if name and (name ~= "") then - name = gsub(name,'%$','') - local result = entries[name..'.'..instance.progname] or entries[name] - if result then - return result - else - result = resolvers.env(name) - if result then - instance.variables[name] = result - resolvers.expand_variables() - return instance.expansions[name] or "" - end - end - end - return "" -end - -local function is_entry(entries,name) - if name and name ~= "" then - name = gsub(name,'%$','') - return (entries[name..'.'..instance.progname] or entries[name]) ~= nil - else - return false - end -end - --- {a,b,c,d} --- a,b,c/{p,q,r},d --- a,b,c/{p,q,r}/d/{x,y,z}// --- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} --- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} --- a{b,c}{d,e}f --- {a,b,c,d} --- {a,b,c/{p,q,r},d} --- {a,b,c/{p,q,r}/d/{x,y,z}//} --- {a,b,c/{p,q/{x,y,z}},d/{p,q,r}} --- {a,b,c/{p,q/{x,y,z},w}v,d/{p,q,r}} --- {$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c} - --- this one is better and faster, but it took me a while to realize --- that this kind of replacement is cleaner than messy parsing and --- fuzzy concatenating we can probably gain a bit with selectively --- applying lpeg, but experiments with lpeg parsing this proved not to --- work that well; the parsing is ok, but dealing with the resulting --- table is a pain because we need to work inside-out recursively - -local function do_first(a,b) - local t = { } - for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end - return "{" .. concat(t,",") .. "}" -end - -local function do_second(a,b) - local t = { } - for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end - return "{" .. concat(t,",") .. "}" -end - -local function do_both(a,b) - local t = { } - for sa in gmatch(a,"[^,]+") do - for sb in gmatch(b,"[^,]+") do - t[#t+1] = sa .. sb - end - end - return "{" .. concat(t,",") .. "}" -end - -local function do_three(a,b,c) - return a .. b.. c -end - -local function splitpathexpr(str, t, validate) - -- no need for further optimization as it is only called a - -- few times, we can use lpeg for the sub - if trace_expansions then - logs.report("fileio","expanding variable '%s'",str) - end - t = t or { } - str = gsub(str,",}",",@}") - str = gsub(str,"{,","{@,") - -- str = "@" .. str .. "@" - local ok, done - while true do - done = false - while true do - str, ok = gsub(str,"([^{},]+){([^{}]+)}",do_first) - if ok > 0 then done = true else break end - end - while true do - str, ok = gsub(str,"{([^{}]+)}([^{},]+)",do_second) - if ok > 0 then done = true else break end - end - while true do - str, ok = gsub(str,"{([^{}]+)}{([^{}]+)}",do_both) - if ok > 0 then done = true else break end - end - str, ok = gsub(str,"({[^{}]*){([^{}]+)}([^{}]*})",do_three) - if ok > 0 then done = true end - if not done then break end - end - str = gsub(str,"[{}]", "") - str = gsub(str,"@","") - if validate then - for s in gmatch(str,"[^,]+") do - s = validate(s) - if s then t[#t+1] = s end - end - else - for s in gmatch(str,"[^,]+") do - t[#t+1] = s - end - end - if trace_expansions then - for k=1,#t do - logs.report("fileio","% 4i: %s",k,t[k]) - end - end - return t -end - -local function expanded_path_from_list(pathlist) -- maybe not a list, just a path - -- a previous version fed back into pathlist - local newlist, ok = { }, false - for k=1,#pathlist do - if find(pathlist[k],"[{}]") then - ok = true - break - end - end - if ok then - local function validate(s) - s = file.collapse_path(s) - return s ~= "" and not find(s,dummy_path_expr) and s - end - for k=1,#pathlist do - splitpathexpr(pathlist[k],newlist,validate) - end - else - for k=1,#pathlist do - for p in gmatch(pathlist[k],"([^,]+)") do - p = file.collapse_path(p) - if p ~= "" then newlist[#newlist+1] = p end - end - end - end - return newlist -end - --- we follow a rather traditional approach: --- --- (1) texmf.cnf given in TEXMFCNF --- (2) texmf.cnf searched in default variable --- --- also we now follow the stupid route: if not set then just assume *one* --- cnf file under texmf (i.e. distribution) - -local args = environment and environment.original_arguments or arg -- this needs a cleanup - -resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex" -resolvers.ownbin = gsub(resolvers.ownbin,"\\","/") - -function resolvers.getownpath() - local ownpath = resolvers.ownpath or os.selfdir - if not ownpath or ownpath == "" or ownpath == "unset" then - ownpath = args[-1] or arg[-1] - ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/")) - if not ownpath or ownpath == "" then - ownpath = args[-0] or arg[-0] - ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/")) - end - local binary = resolvers.ownbin - if not ownpath or ownpath == "" then - ownpath = ownpath and file.dirname(binary) - end - if not ownpath or ownpath == "" then - if os.binsuffix ~= "" then - binary = file.replacesuffix(binary,os.binsuffix) - end - for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do - local b = file.join(p,binary) - if lfs.isfile(b) then - -- we assume that after changing to the path the currentdir function - -- resolves to the real location and use this side effect here; this - -- trick is needed because on the mac installations use symlinks in the - -- path instead of real locations - local olddir = lfs.currentdir() - if lfs.chdir(p) then - local pp = lfs.currentdir() - if trace_locating and p ~= pp then - logs.report("fileio","following symlink '%s' to '%s'",p,pp) - end - ownpath = pp - lfs.chdir(olddir) - else - if trace_locating then - logs.report("fileio","unable to check path '%s'",p) - end - ownpath = p - end - break - end - end - end - if not ownpath or ownpath == "" then - ownpath = "." - logs.report("fileio","forcing fallback ownpath .") - elseif trace_locating then - logs.report("fileio","using ownpath '%s'",ownpath) - end - end - resolvers.ownpath = ownpath - function resolvers.getownpath() - return resolvers.ownpath - end - return ownpath -end - -local own_places = { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF" } - -local function identify_own() - local ownpath = resolvers.getownpath() or dir.current() - local ie = instance.environment - if ownpath then - if resolvers.env('SELFAUTOLOC') == "" then os.env['SELFAUTOLOC'] = file.collapse_path(ownpath) end - if resolvers.env('SELFAUTODIR') == "" then os.env['SELFAUTODIR'] = file.collapse_path(ownpath .. "/..") end - if resolvers.env('SELFAUTOPARENT') == "" then os.env['SELFAUTOPARENT'] = file.collapse_path(ownpath .. "/../..") end - else - logs.report("fileio","error: unable to locate ownpath") - os.exit() - end - if resolvers.env('TEXMFCNF') == "" then os.env['TEXMFCNF'] = resolvers.cnfdefault end - if resolvers.env('TEXOS') == "" then os.env['TEXOS'] = resolvers.env('SELFAUTODIR') end - if resolvers.env('TEXROOT') == "" then os.env['TEXROOT'] = resolvers.env('SELFAUTOPARENT') end - if trace_locating then - for i=1,#own_places do - local v = own_places[i] - logs.report("fileio","variable '%s' set to '%s'",v,resolvers.env(v) or "unknown") - end - end - identify_own = function() end -end - -function resolvers.identify_cnf() - if #instance.cnffiles == 0 then - -- fallback - identify_own() - -- the real search - resolvers.expand_variables() - local t = resolvers.split_path(resolvers.env('TEXMFCNF')) - t = expanded_path_from_list(t) - expand_vars(t) -- redundant - local function locate(filename,list) - for i=1,#t do - local ti = t[i] - local texmfcnf = file.collapse_path(file.join(ti,filename)) - if lfs.isfile(texmfcnf) then - list[#list+1] = texmfcnf - end - end - end - locate(resolvers.luaname,instance.luafiles) - locate(resolvers.cnfname,instance.cnffiles) - end -end - -local function load_cnf_file(fname) - fname = resolvers.clean_path(fname) - local lname = file.replacesuffix(fname,'lua') - if lfs.isfile(lname) then - local dname = file.dirname(fname) -- fname ? - if not instance.configuration[dname] then - resolvers.load_data(dname,'configuration',lname and file.basename(lname)) - instance.order[#instance.order+1] = instance.configuration[dname] - end - else - f = io.open(fname) - if f then - if trace_locating then - logs.report("fileio","loading configuration file %s", fname) - end - local line, data, n, k, v - local dname = file.dirname(fname) - if not instance.configuration[dname] then - instance.configuration[dname] = { } - instance.order[#instance.order+1] = instance.configuration[dname] - end - local data = instance.configuration[dname] - while true do - local line, n = f:read(), 0 - if line then - while true do -- join lines - line, n = gsub(line,"\\%s*$", "") - if n > 0 then - line = line .. f:read() - else - break - end - end - if not find(line,"^[%%#]") then - local l = gsub(line,"%s*%%.*$","") - local k, v = match(l,"%s*(.-)%s*=%s*(.-)%s*$") - if k and v and not data[k] then - v = gsub(v,"[%%#].*",'') - data[k] = gsub(v,"~","$HOME") - instance.kpsevars[k] = true - end - end - else - break - end - end - f:close() - elseif trace_locating then - logs.report("fileio","skipping configuration file '%s'", fname) - end - end -end - -local function collapse_cnf_data() -- potential optimization: pass start index (setup and configuration are shared) - local order = instance.order - for i=1,#order do - local c = order[i] - for k,v in next, c do - if not instance.variables[k] then - if instance.environment[k] then - instance.variables[k] = instance.environment[k] - else - instance.kpsevars[k] = true - instance.variables[k] = resolvers.bare_variable(v) - end - end - end - end -end - -function resolvers.load_cnf() - local function loadoldconfigdata() - local cnffiles = instance.cnffiles - for i=1,#cnffiles do - load_cnf_file(cnffiles[i]) - end - end - -- instance.cnffiles contain complete names now ! - -- we still use a funny mix of cnf and new but soon - -- we will switch to lua exclusively as we only use - -- the file to collect the tree roots - if #instance.cnffiles == 0 then - if trace_locating then - logs.report("fileio","no cnf files found (TEXMFCNF may not be set/known)") - end - else - local cnffiles = instance.cnffiles - instance.rootpath = cnffiles[1] - for k=1,#cnffiles do - instance.cnffiles[k] = file.collapse_path(cnffiles[k]) - end - for i=1,3 do - instance.rootpath = file.dirname(instance.rootpath) - end - instance.rootpath = file.collapse_path(instance.rootpath) - if instance.diskcache and not instance.renewcache then - resolvers.loadoldconfig(instance.cnffiles) - if instance.loaderror then - loadoldconfigdata() - resolvers.saveoldconfig() - end - else - loadoldconfigdata() - if instance.renewcache then - resolvers.saveoldconfig() - end - end - collapse_cnf_data() - end - check_configuration() -end - -function resolvers.load_lua() - if #instance.luafiles == 0 then - -- yet harmless - else - instance.rootpath = instance.luafiles[1] - local luafiles = instance.luafiles - for k=1,#luafiles do - instance.luafiles[k] = file.collapse_path(luafiles[k]) - end - for i=1,3 do - instance.rootpath = file.dirname(instance.rootpath) - end - instance.rootpath = file.collapse_path(instance.rootpath) - resolvers.loadnewconfig() - collapse_cnf_data() - end - check_configuration() -end - --- database loading - -function resolvers.load_hash() - resolvers.locatelists() - if instance.diskcache and not instance.renewcache then - resolvers.loadfiles() - if instance.loaderror then - resolvers.loadlists() - resolvers.savefiles() - end - else - resolvers.loadlists() - if instance.renewcache then - resolvers.savefiles() - end - end -end - -function resolvers.append_hash(type,tag,name) - if trace_locating then - logs.report("fileio","hash '%s' appended",tag) - end - insert(instance.hashes, { ['type']=type, ['tag']=tag, ['name']=name } ) -end - -function resolvers.prepend_hash(type,tag,name) - if trace_locating then - logs.report("fileio","hash '%s' prepended",tag) - end - insert(instance.hashes, 1, { ['type']=type, ['tag']=tag, ['name']=name } ) -end - -function resolvers.extend_texmf_var(specification) -- crap, we could better prepend the hash --- local t = resolvers.expanded_path_list('TEXMF') -- full expansion - local t = resolvers.split_path(resolvers.env('TEXMF')) - insert(t,1,specification) - local newspec = concat(t,";") - if instance.environment["TEXMF"] then - instance.environment["TEXMF"] = newspec - elseif instance.variables["TEXMF"] then - instance.variables["TEXMF"] = newspec - else - -- weird - end - resolvers.expand_variables() - reset_hashes() -end - --- locators - -function resolvers.locatelists() - local texmfpaths = resolvers.clean_path_list('TEXMF') - for i=1,#texmfpaths do - local path = texmfpaths[i] - if trace_locating then - logs.report("fileio","locating list of '%s'",path) - end - resolvers.locatedatabase(file.collapse_path(path)) - end -end - -function resolvers.locatedatabase(specification) - return resolvers.methodhandler('locators', specification) -end - -function resolvers.locators.tex(specification) - if specification and specification ~= '' and lfs.isdir(specification) then - if trace_locating then - logs.report("fileio","tex locator '%s' found",specification) - end - resolvers.append_hash('file',specification,filename) - elseif trace_locating then - logs.report("fileio","tex locator '%s' not found",specification) - end -end - --- hashers - -function resolvers.hashdatabase(tag,name) - return resolvers.methodhandler('hashers',tag,name) -end - -function resolvers.loadfiles() - instance.loaderror = false - instance.files = { } - if not instance.renewcache then - local hashes = instance.hashes - for k=1,#hashes do - local hash = hashes[k] - resolvers.hashdatabase(hash.tag,hash.name) - if instance.loaderror then break end - end - end -end - -function resolvers.hashers.tex(tag,name) - resolvers.load_data(tag,'files') -end - --- generators: - -function resolvers.loadlists() - local hashes = instance.hashes - for i=1,#hashes do - resolvers.generatedatabase(hashes[i].tag) - end -end - -function resolvers.generatedatabase(specification) - return resolvers.methodhandler('generators', specification) -end - --- starting with . or .. etc or funny char - -local weird = lpeg.P(".")^1 + lpeg.anywhere(lpeg.S("~`!#$%^&*()={}[]:;\"\'||<>,?\n\r\t")) - ---~ local l_forbidden = lpeg.S("~`!#$%^&*()={}[]:;\"\'||\\/<>,?\n\r\t") ---~ local l_confusing = lpeg.P(" ") ---~ local l_character = lpeg.patterns.utf8 ---~ local l_dangerous = lpeg.P(".") - ---~ local l_normal = (l_character - l_forbidden - l_confusing - l_dangerous) * (l_character - l_forbidden - l_confusing^2)^0 * lpeg.P(-1) ---~ ----- l_normal = l_normal * lpeg.Cc(true) + lpeg.Cc(false) - ---~ local function test(str) ---~ print(str,lpeg.match(l_normal,str)) ---~ end ---~ test("ヒラギノ明朝 Pro W3") ---~ test("..ヒラギノ明朝 Pro W3") ---~ test(":ヒラギノ明朝 Pro W3;") ---~ test("ヒラギノ明朝 /Pro W3;") ---~ test("ヒラギノ明朝 Pro W3") - -function resolvers.generators.tex(specification) - local tag = specification - if trace_locating then - logs.report("fileio","scanning path '%s'",specification) - end - instance.files[tag] = { } - local files = instance.files[tag] - local n, m, r = 0, 0, 0 - local spec = specification .. '/' - local attributes = lfs.attributes - local directory = lfs.dir - local function action(path) - local full - if path then - full = spec .. path .. '/' - else - full = spec - end - for name in directory(full) do - if not lpegmatch(weird,name) then - -- if lpegmatch(l_normal,name) then - local mode = attributes(full..name,'mode') - if mode == 'file' then - if path then - n = n + 1 - local f = files[name] - if f then - if type(f) == 'string' then - files[name] = { f, path } - else - f[#f+1] = path - end - else -- probably unique anyway - files[name] = path - local lower = lower(name) - if name ~= lower then - files["remap:"..lower] = name - r = r + 1 - end - end - end - elseif mode == 'directory' then - m = m + 1 - if path then - action(path..'/'..name) - else - action(name) - end - end - end - end - end - action() - if trace_locating then - logs.report("fileio","%s files found on %s directories with %s uppercase remappings",n,m,r) - end -end - --- savers, todo - -function resolvers.savefiles() - resolvers.save_data('files') -end - --- A config (optionally) has the paths split in tables. Internally --- we join them and split them after the expansion has taken place. This --- is more convenient. - ---~ local checkedsplit = string.checkedsplit - -local cache = { } - -local splitter = lpeg.Ct(lpeg.splitat(lpeg.S(os.type == "windows" and ";" or ":;"))) - -local function split_kpse_path(str) -- beware, this can be either a path or a {specification} - local found = cache[str] - if not found then - if str == "" then - found = { } - else - str = gsub(str,"\\","/") ---~ local split = (find(str,";") and checkedsplit(str,";")) or checkedsplit(str,io.pathseparator) -local split = lpegmatch(splitter,str) - found = { } - for i=1,#split do - local s = split[i] - if not find(s,"^{*unset}*") then - found[#found+1] = s - end - end - if trace_expansions then - logs.report("fileio","splitting path specification '%s'",str) - for k=1,#found do - logs.report("fileio","% 4i: %s",k,found[k]) - end - end - cache[str] = found - end - end - return found -end - -resolvers.split_kpse_path = split_kpse_path - -function resolvers.splitconfig() - for i=1,#instance do - local c = instance[i] - for k,v in next, c do - if type(v) == 'string' then - local t = split_kpse_path(v) - if #t > 1 then - c[k] = t - end - end - end - end -end - -function resolvers.joinconfig() - local order = instance.order - for i=1,#order do - local c = order[i] - for k,v in next, c do -- indexed? - if type(v) == 'table' then - c[k] = file.join_path(v) - end - end - end -end - -function resolvers.split_path(str) - if type(str) == 'table' then - return str - else - return split_kpse_path(str) - end -end - -function resolvers.join_path(str) - if type(str) == 'table' then - return file.join_path(str) - else - return str - end -end - -function resolvers.splitexpansions() - local ie = instance.expansions - for k,v in next, ie do - local t, h, p = { }, { }, split_kpse_path(v) - for kk=1,#p do - local vv = p[kk] - if vv ~= "" and not h[vv] then - t[#t+1] = vv - h[vv] = true - end - end - if #t > 1 then - ie[k] = t - else - ie[k] = t[1] - end - end -end - --- end of split/join code - -function resolvers.saveoldconfig() - resolvers.splitconfig() - resolvers.save_data('configuration') - resolvers.joinconfig() -end - -resolvers.configbanner = [[ --- This is a Luatex configuration file created by 'luatools.lua' or --- 'luatex.exe' directly. For comment, suggestions and questions you can --- contact the ConTeXt Development Team. This configuration file is --- not copyrighted. [HH & TH] -]] - -function resolvers.serialize(files) - -- This version is somewhat optimized for the kind of - -- tables that we deal with, so it's much faster than - -- the generic serializer. This makes sense because - -- luatools and mtxtools are called frequently. Okay, - -- we pay a small price for properly tabbed tables. - local t = { } - local function dump(k,v,m) -- could be moved inline - if type(v) == 'string' then - return m .. "['" .. k .. "']='" .. v .. "'," - elseif #v == 1 then - return m .. "['" .. k .. "']='" .. v[1] .. "'," - else - return m .. "['" .. k .. "']={'" .. concat(v,"','").. "'}," - end - end - t[#t+1] = "return {" - if instance.sortdata then - local sortedfiles = sortedkeys(files) - for i=1,#sortedfiles do - local k = sortedfiles[i] - local fk = files[k] - if type(fk) == 'table' then - t[#t+1] = "\t['" .. k .. "']={" - local sortedfk = sortedkeys(fk) - for j=1,#sortedfk do - local kk = sortedfk[j] - t[#t+1] = dump(kk,fk[kk],"\t\t") - end - t[#t+1] = "\t}," - else - t[#t+1] = dump(k,fk,"\t") - end - end - else - for k, v in next, files do - if type(v) == 'table' then - t[#t+1] = "\t['" .. k .. "']={" - for kk,vv in next, v do - t[#t+1] = dump(kk,vv,"\t\t") - end - t[#t+1] = "\t}," - else - t[#t+1] = dump(k,v,"\t") - end - end - end - t[#t+1] = "}" - return concat(t,"\n") -end - -local data_state = { } - -function resolvers.data_state() - return data_state or { } -end - -function resolvers.save_data(dataname, makename) -- untested without cache overload - for cachename, files in next, instance[dataname] do - local name = (makename or file.join)(cachename,dataname) - local luaname, lucname = name .. ".lua", name .. ".luc" - if trace_locating then - logs.report("fileio","preparing '%s' for '%s'",dataname,cachename) - end - for k, v in next, files do - if type(v) == "table" and #v == 1 then - files[k] = v[1] - end - end - local data = { - type = dataname, - root = cachename, - version = resolvers.cacheversion, - date = os.date("%Y-%m-%d"), - time = os.date("%H:%M:%S"), - content = files, - uuid = os.uuid(), - } - local ok = io.savedata(luaname,resolvers.serialize(data)) - if ok then - if trace_locating then - logs.report("fileio","'%s' saved in '%s'",dataname,luaname) - end - if utils.lua.compile(luaname,lucname,false,true) then -- no cleanup but strip - if trace_locating then - logs.report("fileio","'%s' compiled to '%s'",dataname,lucname) - end - else - if trace_locating then - logs.report("fileio","compiling failed for '%s', deleting file '%s'",dataname,lucname) - end - os.remove(lucname) - end - elseif trace_locating then - logs.report("fileio","unable to save '%s' in '%s' (access error)",dataname,luaname) - end - end -end - -function resolvers.load_data(pathname,dataname,filename,makename) -- untested without cache overload - filename = ((not filename or (filename == "")) and dataname) or filename - filename = (makename and makename(dataname,filename)) or file.join(pathname,filename) - local blob = loadfile(filename .. ".luc") or loadfile(filename .. ".lua") - if blob then - local data = blob() - if data and data.content and data.type == dataname and data.version == resolvers.cacheversion then - data_state[#data_state+1] = data.uuid - if trace_locating then - logs.report("fileio","loading '%s' for '%s' from '%s'",dataname,pathname,filename) - end - instance[dataname][pathname] = data.content - else - if trace_locating then - logs.report("fileio","skipping '%s' for '%s' from '%s'",dataname,pathname,filename) - end - instance[dataname][pathname] = { } - instance.loaderror = true - end - elseif trace_locating then - logs.report("fileio","skipping '%s' for '%s' from '%s'",dataname,pathname,filename) - end -end - --- some day i'll use the nested approach, but not yet (actually we even drop --- engine/progname support since we have only luatex now) --- --- first texmfcnf.lua files are located, next the cached texmf.cnf files --- --- return { --- TEXMFBOGUS = 'effe checken of dit werkt', --- } - -function resolvers.resetconfig() - identify_own() - instance.configuration, instance.setup, instance.order, instance.loaderror = { }, { }, { }, false -end - -function resolvers.loadnewconfig() - local luafiles = instance.luafiles - for i=1,#luafiles do - local cnf = luafiles[i] - local pathname = file.dirname(cnf) - local filename = file.join(pathname,resolvers.luaname) - local blob = loadfile(filename) - if blob then - local data = blob() - if data then - if trace_locating then - logs.report("fileio","loading configuration file '%s'",filename) - end - if true then - -- flatten to variable.progname - local t = { } - for k, v in next, data do -- v = progname - if type(v) == "string" then - t[k] = v - else - for kk, vv in next, v do -- vv = variable - if type(vv) == "string" then - t[vv.."."..v] = kk - end - end - end - end - instance['setup'][pathname] = t - else - instance['setup'][pathname] = data - end - else - if trace_locating then - logs.report("fileio","skipping configuration file '%s'",filename) - end - instance['setup'][pathname] = { } - instance.loaderror = true - end - elseif trace_locating then - logs.report("fileio","skipping configuration file '%s'",filename) - end - instance.order[#instance.order+1] = instance.setup[pathname] - if instance.loaderror then break end - end -end - -function resolvers.loadoldconfig() - if not instance.renewcache then - local cnffiles = instance.cnffiles - for i=1,#cnffiles do - local cnf = cnffiles[i] - local dname = file.dirname(cnf) - resolvers.load_data(dname,'configuration') - instance.order[#instance.order+1] = instance.configuration[dname] - if instance.loaderror then break end - end - end - resolvers.joinconfig() -end - -function resolvers.expand_variables() - local expansions, environment, variables = { }, instance.environment, instance.variables - local env = resolvers.env - instance.expansions = expansions - local engine, progname = instance.engine, instance.progname - if type(engine) ~= "string" then instance.engine, engine = "", "" end - if type(progname) ~= "string" then instance.progname, progname = "", "" end - if engine ~= "" then environment['engine'] = engine end - if progname ~= "" then environment['progname'] = progname end - for k,v in next, environment do - local a, b = match(k,"^(%a+)%_(.*)%s*$") - if a and b then - expansions[a..'.'..b] = v - else - expansions[k] = v - end - end - for k,v in next, environment do -- move environment to expansions - if not expansions[k] then expansions[k] = v end - end - for k,v in next, variables do -- move variables to expansions - if not expansions[k] then expansions[k] = v end - end - local busy = false - local function resolve(a) - busy = true - return expansions[a] or env(a) - end - while true do - busy = false - for k,v in next, expansions do - local s, n = gsub(v,"%$([%a%d%_%-]+)",resolve) - local s, m = gsub(s,"%$%{([%a%d%_%-]+)%}",resolve) - if n > 0 or m > 0 then - expansions[k]= s - end - end - if not busy then break end - end - for k,v in next, expansions do - expansions[k] = gsub(v,"\\", '/') - end -end - -function resolvers.variable(name) - return entry(instance.variables,name) -end - -function resolvers.expansion(name) - return entry(instance.expansions,name) -end - -function resolvers.is_variable(name) - return is_entry(instance.variables,name) -end - -function resolvers.is_expansion(name) - return is_entry(instance.expansions,name) -end - -function resolvers.unexpanded_path_list(str) - local pth = resolvers.variable(str) - local lst = resolvers.split_path(pth) - return expanded_path_from_list(lst) -end - -function resolvers.unexpanded_path(str) - return file.join_path(resolvers.unexpanded_path_list(str)) -end - -do -- no longer needed - - local done = { } - - function resolvers.reset_extra_path() - local ep = instance.extra_paths - if not ep then - ep, done = { }, { } - instance.extra_paths = ep - elseif #ep > 0 then - instance.lists, done = { }, { } - end - end - - function resolvers.register_extra_path(paths,subpaths) - local ep = instance.extra_paths or { } - local n = #ep - if paths and paths ~= "" then - if subpaths and subpaths ~= "" then - for p in gmatch(paths,"[^,]+") do - -- we gmatch each step again, not that fast, but used seldom - for s in gmatch(subpaths,"[^,]+") do - local ps = p .. "/" .. s - if not done[ps] then - ep[#ep+1] = resolvers.clean_path(ps) - done[ps] = true - end - end - end - else - for p in gmatch(paths,"[^,]+") do - if not done[p] then - ep[#ep+1] = resolvers.clean_path(p) - done[p] = true - end - end - end - elseif subpaths and subpaths ~= "" then - for i=1,n do - -- we gmatch each step again, not that fast, but used seldom - for s in gmatch(subpaths,"[^,]+") do - local ps = ep[i] .. "/" .. s - if not done[ps] then - ep[#ep+1] = resolvers.clean_path(ps) - done[ps] = true - end - end - end - end - if #ep > 0 then - instance.extra_paths = ep -- register paths - end - if #ep > n then - instance.lists = { } -- erase the cache - end - end - -end - -local function made_list(instance,list) - local ep = instance.extra_paths - if not ep or #ep == 0 then - return list - else - local done, new = { }, { } - -- honour . .. ../.. but only when at the start - for k=1,#list do - local v = list[k] - if not done[v] then - if find(v,"^[%.%/]$") then - done[v] = true - new[#new+1] = v - else - break - end - end - end - -- first the extra paths - for k=1,#ep do - local v = ep[k] - if not done[v] then - done[v] = true - new[#new+1] = v - end - end - -- next the formal paths - for k=1,#list do - local v = list[k] - if not done[v] then - done[v] = true - new[#new+1] = v - end - end - return new - end -end - -function resolvers.clean_path_list(str) - local t = resolvers.expanded_path_list(str) - if t then - for i=1,#t do - t[i] = file.collapse_path(resolvers.clean_path(t[i])) - end - end - return t -end - -function resolvers.expand_path(str) - return file.join_path(resolvers.expanded_path_list(str)) -end - -function resolvers.expanded_path_list(str) - if not str then - return ep or { } -- ep ? - elseif instance.savelists then - -- engine+progname hash - str = gsub(str,"%$","") - if not instance.lists[str] then -- cached - local lst = made_list(instance,resolvers.split_path(resolvers.expansion(str))) - instance.lists[str] = expanded_path_from_list(lst) - end - return instance.lists[str] - else - local lst = resolvers.split_path(resolvers.expansion(str)) - return made_list(instance,expanded_path_from_list(lst)) - end -end - -function resolvers.expanded_path_list_from_var(str) -- brrr - local tmp = resolvers.var_of_format_or_suffix(gsub(str,"%$","")) - if tmp ~= "" then - return resolvers.expanded_path_list(tmp) - else - return resolvers.expanded_path_list(str) - end -end - -function resolvers.expand_path_from_var(str) - return file.join_path(resolvers.expanded_path_list_from_var(str)) -end - -function resolvers.format_of_var(str) - return formats[str] or formats[alternatives[str]] or '' -end -function resolvers.format_of_suffix(str) - return suffixmap[file.extname(str)] or 'tex' -end - -function resolvers.variable_of_format(str) - return formats[str] or formats[alternatives[str]] or '' -end - -function resolvers.var_of_format_or_suffix(str) - local v = formats[str] - if v then - return v - end - v = formats[alternatives[str]] - if v then - return v - end - v = suffixmap[file.extname(str)] - if v then - return formats[isf] - end - return '' -end - -function resolvers.expand_braces(str) -- output variable and brace expansion of STRING - local ori = resolvers.variable(str) - local pth = expanded_path_from_list(resolvers.split_path(ori)) - return file.join_path(pth) -end - -resolvers.isreadable = { } - -function resolvers.isreadable.file(name) - local readable = lfs.isfile(name) -- brrr - if trace_detail then - if readable then - logs.report("fileio","file '%s' is readable",name) - else - logs.report("fileio","file '%s' is not readable", name) - end - end - return readable -end - -resolvers.isreadable.tex = resolvers.isreadable.file - --- name --- name/name - -local function collect_files(names) - local filelist = { } - for k=1,#names do - local fname = names[k] - if trace_detail then - logs.report("fileio","checking name '%s'",fname) - end - local bname = file.basename(fname) - local dname = file.dirname(fname) - if dname == "" or find(dname,"^%.") then - dname = false - else - dname = "/" .. dname .. "$" - end - local hashes = instance.hashes - for h=1,#hashes do - local hash = hashes[h] - local blobpath = hash.tag - local files = blobpath and instance.files[blobpath] - if files then - if trace_detail then - logs.report("fileio","deep checking '%s' (%s)",blobpath,bname) - end - local blobfile = files[bname] - if not blobfile then - local rname = "remap:"..bname - blobfile = files[rname] - if blobfile then - bname = files[rname] - blobfile = files[bname] - end - end - if blobfile then - if type(blobfile) == 'string' then - if not dname or find(blobfile,dname) then - filelist[#filelist+1] = { - hash.type, - file.join(blobpath,blobfile,bname), -- search - resolvers.concatinators[hash.type](blobpath,blobfile,bname) -- result - } - end - else - for kk=1,#blobfile do - local vv = blobfile[kk] - if not dname or find(vv,dname) then - filelist[#filelist+1] = { - hash.type, - file.join(blobpath,vv,bname), -- search - resolvers.concatinators[hash.type](blobpath,vv,bname) -- result - } - end - end - end - end - elseif trace_locating then - logs.report("fileio","no match in '%s' (%s)",blobpath,bname) - end - end - end - if #filelist > 0 then - return filelist - else - return nil - end -end - -function resolvers.suffix_of_format(str) - if suffixes[str] then - return suffixes[str][1] - else - return "" - end -end - -function resolvers.suffixes_of_format(str) - if suffixes[str] then - return suffixes[str] - else - return {} - end -end - -function resolvers.register_in_trees(name) - if not find(name,"^%.") then - instance.foundintrees[name] = (instance.foundintrees[name] or 0) + 1 -- maybe only one - end -end - --- split the next one up for readability (bu this module needs a cleanup anyway) - -local function can_be_dir(name) -- can become local - local fakepaths = instance.fakepaths - if not fakepaths[name] then - if lfs.isdir(name) then - fakepaths[name] = 1 -- directory - else - fakepaths[name] = 2 -- no directory - end - end - return (fakepaths[name] == 1) -end - -local function collect_instance_files(filename,collected) -- todo : plugin (scanners, checkers etc) - local result = collected or { } - local stamp = nil - filename = file.collapse_path(filename) - -- speed up / beware: format problem - if instance.remember then - stamp = filename .. "--" .. instance.engine .. "--" .. instance.progname .. "--" .. instance.format - if instance.found[stamp] then - if trace_locating then - logs.report("fileio","remembering file '%s'",filename) - end - return instance.found[stamp] - end - end - if not dangerous[instance.format or "?"] then - if resolvers.isreadable.file(filename) then - if trace_detail then - logs.report("fileio","file '%s' found directly",filename) - end - instance.found[stamp] = { filename } - return { filename } - end - end - if find(filename,'%*') then - if trace_locating then - logs.report("fileio","checking wildcard '%s'", filename) - end - result = resolvers.find_wildcard_files(filename) - elseif file.is_qualified_path(filename) then - if resolvers.isreadable.file(filename) then - if trace_locating then - logs.report("fileio","qualified name '%s'", filename) - end - result = { filename } - else - local forcedname, ok, suffix = "", false, file.extname(filename) - if suffix == "" then -- why - if instance.format == "" then - forcedname = filename .. ".tex" - if resolvers.isreadable.file(forcedname) then - if trace_locating then - logs.report("fileio","no suffix, forcing standard filetype 'tex'") - end - result, ok = { forcedname }, true - end - else - local suffixes = resolvers.suffixes_of_format(instance.format) - for _, s in next, suffixes do - forcedname = filename .. "." .. s - if resolvers.isreadable.file(forcedname) then - if trace_locating then - logs.report("fileio","no suffix, forcing format filetype '%s'", s) - end - result, ok = { forcedname }, true - break - end - end - end - end - if not ok and suffix ~= "" then - -- try to find in tree (no suffix manipulation), here we search for the - -- matching last part of the name - local basename = file.basename(filename) - local pattern = gsub(filename .. "$","([%.%-])","%%%1") - local savedformat = instance.format - local format = savedformat or "" - if format == "" then - instance.format = resolvers.format_of_suffix(suffix) - end - if not format then - instance.format = "othertextfiles" -- kind of everything, maybe texinput is better - end - -- - if basename ~= filename then - local resolved = collect_instance_files(basename) - if #result == 0 then - local lowered = lower(basename) - if filename ~= lowered then - resolved = collect_instance_files(lowered) - end - end - resolvers.format = savedformat - -- - for r=1,#resolved do - local rr = resolved[r] - if find(rr,pattern) then - result[#result+1], ok = rr, true - end - end - end - -- a real wildcard: - -- - -- if not ok then - -- local filelist = collect_files({basename}) - -- for f=1,#filelist do - -- local ff = filelist[f][3] or "" - -- if find(ff,pattern) then - -- result[#result+1], ok = ff, true - -- end - -- end - -- end - end - if not ok and trace_locating then - logs.report("fileio","qualified name '%s'", filename) - end - end - else - -- search spec - local filetype, extra, done, wantedfiles, ext = '', nil, false, { }, file.extname(filename) - if ext == "" then - if not instance.force_suffixes then - wantedfiles[#wantedfiles+1] = filename - end - else - wantedfiles[#wantedfiles+1] = filename - end - if instance.format == "" then - if ext == "" then - local forcedname = filename .. '.tex' - wantedfiles[#wantedfiles+1] = forcedname - filetype = resolvers.format_of_suffix(forcedname) - if trace_locating then - logs.report("fileio","forcing filetype '%s'",filetype) - end - else - filetype = resolvers.format_of_suffix(filename) - if trace_locating then - logs.report("fileio","using suffix based filetype '%s'",filetype) - end - end - else - if ext == "" then - local suffixes = resolvers.suffixes_of_format(instance.format) - for _, s in next, suffixes do - wantedfiles[#wantedfiles+1] = filename .. "." .. s - end - end - filetype = instance.format - if trace_locating then - logs.report("fileio","using given filetype '%s'",filetype) - end - end - local typespec = resolvers.variable_of_format(filetype) - local pathlist = resolvers.expanded_path_list(typespec) - if not pathlist or #pathlist == 0 then - -- no pathlist, access check only / todo == wildcard - if trace_detail then - logs.report("fileio","checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | ")) - end - for k=1,#wantedfiles do - local fname = wantedfiles[k] - if fname and resolvers.isreadable.file(fname) then - filename, done = fname, true - result[#result+1] = file.join('.',fname) - break - end - end - -- this is actually 'other text files' or 'any' or 'whatever' - local filelist = collect_files(wantedfiles) - local fl = filelist and filelist[1] - if fl then - filename = fl[3] - result[#result+1] = filename - done = true - end - else - -- list search - local filelist = collect_files(wantedfiles) - local dirlist = { } - if filelist then - for i=1,#filelist do - dirlist[i] = file.dirname(filelist[i][2]) .. "/" - end - end - if trace_detail then - logs.report("fileio","checking filename '%s'",filename) - end - -- a bit messy ... esp the doscan setting here - local doscan - for k=1,#pathlist do - local path = pathlist[k] - if find(path,"^!!") then doscan = false else doscan = true end - local pathname = gsub(path,"^!+", '') - done = false - -- using file list - if filelist then - local expression - -- compare list entries with permitted pattern -- /xx /xx// - if not find(pathname,"/$") then - expression = pathname .. "/" - else - expression = pathname - end - expression = gsub(expression,"([%-%.])","%%%1") -- this also influences - expression = gsub(expression,"//+$", '/.*') -- later usage of pathname - expression = gsub(expression,"//", '/.-/') -- not ok for /// but harmless - expression = "^" .. expression .. "$" - if trace_detail then - logs.report("fileio","using pattern '%s' for path '%s'",expression,pathname) - end - for k=1,#filelist do - local fl = filelist[k] - local f = fl[2] - local d = dirlist[k] - if find(d,expression) then - --- todo, test for readable - result[#result+1] = fl[3] - resolvers.register_in_trees(f) -- for tracing used files - done = true - if instance.allresults then - if trace_detail then - logs.report("fileio","match in hash for file '%s' on path '%s', continue scanning",f,d) - end - else - if trace_detail then - logs.report("fileio","match in hash for file '%s' on path '%s', quit scanning",f,d) - end - break - end - elseif trace_detail then - logs.report("fileio","no match in hash for file '%s' on path '%s'",f,d) - end - end - end - if not done and doscan then - -- check if on disk / unchecked / does not work at all / also zips - if resolvers.splitmethod(pathname).scheme == 'file' then -- ? - local pname = gsub(pathname,"%.%*$",'') - if not find(pname,"%*") then - local ppname = gsub(pname,"/+$","") - if can_be_dir(ppname) then - for k=1,#wantedfiles do - local w = wantedfiles[k] - local fname = file.join(ppname,w) - if resolvers.isreadable.file(fname) then - if trace_detail then - logs.report("fileio","found '%s' by scanning",fname) - end - result[#result+1] = fname - done = true - if not instance.allresults then break end - end - end - else - -- no access needed for non existing path, speedup (esp in large tree with lots of fake) - end - end - end - end - if not done and doscan then - -- todo: slow path scanning - end - if done and not instance.allresults then break end - end - end - end - for k=1,#result do - result[k] = file.collapse_path(result[k]) - end - if instance.remember then - instance.found[stamp] = result - end - return result -end - -if not resolvers.concatinators then resolvers.concatinators = { } end - -resolvers.concatinators.tex = file.join -resolvers.concatinators.file = resolvers.concatinators.tex - -function resolvers.find_files(filename,filetype,mustexist) - if type(mustexist) == boolean then - -- all set - elseif type(filetype) == 'boolean' then - filetype, mustexist = nil, false - elseif type(filetype) ~= 'string' then - filetype, mustexist = nil, false - end - instance.format = filetype or '' - local result = collect_instance_files(filename) - if #result == 0 then - local lowered = lower(filename) - if filename ~= lowered then - return collect_instance_files(lowered) - end - end - instance.format = '' - return result -end - -function resolvers.find_file(filename,filetype,mustexist) - return (resolvers.find_files(filename,filetype,mustexist)[1] or "") -end - -function resolvers.find_given_files(filename) - local bname, result = file.basename(filename), { } - local hashes = instance.hashes - for k=1,#hashes do - local hash = hashes[k] - local files = instance.files[hash.tag] or { } - local blist = files[bname] - if not blist then - local rname = "remap:"..bname - blist = files[rname] - if blist then - bname = files[rname] - blist = files[bname] - end - end - if blist then - if type(blist) == 'string' then - result[#result+1] = resolvers.concatinators[hash.type](hash.tag,blist,bname) or "" - if not instance.allresults then break end - else - for kk=1,#blist do - local vv = blist[kk] - result[#result+1] = resolvers.concatinators[hash.type](hash.tag,vv,bname) or "" - if not instance.allresults then break end - end - end - end - end - return result -end - -function resolvers.find_given_file(filename) - return (resolvers.find_given_files(filename)[1] or "") -end - -local function doit(path,blist,bname,tag,kind,result,allresults) - local done = false - if blist and kind then - if type(blist) == 'string' then - -- make function and share code - if find(lower(blist),path) then - result[#result+1] = resolvers.concatinators[kind](tag,blist,bname) or "" - done = true - end - else - for kk=1,#blist do - local vv = blist[kk] - if find(lower(vv),path) then - result[#result+1] = resolvers.concatinators[kind](tag,vv,bname) or "" - done = true - if not allresults then break end - end - end - end - end - return done -end - -function resolvers.find_wildcard_files(filename) -- todo: remap: - local result = { } - local bname, dname = file.basename(filename), file.dirname(filename) - local path = gsub(dname,"^*/","") - path = gsub(path,"*",".*") - path = gsub(path,"-","%%-") - if dname == "" then - path = ".*" - end - local name = bname - name = gsub(name,"*",".*") - name = gsub(name,"-","%%-") - path = lower(path) - name = lower(name) - local files, allresults, done = instance.files, instance.allresults, false - if find(name,"%*") then - local hashes = instance.hashes - for k=1,#hashes do - local hash = hashes[k] - local tag, kind = hash.tag, hash.type - for kk, hh in next, files[hash.tag] do - if not find(kk,"^remap:") then - if find(lower(kk),name) then - if doit(path,hh,kk,tag,kind,result,allresults) then done = true end - if done and not allresults then break end - end - end - end - end - else - local hashes = instance.hashes - for k=1,#hashes do - local hash = hashes[k] - local tag, kind = hash.tag, hash.type - if doit(path,files[tag][bname],bname,tag,kind,result,allresults) then done = true end - if done and not allresults then break end - end - end - -- we can consider also searching the paths not in the database, but then - -- we end up with a messy search (all // in all path specs) - return result -end - -function resolvers.find_wildcard_file(filename) - return (resolvers.find_wildcard_files(filename)[1] or "") -end - --- main user functions - -function resolvers.automount() - -- implemented later -end - -function resolvers.load(option) - statistics.starttiming(instance) - resolvers.resetconfig() - resolvers.identify_cnf() - resolvers.load_lua() -- will become the new method - resolvers.expand_variables() - resolvers.load_cnf() -- will be skipped when we have a lua file - resolvers.expand_variables() - if option ~= "nofiles" then - resolvers.load_hash() - resolvers.automount() - end - statistics.stoptiming(instance) -end - -function resolvers.for_files(command, files, filetype, mustexist) - if files and #files > 0 then - local function report(str) - if trace_locating then - logs.report("fileio",str) -- has already verbose - else - print(str) - end - end - if trace_locating then - report('') -- ? - end - for f=1,#files do - local file = files[f] - local result = command(file,filetype,mustexist) - if type(result) == 'string' then - report(result) - else - for i=1,#result do - report(result[i]) -- could be unpack - end - end - end - end -end - --- strtab - -resolvers.var_value = resolvers.variable -- output the value of variable $STRING. -resolvers.expand_var = resolvers.expansion -- output variable expansion of STRING. - -function resolvers.show_path(str) -- output search path for file type NAME - return file.join_path(resolvers.expanded_path_list(resolvers.format_of_var(str))) -end - --- resolvers.find_file(filename) --- resolvers.find_file(filename, filetype, mustexist) --- resolvers.find_file(filename, mustexist) --- resolvers.find_file(filename, filetype) - -function resolvers.register_file(files, name, path) - if files[name] then - if type(files[name]) == 'string' then - files[name] = { files[name], path } - else - files[name] = path - end - else - files[name] = path - end -end - -function resolvers.splitmethod(filename) - if not filename then - return { } -- safeguard - elseif type(filename) == "table" then - return filename -- already split - elseif not find(filename,"://") then - return { scheme="file", path = filename, original=filename } -- quick hack - else - return url.hashed(filename) - end -end - -function table.sequenced(t,sep) -- temp here - local s = { } - for k, v in next, t do -- indexed? - s[#s+1] = k .. "=" .. tostring(v) - end - return concat(s, sep or " | ") -end - -function resolvers.methodhandler(what, filename, filetype) -- ... - filename = file.collapse_path(filename) - local specification = (type(filename) == "string" and resolvers.splitmethod(filename)) or filename -- no or { }, let it bomb - local scheme = specification.scheme - if resolvers[what][scheme] then - if trace_locating then - logs.report("fileio","handler '%s' -> '%s' -> '%s'",specification.original,what,table.sequenced(specification)) - end - return resolvers[what][scheme](filename,filetype) -- todo: specification - else - return resolvers[what].tex(filename,filetype) -- todo: specification - end -end - -function resolvers.clean_path(str) - if str then - str = gsub(str,"\\","/") - str = gsub(str,"^!+","") - str = gsub(str,"^~",resolvers.homedir) - return str - else - return nil - end -end - -function resolvers.do_with_path(name,func) - local pathlist = resolvers.expanded_path_list(name) - for i=1,#pathlist do - func("^"..resolvers.clean_path(pathlist[i])) - end -end - -function resolvers.do_with_var(name,func) - func(expanded_var(name)) -end - -function resolvers.with_files(pattern,handle) - local hashes = instance.hashes - for i=1,#hashes do - local hash = hashes[i] - local blobpath = hash.tag - local blobtype = hash.type - if blobpath then - local files = instance.files[blobpath] - if files then - for k,v in next, files do - if find(k,"^remap:") then - k = files[k] - v = files[k] -- chained - end - if find(k,pattern) then - if type(v) == "string" then - handle(blobtype,blobpath,v,k) - else - for _,vv in next, v do -- indexed - handle(blobtype,blobpath,vv,k) - end - end - end - end - end - end - end -end - -function resolvers.locate_format(name) - local barename, fmtname = gsub(name,"%.%a+$",""), "" - if resolvers.usecache then - local path = file.join(caches.setpath("formats")) -- maybe platform - fmtname = file.join(path,barename..".fmt") or "" - end - if fmtname == "" then - fmtname = resolvers.find_files(barename..".fmt")[1] or "" - end - fmtname = resolvers.clean_path(fmtname) - if fmtname ~= "" then - local barename = file.removesuffix(fmtname) - local luaname, lucname, luiname = barename .. ".lua", barename .. ".luc", barename .. ".lui" - if lfs.isfile(luiname) then - return barename, luiname - elseif lfs.isfile(lucname) then - return barename, lucname - elseif lfs.isfile(luaname) then - return barename, luaname - end - end - return nil, nil -end - -function resolvers.boolean_variable(str,default) - local b = resolvers.expansion(str) - if b == "" then - return default - else - b = toboolean(b) - return (b == nil and default) or b - end -end - -texconfig.kpse_init = false - -kpse = { original = kpse } setmetatable(kpse, { __index = function(k,v) return resolvers[v] end } ) - --- for a while - -input = resolvers - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['data-tmp'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - ---[[ldx-- -

This module deals with caching data. It sets up the paths and -implements loaders and savers for tables. Best is to set the -following variable. When not set, the usual paths will be -checked. Personally I prefer the (users) temporary path.

- - -TEXMFCACHE=$TMP;$TEMP;$TMPDIR;$TEMPDIR;$HOME;$TEXMFVAR;$VARTEXMF;. - - -

Currently we do no locking when we write files. This is no real -problem because most caching involves fonts and the chance of them -being written at the same time is small. We also need to extend -luatools with a recache feature.

---ldx]]-- - -local format, lower, gsub = string.format, string.lower, string.gsub - -local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) -- not used yet - -caches = caches or { } - -caches.path = caches.path or nil -caches.base = caches.base or "luatex-cache" -caches.more = caches.more or "context" -caches.direct = false -- true is faster but may need huge amounts of memory -caches.tree = false -caches.paths = caches.paths or nil -caches.force = true -- changed for TEXLIVE by TH -caches.defaults = { "TEXMFCACHE", "TMPDIR", "TEMPDIR", "TMP", "TEMP", "HOME", "HOMEPATH" } - -function caches.temp() - local cachepath = nil - local function check(list,isenv) - if not cachepath then - for k=1,#list do - local v = list[k] - cachepath = (isenv and (os.env[v] or "")) or v or "" - if cachepath == "" then - -- next - else - cachepath = resolvers.clean_path(cachepath) - if lfs.isdir(cachepath) and file.iswritable(cachepath) then -- lfs.attributes(cachepath,"mode") == "directory" - break - elseif caches.force or io.ask(format("\nShould I create the cache path %s?",cachepath), "no", { "yes", "no" }) == "yes" then - dir.mkdirs(cachepath) - if lfs.isdir(cachepath) and file.iswritable(cachepath) then - break - end - end - end - cachepath = nil - end - end - end - check(resolvers.clean_path_list("TEXMFCACHE") or { }) - check(caches.defaults,true) - if not cachepath then - print("\nfatal error: there is no valid (writable) cache path defined\n") - os.exit() - elseif not lfs.isdir(cachepath) then -- lfs.attributes(cachepath,"mode") ~= "directory" - print(format("\nfatal error: cache path %s is not a directory\n",cachepath)) - os.exit() - end - cachepath = file.collapse_path(cachepath) - function caches.temp() - return cachepath - end - return cachepath -end - -function caches.configpath() - return table.concat(resolvers.instance.cnffiles,";") -end - -function caches.hashed(tree) - return md5.hex(gsub(lower(tree),"[\\\/]+","/")) -end - -function caches.treehash() - local tree = caches.configpath() - if not tree or tree == "" then - return false - else - return caches.hashed(tree) - end -end - -function caches.setpath(...) - if not caches.path then - if not caches.path then - caches.path = caches.temp() - end - caches.path = resolvers.clean_path(caches.path) -- to be sure - caches.tree = caches.tree or caches.treehash() - if caches.tree then - caches.path = dir.mkdirs(caches.path,caches.base,caches.more,caches.tree) - else - caches.path = dir.mkdirs(caches.path,caches.base,caches.more) - end - end - if not caches.path then - caches.path = '.' - end - caches.path = resolvers.clean_path(caches.path) - local dirs = { ... } - if #dirs > 0 then - local pth = dir.mkdirs(caches.path,...) - return pth - end - caches.path = dir.expand_name(caches.path) - return caches.path -end - -function caches.definepath(category,subcategory) - return function() - return caches.setpath(category,subcategory) - end -end - -function caches.setluanames(path,name) - return path .. "/" .. name .. ".tma", path .. "/" .. name .. ".tmc" -end - -function caches.loaddata(path,name) - local tmaname, tmcname = caches.setluanames(path,name) - local loader = loadfile(tmcname) or loadfile(tmaname) - if loader then - loader = loader() - collectgarbage("step") - return loader - else - return false - end -end - ---~ function caches.loaddata(path,name) ---~ local tmaname, tmcname = caches.setluanames(path,name) ---~ return dofile(tmcname) or dofile(tmaname) ---~ end - -function caches.iswritable(filepath,filename) - local tmaname, tmcname = caches.setluanames(filepath,filename) - return file.iswritable(tmaname) -end - -function caches.savedata(filepath,filename,data,raw) - local tmaname, tmcname = caches.setluanames(filepath,filename) - local reduce, simplify = true, true - if raw then - reduce, simplify = false, false - end - data.cache_uuid = os.uuid() - if caches.direct then - file.savedata(tmaname, table.serialize(data,'return',false,true,false)) -- no hex - else - table.tofile(tmaname, data,'return',false,true,false) -- maybe not the last true - end - local cleanup = resolvers.boolean_variable("PURGECACHE", false) - local strip = resolvers.boolean_variable("LUACSTRIP", true) - utils.lua.compile(tmaname, tmcname, cleanup, strip) -end - --- here we use the cache for format loading (texconfig.[formatname|jobname]) - ---~ if tex and texconfig and texconfig.formatname and texconfig.formatname == "" then -if tex and texconfig and (not texconfig.formatname or texconfig.formatname == "") and input and resolvers.instance then - if not texconfig.luaname then texconfig.luaname = "cont-en.lua" end -- or luc - texconfig.formatname = caches.setpath("formats") .. "/" .. gsub(texconfig.luaname,"%.lu.$",".fmt") -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['data-inp'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -resolvers.finders = resolvers.finders or { } -resolvers.openers = resolvers.openers or { } -resolvers.loaders = resolvers.loaders or { } - -resolvers.finders.notfound = { nil } -resolvers.openers.notfound = { nil } -resolvers.loaders.notfound = { false, nil, 0 } - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['data-out'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -outputs = outputs or { } - - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['data-con'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local format, lower, gsub = string.format, string.lower, string.gsub - -local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) -local trace_containers = false trackers.register("resolvers.containers", function(v) trace_containers = v end) -local trace_storage = false trackers.register("resolvers.storage", function(v) trace_storage = v end) - ---[[ldx-- -

Once we found ourselves defining similar cache constructs -several times, containers were introduced. Containers are used -to collect tables in memory and reuse them when possible based -on (unique) hashes (to be provided by the calling function).

- -

Caching to disk is disabled by default. Version numbers are -stored in the saved table which makes it possible to change the -table structures without bothering about the disk cache.

- -

Examples of usage can be found in the font related code.

---ldx]]-- - -containers = containers or { } - -containers.usecache = true - -local function report(container,tag,name) - if trace_cache or trace_containers then - logs.report(format("%s cache",container.subcategory),"%s: %s",tag,name or 'invalid') - end -end - -local allocated = { } - --- tracing - -function containers.define(category, subcategory, version, enabled) - return function() - if category and subcategory then - local c = allocated[category] - if not c then - c = { } - allocated[category] = c - end - local s = c[subcategory] - if not s then - s = { - category = category, - subcategory = subcategory, - storage = { }, - enabled = enabled, - version = version or 1.000, - trace = false, - path = caches and caches.setpath and caches.setpath(category,subcategory), - } - c[subcategory] = s - end - return s - else - return nil - end - end -end - -function containers.is_usable(container, name) - return container.enabled and caches and caches.iswritable(container.path, name) -end - -function containers.is_valid(container, name) - if name and name ~= "" then - local storage = container.storage[name] - return storage and storage.cache_version == container.version - else - return false - end -end - -function containers.read(container,name) - if container.enabled and caches and not container.storage[name] and containers.usecache then - container.storage[name] = caches.loaddata(container.path,name) - if containers.is_valid(container,name) then - report(container,"loaded",name) - else - container.storage[name] = nil - end - end - if container.storage[name] then - report(container,"reusing",name) - end - return container.storage[name] -end - -function containers.write(container, name, data) - if data then - data.cache_version = container.version - if container.enabled and caches then - local unique, shared = data.unique, data.shared - data.unique, data.shared = nil, nil - caches.savedata(container.path, name, data) - report(container,"saved",name) - data.unique, data.shared = unique, shared - end - report(container,"stored",name) - container.storage[name] = data - end - return data -end - -function containers.content(container,name) - return container.storage[name] -end - -function containers.cleanname(name) - return (gsub(lower(name),"[^%w%d]+","-")) -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['data-use'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local format, lower, gsub, find = string.format, string.lower, string.gsub, string.find - -local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) - --- since we want to use the cache instead of the tree, we will now --- reimplement the saver. - -local save_data = resolvers.save_data -local load_data = resolvers.load_data - -resolvers.cachepath = nil -- public, for tracing -resolvers.usecache = true -- public, for tracing - -function resolvers.save_data(dataname) - save_data(dataname, function(cachename,dataname) - resolvers.usecache = not toboolean(resolvers.expansion("CACHEINTDS") or "false",true) - if resolvers.usecache then - resolvers.cachepath = resolvers.cachepath or caches.definepath("trees") - return file.join(resolvers.cachepath(),caches.hashed(cachename)) - else - return file.join(cachename,dataname) - end - end) -end - -function resolvers.load_data(pathname,dataname,filename) - load_data(pathname,dataname,filename,function(dataname,filename) - resolvers.usecache = not toboolean(resolvers.expansion("CACHEINTDS") or "false",true) - if resolvers.usecache then - resolvers.cachepath = resolvers.cachepath or caches.definepath("trees") - return file.join(resolvers.cachepath(),caches.hashed(pathname)) - else - if not filename or (filename == "") then - filename = dataname - end - return file.join(pathname,filename) - end - end) -end - --- we will make a better format, maybe something xml or just text or lua - -resolvers.automounted = resolvers.automounted or { } - -function resolvers.automount(usecache) - local mountpaths = resolvers.clean_path_list(resolvers.expansion('TEXMFMOUNT')) - if (not mountpaths or #mountpaths == 0) and usecache then - mountpaths = { caches.setpath("mount") } - end - if mountpaths and #mountpaths > 0 then - statistics.starttiming(resolvers.instance) - for k=1,#mountpaths do - local root = mountpaths[k] - local f = io.open(root.."/url.tmi") - if f then - for line in f:lines() do - if line then - if find(line,"^[%%#%-]") then -- or %W - -- skip - elseif find(line,"^zip://") then - if trace_locating then - logs.report("fileio","mounting %s",line) - end - table.insert(resolvers.automounted,line) - resolvers.usezipfile(line) - end - end - end - f:close() - end - end - statistics.stoptiming(resolvers.instance) - end -end - --- status info - -statistics.register("used config path", function() return caches.configpath() end) -statistics.register("used cache path", function() return caches.temp() or "?" end) - --- experiment (code will move) - -function statistics.save_fmt_status(texname,formatbanner,sourcefile) -- texname == formatname - local enginebanner = status.list().banner - if formatbanner and enginebanner and sourcefile then - local luvname = file.replacesuffix(texname,"luv") - local luvdata = { - enginebanner = enginebanner, - formatbanner = formatbanner, - sourcehash = md5.hex(io.loaddata(resolvers.find_file(sourcefile)) or "unknown"), - sourcefile = sourcefile, - } - io.savedata(luvname,table.serialize(luvdata,true)) - end -end - -function statistics.check_fmt_status(texname) - local enginebanner = status.list().banner - if enginebanner and texname then - local luvname = file.replacesuffix(texname,"luv") - if lfs.isfile(luvname) then - local luv = dofile(luvname) - if luv and luv.sourcefile then - local sourcehash = md5.hex(io.loaddata(resolvers.find_file(luv.sourcefile)) or "unknown") - local luvbanner = luv.enginebanner or "?" - if luvbanner ~= enginebanner then - return string.format("engine mismatch (luv:%s <> bin:%s)",luvbanner,enginebanner) - end - local luvhash = luv.sourcehash or "?" - if luvhash ~= sourcehash then - return string.format("source mismatch (luv:%s <> bin:%s)",luvhash,sourcehash) - end - else - return "invalid status file" - end - else - return "missing status file" - end - end - return true -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['luat-kps'] = { - version = 1.001, - comment = "companion to luatools.lua", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - ---[[ldx-- -

This file is used when we want the input handlers to behave like -kpsewhich. What to do with the following:

- - -{$SELFAUTOLOC,$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c} -$SELFAUTOLOC : /usr/tex/bin/platform -$SELFAUTODIR : /usr/tex/bin -$SELFAUTOPARENT : /usr/tex - - -

How about just forgetting about them?

---ldx]]-- - -local suffixes = resolvers.suffixes -local formats = resolvers.formats - -suffixes['gf'] = { 'gf' } -suffixes['pk'] = { 'pk' } -suffixes['base'] = { 'base' } -suffixes['bib'] = { 'bib' } -suffixes['bst'] = { 'bst' } -suffixes['cnf'] = { 'cnf' } -suffixes['mem'] = { 'mem' } -suffixes['mf'] = { 'mf' } -suffixes['mfpool'] = { 'pool' } -suffixes['mft'] = { 'mft' } -suffixes['mppool'] = { 'pool' } -suffixes['graphic/figure'] = { 'eps', 'epsi' } -suffixes['texpool'] = { 'pool' } -suffixes['PostScript header'] = { 'pro' } -suffixes['ist'] = { 'ist' } -suffixes['web'] = { 'web', 'ch' } -suffixes['cweb'] = { 'w', 'web', 'ch' } -suffixes['cmap files'] = { 'cmap' } -suffixes['lig files'] = { 'lig' } -suffixes['bitmap font'] = { } -suffixes['MetaPost support'] = { } -suffixes['TeX system documentation'] = { } -suffixes['TeX system sources'] = { } -suffixes['dvips config'] = { } -suffixes['type42 fonts'] = { } -suffixes['web2c files'] = { } -suffixes['other text files'] = { } -suffixes['other binary files'] = { } -suffixes['opentype fonts'] = { 'otf' } - -suffixes['fmt'] = { 'fmt' } -suffixes['texmfscripts'] = { 'rb','lua','py','pl' } - -suffixes['pdftex config'] = { } -suffixes['Troff fonts'] = { } - -suffixes['ls-R'] = { } - ---[[ldx-- -

If you wondered abou tsome of the previous mappings, how about -the next bunch:

---ldx]]-- - -formats['bib'] = '' -formats['bst'] = '' -formats['mft'] = '' -formats['ist'] = '' -formats['web'] = '' -formats['cweb'] = '' -formats['MetaPost support'] = '' -formats['TeX system documentation'] = '' -formats['TeX system sources'] = '' -formats['Troff fonts'] = '' -formats['dvips config'] = '' -formats['graphic/figure'] = '' -formats['ls-R'] = '' -formats['other text files'] = '' -formats['other binary files'] = '' - -formats['gf'] = '' -formats['pk'] = '' -formats['base'] = 'MFBASES' -formats['cnf'] = '' -formats['mem'] = 'MPMEMS' -formats['mf'] = 'MFINPUTS' -formats['mfpool'] = 'MFPOOL' -formats['mppool'] = 'MPPOOL' -formats['texpool'] = 'TEXPOOL' -formats['PostScript header'] = 'TEXPSHEADERS' -formats['cmap files'] = 'CMAPFONTS' -formats['type42 fonts'] = 'T42FONTS' -formats['web2c files'] = 'WEB2C' -formats['pdftex config'] = 'PDFTEXCONFIG' -formats['texmfscripts'] = 'TEXMFSCRIPTS' -formats['bitmap font'] = '' -formats['lig files'] = 'LIGFONTS' - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['data-aux'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local find = string.find - -local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) - -function resolvers.update_script(oldname,newname) -- oldname -> own.name, not per se a suffix - local scriptpath = "scripts/context/lua" - newname = file.addsuffix(newname,"lua") - local oldscript = resolvers.clean_path(oldname) - if trace_locating then - logs.report("fileio","to be replaced old script %s", oldscript) - end - local newscripts = resolvers.find_files(newname) or { } - if #newscripts == 0 then - if trace_locating then - logs.report("fileio","unable to locate new script") - end - else - for i=1,#newscripts do - local newscript = resolvers.clean_path(newscripts[i]) - if trace_locating then - logs.report("fileio","checking new script %s", newscript) - end - if oldscript == newscript then - if trace_locating then - logs.report("fileio","old and new script are the same") - end - elseif not find(newscript,scriptpath) then - if trace_locating then - logs.report("fileio","new script should come from %s",scriptpath) - end - elseif not (find(oldscript,file.removesuffix(newname).."$") or find(oldscript,newname.."$")) then - if trace_locating then - logs.report("fileio","invalid new script name") - end - else - local newdata = io.loaddata(newscript) - if newdata then - if trace_locating then - logs.report("fileio","old script content replaced by new content") - end - io.savedata(oldscript,newdata) - break - elseif trace_locating then - logs.report("fileio","unable to load new script") - end - end - end - end -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['data-lst'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- used in mtxrun - -local find, concat, upper, format = string.find, table.concat, string.upper, string.format - -resolvers.listers = resolvers.listers or { } - -local function tabstr(str) - if type(str) == 'table' then - return concat(str," | ") - else - return str - end -end - -local function list(list,report) - local instance = resolvers.instance - local pat = upper(pattern or "","") - local report = report or texio.write_nl - local sorted = table.sortedkeys(list) - for i=1,#sorted do - local key = sorted[i] - if instance.pattern == "" or find(upper(key),pat) then - if instance.kpseonly then - if instance.kpsevars[key] then - report(format("%s=%s",key,tabstr(list[key]))) - end - else - report(format('%s %s=%s',(instance.kpsevars[key] and 'K') or 'E',key,tabstr(list[key]))) - end - end - end -end - -function resolvers.listers.variables () list(resolvers.instance.variables ) end -function resolvers.listers.expansions() list(resolvers.instance.expansions) end - -function resolvers.listers.configurations(report) - local report = report or texio.write_nl - local instance = resolvers.instance - local sorted = table.sortedkeys(instance.kpsevars) - for i=1,#sorted do - local key = sorted[i] - if not instance.pattern or (instance.pattern=="") or find(key,instance.pattern) then - report(format("%s\n",key)) - local order = instance.order - for i=1,#order do - local str = order[i][key] - if str then - report(format("\t%s\t%s",i,str)) - end - end - report("") - end - end -end - - -end -- of closure --- end library merge - --- We initialize some characteristics of this program. We need to --- do this before we load the libraries, else own.name will not be --- properly set (handy for selfcleaning the file). It's an ugly --- looking piece of code. - -own = { } - -own.libs = { -- todo: check which ones are really needed - 'l-string.lua', - 'l-lpeg.lua', - 'l-table.lua', - 'l-io.lua', - 'l-number.lua', - 'l-set.lua', - 'l-os.lua', - 'l-file.lua', - 'l-md5.lua', - 'l-url.lua', - 'l-dir.lua', - 'l-boolean.lua', - 'l-unicode.lua', - 'l-math.lua', - 'l-utils.lua', - 'l-aux.lua', - 'trac-tra.lua', - 'luat-env.lua', - 'trac-inf.lua', - 'trac-log.lua', - 'data-res.lua', - 'data-tmp.lua', --- 'data-pre.lua', - 'data-inp.lua', - 'data-out.lua', - 'data-con.lua', - 'data-use.lua', --- 'data-tex.lua', --- 'data-bin.lua', --- 'data-zip.lua', --- 'data-crl.lua', --- 'data-lua.lua', - 'data-kps.lua', -- so that we can replace kpsewhich - 'data-aux.lua', -- updater - 'data-lst.lua', -- lister -} - --- We need this hack till luatex is fixed. - -if arg and arg[0] == 'luatex' and arg[1] == "--luaonly" then - arg[-1]=arg[0] arg[0]=arg[2] for k=3,#arg do arg[k-2]=arg[k] end arg[#arg]=nil arg[#arg]=nil -end - --- End of hack. - -own.name = (environment and environment.ownname) or arg[0] or 'luatools.lua' -own.path = string.match(own.name,"^(.+)[\\/].-$") or "." -own.list = { '.' } - -if own.path ~= '.' then - table.insert(own.list,own.path) -end - -table.insert(own.list,own.path.."/../../texmf-dist/tex/context/base") -table.insert(own.list,own.path.."/../../../tex/context/base") -table.insert(own.list,own.path.."/mtx") -table.insert(own.list,own.path.."/../sources") - -function locate_libs() - for _, lib in pairs(own.libs) do - for _, pth in pairs(own.list) do - local filename = string.gsub(pth .. "/" .. lib,"\\","/") - local codeblob = loadfile(filename) - if codeblob then - codeblob() - own.list = { pth } -- speed up te search - break - end - end - end -end - -if not resolvers then - locate_libs() -end - -if not resolvers then - print("") - print("Luatools is unable to start up due to lack of libraries. You may") - print("try to run 'lua luatools.lua --selfmerge' in the path where this") - print("script is located (normally under ..../scripts/context/lua) which") - print("will make luatools library independent.") - os.exit() -end - -logs.setprogram('LuaTools',"TDS Management Tool 1.32",environment.arguments["verbose"] or false) - -local instance = resolvers.reset() - -resolvers.defaultlibs = { -- not all are needed (this will become: context.lus (lua spec) - 'l-string.lua', - 'l-lpeg.lua', - 'l-table.lua', - 'l-boolean.lua', - 'l-number.lua', - 'l-unicode.lua', - 'l-os.lua', - 'l-io.lua', - 'l-file.lua', - 'l-md5.lua', - 'l-url.lua', - 'l-dir.lua', - 'l-utils.lua', - 'l-dimen.lua', - 'trac-inf.lua', - 'trac-tra.lua', - 'trac-log.lua', - 'luat-env.lua', -- here ? - 'data-res.lua', - 'data-inp.lua', - 'data-out.lua', - 'data-tmp.lua', - 'data-con.lua', - 'data-use.lua', --- 'data-pre.lua', - 'data-tex.lua', - 'data-bin.lua', --- 'data-zip.lua', --- 'data-clr.lua', - 'data-lua.lua', - 'data-ctx.lua', - 'luat-fio.lua', - 'luat-cnf.lua', -} - -instance.engine = environment.arguments["engine"] or 'luatex' -instance.progname = environment.arguments["progname"] or 'context' -instance.luaname = environment.arguments["luafile"] or "" -- environment.ownname or "" -instance.lualibs = environment.arguments["lualibs"] or table.concat(resolvers.defaultlibs,",") -instance.allresults = environment.arguments["all"] or false -instance.pattern = environment.arguments["pattern"] or nil -instance.sortdata = environment.arguments["sort"] or false -instance.kpseonly = not environment.arguments["all"] or false -instance.my_format = environment.arguments["format"] or instance.format - -if type(instance.pattern) == 'boolean' then - logs.simple("invalid pattern specification") - instance.pattern = nil -end - -if environment.arguments["trace"] then resolvers.settrace(environment.arguments["trace"]) end - -local trackspec = environment.argument("trackers") or environment.argument("track") - -if trackspec then - trackers.enable(trackspec) -end - -runners = runners or { } -messages = messages or { } - -messages.no_ini_file = [[ -There is no lua initialization file found. This file can be forced by the -"--progname" directive, or specified with "--luaname", or it is derived -automatically from the formatname (aka jobname). It may be that you have -to regenerate the file database using "luatools --generate". -]] - -messages.help = [[ ---generate generate file database ---variables show configuration variables ---expansions show expanded variables ---configurations show configuration order ---expand-braces expand complex variable ---expand-path expand variable (resolve paths) ---expand-var expand variable (resolve references) ---show-path show path expansion of ... ---var-value report value of variable ---find-file report file location ---find-path report path of file ---make or --ini make luatex format ---run or --fmt= run luatex format ---luafile=str lua inifile (default is .lua) ---lualibs=list libraries to assemble (optional when --compile) ---compile assemble and compile lua inifile ---verbose give a bit more info ---all show all found files ---sort sort cached data ---engine=str target engine ---progname=str format or backend ---pattern=str filter variables ---trackers=list enable given trackers -]] - -function runners.make_format(texname) - local instance = resolvers.instance - if texname and texname ~= "" then - if resolvers.usecache then - local path = file.join(caches.setpath("formats")) -- maybe platform - if path and lfs then - lfs.chdir(path) - end - end - local barename = texname:gsub("%.%a+$","") - if barename == texname then - texname = texname .. ".tex" - end - local fullname = resolvers.find_files(texname)[1] or "" - if fullname == "" then - logs.simple("no tex file with name: %s",texname) - else - local luaname, lucname, luapath, lualibs = "", "", "", { } - -- the following is optional, since context.lua can also - -- handle this collect and compile business - if environment.arguments["compile"] then - if luaname == "" then luaname = barename end - logs.simple("creating initialization file: %s",luaname) - luapath = file.dirname(luaname) - if luapath == "" then - luapath = file.dirname(texname) - end - if luapath == "" then - luapath = file.dirname(resolvers.find_files(texname)[1] or "") - end - lualibs = string.split(instance.lualibs,",") - luaname = file.basename(barename .. ".lua") - lucname = file.basename(barename .. ".luc") - -- todo: when this fails, we can just copy the merged libraries from - -- luatools since they are normally the same, at least for context - if lualibs[1] then - local firstlib = file.join(luapath,lualibs[1]) - if not lfs.isfile(firstlib) then - local foundname = resolvers.find_files(lualibs[1])[1] - if foundname then - logs.simple("located library path: %s",luapath) - luapath = file.dirname(foundname) - end - end - end - logs.simple("using library path: %s",luapath) - logs.simple("using lua libraries: %s",table.join(lualibs," ")) - utils.merger.selfcreate(lualibs,luapath,luaname) - local strip = resolvers.boolean_variable("LUACSTRIP", true) - if utils.lua.compile(luaname,lucname,false,strip) and io.exists(lucname) then - luaname = lucname - logs.simple("using compiled initialization file: %s",lucname) - else - logs.simple("using uncompiled initialization file: %s",luaname) - end - else - local what = { instance.luaname, instance.progname, barename } - for k=1,#what do - local v = string.gsub(what[k]..".lua","%.lua%.lua$",".lua") - if v and (v ~= "") then - luaname = resolvers.find_files(v)[1] or "" - if luaname ~= "" then - break - end - end - end - end - if environment.arguments["noluc"] then - luaname = luaname:gsub("%.luc$",".lua") -- make this an option - end - if luaname == "" then - if logs.verbose then - logs.simplelines(messages.no_ini_file) - logs.simple("texname : %s",texname) - logs.simple("luaname : %s",instance.luaname) - logs.simple("progname: %s",instance.progname) - logs.simple("barename: %s",barename) - end - else - logs.simple("using lua initialization file: %s",luaname) - local mp = dir.glob(file.removesuffix(file.basename(luaname)).."-*.mem") - if mp and #mp > 0 then - for i=1,#mp do - local name = mp[i] - logs.simple("removing related mplib format %s", file.basename(name)) - os.remove(name) - end - end - local flags = { - "--ini", - "--lua=" .. string.quote(luaname) - } - local bs = (os.platform == "unix" and "\\\\") or "\\" -- todo: make a function - local command = "luatex ".. table.concat(flags," ") .. " " .. string.quote(fullname) .. " " .. bs .. "dump" - logs.simple("running command: %s\n",command) - os.spawn(command) - -- todo: do a dummy run that generates the related metafun and mfplain formats - end - end - else - logs.simple("no tex file given") - end -end - -function runners.run_format(name,data,more) - -- hm, rather old code here; we can now use the file.whatever functions - if name and (name ~= "") then - local barename = name:gsub("%.%a+$","") - local fmtname = "" - if resolvers.usecache then - local path = file.join(caches.setpath("formats")) -- maybe platform - fmtname = file.join(path,barename..".fmt") or "" - end - if fmtname == "" then - fmtname = resolvers.find_files(barename..".fmt")[1] or "" - end - fmtname = resolvers.clean_path(fmtname) - barename = fmtname:gsub("%.%a+$","") - if fmtname == "" then - logs.simple("no format with name: %s",name) - else - local luaname = barename .. ".luc" - local f = io.open(luaname) - if not f then - luaname = barename .. ".lua" - f = io.open(luaname) - end - if f then - f:close() - local command = "luatex --fmt=" .. string.quote(barename) .. " --lua=" .. string.quote(luaname) .. " " .. string.quote(data) .. " " .. (more ~= "" and string.quote(more) or "") - logs.simple("running command: %s",command) - os.spawn(command) - else - logs.simple("using format name: %s",fmtname) - logs.simple("no luc/lua with name: %s",barename) - end - end - end -end - -local ok = true - --- private option --noluc for testing errors in the stub - -if environment.arguments["find-file"] then - resolvers.load() - instance.format = environment.arguments["format"] or instance.format - if instance.pattern then - instance.allresults = true - resolvers.for_files(resolvers.find_files, { instance.pattern }, instance.my_format) - else - resolvers.for_files(resolvers.find_files, environment.files, instance.my_format) - end -elseif environment.arguments["find-path"] then - resolvers.load() - local path = resolvers.find_file(environment.files[1], instance.my_format) - if logs.verbose then - logs.simple(file.dirname(path)) - else - print(file.dirname(path)) - end -elseif environment.arguments["run"] then - resolvers.load("nofiles") -- ! no need for loading databases - logs.setverbose(true) - runners.run_format(environment.files[1] or "",environment.files[2] or "",environment.files[3] or "") -elseif environment.arguments["fmt"] then - resolvers.load("nofiles") -- ! no need for loading databases - logs.setverbose(true) - runners.run_format(environment.arguments["fmt"], environment.files[1] or "",environment.files[2] or "") -elseif environment.arguments["expand-braces"] then - resolvers.load("nofiles") - resolvers.for_files(resolvers.expand_braces, environment.files) -elseif environment.arguments["expand-path"] then - resolvers.load("nofiles") - resolvers.for_files(resolvers.expand_path, environment.files) -elseif environment.arguments["expand-var"] or environment.arguments["expand-variable"] then - resolvers.load("nofiles") - resolvers.for_files(resolvers.expand_var, environment.files) -elseif environment.arguments["show-path"] or environment.arguments["path-value"] then - resolvers.load("nofiles") - resolvers.for_files(resolvers.show_path, environment.files) -elseif environment.arguments["var-value"] or environment.arguments["show-value"] then - resolvers.load("nofiles") - resolvers.for_files(resolvers.var_value, environment.files) -elseif environment.arguments["format-path"] then - resolvers.load() - logs.simple(caches.setpath("format")) -elseif instance.pattern then -- brrr - resolvers.load() - instance.format = environment.arguments["format"] or instance.format - instance.allresults = true - resolvers.for_files(resolvers.find_files, { instance.pattern }, instance.my_format) -elseif environment.arguments["generate"] then - instance.renewcache = true - logs.setverbose(true) - resolvers.load() -elseif environment.arguments["make"] or environment.arguments["ini"] or environment.arguments["compile"] then - resolvers.load() - logs.setverbose(true) - runners.make_format(environment.files[1] or "") -elseif environment.arguments["selfmerge"] then - utils.merger.selfmerge(own.name,own.libs,own.list) -elseif environment.arguments["selfclean"] then - utils.merger.selfclean(own.name) -elseif environment.arguments["selfupdate"] then - resolvers.load() - logs.setverbose(true) - resolvers.update_script(own.name,"luatools") -elseif environment.arguments["variables"] or environment.arguments["show-variables"] then - resolvers.load("nofiles") - resolvers.listers.variables() -elseif environment.arguments["expansions"] or environment.arguments["show-expansions"] then - resolvers.load("nofiles") - resolvers.listers.expansions() -elseif environment.arguments["configurations"] or environment.arguments["show-configurations"] then - resolvers.load("nofiles") - resolvers.listers.configurations() -elseif environment.arguments["help"] or (environment.files[1]=='help') or (#environment.files==0) then - logs.help(messages.help) -else - resolvers.load() - resolvers.for_files(resolvers.find_files, environment.files, instance.my_format) -end - -if logs.verbose then - logs.simpleline() - logs.simple("runtime: %0.3f seconds",os.runtime()) -end - -if os.platform == "unix" then - io.write("\n") -end +#!/bin/sh +mtxrun --script base "$@" diff --git a/Build/source/texk/texlive/context/mtxrun b/Build/source/texk/texlive/context/mtxrun index 2bdd1b8f020..cc5ebb478ac 100755 --- a/Build/source/texk/texlive/context/mtxrun +++ b/Build/source/texk/texlive/context/mtxrun @@ -8,7 +8,6 @@ if not modules then modules = { } end modules ['mtxrun'] = { license = "see context related readme files" } - -- one can make a stub: -- -- #!/bin/sh @@ -38,8 +37,6 @@ if not modules then modules = { } end modules ['mtxrun'] = { -- remember for subruns: _CTX_K_S_#{original}_ -- remember for subruns: TEXMFSTART.#{original} [tex.rb texmfstart.rb] -texlua = true - -- begin library merge @@ -54,8 +51,9 @@ if not modules then modules = { } end modules ['l-string'] = { license = "see context related readme files" } +local string = string local sub, gsub, find, match, gmatch, format, char, byte, rep, lower = string.sub, string.gsub, string.find, string.match, string.gmatch, string.format, string.char, string.byte, string.rep, string.lower -local lpegmatch = lpeg.match +local lpegmatch, S, C, Ct = lpeg.match, lpeg.S, lpeg.C, lpeg.Ct -- some functions may disappear as they are not used anywhere @@ -63,196 +61,68 @@ if not string.split then -- this will be overloaded by a faster lpeg variant - function string:split(pattern) - if #self > 0 then - local t = { } - for s in gmatch(self..pattern,"(.-)"..pattern) do - t[#t+1] = s + function string.split(str,pattern) + local t = { } + if #str > 0 then + local n = 1 + for s in gmatch(str..pattern,"(.-)"..pattern) do + t[n] = s + n = n + 1 end - return t - else - return { } end + return t end end -local chr_to_esc = { - ["%"] = "%%", - ["."] = "%.", - ["+"] = "%+", ["-"] = "%-", ["*"] = "%*", - ["^"] = "%^", ["$"] = "%$", - ["["] = "%[", ["]"] = "%]", - ["("] = "%(", [")"] = "%)", - ["{"] = "%{", ["}"] = "%}" -} - -string.chr_to_esc = chr_to_esc - -function string:esc() -- variant 2 - return (gsub(self,"(.)",chr_to_esc)) -end - -function string:unquote() - return (gsub(self,"^([\"\'])(.*)%1$","%2")) +function string.unquoted(str) + return (gsub(str,"^([\"\'])(.*)%1$","%2")) end ---~ function string:unquote() ---~ if find(self,"^[\'\"]") then ---~ return sub(self,2,-2) ---~ else ---~ return self ---~ end ---~ end -function string:quote() -- we could use format("%q") - return format("%q",self) +function string.quoted(str) + return format("%q",str) -- always " end -function string:count(pattern) -- variant 3 +function string.count(str,pattern) -- variant 3 local n = 0 - for _ in gmatch(self,pattern) do + for _ in gmatch(str,pattern) do -- not for utf n = n + 1 end return n end -function string:limit(n,sentinel) - if #self > n then - sentinel = sentinel or " ..." - return sub(self,1,(n-#sentinel)) .. sentinel - else - return self - end -end - ---~ function string:strip() -- the .- is quite efficient ---~ -- return match(self,"^%s*(.-)%s*$") or "" ---~ -- return match(self,'^%s*(.*%S)') or '' -- posted on lua list ---~ return find(s,'^%s*$') and '' or match(s,'^%s*(.*%S)') ---~ end - -do -- roberto's variant: - local space = lpeg.S(" \t\v\n") - local nospace = 1 - space - local stripper = space^0 * lpeg.C((space^0 * nospace^1)^0) - function string.strip(str) - return lpegmatch(stripper,str) or "" - end -end - -function string:is_empty() - return not find(self,"%S") -end - -function string:enhance(pattern,action) - local ok, n = true, 0 - while ok do - ok = false - self = gsub(self,pattern, function(...) - ok, n = true, n + 1 - return action(...) - end) - end - return self, n -end - -local chr_to_hex, hex_to_chr = { }, { } - -for i=0,255 do - local c, h = char(i), format("%02X",i) - chr_to_hex[c], hex_to_chr[h] = h, c -end - -function string:to_hex() - return (gsub(self or "","(.)",chr_to_hex)) -end - -function string:from_hex() - return (gsub(self or "","(..)",hex_to_chr)) -end - -if not string.characters then - - local function nextchar(str, index) - index = index + 1 - return (index <= #str) and index or nil, sub(str,index,index) - end - function string:characters() - return nextchar, self, 0 - end - local function nextbyte(str, index) - index = index + 1 - return (index <= #str) and index or nil, byte(sub(str,index,index)) - end - function string:bytes() - return nextbyte, self, 0 - end - -end - --- we can use format for this (neg n) - -function string:rpadd(n,chr) - local m = n-#self - if m > 0 then - return self .. rep(chr or " ",m) +function string.limit(str,n,sentinel) -- not utf proof + if #str > n then + sentinel = sentinel or "..." + return sub(str,1,(n-#sentinel)) .. sentinel else - return self - end -end - -function string:lpadd(n,chr) - local m = n-#self - if m > 0 then - return rep(chr or " ",m) .. self - else - return self + return str end end -string.padd = string.rpadd +local space = S(" \t\v\n") +local nospace = 1 - space +local stripper = space^0 * C((space^0 * nospace^1)^0) -- roberto's code -function is_number(str) -- tonumber - return find(str,"^[%-%+]?[%d]-%.?[%d+]$") == 1 +function string.strip(str) + return lpegmatch(stripper,str) or "" end ---~ print(is_number("1")) ---~ print(is_number("1.1")) ---~ print(is_number(".1")) ---~ print(is_number("-0.1")) ---~ print(is_number("+0.1")) ---~ print(is_number("-.1")) ---~ print(is_number("+.1")) - -function string:split_settings() -- no {} handling, see l-aux for lpeg variant - if find(self,"=") then - local t = { } - for k,v in gmatch(self,"(%a+)=([^%,]*)") do - t[k] = v - end - return t - else - return nil - end +function string.is_empty(str) + return not find(str,"%S") end local patterns_escapes = { - ["-"] = "%-", - ["."] = "%.", - ["+"] = "%+", - ["*"] = "%*", ["%"] = "%%", - ["("] = "%)", - [")"] = "%)", - ["["] = "%[", - ["]"] = "%]", + ["."] = "%.", + ["+"] = "%+", ["-"] = "%-", ["*"] = "%*", + ["["] = "%[", ["]"] = "%]", + ["("] = "%(", [")"] = "%)", + -- ["{"] = "%{", ["}"] = "%}" + -- ["^"] = "%^", ["$"] = "%$", } -function string:pattesc() - return (gsub(self,".",patterns_escapes)) -end - local simple_escapes = { ["-"] = "%-", ["."] = "%.", @@ -260,80 +130,30 @@ local simple_escapes = { ["*"] = ".*", } -function string:simpleesc() - return (gsub(self,".",simple_escapes)) -end - -function string:tohash() - local t = { } - for s in gmatch(self,"([^, ]+)") do -- lpeg - t[s] = true - end - return t -end - -local pattern = lpeg.Ct(lpeg.C(1)^0) - -function string:totable() - return lpegmatch(pattern,self) +function string.escapedpattern(str,simple) + return (gsub(str,".",simple and simple_escapes or patterns_escapes)) end ---~ local t = { ---~ "1234567123456712345671234567", ---~ "a\tb\tc", ---~ "aa\tbb\tcc", ---~ "aaa\tbbb\tccc", ---~ "aaaa\tbbbb\tcccc", ---~ "aaaaa\tbbbbb\tccccc", ---~ "aaaaaa\tbbbbbb\tcccccc", ---~ } ---~ for k,v do ---~ print(string.tabtospace(t[k])) ---~ end - -function string.tabtospace(str,tab) - -- we don't handle embedded newlines - while true do - local s = find(str,"\t") - if s then - if not tab then tab = 7 end -- only when found - local d = tab-(s-1) % tab - if d > 0 then - str = gsub(str,"\t",rep(" ",d),1) - else - str = gsub(str,"\t","",1) - end +function string.topattern(str,lowercase,strict) + if str == "" then + return ".*" + else + str = gsub(str,".",simple_escapes) + if lowercase then + str = lower(str) + end + if strict then + return "^" .. str .. "$" else - break + return str end end - return str end -function string:compactlong() -- strips newlines and leading spaces - self = gsub(self,"[\n\r]+ *","") - self = gsub(self,"^ *","") - return self -end - -function string:striplong() -- strips newlines and leading spaces - self = gsub(self,"^%s*","") - self = gsub(self,"[\n\r]+ *","\n") - return self -end +-- obsolete names: -function string:topattern(lowercase,strict) - if lowercase then - self = lower(self) - end - self = gsub(self,".",simple_escapes) - if self == "" then - self = ".*" - elseif strict then - self = "^" .. self .. "$" - end - return self -end +string.quote = string.quoted +string.unquote = string.unquoted end -- of closure @@ -350,28 +170,75 @@ if not modules then modules = { } end modules ['l-lpeg'] = { local lpeg = require("lpeg") +local type = type + +-- Beware, we predefine a bunch of patterns here and one reason for doing so +-- is that we get consistent behaviour in some of the visualizers. + lpeg.patterns = lpeg.patterns or { } -- so that we can share local patterns = lpeg.patterns -local P, R, S, Ct, C, Cs, Cc, V = lpeg.P, lpeg.R, lpeg.S, lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.V -local match = lpeg.match +local P, R, S, V, match = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.match +local Ct, C, Cs, Cc = lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc +local lpegtype = lpeg.type + +local utfcharacters = string.utfcharacters +local utfgmatch = unicode and unicode.utf8.gmatch + +local anything = P(1) +local endofstring = P(-1) +local alwaysmatched = P(true) + +patterns.anything = anything +patterns.endofstring = endofstring +patterns.beginofstring = alwaysmatched +patterns.alwaysmatched = alwaysmatched local digit, sign = R('09'), S('+-') local cr, lf, crlf = P("\r"), P("\n"), P("\r\n") -local utf8byte = R("\128\191") +local newline = crlf + cr + lf +local escaped = P("\\") * anything +local squote = P("'") +local dquote = P('"') +local space = P(" ") + +local utfbom_32_be = P('\000\000\254\255') +local utfbom_32_le = P('\255\254\000\000') +local utfbom_16_be = P('\255\254') +local utfbom_16_le = P('\254\255') +local utfbom_8 = P('\239\187\191') +local utfbom = utfbom_32_be + utfbom_32_le + + utfbom_16_be + utfbom_16_le + + utfbom_8 +local utftype = utfbom_32_be / "utf-32-be" + utfbom_32_le / "utf-32-le" + + utfbom_16_be / "utf-16-be" + utfbom_16_le / "utf-16-le" + + utfbom_8 / "utf-8" + alwaysmatched / "unknown" + +local utf8next = R("\128\191") -patterns.utf8byte = utf8byte patterns.utf8one = R("\000\127") -patterns.utf8two = R("\194\223") * utf8byte -patterns.utf8three = R("\224\239") * utf8byte * utf8byte -patterns.utf8four = R("\240\244") * utf8byte * utf8byte * utf8byte +patterns.utf8two = R("\194\223") * utf8next +patterns.utf8three = R("\224\239") * utf8next * utf8next +patterns.utf8four = R("\240\244") * utf8next * utf8next * utf8next +patterns.utfbom = utfbom +patterns.utftype = utftype + +local utf8char = patterns.utf8one + patterns.utf8two + patterns.utf8three + patterns.utf8four +local validutf8char = utf8char^0 * endofstring * Cc(true) + Cc(false) + +patterns.utf8 = utf8char +patterns.utf8char = utf8char +patterns.validutf8 = validutf8char +patterns.validutf8char = validutf8char patterns.digit = digit patterns.sign = sign patterns.cardinal = sign^0 * digit^1 patterns.integer = sign^0 * digit^1 patterns.float = sign^0 * digit^0 * P('.') * digit^1 +patterns.cfloat = sign^0 * digit^0 * P(',') * digit^1 patterns.number = patterns.float + patterns.integer +patterns.cnumber = patterns.cfloat + patterns.integer patterns.oct = P("0") * R("07")^1 patterns.octal = patterns.oct patterns.HEX = P("0x") * R("09","AF")^1 @@ -380,16 +247,42 @@ patterns.hexadecimal = P("0x") * R("09","AF","af")^1 patterns.lowercase = R("az") patterns.uppercase = R("AZ") patterns.letter = patterns.lowercase + patterns.uppercase -patterns.space = S(" ") +patterns.space = space +patterns.tab = P("\t") +patterns.spaceortab = patterns.space + patterns.tab patterns.eol = S("\n\r") patterns.spacer = S(" \t\f\v") -- + string.char(0xc2, 0xa0) if we want utf (cf mail roberto) -patterns.newline = crlf + cr + lf -patterns.nonspace = 1 - patterns.space +patterns.newline = newline +patterns.emptyline = newline^1 patterns.nonspacer = 1 - patterns.spacer patterns.whitespace = patterns.eol + patterns.spacer patterns.nonwhitespace = 1 - patterns.whitespace -patterns.utf8 = patterns.utf8one + patterns.utf8two + patterns.utf8three + patterns.utf8four -patterns.utfbom = P('\000\000\254\255') + P('\255\254\000\000') + P('\255\254') + P('\254\255') + P('\239\187\191') +patterns.equal = P("=") +patterns.comma = P(",") +patterns.commaspacer = P(",") * patterns.spacer^0 +patterns.period = P(".") +patterns.colon = P(":") +patterns.semicolon = P(";") +patterns.underscore = P("_") +patterns.escaped = escaped +patterns.squote = squote +patterns.dquote = dquote +patterns.nosquote = (escaped + (1-squote))^0 +patterns.nodquote = (escaped + (1-dquote))^0 +patterns.unsingle = (squote/"") * patterns.nosquote * (squote/"") +patterns.undouble = (dquote/"") * patterns.nodquote * (dquote/"") +patterns.unquoted = patterns.undouble + patterns.unsingle -- more often undouble +patterns.unspacer = ((patterns.spacer^1)/"")^0 + +patterns.somecontent = (anything - newline - space)^1 -- (utf8char - newline - space)^1 +patterns.beginline = #(1-newline) + +local unquoted = Cs(patterns.unquoted * endofstring) -- not C + +function string.unquoted(str) + return match(unquoted,str) or str +end + function lpeg.anywhere(pattern) --slightly adapted from website return P { P(pattern) + 1 * V(1) } -- why so complex? @@ -399,36 +292,18 @@ function lpeg.splitter(pattern, action) return (((1-P(pattern))^1)/action+1)^0 end -local spacing = patterns.spacer^0 * patterns.newline -- sort of strip -local empty = spacing * Cc("") -local nonempty = Cs((1-spacing)^1) * spacing^-1 -local content = (empty + nonempty)^1 - -local capture = Ct(content^0) - -function string:splitlines() - return match(capture,self) -end - -patterns.textline = content - ---~ local p = lpeg.splitat("->",false) print(match(p,"oeps->what->more")) -- oeps what more ---~ local p = lpeg.splitat("->",true) print(match(p,"oeps->what->more")) -- oeps what->more ---~ local p = lpeg.splitat("->",false) print(match(p,"oeps")) -- oeps ---~ local p = lpeg.splitat("->",true) print(match(p,"oeps")) -- oeps - local splitters_s, splitters_m = { }, { } local function splitat(separator,single) local splitter = (single and splitters_s[separator]) or splitters_m[separator] if not splitter then separator = P(separator) + local other = C((1 - separator)^0) if single then - local other, any = C((1 - separator)^0), P(1) + local any = anything splitter = other * (separator * C(any^0) + "") -- ? splitters_s[separator] = splitter else - local other = C((1 - separator)^0) splitter = other * (separator * other)^0 splitters_m[separator] = splitter end @@ -438,6 +313,7 @@ end lpeg.splitat = splitat + local cache = { } function lpeg.split(separator,str) @@ -449,16 +325,39 @@ function lpeg.split(separator,str) return match(c,str) end -function string:split(separator) +function string.split(str,separator) local c = cache[separator] if not c then c = Ct(splitat(separator)) cache[separator] = c end - return match(c,self) + return match(c,str) +end + +local spacing = patterns.spacer^0 * newline -- sort of strip +local empty = spacing * Cc("") +local nonempty = Cs((1-spacing)^1) * spacing^-1 +local content = (empty + nonempty)^1 + +patterns.textline = content + + +local linesplitter = Ct(splitat(newline)) + +patterns.linesplitter = linesplitter + +function string.splitlines(str) + return match(linesplitter,str) +end + +local utflinesplitter = utfbom^-1 * Ct(splitat(newline)) + +patterns.utflinesplitter = utflinesplitter + +function string.utfsplitlines(str) + return match(utflinesplitter,str) end -lpeg.splitters = cache local cache = { } @@ -466,37 +365,24 @@ function lpeg.checkedsplit(separator,str) local c = cache[separator] if not c then separator = P(separator) - local other = C((1 - separator)^0) + local other = C((1 - separator)^1) c = Ct(separator^0 * other * (separator^1 * other)^0) cache[separator] = c end return match(c,str) end -function string:checkedsplit(separator) +function string.checkedsplit(str,separator) local c = cache[separator] if not c then separator = P(separator) - local other = C((1 - separator)^0) + local other = C((1 - separator)^1) c = Ct(separator^0 * other * (separator^1 * other)^0) cache[separator] = c end - return match(c,self) + return match(c,str) end ---~ function lpeg.append(list,pp) ---~ local p = pp ---~ for l=1,#list do ---~ if p then ---~ p = p + P(list[l]) ---~ else ---~ p = P(list[l]) ---~ end ---~ end ---~ return p ---~ end - ---~ from roberto's site: local f1 = string.byte @@ -504,170 +390,459 @@ local function f2(s) local c1, c2 = f1(s,1,2) return c1 * 64 + c2 local function f3(s) local c1, c2, c3 = f1(s,1,3) return (c1 * 64 + c2) * 64 + c3 - 925824 end local function f4(s) local c1, c2, c3, c4 = f1(s,1,4) return ((c1 * 64 + c2) * 64 + c3) * 64 + c4 - 63447168 end -patterns.utf8byte = patterns.utf8one/f1 + patterns.utf8two/f2 + patterns.utf8three/f3 + patterns.utf8four/f4 - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-table'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -table.join = table.concat +local utf8byte = patterns.utf8one/f1 + patterns.utf8two/f2 + patterns.utf8three/f3 + patterns.utf8four/f4 -local concat, sort, insert, remove = table.concat, table.sort, table.insert, table.remove -local format, find, gsub, lower, dump, match = string.format, string.find, string.gsub, string.lower, string.dump, string.match -local getmetatable, setmetatable = getmetatable, setmetatable -local type, next, tostring, tonumber, ipairs = type, next, tostring, tonumber, ipairs +patterns.utf8byte = utf8byte --- Starting with version 5.2 Lua no longer provide ipairs, which makes --- sense. As we already used the for loop and # in most places the --- impact on ConTeXt was not that large; the remaining ipairs already --- have been replaced. In a similar fashio we also hardly used pairs. --- --- Just in case, we provide the fallbacks as discussed in Programming --- in Lua (http://www.lua.org/pil/7.3.html): -if not ipairs then - -- for k, v in ipairs(t) do ... end - -- for k=1,#t do local v = t[k] ... end +local cache = { } - local function iterate(a,i) - i = i + 1 - local v = a[i] - if v ~= nil then - return i, v --, nil +function lpeg.stripper(str) + if type(str) == "string" then + local s = cache[str] + if not s then + s = Cs(((S(str)^1)/"" + 1)^0) + cache[str] = s end + return s + else + return Cs(((str^1)/"" + 1)^0) end - - function ipairs(a) - return iterate, a, 0 - end - end -if not pairs then - - -- for k, v in pairs(t) do ... end - -- for k, v in next, t do ... end +local cache = { } - function pairs(t) - return next, t -- , nil +function lpeg.keeper(str) + if type(str) == "string" then + local s = cache[str] + if not s then + s = Cs((((1-S(str))^1)/"" + 1)^0) + cache[str] = s + end + return s + else + return Cs((((1-str)^1)/"" + 1)^0) end - end --- Also, unpack has been moved to the table table, and for compatiility --- reasons we provide both now. +function lpeg.frontstripper(str) -- or pattern (yet undocumented) + return (P(str) + P(true)) * Cs(P(1)^0) +end -if not table.unpack then - table.unpack = _G.unpack -elseif not unpack then - _G.unpack = table.unpack +function lpeg.endstripper(str) -- or pattern (yet undocumented) + return Cs((1 - P(str) * P(-1))^0) end --- extra functions, some might go (when not used) +-- Just for fun I looked at the used bytecode and +-- p = (p and p + pp) or pp gets one more (testset). -function table.strip(tab) - local lst = { } - for i=1,#tab do - local s = gsub(tab[i],"^%s*(.-)%s*$","%1") - if s == "" then - -- skip this one - else - lst[#lst+1] = s +function lpeg.replacer(one,two) + if type(one) == "table" then + local no = #one + if no > 0 then + local p + for i=1,no do + local o = one[i] + local pp = P(o[1]) / o[2] + if p then + p = p + pp + else + p = pp + end + end + return Cs((p + 1)^0) end + else + two = two or "" + return Cs((P(one)/two + 1)^0) end - return lst end -function table.keys(t) - local k = { } - for key, _ in next, t do - k[#k+1] = key - end - return k -end +local splitters_f, splitters_s = { }, { } -local function compare(a,b) - return (tostring(a) < tostring(b)) +function lpeg.firstofsplit(separator) -- always return value + local splitter = splitters_f[separator] + if not splitter then + separator = P(separator) + splitter = C((1 - separator)^0) + splitters_f[separator] = splitter + end + return splitter end -local function sortedkeys(tab) - local srt, kind = { }, 0 -- 0=unknown 1=string, 2=number 3=mixed - for key,_ in next, tab do - srt[#srt+1] = key - if kind == 3 then - -- no further check - else - local tkey = type(key) - if tkey == "string" then - -- if kind == 2 then kind = 3 else kind = 1 end - kind = (kind == 2 and 3) or 1 - elseif tkey == "number" then - -- if kind == 1 then kind = 3 else kind = 2 end - kind = (kind == 1 and 3) or 2 - else - kind = 3 - end - end - end - if kind == 0 or kind == 3 then - sort(srt,compare) - else - sort(srt) +function lpeg.secondofsplit(separator) -- nil if not split + local splitter = splitters_s[separator] + if not splitter then + separator = P(separator) + splitter = (1 - separator)^0 * separator * C(anything^0) + splitters_s[separator] = splitter end - return srt + return splitter end -local function sortedhashkeys(tab) -- fast one - local srt = { } - for key,_ in next, tab do - srt[#srt+1] = key - end - sort(srt) - return srt +function lpeg.balancer(left,right) + left, right = P(left), P(right) + return P { left * ((1 - left - right) + V(1))^0 * right } end -table.sortedkeys = sortedkeys -table.sortedhashkeys = sortedhashkeys -function table.sortedhash(t) - local s = sortedhashkeys(t) -- maybe just sortedkeys - local n = 0 - local function kv(s) - n = n + 1 - local k = s[n] - return k, t[k] - end - return kv, s -end -table.sortedpairs = table.sortedhash +local nany = utf8char/"" -function table.append(t, list) - for _,v in next, list do - insert(t,v) +function lpeg.counter(pattern) + pattern = Cs((P(pattern)/" " + nany)^0) + return function(str) + return #match(pattern,str) end end -function table.prepend(t, list) - for k,v in next, list do - insert(t,k,v) - end -end +if utfgmatch then -function table.merge(t, ...) -- first one is target - t = t or {} - local lst = {...} - for i=1,#lst do + function lpeg.count(str,what) -- replaces string.count + if type(what) == "string" then + local n = 0 + for _ in utfgmatch(str,what) do + n = n + 1 + end + return n + else -- 4 times slower but still faster than / function + return #match(Cs((P(what)/" " + nany)^0),str) + end + end + +else + + local cache = { } + + function lpeg.count(str,what) -- replaces string.count + if type(what) == "string" then + local p = cache[what] + if not p then + p = Cs((P(what)/" " + nany)^0) + cache[p] = p + end + return #match(p,str) + else -- 4 times slower but still faster than / function + return #match(Cs((P(what)/" " + nany)^0),str) + end + end + +end + +local patterns_escapes = { -- also defines in l-string + ["%"] = "%%", + ["."] = "%.", + ["+"] = "%+", ["-"] = "%-", ["*"] = "%*", + ["["] = "%[", ["]"] = "%]", + ["("] = "%)", [")"] = "%)", + -- ["{"] = "%{", ["}"] = "%}" + -- ["^"] = "%^", ["$"] = "%$", +} + +local simple_escapes = { -- also defines in l-string + ["-"] = "%-", + ["."] = "%.", + ["?"] = ".", + ["*"] = ".*", +} + +local p = Cs((S("-.+*%()[]") / patterns_escapes + anything)^0) +local s = Cs((S("-.+*%()[]") / simple_escapes + anything)^0) + +function string.escapedpattern(str,simple) + return match(simple and s or p,str) +end + +-- utf extensies + +lpeg.UP = lpeg.P + +if utfcharacters then + + function lpeg.US(str) + local p + for uc in utfcharacters(str) do + if p then + p = p + P(uc) + else + p = P(uc) + end + end + return p + end + + +elseif utfgmatch then + + function lpeg.US(str) + local p + for uc in utfgmatch(str,".") do + if p then + p = p + P(uc) + else + p = P(uc) + end + end + return p + end + +else + + function lpeg.US(str) + local p + local f = function(uc) + if p then + p = p + P(uc) + else + p = P(uc) + end + end + match((utf8char/f)^0,str) + return p + end + +end + +local range = Cs(utf8byte) * (Cs(utf8byte) + Cc(false)) + +local utfchar = unicode and unicode.utf8 and unicode.utf8.char + +function lpeg.UR(str,more) + local first, last + if type(str) == "number" then + first = str + last = more or first + else + first, last = match(range,str) + if not last then + return P(str) + end + end + if first == last then + return P(str) + elseif utfchar and last - first < 8 then -- a somewhat arbitrary criterium + local p + for i=first,last do + if p then + p = p + P(utfchar(i)) + else + p = P(utfchar(i)) + end + end + return p -- nil when invalid range + else + local f = function(b) + return b >= first and b <= last + end + return utf8byte / f -- nil when invalid range + end +end + + + +function lpeg.oneof(list,...) -- lpeg.oneof("elseif","else","if","then") + if type(list) ~= "table" then + list = { list, ... } + end + -- sort(list) -- longest match first + local p = P(list[1]) + for l=2,#list do + p = p + P(list[l]) + end + return p +end + +function lpeg.is_lpeg(p) + return p and lpegtype(p) == "pattern" +end + + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['l-table'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local type, next, tostring, tonumber, ipairs, table, string = type, next, tostring, tonumber, ipairs, table, string +local concat, sort, insert, remove = table.concat, table.sort, table.insert, table.remove +local format, find, gsub, lower, dump, match = string.format, string.find, string.gsub, string.lower, string.dump, string.match +local getmetatable, setmetatable = getmetatable, setmetatable + +-- Starting with version 5.2 Lua no longer provide ipairs, which makes +-- sense. As we already used the for loop and # in most places the +-- impact on ConTeXt was not that large; the remaining ipairs already +-- have been replaced. In a similar fashio we also hardly used pairs. +-- +-- Just in case, we provide the fallbacks as discussed in Programming +-- in Lua (http://www.lua.org/pil/7.3.html): + +if not ipairs then + + -- for k, v in ipairs(t) do ... end + -- for k=1,#t do local v = t[k] ... end + + local function iterate(a,i) + i = i + 1 + local v = a[i] + if v ~= nil then + return i, v --, nil + end + end + + function ipairs(a) + return iterate, a, 0 + end + +end + +if not pairs then + + -- for k, v in pairs(t) do ... end + -- for k, v in next, t do ... end + + function pairs(t) + return next, t -- , nil + end + +end + +-- Also, unpack has been moved to the table table, and for compatiility +-- reasons we provide both now. + +if not table.unpack then + table.unpack = _G.unpack +elseif not unpack then + _G.unpack = table.unpack +end + +-- extra functions, some might go (when not used) + +function table.strip(tab) + local lst, l = { }, 0 + for i=1,#tab do + local s = gsub(tab[i],"^%s*(.-)%s*$","%1") + if s == "" then + -- skip this one + else + l = l + 1 + lst[l] = s + end + end + return lst +end + +function table.keys(t) + local keys, k = { }, 0 + for key, _ in next, t do + k = k + 1 + keys[k] = key + end + return keys +end + +local function compare(a,b) + local ta, tb = type(a), type(b) -- needed, else 11 < 2 + if ta == tb then + return a < b + else + return tostring(a) < tostring(b) + end +end + +local function sortedkeys(tab) + local srt, category, s = { }, 0, 0 -- 0=unknown 1=string, 2=number 3=mixed + for key,_ in next, tab do + s = s + 1 + srt[s] = key + if category == 3 then + -- no further check + else + local tkey = type(key) + if tkey == "string" then + category = (category == 2 and 3) or 1 + elseif tkey == "number" then + category = (category == 1 and 3) or 2 + else + category = 3 + end + end + end + if category == 0 or category == 3 then + sort(srt,compare) + else + sort(srt) + end + return srt +end + +local function sortedhashkeys(tab) -- fast one + local srt, s = { }, 0 + for key,_ in next, tab do + if key then + s= s + 1 + srt[s] = key + end + end + sort(srt) + return srt +end + +table.sortedkeys = sortedkeys +table.sortedhashkeys = sortedhashkeys + +local function nothing() end + +local function sortedhash(t) + if t then + local n, s = 0, sortedkeys(t) -- the robust one + local function kv(s) + n = n + 1 + local k = s[n] + return k, t[k] + end + return kv, s + else + return nothing + end +end + +table.sortedhash = sortedhash +table.sortedpairs = sortedhash + +function table.append(t, list) + local n = #t + for i=1,#list do + n = n + 1 + t[n] = list[i] + end + return t +end + +function table.prepend(t, list) + local nl = #list + local nt = nl + #t + for i=#t,1,-1 do + t[nt] = t[i] + nt = nt - 1 + end + for i=1,#list do + t[i] = list[i] + end + return t +end + +function table.merge(t, ...) -- first one is target + t = t or { } + local lst = { ... } + for i=1,#lst do for k, v in next, lst[i] do t[k] = v end @@ -676,7 +851,7 @@ function table.merge(t, ...) -- first one is target end function table.merged(...) - local tmp, lst = { }, {...} + local tmp, lst = { }, { ... } for i=1,#lst do for k, v in next, lst[i] do tmp[k] = v @@ -686,41 +861,45 @@ function table.merged(...) end function table.imerge(t, ...) - local lst = {...} + local lst, nt = { ... }, #t for i=1,#lst do local nst = lst[i] for j=1,#nst do - t[#t+1] = nst[j] + nt = nt + 1 + t[nt] = nst[j] end end return t end function table.imerged(...) - local tmp, lst = { }, {...} + local tmp, ntmp, lst = { }, 0, {...} for i=1,#lst do local nst = lst[i] for j=1,#nst do - tmp[#tmp+1] = nst[j] + ntmp = ntmp + 1 + tmp[ntmp] = nst[j] end end return tmp end -local function fastcopy(old) -- fast one +local function fastcopy(old,metatabletoo) -- fast one if old then local new = { } for k,v in next, old do if type(v) == "table" then - new[k] = fastcopy(v) -- was just table.copy + new[k] = fastcopy(v,metatabletoo) -- was just table.copy else new[k] = v end end - -- optional second arg - local mt = getmetatable(old) - if mt then - setmetatable(new,mt) + if metatabletoo then + -- optional second arg + local mt = getmetatable(old) + if mt then + setmetatable(new,mt) + end end return new else @@ -728,6 +907,8 @@ local function fastcopy(old) -- fast one end end +-- todo : copy without metatable + local function copy(t, tables) -- taken from lua wiki, slightly adapted tables = tables or { } local tcopy = {} @@ -760,33 +941,14 @@ end table.fastcopy = fastcopy table.copy = copy --- roughly: copy-loop : unpack : sub == 0.9 : 0.4 : 0.45 (so in critical apps, use unpack) - -function table.sub(t,i,j) - return { unpack(t,i,j) } -end - -function table.replace(a,b) - for k,v in next, b do - a[k] = v +function table.derive(parent) + local child = { } + if parent then + setmetatable(child,{ __index = parent }) end + return child end --- slower than #t on indexed tables (#t only returns the size of the numerically indexed slice) - -function table.is_empty(t) -- obolete, use inline code instead - return not t or not next(t) -end - -function table.one_entry(t) -- obolete, use inline code instead - local n = next(t) - return n and not next(t,n) -end - ---~ function table.starts_at(t) -- obsolete, not nice anyway ---~ return ipairs(t,1)(t,0) ---~ end - function table.tohash(t,value) local h = { } if t then @@ -799,27 +961,19 @@ function table.tohash(t,value) end function table.fromhash(t) - local h = { } + local hsh, h = { }, 0 for k, v in next, t do -- no ipairs here - if v then h[#h+1] = k end + if v then + h = h + 1 + hsh[h] = k + end end - return h + return hsh end ---~ print(table.serialize(t), "\n") ---~ print(table.serialize(t,"name"), "\n") ---~ print(table.serialize(t,false), "\n") ---~ print(table.serialize(t,true), "\n") ---~ print(table.serialize(t,"name",true), "\n") ---~ print(table.serialize(t,"name",true,true), "\n") - -table.serialize_functions = true -table.serialize_compact = true -table.serialize_inline = true - local noquotes, hexify, handle, reduce, compact, inline, functions -local reserved = table.tohash { -- intercept a language flaw, no reserved words as key +local reserved = table.tohash { -- intercept a language inconvenience: no reserved words as key 'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat', 'return', 'then', 'true', 'until', 'while', } @@ -831,20 +985,23 @@ local function simple_table(t) n = n + 1 end if n == #t then - local tt = { } + local tt, nt = { }, 0 for i=1,#t do local v = t[i] local tv = type(v) if tv == "number" then + nt = nt + 1 if hexify then - tt[#tt+1] = format("0x%04X",v) + tt[nt] = format("0x%04X",v) else - tt[#tt+1] = tostring(v) -- tostring not needed + tt[nt] = tostring(v) -- tostring not needed end elseif tv == "boolean" then - tt[#tt+1] = tostring(v) + nt = nt + 1 + tt[nt] = tostring(v) elseif tv == "string" then - tt[#tt+1] = format("%q",v) + nt = nt + 1 + tt[nt] = format("%q",v) else tt = nil break @@ -870,21 +1027,25 @@ local function do_serialize(root,name,depth,level,indexed) depth = depth .. " " if indexed then handle(format("%s{",depth)) - elseif name then - --~ handle(format("%s%s={",depth,key(name))) - if type(name) == "number" then -- or find(k,"^%d+$") then + else + local tn = type(name) + if tn == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s[0x%04X]={",depth,name)) else handle(format("%s[%s]={",depth,name)) end - elseif noquotes and not reserved[name] and find(name,"^%a[%w%_]*$") then - handle(format("%s%s={",depth,name)) + elseif tn == "string" then + if noquotes and not reserved[name] and find(name,"^%a[%w%_]*$") then + handle(format("%s%s={",depth,name)) + else + handle(format("%s[%q]={",depth,name)) + end + elseif tn == "boolean" then + handle(format("%s[%s]={",depth,tostring(name))) else - handle(format("%s[%q]={",depth,name)) + handle(format("%s{",depth)) end - else - handle(format("%s{",depth)) end end -- we could check for k (index) being number (cardinal) @@ -901,11 +1062,9 @@ local function do_serialize(root,name,depth,level,indexed) for i=1,#sk do local k = sk[i] local v = root[k] - --~ if v == root then - -- circular - --~ else - local t = type(v) - if compact and first and type(k) == "number" and k >= first and k <= last then + -- circular + local t, tk = type(v), type(k) + if compact and first and tk == "number" and k >= first and k <= last then if t == "number" then if hexify then handle(format("%s 0x%04X,",depth,v)) @@ -947,17 +1106,18 @@ local function do_serialize(root,name,depth,level,indexed) handle(format("%s __p__=nil,",depth)) end elseif t == "number" then - --~ if hexify then - --~ handle(format("%s %s=0x%04X,",depth,key(k),v)) - --~ else - --~ handle(format("%s %s=%s,",depth,key(k),v)) -- %.99g - --~ end - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=0x%04X,",depth,k,v)) else handle(format("%s [%s]=%s,",depth,k,v)) -- %.99g end + elseif tk == "boolean" then + if hexify then + handle(format("%s [%s]=0x%04X,",depth,tostring(k),v)) + else + handle(format("%s [%s]=%s,",depth,tostring(k),v)) -- %.99g + end elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then if hexify then handle(format("%s %s=0x%04X,",depth,k,v)) @@ -973,26 +1133,28 @@ local function do_serialize(root,name,depth,level,indexed) end elseif t == "string" then if reduce and tonumber(v) then - --~ handle(format("%s %s=%s,",depth,key(k),v)) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%s,",depth,k,v)) else handle(format("%s [%s]=%s,",depth,k,v)) end + elseif tk == "boolean" then + handle(format("%s [%s]=%s,",depth,tostring(k),v)) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%s,",depth,k,v)) else handle(format("%s [%q]=%s,",depth,k,v)) end else - --~ handle(format("%s %s=%q,",depth,key(k),v)) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%q,",depth,k,v)) else handle(format("%s [%s]=%q,",depth,k,v)) end + elseif tk == "boolean" then + handle(format("%s [%s]=%q,",depth,tostring(k),v)) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%q,",depth,k,v)) else @@ -1001,13 +1163,14 @@ local function do_serialize(root,name,depth,level,indexed) end elseif t == "table" then if not next(v) then - --~ handle(format("%s %s={},",depth,key(k))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]={},",depth,k)) else handle(format("%s [%s]={},",depth,k)) end + elseif tk == "boolean" then + handle(format("%s [%s]={},",depth,tostring(k))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s={},",depth,k)) else @@ -1016,13 +1179,14 @@ local function do_serialize(root,name,depth,level,indexed) elseif inline then local st = simple_table(v) if st then - --~ handle(format("%s %s={ %s },",depth,key(k),concat(st,", "))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]={ %s },",depth,k,concat(st,", "))) else handle(format("%s [%s]={ %s },",depth,k,concat(st,", "))) end + elseif tk == "boolean" then -- or find(k,"^%d+$") then + handle(format("%s [%s]={ %s },",depth,tostring(k),concat(st,", "))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s={ %s },",depth,k,concat(st,", "))) else @@ -1035,13 +1199,14 @@ local function do_serialize(root,name,depth,level,indexed) do_serialize(v,k,depth,level+1) end elseif t == "boolean" then - --~ handle(format("%s %s=%s,",depth,key(k),tostring(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%s,",depth,k,tostring(v))) else handle(format("%s [%s]=%s,",depth,k,tostring(v))) end + elseif tk == "boolean" then -- or find(k,"^%d+$") then + handle(format("%s [%s]=%s,",depth,tostring(k),tostring(v))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%s,",depth,k,tostring(v))) else @@ -1049,35 +1214,37 @@ local function do_serialize(root,name,depth,level,indexed) end elseif t == "function" then if functions then - --~ handle(format('%s %s=loadstring(%q),',depth,key(k),dump(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=loadstring(%q),",depth,k,dump(v))) else handle(format("%s [%s]=loadstring(%q),",depth,k,dump(v))) end + elseif tk == "boolean" then + handle(format("%s [%s]=loadstring(%q),",depth,tostring(k),dump(v))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=loadstring(%q),",depth,k,dump(v))) else - handle(format("%s [%q]=loadstring(%q),",depth,k,dump(v))) + -- handle(format("%s [%q]=loadstring(%q),",depth,k,dump(v))) + handle(format("%s [%q]=loadstring(%q),",depth,k,debug.getinfo(v).what == "C" and "C code" or dump(v))) end end else - --~ handle(format("%s %s=%q,",depth,key(k),tostring(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%q,",depth,k,tostring(v))) else handle(format("%s [%s]=%q,",depth,k,tostring(v))) end + elseif tk == "boolean" then -- or find(k,"^%d+$") then + handle(format("%s [%s]=%q,",depth,tostring(k),tostring(v))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%q,",depth,k,tostring(v))) else handle(format("%s [%q]=%q,",depth,k,tostring(v))) end end - --~ end - end + end end if level > 0 then handle(format("%s},",depth)) @@ -1087,15 +1254,34 @@ end -- replacing handle by a direct t[#t+1] = ... (plus test) is not much -- faster (0.03 on 1.00 for zapfino.tma) -local function serialize(root,name,_handle,_reduce,_noquotes,_hexify) - noquotes = _noquotes - hexify = _hexify - handle = _handle or print - reduce = _reduce or false - compact = table.serialize_compact - inline = compact and table.serialize_inline - functions = table.serialize_functions +local function serialize(_handle,root,name,specification) -- handle wins local tname = type(name) + if type(specification) == "table" then + noquotes = specification.noquotes + hexify = specification.hexify + handle = _handle or specification.handle or print + reduce = specification.reduce or false + functions = specification.functions + compact = specification.compact + inline = specification.inline and compact + if functions == nil then + functions = true + end + if compact == nil then + compact = true + end + if inline == nil then + inline = compact + end + else + noquotes = false + hexify = false + handle = _handle or print + reduce = false + compact = true + inline = true + functions = true + end if tname == "string" then if name == "return" then handle("return {") @@ -1117,33 +1303,33 @@ local function serialize(root,name,_handle,_reduce,_noquotes,_hexify) else handle("t={") end - if root and next(root) then - do_serialize(root,name,"",0,indexed) + if root then + -- The dummy access will initialize a table that has a delayed initialization + -- using a metatable. (maybe explicitly test for metatable) + if getmetatable(root) then -- todo: make this an option, maybe even per subtable + local dummy = root._w_h_a_t_e_v_e_r_ + root._w_h_a_t_e_v_e_r_ = nil + end + -- Let's forget about empty tables. + if next(root) then + do_serialize(root,name,"",0) + end end handle("}") end ---~ name: ---~ ---~ true : return { } ---~ false : { } ---~ nil : t = { } ---~ string : string = { } ---~ 'return' : return { } ---~ number : [number] = { } -function table.serialize(root,name,reduce,noquotes,hexify) - local t = { } +function table.serialize(root,name,specification) + local t, n = { }, 0 local function flush(s) - t[#t+1] = s + n = n + 1 + t[n] = s end - serialize(root,name,flush,reduce,noquotes,hexify) + serialize(flush,root,name,specification) return concat(t,"\n") end -function table.tohandle(handle,root,name,reduce,noquotes,hexify) - serialize(root,name,handle,reduce,noquotes,hexify) -end +table.tohandle = serialize -- sometimes tables are real use (zapfino extra pro is some 85M) in which -- case a stepwise serialization is nice; actually, we could consider: @@ -1154,73 +1340,63 @@ end -- -- so this is on the todo list -table.tofile_maxtab = 2*1024 +local maxtab = 2*1024 -function table.tofile(filename,root,name,reduce,noquotes,hexify) +function table.tofile(filename,root,name,specification) local f = io.open(filename,'w') if f then - local maxtab = table.tofile_maxtab if maxtab > 1 then - local t = { } + local t, n = { }, 0 local function flush(s) - t[#t+1] = s - if #t > maxtab then + n = n + 1 + t[n] = s + if n > maxtab then f:write(concat(t,"\n"),"\n") -- hm, write(sometable) should be nice - t = { } + t, n = { }, 0 -- we could recycle t if needed end end - serialize(root,name,flush,reduce,noquotes,hexify) + serialize(flush,root,name,specification) f:write(concat(t,"\n"),"\n") else local function flush(s) f:write(s,"\n") end - serialize(root,name,flush,reduce,noquotes,hexify) + serialize(flush,root,name,specification) end f:close() + io.flush() end end -local function flatten(t,f,complete) -- is this used? meybe a variant with next, ... - for i=1,#t do - local v = t[i] - if type(v) == "table" then - if complete or type(v[1]) == "table" then - flatten(v,f,complete) +local function flattened(t,f,depth) + if f == nil then + f = { } + depth = 0xFFFF + elseif tonumber(f) then + -- assume then only two arguments are given + depth = f + f = { } + elseif not depth then + depth = 0xFFFF + end + for k, v in next, t do + if type(k) ~= "number" then + if depth > 0 and type(v) == "table" then + flattened(v,f,depth-1) else - f[#f+1] = v + f[k] = v end - else - f[#f+1] = v end end -end - -function table.flatten(t) - local f = { } - flatten(t,f,true) - return f -end - -function table.unnest(t) -- bad name - local f = { } - flatten(t,f,false) - return f -end - -table.flatten_one_level = table.unnest - --- a better one: - -local function flattened(t,f) - if not f then - f = { } - end - for k, v in next, t do - if type(v) == "table" then - flattened(v,f) + local n = #f + for k=1,#t do + local v = t[k] + if depth > 0 and type(v) == "table" then + flattened(v,f,depth-1) + n = #f else - f[k] = v + n = n + 1 + f[n] = v end end return f @@ -1228,49 +1404,27 @@ end table.flattened = flattened --- the next three may disappear - -function table.remove_value(t,value) -- todo: n - if value then - for i=1,#t do - if t[i] == value then - remove(t,i) - -- remove all, so no: return - end - end +local function unnest(t,f) -- only used in mk, for old times sake + if not f then -- and only relevant for token lists + f = { } end -end - -function table.insert_before_value(t,value,str) - if str then - if value then - for i=1,#t do - if t[i] == value then - insert(t,i,str) - return - end + for i=1,#t do + local v = t[i] + if type(v) == "table" then + if type(v[1]) == "table" then + unnest(v,f) + else + f[#f+1] = v end + else + f[#f+1] = v end - insert(t,1,str) - elseif value then - insert(t,1,value) end + return f end -function table.insert_after_value(t,value,str) - if str then - if value then - for i=1,#t do - if t[i] == value then - insert(t,i+1,str) - return - end - end - end - t[#t+1] = str - elseif value then - t[#t+1] = value - end +function table.unnest(t) -- bad name + return unnest(t) end local function are_equal(a,b,n,m) -- indexed @@ -1297,7 +1451,7 @@ end local function identical(a,b) -- assumes same structure for ka, va in next, a do - local vb = b[k] + local vb = b[ka] if va == vb then -- same elseif type(va) == "table" and type(vb) == "table" then @@ -1311,8 +1465,8 @@ local function identical(a,b) -- assumes same structure return true end -table.are_equal = are_equal table.identical = identical +table.are_equal = are_equal -- maybe also make a combined one @@ -1338,89 +1492,84 @@ function table.contains(t, v) end function table.count(t) - local n, e = 0, next(t) - while e do - n, e = n + 1, next(t,e) + local n = 0 + for k, v in next, t do + n = n + 1 end return n end -function table.swapped(t) - local s = { } +function table.swapped(t,s) -- hash + local n = { } + if s then + for k, v in next, s do + n[k] = v + end + end for k, v in next, t do - s[v] = k + n[v] = k end - return s + return n end ---~ function table.are_equal(a,b) ---~ return table.serialize(a) == table.serialize(b) ---~ end - -function table.clone(t,p) -- t is optional or nil or table - if not p then - t, p = { }, t or { } - elseif not t then - t = { } +function table.reversed(t) + if t then + local tt, tn = { }, #t + if tn > 0 then + local ttn = 0 + for i=tn,1,-1 do + ttn = ttn + 1 + tt[ttn] = t[i] + end + end + return tt end - setmetatable(t, { __index = function(_,key) return p[key] end }) -- why not __index = p ? - return t end -function table.hexed(t,seperator) - local tt = { } - for i=1,#t do tt[i] = format("0x%04X",t[i]) end - return concat(tt,seperator or " ") -end - -function table.reverse_hash(h) - local r = { } - for k,v in next, h do - r[v] = lower(gsub(k," ","")) +function table.sequenced(t,sep,simple) -- hash only + local s, n = { }, 0 + for k, v in sortedhash(t) do + if simple then + if v == true then + n = n + 1 + s[n] = k + elseif v and v~= "" then + n = n + 1 + s[n] = k .. "=" .. tostring(v) + end + else + n = n + 1 + s[n] = k .. "=" .. tostring(v) + end end - return r + return concat(s, sep or " | ") end -function table.reverse(t) - local tt = { } - if #t > 0 then - for i=#t,1,-1 do - tt[#tt+1] = t[i] - end +function table.print(t,...) + if type(t) ~= "table" then + print(tostring(t)) + else + table.tohandle(print,t,...) end - return tt end -function table.insert_before_value(t,value,extra) - for i=1,#t do - if t[i] == extra then - remove(t,i) - end - end - for i=1,#t do - if t[i] == value then - insert(t,i,extra) - return - end - end - insert(t,1,extra) +-- -- -- obsolete but we keep them for a while and might comment them later -- -- -- + +-- roughly: copy-loop : unpack : sub == 0.9 : 0.4 : 0.45 (so in critical apps, use unpack) + +function table.sub(t,i,j) + return { unpack(t,i,j) } end -function table.insert_after_value(t,value,extra) - for i=1,#t do - if t[i] == extra then - remove(t,i) - end - end - for i=1,#t do - if t[i] == value then - insert(t,i+1,extra) - return - end - end - insert(t,#t+1,extra) +-- slower than #t on indexed tables (#t only returns the size of the numerically indexed slice) + +function table.is_empty(t) + return not t or not next(t) end +function table.has_one_entry(t) + return t and not next(t,next(t)) +end end -- of closure @@ -1435,7 +1584,10 @@ if not modules then modules = { } end modules ['l-io'] = { license = "see context related readme files" } -local byte, find, gsub = string.byte, string.find, string.gsub +local io = io +local byte, find, gsub, format = string.byte, string.find, string.gsub, string.format +local concat = table.concat +local type = type if string.find(os.getenv("PATH"),";") then io.fileseparator, io.pathseparator = "\\", ";" @@ -1446,9 +1598,7 @@ end function io.loaddata(filename,textmode) local f = io.open(filename,(textmode and 'r') or 'rb') if f then - -- collectgarbage("step") -- sometimes makes a big difference in mem consumption local data = f:read('*all') - -- garbagecollector.check(data) f:close() return data else @@ -1460,13 +1610,14 @@ function io.savedata(filename,data,joiner) local f = io.open(filename,"wb") if f then if type(data) == "table" then - f:write(table.join(data,joiner or "")) + f:write(concat(data,joiner or "")) elseif type(data) == "function" then data(f) else f:write(data or "") end f:close() + io.flush() return true else return false @@ -1495,12 +1646,19 @@ function io.size(filename) end function io.noflines(f) - local n = 0 - for _ in f:lines() do - n = n + 1 + if type(f) == "string" then + local f = io.open(filename) + local n = f and io.noflines(f) or 0 + assert(f:close()) + return n + else + local n = 0 + for _ in f:lines() do + n = n + 1 + end + f:seek('set',0) + return n end - f:seek('set',0) - return n end local nextchar = { @@ -1526,8 +1684,6 @@ local nextchar = { function io.characters(f,n) if f then return nextchar[n or 1], f - else - return nil, nil end end @@ -1536,40 +1692,42 @@ local nextbyte = { local a, b, c, d = f:read(1,1,1,1) if d then return byte(a), byte(b), byte(c), byte(d) - else - return nil, nil, nil, nil + end + end, + [3] = function(f) + local a, b, c = f:read(1,1,1) + if b then + return byte(a), byte(b), byte(c) end end, [2] = function(f) local a, b = f:read(1,1) if b then return byte(a), byte(b) - else - return nil, nil end end, [1] = function (f) local a = f:read(1) if a then return byte(a) - else - return nil end end, [-2] = function (f) local a, b = f:read(1,1) if b then return byte(b), byte(a) - else - return nil, nil + end + end, + [-3] = function(f) + local a, b, c = f:read(1,1,1) + if b then + return byte(c), byte(b), byte(a) end end, [-4] = function(f) local a, b, c, d = f:read(1,1,1,1) if d then return byte(d), byte(c), byte(b), byte(a) - else - return nil, nil, nil, nil end end } @@ -1586,12 +1744,13 @@ function io.ask(question,default,options) while true do io.write(question) if options then - io.write(string.format(" [%s]",table.concat(options,"|"))) + io.write(format(" [%s]",concat(options,"|"))) end if default then - io.write(string.format(" [%s]",default)) + io.write(format(" [%s]",default)) end - io.write(string.format(" ")) + io.write(format(" ")) + io.flush() local answer = io.read() answer = gsub(answer,"^%s*(.*)%s*$","%1") if answer == "" and default then @@ -1615,6 +1774,63 @@ function io.ask(question,default,options) end end +local function readnumber(f,n,m) + if m then + f:seek("set",n) + n = m + end + if n == 1 then + return byte(f:read(1)) + elseif n == 2 then + local a, b = byte(f:read(2),1,2) + return 256 * a + b + elseif n == 3 then + local a, b, c = byte(f:read(3),1,3) + return 256*256 * a + 256 * b + c + elseif n == 4 then + local a, b, c, d = byte(f:read(4),1,4) + return 256*256*256 * a + 256*256 * b + 256 * c + d + elseif n == 8 then + local a, b = readnumber(f,4), readnumber(f,4) + return 256 * a + b + elseif n == 12 then + local a, b, c = readnumber(f,4), readnumber(f,4), readnumber(f,4) + return 256*256 * a + 256 * b + c + elseif n == -2 then + local b, a = byte(f:read(2),1,2) + return 256*a + b + elseif n == -3 then + local c, b, a = byte(f:read(3),1,3) + return 256*256 * a + 256 * b + c + elseif n == -4 then + local d, c, b, a = byte(f:read(4),1,4) + return 256*256*256 * a + 256*256 * b + 256*c + d + elseif n == -8 then + local h, g, f, e, d, c, b, a = byte(f:read(8),1,8) + return 256*256*256*256*256*256*256 * a + + 256*256*256*256*256*256 * b + + 256*256*256*256*256 * c + + 256*256*256*256 * d + + 256*256*256 * e + + 256*256 * f + + 256 * g + + h + else + return 0 + end +end + +io.readnumber = readnumber + +function io.readstring(f,n,m) + if m then + f:seek("set",n) + n = m + end + local str = gsub(f:read(n),"%z","") + return str +end + end -- of closure @@ -1628,11 +1844,15 @@ if not modules then modules = { } end modules ['l-number'] = { license = "see context related readme files" } +-- this module will be replaced when we have the bit library + local tostring = tostring -local format, floor, insert, match = string.format, math.floor, table.insert, string.match +local format, floor, match, rep = string.format, math.floor, string.match, string.rep +local concat, insert = table.concat, table.insert local lpegmatch = lpeg.match -number = number or { } +number = number or { } +local number = number -- a,b,c,d,e,f = number.toset(100101) @@ -1680,6 +1900,54 @@ function number.bits(n,zero) end +function number.bit(p) + return 2 ^ (p - 1) -- 1-based indexing +end + +function number.hasbit(x, p) -- typical call: if hasbit(x, bit(3)) then ... + return x % (p + p) >= p +end + +function number.setbit(x, p) + return hasbit(x, p) and x or x + p +end + +function number.clearbit(x, p) + return hasbit(x, p) and x - p or x +end + + +function number.tobitstring(n,m) + if n == 0 then + if m then + rep("00000000",m) + else + return "00000000" + end + else + local t = { } + while n > 0 do + insert(t,1,n % 2 > 0 and 1 or 0) + n = floor(n/2) + end + local nn = 8 - #t % 8 + if nn > 0 and nn < 8 then + for i=1,nn do + insert(t,1,0) + end + end + if m then + m = m * 8 - #t + if m > 0 then + insert(t,1,rep("0",m)) + end + end + return concat(t) + end +end + + + end -- of closure do -- create closure to overcome 200 locals limit @@ -1692,6 +1960,8 @@ if not modules then modules = { } end modules ['l-set'] = { license = "see context related readme files" } +-- This will become obsolete when we have the bitset library embedded. + set = set or { } local nums = { } @@ -1735,10 +2005,11 @@ function set.tolist(n) if n == 0 or not tabs[n] then return "" else - local t = { } + local t, n = { }, 0 for k, v in next, tabs[n] do if v then - t[#t+1] = k + n = n + 1 + t[n] = k end end return concat(t," ") @@ -1756,17 +2027,6 @@ function set.contains(n,s) end end ---~ local c = set.create{'aap','noot','mies'} ---~ local s = set.tonumber(c) ---~ local t = set.totable(s) ---~ print(t['aap']) ---~ local c = set.create{'zus','wim','jet'} ---~ local s = set.tonumber(c) ---~ local t = set.totable(s) ---~ print(t['aap']) ---~ print(t['jet']) ---~ print(set.contains(t,'jet')) ---~ print(set.contains(t,'aap')) @@ -1782,32 +2042,119 @@ if not modules then modules = { } end modules ['l-os'] = { license = "see context related readme files" } +-- This file deals with some operating system issues. Please don't bother me +-- with the pros and cons of operating systems as they all have their flaws +-- and benefits. Bashing one of them won't help solving problems and fixing +-- bugs faster and is a waste of time and energy. +-- +-- path separators: / or \ ... we can use / everywhere +-- suffixes : dll so exe ... no big deal +-- quotes : we can use "" in most cases +-- expansion : unless "" are used * might give side effects +-- piping/threads : somewhat different for each os +-- locations : specific user file locations and settings can change over time +-- +-- os.type : windows | unix (new, we already guessed os.platform) +-- os.name : windows | msdos | linux | macosx | solaris | .. | generic (new) +-- os.platform : extended os.name with architecture + -- maybe build io.flush in os.execute -local find, format, gsub = string.find, string.format, string.gsub +local os = os +local find, format, gsub, upper = string.find, string.format, string.gsub, string.upper +local concat = table.concat local random, ceil = math.random, math.ceil +local rawget, rawset, type, getmetatable, setmetatable, tonumber = rawget, rawset, type, getmetatable, setmetatable, tonumber + +-- The following code permits traversing the environment table, at least +-- in luatex. Internally all environment names are uppercase. + +if not os.__getenv__ then + + os.__getenv__ = os.getenv + os.__setenv__ = os.setenv + + if os.env then + + local osgetenv = os.getenv + local ossetenv = os.setenv + local osenv = os.env local _ = osenv.PATH -- initialize the table + + function os.setenv(k,v) + if v == nil then + v = "" + end + local K = upper(k) + osenv[K] = v + if type(v) == "table" then + v = concat(v,";") -- path + end + ossetenv(K,v) + end + + function os.getenv(k) + local K = upper(k) + local v = osenv[K] or osenv[k] or osgetenv(K) or osgetenv(k) + if v == "" then + return nil + else + return v + end + end + + else + + local ossetenv = os.setenv + local osgetenv = os.getenv + local osenv = { } + + function os.setenv(k,v) + if v == nil then + v = "" + end + local K = upper(k) + osenv[K] = v + end + + function os.getenv(k) + local K = upper(k) + local v = osenv[K] or osgetenv(K) or osgetenv(k) + if v == "" then + return nil + else + return v + end + end + + local function __index(t,k) + return os.getenv(k) + end + local function __newindex(t,k,v) + os.setenv(k,v) + end + + os.env = { } + + setmetatable(os.env, { __index = __index, __newindex = __newindex } ) + + end + +end + +-- end of environment hack -local execute, spawn, exec, ioflush = os.execute, os.spawn or os.execute, os.exec or os.execute, io.flush +local execute, spawn, exec, iopopen, ioflush = os.execute, os.spawn or os.execute, os.exec or os.execute, io.popen, io.flush function os.execute(...) ioflush() return execute(...) end function os.spawn (...) ioflush() return spawn (...) end function os.exec (...) ioflush() return exec (...) end +function io.popen (...) ioflush() return iopopen(...) end function os.resultof(command) - ioflush() -- else messed up logging local handle = io.popen(command,"r") - if not handle then - -- print("unknown command '".. command .. "' in os.resultof") - return "" - else - return handle:read("*all") or "" - end + return handle and handle:read("*all") or "" end ---~ os.type : windows | unix (new, we already guessed os.platform) ---~ os.name : windows | msdos | linux | macosx | solaris | .. | generic (new) ---~ os.platform : extended os.name with architecture - if not io.fileseparator then if find(os.getenv("PATH"),";") then io.fileseparator, io.pathseparator, os.type = "\\", ";", os.type or "mswin" @@ -1856,16 +2203,11 @@ function os.runtime() return os.gettimeofday() - startuptime end ---~ print(os.gettimeofday()-os.time()) ---~ os.sleep(1.234) ---~ print (">>",os.runtime()) ---~ print(os.date("%H:%M:%S",os.gettimeofday())) ---~ print(os.date("%H:%M:%S",os.time())) -- no need for function anymore as we have more clever code and helpers now -- this metatable trickery might as well disappear -os.resolvers = os.resolvers or { } +os.resolvers = os.resolvers or { } -- will become private local resolvers = os.resolvers @@ -1878,24 +2220,6 @@ end setmetatable(os,osmt) -if not os.setenv then - - -- we still store them but they won't be seen in - -- child processes although we might pass them some day - -- using command concatination - - local env, getenv = { }, os.getenv - - function os.setenv(k,v) - env[k] = v - end - - function os.getenv(k) - return env[k] or getenv(k) - end - -end - -- we can use HOSTTYPE on some platforms local name, platform = os.name or "linux", os.getenv("MTX_PLATFORM") or "" @@ -1935,7 +2259,7 @@ elseif os.type == "windows" then elseif name == "linux" then function os.resolvers.platform(t,k) - -- we sometims have HOSTTYPE set so let's check that first + -- we sometimes have HOSTTYPE set so let's check that first local platform, architecture = "", os.getenv("HOSTTYPE") or os.resultof("uname -m") or "" if find(architecture,"x86_64") then platform = "linux-64" @@ -2013,10 +2337,10 @@ elseif name == "freebsd" then elseif name == "kfreebsd" then function os.resolvers.platform(t,k) - -- we sometims have HOSTTYPE set so let's check that first + -- we sometimes have HOSTTYPE set so let's check that first local platform, architecture = "", os.getenv("HOSTTYPE") or os.resultof("uname -m") or "" if find(architecture,"x86_64") then - platform = "kfreebsd-64" + platform = "kfreebsd-amd64" else platform = "kfreebsd-i386" end @@ -2091,61 +2415,86 @@ if not modules then modules = { } end modules ['l-file'] = { -- needs a cleanup -file = file or { } +file = file or { } +local file = file -local concat = table.concat -local find, gmatch, match, gsub, sub, char = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char +local insert, concat = table.insert, table.concat +local find, gmatch, match, gsub, sub, char, lower = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char, string.lower local lpegmatch = lpeg.match +local getcurrentdir, attributes = lfs.currentdir, lfs.attributes -function file.removesuffix(filename) - return (gsub(filename,"%.[%a%d]+$","")) +local P, R, S, C, Cs, Cp, Cc = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc + +local function dirname(name,default) + return match(name,"^(.+)[/\\].-$") or (default or "") end -function file.addsuffix(filename, suffix) - if not suffix or suffix == "" then - return filename - elseif not find(filename,"%.[%a%d]+$") then - return filename .. "." .. suffix - else - return filename - end +local function basename(name) + return match(name,"^.+[/\\](.-)$") or name end -function file.replacesuffix(filename, suffix) - return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix +local function nameonly(name) + return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) end -function file.dirname(name,default) - return match(name,"^(.+)[/\\].-$") or (default or "") +local function extname(name,default) + return match(name,"^.+%.([^/\\]-)$") or default or "" end -function file.basename(name) - return match(name,"^.+[/\\](.-)$") or name +local function splitname(name) + local n, s = match(name,"^(.+)%.([^/\\]-)$") + return n or name, s or "" end -function file.nameonly(name) - return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) +file.basename = basename +file.dirname = dirname +file.nameonly = nameonly +file.extname = extname +file.suffix = extname + +function file.removesuffix(filename) + return (gsub(filename,"%.[%a%d]+$","")) end -function file.extname(name,default) - return match(name,"^.+%.([^/\\]-)$") or default or "" +function file.addsuffix(filename, suffix, criterium) + if not suffix or suffix == "" then + return filename + elseif criterium == true then + return filename .. "." .. suffix + elseif not criterium then + local n, s = splitname(filename) + if not s or s == "" then + return filename .. "." .. suffix + else + return filename + end + else + local n, s = splitname(filename) + if s and s ~= "" then + local t = type(criterium) + if t == "table" then + -- keep if in criterium + for i=1,#criterium do + if s == criterium[i] then + return filename + end + end + elseif t == "string" then + -- keep if criterium + if s == criterium then + return filename + end + end + end + return n .. "." .. suffix + end end -file.suffix = file.extname ---~ function file.join(...) ---~ local pth = concat({...},"/") ---~ pth = gsub(pth,"\\","/") ---~ local a, b = match(pth,"^(.*://)(.*)$") ---~ if a and b then ---~ return a .. gsub(b,"//+","/") ---~ end ---~ a, b = match(pth,"^(//)(.*)$") ---~ if a and b then ---~ return a .. gsub(b,"//+","/") ---~ end ---~ return (gsub(pth,"//+","/")) ---~ end +function file.replacesuffix(filename, suffix) + return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix +end + local trick_1 = char(1) local trick_2 = "^" .. trick_1 .. "/+" @@ -2173,60 +2522,37 @@ function file.join(...) return (gsub(pth,"//+","/")) end ---~ print(file.join("//","/y")) ---~ print(file.join("/","/y")) ---~ print(file.join("","/y")) ---~ print(file.join("/x/","/y")) ---~ print(file.join("x/","/y")) ---~ print(file.join("http://","/y")) ---~ print(file.join("http://a","/y")) ---~ print(file.join("http:///a","/y")) ---~ print(file.join("//nas-1","/y")) -function file.iswritable(name) - local a = lfs.attributes(name) or lfs.attributes(file.dirname(name,".")) +function file.is_writable(name) + local a = attributes(name) or attributes(dirname(name,".")) return a and sub(a.permissions,2,2) == "w" end -function file.isreadable(name) - local a = lfs.attributes(name) +function file.is_readable(name) + local a = attributes(name) return a and sub(a.permissions,1,1) == "r" end -file.is_readable = file.isreadable -file.is_writable = file.iswritable +file.isreadable = file.is_readable -- depricated +file.iswritable = file.is_writable -- depricated --- todo: lpeg - ---~ function file.split_path(str) ---~ local t = { } ---~ str = gsub(str,"\\", "/") ---~ str = gsub(str,"(%a):([;/])", "%1\001%2") ---~ for name in gmatch(str,"([^;:]+)") do ---~ if name ~= "" then ---~ t[#t+1] = gsub(name,"\001",":") ---~ end ---~ end ---~ return t ---~ end +-- todo: lpeg \\ / .. does not save much local checkedsplit = string.checkedsplit -function file.split_path(str,separator) +function file.splitpath(str,separator) -- string str = gsub(str,"\\","/") return checkedsplit(str,separator or io.pathseparator) end -function file.join_path(tab) - return concat(tab,io.pathseparator) -- can have trailing // +function file.joinpath(tab,separator) -- table + return concat(tab,separator or io.pathseparator) -- can have trailing // end -- we can hash them weakly -local insert = table.insert - -function file.collapse_path(str,anchor) +function file.collapsepath(str,anchor) if anchor and not find(str,"^/") and not find(str,"^%a:") then str = getcurrentdir() .. "/" .. str end @@ -2280,62 +2606,15 @@ function file.collapse_path(str,anchor) return concat(newelements, '/') end end -function file.xcollapse_path(str) - print('collapse', str) - if str == "" or str =="." then - return "." - elseif find(str,"^%.%.") then - return str - elseif not find(str,"%.") then - return str - end - str = gsub(str,"^%./",lfs.currentdir() .. "/") -- ./xx in qualified - str = gsub(str,"\\","/") - local oldelements = checkedsplit(str,"/") - local newelements = { } - local i = #oldelements - while i > 0 do - local element = oldelements[i] - if element == '.' then - -- do nothing - elseif element == '..' then - local n = i -1 - while n > 0 do - local element = oldelements[n] - if element ~= '..' and element ~= '.' then - oldelements[n] = '.' - break - else - n = n - 1 - end - end - if n<1 then - insert(newelements,1,'..') - end - elseif element ~= "" then - insert(newelements,1,element) - end - i = i - 1 - end - if #newelements == 0 then - return "." - elseif find(str,"^/") then - return "/" .. concat(newelements,'/') - else - return concat(newelements, '/') - end -end ---~ print(file.collapse_path("/a")) ---~ print(file.collapse_path("a/./b/..")) ---~ print(file.collapse_path("a/aa/../b/bb")) ---~ print(file.collapse_path("a/../..")) ---~ print(file.collapse_path("a/.././././b/..")) ---~ print(file.collapse_path("a/./././b/..")) ---~ print(file.collapse_path("a/b/c/../..")) -function file.robustname(str) - return (gsub(str,"[^%a%d%/%-%.\\]+","-")) +function file.robustname(str,strict) + str = gsub(str,"[^%a%d%/%-%.\\]+","-") + if strict then + return lower(gsub(str,"^%-*(.-)%-*$","%1")) + else + return str + end end file.readdata = io.loaddata @@ -2347,100 +2626,34 @@ end -- lpeg variants, slightly faster, not always ---~ local period = lpeg.P(".") ---~ local slashes = lpeg.S("\\/") ---~ local noperiod = 1-period ---~ local noslashes = 1-slashes ---~ local name = noperiod^1 - ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.C(noperiod^1) * -1 - ---~ function file.extname(name) ---~ return lpegmatch(pattern,name) or "" ---~ end - ---~ local pattern = lpeg.Cs(((period * noperiod^1 * -1)/"" + 1)^1) - ---~ function file.removesuffix(name) ---~ return lpegmatch(pattern,name) ---~ end - ---~ local pattern = (noslashes^0 * slashes)^1 * lpeg.C(noslashes^1) * -1 - ---~ function file.basename(name) ---~ return lpegmatch(pattern,name) or name ---~ end - ---~ local pattern = (noslashes^0 * slashes)^1 * lpeg.Cp() * noslashes^1 * -1 - ---~ function file.dirname(name) ---~ local p = lpegmatch(pattern,name) ---~ if p then ---~ return sub(name,1,p-2) ---~ else ---~ return "" ---~ end ---~ end - ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.Cp() * noperiod^1 * -1 - ---~ function file.addsuffix(name, suffix) ---~ local p = lpegmatch(pattern,name) ---~ if p then ---~ return name ---~ else ---~ return name .. "." .. suffix ---~ end ---~ end - ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.Cp() * noperiod^1 * -1 - ---~ function file.replacesuffix(name,suffix) ---~ local p = lpegmatch(pattern,name) ---~ if p then ---~ return sub(name,1,p-2) .. "." .. suffix ---~ else ---~ return name .. "." .. suffix ---~ end ---~ end - ---~ local pattern = (noslashes^0 * slashes)^0 * lpeg.Cp() * ((noperiod^1 * period)^1 * lpeg.Cp() + lpeg.P(true)) * noperiod^1 * -1 - ---~ function file.nameonly(name) ---~ local a, b = lpegmatch(pattern,name) ---~ if b then ---~ return sub(name,a,b-2) ---~ elseif a then ---~ return sub(name,a) ---~ else ---~ return name ---~ end ---~ end - ---~ local test = file.extname ---~ local test = file.basename ---~ local test = file.dirname ---~ local test = file.addsuffix ---~ local test = file.replacesuffix ---~ local test = file.nameonly - ---~ print(1,test("./a/b/c/abd.def.xxx","!!!")) ---~ print(2,test("./../b/c/abd.def.xxx","!!!")) ---~ print(3,test("a/b/c/abd.def.xxx","!!!")) ---~ print(4,test("a/b/c/def.xxx","!!!")) ---~ print(5,test("a/b/c/def","!!!")) ---~ print(6,test("def","!!!")) ---~ print(7,test("def.xxx","!!!")) - ---~ local tim = os.clock() for i=1,250000 do local ext = test("abd.def.xxx","!!!") end print(os.clock()-tim) + + + + + + + + + + + + + + + + + -- also rewrite previous -local letter = lpeg.R("az","AZ") + lpeg.S("_-+") -local separator = lpeg.P("://") +local letter = R("az","AZ") + S("_-+") +local separator = P("://") + +local qualified = P(".")^0 * P("/") + letter*P(":") + letter^1*separator + letter^1 * P("/") +local rootbased = P("/") + letter*P(":") -local qualified = lpeg.P(".")^0 * lpeg.P("/") + letter*lpeg.P(":") + letter^1*separator + letter^1 * lpeg.P("/") -local rootbased = lpeg.P("/") + letter*lpeg.P(":") +lpeg.patterns.qualified = qualified +lpeg.patterns.rootbased = rootbased -- ./name ../name /name c: :// name/name @@ -2452,14 +2665,16 @@ function file.is_rootbased_path(filename) return lpegmatch(rootbased,filename) ~= nil end -local slash = lpeg.S("\\/") -local period = lpeg.P(".") -local drive = lpeg.C(lpeg.R("az","AZ")) * lpeg.P(":") -local path = lpeg.C(((1-slash)^0 * slash)^0) -local suffix = period * lpeg.C(lpeg.P(1-period)^0 * lpeg.P(-1)) -local base = lpeg.C((1-suffix)^0) +-- actually these are schemes -local pattern = (drive + lpeg.Cc("")) * (path + lpeg.Cc("")) * (base + lpeg.Cc("")) * (suffix + lpeg.Cc("")) +local slash = S("\\/") +local period = P(".") +local drive = C(R("az","AZ")) * P(":") +local path = C(((1-slash)^0 * slash)^0) +local suffix = period * C(P(1-period)^0 * P(-1)) +local base = C((1-suffix)^0) + +local pattern = (drive + Cc("")) * (path + Cc("")) * (base + Cc("")) * (suffix + Cc("")) function file.splitname(str) -- returns drive, path, base, suffix return lpegmatch(pattern,str) @@ -2472,14 +2687,13 @@ end -- test { "/aa", "/aa/bb", "/aa/bb/cc", "/aa/bb/cc.dd", "/aa/bb/cc.dd.ee" } -- test { "aa", "aa/bb", "aa/bb/cc", "aa/bb/cc.dd", "aa/bb/cc.dd.ee" } ---~ -- todo: ---~ ---~ if os.type == "windows" then ---~ local currentdir = lfs.currentdir ---~ function lfs.currentdir() ---~ return (gsub(currentdir(),"\\","/")) ---~ end ---~ end + +-- for myself: + +function file.strip(name,dir) + local b, a = match(name,"^(.-)" .. dir .. "(.*)$") + return a ~= "" and a or name +end end -- of closure @@ -2495,6 +2709,7 @@ if not modules then modules = { } end modules ['l-md5'] = { -- This also provides file checksums and checkers. +local md5, file = md5, file local gsub, format, byte = string.gsub, string.format, string.byte local function convert(str,fmt) @@ -2505,27 +2720,13 @@ if not md5.HEX then function md5.HEX(str) return convert(str,"%02X") end end if not md5.hex then function md5.hex(str) return convert(str,"%02x") end end if not md5.dec then function md5.dec(str) return convert(str,"%03i") end end ---~ if not md5.HEX then ---~ local function remap(chr) return format("%02X",byte(chr)) end ---~ function md5.HEX(str) return (gsub(md5.sum(str),".",remap)) end ---~ end ---~ if not md5.hex then ---~ local function remap(chr) return format("%02x",byte(chr)) end ---~ function md5.hex(str) return (gsub(md5.sum(str),".",remap)) end ---~ end ---~ if not md5.dec then ---~ local function remap(chr) return format("%03i",byte(chr)) end ---~ function md5.dec(str) return (gsub(md5.sum(str),".",remap)) end ---~ end - -file.needs_updating_threshold = 1 - -function file.needs_updating(oldname,newname) -- size modification access change + +function file.needs_updating(oldname,newname,threshold) -- size modification access change local oldtime = lfs.attributes(oldname, modification) local newtime = lfs.attributes(newname, modification) if newtime >= oldtime then return false - elseif oldtime - newtime < file.needs_updating_threshold then + elseif oldtime - newtime < (threshold or 1) then return false else return true @@ -2572,86 +2773,171 @@ if not modules then modules = { } end modules ['l-url'] = { license = "see context related readme files" } -local char, gmatch, gsub = string.char, string.gmatch, string.gsub +local char, gmatch, gsub, format, byte, find = string.char, string.gmatch, string.gsub, string.format, string.byte, string.find +local concat = table.concat local tonumber, type = tonumber, type -local lpegmatch = lpeg.match +local P, C, R, S, Cs, Cc, Ct = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cs, lpeg.Cc, lpeg.Ct +local lpegmatch, lpegpatterns, replacer = lpeg.match, lpeg.patterns, lpeg.replacer --- from the spec (on the web): +-- from wikipedia: -- --- foo://example.com:8042/over/there?name=ferret#nose --- \_/ \______________/\_________/ \_________/ \__/ --- | | | | | --- scheme authority path query fragment --- | _____________________|__ --- / \ / \ --- urn:example:animal:ferret:nose +-- foo://username:password@example.com:8042/over/there/index.dtb?type=animal;name=narwhal#nose +-- \_/ \_______________/ \_________/ \__/ \___/ \_/ \______________________/ \__/ +-- | | | | | | | | +-- | userinfo hostname port | | query fragment +-- | \________________________________/\_____________|____|/ +-- scheme | | | | +-- | authority path | | +-- | | | +-- | path interpretable as filename +-- | ___________|____________ | +-- / \ / \ | +-- urn:example:animal:ferret:nose interpretable as extension + +url = url or { } +local url = url + +local tochar = function(s) return char(tonumber(s,16)) end + +local colon = P(":") +local qmark = P("?") +local hash = P("#") +local slash = P("/") +local percent = P("%") +local endofstring = P(-1) + +local hexdigit = R("09","AF","af") +local plus = P("+") +local nothing = Cc("") +local escaped = (plus / " ") + (percent * C(hexdigit * hexdigit) / tochar) -url = url or { } +-- we assume schemes with more than 1 character (in order to avoid problems with windows disks) -local function tochar(s) - return char(tonumber(s,16)) -end +local scheme = Cs((escaped+(1-colon-slash-qmark-hash))^2) * colon + nothing +local authority = slash * slash * Cs((escaped+(1- slash-qmark-hash))^0) + nothing +local path = slash * Cs((escaped+(1- qmark-hash))^0) + nothing +local query = qmark * Cs((escaped+(1- hash))^0) + nothing +local fragment = hash * Cs((escaped+(1- endofstring))^0) + nothing -local colon, qmark, hash, slash, percent, endofstring = lpeg.P(":"), lpeg.P("?"), lpeg.P("#"), lpeg.P("/"), lpeg.P("%"), lpeg.P(-1) +local validurl = scheme * authority * path * query * fragment +local parser = Ct(validurl) -local hexdigit = lpeg.R("09","AF","af") -local plus = lpeg.P("+") -local escaped = (plus / " ") + (percent * lpeg.C(hexdigit * hexdigit) / tochar) +lpegpatterns.url = validurl +lpegpatterns.urlsplitter = parser --- we assume schemes with more than 1 character (in order to avoid problems with windows disks) +local escapes = { } ; for i=0,255 do escapes[i] = format("%%%02X",i) end -local scheme = lpeg.Cs((escaped+(1-colon-slash-qmark-hash))^2) * colon + lpeg.Cc("") -local authority = slash * slash * lpeg.Cs((escaped+(1- slash-qmark-hash))^0) + lpeg.Cc("") -local path = slash * lpeg.Cs((escaped+(1- qmark-hash))^0) + lpeg.Cc("") -local query = qmark * lpeg.Cs((escaped+(1- hash))^0) + lpeg.Cc("") -local fragment = hash * lpeg.Cs((escaped+(1- endofstring))^0) + lpeg.Cc("") +local escaper = Cs((R("09","AZ","az") + S("-./_") + P(1) / escapes)^0) -local parser = lpeg.Ct(scheme * authority * path * query * fragment) +lpegpatterns.urlescaper = escaper -- todo: reconsider Ct as we can as well have five return values (saves a table) -- so we can have two parsers, one with and one without -function url.split(str) +local function split(str) return (type(str) == "string" and lpegmatch(parser,str)) or str end +local function hasscheme(str) + local scheme = lpegmatch(scheme,str) -- at least one character + return scheme and scheme ~= "" +end + -- todo: cache them -function url.hashed(str) - local s = url.split(str) +local rootletter = R("az","AZ") + + S("_-+") +local separator = P("://") +local qualified = P(".")^0 * P("/") + + rootletter * P(":") + + rootletter^1 * separator + + rootletter^1 * P("/") +local rootbased = P("/") + + rootletter * P(":") + +local barswapper = replacer("|",":") +local backslashswapper = replacer("\\","/") + +local function hashed(str) -- not yet ok (/test?test) + local s = split(str) local somescheme = s[1] ~= "" - return { - scheme = (somescheme and s[1]) or "file", - authority = s[2], - path = s[3], - query = s[4], - fragment = s[5], - original = str, - noscheme = not somescheme, - } + local somequery = s[4] ~= "" + if not somescheme and not somequery then + s = { + scheme = "file", + authority = "", + path = str, + query = "", + fragment = "", + original = str, + noscheme = true, + filename = str, + } + else -- not always a filename but handy anyway + local authority, path, filename = s[2], s[3] + if authority == "" then + filename = path + else + filename = authority .. "/" .. path + end + s = { + scheme = s[1], + authority = authority, + path = path, + query = s[4], + fragment = s[5], + original = str, + noscheme = false, + filename = filename, + } + end + return s end -function url.hasscheme(str) - return url.split(str)[1] ~= "" -end +-- Here we assume: +-- +-- files: /// = relative +-- files: //// = absolute (!) + -function url.addscheme(str,scheme) - return (url.hasscheme(str) and str) or ((scheme or "file:///") .. str) + +url.split = split +url.hasscheme = hasscheme +url.hashed = hashed + +function url.addscheme(str,scheme) -- no authority + if hasscheme(str) then + return str + elseif not scheme then + return "file:///" .. str + else + return scheme .. ":///" .. str + end end -function url.construct(hash) - local fullurl = hash.sheme .. "://".. hash.authority .. hash.path - if hash.query then - fullurl = fullurl .. "?".. hash.query +function url.construct(hash) -- dodo: we need to escape ! + local fullurl, f = { }, 0 + local scheme, authority, path, query, fragment = hash.scheme, hash.authority, hash.path, hash.query, hash.fragment + if scheme and scheme ~= "" then + f = f + 1 ; fullurl[f] = scheme .. "://" + end + if authority and authority ~= "" then + f = f + 1 ; fullurl[f] = authority + end + if path and path ~= "" then + f = f + 1 ; fullurl[f] = "/" .. path + end + if query and query ~= "" then + f = f + 1 ; fullurl[f] = "?".. query end - if hash.fragment then - fullurl = fullurl .. "?".. hash.fragment + if fragment and fragment ~= "" then + f = f + 1 ; fullurl[f] = "#".. fragment end - return fullurl + return lpegmatch(escaper,concat(fullurl)) end function url.filename(filename) - local t = url.hashed(filename) + local t = hashed(filename) return (t.scheme == "file" and (gsub(t.path,"^/([a-zA-Z])([:|])/)","%1:"))) or filename end @@ -2667,37 +2953,13 @@ function url.query(str) end end ---~ print(url.filename("file:///c:/oeps.txt")) ---~ print(url.filename("c:/oeps.txt")) ---~ print(url.filename("file:///oeps.txt")) ---~ print(url.filename("file:///etc/test.txt")) ---~ print(url.filename("/oeps.txt")) - ---~ from the spec on the web (sort of): ---~ ---~ function test(str) ---~ print(table.serialize(url.hashed(str))) ---~ end ---~ ---~ test("%56pass%20words") ---~ test("file:///c:/oeps.txt") ---~ test("file:///c|/oeps.txt") ---~ test("file:///etc/oeps.txt") ---~ test("file://./etc/oeps.txt") ---~ test("file:////etc/oeps.txt") ---~ test("ftp://ftp.is.co.za/rfc/rfc1808.txt") ---~ test("http://www.ietf.org/rfc/rfc2396.txt") ---~ test("ldap://[2001:db8::7]/c=GB?objectClass?one#what") ---~ test("mailto:John.Doe@example.com") ---~ test("news:comp.infosystems.www.servers.unix") ---~ test("tel:+1-816-555-1212") ---~ test("telnet://192.0.2.16:80/") ---~ test("urn:oasis:names:specification:docbook:dtd:xml:4.1.2") ---~ test("/etc/passwords") ---~ test("http://www.pragma-ade.com/spaced%20name") - ---~ test("zip:///oeps/oeps.zip#bla/bla.tex") ---~ test("zip:///oeps/oeps.zip?bla/bla.tex") + + + + + + + end -- of closure @@ -2712,35 +2974,53 @@ if not modules then modules = { } end modules ['l-dir'] = { license = "see context related readme files" } --- dir.expand_name will be merged with cleanpath and collapsepath +-- dir.expandname will be merged with cleanpath and collapsepath local type = type local find, gmatch, match, gsub = string.find, string.gmatch, string.match, string.gsub +local concat, insert, remove = table.concat, table.insert, table.remove local lpegmatch = lpeg.match +local P, S, R, C, Cc, Cs, Ct, Cv, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cv, lpeg.V + dir = dir or { } +local dir = dir +local lfs = lfs + +local attributes = lfs.attributes +local walkdir = lfs.dir +local isdir = lfs.isdir +local isfile = lfs.isfile +local mkdir = lfs.mkdir +local chdir = lfs.chdir +local currentdir = lfs.currentdir -- handy function dir.current() - return (gsub(lfs.currentdir(),"\\","/")) + return (gsub(currentdir(),"\\","/")) end --- optimizing for no string.find (*) does not save time +-- optimizing for no find (*) does not save time -local attributes = lfs.attributes -local walkdir = lfs.dir -local function glob_pattern(path,patt,recurse,action) - local ok, scanner +local lfsisdir = isdir + +local function isdir(path) + path = gsub(path,"[/\\]+$","") + return lfsisdir(path) +end + +lfs.isdir = isdir + +local function globpattern(path,patt,recurse,action) if path == "/" then - ok, scanner = xpcall(function() return walkdir(path..".") end, function() end) -- kepler safe - else - ok, scanner = xpcall(function() return walkdir(path) end, function() end) -- kepler safe + path = path .. "." + elseif not find(path,"/$") then + path = path .. '/' end - if ok and type(scanner) == "function" then - if not find(path,"/$") then path = path .. '/' end - for name in scanner do + if isdir(path) then -- lfs.isdir does not like trailing / + for name in walkdir(path) do -- lfs.dir accepts trailing / local full = path .. name local mode = attributes(full,'mode') if mode == 'file' then @@ -2748,15 +3028,15 @@ local function glob_pattern(path,patt,recurse,action) action(full) end elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then - glob_pattern(full,patt,recurse,action) + globpattern(full,patt,recurse,action) end end end end -dir.glob_pattern = glob_pattern +dir.globpattern = globpattern -local function collect_pattern(path,patt,recurse,result) +local function collectpattern(path,patt,recurse,result) local ok, scanner result = result or { } if path == "/" then @@ -2775,7 +3055,7 @@ local function collect_pattern(path,patt,recurse,result) result[name] = attr end elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then - attr.list = collect_pattern(full,patt,recurse) + attr.list = collectpattern(full,patt,recurse) result[name] = attr end end @@ -2783,9 +3063,7 @@ local function collect_pattern(path,patt,recurse,result) return result end -dir.collect_pattern = collect_pattern - -local P, S, R, C, Cc, Cs, Ct, Cv, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cv, lpeg.V +dir.collectpattern = collectpattern local pattern = Ct { [1] = (C(P(".") + P("/")^1) + C(R("az","AZ") * P(":") * P("/")^0) + Cc("./")) * V(2) * V(3), @@ -2809,16 +3087,16 @@ local function glob(str,t) for s=1,#str do glob(str[s],t) end - elseif lfs.isfile(str) then + elseif isfile(str) then t(str) else - local split = lpegmatch(pattern,str) + local split = lpegmatch(pattern,str) -- we could use the file splitter if split then local root, path, base = split[1], split[2], split[3] local recurse = find(base,"%*%*") local start = root .. path local result = lpegmatch(filter,start .. base) - glob_pattern(start,result,recurse,t) + globpattern(start,result,recurse,t) end end else @@ -2828,12 +3106,15 @@ local function glob(str,t) glob(str[s],t) end return t - elseif lfs.isfile(str) then - local t = t or { } - t[#t+1] = str - return t + elseif isfile(str) then + if t then + t[#t+1] = str + return t + else + return { str } + end else - local split = lpegmatch(pattern,str) + local split = lpegmatch(pattern,str) -- we could use the file splitter if split then local t = t or { } local action = action or function(name) t[#t+1] = name end @@ -2841,7 +3122,7 @@ local function glob(str,t) local recurse = find(base,"%*%*") local start = root .. path local result = lpegmatch(filter,start .. base) - glob_pattern(start,result,recurse,action) + globpattern(start,result,recurse,action) return t else return { } @@ -2852,18 +3133,14 @@ end dir.glob = glob ---~ list = dir.glob("**/*.tif") ---~ list = dir.glob("/**/*.tif") ---~ list = dir.glob("./**/*.tif") ---~ list = dir.glob("oeps/**/*.tif") ---~ list = dir.glob("/oeps/**/*.tif") local function globfiles(path,recurse,func,files) -- func == pattern or function if type(func) == "string" then - local s = func -- alas, we need this indirect way + local s = func func = function(name) return find(name,s) end end files = files or { } + local noffiles = #files for name in walkdir(path) do if find(name,"^%.") then --- skip @@ -2874,12 +3151,9 @@ local function globfiles(path,recurse,func,files) -- func == pattern or function globfiles(path .. "/" .. name,recurse,func,files) end elseif mode == "file" then - if func then - if func(name) then - files[#files+1] = path .. "/" .. name - end - else - files[#files+1] = path .. "/" .. name + if not func or func(name) then + noffiles = noffiles + 1 + files[noffiles] = path .. "/" .. name end end end @@ -2897,17 +3171,15 @@ dir.globfiles = globfiles -- print(dir.ls("*.tex")) function dir.ls(pattern) - return table.concat(glob(pattern),"\n") + return concat(glob(pattern),"\n") end ---~ mkdirs("temp") ---~ mkdirs("a/b/c") ---~ mkdirs(".","/a/b/c") ---~ mkdirs("a","b","c") local make_indeed = true -- false -if string.find(os.getenv("PATH"),";") then -- os.type == "windows" +local onwindows = os.type == "windows" or find(os.getenv("PATH"),";") + +if onwindows then function dir.mkdirs(...) local str, pth, t = "", "", { ... } @@ -2956,64 +3228,21 @@ if string.find(os.getenv("PATH"),";") then -- os.type == "windows" else pth = pth .. "/" .. s end - if make_indeed and not lfs.isdir(pth) then - lfs.mkdir(pth) - end - end - return pth, (lfs.isdir(pth) == true) - end - ---~ print(dir.mkdirs("","","a","c")) ---~ print(dir.mkdirs("a")) ---~ print(dir.mkdirs("a:")) ---~ print(dir.mkdirs("a:/b/c")) ---~ print(dir.mkdirs("a:b/c")) ---~ print(dir.mkdirs("a:/bbb/c")) ---~ print(dir.mkdirs("/a/b/c")) ---~ print(dir.mkdirs("/aaa/b/c")) ---~ print(dir.mkdirs("//a/b/c")) ---~ print(dir.mkdirs("///a/b/c")) ---~ print(dir.mkdirs("a/bbb//ccc/")) - - function dir.expand_name(str) -- will be merged with cleanpath and collapsepath - local first, nothing, last = match(str,"^(//)(//*)(.*)$") - if first then - first = dir.current() .. "/" - end - if not first then - first, last = match(str,"^(//)/*(.*)$") - end - if not first then - first, last = match(str,"^([a-zA-Z]:)(.*)$") - if first and not find(last,"^/") then - local d = lfs.currentdir() - if lfs.chdir(first) then - first = dir.current() - end - lfs.chdir(d) + if make_indeed and not isdir(pth) then + mkdir(pth) end end - if not first then - first, last = dir.current(), str - end - last = gsub(last,"//","/") - last = gsub(last,"/%./","/") - last = gsub(last,"^/*","") - first = gsub(first,"/*$","") - if last == "" then - return first - else - return first .. "/" .. last - end + return pth, (isdir(pth) == true) end + else function dir.mkdirs(...) local str, pth, t = "", "", { ... } for i=1,#t do local s = t[i] - if s ~= "" then + if s and s ~= "" then -- we catch nil and false if str ~= "" then str = str .. "/" .. s else @@ -3031,42 +3260,92 @@ else else pth = pth .. "/" .. s end - if make_indeed and not first and not lfs.isdir(pth) then - lfs.mkdir(pth) + if make_indeed and not first and not isdir(pth) then + mkdir(pth) end end else pth = "." for s in gmatch(str,"[^/]+") do pth = pth .. "/" .. s - if make_indeed and not lfs.isdir(pth) then - lfs.mkdir(pth) + if make_indeed and not isdir(pth) then + mkdir(pth) + end + end + end + return pth, (isdir(pth) == true) + end + + +end + +dir.makedirs = dir.mkdirs + +-- we can only define it here as it uses dir.current + +if onwindows then + + function dir.expandname(str) -- will be merged with cleanpath and collapsepath + local first, nothing, last = match(str,"^(//)(//*)(.*)$") + if first then + first = dir.current() .. "/" + end + if not first then + first, last = match(str,"^(//)/*(.*)$") + end + if not first then + first, last = match(str,"^([a-zA-Z]:)(.*)$") + if first and not find(last,"^/") then + local d = currentdir() + if chdir(first) then + first = dir.current() end + chdir(d) end end - return pth, (lfs.isdir(pth) == true) + if not first then + first, last = dir.current(), str + end + last = gsub(last,"//","/") + last = gsub(last,"/%./","/") + last = gsub(last,"^/*","") + first = gsub(first,"/*$","") + if last == "" or last == "." then + return first + else + return first .. "/" .. last + end end ---~ print(dir.mkdirs("","","a","c")) ---~ print(dir.mkdirs("a")) ---~ print(dir.mkdirs("/a/b/c")) ---~ print(dir.mkdirs("/aaa/b/c")) ---~ print(dir.mkdirs("//a/b/c")) ---~ print(dir.mkdirs("///a/b/c")) ---~ print(dir.mkdirs("a/bbb//ccc/")) +else - function dir.expand_name(str) -- will be merged with cleanpath and collapsepath + function dir.expandname(str) -- will be merged with cleanpath and collapsepath if not find(str,"^/") then - str = lfs.currentdir() .. "/" .. str + str = currentdir() .. "/" .. str end str = gsub(str,"//","/") str = gsub(str,"/%./","/") + str = gsub(str,"(.)/%.$","%1") return str end end -dir.makedirs = dir.mkdirs +file.expandname = dir.expandname -- for convenience + +local stack = { } + +function dir.push(newdir) + insert(stack,lfs.currentdir()) +end + +function dir.pop() + local d = remove(stack) + if d then + lfs.chdir(d) + end + return d +end end -- of closure @@ -3081,12 +3360,17 @@ if not modules then modules = { } end modules ['l-boolean'] = { license = "see context related readme files" } +local type, tonumber = type, tonumber + boolean = boolean or { } +local boolean = boolean -local type, tonumber = type, tonumber +-- function boolean.tonumber(b) +-- return b and 1 or 0 -- test and test and return or return +-- end function boolean.tonumber(b) - if b then return 1 else return 0 end + if b then return 1 else return 0 end -- test and return or return end function toboolean(str,tolerant) @@ -3110,7 +3394,9 @@ function toboolean(str,tolerant) end end -function string.is_boolean(str) +string.toboolean = toboolean + +function string.is_boolean(str,default) if type(str) == "string" then if str == "true" or str == "yes" or str == "on" or str == "t" then return true @@ -3118,15 +3404,7 @@ function string.is_boolean(str) return false end end - return nil -end - -function boolean.alwaystrue() - return true -end - -function boolean.falsetrue() - return false + return default end @@ -3134,7 +3412,7 @@ end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['l-math'] = { +if not modules then modules = { } end modules ['l-unicode'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -3142,228 +3420,290 @@ if not modules then modules = { } end modules ['l-math'] = { license = "see context related readme files" } -local floor, sin, cos, tan = math.floor, math.sin, math.cos, math.tan +if not unicode then -if not math.round then - function math.round(x) - return floor(x + 0.5) - end -end + unicode = { utf8 = { } } -if not math.div then - function math.div(n,m) - return floor(n/m) - end -end + local floor, char = math.floor, string.char -if not math.mod then - function math.mod(n,m) - return n % m + function unicode.utf8.utfchar(n) + if n < 0x80 then + return char(n) + elseif n < 0x800 then + return char( + 0xC0 + floor(n/0x40), + 0x80 + (n % 0x40) + ) + elseif n < 0x10000 then + return char( + 0xE0 + floor(n/0x1000), + 0x80 + (floor(n/0x40) % 0x40), + 0x80 + (n % 0x40) + ) + elseif n < 0x40000 then + return char( + 0xF0 + floor(n/0x40000), + 0x80 + floor(n/0x1000), + 0x80 + (floor(n/0x40) % 0x40), + 0x80 + (n % 0x40) + ) + else + -- return char( + -- 0xF1 + floor(n/0x1000000), + -- 0x80 + floor(n/0x40000), + -- 0x80 + floor(n/0x1000), + -- 0x80 + (floor(n/0x40) % 0x40), + -- 0x80 + (n % 0x40) + -- ) + return "?" + end end + end -local pipi = 2*math.pi/360 +local unicode = unicode -function math.sind(d) - return sin(d*pipi) -end - -function math.cosd(d) - return cos(d*pipi) -end - -function math.tand(d) - return tan(d*pipi) -end +utf = utf or unicode.utf8 +local concat = table.concat +local utfchar, utfbyte, utfgsub = utf.char, utf.byte, utf.gsub +local char, byte, find, bytepairs, utfvalues, format = string.char, string.byte, string.find, string.bytepairs, string.utfvalues, string.format +local type = type -end -- of closure +local utfsplitlines = string.utfsplitlines -do -- create closure to overcome 200 locals limit +-- 0 EF BB BF UTF-8 +-- 1 FF FE UTF-16-little-endian +-- 2 FE FF UTF-16-big-endian +-- 3 FF FE 00 00 UTF-32-little-endian +-- 4 00 00 FE FF UTF-32-big-endian -if not modules then modules = { } end modules ['l-utils'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" +unicode.utfname = { + [0] = 'utf-8', + [1] = 'utf-16-le', + [2] = 'utf-16-be', + [3] = 'utf-32-le', + [4] = 'utf-32-be' } --- hm, quite unreadable +-- \000 fails in <= 5.0 but is valid in >=5.1 where %z is depricated -local gsub = string.gsub -local concat = table.concat -local type, next = type, next +function unicode.utftype(f) + local str = f:read(4) + if not str then + f:seek('set') + return 0 + -- elseif find(str,"^%z%z\254\255") then -- depricated + -- elseif find(str,"^\000\000\254\255") then -- not permitted and bugged + elseif find(str,"\000\000\254\255",1,true) then -- seems to work okay (TH) + return 4 + -- elseif find(str,"^\255\254%z%z") then -- depricated + -- elseif find(str,"^\255\254\000\000") then -- not permitted and bugged + elseif find(str,"\255\254\000\000",1,true) then -- seems to work okay (TH) + return 3 + elseif find(str,"^\254\255") then + f:seek('set',2) + return 2 + elseif find(str,"^\255\254") then + f:seek('set',2) + return 1 + elseif find(str,"^\239\187\191") then + f:seek('set',3) + return 0 + else + f:seek('set') + return 0 + end +end -if not utils then utils = { } end -if not utils.merger then utils.merger = { } end -if not utils.lua then utils.lua = { } end -utils.merger.m_begin = "begin library merge" -utils.merger.m_end = "end library merge" -utils.merger.pattern = - "%c+" .. - "%-%-%s+" .. utils.merger.m_begin .. - "%c+(.-)%c+" .. - "%-%-%s+" .. utils.merger.m_end .. - "%c+" -function utils.merger._self_fake_() - return - "-- " .. "created merged file" .. "\n\n" .. - "-- " .. utils.merger.m_begin .. "\n\n" .. - "-- " .. utils.merger.m_end .. "\n\n" +local function utf16_to_utf8_be(t) + if type(t) == "string" then + t = utfsplitlines(str) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, 0 + for left, right in bytepairs(t[i]) do + if right then + local now = 256*left + right + if more > 0 then + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 + more = 0 + r = r + 1 + result[r] = utfchar(now) + elseif now >= 0xD800 and now <= 0xDBFF then + more = now + else + r = r + 1 + result[r] = utfchar(now) + end + end + end + t[i] = concat(result,"",1,r) -- we reused tmp, hence t + end + return t end -function utils.report(...) - print(...) +local function utf16_to_utf8_le(t) + if type(t) == "string" then + t = utfsplitlines(str) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, 0 + for left, right in bytepairs(t[i]) do + if right then + local now = 256*right + left + if more > 0 then + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 + more = 0 + r = r + 1 + result[r] = utfchar(now) + elseif now >= 0xD800 and now <= 0xDBFF then + more = now + else + r = r + 1 + result[r] = utfchar(now) + end + end + end + t[i] = concat(result,"",1,r) -- we reused tmp, hence t + end + return t end -utils.merger.strip_comment = true - -function utils.merger._self_load_(name) - local f, data = io.open(name), "" - if f then - utils.report("reading merge from %s",name) - data = f:read("*all") - f:close() - else - utils.report("unknown file to merge %s",name) +local function utf32_to_utf8_be(str) + if type(t) == "string" then + t = utfsplitlines(str) end - if data and utils.merger.strip_comment then - -- saves some 20K - data = gsub(data,"%-%-~[^\n\r]*[\r\n]", "") + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, -1 + for a,b in bytepairs(str) do + if a and b then + if more < 0 then + more = 256*256*256*a + 256*256*b + else + r = r + 1 + result[t] = utfchar(more + 256*a + b) + more = -1 + end + else + break + end + end + t[i] = concat(result,"",1,r) end - return data or "" + return result end -function utils.merger._self_save_(name, data) - if data ~= "" then - local f = io.open(name,'w') - if f then - utils.report("saving merge from %s",name) - f:write(data) - f:close() +local function utf32_to_utf8_le(str) + if type(t) == "string" then + t = utfsplitlines(str) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, -1 + for a,b in bytepairs(str) do + if a and b then + if more < 0 then + more = 256*b + a + else + r = r + 1 + result[t] = utfchar(more + 256*256*256*b + 256*256*a) + more = -1 + end + else + break + end end + t[i] = concat(result,"",1,r) end + return result end -function utils.merger._self_swap_(data,code) - if data ~= "" then - return (gsub(data,utils.merger.pattern, function(s) - return "\n\n" .. "-- "..utils.merger.m_begin .. "\n" .. code .. "\n" .. "-- "..utils.merger.m_end .. "\n\n" - end, 1)) +unicode.utf32_to_utf8_be = utf32_to_utf8_be +unicode.utf32_to_utf8_le = utf32_to_utf8_le +unicode.utf16_to_utf8_be = utf16_to_utf8_be +unicode.utf16_to_utf8_le = utf16_to_utf8_le + +function unicode.utf8_to_utf8(t) + return type(t) == "string" and utfsplitlines(t) or t +end + +function unicode.utf16_to_utf8(t,endian) + return endian and utf16_to_utf8_be(t) or utf16_to_utf8_le(t) or t +end + +function unicode.utf32_to_utf8(t,endian) + return endian and utf32_to_utf8_be(t) or utf32_to_utf8_le(t) or t +end + +local function little(c) + local b = byte(c) + if b < 0x10000 then + return char(b%256,b/256) else - return "" + b = b - 0x10000 + local b1, b2 = b/1024 + 0xD800, b%1024 + 0xDC00 + return char(b1%256,b1/256,b2%256,b2/256) end end ---~ stripper: ---~ ---~ data = gsub(data,"%-%-~[^\n]*\n","") ---~ data = gsub(data,"\n\n+","\n") - -function utils.merger._self_libs_(libs,list) - local result, f, frozen = { }, nil, false - result[#result+1] = "\n" - if type(libs) == 'string' then libs = { libs } end - if type(list) == 'string' then list = { list } end - local foundpath = nil - for i=1,#libs do - local lib = libs[i] - for j=1,#list do - local pth = gsub(list[j],"\\","/") -- file.clean_path - utils.report("checking library path %s",pth) - local name = pth .. "/" .. lib - if lfs.isfile(name) then - foundpath = pth - end - end - if foundpath then break end +local function big(c) + local b = byte(c) + if b < 0x10000 then + return char(b/256,b%256) + else + b = b - 0x10000 + local b1, b2 = b/1024 + 0xD800, b%1024 + 0xDC00 + return char(b1/256,b1%256,b2/256,b2%256) end - if foundpath then - utils.report("using library path %s",foundpath) - local right, wrong = { }, { } - for i=1,#libs do - local lib = libs[i] - local fullname = foundpath .. "/" .. lib - if lfs.isfile(fullname) then - -- right[#right+1] = lib - utils.report("merging library %s",fullname) - result[#result+1] = "do -- create closure to overcome 200 locals limit" - result[#result+1] = io.loaddata(fullname,true) - result[#result+1] = "end -- of closure" - else - -- wrong[#wrong+1] = lib - utils.report("no library %s",fullname) - end - end - if #right > 0 then - utils.report("merged libraries: %s",concat(right," ")) - end - if #wrong > 0 then - utils.report("skipped libraries: %s",concat(wrong," ")) - end +end + +function unicode.utf8_to_utf16(str,littleendian) + if littleendian then + return char(255,254) .. utfgsub(str,".",little) else - utils.report("no valid library path found") + return char(254,255) .. utfgsub(str,".",big) end - return concat(result, "\n\n") end -function utils.merger.selfcreate(libs,list,target) - if target then - utils.merger._self_save_( - target, - utils.merger._self_swap_( - utils.merger._self_fake_(), - utils.merger._self_libs_(libs,list) - ) - ) +function unicode.utfcodes(str) + local t, n = { }, 0 + for u in utfvalues(str) do + n = n + 1 + t[n] = format("0x%04X",u) end + return concat(t,separator or " ") end -function utils.merger.selfmerge(name,libs,list,target) - utils.merger._self_save_( - target or name, - utils.merger._self_swap_( - utils.merger._self_load_(name), - utils.merger._self_libs_(libs,list) - ) - ) +function unicode.ustring(s) + return format("U+%05X",type(s) == "number" and s or utfbyte(s)) end -function utils.merger.selfclean(name) - utils.merger._self_save_( - name, - utils.merger._self_swap_( - utils.merger._self_load_(name), - "" - ) - ) +function unicode.xstring(s) + return format("0x%05X",type(s) == "number" and s or utfbyte(s)) end -function utils.lua.compile(luafile, lucfile, cleanup, strip) -- defaults: cleanup=false strip=true - -- utils.report("compiling",luafile,"into",lucfile) - os.remove(lucfile) - local command = "-o " .. string.quote(lucfile) .. " " .. string.quote(luafile) - if strip ~= false then - command = "-s " .. command - end - local done = (os.spawn("texluac " .. command) == 0) or (os.spawn("luac " .. command) == 0) - if done and cleanup == true and lfs.isfile(lucfile) and lfs.isfile(luafile) then - -- utils.report("removing",luafile) - os.remove(luafile) - end - return done + +local lpegmatch = lpeg.match +local utftype = lpeg.patterns.utftype + +function unicode.filetype(data) + return data and lpegmatch(utftype,data) or "unknown" end + end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['l-aux'] = { +if not modules then modules = { } end modules ['l-math'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -3371,606 +3711,2538 @@ if not modules then modules = { } end modules ['l-aux'] = { license = "see context related readme files" } --- for inline, no store split : for s in string.gmatch(str,",* *([^,]+)") do .. end - -aux = aux or { } +local floor, sin, cos, tan = math.floor, math.sin, math.cos, math.tan -local concat, format, gmatch = table.concat, string.format, string.gmatch -local tostring, type = tostring, type -local lpegmatch = lpeg.match +if not math.round then + function math.round(x) return floor(x + 0.5) end +end -local P, R, V = lpeg.P, lpeg.R, lpeg.V +if not math.div then + function math.div(n,m) return floor(n/m) end +end -local escape, left, right = P("\\"), P('{'), P('}') +if not math.mod then + function math.mod(n,m) return n % m end +end -lpeg.patterns.balanced = P { - [1] = ((escape * (left+right)) + (1 - (left+right)) + V(2))^0, - [2] = left * V(1) * right -} +local pipi = 2*math.pi/360 -local space = lpeg.P(' ') -local equal = lpeg.P("=") -local comma = lpeg.P(",") -local lbrace = lpeg.P("{") -local rbrace = lpeg.P("}") -local nobrace = 1 - (lbrace+rbrace) -local nested = lpeg.P { lbrace * (nobrace + lpeg.V(1))^0 * rbrace } -local spaces = space^0 +if not math.sind then + function math.sind(d) return sin(d*pipi) end + function math.cosd(d) return cos(d*pipi) end + function math.tand(d) return tan(d*pipi) end +end -local value = lpeg.P(lbrace * lpeg.C((nobrace + nested)^0) * rbrace) + lpeg.C((nested + (1-comma))^0) +if not math.odd then + function math.odd (n) return n % 2 == 0 end + function math.even(n) return n % 2 ~= 0 end +end -local key = lpeg.C((1-equal-comma)^1) -local pattern_a = (space+comma)^0 * (key * equal * value + key * lpeg.C("")) -local pattern_c = (space+comma)^0 * (key * equal * value) -local key = lpeg.C((1-space-equal-comma)^1) -local pattern_b = spaces * comma^0 * spaces * (key * ((spaces * equal * spaces * value) + lpeg.C(""))) +end -- of closure --- "a=1, b=2, c=3, d={a{b,c}d}, e=12345, f=xx{a{b,c}d}xx, g={}" : outer {} removes, leading spaces ignored +do -- create closure to overcome 200 locals limit -local hash = { } +if not modules then modules = { } end modules ['util-tab'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} -local function set(key,value) -- using Carg is slower here - hash[key] = value -end +utilities = utilities or {} +utilities.tables = utilities.tables or { } +local tables = utilities.tables -local pattern_a_s = (pattern_a/set)^1 -local pattern_b_s = (pattern_b/set)^1 -local pattern_c_s = (pattern_c/set)^1 +local format, gmatch = string.format, string.gmatch +local concat, insert, remove = table.concat, table.insert, table.remove +local setmetatable, getmetatable, tonumber, tostring = setmetatable, getmetatable, tonumber, tostring -aux.settings_to_hash_pattern_a = pattern_a_s -aux.settings_to_hash_pattern_b = pattern_b_s -aux.settings_to_hash_pattern_c = pattern_c_s +function tables.definetable(target) -- defines undefined tables + local composed, t, n = nil, { }, 0 + for name in gmatch(target,"([^%.]+)") do + n = n + 1 + if composed then + composed = composed .. "." .. name + else + composed = name + end + t[n] = format("%s = %s or { }",composed,composed) + end + return concat(t,"\n") +end -function aux.make_settings_to_hash_pattern(set,how) - if how == "strict" then - return (pattern_c/set)^1 - elseif how == "tolerant" then - return (pattern_b/set)^1 - else - return (pattern_a/set)^1 +function tables.accesstable(target) + local t = _G + for name in gmatch(target,"([^%.]+)") do + t = t[name] end + return t end -function aux.settings_to_hash(str,existing) - if str and str ~= "" then - hash = existing or { } - if moretolerant then - lpegmatch(pattern_b_s,str) - else - lpegmatch(pattern_a_s,str) +function tables.removevalue(t,value) -- todo: n + if value then + for i=1,#t do + if t[i] == value then + remove(t,i) + -- remove all, so no: return + end end - return hash - else - return { } end end -function aux.settings_to_hash_tolerant(str,existing) - if str and str ~= "" then - hash = existing or { } - lpegmatch(pattern_b_s,str) - return hash - else - return { } +function tables.insertbeforevalue(t,value,extra) + for i=1,#t do + if t[i] == extra then + remove(t,i) + end end + for i=1,#t do + if t[i] == value then + insert(t,i,extra) + return + end + end + insert(t,1,extra) end -function aux.settings_to_hash_strict(str,existing) - if str and str ~= "" then - hash = existing or { } - lpegmatch(pattern_c_s,str) - return next(hash) and hash - else - return nil +function tables.insertaftervalue(t,value,extra) + for i=1,#t do + if t[i] == extra then + remove(t,i) + end + end + for i=1,#t do + if t[i] == value then + insert(t,i+1,extra) + return + end end + insert(t,#t+1,extra) end -local separator = comma * space^0 -local value = lpeg.P(lbrace * lpeg.C((nobrace + nested)^0) * rbrace) + lpeg.C((nested + (1-comma))^0) -local pattern = lpeg.Ct(value*(separator*value)^0) - --- "aap, {noot}, mies" : outer {} removes, leading spaces ignored - -aux.settings_to_array_pattern = pattern +-- experimental --- we could use a weak table as cache +local function toxml(t,d,result) + for k, v in table.sortedpairs(t) do + if type(v) == "table" then + result[#result+1] = format("%s<%s>",d,k) + toxml(v,d.." ",result) + result[#result+1] = format("%s",d,k) + elseif tonumber(k) then + result[#result+1] = format("%s%s",d,k,v,k) + else + result[#result+1] = format("%s<%s>%s",d,k,tostring(v),k) + end + end +end -function aux.settings_to_array(str) - if not str or str == "" then - return { } +function table.toxml(t,name,nobanner) + local noroot = name == false + local result = (nobanner or noroot) and { } or { "" } + if noroot then + toxml( t, "", result) else - return lpegmatch(pattern,str) + toxml( { [name or "root"] = t }, "", result) end + return concat(result,"\n") end -local function set(t,v) - t[#t+1] = v -end -local value = lpeg.P(lpeg.Carg(1)*value) / set -local pattern = value*(separator*value)^0 * lpeg.Carg(1) +end -- of closure -function aux.add_settings_to_array(t,str) - return lpegmatch(pattern,str,nil,t) -end +do -- create closure to overcome 200 locals limit -function aux.hash_to_string(h,separator,yes,no,strict,omit) - if h then - local t, s = { }, table.sortedkeys(h) - omit = omit and table.tohash(omit) - for i=1,#s do - local key = s[i] - if not omit or not omit[key] then - local value = h[key] - if type(value) == "boolean" then - if yes and no then - if value then - t[#t+1] = key .. '=' .. yes - elseif not strict then - t[#t+1] = key .. '=' .. no - end - elseif value or not strict then - t[#t+1] = key .. '=' .. tostring(value) - end - else - t[#t+1] = key .. '=' .. value - end - end - end - return concat(t,separator or ",") - else - return "" - end -end +if not modules then modules = { } end modules ['util-sto'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} -function aux.array_to_string(a,separator) - if a then - return concat(a,separator or ",") - else - return "" +local setmetatable, getmetatable = setmetatable, getmetatable + +utilities = utilities or { } +utilities.storage = utilities.storage or { } +local storage = utilities.storage + +function storage.mark(t) + if not t then + texio.write_nl("fatal error: storage '%s' cannot be marked",t) + os.exit() + end + local m = getmetatable(t) + if not m then + m = { } + setmetatable(t,m) end + m.__storage__ = true + return t end -function aux.settings_to_set(str,t) +function storage.allocate(t) t = t or { } - for s in gmatch(str,"%s*([^,]+)") do - t[s] = true + local m = getmetatable(t) + if not m then + m = { } + setmetatable(t,m) end + m.__storage__ = true return t end -local value = lbrace * lpeg.C((nobrace + nested)^0) * rbrace -local pattern = lpeg.Ct((space + value)^0) +function storage.marked(t) + local m = getmetatable(t) + return m and m.__storage__ +end -function aux.arguments_to_table(str) - return lpegmatch(pattern,str) +function storage.checked(t) + if not t then + texio.write_nl("fatal error: storage '%s' has not been allocated",t) + os.exit() + end + return t end --- temporary here -function aux.getparameters(self,class,parentclass,settings) - local sc = self[class] - if not sc then - sc = table.clone(self[parent]) - self[class] = sc +function storage.setinitializer(data,initialize) + local m = getmetatable(data) or { } + m.__index = function(data,k) + m.__index = nil -- so that we can access the entries during initializing + initialize() + return data[k] end - aux.settings_to_hash(settings,sc) + setmetatable(data, m) end --- temporary here +local keyisvalue = { __index = function(t,k) + t[k] = k + return k +end } -local digit = lpeg.R("09") -local period = lpeg.P(".") -local zero = lpeg.P("0") -local trailingzeros = zero^0 * -digit -- suggested by Roberto R -local case_1 = period * trailingzeros / "" -local case_2 = period * (digit - trailingzeros)^1 * (trailingzeros / "") -local number = digit^1 * (case_1 + case_2) -local stripper = lpeg.Cs((number + 1)^0) +function storage.sparse(t) + t = t or { } + setmetatable(t,keyisvalue) + return t +end ---~ local sample = "bla 11.00 bla 11 bla 0.1100 bla 1.00100 bla 0.00 bla 0.001 bla 1.1100 bla 0.100100100 bla 0.00100100100" ---~ collectgarbage("collect") ---~ str = string.rep(sample,10000) ---~ local ts = os.clock() ---~ lpegmatch(stripper,str) ---~ print(#str, os.clock()-ts, lpegmatch(stripper,sample)) +-- table namespace ? -lpeg.patterns.strip_zeros = stripper +local function f_empty () return "" end -- t,k +local function f_self (t,k) t[k] = k return k end +local function f_ignore() end -- t,k,v -function aux.strip_zeros(str) - return lpegmatch(stripper,str) -end +local t_empty = { __index = empty } +local t_self = { __index = self } +local t_ignore = { __newindex = ignore } -function aux.definetable(target) -- defines undefined tables - local composed, t = nil, { } - for name in gmatch(target,"([^%.]+)") do - if composed then - composed = composed .. "." .. name +function table.setmetatableindex(t,f) + local m = getmetatable(t) + if m then + if f == "empty" then + m.__index = f_empty + elseif f == "key" then + m.__index = f_self else - composed = name + m.__index = f + end + else + if f == "empty" then + setmetatable(t, t_empty) + elseif f == "key" then + setmetatable(t, t_self) + else + setmetatable(t,{ __index = f }) end - t[#t+1] = format("%s = %s or { }",composed,composed) end - return concat(t,"\n") end -function aux.accesstable(target) - local t = _G - for name in gmatch(target,"([^%.]+)") do - t = t[name] +function table.setmetatablenewindex(t,f) + local m = getmetatable(t) + if m then + if f == "ignore" then + m.__newindex = f_ignore + else + m.__newindex = f + end + else + if f == "ignore" then + setmetatable(t, t_ignore) + else + setmetatable(t,{ __newindex = f }) + end end - return t end ---~ function string.commaseparated(str) ---~ return gmatch(str,"([^,%s]+)") ---~ end +function table.setmetatablecall(t,f) + local m = getmetatable(t) + if m then + m.__call = f + else + setmetatable(t,{ __call = f }) + end +end --- as we use this a lot ... +function table.setmetatablekey(t,key,value) + local m = getmetatable(t) + if not m then + m = { } + setmetatable(t,m) + end + m[key] = value +end ---~ function aux.cachefunction(action,weak) ---~ local cache = { } ---~ if weak then ---~ setmetatable(cache, { __mode = "kv" } ) ---~ end ---~ local function reminder(str) ---~ local found = cache[str] ---~ if not found then ---~ found = action(str) ---~ cache[str] = found ---~ end ---~ return found ---~ end ---~ return reminder, cache ---~ end +function table.getmetatablekey(t,key,value) + local m = getmetatable(t) + return m and m[key] +end end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['trac-tra'] = { +if not modules then modules = { } end modules ['util-mrg'] = { version = 1.001, - comment = "companion to trac-tra.mkiv", + comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } --- the tag is kind of generic and used for functions that are not --- bound to a variable, like node.new, node.copy etc (contrary to for instance --- node.has_attribute which is bound to a has_attribute local variable in mkiv) - -local debug = require "debug" +-- hm, quite unreadable -local getinfo = debug.getinfo -local type, next = type, next +local gsub, format = string.gsub, string.format local concat = table.concat -local format, find, lower, gmatch, gsub = string.format, string.find, string.lower, string.gmatch, string.gsub - -debugger = debugger or { } +local type, next = type, next -local counters = { } -local names = { } +utilities = utilities or {} +utilities.merger = utilities.merger or { } -- maybe mergers +utilities.report = logs and logs.reporter("system") or print --- one +local merger = utilities.merger -local function hook() - local f = getinfo(2,"f").func - local n = getinfo(2,"Sn") --- if n.what == "C" and n.name then print (n.namewhat .. ': ' .. n.name) end - if f then - local cf = counters[f] - if cf == nil then - counters[f] = 1 - names[f] = n - else - counters[f] = cf + 1 - end - end -end -local function getname(func) - local n = names[func] - if n then - if n.what == "C" then - return n.name or '' - else - -- source short_src linedefined what name namewhat nups func - local name = n.name or n.namewhat or n.what - if not name or name == "" then name = "?" end - return format("%s : %s : %s", n.short_src or "unknown source", n.linedefined or "--", name) - end - else - return "unknown" - end -end -function debugger.showstats(printer,threshold) - printer = printer or texio.write or print - threshold = threshold or 0 - local total, grandtotal, functions = 0, 0, 0 - printer("\n") -- ugly but ok - -- table.sort(counters) - for func, count in next, counters do - if count > threshold then - local name = getname(func) - if not find(name,"for generator") then - printer(format("%8i %s", count, name)) - total = total + count - end - end - grandtotal = grandtotal + count - functions = functions + 1 - end - printer(format("functions: %s, total: %s, grand total: %s, threshold: %s\n", functions, total, grandtotal, threshold)) -end +merger.strip_comment = true --- two +local m_begin_merge = "begin library merge" +local m_end_merge = "end library merge" +local m_begin_closure = "do -- create closure to overcome 200 locals limit" +local m_end_closure = "end -- of closure" ---~ local function hook() ---~ local n = getinfo(2) ---~ if n.what=="C" and not n.name then ---~ local f = tostring(debug.traceback()) ---~ local cf = counters[f] ---~ if cf == nil then ---~ counters[f] = 1 ---~ names[f] = n ---~ else ---~ counters[f] = cf + 1 ---~ end ---~ end ---~ end ---~ function debugger.showstats(printer,threshold) ---~ printer = printer or texio.write or print ---~ threshold = threshold or 0 ---~ local total, grandtotal, functions = 0, 0, 0 ---~ printer("\n") -- ugly but ok ---~ -- table.sort(counters) ---~ for func, count in next, counters do ---~ if count > threshold then ---~ printer(format("%8i %s", count, func)) ---~ total = total + count ---~ end ---~ grandtotal = grandtotal + count ---~ functions = functions + 1 ---~ end ---~ printer(format("functions: %s, total: %s, grand total: %s, threshold: %s\n", functions, total, grandtotal, threshold)) ---~ end +local m_pattern = + "%c+" .. + "%-%-%s+" .. m_begin_merge .. + "%c+(.-)%c+" .. + "%-%-%s+" .. m_end_merge .. + "%c+" --- rest +local m_format = + "\n\n-- " .. m_begin_merge .. + "\n%s\n" .. + "-- " .. m_end_merge .. "\n\n" -function debugger.savestats(filename,threshold) - local f = io.open(filename,'w') - if f then - debugger.showstats(function(str) f:write(str) end,threshold) - f:close() - end -end +local m_faked = + "-- " .. "created merged file" .. "\n\n" .. + "-- " .. m_begin_merge .. "\n\n" .. + "-- " .. m_end_merge .. "\n\n" -function debugger.enable() - debug.sethook(hook,"c") +local function self_fake() + return m_faked end -function debugger.disable() - debug.sethook() ---~ counters[debug.getinfo(2,"f").func] = nil +local function self_nothing() + return "" end -function debugger.tracing() - local n = tonumber(os.env['MTX.TRACE.CALLS']) or tonumber(os.env['MTX_TRACE_CALLS']) or 0 - if n > 0 then - function debugger.tracing() return true end ; return true +local function self_load(name) + local data = io.loaddata(name) or "" + if data == "" then + utilities.report("merge: unknown file %s",name) else - function debugger.tracing() return false end ; return false + utilities.report("merge: inserting %s",name) end + return data or "" end ---~ debugger.enable() - ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) - ---~ debugger.disable() - ---~ print("") ---~ debugger.showstats() ---~ print("") ---~ debugger.showstats(print,3) - -setters = setters or { } -setters.data = setters.data or { } +local function self_save(name, data) + if data ~= "" then + if merger.strip_comment then + -- saves some 20K + local n = #data + data = gsub(data,"%-%-~[^\n\r]*[\r\n]","") + utilities.report("merge: %s bytes of comment stripped, %s bytes of code left",n-#data,#data) + end + io.savedata(name,data) + utilities.report("merge: saving %s",name) + end +end ---~ local function set(t,what,value) ---~ local data, done = t.data, t.done ---~ if type(what) == "string" then ---~ what = aux.settings_to_array(what) -- inefficient but ok ---~ end ---~ for i=1,#what do ---~ local w = what[i] ---~ for d, f in next, data do ---~ if done[d] then ---~ -- prevent recursion due to wildcards ---~ elseif find(d,w) then ---~ done[d] = true ---~ for i=1,#f do ---~ f[i](value) ---~ end ---~ end ---~ end ---~ end ---~ end +local function self_swap(data,code) + return data ~= "" and (gsub(data,m_pattern, function() return format(m_format,code) end, 1)) or "" +end -local function set(t,what,value) - local data, done = t.data, t.done - if type(what) == "string" then - what = aux.settings_to_hash(what) -- inefficient but ok - end - for w, v in next, what do - if v == "" then - v = value - else - v = toboolean(v) +local function self_libs(libs,list) + local result, f, frozen, foundpath = { }, nil, false, nil + result[#result+1] = "\n" + if type(libs) == 'string' then libs = { libs } end + if type(list) == 'string' then list = { list } end + for i=1,#libs do + local lib = libs[i] + for j=1,#list do + local pth = gsub(list[j],"\\","/") -- file.clean_path + utilities.report("merge: checking library path %s",pth) + local name = pth .. "/" .. lib + if lfs.isfile(name) then + foundpath = pth + end end - for d, f in next, data do - if done[d] then - -- prevent recursion due to wildcards - elseif find(d,w) then - done[d] = true - for i=1,#f do - f[i](v) - end + if foundpath then break end + end + if foundpath then + utilities.report("merge: using library path %s",foundpath) + local right, wrong = { }, { } + for i=1,#libs do + local lib = libs[i] + local fullname = foundpath .. "/" .. lib + if lfs.isfile(fullname) then + utilities.report("merge: using library %s",fullname) + right[#right+1] = lib + result[#result+1] = m_begin_closure + result[#result+1] = io.loaddata(fullname,true) + result[#result+1] = m_end_closure + else + utilities.report("merge: skipping library %s",fullname) + wrong[#wrong+1] = lib end end + if #right > 0 then + utilities.report("merge: used libraries: %s",concat(right," ")) + end + if #wrong > 0 then + utilities.report("merge: skipped libraries: %s",concat(wrong," ")) + end + else + utilities.report("merge: no valid library path found") end + return concat(result, "\n\n") end -local function reset(t) - for d, f in next, t.data do - for i=1,#f do - f[i](false) - end +function merger.selfcreate(libs,list,target) + if target then + self_save(target,self_swap(self_fake(),self_libs(libs,list))) end end -local function enable(t,what) - set(t,what,true) +function merger.selfmerge(name,libs,list,target) + self_save(target or name,self_swap(self_load(name),self_libs(libs,list))) end -local function disable(t,what) - local data = t.data - if not what or what == "" then - t.done = { } - reset(t) - else - set(t,what,false) - end +function merger.selfclean(name) + self_save(name,self_swap(self_load(name),self_nothing())) end -function setters.register(t,what,...) - local data = t.data - what = lower(what) - local w = data[what] - if not w then - w = { } - data[what] = w + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['util-lua'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +utilities = utilities or {} +utilities.lua = utilities.lua or { } +utilities.report = logs and logs.reporter("system") or print + +function utilities.lua.compile(luafile,lucfile,cleanup,strip) -- defaults: cleanup=false strip=true + utilities.report("lua: compiling %s into %s",luafile,lucfile) + os.remove(lucfile) + local command = "-o " .. string.quoted(lucfile) .. " " .. string.quoted(luafile) + if strip ~= false then + command = "-s " .. command end - for _, fnc in next, { ... } do - local typ = type(fnc) - if typ == "function" then - w[#w+1] = fnc - elseif typ == "string" then - w[#w+1] = function(value) set(t,fnc,value,nesting) end - end + local done = os.spawn("texluac " .. command) == 0 or os.spawn("luac " .. command) == 0 + if done and cleanup == true and lfs.isfile(lucfile) and lfs.isfile(luafile) then + utilities.report("lua: removing %s",luafile) + os.remove(luafile) end + return done end -function setters.enable(t,what) - local e = t.enable - t.enable, t.done = enable, { } - enable(t,string.simpleesc(tostring(what))) - t.enable, t.done = e, { } -end -function setters.disable(t,what) - local e = t.disable - t.disable, t.done = disable, { } - disable(t,string.simpleesc(tostring(what))) - t.disable, t.done = e, { } -end -function setters.reset(t) - t.done = { } - reset(t) -end -function setters.list(t) -- pattern - local list = table.sortedkeys(t.data) - local user, system = { }, { } - for l=1,#list do - local what = list[l] - if find(what,"^%*") then + + + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['util-prs'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local P, R, V, C, Ct, Carg = lpeg.P, lpeg.R, lpeg.V, lpeg.C, lpeg.Ct, lpeg.Carg +local lpegmatch = lpeg.match +local concat, format, gmatch = table.concat, string.format, string.gmatch +local tostring, type, next = tostring, type, next + +utilities = utilities or {} +utilities.parsers = utilities.parsers or { } +local parsers = utilities.parsers +parsers.patterns = parsers.patterns or { } + +local setmetatableindex = table.setmetatableindex +local sortedhash = table.sortedhash + +-- we could use a Cf Cg construct + +local escape, left, right = P("\\"), P('{'), P('}') + +lpeg.patterns.balanced = P { + [1] = ((escape * (left+right)) + (1 - (left+right)) + V(2))^0, + [2] = left * V(1) * right +} + +local space = P(' ') +local equal = P("=") +local comma = P(",") +local lbrace = P("{") +local rbrace = P("}") +local nobrace = 1 - (lbrace+rbrace) +local nested = P { lbrace * (nobrace + V(1))^0 * rbrace } +local spaces = space^0 + +lpeg.patterns.nested = nested + +local value = P(lbrace * C((nobrace + nested)^0) * rbrace) + C((nested + (1-comma))^0) + +local key = C((1-equal-comma)^1) +local pattern_a = (space+comma)^0 * (key * equal * value + key * C("")) +local pattern_c = (space+comma)^0 * (key * equal * value) + +local key = C((1-space-equal-comma)^1) +local pattern_b = spaces * comma^0 * spaces * (key * ((spaces * equal * spaces * value) + C(""))) + +-- "a=1, b=2, c=3, d={a{b,c}d}, e=12345, f=xx{a{b,c}d}xx, g={}" : outer {} removes, leading spaces ignored + +local hash = { } + +local function set(key,value) + hash[key] = value +end + +local function set(key,value) + hash[key] = value +end + +local pattern_a_s = (pattern_a/set)^1 +local pattern_b_s = (pattern_b/set)^1 +local pattern_c_s = (pattern_c/set)^1 + +parsers.patterns.settings_to_hash_a = pattern_a_s +parsers.patterns.settings_to_hash_b = pattern_b_s +parsers.patterns.settings_to_hash_c = pattern_c_s + +function parsers.make_settings_to_hash_pattern(set,how) + if how == "strict" then + return (pattern_c/set)^1 + elseif how == "tolerant" then + return (pattern_b/set)^1 + else + return (pattern_a/set)^1 + end +end + +function parsers.settings_to_hash(str,existing) + if str and str ~= "" then + hash = existing or { } + lpegmatch(pattern_a_s,str) + return hash + else + return { } + end +end + +function parsers.settings_to_hash_tolerant(str,existing) + if str and str ~= "" then + hash = existing or { } + lpegmatch(pattern_b_s,str) + return hash + else + return { } + end +end + +function parsers.settings_to_hash_strict(str,existing) + if str and str ~= "" then + hash = existing or { } + lpegmatch(pattern_c_s,str) + return next(hash) and hash + else + return nil + end +end + +local separator = comma * space^0 +local value = P(lbrace * C((nobrace + nested)^0) * rbrace) + C((nested + (1-comma))^0) +local pattern = Ct(value*(separator*value)^0) + +-- "aap, {noot}, mies" : outer {} removes, leading spaces ignored + +parsers.patterns.settings_to_array = pattern + +-- we could use a weak table as cache + +function parsers.settings_to_array(str) + if not str or str == "" then + return { } + else + return lpegmatch(pattern,str) + end +end + +local function set(t,v) + t[#t+1] = v +end + +local value = P(Carg(1)*value) / set +local pattern = value*(separator*value)^0 * Carg(1) + +function parsers.add_settings_to_array(t,str) + return lpegmatch(pattern,str,nil,t) +end + +function parsers.hash_to_string(h,separator,yes,no,strict,omit) + if h then + local t, tn, s = { }, 0, table.sortedkeys(h) + omit = omit and table.tohash(omit) + for i=1,#s do + local key = s[i] + if not omit or not omit[key] then + local value = h[key] + if type(value) == "boolean" then + if yes and no then + if value then + tn = tn + 1 + t[tn] = key .. '=' .. yes + elseif not strict then + tn = tn + 1 + t[tn] = key .. '=' .. no + end + elseif value or not strict then + tn = tn + 1 + t[tn] = key .. '=' .. tostring(value) + end + else + tn = tn + 1 + t[tn] = key .. '=' .. value + end + end + end + return concat(t,separator or ",") + else + return "" + end +end + +function parsers.array_to_string(a,separator) + if a then + return concat(a,separator or ",") + else + return "" + end +end + +function parsers.settings_to_set(str,t) -- tohash? -- todo: lpeg -- duplicate anyway + t = t or { } +-- for s in gmatch(str,"%s*([^, ]+)") do -- space added + for s in gmatch(str,"[^, ]+") do -- space added + t[s] = true + end + return t +end + +function parsers.simple_hash_to_string(h, separator) + local t, tn = { }, 0 + for k, v in sortedhash(h) do + if v then + tn = tn + 1 + t[tn] = k + end + end + return concat(t,separator or ",") +end + +local value = lbrace * C((nobrace + nested)^0) * rbrace +local pattern = Ct((space + value)^0) + +function parsers.arguments_to_table(str) + return lpegmatch(pattern,str) +end + +-- temporary here (unoptimized) + +function parsers.getparameters(self,class,parentclass,settings) + local sc = self[class] + if not sc then + sc = { } + self[class] = sc + if parentclass then + local sp = self[parentclass] + if not sp then + sp = { } + self[parentclass] = sp + end + setmetatableindex(sc,sp) + end + end + parsers.settings_to_hash(settings,sc) +end + +function parsers.listitem(str) + return gmatch(str,"[^, ]+") +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['util-fmt'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +utilities = utilities or { } +utilities.formatters = utilities.formatters or { } +local formatters = utilities.formatters + +local concat, format = table.concat, string.format +local tostring, type = tostring, type +local strip = string.strip + +local P, R, Cs = lpeg.P, lpeg.R, lpeg.Cs +local lpegmatch = lpeg.match + +-- temporary here + +local digit = R("09") +local period = P(".") +local zero = P("0") +local trailingzeros = zero^0 * -digit -- suggested by Roberto R +local case_1 = period * trailingzeros / "" +local case_2 = period * (digit - trailingzeros)^1 * (trailingzeros / "") +local number = digit^1 * (case_1 + case_2) +local stripper = Cs((number + 1)^0) + + +lpeg.patterns.stripzeros = stripper + +function formatters.stripzeros(str) + return lpegmatch(stripper,str) +end + +function formatters.formatcolumns(result,between) + if result and #result > 0 then + between = between or " " + local widths, numbers = { }, { } + local first = result[1] + local n = #first + for i=1,n do + widths[i] = 0 + end + for i=1,#result do + local r = result[i] + for j=1,n do + local rj = r[j] + local tj = type(rj) + if tj == "number" then + numbers[j] = true + end + if tj ~= "string" then + rj = tostring(rj) + r[j] = rj + end + local w = #rj + if w > widths[j] then + widths[j] = w + end + end + end + for i=1,n do + local w = widths[i] + if numbers[i] then + if w > 80 then + widths[i] = "%s" .. between + else + widths[i] = "%0" .. w .. "i" .. between + end + else + if w > 80 then + widths[i] = "%s" .. between + elseif w > 0 then + widths[i] = "%-" .. w .. "s" .. between + else + widths[i] = "%s" + end + end + end + local template = strip(concat(widths)) + for i=1,#result do + local str = format(template,unpack(result[i])) + result[i] = strip(str) + end + end + return result +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['util.deb'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- the tag is kind of generic and used for functions that are not +-- bound to a variable, like node.new, node.copy etc (contrary to for instance +-- node.has_attribute which is bound to a has_attribute local variable in mkiv) + +local debug = require "debug" + +local getinfo = debug.getinfo +local type, next, tostring = type, next, tostring +local format, find = string.format, string.find +local is_boolean = string.is_boolean + +utilities = utilities or { } +utilities.debugger = utilities.debugger or { } +local debugger = utilities.debugger + +local counters = { } +local names = { } + +-- one + +local function hook() + local f = getinfo(2,"f").func + local n = getinfo(2,"Sn") +-- if n.what == "C" and n.name then print (n.namewhat .. ': ' .. n.name) end + if f then + local cf = counters[f] + if cf == nil then + counters[f] = 1 + names[f] = n + else + counters[f] = cf + 1 + end + end +end + +local function getname(func) + local n = names[func] + if n then + if n.what == "C" then + return n.name or '' + else + -- source short_src linedefined what name namewhat nups func + local name = n.name or n.namewhat or n.what + if not name or name == "" then name = "?" end + return format("%s : %s : %s", n.short_src or "unknown source", n.linedefined or "--", name) + end + else + return "unknown" + end +end + +function debugger.showstats(printer,threshold) + printer = printer or texio.write or print + threshold = threshold or 0 + local total, grandtotal, functions = 0, 0, 0 + printer("\n") -- ugly but ok + -- table.sort(counters) + for func, count in next, counters do + if count > threshold then + local name = getname(func) + if not find(name,"for generator") then + printer(format("%8i %s", count, name)) + total = total + count + end + end + grandtotal = grandtotal + count + functions = functions + 1 + end + printer(format("functions: %s, total: %s, grand total: %s, threshold: %s\n", functions, total, grandtotal, threshold)) +end + +-- two + + +-- rest + +function debugger.savestats(filename,threshold) + local f = io.open(filename,'w') + if f then + debugger.showstats(function(str) f:write(str) end,threshold) + f:close() + end +end + +function debugger.enable() + debug.sethook(hook,"c") +end + +function debugger.disable() + debug.sethook() +end + + + + + +local is_node = node and node.is_node + +function inspect(i) -- global function + local ti = type(i) + if ti == "table" then + table.print(i,"table") + elseif is_node and is_node(i) then + table.print(nodes.astable(i),tostring(i)) + else + print(tostring(i)) + end +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['trac-inf'] = { + version = 1.001, + comment = "companion to trac-inf.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- As we want to protect the global tables, we no longer store the timing +-- in the tables themselves but in a hidden timers table so that we don't +-- get warnings about assignments. This is more efficient than using rawset +-- and rawget. + +local format = string.format +local clock = os.gettimeofday or os.clock -- should go in environment +local write_nl = texio.write_nl + +statistics = statistics or { } +local statistics = statistics + +statistics.enable = true +statistics.threshold = 0.05 + +local statusinfo, n, registered, timers = { }, 0, { }, { } + +local function hastiming(instance) + return instance and timers[instance] +end + +local function resettiming(instance) + timers[instance or "notimer"] = { timing = 0, loadtime = 0 } +end + +local function starttiming(instance) + local timer = timers[instance or "notimer"] + if not timer then + timer = { } + timers[instance or "notimer"] = timer + end + local it = timer.timing + if not it then + it = 0 + end + if it == 0 then + timer.starttime = clock() + if not timer.loadtime then + timer.loadtime = 0 + end + end + timer.timing = it + 1 +end + +local function stoptiming(instance, report) + local timer = timers[instance or "notimer"] + local it = timer.timing + if it > 1 then + timer.timing = it - 1 + else + local starttime = timer.starttime + if starttime then + local stoptime = clock() + local loadtime = stoptime - starttime + timer.stoptime = stoptime + timer.loadtime = timer.loadtime + loadtime + if report then + statistics.report("load time %0.3f",loadtime) + end + timer.timing = 0 + return loadtime + end + end + return 0 +end + +local function elapsedtime(instance) + local timer = timers[instance or "notimer"] + return format("%0.3f",timer and timer.loadtime or 0) +end + +local function elapsedindeed(instance) + local timer = timers[instance or "notimer"] + return (timer and timer.loadtime or 0) > statistics.threshold +end + +local function elapsedseconds(instance,rest) -- returns nil if 0 seconds + if elapsedindeed(instance) then + return format("%s seconds %s", elapsedtime(instance),rest or "") + end +end + +statistics.hastiming = hastiming +statistics.resettiming = resettiming +statistics.starttiming = starttiming +statistics.stoptiming = stoptiming +statistics.elapsedtime = elapsedtime +statistics.elapsedindeed = elapsedindeed +statistics.elapsedseconds = elapsedseconds + +-- general function + +function statistics.register(tag,fnc) + if statistics.enable and type(fnc) == "function" then + local rt = registered[tag] or (#statusinfo + 1) + statusinfo[rt] = { tag, fnc } + registered[tag] = rt + if #tag > n then n = #tag end + end +end + +function statistics.show(reporter) + if statistics.enable then + if not reporter then reporter = function(tag,data,n) write_nl(tag .. " " .. data) end end + -- this code will move + local register = statistics.register + register("luatex banner", function() + return string.lower(status.banner) + end) + register("control sequences", function() + return format("%s of %s", status.cs_count, status.hash_size+status.hash_extra) + end) + register("callbacks", function() + local total, indirect = status.callbacks or 0, status.indirect_callbacks or 0 + return format("%s direct, %s indirect, %s total", total-indirect, indirect, total) + end) + collectgarbage("collect") + register("current memory usage", statistics.memused) + register("runtime",statistics.runtime) + for i=1,#statusinfo do + local s = statusinfo[i] + local r = s[2]() + if r then + reporter(s[1],r,n) + end + end + write_nl("") -- final newline + statistics.enable = false + end +end + +local template, report_statistics, nn = nil, nil, 0 -- we only calcute it once + +function statistics.showjobstat(tag,data,n) + if not logs then + -- sorry + elseif type(data) == "table" then + for i=1,#data do + statistics.showjobstat(tag,data[i],n) + end + else + if not template or n > nn then + template, n = format("%%-%ss - %%s",n), nn + report_statistics = logs.reporter("mkiv lua stats") + end + report_statistics(format(template,tag,data)) + end +end + +function statistics.memused() -- no math.round yet -) + local round = math.round or math.floor + return format("%s MB (ctx: %s MB)",round(collectgarbage("count")/1000), round(status.luastate_bytes/1000000)) +end + +starttiming(statistics) + +function statistics.formatruntime(runtime) -- indirect so it can be overloaded and + return format("%s seconds", runtime) -- indeed that happens in cure-uti.lua +end + +function statistics.runtime() + stoptiming(statistics) + return statistics.formatruntime(elapsedtime(statistics)) +end + +function statistics.timed(action,report) + report = report or logs.reporter("system") + starttiming("run") + action() + stoptiming("run") + report("total runtime: %s",elapsedtime("run")) +end + +-- where, not really the best spot for this: + +commands = commands or { } + +function commands.resettimer(name) + resettiming(name or "whatever") + starttiming(name or "whatever") +end + +function commands.elapsedtime(name) + stoptiming(name or "whatever") + tex.sprint(elapsedtime(name or "whatever")) +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['trac-set'] = { -- might become util-set.lua + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local type, next, tostring = type, next, tostring +local concat = table.concat +local format, find, lower, gsub, escapedpattern = string.format, string.find, string.lower, string.gsub, string.escapedpattern +local is_boolean = string.is_boolean +local settings_to_hash = utilities.parsers.settings_to_hash +local allocate = utilities.storage.allocate + +utilities = utilities or { } +local utilities = utilities +utilities.setters = utilities.setters or { } +local setters = utilities.setters + +local data = { } -- maybe just local + +-- We can initialize from the cnf file. This is sort of tricky as +-- later defined setters also need to be initialized then. If set +-- this way, we need to ensure that they are not reset later on. + +local trace_initialize = false -- only for testing during development + +function setters.initialize(filename,name,values) -- filename only for diagnostics + local setter = data[name] + if setter then + local data = setter.data + if data then + for key, value in next, values do + -- key = gsub(key,"_",".") + value = is_boolean(value,value) + local functions = data[key] + if functions then + if #functions > 0 and not functions.value then + if trace_initialize then + setter.report("executing %s (%s -> %s)",key,filename,tostring(value)) + end + for i=1,#functions do + functions[i](value) + end + functions.value = value + else + if trace_initialize then + setter.report("skipping %s (%s -> %s)",key,filename,tostring(value)) + end + end + else + -- we do a simple preregistration i.e. not in the + -- list as it might be an obsolete entry + functions = { default = value } + data[key] = functions + if trace_initialize then + setter.report("storing %s (%s -> %s)",key,filename,tostring(value)) + end + end + end + return true + end + end +end + +-- user interface code + +local function set(t,what,newvalue) + local data, done = t.data, t.done + if type(what) == "string" then + what = settings_to_hash(what) -- inefficient but ok + end + if type(what) ~= "table" then + return + end + for w, value in next, what do + if value == "" then + value = newvalue + elseif not value then + value = false -- catch nil + else + value = is_boolean(value,value) + end + w = "^" .. escapedpattern(w,true) .. "$" -- new: anchored + for name, functions in next, data do + if done[name] then + -- prevent recursion due to wildcards + elseif find(name,w) then + done[name] = true + for i=1,#functions do + functions[i](value) + end + functions.value = value + end + end + end +end + +local function reset(t) + for name, functions in next, t.data do + for i=1,#functions do + functions[i](false) + end + functions.value = false + end +end + +local function enable(t,what) + set(t,what,true) +end + +local function disable(t,what) + local data = t.data + if not what or what == "" then + t.done = { } + reset(t) + else + set(t,what,false) + end +end + +function setters.register(t,what,...) + local data = t.data + what = lower(what) + local functions = data[what] + if not functions then + functions = { } + data[what] = functions + if trace_initialize then + t.report("defining %s",what) + end + end + local default = functions.default -- can be set from cnf file + for _, fnc in next, { ... } do + local typ = type(fnc) + if typ == "string" then + if trace_initialize then + t.report("coupling %s to %s",what,fnc) + end + local s = fnc -- else wrong reference + fnc = function(value) set(t,s,value) end + elseif typ ~= "function" then + fnc = nil + end + if fnc then + functions[#functions+1] = fnc + -- default: set at command line or in cnf file + -- value : set in tex run (needed when loading runtime) + local value = functions.value or default + if value ~= nil then + fnc(value) + functions.value = value + end + end + end + return false -- so we can use it in an assignment +end + +function setters.enable(t,what) + local e = t.enable + t.enable, t.done = enable, { } + enable(t,what) + t.enable, t.done = e, { } +end + +function setters.disable(t,what) + local e = t.disable + t.disable, t.done = disable, { } + disable(t,what) + t.disable, t.done = e, { } +end + +function setters.reset(t) + t.done = { } + reset(t) +end + +function setters.list(t) -- pattern + local list = table.sortedkeys(t.data) + local user, system = { }, { } + for l=1,#list do + local what = list[l] + if find(what,"^%*") then system[#system+1] = what else - user[#user+1] = what + user[#user+1] = what + end + end + return user, system +end + +function setters.show(t) + local category = t.name + local list = setters.list(t) + t.report() + for k=1,#list do + local name = list[k] + local functions = t.data[name] + if functions then + local value, default, modules = functions.value, functions.default, #functions + value = value == nil and "unset" or tostring(value) + default = default == nil and "unset" or tostring(default) + t.report("%-30s modules: %2i default: %6s value: %6s",name,modules,default,value) + end + end + t.report() +end + +-- we could have used a bit of oo and the trackers:enable syntax but +-- there is already a lot of code around using the singular tracker + +-- we could make this into a module but we also want the rest avaliable + +local enable, disable, register, list, show = setters.enable, setters.disable, setters.register, setters.list, setters.show + +local function report(setter,...) + local report = logs and logs.report + if report then + report(setter.name,...) + else -- fallback, as this module is loaded before the logger + write_nl(format("%-15s : %s\n",setter.name,format(...))) + end +end + +function setters.new(name) + local setter -- we need to access it in setter itself + setter = { + data = allocate(), -- indexed, but also default and value fields + name = name, + report = function(...) report (setter,...) end, + enable = function(...) enable (setter,...) end, + disable = function(...) disable (setter,...) end, + register = function(...) register(setter,...) end, + list = function(...) list (setter,...) end, + show = function(...) show (setter,...) end, + } + data[name] = setter + return setter +end + +trackers = setters.new("trackers") +directives = setters.new("directives") +experiments = setters.new("experiments") + +local t_enable, t_disable, t_report = trackers .enable, trackers .disable, trackers .report +local d_enable, d_disable, d_report = directives .enable, directives .disable, directives .report +local e_enable, e_disable, e_report = experiments.enable, experiments.disable, experiments.report + +-- nice trick: we overload two of the directives related functions with variants that +-- do tracing (itself using a tracker) .. proof of concept + +local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end) +local trace_experiments = false local trace_experiments = false trackers.register("system.experiments", function(v) trace_experiments = v end) + +function directives.enable(...) + if trace_directives then + d_report("enabling: %s",concat({...}," ")) + end + d_enable(...) +end + +function directives.disable(...) + if trace_directives then + d_report("disabling: %s",concat({...}," ")) + end + d_disable(...) +end + +function experiments.enable(...) + if trace_experiments then + e_report("enabling: %s",concat({...}," ")) + end + e_enable(...) +end + +function experiments.disable(...) + if trace_experiments then + e_report("disabling: %s",concat({...}," ")) + end + e_disable(...) +end + +-- a useful example + +directives.register("system.nostatistics", function(v) + statistics.enable = not v +end) + +directives.register("system.nolibraries", function(v) + libraries = nil -- we discard this tracing for security +end) + +-- experiment + +local flags = environment and environment.engineflags + +if flags then + if trackers and flags.trackers then + setters.initialize("flags","trackers", settings_to_hash(flags.trackers)) + -- t_enable(flags.trackers) + end + if directives and flags.directives then + setters.initialize("flags","directives", settings_to_hash(flags.directives)) + -- d_enable(flags.directives) + end +end + +-- here + +if texconfig then + + local function set(k,v) + v = tonumber(v) + if v then + texconfig[k] = v + end + end + + directives.register("luatex.expanddepth", function(v) set("expand_depth",v) end) + directives.register("luatex.hashextra", function(v) set("hash_extra",v) end) + directives.register("luatex.nestsize", function(v) set("nest_size",v) end) + directives.register("luatex.maxinopen", function(v) set("max_in_open",v) end) + directives.register("luatex.maxprintline", function(v) set("max_print_line",v) end) + directives.register("luatex.maxstrings", function(v) set("max_strings",v) end) + directives.register("luatex.paramsize", function(v) set("param_size",v) end) + directives.register("luatex.savesize", function(v) set("save_size",v) end) + directives.register("luatex.stacksize", function(v) set("stack_size",v) end) + +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['trac-log'] = { + version = 1.001, + comment = "companion to trac-log.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- todo: less categories, more subcategories (e.g. nodes) + + +local write_nl, write = texio and texio.write_nl or print, texio and texio.write or io.write +local format, gmatch, find = string.format, string.gmatch, string.find +local concat, insert, remove = table.concat, table.insert, table.remove +local escapedpattern = string.escapedpattern +local texcount = tex and tex.count +local next, type = next, type + +local setmetatableindex = table.setmetatableindex + +--[[ldx-- +

This is a prelude to a more extensive logging module. We no longer +provide based logging a sparsing is relatively easy anyway.

+--ldx]]-- + +logs = logs or { } +local logs = logs + +local moreinfo = [[ +More information about ConTeXt and the tools that come with it can be found at: + +maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context +webpage : http://www.pragma-ade.nl / http://tex.aanhet.net +wiki : http://contextgarden.net +]] + +-- basic loggers + +local function ignore() end + +setmetatableindex(logs, function(t,k) t[k] = ignore ; return ignore end) + +local report, subreport, status, settarget, setformats, settranslations + +local direct, subdirect, writer, pushtarget, poptarget + +if tex and tex.jobname or tex.formatname then + + local valueiskey = { __index = function(t,k) t[k] = k return k end } -- will be helper + + local target = "term and log" + + logs.flush = io.flush + + local formats = { } setmetatable(formats, valueiskey) + local translations = { } setmetatable(translations,valueiskey) + + writer = function(...) + write_nl(target,...) + end + + report = function(a,b,c,...) + if c then + write_nl(target,format("%-15s > %s\n",translations[a],format(formats[b],c,...))) + elseif b then + write_nl(target,format("%-15s > %s\n",translations[a],formats[b])) + elseif a then + write_nl(target,format("%-15s >\n", translations[a])) + else + write_nl(target,"\n") + end + end + + direct = function(a,b,c,...) + if c then + return format("%-15s > %s",translations[a],format(formats[b],c,...)) + elseif b then + return format("%-15s > %s",translations[a],formats[b]) + elseif a then + return format("%-15s >", translations[a]) + else + return "" + end + end + + subreport = function(a,s,b,c,...) + if c then + write_nl(target,format("%-15s > %s > %s\n",translations[a],translations[s],format(formats[b],c,...))) + elseif b then + write_nl(target,format("%-15s > %s > %s\n",translations[a],translations[s],formats[b])) + elseif a then + write_nl(target,format("%-15s > %s >\n", translations[a],translations[s])) + else + write_nl(target,"\n") + end + end + + subdirect = function(a,s,b,c,...) + if c then + return format("%-15s > %s > %s",translations[a],translations[s],format(formats[b],c,...)) + elseif b then + return format("%-15s > %s > %s",translations[a],translations[s],formats[b]) + elseif a then + return format("%-15s > %s >", translations[a],translations[s]) + else + return "" + end + end + + status = function(a,b,c,...) + if c then + write_nl(target,format("%-15s : %s\n",translations[a],format(formats[b],c,...))) + elseif b then + write_nl(target,format("%-15s : %s\n",translations[a],formats[b])) + elseif a then + write_nl(target,format("%-15s :\n", translations[a])) + else + write_nl(target,"\n") + end + end + + local targets = { + logfile = "log", + log = "log", + file = "log", + console = "term", + terminal = "term", + both = "term and log", + } + + settarget = function(whereto) + target = targets[whereto or "both"] or targets.both + if target == "term" or target == "term and log" then + logs.flush = io.flush + else + logs.flush = ignore + end + end + + local stack = { } + + pushtarget = function(newtarget) + insert(stack,target) + settarget(newtarget) + end + + poptarget = function() + if #stack > 0 then + settarget(remove(stack)) + end + end + + setformats = function(f) + formats = f + end + + settranslations = function(t) + translations = t + end + +else + + logs.flush = ignore + + writer = write_nl + + report = function(a,b,c,...) + if c then + write_nl(format("%-15s | %s",a,format(b,c,...))) + elseif b then + write_nl(format("%-15s | %s",a,b)) + elseif a then + write_nl(format("%-15s |", a)) + else + write_nl("") + end + end + + subreport = function(a,sub,b,c,...) + if c then + write_nl(format("%-15s | %s | %s",a,sub,format(b,c,...))) + elseif b then + write_nl(format("%-15s | %s | %s",a,sub,b)) + elseif a then + write_nl(format("%-15s | %s |", a,sub)) + else + write_nl("") + end + end + + status = function(a,b,c,...) -- not to be used in lua anyway + if c then + write_nl(format("%-15s : %s\n",a,format(b,c,...))) + elseif b then + write_nl(format("%-15s : %s\n",a,b)) -- b can have %'s + elseif a then + write_nl(format("%-15s :\n", a)) + else + write_nl("\n") + end + end + + direct = ignore + subdirect = ignore + + settarget = ignore + pushtarget = ignore + poptarget = ignore + setformats = ignore + settranslations = ignore + +end + +logs.report = report +logs.subreport = subreport +logs.status = status +logs.settarget = settarget +logs.pushtarget = pushtarget +logs.poptarget = poptarget +logs.setformats = setformats +logs.settranslations = settranslations + +logs.direct = direct +logs.subdirect = subdirect +logs.writer = writer + +-- installer + +-- todo: renew (un) locks when a new one is added and wildcard + +local data, states = { }, nil + +function logs.reporter(category,subcategory) + local logger = data[category] + if not logger then + local state = false + if states == true then + state = true + elseif type(states) == "table" then + for c, _ in next, states do + if find(category,c) then + state = true + break + end + end + end + logger = { + reporters = { }, + state = state, + } + data[category] = logger + end + local reporter = logger.reporters[subcategory or "default"] + if not reporter then + if subcategory then + reporter = function(...) + if not logger.state then + subreport(category,subcategory,...) + end + end + logger.reporters[subcategory] = reporter + else + local tag = category + reporter = function(...) + if not logger.state then + report(category,...) + end + end + logger.reporters.default = reporter + end + end + return reporter +end + +logs.new = logs.reporter -- for old times sake + +-- context specicific: this ends up in the macro stream + +local ctxreport = logs.writer + +function logs.setmessenger(m) + ctxreport = m +end + +function logs.messenger(category,subcategory) + -- we need to avoid catcode mess (todo: fast context) + if subcategory then + return function(...) + ctxreport(subdirect(category,subcategory,...)) + end + else + return function(...) + ctxreport(direct(category,...)) + end + end +end + +-- so far + +local function setblocked(category,value) + if category == true then + -- lock all + category, value = "*", true + elseif category == false then + -- unlock all + category, value = "*", false + elseif value == nil then + -- lock selective + value = true + end + if category == "*" then + states = value + for k, v in next, data do + v.state = value + end + else + states = utilities.parsers.settings_to_hash(category) + for c, _ in next, states do + if data[c] then + v.state = value + else + c = escapedpattern(c,true) + for k, v in next, data do + if find(k,c) then + v.state = value + end + end + end + end + end +end + +function logs.disable(category,value) + setblocked(category,value == nil and true or value) +end + +function logs.enable(category) + setblocked(category,false) +end + +function logs.categories() + return table.sortedkeys(data) +end + +function logs.show() + local n, c, s, max = 0, 0, 0, 0 + for category, v in table.sortedpairs(data) do + n = n + 1 + local state = v.state + local reporters = v.reporters + local nc = #category + if nc > c then + c = nc + end + for subcategory, _ in next, reporters do + local ns = #subcategory + if ns > c then + s = ns + end + local m = nc + ns + if m > max then + max = m + end + end + local subcategories = concat(table.sortedkeys(reporters),", ") + if state == true then + state = "disabled" + elseif state == false then + state = "enabled" + else + state = "unknown" + end + -- no new here + report("logging","category: '%s', subcategories: '%s', state: '%s'",category,subcategories,state) + end + report("logging","categories: %s, max category: %s, max subcategory: %s, max combined: %s",n,c,s,max) +end + +directives.register("logs.blocked", function(v) + setblocked(v,true) +end) + +directives.register("logs.target", function(v) + settarget(v) +end) + +-- tex specific loggers (might move elsewhere) + +local report_pages = logs.reporter("pages") -- not needed but saves checking when we grep for it + +local real, user, sub + +function logs.start_page_number() + real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno +end + +function logs.stop_page_number() + if real > 0 then + if user > 0 then + if sub > 0 then + report_pages("flushing realpage %s, userpage %s, subpage %s",real,user,sub) + else + report_pages("flushing realpage %s, userpage %s",real,user) + end + else + report_pages("flushing realpage %s",real) + end + else + report_pages("flushing page") + end + logs.flush() +end + +logs.report_job_stat = statistics and statistics.showjobstat + +local report_files = logs.reporter("files") + +local nesting = 0 +local verbose = false +local hasscheme = url.hasscheme + +-- we don't have show_open and show_close callbacks yet + +function logs.show_open(name) + -- if hasscheme(name) ~= "virtual" then + -- if verbose then + -- nesting = nesting + 1 + -- report_files("level %s, opening %s",nesting,name) + -- else + -- write(format("(%s",name)) -- tex adds a space + -- end + -- end +end + +function logs.show_close(name) + -- if hasscheme(name) ~= "virtual" then + -- if verbose then + -- report_files("level %s, closing %s",nesting,name) + -- nesting = nesting - 1 + -- else + -- write(")") -- tex adds a space + -- end + -- end +end + +function logs.show_load(name) + -- if hasscheme(name) ~= "virtual" then + -- if verbose then + -- report_files("level %s, loading %s",nesting+1,name) + -- else + -- write(format("(%s)",name)) + -- end + -- end +end + +-- there may be scripts out there using this: + +local simple = logs.reporter("comment") + +logs.simple = simple +logs.simpleline = simple + +-- obsolete + +function logs.setprogram () end -- obsolete +function logs.extendbanner() end -- obsolete +function logs.reportlines () end -- obsolete +function logs.reportbanner() end -- obsolete +function logs.reportline () end -- obsolete +function logs.simplelines () end -- obsolete +function logs.help () end -- obsolete + +-- applications + +local function reportlines(t,str) + if str then + for line in gmatch(str,"(.-)[\n\r]") do + t.report(line) + end + end +end + +local function reportbanner(t) + local banner = t.banner + if banner then + t.report(banner) + t.report() + end +end + +local function reporthelp(t,...) + local helpinfo = t.helpinfo + if type(helpinfo) == "string" then + reportlines(t,helpinfo) + elseif type(helpinfo) == "table" then + local tags = { ... } + for i=1,#tags do + reportlines(t,t.helpinfo[tags[i]]) + if i < #tags then + t.report() + end + end + end +end + +local function reportinfo(t) + t.report() + reportlines(t,moreinfo) +end + +function logs.application(t) + t.name = t.name or "unknown" + t.banner = t.banner + t.report = logs.reporter(t.name) + t.help = function(...) reportbanner(t) ; reporthelp(t,...) ; reportinfo(t) end + t.identify = function() reportbanner(t) end + return t +end + +-- somewhat special + +-- logging to a file + + +function logs.system(whereto,process,jobname,category,...) + local message = format("%s %s => %s => %s => %s\r",os.date("%d/%m/%y %H:%m:%S"),process,jobname,category,format(...)) + for i=1,10 do + local f = io.open(whereto,"a") -- we can consider keepint the file open + if f then + f:write(message) + f:close() + break + else + sleep(0.1) + end + end +end + +local report_system = logs.reporter("system","logs") + +function logs.obsolete(old,new) + local o = loadstring("return " .. new)() + if type(o) == "function" then + return function(...) + report_system("function %s is obsolete, use %s",old,new) + loadstring(old .. "=" .. new .. " return ".. old)()(...) + end + elseif type(o) == "table" then + local t, m = { }, { } + m.__index = function(t,k) + report_system("table %s is obsolete, use %s",old,new) + m.__index, m.__newindex = o, o + return o[k] + end + m.__newindex = function(t,k,v) + report_system("table %s is obsolete, use %s",old,new) + m.__index, m.__newindex = o, o + o[k] = v + end + if libraries then + libraries.obsolete[old] = t -- true + end + setmetatable(t,m) + return t + end +end + +if utilities then + utilities.report = report_system +end + +if tex and tex.error then + function logs.texerrormessage(...) -- for the moment we put this function here + tex.error(format(...), { }) + end +else + function logs.texerrormessage(...) + print(format(...)) + end +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['trac-pro'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local getmetatable, setmetatable, rawset, type = getmetatable, setmetatable, rawset, type + +-- The protection implemented here is probably not that tight but good enough to catch +-- problems due to naive usage. +-- +-- There's a more extensive version (trac-xxx.lua) that supports nesting. +-- +-- This will change when we have _ENV in lua 5.2+ + +local trace_namespaces = false trackers.register("system.namespaces", function(v) trace_namespaces = v end) + +local report_system = logs.reporter("system","protection") + +namespaces = namespaces or { } +local namespaces = namespaces + +local registered = { } + +local function report_index(k,name) + if trace_namespaces then + report_system("reference to '%s' in protected namespace '%s', %s",k,name,debug.traceback()) + else + report_system("reference to '%s' in protected namespace '%s'",k,name) + end +end + +local function report_newindex(k,name) + if trace_namespaces then + report_system("assignment to '%s' in protected namespace '%s', %s",k,name,debug.traceback()) + else + report_system("assignment to '%s' in protected namespace '%s'",k,name) + end +end + +local function register(name) + local data = name == "global" and _G or _G[name] + if not data then + return -- error + end + registered[name] = data + local m = getmetatable(data) + if not m then + m = { } + setmetatable(data,m) + end + local index, newindex = { }, { } + m.__saved__index = m.__index + m.__no__index = function(t,k) + if not index[k] then + index[k] = true + report_index(k,name) + end + return nil + end + m.__saved__newindex = m.__newindex + m.__no__newindex = function(t,k,v) + if not newindex[k] then + newindex[k] = true + report_newindex(k,name) + end + rawset(t,k,v) + end + m.__protection__depth = 0 +end + +local function private(name) -- maybe save name + local data = registered[name] + if not data then + data = _G[name] + if not data then + data = { } + _G[name] = data + end + register(name) + end + return data +end + +local function protect(name) + local data = registered[name] + if not data then + return + end + local m = getmetatable(data) + local pd = m.__protection__depth + if pd > 0 then + m.__protection__depth = pd + 1 + else + m.__save_d_index, m.__saved__newindex = m.__index, m.__newindex + m.__index, m.__newindex = m.__no__index, m.__no__newindex + m.__protection__depth = 1 + end +end + +local function unprotect(name) + local data = registered[name] + if not data then + return + end + local m = getmetatable(data) + local pd = m.__protection__depth + if pd > 1 then + m.__protection__depth = pd - 1 + else + m.__index, m.__newindex = m.__saved__index, m.__saved__newindex + m.__protection__depth = 0 + end +end + +local function protectall() + for name, _ in next, registered do + if name ~= "global" then + protect(name) + end + end +end + +local function unprotectall() + for name, _ in next, registered do + if name ~= "global" then + unprotect(name) + end + end +end + +namespaces.register = register -- register when defined +namespaces.private = private -- allocate and register if needed +namespaces.protect = protect +namespaces.unprotect = unprotect +namespaces.protectall = protectall +namespaces.unprotectall = unprotectall + +namespaces.private("namespaces") registered = { } register("global") -- unreachable + +directives.register("system.protect", function(v) + if v then + protectall() + else + unprotectall() + end +end) + +directives.register("system.checkglobals", function(v) + if v then + report_system("enabling global namespace guard") + protect("global") + else + report_system("disabling global namespace guard") + unprotect("global") + end +end) + +-- dummy section (will go to luat-dum.lua) + + + + + + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['luat-env'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- A former version provided functionality for non embeded core +-- scripts i.e. runtime library loading. Given the amount of +-- Lua code we use now, this no longer makes sense. Much of this +-- evolved before bytecode arrays were available and so a lot of +-- code has disappeared already. + +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) + +local report_lua = logs.reporter("resolvers","lua") + +local allocate, mark = utilities.storage.allocate, utilities.storage.mark + +local format, sub, match, gsub, find = string.format, string.sub, string.match, string.gsub, string.find +local unquoted, quoted = string.unquoted, string.quoted +local concat = table.concat + +-- precautions + +os.setlocale(nil,nil) -- useless feature and even dangerous in luatex + +function os.setlocale() + -- no way you can mess with it +end + +-- dirty tricks + +if arg and (arg[0] == 'luatex' or arg[0] == 'luatex.exe') and arg[1] == "--luaonly" then + arg[-1] = arg[0] + arg[ 0] = arg[2] + for k=3,#arg do + arg[k-2] = arg[k] + end + arg[#arg] = nil -- last + arg[#arg] = nil -- pre-last +end + +-- environment + +environment = environment or { } +local environment = environment + +environment.arguments = allocate() +environment.files = allocate() +environment.sortedflags = nil + +local mt = { + __index = function(_,k) + if k == "version" then + local version = tex.toks and tex.toks.contextversiontoks + if version and version ~= "" then + rawset(environment,"version",version) + return version + else + return "unknown" + end + elseif k == "jobname" or k == "formatname" then + local name = tex and tex[k] + if name or name== "" then + rawset(environment,k,name) + return name + else + return "unknown" + end + elseif k == "outputfilename" then + local name = environment.jobname + rawset(environment,k,name) + return name + end + end +} + +setmetatable(environment,mt) + +function environment.initializearguments(arg) + local arguments, files = { }, { } + environment.arguments, environment.files, environment.sortedflags = arguments, files, nil + for index=1,#arg do + local argument = arg[index] + if index > 0 then + local flag, value = match(argument,"^%-+(.-)=(.-)$") + if flag then + arguments[flag] = unquoted(value or "") + else + flag = match(argument,"^%-+(.+)") + if flag then + arguments[flag] = true + else + files[#files+1] = argument + end + end + end + end + environment.ownname = environment.ownname or arg[0] or 'unknown.lua' +end + +function environment.setargument(name,value) + environment.arguments[name] = value +end + +-- todo: defaults, better checks e.g on type (boolean versus string) +-- +-- tricky: too many hits when we support partials unless we add +-- a registration of arguments so from now on we have 'partial' + +function environment.argument(name,partial) + local arguments, sortedflags = environment.arguments, environment.sortedflags + if arguments[name] then + return arguments[name] + elseif partial then + if not sortedflags then + sortedflags = allocate(table.sortedkeys(arguments)) + for k=1,#sortedflags do + sortedflags[k] = "^" .. sortedflags[k] + end + environment.sortedflags = sortedflags + end + -- example of potential clash: ^mode ^modefile + for k=1,#sortedflags do + local v = sortedflags[k] + if find(name,v) then + return arguments[sub(v,2,#v)] + end end end - return user, system + return nil end -function setters.show(t) - commands.writestatus("","") - local list = setters.list(t) - for k=1,#list do - commands.writestatus(t.name,list[k]) +function environment.splitarguments(separator) -- rather special, cut-off before separator + local done, before, after = false, { }, { } + local originalarguments = environment.originalarguments + for k=1,#originalarguments do + local v = originalarguments[k] + if not done and v == separator then + done = true + elseif done then + after[#after+1] = v + else + before[#before+1] = v + end end - commands.writestatus("","") + return before, after end --- we could have used a bit of oo and the trackers:enable syntax but --- there is already a lot of code around using the singular tracker +function environment.reconstructcommandline(arg,noquote) + arg = arg or environment.originalarguments + if noquote and #arg == 1 then + -- we could just do: return unquoted(resolvers.resolve(arg[i])) + local a = arg[1] + a = resolvers.resolve(a) + a = unquoted(a) + return a + elseif #arg > 0 then + local result = { } + for i=1,#arg do + -- we could just do: result[#result+1] = format("%q",unquoted(resolvers.resolve(arg[i]))) + local a = arg[i] + a = resolvers.resolve(a) + a = unquoted(a) + a = gsub(a,'"','\\"') -- tricky + if find(a," ") then + result[#result+1] = quoted(a) + else + result[#result+1] = a + end + end + return concat(result," ") + else + return "" + end +end --- we could make this into a module -function setters.new(name) - local t - t = { - data = { }, - name = name, - enable = function(...) setters.enable (t,...) end, - disable = function(...) setters.disable (t,...) end, - register = function(...) setters.register(t,...) end, - list = function(...) setters.list (t,...) end, - show = function(...) setters.show (t,...) end, - } - setters.data[name] = t - return t -end +if arg then -trackers = setters.new("trackers") -directives = setters.new("directives") -experiments = setters.new("experiments") + -- new, reconstruct quoted snippets (maybe better just remove the " then and add them later) + local newarg, instring = { }, false --- nice trick: we overload two of the directives related functions with variants that --- do tracing (itself using a tracker) .. proof of concept + for index=1,#arg do + local argument = arg[index] + if find(argument,"^\"") then + newarg[#newarg+1] = gsub(argument,"^\"","") + if not find(argument,"\"$") then + instring = true + end + elseif find(argument,"\"$") then + newarg[#newarg] = newarg[#newarg] .. " " .. gsub(argument,"\"$","") + instring = false + elseif instring then + newarg[#newarg] = newarg[#newarg] .. " " .. argument + else + newarg[#newarg+1] = argument + end + end + for i=1,-5,-1 do + newarg[i] = arg[i] + end -local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end) -local trace_experiments = false local trace_experiments = false trackers.register("system.experiments", function(v) trace_experiments = v end) + environment.initializearguments(newarg) -local e = directives.enable -local d = directives.disable + environment.originalarguments = mark(newarg) + environment.rawarguments = mark(arg) -function directives.enable(...) - commands.writestatus("directives","enabling: %s",concat({...}," ")) - e(...) -end + arg = { } -- prevent duplicate handling -function directives.disable(...) - commands.writestatus("directives","disabling: %s",concat({...}," ")) - d(...) end -local e = experiments.enable -local d = experiments.disable +-- weird place ... depends on a not yet loaded module -function experiments.enable(...) - commands.writestatus("experiments","enabling: %s",concat({...}," ")) - e(...) +function environment.texfile(filename) + return resolvers.findfile(filename,'tex') end -function experiments.disable(...) - commands.writestatus("experiments","disabling: %s",concat({...}," ")) - d(...) +function environment.luafile(filename) + local resolved = resolvers.findfile(filename,'tex') or "" + if resolved ~= "" then + return resolved + end + resolved = resolvers.findfile(filename,'texmfscripts') or "" + if resolved ~= "" then + return resolved + end + return resolvers.findfile(filename,'luatexlibs') or "" end --- a useful example +environment.loadedluacode = loadfile -- can be overloaded -directives.register("system.nostatistics", function(v) - statistics.enable = not v -end) +function environment.luafilechunk(filename,silent) -- used for loading lua bytecode in the format + filename = file.replacesuffix(filename, "lua") + local fullname = environment.luafile(filename) + if fullname and fullname ~= "" then + local data = environment.loadedluacode(fullname) + if trace_locating then + report_lua("loading file %s%s", fullname, not data and " failed" or "") + elseif not silent then + texio.write("<",data and "+ " or "- ",fullname,">") + end + return data + else + if trace_locating then + report_lua("unknown file %s", filename) + end + return nil + end +end + +-- the next ones can use the previous ones / combine +function environment.loadluafile(filename, version) + local lucname, luaname, chunk + local basename = file.removesuffix(filename) + if basename == filename then + lucname, luaname = basename .. ".luc", basename .. ".lua" + else + lucname, luaname = nil, basename -- forced suffix + end + -- when not overloaded by explicit suffix we look for a luc file first + local fullname = (lucname and environment.luafile(lucname)) or "" + if fullname ~= "" then + if trace_locating then + report_lua("loading %s", fullname) + end + chunk = loadfile(fullname) -- this way we don't need a file exists check + end + if chunk then + assert(chunk)() + if version then + -- we check of the version number of this chunk matches + local v = version -- can be nil + if modules and modules[filename] then + v = modules[filename].version -- new method + elseif versions and versions[filename] then + v = versions[filename] -- old method + end + if v == version then + return true + else + if trace_locating then + report_lua("version mismatch for %s: lua=%s, luc=%s", filename, v, version) + end + environment.loadluafile(filename) + end + else + return true + end + end + fullname = (luaname and environment.luafile(luaname)) or "" + if fullname ~= "" then + if trace_locating then + report_lua("loading %s", fullname) + end + chunk = loadfile(fullname) -- this way we don't need a file exists check + if not chunk then + if trace_locating then + report_lua("unknown file %s", filename) + end + else + assert(chunk)() + return true + end + end + return false +end end -- of closure @@ -3991,6 +6263,8 @@ if not modules then modules = { } end modules ['lxml-tab'] = { local trace_entities = false trackers.register("xml.entities", function(v) trace_entities = v end) +local report_xml = logs and logs.reporter("xml","core") or function(...) print(format(...)) end + --[[ldx--

The parser used here is inspired by the variant discussed in the lua book, but handles comment and processing instructions, has a different structure, provides @@ -4001,11 +6275,15 @@ The find based parser can be found in l-xml-edu.lua along with other older code.

Beware, the interface may change. For instance at, ns, tg, dt may get more verbose names. Once the code is stable we will also remove some tracing and optimize the code.

+ +

I might even decide to reimplement the parser using the latest trickery +as the current variant was written when showed up and it's easier now to +build tables in one go.

--ldx]]-- xml = xml or { } +local xml = xml ---~ local xml = xml local concat, remove, insert = table.concat, table.remove, table.insert local type, next, setmetatable, getmetatable, tonumber = type, next, setmetatable, getmetatable, tonumber @@ -4129,7 +6407,7 @@ local dcache, hcache, acache = { }, { }, { } local mt = { } -function initialize_mt(root) +local function initialize_mt(root) mt = { __index = root } -- will be redefined later end @@ -4137,8 +6415,8 @@ function xml.setproperty(root,k,v) getmetatable(root).__index[k] = v end -function xml.check_error(top,toclose) - return "" +function xml.checkerror(top,toclose) + return "" -- can be set end local function add_attribute(namespace,tag,value) @@ -4194,9 +6472,9 @@ local function add_end(spacing, namespace, tag) local toclose = remove(stack) top = stack[#stack] if #stack < 1 then - errorstr = format("nothing to close with %s %s", tag, xml.check_error(top,toclose) or "") + errorstr = format("nothing to close with %s %s", tag, xml.checkerror(top,toclose) or "") elseif toclose.tg ~= tag then -- no namespace check - errorstr = format("unable to close %s with %s %s", toclose.tg, tag, xml.check_error(top,toclose) or "") + errorstr = format("unable to close %s with %s %s", toclose.tg, tag, xml.checkerror(top,toclose) or "") end dt = top.dt dt[#dt+1] = toclose @@ -4233,24 +6511,29 @@ local reported_attribute_errors = { } local function attribute_value_error(str) if not reported_attribute_errors[str] then - logs.report("xml","invalid attribute value: %q",str) + report_xml("invalid attribute value: %q",str) reported_attribute_errors[str] = true at._error_ = str end return str end + local function attribute_specification_error(str) if not reported_attribute_errors[str] then - logs.report("xml","invalid attribute specification: %q",str) + report_xml("invalid attribute specification: %q",str) reported_attribute_errors[str] = true at._error_ = str end return str end -function xml.unknown_dec_entity_format(str) return (str == "" and "&error;") or format("&%s;",str) end -function xml.unknown_hex_entity_format(str) return format("&#x%s;",str) end -function xml.unknown_any_entity_format(str) return format("&#x%s;",str) end +xml.placeholders = { + unknown_dec_entity = function(str) return (str == "" and "&error;") or format("&%s;",str) end, + unknown_hex_entity = function(str) return format("&#x%s;",str) end, + unknown_any_entity = function(str) return format("&#x%s;",str) end, +} + +local placeholders = xml.placeholders local function fromhex(s) local n = tonumber(s,16) @@ -4304,18 +6587,18 @@ local function handle_hex_entity(str) h = unify_predefined and predefined_unified[n] if h then if trace_entities then - logs.report("xml","utfize, converting hex entity &#x%s; into %s",str,h) + report_xml("utfize, converting hex entity &#x%s; into %s",str,h) end elseif utfize then - h = (n and utfchar(n)) or xml.unknown_hex_entity_format(str) or "" + h = (n and utfchar(n)) or xml.unknown_hex_entity(str) or "" if not n then - logs.report("xml","utfize, ignoring hex entity &#x%s;",str) + report_xml("utfize, ignoring hex entity &#x%s;",str) elseif trace_entities then - logs.report("xml","utfize, converting hex entity &#x%s; into %s",str,h) + report_xml("utfize, converting hex entity &#x%s; into %s",str,h) end else if trace_entities then - logs.report("xml","found entity &#x%s;",str) + report_xml("found entity &#x%s;",str) end h = "&#x" .. str .. ";" end @@ -4331,18 +6614,18 @@ local function handle_dec_entity(str) d = unify_predefined and predefined_unified[n] if d then if trace_entities then - logs.report("xml","utfize, converting dec entity &#%s; into %s",str,d) + report_xml("utfize, converting dec entity &#%s; into %s",str,d) end elseif utfize then - d = (n and utfchar(n)) or xml.unknown_dec_entity_format(str) or "" + d = (n and utfchar(n)) or placeholders.unknown_dec_entity(str) or "" if not n then - logs.report("xml","utfize, ignoring dec entity &#%s;",str) + report_xml("utfize, ignoring dec entity &#%s;",str) elseif trace_entities then - logs.report("xml","utfize, converting dec entity &#%s; into %s",str,h) + report_xml("utfize, converting dec entity &#%s; into %s",str,h) end else if trace_entities then - logs.report("xml","found entity &#%s;",str) + report_xml("found entity &#%s;",str) end d = "&#" .. str .. ";" end @@ -4367,20 +6650,21 @@ local function handle_any_entity(str) end if a then if trace_entities then - logs.report("xml","resolved entity &%s; -> %s (internal)",str,a) + report_xml("resolved entity &%s; -> %s (internal)",str,a) end a = lpegmatch(parsedentity,a) or a else - if xml.unknown_any_entity_format then - a = xml.unknown_any_entity_format(str) or "" + local unknown_any_entity = placeholders.unknown_any_entity + if unknown_any_entity then + a = unknown_any_entity(str) or "" end if a then if trace_entities then - logs.report("xml","resolved entity &%s; -> %s (external)",str,a) + report_xml("resolved entity &%s; -> %s (external)",str,a) end else if trace_entities then - logs.report("xml","keeping entity &%s;",str) + report_xml("keeping entity &%s;",str) end if str == "" then a = "&error;" @@ -4392,7 +6676,7 @@ local function handle_any_entity(str) acache[str] = a elseif trace_entities then if not acache[str] then - logs.report("xml","converting entity &%s; into %s",str,a) + report_xml("converting entity &%s; into %s",str,a) acache[str] = a end end @@ -4401,7 +6685,7 @@ local function handle_any_entity(str) local a = acache[str] if not a then if trace_entities then - logs.report("xml","found entity &%s;",str) + report_xml("found entity &%s;",str) end a = resolve_predefined and predefined_simplified[str] if a then @@ -4420,7 +6704,7 @@ local function handle_any_entity(str) end local function handle_end_entity(chr) - logs.report("xml","error in entity, %q found instead of ';'",chr) + report_xml("error in entity, %q found instead of ';'",chr) end local space = S(' \r\n\t') @@ -4555,7 +6839,7 @@ local function xmlconvert(data, settings) resolve_predefined = settings.resolve_predefined_entities -- in case we have escaped entities unify_predefined = settings.unify_predefined_entities -- & -> & cleanup = settings.text_cleanup - stack, top, at, xmlns, errorstr, result, entities = { }, { }, { }, { }, nil, nil, settings.entities or { } + stack, top, at, xmlns, errorstr, entities = { }, { }, { }, { }, nil, settings.entities or { } acache, hcache, dcache = { }, { }, { } -- not stored reported_attribute_errors = { } if settings.parent_root then @@ -4583,16 +6867,17 @@ local function xmlconvert(data, settings) else errorstr = "invalid xml file - no text at all" end + local result if errorstr and errorstr ~= "" then result = { dt = { { ns = "", tg = "error", dt = { errorstr }, at={ }, er = true } } } setmetatable(stack, mt) - local error_handler = settings.error_handler - if error_handler == false then + local errorhandler = settings.error_handler + if errorhandler == false then -- no error message else - error_handler = error_handler or xml.error_handler - if error_handler then - xml.error_handler("load",errorstr) + errorhandler = errorhandler or xml.errorhandler + if errorhandler then + xml.errorhandler("load",errorstr) end end else @@ -4652,7 +6937,7 @@ function xml.is_valid(root) return root and not root.error end -xml.error_handler = (logs and logs.report) or (input and logs.report) or print +xml.errorhandler = report --[[ldx--

We cannot load an from a filehandle so we need to load @@ -4763,7 +7048,7 @@ local function verbose_element(e,handlers) ats[#ats+1] = format('%s=%q',k,v) end end - if ern and trace_remap and ern ~= ens then + if ern and trace_entities and ern ~= ens then ens = ern end if ens ~= "" then @@ -4868,7 +7153,7 @@ local function serialize(e,handlers,...) -- elseif type(e) == "string" then -- functions["@tx@"](e,handlers) else - functions["@dc@"](e,handlers) + functions["@dc@"](e,handlers) -- dc ? end if finalize then return finalize() @@ -4894,7 +7179,7 @@ local function newhandlers(settings) if settings then for k,v in next, settings do if type(v) == "table" then - tk = t[k] if not tk then tk = { } t[k] = tk end + local tk = t[k] if not tk then tk = { } t[k] = tk end for kk,vv in next, v do tk[kk] = vv end @@ -4906,6 +7191,7 @@ local function newhandlers(settings) handlers[settings.name] = t end end + utilities.storage.mark(t) return t end @@ -5005,7 +7291,7 @@ local function xmltext(root) -- inline return (root and xmltostring(root)) or "" end -function initialize_mt(root) +initialize_mt = function(root) -- redefinition mt = { __tostring = xmltext, __index = root } end @@ -5040,7 +7326,6 @@ xml.string = xmlstring

A few helpers:

--ldx]]-- ---~ xmlsetproperty(root,"settings",settings) function xml.settings(e) while e do @@ -5150,6 +7435,7 @@ function xml.makestandalone(root) end end end + return root end @@ -5166,11 +7452,14 @@ if not modules then modules = { } end modules ['lxml-pth'] = { } -- e.ni is only valid after a filter run +-- todo: B/C/[get first match] local concat, remove, insert = table.concat, table.remove, table.insert local type, next, tonumber, tostring, setmetatable, loadstring = type, next, tonumber, tostring, setmetatable, loadstring local format, upper, lower, gmatch, gsub, find, rep = string.format, string.upper, string.lower, string.gmatch, string.gsub, string.find, string.rep -local lpegmatch = lpeg.match +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns + +local setmetatableindex = table.setmetatableindex -- beware, this is not xpath ... e.g. position is different (currently) and -- we have reverse-sibling as reversed preceding sibling @@ -5202,23 +7491,33 @@ local trace_lpath = false if trackers then trackers.register("xml.path", local trace_lparse = false if trackers then trackers.register("xml.parse", function(v) trace_lparse = v end) end local trace_lprofile = false if trackers then trackers.register("xml.profile", function(v) trace_lpath = v trace_lparse = v trace_lprofile = v end) end +local report_lpath = logs.reporter("xml","lpath") + --[[ldx--

We've now arrived at an interesting part: accessing the tree using a subset of and since we're not compatible we call it . We will explain more about its usage in other documents.

--ldx]]-- +local xml = xml + local lpathcalls = 0 function xml.lpathcalls () return lpathcalls end local lpathcached = 0 function xml.lpathcached() return lpathcached end -xml.functions = xml.functions or { } -- internal -xml.expressions = xml.expressions or { } -- in expressions -xml.finalizers = xml.finalizers or { } -- fast do-with ... (with return value other than collection) -xml.specialhandler = xml.specialhandler or { } +xml.functions = xml.functions or { } -- internal +local functions = xml.functions + +xml.expressions = xml.expressions or { } -- in expressions +local expressions = xml.expressions + +xml.finalizers = xml.finalizers or { } -- fast do-with ... (with return value other than collection) +local finalizers = xml.finalizers -local functions = xml.functions -local expressions = xml.expressions -local finalizers = xml.finalizers +xml.specialhandler = xml.specialhandler or { } +local specialhandler = xml.specialhandler + +lpegpatterns.xml = lpegpatterns.xml or { } +local xmlpatterns = lpegpatterns.xml finalizers.xml = finalizers.xml or { } finalizers.tex = finalizers.tex or { } @@ -5228,14 +7527,14 @@ local function fallback (t, name) if fn then t[name] = fn else - logs.report("xml","unknown sub finalizer '%s'",tostring(name)) + report_lpath("unknown sub finalizer '%s'",tostring(name)) fn = function() end end return fn end -setmetatable(finalizers.xml, { __index = fallback }) -setmetatable(finalizers.tex, { __index = fallback }) +setmetatableindex(finalizers.xml, fallback) +setmetatableindex(finalizers.tex, fallback) xml.defaultprotocol = "xml" @@ -5283,102 +7582,106 @@ apply_axis['root'] = function(list) rt = ll end end - collected[#collected+1] = rt + collected[l] = rt end return collected end apply_axis['self'] = function(list) ---~ local collected = { } ---~ for l=1,#list do ---~ collected[#collected+1] = list[l] ---~ end ---~ return collected return list end apply_axis['child'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local dt = ll.dt - local en = 0 - for k=1,#dt do - local dk = dt[k] - if dk.tg then - collected[#collected+1] = dk - dk.ni = k -- refresh - en = en + 1 - dk.ei = en + if dt then -- weird that this is needed + local en = 0 + for k=1,#dt do + local dk = dt[k] + if dk.tg then + c = c + 1 + collected[c] = dk + dk.ni = k -- refresh + en = en + 1 + dk.ei = en + end end + ll.en = en end - ll.en = en end return collected end -local function collect(list,collected) +local function collect(list,collected,c) local dt = list.dt if dt then local en = 0 for k=1,#dt do local dk = dt[k] if dk.tg then - collected[#collected+1] = dk + c = c + 1 + collected[c] = dk dk.ni = k -- refresh en = en + 1 dk.ei = en - collect(dk,collected) + c = collect(dk,collected,c) end end list.en = en end + return c end apply_axis['descendant'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do - collect(list[l],collected) + c = collect(list[l],collected,c) end return collected end -local function collect(list,collected) +local function collect(list,collected,c) local dt = list.dt if dt then local en = 0 for k=1,#dt do local dk = dt[k] if dk.tg then - collected[#collected+1] = dk + c = c + 1 + collected[c] = dk dk.ni = k -- refresh en = en + 1 dk.ei = en - collect(dk,collected) + c = collect(dk,collected,c) end end list.en = en end + return c end apply_axis['descendant-or-self'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] if ll.special ~= true then -- catch double root - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end - collect(ll,collected) + c = collect(ll,collected,c) end return collected end apply_axis['ancestor'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] while ll do ll = ll.__p__ if ll then - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end end end @@ -5386,14 +7689,16 @@ apply_axis['ancestor'] = function(list) end apply_axis['ancestor-or-self'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll while ll do ll = ll.__p__ if ll then - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end end end @@ -5401,11 +7706,12 @@ apply_axis['ancestor-or-self'] = function(list) end apply_axis['parent'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local pl = list[l].__p__ if pl then - collected[#collected+1] = pl + c = c + 1 + collected[c] = pl end end return collected @@ -5420,43 +7726,15 @@ apply_axis['namespace'] = function(list) end apply_axis['following'] = function(list) -- incomplete ---~ local collected = { } ---~ for l=1,#list do ---~ local ll = list[l] ---~ local p = ll.__p__ ---~ local d = p.dt ---~ for i=ll.ni+1,#d do ---~ local di = d[i] ---~ if type(di) == "table" then ---~ collected[#collected+1] = di ---~ break ---~ end ---~ end ---~ end ---~ return collected return { } end apply_axis['preceding'] = function(list) -- incomplete ---~ local collected = { } ---~ for l=1,#list do ---~ local ll = list[l] ---~ local p = ll.__p__ ---~ local d = p.dt ---~ for i=ll.ni-1,1,-1 do ---~ local di = d[i] ---~ if type(di) == "table" then ---~ collected[#collected+1] = di ---~ break ---~ end ---~ end ---~ end ---~ return collected return { } end apply_axis['following-sibling'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local p = ll.__p__ @@ -5464,7 +7742,8 @@ apply_axis['following-sibling'] = function(list) for i=ll.ni+1,#d do local di = d[i] if type(di) == "table" then - collected[#collected+1] = di + c = c + 1 + collected[c] = di end end end @@ -5472,7 +7751,7 @@ apply_axis['following-sibling'] = function(list) end apply_axis['preceding-sibling'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local p = ll.__p__ @@ -5480,7 +7759,8 @@ apply_axis['preceding-sibling'] = function(list) for i=1,ll.ni-1 do local di = d[i] if type(di) == "table" then - collected[#collected+1] = di + c = c + 1 + collected[c] = di end end end @@ -5488,7 +7768,7 @@ apply_axis['preceding-sibling'] = function(list) end apply_axis['reverse-sibling'] = function(list) -- reverse preceding - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local p = ll.__p__ @@ -5496,7 +7776,8 @@ apply_axis['reverse-sibling'] = function(list) -- reverse preceding for i=ll.ni-1,1,-1 do local di = d[i] if type(di) == "table" then - collected[#collected+1] = di + c = c + 1 + collected[c] = di end end end @@ -5522,7 +7803,7 @@ local function apply_nodes(list,directive,nodes) return { } end else - local collected, m, p = { }, 0, nil + local collected, c, m, p = { }, 0, 0, nil if not nns then -- only check tag for l=1,#list do local ll = list[l] @@ -5531,11 +7812,13 @@ local function apply_nodes(list,directive,nodes) if directive then if ntg == ltg then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif ntg ~= ltg then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -5547,11 +7830,13 @@ local function apply_nodes(list,directive,nodes) if directive then if lns == nns then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif lns ~= nns then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -5565,11 +7850,13 @@ local function apply_nodes(list,directive,nodes) if directive then if ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif not ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -5577,7 +7864,7 @@ local function apply_nodes(list,directive,nodes) return collected end else - local collected, m, p = { }, 0, nil + local collected, c, m, p = { }, 0, 0, nil for l=1,#list do local ll = list[l] local ltg = ll.tg @@ -5594,11 +7881,13 @@ local function apply_nodes(list,directive,nodes) if directive then if ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif not ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -5609,12 +7898,13 @@ end local quit_expression = false local function apply_expression(list,expression,order) - local collected = { } + local collected, c = { }, 0 quit_expression = false for l=1,#list do local ll = list[l] if expression(list,ll,l,order) then -- nasty, order alleen valid als n=1 - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end if quit_expression then break @@ -5653,7 +7943,9 @@ local lp_builtin = P ( P("ns") / "ll.ns" ) * ((spaces * P("(") * spaces * P(")"))/"") -local lp_attribute = (P("@") + P("attribute::")) / "" * Cc("(ll.at and ll.at['") * R("az","AZ","--","__")^1 * Cc("'])") +-- for the moment we keep namespaces with attributes + +local lp_attribute = (P("@") + P("attribute::")) / "" * Cc("(ll.at and ll.at['") * ((R("az","AZ") + S("-_:"))^1) * Cc("'])") local lp_fastpos_p = ((P("+")^0 * R("09")^1 * P(-1)) / function(s) return "l==" .. s end) local lp_fastpos_n = ((P("-") * R("09")^1 * P(-1)) / function(s) return "(" .. s .. "<0 and (#list+".. s .. "==l))" end) local lp_fastpos = lp_fastpos_n + lp_fastpos_p @@ -5714,14 +8006,12 @@ local converter = Cs ( ) cleaner = Cs ( ( ---~ lp_fastpos + lp_reserved + lp_number + lp_string + 1 )^1 ) ---~ expr local template_e = [[ local expr = xml.expressions @@ -5772,13 +8062,13 @@ local skip = { } local function errorrunner_e(str,cnv) if not skip[str] then - logs.report("lpath","error in expression: %s => %s",str,cnv) + report_lpath("error in expression: %s => %s",str,cnv) skip[str] = cnv or str end return false end local function errorrunner_f(str,arg) - logs.report("lpath","error in finalizer: %s(%s)",str,arg or "") + report_lpath("error in finalizer: %s(%s)",str,arg or "") return false end @@ -5829,7 +8119,7 @@ local special_1 = P("*") * Cc(register_auto_descendant) * Cc(register_all_nodes local special_2 = P("/") * Cc(register_auto_self) local special_3 = P("") * Cc(register_auto_self) -local parser = Ct { "patterns", -- can be made a bit faster by moving pattern outside +local pathparser = Ct { "patterns", -- can be made a bit faster by moving pattern outside patterns = spaces * V("protocol") * spaces * ( ( V("special") * spaces * P(-1) ) + @@ -5901,6 +8191,8 @@ local parser = Ct { "patterns", -- can be made a bit faster by moving pattern ou } +xmlpatterns.pathparser = pathparser + local cache = { } local function nodesettostring(set,nodetest) @@ -5910,7 +8202,7 @@ local function nodesettostring(set,nodetest) if not ns or ns == "" then ns = "*" end if not tg or tg == "" then tg = "*" end tg = (tg == "@rt@" and "[root]") or format("%s:%s",ns,tg) - t[#t+1] = (directive and tg) or format("not(%s)",tg) + t[i] = (directive and tg) or format("not(%s)",tg) end if nodetest == false then return format("not(%s)",concat(t,"|")) @@ -5929,7 +8221,7 @@ local function tagstostring(list) local ns, tg = li.ns, li.tg if not ns or ns == "" then ns = "*" end if not tg or tg == "" then tg = "*" end - t[#t+1] = (tg == "@rt@" and "[root]") or format("%s:%s",ns,tg) + t[i] = (tg == "@rt@" and "[root]") or format("%s:%s",ns,tg) end return concat(t," ") end @@ -5937,16 +8229,16 @@ end xml.nodesettostring = nodesettostring -local parse_pattern -- we have a harmless kind of circular reference +local lpath -- we have a harmless kind of circular reference + +local lshowoptions = { functions = false } local function lshow(parsed) if type(parsed) == "string" then - parsed = parse_pattern(parsed) + parsed = lpath(parsed) end - local s = table.serialize_functions -- ugly - table.serialize_functions = false -- ugly - logs.report("lpath","%s://%s => %s",parsed.protocol or xml.defaultprotocol,parsed.pattern,table.serialize(parsed,false)) - table.serialize_functions = s -- ugly + report_lpath("%s://%s => %s",parsed.protocol or xml.defaultprotocol,parsed.pattern, + table.serialize(parsed,false,lshowoptions)) end xml.lshow = lshow @@ -5960,7 +8252,7 @@ local function add_comment(p,str) end end -parse_pattern = function (pattern) -- the gain of caching is rather minimal +lpath = function (pattern) -- the gain of caching is rather minimal lpathcalls = lpathcalls + 1 if type(pattern) == "table" then return pattern @@ -5969,13 +8261,13 @@ parse_pattern = function (pattern) -- the gain of caching is rather minimal if parsed then lpathcached = lpathcached + 1 else - parsed = lpegmatch(parser,pattern) + parsed = lpegmatch(pathparser,pattern) if parsed then parsed.pattern = pattern local np = #parsed if np == 0 then parsed = { pattern = pattern, register_self, state = "parsing error" } - logs.report("lpath","parsing error in '%s'",pattern) + report_lpath("parsing error in '%s'",pattern) lshow(parsed) else -- we could have done this with a more complex parser but this @@ -6017,6 +8309,8 @@ parse_pattern = function (pattern) -- the gain of caching is rather minimal end end +xml.lpath = lpath + -- we can move all calls inline and then merge the trace back -- technically we can combine axis and the next nodes which is -- what we did before but this a bit cleaner (but slower too) @@ -6079,32 +8373,32 @@ local function traced_apply(list,parsed,nofparsed,order) if trace_lparse then lshow(parsed) end - logs.report("lpath", "collecting : %s",parsed.pattern) - logs.report("lpath", " root tags : %s",tagstostring(list)) - logs.report("lpath", " order : %s",order or "unset") + report_lpath("collecting: %s",parsed.pattern) + report_lpath("root tags : %s",tagstostring(list)) + report_lpath("order : %s",order or "unset") local collected = list for i=1,nofparsed do local pi = parsed[i] local kind = pi.kind if kind == "axis" then collected = apply_axis[pi.axis](collected) - logs.report("lpath", "% 10i : ax : %s",(collected and #collected) or 0,pi.axis) + report_lpath("% 10i : ax : %s",(collected and #collected) or 0,pi.axis) elseif kind == "nodes" then collected = apply_nodes(collected,pi.nodetest,pi.nodes) - logs.report("lpath", "% 10i : ns : %s",(collected and #collected) or 0,nodesettostring(pi.nodes,pi.nodetest)) + report_lpath("% 10i : ns : %s",(collected and #collected) or 0,nodesettostring(pi.nodes,pi.nodetest)) elseif kind == "expression" then collected = apply_expression(collected,pi.evaluator,order) - logs.report("lpath", "% 10i : ex : %s -> %s",(collected and #collected) or 0,pi.expression,pi.converted) + report_lpath("% 10i : ex : %s -> %s",(collected and #collected) or 0,pi.expression,pi.converted) elseif kind == "finalizer" then collected = pi.finalizer(collected) - logs.report("lpath", "% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pi.name,pi.arguments or "") + report_lpath("% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pi.name,pi.arguments or "") return collected end if not collected or #collected == 0 then local pn = i < nofparsed and parsed[nofparsed] if pn and pn.kind == "finalizer" then collected = pn.finalizer(collected) - logs.report("lpath", "% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pn.name,pn.arguments or "") + report_lpath("% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pn.name,pn.arguments or "") return collected end return nil @@ -6141,8 +8435,11 @@ local function normal_apply(list,parsed,nofparsed,order) return collected end -local function parse_apply(list,pattern) - -- we avoid an extra call + +local function applylpath(list,pattern) + if not list then + return + end local parsed = cache[pattern] if parsed then lpathcalls = lpathcalls + 1 @@ -6151,7 +8448,7 @@ local function parse_apply(list,pattern) lpathcalls = lpathcalls + 1 parsed = pattern else - parsed = parse_pattern(pattern) or pattern + parsed = lpath(pattern) or pattern end if not parsed then return @@ -6160,25 +8457,32 @@ local function parse_apply(list,pattern) if nofparsed == 0 then return -- something is wrong end - local one = list[1] - if not one then - return -- something is wrong - elseif not trace_lpath then - return normal_apply(list,parsed,nofparsed,one.mi) + if not trace_lpath then + return normal_apply ({ list },parsed,nofparsed,list.mi) elseif trace_lprofile then - return profiled_apply(list,parsed,nofparsed,one.mi) + return profiled_apply({ list },parsed,nofparsed,list.mi) else - return traced_apply(list,parsed,nofparsed,one.mi) + return traced_apply ({ list },parsed,nofparsed,list.mi) end end +xml.applylpath = applylpath -- takes a table as first argment, which is what xml.filter will do + +--[[ldx-- +

This is the main filter function. It returns whatever is asked for.

+--ldx]]-- + +function xml.filter(root,pattern) -- no longer funny attribute handling here + return applylpath(root,pattern) +end + -- internal (parsed) expressions.child = function(e,pattern) - return parse_apply({ e },pattern) -- todo: cache + return applylpath(e,pattern) -- todo: cache end expressions.count = function(e,pattern) - local collected = parse_apply({ e },pattern) -- todo: cache + local collected = applylpath(e,pattern) -- todo: cache return (collected and #collected) or 0 end @@ -6188,7 +8492,7 @@ expressions.oneof = function(s,...) -- slow local t = {...} for i=1,#t do if s == t[i] then return true end end return false end expressions.error = function(str) - xml.error_handler("unknown function in lpath expression",tostring(str or "?")) + xml.errorhandler("unknown function in lpath expression",tostring(str or "?")) return false end expressions.undefined = function(s) @@ -6217,8 +8521,8 @@ expressions.boolean = toboolean -- user interface local function traverse(root,pattern,handle) - logs.report("xml","use 'xml.selection' instead for '%s'",pattern) - local collected = parse_apply({ root },pattern) + report_lpath("use 'xml.selection' instead for '%s'",pattern) + local collected = applylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6229,7 +8533,7 @@ local function traverse(root,pattern,handle) end local function selection(root,pattern,handle) - local collected = parse_apply({ root },pattern) + local collected = applylpath(root,pattern) if collected then if handle then for c=1,#collected do @@ -6241,19 +8545,9 @@ local function selection(root,pattern,handle) end end -xml.parse_parser = parser -xml.parse_pattern = parse_pattern -xml.parse_apply = parse_apply xml.traverse = traverse -- old method, r, d, k xml.selection = selection -- new method, simple handle -local lpath = parse_pattern - -xml.lpath = lpath - -function xml.cached_patterns() - return cache -end -- generic function finalizer (independant namespace) @@ -6265,13 +8559,13 @@ local function dofunction(collected,fnc) f(collected[c]) end else - logs.report("xml","unknown function '%s'",fnc) + report_lpath("unknown function '%s'",fnc) end end end -xml.finalizers.xml["function"] = dofunction -xml.finalizers.tex["function"] = dofunction +finalizers.xml["function"] = dofunction +finalizers.tex["function"] = dofunction -- functions @@ -6363,14 +8657,6 @@ expressions.tag = function(e,n) -- only tg end end ---[[ldx-- -

This is the main filter function. It returns whatever is asked for.

---ldx]]-- - -function xml.filter(root,pattern) -- no longer funny attribute handling here - return parse_apply({ root },pattern) -end - --[[ldx--

Often using an iterators looks nicer in the code than passing handler functions. The book describes how to use coroutines for that @@ -6390,7 +8676,7 @@ end local wrap, yield = coroutine.wrap, coroutine.yield function xml.elements(root,pattern,reverse) -- r, d, k - local collected = parse_apply({ root },pattern) + local collected = applylpath(root,pattern) if collected then if reverse then return wrap(function() for c=#collected,1,-1 do @@ -6406,7 +8692,7 @@ function xml.elements(root,pattern,reverse) -- r, d, k end function xml.collected(root,pattern,reverse) -- e - local collected = parse_apply({ root },pattern) + local collected = applylpath(root,pattern) if collected then if reverse then return wrap(function() for c=#collected,1,-1 do yield(collected[c]) end end) @@ -6417,6 +8703,15 @@ function xml.collected(root,pattern,reverse) -- e return wrap(function() end) end +-- handy + +function xml.inspect(collection,pattern) + pattern = pattern or "." + for e in xml.collected(collection,pattern or ".") do + report_lpath("pattern %q\n\n%s\n",pattern,xml.tostring(e)) + end +end + end -- of closure @@ -6430,10 +8725,16 @@ if not modules then modules = { } end modules ['lxml-mis'] = { license = "see context related readme files" } +local xml, lpeg, string = xml, lpeg, string + local concat = table.concat local type, next, tonumber, tostring, setmetatable, loadstring = type, next, tonumber, tostring, setmetatable, loadstring local format, gsub, match = string.format, string.gsub, string.match -local lpegmatch = lpeg.match +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns +local P, S, R, C, V, Cc, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.Cc, lpeg.Cs + +lpegpatterns.xml = lpegpatterns.xml or { } +local xmlpatterns = lpegpatterns.xml --[[ldx--

The following helper functions best belong to the lxml-ini @@ -6457,9 +8758,8 @@ local function xmlgsub(t,old,new) -- will be replaced end end ---~ xml.gsub = xmlgsub -function xml.strip_leading_spaces(dk,d,k) -- cosmetic, for manual +function xml.stripleadingspaces(dk,d,k) -- cosmetic, for manual if d and k then local dkm = d[k-1] if dkm and type(dkm) == "string" then @@ -6469,14 +8769,7 @@ function xml.strip_leading_spaces(dk,d,k) -- cosmetic, for manual end end ---~ xml.escapes = { ['&'] = '&', ['<'] = '<', ['>'] = '>', ['"'] = '"' } ---~ xml.unescapes = { } for k,v in next, xml.escapes do xml.unescapes[v] = k end ---~ function xml.escaped (str) return (gsub(str,"(.)" , xml.escapes )) end ---~ function xml.unescaped(str) return (gsub(str,"(&.-;)", xml.unescapes)) end ---~ function xml.cleansed (str) return (gsub(str,"<.->" , '' )) end -- "%b<>" - -local P, S, R, C, V, Cc, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.Cc, lpeg.Cs -- 100 * 2500 * "oeps< oeps> oeps&" : gsub:lpeg|lpeg|lpeg -- @@ -6502,9 +8795,9 @@ local unescaped = Cs(normal * (special * normal)^0) local cleansed = Cs(((P("<") * (1-P(">"))^0 * P(">"))/"" + 1)^0) -xml.escaped_pattern = escaped -xml.unescaped_pattern = unescaped -xml.cleansed_pattern = cleansed +xmlpatterns.escaped = escaped +xmlpatterns.unescaped = unescaped +xmlpatterns.cleansed = cleansed function xml.escaped (str) return lpegmatch(escaped,str) end function xml.unescaped(str) return lpegmatch(unescaped,str) end @@ -6540,15 +8833,20 @@ if not modules then modules = { } end modules ['lxml-aux'] = { local trace_manipulations = false trackers.register("lxml.manipulations", function(v) trace_manipulations = v end) -local xmlparseapply, xmlconvert, xmlcopy, xmlname = xml.parse_apply, xml.convert, xml.copy, xml.name +local report_xml = logs.reporter("xml") + +local xml = xml + +local xmlconvert, xmlcopy, xmlname = xml.convert, xml.copy, xml.name local xmlinheritedconvert = xml.inheritedconvert +local xmlapplylpath = xml.applylpath -local type = type -local insert, remove = table.insert, table.remove +local type, setmetatable, getmetatable = type, setmetatable, getmetatable +local insert, remove, fastcopy = table.insert, table.remove, table.fastcopy local gmatch, gsub = string.gmatch, string.gsub local function report(what,pattern,c,e) - logs.report("xml","%s element '%s' (root: '%s', position: %s, index: %s, pattern: %s)",what,xmlname(e),xmlname(e.__p__),c,e.ni,pattern) + report_xml("%s element '%s' (root: '%s', position: %s, index: %s, pattern: %s)",what,xmlname(e),xmlname(e.__p__),c,e.ni,pattern) end local function withelements(e,handle,depth) @@ -6602,10 +8900,8 @@ function xml.withelement(e,n,handle) -- slow end end -xml.elements_only = xml.collected - -function xml.each_element(root,pattern,handle,reverse) - local collected = xmlparseapply({ root },pattern) +function xml.each(root,pattern,handle,reverse) + local collected = xmlapplylpath(root,pattern) if collected then if reverse then for c=#collected,1,-1 do @@ -6620,10 +8916,8 @@ function xml.each_element(root,pattern,handle,reverse) end end -xml.process_elements = xml.each_element - -function xml.process_attributes(root,pattern,handle) - local collected = xmlparseapply({ root },pattern) +function xml.processattributes(root,pattern,handle) + local collected = xmlapplylpath(root,pattern) if collected and handle then for c=1,#collected do handle(collected[c].at) @@ -6638,12 +8932,12 @@ end -- are these still needed -> lxml-cmp.lua -function xml.collect_elements(root, pattern) - return xmlparseapply({ root },pattern) +function xml.collect(root, pattern) + return xmlapplylpath(root,pattern) end -function xml.collect_texts(root, pattern, flatten) -- todo: variant with handle - local collected = xmlparseapply({ root },pattern) +function xml.collecttexts(root, pattern, flatten) -- todo: variant with handle + local collected = xmlapplylpath(root,pattern) if collected and flatten then local xmltostring = xml.tostring for c=1,#collected do @@ -6654,18 +8948,19 @@ function xml.collect_texts(root, pattern, flatten) -- todo: variant with handle end function xml.collect_tags(root, pattern, nonamespace) - local collected = xmlparseapply({ root },pattern) + local collected = xmlapplylpath(root,pattern) if collected then - local t = { } + local t, n = { }, 0 for c=1,#collected do local e = collected[c] local ns, tg = e.ns, e.tg + n = n + 1 if nonamespace then - t[#t+1] = tg + t[n] = tg elseif ns == "" then - t[#t+1] = tg + t[n] = tg else - t[#t+1] = ns .. ":" .. tg + t[n] = ns .. ":" .. tg end end return t @@ -6678,7 +8973,7 @@ end local no_root = { no_root = true } -function xml.redo_ni(d) +local function redo_ni(d) for k=1,#d do local dk = d[k] if type(dk) == "table" then @@ -6701,12 +8996,7 @@ local function xmltoelement(whatever,root) return whatever -- string end if element then - --~ if element.ri then - --~ element = element.dt[element.ri].dt - --~ else - --~ element = element.dt - --~ end - end + end return element end @@ -6724,8 +9014,8 @@ local function copiedelement(element,newparent) end end -function xml.delete_element(root,pattern) - local collected = xmlparseapply({ root },pattern) +function xml.delete(root,pattern) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6736,15 +9026,15 @@ function xml.delete_element(root,pattern) end local d = p.dt remove(d,e.ni) - xml.redo_ni(d) -- can be made faster and inlined + redo_ni(d) -- can be made faster and inlined end end end end -function xml.replace_element(root,pattern,whatever) +function xml.replace(root,pattern,whatever) local element = root and xmltoelement(whatever,root) - local collected = element and xmlparseapply({ root },pattern) + local collected = element and xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6755,15 +9045,50 @@ function xml.replace_element(root,pattern,whatever) end local d = p.dt d[e.ni] = copiedelement(element,p) - xml.redo_ni(d) -- probably not needed + redo_ni(d) -- probably not needed + end + end + end +end + +local function wrap(e,wrapper) + local t = { + rn = e.rn, + tg = e.tg, + ns = e.ns, + at = e.at, + dt = e.dt, + __p__ = e, + } + setmetatable(t,getmetatable(e)) + e.rn = wrapper.rn or e.rn or "" + e.tg = wrapper.tg or e.tg or "" + e.ns = wrapper.ns or e.ns or "" + e.at = fastcopy(wrapper.at) + e.dt = { t } +end + +function xml.wrap(root,pattern,whatever) + if whatever then + local wrapper = xmltoelement(whatever,root) + local collected = xmlapplylpath(root,pattern) + if collected then + for c=1,#collected do + local e = collected[c] + if trace_manipulations then + report('wrapping',pattern,c,e) + end + wrap(e,wrapper) end end + else + wrap(root,xmltoelement(pattern)) end end local function inject_element(root,pattern,whatever,prepend) local element = root and xmltoelement(whatever,root) - local collected = element and xmlparseapply({ root },pattern) + local collected = element and xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6778,15 +9103,17 @@ local function inject_element(root,pattern,whatever,prepend) else be, af = edt, cp end + local bn = #be for i=1,#af do - be[#be+1] = af[i] + bn = bn + 1 + be[bn] = af[i] end if rri then r.dt[rri].dt = be else d[k].dt = be end - xml.redo_ni(d) + redo_ni(d) end end end @@ -6794,7 +9121,7 @@ end local function insert_element(root,pattern,whatever,before) -- todo: element als functie local element = root and xmltoelement(whatever,root) - local collected = element and xmlparseapply({ root },pattern) + local collected = element and xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6804,24 +9131,23 @@ local function insert_element(root,pattern,whatever,before) -- todo: element als k = k + 1 end insert(d,k,copiedelement(element,r)) - xml.redo_ni(d) + redo_ni(d) end end end -xml.insert_element = insert_element -xml.insert_element_after = insert_element -xml.insert_element_before = function(r,p,e) insert_element(r,p,e,true) end -xml.inject_element = inject_element -xml.inject_element_after = inject_element -xml.inject_element_before = function(r,p,e) inject_element(r,p,e,true) end +xml.insert_element = insert_element +xml.insertafter = insert_element +xml.insertbefore = function(r,p,e) insert_element(r,p,e,true) end +xml.injectafter = inject_element +xml.injectbefore = function(r,p,e) inject_element(r,p,e,true) end local function include(xmldata,pattern,attribute,recursive,loaddata) -- parse="text" (default: xml), encoding="" (todo) -- attribute = attribute or 'href' pattern = pattern or 'include' loaddata = loaddata or io.loaddata - local collected = xmlparseapply({ xmldata },pattern) + local collected = xmlapplylpath(xmldata,pattern) if collected then for c=1,#collected do local ek = collected[c] @@ -6830,7 +9156,7 @@ local function include(xmldata,pattern,attribute,recursive,loaddata) local ekat = ek.at local epdt = ek.__p__.dt if not attribute or attribute == "" then - name = (type(ekdt) == "table" and ekdt[1]) or ekdt -- ckeck, probably always tab or str + name = (type(ekdt) == "table" and ekdt[1]) or ekdt -- check, probably always tab or str end if not name then for a in gmatch(attribute or "href","([^|]+)") do @@ -6845,9 +9171,6 @@ local function include(xmldata,pattern,attribute,recursive,loaddata) -- for the moment hard coded epdt[ek.ni] = xml.escaped(data) -- d[k] = xml.escaped(data) else ---~ local settings = xmldata.settings ---~ settings.parent_root = xmldata -- to be tested ---~ local xi = xmlconvert(data,settings) local xi = xmlinheritedconvert(data,xmldata) if not xi then epdt[ek.ni] = "" -- xml.empty(d,k) @@ -6864,136 +9187,88 @@ end xml.include = include ---~ local function manipulate(xmldata,pattern,manipulator) -- untested and might go away ---~ local collected = xmlparseapply({ xmldata },pattern) ---~ if collected then ---~ local xmltostring = xml.tostring ---~ for c=1,#collected do ---~ local e = collected[c] ---~ local data = manipulator(xmltostring(e)) ---~ if data == "" then ---~ epdt[e.ni] = "" ---~ else ---~ local xi = xmlinheritedconvert(data,xmldata) ---~ if not xi then ---~ epdt[e.ni] = "" ---~ else ---~ epdt[e.ni] = xml.body(xi) -- xml.assign(d,k,xi) ---~ end ---~ end ---~ end ---~ end ---~ end - ---~ xml.manipulate = manipulate - -function xml.strip_whitespace(root, pattern, nolines) -- strips all leading and trailing space ! - local collected = xmlparseapply({ root },pattern) - if collected then - for i=1,#collected do - local e = collected[i] - local edt = e.dt - if edt then - local t = { } - for i=1,#edt do - local str = edt[i] - if type(str) == "string" then - if str == "" then - -- stripped - else - if nolines then - str = gsub(str,"[ \n\r\t]+"," ") - end - if str == "" then - -- stripped - else - t[#t+1] = str - end - end +local function stripelement(e,nolines,anywhere) + local edt = e.dt + if edt then + if anywhere then + local t, n = { }, 0 + for e=1,#edt do + local str = edt[e] + if type(str) ~= "string" then + n = n + 1 + t[n] = str + elseif str ~= "" then + -- todo: lpeg for each case + if nolines then + str = gsub(str,"%s+"," ") + end + str = gsub(str,"^%s*(.-)%s*$","%1") + if str ~= "" then + n = n + 1 + t[n] = str + end + end + end + e.dt = t + else + -- we can assume a regular sparse xml table with no successive strings + -- otherwise we should use a while loop + if #edt > 0 then + -- strip front + local str = edt[1] + if type(str) ~= "string" then + -- nothing + elseif str == "" then + remove(edt,1) + else + if nolines then + str = gsub(str,"%s+"," ") + end + str = gsub(str,"^%s+","") + if str == "" then + remove(edt,1) + else + edt[1] = str + end + end + end + local nedt = #edt + if nedt > 0 then + -- strip end + local str = edt[nedt] + if type(str) ~= "string" then + -- nothing + elseif str == "" then + remove(edt) + else + if nolines then + str = gsub(str,"%s+"," ") + end + str = gsub(str,"%s+$","") + if str == "" then + remove(edt) else - --~ str.ni = i - t[#t+1] = str + edt[nedt] = str end end - e.dt = t end end end + return e -- convenient end -function xml.strip_whitespace(root, pattern, nolines, anywhere) -- strips all leading and trailing spacing - local collected = xmlparseapply({ root },pattern) -- beware, indices no longer are valid now +xml.stripelement = stripelement + +function xml.strip(root,pattern,nolines,anywhere) -- strips all leading and trailing spacing + local collected = xmlapplylpath(root,pattern) -- beware, indices no longer are valid now if collected then for i=1,#collected do - local e = collected[i] - local edt = e.dt - if edt then - if anywhere then - local t = { } - for e=1,#edt do - local str = edt[e] - if type(str) ~= "string" then - t[#t+1] = str - elseif str ~= "" then - -- todo: lpeg for each case - if nolines then - str = gsub(str,"%s+"," ") - end - str = gsub(str,"^%s*(.-)%s*$","%1") - if str ~= "" then - t[#t+1] = str - end - end - end - e.dt = t - else - -- we can assume a regular sparse xml table with no successive strings - -- otherwise we should use a while loop - if #edt > 0 then - -- strip front - local str = edt[1] - if type(str) ~= "string" then - -- nothing - elseif str == "" then - remove(edt,1) - else - if nolines then - str = gsub(str,"%s+"," ") - end - str = gsub(str,"^%s+","") - if str == "" then - remove(edt,1) - else - edt[1] = str - end - end - end - if #edt > 1 then - -- strip end - local str = edt[#edt] - if type(str) ~= "string" then - -- nothing - elseif str == "" then - remove(edt) - else - if nolines then - str = gsub(str,"%s+"," ") - end - str = gsub(str,"%s+$","") - if str == "" then - remove(edt) - else - edt[#edt] = str - end - end - end - end - end + stripelement(collected[i],nolines,anywhere) end end end -local function rename_space(root, oldspace, newspace) -- fast variant +local function renamespace(root, oldspace, newspace) -- fast variant local ndt = #root.dt for i=1,ndt or 0 do local e = root[i] @@ -7006,16 +9281,16 @@ local function rename_space(root, oldspace, newspace) -- fast variant end local edt = e.dt if edt then - rename_space(edt, oldspace, newspace) + renamespace(edt, oldspace, newspace) end end end end -xml.rename_space = rename_space +xml.renamespace = renamespace -function xml.remap_tag(root, pattern, newtg) - local collected = xmlparseapply({ root },pattern) +function xml.remaptag(root, pattern, newtg) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do collected[c].tg = newtg @@ -7023,8 +9298,8 @@ function xml.remap_tag(root, pattern, newtg) end end -function xml.remap_namespace(root, pattern, newns) - local collected = xmlparseapply({ root },pattern) +function xml.remapnamespace(root, pattern, newns) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do collected[c].ns = newns @@ -7032,8 +9307,8 @@ function xml.remap_namespace(root, pattern, newns) end end -function xml.check_namespace(root, pattern, newns) - local collected = xmlparseapply({ root },pattern) +function xml.checknamespace(root, pattern, newns) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -7044,8 +9319,8 @@ function xml.check_namespace(root, pattern, newns) end end -function xml.remap_name(root, pattern, newtg, newns, newrn) - local collected = xmlparseapply({ root },pattern) +function xml.remapname(root, pattern, newtg, newns, newrn) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -7058,18 +9333,34 @@ end

Here are a few synonyms.

--ldx]]-- -xml.each = xml.each_element -xml.process = xml.process_element -xml.strip = xml.strip_whitespace -xml.collect = xml.collect_elements -xml.all = xml.collect_elements - -xml.insert = xml.insert_element_after -xml.inject = xml.inject_element_after -xml.after = xml.insert_element_after -xml.before = xml.insert_element_before -xml.delete = xml.delete_element -xml.replace = xml.replace_element +xml.all = xml.each +xml.insert = xml.insertafter +xml.inject = xml.injectafter +xml.after = xml.insertafter +xml.before = xml.insertbefore +xml.process = xml.each + +-- obsolete + +xml.obsolete = xml.obsolete or { } +local obsolete = xml.obsolete + +xml.strip_whitespace = xml.strip obsolete.strip_whitespace = xml.strip +xml.collect_elements = xml.collect obsolete.collect_elements = xml.collect +xml.delete_element = xml.delete obsolete.delete_element = xml.delete +xml.replace_element = xml.replace obsolete.replace_element = xml.replacet +xml.each_element = xml.each obsolete.each_element = xml.each +xml.process_elements = xml.process obsolete.process_elements = xml.process +xml.insert_element_after = xml.insertafter obsolete.insert_element_after = xml.insertafter +xml.insert_element_before = xml.insertbefore obsolete.insert_element_before = xml.insertbefore +xml.inject_element_after = xml.injectafter obsolete.inject_element_after = xml.injectafter +xml.inject_element_before = xml.injectbefore obsolete.inject_element_before = xml.injectbefore +xml.process_attributes = xml.processattributes obsolete.process_attributes = xml.processattributes +xml.collect_texts = xml.collecttexts obsolete.collect_texts = xml.collecttexts +xml.inject_element = xml.inject obsolete.inject_element = xml.inject +xml.remap_tag = xml.remaptag obsolete.remap_tag = xml.remaptag +xml.remap_name = xml.remapname obsolete.remap_name = xml.remapname +xml.remap_namespace = xml.remapnamespace obsolete.remap_namespace = xml.remapnamespace end -- of closure @@ -7084,10 +9375,15 @@ if not modules then modules = { } end modules ['lxml-xml'] = { license = "see context related readme files" } +local concat = string.concat + +local xml = xml + local finalizers = xml.finalizers.xml local xmlfilter = xml.filter -- we could inline this one for speed local xmltostring = xml.tostring local xmlserialize = xml.serialize +local xmlcollected = xml.collected local function first(collected) -- wrong ? return collected and collected[1] @@ -7101,15 +9397,8 @@ local function all(collected) return collected end -local function reverse(collected) - if collected then - local reversed = { } - for c=#collected,1,-1 do - reversed[#reversed+1] = collected[c] - end - return reversed - end -end + +local reverse = table.reversed local function attribute(collected,name) if collected and #collected > 0 then @@ -7200,11 +9489,12 @@ end local function texts(collected) if collected then - local t = { } + local t, n = { }, 0 for c=1,#collected do - local e = collection[c] + local e = collected[c] if e and e.dt then - t[#t+1] = e.dt + n = n + 1 + t[n] = e.dt end end return t @@ -7247,14 +9537,15 @@ end local function tags(collected,nonamespace) if collected then - local t = { } + local t, n = { }, 0 for c=1,#collected do local e = collected[c] local ns, tg = e.ns, e.tg + n = n + 1 if nonamespace or ns == "" then - t[#t+1] = tg + t[n] = tg else - t[#t+1] = ns .. ":" .. tg + t[n] = ns .. ":" .. tg end end return t @@ -7365,1812 +9656,1937 @@ xml.all = xml.filter xml.index = xml.position xml.found = xml.filter +-- a nice one: + +local function totable(x) + local t = { } + for e in xmlcollected(x[1] or x,"/*") do + t[e.tg] = xmltostring(e.dt) or "" + end + return next(t) and t or nil +end + +xml.table = totable +finalizers.table = totable + +local function textonly(e,t) + if e then + local edt = e.dt + if edt then + for i=1,#edt do + local e = edt[i] + if type(e) == "table" then + textonly(e,t) + else + t[#t+1] = e + end + end + end + end + return t +end + +function xml.textonly(e) -- no pattern + return concat(textonly(e,{})) +end + end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['luat-env'] = { +if not modules then modules = { } end modules ['data-ini'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" + license = "see context related readme files", } --- A former version provided functionality for non embeded core --- scripts i.e. runtime library loading. Given the amount of --- Lua code we use now, this no longer makes sense. Much of this --- evolved before bytecode arrays were available and so a lot of --- code has disappeared already. +local gsub, find, gmatch = string.gsub, string.find, string.gmatch +local concat = table.concat +local next, type = next, type -local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local filedirname, filebasename, fileextname, filejoin = file.dirname, file.basename, file.extname, file.join -local format, sub, match, gsub, find = string.format, string.sub, string.match, string.gsub, string.find -local unquote, quote = string.unquote, string.quote +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_detail = false trackers.register("resolvers.details", function(v) trace_detail = v end) +local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end) --- precautions +local report_initialization = logs.reporter("resolvers","initialization") -os.setlocale(nil,nil) -- useless feature and even dangerous in luatex +local ostype, osname, ossetenv, osgetenv = os.type, os.name, os.setenv, os.getenv -function os.setlocale() - -- no way you can mess with it -end +-- The code here used to be part of a data-res but for convenience +-- we now split it over multiple files. As this file is now the +-- starting point we introduce resolvers here. --- dirty tricks +resolvers = resolvers or { } +local resolvers = resolvers + +-- We don't want the kpse library to kick in. Also, we want to be able to +-- execute programs. Control over execution is implemented later. + +texconfig.kpse_init = false +texconfig.shell_escape = 't' + +kpse = { original = kpse } + +setmetatable(kpse, { + __index = function(kp,name) + report_initialization("fatal error: kpse library is accessed (key: %s)",name) + os.exit() + end +} ) + +-- First we check a couple of environment variables. Some might be +-- set already but we need then later on. We start with the system +-- font path. + +do + + local osfontdir = osgetenv("OSFONTDIR") + + if osfontdir and osfontdir ~= "" then + -- ok + elseif osname == "windows" then + ossetenv("OSFONTDIR","c:/windows/fonts//") + elseif osname == "macosx" then + ossetenv("OSFONTDIR","$HOME/Library/Fonts//;/Library/Fonts//;/System/Library/Fonts//") + end -if arg and (arg[0] == 'luatex' or arg[0] == 'luatex.exe') and arg[1] == "--luaonly" then - arg[-1]=arg[0] arg[0]=arg[2] for k=3,#arg do arg[k-2]=arg[k] end arg[#arg]=nil arg[#arg]=nil end -if profiler and os.env["MTX_PROFILE_RUN"] == "YES" then - profiler.start("luatex-profile.log") +-- Next comes the user's home path. We need this as later on we have +-- to replace ~ with its value. + +do + + local homedir = osgetenv(ostype == "windows" and 'USERPROFILE' or 'HOME') or '' + + if not homedir or homedir == "" then + homedir = string.char(127) -- we need a value, later we wil trigger on it + end + + homedir = file.collapsepath(homedir) + + ossetenv("HOME", homedir) -- can be used in unix cnf files + ossetenv("USERPROFILE",homedir) -- can be used in windows cnf files + + environment.homedir = homedir + end --- environment +-- The following code sets the name of the own binary and its +-- path. This is fallback code as we have os.selfdir now. -environment = environment or { } -environment.arguments = { } -environment.files = { } -environment.sortedflags = nil +do -if not environment.jobname or environment.jobname == "" then if tex then environment.jobname = tex.jobname end end -if not environment.version or environment.version == "" then environment.version = "unknown" end -if not environment.jobname then environment.jobname = "unknown" end + local args = environment.originalarguments or arg -- this needs a cleanup -function environment.initialize_arguments(arg) - local arguments, files = { }, { } - environment.arguments, environment.files, environment.sortedflags = arguments, files, nil - for index=1,#arg do - local argument = arg[index] - if index > 0 then - local flag, value = match(argument,"^%-+(.-)=(.-)$") - if flag then - arguments[flag] = unquote(value or "") - else - flag = match(argument,"^%-+(.+)") - if flag then - arguments[flag] = true - else - files[#files+1] = argument + local ownbin = environment.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex" + local ownpath = environment.ownpath or os.selfdir + + ownbin = file.collapsepath(ownbin) + ownpath = file.collapsepath(ownpath) + + if not ownpath or ownpath == "" or ownpath == "unset" then + ownpath = args[-1] or arg[-1] + ownpath = ownpath and filedirname(gsub(ownpath,"\\","/")) + if not ownpath or ownpath == "" then + ownpath = args[-0] or arg[-0] + ownpath = ownpath and filedirname(gsub(ownpath,"\\","/")) + end + local binary = ownbin + if not ownpath or ownpath == "" then + ownpath = ownpath and filedirname(binary) + end + if not ownpath or ownpath == "" then + if os.binsuffix ~= "" then + binary = file.replacesuffix(binary,os.binsuffix) + end + local path = osgetenv("PATH") + if path then + for p in gmatch(path,"[^"..io.pathseparator.."]+") do + local b = filejoin(p,binary) + if lfs.isfile(b) then + -- we assume that after changing to the path the currentdir function + -- resolves to the real location and use this side effect here; this + -- trick is needed because on the mac installations use symlinks in the + -- path instead of real locations + local olddir = lfs.currentdir() + if lfs.chdir(p) then + local pp = lfs.currentdir() + if trace_locating and p ~= pp then + report_initialization("following symlink '%s' to '%s'",p,pp) + end + ownpath = pp + lfs.chdir(olddir) + else + if trace_locating then + report_initialization("unable to check path '%s'",p) + end + ownpath = p + end + break + end end end end + if not ownpath or ownpath == "" then + ownpath = "." + report_initialization("forcing fallback ownpath .") + elseif trace_locating then + report_initialization("using ownpath '%s'",ownpath) + end end - environment.ownname = environment.ownname or arg[0] or 'unknown.lua' + + environment.ownbin = ownbin + environment.ownpath = ownpath + end -function environment.setargument(name,value) - environment.arguments[name] = value +resolvers.ownpath = environment.ownpath + +function resolvers.getownpath() + return environment.ownpath end --- todo: defaults, better checks e.g on type (boolean versus string) --- --- tricky: too many hits when we support partials unless we add --- a registration of arguments so from now on we have 'partial' +-- The self variables permit us to use only a few (or even no) +-- environment variables. -function environment.argument(name,partial) - local arguments, sortedflags = environment.arguments, environment.sortedflags - if arguments[name] then - return arguments[name] - elseif partial then - if not sortedflags then - sortedflags = table.sortedkeys(arguments) - for k=1,#sortedflags do - sortedflags[k] = "^" .. sortedflags[k] - end - environment.sortedflags = sortedflags - end - -- example of potential clash: ^mode ^modefile - for k=1,#sortedflags do - local v = sortedflags[k] - if find(name,v) then - return arguments[sub(v,2,#v)] - end - end +do + + local ownpath = environment.ownpath or dir.current() + + if ownpath then + ossetenv('SELFAUTOLOC', file.collapsepath(ownpath)) + ossetenv('SELFAUTODIR', file.collapsepath(ownpath .. "/..")) + ossetenv('SELFAUTOPARENT', file.collapsepath(ownpath .. "/../..")) + else + report_initialization("error: unable to locate ownpath") + os.exit() end - return nil + end -environment.argument("x",true) +-- The running os: -function environment.split_arguments(separator) -- rather special, cut-off before separator - local done, before, after = false, { }, { } - local original_arguments = environment.original_arguments - for k=1,#original_arguments do - local v = original_arguments[k] - if not done and v == separator then - done = true - elseif done then - after[#after+1] = v - else - before[#before+1] = v - end - end - return before, after +-- todo: check is context sits here os.platform is more trustworthy +-- that the bin check as mtx-update runs from another path + +local texos = environment.texos or osgetenv("TEXOS") +local texmfos = environment.texmfos or osgetenv('SELFAUTODIR') + +if not texos or texos == "" then + texos = file.basename(texmfos) end -function environment.reconstruct_commandline(arg,noquote) - arg = arg or environment.original_arguments - if noquote and #arg == 1 then - local a = arg[1] - a = resolvers.resolve(a) - a = unquote(a) - return a - elseif #arg > 0 then - local result = { } - for i=1,#arg do - local a = arg[i] - a = resolvers.resolve(a) - a = unquote(a) - a = gsub(a,'"','\\"') -- tricky - if find(a," ") then - result[#result+1] = quote(a) - else - result[#result+1] = a - end - end - return table.join(result," ") - else - return "" +ossetenv('TEXMFOS', texmfos) -- full bin path +ossetenv('TEXOS', texos) -- partial bin parent +ossetenv('SELFAUTOSYSTEM',os.platform) -- bonus + +environment.texos = texos +environment.texmfos = texmfos + +-- The current root: + +local texroot = environment.texroot or osgetenv("TEXROOT") + +if not texroot or texroot == "" then + texroot = osgetenv('SELFAUTOPARENT') + ossetenv('TEXROOT',texroot) +end + +environment.texroot = file.collapsepath(texroot) + +-- Tracing. Todo ... + +function resolvers.settrace(n) -- no longer number but: 'locating' or 'detail' + if n then + trackers.disable("resolvers.*") + trackers.enable("resolvers."..n) end end -if arg then +resolvers.settrace(osgetenv("MTX_INPUT_TRACE")) + +-- todo: + +-- if profiler and osgetenv("MTX_PROFILE_RUN") == "YES" then +-- profiler.start("luatex-profile.log") +-- end + +-- a forward definition + +if not resolvers.resolve then + function resolvers.resolve (s) return s end + function resolvers.unresolve(s) return s end + function resolvers.repath (s) return s end +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-exp'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +local format, find, gmatch, lower = string.format, string.find, string.gmatch, string.lower +local concat, sort = table.concat, table.sort +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns +local Ct, Cs, Cc, P, C, S = lpeg.Ct, lpeg.Cs, lpeg.Cc, lpeg.P, lpeg.C, lpeg.S +local type, next = type, next - -- new, reconstruct quoted snippets (maybe better just remove the " then and add them later) - local newarg, instring = { }, false +local ostype = os.type +local collapsepath = file.collapsepath - for index=1,#arg do - local argument = arg[index] - if find(argument,"^\"") then - newarg[#newarg+1] = gsub(argument,"^\"","") - if not find(argument,"\"$") then - instring = true - end - elseif find(argument,"\"$") then - newarg[#newarg] = newarg[#newarg] .. " " .. gsub(argument,"\"$","") - instring = false - elseif instring then - newarg[#newarg] = newarg[#newarg] .. " " .. argument - else - newarg[#newarg+1] = argument - end - end - for i=1,-5,-1 do - newarg[i] = arg[i] - end +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end) - environment.initialize_arguments(newarg) - environment.original_arguments = newarg - environment.raw_arguments = arg +local report_expansions = logs.reporter("resolvers","expansions") - arg = { } -- prevent duplicate handling +local resolvers = resolvers -end +-- As this bit of code is somewhat special it gets its own module. After +-- all, when working on the main resolver code, I don't want to scroll +-- past this every time. See data-obs.lua for the gsub variant. --- weird place ... depends on a not yet loaded module +-- {a,b,c,d} +-- a,b,c/{p,q,r},d +-- a,b,c/{p,q,r}/d/{x,y,z}// +-- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} +-- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} +-- a{b,c}{d,e}f +-- {a,b,c,d} +-- {a,b,c/{p,q,r},d} +-- {a,b,c/{p,q,r}/d/{x,y,z}//} +-- {a,b,c/{p,q/{x,y,z}},d/{p,q,r}} +-- {a,b,c/{p,q/{x,y,z},w}v,d/{p,q,r}} +-- {$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c} -function environment.texfile(filename) - return resolvers.find_file(filename,'tex') +local function f_first(a,b) + local t, n = { }, 0 + for s in gmatch(b,"[^,]+") do + n = n + 1 ; t[n] = a .. s + end + return concat(t,",") end -function environment.luafile(filename) - local resolved = resolvers.find_file(filename,'tex') or "" - if resolved ~= "" then - return resolved +local function f_second(a,b) + local t, n = { }, 0 + for s in gmatch(a,"[^,]+") do + n = n + 1 ; t[n] = s .. b end - resolved = resolvers.find_file(filename,'texmfscripts') or "" - if resolved ~= "" then - return resolved + return concat(t,",") +end + +local function f_both(a,b) + local t, n = { }, 0 + for sa in gmatch(a,"[^,]+") do + for sb in gmatch(b,"[^,]+") do + n = n + 1 ; t[n] = sa .. sb + end end - return resolvers.find_file(filename,'luatexlibs') or "" + return concat(t,",") end -environment.loadedluacode = loadfile -- can be overloaded +local left = P("{") +local right = P("}") +local var = P((1 - S("{}" ))^0) +local set = P((1 - S("{},"))^0) +local other = P(1) ---~ function environment.loadedluacode(name) ---~ if os.spawn("texluac -s -o texluac.luc " .. name) == 0 then ---~ local chunk = loadstring(io.loaddata("texluac.luc")) ---~ os.remove("texluac.luc") ---~ return chunk ---~ else ---~ environment.loadedluacode = loadfile -- can be overloaded ---~ return loadfile(name) ---~ end ---~ end - -function environment.luafilechunk(filename) -- used for loading lua bytecode in the format - filename = file.replacesuffix(filename, "lua") - local fullname = environment.luafile(filename) - if fullname and fullname ~= "" then - if trace_locating then - logs.report("fileio","loading file %s", fullname) +local l_first = Cs( ( Cc("{") * (C(set) * left * C(var) * right / f_first) * Cc("}") + other )^0 ) +local l_second = Cs( ( Cc("{") * (left * C(var) * right * C(set) / f_second) * Cc("}") + other )^0 ) +local l_both = Cs( ( Cc("{") * (left * C(var) * right * left * C(var) * right / f_both) * Cc("}") + other )^0 ) +local l_rest = Cs( ( left * var * (left/"") * var * (right/"") * var * right + other )^0 ) + +local stripper_1 = lpeg.stripper ("{}@") +local replacer_1 = lpeg.replacer { { ",}", ",@}" }, { "{,", "{@," }, } + +local function splitpathexpr(str, newlist, validate) -- I couldn't resist lpegging it (nice exercise). + if trace_expansions then + report_expansions("expanding variable '%s'",str) + end + local t, ok, done = newlist or { }, false, false + local n = #t + str = lpegmatch(replacer_1,str) + repeat local old = str + repeat local old = str ; str = lpegmatch(l_first, str) until old == str + repeat local old = str ; str = lpegmatch(l_second,str) until old == str + repeat local old = str ; str = lpegmatch(l_both, str) until old == str + repeat local old = str ; str = lpegmatch(l_rest, str) until old == str + until old == str -- or not find(str,"{") + str = lpegmatch(stripper_1,str) + if validate then + for s in gmatch(str,"[^,]+") do + s = validate(s) + if s then + n = n + 1 ; t[n] = s + end end - return environment.loadedluacode(fullname) else - if trace_locating then - logs.report("fileio","unknown file %s", filename) + for s in gmatch(str,"[^,]+") do + n = n + 1 ; t[n] = s + end + end + if trace_expansions then + for k=1,#t do + report_expansions("% 4i: %s",k,t[k]) end - return nil end + return t end --- the next ones can use the previous ones / combine +-- We could make the previous one public. -function environment.loadluafile(filename, version) - local lucname, luaname, chunk - local basename = file.removesuffix(filename) - if basename == filename then - lucname, luaname = basename .. ".luc", basename .. ".lua" - else - lucname, luaname = nil, basename -- forced suffix - end - -- when not overloaded by explicit suffix we look for a luc file first - local fullname = (lucname and environment.luafile(lucname)) or "" - if fullname ~= "" then - if trace_locating then - logs.report("fileio","loading %s", fullname) - end - chunk = loadfile(fullname) -- this way we don't need a file exists check +local function validate(s) + s = collapsepath(s) -- already keeps the // + return s ~= "" and not find(s,"^!*unset/*$") and s +end + +resolvers.validatedpath = validate -- keeps the trailing // + +function resolvers.expandedpathfromlist(pathlist) + local newlist = { } + for k=1,#pathlist do + splitpathexpr(pathlist[k],newlist,validate) end - if chunk then - assert(chunk)() - if version then - -- we check of the version number of this chunk matches - local v = version -- can be nil - if modules and modules[filename] then - v = modules[filename].version -- new method - elseif versions and versions[filename] then - v = versions[filename] -- old method + return newlist +end + +local cleanup = lpeg.replacer { + { "!" , "" }, + { "\\" , "/" }, +} + +local homedir + +function resolvers.cleanpath(str) + if not homedir then + homedir = lpegmatch(cleanup,environment.homedir or "") + if homedir == string.char(127) or homedir == "" or not lfs.isdir(homedir) then + if trace_expansions then + report_expansions("no home dir set, ignoring dependent paths") end - if v == version then - return true - else - if trace_locating then - logs.report("fileio","version mismatch for %s: lua=%s, luc=%s", filename, v, version) + function resolvers.cleanpath(str) + if find(str,"~") then + return "" -- special case + else + return str and lpegmatch(cleanup,str) end - environment.loadluafile(filename) end else - return true - end - end - fullname = (luaname and environment.luafile(luaname)) or "" - if fullname ~= "" then - if trace_locating then - logs.report("fileio","loading %s", fullname) - end - chunk = loadfile(fullname) -- this way we don't need a file exists check - if not chunk then - if trace_locating then - logs.report("fileio","unknown file %s", filename) + cleanup = lpeg.replacer { + { "!" , "" }, + { "\\" , "/" }, + { "~" , homedir }, + } + function resolvers.cleanpath(str) + return str and lpegmatch(cleanup,str) end - else - assert(chunk)() - return true end end - return false + return resolvers.cleanpath(str) end +-- This one strips quotes and funny tokens. -end -- of closure - -do -- create closure to overcome 200 locals limit +local expandhome = P("~") / "$HOME" -- environment.homedir -if not modules then modules = { } end modules ['trac-inf'] = { - version = 1.001, - comment = "companion to trac-inf.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} +local dodouble = P('"')/"" * (expandhome + (1 - P('"')))^0 * P('"')/"" +local dosingle = P("'")/"" * (expandhome + (1 - P("'")))^0 * P("'")/"" +local dostring = (expandhome + 1 )^0 -local format = string.format +local stripper = Cs( + lpegpatterns.unspacer * (dosingle + dodouble + dostring) * lpegpatterns.unspacer +) -local statusinfo, n, registered = { }, 0, { } +function resolvers.checkedvariable(str) -- assumes str is a string + return lpegmatch(stripper,str) or str +end -statistics = statistics or { } +-- The path splitter: -statistics.enable = true -statistics.threshold = 0.05 +-- A config (optionally) has the paths split in tables. Internally +-- we join them and split them after the expansion has taken place. This +-- is more convenient. --- timing functions +local cache = { } -local clock = os.gettimeofday or os.clock +---- splitter = Ct(lpeg.splitat(S(ostype == "windows" and ";" or ":;"))) -- maybe add , +local splitter = Ct(lpeg.splitat(";")) -- as we move towards urls, prefixes and use tables we no longer do : -local notimer +local backslashswapper = lpeg.replacer("\\","/") -function statistics.hastimer(instance) - return instance and instance.starttime +local function splitconfigurationpath(str) -- beware, this can be either a path or a { specification } + if str then + local found = cache[str] + if not found then + if str == "" then + found = { } + else + local split = lpegmatch(splitter,lpegmatch(backslashswapper,str)) -- can be combined + found = { } + local noffound = 0 + for i=1,#split do + local s = split[i] + if not find(s,"^{*unset}*") then + noffound = noffound + 1 + found[noffound] = s + end + end + if trace_expansions then + report_expansions("splitting path specification '%s'",str) + for k=1,noffound do + report_expansions("% 4i: %s",k,found[k]) + end + end + cache[str] = found + end + end + return found + end end -function statistics.resettiming(instance) - if not instance then - notimer = { timing = 0, loadtime = 0 } +resolvers.splitconfigurationpath = splitconfigurationpath + +function resolvers.splitpath(str) + if type(str) == 'table' then + return str else - instance.timing, instance.loadtime = 0, 0 + return splitconfigurationpath(str) end end -function statistics.starttiming(instance) - if not instance then - notimer = { } - instance = notimer - end - local it = instance.timing - if not it then - it = 0 - end - if it == 0 then - instance.starttime = clock() - if not instance.loadtime then - instance.loadtime = 0 - end +function resolvers.joinpath(str) + if type(str) == 'table' then + return file.joinpath(str) else ---~ logs.report("system","nested timing (%s)",tostring(instance)) + return str end - instance.timing = it + 1 end -function statistics.stoptiming(instance, report) - if not instance then - instance = notimer - end - if instance then - local it = instance.timing - if it > 1 then - instance.timing = it - 1 - else - local starttime = instance.starttime - if starttime then - local stoptime = clock() - local loadtime = stoptime - starttime - instance.stoptime = stoptime - instance.loadtime = instance.loadtime + loadtime - if report then - statistics.report("load time %0.3f",loadtime) +-- The next function scans directories and returns a hash where the +-- entries are either strings or tables. + +-- starting with . or .. etc or funny char + + + + +local weird = P(".")^1 + lpeg.anywhere(S("~`!#$%^&*()={}[]:;\"\'||<>,?\n\r\t")) + +local attributes, directory = lfs.attributes, lfs.dir + +local function scan(files,spec,path,n,m,r) + local full = (path == "" and spec) or (spec .. path .. '/') + local dirs, nofdirs = { }, 0 + for name in directory(full) do + if not lpegmatch(weird,name) then + local mode = attributes(full..name,'mode') + if mode == 'file' then + n = n + 1 + local f = files[name] + if f then + if type(f) == 'string' then + files[name] = { f, path } + else + f[#f+1] = path + end + else -- probably unique anyway + files[name] = path + local lower = lower(name) + if name ~= lower then + files["remap:"..lower] = name + r = r + 1 + end + end + elseif mode == 'directory' then + m = m + 1 + nofdirs = nofdirs + 1 + if path ~= "" then + dirs[nofdirs] = path..'/'..name + else + dirs[nofdirs] = name end - instance.timing = 0 - return loadtime end end end - return 0 -end - -function statistics.elapsedtime(instance) - if not instance then - instance = notimer + if nofdirs > 0 then + sort(dirs) + for i=1,nofdirs do + files, n, m, r = scan(files,spec,dirs[i],n,m,r) + end end - return format("%0.3f",(instance and instance.loadtime) or 0) + return files, n, m, r end -function statistics.elapsedindeed(instance) - if not instance then - instance = notimer +function resolvers.scanfiles(path,branch) + if trace_locating then + report_expansions("scanning path '%s', branch '%s'",path, branch or path) + end + local realpath = resolvers.resolve(path) -- no shortcut + local files, n, m, r = scan({ },realpath .. '/',"",0,0,0) + files.__path__ = path -- can be selfautoparent:texmf-whatever + files.__files__ = n + files.__directories__ = m + files.__remappings__ = r + if trace_locating then + report_expansions("%s files found on %s directories with %s uppercase remappings",n,m,r) end - local t = (instance and instance.loadtime) or 0 - return t > statistics.threshold + return files end -function statistics.elapsedseconds(instance,rest) -- returns nil if 0 seconds - if statistics.elapsedindeed(instance) then - return format("%s seconds %s", statistics.elapsedtime(instance),rest or "") - end -end --- general function -function statistics.register(tag,fnc) - if statistics.enable and type(fnc) == "function" then - local rt = registered[tag] or (#statusinfo + 1) - statusinfo[rt] = { tag, fnc } - registered[tag] = rt - if #tag > n then n = #tag end - end -end +end -- of closure -function statistics.show(reporter) - if statistics.enable then - if not reporter then reporter = function(tag,data,n) texio.write_nl(tag .. " " .. data) end end - -- this code will move - local register = statistics.register - register("luatex banner", function() - return string.lower(status.banner) - end) - register("control sequences", function() - return format("%s of %s", status.cs_count, status.hash_size+status.hash_extra) - end) - register("callbacks", function() - local total, indirect = status.callbacks or 0, status.indirect_callbacks or 0 - return format("direct: %s, indirect: %s, total: %s", total-indirect, indirect, total) - end) - register("current memory usage", statistics.memused) - register("runtime",statistics.runtime) --- -- - for i=1,#statusinfo do - local s = statusinfo[i] - local r = s[2]() - if r then - reporter(s[1],r,n) +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-env'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +local lower, gsub = string.lower, string.gsub + +local resolvers = resolvers + +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex +local fileextname = file.extname + +local formats = allocate() +local suffixes = allocate() +local dangerous = allocate() +local suffixmap = allocate() + +resolvers.formats = formats +resolvers.suffixes = suffixes +resolvers.dangerous = dangerous +resolvers.suffixmap = suffixmap + +local relations = allocate { -- todo: handlers also here + core = { + ofm = { -- will become obsolete + names = { "ofm", "omega font metric", "omega font metrics" }, + variable = 'OFMFONTS', + suffixes = { 'ofm', 'tfm' }, + }, + ovf = { -- will become obsolete + names = { "ovf", "omega virtual font", "omega virtual fonts" }, + variable = 'OVFFONTS', + suffixes = { 'ovf', 'vf' }, + }, + tfm = { + names = { "tfm", "tex font metric", "tex font metrics" }, + variable = 'TFMFONTS', + suffixes = { 'tfm' }, + }, + vf = { + names = { "vf", "virtual font", "virtual fonts" }, + variable = 'VFFONTS', + suffixes = { 'vf' }, + }, + otf = { + names = { "otf", "opentype", "opentype font", "opentype fonts"}, + variable = 'OPENTYPEFONTS', + suffixes = { 'otf' }, + }, + ttf = { + names = { "ttf", "truetype", "truetype font", "truetype fonts", "truetype collection", "truetype collections", "truetype dictionary", "truetype dictionaries" }, + variable = 'TTFONTS', + suffixes = { 'ttf', 'ttc', 'dfont' }, + }, + afm = { + names = { "afm", "adobe font metric", "adobe font metrics" }, + variable = "AFMFONTS", + suffixes = { "afm" }, + }, + pfb = { + names = { "pfb", "type1", "type 1", "type1 font", "type 1 font", "type1 fonts", "type 1 fonts" }, + variable = 'T1FONTS', + suffixes = { 'pfb', 'pfa' }, + }, + fea = { + names = { "fea", "font feature", "font features", "font feature file", "font feature files" }, + variable = 'FONTFEATURES', + suffixes = { 'fea' }, + }, + cid = { + names = { "cid", "cid map", "cid maps", "cid file", "cid files" }, + variable = 'FONTCIDMAPS', + suffixes = { 'cid', 'cidmap' }, + }, + fmt = { + names = { "fmt", "format", "tex format" }, + variable = 'TEXFORMATS', + suffixes = { 'fmt' }, + }, + mem = { -- will become obsolete + names = { 'mem', "metapost format" }, + variable = 'MPMEMS', + suffixes = { 'mem' }, + }, + mp = { + names = { "mp" }, + variable = 'MPINPUTS', + suffixes = { 'mp' }, + }, + tex = { + names = { "tex" }, + variable = 'TEXINPUTS', + suffixes = { 'tex', "mkiv", "mkiv", "mkii" }, + }, + icc = { + names = { "icc", "icc profile", "icc profiles" }, + variable = 'ICCPROFILES', + suffixes = { 'icc' }, + }, + texmfscripts = { + names = { "texmfscript", "texmfscripts", "script", "scripts" }, + variable = 'TEXMFSCRIPTS', + suffixes = { 'rb', 'pl', 'py' }, + }, + lua = { + names = { "lua" }, + variable = 'LUAINPUTS', + suffixes = { 'lua', 'luc', 'tma', 'tmc' }, + }, + lib = { + names = { "lib" }, + variable = 'CLUAINPUTS', + suffixes = os.libsuffix and { os.libsuffix } or { 'dll', 'so' }, + }, + bib = { + names = { 'bib' }, + suffixes = { 'bib' }, + }, + bst = { + names = { 'bst' }, + suffixes = { 'bst' }, + }, + fontconfig = { + names = { 'fontconfig', 'fontconfig file', 'fontconfig files' }, + variable = 'FONTCONFIG_PATH', + }, + }, + obsolete = { + enc = { + names = { "enc", "enc files", "enc file", "encoding files", "encoding file" }, + variable = 'ENCFONTS', + suffixes = { 'enc' }, + }, + map = { + names = { "map", "map files", "map file" }, + variable = 'TEXFONTMAPS', + suffixes = { 'map' }, + }, + lig = { + names = { "lig files", "lig file", "ligature file", "ligature files" }, + variable = 'LIGFONTS', + suffixes = { 'lig' }, + }, + opl = { + names = { "opl" }, + variable = 'OPLFONTS', + suffixes = { 'opl' }, + }, + ovp = { + names = { "ovp" }, + variable = 'OVPFONTS', + suffixes = { 'ovp' }, + }, + }, + kpse = { -- subset + base = { + names = { 'base', "metafont format" }, + variable = 'MFBASES', + suffixes = { 'base', 'bas' }, + }, + cmap = { + names = { 'cmap', 'cmap files', 'cmap file' }, + variable = 'CMAPFONTS', + suffixes = { 'cmap' }, + }, + cnf = { + names = { 'cnf' }, + suffixes = { 'cnf' }, + }, + web = { + names = { 'web' }, + suffixes = { 'web', 'ch' } + }, + cweb = { + names = { 'cweb' }, + suffixes = { 'w', 'web', 'ch' }, + }, + gf = { + names = { 'gf' }, + suffixes = { 'gf' }, + }, + mf = { + names = { 'mf' }, + variable = 'MFINPUTS', + suffixes = { 'mf' }, + }, + mft = { + names = { 'mft' }, + suffixes = { 'mft' }, + }, + pk = { + names = { 'pk' }, + suffixes = { 'pk' }, + }, + }, +} + +resolvers.relations = relations + +-- formats: maps a format onto a variable + +function resolvers.updaterelations() + for category, categories in next, relations do + for name, relation in next, categories do + local rn = relation.names + local rv = relation.variable + local rs = relation.suffixes + if rn and rv then + for i=1,#rn do + local rni = lower(gsub(rn[i]," ","")) + formats[rni] = rv + if rs then + suffixes[rni] = rs + for i=1,#rs do + local rsi = rs[i] + suffixmap[rsi] = rni + end + end + end + end + if rs then end end - texio.write_nl("") -- final newline - statistics.enable = false end end -function statistics.show_job_stat(tag,data,n) - texio.write_nl(format("%-15s: %s - %s","mkiv lua stats",tag:rpadd(n," "),data)) +resolvers.updaterelations() -- push this in the metatable -> newindex + +local function simplified(t,k) + return rawget(t,lower(gsub(k," ",""))) end -function statistics.memused() -- no math.round yet -) - local round = math.round or math.floor - return format("%s MB (ctx: %s MB)",round(collectgarbage("count")/1000), round(status.luastate_bytes/1000000)) +setmetatableindex(formats, simplified) +setmetatableindex(suffixes, simplified) +setmetatableindex(suffixmap, simplified) + +-- A few accessors, mostly for command line tool. + +function resolvers.suffixofformat(str) + local s = suffixes[str] + return s and s[1] or "" end -if statistics.runtime then - -- already loaded and set -elseif luatex and luatex.starttime then - statistics.starttime = luatex.starttime - statistics.loadtime = 0 - statistics.timing = 0 -else - statistics.starttiming(statistics) +function resolvers.suffixofformat(str) + return suffixes[str] or { } end -function statistics.runtime() - statistics.stoptiming(statistics) - return statistics.formatruntime(statistics.elapsedtime(statistics)) +for name, format in next, formats do + dangerous[name] = true -- still needed ? end -function statistics.formatruntime(runtime) - return format("%s seconds", statistics.elapsedtime(statistics)) -end +-- because vf searching is somewhat dangerous, we want to prevent +-- too liberal searching esp because we do a lookup on the current +-- path anyway; only tex (or any) is safe + +dangerous.tex = nil -function statistics.timed(action,report) - local timer = { } - report = report or logs.simple - statistics.starttiming(timer) - action() - statistics.stoptiming(timer) - report("total runtime: %s",statistics.elapsedtime(timer)) -end --- where, not really the best spot for this: +-- more helpers -commands = commands or { } +function resolvers.formatofvariable(str) + return formats[str] or '' +end -local timer +function resolvers.formatofsuffix(str) -- of file + return suffixmap[fileextname(str)] or 'tex' -- so many map onto tex (like mkiv, cld etc) +end -function commands.resettimer() - statistics.resettiming(timer) - statistics.starttiming(timer) +function resolvers.variableofformat(str) + return formats[str] or '' end -function commands.elapsedtime() - statistics.stoptiming(timer) - tex.sprint(statistics.elapsedtime(timer)) +function resolvers.variableofformatorsuffix(str) + local v = formats[str] + if v then + return v + end + v = suffixmap[fileextname(str)] + if v then + return formats[v] + end + return '' end -commands.resettimer() end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['trac-log'] = { - version = 1.001, - comment = "companion to trac-log.mkiv", +if not modules then modules = { } end modules ['data-tmp'] = { + version = 1.100, + comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } --- this is old code that needs an overhaul - ---~ io.stdout:setvbuf("no") ---~ io.stderr:setvbuf("no") - -local write_nl, write = texio.write_nl or print, texio.write or io.write -local format, gmatch = string.format, string.gmatch -local texcount = tex and tex.count - -if texlua then - write_nl = print - write = io.write -end - --[[ldx-- -

This is a prelude to a more extensive logging module. For the sake -of parsing log files, in addition to the standard logging we will -provide an structured file. Actually, any logging that -is hooked into callbacks will be \XML\ by default.

---ldx]]-- +

This module deals with caching data. It sets up the paths and +implements loaders and savers for tables. Best is to set the +following variable. When not set, the usual paths will be +checked. Personally I prefer the (users) temporary path.

-logs = logs or { } -logs.xml = logs.xml or { } -logs.tex = logs.tex or { } + +TEXMFCACHE=$TMP;$TEMP;$TMPDIR;$TEMPDIR;$HOME;$TEXMFVAR;$VARTEXMF;. + ---[[ldx-- -

This looks pretty ugly but we need to speed things up a bit.

+

Currently we do no locking when we write files. This is no real +problem because most caching involves fonts and the chance of them +being written at the same time is small. We also need to extend +luatools with a recache feature.

--ldx]]-- -logs.moreinfo = [[ -more information about ConTeXt and the tools that come with it can be found at: +local format, lower, gsub, concat = string.format, string.lower, string.gsub, table.concat +local mkdirs, isdir = dir.mkdirs, lfs.isdir -maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context -webpage : http://www.pragma-ade.nl / http://tex.aanhet.net -wiki : http://contextgarden.net -]] +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) -logs.levels = { - ['error'] = 1, - ['warning'] = 2, - ['info'] = 3, - ['debug'] = 4, -} +local report_caches = logs.reporter("resolvers","caches") +local report_resolvers = logs.reporter("resolvers","caching") -logs.functions = { - 'report', 'start', 'stop', 'push', 'pop', 'line', 'direct', - 'start_run', 'stop_run', - 'start_page_number', 'stop_page_number', - 'report_output_pages', 'report_output_log', - 'report_tex_stat', 'report_job_stat', - 'show_open', 'show_close', 'show_load', -} +local resolvers = resolvers -logs.tracers = { -} +-- intermezzo -logs.level = 0 -logs.mode = string.lower((os.getenv("MTX.LOG.MODE") or os.getenv("MTX_LOG_MODE") or "tex")) +local directive_cleanup = false directives.register("system.compile.cleanup", function(v) directive_cleanup = v end) +local directive_strip = true directives.register("system.compile.strip", function(v) directive_strip = v end) -function logs.set_level(level) - logs.level = logs.levels[level] or level -end +local compile = utilities.lua.compile -function logs.set_method(method) - for _, v in next, logs.functions do - logs[v] = logs[method][v] or function() end - end +function utilities.lua.compile(luafile,lucfile,cleanup,strip) + if cleanup == nil then cleanup = directive_cleanup end + if strip == nil then strip = directive_strip end + return compile(luafile,lucfile,cleanup,strip) end --- tex logging +-- end of intermezzo -function logs.tex.report(category,fmt,...) -- new - if fmt then - write_nl(category .. " | " .. format(fmt,...)) - else - write_nl(category .. " |") - end -end +caches = caches or { } +local caches = caches -function logs.tex.line(fmt,...) -- new - if fmt then - write_nl(format(fmt,...)) +caches.base = caches.base or "luatex-cache" +caches.more = caches.more or "context" +caches.direct = false -- true is faster but may need huge amounts of memory +caches.tree = false +caches.force = true +caches.ask = false +caches.relocate = false +caches.defaults = { "TMPDIR", "TEMPDIR", "TMP", "TEMP", "HOME", "HOMEPATH" } + +local writable, readables, usedreadables = nil, { }, { } + +-- we could use a metatable for writable and readable but not yet + +local function identify() + -- Combining the loops makes it messy. First we check the format cache path + -- and when the last component is not present we try to create it. + local texmfcaches = resolvers.cleanpathlist("TEXMFCACHE") + if texmfcaches then + for k=1,#texmfcaches do + local cachepath = texmfcaches[k] + if cachepath ~= "" then + cachepath = resolvers.resolve(cachepath) + cachepath = resolvers.cleanpath(cachepath) + cachepath = file.collapsepath(cachepath) + local valid = isdir(cachepath) + if valid then + if file.is_readable(cachepath) then + readables[#readables+1] = cachepath + if not writable and file.is_writable(cachepath) then + writable = cachepath + end + end + elseif not writable and caches.force then + local cacheparent = file.dirname(cachepath) + if file.is_writable(cacheparent) then + if not caches.ask or io.ask(format("\nShould I create the cache path %s?",cachepath), "no", { "yes", "no" }) == "yes" then + mkdirs(cachepath) + if isdir(cachepath) and file.is_writable(cachepath) then + report_caches("created: %s",cachepath) + writable = cachepath + readables[#readables+1] = cachepath + end + end + end + end + end + end + end + -- As a last resort we check some temporary paths but this time we don't + -- create them. + local texmfcaches = caches.defaults + if texmfcaches then + for k=1,#texmfcaches do + local cachepath = texmfcaches[k] + cachepath = resolvers.expansion(cachepath) -- was getenv + if cachepath ~= "" then + cachepath = resolvers.resolve(cachepath) + cachepath = resolvers.cleanpath(cachepath) + local valid = isdir(cachepath) + if valid and file.is_readable(cachepath) then + if not writable and file.is_writable(cachepath) then + readables[#readables+1] = cachepath + writable = cachepath + break + end + end + end + end + end + -- Some extra checking. If we have no writable or readable path then we simply + -- quit. + if not writable then + report_caches("fatal error: there is no valid writable cache path defined") + os.exit() + elseif #readables == 0 then + report_caches("fatal error: there is no valid readable cache path defined") + os.exit() + end + -- why here + writable = dir.expandname(resolvers.cleanpath(writable)) -- just in case + -- moved here + local base, more, tree = caches.base, caches.more, caches.tree or caches.treehash() -- we have only one writable tree + if tree then + caches.tree = tree + writable = mkdirs(writable,base,more,tree) + for i=1,#readables do + readables[i] = file.join(readables[i],base,more,tree) + end else - write_nl("") + writable = mkdirs(writable,base,more) + for i=1,#readables do + readables[i] = file.join(readables[i],base,more) + end end + -- end + if trace_cache then + for i=1,#readables do + report_caches("using readable path '%s' (order %s)",readables[i],i) + end + report_caches("using writable path '%s'",writable) + end + identify = function() + return writable, readables + end + return writable, readables end ---~ function logs.tex.start_page_number() ---~ local real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno ---~ if real > 0 then ---~ if user > 0 then ---~ if sub > 0 then ---~ write(format("[%s.%s.%s",real,user,sub)) ---~ else ---~ write(format("[%s.%s",real,user)) ---~ end ---~ else ---~ write(format("[%s",real)) ---~ end ---~ else ---~ write("[-") ---~ end ---~ end - ---~ function logs.tex.stop_page_number() ---~ write("]") ---~ end - -local real, user, sub - -function logs.tex.start_page_number() - real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno -end - -function logs.tex.stop_page_number() - if real > 0 then - if user > 0 then - if sub > 0 then - logs.report("pages", "flushing realpage %s, userpage %s, subpage %s",real,user,sub) - else - logs.report("pages", "flushing realpage %s, userpage %s",real,user) +function caches.usedpaths() + local writable, readables = identify() + if #readables > 1 then + local result = { } + for i=1,#readables do + local readable = readables[i] + if usedreadables[i] or readable == writable then + result[#result+1] = format("readable: '%s' (order %s)",readable,i) end - else - logs.report("pages", "flushing realpage %s",real) end + result[#result+1] = format("writable: '%s'",writable) + return result else - logs.report("pages", "flushing page") + return writable end - io.flush() end -logs.tex.report_job_stat = statistics.show_job_stat - --- xml logging +function caches.configfiles() + return table.concat(resolvers.instance.specification,";") +end -function logs.xml.report(category,fmt,...) -- new - if fmt then - write_nl(format("%s",category,format(fmt,...))) - else - write_nl(format("",category)) +function caches.hashed(tree) + tree = gsub(tree,"\\$","/") + tree = gsub(tree,"/+$","") + tree = lower(tree) + local hash = md5.hex(tree) + if trace_cache or trace_locating then + report_caches("hashing tree %s, hash %s",tree,hash) end + return hash end -function logs.xml.line(fmt,...) -- new - if fmt then - write_nl(format("%s",format(fmt,...))) + +function caches.treehash() + local tree = caches.configfiles() + if not tree or tree == "" then + return false else - write_nl("") + return caches.hashed(tree) end end -function logs.xml.start() if logs.level > 0 then tw("<%s>" ) end end -function logs.xml.stop () if logs.level > 0 then tw("") end end -function logs.xml.push () if logs.level > 0 then tw("" ) end end - -function logs.xml.start_run() - write_nl("") - write_nl("") -- xmlns='www.pragma-ade.com/luatex/schemas/context-job.rng' - write_nl("") -end +local r_cache, w_cache = { }, { } -- normally w in in r but who cares -function logs.xml.stop_run() - write_nl("") +local function getreadablepaths(...) -- we can optimize this as we have at most 2 tags + local tags = { ... } + local hash = concat(tags,"/") + local done = r_cache[hash] + if not done then + local writable, readables = identify() -- exit if not found + if #tags > 0 then + done = { } + for i=1,#readables do + done[i] = file.join(readables[i],...) + end + else + done = readables + end + r_cache[hash] = done + end + return done end -function logs.xml.start_page_number() - write_nl(format("

0 then + done = mkdirs(writable,...) + else + done = writable + end + w_cache[hash] = done + end + return done end -function logs.xml.stop_page_number() - write("/>") - write_nl("") -end +caches.getreadablepaths = getreadablepaths +caches.getwritablepath = getwritablepath -function logs.xml.report_output_pages(p,b) - write_nl(format("", p)) - write_nl(format("", b)) - write_nl("") +function caches.getfirstreadablefile(filename,...) + local rd = getreadablepaths(...) + for i=1,#rd do + local path = rd[i] + local fullname = file.join(path,filename) + if file.is_readable(fullname) then + usedreadables[i] = true + return fullname, path + end + end + return caches.setfirstwritablefile(filename,...) end -function logs.xml.report_output_log() +function caches.setfirstwritablefile(filename,...) + local wr = getwritablepath(...) + local fullname = file.join(wr,filename) + return fullname, wr end -function logs.xml.report_tex_stat(k,v) - texiowrite_nl("log",""..tostring(v).."") +function caches.define(category,subcategory) -- for old times sake + return function() + return getwritablepath(category,subcategory) + end end -local level = 0 - -function logs.xml.show_open(name) - level = level + 1 - texiowrite_nl(format("",level,name)) +function caches.setluanames(path,name) + return path .. "/" .. name .. ".tma", path .. "/" .. name .. ".tmc" end -function logs.xml.show_close(name) - texiowrite(" ") - level = level - 1 +function caches.loaddata(readables,name) + if type(readables) == "string" then + readables = { readables } + end + for i=1,#readables do + local path = readables[i] + local tmaname, tmcname = caches.setluanames(path,name) + local loader = loadfile(tmcname) or loadfile(tmaname) + if loader then + loader = loader() + collectgarbage("step") + return loader + end + end + return false end -function logs.xml.show_load(name) - texiowrite_nl(format("",level+1,name)) +function caches.is_writable(filepath,filename) + local tmaname, tmcname = caches.setluanames(filepath,filename) + return file.is_writable(tmaname) end --- - -local name, banner = 'report', 'context' +local saveoptions = { compact = true } -local function report(category,fmt,...) - if fmt then - write_nl(format("%s | %s: %s",name,category,format(fmt,...))) - elseif category then - write_nl(format("%s | %s",name,category)) - else - write_nl(format("%s |",name)) +function caches.savedata(filepath,filename,data,raw) + local tmaname, tmcname = caches.setluanames(filepath,filename) + local reduce, simplify = true, true + if raw then + reduce, simplify = false, false end -end - -local function simple(fmt,...) - if fmt then - write_nl(format("%s | %s",name,format(fmt,...))) + data.cache_uuid = os.uuid() + if caches.direct then + file.savedata(tmaname,table.serialize(data,true,saveoptions)) else - write_nl(format("%s |",name)) + table.tofile(tmaname,data,true,saveoptions) end + utilities.lua.compile(tmaname,tmcname) end -function logs.setprogram(_name_,_banner_,_verbose_) - name, banner = _name_, _banner_ - if _verbose_ then - trackers.enable("resolvers.locating") - end - logs.set_method("tex") - logs.report = report -- also used in libraries - logs.simple = simple -- only used in scripts ! - if utils then - utils.report = simple - end - logs.verbose = _verbose_ -end +-- moved from data-res: -function logs.setverbose(what) - if what then - trackers.enable("resolvers.locating") - else - trackers.disable("resolvers.locating") - end - logs.verbose = what or false -end +local content_state = { } -function logs.extendbanner(_banner_,_verbose_) - banner = banner .. " | ".. _banner_ - if _verbose_ ~= nil then - logs.setverbose(what) - end +function caches.contentstate() + return content_state or { } end -logs.verbose = false -logs.report = logs.tex.report -logs.simple = logs.tex.report - -function logs.reportlines(str) -- todo: - for line in gmatch(str,"(.-)[\n\r]") do - logs.report(line) +function caches.loadcontent(cachename,dataname) + local name = caches.hashed(cachename) + local full, path = caches.getfirstreadablefile(name ..".lua","trees") + local filename = file.join(path,name) + local blob = loadfile(filename .. ".luc") or loadfile(filename .. ".lua") + if blob then + local data = blob() + if data and data.content then + if data.type == dataname then + if data.version == resolvers.cacheversion then + content_state[#content_state+1] = data.uuid + if trace_locating then + report_resolvers("loading '%s' for '%s' from '%s'",dataname,cachename,filename) + end + return data.content + else + report_resolvers("skipping '%s' for '%s' from '%s' (version mismatch)",dataname,cachename,filename) + end + else + report_resolvers("skipping '%s' for '%s' from '%s' (datatype mismatch)",dataname,cachename,filename) + end + elseif trace_locating then + report_resolvers("skipping '%s' for '%s' from '%s' (no content)",dataname,cachename,filename) + end + elseif trace_locating then + report_resolvers("skipping '%s' for '%s' from '%s' (invalid file)",dataname,cachename,filename) end end -function logs.reportline() -- for scripts too - logs.report() -end - -logs.simpleline = logs.reportline - -function logs.reportbanner() -- for scripts too - logs.report(banner) -end - -function logs.help(message,option) - logs.reportbanner() - logs.reportline() - logs.reportlines(message) - local moreinfo = logs.moreinfo or "" - if moreinfo ~= "" and option ~= "nomoreinfo" then - logs.reportline() - logs.reportlines(moreinfo) +function caches.collapsecontent(content) + for k, v in next, content do + if type(v) == "table" and #v == 1 then + content[k] = v[1] + end end end -logs.set_level('error') -logs.set_method('tex') - -function logs.system(whereto,process,jobname,category,...) - for i=1,10 do - local f = io.open(whereto,"a") - if f then - f:write(format("%s %s => %s => %s => %s\r",os.date("%d/%m/%y %H:%m:%S"),process,jobname,category,format(...))) - f:close() - break +function caches.savecontent(cachename,dataname,content) + local name = caches.hashed(cachename) + local full, path = caches.setfirstwritablefile(name ..".lua","trees") + local filename = file.join(path,name) -- is full + local luaname, lucname = filename .. ".lua", filename .. ".luc" + if trace_locating then + report_resolvers("preparing '%s' for '%s'",dataname,cachename) + end + local data = { + type = dataname, + root = cachename, + version = resolvers.cacheversion, + date = os.date("%Y-%m-%d"), + time = os.date("%H:%M:%S"), + content = content, + uuid = os.uuid(), + } + local ok = io.savedata(luaname,table.serialize(data,true)) + if ok then + if trace_locating then + report_resolvers("category '%s', cachename '%s' saved in '%s'",dataname,cachename,luaname) + end + if utilities.lua.compile(luaname,lucname) then + if trace_locating then + report_resolvers("'%s' compiled to '%s'",dataname,lucname) + end + return true else - sleep(0.1) + if trace_locating then + report_resolvers("compiling failed for '%s', deleting file '%s'",dataname,lucname) + end + os.remove(lucname) end + elseif trace_locating then + report_resolvers("unable to save '%s' in '%s' (access error)",dataname,luaname) end end ---~ local syslogname = "oeps.xxx" ---~ ---~ for i=1,10 do ---~ logs.system(syslogname,"context","test","fonts","font %s recached due to newer version (%s)","blabla","123") ---~ end - -function logs.fatal(where,...) - logs.report(where,"fatal error: %s, aborting now",format(...)) - os.exit() -end - end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['data-inp'] = { - version = 1.001, +if not modules then modules = { } end modules ['data-met'] = { + version = 1.100, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files", + license = "see context related readme files" } --- After a few years using the code the large luat-inp.lua file --- has been split up a bit. In the process some functionality was --- dropped: --- --- * support for reading lsr files --- * selective scanning (subtrees) --- * some public auxiliary functions were made private --- --- TODO: os.getenv -> os.env[] --- TODO: instances.[hashes,cnffiles,configurations,522] --- TODO: check escaping in find etc, too much, too slow +local find, format = string.find, string.format +local sequenced = table.sequenced +local addurlscheme, urlhashed = url.addscheme, url.hashed --- This lib is multi-purpose and can be loaded again later on so that --- additional functionality becomes available. We will split thislogs.report("fileio", --- module in components once we're done with prototyping. This is the --- first code I wrote for LuaTeX, so it needs some cleanup. Before changing --- something in this module one can best check with Taco or Hans first; there --- is some nasty trickery going on that relates to traditional kpse support. +local trace_locating = false --- To be considered: hash key lowercase, first entry in table filename --- (any case), rest paths (so no need for optimization). Or maybe a --- separate table that matches lowercase names to mixed case when --- present. In that case the lower() cases can go away. I will do that --- only when we run into problems with names ... well ... Iwona-Regular. +trackers.register("resolvers.locating", function(v) trace_methods = v end) +trackers.register("resolvers.methods", function(v) trace_methods = v end) --- Beware, loading and saving is overloaded in luat-tmp! -local format, gsub, find, lower, upper, match, gmatch = string.format, string.gsub, string.find, string.lower, string.upper, string.match, string.gmatch -local concat, insert, sortedkeys = table.concat, table.insert, table.sortedkeys -local next, type = next, type -local lpegmatch = lpeg.match +local report_methods = logs.reporter("resolvers","methods") + +local allocate = utilities.storage.allocate -local trace_locating, trace_detail, trace_expansions = false, false, false +local resolvers = resolvers -trackers.register("resolvers.locating", function(v) trace_locating = v end) -trackers.register("resolvers.details", function(v) trace_detail = v end) -trackers.register("resolvers.expansions", function(v) trace_expansions = v end) -- todo +local registered = { } -if not resolvers then - resolvers = { - suffixes = { }, - formats = { }, - dangerous = { }, - suffixmap = { }, - alternatives = { }, - locators = { }, -- locate databases - hashers = { }, -- load databases - generators = { }, -- generate databases - } +local function splitmethod(filename) -- todo: filetype in specification + if not filename then + return { scheme = "unknown", original = filename } + end + if type(filename) == "table" then + return filename -- already split + end + filename = file.collapsepath(filename) + if not find(filename,"://") then + return { scheme = "file", path = filename, original = filename, filename = filename } + end + local specification = url.hashed(filename) + if not specification.scheme or specification.scheme == "" then + return { scheme = "file", path = filename, original = filename, filename = filename } + else + return specification + end end -local resolvers = resolvers +resolvers.splitmethod = splitmethod -- bad name but ok -resolvers.locators .notfound = { nil } -resolvers.hashers .notfound = { nil } -resolvers.generators.notfound = { nil } - -resolvers.cacheversion = '1.0.1' -resolvers.cnfname = 'texmf.cnf' -resolvers.luaname = 'texmfcnf.lua' -resolvers.homedir = os.env[os.type == "windows" and 'USERPROFILE'] or os.env['HOME'] or '~' -resolvers.cnfdefault = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c}' - -local dummy_path_expr = "^!*unset/*$" - -local formats = resolvers.formats -local suffixes = resolvers.suffixes -local dangerous = resolvers.dangerous -local suffixmap = resolvers.suffixmap -local alternatives = resolvers.alternatives - -formats['afm'] = 'AFMFONTS' suffixes['afm'] = { 'afm' } -formats['enc'] = 'ENCFONTS' suffixes['enc'] = { 'enc' } -formats['fmt'] = 'TEXFORMATS' suffixes['fmt'] = { 'fmt' } -formats['map'] = 'TEXFONTMAPS' suffixes['map'] = { 'map' } -formats['mp'] = 'MPINPUTS' suffixes['mp'] = { 'mp' } -formats['ocp'] = 'OCPINPUTS' suffixes['ocp'] = { 'ocp' } -formats['ofm'] = 'OFMFONTS' suffixes['ofm'] = { 'ofm', 'tfm' } -formats['otf'] = 'OPENTYPEFONTS' suffixes['otf'] = { 'otf' } -- 'ttf' -formats['opl'] = 'OPLFONTS' suffixes['opl'] = { 'opl' } -formats['otp'] = 'OTPINPUTS' suffixes['otp'] = { 'otp' } -formats['ovf'] = 'OVFFONTS' suffixes['ovf'] = { 'ovf', 'vf' } -formats['ovp'] = 'OVPFONTS' suffixes['ovp'] = { 'ovp' } -formats['tex'] = 'TEXINPUTS' suffixes['tex'] = { 'tex' } -formats['tfm'] = 'TFMFONTS' suffixes['tfm'] = { 'tfm' } -formats['ttf'] = 'TTFONTS' suffixes['ttf'] = { 'ttf', 'ttc', 'dfont' } -formats['pfb'] = 'T1FONTS' suffixes['pfb'] = { 'pfb', 'pfa' } -formats['vf'] = 'VFFONTS' suffixes['vf'] = { 'vf' } - -formats['fea'] = 'FONTFEATURES' suffixes['fea'] = { 'fea' } -formats['cid'] = 'FONTCIDMAPS' suffixes['cid'] = { 'cid', 'cidmap' } - -formats ['texmfscripts'] = 'TEXMFSCRIPTS' -- new -suffixes['texmfscripts'] = { 'rb', 'pl', 'py' } -- 'lua' - -formats ['lua'] = 'LUAINPUTS' -- new -suffixes['lua'] = { 'lua', 'luc', 'tma', 'tmc' } - --- backward compatible ones - -alternatives['map files'] = 'map' -alternatives['enc files'] = 'enc' -alternatives['cid maps'] = 'cid' -- great, why no cid files -alternatives['font feature files'] = 'fea' -- and fea files here -alternatives['opentype fonts'] = 'otf' -alternatives['truetype fonts'] = 'ttf' -alternatives['truetype collections'] = 'ttc' -alternatives['truetype dictionary'] = 'dfont' -alternatives['type1 fonts'] = 'pfb' - --- obscure ones - -formats ['misc fonts'] = '' -suffixes['misc fonts'] = { } - -formats ['sfd'] = 'SFDFONTS' -suffixes ['sfd'] = { 'sfd' } -alternatives['subfont definition files'] = 'sfd' - --- lib paths - -formats ['lib'] = 'CLUAINPUTS' -- new (needs checking) -suffixes['lib'] = (os.libsuffix and { os.libsuffix }) or { 'dll', 'so' } +-- the second argument is always analyzed (saves time later on) and the original +-- gets passed as original but also as argument --- In practice we will work within one tds tree, but i want to keep --- the option open to build tools that look at multiple trees, which is --- why we keep the tree specific data in a table. We used to pass the --- instance but for practical pusposes we now avoid this and use a --- instance variable. +local function methodhandler(what,first,...) -- filename can be nil or false + local method = registered[what] + if method then + local how, namespace = method.how, method.namespace + if how == "uri" or how == "url" then + local specification = splitmethod(first) + local scheme = specification.scheme + local resolver = namespace and namespace[scheme] + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, scheme=%s, argument=%s",what,how,scheme,first) + end + return resolver(specification,...) + else + resolver = namespace.default or namespace.file + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, default, argument=%s",what,how,first) + end + return resolver(specification,...) + elseif trace_methods then + report_methods("resolver: method=%s, how=%s, no handler",what,how) + end + end + elseif how == "tag" then + local resolver = namespace and namespace[first] + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, tag=%s",what,how,first) + end + return resolver(...) + else + resolver = namespace.default or namespace.file + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, default",what,how) + end + return resolver(...) + elseif trace_methods then + report_methods("resolver: method=%s, how=%s, unknown",what,how) + end + end + end + else + report_methods("resolver: method=%s, unknown",what) + end +end --- here we catch a few new thingies (todo: add these paths to context.tmf) --- --- FONTFEATURES = .;$TEXMF/fonts/fea// --- FONTCIDMAPS = .;$TEXMF/fonts/cid// +resolvers.methodhandler = methodhandler + +function resolvers.registermethod(name,namespace,how) + registered[name] = { how = how or "tag", namespace = namespace } + namespace["byscheme"] = function(scheme,filename,...) + if scheme == "file" then + return methodhandler(name,filename,...) + else + return methodhandler(name,addurlscheme(filename,scheme),...) + end + end +end --- we always have one instance active +local concatinators = allocate { notfound = file.join } -- concatinate paths +local locators = allocate { notfound = function() end } -- locate databases +local hashers = allocate { notfound = function() end } -- load databases +local generators = allocate { notfound = function() end } -- generate databases -resolvers.instance = resolvers.instance or nil -- the current one (slow access) -local instance = resolvers.instance or nil -- the current one (fast access) +resolvers.concatinators = concatinators +resolvers.locators = locators +resolvers.hashers = hashers +resolvers.generators = generators -function resolvers.newinstance() +local registermethod = resolvers.registermethod - -- store once, freeze and faster (once reset we can best use - -- instance.environment) maybe better have a register suffix - -- function +registermethod("concatinators",concatinators,"tag") +registermethod("locators", locators, "uri") +registermethod("hashers", hashers, "uri") +registermethod("generators", generators, "uri") - for k, v in next, suffixes do - for i=1,#v do - local vi = v[i] - if vi then - suffixmap[vi] = k - end - end - end - -- because vf searching is somewhat dangerous, we want to prevent - -- too liberal searching esp because we do a lookup on the current - -- path anyway; only tex (or any) is safe +end -- of closure - for k, v in next, formats do - dangerous[k] = true - end - dangerous.tex = nil +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-res'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +-- In practice we will work within one tds tree, but i want to keep +-- the option open to build tools that look at multiple trees, which is +-- why we keep the tree specific data in a table. We used to pass the +-- instance but for practical purposes we now avoid this and use a +-- instance variable. We always have one instance active (sort of global). + +-- todo: cache:/// home:/// + +local format, gsub, find, lower, upper, match, gmatch = string.format, string.gsub, string.find, string.lower, string.upper, string.match, string.gmatch +local concat, insert, sortedkeys = table.concat, table.insert, table.sortedkeys +local next, type, rawget = next, type, rawget +local os = os - -- the instance +local P, S, R, C, Cc, Cs, Ct, Carg = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Carg +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns - local newinstance = { - rootpath = '', - treepath = '', - progname = 'context', - engine = 'luatex', - format = '', - environment = { }, - variables = { }, - expansions = { }, - files = { }, - remap = { }, - configuration = { }, - setup = { }, - order = { }, - found = { }, - foundintrees = { }, - kpsevars = { }, - hashes = { }, - cnffiles = { }, - luafiles = { }, - lists = { }, - remember = true, - diskcache = true, - renewcache = false, - scandisk = true, - cachepath = nil, - loaderror = false, - sortdata = false, - savelists = true, - cleanuppaths = true, - allresults = false, - pattern = nil, -- lists - data = { }, -- only for loading - force_suffixes = true, - fakepaths = { }, - } +local filedirname = file.dirname +local filebasename = file.basename +local fileextname = file.extname +local filejoin = file.join +local collapsepath = file.collapsepath +local joinpath = file.joinpath +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex - local ne = newinstance.environment +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_detail = false trackers.register("resolvers.details", function(v) trace_detail = v end) +local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end) - for k,v in next, os.env do - ne[k] = resolvers.bare_variable(v) - end +local report_resolving = logs.reporter("resolvers","resolving") - return newinstance +local resolvers = resolvers -end +local expandedpathfromlist = resolvers.expandedpathfromlist +local checkedvariable = resolvers.checkedvariable +local splitconfigurationpath = resolvers.splitconfigurationpath +local methodhandler = resolvers.methodhandler -function resolvers.setinstance(someinstance) - instance = someinstance - resolvers.instance = someinstance - return someinstance -end +local initializesetter = utilities.setters.initialize -function resolvers.reset() - return resolvers.setinstance(resolvers.newinstance()) -end +local ostype, osname, osenv, ossetenv, osgetenv = os.type, os.name, os.env, os.setenv, os.getenv -local function reset_hashes() - instance.lists = { } - instance.found = { } -end +resolvers.cacheversion = '1.0.1' +resolvers.configbanner = '' +resolvers.homedir = environment.homedir +resolvers.criticalvars = allocate { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF", "TEXMF", "TEXOS" } +resolvers.luacnfname = 'texmfcnf.lua' +resolvers.luacnfstate = "unknown" -local function check_configuration() -- not yet ok, no time for debugging now - if os.env["OSFONTDIR"] then - -- ok - elseif os.type == "windows" then - os.setenv("OSFONTDIR","c:/windows/fonts//") - elseif os.type == "macosx" then - os.setenv("OSFONTDIR","$HOME/Library/Fonts//;/Library/Fonts//;/System/Library/Fonts//") - end -end +-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path +resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}' -function resolvers.bare_variable(str) -- assumes str is a string - return (gsub(str,"\s*([\"\']?)(.+)%1\s*", "%2")) -end -function resolvers.settrace(n) -- no longer number but: 'locating' or 'detail' - if n then - trackers.disable("resolvers.*") - trackers.enable("resolvers."..n) - end -end -resolvers.settrace(os.getenv("MTX_INPUT_TRACE")) +local unset_variable = "unset" -function resolvers.osenv(key) - local ie = instance.environment - local value = ie[key] - if value == nil then - -- local e = os.getenv(key) - local e = os.env[key] - if e == nil then - -- value = "" -- false - else - value = resolvers.bare_variable(e) - end - ie[key] = value - end - return value or "" -end +local formats = resolvers.formats +local suffixes = resolvers.suffixes +local dangerous = resolvers.dangerous +local suffixmap = resolvers.suffixmap -function resolvers.env(key) - return instance.environment[key] or resolvers.osenv(key) -end +resolvers.defaultsuffixes = { "tex" } -- "mkiv", "cld" -- too tricky --- +resolvers.instance = resolvers.instance or nil -- the current one (slow access) +local instance = resolvers.instance or nil -- the current one (fast access) -local function expand_vars(lst) -- simple vars - local variables, env = instance.variables, resolvers.env - local function resolve(a) - return variables[a] or env(a) - end - for k=1,#lst do - lst[k] = gsub(lst[k],"%$([%a%d%_%-]+)",resolve) - end -end +-- An instance has an environment (coming from the outside, kept raw), variables +-- (coming from the configuration file), and expansions (variables with nested +-- variables replaced). One can push something into the outer environment and +-- its internal copy, but only the later one will be the raw unprefixed variant. -local function expanded_var(var) -- simple vars - local function resolve(a) - return instance.variables[a] or resolvers.env(a) +function resolvers.setenv(key,value,raw) + if instance then + -- this one will be consulted first when we stay inside + -- the current environment + instance.environment[key] = value + -- we feed back into the environment, and as this is used + -- by other applications (via os.execute) we need to make + -- sure that prefixes are resolve + ossetenv(key,raw and value or resolvers.resolve(value)) end - return (gsub(var,"%$([%a%d%_%-]+)",resolve)) end -local function entry(entries,name) - if name and (name ~= "") then - name = gsub(name,'%$','') - local result = entries[name..'.'..instance.progname] or entries[name] - if result then - return result - else - result = resolvers.env(name) - if result then - instance.variables[name] = result - resolvers.expand_variables() - return instance.expansions[name] or "" - end - end - end - return "" -end +-- Beware we don't want empty here as this one can be called early on +-- and therefore we use rawget. -local function is_entry(entries,name) - if name and name ~= "" then - name = gsub(name,'%$','') - return (entries[name..'.'..instance.progname] or entries[name]) ~= nil +local function getenv(key) + local value = rawget(instance.environment,key) + if value and value ~= "" then + return value else - return false + local e = osgetenv(key) + return e ~= nil and e ~= "" and checkedvariable(e) or "" end end --- {a,b,c,d} --- a,b,c/{p,q,r},d --- a,b,c/{p,q,r}/d/{x,y,z}// --- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} --- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} --- a{b,c}{d,e}f --- {a,b,c,d} --- {a,b,c/{p,q,r},d} --- {a,b,c/{p,q,r}/d/{x,y,z}//} --- {a,b,c/{p,q/{x,y,z}},d/{p,q,r}} --- {a,b,c/{p,q/{x,y,z},w}v,d/{p,q,r}} --- {$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c} +resolvers.getenv = getenv +resolvers.env = getenv --- this one is better and faster, but it took me a while to realize --- that this kind of replacement is cleaner than messy parsing and --- fuzzy concatenating we can probably gain a bit with selectively --- applying lpeg, but experiments with lpeg parsing this proved not to --- work that well; the parsing is ok, but dealing with the resulting --- table is a pain because we need to work inside-out recursively +-- We are going to use some metatable trickery where we backtrack from +-- expansion to variable to environment. -local function do_first(a,b) - local t = { } - for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end - return "{" .. concat(t,",") .. "}" +local function resolve(k) + return instance.expansions[k] end -local function do_second(a,b) - local t = { } - for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end - return "{" .. concat(t,",") .. "}" -end +local dollarstripper = lpeg.stripper("$") +local inhibitstripper = P("!")^0 * Cs(P(1)^0) +local backslashswapper = lpeg.replacer("\\","/") -local function do_both(a,b) - local t = { } - for sa in gmatch(a,"[^,]+") do - for sb in gmatch(b,"[^,]+") do - t[#t+1] = sa .. sb - end - end - return "{" .. concat(t,",") .. "}" -end +local somevariable = P("$") / "" +local somekey = C(R("az","AZ","09","__","--")^1) +local somethingelse = P(";") * ((1-S("!{}/\\"))^1 * P(";") / "") + + P(";") * (P(";") / "") + + P(1) +local variableexpander = Cs( (somevariable * (somekey/resolve) + somethingelse)^1 ) -local function do_three(a,b,c) - return a .. b.. c -end +local cleaner = P("\\") / "/" + P(";") * S("!{}/\\")^0 * P(";")^1 / ";" +local variablecleaner = Cs((cleaner + P(1))^0) -local function splitpathexpr(str, t, validate) - -- no need for further optimization as it is only called a - -- few times, we can use lpeg for the sub - if trace_expansions then - logs.report("fileio","expanding variable '%s'",str) - end - t = t or { } - str = gsub(str,",}",",@}") - str = gsub(str,"{,","{@,") - -- str = "@" .. str .. "@" - local ok, done - while true do - done = false - while true do - str, ok = gsub(str,"([^{},]+){([^{}]+)}",do_first) - if ok > 0 then done = true else break end - end - while true do - str, ok = gsub(str,"{([^{}]+)}([^{},]+)",do_second) - if ok > 0 then done = true else break end - end - while true do - str, ok = gsub(str,"{([^{}]+)}{([^{}]+)}",do_both) - if ok > 0 then done = true else break end - end - str, ok = gsub(str,"({[^{}]*){([^{}]+)}([^{}]*})",do_three) - if ok > 0 then done = true end - if not done then break end - end - str = gsub(str,"[{}]", "") - str = gsub(str,"@","") - if validate then - for s in gmatch(str,"[^,]+") do - s = validate(s) - if s then t[#t+1] = s end - end - else - for s in gmatch(str,"[^,]+") do - t[#t+1] = s - end - end - if trace_expansions then - for k=1,#t do - logs.report("fileio","% 4i: %s",k,t[k]) - end - end - return t -end +local somevariable = R("az","AZ","09","__","--")^1 / resolve +local variable = (P("$")/"") * (somevariable + (P("{")/"") * somevariable * (P("}")/"")) +local variableresolver = Cs((variable + P(1))^0) -local function expanded_path_from_list(pathlist) -- maybe not a list, just a path - -- a previous version fed back into pathlist - local newlist, ok = { }, false - for k=1,#pathlist do - if find(pathlist[k],"[{}]") then - ok = true - break - end - end - if ok then - local function validate(s) - s = file.collapse_path(s) - return s ~= "" and not find(s,dummy_path_expr) and s - end - for k=1,#pathlist do - splitpathexpr(pathlist[k],newlist,validate) - end - else - for k=1,#pathlist do - for p in gmatch(pathlist[k],"([^,]+)") do - p = file.collapse_path(p) - if p ~= "" then newlist[#newlist+1] = p end - end - end - end - return newlist +local function expandedvariable(var) + return lpegmatch(variableexpander,var) or var end --- we follow a rather traditional approach: --- --- (1) texmf.cnf given in TEXMFCNF --- (2) texmf.cnf searched in default variable --- --- also we now follow the stupid route: if not set then just assume *one* --- cnf file under texmf (i.e. distribution) +function resolvers.newinstance() -- todo: all vars will become lowercase and alphanum only -local args = environment and environment.original_arguments or arg -- this needs a cleanup + if trace_locating then + report_resolving("creating instance") + end -resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex" -resolvers.ownbin = gsub(resolvers.ownbin,"\\","/") + local environment, variables, expansions, order = allocate(), allocate(), allocate(), allocate() -function resolvers.getownpath() - local ownpath = resolvers.ownpath or os.selfdir - if not ownpath or ownpath == "" or ownpath == "unset" then - ownpath = args[-1] or arg[-1] - ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/")) - if not ownpath or ownpath == "" then - ownpath = args[-0] or arg[-0] - ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/")) - end - local binary = resolvers.ownbin - if not ownpath or ownpath == "" then - ownpath = ownpath and file.dirname(binary) - end - if not ownpath or ownpath == "" then - if os.binsuffix ~= "" then - binary = file.replacesuffix(binary,os.binsuffix) - end - for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do - local b = file.join(p,binary) - if lfs.isfile(b) then - -- we assume that after changing to the path the currentdir function - -- resolves to the real location and use this side effect here; this - -- trick is needed because on the mac installations use symlinks in the - -- path instead of real locations - local olddir = lfs.currentdir() - if lfs.chdir(p) then - local pp = lfs.currentdir() - if trace_locating and p ~= pp then - logs.report("fileio","following symlink '%s' to '%s'",p,pp) - end - ownpath = pp - lfs.chdir(olddir) - else - if trace_locating then - logs.report("fileio","unable to check path '%s'",p) - end - ownpath = p - end - break - end + local newinstance = { + environment = environment, + variables = variables, + expansions = expansions, + order = order, + files = allocate(), + setups = allocate(), + found = allocate(), + foundintrees = allocate(), + hashes = allocate(), + hashed = allocate(), + specification = allocate(), + lists = allocate(), + data = allocate(), -- only for loading + fakepaths = allocate(), + remember = true, + diskcache = true, + renewcache = false, + loaderror = false, + savelists = true, + pattern = nil, -- lists + force_suffixes = true, + } + + setmetatableindex(variables,function(t,k) + local v + for i=1,#order do + v = order[i][k] + if v ~= nil then + t[k] = v + return v end end - if not ownpath or ownpath == "" then - ownpath = "." - logs.report("fileio","forcing fallback ownpath .") - elseif trace_locating then - logs.report("fileio","using ownpath '%s'",ownpath) + if v == nil then + v = "" end - end - resolvers.ownpath = ownpath - function resolvers.getownpath() - return resolvers.ownpath - end - return ownpath -end - -local own_places = { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF" } + t[k] = v + return v + end) -local function identify_own() - local ownpath = resolvers.getownpath() or dir.current() - local ie = instance.environment - if ownpath then - if resolvers.env('SELFAUTOLOC') == "" then os.env['SELFAUTOLOC'] = file.collapse_path(ownpath) end - if resolvers.env('SELFAUTODIR') == "" then os.env['SELFAUTODIR'] = file.collapse_path(ownpath .. "/..") end - if resolvers.env('SELFAUTOPARENT') == "" then os.env['SELFAUTOPARENT'] = file.collapse_path(ownpath .. "/../..") end - else - logs.report("fileio","error: unable to locate ownpath") - os.exit() - end - if resolvers.env('TEXMFCNF') == "" then os.env['TEXMFCNF'] = resolvers.cnfdefault end - if resolvers.env('TEXOS') == "" then os.env['TEXOS'] = resolvers.env('SELFAUTODIR') end - if resolvers.env('TEXROOT') == "" then os.env['TEXROOT'] = resolvers.env('SELFAUTOPARENT') end - if trace_locating then - for i=1,#own_places do - local v = own_places[i] - logs.report("fileio","variable '%s' set to '%s'",v,resolvers.env(v) or "unknown") + setmetatableindex(environment, function(t,k) + local v = osgetenv(k) + if v == nil then + v = variables[k] end - end - identify_own = function() end -end - -function resolvers.identify_cnf() - if #instance.cnffiles == 0 then - -- fallback - identify_own() - -- the real search - resolvers.expand_variables() - local t = resolvers.split_path(resolvers.env('TEXMFCNF')) - t = expanded_path_from_list(t) - expand_vars(t) -- redundant - local function locate(filename,list) - for i=1,#t do - local ti = t[i] - local texmfcnf = file.collapse_path(file.join(ti,filename)) - if lfs.isfile(texmfcnf) then - list[#list+1] = texmfcnf - end - end + if v ~= nil then + v = checkedvariable(v) or "" end - locate(resolvers.luaname,instance.luafiles) - locate(resolvers.cnfname,instance.cnffiles) - end -end + v = resolvers.repath(v) -- for taco who has a : separated osfontdir + t[k] = v + return v + end) -local function load_cnf_file(fname) - fname = resolvers.clean_path(fname) - local lname = file.replacesuffix(fname,'lua') - if lfs.isfile(lname) then - local dname = file.dirname(fname) -- fname ? - if not instance.configuration[dname] then - resolvers.load_data(dname,'configuration',lname and file.basename(lname)) - instance.order[#instance.order+1] = instance.configuration[dname] - end - else - f = io.open(fname) - if f then - if trace_locating then - logs.report("fileio","loading configuration file %s", fname) - end - local line, data, n, k, v - local dname = file.dirname(fname) - if not instance.configuration[dname] then - instance.configuration[dname] = { } - instance.order[#instance.order+1] = instance.configuration[dname] - end - local data = instance.configuration[dname] - while true do - local line, n = f:read(), 0 - if line then - while true do -- join lines - line, n = gsub(line,"\\%s*$", "") - if n > 0 then - line = line .. f:read() - else - break - end - end - if not find(line,"^[%%#]") then - local l = gsub(line,"%s*%%.*$","") - local k, v = match(l,"%s*(.-)%s*=%s*(.-)%s*$") - if k and v and not data[k] then - v = gsub(v,"[%%#].*",'') - data[k] = gsub(v,"~","$HOME") - instance.kpsevars[k] = true - end - end - else - break - end - end - f:close() - elseif trace_locating then - logs.report("fileio","skipping configuration file '%s'", fname) + setmetatableindex(expansions, function(t,k) + local v = environment[k] + if type(v) == "string" then + v = lpegmatch(variableresolver,v) + v = lpegmatch(variablecleaner,v) end - end + t[k] = v + return v + end) + + return newinstance + end -local function collapse_cnf_data() -- potential optimization: pass start index (setup and configuration are shared) - local order = instance.order - for i=1,#order do - local c = order[i] - for k,v in next, c do - if not instance.variables[k] then - if instance.environment[k] then - instance.variables[k] = instance.environment[k] - else - instance.kpsevars[k] = true - instance.variables[k] = resolvers.bare_variable(v) - end - end - end - end +function resolvers.setinstance(someinstance) -- only one instance is active + instance = someinstance + resolvers.instance = someinstance + return someinstance end -function resolvers.load_cnf() - local function loadoldconfigdata() - local cnffiles = instance.cnffiles - for i=1,#cnffiles do - load_cnf_file(cnffiles[i]) - end - end - -- instance.cnffiles contain complete names now ! - -- we still use a funny mix of cnf and new but soon - -- we will switch to lua exclusively as we only use - -- the file to collect the tree roots - if #instance.cnffiles == 0 then - if trace_locating then - logs.report("fileio","no cnf files found (TEXMFCNF may not be set/known)") - end - else - local cnffiles = instance.cnffiles - instance.rootpath = cnffiles[1] - for k=1,#cnffiles do - instance.cnffiles[k] = file.collapse_path(cnffiles[k]) - end - for i=1,3 do - instance.rootpath = file.dirname(instance.rootpath) - end - instance.rootpath = file.collapse_path(instance.rootpath) - if instance.diskcache and not instance.renewcache then - resolvers.loadoldconfig(instance.cnffiles) - if instance.loaderror then - loadoldconfigdata() - resolvers.saveoldconfig() - end - else - loadoldconfigdata() - if instance.renewcache then - resolvers.saveoldconfig() - end - end - collapse_cnf_data() - end - check_configuration() +function resolvers.reset() + return resolvers.setinstance(resolvers.newinstance()) end -function resolvers.load_lua() - if #instance.luafiles == 0 then - -- yet harmless - else - instance.rootpath = instance.luafiles[1] - local luafiles = instance.luafiles - for k=1,#luafiles do - instance.luafiles[k] = file.collapse_path(luafiles[k]) - end - for i=1,3 do - instance.rootpath = file.dirname(instance.rootpath) - end - instance.rootpath = file.collapse_path(instance.rootpath) - resolvers.loadnewconfig() - collapse_cnf_data() - end - check_configuration() +local function reset_hashes() + instance.lists = { } + instance.found = { } end --- database loading +local slash = P("/") -function resolvers.load_hash() - resolvers.locatelists() - if instance.diskcache and not instance.renewcache then - resolvers.loadfiles() - if instance.loaderror then - resolvers.loadlists() - resolvers.savefiles() - end +local pathexpressionpattern = Cs ( + Cc("^") * ( + Cc("%") * S(".-") + + slash^2 * P(-1) / "/.*" + + slash^2 / "/.-/" + + (1-slash) * P(-1) * Cc("/") + + P(1) + )^1 * Cc("$") -- yes or no $ +) + +local cache = { } + +local function makepathexpression(str) + if str == "." then + return "^%./$" else - resolvers.loadlists() - if instance.renewcache then - resolvers.savefiles() + local c = cache[str] + if not c then + c = lpegmatch(pathexpressionpattern,str) + cache[str] = c end + return c end end -function resolvers.append_hash(type,tag,name) - if trace_locating then - logs.report("fileio","hash '%s' appended",tag) - end - insert(instance.hashes, { ['type']=type, ['tag']=tag, ['name']=name } ) -end - -function resolvers.prepend_hash(type,tag,name) +local function reportcriticalvariables() if trace_locating then - logs.report("fileio","hash '%s' prepended",tag) - end - insert(instance.hashes, 1, { ['type']=type, ['tag']=tag, ['name']=name } ) -end - -function resolvers.extend_texmf_var(specification) -- crap, we could better prepend the hash --- local t = resolvers.expanded_path_list('TEXMF') -- full expansion - local t = resolvers.split_path(resolvers.env('TEXMF')) - insert(t,1,specification) - local newspec = concat(t,";") - if instance.environment["TEXMF"] then - instance.environment["TEXMF"] = newspec - elseif instance.variables["TEXMF"] then - instance.variables["TEXMF"] = newspec - else - -- weird + for i=1,#resolvers.criticalvars do + local k = resolvers.criticalvars[i] + local v = resolvers.getenv(k) or "unknown" -- this one will not resolve ! + report_resolving("variable '%s' set to '%s'",k,v) + end + report_resolving() end - resolvers.expand_variables() - reset_hashes() + reportcriticalvariables = function() end end --- locators - -function resolvers.locatelists() - local texmfpaths = resolvers.clean_path_list('TEXMF') - for i=1,#texmfpaths do - local path = texmfpaths[i] +local function identify_configuration_files() + local specification = instance.specification + if #specification == 0 then + local cnfspec = getenv('TEXMFCNF') + if cnfspec == "" then + cnfspec = resolvers.luacnfspec + resolvers.luacnfstate = "default" + else + resolvers.luacnfstate = "environment" + end + reportcriticalvariables() + local cnfpaths = expandedpathfromlist(resolvers.splitpath(cnfspec)) + local luacnfname = resolvers.luacnfname + for i=1,#cnfpaths do + local filename = collapsepath(filejoin(cnfpaths[i],luacnfname)) + local realname = resolvers.resolve(filename) + if lfs.isfile(realname) then + specification[#specification+1] = filename + if trace_locating then + report_resolving("found configuration file '%s'",realname) + end + elseif trace_locating then + report_resolving("unknown configuration file '%s'",realname) + end + end if trace_locating then - logs.report("fileio","locating list of '%s'",path) + report_resolving() end - resolvers.locatedatabase(file.collapse_path(path)) - end -end - -function resolvers.locatedatabase(specification) - return resolvers.methodhandler('locators', specification) -end + elseif trace_locating then + report_resolving("configuration files already identified") + end +end + +local function load_configuration_files() + local specification = instance.specification + if #specification > 0 then + local luacnfname = resolvers.luacnfname + for i=1,#specification do + local filename = specification[i] + local pathname = filedirname(filename) + local filename = filejoin(pathname,luacnfname) + local realname = resolvers.resolve(filename) -- no shortcut + local blob = loadfile(realname) + if blob then + local setups = instance.setups + local data = blob() + data = data and data.content + if data then + if trace_locating then + report_resolving("loading configuration file '%s'",filename) + report_resolving() + end + local variables = data.variables or { } + local warning = false + for k, v in next, data do + local variant = type(v) + if variant == "table" then + initializesetter(filename,k,v) + elseif variables[k] == nil then + if trace_locating and not warning then + report_resolving("variables like '%s' in configuration file '%s' should move to the 'variables' subtable", + k,resolvers.resolve(filename)) + warning = true + end + variables[k] = v + end + end + setups[pathname] = variables + if resolvers.luacnfstate == "default" then + -- the following code is not tested + local cnfspec = variables["TEXMFCNF"] + if cnfspec then + if trace_locating then + report_resolving("reloading configuration due to TEXMF redefinition") + end + -- we push the value into the main environment (osenv) so + -- that it takes precedence over the default one and therefore + -- also over following definitions + resolvers.setenv('TEXMFCNF',cnfspec) -- resolves prefixes + -- we now identify and load the specified configuration files + instance.specification = { } + identify_configuration_files() + load_configuration_files() + -- we prevent further overload of the configuration variable + resolvers.luacnfstate = "configuration" + -- we quit the outer loop + break + end + end -function resolvers.locators.tex(specification) - if specification and specification ~= '' and lfs.isdir(specification) then - if trace_locating then - logs.report("fileio","tex locator '%s' found",specification) + else + if trace_locating then + report_resolving("skipping configuration file '%s' (no content)",filename) + end + setups[pathname] = { } + instance.loaderror = true + end + elseif trace_locating then + report_resolving("skipping configuration file '%s' (no file)",filename) + end + instance.order[#instance.order+1] = instance.setups[pathname] + if instance.loaderror then + break + end end - resolvers.append_hash('file',specification,filename) elseif trace_locating then - logs.report("fileio","tex locator '%s' not found",specification) + report_resolving("warning: no lua configuration files found") end end --- hashers - -function resolvers.hashdatabase(tag,name) - return resolvers.methodhandler('hashers',tag,name) -end +-- scheme magic ... database loading -function resolvers.loadfiles() - instance.loaderror = false - instance.files = { } +local function load_file_databases() + instance.loaderror, instance.files = false, allocate() if not instance.renewcache then local hashes = instance.hashes for k=1,#hashes do local hash = hashes[k] - resolvers.hashdatabase(hash.tag,hash.name) + resolvers.hashers.byscheme(hash.type,hash.name) if instance.loaderror then break end end end end -function resolvers.hashers.tex(tag,name) - resolvers.load_data(tag,'files') -end - --- generators: - -function resolvers.loadlists() - local hashes = instance.hashes - for i=1,#hashes do - resolvers.generatedatabase(hashes[i].tag) - end -end - -function resolvers.generatedatabase(specification) - return resolvers.methodhandler('generators', specification) -end - --- starting with . or .. etc or funny char - -local weird = lpeg.P(".")^1 + lpeg.anywhere(lpeg.S("~`!#$%^&*()={}[]:;\"\'||<>,?\n\r\t")) - ---~ local l_forbidden = lpeg.S("~`!#$%^&*()={}[]:;\"\'||\\/<>,?\n\r\t") ---~ local l_confusing = lpeg.P(" ") ---~ local l_character = lpeg.patterns.utf8 ---~ local l_dangerous = lpeg.P(".") - ---~ local l_normal = (l_character - l_forbidden - l_confusing - l_dangerous) * (l_character - l_forbidden - l_confusing^2)^0 * lpeg.P(-1) ---~ ----- l_normal = l_normal * lpeg.Cc(true) + lpeg.Cc(false) - ---~ local function test(str) ---~ print(str,lpeg.match(l_normal,str)) ---~ end ---~ test("ヒラギノ明朝 Pro W3") ---~ test("..ヒラギノ明朝 Pro W3") ---~ test(":ヒラギノ明朝 Pro W3;") ---~ test("ヒラギノ明朝 /Pro W3;") ---~ test("ヒラギノ明朝 Pro W3") - -function resolvers.generators.tex(specification) - local tag = specification - if trace_locating then - logs.report("fileio","scanning path '%s'",specification) - end - instance.files[tag] = { } - local files = instance.files[tag] - local n, m, r = 0, 0, 0 - local spec = specification .. '/' - local attributes = lfs.attributes - local directory = lfs.dir - local function action(path) - local full - if path then - full = spec .. path .. '/' - else - full = spec - end - for name in directory(full) do - if not lpegmatch(weird,name) then - -- if lpegmatch(l_normal,name) then - local mode = attributes(full..name,'mode') - if mode == 'file' then - if path then - n = n + 1 - local f = files[name] - if f then - if type(f) == 'string' then - files[name] = { f, path } - else - f[#f+1] = path - end - else -- probably unique anyway - files[name] = path - local lower = lower(name) - if name ~= lower then - files["remap:"..lower] = name - r = r + 1 - end - end - end - elseif mode == 'directory' then - m = m + 1 - if path then - action(path..'/'..name) +local function locate_file_databases() + -- todo: cache:// and tree:// (runtime) + local texmfpaths = resolvers.expandedpathlist('TEXMF') + if #texmfpaths > 0 then + for i=1,#texmfpaths do + local path = collapsepath(texmfpaths[i]) + local stripped = lpegmatch(inhibitstripper,path) -- the !! thing + if stripped ~= "" then + local runtime = stripped == path + path = resolvers.cleanpath(path) + local spec = resolvers.splitmethod(stripped) + if spec.scheme == "cache" or spec.scheme == "file" then + stripped = spec.path + elseif runtime and (spec.noscheme or spec.scheme == "file") then + stripped = "tree:///" .. stripped + end + if trace_locating then + if runtime then + report_resolving("locating list of '%s' (runtime)",path) else - action(name) + report_resolving("locating list of '%s' (cached)",path) end end + methodhandler('locators',stripped) end end - end - action() - if trace_locating then - logs.report("fileio","%s files found on %s directories with %s uppercase remappings",n,m,r) + if trace_locating then + report_resolving() + end + elseif trace_locating then + report_resolving("no texmf paths are defined (using TEXMF)") end end --- savers, todo - -function resolvers.savefiles() - resolvers.save_data('files') +local function generate_file_databases() + local hashes = instance.hashes + for k=1,#hashes do + local hash = hashes[k] + methodhandler('generators',hash.name) + end + if trace_locating then + report_resolving() + end end --- A config (optionally) has the paths split in tables. Internally --- we join them and split them after the expansion has taken place. This --- is more convenient. - ---~ local checkedsplit = string.checkedsplit - -local cache = { } - -local splitter = lpeg.Ct(lpeg.splitat(lpeg.S(os.type == "windows" and ";" or ":;"))) - -local function split_kpse_path(str) -- beware, this can be either a path or a {specification} - local found = cache[str] - if not found then - if str == "" then - found = { } - else - str = gsub(str,"\\","/") ---~ local split = (find(str,";") and checkedsplit(str,";")) or checkedsplit(str,io.pathseparator) -local split = lpegmatch(splitter,str) - found = { } - for i=1,#split do - local s = split[i] - if not find(s,"^{*unset}*") then - found[#found+1] = s - end - end - if trace_expansions then - logs.report("fileio","splitting path specification '%s'",str) - for k=1,#found do - logs.report("fileio","% 4i: %s",k,found[k]) - end +local function save_file_databases() -- will become cachers + for i=1,#instance.hashes do + local hash = instance.hashes[i] + local cachename = hash.name + if hash.cache then + local content = instance.files[cachename] + caches.collapsecontent(content) + if trace_locating then + report_resolving("saving tree '%s'",cachename) end - cache[str] = found + caches.savecontent(cachename,"files",content) + elseif trace_locating then + report_resolving("not saving runtime tree '%s'",cachename) end end - return found end -resolvers.split_kpse_path = split_kpse_path - -function resolvers.splitconfig() - for i=1,#instance do - local c = instance[i] - for k,v in next, c do - if type(v) == 'string' then - local t = split_kpse_path(v) - if #t > 1 then - c[k] = t - end - end +local function load_databases() + locate_file_databases() + if instance.diskcache and not instance.renewcache then + load_file_databases() + if instance.loaderror then + generate_file_databases() + save_file_databases() + end + else + generate_file_databases() + if instance.renewcache then + save_file_databases() end end end -function resolvers.joinconfig() - local order = instance.order - for i=1,#order do - local c = order[i] - for k,v in next, c do -- indexed? - if type(v) == 'table' then - c[k] = file.join_path(v) - end +function resolvers.appendhash(type,name,cache) + -- safeguard ... tricky as it's actually a bug when seen twice + if not instance.hashed[name] then + if trace_locating then + report_resolving("hash '%s' appended",name) end + insert(instance.hashes, { type = type, name = name, cache = cache } ) + instance.hashed[name] = cache end end -function resolvers.split_path(str) - if type(str) == 'table' then - return str - else - return split_kpse_path(str) +function resolvers.prependhash(type,name,cache) + -- safeguard ... tricky as it's actually a bug when seen twice + if not instance.hashed[name] then + if trace_locating then + report_resolving("hash '%s' prepended",name) + end + insert(instance.hashes, 1, { type = type, name = name, cache = cache } ) + instance.hashed[name] = cache end end -function resolvers.join_path(str) - if type(str) == 'table' then - return file.join_path(str) +function resolvers.extendtexmfvariable(specification) -- crap, we could better prepend the hash + local t = resolvers.splitpath(getenv('TEXMF')) + insert(t,1,specification) + local newspec = concat(t,";") + if instance.environment["TEXMF"] then + instance.environment["TEXMF"] = newspec + elseif instance.variables["TEXMF"] then + instance.variables["TEXMF"] = newspec else - return str + -- weird end + reset_hashes() end function resolvers.splitexpansions() local ie = instance.expansions for k,v in next, ie do - local t, h, p = { }, { }, split_kpse_path(v) + local t, tn, h, p = { }, 0, { }, splitconfigurationpath(v) for kk=1,#p do local vv = p[kk] if vv ~= "" and not h[vv] then - t[#t+1] = vv + tn = tn + 1 + t[tn] = vv h[vv] = true end end @@ -9184,343 +11600,92 @@ end -- end of split/join code -function resolvers.saveoldconfig() - resolvers.splitconfig() - resolvers.save_data('configuration') - resolvers.joinconfig() -end - -resolvers.configbanner = [[ --- This is a Luatex configuration file created by 'luatools.lua' or --- 'luatex.exe' directly. For comment, suggestions and questions you can --- contact the ConTeXt Development Team. This configuration file is --- not copyrighted. [HH & TH] -]] - -function resolvers.serialize(files) - -- This version is somewhat optimized for the kind of - -- tables that we deal with, so it's much faster than - -- the generic serializer. This makes sense because - -- luatools and mtxtools are called frequently. Okay, - -- we pay a small price for properly tabbed tables. - local t = { } - local function dump(k,v,m) -- could be moved inline - if type(v) == 'string' then - return m .. "['" .. k .. "']='" .. v .. "'," - elseif #v == 1 then - return m .. "['" .. k .. "']='" .. v[1] .. "'," - else - return m .. "['" .. k .. "']={'" .. concat(v,"','").. "'}," - end - end - t[#t+1] = "return {" - if instance.sortdata then - local sortedfiles = sortedkeys(files) - for i=1,#sortedfiles do - local k = sortedfiles[i] - local fk = files[k] - if type(fk) == 'table' then - t[#t+1] = "\t['" .. k .. "']={" - local sortedfk = sortedkeys(fk) - for j=1,#sortedfk do - local kk = sortedfk[j] - t[#t+1] = dump(kk,fk[kk],"\t\t") - end - t[#t+1] = "\t}," - else - t[#t+1] = dump(k,fk,"\t") - end - end - else - for k, v in next, files do - if type(v) == 'table' then - t[#t+1] = "\t['" .. k .. "']={" - for kk,vv in next, v do - t[#t+1] = dump(kk,vv,"\t\t") - end - t[#t+1] = "\t}," - else - t[#t+1] = dump(k,v,"\t") - end - end - end - t[#t+1] = "}" - return concat(t,"\n") -end - -local data_state = { } - -function resolvers.data_state() - return data_state or { } -end - -function resolvers.save_data(dataname, makename) -- untested without cache overload - for cachename, files in next, instance[dataname] do - local name = (makename or file.join)(cachename,dataname) - local luaname, lucname = name .. ".lua", name .. ".luc" - if trace_locating then - logs.report("fileio","preparing '%s' for '%s'",dataname,cachename) - end - for k, v in next, files do - if type(v) == "table" and #v == 1 then - files[k] = v[1] - end - end - local data = { - type = dataname, - root = cachename, - version = resolvers.cacheversion, - date = os.date("%Y-%m-%d"), - time = os.date("%H:%M:%S"), - content = files, - uuid = os.uuid(), - } - local ok = io.savedata(luaname,resolvers.serialize(data)) - if ok then - if trace_locating then - logs.report("fileio","'%s' saved in '%s'",dataname,luaname) - end - if utils.lua.compile(luaname,lucname,false,true) then -- no cleanup but strip - if trace_locating then - logs.report("fileio","'%s' compiled to '%s'",dataname,lucname) - end - else - if trace_locating then - logs.report("fileio","compiling failed for '%s', deleting file '%s'",dataname,lucname) - end - os.remove(lucname) - end - elseif trace_locating then - logs.report("fileio","unable to save '%s' in '%s' (access error)",dataname,luaname) - end - end -end - -function resolvers.load_data(pathname,dataname,filename,makename) -- untested without cache overload - filename = ((not filename or (filename == "")) and dataname) or filename - filename = (makename and makename(dataname,filename)) or file.join(pathname,filename) - local blob = loadfile(filename .. ".luc") or loadfile(filename .. ".lua") - if blob then - local data = blob() - if data and data.content and data.type == dataname and data.version == resolvers.cacheversion then - data_state[#data_state+1] = data.uuid - if trace_locating then - logs.report("fileio","loading '%s' for '%s' from '%s'",dataname,pathname,filename) - end - instance[dataname][pathname] = data.content - else - if trace_locating then - logs.report("fileio","skipping '%s' for '%s' from '%s'",dataname,pathname,filename) - end - instance[dataname][pathname] = { } - instance.loaderror = true - end - elseif trace_locating then - logs.report("fileio","skipping '%s' for '%s' from '%s'",dataname,pathname,filename) - end -end - --- some day i'll use the nested approach, but not yet (actually we even drop --- engine/progname support since we have only luatex now) --- --- first texmfcnf.lua files are located, next the cached texmf.cnf files --- --- return { --- TEXMFBOGUS = 'effe checken of dit werkt', --- } - -function resolvers.resetconfig() - identify_own() - instance.configuration, instance.setup, instance.order, instance.loaderror = { }, { }, { }, false -end - -function resolvers.loadnewconfig() - local luafiles = instance.luafiles - for i=1,#luafiles do - local cnf = luafiles[i] - local pathname = file.dirname(cnf) - local filename = file.join(pathname,resolvers.luaname) - local blob = loadfile(filename) - if blob then - local data = blob() - if data then - if trace_locating then - logs.report("fileio","loading configuration file '%s'",filename) - end - if true then - -- flatten to variable.progname - local t = { } - for k, v in next, data do -- v = progname - if type(v) == "string" then - t[k] = v - else - for kk, vv in next, v do -- vv = variable - if type(vv) == "string" then - t[vv.."."..v] = kk - end - end - end - end - instance['setup'][pathname] = t - else - instance['setup'][pathname] = data - end - else - if trace_locating then - logs.report("fileio","skipping configuration file '%s'",filename) - end - instance['setup'][pathname] = { } - instance.loaderror = true - end - elseif trace_locating then - logs.report("fileio","skipping configuration file '%s'",filename) - end - instance.order[#instance.order+1] = instance.setup[pathname] - if instance.loaderror then break end - end -end - -function resolvers.loadoldconfig() - if not instance.renewcache then - local cnffiles = instance.cnffiles - for i=1,#cnffiles do - local cnf = cnffiles[i] - local dname = file.dirname(cnf) - resolvers.load_data(dname,'configuration') - instance.order[#instance.order+1] = instance.configuration[dname] - if instance.loaderror then break end - end - end - resolvers.joinconfig() -end +-- we used to have 'files' and 'configurations' so therefore the following +-- shared function -function resolvers.expand_variables() - local expansions, environment, variables = { }, instance.environment, instance.variables - local env = resolvers.env - instance.expansions = expansions - local engine, progname = instance.engine, instance.progname - if type(engine) ~= "string" then instance.engine, engine = "", "" end - if type(progname) ~= "string" then instance.progname, progname = "", "" end - if engine ~= "" then environment['engine'] = engine end - if progname ~= "" then environment['progname'] = progname end - for k,v in next, environment do - local a, b = match(k,"^(%a+)%_(.*)%s*$") - if a and b then - expansions[a..'.'..b] = v - else - expansions[k] = v - end - end - for k,v in next, environment do -- move environment to expansions - if not expansions[k] then expansions[k] = v end - end - for k,v in next, variables do -- move variables to expansions - if not expansions[k] then expansions[k] = v end - end - local busy = false - local function resolve(a) - busy = true - return expansions[a] or env(a) - end - while true do - busy = false - for k,v in next, expansions do - local s, n = gsub(v,"%$([%a%d%_%-]+)",resolve) - local s, m = gsub(s,"%$%{([%a%d%_%-]+)%}",resolve) - if n > 0 or m > 0 then - expansions[k]= s - end - end - if not busy then break end - end - for k,v in next, expansions do - expansions[k] = gsub(v,"\\", '/') - end +function resolvers.datastate() + return caches.contentstate() end function resolvers.variable(name) - return entry(instance.variables,name) + local name = name and lpegmatch(dollarstripper,name) + local result = name and instance.variables[name] + return result ~= nil and result or "" end function resolvers.expansion(name) - return entry(instance.expansions,name) -end - -function resolvers.is_variable(name) - return is_entry(instance.variables,name) -end - -function resolvers.is_expansion(name) - return is_entry(instance.expansions,name) + local name = name and lpegmatch(dollarstripper,name) + local result = name and instance.expansions[name] + return result ~= nil and result or "" end -function resolvers.unexpanded_path_list(str) +function resolvers.unexpandedpathlist(str) local pth = resolvers.variable(str) - local lst = resolvers.split_path(pth) - return expanded_path_from_list(lst) + local lst = resolvers.splitpath(pth) + return expandedpathfromlist(lst) end -function resolvers.unexpanded_path(str) - return file.join_path(resolvers.unexpanded_path_list(str)) +function resolvers.unexpandedpath(str) + return joinpath(resolvers.unexpandedpathlist(str)) end -do -- no longer needed - - local done = { } +local done = { } - function resolvers.reset_extra_path() - local ep = instance.extra_paths - if not ep then - ep, done = { }, { } - instance.extra_paths = ep - elseif #ep > 0 then - instance.lists, done = { }, { } - end +function resolvers.resetextrapath() + local ep = instance.extra_paths + if not ep then + ep, done = { }, { } + instance.extra_paths = ep + elseif #ep > 0 then + instance.lists, done = { }, { } end +end - function resolvers.register_extra_path(paths,subpaths) - local ep = instance.extra_paths or { } - local n = #ep - if paths and paths ~= "" then - if subpaths and subpaths ~= "" then - for p in gmatch(paths,"[^,]+") do - -- we gmatch each step again, not that fast, but used seldom - for s in gmatch(subpaths,"[^,]+") do - local ps = p .. "/" .. s - if not done[ps] then - ep[#ep+1] = resolvers.clean_path(ps) - done[ps] = true - end - end - end - else - for p in gmatch(paths,"[^,]+") do - if not done[p] then - ep[#ep+1] = resolvers.clean_path(p) - done[p] = true - end - end - end - elseif subpaths and subpaths ~= "" then - for i=1,n do +function resolvers.registerextrapath(paths,subpaths) + local ep = instance.extra_paths or { } + local oldn = #ep + local newn = oldn + if paths and paths ~= "" then + if subpaths and subpaths ~= "" then + for p in gmatch(paths,"[^,]+") do -- we gmatch each step again, not that fast, but used seldom for s in gmatch(subpaths,"[^,]+") do - local ps = ep[i] .. "/" .. s + local ps = p .. "/" .. s if not done[ps] then - ep[#ep+1] = resolvers.clean_path(ps) + newn = newn + 1 + ep[newn] = resolvers.cleanpath(ps) done[ps] = true end end end + else + for p in gmatch(paths,"[^,]+") do + if not done[p] then + newn = newn + 1 + ep[newn] = resolvers.cleanpath(p) + done[p] = true + end + end end - if #ep > 0 then - instance.extra_paths = ep -- register paths - end - if #ep > n then - instance.lists = { } -- erase the cache + elseif subpaths and subpaths ~= "" then + for i=1,oldn do + -- we gmatch each step again, not that fast, but used seldom + for s in gmatch(subpaths,"[^,]+") do + local ps = ep[i] .. "/" .. s + if not done[ps] then + newn = newn + 1 + ep[newn] = resolvers.cleanpath(ps) + done[ps] = true + end + end end end - + if newn > 0 then + instance.extra_paths = ep -- register paths + end + if newn > oldn then + instance.lists = { } -- erase the cache + end end local function made_list(instance,list) @@ -9528,14 +11693,15 @@ local function made_list(instance,list) if not ep or #ep == 0 then return list else - local done, new = { }, { } + local done, new, newn = { }, { }, 0 -- honour . .. ../.. but only when at the start for k=1,#list do local v = list[k] if not done[v] then if find(v,"^[%.%/]$") then done[v] = true - new[#new+1] = v + newn = newn + 1 + new[newn] = v else break end @@ -9546,7 +11712,8 @@ local function made_list(instance,list) local v = ep[k] if not done[v] then done[v] = true - new[#new+1] = v + newn = newn + 1 + new[newn] = v end end -- next the formal paths @@ -9554,118 +11721,95 @@ local function made_list(instance,list) local v = list[k] if not done[v] then done[v] = true - new[#new+1] = v + newn = newn + 1 + new[newn] = v end end return new end end -function resolvers.clean_path_list(str) - local t = resolvers.expanded_path_list(str) +function resolvers.cleanpathlist(str) + local t = resolvers.expandedpathlist(str) if t then for i=1,#t do - t[i] = file.collapse_path(resolvers.clean_path(t[i])) + t[i] = collapsepath(resolvers.cleanpath(t[i])) end end return t end -function resolvers.expand_path(str) - return file.join_path(resolvers.expanded_path_list(str)) +function resolvers.expandpath(str) + return joinpath(resolvers.expandedpathlist(str)) end -function resolvers.expanded_path_list(str) +function resolvers.expandedpathlist(str) if not str then - return ep or { } -- ep ? + return { } elseif instance.savelists then - -- engine+progname hash - str = gsub(str,"%$","") + str = lpegmatch(dollarstripper,str) if not instance.lists[str] then -- cached - local lst = made_list(instance,resolvers.split_path(resolvers.expansion(str))) - instance.lists[str] = expanded_path_from_list(lst) + local lst = made_list(instance,resolvers.splitpath(resolvers.expansion(str))) + instance.lists[str] = expandedpathfromlist(lst) end return instance.lists[str] else - local lst = resolvers.split_path(resolvers.expansion(str)) - return made_list(instance,expanded_path_from_list(lst)) - end -end - -function resolvers.expanded_path_list_from_var(str) -- brrr - local tmp = resolvers.var_of_format_or_suffix(gsub(str,"%$","")) - if tmp ~= "" then - return resolvers.expanded_path_list(tmp) - else - return resolvers.expanded_path_list(str) + local lst = resolvers.splitpath(resolvers.expansion(str)) + return made_list(instance,expandedpathfromlist(lst)) end end -function resolvers.expand_path_from_var(str) - return file.join_path(resolvers.expanded_path_list_from_var(str)) +function resolvers.expandedpathlistfromvariable(str) -- brrr + str = lpegmatch(dollarstripper,str) + local tmp = resolvers.variableofformatorsuffix(str) + return resolvers.expandedpathlist(tmp ~= "" and tmp or str) end -function resolvers.format_of_var(str) - return formats[str] or formats[alternatives[str]] or '' -end -function resolvers.format_of_suffix(str) - return suffixmap[file.extname(str)] or 'tex' +function resolvers.expandpathfromvariable(str) + return joinpath(resolvers.expandedpathlistfromvariable(str)) end -function resolvers.variable_of_format(str) - return formats[str] or formats[alternatives[str]] or '' +function resolvers.expandbraces(str) -- output variable and brace expansion of STRING + local ori = resolvers.variable(str) + local pth = expandedpathfromlist(resolvers.splitpath(ori)) + return joinpath(pth) end -function resolvers.var_of_format_or_suffix(str) - local v = formats[str] - if v then - return v - end - v = formats[alternatives[str]] - if v then - return v - end - v = suffixmap[file.extname(str)] - if v then - return formats[isf] +function resolvers.registerfilehash(name,content,someerror) + if content then + instance.files[name] = content + else + instance.files[name] = { } + if somerror == true then -- can be unset + instance.loaderror = someerror + end end - return '' -end - -function resolvers.expand_braces(str) -- output variable and brace expansion of STRING - local ori = resolvers.variable(str) - local pth = expanded_path_from_list(resolvers.split_path(ori)) - return file.join_path(pth) end -resolvers.isreadable = { } - -function resolvers.isreadable.file(name) - local readable = lfs.isfile(name) -- brrr +local function isreadable(name) + local readable = lfs.isfile(name) -- not file.is_readable(name) asit can be a dir if trace_detail then if readable then - logs.report("fileio","file '%s' is readable",name) + report_resolving("file '%s' is readable",name) else - logs.report("fileio","file '%s' is not readable", name) + report_resolving("file '%s' is not readable", name) end end return readable end -resolvers.isreadable.tex = resolvers.isreadable.file - -- name -- name/name local function collect_files(names) - local filelist = { } + local filelist, noffiles = { }, 0 for k=1,#names do local fname = names[k] if trace_detail then - logs.report("fileio","checking name '%s'",fname) + report_resolving("checking name '%s'",fname) end - local bname = file.basename(fname) - local dname = file.dirname(fname) + local bname = filebasename(fname) + local dname = filedirname(fname) if dname == "" or find(dname,"^%.") then dname = false else @@ -9674,11 +11818,11 @@ local function collect_files(names) local hashes = instance.hashes for h=1,#hashes do local hash = hashes[h] - local blobpath = hash.tag + local blobpath = hash.name local files = blobpath and instance.files[blobpath] if files then if trace_detail then - logs.report("fileio","deep checking '%s' (%s)",blobpath,bname) + report_resolving("deep checking '%s' (%s)",blobpath,bname) end local blobfile = files[bname] if not blobfile then @@ -9690,62 +11834,51 @@ local function collect_files(names) end end if blobfile then + local blobroot = files.__path__ or blobpath if type(blobfile) == 'string' then if not dname or find(blobfile,dname) then - filelist[#filelist+1] = { - hash.type, - file.join(blobpath,blobfile,bname), -- search - resolvers.concatinators[hash.type](blobpath,blobfile,bname) -- result - } + local variant = hash.type + -- local search = filejoin(blobpath,blobfile,bname) + local search = filejoin(blobroot,blobfile,bname) + local result = methodhandler('concatinators',hash.type,blobroot,blobfile,bname) + if trace_detail then + report_resolving("match: variant '%s', search '%s', result '%s'",variant,search,result) + end + noffiles = noffiles + 1 + filelist[noffiles] = { variant, search, result } end else for kk=1,#blobfile do local vv = blobfile[kk] if not dname or find(vv,dname) then - filelist[#filelist+1] = { - hash.type, - file.join(blobpath,vv,bname), -- search - resolvers.concatinators[hash.type](blobpath,vv,bname) -- result - } + local variant = hash.type + -- local search = filejoin(blobpath,vv,bname) + local search = filejoin(blobroot,vv,bname) + local result = methodhandler('concatinators',hash.type,blobroot,vv,bname) + if trace_detail then + report_resolving("match: variant '%s', search '%s', result '%s'",variant,search,result) + end + noffiles = noffiles + 1 + filelist[noffiles] = { variant, search, result } end end end end elseif trace_locating then - logs.report("fileio","no match in '%s' (%s)",blobpath,bname) + report_resolving("no match in '%s' (%s)",blobpath,bname) end end end - if #filelist > 0 then - return filelist - else - return nil - end -end - -function resolvers.suffix_of_format(str) - if suffixes[str] then - return suffixes[str][1] - else - return "" - end -end - -function resolvers.suffixes_of_format(str) - if suffixes[str] then - return suffixes[str] - else - return {} - end + return noffiles > 0 and filelist or nil end -function resolvers.register_in_trees(name) +function resolvers.registerintrees(name) if not find(name,"^%.") then instance.foundintrees[name] = (instance.foundintrees[name] or 0) + 1 -- maybe only one end end --- split the next one up for readability (bu this module needs a cleanup anyway) +-- split the next one up for readability (but this module needs a cleanup anyway) local function can_be_dir(name) -- can become local local fakepaths = instance.fakepaths @@ -9756,61 +11889,62 @@ local function can_be_dir(name) -- can become local fakepaths[name] = 2 -- no directory end end - return (fakepaths[name] == 1) + return fakepaths[name] == 1 end -local function collect_instance_files(filename,collected) -- todo : plugin (scanners, checkers etc) - local result = collected or { } +local preparetreepattern = Cs((P(".")/"%%." + P("-")/"%%-" + P(1))^0 * Cc("$")) + +-- this one is split in smaller functions but it needs testing + +local function collect_instance_files(filename,askedformat,allresults) -- todo : plugin (scanners, checkers etc) + local result = { } local stamp = nil - filename = file.collapse_path(filename) + askedformat = askedformat or "" + filename = collapsepath(filename) -- speed up / beware: format problem - if instance.remember then - stamp = filename .. "--" .. instance.engine .. "--" .. instance.progname .. "--" .. instance.format + if instance.remember and not allresults then + stamp = filename .. "--" .. askedformat if instance.found[stamp] then if trace_locating then - logs.report("fileio","remembering file '%s'",filename) + report_resolving("remembered file '%s'",filename) end + resolvers.registerintrees(filename) -- for tracing used files return instance.found[stamp] end end - if not dangerous[instance.format or "?"] then - if resolvers.isreadable.file(filename) then + if not dangerous[askedformat] then + if isreadable(filename) then if trace_detail then - logs.report("fileio","file '%s' found directly",filename) + report_resolving("file '%s' found directly",filename) + end + if stamp then + instance.found[stamp] = { filename } end - instance.found[stamp] = { filename } return { filename } end end if find(filename,'%*') then if trace_locating then - logs.report("fileio","checking wildcard '%s'", filename) + report_resolving("checking wildcard '%s'", filename) end - result = resolvers.find_wildcard_files(filename) + result = resolvers.findwildcardfiles(filename) -- we can use th elocal elseif file.is_qualified_path(filename) then - if resolvers.isreadable.file(filename) then + if isreadable(filename) then if trace_locating then - logs.report("fileio","qualified name '%s'", filename) + report_resolving("qualified name '%s'", filename) end result = { filename } else - local forcedname, ok, suffix = "", false, file.extname(filename) + local forcedname, ok, suffix = "", false, fileextname(filename) if suffix == "" then -- why - if instance.format == "" then - forcedname = filename .. ".tex" - if resolvers.isreadable.file(forcedname) then - if trace_locating then - logs.report("fileio","no suffix, forcing standard filetype 'tex'") - end - result, ok = { forcedname }, true - end - else - local suffixes = resolvers.suffixes_of_format(instance.format) - for _, s in next, suffixes do + local format_suffixes = askedformat == "" and resolvers.defaultsuffixes or suffixes[askedformat] + if format_suffixes then + for i=1,#format_suffixes do + local s = format_suffixes[i] forcedname = filename .. "." .. s - if resolvers.isreadable.file(forcedname) then + if isreadable(forcedname) then if trace_locating then - logs.report("fileio","no suffix, forcing format filetype '%s'", s) + report_resolving("no suffix, forcing format filetype '%s'", s) end result, ok = { forcedname }, true break @@ -9821,23 +11955,24 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan if not ok and suffix ~= "" then -- try to find in tree (no suffix manipulation), here we search for the -- matching last part of the name - local basename = file.basename(filename) - local pattern = gsub(filename .. "$","([%.%-])","%%%1") - local savedformat = instance.format + local basename = filebasename(filename) + local pattern = lpegmatch(preparetreepattern,filename) + -- messy .. to be sorted out + local savedformat = askedformat local format = savedformat or "" if format == "" then - instance.format = resolvers.format_of_suffix(suffix) + askedformat = resolvers.formatofsuffix(suffix) end if not format then - instance.format = "othertextfiles" -- kind of everything, maybe texinput is better + askedformat = "othertextfiles" -- kind of everything, maybe texinput is better end -- if basename ~= filename then - local resolved = collect_instance_files(basename) - if #result == 0 then + local resolved = collect_instance_files(basename,askedformat,allresults) + if #result == 0 then -- shouldn't this be resolved ? local lowered = lower(basename) if filename ~= lowered then - resolved = collect_instance_files(lowered) + resolved = collect_instance_files(lowered,askedformat,allresults) end end resolvers.format = savedformat @@ -9862,57 +11997,60 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan -- end end if not ok and trace_locating then - logs.report("fileio","qualified name '%s'", filename) + report_resolving("qualified name '%s'", filename) end end else -- search spec - local filetype, extra, done, wantedfiles, ext = '', nil, false, { }, file.extname(filename) - if ext == "" then - if not instance.force_suffixes then - wantedfiles[#wantedfiles+1] = filename - end - else - wantedfiles[#wantedfiles+1] = filename - end - if instance.format == "" then - if ext == "" then - local forcedname = filename .. '.tex' - wantedfiles[#wantedfiles+1] = forcedname - filetype = resolvers.format_of_suffix(forcedname) - if trace_locating then - logs.report("fileio","forcing filetype '%s'",filetype) + local filetype, done, wantedfiles, ext = '', false, { }, fileextname(filename) + -- -- tricky as filename can be bla.1.2.3 + -- if not suffixmap[ext] then --- probably needs to be done elsewhere too + -- wantedfiles[#wantedfiles+1] = filename + -- end + wantedfiles[#wantedfiles+1] = filename + if askedformat == "" then + if ext == "" or not suffixmap[ext] then + local defaultsuffixes = resolvers.defaultsuffixes + for i=1,#defaultsuffixes do + local forcedname = filename .. '.' .. defaultsuffixes[i] + wantedfiles[#wantedfiles+1] = forcedname + filetype = resolvers.formatofsuffix(forcedname) + if trace_locating then + report_resolving("forcing filetype '%s'",filetype) + end end else - filetype = resolvers.format_of_suffix(filename) + filetype = resolvers.formatofsuffix(filename) if trace_locating then - logs.report("fileio","using suffix based filetype '%s'",filetype) + report_resolving("using suffix based filetype '%s'",filetype) end end else - if ext == "" then - local suffixes = resolvers.suffixes_of_format(instance.format) - for _, s in next, suffixes do - wantedfiles[#wantedfiles+1] = filename .. "." .. s + if ext == "" or not suffixmap[ext] then + local format_suffixes = suffixes[askedformat] + if format_suffixes then + for i=1,#format_suffixes do + wantedfiles[#wantedfiles+1] = filename .. "." .. format_suffixes[i] + end end end - filetype = instance.format + filetype = askedformat if trace_locating then - logs.report("fileio","using given filetype '%s'",filetype) + report_resolving("using given filetype '%s'",filetype) end end - local typespec = resolvers.variable_of_format(filetype) - local pathlist = resolvers.expanded_path_list(typespec) + local typespec = resolvers.variableofformat(filetype) + local pathlist = resolvers.expandedpathlist(typespec) if not pathlist or #pathlist == 0 then -- no pathlist, access check only / todo == wildcard if trace_detail then - logs.report("fileio","checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | ")) + report_resolving("checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | ")) end for k=1,#wantedfiles do local fname = wantedfiles[k] - if fname and resolvers.isreadable.file(fname) then + if fname and isreadable(fname) then filename, done = fname, true - result[#result+1] = file.join('.',fname) + result[#result+1] = filejoin('.',fname) break end end @@ -9920,8 +12058,8 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan local filelist = collect_files(wantedfiles) local fl = filelist and filelist[1] if fl then - filename = fl[3] - result[#result+1] = filename + filename = fl[3] -- not local? + result[#result+1] = resolvers.resolve(filename) done = true end else @@ -9930,76 +12068,65 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan local dirlist = { } if filelist then for i=1,#filelist do - dirlist[i] = file.dirname(filelist[i][2]) .. "/" + dirlist[i] = filedirname(filelist[i][3]) .. "/" -- was [2] .. gamble end end if trace_detail then - logs.report("fileio","checking filename '%s'",filename) + report_resolving("checking filename '%s'",filename) end - -- a bit messy ... esp the doscan setting here - local doscan for k=1,#pathlist do local path = pathlist[k] - if find(path,"^!!") then doscan = false else doscan = true end - local pathname = gsub(path,"^!+", '') + local pathname = lpegmatch(inhibitstripper,path) + local doscan = path == pathname -- no ^!! done = false -- using file list if filelist then - local expression -- compare list entries with permitted pattern -- /xx /xx// - if not find(pathname,"/$") then - expression = pathname .. "/" - else - expression = pathname - end - expression = gsub(expression,"([%-%.])","%%%1") -- this also influences - expression = gsub(expression,"//+$", '/.*') -- later usage of pathname - expression = gsub(expression,"//", '/.-/') -- not ok for /// but harmless - expression = "^" .. expression .. "$" + local expression = makepathexpression(pathname) if trace_detail then - logs.report("fileio","using pattern '%s' for path '%s'",expression,pathname) + report_resolving("using pattern '%s' for path '%s'",expression,pathname) end for k=1,#filelist do local fl = filelist[k] local f = fl[2] local d = dirlist[k] if find(d,expression) then - --- todo, test for readable - result[#result+1] = fl[3] - resolvers.register_in_trees(f) -- for tracing used files + -- todo, test for readable + result[#result+1] = resolvers.resolve(fl[3]) -- no shortcut done = true - if instance.allresults then + if allresults then if trace_detail then - logs.report("fileio","match in hash for file '%s' on path '%s', continue scanning",f,d) + report_resolving("match to '%s' in hash for file '%s' and path '%s', continue scanning",expression,f,d) end else if trace_detail then - logs.report("fileio","match in hash for file '%s' on path '%s', quit scanning",f,d) + report_resolving("match to '%s' in hash for file '%s' and path '%s', quit scanning",expression,f,d) end break end elseif trace_detail then - logs.report("fileio","no match in hash for file '%s' on path '%s'",f,d) + report_resolving("no match to '%s' in hash for file '%s' and path '%s'",expression,f,d) end end end if not done and doscan then -- check if on disk / unchecked / does not work at all / also zips - if resolvers.splitmethod(pathname).scheme == 'file' then -- ? + local scheme = url.hasscheme(pathname) + if not scheme or scheme == "file" then local pname = gsub(pathname,"%.%*$",'') if not find(pname,"%*") then local ppname = gsub(pname,"/+$","") if can_be_dir(ppname) then for k=1,#wantedfiles do local w = wantedfiles[k] - local fname = file.join(ppname,w) - if resolvers.isreadable.file(fname) then + local fname = filejoin(ppname,w) + if isreadable(fname) then if trace_detail then - logs.report("fileio","found '%s' by scanning",fname) + report_resolving("found '%s' by scanning",fname) end result[#result+1] = fname done = true - if not instance.allresults then break end + if not allresults then break end end end else @@ -10009,56 +12136,66 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan end end if not done and doscan then - -- todo: slow path scanning + -- todo: slow path scanning ... although we now have tree:// supported in $TEXMF end - if done and not instance.allresults then break end + if done and not allresults then break end end end end for k=1,#result do - result[k] = file.collapse_path(result[k]) + local rk = collapsepath(result[k]) + result[k] = rk + resolvers.registerintrees(rk) -- for tracing used files end - if instance.remember then + if stamp then instance.found[stamp] = result end return result end -if not resolvers.concatinators then resolvers.concatinators = { } end +-- -- -- begin of main file search routing -- -- -- -resolvers.concatinators.tex = file.join -resolvers.concatinators.file = resolvers.concatinators.tex -function resolvers.find_files(filename,filetype,mustexist) - if type(mustexist) == boolean then - -- all set - elseif type(filetype) == 'boolean' then - filetype, mustexist = nil, false - elseif type(filetype) ~= 'string' then - filetype, mustexist = nil, false - end - instance.format = filetype or '' - local result = collect_instance_files(filename) + + + + + + + + +-- -- -- end of main file search routing -- -- -- + +local function findfiles(filename,filetype,allresults) + local result = collect_instance_files(filename,filetype or "",allresults) if #result == 0 then local lowered = lower(filename) if filename ~= lowered then - return collect_instance_files(lowered) + return collect_instance_files(lowered,filetype or "",allresults) end end - instance.format = '' return result end -function resolvers.find_file(filename,filetype,mustexist) - return (resolvers.find_files(filename,filetype,mustexist)[1] or "") +function resolvers.findfiles(filename,filetype) + return findfiles(filename,filetype,true) +end + +function resolvers.findfile(filename,filetype) + return findfiles(filename,filetype,false)[1] or "" +end + +function resolvers.findpath(filename,filetype) + return filedirname(findfiles(filename,filetype,false)[1] or "") end -function resolvers.find_given_files(filename) - local bname, result = file.basename(filename), { } +local function findgivenfiles(filename,allresults) + local bname, result = filebasename(filename), { } local hashes = instance.hashes + local noffound = 0 for k=1,#hashes do local hash = hashes[k] - local files = instance.files[hash.tag] or { } + local files = instance.files[hash.name] or { } local blist = files[bname] if not blist then local rname = "remap:"..bname @@ -10070,13 +12207,21 @@ function resolvers.find_given_files(filename) end if blist then if type(blist) == 'string' then - result[#result+1] = resolvers.concatinators[hash.type](hash.tag,blist,bname) or "" - if not instance.allresults then break end + local found = methodhandler('concatinators',hash.type,hash.name,blist,bname) or "" + if found ~= "" then + noffound = noffound + 1 + result[noffound] = resolvers.resolve(found) + if not allresults then break end + end else for kk=1,#blist do local vv = blist[kk] - result[#result+1] = resolvers.concatinators[hash.type](hash.tag,vv,bname) or "" - if not instance.allresults then break end + local found = methodhandler('concatinators',hash.type,hash.name,vv,bname) or "" + if found ~= "" then + noffound = noffound + 1 + result[noffound] = resolvers.resolve(found) + if not allresults then break end + end end end end @@ -10084,24 +12229,31 @@ function resolvers.find_given_files(filename) return result end -function resolvers.find_given_file(filename) - return (resolvers.find_given_files(filename)[1] or "") +function resolvers.findgivenfiles(filename) + return findgivenfiles(filename,true) end -local function doit(path,blist,bname,tag,kind,result,allresults) +function resolvers.findgivenfile(filename) + return findgivenfiles(filename,false)[1] or "" +end + +local function doit(path,blist,bname,tag,variant,result,allresults) local done = false - if blist and kind then + if blist and variant then + local resolve = resolvers.resolve -- added if type(blist) == 'string' then -- make function and share code if find(lower(blist),path) then - result[#result+1] = resolvers.concatinators[kind](tag,blist,bname) or "" + local full = methodhandler('concatinators',variant,tag,blist,bname) or "" + result[#result+1] = resolve(full) done = true end else for kk=1,#blist do local vv = blist[kk] if find(lower(vv),path) then - result[#result+1] = resolvers.concatinators[kind](tag,vv,bname) or "" + local full = methodhandler('concatinators',variant,tag,vv,bname) or "" + result[#result+1] = resolve(full) done = true if not allresults then break end end @@ -10111,30 +12263,32 @@ local function doit(path,blist,bname,tag,kind,result,allresults) return done end -function resolvers.find_wildcard_files(filename) -- todo: remap: - local result = { } - local bname, dname = file.basename(filename), file.dirname(filename) - local path = gsub(dname,"^*/","") - path = gsub(path,"*",".*") - path = gsub(path,"-","%%-") - if dname == "" then - path = ".*" - end - local name = bname - name = gsub(name,"*",".*") - name = gsub(name,"-","%%-") - path = lower(path) - name = lower(name) - local files, allresults, done = instance.files, instance.allresults, false + +local makewildcard = Cs( + (P("^")^0 * P("/") * P(-1) + P(-1)) /".*" + + (P("^")^0 * P("/") / "")^0 * (P("*")/".*" + P("-")/"%%-" + P(".")/"%%." + P("?")/"."+ P("\\")/"/" + P(1))^0 +) + +function resolvers.wildcardpattern(pattern) + return lpegmatch(makewildcard,pattern) or pattern +end + +local function findwildcardfiles(filename,allresults,result) -- todo: remap: and lpeg + result = result or { } + local base = filebasename(filename) + local dirn = filedirname(filename) + local path = lower(lpegmatch(makewildcard,dirn) or dirn) + local name = lower(lpegmatch(makewildcard,base) or base) + local files, done = instance.files, false if find(name,"%*") then local hashes = instance.hashes for k=1,#hashes do local hash = hashes[k] - local tag, kind = hash.tag, hash.type - for kk, hh in next, files[hash.tag] do + local hashname, hashtype = hash.name, hash.type + for kk, hh in next, files[hashname] do if not find(kk,"^remap:") then if find(lower(kk),name) then - if doit(path,hh,kk,tag,kind,result,allresults) then done = true end + if doit(path,hh,kk,hashname,hashtype,result,allresults) then done = true end if done and not allresults then break end end end @@ -10144,8 +12298,8 @@ function resolvers.find_wildcard_files(filename) -- todo: remap: local hashes = instance.hashes for k=1,#hashes do local hash = hashes[k] - local tag, kind = hash.tag, hash.type - if doit(path,files[tag][bname],bname,tag,kind,result,allresults) then done = true end + local hashname, hashtype = hash.name, hash.type + if doit(path,files[hashname][bname],bname,hashname,hashtype,result,allresults) then done = true end if done and not allresults then break end end end @@ -10154,8 +12308,12 @@ function resolvers.find_wildcard_files(filename) -- todo: remap: return result end -function resolvers.find_wildcard_file(filename) - return (resolvers.find_wildcard_files(filename)[1] or "") +function resolvers.findwildcardfiles(filename,result) + return findwildcardfiles(filename,true,result) +end + +function resolvers.findwildcardfile(filename) + return findwildcardfiles(filename,false)[1] or "" end -- main user functions @@ -10166,34 +12324,33 @@ end function resolvers.load(option) statistics.starttiming(instance) - resolvers.resetconfig() - resolvers.identify_cnf() - resolvers.load_lua() -- will become the new method - resolvers.expand_variables() - resolvers.load_cnf() -- will be skipped when we have a lua file - resolvers.expand_variables() + identify_configuration_files() + load_configuration_files() if option ~= "nofiles" then - resolvers.load_hash() + load_databases() resolvers.automount() end statistics.stoptiming(instance) + local files = instance.files + return files and next(files) and true +end + +local function report(str) + if trace_locating then + report_resolving(str) -- has already verbose + else + print(str) + end end -function resolvers.for_files(command, files, filetype, mustexist) +function resolvers.dowithfilesandreport(command, files, ...) -- will move if files and #files > 0 then - local function report(str) - if trace_locating then - logs.report("fileio",str) -- has already verbose - else - print(str) - end - end if trace_locating then report('') -- ? end for f=1,#files do local file = files[f] - local result = command(file,filetype,mustexist) + local result = command(file,...) if type(result) == 'string' then report(result) else @@ -10205,21 +12362,16 @@ function resolvers.for_files(command, files, filetype, mustexist) end end --- strtab +-- obsolete -resolvers.var_value = resolvers.variable -- output the value of variable $STRING. -resolvers.expand_var = resolvers.expansion -- output variable expansion of STRING. +-- resolvers.varvalue = resolvers.variable -- output the value of variable $STRING. +-- resolvers.expandvar = resolvers.expansion -- output variable expansion of STRING. -function resolvers.show_path(str) -- output search path for file type NAME - return file.join_path(resolvers.expanded_path_list(resolvers.format_of_var(str))) +function resolvers.showpath(str) -- output search path for file type NAME + return joinpath(resolvers.expandedpathlist(resolvers.formatofvariable(str))) end --- resolvers.find_file(filename) --- resolvers.find_file(filename, filetype, mustexist) --- resolvers.find_file(filename, mustexist) --- resolvers.find_file(filename, filetype) - -function resolvers.register_file(files, name, path) +function resolvers.registerfile(files, name, path) if files[name] then if type(files[name]) == 'string' then files[name] = { files[name], path } @@ -10231,101 +12383,24 @@ function resolvers.register_file(files, name, path) end end -function resolvers.splitmethod(filename) - if not filename then - return { } -- safeguard - elseif type(filename) == "table" then - return filename -- already split - elseif not find(filename,"://") then - return { scheme="file", path = filename, original=filename } -- quick hack - else - return url.hashed(filename) - end -end - -function table.sequenced(t,sep) -- temp here - local s = { } - for k, v in next, t do -- indexed? - s[#s+1] = k .. "=" .. tostring(v) - end - return concat(s, sep or " | ") -end - -function resolvers.methodhandler(what, filename, filetype) -- ... - filename = file.collapse_path(filename) - local specification = (type(filename) == "string" and resolvers.splitmethod(filename)) or filename -- no or { }, let it bomb - local scheme = specification.scheme - if resolvers[what][scheme] then - if trace_locating then - logs.report("fileio","handler '%s' -> '%s' -> '%s'",specification.original,what,table.sequenced(specification)) - end - return resolvers[what][scheme](filename,filetype) -- todo: specification - else - return resolvers[what].tex(filename,filetype) -- todo: specification - end -end - -function resolvers.clean_path(str) - if str then - str = gsub(str,"\\","/") - str = gsub(str,"^!+","") - str = gsub(str,"^~",resolvers.homedir) - return str - else - return nil - end -end - -function resolvers.do_with_path(name,func) - local pathlist = resolvers.expanded_path_list(name) +function resolvers.dowithpath(name,func) + local pathlist = resolvers.expandedpathlist(name) for i=1,#pathlist do - func("^"..resolvers.clean_path(pathlist[i])) + func("^"..resolvers.cleanpath(pathlist[i])) end end -function resolvers.do_with_var(name,func) - func(expanded_var(name)) -end - -function resolvers.with_files(pattern,handle) - local hashes = instance.hashes - for i=1,#hashes do - local hash = hashes[i] - local blobpath = hash.tag - local blobtype = hash.type - if blobpath then - local files = instance.files[blobpath] - if files then - for k,v in next, files do - if find(k,"^remap:") then - k = files[k] - v = files[k] -- chained - end - if find(k,pattern) then - if type(v) == "string" then - handle(blobtype,blobpath,v,k) - else - for _,vv in next, v do -- indexed - handle(blobtype,blobpath,vv,k) - end - end - end - end - end - end - end +function resolvers.dowithvariable(name,func) + func(expandedvariable(name)) end -function resolvers.locate_format(name) - local barename, fmtname = gsub(name,"%.%a+$",""), "" - if resolvers.usecache then - local path = file.join(caches.setpath("formats")) -- maybe platform - fmtname = file.join(path,barename..".fmt") or "" - end +function resolvers.locateformat(name) + local barename = file.removesuffix(name) -- gsub(name,"%.%a+$","") + local fmtname = caches.getfirstreadablefile(barename..".fmt","formats") or "" if fmtname == "" then - fmtname = resolvers.find_files(barename..".fmt")[1] or "" + fmtname = resolvers.findfile(barename..".fmt") + fmtname = resolvers.cleanpath(fmtname) end - fmtname = resolvers.clean_path(fmtname) if fmtname ~= "" then local barename = file.removesuffix(fmtname) local luaname, lucname, luiname = barename .. ".lua", barename .. ".luc", barename .. ".lui" @@ -10340,7 +12415,7 @@ function resolvers.locate_format(name) return nil, nil end -function resolvers.boolean_variable(str,default) +function resolvers.booleanvariable(str,default) local b = resolvers.expansion(str) if b == "" then return default @@ -10350,204 +12425,62 @@ function resolvers.boolean_variable(str,default) end end -texconfig.kpse_init = false - -kpse = { original = kpse } setmetatable(kpse, { __index = function(k,v) return resolvers[v] end } ) - --- for a while - -input = resolvers - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['data-tmp'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - ---[[ldx-- -

This module deals with caching data. It sets up the paths and -implements loaders and savers for tables. Best is to set the -following variable. When not set, the usual paths will be -checked. Personally I prefer the (users) temporary path.

- - -TEXMFCACHE=$TMP;$TEMP;$TMPDIR;$TEMPDIR;$HOME;$TEXMFVAR;$VARTEXMF;. - - -

Currently we do no locking when we write files. This is no real -problem because most caching involves fonts and the chance of them -being written at the same time is small. We also need to extend -luatools with a recache feature.

---ldx]]-- - -local format, lower, gsub = string.format, string.lower, string.gsub - -local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) -- not used yet - -caches = caches or { } - -caches.path = caches.path or nil -caches.base = caches.base or "luatex-cache" -caches.more = caches.more or "context" -caches.direct = false -- true is faster but may need huge amounts of memory -caches.tree = false -caches.paths = caches.paths or nil -caches.force = true -- changed for TEXLIVE by TH -caches.defaults = { "TEXMFCACHE", "TMPDIR", "TEMPDIR", "TMP", "TEMP", "HOME", "HOMEPATH" } - -function caches.temp() - local cachepath = nil - local function check(list,isenv) - if not cachepath then - for k=1,#list do - local v = list[k] - cachepath = (isenv and (os.env[v] or "")) or v or "" - if cachepath == "" then - -- next - else - cachepath = resolvers.clean_path(cachepath) - if lfs.isdir(cachepath) and file.iswritable(cachepath) then -- lfs.attributes(cachepath,"mode") == "directory" - break - elseif caches.force or io.ask(format("\nShould I create the cache path %s?",cachepath), "no", { "yes", "no" }) == "yes" then - dir.mkdirs(cachepath) - if lfs.isdir(cachepath) and file.iswritable(cachepath) then - break +function resolvers.dowithfilesintree(pattern,handle,before,after) -- will move, can be a nice iterator instead + local instance = resolvers.instance + local hashes = instance.hashes + for i=1,#hashes do + local hash = hashes[i] + local blobtype = hash.type + local blobpath = hash.name + if blobpath then + if before then + before(blobtype,blobpath,pattern) + end + local files = instance.files[blobpath] + local total, checked, done = 0, 0, 0 + if files then + for k,v in next, files do + total = total + 1 + if find(k,"^remap:") then + k = files[k] + v = k -- files[k] -- chained + end + if find(k,pattern) then + if type(v) == "string" then + checked = checked + 1 + if handle(blobtype,blobpath,v,k) then + done = done + 1 + end + else + checked = checked + #v + for i=1,#v do + if handle(blobtype,blobpath,v[i],k) then + done = done + 1 + end + end end end end - cachepath = nil + end + if after then + after(blobtype,blobpath,pattern,total,checked,done) end end end - check(resolvers.clean_path_list("TEXMFCACHE") or { }) - check(caches.defaults,true) - if not cachepath then - print("\nfatal error: there is no valid (writable) cache path defined\n") - os.exit() - elseif not lfs.isdir(cachepath) then -- lfs.attributes(cachepath,"mode") ~= "directory" - print(format("\nfatal error: cache path %s is not a directory\n",cachepath)) - os.exit() - end - cachepath = file.collapse_path(cachepath) - function caches.temp() - return cachepath - end - return cachepath -end - -function caches.configpath() - return table.concat(resolvers.instance.cnffiles,";") -end - -function caches.hashed(tree) - return md5.hex(gsub(lower(tree),"[\\\/]+","/")) -end - -function caches.treehash() - local tree = caches.configpath() - if not tree or tree == "" then - return false - else - return caches.hashed(tree) - end -end - -function caches.setpath(...) - if not caches.path then - if not caches.path then - caches.path = caches.temp() - end - caches.path = resolvers.clean_path(caches.path) -- to be sure - caches.tree = caches.tree or caches.treehash() - if caches.tree then - caches.path = dir.mkdirs(caches.path,caches.base,caches.more,caches.tree) - else - caches.path = dir.mkdirs(caches.path,caches.base,caches.more) - end - end - if not caches.path then - caches.path = '.' - end - caches.path = resolvers.clean_path(caches.path) - local dirs = { ... } - if #dirs > 0 then - local pth = dir.mkdirs(caches.path,...) - return pth - end - caches.path = dir.expand_name(caches.path) - return caches.path -end - -function caches.definepath(category,subcategory) - return function() - return caches.setpath(category,subcategory) - end -end - -function caches.setluanames(path,name) - return path .. "/" .. name .. ".tma", path .. "/" .. name .. ".tmc" -end - -function caches.loaddata(path,name) - local tmaname, tmcname = caches.setluanames(path,name) - local loader = loadfile(tmcname) or loadfile(tmaname) - if loader then - loader = loader() - collectgarbage("step") - return loader - else - return false - end -end - ---~ function caches.loaddata(path,name) ---~ local tmaname, tmcname = caches.setluanames(path,name) ---~ return dofile(tmcname) or dofile(tmaname) ---~ end - -function caches.iswritable(filepath,filename) - local tmaname, tmcname = caches.setluanames(filepath,filename) - return file.iswritable(tmaname) -end - -function caches.savedata(filepath,filename,data,raw) - local tmaname, tmcname = caches.setluanames(filepath,filename) - local reduce, simplify = true, true - if raw then - reduce, simplify = false, false - end - data.cache_uuid = os.uuid() - if caches.direct then - file.savedata(tmaname, table.serialize(data,'return',false,true,false)) -- no hex - else - table.tofile(tmaname, data,'return',false,true,false) -- maybe not the last true - end - local cleanup = resolvers.boolean_variable("PURGECACHE", false) - local strip = resolvers.boolean_variable("LUACSTRIP", true) - utils.lua.compile(tmaname, tmcname, cleanup, strip) end --- here we use the cache for format loading (texconfig.[formatname|jobname]) +resolvers.obsolete = resolvers.obsolete or { } +local obsolete = resolvers.obsolete ---~ if tex and texconfig and texconfig.formatname and texconfig.formatname == "" then -if tex and texconfig and (not texconfig.formatname or texconfig.formatname == "") and input and resolvers.instance then - if not texconfig.luaname then texconfig.luaname = "cont-en.lua" end -- or luc - texconfig.formatname = caches.setpath("formats") .. "/" .. gsub(texconfig.luaname,"%.lu.$",".fmt") -end +resolvers.find_file = resolvers.findfile obsolete.find_file = resolvers.findfile +resolvers.find_files = resolvers.findfiles obsolete.find_files = resolvers.findfiles end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['data-res'] = { +if not modules then modules = { } end modules ['data-pre'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -10555,17 +12488,28 @@ if not modules then modules = { } end modules ['data-res'] = { license = "see context related readme files" } ---~ print(resolvers.resolve("abc env:tmp file:cont-en.tex path:cont-en.tex full:cont-en.tex rel:zapf/one/p-chars.tex")) +-- It could be interesting to hook the resolver in the file +-- opener so that unresolved prefixes travel around and we +-- get more abstraction. -local upper, lower, gsub = string.upper, string.lower, string.gsub +-- As we use this beforehand we will move this up in the chain +-- of loading. -local prefixes = { } + +local resolvers = resolvers +local prefixes = utilities.storage.allocate() +resolvers.prefixes = prefixes + +local gsub = string.gsub +local cleanpath, findgivenfile, expansion = resolvers.cleanpath, resolvers.findgivenfile, resolvers.expansion +local getenv = resolvers.getenv -- we can probably also use resolvers.expansion +local P, Cs, lpegmatch = lpeg.P, lpeg.Cs, lpeg.match prefixes.environment = function(str) - return resolvers.clean_path(os.getenv(str) or os.getenv(upper(str)) or os.getenv(lower(str)) or "") + return cleanpath(expansion(str)) end -prefixes.relative = function(str,n) +prefixes.relative = function(str,n) -- lfs.isfile if io.exists(str) then -- nothing elseif io.exists("./" .. str) then @@ -10581,7 +12525,7 @@ prefixes.relative = function(str,n) end end end - return resolvers.clean_path(str) + return cleanpath(str) end prefixes.auto = function(str) @@ -10593,18 +12537,34 @@ prefixes.auto = function(str) end prefixes.locate = function(str) - local fullname = resolvers.find_given_file(str) or "" - return resolvers.clean_path((fullname ~= "" and fullname) or str) + local fullname = findgivenfile(str) or "" + return cleanpath((fullname ~= "" and fullname) or str) end prefixes.filename = function(str) - local fullname = resolvers.find_given_file(str) or "" - return resolvers.clean_path(file.basename((fullname ~= "" and fullname) or str)) + local fullname = findgivenfile(str) or "" + return cleanpath(file.basename((fullname ~= "" and fullname) or str)) end prefixes.pathname = function(str) - local fullname = resolvers.find_given_file(str) or "" - return resolvers.clean_path(file.dirname((fullname ~= "" and fullname) or str)) + local fullname = findgivenfile(str) or "" + return cleanpath(file.dirname((fullname ~= "" and fullname) or str)) +end + +prefixes.selfautoloc = function(str) + return cleanpath(file.join(getenv('SELFAUTOLOC'),str)) +end + +prefixes.selfautoparent = function(str) + return cleanpath(file.join(getenv('SELFAUTOPARENT'),str)) +end + +prefixes.selfautodir = function(str) + return cleanpath(file.join(getenv('SELFAUTODIR'),str)) +end + +prefixes.home = function(str) + return cleanpath(file.join(getenv('HOME'),str)) end prefixes.env = prefixes.environment @@ -10633,26 +12593,71 @@ local function _resolve_(method,target) end end -local function resolve(str) - if type(str) == "table" then - for k=1,#str do - local v = str[k] - str[k] = resolve(v) or v +local resolved, abstract = { }, { } + +function resolvers.resetresolve(str) + resolved, abstract = { }, { } +end + +local function resolve(str) -- use schemes, this one is then for the commandline only + local res = resolved[str] + if not res then + res = gsub(str,"([a-z][a-z]+):([^ \"\']*)",_resolve_) + resolved[str] = res + abstract[res] = str + end + return res +end + +local function unresolve(str) + return abstract[str] or str +end + +resolvers.resolve = resolve +resolvers.unresolve = unresolve + +if os.uname then + + for k, v in next, os.uname() do + if not prefixes[k] then + prefixes[k] = function() return v end + end + end + +end + +if os.type == "unix" then + + local pattern + + local function makepattern(t,k,v) + local colon = P(":") + local p + for k, v in table.sortedpairs(prefixes) do + if p then + p = P(k) + p + else + p = P(k) + end + end + pattern = Cs((p * colon + colon/";" + P(1))^0) + if t then + t[k] = v end - elseif str and str ~= "" then - str = gsub(str,"([a-z]+):([^ \"\']*)",_resolve_) end - return str -end -resolvers.resolve = resolve + makepattern() -if os.uname then + getmetatable(prefixes).__newindex = makepattern - for k, v in next, os.uname() do - if not prefixes[k] then - prefixes[k] = function() return v end - end + function resolvers.repath(str) + return lpegmatch(pattern,str) + end + +else -- already the default: + + function resolvers.repath(str) + return str end end @@ -10670,13 +12675,23 @@ if not modules then modules = { } end modules ['data-inp'] = { license = "see context related readme files" } -resolvers.finders = resolvers.finders or { } -resolvers.openers = resolvers.openers or { } -resolvers.loaders = resolvers.loaders or { } +local allocate = utilities.storage.allocate +local resolvers = resolvers + +local methodhandler = resolvers.methodhandler +local registermethod = resolvers.registermethod -resolvers.finders.notfound = { nil } -resolvers.openers.notfound = { nil } -resolvers.loaders.notfound = { false, nil, 0 } +local finders = allocate { helpers = { }, notfound = function() end } +local openers = allocate { helpers = { }, notfound = function() end } +local loaders = allocate { helpers = { }, notfound = function() return false, nil, 0 end } + +registermethod("finders", finders, "uri") +registermethod("openers", openers, "uri") +registermethod("loaders", loaders, "uri") + +resolvers.finders = finders +resolvers.openers = openers +resolvers.loaders = loaders end -- of closure @@ -10691,15 +12706,23 @@ if not modules then modules = { } end modules ['data-out'] = { license = "see context related readme files" } -outputs = outputs or { } +local allocate = utilities.storage.allocate +local resolvers = resolvers + +local registermethod = resolvers.registermethod +local savers = allocate { helpers = { } } + +resolvers.savers = savers + +registermethod("savers", savers, "uri") end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['data-con'] = { +if not modules then modules = { } end modules ['data-fil'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -10707,6 +12730,124 @@ if not modules then modules = { } end modules ['data-con'] = { license = "see context related readme files" } +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) + +local report_files = logs.reporter("resolvers","files") + +local resolvers = resolvers + +local finders, openers, loaders, savers = resolvers.finders, resolvers.openers, resolvers.loaders, resolvers.savers +local locators, hashers, generators, concatinators = resolvers.locators, resolvers.hashers, resolvers.generators, resolvers.concatinators + +local checkgarbage = utilities.garbagecollector and utilities.garbagecollector.check + +function locators.file(specification) + local name = specification.filename + local realname = resolvers.resolve(name) -- no shortcut + if realname and realname ~= '' and lfs.isdir(realname) then + if trace_locating then + report_files("file locator '%s' found as '%s'",name,realname) + end + resolvers.appendhash('file',name,true) -- cache + elseif trace_locating then + report_files("file locator '%s' not found",name) + end +end + +function hashers.file(specification) + local name = specification.filename + local content = caches.loadcontent(name,'files') + resolvers.registerfilehash(name,content,content==nil) +end + +function generators.file(specification) + local path = specification.filename + local content = resolvers.scanfiles(path) + resolvers.registerfilehash(path,content,true) +end + +concatinators.file = file.join + +function finders.file(specification,filetype) + local filename = specification.filename + local foundname = resolvers.findfile(filename,filetype) + if foundname and foundname ~= "" then + if trace_locating then + report_files("file finder: '%s' found",filename) + end + return foundname + else + if trace_locating then + report_files("file finder: %s' not found",filename) + end + return finders.notfound() + end +end + +-- The default textopener will be overloaded later on. + +function openers.helpers.textopener(tag,filename,f) + return { + reader = function() return f:read () end, + close = function() logs.show_close(filename) return f:close() end, + } +end + +function openers.file(specification,filetype) + local filename = specification.filename + if filename and filename ~= "" then + local f = io.open(filename,"r") + if f then + if trace_locating then + report_files("file opener, '%s' opened",filename) + end + return openers.helpers.textopener("file",filename,f) + end + end + if trace_locating then + report_files("file opener, '%s' not found",filename) + end + return openers.notfound() +end + +function loaders.file(specification,filetype) + local filename = specification.filename + if filename and filename ~= "" then + local f = io.open(filename,"rb") + if f then + logs.show_load(filename) + if trace_locating then + report_files("file loader, '%s' loaded",filename) + end + local s = f:read("*a") + if checkgarbage then + checkgarbage(#s) + end + f:close() + if s then + return true, s, #s + end + end + end + if trace_locating then + report_files("file loader, '%s' not found",filename) + end + return loaders.notfound() +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-con'] = { + version = 1.100, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + local format, lower, gsub = string.format, string.lower, string.gsub local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) @@ -10726,50 +12867,63 @@ table structures without bothering about the disk cache.

Examples of usage can be found in the font related code.

--ldx]]-- -containers = containers or { } - +containers = containers or { } +local containers = containers containers.usecache = true +local report_containers = logs.reporter("resolvers","containers") + local function report(container,tag,name) if trace_cache or trace_containers then - logs.report(format("%s cache",container.subcategory),"%s: %s",tag,name or 'invalid') + report_containers("container: %s, tag: %s, name: %s",container.subcategory,tag,name or 'invalid') end end local allocated = { } --- tracing +local mt = { + __index = function(t,k) + if k == "writable" then + local writable = caches.getwritablepath(t.category,t.subcategory) or { "." } + t.writable = writable + return writable + elseif k == "readables" then + local readables = caches.getreadablepaths(t.category,t.subcategory) or { "." } + t.readables = readables + return readables + end + end, + __storage__ = true +} function containers.define(category, subcategory, version, enabled) - return function() - if category and subcategory then - local c = allocated[category] - if not c then - c = { } - allocated[category] = c - end - local s = c[subcategory] - if not s then - s = { - category = category, - subcategory = subcategory, - storage = { }, - enabled = enabled, - version = version or 1.000, - trace = false, - path = caches and caches.setpath and caches.setpath(category,subcategory), - } - c[subcategory] = s - end - return s - else - return nil + if category and subcategory then + local c = allocated[category] + if not c then + c = { } + allocated[category] = c + end + local s = c[subcategory] + if not s then + s = { + category = category, + subcategory = subcategory, + storage = { }, + enabled = enabled, + version = version or math.pi, -- after all, this is TeX + trace = false, + -- writable = caches.getwritablepath and caches.getwritablepath (category,subcategory) or { "." }, + -- readables = caches.getreadablepaths and caches.getreadablepaths(category,subcategory) or { "." }, + } + setmetatable(s,mt) + c[subcategory] = s end + return s end end function containers.is_usable(container, name) - return container.enabled and caches and caches.iswritable(container.path, name) + return container.enabled and caches and caches.is_writable(container.writable, name) end function containers.is_valid(container, name) @@ -10782,18 +12936,20 @@ function containers.is_valid(container, name) end function containers.read(container,name) - if container.enabled and caches and not container.storage[name] and containers.usecache then - container.storage[name] = caches.loaddata(container.path,name) - if containers.is_valid(container,name) then + local storage = container.storage + local stored = storage[name] + if not stored and container.enabled and caches and containers.usecache then + stored = caches.loaddata(container.readables,name) + if stored and stored.cache_version == container.version then report(container,"loaded",name) else - container.storage[name] = nil + stored = nil end - end - if container.storage[name] then + storage[name] = stored + elseif stored then report(container,"reusing",name) end - return container.storage[name] + return stored end function containers.write(container, name, data) @@ -10802,7 +12958,7 @@ function containers.write(container, name, data) if container.enabled and caches then local unique, shared = data.unique, data.shared data.unique, data.shared = nil, nil - caches.savedata(container.path, name, data) + caches.savedata(container.writable, name, data) report(container,"saved",name) data.unique, data.shared = unique, shared end @@ -10837,50 +12993,18 @@ local format, lower, gsub, find = string.format, string.lower, string.gsub, stri local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) --- since we want to use the cache instead of the tree, we will now --- reimplement the saver. - -local save_data = resolvers.save_data -local load_data = resolvers.load_data - -resolvers.cachepath = nil -- public, for tracing -resolvers.usecache = true -- public, for tracing +local report_mounts = logs.reporter("resolvers","mounts") -function resolvers.save_data(dataname) - save_data(dataname, function(cachename,dataname) - resolvers.usecache = not toboolean(resolvers.expansion("CACHEINTDS") or "false",true) - if resolvers.usecache then - resolvers.cachepath = resolvers.cachepath or caches.definepath("trees") - return file.join(resolvers.cachepath(),caches.hashed(cachename)) - else - return file.join(cachename,dataname) - end - end) -end - -function resolvers.load_data(pathname,dataname,filename) - load_data(pathname,dataname,filename,function(dataname,filename) - resolvers.usecache = not toboolean(resolvers.expansion("CACHEINTDS") or "false",true) - if resolvers.usecache then - resolvers.cachepath = resolvers.cachepath or caches.definepath("trees") - return file.join(resolvers.cachepath(),caches.hashed(pathname)) - else - if not filename or (filename == "") then - filename = dataname - end - return file.join(pathname,filename) - end - end) -end +local resolvers = resolvers -- we will make a better format, maybe something xml or just text or lua resolvers.automounted = resolvers.automounted or { } function resolvers.automount(usecache) - local mountpaths = resolvers.clean_path_list(resolvers.expansion('TEXMFMOUNT')) + local mountpaths = resolvers.cleanpathlist(resolvers.expansion('TEXMFMOUNT')) if (not mountpaths or #mountpaths == 0) and usecache then - mountpaths = { caches.setpath("mount") } + mountpaths = caches.getreadablepaths("mount") end if mountpaths and #mountpaths > 0 then statistics.starttiming(resolvers.instance) @@ -10894,7 +13018,7 @@ function resolvers.automount(usecache) -- skip elseif find(line,"^zip://") then if trace_locating then - logs.report("fileio","mounting %s",line) + report_mounts("mounting %s",line) end table.insert(resolvers.automounted,line) resolvers.usezipfile(line) @@ -10910,40 +13034,40 @@ end -- status info -statistics.register("used config path", function() return caches.configpath() end) -statistics.register("used cache path", function() return caches.temp() or "?" end) +statistics.register("used config file", function() return caches.configfiles() end) +statistics.register("used cache path", function() return caches.usedpaths() end) -- experiment (code will move) -function statistics.save_fmt_status(texname,formatbanner,sourcefile) -- texname == formatname +function statistics.savefmtstatus(texname,formatbanner,sourcefile) -- texname == formatname local enginebanner = status.list().banner if formatbanner and enginebanner and sourcefile then local luvname = file.replacesuffix(texname,"luv") local luvdata = { enginebanner = enginebanner, formatbanner = formatbanner, - sourcehash = md5.hex(io.loaddata(resolvers.find_file(sourcefile)) or "unknown"), + sourcehash = md5.hex(io.loaddata(resolvers.findfile(sourcefile)) or "unknown"), sourcefile = sourcefile, } io.savedata(luvname,table.serialize(luvdata,true)) end end -function statistics.check_fmt_status(texname) +function statistics.checkfmtstatus(texname) local enginebanner = status.list().banner if enginebanner and texname then local luvname = file.replacesuffix(texname,"luv") if lfs.isfile(luvname) then local luv = dofile(luvname) if luv and luv.sourcefile then - local sourcehash = md5.hex(io.loaddata(resolvers.find_file(luv.sourcefile)) or "unknown") + local sourcehash = md5.hex(io.loaddata(resolvers.findfile(luv.sourcefile)) or "unknown") local luvbanner = luv.enginebanner or "?" if luvbanner ~= enginebanner then - return string.format("engine mismatch (luv:%s <> bin:%s)",luvbanner,enginebanner) + return format("engine mismatch (luv: %s <> bin: %s)",luvbanner,enginebanner) end local luvhash = luv.sourcehash or "?" if luvhash ~= sourcehash then - return string.format("source mismatch (luv:%s <> bin:%s)",luvhash,sourcehash) + return format("source mismatch (luv: %s <> bin: %s)",luvhash,sourcehash) end else return "invalid status file" @@ -10968,25 +13092,30 @@ if not modules then modules = { } end modules ['data-zip'] = { license = "see context related readme files" } +-- partly redone .. needs testing + local format, find, match = string.format, string.find, string.match -local unpack = unpack or table.unpack local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local report_zip = logs.reporter("resolvers","zip") + -- zip:///oeps.zip?name=bla/bla.tex -- zip:///oeps.zip?tree=tex/texmf-local -- zip:///texmf.zip?tree=/tex/texmf -- zip:///texmf.zip?tree=/tex/texmf-local -- zip:///texmf-mine.zip?tree=/tex/texmf-projects -zip = zip or { } -zip.archives = zip.archives or { } -zip.registeredfiles = zip.registeredfiles or { } +local resolvers = resolvers -local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders -local locators, hashers, concatinators = resolvers.locators, resolvers.hashers, resolvers.concatinators +zip = zip or { } +local zip = zip -local archives = zip.archives +zip.archives = zip.archives or { } +local archives = zip.archives + +zip.registeredfiles = zip.registeredfiles or { } +local registeredfiles = zip.registeredfiles local function validzip(str) -- todo: use url splitter if not find(str,"^zip://") then @@ -11002,7 +13131,7 @@ function zip.openarchive(name) else local arch = archives[name] if not arch then - local full = resolvers.find_file(name) or "" + local full = resolvers.findfile(name) or "" arch = (full ~= "" and zip.open(full)) or false archives[name] = arch end @@ -11017,163 +13146,162 @@ function zip.closearchive(name) end end -function locators.zip(specification) -- where is this used? startup zips (untested) - specification = resolvers.splitmethod(specification) - local zipfile = specification.path - local zfile = zip.openarchive(name) -- tricky, could be in to be initialized tree +function resolvers.locators.zip(specification) + local archive = specification.filename + local zipfile = archive and archive ~= "" and zip.openarchive(archive) -- tricky, could be in to be initialized tree if trace_locating then - if zfile then - logs.report("fileio","zip locator, archive '%s' found",specification.original) + if zipfile then + report_zip("locator, archive '%s' found",archive) else - logs.report("fileio","zip locator, archive '%s' not found",specification.original) + report_zip("locator, archive '%s' not found",archive) end end end -function hashers.zip(tag,name) +function resolvers.hashers.zip(specification) + local archive = specification.filename if trace_locating then - logs.report("fileio","loading zip file '%s' as '%s'",name,tag) + report_zip("loading file '%s'",archive) end - resolvers.usezipfile(format("%s?tree=%s",tag,name)) + resolvers.usezipfile(specification.original) end -function concatinators.zip(tag,path,name) +function resolvers.concatinators.zip(zipfile,path,name) -- ok ? if not path or path == "" then - return format('%s?name=%s',tag,name) + return format('%s?name=%s',zipfile,name) else - return format('%s?name=%s/%s',tag,path,name) + return format('%s?name=%s/%s',zipfile,path,name) end end -function resolvers.isreadable.zip(name) - return true -end - -function finders.zip(specification,filetype) - specification = resolvers.splitmethod(specification) - if specification.path then - local q = url.query(specification.query) - if q.name then - local zfile = zip.openarchive(specification.path) +function resolvers.finders.zip(specification) + local original = specification.original + local archive = specification.filename + if archive then + local query = url.query(specification.query) + local queryname = query.name + if queryname then + local zfile = zip.openarchive(archive) if zfile then if trace_locating then - logs.report("fileio","zip finder, archive '%s' found",specification.path) + report_zip("finder, archive '%s' found",archive) end - local dfile = zfile:open(q.name) + local dfile = zfile:open(queryname) if dfile then dfile = zfile:close() if trace_locating then - logs.report("fileio","zip finder, file '%s' found",q.name) + report_zip("finder, file '%s' found",queryname) end return specification.original elseif trace_locating then - logs.report("fileio","zip finder, file '%s' not found",q.name) + report_zip("finder, file '%s' not found",queryname) end elseif trace_locating then - logs.report("fileio","zip finder, unknown archive '%s'",specification.path) + report_zip("finder, unknown archive '%s'",archive) end end end if trace_locating then - logs.report("fileio","zip finder, '%s' not found",filename) + report_zip("finder, '%s' not found",original) end - return unpack(finders.notfound) + return resolvers.finders.notfound() end -function openers.zip(specification) - local zipspecification = resolvers.splitmethod(specification) - if zipspecification.path then - local q = url.query(zipspecification.query) - if q.name then - local zfile = zip.openarchive(zipspecification.path) +function resolvers.openers.zip(specification) + local original = specification.original + local archive = specification.filename + if archive then + local query = url.query(specification.query) + local queryname = query.name + if queryname then + local zfile = zip.openarchive(archive) if zfile then if trace_locating then - logs.report("fileio","zip opener, archive '%s' opened",zipspecification.path) + report_zip("opener, archive '%s' opened",archive) end - local dfile = zfile:open(q.name) + local dfile = zfile:open(queryname) if dfile then - logs.show_open(specification) if trace_locating then - logs.report("fileio","zip opener, file '%s' found",q.name) + report_zip("opener, file '%s' found",queryname) end - return openers.text_opener(specification,dfile,'zip') + return resolvers.openers.helpers.textopener('zip',original,dfile) elseif trace_locating then - logs.report("fileio","zip opener, file '%s' not found",q.name) + report_zip("opener, file '%s' not found",queryname) end elseif trace_locating then - logs.report("fileio","zip opener, unknown archive '%s'",zipspecification.path) + report_zip("opener, unknown archive '%s'",archive) end end end if trace_locating then - logs.report("fileio","zip opener, '%s' not found",filename) + report_zip("opener, '%s' not found",original) end - return unpack(openers.notfound) + return resolvers.openers.notfound() end -function loaders.zip(specification) - specification = resolvers.splitmethod(specification) - if specification.path then - local q = url.query(specification.query) - if q.name then - local zfile = zip.openarchive(specification.path) +function resolvers.loaders.zip(specification) + local original = specification.original + local archive = specification.filename + if archive then + local query = url.query(specification.query) + local queryname = query.name + if queryname then + local zfile = zip.openarchive(archive) if zfile then if trace_locating then - logs.report("fileio","zip loader, archive '%s' opened",specification.path) + report_zip("loader, archive '%s' opened",archive) end - local dfile = zfile:open(q.name) + local dfile = zfile:open(queryname) if dfile then - logs.show_load(filename) + logs.show_load(original) if trace_locating then - logs.report("fileio","zip loader, file '%s' loaded",filename) + report_zip("loader, file '%s' loaded",original) end local s = dfile:read("*all") dfile:close() return true, s, #s elseif trace_locating then - logs.report("fileio","zip loader, file '%s' not found",q.name) + report_zip("loader, file '%s' not found",queryname) end elseif trace_locating then - logs.report("fileio","zip loader, unknown archive '%s'",specification.path) + report_zip("loader, unknown archive '%s'",archive) end end end if trace_locating then - logs.report("fileio","zip loader, '%s' not found",filename) + report_zip("loader, '%s' not found",original) end - return unpack(openers.notfound) + return resolvers.openers.notfound() end -- zip:///somefile.zip -- zip:///somefile.zip?tree=texmf-local -> mount -function resolvers.usezipfile(zipname) - zipname = validzip(zipname) - local specification = resolvers.splitmethod(zipname) - local zipfile = specification.path - if zipfile and not zip.registeredfiles[zipname] then - local tree = url.query(specification.query).tree or "" - local z = zip.openarchive(zipfile) +function resolvers.usezipfile(archive) + local specification = resolvers.splitmethod(archive) -- to be sure + local archive = specification.filename + if archive and not registeredfiles[archive] then + local z = zip.openarchive(archive) if z then - local instance = resolvers.instance + local tree = url.query(specification.query).tree or "" if trace_locating then - logs.report("fileio","zip registering, registering archive '%s'",zipname) - end - statistics.starttiming(instance) - resolvers.prepend_hash('zip',zipname,zipfile) - resolvers.extend_texmf_var(zipname) -- resets hashes too - zip.registeredfiles[zipname] = z - instance.files[zipname] = resolvers.register_zip_file(z,tree or "") - statistics.stoptiming(instance) + report_zip("registering, registering archive '%s'",archive) + end + statistics.starttiming(resolvers.instance) + resolvers.prependhash('zip',archive) + resolvers.extendtexmfvariable(archive) -- resets hashes too + registeredfiles[archive] = z + instance.files[archive] = resolvers.registerzipfile(z,tree) + statistics.stoptiming(resolvers.instance) elseif trace_locating then - logs.report("fileio","zip registering, unknown archive '%s'",zipname) + report_zip("registering, unknown archive '%s'",archive) end elseif trace_locating then - logs.report("fileio","zip registering, '%s' not found",zipname) + report_zip("registering, '%s' not found",archive) end end -function resolvers.register_zip_file(z,tree) +function resolvers.registerzipfile(z,tree) local files, filter = { }, "" if tree == "" then filter = "^(.+)/(.-)$" @@ -11181,9 +13309,9 @@ function resolvers.register_zip_file(z,tree) filter = format("^%s/(.+)/(.-)$",tree) end if trace_locating then - logs.report("fileio","zip registering, using filter '%s'",filter) + report_zip("registering, using filter '%s'",filter) end - local register, n = resolvers.register_file, 0 + local register, n = resolvers.registerfile, 0 for i in z:files() do local path, name = match(i.filename,filter) if path then @@ -11198,11 +13326,89 @@ function resolvers.register_zip_file(z,tree) n = n + 1 end end - logs.report("fileio","zip registering, %s files registered",n) + report_zip("registering, %s files registered",n) return files end +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-tre'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- \input tree://oeps1/**/oeps.tex + +local find, gsub, format = string.find, string.gsub, string.format + +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) + +local report_trees = logs.reporter("resolvers","trees") + +local resolvers = resolvers + +local done, found, notfound = { }, { }, resolvers.finders.notfound + +function resolvers.finders.tree(specification) + local spec = specification.filename + local fnd = found[spec] + if fnd == nil then + if spec ~= "" then + local path, name = file.dirname(spec), file.basename(spec) + if path == "" then path = "." end + local hash = done[path] + if not hash then + local pattern = path .. "/*" -- we will use the proper splitter + hash = dir.glob(pattern) + done[path] = hash + end + local pattern = "/" .. gsub(name,"([%.%-%+])", "%%%1") .. "$" + for k=1,#hash do + local v = hash[k] + if find(v,pattern) then + found[spec] = v + return v + end + end + end + fnd = notfound() -- false + found[spec] = fnd + end + return fnd +end + +function resolvers.locators.tree(specification) + local name = specification.filename + if name ~= '' and lfs.isdir(name) then + if trace_locating then + report_trees("locator '%s' found",name) + end + resolvers.appendhash('tree',name,false) -- don't cache + elseif trace_locating then + report_trees("locator '%s' not found",name) + end +end + +function resolvers.hashers.tree(specification) + local name = specification.filename + if trace_locating then + report_trees("analysing '%s'",name) + end + resolvers.methodhandler("hashers",name) +end + +resolvers.concatinators.tree = resolvers.concatinators.file +resolvers.generators.tree = resolvers.generators.file +resolvers.openers.tree = resolvers.openers.file +resolvers.loaders.tree = resolvers.loaders.file + + end -- of closure do -- create closure to overcome 200 locals limit @@ -11215,58 +13421,59 @@ if not modules then modules = { } end modules ['data-crl'] = { license = "see context related readme files" } -local gsub = string.gsub +-- this one is replaced by data-sch.lua -- -curl = curl or { } +local gsub = string.gsub -curl.cached = { } -curl.cachepath = caches.definepath("curl") +local resolvers = resolvers local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders -function curl.fetch(protocol, name) - local cachename = curl.cachepath() .. "/" .. gsub(name,"[^%a%d%.]+","-") --- cachename = gsub(cachename,"[\\/]", io.fileseparator) - cachename = gsub(cachename,"[\\]", "/") -- cleanup - if not curl.cached[name] then +resolvers.curl = resolvers.curl or { } +local curl = resolvers.curl + +local cached = { } + +local function runcurl(specification) + local original = specification.original + -- local scheme = specification.scheme + local cleanname = gsub(original,"[^%a%d%.]+","-") + local cachename = caches.setfirstwritablefile(cleanname,"curl") + if not cached[original] then if not io.exists(cachename) then - curl.cached[name] = cachename - local command = "curl --silent --create-dirs --output " .. cachename .. " " .. name -- no protocol .. "://" + cached[original] = cachename + local command = "curl --silent --create-dirs --output " .. cachename .. " " .. original os.spawn(command) end if io.exists(cachename) then - curl.cached[name] = cachename + cached[original] = cachename else - curl.cached[name] = "" + cached[original] = "" end end - return curl.cached[name] -end - -function finders.curl(protocol,filename) - local foundname = curl.fetch(protocol, filename) - return finders.generic(protocol,foundname,filetype) + return cached[original] end -function openers.curl(protocol,filename) - return openers.generic(protocol,filename) -end +-- old code: we could be cleaner using specification (see schemes) -function loaders.curl(protocol,filename) - return loaders.generic(protocol,filename) +local function finder(specification,filetype) + return resolvers.methodhandler("finders",runcurl(specification),filetype) end --- todo: metamethod +local opener = openers.file +local loader = loaders.file -function curl.install(protocol) - finders[protocol] = function (filename,filetype) return finders.curl(protocol,filename) end - openers[protocol] = function (filename) return openers.curl(protocol,filename) end - loaders[protocol] = function (filename) return loaders.curl(protocol,filename) end +local function install(scheme) + finders[scheme] = finder + openers[scheme] = opener + loaders[scheme] = loader end -curl.install('http') -curl.install('https') -curl.install('ftp') +resolvers.curl.install = install + +install('http') +install('https') +install('ftp') end -- of closure @@ -11287,9 +13494,13 @@ if not modules then modules = { } end modules ['data-lua'] = { local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local report_libraries = logs.reporter("resolvers","libraries") + local gsub, insert = string.gsub, table.insert local unpack = unpack or table.unpack +local resolvers, package = resolvers, package + local libformats = { 'luatexlibs', 'tex', 'texmfscripts', 'othertextfiles' } -- 'luainputs' local clibformats = { 'lib' } @@ -11298,7 +13509,7 @@ local _path_, libpaths, _cpath_, clibpaths function package.libpaths() if not _path_ or package.path ~= _path_ then _path_ = package.path - libpaths = file.split_path(_path_,";") + libpaths = file.splitpath(_path_,";") end return libpaths end @@ -11306,7 +13517,7 @@ end function package.clibpaths() if not _cpath_ or package.cpath ~= _cpath_ then _cpath_ = package.cpath - clibpaths = file.split_path(_cpath_,";") + clibpaths = file.splitpath(_cpath_,";") end return clibpaths end @@ -11315,18 +13526,18 @@ local function thepath(...) local t = { ... } t[#t+1] = "?.lua" local path = file.join(unpack(t)) if trace_locating then - logs.report("fileio","! appending '%s' to 'package.path'",path) + report_libraries("! appending '%s' to 'package.path'",path) end return path end local p_libpaths, a_libpaths = { }, { } -function package.append_libpath(...) +function package.appendtolibpath(...) insert(a_libpath,thepath(...)) end -function package.prepend_libpath(...) +function package.prependtolibpath(...) insert(p_libpaths,1,thepath(...)) end @@ -11337,31 +13548,30 @@ local function loaded(libpaths,name,simple) local libpath = libpaths[i] local resolved = gsub(libpath,"%?",simple) if trace_locating then -- more detail - logs.report("fileio","! checking for '%s' on 'package.path': '%s' => '%s'",simple,libpath,resolved) + report_libraries("! checking for '%s' on 'package.path': '%s' => '%s'",simple,libpath,resolved) end - if resolvers.isreadable.file(resolved) then + if file.is_readable(resolved) then if trace_locating then - logs.report("fileio","! lib '%s' located via 'package.path': '%s'",name,resolved) + report_libraries("! lib '%s' located via 'package.path': '%s'",name,resolved) end return loadfile(resolved) end end end - package.loaders[2] = function(name) -- was [#package.loaders+1] if trace_locating then -- mode detail - logs.report("fileio","! locating '%s'",name) + report_libraries("! locating '%s'",name) end for i=1,#libformats do local format = libformats[i] - local resolved = resolvers.find_file(name,format) or "" + local resolved = resolvers.findfile(name,format) or "" if trace_locating then -- mode detail - logs.report("fileio","! checking for '%s' using 'libformat path': '%s'",name,format) + report_libraries("! checking for '%s' using 'libformat path': '%s'",name,format) end if resolved ~= "" then if trace_locating then - logs.report("fileio","! lib '%s' located via environment: '%s'",name,resolved) + report_libraries("! lib '%s' located via environment: '%s'",name,resolved) end return loadfile(resolved) end @@ -11379,16 +13589,16 @@ package.loaders[2] = function(name) -- was [#package.loaders+1] for i=1,#clibformats do -- better have a dedicated loop local format = clibformats[i] - local paths = resolvers.expanded_path_list_from_var(format) + local paths = resolvers.expandedpathlistfromvariable(format) for p=1,#paths do local path = paths[p] local resolved = file.join(path,libname) if trace_locating then -- mode detail - logs.report("fileio","! checking for '%s' using 'clibformat path': '%s'",libname,path) + report_libraries("! checking for '%s' using 'clibformat path': '%s'",libname,path) end - if resolvers.isreadable.file(resolved) then + if file.is_readable(resolved) then if trace_locating then - logs.report("fileio","! lib '%s' located via 'clibformat': '%s'",libname,resolved) + report_libraries("! lib '%s' located via 'clibformat': '%s'",libname,resolved) end return package.loadlib(resolved,name) end @@ -11398,140 +13608,43 @@ package.loaders[2] = function(name) -- was [#package.loaders+1] local libpath = clibpaths[i] local resolved = gsub(libpath,"?",simple) if trace_locating then -- more detail - logs.report("fileio","! checking for '%s' on 'package.cpath': '%s'",simple,libpath) + report_libraries("! checking for '%s' on 'package.cpath': '%s'",simple,libpath) end - if resolvers.isreadable.file(resolved) then + if file.is_readable(resolved) then if trace_locating then - logs.report("fileio","! lib '%s' located via 'package.cpath': '%s'",name,resolved) + report_libraries("! lib '%s' located via 'package.cpath': '%s'",name,resolved) end return package.loadlib(resolved,name) end end -- just in case the distribution is messed up if trace_loading then -- more detail - logs.report("fileio","! checking for '%s' using 'luatexlibs': '%s'",name) + report_libraries("! checking for '%s' using 'luatexlibs': '%s'",name) end - local resolved = resolvers.find_file(file.basename(name),'luatexlibs') or "" + local resolved = resolvers.findfile(file.basename(name),'luatexlibs') or "" if resolved ~= "" then if trace_locating then - logs.report("fileio","! lib '%s' located by basename via environment: '%s'",name,resolved) + report_libraries("! lib '%s' located by basename via environment: '%s'",name,resolved) end return loadfile(resolved) end if trace_locating then - logs.report("fileio",'? unable to locate lib: %s',name) + report_libraries('? unable to locate lib: %s',name) end -- return "unable to locate " .. name end resolvers.loadlualib = require +-- -- -- -- -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['luat-kps'] = { - version = 1.001, - comment = "companion to luatools.lua", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - ---[[ldx-- -

This file is used when we want the input handlers to behave like -kpsewhich. What to do with the following:

- - -{$SELFAUTOLOC,$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c} -$SELFAUTOLOC : /usr/tex/bin/platform -$SELFAUTODIR : /usr/tex/bin -$SELFAUTOPARENT : /usr/tex - - -

How about just forgetting about them?

---ldx]]-- - -local suffixes = resolvers.suffixes -local formats = resolvers.formats - -suffixes['gf'] = { 'gf' } -suffixes['pk'] = { 'pk' } -suffixes['base'] = { 'base' } -suffixes['bib'] = { 'bib' } -suffixes['bst'] = { 'bst' } -suffixes['cnf'] = { 'cnf' } -suffixes['mem'] = { 'mem' } -suffixes['mf'] = { 'mf' } -suffixes['mfpool'] = { 'pool' } -suffixes['mft'] = { 'mft' } -suffixes['mppool'] = { 'pool' } -suffixes['graphic/figure'] = { 'eps', 'epsi' } -suffixes['texpool'] = { 'pool' } -suffixes['PostScript header'] = { 'pro' } -suffixes['ist'] = { 'ist' } -suffixes['web'] = { 'web', 'ch' } -suffixes['cweb'] = { 'w', 'web', 'ch' } -suffixes['cmap files'] = { 'cmap' } -suffixes['lig files'] = { 'lig' } -suffixes['bitmap font'] = { } -suffixes['MetaPost support'] = { } -suffixes['TeX system documentation'] = { } -suffixes['TeX system sources'] = { } -suffixes['dvips config'] = { } -suffixes['type42 fonts'] = { } -suffixes['web2c files'] = { } -suffixes['other text files'] = { } -suffixes['other binary files'] = { } -suffixes['opentype fonts'] = { 'otf' } - -suffixes['fmt'] = { 'fmt' } -suffixes['texmfscripts'] = { 'rb','lua','py','pl' } - -suffixes['pdftex config'] = { } -suffixes['Troff fonts'] = { } - -suffixes['ls-R'] = { } +package.obsolete = package.obsolete or { } ---[[ldx-- -

If you wondered abou tsome of the previous mappings, how about -the next bunch:

---ldx]]-- +package.append_libpath = appendtolibpath -- will become obsolete +package.prepend_libpath = prependtolibpath -- will become obsolete -formats['bib'] = '' -formats['bst'] = '' -formats['mft'] = '' -formats['ist'] = '' -formats['web'] = '' -formats['cweb'] = '' -formats['MetaPost support'] = '' -formats['TeX system documentation'] = '' -formats['TeX system sources'] = '' -formats['Troff fonts'] = '' -formats['dvips config'] = '' -formats['graphic/figure'] = '' -formats['ls-R'] = '' -formats['other text files'] = '' -formats['other binary files'] = '' - -formats['gf'] = '' -formats['pk'] = '' -formats['base'] = 'MFBASES' -formats['cnf'] = '' -formats['mem'] = 'MPMEMS' -formats['mf'] = 'MFINPUTS' -formats['mfpool'] = 'MFPOOL' -formats['mppool'] = 'MPPOOL' -formats['texpool'] = 'TEXPOOL' -formats['PostScript header'] = 'TEXPSHEADERS' -formats['cmap files'] = 'CMAPFONTS' -formats['type42 fonts'] = 'T42FONTS' -formats['web2c files'] = 'WEB2C' -formats['pdftex config'] = 'PDFTEXCONFIG' -formats['texmfscripts'] = 'TEXMFSCRIPTS' -formats['bitmap font'] = '' -formats['lig files'] = 'LIGFONTS' +package.obsolete.append_libpath = appendtolibpath -- will become obsolete +package.obsolete.prepend_libpath = prependtolibpath -- will become obsolete end -- of closure @@ -11547,49 +13660,54 @@ if not modules then modules = { } end modules ['data-aux'] = { } local find = string.find +local type, next = type, next local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) -function resolvers.update_script(oldname,newname) -- oldname -> own.name, not per se a suffix +local resolvers = resolvers + +local report_scripts = logs.reporter("resolvers","scripts") + +function resolvers.updatescript(oldname,newname) -- oldname -> own.name, not per se a suffix local scriptpath = "scripts/context/lua" newname = file.addsuffix(newname,"lua") - local oldscript = resolvers.clean_path(oldname) + local oldscript = resolvers.cleanpath(oldname) if trace_locating then - logs.report("fileio","to be replaced old script %s", oldscript) + report_scripts("to be replaced old script %s", oldscript) end - local newscripts = resolvers.find_files(newname) or { } + local newscripts = resolvers.findfiles(newname) or { } if #newscripts == 0 then if trace_locating then - logs.report("fileio","unable to locate new script") + report_scripts("unable to locate new script") end else for i=1,#newscripts do - local newscript = resolvers.clean_path(newscripts[i]) + local newscript = resolvers.cleanpath(newscripts[i]) if trace_locating then - logs.report("fileio","checking new script %s", newscript) + report_scripts("checking new script %s", newscript) end if oldscript == newscript then if trace_locating then - logs.report("fileio","old and new script are the same") + report_scripts("old and new script are the same") end elseif not find(newscript,scriptpath) then if trace_locating then - logs.report("fileio","new script should come from %s",scriptpath) + report_scripts("new script should come from %s",scriptpath) end elseif not (find(oldscript,file.removesuffix(newname).."$") or find(oldscript,newname.."$")) then if trace_locating then - logs.report("fileio","invalid new script name") + report_scripts("invalid new script name") end else local newdata = io.loaddata(newscript) if newdata then if trace_locating then - logs.report("fileio","old script content replaced by new content") + report_scripts("old script content replaced by new content") end io.savedata(oldscript,newdata) break elseif trace_locating then - logs.report("fileio","unable to load new script") + report_scripts("unable to load new script") end end end @@ -11609,72 +13727,133 @@ if not modules then modules = { } end modules ['data-tmf'] = { license = "see context related readme files" } -local find, gsub, match = string.find, string.gsub, string.match -local getenv, setenv = os.getenv, os.setenv +local resolvers = resolvers --- loads *.tmf files in minimal tree roots (to be optimized and documented) +local report_tds = logs.reporter("resolvers","tds") -function resolvers.check_environment(tree) - logs.simpleline() - setenv('TMP', getenv('TMP') or getenv('TEMP') or getenv('TMPDIR') or getenv('HOME')) - setenv('TEXOS', getenv('TEXOS') or ("texmf-" .. os.platform)) - setenv('TEXPATH', gsub(tree or "tex","\/+$",'')) - setenv('TEXMFOS', getenv('TEXPATH') .. "/" .. getenv('TEXOS')) - logs.simpleline() - logs.simple("preset : TEXPATH => %s", getenv('TEXPATH')) - logs.simple("preset : TEXOS => %s", getenv('TEXOS')) - logs.simple("preset : TEXMFOS => %s", getenv('TEXMFOS')) - logs.simple("preset : TMP => %s", getenv('TMP')) - logs.simple('') -end +-- = << +-- ? ?? +-- < += +-- > =+ -function resolvers.load_environment(name) -- todo: key=value as well as lua - local f = io.open(name) - if f then - for line in f:lines() do - if find(line,"^[%%%#]") then - -- skip comment - else - local key, how, value = match(line,"^(.-)%s*([<=>%?]+)%s*(.*)%s*$") - if how then - value = gsub(value,"%%(.-)%%", function(v) return getenv(v) or "" end) - if how == "=" or how == "<<" then - setenv(key,value) - elseif how == "?" or how == "??" then - setenv(key,getenv(key) or value) - elseif how == "<" or how == "+=" then - if getenv(key) then - setenv(key,getenv(key) .. io.fileseparator .. value) - else - setenv(key,value) - end - elseif how == ">" or how == "=+" then - if getenv(key) then - setenv(key,value .. io.pathseparator .. getenv(key)) - else - setenv(key,value) - end - end - end - end +function resolvers.load_tree(tree,resolve) + if type(tree) == "string" and tree ~= "" then + + local getenv, setenv = resolvers.getenv, resolvers.setenv + + -- later might listen to the raw osenv var as well + local texos = "texmf-" .. os.platform + + local oldroot = environment.texroot + local newroot = file.collapsepath(tree) + + local newtree = file.join(newroot,texos) + local newpath = file.join(newtree,"bin") + + if not lfs.isdir(newtree) then + report_tds("no '%s' under tree %s",texos,tree) + os.exit() end - f:close() + if not lfs.isdir(newpath) then + report_tds("no '%s/bin' under tree %s",texos,tree) + os.exit() + end + + local texmfos = newtree + + environment.texroot = newroot + environment.texos = texos + environment.texmfos = texmfos + + -- Beware, we need to obey the relocatable autoparent so we + -- set TEXMFCNF to its raw value. This is somewhat tricky when + -- we run a mkii job from within. Therefore, in mtxrun, there + -- is a resolve applied when we're in mkii/kpse mode. + + setenv('SELFAUTOPARENT', newroot) + setenv('SELFAUTODIR', newtree) + setenv('SELFAUTOLOC', newpath) + setenv('TEXROOT', newroot) + setenv('TEXOS', texos) + setenv('TEXMFOS', texmfos) + setenv('TEXMFCNF', resolvers.luacnfspec, not resolve) + setenv("PATH", newpath .. io.pathseparator .. getenv("PATH")) + + report_tds("changing from root '%s' to '%s'",oldroot,newroot) + report_tds("prepending '%s' to binary path",newpath) + report_tds() end end -function resolvers.load_tree(tree) - if tree and tree ~= "" then - local setuptex = 'setuptex.tmf' - if lfs.attributes(tree, "mode") == "directory" then -- check if not nil - setuptex = tree .. "/" .. setuptex - else - setuptex = tree + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-lst'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- used in mtxrun, can be loaded later .. todo + +local find, concat, upper, format = string.find, table.concat, string.upper, string.format + +resolvers.listers = resolvers.listers or { } + +local resolvers = resolvers + +local report_lists = logs.reporter("resolvers","lists") + +local function tabstr(str) + if type(str) == 'table' then + return concat(str," | ") + else + return str + end +end + +function resolvers.listers.variables(pattern) + local instance = resolvers.instance + local environment = instance.environment + local variables = instance.variables + local expansions = instance.expansions + local pattern = upper(pattern or "") + local configured = { } + local order = instance.order + for i=1,#order do + for k, v in next, order[i] do + if v ~= nil and configured[k] == nil then + configured[k] = v + end end - if io.exists(setuptex) then - resolvers.check_environment(tree) - resolvers.load_environment(setuptex) + end + local env = table.fastcopy(environment) + local var = table.fastcopy(variables) + local exp = table.fastcopy(expansions) + for key, value in table.sortedpairs(configured) do + if key ~= "" and (pattern == "" or find(upper(key),pattern)) then + report_lists(key) + report_lists(" env: %s",tabstr(rawget(environment,key)) or "unset") + report_lists(" var: %s",tabstr(configured[key]) or "unset") + report_lists(" exp: %s",tabstr(expansions[key]) or "unset") + report_lists(" res: %s",resolvers.resolve(expansions[key]) or "unset") end end + instance.environment = table.fastcopy(env) + instance.variables = table.fastcopy(var) + instance.expansions = table.fastcopy(exp) +end + +function resolvers.listers.configurations(report) + local configurations = resolvers.instance.specification + local report = report or texio.write_nl + for i=1,#configurations do + report(resolvers.resolve(configurations[i])) + end end @@ -11691,12 +13870,18 @@ if not modules then modules = { } end modules ['luat-sta'] = { -- this code is used in the updater -local gmatch, match = string.gmatch, string.match -local type = type +local gmatch, match = string.gmatch, string.match +local type = type + +states = states or { } +local states = states + +states.data = states.data or { } +local data = states.data + +states.hash = states.hash or { } +local hash = states.hash -states = states or { } -states.data = states.data or { } -states.hash = states.hash or { } states.tag = states.tag or "" states.filename = states.filename or "" @@ -11706,7 +13891,7 @@ function states.save(filename,tag) io.savedata(filename, "-- generator : luat-sta.lua\n" .. "-- state tag : " .. tag .. "\n\n" .. - table.serialize(states.data[tag or states.tag] or {},true) + table.serialize(data[tag or states.tag] or {},true) ) end @@ -11714,11 +13899,11 @@ function states.load(filename,tag) states.filename = filename states.tag = tag or "whatever" states.filename = file.addsuffix(states.filename,'lus') - states.data[states.tag], states.hash[states.tag] = (io.exists(filename) and dofile(filename)) or { }, { } + data[states.tag], hash[states.tag] = (io.exists(filename) and dofile(filename)) or { }, { } end -function states.set_by_tag(tag,key,value,default,persistent) - local d, h = states.data[tag], states.hash[tag] +local function set_by_tag(tag,key,value,default,persistent) + local d, h = data[tag], hash[tag] if d then if type(d) == "table" then local dkey, hkey = key, key @@ -11738,8 +13923,10 @@ function states.set_by_tag(tag,key,value,default,persistent) end dkey, hkey = post, key end - if type(value) == nil then - value = value or default + if value == nil then + value = default + elseif value == false then + -- special case elseif persistent then value = value or d[dkey] or default else @@ -11748,144 +13935,202 @@ function states.set_by_tag(tag,key,value,default,persistent) d[dkey], h[hkey] = value, value elseif type(d) == "string" then -- weird - states.data[tag], states.hash[tag] = value, value + data[tag], hash[tag] = value, value end end end -function states.get_by_tag(tag,key,default) - local h = states.hash[tag] +local function get_by_tag(tag,key,default) + local h = hash[tag] if h and h[key] then return h[key] else - local d = states.data[tag] + local d = data[tag] if d then for k in gmatch(key,"[^%.]+") do local dk = d[k] - if dk then + if dk ~= nil then d = dk else return default end end - return d or default + if d == false then + return false + else + return d or default + end end end end +states.set_by_tag = set_by_tag +states.get_by_tag = get_by_tag + function states.set(key,value,default,persistent) - states.set_by_tag(states.tag,key,value,default,persistent) + set_by_tag(states.tag,key,value,default,persistent) end function states.get(key,default) - return states.get_by_tag(states.tag,key,default) -end - ---~ states.data.update = { ---~ ["version"] = { ---~ ["major"] = 0, ---~ ["minor"] = 1, ---~ }, ---~ ["rsync"] = { ---~ ["server"] = "contextgarden.net", ---~ ["module"] = "minimals", ---~ ["repository"] = "current", ---~ ["flags"] = "-rpztlv --stats", ---~ }, ---~ ["tasks"] = { ---~ ["update"] = true, ---~ ["make"] = true, ---~ ["delete"] = false, ---~ }, ---~ ["platform"] = { ---~ ["host"] = true, ---~ ["other"] = { ---~ ["mswin"] = false, ---~ ["linux"] = false, ---~ ["linux-64"] = false, ---~ ["osx-intel"] = false, ---~ ["osx-ppc"] = false, ---~ ["sun"] = false, ---~ }, ---~ }, ---~ ["context"] = { ---~ ["available"] = {"current", "beta", "alpha", "experimental"}, ---~ ["selected"] = "current", ---~ }, ---~ ["formats"] = { ---~ ["cont-en"] = true, ---~ ["cont-nl"] = true, ---~ ["cont-de"] = false, ---~ ["cont-cz"] = false, ---~ ["cont-fr"] = false, ---~ ["cont-ro"] = false, ---~ }, ---~ ["engine"] = { ---~ ["pdftex"] = { ---~ ["install"] = true, ---~ ["formats"] = { ---~ ["pdftex"] = true, ---~ }, ---~ }, ---~ ["luatex"] = { ---~ ["install"] = true, ---~ ["formats"] = { ---~ }, ---~ }, ---~ ["xetex"] = { ---~ ["install"] = true, ---~ ["formats"] = { ---~ ["xetex"] = false, ---~ }, ---~ }, ---~ ["metapost"] = { ---~ ["install"] = true, ---~ ["formats"] = { ---~ ["mpost"] = true, ---~ ["metafun"] = true, ---~ }, ---~ }, ---~ }, ---~ ["fonts"] = { ---~ }, ---~ ["doc"] = { ---~ }, ---~ ["modules"] = { ---~ ["f-urwgaramond"] = false, ---~ ["f-urwgothic"] = false, ---~ ["t-bnf"] = false, ---~ ["t-chromato"] = false, ---~ ["t-cmscbf"] = false, ---~ ["t-cmttbf"] = false, ---~ ["t-construction-plan"] = false, ---~ ["t-degrade"] = false, ---~ ["t-french"] = false, ---~ ["t-lettrine"] = false, ---~ ["t-lilypond"] = false, ---~ ["t-mathsets"] = false, ---~ ["t-tikz"] = false, ---~ ["t-typearea"] = false, ---~ ["t-vim"] = false, ---~ }, ---~ } - ---~ states.save("teststate", "update") ---~ states.load("teststate", "update") - ---~ print(states.get_by_tag("update","rsync.server","unknown")) ---~ states.set_by_tag("update","rsync.server","oeps") ---~ print(states.get_by_tag("update","rsync.server","unknown")) ---~ states.save("teststate", "update") ---~ states.load("teststate", "update") ---~ print(states.get_by_tag("update","rsync.server","unknown")) + return get_by_tag(states.tag,key,default) +end + + + + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['luat-fmt'] = { + version = 1.001, + comment = "companion to mtxrun", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + + +local format = string.format + +local report_format = logs.reporter("resolvers","formats") + +-- helper for mtxrun + +local quoted = string.quoted + +local function primaryflags() -- not yet ok + local trackers = environment.argument("trackers") + local directives = environment.argument("directives") + local flags = "" + if trackers and trackers ~= "" then + flags = flags .. "--trackers=" .. quoted(trackers) + end + if directives and directives ~= "" then + flags = flags .. "--directives=" .. quoted(directives) + end + return flags +end + +function environment.make_format(name) + -- change to format path (early as we need expanded paths) + local olddir = lfs.currentdir() + local path = caches.getwritablepath("formats") or "" -- maybe platform + if path ~= "" then + lfs.chdir(path) + end + report_format("format path: %s",lfs.currentdir()) + -- check source file + local texsourcename = file.addsuffix(name,"mkiv") + local fulltexsourcename = resolvers.findfile(texsourcename,"tex") or "" + if fulltexsourcename == "" then + texsourcename = file.addsuffix(name,"tex") + fulltexsourcename = resolvers.findfile(texsourcename,"tex") or "" + end + if fulltexsourcename == "" then + report_format("no tex source file with name: %s (mkiv or tex)",name) + lfs.chdir(olddir) + return + else + report_format("using tex source file: %s",fulltexsourcename) + end + local texsourcepath = dir.expandname(file.dirname(fulltexsourcename)) -- really needed + -- check specification + local specificationname = file.replacesuffix(fulltexsourcename,"lus") + local fullspecificationname = resolvers.findfile(specificationname,"tex") or "" + if fullspecificationname == "" then + specificationname = file.join(texsourcepath,"context.lus") + fullspecificationname = resolvers.findfile(specificationname,"tex") or "" + end + if fullspecificationname == "" then + report_format("unknown stub specification: %s",specificationname) + lfs.chdir(olddir) + return + end + local specificationpath = file.dirname(fullspecificationname) + -- load specification + local usedluastub = nil + local usedlualibs = dofile(fullspecificationname) + if type(usedlualibs) == "string" then + usedluastub = file.join(file.dirname(fullspecificationname),usedlualibs) + elseif type(usedlualibs) == "table" then + report_format("using stub specification: %s",fullspecificationname) + local texbasename = file.basename(name) + local luastubname = file.addsuffix(texbasename,"lua") + local lucstubname = file.addsuffix(texbasename,"luc") + -- pack libraries in stub + report_format("creating initialization file: %s",luastubname) + utilities.merger.selfcreate(usedlualibs,specificationpath,luastubname) + -- compile stub file (does not save that much as we don't use this stub at startup any more) + local strip = resolvers.booleanvariable("LUACSTRIP", true) + if utilities.lua.compile(luastubname,lucstubname) and lfs.isfile(lucstubname) then + report_format("using compiled initialization file: %s",lucstubname) + usedluastub = lucstubname + else + report_format("using uncompiled initialization file: %s",luastubname) + usedluastub = luastubname + end + else + report_format("invalid stub specification: %s",fullspecificationname) + lfs.chdir(olddir) + return + end + -- generate format + local command = format("luatex --ini %s --lua=%s %s %sdump",primaryflags(),quoted(usedluastub),quoted(fulltexsourcename),os.platform == "unix" and "\\\\" or "\\") + report_format("running command: %s\n",command) + os.spawn(command) + -- remove related mem files + local pattern = file.removesuffix(file.basename(usedluastub)).."-*.mem" + -- report_format("removing related mplib format with pattern '%s'", pattern) + local mp = dir.glob(pattern) + if mp then + for i=1,#mp do + local name = mp[i] + report_format("removing related mplib format %s", file.basename(name)) + os.remove(name) + end + end + lfs.chdir(olddir) +end + +function environment.run_format(name,data,more) + -- hm, rather old code here; we can now use the file.whatever functions + if name and name ~= "" then + local barename = file.removesuffix(name) + local fmtname = caches.getfirstreadablefile(file.addsuffix(barename,"fmt"),"formats") + if fmtname == "" then + fmtname = resolvers.findfile(file.addsuffix(barename,"fmt")) or "" + end + fmtname = resolvers.cleanpath(fmtname) + if fmtname == "" then + report_format("no format with name: %s",name) + else + local barename = file.removesuffix(name) -- expanded name + local luaname = file.addsuffix(barename,"luc") + if not lfs.isfile(luaname) then + luaname = file.addsuffix(barename,"lua") + end + if not lfs.isfile(luaname) then + report_format("using format name: %s",fmtname) + report_format("no luc/lua with name: %s",barename) + else + local command = format("luatex %s --fmt=%s --lua=%s %s %s",primaryflags(),quoted(barename),quoted(luaname),quoted(data),more ~= "" and quoted(more) or "") + report_format("running command: %s",command) + os.spawn(command) + end + end + end +end end -- of closure -- end library merge -own = { } -- not local +own = { } -- not local, might change + +own.libs = { -- order can be made better -own.libs = { -- todo: check which ones are really needed 'l-string.lua', 'l-lpeg.lua', 'l-table.lua', @@ -11898,39 +14143,55 @@ own.libs = { -- todo: check which ones are really needed 'l-url.lua', 'l-dir.lua', 'l-boolean.lua', + 'l-unicode.lua', 'l-math.lua', --- 'l-unicode.lua', --- 'l-tex.lua', - 'l-utils.lua', - 'l-aux.lua', --- 'l-xml.lua', - 'trac-tra.lua', + + 'util-tab.lua', + 'util-sto.lua', + 'util-mrg.lua', + 'util-lua.lua', + 'util-prs.lua', + 'util-fmt.lua', + 'util-deb.lua', + + 'trac-inf.lua', + 'trac-set.lua', + 'trac-log.lua', + 'trac-pro.lua', + + 'luat-env.lua', -- can come before inf (as in mkiv) + 'lxml-tab.lua', 'lxml-lpt.lua', --- 'lxml-ent.lua', + -- 'lxml-ent.lua', 'lxml-mis.lua', 'lxml-aux.lua', 'lxml-xml.lua', - 'luat-env.lua', - 'trac-inf.lua', - 'trac-log.lua', - 'data-res.lua', + + 'data-ini.lua', + 'data-exp.lua', + 'data-env.lua', 'data-tmp.lua', + 'data-met.lua', + 'data-res.lua', 'data-pre.lua', 'data-inp.lua', 'data-out.lua', + 'data-fil.lua', 'data-con.lua', 'data-use.lua', -- 'data-tex.lua', -- 'data-bin.lua', 'data-zip.lua', + 'data-tre.lua', 'data-crl.lua', 'data-lua.lua', - 'data-kps.lua', -- so that we can replace kpsewhich 'data-aux.lua', -- updater - 'data-tmf.lua', -- tree files - -- needed ? - 'luat-sta.lua', -- states + 'data-tmf.lua', + 'data-lst.lua', + + 'luat-sta.lua', + 'luat-fmt.lua', } -- We need this hack till luatex is fixed. @@ -11943,35 +14204,62 @@ end -- End of hack. -own.name = (environment and environment.ownname) or arg[0] or 'luatools.lua' +local format, gsub, gmatch, match = string.format, string.gsub, string.gmatch, string.match +local concat = table.concat + +own.name = (environment and environment.ownname) or arg[0] or 'mtxrun.lua' +own.path = gsub(match(own.name,"^(.+)[\\/].-$") or ".","\\","/") + +local ownpath, owntree = own.path, environment and environment.ownpath or own.path + +own.list = { + '.', + ownpath , + ownpath .. "/../sources", -- HH's development path + owntree .. "/../../texmf-local/tex/context/base", + owntree .. "/../../texmf-context/tex/context/base", + owntree .. "/../../texmf-dist/tex/context/base", + owntree .. "/../../texmf/tex/context/base", + owntree .. "/../../../texmf-local/tex/context/base", + owntree .. "/../../../texmf-context/tex/context/base", + owntree .. "/../../../texmf-dist/tex/context/base", + owntree .. "/../../../texmf/tex/context/base", +} +if own.path == "." then table.remove(own.list,1) end -own.path = string.match(own.name,"^(.+)[\\/].-$") or "." -own.list = { '.' } -if own.path ~= '.' then - table.insert(own.list,own.path) +local function locate_libs() + for l=1,#own.libs do + local lib = own.libs[l] + for p =1,#own.list do + local pth = own.list[p] + local filename = pth .. "/" .. lib + local found = lfs.isfile(filename) + if found then + package.path = package.path .. ";" .. pth .. "/?.lua" -- in case l-* does a require + return pth + end + end + end end -table.insert(own.list,own.path.."/../../texmf-dist/tex/context/base") -table.insert(own.list,own.path.."/../../../tex/context/base") -table.insert(own.list,own.path.."/mtx") -table.insert(own.list,own.path.."/../sources") -local function locate_libs() - for _, lib in pairs(own.libs) do - for _, pth in pairs(own.list) do - local filename = string.gsub(pth .. "/" .. lib,"\\","/") +local function load_libs() + local found = locate_libs() + if found then + for l=1,#own.libs do + local filename = found .. "/" .. own.libs[l] local codeblob = loadfile(filename) if codeblob then codeblob() - own.list = { pth } -- speed up te search - break end end + else + resolvers = nil end end if not resolvers then - locate_libs() + load_libs() end if not resolvers then @@ -11983,20 +14271,56 @@ if not resolvers then os.exit() end -logs.setprogram('MTXrun',"TDS Runner Tool 1.24",environment.arguments["verbose"] or false) +-- verbosity -local instance = resolvers.reset() +local e_verbose = environment.arguments["verbose"] + +if e_verbose then + trackers.enable("resolvers.locating") +end + +-- some common flags (also passed through environment) + +local e_silent = environment.argument("silent") +local e_noconsole = environment.argument("noconsole") + +local e_trackers = environment.argument("trackers") +local e_directives = environment.argument("directives") +local e_experiments = environment.argument("experiments") + +if e_silent == true then + e_silent = "*" +end -local trackspec = environment.argument("trackers") or environment.argument("track") +if type(e_silent) == "string" then + if type(e_directives) == "string" then + e_directives = format("%s,logs.blocked={%s}",e_directives,e_silent) + else + e_directives = format("logs.blocked={%s}",e_silent) + end +end -if trackspec then - trackers.enable(trackspec) +if e_noconsole then + if type(e_directives) == "string" then + e_directives = format("%s,logs.target=file",e_directives) + else + e_directives = format("logs.target=file") + end end -runners = runners or { } -- global -messages = messages or { } +if e_trackers then trackers .enable(e_trackers) end +if e_directives then directives .enable(e_directives) end +if e_experiments then experiments.enable(e_experiments) end + +if not environment.trackers then environment.trackers = e_trackers end +if not environment.directives then environment.directives = e_directives end +if not environment.experiments then environment.experiments = e_experiments end + +-- + +local instance = resolvers.reset() -messages.help = [[ +local helpinfo = [[ --script run an mtx script (lua prefered method) (--noquotes), no script gives list --execute run a script or program (texmfstart method) (--noquotes) --resolve resolve prefixed arguments @@ -12011,15 +14335,14 @@ messages.help = [[ --ifchanged=filename only execute when given file has changed (md checksum) --iftouched=old,new only execute when given file has changed (time stamp) ---make create stubs for (context related) scripts ---remove remove stubs (context related) scripts +--makestubs create stubs for (context related) scripts +--removestubs remove stubs (context related) scripts --stubpath=binpath paths where stubs wil be written --windows create windows (mswin) stubs --unix create unix (linux) stubs --verbose give a bit more info --trackers=list enable given trackers ---engine=str target engine --progname=str format or backend --edit launch editor with found file @@ -12032,8 +14355,35 @@ messages.help = [[ --forcekpse force using kpse (handy when no mkiv and cache installed but less functionality) --prefixes show supported prefixes + +--generate generate file database + +--variables show configuration variables +--configurations show configuration order + +--expand-braces expand complex variable +--expand-path expand variable (resolve paths) +--expand-var expand variable (resolve references) +--show-path show path expansion of ... +--var-value report value of variable +--find-file report file location +--find-path report path of file + +--pattern=str filter variables ]] +local application = logs.application { + name = "mtxrun", + banner = "ConTeXt TDS Runner Tool 1.30", + helpinfo = helpinfo, +} + +local report = application.report + +messages = messages or { } -- for the moment + +runners = runners or { } -- global (might become local) + runners.applications = { ["lua"] = "luatex --luaonly", ["luc"] = "luatex --luaonly", @@ -12056,7 +14406,7 @@ runners.registered = { makempy = { 'makempy.pl', true }, mptopdf = { 'mptopdf.pl', true }, pstopdf = { 'pstopdf.rb', true }, -- converts ps (and some more) images, does some cleaning (replaced) --- examplex = { 'examplex.rb', false }, + -- examplex = { 'examplex.rb', false }, concheck = { 'concheck.rb', false }, runtools = { 'runtools.rb', true }, textools = { 'textools.rb', true }, @@ -12065,9 +14415,9 @@ runners.registered = { rlxtools = { 'rlxtools.rb', true }, pdftools = { 'pdftools.rb', true }, mpstools = { 'mpstools.rb', true }, --- exatools = { 'exatools.rb', true }, + -- exatools = { 'exatools.rb', true }, xmltools = { 'xmltools.rb', true }, --- luatools = { 'luatools.lua', true }, + -- luatools = { 'luatools.lua', true }, mtxtools = { 'mtxtools.rb', true }, pdftrimwhite = { 'pdftrimwhite.pl', false } } @@ -12086,45 +14436,39 @@ end function runners.prepare() local checkname = environment.argument("ifchanged") - if checkname and checkname ~= "" then + if type(checkname) == "string" and checkname ~= "" then local oldchecksum = file.loadchecksum(checkname) local newchecksum = file.checksum(checkname) if oldchecksum == newchecksum then - logs.simple("file '%s' is unchanged",checkname) + if e_verbose then + report("file '%s' is unchanged",checkname) + end return "skip" - else - logs.simple("file '%s' is changed, processing started",checkname) + elseif e_verbose then + report("file '%s' is changed, processing started",checkname) end file.savechecksum(checkname) end - local oldname, newname = string.split(environment.argument("iftouched") or "", ",") - if oldname and newname and oldname ~= "" and newname ~= "" then - if not file.needs_updating(oldname,newname) then - logs.simple("file '%s' and '%s' have same age",oldname,newname) - return "skip" - else - logs.simple("file '%s' is older than '%s'",oldname,newname) - end - end - local tree = environment.argument('tree') or "" - if environment.argument('autotree') then - tree = os.getenv('TEXMFSTART_TREE') or os.getenv('TEXMFSTARTTREE') or tree - end - if tree and tree ~= "" then - resolvers.load_tree(tree) - end - local env = environment.argument('environment') or "" - if env and env ~= "" then - for _,e in pairs(string.split(env)) do - -- maybe force suffix when not given - resolvers.load_tree(e) + local touchname = environment.argument("iftouched") + if type(touchname) == "string" and touchname ~= "" then + local oldname, newname = string.split(touchname, ",") + if oldname and newname and oldname ~= "" and newname ~= "" then + if not file.needs_updating(oldname,newname) then + if e_verbose then + report("file '%s' and '%s' have same age",oldname,newname) + end + return "skip" + elseif e_verbose then + report("file '%s' is older than '%s'",oldname,newname) + end end end local runpath = environment.argument("path") - if runpath and not lfs.chdir(runpath) then - logs.simple("unable to change to path '%s'",runpath) + if type(runpath) == "string" and not lfs.chdir(runpath) then + report("unable to change to path '%s'",runpath) return "error" end + runners.prepare = function() end return "run" end @@ -12137,8 +14481,6 @@ function runners.execute_script(fullname,internal,nosplit) elseif state == 'skip' then return true elseif state == "run" then - instance.progname = environment.argument("progname") or instance.progname - instance.format = environment.argument("format") or instance.format local path, name, suffix, result = file.dirname(fullname), file.basename(fullname), file.extname(fullname), "" if path ~= "" then result = fullname @@ -12155,21 +14497,21 @@ function runners.execute_script(fullname,internal,nosplit) if suffix == "" then -- loop over known suffixes for _,s in pairs(runners.suffixes) do - result = resolvers.find_file(name .. "." .. s, 'texmfscripts') + result = resolvers.findfile(name .. "." .. s, 'texmfscripts') if result ~= "" then break end end elseif runners.applications[suffix] then - result = resolvers.find_file(name, 'texmfscripts') + result = resolvers.findfile(name, 'texmfscripts') else -- maybe look on path - result = resolvers.find_file(name, 'other text files') + result = resolvers.findfile(name, 'other text files') end end if result and result ~= "" then if not no_split then - local before, after = environment.split_arguments(fullname) -- already done + local before, after = environment.splitarguments(fullname) -- already done environment.arguments_before, environment.arguments_after = before, after end if internal then @@ -12181,12 +14523,12 @@ function runners.execute_script(fullname,internal,nosplit) if binary and binary ~= "" then result = binary .. " " .. result end - local command = result .. " " .. environment.reconstruct_commandline(environment.arguments_after,noquote) - if logs.verbose then - logs.simpleline() - logs.simple("executing: %s",command) - logs.simpleline() - logs.simpleline() + local command = result .. " " .. environment.reconstructcommandline(environment.arguments_after,noquote) + if e_verbose then + report() + report("executing: %s",command) + report() + report() io.flush() end -- no os.exec because otherwise we get the wrong return value @@ -12196,14 +14538,14 @@ function runners.execute_script(fullname,internal,nosplit) else if binary then binary = file.addsuffix(binary,os.binsuffix) - for p in string.gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do + for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do if lfs.isfile(file.join(p,binary)) then return false end end - logs.simpleline() - logs.simple("This script needs '%s' which seems not to be installed.",binary) - logs.simpleline() + report() + report("This script needs '%s' which seems not to be installed.",binary) + report() end return false end @@ -12223,14 +14565,15 @@ function runners.execute_program(fullname) elseif state == 'skip' then return true elseif state == "run" then - local before, after = environment.split_arguments(fullname) - environment.initialize_arguments(after) + local before, after = environment.splitarguments(fullname) + for k=1,#after do after[k] = resolvers.resolve(after[k]) end + environment.initializearguments(after) fullname = fullname:gsub("^bin:","") - local command = fullname .. " " .. (environment.reconstruct_commandline(after or "",noquote) or "") - logs.simpleline() - logs.simple("executing: %s",command) - logs.simpleline() - logs.simpleline() + local command = fullname .. " " .. (environment.reconstructcommandline(after or "",noquote) or "") + report() + report("executing: %s",command) + report() + report() io.flush() local code = os.exec(command) -- (fullname,unpack(after)) does not work / maybe spawn return code == 0 @@ -12239,7 +14582,7 @@ function runners.execute_program(fullname) return false end --- the --usekpse flag will fallback on kpse (hm, we can better update mtx-stubs) +-- the --usekpse flag will fallback (not default) on kpse (hm, we can better update mtx-stubs) local windows_stub = '@echo off\013\010setlocal\013\010set ownpath=%%~dp0%%\013\010texlua "%%ownpath%%mtxrun.lua" --usekpse --execute %s %%*\013\010endlocal\013\010' local unix_stub = '#!/bin/sh\010mtxrun --usekpse --execute %s \"$@\"\010' @@ -12258,22 +14601,22 @@ function runners.handle_stubs(create) for _,v in pairs(runners.registered) do local name, doit = v[1], v[2] if doit then - local base = string.gsub(file.basename(name), "%.(.-)$", "") + local base = gsub(file.basename(name), "%.(.-)$", "") if create then if windows then - io.savedata(file.join(stubpath,base..".bat"),string.format(windows_stub,name)) - logs.simple("windows stub for '%s' created",base) + io.savedata(file.join(stubpath,base..".bat"),format(windows_stub,name)) + report("windows stub for '%s' created",base) end if unix then - io.savedata(file.join(stubpath,base),string.format(unix_stub,name)) - logs.simple("unix stub for '%s' created",base) + io.savedata(file.join(stubpath,base),format(unix_stub,name)) + report("unix stub for '%s' created",base) end else if windows and (os.remove(file.join(stubpath,base..'.bat')) or os.remove(file.join(stubpath,base..'.cmd'))) then - logs.simple("windows stub for '%s' removed", base) + report("windows stub for '%s' removed", base) end if unix and (os.remove(file.join(stubpath,base)) or os.remove(file.join(stubpath,base..'.sh'))) then - logs.simple("unix stub for '%s' removed",base) + report("unix stub for '%s' removed",base) end end end @@ -12289,7 +14632,7 @@ end function runners.locate_file(filename) -- differs from texmfstart where locate appends .com .exe .bat ... todo if filename and filename ~= "" then - runners.report_location(resolvers.find_given_file(filename)) + runners.report_location(resolvers.findgivenfile(filename)) end end @@ -12298,28 +14641,28 @@ function runners.locate_platform() end function runners.report_location(result) - if logs.verbose then - logs.simpleline() + if e_verbose then + reportline() if result and result ~= "" then - logs.simple(result) + report(result) else - logs.simple("not found") + report("not found") end else io.write(result) end end -function runners.edit_script(filename) -- we assume that vim is present on most systems - local editor = os.getenv("MTXRUN_EDITOR") or os.getenv("TEXMFSTART_EDITOR") or os.getenv("EDITOR") or 'vim' +function runners.edit_script(filename) -- we assume that gvim is present on most systems (todo: also in cnf file) + local editor = os.getenv("MTXRUN_EDITOR") or os.getenv("TEXMFSTART_EDITOR") or os.getenv("EDITOR") or 'gvim' local rest = resolvers.resolve(filename) if rest ~= "" then local command = editor .. " " .. rest - if logs.verbose then - logs.simpleline() - logs.simple("starting editor: %s",command) - logs.simple_line() - logs.simple_line() + if e_verbose then + report() + report("starting editor: %s",command) + report() + report() end os.launch(command) end @@ -12362,33 +14705,33 @@ end function runners.launch_file(filename) instance.allresults = true - logs.setverbose(true) + trackers.enable("resolvers.locating") local pattern = environment.arguments["pattern"] if not pattern or pattern == "" then pattern = filename end if not pattern or pattern == "" then - logs.simple("provide name or --pattern=") + report("provide name or --pattern=") else - local t = resolvers.find_files(pattern) + local t = resolvers.findfiles(pattern) if not t or #t == 0 then - t = resolvers.find_files("*/" .. pattern) + t = resolvers.findfiles("*/" .. pattern) end if not t or #t == 0 then - t = resolvers.find_files("*/" .. pattern .. "*") + t = resolvers.findfiles("*/" .. pattern .. "*") end if t and #t > 0 then if environment.arguments["all"] then for _, v in pairs(t) do - logs.simple("launching %s", v) + report("launching %s", v) resolvers.launch(v) end else - logs.simple("launching %s", t[1]) + report("launching %s", t[1]) resolvers.launch(t[1]) end else - logs.simple("no match for %s", pattern) + report("no match for %s", pattern) end end end @@ -12421,33 +14764,45 @@ function runners.find_mtx_script(filename) local mtxprefix = (filename:find("^mtx%-") and "") or "mtx-" -- context namespace, mtx- fullname = mtxprefix .. filename - fullname = found(fullname) or resolvers.find_file(fullname) + fullname = found(fullname) or resolvers.findfile(fullname) if fullname and fullname ~= "" then return fullname end -- context namespace, mtx-s fullname = mtxprefix .. basename .. "s" .. "." .. suffix - fullname = found(fullname) or resolvers.find_file(fullname) + fullname = found(fullname) or resolvers.findfile(fullname) if fullname and fullname ~= "" then return fullname end -- context namespace, mtx- fullname = mtxprefix .. basename:gsub("s$","") .. "." .. suffix - fullname = found(fullname) or resolvers.find_file(fullname) + fullname = found(fullname) or resolvers.findfile(fullname) if fullname and fullname ~= "" then return fullname end -- context namespace, just - fullname = resolvers.find_file(filename) + fullname = resolvers.findfile(filename) return fullname end -function runners.execute_ctx_script(filename) +function runners.register_arguments(...) + local arguments = environment.arguments_after + local passedon = { ... } + for i=#passedon,1,-1 do + local pi = passedon[i] + if pi then + table.insert(arguments,1,pi) + end + end +end + +function runners.execute_ctx_script(filename,...) + runners.register_arguments(...) local arguments = environment.arguments_after local fullname = runners.find_mtx_script(filename) or "" if file.extname(fullname) == "cld" then -- handy in editors where we force --autopdf - logs.simple("running cld script: %s",filename) + report("running cld script: %s",filename) table.insert(arguments,1,fullname) table.insert(arguments,"--autopdf") fullname = runners.find_mtx_script("context") or "" @@ -12455,7 +14810,7 @@ function runners.execute_ctx_script(filename) -- retry after generate but only if --autogenerate if fullname == "" and environment.argument("autogenerate") then -- might become the default instance.renewcache = true - logs.setverbose(true) + trackers.enable("resolvers.locating") resolvers.load() -- fullname = runners.find_mtx_script(filename) or "" @@ -12470,7 +14825,7 @@ function runners.execute_ctx_script(filename) elseif state == "run" then -- load and save ... kind of undocumented arg = { } for _,v in pairs(arguments) do arg[#arg+1] = resolvers.resolve(v) end - environment.initialize_arguments(arg) + environment.initializearguments(arg) local loadname = environment.arguments['load'] if loadname then if type(loadname) ~= "string" then loadname = file.basename(fullname) end @@ -12478,8 +14833,8 @@ function runners.execute_ctx_script(filename) runners.load_script_session(loadname) end filename = environment.files[1] - if logs.verbose then - logs.simple("using script: %s\n",fullname) + if e_verbose then + report("using script: %s\n",fullname) end environment.ownscript = fullname dofile(fullname) @@ -12495,44 +14850,42 @@ function runners.execute_ctx_script(filename) return true end else - -- logs.setverbose(true) if filename == "" or filename == "help" then - local context = resolvers.find_file("mtx-context.lua") - logs.setverbose(true) + local context = resolvers.findfile("mtx-context.lua") + trackers.enable("resolvers.locating") if context ~= "" then - local result = dir.glob((string.gsub(context,"mtx%-context","mtx-*"))) -- () needed + local result = dir.glob((gsub(context,"mtx%-context","mtx-*"))) -- () needed local valid = { } table.sort(result) for i=1,#result do local scriptname = result[i] - local scriptbase = string.match(scriptname,".*mtx%-([^%-]-)%.lua") + local scriptbase = match(scriptname,".*mtx%-([^%-]-)%.lua") if scriptbase then local data = io.loaddata(scriptname) - local banner, version = string.match(data,"[\n\r]logs%.extendbanner%s*%(%s*[\"\']([^\n\r]+)%s*(%d+%.%d+)") + local banner, version = match(data,"[\n\r]logs%.extendbanner%s*%(%s*[\"\']([^\n\r]+)%s*(%d+%.%d+)") if banner then valid[#valid+1] = { scriptbase, version, banner } end end end if #valid > 0 then - logs.reportbanner() - logs.reportline() - logs.simple("no script name given, known scripts:") - logs.simple() + application.identify() + report("no script name given, known scripts:") + report() for k=1,#valid do local v = valid[k] - logs.simple("%-12s %4s %s",v[1],v[2],v[3]) + report("%-12s %4s %s",v[1],v[2],v[3]) end end else - logs.simple("no script name given") + report("no script name given") end else filename = file.addsuffix(filename,"lua") if file.is_qualified_path(filename) then - logs.simple("unknown script '%s'",filename) + report("unknown script '%s'",filename) else - logs.simple("unknown script '%s' or 'mtx-%s'",filename,filename) + report("unknown script '%s' or 'mtx-%s'",filename,filename) end end return false @@ -12540,9 +14893,9 @@ function runners.execute_ctx_script(filename) end function runners.prefixes() - logs.reportbanner() - logs.reportline() - logs.simple(table.concat(resolvers.allprefixes(true)," ")) + application.identify() + report() + report(concat(resolvers.allprefixes(true)," ")) end function runners.timedrun(filename) -- just for me @@ -12562,13 +14915,11 @@ end local filename = environment.files[1] or "" local ok = true -local before, after = environment.split_arguments(filename) +local before, after = environment.splitarguments(filename) environment.arguments_before, environment.arguments_after = before, after -environment.initialize_arguments(before) +environment.initializearguments(before) -instance.engine = environment.argument("engine") or 'luatex' -instance.progname = environment.argument("progname") or 'context' -instance.lsrmode = environment.argument("lsr") or false +instance.lsrmode = environment.argument("lsr") or false -- maybe the unset has to go to this level @@ -12576,36 +14927,40 @@ local is_mkii_stub = runners.registered[file.removesuffix(file.basename(filename if environment.argument("usekpse") or environment.argument("forcekpse") or is_mkii_stub then + resolvers.load_tree(environment.argument('tree'),true) -- force resolve of TEXMFCNF + os.setenv("engine","") os.setenv("progname","") local remapper = { - otf = "opentype fonts", - ttf = "truetype fonts", - ttc = "truetype fonts", - pfb = "type1 fonts", + otf = "opentype fonts", + ttf = "truetype fonts", + ttc = "truetype fonts", + pfb = "type1 fonts", other = "other text files", } + local progname = environment.argument("progname") or 'context' + local function kpse_initialized() texconfig.kpse_init = true local t = os.clock() - local k = kpse.original.new("luatex",instance.progname) + local k = kpse.original.new("luatex",progname) local dummy = k:find_file("mtxrun.lua") -- so that we're initialized - logs.simple("kpse fallback with progname '%s' initialized in %s seconds",instance.progname,os.clock()-t) + report("kpse fallback with progname '%s' initialized in %s seconds",progname,os.clock()-t) kpse_initialized = function() return k end return k end - local find_file = resolvers.find_file - local show_path = resolvers.show_path + local findfile = resolvers.findfile + local showpath = resolvers.showpath if environment.argument("forcekpse") then - function resolvers.find_file(name,kind) - return (kpse_initialized():find_file(resolvers.clean_path(name),(kind ~= "" and (remapper[kind] or kind)) or "tex") or "") or "" + function resolvers.findfile(name,kind) + return (kpse_initialized():find_file(resolvers.cleanpath(name),(kind ~= "" and (remapper[kind] or kind)) or "tex") or "") or "" end - function resolvers.show_path(name) + function resolvers.showpath(name) return (kpse_initialized():show_path(name)) or "" end @@ -12613,16 +14968,16 @@ if environment.argument("usekpse") or environment.argument("forcekpse") or is_mk resolvers.load() - function resolvers.find_file(name,kind) - local found = find_file(name,kind) or "" + function resolvers.findfile(name,kind) + local found = findfile(name,kind) or "" if found ~= "" then return found else - return (kpse_initialized():find_file(resolvers.clean_path(name),(kind ~= "" and (remapper[kind] or kind)) or "tex") or "") or "" + return (kpse_initialized():find_file(resolvers.cleanpath(name),(kind ~= "" and (remapper[kind] or kind)) or "tex") or "") or "" end end - function resolvers.show_path(name) - local found = show_path(name) or "" + function resolvers.showpath(name) + local found = showpath(name) or "" if found ~= "" then return found else @@ -12632,80 +14987,317 @@ if environment.argument("usekpse") or environment.argument("forcekpse") or is_mk end + function runners.loadbase() + end + else - resolvers.load() + function runners.loadbase(...) + if not resolvers.load(...) then + report("forcing cache reload") + instance.renewcache = true + trackers.enable("resolvers.locating") + if not resolvers.load(...) then + report("the resolver databases are not present or outdated") + end + end + end + + resolvers.load_tree(environment.argument('tree')) end + if environment.argument("selfmerge") then + -- embed used libraries - utils.merger.selfmerge(own.name,own.libs,own.list) + + runners.loadbase() + local found = locate_libs() + if found then + utilities.merger.selfmerge(own.name,own.libs,{ found }) + end + elseif environment.argument("selfclean") then + -- remove embedded libraries - utils.merger.selfclean(own.name) + + runners.loadbase() + utilities.merger.selfclean(own.name) + elseif environment.argument("selfupdate") then - logs.setverbose(true) - resolvers.update_script(own.name,"mtxrun") + + runners.loadbase() + trackers.enable("resolvers.locating") + resolvers.updatescript(own.name,"mtxrun") + elseif environment.argument("ctxlua") or environment.argument("internal") then + -- run a script by loading it (using libs) + + runners.loadbase() ok = runners.execute_script(filename,true) + elseif environment.argument("script") or environment.argument("scripts") then + -- run a script by loading it (using libs), pass args + + runners.loadbase() if is_mkii_stub then - -- execute mkii script ok = runners.execute_script(filename,false,true) else ok = runners.execute_ctx_script(filename) end + elseif environment.argument("execute") then + -- execute script + + runners.loadbase() ok = runners.execute_script(filename) + elseif environment.argument("direct") then + -- equals bin: + + runners.loadbase() ok = runners.execute_program(filename) + elseif environment.argument("edit") then + -- edit file + + runners.loadbase() runners.edit_script(filename) + elseif environment.argument("launch") then + + runners.loadbase() runners.launch_file(filename) -elseif environment.argument("make") then - -- make stubs + +elseif environment.argument("makestubs") then + + -- make stubs (depricated) + runners.handle_stubs(true) -elseif environment.argument("remove") then - -- remove stub + +elseif environment.argument("removestubs") then + + -- remove stub (depricated) + + runners.loadbase() runners.handle_stubs(false) + elseif environment.argument("resolve") then + -- resolve string + + runners.loadbase() runners.resolve_string(filename) + elseif environment.argument("locate") then + -- locate file + + runners.loadbase() runners.locate_file(filename) -elseif environment.argument("platform")then + +elseif environment.argument("platform") or environment.argument("show-platform") then + -- locate platform + + runners.loadbase() runners.locate_platform() + elseif environment.argument("prefixes") then + + runners.loadbase() runners.prefixes() + elseif environment.argument("timedrun") then + -- locate platform + + runners.loadbase() runners.timedrun(filename) + +elseif environment.argument("variables") or environment.argument("show-variables") or environment.argument("expansions") or environment.argument("show-expansions") then + + -- luatools: runners.execute_ctx_script("mtx-base","--expansions",filename) + + resolvers.load("nofiles") + resolvers.listers.variables(environment.argument("pattern")) + +elseif environment.argument("configurations") or environment.argument("show-configurations") then + + -- luatools: runners.execute_ctx_script("mtx-base","--configurations",filename) + + resolvers.load("nofiles") + resolvers.listers.configurations() + +elseif environment.argument("find-file") then + + -- luatools: runners.execute_ctx_script("mtx-base","--find-file",filename) + + resolvers.load() + local e_pattern = environment.argument("pattern") + local e_format = environment.arguments("format") + if not e_pattern then + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.findfiles,environment.files,e_format) + elseif type(e_pattern) == "string" then + instance.allresults = true -- brrrr + resolvers.dowithfilesandreport(resolvers.findfiles,{ e_pattern }, e_format) + end + +elseif environment.argument("find-path") then + + -- luatools: runners.execute_ctx_script("mtx-base","--find-path",filename) + + resolvers.load() + local path = resolvers.findpath(filename, instance.my_format) + if e_verbose then + report(path) + else + print(path) + end + +elseif environment.argument("expand-braces") then + + -- luatools: runners.execute_ctx_script("mtx-base","--expand-braces",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.expandbraces, environment.files) + +elseif environment.argument("expand-path") then + + -- luatools: runners.execute_ctx_script("mtx-base","--expand-path",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.expandpath, environment.files) + +elseif environment.argument("expand-var") or environment.argument("expand-variable") then + + -- luatools: runners.execute_ctx_script("mtx-base","--expand-var",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.expansion, environment.files) + +elseif environment.argument("show-path") or environment.argument("path-value") then + + -- luatools: runners.execute_ctx_script("mtx-base","--show-path",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.showpath, environment.files) + +elseif environment.argument("var-value") or environment.argument("show-value") then + + -- luatools: runners.execute_ctx_script("mtx-base","--show-value",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.variable,environment.files) + +elseif environment.argument("format-path") then + + -- luatools: runners.execute_ctx_script("mtx-base","--format-path",filename) + + resolvers.load() + report(caches.getwritablepath("format")) + +elseif environment.argument("pattern") then + + -- luatools + + runners.execute_ctx_script("mtx-base","--pattern='" .. environment.argument("pattern") .. "'",filename) + +elseif environment.argument("generate") then + + -- luatools + + instance.renewcache = true + trackers.enable("resolvers.locating") + resolvers.load() + +elseif environment.argument("make") or environment.argument("ini") or environment.argument("compile") then + + -- luatools: runners.execute_ctx_script("mtx-base","--make",filename) + + resolvers.load() + trackers.enable("resolvers.locating") + environment.make_format(filename) + +elseif environment.argument("run") then + + -- luatools + + runners.execute_ctx_script("mtx-base","--run",filename) + +elseif environment.argument("fmt") then + + -- luatools + + runners.execute_ctx_script("mtx-base","--fmt",filename) + +elseif environment.argument("help") and filename=='base' then + + -- luatools + + runners.execute_ctx_script("mtx-base","--help") + elseif environment.argument("help") or filename=='help' or filename == "" then - logs.help(messages.help) - -- execute script + + application.help() + elseif filename:find("^bin:") then + + runners.loadbase() ok = runners.execute_program(filename) + elseif is_mkii_stub then + -- execute mkii script + + runners.loadbase() ok = runners.execute_script(filename,false,true) -else + +elseif false then + + runners.loadbase() ok = runners.execute_ctx_script(filename) if not ok then ok = runners.execute_script(filename) end + +elseif environment.files[1] == 'texmfcnf.lua' then -- so that we don't need to load mtx-base + + resolvers.load("nofiles") + resolvers.listers.configurations() + +else + + runners.loadbase() + runners.execute_ctx_script("mtx-base",filename) + +end + +if e_verbose then + report() + report("runtime: %0.3f seconds",os.runtime()) end -if os.platform == "unix" then - io.write("\n") +if os.type ~= "windows" then + texio.write("\n") -- is this still valid? end if ok == false then ok = 1 elseif ok == true then ok = 0 end diff --git a/Master/bin/win32/mtxrun.dll b/Master/bin/win32/mtxrun.dll index 041e1a0e1d0..4116c5a24a6 100755 Binary files a/Master/bin/win32/mtxrun.dll and b/Master/bin/win32/mtxrun.dll differ diff --git a/Master/bin/win32/mtxrun.lua b/Master/bin/win32/mtxrun.lua index 2bdd1b8f020..cc5ebb478ac 100755 --- a/Master/bin/win32/mtxrun.lua +++ b/Master/bin/win32/mtxrun.lua @@ -8,7 +8,6 @@ if not modules then modules = { } end modules ['mtxrun'] = { license = "see context related readme files" } - -- one can make a stub: -- -- #!/bin/sh @@ -38,8 +37,6 @@ if not modules then modules = { } end modules ['mtxrun'] = { -- remember for subruns: _CTX_K_S_#{original}_ -- remember for subruns: TEXMFSTART.#{original} [tex.rb texmfstart.rb] -texlua = true - -- begin library merge @@ -54,8 +51,9 @@ if not modules then modules = { } end modules ['l-string'] = { license = "see context related readme files" } +local string = string local sub, gsub, find, match, gmatch, format, char, byte, rep, lower = string.sub, string.gsub, string.find, string.match, string.gmatch, string.format, string.char, string.byte, string.rep, string.lower -local lpegmatch = lpeg.match +local lpegmatch, S, C, Ct = lpeg.match, lpeg.S, lpeg.C, lpeg.Ct -- some functions may disappear as they are not used anywhere @@ -63,196 +61,68 @@ if not string.split then -- this will be overloaded by a faster lpeg variant - function string:split(pattern) - if #self > 0 then - local t = { } - for s in gmatch(self..pattern,"(.-)"..pattern) do - t[#t+1] = s + function string.split(str,pattern) + local t = { } + if #str > 0 then + local n = 1 + for s in gmatch(str..pattern,"(.-)"..pattern) do + t[n] = s + n = n + 1 end - return t - else - return { } end + return t end end -local chr_to_esc = { - ["%"] = "%%", - ["."] = "%.", - ["+"] = "%+", ["-"] = "%-", ["*"] = "%*", - ["^"] = "%^", ["$"] = "%$", - ["["] = "%[", ["]"] = "%]", - ["("] = "%(", [")"] = "%)", - ["{"] = "%{", ["}"] = "%}" -} - -string.chr_to_esc = chr_to_esc - -function string:esc() -- variant 2 - return (gsub(self,"(.)",chr_to_esc)) -end - -function string:unquote() - return (gsub(self,"^([\"\'])(.*)%1$","%2")) +function string.unquoted(str) + return (gsub(str,"^([\"\'])(.*)%1$","%2")) end ---~ function string:unquote() ---~ if find(self,"^[\'\"]") then ---~ return sub(self,2,-2) ---~ else ---~ return self ---~ end ---~ end -function string:quote() -- we could use format("%q") - return format("%q",self) +function string.quoted(str) + return format("%q",str) -- always " end -function string:count(pattern) -- variant 3 +function string.count(str,pattern) -- variant 3 local n = 0 - for _ in gmatch(self,pattern) do + for _ in gmatch(str,pattern) do -- not for utf n = n + 1 end return n end -function string:limit(n,sentinel) - if #self > n then - sentinel = sentinel or " ..." - return sub(self,1,(n-#sentinel)) .. sentinel - else - return self - end -end - ---~ function string:strip() -- the .- is quite efficient ---~ -- return match(self,"^%s*(.-)%s*$") or "" ---~ -- return match(self,'^%s*(.*%S)') or '' -- posted on lua list ---~ return find(s,'^%s*$') and '' or match(s,'^%s*(.*%S)') ---~ end - -do -- roberto's variant: - local space = lpeg.S(" \t\v\n") - local nospace = 1 - space - local stripper = space^0 * lpeg.C((space^0 * nospace^1)^0) - function string.strip(str) - return lpegmatch(stripper,str) or "" - end -end - -function string:is_empty() - return not find(self,"%S") -end - -function string:enhance(pattern,action) - local ok, n = true, 0 - while ok do - ok = false - self = gsub(self,pattern, function(...) - ok, n = true, n + 1 - return action(...) - end) - end - return self, n -end - -local chr_to_hex, hex_to_chr = { }, { } - -for i=0,255 do - local c, h = char(i), format("%02X",i) - chr_to_hex[c], hex_to_chr[h] = h, c -end - -function string:to_hex() - return (gsub(self or "","(.)",chr_to_hex)) -end - -function string:from_hex() - return (gsub(self or "","(..)",hex_to_chr)) -end - -if not string.characters then - - local function nextchar(str, index) - index = index + 1 - return (index <= #str) and index or nil, sub(str,index,index) - end - function string:characters() - return nextchar, self, 0 - end - local function nextbyte(str, index) - index = index + 1 - return (index <= #str) and index or nil, byte(sub(str,index,index)) - end - function string:bytes() - return nextbyte, self, 0 - end - -end - --- we can use format for this (neg n) - -function string:rpadd(n,chr) - local m = n-#self - if m > 0 then - return self .. rep(chr or " ",m) +function string.limit(str,n,sentinel) -- not utf proof + if #str > n then + sentinel = sentinel or "..." + return sub(str,1,(n-#sentinel)) .. sentinel else - return self - end -end - -function string:lpadd(n,chr) - local m = n-#self - if m > 0 then - return rep(chr or " ",m) .. self - else - return self + return str end end -string.padd = string.rpadd +local space = S(" \t\v\n") +local nospace = 1 - space +local stripper = space^0 * C((space^0 * nospace^1)^0) -- roberto's code -function is_number(str) -- tonumber - return find(str,"^[%-%+]?[%d]-%.?[%d+]$") == 1 +function string.strip(str) + return lpegmatch(stripper,str) or "" end ---~ print(is_number("1")) ---~ print(is_number("1.1")) ---~ print(is_number(".1")) ---~ print(is_number("-0.1")) ---~ print(is_number("+0.1")) ---~ print(is_number("-.1")) ---~ print(is_number("+.1")) - -function string:split_settings() -- no {} handling, see l-aux for lpeg variant - if find(self,"=") then - local t = { } - for k,v in gmatch(self,"(%a+)=([^%,]*)") do - t[k] = v - end - return t - else - return nil - end +function string.is_empty(str) + return not find(str,"%S") end local patterns_escapes = { - ["-"] = "%-", - ["."] = "%.", - ["+"] = "%+", - ["*"] = "%*", ["%"] = "%%", - ["("] = "%)", - [")"] = "%)", - ["["] = "%[", - ["]"] = "%]", + ["."] = "%.", + ["+"] = "%+", ["-"] = "%-", ["*"] = "%*", + ["["] = "%[", ["]"] = "%]", + ["("] = "%(", [")"] = "%)", + -- ["{"] = "%{", ["}"] = "%}" + -- ["^"] = "%^", ["$"] = "%$", } -function string:pattesc() - return (gsub(self,".",patterns_escapes)) -end - local simple_escapes = { ["-"] = "%-", ["."] = "%.", @@ -260,80 +130,30 @@ local simple_escapes = { ["*"] = ".*", } -function string:simpleesc() - return (gsub(self,".",simple_escapes)) -end - -function string:tohash() - local t = { } - for s in gmatch(self,"([^, ]+)") do -- lpeg - t[s] = true - end - return t -end - -local pattern = lpeg.Ct(lpeg.C(1)^0) - -function string:totable() - return lpegmatch(pattern,self) +function string.escapedpattern(str,simple) + return (gsub(str,".",simple and simple_escapes or patterns_escapes)) end ---~ local t = { ---~ "1234567123456712345671234567", ---~ "a\tb\tc", ---~ "aa\tbb\tcc", ---~ "aaa\tbbb\tccc", ---~ "aaaa\tbbbb\tcccc", ---~ "aaaaa\tbbbbb\tccccc", ---~ "aaaaaa\tbbbbbb\tcccccc", ---~ } ---~ for k,v do ---~ print(string.tabtospace(t[k])) ---~ end - -function string.tabtospace(str,tab) - -- we don't handle embedded newlines - while true do - local s = find(str,"\t") - if s then - if not tab then tab = 7 end -- only when found - local d = tab-(s-1) % tab - if d > 0 then - str = gsub(str,"\t",rep(" ",d),1) - else - str = gsub(str,"\t","",1) - end +function string.topattern(str,lowercase,strict) + if str == "" then + return ".*" + else + str = gsub(str,".",simple_escapes) + if lowercase then + str = lower(str) + end + if strict then + return "^" .. str .. "$" else - break + return str end end - return str end -function string:compactlong() -- strips newlines and leading spaces - self = gsub(self,"[\n\r]+ *","") - self = gsub(self,"^ *","") - return self -end - -function string:striplong() -- strips newlines and leading spaces - self = gsub(self,"^%s*","") - self = gsub(self,"[\n\r]+ *","\n") - return self -end +-- obsolete names: -function string:topattern(lowercase,strict) - if lowercase then - self = lower(self) - end - self = gsub(self,".",simple_escapes) - if self == "" then - self = ".*" - elseif strict then - self = "^" .. self .. "$" - end - return self -end +string.quote = string.quoted +string.unquote = string.unquoted end -- of closure @@ -350,28 +170,75 @@ if not modules then modules = { } end modules ['l-lpeg'] = { local lpeg = require("lpeg") +local type = type + +-- Beware, we predefine a bunch of patterns here and one reason for doing so +-- is that we get consistent behaviour in some of the visualizers. + lpeg.patterns = lpeg.patterns or { } -- so that we can share local patterns = lpeg.patterns -local P, R, S, Ct, C, Cs, Cc, V = lpeg.P, lpeg.R, lpeg.S, lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.V -local match = lpeg.match +local P, R, S, V, match = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.match +local Ct, C, Cs, Cc = lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc +local lpegtype = lpeg.type + +local utfcharacters = string.utfcharacters +local utfgmatch = unicode and unicode.utf8.gmatch + +local anything = P(1) +local endofstring = P(-1) +local alwaysmatched = P(true) + +patterns.anything = anything +patterns.endofstring = endofstring +patterns.beginofstring = alwaysmatched +patterns.alwaysmatched = alwaysmatched local digit, sign = R('09'), S('+-') local cr, lf, crlf = P("\r"), P("\n"), P("\r\n") -local utf8byte = R("\128\191") +local newline = crlf + cr + lf +local escaped = P("\\") * anything +local squote = P("'") +local dquote = P('"') +local space = P(" ") + +local utfbom_32_be = P('\000\000\254\255') +local utfbom_32_le = P('\255\254\000\000') +local utfbom_16_be = P('\255\254') +local utfbom_16_le = P('\254\255') +local utfbom_8 = P('\239\187\191') +local utfbom = utfbom_32_be + utfbom_32_le + + utfbom_16_be + utfbom_16_le + + utfbom_8 +local utftype = utfbom_32_be / "utf-32-be" + utfbom_32_le / "utf-32-le" + + utfbom_16_be / "utf-16-be" + utfbom_16_le / "utf-16-le" + + utfbom_8 / "utf-8" + alwaysmatched / "unknown" + +local utf8next = R("\128\191") -patterns.utf8byte = utf8byte patterns.utf8one = R("\000\127") -patterns.utf8two = R("\194\223") * utf8byte -patterns.utf8three = R("\224\239") * utf8byte * utf8byte -patterns.utf8four = R("\240\244") * utf8byte * utf8byte * utf8byte +patterns.utf8two = R("\194\223") * utf8next +patterns.utf8three = R("\224\239") * utf8next * utf8next +patterns.utf8four = R("\240\244") * utf8next * utf8next * utf8next +patterns.utfbom = utfbom +patterns.utftype = utftype + +local utf8char = patterns.utf8one + patterns.utf8two + patterns.utf8three + patterns.utf8four +local validutf8char = utf8char^0 * endofstring * Cc(true) + Cc(false) + +patterns.utf8 = utf8char +patterns.utf8char = utf8char +patterns.validutf8 = validutf8char +patterns.validutf8char = validutf8char patterns.digit = digit patterns.sign = sign patterns.cardinal = sign^0 * digit^1 patterns.integer = sign^0 * digit^1 patterns.float = sign^0 * digit^0 * P('.') * digit^1 +patterns.cfloat = sign^0 * digit^0 * P(',') * digit^1 patterns.number = patterns.float + patterns.integer +patterns.cnumber = patterns.cfloat + patterns.integer patterns.oct = P("0") * R("07")^1 patterns.octal = patterns.oct patterns.HEX = P("0x") * R("09","AF")^1 @@ -380,16 +247,42 @@ patterns.hexadecimal = P("0x") * R("09","AF","af")^1 patterns.lowercase = R("az") patterns.uppercase = R("AZ") patterns.letter = patterns.lowercase + patterns.uppercase -patterns.space = S(" ") +patterns.space = space +patterns.tab = P("\t") +patterns.spaceortab = patterns.space + patterns.tab patterns.eol = S("\n\r") patterns.spacer = S(" \t\f\v") -- + string.char(0xc2, 0xa0) if we want utf (cf mail roberto) -patterns.newline = crlf + cr + lf -patterns.nonspace = 1 - patterns.space +patterns.newline = newline +patterns.emptyline = newline^1 patterns.nonspacer = 1 - patterns.spacer patterns.whitespace = patterns.eol + patterns.spacer patterns.nonwhitespace = 1 - patterns.whitespace -patterns.utf8 = patterns.utf8one + patterns.utf8two + patterns.utf8three + patterns.utf8four -patterns.utfbom = P('\000\000\254\255') + P('\255\254\000\000') + P('\255\254') + P('\254\255') + P('\239\187\191') +patterns.equal = P("=") +patterns.comma = P(",") +patterns.commaspacer = P(",") * patterns.spacer^0 +patterns.period = P(".") +patterns.colon = P(":") +patterns.semicolon = P(";") +patterns.underscore = P("_") +patterns.escaped = escaped +patterns.squote = squote +patterns.dquote = dquote +patterns.nosquote = (escaped + (1-squote))^0 +patterns.nodquote = (escaped + (1-dquote))^0 +patterns.unsingle = (squote/"") * patterns.nosquote * (squote/"") +patterns.undouble = (dquote/"") * patterns.nodquote * (dquote/"") +patterns.unquoted = patterns.undouble + patterns.unsingle -- more often undouble +patterns.unspacer = ((patterns.spacer^1)/"")^0 + +patterns.somecontent = (anything - newline - space)^1 -- (utf8char - newline - space)^1 +patterns.beginline = #(1-newline) + +local unquoted = Cs(patterns.unquoted * endofstring) -- not C + +function string.unquoted(str) + return match(unquoted,str) or str +end + function lpeg.anywhere(pattern) --slightly adapted from website return P { P(pattern) + 1 * V(1) } -- why so complex? @@ -399,36 +292,18 @@ function lpeg.splitter(pattern, action) return (((1-P(pattern))^1)/action+1)^0 end -local spacing = patterns.spacer^0 * patterns.newline -- sort of strip -local empty = spacing * Cc("") -local nonempty = Cs((1-spacing)^1) * spacing^-1 -local content = (empty + nonempty)^1 - -local capture = Ct(content^0) - -function string:splitlines() - return match(capture,self) -end - -patterns.textline = content - ---~ local p = lpeg.splitat("->",false) print(match(p,"oeps->what->more")) -- oeps what more ---~ local p = lpeg.splitat("->",true) print(match(p,"oeps->what->more")) -- oeps what->more ---~ local p = lpeg.splitat("->",false) print(match(p,"oeps")) -- oeps ---~ local p = lpeg.splitat("->",true) print(match(p,"oeps")) -- oeps - local splitters_s, splitters_m = { }, { } local function splitat(separator,single) local splitter = (single and splitters_s[separator]) or splitters_m[separator] if not splitter then separator = P(separator) + local other = C((1 - separator)^0) if single then - local other, any = C((1 - separator)^0), P(1) + local any = anything splitter = other * (separator * C(any^0) + "") -- ? splitters_s[separator] = splitter else - local other = C((1 - separator)^0) splitter = other * (separator * other)^0 splitters_m[separator] = splitter end @@ -438,6 +313,7 @@ end lpeg.splitat = splitat + local cache = { } function lpeg.split(separator,str) @@ -449,16 +325,39 @@ function lpeg.split(separator,str) return match(c,str) end -function string:split(separator) +function string.split(str,separator) local c = cache[separator] if not c then c = Ct(splitat(separator)) cache[separator] = c end - return match(c,self) + return match(c,str) +end + +local spacing = patterns.spacer^0 * newline -- sort of strip +local empty = spacing * Cc("") +local nonempty = Cs((1-spacing)^1) * spacing^-1 +local content = (empty + nonempty)^1 + +patterns.textline = content + + +local linesplitter = Ct(splitat(newline)) + +patterns.linesplitter = linesplitter + +function string.splitlines(str) + return match(linesplitter,str) +end + +local utflinesplitter = utfbom^-1 * Ct(splitat(newline)) + +patterns.utflinesplitter = utflinesplitter + +function string.utfsplitlines(str) + return match(utflinesplitter,str) end -lpeg.splitters = cache local cache = { } @@ -466,37 +365,24 @@ function lpeg.checkedsplit(separator,str) local c = cache[separator] if not c then separator = P(separator) - local other = C((1 - separator)^0) + local other = C((1 - separator)^1) c = Ct(separator^0 * other * (separator^1 * other)^0) cache[separator] = c end return match(c,str) end -function string:checkedsplit(separator) +function string.checkedsplit(str,separator) local c = cache[separator] if not c then separator = P(separator) - local other = C((1 - separator)^0) + local other = C((1 - separator)^1) c = Ct(separator^0 * other * (separator^1 * other)^0) cache[separator] = c end - return match(c,self) + return match(c,str) end ---~ function lpeg.append(list,pp) ---~ local p = pp ---~ for l=1,#list do ---~ if p then ---~ p = p + P(list[l]) ---~ else ---~ p = P(list[l]) ---~ end ---~ end ---~ return p ---~ end - ---~ from roberto's site: local f1 = string.byte @@ -504,170 +390,459 @@ local function f2(s) local c1, c2 = f1(s,1,2) return c1 * 64 + c2 local function f3(s) local c1, c2, c3 = f1(s,1,3) return (c1 * 64 + c2) * 64 + c3 - 925824 end local function f4(s) local c1, c2, c3, c4 = f1(s,1,4) return ((c1 * 64 + c2) * 64 + c3) * 64 + c4 - 63447168 end -patterns.utf8byte = patterns.utf8one/f1 + patterns.utf8two/f2 + patterns.utf8three/f3 + patterns.utf8four/f4 - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-table'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -table.join = table.concat +local utf8byte = patterns.utf8one/f1 + patterns.utf8two/f2 + patterns.utf8three/f3 + patterns.utf8four/f4 -local concat, sort, insert, remove = table.concat, table.sort, table.insert, table.remove -local format, find, gsub, lower, dump, match = string.format, string.find, string.gsub, string.lower, string.dump, string.match -local getmetatable, setmetatable = getmetatable, setmetatable -local type, next, tostring, tonumber, ipairs = type, next, tostring, tonumber, ipairs +patterns.utf8byte = utf8byte --- Starting with version 5.2 Lua no longer provide ipairs, which makes --- sense. As we already used the for loop and # in most places the --- impact on ConTeXt was not that large; the remaining ipairs already --- have been replaced. In a similar fashio we also hardly used pairs. --- --- Just in case, we provide the fallbacks as discussed in Programming --- in Lua (http://www.lua.org/pil/7.3.html): -if not ipairs then - -- for k, v in ipairs(t) do ... end - -- for k=1,#t do local v = t[k] ... end +local cache = { } - local function iterate(a,i) - i = i + 1 - local v = a[i] - if v ~= nil then - return i, v --, nil +function lpeg.stripper(str) + if type(str) == "string" then + local s = cache[str] + if not s then + s = Cs(((S(str)^1)/"" + 1)^0) + cache[str] = s end + return s + else + return Cs(((str^1)/"" + 1)^0) end - - function ipairs(a) - return iterate, a, 0 - end - end -if not pairs then - - -- for k, v in pairs(t) do ... end - -- for k, v in next, t do ... end +local cache = { } - function pairs(t) - return next, t -- , nil +function lpeg.keeper(str) + if type(str) == "string" then + local s = cache[str] + if not s then + s = Cs((((1-S(str))^1)/"" + 1)^0) + cache[str] = s + end + return s + else + return Cs((((1-str)^1)/"" + 1)^0) end - end --- Also, unpack has been moved to the table table, and for compatiility --- reasons we provide both now. +function lpeg.frontstripper(str) -- or pattern (yet undocumented) + return (P(str) + P(true)) * Cs(P(1)^0) +end -if not table.unpack then - table.unpack = _G.unpack -elseif not unpack then - _G.unpack = table.unpack +function lpeg.endstripper(str) -- or pattern (yet undocumented) + return Cs((1 - P(str) * P(-1))^0) end --- extra functions, some might go (when not used) +-- Just for fun I looked at the used bytecode and +-- p = (p and p + pp) or pp gets one more (testset). -function table.strip(tab) - local lst = { } - for i=1,#tab do - local s = gsub(tab[i],"^%s*(.-)%s*$","%1") - if s == "" then - -- skip this one - else - lst[#lst+1] = s +function lpeg.replacer(one,two) + if type(one) == "table" then + local no = #one + if no > 0 then + local p + for i=1,no do + local o = one[i] + local pp = P(o[1]) / o[2] + if p then + p = p + pp + else + p = pp + end + end + return Cs((p + 1)^0) end + else + two = two or "" + return Cs((P(one)/two + 1)^0) end - return lst end -function table.keys(t) - local k = { } - for key, _ in next, t do - k[#k+1] = key - end - return k -end +local splitters_f, splitters_s = { }, { } -local function compare(a,b) - return (tostring(a) < tostring(b)) +function lpeg.firstofsplit(separator) -- always return value + local splitter = splitters_f[separator] + if not splitter then + separator = P(separator) + splitter = C((1 - separator)^0) + splitters_f[separator] = splitter + end + return splitter end -local function sortedkeys(tab) - local srt, kind = { }, 0 -- 0=unknown 1=string, 2=number 3=mixed - for key,_ in next, tab do - srt[#srt+1] = key - if kind == 3 then - -- no further check - else - local tkey = type(key) - if tkey == "string" then - -- if kind == 2 then kind = 3 else kind = 1 end - kind = (kind == 2 and 3) or 1 - elseif tkey == "number" then - -- if kind == 1 then kind = 3 else kind = 2 end - kind = (kind == 1 and 3) or 2 - else - kind = 3 - end - end - end - if kind == 0 or kind == 3 then - sort(srt,compare) - else - sort(srt) +function lpeg.secondofsplit(separator) -- nil if not split + local splitter = splitters_s[separator] + if not splitter then + separator = P(separator) + splitter = (1 - separator)^0 * separator * C(anything^0) + splitters_s[separator] = splitter end - return srt + return splitter end -local function sortedhashkeys(tab) -- fast one - local srt = { } - for key,_ in next, tab do - srt[#srt+1] = key - end - sort(srt) - return srt +function lpeg.balancer(left,right) + left, right = P(left), P(right) + return P { left * ((1 - left - right) + V(1))^0 * right } end -table.sortedkeys = sortedkeys -table.sortedhashkeys = sortedhashkeys -function table.sortedhash(t) - local s = sortedhashkeys(t) -- maybe just sortedkeys - local n = 0 - local function kv(s) - n = n + 1 - local k = s[n] - return k, t[k] - end - return kv, s -end -table.sortedpairs = table.sortedhash +local nany = utf8char/"" -function table.append(t, list) - for _,v in next, list do - insert(t,v) +function lpeg.counter(pattern) + pattern = Cs((P(pattern)/" " + nany)^0) + return function(str) + return #match(pattern,str) end end -function table.prepend(t, list) - for k,v in next, list do - insert(t,k,v) - end -end +if utfgmatch then -function table.merge(t, ...) -- first one is target - t = t or {} - local lst = {...} - for i=1,#lst do + function lpeg.count(str,what) -- replaces string.count + if type(what) == "string" then + local n = 0 + for _ in utfgmatch(str,what) do + n = n + 1 + end + return n + else -- 4 times slower but still faster than / function + return #match(Cs((P(what)/" " + nany)^0),str) + end + end + +else + + local cache = { } + + function lpeg.count(str,what) -- replaces string.count + if type(what) == "string" then + local p = cache[what] + if not p then + p = Cs((P(what)/" " + nany)^0) + cache[p] = p + end + return #match(p,str) + else -- 4 times slower but still faster than / function + return #match(Cs((P(what)/" " + nany)^0),str) + end + end + +end + +local patterns_escapes = { -- also defines in l-string + ["%"] = "%%", + ["."] = "%.", + ["+"] = "%+", ["-"] = "%-", ["*"] = "%*", + ["["] = "%[", ["]"] = "%]", + ["("] = "%)", [")"] = "%)", + -- ["{"] = "%{", ["}"] = "%}" + -- ["^"] = "%^", ["$"] = "%$", +} + +local simple_escapes = { -- also defines in l-string + ["-"] = "%-", + ["."] = "%.", + ["?"] = ".", + ["*"] = ".*", +} + +local p = Cs((S("-.+*%()[]") / patterns_escapes + anything)^0) +local s = Cs((S("-.+*%()[]") / simple_escapes + anything)^0) + +function string.escapedpattern(str,simple) + return match(simple and s or p,str) +end + +-- utf extensies + +lpeg.UP = lpeg.P + +if utfcharacters then + + function lpeg.US(str) + local p + for uc in utfcharacters(str) do + if p then + p = p + P(uc) + else + p = P(uc) + end + end + return p + end + + +elseif utfgmatch then + + function lpeg.US(str) + local p + for uc in utfgmatch(str,".") do + if p then + p = p + P(uc) + else + p = P(uc) + end + end + return p + end + +else + + function lpeg.US(str) + local p + local f = function(uc) + if p then + p = p + P(uc) + else + p = P(uc) + end + end + match((utf8char/f)^0,str) + return p + end + +end + +local range = Cs(utf8byte) * (Cs(utf8byte) + Cc(false)) + +local utfchar = unicode and unicode.utf8 and unicode.utf8.char + +function lpeg.UR(str,more) + local first, last + if type(str) == "number" then + first = str + last = more or first + else + first, last = match(range,str) + if not last then + return P(str) + end + end + if first == last then + return P(str) + elseif utfchar and last - first < 8 then -- a somewhat arbitrary criterium + local p + for i=first,last do + if p then + p = p + P(utfchar(i)) + else + p = P(utfchar(i)) + end + end + return p -- nil when invalid range + else + local f = function(b) + return b >= first and b <= last + end + return utf8byte / f -- nil when invalid range + end +end + + + +function lpeg.oneof(list,...) -- lpeg.oneof("elseif","else","if","then") + if type(list) ~= "table" then + list = { list, ... } + end + -- sort(list) -- longest match first + local p = P(list[1]) + for l=2,#list do + p = p + P(list[l]) + end + return p +end + +function lpeg.is_lpeg(p) + return p and lpegtype(p) == "pattern" +end + + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['l-table'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local type, next, tostring, tonumber, ipairs, table, string = type, next, tostring, tonumber, ipairs, table, string +local concat, sort, insert, remove = table.concat, table.sort, table.insert, table.remove +local format, find, gsub, lower, dump, match = string.format, string.find, string.gsub, string.lower, string.dump, string.match +local getmetatable, setmetatable = getmetatable, setmetatable + +-- Starting with version 5.2 Lua no longer provide ipairs, which makes +-- sense. As we already used the for loop and # in most places the +-- impact on ConTeXt was not that large; the remaining ipairs already +-- have been replaced. In a similar fashio we also hardly used pairs. +-- +-- Just in case, we provide the fallbacks as discussed in Programming +-- in Lua (http://www.lua.org/pil/7.3.html): + +if not ipairs then + + -- for k, v in ipairs(t) do ... end + -- for k=1,#t do local v = t[k] ... end + + local function iterate(a,i) + i = i + 1 + local v = a[i] + if v ~= nil then + return i, v --, nil + end + end + + function ipairs(a) + return iterate, a, 0 + end + +end + +if not pairs then + + -- for k, v in pairs(t) do ... end + -- for k, v in next, t do ... end + + function pairs(t) + return next, t -- , nil + end + +end + +-- Also, unpack has been moved to the table table, and for compatiility +-- reasons we provide both now. + +if not table.unpack then + table.unpack = _G.unpack +elseif not unpack then + _G.unpack = table.unpack +end + +-- extra functions, some might go (when not used) + +function table.strip(tab) + local lst, l = { }, 0 + for i=1,#tab do + local s = gsub(tab[i],"^%s*(.-)%s*$","%1") + if s == "" then + -- skip this one + else + l = l + 1 + lst[l] = s + end + end + return lst +end + +function table.keys(t) + local keys, k = { }, 0 + for key, _ in next, t do + k = k + 1 + keys[k] = key + end + return keys +end + +local function compare(a,b) + local ta, tb = type(a), type(b) -- needed, else 11 < 2 + if ta == tb then + return a < b + else + return tostring(a) < tostring(b) + end +end + +local function sortedkeys(tab) + local srt, category, s = { }, 0, 0 -- 0=unknown 1=string, 2=number 3=mixed + for key,_ in next, tab do + s = s + 1 + srt[s] = key + if category == 3 then + -- no further check + else + local tkey = type(key) + if tkey == "string" then + category = (category == 2 and 3) or 1 + elseif tkey == "number" then + category = (category == 1 and 3) or 2 + else + category = 3 + end + end + end + if category == 0 or category == 3 then + sort(srt,compare) + else + sort(srt) + end + return srt +end + +local function sortedhashkeys(tab) -- fast one + local srt, s = { }, 0 + for key,_ in next, tab do + if key then + s= s + 1 + srt[s] = key + end + end + sort(srt) + return srt +end + +table.sortedkeys = sortedkeys +table.sortedhashkeys = sortedhashkeys + +local function nothing() end + +local function sortedhash(t) + if t then + local n, s = 0, sortedkeys(t) -- the robust one + local function kv(s) + n = n + 1 + local k = s[n] + return k, t[k] + end + return kv, s + else + return nothing + end +end + +table.sortedhash = sortedhash +table.sortedpairs = sortedhash + +function table.append(t, list) + local n = #t + for i=1,#list do + n = n + 1 + t[n] = list[i] + end + return t +end + +function table.prepend(t, list) + local nl = #list + local nt = nl + #t + for i=#t,1,-1 do + t[nt] = t[i] + nt = nt - 1 + end + for i=1,#list do + t[i] = list[i] + end + return t +end + +function table.merge(t, ...) -- first one is target + t = t or { } + local lst = { ... } + for i=1,#lst do for k, v in next, lst[i] do t[k] = v end @@ -676,7 +851,7 @@ function table.merge(t, ...) -- first one is target end function table.merged(...) - local tmp, lst = { }, {...} + local tmp, lst = { }, { ... } for i=1,#lst do for k, v in next, lst[i] do tmp[k] = v @@ -686,41 +861,45 @@ function table.merged(...) end function table.imerge(t, ...) - local lst = {...} + local lst, nt = { ... }, #t for i=1,#lst do local nst = lst[i] for j=1,#nst do - t[#t+1] = nst[j] + nt = nt + 1 + t[nt] = nst[j] end end return t end function table.imerged(...) - local tmp, lst = { }, {...} + local tmp, ntmp, lst = { }, 0, {...} for i=1,#lst do local nst = lst[i] for j=1,#nst do - tmp[#tmp+1] = nst[j] + ntmp = ntmp + 1 + tmp[ntmp] = nst[j] end end return tmp end -local function fastcopy(old) -- fast one +local function fastcopy(old,metatabletoo) -- fast one if old then local new = { } for k,v in next, old do if type(v) == "table" then - new[k] = fastcopy(v) -- was just table.copy + new[k] = fastcopy(v,metatabletoo) -- was just table.copy else new[k] = v end end - -- optional second arg - local mt = getmetatable(old) - if mt then - setmetatable(new,mt) + if metatabletoo then + -- optional second arg + local mt = getmetatable(old) + if mt then + setmetatable(new,mt) + end end return new else @@ -728,6 +907,8 @@ local function fastcopy(old) -- fast one end end +-- todo : copy without metatable + local function copy(t, tables) -- taken from lua wiki, slightly adapted tables = tables or { } local tcopy = {} @@ -760,33 +941,14 @@ end table.fastcopy = fastcopy table.copy = copy --- roughly: copy-loop : unpack : sub == 0.9 : 0.4 : 0.45 (so in critical apps, use unpack) - -function table.sub(t,i,j) - return { unpack(t,i,j) } -end - -function table.replace(a,b) - for k,v in next, b do - a[k] = v +function table.derive(parent) + local child = { } + if parent then + setmetatable(child,{ __index = parent }) end + return child end --- slower than #t on indexed tables (#t only returns the size of the numerically indexed slice) - -function table.is_empty(t) -- obolete, use inline code instead - return not t or not next(t) -end - -function table.one_entry(t) -- obolete, use inline code instead - local n = next(t) - return n and not next(t,n) -end - ---~ function table.starts_at(t) -- obsolete, not nice anyway ---~ return ipairs(t,1)(t,0) ---~ end - function table.tohash(t,value) local h = { } if t then @@ -799,27 +961,19 @@ function table.tohash(t,value) end function table.fromhash(t) - local h = { } + local hsh, h = { }, 0 for k, v in next, t do -- no ipairs here - if v then h[#h+1] = k end + if v then + h = h + 1 + hsh[h] = k + end end - return h + return hsh end ---~ print(table.serialize(t), "\n") ---~ print(table.serialize(t,"name"), "\n") ---~ print(table.serialize(t,false), "\n") ---~ print(table.serialize(t,true), "\n") ---~ print(table.serialize(t,"name",true), "\n") ---~ print(table.serialize(t,"name",true,true), "\n") - -table.serialize_functions = true -table.serialize_compact = true -table.serialize_inline = true - local noquotes, hexify, handle, reduce, compact, inline, functions -local reserved = table.tohash { -- intercept a language flaw, no reserved words as key +local reserved = table.tohash { -- intercept a language inconvenience: no reserved words as key 'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat', 'return', 'then', 'true', 'until', 'while', } @@ -831,20 +985,23 @@ local function simple_table(t) n = n + 1 end if n == #t then - local tt = { } + local tt, nt = { }, 0 for i=1,#t do local v = t[i] local tv = type(v) if tv == "number" then + nt = nt + 1 if hexify then - tt[#tt+1] = format("0x%04X",v) + tt[nt] = format("0x%04X",v) else - tt[#tt+1] = tostring(v) -- tostring not needed + tt[nt] = tostring(v) -- tostring not needed end elseif tv == "boolean" then - tt[#tt+1] = tostring(v) + nt = nt + 1 + tt[nt] = tostring(v) elseif tv == "string" then - tt[#tt+1] = format("%q",v) + nt = nt + 1 + tt[nt] = format("%q",v) else tt = nil break @@ -870,21 +1027,25 @@ local function do_serialize(root,name,depth,level,indexed) depth = depth .. " " if indexed then handle(format("%s{",depth)) - elseif name then - --~ handle(format("%s%s={",depth,key(name))) - if type(name) == "number" then -- or find(k,"^%d+$") then + else + local tn = type(name) + if tn == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s[0x%04X]={",depth,name)) else handle(format("%s[%s]={",depth,name)) end - elseif noquotes and not reserved[name] and find(name,"^%a[%w%_]*$") then - handle(format("%s%s={",depth,name)) + elseif tn == "string" then + if noquotes and not reserved[name] and find(name,"^%a[%w%_]*$") then + handle(format("%s%s={",depth,name)) + else + handle(format("%s[%q]={",depth,name)) + end + elseif tn == "boolean" then + handle(format("%s[%s]={",depth,tostring(name))) else - handle(format("%s[%q]={",depth,name)) + handle(format("%s{",depth)) end - else - handle(format("%s{",depth)) end end -- we could check for k (index) being number (cardinal) @@ -901,11 +1062,9 @@ local function do_serialize(root,name,depth,level,indexed) for i=1,#sk do local k = sk[i] local v = root[k] - --~ if v == root then - -- circular - --~ else - local t = type(v) - if compact and first and type(k) == "number" and k >= first and k <= last then + -- circular + local t, tk = type(v), type(k) + if compact and first and tk == "number" and k >= first and k <= last then if t == "number" then if hexify then handle(format("%s 0x%04X,",depth,v)) @@ -947,17 +1106,18 @@ local function do_serialize(root,name,depth,level,indexed) handle(format("%s __p__=nil,",depth)) end elseif t == "number" then - --~ if hexify then - --~ handle(format("%s %s=0x%04X,",depth,key(k),v)) - --~ else - --~ handle(format("%s %s=%s,",depth,key(k),v)) -- %.99g - --~ end - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=0x%04X,",depth,k,v)) else handle(format("%s [%s]=%s,",depth,k,v)) -- %.99g end + elseif tk == "boolean" then + if hexify then + handle(format("%s [%s]=0x%04X,",depth,tostring(k),v)) + else + handle(format("%s [%s]=%s,",depth,tostring(k),v)) -- %.99g + end elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then if hexify then handle(format("%s %s=0x%04X,",depth,k,v)) @@ -973,26 +1133,28 @@ local function do_serialize(root,name,depth,level,indexed) end elseif t == "string" then if reduce and tonumber(v) then - --~ handle(format("%s %s=%s,",depth,key(k),v)) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%s,",depth,k,v)) else handle(format("%s [%s]=%s,",depth,k,v)) end + elseif tk == "boolean" then + handle(format("%s [%s]=%s,",depth,tostring(k),v)) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%s,",depth,k,v)) else handle(format("%s [%q]=%s,",depth,k,v)) end else - --~ handle(format("%s %s=%q,",depth,key(k),v)) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%q,",depth,k,v)) else handle(format("%s [%s]=%q,",depth,k,v)) end + elseif tk == "boolean" then + handle(format("%s [%s]=%q,",depth,tostring(k),v)) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%q,",depth,k,v)) else @@ -1001,13 +1163,14 @@ local function do_serialize(root,name,depth,level,indexed) end elseif t == "table" then if not next(v) then - --~ handle(format("%s %s={},",depth,key(k))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]={},",depth,k)) else handle(format("%s [%s]={},",depth,k)) end + elseif tk == "boolean" then + handle(format("%s [%s]={},",depth,tostring(k))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s={},",depth,k)) else @@ -1016,13 +1179,14 @@ local function do_serialize(root,name,depth,level,indexed) elseif inline then local st = simple_table(v) if st then - --~ handle(format("%s %s={ %s },",depth,key(k),concat(st,", "))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]={ %s },",depth,k,concat(st,", "))) else handle(format("%s [%s]={ %s },",depth,k,concat(st,", "))) end + elseif tk == "boolean" then -- or find(k,"^%d+$") then + handle(format("%s [%s]={ %s },",depth,tostring(k),concat(st,", "))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s={ %s },",depth,k,concat(st,", "))) else @@ -1035,13 +1199,14 @@ local function do_serialize(root,name,depth,level,indexed) do_serialize(v,k,depth,level+1) end elseif t == "boolean" then - --~ handle(format("%s %s=%s,",depth,key(k),tostring(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%s,",depth,k,tostring(v))) else handle(format("%s [%s]=%s,",depth,k,tostring(v))) end + elseif tk == "boolean" then -- or find(k,"^%d+$") then + handle(format("%s [%s]=%s,",depth,tostring(k),tostring(v))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%s,",depth,k,tostring(v))) else @@ -1049,35 +1214,37 @@ local function do_serialize(root,name,depth,level,indexed) end elseif t == "function" then if functions then - --~ handle(format('%s %s=loadstring(%q),',depth,key(k),dump(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=loadstring(%q),",depth,k,dump(v))) else handle(format("%s [%s]=loadstring(%q),",depth,k,dump(v))) end + elseif tk == "boolean" then + handle(format("%s [%s]=loadstring(%q),",depth,tostring(k),dump(v))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=loadstring(%q),",depth,k,dump(v))) else - handle(format("%s [%q]=loadstring(%q),",depth,k,dump(v))) + -- handle(format("%s [%q]=loadstring(%q),",depth,k,dump(v))) + handle(format("%s [%q]=loadstring(%q),",depth,k,debug.getinfo(v).what == "C" and "C code" or dump(v))) end end else - --~ handle(format("%s %s=%q,",depth,key(k),tostring(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%q,",depth,k,tostring(v))) else handle(format("%s [%s]=%q,",depth,k,tostring(v))) end + elseif tk == "boolean" then -- or find(k,"^%d+$") then + handle(format("%s [%s]=%q,",depth,tostring(k),tostring(v))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%q,",depth,k,tostring(v))) else handle(format("%s [%q]=%q,",depth,k,tostring(v))) end end - --~ end - end + end end if level > 0 then handle(format("%s},",depth)) @@ -1087,15 +1254,34 @@ end -- replacing handle by a direct t[#t+1] = ... (plus test) is not much -- faster (0.03 on 1.00 for zapfino.tma) -local function serialize(root,name,_handle,_reduce,_noquotes,_hexify) - noquotes = _noquotes - hexify = _hexify - handle = _handle or print - reduce = _reduce or false - compact = table.serialize_compact - inline = compact and table.serialize_inline - functions = table.serialize_functions +local function serialize(_handle,root,name,specification) -- handle wins local tname = type(name) + if type(specification) == "table" then + noquotes = specification.noquotes + hexify = specification.hexify + handle = _handle or specification.handle or print + reduce = specification.reduce or false + functions = specification.functions + compact = specification.compact + inline = specification.inline and compact + if functions == nil then + functions = true + end + if compact == nil then + compact = true + end + if inline == nil then + inline = compact + end + else + noquotes = false + hexify = false + handle = _handle or print + reduce = false + compact = true + inline = true + functions = true + end if tname == "string" then if name == "return" then handle("return {") @@ -1117,33 +1303,33 @@ local function serialize(root,name,_handle,_reduce,_noquotes,_hexify) else handle("t={") end - if root and next(root) then - do_serialize(root,name,"",0,indexed) + if root then + -- The dummy access will initialize a table that has a delayed initialization + -- using a metatable. (maybe explicitly test for metatable) + if getmetatable(root) then -- todo: make this an option, maybe even per subtable + local dummy = root._w_h_a_t_e_v_e_r_ + root._w_h_a_t_e_v_e_r_ = nil + end + -- Let's forget about empty tables. + if next(root) then + do_serialize(root,name,"",0) + end end handle("}") end ---~ name: ---~ ---~ true : return { } ---~ false : { } ---~ nil : t = { } ---~ string : string = { } ---~ 'return' : return { } ---~ number : [number] = { } -function table.serialize(root,name,reduce,noquotes,hexify) - local t = { } +function table.serialize(root,name,specification) + local t, n = { }, 0 local function flush(s) - t[#t+1] = s + n = n + 1 + t[n] = s end - serialize(root,name,flush,reduce,noquotes,hexify) + serialize(flush,root,name,specification) return concat(t,"\n") end -function table.tohandle(handle,root,name,reduce,noquotes,hexify) - serialize(root,name,handle,reduce,noquotes,hexify) -end +table.tohandle = serialize -- sometimes tables are real use (zapfino extra pro is some 85M) in which -- case a stepwise serialization is nice; actually, we could consider: @@ -1154,73 +1340,63 @@ end -- -- so this is on the todo list -table.tofile_maxtab = 2*1024 +local maxtab = 2*1024 -function table.tofile(filename,root,name,reduce,noquotes,hexify) +function table.tofile(filename,root,name,specification) local f = io.open(filename,'w') if f then - local maxtab = table.tofile_maxtab if maxtab > 1 then - local t = { } + local t, n = { }, 0 local function flush(s) - t[#t+1] = s - if #t > maxtab then + n = n + 1 + t[n] = s + if n > maxtab then f:write(concat(t,"\n"),"\n") -- hm, write(sometable) should be nice - t = { } + t, n = { }, 0 -- we could recycle t if needed end end - serialize(root,name,flush,reduce,noquotes,hexify) + serialize(flush,root,name,specification) f:write(concat(t,"\n"),"\n") else local function flush(s) f:write(s,"\n") end - serialize(root,name,flush,reduce,noquotes,hexify) + serialize(flush,root,name,specification) end f:close() + io.flush() end end -local function flatten(t,f,complete) -- is this used? meybe a variant with next, ... - for i=1,#t do - local v = t[i] - if type(v) == "table" then - if complete or type(v[1]) == "table" then - flatten(v,f,complete) +local function flattened(t,f,depth) + if f == nil then + f = { } + depth = 0xFFFF + elseif tonumber(f) then + -- assume then only two arguments are given + depth = f + f = { } + elseif not depth then + depth = 0xFFFF + end + for k, v in next, t do + if type(k) ~= "number" then + if depth > 0 and type(v) == "table" then + flattened(v,f,depth-1) else - f[#f+1] = v + f[k] = v end - else - f[#f+1] = v end end -end - -function table.flatten(t) - local f = { } - flatten(t,f,true) - return f -end - -function table.unnest(t) -- bad name - local f = { } - flatten(t,f,false) - return f -end - -table.flatten_one_level = table.unnest - --- a better one: - -local function flattened(t,f) - if not f then - f = { } - end - for k, v in next, t do - if type(v) == "table" then - flattened(v,f) + local n = #f + for k=1,#t do + local v = t[k] + if depth > 0 and type(v) == "table" then + flattened(v,f,depth-1) + n = #f else - f[k] = v + n = n + 1 + f[n] = v end end return f @@ -1228,49 +1404,27 @@ end table.flattened = flattened --- the next three may disappear - -function table.remove_value(t,value) -- todo: n - if value then - for i=1,#t do - if t[i] == value then - remove(t,i) - -- remove all, so no: return - end - end +local function unnest(t,f) -- only used in mk, for old times sake + if not f then -- and only relevant for token lists + f = { } end -end - -function table.insert_before_value(t,value,str) - if str then - if value then - for i=1,#t do - if t[i] == value then - insert(t,i,str) - return - end + for i=1,#t do + local v = t[i] + if type(v) == "table" then + if type(v[1]) == "table" then + unnest(v,f) + else + f[#f+1] = v end + else + f[#f+1] = v end - insert(t,1,str) - elseif value then - insert(t,1,value) end + return f end -function table.insert_after_value(t,value,str) - if str then - if value then - for i=1,#t do - if t[i] == value then - insert(t,i+1,str) - return - end - end - end - t[#t+1] = str - elseif value then - t[#t+1] = value - end +function table.unnest(t) -- bad name + return unnest(t) end local function are_equal(a,b,n,m) -- indexed @@ -1297,7 +1451,7 @@ end local function identical(a,b) -- assumes same structure for ka, va in next, a do - local vb = b[k] + local vb = b[ka] if va == vb then -- same elseif type(va) == "table" and type(vb) == "table" then @@ -1311,8 +1465,8 @@ local function identical(a,b) -- assumes same structure return true end -table.are_equal = are_equal table.identical = identical +table.are_equal = are_equal -- maybe also make a combined one @@ -1338,89 +1492,84 @@ function table.contains(t, v) end function table.count(t) - local n, e = 0, next(t) - while e do - n, e = n + 1, next(t,e) + local n = 0 + for k, v in next, t do + n = n + 1 end return n end -function table.swapped(t) - local s = { } +function table.swapped(t,s) -- hash + local n = { } + if s then + for k, v in next, s do + n[k] = v + end + end for k, v in next, t do - s[v] = k + n[v] = k end - return s + return n end ---~ function table.are_equal(a,b) ---~ return table.serialize(a) == table.serialize(b) ---~ end - -function table.clone(t,p) -- t is optional or nil or table - if not p then - t, p = { }, t or { } - elseif not t then - t = { } +function table.reversed(t) + if t then + local tt, tn = { }, #t + if tn > 0 then + local ttn = 0 + for i=tn,1,-1 do + ttn = ttn + 1 + tt[ttn] = t[i] + end + end + return tt end - setmetatable(t, { __index = function(_,key) return p[key] end }) -- why not __index = p ? - return t end -function table.hexed(t,seperator) - local tt = { } - for i=1,#t do tt[i] = format("0x%04X",t[i]) end - return concat(tt,seperator or " ") -end - -function table.reverse_hash(h) - local r = { } - for k,v in next, h do - r[v] = lower(gsub(k," ","")) +function table.sequenced(t,sep,simple) -- hash only + local s, n = { }, 0 + for k, v in sortedhash(t) do + if simple then + if v == true then + n = n + 1 + s[n] = k + elseif v and v~= "" then + n = n + 1 + s[n] = k .. "=" .. tostring(v) + end + else + n = n + 1 + s[n] = k .. "=" .. tostring(v) + end end - return r + return concat(s, sep or " | ") end -function table.reverse(t) - local tt = { } - if #t > 0 then - for i=#t,1,-1 do - tt[#tt+1] = t[i] - end +function table.print(t,...) + if type(t) ~= "table" then + print(tostring(t)) + else + table.tohandle(print,t,...) end - return tt end -function table.insert_before_value(t,value,extra) - for i=1,#t do - if t[i] == extra then - remove(t,i) - end - end - for i=1,#t do - if t[i] == value then - insert(t,i,extra) - return - end - end - insert(t,1,extra) +-- -- -- obsolete but we keep them for a while and might comment them later -- -- -- + +-- roughly: copy-loop : unpack : sub == 0.9 : 0.4 : 0.45 (so in critical apps, use unpack) + +function table.sub(t,i,j) + return { unpack(t,i,j) } end -function table.insert_after_value(t,value,extra) - for i=1,#t do - if t[i] == extra then - remove(t,i) - end - end - for i=1,#t do - if t[i] == value then - insert(t,i+1,extra) - return - end - end - insert(t,#t+1,extra) +-- slower than #t on indexed tables (#t only returns the size of the numerically indexed slice) + +function table.is_empty(t) + return not t or not next(t) end +function table.has_one_entry(t) + return t and not next(t,next(t)) +end end -- of closure @@ -1435,7 +1584,10 @@ if not modules then modules = { } end modules ['l-io'] = { license = "see context related readme files" } -local byte, find, gsub = string.byte, string.find, string.gsub +local io = io +local byte, find, gsub, format = string.byte, string.find, string.gsub, string.format +local concat = table.concat +local type = type if string.find(os.getenv("PATH"),";") then io.fileseparator, io.pathseparator = "\\", ";" @@ -1446,9 +1598,7 @@ end function io.loaddata(filename,textmode) local f = io.open(filename,(textmode and 'r') or 'rb') if f then - -- collectgarbage("step") -- sometimes makes a big difference in mem consumption local data = f:read('*all') - -- garbagecollector.check(data) f:close() return data else @@ -1460,13 +1610,14 @@ function io.savedata(filename,data,joiner) local f = io.open(filename,"wb") if f then if type(data) == "table" then - f:write(table.join(data,joiner or "")) + f:write(concat(data,joiner or "")) elseif type(data) == "function" then data(f) else f:write(data or "") end f:close() + io.flush() return true else return false @@ -1495,12 +1646,19 @@ function io.size(filename) end function io.noflines(f) - local n = 0 - for _ in f:lines() do - n = n + 1 + if type(f) == "string" then + local f = io.open(filename) + local n = f and io.noflines(f) or 0 + assert(f:close()) + return n + else + local n = 0 + for _ in f:lines() do + n = n + 1 + end + f:seek('set',0) + return n end - f:seek('set',0) - return n end local nextchar = { @@ -1526,8 +1684,6 @@ local nextchar = { function io.characters(f,n) if f then return nextchar[n or 1], f - else - return nil, nil end end @@ -1536,40 +1692,42 @@ local nextbyte = { local a, b, c, d = f:read(1,1,1,1) if d then return byte(a), byte(b), byte(c), byte(d) - else - return nil, nil, nil, nil + end + end, + [3] = function(f) + local a, b, c = f:read(1,1,1) + if b then + return byte(a), byte(b), byte(c) end end, [2] = function(f) local a, b = f:read(1,1) if b then return byte(a), byte(b) - else - return nil, nil end end, [1] = function (f) local a = f:read(1) if a then return byte(a) - else - return nil end end, [-2] = function (f) local a, b = f:read(1,1) if b then return byte(b), byte(a) - else - return nil, nil + end + end, + [-3] = function(f) + local a, b, c = f:read(1,1,1) + if b then + return byte(c), byte(b), byte(a) end end, [-4] = function(f) local a, b, c, d = f:read(1,1,1,1) if d then return byte(d), byte(c), byte(b), byte(a) - else - return nil, nil, nil, nil end end } @@ -1586,12 +1744,13 @@ function io.ask(question,default,options) while true do io.write(question) if options then - io.write(string.format(" [%s]",table.concat(options,"|"))) + io.write(format(" [%s]",concat(options,"|"))) end if default then - io.write(string.format(" [%s]",default)) + io.write(format(" [%s]",default)) end - io.write(string.format(" ")) + io.write(format(" ")) + io.flush() local answer = io.read() answer = gsub(answer,"^%s*(.*)%s*$","%1") if answer == "" and default then @@ -1615,6 +1774,63 @@ function io.ask(question,default,options) end end +local function readnumber(f,n,m) + if m then + f:seek("set",n) + n = m + end + if n == 1 then + return byte(f:read(1)) + elseif n == 2 then + local a, b = byte(f:read(2),1,2) + return 256 * a + b + elseif n == 3 then + local a, b, c = byte(f:read(3),1,3) + return 256*256 * a + 256 * b + c + elseif n == 4 then + local a, b, c, d = byte(f:read(4),1,4) + return 256*256*256 * a + 256*256 * b + 256 * c + d + elseif n == 8 then + local a, b = readnumber(f,4), readnumber(f,4) + return 256 * a + b + elseif n == 12 then + local a, b, c = readnumber(f,4), readnumber(f,4), readnumber(f,4) + return 256*256 * a + 256 * b + c + elseif n == -2 then + local b, a = byte(f:read(2),1,2) + return 256*a + b + elseif n == -3 then + local c, b, a = byte(f:read(3),1,3) + return 256*256 * a + 256 * b + c + elseif n == -4 then + local d, c, b, a = byte(f:read(4),1,4) + return 256*256*256 * a + 256*256 * b + 256*c + d + elseif n == -8 then + local h, g, f, e, d, c, b, a = byte(f:read(8),1,8) + return 256*256*256*256*256*256*256 * a + + 256*256*256*256*256*256 * b + + 256*256*256*256*256 * c + + 256*256*256*256 * d + + 256*256*256 * e + + 256*256 * f + + 256 * g + + h + else + return 0 + end +end + +io.readnumber = readnumber + +function io.readstring(f,n,m) + if m then + f:seek("set",n) + n = m + end + local str = gsub(f:read(n),"%z","") + return str +end + end -- of closure @@ -1628,11 +1844,15 @@ if not modules then modules = { } end modules ['l-number'] = { license = "see context related readme files" } +-- this module will be replaced when we have the bit library + local tostring = tostring -local format, floor, insert, match = string.format, math.floor, table.insert, string.match +local format, floor, match, rep = string.format, math.floor, string.match, string.rep +local concat, insert = table.concat, table.insert local lpegmatch = lpeg.match -number = number or { } +number = number or { } +local number = number -- a,b,c,d,e,f = number.toset(100101) @@ -1680,6 +1900,54 @@ function number.bits(n,zero) end +function number.bit(p) + return 2 ^ (p - 1) -- 1-based indexing +end + +function number.hasbit(x, p) -- typical call: if hasbit(x, bit(3)) then ... + return x % (p + p) >= p +end + +function number.setbit(x, p) + return hasbit(x, p) and x or x + p +end + +function number.clearbit(x, p) + return hasbit(x, p) and x - p or x +end + + +function number.tobitstring(n,m) + if n == 0 then + if m then + rep("00000000",m) + else + return "00000000" + end + else + local t = { } + while n > 0 do + insert(t,1,n % 2 > 0 and 1 or 0) + n = floor(n/2) + end + local nn = 8 - #t % 8 + if nn > 0 and nn < 8 then + for i=1,nn do + insert(t,1,0) + end + end + if m then + m = m * 8 - #t + if m > 0 then + insert(t,1,rep("0",m)) + end + end + return concat(t) + end +end + + + end -- of closure do -- create closure to overcome 200 locals limit @@ -1692,6 +1960,8 @@ if not modules then modules = { } end modules ['l-set'] = { license = "see context related readme files" } +-- This will become obsolete when we have the bitset library embedded. + set = set or { } local nums = { } @@ -1735,10 +2005,11 @@ function set.tolist(n) if n == 0 or not tabs[n] then return "" else - local t = { } + local t, n = { }, 0 for k, v in next, tabs[n] do if v then - t[#t+1] = k + n = n + 1 + t[n] = k end end return concat(t," ") @@ -1756,17 +2027,6 @@ function set.contains(n,s) end end ---~ local c = set.create{'aap','noot','mies'} ---~ local s = set.tonumber(c) ---~ local t = set.totable(s) ---~ print(t['aap']) ---~ local c = set.create{'zus','wim','jet'} ---~ local s = set.tonumber(c) ---~ local t = set.totable(s) ---~ print(t['aap']) ---~ print(t['jet']) ---~ print(set.contains(t,'jet')) ---~ print(set.contains(t,'aap')) @@ -1782,32 +2042,119 @@ if not modules then modules = { } end modules ['l-os'] = { license = "see context related readme files" } +-- This file deals with some operating system issues. Please don't bother me +-- with the pros and cons of operating systems as they all have their flaws +-- and benefits. Bashing one of them won't help solving problems and fixing +-- bugs faster and is a waste of time and energy. +-- +-- path separators: / or \ ... we can use / everywhere +-- suffixes : dll so exe ... no big deal +-- quotes : we can use "" in most cases +-- expansion : unless "" are used * might give side effects +-- piping/threads : somewhat different for each os +-- locations : specific user file locations and settings can change over time +-- +-- os.type : windows | unix (new, we already guessed os.platform) +-- os.name : windows | msdos | linux | macosx | solaris | .. | generic (new) +-- os.platform : extended os.name with architecture + -- maybe build io.flush in os.execute -local find, format, gsub = string.find, string.format, string.gsub +local os = os +local find, format, gsub, upper = string.find, string.format, string.gsub, string.upper +local concat = table.concat local random, ceil = math.random, math.ceil +local rawget, rawset, type, getmetatable, setmetatable, tonumber = rawget, rawset, type, getmetatable, setmetatable, tonumber + +-- The following code permits traversing the environment table, at least +-- in luatex. Internally all environment names are uppercase. + +if not os.__getenv__ then + + os.__getenv__ = os.getenv + os.__setenv__ = os.setenv + + if os.env then + + local osgetenv = os.getenv + local ossetenv = os.setenv + local osenv = os.env local _ = osenv.PATH -- initialize the table + + function os.setenv(k,v) + if v == nil then + v = "" + end + local K = upper(k) + osenv[K] = v + if type(v) == "table" then + v = concat(v,";") -- path + end + ossetenv(K,v) + end + + function os.getenv(k) + local K = upper(k) + local v = osenv[K] or osenv[k] or osgetenv(K) or osgetenv(k) + if v == "" then + return nil + else + return v + end + end + + else + + local ossetenv = os.setenv + local osgetenv = os.getenv + local osenv = { } + + function os.setenv(k,v) + if v == nil then + v = "" + end + local K = upper(k) + osenv[K] = v + end + + function os.getenv(k) + local K = upper(k) + local v = osenv[K] or osgetenv(K) or osgetenv(k) + if v == "" then + return nil + else + return v + end + end + + local function __index(t,k) + return os.getenv(k) + end + local function __newindex(t,k,v) + os.setenv(k,v) + end + + os.env = { } + + setmetatable(os.env, { __index = __index, __newindex = __newindex } ) + + end + +end + +-- end of environment hack -local execute, spawn, exec, ioflush = os.execute, os.spawn or os.execute, os.exec or os.execute, io.flush +local execute, spawn, exec, iopopen, ioflush = os.execute, os.spawn or os.execute, os.exec or os.execute, io.popen, io.flush function os.execute(...) ioflush() return execute(...) end function os.spawn (...) ioflush() return spawn (...) end function os.exec (...) ioflush() return exec (...) end +function io.popen (...) ioflush() return iopopen(...) end function os.resultof(command) - ioflush() -- else messed up logging local handle = io.popen(command,"r") - if not handle then - -- print("unknown command '".. command .. "' in os.resultof") - return "" - else - return handle:read("*all") or "" - end + return handle and handle:read("*all") or "" end ---~ os.type : windows | unix (new, we already guessed os.platform) ---~ os.name : windows | msdos | linux | macosx | solaris | .. | generic (new) ---~ os.platform : extended os.name with architecture - if not io.fileseparator then if find(os.getenv("PATH"),";") then io.fileseparator, io.pathseparator, os.type = "\\", ";", os.type or "mswin" @@ -1856,16 +2203,11 @@ function os.runtime() return os.gettimeofday() - startuptime end ---~ print(os.gettimeofday()-os.time()) ---~ os.sleep(1.234) ---~ print (">>",os.runtime()) ---~ print(os.date("%H:%M:%S",os.gettimeofday())) ---~ print(os.date("%H:%M:%S",os.time())) -- no need for function anymore as we have more clever code and helpers now -- this metatable trickery might as well disappear -os.resolvers = os.resolvers or { } +os.resolvers = os.resolvers or { } -- will become private local resolvers = os.resolvers @@ -1878,24 +2220,6 @@ end setmetatable(os,osmt) -if not os.setenv then - - -- we still store them but they won't be seen in - -- child processes although we might pass them some day - -- using command concatination - - local env, getenv = { }, os.getenv - - function os.setenv(k,v) - env[k] = v - end - - function os.getenv(k) - return env[k] or getenv(k) - end - -end - -- we can use HOSTTYPE on some platforms local name, platform = os.name or "linux", os.getenv("MTX_PLATFORM") or "" @@ -1935,7 +2259,7 @@ elseif os.type == "windows" then elseif name == "linux" then function os.resolvers.platform(t,k) - -- we sometims have HOSTTYPE set so let's check that first + -- we sometimes have HOSTTYPE set so let's check that first local platform, architecture = "", os.getenv("HOSTTYPE") or os.resultof("uname -m") or "" if find(architecture,"x86_64") then platform = "linux-64" @@ -2013,10 +2337,10 @@ elseif name == "freebsd" then elseif name == "kfreebsd" then function os.resolvers.platform(t,k) - -- we sometims have HOSTTYPE set so let's check that first + -- we sometimes have HOSTTYPE set so let's check that first local platform, architecture = "", os.getenv("HOSTTYPE") or os.resultof("uname -m") or "" if find(architecture,"x86_64") then - platform = "kfreebsd-64" + platform = "kfreebsd-amd64" else platform = "kfreebsd-i386" end @@ -2091,61 +2415,86 @@ if not modules then modules = { } end modules ['l-file'] = { -- needs a cleanup -file = file or { } +file = file or { } +local file = file -local concat = table.concat -local find, gmatch, match, gsub, sub, char = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char +local insert, concat = table.insert, table.concat +local find, gmatch, match, gsub, sub, char, lower = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char, string.lower local lpegmatch = lpeg.match +local getcurrentdir, attributes = lfs.currentdir, lfs.attributes -function file.removesuffix(filename) - return (gsub(filename,"%.[%a%d]+$","")) +local P, R, S, C, Cs, Cp, Cc = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc + +local function dirname(name,default) + return match(name,"^(.+)[/\\].-$") or (default or "") end -function file.addsuffix(filename, suffix) - if not suffix or suffix == "" then - return filename - elseif not find(filename,"%.[%a%d]+$") then - return filename .. "." .. suffix - else - return filename - end +local function basename(name) + return match(name,"^.+[/\\](.-)$") or name end -function file.replacesuffix(filename, suffix) - return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix +local function nameonly(name) + return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) end -function file.dirname(name,default) - return match(name,"^(.+)[/\\].-$") or (default or "") +local function extname(name,default) + return match(name,"^.+%.([^/\\]-)$") or default or "" end -function file.basename(name) - return match(name,"^.+[/\\](.-)$") or name +local function splitname(name) + local n, s = match(name,"^(.+)%.([^/\\]-)$") + return n or name, s or "" end -function file.nameonly(name) - return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) +file.basename = basename +file.dirname = dirname +file.nameonly = nameonly +file.extname = extname +file.suffix = extname + +function file.removesuffix(filename) + return (gsub(filename,"%.[%a%d]+$","")) end -function file.extname(name,default) - return match(name,"^.+%.([^/\\]-)$") or default or "" +function file.addsuffix(filename, suffix, criterium) + if not suffix or suffix == "" then + return filename + elseif criterium == true then + return filename .. "." .. suffix + elseif not criterium then + local n, s = splitname(filename) + if not s or s == "" then + return filename .. "." .. suffix + else + return filename + end + else + local n, s = splitname(filename) + if s and s ~= "" then + local t = type(criterium) + if t == "table" then + -- keep if in criterium + for i=1,#criterium do + if s == criterium[i] then + return filename + end + end + elseif t == "string" then + -- keep if criterium + if s == criterium then + return filename + end + end + end + return n .. "." .. suffix + end end -file.suffix = file.extname ---~ function file.join(...) ---~ local pth = concat({...},"/") ---~ pth = gsub(pth,"\\","/") ---~ local a, b = match(pth,"^(.*://)(.*)$") ---~ if a and b then ---~ return a .. gsub(b,"//+","/") ---~ end ---~ a, b = match(pth,"^(//)(.*)$") ---~ if a and b then ---~ return a .. gsub(b,"//+","/") ---~ end ---~ return (gsub(pth,"//+","/")) ---~ end +function file.replacesuffix(filename, suffix) + return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix +end + local trick_1 = char(1) local trick_2 = "^" .. trick_1 .. "/+" @@ -2173,60 +2522,37 @@ function file.join(...) return (gsub(pth,"//+","/")) end ---~ print(file.join("//","/y")) ---~ print(file.join("/","/y")) ---~ print(file.join("","/y")) ---~ print(file.join("/x/","/y")) ---~ print(file.join("x/","/y")) ---~ print(file.join("http://","/y")) ---~ print(file.join("http://a","/y")) ---~ print(file.join("http:///a","/y")) ---~ print(file.join("//nas-1","/y")) -function file.iswritable(name) - local a = lfs.attributes(name) or lfs.attributes(file.dirname(name,".")) +function file.is_writable(name) + local a = attributes(name) or attributes(dirname(name,".")) return a and sub(a.permissions,2,2) == "w" end -function file.isreadable(name) - local a = lfs.attributes(name) +function file.is_readable(name) + local a = attributes(name) return a and sub(a.permissions,1,1) == "r" end -file.is_readable = file.isreadable -file.is_writable = file.iswritable +file.isreadable = file.is_readable -- depricated +file.iswritable = file.is_writable -- depricated --- todo: lpeg - ---~ function file.split_path(str) ---~ local t = { } ---~ str = gsub(str,"\\", "/") ---~ str = gsub(str,"(%a):([;/])", "%1\001%2") ---~ for name in gmatch(str,"([^;:]+)") do ---~ if name ~= "" then ---~ t[#t+1] = gsub(name,"\001",":") ---~ end ---~ end ---~ return t ---~ end +-- todo: lpeg \\ / .. does not save much local checkedsplit = string.checkedsplit -function file.split_path(str,separator) +function file.splitpath(str,separator) -- string str = gsub(str,"\\","/") return checkedsplit(str,separator or io.pathseparator) end -function file.join_path(tab) - return concat(tab,io.pathseparator) -- can have trailing // +function file.joinpath(tab,separator) -- table + return concat(tab,separator or io.pathseparator) -- can have trailing // end -- we can hash them weakly -local insert = table.insert - -function file.collapse_path(str,anchor) +function file.collapsepath(str,anchor) if anchor and not find(str,"^/") and not find(str,"^%a:") then str = getcurrentdir() .. "/" .. str end @@ -2280,62 +2606,15 @@ function file.collapse_path(str,anchor) return concat(newelements, '/') end end -function file.xcollapse_path(str) - print('collapse', str) - if str == "" or str =="." then - return "." - elseif find(str,"^%.%.") then - return str - elseif not find(str,"%.") then - return str - end - str = gsub(str,"^%./",lfs.currentdir() .. "/") -- ./xx in qualified - str = gsub(str,"\\","/") - local oldelements = checkedsplit(str,"/") - local newelements = { } - local i = #oldelements - while i > 0 do - local element = oldelements[i] - if element == '.' then - -- do nothing - elseif element == '..' then - local n = i -1 - while n > 0 do - local element = oldelements[n] - if element ~= '..' and element ~= '.' then - oldelements[n] = '.' - break - else - n = n - 1 - end - end - if n<1 then - insert(newelements,1,'..') - end - elseif element ~= "" then - insert(newelements,1,element) - end - i = i - 1 - end - if #newelements == 0 then - return "." - elseif find(str,"^/") then - return "/" .. concat(newelements,'/') - else - return concat(newelements, '/') - end -end ---~ print(file.collapse_path("/a")) ---~ print(file.collapse_path("a/./b/..")) ---~ print(file.collapse_path("a/aa/../b/bb")) ---~ print(file.collapse_path("a/../..")) ---~ print(file.collapse_path("a/.././././b/..")) ---~ print(file.collapse_path("a/./././b/..")) ---~ print(file.collapse_path("a/b/c/../..")) -function file.robustname(str) - return (gsub(str,"[^%a%d%/%-%.\\]+","-")) +function file.robustname(str,strict) + str = gsub(str,"[^%a%d%/%-%.\\]+","-") + if strict then + return lower(gsub(str,"^%-*(.-)%-*$","%1")) + else + return str + end end file.readdata = io.loaddata @@ -2347,100 +2626,34 @@ end -- lpeg variants, slightly faster, not always ---~ local period = lpeg.P(".") ---~ local slashes = lpeg.S("\\/") ---~ local noperiod = 1-period ---~ local noslashes = 1-slashes ---~ local name = noperiod^1 - ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.C(noperiod^1) * -1 - ---~ function file.extname(name) ---~ return lpegmatch(pattern,name) or "" ---~ end - ---~ local pattern = lpeg.Cs(((period * noperiod^1 * -1)/"" + 1)^1) - ---~ function file.removesuffix(name) ---~ return lpegmatch(pattern,name) ---~ end - ---~ local pattern = (noslashes^0 * slashes)^1 * lpeg.C(noslashes^1) * -1 - ---~ function file.basename(name) ---~ return lpegmatch(pattern,name) or name ---~ end - ---~ local pattern = (noslashes^0 * slashes)^1 * lpeg.Cp() * noslashes^1 * -1 - ---~ function file.dirname(name) ---~ local p = lpegmatch(pattern,name) ---~ if p then ---~ return sub(name,1,p-2) ---~ else ---~ return "" ---~ end ---~ end - ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.Cp() * noperiod^1 * -1 - ---~ function file.addsuffix(name, suffix) ---~ local p = lpegmatch(pattern,name) ---~ if p then ---~ return name ---~ else ---~ return name .. "." .. suffix ---~ end ---~ end - ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.Cp() * noperiod^1 * -1 - ---~ function file.replacesuffix(name,suffix) ---~ local p = lpegmatch(pattern,name) ---~ if p then ---~ return sub(name,1,p-2) .. "." .. suffix ---~ else ---~ return name .. "." .. suffix ---~ end ---~ end - ---~ local pattern = (noslashes^0 * slashes)^0 * lpeg.Cp() * ((noperiod^1 * period)^1 * lpeg.Cp() + lpeg.P(true)) * noperiod^1 * -1 - ---~ function file.nameonly(name) ---~ local a, b = lpegmatch(pattern,name) ---~ if b then ---~ return sub(name,a,b-2) ---~ elseif a then ---~ return sub(name,a) ---~ else ---~ return name ---~ end ---~ end - ---~ local test = file.extname ---~ local test = file.basename ---~ local test = file.dirname ---~ local test = file.addsuffix ---~ local test = file.replacesuffix ---~ local test = file.nameonly - ---~ print(1,test("./a/b/c/abd.def.xxx","!!!")) ---~ print(2,test("./../b/c/abd.def.xxx","!!!")) ---~ print(3,test("a/b/c/abd.def.xxx","!!!")) ---~ print(4,test("a/b/c/def.xxx","!!!")) ---~ print(5,test("a/b/c/def","!!!")) ---~ print(6,test("def","!!!")) ---~ print(7,test("def.xxx","!!!")) - ---~ local tim = os.clock() for i=1,250000 do local ext = test("abd.def.xxx","!!!") end print(os.clock()-tim) + + + + + + + + + + + + + + + + + -- also rewrite previous -local letter = lpeg.R("az","AZ") + lpeg.S("_-+") -local separator = lpeg.P("://") +local letter = R("az","AZ") + S("_-+") +local separator = P("://") + +local qualified = P(".")^0 * P("/") + letter*P(":") + letter^1*separator + letter^1 * P("/") +local rootbased = P("/") + letter*P(":") -local qualified = lpeg.P(".")^0 * lpeg.P("/") + letter*lpeg.P(":") + letter^1*separator + letter^1 * lpeg.P("/") -local rootbased = lpeg.P("/") + letter*lpeg.P(":") +lpeg.patterns.qualified = qualified +lpeg.patterns.rootbased = rootbased -- ./name ../name /name c: :// name/name @@ -2452,14 +2665,16 @@ function file.is_rootbased_path(filename) return lpegmatch(rootbased,filename) ~= nil end -local slash = lpeg.S("\\/") -local period = lpeg.P(".") -local drive = lpeg.C(lpeg.R("az","AZ")) * lpeg.P(":") -local path = lpeg.C(((1-slash)^0 * slash)^0) -local suffix = period * lpeg.C(lpeg.P(1-period)^0 * lpeg.P(-1)) -local base = lpeg.C((1-suffix)^0) +-- actually these are schemes -local pattern = (drive + lpeg.Cc("")) * (path + lpeg.Cc("")) * (base + lpeg.Cc("")) * (suffix + lpeg.Cc("")) +local slash = S("\\/") +local period = P(".") +local drive = C(R("az","AZ")) * P(":") +local path = C(((1-slash)^0 * slash)^0) +local suffix = period * C(P(1-period)^0 * P(-1)) +local base = C((1-suffix)^0) + +local pattern = (drive + Cc("")) * (path + Cc("")) * (base + Cc("")) * (suffix + Cc("")) function file.splitname(str) -- returns drive, path, base, suffix return lpegmatch(pattern,str) @@ -2472,14 +2687,13 @@ end -- test { "/aa", "/aa/bb", "/aa/bb/cc", "/aa/bb/cc.dd", "/aa/bb/cc.dd.ee" } -- test { "aa", "aa/bb", "aa/bb/cc", "aa/bb/cc.dd", "aa/bb/cc.dd.ee" } ---~ -- todo: ---~ ---~ if os.type == "windows" then ---~ local currentdir = lfs.currentdir ---~ function lfs.currentdir() ---~ return (gsub(currentdir(),"\\","/")) ---~ end ---~ end + +-- for myself: + +function file.strip(name,dir) + local b, a = match(name,"^(.-)" .. dir .. "(.*)$") + return a ~= "" and a or name +end end -- of closure @@ -2495,6 +2709,7 @@ if not modules then modules = { } end modules ['l-md5'] = { -- This also provides file checksums and checkers. +local md5, file = md5, file local gsub, format, byte = string.gsub, string.format, string.byte local function convert(str,fmt) @@ -2505,27 +2720,13 @@ if not md5.HEX then function md5.HEX(str) return convert(str,"%02X") end end if not md5.hex then function md5.hex(str) return convert(str,"%02x") end end if not md5.dec then function md5.dec(str) return convert(str,"%03i") end end ---~ if not md5.HEX then ---~ local function remap(chr) return format("%02X",byte(chr)) end ---~ function md5.HEX(str) return (gsub(md5.sum(str),".",remap)) end ---~ end ---~ if not md5.hex then ---~ local function remap(chr) return format("%02x",byte(chr)) end ---~ function md5.hex(str) return (gsub(md5.sum(str),".",remap)) end ---~ end ---~ if not md5.dec then ---~ local function remap(chr) return format("%03i",byte(chr)) end ---~ function md5.dec(str) return (gsub(md5.sum(str),".",remap)) end ---~ end - -file.needs_updating_threshold = 1 - -function file.needs_updating(oldname,newname) -- size modification access change + +function file.needs_updating(oldname,newname,threshold) -- size modification access change local oldtime = lfs.attributes(oldname, modification) local newtime = lfs.attributes(newname, modification) if newtime >= oldtime then return false - elseif oldtime - newtime < file.needs_updating_threshold then + elseif oldtime - newtime < (threshold or 1) then return false else return true @@ -2572,86 +2773,171 @@ if not modules then modules = { } end modules ['l-url'] = { license = "see context related readme files" } -local char, gmatch, gsub = string.char, string.gmatch, string.gsub +local char, gmatch, gsub, format, byte, find = string.char, string.gmatch, string.gsub, string.format, string.byte, string.find +local concat = table.concat local tonumber, type = tonumber, type -local lpegmatch = lpeg.match +local P, C, R, S, Cs, Cc, Ct = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cs, lpeg.Cc, lpeg.Ct +local lpegmatch, lpegpatterns, replacer = lpeg.match, lpeg.patterns, lpeg.replacer --- from the spec (on the web): +-- from wikipedia: -- --- foo://example.com:8042/over/there?name=ferret#nose --- \_/ \______________/\_________/ \_________/ \__/ --- | | | | | --- scheme authority path query fragment --- | _____________________|__ --- / \ / \ --- urn:example:animal:ferret:nose +-- foo://username:password@example.com:8042/over/there/index.dtb?type=animal;name=narwhal#nose +-- \_/ \_______________/ \_________/ \__/ \___/ \_/ \______________________/ \__/ +-- | | | | | | | | +-- | userinfo hostname port | | query fragment +-- | \________________________________/\_____________|____|/ +-- scheme | | | | +-- | authority path | | +-- | | | +-- | path interpretable as filename +-- | ___________|____________ | +-- / \ / \ | +-- urn:example:animal:ferret:nose interpretable as extension + +url = url or { } +local url = url + +local tochar = function(s) return char(tonumber(s,16)) end + +local colon = P(":") +local qmark = P("?") +local hash = P("#") +local slash = P("/") +local percent = P("%") +local endofstring = P(-1) + +local hexdigit = R("09","AF","af") +local plus = P("+") +local nothing = Cc("") +local escaped = (plus / " ") + (percent * C(hexdigit * hexdigit) / tochar) -url = url or { } +-- we assume schemes with more than 1 character (in order to avoid problems with windows disks) -local function tochar(s) - return char(tonumber(s,16)) -end +local scheme = Cs((escaped+(1-colon-slash-qmark-hash))^2) * colon + nothing +local authority = slash * slash * Cs((escaped+(1- slash-qmark-hash))^0) + nothing +local path = slash * Cs((escaped+(1- qmark-hash))^0) + nothing +local query = qmark * Cs((escaped+(1- hash))^0) + nothing +local fragment = hash * Cs((escaped+(1- endofstring))^0) + nothing -local colon, qmark, hash, slash, percent, endofstring = lpeg.P(":"), lpeg.P("?"), lpeg.P("#"), lpeg.P("/"), lpeg.P("%"), lpeg.P(-1) +local validurl = scheme * authority * path * query * fragment +local parser = Ct(validurl) -local hexdigit = lpeg.R("09","AF","af") -local plus = lpeg.P("+") -local escaped = (plus / " ") + (percent * lpeg.C(hexdigit * hexdigit) / tochar) +lpegpatterns.url = validurl +lpegpatterns.urlsplitter = parser --- we assume schemes with more than 1 character (in order to avoid problems with windows disks) +local escapes = { } ; for i=0,255 do escapes[i] = format("%%%02X",i) end -local scheme = lpeg.Cs((escaped+(1-colon-slash-qmark-hash))^2) * colon + lpeg.Cc("") -local authority = slash * slash * lpeg.Cs((escaped+(1- slash-qmark-hash))^0) + lpeg.Cc("") -local path = slash * lpeg.Cs((escaped+(1- qmark-hash))^0) + lpeg.Cc("") -local query = qmark * lpeg.Cs((escaped+(1- hash))^0) + lpeg.Cc("") -local fragment = hash * lpeg.Cs((escaped+(1- endofstring))^0) + lpeg.Cc("") +local escaper = Cs((R("09","AZ","az") + S("-./_") + P(1) / escapes)^0) -local parser = lpeg.Ct(scheme * authority * path * query * fragment) +lpegpatterns.urlescaper = escaper -- todo: reconsider Ct as we can as well have five return values (saves a table) -- so we can have two parsers, one with and one without -function url.split(str) +local function split(str) return (type(str) == "string" and lpegmatch(parser,str)) or str end +local function hasscheme(str) + local scheme = lpegmatch(scheme,str) -- at least one character + return scheme and scheme ~= "" +end + -- todo: cache them -function url.hashed(str) - local s = url.split(str) +local rootletter = R("az","AZ") + + S("_-+") +local separator = P("://") +local qualified = P(".")^0 * P("/") + + rootletter * P(":") + + rootletter^1 * separator + + rootletter^1 * P("/") +local rootbased = P("/") + + rootletter * P(":") + +local barswapper = replacer("|",":") +local backslashswapper = replacer("\\","/") + +local function hashed(str) -- not yet ok (/test?test) + local s = split(str) local somescheme = s[1] ~= "" - return { - scheme = (somescheme and s[1]) or "file", - authority = s[2], - path = s[3], - query = s[4], - fragment = s[5], - original = str, - noscheme = not somescheme, - } + local somequery = s[4] ~= "" + if not somescheme and not somequery then + s = { + scheme = "file", + authority = "", + path = str, + query = "", + fragment = "", + original = str, + noscheme = true, + filename = str, + } + else -- not always a filename but handy anyway + local authority, path, filename = s[2], s[3] + if authority == "" then + filename = path + else + filename = authority .. "/" .. path + end + s = { + scheme = s[1], + authority = authority, + path = path, + query = s[4], + fragment = s[5], + original = str, + noscheme = false, + filename = filename, + } + end + return s end -function url.hasscheme(str) - return url.split(str)[1] ~= "" -end +-- Here we assume: +-- +-- files: /// = relative +-- files: //// = absolute (!) + -function url.addscheme(str,scheme) - return (url.hasscheme(str) and str) or ((scheme or "file:///") .. str) + +url.split = split +url.hasscheme = hasscheme +url.hashed = hashed + +function url.addscheme(str,scheme) -- no authority + if hasscheme(str) then + return str + elseif not scheme then + return "file:///" .. str + else + return scheme .. ":///" .. str + end end -function url.construct(hash) - local fullurl = hash.sheme .. "://".. hash.authority .. hash.path - if hash.query then - fullurl = fullurl .. "?".. hash.query +function url.construct(hash) -- dodo: we need to escape ! + local fullurl, f = { }, 0 + local scheme, authority, path, query, fragment = hash.scheme, hash.authority, hash.path, hash.query, hash.fragment + if scheme and scheme ~= "" then + f = f + 1 ; fullurl[f] = scheme .. "://" + end + if authority and authority ~= "" then + f = f + 1 ; fullurl[f] = authority + end + if path and path ~= "" then + f = f + 1 ; fullurl[f] = "/" .. path + end + if query and query ~= "" then + f = f + 1 ; fullurl[f] = "?".. query end - if hash.fragment then - fullurl = fullurl .. "?".. hash.fragment + if fragment and fragment ~= "" then + f = f + 1 ; fullurl[f] = "#".. fragment end - return fullurl + return lpegmatch(escaper,concat(fullurl)) end function url.filename(filename) - local t = url.hashed(filename) + local t = hashed(filename) return (t.scheme == "file" and (gsub(t.path,"^/([a-zA-Z])([:|])/)","%1:"))) or filename end @@ -2667,37 +2953,13 @@ function url.query(str) end end ---~ print(url.filename("file:///c:/oeps.txt")) ---~ print(url.filename("c:/oeps.txt")) ---~ print(url.filename("file:///oeps.txt")) ---~ print(url.filename("file:///etc/test.txt")) ---~ print(url.filename("/oeps.txt")) - ---~ from the spec on the web (sort of): ---~ ---~ function test(str) ---~ print(table.serialize(url.hashed(str))) ---~ end ---~ ---~ test("%56pass%20words") ---~ test("file:///c:/oeps.txt") ---~ test("file:///c|/oeps.txt") ---~ test("file:///etc/oeps.txt") ---~ test("file://./etc/oeps.txt") ---~ test("file:////etc/oeps.txt") ---~ test("ftp://ftp.is.co.za/rfc/rfc1808.txt") ---~ test("http://www.ietf.org/rfc/rfc2396.txt") ---~ test("ldap://[2001:db8::7]/c=GB?objectClass?one#what") ---~ test("mailto:John.Doe@example.com") ---~ test("news:comp.infosystems.www.servers.unix") ---~ test("tel:+1-816-555-1212") ---~ test("telnet://192.0.2.16:80/") ---~ test("urn:oasis:names:specification:docbook:dtd:xml:4.1.2") ---~ test("/etc/passwords") ---~ test("http://www.pragma-ade.com/spaced%20name") - ---~ test("zip:///oeps/oeps.zip#bla/bla.tex") ---~ test("zip:///oeps/oeps.zip?bla/bla.tex") + + + + + + + end -- of closure @@ -2712,35 +2974,53 @@ if not modules then modules = { } end modules ['l-dir'] = { license = "see context related readme files" } --- dir.expand_name will be merged with cleanpath and collapsepath +-- dir.expandname will be merged with cleanpath and collapsepath local type = type local find, gmatch, match, gsub = string.find, string.gmatch, string.match, string.gsub +local concat, insert, remove = table.concat, table.insert, table.remove local lpegmatch = lpeg.match +local P, S, R, C, Cc, Cs, Ct, Cv, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cv, lpeg.V + dir = dir or { } +local dir = dir +local lfs = lfs + +local attributes = lfs.attributes +local walkdir = lfs.dir +local isdir = lfs.isdir +local isfile = lfs.isfile +local mkdir = lfs.mkdir +local chdir = lfs.chdir +local currentdir = lfs.currentdir -- handy function dir.current() - return (gsub(lfs.currentdir(),"\\","/")) + return (gsub(currentdir(),"\\","/")) end --- optimizing for no string.find (*) does not save time +-- optimizing for no find (*) does not save time -local attributes = lfs.attributes -local walkdir = lfs.dir -local function glob_pattern(path,patt,recurse,action) - local ok, scanner +local lfsisdir = isdir + +local function isdir(path) + path = gsub(path,"[/\\]+$","") + return lfsisdir(path) +end + +lfs.isdir = isdir + +local function globpattern(path,patt,recurse,action) if path == "/" then - ok, scanner = xpcall(function() return walkdir(path..".") end, function() end) -- kepler safe - else - ok, scanner = xpcall(function() return walkdir(path) end, function() end) -- kepler safe + path = path .. "." + elseif not find(path,"/$") then + path = path .. '/' end - if ok and type(scanner) == "function" then - if not find(path,"/$") then path = path .. '/' end - for name in scanner do + if isdir(path) then -- lfs.isdir does not like trailing / + for name in walkdir(path) do -- lfs.dir accepts trailing / local full = path .. name local mode = attributes(full,'mode') if mode == 'file' then @@ -2748,15 +3028,15 @@ local function glob_pattern(path,patt,recurse,action) action(full) end elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then - glob_pattern(full,patt,recurse,action) + globpattern(full,patt,recurse,action) end end end end -dir.glob_pattern = glob_pattern +dir.globpattern = globpattern -local function collect_pattern(path,patt,recurse,result) +local function collectpattern(path,patt,recurse,result) local ok, scanner result = result or { } if path == "/" then @@ -2775,7 +3055,7 @@ local function collect_pattern(path,patt,recurse,result) result[name] = attr end elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then - attr.list = collect_pattern(full,patt,recurse) + attr.list = collectpattern(full,patt,recurse) result[name] = attr end end @@ -2783,9 +3063,7 @@ local function collect_pattern(path,patt,recurse,result) return result end -dir.collect_pattern = collect_pattern - -local P, S, R, C, Cc, Cs, Ct, Cv, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cv, lpeg.V +dir.collectpattern = collectpattern local pattern = Ct { [1] = (C(P(".") + P("/")^1) + C(R("az","AZ") * P(":") * P("/")^0) + Cc("./")) * V(2) * V(3), @@ -2809,16 +3087,16 @@ local function glob(str,t) for s=1,#str do glob(str[s],t) end - elseif lfs.isfile(str) then + elseif isfile(str) then t(str) else - local split = lpegmatch(pattern,str) + local split = lpegmatch(pattern,str) -- we could use the file splitter if split then local root, path, base = split[1], split[2], split[3] local recurse = find(base,"%*%*") local start = root .. path local result = lpegmatch(filter,start .. base) - glob_pattern(start,result,recurse,t) + globpattern(start,result,recurse,t) end end else @@ -2828,12 +3106,15 @@ local function glob(str,t) glob(str[s],t) end return t - elseif lfs.isfile(str) then - local t = t or { } - t[#t+1] = str - return t + elseif isfile(str) then + if t then + t[#t+1] = str + return t + else + return { str } + end else - local split = lpegmatch(pattern,str) + local split = lpegmatch(pattern,str) -- we could use the file splitter if split then local t = t or { } local action = action or function(name) t[#t+1] = name end @@ -2841,7 +3122,7 @@ local function glob(str,t) local recurse = find(base,"%*%*") local start = root .. path local result = lpegmatch(filter,start .. base) - glob_pattern(start,result,recurse,action) + globpattern(start,result,recurse,action) return t else return { } @@ -2852,18 +3133,14 @@ end dir.glob = glob ---~ list = dir.glob("**/*.tif") ---~ list = dir.glob("/**/*.tif") ---~ list = dir.glob("./**/*.tif") ---~ list = dir.glob("oeps/**/*.tif") ---~ list = dir.glob("/oeps/**/*.tif") local function globfiles(path,recurse,func,files) -- func == pattern or function if type(func) == "string" then - local s = func -- alas, we need this indirect way + local s = func func = function(name) return find(name,s) end end files = files or { } + local noffiles = #files for name in walkdir(path) do if find(name,"^%.") then --- skip @@ -2874,12 +3151,9 @@ local function globfiles(path,recurse,func,files) -- func == pattern or function globfiles(path .. "/" .. name,recurse,func,files) end elseif mode == "file" then - if func then - if func(name) then - files[#files+1] = path .. "/" .. name - end - else - files[#files+1] = path .. "/" .. name + if not func or func(name) then + noffiles = noffiles + 1 + files[noffiles] = path .. "/" .. name end end end @@ -2897,17 +3171,15 @@ dir.globfiles = globfiles -- print(dir.ls("*.tex")) function dir.ls(pattern) - return table.concat(glob(pattern),"\n") + return concat(glob(pattern),"\n") end ---~ mkdirs("temp") ---~ mkdirs("a/b/c") ---~ mkdirs(".","/a/b/c") ---~ mkdirs("a","b","c") local make_indeed = true -- false -if string.find(os.getenv("PATH"),";") then -- os.type == "windows" +local onwindows = os.type == "windows" or find(os.getenv("PATH"),";") + +if onwindows then function dir.mkdirs(...) local str, pth, t = "", "", { ... } @@ -2956,64 +3228,21 @@ if string.find(os.getenv("PATH"),";") then -- os.type == "windows" else pth = pth .. "/" .. s end - if make_indeed and not lfs.isdir(pth) then - lfs.mkdir(pth) - end - end - return pth, (lfs.isdir(pth) == true) - end - ---~ print(dir.mkdirs("","","a","c")) ---~ print(dir.mkdirs("a")) ---~ print(dir.mkdirs("a:")) ---~ print(dir.mkdirs("a:/b/c")) ---~ print(dir.mkdirs("a:b/c")) ---~ print(dir.mkdirs("a:/bbb/c")) ---~ print(dir.mkdirs("/a/b/c")) ---~ print(dir.mkdirs("/aaa/b/c")) ---~ print(dir.mkdirs("//a/b/c")) ---~ print(dir.mkdirs("///a/b/c")) ---~ print(dir.mkdirs("a/bbb//ccc/")) - - function dir.expand_name(str) -- will be merged with cleanpath and collapsepath - local first, nothing, last = match(str,"^(//)(//*)(.*)$") - if first then - first = dir.current() .. "/" - end - if not first then - first, last = match(str,"^(//)/*(.*)$") - end - if not first then - first, last = match(str,"^([a-zA-Z]:)(.*)$") - if first and not find(last,"^/") then - local d = lfs.currentdir() - if lfs.chdir(first) then - first = dir.current() - end - lfs.chdir(d) + if make_indeed and not isdir(pth) then + mkdir(pth) end end - if not first then - first, last = dir.current(), str - end - last = gsub(last,"//","/") - last = gsub(last,"/%./","/") - last = gsub(last,"^/*","") - first = gsub(first,"/*$","") - if last == "" then - return first - else - return first .. "/" .. last - end + return pth, (isdir(pth) == true) end + else function dir.mkdirs(...) local str, pth, t = "", "", { ... } for i=1,#t do local s = t[i] - if s ~= "" then + if s and s ~= "" then -- we catch nil and false if str ~= "" then str = str .. "/" .. s else @@ -3031,42 +3260,92 @@ else else pth = pth .. "/" .. s end - if make_indeed and not first and not lfs.isdir(pth) then - lfs.mkdir(pth) + if make_indeed and not first and not isdir(pth) then + mkdir(pth) end end else pth = "." for s in gmatch(str,"[^/]+") do pth = pth .. "/" .. s - if make_indeed and not lfs.isdir(pth) then - lfs.mkdir(pth) + if make_indeed and not isdir(pth) then + mkdir(pth) + end + end + end + return pth, (isdir(pth) == true) + end + + +end + +dir.makedirs = dir.mkdirs + +-- we can only define it here as it uses dir.current + +if onwindows then + + function dir.expandname(str) -- will be merged with cleanpath and collapsepath + local first, nothing, last = match(str,"^(//)(//*)(.*)$") + if first then + first = dir.current() .. "/" + end + if not first then + first, last = match(str,"^(//)/*(.*)$") + end + if not first then + first, last = match(str,"^([a-zA-Z]:)(.*)$") + if first and not find(last,"^/") then + local d = currentdir() + if chdir(first) then + first = dir.current() end + chdir(d) end end - return pth, (lfs.isdir(pth) == true) + if not first then + first, last = dir.current(), str + end + last = gsub(last,"//","/") + last = gsub(last,"/%./","/") + last = gsub(last,"^/*","") + first = gsub(first,"/*$","") + if last == "" or last == "." then + return first + else + return first .. "/" .. last + end end ---~ print(dir.mkdirs("","","a","c")) ---~ print(dir.mkdirs("a")) ---~ print(dir.mkdirs("/a/b/c")) ---~ print(dir.mkdirs("/aaa/b/c")) ---~ print(dir.mkdirs("//a/b/c")) ---~ print(dir.mkdirs("///a/b/c")) ---~ print(dir.mkdirs("a/bbb//ccc/")) +else - function dir.expand_name(str) -- will be merged with cleanpath and collapsepath + function dir.expandname(str) -- will be merged with cleanpath and collapsepath if not find(str,"^/") then - str = lfs.currentdir() .. "/" .. str + str = currentdir() .. "/" .. str end str = gsub(str,"//","/") str = gsub(str,"/%./","/") + str = gsub(str,"(.)/%.$","%1") return str end end -dir.makedirs = dir.mkdirs +file.expandname = dir.expandname -- for convenience + +local stack = { } + +function dir.push(newdir) + insert(stack,lfs.currentdir()) +end + +function dir.pop() + local d = remove(stack) + if d then + lfs.chdir(d) + end + return d +end end -- of closure @@ -3081,12 +3360,17 @@ if not modules then modules = { } end modules ['l-boolean'] = { license = "see context related readme files" } +local type, tonumber = type, tonumber + boolean = boolean or { } +local boolean = boolean -local type, tonumber = type, tonumber +-- function boolean.tonumber(b) +-- return b and 1 or 0 -- test and test and return or return +-- end function boolean.tonumber(b) - if b then return 1 else return 0 end + if b then return 1 else return 0 end -- test and return or return end function toboolean(str,tolerant) @@ -3110,7 +3394,9 @@ function toboolean(str,tolerant) end end -function string.is_boolean(str) +string.toboolean = toboolean + +function string.is_boolean(str,default) if type(str) == "string" then if str == "true" or str == "yes" or str == "on" or str == "t" then return true @@ -3118,15 +3404,7 @@ function string.is_boolean(str) return false end end - return nil -end - -function boolean.alwaystrue() - return true -end - -function boolean.falsetrue() - return false + return default end @@ -3134,7 +3412,7 @@ end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['l-math'] = { +if not modules then modules = { } end modules ['l-unicode'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -3142,228 +3420,290 @@ if not modules then modules = { } end modules ['l-math'] = { license = "see context related readme files" } -local floor, sin, cos, tan = math.floor, math.sin, math.cos, math.tan +if not unicode then -if not math.round then - function math.round(x) - return floor(x + 0.5) - end -end + unicode = { utf8 = { } } -if not math.div then - function math.div(n,m) - return floor(n/m) - end -end + local floor, char = math.floor, string.char -if not math.mod then - function math.mod(n,m) - return n % m + function unicode.utf8.utfchar(n) + if n < 0x80 then + return char(n) + elseif n < 0x800 then + return char( + 0xC0 + floor(n/0x40), + 0x80 + (n % 0x40) + ) + elseif n < 0x10000 then + return char( + 0xE0 + floor(n/0x1000), + 0x80 + (floor(n/0x40) % 0x40), + 0x80 + (n % 0x40) + ) + elseif n < 0x40000 then + return char( + 0xF0 + floor(n/0x40000), + 0x80 + floor(n/0x1000), + 0x80 + (floor(n/0x40) % 0x40), + 0x80 + (n % 0x40) + ) + else + -- return char( + -- 0xF1 + floor(n/0x1000000), + -- 0x80 + floor(n/0x40000), + -- 0x80 + floor(n/0x1000), + -- 0x80 + (floor(n/0x40) % 0x40), + -- 0x80 + (n % 0x40) + -- ) + return "?" + end end + end -local pipi = 2*math.pi/360 +local unicode = unicode -function math.sind(d) - return sin(d*pipi) -end - -function math.cosd(d) - return cos(d*pipi) -end - -function math.tand(d) - return tan(d*pipi) -end +utf = utf or unicode.utf8 +local concat = table.concat +local utfchar, utfbyte, utfgsub = utf.char, utf.byte, utf.gsub +local char, byte, find, bytepairs, utfvalues, format = string.char, string.byte, string.find, string.bytepairs, string.utfvalues, string.format +local type = type -end -- of closure +local utfsplitlines = string.utfsplitlines -do -- create closure to overcome 200 locals limit +-- 0 EF BB BF UTF-8 +-- 1 FF FE UTF-16-little-endian +-- 2 FE FF UTF-16-big-endian +-- 3 FF FE 00 00 UTF-32-little-endian +-- 4 00 00 FE FF UTF-32-big-endian -if not modules then modules = { } end modules ['l-utils'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" +unicode.utfname = { + [0] = 'utf-8', + [1] = 'utf-16-le', + [2] = 'utf-16-be', + [3] = 'utf-32-le', + [4] = 'utf-32-be' } --- hm, quite unreadable +-- \000 fails in <= 5.0 but is valid in >=5.1 where %z is depricated -local gsub = string.gsub -local concat = table.concat -local type, next = type, next +function unicode.utftype(f) + local str = f:read(4) + if not str then + f:seek('set') + return 0 + -- elseif find(str,"^%z%z\254\255") then -- depricated + -- elseif find(str,"^\000\000\254\255") then -- not permitted and bugged + elseif find(str,"\000\000\254\255",1,true) then -- seems to work okay (TH) + return 4 + -- elseif find(str,"^\255\254%z%z") then -- depricated + -- elseif find(str,"^\255\254\000\000") then -- not permitted and bugged + elseif find(str,"\255\254\000\000",1,true) then -- seems to work okay (TH) + return 3 + elseif find(str,"^\254\255") then + f:seek('set',2) + return 2 + elseif find(str,"^\255\254") then + f:seek('set',2) + return 1 + elseif find(str,"^\239\187\191") then + f:seek('set',3) + return 0 + else + f:seek('set') + return 0 + end +end -if not utils then utils = { } end -if not utils.merger then utils.merger = { } end -if not utils.lua then utils.lua = { } end -utils.merger.m_begin = "begin library merge" -utils.merger.m_end = "end library merge" -utils.merger.pattern = - "%c+" .. - "%-%-%s+" .. utils.merger.m_begin .. - "%c+(.-)%c+" .. - "%-%-%s+" .. utils.merger.m_end .. - "%c+" -function utils.merger._self_fake_() - return - "-- " .. "created merged file" .. "\n\n" .. - "-- " .. utils.merger.m_begin .. "\n\n" .. - "-- " .. utils.merger.m_end .. "\n\n" +local function utf16_to_utf8_be(t) + if type(t) == "string" then + t = utfsplitlines(str) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, 0 + for left, right in bytepairs(t[i]) do + if right then + local now = 256*left + right + if more > 0 then + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 + more = 0 + r = r + 1 + result[r] = utfchar(now) + elseif now >= 0xD800 and now <= 0xDBFF then + more = now + else + r = r + 1 + result[r] = utfchar(now) + end + end + end + t[i] = concat(result,"",1,r) -- we reused tmp, hence t + end + return t end -function utils.report(...) - print(...) +local function utf16_to_utf8_le(t) + if type(t) == "string" then + t = utfsplitlines(str) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, 0 + for left, right in bytepairs(t[i]) do + if right then + local now = 256*right + left + if more > 0 then + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 + more = 0 + r = r + 1 + result[r] = utfchar(now) + elseif now >= 0xD800 and now <= 0xDBFF then + more = now + else + r = r + 1 + result[r] = utfchar(now) + end + end + end + t[i] = concat(result,"",1,r) -- we reused tmp, hence t + end + return t end -utils.merger.strip_comment = true - -function utils.merger._self_load_(name) - local f, data = io.open(name), "" - if f then - utils.report("reading merge from %s",name) - data = f:read("*all") - f:close() - else - utils.report("unknown file to merge %s",name) +local function utf32_to_utf8_be(str) + if type(t) == "string" then + t = utfsplitlines(str) end - if data and utils.merger.strip_comment then - -- saves some 20K - data = gsub(data,"%-%-~[^\n\r]*[\r\n]", "") + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, -1 + for a,b in bytepairs(str) do + if a and b then + if more < 0 then + more = 256*256*256*a + 256*256*b + else + r = r + 1 + result[t] = utfchar(more + 256*a + b) + more = -1 + end + else + break + end + end + t[i] = concat(result,"",1,r) end - return data or "" + return result end -function utils.merger._self_save_(name, data) - if data ~= "" then - local f = io.open(name,'w') - if f then - utils.report("saving merge from %s",name) - f:write(data) - f:close() +local function utf32_to_utf8_le(str) + if type(t) == "string" then + t = utfsplitlines(str) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, -1 + for a,b in bytepairs(str) do + if a and b then + if more < 0 then + more = 256*b + a + else + r = r + 1 + result[t] = utfchar(more + 256*256*256*b + 256*256*a) + more = -1 + end + else + break + end end + t[i] = concat(result,"",1,r) end + return result end -function utils.merger._self_swap_(data,code) - if data ~= "" then - return (gsub(data,utils.merger.pattern, function(s) - return "\n\n" .. "-- "..utils.merger.m_begin .. "\n" .. code .. "\n" .. "-- "..utils.merger.m_end .. "\n\n" - end, 1)) +unicode.utf32_to_utf8_be = utf32_to_utf8_be +unicode.utf32_to_utf8_le = utf32_to_utf8_le +unicode.utf16_to_utf8_be = utf16_to_utf8_be +unicode.utf16_to_utf8_le = utf16_to_utf8_le + +function unicode.utf8_to_utf8(t) + return type(t) == "string" and utfsplitlines(t) or t +end + +function unicode.utf16_to_utf8(t,endian) + return endian and utf16_to_utf8_be(t) or utf16_to_utf8_le(t) or t +end + +function unicode.utf32_to_utf8(t,endian) + return endian and utf32_to_utf8_be(t) or utf32_to_utf8_le(t) or t +end + +local function little(c) + local b = byte(c) + if b < 0x10000 then + return char(b%256,b/256) else - return "" + b = b - 0x10000 + local b1, b2 = b/1024 + 0xD800, b%1024 + 0xDC00 + return char(b1%256,b1/256,b2%256,b2/256) end end ---~ stripper: ---~ ---~ data = gsub(data,"%-%-~[^\n]*\n","") ---~ data = gsub(data,"\n\n+","\n") - -function utils.merger._self_libs_(libs,list) - local result, f, frozen = { }, nil, false - result[#result+1] = "\n" - if type(libs) == 'string' then libs = { libs } end - if type(list) == 'string' then list = { list } end - local foundpath = nil - for i=1,#libs do - local lib = libs[i] - for j=1,#list do - local pth = gsub(list[j],"\\","/") -- file.clean_path - utils.report("checking library path %s",pth) - local name = pth .. "/" .. lib - if lfs.isfile(name) then - foundpath = pth - end - end - if foundpath then break end +local function big(c) + local b = byte(c) + if b < 0x10000 then + return char(b/256,b%256) + else + b = b - 0x10000 + local b1, b2 = b/1024 + 0xD800, b%1024 + 0xDC00 + return char(b1/256,b1%256,b2/256,b2%256) end - if foundpath then - utils.report("using library path %s",foundpath) - local right, wrong = { }, { } - for i=1,#libs do - local lib = libs[i] - local fullname = foundpath .. "/" .. lib - if lfs.isfile(fullname) then - -- right[#right+1] = lib - utils.report("merging library %s",fullname) - result[#result+1] = "do -- create closure to overcome 200 locals limit" - result[#result+1] = io.loaddata(fullname,true) - result[#result+1] = "end -- of closure" - else - -- wrong[#wrong+1] = lib - utils.report("no library %s",fullname) - end - end - if #right > 0 then - utils.report("merged libraries: %s",concat(right," ")) - end - if #wrong > 0 then - utils.report("skipped libraries: %s",concat(wrong," ")) - end +end + +function unicode.utf8_to_utf16(str,littleendian) + if littleendian then + return char(255,254) .. utfgsub(str,".",little) else - utils.report("no valid library path found") + return char(254,255) .. utfgsub(str,".",big) end - return concat(result, "\n\n") end -function utils.merger.selfcreate(libs,list,target) - if target then - utils.merger._self_save_( - target, - utils.merger._self_swap_( - utils.merger._self_fake_(), - utils.merger._self_libs_(libs,list) - ) - ) +function unicode.utfcodes(str) + local t, n = { }, 0 + for u in utfvalues(str) do + n = n + 1 + t[n] = format("0x%04X",u) end + return concat(t,separator or " ") end -function utils.merger.selfmerge(name,libs,list,target) - utils.merger._self_save_( - target or name, - utils.merger._self_swap_( - utils.merger._self_load_(name), - utils.merger._self_libs_(libs,list) - ) - ) +function unicode.ustring(s) + return format("U+%05X",type(s) == "number" and s or utfbyte(s)) end -function utils.merger.selfclean(name) - utils.merger._self_save_( - name, - utils.merger._self_swap_( - utils.merger._self_load_(name), - "" - ) - ) +function unicode.xstring(s) + return format("0x%05X",type(s) == "number" and s or utfbyte(s)) end -function utils.lua.compile(luafile, lucfile, cleanup, strip) -- defaults: cleanup=false strip=true - -- utils.report("compiling",luafile,"into",lucfile) - os.remove(lucfile) - local command = "-o " .. string.quote(lucfile) .. " " .. string.quote(luafile) - if strip ~= false then - command = "-s " .. command - end - local done = (os.spawn("texluac " .. command) == 0) or (os.spawn("luac " .. command) == 0) - if done and cleanup == true and lfs.isfile(lucfile) and lfs.isfile(luafile) then - -- utils.report("removing",luafile) - os.remove(luafile) - end - return done + +local lpegmatch = lpeg.match +local utftype = lpeg.patterns.utftype + +function unicode.filetype(data) + return data and lpegmatch(utftype,data) or "unknown" end + end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['l-aux'] = { +if not modules then modules = { } end modules ['l-math'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -3371,606 +3711,2538 @@ if not modules then modules = { } end modules ['l-aux'] = { license = "see context related readme files" } --- for inline, no store split : for s in string.gmatch(str,",* *([^,]+)") do .. end - -aux = aux or { } +local floor, sin, cos, tan = math.floor, math.sin, math.cos, math.tan -local concat, format, gmatch = table.concat, string.format, string.gmatch -local tostring, type = tostring, type -local lpegmatch = lpeg.match +if not math.round then + function math.round(x) return floor(x + 0.5) end +end -local P, R, V = lpeg.P, lpeg.R, lpeg.V +if not math.div then + function math.div(n,m) return floor(n/m) end +end -local escape, left, right = P("\\"), P('{'), P('}') +if not math.mod then + function math.mod(n,m) return n % m end +end -lpeg.patterns.balanced = P { - [1] = ((escape * (left+right)) + (1 - (left+right)) + V(2))^0, - [2] = left * V(1) * right -} +local pipi = 2*math.pi/360 -local space = lpeg.P(' ') -local equal = lpeg.P("=") -local comma = lpeg.P(",") -local lbrace = lpeg.P("{") -local rbrace = lpeg.P("}") -local nobrace = 1 - (lbrace+rbrace) -local nested = lpeg.P { lbrace * (nobrace + lpeg.V(1))^0 * rbrace } -local spaces = space^0 +if not math.sind then + function math.sind(d) return sin(d*pipi) end + function math.cosd(d) return cos(d*pipi) end + function math.tand(d) return tan(d*pipi) end +end -local value = lpeg.P(lbrace * lpeg.C((nobrace + nested)^0) * rbrace) + lpeg.C((nested + (1-comma))^0) +if not math.odd then + function math.odd (n) return n % 2 == 0 end + function math.even(n) return n % 2 ~= 0 end +end -local key = lpeg.C((1-equal-comma)^1) -local pattern_a = (space+comma)^0 * (key * equal * value + key * lpeg.C("")) -local pattern_c = (space+comma)^0 * (key * equal * value) -local key = lpeg.C((1-space-equal-comma)^1) -local pattern_b = spaces * comma^0 * spaces * (key * ((spaces * equal * spaces * value) + lpeg.C(""))) +end -- of closure --- "a=1, b=2, c=3, d={a{b,c}d}, e=12345, f=xx{a{b,c}d}xx, g={}" : outer {} removes, leading spaces ignored +do -- create closure to overcome 200 locals limit -local hash = { } +if not modules then modules = { } end modules ['util-tab'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} -local function set(key,value) -- using Carg is slower here - hash[key] = value -end +utilities = utilities or {} +utilities.tables = utilities.tables or { } +local tables = utilities.tables -local pattern_a_s = (pattern_a/set)^1 -local pattern_b_s = (pattern_b/set)^1 -local pattern_c_s = (pattern_c/set)^1 +local format, gmatch = string.format, string.gmatch +local concat, insert, remove = table.concat, table.insert, table.remove +local setmetatable, getmetatable, tonumber, tostring = setmetatable, getmetatable, tonumber, tostring -aux.settings_to_hash_pattern_a = pattern_a_s -aux.settings_to_hash_pattern_b = pattern_b_s -aux.settings_to_hash_pattern_c = pattern_c_s +function tables.definetable(target) -- defines undefined tables + local composed, t, n = nil, { }, 0 + for name in gmatch(target,"([^%.]+)") do + n = n + 1 + if composed then + composed = composed .. "." .. name + else + composed = name + end + t[n] = format("%s = %s or { }",composed,composed) + end + return concat(t,"\n") +end -function aux.make_settings_to_hash_pattern(set,how) - if how == "strict" then - return (pattern_c/set)^1 - elseif how == "tolerant" then - return (pattern_b/set)^1 - else - return (pattern_a/set)^1 +function tables.accesstable(target) + local t = _G + for name in gmatch(target,"([^%.]+)") do + t = t[name] end + return t end -function aux.settings_to_hash(str,existing) - if str and str ~= "" then - hash = existing or { } - if moretolerant then - lpegmatch(pattern_b_s,str) - else - lpegmatch(pattern_a_s,str) +function tables.removevalue(t,value) -- todo: n + if value then + for i=1,#t do + if t[i] == value then + remove(t,i) + -- remove all, so no: return + end end - return hash - else - return { } end end -function aux.settings_to_hash_tolerant(str,existing) - if str and str ~= "" then - hash = existing or { } - lpegmatch(pattern_b_s,str) - return hash - else - return { } +function tables.insertbeforevalue(t,value,extra) + for i=1,#t do + if t[i] == extra then + remove(t,i) + end end + for i=1,#t do + if t[i] == value then + insert(t,i,extra) + return + end + end + insert(t,1,extra) end -function aux.settings_to_hash_strict(str,existing) - if str and str ~= "" then - hash = existing or { } - lpegmatch(pattern_c_s,str) - return next(hash) and hash - else - return nil +function tables.insertaftervalue(t,value,extra) + for i=1,#t do + if t[i] == extra then + remove(t,i) + end + end + for i=1,#t do + if t[i] == value then + insert(t,i+1,extra) + return + end end + insert(t,#t+1,extra) end -local separator = comma * space^0 -local value = lpeg.P(lbrace * lpeg.C((nobrace + nested)^0) * rbrace) + lpeg.C((nested + (1-comma))^0) -local pattern = lpeg.Ct(value*(separator*value)^0) - --- "aap, {noot}, mies" : outer {} removes, leading spaces ignored - -aux.settings_to_array_pattern = pattern +-- experimental --- we could use a weak table as cache +local function toxml(t,d,result) + for k, v in table.sortedpairs(t) do + if type(v) == "table" then + result[#result+1] = format("%s<%s>",d,k) + toxml(v,d.." ",result) + result[#result+1] = format("%s",d,k) + elseif tonumber(k) then + result[#result+1] = format("%s%s",d,k,v,k) + else + result[#result+1] = format("%s<%s>%s",d,k,tostring(v),k) + end + end +end -function aux.settings_to_array(str) - if not str or str == "" then - return { } +function table.toxml(t,name,nobanner) + local noroot = name == false + local result = (nobanner or noroot) and { } or { "" } + if noroot then + toxml( t, "", result) else - return lpegmatch(pattern,str) + toxml( { [name or "root"] = t }, "", result) end + return concat(result,"\n") end -local function set(t,v) - t[#t+1] = v -end -local value = lpeg.P(lpeg.Carg(1)*value) / set -local pattern = value*(separator*value)^0 * lpeg.Carg(1) +end -- of closure -function aux.add_settings_to_array(t,str) - return lpegmatch(pattern,str,nil,t) -end +do -- create closure to overcome 200 locals limit -function aux.hash_to_string(h,separator,yes,no,strict,omit) - if h then - local t, s = { }, table.sortedkeys(h) - omit = omit and table.tohash(omit) - for i=1,#s do - local key = s[i] - if not omit or not omit[key] then - local value = h[key] - if type(value) == "boolean" then - if yes and no then - if value then - t[#t+1] = key .. '=' .. yes - elseif not strict then - t[#t+1] = key .. '=' .. no - end - elseif value or not strict then - t[#t+1] = key .. '=' .. tostring(value) - end - else - t[#t+1] = key .. '=' .. value - end - end - end - return concat(t,separator or ",") - else - return "" - end -end +if not modules then modules = { } end modules ['util-sto'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} -function aux.array_to_string(a,separator) - if a then - return concat(a,separator or ",") - else - return "" +local setmetatable, getmetatable = setmetatable, getmetatable + +utilities = utilities or { } +utilities.storage = utilities.storage or { } +local storage = utilities.storage + +function storage.mark(t) + if not t then + texio.write_nl("fatal error: storage '%s' cannot be marked",t) + os.exit() + end + local m = getmetatable(t) + if not m then + m = { } + setmetatable(t,m) end + m.__storage__ = true + return t end -function aux.settings_to_set(str,t) +function storage.allocate(t) t = t or { } - for s in gmatch(str,"%s*([^,]+)") do - t[s] = true + local m = getmetatable(t) + if not m then + m = { } + setmetatable(t,m) end + m.__storage__ = true return t end -local value = lbrace * lpeg.C((nobrace + nested)^0) * rbrace -local pattern = lpeg.Ct((space + value)^0) +function storage.marked(t) + local m = getmetatable(t) + return m and m.__storage__ +end -function aux.arguments_to_table(str) - return lpegmatch(pattern,str) +function storage.checked(t) + if not t then + texio.write_nl("fatal error: storage '%s' has not been allocated",t) + os.exit() + end + return t end --- temporary here -function aux.getparameters(self,class,parentclass,settings) - local sc = self[class] - if not sc then - sc = table.clone(self[parent]) - self[class] = sc +function storage.setinitializer(data,initialize) + local m = getmetatable(data) or { } + m.__index = function(data,k) + m.__index = nil -- so that we can access the entries during initializing + initialize() + return data[k] end - aux.settings_to_hash(settings,sc) + setmetatable(data, m) end --- temporary here +local keyisvalue = { __index = function(t,k) + t[k] = k + return k +end } -local digit = lpeg.R("09") -local period = lpeg.P(".") -local zero = lpeg.P("0") -local trailingzeros = zero^0 * -digit -- suggested by Roberto R -local case_1 = period * trailingzeros / "" -local case_2 = period * (digit - trailingzeros)^1 * (trailingzeros / "") -local number = digit^1 * (case_1 + case_2) -local stripper = lpeg.Cs((number + 1)^0) +function storage.sparse(t) + t = t or { } + setmetatable(t,keyisvalue) + return t +end ---~ local sample = "bla 11.00 bla 11 bla 0.1100 bla 1.00100 bla 0.00 bla 0.001 bla 1.1100 bla 0.100100100 bla 0.00100100100" ---~ collectgarbage("collect") ---~ str = string.rep(sample,10000) ---~ local ts = os.clock() ---~ lpegmatch(stripper,str) ---~ print(#str, os.clock()-ts, lpegmatch(stripper,sample)) +-- table namespace ? -lpeg.patterns.strip_zeros = stripper +local function f_empty () return "" end -- t,k +local function f_self (t,k) t[k] = k return k end +local function f_ignore() end -- t,k,v -function aux.strip_zeros(str) - return lpegmatch(stripper,str) -end +local t_empty = { __index = empty } +local t_self = { __index = self } +local t_ignore = { __newindex = ignore } -function aux.definetable(target) -- defines undefined tables - local composed, t = nil, { } - for name in gmatch(target,"([^%.]+)") do - if composed then - composed = composed .. "." .. name +function table.setmetatableindex(t,f) + local m = getmetatable(t) + if m then + if f == "empty" then + m.__index = f_empty + elseif f == "key" then + m.__index = f_self else - composed = name + m.__index = f + end + else + if f == "empty" then + setmetatable(t, t_empty) + elseif f == "key" then + setmetatable(t, t_self) + else + setmetatable(t,{ __index = f }) end - t[#t+1] = format("%s = %s or { }",composed,composed) end - return concat(t,"\n") end -function aux.accesstable(target) - local t = _G - for name in gmatch(target,"([^%.]+)") do - t = t[name] +function table.setmetatablenewindex(t,f) + local m = getmetatable(t) + if m then + if f == "ignore" then + m.__newindex = f_ignore + else + m.__newindex = f + end + else + if f == "ignore" then + setmetatable(t, t_ignore) + else + setmetatable(t,{ __newindex = f }) + end end - return t end ---~ function string.commaseparated(str) ---~ return gmatch(str,"([^,%s]+)") ---~ end +function table.setmetatablecall(t,f) + local m = getmetatable(t) + if m then + m.__call = f + else + setmetatable(t,{ __call = f }) + end +end --- as we use this a lot ... +function table.setmetatablekey(t,key,value) + local m = getmetatable(t) + if not m then + m = { } + setmetatable(t,m) + end + m[key] = value +end ---~ function aux.cachefunction(action,weak) ---~ local cache = { } ---~ if weak then ---~ setmetatable(cache, { __mode = "kv" } ) ---~ end ---~ local function reminder(str) ---~ local found = cache[str] ---~ if not found then ---~ found = action(str) ---~ cache[str] = found ---~ end ---~ return found ---~ end ---~ return reminder, cache ---~ end +function table.getmetatablekey(t,key,value) + local m = getmetatable(t) + return m and m[key] +end end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['trac-tra'] = { +if not modules then modules = { } end modules ['util-mrg'] = { version = 1.001, - comment = "companion to trac-tra.mkiv", + comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } --- the tag is kind of generic and used for functions that are not --- bound to a variable, like node.new, node.copy etc (contrary to for instance --- node.has_attribute which is bound to a has_attribute local variable in mkiv) - -local debug = require "debug" +-- hm, quite unreadable -local getinfo = debug.getinfo -local type, next = type, next +local gsub, format = string.gsub, string.format local concat = table.concat -local format, find, lower, gmatch, gsub = string.format, string.find, string.lower, string.gmatch, string.gsub - -debugger = debugger or { } +local type, next = type, next -local counters = { } -local names = { } +utilities = utilities or {} +utilities.merger = utilities.merger or { } -- maybe mergers +utilities.report = logs and logs.reporter("system") or print --- one +local merger = utilities.merger -local function hook() - local f = getinfo(2,"f").func - local n = getinfo(2,"Sn") --- if n.what == "C" and n.name then print (n.namewhat .. ': ' .. n.name) end - if f then - local cf = counters[f] - if cf == nil then - counters[f] = 1 - names[f] = n - else - counters[f] = cf + 1 - end - end -end -local function getname(func) - local n = names[func] - if n then - if n.what == "C" then - return n.name or '' - else - -- source short_src linedefined what name namewhat nups func - local name = n.name or n.namewhat or n.what - if not name or name == "" then name = "?" end - return format("%s : %s : %s", n.short_src or "unknown source", n.linedefined or "--", name) - end - else - return "unknown" - end -end -function debugger.showstats(printer,threshold) - printer = printer or texio.write or print - threshold = threshold or 0 - local total, grandtotal, functions = 0, 0, 0 - printer("\n") -- ugly but ok - -- table.sort(counters) - for func, count in next, counters do - if count > threshold then - local name = getname(func) - if not find(name,"for generator") then - printer(format("%8i %s", count, name)) - total = total + count - end - end - grandtotal = grandtotal + count - functions = functions + 1 - end - printer(format("functions: %s, total: %s, grand total: %s, threshold: %s\n", functions, total, grandtotal, threshold)) -end +merger.strip_comment = true --- two +local m_begin_merge = "begin library merge" +local m_end_merge = "end library merge" +local m_begin_closure = "do -- create closure to overcome 200 locals limit" +local m_end_closure = "end -- of closure" ---~ local function hook() ---~ local n = getinfo(2) ---~ if n.what=="C" and not n.name then ---~ local f = tostring(debug.traceback()) ---~ local cf = counters[f] ---~ if cf == nil then ---~ counters[f] = 1 ---~ names[f] = n ---~ else ---~ counters[f] = cf + 1 ---~ end ---~ end ---~ end ---~ function debugger.showstats(printer,threshold) ---~ printer = printer or texio.write or print ---~ threshold = threshold or 0 ---~ local total, grandtotal, functions = 0, 0, 0 ---~ printer("\n") -- ugly but ok ---~ -- table.sort(counters) ---~ for func, count in next, counters do ---~ if count > threshold then ---~ printer(format("%8i %s", count, func)) ---~ total = total + count ---~ end ---~ grandtotal = grandtotal + count ---~ functions = functions + 1 ---~ end ---~ printer(format("functions: %s, total: %s, grand total: %s, threshold: %s\n", functions, total, grandtotal, threshold)) ---~ end +local m_pattern = + "%c+" .. + "%-%-%s+" .. m_begin_merge .. + "%c+(.-)%c+" .. + "%-%-%s+" .. m_end_merge .. + "%c+" --- rest +local m_format = + "\n\n-- " .. m_begin_merge .. + "\n%s\n" .. + "-- " .. m_end_merge .. "\n\n" -function debugger.savestats(filename,threshold) - local f = io.open(filename,'w') - if f then - debugger.showstats(function(str) f:write(str) end,threshold) - f:close() - end -end +local m_faked = + "-- " .. "created merged file" .. "\n\n" .. + "-- " .. m_begin_merge .. "\n\n" .. + "-- " .. m_end_merge .. "\n\n" -function debugger.enable() - debug.sethook(hook,"c") +local function self_fake() + return m_faked end -function debugger.disable() - debug.sethook() ---~ counters[debug.getinfo(2,"f").func] = nil +local function self_nothing() + return "" end -function debugger.tracing() - local n = tonumber(os.env['MTX.TRACE.CALLS']) or tonumber(os.env['MTX_TRACE_CALLS']) or 0 - if n > 0 then - function debugger.tracing() return true end ; return true +local function self_load(name) + local data = io.loaddata(name) or "" + if data == "" then + utilities.report("merge: unknown file %s",name) else - function debugger.tracing() return false end ; return false + utilities.report("merge: inserting %s",name) end + return data or "" end ---~ debugger.enable() - ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) - ---~ debugger.disable() - ---~ print("") ---~ debugger.showstats() ---~ print("") ---~ debugger.showstats(print,3) - -setters = setters or { } -setters.data = setters.data or { } +local function self_save(name, data) + if data ~= "" then + if merger.strip_comment then + -- saves some 20K + local n = #data + data = gsub(data,"%-%-~[^\n\r]*[\r\n]","") + utilities.report("merge: %s bytes of comment stripped, %s bytes of code left",n-#data,#data) + end + io.savedata(name,data) + utilities.report("merge: saving %s",name) + end +end ---~ local function set(t,what,value) ---~ local data, done = t.data, t.done ---~ if type(what) == "string" then ---~ what = aux.settings_to_array(what) -- inefficient but ok ---~ end ---~ for i=1,#what do ---~ local w = what[i] ---~ for d, f in next, data do ---~ if done[d] then ---~ -- prevent recursion due to wildcards ---~ elseif find(d,w) then ---~ done[d] = true ---~ for i=1,#f do ---~ f[i](value) ---~ end ---~ end ---~ end ---~ end ---~ end +local function self_swap(data,code) + return data ~= "" and (gsub(data,m_pattern, function() return format(m_format,code) end, 1)) or "" +end -local function set(t,what,value) - local data, done = t.data, t.done - if type(what) == "string" then - what = aux.settings_to_hash(what) -- inefficient but ok - end - for w, v in next, what do - if v == "" then - v = value - else - v = toboolean(v) +local function self_libs(libs,list) + local result, f, frozen, foundpath = { }, nil, false, nil + result[#result+1] = "\n" + if type(libs) == 'string' then libs = { libs } end + if type(list) == 'string' then list = { list } end + for i=1,#libs do + local lib = libs[i] + for j=1,#list do + local pth = gsub(list[j],"\\","/") -- file.clean_path + utilities.report("merge: checking library path %s",pth) + local name = pth .. "/" .. lib + if lfs.isfile(name) then + foundpath = pth + end end - for d, f in next, data do - if done[d] then - -- prevent recursion due to wildcards - elseif find(d,w) then - done[d] = true - for i=1,#f do - f[i](v) - end + if foundpath then break end + end + if foundpath then + utilities.report("merge: using library path %s",foundpath) + local right, wrong = { }, { } + for i=1,#libs do + local lib = libs[i] + local fullname = foundpath .. "/" .. lib + if lfs.isfile(fullname) then + utilities.report("merge: using library %s",fullname) + right[#right+1] = lib + result[#result+1] = m_begin_closure + result[#result+1] = io.loaddata(fullname,true) + result[#result+1] = m_end_closure + else + utilities.report("merge: skipping library %s",fullname) + wrong[#wrong+1] = lib end end + if #right > 0 then + utilities.report("merge: used libraries: %s",concat(right," ")) + end + if #wrong > 0 then + utilities.report("merge: skipped libraries: %s",concat(wrong," ")) + end + else + utilities.report("merge: no valid library path found") end + return concat(result, "\n\n") end -local function reset(t) - for d, f in next, t.data do - for i=1,#f do - f[i](false) - end +function merger.selfcreate(libs,list,target) + if target then + self_save(target,self_swap(self_fake(),self_libs(libs,list))) end end -local function enable(t,what) - set(t,what,true) +function merger.selfmerge(name,libs,list,target) + self_save(target or name,self_swap(self_load(name),self_libs(libs,list))) end -local function disable(t,what) - local data = t.data - if not what or what == "" then - t.done = { } - reset(t) - else - set(t,what,false) - end +function merger.selfclean(name) + self_save(name,self_swap(self_load(name),self_nothing())) end -function setters.register(t,what,...) - local data = t.data - what = lower(what) - local w = data[what] - if not w then - w = { } - data[what] = w + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['util-lua'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +utilities = utilities or {} +utilities.lua = utilities.lua or { } +utilities.report = logs and logs.reporter("system") or print + +function utilities.lua.compile(luafile,lucfile,cleanup,strip) -- defaults: cleanup=false strip=true + utilities.report("lua: compiling %s into %s",luafile,lucfile) + os.remove(lucfile) + local command = "-o " .. string.quoted(lucfile) .. " " .. string.quoted(luafile) + if strip ~= false then + command = "-s " .. command end - for _, fnc in next, { ... } do - local typ = type(fnc) - if typ == "function" then - w[#w+1] = fnc - elseif typ == "string" then - w[#w+1] = function(value) set(t,fnc,value,nesting) end - end + local done = os.spawn("texluac " .. command) == 0 or os.spawn("luac " .. command) == 0 + if done and cleanup == true and lfs.isfile(lucfile) and lfs.isfile(luafile) then + utilities.report("lua: removing %s",luafile) + os.remove(luafile) end + return done end -function setters.enable(t,what) - local e = t.enable - t.enable, t.done = enable, { } - enable(t,string.simpleesc(tostring(what))) - t.enable, t.done = e, { } -end -function setters.disable(t,what) - local e = t.disable - t.disable, t.done = disable, { } - disable(t,string.simpleesc(tostring(what))) - t.disable, t.done = e, { } -end -function setters.reset(t) - t.done = { } - reset(t) -end -function setters.list(t) -- pattern - local list = table.sortedkeys(t.data) - local user, system = { }, { } - for l=1,#list do - local what = list[l] - if find(what,"^%*") then + + + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['util-prs'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local P, R, V, C, Ct, Carg = lpeg.P, lpeg.R, lpeg.V, lpeg.C, lpeg.Ct, lpeg.Carg +local lpegmatch = lpeg.match +local concat, format, gmatch = table.concat, string.format, string.gmatch +local tostring, type, next = tostring, type, next + +utilities = utilities or {} +utilities.parsers = utilities.parsers or { } +local parsers = utilities.parsers +parsers.patterns = parsers.patterns or { } + +local setmetatableindex = table.setmetatableindex +local sortedhash = table.sortedhash + +-- we could use a Cf Cg construct + +local escape, left, right = P("\\"), P('{'), P('}') + +lpeg.patterns.balanced = P { + [1] = ((escape * (left+right)) + (1 - (left+right)) + V(2))^0, + [2] = left * V(1) * right +} + +local space = P(' ') +local equal = P("=") +local comma = P(",") +local lbrace = P("{") +local rbrace = P("}") +local nobrace = 1 - (lbrace+rbrace) +local nested = P { lbrace * (nobrace + V(1))^0 * rbrace } +local spaces = space^0 + +lpeg.patterns.nested = nested + +local value = P(lbrace * C((nobrace + nested)^0) * rbrace) + C((nested + (1-comma))^0) + +local key = C((1-equal-comma)^1) +local pattern_a = (space+comma)^0 * (key * equal * value + key * C("")) +local pattern_c = (space+comma)^0 * (key * equal * value) + +local key = C((1-space-equal-comma)^1) +local pattern_b = spaces * comma^0 * spaces * (key * ((spaces * equal * spaces * value) + C(""))) + +-- "a=1, b=2, c=3, d={a{b,c}d}, e=12345, f=xx{a{b,c}d}xx, g={}" : outer {} removes, leading spaces ignored + +local hash = { } + +local function set(key,value) + hash[key] = value +end + +local function set(key,value) + hash[key] = value +end + +local pattern_a_s = (pattern_a/set)^1 +local pattern_b_s = (pattern_b/set)^1 +local pattern_c_s = (pattern_c/set)^1 + +parsers.patterns.settings_to_hash_a = pattern_a_s +parsers.patterns.settings_to_hash_b = pattern_b_s +parsers.patterns.settings_to_hash_c = pattern_c_s + +function parsers.make_settings_to_hash_pattern(set,how) + if how == "strict" then + return (pattern_c/set)^1 + elseif how == "tolerant" then + return (pattern_b/set)^1 + else + return (pattern_a/set)^1 + end +end + +function parsers.settings_to_hash(str,existing) + if str and str ~= "" then + hash = existing or { } + lpegmatch(pattern_a_s,str) + return hash + else + return { } + end +end + +function parsers.settings_to_hash_tolerant(str,existing) + if str and str ~= "" then + hash = existing or { } + lpegmatch(pattern_b_s,str) + return hash + else + return { } + end +end + +function parsers.settings_to_hash_strict(str,existing) + if str and str ~= "" then + hash = existing or { } + lpegmatch(pattern_c_s,str) + return next(hash) and hash + else + return nil + end +end + +local separator = comma * space^0 +local value = P(lbrace * C((nobrace + nested)^0) * rbrace) + C((nested + (1-comma))^0) +local pattern = Ct(value*(separator*value)^0) + +-- "aap, {noot}, mies" : outer {} removes, leading spaces ignored + +parsers.patterns.settings_to_array = pattern + +-- we could use a weak table as cache + +function parsers.settings_to_array(str) + if not str or str == "" then + return { } + else + return lpegmatch(pattern,str) + end +end + +local function set(t,v) + t[#t+1] = v +end + +local value = P(Carg(1)*value) / set +local pattern = value*(separator*value)^0 * Carg(1) + +function parsers.add_settings_to_array(t,str) + return lpegmatch(pattern,str,nil,t) +end + +function parsers.hash_to_string(h,separator,yes,no,strict,omit) + if h then + local t, tn, s = { }, 0, table.sortedkeys(h) + omit = omit and table.tohash(omit) + for i=1,#s do + local key = s[i] + if not omit or not omit[key] then + local value = h[key] + if type(value) == "boolean" then + if yes and no then + if value then + tn = tn + 1 + t[tn] = key .. '=' .. yes + elseif not strict then + tn = tn + 1 + t[tn] = key .. '=' .. no + end + elseif value or not strict then + tn = tn + 1 + t[tn] = key .. '=' .. tostring(value) + end + else + tn = tn + 1 + t[tn] = key .. '=' .. value + end + end + end + return concat(t,separator or ",") + else + return "" + end +end + +function parsers.array_to_string(a,separator) + if a then + return concat(a,separator or ",") + else + return "" + end +end + +function parsers.settings_to_set(str,t) -- tohash? -- todo: lpeg -- duplicate anyway + t = t or { } +-- for s in gmatch(str,"%s*([^, ]+)") do -- space added + for s in gmatch(str,"[^, ]+") do -- space added + t[s] = true + end + return t +end + +function parsers.simple_hash_to_string(h, separator) + local t, tn = { }, 0 + for k, v in sortedhash(h) do + if v then + tn = tn + 1 + t[tn] = k + end + end + return concat(t,separator or ",") +end + +local value = lbrace * C((nobrace + nested)^0) * rbrace +local pattern = Ct((space + value)^0) + +function parsers.arguments_to_table(str) + return lpegmatch(pattern,str) +end + +-- temporary here (unoptimized) + +function parsers.getparameters(self,class,parentclass,settings) + local sc = self[class] + if not sc then + sc = { } + self[class] = sc + if parentclass then + local sp = self[parentclass] + if not sp then + sp = { } + self[parentclass] = sp + end + setmetatableindex(sc,sp) + end + end + parsers.settings_to_hash(settings,sc) +end + +function parsers.listitem(str) + return gmatch(str,"[^, ]+") +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['util-fmt'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +utilities = utilities or { } +utilities.formatters = utilities.formatters or { } +local formatters = utilities.formatters + +local concat, format = table.concat, string.format +local tostring, type = tostring, type +local strip = string.strip + +local P, R, Cs = lpeg.P, lpeg.R, lpeg.Cs +local lpegmatch = lpeg.match + +-- temporary here + +local digit = R("09") +local period = P(".") +local zero = P("0") +local trailingzeros = zero^0 * -digit -- suggested by Roberto R +local case_1 = period * trailingzeros / "" +local case_2 = period * (digit - trailingzeros)^1 * (trailingzeros / "") +local number = digit^1 * (case_1 + case_2) +local stripper = Cs((number + 1)^0) + + +lpeg.patterns.stripzeros = stripper + +function formatters.stripzeros(str) + return lpegmatch(stripper,str) +end + +function formatters.formatcolumns(result,between) + if result and #result > 0 then + between = between or " " + local widths, numbers = { }, { } + local first = result[1] + local n = #first + for i=1,n do + widths[i] = 0 + end + for i=1,#result do + local r = result[i] + for j=1,n do + local rj = r[j] + local tj = type(rj) + if tj == "number" then + numbers[j] = true + end + if tj ~= "string" then + rj = tostring(rj) + r[j] = rj + end + local w = #rj + if w > widths[j] then + widths[j] = w + end + end + end + for i=1,n do + local w = widths[i] + if numbers[i] then + if w > 80 then + widths[i] = "%s" .. between + else + widths[i] = "%0" .. w .. "i" .. between + end + else + if w > 80 then + widths[i] = "%s" .. between + elseif w > 0 then + widths[i] = "%-" .. w .. "s" .. between + else + widths[i] = "%s" + end + end + end + local template = strip(concat(widths)) + for i=1,#result do + local str = format(template,unpack(result[i])) + result[i] = strip(str) + end + end + return result +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['util.deb'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- the tag is kind of generic and used for functions that are not +-- bound to a variable, like node.new, node.copy etc (contrary to for instance +-- node.has_attribute which is bound to a has_attribute local variable in mkiv) + +local debug = require "debug" + +local getinfo = debug.getinfo +local type, next, tostring = type, next, tostring +local format, find = string.format, string.find +local is_boolean = string.is_boolean + +utilities = utilities or { } +utilities.debugger = utilities.debugger or { } +local debugger = utilities.debugger + +local counters = { } +local names = { } + +-- one + +local function hook() + local f = getinfo(2,"f").func + local n = getinfo(2,"Sn") +-- if n.what == "C" and n.name then print (n.namewhat .. ': ' .. n.name) end + if f then + local cf = counters[f] + if cf == nil then + counters[f] = 1 + names[f] = n + else + counters[f] = cf + 1 + end + end +end + +local function getname(func) + local n = names[func] + if n then + if n.what == "C" then + return n.name or '' + else + -- source short_src linedefined what name namewhat nups func + local name = n.name or n.namewhat or n.what + if not name or name == "" then name = "?" end + return format("%s : %s : %s", n.short_src or "unknown source", n.linedefined or "--", name) + end + else + return "unknown" + end +end + +function debugger.showstats(printer,threshold) + printer = printer or texio.write or print + threshold = threshold or 0 + local total, grandtotal, functions = 0, 0, 0 + printer("\n") -- ugly but ok + -- table.sort(counters) + for func, count in next, counters do + if count > threshold then + local name = getname(func) + if not find(name,"for generator") then + printer(format("%8i %s", count, name)) + total = total + count + end + end + grandtotal = grandtotal + count + functions = functions + 1 + end + printer(format("functions: %s, total: %s, grand total: %s, threshold: %s\n", functions, total, grandtotal, threshold)) +end + +-- two + + +-- rest + +function debugger.savestats(filename,threshold) + local f = io.open(filename,'w') + if f then + debugger.showstats(function(str) f:write(str) end,threshold) + f:close() + end +end + +function debugger.enable() + debug.sethook(hook,"c") +end + +function debugger.disable() + debug.sethook() +end + + + + + +local is_node = node and node.is_node + +function inspect(i) -- global function + local ti = type(i) + if ti == "table" then + table.print(i,"table") + elseif is_node and is_node(i) then + table.print(nodes.astable(i),tostring(i)) + else + print(tostring(i)) + end +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['trac-inf'] = { + version = 1.001, + comment = "companion to trac-inf.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- As we want to protect the global tables, we no longer store the timing +-- in the tables themselves but in a hidden timers table so that we don't +-- get warnings about assignments. This is more efficient than using rawset +-- and rawget. + +local format = string.format +local clock = os.gettimeofday or os.clock -- should go in environment +local write_nl = texio.write_nl + +statistics = statistics or { } +local statistics = statistics + +statistics.enable = true +statistics.threshold = 0.05 + +local statusinfo, n, registered, timers = { }, 0, { }, { } + +local function hastiming(instance) + return instance and timers[instance] +end + +local function resettiming(instance) + timers[instance or "notimer"] = { timing = 0, loadtime = 0 } +end + +local function starttiming(instance) + local timer = timers[instance or "notimer"] + if not timer then + timer = { } + timers[instance or "notimer"] = timer + end + local it = timer.timing + if not it then + it = 0 + end + if it == 0 then + timer.starttime = clock() + if not timer.loadtime then + timer.loadtime = 0 + end + end + timer.timing = it + 1 +end + +local function stoptiming(instance, report) + local timer = timers[instance or "notimer"] + local it = timer.timing + if it > 1 then + timer.timing = it - 1 + else + local starttime = timer.starttime + if starttime then + local stoptime = clock() + local loadtime = stoptime - starttime + timer.stoptime = stoptime + timer.loadtime = timer.loadtime + loadtime + if report then + statistics.report("load time %0.3f",loadtime) + end + timer.timing = 0 + return loadtime + end + end + return 0 +end + +local function elapsedtime(instance) + local timer = timers[instance or "notimer"] + return format("%0.3f",timer and timer.loadtime or 0) +end + +local function elapsedindeed(instance) + local timer = timers[instance or "notimer"] + return (timer and timer.loadtime or 0) > statistics.threshold +end + +local function elapsedseconds(instance,rest) -- returns nil if 0 seconds + if elapsedindeed(instance) then + return format("%s seconds %s", elapsedtime(instance),rest or "") + end +end + +statistics.hastiming = hastiming +statistics.resettiming = resettiming +statistics.starttiming = starttiming +statistics.stoptiming = stoptiming +statistics.elapsedtime = elapsedtime +statistics.elapsedindeed = elapsedindeed +statistics.elapsedseconds = elapsedseconds + +-- general function + +function statistics.register(tag,fnc) + if statistics.enable and type(fnc) == "function" then + local rt = registered[tag] or (#statusinfo + 1) + statusinfo[rt] = { tag, fnc } + registered[tag] = rt + if #tag > n then n = #tag end + end +end + +function statistics.show(reporter) + if statistics.enable then + if not reporter then reporter = function(tag,data,n) write_nl(tag .. " " .. data) end end + -- this code will move + local register = statistics.register + register("luatex banner", function() + return string.lower(status.banner) + end) + register("control sequences", function() + return format("%s of %s", status.cs_count, status.hash_size+status.hash_extra) + end) + register("callbacks", function() + local total, indirect = status.callbacks or 0, status.indirect_callbacks or 0 + return format("%s direct, %s indirect, %s total", total-indirect, indirect, total) + end) + collectgarbage("collect") + register("current memory usage", statistics.memused) + register("runtime",statistics.runtime) + for i=1,#statusinfo do + local s = statusinfo[i] + local r = s[2]() + if r then + reporter(s[1],r,n) + end + end + write_nl("") -- final newline + statistics.enable = false + end +end + +local template, report_statistics, nn = nil, nil, 0 -- we only calcute it once + +function statistics.showjobstat(tag,data,n) + if not logs then + -- sorry + elseif type(data) == "table" then + for i=1,#data do + statistics.showjobstat(tag,data[i],n) + end + else + if not template or n > nn then + template, n = format("%%-%ss - %%s",n), nn + report_statistics = logs.reporter("mkiv lua stats") + end + report_statistics(format(template,tag,data)) + end +end + +function statistics.memused() -- no math.round yet -) + local round = math.round or math.floor + return format("%s MB (ctx: %s MB)",round(collectgarbage("count")/1000), round(status.luastate_bytes/1000000)) +end + +starttiming(statistics) + +function statistics.formatruntime(runtime) -- indirect so it can be overloaded and + return format("%s seconds", runtime) -- indeed that happens in cure-uti.lua +end + +function statistics.runtime() + stoptiming(statistics) + return statistics.formatruntime(elapsedtime(statistics)) +end + +function statistics.timed(action,report) + report = report or logs.reporter("system") + starttiming("run") + action() + stoptiming("run") + report("total runtime: %s",elapsedtime("run")) +end + +-- where, not really the best spot for this: + +commands = commands or { } + +function commands.resettimer(name) + resettiming(name or "whatever") + starttiming(name or "whatever") +end + +function commands.elapsedtime(name) + stoptiming(name or "whatever") + tex.sprint(elapsedtime(name or "whatever")) +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['trac-set'] = { -- might become util-set.lua + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local type, next, tostring = type, next, tostring +local concat = table.concat +local format, find, lower, gsub, escapedpattern = string.format, string.find, string.lower, string.gsub, string.escapedpattern +local is_boolean = string.is_boolean +local settings_to_hash = utilities.parsers.settings_to_hash +local allocate = utilities.storage.allocate + +utilities = utilities or { } +local utilities = utilities +utilities.setters = utilities.setters or { } +local setters = utilities.setters + +local data = { } -- maybe just local + +-- We can initialize from the cnf file. This is sort of tricky as +-- later defined setters also need to be initialized then. If set +-- this way, we need to ensure that they are not reset later on. + +local trace_initialize = false -- only for testing during development + +function setters.initialize(filename,name,values) -- filename only for diagnostics + local setter = data[name] + if setter then + local data = setter.data + if data then + for key, value in next, values do + -- key = gsub(key,"_",".") + value = is_boolean(value,value) + local functions = data[key] + if functions then + if #functions > 0 and not functions.value then + if trace_initialize then + setter.report("executing %s (%s -> %s)",key,filename,tostring(value)) + end + for i=1,#functions do + functions[i](value) + end + functions.value = value + else + if trace_initialize then + setter.report("skipping %s (%s -> %s)",key,filename,tostring(value)) + end + end + else + -- we do a simple preregistration i.e. not in the + -- list as it might be an obsolete entry + functions = { default = value } + data[key] = functions + if trace_initialize then + setter.report("storing %s (%s -> %s)",key,filename,tostring(value)) + end + end + end + return true + end + end +end + +-- user interface code + +local function set(t,what,newvalue) + local data, done = t.data, t.done + if type(what) == "string" then + what = settings_to_hash(what) -- inefficient but ok + end + if type(what) ~= "table" then + return + end + for w, value in next, what do + if value == "" then + value = newvalue + elseif not value then + value = false -- catch nil + else + value = is_boolean(value,value) + end + w = "^" .. escapedpattern(w,true) .. "$" -- new: anchored + for name, functions in next, data do + if done[name] then + -- prevent recursion due to wildcards + elseif find(name,w) then + done[name] = true + for i=1,#functions do + functions[i](value) + end + functions.value = value + end + end + end +end + +local function reset(t) + for name, functions in next, t.data do + for i=1,#functions do + functions[i](false) + end + functions.value = false + end +end + +local function enable(t,what) + set(t,what,true) +end + +local function disable(t,what) + local data = t.data + if not what or what == "" then + t.done = { } + reset(t) + else + set(t,what,false) + end +end + +function setters.register(t,what,...) + local data = t.data + what = lower(what) + local functions = data[what] + if not functions then + functions = { } + data[what] = functions + if trace_initialize then + t.report("defining %s",what) + end + end + local default = functions.default -- can be set from cnf file + for _, fnc in next, { ... } do + local typ = type(fnc) + if typ == "string" then + if trace_initialize then + t.report("coupling %s to %s",what,fnc) + end + local s = fnc -- else wrong reference + fnc = function(value) set(t,s,value) end + elseif typ ~= "function" then + fnc = nil + end + if fnc then + functions[#functions+1] = fnc + -- default: set at command line or in cnf file + -- value : set in tex run (needed when loading runtime) + local value = functions.value or default + if value ~= nil then + fnc(value) + functions.value = value + end + end + end + return false -- so we can use it in an assignment +end + +function setters.enable(t,what) + local e = t.enable + t.enable, t.done = enable, { } + enable(t,what) + t.enable, t.done = e, { } +end + +function setters.disable(t,what) + local e = t.disable + t.disable, t.done = disable, { } + disable(t,what) + t.disable, t.done = e, { } +end + +function setters.reset(t) + t.done = { } + reset(t) +end + +function setters.list(t) -- pattern + local list = table.sortedkeys(t.data) + local user, system = { }, { } + for l=1,#list do + local what = list[l] + if find(what,"^%*") then system[#system+1] = what else - user[#user+1] = what + user[#user+1] = what + end + end + return user, system +end + +function setters.show(t) + local category = t.name + local list = setters.list(t) + t.report() + for k=1,#list do + local name = list[k] + local functions = t.data[name] + if functions then + local value, default, modules = functions.value, functions.default, #functions + value = value == nil and "unset" or tostring(value) + default = default == nil and "unset" or tostring(default) + t.report("%-30s modules: %2i default: %6s value: %6s",name,modules,default,value) + end + end + t.report() +end + +-- we could have used a bit of oo and the trackers:enable syntax but +-- there is already a lot of code around using the singular tracker + +-- we could make this into a module but we also want the rest avaliable + +local enable, disable, register, list, show = setters.enable, setters.disable, setters.register, setters.list, setters.show + +local function report(setter,...) + local report = logs and logs.report + if report then + report(setter.name,...) + else -- fallback, as this module is loaded before the logger + write_nl(format("%-15s : %s\n",setter.name,format(...))) + end +end + +function setters.new(name) + local setter -- we need to access it in setter itself + setter = { + data = allocate(), -- indexed, but also default and value fields + name = name, + report = function(...) report (setter,...) end, + enable = function(...) enable (setter,...) end, + disable = function(...) disable (setter,...) end, + register = function(...) register(setter,...) end, + list = function(...) list (setter,...) end, + show = function(...) show (setter,...) end, + } + data[name] = setter + return setter +end + +trackers = setters.new("trackers") +directives = setters.new("directives") +experiments = setters.new("experiments") + +local t_enable, t_disable, t_report = trackers .enable, trackers .disable, trackers .report +local d_enable, d_disable, d_report = directives .enable, directives .disable, directives .report +local e_enable, e_disable, e_report = experiments.enable, experiments.disable, experiments.report + +-- nice trick: we overload two of the directives related functions with variants that +-- do tracing (itself using a tracker) .. proof of concept + +local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end) +local trace_experiments = false local trace_experiments = false trackers.register("system.experiments", function(v) trace_experiments = v end) + +function directives.enable(...) + if trace_directives then + d_report("enabling: %s",concat({...}," ")) + end + d_enable(...) +end + +function directives.disable(...) + if trace_directives then + d_report("disabling: %s",concat({...}," ")) + end + d_disable(...) +end + +function experiments.enable(...) + if trace_experiments then + e_report("enabling: %s",concat({...}," ")) + end + e_enable(...) +end + +function experiments.disable(...) + if trace_experiments then + e_report("disabling: %s",concat({...}," ")) + end + e_disable(...) +end + +-- a useful example + +directives.register("system.nostatistics", function(v) + statistics.enable = not v +end) + +directives.register("system.nolibraries", function(v) + libraries = nil -- we discard this tracing for security +end) + +-- experiment + +local flags = environment and environment.engineflags + +if flags then + if trackers and flags.trackers then + setters.initialize("flags","trackers", settings_to_hash(flags.trackers)) + -- t_enable(flags.trackers) + end + if directives and flags.directives then + setters.initialize("flags","directives", settings_to_hash(flags.directives)) + -- d_enable(flags.directives) + end +end + +-- here + +if texconfig then + + local function set(k,v) + v = tonumber(v) + if v then + texconfig[k] = v + end + end + + directives.register("luatex.expanddepth", function(v) set("expand_depth",v) end) + directives.register("luatex.hashextra", function(v) set("hash_extra",v) end) + directives.register("luatex.nestsize", function(v) set("nest_size",v) end) + directives.register("luatex.maxinopen", function(v) set("max_in_open",v) end) + directives.register("luatex.maxprintline", function(v) set("max_print_line",v) end) + directives.register("luatex.maxstrings", function(v) set("max_strings",v) end) + directives.register("luatex.paramsize", function(v) set("param_size",v) end) + directives.register("luatex.savesize", function(v) set("save_size",v) end) + directives.register("luatex.stacksize", function(v) set("stack_size",v) end) + +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['trac-log'] = { + version = 1.001, + comment = "companion to trac-log.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- todo: less categories, more subcategories (e.g. nodes) + + +local write_nl, write = texio and texio.write_nl or print, texio and texio.write or io.write +local format, gmatch, find = string.format, string.gmatch, string.find +local concat, insert, remove = table.concat, table.insert, table.remove +local escapedpattern = string.escapedpattern +local texcount = tex and tex.count +local next, type = next, type + +local setmetatableindex = table.setmetatableindex + +--[[ldx-- +

This is a prelude to a more extensive logging module. We no longer +provide based logging a sparsing is relatively easy anyway.

+--ldx]]-- + +logs = logs or { } +local logs = logs + +local moreinfo = [[ +More information about ConTeXt and the tools that come with it can be found at: + +maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context +webpage : http://www.pragma-ade.nl / http://tex.aanhet.net +wiki : http://contextgarden.net +]] + +-- basic loggers + +local function ignore() end + +setmetatableindex(logs, function(t,k) t[k] = ignore ; return ignore end) + +local report, subreport, status, settarget, setformats, settranslations + +local direct, subdirect, writer, pushtarget, poptarget + +if tex and tex.jobname or tex.formatname then + + local valueiskey = { __index = function(t,k) t[k] = k return k end } -- will be helper + + local target = "term and log" + + logs.flush = io.flush + + local formats = { } setmetatable(formats, valueiskey) + local translations = { } setmetatable(translations,valueiskey) + + writer = function(...) + write_nl(target,...) + end + + report = function(a,b,c,...) + if c then + write_nl(target,format("%-15s > %s\n",translations[a],format(formats[b],c,...))) + elseif b then + write_nl(target,format("%-15s > %s\n",translations[a],formats[b])) + elseif a then + write_nl(target,format("%-15s >\n", translations[a])) + else + write_nl(target,"\n") + end + end + + direct = function(a,b,c,...) + if c then + return format("%-15s > %s",translations[a],format(formats[b],c,...)) + elseif b then + return format("%-15s > %s",translations[a],formats[b]) + elseif a then + return format("%-15s >", translations[a]) + else + return "" + end + end + + subreport = function(a,s,b,c,...) + if c then + write_nl(target,format("%-15s > %s > %s\n",translations[a],translations[s],format(formats[b],c,...))) + elseif b then + write_nl(target,format("%-15s > %s > %s\n",translations[a],translations[s],formats[b])) + elseif a then + write_nl(target,format("%-15s > %s >\n", translations[a],translations[s])) + else + write_nl(target,"\n") + end + end + + subdirect = function(a,s,b,c,...) + if c then + return format("%-15s > %s > %s",translations[a],translations[s],format(formats[b],c,...)) + elseif b then + return format("%-15s > %s > %s",translations[a],translations[s],formats[b]) + elseif a then + return format("%-15s > %s >", translations[a],translations[s]) + else + return "" + end + end + + status = function(a,b,c,...) + if c then + write_nl(target,format("%-15s : %s\n",translations[a],format(formats[b],c,...))) + elseif b then + write_nl(target,format("%-15s : %s\n",translations[a],formats[b])) + elseif a then + write_nl(target,format("%-15s :\n", translations[a])) + else + write_nl(target,"\n") + end + end + + local targets = { + logfile = "log", + log = "log", + file = "log", + console = "term", + terminal = "term", + both = "term and log", + } + + settarget = function(whereto) + target = targets[whereto or "both"] or targets.both + if target == "term" or target == "term and log" then + logs.flush = io.flush + else + logs.flush = ignore + end + end + + local stack = { } + + pushtarget = function(newtarget) + insert(stack,target) + settarget(newtarget) + end + + poptarget = function() + if #stack > 0 then + settarget(remove(stack)) + end + end + + setformats = function(f) + formats = f + end + + settranslations = function(t) + translations = t + end + +else + + logs.flush = ignore + + writer = write_nl + + report = function(a,b,c,...) + if c then + write_nl(format("%-15s | %s",a,format(b,c,...))) + elseif b then + write_nl(format("%-15s | %s",a,b)) + elseif a then + write_nl(format("%-15s |", a)) + else + write_nl("") + end + end + + subreport = function(a,sub,b,c,...) + if c then + write_nl(format("%-15s | %s | %s",a,sub,format(b,c,...))) + elseif b then + write_nl(format("%-15s | %s | %s",a,sub,b)) + elseif a then + write_nl(format("%-15s | %s |", a,sub)) + else + write_nl("") + end + end + + status = function(a,b,c,...) -- not to be used in lua anyway + if c then + write_nl(format("%-15s : %s\n",a,format(b,c,...))) + elseif b then + write_nl(format("%-15s : %s\n",a,b)) -- b can have %'s + elseif a then + write_nl(format("%-15s :\n", a)) + else + write_nl("\n") + end + end + + direct = ignore + subdirect = ignore + + settarget = ignore + pushtarget = ignore + poptarget = ignore + setformats = ignore + settranslations = ignore + +end + +logs.report = report +logs.subreport = subreport +logs.status = status +logs.settarget = settarget +logs.pushtarget = pushtarget +logs.poptarget = poptarget +logs.setformats = setformats +logs.settranslations = settranslations + +logs.direct = direct +logs.subdirect = subdirect +logs.writer = writer + +-- installer + +-- todo: renew (un) locks when a new one is added and wildcard + +local data, states = { }, nil + +function logs.reporter(category,subcategory) + local logger = data[category] + if not logger then + local state = false + if states == true then + state = true + elseif type(states) == "table" then + for c, _ in next, states do + if find(category,c) then + state = true + break + end + end + end + logger = { + reporters = { }, + state = state, + } + data[category] = logger + end + local reporter = logger.reporters[subcategory or "default"] + if not reporter then + if subcategory then + reporter = function(...) + if not logger.state then + subreport(category,subcategory,...) + end + end + logger.reporters[subcategory] = reporter + else + local tag = category + reporter = function(...) + if not logger.state then + report(category,...) + end + end + logger.reporters.default = reporter + end + end + return reporter +end + +logs.new = logs.reporter -- for old times sake + +-- context specicific: this ends up in the macro stream + +local ctxreport = logs.writer + +function logs.setmessenger(m) + ctxreport = m +end + +function logs.messenger(category,subcategory) + -- we need to avoid catcode mess (todo: fast context) + if subcategory then + return function(...) + ctxreport(subdirect(category,subcategory,...)) + end + else + return function(...) + ctxreport(direct(category,...)) + end + end +end + +-- so far + +local function setblocked(category,value) + if category == true then + -- lock all + category, value = "*", true + elseif category == false then + -- unlock all + category, value = "*", false + elseif value == nil then + -- lock selective + value = true + end + if category == "*" then + states = value + for k, v in next, data do + v.state = value + end + else + states = utilities.parsers.settings_to_hash(category) + for c, _ in next, states do + if data[c] then + v.state = value + else + c = escapedpattern(c,true) + for k, v in next, data do + if find(k,c) then + v.state = value + end + end + end + end + end +end + +function logs.disable(category,value) + setblocked(category,value == nil and true or value) +end + +function logs.enable(category) + setblocked(category,false) +end + +function logs.categories() + return table.sortedkeys(data) +end + +function logs.show() + local n, c, s, max = 0, 0, 0, 0 + for category, v in table.sortedpairs(data) do + n = n + 1 + local state = v.state + local reporters = v.reporters + local nc = #category + if nc > c then + c = nc + end + for subcategory, _ in next, reporters do + local ns = #subcategory + if ns > c then + s = ns + end + local m = nc + ns + if m > max then + max = m + end + end + local subcategories = concat(table.sortedkeys(reporters),", ") + if state == true then + state = "disabled" + elseif state == false then + state = "enabled" + else + state = "unknown" + end + -- no new here + report("logging","category: '%s', subcategories: '%s', state: '%s'",category,subcategories,state) + end + report("logging","categories: %s, max category: %s, max subcategory: %s, max combined: %s",n,c,s,max) +end + +directives.register("logs.blocked", function(v) + setblocked(v,true) +end) + +directives.register("logs.target", function(v) + settarget(v) +end) + +-- tex specific loggers (might move elsewhere) + +local report_pages = logs.reporter("pages") -- not needed but saves checking when we grep for it + +local real, user, sub + +function logs.start_page_number() + real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno +end + +function logs.stop_page_number() + if real > 0 then + if user > 0 then + if sub > 0 then + report_pages("flushing realpage %s, userpage %s, subpage %s",real,user,sub) + else + report_pages("flushing realpage %s, userpage %s",real,user) + end + else + report_pages("flushing realpage %s",real) + end + else + report_pages("flushing page") + end + logs.flush() +end + +logs.report_job_stat = statistics and statistics.showjobstat + +local report_files = logs.reporter("files") + +local nesting = 0 +local verbose = false +local hasscheme = url.hasscheme + +-- we don't have show_open and show_close callbacks yet + +function logs.show_open(name) + -- if hasscheme(name) ~= "virtual" then + -- if verbose then + -- nesting = nesting + 1 + -- report_files("level %s, opening %s",nesting,name) + -- else + -- write(format("(%s",name)) -- tex adds a space + -- end + -- end +end + +function logs.show_close(name) + -- if hasscheme(name) ~= "virtual" then + -- if verbose then + -- report_files("level %s, closing %s",nesting,name) + -- nesting = nesting - 1 + -- else + -- write(")") -- tex adds a space + -- end + -- end +end + +function logs.show_load(name) + -- if hasscheme(name) ~= "virtual" then + -- if verbose then + -- report_files("level %s, loading %s",nesting+1,name) + -- else + -- write(format("(%s)",name)) + -- end + -- end +end + +-- there may be scripts out there using this: + +local simple = logs.reporter("comment") + +logs.simple = simple +logs.simpleline = simple + +-- obsolete + +function logs.setprogram () end -- obsolete +function logs.extendbanner() end -- obsolete +function logs.reportlines () end -- obsolete +function logs.reportbanner() end -- obsolete +function logs.reportline () end -- obsolete +function logs.simplelines () end -- obsolete +function logs.help () end -- obsolete + +-- applications + +local function reportlines(t,str) + if str then + for line in gmatch(str,"(.-)[\n\r]") do + t.report(line) + end + end +end + +local function reportbanner(t) + local banner = t.banner + if banner then + t.report(banner) + t.report() + end +end + +local function reporthelp(t,...) + local helpinfo = t.helpinfo + if type(helpinfo) == "string" then + reportlines(t,helpinfo) + elseif type(helpinfo) == "table" then + local tags = { ... } + for i=1,#tags do + reportlines(t,t.helpinfo[tags[i]]) + if i < #tags then + t.report() + end + end + end +end + +local function reportinfo(t) + t.report() + reportlines(t,moreinfo) +end + +function logs.application(t) + t.name = t.name or "unknown" + t.banner = t.banner + t.report = logs.reporter(t.name) + t.help = function(...) reportbanner(t) ; reporthelp(t,...) ; reportinfo(t) end + t.identify = function() reportbanner(t) end + return t +end + +-- somewhat special + +-- logging to a file + + +function logs.system(whereto,process,jobname,category,...) + local message = format("%s %s => %s => %s => %s\r",os.date("%d/%m/%y %H:%m:%S"),process,jobname,category,format(...)) + for i=1,10 do + local f = io.open(whereto,"a") -- we can consider keepint the file open + if f then + f:write(message) + f:close() + break + else + sleep(0.1) + end + end +end + +local report_system = logs.reporter("system","logs") + +function logs.obsolete(old,new) + local o = loadstring("return " .. new)() + if type(o) == "function" then + return function(...) + report_system("function %s is obsolete, use %s",old,new) + loadstring(old .. "=" .. new .. " return ".. old)()(...) + end + elseif type(o) == "table" then + local t, m = { }, { } + m.__index = function(t,k) + report_system("table %s is obsolete, use %s",old,new) + m.__index, m.__newindex = o, o + return o[k] + end + m.__newindex = function(t,k,v) + report_system("table %s is obsolete, use %s",old,new) + m.__index, m.__newindex = o, o + o[k] = v + end + if libraries then + libraries.obsolete[old] = t -- true + end + setmetatable(t,m) + return t + end +end + +if utilities then + utilities.report = report_system +end + +if tex and tex.error then + function logs.texerrormessage(...) -- for the moment we put this function here + tex.error(format(...), { }) + end +else + function logs.texerrormessage(...) + print(format(...)) + end +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['trac-pro'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local getmetatable, setmetatable, rawset, type = getmetatable, setmetatable, rawset, type + +-- The protection implemented here is probably not that tight but good enough to catch +-- problems due to naive usage. +-- +-- There's a more extensive version (trac-xxx.lua) that supports nesting. +-- +-- This will change when we have _ENV in lua 5.2+ + +local trace_namespaces = false trackers.register("system.namespaces", function(v) trace_namespaces = v end) + +local report_system = logs.reporter("system","protection") + +namespaces = namespaces or { } +local namespaces = namespaces + +local registered = { } + +local function report_index(k,name) + if trace_namespaces then + report_system("reference to '%s' in protected namespace '%s', %s",k,name,debug.traceback()) + else + report_system("reference to '%s' in protected namespace '%s'",k,name) + end +end + +local function report_newindex(k,name) + if trace_namespaces then + report_system("assignment to '%s' in protected namespace '%s', %s",k,name,debug.traceback()) + else + report_system("assignment to '%s' in protected namespace '%s'",k,name) + end +end + +local function register(name) + local data = name == "global" and _G or _G[name] + if not data then + return -- error + end + registered[name] = data + local m = getmetatable(data) + if not m then + m = { } + setmetatable(data,m) + end + local index, newindex = { }, { } + m.__saved__index = m.__index + m.__no__index = function(t,k) + if not index[k] then + index[k] = true + report_index(k,name) + end + return nil + end + m.__saved__newindex = m.__newindex + m.__no__newindex = function(t,k,v) + if not newindex[k] then + newindex[k] = true + report_newindex(k,name) + end + rawset(t,k,v) + end + m.__protection__depth = 0 +end + +local function private(name) -- maybe save name + local data = registered[name] + if not data then + data = _G[name] + if not data then + data = { } + _G[name] = data + end + register(name) + end + return data +end + +local function protect(name) + local data = registered[name] + if not data then + return + end + local m = getmetatable(data) + local pd = m.__protection__depth + if pd > 0 then + m.__protection__depth = pd + 1 + else + m.__save_d_index, m.__saved__newindex = m.__index, m.__newindex + m.__index, m.__newindex = m.__no__index, m.__no__newindex + m.__protection__depth = 1 + end +end + +local function unprotect(name) + local data = registered[name] + if not data then + return + end + local m = getmetatable(data) + local pd = m.__protection__depth + if pd > 1 then + m.__protection__depth = pd - 1 + else + m.__index, m.__newindex = m.__saved__index, m.__saved__newindex + m.__protection__depth = 0 + end +end + +local function protectall() + for name, _ in next, registered do + if name ~= "global" then + protect(name) + end + end +end + +local function unprotectall() + for name, _ in next, registered do + if name ~= "global" then + unprotect(name) + end + end +end + +namespaces.register = register -- register when defined +namespaces.private = private -- allocate and register if needed +namespaces.protect = protect +namespaces.unprotect = unprotect +namespaces.protectall = protectall +namespaces.unprotectall = unprotectall + +namespaces.private("namespaces") registered = { } register("global") -- unreachable + +directives.register("system.protect", function(v) + if v then + protectall() + else + unprotectall() + end +end) + +directives.register("system.checkglobals", function(v) + if v then + report_system("enabling global namespace guard") + protect("global") + else + report_system("disabling global namespace guard") + unprotect("global") + end +end) + +-- dummy section (will go to luat-dum.lua) + + + + + + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['luat-env'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- A former version provided functionality for non embeded core +-- scripts i.e. runtime library loading. Given the amount of +-- Lua code we use now, this no longer makes sense. Much of this +-- evolved before bytecode arrays were available and so a lot of +-- code has disappeared already. + +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) + +local report_lua = logs.reporter("resolvers","lua") + +local allocate, mark = utilities.storage.allocate, utilities.storage.mark + +local format, sub, match, gsub, find = string.format, string.sub, string.match, string.gsub, string.find +local unquoted, quoted = string.unquoted, string.quoted +local concat = table.concat + +-- precautions + +os.setlocale(nil,nil) -- useless feature and even dangerous in luatex + +function os.setlocale() + -- no way you can mess with it +end + +-- dirty tricks + +if arg and (arg[0] == 'luatex' or arg[0] == 'luatex.exe') and arg[1] == "--luaonly" then + arg[-1] = arg[0] + arg[ 0] = arg[2] + for k=3,#arg do + arg[k-2] = arg[k] + end + arg[#arg] = nil -- last + arg[#arg] = nil -- pre-last +end + +-- environment + +environment = environment or { } +local environment = environment + +environment.arguments = allocate() +environment.files = allocate() +environment.sortedflags = nil + +local mt = { + __index = function(_,k) + if k == "version" then + local version = tex.toks and tex.toks.contextversiontoks + if version and version ~= "" then + rawset(environment,"version",version) + return version + else + return "unknown" + end + elseif k == "jobname" or k == "formatname" then + local name = tex and tex[k] + if name or name== "" then + rawset(environment,k,name) + return name + else + return "unknown" + end + elseif k == "outputfilename" then + local name = environment.jobname + rawset(environment,k,name) + return name + end + end +} + +setmetatable(environment,mt) + +function environment.initializearguments(arg) + local arguments, files = { }, { } + environment.arguments, environment.files, environment.sortedflags = arguments, files, nil + for index=1,#arg do + local argument = arg[index] + if index > 0 then + local flag, value = match(argument,"^%-+(.-)=(.-)$") + if flag then + arguments[flag] = unquoted(value or "") + else + flag = match(argument,"^%-+(.+)") + if flag then + arguments[flag] = true + else + files[#files+1] = argument + end + end + end + end + environment.ownname = environment.ownname or arg[0] or 'unknown.lua' +end + +function environment.setargument(name,value) + environment.arguments[name] = value +end + +-- todo: defaults, better checks e.g on type (boolean versus string) +-- +-- tricky: too many hits when we support partials unless we add +-- a registration of arguments so from now on we have 'partial' + +function environment.argument(name,partial) + local arguments, sortedflags = environment.arguments, environment.sortedflags + if arguments[name] then + return arguments[name] + elseif partial then + if not sortedflags then + sortedflags = allocate(table.sortedkeys(arguments)) + for k=1,#sortedflags do + sortedflags[k] = "^" .. sortedflags[k] + end + environment.sortedflags = sortedflags + end + -- example of potential clash: ^mode ^modefile + for k=1,#sortedflags do + local v = sortedflags[k] + if find(name,v) then + return arguments[sub(v,2,#v)] + end end end - return user, system + return nil end -function setters.show(t) - commands.writestatus("","") - local list = setters.list(t) - for k=1,#list do - commands.writestatus(t.name,list[k]) +function environment.splitarguments(separator) -- rather special, cut-off before separator + local done, before, after = false, { }, { } + local originalarguments = environment.originalarguments + for k=1,#originalarguments do + local v = originalarguments[k] + if not done and v == separator then + done = true + elseif done then + after[#after+1] = v + else + before[#before+1] = v + end end - commands.writestatus("","") + return before, after end --- we could have used a bit of oo and the trackers:enable syntax but --- there is already a lot of code around using the singular tracker +function environment.reconstructcommandline(arg,noquote) + arg = arg or environment.originalarguments + if noquote and #arg == 1 then + -- we could just do: return unquoted(resolvers.resolve(arg[i])) + local a = arg[1] + a = resolvers.resolve(a) + a = unquoted(a) + return a + elseif #arg > 0 then + local result = { } + for i=1,#arg do + -- we could just do: result[#result+1] = format("%q",unquoted(resolvers.resolve(arg[i]))) + local a = arg[i] + a = resolvers.resolve(a) + a = unquoted(a) + a = gsub(a,'"','\\"') -- tricky + if find(a," ") then + result[#result+1] = quoted(a) + else + result[#result+1] = a + end + end + return concat(result," ") + else + return "" + end +end --- we could make this into a module -function setters.new(name) - local t - t = { - data = { }, - name = name, - enable = function(...) setters.enable (t,...) end, - disable = function(...) setters.disable (t,...) end, - register = function(...) setters.register(t,...) end, - list = function(...) setters.list (t,...) end, - show = function(...) setters.show (t,...) end, - } - setters.data[name] = t - return t -end +if arg then -trackers = setters.new("trackers") -directives = setters.new("directives") -experiments = setters.new("experiments") + -- new, reconstruct quoted snippets (maybe better just remove the " then and add them later) + local newarg, instring = { }, false --- nice trick: we overload two of the directives related functions with variants that --- do tracing (itself using a tracker) .. proof of concept + for index=1,#arg do + local argument = arg[index] + if find(argument,"^\"") then + newarg[#newarg+1] = gsub(argument,"^\"","") + if not find(argument,"\"$") then + instring = true + end + elseif find(argument,"\"$") then + newarg[#newarg] = newarg[#newarg] .. " " .. gsub(argument,"\"$","") + instring = false + elseif instring then + newarg[#newarg] = newarg[#newarg] .. " " .. argument + else + newarg[#newarg+1] = argument + end + end + for i=1,-5,-1 do + newarg[i] = arg[i] + end -local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end) -local trace_experiments = false local trace_experiments = false trackers.register("system.experiments", function(v) trace_experiments = v end) + environment.initializearguments(newarg) -local e = directives.enable -local d = directives.disable + environment.originalarguments = mark(newarg) + environment.rawarguments = mark(arg) -function directives.enable(...) - commands.writestatus("directives","enabling: %s",concat({...}," ")) - e(...) -end + arg = { } -- prevent duplicate handling -function directives.disable(...) - commands.writestatus("directives","disabling: %s",concat({...}," ")) - d(...) end -local e = experiments.enable -local d = experiments.disable +-- weird place ... depends on a not yet loaded module -function experiments.enable(...) - commands.writestatus("experiments","enabling: %s",concat({...}," ")) - e(...) +function environment.texfile(filename) + return resolvers.findfile(filename,'tex') end -function experiments.disable(...) - commands.writestatus("experiments","disabling: %s",concat({...}," ")) - d(...) +function environment.luafile(filename) + local resolved = resolvers.findfile(filename,'tex') or "" + if resolved ~= "" then + return resolved + end + resolved = resolvers.findfile(filename,'texmfscripts') or "" + if resolved ~= "" then + return resolved + end + return resolvers.findfile(filename,'luatexlibs') or "" end --- a useful example +environment.loadedluacode = loadfile -- can be overloaded -directives.register("system.nostatistics", function(v) - statistics.enable = not v -end) +function environment.luafilechunk(filename,silent) -- used for loading lua bytecode in the format + filename = file.replacesuffix(filename, "lua") + local fullname = environment.luafile(filename) + if fullname and fullname ~= "" then + local data = environment.loadedluacode(fullname) + if trace_locating then + report_lua("loading file %s%s", fullname, not data and " failed" or "") + elseif not silent then + texio.write("<",data and "+ " or "- ",fullname,">") + end + return data + else + if trace_locating then + report_lua("unknown file %s", filename) + end + return nil + end +end + +-- the next ones can use the previous ones / combine +function environment.loadluafile(filename, version) + local lucname, luaname, chunk + local basename = file.removesuffix(filename) + if basename == filename then + lucname, luaname = basename .. ".luc", basename .. ".lua" + else + lucname, luaname = nil, basename -- forced suffix + end + -- when not overloaded by explicit suffix we look for a luc file first + local fullname = (lucname and environment.luafile(lucname)) or "" + if fullname ~= "" then + if trace_locating then + report_lua("loading %s", fullname) + end + chunk = loadfile(fullname) -- this way we don't need a file exists check + end + if chunk then + assert(chunk)() + if version then + -- we check of the version number of this chunk matches + local v = version -- can be nil + if modules and modules[filename] then + v = modules[filename].version -- new method + elseif versions and versions[filename] then + v = versions[filename] -- old method + end + if v == version then + return true + else + if trace_locating then + report_lua("version mismatch for %s: lua=%s, luc=%s", filename, v, version) + end + environment.loadluafile(filename) + end + else + return true + end + end + fullname = (luaname and environment.luafile(luaname)) or "" + if fullname ~= "" then + if trace_locating then + report_lua("loading %s", fullname) + end + chunk = loadfile(fullname) -- this way we don't need a file exists check + if not chunk then + if trace_locating then + report_lua("unknown file %s", filename) + end + else + assert(chunk)() + return true + end + end + return false +end end -- of closure @@ -3991,6 +6263,8 @@ if not modules then modules = { } end modules ['lxml-tab'] = { local trace_entities = false trackers.register("xml.entities", function(v) trace_entities = v end) +local report_xml = logs and logs.reporter("xml","core") or function(...) print(format(...)) end + --[[ldx--

The parser used here is inspired by the variant discussed in the lua book, but handles comment and processing instructions, has a different structure, provides @@ -4001,11 +6275,15 @@ The find based parser can be found in l-xml-edu.lua along with other older code.

Beware, the interface may change. For instance at, ns, tg, dt may get more verbose names. Once the code is stable we will also remove some tracing and optimize the code.

+ +

I might even decide to reimplement the parser using the latest trickery +as the current variant was written when showed up and it's easier now to +build tables in one go.

--ldx]]-- xml = xml or { } +local xml = xml ---~ local xml = xml local concat, remove, insert = table.concat, table.remove, table.insert local type, next, setmetatable, getmetatable, tonumber = type, next, setmetatable, getmetatable, tonumber @@ -4129,7 +6407,7 @@ local dcache, hcache, acache = { }, { }, { } local mt = { } -function initialize_mt(root) +local function initialize_mt(root) mt = { __index = root } -- will be redefined later end @@ -4137,8 +6415,8 @@ function xml.setproperty(root,k,v) getmetatable(root).__index[k] = v end -function xml.check_error(top,toclose) - return "" +function xml.checkerror(top,toclose) + return "" -- can be set end local function add_attribute(namespace,tag,value) @@ -4194,9 +6472,9 @@ local function add_end(spacing, namespace, tag) local toclose = remove(stack) top = stack[#stack] if #stack < 1 then - errorstr = format("nothing to close with %s %s", tag, xml.check_error(top,toclose) or "") + errorstr = format("nothing to close with %s %s", tag, xml.checkerror(top,toclose) or "") elseif toclose.tg ~= tag then -- no namespace check - errorstr = format("unable to close %s with %s %s", toclose.tg, tag, xml.check_error(top,toclose) or "") + errorstr = format("unable to close %s with %s %s", toclose.tg, tag, xml.checkerror(top,toclose) or "") end dt = top.dt dt[#dt+1] = toclose @@ -4233,24 +6511,29 @@ local reported_attribute_errors = { } local function attribute_value_error(str) if not reported_attribute_errors[str] then - logs.report("xml","invalid attribute value: %q",str) + report_xml("invalid attribute value: %q",str) reported_attribute_errors[str] = true at._error_ = str end return str end + local function attribute_specification_error(str) if not reported_attribute_errors[str] then - logs.report("xml","invalid attribute specification: %q",str) + report_xml("invalid attribute specification: %q",str) reported_attribute_errors[str] = true at._error_ = str end return str end -function xml.unknown_dec_entity_format(str) return (str == "" and "&error;") or format("&%s;",str) end -function xml.unknown_hex_entity_format(str) return format("&#x%s;",str) end -function xml.unknown_any_entity_format(str) return format("&#x%s;",str) end +xml.placeholders = { + unknown_dec_entity = function(str) return (str == "" and "&error;") or format("&%s;",str) end, + unknown_hex_entity = function(str) return format("&#x%s;",str) end, + unknown_any_entity = function(str) return format("&#x%s;",str) end, +} + +local placeholders = xml.placeholders local function fromhex(s) local n = tonumber(s,16) @@ -4304,18 +6587,18 @@ local function handle_hex_entity(str) h = unify_predefined and predefined_unified[n] if h then if trace_entities then - logs.report("xml","utfize, converting hex entity &#x%s; into %s",str,h) + report_xml("utfize, converting hex entity &#x%s; into %s",str,h) end elseif utfize then - h = (n and utfchar(n)) or xml.unknown_hex_entity_format(str) or "" + h = (n and utfchar(n)) or xml.unknown_hex_entity(str) or "" if not n then - logs.report("xml","utfize, ignoring hex entity &#x%s;",str) + report_xml("utfize, ignoring hex entity &#x%s;",str) elseif trace_entities then - logs.report("xml","utfize, converting hex entity &#x%s; into %s",str,h) + report_xml("utfize, converting hex entity &#x%s; into %s",str,h) end else if trace_entities then - logs.report("xml","found entity &#x%s;",str) + report_xml("found entity &#x%s;",str) end h = "&#x" .. str .. ";" end @@ -4331,18 +6614,18 @@ local function handle_dec_entity(str) d = unify_predefined and predefined_unified[n] if d then if trace_entities then - logs.report("xml","utfize, converting dec entity &#%s; into %s",str,d) + report_xml("utfize, converting dec entity &#%s; into %s",str,d) end elseif utfize then - d = (n and utfchar(n)) or xml.unknown_dec_entity_format(str) or "" + d = (n and utfchar(n)) or placeholders.unknown_dec_entity(str) or "" if not n then - logs.report("xml","utfize, ignoring dec entity &#%s;",str) + report_xml("utfize, ignoring dec entity &#%s;",str) elseif trace_entities then - logs.report("xml","utfize, converting dec entity &#%s; into %s",str,h) + report_xml("utfize, converting dec entity &#%s; into %s",str,h) end else if trace_entities then - logs.report("xml","found entity &#%s;",str) + report_xml("found entity &#%s;",str) end d = "&#" .. str .. ";" end @@ -4367,20 +6650,21 @@ local function handle_any_entity(str) end if a then if trace_entities then - logs.report("xml","resolved entity &%s; -> %s (internal)",str,a) + report_xml("resolved entity &%s; -> %s (internal)",str,a) end a = lpegmatch(parsedentity,a) or a else - if xml.unknown_any_entity_format then - a = xml.unknown_any_entity_format(str) or "" + local unknown_any_entity = placeholders.unknown_any_entity + if unknown_any_entity then + a = unknown_any_entity(str) or "" end if a then if trace_entities then - logs.report("xml","resolved entity &%s; -> %s (external)",str,a) + report_xml("resolved entity &%s; -> %s (external)",str,a) end else if trace_entities then - logs.report("xml","keeping entity &%s;",str) + report_xml("keeping entity &%s;",str) end if str == "" then a = "&error;" @@ -4392,7 +6676,7 @@ local function handle_any_entity(str) acache[str] = a elseif trace_entities then if not acache[str] then - logs.report("xml","converting entity &%s; into %s",str,a) + report_xml("converting entity &%s; into %s",str,a) acache[str] = a end end @@ -4401,7 +6685,7 @@ local function handle_any_entity(str) local a = acache[str] if not a then if trace_entities then - logs.report("xml","found entity &%s;",str) + report_xml("found entity &%s;",str) end a = resolve_predefined and predefined_simplified[str] if a then @@ -4420,7 +6704,7 @@ local function handle_any_entity(str) end local function handle_end_entity(chr) - logs.report("xml","error in entity, %q found instead of ';'",chr) + report_xml("error in entity, %q found instead of ';'",chr) end local space = S(' \r\n\t') @@ -4555,7 +6839,7 @@ local function xmlconvert(data, settings) resolve_predefined = settings.resolve_predefined_entities -- in case we have escaped entities unify_predefined = settings.unify_predefined_entities -- & -> & cleanup = settings.text_cleanup - stack, top, at, xmlns, errorstr, result, entities = { }, { }, { }, { }, nil, nil, settings.entities or { } + stack, top, at, xmlns, errorstr, entities = { }, { }, { }, { }, nil, settings.entities or { } acache, hcache, dcache = { }, { }, { } -- not stored reported_attribute_errors = { } if settings.parent_root then @@ -4583,16 +6867,17 @@ local function xmlconvert(data, settings) else errorstr = "invalid xml file - no text at all" end + local result if errorstr and errorstr ~= "" then result = { dt = { { ns = "", tg = "error", dt = { errorstr }, at={ }, er = true } } } setmetatable(stack, mt) - local error_handler = settings.error_handler - if error_handler == false then + local errorhandler = settings.error_handler + if errorhandler == false then -- no error message else - error_handler = error_handler or xml.error_handler - if error_handler then - xml.error_handler("load",errorstr) + errorhandler = errorhandler or xml.errorhandler + if errorhandler then + xml.errorhandler("load",errorstr) end end else @@ -4652,7 +6937,7 @@ function xml.is_valid(root) return root and not root.error end -xml.error_handler = (logs and logs.report) or (input and logs.report) or print +xml.errorhandler = report --[[ldx--

We cannot load an from a filehandle so we need to load @@ -4763,7 +7048,7 @@ local function verbose_element(e,handlers) ats[#ats+1] = format('%s=%q',k,v) end end - if ern and trace_remap and ern ~= ens then + if ern and trace_entities and ern ~= ens then ens = ern end if ens ~= "" then @@ -4868,7 +7153,7 @@ local function serialize(e,handlers,...) -- elseif type(e) == "string" then -- functions["@tx@"](e,handlers) else - functions["@dc@"](e,handlers) + functions["@dc@"](e,handlers) -- dc ? end if finalize then return finalize() @@ -4894,7 +7179,7 @@ local function newhandlers(settings) if settings then for k,v in next, settings do if type(v) == "table" then - tk = t[k] if not tk then tk = { } t[k] = tk end + local tk = t[k] if not tk then tk = { } t[k] = tk end for kk,vv in next, v do tk[kk] = vv end @@ -4906,6 +7191,7 @@ local function newhandlers(settings) handlers[settings.name] = t end end + utilities.storage.mark(t) return t end @@ -5005,7 +7291,7 @@ local function xmltext(root) -- inline return (root and xmltostring(root)) or "" end -function initialize_mt(root) +initialize_mt = function(root) -- redefinition mt = { __tostring = xmltext, __index = root } end @@ -5040,7 +7326,6 @@ xml.string = xmlstring

A few helpers:

--ldx]]-- ---~ xmlsetproperty(root,"settings",settings) function xml.settings(e) while e do @@ -5150,6 +7435,7 @@ function xml.makestandalone(root) end end end + return root end @@ -5166,11 +7452,14 @@ if not modules then modules = { } end modules ['lxml-pth'] = { } -- e.ni is only valid after a filter run +-- todo: B/C/[get first match] local concat, remove, insert = table.concat, table.remove, table.insert local type, next, tonumber, tostring, setmetatable, loadstring = type, next, tonumber, tostring, setmetatable, loadstring local format, upper, lower, gmatch, gsub, find, rep = string.format, string.upper, string.lower, string.gmatch, string.gsub, string.find, string.rep -local lpegmatch = lpeg.match +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns + +local setmetatableindex = table.setmetatableindex -- beware, this is not xpath ... e.g. position is different (currently) and -- we have reverse-sibling as reversed preceding sibling @@ -5202,23 +7491,33 @@ local trace_lpath = false if trackers then trackers.register("xml.path", local trace_lparse = false if trackers then trackers.register("xml.parse", function(v) trace_lparse = v end) end local trace_lprofile = false if trackers then trackers.register("xml.profile", function(v) trace_lpath = v trace_lparse = v trace_lprofile = v end) end +local report_lpath = logs.reporter("xml","lpath") + --[[ldx--

We've now arrived at an interesting part: accessing the tree using a subset of and since we're not compatible we call it . We will explain more about its usage in other documents.

--ldx]]-- +local xml = xml + local lpathcalls = 0 function xml.lpathcalls () return lpathcalls end local lpathcached = 0 function xml.lpathcached() return lpathcached end -xml.functions = xml.functions or { } -- internal -xml.expressions = xml.expressions or { } -- in expressions -xml.finalizers = xml.finalizers or { } -- fast do-with ... (with return value other than collection) -xml.specialhandler = xml.specialhandler or { } +xml.functions = xml.functions or { } -- internal +local functions = xml.functions + +xml.expressions = xml.expressions or { } -- in expressions +local expressions = xml.expressions + +xml.finalizers = xml.finalizers or { } -- fast do-with ... (with return value other than collection) +local finalizers = xml.finalizers -local functions = xml.functions -local expressions = xml.expressions -local finalizers = xml.finalizers +xml.specialhandler = xml.specialhandler or { } +local specialhandler = xml.specialhandler + +lpegpatterns.xml = lpegpatterns.xml or { } +local xmlpatterns = lpegpatterns.xml finalizers.xml = finalizers.xml or { } finalizers.tex = finalizers.tex or { } @@ -5228,14 +7527,14 @@ local function fallback (t, name) if fn then t[name] = fn else - logs.report("xml","unknown sub finalizer '%s'",tostring(name)) + report_lpath("unknown sub finalizer '%s'",tostring(name)) fn = function() end end return fn end -setmetatable(finalizers.xml, { __index = fallback }) -setmetatable(finalizers.tex, { __index = fallback }) +setmetatableindex(finalizers.xml, fallback) +setmetatableindex(finalizers.tex, fallback) xml.defaultprotocol = "xml" @@ -5283,102 +7582,106 @@ apply_axis['root'] = function(list) rt = ll end end - collected[#collected+1] = rt + collected[l] = rt end return collected end apply_axis['self'] = function(list) ---~ local collected = { } ---~ for l=1,#list do ---~ collected[#collected+1] = list[l] ---~ end ---~ return collected return list end apply_axis['child'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local dt = ll.dt - local en = 0 - for k=1,#dt do - local dk = dt[k] - if dk.tg then - collected[#collected+1] = dk - dk.ni = k -- refresh - en = en + 1 - dk.ei = en + if dt then -- weird that this is needed + local en = 0 + for k=1,#dt do + local dk = dt[k] + if dk.tg then + c = c + 1 + collected[c] = dk + dk.ni = k -- refresh + en = en + 1 + dk.ei = en + end end + ll.en = en end - ll.en = en end return collected end -local function collect(list,collected) +local function collect(list,collected,c) local dt = list.dt if dt then local en = 0 for k=1,#dt do local dk = dt[k] if dk.tg then - collected[#collected+1] = dk + c = c + 1 + collected[c] = dk dk.ni = k -- refresh en = en + 1 dk.ei = en - collect(dk,collected) + c = collect(dk,collected,c) end end list.en = en end + return c end apply_axis['descendant'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do - collect(list[l],collected) + c = collect(list[l],collected,c) end return collected end -local function collect(list,collected) +local function collect(list,collected,c) local dt = list.dt if dt then local en = 0 for k=1,#dt do local dk = dt[k] if dk.tg then - collected[#collected+1] = dk + c = c + 1 + collected[c] = dk dk.ni = k -- refresh en = en + 1 dk.ei = en - collect(dk,collected) + c = collect(dk,collected,c) end end list.en = en end + return c end apply_axis['descendant-or-self'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] if ll.special ~= true then -- catch double root - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end - collect(ll,collected) + c = collect(ll,collected,c) end return collected end apply_axis['ancestor'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] while ll do ll = ll.__p__ if ll then - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end end end @@ -5386,14 +7689,16 @@ apply_axis['ancestor'] = function(list) end apply_axis['ancestor-or-self'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll while ll do ll = ll.__p__ if ll then - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end end end @@ -5401,11 +7706,12 @@ apply_axis['ancestor-or-self'] = function(list) end apply_axis['parent'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local pl = list[l].__p__ if pl then - collected[#collected+1] = pl + c = c + 1 + collected[c] = pl end end return collected @@ -5420,43 +7726,15 @@ apply_axis['namespace'] = function(list) end apply_axis['following'] = function(list) -- incomplete ---~ local collected = { } ---~ for l=1,#list do ---~ local ll = list[l] ---~ local p = ll.__p__ ---~ local d = p.dt ---~ for i=ll.ni+1,#d do ---~ local di = d[i] ---~ if type(di) == "table" then ---~ collected[#collected+1] = di ---~ break ---~ end ---~ end ---~ end ---~ return collected return { } end apply_axis['preceding'] = function(list) -- incomplete ---~ local collected = { } ---~ for l=1,#list do ---~ local ll = list[l] ---~ local p = ll.__p__ ---~ local d = p.dt ---~ for i=ll.ni-1,1,-1 do ---~ local di = d[i] ---~ if type(di) == "table" then ---~ collected[#collected+1] = di ---~ break ---~ end ---~ end ---~ end ---~ return collected return { } end apply_axis['following-sibling'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local p = ll.__p__ @@ -5464,7 +7742,8 @@ apply_axis['following-sibling'] = function(list) for i=ll.ni+1,#d do local di = d[i] if type(di) == "table" then - collected[#collected+1] = di + c = c + 1 + collected[c] = di end end end @@ -5472,7 +7751,7 @@ apply_axis['following-sibling'] = function(list) end apply_axis['preceding-sibling'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local p = ll.__p__ @@ -5480,7 +7759,8 @@ apply_axis['preceding-sibling'] = function(list) for i=1,ll.ni-1 do local di = d[i] if type(di) == "table" then - collected[#collected+1] = di + c = c + 1 + collected[c] = di end end end @@ -5488,7 +7768,7 @@ apply_axis['preceding-sibling'] = function(list) end apply_axis['reverse-sibling'] = function(list) -- reverse preceding - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local p = ll.__p__ @@ -5496,7 +7776,8 @@ apply_axis['reverse-sibling'] = function(list) -- reverse preceding for i=ll.ni-1,1,-1 do local di = d[i] if type(di) == "table" then - collected[#collected+1] = di + c = c + 1 + collected[c] = di end end end @@ -5522,7 +7803,7 @@ local function apply_nodes(list,directive,nodes) return { } end else - local collected, m, p = { }, 0, nil + local collected, c, m, p = { }, 0, 0, nil if not nns then -- only check tag for l=1,#list do local ll = list[l] @@ -5531,11 +7812,13 @@ local function apply_nodes(list,directive,nodes) if directive then if ntg == ltg then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif ntg ~= ltg then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -5547,11 +7830,13 @@ local function apply_nodes(list,directive,nodes) if directive then if lns == nns then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif lns ~= nns then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -5565,11 +7850,13 @@ local function apply_nodes(list,directive,nodes) if directive then if ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif not ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -5577,7 +7864,7 @@ local function apply_nodes(list,directive,nodes) return collected end else - local collected, m, p = { }, 0, nil + local collected, c, m, p = { }, 0, 0, nil for l=1,#list do local ll = list[l] local ltg = ll.tg @@ -5594,11 +7881,13 @@ local function apply_nodes(list,directive,nodes) if directive then if ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif not ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -5609,12 +7898,13 @@ end local quit_expression = false local function apply_expression(list,expression,order) - local collected = { } + local collected, c = { }, 0 quit_expression = false for l=1,#list do local ll = list[l] if expression(list,ll,l,order) then -- nasty, order alleen valid als n=1 - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end if quit_expression then break @@ -5653,7 +7943,9 @@ local lp_builtin = P ( P("ns") / "ll.ns" ) * ((spaces * P("(") * spaces * P(")"))/"") -local lp_attribute = (P("@") + P("attribute::")) / "" * Cc("(ll.at and ll.at['") * R("az","AZ","--","__")^1 * Cc("'])") +-- for the moment we keep namespaces with attributes + +local lp_attribute = (P("@") + P("attribute::")) / "" * Cc("(ll.at and ll.at['") * ((R("az","AZ") + S("-_:"))^1) * Cc("'])") local lp_fastpos_p = ((P("+")^0 * R("09")^1 * P(-1)) / function(s) return "l==" .. s end) local lp_fastpos_n = ((P("-") * R("09")^1 * P(-1)) / function(s) return "(" .. s .. "<0 and (#list+".. s .. "==l))" end) local lp_fastpos = lp_fastpos_n + lp_fastpos_p @@ -5714,14 +8006,12 @@ local converter = Cs ( ) cleaner = Cs ( ( ---~ lp_fastpos + lp_reserved + lp_number + lp_string + 1 )^1 ) ---~ expr local template_e = [[ local expr = xml.expressions @@ -5772,13 +8062,13 @@ local skip = { } local function errorrunner_e(str,cnv) if not skip[str] then - logs.report("lpath","error in expression: %s => %s",str,cnv) + report_lpath("error in expression: %s => %s",str,cnv) skip[str] = cnv or str end return false end local function errorrunner_f(str,arg) - logs.report("lpath","error in finalizer: %s(%s)",str,arg or "") + report_lpath("error in finalizer: %s(%s)",str,arg or "") return false end @@ -5829,7 +8119,7 @@ local special_1 = P("*") * Cc(register_auto_descendant) * Cc(register_all_nodes local special_2 = P("/") * Cc(register_auto_self) local special_3 = P("") * Cc(register_auto_self) -local parser = Ct { "patterns", -- can be made a bit faster by moving pattern outside +local pathparser = Ct { "patterns", -- can be made a bit faster by moving pattern outside patterns = spaces * V("protocol") * spaces * ( ( V("special") * spaces * P(-1) ) + @@ -5901,6 +8191,8 @@ local parser = Ct { "patterns", -- can be made a bit faster by moving pattern ou } +xmlpatterns.pathparser = pathparser + local cache = { } local function nodesettostring(set,nodetest) @@ -5910,7 +8202,7 @@ local function nodesettostring(set,nodetest) if not ns or ns == "" then ns = "*" end if not tg or tg == "" then tg = "*" end tg = (tg == "@rt@" and "[root]") or format("%s:%s",ns,tg) - t[#t+1] = (directive and tg) or format("not(%s)",tg) + t[i] = (directive and tg) or format("not(%s)",tg) end if nodetest == false then return format("not(%s)",concat(t,"|")) @@ -5929,7 +8221,7 @@ local function tagstostring(list) local ns, tg = li.ns, li.tg if not ns or ns == "" then ns = "*" end if not tg or tg == "" then tg = "*" end - t[#t+1] = (tg == "@rt@" and "[root]") or format("%s:%s",ns,tg) + t[i] = (tg == "@rt@" and "[root]") or format("%s:%s",ns,tg) end return concat(t," ") end @@ -5937,16 +8229,16 @@ end xml.nodesettostring = nodesettostring -local parse_pattern -- we have a harmless kind of circular reference +local lpath -- we have a harmless kind of circular reference + +local lshowoptions = { functions = false } local function lshow(parsed) if type(parsed) == "string" then - parsed = parse_pattern(parsed) + parsed = lpath(parsed) end - local s = table.serialize_functions -- ugly - table.serialize_functions = false -- ugly - logs.report("lpath","%s://%s => %s",parsed.protocol or xml.defaultprotocol,parsed.pattern,table.serialize(parsed,false)) - table.serialize_functions = s -- ugly + report_lpath("%s://%s => %s",parsed.protocol or xml.defaultprotocol,parsed.pattern, + table.serialize(parsed,false,lshowoptions)) end xml.lshow = lshow @@ -5960,7 +8252,7 @@ local function add_comment(p,str) end end -parse_pattern = function (pattern) -- the gain of caching is rather minimal +lpath = function (pattern) -- the gain of caching is rather minimal lpathcalls = lpathcalls + 1 if type(pattern) == "table" then return pattern @@ -5969,13 +8261,13 @@ parse_pattern = function (pattern) -- the gain of caching is rather minimal if parsed then lpathcached = lpathcached + 1 else - parsed = lpegmatch(parser,pattern) + parsed = lpegmatch(pathparser,pattern) if parsed then parsed.pattern = pattern local np = #parsed if np == 0 then parsed = { pattern = pattern, register_self, state = "parsing error" } - logs.report("lpath","parsing error in '%s'",pattern) + report_lpath("parsing error in '%s'",pattern) lshow(parsed) else -- we could have done this with a more complex parser but this @@ -6017,6 +8309,8 @@ parse_pattern = function (pattern) -- the gain of caching is rather minimal end end +xml.lpath = lpath + -- we can move all calls inline and then merge the trace back -- technically we can combine axis and the next nodes which is -- what we did before but this a bit cleaner (but slower too) @@ -6079,32 +8373,32 @@ local function traced_apply(list,parsed,nofparsed,order) if trace_lparse then lshow(parsed) end - logs.report("lpath", "collecting : %s",parsed.pattern) - logs.report("lpath", " root tags : %s",tagstostring(list)) - logs.report("lpath", " order : %s",order or "unset") + report_lpath("collecting: %s",parsed.pattern) + report_lpath("root tags : %s",tagstostring(list)) + report_lpath("order : %s",order or "unset") local collected = list for i=1,nofparsed do local pi = parsed[i] local kind = pi.kind if kind == "axis" then collected = apply_axis[pi.axis](collected) - logs.report("lpath", "% 10i : ax : %s",(collected and #collected) or 0,pi.axis) + report_lpath("% 10i : ax : %s",(collected and #collected) or 0,pi.axis) elseif kind == "nodes" then collected = apply_nodes(collected,pi.nodetest,pi.nodes) - logs.report("lpath", "% 10i : ns : %s",(collected and #collected) or 0,nodesettostring(pi.nodes,pi.nodetest)) + report_lpath("% 10i : ns : %s",(collected and #collected) or 0,nodesettostring(pi.nodes,pi.nodetest)) elseif kind == "expression" then collected = apply_expression(collected,pi.evaluator,order) - logs.report("lpath", "% 10i : ex : %s -> %s",(collected and #collected) or 0,pi.expression,pi.converted) + report_lpath("% 10i : ex : %s -> %s",(collected and #collected) or 0,pi.expression,pi.converted) elseif kind == "finalizer" then collected = pi.finalizer(collected) - logs.report("lpath", "% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pi.name,pi.arguments or "") + report_lpath("% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pi.name,pi.arguments or "") return collected end if not collected or #collected == 0 then local pn = i < nofparsed and parsed[nofparsed] if pn and pn.kind == "finalizer" then collected = pn.finalizer(collected) - logs.report("lpath", "% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pn.name,pn.arguments or "") + report_lpath("% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pn.name,pn.arguments or "") return collected end return nil @@ -6141,8 +8435,11 @@ local function normal_apply(list,parsed,nofparsed,order) return collected end -local function parse_apply(list,pattern) - -- we avoid an extra call + +local function applylpath(list,pattern) + if not list then + return + end local parsed = cache[pattern] if parsed then lpathcalls = lpathcalls + 1 @@ -6151,7 +8448,7 @@ local function parse_apply(list,pattern) lpathcalls = lpathcalls + 1 parsed = pattern else - parsed = parse_pattern(pattern) or pattern + parsed = lpath(pattern) or pattern end if not parsed then return @@ -6160,25 +8457,32 @@ local function parse_apply(list,pattern) if nofparsed == 0 then return -- something is wrong end - local one = list[1] - if not one then - return -- something is wrong - elseif not trace_lpath then - return normal_apply(list,parsed,nofparsed,one.mi) + if not trace_lpath then + return normal_apply ({ list },parsed,nofparsed,list.mi) elseif trace_lprofile then - return profiled_apply(list,parsed,nofparsed,one.mi) + return profiled_apply({ list },parsed,nofparsed,list.mi) else - return traced_apply(list,parsed,nofparsed,one.mi) + return traced_apply ({ list },parsed,nofparsed,list.mi) end end +xml.applylpath = applylpath -- takes a table as first argment, which is what xml.filter will do + +--[[ldx-- +

This is the main filter function. It returns whatever is asked for.

+--ldx]]-- + +function xml.filter(root,pattern) -- no longer funny attribute handling here + return applylpath(root,pattern) +end + -- internal (parsed) expressions.child = function(e,pattern) - return parse_apply({ e },pattern) -- todo: cache + return applylpath(e,pattern) -- todo: cache end expressions.count = function(e,pattern) - local collected = parse_apply({ e },pattern) -- todo: cache + local collected = applylpath(e,pattern) -- todo: cache return (collected and #collected) or 0 end @@ -6188,7 +8492,7 @@ expressions.oneof = function(s,...) -- slow local t = {...} for i=1,#t do if s == t[i] then return true end end return false end expressions.error = function(str) - xml.error_handler("unknown function in lpath expression",tostring(str or "?")) + xml.errorhandler("unknown function in lpath expression",tostring(str or "?")) return false end expressions.undefined = function(s) @@ -6217,8 +8521,8 @@ expressions.boolean = toboolean -- user interface local function traverse(root,pattern,handle) - logs.report("xml","use 'xml.selection' instead for '%s'",pattern) - local collected = parse_apply({ root },pattern) + report_lpath("use 'xml.selection' instead for '%s'",pattern) + local collected = applylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6229,7 +8533,7 @@ local function traverse(root,pattern,handle) end local function selection(root,pattern,handle) - local collected = parse_apply({ root },pattern) + local collected = applylpath(root,pattern) if collected then if handle then for c=1,#collected do @@ -6241,19 +8545,9 @@ local function selection(root,pattern,handle) end end -xml.parse_parser = parser -xml.parse_pattern = parse_pattern -xml.parse_apply = parse_apply xml.traverse = traverse -- old method, r, d, k xml.selection = selection -- new method, simple handle -local lpath = parse_pattern - -xml.lpath = lpath - -function xml.cached_patterns() - return cache -end -- generic function finalizer (independant namespace) @@ -6265,13 +8559,13 @@ local function dofunction(collected,fnc) f(collected[c]) end else - logs.report("xml","unknown function '%s'",fnc) + report_lpath("unknown function '%s'",fnc) end end end -xml.finalizers.xml["function"] = dofunction -xml.finalizers.tex["function"] = dofunction +finalizers.xml["function"] = dofunction +finalizers.tex["function"] = dofunction -- functions @@ -6363,14 +8657,6 @@ expressions.tag = function(e,n) -- only tg end end ---[[ldx-- -

This is the main filter function. It returns whatever is asked for.

---ldx]]-- - -function xml.filter(root,pattern) -- no longer funny attribute handling here - return parse_apply({ root },pattern) -end - --[[ldx--

Often using an iterators looks nicer in the code than passing handler functions. The book describes how to use coroutines for that @@ -6390,7 +8676,7 @@ end local wrap, yield = coroutine.wrap, coroutine.yield function xml.elements(root,pattern,reverse) -- r, d, k - local collected = parse_apply({ root },pattern) + local collected = applylpath(root,pattern) if collected then if reverse then return wrap(function() for c=#collected,1,-1 do @@ -6406,7 +8692,7 @@ function xml.elements(root,pattern,reverse) -- r, d, k end function xml.collected(root,pattern,reverse) -- e - local collected = parse_apply({ root },pattern) + local collected = applylpath(root,pattern) if collected then if reverse then return wrap(function() for c=#collected,1,-1 do yield(collected[c]) end end) @@ -6417,6 +8703,15 @@ function xml.collected(root,pattern,reverse) -- e return wrap(function() end) end +-- handy + +function xml.inspect(collection,pattern) + pattern = pattern or "." + for e in xml.collected(collection,pattern or ".") do + report_lpath("pattern %q\n\n%s\n",pattern,xml.tostring(e)) + end +end + end -- of closure @@ -6430,10 +8725,16 @@ if not modules then modules = { } end modules ['lxml-mis'] = { license = "see context related readme files" } +local xml, lpeg, string = xml, lpeg, string + local concat = table.concat local type, next, tonumber, tostring, setmetatable, loadstring = type, next, tonumber, tostring, setmetatable, loadstring local format, gsub, match = string.format, string.gsub, string.match -local lpegmatch = lpeg.match +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns +local P, S, R, C, V, Cc, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.Cc, lpeg.Cs + +lpegpatterns.xml = lpegpatterns.xml or { } +local xmlpatterns = lpegpatterns.xml --[[ldx--

The following helper functions best belong to the lxml-ini @@ -6457,9 +8758,8 @@ local function xmlgsub(t,old,new) -- will be replaced end end ---~ xml.gsub = xmlgsub -function xml.strip_leading_spaces(dk,d,k) -- cosmetic, for manual +function xml.stripleadingspaces(dk,d,k) -- cosmetic, for manual if d and k then local dkm = d[k-1] if dkm and type(dkm) == "string" then @@ -6469,14 +8769,7 @@ function xml.strip_leading_spaces(dk,d,k) -- cosmetic, for manual end end ---~ xml.escapes = { ['&'] = '&', ['<'] = '<', ['>'] = '>', ['"'] = '"' } ---~ xml.unescapes = { } for k,v in next, xml.escapes do xml.unescapes[v] = k end ---~ function xml.escaped (str) return (gsub(str,"(.)" , xml.escapes )) end ---~ function xml.unescaped(str) return (gsub(str,"(&.-;)", xml.unescapes)) end ---~ function xml.cleansed (str) return (gsub(str,"<.->" , '' )) end -- "%b<>" - -local P, S, R, C, V, Cc, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.Cc, lpeg.Cs -- 100 * 2500 * "oeps< oeps> oeps&" : gsub:lpeg|lpeg|lpeg -- @@ -6502,9 +8795,9 @@ local unescaped = Cs(normal * (special * normal)^0) local cleansed = Cs(((P("<") * (1-P(">"))^0 * P(">"))/"" + 1)^0) -xml.escaped_pattern = escaped -xml.unescaped_pattern = unescaped -xml.cleansed_pattern = cleansed +xmlpatterns.escaped = escaped +xmlpatterns.unescaped = unescaped +xmlpatterns.cleansed = cleansed function xml.escaped (str) return lpegmatch(escaped,str) end function xml.unescaped(str) return lpegmatch(unescaped,str) end @@ -6540,15 +8833,20 @@ if not modules then modules = { } end modules ['lxml-aux'] = { local trace_manipulations = false trackers.register("lxml.manipulations", function(v) trace_manipulations = v end) -local xmlparseapply, xmlconvert, xmlcopy, xmlname = xml.parse_apply, xml.convert, xml.copy, xml.name +local report_xml = logs.reporter("xml") + +local xml = xml + +local xmlconvert, xmlcopy, xmlname = xml.convert, xml.copy, xml.name local xmlinheritedconvert = xml.inheritedconvert +local xmlapplylpath = xml.applylpath -local type = type -local insert, remove = table.insert, table.remove +local type, setmetatable, getmetatable = type, setmetatable, getmetatable +local insert, remove, fastcopy = table.insert, table.remove, table.fastcopy local gmatch, gsub = string.gmatch, string.gsub local function report(what,pattern,c,e) - logs.report("xml","%s element '%s' (root: '%s', position: %s, index: %s, pattern: %s)",what,xmlname(e),xmlname(e.__p__),c,e.ni,pattern) + report_xml("%s element '%s' (root: '%s', position: %s, index: %s, pattern: %s)",what,xmlname(e),xmlname(e.__p__),c,e.ni,pattern) end local function withelements(e,handle,depth) @@ -6602,10 +8900,8 @@ function xml.withelement(e,n,handle) -- slow end end -xml.elements_only = xml.collected - -function xml.each_element(root,pattern,handle,reverse) - local collected = xmlparseapply({ root },pattern) +function xml.each(root,pattern,handle,reverse) + local collected = xmlapplylpath(root,pattern) if collected then if reverse then for c=#collected,1,-1 do @@ -6620,10 +8916,8 @@ function xml.each_element(root,pattern,handle,reverse) end end -xml.process_elements = xml.each_element - -function xml.process_attributes(root,pattern,handle) - local collected = xmlparseapply({ root },pattern) +function xml.processattributes(root,pattern,handle) + local collected = xmlapplylpath(root,pattern) if collected and handle then for c=1,#collected do handle(collected[c].at) @@ -6638,12 +8932,12 @@ end -- are these still needed -> lxml-cmp.lua -function xml.collect_elements(root, pattern) - return xmlparseapply({ root },pattern) +function xml.collect(root, pattern) + return xmlapplylpath(root,pattern) end -function xml.collect_texts(root, pattern, flatten) -- todo: variant with handle - local collected = xmlparseapply({ root },pattern) +function xml.collecttexts(root, pattern, flatten) -- todo: variant with handle + local collected = xmlapplylpath(root,pattern) if collected and flatten then local xmltostring = xml.tostring for c=1,#collected do @@ -6654,18 +8948,19 @@ function xml.collect_texts(root, pattern, flatten) -- todo: variant with handle end function xml.collect_tags(root, pattern, nonamespace) - local collected = xmlparseapply({ root },pattern) + local collected = xmlapplylpath(root,pattern) if collected then - local t = { } + local t, n = { }, 0 for c=1,#collected do local e = collected[c] local ns, tg = e.ns, e.tg + n = n + 1 if nonamespace then - t[#t+1] = tg + t[n] = tg elseif ns == "" then - t[#t+1] = tg + t[n] = tg else - t[#t+1] = ns .. ":" .. tg + t[n] = ns .. ":" .. tg end end return t @@ -6678,7 +8973,7 @@ end local no_root = { no_root = true } -function xml.redo_ni(d) +local function redo_ni(d) for k=1,#d do local dk = d[k] if type(dk) == "table" then @@ -6701,12 +8996,7 @@ local function xmltoelement(whatever,root) return whatever -- string end if element then - --~ if element.ri then - --~ element = element.dt[element.ri].dt - --~ else - --~ element = element.dt - --~ end - end + end return element end @@ -6724,8 +9014,8 @@ local function copiedelement(element,newparent) end end -function xml.delete_element(root,pattern) - local collected = xmlparseapply({ root },pattern) +function xml.delete(root,pattern) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6736,15 +9026,15 @@ function xml.delete_element(root,pattern) end local d = p.dt remove(d,e.ni) - xml.redo_ni(d) -- can be made faster and inlined + redo_ni(d) -- can be made faster and inlined end end end end -function xml.replace_element(root,pattern,whatever) +function xml.replace(root,pattern,whatever) local element = root and xmltoelement(whatever,root) - local collected = element and xmlparseapply({ root },pattern) + local collected = element and xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6755,15 +9045,50 @@ function xml.replace_element(root,pattern,whatever) end local d = p.dt d[e.ni] = copiedelement(element,p) - xml.redo_ni(d) -- probably not needed + redo_ni(d) -- probably not needed + end + end + end +end + +local function wrap(e,wrapper) + local t = { + rn = e.rn, + tg = e.tg, + ns = e.ns, + at = e.at, + dt = e.dt, + __p__ = e, + } + setmetatable(t,getmetatable(e)) + e.rn = wrapper.rn or e.rn or "" + e.tg = wrapper.tg or e.tg or "" + e.ns = wrapper.ns or e.ns or "" + e.at = fastcopy(wrapper.at) + e.dt = { t } +end + +function xml.wrap(root,pattern,whatever) + if whatever then + local wrapper = xmltoelement(whatever,root) + local collected = xmlapplylpath(root,pattern) + if collected then + for c=1,#collected do + local e = collected[c] + if trace_manipulations then + report('wrapping',pattern,c,e) + end + wrap(e,wrapper) end end + else + wrap(root,xmltoelement(pattern)) end end local function inject_element(root,pattern,whatever,prepend) local element = root and xmltoelement(whatever,root) - local collected = element and xmlparseapply({ root },pattern) + local collected = element and xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6778,15 +9103,17 @@ local function inject_element(root,pattern,whatever,prepend) else be, af = edt, cp end + local bn = #be for i=1,#af do - be[#be+1] = af[i] + bn = bn + 1 + be[bn] = af[i] end if rri then r.dt[rri].dt = be else d[k].dt = be end - xml.redo_ni(d) + redo_ni(d) end end end @@ -6794,7 +9121,7 @@ end local function insert_element(root,pattern,whatever,before) -- todo: element als functie local element = root and xmltoelement(whatever,root) - local collected = element and xmlparseapply({ root },pattern) + local collected = element and xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6804,24 +9131,23 @@ local function insert_element(root,pattern,whatever,before) -- todo: element als k = k + 1 end insert(d,k,copiedelement(element,r)) - xml.redo_ni(d) + redo_ni(d) end end end -xml.insert_element = insert_element -xml.insert_element_after = insert_element -xml.insert_element_before = function(r,p,e) insert_element(r,p,e,true) end -xml.inject_element = inject_element -xml.inject_element_after = inject_element -xml.inject_element_before = function(r,p,e) inject_element(r,p,e,true) end +xml.insert_element = insert_element +xml.insertafter = insert_element +xml.insertbefore = function(r,p,e) insert_element(r,p,e,true) end +xml.injectafter = inject_element +xml.injectbefore = function(r,p,e) inject_element(r,p,e,true) end local function include(xmldata,pattern,attribute,recursive,loaddata) -- parse="text" (default: xml), encoding="" (todo) -- attribute = attribute or 'href' pattern = pattern or 'include' loaddata = loaddata or io.loaddata - local collected = xmlparseapply({ xmldata },pattern) + local collected = xmlapplylpath(xmldata,pattern) if collected then for c=1,#collected do local ek = collected[c] @@ -6830,7 +9156,7 @@ local function include(xmldata,pattern,attribute,recursive,loaddata) local ekat = ek.at local epdt = ek.__p__.dt if not attribute or attribute == "" then - name = (type(ekdt) == "table" and ekdt[1]) or ekdt -- ckeck, probably always tab or str + name = (type(ekdt) == "table" and ekdt[1]) or ekdt -- check, probably always tab or str end if not name then for a in gmatch(attribute or "href","([^|]+)") do @@ -6845,9 +9171,6 @@ local function include(xmldata,pattern,attribute,recursive,loaddata) -- for the moment hard coded epdt[ek.ni] = xml.escaped(data) -- d[k] = xml.escaped(data) else ---~ local settings = xmldata.settings ---~ settings.parent_root = xmldata -- to be tested ---~ local xi = xmlconvert(data,settings) local xi = xmlinheritedconvert(data,xmldata) if not xi then epdt[ek.ni] = "" -- xml.empty(d,k) @@ -6864,136 +9187,88 @@ end xml.include = include ---~ local function manipulate(xmldata,pattern,manipulator) -- untested and might go away ---~ local collected = xmlparseapply({ xmldata },pattern) ---~ if collected then ---~ local xmltostring = xml.tostring ---~ for c=1,#collected do ---~ local e = collected[c] ---~ local data = manipulator(xmltostring(e)) ---~ if data == "" then ---~ epdt[e.ni] = "" ---~ else ---~ local xi = xmlinheritedconvert(data,xmldata) ---~ if not xi then ---~ epdt[e.ni] = "" ---~ else ---~ epdt[e.ni] = xml.body(xi) -- xml.assign(d,k,xi) ---~ end ---~ end ---~ end ---~ end ---~ end - ---~ xml.manipulate = manipulate - -function xml.strip_whitespace(root, pattern, nolines) -- strips all leading and trailing space ! - local collected = xmlparseapply({ root },pattern) - if collected then - for i=1,#collected do - local e = collected[i] - local edt = e.dt - if edt then - local t = { } - for i=1,#edt do - local str = edt[i] - if type(str) == "string" then - if str == "" then - -- stripped - else - if nolines then - str = gsub(str,"[ \n\r\t]+"," ") - end - if str == "" then - -- stripped - else - t[#t+1] = str - end - end +local function stripelement(e,nolines,anywhere) + local edt = e.dt + if edt then + if anywhere then + local t, n = { }, 0 + for e=1,#edt do + local str = edt[e] + if type(str) ~= "string" then + n = n + 1 + t[n] = str + elseif str ~= "" then + -- todo: lpeg for each case + if nolines then + str = gsub(str,"%s+"," ") + end + str = gsub(str,"^%s*(.-)%s*$","%1") + if str ~= "" then + n = n + 1 + t[n] = str + end + end + end + e.dt = t + else + -- we can assume a regular sparse xml table with no successive strings + -- otherwise we should use a while loop + if #edt > 0 then + -- strip front + local str = edt[1] + if type(str) ~= "string" then + -- nothing + elseif str == "" then + remove(edt,1) + else + if nolines then + str = gsub(str,"%s+"," ") + end + str = gsub(str,"^%s+","") + if str == "" then + remove(edt,1) + else + edt[1] = str + end + end + end + local nedt = #edt + if nedt > 0 then + -- strip end + local str = edt[nedt] + if type(str) ~= "string" then + -- nothing + elseif str == "" then + remove(edt) + else + if nolines then + str = gsub(str,"%s+"," ") + end + str = gsub(str,"%s+$","") + if str == "" then + remove(edt) else - --~ str.ni = i - t[#t+1] = str + edt[nedt] = str end end - e.dt = t end end end + return e -- convenient end -function xml.strip_whitespace(root, pattern, nolines, anywhere) -- strips all leading and trailing spacing - local collected = xmlparseapply({ root },pattern) -- beware, indices no longer are valid now +xml.stripelement = stripelement + +function xml.strip(root,pattern,nolines,anywhere) -- strips all leading and trailing spacing + local collected = xmlapplylpath(root,pattern) -- beware, indices no longer are valid now if collected then for i=1,#collected do - local e = collected[i] - local edt = e.dt - if edt then - if anywhere then - local t = { } - for e=1,#edt do - local str = edt[e] - if type(str) ~= "string" then - t[#t+1] = str - elseif str ~= "" then - -- todo: lpeg for each case - if nolines then - str = gsub(str,"%s+"," ") - end - str = gsub(str,"^%s*(.-)%s*$","%1") - if str ~= "" then - t[#t+1] = str - end - end - end - e.dt = t - else - -- we can assume a regular sparse xml table with no successive strings - -- otherwise we should use a while loop - if #edt > 0 then - -- strip front - local str = edt[1] - if type(str) ~= "string" then - -- nothing - elseif str == "" then - remove(edt,1) - else - if nolines then - str = gsub(str,"%s+"," ") - end - str = gsub(str,"^%s+","") - if str == "" then - remove(edt,1) - else - edt[1] = str - end - end - end - if #edt > 1 then - -- strip end - local str = edt[#edt] - if type(str) ~= "string" then - -- nothing - elseif str == "" then - remove(edt) - else - if nolines then - str = gsub(str,"%s+"," ") - end - str = gsub(str,"%s+$","") - if str == "" then - remove(edt) - else - edt[#edt] = str - end - end - end - end - end + stripelement(collected[i],nolines,anywhere) end end end -local function rename_space(root, oldspace, newspace) -- fast variant +local function renamespace(root, oldspace, newspace) -- fast variant local ndt = #root.dt for i=1,ndt or 0 do local e = root[i] @@ -7006,16 +9281,16 @@ local function rename_space(root, oldspace, newspace) -- fast variant end local edt = e.dt if edt then - rename_space(edt, oldspace, newspace) + renamespace(edt, oldspace, newspace) end end end end -xml.rename_space = rename_space +xml.renamespace = renamespace -function xml.remap_tag(root, pattern, newtg) - local collected = xmlparseapply({ root },pattern) +function xml.remaptag(root, pattern, newtg) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do collected[c].tg = newtg @@ -7023,8 +9298,8 @@ function xml.remap_tag(root, pattern, newtg) end end -function xml.remap_namespace(root, pattern, newns) - local collected = xmlparseapply({ root },pattern) +function xml.remapnamespace(root, pattern, newns) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do collected[c].ns = newns @@ -7032,8 +9307,8 @@ function xml.remap_namespace(root, pattern, newns) end end -function xml.check_namespace(root, pattern, newns) - local collected = xmlparseapply({ root },pattern) +function xml.checknamespace(root, pattern, newns) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -7044,8 +9319,8 @@ function xml.check_namespace(root, pattern, newns) end end -function xml.remap_name(root, pattern, newtg, newns, newrn) - local collected = xmlparseapply({ root },pattern) +function xml.remapname(root, pattern, newtg, newns, newrn) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -7058,18 +9333,34 @@ end

Here are a few synonyms.

--ldx]]-- -xml.each = xml.each_element -xml.process = xml.process_element -xml.strip = xml.strip_whitespace -xml.collect = xml.collect_elements -xml.all = xml.collect_elements - -xml.insert = xml.insert_element_after -xml.inject = xml.inject_element_after -xml.after = xml.insert_element_after -xml.before = xml.insert_element_before -xml.delete = xml.delete_element -xml.replace = xml.replace_element +xml.all = xml.each +xml.insert = xml.insertafter +xml.inject = xml.injectafter +xml.after = xml.insertafter +xml.before = xml.insertbefore +xml.process = xml.each + +-- obsolete + +xml.obsolete = xml.obsolete or { } +local obsolete = xml.obsolete + +xml.strip_whitespace = xml.strip obsolete.strip_whitespace = xml.strip +xml.collect_elements = xml.collect obsolete.collect_elements = xml.collect +xml.delete_element = xml.delete obsolete.delete_element = xml.delete +xml.replace_element = xml.replace obsolete.replace_element = xml.replacet +xml.each_element = xml.each obsolete.each_element = xml.each +xml.process_elements = xml.process obsolete.process_elements = xml.process +xml.insert_element_after = xml.insertafter obsolete.insert_element_after = xml.insertafter +xml.insert_element_before = xml.insertbefore obsolete.insert_element_before = xml.insertbefore +xml.inject_element_after = xml.injectafter obsolete.inject_element_after = xml.injectafter +xml.inject_element_before = xml.injectbefore obsolete.inject_element_before = xml.injectbefore +xml.process_attributes = xml.processattributes obsolete.process_attributes = xml.processattributes +xml.collect_texts = xml.collecttexts obsolete.collect_texts = xml.collecttexts +xml.inject_element = xml.inject obsolete.inject_element = xml.inject +xml.remap_tag = xml.remaptag obsolete.remap_tag = xml.remaptag +xml.remap_name = xml.remapname obsolete.remap_name = xml.remapname +xml.remap_namespace = xml.remapnamespace obsolete.remap_namespace = xml.remapnamespace end -- of closure @@ -7084,10 +9375,15 @@ if not modules then modules = { } end modules ['lxml-xml'] = { license = "see context related readme files" } +local concat = string.concat + +local xml = xml + local finalizers = xml.finalizers.xml local xmlfilter = xml.filter -- we could inline this one for speed local xmltostring = xml.tostring local xmlserialize = xml.serialize +local xmlcollected = xml.collected local function first(collected) -- wrong ? return collected and collected[1] @@ -7101,15 +9397,8 @@ local function all(collected) return collected end -local function reverse(collected) - if collected then - local reversed = { } - for c=#collected,1,-1 do - reversed[#reversed+1] = collected[c] - end - return reversed - end -end + +local reverse = table.reversed local function attribute(collected,name) if collected and #collected > 0 then @@ -7200,11 +9489,12 @@ end local function texts(collected) if collected then - local t = { } + local t, n = { }, 0 for c=1,#collected do - local e = collection[c] + local e = collected[c] if e and e.dt then - t[#t+1] = e.dt + n = n + 1 + t[n] = e.dt end end return t @@ -7247,14 +9537,15 @@ end local function tags(collected,nonamespace) if collected then - local t = { } + local t, n = { }, 0 for c=1,#collected do local e = collected[c] local ns, tg = e.ns, e.tg + n = n + 1 if nonamespace or ns == "" then - t[#t+1] = tg + t[n] = tg else - t[#t+1] = ns .. ":" .. tg + t[n] = ns .. ":" .. tg end end return t @@ -7365,1812 +9656,1937 @@ xml.all = xml.filter xml.index = xml.position xml.found = xml.filter +-- a nice one: + +local function totable(x) + local t = { } + for e in xmlcollected(x[1] or x,"/*") do + t[e.tg] = xmltostring(e.dt) or "" + end + return next(t) and t or nil +end + +xml.table = totable +finalizers.table = totable + +local function textonly(e,t) + if e then + local edt = e.dt + if edt then + for i=1,#edt do + local e = edt[i] + if type(e) == "table" then + textonly(e,t) + else + t[#t+1] = e + end + end + end + end + return t +end + +function xml.textonly(e) -- no pattern + return concat(textonly(e,{})) +end + end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['luat-env'] = { +if not modules then modules = { } end modules ['data-ini'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" + license = "see context related readme files", } --- A former version provided functionality for non embeded core --- scripts i.e. runtime library loading. Given the amount of --- Lua code we use now, this no longer makes sense. Much of this --- evolved before bytecode arrays were available and so a lot of --- code has disappeared already. +local gsub, find, gmatch = string.gsub, string.find, string.gmatch +local concat = table.concat +local next, type = next, type -local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local filedirname, filebasename, fileextname, filejoin = file.dirname, file.basename, file.extname, file.join -local format, sub, match, gsub, find = string.format, string.sub, string.match, string.gsub, string.find -local unquote, quote = string.unquote, string.quote +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_detail = false trackers.register("resolvers.details", function(v) trace_detail = v end) +local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end) --- precautions +local report_initialization = logs.reporter("resolvers","initialization") -os.setlocale(nil,nil) -- useless feature and even dangerous in luatex +local ostype, osname, ossetenv, osgetenv = os.type, os.name, os.setenv, os.getenv -function os.setlocale() - -- no way you can mess with it -end +-- The code here used to be part of a data-res but for convenience +-- we now split it over multiple files. As this file is now the +-- starting point we introduce resolvers here. --- dirty tricks +resolvers = resolvers or { } +local resolvers = resolvers + +-- We don't want the kpse library to kick in. Also, we want to be able to +-- execute programs. Control over execution is implemented later. + +texconfig.kpse_init = false +texconfig.shell_escape = 't' + +kpse = { original = kpse } + +setmetatable(kpse, { + __index = function(kp,name) + report_initialization("fatal error: kpse library is accessed (key: %s)",name) + os.exit() + end +} ) + +-- First we check a couple of environment variables. Some might be +-- set already but we need then later on. We start with the system +-- font path. + +do + + local osfontdir = osgetenv("OSFONTDIR") + + if osfontdir and osfontdir ~= "" then + -- ok + elseif osname == "windows" then + ossetenv("OSFONTDIR","c:/windows/fonts//") + elseif osname == "macosx" then + ossetenv("OSFONTDIR","$HOME/Library/Fonts//;/Library/Fonts//;/System/Library/Fonts//") + end -if arg and (arg[0] == 'luatex' or arg[0] == 'luatex.exe') and arg[1] == "--luaonly" then - arg[-1]=arg[0] arg[0]=arg[2] for k=3,#arg do arg[k-2]=arg[k] end arg[#arg]=nil arg[#arg]=nil end -if profiler and os.env["MTX_PROFILE_RUN"] == "YES" then - profiler.start("luatex-profile.log") +-- Next comes the user's home path. We need this as later on we have +-- to replace ~ with its value. + +do + + local homedir = osgetenv(ostype == "windows" and 'USERPROFILE' or 'HOME') or '' + + if not homedir or homedir == "" then + homedir = string.char(127) -- we need a value, later we wil trigger on it + end + + homedir = file.collapsepath(homedir) + + ossetenv("HOME", homedir) -- can be used in unix cnf files + ossetenv("USERPROFILE",homedir) -- can be used in windows cnf files + + environment.homedir = homedir + end --- environment +-- The following code sets the name of the own binary and its +-- path. This is fallback code as we have os.selfdir now. -environment = environment or { } -environment.arguments = { } -environment.files = { } -environment.sortedflags = nil +do -if not environment.jobname or environment.jobname == "" then if tex then environment.jobname = tex.jobname end end -if not environment.version or environment.version == "" then environment.version = "unknown" end -if not environment.jobname then environment.jobname = "unknown" end + local args = environment.originalarguments or arg -- this needs a cleanup -function environment.initialize_arguments(arg) - local arguments, files = { }, { } - environment.arguments, environment.files, environment.sortedflags = arguments, files, nil - for index=1,#arg do - local argument = arg[index] - if index > 0 then - local flag, value = match(argument,"^%-+(.-)=(.-)$") - if flag then - arguments[flag] = unquote(value or "") - else - flag = match(argument,"^%-+(.+)") - if flag then - arguments[flag] = true - else - files[#files+1] = argument + local ownbin = environment.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex" + local ownpath = environment.ownpath or os.selfdir + + ownbin = file.collapsepath(ownbin) + ownpath = file.collapsepath(ownpath) + + if not ownpath or ownpath == "" or ownpath == "unset" then + ownpath = args[-1] or arg[-1] + ownpath = ownpath and filedirname(gsub(ownpath,"\\","/")) + if not ownpath or ownpath == "" then + ownpath = args[-0] or arg[-0] + ownpath = ownpath and filedirname(gsub(ownpath,"\\","/")) + end + local binary = ownbin + if not ownpath or ownpath == "" then + ownpath = ownpath and filedirname(binary) + end + if not ownpath or ownpath == "" then + if os.binsuffix ~= "" then + binary = file.replacesuffix(binary,os.binsuffix) + end + local path = osgetenv("PATH") + if path then + for p in gmatch(path,"[^"..io.pathseparator.."]+") do + local b = filejoin(p,binary) + if lfs.isfile(b) then + -- we assume that after changing to the path the currentdir function + -- resolves to the real location and use this side effect here; this + -- trick is needed because on the mac installations use symlinks in the + -- path instead of real locations + local olddir = lfs.currentdir() + if lfs.chdir(p) then + local pp = lfs.currentdir() + if trace_locating and p ~= pp then + report_initialization("following symlink '%s' to '%s'",p,pp) + end + ownpath = pp + lfs.chdir(olddir) + else + if trace_locating then + report_initialization("unable to check path '%s'",p) + end + ownpath = p + end + break + end end end end + if not ownpath or ownpath == "" then + ownpath = "." + report_initialization("forcing fallback ownpath .") + elseif trace_locating then + report_initialization("using ownpath '%s'",ownpath) + end end - environment.ownname = environment.ownname or arg[0] or 'unknown.lua' + + environment.ownbin = ownbin + environment.ownpath = ownpath + end -function environment.setargument(name,value) - environment.arguments[name] = value +resolvers.ownpath = environment.ownpath + +function resolvers.getownpath() + return environment.ownpath end --- todo: defaults, better checks e.g on type (boolean versus string) --- --- tricky: too many hits when we support partials unless we add --- a registration of arguments so from now on we have 'partial' +-- The self variables permit us to use only a few (or even no) +-- environment variables. -function environment.argument(name,partial) - local arguments, sortedflags = environment.arguments, environment.sortedflags - if arguments[name] then - return arguments[name] - elseif partial then - if not sortedflags then - sortedflags = table.sortedkeys(arguments) - for k=1,#sortedflags do - sortedflags[k] = "^" .. sortedflags[k] - end - environment.sortedflags = sortedflags - end - -- example of potential clash: ^mode ^modefile - for k=1,#sortedflags do - local v = sortedflags[k] - if find(name,v) then - return arguments[sub(v,2,#v)] - end - end +do + + local ownpath = environment.ownpath or dir.current() + + if ownpath then + ossetenv('SELFAUTOLOC', file.collapsepath(ownpath)) + ossetenv('SELFAUTODIR', file.collapsepath(ownpath .. "/..")) + ossetenv('SELFAUTOPARENT', file.collapsepath(ownpath .. "/../..")) + else + report_initialization("error: unable to locate ownpath") + os.exit() end - return nil + end -environment.argument("x",true) +-- The running os: -function environment.split_arguments(separator) -- rather special, cut-off before separator - local done, before, after = false, { }, { } - local original_arguments = environment.original_arguments - for k=1,#original_arguments do - local v = original_arguments[k] - if not done and v == separator then - done = true - elseif done then - after[#after+1] = v - else - before[#before+1] = v - end - end - return before, after +-- todo: check is context sits here os.platform is more trustworthy +-- that the bin check as mtx-update runs from another path + +local texos = environment.texos or osgetenv("TEXOS") +local texmfos = environment.texmfos or osgetenv('SELFAUTODIR') + +if not texos or texos == "" then + texos = file.basename(texmfos) end -function environment.reconstruct_commandline(arg,noquote) - arg = arg or environment.original_arguments - if noquote and #arg == 1 then - local a = arg[1] - a = resolvers.resolve(a) - a = unquote(a) - return a - elseif #arg > 0 then - local result = { } - for i=1,#arg do - local a = arg[i] - a = resolvers.resolve(a) - a = unquote(a) - a = gsub(a,'"','\\"') -- tricky - if find(a," ") then - result[#result+1] = quote(a) - else - result[#result+1] = a - end - end - return table.join(result," ") - else - return "" +ossetenv('TEXMFOS', texmfos) -- full bin path +ossetenv('TEXOS', texos) -- partial bin parent +ossetenv('SELFAUTOSYSTEM',os.platform) -- bonus + +environment.texos = texos +environment.texmfos = texmfos + +-- The current root: + +local texroot = environment.texroot or osgetenv("TEXROOT") + +if not texroot or texroot == "" then + texroot = osgetenv('SELFAUTOPARENT') + ossetenv('TEXROOT',texroot) +end + +environment.texroot = file.collapsepath(texroot) + +-- Tracing. Todo ... + +function resolvers.settrace(n) -- no longer number but: 'locating' or 'detail' + if n then + trackers.disable("resolvers.*") + trackers.enable("resolvers."..n) end end -if arg then +resolvers.settrace(osgetenv("MTX_INPUT_TRACE")) + +-- todo: + +-- if profiler and osgetenv("MTX_PROFILE_RUN") == "YES" then +-- profiler.start("luatex-profile.log") +-- end + +-- a forward definition + +if not resolvers.resolve then + function resolvers.resolve (s) return s end + function resolvers.unresolve(s) return s end + function resolvers.repath (s) return s end +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-exp'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +local format, find, gmatch, lower = string.format, string.find, string.gmatch, string.lower +local concat, sort = table.concat, table.sort +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns +local Ct, Cs, Cc, P, C, S = lpeg.Ct, lpeg.Cs, lpeg.Cc, lpeg.P, lpeg.C, lpeg.S +local type, next = type, next - -- new, reconstruct quoted snippets (maybe better just remove the " then and add them later) - local newarg, instring = { }, false +local ostype = os.type +local collapsepath = file.collapsepath - for index=1,#arg do - local argument = arg[index] - if find(argument,"^\"") then - newarg[#newarg+1] = gsub(argument,"^\"","") - if not find(argument,"\"$") then - instring = true - end - elseif find(argument,"\"$") then - newarg[#newarg] = newarg[#newarg] .. " " .. gsub(argument,"\"$","") - instring = false - elseif instring then - newarg[#newarg] = newarg[#newarg] .. " " .. argument - else - newarg[#newarg+1] = argument - end - end - for i=1,-5,-1 do - newarg[i] = arg[i] - end +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end) - environment.initialize_arguments(newarg) - environment.original_arguments = newarg - environment.raw_arguments = arg +local report_expansions = logs.reporter("resolvers","expansions") - arg = { } -- prevent duplicate handling +local resolvers = resolvers -end +-- As this bit of code is somewhat special it gets its own module. After +-- all, when working on the main resolver code, I don't want to scroll +-- past this every time. See data-obs.lua for the gsub variant. --- weird place ... depends on a not yet loaded module +-- {a,b,c,d} +-- a,b,c/{p,q,r},d +-- a,b,c/{p,q,r}/d/{x,y,z}// +-- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} +-- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} +-- a{b,c}{d,e}f +-- {a,b,c,d} +-- {a,b,c/{p,q,r},d} +-- {a,b,c/{p,q,r}/d/{x,y,z}//} +-- {a,b,c/{p,q/{x,y,z}},d/{p,q,r}} +-- {a,b,c/{p,q/{x,y,z},w}v,d/{p,q,r}} +-- {$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c} -function environment.texfile(filename) - return resolvers.find_file(filename,'tex') +local function f_first(a,b) + local t, n = { }, 0 + for s in gmatch(b,"[^,]+") do + n = n + 1 ; t[n] = a .. s + end + return concat(t,",") end -function environment.luafile(filename) - local resolved = resolvers.find_file(filename,'tex') or "" - if resolved ~= "" then - return resolved +local function f_second(a,b) + local t, n = { }, 0 + for s in gmatch(a,"[^,]+") do + n = n + 1 ; t[n] = s .. b end - resolved = resolvers.find_file(filename,'texmfscripts') or "" - if resolved ~= "" then - return resolved + return concat(t,",") +end + +local function f_both(a,b) + local t, n = { }, 0 + for sa in gmatch(a,"[^,]+") do + for sb in gmatch(b,"[^,]+") do + n = n + 1 ; t[n] = sa .. sb + end end - return resolvers.find_file(filename,'luatexlibs') or "" + return concat(t,",") end -environment.loadedluacode = loadfile -- can be overloaded +local left = P("{") +local right = P("}") +local var = P((1 - S("{}" ))^0) +local set = P((1 - S("{},"))^0) +local other = P(1) ---~ function environment.loadedluacode(name) ---~ if os.spawn("texluac -s -o texluac.luc " .. name) == 0 then ---~ local chunk = loadstring(io.loaddata("texluac.luc")) ---~ os.remove("texluac.luc") ---~ return chunk ---~ else ---~ environment.loadedluacode = loadfile -- can be overloaded ---~ return loadfile(name) ---~ end ---~ end - -function environment.luafilechunk(filename) -- used for loading lua bytecode in the format - filename = file.replacesuffix(filename, "lua") - local fullname = environment.luafile(filename) - if fullname and fullname ~= "" then - if trace_locating then - logs.report("fileio","loading file %s", fullname) +local l_first = Cs( ( Cc("{") * (C(set) * left * C(var) * right / f_first) * Cc("}") + other )^0 ) +local l_second = Cs( ( Cc("{") * (left * C(var) * right * C(set) / f_second) * Cc("}") + other )^0 ) +local l_both = Cs( ( Cc("{") * (left * C(var) * right * left * C(var) * right / f_both) * Cc("}") + other )^0 ) +local l_rest = Cs( ( left * var * (left/"") * var * (right/"") * var * right + other )^0 ) + +local stripper_1 = lpeg.stripper ("{}@") +local replacer_1 = lpeg.replacer { { ",}", ",@}" }, { "{,", "{@," }, } + +local function splitpathexpr(str, newlist, validate) -- I couldn't resist lpegging it (nice exercise). + if trace_expansions then + report_expansions("expanding variable '%s'",str) + end + local t, ok, done = newlist or { }, false, false + local n = #t + str = lpegmatch(replacer_1,str) + repeat local old = str + repeat local old = str ; str = lpegmatch(l_first, str) until old == str + repeat local old = str ; str = lpegmatch(l_second,str) until old == str + repeat local old = str ; str = lpegmatch(l_both, str) until old == str + repeat local old = str ; str = lpegmatch(l_rest, str) until old == str + until old == str -- or not find(str,"{") + str = lpegmatch(stripper_1,str) + if validate then + for s in gmatch(str,"[^,]+") do + s = validate(s) + if s then + n = n + 1 ; t[n] = s + end end - return environment.loadedluacode(fullname) else - if trace_locating then - logs.report("fileio","unknown file %s", filename) + for s in gmatch(str,"[^,]+") do + n = n + 1 ; t[n] = s + end + end + if trace_expansions then + for k=1,#t do + report_expansions("% 4i: %s",k,t[k]) end - return nil end + return t end --- the next ones can use the previous ones / combine +-- We could make the previous one public. -function environment.loadluafile(filename, version) - local lucname, luaname, chunk - local basename = file.removesuffix(filename) - if basename == filename then - lucname, luaname = basename .. ".luc", basename .. ".lua" - else - lucname, luaname = nil, basename -- forced suffix - end - -- when not overloaded by explicit suffix we look for a luc file first - local fullname = (lucname and environment.luafile(lucname)) or "" - if fullname ~= "" then - if trace_locating then - logs.report("fileio","loading %s", fullname) - end - chunk = loadfile(fullname) -- this way we don't need a file exists check +local function validate(s) + s = collapsepath(s) -- already keeps the // + return s ~= "" and not find(s,"^!*unset/*$") and s +end + +resolvers.validatedpath = validate -- keeps the trailing // + +function resolvers.expandedpathfromlist(pathlist) + local newlist = { } + for k=1,#pathlist do + splitpathexpr(pathlist[k],newlist,validate) end - if chunk then - assert(chunk)() - if version then - -- we check of the version number of this chunk matches - local v = version -- can be nil - if modules and modules[filename] then - v = modules[filename].version -- new method - elseif versions and versions[filename] then - v = versions[filename] -- old method + return newlist +end + +local cleanup = lpeg.replacer { + { "!" , "" }, + { "\\" , "/" }, +} + +local homedir + +function resolvers.cleanpath(str) + if not homedir then + homedir = lpegmatch(cleanup,environment.homedir or "") + if homedir == string.char(127) or homedir == "" or not lfs.isdir(homedir) then + if trace_expansions then + report_expansions("no home dir set, ignoring dependent paths") end - if v == version then - return true - else - if trace_locating then - logs.report("fileio","version mismatch for %s: lua=%s, luc=%s", filename, v, version) + function resolvers.cleanpath(str) + if find(str,"~") then + return "" -- special case + else + return str and lpegmatch(cleanup,str) end - environment.loadluafile(filename) end else - return true - end - end - fullname = (luaname and environment.luafile(luaname)) or "" - if fullname ~= "" then - if trace_locating then - logs.report("fileio","loading %s", fullname) - end - chunk = loadfile(fullname) -- this way we don't need a file exists check - if not chunk then - if trace_locating then - logs.report("fileio","unknown file %s", filename) + cleanup = lpeg.replacer { + { "!" , "" }, + { "\\" , "/" }, + { "~" , homedir }, + } + function resolvers.cleanpath(str) + return str and lpegmatch(cleanup,str) end - else - assert(chunk)() - return true end end - return false + return resolvers.cleanpath(str) end +-- This one strips quotes and funny tokens. -end -- of closure - -do -- create closure to overcome 200 locals limit +local expandhome = P("~") / "$HOME" -- environment.homedir -if not modules then modules = { } end modules ['trac-inf'] = { - version = 1.001, - comment = "companion to trac-inf.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} +local dodouble = P('"')/"" * (expandhome + (1 - P('"')))^0 * P('"')/"" +local dosingle = P("'")/"" * (expandhome + (1 - P("'")))^0 * P("'")/"" +local dostring = (expandhome + 1 )^0 -local format = string.format +local stripper = Cs( + lpegpatterns.unspacer * (dosingle + dodouble + dostring) * lpegpatterns.unspacer +) -local statusinfo, n, registered = { }, 0, { } +function resolvers.checkedvariable(str) -- assumes str is a string + return lpegmatch(stripper,str) or str +end -statistics = statistics or { } +-- The path splitter: -statistics.enable = true -statistics.threshold = 0.05 +-- A config (optionally) has the paths split in tables. Internally +-- we join them and split them after the expansion has taken place. This +-- is more convenient. --- timing functions +local cache = { } -local clock = os.gettimeofday or os.clock +---- splitter = Ct(lpeg.splitat(S(ostype == "windows" and ";" or ":;"))) -- maybe add , +local splitter = Ct(lpeg.splitat(";")) -- as we move towards urls, prefixes and use tables we no longer do : -local notimer +local backslashswapper = lpeg.replacer("\\","/") -function statistics.hastimer(instance) - return instance and instance.starttime +local function splitconfigurationpath(str) -- beware, this can be either a path or a { specification } + if str then + local found = cache[str] + if not found then + if str == "" then + found = { } + else + local split = lpegmatch(splitter,lpegmatch(backslashswapper,str)) -- can be combined + found = { } + local noffound = 0 + for i=1,#split do + local s = split[i] + if not find(s,"^{*unset}*") then + noffound = noffound + 1 + found[noffound] = s + end + end + if trace_expansions then + report_expansions("splitting path specification '%s'",str) + for k=1,noffound do + report_expansions("% 4i: %s",k,found[k]) + end + end + cache[str] = found + end + end + return found + end end -function statistics.resettiming(instance) - if not instance then - notimer = { timing = 0, loadtime = 0 } +resolvers.splitconfigurationpath = splitconfigurationpath + +function resolvers.splitpath(str) + if type(str) == 'table' then + return str else - instance.timing, instance.loadtime = 0, 0 + return splitconfigurationpath(str) end end -function statistics.starttiming(instance) - if not instance then - notimer = { } - instance = notimer - end - local it = instance.timing - if not it then - it = 0 - end - if it == 0 then - instance.starttime = clock() - if not instance.loadtime then - instance.loadtime = 0 - end +function resolvers.joinpath(str) + if type(str) == 'table' then + return file.joinpath(str) else ---~ logs.report("system","nested timing (%s)",tostring(instance)) + return str end - instance.timing = it + 1 end -function statistics.stoptiming(instance, report) - if not instance then - instance = notimer - end - if instance then - local it = instance.timing - if it > 1 then - instance.timing = it - 1 - else - local starttime = instance.starttime - if starttime then - local stoptime = clock() - local loadtime = stoptime - starttime - instance.stoptime = stoptime - instance.loadtime = instance.loadtime + loadtime - if report then - statistics.report("load time %0.3f",loadtime) +-- The next function scans directories and returns a hash where the +-- entries are either strings or tables. + +-- starting with . or .. etc or funny char + + + + +local weird = P(".")^1 + lpeg.anywhere(S("~`!#$%^&*()={}[]:;\"\'||<>,?\n\r\t")) + +local attributes, directory = lfs.attributes, lfs.dir + +local function scan(files,spec,path,n,m,r) + local full = (path == "" and spec) or (spec .. path .. '/') + local dirs, nofdirs = { }, 0 + for name in directory(full) do + if not lpegmatch(weird,name) then + local mode = attributes(full..name,'mode') + if mode == 'file' then + n = n + 1 + local f = files[name] + if f then + if type(f) == 'string' then + files[name] = { f, path } + else + f[#f+1] = path + end + else -- probably unique anyway + files[name] = path + local lower = lower(name) + if name ~= lower then + files["remap:"..lower] = name + r = r + 1 + end + end + elseif mode == 'directory' then + m = m + 1 + nofdirs = nofdirs + 1 + if path ~= "" then + dirs[nofdirs] = path..'/'..name + else + dirs[nofdirs] = name end - instance.timing = 0 - return loadtime end end end - return 0 -end - -function statistics.elapsedtime(instance) - if not instance then - instance = notimer + if nofdirs > 0 then + sort(dirs) + for i=1,nofdirs do + files, n, m, r = scan(files,spec,dirs[i],n,m,r) + end end - return format("%0.3f",(instance and instance.loadtime) or 0) + return files, n, m, r end -function statistics.elapsedindeed(instance) - if not instance then - instance = notimer +function resolvers.scanfiles(path,branch) + if trace_locating then + report_expansions("scanning path '%s', branch '%s'",path, branch or path) + end + local realpath = resolvers.resolve(path) -- no shortcut + local files, n, m, r = scan({ },realpath .. '/',"",0,0,0) + files.__path__ = path -- can be selfautoparent:texmf-whatever + files.__files__ = n + files.__directories__ = m + files.__remappings__ = r + if trace_locating then + report_expansions("%s files found on %s directories with %s uppercase remappings",n,m,r) end - local t = (instance and instance.loadtime) or 0 - return t > statistics.threshold + return files end -function statistics.elapsedseconds(instance,rest) -- returns nil if 0 seconds - if statistics.elapsedindeed(instance) then - return format("%s seconds %s", statistics.elapsedtime(instance),rest or "") - end -end --- general function -function statistics.register(tag,fnc) - if statistics.enable and type(fnc) == "function" then - local rt = registered[tag] or (#statusinfo + 1) - statusinfo[rt] = { tag, fnc } - registered[tag] = rt - if #tag > n then n = #tag end - end -end +end -- of closure -function statistics.show(reporter) - if statistics.enable then - if not reporter then reporter = function(tag,data,n) texio.write_nl(tag .. " " .. data) end end - -- this code will move - local register = statistics.register - register("luatex banner", function() - return string.lower(status.banner) - end) - register("control sequences", function() - return format("%s of %s", status.cs_count, status.hash_size+status.hash_extra) - end) - register("callbacks", function() - local total, indirect = status.callbacks or 0, status.indirect_callbacks or 0 - return format("direct: %s, indirect: %s, total: %s", total-indirect, indirect, total) - end) - register("current memory usage", statistics.memused) - register("runtime",statistics.runtime) --- -- - for i=1,#statusinfo do - local s = statusinfo[i] - local r = s[2]() - if r then - reporter(s[1],r,n) +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-env'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +local lower, gsub = string.lower, string.gsub + +local resolvers = resolvers + +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex +local fileextname = file.extname + +local formats = allocate() +local suffixes = allocate() +local dangerous = allocate() +local suffixmap = allocate() + +resolvers.formats = formats +resolvers.suffixes = suffixes +resolvers.dangerous = dangerous +resolvers.suffixmap = suffixmap + +local relations = allocate { -- todo: handlers also here + core = { + ofm = { -- will become obsolete + names = { "ofm", "omega font metric", "omega font metrics" }, + variable = 'OFMFONTS', + suffixes = { 'ofm', 'tfm' }, + }, + ovf = { -- will become obsolete + names = { "ovf", "omega virtual font", "omega virtual fonts" }, + variable = 'OVFFONTS', + suffixes = { 'ovf', 'vf' }, + }, + tfm = { + names = { "tfm", "tex font metric", "tex font metrics" }, + variable = 'TFMFONTS', + suffixes = { 'tfm' }, + }, + vf = { + names = { "vf", "virtual font", "virtual fonts" }, + variable = 'VFFONTS', + suffixes = { 'vf' }, + }, + otf = { + names = { "otf", "opentype", "opentype font", "opentype fonts"}, + variable = 'OPENTYPEFONTS', + suffixes = { 'otf' }, + }, + ttf = { + names = { "ttf", "truetype", "truetype font", "truetype fonts", "truetype collection", "truetype collections", "truetype dictionary", "truetype dictionaries" }, + variable = 'TTFONTS', + suffixes = { 'ttf', 'ttc', 'dfont' }, + }, + afm = { + names = { "afm", "adobe font metric", "adobe font metrics" }, + variable = "AFMFONTS", + suffixes = { "afm" }, + }, + pfb = { + names = { "pfb", "type1", "type 1", "type1 font", "type 1 font", "type1 fonts", "type 1 fonts" }, + variable = 'T1FONTS', + suffixes = { 'pfb', 'pfa' }, + }, + fea = { + names = { "fea", "font feature", "font features", "font feature file", "font feature files" }, + variable = 'FONTFEATURES', + suffixes = { 'fea' }, + }, + cid = { + names = { "cid", "cid map", "cid maps", "cid file", "cid files" }, + variable = 'FONTCIDMAPS', + suffixes = { 'cid', 'cidmap' }, + }, + fmt = { + names = { "fmt", "format", "tex format" }, + variable = 'TEXFORMATS', + suffixes = { 'fmt' }, + }, + mem = { -- will become obsolete + names = { 'mem', "metapost format" }, + variable = 'MPMEMS', + suffixes = { 'mem' }, + }, + mp = { + names = { "mp" }, + variable = 'MPINPUTS', + suffixes = { 'mp' }, + }, + tex = { + names = { "tex" }, + variable = 'TEXINPUTS', + suffixes = { 'tex', "mkiv", "mkiv", "mkii" }, + }, + icc = { + names = { "icc", "icc profile", "icc profiles" }, + variable = 'ICCPROFILES', + suffixes = { 'icc' }, + }, + texmfscripts = { + names = { "texmfscript", "texmfscripts", "script", "scripts" }, + variable = 'TEXMFSCRIPTS', + suffixes = { 'rb', 'pl', 'py' }, + }, + lua = { + names = { "lua" }, + variable = 'LUAINPUTS', + suffixes = { 'lua', 'luc', 'tma', 'tmc' }, + }, + lib = { + names = { "lib" }, + variable = 'CLUAINPUTS', + suffixes = os.libsuffix and { os.libsuffix } or { 'dll', 'so' }, + }, + bib = { + names = { 'bib' }, + suffixes = { 'bib' }, + }, + bst = { + names = { 'bst' }, + suffixes = { 'bst' }, + }, + fontconfig = { + names = { 'fontconfig', 'fontconfig file', 'fontconfig files' }, + variable = 'FONTCONFIG_PATH', + }, + }, + obsolete = { + enc = { + names = { "enc", "enc files", "enc file", "encoding files", "encoding file" }, + variable = 'ENCFONTS', + suffixes = { 'enc' }, + }, + map = { + names = { "map", "map files", "map file" }, + variable = 'TEXFONTMAPS', + suffixes = { 'map' }, + }, + lig = { + names = { "lig files", "lig file", "ligature file", "ligature files" }, + variable = 'LIGFONTS', + suffixes = { 'lig' }, + }, + opl = { + names = { "opl" }, + variable = 'OPLFONTS', + suffixes = { 'opl' }, + }, + ovp = { + names = { "ovp" }, + variable = 'OVPFONTS', + suffixes = { 'ovp' }, + }, + }, + kpse = { -- subset + base = { + names = { 'base', "metafont format" }, + variable = 'MFBASES', + suffixes = { 'base', 'bas' }, + }, + cmap = { + names = { 'cmap', 'cmap files', 'cmap file' }, + variable = 'CMAPFONTS', + suffixes = { 'cmap' }, + }, + cnf = { + names = { 'cnf' }, + suffixes = { 'cnf' }, + }, + web = { + names = { 'web' }, + suffixes = { 'web', 'ch' } + }, + cweb = { + names = { 'cweb' }, + suffixes = { 'w', 'web', 'ch' }, + }, + gf = { + names = { 'gf' }, + suffixes = { 'gf' }, + }, + mf = { + names = { 'mf' }, + variable = 'MFINPUTS', + suffixes = { 'mf' }, + }, + mft = { + names = { 'mft' }, + suffixes = { 'mft' }, + }, + pk = { + names = { 'pk' }, + suffixes = { 'pk' }, + }, + }, +} + +resolvers.relations = relations + +-- formats: maps a format onto a variable + +function resolvers.updaterelations() + for category, categories in next, relations do + for name, relation in next, categories do + local rn = relation.names + local rv = relation.variable + local rs = relation.suffixes + if rn and rv then + for i=1,#rn do + local rni = lower(gsub(rn[i]," ","")) + formats[rni] = rv + if rs then + suffixes[rni] = rs + for i=1,#rs do + local rsi = rs[i] + suffixmap[rsi] = rni + end + end + end + end + if rs then end end - texio.write_nl("") -- final newline - statistics.enable = false end end -function statistics.show_job_stat(tag,data,n) - texio.write_nl(format("%-15s: %s - %s","mkiv lua stats",tag:rpadd(n," "),data)) +resolvers.updaterelations() -- push this in the metatable -> newindex + +local function simplified(t,k) + return rawget(t,lower(gsub(k," ",""))) end -function statistics.memused() -- no math.round yet -) - local round = math.round or math.floor - return format("%s MB (ctx: %s MB)",round(collectgarbage("count")/1000), round(status.luastate_bytes/1000000)) +setmetatableindex(formats, simplified) +setmetatableindex(suffixes, simplified) +setmetatableindex(suffixmap, simplified) + +-- A few accessors, mostly for command line tool. + +function resolvers.suffixofformat(str) + local s = suffixes[str] + return s and s[1] or "" end -if statistics.runtime then - -- already loaded and set -elseif luatex and luatex.starttime then - statistics.starttime = luatex.starttime - statistics.loadtime = 0 - statistics.timing = 0 -else - statistics.starttiming(statistics) +function resolvers.suffixofformat(str) + return suffixes[str] or { } end -function statistics.runtime() - statistics.stoptiming(statistics) - return statistics.formatruntime(statistics.elapsedtime(statistics)) +for name, format in next, formats do + dangerous[name] = true -- still needed ? end -function statistics.formatruntime(runtime) - return format("%s seconds", statistics.elapsedtime(statistics)) -end +-- because vf searching is somewhat dangerous, we want to prevent +-- too liberal searching esp because we do a lookup on the current +-- path anyway; only tex (or any) is safe + +dangerous.tex = nil -function statistics.timed(action,report) - local timer = { } - report = report or logs.simple - statistics.starttiming(timer) - action() - statistics.stoptiming(timer) - report("total runtime: %s",statistics.elapsedtime(timer)) -end --- where, not really the best spot for this: +-- more helpers -commands = commands or { } +function resolvers.formatofvariable(str) + return formats[str] or '' +end -local timer +function resolvers.formatofsuffix(str) -- of file + return suffixmap[fileextname(str)] or 'tex' -- so many map onto tex (like mkiv, cld etc) +end -function commands.resettimer() - statistics.resettiming(timer) - statistics.starttiming(timer) +function resolvers.variableofformat(str) + return formats[str] or '' end -function commands.elapsedtime() - statistics.stoptiming(timer) - tex.sprint(statistics.elapsedtime(timer)) +function resolvers.variableofformatorsuffix(str) + local v = formats[str] + if v then + return v + end + v = suffixmap[fileextname(str)] + if v then + return formats[v] + end + return '' end -commands.resettimer() end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['trac-log'] = { - version = 1.001, - comment = "companion to trac-log.mkiv", +if not modules then modules = { } end modules ['data-tmp'] = { + version = 1.100, + comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } --- this is old code that needs an overhaul - ---~ io.stdout:setvbuf("no") ---~ io.stderr:setvbuf("no") - -local write_nl, write = texio.write_nl or print, texio.write or io.write -local format, gmatch = string.format, string.gmatch -local texcount = tex and tex.count - -if texlua then - write_nl = print - write = io.write -end - --[[ldx-- -

This is a prelude to a more extensive logging module. For the sake -of parsing log files, in addition to the standard logging we will -provide an structured file. Actually, any logging that -is hooked into callbacks will be \XML\ by default.

---ldx]]-- +

This module deals with caching data. It sets up the paths and +implements loaders and savers for tables. Best is to set the +following variable. When not set, the usual paths will be +checked. Personally I prefer the (users) temporary path.

-logs = logs or { } -logs.xml = logs.xml or { } -logs.tex = logs.tex or { } + +TEXMFCACHE=$TMP;$TEMP;$TMPDIR;$TEMPDIR;$HOME;$TEXMFVAR;$VARTEXMF;. + ---[[ldx-- -

This looks pretty ugly but we need to speed things up a bit.

+

Currently we do no locking when we write files. This is no real +problem because most caching involves fonts and the chance of them +being written at the same time is small. We also need to extend +luatools with a recache feature.

--ldx]]-- -logs.moreinfo = [[ -more information about ConTeXt and the tools that come with it can be found at: +local format, lower, gsub, concat = string.format, string.lower, string.gsub, table.concat +local mkdirs, isdir = dir.mkdirs, lfs.isdir -maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context -webpage : http://www.pragma-ade.nl / http://tex.aanhet.net -wiki : http://contextgarden.net -]] +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) -logs.levels = { - ['error'] = 1, - ['warning'] = 2, - ['info'] = 3, - ['debug'] = 4, -} +local report_caches = logs.reporter("resolvers","caches") +local report_resolvers = logs.reporter("resolvers","caching") -logs.functions = { - 'report', 'start', 'stop', 'push', 'pop', 'line', 'direct', - 'start_run', 'stop_run', - 'start_page_number', 'stop_page_number', - 'report_output_pages', 'report_output_log', - 'report_tex_stat', 'report_job_stat', - 'show_open', 'show_close', 'show_load', -} +local resolvers = resolvers -logs.tracers = { -} +-- intermezzo -logs.level = 0 -logs.mode = string.lower((os.getenv("MTX.LOG.MODE") or os.getenv("MTX_LOG_MODE") or "tex")) +local directive_cleanup = false directives.register("system.compile.cleanup", function(v) directive_cleanup = v end) +local directive_strip = true directives.register("system.compile.strip", function(v) directive_strip = v end) -function logs.set_level(level) - logs.level = logs.levels[level] or level -end +local compile = utilities.lua.compile -function logs.set_method(method) - for _, v in next, logs.functions do - logs[v] = logs[method][v] or function() end - end +function utilities.lua.compile(luafile,lucfile,cleanup,strip) + if cleanup == nil then cleanup = directive_cleanup end + if strip == nil then strip = directive_strip end + return compile(luafile,lucfile,cleanup,strip) end --- tex logging +-- end of intermezzo -function logs.tex.report(category,fmt,...) -- new - if fmt then - write_nl(category .. " | " .. format(fmt,...)) - else - write_nl(category .. " |") - end -end +caches = caches or { } +local caches = caches -function logs.tex.line(fmt,...) -- new - if fmt then - write_nl(format(fmt,...)) +caches.base = caches.base or "luatex-cache" +caches.more = caches.more or "context" +caches.direct = false -- true is faster but may need huge amounts of memory +caches.tree = false +caches.force = true +caches.ask = false +caches.relocate = false +caches.defaults = { "TMPDIR", "TEMPDIR", "TMP", "TEMP", "HOME", "HOMEPATH" } + +local writable, readables, usedreadables = nil, { }, { } + +-- we could use a metatable for writable and readable but not yet + +local function identify() + -- Combining the loops makes it messy. First we check the format cache path + -- and when the last component is not present we try to create it. + local texmfcaches = resolvers.cleanpathlist("TEXMFCACHE") + if texmfcaches then + for k=1,#texmfcaches do + local cachepath = texmfcaches[k] + if cachepath ~= "" then + cachepath = resolvers.resolve(cachepath) + cachepath = resolvers.cleanpath(cachepath) + cachepath = file.collapsepath(cachepath) + local valid = isdir(cachepath) + if valid then + if file.is_readable(cachepath) then + readables[#readables+1] = cachepath + if not writable and file.is_writable(cachepath) then + writable = cachepath + end + end + elseif not writable and caches.force then + local cacheparent = file.dirname(cachepath) + if file.is_writable(cacheparent) then + if not caches.ask or io.ask(format("\nShould I create the cache path %s?",cachepath), "no", { "yes", "no" }) == "yes" then + mkdirs(cachepath) + if isdir(cachepath) and file.is_writable(cachepath) then + report_caches("created: %s",cachepath) + writable = cachepath + readables[#readables+1] = cachepath + end + end + end + end + end + end + end + -- As a last resort we check some temporary paths but this time we don't + -- create them. + local texmfcaches = caches.defaults + if texmfcaches then + for k=1,#texmfcaches do + local cachepath = texmfcaches[k] + cachepath = resolvers.expansion(cachepath) -- was getenv + if cachepath ~= "" then + cachepath = resolvers.resolve(cachepath) + cachepath = resolvers.cleanpath(cachepath) + local valid = isdir(cachepath) + if valid and file.is_readable(cachepath) then + if not writable and file.is_writable(cachepath) then + readables[#readables+1] = cachepath + writable = cachepath + break + end + end + end + end + end + -- Some extra checking. If we have no writable or readable path then we simply + -- quit. + if not writable then + report_caches("fatal error: there is no valid writable cache path defined") + os.exit() + elseif #readables == 0 then + report_caches("fatal error: there is no valid readable cache path defined") + os.exit() + end + -- why here + writable = dir.expandname(resolvers.cleanpath(writable)) -- just in case + -- moved here + local base, more, tree = caches.base, caches.more, caches.tree or caches.treehash() -- we have only one writable tree + if tree then + caches.tree = tree + writable = mkdirs(writable,base,more,tree) + for i=1,#readables do + readables[i] = file.join(readables[i],base,more,tree) + end else - write_nl("") + writable = mkdirs(writable,base,more) + for i=1,#readables do + readables[i] = file.join(readables[i],base,more) + end end + -- end + if trace_cache then + for i=1,#readables do + report_caches("using readable path '%s' (order %s)",readables[i],i) + end + report_caches("using writable path '%s'",writable) + end + identify = function() + return writable, readables + end + return writable, readables end ---~ function logs.tex.start_page_number() ---~ local real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno ---~ if real > 0 then ---~ if user > 0 then ---~ if sub > 0 then ---~ write(format("[%s.%s.%s",real,user,sub)) ---~ else ---~ write(format("[%s.%s",real,user)) ---~ end ---~ else ---~ write(format("[%s",real)) ---~ end ---~ else ---~ write("[-") ---~ end ---~ end - ---~ function logs.tex.stop_page_number() ---~ write("]") ---~ end - -local real, user, sub - -function logs.tex.start_page_number() - real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno -end - -function logs.tex.stop_page_number() - if real > 0 then - if user > 0 then - if sub > 0 then - logs.report("pages", "flushing realpage %s, userpage %s, subpage %s",real,user,sub) - else - logs.report("pages", "flushing realpage %s, userpage %s",real,user) +function caches.usedpaths() + local writable, readables = identify() + if #readables > 1 then + local result = { } + for i=1,#readables do + local readable = readables[i] + if usedreadables[i] or readable == writable then + result[#result+1] = format("readable: '%s' (order %s)",readable,i) end - else - logs.report("pages", "flushing realpage %s",real) end + result[#result+1] = format("writable: '%s'",writable) + return result else - logs.report("pages", "flushing page") + return writable end - io.flush() end -logs.tex.report_job_stat = statistics.show_job_stat - --- xml logging +function caches.configfiles() + return table.concat(resolvers.instance.specification,";") +end -function logs.xml.report(category,fmt,...) -- new - if fmt then - write_nl(format("%s",category,format(fmt,...))) - else - write_nl(format("",category)) +function caches.hashed(tree) + tree = gsub(tree,"\\$","/") + tree = gsub(tree,"/+$","") + tree = lower(tree) + local hash = md5.hex(tree) + if trace_cache or trace_locating then + report_caches("hashing tree %s, hash %s",tree,hash) end + return hash end -function logs.xml.line(fmt,...) -- new - if fmt then - write_nl(format("%s",format(fmt,...))) + +function caches.treehash() + local tree = caches.configfiles() + if not tree or tree == "" then + return false else - write_nl("") + return caches.hashed(tree) end end -function logs.xml.start() if logs.level > 0 then tw("<%s>" ) end end -function logs.xml.stop () if logs.level > 0 then tw("") end end -function logs.xml.push () if logs.level > 0 then tw("" ) end end - -function logs.xml.start_run() - write_nl("") - write_nl("") -- xmlns='www.pragma-ade.com/luatex/schemas/context-job.rng' - write_nl("") -end +local r_cache, w_cache = { }, { } -- normally w in in r but who cares -function logs.xml.stop_run() - write_nl("") +local function getreadablepaths(...) -- we can optimize this as we have at most 2 tags + local tags = { ... } + local hash = concat(tags,"/") + local done = r_cache[hash] + if not done then + local writable, readables = identify() -- exit if not found + if #tags > 0 then + done = { } + for i=1,#readables do + done[i] = file.join(readables[i],...) + end + else + done = readables + end + r_cache[hash] = done + end + return done end -function logs.xml.start_page_number() - write_nl(format("

0 then + done = mkdirs(writable,...) + else + done = writable + end + w_cache[hash] = done + end + return done end -function logs.xml.stop_page_number() - write("/>") - write_nl("") -end +caches.getreadablepaths = getreadablepaths +caches.getwritablepath = getwritablepath -function logs.xml.report_output_pages(p,b) - write_nl(format("", p)) - write_nl(format("", b)) - write_nl("") +function caches.getfirstreadablefile(filename,...) + local rd = getreadablepaths(...) + for i=1,#rd do + local path = rd[i] + local fullname = file.join(path,filename) + if file.is_readable(fullname) then + usedreadables[i] = true + return fullname, path + end + end + return caches.setfirstwritablefile(filename,...) end -function logs.xml.report_output_log() +function caches.setfirstwritablefile(filename,...) + local wr = getwritablepath(...) + local fullname = file.join(wr,filename) + return fullname, wr end -function logs.xml.report_tex_stat(k,v) - texiowrite_nl("log",""..tostring(v).."") +function caches.define(category,subcategory) -- for old times sake + return function() + return getwritablepath(category,subcategory) + end end -local level = 0 - -function logs.xml.show_open(name) - level = level + 1 - texiowrite_nl(format("",level,name)) +function caches.setluanames(path,name) + return path .. "/" .. name .. ".tma", path .. "/" .. name .. ".tmc" end -function logs.xml.show_close(name) - texiowrite(" ") - level = level - 1 +function caches.loaddata(readables,name) + if type(readables) == "string" then + readables = { readables } + end + for i=1,#readables do + local path = readables[i] + local tmaname, tmcname = caches.setluanames(path,name) + local loader = loadfile(tmcname) or loadfile(tmaname) + if loader then + loader = loader() + collectgarbage("step") + return loader + end + end + return false end -function logs.xml.show_load(name) - texiowrite_nl(format("",level+1,name)) +function caches.is_writable(filepath,filename) + local tmaname, tmcname = caches.setluanames(filepath,filename) + return file.is_writable(tmaname) end --- - -local name, banner = 'report', 'context' +local saveoptions = { compact = true } -local function report(category,fmt,...) - if fmt then - write_nl(format("%s | %s: %s",name,category,format(fmt,...))) - elseif category then - write_nl(format("%s | %s",name,category)) - else - write_nl(format("%s |",name)) +function caches.savedata(filepath,filename,data,raw) + local tmaname, tmcname = caches.setluanames(filepath,filename) + local reduce, simplify = true, true + if raw then + reduce, simplify = false, false end -end - -local function simple(fmt,...) - if fmt then - write_nl(format("%s | %s",name,format(fmt,...))) + data.cache_uuid = os.uuid() + if caches.direct then + file.savedata(tmaname,table.serialize(data,true,saveoptions)) else - write_nl(format("%s |",name)) + table.tofile(tmaname,data,true,saveoptions) end + utilities.lua.compile(tmaname,tmcname) end -function logs.setprogram(_name_,_banner_,_verbose_) - name, banner = _name_, _banner_ - if _verbose_ then - trackers.enable("resolvers.locating") - end - logs.set_method("tex") - logs.report = report -- also used in libraries - logs.simple = simple -- only used in scripts ! - if utils then - utils.report = simple - end - logs.verbose = _verbose_ -end +-- moved from data-res: -function logs.setverbose(what) - if what then - trackers.enable("resolvers.locating") - else - trackers.disable("resolvers.locating") - end - logs.verbose = what or false -end +local content_state = { } -function logs.extendbanner(_banner_,_verbose_) - banner = banner .. " | ".. _banner_ - if _verbose_ ~= nil then - logs.setverbose(what) - end +function caches.contentstate() + return content_state or { } end -logs.verbose = false -logs.report = logs.tex.report -logs.simple = logs.tex.report - -function logs.reportlines(str) -- todo: - for line in gmatch(str,"(.-)[\n\r]") do - logs.report(line) +function caches.loadcontent(cachename,dataname) + local name = caches.hashed(cachename) + local full, path = caches.getfirstreadablefile(name ..".lua","trees") + local filename = file.join(path,name) + local blob = loadfile(filename .. ".luc") or loadfile(filename .. ".lua") + if blob then + local data = blob() + if data and data.content then + if data.type == dataname then + if data.version == resolvers.cacheversion then + content_state[#content_state+1] = data.uuid + if trace_locating then + report_resolvers("loading '%s' for '%s' from '%s'",dataname,cachename,filename) + end + return data.content + else + report_resolvers("skipping '%s' for '%s' from '%s' (version mismatch)",dataname,cachename,filename) + end + else + report_resolvers("skipping '%s' for '%s' from '%s' (datatype mismatch)",dataname,cachename,filename) + end + elseif trace_locating then + report_resolvers("skipping '%s' for '%s' from '%s' (no content)",dataname,cachename,filename) + end + elseif trace_locating then + report_resolvers("skipping '%s' for '%s' from '%s' (invalid file)",dataname,cachename,filename) end end -function logs.reportline() -- for scripts too - logs.report() -end - -logs.simpleline = logs.reportline - -function logs.reportbanner() -- for scripts too - logs.report(banner) -end - -function logs.help(message,option) - logs.reportbanner() - logs.reportline() - logs.reportlines(message) - local moreinfo = logs.moreinfo or "" - if moreinfo ~= "" and option ~= "nomoreinfo" then - logs.reportline() - logs.reportlines(moreinfo) +function caches.collapsecontent(content) + for k, v in next, content do + if type(v) == "table" and #v == 1 then + content[k] = v[1] + end end end -logs.set_level('error') -logs.set_method('tex') - -function logs.system(whereto,process,jobname,category,...) - for i=1,10 do - local f = io.open(whereto,"a") - if f then - f:write(format("%s %s => %s => %s => %s\r",os.date("%d/%m/%y %H:%m:%S"),process,jobname,category,format(...))) - f:close() - break +function caches.savecontent(cachename,dataname,content) + local name = caches.hashed(cachename) + local full, path = caches.setfirstwritablefile(name ..".lua","trees") + local filename = file.join(path,name) -- is full + local luaname, lucname = filename .. ".lua", filename .. ".luc" + if trace_locating then + report_resolvers("preparing '%s' for '%s'",dataname,cachename) + end + local data = { + type = dataname, + root = cachename, + version = resolvers.cacheversion, + date = os.date("%Y-%m-%d"), + time = os.date("%H:%M:%S"), + content = content, + uuid = os.uuid(), + } + local ok = io.savedata(luaname,table.serialize(data,true)) + if ok then + if trace_locating then + report_resolvers("category '%s', cachename '%s' saved in '%s'",dataname,cachename,luaname) + end + if utilities.lua.compile(luaname,lucname) then + if trace_locating then + report_resolvers("'%s' compiled to '%s'",dataname,lucname) + end + return true else - sleep(0.1) + if trace_locating then + report_resolvers("compiling failed for '%s', deleting file '%s'",dataname,lucname) + end + os.remove(lucname) end + elseif trace_locating then + report_resolvers("unable to save '%s' in '%s' (access error)",dataname,luaname) end end ---~ local syslogname = "oeps.xxx" ---~ ---~ for i=1,10 do ---~ logs.system(syslogname,"context","test","fonts","font %s recached due to newer version (%s)","blabla","123") ---~ end - -function logs.fatal(where,...) - logs.report(where,"fatal error: %s, aborting now",format(...)) - os.exit() -end - end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['data-inp'] = { - version = 1.001, +if not modules then modules = { } end modules ['data-met'] = { + version = 1.100, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files", + license = "see context related readme files" } --- After a few years using the code the large luat-inp.lua file --- has been split up a bit. In the process some functionality was --- dropped: --- --- * support for reading lsr files --- * selective scanning (subtrees) --- * some public auxiliary functions were made private --- --- TODO: os.getenv -> os.env[] --- TODO: instances.[hashes,cnffiles,configurations,522] --- TODO: check escaping in find etc, too much, too slow +local find, format = string.find, string.format +local sequenced = table.sequenced +local addurlscheme, urlhashed = url.addscheme, url.hashed --- This lib is multi-purpose and can be loaded again later on so that --- additional functionality becomes available. We will split thislogs.report("fileio", --- module in components once we're done with prototyping. This is the --- first code I wrote for LuaTeX, so it needs some cleanup. Before changing --- something in this module one can best check with Taco or Hans first; there --- is some nasty trickery going on that relates to traditional kpse support. +local trace_locating = false --- To be considered: hash key lowercase, first entry in table filename --- (any case), rest paths (so no need for optimization). Or maybe a --- separate table that matches lowercase names to mixed case when --- present. In that case the lower() cases can go away. I will do that --- only when we run into problems with names ... well ... Iwona-Regular. +trackers.register("resolvers.locating", function(v) trace_methods = v end) +trackers.register("resolvers.methods", function(v) trace_methods = v end) --- Beware, loading and saving is overloaded in luat-tmp! -local format, gsub, find, lower, upper, match, gmatch = string.format, string.gsub, string.find, string.lower, string.upper, string.match, string.gmatch -local concat, insert, sortedkeys = table.concat, table.insert, table.sortedkeys -local next, type = next, type -local lpegmatch = lpeg.match +local report_methods = logs.reporter("resolvers","methods") + +local allocate = utilities.storage.allocate -local trace_locating, trace_detail, trace_expansions = false, false, false +local resolvers = resolvers -trackers.register("resolvers.locating", function(v) trace_locating = v end) -trackers.register("resolvers.details", function(v) trace_detail = v end) -trackers.register("resolvers.expansions", function(v) trace_expansions = v end) -- todo +local registered = { } -if not resolvers then - resolvers = { - suffixes = { }, - formats = { }, - dangerous = { }, - suffixmap = { }, - alternatives = { }, - locators = { }, -- locate databases - hashers = { }, -- load databases - generators = { }, -- generate databases - } +local function splitmethod(filename) -- todo: filetype in specification + if not filename then + return { scheme = "unknown", original = filename } + end + if type(filename) == "table" then + return filename -- already split + end + filename = file.collapsepath(filename) + if not find(filename,"://") then + return { scheme = "file", path = filename, original = filename, filename = filename } + end + local specification = url.hashed(filename) + if not specification.scheme or specification.scheme == "" then + return { scheme = "file", path = filename, original = filename, filename = filename } + else + return specification + end end -local resolvers = resolvers +resolvers.splitmethod = splitmethod -- bad name but ok -resolvers.locators .notfound = { nil } -resolvers.hashers .notfound = { nil } -resolvers.generators.notfound = { nil } - -resolvers.cacheversion = '1.0.1' -resolvers.cnfname = 'texmf.cnf' -resolvers.luaname = 'texmfcnf.lua' -resolvers.homedir = os.env[os.type == "windows" and 'USERPROFILE'] or os.env['HOME'] or '~' -resolvers.cnfdefault = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c}' - -local dummy_path_expr = "^!*unset/*$" - -local formats = resolvers.formats -local suffixes = resolvers.suffixes -local dangerous = resolvers.dangerous -local suffixmap = resolvers.suffixmap -local alternatives = resolvers.alternatives - -formats['afm'] = 'AFMFONTS' suffixes['afm'] = { 'afm' } -formats['enc'] = 'ENCFONTS' suffixes['enc'] = { 'enc' } -formats['fmt'] = 'TEXFORMATS' suffixes['fmt'] = { 'fmt' } -formats['map'] = 'TEXFONTMAPS' suffixes['map'] = { 'map' } -formats['mp'] = 'MPINPUTS' suffixes['mp'] = { 'mp' } -formats['ocp'] = 'OCPINPUTS' suffixes['ocp'] = { 'ocp' } -formats['ofm'] = 'OFMFONTS' suffixes['ofm'] = { 'ofm', 'tfm' } -formats['otf'] = 'OPENTYPEFONTS' suffixes['otf'] = { 'otf' } -- 'ttf' -formats['opl'] = 'OPLFONTS' suffixes['opl'] = { 'opl' } -formats['otp'] = 'OTPINPUTS' suffixes['otp'] = { 'otp' } -formats['ovf'] = 'OVFFONTS' suffixes['ovf'] = { 'ovf', 'vf' } -formats['ovp'] = 'OVPFONTS' suffixes['ovp'] = { 'ovp' } -formats['tex'] = 'TEXINPUTS' suffixes['tex'] = { 'tex' } -formats['tfm'] = 'TFMFONTS' suffixes['tfm'] = { 'tfm' } -formats['ttf'] = 'TTFONTS' suffixes['ttf'] = { 'ttf', 'ttc', 'dfont' } -formats['pfb'] = 'T1FONTS' suffixes['pfb'] = { 'pfb', 'pfa' } -formats['vf'] = 'VFFONTS' suffixes['vf'] = { 'vf' } - -formats['fea'] = 'FONTFEATURES' suffixes['fea'] = { 'fea' } -formats['cid'] = 'FONTCIDMAPS' suffixes['cid'] = { 'cid', 'cidmap' } - -formats ['texmfscripts'] = 'TEXMFSCRIPTS' -- new -suffixes['texmfscripts'] = { 'rb', 'pl', 'py' } -- 'lua' - -formats ['lua'] = 'LUAINPUTS' -- new -suffixes['lua'] = { 'lua', 'luc', 'tma', 'tmc' } - --- backward compatible ones - -alternatives['map files'] = 'map' -alternatives['enc files'] = 'enc' -alternatives['cid maps'] = 'cid' -- great, why no cid files -alternatives['font feature files'] = 'fea' -- and fea files here -alternatives['opentype fonts'] = 'otf' -alternatives['truetype fonts'] = 'ttf' -alternatives['truetype collections'] = 'ttc' -alternatives['truetype dictionary'] = 'dfont' -alternatives['type1 fonts'] = 'pfb' - --- obscure ones - -formats ['misc fonts'] = '' -suffixes['misc fonts'] = { } - -formats ['sfd'] = 'SFDFONTS' -suffixes ['sfd'] = { 'sfd' } -alternatives['subfont definition files'] = 'sfd' - --- lib paths - -formats ['lib'] = 'CLUAINPUTS' -- new (needs checking) -suffixes['lib'] = (os.libsuffix and { os.libsuffix }) or { 'dll', 'so' } +-- the second argument is always analyzed (saves time later on) and the original +-- gets passed as original but also as argument --- In practice we will work within one tds tree, but i want to keep --- the option open to build tools that look at multiple trees, which is --- why we keep the tree specific data in a table. We used to pass the --- instance but for practical pusposes we now avoid this and use a --- instance variable. +local function methodhandler(what,first,...) -- filename can be nil or false + local method = registered[what] + if method then + local how, namespace = method.how, method.namespace + if how == "uri" or how == "url" then + local specification = splitmethod(first) + local scheme = specification.scheme + local resolver = namespace and namespace[scheme] + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, scheme=%s, argument=%s",what,how,scheme,first) + end + return resolver(specification,...) + else + resolver = namespace.default or namespace.file + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, default, argument=%s",what,how,first) + end + return resolver(specification,...) + elseif trace_methods then + report_methods("resolver: method=%s, how=%s, no handler",what,how) + end + end + elseif how == "tag" then + local resolver = namespace and namespace[first] + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, tag=%s",what,how,first) + end + return resolver(...) + else + resolver = namespace.default or namespace.file + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, default",what,how) + end + return resolver(...) + elseif trace_methods then + report_methods("resolver: method=%s, how=%s, unknown",what,how) + end + end + end + else + report_methods("resolver: method=%s, unknown",what) + end +end --- here we catch a few new thingies (todo: add these paths to context.tmf) --- --- FONTFEATURES = .;$TEXMF/fonts/fea// --- FONTCIDMAPS = .;$TEXMF/fonts/cid// +resolvers.methodhandler = methodhandler + +function resolvers.registermethod(name,namespace,how) + registered[name] = { how = how or "tag", namespace = namespace } + namespace["byscheme"] = function(scheme,filename,...) + if scheme == "file" then + return methodhandler(name,filename,...) + else + return methodhandler(name,addurlscheme(filename,scheme),...) + end + end +end --- we always have one instance active +local concatinators = allocate { notfound = file.join } -- concatinate paths +local locators = allocate { notfound = function() end } -- locate databases +local hashers = allocate { notfound = function() end } -- load databases +local generators = allocate { notfound = function() end } -- generate databases -resolvers.instance = resolvers.instance or nil -- the current one (slow access) -local instance = resolvers.instance or nil -- the current one (fast access) +resolvers.concatinators = concatinators +resolvers.locators = locators +resolvers.hashers = hashers +resolvers.generators = generators -function resolvers.newinstance() +local registermethod = resolvers.registermethod - -- store once, freeze and faster (once reset we can best use - -- instance.environment) maybe better have a register suffix - -- function +registermethod("concatinators",concatinators,"tag") +registermethod("locators", locators, "uri") +registermethod("hashers", hashers, "uri") +registermethod("generators", generators, "uri") - for k, v in next, suffixes do - for i=1,#v do - local vi = v[i] - if vi then - suffixmap[vi] = k - end - end - end - -- because vf searching is somewhat dangerous, we want to prevent - -- too liberal searching esp because we do a lookup on the current - -- path anyway; only tex (or any) is safe +end -- of closure - for k, v in next, formats do - dangerous[k] = true - end - dangerous.tex = nil +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-res'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +-- In practice we will work within one tds tree, but i want to keep +-- the option open to build tools that look at multiple trees, which is +-- why we keep the tree specific data in a table. We used to pass the +-- instance but for practical purposes we now avoid this and use a +-- instance variable. We always have one instance active (sort of global). + +-- todo: cache:/// home:/// + +local format, gsub, find, lower, upper, match, gmatch = string.format, string.gsub, string.find, string.lower, string.upper, string.match, string.gmatch +local concat, insert, sortedkeys = table.concat, table.insert, table.sortedkeys +local next, type, rawget = next, type, rawget +local os = os - -- the instance +local P, S, R, C, Cc, Cs, Ct, Carg = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Carg +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns - local newinstance = { - rootpath = '', - treepath = '', - progname = 'context', - engine = 'luatex', - format = '', - environment = { }, - variables = { }, - expansions = { }, - files = { }, - remap = { }, - configuration = { }, - setup = { }, - order = { }, - found = { }, - foundintrees = { }, - kpsevars = { }, - hashes = { }, - cnffiles = { }, - luafiles = { }, - lists = { }, - remember = true, - diskcache = true, - renewcache = false, - scandisk = true, - cachepath = nil, - loaderror = false, - sortdata = false, - savelists = true, - cleanuppaths = true, - allresults = false, - pattern = nil, -- lists - data = { }, -- only for loading - force_suffixes = true, - fakepaths = { }, - } +local filedirname = file.dirname +local filebasename = file.basename +local fileextname = file.extname +local filejoin = file.join +local collapsepath = file.collapsepath +local joinpath = file.joinpath +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex - local ne = newinstance.environment +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_detail = false trackers.register("resolvers.details", function(v) trace_detail = v end) +local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end) - for k,v in next, os.env do - ne[k] = resolvers.bare_variable(v) - end +local report_resolving = logs.reporter("resolvers","resolving") - return newinstance +local resolvers = resolvers -end +local expandedpathfromlist = resolvers.expandedpathfromlist +local checkedvariable = resolvers.checkedvariable +local splitconfigurationpath = resolvers.splitconfigurationpath +local methodhandler = resolvers.methodhandler -function resolvers.setinstance(someinstance) - instance = someinstance - resolvers.instance = someinstance - return someinstance -end +local initializesetter = utilities.setters.initialize -function resolvers.reset() - return resolvers.setinstance(resolvers.newinstance()) -end +local ostype, osname, osenv, ossetenv, osgetenv = os.type, os.name, os.env, os.setenv, os.getenv -local function reset_hashes() - instance.lists = { } - instance.found = { } -end +resolvers.cacheversion = '1.0.1' +resolvers.configbanner = '' +resolvers.homedir = environment.homedir +resolvers.criticalvars = allocate { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF", "TEXMF", "TEXOS" } +resolvers.luacnfname = 'texmfcnf.lua' +resolvers.luacnfstate = "unknown" -local function check_configuration() -- not yet ok, no time for debugging now - if os.env["OSFONTDIR"] then - -- ok - elseif os.type == "windows" then - os.setenv("OSFONTDIR","c:/windows/fonts//") - elseif os.type == "macosx" then - os.setenv("OSFONTDIR","$HOME/Library/Fonts//;/Library/Fonts//;/System/Library/Fonts//") - end -end +-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path +resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}' -function resolvers.bare_variable(str) -- assumes str is a string - return (gsub(str,"\s*([\"\']?)(.+)%1\s*", "%2")) -end -function resolvers.settrace(n) -- no longer number but: 'locating' or 'detail' - if n then - trackers.disable("resolvers.*") - trackers.enable("resolvers."..n) - end -end -resolvers.settrace(os.getenv("MTX_INPUT_TRACE")) +local unset_variable = "unset" -function resolvers.osenv(key) - local ie = instance.environment - local value = ie[key] - if value == nil then - -- local e = os.getenv(key) - local e = os.env[key] - if e == nil then - -- value = "" -- false - else - value = resolvers.bare_variable(e) - end - ie[key] = value - end - return value or "" -end +local formats = resolvers.formats +local suffixes = resolvers.suffixes +local dangerous = resolvers.dangerous +local suffixmap = resolvers.suffixmap -function resolvers.env(key) - return instance.environment[key] or resolvers.osenv(key) -end +resolvers.defaultsuffixes = { "tex" } -- "mkiv", "cld" -- too tricky --- +resolvers.instance = resolvers.instance or nil -- the current one (slow access) +local instance = resolvers.instance or nil -- the current one (fast access) -local function expand_vars(lst) -- simple vars - local variables, env = instance.variables, resolvers.env - local function resolve(a) - return variables[a] or env(a) - end - for k=1,#lst do - lst[k] = gsub(lst[k],"%$([%a%d%_%-]+)",resolve) - end -end +-- An instance has an environment (coming from the outside, kept raw), variables +-- (coming from the configuration file), and expansions (variables with nested +-- variables replaced). One can push something into the outer environment and +-- its internal copy, but only the later one will be the raw unprefixed variant. -local function expanded_var(var) -- simple vars - local function resolve(a) - return instance.variables[a] or resolvers.env(a) +function resolvers.setenv(key,value,raw) + if instance then + -- this one will be consulted first when we stay inside + -- the current environment + instance.environment[key] = value + -- we feed back into the environment, and as this is used + -- by other applications (via os.execute) we need to make + -- sure that prefixes are resolve + ossetenv(key,raw and value or resolvers.resolve(value)) end - return (gsub(var,"%$([%a%d%_%-]+)",resolve)) end -local function entry(entries,name) - if name and (name ~= "") then - name = gsub(name,'%$','') - local result = entries[name..'.'..instance.progname] or entries[name] - if result then - return result - else - result = resolvers.env(name) - if result then - instance.variables[name] = result - resolvers.expand_variables() - return instance.expansions[name] or "" - end - end - end - return "" -end +-- Beware we don't want empty here as this one can be called early on +-- and therefore we use rawget. -local function is_entry(entries,name) - if name and name ~= "" then - name = gsub(name,'%$','') - return (entries[name..'.'..instance.progname] or entries[name]) ~= nil +local function getenv(key) + local value = rawget(instance.environment,key) + if value and value ~= "" then + return value else - return false + local e = osgetenv(key) + return e ~= nil and e ~= "" and checkedvariable(e) or "" end end --- {a,b,c,d} --- a,b,c/{p,q,r},d --- a,b,c/{p,q,r}/d/{x,y,z}// --- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} --- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} --- a{b,c}{d,e}f --- {a,b,c,d} --- {a,b,c/{p,q,r},d} --- {a,b,c/{p,q,r}/d/{x,y,z}//} --- {a,b,c/{p,q/{x,y,z}},d/{p,q,r}} --- {a,b,c/{p,q/{x,y,z},w}v,d/{p,q,r}} --- {$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c} +resolvers.getenv = getenv +resolvers.env = getenv --- this one is better and faster, but it took me a while to realize --- that this kind of replacement is cleaner than messy parsing and --- fuzzy concatenating we can probably gain a bit with selectively --- applying lpeg, but experiments with lpeg parsing this proved not to --- work that well; the parsing is ok, but dealing with the resulting --- table is a pain because we need to work inside-out recursively +-- We are going to use some metatable trickery where we backtrack from +-- expansion to variable to environment. -local function do_first(a,b) - local t = { } - for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end - return "{" .. concat(t,",") .. "}" +local function resolve(k) + return instance.expansions[k] end -local function do_second(a,b) - local t = { } - for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end - return "{" .. concat(t,",") .. "}" -end +local dollarstripper = lpeg.stripper("$") +local inhibitstripper = P("!")^0 * Cs(P(1)^0) +local backslashswapper = lpeg.replacer("\\","/") -local function do_both(a,b) - local t = { } - for sa in gmatch(a,"[^,]+") do - for sb in gmatch(b,"[^,]+") do - t[#t+1] = sa .. sb - end - end - return "{" .. concat(t,",") .. "}" -end +local somevariable = P("$") / "" +local somekey = C(R("az","AZ","09","__","--")^1) +local somethingelse = P(";") * ((1-S("!{}/\\"))^1 * P(";") / "") + + P(";") * (P(";") / "") + + P(1) +local variableexpander = Cs( (somevariable * (somekey/resolve) + somethingelse)^1 ) -local function do_three(a,b,c) - return a .. b.. c -end +local cleaner = P("\\") / "/" + P(";") * S("!{}/\\")^0 * P(";")^1 / ";" +local variablecleaner = Cs((cleaner + P(1))^0) -local function splitpathexpr(str, t, validate) - -- no need for further optimization as it is only called a - -- few times, we can use lpeg for the sub - if trace_expansions then - logs.report("fileio","expanding variable '%s'",str) - end - t = t or { } - str = gsub(str,",}",",@}") - str = gsub(str,"{,","{@,") - -- str = "@" .. str .. "@" - local ok, done - while true do - done = false - while true do - str, ok = gsub(str,"([^{},]+){([^{}]+)}",do_first) - if ok > 0 then done = true else break end - end - while true do - str, ok = gsub(str,"{([^{}]+)}([^{},]+)",do_second) - if ok > 0 then done = true else break end - end - while true do - str, ok = gsub(str,"{([^{}]+)}{([^{}]+)}",do_both) - if ok > 0 then done = true else break end - end - str, ok = gsub(str,"({[^{}]*){([^{}]+)}([^{}]*})",do_three) - if ok > 0 then done = true end - if not done then break end - end - str = gsub(str,"[{}]", "") - str = gsub(str,"@","") - if validate then - for s in gmatch(str,"[^,]+") do - s = validate(s) - if s then t[#t+1] = s end - end - else - for s in gmatch(str,"[^,]+") do - t[#t+1] = s - end - end - if trace_expansions then - for k=1,#t do - logs.report("fileio","% 4i: %s",k,t[k]) - end - end - return t -end +local somevariable = R("az","AZ","09","__","--")^1 / resolve +local variable = (P("$")/"") * (somevariable + (P("{")/"") * somevariable * (P("}")/"")) +local variableresolver = Cs((variable + P(1))^0) -local function expanded_path_from_list(pathlist) -- maybe not a list, just a path - -- a previous version fed back into pathlist - local newlist, ok = { }, false - for k=1,#pathlist do - if find(pathlist[k],"[{}]") then - ok = true - break - end - end - if ok then - local function validate(s) - s = file.collapse_path(s) - return s ~= "" and not find(s,dummy_path_expr) and s - end - for k=1,#pathlist do - splitpathexpr(pathlist[k],newlist,validate) - end - else - for k=1,#pathlist do - for p in gmatch(pathlist[k],"([^,]+)") do - p = file.collapse_path(p) - if p ~= "" then newlist[#newlist+1] = p end - end - end - end - return newlist +local function expandedvariable(var) + return lpegmatch(variableexpander,var) or var end --- we follow a rather traditional approach: --- --- (1) texmf.cnf given in TEXMFCNF --- (2) texmf.cnf searched in default variable --- --- also we now follow the stupid route: if not set then just assume *one* --- cnf file under texmf (i.e. distribution) +function resolvers.newinstance() -- todo: all vars will become lowercase and alphanum only -local args = environment and environment.original_arguments or arg -- this needs a cleanup + if trace_locating then + report_resolving("creating instance") + end -resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex" -resolvers.ownbin = gsub(resolvers.ownbin,"\\","/") + local environment, variables, expansions, order = allocate(), allocate(), allocate(), allocate() -function resolvers.getownpath() - local ownpath = resolvers.ownpath or os.selfdir - if not ownpath or ownpath == "" or ownpath == "unset" then - ownpath = args[-1] or arg[-1] - ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/")) - if not ownpath or ownpath == "" then - ownpath = args[-0] or arg[-0] - ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/")) - end - local binary = resolvers.ownbin - if not ownpath or ownpath == "" then - ownpath = ownpath and file.dirname(binary) - end - if not ownpath or ownpath == "" then - if os.binsuffix ~= "" then - binary = file.replacesuffix(binary,os.binsuffix) - end - for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do - local b = file.join(p,binary) - if lfs.isfile(b) then - -- we assume that after changing to the path the currentdir function - -- resolves to the real location and use this side effect here; this - -- trick is needed because on the mac installations use symlinks in the - -- path instead of real locations - local olddir = lfs.currentdir() - if lfs.chdir(p) then - local pp = lfs.currentdir() - if trace_locating and p ~= pp then - logs.report("fileio","following symlink '%s' to '%s'",p,pp) - end - ownpath = pp - lfs.chdir(olddir) - else - if trace_locating then - logs.report("fileio","unable to check path '%s'",p) - end - ownpath = p - end - break - end + local newinstance = { + environment = environment, + variables = variables, + expansions = expansions, + order = order, + files = allocate(), + setups = allocate(), + found = allocate(), + foundintrees = allocate(), + hashes = allocate(), + hashed = allocate(), + specification = allocate(), + lists = allocate(), + data = allocate(), -- only for loading + fakepaths = allocate(), + remember = true, + diskcache = true, + renewcache = false, + loaderror = false, + savelists = true, + pattern = nil, -- lists + force_suffixes = true, + } + + setmetatableindex(variables,function(t,k) + local v + for i=1,#order do + v = order[i][k] + if v ~= nil then + t[k] = v + return v end end - if not ownpath or ownpath == "" then - ownpath = "." - logs.report("fileio","forcing fallback ownpath .") - elseif trace_locating then - logs.report("fileio","using ownpath '%s'",ownpath) + if v == nil then + v = "" end - end - resolvers.ownpath = ownpath - function resolvers.getownpath() - return resolvers.ownpath - end - return ownpath -end - -local own_places = { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF" } + t[k] = v + return v + end) -local function identify_own() - local ownpath = resolvers.getownpath() or dir.current() - local ie = instance.environment - if ownpath then - if resolvers.env('SELFAUTOLOC') == "" then os.env['SELFAUTOLOC'] = file.collapse_path(ownpath) end - if resolvers.env('SELFAUTODIR') == "" then os.env['SELFAUTODIR'] = file.collapse_path(ownpath .. "/..") end - if resolvers.env('SELFAUTOPARENT') == "" then os.env['SELFAUTOPARENT'] = file.collapse_path(ownpath .. "/../..") end - else - logs.report("fileio","error: unable to locate ownpath") - os.exit() - end - if resolvers.env('TEXMFCNF') == "" then os.env['TEXMFCNF'] = resolvers.cnfdefault end - if resolvers.env('TEXOS') == "" then os.env['TEXOS'] = resolvers.env('SELFAUTODIR') end - if resolvers.env('TEXROOT') == "" then os.env['TEXROOT'] = resolvers.env('SELFAUTOPARENT') end - if trace_locating then - for i=1,#own_places do - local v = own_places[i] - logs.report("fileio","variable '%s' set to '%s'",v,resolvers.env(v) or "unknown") + setmetatableindex(environment, function(t,k) + local v = osgetenv(k) + if v == nil then + v = variables[k] end - end - identify_own = function() end -end - -function resolvers.identify_cnf() - if #instance.cnffiles == 0 then - -- fallback - identify_own() - -- the real search - resolvers.expand_variables() - local t = resolvers.split_path(resolvers.env('TEXMFCNF')) - t = expanded_path_from_list(t) - expand_vars(t) -- redundant - local function locate(filename,list) - for i=1,#t do - local ti = t[i] - local texmfcnf = file.collapse_path(file.join(ti,filename)) - if lfs.isfile(texmfcnf) then - list[#list+1] = texmfcnf - end - end + if v ~= nil then + v = checkedvariable(v) or "" end - locate(resolvers.luaname,instance.luafiles) - locate(resolvers.cnfname,instance.cnffiles) - end -end + v = resolvers.repath(v) -- for taco who has a : separated osfontdir + t[k] = v + return v + end) -local function load_cnf_file(fname) - fname = resolvers.clean_path(fname) - local lname = file.replacesuffix(fname,'lua') - if lfs.isfile(lname) then - local dname = file.dirname(fname) -- fname ? - if not instance.configuration[dname] then - resolvers.load_data(dname,'configuration',lname and file.basename(lname)) - instance.order[#instance.order+1] = instance.configuration[dname] - end - else - f = io.open(fname) - if f then - if trace_locating then - logs.report("fileio","loading configuration file %s", fname) - end - local line, data, n, k, v - local dname = file.dirname(fname) - if not instance.configuration[dname] then - instance.configuration[dname] = { } - instance.order[#instance.order+1] = instance.configuration[dname] - end - local data = instance.configuration[dname] - while true do - local line, n = f:read(), 0 - if line then - while true do -- join lines - line, n = gsub(line,"\\%s*$", "") - if n > 0 then - line = line .. f:read() - else - break - end - end - if not find(line,"^[%%#]") then - local l = gsub(line,"%s*%%.*$","") - local k, v = match(l,"%s*(.-)%s*=%s*(.-)%s*$") - if k and v and not data[k] then - v = gsub(v,"[%%#].*",'') - data[k] = gsub(v,"~","$HOME") - instance.kpsevars[k] = true - end - end - else - break - end - end - f:close() - elseif trace_locating then - logs.report("fileio","skipping configuration file '%s'", fname) + setmetatableindex(expansions, function(t,k) + local v = environment[k] + if type(v) == "string" then + v = lpegmatch(variableresolver,v) + v = lpegmatch(variablecleaner,v) end - end + t[k] = v + return v + end) + + return newinstance + end -local function collapse_cnf_data() -- potential optimization: pass start index (setup and configuration are shared) - local order = instance.order - for i=1,#order do - local c = order[i] - for k,v in next, c do - if not instance.variables[k] then - if instance.environment[k] then - instance.variables[k] = instance.environment[k] - else - instance.kpsevars[k] = true - instance.variables[k] = resolvers.bare_variable(v) - end - end - end - end +function resolvers.setinstance(someinstance) -- only one instance is active + instance = someinstance + resolvers.instance = someinstance + return someinstance end -function resolvers.load_cnf() - local function loadoldconfigdata() - local cnffiles = instance.cnffiles - for i=1,#cnffiles do - load_cnf_file(cnffiles[i]) - end - end - -- instance.cnffiles contain complete names now ! - -- we still use a funny mix of cnf and new but soon - -- we will switch to lua exclusively as we only use - -- the file to collect the tree roots - if #instance.cnffiles == 0 then - if trace_locating then - logs.report("fileio","no cnf files found (TEXMFCNF may not be set/known)") - end - else - local cnffiles = instance.cnffiles - instance.rootpath = cnffiles[1] - for k=1,#cnffiles do - instance.cnffiles[k] = file.collapse_path(cnffiles[k]) - end - for i=1,3 do - instance.rootpath = file.dirname(instance.rootpath) - end - instance.rootpath = file.collapse_path(instance.rootpath) - if instance.diskcache and not instance.renewcache then - resolvers.loadoldconfig(instance.cnffiles) - if instance.loaderror then - loadoldconfigdata() - resolvers.saveoldconfig() - end - else - loadoldconfigdata() - if instance.renewcache then - resolvers.saveoldconfig() - end - end - collapse_cnf_data() - end - check_configuration() +function resolvers.reset() + return resolvers.setinstance(resolvers.newinstance()) end -function resolvers.load_lua() - if #instance.luafiles == 0 then - -- yet harmless - else - instance.rootpath = instance.luafiles[1] - local luafiles = instance.luafiles - for k=1,#luafiles do - instance.luafiles[k] = file.collapse_path(luafiles[k]) - end - for i=1,3 do - instance.rootpath = file.dirname(instance.rootpath) - end - instance.rootpath = file.collapse_path(instance.rootpath) - resolvers.loadnewconfig() - collapse_cnf_data() - end - check_configuration() +local function reset_hashes() + instance.lists = { } + instance.found = { } end --- database loading +local slash = P("/") -function resolvers.load_hash() - resolvers.locatelists() - if instance.diskcache and not instance.renewcache then - resolvers.loadfiles() - if instance.loaderror then - resolvers.loadlists() - resolvers.savefiles() - end +local pathexpressionpattern = Cs ( + Cc("^") * ( + Cc("%") * S(".-") + + slash^2 * P(-1) / "/.*" + + slash^2 / "/.-/" + + (1-slash) * P(-1) * Cc("/") + + P(1) + )^1 * Cc("$") -- yes or no $ +) + +local cache = { } + +local function makepathexpression(str) + if str == "." then + return "^%./$" else - resolvers.loadlists() - if instance.renewcache then - resolvers.savefiles() + local c = cache[str] + if not c then + c = lpegmatch(pathexpressionpattern,str) + cache[str] = c end + return c end end -function resolvers.append_hash(type,tag,name) - if trace_locating then - logs.report("fileio","hash '%s' appended",tag) - end - insert(instance.hashes, { ['type']=type, ['tag']=tag, ['name']=name } ) -end - -function resolvers.prepend_hash(type,tag,name) +local function reportcriticalvariables() if trace_locating then - logs.report("fileio","hash '%s' prepended",tag) - end - insert(instance.hashes, 1, { ['type']=type, ['tag']=tag, ['name']=name } ) -end - -function resolvers.extend_texmf_var(specification) -- crap, we could better prepend the hash --- local t = resolvers.expanded_path_list('TEXMF') -- full expansion - local t = resolvers.split_path(resolvers.env('TEXMF')) - insert(t,1,specification) - local newspec = concat(t,";") - if instance.environment["TEXMF"] then - instance.environment["TEXMF"] = newspec - elseif instance.variables["TEXMF"] then - instance.variables["TEXMF"] = newspec - else - -- weird + for i=1,#resolvers.criticalvars do + local k = resolvers.criticalvars[i] + local v = resolvers.getenv(k) or "unknown" -- this one will not resolve ! + report_resolving("variable '%s' set to '%s'",k,v) + end + report_resolving() end - resolvers.expand_variables() - reset_hashes() + reportcriticalvariables = function() end end --- locators - -function resolvers.locatelists() - local texmfpaths = resolvers.clean_path_list('TEXMF') - for i=1,#texmfpaths do - local path = texmfpaths[i] +local function identify_configuration_files() + local specification = instance.specification + if #specification == 0 then + local cnfspec = getenv('TEXMFCNF') + if cnfspec == "" then + cnfspec = resolvers.luacnfspec + resolvers.luacnfstate = "default" + else + resolvers.luacnfstate = "environment" + end + reportcriticalvariables() + local cnfpaths = expandedpathfromlist(resolvers.splitpath(cnfspec)) + local luacnfname = resolvers.luacnfname + for i=1,#cnfpaths do + local filename = collapsepath(filejoin(cnfpaths[i],luacnfname)) + local realname = resolvers.resolve(filename) + if lfs.isfile(realname) then + specification[#specification+1] = filename + if trace_locating then + report_resolving("found configuration file '%s'",realname) + end + elseif trace_locating then + report_resolving("unknown configuration file '%s'",realname) + end + end if trace_locating then - logs.report("fileio","locating list of '%s'",path) + report_resolving() end - resolvers.locatedatabase(file.collapse_path(path)) - end -end - -function resolvers.locatedatabase(specification) - return resolvers.methodhandler('locators', specification) -end + elseif trace_locating then + report_resolving("configuration files already identified") + end +end + +local function load_configuration_files() + local specification = instance.specification + if #specification > 0 then + local luacnfname = resolvers.luacnfname + for i=1,#specification do + local filename = specification[i] + local pathname = filedirname(filename) + local filename = filejoin(pathname,luacnfname) + local realname = resolvers.resolve(filename) -- no shortcut + local blob = loadfile(realname) + if blob then + local setups = instance.setups + local data = blob() + data = data and data.content + if data then + if trace_locating then + report_resolving("loading configuration file '%s'",filename) + report_resolving() + end + local variables = data.variables or { } + local warning = false + for k, v in next, data do + local variant = type(v) + if variant == "table" then + initializesetter(filename,k,v) + elseif variables[k] == nil then + if trace_locating and not warning then + report_resolving("variables like '%s' in configuration file '%s' should move to the 'variables' subtable", + k,resolvers.resolve(filename)) + warning = true + end + variables[k] = v + end + end + setups[pathname] = variables + if resolvers.luacnfstate == "default" then + -- the following code is not tested + local cnfspec = variables["TEXMFCNF"] + if cnfspec then + if trace_locating then + report_resolving("reloading configuration due to TEXMF redefinition") + end + -- we push the value into the main environment (osenv) so + -- that it takes precedence over the default one and therefore + -- also over following definitions + resolvers.setenv('TEXMFCNF',cnfspec) -- resolves prefixes + -- we now identify and load the specified configuration files + instance.specification = { } + identify_configuration_files() + load_configuration_files() + -- we prevent further overload of the configuration variable + resolvers.luacnfstate = "configuration" + -- we quit the outer loop + break + end + end -function resolvers.locators.tex(specification) - if specification and specification ~= '' and lfs.isdir(specification) then - if trace_locating then - logs.report("fileio","tex locator '%s' found",specification) + else + if trace_locating then + report_resolving("skipping configuration file '%s' (no content)",filename) + end + setups[pathname] = { } + instance.loaderror = true + end + elseif trace_locating then + report_resolving("skipping configuration file '%s' (no file)",filename) + end + instance.order[#instance.order+1] = instance.setups[pathname] + if instance.loaderror then + break + end end - resolvers.append_hash('file',specification,filename) elseif trace_locating then - logs.report("fileio","tex locator '%s' not found",specification) + report_resolving("warning: no lua configuration files found") end end --- hashers - -function resolvers.hashdatabase(tag,name) - return resolvers.methodhandler('hashers',tag,name) -end +-- scheme magic ... database loading -function resolvers.loadfiles() - instance.loaderror = false - instance.files = { } +local function load_file_databases() + instance.loaderror, instance.files = false, allocate() if not instance.renewcache then local hashes = instance.hashes for k=1,#hashes do local hash = hashes[k] - resolvers.hashdatabase(hash.tag,hash.name) + resolvers.hashers.byscheme(hash.type,hash.name) if instance.loaderror then break end end end end -function resolvers.hashers.tex(tag,name) - resolvers.load_data(tag,'files') -end - --- generators: - -function resolvers.loadlists() - local hashes = instance.hashes - for i=1,#hashes do - resolvers.generatedatabase(hashes[i].tag) - end -end - -function resolvers.generatedatabase(specification) - return resolvers.methodhandler('generators', specification) -end - --- starting with . or .. etc or funny char - -local weird = lpeg.P(".")^1 + lpeg.anywhere(lpeg.S("~`!#$%^&*()={}[]:;\"\'||<>,?\n\r\t")) - ---~ local l_forbidden = lpeg.S("~`!#$%^&*()={}[]:;\"\'||\\/<>,?\n\r\t") ---~ local l_confusing = lpeg.P(" ") ---~ local l_character = lpeg.patterns.utf8 ---~ local l_dangerous = lpeg.P(".") - ---~ local l_normal = (l_character - l_forbidden - l_confusing - l_dangerous) * (l_character - l_forbidden - l_confusing^2)^0 * lpeg.P(-1) ---~ ----- l_normal = l_normal * lpeg.Cc(true) + lpeg.Cc(false) - ---~ local function test(str) ---~ print(str,lpeg.match(l_normal,str)) ---~ end ---~ test("ヒラギノ明朝 Pro W3") ---~ test("..ヒラギノ明朝 Pro W3") ---~ test(":ヒラギノ明朝 Pro W3;") ---~ test("ヒラギノ明朝 /Pro W3;") ---~ test("ヒラギノ明朝 Pro W3") - -function resolvers.generators.tex(specification) - local tag = specification - if trace_locating then - logs.report("fileio","scanning path '%s'",specification) - end - instance.files[tag] = { } - local files = instance.files[tag] - local n, m, r = 0, 0, 0 - local spec = specification .. '/' - local attributes = lfs.attributes - local directory = lfs.dir - local function action(path) - local full - if path then - full = spec .. path .. '/' - else - full = spec - end - for name in directory(full) do - if not lpegmatch(weird,name) then - -- if lpegmatch(l_normal,name) then - local mode = attributes(full..name,'mode') - if mode == 'file' then - if path then - n = n + 1 - local f = files[name] - if f then - if type(f) == 'string' then - files[name] = { f, path } - else - f[#f+1] = path - end - else -- probably unique anyway - files[name] = path - local lower = lower(name) - if name ~= lower then - files["remap:"..lower] = name - r = r + 1 - end - end - end - elseif mode == 'directory' then - m = m + 1 - if path then - action(path..'/'..name) +local function locate_file_databases() + -- todo: cache:// and tree:// (runtime) + local texmfpaths = resolvers.expandedpathlist('TEXMF') + if #texmfpaths > 0 then + for i=1,#texmfpaths do + local path = collapsepath(texmfpaths[i]) + local stripped = lpegmatch(inhibitstripper,path) -- the !! thing + if stripped ~= "" then + local runtime = stripped == path + path = resolvers.cleanpath(path) + local spec = resolvers.splitmethod(stripped) + if spec.scheme == "cache" or spec.scheme == "file" then + stripped = spec.path + elseif runtime and (spec.noscheme or spec.scheme == "file") then + stripped = "tree:///" .. stripped + end + if trace_locating then + if runtime then + report_resolving("locating list of '%s' (runtime)",path) else - action(name) + report_resolving("locating list of '%s' (cached)",path) end end + methodhandler('locators',stripped) end end - end - action() - if trace_locating then - logs.report("fileio","%s files found on %s directories with %s uppercase remappings",n,m,r) + if trace_locating then + report_resolving() + end + elseif trace_locating then + report_resolving("no texmf paths are defined (using TEXMF)") end end --- savers, todo - -function resolvers.savefiles() - resolvers.save_data('files') +local function generate_file_databases() + local hashes = instance.hashes + for k=1,#hashes do + local hash = hashes[k] + methodhandler('generators',hash.name) + end + if trace_locating then + report_resolving() + end end --- A config (optionally) has the paths split in tables. Internally --- we join them and split them after the expansion has taken place. This --- is more convenient. - ---~ local checkedsplit = string.checkedsplit - -local cache = { } - -local splitter = lpeg.Ct(lpeg.splitat(lpeg.S(os.type == "windows" and ";" or ":;"))) - -local function split_kpse_path(str) -- beware, this can be either a path or a {specification} - local found = cache[str] - if not found then - if str == "" then - found = { } - else - str = gsub(str,"\\","/") ---~ local split = (find(str,";") and checkedsplit(str,";")) or checkedsplit(str,io.pathseparator) -local split = lpegmatch(splitter,str) - found = { } - for i=1,#split do - local s = split[i] - if not find(s,"^{*unset}*") then - found[#found+1] = s - end - end - if trace_expansions then - logs.report("fileio","splitting path specification '%s'",str) - for k=1,#found do - logs.report("fileio","% 4i: %s",k,found[k]) - end +local function save_file_databases() -- will become cachers + for i=1,#instance.hashes do + local hash = instance.hashes[i] + local cachename = hash.name + if hash.cache then + local content = instance.files[cachename] + caches.collapsecontent(content) + if trace_locating then + report_resolving("saving tree '%s'",cachename) end - cache[str] = found + caches.savecontent(cachename,"files",content) + elseif trace_locating then + report_resolving("not saving runtime tree '%s'",cachename) end end - return found end -resolvers.split_kpse_path = split_kpse_path - -function resolvers.splitconfig() - for i=1,#instance do - local c = instance[i] - for k,v in next, c do - if type(v) == 'string' then - local t = split_kpse_path(v) - if #t > 1 then - c[k] = t - end - end +local function load_databases() + locate_file_databases() + if instance.diskcache and not instance.renewcache then + load_file_databases() + if instance.loaderror then + generate_file_databases() + save_file_databases() + end + else + generate_file_databases() + if instance.renewcache then + save_file_databases() end end end -function resolvers.joinconfig() - local order = instance.order - for i=1,#order do - local c = order[i] - for k,v in next, c do -- indexed? - if type(v) == 'table' then - c[k] = file.join_path(v) - end +function resolvers.appendhash(type,name,cache) + -- safeguard ... tricky as it's actually a bug when seen twice + if not instance.hashed[name] then + if trace_locating then + report_resolving("hash '%s' appended",name) end + insert(instance.hashes, { type = type, name = name, cache = cache } ) + instance.hashed[name] = cache end end -function resolvers.split_path(str) - if type(str) == 'table' then - return str - else - return split_kpse_path(str) +function resolvers.prependhash(type,name,cache) + -- safeguard ... tricky as it's actually a bug when seen twice + if not instance.hashed[name] then + if trace_locating then + report_resolving("hash '%s' prepended",name) + end + insert(instance.hashes, 1, { type = type, name = name, cache = cache } ) + instance.hashed[name] = cache end end -function resolvers.join_path(str) - if type(str) == 'table' then - return file.join_path(str) +function resolvers.extendtexmfvariable(specification) -- crap, we could better prepend the hash + local t = resolvers.splitpath(getenv('TEXMF')) + insert(t,1,specification) + local newspec = concat(t,";") + if instance.environment["TEXMF"] then + instance.environment["TEXMF"] = newspec + elseif instance.variables["TEXMF"] then + instance.variables["TEXMF"] = newspec else - return str + -- weird end + reset_hashes() end function resolvers.splitexpansions() local ie = instance.expansions for k,v in next, ie do - local t, h, p = { }, { }, split_kpse_path(v) + local t, tn, h, p = { }, 0, { }, splitconfigurationpath(v) for kk=1,#p do local vv = p[kk] if vv ~= "" and not h[vv] then - t[#t+1] = vv + tn = tn + 1 + t[tn] = vv h[vv] = true end end @@ -9184,343 +11600,92 @@ end -- end of split/join code -function resolvers.saveoldconfig() - resolvers.splitconfig() - resolvers.save_data('configuration') - resolvers.joinconfig() -end - -resolvers.configbanner = [[ --- This is a Luatex configuration file created by 'luatools.lua' or --- 'luatex.exe' directly. For comment, suggestions and questions you can --- contact the ConTeXt Development Team. This configuration file is --- not copyrighted. [HH & TH] -]] - -function resolvers.serialize(files) - -- This version is somewhat optimized for the kind of - -- tables that we deal with, so it's much faster than - -- the generic serializer. This makes sense because - -- luatools and mtxtools are called frequently. Okay, - -- we pay a small price for properly tabbed tables. - local t = { } - local function dump(k,v,m) -- could be moved inline - if type(v) == 'string' then - return m .. "['" .. k .. "']='" .. v .. "'," - elseif #v == 1 then - return m .. "['" .. k .. "']='" .. v[1] .. "'," - else - return m .. "['" .. k .. "']={'" .. concat(v,"','").. "'}," - end - end - t[#t+1] = "return {" - if instance.sortdata then - local sortedfiles = sortedkeys(files) - for i=1,#sortedfiles do - local k = sortedfiles[i] - local fk = files[k] - if type(fk) == 'table' then - t[#t+1] = "\t['" .. k .. "']={" - local sortedfk = sortedkeys(fk) - for j=1,#sortedfk do - local kk = sortedfk[j] - t[#t+1] = dump(kk,fk[kk],"\t\t") - end - t[#t+1] = "\t}," - else - t[#t+1] = dump(k,fk,"\t") - end - end - else - for k, v in next, files do - if type(v) == 'table' then - t[#t+1] = "\t['" .. k .. "']={" - for kk,vv in next, v do - t[#t+1] = dump(kk,vv,"\t\t") - end - t[#t+1] = "\t}," - else - t[#t+1] = dump(k,v,"\t") - end - end - end - t[#t+1] = "}" - return concat(t,"\n") -end - -local data_state = { } - -function resolvers.data_state() - return data_state or { } -end - -function resolvers.save_data(dataname, makename) -- untested without cache overload - for cachename, files in next, instance[dataname] do - local name = (makename or file.join)(cachename,dataname) - local luaname, lucname = name .. ".lua", name .. ".luc" - if trace_locating then - logs.report("fileio","preparing '%s' for '%s'",dataname,cachename) - end - for k, v in next, files do - if type(v) == "table" and #v == 1 then - files[k] = v[1] - end - end - local data = { - type = dataname, - root = cachename, - version = resolvers.cacheversion, - date = os.date("%Y-%m-%d"), - time = os.date("%H:%M:%S"), - content = files, - uuid = os.uuid(), - } - local ok = io.savedata(luaname,resolvers.serialize(data)) - if ok then - if trace_locating then - logs.report("fileio","'%s' saved in '%s'",dataname,luaname) - end - if utils.lua.compile(luaname,lucname,false,true) then -- no cleanup but strip - if trace_locating then - logs.report("fileio","'%s' compiled to '%s'",dataname,lucname) - end - else - if trace_locating then - logs.report("fileio","compiling failed for '%s', deleting file '%s'",dataname,lucname) - end - os.remove(lucname) - end - elseif trace_locating then - logs.report("fileio","unable to save '%s' in '%s' (access error)",dataname,luaname) - end - end -end - -function resolvers.load_data(pathname,dataname,filename,makename) -- untested without cache overload - filename = ((not filename or (filename == "")) and dataname) or filename - filename = (makename and makename(dataname,filename)) or file.join(pathname,filename) - local blob = loadfile(filename .. ".luc") or loadfile(filename .. ".lua") - if blob then - local data = blob() - if data and data.content and data.type == dataname and data.version == resolvers.cacheversion then - data_state[#data_state+1] = data.uuid - if trace_locating then - logs.report("fileio","loading '%s' for '%s' from '%s'",dataname,pathname,filename) - end - instance[dataname][pathname] = data.content - else - if trace_locating then - logs.report("fileio","skipping '%s' for '%s' from '%s'",dataname,pathname,filename) - end - instance[dataname][pathname] = { } - instance.loaderror = true - end - elseif trace_locating then - logs.report("fileio","skipping '%s' for '%s' from '%s'",dataname,pathname,filename) - end -end - --- some day i'll use the nested approach, but not yet (actually we even drop --- engine/progname support since we have only luatex now) --- --- first texmfcnf.lua files are located, next the cached texmf.cnf files --- --- return { --- TEXMFBOGUS = 'effe checken of dit werkt', --- } - -function resolvers.resetconfig() - identify_own() - instance.configuration, instance.setup, instance.order, instance.loaderror = { }, { }, { }, false -end - -function resolvers.loadnewconfig() - local luafiles = instance.luafiles - for i=1,#luafiles do - local cnf = luafiles[i] - local pathname = file.dirname(cnf) - local filename = file.join(pathname,resolvers.luaname) - local blob = loadfile(filename) - if blob then - local data = blob() - if data then - if trace_locating then - logs.report("fileio","loading configuration file '%s'",filename) - end - if true then - -- flatten to variable.progname - local t = { } - for k, v in next, data do -- v = progname - if type(v) == "string" then - t[k] = v - else - for kk, vv in next, v do -- vv = variable - if type(vv) == "string" then - t[vv.."."..v] = kk - end - end - end - end - instance['setup'][pathname] = t - else - instance['setup'][pathname] = data - end - else - if trace_locating then - logs.report("fileio","skipping configuration file '%s'",filename) - end - instance['setup'][pathname] = { } - instance.loaderror = true - end - elseif trace_locating then - logs.report("fileio","skipping configuration file '%s'",filename) - end - instance.order[#instance.order+1] = instance.setup[pathname] - if instance.loaderror then break end - end -end - -function resolvers.loadoldconfig() - if not instance.renewcache then - local cnffiles = instance.cnffiles - for i=1,#cnffiles do - local cnf = cnffiles[i] - local dname = file.dirname(cnf) - resolvers.load_data(dname,'configuration') - instance.order[#instance.order+1] = instance.configuration[dname] - if instance.loaderror then break end - end - end - resolvers.joinconfig() -end +-- we used to have 'files' and 'configurations' so therefore the following +-- shared function -function resolvers.expand_variables() - local expansions, environment, variables = { }, instance.environment, instance.variables - local env = resolvers.env - instance.expansions = expansions - local engine, progname = instance.engine, instance.progname - if type(engine) ~= "string" then instance.engine, engine = "", "" end - if type(progname) ~= "string" then instance.progname, progname = "", "" end - if engine ~= "" then environment['engine'] = engine end - if progname ~= "" then environment['progname'] = progname end - for k,v in next, environment do - local a, b = match(k,"^(%a+)%_(.*)%s*$") - if a and b then - expansions[a..'.'..b] = v - else - expansions[k] = v - end - end - for k,v in next, environment do -- move environment to expansions - if not expansions[k] then expansions[k] = v end - end - for k,v in next, variables do -- move variables to expansions - if not expansions[k] then expansions[k] = v end - end - local busy = false - local function resolve(a) - busy = true - return expansions[a] or env(a) - end - while true do - busy = false - for k,v in next, expansions do - local s, n = gsub(v,"%$([%a%d%_%-]+)",resolve) - local s, m = gsub(s,"%$%{([%a%d%_%-]+)%}",resolve) - if n > 0 or m > 0 then - expansions[k]= s - end - end - if not busy then break end - end - for k,v in next, expansions do - expansions[k] = gsub(v,"\\", '/') - end +function resolvers.datastate() + return caches.contentstate() end function resolvers.variable(name) - return entry(instance.variables,name) + local name = name and lpegmatch(dollarstripper,name) + local result = name and instance.variables[name] + return result ~= nil and result or "" end function resolvers.expansion(name) - return entry(instance.expansions,name) -end - -function resolvers.is_variable(name) - return is_entry(instance.variables,name) -end - -function resolvers.is_expansion(name) - return is_entry(instance.expansions,name) + local name = name and lpegmatch(dollarstripper,name) + local result = name and instance.expansions[name] + return result ~= nil and result or "" end -function resolvers.unexpanded_path_list(str) +function resolvers.unexpandedpathlist(str) local pth = resolvers.variable(str) - local lst = resolvers.split_path(pth) - return expanded_path_from_list(lst) + local lst = resolvers.splitpath(pth) + return expandedpathfromlist(lst) end -function resolvers.unexpanded_path(str) - return file.join_path(resolvers.unexpanded_path_list(str)) +function resolvers.unexpandedpath(str) + return joinpath(resolvers.unexpandedpathlist(str)) end -do -- no longer needed - - local done = { } +local done = { } - function resolvers.reset_extra_path() - local ep = instance.extra_paths - if not ep then - ep, done = { }, { } - instance.extra_paths = ep - elseif #ep > 0 then - instance.lists, done = { }, { } - end +function resolvers.resetextrapath() + local ep = instance.extra_paths + if not ep then + ep, done = { }, { } + instance.extra_paths = ep + elseif #ep > 0 then + instance.lists, done = { }, { } end +end - function resolvers.register_extra_path(paths,subpaths) - local ep = instance.extra_paths or { } - local n = #ep - if paths and paths ~= "" then - if subpaths and subpaths ~= "" then - for p in gmatch(paths,"[^,]+") do - -- we gmatch each step again, not that fast, but used seldom - for s in gmatch(subpaths,"[^,]+") do - local ps = p .. "/" .. s - if not done[ps] then - ep[#ep+1] = resolvers.clean_path(ps) - done[ps] = true - end - end - end - else - for p in gmatch(paths,"[^,]+") do - if not done[p] then - ep[#ep+1] = resolvers.clean_path(p) - done[p] = true - end - end - end - elseif subpaths and subpaths ~= "" then - for i=1,n do +function resolvers.registerextrapath(paths,subpaths) + local ep = instance.extra_paths or { } + local oldn = #ep + local newn = oldn + if paths and paths ~= "" then + if subpaths and subpaths ~= "" then + for p in gmatch(paths,"[^,]+") do -- we gmatch each step again, not that fast, but used seldom for s in gmatch(subpaths,"[^,]+") do - local ps = ep[i] .. "/" .. s + local ps = p .. "/" .. s if not done[ps] then - ep[#ep+1] = resolvers.clean_path(ps) + newn = newn + 1 + ep[newn] = resolvers.cleanpath(ps) done[ps] = true end end end + else + for p in gmatch(paths,"[^,]+") do + if not done[p] then + newn = newn + 1 + ep[newn] = resolvers.cleanpath(p) + done[p] = true + end + end end - if #ep > 0 then - instance.extra_paths = ep -- register paths - end - if #ep > n then - instance.lists = { } -- erase the cache + elseif subpaths and subpaths ~= "" then + for i=1,oldn do + -- we gmatch each step again, not that fast, but used seldom + for s in gmatch(subpaths,"[^,]+") do + local ps = ep[i] .. "/" .. s + if not done[ps] then + newn = newn + 1 + ep[newn] = resolvers.cleanpath(ps) + done[ps] = true + end + end end end - + if newn > 0 then + instance.extra_paths = ep -- register paths + end + if newn > oldn then + instance.lists = { } -- erase the cache + end end local function made_list(instance,list) @@ -9528,14 +11693,15 @@ local function made_list(instance,list) if not ep or #ep == 0 then return list else - local done, new = { }, { } + local done, new, newn = { }, { }, 0 -- honour . .. ../.. but only when at the start for k=1,#list do local v = list[k] if not done[v] then if find(v,"^[%.%/]$") then done[v] = true - new[#new+1] = v + newn = newn + 1 + new[newn] = v else break end @@ -9546,7 +11712,8 @@ local function made_list(instance,list) local v = ep[k] if not done[v] then done[v] = true - new[#new+1] = v + newn = newn + 1 + new[newn] = v end end -- next the formal paths @@ -9554,118 +11721,95 @@ local function made_list(instance,list) local v = list[k] if not done[v] then done[v] = true - new[#new+1] = v + newn = newn + 1 + new[newn] = v end end return new end end -function resolvers.clean_path_list(str) - local t = resolvers.expanded_path_list(str) +function resolvers.cleanpathlist(str) + local t = resolvers.expandedpathlist(str) if t then for i=1,#t do - t[i] = file.collapse_path(resolvers.clean_path(t[i])) + t[i] = collapsepath(resolvers.cleanpath(t[i])) end end return t end -function resolvers.expand_path(str) - return file.join_path(resolvers.expanded_path_list(str)) +function resolvers.expandpath(str) + return joinpath(resolvers.expandedpathlist(str)) end -function resolvers.expanded_path_list(str) +function resolvers.expandedpathlist(str) if not str then - return ep or { } -- ep ? + return { } elseif instance.savelists then - -- engine+progname hash - str = gsub(str,"%$","") + str = lpegmatch(dollarstripper,str) if not instance.lists[str] then -- cached - local lst = made_list(instance,resolvers.split_path(resolvers.expansion(str))) - instance.lists[str] = expanded_path_from_list(lst) + local lst = made_list(instance,resolvers.splitpath(resolvers.expansion(str))) + instance.lists[str] = expandedpathfromlist(lst) end return instance.lists[str] else - local lst = resolvers.split_path(resolvers.expansion(str)) - return made_list(instance,expanded_path_from_list(lst)) - end -end - -function resolvers.expanded_path_list_from_var(str) -- brrr - local tmp = resolvers.var_of_format_or_suffix(gsub(str,"%$","")) - if tmp ~= "" then - return resolvers.expanded_path_list(tmp) - else - return resolvers.expanded_path_list(str) + local lst = resolvers.splitpath(resolvers.expansion(str)) + return made_list(instance,expandedpathfromlist(lst)) end end -function resolvers.expand_path_from_var(str) - return file.join_path(resolvers.expanded_path_list_from_var(str)) +function resolvers.expandedpathlistfromvariable(str) -- brrr + str = lpegmatch(dollarstripper,str) + local tmp = resolvers.variableofformatorsuffix(str) + return resolvers.expandedpathlist(tmp ~= "" and tmp or str) end -function resolvers.format_of_var(str) - return formats[str] or formats[alternatives[str]] or '' -end -function resolvers.format_of_suffix(str) - return suffixmap[file.extname(str)] or 'tex' +function resolvers.expandpathfromvariable(str) + return joinpath(resolvers.expandedpathlistfromvariable(str)) end -function resolvers.variable_of_format(str) - return formats[str] or formats[alternatives[str]] or '' +function resolvers.expandbraces(str) -- output variable and brace expansion of STRING + local ori = resolvers.variable(str) + local pth = expandedpathfromlist(resolvers.splitpath(ori)) + return joinpath(pth) end -function resolvers.var_of_format_or_suffix(str) - local v = formats[str] - if v then - return v - end - v = formats[alternatives[str]] - if v then - return v - end - v = suffixmap[file.extname(str)] - if v then - return formats[isf] +function resolvers.registerfilehash(name,content,someerror) + if content then + instance.files[name] = content + else + instance.files[name] = { } + if somerror == true then -- can be unset + instance.loaderror = someerror + end end - return '' -end - -function resolvers.expand_braces(str) -- output variable and brace expansion of STRING - local ori = resolvers.variable(str) - local pth = expanded_path_from_list(resolvers.split_path(ori)) - return file.join_path(pth) end -resolvers.isreadable = { } - -function resolvers.isreadable.file(name) - local readable = lfs.isfile(name) -- brrr +local function isreadable(name) + local readable = lfs.isfile(name) -- not file.is_readable(name) asit can be a dir if trace_detail then if readable then - logs.report("fileio","file '%s' is readable",name) + report_resolving("file '%s' is readable",name) else - logs.report("fileio","file '%s' is not readable", name) + report_resolving("file '%s' is not readable", name) end end return readable end -resolvers.isreadable.tex = resolvers.isreadable.file - -- name -- name/name local function collect_files(names) - local filelist = { } + local filelist, noffiles = { }, 0 for k=1,#names do local fname = names[k] if trace_detail then - logs.report("fileio","checking name '%s'",fname) + report_resolving("checking name '%s'",fname) end - local bname = file.basename(fname) - local dname = file.dirname(fname) + local bname = filebasename(fname) + local dname = filedirname(fname) if dname == "" or find(dname,"^%.") then dname = false else @@ -9674,11 +11818,11 @@ local function collect_files(names) local hashes = instance.hashes for h=1,#hashes do local hash = hashes[h] - local blobpath = hash.tag + local blobpath = hash.name local files = blobpath and instance.files[blobpath] if files then if trace_detail then - logs.report("fileio","deep checking '%s' (%s)",blobpath,bname) + report_resolving("deep checking '%s' (%s)",blobpath,bname) end local blobfile = files[bname] if not blobfile then @@ -9690,62 +11834,51 @@ local function collect_files(names) end end if blobfile then + local blobroot = files.__path__ or blobpath if type(blobfile) == 'string' then if not dname or find(blobfile,dname) then - filelist[#filelist+1] = { - hash.type, - file.join(blobpath,blobfile,bname), -- search - resolvers.concatinators[hash.type](blobpath,blobfile,bname) -- result - } + local variant = hash.type + -- local search = filejoin(blobpath,blobfile,bname) + local search = filejoin(blobroot,blobfile,bname) + local result = methodhandler('concatinators',hash.type,blobroot,blobfile,bname) + if trace_detail then + report_resolving("match: variant '%s', search '%s', result '%s'",variant,search,result) + end + noffiles = noffiles + 1 + filelist[noffiles] = { variant, search, result } end else for kk=1,#blobfile do local vv = blobfile[kk] if not dname or find(vv,dname) then - filelist[#filelist+1] = { - hash.type, - file.join(blobpath,vv,bname), -- search - resolvers.concatinators[hash.type](blobpath,vv,bname) -- result - } + local variant = hash.type + -- local search = filejoin(blobpath,vv,bname) + local search = filejoin(blobroot,vv,bname) + local result = methodhandler('concatinators',hash.type,blobroot,vv,bname) + if trace_detail then + report_resolving("match: variant '%s', search '%s', result '%s'",variant,search,result) + end + noffiles = noffiles + 1 + filelist[noffiles] = { variant, search, result } end end end end elseif trace_locating then - logs.report("fileio","no match in '%s' (%s)",blobpath,bname) + report_resolving("no match in '%s' (%s)",blobpath,bname) end end end - if #filelist > 0 then - return filelist - else - return nil - end -end - -function resolvers.suffix_of_format(str) - if suffixes[str] then - return suffixes[str][1] - else - return "" - end -end - -function resolvers.suffixes_of_format(str) - if suffixes[str] then - return suffixes[str] - else - return {} - end + return noffiles > 0 and filelist or nil end -function resolvers.register_in_trees(name) +function resolvers.registerintrees(name) if not find(name,"^%.") then instance.foundintrees[name] = (instance.foundintrees[name] or 0) + 1 -- maybe only one end end --- split the next one up for readability (bu this module needs a cleanup anyway) +-- split the next one up for readability (but this module needs a cleanup anyway) local function can_be_dir(name) -- can become local local fakepaths = instance.fakepaths @@ -9756,61 +11889,62 @@ local function can_be_dir(name) -- can become local fakepaths[name] = 2 -- no directory end end - return (fakepaths[name] == 1) + return fakepaths[name] == 1 end -local function collect_instance_files(filename,collected) -- todo : plugin (scanners, checkers etc) - local result = collected or { } +local preparetreepattern = Cs((P(".")/"%%." + P("-")/"%%-" + P(1))^0 * Cc("$")) + +-- this one is split in smaller functions but it needs testing + +local function collect_instance_files(filename,askedformat,allresults) -- todo : plugin (scanners, checkers etc) + local result = { } local stamp = nil - filename = file.collapse_path(filename) + askedformat = askedformat or "" + filename = collapsepath(filename) -- speed up / beware: format problem - if instance.remember then - stamp = filename .. "--" .. instance.engine .. "--" .. instance.progname .. "--" .. instance.format + if instance.remember and not allresults then + stamp = filename .. "--" .. askedformat if instance.found[stamp] then if trace_locating then - logs.report("fileio","remembering file '%s'",filename) + report_resolving("remembered file '%s'",filename) end + resolvers.registerintrees(filename) -- for tracing used files return instance.found[stamp] end end - if not dangerous[instance.format or "?"] then - if resolvers.isreadable.file(filename) then + if not dangerous[askedformat] then + if isreadable(filename) then if trace_detail then - logs.report("fileio","file '%s' found directly",filename) + report_resolving("file '%s' found directly",filename) + end + if stamp then + instance.found[stamp] = { filename } end - instance.found[stamp] = { filename } return { filename } end end if find(filename,'%*') then if trace_locating then - logs.report("fileio","checking wildcard '%s'", filename) + report_resolving("checking wildcard '%s'", filename) end - result = resolvers.find_wildcard_files(filename) + result = resolvers.findwildcardfiles(filename) -- we can use th elocal elseif file.is_qualified_path(filename) then - if resolvers.isreadable.file(filename) then + if isreadable(filename) then if trace_locating then - logs.report("fileio","qualified name '%s'", filename) + report_resolving("qualified name '%s'", filename) end result = { filename } else - local forcedname, ok, suffix = "", false, file.extname(filename) + local forcedname, ok, suffix = "", false, fileextname(filename) if suffix == "" then -- why - if instance.format == "" then - forcedname = filename .. ".tex" - if resolvers.isreadable.file(forcedname) then - if trace_locating then - logs.report("fileio","no suffix, forcing standard filetype 'tex'") - end - result, ok = { forcedname }, true - end - else - local suffixes = resolvers.suffixes_of_format(instance.format) - for _, s in next, suffixes do + local format_suffixes = askedformat == "" and resolvers.defaultsuffixes or suffixes[askedformat] + if format_suffixes then + for i=1,#format_suffixes do + local s = format_suffixes[i] forcedname = filename .. "." .. s - if resolvers.isreadable.file(forcedname) then + if isreadable(forcedname) then if trace_locating then - logs.report("fileio","no suffix, forcing format filetype '%s'", s) + report_resolving("no suffix, forcing format filetype '%s'", s) end result, ok = { forcedname }, true break @@ -9821,23 +11955,24 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan if not ok and suffix ~= "" then -- try to find in tree (no suffix manipulation), here we search for the -- matching last part of the name - local basename = file.basename(filename) - local pattern = gsub(filename .. "$","([%.%-])","%%%1") - local savedformat = instance.format + local basename = filebasename(filename) + local pattern = lpegmatch(preparetreepattern,filename) + -- messy .. to be sorted out + local savedformat = askedformat local format = savedformat or "" if format == "" then - instance.format = resolvers.format_of_suffix(suffix) + askedformat = resolvers.formatofsuffix(suffix) end if not format then - instance.format = "othertextfiles" -- kind of everything, maybe texinput is better + askedformat = "othertextfiles" -- kind of everything, maybe texinput is better end -- if basename ~= filename then - local resolved = collect_instance_files(basename) - if #result == 0 then + local resolved = collect_instance_files(basename,askedformat,allresults) + if #result == 0 then -- shouldn't this be resolved ? local lowered = lower(basename) if filename ~= lowered then - resolved = collect_instance_files(lowered) + resolved = collect_instance_files(lowered,askedformat,allresults) end end resolvers.format = savedformat @@ -9862,57 +11997,60 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan -- end end if not ok and trace_locating then - logs.report("fileio","qualified name '%s'", filename) + report_resolving("qualified name '%s'", filename) end end else -- search spec - local filetype, extra, done, wantedfiles, ext = '', nil, false, { }, file.extname(filename) - if ext == "" then - if not instance.force_suffixes then - wantedfiles[#wantedfiles+1] = filename - end - else - wantedfiles[#wantedfiles+1] = filename - end - if instance.format == "" then - if ext == "" then - local forcedname = filename .. '.tex' - wantedfiles[#wantedfiles+1] = forcedname - filetype = resolvers.format_of_suffix(forcedname) - if trace_locating then - logs.report("fileio","forcing filetype '%s'",filetype) + local filetype, done, wantedfiles, ext = '', false, { }, fileextname(filename) + -- -- tricky as filename can be bla.1.2.3 + -- if not suffixmap[ext] then --- probably needs to be done elsewhere too + -- wantedfiles[#wantedfiles+1] = filename + -- end + wantedfiles[#wantedfiles+1] = filename + if askedformat == "" then + if ext == "" or not suffixmap[ext] then + local defaultsuffixes = resolvers.defaultsuffixes + for i=1,#defaultsuffixes do + local forcedname = filename .. '.' .. defaultsuffixes[i] + wantedfiles[#wantedfiles+1] = forcedname + filetype = resolvers.formatofsuffix(forcedname) + if trace_locating then + report_resolving("forcing filetype '%s'",filetype) + end end else - filetype = resolvers.format_of_suffix(filename) + filetype = resolvers.formatofsuffix(filename) if trace_locating then - logs.report("fileio","using suffix based filetype '%s'",filetype) + report_resolving("using suffix based filetype '%s'",filetype) end end else - if ext == "" then - local suffixes = resolvers.suffixes_of_format(instance.format) - for _, s in next, suffixes do - wantedfiles[#wantedfiles+1] = filename .. "." .. s + if ext == "" or not suffixmap[ext] then + local format_suffixes = suffixes[askedformat] + if format_suffixes then + for i=1,#format_suffixes do + wantedfiles[#wantedfiles+1] = filename .. "." .. format_suffixes[i] + end end end - filetype = instance.format + filetype = askedformat if trace_locating then - logs.report("fileio","using given filetype '%s'",filetype) + report_resolving("using given filetype '%s'",filetype) end end - local typespec = resolvers.variable_of_format(filetype) - local pathlist = resolvers.expanded_path_list(typespec) + local typespec = resolvers.variableofformat(filetype) + local pathlist = resolvers.expandedpathlist(typespec) if not pathlist or #pathlist == 0 then -- no pathlist, access check only / todo == wildcard if trace_detail then - logs.report("fileio","checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | ")) + report_resolving("checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | ")) end for k=1,#wantedfiles do local fname = wantedfiles[k] - if fname and resolvers.isreadable.file(fname) then + if fname and isreadable(fname) then filename, done = fname, true - result[#result+1] = file.join('.',fname) + result[#result+1] = filejoin('.',fname) break end end @@ -9920,8 +12058,8 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan local filelist = collect_files(wantedfiles) local fl = filelist and filelist[1] if fl then - filename = fl[3] - result[#result+1] = filename + filename = fl[3] -- not local? + result[#result+1] = resolvers.resolve(filename) done = true end else @@ -9930,76 +12068,65 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan local dirlist = { } if filelist then for i=1,#filelist do - dirlist[i] = file.dirname(filelist[i][2]) .. "/" + dirlist[i] = filedirname(filelist[i][3]) .. "/" -- was [2] .. gamble end end if trace_detail then - logs.report("fileio","checking filename '%s'",filename) + report_resolving("checking filename '%s'",filename) end - -- a bit messy ... esp the doscan setting here - local doscan for k=1,#pathlist do local path = pathlist[k] - if find(path,"^!!") then doscan = false else doscan = true end - local pathname = gsub(path,"^!+", '') + local pathname = lpegmatch(inhibitstripper,path) + local doscan = path == pathname -- no ^!! done = false -- using file list if filelist then - local expression -- compare list entries with permitted pattern -- /xx /xx// - if not find(pathname,"/$") then - expression = pathname .. "/" - else - expression = pathname - end - expression = gsub(expression,"([%-%.])","%%%1") -- this also influences - expression = gsub(expression,"//+$", '/.*') -- later usage of pathname - expression = gsub(expression,"//", '/.-/') -- not ok for /// but harmless - expression = "^" .. expression .. "$" + local expression = makepathexpression(pathname) if trace_detail then - logs.report("fileio","using pattern '%s' for path '%s'",expression,pathname) + report_resolving("using pattern '%s' for path '%s'",expression,pathname) end for k=1,#filelist do local fl = filelist[k] local f = fl[2] local d = dirlist[k] if find(d,expression) then - --- todo, test for readable - result[#result+1] = fl[3] - resolvers.register_in_trees(f) -- for tracing used files + -- todo, test for readable + result[#result+1] = resolvers.resolve(fl[3]) -- no shortcut done = true - if instance.allresults then + if allresults then if trace_detail then - logs.report("fileio","match in hash for file '%s' on path '%s', continue scanning",f,d) + report_resolving("match to '%s' in hash for file '%s' and path '%s', continue scanning",expression,f,d) end else if trace_detail then - logs.report("fileio","match in hash for file '%s' on path '%s', quit scanning",f,d) + report_resolving("match to '%s' in hash for file '%s' and path '%s', quit scanning",expression,f,d) end break end elseif trace_detail then - logs.report("fileio","no match in hash for file '%s' on path '%s'",f,d) + report_resolving("no match to '%s' in hash for file '%s' and path '%s'",expression,f,d) end end end if not done and doscan then -- check if on disk / unchecked / does not work at all / also zips - if resolvers.splitmethod(pathname).scheme == 'file' then -- ? + local scheme = url.hasscheme(pathname) + if not scheme or scheme == "file" then local pname = gsub(pathname,"%.%*$",'') if not find(pname,"%*") then local ppname = gsub(pname,"/+$","") if can_be_dir(ppname) then for k=1,#wantedfiles do local w = wantedfiles[k] - local fname = file.join(ppname,w) - if resolvers.isreadable.file(fname) then + local fname = filejoin(ppname,w) + if isreadable(fname) then if trace_detail then - logs.report("fileio","found '%s' by scanning",fname) + report_resolving("found '%s' by scanning",fname) end result[#result+1] = fname done = true - if not instance.allresults then break end + if not allresults then break end end end else @@ -10009,56 +12136,66 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan end end if not done and doscan then - -- todo: slow path scanning + -- todo: slow path scanning ... although we now have tree:// supported in $TEXMF end - if done and not instance.allresults then break end + if done and not allresults then break end end end end for k=1,#result do - result[k] = file.collapse_path(result[k]) + local rk = collapsepath(result[k]) + result[k] = rk + resolvers.registerintrees(rk) -- for tracing used files end - if instance.remember then + if stamp then instance.found[stamp] = result end return result end -if not resolvers.concatinators then resolvers.concatinators = { } end +-- -- -- begin of main file search routing -- -- -- -resolvers.concatinators.tex = file.join -resolvers.concatinators.file = resolvers.concatinators.tex -function resolvers.find_files(filename,filetype,mustexist) - if type(mustexist) == boolean then - -- all set - elseif type(filetype) == 'boolean' then - filetype, mustexist = nil, false - elseif type(filetype) ~= 'string' then - filetype, mustexist = nil, false - end - instance.format = filetype or '' - local result = collect_instance_files(filename) + + + + + + + + +-- -- -- end of main file search routing -- -- -- + +local function findfiles(filename,filetype,allresults) + local result = collect_instance_files(filename,filetype or "",allresults) if #result == 0 then local lowered = lower(filename) if filename ~= lowered then - return collect_instance_files(lowered) + return collect_instance_files(lowered,filetype or "",allresults) end end - instance.format = '' return result end -function resolvers.find_file(filename,filetype,mustexist) - return (resolvers.find_files(filename,filetype,mustexist)[1] or "") +function resolvers.findfiles(filename,filetype) + return findfiles(filename,filetype,true) +end + +function resolvers.findfile(filename,filetype) + return findfiles(filename,filetype,false)[1] or "" +end + +function resolvers.findpath(filename,filetype) + return filedirname(findfiles(filename,filetype,false)[1] or "") end -function resolvers.find_given_files(filename) - local bname, result = file.basename(filename), { } +local function findgivenfiles(filename,allresults) + local bname, result = filebasename(filename), { } local hashes = instance.hashes + local noffound = 0 for k=1,#hashes do local hash = hashes[k] - local files = instance.files[hash.tag] or { } + local files = instance.files[hash.name] or { } local blist = files[bname] if not blist then local rname = "remap:"..bname @@ -10070,13 +12207,21 @@ function resolvers.find_given_files(filename) end if blist then if type(blist) == 'string' then - result[#result+1] = resolvers.concatinators[hash.type](hash.tag,blist,bname) or "" - if not instance.allresults then break end + local found = methodhandler('concatinators',hash.type,hash.name,blist,bname) or "" + if found ~= "" then + noffound = noffound + 1 + result[noffound] = resolvers.resolve(found) + if not allresults then break end + end else for kk=1,#blist do local vv = blist[kk] - result[#result+1] = resolvers.concatinators[hash.type](hash.tag,vv,bname) or "" - if not instance.allresults then break end + local found = methodhandler('concatinators',hash.type,hash.name,vv,bname) or "" + if found ~= "" then + noffound = noffound + 1 + result[noffound] = resolvers.resolve(found) + if not allresults then break end + end end end end @@ -10084,24 +12229,31 @@ function resolvers.find_given_files(filename) return result end -function resolvers.find_given_file(filename) - return (resolvers.find_given_files(filename)[1] or "") +function resolvers.findgivenfiles(filename) + return findgivenfiles(filename,true) end -local function doit(path,blist,bname,tag,kind,result,allresults) +function resolvers.findgivenfile(filename) + return findgivenfiles(filename,false)[1] or "" +end + +local function doit(path,blist,bname,tag,variant,result,allresults) local done = false - if blist and kind then + if blist and variant then + local resolve = resolvers.resolve -- added if type(blist) == 'string' then -- make function and share code if find(lower(blist),path) then - result[#result+1] = resolvers.concatinators[kind](tag,blist,bname) or "" + local full = methodhandler('concatinators',variant,tag,blist,bname) or "" + result[#result+1] = resolve(full) done = true end else for kk=1,#blist do local vv = blist[kk] if find(lower(vv),path) then - result[#result+1] = resolvers.concatinators[kind](tag,vv,bname) or "" + local full = methodhandler('concatinators',variant,tag,vv,bname) or "" + result[#result+1] = resolve(full) done = true if not allresults then break end end @@ -10111,30 +12263,32 @@ local function doit(path,blist,bname,tag,kind,result,allresults) return done end -function resolvers.find_wildcard_files(filename) -- todo: remap: - local result = { } - local bname, dname = file.basename(filename), file.dirname(filename) - local path = gsub(dname,"^*/","") - path = gsub(path,"*",".*") - path = gsub(path,"-","%%-") - if dname == "" then - path = ".*" - end - local name = bname - name = gsub(name,"*",".*") - name = gsub(name,"-","%%-") - path = lower(path) - name = lower(name) - local files, allresults, done = instance.files, instance.allresults, false + +local makewildcard = Cs( + (P("^")^0 * P("/") * P(-1) + P(-1)) /".*" + + (P("^")^0 * P("/") / "")^0 * (P("*")/".*" + P("-")/"%%-" + P(".")/"%%." + P("?")/"."+ P("\\")/"/" + P(1))^0 +) + +function resolvers.wildcardpattern(pattern) + return lpegmatch(makewildcard,pattern) or pattern +end + +local function findwildcardfiles(filename,allresults,result) -- todo: remap: and lpeg + result = result or { } + local base = filebasename(filename) + local dirn = filedirname(filename) + local path = lower(lpegmatch(makewildcard,dirn) or dirn) + local name = lower(lpegmatch(makewildcard,base) or base) + local files, done = instance.files, false if find(name,"%*") then local hashes = instance.hashes for k=1,#hashes do local hash = hashes[k] - local tag, kind = hash.tag, hash.type - for kk, hh in next, files[hash.tag] do + local hashname, hashtype = hash.name, hash.type + for kk, hh in next, files[hashname] do if not find(kk,"^remap:") then if find(lower(kk),name) then - if doit(path,hh,kk,tag,kind,result,allresults) then done = true end + if doit(path,hh,kk,hashname,hashtype,result,allresults) then done = true end if done and not allresults then break end end end @@ -10144,8 +12298,8 @@ function resolvers.find_wildcard_files(filename) -- todo: remap: local hashes = instance.hashes for k=1,#hashes do local hash = hashes[k] - local tag, kind = hash.tag, hash.type - if doit(path,files[tag][bname],bname,tag,kind,result,allresults) then done = true end + local hashname, hashtype = hash.name, hash.type + if doit(path,files[hashname][bname],bname,hashname,hashtype,result,allresults) then done = true end if done and not allresults then break end end end @@ -10154,8 +12308,12 @@ function resolvers.find_wildcard_files(filename) -- todo: remap: return result end -function resolvers.find_wildcard_file(filename) - return (resolvers.find_wildcard_files(filename)[1] or "") +function resolvers.findwildcardfiles(filename,result) + return findwildcardfiles(filename,true,result) +end + +function resolvers.findwildcardfile(filename) + return findwildcardfiles(filename,false)[1] or "" end -- main user functions @@ -10166,34 +12324,33 @@ end function resolvers.load(option) statistics.starttiming(instance) - resolvers.resetconfig() - resolvers.identify_cnf() - resolvers.load_lua() -- will become the new method - resolvers.expand_variables() - resolvers.load_cnf() -- will be skipped when we have a lua file - resolvers.expand_variables() + identify_configuration_files() + load_configuration_files() if option ~= "nofiles" then - resolvers.load_hash() + load_databases() resolvers.automount() end statistics.stoptiming(instance) + local files = instance.files + return files and next(files) and true +end + +local function report(str) + if trace_locating then + report_resolving(str) -- has already verbose + else + print(str) + end end -function resolvers.for_files(command, files, filetype, mustexist) +function resolvers.dowithfilesandreport(command, files, ...) -- will move if files and #files > 0 then - local function report(str) - if trace_locating then - logs.report("fileio",str) -- has already verbose - else - print(str) - end - end if trace_locating then report('') -- ? end for f=1,#files do local file = files[f] - local result = command(file,filetype,mustexist) + local result = command(file,...) if type(result) == 'string' then report(result) else @@ -10205,21 +12362,16 @@ function resolvers.for_files(command, files, filetype, mustexist) end end --- strtab +-- obsolete -resolvers.var_value = resolvers.variable -- output the value of variable $STRING. -resolvers.expand_var = resolvers.expansion -- output variable expansion of STRING. +-- resolvers.varvalue = resolvers.variable -- output the value of variable $STRING. +-- resolvers.expandvar = resolvers.expansion -- output variable expansion of STRING. -function resolvers.show_path(str) -- output search path for file type NAME - return file.join_path(resolvers.expanded_path_list(resolvers.format_of_var(str))) +function resolvers.showpath(str) -- output search path for file type NAME + return joinpath(resolvers.expandedpathlist(resolvers.formatofvariable(str))) end --- resolvers.find_file(filename) --- resolvers.find_file(filename, filetype, mustexist) --- resolvers.find_file(filename, mustexist) --- resolvers.find_file(filename, filetype) - -function resolvers.register_file(files, name, path) +function resolvers.registerfile(files, name, path) if files[name] then if type(files[name]) == 'string' then files[name] = { files[name], path } @@ -10231,101 +12383,24 @@ function resolvers.register_file(files, name, path) end end -function resolvers.splitmethod(filename) - if not filename then - return { } -- safeguard - elseif type(filename) == "table" then - return filename -- already split - elseif not find(filename,"://") then - return { scheme="file", path = filename, original=filename } -- quick hack - else - return url.hashed(filename) - end -end - -function table.sequenced(t,sep) -- temp here - local s = { } - for k, v in next, t do -- indexed? - s[#s+1] = k .. "=" .. tostring(v) - end - return concat(s, sep or " | ") -end - -function resolvers.methodhandler(what, filename, filetype) -- ... - filename = file.collapse_path(filename) - local specification = (type(filename) == "string" and resolvers.splitmethod(filename)) or filename -- no or { }, let it bomb - local scheme = specification.scheme - if resolvers[what][scheme] then - if trace_locating then - logs.report("fileio","handler '%s' -> '%s' -> '%s'",specification.original,what,table.sequenced(specification)) - end - return resolvers[what][scheme](filename,filetype) -- todo: specification - else - return resolvers[what].tex(filename,filetype) -- todo: specification - end -end - -function resolvers.clean_path(str) - if str then - str = gsub(str,"\\","/") - str = gsub(str,"^!+","") - str = gsub(str,"^~",resolvers.homedir) - return str - else - return nil - end -end - -function resolvers.do_with_path(name,func) - local pathlist = resolvers.expanded_path_list(name) +function resolvers.dowithpath(name,func) + local pathlist = resolvers.expandedpathlist(name) for i=1,#pathlist do - func("^"..resolvers.clean_path(pathlist[i])) + func("^"..resolvers.cleanpath(pathlist[i])) end end -function resolvers.do_with_var(name,func) - func(expanded_var(name)) -end - -function resolvers.with_files(pattern,handle) - local hashes = instance.hashes - for i=1,#hashes do - local hash = hashes[i] - local blobpath = hash.tag - local blobtype = hash.type - if blobpath then - local files = instance.files[blobpath] - if files then - for k,v in next, files do - if find(k,"^remap:") then - k = files[k] - v = files[k] -- chained - end - if find(k,pattern) then - if type(v) == "string" then - handle(blobtype,blobpath,v,k) - else - for _,vv in next, v do -- indexed - handle(blobtype,blobpath,vv,k) - end - end - end - end - end - end - end +function resolvers.dowithvariable(name,func) + func(expandedvariable(name)) end -function resolvers.locate_format(name) - local barename, fmtname = gsub(name,"%.%a+$",""), "" - if resolvers.usecache then - local path = file.join(caches.setpath("formats")) -- maybe platform - fmtname = file.join(path,barename..".fmt") or "" - end +function resolvers.locateformat(name) + local barename = file.removesuffix(name) -- gsub(name,"%.%a+$","") + local fmtname = caches.getfirstreadablefile(barename..".fmt","formats") or "" if fmtname == "" then - fmtname = resolvers.find_files(barename..".fmt")[1] or "" + fmtname = resolvers.findfile(barename..".fmt") + fmtname = resolvers.cleanpath(fmtname) end - fmtname = resolvers.clean_path(fmtname) if fmtname ~= "" then local barename = file.removesuffix(fmtname) local luaname, lucname, luiname = barename .. ".lua", barename .. ".luc", barename .. ".lui" @@ -10340,7 +12415,7 @@ function resolvers.locate_format(name) return nil, nil end -function resolvers.boolean_variable(str,default) +function resolvers.booleanvariable(str,default) local b = resolvers.expansion(str) if b == "" then return default @@ -10350,204 +12425,62 @@ function resolvers.boolean_variable(str,default) end end -texconfig.kpse_init = false - -kpse = { original = kpse } setmetatable(kpse, { __index = function(k,v) return resolvers[v] end } ) - --- for a while - -input = resolvers - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['data-tmp'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - ---[[ldx-- -

This module deals with caching data. It sets up the paths and -implements loaders and savers for tables. Best is to set the -following variable. When not set, the usual paths will be -checked. Personally I prefer the (users) temporary path.

- - -TEXMFCACHE=$TMP;$TEMP;$TMPDIR;$TEMPDIR;$HOME;$TEXMFVAR;$VARTEXMF;. - - -

Currently we do no locking when we write files. This is no real -problem because most caching involves fonts and the chance of them -being written at the same time is small. We also need to extend -luatools with a recache feature.

---ldx]]-- - -local format, lower, gsub = string.format, string.lower, string.gsub - -local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) -- not used yet - -caches = caches or { } - -caches.path = caches.path or nil -caches.base = caches.base or "luatex-cache" -caches.more = caches.more or "context" -caches.direct = false -- true is faster but may need huge amounts of memory -caches.tree = false -caches.paths = caches.paths or nil -caches.force = true -- changed for TEXLIVE by TH -caches.defaults = { "TEXMFCACHE", "TMPDIR", "TEMPDIR", "TMP", "TEMP", "HOME", "HOMEPATH" } - -function caches.temp() - local cachepath = nil - local function check(list,isenv) - if not cachepath then - for k=1,#list do - local v = list[k] - cachepath = (isenv and (os.env[v] or "")) or v or "" - if cachepath == "" then - -- next - else - cachepath = resolvers.clean_path(cachepath) - if lfs.isdir(cachepath) and file.iswritable(cachepath) then -- lfs.attributes(cachepath,"mode") == "directory" - break - elseif caches.force or io.ask(format("\nShould I create the cache path %s?",cachepath), "no", { "yes", "no" }) == "yes" then - dir.mkdirs(cachepath) - if lfs.isdir(cachepath) and file.iswritable(cachepath) then - break +function resolvers.dowithfilesintree(pattern,handle,before,after) -- will move, can be a nice iterator instead + local instance = resolvers.instance + local hashes = instance.hashes + for i=1,#hashes do + local hash = hashes[i] + local blobtype = hash.type + local blobpath = hash.name + if blobpath then + if before then + before(blobtype,blobpath,pattern) + end + local files = instance.files[blobpath] + local total, checked, done = 0, 0, 0 + if files then + for k,v in next, files do + total = total + 1 + if find(k,"^remap:") then + k = files[k] + v = k -- files[k] -- chained + end + if find(k,pattern) then + if type(v) == "string" then + checked = checked + 1 + if handle(blobtype,blobpath,v,k) then + done = done + 1 + end + else + checked = checked + #v + for i=1,#v do + if handle(blobtype,blobpath,v[i],k) then + done = done + 1 + end + end end end end - cachepath = nil + end + if after then + after(blobtype,blobpath,pattern,total,checked,done) end end end - check(resolvers.clean_path_list("TEXMFCACHE") or { }) - check(caches.defaults,true) - if not cachepath then - print("\nfatal error: there is no valid (writable) cache path defined\n") - os.exit() - elseif not lfs.isdir(cachepath) then -- lfs.attributes(cachepath,"mode") ~= "directory" - print(format("\nfatal error: cache path %s is not a directory\n",cachepath)) - os.exit() - end - cachepath = file.collapse_path(cachepath) - function caches.temp() - return cachepath - end - return cachepath -end - -function caches.configpath() - return table.concat(resolvers.instance.cnffiles,";") -end - -function caches.hashed(tree) - return md5.hex(gsub(lower(tree),"[\\\/]+","/")) -end - -function caches.treehash() - local tree = caches.configpath() - if not tree or tree == "" then - return false - else - return caches.hashed(tree) - end -end - -function caches.setpath(...) - if not caches.path then - if not caches.path then - caches.path = caches.temp() - end - caches.path = resolvers.clean_path(caches.path) -- to be sure - caches.tree = caches.tree or caches.treehash() - if caches.tree then - caches.path = dir.mkdirs(caches.path,caches.base,caches.more,caches.tree) - else - caches.path = dir.mkdirs(caches.path,caches.base,caches.more) - end - end - if not caches.path then - caches.path = '.' - end - caches.path = resolvers.clean_path(caches.path) - local dirs = { ... } - if #dirs > 0 then - local pth = dir.mkdirs(caches.path,...) - return pth - end - caches.path = dir.expand_name(caches.path) - return caches.path -end - -function caches.definepath(category,subcategory) - return function() - return caches.setpath(category,subcategory) - end -end - -function caches.setluanames(path,name) - return path .. "/" .. name .. ".tma", path .. "/" .. name .. ".tmc" -end - -function caches.loaddata(path,name) - local tmaname, tmcname = caches.setluanames(path,name) - local loader = loadfile(tmcname) or loadfile(tmaname) - if loader then - loader = loader() - collectgarbage("step") - return loader - else - return false - end -end - ---~ function caches.loaddata(path,name) ---~ local tmaname, tmcname = caches.setluanames(path,name) ---~ return dofile(tmcname) or dofile(tmaname) ---~ end - -function caches.iswritable(filepath,filename) - local tmaname, tmcname = caches.setluanames(filepath,filename) - return file.iswritable(tmaname) -end - -function caches.savedata(filepath,filename,data,raw) - local tmaname, tmcname = caches.setluanames(filepath,filename) - local reduce, simplify = true, true - if raw then - reduce, simplify = false, false - end - data.cache_uuid = os.uuid() - if caches.direct then - file.savedata(tmaname, table.serialize(data,'return',false,true,false)) -- no hex - else - table.tofile(tmaname, data,'return',false,true,false) -- maybe not the last true - end - local cleanup = resolvers.boolean_variable("PURGECACHE", false) - local strip = resolvers.boolean_variable("LUACSTRIP", true) - utils.lua.compile(tmaname, tmcname, cleanup, strip) end --- here we use the cache for format loading (texconfig.[formatname|jobname]) +resolvers.obsolete = resolvers.obsolete or { } +local obsolete = resolvers.obsolete ---~ if tex and texconfig and texconfig.formatname and texconfig.formatname == "" then -if tex and texconfig and (not texconfig.formatname or texconfig.formatname == "") and input and resolvers.instance then - if not texconfig.luaname then texconfig.luaname = "cont-en.lua" end -- or luc - texconfig.formatname = caches.setpath("formats") .. "/" .. gsub(texconfig.luaname,"%.lu.$",".fmt") -end +resolvers.find_file = resolvers.findfile obsolete.find_file = resolvers.findfile +resolvers.find_files = resolvers.findfiles obsolete.find_files = resolvers.findfiles end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['data-res'] = { +if not modules then modules = { } end modules ['data-pre'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -10555,17 +12488,28 @@ if not modules then modules = { } end modules ['data-res'] = { license = "see context related readme files" } ---~ print(resolvers.resolve("abc env:tmp file:cont-en.tex path:cont-en.tex full:cont-en.tex rel:zapf/one/p-chars.tex")) +-- It could be interesting to hook the resolver in the file +-- opener so that unresolved prefixes travel around and we +-- get more abstraction. -local upper, lower, gsub = string.upper, string.lower, string.gsub +-- As we use this beforehand we will move this up in the chain +-- of loading. -local prefixes = { } + +local resolvers = resolvers +local prefixes = utilities.storage.allocate() +resolvers.prefixes = prefixes + +local gsub = string.gsub +local cleanpath, findgivenfile, expansion = resolvers.cleanpath, resolvers.findgivenfile, resolvers.expansion +local getenv = resolvers.getenv -- we can probably also use resolvers.expansion +local P, Cs, lpegmatch = lpeg.P, lpeg.Cs, lpeg.match prefixes.environment = function(str) - return resolvers.clean_path(os.getenv(str) or os.getenv(upper(str)) or os.getenv(lower(str)) or "") + return cleanpath(expansion(str)) end -prefixes.relative = function(str,n) +prefixes.relative = function(str,n) -- lfs.isfile if io.exists(str) then -- nothing elseif io.exists("./" .. str) then @@ -10581,7 +12525,7 @@ prefixes.relative = function(str,n) end end end - return resolvers.clean_path(str) + return cleanpath(str) end prefixes.auto = function(str) @@ -10593,18 +12537,34 @@ prefixes.auto = function(str) end prefixes.locate = function(str) - local fullname = resolvers.find_given_file(str) or "" - return resolvers.clean_path((fullname ~= "" and fullname) or str) + local fullname = findgivenfile(str) or "" + return cleanpath((fullname ~= "" and fullname) or str) end prefixes.filename = function(str) - local fullname = resolvers.find_given_file(str) or "" - return resolvers.clean_path(file.basename((fullname ~= "" and fullname) or str)) + local fullname = findgivenfile(str) or "" + return cleanpath(file.basename((fullname ~= "" and fullname) or str)) end prefixes.pathname = function(str) - local fullname = resolvers.find_given_file(str) or "" - return resolvers.clean_path(file.dirname((fullname ~= "" and fullname) or str)) + local fullname = findgivenfile(str) or "" + return cleanpath(file.dirname((fullname ~= "" and fullname) or str)) +end + +prefixes.selfautoloc = function(str) + return cleanpath(file.join(getenv('SELFAUTOLOC'),str)) +end + +prefixes.selfautoparent = function(str) + return cleanpath(file.join(getenv('SELFAUTOPARENT'),str)) +end + +prefixes.selfautodir = function(str) + return cleanpath(file.join(getenv('SELFAUTODIR'),str)) +end + +prefixes.home = function(str) + return cleanpath(file.join(getenv('HOME'),str)) end prefixes.env = prefixes.environment @@ -10633,26 +12593,71 @@ local function _resolve_(method,target) end end -local function resolve(str) - if type(str) == "table" then - for k=1,#str do - local v = str[k] - str[k] = resolve(v) or v +local resolved, abstract = { }, { } + +function resolvers.resetresolve(str) + resolved, abstract = { }, { } +end + +local function resolve(str) -- use schemes, this one is then for the commandline only + local res = resolved[str] + if not res then + res = gsub(str,"([a-z][a-z]+):([^ \"\']*)",_resolve_) + resolved[str] = res + abstract[res] = str + end + return res +end + +local function unresolve(str) + return abstract[str] or str +end + +resolvers.resolve = resolve +resolvers.unresolve = unresolve + +if os.uname then + + for k, v in next, os.uname() do + if not prefixes[k] then + prefixes[k] = function() return v end + end + end + +end + +if os.type == "unix" then + + local pattern + + local function makepattern(t,k,v) + local colon = P(":") + local p + for k, v in table.sortedpairs(prefixes) do + if p then + p = P(k) + p + else + p = P(k) + end + end + pattern = Cs((p * colon + colon/";" + P(1))^0) + if t then + t[k] = v end - elseif str and str ~= "" then - str = gsub(str,"([a-z]+):([^ \"\']*)",_resolve_) end - return str -end -resolvers.resolve = resolve + makepattern() -if os.uname then + getmetatable(prefixes).__newindex = makepattern - for k, v in next, os.uname() do - if not prefixes[k] then - prefixes[k] = function() return v end - end + function resolvers.repath(str) + return lpegmatch(pattern,str) + end + +else -- already the default: + + function resolvers.repath(str) + return str end end @@ -10670,13 +12675,23 @@ if not modules then modules = { } end modules ['data-inp'] = { license = "see context related readme files" } -resolvers.finders = resolvers.finders or { } -resolvers.openers = resolvers.openers or { } -resolvers.loaders = resolvers.loaders or { } +local allocate = utilities.storage.allocate +local resolvers = resolvers + +local methodhandler = resolvers.methodhandler +local registermethod = resolvers.registermethod -resolvers.finders.notfound = { nil } -resolvers.openers.notfound = { nil } -resolvers.loaders.notfound = { false, nil, 0 } +local finders = allocate { helpers = { }, notfound = function() end } +local openers = allocate { helpers = { }, notfound = function() end } +local loaders = allocate { helpers = { }, notfound = function() return false, nil, 0 end } + +registermethod("finders", finders, "uri") +registermethod("openers", openers, "uri") +registermethod("loaders", loaders, "uri") + +resolvers.finders = finders +resolvers.openers = openers +resolvers.loaders = loaders end -- of closure @@ -10691,15 +12706,23 @@ if not modules then modules = { } end modules ['data-out'] = { license = "see context related readme files" } -outputs = outputs or { } +local allocate = utilities.storage.allocate +local resolvers = resolvers + +local registermethod = resolvers.registermethod +local savers = allocate { helpers = { } } + +resolvers.savers = savers + +registermethod("savers", savers, "uri") end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['data-con'] = { +if not modules then modules = { } end modules ['data-fil'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -10707,6 +12730,124 @@ if not modules then modules = { } end modules ['data-con'] = { license = "see context related readme files" } +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) + +local report_files = logs.reporter("resolvers","files") + +local resolvers = resolvers + +local finders, openers, loaders, savers = resolvers.finders, resolvers.openers, resolvers.loaders, resolvers.savers +local locators, hashers, generators, concatinators = resolvers.locators, resolvers.hashers, resolvers.generators, resolvers.concatinators + +local checkgarbage = utilities.garbagecollector and utilities.garbagecollector.check + +function locators.file(specification) + local name = specification.filename + local realname = resolvers.resolve(name) -- no shortcut + if realname and realname ~= '' and lfs.isdir(realname) then + if trace_locating then + report_files("file locator '%s' found as '%s'",name,realname) + end + resolvers.appendhash('file',name,true) -- cache + elseif trace_locating then + report_files("file locator '%s' not found",name) + end +end + +function hashers.file(specification) + local name = specification.filename + local content = caches.loadcontent(name,'files') + resolvers.registerfilehash(name,content,content==nil) +end + +function generators.file(specification) + local path = specification.filename + local content = resolvers.scanfiles(path) + resolvers.registerfilehash(path,content,true) +end + +concatinators.file = file.join + +function finders.file(specification,filetype) + local filename = specification.filename + local foundname = resolvers.findfile(filename,filetype) + if foundname and foundname ~= "" then + if trace_locating then + report_files("file finder: '%s' found",filename) + end + return foundname + else + if trace_locating then + report_files("file finder: %s' not found",filename) + end + return finders.notfound() + end +end + +-- The default textopener will be overloaded later on. + +function openers.helpers.textopener(tag,filename,f) + return { + reader = function() return f:read () end, + close = function() logs.show_close(filename) return f:close() end, + } +end + +function openers.file(specification,filetype) + local filename = specification.filename + if filename and filename ~= "" then + local f = io.open(filename,"r") + if f then + if trace_locating then + report_files("file opener, '%s' opened",filename) + end + return openers.helpers.textopener("file",filename,f) + end + end + if trace_locating then + report_files("file opener, '%s' not found",filename) + end + return openers.notfound() +end + +function loaders.file(specification,filetype) + local filename = specification.filename + if filename and filename ~= "" then + local f = io.open(filename,"rb") + if f then + logs.show_load(filename) + if trace_locating then + report_files("file loader, '%s' loaded",filename) + end + local s = f:read("*a") + if checkgarbage then + checkgarbage(#s) + end + f:close() + if s then + return true, s, #s + end + end + end + if trace_locating then + report_files("file loader, '%s' not found",filename) + end + return loaders.notfound() +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-con'] = { + version = 1.100, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + local format, lower, gsub = string.format, string.lower, string.gsub local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) @@ -10726,50 +12867,63 @@ table structures without bothering about the disk cache.

Examples of usage can be found in the font related code.

--ldx]]-- -containers = containers or { } - +containers = containers or { } +local containers = containers containers.usecache = true +local report_containers = logs.reporter("resolvers","containers") + local function report(container,tag,name) if trace_cache or trace_containers then - logs.report(format("%s cache",container.subcategory),"%s: %s",tag,name or 'invalid') + report_containers("container: %s, tag: %s, name: %s",container.subcategory,tag,name or 'invalid') end end local allocated = { } --- tracing +local mt = { + __index = function(t,k) + if k == "writable" then + local writable = caches.getwritablepath(t.category,t.subcategory) or { "." } + t.writable = writable + return writable + elseif k == "readables" then + local readables = caches.getreadablepaths(t.category,t.subcategory) or { "." } + t.readables = readables + return readables + end + end, + __storage__ = true +} function containers.define(category, subcategory, version, enabled) - return function() - if category and subcategory then - local c = allocated[category] - if not c then - c = { } - allocated[category] = c - end - local s = c[subcategory] - if not s then - s = { - category = category, - subcategory = subcategory, - storage = { }, - enabled = enabled, - version = version or 1.000, - trace = false, - path = caches and caches.setpath and caches.setpath(category,subcategory), - } - c[subcategory] = s - end - return s - else - return nil + if category and subcategory then + local c = allocated[category] + if not c then + c = { } + allocated[category] = c + end + local s = c[subcategory] + if not s then + s = { + category = category, + subcategory = subcategory, + storage = { }, + enabled = enabled, + version = version or math.pi, -- after all, this is TeX + trace = false, + -- writable = caches.getwritablepath and caches.getwritablepath (category,subcategory) or { "." }, + -- readables = caches.getreadablepaths and caches.getreadablepaths(category,subcategory) or { "." }, + } + setmetatable(s,mt) + c[subcategory] = s end + return s end end function containers.is_usable(container, name) - return container.enabled and caches and caches.iswritable(container.path, name) + return container.enabled and caches and caches.is_writable(container.writable, name) end function containers.is_valid(container, name) @@ -10782,18 +12936,20 @@ function containers.is_valid(container, name) end function containers.read(container,name) - if container.enabled and caches and not container.storage[name] and containers.usecache then - container.storage[name] = caches.loaddata(container.path,name) - if containers.is_valid(container,name) then + local storage = container.storage + local stored = storage[name] + if not stored and container.enabled and caches and containers.usecache then + stored = caches.loaddata(container.readables,name) + if stored and stored.cache_version == container.version then report(container,"loaded",name) else - container.storage[name] = nil + stored = nil end - end - if container.storage[name] then + storage[name] = stored + elseif stored then report(container,"reusing",name) end - return container.storage[name] + return stored end function containers.write(container, name, data) @@ -10802,7 +12958,7 @@ function containers.write(container, name, data) if container.enabled and caches then local unique, shared = data.unique, data.shared data.unique, data.shared = nil, nil - caches.savedata(container.path, name, data) + caches.savedata(container.writable, name, data) report(container,"saved",name) data.unique, data.shared = unique, shared end @@ -10837,50 +12993,18 @@ local format, lower, gsub, find = string.format, string.lower, string.gsub, stri local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) --- since we want to use the cache instead of the tree, we will now --- reimplement the saver. - -local save_data = resolvers.save_data -local load_data = resolvers.load_data - -resolvers.cachepath = nil -- public, for tracing -resolvers.usecache = true -- public, for tracing +local report_mounts = logs.reporter("resolvers","mounts") -function resolvers.save_data(dataname) - save_data(dataname, function(cachename,dataname) - resolvers.usecache = not toboolean(resolvers.expansion("CACHEINTDS") or "false",true) - if resolvers.usecache then - resolvers.cachepath = resolvers.cachepath or caches.definepath("trees") - return file.join(resolvers.cachepath(),caches.hashed(cachename)) - else - return file.join(cachename,dataname) - end - end) -end - -function resolvers.load_data(pathname,dataname,filename) - load_data(pathname,dataname,filename,function(dataname,filename) - resolvers.usecache = not toboolean(resolvers.expansion("CACHEINTDS") or "false",true) - if resolvers.usecache then - resolvers.cachepath = resolvers.cachepath or caches.definepath("trees") - return file.join(resolvers.cachepath(),caches.hashed(pathname)) - else - if not filename or (filename == "") then - filename = dataname - end - return file.join(pathname,filename) - end - end) -end +local resolvers = resolvers -- we will make a better format, maybe something xml or just text or lua resolvers.automounted = resolvers.automounted or { } function resolvers.automount(usecache) - local mountpaths = resolvers.clean_path_list(resolvers.expansion('TEXMFMOUNT')) + local mountpaths = resolvers.cleanpathlist(resolvers.expansion('TEXMFMOUNT')) if (not mountpaths or #mountpaths == 0) and usecache then - mountpaths = { caches.setpath("mount") } + mountpaths = caches.getreadablepaths("mount") end if mountpaths and #mountpaths > 0 then statistics.starttiming(resolvers.instance) @@ -10894,7 +13018,7 @@ function resolvers.automount(usecache) -- skip elseif find(line,"^zip://") then if trace_locating then - logs.report("fileio","mounting %s",line) + report_mounts("mounting %s",line) end table.insert(resolvers.automounted,line) resolvers.usezipfile(line) @@ -10910,40 +13034,40 @@ end -- status info -statistics.register("used config path", function() return caches.configpath() end) -statistics.register("used cache path", function() return caches.temp() or "?" end) +statistics.register("used config file", function() return caches.configfiles() end) +statistics.register("used cache path", function() return caches.usedpaths() end) -- experiment (code will move) -function statistics.save_fmt_status(texname,formatbanner,sourcefile) -- texname == formatname +function statistics.savefmtstatus(texname,formatbanner,sourcefile) -- texname == formatname local enginebanner = status.list().banner if formatbanner and enginebanner and sourcefile then local luvname = file.replacesuffix(texname,"luv") local luvdata = { enginebanner = enginebanner, formatbanner = formatbanner, - sourcehash = md5.hex(io.loaddata(resolvers.find_file(sourcefile)) or "unknown"), + sourcehash = md5.hex(io.loaddata(resolvers.findfile(sourcefile)) or "unknown"), sourcefile = sourcefile, } io.savedata(luvname,table.serialize(luvdata,true)) end end -function statistics.check_fmt_status(texname) +function statistics.checkfmtstatus(texname) local enginebanner = status.list().banner if enginebanner and texname then local luvname = file.replacesuffix(texname,"luv") if lfs.isfile(luvname) then local luv = dofile(luvname) if luv and luv.sourcefile then - local sourcehash = md5.hex(io.loaddata(resolvers.find_file(luv.sourcefile)) or "unknown") + local sourcehash = md5.hex(io.loaddata(resolvers.findfile(luv.sourcefile)) or "unknown") local luvbanner = luv.enginebanner or "?" if luvbanner ~= enginebanner then - return string.format("engine mismatch (luv:%s <> bin:%s)",luvbanner,enginebanner) + return format("engine mismatch (luv: %s <> bin: %s)",luvbanner,enginebanner) end local luvhash = luv.sourcehash or "?" if luvhash ~= sourcehash then - return string.format("source mismatch (luv:%s <> bin:%s)",luvhash,sourcehash) + return format("source mismatch (luv: %s <> bin: %s)",luvhash,sourcehash) end else return "invalid status file" @@ -10968,25 +13092,30 @@ if not modules then modules = { } end modules ['data-zip'] = { license = "see context related readme files" } +-- partly redone .. needs testing + local format, find, match = string.format, string.find, string.match -local unpack = unpack or table.unpack local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local report_zip = logs.reporter("resolvers","zip") + -- zip:///oeps.zip?name=bla/bla.tex -- zip:///oeps.zip?tree=tex/texmf-local -- zip:///texmf.zip?tree=/tex/texmf -- zip:///texmf.zip?tree=/tex/texmf-local -- zip:///texmf-mine.zip?tree=/tex/texmf-projects -zip = zip or { } -zip.archives = zip.archives or { } -zip.registeredfiles = zip.registeredfiles or { } +local resolvers = resolvers -local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders -local locators, hashers, concatinators = resolvers.locators, resolvers.hashers, resolvers.concatinators +zip = zip or { } +local zip = zip -local archives = zip.archives +zip.archives = zip.archives or { } +local archives = zip.archives + +zip.registeredfiles = zip.registeredfiles or { } +local registeredfiles = zip.registeredfiles local function validzip(str) -- todo: use url splitter if not find(str,"^zip://") then @@ -11002,7 +13131,7 @@ function zip.openarchive(name) else local arch = archives[name] if not arch then - local full = resolvers.find_file(name) or "" + local full = resolvers.findfile(name) or "" arch = (full ~= "" and zip.open(full)) or false archives[name] = arch end @@ -11017,163 +13146,162 @@ function zip.closearchive(name) end end -function locators.zip(specification) -- where is this used? startup zips (untested) - specification = resolvers.splitmethod(specification) - local zipfile = specification.path - local zfile = zip.openarchive(name) -- tricky, could be in to be initialized tree +function resolvers.locators.zip(specification) + local archive = specification.filename + local zipfile = archive and archive ~= "" and zip.openarchive(archive) -- tricky, could be in to be initialized tree if trace_locating then - if zfile then - logs.report("fileio","zip locator, archive '%s' found",specification.original) + if zipfile then + report_zip("locator, archive '%s' found",archive) else - logs.report("fileio","zip locator, archive '%s' not found",specification.original) + report_zip("locator, archive '%s' not found",archive) end end end -function hashers.zip(tag,name) +function resolvers.hashers.zip(specification) + local archive = specification.filename if trace_locating then - logs.report("fileio","loading zip file '%s' as '%s'",name,tag) + report_zip("loading file '%s'",archive) end - resolvers.usezipfile(format("%s?tree=%s",tag,name)) + resolvers.usezipfile(specification.original) end -function concatinators.zip(tag,path,name) +function resolvers.concatinators.zip(zipfile,path,name) -- ok ? if not path or path == "" then - return format('%s?name=%s',tag,name) + return format('%s?name=%s',zipfile,name) else - return format('%s?name=%s/%s',tag,path,name) + return format('%s?name=%s/%s',zipfile,path,name) end end -function resolvers.isreadable.zip(name) - return true -end - -function finders.zip(specification,filetype) - specification = resolvers.splitmethod(specification) - if specification.path then - local q = url.query(specification.query) - if q.name then - local zfile = zip.openarchive(specification.path) +function resolvers.finders.zip(specification) + local original = specification.original + local archive = specification.filename + if archive then + local query = url.query(specification.query) + local queryname = query.name + if queryname then + local zfile = zip.openarchive(archive) if zfile then if trace_locating then - logs.report("fileio","zip finder, archive '%s' found",specification.path) + report_zip("finder, archive '%s' found",archive) end - local dfile = zfile:open(q.name) + local dfile = zfile:open(queryname) if dfile then dfile = zfile:close() if trace_locating then - logs.report("fileio","zip finder, file '%s' found",q.name) + report_zip("finder, file '%s' found",queryname) end return specification.original elseif trace_locating then - logs.report("fileio","zip finder, file '%s' not found",q.name) + report_zip("finder, file '%s' not found",queryname) end elseif trace_locating then - logs.report("fileio","zip finder, unknown archive '%s'",specification.path) + report_zip("finder, unknown archive '%s'",archive) end end end if trace_locating then - logs.report("fileio","zip finder, '%s' not found",filename) + report_zip("finder, '%s' not found",original) end - return unpack(finders.notfound) + return resolvers.finders.notfound() end -function openers.zip(specification) - local zipspecification = resolvers.splitmethod(specification) - if zipspecification.path then - local q = url.query(zipspecification.query) - if q.name then - local zfile = zip.openarchive(zipspecification.path) +function resolvers.openers.zip(specification) + local original = specification.original + local archive = specification.filename + if archive then + local query = url.query(specification.query) + local queryname = query.name + if queryname then + local zfile = zip.openarchive(archive) if zfile then if trace_locating then - logs.report("fileio","zip opener, archive '%s' opened",zipspecification.path) + report_zip("opener, archive '%s' opened",archive) end - local dfile = zfile:open(q.name) + local dfile = zfile:open(queryname) if dfile then - logs.show_open(specification) if trace_locating then - logs.report("fileio","zip opener, file '%s' found",q.name) + report_zip("opener, file '%s' found",queryname) end - return openers.text_opener(specification,dfile,'zip') + return resolvers.openers.helpers.textopener('zip',original,dfile) elseif trace_locating then - logs.report("fileio","zip opener, file '%s' not found",q.name) + report_zip("opener, file '%s' not found",queryname) end elseif trace_locating then - logs.report("fileio","zip opener, unknown archive '%s'",zipspecification.path) + report_zip("opener, unknown archive '%s'",archive) end end end if trace_locating then - logs.report("fileio","zip opener, '%s' not found",filename) + report_zip("opener, '%s' not found",original) end - return unpack(openers.notfound) + return resolvers.openers.notfound() end -function loaders.zip(specification) - specification = resolvers.splitmethod(specification) - if specification.path then - local q = url.query(specification.query) - if q.name then - local zfile = zip.openarchive(specification.path) +function resolvers.loaders.zip(specification) + local original = specification.original + local archive = specification.filename + if archive then + local query = url.query(specification.query) + local queryname = query.name + if queryname then + local zfile = zip.openarchive(archive) if zfile then if trace_locating then - logs.report("fileio","zip loader, archive '%s' opened",specification.path) + report_zip("loader, archive '%s' opened",archive) end - local dfile = zfile:open(q.name) + local dfile = zfile:open(queryname) if dfile then - logs.show_load(filename) + logs.show_load(original) if trace_locating then - logs.report("fileio","zip loader, file '%s' loaded",filename) + report_zip("loader, file '%s' loaded",original) end local s = dfile:read("*all") dfile:close() return true, s, #s elseif trace_locating then - logs.report("fileio","zip loader, file '%s' not found",q.name) + report_zip("loader, file '%s' not found",queryname) end elseif trace_locating then - logs.report("fileio","zip loader, unknown archive '%s'",specification.path) + report_zip("loader, unknown archive '%s'",archive) end end end if trace_locating then - logs.report("fileio","zip loader, '%s' not found",filename) + report_zip("loader, '%s' not found",original) end - return unpack(openers.notfound) + return resolvers.openers.notfound() end -- zip:///somefile.zip -- zip:///somefile.zip?tree=texmf-local -> mount -function resolvers.usezipfile(zipname) - zipname = validzip(zipname) - local specification = resolvers.splitmethod(zipname) - local zipfile = specification.path - if zipfile and not zip.registeredfiles[zipname] then - local tree = url.query(specification.query).tree or "" - local z = zip.openarchive(zipfile) +function resolvers.usezipfile(archive) + local specification = resolvers.splitmethod(archive) -- to be sure + local archive = specification.filename + if archive and not registeredfiles[archive] then + local z = zip.openarchive(archive) if z then - local instance = resolvers.instance + local tree = url.query(specification.query).tree or "" if trace_locating then - logs.report("fileio","zip registering, registering archive '%s'",zipname) - end - statistics.starttiming(instance) - resolvers.prepend_hash('zip',zipname,zipfile) - resolvers.extend_texmf_var(zipname) -- resets hashes too - zip.registeredfiles[zipname] = z - instance.files[zipname] = resolvers.register_zip_file(z,tree or "") - statistics.stoptiming(instance) + report_zip("registering, registering archive '%s'",archive) + end + statistics.starttiming(resolvers.instance) + resolvers.prependhash('zip',archive) + resolvers.extendtexmfvariable(archive) -- resets hashes too + registeredfiles[archive] = z + instance.files[archive] = resolvers.registerzipfile(z,tree) + statistics.stoptiming(resolvers.instance) elseif trace_locating then - logs.report("fileio","zip registering, unknown archive '%s'",zipname) + report_zip("registering, unknown archive '%s'",archive) end elseif trace_locating then - logs.report("fileio","zip registering, '%s' not found",zipname) + report_zip("registering, '%s' not found",archive) end end -function resolvers.register_zip_file(z,tree) +function resolvers.registerzipfile(z,tree) local files, filter = { }, "" if tree == "" then filter = "^(.+)/(.-)$" @@ -11181,9 +13309,9 @@ function resolvers.register_zip_file(z,tree) filter = format("^%s/(.+)/(.-)$",tree) end if trace_locating then - logs.report("fileio","zip registering, using filter '%s'",filter) + report_zip("registering, using filter '%s'",filter) end - local register, n = resolvers.register_file, 0 + local register, n = resolvers.registerfile, 0 for i in z:files() do local path, name = match(i.filename,filter) if path then @@ -11198,11 +13326,89 @@ function resolvers.register_zip_file(z,tree) n = n + 1 end end - logs.report("fileio","zip registering, %s files registered",n) + report_zip("registering, %s files registered",n) return files end +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-tre'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- \input tree://oeps1/**/oeps.tex + +local find, gsub, format = string.find, string.gsub, string.format + +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) + +local report_trees = logs.reporter("resolvers","trees") + +local resolvers = resolvers + +local done, found, notfound = { }, { }, resolvers.finders.notfound + +function resolvers.finders.tree(specification) + local spec = specification.filename + local fnd = found[spec] + if fnd == nil then + if spec ~= "" then + local path, name = file.dirname(spec), file.basename(spec) + if path == "" then path = "." end + local hash = done[path] + if not hash then + local pattern = path .. "/*" -- we will use the proper splitter + hash = dir.glob(pattern) + done[path] = hash + end + local pattern = "/" .. gsub(name,"([%.%-%+])", "%%%1") .. "$" + for k=1,#hash do + local v = hash[k] + if find(v,pattern) then + found[spec] = v + return v + end + end + end + fnd = notfound() -- false + found[spec] = fnd + end + return fnd +end + +function resolvers.locators.tree(specification) + local name = specification.filename + if name ~= '' and lfs.isdir(name) then + if trace_locating then + report_trees("locator '%s' found",name) + end + resolvers.appendhash('tree',name,false) -- don't cache + elseif trace_locating then + report_trees("locator '%s' not found",name) + end +end + +function resolvers.hashers.tree(specification) + local name = specification.filename + if trace_locating then + report_trees("analysing '%s'",name) + end + resolvers.methodhandler("hashers",name) +end + +resolvers.concatinators.tree = resolvers.concatinators.file +resolvers.generators.tree = resolvers.generators.file +resolvers.openers.tree = resolvers.openers.file +resolvers.loaders.tree = resolvers.loaders.file + + end -- of closure do -- create closure to overcome 200 locals limit @@ -11215,58 +13421,59 @@ if not modules then modules = { } end modules ['data-crl'] = { license = "see context related readme files" } -local gsub = string.gsub +-- this one is replaced by data-sch.lua -- -curl = curl or { } +local gsub = string.gsub -curl.cached = { } -curl.cachepath = caches.definepath("curl") +local resolvers = resolvers local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders -function curl.fetch(protocol, name) - local cachename = curl.cachepath() .. "/" .. gsub(name,"[^%a%d%.]+","-") --- cachename = gsub(cachename,"[\\/]", io.fileseparator) - cachename = gsub(cachename,"[\\]", "/") -- cleanup - if not curl.cached[name] then +resolvers.curl = resolvers.curl or { } +local curl = resolvers.curl + +local cached = { } + +local function runcurl(specification) + local original = specification.original + -- local scheme = specification.scheme + local cleanname = gsub(original,"[^%a%d%.]+","-") + local cachename = caches.setfirstwritablefile(cleanname,"curl") + if not cached[original] then if not io.exists(cachename) then - curl.cached[name] = cachename - local command = "curl --silent --create-dirs --output " .. cachename .. " " .. name -- no protocol .. "://" + cached[original] = cachename + local command = "curl --silent --create-dirs --output " .. cachename .. " " .. original os.spawn(command) end if io.exists(cachename) then - curl.cached[name] = cachename + cached[original] = cachename else - curl.cached[name] = "" + cached[original] = "" end end - return curl.cached[name] -end - -function finders.curl(protocol,filename) - local foundname = curl.fetch(protocol, filename) - return finders.generic(protocol,foundname,filetype) + return cached[original] end -function openers.curl(protocol,filename) - return openers.generic(protocol,filename) -end +-- old code: we could be cleaner using specification (see schemes) -function loaders.curl(protocol,filename) - return loaders.generic(protocol,filename) +local function finder(specification,filetype) + return resolvers.methodhandler("finders",runcurl(specification),filetype) end --- todo: metamethod +local opener = openers.file +local loader = loaders.file -function curl.install(protocol) - finders[protocol] = function (filename,filetype) return finders.curl(protocol,filename) end - openers[protocol] = function (filename) return openers.curl(protocol,filename) end - loaders[protocol] = function (filename) return loaders.curl(protocol,filename) end +local function install(scheme) + finders[scheme] = finder + openers[scheme] = opener + loaders[scheme] = loader end -curl.install('http') -curl.install('https') -curl.install('ftp') +resolvers.curl.install = install + +install('http') +install('https') +install('ftp') end -- of closure @@ -11287,9 +13494,13 @@ if not modules then modules = { } end modules ['data-lua'] = { local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local report_libraries = logs.reporter("resolvers","libraries") + local gsub, insert = string.gsub, table.insert local unpack = unpack or table.unpack +local resolvers, package = resolvers, package + local libformats = { 'luatexlibs', 'tex', 'texmfscripts', 'othertextfiles' } -- 'luainputs' local clibformats = { 'lib' } @@ -11298,7 +13509,7 @@ local _path_, libpaths, _cpath_, clibpaths function package.libpaths() if not _path_ or package.path ~= _path_ then _path_ = package.path - libpaths = file.split_path(_path_,";") + libpaths = file.splitpath(_path_,";") end return libpaths end @@ -11306,7 +13517,7 @@ end function package.clibpaths() if not _cpath_ or package.cpath ~= _cpath_ then _cpath_ = package.cpath - clibpaths = file.split_path(_cpath_,";") + clibpaths = file.splitpath(_cpath_,";") end return clibpaths end @@ -11315,18 +13526,18 @@ local function thepath(...) local t = { ... } t[#t+1] = "?.lua" local path = file.join(unpack(t)) if trace_locating then - logs.report("fileio","! appending '%s' to 'package.path'",path) + report_libraries("! appending '%s' to 'package.path'",path) end return path end local p_libpaths, a_libpaths = { }, { } -function package.append_libpath(...) +function package.appendtolibpath(...) insert(a_libpath,thepath(...)) end -function package.prepend_libpath(...) +function package.prependtolibpath(...) insert(p_libpaths,1,thepath(...)) end @@ -11337,31 +13548,30 @@ local function loaded(libpaths,name,simple) local libpath = libpaths[i] local resolved = gsub(libpath,"%?",simple) if trace_locating then -- more detail - logs.report("fileio","! checking for '%s' on 'package.path': '%s' => '%s'",simple,libpath,resolved) + report_libraries("! checking for '%s' on 'package.path': '%s' => '%s'",simple,libpath,resolved) end - if resolvers.isreadable.file(resolved) then + if file.is_readable(resolved) then if trace_locating then - logs.report("fileio","! lib '%s' located via 'package.path': '%s'",name,resolved) + report_libraries("! lib '%s' located via 'package.path': '%s'",name,resolved) end return loadfile(resolved) end end end - package.loaders[2] = function(name) -- was [#package.loaders+1] if trace_locating then -- mode detail - logs.report("fileio","! locating '%s'",name) + report_libraries("! locating '%s'",name) end for i=1,#libformats do local format = libformats[i] - local resolved = resolvers.find_file(name,format) or "" + local resolved = resolvers.findfile(name,format) or "" if trace_locating then -- mode detail - logs.report("fileio","! checking for '%s' using 'libformat path': '%s'",name,format) + report_libraries("! checking for '%s' using 'libformat path': '%s'",name,format) end if resolved ~= "" then if trace_locating then - logs.report("fileio","! lib '%s' located via environment: '%s'",name,resolved) + report_libraries("! lib '%s' located via environment: '%s'",name,resolved) end return loadfile(resolved) end @@ -11379,16 +13589,16 @@ package.loaders[2] = function(name) -- was [#package.loaders+1] for i=1,#clibformats do -- better have a dedicated loop local format = clibformats[i] - local paths = resolvers.expanded_path_list_from_var(format) + local paths = resolvers.expandedpathlistfromvariable(format) for p=1,#paths do local path = paths[p] local resolved = file.join(path,libname) if trace_locating then -- mode detail - logs.report("fileio","! checking for '%s' using 'clibformat path': '%s'",libname,path) + report_libraries("! checking for '%s' using 'clibformat path': '%s'",libname,path) end - if resolvers.isreadable.file(resolved) then + if file.is_readable(resolved) then if trace_locating then - logs.report("fileio","! lib '%s' located via 'clibformat': '%s'",libname,resolved) + report_libraries("! lib '%s' located via 'clibformat': '%s'",libname,resolved) end return package.loadlib(resolved,name) end @@ -11398,140 +13608,43 @@ package.loaders[2] = function(name) -- was [#package.loaders+1] local libpath = clibpaths[i] local resolved = gsub(libpath,"?",simple) if trace_locating then -- more detail - logs.report("fileio","! checking for '%s' on 'package.cpath': '%s'",simple,libpath) + report_libraries("! checking for '%s' on 'package.cpath': '%s'",simple,libpath) end - if resolvers.isreadable.file(resolved) then + if file.is_readable(resolved) then if trace_locating then - logs.report("fileio","! lib '%s' located via 'package.cpath': '%s'",name,resolved) + report_libraries("! lib '%s' located via 'package.cpath': '%s'",name,resolved) end return package.loadlib(resolved,name) end end -- just in case the distribution is messed up if trace_loading then -- more detail - logs.report("fileio","! checking for '%s' using 'luatexlibs': '%s'",name) + report_libraries("! checking for '%s' using 'luatexlibs': '%s'",name) end - local resolved = resolvers.find_file(file.basename(name),'luatexlibs') or "" + local resolved = resolvers.findfile(file.basename(name),'luatexlibs') or "" if resolved ~= "" then if trace_locating then - logs.report("fileio","! lib '%s' located by basename via environment: '%s'",name,resolved) + report_libraries("! lib '%s' located by basename via environment: '%s'",name,resolved) end return loadfile(resolved) end if trace_locating then - logs.report("fileio",'? unable to locate lib: %s',name) + report_libraries('? unable to locate lib: %s',name) end -- return "unable to locate " .. name end resolvers.loadlualib = require +-- -- -- -- -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['luat-kps'] = { - version = 1.001, - comment = "companion to luatools.lua", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - ---[[ldx-- -

This file is used when we want the input handlers to behave like -kpsewhich. What to do with the following:

- - -{$SELFAUTOLOC,$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c} -$SELFAUTOLOC : /usr/tex/bin/platform -$SELFAUTODIR : /usr/tex/bin -$SELFAUTOPARENT : /usr/tex - - -

How about just forgetting about them?

---ldx]]-- - -local suffixes = resolvers.suffixes -local formats = resolvers.formats - -suffixes['gf'] = { 'gf' } -suffixes['pk'] = { 'pk' } -suffixes['base'] = { 'base' } -suffixes['bib'] = { 'bib' } -suffixes['bst'] = { 'bst' } -suffixes['cnf'] = { 'cnf' } -suffixes['mem'] = { 'mem' } -suffixes['mf'] = { 'mf' } -suffixes['mfpool'] = { 'pool' } -suffixes['mft'] = { 'mft' } -suffixes['mppool'] = { 'pool' } -suffixes['graphic/figure'] = { 'eps', 'epsi' } -suffixes['texpool'] = { 'pool' } -suffixes['PostScript header'] = { 'pro' } -suffixes['ist'] = { 'ist' } -suffixes['web'] = { 'web', 'ch' } -suffixes['cweb'] = { 'w', 'web', 'ch' } -suffixes['cmap files'] = { 'cmap' } -suffixes['lig files'] = { 'lig' } -suffixes['bitmap font'] = { } -suffixes['MetaPost support'] = { } -suffixes['TeX system documentation'] = { } -suffixes['TeX system sources'] = { } -suffixes['dvips config'] = { } -suffixes['type42 fonts'] = { } -suffixes['web2c files'] = { } -suffixes['other text files'] = { } -suffixes['other binary files'] = { } -suffixes['opentype fonts'] = { 'otf' } - -suffixes['fmt'] = { 'fmt' } -suffixes['texmfscripts'] = { 'rb','lua','py','pl' } - -suffixes['pdftex config'] = { } -suffixes['Troff fonts'] = { } - -suffixes['ls-R'] = { } +package.obsolete = package.obsolete or { } ---[[ldx-- -

If you wondered abou tsome of the previous mappings, how about -the next bunch:

---ldx]]-- +package.append_libpath = appendtolibpath -- will become obsolete +package.prepend_libpath = prependtolibpath -- will become obsolete -formats['bib'] = '' -formats['bst'] = '' -formats['mft'] = '' -formats['ist'] = '' -formats['web'] = '' -formats['cweb'] = '' -formats['MetaPost support'] = '' -formats['TeX system documentation'] = '' -formats['TeX system sources'] = '' -formats['Troff fonts'] = '' -formats['dvips config'] = '' -formats['graphic/figure'] = '' -formats['ls-R'] = '' -formats['other text files'] = '' -formats['other binary files'] = '' - -formats['gf'] = '' -formats['pk'] = '' -formats['base'] = 'MFBASES' -formats['cnf'] = '' -formats['mem'] = 'MPMEMS' -formats['mf'] = 'MFINPUTS' -formats['mfpool'] = 'MFPOOL' -formats['mppool'] = 'MPPOOL' -formats['texpool'] = 'TEXPOOL' -formats['PostScript header'] = 'TEXPSHEADERS' -formats['cmap files'] = 'CMAPFONTS' -formats['type42 fonts'] = 'T42FONTS' -formats['web2c files'] = 'WEB2C' -formats['pdftex config'] = 'PDFTEXCONFIG' -formats['texmfscripts'] = 'TEXMFSCRIPTS' -formats['bitmap font'] = '' -formats['lig files'] = 'LIGFONTS' +package.obsolete.append_libpath = appendtolibpath -- will become obsolete +package.obsolete.prepend_libpath = prependtolibpath -- will become obsolete end -- of closure @@ -11547,49 +13660,54 @@ if not modules then modules = { } end modules ['data-aux'] = { } local find = string.find +local type, next = type, next local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) -function resolvers.update_script(oldname,newname) -- oldname -> own.name, not per se a suffix +local resolvers = resolvers + +local report_scripts = logs.reporter("resolvers","scripts") + +function resolvers.updatescript(oldname,newname) -- oldname -> own.name, not per se a suffix local scriptpath = "scripts/context/lua" newname = file.addsuffix(newname,"lua") - local oldscript = resolvers.clean_path(oldname) + local oldscript = resolvers.cleanpath(oldname) if trace_locating then - logs.report("fileio","to be replaced old script %s", oldscript) + report_scripts("to be replaced old script %s", oldscript) end - local newscripts = resolvers.find_files(newname) or { } + local newscripts = resolvers.findfiles(newname) or { } if #newscripts == 0 then if trace_locating then - logs.report("fileio","unable to locate new script") + report_scripts("unable to locate new script") end else for i=1,#newscripts do - local newscript = resolvers.clean_path(newscripts[i]) + local newscript = resolvers.cleanpath(newscripts[i]) if trace_locating then - logs.report("fileio","checking new script %s", newscript) + report_scripts("checking new script %s", newscript) end if oldscript == newscript then if trace_locating then - logs.report("fileio","old and new script are the same") + report_scripts("old and new script are the same") end elseif not find(newscript,scriptpath) then if trace_locating then - logs.report("fileio","new script should come from %s",scriptpath) + report_scripts("new script should come from %s",scriptpath) end elseif not (find(oldscript,file.removesuffix(newname).."$") or find(oldscript,newname.."$")) then if trace_locating then - logs.report("fileio","invalid new script name") + report_scripts("invalid new script name") end else local newdata = io.loaddata(newscript) if newdata then if trace_locating then - logs.report("fileio","old script content replaced by new content") + report_scripts("old script content replaced by new content") end io.savedata(oldscript,newdata) break elseif trace_locating then - logs.report("fileio","unable to load new script") + report_scripts("unable to load new script") end end end @@ -11609,72 +13727,133 @@ if not modules then modules = { } end modules ['data-tmf'] = { license = "see context related readme files" } -local find, gsub, match = string.find, string.gsub, string.match -local getenv, setenv = os.getenv, os.setenv +local resolvers = resolvers --- loads *.tmf files in minimal tree roots (to be optimized and documented) +local report_tds = logs.reporter("resolvers","tds") -function resolvers.check_environment(tree) - logs.simpleline() - setenv('TMP', getenv('TMP') or getenv('TEMP') or getenv('TMPDIR') or getenv('HOME')) - setenv('TEXOS', getenv('TEXOS') or ("texmf-" .. os.platform)) - setenv('TEXPATH', gsub(tree or "tex","\/+$",'')) - setenv('TEXMFOS', getenv('TEXPATH') .. "/" .. getenv('TEXOS')) - logs.simpleline() - logs.simple("preset : TEXPATH => %s", getenv('TEXPATH')) - logs.simple("preset : TEXOS => %s", getenv('TEXOS')) - logs.simple("preset : TEXMFOS => %s", getenv('TEXMFOS')) - logs.simple("preset : TMP => %s", getenv('TMP')) - logs.simple('') -end +-- = << +-- ? ?? +-- < += +-- > =+ -function resolvers.load_environment(name) -- todo: key=value as well as lua - local f = io.open(name) - if f then - for line in f:lines() do - if find(line,"^[%%%#]") then - -- skip comment - else - local key, how, value = match(line,"^(.-)%s*([<=>%?]+)%s*(.*)%s*$") - if how then - value = gsub(value,"%%(.-)%%", function(v) return getenv(v) or "" end) - if how == "=" or how == "<<" then - setenv(key,value) - elseif how == "?" or how == "??" then - setenv(key,getenv(key) or value) - elseif how == "<" or how == "+=" then - if getenv(key) then - setenv(key,getenv(key) .. io.fileseparator .. value) - else - setenv(key,value) - end - elseif how == ">" or how == "=+" then - if getenv(key) then - setenv(key,value .. io.pathseparator .. getenv(key)) - else - setenv(key,value) - end - end - end - end +function resolvers.load_tree(tree,resolve) + if type(tree) == "string" and tree ~= "" then + + local getenv, setenv = resolvers.getenv, resolvers.setenv + + -- later might listen to the raw osenv var as well + local texos = "texmf-" .. os.platform + + local oldroot = environment.texroot + local newroot = file.collapsepath(tree) + + local newtree = file.join(newroot,texos) + local newpath = file.join(newtree,"bin") + + if not lfs.isdir(newtree) then + report_tds("no '%s' under tree %s",texos,tree) + os.exit() end - f:close() + if not lfs.isdir(newpath) then + report_tds("no '%s/bin' under tree %s",texos,tree) + os.exit() + end + + local texmfos = newtree + + environment.texroot = newroot + environment.texos = texos + environment.texmfos = texmfos + + -- Beware, we need to obey the relocatable autoparent so we + -- set TEXMFCNF to its raw value. This is somewhat tricky when + -- we run a mkii job from within. Therefore, in mtxrun, there + -- is a resolve applied when we're in mkii/kpse mode. + + setenv('SELFAUTOPARENT', newroot) + setenv('SELFAUTODIR', newtree) + setenv('SELFAUTOLOC', newpath) + setenv('TEXROOT', newroot) + setenv('TEXOS', texos) + setenv('TEXMFOS', texmfos) + setenv('TEXMFCNF', resolvers.luacnfspec, not resolve) + setenv("PATH", newpath .. io.pathseparator .. getenv("PATH")) + + report_tds("changing from root '%s' to '%s'",oldroot,newroot) + report_tds("prepending '%s' to binary path",newpath) + report_tds() end end -function resolvers.load_tree(tree) - if tree and tree ~= "" then - local setuptex = 'setuptex.tmf' - if lfs.attributes(tree, "mode") == "directory" then -- check if not nil - setuptex = tree .. "/" .. setuptex - else - setuptex = tree + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-lst'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- used in mtxrun, can be loaded later .. todo + +local find, concat, upper, format = string.find, table.concat, string.upper, string.format + +resolvers.listers = resolvers.listers or { } + +local resolvers = resolvers + +local report_lists = logs.reporter("resolvers","lists") + +local function tabstr(str) + if type(str) == 'table' then + return concat(str," | ") + else + return str + end +end + +function resolvers.listers.variables(pattern) + local instance = resolvers.instance + local environment = instance.environment + local variables = instance.variables + local expansions = instance.expansions + local pattern = upper(pattern or "") + local configured = { } + local order = instance.order + for i=1,#order do + for k, v in next, order[i] do + if v ~= nil and configured[k] == nil then + configured[k] = v + end end - if io.exists(setuptex) then - resolvers.check_environment(tree) - resolvers.load_environment(setuptex) + end + local env = table.fastcopy(environment) + local var = table.fastcopy(variables) + local exp = table.fastcopy(expansions) + for key, value in table.sortedpairs(configured) do + if key ~= "" and (pattern == "" or find(upper(key),pattern)) then + report_lists(key) + report_lists(" env: %s",tabstr(rawget(environment,key)) or "unset") + report_lists(" var: %s",tabstr(configured[key]) or "unset") + report_lists(" exp: %s",tabstr(expansions[key]) or "unset") + report_lists(" res: %s",resolvers.resolve(expansions[key]) or "unset") end end + instance.environment = table.fastcopy(env) + instance.variables = table.fastcopy(var) + instance.expansions = table.fastcopy(exp) +end + +function resolvers.listers.configurations(report) + local configurations = resolvers.instance.specification + local report = report or texio.write_nl + for i=1,#configurations do + report(resolvers.resolve(configurations[i])) + end end @@ -11691,12 +13870,18 @@ if not modules then modules = { } end modules ['luat-sta'] = { -- this code is used in the updater -local gmatch, match = string.gmatch, string.match -local type = type +local gmatch, match = string.gmatch, string.match +local type = type + +states = states or { } +local states = states + +states.data = states.data or { } +local data = states.data + +states.hash = states.hash or { } +local hash = states.hash -states = states or { } -states.data = states.data or { } -states.hash = states.hash or { } states.tag = states.tag or "" states.filename = states.filename or "" @@ -11706,7 +13891,7 @@ function states.save(filename,tag) io.savedata(filename, "-- generator : luat-sta.lua\n" .. "-- state tag : " .. tag .. "\n\n" .. - table.serialize(states.data[tag or states.tag] or {},true) + table.serialize(data[tag or states.tag] or {},true) ) end @@ -11714,11 +13899,11 @@ function states.load(filename,tag) states.filename = filename states.tag = tag or "whatever" states.filename = file.addsuffix(states.filename,'lus') - states.data[states.tag], states.hash[states.tag] = (io.exists(filename) and dofile(filename)) or { }, { } + data[states.tag], hash[states.tag] = (io.exists(filename) and dofile(filename)) or { }, { } end -function states.set_by_tag(tag,key,value,default,persistent) - local d, h = states.data[tag], states.hash[tag] +local function set_by_tag(tag,key,value,default,persistent) + local d, h = data[tag], hash[tag] if d then if type(d) == "table" then local dkey, hkey = key, key @@ -11738,8 +13923,10 @@ function states.set_by_tag(tag,key,value,default,persistent) end dkey, hkey = post, key end - if type(value) == nil then - value = value or default + if value == nil then + value = default + elseif value == false then + -- special case elseif persistent then value = value or d[dkey] or default else @@ -11748,144 +13935,202 @@ function states.set_by_tag(tag,key,value,default,persistent) d[dkey], h[hkey] = value, value elseif type(d) == "string" then -- weird - states.data[tag], states.hash[tag] = value, value + data[tag], hash[tag] = value, value end end end -function states.get_by_tag(tag,key,default) - local h = states.hash[tag] +local function get_by_tag(tag,key,default) + local h = hash[tag] if h and h[key] then return h[key] else - local d = states.data[tag] + local d = data[tag] if d then for k in gmatch(key,"[^%.]+") do local dk = d[k] - if dk then + if dk ~= nil then d = dk else return default end end - return d or default + if d == false then + return false + else + return d or default + end end end end +states.set_by_tag = set_by_tag +states.get_by_tag = get_by_tag + function states.set(key,value,default,persistent) - states.set_by_tag(states.tag,key,value,default,persistent) + set_by_tag(states.tag,key,value,default,persistent) end function states.get(key,default) - return states.get_by_tag(states.tag,key,default) -end - ---~ states.data.update = { ---~ ["version"] = { ---~ ["major"] = 0, ---~ ["minor"] = 1, ---~ }, ---~ ["rsync"] = { ---~ ["server"] = "contextgarden.net", ---~ ["module"] = "minimals", ---~ ["repository"] = "current", ---~ ["flags"] = "-rpztlv --stats", ---~ }, ---~ ["tasks"] = { ---~ ["update"] = true, ---~ ["make"] = true, ---~ ["delete"] = false, ---~ }, ---~ ["platform"] = { ---~ ["host"] = true, ---~ ["other"] = { ---~ ["mswin"] = false, ---~ ["linux"] = false, ---~ ["linux-64"] = false, ---~ ["osx-intel"] = false, ---~ ["osx-ppc"] = false, ---~ ["sun"] = false, ---~ }, ---~ }, ---~ ["context"] = { ---~ ["available"] = {"current", "beta", "alpha", "experimental"}, ---~ ["selected"] = "current", ---~ }, ---~ ["formats"] = { ---~ ["cont-en"] = true, ---~ ["cont-nl"] = true, ---~ ["cont-de"] = false, ---~ ["cont-cz"] = false, ---~ ["cont-fr"] = false, ---~ ["cont-ro"] = false, ---~ }, ---~ ["engine"] = { ---~ ["pdftex"] = { ---~ ["install"] = true, ---~ ["formats"] = { ---~ ["pdftex"] = true, ---~ }, ---~ }, ---~ ["luatex"] = { ---~ ["install"] = true, ---~ ["formats"] = { ---~ }, ---~ }, ---~ ["xetex"] = { ---~ ["install"] = true, ---~ ["formats"] = { ---~ ["xetex"] = false, ---~ }, ---~ }, ---~ ["metapost"] = { ---~ ["install"] = true, ---~ ["formats"] = { ---~ ["mpost"] = true, ---~ ["metafun"] = true, ---~ }, ---~ }, ---~ }, ---~ ["fonts"] = { ---~ }, ---~ ["doc"] = { ---~ }, ---~ ["modules"] = { ---~ ["f-urwgaramond"] = false, ---~ ["f-urwgothic"] = false, ---~ ["t-bnf"] = false, ---~ ["t-chromato"] = false, ---~ ["t-cmscbf"] = false, ---~ ["t-cmttbf"] = false, ---~ ["t-construction-plan"] = false, ---~ ["t-degrade"] = false, ---~ ["t-french"] = false, ---~ ["t-lettrine"] = false, ---~ ["t-lilypond"] = false, ---~ ["t-mathsets"] = false, ---~ ["t-tikz"] = false, ---~ ["t-typearea"] = false, ---~ ["t-vim"] = false, ---~ }, ---~ } - ---~ states.save("teststate", "update") ---~ states.load("teststate", "update") - ---~ print(states.get_by_tag("update","rsync.server","unknown")) ---~ states.set_by_tag("update","rsync.server","oeps") ---~ print(states.get_by_tag("update","rsync.server","unknown")) ---~ states.save("teststate", "update") ---~ states.load("teststate", "update") ---~ print(states.get_by_tag("update","rsync.server","unknown")) + return get_by_tag(states.tag,key,default) +end + + + + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['luat-fmt'] = { + version = 1.001, + comment = "companion to mtxrun", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + + +local format = string.format + +local report_format = logs.reporter("resolvers","formats") + +-- helper for mtxrun + +local quoted = string.quoted + +local function primaryflags() -- not yet ok + local trackers = environment.argument("trackers") + local directives = environment.argument("directives") + local flags = "" + if trackers and trackers ~= "" then + flags = flags .. "--trackers=" .. quoted(trackers) + end + if directives and directives ~= "" then + flags = flags .. "--directives=" .. quoted(directives) + end + return flags +end + +function environment.make_format(name) + -- change to format path (early as we need expanded paths) + local olddir = lfs.currentdir() + local path = caches.getwritablepath("formats") or "" -- maybe platform + if path ~= "" then + lfs.chdir(path) + end + report_format("format path: %s",lfs.currentdir()) + -- check source file + local texsourcename = file.addsuffix(name,"mkiv") + local fulltexsourcename = resolvers.findfile(texsourcename,"tex") or "" + if fulltexsourcename == "" then + texsourcename = file.addsuffix(name,"tex") + fulltexsourcename = resolvers.findfile(texsourcename,"tex") or "" + end + if fulltexsourcename == "" then + report_format("no tex source file with name: %s (mkiv or tex)",name) + lfs.chdir(olddir) + return + else + report_format("using tex source file: %s",fulltexsourcename) + end + local texsourcepath = dir.expandname(file.dirname(fulltexsourcename)) -- really needed + -- check specification + local specificationname = file.replacesuffix(fulltexsourcename,"lus") + local fullspecificationname = resolvers.findfile(specificationname,"tex") or "" + if fullspecificationname == "" then + specificationname = file.join(texsourcepath,"context.lus") + fullspecificationname = resolvers.findfile(specificationname,"tex") or "" + end + if fullspecificationname == "" then + report_format("unknown stub specification: %s",specificationname) + lfs.chdir(olddir) + return + end + local specificationpath = file.dirname(fullspecificationname) + -- load specification + local usedluastub = nil + local usedlualibs = dofile(fullspecificationname) + if type(usedlualibs) == "string" then + usedluastub = file.join(file.dirname(fullspecificationname),usedlualibs) + elseif type(usedlualibs) == "table" then + report_format("using stub specification: %s",fullspecificationname) + local texbasename = file.basename(name) + local luastubname = file.addsuffix(texbasename,"lua") + local lucstubname = file.addsuffix(texbasename,"luc") + -- pack libraries in stub + report_format("creating initialization file: %s",luastubname) + utilities.merger.selfcreate(usedlualibs,specificationpath,luastubname) + -- compile stub file (does not save that much as we don't use this stub at startup any more) + local strip = resolvers.booleanvariable("LUACSTRIP", true) + if utilities.lua.compile(luastubname,lucstubname) and lfs.isfile(lucstubname) then + report_format("using compiled initialization file: %s",lucstubname) + usedluastub = lucstubname + else + report_format("using uncompiled initialization file: %s",luastubname) + usedluastub = luastubname + end + else + report_format("invalid stub specification: %s",fullspecificationname) + lfs.chdir(olddir) + return + end + -- generate format + local command = format("luatex --ini %s --lua=%s %s %sdump",primaryflags(),quoted(usedluastub),quoted(fulltexsourcename),os.platform == "unix" and "\\\\" or "\\") + report_format("running command: %s\n",command) + os.spawn(command) + -- remove related mem files + local pattern = file.removesuffix(file.basename(usedluastub)).."-*.mem" + -- report_format("removing related mplib format with pattern '%s'", pattern) + local mp = dir.glob(pattern) + if mp then + for i=1,#mp do + local name = mp[i] + report_format("removing related mplib format %s", file.basename(name)) + os.remove(name) + end + end + lfs.chdir(olddir) +end + +function environment.run_format(name,data,more) + -- hm, rather old code here; we can now use the file.whatever functions + if name and name ~= "" then + local barename = file.removesuffix(name) + local fmtname = caches.getfirstreadablefile(file.addsuffix(barename,"fmt"),"formats") + if fmtname == "" then + fmtname = resolvers.findfile(file.addsuffix(barename,"fmt")) or "" + end + fmtname = resolvers.cleanpath(fmtname) + if fmtname == "" then + report_format("no format with name: %s",name) + else + local barename = file.removesuffix(name) -- expanded name + local luaname = file.addsuffix(barename,"luc") + if not lfs.isfile(luaname) then + luaname = file.addsuffix(barename,"lua") + end + if not lfs.isfile(luaname) then + report_format("using format name: %s",fmtname) + report_format("no luc/lua with name: %s",barename) + else + local command = format("luatex %s --fmt=%s --lua=%s %s %s",primaryflags(),quoted(barename),quoted(luaname),quoted(data),more ~= "" and quoted(more) or "") + report_format("running command: %s",command) + os.spawn(command) + end + end + end +end end -- of closure -- end library merge -own = { } -- not local +own = { } -- not local, might change + +own.libs = { -- order can be made better -own.libs = { -- todo: check which ones are really needed 'l-string.lua', 'l-lpeg.lua', 'l-table.lua', @@ -11898,39 +14143,55 @@ own.libs = { -- todo: check which ones are really needed 'l-url.lua', 'l-dir.lua', 'l-boolean.lua', + 'l-unicode.lua', 'l-math.lua', --- 'l-unicode.lua', --- 'l-tex.lua', - 'l-utils.lua', - 'l-aux.lua', --- 'l-xml.lua', - 'trac-tra.lua', + + 'util-tab.lua', + 'util-sto.lua', + 'util-mrg.lua', + 'util-lua.lua', + 'util-prs.lua', + 'util-fmt.lua', + 'util-deb.lua', + + 'trac-inf.lua', + 'trac-set.lua', + 'trac-log.lua', + 'trac-pro.lua', + + 'luat-env.lua', -- can come before inf (as in mkiv) + 'lxml-tab.lua', 'lxml-lpt.lua', --- 'lxml-ent.lua', + -- 'lxml-ent.lua', 'lxml-mis.lua', 'lxml-aux.lua', 'lxml-xml.lua', - 'luat-env.lua', - 'trac-inf.lua', - 'trac-log.lua', - 'data-res.lua', + + 'data-ini.lua', + 'data-exp.lua', + 'data-env.lua', 'data-tmp.lua', + 'data-met.lua', + 'data-res.lua', 'data-pre.lua', 'data-inp.lua', 'data-out.lua', + 'data-fil.lua', 'data-con.lua', 'data-use.lua', -- 'data-tex.lua', -- 'data-bin.lua', 'data-zip.lua', + 'data-tre.lua', 'data-crl.lua', 'data-lua.lua', - 'data-kps.lua', -- so that we can replace kpsewhich 'data-aux.lua', -- updater - 'data-tmf.lua', -- tree files - -- needed ? - 'luat-sta.lua', -- states + 'data-tmf.lua', + 'data-lst.lua', + + 'luat-sta.lua', + 'luat-fmt.lua', } -- We need this hack till luatex is fixed. @@ -11943,35 +14204,62 @@ end -- End of hack. -own.name = (environment and environment.ownname) or arg[0] or 'luatools.lua' +local format, gsub, gmatch, match = string.format, string.gsub, string.gmatch, string.match +local concat = table.concat + +own.name = (environment and environment.ownname) or arg[0] or 'mtxrun.lua' +own.path = gsub(match(own.name,"^(.+)[\\/].-$") or ".","\\","/") + +local ownpath, owntree = own.path, environment and environment.ownpath or own.path + +own.list = { + '.', + ownpath , + ownpath .. "/../sources", -- HH's development path + owntree .. "/../../texmf-local/tex/context/base", + owntree .. "/../../texmf-context/tex/context/base", + owntree .. "/../../texmf-dist/tex/context/base", + owntree .. "/../../texmf/tex/context/base", + owntree .. "/../../../texmf-local/tex/context/base", + owntree .. "/../../../texmf-context/tex/context/base", + owntree .. "/../../../texmf-dist/tex/context/base", + owntree .. "/../../../texmf/tex/context/base", +} +if own.path == "." then table.remove(own.list,1) end -own.path = string.match(own.name,"^(.+)[\\/].-$") or "." -own.list = { '.' } -if own.path ~= '.' then - table.insert(own.list,own.path) +local function locate_libs() + for l=1,#own.libs do + local lib = own.libs[l] + for p =1,#own.list do + local pth = own.list[p] + local filename = pth .. "/" .. lib + local found = lfs.isfile(filename) + if found then + package.path = package.path .. ";" .. pth .. "/?.lua" -- in case l-* does a require + return pth + end + end + end end -table.insert(own.list,own.path.."/../../texmf-dist/tex/context/base") -table.insert(own.list,own.path.."/../../../tex/context/base") -table.insert(own.list,own.path.."/mtx") -table.insert(own.list,own.path.."/../sources") -local function locate_libs() - for _, lib in pairs(own.libs) do - for _, pth in pairs(own.list) do - local filename = string.gsub(pth .. "/" .. lib,"\\","/") +local function load_libs() + local found = locate_libs() + if found then + for l=1,#own.libs do + local filename = found .. "/" .. own.libs[l] local codeblob = loadfile(filename) if codeblob then codeblob() - own.list = { pth } -- speed up te search - break end end + else + resolvers = nil end end if not resolvers then - locate_libs() + load_libs() end if not resolvers then @@ -11983,20 +14271,56 @@ if not resolvers then os.exit() end -logs.setprogram('MTXrun',"TDS Runner Tool 1.24",environment.arguments["verbose"] or false) +-- verbosity -local instance = resolvers.reset() +local e_verbose = environment.arguments["verbose"] + +if e_verbose then + trackers.enable("resolvers.locating") +end + +-- some common flags (also passed through environment) + +local e_silent = environment.argument("silent") +local e_noconsole = environment.argument("noconsole") + +local e_trackers = environment.argument("trackers") +local e_directives = environment.argument("directives") +local e_experiments = environment.argument("experiments") + +if e_silent == true then + e_silent = "*" +end -local trackspec = environment.argument("trackers") or environment.argument("track") +if type(e_silent) == "string" then + if type(e_directives) == "string" then + e_directives = format("%s,logs.blocked={%s}",e_directives,e_silent) + else + e_directives = format("logs.blocked={%s}",e_silent) + end +end -if trackspec then - trackers.enable(trackspec) +if e_noconsole then + if type(e_directives) == "string" then + e_directives = format("%s,logs.target=file",e_directives) + else + e_directives = format("logs.target=file") + end end -runners = runners or { } -- global -messages = messages or { } +if e_trackers then trackers .enable(e_trackers) end +if e_directives then directives .enable(e_directives) end +if e_experiments then experiments.enable(e_experiments) end + +if not environment.trackers then environment.trackers = e_trackers end +if not environment.directives then environment.directives = e_directives end +if not environment.experiments then environment.experiments = e_experiments end + +-- + +local instance = resolvers.reset() -messages.help = [[ +local helpinfo = [[ --script run an mtx script (lua prefered method) (--noquotes), no script gives list --execute run a script or program (texmfstart method) (--noquotes) --resolve resolve prefixed arguments @@ -12011,15 +14335,14 @@ messages.help = [[ --ifchanged=filename only execute when given file has changed (md checksum) --iftouched=old,new only execute when given file has changed (time stamp) ---make create stubs for (context related) scripts ---remove remove stubs (context related) scripts +--makestubs create stubs for (context related) scripts +--removestubs remove stubs (context related) scripts --stubpath=binpath paths where stubs wil be written --windows create windows (mswin) stubs --unix create unix (linux) stubs --verbose give a bit more info --trackers=list enable given trackers ---engine=str target engine --progname=str format or backend --edit launch editor with found file @@ -12032,8 +14355,35 @@ messages.help = [[ --forcekpse force using kpse (handy when no mkiv and cache installed but less functionality) --prefixes show supported prefixes + +--generate generate file database + +--variables show configuration variables +--configurations show configuration order + +--expand-braces expand complex variable +--expand-path expand variable (resolve paths) +--expand-var expand variable (resolve references) +--show-path show path expansion of ... +--var-value report value of variable +--find-file report file location +--find-path report path of file + +--pattern=str filter variables ]] +local application = logs.application { + name = "mtxrun", + banner = "ConTeXt TDS Runner Tool 1.30", + helpinfo = helpinfo, +} + +local report = application.report + +messages = messages or { } -- for the moment + +runners = runners or { } -- global (might become local) + runners.applications = { ["lua"] = "luatex --luaonly", ["luc"] = "luatex --luaonly", @@ -12056,7 +14406,7 @@ runners.registered = { makempy = { 'makempy.pl', true }, mptopdf = { 'mptopdf.pl', true }, pstopdf = { 'pstopdf.rb', true }, -- converts ps (and some more) images, does some cleaning (replaced) --- examplex = { 'examplex.rb', false }, + -- examplex = { 'examplex.rb', false }, concheck = { 'concheck.rb', false }, runtools = { 'runtools.rb', true }, textools = { 'textools.rb', true }, @@ -12065,9 +14415,9 @@ runners.registered = { rlxtools = { 'rlxtools.rb', true }, pdftools = { 'pdftools.rb', true }, mpstools = { 'mpstools.rb', true }, --- exatools = { 'exatools.rb', true }, + -- exatools = { 'exatools.rb', true }, xmltools = { 'xmltools.rb', true }, --- luatools = { 'luatools.lua', true }, + -- luatools = { 'luatools.lua', true }, mtxtools = { 'mtxtools.rb', true }, pdftrimwhite = { 'pdftrimwhite.pl', false } } @@ -12086,45 +14436,39 @@ end function runners.prepare() local checkname = environment.argument("ifchanged") - if checkname and checkname ~= "" then + if type(checkname) == "string" and checkname ~= "" then local oldchecksum = file.loadchecksum(checkname) local newchecksum = file.checksum(checkname) if oldchecksum == newchecksum then - logs.simple("file '%s' is unchanged",checkname) + if e_verbose then + report("file '%s' is unchanged",checkname) + end return "skip" - else - logs.simple("file '%s' is changed, processing started",checkname) + elseif e_verbose then + report("file '%s' is changed, processing started",checkname) end file.savechecksum(checkname) end - local oldname, newname = string.split(environment.argument("iftouched") or "", ",") - if oldname and newname and oldname ~= "" and newname ~= "" then - if not file.needs_updating(oldname,newname) then - logs.simple("file '%s' and '%s' have same age",oldname,newname) - return "skip" - else - logs.simple("file '%s' is older than '%s'",oldname,newname) - end - end - local tree = environment.argument('tree') or "" - if environment.argument('autotree') then - tree = os.getenv('TEXMFSTART_TREE') or os.getenv('TEXMFSTARTTREE') or tree - end - if tree and tree ~= "" then - resolvers.load_tree(tree) - end - local env = environment.argument('environment') or "" - if env and env ~= "" then - for _,e in pairs(string.split(env)) do - -- maybe force suffix when not given - resolvers.load_tree(e) + local touchname = environment.argument("iftouched") + if type(touchname) == "string" and touchname ~= "" then + local oldname, newname = string.split(touchname, ",") + if oldname and newname and oldname ~= "" and newname ~= "" then + if not file.needs_updating(oldname,newname) then + if e_verbose then + report("file '%s' and '%s' have same age",oldname,newname) + end + return "skip" + elseif e_verbose then + report("file '%s' is older than '%s'",oldname,newname) + end end end local runpath = environment.argument("path") - if runpath and not lfs.chdir(runpath) then - logs.simple("unable to change to path '%s'",runpath) + if type(runpath) == "string" and not lfs.chdir(runpath) then + report("unable to change to path '%s'",runpath) return "error" end + runners.prepare = function() end return "run" end @@ -12137,8 +14481,6 @@ function runners.execute_script(fullname,internal,nosplit) elseif state == 'skip' then return true elseif state == "run" then - instance.progname = environment.argument("progname") or instance.progname - instance.format = environment.argument("format") or instance.format local path, name, suffix, result = file.dirname(fullname), file.basename(fullname), file.extname(fullname), "" if path ~= "" then result = fullname @@ -12155,21 +14497,21 @@ function runners.execute_script(fullname,internal,nosplit) if suffix == "" then -- loop over known suffixes for _,s in pairs(runners.suffixes) do - result = resolvers.find_file(name .. "." .. s, 'texmfscripts') + result = resolvers.findfile(name .. "." .. s, 'texmfscripts') if result ~= "" then break end end elseif runners.applications[suffix] then - result = resolvers.find_file(name, 'texmfscripts') + result = resolvers.findfile(name, 'texmfscripts') else -- maybe look on path - result = resolvers.find_file(name, 'other text files') + result = resolvers.findfile(name, 'other text files') end end if result and result ~= "" then if not no_split then - local before, after = environment.split_arguments(fullname) -- already done + local before, after = environment.splitarguments(fullname) -- already done environment.arguments_before, environment.arguments_after = before, after end if internal then @@ -12181,12 +14523,12 @@ function runners.execute_script(fullname,internal,nosplit) if binary and binary ~= "" then result = binary .. " " .. result end - local command = result .. " " .. environment.reconstruct_commandline(environment.arguments_after,noquote) - if logs.verbose then - logs.simpleline() - logs.simple("executing: %s",command) - logs.simpleline() - logs.simpleline() + local command = result .. " " .. environment.reconstructcommandline(environment.arguments_after,noquote) + if e_verbose then + report() + report("executing: %s",command) + report() + report() io.flush() end -- no os.exec because otherwise we get the wrong return value @@ -12196,14 +14538,14 @@ function runners.execute_script(fullname,internal,nosplit) else if binary then binary = file.addsuffix(binary,os.binsuffix) - for p in string.gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do + for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do if lfs.isfile(file.join(p,binary)) then return false end end - logs.simpleline() - logs.simple("This script needs '%s' which seems not to be installed.",binary) - logs.simpleline() + report() + report("This script needs '%s' which seems not to be installed.",binary) + report() end return false end @@ -12223,14 +14565,15 @@ function runners.execute_program(fullname) elseif state == 'skip' then return true elseif state == "run" then - local before, after = environment.split_arguments(fullname) - environment.initialize_arguments(after) + local before, after = environment.splitarguments(fullname) + for k=1,#after do after[k] = resolvers.resolve(after[k]) end + environment.initializearguments(after) fullname = fullname:gsub("^bin:","") - local command = fullname .. " " .. (environment.reconstruct_commandline(after or "",noquote) or "") - logs.simpleline() - logs.simple("executing: %s",command) - logs.simpleline() - logs.simpleline() + local command = fullname .. " " .. (environment.reconstructcommandline(after or "",noquote) or "") + report() + report("executing: %s",command) + report() + report() io.flush() local code = os.exec(command) -- (fullname,unpack(after)) does not work / maybe spawn return code == 0 @@ -12239,7 +14582,7 @@ function runners.execute_program(fullname) return false end --- the --usekpse flag will fallback on kpse (hm, we can better update mtx-stubs) +-- the --usekpse flag will fallback (not default) on kpse (hm, we can better update mtx-stubs) local windows_stub = '@echo off\013\010setlocal\013\010set ownpath=%%~dp0%%\013\010texlua "%%ownpath%%mtxrun.lua" --usekpse --execute %s %%*\013\010endlocal\013\010' local unix_stub = '#!/bin/sh\010mtxrun --usekpse --execute %s \"$@\"\010' @@ -12258,22 +14601,22 @@ function runners.handle_stubs(create) for _,v in pairs(runners.registered) do local name, doit = v[1], v[2] if doit then - local base = string.gsub(file.basename(name), "%.(.-)$", "") + local base = gsub(file.basename(name), "%.(.-)$", "") if create then if windows then - io.savedata(file.join(stubpath,base..".bat"),string.format(windows_stub,name)) - logs.simple("windows stub for '%s' created",base) + io.savedata(file.join(stubpath,base..".bat"),format(windows_stub,name)) + report("windows stub for '%s' created",base) end if unix then - io.savedata(file.join(stubpath,base),string.format(unix_stub,name)) - logs.simple("unix stub for '%s' created",base) + io.savedata(file.join(stubpath,base),format(unix_stub,name)) + report("unix stub for '%s' created",base) end else if windows and (os.remove(file.join(stubpath,base..'.bat')) or os.remove(file.join(stubpath,base..'.cmd'))) then - logs.simple("windows stub for '%s' removed", base) + report("windows stub for '%s' removed", base) end if unix and (os.remove(file.join(stubpath,base)) or os.remove(file.join(stubpath,base..'.sh'))) then - logs.simple("unix stub for '%s' removed",base) + report("unix stub for '%s' removed",base) end end end @@ -12289,7 +14632,7 @@ end function runners.locate_file(filename) -- differs from texmfstart where locate appends .com .exe .bat ... todo if filename and filename ~= "" then - runners.report_location(resolvers.find_given_file(filename)) + runners.report_location(resolvers.findgivenfile(filename)) end end @@ -12298,28 +14641,28 @@ function runners.locate_platform() end function runners.report_location(result) - if logs.verbose then - logs.simpleline() + if e_verbose then + reportline() if result and result ~= "" then - logs.simple(result) + report(result) else - logs.simple("not found") + report("not found") end else io.write(result) end end -function runners.edit_script(filename) -- we assume that vim is present on most systems - local editor = os.getenv("MTXRUN_EDITOR") or os.getenv("TEXMFSTART_EDITOR") or os.getenv("EDITOR") or 'vim' +function runners.edit_script(filename) -- we assume that gvim is present on most systems (todo: also in cnf file) + local editor = os.getenv("MTXRUN_EDITOR") or os.getenv("TEXMFSTART_EDITOR") or os.getenv("EDITOR") or 'gvim' local rest = resolvers.resolve(filename) if rest ~= "" then local command = editor .. " " .. rest - if logs.verbose then - logs.simpleline() - logs.simple("starting editor: %s",command) - logs.simple_line() - logs.simple_line() + if e_verbose then + report() + report("starting editor: %s",command) + report() + report() end os.launch(command) end @@ -12362,33 +14705,33 @@ end function runners.launch_file(filename) instance.allresults = true - logs.setverbose(true) + trackers.enable("resolvers.locating") local pattern = environment.arguments["pattern"] if not pattern or pattern == "" then pattern = filename end if not pattern or pattern == "" then - logs.simple("provide name or --pattern=") + report("provide name or --pattern=") else - local t = resolvers.find_files(pattern) + local t = resolvers.findfiles(pattern) if not t or #t == 0 then - t = resolvers.find_files("*/" .. pattern) + t = resolvers.findfiles("*/" .. pattern) end if not t or #t == 0 then - t = resolvers.find_files("*/" .. pattern .. "*") + t = resolvers.findfiles("*/" .. pattern .. "*") end if t and #t > 0 then if environment.arguments["all"] then for _, v in pairs(t) do - logs.simple("launching %s", v) + report("launching %s", v) resolvers.launch(v) end else - logs.simple("launching %s", t[1]) + report("launching %s", t[1]) resolvers.launch(t[1]) end else - logs.simple("no match for %s", pattern) + report("no match for %s", pattern) end end end @@ -12421,33 +14764,45 @@ function runners.find_mtx_script(filename) local mtxprefix = (filename:find("^mtx%-") and "") or "mtx-" -- context namespace, mtx- fullname = mtxprefix .. filename - fullname = found(fullname) or resolvers.find_file(fullname) + fullname = found(fullname) or resolvers.findfile(fullname) if fullname and fullname ~= "" then return fullname end -- context namespace, mtx-s fullname = mtxprefix .. basename .. "s" .. "." .. suffix - fullname = found(fullname) or resolvers.find_file(fullname) + fullname = found(fullname) or resolvers.findfile(fullname) if fullname and fullname ~= "" then return fullname end -- context namespace, mtx- fullname = mtxprefix .. basename:gsub("s$","") .. "." .. suffix - fullname = found(fullname) or resolvers.find_file(fullname) + fullname = found(fullname) or resolvers.findfile(fullname) if fullname and fullname ~= "" then return fullname end -- context namespace, just - fullname = resolvers.find_file(filename) + fullname = resolvers.findfile(filename) return fullname end -function runners.execute_ctx_script(filename) +function runners.register_arguments(...) + local arguments = environment.arguments_after + local passedon = { ... } + for i=#passedon,1,-1 do + local pi = passedon[i] + if pi then + table.insert(arguments,1,pi) + end + end +end + +function runners.execute_ctx_script(filename,...) + runners.register_arguments(...) local arguments = environment.arguments_after local fullname = runners.find_mtx_script(filename) or "" if file.extname(fullname) == "cld" then -- handy in editors where we force --autopdf - logs.simple("running cld script: %s",filename) + report("running cld script: %s",filename) table.insert(arguments,1,fullname) table.insert(arguments,"--autopdf") fullname = runners.find_mtx_script("context") or "" @@ -12455,7 +14810,7 @@ function runners.execute_ctx_script(filename) -- retry after generate but only if --autogenerate if fullname == "" and environment.argument("autogenerate") then -- might become the default instance.renewcache = true - logs.setverbose(true) + trackers.enable("resolvers.locating") resolvers.load() -- fullname = runners.find_mtx_script(filename) or "" @@ -12470,7 +14825,7 @@ function runners.execute_ctx_script(filename) elseif state == "run" then -- load and save ... kind of undocumented arg = { } for _,v in pairs(arguments) do arg[#arg+1] = resolvers.resolve(v) end - environment.initialize_arguments(arg) + environment.initializearguments(arg) local loadname = environment.arguments['load'] if loadname then if type(loadname) ~= "string" then loadname = file.basename(fullname) end @@ -12478,8 +14833,8 @@ function runners.execute_ctx_script(filename) runners.load_script_session(loadname) end filename = environment.files[1] - if logs.verbose then - logs.simple("using script: %s\n",fullname) + if e_verbose then + report("using script: %s\n",fullname) end environment.ownscript = fullname dofile(fullname) @@ -12495,44 +14850,42 @@ function runners.execute_ctx_script(filename) return true end else - -- logs.setverbose(true) if filename == "" or filename == "help" then - local context = resolvers.find_file("mtx-context.lua") - logs.setverbose(true) + local context = resolvers.findfile("mtx-context.lua") + trackers.enable("resolvers.locating") if context ~= "" then - local result = dir.glob((string.gsub(context,"mtx%-context","mtx-*"))) -- () needed + local result = dir.glob((gsub(context,"mtx%-context","mtx-*"))) -- () needed local valid = { } table.sort(result) for i=1,#result do local scriptname = result[i] - local scriptbase = string.match(scriptname,".*mtx%-([^%-]-)%.lua") + local scriptbase = match(scriptname,".*mtx%-([^%-]-)%.lua") if scriptbase then local data = io.loaddata(scriptname) - local banner, version = string.match(data,"[\n\r]logs%.extendbanner%s*%(%s*[\"\']([^\n\r]+)%s*(%d+%.%d+)") + local banner, version = match(data,"[\n\r]logs%.extendbanner%s*%(%s*[\"\']([^\n\r]+)%s*(%d+%.%d+)") if banner then valid[#valid+1] = { scriptbase, version, banner } end end end if #valid > 0 then - logs.reportbanner() - logs.reportline() - logs.simple("no script name given, known scripts:") - logs.simple() + application.identify() + report("no script name given, known scripts:") + report() for k=1,#valid do local v = valid[k] - logs.simple("%-12s %4s %s",v[1],v[2],v[3]) + report("%-12s %4s %s",v[1],v[2],v[3]) end end else - logs.simple("no script name given") + report("no script name given") end else filename = file.addsuffix(filename,"lua") if file.is_qualified_path(filename) then - logs.simple("unknown script '%s'",filename) + report("unknown script '%s'",filename) else - logs.simple("unknown script '%s' or 'mtx-%s'",filename,filename) + report("unknown script '%s' or 'mtx-%s'",filename,filename) end end return false @@ -12540,9 +14893,9 @@ function runners.execute_ctx_script(filename) end function runners.prefixes() - logs.reportbanner() - logs.reportline() - logs.simple(table.concat(resolvers.allprefixes(true)," ")) + application.identify() + report() + report(concat(resolvers.allprefixes(true)," ")) end function runners.timedrun(filename) -- just for me @@ -12562,13 +14915,11 @@ end local filename = environment.files[1] or "" local ok = true -local before, after = environment.split_arguments(filename) +local before, after = environment.splitarguments(filename) environment.arguments_before, environment.arguments_after = before, after -environment.initialize_arguments(before) +environment.initializearguments(before) -instance.engine = environment.argument("engine") or 'luatex' -instance.progname = environment.argument("progname") or 'context' -instance.lsrmode = environment.argument("lsr") or false +instance.lsrmode = environment.argument("lsr") or false -- maybe the unset has to go to this level @@ -12576,36 +14927,40 @@ local is_mkii_stub = runners.registered[file.removesuffix(file.basename(filename if environment.argument("usekpse") or environment.argument("forcekpse") or is_mkii_stub then + resolvers.load_tree(environment.argument('tree'),true) -- force resolve of TEXMFCNF + os.setenv("engine","") os.setenv("progname","") local remapper = { - otf = "opentype fonts", - ttf = "truetype fonts", - ttc = "truetype fonts", - pfb = "type1 fonts", + otf = "opentype fonts", + ttf = "truetype fonts", + ttc = "truetype fonts", + pfb = "type1 fonts", other = "other text files", } + local progname = environment.argument("progname") or 'context' + local function kpse_initialized() texconfig.kpse_init = true local t = os.clock() - local k = kpse.original.new("luatex",instance.progname) + local k = kpse.original.new("luatex",progname) local dummy = k:find_file("mtxrun.lua") -- so that we're initialized - logs.simple("kpse fallback with progname '%s' initialized in %s seconds",instance.progname,os.clock()-t) + report("kpse fallback with progname '%s' initialized in %s seconds",progname,os.clock()-t) kpse_initialized = function() return k end return k end - local find_file = resolvers.find_file - local show_path = resolvers.show_path + local findfile = resolvers.findfile + local showpath = resolvers.showpath if environment.argument("forcekpse") then - function resolvers.find_file(name,kind) - return (kpse_initialized():find_file(resolvers.clean_path(name),(kind ~= "" and (remapper[kind] or kind)) or "tex") or "") or "" + function resolvers.findfile(name,kind) + return (kpse_initialized():find_file(resolvers.cleanpath(name),(kind ~= "" and (remapper[kind] or kind)) or "tex") or "") or "" end - function resolvers.show_path(name) + function resolvers.showpath(name) return (kpse_initialized():show_path(name)) or "" end @@ -12613,16 +14968,16 @@ if environment.argument("usekpse") or environment.argument("forcekpse") or is_mk resolvers.load() - function resolvers.find_file(name,kind) - local found = find_file(name,kind) or "" + function resolvers.findfile(name,kind) + local found = findfile(name,kind) or "" if found ~= "" then return found else - return (kpse_initialized():find_file(resolvers.clean_path(name),(kind ~= "" and (remapper[kind] or kind)) or "tex") or "") or "" + return (kpse_initialized():find_file(resolvers.cleanpath(name),(kind ~= "" and (remapper[kind] or kind)) or "tex") or "") or "" end end - function resolvers.show_path(name) - local found = show_path(name) or "" + function resolvers.showpath(name) + local found = showpath(name) or "" if found ~= "" then return found else @@ -12632,80 +14987,317 @@ if environment.argument("usekpse") or environment.argument("forcekpse") or is_mk end + function runners.loadbase() + end + else - resolvers.load() + function runners.loadbase(...) + if not resolvers.load(...) then + report("forcing cache reload") + instance.renewcache = true + trackers.enable("resolvers.locating") + if not resolvers.load(...) then + report("the resolver databases are not present or outdated") + end + end + end + + resolvers.load_tree(environment.argument('tree')) end + if environment.argument("selfmerge") then + -- embed used libraries - utils.merger.selfmerge(own.name,own.libs,own.list) + + runners.loadbase() + local found = locate_libs() + if found then + utilities.merger.selfmerge(own.name,own.libs,{ found }) + end + elseif environment.argument("selfclean") then + -- remove embedded libraries - utils.merger.selfclean(own.name) + + runners.loadbase() + utilities.merger.selfclean(own.name) + elseif environment.argument("selfupdate") then - logs.setverbose(true) - resolvers.update_script(own.name,"mtxrun") + + runners.loadbase() + trackers.enable("resolvers.locating") + resolvers.updatescript(own.name,"mtxrun") + elseif environment.argument("ctxlua") or environment.argument("internal") then + -- run a script by loading it (using libs) + + runners.loadbase() ok = runners.execute_script(filename,true) + elseif environment.argument("script") or environment.argument("scripts") then + -- run a script by loading it (using libs), pass args + + runners.loadbase() if is_mkii_stub then - -- execute mkii script ok = runners.execute_script(filename,false,true) else ok = runners.execute_ctx_script(filename) end + elseif environment.argument("execute") then + -- execute script + + runners.loadbase() ok = runners.execute_script(filename) + elseif environment.argument("direct") then + -- equals bin: + + runners.loadbase() ok = runners.execute_program(filename) + elseif environment.argument("edit") then + -- edit file + + runners.loadbase() runners.edit_script(filename) + elseif environment.argument("launch") then + + runners.loadbase() runners.launch_file(filename) -elseif environment.argument("make") then - -- make stubs + +elseif environment.argument("makestubs") then + + -- make stubs (depricated) + runners.handle_stubs(true) -elseif environment.argument("remove") then - -- remove stub + +elseif environment.argument("removestubs") then + + -- remove stub (depricated) + + runners.loadbase() runners.handle_stubs(false) + elseif environment.argument("resolve") then + -- resolve string + + runners.loadbase() runners.resolve_string(filename) + elseif environment.argument("locate") then + -- locate file + + runners.loadbase() runners.locate_file(filename) -elseif environment.argument("platform")then + +elseif environment.argument("platform") or environment.argument("show-platform") then + -- locate platform + + runners.loadbase() runners.locate_platform() + elseif environment.argument("prefixes") then + + runners.loadbase() runners.prefixes() + elseif environment.argument("timedrun") then + -- locate platform + + runners.loadbase() runners.timedrun(filename) + +elseif environment.argument("variables") or environment.argument("show-variables") or environment.argument("expansions") or environment.argument("show-expansions") then + + -- luatools: runners.execute_ctx_script("mtx-base","--expansions",filename) + + resolvers.load("nofiles") + resolvers.listers.variables(environment.argument("pattern")) + +elseif environment.argument("configurations") or environment.argument("show-configurations") then + + -- luatools: runners.execute_ctx_script("mtx-base","--configurations",filename) + + resolvers.load("nofiles") + resolvers.listers.configurations() + +elseif environment.argument("find-file") then + + -- luatools: runners.execute_ctx_script("mtx-base","--find-file",filename) + + resolvers.load() + local e_pattern = environment.argument("pattern") + local e_format = environment.arguments("format") + if not e_pattern then + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.findfiles,environment.files,e_format) + elseif type(e_pattern) == "string" then + instance.allresults = true -- brrrr + resolvers.dowithfilesandreport(resolvers.findfiles,{ e_pattern }, e_format) + end + +elseif environment.argument("find-path") then + + -- luatools: runners.execute_ctx_script("mtx-base","--find-path",filename) + + resolvers.load() + local path = resolvers.findpath(filename, instance.my_format) + if e_verbose then + report(path) + else + print(path) + end + +elseif environment.argument("expand-braces") then + + -- luatools: runners.execute_ctx_script("mtx-base","--expand-braces",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.expandbraces, environment.files) + +elseif environment.argument("expand-path") then + + -- luatools: runners.execute_ctx_script("mtx-base","--expand-path",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.expandpath, environment.files) + +elseif environment.argument("expand-var") or environment.argument("expand-variable") then + + -- luatools: runners.execute_ctx_script("mtx-base","--expand-var",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.expansion, environment.files) + +elseif environment.argument("show-path") or environment.argument("path-value") then + + -- luatools: runners.execute_ctx_script("mtx-base","--show-path",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.showpath, environment.files) + +elseif environment.argument("var-value") or environment.argument("show-value") then + + -- luatools: runners.execute_ctx_script("mtx-base","--show-value",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.variable,environment.files) + +elseif environment.argument("format-path") then + + -- luatools: runners.execute_ctx_script("mtx-base","--format-path",filename) + + resolvers.load() + report(caches.getwritablepath("format")) + +elseif environment.argument("pattern") then + + -- luatools + + runners.execute_ctx_script("mtx-base","--pattern='" .. environment.argument("pattern") .. "'",filename) + +elseif environment.argument("generate") then + + -- luatools + + instance.renewcache = true + trackers.enable("resolvers.locating") + resolvers.load() + +elseif environment.argument("make") or environment.argument("ini") or environment.argument("compile") then + + -- luatools: runners.execute_ctx_script("mtx-base","--make",filename) + + resolvers.load() + trackers.enable("resolvers.locating") + environment.make_format(filename) + +elseif environment.argument("run") then + + -- luatools + + runners.execute_ctx_script("mtx-base","--run",filename) + +elseif environment.argument("fmt") then + + -- luatools + + runners.execute_ctx_script("mtx-base","--fmt",filename) + +elseif environment.argument("help") and filename=='base' then + + -- luatools + + runners.execute_ctx_script("mtx-base","--help") + elseif environment.argument("help") or filename=='help' or filename == "" then - logs.help(messages.help) - -- execute script + + application.help() + elseif filename:find("^bin:") then + + runners.loadbase() ok = runners.execute_program(filename) + elseif is_mkii_stub then + -- execute mkii script + + runners.loadbase() ok = runners.execute_script(filename,false,true) -else + +elseif false then + + runners.loadbase() ok = runners.execute_ctx_script(filename) if not ok then ok = runners.execute_script(filename) end + +elseif environment.files[1] == 'texmfcnf.lua' then -- so that we don't need to load mtx-base + + resolvers.load("nofiles") + resolvers.listers.configurations() + +else + + runners.loadbase() + runners.execute_ctx_script("mtx-base",filename) + +end + +if e_verbose then + report() + report("runtime: %0.3f seconds",os.runtime()) end -if os.platform == "unix" then - io.write("\n") +if os.type ~= "windows" then + texio.write("\n") -- is this still valid? end if ok == false then ok = 1 elseif ok == true then ok = 0 end diff --git a/Master/bin/win32/pstopdf.exe b/Master/bin/win32/pstopdf.exe new file mode 100755 index 00000000000..2d45f27494d Binary files /dev/null and b/Master/bin/win32/pstopdf.exe differ diff --git a/Master/texmf-dist/colors/icc/context/colorprofiles.lua b/Master/texmf-dist/colors/icc/context/colorprofiles.lua new file mode 100644 index 00000000000..b2ae731a78c --- /dev/null +++ b/Master/texmf-dist/colors/icc/context/colorprofiles.lua @@ -0,0 +1,14 @@ +-- This is just an example. We support both an xml format as well +-- as lua tables. + +return { + { + filename = "CoatedFOGRA39.icc", + id = "FOGRA39", + info = "Coated FOGRA39 (ISO 12647-2:2004)", + checksum = "74ff62f330bf0dbe4495b5720542d511", + url = "http://www.color.org", + outputcondition = "", + version = "21000000", + } +} diff --git a/Master/texmf-dist/colors/icc/context/colorprofiles.xml b/Master/texmf-dist/colors/icc/context/colorprofiles.xml new file mode 100644 index 00000000000..96b8b54c590 --- /dev/null +++ b/Master/texmf-dist/colors/icc/context/colorprofiles.xml @@ -0,0 +1,427 @@ + + + + + + + + + + + + default + default_cmyk.icc + CMYK + prtr + Artifex PS CMYK Profile + de955d740998369ea1051a4e3e84eb90 + 42000000 + + + + default + default_gray.icc + GRAY + scnr + + + + default + default_rgb.icc + RGB + mntr + + + + default + lab.icc + Lab + spac + + + + default + ps_cmyk.icc + CMYK + prtr + U.S. Web Coated (SWOP) v2 + 79d7e984ea3ac74eed7cc92bf6b22a0d + 21000000 + + + + default + ps_gray.icc + GRAY + mntr + + + + default + ps_rgb.icc + RGB + mntr + + + + default + sgray.icc + GRAY + scnr + + + + default + srgb.icc + RGB + mntr + + + + + + srgb.icc + RGB + mntr + Custom + sRGB IEC61966-2.1 + 1d3fda2edb4a89ab60a23c5f7c7d81dd + 21000000 + http://www.color.org + + + + + + + Probev1_ICCv2.icc + CMYK + prtr + Custom + Probev1_ICCv2.icc + 7d8357d5cb86990465b3d7d4ef359404 + 20000000 + http://www.color.org + + + + + Probev1_ICCv4.icc + CMYK + prtr + Custom + Probev1_ICCv4.icc + 915f373c10daf2e295c0e707d3beb856 + 40000000 + http://www.color.org + + + + + Probe2_ICCv4 + CMYK + prtr + Custom + Probev2_ICCv4.icc + cd8ccdb2b8ee902100cfc45a75b84579 + 40000000 + >http://www.color.org + + + + + + + + CoatedFOGRA39.icc + CMYK + prtr + FOGRA39 + Coated FOGRA39 (ISO 12647-2:2004) + 74ff62f330bf0dbe4495b5720542d511 + 21000000 + http://www.color.org + + + + + GRACoL2006_Coated1v2.icc + CMYK + prtr + CGATS TR 006 + GRACoL2006_Coated1v2.icc + cc7a6196271b13dbae4622aa1fa0fca9 + 20000000 + http://www.color.org + + + + + ISOcoated_v2_300_eci.icc + CMYK + prtr + FOGRA39 + ISO Coated v2 300% (ECI) + e14f5db955711d914d877df35ad7a1b5 + 24000000 + http://www.color.org + Offset printing, according to ISO 12647-2:2004/Amd 1, OFCOM, paper type 1 or 2 = coated art, 115 g/m2, tone value increase curves A (CMY) and B (K) + + + + ISOcoated_v2_eci.icc + CMYK + prtr + FOGRA39 + ISO Coated v2 (ECI) + bda07efcacf5377e91edacb0454ea7e5 + 2400000 + http://www.color.org + Offset printing, according to ISO 12647-2:2004/Amd 1, OFCOM, paper type 1 or 2 = coated art, 115 g/m2, tone value increase curves A (CMY) and B (K) + + + + ISOnewspaper26v4.icc + CMYK + prtr + IFRA26 + ISOnewspaper26v4 + bca21a6afa3a4b5cef9ca8e91565c1b7 + 2400000 + http://www.color.org + Newspaper Coldset-Offset printing according to ISO/DIS 12647-3:2004, standard newsprint 45g/m2, screen ruling 40 l/cm, see readme + + + + ISOnewspaper26v4_gr.icc + CMYK + prtr + IFRA26 + ISOnewspaper26v4_gr + 45dabde250dbbc2b4ab1ddaab1380892 + 2400000 + http://www.color.org + Newspaper Coldset-Offset printing according to ISO/DIS 12647-3:2004, standard newsprint 45g/m2, screen ruling 40 l/cm, see readme + + + + ISOuncoated.icc + CMYK + prtr + FOGRA29 + ISO Uncoated + c62d711cf39488a1fc60e8be18a9d6d7 + 2000000 + http://www.color.org + Offset printing according to ISO/DIS 12647-2:2003, OFCOM, paper type 4 = white, uncoated, 120 g/m2, screen ruling 60 cm-1, positive-acting plates, see readme + + + + ISOuncoatedyellowish.icc + CMYK + prtr + FOGRA30 + ISO Uncoated Yellowish + 06db2a1b6d1eff0a49aaf350888a170e + 2400000 + http://www.color.org + Offset printing according to ISO/DIS 12647-2:2004, OFCOM, paper type 5 = slightly yellowish, uncoated, 120 g/m2, screen ruling 60 cm-1, positive-acting plates, see readme + + + + ISOwebcoated.icc + CMYK + prtr + FOGRA28 + ISO Web Coated + 0bf2ede138b0272421b629b6c8c4deaf + 2000000 + http://www.color.org + Offset printing according to ISO/DIS 12647-2:2003, OFCOM, paper type 3 = low weight coated web offset, 60 g/m2, screen ruling 60 cm-1, positive-acting plates, see readme + + + + JapanColor2001Coated.icc + CMYK + prtr + JC200103 + Japan Color 2001 Coated + 4cb167869183b59bbad20fb90ccf3e0c + 2100000 + http://www.color.org + + + + + JapanColor2002Newspaper.icc + CMYK + prtr + JCN2002 + Japan Color 2002 Newspaper + fa5be8d5b4eb756bf1399afc2cda7d1c + 2100000 + http://www.color.org + + + + + JapanWebCoated.icc + CMYK + prtr + JCW2003 + Japan Web Coated (Ad) + f8607e551233cefdda26d7d6baaa2a4f + 2100000 + http://www.color.org + + + + + SNAP-2007.icc + CMYK + prtr + CGATS TR 002 + SNAP 2007 + 8d48c9b10937672a0690b724e0527247 + 4100000 + http://www.color.org + + + + + SWOP2006_Coated3v2.icc + CMYK + prtr + CGATS TR 003 + SWOP2006_Coated3v2.icc + 7fbad4c0ae1cb7195c34bfc20e623437 + 2000000 + http://www.color.org + + + + + SWOP2006_Coated5v2.icc + CMYK + prtr + CGATS TR 005 + SWOP2006_Coated5v2.icc + 34f7c3c809b926b173ee54e13d655bee + 2000000 + http://www.color.org + + + + + UncoatedFOGRA29.icc + CMYK + prtr + FOGRA29 + Uncoated FOGRA29 (ISO 12647-2:2004) + e3d8676356f2709a7b120036b7ada996 + 2100000 + http://www.color.org + + + + + WebCoatedFOGRA28.icc + CMYK + prtr + FOGRA28 + Web Coated FOGRA28 (ISO 12647-2:2004) + 6e3b77d09d3613bc52ba7f63048d4638 + 2100000 + http://www.color.org + + + + + + + PSR_LWC_PLUS_V2_PT.icc + CMYK + prtr + Custom + PSR_LWC_PLUS_V2_PT + 2373b50219e8df70c70f2e0e798c2e38 + 2400000 + http://www.eci.org + Gravure printing according to ISO 12647-4, paper type LWC (light weight coated) plus + + + + PSR_LWC_STD_V2_PT.icc + CMYK + prtr + Custom + PSR_LWC_STD_V2_PT + 0964b3ca5390dfaf7723527bbb7cec37 + 2400000 + http://www.eci.org + Gravure printing according to ISO 12647-4, paper type LWC (light weight coated) standard + + + + PSR_SC_PLUS_V2_PT.icc + CMYK + prtr + Custom + PSR_SC_PLUS_V2_PT + aa767f70696059557917c050d3ebc6ba + 2400000 + http://www.eci.org + Gravure printing according to ISO 12647-4, paper type SC (super-calendered) plus + + + + PSR_SC_STD_V2_PT.icc + CMYK + prtr + Custom + PSR_SC_STD_V2_PT + 6d978234223b29cde94dd3a5c3624504 + 2400000 + http://www.eci.org + Gravure printing according to ISO 12647-4, paper type SC (super-calendered) standard + + + + PSRgravureMF.icc + CMYK + prtr + Custom + PSRgravureMF + 728f70371f82e930637e60c760876a3d + 2000000 + http://www.eci.org + Gravure printing according to ISO 12647-4, paper type MF (machine finished), 55 g/m2 + + + + + + diff --git a/Master/texmf-dist/context/data/scite/cont-cs-scite.properties b/Master/texmf-dist/context/data/scite/cont-cs-scite.properties index ddf42aacdd6..5c9cc3354df 100644 --- a/Master/texmf-dist/context/data/scite/cont-cs-scite.properties +++ b/Master/texmf-dist/context/data/scite/cont-cs-scite.properties @@ -1 +1 @@ -keywordclass.macros.context.cs=CAP Cap Caps MESIC Rimskecislice SLOVA SLOVO Slova Slovo VSEDNIDEN Znak Znaky aktualnicislonadpisu aktualnidatum appendix barva bilemisto bublinkovanapoveda bypassblocks cap cernalinka cernelinky chapter chem cisla cislonadpisu citace citovat completecombinedlist completelistoffloats completelistofsorts completelistofsynonyms completeregister coupledregister crlf datum definebodyfontDEF definebodyfontREF definedfont definefontfeature definefonthandling definetype definetypeface definuj definujbarvu definujblok definujbloksekce definujbuffer definujfont definujformatodkazu definujinterakcnimenu definujinterakcnimenu definujkombinovanyseznam definujkonverzi definujlogo definujnadpis definujobrazeksymbol definujodkaz definujodsazovani definujodstavce definujopis definujoramovani definujoramovanytext definujpaletu definujplvouciobjekt definujpodpole definujpole definujpopis definujpopisek definujprekryv definujpreskok definujprofil definujprogram definujprostredizakladnihofontu definujrejstrik definujsablonutabulky definujsekci definujseznam definujseznamodkazu definujskupinubarev definujstartstop definujsymbol definujsynonumumfontu definujsynonyma definujtabelaci definujtext definujtrideni definujupravu definujvelikostpapiru definujverzi definujvycet definujvystup definujzakladnifont definujzasobnikpoli definujznaceni description dodrzujprofil dodrzujverzi dodrzujverziprofilu dvoustrannypapir emptylines enumeration externiobraz footnotetext forceblocks framedtext hl hlavnijazyk indentation ininner inouter instalacejazyka interakcnilista interakcnitlacitka jazyk jdidolu jdina jdinabox klonujpole komentar konvertujcislo kopirujpole korekcebilehomista labeling listsymbol loadsorts loadsynonyms mapfontsize marginalnilinka marginalnitext matematika mediaeval meritko mesic mezera mrizka nadpis nadruhyokraj name naokraj nastavbarvu nastavbarvy nastavbilamista nastavblok nastavbloksekce nastavbuffer nastavcernelinky nastavcislonadpisu nastavcislostrany nastavcislovani nastavcislovaniodstavcu nastavcislovaniradku nastavcislovanistran nastavcitaci nastavdefinicipoznamekpodcarou nastavdeleniplvoucichobjektu nastavdelitko nastavdolnitexty nastavexterniobrazy nastavhorejsek nastavhornitexty nastavinterakci nastavinterakcnilistu nastavinterakcnimenu nastavinterakcniobrazovku nastavjazyk nastavkapitalky nastavkombinovanyseznam nastavkomentar nastavlegendu nastavmarginalie nastavmarginalniblok nastavmarginalnilinky nastavmeziradkovoumezeru nastavnadpis nastavnadpisy nastavodkazovani nastavodsazeni nastavodsazovani nastavodstavce nastavopis nastavoramovanetexty nastavoramovani nastavorez nastavotoceni nastavpaletu nastavplvouciobjekt nastavplvouciobjekty nastavpodcislostrany nastavpodtrzeni nastavpole nastavpolozky nastavpopisek nastavpopisky nastavpopisy nastavpozadi nastavpozadi nastavpoznamkypodcarou nastavprechodstrany nastavpreskok nastavprofily nastavprogramy nastavprostredizakladnihofontu nastavpublikace nastavradkovani nastavradky nastavrastr nastavrejstrik nastavrovnice nastavsadusymbolu nastavsekci nastavseznam nastavseznamodkazu nastavsirkucary nastavsloupce nastavspodek nastavspojeni nastavsynchronizaci nastavsynchronizacnilistu nastavsynonyma nastavsystem nastavtab nastavtabelaci nastavtabulky nastavtenkelinky nastavtext nastavtexthlavicky nastavtextovelinky nastavtextpopisku nastavtexttexty nastavtextyupati nastavtextyzahlavi nastavtlacitka nastavtoleranci nastavtrideni nastavtype nastavumisteniprotejsku nastavumistovani nastavupati nastavupravu nastavurl nastavusporadani nastavvelikostpapiru nastavverze nastavvsechnapole nastavvycty nastavvyplnovelinky nastavvyplnoveradky nastavvystup nastavvzhled nastavzahlavi nastavzakladnifont nastavzarovnani nastavznaceni nastavzuzeni nastrane nejakyradek nekde nextsection nivy nizky nocap nop obrazovka odkaz odkaz odkaznadatum odkaznastranu odkaznatext odsazovani okr opis opissoubor oramovani oref orez otocit overbar overbars overstrike overstrikes oznacverzi paragraph parovastrana part pis placefloat placelistoffloats placelistofsorts placelistofsynonyms placereferencelist pol pole polozka polozky popisky porovnejpaletu porovnejskupinubarev pozadi pozice poznamka poznamkapodcarou pref prelozit premistinamrizku prepninazakladnifont preskoc prizpusobivepole prizpusobvzhled program propojeneznaceni propojenydokument propojenyrejstrik publikace ran ref register reservefloat reset resettextcontent resetznaceni rimskecislice rozdelplvouciobjekt rozpojeneznaceni roztazene schovejbloky section sedabarva seeregister settextcontent setupfonthandling setupfontsynonym setupforms setupinterlinespace2 setupitemgroup setuplistalternative setuppaper setupstrut sloupec slovovpravo sort spodek stanovcharakteristickuseznamu stanovcislonadpisu startalignment startbarva startbuffer startbuffer startcitace startcolumns startcombination startdescription startdocument startenumeration startfakt startfigure startfloattext startformula startframedtext starthiding startinteraktivnimenu startitemgroup startkomentar startkomponenta startlegend startline startlinecorrection startlinenumbering startlines startlocal startlocalenvironment startlocalfootnotes startmakeup startmarginalnilinka startmarginblock startnamemakeup startnarrower startopposite startoverlay startoverview startparagraph startpositioning startpostponing startpozadi startprodukt startprofile startprojekt startprostredi startregister startsymbolset startsynchronization starttable starttables starttabulate starttextovalinka starttyping startunpacked startverze startzhustene stopalignment stopbarva stopbuffer stopbuffer stopcitace stopcolumns stopcombination stopdescription stopdocument stopenumeration stopfakt stopfigure stopfloattext stopformula stopframedtext stophiding stopinteraktivnimenu stopitemgroup stopkomentar stopkomponenta stoplegend stopline stoplinecorrection stoplinenumbering stoplines stoplocal stoplocalenvironment stoplocalfootnotes stopmakeup stopmarginalnilinka stopmarginblock stopnamemakeup stopnarrower stopopposite stopoverlay stopoverview stopparagraph stoppositioning stoppostponing stoppozadi stopprodukt stopprofile stopprojekt stopprostredi stopsymbolset stopsynchronization stoptable stoptables stoptabulate stoptextovalinka stoptyping stopunpacked stopverze stopzhustene strana sub subject subsection subsubject subsubsection subsubsubject sym symbol synchronizacnilista synchronizovat synonym tab tecky tenkalinka tenkelinky tex texthlavicky textovalinka textpopisku title tlacitko tref tvrdemezery typebuffer typstrany ukazbarvu ukazexterniobrazy ukazmrizku ukaznastaveni ukazpaletu ukazpodpery ukazpole ukazpostredizakladnihofontu ukazramecek ukazsadusymbolu ukazskupinubarev ukazupravu ukazvytisk ukazvzhled ukazzakladnifont umistikombinovanyseznam umistikombinovanyseznam umistilegendu umistiloga umistilokalnipoznamkypodcarou umistinadsebe umistinamrizku umistipodrovnici umistipoznamkypodcarou umistirejstrik umistirejstrik umistirovnici umistiseznam umistivedlesebe umistizalozky underbar underbars usedirectory usetypescript usetypescriptfile 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 zalozka zapisdorejstriku zapisdoseznamu zapisdoseznamuodkazu zapismeziseznam zaramovani zarovnanonastred zarovnanovlevo zarovnanovpravo zasobnikpoli zaznamovepole zhustene ziskejbuffer ziskejznaceni zlomek znaceni znak znaky zpracujbloky zpracujstranu zrcadlit zref \ No newline at end of file +keywordclass.macros.context.cs=CAP Cap Caps MESIC Rimskecislice SLOVA SLOVO Slova Slovo VSEDNIDEN Znak Znaky aktualnicislonadpisu aktualnidatum appendix barva bilemisto bublinkovanapoveda bypassblocks cap cernalinka cernelinky chapter chem cisla cislonadpisu citace citovat comment completecombinedlist completelistoffloats completelistofsorts completelistofsynonyms completeregister coupledregister crlf datum definebodyfontDEF definebodyfontREF definedfont definefontfeature definefonthandling definetype definetypeface definuj definujbarvu definujblok definujbloksekce definujbuffer definujfont definujformatodkazu definujinterakcnimenu definujinterakcnimenu definujkombinovanyseznam definujkonverzi definujlogo definujnadpis definujobrazeksymbol definujodkaz definujodsazovani definujodstavce definujopis definujoramovani definujoramovanytext definujpaletu definujplvouciobjekt definujpodpole definujpole definujpopis definujpopisek definujprekryv definujpreskok definujprofil definujprogram definujprostredizakladnihofontu definujrejstrik definujsablonutabulky definujsekci definujseznam definujseznamodkazu definujskupinubarev definujstartstop definujsymbol definujsynonumumfontu definujsynonyma definujtabelaci definujtext definujtrideni definujupravu definujvelikostpapiru definujverzi definujvycet definujvystup definujzakladnifont definujzasobnikpoli definujznaceni description dodrzujprofil dodrzujverzi dodrzujverziprofilu dvoustrannypapir emptylines enumeration externiobraz footnotetext forceblocks framedtext hl hlavnijazyk indentation ininner inouter instalacejazyka interakcnilista interakcnitlacitka jazyk jdidolu jdina jdinabox klonujpole konvertujcislo kopirujpole korekcebilehomista labeling listsymbol loadsorts loadsynonyms mapfontsize marginalnilinka marginalnitext matematika mediaeval meritko mesic mezera mrizka nadpis nadruhyokraj name naokraj nastavbarvu nastavbarvy nastavbilamista nastavblok nastavbloksekce nastavbuffer nastavcernelinky nastavcislonadpisu nastavcislostrany nastavcislovani nastavcislovaniodstavcu nastavcislovaniradku nastavcislovanistran nastavcitaci nastavdefinicipoznamekpodcarou nastavdeleniplvoucichobjektu nastavdelitko nastavdolnitexty nastavexterniobrazy nastavhorejsek nastavhornitexty nastavinterakci nastavinterakcnilistu nastavinterakcnimenu nastavinterakcniobrazovku nastavjazyk nastavkapitalky nastavkombinovanyseznam nastavkomentar nastavlegendu nastavmarginalie nastavmarginalniblok nastavmarginalnilinky nastavmeziradkovoumezeru nastavnadpis nastavnadpisy nastavodkazovani nastavodsazeni nastavodsazovani nastavodstavce nastavopis nastavoramovanetexty nastavoramovani nastavorez nastavotoceni nastavpaletu nastavplvouciobjekt nastavplvouciobjekty nastavpodcislostrany nastavpodtrzeni nastavpole nastavpolozky nastavpopisek nastavpopisky nastavpopisy nastavpozadi nastavpozadi nastavpoznamkypodcarou nastavprechodstrany nastavpreskok nastavprofily nastavprogramy nastavprostredizakladnihofontu nastavpublikace nastavradkovani nastavradky nastavrastr nastavrejstrik nastavrovnice nastavsadusymbolu nastavsekci nastavseznam nastavseznamodkazu nastavsirkucary nastavsloupce nastavspodek nastavspojeni nastavsynchronizaci nastavsynchronizacnilistu nastavsynonyma nastavsystem nastavtab nastavtabelaci nastavtabulky nastavtenkelinky nastavtext nastavtexthlavicky nastavtextovelinky nastavtextpopisku nastavtexttexty nastavtextyupati nastavtextyzahlavi nastavtlacitka nastavtoleranci nastavtrideni nastavtype nastavumisteniprotejsku nastavumistovani nastavupati nastavupravu nastavurl nastavusporadani nastavvelikostpapiru nastavverze nastavvsechnapole nastavvycty nastavvyplnovelinky nastavvyplnoveradky nastavvystup nastavvzhled nastavzahlavi nastavzakladnifont nastavzarovnani nastavznaceni nastavzuzeni nastrane nejakyradek nekde nextsection nivy nizky nocap nop obrazovka odkaz odkaz odkaznadatum odkaznastranu odkaznatext odsazovani okr opis opissoubor oramovani oref orez otocit overbar overbars overstrike overstrikes oznacverzi paragraph parovastrana part pis placefloat placelistoffloats placelistofsorts placelistofsynonyms placereferencelist pol pole polozka polozky popisky porovnejpaletu porovnejskupinubarev pozadi pozice poznamka poznamkapodcarou pref prelozit premistinamrizku prepninazakladnifont preskoc prizpusobivepole prizpusobvzhled program propojeneznaceni propojenydokument propojenyrejstrik publikace ran ref register reservefloat reset resettextcontent resetznaceni rimskecislice rozdelplvouciobjekt rozpojeneznaceni roztazene schovejbloky section sedabarva seeregister settextcontent setupfonthandling setupfontsynonym setupforms setupinterlinespace2 setupitemgroup setuplistalternative setuppaper setupstrut sloupec slovovpravo sort spodek stanovcharakteristickuseznamu stanovcislonadpisu startalignment startbarva startbuffer startbuffer startcitace startcolumns startcombination startcomment startdescription startdocument startenumeration startfakt startfigure startfloattext startformula startframedtext starthiding startinteraktivnimenu startitemgroup startkomponenta startlegend startline startlinecorrection startlinenumbering startlines startlocal startlocalenvironment startlocalfootnotes startmakeup startmarginalnilinka startmarginblock startnamemakeup startnarrower startopposite startoverlay startoverview startparagraph startpositioning startpostponing startpozadi startprodukt startprofile startprojekt startprostredi startregister startsymbolset startsynchronization starttable starttables starttabulate starttextovalinka starttyping startunpacked startverze startzhustene stopalignment stopbarva stopbuffer stopbuffer stopcitace stopcolumns stopcombination stopcomment stopdescription stopdocument stopenumeration stopfakt stopfigure stopfloattext stopformula stopframedtext stophiding stopinteraktivnimenu stopitemgroup stopkomponenta stoplegend stopline stoplinecorrection stoplinenumbering stoplines stoplocal stoplocalenvironment stoplocalfootnotes stopmakeup stopmarginalnilinka stopmarginblock stopnamemakeup stopnarrower stopopposite stopoverlay stopoverview stopparagraph stoppositioning stoppostponing stoppozadi stopprodukt stopprofile stopprojekt stopprostredi stopsymbolset stopsynchronization stoptable stoptables stoptabulate stoptextovalinka stoptyping stopunpacked stopverze stopzhustene strana sub subject subsection subsubject subsubsection subsubsubject sym symbol synchronizacnilista synchronizovat synonym tab tecky tenkalinka tenkelinky tex texthlavicky textovalinka textpopisku title tlacitko tref tvrdemezery typebuffer typstrany ukazbarvu ukazexterniobrazy ukazmrizku ukaznastaveni ukazpaletu ukazpodpery ukazpole ukazpostredizakladnihofontu ukazramecek ukazsadusymbolu ukazskupinubarev ukazupravu ukazvytisk ukazvzhled ukazzakladnifont umistikombinovanyseznam umistikombinovanyseznam umistilegendu umistiloga umistilokalnipoznamkypodcarou umistinadsebe umistinamrizku umistipodrovnici umistipoznamkypodcarou umistirejstrik umistirejstrik umistirovnici umistiseznam umistivedlesebe umistizalozky underbar underbars usedirectory usetypescript usetypescriptfile 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 zalozka zapisdorejstriku zapisdoseznamu zapisdoseznamuodkazu zapismeziseznam zaramovani zarovnanonastred zarovnanovlevo zarovnanovpravo zasobnikpoli zaznamovepole zhustene ziskejbuffer ziskejznaceni zlomek znaceni znak znaky zpracujbloky zpracujstranu zrcadlit zref \ No newline at end of file diff --git a/Master/texmf-dist/context/data/scite/cont-de-scite.properties b/Master/texmf-dist/context/data/scite/cont-de-scite.properties index b0e05b91aa5..249fc6a5905 100644 --- a/Master/texmf-dist/context/data/scite/cont-de-scite.properties +++ b/Master/texmf-dist/context/data/scite/cont-de-scite.properties @@ -1 +1 @@ -keywordclass.macros.context.de=Buchstabe Buchstaben CAP Cap Caps MONAT Roemischezahlen WOCHENTAG WOERTER WORT Woerter Wort amgitterausrichten amgitterneuausrichten appendix aufseite ausfuellfeld ausfuelltext ausschnitt bearbeitebloecke bearbeiteseite behaltebloecke bei benutzekodierung benutzespezielles beschrifteversion beschriftung bestimmekopfnummer bestimmelistencharakeristika bildschirm blanko bookmark bruch buchstabe buchstaben but bypassblocks cap chapter chem completecombinedlist completelistoffloats completelistofsorts completelistofsynonyms completeregister coupledregister crlf datum definebodyfontDEF definebodyfontREF definedfont definefontfeature definefonthandling defineoutput defineschriftsynonym definetype definetypeface definiereabbsymbol definiereabsaetze definiereabschnitt definiereabschnittsblock definierebeschreibung definierebeschreibungen definierebeschriftung definiereblanko definiereblock definiereeinzug definierefarbe definierefarbengruppe definierefeld definierefeldstapel definierefliesstext definierefliesstextumgebung definieregleitobjekt definiereinteraktionsmenue definiereinteraktionsmenue definierekonversion definierelabel definiereliste definierelogo definieren definierenummerierung definiereoverlay definierepalette definierepapierformat definiereprofil definiereprogramme definierepuffer definierereferenz definierereferenzformat definierereferenzliste definiereregister definiereschrift definieresortieren definierestartstop definieresubfeld definieresymbol definieresynonyme definieretabellenvorlage definieretabulator definieretext definieretippen definiereueberschrift definiereumbruch definiereumrahmt definiereumrahmtertext definiereversion definierezusammengestellteliste description doppelseite doppelseitigespapier drehen duennelinie duennerumriss einezeile einziehen emptylines entknuepfebeschriftung enumeration externeabbildung farbe feld feldstapel festesspatium folgeprofil folgeprofilversion folgeversion footnotetext forceblocks format framedtext fussnote gefuelltesrechteck gefuelltezeile gestreckt gitter graufarbe haarlinie hauptsprache heutigesdatum heutigeskopfnummer hintergrund hl hoch holebeschriftung holepuffer imlinken imrechten imumriss in inaktiviereinteraktionsmenue inanderermarginale indentation ininner inmarginalie inouter installieresprache interaktionsbalken interaktionsknopfe inzeile irgendwo its keinebeschriftung keinebloeckemehr keinedateienmehr keinekopfundfusszeilen keineliste keinspatium keinzeilenobenundunten keinzwischenraum kleinerdurchschuss klonierefeld knopf kommentar konvertierezahl kopf kopfnummer kopierefeld korrigierezwischenraum labeling labels labeltext linksbuendig listsymbol loadsorts loadsynonyms mapfontsize mar marginallinie marginaltext mathematik mediaeval monat nachunten name nextsection nichteinziehen nocap nop notiz overbar overbars overstrike overstrikes paragraph part passelayoutan passendfeld placefloat placelistoffloats placelistofsorts placelistofsynonyms placereferencelist platzierebookmarks platziereformel platzierefussnoten platzierelegende platziereliste platzierelogo platzierelokalefussnoten platzierenebeneinander platziereregister platziereregister platziereuntereinander platziereunterformel platzierezusammengestellteliste platzierezusammengestellteliste pos position posten programm publikation punkt ran rechteck rechtecke rechtsbuendig ref referenz register registrierefelder reservefloat resettextcontent roemischezahlen ruecksetzten ruecksetztenbeschriftung schreibezumregister schreibezurliste schreibezurreferenzliste schreibezwischenliste section seeregister seite seitenreferenz seitentyp settext setupfonthandling setupfontsynonym setupforms setupinterlinespace2 setupitemgroup setuplistalternative setuppaper setupstrut showsymbolset sort spalte spatium spiegeln sprache startalignment startbuffer startbuffer startcolumns startcombination startdescription startdocument startenumeration startfarbe startfigure startfloattext startformula startframedtext startgeg starthiding starthintergrund startinteraktionsmenue startitemgroup startkleinerdurchschuss startkommentar startkomponente startlegend startline startlinecorrection startlinenumbering startlines startlocal startlocalenvironment startlocalfootnotes startmakeup startmarginallinie startmarginblock startnamemakeup startnarrower startopposite startoverlay startoverview startparagraph startpositioning startpostponing startprodukt startprofile startprojekt startregister startsymbolset startsynchronization starttable starttables starttabulate starttextlinie starttyping startumgebung startunpacked 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 stelleformelnein stellefussnotendefinitionein stellefussnotenein stellefusszeileein stellefusszeilentextein stellegefuelltesrechteckein stellegefuelltezeileein stellegegenueberplatzierenein stellegleitobjekteein stellegleitobjektein stellehintergruendeein stellehintergrundein stelleinmarginalieein stelleinteraktionein stelleinteraktionsbalkenein stelleinteraktionsbildschirmein stelleinteraktionsmenueein 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 stopalignment stopbuffer stopbuffer stopcolumns stopcombination stopdescription stopdocument stopenumeration stopfarbe stopfigure stopfloattext stopformula stopframedtext stopgeg stophiding stophintergrund stopinteraktionsmenue stopitemgroup stopkleinerdurchschuss stopkommentar stopkomponente stoplegend stopline stoplinecorrection stoplinenumbering stoplines stoplocal stoplocalenvironment stoplocalfootnotes stopmakeup stopmarginallinie stopmarginblock stopnamemakeup stopnarrower stopopposite stopoverlay stopoverview stopparagraph stoppositioning stoppostponing stopprodukt stopprofile stopprojekt stopsymbolset stopsynchronization stoptable stoptables stoptabulate stoptextlinie stoptyping stopumgebung stopunpacked stopversion stopzitat sub subject subsection subsubject subsubsection subsubsubject sym symbol synchronisationsbalken synchronisieren synonym tab teilegleitobjekt tex textlinie textreferenz tief tiho tip tippedatei tippen tippepuffer title tooltip ueber ueberschrifttext uebersetzten umrahmt underbar underbars usedirectory usetypescript usetypescriptfile 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 zwischenraum \ No newline at end of file +keywordclass.macros.context.de=Buchstabe Buchstaben CAP Cap Caps MONAT Roemischezahlen WOCHENTAG WOERTER WORT Woerter Wort amgitterausrichten amgitterneuausrichten appendix aufseite ausfuellfeld ausfuelltext ausschnitt bearbeitebloecke bearbeiteseite behaltebloecke bei benutzekodierung benutzespezielles beschrifteversion beschriftung bestimmekopfnummer bestimmelistencharakeristika bildschirm blanko bookmark bruch buchstabe buchstaben but bypassblocks cap chapter chem comment completecombinedlist completelistoffloats completelistofsorts completelistofsynonyms completeregister coupledregister crlf datum definebodyfontDEF definebodyfontREF definedfont definefontfeature definefonthandling defineoutput defineschriftsynonym definetype definetypeface definiereabbsymbol definiereabsaetze definiereabschnitt definiereabschnittsblock definierebeschreibung definierebeschreibungen definierebeschriftung definiereblanko definiereblock definiereeinzug definierefarbe definierefarbengruppe definierefeld definierefeldstapel definierefliesstext definierefliesstextumgebung definieregleitobjekt definiereinteraktionsmenue definiereinteraktionsmenue definierekonversion definierelabel definiereliste definierelogo definieren definierenummerierung definiereoverlay definierepalette definierepapierformat definiereprofil definiereprogramme definierepuffer definierereferenz definierereferenzformat definierereferenzliste definiereregister definiereschrift definieresortieren definierestartstop definieresubfeld definieresymbol definieresynonyme definieretabellenvorlage definieretabulator definieretext definieretippen definiereueberschrift definiereumbruch definiereumrahmt definiereumrahmtertext definiereversion definierezusammengestellteliste description doppelseite doppelseitigespapier drehen duennelinie duennerumriss einezeile einziehen emptylines entknuepfebeschriftung enumeration externeabbildung farbe feld feldstapel festesspatium folgeprofil folgeprofilversion folgeversion footnotetext forceblocks format framedtext fussnote gefuelltesrechteck gefuelltezeile gestreckt gitter graufarbe haarlinie hauptsprache heutigesdatum heutigeskopfnummer hintergrund hl hoch holebeschriftung holepuffer imlinken imrechten imumriss in inaktiviereinteraktionsmenue inanderermarginale indentation ininner inmarginalie inouter installieresprache interaktionsbalken interaktionsknopfe inzeile irgendwo its keinebeschriftung keinebloeckemehr keinedateienmehr keinekopfundfusszeilen keineliste keinspatium keinzeilenobenundunten keinzwischenraum kleinerdurchschuss klonierefeld knopf konvertierezahl kopf kopfnummer kopierefeld korrigierezwischenraum labeling labels labeltext linksbuendig listsymbol loadsorts loadsynonyms mapfontsize mar marginallinie marginaltext mathematik mediaeval monat nachunten name nextsection nichteinziehen nocap nop notiz overbar overbars overstrike overstrikes paragraph part passelayoutan passendfeld placefloat placelistoffloats placelistofsorts placelistofsynonyms placereferencelist platzierebookmarks platziereformel platzierefussnoten platzierelegende platziereliste platzierelogo platzierelokalefussnoten platzierenebeneinander platziereregister platziereregister platziereuntereinander platziereunterformel platzierezusammengestellteliste platzierezusammengestellteliste pos position posten programm publikation punkt ran rechteck rechtecke rechtsbuendig ref referenz register registrierefelder reservefloat resettextcontent roemischezahlen ruecksetzten ruecksetztenbeschriftung schreibezumregister schreibezurliste schreibezurreferenzliste schreibezwischenliste section seeregister seite seitenreferenz seitentyp settext setupfonthandling setupfontsynonym setupforms setupinterlinespace2 setupitemgroup setuplistalternative setuppaper setupstrut showsymbolset sort spalte spatium spiegeln sprache startalignment startbuffer startbuffer startcolumns startcombination startcomment startdescription startdocument startenumeration startfarbe startfigure startfloattext startformula startframedtext startgeg starthiding starthintergrund startinteraktionsmenue startitemgroup startkleinerdurchschuss startkomponente startlegend startline startlinecorrection startlinenumbering startlines startlocal startlocalenvironment startlocalfootnotes startmakeup startmarginallinie startmarginblock startnamemakeup startnarrower startopposite startoverlay startoverview startparagraph startpositioning startpostponing startprodukt startprofile startprojekt startregister startsymbolset startsynchronization starttable starttables starttabulate starttextlinie starttyping startumgebung startunpacked 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 stelleformelnein stellefussnotendefinitionein stellefussnotenein stellefusszeileein stellefusszeilentextein stellegefuelltesrechteckein stellegefuelltezeileein stellegegenueberplatzierenein stellegleitobjekteein stellegleitobjektein stellehintergruendeein stellehintergrundein stelleinmarginalieein stelleinteraktionein stelleinteraktionsbalkenein stelleinteraktionsbildschirmein stelleinteraktionsmenueein 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 stopalignment stopbuffer stopbuffer stopcolumns stopcombination stopcomment stopdescription stopdocument stopenumeration stopfarbe stopfigure stopfloattext stopformula stopframedtext stopgeg stophiding stophintergrund stopinteraktionsmenue stopitemgroup stopkleinerdurchschuss stopkomponente stoplegend stopline stoplinecorrection stoplinenumbering stoplines stoplocal stoplocalenvironment stoplocalfootnotes stopmakeup stopmarginallinie stopmarginblock stopnamemakeup stopnarrower stopopposite stopoverlay stopoverview stopparagraph stoppositioning stoppostponing stopprodukt stopprofile stopprojekt stopsymbolset stopsynchronization stoptable stoptables stoptabulate stoptextlinie stoptyping stopumgebung stopunpacked stopversion stopzitat sub subject subsection subsubject subsubsection subsubsubject sym symbol synchronisationsbalken synchronisieren synonym tab teilegleitobjekt tex textlinie textreferenz tief tiho tip tippedatei tippen tippepuffer title tooltip ueber ueberschrifttext uebersetzten umrahmt underbar underbars usedirectory usetypescript usetypescriptfile 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 zwischenraum \ No newline at end of file diff --git a/Master/texmf-dist/context/data/scite/cont-fr-scite.properties b/Master/texmf-dist/context/data/scite/cont-fr-scite.properties index 606be2efaba..5ecccf961dd 100644 --- a/Master/texmf-dist/context/data/scite/cont-fr-scite.properties +++ b/Master/texmf-dist/context/data/scite/cont-fr-scite.properties @@ -1 +1 @@ -keywordclass.macros.context.fr=CAP Cap Caps Caractere Caracteres Chiffresromains JOURSEMAINE MOIS MOT MOTS Mot Mots a adaptedisposition ajustechamp alaligne alapage aligneadroite aligneagauche aligneaumilieu appendix arriereplan baha barreinteraction barresynchronisation bas bouton boutonsinteraction but cacheblocs cap caractere caracteres champ changepolicecorps chapter chem chiffresromains citation citer clip clonechamp colonne commentaire comparegroupecouleur comparepalette completecombinedlist completelistoffloats completelistofsorts completelistofsynonyms completeregistre composeenalinea concernant convertitnumero copitchamp corrigeespaceblanc couleur couleurgrise coupledocument coupledregister couplemarquage couplepapier coupleregistre crlf dactylographier dans dansautremarge dansdroite dansgauche dansmarge date datecourante daterecommandation de decouplemarquage definebodyfontDEF definebodyfontREF definedfont definefontfeature definefonthandling defineframed defineframedtext definetypeface definit definitbloc definitblocsection definitbuffer definitchamp definitcompoalinea definitconversion definitcouleur definitdactylo definitdemarrestoppe definitdescription definitenumeration definitenvironnementpolicecorps definitetiquette definitflottant definitformatreference definitgroupecouleur definitliste definitlisteimbriquee definitlistereference definitlogo definitmakeup definitmarquage definitmenuinteraction definitmenuinteraction definitnotepdp definitpalette definitparagraphes definitpilechamp definitpolice definitpolicecorps definitprofil definitprogramme definitreference definitregistre definitrevetement definitsection definitsortie definitsouschamp definitsymbole definitsymbolefigure definitsynonymepolice definitsynonymes definittabulation definittaillepapier definittete definittexte definittrametableau definittri definittype definitversion definitvide definitvide demarreciter deplacesurgrille description determinecaracteristiqueliste determinenumerotete echelle ecran ecritdansliste ecritdanslistereference ecritentreliste ecritregistre el element elements emptylines enumeration espace espaceblanc espacesfixes etiquettes etire fichierdactylo figureexterne forceblocs fraction framed framedtext gardeblocs grille groupe haut hl indentation inframed inhibemenuinteraction ininner inouter installelangue joursemaine labeling labeltexte langue langueprincipale ligneh lignenoire ligneregleetexte lignesnoires listesymbole loadsorts loadsynonyms logchamp mapfontsize mar margereglee marquage marquageversion marquepage mathematique mediaeval mois montrecadre montrechamps montrecouleur montredisposition montreedition montreenvironnementpolicecorps montrefiguresexternes montregrille montregroupecouleur montrejeusymboles montremakeup montrepalette montrepolicecorps montrereglages montrestruts motdroit name nextsection nocap nop note notepdp numeros numerotete numerotetecourant obtientmarquage oriente overbar overbars overstrike overstrikes page pagedouble paragraph part pasplusdeblocs pasplusdefichiers periodes pilechamp placecoteacote placeflottant placeformule placelegende placelesunsaudessusdesautres placeliste placelisteinmbriquee placelisteinmbriquee placelistereference placelistoffloats placelistofsorts placelistofsynonyms placelogos placemarquespages placenotespdp placenotespdplocales placeregistre placeregistre placesousformule placesurgrille position prendbuffer programme publication qqpart ran raz razmarquage recommandation ref reference referencepage referencetexte reflete register reglealignement reglealineas reglearrangement reglearriereplan reglearriereplans reglebarreinteraction reglebarresynchronisation reglebloc regleblocmarge regleblocsection regleboutons reglebuffer reglecapitales reglechamp reglechamps regleclipping reglecolonnes reglecombinaisons reglecommentaire reglecompoetroite reglecomposeenalinea reglecouleur reglecouleurs regledactylo regledansmarge regledescriptions regledisposition regleecraninteraction regleecrans regleelements regleencadre regleentete regleenumerations regleenvironnementpolicecorps regleepaisseurligne regleespaceblanc regleespacement regleespacementinterligne reglefiguresexternes regleflottant regleflottants regleformulaires regleformules regleinf regleinteraction regleintitule regleintitules reglejeusymboles reglelabeltexte reglelangue reglelegende reglelignes reglelignesnoires reglelignesreglestexte regleliste reglelisteimbriquee reglelistereference reglemakeup reglemargereglee reglemarquage reglemarquagehyphenation reglemenuinteraction reglenotepdp reglenumeropage reglenumerotation reglenumerotationligne reglenumerotationpage reglenumerotationparagraphe reglenumerotete regleoriente reglepalette reglepapier regleparagraphes reglepdp regleplacementopposition reglepolicecorps reglepositionnement regleprofils regleprogrammes reglepublications reglereferencage regleregistre regleremplitligne regleremplitlignesreglees reglesection regleseparationflottant reglesortie reglesouslignage reglesousnumeropage reglestrut reglesup reglesynchronisation reglesynonymes reglesysteme regletab regletableaux regletabulation regletaillepapier regletete regletetes regletexte regletextesentete regletextesinf regletextespdp regletextessup regletextestexte regletextetete regletolerance regletraitsfins regletransitionspage regletri regletype regleurl regleversions remplitchamp remplitligne remplitlignesreglees remplittexte reservefloat resettextcontent sansalinea sansespace sansespaceblanc sanslignesenteteetpdp sanslignessupetinf sansliste sansmarquage sauteblocs section seeregister selectionneblocs selectionnepapier selectionneversion separeflottant settext setupfonthandling setupfontsynonym setupframedtexts setupinterlinespace2 setupitemgroup setuplistalternative sort startalignment startarriereplan startbuffer startbuffer startcitation startcolumns startcombination startcommentaire startcomposant startcouleur startdescription startdocument startenumeration startenvironement startfait startfigure startfloattext startformula startframedtext startgroupe starthiding startitemgroup startlegend startligneregleetexte startline startlinecorrection startlinenumbering startlines startlocal startlocalenvironment startlocalfootnotes startmakeup startmargereglee startmarginblock startmenuinteraction startnamemakeup startnarrower startopposite startoverlay startoverview startparagraph startpositioning startpostponing startproduit startprofile startprojet startregister startsymbolset startsynchronization starttable starttables starttabulate starttyping startunpacked startversion stopalignment stoparriereplan stopbuffer stopbuffer stopcitation stopcolumns stopcombination stopcommentaire stopcomposant stopcouleur stopdescription stopdocument stopenumeration stopenvironement stopfait stopfigure stopfloattext stopformula stopframedtext stopgroupe stophiding stopitemgroup stoplegend stopligneregleetexte stopline stoplinecorrection stoplinenumbering stoplines stoplocal stoplocalenvironment stoplocalfootnotes stopmakeup stopmargereglee stopmarginblock stopmenuinteraction stopnamemakeup stopnarrower stopopposite stopoverlay stopoverview stopparagraph stoppositioning stoppostponing stopproduit stopprofile stopprojet stopsymbolset stopsynchronization stoptable stoptables stoptabulate stoptyping stopunpacked stopversion sub subject subsection subsubject subsubsection subsubsubject suggestion suivantprofil suivantversion suivantversionprofil sym symbole synchronise synonym tab tapebuffer tapepage tete tex textemarge textenotepdp textetete title traduire traiteblocs traitepage traitfin traitsfins typ underbar underbars uneligne usedirectory usetypescript usetypescriptfile utiliseURL utiliseblocs utilisecommandes utilisedocumentexterne utiliseencodage utilisefichierexterne utilisefichiersexternes utilisefigureexterne utilisemodule utilisepsiteaudioexterne utilisereferences utilisespecialites utilisesymboles va vaalaboite vaenbas version vide vl \ No newline at end of file +keywordclass.macros.context.fr=CAP Cap Caps Caractere Caracteres Chiffresromains JOURSEMAINE MOIS MOT MOTS Mot Mots a adaptedisposition ajustechamp alaligne alapage aligneadroite aligneagauche aligneaumilieu appendix arriereplan baha barreinteraction barresynchronisation bas bouton boutonsinteraction but cacheblocs cap caractere caracteres champ changepolicecorps chapter chem chiffresromains citation citer clip clonechamp colonne comment comparegroupecouleur comparepalette completecombinedlist completelistoffloats completelistofsorts completelistofsynonyms completeregistre composeenalinea concernant convertitnumero copitchamp corrigeespaceblanc couleur couleurgrise coupledocument coupledregister couplemarquage couplepapier coupleregistre crlf dactylographier dans dansautremarge dansdroite dansgauche dansmarge date datecourante daterecommandation de decouplemarquage definebodyfontDEF definebodyfontREF definedfont definefontfeature definefonthandling defineframed defineframedtext definetypeface definit definitbloc definitblocsection definitbuffer definitchamp definitcompoalinea definitconversion definitcouleur definitdactylo definitdemarrestoppe definitdescription definitenumeration definitenvironnementpolicecorps definitetiquette definitflottant definitformatreference definitgroupecouleur definitliste definitlisteimbriquee definitlistereference definitlogo definitmakeup definitmarquage definitmenuinteraction definitmenuinteraction definitnotepdp definitpalette definitparagraphes definitpilechamp definitpolice definitpolicecorps definitprofil definitprogramme definitreference definitregistre definitrevetement definitsection definitsortie definitsouschamp definitsymbole definitsymbolefigure definitsynonymepolice definitsynonymes definittabulation definittaillepapier definittete definittexte definittrametableau definittri definittype definitversion definitvide definitvide demarreciter deplacesurgrille description determinecaracteristiqueliste determinenumerotete echelle ecran ecritdansliste ecritdanslistereference ecritentreliste ecritregistre el element elements emptylines enumeration espace espaceblanc espacesfixes etiquettes etire fichierdactylo figureexterne forceblocs fraction framed framedtext gardeblocs grille groupe haut hl indentation inframed inhibemenuinteraction ininner inouter installelangue joursemaine labeling labeltexte langue langueprincipale ligneh lignenoire ligneregleetexte lignesnoires listesymbole loadsorts loadsynonyms logchamp mapfontsize mar margereglee marquage marquageversion marquepage mathematique mediaeval mois montrecadre montrechamps montrecouleur montredisposition montreedition montreenvironnementpolicecorps montrefiguresexternes montregrille montregroupecouleur montrejeusymboles montremakeup montrepalette montrepolicecorps montrereglages montrestruts motdroit name nextsection nocap nop note notepdp numeros numerotete numerotetecourant obtientmarquage oriente overbar overbars overstrike overstrikes page pagedouble paragraph part pasplusdeblocs pasplusdefichiers periodes pilechamp placecoteacote placeflottant placeformule placelegende placelesunsaudessusdesautres placeliste placelisteinmbriquee placelisteinmbriquee placelistereference placelistoffloats placelistofsorts placelistofsynonyms placelogos placemarquespages placenotespdp placenotespdplocales placeregistre placeregistre placesousformule placesurgrille position prendbuffer programme publication qqpart ran raz razmarquage recommandation ref reference referencepage referencetexte reflete register reglealignement reglealineas reglearrangement reglearriereplan reglearriereplans reglebarreinteraction reglebarresynchronisation reglebloc regleblocmarge regleblocsection regleboutons reglebuffer reglecapitales reglechamp reglechamps regleclipping reglecolonnes reglecombinaisons reglecommentaire reglecompoetroite reglecomposeenalinea reglecouleur reglecouleurs regledactylo regledansmarge regledescriptions regledisposition regleecraninteraction regleecrans regleelements regleencadre regleentete regleenumerations regleenvironnementpolicecorps regleepaisseurligne regleespaceblanc regleespacement regleespacementinterligne reglefiguresexternes regleflottant regleflottants regleformulaires regleformules regleinf regleinteraction regleintitule regleintitules reglejeusymboles reglelabeltexte reglelangue reglelegende reglelignes reglelignesnoires reglelignesreglestexte regleliste reglelisteimbriquee reglelistereference reglemakeup reglemargereglee reglemarquage reglemarquagehyphenation reglemenuinteraction reglenotepdp reglenumeropage reglenumerotation reglenumerotationligne reglenumerotationpage reglenumerotationparagraphe reglenumerotete regleoriente reglepalette reglepapier regleparagraphes reglepdp regleplacementopposition reglepolicecorps reglepositionnement regleprofils regleprogrammes reglepublications reglereferencage regleregistre regleremplitligne regleremplitlignesreglees reglesection regleseparationflottant reglesortie reglesouslignage reglesousnumeropage reglestrut reglesup reglesynchronisation reglesynonymes reglesysteme regletab regletableaux regletabulation regletaillepapier regletete regletetes regletexte regletextesentete regletextesinf regletextespdp regletextessup regletextestexte regletextetete regletolerance regletraitsfins regletransitionspage regletri regletype regleurl regleversions remplitchamp remplitligne remplitlignesreglees remplittexte reservefloat resettextcontent sansalinea sansespace sansespaceblanc sanslignesenteteetpdp sanslignessupetinf sansliste sansmarquage sauteblocs section seeregister selectionneblocs selectionnepapier selectionneversion separeflottant settext setupfonthandling setupfontsynonym setupframedtexts setupinterlinespace2 setupitemgroup setuplistalternative sort startalignment startarriereplan startbuffer startbuffer startcitation startcolumns startcombination startcomment startcomposant startcouleur startdescription startdocument startenumeration startenvironement startfait startfigure startfloattext startformula startframedtext startgroupe starthiding startitemgroup startlegend startligneregleetexte startline startlinecorrection startlinenumbering startlines startlocal startlocalenvironment startlocalfootnotes startmakeup startmargereglee startmarginblock startmenuinteraction startnamemakeup startnarrower startopposite startoverlay startoverview startparagraph startpositioning startpostponing startproduit startprofile startprojet startregister startsymbolset startsynchronization starttable starttables starttabulate starttyping startunpacked startversion stopalignment stoparriereplan stopbuffer stopbuffer stopcitation stopcolumns stopcombination stopcomment stopcomposant stopcouleur stopdescription stopdocument stopenumeration stopenvironement stopfait stopfigure stopfloattext stopformula stopframedtext stopgroupe stophiding stopitemgroup stoplegend stopligneregleetexte stopline stoplinecorrection stoplinenumbering stoplines stoplocal stoplocalenvironment stoplocalfootnotes stopmakeup stopmargereglee stopmarginblock stopmenuinteraction stopnamemakeup stopnarrower stopopposite stopoverlay stopoverview stopparagraph stoppositioning stoppostponing stopproduit stopprofile stopprojet stopsymbolset stopsynchronization stoptable stoptables stoptabulate stoptyping stopunpacked stopversion sub subject subsection subsubject subsubsection subsubsubject suggestion suivantprofil suivantversion suivantversionprofil sym symbole synchronise synonym tab tapebuffer tapepage tete tex textemarge textenotepdp textetete title traduire traiteblocs traitepage traitfin traitsfins typ underbar underbars uneligne usedirectory usetypescript usetypescriptfile utiliseURL utiliseblocs utilisecommandes utilisedocumentexterne utiliseencodage utilisefichierexterne utilisefichiersexternes utilisefigureexterne utilisemodule utilisepsiteaudioexterne utilisereferences utilisespecialites utilisesymboles va vaalaboite vaenbas version vide vl \ No newline at end of file diff --git a/Master/texmf-dist/context/data/scite/cont-it-scite.properties b/Master/texmf-dist/context/data/scite/cont-it-scite.properties index da5df24007d..699cd0f1e73 100644 --- a/Master/texmf-dist/context/data/scite/cont-it-scite.properties +++ b/Master/texmf-dist/context/data/scite/cont-it-scite.properties @@ -1 +1 @@ -keywordclass.macros.context.it=CAP Cap Caps GIORNOSETTIMANA Lettera Lettere MESE Numeriromani PAROLA PAROLE Parola Parole accoppiacarta accoppiadocumento accoppiamarcatura accoppiapagina accoppiaregistro adattacampo adattalayout al allineacentro allineadestra allineasinistra ap apagina appendix barrainterazione barrasincronizzazione bastablocchi bastafile cambiaafontdeltesto campi camporiempimento cap capello chapter chim circondato citazione clip clonacampo colonna colore coloregrigio commento completecombinedlist completelistoffloats completelistofsorts completelistofsynonyms completeregister confrontagruppocolori confrontatavolozza convertinumero copiacampo correggispaziobianco coupledregister crlf da daqualcheparte data datadioggi datareferral definebodyfontDEF definebodyfontREF definedfont definefontfeature definefonthandling definetypeface definisci definisciambientefontdeltesto definisciblocco definiscibloccosezione definiscibuffer definiscicampo definiscicapoversi definiscicolore definisciconversione definiscidescrizione definiscidimensionicarta definiscielenco definiscielencocombinato definiscienumerazione definiscietichetta definiscifigurasimbolo definiscifont definiscifontdeltesto definisciformatoriferimento definiscigruppocolori definisciincorniciato definisciiniziatermina definiscilistariferimenti definiscilogo definiscimakeup definiscimarcatura definiscimenuinterazione definiscimenuinterazione definiscimodellotabella definiscioggettomobile definisciordinamento definiscioutput definisciprofilo definisciprogramma definisciregistro definiscirientro definisciriferimento definiscirigovuoto definiscisezione definiscisimbolo definiscisinonimi definiscisinonimofont definiscisottocampo definiscisovrapposizione definiscistackcampi definiscitabulato definiscitavolozza definiscitesta definiscitesto definiscitestoincorniciato definiscitype definiscityping definisciversion description determinacarattersticheelenco determinanumerotesta disabilitamenuinterazione el elaborablocchi elaborapagina elementi elemento emptylines enumeration etichette figuraesterna fondo forzablocchi framedtext frazione giornosettimana griglia hl impaccato impostaallineamento impostaambientefontdeltesto impostaampiezzariga impostabarrainterazione impostabarrasincronizzazione impostablocchimargine impostablocco impostabloccosezione impostabuffer impostacampi impostacampo impostacapoversi impostacaption impostacaptions impostacima impostaclippling impostacolonne impostacolore impostacolori impostacombinazioni impostacommento impostadefinizionenotepdp impostadescrizioni impostadimensionicarta impostaelementi impostaelenco impostaelencocombinato impostaenumerazioni impostafigureesterne impostafondo impostafontdeltesto impostaforms impostaformule impostaincorniciato impostainmargine impostainstestazione impostainterazione impostainterlinea impostalayout impostalegenda impostalineemargine impostalineenere impostalineeriempimento impostalineesottili impostalineetesto impostalingua impostalistariferimenti impostamaiuscole impostamakeup impostamarcatura impostamenuinterazione impostamenzione impostanotepdp impostanumerazione impostanumerazionecapoversi impostanumerazionepagina impostanumerazionerighe impostanumeropagina impostanumerosottopagina impostanumerotesta impostaoggettimobili impostaoggettomobile impostaordinamento impostaoutput impostaparranging impostapdp impostapiustretto impostaposizionamento impostaposizionamentoopposti impostaprofili impostaprogrammi impostapubblicazioni impostapulsanti impostaregistro impostarientri impostarientro impostariferimento impostarighe impostarigheriempimento impostarigovuoto impostarotazione impostaschermi impostaschermointerazione impostasegnosillabazione impostasetsimboli impostasezione impostasfondi impostasfondo impostasincronizzazione impostasinonimi impostasistema impostasottolinea impostaspaziatura impostaspaziobianco impostaspezzamentooggettomobile impostastrut impostatab impostatabelle impostatabulato impostatavolozza impostatesta impostateste impostatesticima impostatestifondo impostatestiincorniciati impostatestiintestazioni impostatestipdp impostatesto impostatestoetichette impostatestointestazioni impostatestotesti impostatolleranza impostatransizionepagina impostatype impostatyping impostaurl impostaversioni in inaltromargine incorniciato indentation indestra ininner inmargine inouter inriga insinistra installalingua intorno labeling lettera lettere lineamargine lineanera lineasottile lineatesto lineenere lineeriempimento lineesottili lingua linguaprincipale listsymbol loadsorts loadsynonyms logcampi mapfontsize mar marcatura marcaversione matematica mediaeval menzione mese mettielenco mettielencocombinato mettielencocombinato mettifiancoafianco mettiformula mettiingriglia mettilegenda mettiloghi mettinotepdp mettinotepdplocali mettiregistro mettiregistro mettisegnalibro mettisottoformula mettiunosullaltro mostraambientefontdeltesto mostracampi mostracolore mostracornice mostrafiguresterne mostrafontdeltesto mostragriglia mostragruppocolori mostraimpostazioni mostralyout mostramakeup mostrasetsimboli mostrastampa mostrastruts mostratavolozza name nascondiblocchi nextsection nienteelenco nientelineecimafondo nientelineintestazionepdp nientemarcatura nienterientro nientespazio nientespaziobianco nocap nop nota notapdp numeri numeriromani numerotesta numerotestacorrente overbar overbars overstrike overstrikes pagina paragraph paroladestra part ped pedap placefloat placelistoffloats placelistofsorts placelistofsynonyms placereferencelist posizione prendibuffer prendimarcatura programma pubblicazione pulsante pulsantinterazione punti qualcheriga ran referral register reimposta reimpostamarcatura reservefloat resettextcontent rientro rif riferimento riferimentopagina riferimentotesto riflessione rigariempimento rigovuoto ruota saltablocchi scala schermo scrividentroelenco scriviinelenco scriviinlistariferimenti scriviinregistro section seeregister segnalibro seguiprofilo seguiversione seguiversioneprofilo selezionablocchi selezionacarta selezionaversione separamarcatura settext setupfonthandling setupfontsynonym setupinterlinespace2 setupitemgroup setuplistalternative setuppaper sfondo sim simbolo sincronizza sort spazifissi spazio spaziobianco spezzaoggettomobile spostaagriglia stackcampi startalignment startambiente startbuffer startbuffer startcitazione startcolore startcolumns startcombination startcommento startcomponenet startdescription startdocument startenumeration startfatto startfigure startfloattext startformula startframedtext starthiding startimpaccato startitemgroup startlegend startline startlineamargine startlineatesto startlinecorrection startlinenumbering startlines startlocal startlocalenvironment startlocalfootnotes startmakeup startmarginblock startmenuinterattivo startnamemakeup startnarrower startopposite startoverlay startoverview startparagraph startpositioning startpostponing startprodotto startprofile startprogetto startregister startsfondo startsymbolset startsynchronization starttable starttables starttabulate starttyping startunpacked startversione stirato stopalignment stopambiente stopbuffer stopbuffer stopcitazione stopcolore stopcolumns stopcombination stopcommento stopcomponenet stopdescription stopdocument stopenumeration stopfatto stopfigure stopfloattext stopformula stopframedtext stophiding stopimpaccato stopitemgroup stoplegend stopline stoplineamargine stoplineatesto stoplinecorrection stoplinenumbering stoplines stoplocal stoplocalenvironment stoplocalfootnotes stopmakeup stopmarginblock stopmenuinterattivo stopnamemakeup stopnarrower stopopposite stopoverlay stopoverview stopparagraph stoppositioning stoppostponing stopprodotto stopprofile stopprogetto stopsfondo stopsymbolset stopsynchronization stoptable stoptables stoptabulate stoptyping stopunpacked stopversione sub subject subsection subsubject subsubsection subsubsubject synonym tab testa testoetichetta testoinmargine testoinstestazioni testonotapdp testoriempimento tex tieniblocchi tipopagina title tooltip traduci typ type typebuffer typefile underbar underbars usaURL usablocco usacodifica usacolonnasonoraesterna usacomandi usadocumentoesterno usafiguraesterna usafileesterni usafileesterno usamodulo usariferimenti usasimboli usaspecialita usedirectory usetypescript usetypescriptfile vaia vaiabox vaigiu versione vl \ No newline at end of file +keywordclass.macros.context.it=CAP Cap Caps GIORNOSETTIMANA Lettera Lettere MESE Numeriromani PAROLA PAROLE Parola Parole accoppiacarta accoppiadocumento accoppiamarcatura accoppiapagina accoppiaregistro adattacampo adattalayout al allineacentro allineadestra allineasinistra ap apagina appendix barrainterazione barrasincronizzazione bastablocchi bastafile cambiaafontdeltesto campi camporiempimento cap capello chapter chim circondato citazione clip clonacampo colonna colore coloregrigio comment completecombinedlist completelistoffloats completelistofsorts completelistofsynonyms completeregister confrontagruppocolori confrontatavolozza convertinumero copiacampo correggispaziobianco coupledregister crlf da daqualcheparte data datadioggi datareferral definebodyfontDEF definebodyfontREF definedfont definefontfeature definefonthandling definetypeface definisci definisciambientefontdeltesto definisciblocco definiscibloccosezione definiscibuffer definiscicampo definiscicapoversi definiscicolore definisciconversione definiscidescrizione definiscidimensionicarta definiscielenco definiscielencocombinato definiscienumerazione definiscietichetta definiscifigurasimbolo definiscifont definiscifontdeltesto definisciformatoriferimento definiscigruppocolori definisciincorniciato definisciiniziatermina definiscilistariferimenti definiscilogo definiscimakeup definiscimarcatura definiscimenuinterazione definiscimenuinterazione definiscimodellotabella definiscioggettomobile definisciordinamento definiscioutput definisciprofilo definisciprogramma definisciregistro definiscirientro definisciriferimento definiscirigovuoto definiscisezione definiscisimbolo definiscisinonimi definiscisinonimofont definiscisottocampo definiscisovrapposizione definiscistackcampi definiscitabulato definiscitavolozza definiscitesta definiscitesto definiscitestoincorniciato definiscitype definiscityping definisciversion description determinacarattersticheelenco determinanumerotesta disabilitamenuinterazione el elaborablocchi elaborapagina elementi elemento emptylines enumeration etichette figuraesterna fondo forzablocchi framedtext frazione giornosettimana griglia hl impaccato impostaallineamento impostaambientefontdeltesto impostaampiezzariga impostabarrainterazione impostabarrasincronizzazione impostablocchimargine impostablocco impostabloccosezione impostabuffer impostacampi impostacampo impostacapoversi impostacaption impostacaptions impostacima impostaclippling impostacolonne impostacolore impostacolori impostacombinazioni impostacommento impostadefinizionenotepdp impostadescrizioni impostadimensionicarta impostaelementi impostaelenco impostaelencocombinato impostaenumerazioni impostafigureesterne impostafondo impostafontdeltesto impostaforms impostaformule impostaincorniciato impostainmargine impostainstestazione impostainterazione impostainterlinea impostalayout impostalegenda impostalineemargine impostalineenere impostalineeriempimento impostalineesottili impostalineetesto impostalingua impostalistariferimenti impostamaiuscole impostamakeup impostamarcatura impostamenuinterazione impostamenzione impostanotepdp impostanumerazione impostanumerazionecapoversi impostanumerazionepagina impostanumerazionerighe impostanumeropagina impostanumerosottopagina impostanumerotesta impostaoggettimobili impostaoggettomobile impostaordinamento impostaoutput impostaparranging impostapdp impostapiustretto impostaposizionamento impostaposizionamentoopposti impostaprofili impostaprogrammi impostapubblicazioni impostapulsanti impostaregistro impostarientri impostarientro impostariferimento impostarighe impostarigheriempimento impostarigovuoto impostarotazione impostaschermi impostaschermointerazione impostasegnosillabazione impostasetsimboli impostasezione impostasfondi impostasfondo impostasincronizzazione impostasinonimi impostasistema impostasottolinea impostaspaziatura impostaspaziobianco impostaspezzamentooggettomobile impostastrut impostatab impostatabelle impostatabulato impostatavolozza impostatesta impostateste impostatesticima impostatestifondo impostatestiincorniciati impostatestiintestazioni impostatestipdp impostatesto impostatestoetichette impostatestointestazioni impostatestotesti impostatolleranza impostatransizionepagina impostatype impostatyping impostaurl impostaversioni in inaltromargine incorniciato indentation indestra ininner inmargine inouter inriga insinistra installalingua intorno labeling lettera lettere lineamargine lineanera lineasottile lineatesto lineenere lineeriempimento lineesottili lingua linguaprincipale listsymbol loadsorts loadsynonyms logcampi mapfontsize mar marcatura marcaversione matematica mediaeval menzione mese mettielenco mettielencocombinato mettielencocombinato mettifiancoafianco mettiformula mettiingriglia mettilegenda mettiloghi mettinotepdp mettinotepdplocali mettiregistro mettiregistro mettisegnalibro mettisottoformula mettiunosullaltro mostraambientefontdeltesto mostracampi mostracolore mostracornice mostrafiguresterne mostrafontdeltesto mostragriglia mostragruppocolori mostraimpostazioni mostralyout mostramakeup mostrasetsimboli mostrastampa mostrastruts mostratavolozza name nascondiblocchi nextsection nienteelenco nientelineecimafondo nientelineintestazionepdp nientemarcatura nienterientro nientespazio nientespaziobianco nocap nop nota notapdp numeri numeriromani numerotesta numerotestacorrente overbar overbars overstrike overstrikes pagina paragraph paroladestra part ped pedap placefloat placelistoffloats placelistofsorts placelistofsynonyms placereferencelist posizione prendibuffer prendimarcatura programma pubblicazione pulsante pulsantinterazione punti qualcheriga ran referral register reimposta reimpostamarcatura reservefloat resettextcontent rientro rif riferimento riferimentopagina riferimentotesto riflessione rigariempimento rigovuoto ruota saltablocchi scala schermo scrividentroelenco scriviinelenco scriviinlistariferimenti scriviinregistro section seeregister segnalibro seguiprofilo seguiversione seguiversioneprofilo selezionablocchi selezionacarta selezionaversione separamarcatura settext setupfonthandling setupfontsynonym setupinterlinespace2 setupitemgroup setuplistalternative setuppaper sfondo sim simbolo sincronizza sort spazifissi spazio spaziobianco spezzaoggettomobile spostaagriglia stackcampi startalignment startambiente startbuffer startbuffer startcitazione startcolore startcolumns startcombination startcomment startcomponenet startdescription startdocument startenumeration startfatto startfigure startfloattext startformula startframedtext starthiding startimpaccato startitemgroup startlegend startline startlineamargine startlineatesto startlinecorrection startlinenumbering startlines startlocal startlocalenvironment startlocalfootnotes startmakeup startmarginblock startmenuinterattivo startnamemakeup startnarrower startopposite startoverlay startoverview startparagraph startpositioning startpostponing startprodotto startprofile startprogetto startregister startsfondo startsymbolset startsynchronization starttable starttables starttabulate starttyping startunpacked startversione stirato stopalignment stopambiente stopbuffer stopbuffer stopcitazione stopcolore stopcolumns stopcombination stopcomment stopcomponenet stopdescription stopdocument stopenumeration stopfatto stopfigure stopfloattext stopformula stopframedtext stophiding stopimpaccato stopitemgroup stoplegend stopline stoplineamargine stoplineatesto stoplinecorrection stoplinenumbering stoplines stoplocal stoplocalenvironment stoplocalfootnotes stopmakeup stopmarginblock stopmenuinterattivo stopnamemakeup stopnarrower stopopposite stopoverlay stopoverview stopparagraph stoppositioning stoppostponing stopprodotto stopprofile stopprogetto stopsfondo stopsymbolset stopsynchronization stoptable stoptables stoptabulate stoptyping stopunpacked stopversione sub subject subsection subsubject subsubsection subsubsubject synonym tab testa testoetichetta testoinmargine testoinstestazioni testonotapdp testoriempimento tex tieniblocchi tipopagina title tooltip traduci typ type typebuffer typefile underbar underbars usaURL usablocco usacodifica usacolonnasonoraesterna usacomandi usadocumentoesterno usafiguraesterna usafileesterni usafileesterno usamodulo usariferimenti usasimboli usaspecialita usedirectory usetypescript usetypescriptfile vaia vaiabox vaigiu versione vl \ No newline at end of file diff --git a/Master/texmf-dist/context/data/scite/cont-nl-scite.properties b/Master/texmf-dist/context/data/scite/cont-nl-scite.properties index 688c8a7c034..a36e8f475d6 100644 --- a/Master/texmf-dist/context/data/scite/cont-nl-scite.properties +++ b/Master/texmf-dist/context/data/scite/cont-nl-scite.properties @@ -1 +1 @@ -keywordclass.macros.context.nl=CAP Cap Caps Letter Letters MAAND Romeins WEEKDAG WOORD WOORDEN Woord Woorden about achtergrond appendix bepaalkopnummer bepaallijstkenmerken blanko blokje blokjes blokkeerinteractiemenu bookmark breuk but button cap chapter chem cijfers citaat citeer clip commentaar completecombinedlist completelistoffloats completelistofsorts completelistofsynonyms converteernummer copieerveld corrigeerwitruimte coupledregister crlf datum definebodyfontDEF definebodyfontREF definedfont definefontfeature definefonthandling definetypeface definieer definieeralineas definieerbeeldmerk definieerblanko definieerblok definieerbuffer definieerconversie definieerfiguursymbool definieerfont definieerfontsynoniem definieerinteractiemenu definieerinteractiemenu definieerkadertekst definieerkleur definieerkleurgroep definieerkop definieerkorps definieerkorpsomgeving definieerlijst definieermarkering definieeromlijnd definieeropmaak definieeroverlay definieerpalet definieerpapierformaat definieerplaatsblok definieerprofiel definieerprogramma definieerreferentie definieerreferentieformaat definieerreferentielijst definieerregister definieersamengesteldelijst definieersectie definieersectieblok definieersorteren definieerstartstop definieersubveld definieersymbool definieersynoniemen definieertabelvorm definieertabulatie definieertekst definieertype definieertypen definieeruitvoer definieerveld definieerveldstapel definieerversie description doordefinieren doorlabelen doornummeren doorspringen dunnelijn dunnelijnen eenregel enumeration ergens externfiguur forceerblokken framedtext gebruikURL gebruikblokken gebruikcommandos gebruikexterndocument gebruikexternefile gebruikexternefiles gebruikexternfiguur gebruikexterngeluidsfragment gebruikmodule gebruikreferenties gebruikspecials gebruiksymbolen gebruiktypescript gebruiktypescriptfile geenblokkenmeer geenbovenenonderregels geenfilesmeer geenhoofdenvoetregels geenlijst geenmarkering geenspatie geenwitruimte grijskleur haalbuffer haalmarkering haarlijn handhaafblokken hl hoofdtaal hoog huidigedatum huidigekopnummer in inanderemarge inbinnen inbuiten indentation inlijnd inlinker inmarge inrechter inregel inspringen installeertaal interactiebalk interactiebuttons invullijnen invulregel invultekst invulveld items its kantlijn kenmerk kenmerkdatum kleur kloonveld kolom kop kopnummer koppeldocument koppelmarkering koppelpagina koppelpapier koppelregister koptekst laag labeling labels labeltekst laho legeregels letter letters lijstsymbool loadsorts loadsynonyms maand mapfontsize mar margetekst markeer markeerversie mediaeval naar naarbox name nextsection nietinspringen nocap noot nop omlaag omlijnd ontkoppelmarkering op opelkaar oppagina overbar overbars overstrike overstrikes pagina paginareferentie paragraph part paslayoutaan passeerblokken passendveld plaatsbeeldmerken plaatsbookmarks plaatsformule plaatslegenda plaatslijst plaatslokalevoetnoten plaatsnaastelkaar plaatsonderelkaar plaatsopgrid plaatsplaatsblok plaatsreferentielijst plaatsregister plaatsregister plaatssamengesteldelijst plaatssamengesteldelijst plaatssubformule plaatsvoetnoten placelistoffloats placelistofsorts placelistofsynonyms positioneer programma publicatie punten ran ref referentie regellinks regelmidden regelrechts register registreervelden reservefloat reset resetmarkering resettextcontent romeins rooster roteer schaal scherm schrijfnaarlijst schrijfnaarreferentielijst schrijfnaarregister schrijftussenlijst section seeregister selecteerblokken selecteerpapier selecteerversie setupfonthandling setupfontsynonym setupinterlinespace2 setuplistalternative som soortpagina sort spatie spiegel splitsplaatsblok startachtergrond startalignment startbuffer startbuffer startcitaat startcolumns startcombination startcommentaar startdescription startdocument startenumeration startfigure startfloattext startformula startframedtext startgeg starthiding startinteractiemenu startitemgroup startkantlijn startkleur startlegend startline startlinecorrection startlinenumbering startlines startlocal startlocalenvironment startlocalfootnotes startmakeup startmarginblock startnamemakeup startnarrower startomgeving startonderdeel startopelkaar startopposite startoverlay startoverview startparagraph startpositioning startpostponing startprodukt startprofile startprojekt startregister startsymbolset startsynchronization starttable starttables starttabulate starttekstlijn starttyping startunpacked startversie stelachtergrondenin stelachtergrondin stelalineasin stelarrangerenin stelblankoin stelblokin stelblokjesin stelblokkopjein stelblokkopjesin stelbovenin stelboventekstenin stelbufferin stelbuttonsin stelciterenin stelclipin stelcombinatiesin stelcommentaarin steldoordefinierenin steldoornummerenin steldoorspringenin steldunnelijnenin stelexternefigurenin stelformulesin stelformulierenin stelhoofdin stelhoofdtekstenin stelinmargein stelinspringenin stelinteractiebalkin stelinteractiein stelinteractiemenuin stelinteractieschermin stelinterliniein stelinvullijnenin stelinvulregelsin stelitemgroepin stelitemsin stelkadertekstenin stelkantlijnin stelkapitalenin stelkleurenin stelkleurin stelkolommenin stelkopin stelkopnummerin stelkoppeltekenin stelkoppenin stelkoptekstin stelkorpsin stelkorpsomgevingin stellabeltekstin stellayoutin stellegendain stellijndiktein stellijstin stelmargeblokkenin stelmarkeringin stelnaastplaatsenin stelnummerenin stelomlijndin stelonderin stelonderstrepenin stelondertekstenin stelopmaakin stelpaginanummerin stelpaginanummeringin stelpaginaovergangenin stelpaletin stelpapierformaatin stelpapierin stelparagraafnummerenin stelplaatsblokin stelplaatsblokkenin stelplaatsbloksplitsenin stelpositionerenin stelprofielenin stelprogrammasin stelpublicatiesin stelrastersin stelreferentielijstin stelrefererenin stelregelnummerenin stelregelsin stelregisterin stelroterenin stelsamengesteldelijstin stelsectieblokin stelsectiein stelsmallerin stelsorterenin stelspatieringin stelstrutin stelsubpaginanummerin stelsymboolsetin stelsynchronisatiebalkin stelsynchronisatiein stelsynoniemenin stelsysteemin steltaalin steltabellenin steltabin steltabulatiein steltekstin steltekstinhoudin steltekstlijnenin stelteksttekstenin steltolerantiein steltypein steltypenin steluitlijnenin steluitvoerin stelurlin stelveldenin stelveldin stelversiesin stelvoetin stelvoetnootdefinitiein stelvoetnotenin stelvoettekstenin stelwitruimtein stopachtergrond stopalignment stopbuffer stopbuffer stopcitaat stopcolumns stopcombination stopcommentaar stopdescription stopdocument stopenumeration stopfigure stopfloattext stopformula stopframedtext stopgeg stophiding stopinteractiemenu stopitemgroup stopkantlijn stopkleur stoplegend stopline stoplinecorrection stoplinenumbering stoplines stoplocal stoplocalenvironment stoplocalfootnotes stopmakeup stopmarginblock stopnamemakeup stopnarrower stopomgeving stoponderdeel stopopelkaar stopopposite stopoverlay stopoverview stopparagraph stoppositioning stoppostponing stopprodukt stopprofile stopprojekt stopsymbolset stopsynchronization stoptable stoptables stoptabulate stoptekstlijn stoptyping stopunpacked stopversie sub subject subsection subsubject subsubsection subsubsubject suggestie switchnaarkorps sym symbool synchronisatiebalk synchroniseer synonym taal tab tekstlijn tekstreferentie tex title toonexternefiguren toongrid tooninstellingen toonkader toonkleur toonkleurgroep toonkorps toonkorpsomgeving toonlayout toonopmaak toonpalet toonprint toonstruts toonsymboolset toonvelden typ type typebuffer typefile uit uitgerekt underbar underbars usecodering usedirectory vastespaties veld veldstapel verbergblokken vergelijkkleurgroep vergelijkpalet verplaatsopgrid versie vertaal verwerkblokken verwerkpagina vl voetnoot voetnoottekst volgprofiel volgprofielversie volgversie volledigregister weekdag wiskunde witruimte woordrechts \ No newline at end of file +keywordclass.macros.context.nl=CAP Cap Caps Letter Letters MAAND Romeins WEEKDAG WOORD WOORDEN Woord Woorden about achtergrond appendix bepaalkopnummer bepaallijstkenmerken blanko blokje blokjes blokkeerinteractiemenu bookmark breuk but button cap chapter chem cijfers citaat citeer clip comment completecombinedlist completelistoffloats completelistofsorts completelistofsynonyms converteernummer copieerveld corrigeerwitruimte coupledregister crlf datum definebodyfontDEF definebodyfontREF definedfont definefontfeature definefonthandling definetypeface definieer definieeralineas definieerbeeldmerk definieerblanko definieerblok definieerbuffer definieerconversie definieerfiguursymbool definieerfont definieerfontsynoniem definieerinteractiemenu definieerinteractiemenu definieerkadertekst definieerkleur definieerkleurgroep definieerkop definieerkorps definieerkorpsomgeving definieerlijst definieermarkering definieeromlijnd definieeropmaak definieeroverlay definieerpalet definieerpapierformaat definieerplaatsblok definieerprofiel definieerprogramma definieerreferentie definieerreferentieformaat definieerreferentielijst definieerregister definieersamengesteldelijst definieersectie definieersectieblok definieersorteren definieerstartstop definieersubveld definieersymbool definieersynoniemen definieertabelvorm definieertabulatie definieertekst definieertype definieertypen definieeruitvoer definieerveld definieerveldstapel definieerversie description doordefinieren doorlabelen doornummeren doorspringen dunnelijn dunnelijnen eenregel enumeration ergens externfiguur forceerblokken framedtext gebruikURL gebruikblokken gebruikcommandos gebruikexterndocument gebruikexternefile gebruikexternefiles gebruikexternfiguur gebruikexterngeluidsfragment gebruikmodule gebruikreferenties gebruikspecials gebruiksymbolen gebruiktypescript gebruiktypescriptfile geenblokkenmeer geenbovenenonderregels geenfilesmeer geenhoofdenvoetregels geenlijst geenmarkering geenspatie geenwitruimte grijskleur haalbuffer haalmarkering haarlijn handhaafblokken hl hoofdtaal hoog huidigedatum huidigekopnummer in inanderemarge inbinnen inbuiten indentation inlijnd inlinker inmarge inrechter inregel inspringen installeertaal interactiebalk interactiebuttons invullijnen invulregel invultekst invulveld items its kantlijn kenmerk kenmerkdatum kleur kloonveld kolom kop kopnummer koppeldocument koppelmarkering koppelpagina koppelpapier koppelregister koptekst laag labeling labels labeltekst laho legeregels letter letters lijstsymbool loadsorts loadsynonyms maand mapfontsize mar margetekst markeer markeerversie mediaeval naar naarbox name nextsection nietinspringen nocap noot nop omlaag omlijnd ontkoppelmarkering op opelkaar oppagina overbar overbars overstrike overstrikes pagina paginareferentie paragraph part paslayoutaan passeerblokken passendveld plaatsbeeldmerken plaatsbookmarks plaatsformule plaatslegenda plaatslijst plaatslokalevoetnoten plaatsnaastelkaar plaatsonderelkaar plaatsopgrid plaatsplaatsblok plaatsreferentielijst plaatsregister plaatsregister plaatssamengesteldelijst plaatssamengesteldelijst plaatssubformule plaatsvoetnoten placelistoffloats placelistofsorts placelistofsynonyms positioneer programma publicatie punten ran ref referentie regellinks regelmidden regelrechts register registreervelden reservefloat reset resetmarkering resettextcontent romeins rooster roteer schaal scherm schrijfnaarlijst schrijfnaarreferentielijst schrijfnaarregister schrijftussenlijst section seeregister selecteerblokken selecteerpapier selecteerversie setupfonthandling setupfontsynonym setupinterlinespace2 setuplistalternative som soortpagina sort spatie spiegel splitsplaatsblok startachtergrond startalignment startbuffer startbuffer startcitaat startcolumns startcombination startcomment startdescription startdocument startenumeration startfigure startfloattext startformula startframedtext startgeg starthiding startinteractiemenu startitemgroup startkantlijn startkleur startlegend startline startlinecorrection startlinenumbering startlines startlocal startlocalenvironment startlocalfootnotes startmakeup startmarginblock startnamemakeup startnarrower startomgeving startonderdeel startopelkaar startopposite startoverlay startoverview startparagraph startpositioning startpostponing startprodukt startprofile startprojekt startregister startsymbolset startsynchronization starttable starttables starttabulate starttekstlijn starttyping startunpacked startversie stelachtergrondenin stelachtergrondin stelalineasin stelarrangerenin stelblankoin stelblokin stelblokjesin stelblokkopjein stelblokkopjesin stelbovenin stelboventekstenin stelbufferin stelbuttonsin stelciterenin stelclipin stelcombinatiesin stelcommentaarin steldoordefinierenin steldoornummerenin steldoorspringenin steldunnelijnenin stelexternefigurenin stelformulesin stelformulierenin stelhoofdin stelhoofdtekstenin stelinmargein stelinspringenin stelinteractiebalkin stelinteractiein stelinteractiemenuin stelinteractieschermin stelinterliniein stelinvullijnenin stelinvulregelsin stelitemgroepin stelitemsin stelkadertekstenin stelkantlijnin stelkapitalenin stelkleurenin stelkleurin stelkolommenin stelkopin stelkopnummerin stelkoppeltekenin stelkoppenin stelkoptekstin stelkorpsin stelkorpsomgevingin stellabeltekstin stellayoutin stellegendain stellijndiktein stellijstin stelmargeblokkenin stelmarkeringin stelnaastplaatsenin stelnummerenin stelomlijndin stelonderin stelonderstrepenin stelondertekstenin stelopmaakin stelpaginanummerin stelpaginanummeringin stelpaginaovergangenin stelpaletin stelpapierformaatin stelpapierin stelparagraafnummerenin stelplaatsblokin stelplaatsblokkenin stelplaatsbloksplitsenin stelpositionerenin stelprofielenin stelprogrammasin stelpublicatiesin stelrastersin stelreferentielijstin stelrefererenin stelregelnummerenin stelregelsin stelregisterin stelroterenin stelsamengesteldelijstin stelsectieblokin stelsectiein stelsmallerin stelsorterenin stelspatieringin stelstrutin stelsubpaginanummerin stelsymboolsetin stelsynchronisatiebalkin stelsynchronisatiein stelsynoniemenin stelsysteemin steltaalin steltabellenin steltabin steltabulatiein steltekstin steltekstinhoudin steltekstlijnenin stelteksttekstenin steltolerantiein steltypein steltypenin steluitlijnenin steluitvoerin stelurlin stelveldenin stelveldin stelversiesin stelvoetin stelvoetnootdefinitiein stelvoetnotenin stelvoettekstenin stelwitruimtein stopachtergrond stopalignment stopbuffer stopbuffer stopcitaat stopcolumns stopcombination stopcomment stopdescription stopdocument stopenumeration stopfigure stopfloattext stopformula stopframedtext stopgeg stophiding stopinteractiemenu stopitemgroup stopkantlijn stopkleur stoplegend stopline stoplinecorrection stoplinenumbering stoplines stoplocal stoplocalenvironment stoplocalfootnotes stopmakeup stopmarginblock stopnamemakeup stopnarrower stopomgeving stoponderdeel stopopelkaar stopopposite stopoverlay stopoverview stopparagraph stoppositioning stoppostponing stopprodukt stopprofile stopprojekt stopsymbolset stopsynchronization stoptable stoptables stoptabulate stoptekstlijn stoptyping stopunpacked stopversie sub subject subsection subsubject subsubsection subsubsubject suggestie switchnaarkorps sym symbool synchronisatiebalk synchroniseer synonym taal tab tekstlijn tekstreferentie tex title toonexternefiguren toongrid tooninstellingen toonkader toonkleur toonkleurgroep toonkorps toonkorpsomgeving toonlayout toonopmaak toonpalet toonprint toonstruts toonsymboolset toonvelden typ type typebuffer typefile uit uitgerekt underbar underbars usecodering usedirectory vastespaties veld veldstapel verbergblokken vergelijkkleurgroep vergelijkpalet verplaatsopgrid versie vertaal verwerkblokken verwerkpagina vl voetnoot voetnoottekst volgprofiel volgprofielversie volgversie volledigregister weekdag wiskunde witruimte woordrechts \ No newline at end of file diff --git a/Master/texmf-dist/context/data/scite/cont-pe-scite.properties b/Master/texmf-dist/context/data/scite/cont-pe-scite.properties index a1769572557..c89f52b8f20 100644 --- a/Master/texmf-dist/context/data/scite/cont-pe-scite.properties +++ b/Master/texmf-dist/context/data/scite/cont-pe-scite.properties @@ -1 +1 @@ -keywordclass.macros.context.pe=CAP Cap Caps Character Characters MONTH Romannumerals WEEKDAY WORD WORDS Word Words appendix cap chapter chem completecombinedlist completelistoffloats completelistofsorts completelistofsynonyms coupledregister crlf definebodyfontDEF definebodyfontREF definedfont definefontfeature definefonthandling definetypeface description enumeration framedtext indentation its labeling loadsorts loadsynonyms mapfontsize mediaeval name nextsection nocap overbar overbars overstrike overstrikes paragraph part placelistoffloats placelistofsorts placelistofsynonyms ran register reservefloat resettextcontent section seeregister setupcapitals setupfonthandling setupfontsynonym setupinterlinespace2 setuplistalternative setupurl sort startalignment startbuffer startbuffer startcolumns startcombination startdescription startdocument startenumeration startfigure startfloattext startformula startframedtext starthiding startitemgroup startlegend startline startlinecorrection startlinenumbering startlines startlocal startlocalenvironment startlocalfootnotes startmakeup startmarginblock startnamemakeup startnarrower startopposite startoverlay startoverview startparagraph startpositioning startpostponing startprofile startregister startsymbolset startsynchronization starttable starttables starttabulate starttyping startunpacked startتوضیح startتولید startحقیقت startخط‌حاشیه startخط‌متن startرنگ startفشرده startمحیط startمنوی‌پانل startمولفه startنسخه startنقل‌قول startپروژه startپس‌زمینه stopalignment stopbuffer stopbuffer stopcolumns stopcombination stopdescription stopdocument stopenumeration stopfigure stopfloattext stopformula stopframedtext stophiding stopitemgroup stoplegend stopline stoplinecorrection stoplinenumbering stoplines stoplocal stoplocalenvironment stoplocalfootnotes stopmakeup stopmarginblock stopnamemakeup stopnarrower stopopposite stopoverlay stopoverview stopparagraph stoppositioning stoppostponing stopprofile stopsymbolset stopsynchronization stoptable stoptables stoptabulate stoptyping stopunpacked stopتوضیح stopتولید stopحقیقت stopخط‌حاشیه stopخط‌متن stopرنگ stopفشرده stopمحیط stopمنوی‌پانل stopمولفه stopنسخه stopنقل‌قول stopپروژه stopپس‌زمینه sub subject subsection subsubject subsubsection subsubsubject synonym title tooltip typ underbar underbars useURL usedirectory آیتم آیتمها آینه اجباربلوکها از ازکارانداختن‌منوی‌پانل استفاده‌بلوکها استفاده‌دستخط‌تایپ استفاده‌رمزینه استفاده‌شکل‌خارجی استفاده‌فرمانها استفاده‌قطعه‌موزیک‌خارجی استفاده‌مدول استفاده‌مرجعها استفاده‌نمادها استفاده‌نوشتارخارجی استفاده‌ویژگیها استفاده‌پرونده‌خارجی استفاده‌پرونده‌دستخط‌تایپ استفاده‌پرونده‌های‌خارجی اعدادلاتین اما انتخاب‌برگ انتخاب‌بلوکها انتخاب‌نسخه انتقال‌به‌توری بارگذاری‌آرایش بارگذاری‌آیتمها بارگذاری‌ارجاع بارگذاری‌اندازه‌برگ بارگذاری‌باریکتر بارگذاری‌بافر بارگذاری‌بالا بارگذاری‌بخش بارگذاری‌بردباری بارگذاری‌برنامه‌ها بارگذاری‌برگ بارگذاری‌بست بارگذاری‌بلوک بارگذاری‌بلوکهای‌حاشیه بارگذاری‌بلوک‌بخش بارگذاری‌تایپ بارگذاری‌تایپ‌کردن بارگذاری‌تب بارگذاری‌ترتیب بارگذاری‌ترتیب بارگذاری‌ترکیب‌ها بارگذاری‌تطابق بارگذاری‌تعریف‌پانوشت بارگذاری‌تنظیم بارگذاری‌ته‌برگ بارگذاری‌تورفتگی بارگذاری‌تورفتگیها بارگذاری‌توضیح بارگذاری‌ثبت بارگذاری‌جدولها بارگذاری‌جدول‌بندی بارگذاری‌خالی بارگذاری‌خروجی بارگذاری‌خطها بارگذاری‌خطهای‌حاشیه بارگذاری‌خطهای‌سیاه بارگذاری‌خطهای‌متن بارگذاری‌خطها‌ی‌نازک بارگذاری‌درج‌درخطها بارگذاری‌درج‌مخالف بارگذاری‌درون‌حاشیه بارگذاری‌دوران بارگذاری‌دکمه‌ها بارگذاری‌راهنما بارگذاری‌رنگ بارگذاری‌رنگها بارگذاری‌زبان بارگذاری‌ستونها بارگذاری‌سر بارگذاری‌سربرگ بارگذاری‌سرها بارگذاری‌سیستم بارگذاری‌شرح بارگذاری‌شرح بارگذاری‌شرحها بارگذاری‌شماره‌زیرصفحه بارگذاری‌شماره‌سر بارگذاری‌شماره‌صفحه بارگذاری‌شماره‌گذاری بارگذاری‌شماره‌گذاریها بارگذاری‌شماره‌گذاری‌صفحه بارگذاری‌شماره‌گذاری‌پاراگراف بارگذاری‌شماره‌‌گذاری‌خط بارگذاری‌شناور بارگذاری‌شناورها بارگذاری‌شکافتن‌شناورها بارگذاری‌شکلهای‌خارجی بارگذاری‌طرح بارگذاری‌طرح‌بندی بارگذاری‌عرض‌خط بارگذاری‌فاصله‌بین‌خط بارگذاری‌فرمولها بارگذاری‌فضای‌سفید بارگذاری‌فضا‌گذاری بارگذاری‌قالبی بارگذاری‌قلم‌متن بارگذاری‌لوح بارگذاری‌لیست بارگذاری‌لیست‌ترکیبی بارگذاری‌لیست‌مرجع بارگذاری‌مترادفها بارگذاری‌متن بارگذاری‌متنهای‌بالا بارگذاری‌متن‌سر بارگذاری‌متن‌سربرگ بارگذاری‌متن‌قالبی بارگذاری‌متن‌متنها بارگذاری‌متن‌پانوشت بارگذاری‌متن‌پایین بارگذاری‌مجموعه‌نماد بارگذاری‌محیط‌قلم‌متن بارگذاری‌منوی‌پانل بارگذاری‌مکان‌گذاری بارگذاری‌میدان بارگذاری‌میدانها بارگذاری‌میله‌تطابق بارگذاری‌میله‌زیر بارگذاری‌میله‌پانل بارگذاری‌نسخه‌ها بارگذاری‌نشانه‌شکستن بارگذاری‌نشانه‌گذاری بارگذاری‌نشرها بارگذاری‌نقل بارگذاری‌پاراگرافها بارگذاری‌پانل بارگذاری‌پانوشتها بارگذاری‌پایین بارگذاری‌پرده‌ها بارگذاری‌پرده‌پانل بارگذاری‌پروفایلها بارگذاری‌پرکردن‌خطها بارگذاری‌پس‌زمینه بارگذاری‌پس‌زمینه‌ها بارگذاری‌چیدن بارگذاری‌گذارصفحه بارگذاری‌گروه‌آیتم بازنشانی بازنشانی‌نشانه‌گذاری باگذاری‌متن‌برچسب بدون‌بلوکهای‌بیشتر بدون‌تورفتگی بدون‌خط‌بالاوپایین بدون‌خط‌سروته‌برگ بدون‌فایلهای‌بیشتر بدون‌فضا بدون‌فضای‌سفید بدون‌لیست بدون‌نشانه‌گذاری برنامه بروبه بروبه‌جعبه بروپایین برچسبها بلند بلوکهای‌پردازش بلوکها‌پنهان بنویس‌بین‌لیست بنویس‌درثبت بنویس‌درلیست‌مرجع بنویس‌در‌لیست تاریخ تاریخ‌جاری تاریخ‌رجوع تایپ تایپ‌بافر تایپ‌پرونده تب ترجمه تطابق تعریف تعریف‌آرایش تعریف‌آرم تعریف‌الگوی‌جدول تعریف‌اندازه‌برگ تعریف‌بافر تعریف‌بخش تعریف‌برنامه تعریف‌برچسب تعریف‌بلوک تعریف‌بلوک‌بخش تعریف‌تایپ تعریف‌تایپ‌کردن تعریف‌تبدیل تعریف‌ترتیب تعریف‌توده‌میدان تعریف‌تورفتگی تعریف‌ثبت تعریف‌جدول‌بندی تعریف‌خالی تعریف‌خروجی تعریف‌رنگ تعریف‌زیرمیدان تعریف‌سر تعریف‌شرح تعریف‌شروع‌پایان تعریف‌شماره‌بندی تعریف‌شمایل‌مرجع تعریف‌شناور تعریف‌قالبی تعریف‌قلم تعریف‌قلم‌متن تعریف‌لوح تعریف‌لیست تعریف‌لیست‌ترکیبی تعریف‌لیست‌مرجع تعریف‌مترادفها تعریف‌مترادف‌قلم تعریف‌متن تعریف‌متن‌قالبی تعریف‌محیط‌قلم‌بدنه تعریف‌مرجع تعریف‌منوی‌پانل تعریف‌منوی‌پانل تعریف‌میدان تعریف‌نسخه تعریف‌نشانه‌گذاری تعریف‌نماد تعریف‌نمادشکل تعریف‌پاراگرافها تعریف‌پروفایل تعریف‌پوشش تعریف‌گروه‌رنگ تعیین‌شماره‌سر تعیین‌محتوای‌متن تعیین‌مشخصات‌لیست تغییربه‌قلم‌بدنه تنظیم‌راست تنظیم‌طرح‌بندی تنظیم‌وسط تورفتگی توری توضیح تک ثبت‌زوج ثبت‌کامل جداسازی‌نشانه‌گذاری حاش حرف حرفها حفظ‌بلوکها خالی خطهای‌سیاه خطهای‌نازک خطها‌خالی خط‌حاشیه خط‌سیاه خط‌متن خط‌مو خط‌نازک خ‌ا خ‌ع در درج‌آرمها درج‌ثبت درج‌ثبت درج‌درخط درج‌درخطها درج‌درمتن درج‌درمیدان درج‌در‌بالای‌یکدیگر درج‌در‌توری درج‌راهنما درج‌زیرفرمول درج‌شناور درج‌فرمول درج‌لیست درج‌لیست‌مختلط درج‌لیست‌مختلط درج‌لیست‌مرجع درج‌پانوشتها درج‌پانوشتهای‌موضعی درج‌چوب‌خط درج‌کنار‌به‌کنار درحاشیه درحاشیه‌دیگر درخارجی درخط درداخلی درراست درصفحه درقالبی درمورد درون درچپ دریافت‌بافر دریافت‌نشانه دوران دکمه دکمه‌پانل رج رجوع رنگ رنگ‌خاکستری روزهفته ریاضی زبان زبان‌اصلی ستون سر شماره‌سر شماره‌سرجاری شماره‌مبدل شماره‌ها شکافتن‌شناور شکل‌خارجی صفحه صفحه‌زوج صفحه‌پردازش عبوربلوکها فشرده فضا فضاهای‌ثابت فضای‌سفید فضای‌سفیدصحیح قالبی لوح‌مقایسه ماه متن‌برچسب متن‌حاشیه متن‌سر متن‌پانوشت مرجع مرجع‌صفحه مرجع‌متن مقایسه‌گروه‌رنگ مقیاس منفی مکان میدان میدانهای‌گزارش میدان‌شبیه‌سازی میدان‌پشته میدان‌کپی میله‌تطابق میله‌پانل نسخه نسخه‌نشانه نشانه‌گذاری نشانه‌گذاری‌زوج نشر نصب‌زبان نقطه‌ها نقل نقل‌قول نم نماد نمادلیست نمایش‌آرایش نمایش‌بارگذاریها نمایش‌بستها نمایش‌توری نمایش‌رنگ نمایش‌شکلهای‌خارجی نمایش‌طرح‌بندی نمایش‌قالب نمایش‌قلم‌بدنه نمایش‌لوح نمایش‌مجموعه‌علامت نمایش‌محیط‌قلم‌بدنه نمایش‌میدانها نمایش‌چاپ نمایش‌گروه‌رنگ نوشتارزوج نوع‌صفحه پابا پانوشت پایین پرده پرکردن‌میدان پس‌زمینه پیروی‌نسخه پیروی‌نسخه‌پروفایل پیروی‌پروفایل چوبخط چپ‌چین کاغذزوج کسر کشیده کلمه‌راست گیره یادداشت یک‌جا یک‌خط \ No newline at end of file +keywordclass.macros.context.pe=CAP Cap Caps Character Characters MONTH Romannumerals WEEKDAY WORD WORDS Word Words appendix cap chapter chem comment completecombinedlist completelistoffloats completelistofsorts completelistofsynonyms coupledregister crlf definebodyfontDEF definebodyfontREF definedfont definefontfeature definefonthandling definetypeface description enumeration framedtext indentation its labeling loadsorts loadsynonyms mapfontsize mediaeval name nextsection nocap overbar overbars overstrike overstrikes paragraph part placelistoffloats placelistofsorts placelistofsynonyms ran register reservefloat resettextcontent section seeregister setupcapitals setupfonthandling setupfontsynonym setupinterlinespace2 setuplistalternative setupurl sort startalignment startbuffer startbuffer startcolumns startcombination startcomment startdescription startdocument startenumeration startfigure startfloattext startformula startframedtext starthiding startitemgroup startlegend startline startlinecorrection startlinenumbering startlines startlocal startlocalenvironment startlocalfootnotes startmakeup startmarginblock startnamemakeup startnarrower startopposite startoverlay startoverview startparagraph startpositioning startpostponing startprofile startregister startsymbolset startsynchronization starttable starttables starttabulate starttyping startunpacked startتولید startحقیقت startخط‌حاشیه startخط‌متن startرنگ startفشرده startمحیط startمنوی‌پانل startمولفه startنسخه startنقل‌قول startپروژه startپس‌زمینه stopalignment stopbuffer stopbuffer stopcolumns stopcombination stopcomment stopdescription stopdocument stopenumeration stopfigure stopfloattext stopformula stopframedtext stophiding stopitemgroup stoplegend stopline stoplinecorrection stoplinenumbering stoplines stoplocal stoplocalenvironment stoplocalfootnotes stopmakeup stopmarginblock stopnamemakeup stopnarrower stopopposite stopoverlay stopoverview stopparagraph stoppositioning stoppostponing stopprofile stopsymbolset stopsynchronization stoptable stoptables stoptabulate stoptyping stopunpacked stopتولید stopحقیقت stopخط‌حاشیه stopخط‌متن stopرنگ stopفشرده stopمحیط stopمنوی‌پانل stopمولفه stopنسخه stopنقل‌قول stopپروژه stopپس‌زمینه sub subject subsection subsubject subsubsection subsubsubject synonym title tooltip typ underbar underbars useURL usedirectory آیتم آیتمها آینه اجباربلوکها از ازکارانداختن‌منوی‌پانل استفاده‌بلوکها استفاده‌دستخط‌تایپ استفاده‌رمزینه استفاده‌شکل‌خارجی استفاده‌فرمانها استفاده‌قطعه‌موزیک‌خارجی استفاده‌مدول استفاده‌مرجعها استفاده‌نمادها استفاده‌نوشتارخارجی استفاده‌ویژگیها استفاده‌پرونده‌خارجی استفاده‌پرونده‌دستخط‌تایپ استفاده‌پرونده‌های‌خارجی اعدادلاتین اما انتخاب‌برگ انتخاب‌بلوکها انتخاب‌نسخه انتقال‌به‌توری بارگذاری‌آرایش بارگذاری‌آیتمها بارگذاری‌ارجاع بارگذاری‌اندازه‌برگ بارگذاری‌باریکتر بارگذاری‌بافر بارگذاری‌بالا بارگذاری‌بخش بارگذاری‌بردباری بارگذاری‌برنامه‌ها بارگذاری‌برگ بارگذاری‌بست بارگذاری‌بلوک بارگذاری‌بلوکهای‌حاشیه بارگذاری‌بلوک‌بخش بارگذاری‌تایپ بارگذاری‌تایپ‌کردن بارگذاری‌تب بارگذاری‌ترتیب بارگذاری‌ترتیب بارگذاری‌ترکیب‌ها بارگذاری‌تطابق بارگذاری‌تعریف‌پانوشت بارگذاری‌تنظیم بارگذاری‌ته‌برگ بارگذاری‌تورفتگی بارگذاری‌تورفتگیها بارگذاری‌توضیح بارگذاری‌ثبت بارگذاری‌جدولها بارگذاری‌جدول‌بندی بارگذاری‌خالی بارگذاری‌خروجی بارگذاری‌خطها بارگذاری‌خطهای‌حاشیه بارگذاری‌خطهای‌سیاه بارگذاری‌خطهای‌متن بارگذاری‌خطها‌ی‌نازک بارگذاری‌درج‌درخطها بارگذاری‌درج‌مخالف بارگذاری‌درون‌حاشیه بارگذاری‌دوران بارگذاری‌دکمه‌ها بارگذاری‌راهنما بارگذاری‌رنگ بارگذاری‌رنگها بارگذاری‌زبان بارگذاری‌ستونها بارگذاری‌سر بارگذاری‌سربرگ بارگذاری‌سرها بارگذاری‌سیستم بارگذاری‌شرح بارگذاری‌شرح بارگذاری‌شرحها بارگذاری‌شماره‌زیرصفحه بارگذاری‌شماره‌سر بارگذاری‌شماره‌صفحه بارگذاری‌شماره‌گذاری بارگذاری‌شماره‌گذاریها بارگذاری‌شماره‌گذاری‌صفحه بارگذاری‌شماره‌گذاری‌پاراگراف بارگذاری‌شماره‌‌گذاری‌خط بارگذاری‌شناور بارگذاری‌شناورها بارگذاری‌شکافتن‌شناورها بارگذاری‌شکلهای‌خارجی بارگذاری‌طرح بارگذاری‌طرح‌بندی بارگذاری‌عرض‌خط بارگذاری‌فاصله‌بین‌خط بارگذاری‌فرمولها بارگذاری‌فضای‌سفید بارگذاری‌فضا‌گذاری بارگذاری‌قالبی بارگذاری‌قلم‌متن بارگذاری‌لوح بارگذاری‌لیست بارگذاری‌لیست‌ترکیبی بارگذاری‌لیست‌مرجع بارگذاری‌مترادفها بارگذاری‌متن بارگذاری‌متنهای‌بالا بارگذاری‌متن‌سر بارگذاری‌متن‌سربرگ بارگذاری‌متن‌قالبی بارگذاری‌متن‌متنها بارگذاری‌متن‌پانوشت بارگذاری‌متن‌پایین بارگذاری‌مجموعه‌نماد بارگذاری‌محیط‌قلم‌متن بارگذاری‌منوی‌پانل بارگذاری‌مکان‌گذاری بارگذاری‌میدان بارگذاری‌میدانها بارگذاری‌میله‌تطابق بارگذاری‌میله‌زیر بارگذاری‌میله‌پانل بارگذاری‌نسخه‌ها بارگذاری‌نشانه‌شکستن بارگذاری‌نشانه‌گذاری بارگذاری‌نشرها بارگذاری‌نقل بارگذاری‌پاراگرافها بارگذاری‌پانل بارگذاری‌پانوشتها بارگذاری‌پایین بارگذاری‌پرده‌ها بارگذاری‌پرده‌پانل بارگذاری‌پروفایلها بارگذاری‌پرکردن‌خطها بارگذاری‌پس‌زمینه بارگذاری‌پس‌زمینه‌ها بارگذاری‌چیدن بارگذاری‌گذارصفحه بارگذاری‌گروه‌آیتم بازنشانی بازنشانی‌نشانه‌گذاری باگذاری‌متن‌برچسب بدون‌بلوکهای‌بیشتر بدون‌تورفتگی بدون‌خط‌بالاوپایین بدون‌خط‌سروته‌برگ بدون‌فایلهای‌بیشتر بدون‌فضا بدون‌فضای‌سفید بدون‌لیست بدون‌نشانه‌گذاری برنامه بروبه بروبه‌جعبه بروپایین برچسبها بلند بلوکهای‌پردازش بلوکها‌پنهان بنویس‌بین‌لیست بنویس‌درثبت بنویس‌درلیست‌مرجع بنویس‌در‌لیست تاریخ تاریخ‌جاری تاریخ‌رجوع تایپ تایپ‌بافر تایپ‌پرونده تب ترجمه تطابق تعریف تعریف‌آرایش تعریف‌آرم تعریف‌الگوی‌جدول تعریف‌اندازه‌برگ تعریف‌بافر تعریف‌بخش تعریف‌برنامه تعریف‌برچسب تعریف‌بلوک تعریف‌بلوک‌بخش تعریف‌تایپ تعریف‌تایپ‌کردن تعریف‌تبدیل تعریف‌ترتیب تعریف‌توده‌میدان تعریف‌تورفتگی تعریف‌ثبت تعریف‌جدول‌بندی تعریف‌خالی تعریف‌خروجی تعریف‌رنگ تعریف‌زیرمیدان تعریف‌سر تعریف‌شرح تعریف‌شروع‌پایان تعریف‌شماره‌بندی تعریف‌شمایل‌مرجع تعریف‌شناور تعریف‌قالبی تعریف‌قلم تعریف‌قلم‌متن تعریف‌لوح تعریف‌لیست تعریف‌لیست‌ترکیبی تعریف‌لیست‌مرجع تعریف‌مترادفها تعریف‌مترادف‌قلم تعریف‌متن تعریف‌متن‌قالبی تعریف‌محیط‌قلم‌بدنه تعریف‌مرجع تعریف‌منوی‌پانل تعریف‌منوی‌پانل تعریف‌میدان تعریف‌نسخه تعریف‌نشانه‌گذاری تعریف‌نماد تعریف‌نمادشکل تعریف‌پاراگرافها تعریف‌پروفایل تعریف‌پوشش تعریف‌گروه‌رنگ تعیین‌شماره‌سر تعیین‌محتوای‌متن تعیین‌مشخصات‌لیست تغییربه‌قلم‌بدنه تنظیم‌راست تنظیم‌طرح‌بندی تنظیم‌وسط تورفتگی توری تک ثبت‌زوج ثبت‌کامل جداسازی‌نشانه‌گذاری حاش حرف حرفها حفظ‌بلوکها خالی خطهای‌سیاه خطهای‌نازک خطها‌خالی خط‌حاشیه خط‌سیاه خط‌متن خط‌مو خط‌نازک خ‌ا خ‌ع در درج‌آرمها درج‌ثبت درج‌ثبت درج‌درخط درج‌درخطها درج‌درمتن درج‌درمیدان درج‌در‌بالای‌یکدیگر درج‌در‌توری درج‌راهنما درج‌زیرفرمول درج‌شناور درج‌فرمول درج‌لیست درج‌لیست‌مختلط درج‌لیست‌مختلط درج‌لیست‌مرجع درج‌پانوشتها درج‌پانوشتهای‌موضعی درج‌چوب‌خط درج‌کنار‌به‌کنار درحاشیه درحاشیه‌دیگر درخارجی درخط درداخلی درراست درصفحه درقالبی درمورد درون درچپ دریافت‌بافر دریافت‌نشانه دوران دکمه دکمه‌پانل رج رجوع رنگ رنگ‌خاکستری روزهفته ریاضی زبان زبان‌اصلی ستون سر شماره‌سر شماره‌سرجاری شماره‌مبدل شماره‌ها شکافتن‌شناور شکل‌خارجی صفحه صفحه‌زوج صفحه‌پردازش عبوربلوکها فشرده فضا فضاهای‌ثابت فضای‌سفید فضای‌سفیدصحیح قالبی لوح‌مقایسه ماه متن‌برچسب متن‌حاشیه متن‌سر متن‌پانوشت مرجع مرجع‌صفحه مرجع‌متن مقایسه‌گروه‌رنگ مقیاس منفی مکان میدان میدانهای‌گزارش میدان‌شبیه‌سازی میدان‌پشته میدان‌کپی میله‌تطابق میله‌پانل نسخه نسخه‌نشانه نشانه‌گذاری نشانه‌گذاری‌زوج نشر نصب‌زبان نقطه‌ها نقل نقل‌قول نم نماد نمادلیست نمایش‌آرایش نمایش‌بارگذاریها نمایش‌بستها نمایش‌توری نمایش‌رنگ نمایش‌شکلهای‌خارجی نمایش‌طرح‌بندی نمایش‌قالب نمایش‌قلم‌بدنه نمایش‌لوح نمایش‌مجموعه‌علامت نمایش‌محیط‌قلم‌بدنه نمایش‌میدانها نمایش‌چاپ نمایش‌گروه‌رنگ نوشتارزوج نوع‌صفحه پابا پانوشت پایین پرده پرکردن‌میدان پس‌زمینه پیروی‌نسخه پیروی‌نسخه‌پروفایل پیروی‌پروفایل چوبخط چپ‌چین کاغذزوج کسر کشیده کلمه‌راست گیره یادداشت یک‌جا یک‌خط \ No newline at end of file diff --git a/Master/texmf-dist/context/data/scite/cont-ro-scite.properties b/Master/texmf-dist/context/data/scite/cont-ro-scite.properties index 47fd2b9c3ce..3f9cc57e160 100644 --- a/Master/texmf-dist/context/data/scite/cont-ro-scite.properties +++ b/Master/texmf-dist/context/data/scite/cont-ro-scite.properties @@ -1 +1 @@ -keywordclass.macros.context.ro=CAP CUVANT CUVINTE Cap Caps Cuvant Cuvinte LUNA Litera Litere Numereromane ZIDINSAPTAMANA adapteazaaspect adubuffer adumarcaje afiseazaaspect afiseazacampuri afiseazaculoare afiseazafiguriexterne afiseazafonttext afiseazagrid afiseazagrupculoare afiseazamakeup afiseazamediufonttext afiseazapaleta afiseazarama afiseazasetari afiseazasetsimboluri afiseazastruts afiseazatiparire aliniat aliniatcentru aliniatdreapta aliniatstanga appendix ascundeblocuri barainteractiune barasincronizare blanc but butoaneinteractiune buton camp campumplere cap chapter chem citat clip cloneazacamp coloana comentariu comparagrupculoare comparapaleta completecombinedlist completelistoffloats completelistofsorts completelistofsynonyms completeregister convertestenumar copiazacamp corecteazaspatiualb coupledregister crlf culoare culoaregri cupleazadocument cupleazamarcaje cupleazaregistru cuvantdreapta data datacurenta datareferit decupleazamarcaje definebodyfontDEF definebodyfontREF definedfont definefontfeature definefonthandling defineste definestealiat definesteantet definesteblanc definestebloc definesteblocsectiune definestebuffer definestecamp definesteconversie definesteculoare definestedescriere definestedimensiunehartie definesteenumerare definesteeticheta definestefloat definestefont definestefonttext definesteformatreferinte definestegrupculori definesteinconjurare definestelista definestelistacombinata definestelistareferinte definestelogo definestemakeup definestemarcaje definestemediulfonttext definestemeniuinteractiune definestemeniuinteractiune definesteoutput definesteoverlay definestepaleta definesteparagraf definesteprofil definesteprogram definestereferinte definesteregistru definestesablontabel definestesectiune definestesimbol definestesimbolfigura definestesinonim definestesinonimfont definestesortare definestestartstop definestestivacampuri definestesubcamp definestetabulatori definestetext definestetexteinconjurate definestetextinconjurat definestetyping definesteversiune definetype definetypeface description despre determinacaracteristicilelistei determinanumartitlu dezactiveazameniuinteractiune din dute dutebox ecran el element element emptylines enumeration etichete faraaliniat farafisiere faraliniiantetsisubsol faraliniisussijos faralista faramarcaje faraspatiu faraspatiualb figuraexterna firdepar folosesteURL folosestebloc folosestecodificarea folosestecomenzi folosestedocumentextern folosestefiguraexterna folosestefisiereexterne folosestefisierextern folosestemodul folosestemuzicaexterna folosestereferinte folosestesimboluri folosestespeciale footnotetext forteazablocuri fractie framed framedtext fundal gatablocuri grid hartiedubla hl impachetat impartefloat in inalt inaltamargine indentation indreapta inframed ininner injos inlinie inouter instalarelimba instanga intins jos jossus la labeling lapagina limba limbaprincipala liniemargine linieneagra liniesubtire linieumplere liniinegre liniisubtiri listsymbol litera litere loadsorts loadsynonyms logcampuri luna mapfontsize mar marcaje marcheazaversiune marginal matematica mediaeval minicitat mutapegrid name nextsection nocap nop nota notasubsol numartitlu numartitlucurent numere numereromane olinie overbar overbars overstrike overstrikes pagina paginadubla paragraph part pastreazablocuri placefloat placelistoffloats placelistofsorts placelistofsynonyms placereferencelist plaseazapegrid plaseazasemnecarte potrivestecamp pozitie proceseazabloc proceseazapagina program publicatie puncte punedeasuprafiecareia punefatainfata puneformula punelegenda punelista punelistacombinata punelistacombinata punelogouri punenotesubsol punenotesubsollocale puneregistru puneregistru punesubformula ran ref referinta referintapagina referintatext referit reflexie register reservefloat reset reseteazamarcaje resettextcontent riglatext rigleumplere roteste saripesteblocuri scala scriebuffer scrieinlista scrieinlistareferinte scrieinregistru scrieintreliste section seeregister selecteazablocuri selecteazahartie selecteazaversiune semncarte setarebarasincronizare setarelimba setareoutput setarepozitie setaresincronizare seteazaaliniat seteazaaliniate seteazaalinierea seteazaantet seteazaaranjareapag seteazaaspect seteazabarainteractiune seteazablanc seteazabloc seteazablocsectiune seteazablocurimarginale seteazabuffer seteazabutoane seteazacamp seteazacampuri seteazaclipping seteazacoloane seteazacombinari seteazacomentariu seteazaculoare seteazaculori seteazadefinireanotasubsol seteazadescriere seteazadimensiunihartie seteazaecrane seteazaecraninteractiune seteazaelemente seteazaenumerare seteazafiguriexterne seteazafloat seteazafloats seteazafonttext seteazaformulare seteazaformule seteazafundal seteazafundaluri seteazagrosimelinie seteazaimpartireafloat seteazainconjurat seteazaingust seteazainteractiunea seteazajos seteazalegenda seteazalegenda seteazalegendele seteazaliniesilabe seteazaliniesubtire seteazalinii seteazaliniimargine seteazaliniinegre seteazaliniiumplere seteazalista seteazalistacombinata seteazalistareferinte seteazamajuscule seteazamakeup seteazamarcaje seteazamarginal seteazamediulfonttext seteazameniuinteractiune seteazaminicitat seteazanotasubsol seteazanumarpagina seteazanumarsubpagina seteazanumartitlu seteazanumerotare seteazanumerotarelinii seteazanumerotarepagina seteazanumerotareparagrafe seteazapaleta seteazaparagrafe seteazaplasareaopozita seteazaprofile seteazaprograme seteazapublicatii seteazareferinte seteazaregistru seteazarigletext seteazarigleumplere seteazarotare seteazasectiune seteazasimbol seteazasinonime seteazasistem seteazasortare seteazaspatiu seteazaspatiualb seteazaspatiuinterliniar seteazastrut seteazasublinie seteazasubsol seteazasus seteazatab seteazatabele seteazatabulatori seteazatext seteazatexteantet seteazatextejos seteazatextesubsol seteazatextesus seteazatextetext seteazatexteticheta seteazatexttitlu seteazatitlu seteazatitluri seteazatoleranta seteazatranzitiepagina seteazatype seteazatyping seteazaurl seteazaversiuni settextcontent setupfonthandling setupfontsynonym setupinterlinespace2 setupitemgroup setuplistalternative setuppaper sim simbol sincronizeaza sort spatiifixate spatiu spatiualb startalignment startbuffer startbuffer startcitat startcolumns startcombination startcomentariu startcomponenta startculoare startdescription startdocument startenumeration startfact startfigure startfloattext startformula startframedtext startfundal starthiding startimpachetat startitemgroup startlegend startline startlinecorrection startlinenumbering startlines startliniemargine startlocal startlocalenvironment startlocalfootnotes startmakeup startmarginblock startmediu startmeniuinteractiune startnamemakeup startnarrower startopposite startoverlay startoverview startparagraph startpositioning startpostponing startprodus startprofile startproiect startregister startriglatext startsymbolset startsynchronization starttable starttables starttabulate starttyping startunpacked startversiune stivacampuri stopalignment stopbuffer stopbuffer stopcitat stopcolumns stopcombination stopcomentariu stopcomponenta stopculoare stopdescription stopdocument stopenumeration stopfact stopfigure stopfloattext stopformula stopframedtext stopfundal stophiding stopimpachetat stopitemgroup stoplegend stopline stoplinecorrection stoplinenumbering stoplines stopliniemargine stoplocal stoplocalenvironment stoplocalfootnotes stopmakeup stopmarginblock stopmediu stopmeniuinteractiune stopnamemakeup stopnarrower stopopposite stopoverlay stopoverview stopparagraph stoppositioning stoppostponing stopprodus stopprofile stopproiect stopriglatext stopsymbolset stopsynchronization stoptable stoptables stoptabulate stoptyping stopunpacked stopversiune sub subject subsection subsubject subsubsection subsubsubject synonym tab tex texteticheta textmarginal texttitlu textumplere tippagina title titlu tooltip traduce trecilafonttext typ type typefile underbar underbars undeva urmeazaprofil urmeazaversiune urmeazaversiuneprofil usedirectory usetypescript usetypescriptfile versiune vl zidinsaptamana \ No newline at end of file +keywordclass.macros.context.ro=CAP CUVANT CUVINTE Cap Caps Cuvant Cuvinte LUNA Litera Litere Numereromane ZIDINSAPTAMANA adapteazaaspect adubuffer adumarcaje afiseazaaspect afiseazacampuri afiseazaculoare afiseazafiguriexterne afiseazafonttext afiseazagrid afiseazagrupculoare afiseazamakeup afiseazamediufonttext afiseazapaleta afiseazarama afiseazasetari afiseazasetsimboluri afiseazastruts afiseazatiparire aliniat aliniatcentru aliniatdreapta aliniatstanga appendix ascundeblocuri barainteractiune barasincronizare blanc but butoaneinteractiune buton camp campumplere cap chapter chem citat clip cloneazacamp coloana comment comparagrupculoare comparapaleta completecombinedlist completelistoffloats completelistofsorts completelistofsynonyms completeregister convertestenumar copiazacamp corecteazaspatiualb coupledregister crlf culoare culoaregri cupleazadocument cupleazamarcaje cupleazaregistru cuvantdreapta data datacurenta datareferit decupleazamarcaje definebodyfontDEF definebodyfontREF definedfont definefontfeature definefonthandling defineste definestealiat definesteantet definesteblanc definestebloc definesteblocsectiune definestebuffer definestecamp definesteconversie definesteculoare definestedescriere definestedimensiunehartie definesteenumerare definesteeticheta definestefloat definestefont definestefonttext definesteformatreferinte definestegrupculori definesteinconjurare definestelista definestelistacombinata definestelistareferinte definestelogo definestemakeup definestemarcaje definestemediulfonttext definestemeniuinteractiune definestemeniuinteractiune definesteoutput definesteoverlay definestepaleta definesteparagraf definesteprofil definesteprogram definestereferinte definesteregistru definestesablontabel definestesectiune definestesimbol definestesimbolfigura definestesinonim definestesinonimfont definestesortare definestestartstop definestestivacampuri definestesubcamp definestetabulatori definestetext definestetexteinconjurate definestetextinconjurat definestetyping definesteversiune definetype definetypeface description despre determinacaracteristicilelistei determinanumartitlu dezactiveazameniuinteractiune din dute dutebox ecran el element element emptylines enumeration etichete faraaliniat farafisiere faraliniiantetsisubsol faraliniisussijos faralista faramarcaje faraspatiu faraspatiualb figuraexterna firdepar folosesteURL folosestebloc folosestecodificarea folosestecomenzi folosestedocumentextern folosestefiguraexterna folosestefisiereexterne folosestefisierextern folosestemodul folosestemuzicaexterna folosestereferinte folosestesimboluri folosestespeciale footnotetext forteazablocuri fractie framed framedtext fundal gatablocuri grid hartiedubla hl impachetat impartefloat in inalt inaltamargine indentation indreapta inframed ininner injos inlinie inouter instalarelimba instanga intins jos jossus la labeling lapagina limba limbaprincipala liniemargine linieneagra liniesubtire linieumplere liniinegre liniisubtiri listsymbol litera litere loadsorts loadsynonyms logcampuri luna mapfontsize mar marcaje marcheazaversiune marginal matematica mediaeval minicitat mutapegrid name nextsection nocap nop nota notasubsol numartitlu numartitlucurent numere numereromane olinie overbar overbars overstrike overstrikes pagina paginadubla paragraph part pastreazablocuri placefloat placelistoffloats placelistofsorts placelistofsynonyms placereferencelist plaseazapegrid plaseazasemnecarte potrivestecamp pozitie proceseazabloc proceseazapagina program publicatie puncte punedeasuprafiecareia punefatainfata puneformula punelegenda punelista punelistacombinata punelistacombinata punelogouri punenotesubsol punenotesubsollocale puneregistru puneregistru punesubformula ran ref referinta referintapagina referintatext referit reflexie register reservefloat reset reseteazamarcaje resettextcontent riglatext rigleumplere roteste saripesteblocuri scala scriebuffer scrieinlista scrieinlistareferinte scrieinregistru scrieintreliste section seeregister selecteazablocuri selecteazahartie selecteazaversiune semncarte setarebarasincronizare setarelimba setareoutput setarepozitie setaresincronizare seteazaaliniat seteazaaliniate seteazaalinierea seteazaantet seteazaaranjareapag seteazaaspect seteazabarainteractiune seteazablanc seteazabloc seteazablocsectiune seteazablocurimarginale seteazabuffer seteazabutoane seteazacamp seteazacampuri seteazaclipping seteazacoloane seteazacombinari seteazacomentariu seteazaculoare seteazaculori seteazadefinireanotasubsol seteazadescriere seteazadimensiunihartie seteazaecrane seteazaecraninteractiune seteazaelemente seteazaenumerare seteazafiguriexterne seteazafloat seteazafloats seteazafonttext seteazaformulare seteazaformule seteazafundal seteazafundaluri seteazagrosimelinie seteazaimpartireafloat seteazainconjurat seteazaingust seteazainteractiunea seteazajos seteazalegenda seteazalegenda seteazalegendele seteazaliniesilabe seteazaliniesubtire seteazalinii seteazaliniimargine seteazaliniinegre seteazaliniiumplere seteazalista seteazalistacombinata seteazalistareferinte seteazamajuscule seteazamakeup seteazamarcaje seteazamarginal seteazamediulfonttext seteazameniuinteractiune seteazaminicitat seteazanotasubsol seteazanumarpagina seteazanumarsubpagina seteazanumartitlu seteazanumerotare seteazanumerotarelinii seteazanumerotarepagina seteazanumerotareparagrafe seteazapaleta seteazaparagrafe seteazaplasareaopozita seteazaprofile seteazaprograme seteazapublicatii seteazareferinte seteazaregistru seteazarigletext seteazarigleumplere seteazarotare seteazasectiune seteazasimbol seteazasinonime seteazasistem seteazasortare seteazaspatiu seteazaspatiualb seteazaspatiuinterliniar seteazastrut seteazasublinie seteazasubsol seteazasus seteazatab seteazatabele seteazatabulatori seteazatext seteazatexteantet seteazatextejos seteazatextesubsol seteazatextesus seteazatextetext seteazatexteticheta seteazatexttitlu seteazatitlu seteazatitluri seteazatoleranta seteazatranzitiepagina seteazatype seteazatyping seteazaurl seteazaversiuni settextcontent setupfonthandling setupfontsynonym setupinterlinespace2 setupitemgroup setuplistalternative setuppaper sim simbol sincronizeaza sort spatiifixate spatiu spatiualb startalignment startbuffer startbuffer startcitat startcolumns startcombination startcomment startcomponenta startculoare startdescription startdocument startenumeration startfact startfigure startfloattext startformula startframedtext startfundal starthiding startimpachetat startitemgroup startlegend startline startlinecorrection startlinenumbering startlines startliniemargine startlocal startlocalenvironment startlocalfootnotes startmakeup startmarginblock startmediu startmeniuinteractiune startnamemakeup startnarrower startopposite startoverlay startoverview startparagraph startpositioning startpostponing startprodus startprofile startproiect startregister startriglatext startsymbolset startsynchronization starttable starttables starttabulate starttyping startunpacked startversiune stivacampuri stopalignment stopbuffer stopbuffer stopcitat stopcolumns stopcombination stopcomment stopcomponenta stopculoare stopdescription stopdocument stopenumeration stopfact stopfigure stopfloattext stopformula stopframedtext stopfundal stophiding stopimpachetat stopitemgroup stoplegend stopline stoplinecorrection stoplinenumbering stoplines stopliniemargine stoplocal stoplocalenvironment stoplocalfootnotes stopmakeup stopmarginblock stopmediu stopmeniuinteractiune stopnamemakeup stopnarrower stopopposite stopoverlay stopoverview stopparagraph stoppositioning stoppostponing stopprodus stopprofile stopproiect stopriglatext stopsymbolset stopsynchronization stoptable stoptables stoptabulate stoptyping stopunpacked stopversiune sub subject subsection subsubject subsubsection subsubsubject synonym tab tex texteticheta textmarginal texttitlu textumplere tippagina title titlu tooltip traduce trecilafonttext typ type typefile underbar underbars undeva urmeazaprofil urmeazaversiune urmeazaversiuneprofil usedirectory usetypescript usetypescriptfile versiune vl zidinsaptamana \ No newline at end of file diff --git a/Master/texmf-dist/context/data/scite/context.properties b/Master/texmf-dist/context/data/scite/context.properties index 13fa079c02e..006cfe64071 100644 --- a/Master/texmf-dist/context/data/scite/context.properties +++ b/Master/texmf-dist/context/data/scite/context.properties @@ -39,7 +39,7 @@ textwrapper.length=68 file.patterns.tex= file.patterns.latex= -file.patterns.context=*.tex;*.tui;*.tuo;*.sty;*.mkii;*.mkiv; +file.patterns.context=*.tex;*.tui;*.tuo;*.sty;*.mkii;*.mkiv;*.mkvi; # ConTeXt : keywords (if not yet loaded already) diff --git a/Master/texmf-dist/context/data/textpad/textpad-context-template.txt b/Master/texmf-dist/context/data/textpad/textpad-context-template.txt new file mode 100644 index 00000000000..48d0b86f9e0 --- /dev/null +++ b/Master/texmf-dist/context/data/textpad/textpad-context-template.txt @@ -0,0 +1,54 @@ +; TextPad syntax definitions for ConTeXt (and LaTeX, respectively) + +LaTeX=1 + +[Syntax] +Namespace1=6 +IgnoreCase=No +InitKeyWordChars=\abcdefghijklmopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ +KeyWordChars=A-Za-z0-9@*'`! +BracketChars={}[]() +OperatorChars=-+*/<>!~%^&|= +PreprocStart= +SyntaxStart= +SyntaxEnd= +CommentStart= +CommentEnd= +CommentStartAlt=$ +CommentEndAlt=$ +SingleComment=% +SingleCommentCol= +SingleCommentAlt= +SingleCommentColAlt= +SingleCommentEsc=\ +StringStart= +StringEnd= +StringAlt= +StringEsc= +CharStart= +CharEnd= +CharEsc= + +[Keywords 1] +; category: tex commands +; filename: tex-commands.txt + +[Keywords 2] +; category: context commands +; filename: context-commands-en.txt + +[Keywords 3] +; category: context commands +; filename: context-environments-en.txt + +[Keywords 4] +; category: latex commands +; filename: latex-commands-1.txt + +[Keywords 5] +; category: latex commands +; filename: latex-commands-2.txt + +[Keywords 6] +; category: latex commands +; filename: latex-commands-3.txt diff --git a/Master/texmf-dist/fonts/afm/jmn/hans/hans-sh.afm b/Master/texmf-dist/fonts/afm/jmn/hans/hans-sh.afm index c6ed33788e5..f6d899922b8 100644 --- a/Master/texmf-dist/fonts/afm/jmn/hans/hans-sh.afm +++ b/Master/texmf-dist/fonts/afm/jmn/hans/hans-sh.afm @@ -1,188 +1,164 @@ StartFontMetrics 2.0 Generated by MetaType1 (a MetaPost-based engine) -Comment Creation Date: 20.08.2004 +Comment Creation Date: 19.08.2004 Notice Design by Janusz M. Nowacki, 2004. -FontName Hans-SH-Regular -FullName Hans-SH-Regular -FamilyName Hans-SH +FontName Hans-sh-Regular +FullName Hans-sh-Regular +FamilyName Hans-sh Weight Normal ItalicAngle 0 IsFixedPitch false UnderlinePosition -200 UnderlineThickness 40 -Version 1.000 +Version 1.0 EncodingScheme FontSpecific -FontBBox -2 -459 1405 939 -CapHeight 502 -XHeight 410 -Descender 70 -Ascender 535 +FontBBox 0 -469 1420 939 +CapHeight 700 +XHeight 500 +Descender -200 +Ascender 700 Comment TFM designsize: 10 (in points) Comment TFM fontdimen 1: 0 (slant) Comment TFM fontdimen 2: 3.33 (space) Comment TFM fontdimen 3: 1.67 (space stretch) Comment TFM fontdimen 4: 1.11 (space shrink) -Comment TFM fontdimen 5: 4.1 (xheight) +Comment TFM fontdimen 5: 5 (xheight) Comment TFM fontdimen 6: 10 (quad) Comment TFM fontdimen 7: 1.11 (extra space) Comment TFM fontdimen 8: 0.4 (math rule) Comment TFM fontdimen 22: 2.5 (math axis) Comment TFM headerbyte 9: FontSpecific -Comment TFM headerbyte 49: Hans-SH +Comment TFM headerbyte 49: Hans-sh Comment TFM headerbyte 72: 234 -StartCharMetrics 153 +StartCharMetrics 129 C 32 ; WX 333 ; N space ; B 0 0 0 0 ; -C 64 ; WX 580 ; N at ; B 25 -35 575 515 ; -C 65 ; WX 620 ; N A ; B 25 -55 615 535 ; L A AA ; L at A.alt ; -C 66 ; WX 620 ; N B ; B 25 -55 615 535 ; L B BB ; L at B.alt ; -C 67 ; WX 620 ; N C ; B 25 -55 615 535 ; L C CC ; L at C.alt ; -C 68 ; WX 620 ; N D ; B 25 -55 615 535 ; L D DD ; L at D.alt ; -C 69 ; WX 645 ; N E ; B 7 -76 640 556 ; L E EE ; L at E.alt ; -C 70 ; WX 645 ; N F ; B 25 -76 658 556 ; L F FF ; L at F.alt ; -C 71 ; WX 645 ; N G ; B 7 -76 640 556 ; L G GG ; L at G.alt ; -C 72 ; WX 645 ; N H ; B 25 -76 658 556 ; L H HH ; L at H.alt ; -C 73 ; WX 652 ; N I ; B -2 -56 651 536 ; L I II ; L at I.alt ; -C 74 ; WX 652 ; N J ; B 20 -56 637 536 ; L J JJ ; L at J.alt ; -C 75 ; WX 652 ; N K ; B -2 -56 651 536 ; L K KK ; L at K.alt ; -C 76 ; WX 652 ; N L ; B 20 -56 637 536 ; L L LL ; L at L.alt ; -C 77 ; WX 370 ; N M ; B 25 70 365 410 ; L M MM ; -C 78 ; WX 370 ; N N ; B 25 70 365 410 ; L N NN ; -C 79 ; WX 370 ; N O ; B 25 70 365 410 ; L O OO ; -C 80 ; WX 370 ; N P ; B 25 70 365 410 ; L P PP ; -C 81 ; WX 370 ; N Q ; B 25 70 365 410 ; L Q QQ ; -C 82 ; WX 370 ; N R ; B 25 70 365 410 ; L R RR ; -C 83 ; WX 370 ; N S ; B 25 70 365 410 ; L S SS ; -C 84 ; WX 358 ; N T ; B 18 69 360 411 ; L T TT ; -C 85 ; WX 370 ; N U ; B 25 70 365 410 ; L U UU ; -C 86 ; WX 370 ; N V ; B 25 70 365 410 ; L V VV ; -C 87 ; WX 474 ; N W ; B 24 17 470 463 ; L W WW ; -C 88 ; WX 474 ; N X ; B 24 17 470 463 ; L X XX ; -C 89 ; WX 490 ; N Y ; B 18 3 492 477 ; L Y YY ; -C 90 ; WX 490 ; N Z ; B 18 3 492 477 ; L Z ZZ ; -C 97 ; WX 620 ; N a ; B 25 -55 615 535 ; L a aa ; -C 98 ; WX 620 ; N b ; B 25 -55 615 535 ; L b bb ; -C 99 ; WX 620 ; N c ; B 25 -55 615 535 ; L c cc ; -C 100 ; WX 620 ; N d ; B 25 -55 615 535 ; L d dd ; -C 101 ; WX 645 ; N e ; B 16 -67 649 565 ; L e ee ; -C 102 ; WX 645 ; N f ; B 16 -85 649 547 ; L f ff ; -C 103 ; WX 645 ; N g ; B 16 -67 649 565 ; L g gg ; -C 104 ; WX 645 ; N h ; B 16 -85 649 547 ; L h hh ; -C 105 ; WX 614 ; N i ; B 21 -76 613 578 ; L i ii ; -C 106 ; WX 614 ; N j ; B 21 -98 607 556 ; L j jj ; -C 107 ; WX 614 ; N k ; B 21 -76 613 578 ; L k kk ; -C 108 ; WX 614 ; N l ; B 21 -98 607 556 ; L l ll ; -C 109 ; WX 370 ; N m ; B 25 70 365 410 ; L m mm ; -C 110 ; WX 370 ; N n ; B 25 70 365 410 ; L n nn ; -C 111 ; WX 370 ; N o ; B 25 70 365 410 ; L o oo ; -C 112 ; WX 370 ; N p ; B 25 70 365 410 ; L p pp ; -C 113 ; WX 745 ; N q ; B 25 -55 740 535 ; -C 114 ; WX 745 ; N r ; B 25 -55 740 535 ; -C 115 ; WX 745 ; N s ; B 25 -55 740 535 ; -C 116 ; WX 745 ; N t ; B 25 -55 740 535 ; -C 117 ; WX 745 ; N u ; B 25 -76 740 556 ; -C 118 ; WX 745 ; N v ; B 25 -76 740 556 ; -C 119 ; WX 745 ; N w ; B 25 -76 740 556 ; -C 120 ; WX 745 ; N x ; B 25 -76 740 556 ; L x xx ; -C 121 ; WX 741 ; N y ; B 25 -56 740 536 ; -C 122 ; WX 741 ; N z ; B 20 -56 736 536 ; L z zz ; -C 128 ; WX 995 ; N AA ; B 25 -55 990 535 ; L A AAA ; -C 129 ; WX 1367 ; N AAA ; B 25 -55 1362 535 ; -C 130 ; WX 995 ; N BB ; B 25 -55 990 535 ; L B BBB ; -C 131 ; WX 1367 ; N BBB ; B 25 -55 1362 535 ; -C 132 ; WX 995 ; N CC ; B 25 -55 990 535 ; L C CCC ; -C 133 ; WX 1367 ; N CCC ; B 25 -55 1362 535 ; -C 134 ; WX 995 ; N DD ; B 25 -55 990 535 ; L D DDD ; -C 135 ; WX 1367 ; N DDD ; B 25 -55 1362 535 ; -C 136 ; WX 1020 ; N EE ; B 7 -76 1015 556 ; L E EEE ; -C 137 ; WX 1391 ; N EEE ; B 7 -76 1387 556 ; -C 138 ; WX 1020 ; N FF ; B 25 -76 1033 556 ; L F FFF ; -C 139 ; WX 1391 ; N FFF ; B 25 -76 1405 556 ; -C 140 ; WX 1020 ; N GG ; B 7 -76 1015 556 ; L G GGG ; -C 141 ; WX 1391 ; N GGG ; B 7 -76 1387 556 ; -C 142 ; WX 1020 ; N HH ; B 25 -76 1033 556 ; L H HHH ; -C 143 ; WX 1391 ; N HHH ; B 25 -76 1405 556 ; -C 144 ; WX 985 ; N II ; B -2 -56 986 536 ; L I III ; -C 145 ; WX 1319 ; N III ; B -2 -56 1319 536 ; -C 146 ; WX 985 ; N JJ ; B 20 -56 971 536 ; L J JJJ ; -C 147 ; WX 1319 ; N JJJ ; B 20 -56 1304 536 ; -C 148 ; WX 985 ; N KK ; B -2 -56 986 536 ; L K KKK ; -C 149 ; WX 1319 ; N KKK ; B -2 -56 1319 536 ; -C 150 ; WX 985 ; N LL ; B 20 -56 971 536 ; L L LLL ; -C 151 ; WX 1319 ; N LLL ; B 20 -56 1304 536 ; -C 152 ; WX 620 ; N MM ; B 25 -55 615 535 ; L M MMM ; -C 153 ; WX 870 ; N MMM ; B 25 -180 865 660 ; -C 154 ; WX 620 ; N NN ; B 25 -55 615 535 ; L N NNN ; -C 155 ; WX 870 ; N NNN ; B 25 -180 865 660 ; -C 156 ; WX 620 ; N OO ; B 25 -55 615 535 ; L O OOO ; -C 157 ; WX 870 ; N OOO ; B 25 -180 865 660 ; -C 158 ; WX 620 ; N PP ; B 25 -55 615 535 ; L P PPP ; -C 159 ; WX 870 ; N PPP ; B 25 -180 865 660 ; -C 160 ; WX 620 ; N QQ ; B 25 -55 615 535 ; L Q QQQ ; -C 161 ; WX 870 ; N QQQ ; B 25 -180 865 660 ; -C 162 ; WX 620 ; N RR ; B 25 -55 615 535 ; L R RRR ; -C 163 ; WX 870 ; N RRR ; B 25 -180 865 660 ; -C 164 ; WX 620 ; N SS ; B 25 -55 615 535 ; L S SSS ; -C 165 ; WX 870 ; N SSS ; B 25 -180 865 660 ; -C 166 ; WX 608 ; N TT ; B 18 -56 610 536 ; L T TTT ; -C 167 ; WX 858 ; N TTT ; B 18 -181 860 661 ; -C 168 ; WX 620 ; N UU ; B 25 -55 615 535 ; L U UUU ; -C 169 ; WX 870 ; N UUU ; B 25 -180 865 660 ; -C 170 ; WX 620 ; N VV ; B 25 -55 615 535 ; L V VVV ; -C 171 ; WX 870 ; N VVV ; B 25 -180 865 660 ; -C 172 ; WX 827 ; N WW ; B 24 -160 824 640 ; L W WWW ; -C 173 ; WX 1181 ; N WWW ; B 24 -336 1176 816 ; -C 174 ; WX 827 ; N XX ; B 24 -160 824 640 ; L X XXX ; -C 175 ; WX 1181 ; N XXX ; B 24 -336 1176 816 ; -C 176 ; WX 844 ; N YY ; B 18 -174 846 654 ; L Y YYY ; -C 177 ; WX 1197 ; N YYY ; B 18 -351 1200 831 ; -C 178 ; WX 844 ; N ZZ ; B 18 -174 846 654 ; L Z ZZZ ; -C 179 ; WX 1197 ; N ZZZ ; B 18 -351 1200 831 ; -C 180 ; WX 620 ; N aa ; B 26 -242 616 723 ; L a aaa ; -C 181 ; WX 620 ; N aaa ; B 25 -428 615 908 ; -C 182 ; WX 620 ; N bb ; B 26 -242 616 723 ; L b bbb ; -C 183 ; WX 620 ; N bbb ; B 25 -428 615 908 ; -C 184 ; WX 620 ; N cc ; B 26 -242 616 723 ; L c ccc ; -C 185 ; WX 620 ; N ccc ; B 25 -428 615 908 ; -C 186 ; WX 620 ; N dd ; B 26 -242 616 723 ; L d ddd ; -C 187 ; WX 620 ; N ddd ; B 25 -428 615 908 ; -C 188 ; WX 645 ; N ee ; B 16 -255 649 753 ; L e eee ; -C 189 ; WX 645 ; N eee ; B 16 -441 648 939 ; -C 190 ; WX 645 ; N ff ; B 16 -273 649 735 ; L f fff ; -C 191 ; WX 645 ; N fff ; B 16 -459 648 921 ; -C 192 ; WX 645 ; N gg ; B 16 -255 649 753 ; L g ggg ; -C 193 ; WX 645 ; N ggg ; B 16 -441 648 939 ; -C 194 ; WX 645 ; N hh ; B 16 -273 649 735 ; L h hhh ; -C 195 ; WX 645 ; N hhh ; B 16 -459 648 921 ; -C 196 ; WX 614 ; N ii ; B 21 -243 613 745 ; L i iii ; -C 197 ; WX 614 ; N iii ; B 21 -408 614 911 ; -C 198 ; WX 614 ; N jj ; B 21 -265 613 723 ; L j jjj ; -C 199 ; WX 614 ; N jjj ; B 21 -431 614 888 ; -C 200 ; WX 614 ; N kk ; B 21 -243 613 745 ; L k kkk ; -C 201 ; WX 614 ; N kkk ; B 21 -408 614 911 ; -C 202 ; WX 614 ; N ll ; B 21 -265 613 723 ; L l lll ; -C 203 ; WX 614 ; N lll ; B 21 -431 614 888 ; -C 204 ; WX 1120 ; N A.alt ; B 25 -55 1115 535 ; -C 205 ; WX 1120 ; N B.alt ; B 25 -55 1115 535 ; -C 206 ; WX 1120 ; N C.alt ; B 25 -55 1115 535 ; -C 207 ; WX 1120 ; N D.alt ; B 25 -55 1115 535 ; -C 208 ; WX 1145 ; N E.alt ; B 7 -76 1140 556 ; -C 209 ; WX 1145 ; N F.alt ; B 25 -76 1158 556 ; -C 210 ; WX 1145 ; N G.alt ; B 7 -76 1140 556 ; -C 211 ; WX 1145 ; N H.alt ; B 25 -76 1158 556 ; -C 212 ; WX 1156 ; N I.alt ; B -2 -57 1151 537 ; -C 213 ; WX 1156 ; N J.alt ; B 25 -57 1141 537 ; -C 214 ; WX 1156 ; N K.alt ; B -2 -57 1151 537 ; -C 215 ; WX 1156 ; N L.alt ; B 25 -57 1141 537 ; -C 216 ; WX 741 ; N xx ; B 25 -56 740 536 ; -C 217 ; WX 741 ; N zz ; B 20 -56 736 536 ; -C 218 ; WX 620 ; N mm ; B 25 -55 615 535 ; L m mmm ; -C 219 ; WX 870 ; N mmm ; B 25 -180 865 660 ; -C 220 ; WX 620 ; N nn ; B 25 -55 615 535 ; L n nnn ; -C 221 ; WX 870 ; N nnn ; B 25 -180 865 660 ; -C 222 ; WX 620 ; N oo ; B 25 -55 615 535 ; L o ooo ; -C 223 ; WX 870 ; N ooo ; B 25 -180 865 660 ; -C 224 ; WX 620 ; N pp ; B 25 -55 615 535 ; L p ppp ; -C 225 ; WX 870 ; N ppp ; B 25 -180 865 660 ; +C 64 ; WX 580 ; N at ; B 40 0 540 500 ; +C 65 ; WX 660 ; N A ; B 30 -65 630 535 ; L A AA ; L at A.alt ; +C 66 ; WX 660 ; N B ; B 30 -65 630 535 ; L B BB ; L at B.alt ; +C 67 ; WX 660 ; N C ; B 30 -65 630 535 ; L C CC ; L at C.alt ; +C 68 ; WX 660 ; N D ; B 30 -65 630 535 ; L D DD ; L at D.alt ; +C 69 ; WX 703 ; N E ; B 30 -86 673 556 ; L E EE ; L at E.alt ; +C 70 ; WX 703 ; N F ; B 30 -86 673 556 ; L F FF ; L at F.alt ; +C 71 ; WX 703 ; N G ; B 30 -86 673 556 ; L G GG ; L at G.alt ; +C 72 ; WX 703 ; N H ; B 30 -86 673 556 ; L H HH ; L at H.alt ; +C 73 ; WX 723 ; N I ; B 30 -66 693 536 ; L I II ; L at I.alt ; +C 74 ; WX 687 ; N J ; B 30 -66 657 536 ; L J JJ ; L at J.alt ; +C 75 ; WX 723 ; N K ; B 30 -66 693 536 ; L K KK ; L at K.alt ; +C 76 ; WX 687 ; N L ; B 30 -66 657 536 ; L L LL ; L at L.alt ; +C 77 ; WX 410 ; N M ; B 30 60 380 410 ; L M MM ; +C 78 ; WX 410 ; N N ; B 30 60 380 410 ; L N NN ; +C 79 ; WX 410 ; N O ; B 30 60 380 410 ; L O OO ; +C 80 ; WX 410 ; N P ; B 30 60 380 410 ; L P PP ; +C 81 ; WX 410 ; N Q ; B 30 60 380 410 ; L Q QQ ; +C 82 ; WX 410 ; N R ; B 30 60 380 410 ; L R RR ; +C 83 ; WX 410 ; N S ; B 30 60 380 410 ; L S SS ; +C 84 ; WX 412 ; N T ; B 30 59 382 411 ; L T TT ; +C 85 ; WX 410 ; N U ; B 30 60 380 410 ; L U UU ; +C 86 ; WX 410 ; N V ; B 30 60 380 410 ; L V VV ; +C 87 ; WX 515 ; N W ; B 30 7 486 463 ; L W WW ; +C 88 ; WX 515 ; N X ; B 30 7 486 463 ; L X XX ; +C 89 ; WX 544 ; N Y ; B 30 -7 514 477 ; L Y YY ; +C 90 ; WX 544 ; N Z ; B 30 -7 514 477 ; L Z ZZ ; +C 97 ; WX 660 ; N a ; B 30 -65 630 535 ; L a aa ; +C 98 ; WX 660 ; N b ; B 30 -65 630 535 ; L b bb ; +C 99 ; WX 660 ; N c ; B 30 -65 630 535 ; L c cc ; +C 100 ; WX 660 ; N d ; B 30 -65 630 535 ; L d dd ; +C 101 ; WX 703 ; N e ; B 30 -77 673 565 ; L e ee ; +C 102 ; WX 703 ; N f ; B 30 -95 673 547 ; L f ff ; +C 103 ; WX 703 ; N g ; B 30 -77 673 565 ; L g gg ; +C 104 ; WX 703 ; N h ; B 30 -95 673 547 ; L h hh ; +C 105 ; WX 662 ; N i ; B 30 -86 632 578 ; L i ii ; +C 106 ; WX 656 ; N j ; B 30 -108 626 556 ; L j jj ; +C 107 ; WX 662 ; N k ; B 30 -86 632 578 ; L k kk ; +C 108 ; WX 656 ; N l ; B 30 -108 626 556 ; L l ll ; +C 128 ; WX 1035 ; N AA ; B 30 -65 1005 535 ; L A AAA ; +C 129 ; WX 1407 ; N AAA ; B 30 -65 1377 535 ; +C 130 ; WX 1035 ; N BB ; B 30 -65 1005 535 ; L B BBB ; +C 131 ; WX 1407 ; N BBB ; B 30 -65 1377 535 ; +C 132 ; WX 1035 ; N CC ; B 30 -65 1005 535 ; L C CCC ; +C 133 ; WX 1407 ; N CCC ; B 30 -65 1377 535 ; +C 134 ; WX 1035 ; N DD ; B 30 -65 1005 535 ; L D DDD ; +C 135 ; WX 1407 ; N DDD ; B 30 -65 1377 535 ; +C 136 ; WX 1078 ; N EE ; B 30 -86 1048 556 ; L E EEE ; +C 137 ; WX 1450 ; N EEE ; B 30 -86 1420 556 ; +C 138 ; WX 1078 ; N FF ; B 30 -86 1048 556 ; L F FFF ; +C 139 ; WX 1450 ; N FFF ; B 30 -86 1420 556 ; +C 140 ; WX 1078 ; N GG ; B 30 -86 1048 556 ; L G GGG ; +C 141 ; WX 1450 ; N GGG ; B 30 -86 1420 556 ; +C 142 ; WX 1078 ; N HH ; B 30 -86 1048 556 ; L H HHH ; +C 143 ; WX 1450 ; N HHH ; B 30 -86 1420 556 ; +C 144 ; WX 1058 ; N II ; B 30 -66 1028 536 ; L I III ; +C 145 ; WX 1391 ; N III ; B 30 -66 1361 536 ; +C 146 ; WX 1021 ; N JJ ; B 30 -66 991 536 ; L J JJJ ; +C 147 ; WX 1354 ; N JJJ ; B 30 -66 1324 536 ; +C 148 ; WX 1058 ; N KK ; B 30 -66 1028 536 ; L K KKK ; +C 149 ; WX 1391 ; N KKK ; B 30 -66 1361 536 ; +C 150 ; WX 1021 ; N LL ; B 30 -66 991 536 ; L L LLL ; +C 151 ; WX 1354 ; N LLL ; B 30 -66 1324 536 ; +C 152 ; WX 660 ; N MM ; B 30 -65 630 535 ; L M MMM ; +C 153 ; WX 910 ; N MMM ; B 30 -190 880 660 ; +C 154 ; WX 660 ; N NN ; B 30 -65 630 535 ; L N NNN ; +C 155 ; WX 910 ; N NNN ; B 30 -190 880 660 ; +C 156 ; WX 660 ; N OO ; B 30 -65 630 535 ; L O OOO ; +C 157 ; WX 910 ; N OOO ; B 30 -190 880 660 ; +C 158 ; WX 660 ; N PP ; B 30 -65 630 535 ; L P PPP ; +C 159 ; WX 910 ; N PPP ; B 30 -190 880 660 ; +C 160 ; WX 660 ; N QQ ; B 30 -65 630 535 ; L Q QQQ ; +C 161 ; WX 910 ; N QQQ ; B 30 -190 880 660 ; +C 162 ; WX 660 ; N RR ; B 30 -65 630 535 ; L R RRR ; +C 163 ; WX 910 ; N RRR ; B 30 -190 880 660 ; +C 164 ; WX 660 ; N SS ; B 30 -65 630 535 ; L S SSS ; +C 165 ; WX 910 ; N SSS ; B 30 -190 880 660 ; +C 166 ; WX 662 ; N TT ; B 30 -66 632 536 ; L T TTT ; +C 167 ; WX 912 ; N TTT ; B 30 -191 882 661 ; +C 168 ; WX 660 ; N UU ; B 30 -65 630 535 ; L U UUU ; +C 169 ; WX 910 ; N UUU ; B 30 -190 880 660 ; +C 170 ; WX 660 ; N VV ; B 30 -65 630 535 ; L V VVV ; +C 171 ; WX 910 ; N VVV ; B 30 -190 880 660 ; +C 172 ; WX 869 ; N WW ; B 30 -170 840 640 ; L W WWW ; +C 173 ; WX 1221 ; N WWW ; B 30 -346 1192 816 ; +C 174 ; WX 869 ; N XX ; B 30 -170 840 640 ; L X XXX ; +C 175 ; WX 1221 ; N XXX ; B 30 -346 1192 816 ; +C 176 ; WX 898 ; N YY ; B 30 -184 868 654 ; L Y YYY ; +C 177 ; WX 1252 ; N YYY ; B 30 -361 1222 831 ; +C 178 ; WX 898 ; N ZZ ; B 30 -184 868 654 ; L Z ZZZ ; +C 179 ; WX 1252 ; N ZZZ ; B 30 -361 1222 831 ; +C 180 ; WX 660 ; N aa ; B 30 -252 630 723 ; L a aaa ; +C 181 ; WX 660 ; N aaa ; B 30 -438 630 908 ; +C 182 ; WX 660 ; N bb ; B 30 -252 630 723 ; L b bbb ; +C 183 ; WX 660 ; N bbb ; B 30 -438 630 908 ; +C 184 ; WX 660 ; N cc ; B 30 -252 630 723 ; L c ccc ; +C 185 ; WX 660 ; N ccc ; B 30 -438 630 908 ; +C 186 ; WX 660 ; N dd ; B 30 -252 630 723 ; L d ddd ; +C 187 ; WX 660 ; N ddd ; B 30 -438 630 908 ; +C 188 ; WX 703 ; N ee ; B 30 -265 673 753 ; L e eee ; +C 189 ; WX 702 ; N eee ; B 30 -451 672 939 ; +C 190 ; WX 703 ; N ff ; B 30 -283 673 735 ; L f fff ; +C 191 ; WX 702 ; N fff ; B 30 -469 672 921 ; +C 192 ; WX 703 ; N gg ; B 30 -265 673 753 ; L g ggg ; +C 193 ; WX 702 ; N ggg ; B 30 -451 672 939 ; +C 194 ; WX 703 ; N hh ; B 30 -283 673 735 ; L h hhh ; +C 195 ; WX 702 ; N hhh ; B 30 -469 672 921 ; +C 196 ; WX 662 ; N ii ; B 30 -253 632 745 ; L i iii ; +C 197 ; WX 663 ; N iii ; B 30 -418 633 911 ; +C 198 ; WX 662 ; N jj ; B 30 -275 632 723 ; L j jjj ; +C 199 ; WX 663 ; N jjj ; B 30 -441 633 888 ; +C 200 ; WX 662 ; N kk ; B 30 -253 632 745 ; L k kkk ; +C 201 ; WX 663 ; N kkk ; B 30 -418 633 911 ; +C 202 ; WX 662 ; N ll ; B 30 -275 632 723 ; L l lll ; +C 203 ; WX 663 ; N lll ; B 30 -441 633 888 ; +C 204 ; WX 1160 ; N A.alt ; B 30 -65 1130 535 ; +C 205 ; WX 1160 ; N B.alt ; B 30 -65 1130 535 ; +C 206 ; WX 1160 ; N C.alt ; B 30 -65 1130 535 ; +C 207 ; WX 1160 ; N D.alt ; B 30 -65 1130 535 ; +C 208 ; WX 1203 ; N E.alt ; B 30 -86 1173 556 ; +C 209 ; WX 1203 ; N F.alt ; B 30 -86 1173 556 ; +C 210 ; WX 1203 ; N G.alt ; B 30 -86 1173 556 ; +C 211 ; WX 1203 ; N H.alt ; B 30 -86 1173 556 ; +C 212 ; WX 1223 ; N I.alt ; B 30 -67 1193 537 ; +C 213 ; WX 1186 ; N J.alt ; B 30 -67 1156 537 ; +C 214 ; WX 1223 ; N K.alt ; B 30 -67 1193 537 ; +C 215 ; WX 1186 ; N L.alt ; B 30 -67 1156 537 ; C -1 ; WX 333 ; N nbspace ; B 0 0 0 0 ; EndCharMetrics EndFontMetrics diff --git a/Master/texmf-dist/fonts/afm/jmn/hans/hans.afm b/Master/texmf-dist/fonts/afm/jmn/hans/hans.afm index 480524f7e0e..6c599d6e418 100644 --- a/Master/texmf-dist/fonts/afm/jmn/hans/hans.afm +++ b/Master/texmf-dist/fonts/afm/jmn/hans/hans.afm @@ -1,6 +1,6 @@ StartFontMetrics 2.0 Generated by MetaType1 (a MetaPost-based engine) -Comment Creation Date: 20.08.2004 +Comment Creation Date: 18.08.2004 Notice Design by Janusz M. Nowacki, 2004. FontName Hans-Regular FullName Hans-Regular @@ -30,7 +30,7 @@ Comment TFM fontdimen 22: 2.5 (math axis) Comment TFM headerbyte 9: FontSpecific Comment TFM headerbyte 49: Hans Comment TFM headerbyte 72: 234 -StartCharMetrics 153 +StartCharMetrics 129 C 32 ; WX 333 ; N space ; B 0 0 0 0 ; C 64 ; WX 580 ; N at ; B 40 0 540 500 ; C 65 ; WX 620 ; N A ; B 40 -20 580 520 ; L A AA ; L at A.alt ; @@ -71,20 +71,6 @@ C 105 ; WX 614 ; N i ; B 40 -36 574 536 ; L i ii ; C 106 ; WX 614 ; N j ; B 40 -36 574 536 ; L j jj ; C 107 ; WX 614 ; N k ; B 40 -36 574 536 ; L k kk ; C 108 ; WX 614 ; N l ; B 40 -36 574 536 ; L l ll ; -C 109 ; WX 370 ; N m ; B 40 105 330 395 ; L m mm ; -C 110 ; WX 370 ; N n ; B 40 105 330 395 ; L n nn ; -C 111 ; WX 370 ; N o ; B 40 105 330 395 ; L o oo ; -C 112 ; WX 370 ; N p ; B 40 105 330 395 ; L p pp ; -C 113 ; WX 745 ; N q ; B 40 -20 705 520 ; -C 114 ; WX 745 ; N r ; B 40 -20 705 520 ; -C 115 ; WX 745 ; N s ; B 40 -20 705 520 ; -C 116 ; WX 745 ; N t ; B 40 -20 705 520 ; -C 117 ; WX 745 ; N u ; B 40 -32 705 532 ; -C 118 ; WX 745 ; N v ; B 40 -32 705 532 ; -C 119 ; WX 745 ; N w ; B 40 -32 705 532 ; -C 120 ; WX 745 ; N x ; B 40 -32 705 532 ; L x xx ; -C 121 ; WX 741 ; N y ; B 40 -20 701 520 ; -C 122 ; WX 741 ; N z ; B 40 -20 701 520 ; L z zz ; C 128 ; WX 995 ; N AA ; B 40 -20 955 520 ; L A AAA ; C 129 ; WX 1367 ; N AAA ; B 40 -20 1327 520 ; C 130 ; WX 995 ; N BB ; B 40 -20 955 520 ; L B BBB ; @@ -173,16 +159,6 @@ C 212 ; WX 1156 ; N I.alt ; B 40 -17 1116 517 ; C 213 ; WX 1156 ; N J.alt ; B 40 -17 1116 517 ; C 214 ; WX 1156 ; N K.alt ; B 40 -17 1116 517 ; C 215 ; WX 1156 ; N L.alt ; B 40 -17 1116 517 ; -C 216 ; WX 741 ; N xx ; B 40 -20 701 520 ; -C 217 ; WX 741 ; N zz ; B 40 -20 701 520 ; -C 218 ; WX 620 ; N mm ; B 40 -20 580 520 ; L m mmm ; -C 219 ; WX 870 ; N mmm ; B 40 -145 830 645 ; -C 220 ; WX 620 ; N nn ; B 40 -20 580 520 ; L n nnn ; -C 221 ; WX 870 ; N nnn ; B 40 -145 830 645 ; -C 222 ; WX 620 ; N oo ; B 40 -20 580 520 ; L o ooo ; -C 223 ; WX 870 ; N ooo ; B 40 -145 830 645 ; -C 224 ; WX 620 ; N pp ; B 40 -20 580 520 ; L p ppp ; -C 225 ; WX 870 ; N ppp ; B 40 -145 830 645 ; C -1 ; WX 333 ; N nbspace ; B 0 0 0 0 ; EndCharMetrics EndFontMetrics diff --git a/Master/texmf-dist/fonts/data/tests/texmfhome.otf b/Master/texmf-dist/fonts/data/tests/texmfhome.otf new file mode 100644 index 00000000000..d0af1152ff4 Binary files /dev/null and b/Master/texmf-dist/fonts/data/tests/texmfhome.otf differ diff --git a/Master/texmf-dist/fonts/enc/dvips/jmn/hans.enc b/Master/texmf-dist/fonts/enc/dvips/jmn/hans.enc index 9139b437778..9c7b78a8665 100644 --- a/Master/texmf-dist/fonts/enc/dvips/jmn/hans.enc +++ b/Master/texmf-dist/fonts/enc/dvips/jmn/hans.enc @@ -109,19 +109,19 @@ /k /l /m -/n -/o -/p -/q -/r -/s -/t -/u -/v -/w -/x -/y -/z +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef /.notdef /.notdef /.notdef @@ -215,35 +215,35 @@ /J.alt /K.alt /L.alt -/xx -/zz -/mm -/mmm -/nn -/nnn -/oo -/ooo -/pp -/ppp -/qq -/qqq -/rr -/rrr -/ss -/sss -/tt -/ttt /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef -/xx /.notdef /.notdef /.notdef -/zz +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef +/.notdef /.notdef /.notdef /.notdef diff --git a/Master/texmf-dist/fonts/map/dvips/jmn/hans.map b/Master/texmf-dist/fonts/map/dvips/jmn/hans.map index a60052d3994..8d283c0f664 100644 --- a/Master/texmf-dist/fonts/map/dvips/jmn/hans.map +++ b/Master/texmf-dist/fonts/map/dvips/jmn/hans.map @@ -1,2 +1,2 @@ hans Hans-Regular "enchans ReEncodeFont" 0 : left_skip := rl + xpart llxy[wpos] - xpart llxy[ppos] ; @@ -430,249 +433,247 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd, numeric multi_par_pages ; multi_par_pages := nxy[tpos]-nxy[fpos]+1 ; - vardef snapped_multi_pos (expr p) = - if snap_multi_par_tops : - if abs(ypart p - ypart ulcorner multipar) < par_line_height : - (xpart p,ypart ulcorner multipar) - else : - p - fi + % locals .. why can't i move these outside? + +vardef _pmp_set_multipar_ (expr i) = + ( (TextAreas[i] leftenlarged -left_skip) rightenlarged (-right_skip + if auto_multi_par_hsize : + rw - bbwidth(TextAreas[i]) fi) ) +enddef ; + +vardef _pmp_snapped_multi_pos_ (expr p) = + if snap_multi_par_tops : + if abs(ypart p - ypart ulcorner multipar) < par_line_height : + (xpart p,ypart ulcorner multipar) else : p fi - enddef ; + else : + p + fi +enddef ; - % def set_multipar (expr i) = - % ((TextAreas[i] leftenlarged -left_skip) rightenlarged -right_skip) - % enddef ; +vardef _pmp_estimated_par_lines_ (expr h) = + round(h/par_line_height) +enddef ; - vardef set_multipar (expr i) = - ( (TextAreas[i] leftenlarged -left_skip) rightenlarged (-right_skip - if auto_multi_par_hsize : + rw - bbwidth(TextAreas[i]) fi) ) - enddef ; +vardef _pmp_top_multi_par_(expr p) = + (round(_pmp_estimated_par_lines_(bbheight(p)*par_line_height))=round(bbheight(p))) +enddef ; - vardef top_multi_par(expr p) = - (round(estimated_par_lines(bbheight(p)*par_line_height))=round(bbheight(p))) - enddef ; +vardef _pmp_multi_par_tsc_(expr p) = + if _pmp_top_multi_par_(p) : TopSkipCorrection else : 0 fi +enddef ; - vardef multi_par_tsc(expr p) = - if top_multi_par(p) : TopSkipCorrection else : 0 fi - enddef ; +vardef _pmp_estimated_multi_par_height_ (expr n, t) = + if round(par_line_height)=0 : + 0 + else : + save ok, h ; boolean ok ; + numeric h ; h := 0 ; + ok := false ; + if (nxy[fpos]=RealPageNumber-1) : + for i := 1 upto NOfSavedTextAreas : + if (InsideSavedTextArea(i,par_start_pos)) : + ok := true ; + h := h + _pmp_estimated_par_lines_(ypart ulxy[fpos] - + ypart llcorner SavedTextAreas[i]) ; + elseif ok : + h := h + _pmp_estimated_par_lines_(bbheight(SavedTextAreas[i])) ; + fi ; + endfor ; + fi ; + if ok : + for i := 1 upto n-1 : + h := h + _pmp_estimated_par_lines_(bbheight(TextAreas[i])) ; + endfor ; + else : + % already: ok := false ; + for i := 1 upto n-1 : + if (InsideTextArea(i,par_start_pos)) : + ok := true ; + h := h + _pmp_estimated_par_lines_(ypart ulxy[fpos] - ypart llcorner TextAreas[i]) ; + elseif ok : + h := h + _pmp_estimated_par_lines_(bbheight(TextAreas[i])) ; + fi ; + endfor ; + fi ; + h + fi +enddef ; - vardef estimated_par_lines (expr h) = - round(h/par_line_height) - enddef ; +vardef _pmp_left_top_hang_ (expr same_area) = - vardef estimated_multi_par_height (expr n, t) = - if round(par_line_height)=0 : - 0 - else : - save ok, h ; boolean ok ; - numeric h ; h := 0 ; - ok := false ; - if (nxy[fpos]=RealPageNumber-1) : - for i := 1 upto NOfSavedTextAreas : - if (InsideSavedTextArea(i,par_start_pos)) : - ok := true ; - h := h + estimated_par_lines(ypart ulxy[fpos] - - ypart llcorner SavedTextAreas[i]) ; - elseif ok : - h := h + estimated_par_lines(bbheight(SavedTextAreas[i])) ; - fi ; - endfor ; - fi ; - if ok : - for i := 1 upto n-1 : - h := h + estimated_par_lines(bbheight(TextAreas[i])) ; - endfor ; - else : - % already: ok := false ; - for i := 1 upto n-1 : - if (InsideTextArea(i,par_start_pos)) : - ok := true ; - h := h + estimated_par_lines(ypart ulxy[fpos] - ypart llcorner TextAreas[i]) ; - elseif ok : - h := h + estimated_par_lines(bbheight(TextAreas[i])) ; - fi ; - endfor ; - fi ; - h - fi - enddef ; + par_hang_after := ra + _pmp_estimated_par_lines_(py-fy) ; - vardef left_top_hang (expr same_area) = + if (par_hang_indent>0) and (par_hang_after<0) and obey_multi_par_hang : + pair _ul_ ; _ul_ := (xpart ulcorner multipar, ypart _pmp_snapped_multi_pos_(ulxy[fpos])); + pair _pa_ ; _pa_ := _ul_ shifted (0,par_hang_after*par_line_height) ; + _pa_ := (xpart _pa_,max(ypart _pa_ -TopSkipCorrection,ypart llcorner multipar)) ; + if same_area : + _pa_ := (xpart _pa_,max(ypart _pa_ -TopSkipCorrection,ypart llxy[tpos])) ; + fi ; + if obey_multi_par_more and (round(par_line_height)>0) : + par_hang_after := min(0,round(par_hang_after + + (ypart urxy[fpos]-ypart _pa_)/par_line_height)) ; + fi ; + (xpart _ul_ + par_hang_indent, ypart lrxy[fpos]) -- + (xpart _ul_ + par_hang_indent, ypart _pa_) -- + (xpart ulcorner multipar, ypart _pa_) + else : + (xpart ulcorner multipar, ypart lrxy[fpos]) + fi +enddef ; - par_hang_after := ra + estimated_par_lines(py-fy) ; +vardef _pmp_right_top_hang_ (expr same_area) = - if (par_hang_indent>0) and (par_hang_after<0) and obey_multi_par_hang : - pair _ul_ ; _ul_ := (xpart ulcorner multipar, ypart snapped_multi_pos(ulxy[fpos])); - pair _pa_ ; _pa_ := _ul_ shifted (0,par_hang_after*par_line_height) ; - _pa_ := (xpart _pa_,max(ypart _pa_ -TopSkipCorrection,ypart llcorner multipar)) ; - if same_area : - _pa_ := (xpart _pa_,max(ypart _pa_ -TopSkipCorrection,ypart llxy[tpos])) ; - fi ; - if obey_multi_par_more and (round(par_line_height)>0) : - par_hang_after := min(0,round(par_hang_after + - (ypart urxy[fpos]-ypart _pa_)/par_line_height)) ; - fi ; - (xpart _ul_ + par_hang_indent, ypart lrxy[fpos]) -- - (xpart _ul_ + par_hang_indent, ypart _pa_) -- - (xpart ulcorner multipar, ypart _pa_) - else : - (xpart ulcorner multipar, ypart lrxy[fpos]) - fi - enddef ; + par_hang_after := ra + _pmp_estimated_par_lines_(py-fy) ; - vardef right_top_hang (expr same_area) = + if (par_hang_indent<0) and (par_hang_after<0) and obey_multi_par_hang : + pair _ur_ ; _ur_ := (xpart urcorner multipar, ypart _pmp_snapped_multi_pos_(urxy[fpos])) ; + pair _pa_ ; _pa_ := _ur_ shifted (0,par_hang_after*par_line_height) ; + _pa_ := (xpart _pa_,max(ypart _pa_ -TopSkipCorrection,ypart llcorner multipar)) ; + if same_area : + _pa_ := (xpart _pa_,max(ypart _pa_ -TopSkipCorrection,ypart _pmp_snapped_multi_pos_(ulxy[tpos]))) ; + fi ; + if obey_multi_par_more and (round(par_line_height)>0) : + par_hang_after := min(0,round(par_hang_after + + (ypart urxy[fpos]-ypart _pa_)/par_line_height)) ; + fi ; + (xpart urcorner multipar, ypart _pa_) -- + (xpart _ur_ + par_hang_indent, ypart _pa_) -- + (xpart _ur_ + par_hang_indent, ypart _pmp_snapped_multi_pos_(urxy[fpos])) + else : + (xpart urcorner multipar, ypart _pmp_snapped_multi_pos_(urxy[fpos])) + fi +enddef ; - par_hang_after := ra + estimated_par_lines(py-fy) ; +vardef _pmp_x_left_top_hang_ (expr i, t) = + par_hang_after := min(0,ra + _pmp_estimated_multi_par_height_(i,t)) ; + if (par_hang_indent>0) and (par_hang_after<0) : + pair _ul_ ; _ul_ := ulcorner multipar ; + pair _pa_ ; _pa_ := _ul_ shifted (0,par_hang_after*par_line_height) ; + _pa_ := (xpart _pa_,max(ypart _pa_,ypart llcorner multipar)) ; + if t : + _pa_ := (xpart _pa_,max(ypart _pa_,ypart llxy[tpos])); + fi ; + if abs(ypart _pa_-ypart llxy[tpos])0) : - par_hang_after := min(0,round(par_hang_after + - (ypart urxy[fpos]-ypart _pa_)/par_line_height)) ; - fi ; - (xpart urcorner multipar, ypart _pa_) -- - (xpart _ur_ + par_hang_indent, ypart _pa_) -- - (xpart _ur_ + par_hang_indent, ypart snapped_multi_pos(urxy[fpos])) - else : - (xpart urcorner multipar, ypart snapped_multi_pos(urxy[fpos])) - fi - enddef ; - - vardef x_left_top_hang (expr i, t) = - par_hang_after := min(0,ra + estimated_multi_par_height(i,t)) ; - if (par_hang_indent>0) and (par_hang_after<0) : - pair _ul_ ; _ul_ := ulcorner multipar ; - pair _pa_ ; _pa_ := _ul_ shifted (0,par_hang_after*par_line_height) ; - _pa_ := (xpart _pa_,max(ypart _pa_,ypart llcorner multipar)) ; - if t : - _pa_ := (xpart _pa_,max(ypart _pa_,ypart llxy[tpos])); - fi ; - if abs(ypart _pa_-ypart llxy[tpos])0) and (par_hang_after>0) and obey_multi_par_hang : - _ll_ := (xpart ulcorner multipar, ypart snapped_multi_pos(ulxy[fpos])) ; - _pa_ := _ll_ shifted (0,-par_hang_after*par_line_height) ; - _pa_ := (xpart _pa_,max(ypart _pa_,ypart llcorner multipar)) ; - if same_area : - _pa_ := (xpart _pa_,max(ypart _pa_,ypart _sa_)) ; - fi ; - if obey_multi_par_more and (round(par_line_height)>0) : - par_hang_after := max(0,round(par_hang_after - - (ypart urxy[fpos]-ypart _pa_)/par_line_height)) ; - fi ; - _pa_ -- - (xpart _pa_ + par_hang_indent,ypart _pa_) -- - (xpart _pa_ + par_hang_indent,ypart _sa_) - else : - (xpart llcorner multipar, ypart _sa_) - fi - enddef ; - - vardef right_bottom_hang (expr same_area) = - pair _lr_, _sa_, _pa_ ; - _sa_ := if same_area : snapped_multi_pos(ulxy[tpos]) else : lrcorner multipar fi ; - if (par_hang_indent<0) and (par_hang_after>0) and obey_multi_par_hang : - _lr_ := (xpart urcorner multipar, ypart snapped_multi_pos(urxy[fpos])) ; - _pa_ := _lr_ shifted (0,-par_hang_after*par_line_height) ; - _pa_ := (xpart _pa_,max(ypart _pa_,ypart lrcorner multipar)) ; - if same_area : - _pa_ := (xpart _pa_,max(ypart _pa_,ypart snapped_multi_pos(ulxy[tpos]))) ; - fi ; - if obey_multi_par_more and (round(par_line_height)>0) : - par_hang_after := max(0,round(par_hang_after - - (ypart urxy[fpos]-ypart _pa_)/par_line_height)) ; - fi ; +vardef _pmp_x_right_top_hang_ (expr i, t) = + par_hang_after := min(0,ra + _pmp_estimated_multi_par_height_(i,t)) ; + if (par_hang_indent<0) and (par_hang_after<0) : + pair _ur_ ; _ur_ := urcorner multipar ; + pair _pa_ ; _pa_ := _ur_ shifted (0,par_hang_after*par_line_height) ; + _pa_ := (xpart _pa_,max(ypart _pa_,ypart lrcorner multipar)) ; + if t : + _pa_ := (xpart _pa_,max(ypart _pa_,ypart _pmp_snapped_multi_pos_(urxy[tpos]))) ; + fi ; + (xpart _ur_ + par_hang_indent, ypart _ur_) -- + (xpart _ur_ + par_hang_indent, ypart _pa_) -- + (xpart _ur_, ypart _pa_) + else : + urcorner multipar + fi +enddef ; + +vardef _pmp_left_bottom_hang_ (expr same_area) = + pair _ll_, _sa_, _pa_ ; + _sa_ := if same_area : llxy[tpos] else : lrcorner multipar fi ; + if (par_hang_indent>0) and (par_hang_after>0) and obey_multi_par_hang : + _ll_ := (xpart ulcorner multipar, ypart _pmp_snapped_multi_pos_(ulxy[fpos])) ; + _pa_ := _ll_ shifted (0,-par_hang_after*par_line_height) ; + _pa_ := (xpart _pa_,max(ypart _pa_,ypart llcorner multipar)) ; + if same_area : + _pa_ := (xpart _pa_,max(ypart _pa_,ypart _sa_)) ; + fi ; + if obey_multi_par_more and (round(par_line_height)>0) : + par_hang_after := max(0,round(par_hang_after - + (ypart urxy[fpos]-ypart _pa_)/par_line_height)) ; + fi ; + _pa_ -- + (xpart _pa_ + par_hang_indent,ypart _pa_) -- + (xpart _pa_ + par_hang_indent,ypart _sa_) + else : + (xpart llcorner multipar, ypart _sa_) + fi +enddef ; + +vardef _pmp_right_bottom_hang_ (expr same_area) = + pair _lr_, _sa_, _pa_ ; + _sa_ := if same_area : _pmp_snapped_multi_pos_(ulxy[tpos]) else : lrcorner multipar fi ; + if (par_hang_indent<0) and (par_hang_after>0) and obey_multi_par_hang : + _lr_ := (xpart urcorner multipar, ypart _pmp_snapped_multi_pos_(urxy[fpos])) ; + _pa_ := _lr_ shifted (0,-par_hang_after*par_line_height) ; + _pa_ := (xpart _pa_,max(ypart _pa_,ypart lrcorner multipar)) ; + if same_area : + _pa_ := (xpart _pa_,max(ypart _pa_,ypart _pmp_snapped_multi_pos_(ulxy[tpos]))) ; + fi ; + if obey_multi_par_more and (round(par_line_height)>0) : + par_hang_after := max(0,round(par_hang_after - + (ypart urxy[fpos]-ypart _pa_)/par_line_height)) ; + fi ; + (xpart _pa_ + par_hang_indent,ypart _sa_) -- + (xpart _pa_ + par_hang_indent,ypart _pa_) -- + _pa_ + else : + (xpart lrcorner multipar, ypart _sa_) + fi +enddef ; + +vardef _pmp_x_left_bottom_hang_ (expr i, t) = + pair _ll_, _sa_, _pa_ ; + _sa_ := if t : llxy[tpos] else : llcorner multipar fi ; + if (par_hang_indent>0) and (ra>0) : + par_hang_after := max(0,ra - _pmp_estimated_multi_par_height_(i,t)) ; + _ll_ := ulcorner multipar ; + _pa_ := _ll_ shifted (0,-par_hang_after*par_line_height) ; + _pa_ := (xpart _pa_,max(ypart _pa_,ypart llcorner multipar)) ; + _pa_ := (xpart _pa_,max(ypart _pa_,ypart _sa_)) ; + % we need to compensate for topskip enlarged areas + if abs(ypart _pa_ - ypart _sa_) > par_line_height : (xpart _pa_ + par_hang_indent,ypart _sa_) -- (xpart _pa_ + par_hang_indent,ypart _pa_) -- - _pa_ - else : - (xpart lrcorner multipar, ypart _sa_) fi - enddef ; - - vardef x_left_bottom_hang (expr i, t) = - pair _ll_, _sa_, _pa_ ; - _sa_ := if t : llxy[tpos] else : llcorner multipar fi ; - if (par_hang_indent>0) and (ra>0) : - par_hang_after := max(0,ra - estimated_multi_par_height(i,t)) ; - _ll_ := ulcorner multipar ; - _pa_ := _ll_ shifted (0,-par_hang_after*par_line_height) ; - _pa_ := (xpart _pa_,max(ypart _pa_,ypart llcorner multipar)) ; - _pa_ := (xpart _pa_,max(ypart _pa_,ypart _sa_)) ; - % we need to compensate for topskip enlarged areas - if abs(ypart _pa_ - ypart _sa_) > par_line_height : - (xpart _pa_ + par_hang_indent,ypart _sa_) -- - (xpart _pa_ + par_hang_indent,ypart _pa_) -- - fi - _pa_ - else : - (xpart llcorner multipar, ypart _sa_) - fi - enddef ; - - vardef x_right_bottom_hang (expr i, t) = - pair _lr_, _sa_, _pa_ ; - _sa_ := if t : snapped_multi_pos(ulxy[tpos]) else : llcorner multipar fi ; - if (par_hang_indent<0) and (ra>0) : - par_hang_after := max(0,ra - estimated_multi_par_height(i, t)) ; - _lr_ := urcorner multipar ; - _pa_ := _lr_ shifted (0,-par_hang_after*par_line_height) ; - _pa_ := (xpart _pa_,max(ypart _pa_,ypart lrcorner multipar)) ; - _pa_ := (xpart _pa_,max(ypart _pa_,ypart _sa_)) ; - % we need to compensate for topskip enlarged areas - _pa_ - if abs(ypart _pa_ - ypart _sa_) > par_line_height : - -- (xpart _pa_ + par_hang_indent,ypart _pa_) - -- (xpart _pa_ + par_hang_indent,ypart _sa_) - fi - else : - (xpart lrcorner multipar, ypart _sa_) + _pa_ + else : + (xpart llcorner multipar, ypart _sa_) + fi +enddef ; + +vardef _pmp_x_right_bottom_hang_ (expr i, t) = + pair _lr_, _sa_, _pa_ ; + _sa_ := if t : _pmp_snapped_multi_pos_(ulxy[tpos]) else : llcorner multipar fi ; + if (par_hang_indent<0) and (ra>0) : + par_hang_after := max(0,ra - _pmp_estimated_multi_par_height_(i, t)) ; + _lr_ := urcorner multipar ; + _pa_ := _lr_ shifted (0,-par_hang_after*par_line_height) ; + _pa_ := (xpart _pa_,max(ypart _pa_,ypart lrcorner multipar)) ; + _pa_ := (xpart _pa_,max(ypart _pa_,ypart _sa_)) ; + % we need to compensate for topskip enlarged areas + _pa_ + if abs(ypart _pa_ - ypart _sa_) > par_line_height : + -- (xpart _pa_ + par_hang_indent,ypart _pa_) + -- (xpart _pa_ + par_hang_indent,ypart _sa_) fi - enddef ; + else : + (xpart lrcorner multipar, ypart _sa_) + fi +enddef ; - def test_multipar = - multipar := boundingbox multipar ; - enddef ; +% def _pmp_test_multipar_ = +% multipar := boundingbox multipar ; +% enddef ; % first loop @@ -713,7 +714,7 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd, TopSkipCorrection := 0 ; - multipar := set_multipar(i) ; + multipar := _pmp_set_multipar_(i) ; % watch how we compensate for negative indentation @@ -723,7 +724,8 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd, ii := i ; - if (nxy[tpos]=RealPageNumber) and (InsideTextArea(i,llxy[tpos])) : +% if (nxy[tpos]=RealPageNumber) and (InsideTextArea(i,llxy[tpos])) : + if (nxy[tpos]=RealPageNumber) and (InsideTextArea(i,par_stop_pos)) : % in same area @@ -749,9 +751,9 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd, llxy[fpos] -- lrxy[tpos] -- %urxy[tpos] -- - snapped_multi_pos(urxy[tpos]) -- + _pmp_snapped_multi_pos_(urxy[tpos]) -- %ulxy[fpos] -- - snapped_multi_pos(ulxy[fpos]) -- + _pmp_snapped_multi_pos_(ulxy[fpos]) -- cycle ; save_multipar (i,1,multipar) ; @@ -763,9 +765,9 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd, multipar := if obey_multi_par_hang : - right_bottom_hang(true) -- - right_top_hang(true) -- - snapped_multi_pos(urxy[fpos]) -- + _pmp_right_bottom_hang_(true) -- + _pmp_right_top_hang_(true) -- + _pmp_snapped_multi_pos_(urxy[fpos]) -- lrxy[fpos] -- else : @@ -773,26 +775,26 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd, llxy[fpos] -- (xpart urcorner multipar, ypart llxy[fpos]) -- (xpart urcorner multipar, ypart ulxy[fpos]) -- - snapped_multi_pos(ulxy[fpos]) -- + _pmp_snapped_multi_pos_(ulxy[fpos]) -- fi cycle ; save_multipar (i,1,multipar) ; - multipar := set_multipar(i) ; + multipar := _pmp_set_multipar_(i) ; multipar := if obey_multi_par_hang : - left_bottom_hang(true) -- + _pmp_left_bottom_hang_(true) -- llxy[tpos] -- - snapped_multi_pos(ulxy[tpos]) -- - left_top_hang(true) -- + _pmp_snapped_multi_pos_(ulxy[tpos]) -- + _pmp_left_top_hang_(true) -- else : (xpart llcorner multipar, ypart llxy[tpos]) -- llxy[tpos] -- - snapped_multi_pos(ulxy[tpos]) -- + _pmp_snapped_multi_pos_(ulxy[tpos]) -- (xpart llcorner multipar, ypart ulxy[tpos]) -- fi cycle ; @@ -803,27 +805,27 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd, multipar := if obey_multi_par_hang : - left_bottom_hang(true) -- + _pmp_left_bottom_hang_(true) -- llxy[tpos] -- %ulxy[tpos] -- - snapped_multi_pos(ulxy[tpos]) -- - right_bottom_hang(true) -- - right_top_hang(true) -- + _pmp_snapped_multi_pos_(ulxy[tpos]) -- + _pmp_right_bottom_hang_(true) -- + _pmp_right_top_hang_(true) -- %urxy[fpos] -- - snapped_multi_pos(urxy[fpos]) -- + _pmp_snapped_multi_pos_(urxy[fpos]) -- lrxy[fpos] -- - left_top_hang(true) -- + _pmp_left_top_hang_(true) -- else : (xpart llcorner multipar, ypart llxy[tpos]) -- llxy[tpos] -- %ulxy[tpos] -- - snapped_multi_pos(ulxy[tpos]) -- + _pmp_snapped_multi_pos_(ulxy[tpos]) -- (xpart lrcorner multipar, ypart ulxy[tpos]) -- (xpart urcorner multipar, ypart urxy[fpos]) -- %urxy[fpos] -- - snapped_multi_pos(urxy[fpos]) -- + _pmp_snapped_multi_pos_(urxy[fpos]) -- lrxy[fpos] -- (xpart ulcorner multipar, ypart lrxy[fpos]) -- @@ -837,13 +839,13 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd, multipar := if obey_multi_par_hang : - left_bottom_hang(false) -- - right_bottom_hang(false) -- - right_top_hang(false) -- + _pmp_left_bottom_hang_(false) -- + _pmp_right_bottom_hang_(false) -- + _pmp_right_top_hang_(false) -- %urxy[fpos] -- - snapped_multi_pos(urxy[fpos]) -- + _pmp_snapped_multi_pos_(urxy[fpos]) -- lrxy[fpos] -- - left_top_hang(false) -- + _pmp_left_top_hang_(false) -- else : @@ -851,7 +853,7 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd, lrcorner multipar -- (xpart urcorner multipar, ypart urxy[fpos]) -- %urxy[fpos] -- - snapped_multi_pos(urxy[fpos]) -- + _pmp_snapped_multi_pos_(urxy[fpos]) -- lrxy[fpos] -- (xpart ulcorner multipar, ypart lrxy[fpos]) -- @@ -861,7 +863,8 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd, fi ; - elseif (nxy[tpos]=RealPageNumber) and (InsideTextArea(i,llxy[tpos])) : +% elseif (nxy[tpos]=RealPageNumber) and (InsideTextArea(i,llxy[tpos])) : + elseif (nxy[tpos]=RealPageNumber) and (InsideTextArea(i,par_stop_pos)) : % last one in chain @@ -870,12 +873,12 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd, if obey_multi_par_hang and obey_multi_par_more : multipar := - x_left_top_hang(i,true) -- - x_right_top_hang(i,true) -- - x_right_bottom_hang(i,true) -- - snapped_multi_pos(ulxy[tpos]) -- + _pmp_x_left_top_hang_(i,true) -- + _pmp_x_right_top_hang_(i,true) -- + _pmp_x_right_bottom_hang_(i,true) -- + _pmp_snapped_multi_pos_(ulxy[tpos]) -- llxy[tpos] -- - x_left_bottom_hang(i,true) -- + _pmp_x_left_bottom_hang_(i,true) -- cycle ; else : @@ -884,7 +887,7 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd, ulcorner multipar -- urcorner multipar -- (xpart lrcorner multipar, ypart urxy[tpos]) -- - snapped_multi_pos(ulxy[tpos]) -- + _pmp_snapped_multi_pos_(ulxy[tpos]) -- llxy[tpos] -- (xpart llcorner multipar, ypart llxy[tpos]) -- cycle ; @@ -917,15 +920,15 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd, ((nxy[fpos]RealPageNumber)) : - multipar := set_multipar(i) ; + multipar := _pmp_set_multipar_(i) ; if obey_multi_par_hang and obey_multi_par_more : multipar := - x_left_top_hang(i,false) -- - x_right_top_hang(i,false) -- - x_right_bottom_hang(i,false) -- - x_left_bottom_hang(i,false) -- + _pmp_x_left_top_hang_(i,false) -- + _pmp_x_right_top_hang_(i,false) -- + _pmp_x_right_bottom_hang_(i,false) -- + _pmp_x_left_bottom_hang_(i,false) -- cycle ; fi ; diff --git a/Master/texmf-dist/metapost/context/base/mp-form.mp b/Master/texmf-dist/metapost/context/base/mp-form.mp index a65ab6d7374..60ea4cac214 100644 --- a/Master/texmf-dist/metapost/context/base/mp-form.mp +++ b/Master/texmf-dist/metapost/context/base/mp-form.mp @@ -15,6 +15,11 @@ boolean mant_font ; mant_font := true ; % signals graph not to load form +if known mplib : + boolean fmt_loaded ; fmt_loaded := true ; + expandafter endinput +fi ; + if known fmt_loaded : expandafter endinput fi ; boolean fmt_loaded ; fmt_loaded := true ; @@ -78,8 +83,8 @@ begingroup interim warningcheck := 0 ; %%% Load auxiliary macros. -input string -input marith +input string ; +input marith ; %%% Choosing the Layout %%% @@ -318,7 +323,7 @@ enddef ; % round and typeset a quantity z in exponent form. % % e scientific, p significant figures -% p decimal, p digits right of the point +% f decimal, p digits right of the point % g decimal or scientific, p sig. figs. % G decimal or scientific, p digits diff --git a/Master/texmf-dist/metapost/context/base/mp-grid.mp b/Master/texmf-dist/metapost/context/base/mp-grid.mp index f6e84348915..c87df821cfa 100644 --- a/Master/texmf-dist/metapost/context/base/mp-grid.mp +++ b/Master/texmf-dist/metapost/context/base/mp-grid.mp @@ -107,7 +107,12 @@ def do_initialize_numbers = textext.raw("${\times}10$") , textext.raw("${}^-$") , textext.raw("${}^2$") ) ; - numbers_initialized := true ; + if unknown _trial_run_ : + numbers_initialized := true ; + else : + % no reset, otherwise textexts get out of sync + % slows down graphics a bit but not much + fi ; fi ; enddef ; diff --git a/Master/texmf-dist/metapost/context/base/mp-grph.mp b/Master/texmf-dist/metapost/context/base/mp-grph.mp index 243b45318b0..3cd9f2cfbda 100644 --- a/Master/texmf-dist/metapost/context/base/mp-grph.mp +++ b/Master/texmf-dist/metapost/context/base/mp-grph.mp @@ -59,21 +59,25 @@ string graphictextfile ; graphictextfile := "dummy.mpo" ; def data_mpo_file = job_name & "-mpgraph.mpo" enddef ; def data_mpy_file = job_name & "-mpgraph.mpy" enddef ; -def savegraphictext (expr str) = - if (graphictextstring<>"") : - write graphictextstring to data_mpo_file ; - graphictextstring := "" ; - fi ; - write str to data_mpo_file ; - let erasegraphictextfile = relax ; -enddef ; +if unknown mplib : -def erasegraphictextfile = - write EOF to data_mpo_file ; - let erasegraphictextfile = relax ; -enddef ; + def savegraphictext (expr str) = + if (graphictextstring<>"") : + write graphictextstring to data_mpo_file ; + graphictextstring := "" ; + fi ; + write str to data_mpo_file ; + let erasegraphictextfile = relax ; + enddef ; -extra_beginfig := extra_beginfig & " erasegraphictextfile ;" ; + def erasegraphictextfile = + write EOF to data_mpo_file ; + let erasegraphictextfile = relax ; + enddef ; + + extra_beginfig := extra_beginfig & " erasegraphictextfile ;" ; + +fi ; def begingraphictextfig (expr n) = foundpicture := n ; scratchpicture := nullpicture ; @@ -138,7 +142,9 @@ def dographictext (expr t) = graphictextformat := "" ; fi ; currentgraphictext := currentgraphictext + 1 ; - savegraphictext ("\startTEXpage[scale=10000]" & t & "\stopTEXpage") ; + if unknown mplib : + savegraphictext ("\startTEXpage[scale=10000]" & t & "\stopTEXpage") ; + fi ; dofinishgraphictext enddef ; diff --git a/Master/texmf-dist/metapost/context/base/mp-mlib.mp b/Master/texmf-dist/metapost/context/base/mp-mlib.mp index bf2372ca390..6c7115cb7d4 100644 --- a/Master/texmf-dist/metapost/context/base/mp-mlib.mp +++ b/Master/texmf-dist/metapost/context/base/mp-mlib.mp @@ -2,7 +2,7 @@ %D [ file=mp-mlib.mp, %D version=2008.03.21, %D title=\CONTEXT\ \METAPOST\ graphics, -%D subtitle=specials, +%D subtitle=plugins, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] @@ -16,6 +16,66 @@ if known context_mlib : endinput ; fi ; boolean context_mlib ; context_mlib := true ; +%D Color and transparency + +newinternal normaltransparent ; normaltransparent := 1 ; +newinternal multiplytransparent ; multiplytransparent := 2 ; +newinternal screentransparent ; screentransparent := 3 ; +newinternal overlaytransparent ; overlaytransparent := 4 ; +newinternal softlighttransparent ; softlighttransparent := 5 ; +newinternal hardlighttransparent ; hardlighttransparent := 6 ; +newinternal colordodgetransparent ; colordodgetransparent := 7 ; +newinternal colorburntransparent ; colorburntransparent := 8 ; +newinternal darkentransparent ; darkentransparent := 9 ; +newinternal lightentransparent ; lightentransparent := 10 ; +newinternal differencetransparent ; differencetransparent := 11 ; +newinternal exclusiontransparent ; exclusiontransparent := 12 ; + +vardef transparency_alternative_to_number(expr name) = + if string name : + if expandafter known scantokens(name & "transparent") : + scantokens(name & "transparent") + else : + 0 + fi + elseif name < 13 : + name + else : + 0 + fi +enddef ; + +def spotcolor(expr n, v) = + 1 + withprescript "sp_name=" & n + withprescript "sp_value=" & v +enddef ; + +def multitonecolor(expr name, fractions, components, value) = + 1 + withprescript "sp_name=" & name + withprescript "sp_fractions=" & decimal fractions + withprescript "sp_components=" & components + withprescript "sp_value=" & value +enddef ; + +def transparent(expr alternative, transparency)(text c) = + c + withprescript "tr_alternative=" & decimal transparency_alternative_to_number(alternative) + withprescript "tr_transparency=" & decimal transparency +enddef ; + +def withtransparency(expr alternative, transparency) = + withprescript "tr_alternative=" & decimal transparency_alternative_to_number(alternative) + withprescript "tr_transparency=" & decimal transparency +enddef ; + +def cmyk(expr c, m, y, k) = + (c,m,y,k) +enddef ; + +% Texts + numeric _tt_w_[], _tt_h_[], _tt_d_[] ; numeric _tt_n_ ; _tt_n_ := 0 ; picture _tt_p_ ; _tt_p_ := nullpicture ; @@ -26,34 +86,53 @@ def resettextexts = _tt_p_ := nullpicture ; enddef ; -extra_endfig := ";addto currentpicture also _tt_p_; " & extra_endfig; % was draw _tt_p_ +def flushtextexts = + addto currentpicture also _tt_p_ +enddef ; + +extra_endfig := "flushtextexts;" & extra_endfig; extra_beginfig := extra_beginfig & "resettextexts;"; +% We collect and flush them all, as we can also have temporary textexts +% that gets never really flushed but are used for calculations. So, we +% flush twice: once in location in order to pick up e.g. color properties, +% and once at the end because we need to flush missing ones. + vardef rawtextext(expr str) = if str = "" : nullpicture elseif _trial_run_ : + _tt_n_ := _tt_n_ + 1 ; + addto _tt_p_ doublepath unitsquare + withprescript "tx_number=" & decimal _tt_n_ + withprescript "tx_stage=extra" + withpostscript str ; image ( - _tt_n_ := _tt_n_ + 1 ; - _tt_p_ := image ( - addto currentpicture also _tt_p_ ; - addto currentpicture doublepath unitsquare withprescript "tf" withpostscript decimal _tt_n_ & ":" & str ; - ) ; - addto currentpicture doublepath unitsquare withpen pencircle scaled 0 ; + addto currentpicture doublepath unitsquare + withprescript "tx_number=" & decimal _tt_n_ + withprescript "tx_stage=trial" + withpostscript str ) else : - image ( - _tt_n_ := _tt_n_ + 1 ; - addto currentpicture doublepath unitsquare - xscaled _tt_w_[_tt_n_] - yscaled (_tt_h_[_tt_n_] + _tt_d_[_tt_n_]) - withprescript "ts" - withpostscript decimal _tt_n_ & ":" & str ; - ) shifted (0,-_tt_d_[_tt_n_]) + _tt_n_ := _tt_n_ + 1 ; + if known _tt_d_[_tt_n_] : + image ( + addto currentpicture doublepath unitsquare + xscaled _tt_w_[_tt_n_] + yscaled (_tt_h_[_tt_n_] + _tt_d_[_tt_n_]) + withprescript "tx_number=" & decimal _tt_n_ + withprescript "tx_stage=final" + ; % withpostscript str ; + ) shifted (0,-_tt_d_[_tt_n_]) + else : + image ( + addto currentpicture doublepath unitsquare ; + ) + fi fi enddef ; -% not ok yet +% More text pair laboff.d, laboff.dlft, laboff.drt ; % new positional suffixes pair laboff.origin, laboff.raw ; % graph mess @@ -89,44 +168,44 @@ pair laboff.t_r ; laboff.t_r = laboff.urt ; pair laboff.b_l ; laboff.b_l = laboff.llft ; pair laboff.b_r ; laboff.b_r = laboff.lrt ; -labxf.l ; labxf.l = labxf.lft ; -labxf.r ; labxf.r = labxf.rt ; -labxf.b ; labxf.b = labxf.bot ; -labxf.t ; labxf.t = labxf.top ; -labxf.l_t ; labxf.l_t = labxf.ulft ; -labxf.r_t ; labxf.r_t = labxf.urt ; -labxf.l_b ; labxf.l_b = labxf.llft ; -labxf.r_b ; labxf.r_b = labxf.lrt ; -labxf.t_l ; labxf.t_l = labxf.ulft ; -labxf.t_r ; labxf.t_r = labxf.urt ; -labxf.b_l ; labxf.b_l = labxf.llft ; -labxf.b_r ; labxf.b_r = labxf.lrt ; - -labyf.l ; labyf.l = labyf.lft ; -labyf.r ; labyf.r = labyf.rt ; -labyf.b ; labyf.b = labyf.bot ; -labyf.t ; labyf.t = labyf.top ; -labyf.l_t ; labyf.l_t = labyf.ulft ; -labyf.r_t ; labyf.r_t = labyf.urt ; -labyf.l_b ; labyf.l_b = labyf.llft ; -labyf.r_b ; labyf.r_b = labyf.lrt ; -labyf.t_l ; labyf.t_l = labyf.ulft ; -labyf.t_r ; labyf.t_r = labyf.urt ; -labyf.b_l ; labyf.b_l = labyf.llft ; -labyf.b_r ; labyf.b_r = labyf.lrt ; - -labtype.l ; labtype.l = labtype.lft ; -labtype.r ; labtype.r = labtype.rt ; -labtype.b ; labtype.b = labtype.bot ; -labtype.t ; labtype.t = labtype.top ; -labtype.l_t ; labtype.l_t = labtype.ulft ; -labtype.r_t ; labtype.r_t = labtype.urt ; -labtype.l_b ; labtype.l_b = labtype.llft ; -labtype.r_b ; labtype.r_b = labtype.lrt ; -labtype.t_l ; labtype.t_l = labtype.ulft ; -labtype.t_r ; labtype.t_r = labtype.urt ; -labtype.b_l ; labtype.b_l = labtype.llft ; -labtype.b_r ; labtype.b_r = labtype.lrt ; +numeric labxf.l ; labxf.l = labxf.lft ; +numeric labxf.r ; labxf.r = labxf.rt ; +numeric labxf.b ; labxf.b = labxf.bot ; +numeric labxf.t ; labxf.t = labxf.top ; +numeric labxf.l_t ; labxf.l_t = labxf.ulft ; +numeric labxf.r_t ; labxf.r_t = labxf.urt ; +numeric labxf.l_b ; labxf.l_b = labxf.llft ; +numeric labxf.r_b ; labxf.r_b = labxf.lrt ; +numeric labxf.t_l ; labxf.t_l = labxf.ulft ; +numeric labxf.t_r ; labxf.t_r = labxf.urt ; +numeric labxf.b_l ; labxf.b_l = labxf.llft ; +numeric labxf.b_r ; labxf.b_r = labxf.lrt ; + +numeric labyf.l ; labyf.l = labyf.lft ; +numeric labyf.r ; labyf.r = labyf.rt ; +numeric labyf.b ; labyf.b = labyf.bot ; +numeric labyf.t ; labyf.t = labyf.top ; +numeric labyf.l_t ; labyf.l_t = labyf.ulft ; +numeric labyf.r_t ; labyf.r_t = labyf.urt ; +numeric labyf.l_b ; labyf.l_b = labyf.llft ; +numeric labyf.r_b ; labyf.r_b = labyf.lrt ; +numeric labyf.t_l ; labyf.t_l = labyf.ulft ; +numeric labyf.t_r ; labyf.t_r = labyf.urt ; +numeric labyf.b_l ; labyf.b_l = labyf.llft ; +numeric labyf.b_r ; labyf.b_r = labyf.lrt ; + +numeric labtype.l ; labtype.l = labtype.lft ; +numeric labtype.r ; labtype.r = labtype.rt ; +numeric labtype.b ; labtype.b = labtype.bot ; +numeric labtype.t ; labtype.t = labtype.top ; +numeric labtype.l_t ; labtype.l_t = labtype.ulft ; +numeric labtype.r_t ; labtype.r_t = labtype.urt ; +numeric labtype.l_b ; labtype.l_b = labtype.llft ; +numeric labtype.r_b ; labtype.r_b = labtype.lrt ; +numeric labtype.t_l ; labtype.t_l = labtype.ulft ; +numeric labtype.t_r ; labtype.t_r = labtype.urt ; +numeric labtype.b_l ; labtype.b_l = labtype.llft ; +numeric labtype.b_r ; labtype.b_r = labtype.lrt ; vardef thetextext@#(expr p,z) = % adapted copy of thelabel@ if string p : @@ -175,6 +254,34 @@ primarydef str infont name = % very naughty ! fi enddef ; +% Shades + +newinternal shadefactor ; shadefactor := 1 ; +pair shadeoffset ; shadeoffset := origin ; +boolean trace_shades ; trace_shades := false ; + +def set_linear_vector (suffix a,b)(expr p,n) = + if (n=1) : a := llcorner p ; b := urcorner p ; + elseif (n=2) : a := lrcorner p ; b := ulcorner p ; + elseif (n=3) : a := urcorner p ; b := llcorner p ; + elseif (n=4) : a := ulcorner p ; b := lrcorner p ; + elseif (n=5) : a := .5[ulcorner p,llcorner p] ; b := .5[urcorner p,lrcorner p] ; + elseif (n=6) : a := .5[llcorner p,lrcorner p] ; b := .5[ulcorner p,urcorner p] ; + elseif (n=7) : a := .5[lrcorner p,urcorner p] ; b := .5[llcorner p,ulcorner p] ; + elseif (n=8) : a := .5[urcorner p,ulcorner p] ; b := .5[lrcorner p,llcorner p] ; + else : a := .5[ulcorner p,llcorner p] ; b := .5[urcorner p,lrcorner p] ; + fi ; +enddef ; + +def set_circular_vector (suffix ab, r)(expr p,n) = + if (n=1) : ab := llcorner p ; + elseif (n=2) : ab := lrcorner p ; + elseif (n=3) : ab := urcorner p ; + elseif (n=4) : ab := ulcorner p ; + else : ab := center p ; r := .5r ; + fi ; +enddef ; + def circular_shade (expr p, n, ca, cb) = begingroup ; save ab, r ; pair ab ; numeric r ; @@ -186,6 +293,7 @@ def circular_shade (expr p, n, ca, cb) = fi ; endgroup ; enddef ; + def linear_shade (expr p, n, ca, cb) = begingroup ; save a, b, sh ; pair a, b ; @@ -196,46 +304,128 @@ def linear_shade (expr p, n, ca, cb) = fi ; endgroup ; enddef ; + def withcircularshade (expr a, b, ra, rb, ca, cb) = - withprescript - "cs" - withpostscript - "0 1 " & decimal shadefactor & " " & - colordecimals ca & " " & ddecimal (a shifted shadeoffset) & " " & decimal ra & " " & - colordecimals cb & " " & ddecimal (b shifted shadeoffset) & " " & decimal rb + withprescript "sh_type=circular" + withprescript "sh_domain=0 1" + withprescript "sh_factor=" & decimal shadefactor + withprescript "sh_color_a=" & colordecimals ca + withprescript "sh_color_b=" & colordecimals cb + withprescript "sh_center_a=" & ddecimal (a shifted shadeoffset) + withprescript "sh_center_b=" & ddecimal (b shifted shadeoffset) + withprescript "sh_radius_a=" & decimal ra + withprescript "sh_radius_b=" & decimal rb enddef ; + def withlinearshade (expr a, b, ca, cb) = - withprescript - "ls" - withpostscript - "0 1 " & decimal shadefactor & " " & - colordecimals ca & " " & ddecimal (a shifted shadeoffset) & " " & - colordecimals cb & " " & ddecimal (b shifted shadeoffset) -enddef ; -string _defined_cs_pre_[], _defined_cs_post_[] ; numeric _defined_cs_ ; _defined_cs_:= 0 ; + withprescript "sh_type=linear" + withprescript "sh_domain=0 1" + withprescript "sh_factor=" & decimal shadefactor + withprescript "sh_color_a=" & colordecimals ca + withprescript "sh_color_b=" & colordecimals cb + withprescript "sh_center_a=" & ddecimal (a shifted shadeoffset) + withprescript "sh_center_b=" & ddecimal (b shifted shadeoffset) +enddef ; + +string _defined_cs_pre_[] ; numeric _defined_cs_ ; _defined_cs_:= 0 ; +string prescript_separator ; prescript_separator := char(13) ; + vardef define_circular_shade (expr a, b, ra, rb, ca, cb) = _defined_cs_ := _defined_cs_ + 1 ; - _defined_cs_pre_ [_defined_cs_] := "cs" ; - _defined_cs_post_[_defined_cs_] := "0 1 " & decimal shadefactor & " " & - colordecimals ca & " " & ddecimal (a shifted shadeoffset) & " " & decimal ra & " " & - colordecimals cb & " " & ddecimal (b shifted shadeoffset) & " " & decimal rb ; + _defined_cs_pre_ [_defined_cs_] := "sh_type=circular" + & prescript_separator & "sh_domain=0 1" + & prescript_separator & "sh_factor=" & decimal shadefactor + & prescript_separator & "sh_color_a=" & colordecimals ca + & prescript_separator & "sh_color_b=" & colordecimals cb + & prescript_separator & "sh_center_a=" & ddecimal (a shifted shadeoffset) + & prescript_separator & "sh_center_b=" & ddecimal (b shifted shadeoffset) + & prescript_separator & "sh_radius_a=" & decimal ra + & prescript_separator & "sh_radius_b=" & decimal rb + ; _defined_cs_ enddef ; + vardef define_linear_shade (expr a, b, ca, cb) = _defined_cs_ := _defined_cs_ + 1 ; - _defined_cs_pre_ [_defined_cs_] := "ls" ; - _defined_cs_post_[_defined_cs_] := "0 1 " & decimal shadefactor & " " & - colordecimals ca & " " & ddecimal (a shifted shadeoffset) & " " & - colordecimals cb & " " & ddecimal (b shifted shadeoffset) ; + _defined_cs_pre_ [_defined_cs_] := "sh_type=linear" + & prescript_separator & "sh_domain=0 1" + & prescript_separator & "sh_factor=" & decimal shadefactor + & prescript_separator & "sh_color_a=" & colordecimals ca + & prescript_separator & "sh_color_b=" & colordecimals cb + & prescript_separator & "sh_center_a=" & ddecimal (a shifted shadeoffset) + & prescript_separator & "sh_center_b=" & ddecimal (b shifted shadeoffset) + ; _defined_cs_ enddef ; + primarydef p withshade sc = - p withprescript _defined_cs_pre_[sc] withpostscript _defined_cs_post_[sc] + p withprescript _defined_cs_pre_[sc] +enddef ; + +% vardef predefined_linear_shade (expr p, n, ca, cb) = +% save a, b, sh ; pair a, b ; +% set_linear_vector(a,b)(p,n) ; +% define_linear_shade (a,b,ca,cb) +% enddef ; +% +% vardef predefined_circular_shade (expr p, n, ca, cb) = +% save ab, r ; pair ab ; numeric r ; +% r := (xpart lrcorner p - xpart llcorner p) ++ (ypart urcorner p - ypart lrcorner p) ; +% set_circular_vector(ab,r)(p,n) ; +% define_circular_shade(ab,ab,0,r,ca,cb) +% enddef ; + +% NEW EXPERIMENTAL CODE + +def withlinearshading (expr a, b) = + withprescript "sh_type=linear" + withprescript "sh_domain=0 1" + withprescript "sh_factor=" & decimal shadefactor + withprescript "sh_center_a=" & ddecimal (a shifted shadeoffset) + withprescript "sh_center_b=" & ddecimal (b shifted shadeoffset) +enddef ; + +def withcircularshading (expr a, b, ra, rb) = + withprescript "sh_type=circular" + withprescript "sh_domain=0 1" + withprescript "sh_factor=" & decimal shadefactor + withprescript "sh_center_a=" & ddecimal (a shifted shadeoffset) + withprescript "sh_center_b=" & ddecimal (b shifted shadeoffset) + withprescript "sh_radius_a=" & decimal ra + withprescript "sh_radius_b=" & decimal rb +enddef ; + +def withfromshadecolor expr t = + withprescript "sh_color=into" + withprescript "sh_color_a=" & colordecimals t +enddef ; + +def withtoshadecolor expr t = + withprescript "sh_color=into" + withprescript "sh_color_b=" & colordecimals t +enddef ; + +def withshading (expr how)(text rest) = + if how = "linear" : + withlinearshading(rest) + elseif how = "circular" : + withcircularshading(rest) + else : + % nothing + fi enddef ; -def shadecolor(expr sc) = % obsolete - 1 withprescript _defined_cs_pre_[sc] withpostscript _defined_cs_post_[sc] + +primarydef a shadedinto b = + 1 + withprescript "sh_color=into" + withprescript "sh_color_a=" & colordecimals a + withprescript "sh_color_b=" & colordecimals b enddef ; +% END OF NEW + +% Graphic text (we will move code here) + def graphictext primary t = if _trial_run_ : let dographictextindeed = nographictext ; @@ -244,32 +434,80 @@ def graphictext primary t = fi dographictextindeed(t) enddef ; + def dographictext (expr t) = + % withprescript "gt_stage=final" begingroup ; save figurepicture ; picture figurepicture ; figurepicture := currentpicture ; currentpicture := nullpicture ; currentgraphictext := currentgraphictext + 1 ; dofinishgraphictext enddef ; + def nographictext (expr t) text rest = - draw unitsquare withprescript "gt" withpostscript t ; + draw unitsquare withprescript "gt_stage=trial" withpostscript t enddef ; -def savegraphictext (expr str) = + +% def savegraphictext (expr str) = +% enddef ; + +% def erasegraphictextfile = +% enddef ; + +% Layers + +def onlayer primary name = + withprescript "la_name=" & name enddef ; -def erasegraphictextfile = + + +% Figures + +% def externalfigure primary filename = +% doexternalfigure (filename) +% enddef ; +% +% def doexternalfigure (expr filename) text transformation = +% if true : % a bit incompatible esp scaled 1cm now scaled the natural size +% draw rawtextext("\externalfigure[" & filename & "]") transformation ; +% else : +% draw unitsquare transformation withprescript "fg_name=" & filename ; +% fi ; +% enddef ; + +def withmask primary filename = + withprescript "fg_mask=" & filename enddef ; def externalfigure primary filename = - doexternalfigure (filename) + if false : + rawtextext("\externalfigure[" & filename & "]") + else : + image ( + addto currentpicture doublepath unitsquare + withprescript "fg_name=" & filename ; + ) +% unitsquare +% withpen pencircle scaled 0 +% withprescript "fg_name=" & filename + fi enddef ; -def doexternalfigure (expr filename) text transformation = - draw unitsquare transformation withprescript "fg" withpostscript filename ; + +def figure primary filename = + rawtextext("\externalfigure[" & filename & "]") enddef ; +% Positions + def register (expr label, width, height, offset) = - draw unitsquare xscaled width yscaled height shifted offset withprescript "ps" withpostscript label ; + image ( + addto currentpicture doublepath unitsquare xscaled width yscaled height shifted offset + withprescript "ps_label=" & label ; + ) ; % no transformations enddef ; +% Housekeeping + extra_beginfig := extra_beginfig & "currentgraphictext := 0 ; " ; extra_endfig := extra_endfig & "finishsavingdata ; " ; extra_endfig := extra_endfig & "resettextexts ; " ; @@ -277,6 +515,19 @@ extra_endfig := extra_endfig & "resettextexts ; " ; boolean cmykcolors ; cmykcolors := true ; boolean spotcolors ; spotcolors := true ; +% Bonus + vardef verbatim(expr str) = ditto & "\detokenize{" & str & "}" & ditto enddef ; + +% New + +def bitmapimage(expr xresolution, yresolution, data) = + image ( + addto currentpicture doublepath unitsquare + withprescript "bm_xresolution=" & decimal xresolution + withprescript "bm_yresolution=" & decimal yresolution + withpostscript data ; + ) +enddef ; diff --git a/Master/texmf-dist/metapost/context/base/mp-page.mp b/Master/texmf-dist/metapost/context/base/mp-page.mp index 60bfb141754..59d8bccbcd7 100644 --- a/Master/texmf-dist/metapost/context/base/mp-page.mp +++ b/Master/texmf-dist/metapost/context/base/mp-page.mp @@ -123,7 +123,7 @@ vardef InsideSavedTextArea (expr _i_, _xy_) = (round(ypart _xy_) <= round(ypart urcorner SavedTextAreas[_i_])) ) enddef ; -vardef InsideSomeTextArea(expr _xy_) = +vardef InsideSomeTextArea (expr _xy_) = save ok ; boolean ok ; ok := false ; for i := 1 upto NOfTextAreas : if InsideTextArea(i,_xy_) : ok := true ; fi ; @@ -132,7 +132,7 @@ vardef InsideSomeTextArea(expr _xy_) = ok enddef ; -vardef InsideSomeSavedTextArea(expr _xy_) = +vardef InsideSomeSavedTextArea (expr _xy_) = save ok ; boolean ok ; ok := false ; for i := 1 upto NOfSavedTextAreas : if InsideSavedTextArea(i,_xy_) : ok := true ; fi ; @@ -211,6 +211,10 @@ vardef TextAreaWH (expr x, y) = _TextAreaWH_ enddef ; +string CurrentLayout ; + +CurrentLayout := "default" ; + PageNumber := 0 ; PaperHeight := 845.04684pt ; PaperWidth := 597.50787pt ; diff --git a/Master/texmf-dist/metapost/context/base/mp-spec.mp b/Master/texmf-dist/metapost/context/base/mp-spec.mp index 9125b4b8bc2..123e75faaae 100644 --- a/Master/texmf-dist/metapost/context/base/mp-spec.mp +++ b/Master/texmf-dist/metapost/context/base/mp-spec.mp @@ -47,6 +47,7 @@ %D for instance shading. More information can be found in %D type {supp-mpe.tex}. +if known mplib : endinput ; fi ; if unknown context_tool : input mp-tool ; fi ; if known context_spec : endinput ; fi ; @@ -366,18 +367,16 @@ def circular_shade (expr p, n, ca, cb) = enddef ; vardef predefined_linear_shade (expr p, n, ca, cb) = - save a, b, sh ; pair a, b ; - set_linear_vector(a,b)(p,n) ; - set_shade_vector(a,b)(p,n) ; - define_linear_shade (a,b,ca,cb) + save a, b, sh ; pair a, b ; + set_linear_vector(a,b)(p,n) ; + define_linear_shade (a,b,ca,cb) enddef ; vardef predefined_circular_shade (expr p, n, ca, cb) = - save ab, r ; pair ab ; numeric r ; - r := (xpart lrcorner p - xpart llcorner p) ++ - (ypart urcorner p - ypart lrcorner p) ; - set_circular_vector(ab,r)(p,n) ; - define_circular_shade(ab,ab,0,r,ca,cb) + save ab, r ; pair ab ; numeric r ; + r := (xpart lrcorner p - xpart llcorner p) ++ (ypart urcorner p - ypart lrcorner p) ; + set_circular_vector(ab,r)(p,n) ; + define_circular_shade(ab,ab,0,r,ca,cb) enddef ; %D Since a \type {fill p withshade s} syntax looks better @@ -638,8 +637,7 @@ vardef transparent(expr n, t, c) = flush_special(3, 7, s) ; fi ; scantokens(ss) := _special_counter_ ; - _local_specials_ := _local_specials_ & - "scantokens(" & ditto & ss & ditto & ") := -1 ;" ; + _local_specials_ := _local_specials_ & "scantokens(" & ditto & ss & ditto & ") := -1 ;" ; fi ; % go ahead if is_spot : @@ -661,6 +659,18 @@ vardef is_transparent(text t) = endgroup enddef ; +% boolean _b_ ; better namespacing +% color _c_ ; +% vardef _transparent_(expr nn, tt, cc) = _b_ := true ; cc enddef ; +% vardef is_transparent(text t) = +% begingroup ; +% save transparent ; +% transparent := _transparent_ ; +% _b_ := false ; +% _c_ := t ; _b_ +% endgroup +% enddef ; + %D This function returns the not transparent color. vardef not_transparent(text t) = diff --git a/Master/texmf-dist/metapost/context/base/mp-tool.mp b/Master/texmf-dist/metapost/context/base/mp-tool.mp index 1a748baf9ea..7f047fefcce 100644 --- a/Master/texmf-dist/metapost/context/base/mp-tool.mp +++ b/Master/texmf-dist/metapost/context/base/mp-tool.mp @@ -251,6 +251,7 @@ def newtransform text v = forsuffixes i=v : save i ; transform i ; endfor ; endd def newpath text v = forsuffixes i=v : save i ; path i ; endfor ; enddef ; def newpicture text v = forsuffixes i=v : save i ; picture i ; endfor ; enddef ; def newstring text v = forsuffixes i=v : save i ; string i ; endfor ; enddef ; +def newpair text v = forsuffixes i=v : save i ; pair i ; endfor ; enddef ; %D Sometimes we don't want parts of the graphics add to the %D bounding box. One way of doing this is to save the bounding diff --git a/Master/texmf-dist/metapost/context/font/punkfont-bold.mp b/Master/texmf-dist/metapost/context/font/punkfont-bold.mp new file mode 100644 index 00000000000..1c62963f9aa --- /dev/null +++ b/Master/texmf-dist/metapost/context/font/punkfont-bold.mp @@ -0,0 +1,4 @@ +boolean bold_punk ; bold_punk := true ; + +input "punkfont-definitions.mp" ; +input "punkfont-characters.mp" ; diff --git a/Master/texmf-dist/metapost/context/font/punkfont-boldslanted.mp b/Master/texmf-dist/metapost/context/font/punkfont-boldslanted.mp new file mode 100644 index 00000000000..3e5fa1561df --- /dev/null +++ b/Master/texmf-dist/metapost/context/font/punkfont-boldslanted.mp @@ -0,0 +1,5 @@ +boolean bold_punk ; bold_punk := true ; +boolean slanted_punk ; slanted_punk := true ; + +input "punkfont-definitions.mp" ; +input "punkfont-characters.mp" ; diff --git a/Master/texmf-dist/metapost/context/font/punkfont-characters.mp b/Master/texmf-dist/metapost/context/font/punkfont-characters.mp new file mode 100644 index 00000000000..da0015b02b4 --- /dev/null +++ b/Master/texmf-dist/metapost/context/font/punkfont-characters.mp @@ -0,0 +1,726 @@ +initialize_punk_upper ; + +beginpunkchar("A",13,1,2); +z1=pp(1.5u,0); z2=(.5w,1.1h); z3=pp(w-1.5u,0); +pd z1; pd z3; draw z1--z2--z3; % left and right diagonals +z4=pp .3[z1,z2]; z5=pp .3[z3,z2]; pd z4; pd z5; draw z4--z5; % crossbar +endchar; + +beginpunkchar("B",12,1,1); +z1=pp(2u,0); z2=pp(2u,.6h); z3=pp(2u,h); pd z1; pd z3; draw z1--z3; % stem +z1.5=pp(w-u,.5y2); z2.5=pp(w-u,.5[y2,y3]); draw z2--z2.5--z3; % upper lobe +draw flex(z2,z1.5,z1); % lower lobe +endchar; + +beginpunkchar("C",13,1,2); +z1=pp(w-2u,.8h); z2=pp(.6w,h); z3=pp(u,.5h); z4=(.6w,0); z5=(w-2u,.2h); +pd z1; pd z5; draw z1..z2..z3..z4..z5; % arc +endchar; + +beginpunkchar("D",14,1,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-u,.6h); +pd z1; pd z2; draw flex(z1,z3,z2); % lobe +draw z1--z2; % stem +endchar; + +beginpunkchar("E",12,.5,1); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2.5u,h); z4=pp(w-2u,0); +pd z3; pd z4; draw z4--z1--z2--z3; % stem and arms +z5=pp(2u,.6h); z6=pp(w-3u,.6h); pd z5; pd z6; draw z5--z6; % crossbar +endchar; + +beginpunkchar("F",12,.5,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,h); +pd z1; pd z3; draw z1--z2--z3; % stem and arm +z5=pp(2u,.6h); z6=pp(w-3u,.6h); z4=pp .5[z5,z6]-(0,.1h); +pd z5; pd z6; draw flex (z5,z4,z6); % crossbar +endchar; + +beginpunkchar("G",13,.5,.5); +z1=pp(w-2u,.8h); z2=pp(.6w,h); z3=pp(u,.5h); z4=pp(.6w,0); z5=(w-2u,0); +pd z1; draw z1..z2..z3..z4---z5; % arc +z6=pp(.5[u,x5],.4h); pd z6; pd z5; draw z6--(pp(x5,y6))--z5; % spur +endchar; + +beginpunkchar("H",14,1,.5); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,0); z4=pp(w-2u,h); +z5=pp(2u,.6h); z6=pp(w-2u,.6h); +pd z1; pd z2; pd z3; pd z4; draw z1--z2; draw flex(z3,z6,z4); % stems +pd z5; draw z5--z6; % crossbar +endchar; + +beginpunkchar("I",5,1,2); +z1=pp(.5w,0); z2=(.5w,1/3h); z3=(.5w,2/3h); z4=(.5w,h); +pd z1; pd z4; draw flex(z1,z2,z3,z4); % stem +endchar; + +beginpunkchar("J",9,1,2); +z1=pp(w-2u,h); z2=pp(w-2u,-.1h); z3=pp(u,0); +pd z1; pd z3; draw z1--z2--z3; % arc +endchar; + +beginpunkchar("K",14,1,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(2u,1/3h); z4=pp(w-1.5u,h); +pd z1; pd z2; draw z1--z2; % stem +pd z3; pd z4; draw z3--z4; % upper diagonal +z6=pp(w-u,0); z5=1/3[z3,z4]; +pd z6; draw flex(z5,.8[z1,2/3[z5,z6] ],z6);% lower diagonal +endchar; + +beginpunkchar("L",11,1,2); +z1=pp(2u,h); z2=pp(2u,0); z3=pp(w-1.5u,0); +pd z1; pd z3; draw z1--z2--z3; % stem and arm +endchar; + +beginpunkchar("M",17,.5,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(.5w,0); z4=pp(w-2u,h); z5=pp(w-2u,0); +pd z1; pd z5; draw z1--z2--z3--z4--z5; % stems and diagonals +endchar; + +beginpunkchar("N",13,.75,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,0); z4=pp(w-2u,h); +pd z1; pd z4; draw z1--z2--z3--z4; % stems and diagonals +endchar; + +beginpunkchar("O",12,.5,2); +z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h); +pd z1; draw z1{left}..z2..z3..z4..z1; % bowl +endchar; + +beginpunkchar("P",13,1,2); +z1=pp(2u,0); z2=pp(2u,1.1h); z3=pp(2u,.5h); z4=pp(w,.6[y3,y2]); +pd z1; pd z3; draw z1--z2--z4--z3; % stem and bowl +endchar; + +beginpunkchar("Q",14,.5,2); +z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h); +pd z1; draw z1{curl 2}..z2..z3..z4..z1; % bowl +z5=pp(.4w,.2h); z6=pp(w-u,-.1h); z7=pp(.5[x5,x6],-.2h); +pd z5; pd z6; draw z5--z7--z6; % tail +endchar; + +beginpunkchar("R",16,1,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-u,.6[y2,y4]); z4=pp(2u,.5h); z5=pp(w-1.5u,0); +pd z1; pd z2; pd z5; draw z1--flex(z2,z3,z4)--z5; % stem, bowl, and diagonal +endchar; + +beginpunkchar("S",11,.3,1); +z1=pp(w-2u,.9h); z2=pp(.5w,h); z3=pp(u,.7h); z4=.6[z6,z2]; +z5=pp(w-u,.35h); z6=pp(.5w,u); z7=pp(u,.2h); +pd z1; pd z7; draw z1--z2...z3..z4..z5...z6--z7; % stroke +endchar; + +beginpunkchar("T",13,.75,2); +z1=pp(u,h); z2=pp(w-u,h); z3=pp(.5w,0); +pd z1; pd z2; pd z3; draw z1--z2; % arms +draw .5[z1,z2]--z3; % stem +endchar; + +beginpunkchar("U",13,.3,2); +z1=pp(2u,h); z2=pp(2u,.2h); z3=pp(.5w,0); z4=pp(w-2u,.2h); z5=pp(w-2u,h); +pd z1; pd z5; draw z1---z2...z3{z4-z2}...z4---z5; % stroke +endchar; + +beginpunkchar("V",13,1,2); +z1=pp(1.5u,h); z2=pp(.5w,0); z3=pp(w-1.5u,h); +pd z1; pd z3; draw z1--z2--z3; % diagonals +endchar; + +beginpunkchar("W",18,1,2); +z1=pp(1.5u,h); z2=pp(.5[x1,x3],0); z3=pp(.5w,.8h); z4=pp(.5[x3,x5],0); +z5=pp(w-1.5u,h); +pd z1; pd z5; draw z1--z2--z3--z4--z5; % diagonals +endchar; + +beginpunkchar("X",13,1,1); +z1=pp(1.5u,h); z2=pp(w-1.5u,0); z3=pp(1.5u,0); z4=pp(w-2.5u,h); +pd z1; pd z2; draw z1--z2; % main diagonal +pd z3; pd z4; draw z3--z4; % cross diagonal +endchar; + +beginpunkchar("Y",13,1,2); +z1=pp(1.5u,h); z2=pp(w-1.5u,h); z3=pp(.5w,.5h); z4=pp(.5w,0); +pd z1; pd z2; pd z4; draw z1--z3--z4; % stem and left diagonal +draw z2--z3; % right diagonal +endchar; + +beginpunkchar("Z",11,1,2); +z1=pp(1.5u,h); z2=pp(w-2.5u,h); z3=pp(1.5u,0); z4=pp(w-1.5u,0); +pd z1; pd z4; draw z1--z2--z3--z4; % diagonals +endchar; + +beginpunkchar(198,16,1,2); % \AE +z1=pp(1.5u,0); z2=pp(.6w,h); z3=pp(w-1.5u,h); +pd z1; pd z3; draw z1--z2--z3; % left diagonal and upper arm +z4=pp .3[z1,z2]; z5=pp(.6w,0); z6=pp(w-2u,.3h); +pd z4; pd z6; draw z4--z6; % crossbar +z7=pp(w-u,0); pd z2; pd z7; draw z2--z5--z7; % stem and lower arm +endchar; + +beginpunkchar(338,18,1,2); % \OE +z1=pp(.5w,h); z2=pp(u,.4h); z3=pp(.5w,0); +pd z1; draw z1..z2..{right}z3; % bowl +z4=pp(w-1.5u,h); z5=pp(w-2u,.4h); z6=pp(w-u,0); +pd z4; pd z6; draw z4--z1--z3--z6; % arms and stem +pd z5; draw z5--.4[z3,z1]; % crossbar +endchar; + +beginpunkchar(216,14,1,1); % \O +z1=pp(.5w,h); z2=pp(u,.5h); z3=pp(.5w,0); z4=pp(w-u,.5h); +z5=pp(w-2u,1.1h); z6=pp(2u,-.1h); +pd z1; pd z6; draw z1..z2..z3..z4..z5--z6; % bowl and diagonal +endchar; + +beginpunkchar(915,11,1,2); % $\Gamma$ +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-1.5u,h); +pd z1; pd z3; draw z1--z2--z3; % stem and arm +endchar; + +beginpunkchar(916,15,1,2); % $\Delta$ +z1=pp(u,0); z2=pp(.5w,h); z3=pp(w-u,0); +pd z1; draw z1--z2..tension 5..z3..tension 5..z1; % triangle +endchar; + +beginpunkchar(920,15,.5,2); % $\Theta$ +z1=pp(.5w,h); z2=pp(u,.6h); z3=pp(.5w,0); z4=pp(w-u,.6h); +pd z1; draw z1..tension.8..z2..z3..z4..tension.8..z1; % bowl +z5=pp(x2+2u,.4h); z6=pp(x4-2u,.4h); pd z5; pd z6; draw z5--z6; % bar +endchar; + +beginpunkchar(923,12,1,2); % $\Lambda$ +z1=pp(u,0); z2=pp(.5w,h); z3=pp(w-u,0); +pd z1; pd z3; draw z1--z2--z3; % diagonals +endchar; + +beginpunkchar(926,12,1,1); % $\Xi$ +z1=pp(u,h); z2=pp(w-u,h); pd z1; pd z2; draw z1--z2; % upper arm +z3=pp(2u,.55h); z4=pp(w-2u,.55h); pd z3; pd z4; draw z3--z4; % bar +z5=pp(u,0); z6=pp(w-u,0); pd z5; pd z6; draw z5--z6; % lower arm +endchar; + +beginpunkchar(928,13,1,.5); % $\Pi$ +z1=pp(1.5u,0); z2=pp(1.5u,h); z3=pp(w-1.5u,h); z4=pp(w-1.5u,0); +pd z1; pd z4; draw z1--z2--z3--z4; % stems and bar +endchar; + +beginpunkchar(931,13,1,1); % $\Sigma$ +z1=pp(w-u,h); z2=pp(u,h); z3=pp(.5w-u,.5h); z4=pp(u,0); z5=pp(w-u,0); +pd z1; pd z5; draw z1--z2{.5[z4,z5]-z2}..z3--z4--z5; % arms and diagonals +endchar; + +beginpunkchar(933,15,1,.5); % $\Upsilon$ +z1=pp(u,.8h); z2=pp(.3w,h); z3=pp(.5w,.5h); z4=pp(.5w,0); +pd z1; pd z4; draw z1..z2..tension2..z3---z4; % left arc and stem +z5=pp(w-u,.8h); z6=pp(.7w,h); +pd z5; draw z5..z6..tension2..{z4-z3}z3; % right arc +endchar; + +beginpunkchar(934,13,1,2); % $\Phi$ +z1=pp(.5w,h); z2=pp(.5w,0); pd z1; pd z2; draw z1--z2; % stem +z3=pp(.5w,2/3h); z4=pp(u,.5h); z5=pp(.5w,1/4h); z6=pp(w-u,.5h); +pd z3; draw z3..z4..z5..z6..z3; % bowl +endchar; + +beginpunkchar(936,14,1,1); % $\Psi$ +z1=pp(.5w,h); z2=pp(.5w,0); pd z1; pd z2; draw z1--z2; % stem +z3=pp(u,.8h); z4=pp(.5w,.2h); z5=pp(w-u,.8h); +pd z3; pd z5; draw z3{.4[z1,z2]-z3}..z4{right}..{z5-.4[z1,z2]}z5; % stroke +endchar; + +beginpunkchar(937,13,1,2); % $\Omega$ +z1=pp(u,0); z2=pp(1/3w,0); z3=pp(u,2/3h); z4=pp(.5w,h); +z5=pp(w-u,2/3h); z6=pp(2/3w,0); z7=pp(w-u,0); +pd z1; pd z7; draw z1--z2{up}..z3..z4..z5..{down}z6--z7; % bowl and arms +endchar; + +beginpunkchar(".",5,1,2); +pd pp(.5w,0); % dot +endchar; + +beginpunkchar(",",5,.5,.5); +z1=pp(.5w,0); z2=pp(w-u,-.1h); z3=pp(.5w,-.3h); +pd z1; pd z3; draw z1--z2--z3; % stroke +endchar; + +beginpunkchar(":",5,1,.5); +pd pp(.5w,0); pd pp(.5w,.4h); % dots +endchar; + +beginpunkchar(";",5,.5,.5); +z1=pp(.5w,0); z2=pp(w-u,-.1h); z3=pp(.5w,-.3h); +pd z1; pd z3; draw z1--z2--z3; % stroke +pd pp(.5w,.4h); % dot +endchar; + +beginpunkchar("!",5,.5,.5); +pd pp(.5w,0); % dot +z1=pp(.5w,1.05h); z2=pp(.5w,.3h); pd z1; pd z2; draw z1--z2; % stem +endchar; + +beginpunkchar(161,5,.5,.5); % spanish inverted ! +pd pp(.5w,.9h); % dot +z1=pp(.5w,-.1h); z2=pp(.5w,.6h); pd z1; pd z2; draw z1--z2; % stem +endchar; + +beginpunkchar("?",9,1,.5); +z1=pp(1.5u,.8h); z2=pp(.5w,h); z3=pp(w-u,.8h); z4=pp(.5w,.3h); +pd z1; pd z4; draw z1..z2..z3..{down}z4; % arc and stem +pd pp(.5w,0); % dot +endchar; + +beginpunkchar(191,9,1,.5); % spanish inverted ? +z1=pp(1.5u,.1h); z2=pp(.5w,-.1h); z3=pp(w-u,.1h); z4=pp(.5w,.6h); +pd z1; pd z4; draw z1..z2..z3..{up}z4; % arc and stem +pd pp(.5w,.9h); % dot +endchar; + +beginpunkchar("&",14,.5,.5); +z1=pp(w-2u,h); z2=pp(u,h); z3=pp(3u,0); z5=pp(w-u,.6h); z6=pp(w-2u,0); +pd z1; pd z5; draw z1--z2--z3--z5; % arms and stem +draw z1--.5[z2,z3]; pd z6; draw z6--.6[z3,z5]; % diagonals +endchar; + +beginpunkchar("$",12,.5,.5); +z1=pp(w-1.5u,.7h); z2=pp(.5w,h); z3=pp(u,.7h); z4=.5[z3,z5]; +z5=pp(w-u,.3h); z6=pp(.5w,0); z7=pp(u,.3h); +pd z1; pd z7; draw z1..z2..z3..z4..z5..z6..z7; % stroke +z8=z2+(0,.1h); pd z8; draw z8--z6; % stem +endchar; + +beginpunkchar("%",18,.5,.5); +z1=pp(3.5u,1.1h); z2=pp(u,.8h); z3=pp(3.5u,.5h); z4=pp(6u,.8h); +z5=pp(w-3.5u,.5h); z6=pp(w-6u,.2h); z7=pp(w-3.5u,-.1h); z8=pp(w-u,.2h); +pd z1; draw z1..z2..z3..z4..z1; % upper bowl +pd z5; draw z5..z6..z7..z8..z5; % lower bowl +z9=pp(w-3u,1.1h); z0=pp(3u,-.1h); pd z0; draw z9--z0; % diagonal +draw z1{z5-z1}..z9; % link +endchar; + +beginpunkchar("@",18,1,.5); +z1=pp(2u,0); z2=pp(1/3w,.7h); z3=pp(w-6u,0); +z4=pp(w,.3h); z5=pp(1/3w,h); z6=pp(u,.5h); z7=.7[z2,z3]; +pd z1; pd z7; draw z1--z2--z3{right}..z4..z5..z6..z7; % diagonals and stroke +endchar; + +beginpunkchar("-",7,.5,.5); +z1=pp(u,.4h); z2=pp(w-u,.5h); pd z1; pd z2; draw z1--z2; % bar +endchar; + +beginpunkchar(8211,9,.5,.5); % -- +z1=pp(0,.5h); z2=pp(w,.4h); pd z1; pd z2; draw z1--z2; % bar +endchar; + +beginpunkchar(8212,18,.5,.5); % --- +z1=pp(0,.5h); z2=pp(w,.4h); pd z1; pd z2; draw z1--z2; % bar +endchar; + +beginpunkchar("+",9,.5,1); +z1=pp(0,.5h); z2=pp(w,.5h); pd z1; pd z2; draw z1--z2; % bar +z3=pp(.5w,.1h); z4=pp(.5w,.9h); pd z3; pd z4; draw z3--z4; % stem +endchar; + +beginpunkchar("*",13,.5,1); +z0=pp(.5w,1.1h); z1=pp(u,.9h); z2=pp(2u,.3h); z3=pp(w-u,.3h); z4=pp(w-u,.9h); +pd z0; draw z0--z2..1/3[.5[z2,z4],z0]..z4--z1--z3--z0; % star +endchar; + +beginpunkchar(39,5,.5,1.5); % ' apostrofe HH/TH (to be checked) +z1=pp(w/2,h); z2=pp(w/2+u,.85h); z3=pp(w/2,2/3h); +pd z1; pd z3; draw z1..z2..z3; % stroke +endchar; + +beginpunkchar(34,9,1,1.5); % " HH/TH (to be checked) +z1=pp(1.5u,h); z2=pp(1.5u,.6h); z3=pp(w-1.5u,h); z4=pp(w-1.5u,.6h); +pd z1; pd z2; pd z3; pd z4; draw z1--z2; draw z3--z4; +endchar; + +beginpunkchar(8216,5,.3,.5); % ` +z1=pp(w-1.5u,h); z2=pp(u,.85h); z3=pp(w-u,2/3h); +pd z1; pd z3; draw z1--z2--z3; % stroke +endchar; + +beginpunkchar(8217,5,.3,.5); % ' +z1=pp(1.5u,h); z2=pp(w-u,.85h); z3=pp(u,2/3h); +pd z1; pd z3; draw z1--z2--z3; % stroke +endchar; + +beginpunkchar(8220,9,.3,.5); % `` quotedblleft +z1=pp(.5w+.5u,h); z2=pp(w-u,.6h); z3=pp(u,.95h); +pd z1; pd z3; draw z1--z2--z3; % stroke +endchar; + +beginpunkchar(8221,9,.3,.5); % '' quotedblright +z1=pp(.5w-.5u,h); z2=pp(u,.6h); z3=pp(w-u,.95h); +pd z1; pd z3; draw z1--z2--z3; % stroke +endchar; + +beginpunkchar("(",7,.5,.5); +z1=pp(w-u,h); z2=pp(u,.5h); z3=pp(w-u,0); +pd z1; pd z3; draw z1..z2..z3; % stroke +endchar; + +beginpunkchar(")",7,.5,.5); +z1=pp(u,h); z2=pp(w-u,.5h); z3=pp(u,0); pd z1; pd z3; draw z1..z2..z3; % stroke +endchar; + +beginpunkchar("[",8,.5,.5); +z1=pp(w-u,h); z2=pp(.5w,h); z3=pp(.5w,0); z4=pp(w-u,0); +pd z1; pd z4; draw z1--z2--z3--z4; % bars and stem +endchar; + +beginpunkchar("]",8,.5,.5); +z1=pp(u,h); z2=pp(.5w,h); z3=pp(.5w,0); z4=pp(u,0); +pd z1; pd z4; draw z1--z2--z3--z4; % bars and stem +endchar; + +beginpunkchar("<",9,.5,.5); +z1=pp(w-u,.9h); z2=pp(u,.5h); z3=pp(w-u,.1h); +pd z1; pd z3; draw z1--z2--z3; % diagonals +endchar; + +beginpunkchar(">",9,.5,.5); +z1=pp(u,.9h); z2=pp(w-u,.5h); z3=pp(u,.1h); +pd z1; pd z3; draw z1--z2--z3; % diagonals +endchar; + +beginpunkchar("{",10,.5,.5); % HH/TH +z1=pp(w-2u,h); z3=pp(2u,.5h); z5=pp(w-2u,0); +z2=pp(w-4u,.6h); z4=(w-4u,.4h); +pd z1; pd z3; pd z5; draw z1{left}..z2--z3 & z3--z4..{right}z5; +endchar; + +beginpunkchar("}",10,.5,.5); % HH/TH +z1=pp(2u,h); z3=pp(w-2u,.5h); z5=pp(2u,0); +z2=pp(4u,.6h); z4=(4u,.4h); +pd z1; pd z3; pd z5; draw z1{right}..z2--z3 & z3--z4..{left}z5; +endchar; + +beginpunkchar("=",9,.5,.5); +z5=pp(u,2/3h); z6=pp(w-u,2/3h); pd z5; pd z6; draw z5--z6; % upper bar +z7=pp(u,1/3h); z8=pp(w-u,1/3h); pd z7; pd z8; draw z7--z8; % lower bar +endchar; + +beginpunkchar("#",15,.5,.5); +z1=pp(.5w,h); z2=pp(3u,0); z3=pp(w-3u,h); z4=pp(.5w,0); +pd z2; pd z3; draw z3--z1--z2; draw z3--z4--z2; % diagonals (linked) +z5=pp(u,2/3h); z6=pp(w-u,2/3h); pd z5; pd z6; draw z5--z6; % upper bar +z7=pp(u,1/3h); z8=pp(w-u,1/3h); pd z7; pd z8; draw z7--z8; % lower bar +endchar; + +beginpunkchar("/",9,1,1); +z1=pp(1.5u,-.05h); z2=pp(w-1.5u,1.05h); pd z1; pd z2; draw z1--z2; % diagonal +endchar; + +beginpunkchar("\",9,1,1); % HH/TH +z1=pp(1.5u,1.05h); z2=pp(w-1.5u,-.05h); pd z1; pd z2; draw z1--z2; % reverse diagonal +endchar; + + +beginpunkchar("0",9,.5,1); +z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h); +pd z1; draw z1{curl 2}..z2..z3..z4..z1; % bowl +endchar; + +beginpunkchar("1",9,.3,1); +z1=pp(2u,.7h); z2=pp(.6w,h); z3=pp(.6w,0); +pd z1; pd z3; draw z1--z2--z3; % serif and stem +endchar; + +beginpunkchar("2",9,1,1); +z1=pp(2u,.7h); z2=pp(.5w,h); z3=pp(w-u,.6h); z4=pp(u,0); z5=pp(w-2u,0); +pd z1; pd z5; draw z1..z2..z3..z4--z5; % stroke +endchar; + +beginpunkchar("3",9,.5,.5); +z1=pp(2u,.7h); z2=pp(.5w,h); z3=pp(w-u,.5[y2,y4]); +z4=pp(.5w-u,.55h); z5=pp(w-u,.5[y4,y6]); z6=pp(.5w,0); z7=pp(1.5u,.2h); +pd z1; pd z7; draw z1..z2..z3..z4&z4..z5..z6..z7; % arcs +endchar; + +beginpunkchar("4",9,1,1); +z1=pp(w-u,.3h); z2=pp(u,.3h); z3=pp(2/3w,h); z4=pp(2/3w,0); +pd z1; pd z4; draw z1--z2--z3--z4; % stem and diagonals +endchar; + +beginpunkchar("5",9,.5,.5); +z1=pp(w-2u,h); z2=pp(2u,h); z3=pp(u,.7h); z4=pp(w-u,.5[y3,y5]); +z5=pp(.5w,0); z6=pp(u,.2h); +pd z1; pd z6; draw z1--z2--z3..z4..z5..z6; % stroke +endchar; + +beginpunkchar("6",9,1,1); +z1=pp(2/3w,h); z2=pp(u,.3h); z3=pp(.5w,0); z4=pp(w-u,.3h); z5=pp(.6w,.6h); +z6=pp z2; pd z1; pd z6; draw z1..z2..z3..z4..z5--z6; % stroke +endchar; + +beginpunkchar("7",9,.5,1); +z1=pp(2u,h); z2=pp(w-.5u,h); z3=pp(.4w,0); +pd z1; pd z3; draw z1--z2&z2..z3{down}; % stroke +endchar; + +beginpunkchar("8",9,.5,.5); +z1=pp(.5w,h); z2=pp(u,.5[y1,y3]); z3=pp(.5w,.6h); z4=pp(w-u,.5[y3,y5]); +z5=pp(.5w,0); z6=pp(u,.5[y5,y3]); z7=pp(w-u,.5[y1,y3]); +pd z1; draw z1{curl 8}..z2..z3..z4..z5..z6..z3..z7..z1; % stroke +endchar; + +beginpunkchar("9",9,1,1); +z1=pp(1/3w,0); z2=pp(w-u,.7h); z3=pp(.5w,h); z4=pp(u,.7h); z5=pp(.5w,.4h); +pd z1; pd z5; draw z1..z2..z3..z4..z5; % stroke +endchar; + +beginpunkchar(96,9,1,1); % \`{} grave +z1=pp(2.5u,h); z2=pp(.6w,.8h); pd z1; pd z2; draw z1--z2; % diagonal +endchar; + +beginpunkchar(180,9,1,1); % \'{} acute +z1=pp(w-2.5u,h); z2=pp(.4w,.8h); pd z1; pd z2; draw z1--z2; % diagonal +endchar; + +beginpunkchar(710,13,1,1); % \^{} circumflex +z1=pp(2.5u,.8h); z2=pp(.5w,h); z3=(w-2.5u,.8h); +pd z1; pd z3; draw z1--z2--z3; % diagonals +endchar; + +beginpunkchar(711,13,1,1); % \v{} caron +z1=pp(2.5u,.9h); z2=pp(.5w,.7h); z3=pp(w-2.5u,.9h); +pd z1; pd z3; draw z1--z2--z3; % diagonals +endchar; + +beginpunkchar(728,11,1,1); % \u{} breve +z1=pp(2u,h); z2=pp(.5w,.75h); z3=pp(w-2u,h); +pd z1; pd z3; draw flex(z1,z2,z3); % stroke +endchar; + +beginpunkchar(175,12,1,1); % \={} macron +z1=pp(u,.8h); z2=pp(w-u,.8h); pd z1; pd z2; draw z1--z2; % bar +endchar; + +beginpunkchar(729,5,1,1); % \.{} +pd pp(.5w,.9h); % dot +endchar; + +beginpunkchar(168,13,1,1); % \"{} diaeresis +pd pp(1/5w,.9h); pd pp(4/5w,.9h); % dots +endchar; + +beginpunkchar(732,13,1,1); % \~{} tilde +z1=pp(u,.75h); z2=pp(w-u,.9h); pd z1; pd z2; draw z1{up}..{up}z2; % stroke +endchar; + +beginpunkchar(733,13,1,1); % \H{} hungarumlaut +z1=pp(4u,h); z2=pp(2.5u,.7h); z3=pp(w-2u,h); z4=pp(w-3.5u,.7h); +pd z1; pd z3; draw z1--z2--z4--z3; % diagonals (linked) +endchar; + +beginpunkchar(730,13,0,0); % Scandinavian loop, for \AA\ and \aa (ring) +z0=(.5w,.66h); % point $z^2$ of lowercase A +z1=(.5w,.9h); draw z0{z0-(1.5u,0)}..z1..{(w-1.5u,0)-z0}z0; % loop +endchar; + +beginpunkchar(184,13,.5,.5); % Cedilla, for \c c +z1=(.6w,0); z2=pp(.6w,-.1h); z3=pp(2.5u,-.1h); +pd z3; draw z1--z2--z3; % stroke +endchar; + +initialize_punk_lower ; + +beginpunkchar(305,5,1,2); % dotless I +z1=pp(.5w,0); z2=(.5w,1/3h); z3=(.5w,2/3h); z4=(.5w,h); +pd z1; pd z4; draw flex(z1,z2,z3,z4); % stem +endchar; + +beginpunkchar(567,9,1,2); % dotless J +z1=pp(w-2u,h); z2=pp(w-2u,-.1h); z3=pp(u,0); +pd z1; pd z3; draw z1--z2--z3; % arc +endchar; + +beginpunkchar(223,18,.3,1); % German SS +z1=pp(.5w-u,.9h); z2=pp(1/3w,h); z3=pp(u,.7h); z4=.6[z6,z2]; +z5=pp(.5w,.35h); z6=pp(1/3w,u); z7=pp(u,.2h); +pd z1; pd z7; draw z1--z2...z3..z4..z5...z6--z7; % left stroke +for i=1 upto 7: z[i+10]=pp(z[i] shifted (.5w-u,0)); endfor +pd z11; pd z17; draw z11--z12...z13..z14..z15...z16--z17; % right stroke +endchar; + +beginpunkchar("a",13,1,2); +z1=pp(1.5u,0); z2=(.5w,1.1h); z3=pp(w-1.5u,0); +pd z1; pd z3; draw z1--z2--z3; % left and right diagonals +z4=pp .3[z1,z2]; z5=pp .3[z3,z2]; pd z4; pd z5; draw z4--z5; % crossbar +endchar; + +beginpunkchar("b",12,1,1); +z1=pp(2u,0); z2=pp(2u,.6h); z3=pp(2u,h); pd z1; pd z3; draw z1--z3; % stem +z1.5=pp(w-u,.5y2); z2.5=pp(w-u,.5[y2,y3]); draw z2--z2.5--z3; % upper lobe +draw flex(z2,z1.5,z1); % lower lobe +endchar; + +beginpunkchar("c",13,1,2); +z1=pp(w-2u,.8h); z2=pp(.6w,h); z3=pp(u,.5h); z4=(.6w,0); z5=(w-2u,.2h); +pd z1; pd z5; draw z1..z2..z3..z4..z5; % arc +endchar; + +beginpunkchar("d",14,1,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-u,.6h); +pd z1; pd z2; draw flex(z1,z3,z2); % lobe +draw z1--z2; % stem +endchar; + +beginpunkchar("e",12,.5,1); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2.5u,h); z4=pp(w-2u,0); +pd z3; pd z4; draw z4--z1--z2--z3; % stem and arms +z5=pp(2u,.6h); z6=pp(w-3u,.6h); pd z5; pd z6; draw z5--z6; % crossbar +endchar; + +beginpunkchar("f",12,.5,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,h); +pd z1; pd z3; draw z1--z2--z3; % stem and arm +z5=pp(2u,.6h); z6=pp(w-3u,.6h); z4=pp .5[z5,z6]-(0,.1h); +pd z5; pd z6; draw flex (z5,z4,z6); % crossbar +endchar; + +beginpunkchar("g",13,.5,.5); +z1=pp(w-2u,.8h); z2=pp(.6w,h); z3=pp(u,.5h); z4=pp(.6w,0); z5=(w-2u,0); +pd z1; draw z1..z2..z3..z4---z5; % arc +z6=pp(.5[u,x5],.4h); pd z6; pd z5; draw z6--(pp(x5,y6))--z5; % spur +endchar; + +beginpunkchar("h",14,1,.5); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,0); z4=pp(w-2u,h); +z5=pp(2u,.6h); z6=pp(w-2u,.6h); +pd z1; pd z2; pd z3; pd z4; draw z1--z2; draw flex(z3,z6,z4); % stems +pd z5; draw z5--z6; % crossbar +endchar; + +beginpunkchar("i",5,1,2); +z1=pp(.5w,0); z2=(.5w,1/3h); z3=(.5w,2/3h); z4=(.5w,h); +pd z1; pd z4; draw flex(z1,z2,z3,z4); % stem +endchar; + +beginpunkchar("j",9,1,2); +z1=pp(w-2u,h); z2=pp(w-2u,-.1h); z3=pp(u,0); +pd z1; pd z3; draw z1--z2--z3; % arc +endchar; + +beginpunkchar("k",14,1,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(2u,1/3h); z4=pp(w-1.5u,h); +pd z1; pd z2; draw z1--z2; % stem +pd z3; pd z4; draw z3--z4; % upper diagonal +z6=pp(w-u,0); z5=1/3[z3,z4]; +pd z6; draw flex(z5,.8[z1,2/3[z5,z6] ],z6);% lower diagonal +endchar; + +beginpunkchar("l",11,1,2); +z1=pp(2u,h); z2=pp(2u,0); z3=pp(w-1.5u,0); +pd z1; pd z3; draw z1--z2--z3; % stem and arm +endchar; + +beginpunkchar("m",17,.5,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(.5w,0); z4=pp(w-2u,h); z5=pp(w-2u,0); +pd z1; pd z5; draw z1--z2--z3--z4--z5; % stems and diagonals +endchar; + +beginpunkchar("n",13,.75,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,0); z4=pp(w-2u,h); +pd z1; pd z4; draw z1--z2--z3--z4; % stems and diagonals +endchar; + +beginpunkchar("o",12,.5,2); +z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h); +pd z1; draw z1{left}..z2..z3..z4..z1; % bowl +endchar; + +beginpunkchar("p",13,1,2); +z1=pp(2u,0); z2=pp(2u,1.1h); z3=pp(2u,.5h); z4=pp(w,.6[y3,y2]); +pd z1; pd z3; draw z1--z2--z4--z3; % stem and bowl +endchar; + +beginpunkchar("q",14,.5,2); +z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h); +pd z1; draw z1{curl 2}..z2..z3..z4..z1; % bowl +z5=pp(.4w,.2h); z6=pp(w-u,-.1h); z7=pp(.5[x5,x6],-.2h); +pd z5; pd z6; draw z5--z7--z6; % tail +endchar; + +beginpunkchar("r",16,1,2); +z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-u,.6[y2,y4]); z4=pp(2u,.5h); z5=pp(w-1.5u,0); +pd z1; pd z2; pd z5; draw z1--flex(z2,z3,z4)--z5; % stem, bowl, and diagonal +endchar; + +beginpunkchar("s",11,.3,1); +z1=pp(w-2u,.9h); z2=pp(.5w,h); z3=pp(u,.7h); z4=.6[z6,z2]; +z5=pp(w-u,.35h); z6=pp(.5w,u); z7=pp(u,.2h); +pd z1; pd z7; draw z1--z2...z3..z4..z5...z6--z7; % stroke +endchar; + +beginpunkchar("t",13,.75,2); +z1=pp(u,h); z2=pp(w-u,h); z3=pp(.5w,0); +pd z1; pd z2; pd z3; draw z1--z2; % arms +draw .5[z1,z2]--z3; % stem +endchar; + +beginpunkchar("u",13,.3,2); +z1=pp(2u,h); z2=pp(2u,.2h); z3=pp(.5w,0); z4=pp(w-2u,.2h); z5=pp(w-2u,h); +pd z1; pd z5; draw z1---z2...z3{z4-z2}...z4---z5; % stroke +endchar; + +beginpunkchar("v",13,1,2); +z1=pp(1.5u,h); z2=pp(.5w,0); z3=pp(w-1.5u,h); +pd z1; pd z3; draw z1--z2--z3; % diagonals +endchar; + +beginpunkchar("w",18,1,2); +z1=pp(1.5u,h); z2=pp(.5[x1,x3],0); z3=pp(.5w,.8h); z4=pp(.5[x3,x5],0); +z5=pp(w-1.5u,h); +pd z1; pd z5; draw z1--z2--z3--z4--z5; % diagonals +endchar; + +beginpunkchar("x",13,1,1); +z1=pp(1.5u,h); z2=pp(w-1.5u,0); z3=pp(1.5u,0); z4=pp(w-2.5u,h); +pd z1; pd z2; draw z1--z2; % main diagonal +pd z3; pd z4; draw z3--z4; % cross diagonal +endchar; + +beginpunkchar("y",13,1,2); +z1=pp(1.5u,h); z2=pp(w-1.5u,h); z3=pp(.5w,.5h); z4=pp(.5w,0); +pd z1; pd z2; pd z4; draw z1--z3--z4; % stem and left diagonal +draw z2--z3; % right diagonal +endchar; + +beginpunkchar("z",11,1,2); +z1=pp(1.5u,h); z2=pp(w-2.5u,h); z3=pp(1.5u,0); z4=pp(w-1.5u,0); +pd z1; pd z4; draw z1--z2--z3--z4; % diagonals +endchar; + +beginpunkchar(230,16,1,2); % \ae +z1=pp(1.5u,0); z2=pp(.6w,h); z3=pp(w-1.5u,h); +pd z1; pd z3; draw z1--z2--z3; % left diagonal and upper arm +z4=pp .3[z1,z2]; z5=pp(.6w,0); z6=pp(w-2u,.3h); +pd z4; pd z6; draw z4--z6; % crossbar +z7=pp(w-u,0); pd z2; pd z7; draw z2--z5--z7; % stem and lower arm +endchar; + +beginpunkchar(339,18,1,2); % \oe +z1=pp(.5w,h); z2=pp(u,.4h); z3=pp(.5w,0); +pd z1; draw z1..z2..{right}z3; % bowl +z4=pp(w-1.5u,h); z5=pp(w-2u,.4h); z6=pp(w-u,0); +pd z4; pd z6; draw z4--z1--z3--z6; % arms and stem +pd z5; draw z5--.4[z3,z1]; % crossbar +endchar; + +beginpunkchar(248,14,1,1); % \o +z1=pp(.5w,h); z2=pp(u,.5h); z3=pp(.5w,0); z4=pp(w-u,.5h); +z5=pp(w-2u,1.1h); z6=pp(2u,-.1h); +pd z1; pd z6; draw z1..z2..z3..z4..z5--z6; % bowl and diagonal +endchar; + +revert_punk_lower; + +beginpunkchar("_",12,.5,.5); % _ +z1=pp(0,-.2h); z2=pp(w,-.2h); pd z1; pd z2; draw z1--z2; % bar +endchar; + +beginpunkchar("^",12,1,.5); % +z1=pp(.5w,h); z2=pp(1.5u,.6h); z3=pp(w-1.5u,.6h); +pd z2; pd z3; draw z2--z1--z3; +endchar; diff --git a/Master/texmf-dist/metapost/context/font/punkfont-definitions.mp b/Master/texmf-dist/metapost/context/font/punkfont-definitions.mp new file mode 100644 index 00000000000..2901a9d0312 --- /dev/null +++ b/Master/texmf-dist/metapost/context/font/punkfont-definitions.mp @@ -0,0 +1,115 @@ +% Remark: +% +% This file is a merge of the original punk files by Donald Knuth, who +% added this comment: +% +% Font inspired by Gerard and Marjan Unger's lectures, Feb 1985 +% +% The regular punk files are part of TeXLive and in metafont format. All +% errors introduced are ours. We also changed the encoding to unicode. In +% due time we might add a few more more characters. We still need to +% improve some of the metrics which involves a bit of trial and error. The +% font just covers basic latin shapes but in ConTeXt MkIV we add virtual +% composed shapes. There is a module m-punk.tex that implements this. This +% derivate is also used in mk.tex (mk.pdf) which is one of our tests for +% LuaTeX. We published an article on it in the MAPS (NTG magazine). +% +% 2008, Taco Hoekwater & Hans Hagen + +if unknown punk_font_loaded : + + if unknown scale_factor : + scale_factor := 1 ; + fi ; + + boolean punk_font_loaded ; + + punk_font_loaded := true ; + warningcheck := 0 ; + proofing := 0 ; + designsize := 10pt#; + font_identifier := "Punk Nova" ; % dedicated to Don Knuth and Hermann Zapf + + ht# := 7pt# ; % height of characters + u# := 1/4pt# ; % unit width + dev# := .3pt# ; % standard deviation of punk points + + if known bold_punk : + s# := 1.2pt# ; % extra sidebar + px# := 1pt# ; % horizontal thickness of pen + py# := .8pt# ; % vertical thickness of pen + dot# := 1.7pt# ; % diameter of dots + else : + s# := 0 ; % extra sidebar, ok + px# := .6pt# ; % horizontal thickness of pen + py# := .5pt# ; % vertical thickness of pen + dot# := 1.3pt# ; % diameter of dots + fi ; + + pt := .1pt ; + mag := scale_factor * 10 ; + bp_per_pixel := bpppix_ * mag ; + + define_pixels(u,dev) ; + define_blacker_pixels(px,py,dot) ; + define_whole_pixels(s) ; + xoffset := s ; + + pickup pencircle xscaled px yscaled py ; + punk_pen := savepen ; + pickup pencircle scaled dot ; + path dot_pen_path ; + dot_pen_path := tensepath makepath currentpen ; + + defaultcolormodel := 1 ; + + if known slanted_punk : + dot_pen_path := dot_pen_path slanted -0.25 ; + extra_endchar := extra_endchar & "currentpicture := currentpicture slanted 0.25 ;" ; + fi ; + + + def beginpunkchar(expr c,n,h,v) = % code $c$; width is $n$ units + hdev := h * dev ; % modify horizontal amounts of deviation + vdev := v * dev ; % modify vertical amounts of deviation + beginchar(c,n*u#,ht#,0) ; + italcorr 0 ; + % italcorr ht#*slant; + pickup punk_pen + enddef ; + + def ^ = + transformed currenttransform + enddef ; + + def makebox(text rule) = + for y=0, h : % horizontals + rule((-s,y)^,(w-s,y)^) ; + endfor + for x=-s, 0, w-2s, w-s : % verticals + rule((x,0)^,(x,h)^) ; + endfor + enddef ; + + rulepen := pensquare ; + + vardef pp expr z = + z + (hdev * normaldeviate, vdev * normaldeviate) + enddef; + + def pd expr z = % {\bf drawdot} + addto currentpicture contour dot_pen_path shifted z.t_ % withpen penspeck + enddef; + + def initialize_punk_upper = + ht# := 7pt# ; dev# := .3pt# ; + enddef ; + def initialize_punk_lower = + sht# := ht#; sdev := dev; + ht# := .6ht# ; dev := .7dev ; + enddef ; + def revert_punk_lower = + ht# := sht#; dev := sdev; + enddef ; + +fi ; diff --git a/Master/texmf-dist/metapost/context/font/punkfont-slanted.mp b/Master/texmf-dist/metapost/context/font/punkfont-slanted.mp new file mode 100644 index 00000000000..5c1ff46b233 --- /dev/null +++ b/Master/texmf-dist/metapost/context/font/punkfont-slanted.mp @@ -0,0 +1,4 @@ +boolean slanted_punk ; slanted_punk := true ; + +input "punkfont-definitions.mp" ; +input "punkfont-characters.mp" ; diff --git a/Master/texmf-dist/metapost/context/font/punkfont.mp b/Master/texmf-dist/metapost/context/font/punkfont.mp index e57499859c8..2a03aae81df 100644 --- a/Master/texmf-dist/metapost/context/font/punkfont.mp +++ b/Master/texmf-dist/metapost/context/font/punkfont.mp @@ -1,863 +1,2 @@ -% Remark: -% -% This file is a merge of the original punk files by Donald Knuth, who -% added this comment: -% -% Font inspired by Gerard and Marjan Unger's lectures, -% Feb 1985 -% -% The regular punk files are part of TeXLive and in metafont format. All -% errors introduced are ours. We also changed the encoding to unicode. In -% due time we might add a few more more characters. We still need to -% improve some of the metrics which involves a bit of trial and error. The -% font just covers basic latin shapes but in ConTeXt MkIV we add virtual -% composed shapes. There is a module m-punk.tex that implements this. This -% derivate is also used in mk.tex (mk.pdf) which is one of our tests for -% LuaTeX. We published an article on it in the MAPS (NTG magazine). -% -% 2008, Taco Hoekwater & Hans Hagen - -if unknown punk_font_loaded : - - if unknown scale_factor : - scale_factor := 1 ; - fi ; - - boolean punk_font_loaded ; - - punk_font_loaded := true ; - warningcheck := 0 ; - designsize := 10pt#; - font_identifier := "Punk Nova" ; % dedicated to Don Knuth and Hermann Zapf - - ht# := 7pt# ; % height of characters - u# := 1/4pt# ; % unit width - % s# := 1.2pt# ; % extra sidebar - % s# := 0.1pt# ; % extra sidebar, needed because we use the bbox currently - s# := 0 ; % extra sidebar, ok -% s# := 1.2pt# ; % extra sidebar - px# := .6pt# ; % horizontal thickness of pen - py# := .5pt# ; % vertical thickness of pen - dot# := 1.3pt# ; % diameter of dots - dev# := .3pt# ; % standard deviation of punk points - - % dot# := .8pt# ; % diameter of dots - % px# := .3pt# ; % horizontal thickness of pen - % py# := .2pt# ; % vertical thickness of pen - - % seed := sqrt2 ; - % randomseed := seed ; - proofing := 0 ; - pt := .1pt ; - mag := scale_factor * 10 ; - bp_per_pixel := bpppix_ * mag ; - - define_pixels(u,dev) ; - define_blacker_pixels(px,py,dot) ; - define_whole_pixels(s) ; - xoffset := s ; - - pickup pencircle xscaled px yscaled py ; - punk_pen := savepen ; - pickup pencircle scaled dot ; - path dot_pen_path ; - dot_pen_path := tensepath makepath currentpen ; - -% px# := .8pt# ; % horizontal thickness of pen -% define_pixels(u,dev) ; -% define_blacker_pixels(px,py,dot) ; -% pickup pencircle xscaled 1.25px yscaled 1.25py ; -% punk_pen := savepen ; -% pickup pencircle scaled 1.25dot ; -% path dot_pen_path ; -% dot_pen_path := tensepath makepath currentpen ; - - defaultcolormodel := 1 ; - - def beginpunkchar(expr c,n,h,v) = % code $c$; width is $n$ units - hdev := h * dev ; % modify horizontal amounts of deviation - vdev := v * dev ; % modify vertical amounts of deviation - beginchar(c,n*u#,ht#,0) ; - italcorr 0 ; - % italcorr ht#*slant; - pickup punk_pen - enddef ; - -% extra_endchar := extra_endchar & "w := w+2s ; charwd := charwd+2s# ;" ; -% extra_endchar := extra_endchar & "setbounds currentpicture to (0,-d)--(w*1.2,-d)--(w*1.2,h)--(0,h)--cycle;" ; - -% extra_endchar := extra_endchar & "w := w+2s ; " ; -% extra_endchar := extra_endchar & "w := 1.2w ; " ; -% extra_endchar := extra_endchar & "charwd := 1.2charwd ; " ; -% extra_endchar := extra_endchar & "setbounds currentpicture to (0,-d)--(w,-d)--(w,h)--(0,h)--cycle;" ; - -% todo: - -% extra_endchar := extra_endchar & -% "currentpicture := currentpicture shifted (0,1pt#) ; setbounds currentpicture to " & -% "llcorner currentpicture shifted ( 0,-1pt#) -- lrcorner currentpicture shifted ( 1pt#,-1pt#) -- " & -% "urcorner currentpicture shifted ( 1pt#, 1pt#) -- ulcorner currentpicture shifted ( 0, 1pt#) -- cycle ; " ; - - def ^ = - transformed currenttransform - enddef ; - - def makebox(text rule) = - for y=0, h : % horizontals - rule((-s,y)^,(w-s,y)^) ; - endfor - for x=-s, 0, w-2s, w-s : % verticals - rule((x,0)^,(x,h)^) ; - endfor - enddef ; - - rulepen := pensquare ; - - vardef pp expr z = - z + (hdev * normaldeviate, vdev * normaldeviate) - enddef; - - def pd expr z = % {\bf drawdot} - addto currentpicture contour dot_pen_path shifted z.t_ withpen penspeck - enddef; - - def initialize_punk_upper = - ht# := 7pt# ; dev# := .3pt# ; - enddef ; - def initialize_punk_lower = - sht# := ht#; sdev := dev; - ht# := .6ht# ; dev := .7dev ; - enddef ; - def revert_punk_lower = - ht# := sht#; dev := sdev; - enddef ; - -fi ; - - -initialize_punk_upper ; - -beginpunkchar("A",13,1,2); -z1=pp(1.5u,0); z2=(.5w,1.1h); z3=pp(w-1.5u,0); -pd z1; pd z3; draw z1--z2--z3; % left and right diagonals -z4=pp .3[z1,z2]; z5=pp .3[z3,z2]; pd z4; pd z5; draw z4--z5; % crossbar -endchar; - -beginpunkchar("B",12,1,1); -z1=pp(2u,0); z2=pp(2u,.6h); z3=pp(2u,h); pd z1; pd z3; draw z1--z3; % stem -z1.5=pp(w-u,.5y2); z2.5=pp(w-u,.5[y2,y3]); draw z2--z2.5--z3; % upper lobe -draw flex(z2,z1.5,z1); % lower lobe -endchar; - -beginpunkchar("C",13,1,2); -z1=pp(w-2u,.8h); z2=pp(.6w,h); z3=pp(u,.5h); z4=(.6w,0); z5=(w-2u,.2h); -pd z1; pd z5; draw z1..z2..z3..z4..z5; % arc -endchar; - -beginpunkchar("D",14,1,2); -z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-u,.6h); -pd z1; pd z2; draw flex(z1,z3,z2); % lobe -draw z1--z2; % stem -endchar; - -beginpunkchar("E",12,.5,1); -z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2.5u,h); z4=pp(w-2u,0); -pd z3; pd z4; draw z4--z1--z2--z3; % stem and arms -z5=pp(2u,.6h); z6=pp(w-3u,.6h); pd z5; pd z6; draw z5--z6; % crossbar -endchar; - -beginpunkchar("F",12,.5,2); -z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,h); -pd z1; pd z3; draw z1--z2--z3; % stem and arm -z5=pp(2u,.6h); z6=pp(w-3u,.6h); z4=pp .5[z5,z6]-(0,.1h); -pd z5; pd z6; draw flex (z5,z4,z6); % crossbar -endchar; - -beginpunkchar("G",13,.5,.5); -z1=pp(w-2u,.8h); z2=pp(.6w,h); z3=pp(u,.5h); z4=pp(.6w,0); z5=(w-2u,0); -pd z1; draw z1..z2..z3..z4---z5; % arc -z6=pp(.5[u,x5],.4h); pd z6; pd z5; draw z6--(pp(x5,y6))--z5; % spur -endchar; - -beginpunkchar("H",14,1,.5); -z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,0); z4=pp(w-2u,h); -z5=pp(2u,.6h); z6=pp(w-2u,.6h); -pd z1; pd z2; pd z3; pd z4; draw z1--z2; draw flex(z3,z6,z4); % stems -pd z5; draw z5--z6; % crossbar -endchar; - -beginpunkchar("I",5,1,2); -z1=pp(.5w,0); z2=(.5w,1/3h); z3=(.5w,2/3h); z4=(.5w,h); -pd z1; pd z4; draw flex(z1,z2,z3,z4); % stem -endchar; - -beginpunkchar("J",9,1,2); -z1=pp(w-2u,h); z2=pp(w-2u,-.1h); z3=pp(u,0); -pd z1; pd z3; draw z1--z2--z3; % arc -endchar; - -beginpunkchar("K",14,1,2); -z1=pp(2u,0); z2=pp(2u,h); z3=pp(2u,1/3h); z4=pp(w-1.5u,h); -pd z1; pd z2; draw z1--z2; % stem -pd z3; pd z4; draw z3--z4; % upper diagonal -z6=pp(w-u,0); z5=1/3[z3,z4]; -pd z6; draw flex(z5,.8[z1,2/3[z5,z6] ],z6);% lower diagonal -endchar; - -beginpunkchar("L",11,1,2); -z1=pp(2u,h); z2=pp(2u,0); z3=pp(w-1.5u,0); -pd z1; pd z3; draw z1--z2--z3; % stem and arm -endchar; - -beginpunkchar("M",17,.5,2); -z1=pp(2u,0); z2=pp(2u,h); z3=pp(.5w,0); z4=pp(w-2u,h); z5=pp(w-2u,0); -pd z1; pd z5; draw z1--z2--z3--z4--z5; % stems and diagonals -endchar; - -beginpunkchar("N",13,.75,2); -z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,0); z4=pp(w-2u,h); -pd z1; pd z4; draw z1--z2--z3--z4; % stems and diagonals -endchar; - -beginpunkchar("O",12,.5,2); -z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h); -pd z1; draw z1{left}..z2..z3..z4..z1; % bowl -endchar; - -beginpunkchar("P",13,1,2); -z1=pp(2u,0); z2=pp(2u,1.1h); z3=pp(2u,.5h); z4=pp(w,.6[y3,y2]); -pd z1; pd z3; draw z1--z2--z4--z3; % stem and bowl -endchar; - -beginpunkchar("Q",14,.5,2); -z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h); -pd z1; draw z1{curl 2}..z2..z3..z4..z1; % bowl -z5=pp(.4w,.2h); z6=pp(w-u,-.1h); z7=pp(.5[x5,x6],-.2h); -pd z5; pd z6; draw z5--z7--z6; % tail -endchar; - -beginpunkchar("R",16,1,2); -z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-u,.6[y2,y4]); z4=pp(2u,.5h); z5=pp(w-1.5u,0); -pd z1; pd z2; pd z5; draw z1--flex(z2,z3,z4)--z5; % stem, bowl, and diagonal -endchar; - -beginpunkchar("S",11,.3,1); -z1=pp(w-2u,.9h); z2=pp(.5w,h); z3=pp(u,.7h); z4=.6[z6,z2]; -z5=pp(w-u,.35h); z6=pp(.5w,u); z7=pp(u,.2h); -pd z1; pd z7; draw z1--z2...z3..z4..z5...z6--z7; % stroke -endchar; - -beginpunkchar("T",13,.75,2); -z1=pp(u,h); z2=pp(w-u,h); z3=pp(.5w,0); -pd z1; pd z2; pd z3; draw z1--z2; % arms -draw .5[z1,z2]--z3; % stem -endchar; - -beginpunkchar("U",13,.3,2); -z1=pp(2u,h); z2=pp(2u,.2h); z3=pp(.5w,0); z4=pp(w-2u,.2h); z5=pp(w-2u,h); -pd z1; pd z5; draw z1---z2...z3{z4-z2}...z4---z5; % stroke -endchar; - -beginpunkchar("V",13,1,2); -z1=pp(1.5u,h); z2=pp(.5w,0); z3=pp(w-1.5u,h); -pd z1; pd z3; draw z1--z2--z3; % diagonals -endchar; - -beginpunkchar("W",18,1,2); -z1=pp(1.5u,h); z2=pp(.5[x1,x3],0); z3=pp(.5w,.8h); z4=pp(.5[x3,x5],0); -z5=pp(w-1.5u,h); -pd z1; pd z5; draw z1--z2--z3--z4--z5; % diagonals -endchar; - -beginpunkchar("X",13,1,1); -z1=pp(1.5u,h); z2=pp(w-1.5u,0); z3=pp(1.5u,0); z4=pp(w-2.5u,h); -pd z1; pd z2; draw z1--z2; % main diagonal -pd z3; pd z4; draw z3--z4; % cross diagonal -endchar; - -beginpunkchar("Y",13,1,2); -z1=pp(1.5u,h); z2=pp(w-1.5u,h); z3=pp(.5w,.5h); z4=pp(.5w,0); -pd z1; pd z2; pd z4; draw z1--z3--z4; % stem and left diagonal -draw z2--z3; % right diagonal -endchar; - -beginpunkchar("Z",11,1,2); -z1=pp(1.5u,h); z2=pp(w-2.5u,h); z3=pp(1.5u,0); z4=pp(w-1.5u,0); -pd z1; pd z4; draw z1--z2--z3--z4; % diagonals -endchar; - -beginpunkchar(198,16,1,2); % \AE -z1=pp(1.5u,0); z2=pp(.6w,h); z3=pp(w-1.5u,h); -pd z1; pd z3; draw z1--z2--z3; % left diagonal and upper arm -z4=pp .3[z1,z2]; z5=pp(.6w,0); z6=pp(w-2u,.3h); -pd z4; pd z6; draw z4--z6; % crossbar -z7=pp(w-u,0); pd z2; pd z7; draw z2--z5--z7; % stem and lower arm -endchar; - -beginpunkchar(338,18,1,2); % \OE -z1=pp(.5w,h); z2=pp(u,.4h); z3=pp(.5w,0); -pd z1; draw z1..z2..{right}z3; % bowl -z4=pp(w-1.5u,h); z5=pp(w-2u,.4h); z6=pp(w-u,0); -pd z4; pd z6; draw z4--z1--z3--z6; % arms and stem -pd z5; draw z5--.4[z3,z1]; % crossbar -endchar; - -beginpunkchar(216,14,1,1); % \O -z1=pp(.5w,h); z2=pp(u,.5h); z3=pp(.5w,0); z4=pp(w-u,.5h); -z5=pp(w-2u,1.1h); z6=pp(2u,-.1h); -pd z1; pd z6; draw z1..z2..z3..z4..z5--z6; % bowl and diagonal -endchar; - -beginpunkchar(915,11,1,2); % $\Gamma$ -z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-1.5u,h); -pd z1; pd z3; draw z1--z2--z3; % stem and arm -endchar; - -beginpunkchar(916,15,1,2); % $\Delta$ -z1=pp(u,0); z2=pp(.5w,h); z3=pp(w-u,0); -pd z1; draw z1--z2..tension 5..z3..tension 5..z1; % triangle -endchar; - -beginpunkchar(920,15,.5,2); % $\Theta$ -z1=pp(.5w,h); z2=pp(u,.6h); z3=pp(.5w,0); z4=pp(w-u,.6h); -pd z1; draw z1..tension.8..z2..z3..z4..tension.8..z1; % bowl -z5=pp(x2+2u,.4h); z6=pp(x4-2u,.4h); pd z5; pd z6; draw z5--z6; % bar -endchar; - -beginpunkchar(923,12,1,2); % $\Lambda$ -z1=pp(u,0); z2=pp(.5w,h); z3=pp(w-u,0); -pd z1; pd z3; draw z1--z2--z3; % diagonals -endchar; - -beginpunkchar(926,12,1,1); % $\Xi$ -z1=pp(u,h); z2=pp(w-u,h); pd z1; pd z2; draw z1--z2; % upper arm -z3=pp(2u,.55h); z4=pp(w-2u,.55h); pd z3; pd z4; draw z3--z4; % bar -z5=pp(u,0); z6=pp(w-u,0); pd z5; pd z6; draw z5--z6; % lower arm -endchar; - -beginpunkchar(928,13,1,.5); % $\Pi$ -z1=pp(1.5u,0); z2=pp(1.5u,h); z3=pp(w-1.5u,h); z4=pp(w-1.5u,0); -pd z1; pd z4; draw z1--z2--z3--z4; % stems and bar -endchar; - -beginpunkchar(931,13,1,1); % $\Sigma$ -z1=pp(w-u,h); z2=pp(u,h); z3=pp(.5w-u,.5h); z4=pp(u,0); z5=pp(w-u,0); -pd z1; pd z5; draw z1--z2{.5[z4,z5]-z2}..z3--z4--z5; % arms and diagonals -endchar; - -beginpunkchar(933,15,1,.5); % $\Upsilon$ -z1=pp(u,.8h); z2=pp(.3w,h); z3=pp(.5w,.5h); z4=pp(.5w,0); -pd z1; pd z4; draw z1..z2..tension2..z3---z4; % left arc and stem -z5=pp(w-u,.8h); z6=pp(.7w,h); -pd z5; draw z5..z6..tension2..{z4-z3}z3; % right arc -endchar; - -beginpunkchar(934,13,1,2); % $\Phi$ -z1=pp(.5w,h); z2=pp(.5w,0); pd z1; pd z2; draw z1--z2; % stem -z3=pp(.5w,2/3h); z4=pp(u,.5h); z5=pp(.5w,1/4h); z6=pp(w-u,.5h); -pd z3; draw z3..z4..z5..z6..z3; % bowl -endchar; - -beginpunkchar(936,14,1,1); % $\Psi$ -z1=pp(.5w,h); z2=pp(.5w,0); pd z1; pd z2; draw z1--z2; % stem -z3=pp(u,.8h); z4=pp(.5w,.2h); z5=pp(w-u,.8h); -pd z3; pd z5; draw z3{.4[z1,z2]-z3}..z4{right}..{z5-.4[z1,z2]}z5; % stroke -endchar; - -beginpunkchar(937,13,1,2); % $\Omega$ -z1=pp(u,0); z2=pp(1/3w,0); z3=pp(u,2/3h); z4=pp(.5w,h); -z5=pp(w-u,2/3h); z6=pp(2/3w,0); z7=pp(w-u,0); -pd z1; pd z7; draw z1--z2{up}..z3..z4..z5..{down}z6--z7; % bowl and arms -endchar; - -beginpunkchar(".",5,1,2); -pd pp(.5w,0); % dot -endchar; - -beginpunkchar(",",5,.5,.5); -z1=pp(.5w,0); z2=pp(w-u,-.1h); z3=pp(.5w,-.3h); -pd z1; pd z3; draw z1--z2--z3; % stroke -endchar; - -beginpunkchar(":",5,1,.5); -pd pp(.5w,0); pd pp(.5w,.4h); % dots -endchar; - -beginpunkchar(";",5,.5,.5); -z1=pp(.5w,0); z2=pp(w-u,-.1h); z3=pp(.5w,-.3h); -pd z1; pd z3; draw z1--z2--z3; % stroke -pd pp(.5w,.4h); % dot -endchar; - -beginpunkchar("!",5,.5,.5); -pd pp(.5w,0); % dot -z1=pp(.5w,1.05h); z2=pp(.5w,.3h); pd z1; pd z2; draw z1--z2; % stem -endchar; - -beginpunkchar(161,5,.5,.5); % spanish inverted ! -pd pp(.5w,.9h); % dot -z1=pp(.5w,-.1h); z2=pp(.5w,.6h); pd z1; pd z2; draw z1--z2; % stem -endchar; - -beginpunkchar("?",9,1,.5); -z1=pp(1.5u,.8h); z2=pp(.5w,h); z3=pp(w-u,.8h); z4=pp(.5w,.3h); -pd z1; pd z4; draw z1..z2..z3..{down}z4; % arc and stem -pd pp(.5w,0); % dot -endchar; - -beginpunkchar(191,9,1,.5); % spanish inverted ? -z1=pp(1.5u,.1h); z2=pp(.5w,-.1h); z3=pp(w-u,.1h); z4=pp(.5w,.6h); -pd z1; pd z4; draw z1..z2..z3..{up}z4; % arc and stem -pd pp(.5w,.9h); % dot -endchar; - -beginpunkchar("&",14,.5,.5); -z1=pp(w-2u,h); z2=pp(u,h); z3=pp(3u,0); z5=pp(w-u,.6h); z6=pp(w-2u,0); -pd z1; pd z5; draw z1--z2--z3--z5; % arms and stem -draw z1--.5[z2,z3]; pd z6; draw z6--.6[z3,z5]; % diagonals -endchar; - -beginpunkchar("$",12,.5,.5); -z1=pp(w-1.5u,.7h); z2=pp(.5w,h); z3=pp(u,.7h); z4=.5[z3,z5]; -z5=pp(w-u,.3h); z6=pp(.5w,0); z7=pp(u,.3h); -pd z1; pd z7; draw z1..z2..z3..z4..z5..z6..z7; % stroke -z8=z2+(0,.1h); pd z8; draw z8--z6; % stem -endchar; - -beginpunkchar("%",18,.5,.5); -z1=pp(3.5u,1.1h); z2=pp(u,.8h); z3=pp(3.5u,.5h); z4=pp(6u,.8h); -z5=pp(w-3.5u,.5h); z6=pp(w-6u,.2h); z7=pp(w-3.5u,-.1h); z8=pp(w-u,.2h); -pd z1; draw z1..z2..z3..z4..z1; % upper bowl -pd z5; draw z5..z6..z7..z8..z5; % lower bowl -z9=pp(w-3u,1.1h); z0=pp(3u,-.1h); pd z0; draw z9--z0; % diagonal -draw z1{z5-z1}..z9; % link -endchar; - -beginpunkchar("@",18,1,.5); -z1=pp(2u,0); z2=pp(1/3w,.7h); z3=pp(w-6u,0); -z4=pp(w,.3h); z5=pp(1/3w,h); z6=pp(u,.5h); z7=.7[z2,z3]; -pd z1; pd z7; draw z1--z2--z3{right}..z4..z5..z6..z7; % diagonals and stroke -endchar; - -beginpunkchar("-",7,.5,.5); -z1=pp(u,.4h); z2=pp(w-u,.5h); pd z1; pd z2; draw z1--z2; % bar -endchar; - -beginpunkchar(8211,9,.5,.5); % -- -z1=pp(0,.5h); z2=pp(w,.4h); pd z1; pd z2; draw z1--z2; % bar -endchar; - -beginpunkchar(8212,18,.5,.5); % --- -z1=pp(0,.5h); z2=pp(w,.4h); pd z1; pd z2; draw z1--z2; % bar -endchar; - -beginpunkchar("+",9,.5,1); -z1=pp(0,.5h); z2=pp(w,.5h); pd z1; pd z2; draw z1--z2; % bar -z3=pp(.5w,.1h); z4=pp(.5w,.9h); pd z3; pd z4; draw z3--z4; % stem -endchar; - -beginpunkchar("*",13,.5,1); -z0=pp(.5w,1.1h); z1=pp(u,.9h); z2=pp(2u,.3h); z3=pp(w-u,.3h); z4=pp(w-u,.9h); -pd z0; draw z0--z2..1/3[.5[z2,z4],z0]..z4--z1--z3--z0; % star -endchar; - -beginpunkchar(39,5,.5,1.5); % ' apostrofe HH/TH (to be checked) -z1=pp(w/2,h); z2=pp(w/2+u,.85h); z3=pp(w/2,2/3h); -pd z1; pd z3; draw z1..z2..z3; % stroke -endchar; - -beginpunkchar(34,9,1,1.5); % " HH/TH (to be checked) -z1=pp(1.5u,h); z2=pp(1.5u,.6h); z3=pp(w-1.5u,h); z4=pp(w-1.5u,.6h); -pd z1; pd z2; pd z3; pd z4; draw z1--z2; draw z3--z4; -endchar; - -beginpunkchar(8216,5,.3,.5); % ` -z1=pp(w-1.5u,h); z2=pp(u,.85h); z3=pp(w-u,2/3h); -pd z1; pd z3; draw z1--z2--z3; % stroke -endchar; - -beginpunkchar(8217,5,.3,.5); % ' -z1=pp(1.5u,h); z2=pp(w-u,.85h); z3=pp(u,2/3h); -pd z1; pd z3; draw z1--z2--z3; % stroke -endchar; - -beginpunkchar(8220,9,.3,.5); % `` quotedblleft -z1=pp(.5w+.5u,h); z2=pp(w-u,.6h); z3=pp(u,.95h); -pd z1; pd z3; draw z1--z2--z3; % stroke -endchar; - -beginpunkchar(8221,9,.3,.5); % '' quotedblright -z1=pp(.5w-.5u,h); z2=pp(u,.6h); z3=pp(w-u,.95h); -pd z1; pd z3; draw z1--z2--z3; % stroke -endchar; - -beginpunkchar("(",7,.5,.5); -z1=pp(w-u,h); z2=pp(u,.5h); z3=pp(w-u,0); -pd z1; pd z3; draw z1..z2..z3; % stroke -endchar; - -beginpunkchar(")",7,.5,.5); -z1=pp(u,h); z2=pp(w-u,.5h); z3=pp(u,0); pd z1; pd z3; draw z1..z2..z3; % stroke -endchar; - -beginpunkchar("[",8,.5,.5); -z1=pp(w-u,h); z2=pp(.5w,h); z3=pp(.5w,0); z4=pp(w-u,0); -pd z1; pd z4; draw z1--z2--z3--z4; % bars and stem -endchar; - -beginpunkchar("]",8,.5,.5); -z1=pp(u,h); z2=pp(.5w,h); z3=pp(.5w,0); z4=pp(u,0); -pd z1; pd z4; draw z1--z2--z3--z4; % bars and stem -endchar; - -beginpunkchar("<",9,.5,.5); -z1=pp(w-u,.9h); z2=pp(u,.5h); z3=pp(w-u,.1h); -pd z1; pd z3; draw z1--z2--z3; % diagonals -endchar; - -beginpunkchar(">",9,.5,.5); -z1=pp(u,.9h); z2=pp(w-u,.5h); z3=pp(u,.1h); -pd z1; pd z3; draw z1--z2--z3; % diagonals -endchar; - -beginpunkchar("{",10,.5,.5); % HH/TH -z1=pp(w-2u,h); z3=pp(2u,.5h); z5=pp(w-2u,0); -z2=pp(w-4u,.6h); z4=(w-4u,.4h); -pd z1; pd z3; pd z5; draw z1{left}..z2--z3 & z3--z4..{right}z5; -endchar; - -beginpunkchar("}",10,.5,.5); % HH/TH -z1=pp(2u,h); z3=pp(w-2u,.5h); z5=pp(2u,0); -z2=pp(4u,.6h); z4=(4u,.4h); -pd z1; pd z3; pd z5; draw z1{right}..z2--z3 & z3--z4..{left}z5; -endchar; - -beginpunkchar("=",9,.5,.5); -z5=pp(u,2/3h); z6=pp(w-u,2/3h); pd z5; pd z6; draw z5--z6; % upper bar -z7=pp(u,1/3h); z8=pp(w-u,1/3h); pd z7; pd z8; draw z7--z8; % lower bar -endchar; - -beginpunkchar("#",15,.5,.5); -z1=pp(.5w,h); z2=pp(3u,0); z3=pp(w-3u,h); z4=pp(.5w,0); -pd z2; pd z3; draw z3--z1--z2; draw z3--z4--z2; % diagonals (linked) -z5=pp(u,2/3h); z6=pp(w-u,2/3h); pd z5; pd z6; draw z5--z6; % upper bar -z7=pp(u,1/3h); z8=pp(w-u,1/3h); pd z7; pd z8; draw z7--z8; % lower bar -endchar; - -beginpunkchar("/",9,1,1); -z1=pp(1.5u,-.05h); z2=pp(w-1.5u,1.05h); pd z1; pd z2; draw z1--z2; % diagonal -endchar; - -beginpunkchar("\",9,1,1); % HH/TH -z1=pp(1.5u,1.05h); z2=pp(w-1.5u,-.05h); pd z1; pd z2; draw z1--z2; % reverse diagonal -endchar; - - -beginpunkchar("0",9,.5,1); -z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h); -pd z1; draw z1{curl 2}..z2..z3..z4..z1; % bowl -endchar; - -beginpunkchar("1",9,.3,1); -z1=pp(2u,.7h); z2=pp(.6w,h); z3=pp(.6w,0); -pd z1; pd z3; draw z1--z2--z3; % serif and stem -endchar; - -beginpunkchar("2",9,1,1); -z1=pp(2u,.7h); z2=pp(.5w,h); z3=pp(w-u,.6h); z4=pp(u,0); z5=pp(w-2u,0); -pd z1; pd z5; draw z1..z2..z3..z4--z5; % stroke -endchar; - -beginpunkchar("3",9,.5,.5); -z1=pp(2u,.7h); z2=pp(.5w,h); z3=pp(w-u,.5[y2,y4]); -z4=pp(.5w-u,.55h); z5=pp(w-u,.5[y4,y6]); z6=pp(.5w,0); z7=pp(1.5u,.2h); -pd z1; pd z7; draw z1..z2..z3..z4&z4..z5..z6..z7; % arcs -endchar; - -beginpunkchar("4",9,1,1); -z1=pp(w-u,.3h); z2=pp(u,.3h); z3=pp(2/3w,h); z4=pp(2/3w,0); -pd z1; pd z4; draw z1--z2--z3--z4; % stem and diagonals -endchar; - -beginpunkchar("5",9,.5,.5); -z1=pp(w-2u,h); z2=pp(2u,h); z3=pp(u,.7h); z4=pp(w-u,.5[y3,y5]); -z5=pp(.5w,0); z6=pp(u,.2h); -pd z1; pd z6; draw z1--z2--z3..z4..z5..z6; % stroke -endchar; - -beginpunkchar("6",9,1,1); -z1=pp(2/3w,h); z2=pp(u,.3h); z3=pp(.5w,0); z4=pp(w-u,.3h); z5=pp(.6w,.6h); -z6=pp z2; pd z1; pd z6; draw z1..z2..z3..z4..z5--z6; % stroke -endchar; - -beginpunkchar("7",9,.5,1); -z1=pp(2u,h); z2=pp(w-.5u,h); z3=pp(.4w,0); -pd z1; pd z3; draw z1--z2&z2..z3{down}; % stroke -endchar; - -beginpunkchar("8",9,.5,.5); -z1=pp(.5w,h); z2=pp(u,.5[y1,y3]); z3=pp(.5w,.6h); z4=pp(w-u,.5[y3,y5]); -z5=pp(.5w,0); z6=pp(u,.5[y5,y3]); z7=pp(w-u,.5[y1,y3]); -pd z1; draw z1{curl 8}..z2..z3..z4..z5..z6..z3..z7..z1; % stroke -endchar; - -beginpunkchar("9",9,1,1); -z1=pp(1/3w,0); z2=pp(w-u,.7h); z3=pp(.5w,h); z4=pp(u,.7h); z5=pp(.5w,.4h); -pd z1; pd z5; draw z1..z2..z3..z4..z5; % stroke -endchar; - -beginpunkchar(96,9,1,1); % \`{} grave -z1=pp(2.5u,h); z2=pp(.6w,.8h); pd z1; pd z2; draw z1--z2; % diagonal -endchar; - -beginpunkchar(180,9,1,1); % \'{} acute -z1=pp(w-2.5u,h); z2=pp(.4w,.8h); pd z1; pd z2; draw z1--z2; % diagonal -endchar; - -beginpunkchar(710,13,1,1); % \^{} circumflex -z1=pp(2.5u,.8h); z2=pp(.5w,h); z3=(w-2.5u,.8h); -pd z1; pd z3; draw z1--z2--z3; % diagonals -endchar; - -beginpunkchar(711,13,1,1); % \v{} caron -z1=pp(2.5u,.9h); z2=pp(.5w,.7h); z3=pp(w-2.5u,.9h); -pd z1; pd z3; draw z1--z2--z3; % diagonals -endchar; - -beginpunkchar(728,11,1,1); % \u{} breve -z1=pp(2u,h); z2=pp(.5w,.75h); z3=pp(w-2u,h); -pd z1; pd z3; draw flex(z1,z2,z3); % stroke -endchar; - -beginpunkchar(175,12,1,1); % \={} macron -z1=pp(u,.8h); z2=pp(w-u,.8h); pd z1; pd z2; draw z1--z2; % bar -endchar; - -beginpunkchar(729,5,1,1); % \.{} -pd pp(.5w,.9h); % dot -endchar; - -beginpunkchar(168,13,1,1); % \"{} diaeresis -pd pp(1/5w,.9h); pd pp(4/5w,.9h); % dots -endchar; - -beginpunkchar(732,13,1,1); % \~{} tilde -z1=pp(u,.75h); z2=pp(w-u,.9h); pd z1; pd z2; draw z1{up}..{up}z2; % stroke -endchar; - -beginpunkchar(733,13,1,1); % \H{} hungarumlaut -z1=pp(4u,h); z2=pp(2.5u,.7h); z3=pp(w-2u,h); z4=pp(w-3.5u,.7h); -pd z1; pd z3; draw z1--z2--z4--z3; % diagonals (linked) -endchar; - -beginpunkchar(730,13,0,0); % Scandinavian loop, for \AA\ and \aa (ring) -z0=(.5w,.66h); % point $z^2$ of lowercase A -z1=(.5w,.9h); draw z0{z0-(1.5u,0)}..z1..{(w-1.5u,0)-z0}z0; % loop -endchar; - -beginpunkchar(184,13,.5,.5); % Cedilla, for \c c -z1=(.6w,0); z2=pp(.6w,-.1h); z3=pp(2.5u,-.1h); -pd z3; draw z1--z2--z3; % stroke -endchar; - -initialize_punk_lower ; - -beginpunkchar(305,5,1,2); % dotless I -z1=pp(.5w,0); z2=(.5w,1/3h); z3=(.5w,2/3h); z4=(.5w,h); -pd z1; pd z4; draw flex(z1,z2,z3,z4); % stem -endchar; - -beginpunkchar(567,9,1,2); % dotless J -z1=pp(w-2u,h); z2=pp(w-2u,-.1h); z3=pp(u,0); -pd z1; pd z3; draw z1--z2--z3; % arc -endchar; - -beginpunkchar(223,18,.3,1); % German SS -z1=pp(.5w-u,.9h); z2=pp(1/3w,h); z3=pp(u,.7h); z4=.6[z6,z2]; -z5=pp(.5w,.35h); z6=pp(1/3w,u); z7=pp(u,.2h); -pd z1; pd z7; draw z1--z2...z3..z4..z5...z6--z7; % left stroke -for i=1 upto 7: z[i+10]=pp(z[i] shifted (.5w-u,0)); endfor -pd z11; pd z17; draw z11--z12...z13..z14..z15...z16--z17; % right stroke -endchar; - -beginpunkchar("a",13,1,2); -z1=pp(1.5u,0); z2=(.5w,1.1h); z3=pp(w-1.5u,0); -pd z1; pd z3; draw z1--z2--z3; % left and right diagonals -z4=pp .3[z1,z2]; z5=pp .3[z3,z2]; pd z4; pd z5; draw z4--z5; % crossbar -endchar; - -beginpunkchar("b",12,1,1); -z1=pp(2u,0); z2=pp(2u,.6h); z3=pp(2u,h); pd z1; pd z3; draw z1--z3; % stem -z1.5=pp(w-u,.5y2); z2.5=pp(w-u,.5[y2,y3]); draw z2--z2.5--z3; % upper lobe -draw flex(z2,z1.5,z1); % lower lobe -endchar; - -beginpunkchar("c",13,1,2); -z1=pp(w-2u,.8h); z2=pp(.6w,h); z3=pp(u,.5h); z4=(.6w,0); z5=(w-2u,.2h); -pd z1; pd z5; draw z1..z2..z3..z4..z5; % arc -endchar; - -beginpunkchar("d",14,1,2); -z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-u,.6h); -pd z1; pd z2; draw flex(z1,z3,z2); % lobe -draw z1--z2; % stem -endchar; - -beginpunkchar("e",12,.5,1); -z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2.5u,h); z4=pp(w-2u,0); -pd z3; pd z4; draw z4--z1--z2--z3; % stem and arms -z5=pp(2u,.6h); z6=pp(w-3u,.6h); pd z5; pd z6; draw z5--z6; % crossbar -endchar; - -beginpunkchar("f",12,.5,2); -z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,h); -pd z1; pd z3; draw z1--z2--z3; % stem and arm -z5=pp(2u,.6h); z6=pp(w-3u,.6h); z4=pp .5[z5,z6]-(0,.1h); -pd z5; pd z6; draw flex (z5,z4,z6); % crossbar -endchar; - -beginpunkchar("g",13,.5,.5); -z1=pp(w-2u,.8h); z2=pp(.6w,h); z3=pp(u,.5h); z4=pp(.6w,0); z5=(w-2u,0); -pd z1; draw z1..z2..z3..z4---z5; % arc -z6=pp(.5[u,x5],.4h); pd z6; pd z5; draw z6--(pp(x5,y6))--z5; % spur -endchar; - -beginpunkchar("h",14,1,.5); -z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,0); z4=pp(w-2u,h); -z5=pp(2u,.6h); z6=pp(w-2u,.6h); -pd z1; pd z2; pd z3; pd z4; draw z1--z2; draw flex(z3,z6,z4); % stems -pd z5; draw z5--z6; % crossbar -endchar; - -beginpunkchar("i",5,1,2); -z1=pp(.5w,0); z2=(.5w,1/3h); z3=(.5w,2/3h); z4=(.5w,h); -pd z1; pd z4; draw flex(z1,z2,z3,z4); % stem -endchar; - -beginpunkchar("j",9,1,2); -z1=pp(w-2u,h); z2=pp(w-2u,-.1h); z3=pp(u,0); -pd z1; pd z3; draw z1--z2--z3; % arc -endchar; - -beginpunkchar("k",14,1,2); -z1=pp(2u,0); z2=pp(2u,h); z3=pp(2u,1/3h); z4=pp(w-1.5u,h); -pd z1; pd z2; draw z1--z2; % stem -pd z3; pd z4; draw z3--z4; % upper diagonal -z6=pp(w-u,0); z5=1/3[z3,z4]; -pd z6; draw flex(z5,.8[z1,2/3[z5,z6] ],z6);% lower diagonal -endchar; - -beginpunkchar("l",11,1,2); -z1=pp(2u,h); z2=pp(2u,0); z3=pp(w-1.5u,0); -pd z1; pd z3; draw z1--z2--z3; % stem and arm -endchar; - -beginpunkchar("m",17,.5,2); -z1=pp(2u,0); z2=pp(2u,h); z3=pp(.5w,0); z4=pp(w-2u,h); z5=pp(w-2u,0); -pd z1; pd z5; draw z1--z2--z3--z4--z5; % stems and diagonals -endchar; - -beginpunkchar("n",13,.75,2); -z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,0); z4=pp(w-2u,h); -pd z1; pd z4; draw z1--z2--z3--z4; % stems and diagonals -endchar; - -beginpunkchar("o",12,.5,2); -z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h); -pd z1; draw z1{left}..z2..z3..z4..z1; % bowl -endchar; - -beginpunkchar("p",13,1,2); -z1=pp(2u,0); z2=pp(2u,1.1h); z3=pp(2u,.5h); z4=pp(w,.6[y3,y2]); -pd z1; pd z3; draw z1--z2--z4--z3; % stem and bowl -endchar; - -beginpunkchar("q",14,.5,2); -z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h); -pd z1; draw z1{curl 2}..z2..z3..z4..z1; % bowl -z5=pp(.4w,.2h); z6=pp(w-u,-.1h); z7=pp(.5[x5,x6],-.2h); -pd z5; pd z6; draw z5--z7--z6; % tail -endchar; - -beginpunkchar("r",16,1,2); -z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-u,.6[y2,y4]); z4=pp(2u,.5h); z5=pp(w-1.5u,0); -pd z1; pd z2; pd z5; draw z1--flex(z2,z3,z4)--z5; % stem, bowl, and diagonal -endchar; - -beginpunkchar("s",11,.3,1); -z1=pp(w-2u,.9h); z2=pp(.5w,h); z3=pp(u,.7h); z4=.6[z6,z2]; -z5=pp(w-u,.35h); z6=pp(.5w,u); z7=pp(u,.2h); -pd z1; pd z7; draw z1--z2...z3..z4..z5...z6--z7; % stroke -endchar; - -beginpunkchar("t",13,.75,2); -z1=pp(u,h); z2=pp(w-u,h); z3=pp(.5w,0); -pd z1; pd z2; pd z3; draw z1--z2; % arms -draw .5[z1,z2]--z3; % stem -endchar; - -beginpunkchar("u",13,.3,2); -z1=pp(2u,h); z2=pp(2u,.2h); z3=pp(.5w,0); z4=pp(w-2u,.2h); z5=pp(w-2u,h); -pd z1; pd z5; draw z1---z2...z3{z4-z2}...z4---z5; % stroke -endchar; - -beginpunkchar("v",13,1,2); -z1=pp(1.5u,h); z2=pp(.5w,0); z3=pp(w-1.5u,h); -pd z1; pd z3; draw z1--z2--z3; % diagonals -endchar; - -beginpunkchar("w",18,1,2); -z1=pp(1.5u,h); z2=pp(.5[x1,x3],0); z3=pp(.5w,.8h); z4=pp(.5[x3,x5],0); -z5=pp(w-1.5u,h); -pd z1; pd z5; draw z1--z2--z3--z4--z5; % diagonals -endchar; - -beginpunkchar("x",13,1,1); -z1=pp(1.5u,h); z2=pp(w-1.5u,0); z3=pp(1.5u,0); z4=pp(w-2.5u,h); -pd z1; pd z2; draw z1--z2; % main diagonal -pd z3; pd z4; draw z3--z4; % cross diagonal -endchar; - -beginpunkchar("y",13,1,2); -z1=pp(1.5u,h); z2=pp(w-1.5u,h); z3=pp(.5w,.5h); z4=pp(.5w,0); -pd z1; pd z2; pd z4; draw z1--z3--z4; % stem and left diagonal -draw z2--z3; % right diagonal -endchar; - -beginpunkchar("z",11,1,2); -z1=pp(1.5u,h); z2=pp(w-2.5u,h); z3=pp(1.5u,0); z4=pp(w-1.5u,0); -pd z1; pd z4; draw z1--z2--z3--z4; % diagonals -endchar; - -beginpunkchar(230,16,1,2); % \ae -z1=pp(1.5u,0); z2=pp(.6w,h); z3=pp(w-1.5u,h); -pd z1; pd z3; draw z1--z2--z3; % left diagonal and upper arm -z4=pp .3[z1,z2]; z5=pp(.6w,0); z6=pp(w-2u,.3h); -pd z4; pd z6; draw z4--z6; % crossbar -z7=pp(w-u,0); pd z2; pd z7; draw z2--z5--z7; % stem and lower arm -endchar; - -beginpunkchar(339,18,1,2); % \oe -z1=pp(.5w,h); z2=pp(u,.4h); z3=pp(.5w,0); -pd z1; draw z1..z2..{right}z3; % bowl -z4=pp(w-1.5u,h); z5=pp(w-2u,.4h); z6=pp(w-u,0); -pd z4; pd z6; draw z4--z1--z3--z6; % arms and stem -pd z5; draw z5--.4[z3,z1]; % crossbar -endchar; - -beginpunkchar(248,14,1,1); % \o -z1=pp(.5w,h); z2=pp(u,.5h); z3=pp(.5w,0); z4=pp(w-u,.5h); -z5=pp(w-2u,1.1h); z6=pp(2u,-.1h); -pd z1; pd z6; draw z1..z2..z3..z4..z5--z6; % bowl and diagonal -endchar; - -revert_punk_lower; - -beginpunkchar("_",12,.5,.5); % _ -z1=pp(0,-.2h); z2=pp(w,-.2h); pd z1; pd z2; draw z1--z2; % bar -endchar; - -beginpunkchar("^",12,1,.5); % -z1=pp(.5w,h); z2=pp(1.5u,.6h); z3=pp(w-1.5u,.6h); -pd z2; pd z3; draw z2--z1--z3; -endchar; +input "punkfont-definitions.mp" ; +input "punkfont-characters.mp" ; diff --git a/Master/texmf-dist/scripts/context/lua/mtx-babel.lua b/Master/texmf-dist/scripts/context/lua/mtx-babel.lua index 01e2ba4b223..120e490929e 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-babel.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-babel.lua @@ -8,6 +8,20 @@ if not modules then modules = { } end modules ['mtx-babel'] = { -- data tables by Thomas A. Schmitz +local helpinfo = [[ +--language=string conversion language (e.g. greek) +--structure=string obey given structure (e.g. 'document', default: 'context') +--convert convert babel codes into utf +]] + +local application = logs.application { + name = "mtx-babel", + banner = "Babel Input To UTF Conversion 1.20", + helpinfo = helpinfo, +} + +local report = application.report + scripts = scripts or { } scripts.babel = scripts.babel or { } @@ -387,22 +401,22 @@ do local structure = environment.argument("structure") or "document" converter = converter[structure] if converter then - logs.simple("converting '%s' using language '%s' with structure '%s'", filename, language, structure) + report("converting '%s' using language '%s' with structure '%s'", filename, language, structure) data = converter:match(data) local newfilename = filename .. ".utf" io.savedata(newfilename, data) - logs.simple("converted data saved in '%s'", newfilename) + report("converted data saved in '%s'", newfilename) else - logs.simple("unknown structure '%s' language '%s'", structure, language) + report("unknown structure '%s' language '%s'", structure, language) end else - logs.simple("no converter for language '%s'", language) + report("no converter for language '%s'", language) end else - logs.simple("provide language") + report("provide language") end else - logs.simple("no data in '%s'",filename) + report("no data in '%s'",filename) end end end @@ -415,16 +429,8 @@ do end -logs.extendbanner("Babel Input To UTF Conversion 1.20",true) - -messages.help = [[ ---language=string conversion language (e.g. greek) ---structure=string obey given structure (e.g. 'document', default: 'context') ---convert convert babel codes into utf -]] - if environment.argument("convert") then scripts.babel.convert(environment.files[1] or "") else - logs.help(messages.help) + application.help() end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-base.lua b/Master/texmf-dist/scripts/context/lua/mtx-base.lua new file mode 100644 index 00000000000..ab5bfe18a9b --- /dev/null +++ b/Master/texmf-dist/scripts/context/lua/mtx-base.lua @@ -0,0 +1,118 @@ +if not modules then modules = { } end modules ['mtx-base'] = { + version = 1.001, + comment = "formerly known as luatools", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local helpinfo = [[ +--generate generate file database +--variables show configuration variables +--configurations show configuration order +--expand-braces expand complex variable +--expand-path expand variable (resolve paths) +--expand-var expand variable (resolve references) +--show-path show path expansion of ... +--var-value report value of variable +--find-file report file location +--find-path report path of file +--make or --ini make luatex format +--run or --fmt= run luatex format +--compile assemble and compile lua inifile +--verbose give a bit more info +--all show all found files +--format=str filter cf format specification (default 'tex', use 'any' for any match) +--pattern=str filter variables +--trackers=list enable given trackers +]] + +local application = logs.application { + name = "mtx-base", + banner = "ConTeXt TDS Management Tool 1.35 (aka luatools)", + helpinfo = helpinfo, +} + +local report = application.report + +-- private option --noluc for testing errors in the stub + +local instance = resolvers.instance + +local pattern = environment.arguments["pattern"] or nil +local fileformat = environment.arguments["format"] or "" -- nil ? +local allresults = environment.arguments["all"] or false +local trace = environment.arguments["trace"] + +if type(pattern) == 'boolean' then + report("invalid pattern specification") + pattern = nil +end + +if trace then + resolvers.settrace(trace) -- move to mtxrun ? +end + +if environment.arguments["find-file"] then + resolvers.load() + if pattern then + resolvers.dowithfilesandreport(resolvers.findfiles, { pattern }, fileformat, allresults) + else + resolvers.dowithfilesandreport(resolvers.findfiles, environment.files, fileformat, allresults) + end +elseif environment.arguments["find-path"] then + resolvers.load() + local path = resolvers.findpath(environment.files[1], fileformat) + print(path) -- quite basic, wil become function in logs +elseif environment.arguments["run"] then + resolvers.load("nofiles") -- ! no need for loading databases + trackers.enable("resolvers.locating") + environment.run_format(environment.files[1] or "",environment.files[2] or "",environment.files[3] or "") +elseif environment.arguments["fmt"] then + resolvers.load("nofiles") -- ! no need for loading databases + trackers.enable("resolvers.locating") + environment.run_format(environment.arguments["fmt"], environment.files[1] or "",environment.files[2] or "") +elseif environment.arguments["expand-braces"] then + resolvers.load("nofiles") + resolvers.dowithfilesandreport(resolvers.expandbraces, environment.files) +elseif environment.arguments["expand-path"] then + resolvers.load("nofiles") + resolvers.dowithfilesandreport(resolvers.expandpath, environment.files) +elseif environment.arguments["expand-var"] or environment.arguments["expand-variable"] then + resolvers.load("nofiles") + resolvers.dowithfilesandreport(resolvers.expansion, environment.files) +elseif environment.arguments["show-path"] or environment.arguments["path-value"] then + resolvers.load("nofiles") + resolvers.dowithfilesandreport(resolvers.showpath, environment.files) +elseif environment.arguments["var-value"] or environment.arguments["show-value"] then + resolvers.load("nofiles") + resolvers.dowithfilesandreport(resolvers.variable, environment.files) +elseif environment.arguments["format-path"] then + resolvers.load() + report(caches.getwritablepath("format")) +elseif pattern then -- brrr + resolvers.load() + resolvers.dowithfilesandreport(resolvers.findfiles, { pattern }, fileformat, allresults) +elseif environment.arguments["generate"] then + instance.renewcache = true + trackers.enable("resolvers.locating") + resolvers.load() +elseif environment.arguments["make"] or environment.arguments["ini"] or environment.arguments["compile"] then + resolvers.load() + trackers.enable("resolvers.locating") + environment.make_format(environment.files[1] or "") +elseif environment.arguments["variables"] or environment.arguments["show-variables"] or environment.arguments["expansions"] or environment.arguments["show-expansions"] then + resolvers.load("nofiles") + resolvers.listers.variables(pattern) +elseif environment.arguments["configurations"] or environment.arguments["show-configurations"] then + resolvers.load("nofiles") + resolvers.listers.configurations() +elseif environment.arguments["help"] or (environment.files[1]=='help') or (#environment.files==0) then + application.help() +elseif environment.files[1] == 'texmfcnf.lua' then + resolvers.load("nofiles") + resolvers.listers.configurations() +else + resolvers.load() + resolvers.dowithfilesandreport(resolvers.findfiles, environment.files, fileformat, allresults) +end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-cache.lua b/Master/texmf-dist/scripts/context/lua/mtx-cache.lua index c2a0db00d89..08202bbf816 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-cache.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-cache.lua @@ -6,91 +6,114 @@ if not modules then modules = { } end modules ['mtx-cache'] = { license = "see context related readme files" } -scripts = scripts or { } -scripts.cache = scripts.cache or { } +local helpinfo = [[ +--purge remove not used files +--erase completely remove cache +--list show cache -function scripts.cache.collect_one(...) - local path = caches.setpath(...) - local tmas = dir.glob(path .. "/*.tma") - local tmcs = dir.glob(path .. "/*.tmc") - return path, tmas, tmcs -end +--all all (not yet implemented) +]] -function scripts.cache.collect_two(...) - local path = caches.setpath(...) - local rest = dir.glob(path .. "/**/*") - return path, rest -end +local application = logs.application { + name = "mtx-cache", + banner = "ConTeXt & MetaTeX Cache Management 0.10", + helpinfo = helpinfo, +} -local suffixes = { "afm", "tfm", "def", "enc", "otf", "mp", "data" } +local report = application.report + +scripts = scripts or { } +scripts.cache = scripts.cache or { } -function scripts.cache.process_one(action) - for i=1,#suffixes do - action("fonts", suffixes[i]) +local function collect(path) + local all = dir.glob(path .. "/**/*") + local tmas, tmcs, rest = { }, { }, { } + for i=1,#all do + local name = all[i] + local suffix = file.suffix(name) + if suffix == "tma" then + tmas[#tmas+1] = name + elseif suffix == "tmc" then + tmcs[#tmcs+1] = name + else + rest[#rest+1] = name + end end + return tmas, tmcs, rest, all end -function scripts.cache.process_two(action) - action("curl") +local function list(banner,path,tmas,tmcs,rest) + report("%s: %s",banner,path) + report() + report("tma : %4i",#tmas) + report("tmc : %4i",#tmcs) + report("rest : %4i",#rest) + report("total : %4i",#tmas+#tmcs+#rest) + report() end --- todo: recursive delete of paths - -function scripts.cache.remove(list,keep) - local n, keepsuffixes = 0, table.tohash(keep or { }) +local function purge(banner,path,list,all) + report("%s: %s",banner,path) + report() + local n = 0 for i=1,#list do local filename = list[i] if string.find(filename,"luatex%-cache") then -- safeguard - if not keepsuffixes[file.extname(filename) or ""] then + if all then os.remove(filename) n = n + 1 + else + local suffix = file.suffix(filename) + if suffix == "tma" then + local checkname = file.replacesuffix(filename,"tma","tmc") + if lfs.isfile(checkname) then + os.remove(filename) + n = n + 1 + end + end end end end - return n + report("removed tma files : %i",n) + report() end -function scripts.cache.delete(all,keep) - scripts.cache.process_one(function(...) - local path, rest = scripts.cache.collect_one(...) - local n = scripts.cache.remove(rest,keep) - logs.report("cache path",string.format("%4i files out of %4i deleted on %s",n,#rest,path)) - end) - scripts.cache.process_two(function(...) - local path, rest = scripts.cache.collect_two(...) - local n = scripts.cache.remove(rest,keep) - logs.report("cache path",string.format("%4i files out of %4i deleted on %s",n,#rest,path)) - end) +function scripts.cache.purge() + local writable = caches.getwritablepath() + local tmas, tmcs, rest = collect(writable) + list("writable path",writable,tmas,tmcs,rest) + local n = purge("writable path",writable,tmas) + list("writable path",writable,tmas,tmcs,rest) end -function scripts.cache.list(all) - scripts.cache.process_one(function(...) - local path, tmas, tmcs = scripts.cache.collect_one(...) - logs.report("cache path",string.format("%4i (tma:%4i, tmc:%4i) %s",#tmas+#tmcs,#tmas,#tmcs,path)) - logs.report("cache path",string.format("%4i (tma:%4i, tmc:%4i) %s",#tmas+#tmcs,#tmas,#tmcs,path)) - end) - scripts.cache.process_two(function(...) - local path, rest = scripts.cache.collect_two("curl") - logs.report("cache path",string.format("%4i %s",#rest,path)) - end) +function scripts.cache.erase() + local writable = caches.getwritablepath() + local tmas, tmcs, rest, all = collect(writable) + list("writable path",writable,tmas,tmcs,rest) + local n = purge("writable path",writable,all,true) + list("writable path",writable,tmas,tmcs,rest) end -logs.extendbanner("ConTeXt & MetaTeX Cache Management 0.10") - -messages.help = [[ ---purge remove not used files ---erase completely remove cache ---list show cache - ---all all (not yet implemented) -]] +function scripts.cache.list() + local readables = caches.getreadablepaths() + local writable = caches.getwritablepath() + local tmas, tmcs, rest = collect(writable) + list("writable path",writable,tmas,tmcs,rest) + for i=1,#readables do + local readable = readables[i] + if readable ~= writable then + local tmas, tmcs = collect(readable) + list("readable path",readable,tmas,tmcs,rest) + end + end +end if environment.argument("purge") then - scripts.cache.delete(environment.argument("all"),{"tmc"}) + scripts.cache.purge() elseif environment.argument("erase") then - scripts.cache.delete(environment.argument("all")) + scripts.cache.erase() elseif environment.argument("list") then - scripts.cache.list(environment.argument("all")) + scripts.cache.list() else - logs.help(messages.help) + application.help() end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-chars.lua b/Master/texmf-dist/scripts/context/lua/mtx-chars.lua index 6acacfbd22e..dc760c4e7e6 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-chars.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-chars.lua @@ -6,6 +6,20 @@ if not modules then modules = { } end modules ['mtx-chars'] = { license = "see context related readme files" } +local helpinfo = [[ +--stix convert stix table to math table +--xtx generate xetx-*.tex (used by xetex) +--pdf generate pdfr-def.tex (used by pdftex) +]] + +local application = logs.application { + name = "mtx-chars", + banner = "MkII Character Table Generators 0.10", + helpinfo = helpinfo, +} + +local report = application.report + local format, concat, utfchar, upper = string.format, table.concat, unicode.utf8.char, string.upper scripts = scripts or { } @@ -24,13 +38,13 @@ scripts.chars = scripts.chars or { } --~ --~ function scripts.chars.stixtomkiv(inname,outname) --~ if inname == "" then ---~ logs.report("aquiring math data","invalid datafilename") +--~ report("aquiring math data, invalid datafilename") --~ end --~ local f = io.open(inname) --~ if not f then ---~ logs.report("aquiring math data","invalid datafile") +--~ report("aquiring math data, invalid datafile") --~ else ---~ logs.report("aquiring math data","processing " .. inname) +--~ report("aquiring math data, processing %s",inname) --~ if not outname or outname == "" then --~ outname = "char-mth.lua" --~ end @@ -72,9 +86,9 @@ scripts.chars = scripts.chars or { } --~ end --~ if not valid then --~ g:write("\t-- The data file is corrupt, invalid or maybe the format has changed.\n") ---~ logs.report("aquiring math data","problems with data table") +--~ report("aquiring math data, problems with data table") --~ else ---~ logs.report("aquiring math data","table saved in " .. outname) +--~ report("aquiring math data, table saved in %s",outname) --~ end --~ g:write("}\n") --~ g:close() @@ -83,7 +97,7 @@ scripts.chars = scripts.chars or { } --~ end function scripts.chars.stixtomkiv(inname,outname) - logs.report("we no longer use this options but use our own tables instead") + report("we no longer use this options but use our own tables instead") end local banner_pdf_1 = [[ @@ -101,7 +115,7 @@ local banner_pdf_2 = [[ ]] function scripts.chars.makepdfr() - local chartable = resolvers.find_file("char-def.lua") or "" + local chartable = resolvers.findfile("char-def.lua") or "" if chartable ~= "" then dofile(chartable) if characters and characters.data then @@ -143,6 +157,11 @@ local banner_utf_patch = [[ \setXTXcharcodes "201C "201C "201C \setXTXcharcodes "201D "201D "201D + +% patch needed for french + +\setXTXcharcodes "2019 "2019 "2019 + ]] local banner_utf_names = [[ @@ -174,13 +193,13 @@ local xtxclasses = { } function scripts.chars.makeencoutf() - local chartable = resolvers.find_file("char-def.lua") or "" + local chartable = resolvers.findfile("char-def.lua") or "" if chartable ~= "" then dofile(chartable) local function open(name,banner) local f = io.open(name,'w') if f then - logs.simple("writing '%s'",name) + report("writing '%s'",name) f:write(format(banner_utf_module,name)) f:write(banner) f:write() @@ -234,13 +253,14 @@ function scripts.chars.makeencoutf() end end end + local template = "\\def\\%-".. length .. "s{\\char\"%05X } %% %s: %s\n" for i=1,#list do local code = list[i] if code > 0x5B and code <= 0xFFFF then local chr = data[code] if chr and chr.contextname then local ch = utfchar(code) - f:write(format("\\def\\%s{\\char\"%05X } %% %s: %s\n", chr.contextname:rpadd(length," "), code, chr.description, ch)) + f:write(format(template, chr.contextname, code, chr.description, ch)) end end end @@ -301,14 +321,6 @@ function scripts.chars.makeencoutf() end end -logs.extendbanner("MkII Character Table Generators 0.10") - -messages.help = [[ ---stix convert stix table to math table ---xtx generate xetx-*.tex (used by xetex) ---pdf generate pdfr-def.tex (used by pdftex) -]] - if environment.argument("stix") then local inname = environment.files[1] or "" local outname = environment.files[2] or "" @@ -318,5 +330,5 @@ elseif environment.argument("xtx") then elseif environment.argument("pdf") then scripts.chars.makepdfr() else - logs.help(messages.help) + application.help() end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-check.lua b/Master/texmf-dist/scripts/context/lua/mtx-check.lua index 4266ddf0d46..e0ab3b88276 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-check.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-check.lua @@ -6,91 +6,99 @@ if not modules then modules = { } end modules ['mtx-check'] = { license = "see context related readme files" } +local helpinfo = [[ +--convert check tex file for errors +]] + +local application = logs.application { + name = "mtx-check", + banner = "Basic ConTeXt Syntax Checking 0.10", + helpinfo = helpinfo, +} + +local report = application.report + scripts = scripts or { } scripts.checker = scripts.checker or { } local validator = { } -do - - validator.n = 1 - validator.errors = { } - validator.trace = false - validator.direct = false +validator.n = 1 +validator.errors = { } +validator.trace = false +validator.direct = false - validator.printer = print - validator.tracer = print +validator.printer = print +validator.tracer = print - local message = function(position, kind) - local ve = validator.errors - ve[#ve+1] = { kind, position, validator.n } - if validator.direct then - validator.printer(string.format("%s error at position %s (line %s)", kind, position, validator.n)) - end +local message = function(position, kind) + local ve = validator.errors + ve[#ve+1] = { kind, position, validator.n } + if validator.direct then + validator.printer(string.format("%s error at position %s (line %s)", kind, position, validator.n)) end - local progress = function(position, data, kind) - if validator.trace then - validator.tracer(string.format("%s at position %s: %s", kind, position, data or "")) - end +end +local progress = function(position, data, kind) + if validator.trace then + validator.tracer(string.format("%s at position %s: %s", kind, position, data or "")) end +end - local P, R, S, V, C, CP, CC = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.C, lpeg.Cp, lpeg.Cc - - local i_m, d_m = P("$"), P("$$") - local l_s, r_s = P("["), P("]") - local l_g, r_g = P("{"), P("}") - - local okay = lpeg.P("{[}") + lpeg.P("{]}") - - local esc = P("\\") - local cr = P("\r") - local lf = P("\n") - local crlf = P("\r\n") - local space = S(" \t\f\v") - local newline = crlf + cr + lf - - local line = newline / function() validator.n = validator.n + 1 end - - -- local grammar = P { "tokens", - -- ["tokens"] = (V("whatever") + V("grouped") + V("setup") + V("display") + V("inline") + V("errors") + 1)^0, - -- ["whatever"] = line + esc * 1 + C(P("%") * (1-line)^0), - -- ["grouped"] = CP() * C(l_g * (V("whatever") + V("grouped") + V("setup") + V("display") + V("inline") + (1 - l_g - r_g))^0 * r_g) * CC("group") / progress, - -- ["setup"] = CP() * C(l_s * (V("whatever") + V("grouped") + V("setup") + V("display") + V("inline") + (1 - l_s - r_s))^0 * r_s) * CC("setup") / progress, - -- ["display"] = CP() * C(d_m * (V("whatever") + V("grouped") + (1 - d_m))^0 * d_m) * CC("display") / progress, - -- ["inline"] = CP() * C(i_m * (V("whatever") + V("grouped") + (1 - i_m))^0 * i_m) * CC("inline") / progress, - -- ["errors"] = (V("gerror") + V("serror") + V("derror") + V("ierror")) * true, - -- ["gerror"] = CP() * (l_g + r_g) * CC("grouping") / message, - -- ["serror"] = CP() * (l_s + r_g) * CC("setup error") / message, - -- ["derror"] = CP() * d_m * CC("display math error") / message, - -- ["ierror"] = CP() * i_m * CC("inline math error") / message, - -- } - - local startluacode = P("\\startluacode") - local stopluacode = P("\\stopluacode") - - local somecode = startluacode * (1-stopluacode)^1 * stopluacode - - local grammar = P { "tokens", - ["tokens"] = (V("ignore") + V("whatever") + V("grouped") + V("setup") + V("display") + V("inline") + V("errors") + 1)^0, - ["whatever"] = line + esc * 1 + C(P("%") * (1-line)^0), - ["grouped"] = l_g * (V("whatever") + V("grouped") + V("setup") + V("display") + V("inline") + (1 - l_g - r_g))^0 * r_g, - ["setup"] = l_s * (okay + V("whatever") + V("grouped") + V("setup") + V("display") + V("inline") + (1 - l_s - r_s))^0 * r_s, - ["display"] = d_m * (V("whatever") + V("grouped") + (1 - d_m))^0 * d_m, - ["inline"] = i_m * (V("whatever") + V("grouped") + (1 - i_m))^0 * i_m, - ["errors"] = (V("gerror")+ V("serror") + V("derror") + V("ierror")), - ["gerror"] = CP() * (l_g + r_g) * CC("grouping") / message, - ["serror"] = CP() * (l_s + r_g) * CC("setup error") / message, - ["derror"] = CP() * d_m * CC("display math error") / message, - ["ierror"] = CP() * i_m * CC("inline math error") / message, - ["ignore"] = somecode, - } - - function validator.check(str) - validator.n = 1 - validator.errors = { } - grammar:match(str) - end +local P, R, S, V, C, CP, CC = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.C, lpeg.Cp, lpeg.Cc + +local i_m, d_m = P("$"), P("$$") +local l_s, r_s = P("["), P("]") +local l_g, r_g = P("{"), P("}") + +local okay = lpeg.P("{[}") + lpeg.P("{]}") + +local esc = P("\\") +local cr = P("\r") +local lf = P("\n") +local crlf = P("\r\n") +local space = S(" \t\f\v") +local newline = crlf + cr + lf + +local line = newline / function() validator.n = validator.n + 1 end + +-- local grammar = P { "tokens", +-- ["tokens"] = (V("whatever") + V("grouped") + V("setup") + V("display") + V("inline") + V("errors") + 1)^0, +-- ["whatever"] = line + esc * 1 + C(P("%") * (1-line)^0), +-- ["grouped"] = CP() * C(l_g * (V("whatever") + V("grouped") + V("setup") + V("display") + V("inline") + (1 - l_g - r_g))^0 * r_g) * CC("group") / progress, +-- ["setup"] = CP() * C(l_s * (V("whatever") + V("grouped") + V("setup") + V("display") + V("inline") + (1 - l_s - r_s))^0 * r_s) * CC("setup") / progress, +-- ["display"] = CP() * C(d_m * (V("whatever") + V("grouped") + (1 - d_m))^0 * d_m) * CC("display") / progress, +-- ["inline"] = CP() * C(i_m * (V("whatever") + V("grouped") + (1 - i_m))^0 * i_m) * CC("inline") / progress, +-- ["errors"] = (V("gerror") + V("serror") + V("derror") + V("ierror")) * true, +-- ["gerror"] = CP() * (l_g + r_g) * CC("grouping") / message, +-- ["serror"] = CP() * (l_s + r_g) * CC("setup error") / message, +-- ["derror"] = CP() * d_m * CC("display math error") / message, +-- ["ierror"] = CP() * i_m * CC("inline math error") / message, +-- } + +local startluacode = P("\\startluacode") +local stopluacode = P("\\stopluacode") + +local somecode = startluacode * (1-stopluacode)^1 * stopluacode + +local grammar = P { "tokens", + ["tokens"] = (V("ignore") + V("whatever") + V("grouped") + V("setup") + V("display") + V("inline") + V("errors") + 1)^0, + ["whatever"] = line + esc * 1 + C(P("%") * (1-line)^0), + ["grouped"] = l_g * (V("whatever") + V("grouped") + V("setup") + V("display") + V("inline") + (1 - l_g - r_g))^0 * r_g, + ["setup"] = l_s * (okay + V("whatever") + V("grouped") + V("setup") + V("display") + V("inline") + (1 - l_s - r_s))^0 * r_s, + ["display"] = d_m * (V("whatever") + V("grouped") + (1 - d_m))^0 * d_m, + ["inline"] = i_m * (V("whatever") + V("grouped") + (1 - i_m))^0 * i_m, + ["errors"] = (V("gerror")+ V("serror") + V("derror") + V("ierror")), + ["gerror"] = CP() * (l_g + r_g) * CC("grouping") / message, + ["serror"] = CP() * (l_s + r_g) * CC("setup error") / message, + ["derror"] = CP() * d_m * CC("display math error") / message, + ["ierror"] = CP() * i_m * CC("inline math error") / message, + ["ignore"] = somecode, +} +function validator.check(str) + validator.n = 1 + validator.errors = { } + grammar:match(str) end --~ str = [[ @@ -117,7 +125,7 @@ function scripts.checker.check(filename) ["\t"] = " ", }) data = data:gsub("^ *","") - print(string.format("% 5i %s %s", line,string.rpadd(kind,10," "),data)) + print(string.format("% 5i %-10s %s", line, kind, data)) end else print("no error") @@ -127,17 +135,13 @@ function scripts.checker.check(filename) end end -logs.extendbanner("Basic ConTeXt Syntax Checking 0.10",true) - -messages.help = [[ ---convert check tex file for errors -]] - if environment.argument("check") then scripts.checker.check(environment.files[1]) elseif environment.argument("help") then - logs.help(messages.help) + application.help() elseif environment.files[1] then scripts.checker.check(environment.files[1]) +else + application.help() end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-colors.lua b/Master/texmf-dist/scripts/context/lua/mtx-colors.lua new file mode 100644 index 00000000000..2a51d50990e --- /dev/null +++ b/Master/texmf-dist/scripts/context/lua/mtx-colors.lua @@ -0,0 +1,57 @@ +if not modules then modules = { } end modules ['mtx-colors'] = { + version = 1.001, + comment = "companion to mtxrun.lua", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- todo: fc-cache -v en check dirs, or better is: fc-cat -v | grep Directory + +local helpinfo = [[ +--table show icc table + +example: + +mtxrun --script color --table somename +]] + +local application = logs.application { + name = "mtx-colors", + banner = "ConTeXt Color Management 0.10", + helpinfo = helpinfo, +} + +local report = application.report + +if not fontloader then fontloader = fontforge end + +dofile(resolvers.findfile("colo-icc.lua","tex")) + +scripts = scripts or { } +scripts.colors = scripts.colors or { } + +function scripts.colors.table() + local files = environment.files + if #files > 0 then + for i=1,#files do + local profile, okay, message = colors.iccprofile(files[i]) + if not okay then + report(message) + else + report(table.serialize(profile,"profile")) + end + end + else + report("no file(s) given" ) + end +end + +--~ local track = environment.argument("track") +--~ if track then trackers.enable(track) end + +if environment.argument("table") then + scripts.colors.table() +else + application.help() +end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-context.lua b/Master/texmf-dist/scripts/context/lua/mtx-context.lua index 79e74e407ff..5645e476050 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-context.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-context.lua @@ -6,6 +6,93 @@ if not modules then modules = { } end modules ['mtx-context'] = { license = "see context related readme files" } +local format, gmatch, match, gsub, find = string.format, string.gmatch, string.match, string.gsub, string.find +local quote = string.quote +local concat = table.concat + +local basicinfo = [[ +--run process (one or more) files (default action) +--make create context formats + +--ctx=name use ctx file (process management specification) +--interface use specified user interface (default: en) + +--autopdf close pdf file in viewer and start pdf viewer afterwards +--purge(all) purge files either or not after a run (--pattern=...) + +--usemodule=list load the given module or style, normally part o fthe distribution +--environment=list load the given environment file first (document styles) +--mode=list enable given the modes (conditional processing in styles) +--path=list also consult the given paths when files are looked for +--arguments=list set variables that can be consulted during a run (key/value pairs) +--randomseed=number set the randomseed +--result=name rename the resulting output to the given name +--trackers=list set tracker variables (show list with --showtrackers) +--directives=list set directive variables (show list with --showdirectives) +--silent=list disable logcatgories (show list with --showlogcategories) +--noconsole disable logging to the console (logfile only) +--purgeresult purge result file before run + +--forcexml force xml stub (optional flag: --mkii) +--forcecld force cld (context lua document) stub + +--arrange run extra imposition pass, given that the style sets up imposition +--noarrange ignore imposition specifications in the style + +--once only run once (no multipass data file is produced) +--batchmode run without stopping and don't show messages on the console +--nonstopmode run without stopping + +--generate generate file database etc. (as luatools does) +--paranoid don't descend to .. and ../.. +--version report installed context version + +--expert expert options +]] + +-- filter=list is kind of obsolete +-- color is obsolete for mkiv, always on +-- separation is obsolete for mkiv, no longer available +-- output is currently obsolete for mkiv +-- setuppath=list must check +-- modefile=name must check +-- input=name load the given inputfile (must check) + +local expertinfo = [[ +expert options: + +--touch update context version number (remake needed afterwards, also provide --expert) +--nostats omit runtime statistics at the end of the run +--update update context from website (not to be confused with contextgarden) +--profile profile job (use: mtxrun --script profile --analyze) +--timing generate timing and statistics overview +--tracefiles show some extra info when locating files (at the tex end) + +--extra=name process extra (mtx-context- in distribution) +--extras show extras +]] + +local specialinfo = [[ +special options: + +--pdftex process file with texexec using pdftex +--xetex process file with texexec using xetex + +--pipe don't check for file and enter scroll mode (--dummyfile=whatever.tmp) +]] + +local application = logs.application { + name = "mtx-context", + banner = "ConTeXt Process Management 0.52", + helpinfo = { + basic = basicinfo, + extra = extrainfo, + expert = expertinfo, + } +} + +local report = application.report + scripts = scripts or { } scripts.context = scripts.context or { } @@ -30,334 +117,334 @@ function io.copydata(fromfile,tofile) io.savedata(tofile,io.loaddata(fromfile) or "") end --- ctx - -ctxrunner = { } - -do - - function ctxrunner.filtered(str,method) - str = tostring(str) - if method == 'name' then str = file.removesuffix(file.basename(str)) - elseif method == 'path' then str = file.dirname(str) - elseif method == 'suffix' then str = file.extname(str) - elseif method == 'nosuffix' then str = file.removesuffix(str) - elseif method == 'nopath' then str = file.basename(str) - elseif method == 'base' then str = file.basename(str) - -- elseif method == 'full' then - -- elseif method == 'complete' then - -- elseif method == 'expand' then -- str = file.expand_path(str) - end - return str:gsub("\\","/") +-- ctx (will become util-ctx) + +local ctxrunner = { } + +function ctxrunner.filtered(str,method) + str = tostring(str) + if method == 'name' then str = file.removesuffix(file.basename(str)) + elseif method == 'path' then str = file.dirname(str) + elseif method == 'suffix' then str = file.extname(str) + elseif method == 'nosuffix' then str = file.removesuffix(str) + elseif method == 'nopath' then str = file.basename(str) + elseif method == 'base' then str = file.basename(str) +-- elseif method == 'full' then +-- elseif method == 'complete' then +-- elseif method == 'expand' then -- str = file.expandpath(str) end + return str:gsub("\\","/") +end - function ctxrunner.substitute(e,str) - local attributes = e.at - if str and attributes then - if attributes['method'] then - str = ctxrunner.filtered(str,attributes['method']) - end - if str == "" and attributes['default'] then - str = attributes['default'] - end +function ctxrunner.substitute(e,str) + local attributes = e.at + if str and attributes then + if attributes['method'] then + str = ctxrunner.filtered(str,attributes['method']) + end + if str == "" and attributes['default'] then + str = attributes['default'] end - return str end + return str +end - function ctxrunner.reflag(flags) - local t = { } - for _, flag in next, flags do - local key, value = flag:match("^(.-)=(.+)$") - if key and value then - t[key] = value - else - t[flag] = true - end +function ctxrunner.reflag(flags) + local t = { } + for _, flag in next, flags do + local key, value = match(flag,"^(.-)=(.+)$") + if key and value then + t[key] = value + else + t[flag] = true end - return t end + return t +end - function ctxrunner.substitute(str) - return str - end +function ctxrunner.substitute(str) + return str +end - function ctxrunner.justtext(str) - str = xml.unescaped(tostring(str)) - str = xml.cleansed(str) - str = str:gsub("\\+",'/') - str = str:gsub("%s+",' ') - return str - end +function ctxrunner.justtext(str) + str = xml.unescaped(tostring(str)) + str = xml.cleansed(str) + str = str:gsub("\\+",'/') + str = str:gsub("%s+",' ') + return str +end - function ctxrunner.new() - return { - ctxname = "", - jobname = "", - xmldata = nil, - suffix = "prep", - locations = { '..', '../..' }, - variables = { }, - messages = { }, - environments = { }, - modules = { }, - filters = { }, - flags = { }, - modes = { }, - prepfiles = { }, - paths = { }, - } - end +function ctxrunner.new() + return { + ctxname = "", + jobname = "", + xmldata = nil, + suffix = "prep", + locations = { '..', '../..' }, + variables = { }, + messages = { }, + environments = { }, + modules = { }, + filters = { }, + flags = { }, + modes = { }, + prepfiles = { }, + paths = { }, + } +end - function ctxrunner.savelog(ctxdata,ctlname) - local function yn(b) - if b then return 'yes' else return 'no' end - end - if not ctlname or ctlname == "" or ctlname == ctxdata.jobname then - if ctxdata.jobname then - ctlname = file.replacesuffix(ctxdata.jobname,'ctl') - elseif ctxdata.ctxname then - ctlname = file.replacesuffix(ctxdata.ctxname,'ctl') - else - logs.simple("invalid ctl name: %s",ctlname or "?") - return - end +function ctxrunner.savelog(ctxdata,ctlname) + local function yn(b) + if b then return 'yes' else return 'no' end + end + if not ctlname or ctlname == "" or ctlname == ctxdata.jobname then + if ctxdata.jobname then + ctlname = file.replacesuffix(ctxdata.jobname,'ctl') + elseif ctxdata.ctxname then + ctlname = file.replacesuffix(ctxdata.ctxname,'ctl') + else + report("invalid ctl name: %s",ctlname or "?") + return end - local prepfiles = ctxdata.prepfiles - if prepfiles and next(prepfiles) then - logs.simple("saving logdata in: %s",ctlname) - f = io.open(ctlname,'w') - if f then - f:write("\n\n") - f:write(string.format("\n",yn(ctxdata.runlocal))) - local sorted = table.sortedkeys(prepfiles) - for i=1,#sorted do - local name = sorted[i] - f:write(string.format("\t%s\n",yn(prepfiles[name]),name)) - end - f:write("\n") - f:close() + end + local prepfiles = ctxdata.prepfiles + if prepfiles and next(prepfiles) then + report("saving logdata in: %s",ctlname) + f = io.open(ctlname,'w') + if f then + f:write("\n\n") + f:write(format("\n",yn(ctxdata.runlocal))) + local sorted = table.sortedkeys(prepfiles) + for i=1,#sorted do + local name = sorted[i] + f:write(format("\t%s\n",yn(prepfiles[name]),name)) end - else - logs.simple("nothing prepared, no ctl file saved") - os.remove(ctlname) + f:write("\n") + f:close() end + else + report("nothing prepared, no ctl file saved") + os.remove(ctlname) end +end - function ctxrunner.register_path(ctxdata,path) - -- test if exists - ctxdata.paths[ctxdata.paths+1] = path - end +function ctxrunner.register_path(ctxdata,path) + -- test if exists + ctxdata.paths[ctxdata.paths+1] = path +end - function ctxrunner.trace(ctxdata) - print(table.serialize(ctxdata.messages)) - print(table.serialize(ctxdata.flags)) - print(table.serialize(ctxdata.environments)) - print(table.serialize(ctxdata.modules)) - print(table.serialize(ctxdata.filters)) - print(table.serialize(ctxdata.modes)) - print(xml.tostring(ctxdata.xmldata)) - end +function ctxrunner.trace(ctxdata) + print(table.serialize(ctxdata.messages)) + print(table.serialize(ctxdata.flags)) + print(table.serialize(ctxdata.environments)) + print(table.serialize(ctxdata.modules)) + print(table.serialize(ctxdata.filters)) + print(table.serialize(ctxdata.modes)) + print(xml.tostring(ctxdata.xmldata)) +end - function ctxrunner.manipulate(ctxdata,ctxname,defaultname) +function ctxrunner.manipulate(ctxdata,ctxname,defaultname) - if not ctxdata.jobname or ctxdata.jobname == "" then - return - end + if not ctxdata.jobname or ctxdata.jobname == "" then + return + end - ctxdata.ctxname = ctxname or file.removesuffix(ctxdata.jobname) or "" + ctxdata.ctxname = ctxname or file.removesuffix(ctxdata.jobname) or "" - if ctxdata.ctxname == "" then - return - end + if ctxdata.ctxname == "" then + return + end - ctxdata.jobname = file.addsuffix(ctxdata.jobname,'tex') - ctxdata.ctxname = file.addsuffix(ctxdata.ctxname,'ctx') + ctxdata.jobname = file.addsuffix(ctxdata.jobname,'tex') + ctxdata.ctxname = file.addsuffix(ctxdata.ctxname,'ctx') - logs.simple("jobname: %s",ctxdata.jobname) - logs.simple("ctxname: %s",ctxdata.ctxname) + report("jobname: %s",ctxdata.jobname) + report("ctxname: %s",ctxdata.ctxname) - -- mtxrun should resolve kpse: and file: + -- mtxrun should resolve kpse: and file: - local usedname = ctxdata.ctxname - local found = lfs.isfile(usedname) + local usedname = ctxdata.ctxname + local found = lfs.isfile(usedname) - if not found then - for _, path in next, ctxdata.locations do - local fullname = file.join(path,ctxdata.ctxname) - if lfs.isfile(fullname) then - usedname, found = fullname, true - break - end + -- no futher test if qualified path + + if not found then + for _, path in next, ctxdata.locations do + local fullname = file.join(path,ctxdata.ctxname) + if lfs.isfile(fullname) then + usedname, found = fullname, true + break end end + end - usedname = resolvers.find_file(ctxdata.ctxname,"tex") + if not found then + usedname = resolvers.findfile(ctxdata.ctxname,"tex") found = usedname ~= "" + end - if not found and defaultname and defaultname ~= "" and lfs.isfile(defaultname) then - usedname, found = defaultname, true - end + if not found and defaultname and defaultname ~= "" and lfs.isfile(defaultname) then + usedname, found = defaultname, true + end - if not found then - return - end + if not found then + return + end - ctxdata.xmldata = xml.load(usedname) + ctxdata.xmldata = xml.load(usedname) - if not ctxdata.xmldata then - return - else - -- test for valid, can be text file - end + if not ctxdata.xmldata then + return + else + -- test for valid, can be text file + end - xml.include(ctxdata.xmldata,'ctx:include','name', table.append({'.', file.dirname(ctxdata.ctxname)},ctxdata.locations)) + xml.include(ctxdata.xmldata,'ctx:include','name', table.append({'.', file.dirname(ctxdata.ctxname)},ctxdata.locations)) - ctxdata.variables['job'] = ctxdata.jobname + ctxdata.variables['job'] = ctxdata.jobname - ctxdata.flags = xml.collect_texts(ctxdata.xmldata,"/ctx:job/ctx:flags/ctx:flag",true) - ctxdata.environments = xml.collect_texts(ctxdata.xmldata,"/ctx:job/ctx:process/ctx:resources/ctx:environment",true) - ctxdata.modules = xml.collect_texts(ctxdata.xmldata,"/ctx:job/ctx:process/ctx:resources/ctx:module",true) - ctxdata.filters = xml.collect_texts(ctxdata.xmldata,"/ctx:job/ctx:process/ctx:resources/ctx:filter",true) - ctxdata.modes = xml.collect_texts(ctxdata.xmldata,"/ctx:job/ctx:process/ctx:resources/ctx:mode",true) - ctxdata.messages = xml.collect_texts(ctxdata.xmldata,"ctx:message",true) + ctxdata.flags = xml.collect_texts(ctxdata.xmldata,"/ctx:job/ctx:flags/ctx:flag",true) + ctxdata.environments = xml.collect_texts(ctxdata.xmldata,"/ctx:job/ctx:process/ctx:resources/ctx:environment",true) + ctxdata.modules = xml.collect_texts(ctxdata.xmldata,"/ctx:job/ctx:process/ctx:resources/ctx:module",true) + ctxdata.filters = xml.collect_texts(ctxdata.xmldata,"/ctx:job/ctx:process/ctx:resources/ctx:filter",true) + ctxdata.modes = xml.collect_texts(ctxdata.xmldata,"/ctx:job/ctx:process/ctx:resources/ctx:mode",true) + ctxdata.messages = xml.collect_texts(ctxdata.xmldata,"ctx:message",true) - ctxdata.flags = ctxrunner.reflag(ctxdata.flags) + ctxdata.flags = ctxrunner.reflag(ctxdata.flags) - local messages = ctxdata.messages - for i=1,#messages do - logs.simple("ctx comment: %s", xml.tostring(messages[i])) - end + local messages = ctxdata.messages + for i=1,#messages do + report("ctx comment: %s", xml.tostring(messages[i])) + end - for r, d, k in xml.elements(ctxdata.xmldata,"ctx:value[@name='job']") do - d[k] = ctxdata.variables['job'] or "" - end + for r, d, k in xml.elements(ctxdata.xmldata,"ctx:value[@name='job']") do + d[k] = ctxdata.variables['job'] or "" + end - local commands = { } - for e in xml.collected(ctxdata.xmldata,"/ctx:job/ctx:preprocess/ctx:processors/ctx:processor") do - commands[e.at and e.at['name'] or "unknown"] = e - end + local commands = { } + for e in xml.collected(ctxdata.xmldata,"/ctx:job/ctx:preprocess/ctx:processors/ctx:processor") do + commands[e.at and e.at['name'] or "unknown"] = e + end - local suffix = xml.filter(ctxdata.xmldata,"/ctx:job/ctx:preprocess/attribute('suffix')") or ctxdata.suffix - local runlocal = xml.filter(ctxdata.xmldata,"/ctx:job/ctx:preprocess/ctx:processors/attribute('local')") + local suffix = xml.filter(ctxdata.xmldata,"/ctx:job/ctx:preprocess/attribute('suffix')") or ctxdata.suffix + local runlocal = xml.filter(ctxdata.xmldata,"/ctx:job/ctx:preprocess/ctx:processors/attribute('local')") - runlocal = toboolean(runlocal) + runlocal = toboolean(runlocal) - for files in xml.collected(ctxdata.xmldata,"/ctx:job/ctx:preprocess/ctx:files") do - for pattern in xml.collected(files,"ctx:file") do + for files in xml.collected(ctxdata.xmldata,"/ctx:job/ctx:preprocess/ctx:files") do + for pattern in xml.collected(files,"ctx:file") do - preprocessor = pattern.at['processor'] or "" + preprocessor = pattern.at['processor'] or "" - if preprocessor ~= "" then + if preprocessor ~= "" then - ctxdata.variables['old'] = ctxdata.jobname - for r, d, k in xml.elements(ctxdata.xmldata,"ctx:value") do - local ek = d[k] - local ekat = ek.at['name'] - if ekat == 'old' then - d[k] = ctxrunner.substitute(ctxdata.variables[ekat] or "") - end + ctxdata.variables['old'] = ctxdata.jobname + for r, d, k in xml.elements(ctxdata.xmldata,"ctx:value") do + local ek = d[k] + local ekat = ek.at['name'] + if ekat == 'old' then + d[k] = ctxrunner.substitute(ctxdata.variables[ekat] or "") end + end - pattern = ctxrunner.justtext(xml.tostring(pattern)) + pattern = ctxrunner.justtext(xml.tostring(pattern)) - local oldfiles = dir.glob(pattern) + local oldfiles = dir.glob(pattern) - local pluspath = false - if #oldfiles == 0 then - -- message: no files match pattern - local paths = ctxdata.paths - for i=1,#paths do - local p = paths[i] - local oldfiles = dir.glob(path.join(p,pattern)) - if #oldfiles > 0 then - pluspath = true - break - end + local pluspath = false + if #oldfiles == 0 then + -- message: no files match pattern + local paths = ctxdata.paths + for i=1,#paths do + local p = paths[i] + local oldfiles = dir.glob(path.join(p,pattern)) + if #oldfiles > 0 then + pluspath = true + break end end - if #oldfiles == 0 then - -- message: no old files - else - for i=1,#oldfiles do - local oldfile = oldfiles[i] - local newfile = oldfile .. "." .. suffix -- addsuffix will add one only - if ctxdata.runlocal then - newfile = file.basename(newfile) - end - if oldfile ~= newfile and file.needsupdate(oldfile,newfile) then - -- message: oldfile needs preprocessing - -- os.remove(newfile) - local splitted = preprocessor:split(',') - for i=1,#splitted do - local pp = splitted[i] - local command = commands[pp] - if command then - command = xml.copy(command) - local suf = (command.at and command.at['suffix']) or ctxdata.suffix - if suf then - newfile = oldfile .. "." .. suf - end - if ctxdata.runlocal then - newfile = file.basename(newfile) - end - for r, d, k in xml.elements(command,"ctx:old") do - d[k] = ctxrunner.substitute(oldfile) - end - for r, d, k in xml.elements(command,"ctx:new") do - d[k] = ctxrunner.substitute(newfile) - end - ctxdata.variables['old'] = oldfile - ctxdata.variables['new'] = newfile - for r, d, k in xml.elements(command,"ctx:value") do - local ek = d[k] - local ekat = ek.at and ek.at['name'] - if ekat then - d[k] = ctxrunner.substitute(ctxdata.variables[ekat] or "") - end - end - -- potential optimization: when mtxrun run internal - command = xml.content(command) - command = ctxrunner.justtext(command) - logs.simple("command: %s",command) - local result = os.spawn(command) or 0 - -- somehow we get the wrong return value - if result > 0 then - logs.simple("error, return code: %s",result) - end - if ctxdata.runlocal then - oldfile = file.basename(oldfile) + end + if #oldfiles == 0 then + -- message: no old files + else + for i=1,#oldfiles do + local oldfile = oldfiles[i] + local newfile = oldfile .. "." .. suffix -- addsuffix will add one only + if ctxdata.runlocal then + newfile = file.basename(newfile) + end + if oldfile ~= newfile and file.needsupdate(oldfile,newfile) then + -- message: oldfile needs preprocessing + -- os.remove(newfile) + local splitted = preprocessor:split(',') + for i=1,#splitted do + local pp = splitted[i] + local command = commands[pp] + if command then + command = xml.copy(command) + local suf = (command.at and command.at['suffix']) or ctxdata.suffix + if suf then + newfile = oldfile .. "." .. suf + end + if ctxdata.runlocal then + newfile = file.basename(newfile) + end + for r, d, k in xml.elements(command,"ctx:old") do + d[k] = ctxrunner.substitute(oldfile) + end + for r, d, k in xml.elements(command,"ctx:new") do + d[k] = ctxrunner.substitute(newfile) + end + ctxdata.variables['old'] = oldfile + ctxdata.variables['new'] = newfile + for r, d, k in xml.elements(command,"ctx:value") do + local ek = d[k] + local ekat = ek.at and ek.at['name'] + if ekat then + d[k] = ctxrunner.substitute(ctxdata.variables[ekat] or "") end end + -- potential optimization: when mtxrun run internal + command = xml.content(command) + command = ctxrunner.justtext(command) + report("command: %s",command) + local result = os.spawn(command) or 0 + -- somehow we get the wrong return value + if result > 0 then + report("error, return code: %s",result) + end + if ctxdata.runlocal then + oldfile = file.basename(oldfile) + end end - if lfs.isfile(newfile) then - file.syncmtimes(oldfile,newfile) - ctxdata.prepfiles[oldfile] = true - else - logs.simple("error, check target location of new file: %s", newfile) - ctxdata.prepfiles[oldfile] = false - end + end + if lfs.isfile(newfile) then + file.syncmtimes(oldfile,newfile) + ctxdata.prepfiles[oldfile] = true else - logs.simple("old file needs no preprocessing") - ctxdata.prepfiles[oldfile] = lfs.isfile(newfile) + report("error, check target location of new file: %s", newfile) + ctxdata.prepfiles[oldfile] = false end + else + report("old file needs no preprocessing") + ctxdata.prepfiles[oldfile] = lfs.isfile(newfile) end end end end end + end - ctxrunner.savelog(ctxdata) + ctxrunner.savelog(ctxdata) - end +end - function ctxrunner.preppedfile(ctxdata,filename) - if ctxdata.prepfiles[file.basename(filename)] then - return filename .. ".prep" - else - return filename - end +function ctxrunner.preppedfile(ctxdata,filename) + if ctxdata.prepfiles[file.basename(filename)] then + return filename .. ".prep" + else + return filename end - end -- rest @@ -388,14 +475,6 @@ function scripts.context.multipass.changed(oldhash, newhash) return false end -scripts.context.backends = { - pdftex = 'pdftex', - luatex = 'pdftex', - pdf = 'pdftex', - dvi = 'dvipdfmx', - dvips = 'dvips' -} - function scripts.context.multipass.makeoptionfile(jobname,ctxdata,kindofrun,currentrun,finalrun) -- take jobname from ctx jobname = file.removesuffix(jobname) @@ -404,62 +483,51 @@ function scripts.context.multipass.makeoptionfile(jobname,ctxdata,kindofrun,curr local function someflag(flag) return (ctxdata and ctxdata.flags[flag]) or environment.argument(flag) end - local function setvalue(flag,format,hash,default) + local function setvalue(flag,template,hash,default) local a = someflag(flag) or default if a and a ~= "" then if hash then if hash[a] then - f:write(format:format(a),"\n") + f:write(format(template,a),"\n") end else - f:write(format:format(a),"\n") + f:write(format(template,a),"\n") end end end - local function setvalues(flag,format,plural) + local function setvalues(flag,template,plural) if type(flag) == "table" then for k, v in next, flag do - f:write(format:format(v),"\n") + f:write(format(template,v),"\n") end else local a = someflag(flag) or (plural and someflag(flag.."s")) if a and a ~= "" then - for v in a:gmatch("%s*([^,]+)") do - f:write(format:format(v),"\n") + for v in gmatch(a,"%s*([^,]+)") do + f:write(format(template,v),"\n") end end end end - local function setfixed(flag,format,...) + local function setfixed(flag,template,...) if someflag(flag) then - f:write(format:format(...),"\n") + f:write(format(template,...),"\n") end end - local function setalways(format,...) - f:write(format:format(...),"\n") + local function setalways(template,...) + f:write(format(template,...),"\n") end -- + -- This might change ... we can just pass the relevant flags directly. + -- setalways("%% runtime options files (command line driven)") -- setalways("\\unprotect") -- - setalways("%% special commands, mostly for the ctx development team") - -- - if environment.argument("dumpdelta") then - setalways("\\tracersdumpdelta") - elseif environment.argument("dumphash") then - setalways("\\tracersdumphash") - end setalways("%% feedback and basic job control") - if type(environment.argument("track")) == "string" then - setvalue ("track" , "\\enabletrackers[%s]") - end - if type(environment.argument("trackers")) == "string" then - setvalue ("trackers" , "\\enabletrackers[%s]") - end - if type(environment.argument("directives")) == "string" then - setvalue ("directives", "\\enabledirectives[%s]") - end + -- + -- Option file, we can pass more on the commandline some day soon. + -- setfixed ("timing" , "\\usemodule[timing]") setfixed ("batchmode" , "\\batchmode") setfixed ("batch" , "\\batchmode") @@ -479,11 +547,9 @@ function scripts.context.multipass.makeoptionfile(jobname,ctxdata,kindofrun,curr -- setalways("%% process info") -- - -- setvalue ("inputfile" , "\\setupsystem[inputfile=%s]") setalways( "\\setupsystem[inputfile=%s]",environment.argument("input") or environment.files[1] or "\\jobname") setvalue ("result" , "\\setupsystem[file=%s]") setalways( "\\setupsystem[\\c!n=%s,\\c!m=%s]", kindofrun or 0, currentrun or 0) - -- setalways( "\\setupsystem[\\c!type=%s]",os.type) -- windows or unix setvalues("path" , "\\usepath[%s]") setvalue ("setuppath" , "\\setupsystem[\\c!directory={%s}]") setvalue ("randomseed" , "\\setupsystem[\\c!random=%s]") @@ -498,7 +564,6 @@ function scripts.context.multipass.makeoptionfile(jobname,ctxdata,kindofrun,curr setalways("%% options (not that important)") -- setalways("\\startsetups *runtime:options") - setvalue ('output' , "\\setupoutput[%s]", scripts.context.backends, 'pdftex') setfixed ("color" , "\\setupcolors[\\c!state=\\v!start]") setvalue ("separation" , "\\setupcolors[\\c!split=%s]") setfixed ("noarrange" , "\\setuparranging[\\v!disable]") @@ -510,7 +575,6 @@ function scripts.context.multipass.makeoptionfile(jobname,ctxdata,kindofrun,curr setalways("%% styles and modules") -- setalways("\\startsetups *runtime:modules") - setvalues("filter" , "\\useXMLfilter[%s]", true) setvalues("usemodule" , "\\usemodule[%s]", true) setvalues("environment" , "\\environment %s ", true) if ctxdata then @@ -527,7 +591,6 @@ function scripts.context.multipass.makeoptionfile(jobname,ctxdata,kindofrun,curr end function scripts.context.multipass.copyluafile(jobname) --- io.savedata(jobname..".tuc",io.loaddata(jobname..".tua") or "") local tuaname, tucname = jobname..".tua", jobname..".tuc" if lfs.isfile(tuaname) then os.remove(tucname) @@ -535,28 +598,6 @@ function scripts.context.multipass.copyluafile(jobname) end end --- obsolete: --- --- function scripts.context.multipass.copytuifile(jobname) --- local tuiname, tuoname = jobname .. ".tui", jobname .. ".tuo" --- if lfs.isfile(tuiname) then --- local f, g = io.open(tuiname), io.open(tuoname,'w') --- if f and g then --- g:write("% traditional utility file, only commands written by mtxrun/context\n%\n") --- for line in f:lines() do --- if line:find("^c ") then --- g:write((line:gsub("^c ","")),"%\n") --- end --- end --- g:write("\\endinput\n") --- f:close() --- g:close() --- end --- else --- -- os.remove(tuoname) --- end --- end - scripts.context.cldsuffixes = table.tohash { "cld", } @@ -591,20 +632,20 @@ scripts.context.interfaces = { scripts.context.defaultformats = { "cont-en", "cont-nl", - "mptopdf", --- "metatex", - "metafun", +-- "mptopdf", -- todo: mak emkiv variant +-- "metatex", -- will show up soon +-- "metafun", -- todo: mp formats -- "plain" } -local function analyze(filename) +local function analyze(filename) -- only files on current path local f = io.open(file.addsuffix(filename,"tex")) if f then local t = { } local line = f:read("*line") or "" - local preamble = line:match("[\254\255]*%%%s+(.+)$") -- there can be an utf bomb in front + local preamble = match(line,"[\254\255]*%%%s+(.+)$") -- there can be an utf bomb in front if preamble then - for key, value in preamble:gmatch("(%S+)=(%S+)") do + for key, value in gmatch(preamble,"(%S+)=(%S+)") do t[key] = value end t.type = "tex" @@ -623,13 +664,17 @@ local function analyze(filename) return nil end -local function makestub(format,filename,prepname) +local function makestub(wrap,template,filename,prepname) local stubname = file.replacesuffix(file.basename(filename),'run') local f = io.open(stubname,'w') if f then - f:write("\\starttext\n") - f:write(string.format(format,prepname or filename),"\n") - f:write("\\stoptext\n") + if wrap then + f:write("\\starttext\n") + end + f:write(format(template,prepname or filename),"\n") + if wrap then + f:write("\\stoptext\n") + end f:close() filename = stubname end @@ -637,22 +682,24 @@ local function makestub(format,filename,prepname) end --~ function scripts.context.openpdf(name) ---~ os.spawn(string.format('pdfopen --file "%s" 2>&1', file.replacesuffix(name,"pdf"))) +--~ os.spawn(format('pdfopen --file "%s" 2>&1', file.replacesuffix(name,"pdf"))) --~ end --~ function scripts.context.closepdf(name) ---~ os.spawn(string.format('pdfclose --file "%s" 2>&1', file.replacesuffix(name,"pdf"))) +--~ os.spawn(format('pdfclose --file "%s" 2>&1', file.replacesuffix(name,"pdf"))) --~ end local pdfview -- delayed loading -function scripts.context.openpdf(name) - pdfview = pdfview or dofile(resolvers.find_file("l-pdfview.lua","tex")) - logs.simple("pdfview methods: %s, current method: %s, MTX_PDFVIEW_METHOD=%s",pdfview.methods(),pdfview.method,os.getenv(pdfview.METHOD) or "") +function scripts.context.openpdf(name,method) + pdfview = pdfview or dofile(resolvers.findfile("l-pdfview.lua","tex")) + pdfview.setmethod(method) + report(pdfview.status()) pdfview.open(file.replacesuffix(name,"pdf")) end -function scripts.context.closepdf(name) - pdfview = pdfview or dofile(resolvers.find_file("l-pdfview.lua","tex")) +function scripts.context.closepdf(name,method) + pdfview = pdfview or dofile(resolvers.findfile("l-pdfview.lua","tex")) + pdfview.setmethod(method) pdfview.close(file.replacesuffix(name,"pdf")) end @@ -672,13 +719,12 @@ function scripts.context.run(ctxdata,filename) interface = (type(interface) == "string" and interface) or "en" -- local formatname = scripts.context.interfaces[interface] or "cont-en" - local formatfile, scriptfile = resolvers.locate_format(formatname) + local formatfile, scriptfile = resolvers.locateformat(formatname) -- this catches the command line if not formatfile or not scriptfile then - logs.simple("warning: no format found, forcing remake (commandline driven)") - scripts.context.generate() + report("warning: no format found, forcing remake (commandline driven)") scripts.context.make(formatname) - formatfile, scriptfile = resolvers.locate_format(formatname) + formatfile, scriptfile = resolvers.locateformat(formatname) end -- if formatfile and scriptfile then @@ -686,7 +732,7 @@ function scripts.context.run(ctxdata,filename) local filename = files[i] local basename, pathname = file.basename(filename), file.dirname(filename) local jobname = file.removesuffix(basename) - if pathname == "" then + if pathname == "" and not environment.argument("global") then filename = "./" .. filename end -- look at the first line @@ -698,24 +744,34 @@ function scripts.context.run(ctxdata,filename) -- -- require "mtx-texutil.lua" else - local texexec = resolvers.find_file("texexec.rb") or "" + local texexec = resolvers.findfile("texexec.rb") or "" if texexec ~= "" then os.setenv("RUBYOPT","") - local command = string.format("ruby %s %s",texexec,environment.reconstruct_commandline(environment.arguments_after)) - os.exec(command) + local options = environment.reconstructcommandline(environment.arguments_after) + options = gsub(options,"--purge","") + options = gsub(options,"--purgeall","") + local command = format("ruby %s %s",texexec,options) + if environment.argument("purge") then + os.execute(command) + scripts.context.purge_job(filename,false,true) + elseif environment.argument("purgeall") then + os.execute(command) + scripts.context.purge_job(filename,true,true) + else + os.exec(command) + end end end else if a and a.interface and a.interface ~= interface then formatname = scripts.context.interfaces[a.interface] or formatname - formatfile, scriptfile = resolvers.locate_format(formatname) + formatfile, scriptfile = resolvers.locateformat(formatname) end -- this catches the command line if not formatfile or not scriptfile then - logs.simple("warning: no format found, forcing remake (source driven)") - scripts.context.generate() + report("warning: no format found, forcing remake (source driven)") scripts.context.make(formatname) - formatfile, scriptfile = resolvers.locate_format(formatname) + formatfile, scriptfile = resolvers.locateformat(formatname) end if formatfile and scriptfile then -- we default to mkiv xml ! @@ -723,17 +779,18 @@ function scripts.context.run(ctxdata,filename) local suffix = file.extname(filename) or "?" if scripts.context.xmlsuffixes[suffix] or environment.argument("forcexml") then if environment.argument("mkii") then - filename = makestub("\\processXMLfilegrouped{%s}",filename) + filename = makestub(true,"\\processXMLfilegrouped{%s}",filename) else - filename = makestub("\\xmlprocess{\\xmldocument}{%s}{}",filename) + filename = makestub(true,"\\xmlprocess{\\xmldocument}{%s}{}",filename) end elseif scripts.context.cldsuffixes[suffix] or environment.argument("forcecld") then - filename = makestub("\\ctxlua{context.runfile('%s')}",filename) + -- self contained cld files need to have a starttext/stoptext (less fontloading) + filename = makestub(false,"\\ctxlua{context.runfile('%s')}",filename) elseif scripts.context.luasuffixes[suffix] or environment.argument("forcelua") then - filename = makestub("\\ctxlua{dofile('%s')}",filename) + filename = makestub(true,"\\ctxlua{dofile('%s')}",filename) elseif environment.argument("prep") then -- we need to keep the original jobname - filename = makestub("\\readfile{%s}{}{}",filename,ctxrunner.preppedfile(ctxdata,filename)) + filename = makestub(true,"\\readfile{%s}{}{}",filename,ctxrunner.preppedfile(ctxdata,filename)) end -- -- todo: also other stubs @@ -747,14 +804,23 @@ function scripts.context.run(ctxdata,filename) oldbase = file.removesuffix(jobname) newbase = file.removesuffix(resultname) if oldbase ~= newbase then - for _, suffix in next, scripts.context.beforesuffixes do - local oldname = file.addsuffix(oldbase,suffix) - local newname = file.addsuffix(newbase,suffix) - local tmpname = "keep-"..oldname - os.remove(tmpname) - os.rename(oldname,tmpname) - os.remove(oldname) - os.rename(newname,oldname) + if environment.argument("purgeresult") then + for _, suffix in next, scripts.context.aftersuffixes do + local oldname = file.addsuffix(oldbase,suffix) + local newname = file.addsuffix(newbase,suffix) + os.remove(newname) + os.remove(oldname) + end + else + for _, suffix in next, scripts.context.beforesuffixes do + local oldname = file.addsuffix(oldbase,suffix) + local newname = file.addsuffix(newbase,suffix) + local tmpname = "keep-"..oldname + os.remove(tmpname) + os.rename(oldname,tmpname) + os.remove(oldname) + os.rename(newname,oldname) + end end else resultname = nil @@ -763,17 +829,17 @@ function scripts.context.run(ctxdata,filename) resultname = nil end -- - if environment.argument("autopdf") then - scripts.context.closepdf(filename) + local pdfview = environment.argument("autopdf") or environment.argument("closepdf") + if pdfview then + scripts.context.closepdf(filename,pdfview) if resultname then - scripts.context.closepdf(resultname) + scripts.context.closepdf(resultname,pdfview) end end -- - local okay = statistics.check_fmt_status(formatfile) + local okay = statistics.checkfmtstatus(formatfile) if okay ~= true then - logs.simple("warning: %s, forcing remake",tostring(okay)) - scripts.context.generate() + report("warning: %s, forcing remake",tostring(okay)) scripts.context.make(formatname) end -- @@ -782,13 +848,57 @@ function scripts.context.run(ctxdata,filename) flags[#flags+1] = "--interaction=batchmode" end if environment.argument("synctex") then - logs.simple("warning: syntex is enabled") -- can add upto 5% runtime + -- this should become a directive + report("warning: synctex is enabled") -- can add upto 5% runtime flags[#flags+1] = "--synctex=1" end - flags[#flags+1] = "--fmt=" .. string.quote(formatfile) - flags[#flags+1] = "--lua=" .. string.quote(scriptfile) - flags[#flags+1] = "--backend=pdf" - local command = string.format("luatex %s %s", table.concat(flags," "), string.quote(filename)) + flags[#flags+1] = "--fmt=" .. quote(formatfile) + flags[#flags+1] = "--lua=" .. quote(scriptfile) + -- + -- We pass these directly. + -- + +--~ local silent = environment.argument("silent") +--~ local noconsole = environment.argument("noconsole") +--~ local directives = environment.argument("directives") +--~ local trackers = environment.argument("trackers") +--~ if silent == true then +--~ silent = "*" +--~ end +--~ if type(silent) == "string" then +--~ if type(directives) == "string" then +--~ directives = format("%s,logs.blocked={%s}",directives,silent) +--~ else +--~ directives = format("logs.blocked={%s}",silent) +--~ end +--~ end +--~ if noconsole then +--~ if type(directives) == "string" then +--~ directives = format("%s,logs.target=file",directives) +--~ else +--~ directives = format("logs.target=file") +--~ end +--~ end + + local directives = environment.directives + local trackers = environment.trackers + local experiments = environment.experiments + + -- + if type(directives) == "string" then + flags[#flags+1] = format('--directives="%s"',directives) + end + if type(trackers) == "string" then + flags[#flags+1] = format('--trackers="%s"',trackers) + end + -- + local backend = environment.argument("backend") + if type(backend) ~= "string" then + backend = "pdf" + end + flags[#flags+1] = format('--backend="%s"',backend) + -- + local command = format("luatex %s %s", concat(flags," "), quote(filename)) local oldhash, newhash = scripts.context.multipass.hashfiles(jobname), { } local once = environment.argument("once") local maxnofruns = (once and 1) or scripts.context.multipass.nofruns @@ -797,23 +907,24 @@ function scripts.context.run(ctxdata,filename) -- 1:first run, 2:successive run, 3:once, 4:last of maxruns local kindofrun = (once and 3) or (i==1 and 1) or (i==maxnofruns and 4) or 2 scripts.context.multipass.makeoptionfile(jobname,ctxdata,kindofrun,i,false) -- kindofrun, currentrun, final - logs.simple("run %s: %s",i,command) + report("run %s: %s",i,command) +--~ print("\n") -- cleaner, else continuation on same line + print("") -- cleaner, else continuation on same line local returncode, errorstring = os.spawn(command) --~ if returncode == 3 then - --~ scripts.context.generate() --~ scripts.context.make(formatname) --~ returncode, errorstring = os.spawn(command) --~ if returncode == 3 then - --~ logs.simple("ks: return code 3, message: %s",errorstring or "?") + --~ report("ks: return code 3, message: %s",errorstring or "?") --~ os.exit(1) --~ end --~ end if not returncode then - logs.simple("fatal error: no return code, message: %s",errorstring or "?") + report("fatal error: no return code, message: %s",errorstring or "?") os.exit(1) break elseif returncode > 0 then - logs.simple("fatal error: return code: %s",returncode or "?") + report("fatal error: return code: %s",returncode or "?") os.exit(returncode) break else @@ -831,13 +942,13 @@ function scripts.context.run(ctxdata,filename) if arrange then local kindofrun = 3 scripts.context.multipass.makeoptionfile(jobname,ctxdata,kindofrun,i,true) -- kindofrun, currentrun, final - logs.simple("arrange run: %s",command) + report("arrange run: %s",command) local returncode, errorstring = os.spawn(command) if not returncode then - logs.simple("fatal error: no return code, message: %s",errorstring or "?") + report("fatal error: no return code, message: %s",errorstring or "?") os.exit(1) elseif returncode > 0 then - logs.simple("fatal error: return code: %s",returncode or "?") + report("fatal error: return code: %s",returncode or "?") os.exit(returncode) end end @@ -851,15 +962,26 @@ function scripts.context.run(ctxdata,filename) os.remove(jobname..".top") -- if resultname then - for _, suffix in next, scripts.context.aftersuffixes do - local oldname = file.addsuffix(oldbase,suffix) - local newname = file.addsuffix(newbase,suffix) - local tmpname = "keep-"..oldname - os.remove(newname) - os.rename(oldname,newname) - os.rename(tmpname,oldname) + if environment.argument("purgeresult") then + -- so, if there is no result then we don't get the old one, but + -- related files (log etc) are still there for tracing purposes + for _, suffix in next, scripts.context.aftersuffixes do + local oldname = file.addsuffix(oldbase,suffix) + local newname = file.addsuffix(newbase,suffix) + os.remove(newname) -- to be sure + os.rename(oldname,newname) + end + else + for _, suffix in next, scripts.context.aftersuffixes do + local oldname = file.addsuffix(oldbase,suffix) + local newname = file.addsuffix(newbase,suffix) + local tmpname = "keep-"..oldname + os.remove(newname) + os.rename(oldname,newname) + os.rename(tmpname,oldname) + end end - logs.simple("result renamed to: %s",newbase) + report("result renamed to: %s",newbase) end -- if environment.argument("purge") then @@ -868,23 +990,24 @@ function scripts.context.run(ctxdata,filename) scripts.context.purge_job(resultname,true) end -- - if environment.argument("autopdf") then - scripts.context.openpdf(resultname or filename) + local pdfview = environment.argument("autopdf") + if pdfview then + scripts.context.openpdf(resultname or filename,pdfview) end -- if environment.argument("timing") then - logs.line() - logs.simple("you can process (timing) statistics with:",jobname) - logs.line() - logs.simple("context --extra=timing '%s'",jobname) - logs.simple("mtxrun --script timing --xhtml [--launch --remove] '%s'",jobname) - logs.line() + report() + report("you can process (timing) statistics with:",jobname) + report() + report("context --extra=timing '%s'",jobname) + report("mtxrun --script timing --xhtml [--launch --remove] '%s'",jobname) + report() end else if formatname then - logs.simple("error, no format found with name: %s, skipping",formatname) + report("error, no format found with name: %s, skipping",formatname) else - logs.simple("error, no format found (provide formatname or interface)") + report("error, no format found (provide formatname or interface)") end break end @@ -892,9 +1015,9 @@ function scripts.context.run(ctxdata,filename) end else if formatname then - logs.simple("error, no format found with name: %s, aborting",formatname) + report("error, no format found with name: %s, aborting",formatname) else - logs.simple("error, no format found (provide formatname or interface)") + report("error, no format found (provide formatname or interface)") end end end @@ -906,37 +1029,35 @@ function scripts.context.pipe() local interface = environment.argument("interface") interface = (type(interface) == "string" and interface) or "en" local formatname = scripts.context.interfaces[interface] or "cont-en" - local formatfile, scriptfile = resolvers.locate_format(formatname) + local formatfile, scriptfile = resolvers.locateformat(formatname) if not formatfile or not scriptfile then - logs.simple("warning: no format found, forcing remake (commandline driven)") - scripts.context.generate() + report("warning: no format found, forcing remake (commandline driven)") scripts.context.make(formatname) - formatfile, scriptfile = resolvers.locate_format(formatname) + formatfile, scriptfile = resolvers.locateformat(formatname) end if formatfile and scriptfile then - local okay = statistics.check_fmt_status(formatfile) + local okay = statistics.checkfmtstatus(formatfile) if okay ~= true then - logs.simple("warning: %s, forcing remake",tostring(okay)) - scripts.context.generate() + report("warning: %s, forcing remake",tostring(okay)) scripts.context.make(formatname) end local flags = { "--interaction=scrollmode", - "--fmt=" .. string.quote(formatfile), - "--lua=" .. string.quote(scriptfile), + "--fmt=" .. quote(formatfile), + "--lua=" .. quote(scriptfile), "--backend=pdf", } local filename = environment.argument("dummyfile") or "" if filename == "" then filename = "\\relax" - logs.simple("entering scrollmode, end job with \\end") + report("entering scrollmode, end job with \\end") else filename = file.addsuffix(filename,"tmp") io.savedata(filename,"\\relax") scripts.context.multipass.makeoptionfile(filename,{ flags = flags },3,1,false) -- kindofrun, currentrun, final - logs.simple("entering scrollmode using '%s' with optionfile, end job with \\end",filename) + report("entering scrollmode using '%s' with optionfile, end job with \\end",filename) end - local command = string.format("luatex %s %s", table.concat(flags," "), string.quote(filename)) + local command = format("luatex %s %s", concat(flags," "), quote(filename)) os.spawn(command) if environment.argument("purge") then scripts.context.purge_job(filename) @@ -946,41 +1067,45 @@ function scripts.context.pipe() end else if formatname then - logs.simple("error, no format found with name: %s, aborting",formatname) + report("error, no format found with name: %s, aborting",formatname) else - logs.simple("error, no format found (provide formatname or interface)") + report("error, no format found (provide formatname or interface)") end end end +local make_mkiv_format = environment.make_format + +local function make_mkii_format(name,engine) + if environment.argument(engine) then + local command = format("mtxrun texexec.rb --make --%s %s",name,engine) + report("running command: %s",command) + os.spawn(command) + end +end + +function scripts.context.generate() + resolvers.instance.renewcache = true + trackers.enable("resolvers.locating") + resolvers.load() +end + function scripts.context.make(name) - local runners = { - "luatools --make --compile ", - (environment.argument("pdftex") and "mtxrun texexec.rb --make --pdftex ") or false, - (environment.argument("xetex") and "mtxrun texexec.rb --make --xetex " ) or false, - } + if not environment.argument("fast") then -- as in texexec + scripts.context.generate() + end local list = (name and { name }) or (environment.files[1] and environment.files) or scripts.context.defaultformats for i=1,#list do local name = list[i] - name = scripts.context.interfaces[name] or name - for i=1,#runners do - local runner = runners[i] - if runner then - local command = runner .. name - logs.simple("running command: %s",command) - os.spawn(command) - end + name = scripts.context.interfaces[name] or name or "" + if name ~= "" then + make_mkiv_format(name) + make_mkii_format(name,"pdftex") + make_mkii_format(name,"xetex") end end end -function scripts.context.generate() - -- hack, should also be a shared function - local command = "luatools --generate " - logs.simple("running command: %s",command) - os.spawn(command) -end - function scripts.context.ctx() local ctxdata = ctxrunner.new() ctxdata.jobname = environment.files[1] @@ -997,7 +1122,7 @@ function scripts.context.autoctx() if f then local chunk = f:read(512) or "" f:close() - local ctxname = string.match(chunk,"<%?context%-directive%s+job%s+ctxfile%s+([^ ]-)%s*?>") + local ctxname = match(chunk,"<%?context%-directive%s+job%s+ctxfile%s+([^ ]-)%s*?>") if ctxname then ctxdata = ctxrunner.new() ctxdata.jobname = firstfile @@ -1023,13 +1148,13 @@ local loaded = false function scripts.context.metapost() local filename = environment.files[1] or "" if not loaded then - dofile(resolvers.find_file("mlib-run.lua")) + dofile(resolvers.findfile("mlib-run.lua")) loaded = true commands = commands or { } - commands.writestatus = logs.report + commands.writestatus = report -- no longer needed end local formatname = environment.argument("format") or "metafun" - if formatname == "" or type(format) == "boolean" then + if formatname == "" or type(formatname) == "boolean" then formatname = "metafun" end if environment.argument("pdf") then @@ -1037,7 +1162,7 @@ function scripts.context.metapost() local resultname = environment.argument("result") or basename local jobname = "mtx-context-metapost" local tempname = file.addsuffix(jobname,"tex") - io.savedata(tempname,string.format(template,"metafun",filename)) + io.savedata(tempname,format(template,"metafun",filename)) environment.files[1] = tempname environment.setargument("result",resultname) environment.setargument("once",true) @@ -1052,22 +1177,22 @@ function scripts.context.metapost() end function scripts.context.version() - local name = resolvers.find_file("context.tex") + local name = resolvers.findfile("context.mkiv") if name ~= "" then - logs.simple("main context file: %s",name) + report("main context file: %s",name) local data = io.loaddata(name) if data then - local version = data:match("\\edef\\contextversion{(.-)}") + local version = match(data,"\\edef\\contextversion{(.-)}") if version then - logs.simple("current version: %s",version) + report("current version: %s",version) else - logs.simple("context version: unknown, no timestamp found") + report("context version: unknown, no timestamp found") end else - logs.simple("context version: unknown, load error") + report("context version: unknown, load error") end else - logs.simple("main context file: unknown, 'context.tex' not found") + report("main context file: unknown, 'context.mkiv' not found") end end @@ -1093,6 +1218,10 @@ local persistent_runfiles = { "tuo", "tub", "top", "tuc" } +local special_runfiles = { + "-mpgraph*", "-mprun*", "-temp-*" +} + local function purge_file(dfile,cfile) if cfile and lfs.isfile(cfile) then if os.remove(dfile) then @@ -1105,31 +1234,38 @@ local function purge_file(dfile,cfile) end end -function scripts.context.purge_job(jobname,all) +local function remove_special_files(pattern) +end + +function scripts.context.purge_job(jobname,all,mkiitoo) if jobname and jobname ~= "" then jobname = file.basename(jobname) local filebase = file.removesuffix(jobname) - local deleted = { } - for i=1,#obsolete_results do - deleted[#deleted+1] = purge_file(filebase.."."..obsolete_results[i],filebase..".pdf") - end - for i=1,#temporary_runfiles do - deleted[#deleted+1] = purge_file(filebase.."."..temporary_runfiles[i]) - end - if all then - for i=1,#persistent_runfiles do - deleted[#deleted+1] = purge_file(filebase.."."..persistent_runfiles[i]) + if mkiitoo then + scripts.context.purge(all,filebase,true) -- leading "./" + else + local deleted = { } + for i=1,#obsolete_results do + deleted[#deleted+1] = purge_file(filebase.."."..obsolete_results[i],filebase..".pdf") + end + for i=1,#temporary_runfiles do + deleted[#deleted+1] = purge_file(filebase.."."..temporary_runfiles[i]) + end + if all then + for i=1,#persistent_runfiles do + deleted[#deleted+1] = purge_file(filebase.."."..persistent_runfiles[i]) + end + end + if #deleted > 0 then + report("purged files: %s", concat(deleted,", ")) end - end - if #deleted > 0 then - logs.simple("purged files: %s", table.join(deleted,", ")) end end end -function scripts.context.purge(all) +function scripts.context.purge(all,pattern,mkiitoo) local all = all or environment.argument("all") - local pattern = environment.argument("pattern") or "*.*" + local pattern = environment.argument("pattern") or (pattern and (pattern.."*")) or "*.*" local files = dir.glob(pattern) local obsolete = table.tohash(obsolete_results) local temporary = table.tohash(temporary_runfiles) @@ -1142,18 +1278,21 @@ function scripts.context.purge(all) local basename = file.basename(name) if obsolete[suffix] or temporary[suffix] or persistent[suffix] or generic[basename] then deleted[#deleted+1] = purge_file(name) + elseif mkiitoo then + for i=1,#special_runfiles do + if find(name,special_runfiles[i]) then + deleted[#deleted+1] = purge_file(name) + end + end end end if #deleted > 0 then - logs.simple("purged files: %s", table.join(deleted,", ")) + report("purged files: %s", concat(deleted,", ")) end end ---~ purge_for_files("test",true) ---~ purge_all_files() - local function touch(name,pattern) - local name = resolvers.find_file(name) + local name = resolvers.findfile(name) local olddata = io.loaddata(name) if olddata then local oldversion, newversion = "", os.date("%Y.%m.%d %H:%M") @@ -1173,20 +1312,78 @@ local function touch(name,pattern) end end +local function touchfiles(suffix) + local done, oldversion, newversion, foundname = touch(file.addsuffix("context",suffix),"(\\edef\\contextversion{)(.-)(})") + if done then + report("old version : %s", oldversion) + report("new version : %s", newversion) + report("touched file: %s", foundname) + local ok, _, _, foundname = touch(file.addsuffix("cont-new",suffix), "(\\newcontextversion{)(.-)(})") + if ok then + report("touched file: %s", foundname) + end + end +end + function scripts.context.touch() if environment.argument("expert") then - local done, oldversion, newversion, foundname = touch("context.tex", "(\\edef\\contextversion{)(.-)(})") - if done then - logs.simple("old version : %s", oldversion) - logs.simple("new version : %s", newversion) - logs.simple("touched file: %s", foundname) - local ok, _, _, foundname = touch("cont-new.tex", "(\\newcontextversion{)(.-)(})") - if ok then - logs.simple("touched file: %s", foundname) - end - local ok, _, _, foundname = touch("cont-xp.tex", "(\\edef\\contextversion{)(.-)(})") - if ok then - logs.simple("touched file: %s", foundname) + touchfiles("mkii") + touchfiles("mkiv") + touchfiles("mkvi") + end +end + +-- modules + +local labels = { "title", "comment", "status" } +local cards = { "*.mkvi", "*.mkiv", "*.tex" } + +function scripts.context.modules(pattern) + local list = { } + local found = resolvers.findfile("context.mkiv") + if not pattern or pattern == "" then + -- official files in the tree + for _, card in ipairs(cards) do + resolvers.findwildcardfiles(card,list) + end + -- my dev path + for _, card in ipairs(cards) do + dir.glob(file.join(file.dirname(found),card),list) + end + else + resolvers.findwildcardfiles(pattern,list) + dir.glob(file.join(file.dirname(found,pattern)),list) + end + local done = { } -- todo : sort + for i=1,#list do + local v = list[i] + local base = file.basename(v) + if not done[base] then + done[base] = true + local suffix = file.suffix(base) + if suffix == "tex" or suffix == "mkiv" or suffix == "mkvi" then + local prefix = match(base,"^([xmst])%-") + if prefix then + v = resolvers.findfile(base) -- so that files on my dev path are seen + local data = io.loaddata(v) or "" + data = match(data,"%% begin info(.-)%% end info") + if data then + local info = { } + for label, text in gmatch(data,"%% +([^ ]+) *: *(.-)[\n\r]") do + info[label] = text + end + report() + report("%-7s : %s","module",base) + report() + for i=1,#labels do + local l = labels[i] + if info[l] then + report("%-7s : %s",l,info[l]) + end + end + report() + end + end end end end @@ -1195,28 +1392,22 @@ end -- extras function scripts.context.extras(pattern) - local found = resolvers.find_file("context.tex") - if found == "" then - logs.simple("unknown extra: %s", extra) - else - pattern = file.join(dir.expand_name(file.dirname(found)),string.format("mtx-context-%s.tex",pattern or "*")) + -- only in base path, i.e. only official ones + local found = resolvers.findfile("context.mkiv") + if found ~= "" then + pattern = file.join(dir.expandname(file.dirname(found)),format("mtx-context-%s.tex",pattern or "*")) local list = dir.glob(pattern) - if not extra or extra == "" then - logs.extendbanner("extras") - else - logs.extendbanner(extra) - end for i=1,#list do local v = list[i] local data = io.loaddata(v) or "" - data = string.match(data,"begin help(.-)end help") + data = match(data,"%% begin help(.-)%% end help") if data then - local h = { string.format("extra: %s (%s)",string.gsub(v,"^.*mtx%-context%-(.-)%.tex$","%1"),v) } - for s in string.gmatch(data,"%% *(.-)[\n\r]") do - h[#h+1] = s + report() + report("extra: %s (%s)",(gsub(v,"^.*mtx%-context%-(.-)%.tex$","%1")),v) + for s in gmatch(data,"%% *(.-)[\n\r]") do + report(s) end - h[#h+1] = "" - logs.help(table.concat(h,"\n"),"nomoreinfo") + report() end end end @@ -1229,15 +1420,15 @@ function scripts.context.extra() scripts.context.extras(extra) else local fullextra = extra - if not string.find(fullextra,"mtx%-context%-") then + if not find(fullextra,"mtx%-context%-") then fullextra = "mtx-context-" .. extra end - local foundextra = resolvers.find_file(fullextra) + local foundextra = resolvers.findfile(fullextra) if foundextra == "" then scripts.context.extras() return else - logs.simple("processing extra: %s", foundextra) + report("processing extra: %s", foundextra) end environment.setargument("purgeall",true) local result = environment.setargument("result") or "" @@ -1254,26 +1445,34 @@ end -- todo: we need to do a dummy run function scripts.context.trackers() - environment.files = { resolvers.find_file("m-trackers.tex") } + environment.files = { resolvers.findfile("m-trackers.mkiv") } scripts.context.multipass.nofruns = 1 + environment.setargument("purgeall",true) scripts.context.run() - -- maybe filter from log end function scripts.context.directives() - environment.files = { resolvers.find_file("m-directives.tex") } + environment.files = { resolvers.findfile("m-directives.mkiv") } scripts.context.multipass.nofruns = 1 + environment.setargument("purgeall",true) + scripts.context.run() +end + +function scripts.context.logcategories() + environment.files = { resolvers.findfile("m-logcategories.mkiv") } + scripts.context.multipass.nofruns = 1 + environment.setargument("purgeall",true) scripts.context.run() - -- maybe filter from log end function scripts.context.timed(action) statistics.timed(action) end -local zipname = "cont-tmf.zip" -local mainzip = "http://www.pragma-ade.com/context/latest/" .. zipname -local validtrees = { "texmf-local", "texmf-context" } +local zipname = "cont-tmf.zip" +local mainzip = "http://www.pragma-ade.com/context/latest/" .. zipname +local validtrees = { "texmf-local", "texmf-context" } +local selfscripts = { "mtxrun.lua" } -- was: { "luatools.lua", "mtxrun.lua" } function zip.loaddata(zipfile,filename) -- should be in zip lib local f = zipfile:open(filename) @@ -1289,19 +1488,19 @@ function scripts.context.update() local force = environment.argument("force") local socket = require("socket") local http = require("socket.http") - local basepath = resolvers.find_file("context.tex") or "" + local basepath = resolvers.findfile("context.mkiv") or "" if basepath == "" then - logs.simple("quiting, no 'context.tex' found") + report("quiting, no 'context.mkiv' found") return end - local basetree = basepath.match(basepath,"^(.-)tex/context/base/context.tex$") or "" + local basetree = basepath.match(basepath,"^(.-)tex/context/base/context.mkiv$") or "" if basetree == "" then - logs.simple("quiting, no proper tds structure (%s)",basepath) + report("quiting, no proper tds structure (%s)",basepath) return end local function is_okay(basetree) for _, tree in next, validtrees do - local pattern = string.gsub(tree,"%-","%%-") + local pattern = gsub(tree,"%-","%%-") if basetree:find(pattern) then return tree end @@ -1310,19 +1509,19 @@ function scripts.context.update() end local okay = is_okay(basetree) if not okay then - logs.simple("quiting, tree '%s' is protected",okay) + report("quiting, tree '%s' is protected",okay) return else - logs.simple("updating tree '%s'",okay) + report("updating tree '%s'",okay) end if not lfs.chdir(basetree) then - logs.simple("quiting, unable to change to '%s'",okay) + report("quiting, unable to change to '%s'",okay) return end - logs.simple("fetching '%s'",mainzip) + report("fetching '%s'",mainzip) local latest = http.request(mainzip) if not latest then - logs.simple("context tree '%s' can be updated, use --force",okay) + report("context tree '%s' can be updated, use --force",okay) return end io.savedata("cont-tmf.zip",latest) @@ -1333,37 +1532,37 @@ function scripts.context.update() -- variant 2 local zipfile = zip.open(zipname) if not zipfile then - logs.simple("quiting, unable to open '%s'",zipname) + report("quiting, unable to open '%s'",zipname) return end - local newfile = zip.loaddata(zipfile,"tex/context/base/context.tex") + local newfile = zip.loaddata(zipfile,"tex/context/base/context.mkiv") if not newfile then - logs.simple("quiting, unable to open '%s'","context.tex") + report("quiting, unable to open '%s'","context.mkiv") return end - local oldfile = io.loaddata(resolvers.find_file("context.tex")) or "" + local oldfile = io.loaddata(resolvers.findfile("context.mkiv")) or "" local function versiontonumber(what,str) - local version = str:match("\\edef\\contextversion{(.-)}") or "" - local year, month, day, hour, minute = str:match("\\edef\\contextversion{(%d+)%.(%d+)%.(%d+) *(%d+)%:(%d+)}") + local version = match(str,"\\edef\\contextversion{(.-)}") or "" + local year, month, day, hour, minute = match(str,"\\edef\\contextversion{(%d+)%.(%d+)%.(%d+) *(%d+)%:(%d+)}") if year and minute then local time = os.time { year=year,month=month,day=day,hour=hour,minute=minute} - logs.simple("%s version: %s (%s)",what,version,time) + report("%s version: %s (%s)",what,version,time) return time else - logs.simple("%s version: %s (unknown)",what,version) + report("%s version: %s (unknown)",what,version) return nil end end local oldversion = versiontonumber("old",oldfile) local newversion = versiontonumber("new",newfile) if not oldversion or not newversion then - logs.simple("quiting, version cannot be determined") + report("quiting, version cannot be determined") return elseif oldversion == newversion then - logs.simple("quiting, your current version is up-to-date") + report("quiting, your current version is up-to-date") return elseif oldversion > newversion then - logs.simple("quiting, your current version is newer") + report("quiting, your current version is newer") return end for k in zipfile:files() do @@ -1376,113 +1575,46 @@ function scripts.context.update() if force then io.savedata(filename,data) end - logs.simple(filename) + report(filename) end end end - for _, scriptname in next, { "luatools.lua", "mtxrun.lua" } do - local oldscript = resolvers.find_file(scriptname) or "" + for _, scriptname in next, selfscripts do + local oldscript = resolvers.findfile(scriptname) or "" if oldscript ~= "" and is_okay(oldscript) then local newscript = "./scripts/context/lua/" .. scriptname local data = io.loaddata(newscript) or "" if data ~= "" then - logs.simple("replacing script '%s' by '%s'",oldscript,newscript) + report("replacing script '%s' by '%s'",oldscript,newscript) if force then io.savedata(oldscript,data) end end else - logs.simple("keeping script '%s'",oldscript) + report("keeping script '%s'",oldscript) end end if force then - os.execute("context --generate") - os.execute("context --make") + scripts.context.make() end end if force then - logs.simple("context tree '%s' has been updated",okay) + report("context tree '%s' has been updated",okay) else - logs.simple("context tree '%s' can been updated (use --force)",okay) + report("context tree '%s' can been updated (use --force)",okay) end end -logs.extendbanner("ConTeXt Process Management 0.51",true) - -messages.help = [[ ---run process (one or more) files (default action) ---make create context formats - ---ctx=name use ctx file (process management specification) ---interface use specified user interface (default: en) - ---autopdf close pdf file in viewer and start pdf viewer afterwards ---purge(all) purge files either or not after a run (--pattern=...) - ---usemodule=list load the given module or style, normally part o fthe distribution ---environment=list load the given environment file first (document styles) ---mode=list enable given the modes (conditional processing in styles) ---path=list also consult the given paths when files are looked for ---arguments=list set variables that can be consulted during a run (key/value pairs) ---randomseed=number set the randomseed ---result=name rename the resulting output to the given name ---trackers=list show/set tracker variables ---directives=list show/set directive variables - ---forcexml force xml stub (optional flag: --mkii) ---forcecld force cld (context lua document) stub - ---arrange run extra imposition pass, given that the style sets up imposition ---noarrange ignore imposition specifications in the style - ---once only run once (no multipass data file is produced) ---batchmode run without stopping and don't show messages on the console ---nonstopmode run without stopping - ---generate generate file database etc. (as luatools does) ---paranoid don't descend to .. and ../.. ---version report installed context version - ---expert expert options -]] - --- filter=list is kind of obsolete --- color is obsolete for mkiv, always on --- separation is obsolete for mkiv, no longer available --- output is currently obsolete for mkiv --- setuppath=list must check --- modefile=name must check --- input=name load the given inputfile (must check) - -messages.expert = [[ -expert options: - ---touch update context version number (remake needed afterwards, also provide --expert) ---nostats omit runtime statistics at the end of the run ---update update context from website (not to be confused with contextgarden) ---profile profile job (use: mtxrun --script profile --analyse) ---timing generate timing and statistics overview ---tracefiles show some extra info when locating files (at the tex end) - ---extra=name process extra (mtx-context- in distribution) ---extras show extras -]] - -messages.private = [[ -private options: - ---dumphash dump hash table afterwards ---dumpdelta dump hash table afterwards (only new entries) -]] - -messages.special = [[ -special options: +do ---pdftex process file with texexec using pdftex ---xetex process file with texexec using xetex + local silent = environment.argument("silent") + if type(silent) == "string" then + directives.enable(format("logs.blocked={%s}",silent)) + elseif silent then + directives.enable("logs.blocked") + end ---pipe don't check for file and enter scroll mode (--dummyfile=whatever.tmp) -]] +end if environment.argument("once") then scripts.context.multipass.nofruns = 1 @@ -1497,15 +1629,10 @@ end if environment.argument("run") then -- scripts.context.timed(scripts.context.run) scripts.context.timed(scripts.context.autoctx) -elseif environment.argument("make") or environment.argument("generate") then - scripts.context.timed(function() - if environment.argument("generate") then - scripts.context.generate() - end - if environment.argument("make") then - scripts.context.make() - end - end) +elseif environment.argument("make") then + scripts.context.timed(function() scripts.context.make() end) +elseif environment.argument("generate") then + scripts.context.timed(function() scripts.context.generate() end) elseif environment.argument("ctx") then scripts.context.timed(scripts.context.ctx) elseif environment.argument("mp") or environment.argument("metapost") then @@ -1517,7 +1644,9 @@ elseif environment.argument("touch") then elseif environment.argument("update") then scripts.context.update() elseif environment.argument("expert") then - logs.help(table.join({ messages.expert, messages.private, messages.special },"\n")) + application.help("expert", "special") +elseif environment.argument("modules") then + scripts.context.modules() elseif environment.argument("extras") then scripts.context.extras() elseif environment.argument("extra") then @@ -1526,12 +1655,14 @@ elseif environment.argument("help") then if environment.files[1] == "extras" then scripts.context.extras() else - logs.help(messages.help) + application.help("basic") end -elseif environment.argument("trackers") and type(environment.argument("trackers")) == "boolean" then +elseif environment.argument("showtrackers") or environment.argument("trackers") == true then scripts.context.trackers() -elseif environment.argument("directives") and type(environment.argument("directives")) == "boolean" then +elseif environment.argument("showdirectives") or environment.argument("directives") == true then scripts.context.directives() +elseif environment.argument("showlogcategories") then + scripts.context.logcategories() elseif environment.argument("track") and type(environment.argument("track")) == "boolean" then -- for old times sake, will go scripts.context.trackers() elseif environment.files[1] then @@ -1546,7 +1677,7 @@ elseif environment.argument("purgeall") then -- only when no filename given, supports --pattern scripts.context.purge(true) else - logs.help(messages.help) + application.help("basic") end if environment.argument("profile") then diff --git a/Master/texmf-dist/scripts/context/lua/mtx-convert.lua b/Master/texmf-dist/scripts/context/lua/mtx-convert.lua index 62198a62188..0c5c01bbfbe 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-convert.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-convert.lua @@ -8,6 +8,23 @@ if not modules then modules = { } end modules ['mtx-convert'] = { -- todo: eps and svg +local helpinfo = [[ +--convertall convert all graphics on path +--inputpath=string original graphics path +--outputpath=string converted graphics path +--watch watch folders +--force force conversion (even if older) +--delay time between sweeps +]] + +local application = logs.application { + name = "mtx-convert", + banner = "ConTeXT Graphic Conversion Helpers 0.10", + helpinfo = helpinfo, +} + +local report = application.report + graphics = graphics or { } graphics.converters = graphics.converters or { } @@ -40,7 +57,7 @@ local function convert(kind,oldname,newname) if graphics.converters[kind] then -- extra test local tmpname = file.replacesuffix(newname,"tmp") local command = graphics.converters[kind](oldname,tmpname) - logs.simple("command: %s",command) + report("command: %s",command) io.flush() os.spawn(command) os.remove(newname) @@ -118,22 +135,10 @@ function scripts.convert.convertgiven() end end - -logs.extendbanner("ConTeXT Graphic Conversion Helpers 0.10",true) - -messages.help = [[ ---convertall convert all graphics on path ---inputpath=string original graphics path ---outputpath=string converted graphics path ---watch watch folders ---force force conversion (even if older) ---delay time between sweeps -]] - if environment.argument("convertall") then scripts.convert.convertall() elseif environment.files[1] then scripts.convert.convertgiven() else - logs.help(messages.help) + application.help() end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-epub.lua b/Master/texmf-dist/scripts/context/lua/mtx-epub.lua new file mode 100644 index 00000000000..70ee7828cee --- /dev/null +++ b/Master/texmf-dist/scripts/context/lua/mtx-epub.lua @@ -0,0 +1,177 @@ +if not modules then modules = { } end modules ['mtx-epub'] = { + version = 1.001, + comment = "companion to mtxrun.lua", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- The epub specification is far from beautiful. Especially the id related +-- part is messy and devices/programs react differently on them (so an id is not +-- really an id but has some special property). Then there is this ncx suffix +-- thing. Somehow it give the impression of a reversed engineered application +-- format so it will probably take a few cycles to let it become a real +-- clean standard. Thanks to Adam Reviczky for helping to figure out all these +-- puzzling details. + +-- This is preliminary code. At some point we will deal with images as well but +-- first we need a decent strategy to export them. More information will be +-- available on the wiki. + +local format = string.format +local concat = table.concat + +local helpinfo = [[ +--make create epub zip file + +example: + +mtxrun --script epub --make mydocument +]] + +local application = logs.application { + name = "mtx-epub", + banner = "ConTeXt EPUB Helpers 0.11", + helpinfo = helpinfo, +} + +-- script code + +scripts = scripts or { } +scripts.epub = scripts.epub or { } + +local mimetype = "application/epub+zip" + +local container = [[ + + + + + + + +]] + +local package = [[ + + + + + + My Title + en + + MySelf + + + + %s + + + + + + + +]] + +-- We need to figure out what is permitted; numbers only seem to give +-- problems is some applications as do names with dashes. + +local function dumbid(filename) + -- return (string.gsub(os.uuid(),"%-%","")) -- to be tested + return file.nameonly(filename) +end + +local mimetypes = { + xhtml = "application/xhtml+xml", + css = "text/css", + -- default = "text/plain", +} + +local idmakers = { + ncx = function(filename) return "ncx" end, + -- css = function(filename) return "stylesheet" end, + default = function(filename) return dubmid(filename) end, +} + +-- specification = { +-- name = "document", +-- identifier = "123", +-- root = "a.xhtml", +-- files = { +-- "a.xhtml", +-- "b.css", +-- "c.png", +-- } +-- } + +function scripts.epub.make() + + local filename = environment.files[1] + + if filename and filename ~= "" then + + filename = file.basename(filename) + local specfile = file.replacesuffix(filename,"specification") + local specification = lfs.isfile(specfile) and dofile(specfile) or { } + + -- inspect(specification) + + local name = specification.name or file.removesuffix(filename) + local identifier = specification.identifier or os.uuid() + local files = specification.files or { file.addsuffix(filename,"xhtml") } + local root = specification.root or files[1] + + local epubname = name + local epubpath = file.replacesuffix(name,"tree") + local epubfile = file.replacesuffix(name,"epub") + local epubroot = file.replacesuffix(name,"opf") + + lfs.mkdir(epubpath) + lfs.mkdir(file.join(epubpath,"META-INF")) + lfs.mkdir(file.join(epubpath,"OPS")) + + local used = { } + + for i=1,#files do + local filename = files[i] + local suffix = file.suffix(filename) + local mime = mimetypes[suffix] + if mime then + local idmaker = idmakers[suffix] or idmakers.default + file.copy(filename,file.join(epubpath,"OPS",filename)) + used[#used+1] = format("",idmaker(filename),filename,mime) + end + end + + container = format(container,epubroot) + package = format(package,identifier,identifier,concat(used,"\n"),file.removesuffix(root)) + + io.savedata(file.join(epubpath,"mimetype"),mimetype) + io.savedata(file.join(epubpath,"META-INF","container.xml"),container) + io.savedata(file.join(epubpath,"OPS",epubroot),package) + + lfs.chdir(epubpath) + + os.remove(epubfile) + + os.execute(format("zip %s -0 %s",epubfile,"mimetype")) + os.execute(format("zip %s -r %s",epubfile,"META-INF")) + os.execute(format("zip %s -r %s",epubfile,"OPS")) + + lfs.chdir("..") + + application.report("epub archive: %s",file.join(epubpath,epubfile)) + + end + +end + +-- + +if environment.argument("make") then + scripts.epub.make() +else + application.help() +end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-flac.lua b/Master/texmf-dist/scripts/context/lua/mtx-flac.lua new file mode 100644 index 00000000000..37f985654a3 --- /dev/null +++ b/Master/texmf-dist/scripts/context/lua/mtx-flac.lua @@ -0,0 +1,216 @@ +if not modules then modules = { } end modules ['mtx-flac'] = { + version = 1.001, + comment = "companion to mtxrun.lua", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- Written with Within Temptation's "The Unforgiven" in loopmode on +-- the speakers. The following code is also used for my occasional music +-- repository cleanup session using the code below. + +-- this can become l-flac.lua + +local sub, match, byte, lower = string.sub, string.match, string.byte, string.lower +local readstring, readnumber = io.readstring, io.readnumber +local concat = table.concat +local tonumber = tonumber +local tobitstring = number.tobitstring + +flac = flac or { } + +flac.report = string.format + +local splitter = lpeg.splitat("=") +local readers = { } + +readers[0] = function(f,size,target) -- not yet ok + local info = { } + target.info = info + info.minimum_block_size = readnumber(f,-2) + info.maximum_block_size = readnumber(f,-2) + info.minimum_frame_size = readnumber(f,-3) + info.maximum_frame_size = readnumber(f,-3) + local buffer = { } + for i=1,8 do + buffer[i] = tobitstring(readnumber(f,1)) + end + local bytes = concat(buffer) + info.sample_rate_in_hz = tonumber(sub(bytes, 1,20),2) -- 20 + info.number_of_channels = tonumber(sub(bytes,21,23),2) -- 3 + info.bits_per_sample = tonumber(sub(bytes,24,28),2) -- 5 + info.samples_in_stream = tonumber(sub(bytes,29,64),2) -- 36 + info.md5_signature = readstring(f,16) -- 128 +end + +readers[4] = function(f,size,target,banner) + local tags = { } + target.tags = tags + target.vendor = readstring(f,readnumber(f,-4)) + for i=1,readnumber(f,-4) do + local key, value = lpeg.match(splitter,readstring(f,readnumber(f,-4))) + tags[lower(key)] = value + end +end + +readers.default = function(f,size,target) + f:seek("cur",size) +end + +function flac.getmetadata(filename) + local f = io.open(filename, "rb") + if f then + local banner = readstring(f,4) + if banner == "fLaC" then + local data = { + banner = banner, + filename = filename, + filesize = lfs.attributes(filename,"size"), + } + while true do + local flag = readnumber(f,1) + local size = readnumber(f,3) + local last = flag > 127 + if last then + flag = flag - 128 + end + local reader = readers[flag] or readers.default + reader(f,size,data,banner) + if last then + return data + end + end + else + flac.report("no flac file: %s (%s)",filename,banner) + end + f:close() + else + flac.report("no file: %s",filename) + end +end + +function flac.savecollection(pattern,filename) + pattern = (pattern ~= "" and pattern) or "**/*.flac" + filename = (filename ~= "" and filename) or "music-collection.xml" + flac.report("identifying files using pattern %q" ,pattern) + local files = dir.glob(pattern) + flac.report("%s files found, analyzing files",#files) + local music = { } + for i=1,#files do + local data = flac.getmetadata(files[i]) + if data then + local tags = data.tags + local info = data.info + local artist = tags.artist + local album = tags.album + local albums = music[artist] + if not albums then + albums = { } + music[artist] = albums + end + local albumx = albums[album] + if not albumx then + albumx = { + year = tags.date, + tracks = { }, + } + albums[album] = albumx + end + albumx.tracks[tonumber(tags.tracknumber) or 0] = { + title = tags.title, + length = math.round((info.samples_in_stream/info.sample_rate_in_hz)), + } + end + end + -- inspect(music) + local nofartists, nofalbums, noftracks, noferrors = 0, 0, 0, 0 + local f = io.open(filename,"wb") + if f then + f:write("\n\n") + f:write("\n") + for artist, albums in table.sortedpairs(music) do + nofartists = nofartists + 1 + f:write("\t\n") + f:write("\t\t" .. artist .. "\n") + f:write("\t\t\n") + for album, data in table.sortedpairs(albums) do + nofalbums = nofalbums + 1 + f:write("\t\t\t\n") + f:write("\t\t\t\t" .. album .. "\n") + f:write("\t\t\t\t\n") + local tracks = data.tracks + for i=1,#tracks do + local track = tracks[i] + if track then + noftracks = noftracks + 1 + f:write("\t\t\t\t\t" .. track.title .. "\n") + else + noferrors = noferrors + 1 + flac.report("error in album: %q of artist",album,artist) + f:write("\t\t\t\t\t\n") + end + end + f:write("\t\t\t\t\n") + f:write("\t\t\t\n") + end + f:write("\t\t\n") + f:write("\t\n") + end + f:write("\n") + end + f:close() + flac.report("%s tracks of %s albums of %s artists saved in %q (%s errors)",noftracks,nofalbums,nofartists,filename,noferrors) +end + +-- + +local helpinfo = [[ +--collect collect albums in xml file + +example: + +mtxrun --script flac --collect somename.flac +mtxrun --script flac --collect --pattern="m:/music/**") +]] + +local application = logs.application { + name = "mtx-flac", + banner = "ConTeXt Flac Helpers 0.10", + helpinfo = helpinfo, +} + +flac.report = application.report + +-- script code + +scripts = scripts or { } +scripts.flac = scripts.flac or { } + +function scripts.flac.collect() + local files = environment.files + local pattern = environment.arguments.pattern + if #files > 0 then + for i=1,#files do + local filename = files[1] + if file.suffix(filename) == "flac" then + flac.savecollection(filename,file.replacesuffix(filename,"xml")) + elseif lfs.isdir(filename) then + local pattern = filename .. "/**.flac" + flac.savecollection(pattern,file.addsuffix(file.basename(filename),"xml")) + else + flac.savecollection(file.replacesuffix(filename,"flac"),file.replacesuffix(filename,"xml")) + end + end + elseif pattern then + flac.savecollection(file.addsuffix(pattern,"flac"),"music-collection.xml") + else + flac.report("no file(s) or pattern given" ) + end +end + +if environment.argument("collect") then + scripts.flac.collect() +else + application.help() +end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-fonts.lua b/Master/texmf-dist/scripts/context/lua/mtx-fonts.lua index 74012ae38d3..8c8f47a70ab 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-fonts.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-fonts.lua @@ -6,22 +6,107 @@ if not modules then modules = { } end modules ['mtx-fonts'] = { license = "see context related readme files" } +local helpinfo = [[ +--save save open type font in raw table + +--reload generate new font database +--reload --simple generate 'luatex-fonts-names.lua' (not for context!) + +--list --name list installed fonts, filter by name [--pattern] +--list --spec list installed fonts, filter by spec [--filter] +--list --file list installed fonts, filter by file [--pattern] + +--pattern=str filter files using pattern +--filter=list key-value pairs +--all show all found instances +--info give more details +--track=list enable trackers +--statistics some info about the database + +examples of searches: + +mtxrun --script font --list somename (== --pattern=*somename*) + +mtxrun --script font --list --name somename +mtxrun --script font --list --name --pattern=*somename* + +mtxrun --script font --list --spec somename +mtxrun --script font --list --spec somename-bold-italic +mtxrun --script font --list --spec --pattern=*somename* +mtxrun --script font --list --spec --filter="fontname=somename" +mtxrun --script font --list --spec --filter="familyname=somename,weight=bold,style=italic,width=condensed" +mtxrun --script font --list --spec --filter="familyname=crap*,weight=bold,style=italic" + +mtxrun --script font --list --file somename +mtxrun --script font --list --file --pattern=*somename* +]] + +local application = logs.application { + name = "mtx-fonts", + banner = "ConTeXt Font Database Management 0.21", + helpinfo = helpinfo, +} + +local report = application.report + +-- todo: fc-cache -v en check dirs, or better is: fc-cat -v | grep Directory + if not fontloader then fontloader = fontforge end -dofile(resolvers.find_file("font-otp.lua","tex")) -dofile(resolvers.find_file("font-syn.lua","tex")) -dofile(resolvers.find_file("font-mis.lua","tex")) +dofile(resolvers.findfile("font-otp.lua","tex")) -- we need to unpack the font for analysis +dofile(resolvers.findfile("font-syn.lua","tex")) +dofile(resolvers.findfile("font-mis.lua","tex")) scripts = scripts or { } scripts.fonts = scripts.fonts or { } +function fonts.names.statistics() + fonts.names.load() + + local data = fonts.names.data + local statistics = data.statistics + + local function counted(t) + local n = { } + for k, v in next, t do + n[k] = table.count(v) + end + return table.sequenced(n) + end + + report("cache uuid : %s", data.cache_uuid) + report("cache version : %s", data.cache_version) + report("number of trees : %s", #data.datastate) + report() + report("number of fonts : %s", statistics.fonts or 0) + report("used files : %s", statistics.readfiles or 0) + report("skipped files : %s", statistics.skippedfiles or 0) + report("duplicate files : %s", statistics.duplicatefiles or 0) + report("specifications : %s", #data.specifications) + report("families : %s", table.count(data.families)) + report() + report("mappings : %s", counted(data.mappings)) + report("fallbacks : %s", counted(data.fallbacks)) + report() + report("used styles : %s", table.sequenced(statistics.used_styles)) + report("used variants : %s", table.sequenced(statistics.used_variants)) + report("used weights : %s", table.sequenced(statistics.used_weights)) + report("used widths : %s", table.sequenced(statistics.used_widths)) + report() + report("found styles : %s", table.sequenced(statistics.styles)) + report("found variants : %s", table.sequenced(statistics.variants)) + report("found weights : %s", table.sequenced(statistics.weights)) + report("found widths : %s", table.sequenced(statistics.widths)) + +end + function fonts.names.simple() local simpleversion = 1.001 local simplelist = { "ttf", "otf", "ttc", "dfont" } local name = "luatex-fonts-names.lua" fonts.names.filters.list = simplelist fonts.names.version = simpleversion -- this number is the same as in font-dum.lua - logs.report("fontnames","generating font database for 'luatex-fonts' version %s",fonts.names.version) + report("generating font database for 'luatex-fonts' version %s",fonts.names.version) fonts.names.identify(true) local data = fonts.names.data if data then @@ -38,12 +123,12 @@ function fonts.names.simple() simplemappings[tag] = { s.rawname, s.filename, s.subfont } end end - logs.report("fontnames","saving names in '%s'",name) + report("saving names in '%s'",name) io.savedata(name,table.serialize(simplified,true)) - local data = io.loaddata(resolvers.find_file("font-dum.lua","tex")) + local data = io.loaddata(resolvers.findfile("font-dum.lua","tex")) local dummy = string.match(data,"fonts%.names%.version%s*=%s*([%d%.]+)") if tonumber(dummy) ~= simpleversion then - logs.report("fontnames","warning: version number %s in 'font-dum' does not match database version number %s",dummy or "?",simpleversion) + report("warning: version number %s in 'font-dum' does not match database version number %s",dummy or "?",simpleversion) end elseif lfs.isfile(name) then os.remove(name) @@ -75,28 +160,29 @@ local function fontweight(fw) end local function showfeatures(tag,specification) - logs.simple("mapping : %s",tag) - logs.simple("fontname: %s",specification.fontname) - logs.simple("fullname: %s",specification.fullname) - logs.simple("filename: %s",specification.filename) - logs.simple("family : %s",specification.familyname or "") - logs.simple("weight : %s",specification.weight or "") - logs.simple("style : %s",specification.style or "") - logs.simple("width : %s",specification.width or "") - logs.simple("variant : %s",specification.variant or "") - logs.simple("subfont : %s",subfont(specification.subfont)) - logs.simple("fweight : %s",fontweight(specification.fontweight)) + report() + report("mapping : %s",tag) + report("fontname: %s",specification.fontname) + report("fullname: %s",specification.fullname) + report("filename: %s",specification.filename) + report("family : %s",specification.familyname or "") + report("weight : %s",specification.weight or "") + report("style : %s",specification.style or "") + report("width : %s",specification.width or "") + report("variant : %s",specification.variant or "") + report("subfont : %s",subfont(specification.subfont)) + report("fweight : %s",fontweight(specification.fontweight)) -- maybe more - local features = fonts.get_features(specification.filename,specification.format) + local features = fonts.helpers.getfeatures(specification.filename,specification.format) if features then for what, v in table.sortedhash(features) do local data = features[what] if data and next(data) then - logs.simple() - logs.simple("%s features:",what) - logs.simple() - logs.simple("feature script languages") - logs.simple() + report() + report("%s features:",what) + report() + report("feature script languages") + report() for f,ff in table.sortedhash(data) do local done = false for s, ss in table.sortedhash(ff) do @@ -107,24 +193,22 @@ local function showfeatures(tag,specification) else done = true end - logs.simple("% -8s % -8s % -8s",f,s,table.concat(table.sortedkeys(ss), " ")) + report("% -8s % -8s % -8s",f,s,table.concat(table.sortedkeys(ss), " ")) -- todo: padd 4 end end end end else - logs.simple() - logs.simple("no features") - logs.simple() + report("no features") end - logs.reportline() + report() end local function reloadbase(reload) if reload then - logs.simple("fontnames, reloading font database") + report("fontnames, reloading font database") names.load(true) - logs.simple("fontnames, done\n\n") + report("fontnames, done\n\n") end end @@ -151,12 +235,10 @@ local function list_specifications(t,info) subfont(entry.subfont), fontweight(entry.fontweight), } - e[k] = entry end - table.formatcolumns(s) + utilities.formatters.formatcolumns(s) for k=1,#s do - local v = s[k] - texio.write_nl(v) + texio.write_nl(s[k]) end end end @@ -181,7 +263,7 @@ local function list_matches(t,info) subfont(entry.subfont) } end - table.formatcolumns(s) + utilities.formatters.formatcolumns(s) for k=1,#s do texio.write_nl(s[k]) end @@ -205,17 +287,17 @@ function scripts.fonts.list() --~ mtxrun --script font --list --name --pattern=*somename* list_matches(fonts.names.list(string.topattern(pattern,true),reload,all),info) elseif filter then - logs.report("fontnames","not supported: --list --name --filter",name) + report("not supported: --list --name --filter",name) elseif given then --~ mtxrun --script font --list --name somename list_matches(fonts.names.list(given,reload,all),info) else - logs.report("fontnames","not supported: --list --name ",name) + report("not supported: --list --name ",name) end elseif environment.argument("spec") then if pattern then --~ mtxrun --script font --list --spec --pattern=*somename* - logs.report("fontnames","not supported: --list --spec --pattern",name) + report("not supported: --list --spec --pattern",name) elseif filter then --~ mtxrun --script font --list --spec --filter="fontname=somename" list_specifications(fonts.names.getlookups(filter),info) @@ -223,19 +305,19 @@ function scripts.fonts.list() --~ mtxrun --script font --list --spec somename list_specifications(fonts.names.collectspec(given,reload,all),info) else - logs.report("fontnames","not supported: --list --spec ",name) + report("not supported: --list --spec ",name) end elseif environment.argument("file") then if pattern then --~ mtxrun --script font --list --file --pattern=*somename* list_specifications(fonts.names.collectfiles(string.topattern(pattern,true),reload,all),info) elseif filter then - logs.report("fontnames","not supported: --list --spec",name) + report("not supported: --list --spec",name) elseif given then --~ mtxrun --script font --list --file somename list_specifications(fonts.names.collectfiles(given,reload,all),info) else - logs.report("fontnames","not supported: --list --file ",name) + report("not supported: --list --file ",name) end elseif pattern then --~ mtxrun --script font --list --pattern=*somename* @@ -243,8 +325,11 @@ function scripts.fonts.list() elseif given then --~ mtxrun --script font --list somename list_matches(fonts.names.list(given,reload,all),info) + elseif all then + pattern = "*" + list_matches(fonts.names.list(string.topattern(pattern,true),reload,all),info) else - logs.report("fontnames","not supported: --list ",name) + report("not supported: --list ",name) end end @@ -255,19 +340,20 @@ function scripts.fonts.save() local function save(savename,fontblob) if fontblob then savename = savename:lower() .. ".lua" - logs.simple("fontsave, saving data in %s",savename) + report("fontsave, saving data in %s",savename) +-- fontloader.apply_featurefile(fontblob, "./ts/test.fea") table.tofile(savename,fontloader.to_table(fontblob),"return") fontloader.close(fontblob) end end if name and name ~= "" then - local filename = resolvers.find_file(name) -- maybe also search for opentype + local filename = resolvers.findfile(name) -- maybe also search for opentype if filename and filename ~= "" then - local suffix = file.extname(filename) + local suffix = string.lower(file.extname(filename)) if suffix == 'ttf' or suffix == 'otf' or suffix == 'ttc' or suffix == "dfont" then local fontinfo = fontloader.info(filename) if fontinfo then - logs.simple("font: %s located as %s",name,filename) + report("font: %s located as %s",name,filename) if fontinfo[1] then for k=1,#fontinfo do local v = fontinfo[k] @@ -277,58 +363,19 @@ function scripts.fonts.save() save(fontinfo.fullname,fontloader.open(filename)) end else - logs.simple("font: %s cannot be read",filename) + report("font: %s cannot be read",filename) end else - logs.simple("font: %s not saved",filename) + report("font: %s not saved",filename) end else - logs.simple("font: %s not found",name) + report("font: %s not found",name) end else - logs.simple("font: no name given") + report("font: no name given") end end -logs.extendbanner("ConTeXt Font Database Management 0.21",true) - -messages.help = [[ ---save save open type font in raw table - ---reload generate new font database ---reload --simple generate 'luatex-fonts-names.lua' (not for context!) - ---list --name list installed fonts, filter by name [--pattern] ---list --spec list installed fonts, filter by spec [--filter] ---list --file list installed fonts, filter by file [--pattern] - ---pattern=str filter files using pattern ---filter=list key-value pairs ---all show all found instances ---info give more details ---track=list enable trackers - -examples of searches: - -mtxrun --script font --list somename (== --pattern=*somename*) - -mtxrun --script font --list --name somename -mtxrun --script font --list --name --pattern=*somename* - -mtxrun --script font --list --spec somename -mtxrun --script font --list --spec somename-bold-italic -mtxrun --script font --list --spec --pattern=*somename* -mtxrun --script font --list --spec --filter="fontname=somename" -mtxrun --script font --list --spec --filter="familyname=somename,weight=bold,style=italic,width=condensed" - -mtxrun --script font --list --file somename -mtxrun --script font --list --file --pattern=*somename* -]] - -local track = environment.argument("track") - -if track then trackers.enable(track) end - if environment.argument("names") then environment.setargument("reload",true) environment.setargument("simple",true) @@ -340,6 +387,8 @@ elseif environment.argument("reload") then scripts.fonts.reload() elseif environment.argument("save") then scripts.fonts.save() +elseif environment.argument("statistics") then + fonts.names.statistics() else - logs.help(messages.help) + application.help() end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-grep.lua b/Master/texmf-dist/scripts/context/lua/mtx-grep.lua index 9604bc9f85d..963422c68ec 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-grep.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-grep.lua @@ -6,11 +6,25 @@ if not modules then modules = { } end modules ['mtx-babel'] = { license = "see context related readme files" } +local helpinfo = [[ +--pattern search for pattern (optional) +--count count matches only +--nocomment skip lines that start with %% or # + +patterns are lua patterns and need to be escaped accordingly +]] + +local application = logs.application { + name = "mtx-grep", + banner = "Simple Grepper 0.10", + helpinfo = helpinfo, +} + +local report = application.report + scripts = scripts or { } scripts.grep = scripts.grep or { } -logs.extendbanner("Simple Grepper 0.10",true) - local find, format = string.find, string.format local cr = lpeg.P("\r") @@ -94,14 +108,6 @@ function scripts.grep.find(pattern, files, offset) end end -messages.help = [[ ---pattern search for pattern (optional) ---count count matches only ---nocomment skip lines that start with %% or # - -patterns are lua patterns and need to be escaped accordingly -]] - local pattern = environment.argument("pattern") local files = environment.files and #environment.files > 0 and environment.files @@ -110,5 +116,5 @@ if pattern and files then elseif files then scripts.grep.find(files[1], files, 2) else - logs.help(messages.help) + application.help() end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-interface.lua b/Master/texmf-dist/scripts/context/lua/mtx-interface.lua index 730a030d930..954cb449870 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-interface.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-interface.lua @@ -6,7 +6,39 @@ if not modules then modules = { } end modules ['mtx-cache'] = { license = "see context related readme files" } -local format = string.format +local concat, sort, insert = table.concat, table.sort, table.insert +local gsub, format, gmatch, find = string.gsub, string.format, string.gmatch, string.find +local utfchar, utfgsub = utf.char, utf.gsub + +local helpinfo = [[ +--interfaces generate context interface files +--messages generate context message files +--labels generate context label files + +--context equals --interfaces --messages --languages + +--scite generate scite interface +--bbedit generate bbedit interface files +--jedit generate jedit interface files +--textpad generate textpad interface files +--text create text files for commands and environments +--raw report commands to the console +--check generate check file + +--toutf replace named characters by utf +--preprocess preprocess mkvi files to tex files [force,suffix] + +--suffix use given suffix for output files +--force force action even when in doubt +]] + +local application = logs.application { + name = "mtx-interface", + banner = "ConTeXt Interface Related Goodies 0.13", + helpinfo = helpinfo, +} + +local report = application.report scripts = scripts or { } scripts.interface = scripts.interface or { } @@ -15,11 +47,11 @@ local flushers = { } local userinterfaces = { 'en','cs','de','it','nl','ro','fr','pe' } local messageinterfaces = { 'en','cs','de','it','nl','ro','fr','pe','no' } -function flushers.scite(interface,collection) +function flushers.scite(interface,commands) local result, i = {}, 0 result[#result+1] = format("keywordclass.macros.context.%s=",interface) - for i=1,#collection do - local command = collection[i] + for i=1,#commands do + local command = commands[i] if i==0 then result[#result+1] = "\\\n" i = 5 @@ -28,64 +60,139 @@ function flushers.scite(interface,collection) end result[#result+1] = format("%s ",command) end - io.savedata(format("cont-%s-scite.properties",interface), table.concat(result),"\n") - io.savedata(format("cont-%s-scite.lua",interface), table.serialize(collection,true)) + io.savedata(format("cont-%s-scite.properties",interface), concat(result),"\n") + io.savedata(format("cont-%s-scite.lua",interface), table.serialize(commands,true)) end -function flushers.jedit(interface,collection) +function flushers.jedit(interface,commands) local result = {} result[#result+1] = "" result[#result+1] = "\n" result[#result+1] = "" result[#result+1] = "\t" result[#result+1] = "\t\t" - for i=1,#collection do - local command = collection[i] - result[#result+1] = format("\t\t\t%s",command) + for i=1,#commands do + result[#result+1] = format("\t\t\t%s",commands[i]) end result[#result+1] = "\t\t" result[#result+1] = "\t" result[#result+1] = "" - io.savedata(format("context-jedit-%s.xml",interface), table.concat(result),"\n") + io.savedata(format("context-jedit-%s.xml",interface), concat(result),"\n") end -function flushers.bbedit(interface,collection) +function flushers.bbedit(interface,commands) local result = {} result[#result+1] = "" result[#result+1] = "BBLMKeywordList" result[#result+1] = "" - for i=1,#collection do - local command = collection[i] - result[#result+1] = format("\t\\%s",command) + for i=1,#commands do + result[#result+1] = format("\t\\%s",commands[i]) end result[#result+1] = "" - io.savedata(format("context-bbedit-%s.xml",interface), table.concat(result),"\n") + io.savedata(format("context-bbedit-%s.xml",interface), concat(result),"\n") +end + +function flushers.raw(interface,commands) + for i=1,#commands do + report(commands[i]) + end +end + +local textpadcreator = "mtx-interface-textpad.lua" + +function flushers.text(interface,commands,environments) + local c, cname = { }, format("context-commands-%s.txt",interface) + local e, ename = { }, format("context-environments-%s.txt",interface) + report("saving '%s'",cname) + for i=1,#commands do + c[#c+1] = format("\\%s",commands[i]) + end + io.savedata(cname,concat(c,"\n")) + report("saving '%s'",ename) + for i=1,#environments do + e[#e+1] = format("\\start%s",environments[i]) + e[#e+1] = format("\\stop%s", environments[i]) + end + io.savedata(format("context-environments-%s.txt",interface),concat(e,"\n")) end -function flushers.raw(interface,collection) - for i=1,#collection do - local command = collection[i] - logs.simple(command) +function flushers.textpad(interface,commands,environments) + flushers.text(interface,commands,environments) + -- + -- plugin, this is a rewrite of a file provided by Lukas Prochazka + -- + local function merge(templatedata,destinationdata,categories) + report("loading '%s'",templatedata) + local data = io.loaddata(templatedata) + local done = 0 + for i=1,#categories do + local category = categories[i] + local cpattern = ";%s*category:%s*(" .. category .. ")%s*[\n\r]+" + local fpattern = ";%s*filename:%s*(" .. "%S+" .. ")%s*[\n\r]+" + data = gsub(data,cpattern..fpattern,function(category,filename) + local found = resolvers.findfile(filename) or "" + local blob = found ~= "" and io.loaddata(found) or "" + if blob == "" then + report("category: %s, filename: %s, not found",category,filename) + else + done = done + 1 + report("category: %s, filename: %s, merged",category,filename) + end + return format("; category: %s\n; filename: %s\n%s\n\n",category,filename,blob) + end) + end + if done > 0 then + report("saving '%s' (%s files merged)",destinationdata,done) + io.savedata(destinationdata,data) + else + report("skipping '%s' (no files merged)",destinationdata) + end + end + local templatename = "textpad-context-template.txt" + local templatedata = resolvers.findfile(templatename) or "" + if templatedata == "" then + report("unable to locate template '%s'",templatename) + else + merge(templatedata, "context.syn", { "tex commands","context commands" }) + if environment.argument("textpad") == "latex" then + merge(templatedata, "context-latex.syn", { "tex commands","context commands", "latex commands" }) + end end + local r = { } + local c = io.loaddata("context-commands-en.txt") or "" -- sits on the same path + local e = io.loaddata("context-environments-en.txt") or "" -- sits on the same path + for s in gmatch(c,"\\(.-)%s") do + r[#r+1] = format("\n!TEXT=%s\n\\%s\n!",s,s) + end + for s in gmatch(e,"\\start(.-)%s+\\stop(.-)") do + r[#r+1] = format("\n!TEXT=%s (start/stop)\n\\start%s \\^\\stop%s\n!",s,s,s) + end + sort(r) + insert(r,1,"!TCL=597,\n!TITLE=ConTeXt\n!SORT=N\n!CHARSET=DEFAULT") + io.savedata("context.tcl",concat(r,"\n")) + -- cleanup + os.remove("context-commands-en.txt") + os.remove("context-environments-en.txt") end -function scripts.interface.editor(editor) - local interfaces= environment.files +function scripts.interface.editor(editor,split,forcedinterfaces) + local interfaces= forcedinterfaces or environment.files if #interfaces == 0 then interfaces= userinterfaces end - local xmlfile = resolvers.find_file("cont-en.xml") or "" + local xmlfile = resolvers.findfile("cont-en.xml") or "" if xmlfile == "" then - logs.simple("unable to locate cont-en.xml") + report("unable to locate cont-en.xml") end for i=1,#interfaces do local interface = interfaces[i] - local keyfile = resolvers.find_file(format("keys-%s.xml",interface)) or "" + local keyfile = resolvers.findfile(format("keys-%s.xml",interface)) or "" if keyfile == "" then - logs.simple("unable to locate keys-*.xml") + report("unable to locate keys-*.xml") else - local collection = { } - local mappings = { } + local commands = { } + local mappings = { } + local environments = { } local x = xml.load(keyfile) for e, d, k in xml.elements(x,"cd:command") do local at = d[k].at @@ -101,23 +208,28 @@ function scripts.interface.editor(editor) if name and name ~= "" then local remapped = mappings[name] or name if type == "environment" then - collection[#collection+1] = "start" .. remapped - collection[#collection+1] = "stop" .. remapped + if split then + environments[#environments+1] = remapped + else + commands[#commands+1] = "start" .. remapped + commands[#commands+1] = "stop" .. remapped + end else - collection[#collection+1] = remapped + commands[#commands+1] = remapped end end end - if #collection > 0 then - table.sort(collection) - flushers[editor](interface,collection) + if #commands > 0 then + sort(commands) + sort(environments) + flushers[editor](interface,commands,environments) end end end end function scripts.interface.check() - local xmlfile = resolvers.find_file("cont-en.xml") or "" + local xmlfile = resolvers.findfile("cont-en.xml") or "" if xmlfile ~= "" then local f = io.open("cont-en-check.tex","w") if f then @@ -142,13 +254,13 @@ function scripts.interface.check() end end -function scripts.interface.context() - local filename = resolvers.find_file(environment.files[1] or "mult-def.lua") or "" +function scripts.interface.interfaces() + local filename = resolvers.findfile(environment.files[1] or "mult-def.lua") or "" if filename ~= "" then local interface = dofile(filename) if interface and next(interface) then local variables, constants, commands, elements = interface.variables, interface.constants, interface.commands, interface.elements - local filename = resolvers.find_file("cont-en.xml") or "" + local filename = resolvers.findfile("cont-en.xml") or "" local xmldata = filename ~= "" and (io.loaddata(filename) or "") local function flush(texresult,xmlresult,language,what,tag) local t = interface[what] @@ -161,7 +273,7 @@ function scripts.interface.context() local v = t[key] local value = v[language] or v["en"] if not value then - logs.simple(format("warning, no value for key '%s' for language '%s'",key,language)) + report("warning, no value for key '%s' for language '%s'",key,language) else local value = t[key][language] or t[key].en texresult[#texresult+1] = format("\\setinterface%s{%s}{%s}",tag,key,value) @@ -196,12 +308,12 @@ function scripts.interface.context() flush(texresult,xmlresult,language,"commands", "command") texresult[#texresult+1] = format("%%\n\\endinput") xmlresult[#xmlresult+1] = format("") - local texfilename = format("mult-%s.tex",language) + local texfilename = format("mult-%s.mkii",language) local xmlfilename = format("keys-%s.xml",language) - io.savedata(texfilename,table.concat(texresult,"\n")) - logs.simple(format("saving interface definitions '%s'",texfilename)) - io.savedata(xmlfilename,table.concat(xmlresult,"\n")) - logs.simple(format("saving interface translations '%s'",xmlfilename)) + io.savedata(texfilename,concat(texresult,"\n")) + report("saving interface definitions '%s'",texfilename) + io.savedata(xmlfilename,concat(xmlresult,"\n")) + report("saving interface translations '%s'",xmlfilename) if language ~= "en" and xmldata ~= "" then local newdata = xmldata:gsub("( 0 then + report("+ %5i : %s => %s",v,k,contextnames[k]) + else + report("- %5i : %s",-v,k,contextnames[k]) + end + end + filename = filename .. ".toutf" + report("saving '%s'",filename) + io.savedata(filename,str) end end -logs.extendbanner("ConTeXt Interface Related Goodies 0.11",true) +-- function scripts.interface.labels() +-- require("char-def.lua") +-- require("lang-txt.lua") +-- local interfaces = require("mult-def.lua") +-- local variables = interfaces.variables +-- local contextnames = { } +-- for unicode, data in next, characters.data do +-- local contextname = data.contextname +-- if contextname then +-- contextnames[utfchar(unicode)] = "\\" .. contextname .. " " +-- end +-- end +-- contextnames["i"] = nil +-- contextnames["'"] = nil +-- contextnames["\\"] = nil +-- local function flush(f,kind,what,expand,namespace,prefix) +-- local whatdata = languages.data.labels[what] +-- f:write("\n") +-- f:write(format("%% %s => %s\n",what,kind)) +-- for tag, data in table.sortedpairs(whatdata) do +-- if not data.hidden then +-- f:write("\n") +-- for language, text in table.sortedpairs(data.labels) do +-- if text ~= "" then +-- if expand then +-- text = utfgsub(text,".",contextnames) +-- text = gsub(text," ", "\ ") +-- end +-- if namespace and namespace[tag] then +-- tag = prefix .. tag +-- end +-- if find(text,",") then +-- text = "{" .. text .. "}" +-- end +-- if text == "" then +-- -- skip +-- else +-- if type(text) == "table" then +-- f:write(format("\\setup%stext[\\s!%s][%s={{%s},}]\n",kind,language,tag,text)) +-- else +-- f:write(format("\\setup%stext[\\s!%s][%s={{%s},{%s}}]\n",kind,language,tag,text[1],text[2])) +-- end +-- end +-- end +-- end +-- end +-- end +-- end +-- function flushall(txtname,expand) +-- local f = io.open(txtname,"w") +-- if f then +-- report("saving '%s'",txtname) +-- f:write("% this file is auto-generated, don't edit this file\n") +-- flush(f,"head","titles",expand,variables,"\\v!") +-- flush(f,"label","texts",expand,variables,"\\v!") +-- flush(f,"mathlabel","functions",expand) +-- flush(f,"taglabel","tags",expand) +-- f:write("\n") +-- f:write("\\endinput\n") +-- f:close() +-- end +-- end +-- flushall("lang-txt.mkii",true) +-- flushall("lang-txt.mkiv",false) +-- end -messages.help = [[ ---scite generate scite interface ---bbedit generate scite interface ---jedit generate scite interface ---check generate check file ---context generate context definition files ---messages generate context message files -]] +local ea = environment.argument -if environment.argument("context") then - scripts.interface.context() -elseif environment.argument("messages") then - scripts.interface.messages() -elseif environment.argument("scite") or environment.argument("bbedit") or environment.argument("jedit") then - if environment.argument("scite") then +if ea("context") then + scripts.interface.interfaces() + -- scripts.interface.messages() + -- scripts.interface.labels() +elseif ea("interfaces") or ea("messages") or ea("labels") then + if ea("interfaces") then + scripts.interface.interfaces() + end + -- if ea("messages") then + -- scripts.interface.messages() + -- end + -- if ea("labels") then + -- scripts.interface.labels() + -- end +elseif ea("preprocess") then + scripts.interface.preprocess() +elseif ea("toutf") then + scripts.interface.toutf() +elseif ea("check") then + scripts.interface.check() +elseif ea("scite") or ea("bbedit") or ea("jedit") or ea("textpad") or ea("text") or ea("raw") then + if ea("scite") then scripts.interface.editor("scite") end - if environment.argument("bbedit") then + if ea("bbedit") then scripts.interface.editor("bbedit") end - if environment.argument("jedit") then + if ea("jedit") then scripts.interface.editor("jedit") end -elseif environment.argument("check") then - scripts.interface.check() + if ea("textpad") then + scripts.interface.editor("textpad",true, { "en" }) + end + if ea("text") then + scripts.interface.editor("text") + end + if ea("raw") then + scripts.interface.editor("raw") + end else - logs.help(messages.help) + application.help() end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-metapost.lua b/Master/texmf-dist/scripts/context/lua/mtx-metapost.lua new file mode 100644 index 00000000000..3b9ed6ff17e --- /dev/null +++ b/Master/texmf-dist/scripts/context/lua/mtx-metapost.lua @@ -0,0 +1,177 @@ +if not modules then modules = { } end modules ['mtx-metapost'] = { -- this was mtx-mptopdf + version = 0.100, + comment = "companion to mtxrun.lua", + author = "Taco Hoekwater & Hans Hagen", + copyright = "ConTeXt Development Team", + license = "see context related readme files" +} + +local helpinfo = [[ +--rawmp raw metapost run +--metafun use metafun instead of plain +--latex force --tex=latex +--texexec force texexec usage (mkii) +--split split single result file into pages + +intended usage: + +mtxrun --script metapost yourfile.mp +mtxrun --script metapost --split yourfile.mp +mtxrun --script metapost yourfile.123 myfile.mps + +other usage resembles mptopdf.pl +]] + +local application = logs.application { + name = "mtx-metapost", + banner = "MetaPost to PDF processor 0.10", + helpinfo = helpinfo, +} + +local report = application.report + +scripts = scripts or { } +scripts.mptopdf = scripts.mptopdf or { } +scripts.mptopdf.aux = scripts.mptopdf.aux or { } + +local format, find, gsub = string.format, string.find, string.gsub + +local function assumes_latex(filename) + local d = io.loaddata(filename) or "" + return find(d,"\\documentstyle") or find(d,"\\documentclass") or find(d,"\\begin{document}") +end + +local template = "\\startTEXpage\n\\convertMPtoPDF{%s}{1}{1}\n\\stopTEXpage" +local texified = "\\starttext\n%s\n\\stoptext" +local splitter = "\\startTEXpage\\externalfigure[%s][page=%s]\\stopTEXpage" +local tempname = "mptopdf-temp.tex" + +local function do_convert(filename) + if find(filename,".%d+$") or find(filename,"%.mps$") then + io.savedata(tempname,format(template,filename)) + local resultname = format("%s-%s.pdf",file.nameonly(filename),file.extname(filename)) + local result = os.execute(format([[context --once --batch --purge --result=%s "%s"]],resultname,tempname)) + return lfs.isfile(resultname) and resultname + end +end + +local function do_split(filename,numbers) + local name = file.nameonly(filename) + for i=1,#numbers do + io.savedata(tempname,format(splitter,file.addsuffix(name,"pdf"),i)) + local resultname = format("%s-%s.pdf",name,numbers[i]) + local result = os.execute(format([[context --once --batch --purge --result=%s "%s"]],resultname,tempname)) + end +end + +local function do_texify(str) + -- This only works for flat mp files i.e. outer beginfigs. Normally a + -- context user will directly make a tex file. Of course we can make + -- this script more clever, but why should we as better methods exist. + local numbers = { } + str = "\\startMPinclusions\n".. str .. "\n\\stopMPinclusions" + str = gsub(str,"beginfig%s*%(%s*(.-)%s*%)%s*;%s*",function(s) + numbers[#numbers+1] = tonumber(s) or 0 + return "\n\\stopMPinclusions\n\\startMPpage\n" + end) + str = gsub(str,"%s*endfig%s*;%s*","\n\\stopMPpage\n\\startMPinclusions\n") + str = gsub(str,"\\startMPinclusions%s*\\stopMPinclusions","") + str = gsub(str,"[\n\r]+","\n") + return format(texified,str), numbers +end + +local function do_convert_all(filename) + local results = dir.glob(file.nameonly(filename) .. ".*") -- reset + local report = { } + for i=1,#results do + local filename = results[i] + local resultname = do_convert(filename) + if resultname then + report[#report+1] = { filename, resultname } + end + end + if #report > 0 then + report("number of converted files: %i", #report) + report() + for i=1,#report do + local r = report[i] + report("%s => %s", r[1], r[2]) + end + else + report("no files are converted for '%s'",filename) + end +end + +local function do_convert_one(filename) + local resultname = do_convert(filename) + if resultname then + report("%s => %s", filename,resultname) + else + report("no result for '%s'",filename) + end +end + +function scripts.mptopdf.convertall() + local rawmp = environment.arguments.rawmp or false + local metafun = environment.arguments.metafun or false + local latex = environment.arguments.latex or false + local pattern = environment.arguments.pattern or false + local split = environment.arguments.split or false + local files + if pattern then + files = dir.glob(file.nameonly(filename)) + else + files = environment.files + end + if #files > 0 then + for i=1,#files do + local filename = files[i] + if file.suffix(filename) == "mp" then + local command, convert, texdata, numbers + if rawmp then + if metafun then + command, convert = format("mpost --progname=mpost --mem=metafun %s",filename), true + else + command, convert = format("mpost --mem=mpost %s",filename), true + end + else + if latex or assumes_latex(filename) then + command, convert = format("mpost --mem=mpost --tex=latex %s",filename), true + elseif texexec then + command, convert = format("texexec --mptex %s",filename), true + else + texdata, numbers = do_texify(io.loaddata(filename) or "") + io.savedata(tempname,texdata) + command, convert = format("context --result=%s --purge --once %s",file.nameonly(filename),tempname), false + end + end + report("running: %s",command) + local done = os.execute(command) + if done then + if convert then + do_convert_all(filename) + elseif split then + do_split(filename,numbers) + -- already pdf, maybe optionally split + end + else + report("error while processing mp file '%s'", filename) + end + else + do_convert_one(filename) + end + end + else + report("no files match to process") + end +end + +if environment.files[1] then + scripts.mptopdf.convertall() +else + if not environment.arguments.help then + report("provide MP output file (or pattern)") + report() + end + application.help() +end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-metatex.lua b/Master/texmf-dist/scripts/context/lua/mtx-metatex.lua index 4453e2ccb47..0b66d59ef3a 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-metatex.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-metatex.lua @@ -8,39 +8,41 @@ if not modules then modules = { } end modules ['mtx-metatex'] = { -- future versions will deal with specific variants of metatex +local helpinfo = [[ +--run process (one or more) files (default action) +--make create metatex format(s) +]] + +local application = logs.application { + name = "mtx-metatex", + banner = "MetaTeX Process Management 0.10", + helpinfo = helpinfo, +} + +local report = application.report + scripts = scripts or { } scripts.metatex = scripts.metatex or { } -- metatex function scripts.metatex.make() - local command = "luatools --make --compile metatex" - logs.simple("running command: %s",command) - os.spawn(command) + environment.make_format("metatex") end ---~ function scripts.metatex.run() ---~ local name = environment.files[1] or "" ---~ if name ~= "" then ---~ local command = "luatools --fmt=metatex " .. name ---~ logs.simple("running command: %s",command) ---~ os.spawn(command) ---~ end ---~ end - function scripts.metatex.run(ctxdata,filename) local filename = environment.files[1] or "" if filename ~= "" then - local formatfile, scriptfile = resolvers.locate_format("metatex") + local formatfile, scriptfile = resolvers.locateformat("metatex") if formatfile and scriptfile then local command = string.format("luatex --fmt=%s --lua=%s %s", string.quote(formatfile), string.quote(scriptfile), string.quote(filename)) - logs.simple("running command: %s",command) + report("running command: %s",command) os.spawn(command) elseif formatname then - logs.simple("error, no format found with name: %s",formatname) + report("error, no format found with name: %s",formatname) else - logs.simple("error, no format found (provide formatname or interface)") + report("error, no format found (provide formatname or interface)") end end end @@ -49,13 +51,6 @@ function scripts.metatex.timed(action) statistics.timed(action) end -logs.extendbanner("MetaTeX Process Management 0.10",true) - -messages.help = [[ ---run process (one or more) files (default action) ---make create metatex format(s) -]] - if environment.argument("run") then scripts.metatex.timed(scripts.metatex.run) elseif environment.argument("make") then @@ -65,5 +60,5 @@ elseif environment.argument("help") then elseif environment.files[1] then scripts.metatex.timed(scripts.metatex.run) else - logs.help(messages.help,false) + application.help() end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-modules.lua b/Master/texmf-dist/scripts/context/lua/mtx-modules.lua index 3a348593f8e..8f3ab89cfb6 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-modules.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-modules.lua @@ -9,6 +9,20 @@ if not modules then modules = { } end modules ['mtx-modules'] = { scripts = scripts or { } scripts.modules = scripts.modules or { } +local helpinfo = [[ +--convert convert source files (tex, mkii, mkiv, mp) to 'ted' files +--process process source files (tex, mkii, mkiv, mp) to 'pdf' files +--prep use original name with suffix 'prep' appended +]] + +local application = logs.application { + name = "mtx-modules", + banner = "ConTeXt Module Documentation Generators 1.00", + helpinfo = helpinfo, +} + +local report = application.report + -- Documentation can be woven into a source file. This script can generates -- a file with the documentation and source fragments properly tagged. The -- documentation is included as comment: @@ -39,15 +53,15 @@ local find, format, sub, is_empty, strip = string.find, string.format, string.su local function source_to_ted(inpname,outname,filetype) local inp = io.open(inpname) if not inp then - logs.simple("unable to open '%s'",inpname) + report("unable to open '%s'",inpname) return end local out = io.open(outname,"w") if not out then - logs.simple("unable to open '%s'",outname) + report("unable to open '%s'",outname) return end - logs.simple("converting '%s' to '%s'",inpname,outname) + report("converting '%s' to '%s'",inpname,outname) local skiplevel, indocument, indefinition = 0, false, false out:write(format("\\startmodule[type=%s]\n",filetype or file.suffix(inpname))) for line in inp:lines() do @@ -118,7 +132,7 @@ local function source_to_ted(inpname,outname,filetype) return true end -local suffixes = table.tohash { 'tex','mkii','mkiv','mp' } +local suffixes = table.tohash { 'tex','mkii','mkiv', 'mkvi', 'mp' } function scripts.modules.process(runtex) local processed = { } @@ -143,25 +157,16 @@ function scripts.modules.process(runtex) end for i=1,#processed do local name = processed[i] - logs.simple("modules","processed: %s",name) + report("modules","processed: %s",name) end end -- context --ctx=m-modules.ctx xxx.mkiv - -logs.extendbanner("ConTeXt Module Documentation Generators 1.00",true) - -messages.help = [[ ---convert convert source files (tex, mkii, mkiv, mp) to 'ted' files ---process process source files (tex, mkii, mkiv, mp) to 'pdf' files ---prep use original name with suffix 'prep' appended -]] - if environment.argument("process") then scripts.modules.process(true) elseif environment.argument("convert") then scripts.modules.process(false) else - logs.help(messages.help) + application.help() end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-mptopdf.lua b/Master/texmf-dist/scripts/context/lua/mtx-mptopdf.lua deleted file mode 100644 index 342ff1c284a..00000000000 --- a/Master/texmf-dist/scripts/context/lua/mtx-mptopdf.lua +++ /dev/null @@ -1,127 +0,0 @@ -if not modules then modules = { } end modules ['mtx-mptopdf'] = { - version = 1.303, - comment = "companion to mtxrun.lua, patched by HH so errors are his", - author = "Taco Hoekwater, Elvenkind BV, Dordrecht NL", - copyright = "Elvenkind BV / ConTeXt Development Team", - license = "see context related readme files" -} - -scripts = scripts or { } -scripts.mptopdf = scripts.mptopdf or { } -scripts.mptopdf.aux = scripts.mptopdf.aux or { } - -local dosish = os.type == 'windows' -local miktex = dosish and environment.TEXSYSTEM and environment.TEXSYSTEM:find("miktex") -local escapeshell = environment.SHELL and environment.SHELL:find("sh") and true - -function scripts.mptopdf.aux.find_latex(fname) - local d = io.loaddata(fname) or "" - return d:find("\\documentstyle") or d:find("\\documentclass") or d:find("\\begin{document}") -end - -function scripts.mptopdf.aux.do_convert (fname) - local command, done, pdfdest = "", 0, "" - if fname:find(".%d+$") or fname:find("%.mps$") then - if miktex then - command = "pdftex -undump=mptopdf" - else - command = "pdftex -fmt=mptopdf -progname=context" - end - if dosish then - command = string.format('%s \\relax "%s"',command,fname) - else - command = string.format('%s \\\\relax "%s"',command,fname) - end - local result = os.execute(command) - if result == 0 then - local name, suffix = file.nameonly(fname), file.extname(fname) - local pdfsrc = name .. ".pdf" - if lfs.isfile(pdfsrc) then - pdfdest = name .. "-" .. suffix .. ".pdf" - os.rename(pdfsrc, pdfdest) - if lfs.isfile(pdfsrc) then -- rename failed - file.copy(pdfsrc, pdfdest) - end - done = 1 - end - end - end - return done, pdfdest -end - -function scripts.mptopdf.aux.make_mps(fn,latex,rawmp,metafun) - local rest, mpbin = latex and " --tex=latex " or " ", "" - if rawmp then - if metafun then - mpbin = "mpost --progname=mpost --mem=metafun" - else - mpbin = "mpost --mem=mpost" - end - else - if latex then - mpbin = "mpost --mem=mpost" - else - mpbin = "texexec --mptex" - end - end - local runner = mpbin .. rest .. fn - logs.simple("running: %s\n", runner) - return (os.execute(runner)) -end - -function scripts.mptopdf.convertall() - local rawmp = environment.arguments.rawmp or false - local metafun = environment.arguments.metafun or false - local latex = environment.arguments.latex or false - local files = dir.glob(environment.files) - if #files > 0 then - local fn = files[1] - if #files == 1 and fn:find("%.mp$") then - latex = scripts.mptopdf.aux.find_latex(fn) or latex - end - if scripts.mptopdf.aux.make_mps(fn,latex,rawmp,metafun) then - files = dir.glob(file.nameonly(fn) .. ".*") -- reset - else - logs.simple("error while processing mp file '%s'", fn) - exit(1) - end - local report = { } - for i=1,#files do - local fn = files[i] - local success, name = scripts.mptopdf.aux.do_convert(fn) - if success > 0 then - report[#report+1] = { fn, name } - end - end - if #report > 0 then - logs.simple("number of converted files: %i", #report) - logs.simple("") - for i=1,#report do - local r = report[i] - logs.simple("%s => %s", r[1], r[2]) - end - else - logs.simple("no files are converted") - end - else - logs.simple("no files match %s", table.concat(environment.files,' ')) - end -end - -logs.extendbanner("MetaPost to PDF Converter 0.51",true) - -messages.help = [[ ---rawmp raw metapost run ---metafun use metafun instead of plain ---latex force --tex=latex -]] - -if environment.files[1] then - scripts.mptopdf.convertall() -else - if not environment.arguments.help then - logs.simple("provide MP output file (or pattern)") - logs.simple("") - end - logs.help(messages.help) -end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-package.lua b/Master/texmf-dist/scripts/context/lua/mtx-package.lua index b36fc0ed89c..294ef4f285a 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-package.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-package.lua @@ -8,22 +8,34 @@ if not modules then modules = { } end modules ['mtx-package'] = { local format, gsub, gmatch = string.format, string.gsub, string.gmatch +local helpinfo = [[ +--merge merge 'loadmodule' into merge file +]] + +local application = logs.application { + name = "mtx-package", + banner = "Distribution Related Goodies 0.10", + helpinfo = helpinfo, +} + +local report = application.report + scripts = scripts or { } messages = messages or { } scripts.package = scripts.package or { } function scripts.package.merge_luatex_files(name,strip) - local oldname = resolvers.find_file(name) or "" + local oldname = resolvers.findfile(name) or "" oldname = file.replacesuffix(oldname,"lua") if oldname == "" then - logs.simple("missing '%s'",name) + report("missing '%s'",name) else local newname = file.removesuffix(oldname) .. "-merged.lua" local data = io.loaddata(oldname) or "" if data == "" then - logs.simple("missing '%s'",newname) + report("missing '%s'",newname) else - logs.simple("loading '%s'",oldname) + report("loading '%s'",oldname) local collected = { } collected[#collected+1] = format("-- merged file : %s\n",newname) collected[#collected+1] = format("-- parent file : %s\n",oldname) @@ -31,11 +43,11 @@ function scripts.package.merge_luatex_files(name,strip) -- loadmodule can have extra arguments for lib in gmatch(data,"loadmodule *%([\'\"](.-)[\'\"]") do if file.basename(lib) ~= file.basename(newname) then - local fullname = resolvers.find_file(lib) or "" + local fullname = resolvers.findfile(lib) or "" if fullname == "" then - logs.simple("missing '%s'",lib) + report("missing '%s'",lib) else - logs.simple("fetching '%s'",fullname) + report("fetching '%s'",fullname) local data = io.loaddata(fullname) if strip then data = gsub(data,"%-%-%[%[ldx%-%-.-%-%-%ldx%]%]%-%-[\n\r]*","") @@ -49,20 +61,14 @@ function scripts.package.merge_luatex_files(name,strip) end end end - logs.simple("saving '%s'",newname) + report("saving '%s'",newname) io.savedata(newname,table.concat(collected)) end end end -logs.extendbanner("Distribution Related Goodies 0.10",true) - -messages.help = [[ ---merge merge 'loadmodule' into merge file -]] - if environment.argument("merge") then scripts.package.merge_luatex_files(environment.files[1] or "") else - logs.help(messages.help) + application.help() end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-patterns.lua b/Master/texmf-dist/scripts/context/lua/mtx-patterns.lua index 293016991ff..bbf47513354 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-patterns.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-patterns.lua @@ -6,312 +6,453 @@ if not modules then modules = { } end modules ['mtx-patterns'] = { license = "see context related readme files" } -local format = string.format +local format, find, concat, gsub, match, gmatch = string.format, string.find, table.concat, string.gsub, string.match, string.gmatch +local byte, char = utf.byte, utf.char +local addsuffix = file.addsuffix +local lpegmatch, validutf8 = lpeg.match, lpeg.patterns.validutf8 + +local helpinfo = [[ +--convert generate context language files (mnemonic driven, if not given then all) +--check check pattern file (or those used by context when no file given) +--path source path where hyph-foo.tex files are stored +--destination destination path + +examples of usage: + +mtxrun --script pattern --check hyph-*.tex +mtxrun --script pattern --check --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns +mtxrun --script pattern --convert --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns/tex --destination=e:/tmp/patterns +mtxrun --script pattern --convert --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns/txt --destination=e:/tmp/patterns +]] + +local application = logs.application { + name = "mtx-patterns", + banner = "ConTeXt Pattern File Management 0.20", + helpinfo = helpinfo, +} + +local report = application.report scripts = scripts or { } scripts.patterns = scripts.patterns or { } -scripts.patterns.list = { - { "??", "hyph-ar.tex", "arabic" }, - { "bg", "hyph-bg.tex", "bulgarian" }, - { "ca", "hyph-ca.tex", "catalan" }, - { "??", "hyph-cop.tex", "coptic" }, - { "cs", "hyph-cs.tex", "czech" }, - { "cy", "hyph-cy.tex", "welsh" }, - { "da", "hyph-da.tex", "danish" }, - { "deo", "hyph-de-1901.tex", "german, old spelling" }, - { "de", "hyph-de-1996.tex", "german, new spelling" }, ---~ { "??", "hyph-el-monoton.tex", "" }, ---~ { "??", "hyph-el-polyton.tex", "" }, - { "agr", "hyph-grc", "ancient greek" }, ---~ { "???", "hyph-x-ibycus", "ancient greek in ibycus encoding" }, ---~ { "gr", "", "" }, - { "eo", "hyph-eo.tex", "esperanto" }, - { "gb", "hyph-en-gb.tex", "british english" }, - { "us", "hyph-en-us.tex", "american english" }, - { "es", "hyph-es.tex", "spanish" }, - { "et", "hyph-et.tex", "estonian" }, - { "eu", "hyph-eu.tex", "basque" }, -- ba is Bashkir! - { "fa", "hyph-fa.tex", "farsi" }, - { "fi", "hyph-fi.tex", "finnish" }, - { "fr", "hyph-fr.tex", "french" }, --- { "??", "hyph-ga.tex", "" }, --- { "??", "hyph-gl.tex", "" }, --- { "??", "hyph-grc.tex", "" }, - { "hr", "hyph-hr.tex", "croatian" }, - { "??", "hyph-hsb.tex", "upper sorbian" }, - { "hu", "hyph-hu.tex", "hungarian" }, - { "??", "hyph-ia.tex", "interlingua" }, - { "??", "hyph-id.tex", "indonesian" }, - { "is", "hyph-is.tex", "icelandic" }, - { "it", "hyph-it.tex", "italian" }, - { "la", "hyph-la.tex", "latin" }, - { "lt", "hyph-lt.tex", "lithuanian" }, - { "mn", "hyph-mn-cyrl.tex", "mongolian, cyrillic script" }, - { "nb", "hyph-nb.tex", "norwegian bokmål" }, - { "nl", "hyph-nl.tex", "dutch" }, - { "nn", "hyph-nn.tex", "norwegian nynorsk" }, - { "pl", "hyph-pl.tex", "polish" }, - { "pt", "hyph-pt.tex", "portuguese" }, - { "ro", "hyph-ro.tex", "romanian" }, - { "ru", "hyph-ru.tex", "russian" }, - { "sk", "hyph-sk.tex", "slovak" }, - { "sl", "hyph-sl.tex", "slovenian" }, - { "sr", "hyph-sr-cyrl.tex", "serbian" }, - { "sv", "hyph-sv.tex", "swedish" }, - { "tr", "hyph-tr.tex", "turkish" }, - { "tk", "hyph-tk.tex", "turkman" }, - { "uk", "hyph-uk.tex", "ukrainian" }, - { "zh", "hyph-zh-latn.tex", "zh-latn, chinese Pinyin" }, +local permitted_characters = table.tohash { + 0x0009, -- tab + 0x0027, -- apostrofe + 0x02BC, -- modifier apostrofe (used in greek) + 0x002D, -- hyphen + 0x200C, -- zwnj + 0x2019, -- quote right + 0x1FBD, -- greek, but no letter: symbol modifier + 0x1FBF, -- greek, but no letter: symbol modifier } +local ignored_ancient_greek = table.tohash { + 0x1FD3, -- greekiotadialytikatonos (also 0x0390) + 0x1FE3, -- greekupsilondialytikatonos (also 0x03B0) + 0x1FBD, -- greek, but no letter: symbol modifier + 0x1FBF, -- greek, but no letter: symbol modifier + 0x03F2, -- greeksigmalunate + 0x02BC, -- modifier apostrofe) +} --- stripped down from lpeg example: +local ignored_french = table.tohash { + 0x02BC, -- modifier apostrofe +} -local utf = unicode.utf8 +local replaced_whatever = { + [char(0x2019)] = char(0x0027) +} -local cont = lpeg.R("\128\191") -- continuation byte +scripts.patterns.list = { + { "af", "hyph-af", "afrikaans" }, + -- { "ar", "hyph-ar", "arabic" }, + -- { "as", "hyph-as", "assamese" }, + { "bg", "hyph-bg", "bulgarian" }, + -- { "bn", "hyph-bn", "bengali" }, + { "ca", "hyph-ca", "catalan" }, + -- { "??", "hyph-cop", "coptic" }, + { "cs", "hyph-cs", "czech" }, + { "cy", "hyph-cy", "welsh" }, + { "da", "hyph-da", "danish" }, + { "deo", "hyph-de-1901", "german, old spelling" }, + { "de", "hyph-de-1996", "german, new spelling" }, + -- { "??", "hyph-de-ch-1901", "swiss german" }, + -- { "??", "hyph-el-monoton", "greek" }, + -- { "gr", "hyph-el-polyton", "greek" }, + { "agr", "hyph-grc", "ancient greek", ignored_ancient_greek }, + { "gb", "hyph-en-gb", "british english" }, + { "us", "hyph-en-us", "american english" }, + -- { "eo", "hyph-eo", "esperanto" }, + { "es", "hyph-es", "spanish" }, + { "et", "hyph-et", "estonian" }, + { "eu", "hyph-eu", "basque" }, + -- { "fa", "hyph-fa", "farsi" }, + { "fi", "hyph-fi", "finnish" }, + { "fr", "hyph-fr", "french", ignored_french }, + -- { "??", "hyph-ga", "irish" }, + -- { "??", "hyph-gl", "galician" }, + -- { "gu", "hyph-gu", "gujarati" }, + -- { "hi", "hyph-hi", "hindi" }, + { "hr", "hyph-hr", "croatian" }, + -- { "??", "hyph-hsb", "upper sorbian" }, + { "hu", "hyph-hu", "hungarian" }, + -- { "hy", "hyph-hy", "armenian" }, + -- { "??", "hyph-ia", "interlingua" }, + -- { "??", "hyph-id", "indonesian" }, + { "is", "hyph-is", "icelandic" }, + { "it", "hyph-it", "italian" }, + -- { "??", "hyph-kmr", "kurmanji" }, + -- { "kn", "hyph-kn", "kannada" }, + { "la", "hyph-la", "latin" }, + -- { "lo", "hyph-lo", "lao" }, + { "lt", "hyph-lt", "lithuanian" }, + { "lv", "hyph-lv", "latvian" }, + -- { "ml", "hyph-ml", "..." }, + { "mn", "hyph-mn-cyrl", "mongolian, cyrillic script" }, + -- { "mr", "hyph-mr", "..." }, + { "nb", "hyph-nb", "norwegian bokmål" }, + { "nl", "hyph-nl", "dutch" }, + { "nn", "hyph-nn", "norwegian nynorsk" }, + -- { "or", "hyph-or", "oriya" }, + -- { "pa", "hyph-pa", "panjabi" }, + -- { "", "hyph-", "" }, + { "pl", "hyph-pl", "polish" }, + { "pt", "hyph-pt", "portuguese" }, + { "ro", "hyph-ro", "romanian" }, + { "ru", "hyph-ru", "russian" }, + -- { "sa", "hyph-sa", "sanskrit" }, + { "sk", "hyph-sk", "slovak" }, + { "sl", "hyph-sl", "slovenian" }, + { "sr", "hyph-sr-cyrl", "serbian" }, + -- { "sr", "hyph-sr-latn", "serbian" }, + { "sv", "hyph-sv", "swedish" }, + -- { "ta", "hyph-ta", "tamil" }, + -- { "te", "hyph-te", "telugu" }, + { "tk", "hyph-tk", "turkmen" }, + { "tr", "hyph-tr", "turkish" }, + { "uk", "hyph-uk", "ukrainian" }, + { "zh", "hyph-zh-latn", "zh-latn, chinese pinyin" }, +} -local utf8 = lpeg.R("\0\127") - + lpeg.R("\194\223") * cont - + lpeg.R("\224\239") * cont * cont - + lpeg.R("\240\244") * cont * cont * cont +-- stripped down from lpeg example: -local validutf = (utf8^0/function() return true end) * (lpeg.P(-1)/function() return false end) +local utf = unicode.utf8 function utf.check(str) - return lpeg.match(validutf,str) + return lpeg.match(lpeg.patterns.validutf8,str) end -local permitted_commands = table.tohash { - "message", - "endinput" -} +-- *.tex +-- *.hyp.txt *.pat.txt *.lic.txt *.chr.txt -local permitted_characters = table.tohash { - 0x0009, -- tab - 0x0027, -- apostrofe - 0x002D, -- hyphen - 0x200C, -- -} - -function scripts.patterns.load(path,name,mnemonic,fullcheck) +function scripts.patterns.load(path,name,mnemonic,ignored) local fullname = file.join(path,name) - local data = io.loaddata(fullname) or "" - local byte, char = utf.byte, utf.char - if data ~= "" then - data = data:gsub("([\n\r])\\input ([^ \n\r]+)", function(previous,subname) - local subname = file.addsuffix(subname,"tex") - local subfull = file.join(file.dirname(fullname),subname) - local subdata = io.loaddata(subfull) or "" - if subdata == "" then - if mnemonic then - logs.simple("no subfile %s for language %s",subname,mnemonic) - else - logs.simple("no subfile %s",name) + local texfile = addsuffix(fullname,"tex") + local hypfile = addsuffix(fullname,"hyp.txt") + local patfile = addsuffix(fullname,"pat.txt") + local licfile = addsuffix(fullname,"lic.txt") + -- local chrfile = addsuffix(fullname,"chr.txt") + local okay = true + local hyphenations, patterns, comment, stripset = "", "", "", "" + local splitpatternsnew, splithyphenationsnew = { }, { } + local splitpatternsold, splithyphenationsold = { }, { } + local usedpatterncharacters, usedhyphenationcharacters = { }, { } + if lfs.isfile(patfile) then + report("using txt files %s.[hyp|pat|lic].txt",name) + comment, patterns, hyphenations = io.loaddata(licfile) or "", io.loaddata(patfile) or "", io.loaddata(hypfile) or "" + hypfile, patfile, licfile = hypfile, patfile, licfile + elseif lfs.isfile(texfile) then + report("using tex file %s.txt",name) + local data = io.loaddata(texfile) or "" + if data ~= "" then + data = gsub(data,"([\n\r])\\input ([^ \n\r]+)", function(previous,subname) + local subname = addsuffix(subname,"tex") + local subfull = file.join(file.dirname(texfile),subname) + local subdata = io.loaddata(subfull) or "" + if subdata == "" then + report("no subfile %s",subname) end - end - return previous .. subdata - end) - local comment = data:match("^(.-)[\n\r]\\patterns") or "" - local n, okay = 0, true - local cd = characters.data - for line in data:gmatch("[^ \n\r]+") do - local ok = utf.check(line) - n = n + 1 - if not ok then - okay = false - line = line:gsub("%%","%%%%") - if fullcheck then - if mnemonic then - logs.simple("invalid utf in language %s, file %s, line %s: %s",mnemonic,name,n,line) - else - logs.simple("invalid utf in file %s, line %s: %s",name,n,line) - end - else - if mnemonic then - logs.simple("file %s for %s contains invalid utf",name,mnemonic) - else - logs.simple("file %s contains invalid utf",name) + return previous .. subdata + end) + data = gsub(data,"%%.-[\n\r]","") + data = gsub(data," *[\n\r]+","\n") + patterns = match(data,"\\patterns[%s]*{[%s]*(.-)[%s]*}") or "" + hyphenations = match(data,"\\hyphenation[%s]*{[%s]*(.-)[%s]*}") or "" + comment = match(data,"^(.-)[\n\r]\\patterns") or "" + else + okay = false + end + else + okay = false + end + if okay then + -- split into lines + local how = lpeg.patterns.whitespace^1 + splitpatternsnew = lpeg.split(how,patterns) + splithyphenationsnew = lpeg.split(how,hyphenations) + end + if okay then + -- remove comments + local function check(data,splitdata,name) + if find(data,"%%") then + for i=1,#splitdata do + local line = splitdata[i] + if find(line,"%%") then + splitdata[i] = gsub(line,"%%.*$","") + report("removing comment: %s",line) end - break end end end - local c, h = { }, { } - for line in data:gmatch("[^\n\r]+") do - local txt, cmt = line:match("^(.-)%%(.*)$") - if not txt then - txt, cmt = line, "" - end - for s in txt:gmatch("\\([a-zA-Z]+)") do - h[s] = (h[s] or 0) + 1 - end - for s in cmt:gmatch("\\([a-zA-Z]+)") do - c[s] = (c[s] or 0) + 1 - end - end - h.patterns = nil - h.hyphenation = nil - for k, v in next, h do - if not permitted_commands[k] then okay = false end - if mnemonic then - logs.simple("command \\%s found in language %s, file %s, n=%s",k,mnemonic,name,v) - else - logs.simple("command \\%s found in file %s, n=%s",k,name,v) + check(patterns,splitpatternsnew,patfile) + check(hyphenations,splithyphenationsnew,hypfile) + end + if okay then + -- remove lines with commands + local function check(data,splitdata,name) + if find(data,"\\") then + for i=1,#splitdata do + local line = splitdata[i] + if find(line,"\\") then + splitdata[i] = "" + report("removing line with command: %s",line) + end + end end end - if not environment.argument("fast") then - for k, v in next, c do - if mnemonic then - logs.simple("command \\%s found in comment of language %s, file %s, n=%s",k,mnemonic,name,v) - else - logs.simple("command \\%s found in comment of file %s, n=%s",k,name,v) + check(patterns,splitpatternsnew,patfile) + check(hyphenations,splithyphenationsnew,hypfile) + end + if okay then + -- check for valid utf + local function check(data,splitdata,name) + for i=1,#splitdata do + local line = splitdata[i] + local ok = lpegmatch(validutf8,line) + if not ok then + splitdata[i] = "" + report("removing line with invalid utf: %s",line) end end + -- check for commands being used in comments end - data = data:gsub("%%.-[\n\r]","") - data = data:gsub(" *[\n\r]+","\n") - local patterns = data:match("\\patterns[%s]*{[%s]*(.-)[%s]*}") or "" - local hyphenations = data:match("\\hyphenation[%s]*{[%s]*(.-)[%s]*}") or "" - patterns = patterns:gsub(" +","\n") - hyphenations = hyphenations:gsub(" +","\n") - local p, h = { }, { } - local pats, hyps = { } , { } - local pused, hused = { } , { } - local period = byte(".") - for line in patterns:gmatch("[^ \n\r]+") do - local ok = true - for b in line:utfvalues() do - if b == period then - -- ok - else - local ct = cd[b].category - if ct == "lu" or ct == "ll" then - pused[char(b)] = true - elseif ct == "nd" then - -- ok + check(patterns,splitpatternsnew,patfile) + check(hyphenations,splithyphenationsnew,hypfile) + end + if okay then + -- remove funny lines + local cd = characters.data + local stripped = { } + local function check(splitdata,special,name) + local used = { } + for i=1,#splitdata do + local line = splitdata[i] + for b in line:utfvalues() do -- could be an lpeg + if b == special then + -- not registered + elseif permitted_characters[b] then + used[char(b)] = true else - p[b] = (p[b] or 0) + 1 - ok = false + local cdb = cd[b] + if not cdb then + report("no entry in chardata for character %s (0x%04X)",char(b),b) + else + local ct = cd[b].category + if ct == "lu" or ct == "ll" then + used[char(b)] = true + elseif ct == "nd" then + -- number + else + report("removing line with suspected utf character %s (0x%04X), category %s: %s",char(b),b,ct,line) + splitdata[i] = "" + break + end + end end end end - if ok then - pats[#pats+1] = line - end + return used end - local hyphen = byte("-") - for line in hyphenations:gmatch("[^ \n\r]+") do - local ok = true - for b in line:utfvalues() do - if b == hyphen then - -- ok - else - local ct = cd[b].category - if ct == "lu" or ct == "ll" then - hused[char(b)] = true + usedpatterncharacters = check(splitpatternsnew,byte(".")) + usedhyphenationcharacters = check(splithyphenationsnew,byte("-")) + for k, v in next, stripped do + report("entries that contain character %s (0x%04X) have been omitted",char(k),k) + end + end + if okay then + local function stripped(what,ignored) + -- ignored (per language) + local p = nil + if ignored then + for k, v in next, ignored do + if p then + p = p + lpeg.P(char(k)) else - h[b] = (h[b] or 0) + 1 - ok = false + p = lpeg.P(char(k)) end end + p = lpeg.P{ p + 1 * lpeg.V(1) } -- anywhere end - if ok then - hyps[#hyps+1] = line - end - end - local stripped = { } - for k, v in next, p do - if mnemonic then - logs.simple("invalid character %s (0x%04X) in patterns of language %s, file %s, n=%s",char(k),k,mnemonic,name,v) - else - logs.simple("invalid character %s (0x%04X) in patterns of file %s, n=%s",char(k),k,name,v) + -- replaced (all languages) + local r = nil + for k, v in next, replaced_whatever do + if r then + r = r + lpeg.P(k)/v + else + r = lpeg.P(k)/v + end end - if not permitted_characters[k] then - okay = false - else - stripped[k] = true + r = lpeg.Cs((r + 1)^0) + local result = { } + for i=1,#what do + local line = what[i] + if p and lpegmatch(p,line) then + report("discarding conflicting pattern: %s",line) + else -- we can speed this up by testing for replacements in the string + local l = lpegmatch(r,line) + if l ~= line then + report("sanitizing pattern: %s -> %s (for old patterns)",line,l) + end + result[#result+1] = l + end end + return result end - for k, v in next, h do - if mnemonic then - logs.simple("invalid character %s (0x%04X) in exceptions of language %s, file %s, n=%s",char(k),k,mnemonic,name,v) - else - logs.simple("invalid character %s (0x%04X) in exceptions of file %s, n=%s",char(k),k,name,v) - end - if not permitted_characters[k] then - okay = false - else - stripped[k] = true + + splitpatternsold = stripped(splitpatternsnew,ignored) + splithyphenationsold = stripped(splithyphenationsnew,ignored) + + end + if okay then + -- discarding duplicates + local function check(data,splitdata,name) + local used, collected = { }, { } + for i=1,#splitdata do + local line = splitdata[i] + if line == "" then + -- discard + elseif used[line] then + -- discard + repo("discarding duplicate pattern: %s",line) + else + used[line] = true + collected[#collected+1] = line + end end + return collected end - local stripset = "" - for k, v in next, stripped do - logs.simple("entries that contain character %s will be omitted",char(k)) - stripset = stripset .. "%" .. char(k) - end - return okay, pats, hyps, comment, stripset, pused, hused - else - if mnemonic then - logs.simple("no file %s for language %s",fullname,mnemonic) - else - logs.simple("no file %s",fullname) - end - return false, { }, { }, "", "", { }, { } + splitpatternsnew = check(patterns,splitpatternsnew,patfile) + splithyphenationsnew = check(hyphenations,splithyphenationsnew,hypfile) + splitpatternsold = check(patterns,splitpatternsold,patfile) + splithyphenationsold = check(hyphenations,splithyphenationsold,hypfile) + end + if not okay then + report("no valid file %s.*",name) end + return okay, splitpatternsnew, splithyphenationsnew, splitpatternsold, splithyphenationsold, comment, stripset, usedpatterncharacters, usedhyphenationcharacters end -function scripts.patterns.save(destination,mnemonic,patterns,hyphenations,comment,stripped,pused,hused) - local nofpatterns = #patterns - local nofhyphenations = #hyphenations - local pu = table.concat(table.sortedkeys(pused), " ") - local hu = table.concat(table.sortedkeys(hused), " ") - logs.simple("language %s has %s patterns and %s exceptions",mnemonic,nofpatterns,nofhyphenations) +function scripts.patterns.save(destination,mnemonic,name,patternsnew,hyphenationsnew,patternsold,hyphenationsold,comment,stripped,pused,hused,ignored) + local nofpatternsnew, nofhyphenationsnew = #patternsnew, #hyphenationsnew + local nofpatternsold, nofhyphenationsold = #patternsold, #hyphenationsold + report("language %s has %s old and %s new patterns and %s old and %s new exceptions",mnemonic,nofpatternsold,nofpatternsnew,nofhyphenationsold,nofhyphenationsnew) if mnemonic ~= "??" then + local pu = concat(table.sortedkeys(pused), " ") + local hu = concat(table.sortedkeys(hused), " ") + local rmefile = file.join(destination,"lang-"..mnemonic..".rme") local patfile = file.join(destination,"lang-"..mnemonic..".pat") local hypfile = file.join(destination,"lang-"..mnemonic..".hyp") + local luafile = file.join(destination,"lang-"..mnemonic..".lua") -- suffix might change to llg + local topline = "% generated by mtxrun --script pattern --convert" local banner = "% for comment and copyright, see " .. rmefile - logs.simple("saving language data for %s",mnemonic) + report("saving language data for %s",mnemonic) if not comment or comment == "" then comment = "% no comment" end if not type(destination) == "string" then destination = "." end + + local lines = string.splitlines(comment) + for i=1,#lines do + if not find(lines[i],"^%%") then + lines[i] = "% " .. lines[i] + end + end + + local metadata = { + -- texcomment = comment, + texcomment = concat(lines,"\n"), + source = name, + mnemonic = mnemonic, + } + + local patterndata, hyphenationdata + if nofpatternsnew > 0 then + patterndata = { + n = nofpatternsnew, + data = concat(patternsnew," ") or nil, + characters = concat(table.sortedkeys(pused),""), + minhyphenmin = 1, -- determined by pattern author + minhyphenmax = 1, -- determined by pattern author + } + else + patterndata = { + n = 0, + } + end + if nofhyphenationsnew > 0 then + hyphenationdata = { + n = nofhyphenationsnew, + data = concat(hyphenationsnew," "), + characters = concat(table.sortedkeys(hused),""), + } + else + hyphenationdata = { + n = 0, + } + end + local data = { + -- a prelude to language goodies, like we have font goodies and in + -- mkiv we can use this file directly + version = "1.001", + comment = topline, + metadata = metadata, + patterns = patterndata, + exceptions = hyphenationdata, + } + os.remove(rmefile) os.remove(patfile) os.remove(hypfile) + os.remove(luafile) + io.savedata(rmefile,format("%s\n\n%s",topline,comment)) - io.savedata(patfile,format("%s\n\n%s\n\n%% used: %s\n\n\\patterns{\n%s}",topline,banner,pu,table.concat(patterns,"\n"))) - io.savedata(hypfile,format("%s\n\n%s\n\n%% used: %s\n\n\\hyphenation{\n%s}",topline,banner,hu,table.concat(hyphenations,"\n"))) + io.savedata(patfile,format("%s\n\n%s\n\n%% used: %s\n\n\\patterns{\n%s}",topline,banner,pu,concat(patternsold,"\n"))) + io.savedata(hypfile,format("%s\n\n%s\n\n%% used: %s\n\n\\hyphenation{\n%s}",topline,banner,hu,concat(hyphenationsold,"\n"))) + io.savedata(luafile,table.serialize(data,true)) end end function scripts.patterns.prepare() - dofile(resolvers.find_file("char-def.lua")) + dofile(resolvers.findfile("char-def.lua")) end function scripts.patterns.check() local path = environment.argument("path") or "." - local found = false local files = environment.files + local only = false if #files > 0 then - for i=1,#files do - local name = files[i] - logs.simple("checking language file %s", name) - local okay = scripts.patterns.load(path,name,nil,not environment.argument("fast")) - if #environment.files > 1 then - logs.simple("") - end - end - else - for k, v in next, scripts.patterns.list do - local mnemonic, name = v[1], v[2] - logs.simple("checking language %s, file %s", mnemonic, name) - local okay = scripts.patterns.load(path,name,mnemonic,not environment.argument("fast")) + only = table.tohash(files) + end + for k, v in next, scripts.patterns.list do + local mnemonic, name, ignored = v[1], v[2], v[4] + if not only or only[mnemonic] then + report("checking language %s, file %s", mnemonic, name) + local okay = scripts.patterns.load(path,name,mnemonic,ignored) if not okay then - logs.simple("there are errors that need to be fixed") + report("there are errors that need to be fixed") end - logs.simple("") + report() end end end @@ -319,36 +460,34 @@ end function scripts.patterns.convert() local path = environment.argument("path") or "." if path == "" then - logs.simple("provide sourcepath using --path ") + report("provide sourcepath using --path ") else local destination = environment.argument("destination") or "." if path == destination then - logs.simple("source path and destination path should differ (use --path and/or --destination)") + resport("source path and destination path should differ (use --path and/or --destination)") else + local files = environment.files + local only = false + if #files > 0 then + only = table.tohash(files) + end for k, v in next, scripts.patterns.list do - local mnemonic, name = v[1], v[2] - logs.simple("converting language %s, file %s", mnemonic, name) - local okay, patterns, hyphenations, comment, stripped, pused, hused = scripts.patterns.load(path,name,false) - if okay then - scripts.patterns.save(destination,mnemonic,patterns,hyphenations,comment,stripped,pused,hused) - else - logs.simple("convertion aborted due to error(s)") + local mnemonic, name, ignored = v[1], v[2], v[4] + if not only or only[mnemonic] then + report("converting language %s, file %s", mnemonic, name) + local okay, patternsnew, hyphenationsnew, patternsold, hyphenationsold, comment, stripped, pused, hused = scripts.patterns.load(path,name,mnemonic,ignored) + if okay then + scripts.patterns.save(destination,mnemonic,name,patternsnew,hyphenationsnew,patternsold,hyphenationsold,comment,stripped,pused,hused,ignored) + else + report("convertion aborted due to error(s)") + end + report() end - logs.simple("") end end end end -logs.extendbanner("ConTeXt Pattern File Management 0.20",true) - -messages.help = [[ ---convert generate context language files (mnemonic driven, if not given then all) ---check check pattern file (or those used by context when no file given) - ---fast only report filenames, no lines -]] - if environment.argument("check") then scripts.patterns.prepare() scripts.patterns.check() @@ -356,11 +495,10 @@ elseif environment.argument("convert") then scripts.patterns.prepare() scripts.patterns.convert() else - logs.help(messages.help) + application.help() end -- mtxrun --script pattern --check hyph-*.tex -- mtxrun --script pattern --check --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns --- mtxrun --script pattern --check --fast --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns --- mtxrun --script pattern --convert --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns --destination=e:/tmp/patterns --- mtxrun --script pattern --convert --path=c:/data/develop/svn-hyphen/branches/luatex/hyph-utf8/tex/generic/hyph-utf8/patterns/tex --destination=e:/tmp/patterns +-- mtxrun --script pattern --convert --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns/tex --destination=e:/tmp/patterns +-- mtxrun --script pattern --convert --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns/txt --destination=e:/tmp/patterns diff --git a/Master/texmf-dist/scripts/context/lua/mtx-profile.lua b/Master/texmf-dist/scripts/context/lua/mtx-profile.lua index 11d48d0399b..74e1d153845 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-profile.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-profile.lua @@ -11,6 +11,19 @@ if not modules then modules = { } end modules ['mtx-profile'] = { local match, format, find = string.match, string.format, string.find +local helpinfo = [[ +--analyze analyze lua calls +--trace analyze tex calls +]] + +local application = logs.application { + name = "mtx-cache", + banner = "ConTeXt MkIV LuaTeX Profiler 1.00", + helpinfo = helpinfo, +} + +local report = application.report + scripts = scripts or { } scripts.profiler = scripts.profiler or { } @@ -23,7 +36,7 @@ local calltemplate = "%9i %s" local totaltemplate = "%i internal calls, %i function calls taking %3.4f seconds" local thresholdtemplate = "thresholds: %i internal calls, %i function calls, %i seconds" -function scripts.profiler.analyse(filename) +function scripts.profiler.analyze(filename) local f = io.open(filename) if f then local times, counts, calls = { }, { }, { } @@ -54,7 +67,7 @@ function scripts.profiler.analyse(filename) f:close() print("") local loaded = { } - local sortedtable.sortedkeys(times) + sortedtable.sortedkeys(times) for i=1,#sorted do local filename = sorted[i] local functions = times[filename] @@ -101,7 +114,7 @@ function scripts.profiler.analyse(filename) end end -function scripts.profiler.x_analyse(filename) +function scripts.profiler.x_analyze(filename) local f = io.open(filename) local calls = { } local lines = 0 @@ -151,20 +164,13 @@ local criterium = 100 end end ---~ scripts.profiler.analyse("t:/manuals/mk/mk-fonts-profile.lua") ---~ scripts.profiler.analyse("t:/manuals/mk/mk-introduction-profile.lua") - -logs.extendbanner("ConTeXt MkIV LuaTeX Profiler 1.00",true) - -messages.help = [[ ---analyse analyse lua calls ---trace analyse tex calls -]] +--~ scripts.profiler.analyze("t:/manuals/mk/mk-fonts-profile.lua") +--~ scripts.profiler.analyze("t:/manuals/mk/mk-introduction-profile.lua") -if environment.argument("analyse") then - scripts.profiler.analyse(environment.files[1] or "luatex-profile.log") +if environment.argument("analyze") then + scripts.profiler.analyze(environment.files[1] or "luatex-profile.log") elseif environment.argument("trace") then - scripts.profiler.analyse(environment.files[1] or "temp.log") + scripts.profiler.analyze(environment.files[1] or "temp.log") else - logs.help(messages.help) + application.help() end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-scite.lua b/Master/texmf-dist/scripts/context/lua/mtx-scite.lua index d5f0a5344e5..0ac09b01702 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-scite.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-scite.lua @@ -9,6 +9,19 @@ if not modules then modules = { } end modules ['mtx-scite'] = { -- todo: append to global properties else order of loading problem -- linux problem ... files are under root protection so we need --install +local helpinfo = [[ +--start [--verbose] start scite +--test report what will happen +]] + +local application = logs.application { + name = "mtx-scite", + banner = "Scite Startup Script 1.00", + helpinfo = helpinfo, +} + +local report = application.report + scripts = scripts or { } scripts.scite = scripts.scite or { } @@ -30,11 +43,11 @@ function scripts.scite.start(indeed) local binpaths = file.split_path(os.getenv("PATH")) or file.split_path(os.getenv("path")) for i=1,#scitesignals do local scitesignal = scitesignals[i] - local scitepath = resolvers.find_file(scitesignal,"other text files") or "" + local scitepath = resolvers.findfile(scitesignal,"other text files") or "" if scitepath ~= "" then scitepath = file.dirname(scitepath) -- data if scitepath == "" then - scitepath = resolvers.clean_path(lfs.currentdir()) + scitepath = resolvers.cleanpath(lfs.currentdir()) else usedsignal, datapath = scitesignal, scitepath break @@ -42,11 +55,11 @@ function scripts.scite.start(indeed) end end if not datapath or datapath == "" then - logs.simple("invalid datapath, maybe you need to regenerate the file database") + report("invalid datapath, maybe you need to regenerate the file database") return false end if not binpaths or #binpaths == 0 then - logs.simple("invalid binpath") + report("invalid binpath") return false end for i=1,#binpaths do @@ -57,15 +70,15 @@ function scripts.scite.start(indeed) end end if not fullname then - logs.simple("unable to locate %s",workname) + report("unable to locate %s",workname) return false end local properties = dir.glob(file.join(datapath,"*.properties")) local luafiles = dir.glob(file.join(datapath,"*.lua")) - local extrafont = resolvers.find_file(screenfont,"truetype font") or "" + local extrafont = resolvers.findfile(screenfont,"truetype font") or "" local pragmafound = dir.glob(file.join(datapath,"pragma.properties")) if userpath == "" then - logs.simple("unable to figure out userpath") + report("unable to figure out userpath") return false end local verbose = environment.argument("verbose") @@ -120,47 +133,40 @@ function scripts.scite.start(indeed) end end if not indeed or verbose then - logs.simple("used signal: %s", usedsignal) - logs.simple("data path : %s", datapath) - logs.simple("full name : %s", fullname) - logs.simple("user path : %s", userpath) - logs.simple("extra font : %s", extrafont) + report("used signal: %s", usedsignal) + report("data path : %s", datapath) + report("full name : %s", fullname) + report("user path : %s", userpath) + report("extra font : %s", extrafont) end if #logdata > 0 then - logs.simple("") + report("") for k=1,#logdata do local v = logdata[k] - logs.simple(v[1],v[2]) + report(v[1],v[2]) end end if indeed then if #tobecopied > 0 then - logs.simple("warning : copying updated files") + report("warning : copying updated files") for i=1,#tobecopied do local what = tobecopied[i] - logs.simple("copying : '%s' => '%s'",what[1],what[2]) + report("copying : '%s' => '%s'",what[1],what[2]) file.copy(what[1],what[2]) end end if propfiledone then - logs.simple("saving : '%s'",userpropfile) + report("saving : '%s'",userpropfile) io.savedata(fullpropfile,userpropdata) end os.launch(fullname) end end -logs.extendbanner("Scite Startup Script 1.00",true) - -messages.help = [[ ---start [--verbose] start scite ---test report what will happen -]] - if environment.argument("start") then scripts.scite.start(true) elseif environment.argument("test") then scripts.scite.start() else - logs.help(messages.help) + application.help() end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-server-ctx-fonttest.lua b/Master/texmf-dist/scripts/context/lua/mtx-server-ctx-fonttest.lua index b2a993bf836..b30cf017525 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-server-ctx-fonttest.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-server-ctx-fonttest.lua @@ -6,18 +6,20 @@ if not modules then modules = { } end modules ['mtx-server-ctx-fonttest'] = { license = "see context related readme files" } ---~ dofile(resolvers.find_file("l-aux.lua","tex")) -dofile(resolvers.find_file("trac-lmx.lua","tex")) -dofile(resolvers.find_file("font-ott.lua","tex")) -dofile(resolvers.find_file("font-syn.lua","tex")) -dofile(resolvers.find_file("font-mis.lua","tex")) -dofile(resolvers.find_file("font-otp.lua","tex")) +--~ dofile(resolvers.findfile("l-aux.lua","tex")) +dofile(resolvers.findfile("trac-lmx.lua","tex")) +dofile(resolvers.findfile("font-ott.lua","tex")) +dofile(resolvers.findfile("font-syn.lua","tex")) +dofile(resolvers.findfile("font-mis.lua","tex")) +--~ dofile(resolvers.findfile("font-otp.lua","tex")) local format, gsub, concat, match, find = string.format, string.gsub, table.concat, string.match, string.find +local report = logs.reporter("ctx-fonttest") + local sample_line = "This is a sample line!" local tempname = "mtx-server-ctx-fonttest-temp" -local temppath = caches.setpath("temp","mtx-server-ctx-fonttest") +local temppath = caches.setfirstwritablefile("temp","mtx-server-ctx-fonttest") local basename = "mtx-server-ctx-fonttest-data.lua" local basepath = temppath @@ -33,7 +35,7 @@ local process_templates = { } process_templates.default = [[ \starttext \setcharactermirroring[1] - \definefontfeature[sample][analyse=yes,%s] + \definefontfeature[sample][analyze=yes,%s] \definedfont[name:%s*sample] \startTEXpage[offset=3pt] \detokenize{%s} @@ -150,20 +152,20 @@ local cache = { } local function showfeatures(f) if f then - logs.simple("processing font '%s'",f) + report("processing font '%s'",f) local features = cache[f] if features == nil then - features = fonts.get_features(resolvers.find_file(f)) + features = fonts.helpers.getfeatures(resolvers.findfile(f)) if not features then - logs.simple("building cache for '%s'",f) + report("building cache for '%s'",f) io.savedata(file.join(temppath,file.addsuffix(tempname,"tex")),format(process_templates.cache,f,f)) os.execute(format("mtxrun --path=%s --script context --once --batchmode %s",temppath,tempname)) - features = fonts.get_features(f) + features = fonts.helpers.getfeatures(f) end cache[f] = features or false - logs.simple("caching info of '%s'",f) + report("caching info of '%s'",f) else - logs.simple("using cached info of '%s'",f) + report("using cached info of '%s'",f) end if features then local scr, lan, fea, rev = { }, { }, { }, { } @@ -294,7 +296,7 @@ local function get_specification(name) end local function edit_font(currentfont,detail,tempname) - logs.simple("entering edit mode for '%s'",currentfont) + report("entering edit mode for '%s'",currentfont) local specification = get_specification(currentfont) if specification then local htmldata = showfeatures(specification.filename) @@ -303,7 +305,7 @@ local function edit_font(currentfont,detail,tempname) local sorted = table.sortedkeys(htmldata.scripts) for k=1,#sorted do local v = sorted[k] - local s = fonts.otf.tables.scripts[v] or v + local s = fonts.handlers.otf.tables.scripts[v] or v if detail and v == detail.script then scripts[#scripts+1] = format(" %s",s,v,v,v,v) else @@ -313,7 +315,7 @@ local function edit_font(currentfont,detail,tempname) local sorted = table.sortedkeys(htmldata.languages) for k=1,#sorted do local v = sorted[k] - local l = fonts.otf.tables.languages[v] or v + local l = fonts.handlers.otf.tables.languages[v] or v if detail and v == detail.language then languages[#languages+1] = format(" %s",l,v,v,v,v) else @@ -323,7 +325,7 @@ local function edit_font(currentfont,detail,tempname) local sorted = table.sortedkeys(htmldata.features) for k=1,#sorted do local v = sorted[k] - local f = fonts.otf.tables.features[v] or v + local f = fonts.handlers.otf.tables.features[v] or v if detail and detail["f-"..v] then features[#features+1] = format(" %s",f,v,v,v,v) else @@ -374,7 +376,7 @@ local function process_font(currentfont,detail) -- maybe just fontname end local sample = string.strip(detail.sampletext or "") if sample == "" then sample = sample_line end - logs.simple("sample text: %s",sample) + report("sample text: %s",sample) io.savedata(file.join(temppath,file.addsuffix(tempname,"tex")),format(variant,concat(features,","),currentfont,sample)) os.execute(format("mtxrun --path=%s --script context --once --batchmode %s",temppath,tempname)) return edit_font(currentfont,detail,tempname) @@ -406,7 +408,7 @@ end local function show_font(currentfont,detail) local specification = get_specification(currentfont) - local features = fonts.get_features(specification.filename) + local features = fonts.helpers.getfeatures(specification.filename) local result = { } result[#result+1] = format("

names

",what) result[#result+1] = "" @@ -444,7 +446,7 @@ local function show_font(currentfont,detail) else done = true end - local title = fonts.otf.tables.features[f] or "" + local title = fonts.handlers.otf.tables.features[f] or "" result[#result+1] = format("",title,f,s,concat(table.sortedkeys(ss)," ")) end end @@ -497,7 +499,7 @@ local function loadbase() if storage == "" then storage = { } else - logs.simple("loading '%s'",datafile) + report("loading '%s'",datafile) storage = loadstring(storage) storage = (storage and storage()) or { } end @@ -527,14 +529,14 @@ end local function savebase(storage,name) local datafile = file.join(basepath,basename) - logs.simple("saving '%s' in '%s'",name or "data",datafile) + report("saving '%s' in '%s'",name or "data",datafile) io.savedata(datafile,table.serialize(storage,true)) end local function deletestored(detail,currentfont,name) local storage = loadbase() if storage and name and storage[name] then - logs.simple("deleting '%s' from base",name) + report("deleting '%s' from base",name) storage[name] = nil savebase(storage) end @@ -610,7 +612,7 @@ end function extras.reload() local command = "mtxrun --script font --reload" - logs.simple("run command: %s",command) + report("run command: %s",command) os.execute(command) return do_extras() end @@ -679,7 +681,7 @@ function doit(configuration,filename,hashed) variables.javascripts = "" variables.javascriptinit = "" - logs.simple("action: %s",action or "no action") + report("action: %s",action or "no action") local result @@ -722,7 +724,7 @@ function doit(configuration,filename,hashed) result = { content = lmx.convert('context-fonttest.lmx',false,variables) } - logs.simple("time spent on page: %0.03f seconds",os.clock()-start) + report("time spent on page: %0.03f seconds",os.clock()-start) return result diff --git a/Master/texmf-dist/scripts/context/lua/mtx-server-ctx-help.lua b/Master/texmf-dist/scripts/context/lua/mtx-server-ctx-help.lua index 2f072f97747..15f393853c1 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-server-ctx-help.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-server-ctx-help.lua @@ -8,15 +8,17 @@ if not modules then modules = { } end modules ['mtx-server-ctx-help'] = { -- todo in lua interface: noargument, oneargument, twoarguments, threearguments ---~ dofile(resolvers.find_file("l-aux.lua","tex")) ---~ dofile(resolvers.find_file("l-url.lua","tex")) -dofile(resolvers.find_file("trac-lmx.lua","tex")) +--~ dofile(resolvers.findfile("l-aux.lua","tex")) +--~ dofile(resolvers.findfile("l-url.lua","tex")) +dofile(resolvers.findfile("trac-lmx.lua","tex")) -- problem ... serialize parent stack local format = string.format local concat = table.concat +local report = logs.reporter("ctx-help") + -- -- -- make this a module: cont-xx.lua document = document or { } @@ -329,7 +331,7 @@ document.setups.showsources = true document.setups.mode = 1 function document.setups.load(filename) - filename = resolvers.find_file(filename) or "" + filename = resolvers.findfile(filename) or "" if filename ~= "" then local current = document.setups.loaded[filename] if not current then @@ -574,7 +576,7 @@ local variables = { } --~ function lmx.loadedfile(filename) ---~ return io.loaddata(resolvers.find_file(filename)) -- return resolvers.texdatablob(filename) +--~ return io.loaddata(resolvers.findfile(filename)) -- return resolvers.texdatablob(filename) --~ end local function doit(configuration,filename,hashed) @@ -591,7 +593,7 @@ local function doit(configuration,filename,hashed) lastmode = tonumber(detail.mode or lastmode) or 1 if lastinterface then - logs.simple("checking interface: %s",lastinterface) + report("checking interface: %s",lastinterface) document.setups.load(format("cont-%s.xml",lastinterface)) end @@ -632,7 +634,7 @@ local function doit(configuration,filename,hashed) if document.setups.showsources and lastsource and lastsource ~= "" then -- todo: mkii, mkiv, tex (can be different) - local data = io.loaddata(resolvers.find_file(lastsource)) + local data = io.loaddata(resolvers.findfile(lastsource)) variables.maintitle = lastsource variables.maintext = formats.listing:format(data) lastsource = "" @@ -657,7 +659,7 @@ local function doit(configuration,filename,hashed) local content = lmx.convert('context-help.lmx',false,variables) - logs.simple("time spent on page: %0.03f seconds",os.clock()-start) + report("time spent on page: %0.03f seconds",os.clock()-start) return { content = content } end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-server-ctx-startup.lua b/Master/texmf-dist/scripts/context/lua/mtx-server-ctx-startup.lua index 59536c36cdb..55680511314 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-server-ctx-startup.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-server-ctx-startup.lua @@ -6,12 +6,12 @@ if not modules then modules = { } end modules ['mtx-server-ctx-startup'] = { license = "see context related readme files" } -dofile(resolvers.find_file("trac-lmx.lua","tex")) +dofile(resolvers.findfile("trac-lmx.lua","tex")) function doit(configuration,filename,hashed) local list = { } - local root = file.dirname(resolvers.find_file("mtx-server.lua") or ".") + local root = file.dirname(resolvers.findfile("mtx-server.lua") or ".") if root == "" then root = "." end local pattern = root .. "/mtx-server-ctx-*.lua" local files = dir.glob(pattern) diff --git a/Master/texmf-dist/scripts/context/lua/mtx-server.lua b/Master/texmf-dist/scripts/context/lua/mtx-server.lua index dc0befcaa2f..4547877b5ef 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-server.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-server.lua @@ -6,11 +6,28 @@ if not modules then modules = { } end modules ['mtx-server'] = { license = "see context related readme files" } +local helpinfo = [[ +--start start server +--port port to listen to +--root server root +--scripts scripts sub path +--index index file +--auto start on own path +]] + +local application = logs.application { + name = "mtx-server", + banner = "Simple Webserver For Helpers 0.10", + helpinfo = helpinfo, +} + +local report = application.report + scripts = scripts or { } scripts.webserver = scripts.webserver or { } -dofile(resolvers.find_file("l-url.lua","tex")) -dofile(resolvers.find_file("luat-soc.lua","tex")) +dofile(resolvers.findfile("l-url.lua","tex")) +dofile(resolvers.findfile("luat-soc.lua","tex")) local socket = socket or require("socket") -- redundant in future version local format = string.format @@ -127,7 +144,7 @@ local handlers = { } local function errormessage(client,configuration,n) local data = format("%s %s

%s %s

",n,messages[n],n,messages[n]) - logs.simple("handling error %s: %s",n,messages[n]) + report("handling error %s: %s",n,messages[n]) handlers.generic(client,configuration,data,nil,true) end @@ -136,7 +153,7 @@ local validpaths, registered = { }, { } function scripts.webserver.registerpath(name) if not registered[name] then local cleanname = string.gsub(name,"%.%.","deleted-parent") - logs.simple("registering path '%s'",cleanname) + report("registering path '%s'",cleanname) validpaths[#validpaths+1] = cleanname registered[name] = true end @@ -145,7 +162,7 @@ end function handlers.generic(client,configuration,data,suffix,iscontent) if not iscontent then local name = data - logs.simple("requested file '%s'",name) + report("requested file '%s'",name) local fullname = file.join(configuration.root,name) data = io.loaddata(fullname) or "" if data == "" then @@ -153,12 +170,12 @@ function handlers.generic(client,configuration,data,suffix,iscontent) local fullname = file.join(validpaths[n],name) data = io.loaddata(fullname) or "" if data ~= "" then - logs.simple("sending generic file '%s'",fullname) + report("sending generic file '%s'",fullname) break end end else - logs.simple("sending generic file '%s'",fullname) + report("sending generic file '%s'",fullname) end end if data and data ~= "" then @@ -192,18 +209,18 @@ function handlers.lua(client,configuration,filename,suffix,iscontent,hashed) -- -- todo: split url in components, see l-url; rather trivial local result, keep = loaded[filename], false if result then - logs.simple("reusing script: %s",filename) + report("reusing script: %s",filename) else - logs.simple("locating script: %s",filename) + report("locating script: %s",filename) if lfs.isfile(filename) then - logs.simple("loading script: %s",filename) + report("loading script: %s",filename) result = loadfile(filename) - logs.simple("return type: %s",type(result)) + report("return type: %s",type(result)) if result and type(result) == "function" then -- result() should return a table { [type=,] [length=,] content= }, function or string result, keep = result() if keep then - logs.simple("saving script: %s",type(result)) + report("saving script: %s",type(result)) loaded[filename] = result end end @@ -262,7 +279,7 @@ function scripts.webserver.run(configuration) end end end - configuration.root = dir.expand_name(configuration.root) + configuration.root = dir.expandname(configuration.root) if not configuration.index then for i=1,#indices do local name = indices[i] @@ -274,14 +291,14 @@ function scripts.webserver.run(configuration) configuration.index = configuration.index or "unknown" end if not configuration.scripts or configuration.scripts == "" then - configuration.scripts = dir.expand_name(file.join(configuration.root or ".",configuration.scripts or ".")) + configuration.scripts = dir.expandname(file.join(configuration.root or ".",configuration.scripts or ".")) end -- so far for checks - logs.simple("running at port: %s",configuration.port) - logs.simple("document root: %s",configuration.root or resolvers.ownpath) - logs.simple("main index file: %s",configuration.index) - logs.simple("scripts subpath: %s",configuration.scripts) - logs.simple("context services: http://localhost:%s/mtx-server-ctx-startup.lua",configuration.port) + report("running at port: %s",configuration.port) + report("document root: %s",configuration.root or resolvers.ownpath) + report("main index file: %s",configuration.index) + report("scripts subpath: %s",configuration.scripts) + report("context services: http://localhost:%s/mtx-server-ctx-startup.lua",configuration.port) local server = assert(socket.bind("*", configuration.port)) --~ local reading = { server } while true do -- no multiple clients @@ -295,26 +312,27 @@ function scripts.webserver.run(configuration) errormessage(client,configuration,404) else local from = client:getpeername() - logs.simple("request from: %s",tostring(from)) + report("request from: %s",tostring(from)) local fullurl = request:match("GET (.+) HTTP/.*$") -- todo: more clever fullurl = socket.url.unescape(fullurl) local hashed = url.hashed(fullurl) local query = url.query(hashed.query) local filename = hashed.path +--~ table.print(hashed) if filename then filename = socket.url.unescape(filename) - logs.simple("requested action: %s",filename) + report("requested action: %s",filename) if filename:find("%.%.") then filename = nil -- invalid path end if filename == nil or filename == "" or filename == "/" then filename = configuration.index - logs.simple("invalid filename, forcing: %s",filename) + report("invalid filename, forcing: %s",filename) end local suffix = file.extname(filename) local action = handlers[suffix] or handlers.generic if action then - logs.simple("performing action: %s",filename) + report("performing action: %s",filename) action(client,configuration,filename,suffix,false,hashed) -- filename and no content else errormessage(client,configuration,404) @@ -324,23 +342,12 @@ function scripts.webserver.run(configuration) end end client:close() - logs.simple("time spent with client: %0.03f seconds",os.clock()-start) + report("time spent with client: %0.03f seconds",os.clock()-start) end end -logs.extendbanner("Simple Webserver For Helpers 0.10") - -messages.help = [[ ---start start server ---port port to listen to ---root server root ---scripts scripts sub path ---index index file ---auto start on own path -]] - if environment.argument("auto") then - local path = resolvers.find_file("mtx-server.lua") or "." + local path = resolvers.findfile("mtx-server.lua") or "." scripts.webserver.run { port = environment.argument("port"), root = environment.argument("root") or file.dirname(path) or ".", @@ -354,8 +361,8 @@ elseif environment.argument("start") then scripts = environment.argument("scripts"), } else - logs.help(messages.help) + application.help() end --- mtxrun --script server --start => http://localhost:8080/mtx-server-ctx-help.lua +-- mtxrun --script server --start => http://localhost:31415/mtx-server-ctx-startup.lua diff --git a/Master/texmf-dist/scripts/context/lua/mtx-texworks.lua b/Master/texmf-dist/scripts/context/lua/mtx-texworks.lua index 73ab846cd7f..33e56df468a 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-texworks.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-texworks.lua @@ -6,6 +6,19 @@ if not modules then modules = { } end modules ['mtx-texworks'] = { license = "see context related readme files" } +local helpinfo = [[ +--start [--verbose] start texworks +--test report what will happen +]] + +local application = logs.application { + name = "mtx-texworks", + banner = "TeXworks Startup Script 1.00", + helpinfo = helpinfo, +} + +local report = application.report + scripts = scripts or { } scripts.texworks = scripts.texworks or { } @@ -25,35 +38,35 @@ local texworkininame = "texworks.ini" function scripts.texworks.start(indeed) local workname = (os.type == "windows" and "texworks.exe") or "texworks" local fullname = nil - local binpaths = file.split_path(os.getenv("PATH")) or file.split_path(os.getenv("path")) + local binpaths = file.splitpath(os.getenv("PATH")) or file.splitpath(os.getenv("path")) local usedsignal = texworkssignal - local datapath = resolvers.find_file(usedsignal,"other text files") or "" + local datapath = resolvers.findfile(usedsignal,"other text files") or "" if datapath ~= "" then datapath = file.dirname(datapath) -- data if datapath == "" then - datapath = resolvers.clean_path(lfs.currentdir()) + datapath = resolvers.cleanpath(lfs.currentdir()) end else usedsignal = texworkininame - datapath = resolvers.find_file(usedsignal,"other text files") or "" + datapath = resolvers.findfile(usedsignal,"other text files") or "" if datapath == "" then usedsignal = string.lower(usedsignal) - datapath = resolvers.find_file(usedsignal,"other text files") or "" + datapath = resolvers.findfile(usedsignal,"other text files") or "" end if datapath ~= "" and lfs.isfile(datapath) then datapath = file.dirname(datapath) -- TUG datapath = file.dirname(datapath) -- data if datapath == "" then - datapath = resolvers.clean_path(lfs.currentdir()) + datapath = resolvers.cleanpath(lfs.currentdir()) end end end if datapath == "" then - logs.simple("invalid datapath, maybe you need to regenerate the file database") + report("invalid datapath, maybe you need to regenerate the file database") return false end if not binpaths or #binpaths == 0 then - logs.simple("invalid binpath") + report("invalid binpath") return false end for i=1,#binpaths do @@ -64,7 +77,7 @@ function scripts.texworks.start(indeed) end end if not fullname then - logs.simple("unable to locate %s",workname) + report("unable to locate %s",workname) return false end for i=1,#texworkspaths do @@ -73,27 +86,20 @@ function scripts.texworks.start(indeed) os.setenv("TW_INIPATH",datapath) os.setenv("TW_LIBPATH",datapath) if not indeed or environment.argument("verbose") then - logs.simple("used signal: %s", usedsignal) - logs.simple("data path : %s", datapath) - logs.simple("full name : %s", fullname) - logs.simple("set paths : TW_INIPATH TW_LIBPATH") + report("used signal: %s", usedsignal) + report("data path : %s", datapath) + report("full name : %s", fullname) + report("set paths : TW_INIPATH TW_LIBPATH") end if indeed then os.launch(fullname) end end -logs.extendbanner("TeXworks Startup Script 1.00",true) - -messages.help = [[ ---start [--verbose] start texworks ---test report what will happen -]] - if environment.argument("start") then scripts.texworks.start(true) elseif environment.argument("test") then scripts.texworks.start() else - logs.help(messages.help) + application.help() end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-timing.lua b/Master/texmf-dist/scripts/context/lua/mtx-timing.lua index 40e33cdaef0..03100e991af 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-timing.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-timing.lua @@ -8,8 +8,22 @@ if not modules then modules = { } end modules ['mtx-timing'] = { local format, gsub, concat = string.format, string.gsub, table.concat -dofile(resolvers.find_file("trac-tim.lua","tex")) -dofile(resolvers.find_file("trac-lmx.lua","tex")) +local helpinfo = [[ +--xhtml make xhtml file +--launch launch after conversion +--remove remove after launching +]] + +local application = logs.application { + name = "mtx-timing", + banner = "ConTeXt Timing Tools 0.10", + helpinfo = helpinfo, +} + +local report = application.report + +dofile(resolvers.findfile("trac-tim.lua","tex")) +dofile(resolvers.findfile("trac-lmx.lua","tex")) local meta = [[ beginfig(%s) ; @@ -57,6 +71,8 @@ local directrun = true local what = { "parameters", "nodes" } +plugins = plugins or { } -- brrr, will become moduledata as well + function plugins.progress.make_svg(filename,other) local metadata, menudata, c = { }, { }, 0 metadata[#metadata+1] = 'outputformat := "svg" ;' @@ -74,9 +90,9 @@ function plugins.progress.make_svg(filename,other) metadata[#metadata+1] = "end ." metadata = concat(metadata,"\n\n") if directrun then - dofile(resolvers.find_file("mlib-run.lua","tex")) + dofile(resolvers.findfile("mlib-run.lua","tex")) commands = commands or { } - commands.writestatus = logs.report + commands.writestatus = report local result = metapost.directrun("metafun","timing data","svg",true,metadata) return menudata, result else @@ -138,7 +154,7 @@ function plugins.progress.make_lmx_page(name,launch,remove) local htmldata = plugins.progress.makehtml(filename,other,menudata,metadata) lmx.htmfile = function(name) return name .. "-timing.xhtml" end - lmx.lmxfile = function(name) return resolvers.find_file(name,'tex') end + lmx.lmxfile = function(name) return resolvers.findfile(name,'tex') end local variables = { ['title-default'] = 'ConTeXt Timing Information', @@ -167,9 +183,9 @@ scripts.timings = scripts.timings or { } function scripts.timings.xhtml(filename) if filename == "" then - logs.simple("provide filename") + report("provide filename") elseif not plugins.progress.valid_file(filename) then - logs.simple("first run context again with the --timing option") + report("first run context again with the --timing option") else local basename = file.removesuffix(filename) local launch = environment.argument("launch") @@ -178,16 +194,8 @@ function scripts.timings.xhtml(filename) end end -logs.extendbanner("ConTeXt Timing Tools 0.10",true) - -messages.help = [[ ---xhtml make xhtml file ---launch launch after conversion ---remove remove after launching -]] - if environment.argument("xhtml") then scripts.timings.xhtml(environment.files[1] or "") else - logs.help(messages.help) + application.help() end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-tools.lua b/Master/texmf-dist/scripts/context/lua/mtx-tools.lua index bf4add16840..905b3aa8583 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-tools.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-tools.lua @@ -8,6 +8,33 @@ if not modules then modules = { } end modules ['mtx-tools'] = { local find, format, sub, rep, gsub, lower = string.find, string.format, string.sub, string.rep, string.gsub, string.lower +local helpinfo = [[ +--disarmutfbomb remove utf bomb if present + --force remove indeed + +--dirtoxml glob directory into xml + --pattern glob pattern (default: *) + --url url attribute (no processing) + --root the root of the globbed path (default: .) + --output output filename (console by default) + --recurse recurse into subdirecories + --stripname take pathpart of given pattern + --longname set name attributes to full path name + +--downcase + --pattern glob pattern (default: *) + --recurse recurse into subdirecories + --force downcase indeed +]] + +local application = logs.application { + name = "mtx-tools", + banner = "Some File Related Goodies 1.01", + helpinfo = helpinfo, +} + +local report = application.report + scripts = scripts or { } scripts.tools = scripts.tools or { } @@ -23,24 +50,24 @@ function scripts.tools.disarmutfbomb() if not data then -- just skip elseif find(data,bomb_1) then - logs.simple("file '%s' has a 2 character utf bomb",name) + report("file '%s' has a 2 character utf bomb",name) if force then io.savedata(name,(gsub(data,bomb_1,""))) end done = true elseif find(data,bomb_2) then - logs.simple("file '%s' has a 3 character utf bomb",name) + report("file '%s' has a 3 character utf bomb",name) if force then io.savedata(name,(gsub(data,bomb_2,""))) end done = true else - -- logs.simple("file '%s' has no utf bomb",name) + -- report("file '%s' has no utf bomb",name) end end end if done and not force then - logs.simple("use --force to do a real disarming") + report("use --force to do a real disarming") end end @@ -63,12 +90,12 @@ function scripts.tools.downcase() end) if n > 0 then if force then - logs.simple("%s files renamed",n) + report("%s files renamed",n) else - logs.simple("use --force to do a real rename (%s files involved)",n) + report("use --force to do a real rename (%s files involved)",n) end else - logs.simple("nothing to do") + report("nothing to do") end end @@ -111,7 +138,7 @@ function scripts.tools.dirtoxml() end if not pattern or pattern == "" then - logs.report('provide --pattern=') + report('provide --pattern=') return end @@ -123,7 +150,7 @@ function scripts.tools.dirtoxml() lfs.chdir(root) - local list = dir.collect_pattern(root,luapattern,recurse) + local list = dir.collectpattern(root,luapattern,recurse) if list[outputfile] then list[outputfile] = nil @@ -144,27 +171,6 @@ function scripts.tools.dirtoxml() end -logs.extendbanner("Some File Related Goodies 1.01",true) - -messages.help = [[ ---disarmutfbomb remove utf bomb if present - --force remove indeed - ---dirtoxml glob directory into xml - --pattern glob pattern (default: *) - --url url attribute (no processing) - --root the root of the globbed path (default: .) - --output output filename (console by default) - --recurse recurse into subdirecories - --stripname take pathpart of given pattern - --longname set name attributes to full path name - ---downcase - --pattern glob pattern (default: *) - --recurse recurse into subdirecories - --force downcase indeed -]] - if environment.argument("disarmutfbomb") then scripts.tools.disarmutfbomb() elseif environment.argument("dirtoxml") then @@ -172,5 +178,5 @@ elseif environment.argument("dirtoxml") then elseif environment.argument("downcase") then scripts.tools.downcase() else - logs.help(messages.help) + application.help() end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-unzip.lua b/Master/texmf-dist/scripts/context/lua/mtx-unzip.lua index f990f421032..645863426db 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-unzip.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-unzip.lua @@ -1,20 +1,32 @@ +if not modules then modules = { } end modules ['mtx-unzip'] = { + version = 1.001, + comment = "companion to mtxrun.lua", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + -- maybe --pattern -logs.extendbanner("Simple Unzipper 0.10") +local format = string.format -messages.help = [[ +local helpinfo = [[ --list list files in archive --junk flatten unzipped directory structure --extract extract files ]] +local application = logs.application { + name = "mtx-unzip", + banner = "Simple Unzipper 0.10", + helpinfo = helpinfo, +} + +local report = application.report + scripts = scripts or { } scripts.unzipper = scripts.unzipper or { } -function scripts.unzipper.help() - logs.help(messages.help) -end - function scripts.unzipper.opened() local filename = environment.files[1] if filename and filename ~= "" then @@ -24,7 +36,7 @@ function scripts.unzipper.opened() return zipfile end end - logs.report("unzip", "no zip file: " .. filename) + report("no zip file: %s",filename) return false end @@ -36,10 +48,13 @@ function scripts.unzipper.list() if #k.filename > n then n = #k.filename end end local files, paths, compressed, uncompressed = 0, 0, 0, 0 + local template_a = "%-"..n.."s" + local template_b = "%-"..n.."s % 9i % 9i" + local template_c = "\n%-"..n.."s % 9i % 9i" for k in zipfile:files() do if k.filename:find("/$") then paths = paths + 1 - print(string.format("%s", k.filename:rpadd(n," "))) + print(format(template_a, k.filename)) else files = files + 1 local cs, us = k.compressed_size, k.uncompressed_size @@ -49,10 +64,10 @@ function scripts.unzipper.list() if us > uncompressed then uncompressed = us end - print(string.format("%s % 9i % 9i", k.filename:rpadd(n," "),cs,us)) + print(format(template_b,k.filename,cs,us)) end - end - print(string.format("\n%s % 9i % 9i", (files .. " files, " .. paths .. " directories"):rpadd(n," "),compressed,uncompressed)) + end -- check following pattern, n is not enough + print(format(template_c,files .. " files, " .. paths .. " directories",compressed,uncompressed)) end end @@ -91,11 +106,11 @@ function scripts.unzipper.extract() end if environment.arguments["h"] or environment.arguments["help"] then - scripts.unzipper.help() + application.help() elseif environment.arguments["l"] or environment.arguments["list"] then scripts.unzipper.list(zipfile) elseif environment.files[1] then -- implicit --extract scripts.unzipper.extract(zipfile) else - scripts.unzipper.help() + application.help() end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-update.lua b/Master/texmf-dist/scripts/context/lua/mtx-update.lua index b56083d3809..750c7488692 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-update.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-update.lua @@ -11,7 +11,33 @@ if not modules then modules = { } end modules ['mtx-update'] = { -- Together with Arthur Reutenauer she made sure that it worked well on all -- platforms that matter. -local format, concat, gmatch = string.format, table.concat, string.gmatch +local helpinfo = [[ +--platform=string platform (windows, linux, linux-64, osx-intel, osx-ppc, linux-ppc) +--server=string repository url (rsync://contextgarden.net) +--module=string repository url (minimals) +--repository=string specify version (current, experimental) +--context=string specify version (current, latest, beta, yyyy.mm.dd) +--rsync=string rsync binary (rsync) +--texroot=string installation directory (not guessed for the moment) +--engine=string tex engine (luatex, pdftex, xetex) +--extras=string extra modules (can be list or 'all') +--goodies=string extra binaries (like scite and texworks) +--force instead of a dryrun, do the real thing +--update update minimal tree +--make also make formats and generate file databases +--keep don't delete unused or obsolete files +--state update tree using saved state +]] + +local application = logs.application { + name = "mtx-update", + banner = "ConTeXt Minimals Updater 0.22", + helpinfo = helpinfo, +} + +local report = application.report + +local format, concat, gmatch, gsub = string.format, table.concat, string.gmatch, string.gsub scripts = scripts or { } scripts.update = scripts.update or { } @@ -144,6 +170,11 @@ scripts.update.platforms = { ["solaris"] = "solaris-sparc", } +scripts.update.selfscripts = { + "mtxrun", + -- "luatools", +} + -- the list is filled up later (when we know what modules to download) scripts.update.modules = { @@ -154,10 +185,10 @@ function scripts.update.run(str) -- (texlua sets luatex as the engine, we need to reset that or to fix texexec :) os.setenv("engine",nil) if environment.argument("force") then - logs.report("run", str) + report("run, %s",str) os.execute(str) else - logs.report("dry run", str) + report("dry run, %s",str) end end @@ -171,7 +202,7 @@ end function scripts.update.synchronize() - logs.report("update","start") + report("update, start") local texroot = scripts.update.fullpath(states.get("paths.root")) local engines = states.get('engines') or { } @@ -184,7 +215,7 @@ function scripts.update.synchronize() local goodies = states.get("goodies") -- goodies (like editors) local force = environment.argument("force") - bin = string.gsub(bin,"\\","/") + bin = gsub(bin,"\\","/") if not url:find("::$") then url = url .. "::" end local ok = lfs.attributes(texroot,"mode") == "directory" @@ -197,6 +228,7 @@ function scripts.update.synchronize() dir.mkdirs(format("%s/%s", texroot, "texmf-cache")) dir.mkdirs(format("%s/%s", texroot, "texmf-local")) dir.mkdirs(format("%s/%s", texroot, "texmf-project")) + dir.mkdirs(format("%s/%s", texroot, "texmf-fonts")) end if ok or not force then @@ -209,8 +241,8 @@ function scripts.update.synchronize() local archives = {} for i=1,#collection do local archive = collection[i][1] - archive = archive:gsub("", platform) - archive = archive:gsub("", version) + archive = gsub(archive,"",platform) + archive = gsub(archive,"",version) archives[#archives+1] = archive end return archives @@ -281,12 +313,12 @@ function scripts.update.synchronize() if platform then for i=1,#collection do local c = collection[i] - local archive = c[1]:gsub("", platform) - local destination = format("%s/%s", texroot, c[2]:gsub("", platform)) - destination = destination:gsub("\\","/") - archive = archive:gsub("",version) + local archive = gsub(c[1],"",platform) + local destination = format("%s/%s", texroot, gsub(c[2],"", platform)) + destination = gsub(destination,"\\","/") + archive = gsub(archive,"",version) if osplatform == "windows" or osplatform == "mswin" then - destination = destination:gsub("([a-zA-Z]):/", "/cygdrive/%1/") + destination = gsub(destination,"([a-zA-Z]):/", "/cygdrive/%1/") end individual[#individual+1] = { archive, destination } end @@ -330,23 +362,12 @@ function scripts.update.synchronize() end end end - if logs.verbose then - for k, v in next, combined do - logs.report("update", k) - for i=1,#v do - logs.report("update", " <= " .. v[i]) - end - end - end for destination, archive in next, combined do local archives, command = concat(archive," "), "" - -- local normalflags, deleteflags = states.get("rsync.flags.normal"), states.get("rsync.flags.delete") - -- if environment.argument("keep") or destination:find("%.$") then - -- command = format("%s %s %s'%s' '%s'", bin, normalflags, url, archives, destination) - -- else - -- command = format("%s %s %s %s'%s' '%s'", bin, normalflags, deleteflags, url, archives, destination) - -- end local normalflags, deleteflags = states.get("rsync.flags.normal"), "" + if os.name == "windows" then + normalflags = normalflags .. " -L" -- no symlinks + end local dryrunflags = "" if not environment.argument("force") then dryrunflags = "--dry-run" @@ -355,7 +376,7 @@ function scripts.update.synchronize() deleteflags = states.get("rsync.flags.delete") end command = format("%s %s %s %s %s'%s' '%s'", bin, normalflags, deleteflags, dryrunflags, url, archives, destination) - --logs.report("mtx update", format("running command: %s",command)) + -- report("running command: %s",command) if not fetched[command] then scripts.update.run(command,true) fetched[command] = command @@ -363,43 +384,44 @@ function scripts.update.synchronize() end local function update_script(script, platform) - local bin = bin:gsub("\\","/") - local texroot = texroot:gsub("\\","/") + local bin = gsub(bin,"\\","/") + local texroot = gsub(texroot,"\\","/") platform = scripts.update.platforms[platform] if platform then local command if platform == 'mswin' then - bin = bin:gsub("([a-zA-Z]):/", "/cygdrive/%1/") - texroot = texroot:gsub("([a-zA-Z]):/", "/cygdrive/%1/") - command = string.format("%s -t %s/texmf-context/scripts/context/lua/%s.lua %s/texmf-mswin/bin/", bin, texroot, script, texroot) + bin = gsub(bin,"([a-zA-Z]):/", "/cygdrive/%1/") + texroot = gsub(texroot,"([a-zA-Z]):/", "/cygdrive/%1/") + command = format("%s -t %s/texmf-context/scripts/context/lua/%s.lua %s/texmf-mswin/bin/", bin, texroot, script, texroot) else - command = string.format("%s -tgo --chmod=a+x %s/texmf-context/scripts/context/lua/%s.lua %s/texmf-%s/bin/%s", bin, texroot, script, texroot, platform, script) + command = format("%s -tgo --chmod=a+x %s/texmf-context/scripts/context/lua/%s.lua %s/texmf-%s/bin/%s", bin, texroot, script, texroot, platform, script) end - logs.report("mtx update", format("updating %s for %s: %s", script, platform, command)) + report("updating %s for %s: %s", script, platform, command) scripts.update.run(command) end end for platform, _ in next, platforms do - update_script('luatools',platform) - update_script('mtxrun',platform) + for i=1, #scripts.update.selfscripts do + update_script(scripts.update.selfscripts[i],platform) + end end else - logs.report("mtx update", format("no valid texroot: %s",texroot)) + report("no valid texroot: %s",texroot) end if not force then - logs.report("update", "use --force to really update files") + report("use --force to really update files") end resolvers.load_tree(texroot) -- else we operate in the wrong tree -- update filename database for pdftex/xetex - scripts.update.run("mktexlsr") + scripts.update.run(format('mtxrun --tree="%s" --direct mktexlsr',texroot)) -- update filename database for luatex - scripts.update.run("luatools --generate") + scripts.update.run(format('mtxrun --tree="%s" --generate',texroot)) - logs.report("update","done") + report("update, done") end function table.fromhash(t) @@ -413,7 +435,7 @@ end -- make the ConTeXt formats function scripts.update.make() - logs.report("make","start") + report("make, start") local force = environment.argument("force") local texroot = scripts.update.fullpath(states.get("paths.root")) @@ -424,8 +446,8 @@ function scripts.update.make() resolvers.load_tree(texroot) - scripts.update.run("mktexlsr") - scripts.update.run("luatools --generate") + scripts.update.run(format('mtxrun --tree="%s" --direct mktexlsr',texroot)) + scripts.update.run(format('mtxrun --tree="%s" --generate',texroot)) local askedformats = formats local texformats = table.tohash(scripts.update.texformats) @@ -444,45 +466,24 @@ function scripts.update.make() if formatlist ~= "" then for engine in next, engines do if engine == "luatex" then - scripts.update.run(format("context --make")) -- maybe also formatlist + scripts.update.run(format('mtxrun --tree="%s" --script context --autogenerate --make',texroot)) else - -- todo: just handle make here or in mtxrun --script context --make - scripts.update.run(format("texexec --make --all --fast --%s %s",engine,formatlist)) + scripts.update.run(format('mtxrun --tree="%s" --script texexec --make --all --%s %s',texroot,engine,formatlist)) end end end local formatlist = concat(table.fromhash(mpformats), " ") if formatlist ~= "" then - scripts.update.run(format("texexec --make --all --fast %s",formatlist)) + scripts.update.run(format('mtxrun --tree="%s" --script texexec --make --all %s',texroot,formatlist)) end if not force then - logs.report("make", "use --force to really make formats") + report("make, use --force to really make formats") end - scripts.update.run("mktexlsr") - scripts.update.run("luatools --generate") - logs.report("make","done") + scripts.update.run(format('mtxrun --tree="%s" --direct mktexlsr',texroot)) + scripts.update.run(format('mtxrun --tree="%s" --generate',texroot)) + report("make, done") end -logs.extendbanner("ConTeXt Minimals Updater 0.21",true) - -messages.help = [[ ---platform=string platform (windows, linux, linux-64, osx-intel, osx-ppc, linux-ppc) ---server=string repository url (rsync://contextgarden.net) ---module=string repository url (minimals) ---repository=string specify version (current, experimental) ---context=string specify version (current, latest, yyyy.mm.dd) ---rsync=string rsync binary (rsync) ---texroot=string installation directory (not guessed for the moment) ---engine=string tex engine (luatex, pdftex, xetex) ---extras=string extra modules (can be list or 'all') ---goodies=string extra binaries (like scite and texworks) ---force instead of a dryrun, do the real thing ---update update minimal tree ---make also make formats and generate file databases ---keep don't delete unused or obsolete files ---state update tree using saved state -]] - scripts.savestate = true if scripts.savestate then @@ -549,7 +550,8 @@ if scripts.savestate then states.set("goodies." .. r, true) end - logs.report("state","loaded") + report("state, loaded") + report() end @@ -567,7 +569,7 @@ if environment.argument("update") then elseif environment.argument("make") then scripts.update.make() else - logs.help(messages.help) + application.help() end if scripts.savestate then @@ -575,6 +577,6 @@ if scripts.savestate then states.set("info.runtime",tonumber(statistics.elapsedtime(states))) if environment.argument("force") then states.save() - logs.report("state","saved") + report("state","saved") end end diff --git a/Master/texmf-dist/scripts/context/lua/mtx-watch.lua b/Master/texmf-dist/scripts/context/lua/mtx-watch.lua index 10f01cf8698..5bd0ad5f496 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-watch.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-watch.lua @@ -6,6 +6,25 @@ if not modules then modules = { } end modules ['mtx-watch'] = { license = "see context related readme files" } +local helpinfo = [[ +--logpath optional path for log files +--watch watch given path [--delay] +--pipe use pipe instead of execute +--delay delay between sweeps +--automachine replace /machine/ in path // +--collect condense log files +--cleanup=delay remove files in given path [--force] +--showlog show log data +]] + +local application = logs.application { + name = "mtx-watch", + banner = "ConTeXt Request Watchdog 1.00", + helpinfo = helpinfo, +} + +local report = application.report + scripts = scripts or { } scripts.watch = scripts.watch or { } @@ -92,7 +111,7 @@ function scripts.watch.watch() end end for i=1,#paths do - logs.report("watch", "watching path ".. paths[i]) + report("watching path %s",paths[i]) end local function process() local done = false @@ -107,7 +126,7 @@ function scripts.watch.watch() local ok, joblog = pcall(dofile,name) if ok and joblog then if joblog.status == "processing" then - logs.report("watch",format("aborted job, %s added to queue",name)) + report("aborted job, %s added to queue",name) joblog.status = "queued" io.savedata(name, table.serialize(joblog,true)) elseif joblog.status == "queued" then @@ -124,7 +143,7 @@ function scripts.watch.watch() joblog.status = "processing" joblog.runtime = clock() io.savedata(name, table.serialize(joblog,true)) - logs.report("watch",format("running: %s", command)) + report("running: %s", command) local newpath = file.dirname(name) io.flush() local result = "" @@ -141,7 +160,7 @@ function scripts.watch.watch() scripts.watch.save_exa_modes(joblog,ctmname) if pipe then result = os.resultof(command) else result = os.spawn(command) end end - logs.report("watch",format("return value: %s", result)) + report("return value: %s", result) done = true local path, base = replacements.outputpath, file.basename(replacements.filename) joblog.runtime = clock() - joblog.runtime @@ -162,7 +181,7 @@ function scripts.watch.watch() if logpath and logpath ~= "" then local name = file.join(logpath,os.uuid() .. ".lua") io.savedata(name, table.serialize(joblog,true)) - logs.report("watch", "saving joblog in " .. name) + report("saving joblog in %s",name) end end end @@ -175,7 +194,7 @@ function scripts.watch.watch() --~ if not done then --~ n = n + 1 --~ if n >= 10 then ---~ logs.report("watch", format("run time: %i seconds, memory usage: %0.3g MB", difftime(time(),start), (status.luastate_bytes/1024)/1000)) +--~ report("run time: %i seconds, memory usage: %0.3g MB", difftime(time(),start), (status.luastate_bytes/1024)/1000) --~ n = 0 --~ end --~ os.sleep(delay) @@ -187,7 +206,7 @@ function scripts.watch.watch() if not done then n = n + 1 if n >= 10 then - logs.report("watch", format("run time: %i seconds, memory usage: %0.3g MB", difftime(time(),start), (status.luastate_bytes/1024)/1000)) + report("run time: %i seconds, memory usage: %0.3g MB", difftime(time(),start), (status.luastate_bytes/1024)/1000) n = 0 end local ttime = 0 @@ -222,7 +241,7 @@ function scripts.watch.watch() local filetime = lfs.attributes(name,"modification") local delta = difftime(currenttime,filetime) if delta > cleanupdelay then - -- logs.report("watch",format("cleaning up '%s'",name)) + -- report("cleaning up '%s'",name) os.remove(name) end end @@ -248,7 +267,7 @@ function scripts.watch.watch() end end else - logs.report("watch", "no paths to watch") + report("no paths to watch") end end @@ -282,7 +301,7 @@ function scripts.watch.save_logs(collection,path) -- play safe local check = dofile(filename) for k,v in next, check do if not collection[k] then - logs.error("watch", "error in saving file") + report("error in saving file") os.remove(filename) return false end @@ -326,7 +345,7 @@ function scripts.watch.show_logs(path) -- removes duplicates local v = sorted[k] local c = collection[v] local f, s, r, n = c.filename or "?", c.status or "?", c.runtime or 0, c.size or 0 - logs.report("watch", format("%s %s %3i %8i %s",string.padd(f,max," "),string.padd(s,10," "),r,n,v)) + report("%s %s %3i %8i %s",string.padd(f,max," "),string.padd(s,10," "),r,n,v) end end @@ -335,11 +354,11 @@ function scripts.watch.cleanup_stale_files() -- removes duplicates local delay = tonumber(environment.argument("cleanup")) local force = environment.argument("force") if not path or path == "." then - logs.report("watch","provide qualified path") + report("provide qualified path") elseif not delay then - logs.report("watch","missing --cleanup=delay") + report("missing --cleanup=delay") else - logs.report("watch","dryrun, use --force for real cleanup") + report("dryrun, use --force for real cleanup") local files = dir.glob(file.join(path,"*")) local rtime = time() for i=1,#files do @@ -347,7 +366,7 @@ function scripts.watch.cleanup_stale_files() -- removes duplicates local mtime = lfs.attributes(name,"modification") local delta = difftime(rtime,mtime) if delta > delay then - logs.report("watch",format("cleaning up '%s'",name)) + report("cleaning up '%s'",name) if force then os.remove(name) end @@ -356,19 +375,6 @@ function scripts.watch.cleanup_stale_files() -- removes duplicates end end -logs.extendbanner("ConTeXt Request Watchdog 1.00",true) - -messages.help = [[ ---logpath optional path for log files ---watch watch given path [--delay] ---pipe use pipe instead of execute ---delay delay between sweeps ---automachine replace /machine/ in path // ---collect condense log files ---cleanup=delay remove files in given path [--force] ---showlog show log data -]] - if environment.argument("watch") then scripts.watch.watch() elseif environment.argument("collect") then @@ -378,5 +384,5 @@ elseif environment.argument("cleanup") then elseif environment.argument("showlog") then scripts.watch.show_logs() else - logs.help(messages.help) + application.help() end diff --git a/Master/texmf-dist/scripts/context/lua/mtxrun.lua b/Master/texmf-dist/scripts/context/lua/mtxrun.lua index 2bdd1b8f020..cc5ebb478ac 100755 --- a/Master/texmf-dist/scripts/context/lua/mtxrun.lua +++ b/Master/texmf-dist/scripts/context/lua/mtxrun.lua @@ -8,7 +8,6 @@ if not modules then modules = { } end modules ['mtxrun'] = { license = "see context related readme files" } - -- one can make a stub: -- -- #!/bin/sh @@ -38,8 +37,6 @@ if not modules then modules = { } end modules ['mtxrun'] = { -- remember for subruns: _CTX_K_S_#{original}_ -- remember for subruns: TEXMFSTART.#{original} [tex.rb texmfstart.rb] -texlua = true - -- begin library merge @@ -54,8 +51,9 @@ if not modules then modules = { } end modules ['l-string'] = { license = "see context related readme files" } +local string = string local sub, gsub, find, match, gmatch, format, char, byte, rep, lower = string.sub, string.gsub, string.find, string.match, string.gmatch, string.format, string.char, string.byte, string.rep, string.lower -local lpegmatch = lpeg.match +local lpegmatch, S, C, Ct = lpeg.match, lpeg.S, lpeg.C, lpeg.Ct -- some functions may disappear as they are not used anywhere @@ -63,196 +61,68 @@ if not string.split then -- this will be overloaded by a faster lpeg variant - function string:split(pattern) - if #self > 0 then - local t = { } - for s in gmatch(self..pattern,"(.-)"..pattern) do - t[#t+1] = s + function string.split(str,pattern) + local t = { } + if #str > 0 then + local n = 1 + for s in gmatch(str..pattern,"(.-)"..pattern) do + t[n] = s + n = n + 1 end - return t - else - return { } end + return t end end -local chr_to_esc = { - ["%"] = "%%", - ["."] = "%.", - ["+"] = "%+", ["-"] = "%-", ["*"] = "%*", - ["^"] = "%^", ["$"] = "%$", - ["["] = "%[", ["]"] = "%]", - ["("] = "%(", [")"] = "%)", - ["{"] = "%{", ["}"] = "%}" -} - -string.chr_to_esc = chr_to_esc - -function string:esc() -- variant 2 - return (gsub(self,"(.)",chr_to_esc)) -end - -function string:unquote() - return (gsub(self,"^([\"\'])(.*)%1$","%2")) +function string.unquoted(str) + return (gsub(str,"^([\"\'])(.*)%1$","%2")) end ---~ function string:unquote() ---~ if find(self,"^[\'\"]") then ---~ return sub(self,2,-2) ---~ else ---~ return self ---~ end ---~ end -function string:quote() -- we could use format("%q") - return format("%q",self) +function string.quoted(str) + return format("%q",str) -- always " end -function string:count(pattern) -- variant 3 +function string.count(str,pattern) -- variant 3 local n = 0 - for _ in gmatch(self,pattern) do + for _ in gmatch(str,pattern) do -- not for utf n = n + 1 end return n end -function string:limit(n,sentinel) - if #self > n then - sentinel = sentinel or " ..." - return sub(self,1,(n-#sentinel)) .. sentinel - else - return self - end -end - ---~ function string:strip() -- the .- is quite efficient ---~ -- return match(self,"^%s*(.-)%s*$") or "" ---~ -- return match(self,'^%s*(.*%S)') or '' -- posted on lua list ---~ return find(s,'^%s*$') and '' or match(s,'^%s*(.*%S)') ---~ end - -do -- roberto's variant: - local space = lpeg.S(" \t\v\n") - local nospace = 1 - space - local stripper = space^0 * lpeg.C((space^0 * nospace^1)^0) - function string.strip(str) - return lpegmatch(stripper,str) or "" - end -end - -function string:is_empty() - return not find(self,"%S") -end - -function string:enhance(pattern,action) - local ok, n = true, 0 - while ok do - ok = false - self = gsub(self,pattern, function(...) - ok, n = true, n + 1 - return action(...) - end) - end - return self, n -end - -local chr_to_hex, hex_to_chr = { }, { } - -for i=0,255 do - local c, h = char(i), format("%02X",i) - chr_to_hex[c], hex_to_chr[h] = h, c -end - -function string:to_hex() - return (gsub(self or "","(.)",chr_to_hex)) -end - -function string:from_hex() - return (gsub(self or "","(..)",hex_to_chr)) -end - -if not string.characters then - - local function nextchar(str, index) - index = index + 1 - return (index <= #str) and index or nil, sub(str,index,index) - end - function string:characters() - return nextchar, self, 0 - end - local function nextbyte(str, index) - index = index + 1 - return (index <= #str) and index or nil, byte(sub(str,index,index)) - end - function string:bytes() - return nextbyte, self, 0 - end - -end - --- we can use format for this (neg n) - -function string:rpadd(n,chr) - local m = n-#self - if m > 0 then - return self .. rep(chr or " ",m) +function string.limit(str,n,sentinel) -- not utf proof + if #str > n then + sentinel = sentinel or "..." + return sub(str,1,(n-#sentinel)) .. sentinel else - return self - end -end - -function string:lpadd(n,chr) - local m = n-#self - if m > 0 then - return rep(chr or " ",m) .. self - else - return self + return str end end -string.padd = string.rpadd +local space = S(" \t\v\n") +local nospace = 1 - space +local stripper = space^0 * C((space^0 * nospace^1)^0) -- roberto's code -function is_number(str) -- tonumber - return find(str,"^[%-%+]?[%d]-%.?[%d+]$") == 1 +function string.strip(str) + return lpegmatch(stripper,str) or "" end ---~ print(is_number("1")) ---~ print(is_number("1.1")) ---~ print(is_number(".1")) ---~ print(is_number("-0.1")) ---~ print(is_number("+0.1")) ---~ print(is_number("-.1")) ---~ print(is_number("+.1")) - -function string:split_settings() -- no {} handling, see l-aux for lpeg variant - if find(self,"=") then - local t = { } - for k,v in gmatch(self,"(%a+)=([^%,]*)") do - t[k] = v - end - return t - else - return nil - end +function string.is_empty(str) + return not find(str,"%S") end local patterns_escapes = { - ["-"] = "%-", - ["."] = "%.", - ["+"] = "%+", - ["*"] = "%*", ["%"] = "%%", - ["("] = "%)", - [")"] = "%)", - ["["] = "%[", - ["]"] = "%]", + ["."] = "%.", + ["+"] = "%+", ["-"] = "%-", ["*"] = "%*", + ["["] = "%[", ["]"] = "%]", + ["("] = "%(", [")"] = "%)", + -- ["{"] = "%{", ["}"] = "%}" + -- ["^"] = "%^", ["$"] = "%$", } -function string:pattesc() - return (gsub(self,".",patterns_escapes)) -end - local simple_escapes = { ["-"] = "%-", ["."] = "%.", @@ -260,80 +130,30 @@ local simple_escapes = { ["*"] = ".*", } -function string:simpleesc() - return (gsub(self,".",simple_escapes)) -end - -function string:tohash() - local t = { } - for s in gmatch(self,"([^, ]+)") do -- lpeg - t[s] = true - end - return t -end - -local pattern = lpeg.Ct(lpeg.C(1)^0) - -function string:totable() - return lpegmatch(pattern,self) +function string.escapedpattern(str,simple) + return (gsub(str,".",simple and simple_escapes or patterns_escapes)) end ---~ local t = { ---~ "1234567123456712345671234567", ---~ "a\tb\tc", ---~ "aa\tbb\tcc", ---~ "aaa\tbbb\tccc", ---~ "aaaa\tbbbb\tcccc", ---~ "aaaaa\tbbbbb\tccccc", ---~ "aaaaaa\tbbbbbb\tcccccc", ---~ } ---~ for k,v do ---~ print(string.tabtospace(t[k])) ---~ end - -function string.tabtospace(str,tab) - -- we don't handle embedded newlines - while true do - local s = find(str,"\t") - if s then - if not tab then tab = 7 end -- only when found - local d = tab-(s-1) % tab - if d > 0 then - str = gsub(str,"\t",rep(" ",d),1) - else - str = gsub(str,"\t","",1) - end +function string.topattern(str,lowercase,strict) + if str == "" then + return ".*" + else + str = gsub(str,".",simple_escapes) + if lowercase then + str = lower(str) + end + if strict then + return "^" .. str .. "$" else - break + return str end end - return str end -function string:compactlong() -- strips newlines and leading spaces - self = gsub(self,"[\n\r]+ *","") - self = gsub(self,"^ *","") - return self -end - -function string:striplong() -- strips newlines and leading spaces - self = gsub(self,"^%s*","") - self = gsub(self,"[\n\r]+ *","\n") - return self -end +-- obsolete names: -function string:topattern(lowercase,strict) - if lowercase then - self = lower(self) - end - self = gsub(self,".",simple_escapes) - if self == "" then - self = ".*" - elseif strict then - self = "^" .. self .. "$" - end - return self -end +string.quote = string.quoted +string.unquote = string.unquoted end -- of closure @@ -350,28 +170,75 @@ if not modules then modules = { } end modules ['l-lpeg'] = { local lpeg = require("lpeg") +local type = type + +-- Beware, we predefine a bunch of patterns here and one reason for doing so +-- is that we get consistent behaviour in some of the visualizers. + lpeg.patterns = lpeg.patterns or { } -- so that we can share local patterns = lpeg.patterns -local P, R, S, Ct, C, Cs, Cc, V = lpeg.P, lpeg.R, lpeg.S, lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.V -local match = lpeg.match +local P, R, S, V, match = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.match +local Ct, C, Cs, Cc = lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc +local lpegtype = lpeg.type + +local utfcharacters = string.utfcharacters +local utfgmatch = unicode and unicode.utf8.gmatch + +local anything = P(1) +local endofstring = P(-1) +local alwaysmatched = P(true) + +patterns.anything = anything +patterns.endofstring = endofstring +patterns.beginofstring = alwaysmatched +patterns.alwaysmatched = alwaysmatched local digit, sign = R('09'), S('+-') local cr, lf, crlf = P("\r"), P("\n"), P("\r\n") -local utf8byte = R("\128\191") +local newline = crlf + cr + lf +local escaped = P("\\") * anything +local squote = P("'") +local dquote = P('"') +local space = P(" ") + +local utfbom_32_be = P('\000\000\254\255') +local utfbom_32_le = P('\255\254\000\000') +local utfbom_16_be = P('\255\254') +local utfbom_16_le = P('\254\255') +local utfbom_8 = P('\239\187\191') +local utfbom = utfbom_32_be + utfbom_32_le + + utfbom_16_be + utfbom_16_le + + utfbom_8 +local utftype = utfbom_32_be / "utf-32-be" + utfbom_32_le / "utf-32-le" + + utfbom_16_be / "utf-16-be" + utfbom_16_le / "utf-16-le" + + utfbom_8 / "utf-8" + alwaysmatched / "unknown" + +local utf8next = R("\128\191") -patterns.utf8byte = utf8byte patterns.utf8one = R("\000\127") -patterns.utf8two = R("\194\223") * utf8byte -patterns.utf8three = R("\224\239") * utf8byte * utf8byte -patterns.utf8four = R("\240\244") * utf8byte * utf8byte * utf8byte +patterns.utf8two = R("\194\223") * utf8next +patterns.utf8three = R("\224\239") * utf8next * utf8next +patterns.utf8four = R("\240\244") * utf8next * utf8next * utf8next +patterns.utfbom = utfbom +patterns.utftype = utftype + +local utf8char = patterns.utf8one + patterns.utf8two + patterns.utf8three + patterns.utf8four +local validutf8char = utf8char^0 * endofstring * Cc(true) + Cc(false) + +patterns.utf8 = utf8char +patterns.utf8char = utf8char +patterns.validutf8 = validutf8char +patterns.validutf8char = validutf8char patterns.digit = digit patterns.sign = sign patterns.cardinal = sign^0 * digit^1 patterns.integer = sign^0 * digit^1 patterns.float = sign^0 * digit^0 * P('.') * digit^1 +patterns.cfloat = sign^0 * digit^0 * P(',') * digit^1 patterns.number = patterns.float + patterns.integer +patterns.cnumber = patterns.cfloat + patterns.integer patterns.oct = P("0") * R("07")^1 patterns.octal = patterns.oct patterns.HEX = P("0x") * R("09","AF")^1 @@ -380,16 +247,42 @@ patterns.hexadecimal = P("0x") * R("09","AF","af")^1 patterns.lowercase = R("az") patterns.uppercase = R("AZ") patterns.letter = patterns.lowercase + patterns.uppercase -patterns.space = S(" ") +patterns.space = space +patterns.tab = P("\t") +patterns.spaceortab = patterns.space + patterns.tab patterns.eol = S("\n\r") patterns.spacer = S(" \t\f\v") -- + string.char(0xc2, 0xa0) if we want utf (cf mail roberto) -patterns.newline = crlf + cr + lf -patterns.nonspace = 1 - patterns.space +patterns.newline = newline +patterns.emptyline = newline^1 patterns.nonspacer = 1 - patterns.spacer patterns.whitespace = patterns.eol + patterns.spacer patterns.nonwhitespace = 1 - patterns.whitespace -patterns.utf8 = patterns.utf8one + patterns.utf8two + patterns.utf8three + patterns.utf8four -patterns.utfbom = P('\000\000\254\255') + P('\255\254\000\000') + P('\255\254') + P('\254\255') + P('\239\187\191') +patterns.equal = P("=") +patterns.comma = P(",") +patterns.commaspacer = P(",") * patterns.spacer^0 +patterns.period = P(".") +patterns.colon = P(":") +patterns.semicolon = P(";") +patterns.underscore = P("_") +patterns.escaped = escaped +patterns.squote = squote +patterns.dquote = dquote +patterns.nosquote = (escaped + (1-squote))^0 +patterns.nodquote = (escaped + (1-dquote))^0 +patterns.unsingle = (squote/"") * patterns.nosquote * (squote/"") +patterns.undouble = (dquote/"") * patterns.nodquote * (dquote/"") +patterns.unquoted = patterns.undouble + patterns.unsingle -- more often undouble +patterns.unspacer = ((patterns.spacer^1)/"")^0 + +patterns.somecontent = (anything - newline - space)^1 -- (utf8char - newline - space)^1 +patterns.beginline = #(1-newline) + +local unquoted = Cs(patterns.unquoted * endofstring) -- not C + +function string.unquoted(str) + return match(unquoted,str) or str +end + function lpeg.anywhere(pattern) --slightly adapted from website return P { P(pattern) + 1 * V(1) } -- why so complex? @@ -399,36 +292,18 @@ function lpeg.splitter(pattern, action) return (((1-P(pattern))^1)/action+1)^0 end -local spacing = patterns.spacer^0 * patterns.newline -- sort of strip -local empty = spacing * Cc("") -local nonempty = Cs((1-spacing)^1) * spacing^-1 -local content = (empty + nonempty)^1 - -local capture = Ct(content^0) - -function string:splitlines() - return match(capture,self) -end - -patterns.textline = content - ---~ local p = lpeg.splitat("->",false) print(match(p,"oeps->what->more")) -- oeps what more ---~ local p = lpeg.splitat("->",true) print(match(p,"oeps->what->more")) -- oeps what->more ---~ local p = lpeg.splitat("->",false) print(match(p,"oeps")) -- oeps ---~ local p = lpeg.splitat("->",true) print(match(p,"oeps")) -- oeps - local splitters_s, splitters_m = { }, { } local function splitat(separator,single) local splitter = (single and splitters_s[separator]) or splitters_m[separator] if not splitter then separator = P(separator) + local other = C((1 - separator)^0) if single then - local other, any = C((1 - separator)^0), P(1) + local any = anything splitter = other * (separator * C(any^0) + "") -- ? splitters_s[separator] = splitter else - local other = C((1 - separator)^0) splitter = other * (separator * other)^0 splitters_m[separator] = splitter end @@ -438,6 +313,7 @@ end lpeg.splitat = splitat + local cache = { } function lpeg.split(separator,str) @@ -449,16 +325,39 @@ function lpeg.split(separator,str) return match(c,str) end -function string:split(separator) +function string.split(str,separator) local c = cache[separator] if not c then c = Ct(splitat(separator)) cache[separator] = c end - return match(c,self) + return match(c,str) +end + +local spacing = patterns.spacer^0 * newline -- sort of strip +local empty = spacing * Cc("") +local nonempty = Cs((1-spacing)^1) * spacing^-1 +local content = (empty + nonempty)^1 + +patterns.textline = content + + +local linesplitter = Ct(splitat(newline)) + +patterns.linesplitter = linesplitter + +function string.splitlines(str) + return match(linesplitter,str) +end + +local utflinesplitter = utfbom^-1 * Ct(splitat(newline)) + +patterns.utflinesplitter = utflinesplitter + +function string.utfsplitlines(str) + return match(utflinesplitter,str) end -lpeg.splitters = cache local cache = { } @@ -466,37 +365,24 @@ function lpeg.checkedsplit(separator,str) local c = cache[separator] if not c then separator = P(separator) - local other = C((1 - separator)^0) + local other = C((1 - separator)^1) c = Ct(separator^0 * other * (separator^1 * other)^0) cache[separator] = c end return match(c,str) end -function string:checkedsplit(separator) +function string.checkedsplit(str,separator) local c = cache[separator] if not c then separator = P(separator) - local other = C((1 - separator)^0) + local other = C((1 - separator)^1) c = Ct(separator^0 * other * (separator^1 * other)^0) cache[separator] = c end - return match(c,self) + return match(c,str) end ---~ function lpeg.append(list,pp) ---~ local p = pp ---~ for l=1,#list do ---~ if p then ---~ p = p + P(list[l]) ---~ else ---~ p = P(list[l]) ---~ end ---~ end ---~ return p ---~ end - ---~ from roberto's site: local f1 = string.byte @@ -504,170 +390,459 @@ local function f2(s) local c1, c2 = f1(s,1,2) return c1 * 64 + c2 local function f3(s) local c1, c2, c3 = f1(s,1,3) return (c1 * 64 + c2) * 64 + c3 - 925824 end local function f4(s) local c1, c2, c3, c4 = f1(s,1,4) return ((c1 * 64 + c2) * 64 + c3) * 64 + c4 - 63447168 end -patterns.utf8byte = patterns.utf8one/f1 + patterns.utf8two/f2 + patterns.utf8three/f3 + patterns.utf8four/f4 - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-table'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -table.join = table.concat +local utf8byte = patterns.utf8one/f1 + patterns.utf8two/f2 + patterns.utf8three/f3 + patterns.utf8four/f4 -local concat, sort, insert, remove = table.concat, table.sort, table.insert, table.remove -local format, find, gsub, lower, dump, match = string.format, string.find, string.gsub, string.lower, string.dump, string.match -local getmetatable, setmetatable = getmetatable, setmetatable -local type, next, tostring, tonumber, ipairs = type, next, tostring, tonumber, ipairs +patterns.utf8byte = utf8byte --- Starting with version 5.2 Lua no longer provide ipairs, which makes --- sense. As we already used the for loop and # in most places the --- impact on ConTeXt was not that large; the remaining ipairs already --- have been replaced. In a similar fashio we also hardly used pairs. --- --- Just in case, we provide the fallbacks as discussed in Programming --- in Lua (http://www.lua.org/pil/7.3.html): -if not ipairs then - -- for k, v in ipairs(t) do ... end - -- for k=1,#t do local v = t[k] ... end +local cache = { } - local function iterate(a,i) - i = i + 1 - local v = a[i] - if v ~= nil then - return i, v --, nil +function lpeg.stripper(str) + if type(str) == "string" then + local s = cache[str] + if not s then + s = Cs(((S(str)^1)/"" + 1)^0) + cache[str] = s end + return s + else + return Cs(((str^1)/"" + 1)^0) end - - function ipairs(a) - return iterate, a, 0 - end - end -if not pairs then - - -- for k, v in pairs(t) do ... end - -- for k, v in next, t do ... end +local cache = { } - function pairs(t) - return next, t -- , nil +function lpeg.keeper(str) + if type(str) == "string" then + local s = cache[str] + if not s then + s = Cs((((1-S(str))^1)/"" + 1)^0) + cache[str] = s + end + return s + else + return Cs((((1-str)^1)/"" + 1)^0) end - end --- Also, unpack has been moved to the table table, and for compatiility --- reasons we provide both now. +function lpeg.frontstripper(str) -- or pattern (yet undocumented) + return (P(str) + P(true)) * Cs(P(1)^0) +end -if not table.unpack then - table.unpack = _G.unpack -elseif not unpack then - _G.unpack = table.unpack +function lpeg.endstripper(str) -- or pattern (yet undocumented) + return Cs((1 - P(str) * P(-1))^0) end --- extra functions, some might go (when not used) +-- Just for fun I looked at the used bytecode and +-- p = (p and p + pp) or pp gets one more (testset). -function table.strip(tab) - local lst = { } - for i=1,#tab do - local s = gsub(tab[i],"^%s*(.-)%s*$","%1") - if s == "" then - -- skip this one - else - lst[#lst+1] = s +function lpeg.replacer(one,two) + if type(one) == "table" then + local no = #one + if no > 0 then + local p + for i=1,no do + local o = one[i] + local pp = P(o[1]) / o[2] + if p then + p = p + pp + else + p = pp + end + end + return Cs((p + 1)^0) end + else + two = two or "" + return Cs((P(one)/two + 1)^0) end - return lst end -function table.keys(t) - local k = { } - for key, _ in next, t do - k[#k+1] = key - end - return k -end +local splitters_f, splitters_s = { }, { } -local function compare(a,b) - return (tostring(a) < tostring(b)) +function lpeg.firstofsplit(separator) -- always return value + local splitter = splitters_f[separator] + if not splitter then + separator = P(separator) + splitter = C((1 - separator)^0) + splitters_f[separator] = splitter + end + return splitter end -local function sortedkeys(tab) - local srt, kind = { }, 0 -- 0=unknown 1=string, 2=number 3=mixed - for key,_ in next, tab do - srt[#srt+1] = key - if kind == 3 then - -- no further check - else - local tkey = type(key) - if tkey == "string" then - -- if kind == 2 then kind = 3 else kind = 1 end - kind = (kind == 2 and 3) or 1 - elseif tkey == "number" then - -- if kind == 1 then kind = 3 else kind = 2 end - kind = (kind == 1 and 3) or 2 - else - kind = 3 - end - end - end - if kind == 0 or kind == 3 then - sort(srt,compare) - else - sort(srt) +function lpeg.secondofsplit(separator) -- nil if not split + local splitter = splitters_s[separator] + if not splitter then + separator = P(separator) + splitter = (1 - separator)^0 * separator * C(anything^0) + splitters_s[separator] = splitter end - return srt + return splitter end -local function sortedhashkeys(tab) -- fast one - local srt = { } - for key,_ in next, tab do - srt[#srt+1] = key - end - sort(srt) - return srt +function lpeg.balancer(left,right) + left, right = P(left), P(right) + return P { left * ((1 - left - right) + V(1))^0 * right } end -table.sortedkeys = sortedkeys -table.sortedhashkeys = sortedhashkeys -function table.sortedhash(t) - local s = sortedhashkeys(t) -- maybe just sortedkeys - local n = 0 - local function kv(s) - n = n + 1 - local k = s[n] - return k, t[k] - end - return kv, s -end -table.sortedpairs = table.sortedhash +local nany = utf8char/"" -function table.append(t, list) - for _,v in next, list do - insert(t,v) +function lpeg.counter(pattern) + pattern = Cs((P(pattern)/" " + nany)^0) + return function(str) + return #match(pattern,str) end end -function table.prepend(t, list) - for k,v in next, list do - insert(t,k,v) - end -end +if utfgmatch then -function table.merge(t, ...) -- first one is target - t = t or {} - local lst = {...} - for i=1,#lst do + function lpeg.count(str,what) -- replaces string.count + if type(what) == "string" then + local n = 0 + for _ in utfgmatch(str,what) do + n = n + 1 + end + return n + else -- 4 times slower but still faster than / function + return #match(Cs((P(what)/" " + nany)^0),str) + end + end + +else + + local cache = { } + + function lpeg.count(str,what) -- replaces string.count + if type(what) == "string" then + local p = cache[what] + if not p then + p = Cs((P(what)/" " + nany)^0) + cache[p] = p + end + return #match(p,str) + else -- 4 times slower but still faster than / function + return #match(Cs((P(what)/" " + nany)^0),str) + end + end + +end + +local patterns_escapes = { -- also defines in l-string + ["%"] = "%%", + ["."] = "%.", + ["+"] = "%+", ["-"] = "%-", ["*"] = "%*", + ["["] = "%[", ["]"] = "%]", + ["("] = "%)", [")"] = "%)", + -- ["{"] = "%{", ["}"] = "%}" + -- ["^"] = "%^", ["$"] = "%$", +} + +local simple_escapes = { -- also defines in l-string + ["-"] = "%-", + ["."] = "%.", + ["?"] = ".", + ["*"] = ".*", +} + +local p = Cs((S("-.+*%()[]") / patterns_escapes + anything)^0) +local s = Cs((S("-.+*%()[]") / simple_escapes + anything)^0) + +function string.escapedpattern(str,simple) + return match(simple and s or p,str) +end + +-- utf extensies + +lpeg.UP = lpeg.P + +if utfcharacters then + + function lpeg.US(str) + local p + for uc in utfcharacters(str) do + if p then + p = p + P(uc) + else + p = P(uc) + end + end + return p + end + + +elseif utfgmatch then + + function lpeg.US(str) + local p + for uc in utfgmatch(str,".") do + if p then + p = p + P(uc) + else + p = P(uc) + end + end + return p + end + +else + + function lpeg.US(str) + local p + local f = function(uc) + if p then + p = p + P(uc) + else + p = P(uc) + end + end + match((utf8char/f)^0,str) + return p + end + +end + +local range = Cs(utf8byte) * (Cs(utf8byte) + Cc(false)) + +local utfchar = unicode and unicode.utf8 and unicode.utf8.char + +function lpeg.UR(str,more) + local first, last + if type(str) == "number" then + first = str + last = more or first + else + first, last = match(range,str) + if not last then + return P(str) + end + end + if first == last then + return P(str) + elseif utfchar and last - first < 8 then -- a somewhat arbitrary criterium + local p + for i=first,last do + if p then + p = p + P(utfchar(i)) + else + p = P(utfchar(i)) + end + end + return p -- nil when invalid range + else + local f = function(b) + return b >= first and b <= last + end + return utf8byte / f -- nil when invalid range + end +end + + + +function lpeg.oneof(list,...) -- lpeg.oneof("elseif","else","if","then") + if type(list) ~= "table" then + list = { list, ... } + end + -- sort(list) -- longest match first + local p = P(list[1]) + for l=2,#list do + p = p + P(list[l]) + end + return p +end + +function lpeg.is_lpeg(p) + return p and lpegtype(p) == "pattern" +end + + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['l-table'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local type, next, tostring, tonumber, ipairs, table, string = type, next, tostring, tonumber, ipairs, table, string +local concat, sort, insert, remove = table.concat, table.sort, table.insert, table.remove +local format, find, gsub, lower, dump, match = string.format, string.find, string.gsub, string.lower, string.dump, string.match +local getmetatable, setmetatable = getmetatable, setmetatable + +-- Starting with version 5.2 Lua no longer provide ipairs, which makes +-- sense. As we already used the for loop and # in most places the +-- impact on ConTeXt was not that large; the remaining ipairs already +-- have been replaced. In a similar fashio we also hardly used pairs. +-- +-- Just in case, we provide the fallbacks as discussed in Programming +-- in Lua (http://www.lua.org/pil/7.3.html): + +if not ipairs then + + -- for k, v in ipairs(t) do ... end + -- for k=1,#t do local v = t[k] ... end + + local function iterate(a,i) + i = i + 1 + local v = a[i] + if v ~= nil then + return i, v --, nil + end + end + + function ipairs(a) + return iterate, a, 0 + end + +end + +if not pairs then + + -- for k, v in pairs(t) do ... end + -- for k, v in next, t do ... end + + function pairs(t) + return next, t -- , nil + end + +end + +-- Also, unpack has been moved to the table table, and for compatiility +-- reasons we provide both now. + +if not table.unpack then + table.unpack = _G.unpack +elseif not unpack then + _G.unpack = table.unpack +end + +-- extra functions, some might go (when not used) + +function table.strip(tab) + local lst, l = { }, 0 + for i=1,#tab do + local s = gsub(tab[i],"^%s*(.-)%s*$","%1") + if s == "" then + -- skip this one + else + l = l + 1 + lst[l] = s + end + end + return lst +end + +function table.keys(t) + local keys, k = { }, 0 + for key, _ in next, t do + k = k + 1 + keys[k] = key + end + return keys +end + +local function compare(a,b) + local ta, tb = type(a), type(b) -- needed, else 11 < 2 + if ta == tb then + return a < b + else + return tostring(a) < tostring(b) + end +end + +local function sortedkeys(tab) + local srt, category, s = { }, 0, 0 -- 0=unknown 1=string, 2=number 3=mixed + for key,_ in next, tab do + s = s + 1 + srt[s] = key + if category == 3 then + -- no further check + else + local tkey = type(key) + if tkey == "string" then + category = (category == 2 and 3) or 1 + elseif tkey == "number" then + category = (category == 1 and 3) or 2 + else + category = 3 + end + end + end + if category == 0 or category == 3 then + sort(srt,compare) + else + sort(srt) + end + return srt +end + +local function sortedhashkeys(tab) -- fast one + local srt, s = { }, 0 + for key,_ in next, tab do + if key then + s= s + 1 + srt[s] = key + end + end + sort(srt) + return srt +end + +table.sortedkeys = sortedkeys +table.sortedhashkeys = sortedhashkeys + +local function nothing() end + +local function sortedhash(t) + if t then + local n, s = 0, sortedkeys(t) -- the robust one + local function kv(s) + n = n + 1 + local k = s[n] + return k, t[k] + end + return kv, s + else + return nothing + end +end + +table.sortedhash = sortedhash +table.sortedpairs = sortedhash + +function table.append(t, list) + local n = #t + for i=1,#list do + n = n + 1 + t[n] = list[i] + end + return t +end + +function table.prepend(t, list) + local nl = #list + local nt = nl + #t + for i=#t,1,-1 do + t[nt] = t[i] + nt = nt - 1 + end + for i=1,#list do + t[i] = list[i] + end + return t +end + +function table.merge(t, ...) -- first one is target + t = t or { } + local lst = { ... } + for i=1,#lst do for k, v in next, lst[i] do t[k] = v end @@ -676,7 +851,7 @@ function table.merge(t, ...) -- first one is target end function table.merged(...) - local tmp, lst = { }, {...} + local tmp, lst = { }, { ... } for i=1,#lst do for k, v in next, lst[i] do tmp[k] = v @@ -686,41 +861,45 @@ function table.merged(...) end function table.imerge(t, ...) - local lst = {...} + local lst, nt = { ... }, #t for i=1,#lst do local nst = lst[i] for j=1,#nst do - t[#t+1] = nst[j] + nt = nt + 1 + t[nt] = nst[j] end end return t end function table.imerged(...) - local tmp, lst = { }, {...} + local tmp, ntmp, lst = { }, 0, {...} for i=1,#lst do local nst = lst[i] for j=1,#nst do - tmp[#tmp+1] = nst[j] + ntmp = ntmp + 1 + tmp[ntmp] = nst[j] end end return tmp end -local function fastcopy(old) -- fast one +local function fastcopy(old,metatabletoo) -- fast one if old then local new = { } for k,v in next, old do if type(v) == "table" then - new[k] = fastcopy(v) -- was just table.copy + new[k] = fastcopy(v,metatabletoo) -- was just table.copy else new[k] = v end end - -- optional second arg - local mt = getmetatable(old) - if mt then - setmetatable(new,mt) + if metatabletoo then + -- optional second arg + local mt = getmetatable(old) + if mt then + setmetatable(new,mt) + end end return new else @@ -728,6 +907,8 @@ local function fastcopy(old) -- fast one end end +-- todo : copy without metatable + local function copy(t, tables) -- taken from lua wiki, slightly adapted tables = tables or { } local tcopy = {} @@ -760,33 +941,14 @@ end table.fastcopy = fastcopy table.copy = copy --- roughly: copy-loop : unpack : sub == 0.9 : 0.4 : 0.45 (so in critical apps, use unpack) - -function table.sub(t,i,j) - return { unpack(t,i,j) } -end - -function table.replace(a,b) - for k,v in next, b do - a[k] = v +function table.derive(parent) + local child = { } + if parent then + setmetatable(child,{ __index = parent }) end + return child end --- slower than #t on indexed tables (#t only returns the size of the numerically indexed slice) - -function table.is_empty(t) -- obolete, use inline code instead - return not t or not next(t) -end - -function table.one_entry(t) -- obolete, use inline code instead - local n = next(t) - return n and not next(t,n) -end - ---~ function table.starts_at(t) -- obsolete, not nice anyway ---~ return ipairs(t,1)(t,0) ---~ end - function table.tohash(t,value) local h = { } if t then @@ -799,27 +961,19 @@ function table.tohash(t,value) end function table.fromhash(t) - local h = { } + local hsh, h = { }, 0 for k, v in next, t do -- no ipairs here - if v then h[#h+1] = k end + if v then + h = h + 1 + hsh[h] = k + end end - return h + return hsh end ---~ print(table.serialize(t), "\n") ---~ print(table.serialize(t,"name"), "\n") ---~ print(table.serialize(t,false), "\n") ---~ print(table.serialize(t,true), "\n") ---~ print(table.serialize(t,"name",true), "\n") ---~ print(table.serialize(t,"name",true,true), "\n") - -table.serialize_functions = true -table.serialize_compact = true -table.serialize_inline = true - local noquotes, hexify, handle, reduce, compact, inline, functions -local reserved = table.tohash { -- intercept a language flaw, no reserved words as key +local reserved = table.tohash { -- intercept a language inconvenience: no reserved words as key 'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat', 'return', 'then', 'true', 'until', 'while', } @@ -831,20 +985,23 @@ local function simple_table(t) n = n + 1 end if n == #t then - local tt = { } + local tt, nt = { }, 0 for i=1,#t do local v = t[i] local tv = type(v) if tv == "number" then + nt = nt + 1 if hexify then - tt[#tt+1] = format("0x%04X",v) + tt[nt] = format("0x%04X",v) else - tt[#tt+1] = tostring(v) -- tostring not needed + tt[nt] = tostring(v) -- tostring not needed end elseif tv == "boolean" then - tt[#tt+1] = tostring(v) + nt = nt + 1 + tt[nt] = tostring(v) elseif tv == "string" then - tt[#tt+1] = format("%q",v) + nt = nt + 1 + tt[nt] = format("%q",v) else tt = nil break @@ -870,21 +1027,25 @@ local function do_serialize(root,name,depth,level,indexed) depth = depth .. " " if indexed then handle(format("%s{",depth)) - elseif name then - --~ handle(format("%s%s={",depth,key(name))) - if type(name) == "number" then -- or find(k,"^%d+$") then + else + local tn = type(name) + if tn == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s[0x%04X]={",depth,name)) else handle(format("%s[%s]={",depth,name)) end - elseif noquotes and not reserved[name] and find(name,"^%a[%w%_]*$") then - handle(format("%s%s={",depth,name)) + elseif tn == "string" then + if noquotes and not reserved[name] and find(name,"^%a[%w%_]*$") then + handle(format("%s%s={",depth,name)) + else + handle(format("%s[%q]={",depth,name)) + end + elseif tn == "boolean" then + handle(format("%s[%s]={",depth,tostring(name))) else - handle(format("%s[%q]={",depth,name)) + handle(format("%s{",depth)) end - else - handle(format("%s{",depth)) end end -- we could check for k (index) being number (cardinal) @@ -901,11 +1062,9 @@ local function do_serialize(root,name,depth,level,indexed) for i=1,#sk do local k = sk[i] local v = root[k] - --~ if v == root then - -- circular - --~ else - local t = type(v) - if compact and first and type(k) == "number" and k >= first and k <= last then + -- circular + local t, tk = type(v), type(k) + if compact and first and tk == "number" and k >= first and k <= last then if t == "number" then if hexify then handle(format("%s 0x%04X,",depth,v)) @@ -947,17 +1106,18 @@ local function do_serialize(root,name,depth,level,indexed) handle(format("%s __p__=nil,",depth)) end elseif t == "number" then - --~ if hexify then - --~ handle(format("%s %s=0x%04X,",depth,key(k),v)) - --~ else - --~ handle(format("%s %s=%s,",depth,key(k),v)) -- %.99g - --~ end - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=0x%04X,",depth,k,v)) else handle(format("%s [%s]=%s,",depth,k,v)) -- %.99g end + elseif tk == "boolean" then + if hexify then + handle(format("%s [%s]=0x%04X,",depth,tostring(k),v)) + else + handle(format("%s [%s]=%s,",depth,tostring(k),v)) -- %.99g + end elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then if hexify then handle(format("%s %s=0x%04X,",depth,k,v)) @@ -973,26 +1133,28 @@ local function do_serialize(root,name,depth,level,indexed) end elseif t == "string" then if reduce and tonumber(v) then - --~ handle(format("%s %s=%s,",depth,key(k),v)) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%s,",depth,k,v)) else handle(format("%s [%s]=%s,",depth,k,v)) end + elseif tk == "boolean" then + handle(format("%s [%s]=%s,",depth,tostring(k),v)) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%s,",depth,k,v)) else handle(format("%s [%q]=%s,",depth,k,v)) end else - --~ handle(format("%s %s=%q,",depth,key(k),v)) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%q,",depth,k,v)) else handle(format("%s [%s]=%q,",depth,k,v)) end + elseif tk == "boolean" then + handle(format("%s [%s]=%q,",depth,tostring(k),v)) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%q,",depth,k,v)) else @@ -1001,13 +1163,14 @@ local function do_serialize(root,name,depth,level,indexed) end elseif t == "table" then if not next(v) then - --~ handle(format("%s %s={},",depth,key(k))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]={},",depth,k)) else handle(format("%s [%s]={},",depth,k)) end + elseif tk == "boolean" then + handle(format("%s [%s]={},",depth,tostring(k))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s={},",depth,k)) else @@ -1016,13 +1179,14 @@ local function do_serialize(root,name,depth,level,indexed) elseif inline then local st = simple_table(v) if st then - --~ handle(format("%s %s={ %s },",depth,key(k),concat(st,", "))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]={ %s },",depth,k,concat(st,", "))) else handle(format("%s [%s]={ %s },",depth,k,concat(st,", "))) end + elseif tk == "boolean" then -- or find(k,"^%d+$") then + handle(format("%s [%s]={ %s },",depth,tostring(k),concat(st,", "))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s={ %s },",depth,k,concat(st,", "))) else @@ -1035,13 +1199,14 @@ local function do_serialize(root,name,depth,level,indexed) do_serialize(v,k,depth,level+1) end elseif t == "boolean" then - --~ handle(format("%s %s=%s,",depth,key(k),tostring(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%s,",depth,k,tostring(v))) else handle(format("%s [%s]=%s,",depth,k,tostring(v))) end + elseif tk == "boolean" then -- or find(k,"^%d+$") then + handle(format("%s [%s]=%s,",depth,tostring(k),tostring(v))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%s,",depth,k,tostring(v))) else @@ -1049,35 +1214,37 @@ local function do_serialize(root,name,depth,level,indexed) end elseif t == "function" then if functions then - --~ handle(format('%s %s=loadstring(%q),',depth,key(k),dump(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=loadstring(%q),",depth,k,dump(v))) else handle(format("%s [%s]=loadstring(%q),",depth,k,dump(v))) end + elseif tk == "boolean" then + handle(format("%s [%s]=loadstring(%q),",depth,tostring(k),dump(v))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=loadstring(%q),",depth,k,dump(v))) else - handle(format("%s [%q]=loadstring(%q),",depth,k,dump(v))) + -- handle(format("%s [%q]=loadstring(%q),",depth,k,dump(v))) + handle(format("%s [%q]=loadstring(%q),",depth,k,debug.getinfo(v).what == "C" and "C code" or dump(v))) end end else - --~ handle(format("%s %s=%q,",depth,key(k),tostring(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%q,",depth,k,tostring(v))) else handle(format("%s [%s]=%q,",depth,k,tostring(v))) end + elseif tk == "boolean" then -- or find(k,"^%d+$") then + handle(format("%s [%s]=%q,",depth,tostring(k),tostring(v))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%q,",depth,k,tostring(v))) else handle(format("%s [%q]=%q,",depth,k,tostring(v))) end end - --~ end - end + end end if level > 0 then handle(format("%s},",depth)) @@ -1087,15 +1254,34 @@ end -- replacing handle by a direct t[#t+1] = ... (plus test) is not much -- faster (0.03 on 1.00 for zapfino.tma) -local function serialize(root,name,_handle,_reduce,_noquotes,_hexify) - noquotes = _noquotes - hexify = _hexify - handle = _handle or print - reduce = _reduce or false - compact = table.serialize_compact - inline = compact and table.serialize_inline - functions = table.serialize_functions +local function serialize(_handle,root,name,specification) -- handle wins local tname = type(name) + if type(specification) == "table" then + noquotes = specification.noquotes + hexify = specification.hexify + handle = _handle or specification.handle or print + reduce = specification.reduce or false + functions = specification.functions + compact = specification.compact + inline = specification.inline and compact + if functions == nil then + functions = true + end + if compact == nil then + compact = true + end + if inline == nil then + inline = compact + end + else + noquotes = false + hexify = false + handle = _handle or print + reduce = false + compact = true + inline = true + functions = true + end if tname == "string" then if name == "return" then handle("return {") @@ -1117,33 +1303,33 @@ local function serialize(root,name,_handle,_reduce,_noquotes,_hexify) else handle("t={") end - if root and next(root) then - do_serialize(root,name,"",0,indexed) + if root then + -- The dummy access will initialize a table that has a delayed initialization + -- using a metatable. (maybe explicitly test for metatable) + if getmetatable(root) then -- todo: make this an option, maybe even per subtable + local dummy = root._w_h_a_t_e_v_e_r_ + root._w_h_a_t_e_v_e_r_ = nil + end + -- Let's forget about empty tables. + if next(root) then + do_serialize(root,name,"",0) + end end handle("}") end ---~ name: ---~ ---~ true : return { } ---~ false : { } ---~ nil : t = { } ---~ string : string = { } ---~ 'return' : return { } ---~ number : [number] = { } -function table.serialize(root,name,reduce,noquotes,hexify) - local t = { } +function table.serialize(root,name,specification) + local t, n = { }, 0 local function flush(s) - t[#t+1] = s + n = n + 1 + t[n] = s end - serialize(root,name,flush,reduce,noquotes,hexify) + serialize(flush,root,name,specification) return concat(t,"\n") end -function table.tohandle(handle,root,name,reduce,noquotes,hexify) - serialize(root,name,handle,reduce,noquotes,hexify) -end +table.tohandle = serialize -- sometimes tables are real use (zapfino extra pro is some 85M) in which -- case a stepwise serialization is nice; actually, we could consider: @@ -1154,73 +1340,63 @@ end -- -- so this is on the todo list -table.tofile_maxtab = 2*1024 +local maxtab = 2*1024 -function table.tofile(filename,root,name,reduce,noquotes,hexify) +function table.tofile(filename,root,name,specification) local f = io.open(filename,'w') if f then - local maxtab = table.tofile_maxtab if maxtab > 1 then - local t = { } + local t, n = { }, 0 local function flush(s) - t[#t+1] = s - if #t > maxtab then + n = n + 1 + t[n] = s + if n > maxtab then f:write(concat(t,"\n"),"\n") -- hm, write(sometable) should be nice - t = { } + t, n = { }, 0 -- we could recycle t if needed end end - serialize(root,name,flush,reduce,noquotes,hexify) + serialize(flush,root,name,specification) f:write(concat(t,"\n"),"\n") else local function flush(s) f:write(s,"\n") end - serialize(root,name,flush,reduce,noquotes,hexify) + serialize(flush,root,name,specification) end f:close() + io.flush() end end -local function flatten(t,f,complete) -- is this used? meybe a variant with next, ... - for i=1,#t do - local v = t[i] - if type(v) == "table" then - if complete or type(v[1]) == "table" then - flatten(v,f,complete) +local function flattened(t,f,depth) + if f == nil then + f = { } + depth = 0xFFFF + elseif tonumber(f) then + -- assume then only two arguments are given + depth = f + f = { } + elseif not depth then + depth = 0xFFFF + end + for k, v in next, t do + if type(k) ~= "number" then + if depth > 0 and type(v) == "table" then + flattened(v,f,depth-1) else - f[#f+1] = v + f[k] = v end - else - f[#f+1] = v end end -end - -function table.flatten(t) - local f = { } - flatten(t,f,true) - return f -end - -function table.unnest(t) -- bad name - local f = { } - flatten(t,f,false) - return f -end - -table.flatten_one_level = table.unnest - --- a better one: - -local function flattened(t,f) - if not f then - f = { } - end - for k, v in next, t do - if type(v) == "table" then - flattened(v,f) + local n = #f + for k=1,#t do + local v = t[k] + if depth > 0 and type(v) == "table" then + flattened(v,f,depth-1) + n = #f else - f[k] = v + n = n + 1 + f[n] = v end end return f @@ -1228,49 +1404,27 @@ end table.flattened = flattened --- the next three may disappear - -function table.remove_value(t,value) -- todo: n - if value then - for i=1,#t do - if t[i] == value then - remove(t,i) - -- remove all, so no: return - end - end +local function unnest(t,f) -- only used in mk, for old times sake + if not f then -- and only relevant for token lists + f = { } end -end - -function table.insert_before_value(t,value,str) - if str then - if value then - for i=1,#t do - if t[i] == value then - insert(t,i,str) - return - end + for i=1,#t do + local v = t[i] + if type(v) == "table" then + if type(v[1]) == "table" then + unnest(v,f) + else + f[#f+1] = v end + else + f[#f+1] = v end - insert(t,1,str) - elseif value then - insert(t,1,value) end + return f end -function table.insert_after_value(t,value,str) - if str then - if value then - for i=1,#t do - if t[i] == value then - insert(t,i+1,str) - return - end - end - end - t[#t+1] = str - elseif value then - t[#t+1] = value - end +function table.unnest(t) -- bad name + return unnest(t) end local function are_equal(a,b,n,m) -- indexed @@ -1297,7 +1451,7 @@ end local function identical(a,b) -- assumes same structure for ka, va in next, a do - local vb = b[k] + local vb = b[ka] if va == vb then -- same elseif type(va) == "table" and type(vb) == "table" then @@ -1311,8 +1465,8 @@ local function identical(a,b) -- assumes same structure return true end -table.are_equal = are_equal table.identical = identical +table.are_equal = are_equal -- maybe also make a combined one @@ -1338,89 +1492,84 @@ function table.contains(t, v) end function table.count(t) - local n, e = 0, next(t) - while e do - n, e = n + 1, next(t,e) + local n = 0 + for k, v in next, t do + n = n + 1 end return n end -function table.swapped(t) - local s = { } +function table.swapped(t,s) -- hash + local n = { } + if s then + for k, v in next, s do + n[k] = v + end + end for k, v in next, t do - s[v] = k + n[v] = k end - return s + return n end ---~ function table.are_equal(a,b) ---~ return table.serialize(a) == table.serialize(b) ---~ end - -function table.clone(t,p) -- t is optional or nil or table - if not p then - t, p = { }, t or { } - elseif not t then - t = { } +function table.reversed(t) + if t then + local tt, tn = { }, #t + if tn > 0 then + local ttn = 0 + for i=tn,1,-1 do + ttn = ttn + 1 + tt[ttn] = t[i] + end + end + return tt end - setmetatable(t, { __index = function(_,key) return p[key] end }) -- why not __index = p ? - return t end -function table.hexed(t,seperator) - local tt = { } - for i=1,#t do tt[i] = format("0x%04X",t[i]) end - return concat(tt,seperator or " ") -end - -function table.reverse_hash(h) - local r = { } - for k,v in next, h do - r[v] = lower(gsub(k," ","")) +function table.sequenced(t,sep,simple) -- hash only + local s, n = { }, 0 + for k, v in sortedhash(t) do + if simple then + if v == true then + n = n + 1 + s[n] = k + elseif v and v~= "" then + n = n + 1 + s[n] = k .. "=" .. tostring(v) + end + else + n = n + 1 + s[n] = k .. "=" .. tostring(v) + end end - return r + return concat(s, sep or " | ") end -function table.reverse(t) - local tt = { } - if #t > 0 then - for i=#t,1,-1 do - tt[#tt+1] = t[i] - end +function table.print(t,...) + if type(t) ~= "table" then + print(tostring(t)) + else + table.tohandle(print,t,...) end - return tt end -function table.insert_before_value(t,value,extra) - for i=1,#t do - if t[i] == extra then - remove(t,i) - end - end - for i=1,#t do - if t[i] == value then - insert(t,i,extra) - return - end - end - insert(t,1,extra) +-- -- -- obsolete but we keep them for a while and might comment them later -- -- -- + +-- roughly: copy-loop : unpack : sub == 0.9 : 0.4 : 0.45 (so in critical apps, use unpack) + +function table.sub(t,i,j) + return { unpack(t,i,j) } end -function table.insert_after_value(t,value,extra) - for i=1,#t do - if t[i] == extra then - remove(t,i) - end - end - for i=1,#t do - if t[i] == value then - insert(t,i+1,extra) - return - end - end - insert(t,#t+1,extra) +-- slower than #t on indexed tables (#t only returns the size of the numerically indexed slice) + +function table.is_empty(t) + return not t or not next(t) end +function table.has_one_entry(t) + return t and not next(t,next(t)) +end end -- of closure @@ -1435,7 +1584,10 @@ if not modules then modules = { } end modules ['l-io'] = { license = "see context related readme files" } -local byte, find, gsub = string.byte, string.find, string.gsub +local io = io +local byte, find, gsub, format = string.byte, string.find, string.gsub, string.format +local concat = table.concat +local type = type if string.find(os.getenv("PATH"),";") then io.fileseparator, io.pathseparator = "\\", ";" @@ -1446,9 +1598,7 @@ end function io.loaddata(filename,textmode) local f = io.open(filename,(textmode and 'r') or 'rb') if f then - -- collectgarbage("step") -- sometimes makes a big difference in mem consumption local data = f:read('*all') - -- garbagecollector.check(data) f:close() return data else @@ -1460,13 +1610,14 @@ function io.savedata(filename,data,joiner) local f = io.open(filename,"wb") if f then if type(data) == "table" then - f:write(table.join(data,joiner or "")) + f:write(concat(data,joiner or "")) elseif type(data) == "function" then data(f) else f:write(data or "") end f:close() + io.flush() return true else return false @@ -1495,12 +1646,19 @@ function io.size(filename) end function io.noflines(f) - local n = 0 - for _ in f:lines() do - n = n + 1 + if type(f) == "string" then + local f = io.open(filename) + local n = f and io.noflines(f) or 0 + assert(f:close()) + return n + else + local n = 0 + for _ in f:lines() do + n = n + 1 + end + f:seek('set',0) + return n end - f:seek('set',0) - return n end local nextchar = { @@ -1526,8 +1684,6 @@ local nextchar = { function io.characters(f,n) if f then return nextchar[n or 1], f - else - return nil, nil end end @@ -1536,40 +1692,42 @@ local nextbyte = { local a, b, c, d = f:read(1,1,1,1) if d then return byte(a), byte(b), byte(c), byte(d) - else - return nil, nil, nil, nil + end + end, + [3] = function(f) + local a, b, c = f:read(1,1,1) + if b then + return byte(a), byte(b), byte(c) end end, [2] = function(f) local a, b = f:read(1,1) if b then return byte(a), byte(b) - else - return nil, nil end end, [1] = function (f) local a = f:read(1) if a then return byte(a) - else - return nil end end, [-2] = function (f) local a, b = f:read(1,1) if b then return byte(b), byte(a) - else - return nil, nil + end + end, + [-3] = function(f) + local a, b, c = f:read(1,1,1) + if b then + return byte(c), byte(b), byte(a) end end, [-4] = function(f) local a, b, c, d = f:read(1,1,1,1) if d then return byte(d), byte(c), byte(b), byte(a) - else - return nil, nil, nil, nil end end } @@ -1586,12 +1744,13 @@ function io.ask(question,default,options) while true do io.write(question) if options then - io.write(string.format(" [%s]",table.concat(options,"|"))) + io.write(format(" [%s]",concat(options,"|"))) end if default then - io.write(string.format(" [%s]",default)) + io.write(format(" [%s]",default)) end - io.write(string.format(" ")) + io.write(format(" ")) + io.flush() local answer = io.read() answer = gsub(answer,"^%s*(.*)%s*$","%1") if answer == "" and default then @@ -1615,6 +1774,63 @@ function io.ask(question,default,options) end end +local function readnumber(f,n,m) + if m then + f:seek("set",n) + n = m + end + if n == 1 then + return byte(f:read(1)) + elseif n == 2 then + local a, b = byte(f:read(2),1,2) + return 256 * a + b + elseif n == 3 then + local a, b, c = byte(f:read(3),1,3) + return 256*256 * a + 256 * b + c + elseif n == 4 then + local a, b, c, d = byte(f:read(4),1,4) + return 256*256*256 * a + 256*256 * b + 256 * c + d + elseif n == 8 then + local a, b = readnumber(f,4), readnumber(f,4) + return 256 * a + b + elseif n == 12 then + local a, b, c = readnumber(f,4), readnumber(f,4), readnumber(f,4) + return 256*256 * a + 256 * b + c + elseif n == -2 then + local b, a = byte(f:read(2),1,2) + return 256*a + b + elseif n == -3 then + local c, b, a = byte(f:read(3),1,3) + return 256*256 * a + 256 * b + c + elseif n == -4 then + local d, c, b, a = byte(f:read(4),1,4) + return 256*256*256 * a + 256*256 * b + 256*c + d + elseif n == -8 then + local h, g, f, e, d, c, b, a = byte(f:read(8),1,8) + return 256*256*256*256*256*256*256 * a + + 256*256*256*256*256*256 * b + + 256*256*256*256*256 * c + + 256*256*256*256 * d + + 256*256*256 * e + + 256*256 * f + + 256 * g + + h + else + return 0 + end +end + +io.readnumber = readnumber + +function io.readstring(f,n,m) + if m then + f:seek("set",n) + n = m + end + local str = gsub(f:read(n),"%z","") + return str +end + end -- of closure @@ -1628,11 +1844,15 @@ if not modules then modules = { } end modules ['l-number'] = { license = "see context related readme files" } +-- this module will be replaced when we have the bit library + local tostring = tostring -local format, floor, insert, match = string.format, math.floor, table.insert, string.match +local format, floor, match, rep = string.format, math.floor, string.match, string.rep +local concat, insert = table.concat, table.insert local lpegmatch = lpeg.match -number = number or { } +number = number or { } +local number = number -- a,b,c,d,e,f = number.toset(100101) @@ -1680,6 +1900,54 @@ function number.bits(n,zero) end +function number.bit(p) + return 2 ^ (p - 1) -- 1-based indexing +end + +function number.hasbit(x, p) -- typical call: if hasbit(x, bit(3)) then ... + return x % (p + p) >= p +end + +function number.setbit(x, p) + return hasbit(x, p) and x or x + p +end + +function number.clearbit(x, p) + return hasbit(x, p) and x - p or x +end + + +function number.tobitstring(n,m) + if n == 0 then + if m then + rep("00000000",m) + else + return "00000000" + end + else + local t = { } + while n > 0 do + insert(t,1,n % 2 > 0 and 1 or 0) + n = floor(n/2) + end + local nn = 8 - #t % 8 + if nn > 0 and nn < 8 then + for i=1,nn do + insert(t,1,0) + end + end + if m then + m = m * 8 - #t + if m > 0 then + insert(t,1,rep("0",m)) + end + end + return concat(t) + end +end + + + end -- of closure do -- create closure to overcome 200 locals limit @@ -1692,6 +1960,8 @@ if not modules then modules = { } end modules ['l-set'] = { license = "see context related readme files" } +-- This will become obsolete when we have the bitset library embedded. + set = set or { } local nums = { } @@ -1735,10 +2005,11 @@ function set.tolist(n) if n == 0 or not tabs[n] then return "" else - local t = { } + local t, n = { }, 0 for k, v in next, tabs[n] do if v then - t[#t+1] = k + n = n + 1 + t[n] = k end end return concat(t," ") @@ -1756,17 +2027,6 @@ function set.contains(n,s) end end ---~ local c = set.create{'aap','noot','mies'} ---~ local s = set.tonumber(c) ---~ local t = set.totable(s) ---~ print(t['aap']) ---~ local c = set.create{'zus','wim','jet'} ---~ local s = set.tonumber(c) ---~ local t = set.totable(s) ---~ print(t['aap']) ---~ print(t['jet']) ---~ print(set.contains(t,'jet')) ---~ print(set.contains(t,'aap')) @@ -1782,32 +2042,119 @@ if not modules then modules = { } end modules ['l-os'] = { license = "see context related readme files" } +-- This file deals with some operating system issues. Please don't bother me +-- with the pros and cons of operating systems as they all have their flaws +-- and benefits. Bashing one of them won't help solving problems and fixing +-- bugs faster and is a waste of time and energy. +-- +-- path separators: / or \ ... we can use / everywhere +-- suffixes : dll so exe ... no big deal +-- quotes : we can use "" in most cases +-- expansion : unless "" are used * might give side effects +-- piping/threads : somewhat different for each os +-- locations : specific user file locations and settings can change over time +-- +-- os.type : windows | unix (new, we already guessed os.platform) +-- os.name : windows | msdos | linux | macosx | solaris | .. | generic (new) +-- os.platform : extended os.name with architecture + -- maybe build io.flush in os.execute -local find, format, gsub = string.find, string.format, string.gsub +local os = os +local find, format, gsub, upper = string.find, string.format, string.gsub, string.upper +local concat = table.concat local random, ceil = math.random, math.ceil +local rawget, rawset, type, getmetatable, setmetatable, tonumber = rawget, rawset, type, getmetatable, setmetatable, tonumber + +-- The following code permits traversing the environment table, at least +-- in luatex. Internally all environment names are uppercase. + +if not os.__getenv__ then + + os.__getenv__ = os.getenv + os.__setenv__ = os.setenv + + if os.env then + + local osgetenv = os.getenv + local ossetenv = os.setenv + local osenv = os.env local _ = osenv.PATH -- initialize the table + + function os.setenv(k,v) + if v == nil then + v = "" + end + local K = upper(k) + osenv[K] = v + if type(v) == "table" then + v = concat(v,";") -- path + end + ossetenv(K,v) + end + + function os.getenv(k) + local K = upper(k) + local v = osenv[K] or osenv[k] or osgetenv(K) or osgetenv(k) + if v == "" then + return nil + else + return v + end + end + + else + + local ossetenv = os.setenv + local osgetenv = os.getenv + local osenv = { } + + function os.setenv(k,v) + if v == nil then + v = "" + end + local K = upper(k) + osenv[K] = v + end + + function os.getenv(k) + local K = upper(k) + local v = osenv[K] or osgetenv(K) or osgetenv(k) + if v == "" then + return nil + else + return v + end + end + + local function __index(t,k) + return os.getenv(k) + end + local function __newindex(t,k,v) + os.setenv(k,v) + end + + os.env = { } + + setmetatable(os.env, { __index = __index, __newindex = __newindex } ) + + end + +end + +-- end of environment hack -local execute, spawn, exec, ioflush = os.execute, os.spawn or os.execute, os.exec or os.execute, io.flush +local execute, spawn, exec, iopopen, ioflush = os.execute, os.spawn or os.execute, os.exec or os.execute, io.popen, io.flush function os.execute(...) ioflush() return execute(...) end function os.spawn (...) ioflush() return spawn (...) end function os.exec (...) ioflush() return exec (...) end +function io.popen (...) ioflush() return iopopen(...) end function os.resultof(command) - ioflush() -- else messed up logging local handle = io.popen(command,"r") - if not handle then - -- print("unknown command '".. command .. "' in os.resultof") - return "" - else - return handle:read("*all") or "" - end + return handle and handle:read("*all") or "" end ---~ os.type : windows | unix (new, we already guessed os.platform) ---~ os.name : windows | msdos | linux | macosx | solaris | .. | generic (new) ---~ os.platform : extended os.name with architecture - if not io.fileseparator then if find(os.getenv("PATH"),";") then io.fileseparator, io.pathseparator, os.type = "\\", ";", os.type or "mswin" @@ -1856,16 +2203,11 @@ function os.runtime() return os.gettimeofday() - startuptime end ---~ print(os.gettimeofday()-os.time()) ---~ os.sleep(1.234) ---~ print (">>",os.runtime()) ---~ print(os.date("%H:%M:%S",os.gettimeofday())) ---~ print(os.date("%H:%M:%S",os.time())) -- no need for function anymore as we have more clever code and helpers now -- this metatable trickery might as well disappear -os.resolvers = os.resolvers or { } +os.resolvers = os.resolvers or { } -- will become private local resolvers = os.resolvers @@ -1878,24 +2220,6 @@ end setmetatable(os,osmt) -if not os.setenv then - - -- we still store them but they won't be seen in - -- child processes although we might pass them some day - -- using command concatination - - local env, getenv = { }, os.getenv - - function os.setenv(k,v) - env[k] = v - end - - function os.getenv(k) - return env[k] or getenv(k) - end - -end - -- we can use HOSTTYPE on some platforms local name, platform = os.name or "linux", os.getenv("MTX_PLATFORM") or "" @@ -1935,7 +2259,7 @@ elseif os.type == "windows" then elseif name == "linux" then function os.resolvers.platform(t,k) - -- we sometims have HOSTTYPE set so let's check that first + -- we sometimes have HOSTTYPE set so let's check that first local platform, architecture = "", os.getenv("HOSTTYPE") or os.resultof("uname -m") or "" if find(architecture,"x86_64") then platform = "linux-64" @@ -2013,10 +2337,10 @@ elseif name == "freebsd" then elseif name == "kfreebsd" then function os.resolvers.platform(t,k) - -- we sometims have HOSTTYPE set so let's check that first + -- we sometimes have HOSTTYPE set so let's check that first local platform, architecture = "", os.getenv("HOSTTYPE") or os.resultof("uname -m") or "" if find(architecture,"x86_64") then - platform = "kfreebsd-64" + platform = "kfreebsd-amd64" else platform = "kfreebsd-i386" end @@ -2091,61 +2415,86 @@ if not modules then modules = { } end modules ['l-file'] = { -- needs a cleanup -file = file or { } +file = file or { } +local file = file -local concat = table.concat -local find, gmatch, match, gsub, sub, char = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char +local insert, concat = table.insert, table.concat +local find, gmatch, match, gsub, sub, char, lower = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char, string.lower local lpegmatch = lpeg.match +local getcurrentdir, attributes = lfs.currentdir, lfs.attributes -function file.removesuffix(filename) - return (gsub(filename,"%.[%a%d]+$","")) +local P, R, S, C, Cs, Cp, Cc = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc + +local function dirname(name,default) + return match(name,"^(.+)[/\\].-$") or (default or "") end -function file.addsuffix(filename, suffix) - if not suffix or suffix == "" then - return filename - elseif not find(filename,"%.[%a%d]+$") then - return filename .. "." .. suffix - else - return filename - end +local function basename(name) + return match(name,"^.+[/\\](.-)$") or name end -function file.replacesuffix(filename, suffix) - return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix +local function nameonly(name) + return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) end -function file.dirname(name,default) - return match(name,"^(.+)[/\\].-$") or (default or "") +local function extname(name,default) + return match(name,"^.+%.([^/\\]-)$") or default or "" end -function file.basename(name) - return match(name,"^.+[/\\](.-)$") or name +local function splitname(name) + local n, s = match(name,"^(.+)%.([^/\\]-)$") + return n or name, s or "" end -function file.nameonly(name) - return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) +file.basename = basename +file.dirname = dirname +file.nameonly = nameonly +file.extname = extname +file.suffix = extname + +function file.removesuffix(filename) + return (gsub(filename,"%.[%a%d]+$","")) end -function file.extname(name,default) - return match(name,"^.+%.([^/\\]-)$") or default or "" +function file.addsuffix(filename, suffix, criterium) + if not suffix or suffix == "" then + return filename + elseif criterium == true then + return filename .. "." .. suffix + elseif not criterium then + local n, s = splitname(filename) + if not s or s == "" then + return filename .. "." .. suffix + else + return filename + end + else + local n, s = splitname(filename) + if s and s ~= "" then + local t = type(criterium) + if t == "table" then + -- keep if in criterium + for i=1,#criterium do + if s == criterium[i] then + return filename + end + end + elseif t == "string" then + -- keep if criterium + if s == criterium then + return filename + end + end + end + return n .. "." .. suffix + end end -file.suffix = file.extname ---~ function file.join(...) ---~ local pth = concat({...},"/") ---~ pth = gsub(pth,"\\","/") ---~ local a, b = match(pth,"^(.*://)(.*)$") ---~ if a and b then ---~ return a .. gsub(b,"//+","/") ---~ end ---~ a, b = match(pth,"^(//)(.*)$") ---~ if a and b then ---~ return a .. gsub(b,"//+","/") ---~ end ---~ return (gsub(pth,"//+","/")) ---~ end +function file.replacesuffix(filename, suffix) + return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix +end + local trick_1 = char(1) local trick_2 = "^" .. trick_1 .. "/+" @@ -2173,60 +2522,37 @@ function file.join(...) return (gsub(pth,"//+","/")) end ---~ print(file.join("//","/y")) ---~ print(file.join("/","/y")) ---~ print(file.join("","/y")) ---~ print(file.join("/x/","/y")) ---~ print(file.join("x/","/y")) ---~ print(file.join("http://","/y")) ---~ print(file.join("http://a","/y")) ---~ print(file.join("http:///a","/y")) ---~ print(file.join("//nas-1","/y")) -function file.iswritable(name) - local a = lfs.attributes(name) or lfs.attributes(file.dirname(name,".")) +function file.is_writable(name) + local a = attributes(name) or attributes(dirname(name,".")) return a and sub(a.permissions,2,2) == "w" end -function file.isreadable(name) - local a = lfs.attributes(name) +function file.is_readable(name) + local a = attributes(name) return a and sub(a.permissions,1,1) == "r" end -file.is_readable = file.isreadable -file.is_writable = file.iswritable +file.isreadable = file.is_readable -- depricated +file.iswritable = file.is_writable -- depricated --- todo: lpeg - ---~ function file.split_path(str) ---~ local t = { } ---~ str = gsub(str,"\\", "/") ---~ str = gsub(str,"(%a):([;/])", "%1\001%2") ---~ for name in gmatch(str,"([^;:]+)") do ---~ if name ~= "" then ---~ t[#t+1] = gsub(name,"\001",":") ---~ end ---~ end ---~ return t ---~ end +-- todo: lpeg \\ / .. does not save much local checkedsplit = string.checkedsplit -function file.split_path(str,separator) +function file.splitpath(str,separator) -- string str = gsub(str,"\\","/") return checkedsplit(str,separator or io.pathseparator) end -function file.join_path(tab) - return concat(tab,io.pathseparator) -- can have trailing // +function file.joinpath(tab,separator) -- table + return concat(tab,separator or io.pathseparator) -- can have trailing // end -- we can hash them weakly -local insert = table.insert - -function file.collapse_path(str,anchor) +function file.collapsepath(str,anchor) if anchor and not find(str,"^/") and not find(str,"^%a:") then str = getcurrentdir() .. "/" .. str end @@ -2280,62 +2606,15 @@ function file.collapse_path(str,anchor) return concat(newelements, '/') end end -function file.xcollapse_path(str) - print('collapse', str) - if str == "" or str =="." then - return "." - elseif find(str,"^%.%.") then - return str - elseif not find(str,"%.") then - return str - end - str = gsub(str,"^%./",lfs.currentdir() .. "/") -- ./xx in qualified - str = gsub(str,"\\","/") - local oldelements = checkedsplit(str,"/") - local newelements = { } - local i = #oldelements - while i > 0 do - local element = oldelements[i] - if element == '.' then - -- do nothing - elseif element == '..' then - local n = i -1 - while n > 0 do - local element = oldelements[n] - if element ~= '..' and element ~= '.' then - oldelements[n] = '.' - break - else - n = n - 1 - end - end - if n<1 then - insert(newelements,1,'..') - end - elseif element ~= "" then - insert(newelements,1,element) - end - i = i - 1 - end - if #newelements == 0 then - return "." - elseif find(str,"^/") then - return "/" .. concat(newelements,'/') - else - return concat(newelements, '/') - end -end ---~ print(file.collapse_path("/a")) ---~ print(file.collapse_path("a/./b/..")) ---~ print(file.collapse_path("a/aa/../b/bb")) ---~ print(file.collapse_path("a/../..")) ---~ print(file.collapse_path("a/.././././b/..")) ---~ print(file.collapse_path("a/./././b/..")) ---~ print(file.collapse_path("a/b/c/../..")) -function file.robustname(str) - return (gsub(str,"[^%a%d%/%-%.\\]+","-")) +function file.robustname(str,strict) + str = gsub(str,"[^%a%d%/%-%.\\]+","-") + if strict then + return lower(gsub(str,"^%-*(.-)%-*$","%1")) + else + return str + end end file.readdata = io.loaddata @@ -2347,100 +2626,34 @@ end -- lpeg variants, slightly faster, not always ---~ local period = lpeg.P(".") ---~ local slashes = lpeg.S("\\/") ---~ local noperiod = 1-period ---~ local noslashes = 1-slashes ---~ local name = noperiod^1 - ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.C(noperiod^1) * -1 - ---~ function file.extname(name) ---~ return lpegmatch(pattern,name) or "" ---~ end - ---~ local pattern = lpeg.Cs(((period * noperiod^1 * -1)/"" + 1)^1) - ---~ function file.removesuffix(name) ---~ return lpegmatch(pattern,name) ---~ end - ---~ local pattern = (noslashes^0 * slashes)^1 * lpeg.C(noslashes^1) * -1 - ---~ function file.basename(name) ---~ return lpegmatch(pattern,name) or name ---~ end - ---~ local pattern = (noslashes^0 * slashes)^1 * lpeg.Cp() * noslashes^1 * -1 - ---~ function file.dirname(name) ---~ local p = lpegmatch(pattern,name) ---~ if p then ---~ return sub(name,1,p-2) ---~ else ---~ return "" ---~ end ---~ end - ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.Cp() * noperiod^1 * -1 - ---~ function file.addsuffix(name, suffix) ---~ local p = lpegmatch(pattern,name) ---~ if p then ---~ return name ---~ else ---~ return name .. "." .. suffix ---~ end ---~ end - ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.Cp() * noperiod^1 * -1 - ---~ function file.replacesuffix(name,suffix) ---~ local p = lpegmatch(pattern,name) ---~ if p then ---~ return sub(name,1,p-2) .. "." .. suffix ---~ else ---~ return name .. "." .. suffix ---~ end ---~ end - ---~ local pattern = (noslashes^0 * slashes)^0 * lpeg.Cp() * ((noperiod^1 * period)^1 * lpeg.Cp() + lpeg.P(true)) * noperiod^1 * -1 - ---~ function file.nameonly(name) ---~ local a, b = lpegmatch(pattern,name) ---~ if b then ---~ return sub(name,a,b-2) ---~ elseif a then ---~ return sub(name,a) ---~ else ---~ return name ---~ end ---~ end - ---~ local test = file.extname ---~ local test = file.basename ---~ local test = file.dirname ---~ local test = file.addsuffix ---~ local test = file.replacesuffix ---~ local test = file.nameonly - ---~ print(1,test("./a/b/c/abd.def.xxx","!!!")) ---~ print(2,test("./../b/c/abd.def.xxx","!!!")) ---~ print(3,test("a/b/c/abd.def.xxx","!!!")) ---~ print(4,test("a/b/c/def.xxx","!!!")) ---~ print(5,test("a/b/c/def","!!!")) ---~ print(6,test("def","!!!")) ---~ print(7,test("def.xxx","!!!")) - ---~ local tim = os.clock() for i=1,250000 do local ext = test("abd.def.xxx","!!!") end print(os.clock()-tim) + + + + + + + + + + + + + + + + + -- also rewrite previous -local letter = lpeg.R("az","AZ") + lpeg.S("_-+") -local separator = lpeg.P("://") +local letter = R("az","AZ") + S("_-+") +local separator = P("://") + +local qualified = P(".")^0 * P("/") + letter*P(":") + letter^1*separator + letter^1 * P("/") +local rootbased = P("/") + letter*P(":") -local qualified = lpeg.P(".")^0 * lpeg.P("/") + letter*lpeg.P(":") + letter^1*separator + letter^1 * lpeg.P("/") -local rootbased = lpeg.P("/") + letter*lpeg.P(":") +lpeg.patterns.qualified = qualified +lpeg.patterns.rootbased = rootbased -- ./name ../name /name c: :// name/name @@ -2452,14 +2665,16 @@ function file.is_rootbased_path(filename) return lpegmatch(rootbased,filename) ~= nil end -local slash = lpeg.S("\\/") -local period = lpeg.P(".") -local drive = lpeg.C(lpeg.R("az","AZ")) * lpeg.P(":") -local path = lpeg.C(((1-slash)^0 * slash)^0) -local suffix = period * lpeg.C(lpeg.P(1-period)^0 * lpeg.P(-1)) -local base = lpeg.C((1-suffix)^0) +-- actually these are schemes -local pattern = (drive + lpeg.Cc("")) * (path + lpeg.Cc("")) * (base + lpeg.Cc("")) * (suffix + lpeg.Cc("")) +local slash = S("\\/") +local period = P(".") +local drive = C(R("az","AZ")) * P(":") +local path = C(((1-slash)^0 * slash)^0) +local suffix = period * C(P(1-period)^0 * P(-1)) +local base = C((1-suffix)^0) + +local pattern = (drive + Cc("")) * (path + Cc("")) * (base + Cc("")) * (suffix + Cc("")) function file.splitname(str) -- returns drive, path, base, suffix return lpegmatch(pattern,str) @@ -2472,14 +2687,13 @@ end -- test { "/aa", "/aa/bb", "/aa/bb/cc", "/aa/bb/cc.dd", "/aa/bb/cc.dd.ee" } -- test { "aa", "aa/bb", "aa/bb/cc", "aa/bb/cc.dd", "aa/bb/cc.dd.ee" } ---~ -- todo: ---~ ---~ if os.type == "windows" then ---~ local currentdir = lfs.currentdir ---~ function lfs.currentdir() ---~ return (gsub(currentdir(),"\\","/")) ---~ end ---~ end + +-- for myself: + +function file.strip(name,dir) + local b, a = match(name,"^(.-)" .. dir .. "(.*)$") + return a ~= "" and a or name +end end -- of closure @@ -2495,6 +2709,7 @@ if not modules then modules = { } end modules ['l-md5'] = { -- This also provides file checksums and checkers. +local md5, file = md5, file local gsub, format, byte = string.gsub, string.format, string.byte local function convert(str,fmt) @@ -2505,27 +2720,13 @@ if not md5.HEX then function md5.HEX(str) return convert(str,"%02X") end end if not md5.hex then function md5.hex(str) return convert(str,"%02x") end end if not md5.dec then function md5.dec(str) return convert(str,"%03i") end end ---~ if not md5.HEX then ---~ local function remap(chr) return format("%02X",byte(chr)) end ---~ function md5.HEX(str) return (gsub(md5.sum(str),".",remap)) end ---~ end ---~ if not md5.hex then ---~ local function remap(chr) return format("%02x",byte(chr)) end ---~ function md5.hex(str) return (gsub(md5.sum(str),".",remap)) end ---~ end ---~ if not md5.dec then ---~ local function remap(chr) return format("%03i",byte(chr)) end ---~ function md5.dec(str) return (gsub(md5.sum(str),".",remap)) end ---~ end - -file.needs_updating_threshold = 1 - -function file.needs_updating(oldname,newname) -- size modification access change + +function file.needs_updating(oldname,newname,threshold) -- size modification access change local oldtime = lfs.attributes(oldname, modification) local newtime = lfs.attributes(newname, modification) if newtime >= oldtime then return false - elseif oldtime - newtime < file.needs_updating_threshold then + elseif oldtime - newtime < (threshold or 1) then return false else return true @@ -2572,86 +2773,171 @@ if not modules then modules = { } end modules ['l-url'] = { license = "see context related readme files" } -local char, gmatch, gsub = string.char, string.gmatch, string.gsub +local char, gmatch, gsub, format, byte, find = string.char, string.gmatch, string.gsub, string.format, string.byte, string.find +local concat = table.concat local tonumber, type = tonumber, type -local lpegmatch = lpeg.match +local P, C, R, S, Cs, Cc, Ct = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cs, lpeg.Cc, lpeg.Ct +local lpegmatch, lpegpatterns, replacer = lpeg.match, lpeg.patterns, lpeg.replacer --- from the spec (on the web): +-- from wikipedia: -- --- foo://example.com:8042/over/there?name=ferret#nose --- \_/ \______________/\_________/ \_________/ \__/ --- | | | | | --- scheme authority path query fragment --- | _____________________|__ --- / \ / \ --- urn:example:animal:ferret:nose +-- foo://username:password@example.com:8042/over/there/index.dtb?type=animal;name=narwhal#nose +-- \_/ \_______________/ \_________/ \__/ \___/ \_/ \______________________/ \__/ +-- | | | | | | | | +-- | userinfo hostname port | | query fragment +-- | \________________________________/\_____________|____|/ +-- scheme | | | | +-- | authority path | | +-- | | | +-- | path interpretable as filename +-- | ___________|____________ | +-- / \ / \ | +-- urn:example:animal:ferret:nose interpretable as extension + +url = url or { } +local url = url + +local tochar = function(s) return char(tonumber(s,16)) end + +local colon = P(":") +local qmark = P("?") +local hash = P("#") +local slash = P("/") +local percent = P("%") +local endofstring = P(-1) + +local hexdigit = R("09","AF","af") +local plus = P("+") +local nothing = Cc("") +local escaped = (plus / " ") + (percent * C(hexdigit * hexdigit) / tochar) -url = url or { } +-- we assume schemes with more than 1 character (in order to avoid problems with windows disks) -local function tochar(s) - return char(tonumber(s,16)) -end +local scheme = Cs((escaped+(1-colon-slash-qmark-hash))^2) * colon + nothing +local authority = slash * slash * Cs((escaped+(1- slash-qmark-hash))^0) + nothing +local path = slash * Cs((escaped+(1- qmark-hash))^0) + nothing +local query = qmark * Cs((escaped+(1- hash))^0) + nothing +local fragment = hash * Cs((escaped+(1- endofstring))^0) + nothing -local colon, qmark, hash, slash, percent, endofstring = lpeg.P(":"), lpeg.P("?"), lpeg.P("#"), lpeg.P("/"), lpeg.P("%"), lpeg.P(-1) +local validurl = scheme * authority * path * query * fragment +local parser = Ct(validurl) -local hexdigit = lpeg.R("09","AF","af") -local plus = lpeg.P("+") -local escaped = (plus / " ") + (percent * lpeg.C(hexdigit * hexdigit) / tochar) +lpegpatterns.url = validurl +lpegpatterns.urlsplitter = parser --- we assume schemes with more than 1 character (in order to avoid problems with windows disks) +local escapes = { } ; for i=0,255 do escapes[i] = format("%%%02X",i) end -local scheme = lpeg.Cs((escaped+(1-colon-slash-qmark-hash))^2) * colon + lpeg.Cc("") -local authority = slash * slash * lpeg.Cs((escaped+(1- slash-qmark-hash))^0) + lpeg.Cc("") -local path = slash * lpeg.Cs((escaped+(1- qmark-hash))^0) + lpeg.Cc("") -local query = qmark * lpeg.Cs((escaped+(1- hash))^0) + lpeg.Cc("") -local fragment = hash * lpeg.Cs((escaped+(1- endofstring))^0) + lpeg.Cc("") +local escaper = Cs((R("09","AZ","az") + S("-./_") + P(1) / escapes)^0) -local parser = lpeg.Ct(scheme * authority * path * query * fragment) +lpegpatterns.urlescaper = escaper -- todo: reconsider Ct as we can as well have five return values (saves a table) -- so we can have two parsers, one with and one without -function url.split(str) +local function split(str) return (type(str) == "string" and lpegmatch(parser,str)) or str end +local function hasscheme(str) + local scheme = lpegmatch(scheme,str) -- at least one character + return scheme and scheme ~= "" +end + -- todo: cache them -function url.hashed(str) - local s = url.split(str) +local rootletter = R("az","AZ") + + S("_-+") +local separator = P("://") +local qualified = P(".")^0 * P("/") + + rootletter * P(":") + + rootletter^1 * separator + + rootletter^1 * P("/") +local rootbased = P("/") + + rootletter * P(":") + +local barswapper = replacer("|",":") +local backslashswapper = replacer("\\","/") + +local function hashed(str) -- not yet ok (/test?test) + local s = split(str) local somescheme = s[1] ~= "" - return { - scheme = (somescheme and s[1]) or "file", - authority = s[2], - path = s[3], - query = s[4], - fragment = s[5], - original = str, - noscheme = not somescheme, - } + local somequery = s[4] ~= "" + if not somescheme and not somequery then + s = { + scheme = "file", + authority = "", + path = str, + query = "", + fragment = "", + original = str, + noscheme = true, + filename = str, + } + else -- not always a filename but handy anyway + local authority, path, filename = s[2], s[3] + if authority == "" then + filename = path + else + filename = authority .. "/" .. path + end + s = { + scheme = s[1], + authority = authority, + path = path, + query = s[4], + fragment = s[5], + original = str, + noscheme = false, + filename = filename, + } + end + return s end -function url.hasscheme(str) - return url.split(str)[1] ~= "" -end +-- Here we assume: +-- +-- files: /// = relative +-- files: //// = absolute (!) + -function url.addscheme(str,scheme) - return (url.hasscheme(str) and str) or ((scheme or "file:///") .. str) + +url.split = split +url.hasscheme = hasscheme +url.hashed = hashed + +function url.addscheme(str,scheme) -- no authority + if hasscheme(str) then + return str + elseif not scheme then + return "file:///" .. str + else + return scheme .. ":///" .. str + end end -function url.construct(hash) - local fullurl = hash.sheme .. "://".. hash.authority .. hash.path - if hash.query then - fullurl = fullurl .. "?".. hash.query +function url.construct(hash) -- dodo: we need to escape ! + local fullurl, f = { }, 0 + local scheme, authority, path, query, fragment = hash.scheme, hash.authority, hash.path, hash.query, hash.fragment + if scheme and scheme ~= "" then + f = f + 1 ; fullurl[f] = scheme .. "://" + end + if authority and authority ~= "" then + f = f + 1 ; fullurl[f] = authority + end + if path and path ~= "" then + f = f + 1 ; fullurl[f] = "/" .. path + end + if query and query ~= "" then + f = f + 1 ; fullurl[f] = "?".. query end - if hash.fragment then - fullurl = fullurl .. "?".. hash.fragment + if fragment and fragment ~= "" then + f = f + 1 ; fullurl[f] = "#".. fragment end - return fullurl + return lpegmatch(escaper,concat(fullurl)) end function url.filename(filename) - local t = url.hashed(filename) + local t = hashed(filename) return (t.scheme == "file" and (gsub(t.path,"^/([a-zA-Z])([:|])/)","%1:"))) or filename end @@ -2667,37 +2953,13 @@ function url.query(str) end end ---~ print(url.filename("file:///c:/oeps.txt")) ---~ print(url.filename("c:/oeps.txt")) ---~ print(url.filename("file:///oeps.txt")) ---~ print(url.filename("file:///etc/test.txt")) ---~ print(url.filename("/oeps.txt")) - ---~ from the spec on the web (sort of): ---~ ---~ function test(str) ---~ print(table.serialize(url.hashed(str))) ---~ end ---~ ---~ test("%56pass%20words") ---~ test("file:///c:/oeps.txt") ---~ test("file:///c|/oeps.txt") ---~ test("file:///etc/oeps.txt") ---~ test("file://./etc/oeps.txt") ---~ test("file:////etc/oeps.txt") ---~ test("ftp://ftp.is.co.za/rfc/rfc1808.txt") ---~ test("http://www.ietf.org/rfc/rfc2396.txt") ---~ test("ldap://[2001:db8::7]/c=GB?objectClass?one#what") ---~ test("mailto:John.Doe@example.com") ---~ test("news:comp.infosystems.www.servers.unix") ---~ test("tel:+1-816-555-1212") ---~ test("telnet://192.0.2.16:80/") ---~ test("urn:oasis:names:specification:docbook:dtd:xml:4.1.2") ---~ test("/etc/passwords") ---~ test("http://www.pragma-ade.com/spaced%20name") - ---~ test("zip:///oeps/oeps.zip#bla/bla.tex") ---~ test("zip:///oeps/oeps.zip?bla/bla.tex") + + + + + + + end -- of closure @@ -2712,35 +2974,53 @@ if not modules then modules = { } end modules ['l-dir'] = { license = "see context related readme files" } --- dir.expand_name will be merged with cleanpath and collapsepath +-- dir.expandname will be merged with cleanpath and collapsepath local type = type local find, gmatch, match, gsub = string.find, string.gmatch, string.match, string.gsub +local concat, insert, remove = table.concat, table.insert, table.remove local lpegmatch = lpeg.match +local P, S, R, C, Cc, Cs, Ct, Cv, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cv, lpeg.V + dir = dir or { } +local dir = dir +local lfs = lfs + +local attributes = lfs.attributes +local walkdir = lfs.dir +local isdir = lfs.isdir +local isfile = lfs.isfile +local mkdir = lfs.mkdir +local chdir = lfs.chdir +local currentdir = lfs.currentdir -- handy function dir.current() - return (gsub(lfs.currentdir(),"\\","/")) + return (gsub(currentdir(),"\\","/")) end --- optimizing for no string.find (*) does not save time +-- optimizing for no find (*) does not save time -local attributes = lfs.attributes -local walkdir = lfs.dir -local function glob_pattern(path,patt,recurse,action) - local ok, scanner +local lfsisdir = isdir + +local function isdir(path) + path = gsub(path,"[/\\]+$","") + return lfsisdir(path) +end + +lfs.isdir = isdir + +local function globpattern(path,patt,recurse,action) if path == "/" then - ok, scanner = xpcall(function() return walkdir(path..".") end, function() end) -- kepler safe - else - ok, scanner = xpcall(function() return walkdir(path) end, function() end) -- kepler safe + path = path .. "." + elseif not find(path,"/$") then + path = path .. '/' end - if ok and type(scanner) == "function" then - if not find(path,"/$") then path = path .. '/' end - for name in scanner do + if isdir(path) then -- lfs.isdir does not like trailing / + for name in walkdir(path) do -- lfs.dir accepts trailing / local full = path .. name local mode = attributes(full,'mode') if mode == 'file' then @@ -2748,15 +3028,15 @@ local function glob_pattern(path,patt,recurse,action) action(full) end elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then - glob_pattern(full,patt,recurse,action) + globpattern(full,patt,recurse,action) end end end end -dir.glob_pattern = glob_pattern +dir.globpattern = globpattern -local function collect_pattern(path,patt,recurse,result) +local function collectpattern(path,patt,recurse,result) local ok, scanner result = result or { } if path == "/" then @@ -2775,7 +3055,7 @@ local function collect_pattern(path,patt,recurse,result) result[name] = attr end elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then - attr.list = collect_pattern(full,patt,recurse) + attr.list = collectpattern(full,patt,recurse) result[name] = attr end end @@ -2783,9 +3063,7 @@ local function collect_pattern(path,patt,recurse,result) return result end -dir.collect_pattern = collect_pattern - -local P, S, R, C, Cc, Cs, Ct, Cv, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cv, lpeg.V +dir.collectpattern = collectpattern local pattern = Ct { [1] = (C(P(".") + P("/")^1) + C(R("az","AZ") * P(":") * P("/")^0) + Cc("./")) * V(2) * V(3), @@ -2809,16 +3087,16 @@ local function glob(str,t) for s=1,#str do glob(str[s],t) end - elseif lfs.isfile(str) then + elseif isfile(str) then t(str) else - local split = lpegmatch(pattern,str) + local split = lpegmatch(pattern,str) -- we could use the file splitter if split then local root, path, base = split[1], split[2], split[3] local recurse = find(base,"%*%*") local start = root .. path local result = lpegmatch(filter,start .. base) - glob_pattern(start,result,recurse,t) + globpattern(start,result,recurse,t) end end else @@ -2828,12 +3106,15 @@ local function glob(str,t) glob(str[s],t) end return t - elseif lfs.isfile(str) then - local t = t or { } - t[#t+1] = str - return t + elseif isfile(str) then + if t then + t[#t+1] = str + return t + else + return { str } + end else - local split = lpegmatch(pattern,str) + local split = lpegmatch(pattern,str) -- we could use the file splitter if split then local t = t or { } local action = action or function(name) t[#t+1] = name end @@ -2841,7 +3122,7 @@ local function glob(str,t) local recurse = find(base,"%*%*") local start = root .. path local result = lpegmatch(filter,start .. base) - glob_pattern(start,result,recurse,action) + globpattern(start,result,recurse,action) return t else return { } @@ -2852,18 +3133,14 @@ end dir.glob = glob ---~ list = dir.glob("**/*.tif") ---~ list = dir.glob("/**/*.tif") ---~ list = dir.glob("./**/*.tif") ---~ list = dir.glob("oeps/**/*.tif") ---~ list = dir.glob("/oeps/**/*.tif") local function globfiles(path,recurse,func,files) -- func == pattern or function if type(func) == "string" then - local s = func -- alas, we need this indirect way + local s = func func = function(name) return find(name,s) end end files = files or { } + local noffiles = #files for name in walkdir(path) do if find(name,"^%.") then --- skip @@ -2874,12 +3151,9 @@ local function globfiles(path,recurse,func,files) -- func == pattern or function globfiles(path .. "/" .. name,recurse,func,files) end elseif mode == "file" then - if func then - if func(name) then - files[#files+1] = path .. "/" .. name - end - else - files[#files+1] = path .. "/" .. name + if not func or func(name) then + noffiles = noffiles + 1 + files[noffiles] = path .. "/" .. name end end end @@ -2897,17 +3171,15 @@ dir.globfiles = globfiles -- print(dir.ls("*.tex")) function dir.ls(pattern) - return table.concat(glob(pattern),"\n") + return concat(glob(pattern),"\n") end ---~ mkdirs("temp") ---~ mkdirs("a/b/c") ---~ mkdirs(".","/a/b/c") ---~ mkdirs("a","b","c") local make_indeed = true -- false -if string.find(os.getenv("PATH"),";") then -- os.type == "windows" +local onwindows = os.type == "windows" or find(os.getenv("PATH"),";") + +if onwindows then function dir.mkdirs(...) local str, pth, t = "", "", { ... } @@ -2956,64 +3228,21 @@ if string.find(os.getenv("PATH"),";") then -- os.type == "windows" else pth = pth .. "/" .. s end - if make_indeed and not lfs.isdir(pth) then - lfs.mkdir(pth) - end - end - return pth, (lfs.isdir(pth) == true) - end - ---~ print(dir.mkdirs("","","a","c")) ---~ print(dir.mkdirs("a")) ---~ print(dir.mkdirs("a:")) ---~ print(dir.mkdirs("a:/b/c")) ---~ print(dir.mkdirs("a:b/c")) ---~ print(dir.mkdirs("a:/bbb/c")) ---~ print(dir.mkdirs("/a/b/c")) ---~ print(dir.mkdirs("/aaa/b/c")) ---~ print(dir.mkdirs("//a/b/c")) ---~ print(dir.mkdirs("///a/b/c")) ---~ print(dir.mkdirs("a/bbb//ccc/")) - - function dir.expand_name(str) -- will be merged with cleanpath and collapsepath - local first, nothing, last = match(str,"^(//)(//*)(.*)$") - if first then - first = dir.current() .. "/" - end - if not first then - first, last = match(str,"^(//)/*(.*)$") - end - if not first then - first, last = match(str,"^([a-zA-Z]:)(.*)$") - if first and not find(last,"^/") then - local d = lfs.currentdir() - if lfs.chdir(first) then - first = dir.current() - end - lfs.chdir(d) + if make_indeed and not isdir(pth) then + mkdir(pth) end end - if not first then - first, last = dir.current(), str - end - last = gsub(last,"//","/") - last = gsub(last,"/%./","/") - last = gsub(last,"^/*","") - first = gsub(first,"/*$","") - if last == "" then - return first - else - return first .. "/" .. last - end + return pth, (isdir(pth) == true) end + else function dir.mkdirs(...) local str, pth, t = "", "", { ... } for i=1,#t do local s = t[i] - if s ~= "" then + if s and s ~= "" then -- we catch nil and false if str ~= "" then str = str .. "/" .. s else @@ -3031,42 +3260,92 @@ else else pth = pth .. "/" .. s end - if make_indeed and not first and not lfs.isdir(pth) then - lfs.mkdir(pth) + if make_indeed and not first and not isdir(pth) then + mkdir(pth) end end else pth = "." for s in gmatch(str,"[^/]+") do pth = pth .. "/" .. s - if make_indeed and not lfs.isdir(pth) then - lfs.mkdir(pth) + if make_indeed and not isdir(pth) then + mkdir(pth) + end + end + end + return pth, (isdir(pth) == true) + end + + +end + +dir.makedirs = dir.mkdirs + +-- we can only define it here as it uses dir.current + +if onwindows then + + function dir.expandname(str) -- will be merged with cleanpath and collapsepath + local first, nothing, last = match(str,"^(//)(//*)(.*)$") + if first then + first = dir.current() .. "/" + end + if not first then + first, last = match(str,"^(//)/*(.*)$") + end + if not first then + first, last = match(str,"^([a-zA-Z]:)(.*)$") + if first and not find(last,"^/") then + local d = currentdir() + if chdir(first) then + first = dir.current() end + chdir(d) end end - return pth, (lfs.isdir(pth) == true) + if not first then + first, last = dir.current(), str + end + last = gsub(last,"//","/") + last = gsub(last,"/%./","/") + last = gsub(last,"^/*","") + first = gsub(first,"/*$","") + if last == "" or last == "." then + return first + else + return first .. "/" .. last + end end ---~ print(dir.mkdirs("","","a","c")) ---~ print(dir.mkdirs("a")) ---~ print(dir.mkdirs("/a/b/c")) ---~ print(dir.mkdirs("/aaa/b/c")) ---~ print(dir.mkdirs("//a/b/c")) ---~ print(dir.mkdirs("///a/b/c")) ---~ print(dir.mkdirs("a/bbb//ccc/")) +else - function dir.expand_name(str) -- will be merged with cleanpath and collapsepath + function dir.expandname(str) -- will be merged with cleanpath and collapsepath if not find(str,"^/") then - str = lfs.currentdir() .. "/" .. str + str = currentdir() .. "/" .. str end str = gsub(str,"//","/") str = gsub(str,"/%./","/") + str = gsub(str,"(.)/%.$","%1") return str end end -dir.makedirs = dir.mkdirs +file.expandname = dir.expandname -- for convenience + +local stack = { } + +function dir.push(newdir) + insert(stack,lfs.currentdir()) +end + +function dir.pop() + local d = remove(stack) + if d then + lfs.chdir(d) + end + return d +end end -- of closure @@ -3081,12 +3360,17 @@ if not modules then modules = { } end modules ['l-boolean'] = { license = "see context related readme files" } +local type, tonumber = type, tonumber + boolean = boolean or { } +local boolean = boolean -local type, tonumber = type, tonumber +-- function boolean.tonumber(b) +-- return b and 1 or 0 -- test and test and return or return +-- end function boolean.tonumber(b) - if b then return 1 else return 0 end + if b then return 1 else return 0 end -- test and return or return end function toboolean(str,tolerant) @@ -3110,7 +3394,9 @@ function toboolean(str,tolerant) end end -function string.is_boolean(str) +string.toboolean = toboolean + +function string.is_boolean(str,default) if type(str) == "string" then if str == "true" or str == "yes" or str == "on" or str == "t" then return true @@ -3118,15 +3404,7 @@ function string.is_boolean(str) return false end end - return nil -end - -function boolean.alwaystrue() - return true -end - -function boolean.falsetrue() - return false + return default end @@ -3134,7 +3412,7 @@ end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['l-math'] = { +if not modules then modules = { } end modules ['l-unicode'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -3142,228 +3420,290 @@ if not modules then modules = { } end modules ['l-math'] = { license = "see context related readme files" } -local floor, sin, cos, tan = math.floor, math.sin, math.cos, math.tan +if not unicode then -if not math.round then - function math.round(x) - return floor(x + 0.5) - end -end + unicode = { utf8 = { } } -if not math.div then - function math.div(n,m) - return floor(n/m) - end -end + local floor, char = math.floor, string.char -if not math.mod then - function math.mod(n,m) - return n % m + function unicode.utf8.utfchar(n) + if n < 0x80 then + return char(n) + elseif n < 0x800 then + return char( + 0xC0 + floor(n/0x40), + 0x80 + (n % 0x40) + ) + elseif n < 0x10000 then + return char( + 0xE0 + floor(n/0x1000), + 0x80 + (floor(n/0x40) % 0x40), + 0x80 + (n % 0x40) + ) + elseif n < 0x40000 then + return char( + 0xF0 + floor(n/0x40000), + 0x80 + floor(n/0x1000), + 0x80 + (floor(n/0x40) % 0x40), + 0x80 + (n % 0x40) + ) + else + -- return char( + -- 0xF1 + floor(n/0x1000000), + -- 0x80 + floor(n/0x40000), + -- 0x80 + floor(n/0x1000), + -- 0x80 + (floor(n/0x40) % 0x40), + -- 0x80 + (n % 0x40) + -- ) + return "?" + end end + end -local pipi = 2*math.pi/360 +local unicode = unicode -function math.sind(d) - return sin(d*pipi) -end - -function math.cosd(d) - return cos(d*pipi) -end - -function math.tand(d) - return tan(d*pipi) -end +utf = utf or unicode.utf8 +local concat = table.concat +local utfchar, utfbyte, utfgsub = utf.char, utf.byte, utf.gsub +local char, byte, find, bytepairs, utfvalues, format = string.char, string.byte, string.find, string.bytepairs, string.utfvalues, string.format +local type = type -end -- of closure +local utfsplitlines = string.utfsplitlines -do -- create closure to overcome 200 locals limit +-- 0 EF BB BF UTF-8 +-- 1 FF FE UTF-16-little-endian +-- 2 FE FF UTF-16-big-endian +-- 3 FF FE 00 00 UTF-32-little-endian +-- 4 00 00 FE FF UTF-32-big-endian -if not modules then modules = { } end modules ['l-utils'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" +unicode.utfname = { + [0] = 'utf-8', + [1] = 'utf-16-le', + [2] = 'utf-16-be', + [3] = 'utf-32-le', + [4] = 'utf-32-be' } --- hm, quite unreadable +-- \000 fails in <= 5.0 but is valid in >=5.1 where %z is depricated -local gsub = string.gsub -local concat = table.concat -local type, next = type, next +function unicode.utftype(f) + local str = f:read(4) + if not str then + f:seek('set') + return 0 + -- elseif find(str,"^%z%z\254\255") then -- depricated + -- elseif find(str,"^\000\000\254\255") then -- not permitted and bugged + elseif find(str,"\000\000\254\255",1,true) then -- seems to work okay (TH) + return 4 + -- elseif find(str,"^\255\254%z%z") then -- depricated + -- elseif find(str,"^\255\254\000\000") then -- not permitted and bugged + elseif find(str,"\255\254\000\000",1,true) then -- seems to work okay (TH) + return 3 + elseif find(str,"^\254\255") then + f:seek('set',2) + return 2 + elseif find(str,"^\255\254") then + f:seek('set',2) + return 1 + elseif find(str,"^\239\187\191") then + f:seek('set',3) + return 0 + else + f:seek('set') + return 0 + end +end -if not utils then utils = { } end -if not utils.merger then utils.merger = { } end -if not utils.lua then utils.lua = { } end -utils.merger.m_begin = "begin library merge" -utils.merger.m_end = "end library merge" -utils.merger.pattern = - "%c+" .. - "%-%-%s+" .. utils.merger.m_begin .. - "%c+(.-)%c+" .. - "%-%-%s+" .. utils.merger.m_end .. - "%c+" -function utils.merger._self_fake_() - return - "-- " .. "created merged file" .. "\n\n" .. - "-- " .. utils.merger.m_begin .. "\n\n" .. - "-- " .. utils.merger.m_end .. "\n\n" +local function utf16_to_utf8_be(t) + if type(t) == "string" then + t = utfsplitlines(str) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, 0 + for left, right in bytepairs(t[i]) do + if right then + local now = 256*left + right + if more > 0 then + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 + more = 0 + r = r + 1 + result[r] = utfchar(now) + elseif now >= 0xD800 and now <= 0xDBFF then + more = now + else + r = r + 1 + result[r] = utfchar(now) + end + end + end + t[i] = concat(result,"",1,r) -- we reused tmp, hence t + end + return t end -function utils.report(...) - print(...) +local function utf16_to_utf8_le(t) + if type(t) == "string" then + t = utfsplitlines(str) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, 0 + for left, right in bytepairs(t[i]) do + if right then + local now = 256*right + left + if more > 0 then + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 + more = 0 + r = r + 1 + result[r] = utfchar(now) + elseif now >= 0xD800 and now <= 0xDBFF then + more = now + else + r = r + 1 + result[r] = utfchar(now) + end + end + end + t[i] = concat(result,"",1,r) -- we reused tmp, hence t + end + return t end -utils.merger.strip_comment = true - -function utils.merger._self_load_(name) - local f, data = io.open(name), "" - if f then - utils.report("reading merge from %s",name) - data = f:read("*all") - f:close() - else - utils.report("unknown file to merge %s",name) +local function utf32_to_utf8_be(str) + if type(t) == "string" then + t = utfsplitlines(str) end - if data and utils.merger.strip_comment then - -- saves some 20K - data = gsub(data,"%-%-~[^\n\r]*[\r\n]", "") + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, -1 + for a,b in bytepairs(str) do + if a and b then + if more < 0 then + more = 256*256*256*a + 256*256*b + else + r = r + 1 + result[t] = utfchar(more + 256*a + b) + more = -1 + end + else + break + end + end + t[i] = concat(result,"",1,r) end - return data or "" + return result end -function utils.merger._self_save_(name, data) - if data ~= "" then - local f = io.open(name,'w') - if f then - utils.report("saving merge from %s",name) - f:write(data) - f:close() +local function utf32_to_utf8_le(str) + if type(t) == "string" then + t = utfsplitlines(str) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, -1 + for a,b in bytepairs(str) do + if a and b then + if more < 0 then + more = 256*b + a + else + r = r + 1 + result[t] = utfchar(more + 256*256*256*b + 256*256*a) + more = -1 + end + else + break + end end + t[i] = concat(result,"",1,r) end + return result end -function utils.merger._self_swap_(data,code) - if data ~= "" then - return (gsub(data,utils.merger.pattern, function(s) - return "\n\n" .. "-- "..utils.merger.m_begin .. "\n" .. code .. "\n" .. "-- "..utils.merger.m_end .. "\n\n" - end, 1)) +unicode.utf32_to_utf8_be = utf32_to_utf8_be +unicode.utf32_to_utf8_le = utf32_to_utf8_le +unicode.utf16_to_utf8_be = utf16_to_utf8_be +unicode.utf16_to_utf8_le = utf16_to_utf8_le + +function unicode.utf8_to_utf8(t) + return type(t) == "string" and utfsplitlines(t) or t +end + +function unicode.utf16_to_utf8(t,endian) + return endian and utf16_to_utf8_be(t) or utf16_to_utf8_le(t) or t +end + +function unicode.utf32_to_utf8(t,endian) + return endian and utf32_to_utf8_be(t) or utf32_to_utf8_le(t) or t +end + +local function little(c) + local b = byte(c) + if b < 0x10000 then + return char(b%256,b/256) else - return "" + b = b - 0x10000 + local b1, b2 = b/1024 + 0xD800, b%1024 + 0xDC00 + return char(b1%256,b1/256,b2%256,b2/256) end end ---~ stripper: ---~ ---~ data = gsub(data,"%-%-~[^\n]*\n","") ---~ data = gsub(data,"\n\n+","\n") - -function utils.merger._self_libs_(libs,list) - local result, f, frozen = { }, nil, false - result[#result+1] = "\n" - if type(libs) == 'string' then libs = { libs } end - if type(list) == 'string' then list = { list } end - local foundpath = nil - for i=1,#libs do - local lib = libs[i] - for j=1,#list do - local pth = gsub(list[j],"\\","/") -- file.clean_path - utils.report("checking library path %s",pth) - local name = pth .. "/" .. lib - if lfs.isfile(name) then - foundpath = pth - end - end - if foundpath then break end +local function big(c) + local b = byte(c) + if b < 0x10000 then + return char(b/256,b%256) + else + b = b - 0x10000 + local b1, b2 = b/1024 + 0xD800, b%1024 + 0xDC00 + return char(b1/256,b1%256,b2/256,b2%256) end - if foundpath then - utils.report("using library path %s",foundpath) - local right, wrong = { }, { } - for i=1,#libs do - local lib = libs[i] - local fullname = foundpath .. "/" .. lib - if lfs.isfile(fullname) then - -- right[#right+1] = lib - utils.report("merging library %s",fullname) - result[#result+1] = "do -- create closure to overcome 200 locals limit" - result[#result+1] = io.loaddata(fullname,true) - result[#result+1] = "end -- of closure" - else - -- wrong[#wrong+1] = lib - utils.report("no library %s",fullname) - end - end - if #right > 0 then - utils.report("merged libraries: %s",concat(right," ")) - end - if #wrong > 0 then - utils.report("skipped libraries: %s",concat(wrong," ")) - end +end + +function unicode.utf8_to_utf16(str,littleendian) + if littleendian then + return char(255,254) .. utfgsub(str,".",little) else - utils.report("no valid library path found") + return char(254,255) .. utfgsub(str,".",big) end - return concat(result, "\n\n") end -function utils.merger.selfcreate(libs,list,target) - if target then - utils.merger._self_save_( - target, - utils.merger._self_swap_( - utils.merger._self_fake_(), - utils.merger._self_libs_(libs,list) - ) - ) +function unicode.utfcodes(str) + local t, n = { }, 0 + for u in utfvalues(str) do + n = n + 1 + t[n] = format("0x%04X",u) end + return concat(t,separator or " ") end -function utils.merger.selfmerge(name,libs,list,target) - utils.merger._self_save_( - target or name, - utils.merger._self_swap_( - utils.merger._self_load_(name), - utils.merger._self_libs_(libs,list) - ) - ) +function unicode.ustring(s) + return format("U+%05X",type(s) == "number" and s or utfbyte(s)) end -function utils.merger.selfclean(name) - utils.merger._self_save_( - name, - utils.merger._self_swap_( - utils.merger._self_load_(name), - "" - ) - ) +function unicode.xstring(s) + return format("0x%05X",type(s) == "number" and s or utfbyte(s)) end -function utils.lua.compile(luafile, lucfile, cleanup, strip) -- defaults: cleanup=false strip=true - -- utils.report("compiling",luafile,"into",lucfile) - os.remove(lucfile) - local command = "-o " .. string.quote(lucfile) .. " " .. string.quote(luafile) - if strip ~= false then - command = "-s " .. command - end - local done = (os.spawn("texluac " .. command) == 0) or (os.spawn("luac " .. command) == 0) - if done and cleanup == true and lfs.isfile(lucfile) and lfs.isfile(luafile) then - -- utils.report("removing",luafile) - os.remove(luafile) - end - return done + +local lpegmatch = lpeg.match +local utftype = lpeg.patterns.utftype + +function unicode.filetype(data) + return data and lpegmatch(utftype,data) or "unknown" end + end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['l-aux'] = { +if not modules then modules = { } end modules ['l-math'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -3371,606 +3711,2538 @@ if not modules then modules = { } end modules ['l-aux'] = { license = "see context related readme files" } --- for inline, no store split : for s in string.gmatch(str,",* *([^,]+)") do .. end - -aux = aux or { } +local floor, sin, cos, tan = math.floor, math.sin, math.cos, math.tan -local concat, format, gmatch = table.concat, string.format, string.gmatch -local tostring, type = tostring, type -local lpegmatch = lpeg.match +if not math.round then + function math.round(x) return floor(x + 0.5) end +end -local P, R, V = lpeg.P, lpeg.R, lpeg.V +if not math.div then + function math.div(n,m) return floor(n/m) end +end -local escape, left, right = P("\\"), P('{'), P('}') +if not math.mod then + function math.mod(n,m) return n % m end +end -lpeg.patterns.balanced = P { - [1] = ((escape * (left+right)) + (1 - (left+right)) + V(2))^0, - [2] = left * V(1) * right -} +local pipi = 2*math.pi/360 -local space = lpeg.P(' ') -local equal = lpeg.P("=") -local comma = lpeg.P(",") -local lbrace = lpeg.P("{") -local rbrace = lpeg.P("}") -local nobrace = 1 - (lbrace+rbrace) -local nested = lpeg.P { lbrace * (nobrace + lpeg.V(1))^0 * rbrace } -local spaces = space^0 +if not math.sind then + function math.sind(d) return sin(d*pipi) end + function math.cosd(d) return cos(d*pipi) end + function math.tand(d) return tan(d*pipi) end +end -local value = lpeg.P(lbrace * lpeg.C((nobrace + nested)^0) * rbrace) + lpeg.C((nested + (1-comma))^0) +if not math.odd then + function math.odd (n) return n % 2 == 0 end + function math.even(n) return n % 2 ~= 0 end +end -local key = lpeg.C((1-equal-comma)^1) -local pattern_a = (space+comma)^0 * (key * equal * value + key * lpeg.C("")) -local pattern_c = (space+comma)^0 * (key * equal * value) -local key = lpeg.C((1-space-equal-comma)^1) -local pattern_b = spaces * comma^0 * spaces * (key * ((spaces * equal * spaces * value) + lpeg.C(""))) +end -- of closure --- "a=1, b=2, c=3, d={a{b,c}d}, e=12345, f=xx{a{b,c}d}xx, g={}" : outer {} removes, leading spaces ignored +do -- create closure to overcome 200 locals limit -local hash = { } +if not modules then modules = { } end modules ['util-tab'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} -local function set(key,value) -- using Carg is slower here - hash[key] = value -end +utilities = utilities or {} +utilities.tables = utilities.tables or { } +local tables = utilities.tables -local pattern_a_s = (pattern_a/set)^1 -local pattern_b_s = (pattern_b/set)^1 -local pattern_c_s = (pattern_c/set)^1 +local format, gmatch = string.format, string.gmatch +local concat, insert, remove = table.concat, table.insert, table.remove +local setmetatable, getmetatable, tonumber, tostring = setmetatable, getmetatable, tonumber, tostring -aux.settings_to_hash_pattern_a = pattern_a_s -aux.settings_to_hash_pattern_b = pattern_b_s -aux.settings_to_hash_pattern_c = pattern_c_s +function tables.definetable(target) -- defines undefined tables + local composed, t, n = nil, { }, 0 + for name in gmatch(target,"([^%.]+)") do + n = n + 1 + if composed then + composed = composed .. "." .. name + else + composed = name + end + t[n] = format("%s = %s or { }",composed,composed) + end + return concat(t,"\n") +end -function aux.make_settings_to_hash_pattern(set,how) - if how == "strict" then - return (pattern_c/set)^1 - elseif how == "tolerant" then - return (pattern_b/set)^1 - else - return (pattern_a/set)^1 +function tables.accesstable(target) + local t = _G + for name in gmatch(target,"([^%.]+)") do + t = t[name] end + return t end -function aux.settings_to_hash(str,existing) - if str and str ~= "" then - hash = existing or { } - if moretolerant then - lpegmatch(pattern_b_s,str) - else - lpegmatch(pattern_a_s,str) +function tables.removevalue(t,value) -- todo: n + if value then + for i=1,#t do + if t[i] == value then + remove(t,i) + -- remove all, so no: return + end end - return hash - else - return { } end end -function aux.settings_to_hash_tolerant(str,existing) - if str and str ~= "" then - hash = existing or { } - lpegmatch(pattern_b_s,str) - return hash - else - return { } +function tables.insertbeforevalue(t,value,extra) + for i=1,#t do + if t[i] == extra then + remove(t,i) + end end + for i=1,#t do + if t[i] == value then + insert(t,i,extra) + return + end + end + insert(t,1,extra) end -function aux.settings_to_hash_strict(str,existing) - if str and str ~= "" then - hash = existing or { } - lpegmatch(pattern_c_s,str) - return next(hash) and hash - else - return nil +function tables.insertaftervalue(t,value,extra) + for i=1,#t do + if t[i] == extra then + remove(t,i) + end + end + for i=1,#t do + if t[i] == value then + insert(t,i+1,extra) + return + end end + insert(t,#t+1,extra) end -local separator = comma * space^0 -local value = lpeg.P(lbrace * lpeg.C((nobrace + nested)^0) * rbrace) + lpeg.C((nested + (1-comma))^0) -local pattern = lpeg.Ct(value*(separator*value)^0) - --- "aap, {noot}, mies" : outer {} removes, leading spaces ignored - -aux.settings_to_array_pattern = pattern +-- experimental --- we could use a weak table as cache +local function toxml(t,d,result) + for k, v in table.sortedpairs(t) do + if type(v) == "table" then + result[#result+1] = format("%s<%s>",d,k) + toxml(v,d.." ",result) + result[#result+1] = format("%s",d,k) + elseif tonumber(k) then + result[#result+1] = format("%s%s",d,k,v,k) + else + result[#result+1] = format("%s<%s>%s",d,k,tostring(v),k) + end + end +end -function aux.settings_to_array(str) - if not str or str == "" then - return { } +function table.toxml(t,name,nobanner) + local noroot = name == false + local result = (nobanner or noroot) and { } or { "" } + if noroot then + toxml( t, "", result) else - return lpegmatch(pattern,str) + toxml( { [name or "root"] = t }, "", result) end + return concat(result,"\n") end -local function set(t,v) - t[#t+1] = v -end -local value = lpeg.P(lpeg.Carg(1)*value) / set -local pattern = value*(separator*value)^0 * lpeg.Carg(1) +end -- of closure -function aux.add_settings_to_array(t,str) - return lpegmatch(pattern,str,nil,t) -end +do -- create closure to overcome 200 locals limit -function aux.hash_to_string(h,separator,yes,no,strict,omit) - if h then - local t, s = { }, table.sortedkeys(h) - omit = omit and table.tohash(omit) - for i=1,#s do - local key = s[i] - if not omit or not omit[key] then - local value = h[key] - if type(value) == "boolean" then - if yes and no then - if value then - t[#t+1] = key .. '=' .. yes - elseif not strict then - t[#t+1] = key .. '=' .. no - end - elseif value or not strict then - t[#t+1] = key .. '=' .. tostring(value) - end - else - t[#t+1] = key .. '=' .. value - end - end - end - return concat(t,separator or ",") - else - return "" - end -end +if not modules then modules = { } end modules ['util-sto'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} -function aux.array_to_string(a,separator) - if a then - return concat(a,separator or ",") - else - return "" +local setmetatable, getmetatable = setmetatable, getmetatable + +utilities = utilities or { } +utilities.storage = utilities.storage or { } +local storage = utilities.storage + +function storage.mark(t) + if not t then + texio.write_nl("fatal error: storage '%s' cannot be marked",t) + os.exit() + end + local m = getmetatable(t) + if not m then + m = { } + setmetatable(t,m) end + m.__storage__ = true + return t end -function aux.settings_to_set(str,t) +function storage.allocate(t) t = t or { } - for s in gmatch(str,"%s*([^,]+)") do - t[s] = true + local m = getmetatable(t) + if not m then + m = { } + setmetatable(t,m) end + m.__storage__ = true return t end -local value = lbrace * lpeg.C((nobrace + nested)^0) * rbrace -local pattern = lpeg.Ct((space + value)^0) +function storage.marked(t) + local m = getmetatable(t) + return m and m.__storage__ +end -function aux.arguments_to_table(str) - return lpegmatch(pattern,str) +function storage.checked(t) + if not t then + texio.write_nl("fatal error: storage '%s' has not been allocated",t) + os.exit() + end + return t end --- temporary here -function aux.getparameters(self,class,parentclass,settings) - local sc = self[class] - if not sc then - sc = table.clone(self[parent]) - self[class] = sc +function storage.setinitializer(data,initialize) + local m = getmetatable(data) or { } + m.__index = function(data,k) + m.__index = nil -- so that we can access the entries during initializing + initialize() + return data[k] end - aux.settings_to_hash(settings,sc) + setmetatable(data, m) end --- temporary here +local keyisvalue = { __index = function(t,k) + t[k] = k + return k +end } -local digit = lpeg.R("09") -local period = lpeg.P(".") -local zero = lpeg.P("0") -local trailingzeros = zero^0 * -digit -- suggested by Roberto R -local case_1 = period * trailingzeros / "" -local case_2 = period * (digit - trailingzeros)^1 * (trailingzeros / "") -local number = digit^1 * (case_1 + case_2) -local stripper = lpeg.Cs((number + 1)^0) +function storage.sparse(t) + t = t or { } + setmetatable(t,keyisvalue) + return t +end ---~ local sample = "bla 11.00 bla 11 bla 0.1100 bla 1.00100 bla 0.00 bla 0.001 bla 1.1100 bla 0.100100100 bla 0.00100100100" ---~ collectgarbage("collect") ---~ str = string.rep(sample,10000) ---~ local ts = os.clock() ---~ lpegmatch(stripper,str) ---~ print(#str, os.clock()-ts, lpegmatch(stripper,sample)) +-- table namespace ? -lpeg.patterns.strip_zeros = stripper +local function f_empty () return "" end -- t,k +local function f_self (t,k) t[k] = k return k end +local function f_ignore() end -- t,k,v -function aux.strip_zeros(str) - return lpegmatch(stripper,str) -end +local t_empty = { __index = empty } +local t_self = { __index = self } +local t_ignore = { __newindex = ignore } -function aux.definetable(target) -- defines undefined tables - local composed, t = nil, { } - for name in gmatch(target,"([^%.]+)") do - if composed then - composed = composed .. "." .. name +function table.setmetatableindex(t,f) + local m = getmetatable(t) + if m then + if f == "empty" then + m.__index = f_empty + elseif f == "key" then + m.__index = f_self else - composed = name + m.__index = f + end + else + if f == "empty" then + setmetatable(t, t_empty) + elseif f == "key" then + setmetatable(t, t_self) + else + setmetatable(t,{ __index = f }) end - t[#t+1] = format("%s = %s or { }",composed,composed) end - return concat(t,"\n") end -function aux.accesstable(target) - local t = _G - for name in gmatch(target,"([^%.]+)") do - t = t[name] +function table.setmetatablenewindex(t,f) + local m = getmetatable(t) + if m then + if f == "ignore" then + m.__newindex = f_ignore + else + m.__newindex = f + end + else + if f == "ignore" then + setmetatable(t, t_ignore) + else + setmetatable(t,{ __newindex = f }) + end end - return t end ---~ function string.commaseparated(str) ---~ return gmatch(str,"([^,%s]+)") ---~ end +function table.setmetatablecall(t,f) + local m = getmetatable(t) + if m then + m.__call = f + else + setmetatable(t,{ __call = f }) + end +end --- as we use this a lot ... +function table.setmetatablekey(t,key,value) + local m = getmetatable(t) + if not m then + m = { } + setmetatable(t,m) + end + m[key] = value +end ---~ function aux.cachefunction(action,weak) ---~ local cache = { } ---~ if weak then ---~ setmetatable(cache, { __mode = "kv" } ) ---~ end ---~ local function reminder(str) ---~ local found = cache[str] ---~ if not found then ---~ found = action(str) ---~ cache[str] = found ---~ end ---~ return found ---~ end ---~ return reminder, cache ---~ end +function table.getmetatablekey(t,key,value) + local m = getmetatable(t) + return m and m[key] +end end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['trac-tra'] = { +if not modules then modules = { } end modules ['util-mrg'] = { version = 1.001, - comment = "companion to trac-tra.mkiv", + comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } --- the tag is kind of generic and used for functions that are not --- bound to a variable, like node.new, node.copy etc (contrary to for instance --- node.has_attribute which is bound to a has_attribute local variable in mkiv) - -local debug = require "debug" +-- hm, quite unreadable -local getinfo = debug.getinfo -local type, next = type, next +local gsub, format = string.gsub, string.format local concat = table.concat -local format, find, lower, gmatch, gsub = string.format, string.find, string.lower, string.gmatch, string.gsub - -debugger = debugger or { } +local type, next = type, next -local counters = { } -local names = { } +utilities = utilities or {} +utilities.merger = utilities.merger or { } -- maybe mergers +utilities.report = logs and logs.reporter("system") or print --- one +local merger = utilities.merger -local function hook() - local f = getinfo(2,"f").func - local n = getinfo(2,"Sn") --- if n.what == "C" and n.name then print (n.namewhat .. ': ' .. n.name) end - if f then - local cf = counters[f] - if cf == nil then - counters[f] = 1 - names[f] = n - else - counters[f] = cf + 1 - end - end -end -local function getname(func) - local n = names[func] - if n then - if n.what == "C" then - return n.name or '' - else - -- source short_src linedefined what name namewhat nups func - local name = n.name or n.namewhat or n.what - if not name or name == "" then name = "?" end - return format("%s : %s : %s", n.short_src or "unknown source", n.linedefined or "--", name) - end - else - return "unknown" - end -end -function debugger.showstats(printer,threshold) - printer = printer or texio.write or print - threshold = threshold or 0 - local total, grandtotal, functions = 0, 0, 0 - printer("\n") -- ugly but ok - -- table.sort(counters) - for func, count in next, counters do - if count > threshold then - local name = getname(func) - if not find(name,"for generator") then - printer(format("%8i %s", count, name)) - total = total + count - end - end - grandtotal = grandtotal + count - functions = functions + 1 - end - printer(format("functions: %s, total: %s, grand total: %s, threshold: %s\n", functions, total, grandtotal, threshold)) -end +merger.strip_comment = true --- two +local m_begin_merge = "begin library merge" +local m_end_merge = "end library merge" +local m_begin_closure = "do -- create closure to overcome 200 locals limit" +local m_end_closure = "end -- of closure" ---~ local function hook() ---~ local n = getinfo(2) ---~ if n.what=="C" and not n.name then ---~ local f = tostring(debug.traceback()) ---~ local cf = counters[f] ---~ if cf == nil then ---~ counters[f] = 1 ---~ names[f] = n ---~ else ---~ counters[f] = cf + 1 ---~ end ---~ end ---~ end ---~ function debugger.showstats(printer,threshold) ---~ printer = printer or texio.write or print ---~ threshold = threshold or 0 ---~ local total, grandtotal, functions = 0, 0, 0 ---~ printer("\n") -- ugly but ok ---~ -- table.sort(counters) ---~ for func, count in next, counters do ---~ if count > threshold then ---~ printer(format("%8i %s", count, func)) ---~ total = total + count ---~ end ---~ grandtotal = grandtotal + count ---~ functions = functions + 1 ---~ end ---~ printer(format("functions: %s, total: %s, grand total: %s, threshold: %s\n", functions, total, grandtotal, threshold)) ---~ end +local m_pattern = + "%c+" .. + "%-%-%s+" .. m_begin_merge .. + "%c+(.-)%c+" .. + "%-%-%s+" .. m_end_merge .. + "%c+" --- rest +local m_format = + "\n\n-- " .. m_begin_merge .. + "\n%s\n" .. + "-- " .. m_end_merge .. "\n\n" -function debugger.savestats(filename,threshold) - local f = io.open(filename,'w') - if f then - debugger.showstats(function(str) f:write(str) end,threshold) - f:close() - end -end +local m_faked = + "-- " .. "created merged file" .. "\n\n" .. + "-- " .. m_begin_merge .. "\n\n" .. + "-- " .. m_end_merge .. "\n\n" -function debugger.enable() - debug.sethook(hook,"c") +local function self_fake() + return m_faked end -function debugger.disable() - debug.sethook() ---~ counters[debug.getinfo(2,"f").func] = nil +local function self_nothing() + return "" end -function debugger.tracing() - local n = tonumber(os.env['MTX.TRACE.CALLS']) or tonumber(os.env['MTX_TRACE_CALLS']) or 0 - if n > 0 then - function debugger.tracing() return true end ; return true +local function self_load(name) + local data = io.loaddata(name) or "" + if data == "" then + utilities.report("merge: unknown file %s",name) else - function debugger.tracing() return false end ; return false + utilities.report("merge: inserting %s",name) end + return data or "" end ---~ debugger.enable() - ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) - ---~ debugger.disable() - ---~ print("") ---~ debugger.showstats() ---~ print("") ---~ debugger.showstats(print,3) - -setters = setters or { } -setters.data = setters.data or { } +local function self_save(name, data) + if data ~= "" then + if merger.strip_comment then + -- saves some 20K + local n = #data + data = gsub(data,"%-%-~[^\n\r]*[\r\n]","") + utilities.report("merge: %s bytes of comment stripped, %s bytes of code left",n-#data,#data) + end + io.savedata(name,data) + utilities.report("merge: saving %s",name) + end +end ---~ local function set(t,what,value) ---~ local data, done = t.data, t.done ---~ if type(what) == "string" then ---~ what = aux.settings_to_array(what) -- inefficient but ok ---~ end ---~ for i=1,#what do ---~ local w = what[i] ---~ for d, f in next, data do ---~ if done[d] then ---~ -- prevent recursion due to wildcards ---~ elseif find(d,w) then ---~ done[d] = true ---~ for i=1,#f do ---~ f[i](value) ---~ end ---~ end ---~ end ---~ end ---~ end +local function self_swap(data,code) + return data ~= "" and (gsub(data,m_pattern, function() return format(m_format,code) end, 1)) or "" +end -local function set(t,what,value) - local data, done = t.data, t.done - if type(what) == "string" then - what = aux.settings_to_hash(what) -- inefficient but ok - end - for w, v in next, what do - if v == "" then - v = value - else - v = toboolean(v) +local function self_libs(libs,list) + local result, f, frozen, foundpath = { }, nil, false, nil + result[#result+1] = "\n" + if type(libs) == 'string' then libs = { libs } end + if type(list) == 'string' then list = { list } end + for i=1,#libs do + local lib = libs[i] + for j=1,#list do + local pth = gsub(list[j],"\\","/") -- file.clean_path + utilities.report("merge: checking library path %s",pth) + local name = pth .. "/" .. lib + if lfs.isfile(name) then + foundpath = pth + end end - for d, f in next, data do - if done[d] then - -- prevent recursion due to wildcards - elseif find(d,w) then - done[d] = true - for i=1,#f do - f[i](v) - end + if foundpath then break end + end + if foundpath then + utilities.report("merge: using library path %s",foundpath) + local right, wrong = { }, { } + for i=1,#libs do + local lib = libs[i] + local fullname = foundpath .. "/" .. lib + if lfs.isfile(fullname) then + utilities.report("merge: using library %s",fullname) + right[#right+1] = lib + result[#result+1] = m_begin_closure + result[#result+1] = io.loaddata(fullname,true) + result[#result+1] = m_end_closure + else + utilities.report("merge: skipping library %s",fullname) + wrong[#wrong+1] = lib end end + if #right > 0 then + utilities.report("merge: used libraries: %s",concat(right," ")) + end + if #wrong > 0 then + utilities.report("merge: skipped libraries: %s",concat(wrong," ")) + end + else + utilities.report("merge: no valid library path found") end + return concat(result, "\n\n") end -local function reset(t) - for d, f in next, t.data do - for i=1,#f do - f[i](false) - end +function merger.selfcreate(libs,list,target) + if target then + self_save(target,self_swap(self_fake(),self_libs(libs,list))) end end -local function enable(t,what) - set(t,what,true) +function merger.selfmerge(name,libs,list,target) + self_save(target or name,self_swap(self_load(name),self_libs(libs,list))) end -local function disable(t,what) - local data = t.data - if not what or what == "" then - t.done = { } - reset(t) - else - set(t,what,false) - end +function merger.selfclean(name) + self_save(name,self_swap(self_load(name),self_nothing())) end -function setters.register(t,what,...) - local data = t.data - what = lower(what) - local w = data[what] - if not w then - w = { } - data[what] = w + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['util-lua'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +utilities = utilities or {} +utilities.lua = utilities.lua or { } +utilities.report = logs and logs.reporter("system") or print + +function utilities.lua.compile(luafile,lucfile,cleanup,strip) -- defaults: cleanup=false strip=true + utilities.report("lua: compiling %s into %s",luafile,lucfile) + os.remove(lucfile) + local command = "-o " .. string.quoted(lucfile) .. " " .. string.quoted(luafile) + if strip ~= false then + command = "-s " .. command end - for _, fnc in next, { ... } do - local typ = type(fnc) - if typ == "function" then - w[#w+1] = fnc - elseif typ == "string" then - w[#w+1] = function(value) set(t,fnc,value,nesting) end - end + local done = os.spawn("texluac " .. command) == 0 or os.spawn("luac " .. command) == 0 + if done and cleanup == true and lfs.isfile(lucfile) and lfs.isfile(luafile) then + utilities.report("lua: removing %s",luafile) + os.remove(luafile) end + return done end -function setters.enable(t,what) - local e = t.enable - t.enable, t.done = enable, { } - enable(t,string.simpleesc(tostring(what))) - t.enable, t.done = e, { } -end -function setters.disable(t,what) - local e = t.disable - t.disable, t.done = disable, { } - disable(t,string.simpleesc(tostring(what))) - t.disable, t.done = e, { } -end -function setters.reset(t) - t.done = { } - reset(t) -end -function setters.list(t) -- pattern - local list = table.sortedkeys(t.data) - local user, system = { }, { } - for l=1,#list do - local what = list[l] - if find(what,"^%*") then + + + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['util-prs'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local P, R, V, C, Ct, Carg = lpeg.P, lpeg.R, lpeg.V, lpeg.C, lpeg.Ct, lpeg.Carg +local lpegmatch = lpeg.match +local concat, format, gmatch = table.concat, string.format, string.gmatch +local tostring, type, next = tostring, type, next + +utilities = utilities or {} +utilities.parsers = utilities.parsers or { } +local parsers = utilities.parsers +parsers.patterns = parsers.patterns or { } + +local setmetatableindex = table.setmetatableindex +local sortedhash = table.sortedhash + +-- we could use a Cf Cg construct + +local escape, left, right = P("\\"), P('{'), P('}') + +lpeg.patterns.balanced = P { + [1] = ((escape * (left+right)) + (1 - (left+right)) + V(2))^0, + [2] = left * V(1) * right +} + +local space = P(' ') +local equal = P("=") +local comma = P(",") +local lbrace = P("{") +local rbrace = P("}") +local nobrace = 1 - (lbrace+rbrace) +local nested = P { lbrace * (nobrace + V(1))^0 * rbrace } +local spaces = space^0 + +lpeg.patterns.nested = nested + +local value = P(lbrace * C((nobrace + nested)^0) * rbrace) + C((nested + (1-comma))^0) + +local key = C((1-equal-comma)^1) +local pattern_a = (space+comma)^0 * (key * equal * value + key * C("")) +local pattern_c = (space+comma)^0 * (key * equal * value) + +local key = C((1-space-equal-comma)^1) +local pattern_b = spaces * comma^0 * spaces * (key * ((spaces * equal * spaces * value) + C(""))) + +-- "a=1, b=2, c=3, d={a{b,c}d}, e=12345, f=xx{a{b,c}d}xx, g={}" : outer {} removes, leading spaces ignored + +local hash = { } + +local function set(key,value) + hash[key] = value +end + +local function set(key,value) + hash[key] = value +end + +local pattern_a_s = (pattern_a/set)^1 +local pattern_b_s = (pattern_b/set)^1 +local pattern_c_s = (pattern_c/set)^1 + +parsers.patterns.settings_to_hash_a = pattern_a_s +parsers.patterns.settings_to_hash_b = pattern_b_s +parsers.patterns.settings_to_hash_c = pattern_c_s + +function parsers.make_settings_to_hash_pattern(set,how) + if how == "strict" then + return (pattern_c/set)^1 + elseif how == "tolerant" then + return (pattern_b/set)^1 + else + return (pattern_a/set)^1 + end +end + +function parsers.settings_to_hash(str,existing) + if str and str ~= "" then + hash = existing or { } + lpegmatch(pattern_a_s,str) + return hash + else + return { } + end +end + +function parsers.settings_to_hash_tolerant(str,existing) + if str and str ~= "" then + hash = existing or { } + lpegmatch(pattern_b_s,str) + return hash + else + return { } + end +end + +function parsers.settings_to_hash_strict(str,existing) + if str and str ~= "" then + hash = existing or { } + lpegmatch(pattern_c_s,str) + return next(hash) and hash + else + return nil + end +end + +local separator = comma * space^0 +local value = P(lbrace * C((nobrace + nested)^0) * rbrace) + C((nested + (1-comma))^0) +local pattern = Ct(value*(separator*value)^0) + +-- "aap, {noot}, mies" : outer {} removes, leading spaces ignored + +parsers.patterns.settings_to_array = pattern + +-- we could use a weak table as cache + +function parsers.settings_to_array(str) + if not str or str == "" then + return { } + else + return lpegmatch(pattern,str) + end +end + +local function set(t,v) + t[#t+1] = v +end + +local value = P(Carg(1)*value) / set +local pattern = value*(separator*value)^0 * Carg(1) + +function parsers.add_settings_to_array(t,str) + return lpegmatch(pattern,str,nil,t) +end + +function parsers.hash_to_string(h,separator,yes,no,strict,omit) + if h then + local t, tn, s = { }, 0, table.sortedkeys(h) + omit = omit and table.tohash(omit) + for i=1,#s do + local key = s[i] + if not omit or not omit[key] then + local value = h[key] + if type(value) == "boolean" then + if yes and no then + if value then + tn = tn + 1 + t[tn] = key .. '=' .. yes + elseif not strict then + tn = tn + 1 + t[tn] = key .. '=' .. no + end + elseif value or not strict then + tn = tn + 1 + t[tn] = key .. '=' .. tostring(value) + end + else + tn = tn + 1 + t[tn] = key .. '=' .. value + end + end + end + return concat(t,separator or ",") + else + return "" + end +end + +function parsers.array_to_string(a,separator) + if a then + return concat(a,separator or ",") + else + return "" + end +end + +function parsers.settings_to_set(str,t) -- tohash? -- todo: lpeg -- duplicate anyway + t = t or { } +-- for s in gmatch(str,"%s*([^, ]+)") do -- space added + for s in gmatch(str,"[^, ]+") do -- space added + t[s] = true + end + return t +end + +function parsers.simple_hash_to_string(h, separator) + local t, tn = { }, 0 + for k, v in sortedhash(h) do + if v then + tn = tn + 1 + t[tn] = k + end + end + return concat(t,separator or ",") +end + +local value = lbrace * C((nobrace + nested)^0) * rbrace +local pattern = Ct((space + value)^0) + +function parsers.arguments_to_table(str) + return lpegmatch(pattern,str) +end + +-- temporary here (unoptimized) + +function parsers.getparameters(self,class,parentclass,settings) + local sc = self[class] + if not sc then + sc = { } + self[class] = sc + if parentclass then + local sp = self[parentclass] + if not sp then + sp = { } + self[parentclass] = sp + end + setmetatableindex(sc,sp) + end + end + parsers.settings_to_hash(settings,sc) +end + +function parsers.listitem(str) + return gmatch(str,"[^, ]+") +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['util-fmt'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +utilities = utilities or { } +utilities.formatters = utilities.formatters or { } +local formatters = utilities.formatters + +local concat, format = table.concat, string.format +local tostring, type = tostring, type +local strip = string.strip + +local P, R, Cs = lpeg.P, lpeg.R, lpeg.Cs +local lpegmatch = lpeg.match + +-- temporary here + +local digit = R("09") +local period = P(".") +local zero = P("0") +local trailingzeros = zero^0 * -digit -- suggested by Roberto R +local case_1 = period * trailingzeros / "" +local case_2 = period * (digit - trailingzeros)^1 * (trailingzeros / "") +local number = digit^1 * (case_1 + case_2) +local stripper = Cs((number + 1)^0) + + +lpeg.patterns.stripzeros = stripper + +function formatters.stripzeros(str) + return lpegmatch(stripper,str) +end + +function formatters.formatcolumns(result,between) + if result and #result > 0 then + between = between or " " + local widths, numbers = { }, { } + local first = result[1] + local n = #first + for i=1,n do + widths[i] = 0 + end + for i=1,#result do + local r = result[i] + for j=1,n do + local rj = r[j] + local tj = type(rj) + if tj == "number" then + numbers[j] = true + end + if tj ~= "string" then + rj = tostring(rj) + r[j] = rj + end + local w = #rj + if w > widths[j] then + widths[j] = w + end + end + end + for i=1,n do + local w = widths[i] + if numbers[i] then + if w > 80 then + widths[i] = "%s" .. between + else + widths[i] = "%0" .. w .. "i" .. between + end + else + if w > 80 then + widths[i] = "%s" .. between + elseif w > 0 then + widths[i] = "%-" .. w .. "s" .. between + else + widths[i] = "%s" + end + end + end + local template = strip(concat(widths)) + for i=1,#result do + local str = format(template,unpack(result[i])) + result[i] = strip(str) + end + end + return result +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['util.deb'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- the tag is kind of generic and used for functions that are not +-- bound to a variable, like node.new, node.copy etc (contrary to for instance +-- node.has_attribute which is bound to a has_attribute local variable in mkiv) + +local debug = require "debug" + +local getinfo = debug.getinfo +local type, next, tostring = type, next, tostring +local format, find = string.format, string.find +local is_boolean = string.is_boolean + +utilities = utilities or { } +utilities.debugger = utilities.debugger or { } +local debugger = utilities.debugger + +local counters = { } +local names = { } + +-- one + +local function hook() + local f = getinfo(2,"f").func + local n = getinfo(2,"Sn") +-- if n.what == "C" and n.name then print (n.namewhat .. ': ' .. n.name) end + if f then + local cf = counters[f] + if cf == nil then + counters[f] = 1 + names[f] = n + else + counters[f] = cf + 1 + end + end +end + +local function getname(func) + local n = names[func] + if n then + if n.what == "C" then + return n.name or '' + else + -- source short_src linedefined what name namewhat nups func + local name = n.name or n.namewhat or n.what + if not name or name == "" then name = "?" end + return format("%s : %s : %s", n.short_src or "unknown source", n.linedefined or "--", name) + end + else + return "unknown" + end +end + +function debugger.showstats(printer,threshold) + printer = printer or texio.write or print + threshold = threshold or 0 + local total, grandtotal, functions = 0, 0, 0 + printer("\n") -- ugly but ok + -- table.sort(counters) + for func, count in next, counters do + if count > threshold then + local name = getname(func) + if not find(name,"for generator") then + printer(format("%8i %s", count, name)) + total = total + count + end + end + grandtotal = grandtotal + count + functions = functions + 1 + end + printer(format("functions: %s, total: %s, grand total: %s, threshold: %s\n", functions, total, grandtotal, threshold)) +end + +-- two + + +-- rest + +function debugger.savestats(filename,threshold) + local f = io.open(filename,'w') + if f then + debugger.showstats(function(str) f:write(str) end,threshold) + f:close() + end +end + +function debugger.enable() + debug.sethook(hook,"c") +end + +function debugger.disable() + debug.sethook() +end + + + + + +local is_node = node and node.is_node + +function inspect(i) -- global function + local ti = type(i) + if ti == "table" then + table.print(i,"table") + elseif is_node and is_node(i) then + table.print(nodes.astable(i),tostring(i)) + else + print(tostring(i)) + end +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['trac-inf'] = { + version = 1.001, + comment = "companion to trac-inf.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- As we want to protect the global tables, we no longer store the timing +-- in the tables themselves but in a hidden timers table so that we don't +-- get warnings about assignments. This is more efficient than using rawset +-- and rawget. + +local format = string.format +local clock = os.gettimeofday or os.clock -- should go in environment +local write_nl = texio.write_nl + +statistics = statistics or { } +local statistics = statistics + +statistics.enable = true +statistics.threshold = 0.05 + +local statusinfo, n, registered, timers = { }, 0, { }, { } + +local function hastiming(instance) + return instance and timers[instance] +end + +local function resettiming(instance) + timers[instance or "notimer"] = { timing = 0, loadtime = 0 } +end + +local function starttiming(instance) + local timer = timers[instance or "notimer"] + if not timer then + timer = { } + timers[instance or "notimer"] = timer + end + local it = timer.timing + if not it then + it = 0 + end + if it == 0 then + timer.starttime = clock() + if not timer.loadtime then + timer.loadtime = 0 + end + end + timer.timing = it + 1 +end + +local function stoptiming(instance, report) + local timer = timers[instance or "notimer"] + local it = timer.timing + if it > 1 then + timer.timing = it - 1 + else + local starttime = timer.starttime + if starttime then + local stoptime = clock() + local loadtime = stoptime - starttime + timer.stoptime = stoptime + timer.loadtime = timer.loadtime + loadtime + if report then + statistics.report("load time %0.3f",loadtime) + end + timer.timing = 0 + return loadtime + end + end + return 0 +end + +local function elapsedtime(instance) + local timer = timers[instance or "notimer"] + return format("%0.3f",timer and timer.loadtime or 0) +end + +local function elapsedindeed(instance) + local timer = timers[instance or "notimer"] + return (timer and timer.loadtime or 0) > statistics.threshold +end + +local function elapsedseconds(instance,rest) -- returns nil if 0 seconds + if elapsedindeed(instance) then + return format("%s seconds %s", elapsedtime(instance),rest or "") + end +end + +statistics.hastiming = hastiming +statistics.resettiming = resettiming +statistics.starttiming = starttiming +statistics.stoptiming = stoptiming +statistics.elapsedtime = elapsedtime +statistics.elapsedindeed = elapsedindeed +statistics.elapsedseconds = elapsedseconds + +-- general function + +function statistics.register(tag,fnc) + if statistics.enable and type(fnc) == "function" then + local rt = registered[tag] or (#statusinfo + 1) + statusinfo[rt] = { tag, fnc } + registered[tag] = rt + if #tag > n then n = #tag end + end +end + +function statistics.show(reporter) + if statistics.enable then + if not reporter then reporter = function(tag,data,n) write_nl(tag .. " " .. data) end end + -- this code will move + local register = statistics.register + register("luatex banner", function() + return string.lower(status.banner) + end) + register("control sequences", function() + return format("%s of %s", status.cs_count, status.hash_size+status.hash_extra) + end) + register("callbacks", function() + local total, indirect = status.callbacks or 0, status.indirect_callbacks or 0 + return format("%s direct, %s indirect, %s total", total-indirect, indirect, total) + end) + collectgarbage("collect") + register("current memory usage", statistics.memused) + register("runtime",statistics.runtime) + for i=1,#statusinfo do + local s = statusinfo[i] + local r = s[2]() + if r then + reporter(s[1],r,n) + end + end + write_nl("") -- final newline + statistics.enable = false + end +end + +local template, report_statistics, nn = nil, nil, 0 -- we only calcute it once + +function statistics.showjobstat(tag,data,n) + if not logs then + -- sorry + elseif type(data) == "table" then + for i=1,#data do + statistics.showjobstat(tag,data[i],n) + end + else + if not template or n > nn then + template, n = format("%%-%ss - %%s",n), nn + report_statistics = logs.reporter("mkiv lua stats") + end + report_statistics(format(template,tag,data)) + end +end + +function statistics.memused() -- no math.round yet -) + local round = math.round or math.floor + return format("%s MB (ctx: %s MB)",round(collectgarbage("count")/1000), round(status.luastate_bytes/1000000)) +end + +starttiming(statistics) + +function statistics.formatruntime(runtime) -- indirect so it can be overloaded and + return format("%s seconds", runtime) -- indeed that happens in cure-uti.lua +end + +function statistics.runtime() + stoptiming(statistics) + return statistics.formatruntime(elapsedtime(statistics)) +end + +function statistics.timed(action,report) + report = report or logs.reporter("system") + starttiming("run") + action() + stoptiming("run") + report("total runtime: %s",elapsedtime("run")) +end + +-- where, not really the best spot for this: + +commands = commands or { } + +function commands.resettimer(name) + resettiming(name or "whatever") + starttiming(name or "whatever") +end + +function commands.elapsedtime(name) + stoptiming(name or "whatever") + tex.sprint(elapsedtime(name or "whatever")) +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['trac-set'] = { -- might become util-set.lua + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local type, next, tostring = type, next, tostring +local concat = table.concat +local format, find, lower, gsub, escapedpattern = string.format, string.find, string.lower, string.gsub, string.escapedpattern +local is_boolean = string.is_boolean +local settings_to_hash = utilities.parsers.settings_to_hash +local allocate = utilities.storage.allocate + +utilities = utilities or { } +local utilities = utilities +utilities.setters = utilities.setters or { } +local setters = utilities.setters + +local data = { } -- maybe just local + +-- We can initialize from the cnf file. This is sort of tricky as +-- later defined setters also need to be initialized then. If set +-- this way, we need to ensure that they are not reset later on. + +local trace_initialize = false -- only for testing during development + +function setters.initialize(filename,name,values) -- filename only for diagnostics + local setter = data[name] + if setter then + local data = setter.data + if data then + for key, value in next, values do + -- key = gsub(key,"_",".") + value = is_boolean(value,value) + local functions = data[key] + if functions then + if #functions > 0 and not functions.value then + if trace_initialize then + setter.report("executing %s (%s -> %s)",key,filename,tostring(value)) + end + for i=1,#functions do + functions[i](value) + end + functions.value = value + else + if trace_initialize then + setter.report("skipping %s (%s -> %s)",key,filename,tostring(value)) + end + end + else + -- we do a simple preregistration i.e. not in the + -- list as it might be an obsolete entry + functions = { default = value } + data[key] = functions + if trace_initialize then + setter.report("storing %s (%s -> %s)",key,filename,tostring(value)) + end + end + end + return true + end + end +end + +-- user interface code + +local function set(t,what,newvalue) + local data, done = t.data, t.done + if type(what) == "string" then + what = settings_to_hash(what) -- inefficient but ok + end + if type(what) ~= "table" then + return + end + for w, value in next, what do + if value == "" then + value = newvalue + elseif not value then + value = false -- catch nil + else + value = is_boolean(value,value) + end + w = "^" .. escapedpattern(w,true) .. "$" -- new: anchored + for name, functions in next, data do + if done[name] then + -- prevent recursion due to wildcards + elseif find(name,w) then + done[name] = true + for i=1,#functions do + functions[i](value) + end + functions.value = value + end + end + end +end + +local function reset(t) + for name, functions in next, t.data do + for i=1,#functions do + functions[i](false) + end + functions.value = false + end +end + +local function enable(t,what) + set(t,what,true) +end + +local function disable(t,what) + local data = t.data + if not what or what == "" then + t.done = { } + reset(t) + else + set(t,what,false) + end +end + +function setters.register(t,what,...) + local data = t.data + what = lower(what) + local functions = data[what] + if not functions then + functions = { } + data[what] = functions + if trace_initialize then + t.report("defining %s",what) + end + end + local default = functions.default -- can be set from cnf file + for _, fnc in next, { ... } do + local typ = type(fnc) + if typ == "string" then + if trace_initialize then + t.report("coupling %s to %s",what,fnc) + end + local s = fnc -- else wrong reference + fnc = function(value) set(t,s,value) end + elseif typ ~= "function" then + fnc = nil + end + if fnc then + functions[#functions+1] = fnc + -- default: set at command line or in cnf file + -- value : set in tex run (needed when loading runtime) + local value = functions.value or default + if value ~= nil then + fnc(value) + functions.value = value + end + end + end + return false -- so we can use it in an assignment +end + +function setters.enable(t,what) + local e = t.enable + t.enable, t.done = enable, { } + enable(t,what) + t.enable, t.done = e, { } +end + +function setters.disable(t,what) + local e = t.disable + t.disable, t.done = disable, { } + disable(t,what) + t.disable, t.done = e, { } +end + +function setters.reset(t) + t.done = { } + reset(t) +end + +function setters.list(t) -- pattern + local list = table.sortedkeys(t.data) + local user, system = { }, { } + for l=1,#list do + local what = list[l] + if find(what,"^%*") then system[#system+1] = what else - user[#user+1] = what + user[#user+1] = what + end + end + return user, system +end + +function setters.show(t) + local category = t.name + local list = setters.list(t) + t.report() + for k=1,#list do + local name = list[k] + local functions = t.data[name] + if functions then + local value, default, modules = functions.value, functions.default, #functions + value = value == nil and "unset" or tostring(value) + default = default == nil and "unset" or tostring(default) + t.report("%-30s modules: %2i default: %6s value: %6s",name,modules,default,value) + end + end + t.report() +end + +-- we could have used a bit of oo and the trackers:enable syntax but +-- there is already a lot of code around using the singular tracker + +-- we could make this into a module but we also want the rest avaliable + +local enable, disable, register, list, show = setters.enable, setters.disable, setters.register, setters.list, setters.show + +local function report(setter,...) + local report = logs and logs.report + if report then + report(setter.name,...) + else -- fallback, as this module is loaded before the logger + write_nl(format("%-15s : %s\n",setter.name,format(...))) + end +end + +function setters.new(name) + local setter -- we need to access it in setter itself + setter = { + data = allocate(), -- indexed, but also default and value fields + name = name, + report = function(...) report (setter,...) end, + enable = function(...) enable (setter,...) end, + disable = function(...) disable (setter,...) end, + register = function(...) register(setter,...) end, + list = function(...) list (setter,...) end, + show = function(...) show (setter,...) end, + } + data[name] = setter + return setter +end + +trackers = setters.new("trackers") +directives = setters.new("directives") +experiments = setters.new("experiments") + +local t_enable, t_disable, t_report = trackers .enable, trackers .disable, trackers .report +local d_enable, d_disable, d_report = directives .enable, directives .disable, directives .report +local e_enable, e_disable, e_report = experiments.enable, experiments.disable, experiments.report + +-- nice trick: we overload two of the directives related functions with variants that +-- do tracing (itself using a tracker) .. proof of concept + +local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end) +local trace_experiments = false local trace_experiments = false trackers.register("system.experiments", function(v) trace_experiments = v end) + +function directives.enable(...) + if trace_directives then + d_report("enabling: %s",concat({...}," ")) + end + d_enable(...) +end + +function directives.disable(...) + if trace_directives then + d_report("disabling: %s",concat({...}," ")) + end + d_disable(...) +end + +function experiments.enable(...) + if trace_experiments then + e_report("enabling: %s",concat({...}," ")) + end + e_enable(...) +end + +function experiments.disable(...) + if trace_experiments then + e_report("disabling: %s",concat({...}," ")) + end + e_disable(...) +end + +-- a useful example + +directives.register("system.nostatistics", function(v) + statistics.enable = not v +end) + +directives.register("system.nolibraries", function(v) + libraries = nil -- we discard this tracing for security +end) + +-- experiment + +local flags = environment and environment.engineflags + +if flags then + if trackers and flags.trackers then + setters.initialize("flags","trackers", settings_to_hash(flags.trackers)) + -- t_enable(flags.trackers) + end + if directives and flags.directives then + setters.initialize("flags","directives", settings_to_hash(flags.directives)) + -- d_enable(flags.directives) + end +end + +-- here + +if texconfig then + + local function set(k,v) + v = tonumber(v) + if v then + texconfig[k] = v + end + end + + directives.register("luatex.expanddepth", function(v) set("expand_depth",v) end) + directives.register("luatex.hashextra", function(v) set("hash_extra",v) end) + directives.register("luatex.nestsize", function(v) set("nest_size",v) end) + directives.register("luatex.maxinopen", function(v) set("max_in_open",v) end) + directives.register("luatex.maxprintline", function(v) set("max_print_line",v) end) + directives.register("luatex.maxstrings", function(v) set("max_strings",v) end) + directives.register("luatex.paramsize", function(v) set("param_size",v) end) + directives.register("luatex.savesize", function(v) set("save_size",v) end) + directives.register("luatex.stacksize", function(v) set("stack_size",v) end) + +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['trac-log'] = { + version = 1.001, + comment = "companion to trac-log.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- todo: less categories, more subcategories (e.g. nodes) + + +local write_nl, write = texio and texio.write_nl or print, texio and texio.write or io.write +local format, gmatch, find = string.format, string.gmatch, string.find +local concat, insert, remove = table.concat, table.insert, table.remove +local escapedpattern = string.escapedpattern +local texcount = tex and tex.count +local next, type = next, type + +local setmetatableindex = table.setmetatableindex + +--[[ldx-- +

This is a prelude to a more extensive logging module. We no longer +provide based logging a sparsing is relatively easy anyway.

+--ldx]]-- + +logs = logs or { } +local logs = logs + +local moreinfo = [[ +More information about ConTeXt and the tools that come with it can be found at: + +maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context +webpage : http://www.pragma-ade.nl / http://tex.aanhet.net +wiki : http://contextgarden.net +]] + +-- basic loggers + +local function ignore() end + +setmetatableindex(logs, function(t,k) t[k] = ignore ; return ignore end) + +local report, subreport, status, settarget, setformats, settranslations + +local direct, subdirect, writer, pushtarget, poptarget + +if tex and tex.jobname or tex.formatname then + + local valueiskey = { __index = function(t,k) t[k] = k return k end } -- will be helper + + local target = "term and log" + + logs.flush = io.flush + + local formats = { } setmetatable(formats, valueiskey) + local translations = { } setmetatable(translations,valueiskey) + + writer = function(...) + write_nl(target,...) + end + + report = function(a,b,c,...) + if c then + write_nl(target,format("%-15s > %s\n",translations[a],format(formats[b],c,...))) + elseif b then + write_nl(target,format("%-15s > %s\n",translations[a],formats[b])) + elseif a then + write_nl(target,format("%-15s >\n", translations[a])) + else + write_nl(target,"\n") + end + end + + direct = function(a,b,c,...) + if c then + return format("%-15s > %s",translations[a],format(formats[b],c,...)) + elseif b then + return format("%-15s > %s",translations[a],formats[b]) + elseif a then + return format("%-15s >", translations[a]) + else + return "" + end + end + + subreport = function(a,s,b,c,...) + if c then + write_nl(target,format("%-15s > %s > %s\n",translations[a],translations[s],format(formats[b],c,...))) + elseif b then + write_nl(target,format("%-15s > %s > %s\n",translations[a],translations[s],formats[b])) + elseif a then + write_nl(target,format("%-15s > %s >\n", translations[a],translations[s])) + else + write_nl(target,"\n") + end + end + + subdirect = function(a,s,b,c,...) + if c then + return format("%-15s > %s > %s",translations[a],translations[s],format(formats[b],c,...)) + elseif b then + return format("%-15s > %s > %s",translations[a],translations[s],formats[b]) + elseif a then + return format("%-15s > %s >", translations[a],translations[s]) + else + return "" + end + end + + status = function(a,b,c,...) + if c then + write_nl(target,format("%-15s : %s\n",translations[a],format(formats[b],c,...))) + elseif b then + write_nl(target,format("%-15s : %s\n",translations[a],formats[b])) + elseif a then + write_nl(target,format("%-15s :\n", translations[a])) + else + write_nl(target,"\n") + end + end + + local targets = { + logfile = "log", + log = "log", + file = "log", + console = "term", + terminal = "term", + both = "term and log", + } + + settarget = function(whereto) + target = targets[whereto or "both"] or targets.both + if target == "term" or target == "term and log" then + logs.flush = io.flush + else + logs.flush = ignore + end + end + + local stack = { } + + pushtarget = function(newtarget) + insert(stack,target) + settarget(newtarget) + end + + poptarget = function() + if #stack > 0 then + settarget(remove(stack)) + end + end + + setformats = function(f) + formats = f + end + + settranslations = function(t) + translations = t + end + +else + + logs.flush = ignore + + writer = write_nl + + report = function(a,b,c,...) + if c then + write_nl(format("%-15s | %s",a,format(b,c,...))) + elseif b then + write_nl(format("%-15s | %s",a,b)) + elseif a then + write_nl(format("%-15s |", a)) + else + write_nl("") + end + end + + subreport = function(a,sub,b,c,...) + if c then + write_nl(format("%-15s | %s | %s",a,sub,format(b,c,...))) + elseif b then + write_nl(format("%-15s | %s | %s",a,sub,b)) + elseif a then + write_nl(format("%-15s | %s |", a,sub)) + else + write_nl("") + end + end + + status = function(a,b,c,...) -- not to be used in lua anyway + if c then + write_nl(format("%-15s : %s\n",a,format(b,c,...))) + elseif b then + write_nl(format("%-15s : %s\n",a,b)) -- b can have %'s + elseif a then + write_nl(format("%-15s :\n", a)) + else + write_nl("\n") + end + end + + direct = ignore + subdirect = ignore + + settarget = ignore + pushtarget = ignore + poptarget = ignore + setformats = ignore + settranslations = ignore + +end + +logs.report = report +logs.subreport = subreport +logs.status = status +logs.settarget = settarget +logs.pushtarget = pushtarget +logs.poptarget = poptarget +logs.setformats = setformats +logs.settranslations = settranslations + +logs.direct = direct +logs.subdirect = subdirect +logs.writer = writer + +-- installer + +-- todo: renew (un) locks when a new one is added and wildcard + +local data, states = { }, nil + +function logs.reporter(category,subcategory) + local logger = data[category] + if not logger then + local state = false + if states == true then + state = true + elseif type(states) == "table" then + for c, _ in next, states do + if find(category,c) then + state = true + break + end + end + end + logger = { + reporters = { }, + state = state, + } + data[category] = logger + end + local reporter = logger.reporters[subcategory or "default"] + if not reporter then + if subcategory then + reporter = function(...) + if not logger.state then + subreport(category,subcategory,...) + end + end + logger.reporters[subcategory] = reporter + else + local tag = category + reporter = function(...) + if not logger.state then + report(category,...) + end + end + logger.reporters.default = reporter + end + end + return reporter +end + +logs.new = logs.reporter -- for old times sake + +-- context specicific: this ends up in the macro stream + +local ctxreport = logs.writer + +function logs.setmessenger(m) + ctxreport = m +end + +function logs.messenger(category,subcategory) + -- we need to avoid catcode mess (todo: fast context) + if subcategory then + return function(...) + ctxreport(subdirect(category,subcategory,...)) + end + else + return function(...) + ctxreport(direct(category,...)) + end + end +end + +-- so far + +local function setblocked(category,value) + if category == true then + -- lock all + category, value = "*", true + elseif category == false then + -- unlock all + category, value = "*", false + elseif value == nil then + -- lock selective + value = true + end + if category == "*" then + states = value + for k, v in next, data do + v.state = value + end + else + states = utilities.parsers.settings_to_hash(category) + for c, _ in next, states do + if data[c] then + v.state = value + else + c = escapedpattern(c,true) + for k, v in next, data do + if find(k,c) then + v.state = value + end + end + end + end + end +end + +function logs.disable(category,value) + setblocked(category,value == nil and true or value) +end + +function logs.enable(category) + setblocked(category,false) +end + +function logs.categories() + return table.sortedkeys(data) +end + +function logs.show() + local n, c, s, max = 0, 0, 0, 0 + for category, v in table.sortedpairs(data) do + n = n + 1 + local state = v.state + local reporters = v.reporters + local nc = #category + if nc > c then + c = nc + end + for subcategory, _ in next, reporters do + local ns = #subcategory + if ns > c then + s = ns + end + local m = nc + ns + if m > max then + max = m + end + end + local subcategories = concat(table.sortedkeys(reporters),", ") + if state == true then + state = "disabled" + elseif state == false then + state = "enabled" + else + state = "unknown" + end + -- no new here + report("logging","category: '%s', subcategories: '%s', state: '%s'",category,subcategories,state) + end + report("logging","categories: %s, max category: %s, max subcategory: %s, max combined: %s",n,c,s,max) +end + +directives.register("logs.blocked", function(v) + setblocked(v,true) +end) + +directives.register("logs.target", function(v) + settarget(v) +end) + +-- tex specific loggers (might move elsewhere) + +local report_pages = logs.reporter("pages") -- not needed but saves checking when we grep for it + +local real, user, sub + +function logs.start_page_number() + real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno +end + +function logs.stop_page_number() + if real > 0 then + if user > 0 then + if sub > 0 then + report_pages("flushing realpage %s, userpage %s, subpage %s",real,user,sub) + else + report_pages("flushing realpage %s, userpage %s",real,user) + end + else + report_pages("flushing realpage %s",real) + end + else + report_pages("flushing page") + end + logs.flush() +end + +logs.report_job_stat = statistics and statistics.showjobstat + +local report_files = logs.reporter("files") + +local nesting = 0 +local verbose = false +local hasscheme = url.hasscheme + +-- we don't have show_open and show_close callbacks yet + +function logs.show_open(name) + -- if hasscheme(name) ~= "virtual" then + -- if verbose then + -- nesting = nesting + 1 + -- report_files("level %s, opening %s",nesting,name) + -- else + -- write(format("(%s",name)) -- tex adds a space + -- end + -- end +end + +function logs.show_close(name) + -- if hasscheme(name) ~= "virtual" then + -- if verbose then + -- report_files("level %s, closing %s",nesting,name) + -- nesting = nesting - 1 + -- else + -- write(")") -- tex adds a space + -- end + -- end +end + +function logs.show_load(name) + -- if hasscheme(name) ~= "virtual" then + -- if verbose then + -- report_files("level %s, loading %s",nesting+1,name) + -- else + -- write(format("(%s)",name)) + -- end + -- end +end + +-- there may be scripts out there using this: + +local simple = logs.reporter("comment") + +logs.simple = simple +logs.simpleline = simple + +-- obsolete + +function logs.setprogram () end -- obsolete +function logs.extendbanner() end -- obsolete +function logs.reportlines () end -- obsolete +function logs.reportbanner() end -- obsolete +function logs.reportline () end -- obsolete +function logs.simplelines () end -- obsolete +function logs.help () end -- obsolete + +-- applications + +local function reportlines(t,str) + if str then + for line in gmatch(str,"(.-)[\n\r]") do + t.report(line) + end + end +end + +local function reportbanner(t) + local banner = t.banner + if banner then + t.report(banner) + t.report() + end +end + +local function reporthelp(t,...) + local helpinfo = t.helpinfo + if type(helpinfo) == "string" then + reportlines(t,helpinfo) + elseif type(helpinfo) == "table" then + local tags = { ... } + for i=1,#tags do + reportlines(t,t.helpinfo[tags[i]]) + if i < #tags then + t.report() + end + end + end +end + +local function reportinfo(t) + t.report() + reportlines(t,moreinfo) +end + +function logs.application(t) + t.name = t.name or "unknown" + t.banner = t.banner + t.report = logs.reporter(t.name) + t.help = function(...) reportbanner(t) ; reporthelp(t,...) ; reportinfo(t) end + t.identify = function() reportbanner(t) end + return t +end + +-- somewhat special + +-- logging to a file + + +function logs.system(whereto,process,jobname,category,...) + local message = format("%s %s => %s => %s => %s\r",os.date("%d/%m/%y %H:%m:%S"),process,jobname,category,format(...)) + for i=1,10 do + local f = io.open(whereto,"a") -- we can consider keepint the file open + if f then + f:write(message) + f:close() + break + else + sleep(0.1) + end + end +end + +local report_system = logs.reporter("system","logs") + +function logs.obsolete(old,new) + local o = loadstring("return " .. new)() + if type(o) == "function" then + return function(...) + report_system("function %s is obsolete, use %s",old,new) + loadstring(old .. "=" .. new .. " return ".. old)()(...) + end + elseif type(o) == "table" then + local t, m = { }, { } + m.__index = function(t,k) + report_system("table %s is obsolete, use %s",old,new) + m.__index, m.__newindex = o, o + return o[k] + end + m.__newindex = function(t,k,v) + report_system("table %s is obsolete, use %s",old,new) + m.__index, m.__newindex = o, o + o[k] = v + end + if libraries then + libraries.obsolete[old] = t -- true + end + setmetatable(t,m) + return t + end +end + +if utilities then + utilities.report = report_system +end + +if tex and tex.error then + function logs.texerrormessage(...) -- for the moment we put this function here + tex.error(format(...), { }) + end +else + function logs.texerrormessage(...) + print(format(...)) + end +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['trac-pro'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local getmetatable, setmetatable, rawset, type = getmetatable, setmetatable, rawset, type + +-- The protection implemented here is probably not that tight but good enough to catch +-- problems due to naive usage. +-- +-- There's a more extensive version (trac-xxx.lua) that supports nesting. +-- +-- This will change when we have _ENV in lua 5.2+ + +local trace_namespaces = false trackers.register("system.namespaces", function(v) trace_namespaces = v end) + +local report_system = logs.reporter("system","protection") + +namespaces = namespaces or { } +local namespaces = namespaces + +local registered = { } + +local function report_index(k,name) + if trace_namespaces then + report_system("reference to '%s' in protected namespace '%s', %s",k,name,debug.traceback()) + else + report_system("reference to '%s' in protected namespace '%s'",k,name) + end +end + +local function report_newindex(k,name) + if trace_namespaces then + report_system("assignment to '%s' in protected namespace '%s', %s",k,name,debug.traceback()) + else + report_system("assignment to '%s' in protected namespace '%s'",k,name) + end +end + +local function register(name) + local data = name == "global" and _G or _G[name] + if not data then + return -- error + end + registered[name] = data + local m = getmetatable(data) + if not m then + m = { } + setmetatable(data,m) + end + local index, newindex = { }, { } + m.__saved__index = m.__index + m.__no__index = function(t,k) + if not index[k] then + index[k] = true + report_index(k,name) + end + return nil + end + m.__saved__newindex = m.__newindex + m.__no__newindex = function(t,k,v) + if not newindex[k] then + newindex[k] = true + report_newindex(k,name) + end + rawset(t,k,v) + end + m.__protection__depth = 0 +end + +local function private(name) -- maybe save name + local data = registered[name] + if not data then + data = _G[name] + if not data then + data = { } + _G[name] = data + end + register(name) + end + return data +end + +local function protect(name) + local data = registered[name] + if not data then + return + end + local m = getmetatable(data) + local pd = m.__protection__depth + if pd > 0 then + m.__protection__depth = pd + 1 + else + m.__save_d_index, m.__saved__newindex = m.__index, m.__newindex + m.__index, m.__newindex = m.__no__index, m.__no__newindex + m.__protection__depth = 1 + end +end + +local function unprotect(name) + local data = registered[name] + if not data then + return + end + local m = getmetatable(data) + local pd = m.__protection__depth + if pd > 1 then + m.__protection__depth = pd - 1 + else + m.__index, m.__newindex = m.__saved__index, m.__saved__newindex + m.__protection__depth = 0 + end +end + +local function protectall() + for name, _ in next, registered do + if name ~= "global" then + protect(name) + end + end +end + +local function unprotectall() + for name, _ in next, registered do + if name ~= "global" then + unprotect(name) + end + end +end + +namespaces.register = register -- register when defined +namespaces.private = private -- allocate and register if needed +namespaces.protect = protect +namespaces.unprotect = unprotect +namespaces.protectall = protectall +namespaces.unprotectall = unprotectall + +namespaces.private("namespaces") registered = { } register("global") -- unreachable + +directives.register("system.protect", function(v) + if v then + protectall() + else + unprotectall() + end +end) + +directives.register("system.checkglobals", function(v) + if v then + report_system("enabling global namespace guard") + protect("global") + else + report_system("disabling global namespace guard") + unprotect("global") + end +end) + +-- dummy section (will go to luat-dum.lua) + + + + + + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['luat-env'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- A former version provided functionality for non embeded core +-- scripts i.e. runtime library loading. Given the amount of +-- Lua code we use now, this no longer makes sense. Much of this +-- evolved before bytecode arrays were available and so a lot of +-- code has disappeared already. + +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) + +local report_lua = logs.reporter("resolvers","lua") + +local allocate, mark = utilities.storage.allocate, utilities.storage.mark + +local format, sub, match, gsub, find = string.format, string.sub, string.match, string.gsub, string.find +local unquoted, quoted = string.unquoted, string.quoted +local concat = table.concat + +-- precautions + +os.setlocale(nil,nil) -- useless feature and even dangerous in luatex + +function os.setlocale() + -- no way you can mess with it +end + +-- dirty tricks + +if arg and (arg[0] == 'luatex' or arg[0] == 'luatex.exe') and arg[1] == "--luaonly" then + arg[-1] = arg[0] + arg[ 0] = arg[2] + for k=3,#arg do + arg[k-2] = arg[k] + end + arg[#arg] = nil -- last + arg[#arg] = nil -- pre-last +end + +-- environment + +environment = environment or { } +local environment = environment + +environment.arguments = allocate() +environment.files = allocate() +environment.sortedflags = nil + +local mt = { + __index = function(_,k) + if k == "version" then + local version = tex.toks and tex.toks.contextversiontoks + if version and version ~= "" then + rawset(environment,"version",version) + return version + else + return "unknown" + end + elseif k == "jobname" or k == "formatname" then + local name = tex and tex[k] + if name or name== "" then + rawset(environment,k,name) + return name + else + return "unknown" + end + elseif k == "outputfilename" then + local name = environment.jobname + rawset(environment,k,name) + return name + end + end +} + +setmetatable(environment,mt) + +function environment.initializearguments(arg) + local arguments, files = { }, { } + environment.arguments, environment.files, environment.sortedflags = arguments, files, nil + for index=1,#arg do + local argument = arg[index] + if index > 0 then + local flag, value = match(argument,"^%-+(.-)=(.-)$") + if flag then + arguments[flag] = unquoted(value or "") + else + flag = match(argument,"^%-+(.+)") + if flag then + arguments[flag] = true + else + files[#files+1] = argument + end + end + end + end + environment.ownname = environment.ownname or arg[0] or 'unknown.lua' +end + +function environment.setargument(name,value) + environment.arguments[name] = value +end + +-- todo: defaults, better checks e.g on type (boolean versus string) +-- +-- tricky: too many hits when we support partials unless we add +-- a registration of arguments so from now on we have 'partial' + +function environment.argument(name,partial) + local arguments, sortedflags = environment.arguments, environment.sortedflags + if arguments[name] then + return arguments[name] + elseif partial then + if not sortedflags then + sortedflags = allocate(table.sortedkeys(arguments)) + for k=1,#sortedflags do + sortedflags[k] = "^" .. sortedflags[k] + end + environment.sortedflags = sortedflags + end + -- example of potential clash: ^mode ^modefile + for k=1,#sortedflags do + local v = sortedflags[k] + if find(name,v) then + return arguments[sub(v,2,#v)] + end end end - return user, system + return nil end -function setters.show(t) - commands.writestatus("","") - local list = setters.list(t) - for k=1,#list do - commands.writestatus(t.name,list[k]) +function environment.splitarguments(separator) -- rather special, cut-off before separator + local done, before, after = false, { }, { } + local originalarguments = environment.originalarguments + for k=1,#originalarguments do + local v = originalarguments[k] + if not done and v == separator then + done = true + elseif done then + after[#after+1] = v + else + before[#before+1] = v + end end - commands.writestatus("","") + return before, after end --- we could have used a bit of oo and the trackers:enable syntax but --- there is already a lot of code around using the singular tracker +function environment.reconstructcommandline(arg,noquote) + arg = arg or environment.originalarguments + if noquote and #arg == 1 then + -- we could just do: return unquoted(resolvers.resolve(arg[i])) + local a = arg[1] + a = resolvers.resolve(a) + a = unquoted(a) + return a + elseif #arg > 0 then + local result = { } + for i=1,#arg do + -- we could just do: result[#result+1] = format("%q",unquoted(resolvers.resolve(arg[i]))) + local a = arg[i] + a = resolvers.resolve(a) + a = unquoted(a) + a = gsub(a,'"','\\"') -- tricky + if find(a," ") then + result[#result+1] = quoted(a) + else + result[#result+1] = a + end + end + return concat(result," ") + else + return "" + end +end --- we could make this into a module -function setters.new(name) - local t - t = { - data = { }, - name = name, - enable = function(...) setters.enable (t,...) end, - disable = function(...) setters.disable (t,...) end, - register = function(...) setters.register(t,...) end, - list = function(...) setters.list (t,...) end, - show = function(...) setters.show (t,...) end, - } - setters.data[name] = t - return t -end +if arg then -trackers = setters.new("trackers") -directives = setters.new("directives") -experiments = setters.new("experiments") + -- new, reconstruct quoted snippets (maybe better just remove the " then and add them later) + local newarg, instring = { }, false --- nice trick: we overload two of the directives related functions with variants that --- do tracing (itself using a tracker) .. proof of concept + for index=1,#arg do + local argument = arg[index] + if find(argument,"^\"") then + newarg[#newarg+1] = gsub(argument,"^\"","") + if not find(argument,"\"$") then + instring = true + end + elseif find(argument,"\"$") then + newarg[#newarg] = newarg[#newarg] .. " " .. gsub(argument,"\"$","") + instring = false + elseif instring then + newarg[#newarg] = newarg[#newarg] .. " " .. argument + else + newarg[#newarg+1] = argument + end + end + for i=1,-5,-1 do + newarg[i] = arg[i] + end -local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end) -local trace_experiments = false local trace_experiments = false trackers.register("system.experiments", function(v) trace_experiments = v end) + environment.initializearguments(newarg) -local e = directives.enable -local d = directives.disable + environment.originalarguments = mark(newarg) + environment.rawarguments = mark(arg) -function directives.enable(...) - commands.writestatus("directives","enabling: %s",concat({...}," ")) - e(...) -end + arg = { } -- prevent duplicate handling -function directives.disable(...) - commands.writestatus("directives","disabling: %s",concat({...}," ")) - d(...) end -local e = experiments.enable -local d = experiments.disable +-- weird place ... depends on a not yet loaded module -function experiments.enable(...) - commands.writestatus("experiments","enabling: %s",concat({...}," ")) - e(...) +function environment.texfile(filename) + return resolvers.findfile(filename,'tex') end -function experiments.disable(...) - commands.writestatus("experiments","disabling: %s",concat({...}," ")) - d(...) +function environment.luafile(filename) + local resolved = resolvers.findfile(filename,'tex') or "" + if resolved ~= "" then + return resolved + end + resolved = resolvers.findfile(filename,'texmfscripts') or "" + if resolved ~= "" then + return resolved + end + return resolvers.findfile(filename,'luatexlibs') or "" end --- a useful example +environment.loadedluacode = loadfile -- can be overloaded -directives.register("system.nostatistics", function(v) - statistics.enable = not v -end) +function environment.luafilechunk(filename,silent) -- used for loading lua bytecode in the format + filename = file.replacesuffix(filename, "lua") + local fullname = environment.luafile(filename) + if fullname and fullname ~= "" then + local data = environment.loadedluacode(fullname) + if trace_locating then + report_lua("loading file %s%s", fullname, not data and " failed" or "") + elseif not silent then + texio.write("<",data and "+ " or "- ",fullname,">") + end + return data + else + if trace_locating then + report_lua("unknown file %s", filename) + end + return nil + end +end + +-- the next ones can use the previous ones / combine +function environment.loadluafile(filename, version) + local lucname, luaname, chunk + local basename = file.removesuffix(filename) + if basename == filename then + lucname, luaname = basename .. ".luc", basename .. ".lua" + else + lucname, luaname = nil, basename -- forced suffix + end + -- when not overloaded by explicit suffix we look for a luc file first + local fullname = (lucname and environment.luafile(lucname)) or "" + if fullname ~= "" then + if trace_locating then + report_lua("loading %s", fullname) + end + chunk = loadfile(fullname) -- this way we don't need a file exists check + end + if chunk then + assert(chunk)() + if version then + -- we check of the version number of this chunk matches + local v = version -- can be nil + if modules and modules[filename] then + v = modules[filename].version -- new method + elseif versions and versions[filename] then + v = versions[filename] -- old method + end + if v == version then + return true + else + if trace_locating then + report_lua("version mismatch for %s: lua=%s, luc=%s", filename, v, version) + end + environment.loadluafile(filename) + end + else + return true + end + end + fullname = (luaname and environment.luafile(luaname)) or "" + if fullname ~= "" then + if trace_locating then + report_lua("loading %s", fullname) + end + chunk = loadfile(fullname) -- this way we don't need a file exists check + if not chunk then + if trace_locating then + report_lua("unknown file %s", filename) + end + else + assert(chunk)() + return true + end + end + return false +end end -- of closure @@ -3991,6 +6263,8 @@ if not modules then modules = { } end modules ['lxml-tab'] = { local trace_entities = false trackers.register("xml.entities", function(v) trace_entities = v end) +local report_xml = logs and logs.reporter("xml","core") or function(...) print(format(...)) end + --[[ldx--

The parser used here is inspired by the variant discussed in the lua book, but handles comment and processing instructions, has a different structure, provides @@ -4001,11 +6275,15 @@ The find based parser can be found in l-xml-edu.lua along with other older code.

Beware, the interface may change. For instance at, ns, tg, dt may get more verbose names. Once the code is stable we will also remove some tracing and optimize the code.

+ +

I might even decide to reimplement the parser using the latest trickery +as the current variant was written when showed up and it's easier now to +build tables in one go.

--ldx]]-- xml = xml or { } +local xml = xml ---~ local xml = xml local concat, remove, insert = table.concat, table.remove, table.insert local type, next, setmetatable, getmetatable, tonumber = type, next, setmetatable, getmetatable, tonumber @@ -4129,7 +6407,7 @@ local dcache, hcache, acache = { }, { }, { } local mt = { } -function initialize_mt(root) +local function initialize_mt(root) mt = { __index = root } -- will be redefined later end @@ -4137,8 +6415,8 @@ function xml.setproperty(root,k,v) getmetatable(root).__index[k] = v end -function xml.check_error(top,toclose) - return "" +function xml.checkerror(top,toclose) + return "" -- can be set end local function add_attribute(namespace,tag,value) @@ -4194,9 +6472,9 @@ local function add_end(spacing, namespace, tag) local toclose = remove(stack) top = stack[#stack] if #stack < 1 then - errorstr = format("nothing to close with %s %s", tag, xml.check_error(top,toclose) or "") + errorstr = format("nothing to close with %s %s", tag, xml.checkerror(top,toclose) or "") elseif toclose.tg ~= tag then -- no namespace check - errorstr = format("unable to close %s with %s %s", toclose.tg, tag, xml.check_error(top,toclose) or "") + errorstr = format("unable to close %s with %s %s", toclose.tg, tag, xml.checkerror(top,toclose) or "") end dt = top.dt dt[#dt+1] = toclose @@ -4233,24 +6511,29 @@ local reported_attribute_errors = { } local function attribute_value_error(str) if not reported_attribute_errors[str] then - logs.report("xml","invalid attribute value: %q",str) + report_xml("invalid attribute value: %q",str) reported_attribute_errors[str] = true at._error_ = str end return str end + local function attribute_specification_error(str) if not reported_attribute_errors[str] then - logs.report("xml","invalid attribute specification: %q",str) + report_xml("invalid attribute specification: %q",str) reported_attribute_errors[str] = true at._error_ = str end return str end -function xml.unknown_dec_entity_format(str) return (str == "" and "&error;") or format("&%s;",str) end -function xml.unknown_hex_entity_format(str) return format("&#x%s;",str) end -function xml.unknown_any_entity_format(str) return format("&#x%s;",str) end +xml.placeholders = { + unknown_dec_entity = function(str) return (str == "" and "&error;") or format("&%s;",str) end, + unknown_hex_entity = function(str) return format("&#x%s;",str) end, + unknown_any_entity = function(str) return format("&#x%s;",str) end, +} + +local placeholders = xml.placeholders local function fromhex(s) local n = tonumber(s,16) @@ -4304,18 +6587,18 @@ local function handle_hex_entity(str) h = unify_predefined and predefined_unified[n] if h then if trace_entities then - logs.report("xml","utfize, converting hex entity &#x%s; into %s",str,h) + report_xml("utfize, converting hex entity &#x%s; into %s",str,h) end elseif utfize then - h = (n and utfchar(n)) or xml.unknown_hex_entity_format(str) or "" + h = (n and utfchar(n)) or xml.unknown_hex_entity(str) or "" if not n then - logs.report("xml","utfize, ignoring hex entity &#x%s;",str) + report_xml("utfize, ignoring hex entity &#x%s;",str) elseif trace_entities then - logs.report("xml","utfize, converting hex entity &#x%s; into %s",str,h) + report_xml("utfize, converting hex entity &#x%s; into %s",str,h) end else if trace_entities then - logs.report("xml","found entity &#x%s;",str) + report_xml("found entity &#x%s;",str) end h = "&#x" .. str .. ";" end @@ -4331,18 +6614,18 @@ local function handle_dec_entity(str) d = unify_predefined and predefined_unified[n] if d then if trace_entities then - logs.report("xml","utfize, converting dec entity &#%s; into %s",str,d) + report_xml("utfize, converting dec entity &#%s; into %s",str,d) end elseif utfize then - d = (n and utfchar(n)) or xml.unknown_dec_entity_format(str) or "" + d = (n and utfchar(n)) or placeholders.unknown_dec_entity(str) or "" if not n then - logs.report("xml","utfize, ignoring dec entity &#%s;",str) + report_xml("utfize, ignoring dec entity &#%s;",str) elseif trace_entities then - logs.report("xml","utfize, converting dec entity &#%s; into %s",str,h) + report_xml("utfize, converting dec entity &#%s; into %s",str,h) end else if trace_entities then - logs.report("xml","found entity &#%s;",str) + report_xml("found entity &#%s;",str) end d = "&#" .. str .. ";" end @@ -4367,20 +6650,21 @@ local function handle_any_entity(str) end if a then if trace_entities then - logs.report("xml","resolved entity &%s; -> %s (internal)",str,a) + report_xml("resolved entity &%s; -> %s (internal)",str,a) end a = lpegmatch(parsedentity,a) or a else - if xml.unknown_any_entity_format then - a = xml.unknown_any_entity_format(str) or "" + local unknown_any_entity = placeholders.unknown_any_entity + if unknown_any_entity then + a = unknown_any_entity(str) or "" end if a then if trace_entities then - logs.report("xml","resolved entity &%s; -> %s (external)",str,a) + report_xml("resolved entity &%s; -> %s (external)",str,a) end else if trace_entities then - logs.report("xml","keeping entity &%s;",str) + report_xml("keeping entity &%s;",str) end if str == "" then a = "&error;" @@ -4392,7 +6676,7 @@ local function handle_any_entity(str) acache[str] = a elseif trace_entities then if not acache[str] then - logs.report("xml","converting entity &%s; into %s",str,a) + report_xml("converting entity &%s; into %s",str,a) acache[str] = a end end @@ -4401,7 +6685,7 @@ local function handle_any_entity(str) local a = acache[str] if not a then if trace_entities then - logs.report("xml","found entity &%s;",str) + report_xml("found entity &%s;",str) end a = resolve_predefined and predefined_simplified[str] if a then @@ -4420,7 +6704,7 @@ local function handle_any_entity(str) end local function handle_end_entity(chr) - logs.report("xml","error in entity, %q found instead of ';'",chr) + report_xml("error in entity, %q found instead of ';'",chr) end local space = S(' \r\n\t') @@ -4555,7 +6839,7 @@ local function xmlconvert(data, settings) resolve_predefined = settings.resolve_predefined_entities -- in case we have escaped entities unify_predefined = settings.unify_predefined_entities -- & -> & cleanup = settings.text_cleanup - stack, top, at, xmlns, errorstr, result, entities = { }, { }, { }, { }, nil, nil, settings.entities or { } + stack, top, at, xmlns, errorstr, entities = { }, { }, { }, { }, nil, settings.entities or { } acache, hcache, dcache = { }, { }, { } -- not stored reported_attribute_errors = { } if settings.parent_root then @@ -4583,16 +6867,17 @@ local function xmlconvert(data, settings) else errorstr = "invalid xml file - no text at all" end + local result if errorstr and errorstr ~= "" then result = { dt = { { ns = "", tg = "error", dt = { errorstr }, at={ }, er = true } } } setmetatable(stack, mt) - local error_handler = settings.error_handler - if error_handler == false then + local errorhandler = settings.error_handler + if errorhandler == false then -- no error message else - error_handler = error_handler or xml.error_handler - if error_handler then - xml.error_handler("load",errorstr) + errorhandler = errorhandler or xml.errorhandler + if errorhandler then + xml.errorhandler("load",errorstr) end end else @@ -4652,7 +6937,7 @@ function xml.is_valid(root) return root and not root.error end -xml.error_handler = (logs and logs.report) or (input and logs.report) or print +xml.errorhandler = report --[[ldx--

We cannot load an from a filehandle so we need to load @@ -4763,7 +7048,7 @@ local function verbose_element(e,handlers) ats[#ats+1] = format('%s=%q',k,v) end end - if ern and trace_remap and ern ~= ens then + if ern and trace_entities and ern ~= ens then ens = ern end if ens ~= "" then @@ -4868,7 +7153,7 @@ local function serialize(e,handlers,...) -- elseif type(e) == "string" then -- functions["@tx@"](e,handlers) else - functions["@dc@"](e,handlers) + functions["@dc@"](e,handlers) -- dc ? end if finalize then return finalize() @@ -4894,7 +7179,7 @@ local function newhandlers(settings) if settings then for k,v in next, settings do if type(v) == "table" then - tk = t[k] if not tk then tk = { } t[k] = tk end + local tk = t[k] if not tk then tk = { } t[k] = tk end for kk,vv in next, v do tk[kk] = vv end @@ -4906,6 +7191,7 @@ local function newhandlers(settings) handlers[settings.name] = t end end + utilities.storage.mark(t) return t end @@ -5005,7 +7291,7 @@ local function xmltext(root) -- inline return (root and xmltostring(root)) or "" end -function initialize_mt(root) +initialize_mt = function(root) -- redefinition mt = { __tostring = xmltext, __index = root } end @@ -5040,7 +7326,6 @@ xml.string = xmlstring

A few helpers:

--ldx]]-- ---~ xmlsetproperty(root,"settings",settings) function xml.settings(e) while e do @@ -5150,6 +7435,7 @@ function xml.makestandalone(root) end end end + return root end @@ -5166,11 +7452,14 @@ if not modules then modules = { } end modules ['lxml-pth'] = { } -- e.ni is only valid after a filter run +-- todo: B/C/[get first match] local concat, remove, insert = table.concat, table.remove, table.insert local type, next, tonumber, tostring, setmetatable, loadstring = type, next, tonumber, tostring, setmetatable, loadstring local format, upper, lower, gmatch, gsub, find, rep = string.format, string.upper, string.lower, string.gmatch, string.gsub, string.find, string.rep -local lpegmatch = lpeg.match +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns + +local setmetatableindex = table.setmetatableindex -- beware, this is not xpath ... e.g. position is different (currently) and -- we have reverse-sibling as reversed preceding sibling @@ -5202,23 +7491,33 @@ local trace_lpath = false if trackers then trackers.register("xml.path", local trace_lparse = false if trackers then trackers.register("xml.parse", function(v) trace_lparse = v end) end local trace_lprofile = false if trackers then trackers.register("xml.profile", function(v) trace_lpath = v trace_lparse = v trace_lprofile = v end) end +local report_lpath = logs.reporter("xml","lpath") + --[[ldx--

We've now arrived at an interesting part: accessing the tree using a subset of and since we're not compatible we call it . We will explain more about its usage in other documents.

--ldx]]-- +local xml = xml + local lpathcalls = 0 function xml.lpathcalls () return lpathcalls end local lpathcached = 0 function xml.lpathcached() return lpathcached end -xml.functions = xml.functions or { } -- internal -xml.expressions = xml.expressions or { } -- in expressions -xml.finalizers = xml.finalizers or { } -- fast do-with ... (with return value other than collection) -xml.specialhandler = xml.specialhandler or { } +xml.functions = xml.functions or { } -- internal +local functions = xml.functions + +xml.expressions = xml.expressions or { } -- in expressions +local expressions = xml.expressions + +xml.finalizers = xml.finalizers or { } -- fast do-with ... (with return value other than collection) +local finalizers = xml.finalizers -local functions = xml.functions -local expressions = xml.expressions -local finalizers = xml.finalizers +xml.specialhandler = xml.specialhandler or { } +local specialhandler = xml.specialhandler + +lpegpatterns.xml = lpegpatterns.xml or { } +local xmlpatterns = lpegpatterns.xml finalizers.xml = finalizers.xml or { } finalizers.tex = finalizers.tex or { } @@ -5228,14 +7527,14 @@ local function fallback (t, name) if fn then t[name] = fn else - logs.report("xml","unknown sub finalizer '%s'",tostring(name)) + report_lpath("unknown sub finalizer '%s'",tostring(name)) fn = function() end end return fn end -setmetatable(finalizers.xml, { __index = fallback }) -setmetatable(finalizers.tex, { __index = fallback }) +setmetatableindex(finalizers.xml, fallback) +setmetatableindex(finalizers.tex, fallback) xml.defaultprotocol = "xml" @@ -5283,102 +7582,106 @@ apply_axis['root'] = function(list) rt = ll end end - collected[#collected+1] = rt + collected[l] = rt end return collected end apply_axis['self'] = function(list) ---~ local collected = { } ---~ for l=1,#list do ---~ collected[#collected+1] = list[l] ---~ end ---~ return collected return list end apply_axis['child'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local dt = ll.dt - local en = 0 - for k=1,#dt do - local dk = dt[k] - if dk.tg then - collected[#collected+1] = dk - dk.ni = k -- refresh - en = en + 1 - dk.ei = en + if dt then -- weird that this is needed + local en = 0 + for k=1,#dt do + local dk = dt[k] + if dk.tg then + c = c + 1 + collected[c] = dk + dk.ni = k -- refresh + en = en + 1 + dk.ei = en + end end + ll.en = en end - ll.en = en end return collected end -local function collect(list,collected) +local function collect(list,collected,c) local dt = list.dt if dt then local en = 0 for k=1,#dt do local dk = dt[k] if dk.tg then - collected[#collected+1] = dk + c = c + 1 + collected[c] = dk dk.ni = k -- refresh en = en + 1 dk.ei = en - collect(dk,collected) + c = collect(dk,collected,c) end end list.en = en end + return c end apply_axis['descendant'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do - collect(list[l],collected) + c = collect(list[l],collected,c) end return collected end -local function collect(list,collected) +local function collect(list,collected,c) local dt = list.dt if dt then local en = 0 for k=1,#dt do local dk = dt[k] if dk.tg then - collected[#collected+1] = dk + c = c + 1 + collected[c] = dk dk.ni = k -- refresh en = en + 1 dk.ei = en - collect(dk,collected) + c = collect(dk,collected,c) end end list.en = en end + return c end apply_axis['descendant-or-self'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] if ll.special ~= true then -- catch double root - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end - collect(ll,collected) + c = collect(ll,collected,c) end return collected end apply_axis['ancestor'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] while ll do ll = ll.__p__ if ll then - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end end end @@ -5386,14 +7689,16 @@ apply_axis['ancestor'] = function(list) end apply_axis['ancestor-or-self'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll while ll do ll = ll.__p__ if ll then - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end end end @@ -5401,11 +7706,12 @@ apply_axis['ancestor-or-self'] = function(list) end apply_axis['parent'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local pl = list[l].__p__ if pl then - collected[#collected+1] = pl + c = c + 1 + collected[c] = pl end end return collected @@ -5420,43 +7726,15 @@ apply_axis['namespace'] = function(list) end apply_axis['following'] = function(list) -- incomplete ---~ local collected = { } ---~ for l=1,#list do ---~ local ll = list[l] ---~ local p = ll.__p__ ---~ local d = p.dt ---~ for i=ll.ni+1,#d do ---~ local di = d[i] ---~ if type(di) == "table" then ---~ collected[#collected+1] = di ---~ break ---~ end ---~ end ---~ end ---~ return collected return { } end apply_axis['preceding'] = function(list) -- incomplete ---~ local collected = { } ---~ for l=1,#list do ---~ local ll = list[l] ---~ local p = ll.__p__ ---~ local d = p.dt ---~ for i=ll.ni-1,1,-1 do ---~ local di = d[i] ---~ if type(di) == "table" then ---~ collected[#collected+1] = di ---~ break ---~ end ---~ end ---~ end ---~ return collected return { } end apply_axis['following-sibling'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local p = ll.__p__ @@ -5464,7 +7742,8 @@ apply_axis['following-sibling'] = function(list) for i=ll.ni+1,#d do local di = d[i] if type(di) == "table" then - collected[#collected+1] = di + c = c + 1 + collected[c] = di end end end @@ -5472,7 +7751,7 @@ apply_axis['following-sibling'] = function(list) end apply_axis['preceding-sibling'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local p = ll.__p__ @@ -5480,7 +7759,8 @@ apply_axis['preceding-sibling'] = function(list) for i=1,ll.ni-1 do local di = d[i] if type(di) == "table" then - collected[#collected+1] = di + c = c + 1 + collected[c] = di end end end @@ -5488,7 +7768,7 @@ apply_axis['preceding-sibling'] = function(list) end apply_axis['reverse-sibling'] = function(list) -- reverse preceding - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local p = ll.__p__ @@ -5496,7 +7776,8 @@ apply_axis['reverse-sibling'] = function(list) -- reverse preceding for i=ll.ni-1,1,-1 do local di = d[i] if type(di) == "table" then - collected[#collected+1] = di + c = c + 1 + collected[c] = di end end end @@ -5522,7 +7803,7 @@ local function apply_nodes(list,directive,nodes) return { } end else - local collected, m, p = { }, 0, nil + local collected, c, m, p = { }, 0, 0, nil if not nns then -- only check tag for l=1,#list do local ll = list[l] @@ -5531,11 +7812,13 @@ local function apply_nodes(list,directive,nodes) if directive then if ntg == ltg then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif ntg ~= ltg then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -5547,11 +7830,13 @@ local function apply_nodes(list,directive,nodes) if directive then if lns == nns then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif lns ~= nns then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -5565,11 +7850,13 @@ local function apply_nodes(list,directive,nodes) if directive then if ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif not ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -5577,7 +7864,7 @@ local function apply_nodes(list,directive,nodes) return collected end else - local collected, m, p = { }, 0, nil + local collected, c, m, p = { }, 0, 0, nil for l=1,#list do local ll = list[l] local ltg = ll.tg @@ -5594,11 +7881,13 @@ local function apply_nodes(list,directive,nodes) if directive then if ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif not ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -5609,12 +7898,13 @@ end local quit_expression = false local function apply_expression(list,expression,order) - local collected = { } + local collected, c = { }, 0 quit_expression = false for l=1,#list do local ll = list[l] if expression(list,ll,l,order) then -- nasty, order alleen valid als n=1 - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end if quit_expression then break @@ -5653,7 +7943,9 @@ local lp_builtin = P ( P("ns") / "ll.ns" ) * ((spaces * P("(") * spaces * P(")"))/"") -local lp_attribute = (P("@") + P("attribute::")) / "" * Cc("(ll.at and ll.at['") * R("az","AZ","--","__")^1 * Cc("'])") +-- for the moment we keep namespaces with attributes + +local lp_attribute = (P("@") + P("attribute::")) / "" * Cc("(ll.at and ll.at['") * ((R("az","AZ") + S("-_:"))^1) * Cc("'])") local lp_fastpos_p = ((P("+")^0 * R("09")^1 * P(-1)) / function(s) return "l==" .. s end) local lp_fastpos_n = ((P("-") * R("09")^1 * P(-1)) / function(s) return "(" .. s .. "<0 and (#list+".. s .. "==l))" end) local lp_fastpos = lp_fastpos_n + lp_fastpos_p @@ -5714,14 +8006,12 @@ local converter = Cs ( ) cleaner = Cs ( ( ---~ lp_fastpos + lp_reserved + lp_number + lp_string + 1 )^1 ) ---~ expr local template_e = [[ local expr = xml.expressions @@ -5772,13 +8062,13 @@ local skip = { } local function errorrunner_e(str,cnv) if not skip[str] then - logs.report("lpath","error in expression: %s => %s",str,cnv) + report_lpath("error in expression: %s => %s",str,cnv) skip[str] = cnv or str end return false end local function errorrunner_f(str,arg) - logs.report("lpath","error in finalizer: %s(%s)",str,arg or "") + report_lpath("error in finalizer: %s(%s)",str,arg or "") return false end @@ -5829,7 +8119,7 @@ local special_1 = P("*") * Cc(register_auto_descendant) * Cc(register_all_nodes local special_2 = P("/") * Cc(register_auto_self) local special_3 = P("") * Cc(register_auto_self) -local parser = Ct { "patterns", -- can be made a bit faster by moving pattern outside +local pathparser = Ct { "patterns", -- can be made a bit faster by moving pattern outside patterns = spaces * V("protocol") * spaces * ( ( V("special") * spaces * P(-1) ) + @@ -5901,6 +8191,8 @@ local parser = Ct { "patterns", -- can be made a bit faster by moving pattern ou } +xmlpatterns.pathparser = pathparser + local cache = { } local function nodesettostring(set,nodetest) @@ -5910,7 +8202,7 @@ local function nodesettostring(set,nodetest) if not ns or ns == "" then ns = "*" end if not tg or tg == "" then tg = "*" end tg = (tg == "@rt@" and "[root]") or format("%s:%s",ns,tg) - t[#t+1] = (directive and tg) or format("not(%s)",tg) + t[i] = (directive and tg) or format("not(%s)",tg) end if nodetest == false then return format("not(%s)",concat(t,"|")) @@ -5929,7 +8221,7 @@ local function tagstostring(list) local ns, tg = li.ns, li.tg if not ns or ns == "" then ns = "*" end if not tg or tg == "" then tg = "*" end - t[#t+1] = (tg == "@rt@" and "[root]") or format("%s:%s",ns,tg) + t[i] = (tg == "@rt@" and "[root]") or format("%s:%s",ns,tg) end return concat(t," ") end @@ -5937,16 +8229,16 @@ end xml.nodesettostring = nodesettostring -local parse_pattern -- we have a harmless kind of circular reference +local lpath -- we have a harmless kind of circular reference + +local lshowoptions = { functions = false } local function lshow(parsed) if type(parsed) == "string" then - parsed = parse_pattern(parsed) + parsed = lpath(parsed) end - local s = table.serialize_functions -- ugly - table.serialize_functions = false -- ugly - logs.report("lpath","%s://%s => %s",parsed.protocol or xml.defaultprotocol,parsed.pattern,table.serialize(parsed,false)) - table.serialize_functions = s -- ugly + report_lpath("%s://%s => %s",parsed.protocol or xml.defaultprotocol,parsed.pattern, + table.serialize(parsed,false,lshowoptions)) end xml.lshow = lshow @@ -5960,7 +8252,7 @@ local function add_comment(p,str) end end -parse_pattern = function (pattern) -- the gain of caching is rather minimal +lpath = function (pattern) -- the gain of caching is rather minimal lpathcalls = lpathcalls + 1 if type(pattern) == "table" then return pattern @@ -5969,13 +8261,13 @@ parse_pattern = function (pattern) -- the gain of caching is rather minimal if parsed then lpathcached = lpathcached + 1 else - parsed = lpegmatch(parser,pattern) + parsed = lpegmatch(pathparser,pattern) if parsed then parsed.pattern = pattern local np = #parsed if np == 0 then parsed = { pattern = pattern, register_self, state = "parsing error" } - logs.report("lpath","parsing error in '%s'",pattern) + report_lpath("parsing error in '%s'",pattern) lshow(parsed) else -- we could have done this with a more complex parser but this @@ -6017,6 +8309,8 @@ parse_pattern = function (pattern) -- the gain of caching is rather minimal end end +xml.lpath = lpath + -- we can move all calls inline and then merge the trace back -- technically we can combine axis and the next nodes which is -- what we did before but this a bit cleaner (but slower too) @@ -6079,32 +8373,32 @@ local function traced_apply(list,parsed,nofparsed,order) if trace_lparse then lshow(parsed) end - logs.report("lpath", "collecting : %s",parsed.pattern) - logs.report("lpath", " root tags : %s",tagstostring(list)) - logs.report("lpath", " order : %s",order or "unset") + report_lpath("collecting: %s",parsed.pattern) + report_lpath("root tags : %s",tagstostring(list)) + report_lpath("order : %s",order or "unset") local collected = list for i=1,nofparsed do local pi = parsed[i] local kind = pi.kind if kind == "axis" then collected = apply_axis[pi.axis](collected) - logs.report("lpath", "% 10i : ax : %s",(collected and #collected) or 0,pi.axis) + report_lpath("% 10i : ax : %s",(collected and #collected) or 0,pi.axis) elseif kind == "nodes" then collected = apply_nodes(collected,pi.nodetest,pi.nodes) - logs.report("lpath", "% 10i : ns : %s",(collected and #collected) or 0,nodesettostring(pi.nodes,pi.nodetest)) + report_lpath("% 10i : ns : %s",(collected and #collected) or 0,nodesettostring(pi.nodes,pi.nodetest)) elseif kind == "expression" then collected = apply_expression(collected,pi.evaluator,order) - logs.report("lpath", "% 10i : ex : %s -> %s",(collected and #collected) or 0,pi.expression,pi.converted) + report_lpath("% 10i : ex : %s -> %s",(collected and #collected) or 0,pi.expression,pi.converted) elseif kind == "finalizer" then collected = pi.finalizer(collected) - logs.report("lpath", "% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pi.name,pi.arguments or "") + report_lpath("% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pi.name,pi.arguments or "") return collected end if not collected or #collected == 0 then local pn = i < nofparsed and parsed[nofparsed] if pn and pn.kind == "finalizer" then collected = pn.finalizer(collected) - logs.report("lpath", "% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pn.name,pn.arguments or "") + report_lpath("% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pn.name,pn.arguments or "") return collected end return nil @@ -6141,8 +8435,11 @@ local function normal_apply(list,parsed,nofparsed,order) return collected end -local function parse_apply(list,pattern) - -- we avoid an extra call + +local function applylpath(list,pattern) + if not list then + return + end local parsed = cache[pattern] if parsed then lpathcalls = lpathcalls + 1 @@ -6151,7 +8448,7 @@ local function parse_apply(list,pattern) lpathcalls = lpathcalls + 1 parsed = pattern else - parsed = parse_pattern(pattern) or pattern + parsed = lpath(pattern) or pattern end if not parsed then return @@ -6160,25 +8457,32 @@ local function parse_apply(list,pattern) if nofparsed == 0 then return -- something is wrong end - local one = list[1] - if not one then - return -- something is wrong - elseif not trace_lpath then - return normal_apply(list,parsed,nofparsed,one.mi) + if not trace_lpath then + return normal_apply ({ list },parsed,nofparsed,list.mi) elseif trace_lprofile then - return profiled_apply(list,parsed,nofparsed,one.mi) + return profiled_apply({ list },parsed,nofparsed,list.mi) else - return traced_apply(list,parsed,nofparsed,one.mi) + return traced_apply ({ list },parsed,nofparsed,list.mi) end end +xml.applylpath = applylpath -- takes a table as first argment, which is what xml.filter will do + +--[[ldx-- +

This is the main filter function. It returns whatever is asked for.

+--ldx]]-- + +function xml.filter(root,pattern) -- no longer funny attribute handling here + return applylpath(root,pattern) +end + -- internal (parsed) expressions.child = function(e,pattern) - return parse_apply({ e },pattern) -- todo: cache + return applylpath(e,pattern) -- todo: cache end expressions.count = function(e,pattern) - local collected = parse_apply({ e },pattern) -- todo: cache + local collected = applylpath(e,pattern) -- todo: cache return (collected and #collected) or 0 end @@ -6188,7 +8492,7 @@ expressions.oneof = function(s,...) -- slow local t = {...} for i=1,#t do if s == t[i] then return true end end return false end expressions.error = function(str) - xml.error_handler("unknown function in lpath expression",tostring(str or "?")) + xml.errorhandler("unknown function in lpath expression",tostring(str or "?")) return false end expressions.undefined = function(s) @@ -6217,8 +8521,8 @@ expressions.boolean = toboolean -- user interface local function traverse(root,pattern,handle) - logs.report("xml","use 'xml.selection' instead for '%s'",pattern) - local collected = parse_apply({ root },pattern) + report_lpath("use 'xml.selection' instead for '%s'",pattern) + local collected = applylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6229,7 +8533,7 @@ local function traverse(root,pattern,handle) end local function selection(root,pattern,handle) - local collected = parse_apply({ root },pattern) + local collected = applylpath(root,pattern) if collected then if handle then for c=1,#collected do @@ -6241,19 +8545,9 @@ local function selection(root,pattern,handle) end end -xml.parse_parser = parser -xml.parse_pattern = parse_pattern -xml.parse_apply = parse_apply xml.traverse = traverse -- old method, r, d, k xml.selection = selection -- new method, simple handle -local lpath = parse_pattern - -xml.lpath = lpath - -function xml.cached_patterns() - return cache -end -- generic function finalizer (independant namespace) @@ -6265,13 +8559,13 @@ local function dofunction(collected,fnc) f(collected[c]) end else - logs.report("xml","unknown function '%s'",fnc) + report_lpath("unknown function '%s'",fnc) end end end -xml.finalizers.xml["function"] = dofunction -xml.finalizers.tex["function"] = dofunction +finalizers.xml["function"] = dofunction +finalizers.tex["function"] = dofunction -- functions @@ -6363,14 +8657,6 @@ expressions.tag = function(e,n) -- only tg end end ---[[ldx-- -

This is the main filter function. It returns whatever is asked for.

---ldx]]-- - -function xml.filter(root,pattern) -- no longer funny attribute handling here - return parse_apply({ root },pattern) -end - --[[ldx--

Often using an iterators looks nicer in the code than passing handler functions. The book describes how to use coroutines for that @@ -6390,7 +8676,7 @@ end local wrap, yield = coroutine.wrap, coroutine.yield function xml.elements(root,pattern,reverse) -- r, d, k - local collected = parse_apply({ root },pattern) + local collected = applylpath(root,pattern) if collected then if reverse then return wrap(function() for c=#collected,1,-1 do @@ -6406,7 +8692,7 @@ function xml.elements(root,pattern,reverse) -- r, d, k end function xml.collected(root,pattern,reverse) -- e - local collected = parse_apply({ root },pattern) + local collected = applylpath(root,pattern) if collected then if reverse then return wrap(function() for c=#collected,1,-1 do yield(collected[c]) end end) @@ -6417,6 +8703,15 @@ function xml.collected(root,pattern,reverse) -- e return wrap(function() end) end +-- handy + +function xml.inspect(collection,pattern) + pattern = pattern or "." + for e in xml.collected(collection,pattern or ".") do + report_lpath("pattern %q\n\n%s\n",pattern,xml.tostring(e)) + end +end + end -- of closure @@ -6430,10 +8725,16 @@ if not modules then modules = { } end modules ['lxml-mis'] = { license = "see context related readme files" } +local xml, lpeg, string = xml, lpeg, string + local concat = table.concat local type, next, tonumber, tostring, setmetatable, loadstring = type, next, tonumber, tostring, setmetatable, loadstring local format, gsub, match = string.format, string.gsub, string.match -local lpegmatch = lpeg.match +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns +local P, S, R, C, V, Cc, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.Cc, lpeg.Cs + +lpegpatterns.xml = lpegpatterns.xml or { } +local xmlpatterns = lpegpatterns.xml --[[ldx--

The following helper functions best belong to the lxml-ini @@ -6457,9 +8758,8 @@ local function xmlgsub(t,old,new) -- will be replaced end end ---~ xml.gsub = xmlgsub -function xml.strip_leading_spaces(dk,d,k) -- cosmetic, for manual +function xml.stripleadingspaces(dk,d,k) -- cosmetic, for manual if d and k then local dkm = d[k-1] if dkm and type(dkm) == "string" then @@ -6469,14 +8769,7 @@ function xml.strip_leading_spaces(dk,d,k) -- cosmetic, for manual end end ---~ xml.escapes = { ['&'] = '&', ['<'] = '<', ['>'] = '>', ['"'] = '"' } ---~ xml.unescapes = { } for k,v in next, xml.escapes do xml.unescapes[v] = k end ---~ function xml.escaped (str) return (gsub(str,"(.)" , xml.escapes )) end ---~ function xml.unescaped(str) return (gsub(str,"(&.-;)", xml.unescapes)) end ---~ function xml.cleansed (str) return (gsub(str,"<.->" , '' )) end -- "%b<>" - -local P, S, R, C, V, Cc, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.Cc, lpeg.Cs -- 100 * 2500 * "oeps< oeps> oeps&" : gsub:lpeg|lpeg|lpeg -- @@ -6502,9 +8795,9 @@ local unescaped = Cs(normal * (special * normal)^0) local cleansed = Cs(((P("<") * (1-P(">"))^0 * P(">"))/"" + 1)^0) -xml.escaped_pattern = escaped -xml.unescaped_pattern = unescaped -xml.cleansed_pattern = cleansed +xmlpatterns.escaped = escaped +xmlpatterns.unescaped = unescaped +xmlpatterns.cleansed = cleansed function xml.escaped (str) return lpegmatch(escaped,str) end function xml.unescaped(str) return lpegmatch(unescaped,str) end @@ -6540,15 +8833,20 @@ if not modules then modules = { } end modules ['lxml-aux'] = { local trace_manipulations = false trackers.register("lxml.manipulations", function(v) trace_manipulations = v end) -local xmlparseapply, xmlconvert, xmlcopy, xmlname = xml.parse_apply, xml.convert, xml.copy, xml.name +local report_xml = logs.reporter("xml") + +local xml = xml + +local xmlconvert, xmlcopy, xmlname = xml.convert, xml.copy, xml.name local xmlinheritedconvert = xml.inheritedconvert +local xmlapplylpath = xml.applylpath -local type = type -local insert, remove = table.insert, table.remove +local type, setmetatable, getmetatable = type, setmetatable, getmetatable +local insert, remove, fastcopy = table.insert, table.remove, table.fastcopy local gmatch, gsub = string.gmatch, string.gsub local function report(what,pattern,c,e) - logs.report("xml","%s element '%s' (root: '%s', position: %s, index: %s, pattern: %s)",what,xmlname(e),xmlname(e.__p__),c,e.ni,pattern) + report_xml("%s element '%s' (root: '%s', position: %s, index: %s, pattern: %s)",what,xmlname(e),xmlname(e.__p__),c,e.ni,pattern) end local function withelements(e,handle,depth) @@ -6602,10 +8900,8 @@ function xml.withelement(e,n,handle) -- slow end end -xml.elements_only = xml.collected - -function xml.each_element(root,pattern,handle,reverse) - local collected = xmlparseapply({ root },pattern) +function xml.each(root,pattern,handle,reverse) + local collected = xmlapplylpath(root,pattern) if collected then if reverse then for c=#collected,1,-1 do @@ -6620,10 +8916,8 @@ function xml.each_element(root,pattern,handle,reverse) end end -xml.process_elements = xml.each_element - -function xml.process_attributes(root,pattern,handle) - local collected = xmlparseapply({ root },pattern) +function xml.processattributes(root,pattern,handle) + local collected = xmlapplylpath(root,pattern) if collected and handle then for c=1,#collected do handle(collected[c].at) @@ -6638,12 +8932,12 @@ end -- are these still needed -> lxml-cmp.lua -function xml.collect_elements(root, pattern) - return xmlparseapply({ root },pattern) +function xml.collect(root, pattern) + return xmlapplylpath(root,pattern) end -function xml.collect_texts(root, pattern, flatten) -- todo: variant with handle - local collected = xmlparseapply({ root },pattern) +function xml.collecttexts(root, pattern, flatten) -- todo: variant with handle + local collected = xmlapplylpath(root,pattern) if collected and flatten then local xmltostring = xml.tostring for c=1,#collected do @@ -6654,18 +8948,19 @@ function xml.collect_texts(root, pattern, flatten) -- todo: variant with handle end function xml.collect_tags(root, pattern, nonamespace) - local collected = xmlparseapply({ root },pattern) + local collected = xmlapplylpath(root,pattern) if collected then - local t = { } + local t, n = { }, 0 for c=1,#collected do local e = collected[c] local ns, tg = e.ns, e.tg + n = n + 1 if nonamespace then - t[#t+1] = tg + t[n] = tg elseif ns == "" then - t[#t+1] = tg + t[n] = tg else - t[#t+1] = ns .. ":" .. tg + t[n] = ns .. ":" .. tg end end return t @@ -6678,7 +8973,7 @@ end local no_root = { no_root = true } -function xml.redo_ni(d) +local function redo_ni(d) for k=1,#d do local dk = d[k] if type(dk) == "table" then @@ -6701,12 +8996,7 @@ local function xmltoelement(whatever,root) return whatever -- string end if element then - --~ if element.ri then - --~ element = element.dt[element.ri].dt - --~ else - --~ element = element.dt - --~ end - end + end return element end @@ -6724,8 +9014,8 @@ local function copiedelement(element,newparent) end end -function xml.delete_element(root,pattern) - local collected = xmlparseapply({ root },pattern) +function xml.delete(root,pattern) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6736,15 +9026,15 @@ function xml.delete_element(root,pattern) end local d = p.dt remove(d,e.ni) - xml.redo_ni(d) -- can be made faster and inlined + redo_ni(d) -- can be made faster and inlined end end end end -function xml.replace_element(root,pattern,whatever) +function xml.replace(root,pattern,whatever) local element = root and xmltoelement(whatever,root) - local collected = element and xmlparseapply({ root },pattern) + local collected = element and xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6755,15 +9045,50 @@ function xml.replace_element(root,pattern,whatever) end local d = p.dt d[e.ni] = copiedelement(element,p) - xml.redo_ni(d) -- probably not needed + redo_ni(d) -- probably not needed + end + end + end +end + +local function wrap(e,wrapper) + local t = { + rn = e.rn, + tg = e.tg, + ns = e.ns, + at = e.at, + dt = e.dt, + __p__ = e, + } + setmetatable(t,getmetatable(e)) + e.rn = wrapper.rn or e.rn or "" + e.tg = wrapper.tg or e.tg or "" + e.ns = wrapper.ns or e.ns or "" + e.at = fastcopy(wrapper.at) + e.dt = { t } +end + +function xml.wrap(root,pattern,whatever) + if whatever then + local wrapper = xmltoelement(whatever,root) + local collected = xmlapplylpath(root,pattern) + if collected then + for c=1,#collected do + local e = collected[c] + if trace_manipulations then + report('wrapping',pattern,c,e) + end + wrap(e,wrapper) end end + else + wrap(root,xmltoelement(pattern)) end end local function inject_element(root,pattern,whatever,prepend) local element = root and xmltoelement(whatever,root) - local collected = element and xmlparseapply({ root },pattern) + local collected = element and xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6778,15 +9103,17 @@ local function inject_element(root,pattern,whatever,prepend) else be, af = edt, cp end + local bn = #be for i=1,#af do - be[#be+1] = af[i] + bn = bn + 1 + be[bn] = af[i] end if rri then r.dt[rri].dt = be else d[k].dt = be end - xml.redo_ni(d) + redo_ni(d) end end end @@ -6794,7 +9121,7 @@ end local function insert_element(root,pattern,whatever,before) -- todo: element als functie local element = root and xmltoelement(whatever,root) - local collected = element and xmlparseapply({ root },pattern) + local collected = element and xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6804,24 +9131,23 @@ local function insert_element(root,pattern,whatever,before) -- todo: element als k = k + 1 end insert(d,k,copiedelement(element,r)) - xml.redo_ni(d) + redo_ni(d) end end end -xml.insert_element = insert_element -xml.insert_element_after = insert_element -xml.insert_element_before = function(r,p,e) insert_element(r,p,e,true) end -xml.inject_element = inject_element -xml.inject_element_after = inject_element -xml.inject_element_before = function(r,p,e) inject_element(r,p,e,true) end +xml.insert_element = insert_element +xml.insertafter = insert_element +xml.insertbefore = function(r,p,e) insert_element(r,p,e,true) end +xml.injectafter = inject_element +xml.injectbefore = function(r,p,e) inject_element(r,p,e,true) end local function include(xmldata,pattern,attribute,recursive,loaddata) -- parse="text" (default: xml), encoding="" (todo) -- attribute = attribute or 'href' pattern = pattern or 'include' loaddata = loaddata or io.loaddata - local collected = xmlparseapply({ xmldata },pattern) + local collected = xmlapplylpath(xmldata,pattern) if collected then for c=1,#collected do local ek = collected[c] @@ -6830,7 +9156,7 @@ local function include(xmldata,pattern,attribute,recursive,loaddata) local ekat = ek.at local epdt = ek.__p__.dt if not attribute or attribute == "" then - name = (type(ekdt) == "table" and ekdt[1]) or ekdt -- ckeck, probably always tab or str + name = (type(ekdt) == "table" and ekdt[1]) or ekdt -- check, probably always tab or str end if not name then for a in gmatch(attribute or "href","([^|]+)") do @@ -6845,9 +9171,6 @@ local function include(xmldata,pattern,attribute,recursive,loaddata) -- for the moment hard coded epdt[ek.ni] = xml.escaped(data) -- d[k] = xml.escaped(data) else ---~ local settings = xmldata.settings ---~ settings.parent_root = xmldata -- to be tested ---~ local xi = xmlconvert(data,settings) local xi = xmlinheritedconvert(data,xmldata) if not xi then epdt[ek.ni] = "" -- xml.empty(d,k) @@ -6864,136 +9187,88 @@ end xml.include = include ---~ local function manipulate(xmldata,pattern,manipulator) -- untested and might go away ---~ local collected = xmlparseapply({ xmldata },pattern) ---~ if collected then ---~ local xmltostring = xml.tostring ---~ for c=1,#collected do ---~ local e = collected[c] ---~ local data = manipulator(xmltostring(e)) ---~ if data == "" then ---~ epdt[e.ni] = "" ---~ else ---~ local xi = xmlinheritedconvert(data,xmldata) ---~ if not xi then ---~ epdt[e.ni] = "" ---~ else ---~ epdt[e.ni] = xml.body(xi) -- xml.assign(d,k,xi) ---~ end ---~ end ---~ end ---~ end ---~ end - ---~ xml.manipulate = manipulate - -function xml.strip_whitespace(root, pattern, nolines) -- strips all leading and trailing space ! - local collected = xmlparseapply({ root },pattern) - if collected then - for i=1,#collected do - local e = collected[i] - local edt = e.dt - if edt then - local t = { } - for i=1,#edt do - local str = edt[i] - if type(str) == "string" then - if str == "" then - -- stripped - else - if nolines then - str = gsub(str,"[ \n\r\t]+"," ") - end - if str == "" then - -- stripped - else - t[#t+1] = str - end - end +local function stripelement(e,nolines,anywhere) + local edt = e.dt + if edt then + if anywhere then + local t, n = { }, 0 + for e=1,#edt do + local str = edt[e] + if type(str) ~= "string" then + n = n + 1 + t[n] = str + elseif str ~= "" then + -- todo: lpeg for each case + if nolines then + str = gsub(str,"%s+"," ") + end + str = gsub(str,"^%s*(.-)%s*$","%1") + if str ~= "" then + n = n + 1 + t[n] = str + end + end + end + e.dt = t + else + -- we can assume a regular sparse xml table with no successive strings + -- otherwise we should use a while loop + if #edt > 0 then + -- strip front + local str = edt[1] + if type(str) ~= "string" then + -- nothing + elseif str == "" then + remove(edt,1) + else + if nolines then + str = gsub(str,"%s+"," ") + end + str = gsub(str,"^%s+","") + if str == "" then + remove(edt,1) + else + edt[1] = str + end + end + end + local nedt = #edt + if nedt > 0 then + -- strip end + local str = edt[nedt] + if type(str) ~= "string" then + -- nothing + elseif str == "" then + remove(edt) + else + if nolines then + str = gsub(str,"%s+"," ") + end + str = gsub(str,"%s+$","") + if str == "" then + remove(edt) else - --~ str.ni = i - t[#t+1] = str + edt[nedt] = str end end - e.dt = t end end end + return e -- convenient end -function xml.strip_whitespace(root, pattern, nolines, anywhere) -- strips all leading and trailing spacing - local collected = xmlparseapply({ root },pattern) -- beware, indices no longer are valid now +xml.stripelement = stripelement + +function xml.strip(root,pattern,nolines,anywhere) -- strips all leading and trailing spacing + local collected = xmlapplylpath(root,pattern) -- beware, indices no longer are valid now if collected then for i=1,#collected do - local e = collected[i] - local edt = e.dt - if edt then - if anywhere then - local t = { } - for e=1,#edt do - local str = edt[e] - if type(str) ~= "string" then - t[#t+1] = str - elseif str ~= "" then - -- todo: lpeg for each case - if nolines then - str = gsub(str,"%s+"," ") - end - str = gsub(str,"^%s*(.-)%s*$","%1") - if str ~= "" then - t[#t+1] = str - end - end - end - e.dt = t - else - -- we can assume a regular sparse xml table with no successive strings - -- otherwise we should use a while loop - if #edt > 0 then - -- strip front - local str = edt[1] - if type(str) ~= "string" then - -- nothing - elseif str == "" then - remove(edt,1) - else - if nolines then - str = gsub(str,"%s+"," ") - end - str = gsub(str,"^%s+","") - if str == "" then - remove(edt,1) - else - edt[1] = str - end - end - end - if #edt > 1 then - -- strip end - local str = edt[#edt] - if type(str) ~= "string" then - -- nothing - elseif str == "" then - remove(edt) - else - if nolines then - str = gsub(str,"%s+"," ") - end - str = gsub(str,"%s+$","") - if str == "" then - remove(edt) - else - edt[#edt] = str - end - end - end - end - end + stripelement(collected[i],nolines,anywhere) end end end -local function rename_space(root, oldspace, newspace) -- fast variant +local function renamespace(root, oldspace, newspace) -- fast variant local ndt = #root.dt for i=1,ndt or 0 do local e = root[i] @@ -7006,16 +9281,16 @@ local function rename_space(root, oldspace, newspace) -- fast variant end local edt = e.dt if edt then - rename_space(edt, oldspace, newspace) + renamespace(edt, oldspace, newspace) end end end end -xml.rename_space = rename_space +xml.renamespace = renamespace -function xml.remap_tag(root, pattern, newtg) - local collected = xmlparseapply({ root },pattern) +function xml.remaptag(root, pattern, newtg) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do collected[c].tg = newtg @@ -7023,8 +9298,8 @@ function xml.remap_tag(root, pattern, newtg) end end -function xml.remap_namespace(root, pattern, newns) - local collected = xmlparseapply({ root },pattern) +function xml.remapnamespace(root, pattern, newns) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do collected[c].ns = newns @@ -7032,8 +9307,8 @@ function xml.remap_namespace(root, pattern, newns) end end -function xml.check_namespace(root, pattern, newns) - local collected = xmlparseapply({ root },pattern) +function xml.checknamespace(root, pattern, newns) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -7044,8 +9319,8 @@ function xml.check_namespace(root, pattern, newns) end end -function xml.remap_name(root, pattern, newtg, newns, newrn) - local collected = xmlparseapply({ root },pattern) +function xml.remapname(root, pattern, newtg, newns, newrn) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -7058,18 +9333,34 @@ end

Here are a few synonyms.

--ldx]]-- -xml.each = xml.each_element -xml.process = xml.process_element -xml.strip = xml.strip_whitespace -xml.collect = xml.collect_elements -xml.all = xml.collect_elements - -xml.insert = xml.insert_element_after -xml.inject = xml.inject_element_after -xml.after = xml.insert_element_after -xml.before = xml.insert_element_before -xml.delete = xml.delete_element -xml.replace = xml.replace_element +xml.all = xml.each +xml.insert = xml.insertafter +xml.inject = xml.injectafter +xml.after = xml.insertafter +xml.before = xml.insertbefore +xml.process = xml.each + +-- obsolete + +xml.obsolete = xml.obsolete or { } +local obsolete = xml.obsolete + +xml.strip_whitespace = xml.strip obsolete.strip_whitespace = xml.strip +xml.collect_elements = xml.collect obsolete.collect_elements = xml.collect +xml.delete_element = xml.delete obsolete.delete_element = xml.delete +xml.replace_element = xml.replace obsolete.replace_element = xml.replacet +xml.each_element = xml.each obsolete.each_element = xml.each +xml.process_elements = xml.process obsolete.process_elements = xml.process +xml.insert_element_after = xml.insertafter obsolete.insert_element_after = xml.insertafter +xml.insert_element_before = xml.insertbefore obsolete.insert_element_before = xml.insertbefore +xml.inject_element_after = xml.injectafter obsolete.inject_element_after = xml.injectafter +xml.inject_element_before = xml.injectbefore obsolete.inject_element_before = xml.injectbefore +xml.process_attributes = xml.processattributes obsolete.process_attributes = xml.processattributes +xml.collect_texts = xml.collecttexts obsolete.collect_texts = xml.collecttexts +xml.inject_element = xml.inject obsolete.inject_element = xml.inject +xml.remap_tag = xml.remaptag obsolete.remap_tag = xml.remaptag +xml.remap_name = xml.remapname obsolete.remap_name = xml.remapname +xml.remap_namespace = xml.remapnamespace obsolete.remap_namespace = xml.remapnamespace end -- of closure @@ -7084,10 +9375,15 @@ if not modules then modules = { } end modules ['lxml-xml'] = { license = "see context related readme files" } +local concat = string.concat + +local xml = xml + local finalizers = xml.finalizers.xml local xmlfilter = xml.filter -- we could inline this one for speed local xmltostring = xml.tostring local xmlserialize = xml.serialize +local xmlcollected = xml.collected local function first(collected) -- wrong ? return collected and collected[1] @@ -7101,15 +9397,8 @@ local function all(collected) return collected end -local function reverse(collected) - if collected then - local reversed = { } - for c=#collected,1,-1 do - reversed[#reversed+1] = collected[c] - end - return reversed - end -end + +local reverse = table.reversed local function attribute(collected,name) if collected and #collected > 0 then @@ -7200,11 +9489,12 @@ end local function texts(collected) if collected then - local t = { } + local t, n = { }, 0 for c=1,#collected do - local e = collection[c] + local e = collected[c] if e and e.dt then - t[#t+1] = e.dt + n = n + 1 + t[n] = e.dt end end return t @@ -7247,14 +9537,15 @@ end local function tags(collected,nonamespace) if collected then - local t = { } + local t, n = { }, 0 for c=1,#collected do local e = collected[c] local ns, tg = e.ns, e.tg + n = n + 1 if nonamespace or ns == "" then - t[#t+1] = tg + t[n] = tg else - t[#t+1] = ns .. ":" .. tg + t[n] = ns .. ":" .. tg end end return t @@ -7365,1812 +9656,1937 @@ xml.all = xml.filter xml.index = xml.position xml.found = xml.filter +-- a nice one: + +local function totable(x) + local t = { } + for e in xmlcollected(x[1] or x,"/*") do + t[e.tg] = xmltostring(e.dt) or "" + end + return next(t) and t or nil +end + +xml.table = totable +finalizers.table = totable + +local function textonly(e,t) + if e then + local edt = e.dt + if edt then + for i=1,#edt do + local e = edt[i] + if type(e) == "table" then + textonly(e,t) + else + t[#t+1] = e + end + end + end + end + return t +end + +function xml.textonly(e) -- no pattern + return concat(textonly(e,{})) +end + end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['luat-env'] = { +if not modules then modules = { } end modules ['data-ini'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" + license = "see context related readme files", } --- A former version provided functionality for non embeded core --- scripts i.e. runtime library loading. Given the amount of --- Lua code we use now, this no longer makes sense. Much of this --- evolved before bytecode arrays were available and so a lot of --- code has disappeared already. +local gsub, find, gmatch = string.gsub, string.find, string.gmatch +local concat = table.concat +local next, type = next, type -local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local filedirname, filebasename, fileextname, filejoin = file.dirname, file.basename, file.extname, file.join -local format, sub, match, gsub, find = string.format, string.sub, string.match, string.gsub, string.find -local unquote, quote = string.unquote, string.quote +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_detail = false trackers.register("resolvers.details", function(v) trace_detail = v end) +local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end) --- precautions +local report_initialization = logs.reporter("resolvers","initialization") -os.setlocale(nil,nil) -- useless feature and even dangerous in luatex +local ostype, osname, ossetenv, osgetenv = os.type, os.name, os.setenv, os.getenv -function os.setlocale() - -- no way you can mess with it -end +-- The code here used to be part of a data-res but for convenience +-- we now split it over multiple files. As this file is now the +-- starting point we introduce resolvers here. --- dirty tricks +resolvers = resolvers or { } +local resolvers = resolvers + +-- We don't want the kpse library to kick in. Also, we want to be able to +-- execute programs. Control over execution is implemented later. + +texconfig.kpse_init = false +texconfig.shell_escape = 't' + +kpse = { original = kpse } + +setmetatable(kpse, { + __index = function(kp,name) + report_initialization("fatal error: kpse library is accessed (key: %s)",name) + os.exit() + end +} ) + +-- First we check a couple of environment variables. Some might be +-- set already but we need then later on. We start with the system +-- font path. + +do + + local osfontdir = osgetenv("OSFONTDIR") + + if osfontdir and osfontdir ~= "" then + -- ok + elseif osname == "windows" then + ossetenv("OSFONTDIR","c:/windows/fonts//") + elseif osname == "macosx" then + ossetenv("OSFONTDIR","$HOME/Library/Fonts//;/Library/Fonts//;/System/Library/Fonts//") + end -if arg and (arg[0] == 'luatex' or arg[0] == 'luatex.exe') and arg[1] == "--luaonly" then - arg[-1]=arg[0] arg[0]=arg[2] for k=3,#arg do arg[k-2]=arg[k] end arg[#arg]=nil arg[#arg]=nil end -if profiler and os.env["MTX_PROFILE_RUN"] == "YES" then - profiler.start("luatex-profile.log") +-- Next comes the user's home path. We need this as later on we have +-- to replace ~ with its value. + +do + + local homedir = osgetenv(ostype == "windows" and 'USERPROFILE' or 'HOME') or '' + + if not homedir or homedir == "" then + homedir = string.char(127) -- we need a value, later we wil trigger on it + end + + homedir = file.collapsepath(homedir) + + ossetenv("HOME", homedir) -- can be used in unix cnf files + ossetenv("USERPROFILE",homedir) -- can be used in windows cnf files + + environment.homedir = homedir + end --- environment +-- The following code sets the name of the own binary and its +-- path. This is fallback code as we have os.selfdir now. -environment = environment or { } -environment.arguments = { } -environment.files = { } -environment.sortedflags = nil +do -if not environment.jobname or environment.jobname == "" then if tex then environment.jobname = tex.jobname end end -if not environment.version or environment.version == "" then environment.version = "unknown" end -if not environment.jobname then environment.jobname = "unknown" end + local args = environment.originalarguments or arg -- this needs a cleanup -function environment.initialize_arguments(arg) - local arguments, files = { }, { } - environment.arguments, environment.files, environment.sortedflags = arguments, files, nil - for index=1,#arg do - local argument = arg[index] - if index > 0 then - local flag, value = match(argument,"^%-+(.-)=(.-)$") - if flag then - arguments[flag] = unquote(value or "") - else - flag = match(argument,"^%-+(.+)") - if flag then - arguments[flag] = true - else - files[#files+1] = argument + local ownbin = environment.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex" + local ownpath = environment.ownpath or os.selfdir + + ownbin = file.collapsepath(ownbin) + ownpath = file.collapsepath(ownpath) + + if not ownpath or ownpath == "" or ownpath == "unset" then + ownpath = args[-1] or arg[-1] + ownpath = ownpath and filedirname(gsub(ownpath,"\\","/")) + if not ownpath or ownpath == "" then + ownpath = args[-0] or arg[-0] + ownpath = ownpath and filedirname(gsub(ownpath,"\\","/")) + end + local binary = ownbin + if not ownpath or ownpath == "" then + ownpath = ownpath and filedirname(binary) + end + if not ownpath or ownpath == "" then + if os.binsuffix ~= "" then + binary = file.replacesuffix(binary,os.binsuffix) + end + local path = osgetenv("PATH") + if path then + for p in gmatch(path,"[^"..io.pathseparator.."]+") do + local b = filejoin(p,binary) + if lfs.isfile(b) then + -- we assume that after changing to the path the currentdir function + -- resolves to the real location and use this side effect here; this + -- trick is needed because on the mac installations use symlinks in the + -- path instead of real locations + local olddir = lfs.currentdir() + if lfs.chdir(p) then + local pp = lfs.currentdir() + if trace_locating and p ~= pp then + report_initialization("following symlink '%s' to '%s'",p,pp) + end + ownpath = pp + lfs.chdir(olddir) + else + if trace_locating then + report_initialization("unable to check path '%s'",p) + end + ownpath = p + end + break + end end end end + if not ownpath or ownpath == "" then + ownpath = "." + report_initialization("forcing fallback ownpath .") + elseif trace_locating then + report_initialization("using ownpath '%s'",ownpath) + end end - environment.ownname = environment.ownname or arg[0] or 'unknown.lua' + + environment.ownbin = ownbin + environment.ownpath = ownpath + end -function environment.setargument(name,value) - environment.arguments[name] = value +resolvers.ownpath = environment.ownpath + +function resolvers.getownpath() + return environment.ownpath end --- todo: defaults, better checks e.g on type (boolean versus string) --- --- tricky: too many hits when we support partials unless we add --- a registration of arguments so from now on we have 'partial' +-- The self variables permit us to use only a few (or even no) +-- environment variables. -function environment.argument(name,partial) - local arguments, sortedflags = environment.arguments, environment.sortedflags - if arguments[name] then - return arguments[name] - elseif partial then - if not sortedflags then - sortedflags = table.sortedkeys(arguments) - for k=1,#sortedflags do - sortedflags[k] = "^" .. sortedflags[k] - end - environment.sortedflags = sortedflags - end - -- example of potential clash: ^mode ^modefile - for k=1,#sortedflags do - local v = sortedflags[k] - if find(name,v) then - return arguments[sub(v,2,#v)] - end - end +do + + local ownpath = environment.ownpath or dir.current() + + if ownpath then + ossetenv('SELFAUTOLOC', file.collapsepath(ownpath)) + ossetenv('SELFAUTODIR', file.collapsepath(ownpath .. "/..")) + ossetenv('SELFAUTOPARENT', file.collapsepath(ownpath .. "/../..")) + else + report_initialization("error: unable to locate ownpath") + os.exit() end - return nil + end -environment.argument("x",true) +-- The running os: -function environment.split_arguments(separator) -- rather special, cut-off before separator - local done, before, after = false, { }, { } - local original_arguments = environment.original_arguments - for k=1,#original_arguments do - local v = original_arguments[k] - if not done and v == separator then - done = true - elseif done then - after[#after+1] = v - else - before[#before+1] = v - end - end - return before, after +-- todo: check is context sits here os.platform is more trustworthy +-- that the bin check as mtx-update runs from another path + +local texos = environment.texos or osgetenv("TEXOS") +local texmfos = environment.texmfos or osgetenv('SELFAUTODIR') + +if not texos or texos == "" then + texos = file.basename(texmfos) end -function environment.reconstruct_commandline(arg,noquote) - arg = arg or environment.original_arguments - if noquote and #arg == 1 then - local a = arg[1] - a = resolvers.resolve(a) - a = unquote(a) - return a - elseif #arg > 0 then - local result = { } - for i=1,#arg do - local a = arg[i] - a = resolvers.resolve(a) - a = unquote(a) - a = gsub(a,'"','\\"') -- tricky - if find(a," ") then - result[#result+1] = quote(a) - else - result[#result+1] = a - end - end - return table.join(result," ") - else - return "" +ossetenv('TEXMFOS', texmfos) -- full bin path +ossetenv('TEXOS', texos) -- partial bin parent +ossetenv('SELFAUTOSYSTEM',os.platform) -- bonus + +environment.texos = texos +environment.texmfos = texmfos + +-- The current root: + +local texroot = environment.texroot or osgetenv("TEXROOT") + +if not texroot or texroot == "" then + texroot = osgetenv('SELFAUTOPARENT') + ossetenv('TEXROOT',texroot) +end + +environment.texroot = file.collapsepath(texroot) + +-- Tracing. Todo ... + +function resolvers.settrace(n) -- no longer number but: 'locating' or 'detail' + if n then + trackers.disable("resolvers.*") + trackers.enable("resolvers."..n) end end -if arg then +resolvers.settrace(osgetenv("MTX_INPUT_TRACE")) + +-- todo: + +-- if profiler and osgetenv("MTX_PROFILE_RUN") == "YES" then +-- profiler.start("luatex-profile.log") +-- end + +-- a forward definition + +if not resolvers.resolve then + function resolvers.resolve (s) return s end + function resolvers.unresolve(s) return s end + function resolvers.repath (s) return s end +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-exp'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +local format, find, gmatch, lower = string.format, string.find, string.gmatch, string.lower +local concat, sort = table.concat, table.sort +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns +local Ct, Cs, Cc, P, C, S = lpeg.Ct, lpeg.Cs, lpeg.Cc, lpeg.P, lpeg.C, lpeg.S +local type, next = type, next - -- new, reconstruct quoted snippets (maybe better just remove the " then and add them later) - local newarg, instring = { }, false +local ostype = os.type +local collapsepath = file.collapsepath - for index=1,#arg do - local argument = arg[index] - if find(argument,"^\"") then - newarg[#newarg+1] = gsub(argument,"^\"","") - if not find(argument,"\"$") then - instring = true - end - elseif find(argument,"\"$") then - newarg[#newarg] = newarg[#newarg] .. " " .. gsub(argument,"\"$","") - instring = false - elseif instring then - newarg[#newarg] = newarg[#newarg] .. " " .. argument - else - newarg[#newarg+1] = argument - end - end - for i=1,-5,-1 do - newarg[i] = arg[i] - end +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end) - environment.initialize_arguments(newarg) - environment.original_arguments = newarg - environment.raw_arguments = arg +local report_expansions = logs.reporter("resolvers","expansions") - arg = { } -- prevent duplicate handling +local resolvers = resolvers -end +-- As this bit of code is somewhat special it gets its own module. After +-- all, when working on the main resolver code, I don't want to scroll +-- past this every time. See data-obs.lua for the gsub variant. --- weird place ... depends on a not yet loaded module +-- {a,b,c,d} +-- a,b,c/{p,q,r},d +-- a,b,c/{p,q,r}/d/{x,y,z}// +-- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} +-- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} +-- a{b,c}{d,e}f +-- {a,b,c,d} +-- {a,b,c/{p,q,r},d} +-- {a,b,c/{p,q,r}/d/{x,y,z}//} +-- {a,b,c/{p,q/{x,y,z}},d/{p,q,r}} +-- {a,b,c/{p,q/{x,y,z},w}v,d/{p,q,r}} +-- {$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c} -function environment.texfile(filename) - return resolvers.find_file(filename,'tex') +local function f_first(a,b) + local t, n = { }, 0 + for s in gmatch(b,"[^,]+") do + n = n + 1 ; t[n] = a .. s + end + return concat(t,",") end -function environment.luafile(filename) - local resolved = resolvers.find_file(filename,'tex') or "" - if resolved ~= "" then - return resolved +local function f_second(a,b) + local t, n = { }, 0 + for s in gmatch(a,"[^,]+") do + n = n + 1 ; t[n] = s .. b end - resolved = resolvers.find_file(filename,'texmfscripts') or "" - if resolved ~= "" then - return resolved + return concat(t,",") +end + +local function f_both(a,b) + local t, n = { }, 0 + for sa in gmatch(a,"[^,]+") do + for sb in gmatch(b,"[^,]+") do + n = n + 1 ; t[n] = sa .. sb + end end - return resolvers.find_file(filename,'luatexlibs') or "" + return concat(t,",") end -environment.loadedluacode = loadfile -- can be overloaded +local left = P("{") +local right = P("}") +local var = P((1 - S("{}" ))^0) +local set = P((1 - S("{},"))^0) +local other = P(1) ---~ function environment.loadedluacode(name) ---~ if os.spawn("texluac -s -o texluac.luc " .. name) == 0 then ---~ local chunk = loadstring(io.loaddata("texluac.luc")) ---~ os.remove("texluac.luc") ---~ return chunk ---~ else ---~ environment.loadedluacode = loadfile -- can be overloaded ---~ return loadfile(name) ---~ end ---~ end - -function environment.luafilechunk(filename) -- used for loading lua bytecode in the format - filename = file.replacesuffix(filename, "lua") - local fullname = environment.luafile(filename) - if fullname and fullname ~= "" then - if trace_locating then - logs.report("fileio","loading file %s", fullname) +local l_first = Cs( ( Cc("{") * (C(set) * left * C(var) * right / f_first) * Cc("}") + other )^0 ) +local l_second = Cs( ( Cc("{") * (left * C(var) * right * C(set) / f_second) * Cc("}") + other )^0 ) +local l_both = Cs( ( Cc("{") * (left * C(var) * right * left * C(var) * right / f_both) * Cc("}") + other )^0 ) +local l_rest = Cs( ( left * var * (left/"") * var * (right/"") * var * right + other )^0 ) + +local stripper_1 = lpeg.stripper ("{}@") +local replacer_1 = lpeg.replacer { { ",}", ",@}" }, { "{,", "{@," }, } + +local function splitpathexpr(str, newlist, validate) -- I couldn't resist lpegging it (nice exercise). + if trace_expansions then + report_expansions("expanding variable '%s'",str) + end + local t, ok, done = newlist or { }, false, false + local n = #t + str = lpegmatch(replacer_1,str) + repeat local old = str + repeat local old = str ; str = lpegmatch(l_first, str) until old == str + repeat local old = str ; str = lpegmatch(l_second,str) until old == str + repeat local old = str ; str = lpegmatch(l_both, str) until old == str + repeat local old = str ; str = lpegmatch(l_rest, str) until old == str + until old == str -- or not find(str,"{") + str = lpegmatch(stripper_1,str) + if validate then + for s in gmatch(str,"[^,]+") do + s = validate(s) + if s then + n = n + 1 ; t[n] = s + end end - return environment.loadedluacode(fullname) else - if trace_locating then - logs.report("fileio","unknown file %s", filename) + for s in gmatch(str,"[^,]+") do + n = n + 1 ; t[n] = s + end + end + if trace_expansions then + for k=1,#t do + report_expansions("% 4i: %s",k,t[k]) end - return nil end + return t end --- the next ones can use the previous ones / combine +-- We could make the previous one public. -function environment.loadluafile(filename, version) - local lucname, luaname, chunk - local basename = file.removesuffix(filename) - if basename == filename then - lucname, luaname = basename .. ".luc", basename .. ".lua" - else - lucname, luaname = nil, basename -- forced suffix - end - -- when not overloaded by explicit suffix we look for a luc file first - local fullname = (lucname and environment.luafile(lucname)) or "" - if fullname ~= "" then - if trace_locating then - logs.report("fileio","loading %s", fullname) - end - chunk = loadfile(fullname) -- this way we don't need a file exists check +local function validate(s) + s = collapsepath(s) -- already keeps the // + return s ~= "" and not find(s,"^!*unset/*$") and s +end + +resolvers.validatedpath = validate -- keeps the trailing // + +function resolvers.expandedpathfromlist(pathlist) + local newlist = { } + for k=1,#pathlist do + splitpathexpr(pathlist[k],newlist,validate) end - if chunk then - assert(chunk)() - if version then - -- we check of the version number of this chunk matches - local v = version -- can be nil - if modules and modules[filename] then - v = modules[filename].version -- new method - elseif versions and versions[filename] then - v = versions[filename] -- old method + return newlist +end + +local cleanup = lpeg.replacer { + { "!" , "" }, + { "\\" , "/" }, +} + +local homedir + +function resolvers.cleanpath(str) + if not homedir then + homedir = lpegmatch(cleanup,environment.homedir or "") + if homedir == string.char(127) or homedir == "" or not lfs.isdir(homedir) then + if trace_expansions then + report_expansions("no home dir set, ignoring dependent paths") end - if v == version then - return true - else - if trace_locating then - logs.report("fileio","version mismatch for %s: lua=%s, luc=%s", filename, v, version) + function resolvers.cleanpath(str) + if find(str,"~") then + return "" -- special case + else + return str and lpegmatch(cleanup,str) end - environment.loadluafile(filename) end else - return true - end - end - fullname = (luaname and environment.luafile(luaname)) or "" - if fullname ~= "" then - if trace_locating then - logs.report("fileio","loading %s", fullname) - end - chunk = loadfile(fullname) -- this way we don't need a file exists check - if not chunk then - if trace_locating then - logs.report("fileio","unknown file %s", filename) + cleanup = lpeg.replacer { + { "!" , "" }, + { "\\" , "/" }, + { "~" , homedir }, + } + function resolvers.cleanpath(str) + return str and lpegmatch(cleanup,str) end - else - assert(chunk)() - return true end end - return false + return resolvers.cleanpath(str) end +-- This one strips quotes and funny tokens. -end -- of closure - -do -- create closure to overcome 200 locals limit +local expandhome = P("~") / "$HOME" -- environment.homedir -if not modules then modules = { } end modules ['trac-inf'] = { - version = 1.001, - comment = "companion to trac-inf.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} +local dodouble = P('"')/"" * (expandhome + (1 - P('"')))^0 * P('"')/"" +local dosingle = P("'")/"" * (expandhome + (1 - P("'")))^0 * P("'")/"" +local dostring = (expandhome + 1 )^0 -local format = string.format +local stripper = Cs( + lpegpatterns.unspacer * (dosingle + dodouble + dostring) * lpegpatterns.unspacer +) -local statusinfo, n, registered = { }, 0, { } +function resolvers.checkedvariable(str) -- assumes str is a string + return lpegmatch(stripper,str) or str +end -statistics = statistics or { } +-- The path splitter: -statistics.enable = true -statistics.threshold = 0.05 +-- A config (optionally) has the paths split in tables. Internally +-- we join them and split them after the expansion has taken place. This +-- is more convenient. --- timing functions +local cache = { } -local clock = os.gettimeofday or os.clock +---- splitter = Ct(lpeg.splitat(S(ostype == "windows" and ";" or ":;"))) -- maybe add , +local splitter = Ct(lpeg.splitat(";")) -- as we move towards urls, prefixes and use tables we no longer do : -local notimer +local backslashswapper = lpeg.replacer("\\","/") -function statistics.hastimer(instance) - return instance and instance.starttime +local function splitconfigurationpath(str) -- beware, this can be either a path or a { specification } + if str then + local found = cache[str] + if not found then + if str == "" then + found = { } + else + local split = lpegmatch(splitter,lpegmatch(backslashswapper,str)) -- can be combined + found = { } + local noffound = 0 + for i=1,#split do + local s = split[i] + if not find(s,"^{*unset}*") then + noffound = noffound + 1 + found[noffound] = s + end + end + if trace_expansions then + report_expansions("splitting path specification '%s'",str) + for k=1,noffound do + report_expansions("% 4i: %s",k,found[k]) + end + end + cache[str] = found + end + end + return found + end end -function statistics.resettiming(instance) - if not instance then - notimer = { timing = 0, loadtime = 0 } +resolvers.splitconfigurationpath = splitconfigurationpath + +function resolvers.splitpath(str) + if type(str) == 'table' then + return str else - instance.timing, instance.loadtime = 0, 0 + return splitconfigurationpath(str) end end -function statistics.starttiming(instance) - if not instance then - notimer = { } - instance = notimer - end - local it = instance.timing - if not it then - it = 0 - end - if it == 0 then - instance.starttime = clock() - if not instance.loadtime then - instance.loadtime = 0 - end +function resolvers.joinpath(str) + if type(str) == 'table' then + return file.joinpath(str) else ---~ logs.report("system","nested timing (%s)",tostring(instance)) + return str end - instance.timing = it + 1 end -function statistics.stoptiming(instance, report) - if not instance then - instance = notimer - end - if instance then - local it = instance.timing - if it > 1 then - instance.timing = it - 1 - else - local starttime = instance.starttime - if starttime then - local stoptime = clock() - local loadtime = stoptime - starttime - instance.stoptime = stoptime - instance.loadtime = instance.loadtime + loadtime - if report then - statistics.report("load time %0.3f",loadtime) +-- The next function scans directories and returns a hash where the +-- entries are either strings or tables. + +-- starting with . or .. etc or funny char + + + + +local weird = P(".")^1 + lpeg.anywhere(S("~`!#$%^&*()={}[]:;\"\'||<>,?\n\r\t")) + +local attributes, directory = lfs.attributes, lfs.dir + +local function scan(files,spec,path,n,m,r) + local full = (path == "" and spec) or (spec .. path .. '/') + local dirs, nofdirs = { }, 0 + for name in directory(full) do + if not lpegmatch(weird,name) then + local mode = attributes(full..name,'mode') + if mode == 'file' then + n = n + 1 + local f = files[name] + if f then + if type(f) == 'string' then + files[name] = { f, path } + else + f[#f+1] = path + end + else -- probably unique anyway + files[name] = path + local lower = lower(name) + if name ~= lower then + files["remap:"..lower] = name + r = r + 1 + end + end + elseif mode == 'directory' then + m = m + 1 + nofdirs = nofdirs + 1 + if path ~= "" then + dirs[nofdirs] = path..'/'..name + else + dirs[nofdirs] = name end - instance.timing = 0 - return loadtime end end end - return 0 -end - -function statistics.elapsedtime(instance) - if not instance then - instance = notimer + if nofdirs > 0 then + sort(dirs) + for i=1,nofdirs do + files, n, m, r = scan(files,spec,dirs[i],n,m,r) + end end - return format("%0.3f",(instance and instance.loadtime) or 0) + return files, n, m, r end -function statistics.elapsedindeed(instance) - if not instance then - instance = notimer +function resolvers.scanfiles(path,branch) + if trace_locating then + report_expansions("scanning path '%s', branch '%s'",path, branch or path) + end + local realpath = resolvers.resolve(path) -- no shortcut + local files, n, m, r = scan({ },realpath .. '/',"",0,0,0) + files.__path__ = path -- can be selfautoparent:texmf-whatever + files.__files__ = n + files.__directories__ = m + files.__remappings__ = r + if trace_locating then + report_expansions("%s files found on %s directories with %s uppercase remappings",n,m,r) end - local t = (instance and instance.loadtime) or 0 - return t > statistics.threshold + return files end -function statistics.elapsedseconds(instance,rest) -- returns nil if 0 seconds - if statistics.elapsedindeed(instance) then - return format("%s seconds %s", statistics.elapsedtime(instance),rest or "") - end -end --- general function -function statistics.register(tag,fnc) - if statistics.enable and type(fnc) == "function" then - local rt = registered[tag] or (#statusinfo + 1) - statusinfo[rt] = { tag, fnc } - registered[tag] = rt - if #tag > n then n = #tag end - end -end +end -- of closure -function statistics.show(reporter) - if statistics.enable then - if not reporter then reporter = function(tag,data,n) texio.write_nl(tag .. " " .. data) end end - -- this code will move - local register = statistics.register - register("luatex banner", function() - return string.lower(status.banner) - end) - register("control sequences", function() - return format("%s of %s", status.cs_count, status.hash_size+status.hash_extra) - end) - register("callbacks", function() - local total, indirect = status.callbacks or 0, status.indirect_callbacks or 0 - return format("direct: %s, indirect: %s, total: %s", total-indirect, indirect, total) - end) - register("current memory usage", statistics.memused) - register("runtime",statistics.runtime) --- -- - for i=1,#statusinfo do - local s = statusinfo[i] - local r = s[2]() - if r then - reporter(s[1],r,n) +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-env'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +local lower, gsub = string.lower, string.gsub + +local resolvers = resolvers + +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex +local fileextname = file.extname + +local formats = allocate() +local suffixes = allocate() +local dangerous = allocate() +local suffixmap = allocate() + +resolvers.formats = formats +resolvers.suffixes = suffixes +resolvers.dangerous = dangerous +resolvers.suffixmap = suffixmap + +local relations = allocate { -- todo: handlers also here + core = { + ofm = { -- will become obsolete + names = { "ofm", "omega font metric", "omega font metrics" }, + variable = 'OFMFONTS', + suffixes = { 'ofm', 'tfm' }, + }, + ovf = { -- will become obsolete + names = { "ovf", "omega virtual font", "omega virtual fonts" }, + variable = 'OVFFONTS', + suffixes = { 'ovf', 'vf' }, + }, + tfm = { + names = { "tfm", "tex font metric", "tex font metrics" }, + variable = 'TFMFONTS', + suffixes = { 'tfm' }, + }, + vf = { + names = { "vf", "virtual font", "virtual fonts" }, + variable = 'VFFONTS', + suffixes = { 'vf' }, + }, + otf = { + names = { "otf", "opentype", "opentype font", "opentype fonts"}, + variable = 'OPENTYPEFONTS', + suffixes = { 'otf' }, + }, + ttf = { + names = { "ttf", "truetype", "truetype font", "truetype fonts", "truetype collection", "truetype collections", "truetype dictionary", "truetype dictionaries" }, + variable = 'TTFONTS', + suffixes = { 'ttf', 'ttc', 'dfont' }, + }, + afm = { + names = { "afm", "adobe font metric", "adobe font metrics" }, + variable = "AFMFONTS", + suffixes = { "afm" }, + }, + pfb = { + names = { "pfb", "type1", "type 1", "type1 font", "type 1 font", "type1 fonts", "type 1 fonts" }, + variable = 'T1FONTS', + suffixes = { 'pfb', 'pfa' }, + }, + fea = { + names = { "fea", "font feature", "font features", "font feature file", "font feature files" }, + variable = 'FONTFEATURES', + suffixes = { 'fea' }, + }, + cid = { + names = { "cid", "cid map", "cid maps", "cid file", "cid files" }, + variable = 'FONTCIDMAPS', + suffixes = { 'cid', 'cidmap' }, + }, + fmt = { + names = { "fmt", "format", "tex format" }, + variable = 'TEXFORMATS', + suffixes = { 'fmt' }, + }, + mem = { -- will become obsolete + names = { 'mem', "metapost format" }, + variable = 'MPMEMS', + suffixes = { 'mem' }, + }, + mp = { + names = { "mp" }, + variable = 'MPINPUTS', + suffixes = { 'mp' }, + }, + tex = { + names = { "tex" }, + variable = 'TEXINPUTS', + suffixes = { 'tex', "mkiv", "mkiv", "mkii" }, + }, + icc = { + names = { "icc", "icc profile", "icc profiles" }, + variable = 'ICCPROFILES', + suffixes = { 'icc' }, + }, + texmfscripts = { + names = { "texmfscript", "texmfscripts", "script", "scripts" }, + variable = 'TEXMFSCRIPTS', + suffixes = { 'rb', 'pl', 'py' }, + }, + lua = { + names = { "lua" }, + variable = 'LUAINPUTS', + suffixes = { 'lua', 'luc', 'tma', 'tmc' }, + }, + lib = { + names = { "lib" }, + variable = 'CLUAINPUTS', + suffixes = os.libsuffix and { os.libsuffix } or { 'dll', 'so' }, + }, + bib = { + names = { 'bib' }, + suffixes = { 'bib' }, + }, + bst = { + names = { 'bst' }, + suffixes = { 'bst' }, + }, + fontconfig = { + names = { 'fontconfig', 'fontconfig file', 'fontconfig files' }, + variable = 'FONTCONFIG_PATH', + }, + }, + obsolete = { + enc = { + names = { "enc", "enc files", "enc file", "encoding files", "encoding file" }, + variable = 'ENCFONTS', + suffixes = { 'enc' }, + }, + map = { + names = { "map", "map files", "map file" }, + variable = 'TEXFONTMAPS', + suffixes = { 'map' }, + }, + lig = { + names = { "lig files", "lig file", "ligature file", "ligature files" }, + variable = 'LIGFONTS', + suffixes = { 'lig' }, + }, + opl = { + names = { "opl" }, + variable = 'OPLFONTS', + suffixes = { 'opl' }, + }, + ovp = { + names = { "ovp" }, + variable = 'OVPFONTS', + suffixes = { 'ovp' }, + }, + }, + kpse = { -- subset + base = { + names = { 'base', "metafont format" }, + variable = 'MFBASES', + suffixes = { 'base', 'bas' }, + }, + cmap = { + names = { 'cmap', 'cmap files', 'cmap file' }, + variable = 'CMAPFONTS', + suffixes = { 'cmap' }, + }, + cnf = { + names = { 'cnf' }, + suffixes = { 'cnf' }, + }, + web = { + names = { 'web' }, + suffixes = { 'web', 'ch' } + }, + cweb = { + names = { 'cweb' }, + suffixes = { 'w', 'web', 'ch' }, + }, + gf = { + names = { 'gf' }, + suffixes = { 'gf' }, + }, + mf = { + names = { 'mf' }, + variable = 'MFINPUTS', + suffixes = { 'mf' }, + }, + mft = { + names = { 'mft' }, + suffixes = { 'mft' }, + }, + pk = { + names = { 'pk' }, + suffixes = { 'pk' }, + }, + }, +} + +resolvers.relations = relations + +-- formats: maps a format onto a variable + +function resolvers.updaterelations() + for category, categories in next, relations do + for name, relation in next, categories do + local rn = relation.names + local rv = relation.variable + local rs = relation.suffixes + if rn and rv then + for i=1,#rn do + local rni = lower(gsub(rn[i]," ","")) + formats[rni] = rv + if rs then + suffixes[rni] = rs + for i=1,#rs do + local rsi = rs[i] + suffixmap[rsi] = rni + end + end + end + end + if rs then end end - texio.write_nl("") -- final newline - statistics.enable = false end end -function statistics.show_job_stat(tag,data,n) - texio.write_nl(format("%-15s: %s - %s","mkiv lua stats",tag:rpadd(n," "),data)) +resolvers.updaterelations() -- push this in the metatable -> newindex + +local function simplified(t,k) + return rawget(t,lower(gsub(k," ",""))) end -function statistics.memused() -- no math.round yet -) - local round = math.round or math.floor - return format("%s MB (ctx: %s MB)",round(collectgarbage("count")/1000), round(status.luastate_bytes/1000000)) +setmetatableindex(formats, simplified) +setmetatableindex(suffixes, simplified) +setmetatableindex(suffixmap, simplified) + +-- A few accessors, mostly for command line tool. + +function resolvers.suffixofformat(str) + local s = suffixes[str] + return s and s[1] or "" end -if statistics.runtime then - -- already loaded and set -elseif luatex and luatex.starttime then - statistics.starttime = luatex.starttime - statistics.loadtime = 0 - statistics.timing = 0 -else - statistics.starttiming(statistics) +function resolvers.suffixofformat(str) + return suffixes[str] or { } end -function statistics.runtime() - statistics.stoptiming(statistics) - return statistics.formatruntime(statistics.elapsedtime(statistics)) +for name, format in next, formats do + dangerous[name] = true -- still needed ? end -function statistics.formatruntime(runtime) - return format("%s seconds", statistics.elapsedtime(statistics)) -end +-- because vf searching is somewhat dangerous, we want to prevent +-- too liberal searching esp because we do a lookup on the current +-- path anyway; only tex (or any) is safe + +dangerous.tex = nil -function statistics.timed(action,report) - local timer = { } - report = report or logs.simple - statistics.starttiming(timer) - action() - statistics.stoptiming(timer) - report("total runtime: %s",statistics.elapsedtime(timer)) -end --- where, not really the best spot for this: +-- more helpers -commands = commands or { } +function resolvers.formatofvariable(str) + return formats[str] or '' +end -local timer +function resolvers.formatofsuffix(str) -- of file + return suffixmap[fileextname(str)] or 'tex' -- so many map onto tex (like mkiv, cld etc) +end -function commands.resettimer() - statistics.resettiming(timer) - statistics.starttiming(timer) +function resolvers.variableofformat(str) + return formats[str] or '' end -function commands.elapsedtime() - statistics.stoptiming(timer) - tex.sprint(statistics.elapsedtime(timer)) +function resolvers.variableofformatorsuffix(str) + local v = formats[str] + if v then + return v + end + v = suffixmap[fileextname(str)] + if v then + return formats[v] + end + return '' end -commands.resettimer() end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['trac-log'] = { - version = 1.001, - comment = "companion to trac-log.mkiv", +if not modules then modules = { } end modules ['data-tmp'] = { + version = 1.100, + comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } --- this is old code that needs an overhaul - ---~ io.stdout:setvbuf("no") ---~ io.stderr:setvbuf("no") - -local write_nl, write = texio.write_nl or print, texio.write or io.write -local format, gmatch = string.format, string.gmatch -local texcount = tex and tex.count - -if texlua then - write_nl = print - write = io.write -end - --[[ldx-- -

This is a prelude to a more extensive logging module. For the sake -of parsing log files, in addition to the standard logging we will -provide an structured file. Actually, any logging that -is hooked into callbacks will be \XML\ by default.

---ldx]]-- +

This module deals with caching data. It sets up the paths and +implements loaders and savers for tables. Best is to set the +following variable. When not set, the usual paths will be +checked. Personally I prefer the (users) temporary path.

-logs = logs or { } -logs.xml = logs.xml or { } -logs.tex = logs.tex or { } + +TEXMFCACHE=$TMP;$TEMP;$TMPDIR;$TEMPDIR;$HOME;$TEXMFVAR;$VARTEXMF;. + ---[[ldx-- -

This looks pretty ugly but we need to speed things up a bit.

+

Currently we do no locking when we write files. This is no real +problem because most caching involves fonts and the chance of them +being written at the same time is small. We also need to extend +luatools with a recache feature.

--ldx]]-- -logs.moreinfo = [[ -more information about ConTeXt and the tools that come with it can be found at: +local format, lower, gsub, concat = string.format, string.lower, string.gsub, table.concat +local mkdirs, isdir = dir.mkdirs, lfs.isdir -maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context -webpage : http://www.pragma-ade.nl / http://tex.aanhet.net -wiki : http://contextgarden.net -]] +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) -logs.levels = { - ['error'] = 1, - ['warning'] = 2, - ['info'] = 3, - ['debug'] = 4, -} +local report_caches = logs.reporter("resolvers","caches") +local report_resolvers = logs.reporter("resolvers","caching") -logs.functions = { - 'report', 'start', 'stop', 'push', 'pop', 'line', 'direct', - 'start_run', 'stop_run', - 'start_page_number', 'stop_page_number', - 'report_output_pages', 'report_output_log', - 'report_tex_stat', 'report_job_stat', - 'show_open', 'show_close', 'show_load', -} +local resolvers = resolvers -logs.tracers = { -} +-- intermezzo -logs.level = 0 -logs.mode = string.lower((os.getenv("MTX.LOG.MODE") or os.getenv("MTX_LOG_MODE") or "tex")) +local directive_cleanup = false directives.register("system.compile.cleanup", function(v) directive_cleanup = v end) +local directive_strip = true directives.register("system.compile.strip", function(v) directive_strip = v end) -function logs.set_level(level) - logs.level = logs.levels[level] or level -end +local compile = utilities.lua.compile -function logs.set_method(method) - for _, v in next, logs.functions do - logs[v] = logs[method][v] or function() end - end +function utilities.lua.compile(luafile,lucfile,cleanup,strip) + if cleanup == nil then cleanup = directive_cleanup end + if strip == nil then strip = directive_strip end + return compile(luafile,lucfile,cleanup,strip) end --- tex logging +-- end of intermezzo -function logs.tex.report(category,fmt,...) -- new - if fmt then - write_nl(category .. " | " .. format(fmt,...)) - else - write_nl(category .. " |") - end -end +caches = caches or { } +local caches = caches -function logs.tex.line(fmt,...) -- new - if fmt then - write_nl(format(fmt,...)) +caches.base = caches.base or "luatex-cache" +caches.more = caches.more or "context" +caches.direct = false -- true is faster but may need huge amounts of memory +caches.tree = false +caches.force = true +caches.ask = false +caches.relocate = false +caches.defaults = { "TMPDIR", "TEMPDIR", "TMP", "TEMP", "HOME", "HOMEPATH" } + +local writable, readables, usedreadables = nil, { }, { } + +-- we could use a metatable for writable and readable but not yet + +local function identify() + -- Combining the loops makes it messy. First we check the format cache path + -- and when the last component is not present we try to create it. + local texmfcaches = resolvers.cleanpathlist("TEXMFCACHE") + if texmfcaches then + for k=1,#texmfcaches do + local cachepath = texmfcaches[k] + if cachepath ~= "" then + cachepath = resolvers.resolve(cachepath) + cachepath = resolvers.cleanpath(cachepath) + cachepath = file.collapsepath(cachepath) + local valid = isdir(cachepath) + if valid then + if file.is_readable(cachepath) then + readables[#readables+1] = cachepath + if not writable and file.is_writable(cachepath) then + writable = cachepath + end + end + elseif not writable and caches.force then + local cacheparent = file.dirname(cachepath) + if file.is_writable(cacheparent) then + if not caches.ask or io.ask(format("\nShould I create the cache path %s?",cachepath), "no", { "yes", "no" }) == "yes" then + mkdirs(cachepath) + if isdir(cachepath) and file.is_writable(cachepath) then + report_caches("created: %s",cachepath) + writable = cachepath + readables[#readables+1] = cachepath + end + end + end + end + end + end + end + -- As a last resort we check some temporary paths but this time we don't + -- create them. + local texmfcaches = caches.defaults + if texmfcaches then + for k=1,#texmfcaches do + local cachepath = texmfcaches[k] + cachepath = resolvers.expansion(cachepath) -- was getenv + if cachepath ~= "" then + cachepath = resolvers.resolve(cachepath) + cachepath = resolvers.cleanpath(cachepath) + local valid = isdir(cachepath) + if valid and file.is_readable(cachepath) then + if not writable and file.is_writable(cachepath) then + readables[#readables+1] = cachepath + writable = cachepath + break + end + end + end + end + end + -- Some extra checking. If we have no writable or readable path then we simply + -- quit. + if not writable then + report_caches("fatal error: there is no valid writable cache path defined") + os.exit() + elseif #readables == 0 then + report_caches("fatal error: there is no valid readable cache path defined") + os.exit() + end + -- why here + writable = dir.expandname(resolvers.cleanpath(writable)) -- just in case + -- moved here + local base, more, tree = caches.base, caches.more, caches.tree or caches.treehash() -- we have only one writable tree + if tree then + caches.tree = tree + writable = mkdirs(writable,base,more,tree) + for i=1,#readables do + readables[i] = file.join(readables[i],base,more,tree) + end else - write_nl("") + writable = mkdirs(writable,base,more) + for i=1,#readables do + readables[i] = file.join(readables[i],base,more) + end end + -- end + if trace_cache then + for i=1,#readables do + report_caches("using readable path '%s' (order %s)",readables[i],i) + end + report_caches("using writable path '%s'",writable) + end + identify = function() + return writable, readables + end + return writable, readables end ---~ function logs.tex.start_page_number() ---~ local real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno ---~ if real > 0 then ---~ if user > 0 then ---~ if sub > 0 then ---~ write(format("[%s.%s.%s",real,user,sub)) ---~ else ---~ write(format("[%s.%s",real,user)) ---~ end ---~ else ---~ write(format("[%s",real)) ---~ end ---~ else ---~ write("[-") ---~ end ---~ end - ---~ function logs.tex.stop_page_number() ---~ write("]") ---~ end - -local real, user, sub - -function logs.tex.start_page_number() - real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno -end - -function logs.tex.stop_page_number() - if real > 0 then - if user > 0 then - if sub > 0 then - logs.report("pages", "flushing realpage %s, userpage %s, subpage %s",real,user,sub) - else - logs.report("pages", "flushing realpage %s, userpage %s",real,user) +function caches.usedpaths() + local writable, readables = identify() + if #readables > 1 then + local result = { } + for i=1,#readables do + local readable = readables[i] + if usedreadables[i] or readable == writable then + result[#result+1] = format("readable: '%s' (order %s)",readable,i) end - else - logs.report("pages", "flushing realpage %s",real) end + result[#result+1] = format("writable: '%s'",writable) + return result else - logs.report("pages", "flushing page") + return writable end - io.flush() end -logs.tex.report_job_stat = statistics.show_job_stat - --- xml logging +function caches.configfiles() + return table.concat(resolvers.instance.specification,";") +end -function logs.xml.report(category,fmt,...) -- new - if fmt then - write_nl(format("%s",category,format(fmt,...))) - else - write_nl(format("",category)) +function caches.hashed(tree) + tree = gsub(tree,"\\$","/") + tree = gsub(tree,"/+$","") + tree = lower(tree) + local hash = md5.hex(tree) + if trace_cache or trace_locating then + report_caches("hashing tree %s, hash %s",tree,hash) end + return hash end -function logs.xml.line(fmt,...) -- new - if fmt then - write_nl(format("%s",format(fmt,...))) + +function caches.treehash() + local tree = caches.configfiles() + if not tree or tree == "" then + return false else - write_nl("") + return caches.hashed(tree) end end -function logs.xml.start() if logs.level > 0 then tw("<%s>" ) end end -function logs.xml.stop () if logs.level > 0 then tw("") end end -function logs.xml.push () if logs.level > 0 then tw("" ) end end - -function logs.xml.start_run() - write_nl("") - write_nl("") -- xmlns='www.pragma-ade.com/luatex/schemas/context-job.rng' - write_nl("") -end +local r_cache, w_cache = { }, { } -- normally w in in r but who cares -function logs.xml.stop_run() - write_nl("") +local function getreadablepaths(...) -- we can optimize this as we have at most 2 tags + local tags = { ... } + local hash = concat(tags,"/") + local done = r_cache[hash] + if not done then + local writable, readables = identify() -- exit if not found + if #tags > 0 then + done = { } + for i=1,#readables do + done[i] = file.join(readables[i],...) + end + else + done = readables + end + r_cache[hash] = done + end + return done end -function logs.xml.start_page_number() - write_nl(format("

0 then + done = mkdirs(writable,...) + else + done = writable + end + w_cache[hash] = done + end + return done end -function logs.xml.stop_page_number() - write("/>") - write_nl("") -end +caches.getreadablepaths = getreadablepaths +caches.getwritablepath = getwritablepath -function logs.xml.report_output_pages(p,b) - write_nl(format("", p)) - write_nl(format("", b)) - write_nl("") +function caches.getfirstreadablefile(filename,...) + local rd = getreadablepaths(...) + for i=1,#rd do + local path = rd[i] + local fullname = file.join(path,filename) + if file.is_readable(fullname) then + usedreadables[i] = true + return fullname, path + end + end + return caches.setfirstwritablefile(filename,...) end -function logs.xml.report_output_log() +function caches.setfirstwritablefile(filename,...) + local wr = getwritablepath(...) + local fullname = file.join(wr,filename) + return fullname, wr end -function logs.xml.report_tex_stat(k,v) - texiowrite_nl("log",""..tostring(v).."") +function caches.define(category,subcategory) -- for old times sake + return function() + return getwritablepath(category,subcategory) + end end -local level = 0 - -function logs.xml.show_open(name) - level = level + 1 - texiowrite_nl(format("",level,name)) +function caches.setluanames(path,name) + return path .. "/" .. name .. ".tma", path .. "/" .. name .. ".tmc" end -function logs.xml.show_close(name) - texiowrite(" ") - level = level - 1 +function caches.loaddata(readables,name) + if type(readables) == "string" then + readables = { readables } + end + for i=1,#readables do + local path = readables[i] + local tmaname, tmcname = caches.setluanames(path,name) + local loader = loadfile(tmcname) or loadfile(tmaname) + if loader then + loader = loader() + collectgarbage("step") + return loader + end + end + return false end -function logs.xml.show_load(name) - texiowrite_nl(format("",level+1,name)) +function caches.is_writable(filepath,filename) + local tmaname, tmcname = caches.setluanames(filepath,filename) + return file.is_writable(tmaname) end --- - -local name, banner = 'report', 'context' +local saveoptions = { compact = true } -local function report(category,fmt,...) - if fmt then - write_nl(format("%s | %s: %s",name,category,format(fmt,...))) - elseif category then - write_nl(format("%s | %s",name,category)) - else - write_nl(format("%s |",name)) +function caches.savedata(filepath,filename,data,raw) + local tmaname, tmcname = caches.setluanames(filepath,filename) + local reduce, simplify = true, true + if raw then + reduce, simplify = false, false end -end - -local function simple(fmt,...) - if fmt then - write_nl(format("%s | %s",name,format(fmt,...))) + data.cache_uuid = os.uuid() + if caches.direct then + file.savedata(tmaname,table.serialize(data,true,saveoptions)) else - write_nl(format("%s |",name)) + table.tofile(tmaname,data,true,saveoptions) end + utilities.lua.compile(tmaname,tmcname) end -function logs.setprogram(_name_,_banner_,_verbose_) - name, banner = _name_, _banner_ - if _verbose_ then - trackers.enable("resolvers.locating") - end - logs.set_method("tex") - logs.report = report -- also used in libraries - logs.simple = simple -- only used in scripts ! - if utils then - utils.report = simple - end - logs.verbose = _verbose_ -end +-- moved from data-res: -function logs.setverbose(what) - if what then - trackers.enable("resolvers.locating") - else - trackers.disable("resolvers.locating") - end - logs.verbose = what or false -end +local content_state = { } -function logs.extendbanner(_banner_,_verbose_) - banner = banner .. " | ".. _banner_ - if _verbose_ ~= nil then - logs.setverbose(what) - end +function caches.contentstate() + return content_state or { } end -logs.verbose = false -logs.report = logs.tex.report -logs.simple = logs.tex.report - -function logs.reportlines(str) -- todo: - for line in gmatch(str,"(.-)[\n\r]") do - logs.report(line) +function caches.loadcontent(cachename,dataname) + local name = caches.hashed(cachename) + local full, path = caches.getfirstreadablefile(name ..".lua","trees") + local filename = file.join(path,name) + local blob = loadfile(filename .. ".luc") or loadfile(filename .. ".lua") + if blob then + local data = blob() + if data and data.content then + if data.type == dataname then + if data.version == resolvers.cacheversion then + content_state[#content_state+1] = data.uuid + if trace_locating then + report_resolvers("loading '%s' for '%s' from '%s'",dataname,cachename,filename) + end + return data.content + else + report_resolvers("skipping '%s' for '%s' from '%s' (version mismatch)",dataname,cachename,filename) + end + else + report_resolvers("skipping '%s' for '%s' from '%s' (datatype mismatch)",dataname,cachename,filename) + end + elseif trace_locating then + report_resolvers("skipping '%s' for '%s' from '%s' (no content)",dataname,cachename,filename) + end + elseif trace_locating then + report_resolvers("skipping '%s' for '%s' from '%s' (invalid file)",dataname,cachename,filename) end end -function logs.reportline() -- for scripts too - logs.report() -end - -logs.simpleline = logs.reportline - -function logs.reportbanner() -- for scripts too - logs.report(banner) -end - -function logs.help(message,option) - logs.reportbanner() - logs.reportline() - logs.reportlines(message) - local moreinfo = logs.moreinfo or "" - if moreinfo ~= "" and option ~= "nomoreinfo" then - logs.reportline() - logs.reportlines(moreinfo) +function caches.collapsecontent(content) + for k, v in next, content do + if type(v) == "table" and #v == 1 then + content[k] = v[1] + end end end -logs.set_level('error') -logs.set_method('tex') - -function logs.system(whereto,process,jobname,category,...) - for i=1,10 do - local f = io.open(whereto,"a") - if f then - f:write(format("%s %s => %s => %s => %s\r",os.date("%d/%m/%y %H:%m:%S"),process,jobname,category,format(...))) - f:close() - break +function caches.savecontent(cachename,dataname,content) + local name = caches.hashed(cachename) + local full, path = caches.setfirstwritablefile(name ..".lua","trees") + local filename = file.join(path,name) -- is full + local luaname, lucname = filename .. ".lua", filename .. ".luc" + if trace_locating then + report_resolvers("preparing '%s' for '%s'",dataname,cachename) + end + local data = { + type = dataname, + root = cachename, + version = resolvers.cacheversion, + date = os.date("%Y-%m-%d"), + time = os.date("%H:%M:%S"), + content = content, + uuid = os.uuid(), + } + local ok = io.savedata(luaname,table.serialize(data,true)) + if ok then + if trace_locating then + report_resolvers("category '%s', cachename '%s' saved in '%s'",dataname,cachename,luaname) + end + if utilities.lua.compile(luaname,lucname) then + if trace_locating then + report_resolvers("'%s' compiled to '%s'",dataname,lucname) + end + return true else - sleep(0.1) + if trace_locating then + report_resolvers("compiling failed for '%s', deleting file '%s'",dataname,lucname) + end + os.remove(lucname) end + elseif trace_locating then + report_resolvers("unable to save '%s' in '%s' (access error)",dataname,luaname) end end ---~ local syslogname = "oeps.xxx" ---~ ---~ for i=1,10 do ---~ logs.system(syslogname,"context","test","fonts","font %s recached due to newer version (%s)","blabla","123") ---~ end - -function logs.fatal(where,...) - logs.report(where,"fatal error: %s, aborting now",format(...)) - os.exit() -end - end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['data-inp'] = { - version = 1.001, +if not modules then modules = { } end modules ['data-met'] = { + version = 1.100, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files", + license = "see context related readme files" } --- After a few years using the code the large luat-inp.lua file --- has been split up a bit. In the process some functionality was --- dropped: --- --- * support for reading lsr files --- * selective scanning (subtrees) --- * some public auxiliary functions were made private --- --- TODO: os.getenv -> os.env[] --- TODO: instances.[hashes,cnffiles,configurations,522] --- TODO: check escaping in find etc, too much, too slow +local find, format = string.find, string.format +local sequenced = table.sequenced +local addurlscheme, urlhashed = url.addscheme, url.hashed --- This lib is multi-purpose and can be loaded again later on so that --- additional functionality becomes available. We will split thislogs.report("fileio", --- module in components once we're done with prototyping. This is the --- first code I wrote for LuaTeX, so it needs some cleanup. Before changing --- something in this module one can best check with Taco or Hans first; there --- is some nasty trickery going on that relates to traditional kpse support. +local trace_locating = false --- To be considered: hash key lowercase, first entry in table filename --- (any case), rest paths (so no need for optimization). Or maybe a --- separate table that matches lowercase names to mixed case when --- present. In that case the lower() cases can go away. I will do that --- only when we run into problems with names ... well ... Iwona-Regular. +trackers.register("resolvers.locating", function(v) trace_methods = v end) +trackers.register("resolvers.methods", function(v) trace_methods = v end) --- Beware, loading and saving is overloaded in luat-tmp! -local format, gsub, find, lower, upper, match, gmatch = string.format, string.gsub, string.find, string.lower, string.upper, string.match, string.gmatch -local concat, insert, sortedkeys = table.concat, table.insert, table.sortedkeys -local next, type = next, type -local lpegmatch = lpeg.match +local report_methods = logs.reporter("resolvers","methods") + +local allocate = utilities.storage.allocate -local trace_locating, trace_detail, trace_expansions = false, false, false +local resolvers = resolvers -trackers.register("resolvers.locating", function(v) trace_locating = v end) -trackers.register("resolvers.details", function(v) trace_detail = v end) -trackers.register("resolvers.expansions", function(v) trace_expansions = v end) -- todo +local registered = { } -if not resolvers then - resolvers = { - suffixes = { }, - formats = { }, - dangerous = { }, - suffixmap = { }, - alternatives = { }, - locators = { }, -- locate databases - hashers = { }, -- load databases - generators = { }, -- generate databases - } +local function splitmethod(filename) -- todo: filetype in specification + if not filename then + return { scheme = "unknown", original = filename } + end + if type(filename) == "table" then + return filename -- already split + end + filename = file.collapsepath(filename) + if not find(filename,"://") then + return { scheme = "file", path = filename, original = filename, filename = filename } + end + local specification = url.hashed(filename) + if not specification.scheme or specification.scheme == "" then + return { scheme = "file", path = filename, original = filename, filename = filename } + else + return specification + end end -local resolvers = resolvers +resolvers.splitmethod = splitmethod -- bad name but ok -resolvers.locators .notfound = { nil } -resolvers.hashers .notfound = { nil } -resolvers.generators.notfound = { nil } - -resolvers.cacheversion = '1.0.1' -resolvers.cnfname = 'texmf.cnf' -resolvers.luaname = 'texmfcnf.lua' -resolvers.homedir = os.env[os.type == "windows" and 'USERPROFILE'] or os.env['HOME'] or '~' -resolvers.cnfdefault = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c}' - -local dummy_path_expr = "^!*unset/*$" - -local formats = resolvers.formats -local suffixes = resolvers.suffixes -local dangerous = resolvers.dangerous -local suffixmap = resolvers.suffixmap -local alternatives = resolvers.alternatives - -formats['afm'] = 'AFMFONTS' suffixes['afm'] = { 'afm' } -formats['enc'] = 'ENCFONTS' suffixes['enc'] = { 'enc' } -formats['fmt'] = 'TEXFORMATS' suffixes['fmt'] = { 'fmt' } -formats['map'] = 'TEXFONTMAPS' suffixes['map'] = { 'map' } -formats['mp'] = 'MPINPUTS' suffixes['mp'] = { 'mp' } -formats['ocp'] = 'OCPINPUTS' suffixes['ocp'] = { 'ocp' } -formats['ofm'] = 'OFMFONTS' suffixes['ofm'] = { 'ofm', 'tfm' } -formats['otf'] = 'OPENTYPEFONTS' suffixes['otf'] = { 'otf' } -- 'ttf' -formats['opl'] = 'OPLFONTS' suffixes['opl'] = { 'opl' } -formats['otp'] = 'OTPINPUTS' suffixes['otp'] = { 'otp' } -formats['ovf'] = 'OVFFONTS' suffixes['ovf'] = { 'ovf', 'vf' } -formats['ovp'] = 'OVPFONTS' suffixes['ovp'] = { 'ovp' } -formats['tex'] = 'TEXINPUTS' suffixes['tex'] = { 'tex' } -formats['tfm'] = 'TFMFONTS' suffixes['tfm'] = { 'tfm' } -formats['ttf'] = 'TTFONTS' suffixes['ttf'] = { 'ttf', 'ttc', 'dfont' } -formats['pfb'] = 'T1FONTS' suffixes['pfb'] = { 'pfb', 'pfa' } -formats['vf'] = 'VFFONTS' suffixes['vf'] = { 'vf' } - -formats['fea'] = 'FONTFEATURES' suffixes['fea'] = { 'fea' } -formats['cid'] = 'FONTCIDMAPS' suffixes['cid'] = { 'cid', 'cidmap' } - -formats ['texmfscripts'] = 'TEXMFSCRIPTS' -- new -suffixes['texmfscripts'] = { 'rb', 'pl', 'py' } -- 'lua' - -formats ['lua'] = 'LUAINPUTS' -- new -suffixes['lua'] = { 'lua', 'luc', 'tma', 'tmc' } - --- backward compatible ones - -alternatives['map files'] = 'map' -alternatives['enc files'] = 'enc' -alternatives['cid maps'] = 'cid' -- great, why no cid files -alternatives['font feature files'] = 'fea' -- and fea files here -alternatives['opentype fonts'] = 'otf' -alternatives['truetype fonts'] = 'ttf' -alternatives['truetype collections'] = 'ttc' -alternatives['truetype dictionary'] = 'dfont' -alternatives['type1 fonts'] = 'pfb' - --- obscure ones - -formats ['misc fonts'] = '' -suffixes['misc fonts'] = { } - -formats ['sfd'] = 'SFDFONTS' -suffixes ['sfd'] = { 'sfd' } -alternatives['subfont definition files'] = 'sfd' - --- lib paths - -formats ['lib'] = 'CLUAINPUTS' -- new (needs checking) -suffixes['lib'] = (os.libsuffix and { os.libsuffix }) or { 'dll', 'so' } +-- the second argument is always analyzed (saves time later on) and the original +-- gets passed as original but also as argument --- In practice we will work within one tds tree, but i want to keep --- the option open to build tools that look at multiple trees, which is --- why we keep the tree specific data in a table. We used to pass the --- instance but for practical pusposes we now avoid this and use a --- instance variable. +local function methodhandler(what,first,...) -- filename can be nil or false + local method = registered[what] + if method then + local how, namespace = method.how, method.namespace + if how == "uri" or how == "url" then + local specification = splitmethod(first) + local scheme = specification.scheme + local resolver = namespace and namespace[scheme] + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, scheme=%s, argument=%s",what,how,scheme,first) + end + return resolver(specification,...) + else + resolver = namespace.default or namespace.file + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, default, argument=%s",what,how,first) + end + return resolver(specification,...) + elseif trace_methods then + report_methods("resolver: method=%s, how=%s, no handler",what,how) + end + end + elseif how == "tag" then + local resolver = namespace and namespace[first] + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, tag=%s",what,how,first) + end + return resolver(...) + else + resolver = namespace.default or namespace.file + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, default",what,how) + end + return resolver(...) + elseif trace_methods then + report_methods("resolver: method=%s, how=%s, unknown",what,how) + end + end + end + else + report_methods("resolver: method=%s, unknown",what) + end +end --- here we catch a few new thingies (todo: add these paths to context.tmf) --- --- FONTFEATURES = .;$TEXMF/fonts/fea// --- FONTCIDMAPS = .;$TEXMF/fonts/cid// +resolvers.methodhandler = methodhandler + +function resolvers.registermethod(name,namespace,how) + registered[name] = { how = how or "tag", namespace = namespace } + namespace["byscheme"] = function(scheme,filename,...) + if scheme == "file" then + return methodhandler(name,filename,...) + else + return methodhandler(name,addurlscheme(filename,scheme),...) + end + end +end --- we always have one instance active +local concatinators = allocate { notfound = file.join } -- concatinate paths +local locators = allocate { notfound = function() end } -- locate databases +local hashers = allocate { notfound = function() end } -- load databases +local generators = allocate { notfound = function() end } -- generate databases -resolvers.instance = resolvers.instance or nil -- the current one (slow access) -local instance = resolvers.instance or nil -- the current one (fast access) +resolvers.concatinators = concatinators +resolvers.locators = locators +resolvers.hashers = hashers +resolvers.generators = generators -function resolvers.newinstance() +local registermethod = resolvers.registermethod - -- store once, freeze and faster (once reset we can best use - -- instance.environment) maybe better have a register suffix - -- function +registermethod("concatinators",concatinators,"tag") +registermethod("locators", locators, "uri") +registermethod("hashers", hashers, "uri") +registermethod("generators", generators, "uri") - for k, v in next, suffixes do - for i=1,#v do - local vi = v[i] - if vi then - suffixmap[vi] = k - end - end - end - -- because vf searching is somewhat dangerous, we want to prevent - -- too liberal searching esp because we do a lookup on the current - -- path anyway; only tex (or any) is safe +end -- of closure - for k, v in next, formats do - dangerous[k] = true - end - dangerous.tex = nil +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-res'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +-- In practice we will work within one tds tree, but i want to keep +-- the option open to build tools that look at multiple trees, which is +-- why we keep the tree specific data in a table. We used to pass the +-- instance but for practical purposes we now avoid this and use a +-- instance variable. We always have one instance active (sort of global). + +-- todo: cache:/// home:/// + +local format, gsub, find, lower, upper, match, gmatch = string.format, string.gsub, string.find, string.lower, string.upper, string.match, string.gmatch +local concat, insert, sortedkeys = table.concat, table.insert, table.sortedkeys +local next, type, rawget = next, type, rawget +local os = os - -- the instance +local P, S, R, C, Cc, Cs, Ct, Carg = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Carg +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns - local newinstance = { - rootpath = '', - treepath = '', - progname = 'context', - engine = 'luatex', - format = '', - environment = { }, - variables = { }, - expansions = { }, - files = { }, - remap = { }, - configuration = { }, - setup = { }, - order = { }, - found = { }, - foundintrees = { }, - kpsevars = { }, - hashes = { }, - cnffiles = { }, - luafiles = { }, - lists = { }, - remember = true, - diskcache = true, - renewcache = false, - scandisk = true, - cachepath = nil, - loaderror = false, - sortdata = false, - savelists = true, - cleanuppaths = true, - allresults = false, - pattern = nil, -- lists - data = { }, -- only for loading - force_suffixes = true, - fakepaths = { }, - } +local filedirname = file.dirname +local filebasename = file.basename +local fileextname = file.extname +local filejoin = file.join +local collapsepath = file.collapsepath +local joinpath = file.joinpath +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex - local ne = newinstance.environment +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_detail = false trackers.register("resolvers.details", function(v) trace_detail = v end) +local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end) - for k,v in next, os.env do - ne[k] = resolvers.bare_variable(v) - end +local report_resolving = logs.reporter("resolvers","resolving") - return newinstance +local resolvers = resolvers -end +local expandedpathfromlist = resolvers.expandedpathfromlist +local checkedvariable = resolvers.checkedvariable +local splitconfigurationpath = resolvers.splitconfigurationpath +local methodhandler = resolvers.methodhandler -function resolvers.setinstance(someinstance) - instance = someinstance - resolvers.instance = someinstance - return someinstance -end +local initializesetter = utilities.setters.initialize -function resolvers.reset() - return resolvers.setinstance(resolvers.newinstance()) -end +local ostype, osname, osenv, ossetenv, osgetenv = os.type, os.name, os.env, os.setenv, os.getenv -local function reset_hashes() - instance.lists = { } - instance.found = { } -end +resolvers.cacheversion = '1.0.1' +resolvers.configbanner = '' +resolvers.homedir = environment.homedir +resolvers.criticalvars = allocate { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF", "TEXMF", "TEXOS" } +resolvers.luacnfname = 'texmfcnf.lua' +resolvers.luacnfstate = "unknown" -local function check_configuration() -- not yet ok, no time for debugging now - if os.env["OSFONTDIR"] then - -- ok - elseif os.type == "windows" then - os.setenv("OSFONTDIR","c:/windows/fonts//") - elseif os.type == "macosx" then - os.setenv("OSFONTDIR","$HOME/Library/Fonts//;/Library/Fonts//;/System/Library/Fonts//") - end -end +-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path +resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}' -function resolvers.bare_variable(str) -- assumes str is a string - return (gsub(str,"\s*([\"\']?)(.+)%1\s*", "%2")) -end -function resolvers.settrace(n) -- no longer number but: 'locating' or 'detail' - if n then - trackers.disable("resolvers.*") - trackers.enable("resolvers."..n) - end -end -resolvers.settrace(os.getenv("MTX_INPUT_TRACE")) +local unset_variable = "unset" -function resolvers.osenv(key) - local ie = instance.environment - local value = ie[key] - if value == nil then - -- local e = os.getenv(key) - local e = os.env[key] - if e == nil then - -- value = "" -- false - else - value = resolvers.bare_variable(e) - end - ie[key] = value - end - return value or "" -end +local formats = resolvers.formats +local suffixes = resolvers.suffixes +local dangerous = resolvers.dangerous +local suffixmap = resolvers.suffixmap -function resolvers.env(key) - return instance.environment[key] or resolvers.osenv(key) -end +resolvers.defaultsuffixes = { "tex" } -- "mkiv", "cld" -- too tricky --- +resolvers.instance = resolvers.instance or nil -- the current one (slow access) +local instance = resolvers.instance or nil -- the current one (fast access) -local function expand_vars(lst) -- simple vars - local variables, env = instance.variables, resolvers.env - local function resolve(a) - return variables[a] or env(a) - end - for k=1,#lst do - lst[k] = gsub(lst[k],"%$([%a%d%_%-]+)",resolve) - end -end +-- An instance has an environment (coming from the outside, kept raw), variables +-- (coming from the configuration file), and expansions (variables with nested +-- variables replaced). One can push something into the outer environment and +-- its internal copy, but only the later one will be the raw unprefixed variant. -local function expanded_var(var) -- simple vars - local function resolve(a) - return instance.variables[a] or resolvers.env(a) +function resolvers.setenv(key,value,raw) + if instance then + -- this one will be consulted first when we stay inside + -- the current environment + instance.environment[key] = value + -- we feed back into the environment, and as this is used + -- by other applications (via os.execute) we need to make + -- sure that prefixes are resolve + ossetenv(key,raw and value or resolvers.resolve(value)) end - return (gsub(var,"%$([%a%d%_%-]+)",resolve)) end -local function entry(entries,name) - if name and (name ~= "") then - name = gsub(name,'%$','') - local result = entries[name..'.'..instance.progname] or entries[name] - if result then - return result - else - result = resolvers.env(name) - if result then - instance.variables[name] = result - resolvers.expand_variables() - return instance.expansions[name] or "" - end - end - end - return "" -end +-- Beware we don't want empty here as this one can be called early on +-- and therefore we use rawget. -local function is_entry(entries,name) - if name and name ~= "" then - name = gsub(name,'%$','') - return (entries[name..'.'..instance.progname] or entries[name]) ~= nil +local function getenv(key) + local value = rawget(instance.environment,key) + if value and value ~= "" then + return value else - return false + local e = osgetenv(key) + return e ~= nil and e ~= "" and checkedvariable(e) or "" end end --- {a,b,c,d} --- a,b,c/{p,q,r},d --- a,b,c/{p,q,r}/d/{x,y,z}// --- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} --- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} --- a{b,c}{d,e}f --- {a,b,c,d} --- {a,b,c/{p,q,r},d} --- {a,b,c/{p,q,r}/d/{x,y,z}//} --- {a,b,c/{p,q/{x,y,z}},d/{p,q,r}} --- {a,b,c/{p,q/{x,y,z},w}v,d/{p,q,r}} --- {$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c} +resolvers.getenv = getenv +resolvers.env = getenv --- this one is better and faster, but it took me a while to realize --- that this kind of replacement is cleaner than messy parsing and --- fuzzy concatenating we can probably gain a bit with selectively --- applying lpeg, but experiments with lpeg parsing this proved not to --- work that well; the parsing is ok, but dealing with the resulting --- table is a pain because we need to work inside-out recursively +-- We are going to use some metatable trickery where we backtrack from +-- expansion to variable to environment. -local function do_first(a,b) - local t = { } - for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end - return "{" .. concat(t,",") .. "}" +local function resolve(k) + return instance.expansions[k] end -local function do_second(a,b) - local t = { } - for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end - return "{" .. concat(t,",") .. "}" -end +local dollarstripper = lpeg.stripper("$") +local inhibitstripper = P("!")^0 * Cs(P(1)^0) +local backslashswapper = lpeg.replacer("\\","/") -local function do_both(a,b) - local t = { } - for sa in gmatch(a,"[^,]+") do - for sb in gmatch(b,"[^,]+") do - t[#t+1] = sa .. sb - end - end - return "{" .. concat(t,",") .. "}" -end +local somevariable = P("$") / "" +local somekey = C(R("az","AZ","09","__","--")^1) +local somethingelse = P(";") * ((1-S("!{}/\\"))^1 * P(";") / "") + + P(";") * (P(";") / "") + + P(1) +local variableexpander = Cs( (somevariable * (somekey/resolve) + somethingelse)^1 ) -local function do_three(a,b,c) - return a .. b.. c -end +local cleaner = P("\\") / "/" + P(";") * S("!{}/\\")^0 * P(";")^1 / ";" +local variablecleaner = Cs((cleaner + P(1))^0) -local function splitpathexpr(str, t, validate) - -- no need for further optimization as it is only called a - -- few times, we can use lpeg for the sub - if trace_expansions then - logs.report("fileio","expanding variable '%s'",str) - end - t = t or { } - str = gsub(str,",}",",@}") - str = gsub(str,"{,","{@,") - -- str = "@" .. str .. "@" - local ok, done - while true do - done = false - while true do - str, ok = gsub(str,"([^{},]+){([^{}]+)}",do_first) - if ok > 0 then done = true else break end - end - while true do - str, ok = gsub(str,"{([^{}]+)}([^{},]+)",do_second) - if ok > 0 then done = true else break end - end - while true do - str, ok = gsub(str,"{([^{}]+)}{([^{}]+)}",do_both) - if ok > 0 then done = true else break end - end - str, ok = gsub(str,"({[^{}]*){([^{}]+)}([^{}]*})",do_three) - if ok > 0 then done = true end - if not done then break end - end - str = gsub(str,"[{}]", "") - str = gsub(str,"@","") - if validate then - for s in gmatch(str,"[^,]+") do - s = validate(s) - if s then t[#t+1] = s end - end - else - for s in gmatch(str,"[^,]+") do - t[#t+1] = s - end - end - if trace_expansions then - for k=1,#t do - logs.report("fileio","% 4i: %s",k,t[k]) - end - end - return t -end +local somevariable = R("az","AZ","09","__","--")^1 / resolve +local variable = (P("$")/"") * (somevariable + (P("{")/"") * somevariable * (P("}")/"")) +local variableresolver = Cs((variable + P(1))^0) -local function expanded_path_from_list(pathlist) -- maybe not a list, just a path - -- a previous version fed back into pathlist - local newlist, ok = { }, false - for k=1,#pathlist do - if find(pathlist[k],"[{}]") then - ok = true - break - end - end - if ok then - local function validate(s) - s = file.collapse_path(s) - return s ~= "" and not find(s,dummy_path_expr) and s - end - for k=1,#pathlist do - splitpathexpr(pathlist[k],newlist,validate) - end - else - for k=1,#pathlist do - for p in gmatch(pathlist[k],"([^,]+)") do - p = file.collapse_path(p) - if p ~= "" then newlist[#newlist+1] = p end - end - end - end - return newlist +local function expandedvariable(var) + return lpegmatch(variableexpander,var) or var end --- we follow a rather traditional approach: --- --- (1) texmf.cnf given in TEXMFCNF --- (2) texmf.cnf searched in default variable --- --- also we now follow the stupid route: if not set then just assume *one* --- cnf file under texmf (i.e. distribution) +function resolvers.newinstance() -- todo: all vars will become lowercase and alphanum only -local args = environment and environment.original_arguments or arg -- this needs a cleanup + if trace_locating then + report_resolving("creating instance") + end -resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex" -resolvers.ownbin = gsub(resolvers.ownbin,"\\","/") + local environment, variables, expansions, order = allocate(), allocate(), allocate(), allocate() -function resolvers.getownpath() - local ownpath = resolvers.ownpath or os.selfdir - if not ownpath or ownpath == "" or ownpath == "unset" then - ownpath = args[-1] or arg[-1] - ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/")) - if not ownpath or ownpath == "" then - ownpath = args[-0] or arg[-0] - ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/")) - end - local binary = resolvers.ownbin - if not ownpath or ownpath == "" then - ownpath = ownpath and file.dirname(binary) - end - if not ownpath or ownpath == "" then - if os.binsuffix ~= "" then - binary = file.replacesuffix(binary,os.binsuffix) - end - for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do - local b = file.join(p,binary) - if lfs.isfile(b) then - -- we assume that after changing to the path the currentdir function - -- resolves to the real location and use this side effect here; this - -- trick is needed because on the mac installations use symlinks in the - -- path instead of real locations - local olddir = lfs.currentdir() - if lfs.chdir(p) then - local pp = lfs.currentdir() - if trace_locating and p ~= pp then - logs.report("fileio","following symlink '%s' to '%s'",p,pp) - end - ownpath = pp - lfs.chdir(olddir) - else - if trace_locating then - logs.report("fileio","unable to check path '%s'",p) - end - ownpath = p - end - break - end + local newinstance = { + environment = environment, + variables = variables, + expansions = expansions, + order = order, + files = allocate(), + setups = allocate(), + found = allocate(), + foundintrees = allocate(), + hashes = allocate(), + hashed = allocate(), + specification = allocate(), + lists = allocate(), + data = allocate(), -- only for loading + fakepaths = allocate(), + remember = true, + diskcache = true, + renewcache = false, + loaderror = false, + savelists = true, + pattern = nil, -- lists + force_suffixes = true, + } + + setmetatableindex(variables,function(t,k) + local v + for i=1,#order do + v = order[i][k] + if v ~= nil then + t[k] = v + return v end end - if not ownpath or ownpath == "" then - ownpath = "." - logs.report("fileio","forcing fallback ownpath .") - elseif trace_locating then - logs.report("fileio","using ownpath '%s'",ownpath) + if v == nil then + v = "" end - end - resolvers.ownpath = ownpath - function resolvers.getownpath() - return resolvers.ownpath - end - return ownpath -end - -local own_places = { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF" } + t[k] = v + return v + end) -local function identify_own() - local ownpath = resolvers.getownpath() or dir.current() - local ie = instance.environment - if ownpath then - if resolvers.env('SELFAUTOLOC') == "" then os.env['SELFAUTOLOC'] = file.collapse_path(ownpath) end - if resolvers.env('SELFAUTODIR') == "" then os.env['SELFAUTODIR'] = file.collapse_path(ownpath .. "/..") end - if resolvers.env('SELFAUTOPARENT') == "" then os.env['SELFAUTOPARENT'] = file.collapse_path(ownpath .. "/../..") end - else - logs.report("fileio","error: unable to locate ownpath") - os.exit() - end - if resolvers.env('TEXMFCNF') == "" then os.env['TEXMFCNF'] = resolvers.cnfdefault end - if resolvers.env('TEXOS') == "" then os.env['TEXOS'] = resolvers.env('SELFAUTODIR') end - if resolvers.env('TEXROOT') == "" then os.env['TEXROOT'] = resolvers.env('SELFAUTOPARENT') end - if trace_locating then - for i=1,#own_places do - local v = own_places[i] - logs.report("fileio","variable '%s' set to '%s'",v,resolvers.env(v) or "unknown") + setmetatableindex(environment, function(t,k) + local v = osgetenv(k) + if v == nil then + v = variables[k] end - end - identify_own = function() end -end - -function resolvers.identify_cnf() - if #instance.cnffiles == 0 then - -- fallback - identify_own() - -- the real search - resolvers.expand_variables() - local t = resolvers.split_path(resolvers.env('TEXMFCNF')) - t = expanded_path_from_list(t) - expand_vars(t) -- redundant - local function locate(filename,list) - for i=1,#t do - local ti = t[i] - local texmfcnf = file.collapse_path(file.join(ti,filename)) - if lfs.isfile(texmfcnf) then - list[#list+1] = texmfcnf - end - end + if v ~= nil then + v = checkedvariable(v) or "" end - locate(resolvers.luaname,instance.luafiles) - locate(resolvers.cnfname,instance.cnffiles) - end -end + v = resolvers.repath(v) -- for taco who has a : separated osfontdir + t[k] = v + return v + end) -local function load_cnf_file(fname) - fname = resolvers.clean_path(fname) - local lname = file.replacesuffix(fname,'lua') - if lfs.isfile(lname) then - local dname = file.dirname(fname) -- fname ? - if not instance.configuration[dname] then - resolvers.load_data(dname,'configuration',lname and file.basename(lname)) - instance.order[#instance.order+1] = instance.configuration[dname] - end - else - f = io.open(fname) - if f then - if trace_locating then - logs.report("fileio","loading configuration file %s", fname) - end - local line, data, n, k, v - local dname = file.dirname(fname) - if not instance.configuration[dname] then - instance.configuration[dname] = { } - instance.order[#instance.order+1] = instance.configuration[dname] - end - local data = instance.configuration[dname] - while true do - local line, n = f:read(), 0 - if line then - while true do -- join lines - line, n = gsub(line,"\\%s*$", "") - if n > 0 then - line = line .. f:read() - else - break - end - end - if not find(line,"^[%%#]") then - local l = gsub(line,"%s*%%.*$","") - local k, v = match(l,"%s*(.-)%s*=%s*(.-)%s*$") - if k and v and not data[k] then - v = gsub(v,"[%%#].*",'') - data[k] = gsub(v,"~","$HOME") - instance.kpsevars[k] = true - end - end - else - break - end - end - f:close() - elseif trace_locating then - logs.report("fileio","skipping configuration file '%s'", fname) + setmetatableindex(expansions, function(t,k) + local v = environment[k] + if type(v) == "string" then + v = lpegmatch(variableresolver,v) + v = lpegmatch(variablecleaner,v) end - end + t[k] = v + return v + end) + + return newinstance + end -local function collapse_cnf_data() -- potential optimization: pass start index (setup and configuration are shared) - local order = instance.order - for i=1,#order do - local c = order[i] - for k,v in next, c do - if not instance.variables[k] then - if instance.environment[k] then - instance.variables[k] = instance.environment[k] - else - instance.kpsevars[k] = true - instance.variables[k] = resolvers.bare_variable(v) - end - end - end - end +function resolvers.setinstance(someinstance) -- only one instance is active + instance = someinstance + resolvers.instance = someinstance + return someinstance end -function resolvers.load_cnf() - local function loadoldconfigdata() - local cnffiles = instance.cnffiles - for i=1,#cnffiles do - load_cnf_file(cnffiles[i]) - end - end - -- instance.cnffiles contain complete names now ! - -- we still use a funny mix of cnf and new but soon - -- we will switch to lua exclusively as we only use - -- the file to collect the tree roots - if #instance.cnffiles == 0 then - if trace_locating then - logs.report("fileio","no cnf files found (TEXMFCNF may not be set/known)") - end - else - local cnffiles = instance.cnffiles - instance.rootpath = cnffiles[1] - for k=1,#cnffiles do - instance.cnffiles[k] = file.collapse_path(cnffiles[k]) - end - for i=1,3 do - instance.rootpath = file.dirname(instance.rootpath) - end - instance.rootpath = file.collapse_path(instance.rootpath) - if instance.diskcache and not instance.renewcache then - resolvers.loadoldconfig(instance.cnffiles) - if instance.loaderror then - loadoldconfigdata() - resolvers.saveoldconfig() - end - else - loadoldconfigdata() - if instance.renewcache then - resolvers.saveoldconfig() - end - end - collapse_cnf_data() - end - check_configuration() +function resolvers.reset() + return resolvers.setinstance(resolvers.newinstance()) end -function resolvers.load_lua() - if #instance.luafiles == 0 then - -- yet harmless - else - instance.rootpath = instance.luafiles[1] - local luafiles = instance.luafiles - for k=1,#luafiles do - instance.luafiles[k] = file.collapse_path(luafiles[k]) - end - for i=1,3 do - instance.rootpath = file.dirname(instance.rootpath) - end - instance.rootpath = file.collapse_path(instance.rootpath) - resolvers.loadnewconfig() - collapse_cnf_data() - end - check_configuration() +local function reset_hashes() + instance.lists = { } + instance.found = { } end --- database loading +local slash = P("/") -function resolvers.load_hash() - resolvers.locatelists() - if instance.diskcache and not instance.renewcache then - resolvers.loadfiles() - if instance.loaderror then - resolvers.loadlists() - resolvers.savefiles() - end +local pathexpressionpattern = Cs ( + Cc("^") * ( + Cc("%") * S(".-") + + slash^2 * P(-1) / "/.*" + + slash^2 / "/.-/" + + (1-slash) * P(-1) * Cc("/") + + P(1) + )^1 * Cc("$") -- yes or no $ +) + +local cache = { } + +local function makepathexpression(str) + if str == "." then + return "^%./$" else - resolvers.loadlists() - if instance.renewcache then - resolvers.savefiles() + local c = cache[str] + if not c then + c = lpegmatch(pathexpressionpattern,str) + cache[str] = c end + return c end end -function resolvers.append_hash(type,tag,name) - if trace_locating then - logs.report("fileio","hash '%s' appended",tag) - end - insert(instance.hashes, { ['type']=type, ['tag']=tag, ['name']=name } ) -end - -function resolvers.prepend_hash(type,tag,name) +local function reportcriticalvariables() if trace_locating then - logs.report("fileio","hash '%s' prepended",tag) - end - insert(instance.hashes, 1, { ['type']=type, ['tag']=tag, ['name']=name } ) -end - -function resolvers.extend_texmf_var(specification) -- crap, we could better prepend the hash --- local t = resolvers.expanded_path_list('TEXMF') -- full expansion - local t = resolvers.split_path(resolvers.env('TEXMF')) - insert(t,1,specification) - local newspec = concat(t,";") - if instance.environment["TEXMF"] then - instance.environment["TEXMF"] = newspec - elseif instance.variables["TEXMF"] then - instance.variables["TEXMF"] = newspec - else - -- weird + for i=1,#resolvers.criticalvars do + local k = resolvers.criticalvars[i] + local v = resolvers.getenv(k) or "unknown" -- this one will not resolve ! + report_resolving("variable '%s' set to '%s'",k,v) + end + report_resolving() end - resolvers.expand_variables() - reset_hashes() + reportcriticalvariables = function() end end --- locators - -function resolvers.locatelists() - local texmfpaths = resolvers.clean_path_list('TEXMF') - for i=1,#texmfpaths do - local path = texmfpaths[i] +local function identify_configuration_files() + local specification = instance.specification + if #specification == 0 then + local cnfspec = getenv('TEXMFCNF') + if cnfspec == "" then + cnfspec = resolvers.luacnfspec + resolvers.luacnfstate = "default" + else + resolvers.luacnfstate = "environment" + end + reportcriticalvariables() + local cnfpaths = expandedpathfromlist(resolvers.splitpath(cnfspec)) + local luacnfname = resolvers.luacnfname + for i=1,#cnfpaths do + local filename = collapsepath(filejoin(cnfpaths[i],luacnfname)) + local realname = resolvers.resolve(filename) + if lfs.isfile(realname) then + specification[#specification+1] = filename + if trace_locating then + report_resolving("found configuration file '%s'",realname) + end + elseif trace_locating then + report_resolving("unknown configuration file '%s'",realname) + end + end if trace_locating then - logs.report("fileio","locating list of '%s'",path) + report_resolving() end - resolvers.locatedatabase(file.collapse_path(path)) - end -end - -function resolvers.locatedatabase(specification) - return resolvers.methodhandler('locators', specification) -end + elseif trace_locating then + report_resolving("configuration files already identified") + end +end + +local function load_configuration_files() + local specification = instance.specification + if #specification > 0 then + local luacnfname = resolvers.luacnfname + for i=1,#specification do + local filename = specification[i] + local pathname = filedirname(filename) + local filename = filejoin(pathname,luacnfname) + local realname = resolvers.resolve(filename) -- no shortcut + local blob = loadfile(realname) + if blob then + local setups = instance.setups + local data = blob() + data = data and data.content + if data then + if trace_locating then + report_resolving("loading configuration file '%s'",filename) + report_resolving() + end + local variables = data.variables or { } + local warning = false + for k, v in next, data do + local variant = type(v) + if variant == "table" then + initializesetter(filename,k,v) + elseif variables[k] == nil then + if trace_locating and not warning then + report_resolving("variables like '%s' in configuration file '%s' should move to the 'variables' subtable", + k,resolvers.resolve(filename)) + warning = true + end + variables[k] = v + end + end + setups[pathname] = variables + if resolvers.luacnfstate == "default" then + -- the following code is not tested + local cnfspec = variables["TEXMFCNF"] + if cnfspec then + if trace_locating then + report_resolving("reloading configuration due to TEXMF redefinition") + end + -- we push the value into the main environment (osenv) so + -- that it takes precedence over the default one and therefore + -- also over following definitions + resolvers.setenv('TEXMFCNF',cnfspec) -- resolves prefixes + -- we now identify and load the specified configuration files + instance.specification = { } + identify_configuration_files() + load_configuration_files() + -- we prevent further overload of the configuration variable + resolvers.luacnfstate = "configuration" + -- we quit the outer loop + break + end + end -function resolvers.locators.tex(specification) - if specification and specification ~= '' and lfs.isdir(specification) then - if trace_locating then - logs.report("fileio","tex locator '%s' found",specification) + else + if trace_locating then + report_resolving("skipping configuration file '%s' (no content)",filename) + end + setups[pathname] = { } + instance.loaderror = true + end + elseif trace_locating then + report_resolving("skipping configuration file '%s' (no file)",filename) + end + instance.order[#instance.order+1] = instance.setups[pathname] + if instance.loaderror then + break + end end - resolvers.append_hash('file',specification,filename) elseif trace_locating then - logs.report("fileio","tex locator '%s' not found",specification) + report_resolving("warning: no lua configuration files found") end end --- hashers - -function resolvers.hashdatabase(tag,name) - return resolvers.methodhandler('hashers',tag,name) -end +-- scheme magic ... database loading -function resolvers.loadfiles() - instance.loaderror = false - instance.files = { } +local function load_file_databases() + instance.loaderror, instance.files = false, allocate() if not instance.renewcache then local hashes = instance.hashes for k=1,#hashes do local hash = hashes[k] - resolvers.hashdatabase(hash.tag,hash.name) + resolvers.hashers.byscheme(hash.type,hash.name) if instance.loaderror then break end end end end -function resolvers.hashers.tex(tag,name) - resolvers.load_data(tag,'files') -end - --- generators: - -function resolvers.loadlists() - local hashes = instance.hashes - for i=1,#hashes do - resolvers.generatedatabase(hashes[i].tag) - end -end - -function resolvers.generatedatabase(specification) - return resolvers.methodhandler('generators', specification) -end - --- starting with . or .. etc or funny char - -local weird = lpeg.P(".")^1 + lpeg.anywhere(lpeg.S("~`!#$%^&*()={}[]:;\"\'||<>,?\n\r\t")) - ---~ local l_forbidden = lpeg.S("~`!#$%^&*()={}[]:;\"\'||\\/<>,?\n\r\t") ---~ local l_confusing = lpeg.P(" ") ---~ local l_character = lpeg.patterns.utf8 ---~ local l_dangerous = lpeg.P(".") - ---~ local l_normal = (l_character - l_forbidden - l_confusing - l_dangerous) * (l_character - l_forbidden - l_confusing^2)^0 * lpeg.P(-1) ---~ ----- l_normal = l_normal * lpeg.Cc(true) + lpeg.Cc(false) - ---~ local function test(str) ---~ print(str,lpeg.match(l_normal,str)) ---~ end ---~ test("ヒラギノ明朝 Pro W3") ---~ test("..ヒラギノ明朝 Pro W3") ---~ test(":ヒラギノ明朝 Pro W3;") ---~ test("ヒラギノ明朝 /Pro W3;") ---~ test("ヒラギノ明朝 Pro W3") - -function resolvers.generators.tex(specification) - local tag = specification - if trace_locating then - logs.report("fileio","scanning path '%s'",specification) - end - instance.files[tag] = { } - local files = instance.files[tag] - local n, m, r = 0, 0, 0 - local spec = specification .. '/' - local attributes = lfs.attributes - local directory = lfs.dir - local function action(path) - local full - if path then - full = spec .. path .. '/' - else - full = spec - end - for name in directory(full) do - if not lpegmatch(weird,name) then - -- if lpegmatch(l_normal,name) then - local mode = attributes(full..name,'mode') - if mode == 'file' then - if path then - n = n + 1 - local f = files[name] - if f then - if type(f) == 'string' then - files[name] = { f, path } - else - f[#f+1] = path - end - else -- probably unique anyway - files[name] = path - local lower = lower(name) - if name ~= lower then - files["remap:"..lower] = name - r = r + 1 - end - end - end - elseif mode == 'directory' then - m = m + 1 - if path then - action(path..'/'..name) +local function locate_file_databases() + -- todo: cache:// and tree:// (runtime) + local texmfpaths = resolvers.expandedpathlist('TEXMF') + if #texmfpaths > 0 then + for i=1,#texmfpaths do + local path = collapsepath(texmfpaths[i]) + local stripped = lpegmatch(inhibitstripper,path) -- the !! thing + if stripped ~= "" then + local runtime = stripped == path + path = resolvers.cleanpath(path) + local spec = resolvers.splitmethod(stripped) + if spec.scheme == "cache" or spec.scheme == "file" then + stripped = spec.path + elseif runtime and (spec.noscheme or spec.scheme == "file") then + stripped = "tree:///" .. stripped + end + if trace_locating then + if runtime then + report_resolving("locating list of '%s' (runtime)",path) else - action(name) + report_resolving("locating list of '%s' (cached)",path) end end + methodhandler('locators',stripped) end end - end - action() - if trace_locating then - logs.report("fileio","%s files found on %s directories with %s uppercase remappings",n,m,r) + if trace_locating then + report_resolving() + end + elseif trace_locating then + report_resolving("no texmf paths are defined (using TEXMF)") end end --- savers, todo - -function resolvers.savefiles() - resolvers.save_data('files') +local function generate_file_databases() + local hashes = instance.hashes + for k=1,#hashes do + local hash = hashes[k] + methodhandler('generators',hash.name) + end + if trace_locating then + report_resolving() + end end --- A config (optionally) has the paths split in tables. Internally --- we join them and split them after the expansion has taken place. This --- is more convenient. - ---~ local checkedsplit = string.checkedsplit - -local cache = { } - -local splitter = lpeg.Ct(lpeg.splitat(lpeg.S(os.type == "windows" and ";" or ":;"))) - -local function split_kpse_path(str) -- beware, this can be either a path or a {specification} - local found = cache[str] - if not found then - if str == "" then - found = { } - else - str = gsub(str,"\\","/") ---~ local split = (find(str,";") and checkedsplit(str,";")) or checkedsplit(str,io.pathseparator) -local split = lpegmatch(splitter,str) - found = { } - for i=1,#split do - local s = split[i] - if not find(s,"^{*unset}*") then - found[#found+1] = s - end - end - if trace_expansions then - logs.report("fileio","splitting path specification '%s'",str) - for k=1,#found do - logs.report("fileio","% 4i: %s",k,found[k]) - end +local function save_file_databases() -- will become cachers + for i=1,#instance.hashes do + local hash = instance.hashes[i] + local cachename = hash.name + if hash.cache then + local content = instance.files[cachename] + caches.collapsecontent(content) + if trace_locating then + report_resolving("saving tree '%s'",cachename) end - cache[str] = found + caches.savecontent(cachename,"files",content) + elseif trace_locating then + report_resolving("not saving runtime tree '%s'",cachename) end end - return found end -resolvers.split_kpse_path = split_kpse_path - -function resolvers.splitconfig() - for i=1,#instance do - local c = instance[i] - for k,v in next, c do - if type(v) == 'string' then - local t = split_kpse_path(v) - if #t > 1 then - c[k] = t - end - end +local function load_databases() + locate_file_databases() + if instance.diskcache and not instance.renewcache then + load_file_databases() + if instance.loaderror then + generate_file_databases() + save_file_databases() + end + else + generate_file_databases() + if instance.renewcache then + save_file_databases() end end end -function resolvers.joinconfig() - local order = instance.order - for i=1,#order do - local c = order[i] - for k,v in next, c do -- indexed? - if type(v) == 'table' then - c[k] = file.join_path(v) - end +function resolvers.appendhash(type,name,cache) + -- safeguard ... tricky as it's actually a bug when seen twice + if not instance.hashed[name] then + if trace_locating then + report_resolving("hash '%s' appended",name) end + insert(instance.hashes, { type = type, name = name, cache = cache } ) + instance.hashed[name] = cache end end -function resolvers.split_path(str) - if type(str) == 'table' then - return str - else - return split_kpse_path(str) +function resolvers.prependhash(type,name,cache) + -- safeguard ... tricky as it's actually a bug when seen twice + if not instance.hashed[name] then + if trace_locating then + report_resolving("hash '%s' prepended",name) + end + insert(instance.hashes, 1, { type = type, name = name, cache = cache } ) + instance.hashed[name] = cache end end -function resolvers.join_path(str) - if type(str) == 'table' then - return file.join_path(str) +function resolvers.extendtexmfvariable(specification) -- crap, we could better prepend the hash + local t = resolvers.splitpath(getenv('TEXMF')) + insert(t,1,specification) + local newspec = concat(t,";") + if instance.environment["TEXMF"] then + instance.environment["TEXMF"] = newspec + elseif instance.variables["TEXMF"] then + instance.variables["TEXMF"] = newspec else - return str + -- weird end + reset_hashes() end function resolvers.splitexpansions() local ie = instance.expansions for k,v in next, ie do - local t, h, p = { }, { }, split_kpse_path(v) + local t, tn, h, p = { }, 0, { }, splitconfigurationpath(v) for kk=1,#p do local vv = p[kk] if vv ~= "" and not h[vv] then - t[#t+1] = vv + tn = tn + 1 + t[tn] = vv h[vv] = true end end @@ -9184,343 +11600,92 @@ end -- end of split/join code -function resolvers.saveoldconfig() - resolvers.splitconfig() - resolvers.save_data('configuration') - resolvers.joinconfig() -end - -resolvers.configbanner = [[ --- This is a Luatex configuration file created by 'luatools.lua' or --- 'luatex.exe' directly. For comment, suggestions and questions you can --- contact the ConTeXt Development Team. This configuration file is --- not copyrighted. [HH & TH] -]] - -function resolvers.serialize(files) - -- This version is somewhat optimized for the kind of - -- tables that we deal with, so it's much faster than - -- the generic serializer. This makes sense because - -- luatools and mtxtools are called frequently. Okay, - -- we pay a small price for properly tabbed tables. - local t = { } - local function dump(k,v,m) -- could be moved inline - if type(v) == 'string' then - return m .. "['" .. k .. "']='" .. v .. "'," - elseif #v == 1 then - return m .. "['" .. k .. "']='" .. v[1] .. "'," - else - return m .. "['" .. k .. "']={'" .. concat(v,"','").. "'}," - end - end - t[#t+1] = "return {" - if instance.sortdata then - local sortedfiles = sortedkeys(files) - for i=1,#sortedfiles do - local k = sortedfiles[i] - local fk = files[k] - if type(fk) == 'table' then - t[#t+1] = "\t['" .. k .. "']={" - local sortedfk = sortedkeys(fk) - for j=1,#sortedfk do - local kk = sortedfk[j] - t[#t+1] = dump(kk,fk[kk],"\t\t") - end - t[#t+1] = "\t}," - else - t[#t+1] = dump(k,fk,"\t") - end - end - else - for k, v in next, files do - if type(v) == 'table' then - t[#t+1] = "\t['" .. k .. "']={" - for kk,vv in next, v do - t[#t+1] = dump(kk,vv,"\t\t") - end - t[#t+1] = "\t}," - else - t[#t+1] = dump(k,v,"\t") - end - end - end - t[#t+1] = "}" - return concat(t,"\n") -end - -local data_state = { } - -function resolvers.data_state() - return data_state or { } -end - -function resolvers.save_data(dataname, makename) -- untested without cache overload - for cachename, files in next, instance[dataname] do - local name = (makename or file.join)(cachename,dataname) - local luaname, lucname = name .. ".lua", name .. ".luc" - if trace_locating then - logs.report("fileio","preparing '%s' for '%s'",dataname,cachename) - end - for k, v in next, files do - if type(v) == "table" and #v == 1 then - files[k] = v[1] - end - end - local data = { - type = dataname, - root = cachename, - version = resolvers.cacheversion, - date = os.date("%Y-%m-%d"), - time = os.date("%H:%M:%S"), - content = files, - uuid = os.uuid(), - } - local ok = io.savedata(luaname,resolvers.serialize(data)) - if ok then - if trace_locating then - logs.report("fileio","'%s' saved in '%s'",dataname,luaname) - end - if utils.lua.compile(luaname,lucname,false,true) then -- no cleanup but strip - if trace_locating then - logs.report("fileio","'%s' compiled to '%s'",dataname,lucname) - end - else - if trace_locating then - logs.report("fileio","compiling failed for '%s', deleting file '%s'",dataname,lucname) - end - os.remove(lucname) - end - elseif trace_locating then - logs.report("fileio","unable to save '%s' in '%s' (access error)",dataname,luaname) - end - end -end - -function resolvers.load_data(pathname,dataname,filename,makename) -- untested without cache overload - filename = ((not filename or (filename == "")) and dataname) or filename - filename = (makename and makename(dataname,filename)) or file.join(pathname,filename) - local blob = loadfile(filename .. ".luc") or loadfile(filename .. ".lua") - if blob then - local data = blob() - if data and data.content and data.type == dataname and data.version == resolvers.cacheversion then - data_state[#data_state+1] = data.uuid - if trace_locating then - logs.report("fileio","loading '%s' for '%s' from '%s'",dataname,pathname,filename) - end - instance[dataname][pathname] = data.content - else - if trace_locating then - logs.report("fileio","skipping '%s' for '%s' from '%s'",dataname,pathname,filename) - end - instance[dataname][pathname] = { } - instance.loaderror = true - end - elseif trace_locating then - logs.report("fileio","skipping '%s' for '%s' from '%s'",dataname,pathname,filename) - end -end - --- some day i'll use the nested approach, but not yet (actually we even drop --- engine/progname support since we have only luatex now) --- --- first texmfcnf.lua files are located, next the cached texmf.cnf files --- --- return { --- TEXMFBOGUS = 'effe checken of dit werkt', --- } - -function resolvers.resetconfig() - identify_own() - instance.configuration, instance.setup, instance.order, instance.loaderror = { }, { }, { }, false -end - -function resolvers.loadnewconfig() - local luafiles = instance.luafiles - for i=1,#luafiles do - local cnf = luafiles[i] - local pathname = file.dirname(cnf) - local filename = file.join(pathname,resolvers.luaname) - local blob = loadfile(filename) - if blob then - local data = blob() - if data then - if trace_locating then - logs.report("fileio","loading configuration file '%s'",filename) - end - if true then - -- flatten to variable.progname - local t = { } - for k, v in next, data do -- v = progname - if type(v) == "string" then - t[k] = v - else - for kk, vv in next, v do -- vv = variable - if type(vv) == "string" then - t[vv.."."..v] = kk - end - end - end - end - instance['setup'][pathname] = t - else - instance['setup'][pathname] = data - end - else - if trace_locating then - logs.report("fileio","skipping configuration file '%s'",filename) - end - instance['setup'][pathname] = { } - instance.loaderror = true - end - elseif trace_locating then - logs.report("fileio","skipping configuration file '%s'",filename) - end - instance.order[#instance.order+1] = instance.setup[pathname] - if instance.loaderror then break end - end -end - -function resolvers.loadoldconfig() - if not instance.renewcache then - local cnffiles = instance.cnffiles - for i=1,#cnffiles do - local cnf = cnffiles[i] - local dname = file.dirname(cnf) - resolvers.load_data(dname,'configuration') - instance.order[#instance.order+1] = instance.configuration[dname] - if instance.loaderror then break end - end - end - resolvers.joinconfig() -end +-- we used to have 'files' and 'configurations' so therefore the following +-- shared function -function resolvers.expand_variables() - local expansions, environment, variables = { }, instance.environment, instance.variables - local env = resolvers.env - instance.expansions = expansions - local engine, progname = instance.engine, instance.progname - if type(engine) ~= "string" then instance.engine, engine = "", "" end - if type(progname) ~= "string" then instance.progname, progname = "", "" end - if engine ~= "" then environment['engine'] = engine end - if progname ~= "" then environment['progname'] = progname end - for k,v in next, environment do - local a, b = match(k,"^(%a+)%_(.*)%s*$") - if a and b then - expansions[a..'.'..b] = v - else - expansions[k] = v - end - end - for k,v in next, environment do -- move environment to expansions - if not expansions[k] then expansions[k] = v end - end - for k,v in next, variables do -- move variables to expansions - if not expansions[k] then expansions[k] = v end - end - local busy = false - local function resolve(a) - busy = true - return expansions[a] or env(a) - end - while true do - busy = false - for k,v in next, expansions do - local s, n = gsub(v,"%$([%a%d%_%-]+)",resolve) - local s, m = gsub(s,"%$%{([%a%d%_%-]+)%}",resolve) - if n > 0 or m > 0 then - expansions[k]= s - end - end - if not busy then break end - end - for k,v in next, expansions do - expansions[k] = gsub(v,"\\", '/') - end +function resolvers.datastate() + return caches.contentstate() end function resolvers.variable(name) - return entry(instance.variables,name) + local name = name and lpegmatch(dollarstripper,name) + local result = name and instance.variables[name] + return result ~= nil and result or "" end function resolvers.expansion(name) - return entry(instance.expansions,name) -end - -function resolvers.is_variable(name) - return is_entry(instance.variables,name) -end - -function resolvers.is_expansion(name) - return is_entry(instance.expansions,name) + local name = name and lpegmatch(dollarstripper,name) + local result = name and instance.expansions[name] + return result ~= nil and result or "" end -function resolvers.unexpanded_path_list(str) +function resolvers.unexpandedpathlist(str) local pth = resolvers.variable(str) - local lst = resolvers.split_path(pth) - return expanded_path_from_list(lst) + local lst = resolvers.splitpath(pth) + return expandedpathfromlist(lst) end -function resolvers.unexpanded_path(str) - return file.join_path(resolvers.unexpanded_path_list(str)) +function resolvers.unexpandedpath(str) + return joinpath(resolvers.unexpandedpathlist(str)) end -do -- no longer needed - - local done = { } +local done = { } - function resolvers.reset_extra_path() - local ep = instance.extra_paths - if not ep then - ep, done = { }, { } - instance.extra_paths = ep - elseif #ep > 0 then - instance.lists, done = { }, { } - end +function resolvers.resetextrapath() + local ep = instance.extra_paths + if not ep then + ep, done = { }, { } + instance.extra_paths = ep + elseif #ep > 0 then + instance.lists, done = { }, { } end +end - function resolvers.register_extra_path(paths,subpaths) - local ep = instance.extra_paths or { } - local n = #ep - if paths and paths ~= "" then - if subpaths and subpaths ~= "" then - for p in gmatch(paths,"[^,]+") do - -- we gmatch each step again, not that fast, but used seldom - for s in gmatch(subpaths,"[^,]+") do - local ps = p .. "/" .. s - if not done[ps] then - ep[#ep+1] = resolvers.clean_path(ps) - done[ps] = true - end - end - end - else - for p in gmatch(paths,"[^,]+") do - if not done[p] then - ep[#ep+1] = resolvers.clean_path(p) - done[p] = true - end - end - end - elseif subpaths and subpaths ~= "" then - for i=1,n do +function resolvers.registerextrapath(paths,subpaths) + local ep = instance.extra_paths or { } + local oldn = #ep + local newn = oldn + if paths and paths ~= "" then + if subpaths and subpaths ~= "" then + for p in gmatch(paths,"[^,]+") do -- we gmatch each step again, not that fast, but used seldom for s in gmatch(subpaths,"[^,]+") do - local ps = ep[i] .. "/" .. s + local ps = p .. "/" .. s if not done[ps] then - ep[#ep+1] = resolvers.clean_path(ps) + newn = newn + 1 + ep[newn] = resolvers.cleanpath(ps) done[ps] = true end end end + else + for p in gmatch(paths,"[^,]+") do + if not done[p] then + newn = newn + 1 + ep[newn] = resolvers.cleanpath(p) + done[p] = true + end + end end - if #ep > 0 then - instance.extra_paths = ep -- register paths - end - if #ep > n then - instance.lists = { } -- erase the cache + elseif subpaths and subpaths ~= "" then + for i=1,oldn do + -- we gmatch each step again, not that fast, but used seldom + for s in gmatch(subpaths,"[^,]+") do + local ps = ep[i] .. "/" .. s + if not done[ps] then + newn = newn + 1 + ep[newn] = resolvers.cleanpath(ps) + done[ps] = true + end + end end end - + if newn > 0 then + instance.extra_paths = ep -- register paths + end + if newn > oldn then + instance.lists = { } -- erase the cache + end end local function made_list(instance,list) @@ -9528,14 +11693,15 @@ local function made_list(instance,list) if not ep or #ep == 0 then return list else - local done, new = { }, { } + local done, new, newn = { }, { }, 0 -- honour . .. ../.. but only when at the start for k=1,#list do local v = list[k] if not done[v] then if find(v,"^[%.%/]$") then done[v] = true - new[#new+1] = v + newn = newn + 1 + new[newn] = v else break end @@ -9546,7 +11712,8 @@ local function made_list(instance,list) local v = ep[k] if not done[v] then done[v] = true - new[#new+1] = v + newn = newn + 1 + new[newn] = v end end -- next the formal paths @@ -9554,118 +11721,95 @@ local function made_list(instance,list) local v = list[k] if not done[v] then done[v] = true - new[#new+1] = v + newn = newn + 1 + new[newn] = v end end return new end end -function resolvers.clean_path_list(str) - local t = resolvers.expanded_path_list(str) +function resolvers.cleanpathlist(str) + local t = resolvers.expandedpathlist(str) if t then for i=1,#t do - t[i] = file.collapse_path(resolvers.clean_path(t[i])) + t[i] = collapsepath(resolvers.cleanpath(t[i])) end end return t end -function resolvers.expand_path(str) - return file.join_path(resolvers.expanded_path_list(str)) +function resolvers.expandpath(str) + return joinpath(resolvers.expandedpathlist(str)) end -function resolvers.expanded_path_list(str) +function resolvers.expandedpathlist(str) if not str then - return ep or { } -- ep ? + return { } elseif instance.savelists then - -- engine+progname hash - str = gsub(str,"%$","") + str = lpegmatch(dollarstripper,str) if not instance.lists[str] then -- cached - local lst = made_list(instance,resolvers.split_path(resolvers.expansion(str))) - instance.lists[str] = expanded_path_from_list(lst) + local lst = made_list(instance,resolvers.splitpath(resolvers.expansion(str))) + instance.lists[str] = expandedpathfromlist(lst) end return instance.lists[str] else - local lst = resolvers.split_path(resolvers.expansion(str)) - return made_list(instance,expanded_path_from_list(lst)) - end -end - -function resolvers.expanded_path_list_from_var(str) -- brrr - local tmp = resolvers.var_of_format_or_suffix(gsub(str,"%$","")) - if tmp ~= "" then - return resolvers.expanded_path_list(tmp) - else - return resolvers.expanded_path_list(str) + local lst = resolvers.splitpath(resolvers.expansion(str)) + return made_list(instance,expandedpathfromlist(lst)) end end -function resolvers.expand_path_from_var(str) - return file.join_path(resolvers.expanded_path_list_from_var(str)) +function resolvers.expandedpathlistfromvariable(str) -- brrr + str = lpegmatch(dollarstripper,str) + local tmp = resolvers.variableofformatorsuffix(str) + return resolvers.expandedpathlist(tmp ~= "" and tmp or str) end -function resolvers.format_of_var(str) - return formats[str] or formats[alternatives[str]] or '' -end -function resolvers.format_of_suffix(str) - return suffixmap[file.extname(str)] or 'tex' +function resolvers.expandpathfromvariable(str) + return joinpath(resolvers.expandedpathlistfromvariable(str)) end -function resolvers.variable_of_format(str) - return formats[str] or formats[alternatives[str]] or '' +function resolvers.expandbraces(str) -- output variable and brace expansion of STRING + local ori = resolvers.variable(str) + local pth = expandedpathfromlist(resolvers.splitpath(ori)) + return joinpath(pth) end -function resolvers.var_of_format_or_suffix(str) - local v = formats[str] - if v then - return v - end - v = formats[alternatives[str]] - if v then - return v - end - v = suffixmap[file.extname(str)] - if v then - return formats[isf] +function resolvers.registerfilehash(name,content,someerror) + if content then + instance.files[name] = content + else + instance.files[name] = { } + if somerror == true then -- can be unset + instance.loaderror = someerror + end end - return '' -end - -function resolvers.expand_braces(str) -- output variable and brace expansion of STRING - local ori = resolvers.variable(str) - local pth = expanded_path_from_list(resolvers.split_path(ori)) - return file.join_path(pth) end -resolvers.isreadable = { } - -function resolvers.isreadable.file(name) - local readable = lfs.isfile(name) -- brrr +local function isreadable(name) + local readable = lfs.isfile(name) -- not file.is_readable(name) asit can be a dir if trace_detail then if readable then - logs.report("fileio","file '%s' is readable",name) + report_resolving("file '%s' is readable",name) else - logs.report("fileio","file '%s' is not readable", name) + report_resolving("file '%s' is not readable", name) end end return readable end -resolvers.isreadable.tex = resolvers.isreadable.file - -- name -- name/name local function collect_files(names) - local filelist = { } + local filelist, noffiles = { }, 0 for k=1,#names do local fname = names[k] if trace_detail then - logs.report("fileio","checking name '%s'",fname) + report_resolving("checking name '%s'",fname) end - local bname = file.basename(fname) - local dname = file.dirname(fname) + local bname = filebasename(fname) + local dname = filedirname(fname) if dname == "" or find(dname,"^%.") then dname = false else @@ -9674,11 +11818,11 @@ local function collect_files(names) local hashes = instance.hashes for h=1,#hashes do local hash = hashes[h] - local blobpath = hash.tag + local blobpath = hash.name local files = blobpath and instance.files[blobpath] if files then if trace_detail then - logs.report("fileio","deep checking '%s' (%s)",blobpath,bname) + report_resolving("deep checking '%s' (%s)",blobpath,bname) end local blobfile = files[bname] if not blobfile then @@ -9690,62 +11834,51 @@ local function collect_files(names) end end if blobfile then + local blobroot = files.__path__ or blobpath if type(blobfile) == 'string' then if not dname or find(blobfile,dname) then - filelist[#filelist+1] = { - hash.type, - file.join(blobpath,blobfile,bname), -- search - resolvers.concatinators[hash.type](blobpath,blobfile,bname) -- result - } + local variant = hash.type + -- local search = filejoin(blobpath,blobfile,bname) + local search = filejoin(blobroot,blobfile,bname) + local result = methodhandler('concatinators',hash.type,blobroot,blobfile,bname) + if trace_detail then + report_resolving("match: variant '%s', search '%s', result '%s'",variant,search,result) + end + noffiles = noffiles + 1 + filelist[noffiles] = { variant, search, result } end else for kk=1,#blobfile do local vv = blobfile[kk] if not dname or find(vv,dname) then - filelist[#filelist+1] = { - hash.type, - file.join(blobpath,vv,bname), -- search - resolvers.concatinators[hash.type](blobpath,vv,bname) -- result - } + local variant = hash.type + -- local search = filejoin(blobpath,vv,bname) + local search = filejoin(blobroot,vv,bname) + local result = methodhandler('concatinators',hash.type,blobroot,vv,bname) + if trace_detail then + report_resolving("match: variant '%s', search '%s', result '%s'",variant,search,result) + end + noffiles = noffiles + 1 + filelist[noffiles] = { variant, search, result } end end end end elseif trace_locating then - logs.report("fileio","no match in '%s' (%s)",blobpath,bname) + report_resolving("no match in '%s' (%s)",blobpath,bname) end end end - if #filelist > 0 then - return filelist - else - return nil - end -end - -function resolvers.suffix_of_format(str) - if suffixes[str] then - return suffixes[str][1] - else - return "" - end -end - -function resolvers.suffixes_of_format(str) - if suffixes[str] then - return suffixes[str] - else - return {} - end + return noffiles > 0 and filelist or nil end -function resolvers.register_in_trees(name) +function resolvers.registerintrees(name) if not find(name,"^%.") then instance.foundintrees[name] = (instance.foundintrees[name] or 0) + 1 -- maybe only one end end --- split the next one up for readability (bu this module needs a cleanup anyway) +-- split the next one up for readability (but this module needs a cleanup anyway) local function can_be_dir(name) -- can become local local fakepaths = instance.fakepaths @@ -9756,61 +11889,62 @@ local function can_be_dir(name) -- can become local fakepaths[name] = 2 -- no directory end end - return (fakepaths[name] == 1) + return fakepaths[name] == 1 end -local function collect_instance_files(filename,collected) -- todo : plugin (scanners, checkers etc) - local result = collected or { } +local preparetreepattern = Cs((P(".")/"%%." + P("-")/"%%-" + P(1))^0 * Cc("$")) + +-- this one is split in smaller functions but it needs testing + +local function collect_instance_files(filename,askedformat,allresults) -- todo : plugin (scanners, checkers etc) + local result = { } local stamp = nil - filename = file.collapse_path(filename) + askedformat = askedformat or "" + filename = collapsepath(filename) -- speed up / beware: format problem - if instance.remember then - stamp = filename .. "--" .. instance.engine .. "--" .. instance.progname .. "--" .. instance.format + if instance.remember and not allresults then + stamp = filename .. "--" .. askedformat if instance.found[stamp] then if trace_locating then - logs.report("fileio","remembering file '%s'",filename) + report_resolving("remembered file '%s'",filename) end + resolvers.registerintrees(filename) -- for tracing used files return instance.found[stamp] end end - if not dangerous[instance.format or "?"] then - if resolvers.isreadable.file(filename) then + if not dangerous[askedformat] then + if isreadable(filename) then if trace_detail then - logs.report("fileio","file '%s' found directly",filename) + report_resolving("file '%s' found directly",filename) + end + if stamp then + instance.found[stamp] = { filename } end - instance.found[stamp] = { filename } return { filename } end end if find(filename,'%*') then if trace_locating then - logs.report("fileio","checking wildcard '%s'", filename) + report_resolving("checking wildcard '%s'", filename) end - result = resolvers.find_wildcard_files(filename) + result = resolvers.findwildcardfiles(filename) -- we can use th elocal elseif file.is_qualified_path(filename) then - if resolvers.isreadable.file(filename) then + if isreadable(filename) then if trace_locating then - logs.report("fileio","qualified name '%s'", filename) + report_resolving("qualified name '%s'", filename) end result = { filename } else - local forcedname, ok, suffix = "", false, file.extname(filename) + local forcedname, ok, suffix = "", false, fileextname(filename) if suffix == "" then -- why - if instance.format == "" then - forcedname = filename .. ".tex" - if resolvers.isreadable.file(forcedname) then - if trace_locating then - logs.report("fileio","no suffix, forcing standard filetype 'tex'") - end - result, ok = { forcedname }, true - end - else - local suffixes = resolvers.suffixes_of_format(instance.format) - for _, s in next, suffixes do + local format_suffixes = askedformat == "" and resolvers.defaultsuffixes or suffixes[askedformat] + if format_suffixes then + for i=1,#format_suffixes do + local s = format_suffixes[i] forcedname = filename .. "." .. s - if resolvers.isreadable.file(forcedname) then + if isreadable(forcedname) then if trace_locating then - logs.report("fileio","no suffix, forcing format filetype '%s'", s) + report_resolving("no suffix, forcing format filetype '%s'", s) end result, ok = { forcedname }, true break @@ -9821,23 +11955,24 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan if not ok and suffix ~= "" then -- try to find in tree (no suffix manipulation), here we search for the -- matching last part of the name - local basename = file.basename(filename) - local pattern = gsub(filename .. "$","([%.%-])","%%%1") - local savedformat = instance.format + local basename = filebasename(filename) + local pattern = lpegmatch(preparetreepattern,filename) + -- messy .. to be sorted out + local savedformat = askedformat local format = savedformat or "" if format == "" then - instance.format = resolvers.format_of_suffix(suffix) + askedformat = resolvers.formatofsuffix(suffix) end if not format then - instance.format = "othertextfiles" -- kind of everything, maybe texinput is better + askedformat = "othertextfiles" -- kind of everything, maybe texinput is better end -- if basename ~= filename then - local resolved = collect_instance_files(basename) - if #result == 0 then + local resolved = collect_instance_files(basename,askedformat,allresults) + if #result == 0 then -- shouldn't this be resolved ? local lowered = lower(basename) if filename ~= lowered then - resolved = collect_instance_files(lowered) + resolved = collect_instance_files(lowered,askedformat,allresults) end end resolvers.format = savedformat @@ -9862,57 +11997,60 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan -- end end if not ok and trace_locating then - logs.report("fileio","qualified name '%s'", filename) + report_resolving("qualified name '%s'", filename) end end else -- search spec - local filetype, extra, done, wantedfiles, ext = '', nil, false, { }, file.extname(filename) - if ext == "" then - if not instance.force_suffixes then - wantedfiles[#wantedfiles+1] = filename - end - else - wantedfiles[#wantedfiles+1] = filename - end - if instance.format == "" then - if ext == "" then - local forcedname = filename .. '.tex' - wantedfiles[#wantedfiles+1] = forcedname - filetype = resolvers.format_of_suffix(forcedname) - if trace_locating then - logs.report("fileio","forcing filetype '%s'",filetype) + local filetype, done, wantedfiles, ext = '', false, { }, fileextname(filename) + -- -- tricky as filename can be bla.1.2.3 + -- if not suffixmap[ext] then --- probably needs to be done elsewhere too + -- wantedfiles[#wantedfiles+1] = filename + -- end + wantedfiles[#wantedfiles+1] = filename + if askedformat == "" then + if ext == "" or not suffixmap[ext] then + local defaultsuffixes = resolvers.defaultsuffixes + for i=1,#defaultsuffixes do + local forcedname = filename .. '.' .. defaultsuffixes[i] + wantedfiles[#wantedfiles+1] = forcedname + filetype = resolvers.formatofsuffix(forcedname) + if trace_locating then + report_resolving("forcing filetype '%s'",filetype) + end end else - filetype = resolvers.format_of_suffix(filename) + filetype = resolvers.formatofsuffix(filename) if trace_locating then - logs.report("fileio","using suffix based filetype '%s'",filetype) + report_resolving("using suffix based filetype '%s'",filetype) end end else - if ext == "" then - local suffixes = resolvers.suffixes_of_format(instance.format) - for _, s in next, suffixes do - wantedfiles[#wantedfiles+1] = filename .. "." .. s + if ext == "" or not suffixmap[ext] then + local format_suffixes = suffixes[askedformat] + if format_suffixes then + for i=1,#format_suffixes do + wantedfiles[#wantedfiles+1] = filename .. "." .. format_suffixes[i] + end end end - filetype = instance.format + filetype = askedformat if trace_locating then - logs.report("fileio","using given filetype '%s'",filetype) + report_resolving("using given filetype '%s'",filetype) end end - local typespec = resolvers.variable_of_format(filetype) - local pathlist = resolvers.expanded_path_list(typespec) + local typespec = resolvers.variableofformat(filetype) + local pathlist = resolvers.expandedpathlist(typespec) if not pathlist or #pathlist == 0 then -- no pathlist, access check only / todo == wildcard if trace_detail then - logs.report("fileio","checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | ")) + report_resolving("checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | ")) end for k=1,#wantedfiles do local fname = wantedfiles[k] - if fname and resolvers.isreadable.file(fname) then + if fname and isreadable(fname) then filename, done = fname, true - result[#result+1] = file.join('.',fname) + result[#result+1] = filejoin('.',fname) break end end @@ -9920,8 +12058,8 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan local filelist = collect_files(wantedfiles) local fl = filelist and filelist[1] if fl then - filename = fl[3] - result[#result+1] = filename + filename = fl[3] -- not local? + result[#result+1] = resolvers.resolve(filename) done = true end else @@ -9930,76 +12068,65 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan local dirlist = { } if filelist then for i=1,#filelist do - dirlist[i] = file.dirname(filelist[i][2]) .. "/" + dirlist[i] = filedirname(filelist[i][3]) .. "/" -- was [2] .. gamble end end if trace_detail then - logs.report("fileio","checking filename '%s'",filename) + report_resolving("checking filename '%s'",filename) end - -- a bit messy ... esp the doscan setting here - local doscan for k=1,#pathlist do local path = pathlist[k] - if find(path,"^!!") then doscan = false else doscan = true end - local pathname = gsub(path,"^!+", '') + local pathname = lpegmatch(inhibitstripper,path) + local doscan = path == pathname -- no ^!! done = false -- using file list if filelist then - local expression -- compare list entries with permitted pattern -- /xx /xx// - if not find(pathname,"/$") then - expression = pathname .. "/" - else - expression = pathname - end - expression = gsub(expression,"([%-%.])","%%%1") -- this also influences - expression = gsub(expression,"//+$", '/.*') -- later usage of pathname - expression = gsub(expression,"//", '/.-/') -- not ok for /// but harmless - expression = "^" .. expression .. "$" + local expression = makepathexpression(pathname) if trace_detail then - logs.report("fileio","using pattern '%s' for path '%s'",expression,pathname) + report_resolving("using pattern '%s' for path '%s'",expression,pathname) end for k=1,#filelist do local fl = filelist[k] local f = fl[2] local d = dirlist[k] if find(d,expression) then - --- todo, test for readable - result[#result+1] = fl[3] - resolvers.register_in_trees(f) -- for tracing used files + -- todo, test for readable + result[#result+1] = resolvers.resolve(fl[3]) -- no shortcut done = true - if instance.allresults then + if allresults then if trace_detail then - logs.report("fileio","match in hash for file '%s' on path '%s', continue scanning",f,d) + report_resolving("match to '%s' in hash for file '%s' and path '%s', continue scanning",expression,f,d) end else if trace_detail then - logs.report("fileio","match in hash for file '%s' on path '%s', quit scanning",f,d) + report_resolving("match to '%s' in hash for file '%s' and path '%s', quit scanning",expression,f,d) end break end elseif trace_detail then - logs.report("fileio","no match in hash for file '%s' on path '%s'",f,d) + report_resolving("no match to '%s' in hash for file '%s' and path '%s'",expression,f,d) end end end if not done and doscan then -- check if on disk / unchecked / does not work at all / also zips - if resolvers.splitmethod(pathname).scheme == 'file' then -- ? + local scheme = url.hasscheme(pathname) + if not scheme or scheme == "file" then local pname = gsub(pathname,"%.%*$",'') if not find(pname,"%*") then local ppname = gsub(pname,"/+$","") if can_be_dir(ppname) then for k=1,#wantedfiles do local w = wantedfiles[k] - local fname = file.join(ppname,w) - if resolvers.isreadable.file(fname) then + local fname = filejoin(ppname,w) + if isreadable(fname) then if trace_detail then - logs.report("fileio","found '%s' by scanning",fname) + report_resolving("found '%s' by scanning",fname) end result[#result+1] = fname done = true - if not instance.allresults then break end + if not allresults then break end end end else @@ -10009,56 +12136,66 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan end end if not done and doscan then - -- todo: slow path scanning + -- todo: slow path scanning ... although we now have tree:// supported in $TEXMF end - if done and not instance.allresults then break end + if done and not allresults then break end end end end for k=1,#result do - result[k] = file.collapse_path(result[k]) + local rk = collapsepath(result[k]) + result[k] = rk + resolvers.registerintrees(rk) -- for tracing used files end - if instance.remember then + if stamp then instance.found[stamp] = result end return result end -if not resolvers.concatinators then resolvers.concatinators = { } end +-- -- -- begin of main file search routing -- -- -- -resolvers.concatinators.tex = file.join -resolvers.concatinators.file = resolvers.concatinators.tex -function resolvers.find_files(filename,filetype,mustexist) - if type(mustexist) == boolean then - -- all set - elseif type(filetype) == 'boolean' then - filetype, mustexist = nil, false - elseif type(filetype) ~= 'string' then - filetype, mustexist = nil, false - end - instance.format = filetype or '' - local result = collect_instance_files(filename) + + + + + + + + +-- -- -- end of main file search routing -- -- -- + +local function findfiles(filename,filetype,allresults) + local result = collect_instance_files(filename,filetype or "",allresults) if #result == 0 then local lowered = lower(filename) if filename ~= lowered then - return collect_instance_files(lowered) + return collect_instance_files(lowered,filetype or "",allresults) end end - instance.format = '' return result end -function resolvers.find_file(filename,filetype,mustexist) - return (resolvers.find_files(filename,filetype,mustexist)[1] or "") +function resolvers.findfiles(filename,filetype) + return findfiles(filename,filetype,true) +end + +function resolvers.findfile(filename,filetype) + return findfiles(filename,filetype,false)[1] or "" +end + +function resolvers.findpath(filename,filetype) + return filedirname(findfiles(filename,filetype,false)[1] or "") end -function resolvers.find_given_files(filename) - local bname, result = file.basename(filename), { } +local function findgivenfiles(filename,allresults) + local bname, result = filebasename(filename), { } local hashes = instance.hashes + local noffound = 0 for k=1,#hashes do local hash = hashes[k] - local files = instance.files[hash.tag] or { } + local files = instance.files[hash.name] or { } local blist = files[bname] if not blist then local rname = "remap:"..bname @@ -10070,13 +12207,21 @@ function resolvers.find_given_files(filename) end if blist then if type(blist) == 'string' then - result[#result+1] = resolvers.concatinators[hash.type](hash.tag,blist,bname) or "" - if not instance.allresults then break end + local found = methodhandler('concatinators',hash.type,hash.name,blist,bname) or "" + if found ~= "" then + noffound = noffound + 1 + result[noffound] = resolvers.resolve(found) + if not allresults then break end + end else for kk=1,#blist do local vv = blist[kk] - result[#result+1] = resolvers.concatinators[hash.type](hash.tag,vv,bname) or "" - if not instance.allresults then break end + local found = methodhandler('concatinators',hash.type,hash.name,vv,bname) or "" + if found ~= "" then + noffound = noffound + 1 + result[noffound] = resolvers.resolve(found) + if not allresults then break end + end end end end @@ -10084,24 +12229,31 @@ function resolvers.find_given_files(filename) return result end -function resolvers.find_given_file(filename) - return (resolvers.find_given_files(filename)[1] or "") +function resolvers.findgivenfiles(filename) + return findgivenfiles(filename,true) end -local function doit(path,blist,bname,tag,kind,result,allresults) +function resolvers.findgivenfile(filename) + return findgivenfiles(filename,false)[1] or "" +end + +local function doit(path,blist,bname,tag,variant,result,allresults) local done = false - if blist and kind then + if blist and variant then + local resolve = resolvers.resolve -- added if type(blist) == 'string' then -- make function and share code if find(lower(blist),path) then - result[#result+1] = resolvers.concatinators[kind](tag,blist,bname) or "" + local full = methodhandler('concatinators',variant,tag,blist,bname) or "" + result[#result+1] = resolve(full) done = true end else for kk=1,#blist do local vv = blist[kk] if find(lower(vv),path) then - result[#result+1] = resolvers.concatinators[kind](tag,vv,bname) or "" + local full = methodhandler('concatinators',variant,tag,vv,bname) or "" + result[#result+1] = resolve(full) done = true if not allresults then break end end @@ -10111,30 +12263,32 @@ local function doit(path,blist,bname,tag,kind,result,allresults) return done end -function resolvers.find_wildcard_files(filename) -- todo: remap: - local result = { } - local bname, dname = file.basename(filename), file.dirname(filename) - local path = gsub(dname,"^*/","") - path = gsub(path,"*",".*") - path = gsub(path,"-","%%-") - if dname == "" then - path = ".*" - end - local name = bname - name = gsub(name,"*",".*") - name = gsub(name,"-","%%-") - path = lower(path) - name = lower(name) - local files, allresults, done = instance.files, instance.allresults, false + +local makewildcard = Cs( + (P("^")^0 * P("/") * P(-1) + P(-1)) /".*" + + (P("^")^0 * P("/") / "")^0 * (P("*")/".*" + P("-")/"%%-" + P(".")/"%%." + P("?")/"."+ P("\\")/"/" + P(1))^0 +) + +function resolvers.wildcardpattern(pattern) + return lpegmatch(makewildcard,pattern) or pattern +end + +local function findwildcardfiles(filename,allresults,result) -- todo: remap: and lpeg + result = result or { } + local base = filebasename(filename) + local dirn = filedirname(filename) + local path = lower(lpegmatch(makewildcard,dirn) or dirn) + local name = lower(lpegmatch(makewildcard,base) or base) + local files, done = instance.files, false if find(name,"%*") then local hashes = instance.hashes for k=1,#hashes do local hash = hashes[k] - local tag, kind = hash.tag, hash.type - for kk, hh in next, files[hash.tag] do + local hashname, hashtype = hash.name, hash.type + for kk, hh in next, files[hashname] do if not find(kk,"^remap:") then if find(lower(kk),name) then - if doit(path,hh,kk,tag,kind,result,allresults) then done = true end + if doit(path,hh,kk,hashname,hashtype,result,allresults) then done = true end if done and not allresults then break end end end @@ -10144,8 +12298,8 @@ function resolvers.find_wildcard_files(filename) -- todo: remap: local hashes = instance.hashes for k=1,#hashes do local hash = hashes[k] - local tag, kind = hash.tag, hash.type - if doit(path,files[tag][bname],bname,tag,kind,result,allresults) then done = true end + local hashname, hashtype = hash.name, hash.type + if doit(path,files[hashname][bname],bname,hashname,hashtype,result,allresults) then done = true end if done and not allresults then break end end end @@ -10154,8 +12308,12 @@ function resolvers.find_wildcard_files(filename) -- todo: remap: return result end -function resolvers.find_wildcard_file(filename) - return (resolvers.find_wildcard_files(filename)[1] or "") +function resolvers.findwildcardfiles(filename,result) + return findwildcardfiles(filename,true,result) +end + +function resolvers.findwildcardfile(filename) + return findwildcardfiles(filename,false)[1] or "" end -- main user functions @@ -10166,34 +12324,33 @@ end function resolvers.load(option) statistics.starttiming(instance) - resolvers.resetconfig() - resolvers.identify_cnf() - resolvers.load_lua() -- will become the new method - resolvers.expand_variables() - resolvers.load_cnf() -- will be skipped when we have a lua file - resolvers.expand_variables() + identify_configuration_files() + load_configuration_files() if option ~= "nofiles" then - resolvers.load_hash() + load_databases() resolvers.automount() end statistics.stoptiming(instance) + local files = instance.files + return files and next(files) and true +end + +local function report(str) + if trace_locating then + report_resolving(str) -- has already verbose + else + print(str) + end end -function resolvers.for_files(command, files, filetype, mustexist) +function resolvers.dowithfilesandreport(command, files, ...) -- will move if files and #files > 0 then - local function report(str) - if trace_locating then - logs.report("fileio",str) -- has already verbose - else - print(str) - end - end if trace_locating then report('') -- ? end for f=1,#files do local file = files[f] - local result = command(file,filetype,mustexist) + local result = command(file,...) if type(result) == 'string' then report(result) else @@ -10205,21 +12362,16 @@ function resolvers.for_files(command, files, filetype, mustexist) end end --- strtab +-- obsolete -resolvers.var_value = resolvers.variable -- output the value of variable $STRING. -resolvers.expand_var = resolvers.expansion -- output variable expansion of STRING. +-- resolvers.varvalue = resolvers.variable -- output the value of variable $STRING. +-- resolvers.expandvar = resolvers.expansion -- output variable expansion of STRING. -function resolvers.show_path(str) -- output search path for file type NAME - return file.join_path(resolvers.expanded_path_list(resolvers.format_of_var(str))) +function resolvers.showpath(str) -- output search path for file type NAME + return joinpath(resolvers.expandedpathlist(resolvers.formatofvariable(str))) end --- resolvers.find_file(filename) --- resolvers.find_file(filename, filetype, mustexist) --- resolvers.find_file(filename, mustexist) --- resolvers.find_file(filename, filetype) - -function resolvers.register_file(files, name, path) +function resolvers.registerfile(files, name, path) if files[name] then if type(files[name]) == 'string' then files[name] = { files[name], path } @@ -10231,101 +12383,24 @@ function resolvers.register_file(files, name, path) end end -function resolvers.splitmethod(filename) - if not filename then - return { } -- safeguard - elseif type(filename) == "table" then - return filename -- already split - elseif not find(filename,"://") then - return { scheme="file", path = filename, original=filename } -- quick hack - else - return url.hashed(filename) - end -end - -function table.sequenced(t,sep) -- temp here - local s = { } - for k, v in next, t do -- indexed? - s[#s+1] = k .. "=" .. tostring(v) - end - return concat(s, sep or " | ") -end - -function resolvers.methodhandler(what, filename, filetype) -- ... - filename = file.collapse_path(filename) - local specification = (type(filename) == "string" and resolvers.splitmethod(filename)) or filename -- no or { }, let it bomb - local scheme = specification.scheme - if resolvers[what][scheme] then - if trace_locating then - logs.report("fileio","handler '%s' -> '%s' -> '%s'",specification.original,what,table.sequenced(specification)) - end - return resolvers[what][scheme](filename,filetype) -- todo: specification - else - return resolvers[what].tex(filename,filetype) -- todo: specification - end -end - -function resolvers.clean_path(str) - if str then - str = gsub(str,"\\","/") - str = gsub(str,"^!+","") - str = gsub(str,"^~",resolvers.homedir) - return str - else - return nil - end -end - -function resolvers.do_with_path(name,func) - local pathlist = resolvers.expanded_path_list(name) +function resolvers.dowithpath(name,func) + local pathlist = resolvers.expandedpathlist(name) for i=1,#pathlist do - func("^"..resolvers.clean_path(pathlist[i])) + func("^"..resolvers.cleanpath(pathlist[i])) end end -function resolvers.do_with_var(name,func) - func(expanded_var(name)) -end - -function resolvers.with_files(pattern,handle) - local hashes = instance.hashes - for i=1,#hashes do - local hash = hashes[i] - local blobpath = hash.tag - local blobtype = hash.type - if blobpath then - local files = instance.files[blobpath] - if files then - for k,v in next, files do - if find(k,"^remap:") then - k = files[k] - v = files[k] -- chained - end - if find(k,pattern) then - if type(v) == "string" then - handle(blobtype,blobpath,v,k) - else - for _,vv in next, v do -- indexed - handle(blobtype,blobpath,vv,k) - end - end - end - end - end - end - end +function resolvers.dowithvariable(name,func) + func(expandedvariable(name)) end -function resolvers.locate_format(name) - local barename, fmtname = gsub(name,"%.%a+$",""), "" - if resolvers.usecache then - local path = file.join(caches.setpath("formats")) -- maybe platform - fmtname = file.join(path,barename..".fmt") or "" - end +function resolvers.locateformat(name) + local barename = file.removesuffix(name) -- gsub(name,"%.%a+$","") + local fmtname = caches.getfirstreadablefile(barename..".fmt","formats") or "" if fmtname == "" then - fmtname = resolvers.find_files(barename..".fmt")[1] or "" + fmtname = resolvers.findfile(barename..".fmt") + fmtname = resolvers.cleanpath(fmtname) end - fmtname = resolvers.clean_path(fmtname) if fmtname ~= "" then local barename = file.removesuffix(fmtname) local luaname, lucname, luiname = barename .. ".lua", barename .. ".luc", barename .. ".lui" @@ -10340,7 +12415,7 @@ function resolvers.locate_format(name) return nil, nil end -function resolvers.boolean_variable(str,default) +function resolvers.booleanvariable(str,default) local b = resolvers.expansion(str) if b == "" then return default @@ -10350,204 +12425,62 @@ function resolvers.boolean_variable(str,default) end end -texconfig.kpse_init = false - -kpse = { original = kpse } setmetatable(kpse, { __index = function(k,v) return resolvers[v] end } ) - --- for a while - -input = resolvers - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['data-tmp'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - ---[[ldx-- -

This module deals with caching data. It sets up the paths and -implements loaders and savers for tables. Best is to set the -following variable. When not set, the usual paths will be -checked. Personally I prefer the (users) temporary path.

- - -TEXMFCACHE=$TMP;$TEMP;$TMPDIR;$TEMPDIR;$HOME;$TEXMFVAR;$VARTEXMF;. - - -

Currently we do no locking when we write files. This is no real -problem because most caching involves fonts and the chance of them -being written at the same time is small. We also need to extend -luatools with a recache feature.

---ldx]]-- - -local format, lower, gsub = string.format, string.lower, string.gsub - -local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) -- not used yet - -caches = caches or { } - -caches.path = caches.path or nil -caches.base = caches.base or "luatex-cache" -caches.more = caches.more or "context" -caches.direct = false -- true is faster but may need huge amounts of memory -caches.tree = false -caches.paths = caches.paths or nil -caches.force = true -- changed for TEXLIVE by TH -caches.defaults = { "TEXMFCACHE", "TMPDIR", "TEMPDIR", "TMP", "TEMP", "HOME", "HOMEPATH" } - -function caches.temp() - local cachepath = nil - local function check(list,isenv) - if not cachepath then - for k=1,#list do - local v = list[k] - cachepath = (isenv and (os.env[v] or "")) or v or "" - if cachepath == "" then - -- next - else - cachepath = resolvers.clean_path(cachepath) - if lfs.isdir(cachepath) and file.iswritable(cachepath) then -- lfs.attributes(cachepath,"mode") == "directory" - break - elseif caches.force or io.ask(format("\nShould I create the cache path %s?",cachepath), "no", { "yes", "no" }) == "yes" then - dir.mkdirs(cachepath) - if lfs.isdir(cachepath) and file.iswritable(cachepath) then - break +function resolvers.dowithfilesintree(pattern,handle,before,after) -- will move, can be a nice iterator instead + local instance = resolvers.instance + local hashes = instance.hashes + for i=1,#hashes do + local hash = hashes[i] + local blobtype = hash.type + local blobpath = hash.name + if blobpath then + if before then + before(blobtype,blobpath,pattern) + end + local files = instance.files[blobpath] + local total, checked, done = 0, 0, 0 + if files then + for k,v in next, files do + total = total + 1 + if find(k,"^remap:") then + k = files[k] + v = k -- files[k] -- chained + end + if find(k,pattern) then + if type(v) == "string" then + checked = checked + 1 + if handle(blobtype,blobpath,v,k) then + done = done + 1 + end + else + checked = checked + #v + for i=1,#v do + if handle(blobtype,blobpath,v[i],k) then + done = done + 1 + end + end end end end - cachepath = nil + end + if after then + after(blobtype,blobpath,pattern,total,checked,done) end end end - check(resolvers.clean_path_list("TEXMFCACHE") or { }) - check(caches.defaults,true) - if not cachepath then - print("\nfatal error: there is no valid (writable) cache path defined\n") - os.exit() - elseif not lfs.isdir(cachepath) then -- lfs.attributes(cachepath,"mode") ~= "directory" - print(format("\nfatal error: cache path %s is not a directory\n",cachepath)) - os.exit() - end - cachepath = file.collapse_path(cachepath) - function caches.temp() - return cachepath - end - return cachepath -end - -function caches.configpath() - return table.concat(resolvers.instance.cnffiles,";") -end - -function caches.hashed(tree) - return md5.hex(gsub(lower(tree),"[\\\/]+","/")) -end - -function caches.treehash() - local tree = caches.configpath() - if not tree or tree == "" then - return false - else - return caches.hashed(tree) - end -end - -function caches.setpath(...) - if not caches.path then - if not caches.path then - caches.path = caches.temp() - end - caches.path = resolvers.clean_path(caches.path) -- to be sure - caches.tree = caches.tree or caches.treehash() - if caches.tree then - caches.path = dir.mkdirs(caches.path,caches.base,caches.more,caches.tree) - else - caches.path = dir.mkdirs(caches.path,caches.base,caches.more) - end - end - if not caches.path then - caches.path = '.' - end - caches.path = resolvers.clean_path(caches.path) - local dirs = { ... } - if #dirs > 0 then - local pth = dir.mkdirs(caches.path,...) - return pth - end - caches.path = dir.expand_name(caches.path) - return caches.path -end - -function caches.definepath(category,subcategory) - return function() - return caches.setpath(category,subcategory) - end -end - -function caches.setluanames(path,name) - return path .. "/" .. name .. ".tma", path .. "/" .. name .. ".tmc" -end - -function caches.loaddata(path,name) - local tmaname, tmcname = caches.setluanames(path,name) - local loader = loadfile(tmcname) or loadfile(tmaname) - if loader then - loader = loader() - collectgarbage("step") - return loader - else - return false - end -end - ---~ function caches.loaddata(path,name) ---~ local tmaname, tmcname = caches.setluanames(path,name) ---~ return dofile(tmcname) or dofile(tmaname) ---~ end - -function caches.iswritable(filepath,filename) - local tmaname, tmcname = caches.setluanames(filepath,filename) - return file.iswritable(tmaname) -end - -function caches.savedata(filepath,filename,data,raw) - local tmaname, tmcname = caches.setluanames(filepath,filename) - local reduce, simplify = true, true - if raw then - reduce, simplify = false, false - end - data.cache_uuid = os.uuid() - if caches.direct then - file.savedata(tmaname, table.serialize(data,'return',false,true,false)) -- no hex - else - table.tofile(tmaname, data,'return',false,true,false) -- maybe not the last true - end - local cleanup = resolvers.boolean_variable("PURGECACHE", false) - local strip = resolvers.boolean_variable("LUACSTRIP", true) - utils.lua.compile(tmaname, tmcname, cleanup, strip) end --- here we use the cache for format loading (texconfig.[formatname|jobname]) +resolvers.obsolete = resolvers.obsolete or { } +local obsolete = resolvers.obsolete ---~ if tex and texconfig and texconfig.formatname and texconfig.formatname == "" then -if tex and texconfig and (not texconfig.formatname or texconfig.formatname == "") and input and resolvers.instance then - if not texconfig.luaname then texconfig.luaname = "cont-en.lua" end -- or luc - texconfig.formatname = caches.setpath("formats") .. "/" .. gsub(texconfig.luaname,"%.lu.$",".fmt") -end +resolvers.find_file = resolvers.findfile obsolete.find_file = resolvers.findfile +resolvers.find_files = resolvers.findfiles obsolete.find_files = resolvers.findfiles end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['data-res'] = { +if not modules then modules = { } end modules ['data-pre'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -10555,17 +12488,28 @@ if not modules then modules = { } end modules ['data-res'] = { license = "see context related readme files" } ---~ print(resolvers.resolve("abc env:tmp file:cont-en.tex path:cont-en.tex full:cont-en.tex rel:zapf/one/p-chars.tex")) +-- It could be interesting to hook the resolver in the file +-- opener so that unresolved prefixes travel around and we +-- get more abstraction. -local upper, lower, gsub = string.upper, string.lower, string.gsub +-- As we use this beforehand we will move this up in the chain +-- of loading. -local prefixes = { } + +local resolvers = resolvers +local prefixes = utilities.storage.allocate() +resolvers.prefixes = prefixes + +local gsub = string.gsub +local cleanpath, findgivenfile, expansion = resolvers.cleanpath, resolvers.findgivenfile, resolvers.expansion +local getenv = resolvers.getenv -- we can probably also use resolvers.expansion +local P, Cs, lpegmatch = lpeg.P, lpeg.Cs, lpeg.match prefixes.environment = function(str) - return resolvers.clean_path(os.getenv(str) or os.getenv(upper(str)) or os.getenv(lower(str)) or "") + return cleanpath(expansion(str)) end -prefixes.relative = function(str,n) +prefixes.relative = function(str,n) -- lfs.isfile if io.exists(str) then -- nothing elseif io.exists("./" .. str) then @@ -10581,7 +12525,7 @@ prefixes.relative = function(str,n) end end end - return resolvers.clean_path(str) + return cleanpath(str) end prefixes.auto = function(str) @@ -10593,18 +12537,34 @@ prefixes.auto = function(str) end prefixes.locate = function(str) - local fullname = resolvers.find_given_file(str) or "" - return resolvers.clean_path((fullname ~= "" and fullname) or str) + local fullname = findgivenfile(str) or "" + return cleanpath((fullname ~= "" and fullname) or str) end prefixes.filename = function(str) - local fullname = resolvers.find_given_file(str) or "" - return resolvers.clean_path(file.basename((fullname ~= "" and fullname) or str)) + local fullname = findgivenfile(str) or "" + return cleanpath(file.basename((fullname ~= "" and fullname) or str)) end prefixes.pathname = function(str) - local fullname = resolvers.find_given_file(str) or "" - return resolvers.clean_path(file.dirname((fullname ~= "" and fullname) or str)) + local fullname = findgivenfile(str) or "" + return cleanpath(file.dirname((fullname ~= "" and fullname) or str)) +end + +prefixes.selfautoloc = function(str) + return cleanpath(file.join(getenv('SELFAUTOLOC'),str)) +end + +prefixes.selfautoparent = function(str) + return cleanpath(file.join(getenv('SELFAUTOPARENT'),str)) +end + +prefixes.selfautodir = function(str) + return cleanpath(file.join(getenv('SELFAUTODIR'),str)) +end + +prefixes.home = function(str) + return cleanpath(file.join(getenv('HOME'),str)) end prefixes.env = prefixes.environment @@ -10633,26 +12593,71 @@ local function _resolve_(method,target) end end -local function resolve(str) - if type(str) == "table" then - for k=1,#str do - local v = str[k] - str[k] = resolve(v) or v +local resolved, abstract = { }, { } + +function resolvers.resetresolve(str) + resolved, abstract = { }, { } +end + +local function resolve(str) -- use schemes, this one is then for the commandline only + local res = resolved[str] + if not res then + res = gsub(str,"([a-z][a-z]+):([^ \"\']*)",_resolve_) + resolved[str] = res + abstract[res] = str + end + return res +end + +local function unresolve(str) + return abstract[str] or str +end + +resolvers.resolve = resolve +resolvers.unresolve = unresolve + +if os.uname then + + for k, v in next, os.uname() do + if not prefixes[k] then + prefixes[k] = function() return v end + end + end + +end + +if os.type == "unix" then + + local pattern + + local function makepattern(t,k,v) + local colon = P(":") + local p + for k, v in table.sortedpairs(prefixes) do + if p then + p = P(k) + p + else + p = P(k) + end + end + pattern = Cs((p * colon + colon/";" + P(1))^0) + if t then + t[k] = v end - elseif str and str ~= "" then - str = gsub(str,"([a-z]+):([^ \"\']*)",_resolve_) end - return str -end -resolvers.resolve = resolve + makepattern() -if os.uname then + getmetatable(prefixes).__newindex = makepattern - for k, v in next, os.uname() do - if not prefixes[k] then - prefixes[k] = function() return v end - end + function resolvers.repath(str) + return lpegmatch(pattern,str) + end + +else -- already the default: + + function resolvers.repath(str) + return str end end @@ -10670,13 +12675,23 @@ if not modules then modules = { } end modules ['data-inp'] = { license = "see context related readme files" } -resolvers.finders = resolvers.finders or { } -resolvers.openers = resolvers.openers or { } -resolvers.loaders = resolvers.loaders or { } +local allocate = utilities.storage.allocate +local resolvers = resolvers + +local methodhandler = resolvers.methodhandler +local registermethod = resolvers.registermethod -resolvers.finders.notfound = { nil } -resolvers.openers.notfound = { nil } -resolvers.loaders.notfound = { false, nil, 0 } +local finders = allocate { helpers = { }, notfound = function() end } +local openers = allocate { helpers = { }, notfound = function() end } +local loaders = allocate { helpers = { }, notfound = function() return false, nil, 0 end } + +registermethod("finders", finders, "uri") +registermethod("openers", openers, "uri") +registermethod("loaders", loaders, "uri") + +resolvers.finders = finders +resolvers.openers = openers +resolvers.loaders = loaders end -- of closure @@ -10691,15 +12706,23 @@ if not modules then modules = { } end modules ['data-out'] = { license = "see context related readme files" } -outputs = outputs or { } +local allocate = utilities.storage.allocate +local resolvers = resolvers + +local registermethod = resolvers.registermethod +local savers = allocate { helpers = { } } + +resolvers.savers = savers + +registermethod("savers", savers, "uri") end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['data-con'] = { +if not modules then modules = { } end modules ['data-fil'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -10707,6 +12730,124 @@ if not modules then modules = { } end modules ['data-con'] = { license = "see context related readme files" } +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) + +local report_files = logs.reporter("resolvers","files") + +local resolvers = resolvers + +local finders, openers, loaders, savers = resolvers.finders, resolvers.openers, resolvers.loaders, resolvers.savers +local locators, hashers, generators, concatinators = resolvers.locators, resolvers.hashers, resolvers.generators, resolvers.concatinators + +local checkgarbage = utilities.garbagecollector and utilities.garbagecollector.check + +function locators.file(specification) + local name = specification.filename + local realname = resolvers.resolve(name) -- no shortcut + if realname and realname ~= '' and lfs.isdir(realname) then + if trace_locating then + report_files("file locator '%s' found as '%s'",name,realname) + end + resolvers.appendhash('file',name,true) -- cache + elseif trace_locating then + report_files("file locator '%s' not found",name) + end +end + +function hashers.file(specification) + local name = specification.filename + local content = caches.loadcontent(name,'files') + resolvers.registerfilehash(name,content,content==nil) +end + +function generators.file(specification) + local path = specification.filename + local content = resolvers.scanfiles(path) + resolvers.registerfilehash(path,content,true) +end + +concatinators.file = file.join + +function finders.file(specification,filetype) + local filename = specification.filename + local foundname = resolvers.findfile(filename,filetype) + if foundname and foundname ~= "" then + if trace_locating then + report_files("file finder: '%s' found",filename) + end + return foundname + else + if trace_locating then + report_files("file finder: %s' not found",filename) + end + return finders.notfound() + end +end + +-- The default textopener will be overloaded later on. + +function openers.helpers.textopener(tag,filename,f) + return { + reader = function() return f:read () end, + close = function() logs.show_close(filename) return f:close() end, + } +end + +function openers.file(specification,filetype) + local filename = specification.filename + if filename and filename ~= "" then + local f = io.open(filename,"r") + if f then + if trace_locating then + report_files("file opener, '%s' opened",filename) + end + return openers.helpers.textopener("file",filename,f) + end + end + if trace_locating then + report_files("file opener, '%s' not found",filename) + end + return openers.notfound() +end + +function loaders.file(specification,filetype) + local filename = specification.filename + if filename and filename ~= "" then + local f = io.open(filename,"rb") + if f then + logs.show_load(filename) + if trace_locating then + report_files("file loader, '%s' loaded",filename) + end + local s = f:read("*a") + if checkgarbage then + checkgarbage(#s) + end + f:close() + if s then + return true, s, #s + end + end + end + if trace_locating then + report_files("file loader, '%s' not found",filename) + end + return loaders.notfound() +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-con'] = { + version = 1.100, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + local format, lower, gsub = string.format, string.lower, string.gsub local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) @@ -10726,50 +12867,63 @@ table structures without bothering about the disk cache.

Examples of usage can be found in the font related code.

--ldx]]-- -containers = containers or { } - +containers = containers or { } +local containers = containers containers.usecache = true +local report_containers = logs.reporter("resolvers","containers") + local function report(container,tag,name) if trace_cache or trace_containers then - logs.report(format("%s cache",container.subcategory),"%s: %s",tag,name or 'invalid') + report_containers("container: %s, tag: %s, name: %s",container.subcategory,tag,name or 'invalid') end end local allocated = { } --- tracing +local mt = { + __index = function(t,k) + if k == "writable" then + local writable = caches.getwritablepath(t.category,t.subcategory) or { "." } + t.writable = writable + return writable + elseif k == "readables" then + local readables = caches.getreadablepaths(t.category,t.subcategory) or { "." } + t.readables = readables + return readables + end + end, + __storage__ = true +} function containers.define(category, subcategory, version, enabled) - return function() - if category and subcategory then - local c = allocated[category] - if not c then - c = { } - allocated[category] = c - end - local s = c[subcategory] - if not s then - s = { - category = category, - subcategory = subcategory, - storage = { }, - enabled = enabled, - version = version or 1.000, - trace = false, - path = caches and caches.setpath and caches.setpath(category,subcategory), - } - c[subcategory] = s - end - return s - else - return nil + if category and subcategory then + local c = allocated[category] + if not c then + c = { } + allocated[category] = c + end + local s = c[subcategory] + if not s then + s = { + category = category, + subcategory = subcategory, + storage = { }, + enabled = enabled, + version = version or math.pi, -- after all, this is TeX + trace = false, + -- writable = caches.getwritablepath and caches.getwritablepath (category,subcategory) or { "." }, + -- readables = caches.getreadablepaths and caches.getreadablepaths(category,subcategory) or { "." }, + } + setmetatable(s,mt) + c[subcategory] = s end + return s end end function containers.is_usable(container, name) - return container.enabled and caches and caches.iswritable(container.path, name) + return container.enabled and caches and caches.is_writable(container.writable, name) end function containers.is_valid(container, name) @@ -10782,18 +12936,20 @@ function containers.is_valid(container, name) end function containers.read(container,name) - if container.enabled and caches and not container.storage[name] and containers.usecache then - container.storage[name] = caches.loaddata(container.path,name) - if containers.is_valid(container,name) then + local storage = container.storage + local stored = storage[name] + if not stored and container.enabled and caches and containers.usecache then + stored = caches.loaddata(container.readables,name) + if stored and stored.cache_version == container.version then report(container,"loaded",name) else - container.storage[name] = nil + stored = nil end - end - if container.storage[name] then + storage[name] = stored + elseif stored then report(container,"reusing",name) end - return container.storage[name] + return stored end function containers.write(container, name, data) @@ -10802,7 +12958,7 @@ function containers.write(container, name, data) if container.enabled and caches then local unique, shared = data.unique, data.shared data.unique, data.shared = nil, nil - caches.savedata(container.path, name, data) + caches.savedata(container.writable, name, data) report(container,"saved",name) data.unique, data.shared = unique, shared end @@ -10837,50 +12993,18 @@ local format, lower, gsub, find = string.format, string.lower, string.gsub, stri local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) --- since we want to use the cache instead of the tree, we will now --- reimplement the saver. - -local save_data = resolvers.save_data -local load_data = resolvers.load_data - -resolvers.cachepath = nil -- public, for tracing -resolvers.usecache = true -- public, for tracing +local report_mounts = logs.reporter("resolvers","mounts") -function resolvers.save_data(dataname) - save_data(dataname, function(cachename,dataname) - resolvers.usecache = not toboolean(resolvers.expansion("CACHEINTDS") or "false",true) - if resolvers.usecache then - resolvers.cachepath = resolvers.cachepath or caches.definepath("trees") - return file.join(resolvers.cachepath(),caches.hashed(cachename)) - else - return file.join(cachename,dataname) - end - end) -end - -function resolvers.load_data(pathname,dataname,filename) - load_data(pathname,dataname,filename,function(dataname,filename) - resolvers.usecache = not toboolean(resolvers.expansion("CACHEINTDS") or "false",true) - if resolvers.usecache then - resolvers.cachepath = resolvers.cachepath or caches.definepath("trees") - return file.join(resolvers.cachepath(),caches.hashed(pathname)) - else - if not filename or (filename == "") then - filename = dataname - end - return file.join(pathname,filename) - end - end) -end +local resolvers = resolvers -- we will make a better format, maybe something xml or just text or lua resolvers.automounted = resolvers.automounted or { } function resolvers.automount(usecache) - local mountpaths = resolvers.clean_path_list(resolvers.expansion('TEXMFMOUNT')) + local mountpaths = resolvers.cleanpathlist(resolvers.expansion('TEXMFMOUNT')) if (not mountpaths or #mountpaths == 0) and usecache then - mountpaths = { caches.setpath("mount") } + mountpaths = caches.getreadablepaths("mount") end if mountpaths and #mountpaths > 0 then statistics.starttiming(resolvers.instance) @@ -10894,7 +13018,7 @@ function resolvers.automount(usecache) -- skip elseif find(line,"^zip://") then if trace_locating then - logs.report("fileio","mounting %s",line) + report_mounts("mounting %s",line) end table.insert(resolvers.automounted,line) resolvers.usezipfile(line) @@ -10910,40 +13034,40 @@ end -- status info -statistics.register("used config path", function() return caches.configpath() end) -statistics.register("used cache path", function() return caches.temp() or "?" end) +statistics.register("used config file", function() return caches.configfiles() end) +statistics.register("used cache path", function() return caches.usedpaths() end) -- experiment (code will move) -function statistics.save_fmt_status(texname,formatbanner,sourcefile) -- texname == formatname +function statistics.savefmtstatus(texname,formatbanner,sourcefile) -- texname == formatname local enginebanner = status.list().banner if formatbanner and enginebanner and sourcefile then local luvname = file.replacesuffix(texname,"luv") local luvdata = { enginebanner = enginebanner, formatbanner = formatbanner, - sourcehash = md5.hex(io.loaddata(resolvers.find_file(sourcefile)) or "unknown"), + sourcehash = md5.hex(io.loaddata(resolvers.findfile(sourcefile)) or "unknown"), sourcefile = sourcefile, } io.savedata(luvname,table.serialize(luvdata,true)) end end -function statistics.check_fmt_status(texname) +function statistics.checkfmtstatus(texname) local enginebanner = status.list().banner if enginebanner and texname then local luvname = file.replacesuffix(texname,"luv") if lfs.isfile(luvname) then local luv = dofile(luvname) if luv and luv.sourcefile then - local sourcehash = md5.hex(io.loaddata(resolvers.find_file(luv.sourcefile)) or "unknown") + local sourcehash = md5.hex(io.loaddata(resolvers.findfile(luv.sourcefile)) or "unknown") local luvbanner = luv.enginebanner or "?" if luvbanner ~= enginebanner then - return string.format("engine mismatch (luv:%s <> bin:%s)",luvbanner,enginebanner) + return format("engine mismatch (luv: %s <> bin: %s)",luvbanner,enginebanner) end local luvhash = luv.sourcehash or "?" if luvhash ~= sourcehash then - return string.format("source mismatch (luv:%s <> bin:%s)",luvhash,sourcehash) + return format("source mismatch (luv: %s <> bin: %s)",luvhash,sourcehash) end else return "invalid status file" @@ -10968,25 +13092,30 @@ if not modules then modules = { } end modules ['data-zip'] = { license = "see context related readme files" } +-- partly redone .. needs testing + local format, find, match = string.format, string.find, string.match -local unpack = unpack or table.unpack local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local report_zip = logs.reporter("resolvers","zip") + -- zip:///oeps.zip?name=bla/bla.tex -- zip:///oeps.zip?tree=tex/texmf-local -- zip:///texmf.zip?tree=/tex/texmf -- zip:///texmf.zip?tree=/tex/texmf-local -- zip:///texmf-mine.zip?tree=/tex/texmf-projects -zip = zip or { } -zip.archives = zip.archives or { } -zip.registeredfiles = zip.registeredfiles or { } +local resolvers = resolvers -local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders -local locators, hashers, concatinators = resolvers.locators, resolvers.hashers, resolvers.concatinators +zip = zip or { } +local zip = zip -local archives = zip.archives +zip.archives = zip.archives or { } +local archives = zip.archives + +zip.registeredfiles = zip.registeredfiles or { } +local registeredfiles = zip.registeredfiles local function validzip(str) -- todo: use url splitter if not find(str,"^zip://") then @@ -11002,7 +13131,7 @@ function zip.openarchive(name) else local arch = archives[name] if not arch then - local full = resolvers.find_file(name) or "" + local full = resolvers.findfile(name) or "" arch = (full ~= "" and zip.open(full)) or false archives[name] = arch end @@ -11017,163 +13146,162 @@ function zip.closearchive(name) end end -function locators.zip(specification) -- where is this used? startup zips (untested) - specification = resolvers.splitmethod(specification) - local zipfile = specification.path - local zfile = zip.openarchive(name) -- tricky, could be in to be initialized tree +function resolvers.locators.zip(specification) + local archive = specification.filename + local zipfile = archive and archive ~= "" and zip.openarchive(archive) -- tricky, could be in to be initialized tree if trace_locating then - if zfile then - logs.report("fileio","zip locator, archive '%s' found",specification.original) + if zipfile then + report_zip("locator, archive '%s' found",archive) else - logs.report("fileio","zip locator, archive '%s' not found",specification.original) + report_zip("locator, archive '%s' not found",archive) end end end -function hashers.zip(tag,name) +function resolvers.hashers.zip(specification) + local archive = specification.filename if trace_locating then - logs.report("fileio","loading zip file '%s' as '%s'",name,tag) + report_zip("loading file '%s'",archive) end - resolvers.usezipfile(format("%s?tree=%s",tag,name)) + resolvers.usezipfile(specification.original) end -function concatinators.zip(tag,path,name) +function resolvers.concatinators.zip(zipfile,path,name) -- ok ? if not path or path == "" then - return format('%s?name=%s',tag,name) + return format('%s?name=%s',zipfile,name) else - return format('%s?name=%s/%s',tag,path,name) + return format('%s?name=%s/%s',zipfile,path,name) end end -function resolvers.isreadable.zip(name) - return true -end - -function finders.zip(specification,filetype) - specification = resolvers.splitmethod(specification) - if specification.path then - local q = url.query(specification.query) - if q.name then - local zfile = zip.openarchive(specification.path) +function resolvers.finders.zip(specification) + local original = specification.original + local archive = specification.filename + if archive then + local query = url.query(specification.query) + local queryname = query.name + if queryname then + local zfile = zip.openarchive(archive) if zfile then if trace_locating then - logs.report("fileio","zip finder, archive '%s' found",specification.path) + report_zip("finder, archive '%s' found",archive) end - local dfile = zfile:open(q.name) + local dfile = zfile:open(queryname) if dfile then dfile = zfile:close() if trace_locating then - logs.report("fileio","zip finder, file '%s' found",q.name) + report_zip("finder, file '%s' found",queryname) end return specification.original elseif trace_locating then - logs.report("fileio","zip finder, file '%s' not found",q.name) + report_zip("finder, file '%s' not found",queryname) end elseif trace_locating then - logs.report("fileio","zip finder, unknown archive '%s'",specification.path) + report_zip("finder, unknown archive '%s'",archive) end end end if trace_locating then - logs.report("fileio","zip finder, '%s' not found",filename) + report_zip("finder, '%s' not found",original) end - return unpack(finders.notfound) + return resolvers.finders.notfound() end -function openers.zip(specification) - local zipspecification = resolvers.splitmethod(specification) - if zipspecification.path then - local q = url.query(zipspecification.query) - if q.name then - local zfile = zip.openarchive(zipspecification.path) +function resolvers.openers.zip(specification) + local original = specification.original + local archive = specification.filename + if archive then + local query = url.query(specification.query) + local queryname = query.name + if queryname then + local zfile = zip.openarchive(archive) if zfile then if trace_locating then - logs.report("fileio","zip opener, archive '%s' opened",zipspecification.path) + report_zip("opener, archive '%s' opened",archive) end - local dfile = zfile:open(q.name) + local dfile = zfile:open(queryname) if dfile then - logs.show_open(specification) if trace_locating then - logs.report("fileio","zip opener, file '%s' found",q.name) + report_zip("opener, file '%s' found",queryname) end - return openers.text_opener(specification,dfile,'zip') + return resolvers.openers.helpers.textopener('zip',original,dfile) elseif trace_locating then - logs.report("fileio","zip opener, file '%s' not found",q.name) + report_zip("opener, file '%s' not found",queryname) end elseif trace_locating then - logs.report("fileio","zip opener, unknown archive '%s'",zipspecification.path) + report_zip("opener, unknown archive '%s'",archive) end end end if trace_locating then - logs.report("fileio","zip opener, '%s' not found",filename) + report_zip("opener, '%s' not found",original) end - return unpack(openers.notfound) + return resolvers.openers.notfound() end -function loaders.zip(specification) - specification = resolvers.splitmethod(specification) - if specification.path then - local q = url.query(specification.query) - if q.name then - local zfile = zip.openarchive(specification.path) +function resolvers.loaders.zip(specification) + local original = specification.original + local archive = specification.filename + if archive then + local query = url.query(specification.query) + local queryname = query.name + if queryname then + local zfile = zip.openarchive(archive) if zfile then if trace_locating then - logs.report("fileio","zip loader, archive '%s' opened",specification.path) + report_zip("loader, archive '%s' opened",archive) end - local dfile = zfile:open(q.name) + local dfile = zfile:open(queryname) if dfile then - logs.show_load(filename) + logs.show_load(original) if trace_locating then - logs.report("fileio","zip loader, file '%s' loaded",filename) + report_zip("loader, file '%s' loaded",original) end local s = dfile:read("*all") dfile:close() return true, s, #s elseif trace_locating then - logs.report("fileio","zip loader, file '%s' not found",q.name) + report_zip("loader, file '%s' not found",queryname) end elseif trace_locating then - logs.report("fileio","zip loader, unknown archive '%s'",specification.path) + report_zip("loader, unknown archive '%s'",archive) end end end if trace_locating then - logs.report("fileio","zip loader, '%s' not found",filename) + report_zip("loader, '%s' not found",original) end - return unpack(openers.notfound) + return resolvers.openers.notfound() end -- zip:///somefile.zip -- zip:///somefile.zip?tree=texmf-local -> mount -function resolvers.usezipfile(zipname) - zipname = validzip(zipname) - local specification = resolvers.splitmethod(zipname) - local zipfile = specification.path - if zipfile and not zip.registeredfiles[zipname] then - local tree = url.query(specification.query).tree or "" - local z = zip.openarchive(zipfile) +function resolvers.usezipfile(archive) + local specification = resolvers.splitmethod(archive) -- to be sure + local archive = specification.filename + if archive and not registeredfiles[archive] then + local z = zip.openarchive(archive) if z then - local instance = resolvers.instance + local tree = url.query(specification.query).tree or "" if trace_locating then - logs.report("fileio","zip registering, registering archive '%s'",zipname) - end - statistics.starttiming(instance) - resolvers.prepend_hash('zip',zipname,zipfile) - resolvers.extend_texmf_var(zipname) -- resets hashes too - zip.registeredfiles[zipname] = z - instance.files[zipname] = resolvers.register_zip_file(z,tree or "") - statistics.stoptiming(instance) + report_zip("registering, registering archive '%s'",archive) + end + statistics.starttiming(resolvers.instance) + resolvers.prependhash('zip',archive) + resolvers.extendtexmfvariable(archive) -- resets hashes too + registeredfiles[archive] = z + instance.files[archive] = resolvers.registerzipfile(z,tree) + statistics.stoptiming(resolvers.instance) elseif trace_locating then - logs.report("fileio","zip registering, unknown archive '%s'",zipname) + report_zip("registering, unknown archive '%s'",archive) end elseif trace_locating then - logs.report("fileio","zip registering, '%s' not found",zipname) + report_zip("registering, '%s' not found",archive) end end -function resolvers.register_zip_file(z,tree) +function resolvers.registerzipfile(z,tree) local files, filter = { }, "" if tree == "" then filter = "^(.+)/(.-)$" @@ -11181,9 +13309,9 @@ function resolvers.register_zip_file(z,tree) filter = format("^%s/(.+)/(.-)$",tree) end if trace_locating then - logs.report("fileio","zip registering, using filter '%s'",filter) + report_zip("registering, using filter '%s'",filter) end - local register, n = resolvers.register_file, 0 + local register, n = resolvers.registerfile, 0 for i in z:files() do local path, name = match(i.filename,filter) if path then @@ -11198,11 +13326,89 @@ function resolvers.register_zip_file(z,tree) n = n + 1 end end - logs.report("fileio","zip registering, %s files registered",n) + report_zip("registering, %s files registered",n) return files end +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-tre'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- \input tree://oeps1/**/oeps.tex + +local find, gsub, format = string.find, string.gsub, string.format + +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) + +local report_trees = logs.reporter("resolvers","trees") + +local resolvers = resolvers + +local done, found, notfound = { }, { }, resolvers.finders.notfound + +function resolvers.finders.tree(specification) + local spec = specification.filename + local fnd = found[spec] + if fnd == nil then + if spec ~= "" then + local path, name = file.dirname(spec), file.basename(spec) + if path == "" then path = "." end + local hash = done[path] + if not hash then + local pattern = path .. "/*" -- we will use the proper splitter + hash = dir.glob(pattern) + done[path] = hash + end + local pattern = "/" .. gsub(name,"([%.%-%+])", "%%%1") .. "$" + for k=1,#hash do + local v = hash[k] + if find(v,pattern) then + found[spec] = v + return v + end + end + end + fnd = notfound() -- false + found[spec] = fnd + end + return fnd +end + +function resolvers.locators.tree(specification) + local name = specification.filename + if name ~= '' and lfs.isdir(name) then + if trace_locating then + report_trees("locator '%s' found",name) + end + resolvers.appendhash('tree',name,false) -- don't cache + elseif trace_locating then + report_trees("locator '%s' not found",name) + end +end + +function resolvers.hashers.tree(specification) + local name = specification.filename + if trace_locating then + report_trees("analysing '%s'",name) + end + resolvers.methodhandler("hashers",name) +end + +resolvers.concatinators.tree = resolvers.concatinators.file +resolvers.generators.tree = resolvers.generators.file +resolvers.openers.tree = resolvers.openers.file +resolvers.loaders.tree = resolvers.loaders.file + + end -- of closure do -- create closure to overcome 200 locals limit @@ -11215,58 +13421,59 @@ if not modules then modules = { } end modules ['data-crl'] = { license = "see context related readme files" } -local gsub = string.gsub +-- this one is replaced by data-sch.lua -- -curl = curl or { } +local gsub = string.gsub -curl.cached = { } -curl.cachepath = caches.definepath("curl") +local resolvers = resolvers local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders -function curl.fetch(protocol, name) - local cachename = curl.cachepath() .. "/" .. gsub(name,"[^%a%d%.]+","-") --- cachename = gsub(cachename,"[\\/]", io.fileseparator) - cachename = gsub(cachename,"[\\]", "/") -- cleanup - if not curl.cached[name] then +resolvers.curl = resolvers.curl or { } +local curl = resolvers.curl + +local cached = { } + +local function runcurl(specification) + local original = specification.original + -- local scheme = specification.scheme + local cleanname = gsub(original,"[^%a%d%.]+","-") + local cachename = caches.setfirstwritablefile(cleanname,"curl") + if not cached[original] then if not io.exists(cachename) then - curl.cached[name] = cachename - local command = "curl --silent --create-dirs --output " .. cachename .. " " .. name -- no protocol .. "://" + cached[original] = cachename + local command = "curl --silent --create-dirs --output " .. cachename .. " " .. original os.spawn(command) end if io.exists(cachename) then - curl.cached[name] = cachename + cached[original] = cachename else - curl.cached[name] = "" + cached[original] = "" end end - return curl.cached[name] -end - -function finders.curl(protocol,filename) - local foundname = curl.fetch(protocol, filename) - return finders.generic(protocol,foundname,filetype) + return cached[original] end -function openers.curl(protocol,filename) - return openers.generic(protocol,filename) -end +-- old code: we could be cleaner using specification (see schemes) -function loaders.curl(protocol,filename) - return loaders.generic(protocol,filename) +local function finder(specification,filetype) + return resolvers.methodhandler("finders",runcurl(specification),filetype) end --- todo: metamethod +local opener = openers.file +local loader = loaders.file -function curl.install(protocol) - finders[protocol] = function (filename,filetype) return finders.curl(protocol,filename) end - openers[protocol] = function (filename) return openers.curl(protocol,filename) end - loaders[protocol] = function (filename) return loaders.curl(protocol,filename) end +local function install(scheme) + finders[scheme] = finder + openers[scheme] = opener + loaders[scheme] = loader end -curl.install('http') -curl.install('https') -curl.install('ftp') +resolvers.curl.install = install + +install('http') +install('https') +install('ftp') end -- of closure @@ -11287,9 +13494,13 @@ if not modules then modules = { } end modules ['data-lua'] = { local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local report_libraries = logs.reporter("resolvers","libraries") + local gsub, insert = string.gsub, table.insert local unpack = unpack or table.unpack +local resolvers, package = resolvers, package + local libformats = { 'luatexlibs', 'tex', 'texmfscripts', 'othertextfiles' } -- 'luainputs' local clibformats = { 'lib' } @@ -11298,7 +13509,7 @@ local _path_, libpaths, _cpath_, clibpaths function package.libpaths() if not _path_ or package.path ~= _path_ then _path_ = package.path - libpaths = file.split_path(_path_,";") + libpaths = file.splitpath(_path_,";") end return libpaths end @@ -11306,7 +13517,7 @@ end function package.clibpaths() if not _cpath_ or package.cpath ~= _cpath_ then _cpath_ = package.cpath - clibpaths = file.split_path(_cpath_,";") + clibpaths = file.splitpath(_cpath_,";") end return clibpaths end @@ -11315,18 +13526,18 @@ local function thepath(...) local t = { ... } t[#t+1] = "?.lua" local path = file.join(unpack(t)) if trace_locating then - logs.report("fileio","! appending '%s' to 'package.path'",path) + report_libraries("! appending '%s' to 'package.path'",path) end return path end local p_libpaths, a_libpaths = { }, { } -function package.append_libpath(...) +function package.appendtolibpath(...) insert(a_libpath,thepath(...)) end -function package.prepend_libpath(...) +function package.prependtolibpath(...) insert(p_libpaths,1,thepath(...)) end @@ -11337,31 +13548,30 @@ local function loaded(libpaths,name,simple) local libpath = libpaths[i] local resolved = gsub(libpath,"%?",simple) if trace_locating then -- more detail - logs.report("fileio","! checking for '%s' on 'package.path': '%s' => '%s'",simple,libpath,resolved) + report_libraries("! checking for '%s' on 'package.path': '%s' => '%s'",simple,libpath,resolved) end - if resolvers.isreadable.file(resolved) then + if file.is_readable(resolved) then if trace_locating then - logs.report("fileio","! lib '%s' located via 'package.path': '%s'",name,resolved) + report_libraries("! lib '%s' located via 'package.path': '%s'",name,resolved) end return loadfile(resolved) end end end - package.loaders[2] = function(name) -- was [#package.loaders+1] if trace_locating then -- mode detail - logs.report("fileio","! locating '%s'",name) + report_libraries("! locating '%s'",name) end for i=1,#libformats do local format = libformats[i] - local resolved = resolvers.find_file(name,format) or "" + local resolved = resolvers.findfile(name,format) or "" if trace_locating then -- mode detail - logs.report("fileio","! checking for '%s' using 'libformat path': '%s'",name,format) + report_libraries("! checking for '%s' using 'libformat path': '%s'",name,format) end if resolved ~= "" then if trace_locating then - logs.report("fileio","! lib '%s' located via environment: '%s'",name,resolved) + report_libraries("! lib '%s' located via environment: '%s'",name,resolved) end return loadfile(resolved) end @@ -11379,16 +13589,16 @@ package.loaders[2] = function(name) -- was [#package.loaders+1] for i=1,#clibformats do -- better have a dedicated loop local format = clibformats[i] - local paths = resolvers.expanded_path_list_from_var(format) + local paths = resolvers.expandedpathlistfromvariable(format) for p=1,#paths do local path = paths[p] local resolved = file.join(path,libname) if trace_locating then -- mode detail - logs.report("fileio","! checking for '%s' using 'clibformat path': '%s'",libname,path) + report_libraries("! checking for '%s' using 'clibformat path': '%s'",libname,path) end - if resolvers.isreadable.file(resolved) then + if file.is_readable(resolved) then if trace_locating then - logs.report("fileio","! lib '%s' located via 'clibformat': '%s'",libname,resolved) + report_libraries("! lib '%s' located via 'clibformat': '%s'",libname,resolved) end return package.loadlib(resolved,name) end @@ -11398,140 +13608,43 @@ package.loaders[2] = function(name) -- was [#package.loaders+1] local libpath = clibpaths[i] local resolved = gsub(libpath,"?",simple) if trace_locating then -- more detail - logs.report("fileio","! checking for '%s' on 'package.cpath': '%s'",simple,libpath) + report_libraries("! checking for '%s' on 'package.cpath': '%s'",simple,libpath) end - if resolvers.isreadable.file(resolved) then + if file.is_readable(resolved) then if trace_locating then - logs.report("fileio","! lib '%s' located via 'package.cpath': '%s'",name,resolved) + report_libraries("! lib '%s' located via 'package.cpath': '%s'",name,resolved) end return package.loadlib(resolved,name) end end -- just in case the distribution is messed up if trace_loading then -- more detail - logs.report("fileio","! checking for '%s' using 'luatexlibs': '%s'",name) + report_libraries("! checking for '%s' using 'luatexlibs': '%s'",name) end - local resolved = resolvers.find_file(file.basename(name),'luatexlibs') or "" + local resolved = resolvers.findfile(file.basename(name),'luatexlibs') or "" if resolved ~= "" then if trace_locating then - logs.report("fileio","! lib '%s' located by basename via environment: '%s'",name,resolved) + report_libraries("! lib '%s' located by basename via environment: '%s'",name,resolved) end return loadfile(resolved) end if trace_locating then - logs.report("fileio",'? unable to locate lib: %s',name) + report_libraries('? unable to locate lib: %s',name) end -- return "unable to locate " .. name end resolvers.loadlualib = require +-- -- -- -- -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['luat-kps'] = { - version = 1.001, - comment = "companion to luatools.lua", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - ---[[ldx-- -

This file is used when we want the input handlers to behave like -kpsewhich. What to do with the following:

- - -{$SELFAUTOLOC,$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c} -$SELFAUTOLOC : /usr/tex/bin/platform -$SELFAUTODIR : /usr/tex/bin -$SELFAUTOPARENT : /usr/tex - - -

How about just forgetting about them?

---ldx]]-- - -local suffixes = resolvers.suffixes -local formats = resolvers.formats - -suffixes['gf'] = { 'gf' } -suffixes['pk'] = { 'pk' } -suffixes['base'] = { 'base' } -suffixes['bib'] = { 'bib' } -suffixes['bst'] = { 'bst' } -suffixes['cnf'] = { 'cnf' } -suffixes['mem'] = { 'mem' } -suffixes['mf'] = { 'mf' } -suffixes['mfpool'] = { 'pool' } -suffixes['mft'] = { 'mft' } -suffixes['mppool'] = { 'pool' } -suffixes['graphic/figure'] = { 'eps', 'epsi' } -suffixes['texpool'] = { 'pool' } -suffixes['PostScript header'] = { 'pro' } -suffixes['ist'] = { 'ist' } -suffixes['web'] = { 'web', 'ch' } -suffixes['cweb'] = { 'w', 'web', 'ch' } -suffixes['cmap files'] = { 'cmap' } -suffixes['lig files'] = { 'lig' } -suffixes['bitmap font'] = { } -suffixes['MetaPost support'] = { } -suffixes['TeX system documentation'] = { } -suffixes['TeX system sources'] = { } -suffixes['dvips config'] = { } -suffixes['type42 fonts'] = { } -suffixes['web2c files'] = { } -suffixes['other text files'] = { } -suffixes['other binary files'] = { } -suffixes['opentype fonts'] = { 'otf' } - -suffixes['fmt'] = { 'fmt' } -suffixes['texmfscripts'] = { 'rb','lua','py','pl' } - -suffixes['pdftex config'] = { } -suffixes['Troff fonts'] = { } - -suffixes['ls-R'] = { } +package.obsolete = package.obsolete or { } ---[[ldx-- -

If you wondered abou tsome of the previous mappings, how about -the next bunch:

---ldx]]-- +package.append_libpath = appendtolibpath -- will become obsolete +package.prepend_libpath = prependtolibpath -- will become obsolete -formats['bib'] = '' -formats['bst'] = '' -formats['mft'] = '' -formats['ist'] = '' -formats['web'] = '' -formats['cweb'] = '' -formats['MetaPost support'] = '' -formats['TeX system documentation'] = '' -formats['TeX system sources'] = '' -formats['Troff fonts'] = '' -formats['dvips config'] = '' -formats['graphic/figure'] = '' -formats['ls-R'] = '' -formats['other text files'] = '' -formats['other binary files'] = '' - -formats['gf'] = '' -formats['pk'] = '' -formats['base'] = 'MFBASES' -formats['cnf'] = '' -formats['mem'] = 'MPMEMS' -formats['mf'] = 'MFINPUTS' -formats['mfpool'] = 'MFPOOL' -formats['mppool'] = 'MPPOOL' -formats['texpool'] = 'TEXPOOL' -formats['PostScript header'] = 'TEXPSHEADERS' -formats['cmap files'] = 'CMAPFONTS' -formats['type42 fonts'] = 'T42FONTS' -formats['web2c files'] = 'WEB2C' -formats['pdftex config'] = 'PDFTEXCONFIG' -formats['texmfscripts'] = 'TEXMFSCRIPTS' -formats['bitmap font'] = '' -formats['lig files'] = 'LIGFONTS' +package.obsolete.append_libpath = appendtolibpath -- will become obsolete +package.obsolete.prepend_libpath = prependtolibpath -- will become obsolete end -- of closure @@ -11547,49 +13660,54 @@ if not modules then modules = { } end modules ['data-aux'] = { } local find = string.find +local type, next = type, next local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) -function resolvers.update_script(oldname,newname) -- oldname -> own.name, not per se a suffix +local resolvers = resolvers + +local report_scripts = logs.reporter("resolvers","scripts") + +function resolvers.updatescript(oldname,newname) -- oldname -> own.name, not per se a suffix local scriptpath = "scripts/context/lua" newname = file.addsuffix(newname,"lua") - local oldscript = resolvers.clean_path(oldname) + local oldscript = resolvers.cleanpath(oldname) if trace_locating then - logs.report("fileio","to be replaced old script %s", oldscript) + report_scripts("to be replaced old script %s", oldscript) end - local newscripts = resolvers.find_files(newname) or { } + local newscripts = resolvers.findfiles(newname) or { } if #newscripts == 0 then if trace_locating then - logs.report("fileio","unable to locate new script") + report_scripts("unable to locate new script") end else for i=1,#newscripts do - local newscript = resolvers.clean_path(newscripts[i]) + local newscript = resolvers.cleanpath(newscripts[i]) if trace_locating then - logs.report("fileio","checking new script %s", newscript) + report_scripts("checking new script %s", newscript) end if oldscript == newscript then if trace_locating then - logs.report("fileio","old and new script are the same") + report_scripts("old and new script are the same") end elseif not find(newscript,scriptpath) then if trace_locating then - logs.report("fileio","new script should come from %s",scriptpath) + report_scripts("new script should come from %s",scriptpath) end elseif not (find(oldscript,file.removesuffix(newname).."$") or find(oldscript,newname.."$")) then if trace_locating then - logs.report("fileio","invalid new script name") + report_scripts("invalid new script name") end else local newdata = io.loaddata(newscript) if newdata then if trace_locating then - logs.report("fileio","old script content replaced by new content") + report_scripts("old script content replaced by new content") end io.savedata(oldscript,newdata) break elseif trace_locating then - logs.report("fileio","unable to load new script") + report_scripts("unable to load new script") end end end @@ -11609,72 +13727,133 @@ if not modules then modules = { } end modules ['data-tmf'] = { license = "see context related readme files" } -local find, gsub, match = string.find, string.gsub, string.match -local getenv, setenv = os.getenv, os.setenv +local resolvers = resolvers --- loads *.tmf files in minimal tree roots (to be optimized and documented) +local report_tds = logs.reporter("resolvers","tds") -function resolvers.check_environment(tree) - logs.simpleline() - setenv('TMP', getenv('TMP') or getenv('TEMP') or getenv('TMPDIR') or getenv('HOME')) - setenv('TEXOS', getenv('TEXOS') or ("texmf-" .. os.platform)) - setenv('TEXPATH', gsub(tree or "tex","\/+$",'')) - setenv('TEXMFOS', getenv('TEXPATH') .. "/" .. getenv('TEXOS')) - logs.simpleline() - logs.simple("preset : TEXPATH => %s", getenv('TEXPATH')) - logs.simple("preset : TEXOS => %s", getenv('TEXOS')) - logs.simple("preset : TEXMFOS => %s", getenv('TEXMFOS')) - logs.simple("preset : TMP => %s", getenv('TMP')) - logs.simple('') -end +-- = << +-- ? ?? +-- < += +-- > =+ -function resolvers.load_environment(name) -- todo: key=value as well as lua - local f = io.open(name) - if f then - for line in f:lines() do - if find(line,"^[%%%#]") then - -- skip comment - else - local key, how, value = match(line,"^(.-)%s*([<=>%?]+)%s*(.*)%s*$") - if how then - value = gsub(value,"%%(.-)%%", function(v) return getenv(v) or "" end) - if how == "=" or how == "<<" then - setenv(key,value) - elseif how == "?" or how == "??" then - setenv(key,getenv(key) or value) - elseif how == "<" or how == "+=" then - if getenv(key) then - setenv(key,getenv(key) .. io.fileseparator .. value) - else - setenv(key,value) - end - elseif how == ">" or how == "=+" then - if getenv(key) then - setenv(key,value .. io.pathseparator .. getenv(key)) - else - setenv(key,value) - end - end - end - end +function resolvers.load_tree(tree,resolve) + if type(tree) == "string" and tree ~= "" then + + local getenv, setenv = resolvers.getenv, resolvers.setenv + + -- later might listen to the raw osenv var as well + local texos = "texmf-" .. os.platform + + local oldroot = environment.texroot + local newroot = file.collapsepath(tree) + + local newtree = file.join(newroot,texos) + local newpath = file.join(newtree,"bin") + + if not lfs.isdir(newtree) then + report_tds("no '%s' under tree %s",texos,tree) + os.exit() end - f:close() + if not lfs.isdir(newpath) then + report_tds("no '%s/bin' under tree %s",texos,tree) + os.exit() + end + + local texmfos = newtree + + environment.texroot = newroot + environment.texos = texos + environment.texmfos = texmfos + + -- Beware, we need to obey the relocatable autoparent so we + -- set TEXMFCNF to its raw value. This is somewhat tricky when + -- we run a mkii job from within. Therefore, in mtxrun, there + -- is a resolve applied when we're in mkii/kpse mode. + + setenv('SELFAUTOPARENT', newroot) + setenv('SELFAUTODIR', newtree) + setenv('SELFAUTOLOC', newpath) + setenv('TEXROOT', newroot) + setenv('TEXOS', texos) + setenv('TEXMFOS', texmfos) + setenv('TEXMFCNF', resolvers.luacnfspec, not resolve) + setenv("PATH", newpath .. io.pathseparator .. getenv("PATH")) + + report_tds("changing from root '%s' to '%s'",oldroot,newroot) + report_tds("prepending '%s' to binary path",newpath) + report_tds() end end -function resolvers.load_tree(tree) - if tree and tree ~= "" then - local setuptex = 'setuptex.tmf' - if lfs.attributes(tree, "mode") == "directory" then -- check if not nil - setuptex = tree .. "/" .. setuptex - else - setuptex = tree + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-lst'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- used in mtxrun, can be loaded later .. todo + +local find, concat, upper, format = string.find, table.concat, string.upper, string.format + +resolvers.listers = resolvers.listers or { } + +local resolvers = resolvers + +local report_lists = logs.reporter("resolvers","lists") + +local function tabstr(str) + if type(str) == 'table' then + return concat(str," | ") + else + return str + end +end + +function resolvers.listers.variables(pattern) + local instance = resolvers.instance + local environment = instance.environment + local variables = instance.variables + local expansions = instance.expansions + local pattern = upper(pattern or "") + local configured = { } + local order = instance.order + for i=1,#order do + for k, v in next, order[i] do + if v ~= nil and configured[k] == nil then + configured[k] = v + end end - if io.exists(setuptex) then - resolvers.check_environment(tree) - resolvers.load_environment(setuptex) + end + local env = table.fastcopy(environment) + local var = table.fastcopy(variables) + local exp = table.fastcopy(expansions) + for key, value in table.sortedpairs(configured) do + if key ~= "" and (pattern == "" or find(upper(key),pattern)) then + report_lists(key) + report_lists(" env: %s",tabstr(rawget(environment,key)) or "unset") + report_lists(" var: %s",tabstr(configured[key]) or "unset") + report_lists(" exp: %s",tabstr(expansions[key]) or "unset") + report_lists(" res: %s",resolvers.resolve(expansions[key]) or "unset") end end + instance.environment = table.fastcopy(env) + instance.variables = table.fastcopy(var) + instance.expansions = table.fastcopy(exp) +end + +function resolvers.listers.configurations(report) + local configurations = resolvers.instance.specification + local report = report or texio.write_nl + for i=1,#configurations do + report(resolvers.resolve(configurations[i])) + end end @@ -11691,12 +13870,18 @@ if not modules then modules = { } end modules ['luat-sta'] = { -- this code is used in the updater -local gmatch, match = string.gmatch, string.match -local type = type +local gmatch, match = string.gmatch, string.match +local type = type + +states = states or { } +local states = states + +states.data = states.data or { } +local data = states.data + +states.hash = states.hash or { } +local hash = states.hash -states = states or { } -states.data = states.data or { } -states.hash = states.hash or { } states.tag = states.tag or "" states.filename = states.filename or "" @@ -11706,7 +13891,7 @@ function states.save(filename,tag) io.savedata(filename, "-- generator : luat-sta.lua\n" .. "-- state tag : " .. tag .. "\n\n" .. - table.serialize(states.data[tag or states.tag] or {},true) + table.serialize(data[tag or states.tag] or {},true) ) end @@ -11714,11 +13899,11 @@ function states.load(filename,tag) states.filename = filename states.tag = tag or "whatever" states.filename = file.addsuffix(states.filename,'lus') - states.data[states.tag], states.hash[states.tag] = (io.exists(filename) and dofile(filename)) or { }, { } + data[states.tag], hash[states.tag] = (io.exists(filename) and dofile(filename)) or { }, { } end -function states.set_by_tag(tag,key,value,default,persistent) - local d, h = states.data[tag], states.hash[tag] +local function set_by_tag(tag,key,value,default,persistent) + local d, h = data[tag], hash[tag] if d then if type(d) == "table" then local dkey, hkey = key, key @@ -11738,8 +13923,10 @@ function states.set_by_tag(tag,key,value,default,persistent) end dkey, hkey = post, key end - if type(value) == nil then - value = value or default + if value == nil then + value = default + elseif value == false then + -- special case elseif persistent then value = value or d[dkey] or default else @@ -11748,144 +13935,202 @@ function states.set_by_tag(tag,key,value,default,persistent) d[dkey], h[hkey] = value, value elseif type(d) == "string" then -- weird - states.data[tag], states.hash[tag] = value, value + data[tag], hash[tag] = value, value end end end -function states.get_by_tag(tag,key,default) - local h = states.hash[tag] +local function get_by_tag(tag,key,default) + local h = hash[tag] if h and h[key] then return h[key] else - local d = states.data[tag] + local d = data[tag] if d then for k in gmatch(key,"[^%.]+") do local dk = d[k] - if dk then + if dk ~= nil then d = dk else return default end end - return d or default + if d == false then + return false + else + return d or default + end end end end +states.set_by_tag = set_by_tag +states.get_by_tag = get_by_tag + function states.set(key,value,default,persistent) - states.set_by_tag(states.tag,key,value,default,persistent) + set_by_tag(states.tag,key,value,default,persistent) end function states.get(key,default) - return states.get_by_tag(states.tag,key,default) -end - ---~ states.data.update = { ---~ ["version"] = { ---~ ["major"] = 0, ---~ ["minor"] = 1, ---~ }, ---~ ["rsync"] = { ---~ ["server"] = "contextgarden.net", ---~ ["module"] = "minimals", ---~ ["repository"] = "current", ---~ ["flags"] = "-rpztlv --stats", ---~ }, ---~ ["tasks"] = { ---~ ["update"] = true, ---~ ["make"] = true, ---~ ["delete"] = false, ---~ }, ---~ ["platform"] = { ---~ ["host"] = true, ---~ ["other"] = { ---~ ["mswin"] = false, ---~ ["linux"] = false, ---~ ["linux-64"] = false, ---~ ["osx-intel"] = false, ---~ ["osx-ppc"] = false, ---~ ["sun"] = false, ---~ }, ---~ }, ---~ ["context"] = { ---~ ["available"] = {"current", "beta", "alpha", "experimental"}, ---~ ["selected"] = "current", ---~ }, ---~ ["formats"] = { ---~ ["cont-en"] = true, ---~ ["cont-nl"] = true, ---~ ["cont-de"] = false, ---~ ["cont-cz"] = false, ---~ ["cont-fr"] = false, ---~ ["cont-ro"] = false, ---~ }, ---~ ["engine"] = { ---~ ["pdftex"] = { ---~ ["install"] = true, ---~ ["formats"] = { ---~ ["pdftex"] = true, ---~ }, ---~ }, ---~ ["luatex"] = { ---~ ["install"] = true, ---~ ["formats"] = { ---~ }, ---~ }, ---~ ["xetex"] = { ---~ ["install"] = true, ---~ ["formats"] = { ---~ ["xetex"] = false, ---~ }, ---~ }, ---~ ["metapost"] = { ---~ ["install"] = true, ---~ ["formats"] = { ---~ ["mpost"] = true, ---~ ["metafun"] = true, ---~ }, ---~ }, ---~ }, ---~ ["fonts"] = { ---~ }, ---~ ["doc"] = { ---~ }, ---~ ["modules"] = { ---~ ["f-urwgaramond"] = false, ---~ ["f-urwgothic"] = false, ---~ ["t-bnf"] = false, ---~ ["t-chromato"] = false, ---~ ["t-cmscbf"] = false, ---~ ["t-cmttbf"] = false, ---~ ["t-construction-plan"] = false, ---~ ["t-degrade"] = false, ---~ ["t-french"] = false, ---~ ["t-lettrine"] = false, ---~ ["t-lilypond"] = false, ---~ ["t-mathsets"] = false, ---~ ["t-tikz"] = false, ---~ ["t-typearea"] = false, ---~ ["t-vim"] = false, ---~ }, ---~ } - ---~ states.save("teststate", "update") ---~ states.load("teststate", "update") - ---~ print(states.get_by_tag("update","rsync.server","unknown")) ---~ states.set_by_tag("update","rsync.server","oeps") ---~ print(states.get_by_tag("update","rsync.server","unknown")) ---~ states.save("teststate", "update") ---~ states.load("teststate", "update") ---~ print(states.get_by_tag("update","rsync.server","unknown")) + return get_by_tag(states.tag,key,default) +end + + + + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['luat-fmt'] = { + version = 1.001, + comment = "companion to mtxrun", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + + +local format = string.format + +local report_format = logs.reporter("resolvers","formats") + +-- helper for mtxrun + +local quoted = string.quoted + +local function primaryflags() -- not yet ok + local trackers = environment.argument("trackers") + local directives = environment.argument("directives") + local flags = "" + if trackers and trackers ~= "" then + flags = flags .. "--trackers=" .. quoted(trackers) + end + if directives and directives ~= "" then + flags = flags .. "--directives=" .. quoted(directives) + end + return flags +end + +function environment.make_format(name) + -- change to format path (early as we need expanded paths) + local olddir = lfs.currentdir() + local path = caches.getwritablepath("formats") or "" -- maybe platform + if path ~= "" then + lfs.chdir(path) + end + report_format("format path: %s",lfs.currentdir()) + -- check source file + local texsourcename = file.addsuffix(name,"mkiv") + local fulltexsourcename = resolvers.findfile(texsourcename,"tex") or "" + if fulltexsourcename == "" then + texsourcename = file.addsuffix(name,"tex") + fulltexsourcename = resolvers.findfile(texsourcename,"tex") or "" + end + if fulltexsourcename == "" then + report_format("no tex source file with name: %s (mkiv or tex)",name) + lfs.chdir(olddir) + return + else + report_format("using tex source file: %s",fulltexsourcename) + end + local texsourcepath = dir.expandname(file.dirname(fulltexsourcename)) -- really needed + -- check specification + local specificationname = file.replacesuffix(fulltexsourcename,"lus") + local fullspecificationname = resolvers.findfile(specificationname,"tex") or "" + if fullspecificationname == "" then + specificationname = file.join(texsourcepath,"context.lus") + fullspecificationname = resolvers.findfile(specificationname,"tex") or "" + end + if fullspecificationname == "" then + report_format("unknown stub specification: %s",specificationname) + lfs.chdir(olddir) + return + end + local specificationpath = file.dirname(fullspecificationname) + -- load specification + local usedluastub = nil + local usedlualibs = dofile(fullspecificationname) + if type(usedlualibs) == "string" then + usedluastub = file.join(file.dirname(fullspecificationname),usedlualibs) + elseif type(usedlualibs) == "table" then + report_format("using stub specification: %s",fullspecificationname) + local texbasename = file.basename(name) + local luastubname = file.addsuffix(texbasename,"lua") + local lucstubname = file.addsuffix(texbasename,"luc") + -- pack libraries in stub + report_format("creating initialization file: %s",luastubname) + utilities.merger.selfcreate(usedlualibs,specificationpath,luastubname) + -- compile stub file (does not save that much as we don't use this stub at startup any more) + local strip = resolvers.booleanvariable("LUACSTRIP", true) + if utilities.lua.compile(luastubname,lucstubname) and lfs.isfile(lucstubname) then + report_format("using compiled initialization file: %s",lucstubname) + usedluastub = lucstubname + else + report_format("using uncompiled initialization file: %s",luastubname) + usedluastub = luastubname + end + else + report_format("invalid stub specification: %s",fullspecificationname) + lfs.chdir(olddir) + return + end + -- generate format + local command = format("luatex --ini %s --lua=%s %s %sdump",primaryflags(),quoted(usedluastub),quoted(fulltexsourcename),os.platform == "unix" and "\\\\" or "\\") + report_format("running command: %s\n",command) + os.spawn(command) + -- remove related mem files + local pattern = file.removesuffix(file.basename(usedluastub)).."-*.mem" + -- report_format("removing related mplib format with pattern '%s'", pattern) + local mp = dir.glob(pattern) + if mp then + for i=1,#mp do + local name = mp[i] + report_format("removing related mplib format %s", file.basename(name)) + os.remove(name) + end + end + lfs.chdir(olddir) +end + +function environment.run_format(name,data,more) + -- hm, rather old code here; we can now use the file.whatever functions + if name and name ~= "" then + local barename = file.removesuffix(name) + local fmtname = caches.getfirstreadablefile(file.addsuffix(barename,"fmt"),"formats") + if fmtname == "" then + fmtname = resolvers.findfile(file.addsuffix(barename,"fmt")) or "" + end + fmtname = resolvers.cleanpath(fmtname) + if fmtname == "" then + report_format("no format with name: %s",name) + else + local barename = file.removesuffix(name) -- expanded name + local luaname = file.addsuffix(barename,"luc") + if not lfs.isfile(luaname) then + luaname = file.addsuffix(barename,"lua") + end + if not lfs.isfile(luaname) then + report_format("using format name: %s",fmtname) + report_format("no luc/lua with name: %s",barename) + else + local command = format("luatex %s --fmt=%s --lua=%s %s %s",primaryflags(),quoted(barename),quoted(luaname),quoted(data),more ~= "" and quoted(more) or "") + report_format("running command: %s",command) + os.spawn(command) + end + end + end +end end -- of closure -- end library merge -own = { } -- not local +own = { } -- not local, might change + +own.libs = { -- order can be made better -own.libs = { -- todo: check which ones are really needed 'l-string.lua', 'l-lpeg.lua', 'l-table.lua', @@ -11898,39 +14143,55 @@ own.libs = { -- todo: check which ones are really needed 'l-url.lua', 'l-dir.lua', 'l-boolean.lua', + 'l-unicode.lua', 'l-math.lua', --- 'l-unicode.lua', --- 'l-tex.lua', - 'l-utils.lua', - 'l-aux.lua', --- 'l-xml.lua', - 'trac-tra.lua', + + 'util-tab.lua', + 'util-sto.lua', + 'util-mrg.lua', + 'util-lua.lua', + 'util-prs.lua', + 'util-fmt.lua', + 'util-deb.lua', + + 'trac-inf.lua', + 'trac-set.lua', + 'trac-log.lua', + 'trac-pro.lua', + + 'luat-env.lua', -- can come before inf (as in mkiv) + 'lxml-tab.lua', 'lxml-lpt.lua', --- 'lxml-ent.lua', + -- 'lxml-ent.lua', 'lxml-mis.lua', 'lxml-aux.lua', 'lxml-xml.lua', - 'luat-env.lua', - 'trac-inf.lua', - 'trac-log.lua', - 'data-res.lua', + + 'data-ini.lua', + 'data-exp.lua', + 'data-env.lua', 'data-tmp.lua', + 'data-met.lua', + 'data-res.lua', 'data-pre.lua', 'data-inp.lua', 'data-out.lua', + 'data-fil.lua', 'data-con.lua', 'data-use.lua', -- 'data-tex.lua', -- 'data-bin.lua', 'data-zip.lua', + 'data-tre.lua', 'data-crl.lua', 'data-lua.lua', - 'data-kps.lua', -- so that we can replace kpsewhich 'data-aux.lua', -- updater - 'data-tmf.lua', -- tree files - -- needed ? - 'luat-sta.lua', -- states + 'data-tmf.lua', + 'data-lst.lua', + + 'luat-sta.lua', + 'luat-fmt.lua', } -- We need this hack till luatex is fixed. @@ -11943,35 +14204,62 @@ end -- End of hack. -own.name = (environment and environment.ownname) or arg[0] or 'luatools.lua' +local format, gsub, gmatch, match = string.format, string.gsub, string.gmatch, string.match +local concat = table.concat + +own.name = (environment and environment.ownname) or arg[0] or 'mtxrun.lua' +own.path = gsub(match(own.name,"^(.+)[\\/].-$") or ".","\\","/") + +local ownpath, owntree = own.path, environment and environment.ownpath or own.path + +own.list = { + '.', + ownpath , + ownpath .. "/../sources", -- HH's development path + owntree .. "/../../texmf-local/tex/context/base", + owntree .. "/../../texmf-context/tex/context/base", + owntree .. "/../../texmf-dist/tex/context/base", + owntree .. "/../../texmf/tex/context/base", + owntree .. "/../../../texmf-local/tex/context/base", + owntree .. "/../../../texmf-context/tex/context/base", + owntree .. "/../../../texmf-dist/tex/context/base", + owntree .. "/../../../texmf/tex/context/base", +} +if own.path == "." then table.remove(own.list,1) end -own.path = string.match(own.name,"^(.+)[\\/].-$") or "." -own.list = { '.' } -if own.path ~= '.' then - table.insert(own.list,own.path) +local function locate_libs() + for l=1,#own.libs do + local lib = own.libs[l] + for p =1,#own.list do + local pth = own.list[p] + local filename = pth .. "/" .. lib + local found = lfs.isfile(filename) + if found then + package.path = package.path .. ";" .. pth .. "/?.lua" -- in case l-* does a require + return pth + end + end + end end -table.insert(own.list,own.path.."/../../texmf-dist/tex/context/base") -table.insert(own.list,own.path.."/../../../tex/context/base") -table.insert(own.list,own.path.."/mtx") -table.insert(own.list,own.path.."/../sources") -local function locate_libs() - for _, lib in pairs(own.libs) do - for _, pth in pairs(own.list) do - local filename = string.gsub(pth .. "/" .. lib,"\\","/") +local function load_libs() + local found = locate_libs() + if found then + for l=1,#own.libs do + local filename = found .. "/" .. own.libs[l] local codeblob = loadfile(filename) if codeblob then codeblob() - own.list = { pth } -- speed up te search - break end end + else + resolvers = nil end end if not resolvers then - locate_libs() + load_libs() end if not resolvers then @@ -11983,20 +14271,56 @@ if not resolvers then os.exit() end -logs.setprogram('MTXrun',"TDS Runner Tool 1.24",environment.arguments["verbose"] or false) +-- verbosity -local instance = resolvers.reset() +local e_verbose = environment.arguments["verbose"] + +if e_verbose then + trackers.enable("resolvers.locating") +end + +-- some common flags (also passed through environment) + +local e_silent = environment.argument("silent") +local e_noconsole = environment.argument("noconsole") + +local e_trackers = environment.argument("trackers") +local e_directives = environment.argument("directives") +local e_experiments = environment.argument("experiments") + +if e_silent == true then + e_silent = "*" +end -local trackspec = environment.argument("trackers") or environment.argument("track") +if type(e_silent) == "string" then + if type(e_directives) == "string" then + e_directives = format("%s,logs.blocked={%s}",e_directives,e_silent) + else + e_directives = format("logs.blocked={%s}",e_silent) + end +end -if trackspec then - trackers.enable(trackspec) +if e_noconsole then + if type(e_directives) == "string" then + e_directives = format("%s,logs.target=file",e_directives) + else + e_directives = format("logs.target=file") + end end -runners = runners or { } -- global -messages = messages or { } +if e_trackers then trackers .enable(e_trackers) end +if e_directives then directives .enable(e_directives) end +if e_experiments then experiments.enable(e_experiments) end + +if not environment.trackers then environment.trackers = e_trackers end +if not environment.directives then environment.directives = e_directives end +if not environment.experiments then environment.experiments = e_experiments end + +-- + +local instance = resolvers.reset() -messages.help = [[ +local helpinfo = [[ --script run an mtx script (lua prefered method) (--noquotes), no script gives list --execute run a script or program (texmfstart method) (--noquotes) --resolve resolve prefixed arguments @@ -12011,15 +14335,14 @@ messages.help = [[ --ifchanged=filename only execute when given file has changed (md checksum) --iftouched=old,new only execute when given file has changed (time stamp) ---make create stubs for (context related) scripts ---remove remove stubs (context related) scripts +--makestubs create stubs for (context related) scripts +--removestubs remove stubs (context related) scripts --stubpath=binpath paths where stubs wil be written --windows create windows (mswin) stubs --unix create unix (linux) stubs --verbose give a bit more info --trackers=list enable given trackers ---engine=str target engine --progname=str format or backend --edit launch editor with found file @@ -12032,8 +14355,35 @@ messages.help = [[ --forcekpse force using kpse (handy when no mkiv and cache installed but less functionality) --prefixes show supported prefixes + +--generate generate file database + +--variables show configuration variables +--configurations show configuration order + +--expand-braces expand complex variable +--expand-path expand variable (resolve paths) +--expand-var expand variable (resolve references) +--show-path show path expansion of ... +--var-value report value of variable +--find-file report file location +--find-path report path of file + +--pattern=str filter variables ]] +local application = logs.application { + name = "mtxrun", + banner = "ConTeXt TDS Runner Tool 1.30", + helpinfo = helpinfo, +} + +local report = application.report + +messages = messages or { } -- for the moment + +runners = runners or { } -- global (might become local) + runners.applications = { ["lua"] = "luatex --luaonly", ["luc"] = "luatex --luaonly", @@ -12056,7 +14406,7 @@ runners.registered = { makempy = { 'makempy.pl', true }, mptopdf = { 'mptopdf.pl', true }, pstopdf = { 'pstopdf.rb', true }, -- converts ps (and some more) images, does some cleaning (replaced) --- examplex = { 'examplex.rb', false }, + -- examplex = { 'examplex.rb', false }, concheck = { 'concheck.rb', false }, runtools = { 'runtools.rb', true }, textools = { 'textools.rb', true }, @@ -12065,9 +14415,9 @@ runners.registered = { rlxtools = { 'rlxtools.rb', true }, pdftools = { 'pdftools.rb', true }, mpstools = { 'mpstools.rb', true }, --- exatools = { 'exatools.rb', true }, + -- exatools = { 'exatools.rb', true }, xmltools = { 'xmltools.rb', true }, --- luatools = { 'luatools.lua', true }, + -- luatools = { 'luatools.lua', true }, mtxtools = { 'mtxtools.rb', true }, pdftrimwhite = { 'pdftrimwhite.pl', false } } @@ -12086,45 +14436,39 @@ end function runners.prepare() local checkname = environment.argument("ifchanged") - if checkname and checkname ~= "" then + if type(checkname) == "string" and checkname ~= "" then local oldchecksum = file.loadchecksum(checkname) local newchecksum = file.checksum(checkname) if oldchecksum == newchecksum then - logs.simple("file '%s' is unchanged",checkname) + if e_verbose then + report("file '%s' is unchanged",checkname) + end return "skip" - else - logs.simple("file '%s' is changed, processing started",checkname) + elseif e_verbose then + report("file '%s' is changed, processing started",checkname) end file.savechecksum(checkname) end - local oldname, newname = string.split(environment.argument("iftouched") or "", ",") - if oldname and newname and oldname ~= "" and newname ~= "" then - if not file.needs_updating(oldname,newname) then - logs.simple("file '%s' and '%s' have same age",oldname,newname) - return "skip" - else - logs.simple("file '%s' is older than '%s'",oldname,newname) - end - end - local tree = environment.argument('tree') or "" - if environment.argument('autotree') then - tree = os.getenv('TEXMFSTART_TREE') or os.getenv('TEXMFSTARTTREE') or tree - end - if tree and tree ~= "" then - resolvers.load_tree(tree) - end - local env = environment.argument('environment') or "" - if env and env ~= "" then - for _,e in pairs(string.split(env)) do - -- maybe force suffix when not given - resolvers.load_tree(e) + local touchname = environment.argument("iftouched") + if type(touchname) == "string" and touchname ~= "" then + local oldname, newname = string.split(touchname, ",") + if oldname and newname and oldname ~= "" and newname ~= "" then + if not file.needs_updating(oldname,newname) then + if e_verbose then + report("file '%s' and '%s' have same age",oldname,newname) + end + return "skip" + elseif e_verbose then + report("file '%s' is older than '%s'",oldname,newname) + end end end local runpath = environment.argument("path") - if runpath and not lfs.chdir(runpath) then - logs.simple("unable to change to path '%s'",runpath) + if type(runpath) == "string" and not lfs.chdir(runpath) then + report("unable to change to path '%s'",runpath) return "error" end + runners.prepare = function() end return "run" end @@ -12137,8 +14481,6 @@ function runners.execute_script(fullname,internal,nosplit) elseif state == 'skip' then return true elseif state == "run" then - instance.progname = environment.argument("progname") or instance.progname - instance.format = environment.argument("format") or instance.format local path, name, suffix, result = file.dirname(fullname), file.basename(fullname), file.extname(fullname), "" if path ~= "" then result = fullname @@ -12155,21 +14497,21 @@ function runners.execute_script(fullname,internal,nosplit) if suffix == "" then -- loop over known suffixes for _,s in pairs(runners.suffixes) do - result = resolvers.find_file(name .. "." .. s, 'texmfscripts') + result = resolvers.findfile(name .. "." .. s, 'texmfscripts') if result ~= "" then break end end elseif runners.applications[suffix] then - result = resolvers.find_file(name, 'texmfscripts') + result = resolvers.findfile(name, 'texmfscripts') else -- maybe look on path - result = resolvers.find_file(name, 'other text files') + result = resolvers.findfile(name, 'other text files') end end if result and result ~= "" then if not no_split then - local before, after = environment.split_arguments(fullname) -- already done + local before, after = environment.splitarguments(fullname) -- already done environment.arguments_before, environment.arguments_after = before, after end if internal then @@ -12181,12 +14523,12 @@ function runners.execute_script(fullname,internal,nosplit) if binary and binary ~= "" then result = binary .. " " .. result end - local command = result .. " " .. environment.reconstruct_commandline(environment.arguments_after,noquote) - if logs.verbose then - logs.simpleline() - logs.simple("executing: %s",command) - logs.simpleline() - logs.simpleline() + local command = result .. " " .. environment.reconstructcommandline(environment.arguments_after,noquote) + if e_verbose then + report() + report("executing: %s",command) + report() + report() io.flush() end -- no os.exec because otherwise we get the wrong return value @@ -12196,14 +14538,14 @@ function runners.execute_script(fullname,internal,nosplit) else if binary then binary = file.addsuffix(binary,os.binsuffix) - for p in string.gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do + for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do if lfs.isfile(file.join(p,binary)) then return false end end - logs.simpleline() - logs.simple("This script needs '%s' which seems not to be installed.",binary) - logs.simpleline() + report() + report("This script needs '%s' which seems not to be installed.",binary) + report() end return false end @@ -12223,14 +14565,15 @@ function runners.execute_program(fullname) elseif state == 'skip' then return true elseif state == "run" then - local before, after = environment.split_arguments(fullname) - environment.initialize_arguments(after) + local before, after = environment.splitarguments(fullname) + for k=1,#after do after[k] = resolvers.resolve(after[k]) end + environment.initializearguments(after) fullname = fullname:gsub("^bin:","") - local command = fullname .. " " .. (environment.reconstruct_commandline(after or "",noquote) or "") - logs.simpleline() - logs.simple("executing: %s",command) - logs.simpleline() - logs.simpleline() + local command = fullname .. " " .. (environment.reconstructcommandline(after or "",noquote) or "") + report() + report("executing: %s",command) + report() + report() io.flush() local code = os.exec(command) -- (fullname,unpack(after)) does not work / maybe spawn return code == 0 @@ -12239,7 +14582,7 @@ function runners.execute_program(fullname) return false end --- the --usekpse flag will fallback on kpse (hm, we can better update mtx-stubs) +-- the --usekpse flag will fallback (not default) on kpse (hm, we can better update mtx-stubs) local windows_stub = '@echo off\013\010setlocal\013\010set ownpath=%%~dp0%%\013\010texlua "%%ownpath%%mtxrun.lua" --usekpse --execute %s %%*\013\010endlocal\013\010' local unix_stub = '#!/bin/sh\010mtxrun --usekpse --execute %s \"$@\"\010' @@ -12258,22 +14601,22 @@ function runners.handle_stubs(create) for _,v in pairs(runners.registered) do local name, doit = v[1], v[2] if doit then - local base = string.gsub(file.basename(name), "%.(.-)$", "") + local base = gsub(file.basename(name), "%.(.-)$", "") if create then if windows then - io.savedata(file.join(stubpath,base..".bat"),string.format(windows_stub,name)) - logs.simple("windows stub for '%s' created",base) + io.savedata(file.join(stubpath,base..".bat"),format(windows_stub,name)) + report("windows stub for '%s' created",base) end if unix then - io.savedata(file.join(stubpath,base),string.format(unix_stub,name)) - logs.simple("unix stub for '%s' created",base) + io.savedata(file.join(stubpath,base),format(unix_stub,name)) + report("unix stub for '%s' created",base) end else if windows and (os.remove(file.join(stubpath,base..'.bat')) or os.remove(file.join(stubpath,base..'.cmd'))) then - logs.simple("windows stub for '%s' removed", base) + report("windows stub for '%s' removed", base) end if unix and (os.remove(file.join(stubpath,base)) or os.remove(file.join(stubpath,base..'.sh'))) then - logs.simple("unix stub for '%s' removed",base) + report("unix stub for '%s' removed",base) end end end @@ -12289,7 +14632,7 @@ end function runners.locate_file(filename) -- differs from texmfstart where locate appends .com .exe .bat ... todo if filename and filename ~= "" then - runners.report_location(resolvers.find_given_file(filename)) + runners.report_location(resolvers.findgivenfile(filename)) end end @@ -12298,28 +14641,28 @@ function runners.locate_platform() end function runners.report_location(result) - if logs.verbose then - logs.simpleline() + if e_verbose then + reportline() if result and result ~= "" then - logs.simple(result) + report(result) else - logs.simple("not found") + report("not found") end else io.write(result) end end -function runners.edit_script(filename) -- we assume that vim is present on most systems - local editor = os.getenv("MTXRUN_EDITOR") or os.getenv("TEXMFSTART_EDITOR") or os.getenv("EDITOR") or 'vim' +function runners.edit_script(filename) -- we assume that gvim is present on most systems (todo: also in cnf file) + local editor = os.getenv("MTXRUN_EDITOR") or os.getenv("TEXMFSTART_EDITOR") or os.getenv("EDITOR") or 'gvim' local rest = resolvers.resolve(filename) if rest ~= "" then local command = editor .. " " .. rest - if logs.verbose then - logs.simpleline() - logs.simple("starting editor: %s",command) - logs.simple_line() - logs.simple_line() + if e_verbose then + report() + report("starting editor: %s",command) + report() + report() end os.launch(command) end @@ -12362,33 +14705,33 @@ end function runners.launch_file(filename) instance.allresults = true - logs.setverbose(true) + trackers.enable("resolvers.locating") local pattern = environment.arguments["pattern"] if not pattern or pattern == "" then pattern = filename end if not pattern or pattern == "" then - logs.simple("provide name or --pattern=") + report("provide name or --pattern=") else - local t = resolvers.find_files(pattern) + local t = resolvers.findfiles(pattern) if not t or #t == 0 then - t = resolvers.find_files("*/" .. pattern) + t = resolvers.findfiles("*/" .. pattern) end if not t or #t == 0 then - t = resolvers.find_files("*/" .. pattern .. "*") + t = resolvers.findfiles("*/" .. pattern .. "*") end if t and #t > 0 then if environment.arguments["all"] then for _, v in pairs(t) do - logs.simple("launching %s", v) + report("launching %s", v) resolvers.launch(v) end else - logs.simple("launching %s", t[1]) + report("launching %s", t[1]) resolvers.launch(t[1]) end else - logs.simple("no match for %s", pattern) + report("no match for %s", pattern) end end end @@ -12421,33 +14764,45 @@ function runners.find_mtx_script(filename) local mtxprefix = (filename:find("^mtx%-") and "") or "mtx-" -- context namespace, mtx- fullname = mtxprefix .. filename - fullname = found(fullname) or resolvers.find_file(fullname) + fullname = found(fullname) or resolvers.findfile(fullname) if fullname and fullname ~= "" then return fullname end -- context namespace, mtx-s fullname = mtxprefix .. basename .. "s" .. "." .. suffix - fullname = found(fullname) or resolvers.find_file(fullname) + fullname = found(fullname) or resolvers.findfile(fullname) if fullname and fullname ~= "" then return fullname end -- context namespace, mtx- fullname = mtxprefix .. basename:gsub("s$","") .. "." .. suffix - fullname = found(fullname) or resolvers.find_file(fullname) + fullname = found(fullname) or resolvers.findfile(fullname) if fullname and fullname ~= "" then return fullname end -- context namespace, just - fullname = resolvers.find_file(filename) + fullname = resolvers.findfile(filename) return fullname end -function runners.execute_ctx_script(filename) +function runners.register_arguments(...) + local arguments = environment.arguments_after + local passedon = { ... } + for i=#passedon,1,-1 do + local pi = passedon[i] + if pi then + table.insert(arguments,1,pi) + end + end +end + +function runners.execute_ctx_script(filename,...) + runners.register_arguments(...) local arguments = environment.arguments_after local fullname = runners.find_mtx_script(filename) or "" if file.extname(fullname) == "cld" then -- handy in editors where we force --autopdf - logs.simple("running cld script: %s",filename) + report("running cld script: %s",filename) table.insert(arguments,1,fullname) table.insert(arguments,"--autopdf") fullname = runners.find_mtx_script("context") or "" @@ -12455,7 +14810,7 @@ function runners.execute_ctx_script(filename) -- retry after generate but only if --autogenerate if fullname == "" and environment.argument("autogenerate") then -- might become the default instance.renewcache = true - logs.setverbose(true) + trackers.enable("resolvers.locating") resolvers.load() -- fullname = runners.find_mtx_script(filename) or "" @@ -12470,7 +14825,7 @@ function runners.execute_ctx_script(filename) elseif state == "run" then -- load and save ... kind of undocumented arg = { } for _,v in pairs(arguments) do arg[#arg+1] = resolvers.resolve(v) end - environment.initialize_arguments(arg) + environment.initializearguments(arg) local loadname = environment.arguments['load'] if loadname then if type(loadname) ~= "string" then loadname = file.basename(fullname) end @@ -12478,8 +14833,8 @@ function runners.execute_ctx_script(filename) runners.load_script_session(loadname) end filename = environment.files[1] - if logs.verbose then - logs.simple("using script: %s\n",fullname) + if e_verbose then + report("using script: %s\n",fullname) end environment.ownscript = fullname dofile(fullname) @@ -12495,44 +14850,42 @@ function runners.execute_ctx_script(filename) return true end else - -- logs.setverbose(true) if filename == "" or filename == "help" then - local context = resolvers.find_file("mtx-context.lua") - logs.setverbose(true) + local context = resolvers.findfile("mtx-context.lua") + trackers.enable("resolvers.locating") if context ~= "" then - local result = dir.glob((string.gsub(context,"mtx%-context","mtx-*"))) -- () needed + local result = dir.glob((gsub(context,"mtx%-context","mtx-*"))) -- () needed local valid = { } table.sort(result) for i=1,#result do local scriptname = result[i] - local scriptbase = string.match(scriptname,".*mtx%-([^%-]-)%.lua") + local scriptbase = match(scriptname,".*mtx%-([^%-]-)%.lua") if scriptbase then local data = io.loaddata(scriptname) - local banner, version = string.match(data,"[\n\r]logs%.extendbanner%s*%(%s*[\"\']([^\n\r]+)%s*(%d+%.%d+)") + local banner, version = match(data,"[\n\r]logs%.extendbanner%s*%(%s*[\"\']([^\n\r]+)%s*(%d+%.%d+)") if banner then valid[#valid+1] = { scriptbase, version, banner } end end end if #valid > 0 then - logs.reportbanner() - logs.reportline() - logs.simple("no script name given, known scripts:") - logs.simple() + application.identify() + report("no script name given, known scripts:") + report() for k=1,#valid do local v = valid[k] - logs.simple("%-12s %4s %s",v[1],v[2],v[3]) + report("%-12s %4s %s",v[1],v[2],v[3]) end end else - logs.simple("no script name given") + report("no script name given") end else filename = file.addsuffix(filename,"lua") if file.is_qualified_path(filename) then - logs.simple("unknown script '%s'",filename) + report("unknown script '%s'",filename) else - logs.simple("unknown script '%s' or 'mtx-%s'",filename,filename) + report("unknown script '%s' or 'mtx-%s'",filename,filename) end end return false @@ -12540,9 +14893,9 @@ function runners.execute_ctx_script(filename) end function runners.prefixes() - logs.reportbanner() - logs.reportline() - logs.simple(table.concat(resolvers.allprefixes(true)," ")) + application.identify() + report() + report(concat(resolvers.allprefixes(true)," ")) end function runners.timedrun(filename) -- just for me @@ -12562,13 +14915,11 @@ end local filename = environment.files[1] or "" local ok = true -local before, after = environment.split_arguments(filename) +local before, after = environment.splitarguments(filename) environment.arguments_before, environment.arguments_after = before, after -environment.initialize_arguments(before) +environment.initializearguments(before) -instance.engine = environment.argument("engine") or 'luatex' -instance.progname = environment.argument("progname") or 'context' -instance.lsrmode = environment.argument("lsr") or false +instance.lsrmode = environment.argument("lsr") or false -- maybe the unset has to go to this level @@ -12576,36 +14927,40 @@ local is_mkii_stub = runners.registered[file.removesuffix(file.basename(filename if environment.argument("usekpse") or environment.argument("forcekpse") or is_mkii_stub then + resolvers.load_tree(environment.argument('tree'),true) -- force resolve of TEXMFCNF + os.setenv("engine","") os.setenv("progname","") local remapper = { - otf = "opentype fonts", - ttf = "truetype fonts", - ttc = "truetype fonts", - pfb = "type1 fonts", + otf = "opentype fonts", + ttf = "truetype fonts", + ttc = "truetype fonts", + pfb = "type1 fonts", other = "other text files", } + local progname = environment.argument("progname") or 'context' + local function kpse_initialized() texconfig.kpse_init = true local t = os.clock() - local k = kpse.original.new("luatex",instance.progname) + local k = kpse.original.new("luatex",progname) local dummy = k:find_file("mtxrun.lua") -- so that we're initialized - logs.simple("kpse fallback with progname '%s' initialized in %s seconds",instance.progname,os.clock()-t) + report("kpse fallback with progname '%s' initialized in %s seconds",progname,os.clock()-t) kpse_initialized = function() return k end return k end - local find_file = resolvers.find_file - local show_path = resolvers.show_path + local findfile = resolvers.findfile + local showpath = resolvers.showpath if environment.argument("forcekpse") then - function resolvers.find_file(name,kind) - return (kpse_initialized():find_file(resolvers.clean_path(name),(kind ~= "" and (remapper[kind] or kind)) or "tex") or "") or "" + function resolvers.findfile(name,kind) + return (kpse_initialized():find_file(resolvers.cleanpath(name),(kind ~= "" and (remapper[kind] or kind)) or "tex") or "") or "" end - function resolvers.show_path(name) + function resolvers.showpath(name) return (kpse_initialized():show_path(name)) or "" end @@ -12613,16 +14968,16 @@ if environment.argument("usekpse") or environment.argument("forcekpse") or is_mk resolvers.load() - function resolvers.find_file(name,kind) - local found = find_file(name,kind) or "" + function resolvers.findfile(name,kind) + local found = findfile(name,kind) or "" if found ~= "" then return found else - return (kpse_initialized():find_file(resolvers.clean_path(name),(kind ~= "" and (remapper[kind] or kind)) or "tex") or "") or "" + return (kpse_initialized():find_file(resolvers.cleanpath(name),(kind ~= "" and (remapper[kind] or kind)) or "tex") or "") or "" end end - function resolvers.show_path(name) - local found = show_path(name) or "" + function resolvers.showpath(name) + local found = showpath(name) or "" if found ~= "" then return found else @@ -12632,80 +14987,317 @@ if environment.argument("usekpse") or environment.argument("forcekpse") or is_mk end + function runners.loadbase() + end + else - resolvers.load() + function runners.loadbase(...) + if not resolvers.load(...) then + report("forcing cache reload") + instance.renewcache = true + trackers.enable("resolvers.locating") + if not resolvers.load(...) then + report("the resolver databases are not present or outdated") + end + end + end + + resolvers.load_tree(environment.argument('tree')) end + if environment.argument("selfmerge") then + -- embed used libraries - utils.merger.selfmerge(own.name,own.libs,own.list) + + runners.loadbase() + local found = locate_libs() + if found then + utilities.merger.selfmerge(own.name,own.libs,{ found }) + end + elseif environment.argument("selfclean") then + -- remove embedded libraries - utils.merger.selfclean(own.name) + + runners.loadbase() + utilities.merger.selfclean(own.name) + elseif environment.argument("selfupdate") then - logs.setverbose(true) - resolvers.update_script(own.name,"mtxrun") + + runners.loadbase() + trackers.enable("resolvers.locating") + resolvers.updatescript(own.name,"mtxrun") + elseif environment.argument("ctxlua") or environment.argument("internal") then + -- run a script by loading it (using libs) + + runners.loadbase() ok = runners.execute_script(filename,true) + elseif environment.argument("script") or environment.argument("scripts") then + -- run a script by loading it (using libs), pass args + + runners.loadbase() if is_mkii_stub then - -- execute mkii script ok = runners.execute_script(filename,false,true) else ok = runners.execute_ctx_script(filename) end + elseif environment.argument("execute") then + -- execute script + + runners.loadbase() ok = runners.execute_script(filename) + elseif environment.argument("direct") then + -- equals bin: + + runners.loadbase() ok = runners.execute_program(filename) + elseif environment.argument("edit") then + -- edit file + + runners.loadbase() runners.edit_script(filename) + elseif environment.argument("launch") then + + runners.loadbase() runners.launch_file(filename) -elseif environment.argument("make") then - -- make stubs + +elseif environment.argument("makestubs") then + + -- make stubs (depricated) + runners.handle_stubs(true) -elseif environment.argument("remove") then - -- remove stub + +elseif environment.argument("removestubs") then + + -- remove stub (depricated) + + runners.loadbase() runners.handle_stubs(false) + elseif environment.argument("resolve") then + -- resolve string + + runners.loadbase() runners.resolve_string(filename) + elseif environment.argument("locate") then + -- locate file + + runners.loadbase() runners.locate_file(filename) -elseif environment.argument("platform")then + +elseif environment.argument("platform") or environment.argument("show-platform") then + -- locate platform + + runners.loadbase() runners.locate_platform() + elseif environment.argument("prefixes") then + + runners.loadbase() runners.prefixes() + elseif environment.argument("timedrun") then + -- locate platform + + runners.loadbase() runners.timedrun(filename) + +elseif environment.argument("variables") or environment.argument("show-variables") or environment.argument("expansions") or environment.argument("show-expansions") then + + -- luatools: runners.execute_ctx_script("mtx-base","--expansions",filename) + + resolvers.load("nofiles") + resolvers.listers.variables(environment.argument("pattern")) + +elseif environment.argument("configurations") or environment.argument("show-configurations") then + + -- luatools: runners.execute_ctx_script("mtx-base","--configurations",filename) + + resolvers.load("nofiles") + resolvers.listers.configurations() + +elseif environment.argument("find-file") then + + -- luatools: runners.execute_ctx_script("mtx-base","--find-file",filename) + + resolvers.load() + local e_pattern = environment.argument("pattern") + local e_format = environment.arguments("format") + if not e_pattern then + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.findfiles,environment.files,e_format) + elseif type(e_pattern) == "string" then + instance.allresults = true -- brrrr + resolvers.dowithfilesandreport(resolvers.findfiles,{ e_pattern }, e_format) + end + +elseif environment.argument("find-path") then + + -- luatools: runners.execute_ctx_script("mtx-base","--find-path",filename) + + resolvers.load() + local path = resolvers.findpath(filename, instance.my_format) + if e_verbose then + report(path) + else + print(path) + end + +elseif environment.argument("expand-braces") then + + -- luatools: runners.execute_ctx_script("mtx-base","--expand-braces",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.expandbraces, environment.files) + +elseif environment.argument("expand-path") then + + -- luatools: runners.execute_ctx_script("mtx-base","--expand-path",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.expandpath, environment.files) + +elseif environment.argument("expand-var") or environment.argument("expand-variable") then + + -- luatools: runners.execute_ctx_script("mtx-base","--expand-var",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.expansion, environment.files) + +elseif environment.argument("show-path") or environment.argument("path-value") then + + -- luatools: runners.execute_ctx_script("mtx-base","--show-path",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.showpath, environment.files) + +elseif environment.argument("var-value") or environment.argument("show-value") then + + -- luatools: runners.execute_ctx_script("mtx-base","--show-value",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.variable,environment.files) + +elseif environment.argument("format-path") then + + -- luatools: runners.execute_ctx_script("mtx-base","--format-path",filename) + + resolvers.load() + report(caches.getwritablepath("format")) + +elseif environment.argument("pattern") then + + -- luatools + + runners.execute_ctx_script("mtx-base","--pattern='" .. environment.argument("pattern") .. "'",filename) + +elseif environment.argument("generate") then + + -- luatools + + instance.renewcache = true + trackers.enable("resolvers.locating") + resolvers.load() + +elseif environment.argument("make") or environment.argument("ini") or environment.argument("compile") then + + -- luatools: runners.execute_ctx_script("mtx-base","--make",filename) + + resolvers.load() + trackers.enable("resolvers.locating") + environment.make_format(filename) + +elseif environment.argument("run") then + + -- luatools + + runners.execute_ctx_script("mtx-base","--run",filename) + +elseif environment.argument("fmt") then + + -- luatools + + runners.execute_ctx_script("mtx-base","--fmt",filename) + +elseif environment.argument("help") and filename=='base' then + + -- luatools + + runners.execute_ctx_script("mtx-base","--help") + elseif environment.argument("help") or filename=='help' or filename == "" then - logs.help(messages.help) - -- execute script + + application.help() + elseif filename:find("^bin:") then + + runners.loadbase() ok = runners.execute_program(filename) + elseif is_mkii_stub then + -- execute mkii script + + runners.loadbase() ok = runners.execute_script(filename,false,true) -else + +elseif false then + + runners.loadbase() ok = runners.execute_ctx_script(filename) if not ok then ok = runners.execute_script(filename) end + +elseif environment.files[1] == 'texmfcnf.lua' then -- so that we don't need to load mtx-base + + resolvers.load("nofiles") + resolvers.listers.configurations() + +else + + runners.loadbase() + runners.execute_ctx_script("mtx-base",filename) + +end + +if e_verbose then + report() + report("runtime: %0.3f seconds",os.runtime()) end -if os.platform == "unix" then - io.write("\n") +if os.type ~= "windows" then + texio.write("\n") -- is this still valid? end if ok == false then ok = 1 elseif ok == true then ok = 0 end diff --git a/Master/texmf-dist/scripts/context/lua/x-ldx.lua b/Master/texmf-dist/scripts/context/lua/x-ldx.lua deleted file mode 100644 index e0f21d68cd9..00000000000 --- a/Master/texmf-dist/scripts/context/lua/x-ldx.lua +++ /dev/null @@ -1,322 +0,0 @@ ---[[ldx-- -Lua Documentation Module - -This file is part of the documentation suite and -itself serves as an example of using in combination -with . - -I will rewrite this using lpeg once I have the time to study that nice new -subsystem. On the other hand, we cannot expect proper -ad for educational purposed the syntax migh be wrong. ---ldx]]-- - -banner = "version 1.0.1 - 2007+ - PRAGMA ADE / CONTEXT" - ---[[ -This script needs a few libraries. Instead of merging the code here -we can use - - -mtxrun --internal x-ldx.lua - - -That way, the libraries included in the runner will be used. -]]-- - --- libraries l-string.lua l-table.lua l-io.lua l-file.lua - --- begin library merge --- end library merge - ---[[ -Just a demo comment line. We will handle such multiline comments but -only when they start and end at the beginning of a line. More rich -comments are tagged differently. -]]-- - ---[[ldx-- -First we define a proper namespace for this module. The l stands for -, the d for documentation and the x for -. ---ldx]]-- - -if not ldx then ldx = { } end - ---[[ldx-- -We load the lua file into a table. The entries in this table themselves are -tables and have keys like code and comment. ---ldx]]-- - -function ldx.load(filename) - local data = file.readdata(filename) - local expr = "%s*%-%-%[%[ldx%-*%s*(.-)%s*%-%-ldx%]%]%-*%s*" - local i, j, t = 0, 0, { } - while true do - local comment, ni - ni, j, comment = data:find(expr, j) - if not ni then break end - t[#t+1] = { code = data:sub(i, ni-1) } - t[#t+1] = { comment = comment } - i = j + 1 - end - local str = data:sub(i, #data) - str = str:gsub("^%s*(.-)%s*$", "%1") - if #str > 0 then - t[#t+1] = { code = str } - end - return t -end - ---[[ldx-- -We will tag keywords so that we can higlight them using a special font -or color. Users can extend this list when needed. ---ldx]]-- - -ldx.keywords = { } - ---[[ldx-- -Here come the reserved words: ---ldx]]-- - -ldx.keywords.reserved = { - ["and"] = 1, - ["break"] = 1, - ["do"] = 1, - ["else"] = 1, - ["elseif"] = 1, - ["end"] = 1, - ["false"] = 1, - ["for"] = 1, - ["function"] = 1, - ["if"] = 1, - ["in"] = 1, - ["local"] = 1, - ["nil"] = 1, - ["not"] = 1, - ["or"] = 1, - ["repeat"] = 1, - ["return"] = 1, - ["then"] = 1, - ["true"] = 1, - ["until"] = 1, - ["while"] = 1 -} - ---[[ldx-- -We need to escape a few tokens. We keep the hash local to the -definition but set it up only once, hence the do -construction. ---ldx]]-- - -do - local e = { [">"] = ">", ["<"] = "<", ["&"] = "&" } - function ldx.escape(str) - return (str:gsub("([><&])",e)) - end -end - ---[[ldx-- -Enhancing the code is a bit tricky due to the fact that we have to -deal with strings and escaped quotes within these strings. Before we -mess around with the code, we hide the strings, and after that we -insert them again. Single and double quoted strings are tagged so -that we can use a different font to highlight them. ---ldx]]-- - -ldx.make_index = true - -function ldx.enhance(data) -- i need to use lpeg and then we can properly autoindent -) - local e = ldx.escape - for k=1,#data do - local v = data[k] - if v.code then - local dqs, sqs, com, cmt, cod = { }, { }, { }, { }, e(v.code) - cod = cod:gsub('\\"', "##d##") - cod = cod:gsub("\\'", "##s##") - cod = cod:gsub("%-%-%[%[.-%]%]%-%-", function(s) - cmt[#cmt+1] = s - return ">>l>" - end) - cod = cod:gsub("%-%-([^\n]*)", function(s) - com[#com+1] = s - return ">>c>" - end) - cod = cod:gsub("(%b\"\")", function(s) - dqs[#dqs+1] = s:sub(2,-2) or "" - return ">>d>" - end) - cod = cod:gsub("(%b\'\')", function(s) - sqs[#sqs+1] = s:sub(2,-2) or "" - return ">>s>" - end) - cod = cod:gsub("(%a+)",function(key) - local class = ldx.keywords.reserved[key] - if class then - return "" .. key .. "" - else - return key - end - end) - cod = cod:gsub(">>s>", function(s) - return "" .. sqs[tonumber(s)] .. "" - end) - cod = cod:gsub(">>d>", function(s) - return "" .. dqs[tonumber(s)] .. "" - end) - cod = cod:gsub(">>c>", function(s) - return "" .. com[tonumber(s)] .. "" - end) - cod = cod:gsub(">>l>", function(s) - return cmt[tonumber(s)] - end) - cod = cod:gsub("##d##", "\\\"") - cod = cod:gsub("##s##", "\\\'") - if ldx.make_index then - local lines = cod:split("\n") - local f = "(function)%s+([%w%.]+)%s*%(" - for k=1,#lines do - local v = lines[k] - -- functies - v = v:gsub(f,function(key, str) - return "" .. str .. "(" - end) - -- variables - v = v:gsub("^([%w][%w%,%s]-)(=[^=])",function(str, rest) - local t = string.split(str, ",%s*") - for k=1,#t do - t[k] = "" .. t[k] .. "" - end - return table.join(t,", ") .. rest - end) - -- so far - lines[k] = v - end - v.code = table.concat(lines,"\n") - else - v.code = cod - end - end - end -end - ---[[ldx-- -We're now ready to save the file in format. This boils -down to wrapping the code and comment as well as the whole document. We tag -lines in the code as such so that we don't need messy CDATA constructs -and by calculating the indentation we also avoid space troubles. It also makes -it possible to change the indentation afterwards. ---ldx]]-- - -function ldx.as_xml(data) -- ldx: not needed - local t, cmode = { }, false - t[#t+1] = "\n" - t[#t+1] = "\n\n" - for k=1,#data do - local v = data[k] - if v.code and not v.code:is_empty() then - t[#t+1] = "\n\n" - local split = v.code:split("\n") - for k=1,#split do -- make this faster - local v = split[k] - local a, b = v:find("^(%s+)") - if v then v = v:gsub("[\n\r ]+$","") end - if a and b then - v = v:sub(b+1,#v) - if cmode then - t[#t+1] = "" .. v .. "\n" - else - t[#t+1] = "" .. v .. "\n" - end - elseif v:is_empty() then - if cmode then - t[#t+1] = "\n" - else - t[#t+1] = "\n" - end - elseif v:find("^%-%-%[%[") then - t[#t+1] = "" .. v .. "\n" - cmode= true - elseif v:find("^%]%]%-%-") then - t[#t+1] = "" .. v .. "\n" - cmode= false - elseif cmode then - t[#t+1] = "" .. v .. "\n" - else - t[#t+1] = "" .. v .. "\n" - end - end - t[#t+1] = "\n" - elseif v.comment then - t[#t+1] = "\n\n" .. v.comment .. "\n\n" - else - -- cannot happen - end - end - t[#t+1] = "\n\n" - return table.concat(t,"") -end - ---[[ldx-- -Saving the result is a trivial effort. ---ldx]]-- - -function ldx.save(filename,data) - file.savedata(filename,ldx.as_xml(data)) -end - ---[[ldx-- -The next function wraps it all in one call: ---ldx]]-- - -function ldx.convert(luaname,ldxname) - if not file.isreadable(luaname) then - luaname = luaname .. ".lua" - end - if file.isreadable(luaname) then - if not ldxname then - ldxname = file.replacesuffix(luaname,"ldx") - end - local data = ldx.load(luaname) - if data then - ldx.enhance(data) - if ldxname ~= luaname then - ldx.save(ldxname,data) - end - end - end -end - ---[[ldx-- -This module can be used directly: - - -mtxrun --internal x-ldx somefile.lua - - -will produce an ldx file that can be processed with -by running: - - -texexec --use=x-ldx --forcexml somefile.ldx - - -You can do this in one step by saying: - - -texmfstart texexec --ctx=x-ldx somefile.lua - - -This will trigger into loading the mentioned - file. That file describes the conversion as well -as the module to be used. - -The main conversion call is: ---ldx]]-- - --- todo: assume usage of "mtxrun --script x-ldx", maybe make it mtx-ldx - -if arg and arg[1] then - ldx.convert(arg[1],arg[2]) -end - ---~ exit(1) diff --git a/Master/texmf-dist/scripts/context/perl/mptopdf.pl b/Master/texmf-dist/scripts/context/perl/mptopdf.pl index ec08c5306b3..42db9001ec4 100755 --- a/Master/texmf-dist/scripts/context/perl/mptopdf.pl +++ b/Master/texmf-dist/scripts/context/perl/mptopdf.pl @@ -27,27 +27,30 @@ use File::Basename ; $Getopt::Long::passthrough = 1 ; # no error message $Getopt::Long::autoabbrev = 1 ; # partial switch accepted -my $Help = 0; -my $Latex = 0; -my $RawMP = 1; +my $Help = 0 ; +my $Latex = 0 ; +my $TeXexec = 0 ; +my $RawMP = 1 ; my $MetaFun = 0 ; -my $PassOn = '' ; +my $PassOn = '' ; &GetOptions ( "help" => \$Help , "rawmp" => \$RawMP, # option is now default, but keep for compat "metafun" => \$MetaFun, "passon" => \$PassOn, # option is ignored, but keep for compat - "latex" => \$Latex ) ; - -my $program = "MPtoPDF 1.4.0" ; -my $pattern = "@ARGV" ; # was $ARGV[0] -my $miktex = 0 ; -my $done = 0 ; -my $report = '' ; + "latex" => \$Latex, + "texexec" => \$TeXexec) ; + +my $program = "MPtoPDF 1.4.1" ; +my $pattern = "@ARGV" ; # was $ARGV[0] +my $miktex = 0 ; +my $done = 0 ; +my $report = '' ; my $mplatexswitch = " --tex=latex " ; +my $texexecswitch = " --tex=\"texexec --batch --once --nomp --mptex\" " ; # untested -my $dosish = ($Config{'osname'} =~/^(ms)?dos|^os\/2|^mswin/i) ; +my $dosish = ($Config{'osname'} =~ /^(ms)?dos|^os\/2|^mswin/i) ; my $escapeshell = (($ENV{'SHELL'}) && ($ENV{'SHELL'} =~ m/sh/i )); if ($ENV{"TEXSYSTEM"}) { @@ -88,6 +91,9 @@ if (($pattern eq '')||($Help)) { if ($Latex) { $rest .= " $mplatexswitch" ; } + if ($TeXexec) { + $rest .= " $texexecswitch" ; + } if ($MetaFun) { $mpbin = "mpost --progname=mpost --mem=metafun" ; } else { diff --git a/Master/texmf-dist/scripts/context/ruby/base/kpse.rb b/Master/texmf-dist/scripts/context/ruby/base/kpse.rb index 0f986878413..313ebbe6286 100644 --- a/Master/texmf-dist/scripts/context/ruby/base/kpse.rb +++ b/Master/texmf-dist/scripts/context/ruby/base/kpse.rb @@ -351,15 +351,25 @@ module Kpse end end + # def Kpse.runscript(name,filename=[],options=[]) + # setscript(name,`texmfstart --locate #{name}`) unless @@scripts.key?(name) + # cmd = "#{@@scripts[name]} #{[options].flatten.join(' ')} #{[filename].flatten.join(' ')}" + # system(cmd) + # end + + # def Kpse.pipescript(name,filename=[],options=[]) + # setscript(name,`texmfstart --locate #{name}`) unless @@scripts.key?(name) + # cmd = "#{@@scripts[name]} #{[options].flatten.join(' ')} #{[filename].flatten.join(' ')}" + # `#{cmd}` + # end + def Kpse.runscript(name,filename=[],options=[]) - setscript(name,`texmfstart --locate #{name}`) unless @@scripts.key?(name) - cmd = "#{@@scripts[name]} #{[options].flatten.join(' ')} #{[filename].flatten.join(' ')}" + cmd = "mtxrun --script #{name} #{[options].flatten.join(' ')} #{[filename].flatten.join(' ')}" system(cmd) end def Kpse.pipescript(name,filename=[],options=[]) - setscript(name,`texmfstart --locate #{name}`) unless @@scripts.key?(name) - cmd = "#{@@scripts[name]} #{[options].flatten.join(' ')} #{[filename].flatten.join(' ')}" + cmd = "mtxrun --script #{name} #{[options].flatten.join(' ')} #{[filename].flatten.join(' ')}" `#{cmd}` end diff --git a/Master/texmf-dist/scripts/context/ruby/base/tex.rb b/Master/texmf-dist/scripts/context/ruby/base/tex.rb index 84025693b01..2184447ce84 100644 --- a/Master/texmf-dist/scripts/context/ruby/base/tex.rb +++ b/Master/texmf-dist/scripts/context/ruby/base/tex.rb @@ -87,8 +87,6 @@ class TEX @@texmethods = Hash.new @@mpsmethods = Hash.new @@pdftex = 'pdftex' # new default, pdfetex is gone - @@luafiles = "luafiles.tmp" - @@luatarget = "lua/context" @@platformslash = if System.unix? then "\\\\" else "\\" end @@ -96,7 +94,6 @@ class TEX ['aleph','omega'] .each do |e| @@texengines[e] = 'aleph' end ['xetex'] .each do |e| @@texengines[e] = 'xetex' end ['petex'] .each do |e| @@texengines[e] = 'petex' end - ['luatex'] .each do |e| @@texengines[e] = 'luatex' end ['metapost','mpost', 'standard'] .each do |e| @@mpsengines[e] = 'mpost' end @@ -118,18 +115,16 @@ class TEX # todo norwegian (no) - ['plain'] .each do |f| @@texformats[f] = 'plain' end - ['cont-en','en','english','context','standard'].each do |f| @@texformats[f] = 'cont-en' end - ['cont-nl','nl','dutch'] .each do |f| @@texformats[f] = 'cont-nl' end - ['cont-de','de','german'] .each do |f| @@texformats[f] = 'cont-de' end - ['cont-it','it','italian'] .each do |f| @@texformats[f] = 'cont-it' end - ['cont-fr','fr','french'] .each do |f| @@texformats[f] = 'cont-fr' end - ['cont-cs','cs','cont-cz','cz','czech'] .each do |f| @@texformats[f] = 'cont-cs' end - ['cont-ro','ro','romanian'] .each do |f| @@texformats[f] = 'cont-ro' end - ['cont-gb','gb','cont-uk','uk','british'] .each do |f| @@texformats[f] = 'cont-gb' end - ['cont-pe','pe','persian'] .each do |f| @@texformats[f] = 'cont-pe' end - ['cont-xp','xp','experimental'] .each do |f| @@texformats[f] = 'cont-xp' end - ['mptopdf'] .each do |f| @@texformats[f] = 'mptopdf' end + ['plain'] .each do |f| @@texformats[f] = 'plain' end + ['cont-en','en','english','context','standard'].each do |f| @@texformats[f] = 'cont-en.mkii' end + ['cont-nl','nl','dutch'] .each do |f| @@texformats[f] = 'cont-nl.mkii' end + ['cont-de','de','german'] .each do |f| @@texformats[f] = 'cont-de.mkii' end + ['cont-it','it','italian'] .each do |f| @@texformats[f] = 'cont-it.mkii' end + ['cont-fr','fr','french'] .each do |f| @@texformats[f] = 'cont-fr.mkii' end + ['cont-cs','cs','cont-cz','cz','czech'] .each do |f| @@texformats[f] = 'cont-cs.mkii' end + ['cont-ro','ro','romanian'] .each do |f| @@texformats[f] = 'cont-ro.mkii' end + ['cont-gb','gb','cont-uk','uk','british'] .each do |f| @@texformats[f] = 'cont-gb.mkii' end + ['mptopdf'] .each do |f| @@texformats[f] = 'mptopdf' end ['latex'] .each do |f| @@texformats[f] = 'latex.ltx' end @@ -137,15 +132,20 @@ class TEX ['metafun','context','standard'] .each do |f| @@mpsformats[f] = 'metafun' end ['pdftex','pdfetex','aleph','omega','petex', - 'xetex','luatex'] .each do |p| @@prognames[p] = 'context' end + 'xetex'] .each do |p| @@prognames[p] = 'context' end ['mpost'] .each do |p| @@prognames[p] = 'metafun' end ['latex','pdflatex'] .each do |p| @@prognames[p] = 'latex' end ['plain','default','standard','mptopdf'] .each do |f| @@texmethods[f] = 'plain' end - ['cont-en','cont-nl','cont-de','cont-it', - 'cont-fr','cont-cs','cont-ro','cont-gb', - 'cont-pe','cont-xp'] .each do |f| @@texmethods[f] = 'context' end - ['latex','pdflatex'] .each do |f| @@texmethods[f] = 'latex' end + ['cont-en','cont-en.mkii', + 'cont-nl','cont-nl.mkii', + 'cont-de','cont-de.mkii', + 'cont-it','cont-it.mkii', + 'cont-fr','cont-fr.mkii', + 'cont-cs','cont-cs.mkii', + 'cont-ro','cont-ro.mkii', + 'cont-gb','cont-gb.mkii'] .each do |f| @@texmethods[f] = 'context' end + ['latex','latex.ltx','pdflatex'] .each do |f| @@texmethods[f] = 'latex' end # untested ['plain','default','standard'] .each do |f| @@mpsmethods[f] = 'plain' end ['metafun'] .each do |f| @@mpsmethods[f] = 'metafun' end @@ -158,7 +158,6 @@ class TEX 'cont-pe','cont-xp'] .each do |f| @@texprocstr[f] = @@platformslash + "emergencyend" end @@runoptions['aleph'] = ['--8bit'] - @@runoptions['luatex'] = ['--file-line-error'] @@runoptions['mpost'] = ['--8bit'] @@runoptions['pdfetex'] = ['--8bit'] # obsolete @@runoptions['pdftex'] = ['--8bit'] # pdftex is now pdfetex @@ -166,11 +165,9 @@ class TEX @@runoptions['xetex'] = ['--8bit','-output-driver="xdvipdfmx -E -d 4 -V 5"'] @@draftoptions['pdftex'] = ['--draftmode'] @@synctexcoptions['pdftex'] = ['--synctex=1'] - @@synctexcoptions['luatex'] = ['--synctex=1'] @@synctexcoptions['xetex'] = ['--synctex=1'] @@tcxflag['aleph'] = true - @@tcxflag['luatex'] = false @@tcxflag['mpost'] = false @@tcxflag['pdfetex'] = true @@tcxflag['pdftex'] = true @@ -184,7 +181,7 @@ class TEX 'nomapfiles', 'local', 'arrange', 'noarrange', 'forcexml', 'foxet', - 'alpha', 'beta', 'luatex', + 'alpha', 'beta', 'mpyforce', 'forcempy', 'forcetexutil', 'texutil', 'globalfile', 'autopath', @@ -198,7 +195,7 @@ class TEX 'filters', 'usemodules', 'environments', 'separation', 'setuppath', 'arguments', 'input', 'output', 'randomseed', 'modes', 'mode', 'filename', 'ctxfile', 'printformat', 'paperformat', 'paperoffset', - 'timeout', 'passon' + 'timeout', 'passon', 'pdftitle' ] @@mainstandardvars = [ 'mainlanguage', 'bodyfont', 'language' @@ -362,9 +359,9 @@ class TEX end rescue end - ['mpgraph.mp'].each do |file| - (File.delete(file) if (FileTest.size?(file) rescue 10) < 10) rescue false - end + # ['mpgraph.mp'].each do |file| + # (File.delete(file) if (FileTest.size?(file) rescue 10) < 10) rescue false + # end end def backends() @@backends.keys.sort end @@ -426,7 +423,7 @@ class TEX def prefixed(format,engine) # format case engine - when /etex|pdftex|pdfetex|aleph|xetex|luatex/io then + when /etex|pdftex|pdfetex|aleph|xetex/io then "*#{format}" else format @@ -442,14 +439,6 @@ class TEX if str.class == String then str.split(',') else str.flatten end end - def validtexformat(str) validsomething(str,@@texformats,'tex') end - def validmpsformat(str) validsomething(str,@@mpsformats,'mp' ) end - def validtexengine(str) validsomething(str,@@texengines,'pdftex') end - def validmpsengine(str) validsomething(str,@@mpsengines,'mpost' ) end - - def validtexmethod(str) [validsomething(str,@@texmethods)].flatten.first end - def validmpsmethod(str) [validsomething(str,@@mpsmethods)].flatten.first end - def validsomething(str,something,type=nil) if str then list = [str].flatten.collect do |s| @@ -471,6 +460,15 @@ class TEX end end + def validtexformat(str) validsomething(str,@@texformats,'tex') || + validsomething(str,@@texformats,'mkii') end + def validmpsformat(str) validsomething(str,@@mpsformats,'mp' ) end + def validtexengine(str) validsomething(str,@@texengines,'pdftex') end + def validmpsengine(str) validsomething(str,@@mpsengines,'mpost' ) end + + def validtexmethod(str) [validsomething(str,@@texmethods)].flatten.first end + def validmpsmethod(str) [validsomething(str,@@mpsmethods)].flatten.first end + def validbackend(str) if str && @@backends.key?(str) then @@backends[str] @@ -562,7 +560,7 @@ class TEX # will go to context/process context/listing etc def contextversion # ook elders gebruiken - filename = Kpse.found('context.tex') + filename = Kpse.found('context.mkii') version = 'unknown' begin if FileTest.file?(filename) && IO.read(filename).match(/\\contextversion\{(\d+\.\d+\.\d+.*?)\}/) then @@ -573,39 +571,6 @@ 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 - FileUtils.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 @@ -618,14 +583,6 @@ class TEX else report('updating file database') Kpse.update # obsolete here - if getvariable('luatex') then - begin - runcommand(["luatools","--generate","--verbose"]) - rescue - report("run 'luatools --generate' manualy") - exit - end - end end # goody if getvariable('texformats') == 'standard' then @@ -658,22 +615,10 @@ class TEX # makeuserfile # makeresponsefile # end - if texengine == 'luatex' then - cleanupluafiles - texformats.each do |texformat| - report("generating tex format #{texformat}") - flags = ['--ini','--compile'] - flags << '--verbose' if getvariable('verbose') - flags << '--mkii' if getvariable('mkii') - run_luatools("#{flags.join(" ")} #{texformat}") - end - compileluafiles - else - texformats.each do |texformat| - report("generating tex format #{texformat}") - progname = validprogname([getvariable('progname'),texformat,texengine]) - runcommand([quoted(texengine),prognameflag(progname),iniflag,tcxflag(texengine),prefixed(texformat,texengine),texmakeextras(texformat)]) - end + texformats.each do |texformat| + report("generating tex format #{texformat}") + progname = validprogname([getvariable('progname'),texformat,texengine]) + runcommand([quoted(texengine),prognameflag(progname),iniflag,tcxflag(texengine),prefixed(texformat,texengine),texmakeextras(texformat)]) end else report("unable to make format due to lack of permissions") @@ -728,15 +673,6 @@ class TEX 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) @@ -781,7 +717,7 @@ class TEX f.close if FileTest.file?(tempfilename('tex')) then format = File.basename(name) - engine = if name =~ /(pdftex|pdfetex|aleph|xetex|luatex)[\/\\]#{format}/ then $1 else '' end + engine = if name =~ /(pdftex|pdfetex|aleph|xetex)[\/\\]#{format}/ then $1 else '' end if engine.empty? then engineflag = "" else @@ -831,7 +767,7 @@ class TEX private - def makeuserfile # not used in luatex (yet) + def makeuserfile language = getvariable('language') mainlanguage = getvariable('mainlanguage') bodyfont = getvariable('bodyfont') @@ -1179,24 +1115,6 @@ 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("luatex --luaonly #{script} #{args}") - # end - # end - # end - # return runcommand("texmfstart luatools #{args}") - # end - - def run_luatools(args) - return runcommand("luatools #{args}") - end - def processmpgraphic getarrayvariable('files').each do |filename| setvariable('filename',filename) @@ -1584,17 +1502,8 @@ end report("tex format: #{texformat}") if texengine && texformat then fixbackendvars(@@mappaths[texengine]) - if texengine == "luatex" then - # currently we use luatools to start luatex but some day we should - # find a clever way to directly call luatex (problem is that we need - # to feed the explicit location of the format and lua initialization - # file) - run_luatools("--fmt=#{texformat} #{filename}") - else - progname = validprogname([getvariable('progname'),texformat,texengine]) - runcommand([quoted(texengine),prognameflag(progname),formatflag(texengine,texformat),tcxflag(texengine),runoptions(texengine),filename,texprocextras(texformat)]) - end - # true + progname = validprogname([getvariable('progname'),texformat,texengine]) + runcommand([quoted(texengine),prognameflag(progname),formatflag(texengine,texformat),tcxflag(texengine),runoptions(texengine),filename,texprocextras(texformat)]) else false end @@ -1673,24 +1582,6 @@ end end end - 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) @@ -1928,7 +1819,6 @@ end 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 @@ -1979,7 +1869,6 @@ end mprundone = runtexmpjob(rawbase, "mprun") end ok = runtexutil(rawbase) - runluacheck(rawbase) state.update stoprunning = state.stable? end @@ -1989,7 +1878,6 @@ end end 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') diff --git a/Master/texmf-dist/scripts/context/ruby/ctxtools.rb b/Master/texmf-dist/scripts/context/ruby/ctxtools.rb index 67baaab39c4..339f3d4906a 100644 --- a/Master/texmf-dist/scripts/context/ruby/ctxtools.rb +++ b/Master/texmf-dist/scripts/context/ruby/ctxtools.rb @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +#encoding: ASCII-8BIT # program : ctxtools # copyright : PRAGMA Advanced Document Engineering @@ -553,7 +554,7 @@ class Commands "tuo", "tub", "top", "tuc" ] $dummyfiles = [ - "mpgraph" + # "mpgraph" ] def removecontextfile (filename) @@ -1852,8 +1853,6 @@ class Commands ok = data.add_shebang(filename,'perl') when /\.py$/ then ok = data.add_shebang(filename,'python') - when /\.lua$/ then - ok = data.add_shebang(filename,'lua') when /\.tex$/ then ok = data.add_directive(filename,'tex') when /\.mp$/ then @@ -2696,11 +2695,7 @@ class Commands def remakeformats system("mktexlsr") - system("luatools --selfupdate") - system("mtxrun --selfupdate") - system("luatools --generate") system("texmfstart texexec --make --all --fast --pdftex") - system("texmfstart texexec --make --all --fast --luatex") system("texmfstart texexec --make --all --fast --xetex") return true end diff --git a/Master/texmf-dist/scripts/context/ruby/fcd_start.rb b/Master/texmf-dist/scripts/context/ruby/fcd_start.rb index 28f407c761e..b1fa42a2a69 100644 --- a/Master/texmf-dist/scripts/context/ruby/fcd_start.rb +++ b/Master/texmf-dist/scripts/context/ruby/fcd_start.rb @@ -38,6 +38,8 @@ # fcd [--find] whatever . (last choice with this pattern) # fcd --list +# todo: HOMEDRIVE\HOMEPATH + require 'rbconfig' class FastCD diff --git a/Master/texmf-dist/scripts/context/ruby/mtxtools.rb b/Master/texmf-dist/scripts/context/ruby/mtxtools.rb deleted file mode 100644 index 41d0f7085b1..00000000000 --- a/Master/texmf-dist/scripts/context/ruby/mtxtools.rb +++ /dev/null @@ -1,475 +0,0 @@ -#!/usr/bin/env ruby - -# program : mtxtools -# copyright : PRAGMA Advanced Document Engineering -# version : 2004-2005 -# author : Hans Hagen -# -# info : j.hagen@xs4all.nl -# www : www.pragma-ade.com - -# This script hosts MetaTeX related features. - -banner = ['MtxTools', 'version 1.0.0', '2006', 'PRAGMA ADE/POD'] - -$: << File.expand_path(File.dirname($0)) ; $: << File.join($:.last,'lib') ; $:.uniq! - -require 'base/switch' -require 'base/logger' -require 'base/system' -require 'base/kpse' - -class Reporter - def report(str) - puts(str) - end -end - -module ConTeXt - - def ConTeXt::banner(filename,companionname,compact=false) - "-- filename : #{File.basename(filename)}\n" + - "-- comment : companion to #{File.basename(companionname)} (in ConTeXt)\n" + - "-- author : Hans Hagen, PRAGMA-ADE, Hasselt NL\n" + - "-- copyright: PRAGMA ADE / ConTeXt Development Team\n" + - "-- license : see context related readme files\n" + - if compact then "\n-- remark : compact version\n" else "" end - end - -end - -class UnicodeTables - - @@version = "1.001" - - @@shape_a = /^((GREEK|LATIN|HEBREW)\s*(SMALL|CAPITAL|)\s*LETTER\s*[A-Z]+)$/ - @@shape_b = /^((GREEK|LATIN|HEBREW)\s*(SMALL|CAPITAL|)\s*LETTER\s*[A-Z]+)\s*(.+)$/ - - @@shape_a = /^(.*\s*LETTER\s*[A-Z]+)$/ - @@shape_b = /^(.*\s*LETTER\s*[A-Z]+)\s+WITH\s+(.+)$/ - - attr_accessor :context, :comment - - def initialize(logger=Reporter.new) - @data = Array.new - @logger = logger - @error = false - @context = true - @comment = true - @shapes = Hash.new - end - - def load_unicode_data(filename='unicodedata.txt') - # beware, the unicodedata table is bugged, sometimes ending - @logger.report("reading base data from #{filename}") if @logger - begin - IO.readlines(filename).each do |line| - if line =~ /^[0-9A-F]{4,4}/ then - d = line.chomp.sub(/\;$/, '').split(';') - if d then - while d.size < 15 do d << '' end - n = d[0].hex - @data[n] = d - if d[1] =~ @@shape_a then - @shapes[$1] = d[0] - end - end - end - end - rescue - @error = true - @logger.report("error while reading base data from #{filename}") if @logger - end - end - - def load_context_data(filename='contextnames.txt') - @logger.report("reading data from #{filename}") if @logger - begin - IO.readlines(filename).each do |line| - if line =~ /^[0-9A-F]{4,4}/ then - d = line.chomp.split(';') - if d then - n = d[0].hex - if @data[n] then - @data[d[0].hex] << d[1] # adobename == 15 - @data[d[0].hex] << d[2] # contextname == 16 - else - @logger.report("missing information about #{d} in #{filename}") if @logger - end - end - end - end - rescue - @error = true - @logger.report("error while reading context data from #{filename}") if @logger - end - end - - def save_metatex_data(filename='char-def.lua',compact=false) - if not @error then - begin - File.open(filename,'w') do |f| - @logger.report("saving data in #{filename}") if @logger - f << ConTeXt::banner(filename,'char-def.tex',compact) - f << "\n" - f << "\nif not versions then versions = { } end versions['#{filename.gsub(/\..*?$/,'')}'] = #{@@version}\n" - f << "\n" - f << "if not characters then characters = { } end\n" - f << "if not characters.data then characters.data = { } end\n" - f << "\n" - f << "characters.data = {\n" if compact - @data.each do |d| - if d then - r = metatex_data(d) - if compact then - f << "\t" << "[0x#{d[0]}]".rjust(8,' ') << " = { #{r.join(", ").gsub(/\t/,'')} }, \n" - else - f << "characters.define { -- #{d[0].hex}" << "\n" - f << r.join(",\n") << "\n" - f << "}" << "\n" - end - end - end - f << "}\n" if compact - end - rescue - @logger.report("error while saving data in #{filename}") if @logger - else - @logger.report("#{@data.size} (#{sprintf('%X',@data.size)}) entries saved in #{filename}") if @logger - end - else - @logger.report("not saving data in #{filename} due to previous error") if @logger - end - end - - def metatex_data(d) - r = Array.new - r << "\tunicodeslot=0x#{d[0]}" - if d[2] && ! d[2].empty? then - r << "\tcategory='#{d[2].downcase}'" - end - if @context then - if d[15] && ! d[15].empty? then - r << "\tadobename='#{d[15]}'" - end - if d[16] && ! d[16].empty? then - r << "\tcontextname='#{d[16]}'" - end - end - if @comment then - if d[1] == "" then - r << "\tdescription='#{d[10]}'" unless d[10].empty? - else - r << "\tdescription='#{d[1]}'" unless d[1].empty? - end - end - if d[1] =~ @@shape_b then - r << "\tshcode=0x#{@shapes[$1]}" if @shapes[$1] - end - if d[12] && ! d[12].empty? then - r << "\tuccode=0x#{d[12]}" - elsif d[14] && ! d[14].empty? then - r << "\tuccode=0x#{d[14]}" - end - if d[13] && ! d[13].empty? then - r << "\tlccode=0x#{d[13]}" - end - if d[5] && ! d[5].empty? then - special, specials = '', Array.new - c = d[5].split(/\s+/).collect do |cc| - if cc =~ /^\<(.*)\>$/io then - special = $1.downcase - else - specials << "0x#{cc}" - end - end - if specials.size > 0 then - special = 'char' if special.empty? - r << "\tspecials={'#{special}',#{specials.join(',')}}" - end - end - return r - end - - def save_xetex_data(filename='enco-utf.tex') - if not @error then - begin - minnumber, maxnumber, n = 0x001F, 0xFFFF, 0 - File.open(filename,'w') do |f| - @logger.report("saving data in #{filename}") if @logger - f << "% filename : #{filename}\n" - f << "% comment : poor man's alternative for a proper enco file\n" - f << "% this file is generated by mtxtools and can be\n" - f << "% used in xetex and luatex mkii mode\n" - f << "% author : Hans Hagen, PRAGMA-ADE, Hasselt NL\n" - f << "% copyright: PRAGMA ADE / ConTeXt Development Team\n" - f << "% license : see context related readme files\n" - f << "\n" - f << "\\ifx\\setcclcucx\\undefined\n" - f << "\n" - f << " \\def\\setcclcucx #1 #2 #3 %\n" - f << " {\\global\\catcode\"#1=11 \n" - f << " \\global\\lccode \"#1=\"#2 \n" - f << " \\global\\uccode \"#1=\"#3 }\n" - f << "\n" - f << "\\fi\n" - f << "\n" - @data.each do |d| - if d then - number, type = d[0], d[2].downcase - if number.hex >= minnumber && number.hex <= maxnumber && type =~ /^l(l|u|t)$/o then - if d[13] && ! d[13].empty? then - lc = d[13] - else - lc = number - end - if d[12] && ! d[12].empty? then - uc = d[12] - elsif d[14] && ! d[14].empty? then - uc = d[14] - else - uc = number - end - if @comment then - f << "\\setcclcuc #{number} #{lc} #{uc} % #{d[1]}\n" - else - f << "\\setcclcuc #{number} #{lc} #{uc} \n" - end - n += 1 - end - end - end - f << "\n" - f << "\\endinput\n" - end - rescue - @logger.report("error while saving data in #{filename}") if @logger - else - @logger.report("#{n} entries saved in #{filename}") if @logger - end - else - @logger.report("not saving data in #{filename} due to previous error") if @logger - end - end - -end - -class RegimeTables - - @@version = "1.001" - - def initialize(logger=Reporter.new) - @logger = logger - reset - end - - def reset - @code, @regime, @filename, @loaded = Array.new(256), '', '', false - (32..127).each do |i| - @code[i] = [sprintf('%04X',i), i.chr] - end - end - - def load(filename) - begin - reset - if filename =~ /regi\-(ini|run|uni|utf|syn)/ then - report("skipping #{filename}") - else - report("loading file #{filename}") - @regime, unicodeset = File.basename(filename).sub(/\..*?$/,''), false - IO.readlines(filename).each do |line| - case line - when /^\#/ then - # skip - when /^(0x[0-9A-F]+)\s+(0x[0-9A-F]+)\s+\#\s+(.*)$/ then - @code[$1.hex], unicodeset = [$2, $3], true - when /^(0x[0-9A-F]+)\s+(0x[0-9A-F]+)\s+/ then - @code[$1.hex], unicodeset = [$2, ''], true - end - end - reset if not unicodeset - end - rescue - report("problem in loading file #{filename}") - reset - else - if ! @regime.empty? then - @loaded = true - else - reset - end - end - end - - def save(filename,compact=false) - begin - if @loaded && ! @regime.empty? then - if File.expand_path(filename) == File.expand_path(@filename) then - report("saving in #{filename} is blocked") - else - report("saving file #{filename}") - File.open(filename,'w') do |f| - f << ConTeXt::banner(filename,'regi-ini.tex',compact) - f << "\n" - f << "\nif not versions then versions = { } end versions['#{filename.gsub(/\..*?$/,'')}'] = #{@@version}\n" - f << "\n" - f << "if not regimes then regimes = { } end\n" - f << "if not regimes.data then regimes.data = { } end\n" - f << "\n" - if compact then - f << "regimes.data[\"#{@regime}\"] = { [0] = \n\t" - i = 17 - @code.each_index do |c| - if (i-=1) == 0 then - i = 16 - f << "\n\t" - end - if @code[c] then - f << @code[c][0].rjust(6,' ') - else - f << "0x0000".rjust(6,' ') - end - f << ', ' if c<@code.length-1 - end - f << "\n}\n" - else - @code.each_index do |c| - if @code[c] then - f << someregimeslot(@regime,c,@code[c][0],@code[c][1]) - else - f << someregimeslot(@regime,c,'','') - end - end - end - end - end - end - rescue - report("problem in saving file #{filename} #{$!}") - end - end - - def report(str) - @logger.report(str) - end - - private - - def someregimeslot(regime,slot,unicodeslot,comment) - "regimes.define { #{if comment.empty? then '' else '-- ' end} #{comment}\n" + - "\tregime='#{regime}',\n" + - "\tslot='#{sprintf('0x%02X',slot)}',\n" + - "\tunicodeslot='#{if unicodeslot.empty? then '0x0000' else unicodeslot end}'\n" + - "}\n" - end - - public - - def RegimeTables::convert(filenames,compact=false) - filenames.each do |filename| - txtfile = File.expand_path(filename) - luafile = File.join(File.dirname(txtfile),'regi-'+File.basename(txtfile.sub(/\..*?$/, '.lua'))) - unless txtfile == luafile then - regime = RegimeTables.new - regime.load(txtfile) - regime.save(luafile,compact) - end - end - end - -end - -class Commands - - include CommandBase - - def unicodetable - unicode = UnicodeTables.new(logger) - unicode.load_unicode_data - unicode.load_context_data - unicode.save_metatex_data('char-def.lua',@commandline.option('compact')) - end - - def xetextable - unicode = UnicodeTables.new(logger) - unicode.load_unicode_data - unicode.load_context_data - # unicode.comment = false - unicode.save_xetex_data - end - - def regimetable - if @commandline.arguments.length > 0 then - RegimeTables::convert(@commandline.arguments, @commandline.option('compact')) - else - RegimeTables::convert(Dir.glob("cp*.txt") , @commandline.option('compact')) - RegimeTables::convert(Dir.glob("8859*.txt") , @commandline.option('compact')) - end - end - - def pdftextable - # instead of directly saving the data, we use luatex (kind of test) - pdfrdef = 'pdfr-def.tex' - tmpfile = 'mtxtools.tmp' - File.delete(pdfrdef) rescue false - if f = File.open(tmpfile,'w') then - f << "\\starttext\n" - f << "\\ctxlua{characters.pdftex.make_pdf_to_unicodetable('#{pdfrdef}')}\n" - f << "\\stoptext\n" - f.close() - system("texmfstart texexec --luatex --once --purge mtxtools.tmp") - report("vecor saved in #{pdfrdef}") - end - File.delete(tmpfile) rescue false - end - - def xmlmapfile - # instead of directly saving the data, we use luatex (kind of test) - tmpfile = 'mtxtools.tmp' - xmlsuffix = 'frx' - @commandline.arguments.each do |mapname| - if f = File.open(tmpfile,'w') then - xmlname = mapname.gsub(/\.map$/,".#{xmlsuffix}") - File.delete(xmlname) rescue false - f << "\\starttext\n" - f << "\\ctxlua{\n" - f << " mapname = input.find_file(texmf.instance,'#{mapname}') or ''\n" - f << " xmlname = '#{xmlname}'\n" - f << " if mapname and not mapname:is_empty() then\n" - f << " ctx.fonts.map.convert_file(mapname,xmlname)\n" - f << " end\n" - f << "}\n" - f << "\\stoptext\n" - f.close() - system("texmfstart texexec --luatex --once --purge mtxtools.tmp") - if FileTest.file?(xmlname) then - report("map file #{mapname} converted to #{xmlname}") - else - report("no valid map file #{mapname}") - end - end - end - File.delete(tmpfile) rescue false - end - -end - -logger = Logger.new(banner.shift) -commandline = CommandLine.new - -commandline.registeraction('unicodetable', 'create unicode table for metatex/luatex') -commandline.registeraction('regimetable' , 'create regime table(s) for metatex/luatex [--compact]') -commandline.registeraction('xetextable' , 'create unicode table for xetex') -commandline.registeraction('pdftextable' , 'create unicode table for xetex') -commandline.registeraction('xmlmapfile' , 'convert traditional mapfile to xml font resourse') - -# general - -commandline.registeraction('help') -commandline.registeraction('version') -commandline.registerflag('compact') - -commandline.expand - -Commands.new(commandline,logger,banner).send(commandline.action || 'help') diff --git a/Master/texmf-dist/scripts/context/ruby/rslibtool.rb b/Master/texmf-dist/scripts/context/ruby/rslibtool.rb new file mode 100644 index 00000000000..7ae5efb647e --- /dev/null +++ b/Master/texmf-dist/scripts/context/ruby/rslibtool.rb @@ -0,0 +1,114 @@ +# program : rslibtool +# copyright : PRAGMA Publishing On Demand +# version : 1.00 - 2002 +# author : Hans Hagen +# +# project : eXaMpLe +# concept : Hans Hagen +# info : j.hagen@xs4all.nl +# www : www.pragma-pod.com / www.pragma-ade.com + +# --add --base=filename --path=directory pattern +# --remove --base=filename --path=directory label +# --sort --base=filename --path=directory +# --purge --base=filename --path=directory +# --dummy --base=filename +# --namespace + +# rewrite + +unless defined? ownpath + ownpath = $0.sub(/[\\\/]\w*?\.rb/i,'') + $: << ownpath +end + +require 'rslb/base' +require 'xmpl/base' +require 'xmpl/switch' + +session = Example.new('rslbtool', '1.0', 'PRAGMA POD') + +session.identify + +commandline = CommandLine.new + +commandline.registerflag('add') +commandline.registerflag('remove') +commandline.registerflag('delete') +commandline.registerflag('sort') +commandline.registerflag('purge') +commandline.registerflag('dummy') +commandline.registerflag('process') +commandline.registerflag('namespace') + +commandline.registervalue('prefix') +commandline.registervalue('base') +commandline.registervalue('path') +commandline.registervalue('result') +commandline.registervalue('texexec') +commandline.registervalue('zipalso') + +commandline.expand + +session.inherit(commandline) + +base = session.get('option.base') +path = session.get('option.path') + +base = 'rslbtool.xml' if base.empty? + +# when path is given, assume that arg list is list of +# suffixes, else assume it is a list of globbed filespec + +if path.empty? + base += '.xml' unless base =~ /\..+$/ + list = commandline.arguments +else + Dir.chdir(File.dirname(path)) + list = Dir.glob("*.{#{commandline.arguments.join(',')}}") +end + +begin + reslib = Resource.new(base,session.get('option.namespace')) + reslib.load(base) +rescue + session.error('problems with loading base') + exit +end + +unless session.get('option.texexec').empty? + reslib.set_texexec(session.get('option.texexec')) +end + +if session.get('option.add') + + session.report('adding records', list) + reslib.add_figures(list,session.get('option.prefix')) + +elsif session.get('option.remove') or session.get('option.delete') + + session.report('removing records') + reslib.delete_figures(list) + +elsif session.get('option.sort') + + session.report('sorting records') + reslib.sort_figures() + +elsif session.get('option.purge') + + session.report('purging records') + reslib.purge_figures() + +elsif session.get('option.dummy') + + session.report('creating dummy records') + reslib.create_dummies(session.get('option.process'),session.get('option.result'),session.get('option.zipalso')) + +else + + session.warning('provide action') + +end + +reslib.save(base) diff --git a/Master/texmf-dist/scripts/context/ruby/texexec.rb b/Master/texmf-dist/scripts/context/ruby/texexec.rb index 94b14e4283c..32c9d0ca538 100644 --- a/Master/texmf-dist/scripts/context/ruby/texexec.rb +++ b/Master/texmf-dist/scripts/context/ruby/texexec.rb @@ -164,7 +164,8 @@ class Commands if fast or (files.length > 0) then if f = File.open(job.tempfilename('tex'),'w') then files.delete("texexec.pdf") - Kpse.runscript('rlxtools', ['--identify','--collect'], files.join(' ')) unless fast + # Kpse.runscript('rlxtools', ['--identify','--collect'], files.join(' ')) unless fast + system("texmfstart rlxtools --identify --collect #{files.join(' ')}") figures = @commandline.checkedoption('method', 'a').downcase paperoffset = @commandline.checkedoption('paperoffset', '0pt') backspace = @commandline.checkedoption('backspace', '1.5cm') @@ -226,7 +227,8 @@ class Commands else markfile = nil end - Kpse.runscript('ctxtools',ffname,'--document') + # Kpse.runscript('ctxtools',['--document'],ffname) + system("texmfstart ctxtools --document #{ffname}") if ted = File.silentopen(File.suffixed(ffname,'ted')) then firstline = ted.gets if firstline =~ /interface=/o then @@ -506,6 +508,7 @@ class Commands combination = @commandline.checkedoption('combination','2*2').split(/[\*x]/o) paperformat = @commandline.checkedoption('paperformat', 'A4*A4').split(/[\*x]/o) bannerheight = @commandline.checkedoption('bannerheight', '') + pdftitle = @commandline.checkedoption('pdftitle', '') nx, ny = combination[0] || '2', combination[1] || combination[0] || '2' from, to = paperformat[0] || 'A4', paperformat[1] || paperformat[0] || 'A4' f << "\\setuppapersize[#{from}][#{to}]\n" @@ -523,8 +526,10 @@ class Commands f << "\\setuplayout[footer=0cm]\n" f << "\\setupbackgrounds[page][background=]\n" end - f << "\\setupexternalfigures\n" - f << " [directory=]\n" + f << "\\setupexternalfigures[directory=]\n" + if not pdftitle.empty? then + f << "\\setupinteraction[state=start,title={#{pdftitle}}]\n" + end f << "\\starttext\n" files.each do |filename| result = @commandline.checkedoption('result','texexec') @@ -582,8 +587,6 @@ job.setvariable('given.backend',job.getvariable('backend')) if (str = @commandline.option('engine')) && ! str.standard? && ! str.empty? then job.setvariable('texengine',str) - elsif @commandline.oneof('luatex') then - job.setvariable('texengine','luatex') elsif @commandline.oneof('pdfetex','pdftex','pdf') then job.setvariable('texengine','pdftex') elsif @commandline.oneof('xetex','xtx') then @@ -598,7 +601,7 @@ job.setvariable('given.backend',job.getvariable('backend')) if (str = @commandline.option('backend')) && ! str.standard? && ! str.empty? then job.setvariable('backend',str) - elsif @commandline.oneof('pdfetex','pdftex','pdf','luatex') then + elsif @commandline.oneof('pdfetex','pdftex','pdf') then job.setvariable('backend','pdftex') elsif @commandline.oneof('dvipdfmx','dvipdfm','dpx','dpm') then job.setvariable('backend','dvipdfmx') @@ -616,7 +619,6 @@ job.setvariable('given.backend',job.getvariable('backend')) case job.getvariable('texengine') when 'pdfetex' then job.setvariable('backend','pdftex') when 'pdftex' then job.setvariable('backend','pdftex') - when 'luatex' then job.setvariable('backend','pdftex') when 'xetex' then job.setvariable('backend','xetex') when 'petex' then job.setvariable('backend','dvipdfmx') when 'aleph' then job.setvariable('backend','dvipdfmx') @@ -756,7 +758,6 @@ end commandline.registerflag('pdf') commandline.registerflag('pdftex') commandline.registerflag('pdfetex') -commandline.registerflag('luatex') commandline.registerflag('dvipdfmx') commandline.registerflag('dvipdfm') diff --git a/Master/texmf-dist/scripts/context/ruby/texmfstart.rb b/Master/texmf-dist/scripts/context/ruby/texmfstart.rb index 97087c3ae40..be892c83ced 100755 --- a/Master/texmf-dist/scripts/context/ruby/texmfstart.rb +++ b/Master/texmf-dist/scripts/context/ruby/texmfstart.rb @@ -158,7 +158,6 @@ $runners = Hash.new $suffixinputs['pl'] = 'PERLINPUTS' $suffixinputs['rb'] = 'RUBYINPUTS' $suffixinputs['py'] = 'PYTHONINPUTS' -$suffixinputs['lua'] = 'LUAINPUTS' $suffixinputs['jar'] = 'JAVAINPUTS' $suffixinputs['pdf'] = 'PDFINPUTS' @@ -183,7 +182,6 @@ $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' @@ -213,12 +211,11 @@ $makelist = [ 'texfind', 'texshow' # - # no 'luatools', # no 'mtxtools', # no, 'texmfstart' ] -$scriptlist = 'rb|pl|py|lua|jar' +$scriptlist = 'rb|pl|py|jar' $documentlist = 'pdf|ps|eps|htm|html' $editor = ENV['TEXMFSTART_EDITOR'] || ENV['EDITOR'] || ENV['editor'] || 'scite' @@ -230,7 +227,6 @@ def set_applications(page=1) $applications['unknown'] = '' $applications['ruby'] = $applications['rb'] = 'ruby' - $applications['lua'] = $applications['lua'] = 'lua' $applications['perl'] = $applications['pl'] = 'perl' $applications['python'] = $applications['py'] = 'python' $applications['java'] = $applications['jar'] = 'java' @@ -248,8 +244,6 @@ def set_applications(page=1) $applications['htm'] = $applications['html'] $applications['eps'] = $applications['ps'] - $runners['lua'] = "texlua" - end set_applications() diff --git a/Master/texmf-dist/scripts/context/stubs/mswin/metatex.exe b/Master/texmf-dist/scripts/context/stubs/mswin/metatex.exe deleted file mode 100755 index 2d45f27494d..00000000000 Binary files a/Master/texmf-dist/scripts/context/stubs/mswin/metatex.exe and /dev/null differ diff --git a/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.dll b/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.dll index 041e1a0e1d0..4116c5a24a6 100755 Binary files a/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.dll and b/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.dll differ diff --git a/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua b/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua index 2bdd1b8f020..cc5ebb478ac 100755 --- a/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua +++ b/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua @@ -8,7 +8,6 @@ if not modules then modules = { } end modules ['mtxrun'] = { license = "see context related readme files" } - -- one can make a stub: -- -- #!/bin/sh @@ -38,8 +37,6 @@ if not modules then modules = { } end modules ['mtxrun'] = { -- remember for subruns: _CTX_K_S_#{original}_ -- remember for subruns: TEXMFSTART.#{original} [tex.rb texmfstart.rb] -texlua = true - -- begin library merge @@ -54,8 +51,9 @@ if not modules then modules = { } end modules ['l-string'] = { license = "see context related readme files" } +local string = string local sub, gsub, find, match, gmatch, format, char, byte, rep, lower = string.sub, string.gsub, string.find, string.match, string.gmatch, string.format, string.char, string.byte, string.rep, string.lower -local lpegmatch = lpeg.match +local lpegmatch, S, C, Ct = lpeg.match, lpeg.S, lpeg.C, lpeg.Ct -- some functions may disappear as they are not used anywhere @@ -63,196 +61,68 @@ if not string.split then -- this will be overloaded by a faster lpeg variant - function string:split(pattern) - if #self > 0 then - local t = { } - for s in gmatch(self..pattern,"(.-)"..pattern) do - t[#t+1] = s + function string.split(str,pattern) + local t = { } + if #str > 0 then + local n = 1 + for s in gmatch(str..pattern,"(.-)"..pattern) do + t[n] = s + n = n + 1 end - return t - else - return { } end + return t end end -local chr_to_esc = { - ["%"] = "%%", - ["."] = "%.", - ["+"] = "%+", ["-"] = "%-", ["*"] = "%*", - ["^"] = "%^", ["$"] = "%$", - ["["] = "%[", ["]"] = "%]", - ["("] = "%(", [")"] = "%)", - ["{"] = "%{", ["}"] = "%}" -} - -string.chr_to_esc = chr_to_esc - -function string:esc() -- variant 2 - return (gsub(self,"(.)",chr_to_esc)) -end - -function string:unquote() - return (gsub(self,"^([\"\'])(.*)%1$","%2")) +function string.unquoted(str) + return (gsub(str,"^([\"\'])(.*)%1$","%2")) end ---~ function string:unquote() ---~ if find(self,"^[\'\"]") then ---~ return sub(self,2,-2) ---~ else ---~ return self ---~ end ---~ end -function string:quote() -- we could use format("%q") - return format("%q",self) +function string.quoted(str) + return format("%q",str) -- always " end -function string:count(pattern) -- variant 3 +function string.count(str,pattern) -- variant 3 local n = 0 - for _ in gmatch(self,pattern) do + for _ in gmatch(str,pattern) do -- not for utf n = n + 1 end return n end -function string:limit(n,sentinel) - if #self > n then - sentinel = sentinel or " ..." - return sub(self,1,(n-#sentinel)) .. sentinel - else - return self - end -end - ---~ function string:strip() -- the .- is quite efficient ---~ -- return match(self,"^%s*(.-)%s*$") or "" ---~ -- return match(self,'^%s*(.*%S)') or '' -- posted on lua list ---~ return find(s,'^%s*$') and '' or match(s,'^%s*(.*%S)') ---~ end - -do -- roberto's variant: - local space = lpeg.S(" \t\v\n") - local nospace = 1 - space - local stripper = space^0 * lpeg.C((space^0 * nospace^1)^0) - function string.strip(str) - return lpegmatch(stripper,str) or "" - end -end - -function string:is_empty() - return not find(self,"%S") -end - -function string:enhance(pattern,action) - local ok, n = true, 0 - while ok do - ok = false - self = gsub(self,pattern, function(...) - ok, n = true, n + 1 - return action(...) - end) - end - return self, n -end - -local chr_to_hex, hex_to_chr = { }, { } - -for i=0,255 do - local c, h = char(i), format("%02X",i) - chr_to_hex[c], hex_to_chr[h] = h, c -end - -function string:to_hex() - return (gsub(self or "","(.)",chr_to_hex)) -end - -function string:from_hex() - return (gsub(self or "","(..)",hex_to_chr)) -end - -if not string.characters then - - local function nextchar(str, index) - index = index + 1 - return (index <= #str) and index or nil, sub(str,index,index) - end - function string:characters() - return nextchar, self, 0 - end - local function nextbyte(str, index) - index = index + 1 - return (index <= #str) and index or nil, byte(sub(str,index,index)) - end - function string:bytes() - return nextbyte, self, 0 - end - -end - --- we can use format for this (neg n) - -function string:rpadd(n,chr) - local m = n-#self - if m > 0 then - return self .. rep(chr or " ",m) +function string.limit(str,n,sentinel) -- not utf proof + if #str > n then + sentinel = sentinel or "..." + return sub(str,1,(n-#sentinel)) .. sentinel else - return self - end -end - -function string:lpadd(n,chr) - local m = n-#self - if m > 0 then - return rep(chr or " ",m) .. self - else - return self + return str end end -string.padd = string.rpadd +local space = S(" \t\v\n") +local nospace = 1 - space +local stripper = space^0 * C((space^0 * nospace^1)^0) -- roberto's code -function is_number(str) -- tonumber - return find(str,"^[%-%+]?[%d]-%.?[%d+]$") == 1 +function string.strip(str) + return lpegmatch(stripper,str) or "" end ---~ print(is_number("1")) ---~ print(is_number("1.1")) ---~ print(is_number(".1")) ---~ print(is_number("-0.1")) ---~ print(is_number("+0.1")) ---~ print(is_number("-.1")) ---~ print(is_number("+.1")) - -function string:split_settings() -- no {} handling, see l-aux for lpeg variant - if find(self,"=") then - local t = { } - for k,v in gmatch(self,"(%a+)=([^%,]*)") do - t[k] = v - end - return t - else - return nil - end +function string.is_empty(str) + return not find(str,"%S") end local patterns_escapes = { - ["-"] = "%-", - ["."] = "%.", - ["+"] = "%+", - ["*"] = "%*", ["%"] = "%%", - ["("] = "%)", - [")"] = "%)", - ["["] = "%[", - ["]"] = "%]", + ["."] = "%.", + ["+"] = "%+", ["-"] = "%-", ["*"] = "%*", + ["["] = "%[", ["]"] = "%]", + ["("] = "%(", [")"] = "%)", + -- ["{"] = "%{", ["}"] = "%}" + -- ["^"] = "%^", ["$"] = "%$", } -function string:pattesc() - return (gsub(self,".",patterns_escapes)) -end - local simple_escapes = { ["-"] = "%-", ["."] = "%.", @@ -260,80 +130,30 @@ local simple_escapes = { ["*"] = ".*", } -function string:simpleesc() - return (gsub(self,".",simple_escapes)) -end - -function string:tohash() - local t = { } - for s in gmatch(self,"([^, ]+)") do -- lpeg - t[s] = true - end - return t -end - -local pattern = lpeg.Ct(lpeg.C(1)^0) - -function string:totable() - return lpegmatch(pattern,self) +function string.escapedpattern(str,simple) + return (gsub(str,".",simple and simple_escapes or patterns_escapes)) end ---~ local t = { ---~ "1234567123456712345671234567", ---~ "a\tb\tc", ---~ "aa\tbb\tcc", ---~ "aaa\tbbb\tccc", ---~ "aaaa\tbbbb\tcccc", ---~ "aaaaa\tbbbbb\tccccc", ---~ "aaaaaa\tbbbbbb\tcccccc", ---~ } ---~ for k,v do ---~ print(string.tabtospace(t[k])) ---~ end - -function string.tabtospace(str,tab) - -- we don't handle embedded newlines - while true do - local s = find(str,"\t") - if s then - if not tab then tab = 7 end -- only when found - local d = tab-(s-1) % tab - if d > 0 then - str = gsub(str,"\t",rep(" ",d),1) - else - str = gsub(str,"\t","",1) - end +function string.topattern(str,lowercase,strict) + if str == "" then + return ".*" + else + str = gsub(str,".",simple_escapes) + if lowercase then + str = lower(str) + end + if strict then + return "^" .. str .. "$" else - break + return str end end - return str end -function string:compactlong() -- strips newlines and leading spaces - self = gsub(self,"[\n\r]+ *","") - self = gsub(self,"^ *","") - return self -end - -function string:striplong() -- strips newlines and leading spaces - self = gsub(self,"^%s*","") - self = gsub(self,"[\n\r]+ *","\n") - return self -end +-- obsolete names: -function string:topattern(lowercase,strict) - if lowercase then - self = lower(self) - end - self = gsub(self,".",simple_escapes) - if self == "" then - self = ".*" - elseif strict then - self = "^" .. self .. "$" - end - return self -end +string.quote = string.quoted +string.unquote = string.unquoted end -- of closure @@ -350,28 +170,75 @@ if not modules then modules = { } end modules ['l-lpeg'] = { local lpeg = require("lpeg") +local type = type + +-- Beware, we predefine a bunch of patterns here and one reason for doing so +-- is that we get consistent behaviour in some of the visualizers. + lpeg.patterns = lpeg.patterns or { } -- so that we can share local patterns = lpeg.patterns -local P, R, S, Ct, C, Cs, Cc, V = lpeg.P, lpeg.R, lpeg.S, lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.V -local match = lpeg.match +local P, R, S, V, match = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.match +local Ct, C, Cs, Cc = lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc +local lpegtype = lpeg.type + +local utfcharacters = string.utfcharacters +local utfgmatch = unicode and unicode.utf8.gmatch + +local anything = P(1) +local endofstring = P(-1) +local alwaysmatched = P(true) + +patterns.anything = anything +patterns.endofstring = endofstring +patterns.beginofstring = alwaysmatched +patterns.alwaysmatched = alwaysmatched local digit, sign = R('09'), S('+-') local cr, lf, crlf = P("\r"), P("\n"), P("\r\n") -local utf8byte = R("\128\191") +local newline = crlf + cr + lf +local escaped = P("\\") * anything +local squote = P("'") +local dquote = P('"') +local space = P(" ") + +local utfbom_32_be = P('\000\000\254\255') +local utfbom_32_le = P('\255\254\000\000') +local utfbom_16_be = P('\255\254') +local utfbom_16_le = P('\254\255') +local utfbom_8 = P('\239\187\191') +local utfbom = utfbom_32_be + utfbom_32_le + + utfbom_16_be + utfbom_16_le + + utfbom_8 +local utftype = utfbom_32_be / "utf-32-be" + utfbom_32_le / "utf-32-le" + + utfbom_16_be / "utf-16-be" + utfbom_16_le / "utf-16-le" + + utfbom_8 / "utf-8" + alwaysmatched / "unknown" + +local utf8next = R("\128\191") -patterns.utf8byte = utf8byte patterns.utf8one = R("\000\127") -patterns.utf8two = R("\194\223") * utf8byte -patterns.utf8three = R("\224\239") * utf8byte * utf8byte -patterns.utf8four = R("\240\244") * utf8byte * utf8byte * utf8byte +patterns.utf8two = R("\194\223") * utf8next +patterns.utf8three = R("\224\239") * utf8next * utf8next +patterns.utf8four = R("\240\244") * utf8next * utf8next * utf8next +patterns.utfbom = utfbom +patterns.utftype = utftype + +local utf8char = patterns.utf8one + patterns.utf8two + patterns.utf8three + patterns.utf8four +local validutf8char = utf8char^0 * endofstring * Cc(true) + Cc(false) + +patterns.utf8 = utf8char +patterns.utf8char = utf8char +patterns.validutf8 = validutf8char +patterns.validutf8char = validutf8char patterns.digit = digit patterns.sign = sign patterns.cardinal = sign^0 * digit^1 patterns.integer = sign^0 * digit^1 patterns.float = sign^0 * digit^0 * P('.') * digit^1 +patterns.cfloat = sign^0 * digit^0 * P(',') * digit^1 patterns.number = patterns.float + patterns.integer +patterns.cnumber = patterns.cfloat + patterns.integer patterns.oct = P("0") * R("07")^1 patterns.octal = patterns.oct patterns.HEX = P("0x") * R("09","AF")^1 @@ -380,16 +247,42 @@ patterns.hexadecimal = P("0x") * R("09","AF","af")^1 patterns.lowercase = R("az") patterns.uppercase = R("AZ") patterns.letter = patterns.lowercase + patterns.uppercase -patterns.space = S(" ") +patterns.space = space +patterns.tab = P("\t") +patterns.spaceortab = patterns.space + patterns.tab patterns.eol = S("\n\r") patterns.spacer = S(" \t\f\v") -- + string.char(0xc2, 0xa0) if we want utf (cf mail roberto) -patterns.newline = crlf + cr + lf -patterns.nonspace = 1 - patterns.space +patterns.newline = newline +patterns.emptyline = newline^1 patterns.nonspacer = 1 - patterns.spacer patterns.whitespace = patterns.eol + patterns.spacer patterns.nonwhitespace = 1 - patterns.whitespace -patterns.utf8 = patterns.utf8one + patterns.utf8two + patterns.utf8three + patterns.utf8four -patterns.utfbom = P('\000\000\254\255') + P('\255\254\000\000') + P('\255\254') + P('\254\255') + P('\239\187\191') +patterns.equal = P("=") +patterns.comma = P(",") +patterns.commaspacer = P(",") * patterns.spacer^0 +patterns.period = P(".") +patterns.colon = P(":") +patterns.semicolon = P(";") +patterns.underscore = P("_") +patterns.escaped = escaped +patterns.squote = squote +patterns.dquote = dquote +patterns.nosquote = (escaped + (1-squote))^0 +patterns.nodquote = (escaped + (1-dquote))^0 +patterns.unsingle = (squote/"") * patterns.nosquote * (squote/"") +patterns.undouble = (dquote/"") * patterns.nodquote * (dquote/"") +patterns.unquoted = patterns.undouble + patterns.unsingle -- more often undouble +patterns.unspacer = ((patterns.spacer^1)/"")^0 + +patterns.somecontent = (anything - newline - space)^1 -- (utf8char - newline - space)^1 +patterns.beginline = #(1-newline) + +local unquoted = Cs(patterns.unquoted * endofstring) -- not C + +function string.unquoted(str) + return match(unquoted,str) or str +end + function lpeg.anywhere(pattern) --slightly adapted from website return P { P(pattern) + 1 * V(1) } -- why so complex? @@ -399,36 +292,18 @@ function lpeg.splitter(pattern, action) return (((1-P(pattern))^1)/action+1)^0 end -local spacing = patterns.spacer^0 * patterns.newline -- sort of strip -local empty = spacing * Cc("") -local nonempty = Cs((1-spacing)^1) * spacing^-1 -local content = (empty + nonempty)^1 - -local capture = Ct(content^0) - -function string:splitlines() - return match(capture,self) -end - -patterns.textline = content - ---~ local p = lpeg.splitat("->",false) print(match(p,"oeps->what->more")) -- oeps what more ---~ local p = lpeg.splitat("->",true) print(match(p,"oeps->what->more")) -- oeps what->more ---~ local p = lpeg.splitat("->",false) print(match(p,"oeps")) -- oeps ---~ local p = lpeg.splitat("->",true) print(match(p,"oeps")) -- oeps - local splitters_s, splitters_m = { }, { } local function splitat(separator,single) local splitter = (single and splitters_s[separator]) or splitters_m[separator] if not splitter then separator = P(separator) + local other = C((1 - separator)^0) if single then - local other, any = C((1 - separator)^0), P(1) + local any = anything splitter = other * (separator * C(any^0) + "") -- ? splitters_s[separator] = splitter else - local other = C((1 - separator)^0) splitter = other * (separator * other)^0 splitters_m[separator] = splitter end @@ -438,6 +313,7 @@ end lpeg.splitat = splitat + local cache = { } function lpeg.split(separator,str) @@ -449,16 +325,39 @@ function lpeg.split(separator,str) return match(c,str) end -function string:split(separator) +function string.split(str,separator) local c = cache[separator] if not c then c = Ct(splitat(separator)) cache[separator] = c end - return match(c,self) + return match(c,str) +end + +local spacing = patterns.spacer^0 * newline -- sort of strip +local empty = spacing * Cc("") +local nonempty = Cs((1-spacing)^1) * spacing^-1 +local content = (empty + nonempty)^1 + +patterns.textline = content + + +local linesplitter = Ct(splitat(newline)) + +patterns.linesplitter = linesplitter + +function string.splitlines(str) + return match(linesplitter,str) +end + +local utflinesplitter = utfbom^-1 * Ct(splitat(newline)) + +patterns.utflinesplitter = utflinesplitter + +function string.utfsplitlines(str) + return match(utflinesplitter,str) end -lpeg.splitters = cache local cache = { } @@ -466,37 +365,24 @@ function lpeg.checkedsplit(separator,str) local c = cache[separator] if not c then separator = P(separator) - local other = C((1 - separator)^0) + local other = C((1 - separator)^1) c = Ct(separator^0 * other * (separator^1 * other)^0) cache[separator] = c end return match(c,str) end -function string:checkedsplit(separator) +function string.checkedsplit(str,separator) local c = cache[separator] if not c then separator = P(separator) - local other = C((1 - separator)^0) + local other = C((1 - separator)^1) c = Ct(separator^0 * other * (separator^1 * other)^0) cache[separator] = c end - return match(c,self) + return match(c,str) end ---~ function lpeg.append(list,pp) ---~ local p = pp ---~ for l=1,#list do ---~ if p then ---~ p = p + P(list[l]) ---~ else ---~ p = P(list[l]) ---~ end ---~ end ---~ return p ---~ end - ---~ from roberto's site: local f1 = string.byte @@ -504,170 +390,459 @@ local function f2(s) local c1, c2 = f1(s,1,2) return c1 * 64 + c2 local function f3(s) local c1, c2, c3 = f1(s,1,3) return (c1 * 64 + c2) * 64 + c3 - 925824 end local function f4(s) local c1, c2, c3, c4 = f1(s,1,4) return ((c1 * 64 + c2) * 64 + c3) * 64 + c4 - 63447168 end -patterns.utf8byte = patterns.utf8one/f1 + patterns.utf8two/f2 + patterns.utf8three/f3 + patterns.utf8four/f4 - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-table'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -table.join = table.concat +local utf8byte = patterns.utf8one/f1 + patterns.utf8two/f2 + patterns.utf8three/f3 + patterns.utf8four/f4 -local concat, sort, insert, remove = table.concat, table.sort, table.insert, table.remove -local format, find, gsub, lower, dump, match = string.format, string.find, string.gsub, string.lower, string.dump, string.match -local getmetatable, setmetatable = getmetatable, setmetatable -local type, next, tostring, tonumber, ipairs = type, next, tostring, tonumber, ipairs +patterns.utf8byte = utf8byte --- Starting with version 5.2 Lua no longer provide ipairs, which makes --- sense. As we already used the for loop and # in most places the --- impact on ConTeXt was not that large; the remaining ipairs already --- have been replaced. In a similar fashio we also hardly used pairs. --- --- Just in case, we provide the fallbacks as discussed in Programming --- in Lua (http://www.lua.org/pil/7.3.html): -if not ipairs then - -- for k, v in ipairs(t) do ... end - -- for k=1,#t do local v = t[k] ... end +local cache = { } - local function iterate(a,i) - i = i + 1 - local v = a[i] - if v ~= nil then - return i, v --, nil +function lpeg.stripper(str) + if type(str) == "string" then + local s = cache[str] + if not s then + s = Cs(((S(str)^1)/"" + 1)^0) + cache[str] = s end + return s + else + return Cs(((str^1)/"" + 1)^0) end - - function ipairs(a) - return iterate, a, 0 - end - end -if not pairs then - - -- for k, v in pairs(t) do ... end - -- for k, v in next, t do ... end +local cache = { } - function pairs(t) - return next, t -- , nil +function lpeg.keeper(str) + if type(str) == "string" then + local s = cache[str] + if not s then + s = Cs((((1-S(str))^1)/"" + 1)^0) + cache[str] = s + end + return s + else + return Cs((((1-str)^1)/"" + 1)^0) end - end --- Also, unpack has been moved to the table table, and for compatiility --- reasons we provide both now. +function lpeg.frontstripper(str) -- or pattern (yet undocumented) + return (P(str) + P(true)) * Cs(P(1)^0) +end -if not table.unpack then - table.unpack = _G.unpack -elseif not unpack then - _G.unpack = table.unpack +function lpeg.endstripper(str) -- or pattern (yet undocumented) + return Cs((1 - P(str) * P(-1))^0) end --- extra functions, some might go (when not used) +-- Just for fun I looked at the used bytecode and +-- p = (p and p + pp) or pp gets one more (testset). -function table.strip(tab) - local lst = { } - for i=1,#tab do - local s = gsub(tab[i],"^%s*(.-)%s*$","%1") - if s == "" then - -- skip this one - else - lst[#lst+1] = s +function lpeg.replacer(one,two) + if type(one) == "table" then + local no = #one + if no > 0 then + local p + for i=1,no do + local o = one[i] + local pp = P(o[1]) / o[2] + if p then + p = p + pp + else + p = pp + end + end + return Cs((p + 1)^0) end + else + two = two or "" + return Cs((P(one)/two + 1)^0) end - return lst end -function table.keys(t) - local k = { } - for key, _ in next, t do - k[#k+1] = key - end - return k -end +local splitters_f, splitters_s = { }, { } -local function compare(a,b) - return (tostring(a) < tostring(b)) +function lpeg.firstofsplit(separator) -- always return value + local splitter = splitters_f[separator] + if not splitter then + separator = P(separator) + splitter = C((1 - separator)^0) + splitters_f[separator] = splitter + end + return splitter end -local function sortedkeys(tab) - local srt, kind = { }, 0 -- 0=unknown 1=string, 2=number 3=mixed - for key,_ in next, tab do - srt[#srt+1] = key - if kind == 3 then - -- no further check - else - local tkey = type(key) - if tkey == "string" then - -- if kind == 2 then kind = 3 else kind = 1 end - kind = (kind == 2 and 3) or 1 - elseif tkey == "number" then - -- if kind == 1 then kind = 3 else kind = 2 end - kind = (kind == 1 and 3) or 2 - else - kind = 3 - end - end - end - if kind == 0 or kind == 3 then - sort(srt,compare) - else - sort(srt) +function lpeg.secondofsplit(separator) -- nil if not split + local splitter = splitters_s[separator] + if not splitter then + separator = P(separator) + splitter = (1 - separator)^0 * separator * C(anything^0) + splitters_s[separator] = splitter end - return srt + return splitter end -local function sortedhashkeys(tab) -- fast one - local srt = { } - for key,_ in next, tab do - srt[#srt+1] = key - end - sort(srt) - return srt +function lpeg.balancer(left,right) + left, right = P(left), P(right) + return P { left * ((1 - left - right) + V(1))^0 * right } end -table.sortedkeys = sortedkeys -table.sortedhashkeys = sortedhashkeys -function table.sortedhash(t) - local s = sortedhashkeys(t) -- maybe just sortedkeys - local n = 0 - local function kv(s) - n = n + 1 - local k = s[n] - return k, t[k] - end - return kv, s -end -table.sortedpairs = table.sortedhash +local nany = utf8char/"" -function table.append(t, list) - for _,v in next, list do - insert(t,v) +function lpeg.counter(pattern) + pattern = Cs((P(pattern)/" " + nany)^0) + return function(str) + return #match(pattern,str) end end -function table.prepend(t, list) - for k,v in next, list do - insert(t,k,v) - end -end +if utfgmatch then -function table.merge(t, ...) -- first one is target - t = t or {} - local lst = {...} - for i=1,#lst do + function lpeg.count(str,what) -- replaces string.count + if type(what) == "string" then + local n = 0 + for _ in utfgmatch(str,what) do + n = n + 1 + end + return n + else -- 4 times slower but still faster than / function + return #match(Cs((P(what)/" " + nany)^0),str) + end + end + +else + + local cache = { } + + function lpeg.count(str,what) -- replaces string.count + if type(what) == "string" then + local p = cache[what] + if not p then + p = Cs((P(what)/" " + nany)^0) + cache[p] = p + end + return #match(p,str) + else -- 4 times slower but still faster than / function + return #match(Cs((P(what)/" " + nany)^0),str) + end + end + +end + +local patterns_escapes = { -- also defines in l-string + ["%"] = "%%", + ["."] = "%.", + ["+"] = "%+", ["-"] = "%-", ["*"] = "%*", + ["["] = "%[", ["]"] = "%]", + ["("] = "%)", [")"] = "%)", + -- ["{"] = "%{", ["}"] = "%}" + -- ["^"] = "%^", ["$"] = "%$", +} + +local simple_escapes = { -- also defines in l-string + ["-"] = "%-", + ["."] = "%.", + ["?"] = ".", + ["*"] = ".*", +} + +local p = Cs((S("-.+*%()[]") / patterns_escapes + anything)^0) +local s = Cs((S("-.+*%()[]") / simple_escapes + anything)^0) + +function string.escapedpattern(str,simple) + return match(simple and s or p,str) +end + +-- utf extensies + +lpeg.UP = lpeg.P + +if utfcharacters then + + function lpeg.US(str) + local p + for uc in utfcharacters(str) do + if p then + p = p + P(uc) + else + p = P(uc) + end + end + return p + end + + +elseif utfgmatch then + + function lpeg.US(str) + local p + for uc in utfgmatch(str,".") do + if p then + p = p + P(uc) + else + p = P(uc) + end + end + return p + end + +else + + function lpeg.US(str) + local p + local f = function(uc) + if p then + p = p + P(uc) + else + p = P(uc) + end + end + match((utf8char/f)^0,str) + return p + end + +end + +local range = Cs(utf8byte) * (Cs(utf8byte) + Cc(false)) + +local utfchar = unicode and unicode.utf8 and unicode.utf8.char + +function lpeg.UR(str,more) + local first, last + if type(str) == "number" then + first = str + last = more or first + else + first, last = match(range,str) + if not last then + return P(str) + end + end + if first == last then + return P(str) + elseif utfchar and last - first < 8 then -- a somewhat arbitrary criterium + local p + for i=first,last do + if p then + p = p + P(utfchar(i)) + else + p = P(utfchar(i)) + end + end + return p -- nil when invalid range + else + local f = function(b) + return b >= first and b <= last + end + return utf8byte / f -- nil when invalid range + end +end + + + +function lpeg.oneof(list,...) -- lpeg.oneof("elseif","else","if","then") + if type(list) ~= "table" then + list = { list, ... } + end + -- sort(list) -- longest match first + local p = P(list[1]) + for l=2,#list do + p = p + P(list[l]) + end + return p +end + +function lpeg.is_lpeg(p) + return p and lpegtype(p) == "pattern" +end + + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['l-table'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local type, next, tostring, tonumber, ipairs, table, string = type, next, tostring, tonumber, ipairs, table, string +local concat, sort, insert, remove = table.concat, table.sort, table.insert, table.remove +local format, find, gsub, lower, dump, match = string.format, string.find, string.gsub, string.lower, string.dump, string.match +local getmetatable, setmetatable = getmetatable, setmetatable + +-- Starting with version 5.2 Lua no longer provide ipairs, which makes +-- sense. As we already used the for loop and # in most places the +-- impact on ConTeXt was not that large; the remaining ipairs already +-- have been replaced. In a similar fashio we also hardly used pairs. +-- +-- Just in case, we provide the fallbacks as discussed in Programming +-- in Lua (http://www.lua.org/pil/7.3.html): + +if not ipairs then + + -- for k, v in ipairs(t) do ... end + -- for k=1,#t do local v = t[k] ... end + + local function iterate(a,i) + i = i + 1 + local v = a[i] + if v ~= nil then + return i, v --, nil + end + end + + function ipairs(a) + return iterate, a, 0 + end + +end + +if not pairs then + + -- for k, v in pairs(t) do ... end + -- for k, v in next, t do ... end + + function pairs(t) + return next, t -- , nil + end + +end + +-- Also, unpack has been moved to the table table, and for compatiility +-- reasons we provide both now. + +if not table.unpack then + table.unpack = _G.unpack +elseif not unpack then + _G.unpack = table.unpack +end + +-- extra functions, some might go (when not used) + +function table.strip(tab) + local lst, l = { }, 0 + for i=1,#tab do + local s = gsub(tab[i],"^%s*(.-)%s*$","%1") + if s == "" then + -- skip this one + else + l = l + 1 + lst[l] = s + end + end + return lst +end + +function table.keys(t) + local keys, k = { }, 0 + for key, _ in next, t do + k = k + 1 + keys[k] = key + end + return keys +end + +local function compare(a,b) + local ta, tb = type(a), type(b) -- needed, else 11 < 2 + if ta == tb then + return a < b + else + return tostring(a) < tostring(b) + end +end + +local function sortedkeys(tab) + local srt, category, s = { }, 0, 0 -- 0=unknown 1=string, 2=number 3=mixed + for key,_ in next, tab do + s = s + 1 + srt[s] = key + if category == 3 then + -- no further check + else + local tkey = type(key) + if tkey == "string" then + category = (category == 2 and 3) or 1 + elseif tkey == "number" then + category = (category == 1 and 3) or 2 + else + category = 3 + end + end + end + if category == 0 or category == 3 then + sort(srt,compare) + else + sort(srt) + end + return srt +end + +local function sortedhashkeys(tab) -- fast one + local srt, s = { }, 0 + for key,_ in next, tab do + if key then + s= s + 1 + srt[s] = key + end + end + sort(srt) + return srt +end + +table.sortedkeys = sortedkeys +table.sortedhashkeys = sortedhashkeys + +local function nothing() end + +local function sortedhash(t) + if t then + local n, s = 0, sortedkeys(t) -- the robust one + local function kv(s) + n = n + 1 + local k = s[n] + return k, t[k] + end + return kv, s + else + return nothing + end +end + +table.sortedhash = sortedhash +table.sortedpairs = sortedhash + +function table.append(t, list) + local n = #t + for i=1,#list do + n = n + 1 + t[n] = list[i] + end + return t +end + +function table.prepend(t, list) + local nl = #list + local nt = nl + #t + for i=#t,1,-1 do + t[nt] = t[i] + nt = nt - 1 + end + for i=1,#list do + t[i] = list[i] + end + return t +end + +function table.merge(t, ...) -- first one is target + t = t or { } + local lst = { ... } + for i=1,#lst do for k, v in next, lst[i] do t[k] = v end @@ -676,7 +851,7 @@ function table.merge(t, ...) -- first one is target end function table.merged(...) - local tmp, lst = { }, {...} + local tmp, lst = { }, { ... } for i=1,#lst do for k, v in next, lst[i] do tmp[k] = v @@ -686,41 +861,45 @@ function table.merged(...) end function table.imerge(t, ...) - local lst = {...} + local lst, nt = { ... }, #t for i=1,#lst do local nst = lst[i] for j=1,#nst do - t[#t+1] = nst[j] + nt = nt + 1 + t[nt] = nst[j] end end return t end function table.imerged(...) - local tmp, lst = { }, {...} + local tmp, ntmp, lst = { }, 0, {...} for i=1,#lst do local nst = lst[i] for j=1,#nst do - tmp[#tmp+1] = nst[j] + ntmp = ntmp + 1 + tmp[ntmp] = nst[j] end end return tmp end -local function fastcopy(old) -- fast one +local function fastcopy(old,metatabletoo) -- fast one if old then local new = { } for k,v in next, old do if type(v) == "table" then - new[k] = fastcopy(v) -- was just table.copy + new[k] = fastcopy(v,metatabletoo) -- was just table.copy else new[k] = v end end - -- optional second arg - local mt = getmetatable(old) - if mt then - setmetatable(new,mt) + if metatabletoo then + -- optional second arg + local mt = getmetatable(old) + if mt then + setmetatable(new,mt) + end end return new else @@ -728,6 +907,8 @@ local function fastcopy(old) -- fast one end end +-- todo : copy without metatable + local function copy(t, tables) -- taken from lua wiki, slightly adapted tables = tables or { } local tcopy = {} @@ -760,33 +941,14 @@ end table.fastcopy = fastcopy table.copy = copy --- roughly: copy-loop : unpack : sub == 0.9 : 0.4 : 0.45 (so in critical apps, use unpack) - -function table.sub(t,i,j) - return { unpack(t,i,j) } -end - -function table.replace(a,b) - for k,v in next, b do - a[k] = v +function table.derive(parent) + local child = { } + if parent then + setmetatable(child,{ __index = parent }) end + return child end --- slower than #t on indexed tables (#t only returns the size of the numerically indexed slice) - -function table.is_empty(t) -- obolete, use inline code instead - return not t or not next(t) -end - -function table.one_entry(t) -- obolete, use inline code instead - local n = next(t) - return n and not next(t,n) -end - ---~ function table.starts_at(t) -- obsolete, not nice anyway ---~ return ipairs(t,1)(t,0) ---~ end - function table.tohash(t,value) local h = { } if t then @@ -799,27 +961,19 @@ function table.tohash(t,value) end function table.fromhash(t) - local h = { } + local hsh, h = { }, 0 for k, v in next, t do -- no ipairs here - if v then h[#h+1] = k end + if v then + h = h + 1 + hsh[h] = k + end end - return h + return hsh end ---~ print(table.serialize(t), "\n") ---~ print(table.serialize(t,"name"), "\n") ---~ print(table.serialize(t,false), "\n") ---~ print(table.serialize(t,true), "\n") ---~ print(table.serialize(t,"name",true), "\n") ---~ print(table.serialize(t,"name",true,true), "\n") - -table.serialize_functions = true -table.serialize_compact = true -table.serialize_inline = true - local noquotes, hexify, handle, reduce, compact, inline, functions -local reserved = table.tohash { -- intercept a language flaw, no reserved words as key +local reserved = table.tohash { -- intercept a language inconvenience: no reserved words as key 'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat', 'return', 'then', 'true', 'until', 'while', } @@ -831,20 +985,23 @@ local function simple_table(t) n = n + 1 end if n == #t then - local tt = { } + local tt, nt = { }, 0 for i=1,#t do local v = t[i] local tv = type(v) if tv == "number" then + nt = nt + 1 if hexify then - tt[#tt+1] = format("0x%04X",v) + tt[nt] = format("0x%04X",v) else - tt[#tt+1] = tostring(v) -- tostring not needed + tt[nt] = tostring(v) -- tostring not needed end elseif tv == "boolean" then - tt[#tt+1] = tostring(v) + nt = nt + 1 + tt[nt] = tostring(v) elseif tv == "string" then - tt[#tt+1] = format("%q",v) + nt = nt + 1 + tt[nt] = format("%q",v) else tt = nil break @@ -870,21 +1027,25 @@ local function do_serialize(root,name,depth,level,indexed) depth = depth .. " " if indexed then handle(format("%s{",depth)) - elseif name then - --~ handle(format("%s%s={",depth,key(name))) - if type(name) == "number" then -- or find(k,"^%d+$") then + else + local tn = type(name) + if tn == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s[0x%04X]={",depth,name)) else handle(format("%s[%s]={",depth,name)) end - elseif noquotes and not reserved[name] and find(name,"^%a[%w%_]*$") then - handle(format("%s%s={",depth,name)) + elseif tn == "string" then + if noquotes and not reserved[name] and find(name,"^%a[%w%_]*$") then + handle(format("%s%s={",depth,name)) + else + handle(format("%s[%q]={",depth,name)) + end + elseif tn == "boolean" then + handle(format("%s[%s]={",depth,tostring(name))) else - handle(format("%s[%q]={",depth,name)) + handle(format("%s{",depth)) end - else - handle(format("%s{",depth)) end end -- we could check for k (index) being number (cardinal) @@ -901,11 +1062,9 @@ local function do_serialize(root,name,depth,level,indexed) for i=1,#sk do local k = sk[i] local v = root[k] - --~ if v == root then - -- circular - --~ else - local t = type(v) - if compact and first and type(k) == "number" and k >= first and k <= last then + -- circular + local t, tk = type(v), type(k) + if compact and first and tk == "number" and k >= first and k <= last then if t == "number" then if hexify then handle(format("%s 0x%04X,",depth,v)) @@ -947,17 +1106,18 @@ local function do_serialize(root,name,depth,level,indexed) handle(format("%s __p__=nil,",depth)) end elseif t == "number" then - --~ if hexify then - --~ handle(format("%s %s=0x%04X,",depth,key(k),v)) - --~ else - --~ handle(format("%s %s=%s,",depth,key(k),v)) -- %.99g - --~ end - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=0x%04X,",depth,k,v)) else handle(format("%s [%s]=%s,",depth,k,v)) -- %.99g end + elseif tk == "boolean" then + if hexify then + handle(format("%s [%s]=0x%04X,",depth,tostring(k),v)) + else + handle(format("%s [%s]=%s,",depth,tostring(k),v)) -- %.99g + end elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then if hexify then handle(format("%s %s=0x%04X,",depth,k,v)) @@ -973,26 +1133,28 @@ local function do_serialize(root,name,depth,level,indexed) end elseif t == "string" then if reduce and tonumber(v) then - --~ handle(format("%s %s=%s,",depth,key(k),v)) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%s,",depth,k,v)) else handle(format("%s [%s]=%s,",depth,k,v)) end + elseif tk == "boolean" then + handle(format("%s [%s]=%s,",depth,tostring(k),v)) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%s,",depth,k,v)) else handle(format("%s [%q]=%s,",depth,k,v)) end else - --~ handle(format("%s %s=%q,",depth,key(k),v)) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%q,",depth,k,v)) else handle(format("%s [%s]=%q,",depth,k,v)) end + elseif tk == "boolean" then + handle(format("%s [%s]=%q,",depth,tostring(k),v)) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%q,",depth,k,v)) else @@ -1001,13 +1163,14 @@ local function do_serialize(root,name,depth,level,indexed) end elseif t == "table" then if not next(v) then - --~ handle(format("%s %s={},",depth,key(k))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]={},",depth,k)) else handle(format("%s [%s]={},",depth,k)) end + elseif tk == "boolean" then + handle(format("%s [%s]={},",depth,tostring(k))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s={},",depth,k)) else @@ -1016,13 +1179,14 @@ local function do_serialize(root,name,depth,level,indexed) elseif inline then local st = simple_table(v) if st then - --~ handle(format("%s %s={ %s },",depth,key(k),concat(st,", "))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]={ %s },",depth,k,concat(st,", "))) else handle(format("%s [%s]={ %s },",depth,k,concat(st,", "))) end + elseif tk == "boolean" then -- or find(k,"^%d+$") then + handle(format("%s [%s]={ %s },",depth,tostring(k),concat(st,", "))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s={ %s },",depth,k,concat(st,", "))) else @@ -1035,13 +1199,14 @@ local function do_serialize(root,name,depth,level,indexed) do_serialize(v,k,depth,level+1) end elseif t == "boolean" then - --~ handle(format("%s %s=%s,",depth,key(k),tostring(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%s,",depth,k,tostring(v))) else handle(format("%s [%s]=%s,",depth,k,tostring(v))) end + elseif tk == "boolean" then -- or find(k,"^%d+$") then + handle(format("%s [%s]=%s,",depth,tostring(k),tostring(v))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%s,",depth,k,tostring(v))) else @@ -1049,35 +1214,37 @@ local function do_serialize(root,name,depth,level,indexed) end elseif t == "function" then if functions then - --~ handle(format('%s %s=loadstring(%q),',depth,key(k),dump(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=loadstring(%q),",depth,k,dump(v))) else handle(format("%s [%s]=loadstring(%q),",depth,k,dump(v))) end + elseif tk == "boolean" then + handle(format("%s [%s]=loadstring(%q),",depth,tostring(k),dump(v))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=loadstring(%q),",depth,k,dump(v))) else - handle(format("%s [%q]=loadstring(%q),",depth,k,dump(v))) + -- handle(format("%s [%q]=loadstring(%q),",depth,k,dump(v))) + handle(format("%s [%q]=loadstring(%q),",depth,k,debug.getinfo(v).what == "C" and "C code" or dump(v))) end end else - --~ handle(format("%s %s=%q,",depth,key(k),tostring(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%q,",depth,k,tostring(v))) else handle(format("%s [%s]=%q,",depth,k,tostring(v))) end + elseif tk == "boolean" then -- or find(k,"^%d+$") then + handle(format("%s [%s]=%q,",depth,tostring(k),tostring(v))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%q,",depth,k,tostring(v))) else handle(format("%s [%q]=%q,",depth,k,tostring(v))) end end - --~ end - end + end end if level > 0 then handle(format("%s},",depth)) @@ -1087,15 +1254,34 @@ end -- replacing handle by a direct t[#t+1] = ... (plus test) is not much -- faster (0.03 on 1.00 for zapfino.tma) -local function serialize(root,name,_handle,_reduce,_noquotes,_hexify) - noquotes = _noquotes - hexify = _hexify - handle = _handle or print - reduce = _reduce or false - compact = table.serialize_compact - inline = compact and table.serialize_inline - functions = table.serialize_functions +local function serialize(_handle,root,name,specification) -- handle wins local tname = type(name) + if type(specification) == "table" then + noquotes = specification.noquotes + hexify = specification.hexify + handle = _handle or specification.handle or print + reduce = specification.reduce or false + functions = specification.functions + compact = specification.compact + inline = specification.inline and compact + if functions == nil then + functions = true + end + if compact == nil then + compact = true + end + if inline == nil then + inline = compact + end + else + noquotes = false + hexify = false + handle = _handle or print + reduce = false + compact = true + inline = true + functions = true + end if tname == "string" then if name == "return" then handle("return {") @@ -1117,33 +1303,33 @@ local function serialize(root,name,_handle,_reduce,_noquotes,_hexify) else handle("t={") end - if root and next(root) then - do_serialize(root,name,"",0,indexed) + if root then + -- The dummy access will initialize a table that has a delayed initialization + -- using a metatable. (maybe explicitly test for metatable) + if getmetatable(root) then -- todo: make this an option, maybe even per subtable + local dummy = root._w_h_a_t_e_v_e_r_ + root._w_h_a_t_e_v_e_r_ = nil + end + -- Let's forget about empty tables. + if next(root) then + do_serialize(root,name,"",0) + end end handle("}") end ---~ name: ---~ ---~ true : return { } ---~ false : { } ---~ nil : t = { } ---~ string : string = { } ---~ 'return' : return { } ---~ number : [number] = { } -function table.serialize(root,name,reduce,noquotes,hexify) - local t = { } +function table.serialize(root,name,specification) + local t, n = { }, 0 local function flush(s) - t[#t+1] = s + n = n + 1 + t[n] = s end - serialize(root,name,flush,reduce,noquotes,hexify) + serialize(flush,root,name,specification) return concat(t,"\n") end -function table.tohandle(handle,root,name,reduce,noquotes,hexify) - serialize(root,name,handle,reduce,noquotes,hexify) -end +table.tohandle = serialize -- sometimes tables are real use (zapfino extra pro is some 85M) in which -- case a stepwise serialization is nice; actually, we could consider: @@ -1154,73 +1340,63 @@ end -- -- so this is on the todo list -table.tofile_maxtab = 2*1024 +local maxtab = 2*1024 -function table.tofile(filename,root,name,reduce,noquotes,hexify) +function table.tofile(filename,root,name,specification) local f = io.open(filename,'w') if f then - local maxtab = table.tofile_maxtab if maxtab > 1 then - local t = { } + local t, n = { }, 0 local function flush(s) - t[#t+1] = s - if #t > maxtab then + n = n + 1 + t[n] = s + if n > maxtab then f:write(concat(t,"\n"),"\n") -- hm, write(sometable) should be nice - t = { } + t, n = { }, 0 -- we could recycle t if needed end end - serialize(root,name,flush,reduce,noquotes,hexify) + serialize(flush,root,name,specification) f:write(concat(t,"\n"),"\n") else local function flush(s) f:write(s,"\n") end - serialize(root,name,flush,reduce,noquotes,hexify) + serialize(flush,root,name,specification) end f:close() + io.flush() end end -local function flatten(t,f,complete) -- is this used? meybe a variant with next, ... - for i=1,#t do - local v = t[i] - if type(v) == "table" then - if complete or type(v[1]) == "table" then - flatten(v,f,complete) +local function flattened(t,f,depth) + if f == nil then + f = { } + depth = 0xFFFF + elseif tonumber(f) then + -- assume then only two arguments are given + depth = f + f = { } + elseif not depth then + depth = 0xFFFF + end + for k, v in next, t do + if type(k) ~= "number" then + if depth > 0 and type(v) == "table" then + flattened(v,f,depth-1) else - f[#f+1] = v + f[k] = v end - else - f[#f+1] = v end end -end - -function table.flatten(t) - local f = { } - flatten(t,f,true) - return f -end - -function table.unnest(t) -- bad name - local f = { } - flatten(t,f,false) - return f -end - -table.flatten_one_level = table.unnest - --- a better one: - -local function flattened(t,f) - if not f then - f = { } - end - for k, v in next, t do - if type(v) == "table" then - flattened(v,f) + local n = #f + for k=1,#t do + local v = t[k] + if depth > 0 and type(v) == "table" then + flattened(v,f,depth-1) + n = #f else - f[k] = v + n = n + 1 + f[n] = v end end return f @@ -1228,49 +1404,27 @@ end table.flattened = flattened --- the next three may disappear - -function table.remove_value(t,value) -- todo: n - if value then - for i=1,#t do - if t[i] == value then - remove(t,i) - -- remove all, so no: return - end - end +local function unnest(t,f) -- only used in mk, for old times sake + if not f then -- and only relevant for token lists + f = { } end -end - -function table.insert_before_value(t,value,str) - if str then - if value then - for i=1,#t do - if t[i] == value then - insert(t,i,str) - return - end + for i=1,#t do + local v = t[i] + if type(v) == "table" then + if type(v[1]) == "table" then + unnest(v,f) + else + f[#f+1] = v end + else + f[#f+1] = v end - insert(t,1,str) - elseif value then - insert(t,1,value) end + return f end -function table.insert_after_value(t,value,str) - if str then - if value then - for i=1,#t do - if t[i] == value then - insert(t,i+1,str) - return - end - end - end - t[#t+1] = str - elseif value then - t[#t+1] = value - end +function table.unnest(t) -- bad name + return unnest(t) end local function are_equal(a,b,n,m) -- indexed @@ -1297,7 +1451,7 @@ end local function identical(a,b) -- assumes same structure for ka, va in next, a do - local vb = b[k] + local vb = b[ka] if va == vb then -- same elseif type(va) == "table" and type(vb) == "table" then @@ -1311,8 +1465,8 @@ local function identical(a,b) -- assumes same structure return true end -table.are_equal = are_equal table.identical = identical +table.are_equal = are_equal -- maybe also make a combined one @@ -1338,89 +1492,84 @@ function table.contains(t, v) end function table.count(t) - local n, e = 0, next(t) - while e do - n, e = n + 1, next(t,e) + local n = 0 + for k, v in next, t do + n = n + 1 end return n end -function table.swapped(t) - local s = { } +function table.swapped(t,s) -- hash + local n = { } + if s then + for k, v in next, s do + n[k] = v + end + end for k, v in next, t do - s[v] = k + n[v] = k end - return s + return n end ---~ function table.are_equal(a,b) ---~ return table.serialize(a) == table.serialize(b) ---~ end - -function table.clone(t,p) -- t is optional or nil or table - if not p then - t, p = { }, t or { } - elseif not t then - t = { } +function table.reversed(t) + if t then + local tt, tn = { }, #t + if tn > 0 then + local ttn = 0 + for i=tn,1,-1 do + ttn = ttn + 1 + tt[ttn] = t[i] + end + end + return tt end - setmetatable(t, { __index = function(_,key) return p[key] end }) -- why not __index = p ? - return t end -function table.hexed(t,seperator) - local tt = { } - for i=1,#t do tt[i] = format("0x%04X",t[i]) end - return concat(tt,seperator or " ") -end - -function table.reverse_hash(h) - local r = { } - for k,v in next, h do - r[v] = lower(gsub(k," ","")) +function table.sequenced(t,sep,simple) -- hash only + local s, n = { }, 0 + for k, v in sortedhash(t) do + if simple then + if v == true then + n = n + 1 + s[n] = k + elseif v and v~= "" then + n = n + 1 + s[n] = k .. "=" .. tostring(v) + end + else + n = n + 1 + s[n] = k .. "=" .. tostring(v) + end end - return r + return concat(s, sep or " | ") end -function table.reverse(t) - local tt = { } - if #t > 0 then - for i=#t,1,-1 do - tt[#tt+1] = t[i] - end +function table.print(t,...) + if type(t) ~= "table" then + print(tostring(t)) + else + table.tohandle(print,t,...) end - return tt end -function table.insert_before_value(t,value,extra) - for i=1,#t do - if t[i] == extra then - remove(t,i) - end - end - for i=1,#t do - if t[i] == value then - insert(t,i,extra) - return - end - end - insert(t,1,extra) +-- -- -- obsolete but we keep them for a while and might comment them later -- -- -- + +-- roughly: copy-loop : unpack : sub == 0.9 : 0.4 : 0.45 (so in critical apps, use unpack) + +function table.sub(t,i,j) + return { unpack(t,i,j) } end -function table.insert_after_value(t,value,extra) - for i=1,#t do - if t[i] == extra then - remove(t,i) - end - end - for i=1,#t do - if t[i] == value then - insert(t,i+1,extra) - return - end - end - insert(t,#t+1,extra) +-- slower than #t on indexed tables (#t only returns the size of the numerically indexed slice) + +function table.is_empty(t) + return not t or not next(t) end +function table.has_one_entry(t) + return t and not next(t,next(t)) +end end -- of closure @@ -1435,7 +1584,10 @@ if not modules then modules = { } end modules ['l-io'] = { license = "see context related readme files" } -local byte, find, gsub = string.byte, string.find, string.gsub +local io = io +local byte, find, gsub, format = string.byte, string.find, string.gsub, string.format +local concat = table.concat +local type = type if string.find(os.getenv("PATH"),";") then io.fileseparator, io.pathseparator = "\\", ";" @@ -1446,9 +1598,7 @@ end function io.loaddata(filename,textmode) local f = io.open(filename,(textmode and 'r') or 'rb') if f then - -- collectgarbage("step") -- sometimes makes a big difference in mem consumption local data = f:read('*all') - -- garbagecollector.check(data) f:close() return data else @@ -1460,13 +1610,14 @@ function io.savedata(filename,data,joiner) local f = io.open(filename,"wb") if f then if type(data) == "table" then - f:write(table.join(data,joiner or "")) + f:write(concat(data,joiner or "")) elseif type(data) == "function" then data(f) else f:write(data or "") end f:close() + io.flush() return true else return false @@ -1495,12 +1646,19 @@ function io.size(filename) end function io.noflines(f) - local n = 0 - for _ in f:lines() do - n = n + 1 + if type(f) == "string" then + local f = io.open(filename) + local n = f and io.noflines(f) or 0 + assert(f:close()) + return n + else + local n = 0 + for _ in f:lines() do + n = n + 1 + end + f:seek('set',0) + return n end - f:seek('set',0) - return n end local nextchar = { @@ -1526,8 +1684,6 @@ local nextchar = { function io.characters(f,n) if f then return nextchar[n or 1], f - else - return nil, nil end end @@ -1536,40 +1692,42 @@ local nextbyte = { local a, b, c, d = f:read(1,1,1,1) if d then return byte(a), byte(b), byte(c), byte(d) - else - return nil, nil, nil, nil + end + end, + [3] = function(f) + local a, b, c = f:read(1,1,1) + if b then + return byte(a), byte(b), byte(c) end end, [2] = function(f) local a, b = f:read(1,1) if b then return byte(a), byte(b) - else - return nil, nil end end, [1] = function (f) local a = f:read(1) if a then return byte(a) - else - return nil end end, [-2] = function (f) local a, b = f:read(1,1) if b then return byte(b), byte(a) - else - return nil, nil + end + end, + [-3] = function(f) + local a, b, c = f:read(1,1,1) + if b then + return byte(c), byte(b), byte(a) end end, [-4] = function(f) local a, b, c, d = f:read(1,1,1,1) if d then return byte(d), byte(c), byte(b), byte(a) - else - return nil, nil, nil, nil end end } @@ -1586,12 +1744,13 @@ function io.ask(question,default,options) while true do io.write(question) if options then - io.write(string.format(" [%s]",table.concat(options,"|"))) + io.write(format(" [%s]",concat(options,"|"))) end if default then - io.write(string.format(" [%s]",default)) + io.write(format(" [%s]",default)) end - io.write(string.format(" ")) + io.write(format(" ")) + io.flush() local answer = io.read() answer = gsub(answer,"^%s*(.*)%s*$","%1") if answer == "" and default then @@ -1615,6 +1774,63 @@ function io.ask(question,default,options) end end +local function readnumber(f,n,m) + if m then + f:seek("set",n) + n = m + end + if n == 1 then + return byte(f:read(1)) + elseif n == 2 then + local a, b = byte(f:read(2),1,2) + return 256 * a + b + elseif n == 3 then + local a, b, c = byte(f:read(3),1,3) + return 256*256 * a + 256 * b + c + elseif n == 4 then + local a, b, c, d = byte(f:read(4),1,4) + return 256*256*256 * a + 256*256 * b + 256 * c + d + elseif n == 8 then + local a, b = readnumber(f,4), readnumber(f,4) + return 256 * a + b + elseif n == 12 then + local a, b, c = readnumber(f,4), readnumber(f,4), readnumber(f,4) + return 256*256 * a + 256 * b + c + elseif n == -2 then + local b, a = byte(f:read(2),1,2) + return 256*a + b + elseif n == -3 then + local c, b, a = byte(f:read(3),1,3) + return 256*256 * a + 256 * b + c + elseif n == -4 then + local d, c, b, a = byte(f:read(4),1,4) + return 256*256*256 * a + 256*256 * b + 256*c + d + elseif n == -8 then + local h, g, f, e, d, c, b, a = byte(f:read(8),1,8) + return 256*256*256*256*256*256*256 * a + + 256*256*256*256*256*256 * b + + 256*256*256*256*256 * c + + 256*256*256*256 * d + + 256*256*256 * e + + 256*256 * f + + 256 * g + + h + else + return 0 + end +end + +io.readnumber = readnumber + +function io.readstring(f,n,m) + if m then + f:seek("set",n) + n = m + end + local str = gsub(f:read(n),"%z","") + return str +end + end -- of closure @@ -1628,11 +1844,15 @@ if not modules then modules = { } end modules ['l-number'] = { license = "see context related readme files" } +-- this module will be replaced when we have the bit library + local tostring = tostring -local format, floor, insert, match = string.format, math.floor, table.insert, string.match +local format, floor, match, rep = string.format, math.floor, string.match, string.rep +local concat, insert = table.concat, table.insert local lpegmatch = lpeg.match -number = number or { } +number = number or { } +local number = number -- a,b,c,d,e,f = number.toset(100101) @@ -1680,6 +1900,54 @@ function number.bits(n,zero) end +function number.bit(p) + return 2 ^ (p - 1) -- 1-based indexing +end + +function number.hasbit(x, p) -- typical call: if hasbit(x, bit(3)) then ... + return x % (p + p) >= p +end + +function number.setbit(x, p) + return hasbit(x, p) and x or x + p +end + +function number.clearbit(x, p) + return hasbit(x, p) and x - p or x +end + + +function number.tobitstring(n,m) + if n == 0 then + if m then + rep("00000000",m) + else + return "00000000" + end + else + local t = { } + while n > 0 do + insert(t,1,n % 2 > 0 and 1 or 0) + n = floor(n/2) + end + local nn = 8 - #t % 8 + if nn > 0 and nn < 8 then + for i=1,nn do + insert(t,1,0) + end + end + if m then + m = m * 8 - #t + if m > 0 then + insert(t,1,rep("0",m)) + end + end + return concat(t) + end +end + + + end -- of closure do -- create closure to overcome 200 locals limit @@ -1692,6 +1960,8 @@ if not modules then modules = { } end modules ['l-set'] = { license = "see context related readme files" } +-- This will become obsolete when we have the bitset library embedded. + set = set or { } local nums = { } @@ -1735,10 +2005,11 @@ function set.tolist(n) if n == 0 or not tabs[n] then return "" else - local t = { } + local t, n = { }, 0 for k, v in next, tabs[n] do if v then - t[#t+1] = k + n = n + 1 + t[n] = k end end return concat(t," ") @@ -1756,17 +2027,6 @@ function set.contains(n,s) end end ---~ local c = set.create{'aap','noot','mies'} ---~ local s = set.tonumber(c) ---~ local t = set.totable(s) ---~ print(t['aap']) ---~ local c = set.create{'zus','wim','jet'} ---~ local s = set.tonumber(c) ---~ local t = set.totable(s) ---~ print(t['aap']) ---~ print(t['jet']) ---~ print(set.contains(t,'jet')) ---~ print(set.contains(t,'aap')) @@ -1782,32 +2042,119 @@ if not modules then modules = { } end modules ['l-os'] = { license = "see context related readme files" } +-- This file deals with some operating system issues. Please don't bother me +-- with the pros and cons of operating systems as they all have their flaws +-- and benefits. Bashing one of them won't help solving problems and fixing +-- bugs faster and is a waste of time and energy. +-- +-- path separators: / or \ ... we can use / everywhere +-- suffixes : dll so exe ... no big deal +-- quotes : we can use "" in most cases +-- expansion : unless "" are used * might give side effects +-- piping/threads : somewhat different for each os +-- locations : specific user file locations and settings can change over time +-- +-- os.type : windows | unix (new, we already guessed os.platform) +-- os.name : windows | msdos | linux | macosx | solaris | .. | generic (new) +-- os.platform : extended os.name with architecture + -- maybe build io.flush in os.execute -local find, format, gsub = string.find, string.format, string.gsub +local os = os +local find, format, gsub, upper = string.find, string.format, string.gsub, string.upper +local concat = table.concat local random, ceil = math.random, math.ceil +local rawget, rawset, type, getmetatable, setmetatable, tonumber = rawget, rawset, type, getmetatable, setmetatable, tonumber + +-- The following code permits traversing the environment table, at least +-- in luatex. Internally all environment names are uppercase. + +if not os.__getenv__ then + + os.__getenv__ = os.getenv + os.__setenv__ = os.setenv + + if os.env then + + local osgetenv = os.getenv + local ossetenv = os.setenv + local osenv = os.env local _ = osenv.PATH -- initialize the table + + function os.setenv(k,v) + if v == nil then + v = "" + end + local K = upper(k) + osenv[K] = v + if type(v) == "table" then + v = concat(v,";") -- path + end + ossetenv(K,v) + end + + function os.getenv(k) + local K = upper(k) + local v = osenv[K] or osenv[k] or osgetenv(K) or osgetenv(k) + if v == "" then + return nil + else + return v + end + end + + else + + local ossetenv = os.setenv + local osgetenv = os.getenv + local osenv = { } + + function os.setenv(k,v) + if v == nil then + v = "" + end + local K = upper(k) + osenv[K] = v + end + + function os.getenv(k) + local K = upper(k) + local v = osenv[K] or osgetenv(K) or osgetenv(k) + if v == "" then + return nil + else + return v + end + end + + local function __index(t,k) + return os.getenv(k) + end + local function __newindex(t,k,v) + os.setenv(k,v) + end + + os.env = { } + + setmetatable(os.env, { __index = __index, __newindex = __newindex } ) + + end + +end + +-- end of environment hack -local execute, spawn, exec, ioflush = os.execute, os.spawn or os.execute, os.exec or os.execute, io.flush +local execute, spawn, exec, iopopen, ioflush = os.execute, os.spawn or os.execute, os.exec or os.execute, io.popen, io.flush function os.execute(...) ioflush() return execute(...) end function os.spawn (...) ioflush() return spawn (...) end function os.exec (...) ioflush() return exec (...) end +function io.popen (...) ioflush() return iopopen(...) end function os.resultof(command) - ioflush() -- else messed up logging local handle = io.popen(command,"r") - if not handle then - -- print("unknown command '".. command .. "' in os.resultof") - return "" - else - return handle:read("*all") or "" - end + return handle and handle:read("*all") or "" end ---~ os.type : windows | unix (new, we already guessed os.platform) ---~ os.name : windows | msdos | linux | macosx | solaris | .. | generic (new) ---~ os.platform : extended os.name with architecture - if not io.fileseparator then if find(os.getenv("PATH"),";") then io.fileseparator, io.pathseparator, os.type = "\\", ";", os.type or "mswin" @@ -1856,16 +2203,11 @@ function os.runtime() return os.gettimeofday() - startuptime end ---~ print(os.gettimeofday()-os.time()) ---~ os.sleep(1.234) ---~ print (">>",os.runtime()) ---~ print(os.date("%H:%M:%S",os.gettimeofday())) ---~ print(os.date("%H:%M:%S",os.time())) -- no need for function anymore as we have more clever code and helpers now -- this metatable trickery might as well disappear -os.resolvers = os.resolvers or { } +os.resolvers = os.resolvers or { } -- will become private local resolvers = os.resolvers @@ -1878,24 +2220,6 @@ end setmetatable(os,osmt) -if not os.setenv then - - -- we still store them but they won't be seen in - -- child processes although we might pass them some day - -- using command concatination - - local env, getenv = { }, os.getenv - - function os.setenv(k,v) - env[k] = v - end - - function os.getenv(k) - return env[k] or getenv(k) - end - -end - -- we can use HOSTTYPE on some platforms local name, platform = os.name or "linux", os.getenv("MTX_PLATFORM") or "" @@ -1935,7 +2259,7 @@ elseif os.type == "windows" then elseif name == "linux" then function os.resolvers.platform(t,k) - -- we sometims have HOSTTYPE set so let's check that first + -- we sometimes have HOSTTYPE set so let's check that first local platform, architecture = "", os.getenv("HOSTTYPE") or os.resultof("uname -m") or "" if find(architecture,"x86_64") then platform = "linux-64" @@ -2013,10 +2337,10 @@ elseif name == "freebsd" then elseif name == "kfreebsd" then function os.resolvers.platform(t,k) - -- we sometims have HOSTTYPE set so let's check that first + -- we sometimes have HOSTTYPE set so let's check that first local platform, architecture = "", os.getenv("HOSTTYPE") or os.resultof("uname -m") or "" if find(architecture,"x86_64") then - platform = "kfreebsd-64" + platform = "kfreebsd-amd64" else platform = "kfreebsd-i386" end @@ -2091,61 +2415,86 @@ if not modules then modules = { } end modules ['l-file'] = { -- needs a cleanup -file = file or { } +file = file or { } +local file = file -local concat = table.concat -local find, gmatch, match, gsub, sub, char = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char +local insert, concat = table.insert, table.concat +local find, gmatch, match, gsub, sub, char, lower = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char, string.lower local lpegmatch = lpeg.match +local getcurrentdir, attributes = lfs.currentdir, lfs.attributes -function file.removesuffix(filename) - return (gsub(filename,"%.[%a%d]+$","")) +local P, R, S, C, Cs, Cp, Cc = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc + +local function dirname(name,default) + return match(name,"^(.+)[/\\].-$") or (default or "") end -function file.addsuffix(filename, suffix) - if not suffix or suffix == "" then - return filename - elseif not find(filename,"%.[%a%d]+$") then - return filename .. "." .. suffix - else - return filename - end +local function basename(name) + return match(name,"^.+[/\\](.-)$") or name end -function file.replacesuffix(filename, suffix) - return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix +local function nameonly(name) + return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) end -function file.dirname(name,default) - return match(name,"^(.+)[/\\].-$") or (default or "") +local function extname(name,default) + return match(name,"^.+%.([^/\\]-)$") or default or "" end -function file.basename(name) - return match(name,"^.+[/\\](.-)$") or name +local function splitname(name) + local n, s = match(name,"^(.+)%.([^/\\]-)$") + return n or name, s or "" end -function file.nameonly(name) - return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) +file.basename = basename +file.dirname = dirname +file.nameonly = nameonly +file.extname = extname +file.suffix = extname + +function file.removesuffix(filename) + return (gsub(filename,"%.[%a%d]+$","")) end -function file.extname(name,default) - return match(name,"^.+%.([^/\\]-)$") or default or "" +function file.addsuffix(filename, suffix, criterium) + if not suffix or suffix == "" then + return filename + elseif criterium == true then + return filename .. "." .. suffix + elseif not criterium then + local n, s = splitname(filename) + if not s or s == "" then + return filename .. "." .. suffix + else + return filename + end + else + local n, s = splitname(filename) + if s and s ~= "" then + local t = type(criterium) + if t == "table" then + -- keep if in criterium + for i=1,#criterium do + if s == criterium[i] then + return filename + end + end + elseif t == "string" then + -- keep if criterium + if s == criterium then + return filename + end + end + end + return n .. "." .. suffix + end end -file.suffix = file.extname ---~ function file.join(...) ---~ local pth = concat({...},"/") ---~ pth = gsub(pth,"\\","/") ---~ local a, b = match(pth,"^(.*://)(.*)$") ---~ if a and b then ---~ return a .. gsub(b,"//+","/") ---~ end ---~ a, b = match(pth,"^(//)(.*)$") ---~ if a and b then ---~ return a .. gsub(b,"//+","/") ---~ end ---~ return (gsub(pth,"//+","/")) ---~ end +function file.replacesuffix(filename, suffix) + return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix +end + local trick_1 = char(1) local trick_2 = "^" .. trick_1 .. "/+" @@ -2173,60 +2522,37 @@ function file.join(...) return (gsub(pth,"//+","/")) end ---~ print(file.join("//","/y")) ---~ print(file.join("/","/y")) ---~ print(file.join("","/y")) ---~ print(file.join("/x/","/y")) ---~ print(file.join("x/","/y")) ---~ print(file.join("http://","/y")) ---~ print(file.join("http://a","/y")) ---~ print(file.join("http:///a","/y")) ---~ print(file.join("//nas-1","/y")) -function file.iswritable(name) - local a = lfs.attributes(name) or lfs.attributes(file.dirname(name,".")) +function file.is_writable(name) + local a = attributes(name) or attributes(dirname(name,".")) return a and sub(a.permissions,2,2) == "w" end -function file.isreadable(name) - local a = lfs.attributes(name) +function file.is_readable(name) + local a = attributes(name) return a and sub(a.permissions,1,1) == "r" end -file.is_readable = file.isreadable -file.is_writable = file.iswritable +file.isreadable = file.is_readable -- depricated +file.iswritable = file.is_writable -- depricated --- todo: lpeg - ---~ function file.split_path(str) ---~ local t = { } ---~ str = gsub(str,"\\", "/") ---~ str = gsub(str,"(%a):([;/])", "%1\001%2") ---~ for name in gmatch(str,"([^;:]+)") do ---~ if name ~= "" then ---~ t[#t+1] = gsub(name,"\001",":") ---~ end ---~ end ---~ return t ---~ end +-- todo: lpeg \\ / .. does not save much local checkedsplit = string.checkedsplit -function file.split_path(str,separator) +function file.splitpath(str,separator) -- string str = gsub(str,"\\","/") return checkedsplit(str,separator or io.pathseparator) end -function file.join_path(tab) - return concat(tab,io.pathseparator) -- can have trailing // +function file.joinpath(tab,separator) -- table + return concat(tab,separator or io.pathseparator) -- can have trailing // end -- we can hash them weakly -local insert = table.insert - -function file.collapse_path(str,anchor) +function file.collapsepath(str,anchor) if anchor and not find(str,"^/") and not find(str,"^%a:") then str = getcurrentdir() .. "/" .. str end @@ -2280,62 +2606,15 @@ function file.collapse_path(str,anchor) return concat(newelements, '/') end end -function file.xcollapse_path(str) - print('collapse', str) - if str == "" or str =="." then - return "." - elseif find(str,"^%.%.") then - return str - elseif not find(str,"%.") then - return str - end - str = gsub(str,"^%./",lfs.currentdir() .. "/") -- ./xx in qualified - str = gsub(str,"\\","/") - local oldelements = checkedsplit(str,"/") - local newelements = { } - local i = #oldelements - while i > 0 do - local element = oldelements[i] - if element == '.' then - -- do nothing - elseif element == '..' then - local n = i -1 - while n > 0 do - local element = oldelements[n] - if element ~= '..' and element ~= '.' then - oldelements[n] = '.' - break - else - n = n - 1 - end - end - if n<1 then - insert(newelements,1,'..') - end - elseif element ~= "" then - insert(newelements,1,element) - end - i = i - 1 - end - if #newelements == 0 then - return "." - elseif find(str,"^/") then - return "/" .. concat(newelements,'/') - else - return concat(newelements, '/') - end -end ---~ print(file.collapse_path("/a")) ---~ print(file.collapse_path("a/./b/..")) ---~ print(file.collapse_path("a/aa/../b/bb")) ---~ print(file.collapse_path("a/../..")) ---~ print(file.collapse_path("a/.././././b/..")) ---~ print(file.collapse_path("a/./././b/..")) ---~ print(file.collapse_path("a/b/c/../..")) -function file.robustname(str) - return (gsub(str,"[^%a%d%/%-%.\\]+","-")) +function file.robustname(str,strict) + str = gsub(str,"[^%a%d%/%-%.\\]+","-") + if strict then + return lower(gsub(str,"^%-*(.-)%-*$","%1")) + else + return str + end end file.readdata = io.loaddata @@ -2347,100 +2626,34 @@ end -- lpeg variants, slightly faster, not always ---~ local period = lpeg.P(".") ---~ local slashes = lpeg.S("\\/") ---~ local noperiod = 1-period ---~ local noslashes = 1-slashes ---~ local name = noperiod^1 - ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.C(noperiod^1) * -1 - ---~ function file.extname(name) ---~ return lpegmatch(pattern,name) or "" ---~ end - ---~ local pattern = lpeg.Cs(((period * noperiod^1 * -1)/"" + 1)^1) - ---~ function file.removesuffix(name) ---~ return lpegmatch(pattern,name) ---~ end - ---~ local pattern = (noslashes^0 * slashes)^1 * lpeg.C(noslashes^1) * -1 - ---~ function file.basename(name) ---~ return lpegmatch(pattern,name) or name ---~ end - ---~ local pattern = (noslashes^0 * slashes)^1 * lpeg.Cp() * noslashes^1 * -1 - ---~ function file.dirname(name) ---~ local p = lpegmatch(pattern,name) ---~ if p then ---~ return sub(name,1,p-2) ---~ else ---~ return "" ---~ end ---~ end - ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.Cp() * noperiod^1 * -1 - ---~ function file.addsuffix(name, suffix) ---~ local p = lpegmatch(pattern,name) ---~ if p then ---~ return name ---~ else ---~ return name .. "." .. suffix ---~ end ---~ end - ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.Cp() * noperiod^1 * -1 - ---~ function file.replacesuffix(name,suffix) ---~ local p = lpegmatch(pattern,name) ---~ if p then ---~ return sub(name,1,p-2) .. "." .. suffix ---~ else ---~ return name .. "." .. suffix ---~ end ---~ end - ---~ local pattern = (noslashes^0 * slashes)^0 * lpeg.Cp() * ((noperiod^1 * period)^1 * lpeg.Cp() + lpeg.P(true)) * noperiod^1 * -1 - ---~ function file.nameonly(name) ---~ local a, b = lpegmatch(pattern,name) ---~ if b then ---~ return sub(name,a,b-2) ---~ elseif a then ---~ return sub(name,a) ---~ else ---~ return name ---~ end ---~ end - ---~ local test = file.extname ---~ local test = file.basename ---~ local test = file.dirname ---~ local test = file.addsuffix ---~ local test = file.replacesuffix ---~ local test = file.nameonly - ---~ print(1,test("./a/b/c/abd.def.xxx","!!!")) ---~ print(2,test("./../b/c/abd.def.xxx","!!!")) ---~ print(3,test("a/b/c/abd.def.xxx","!!!")) ---~ print(4,test("a/b/c/def.xxx","!!!")) ---~ print(5,test("a/b/c/def","!!!")) ---~ print(6,test("def","!!!")) ---~ print(7,test("def.xxx","!!!")) - ---~ local tim = os.clock() for i=1,250000 do local ext = test("abd.def.xxx","!!!") end print(os.clock()-tim) + + + + + + + + + + + + + + + + + -- also rewrite previous -local letter = lpeg.R("az","AZ") + lpeg.S("_-+") -local separator = lpeg.P("://") +local letter = R("az","AZ") + S("_-+") +local separator = P("://") + +local qualified = P(".")^0 * P("/") + letter*P(":") + letter^1*separator + letter^1 * P("/") +local rootbased = P("/") + letter*P(":") -local qualified = lpeg.P(".")^0 * lpeg.P("/") + letter*lpeg.P(":") + letter^1*separator + letter^1 * lpeg.P("/") -local rootbased = lpeg.P("/") + letter*lpeg.P(":") +lpeg.patterns.qualified = qualified +lpeg.patterns.rootbased = rootbased -- ./name ../name /name c: :// name/name @@ -2452,14 +2665,16 @@ function file.is_rootbased_path(filename) return lpegmatch(rootbased,filename) ~= nil end -local slash = lpeg.S("\\/") -local period = lpeg.P(".") -local drive = lpeg.C(lpeg.R("az","AZ")) * lpeg.P(":") -local path = lpeg.C(((1-slash)^0 * slash)^0) -local suffix = period * lpeg.C(lpeg.P(1-period)^0 * lpeg.P(-1)) -local base = lpeg.C((1-suffix)^0) +-- actually these are schemes -local pattern = (drive + lpeg.Cc("")) * (path + lpeg.Cc("")) * (base + lpeg.Cc("")) * (suffix + lpeg.Cc("")) +local slash = S("\\/") +local period = P(".") +local drive = C(R("az","AZ")) * P(":") +local path = C(((1-slash)^0 * slash)^0) +local suffix = period * C(P(1-period)^0 * P(-1)) +local base = C((1-suffix)^0) + +local pattern = (drive + Cc("")) * (path + Cc("")) * (base + Cc("")) * (suffix + Cc("")) function file.splitname(str) -- returns drive, path, base, suffix return lpegmatch(pattern,str) @@ -2472,14 +2687,13 @@ end -- test { "/aa", "/aa/bb", "/aa/bb/cc", "/aa/bb/cc.dd", "/aa/bb/cc.dd.ee" } -- test { "aa", "aa/bb", "aa/bb/cc", "aa/bb/cc.dd", "aa/bb/cc.dd.ee" } ---~ -- todo: ---~ ---~ if os.type == "windows" then ---~ local currentdir = lfs.currentdir ---~ function lfs.currentdir() ---~ return (gsub(currentdir(),"\\","/")) ---~ end ---~ end + +-- for myself: + +function file.strip(name,dir) + local b, a = match(name,"^(.-)" .. dir .. "(.*)$") + return a ~= "" and a or name +end end -- of closure @@ -2495,6 +2709,7 @@ if not modules then modules = { } end modules ['l-md5'] = { -- This also provides file checksums and checkers. +local md5, file = md5, file local gsub, format, byte = string.gsub, string.format, string.byte local function convert(str,fmt) @@ -2505,27 +2720,13 @@ if not md5.HEX then function md5.HEX(str) return convert(str,"%02X") end end if not md5.hex then function md5.hex(str) return convert(str,"%02x") end end if not md5.dec then function md5.dec(str) return convert(str,"%03i") end end ---~ if not md5.HEX then ---~ local function remap(chr) return format("%02X",byte(chr)) end ---~ function md5.HEX(str) return (gsub(md5.sum(str),".",remap)) end ---~ end ---~ if not md5.hex then ---~ local function remap(chr) return format("%02x",byte(chr)) end ---~ function md5.hex(str) return (gsub(md5.sum(str),".",remap)) end ---~ end ---~ if not md5.dec then ---~ local function remap(chr) return format("%03i",byte(chr)) end ---~ function md5.dec(str) return (gsub(md5.sum(str),".",remap)) end ---~ end - -file.needs_updating_threshold = 1 - -function file.needs_updating(oldname,newname) -- size modification access change + +function file.needs_updating(oldname,newname,threshold) -- size modification access change local oldtime = lfs.attributes(oldname, modification) local newtime = lfs.attributes(newname, modification) if newtime >= oldtime then return false - elseif oldtime - newtime < file.needs_updating_threshold then + elseif oldtime - newtime < (threshold or 1) then return false else return true @@ -2572,86 +2773,171 @@ if not modules then modules = { } end modules ['l-url'] = { license = "see context related readme files" } -local char, gmatch, gsub = string.char, string.gmatch, string.gsub +local char, gmatch, gsub, format, byte, find = string.char, string.gmatch, string.gsub, string.format, string.byte, string.find +local concat = table.concat local tonumber, type = tonumber, type -local lpegmatch = lpeg.match +local P, C, R, S, Cs, Cc, Ct = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cs, lpeg.Cc, lpeg.Ct +local lpegmatch, lpegpatterns, replacer = lpeg.match, lpeg.patterns, lpeg.replacer --- from the spec (on the web): +-- from wikipedia: -- --- foo://example.com:8042/over/there?name=ferret#nose --- \_/ \______________/\_________/ \_________/ \__/ --- | | | | | --- scheme authority path query fragment --- | _____________________|__ --- / \ / \ --- urn:example:animal:ferret:nose +-- foo://username:password@example.com:8042/over/there/index.dtb?type=animal;name=narwhal#nose +-- \_/ \_______________/ \_________/ \__/ \___/ \_/ \______________________/ \__/ +-- | | | | | | | | +-- | userinfo hostname port | | query fragment +-- | \________________________________/\_____________|____|/ +-- scheme | | | | +-- | authority path | | +-- | | | +-- | path interpretable as filename +-- | ___________|____________ | +-- / \ / \ | +-- urn:example:animal:ferret:nose interpretable as extension + +url = url or { } +local url = url + +local tochar = function(s) return char(tonumber(s,16)) end + +local colon = P(":") +local qmark = P("?") +local hash = P("#") +local slash = P("/") +local percent = P("%") +local endofstring = P(-1) + +local hexdigit = R("09","AF","af") +local plus = P("+") +local nothing = Cc("") +local escaped = (plus / " ") + (percent * C(hexdigit * hexdigit) / tochar) -url = url or { } +-- we assume schemes with more than 1 character (in order to avoid problems with windows disks) -local function tochar(s) - return char(tonumber(s,16)) -end +local scheme = Cs((escaped+(1-colon-slash-qmark-hash))^2) * colon + nothing +local authority = slash * slash * Cs((escaped+(1- slash-qmark-hash))^0) + nothing +local path = slash * Cs((escaped+(1- qmark-hash))^0) + nothing +local query = qmark * Cs((escaped+(1- hash))^0) + nothing +local fragment = hash * Cs((escaped+(1- endofstring))^0) + nothing -local colon, qmark, hash, slash, percent, endofstring = lpeg.P(":"), lpeg.P("?"), lpeg.P("#"), lpeg.P("/"), lpeg.P("%"), lpeg.P(-1) +local validurl = scheme * authority * path * query * fragment +local parser = Ct(validurl) -local hexdigit = lpeg.R("09","AF","af") -local plus = lpeg.P("+") -local escaped = (plus / " ") + (percent * lpeg.C(hexdigit * hexdigit) / tochar) +lpegpatterns.url = validurl +lpegpatterns.urlsplitter = parser --- we assume schemes with more than 1 character (in order to avoid problems with windows disks) +local escapes = { } ; for i=0,255 do escapes[i] = format("%%%02X",i) end -local scheme = lpeg.Cs((escaped+(1-colon-slash-qmark-hash))^2) * colon + lpeg.Cc("") -local authority = slash * slash * lpeg.Cs((escaped+(1- slash-qmark-hash))^0) + lpeg.Cc("") -local path = slash * lpeg.Cs((escaped+(1- qmark-hash))^0) + lpeg.Cc("") -local query = qmark * lpeg.Cs((escaped+(1- hash))^0) + lpeg.Cc("") -local fragment = hash * lpeg.Cs((escaped+(1- endofstring))^0) + lpeg.Cc("") +local escaper = Cs((R("09","AZ","az") + S("-./_") + P(1) / escapes)^0) -local parser = lpeg.Ct(scheme * authority * path * query * fragment) +lpegpatterns.urlescaper = escaper -- todo: reconsider Ct as we can as well have five return values (saves a table) -- so we can have two parsers, one with and one without -function url.split(str) +local function split(str) return (type(str) == "string" and lpegmatch(parser,str)) or str end +local function hasscheme(str) + local scheme = lpegmatch(scheme,str) -- at least one character + return scheme and scheme ~= "" +end + -- todo: cache them -function url.hashed(str) - local s = url.split(str) +local rootletter = R("az","AZ") + + S("_-+") +local separator = P("://") +local qualified = P(".")^0 * P("/") + + rootletter * P(":") + + rootletter^1 * separator + + rootletter^1 * P("/") +local rootbased = P("/") + + rootletter * P(":") + +local barswapper = replacer("|",":") +local backslashswapper = replacer("\\","/") + +local function hashed(str) -- not yet ok (/test?test) + local s = split(str) local somescheme = s[1] ~= "" - return { - scheme = (somescheme and s[1]) or "file", - authority = s[2], - path = s[3], - query = s[4], - fragment = s[5], - original = str, - noscheme = not somescheme, - } + local somequery = s[4] ~= "" + if not somescheme and not somequery then + s = { + scheme = "file", + authority = "", + path = str, + query = "", + fragment = "", + original = str, + noscheme = true, + filename = str, + } + else -- not always a filename but handy anyway + local authority, path, filename = s[2], s[3] + if authority == "" then + filename = path + else + filename = authority .. "/" .. path + end + s = { + scheme = s[1], + authority = authority, + path = path, + query = s[4], + fragment = s[5], + original = str, + noscheme = false, + filename = filename, + } + end + return s end -function url.hasscheme(str) - return url.split(str)[1] ~= "" -end +-- Here we assume: +-- +-- files: /// = relative +-- files: //// = absolute (!) + -function url.addscheme(str,scheme) - return (url.hasscheme(str) and str) or ((scheme or "file:///") .. str) + +url.split = split +url.hasscheme = hasscheme +url.hashed = hashed + +function url.addscheme(str,scheme) -- no authority + if hasscheme(str) then + return str + elseif not scheme then + return "file:///" .. str + else + return scheme .. ":///" .. str + end end -function url.construct(hash) - local fullurl = hash.sheme .. "://".. hash.authority .. hash.path - if hash.query then - fullurl = fullurl .. "?".. hash.query +function url.construct(hash) -- dodo: we need to escape ! + local fullurl, f = { }, 0 + local scheme, authority, path, query, fragment = hash.scheme, hash.authority, hash.path, hash.query, hash.fragment + if scheme and scheme ~= "" then + f = f + 1 ; fullurl[f] = scheme .. "://" + end + if authority and authority ~= "" then + f = f + 1 ; fullurl[f] = authority + end + if path and path ~= "" then + f = f + 1 ; fullurl[f] = "/" .. path + end + if query and query ~= "" then + f = f + 1 ; fullurl[f] = "?".. query end - if hash.fragment then - fullurl = fullurl .. "?".. hash.fragment + if fragment and fragment ~= "" then + f = f + 1 ; fullurl[f] = "#".. fragment end - return fullurl + return lpegmatch(escaper,concat(fullurl)) end function url.filename(filename) - local t = url.hashed(filename) + local t = hashed(filename) return (t.scheme == "file" and (gsub(t.path,"^/([a-zA-Z])([:|])/)","%1:"))) or filename end @@ -2667,37 +2953,13 @@ function url.query(str) end end ---~ print(url.filename("file:///c:/oeps.txt")) ---~ print(url.filename("c:/oeps.txt")) ---~ print(url.filename("file:///oeps.txt")) ---~ print(url.filename("file:///etc/test.txt")) ---~ print(url.filename("/oeps.txt")) - ---~ from the spec on the web (sort of): ---~ ---~ function test(str) ---~ print(table.serialize(url.hashed(str))) ---~ end ---~ ---~ test("%56pass%20words") ---~ test("file:///c:/oeps.txt") ---~ test("file:///c|/oeps.txt") ---~ test("file:///etc/oeps.txt") ---~ test("file://./etc/oeps.txt") ---~ test("file:////etc/oeps.txt") ---~ test("ftp://ftp.is.co.za/rfc/rfc1808.txt") ---~ test("http://www.ietf.org/rfc/rfc2396.txt") ---~ test("ldap://[2001:db8::7]/c=GB?objectClass?one#what") ---~ test("mailto:John.Doe@example.com") ---~ test("news:comp.infosystems.www.servers.unix") ---~ test("tel:+1-816-555-1212") ---~ test("telnet://192.0.2.16:80/") ---~ test("urn:oasis:names:specification:docbook:dtd:xml:4.1.2") ---~ test("/etc/passwords") ---~ test("http://www.pragma-ade.com/spaced%20name") - ---~ test("zip:///oeps/oeps.zip#bla/bla.tex") ---~ test("zip:///oeps/oeps.zip?bla/bla.tex") + + + + + + + end -- of closure @@ -2712,35 +2974,53 @@ if not modules then modules = { } end modules ['l-dir'] = { license = "see context related readme files" } --- dir.expand_name will be merged with cleanpath and collapsepath +-- dir.expandname will be merged with cleanpath and collapsepath local type = type local find, gmatch, match, gsub = string.find, string.gmatch, string.match, string.gsub +local concat, insert, remove = table.concat, table.insert, table.remove local lpegmatch = lpeg.match +local P, S, R, C, Cc, Cs, Ct, Cv, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cv, lpeg.V + dir = dir or { } +local dir = dir +local lfs = lfs + +local attributes = lfs.attributes +local walkdir = lfs.dir +local isdir = lfs.isdir +local isfile = lfs.isfile +local mkdir = lfs.mkdir +local chdir = lfs.chdir +local currentdir = lfs.currentdir -- handy function dir.current() - return (gsub(lfs.currentdir(),"\\","/")) + return (gsub(currentdir(),"\\","/")) end --- optimizing for no string.find (*) does not save time +-- optimizing for no find (*) does not save time -local attributes = lfs.attributes -local walkdir = lfs.dir -local function glob_pattern(path,patt,recurse,action) - local ok, scanner +local lfsisdir = isdir + +local function isdir(path) + path = gsub(path,"[/\\]+$","") + return lfsisdir(path) +end + +lfs.isdir = isdir + +local function globpattern(path,patt,recurse,action) if path == "/" then - ok, scanner = xpcall(function() return walkdir(path..".") end, function() end) -- kepler safe - else - ok, scanner = xpcall(function() return walkdir(path) end, function() end) -- kepler safe + path = path .. "." + elseif not find(path,"/$") then + path = path .. '/' end - if ok and type(scanner) == "function" then - if not find(path,"/$") then path = path .. '/' end - for name in scanner do + if isdir(path) then -- lfs.isdir does not like trailing / + for name in walkdir(path) do -- lfs.dir accepts trailing / local full = path .. name local mode = attributes(full,'mode') if mode == 'file' then @@ -2748,15 +3028,15 @@ local function glob_pattern(path,patt,recurse,action) action(full) end elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then - glob_pattern(full,patt,recurse,action) + globpattern(full,patt,recurse,action) end end end end -dir.glob_pattern = glob_pattern +dir.globpattern = globpattern -local function collect_pattern(path,patt,recurse,result) +local function collectpattern(path,patt,recurse,result) local ok, scanner result = result or { } if path == "/" then @@ -2775,7 +3055,7 @@ local function collect_pattern(path,patt,recurse,result) result[name] = attr end elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then - attr.list = collect_pattern(full,patt,recurse) + attr.list = collectpattern(full,patt,recurse) result[name] = attr end end @@ -2783,9 +3063,7 @@ local function collect_pattern(path,patt,recurse,result) return result end -dir.collect_pattern = collect_pattern - -local P, S, R, C, Cc, Cs, Ct, Cv, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cv, lpeg.V +dir.collectpattern = collectpattern local pattern = Ct { [1] = (C(P(".") + P("/")^1) + C(R("az","AZ") * P(":") * P("/")^0) + Cc("./")) * V(2) * V(3), @@ -2809,16 +3087,16 @@ local function glob(str,t) for s=1,#str do glob(str[s],t) end - elseif lfs.isfile(str) then + elseif isfile(str) then t(str) else - local split = lpegmatch(pattern,str) + local split = lpegmatch(pattern,str) -- we could use the file splitter if split then local root, path, base = split[1], split[2], split[3] local recurse = find(base,"%*%*") local start = root .. path local result = lpegmatch(filter,start .. base) - glob_pattern(start,result,recurse,t) + globpattern(start,result,recurse,t) end end else @@ -2828,12 +3106,15 @@ local function glob(str,t) glob(str[s],t) end return t - elseif lfs.isfile(str) then - local t = t or { } - t[#t+1] = str - return t + elseif isfile(str) then + if t then + t[#t+1] = str + return t + else + return { str } + end else - local split = lpegmatch(pattern,str) + local split = lpegmatch(pattern,str) -- we could use the file splitter if split then local t = t or { } local action = action or function(name) t[#t+1] = name end @@ -2841,7 +3122,7 @@ local function glob(str,t) local recurse = find(base,"%*%*") local start = root .. path local result = lpegmatch(filter,start .. base) - glob_pattern(start,result,recurse,action) + globpattern(start,result,recurse,action) return t else return { } @@ -2852,18 +3133,14 @@ end dir.glob = glob ---~ list = dir.glob("**/*.tif") ---~ list = dir.glob("/**/*.tif") ---~ list = dir.glob("./**/*.tif") ---~ list = dir.glob("oeps/**/*.tif") ---~ list = dir.glob("/oeps/**/*.tif") local function globfiles(path,recurse,func,files) -- func == pattern or function if type(func) == "string" then - local s = func -- alas, we need this indirect way + local s = func func = function(name) return find(name,s) end end files = files or { } + local noffiles = #files for name in walkdir(path) do if find(name,"^%.") then --- skip @@ -2874,12 +3151,9 @@ local function globfiles(path,recurse,func,files) -- func == pattern or function globfiles(path .. "/" .. name,recurse,func,files) end elseif mode == "file" then - if func then - if func(name) then - files[#files+1] = path .. "/" .. name - end - else - files[#files+1] = path .. "/" .. name + if not func or func(name) then + noffiles = noffiles + 1 + files[noffiles] = path .. "/" .. name end end end @@ -2897,17 +3171,15 @@ dir.globfiles = globfiles -- print(dir.ls("*.tex")) function dir.ls(pattern) - return table.concat(glob(pattern),"\n") + return concat(glob(pattern),"\n") end ---~ mkdirs("temp") ---~ mkdirs("a/b/c") ---~ mkdirs(".","/a/b/c") ---~ mkdirs("a","b","c") local make_indeed = true -- false -if string.find(os.getenv("PATH"),";") then -- os.type == "windows" +local onwindows = os.type == "windows" or find(os.getenv("PATH"),";") + +if onwindows then function dir.mkdirs(...) local str, pth, t = "", "", { ... } @@ -2956,64 +3228,21 @@ if string.find(os.getenv("PATH"),";") then -- os.type == "windows" else pth = pth .. "/" .. s end - if make_indeed and not lfs.isdir(pth) then - lfs.mkdir(pth) - end - end - return pth, (lfs.isdir(pth) == true) - end - ---~ print(dir.mkdirs("","","a","c")) ---~ print(dir.mkdirs("a")) ---~ print(dir.mkdirs("a:")) ---~ print(dir.mkdirs("a:/b/c")) ---~ print(dir.mkdirs("a:b/c")) ---~ print(dir.mkdirs("a:/bbb/c")) ---~ print(dir.mkdirs("/a/b/c")) ---~ print(dir.mkdirs("/aaa/b/c")) ---~ print(dir.mkdirs("//a/b/c")) ---~ print(dir.mkdirs("///a/b/c")) ---~ print(dir.mkdirs("a/bbb//ccc/")) - - function dir.expand_name(str) -- will be merged with cleanpath and collapsepath - local first, nothing, last = match(str,"^(//)(//*)(.*)$") - if first then - first = dir.current() .. "/" - end - if not first then - first, last = match(str,"^(//)/*(.*)$") - end - if not first then - first, last = match(str,"^([a-zA-Z]:)(.*)$") - if first and not find(last,"^/") then - local d = lfs.currentdir() - if lfs.chdir(first) then - first = dir.current() - end - lfs.chdir(d) + if make_indeed and not isdir(pth) then + mkdir(pth) end end - if not first then - first, last = dir.current(), str - end - last = gsub(last,"//","/") - last = gsub(last,"/%./","/") - last = gsub(last,"^/*","") - first = gsub(first,"/*$","") - if last == "" then - return first - else - return first .. "/" .. last - end + return pth, (isdir(pth) == true) end + else function dir.mkdirs(...) local str, pth, t = "", "", { ... } for i=1,#t do local s = t[i] - if s ~= "" then + if s and s ~= "" then -- we catch nil and false if str ~= "" then str = str .. "/" .. s else @@ -3031,42 +3260,92 @@ else else pth = pth .. "/" .. s end - if make_indeed and not first and not lfs.isdir(pth) then - lfs.mkdir(pth) + if make_indeed and not first and not isdir(pth) then + mkdir(pth) end end else pth = "." for s in gmatch(str,"[^/]+") do pth = pth .. "/" .. s - if make_indeed and not lfs.isdir(pth) then - lfs.mkdir(pth) + if make_indeed and not isdir(pth) then + mkdir(pth) + end + end + end + return pth, (isdir(pth) == true) + end + + +end + +dir.makedirs = dir.mkdirs + +-- we can only define it here as it uses dir.current + +if onwindows then + + function dir.expandname(str) -- will be merged with cleanpath and collapsepath + local first, nothing, last = match(str,"^(//)(//*)(.*)$") + if first then + first = dir.current() .. "/" + end + if not first then + first, last = match(str,"^(//)/*(.*)$") + end + if not first then + first, last = match(str,"^([a-zA-Z]:)(.*)$") + if first and not find(last,"^/") then + local d = currentdir() + if chdir(first) then + first = dir.current() end + chdir(d) end end - return pth, (lfs.isdir(pth) == true) + if not first then + first, last = dir.current(), str + end + last = gsub(last,"//","/") + last = gsub(last,"/%./","/") + last = gsub(last,"^/*","") + first = gsub(first,"/*$","") + if last == "" or last == "." then + return first + else + return first .. "/" .. last + end end ---~ print(dir.mkdirs("","","a","c")) ---~ print(dir.mkdirs("a")) ---~ print(dir.mkdirs("/a/b/c")) ---~ print(dir.mkdirs("/aaa/b/c")) ---~ print(dir.mkdirs("//a/b/c")) ---~ print(dir.mkdirs("///a/b/c")) ---~ print(dir.mkdirs("a/bbb//ccc/")) +else - function dir.expand_name(str) -- will be merged with cleanpath and collapsepath + function dir.expandname(str) -- will be merged with cleanpath and collapsepath if not find(str,"^/") then - str = lfs.currentdir() .. "/" .. str + str = currentdir() .. "/" .. str end str = gsub(str,"//","/") str = gsub(str,"/%./","/") + str = gsub(str,"(.)/%.$","%1") return str end end -dir.makedirs = dir.mkdirs +file.expandname = dir.expandname -- for convenience + +local stack = { } + +function dir.push(newdir) + insert(stack,lfs.currentdir()) +end + +function dir.pop() + local d = remove(stack) + if d then + lfs.chdir(d) + end + return d +end end -- of closure @@ -3081,12 +3360,17 @@ if not modules then modules = { } end modules ['l-boolean'] = { license = "see context related readme files" } +local type, tonumber = type, tonumber + boolean = boolean or { } +local boolean = boolean -local type, tonumber = type, tonumber +-- function boolean.tonumber(b) +-- return b and 1 or 0 -- test and test and return or return +-- end function boolean.tonumber(b) - if b then return 1 else return 0 end + if b then return 1 else return 0 end -- test and return or return end function toboolean(str,tolerant) @@ -3110,7 +3394,9 @@ function toboolean(str,tolerant) end end -function string.is_boolean(str) +string.toboolean = toboolean + +function string.is_boolean(str,default) if type(str) == "string" then if str == "true" or str == "yes" or str == "on" or str == "t" then return true @@ -3118,15 +3404,7 @@ function string.is_boolean(str) return false end end - return nil -end - -function boolean.alwaystrue() - return true -end - -function boolean.falsetrue() - return false + return default end @@ -3134,7 +3412,7 @@ end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['l-math'] = { +if not modules then modules = { } end modules ['l-unicode'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -3142,228 +3420,290 @@ if not modules then modules = { } end modules ['l-math'] = { license = "see context related readme files" } -local floor, sin, cos, tan = math.floor, math.sin, math.cos, math.tan +if not unicode then -if not math.round then - function math.round(x) - return floor(x + 0.5) - end -end + unicode = { utf8 = { } } -if not math.div then - function math.div(n,m) - return floor(n/m) - end -end + local floor, char = math.floor, string.char -if not math.mod then - function math.mod(n,m) - return n % m + function unicode.utf8.utfchar(n) + if n < 0x80 then + return char(n) + elseif n < 0x800 then + return char( + 0xC0 + floor(n/0x40), + 0x80 + (n % 0x40) + ) + elseif n < 0x10000 then + return char( + 0xE0 + floor(n/0x1000), + 0x80 + (floor(n/0x40) % 0x40), + 0x80 + (n % 0x40) + ) + elseif n < 0x40000 then + return char( + 0xF0 + floor(n/0x40000), + 0x80 + floor(n/0x1000), + 0x80 + (floor(n/0x40) % 0x40), + 0x80 + (n % 0x40) + ) + else + -- return char( + -- 0xF1 + floor(n/0x1000000), + -- 0x80 + floor(n/0x40000), + -- 0x80 + floor(n/0x1000), + -- 0x80 + (floor(n/0x40) % 0x40), + -- 0x80 + (n % 0x40) + -- ) + return "?" + end end + end -local pipi = 2*math.pi/360 +local unicode = unicode -function math.sind(d) - return sin(d*pipi) -end - -function math.cosd(d) - return cos(d*pipi) -end - -function math.tand(d) - return tan(d*pipi) -end +utf = utf or unicode.utf8 +local concat = table.concat +local utfchar, utfbyte, utfgsub = utf.char, utf.byte, utf.gsub +local char, byte, find, bytepairs, utfvalues, format = string.char, string.byte, string.find, string.bytepairs, string.utfvalues, string.format +local type = type -end -- of closure +local utfsplitlines = string.utfsplitlines -do -- create closure to overcome 200 locals limit +-- 0 EF BB BF UTF-8 +-- 1 FF FE UTF-16-little-endian +-- 2 FE FF UTF-16-big-endian +-- 3 FF FE 00 00 UTF-32-little-endian +-- 4 00 00 FE FF UTF-32-big-endian -if not modules then modules = { } end modules ['l-utils'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" +unicode.utfname = { + [0] = 'utf-8', + [1] = 'utf-16-le', + [2] = 'utf-16-be', + [3] = 'utf-32-le', + [4] = 'utf-32-be' } --- hm, quite unreadable +-- \000 fails in <= 5.0 but is valid in >=5.1 where %z is depricated -local gsub = string.gsub -local concat = table.concat -local type, next = type, next +function unicode.utftype(f) + local str = f:read(4) + if not str then + f:seek('set') + return 0 + -- elseif find(str,"^%z%z\254\255") then -- depricated + -- elseif find(str,"^\000\000\254\255") then -- not permitted and bugged + elseif find(str,"\000\000\254\255",1,true) then -- seems to work okay (TH) + return 4 + -- elseif find(str,"^\255\254%z%z") then -- depricated + -- elseif find(str,"^\255\254\000\000") then -- not permitted and bugged + elseif find(str,"\255\254\000\000",1,true) then -- seems to work okay (TH) + return 3 + elseif find(str,"^\254\255") then + f:seek('set',2) + return 2 + elseif find(str,"^\255\254") then + f:seek('set',2) + return 1 + elseif find(str,"^\239\187\191") then + f:seek('set',3) + return 0 + else + f:seek('set') + return 0 + end +end -if not utils then utils = { } end -if not utils.merger then utils.merger = { } end -if not utils.lua then utils.lua = { } end -utils.merger.m_begin = "begin library merge" -utils.merger.m_end = "end library merge" -utils.merger.pattern = - "%c+" .. - "%-%-%s+" .. utils.merger.m_begin .. - "%c+(.-)%c+" .. - "%-%-%s+" .. utils.merger.m_end .. - "%c+" -function utils.merger._self_fake_() - return - "-- " .. "created merged file" .. "\n\n" .. - "-- " .. utils.merger.m_begin .. "\n\n" .. - "-- " .. utils.merger.m_end .. "\n\n" +local function utf16_to_utf8_be(t) + if type(t) == "string" then + t = utfsplitlines(str) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, 0 + for left, right in bytepairs(t[i]) do + if right then + local now = 256*left + right + if more > 0 then + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 + more = 0 + r = r + 1 + result[r] = utfchar(now) + elseif now >= 0xD800 and now <= 0xDBFF then + more = now + else + r = r + 1 + result[r] = utfchar(now) + end + end + end + t[i] = concat(result,"",1,r) -- we reused tmp, hence t + end + return t end -function utils.report(...) - print(...) +local function utf16_to_utf8_le(t) + if type(t) == "string" then + t = utfsplitlines(str) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, 0 + for left, right in bytepairs(t[i]) do + if right then + local now = 256*right + left + if more > 0 then + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 + more = 0 + r = r + 1 + result[r] = utfchar(now) + elseif now >= 0xD800 and now <= 0xDBFF then + more = now + else + r = r + 1 + result[r] = utfchar(now) + end + end + end + t[i] = concat(result,"",1,r) -- we reused tmp, hence t + end + return t end -utils.merger.strip_comment = true - -function utils.merger._self_load_(name) - local f, data = io.open(name), "" - if f then - utils.report("reading merge from %s",name) - data = f:read("*all") - f:close() - else - utils.report("unknown file to merge %s",name) +local function utf32_to_utf8_be(str) + if type(t) == "string" then + t = utfsplitlines(str) end - if data and utils.merger.strip_comment then - -- saves some 20K - data = gsub(data,"%-%-~[^\n\r]*[\r\n]", "") + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, -1 + for a,b in bytepairs(str) do + if a and b then + if more < 0 then + more = 256*256*256*a + 256*256*b + else + r = r + 1 + result[t] = utfchar(more + 256*a + b) + more = -1 + end + else + break + end + end + t[i] = concat(result,"",1,r) end - return data or "" + return result end -function utils.merger._self_save_(name, data) - if data ~= "" then - local f = io.open(name,'w') - if f then - utils.report("saving merge from %s",name) - f:write(data) - f:close() +local function utf32_to_utf8_le(str) + if type(t) == "string" then + t = utfsplitlines(str) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, -1 + for a,b in bytepairs(str) do + if a and b then + if more < 0 then + more = 256*b + a + else + r = r + 1 + result[t] = utfchar(more + 256*256*256*b + 256*256*a) + more = -1 + end + else + break + end end + t[i] = concat(result,"",1,r) end + return result end -function utils.merger._self_swap_(data,code) - if data ~= "" then - return (gsub(data,utils.merger.pattern, function(s) - return "\n\n" .. "-- "..utils.merger.m_begin .. "\n" .. code .. "\n" .. "-- "..utils.merger.m_end .. "\n\n" - end, 1)) +unicode.utf32_to_utf8_be = utf32_to_utf8_be +unicode.utf32_to_utf8_le = utf32_to_utf8_le +unicode.utf16_to_utf8_be = utf16_to_utf8_be +unicode.utf16_to_utf8_le = utf16_to_utf8_le + +function unicode.utf8_to_utf8(t) + return type(t) == "string" and utfsplitlines(t) or t +end + +function unicode.utf16_to_utf8(t,endian) + return endian and utf16_to_utf8_be(t) or utf16_to_utf8_le(t) or t +end + +function unicode.utf32_to_utf8(t,endian) + return endian and utf32_to_utf8_be(t) or utf32_to_utf8_le(t) or t +end + +local function little(c) + local b = byte(c) + if b < 0x10000 then + return char(b%256,b/256) else - return "" + b = b - 0x10000 + local b1, b2 = b/1024 + 0xD800, b%1024 + 0xDC00 + return char(b1%256,b1/256,b2%256,b2/256) end end ---~ stripper: ---~ ---~ data = gsub(data,"%-%-~[^\n]*\n","") ---~ data = gsub(data,"\n\n+","\n") - -function utils.merger._self_libs_(libs,list) - local result, f, frozen = { }, nil, false - result[#result+1] = "\n" - if type(libs) == 'string' then libs = { libs } end - if type(list) == 'string' then list = { list } end - local foundpath = nil - for i=1,#libs do - local lib = libs[i] - for j=1,#list do - local pth = gsub(list[j],"\\","/") -- file.clean_path - utils.report("checking library path %s",pth) - local name = pth .. "/" .. lib - if lfs.isfile(name) then - foundpath = pth - end - end - if foundpath then break end +local function big(c) + local b = byte(c) + if b < 0x10000 then + return char(b/256,b%256) + else + b = b - 0x10000 + local b1, b2 = b/1024 + 0xD800, b%1024 + 0xDC00 + return char(b1/256,b1%256,b2/256,b2%256) end - if foundpath then - utils.report("using library path %s",foundpath) - local right, wrong = { }, { } - for i=1,#libs do - local lib = libs[i] - local fullname = foundpath .. "/" .. lib - if lfs.isfile(fullname) then - -- right[#right+1] = lib - utils.report("merging library %s",fullname) - result[#result+1] = "do -- create closure to overcome 200 locals limit" - result[#result+1] = io.loaddata(fullname,true) - result[#result+1] = "end -- of closure" - else - -- wrong[#wrong+1] = lib - utils.report("no library %s",fullname) - end - end - if #right > 0 then - utils.report("merged libraries: %s",concat(right," ")) - end - if #wrong > 0 then - utils.report("skipped libraries: %s",concat(wrong," ")) - end +end + +function unicode.utf8_to_utf16(str,littleendian) + if littleendian then + return char(255,254) .. utfgsub(str,".",little) else - utils.report("no valid library path found") + return char(254,255) .. utfgsub(str,".",big) end - return concat(result, "\n\n") end -function utils.merger.selfcreate(libs,list,target) - if target then - utils.merger._self_save_( - target, - utils.merger._self_swap_( - utils.merger._self_fake_(), - utils.merger._self_libs_(libs,list) - ) - ) +function unicode.utfcodes(str) + local t, n = { }, 0 + for u in utfvalues(str) do + n = n + 1 + t[n] = format("0x%04X",u) end + return concat(t,separator or " ") end -function utils.merger.selfmerge(name,libs,list,target) - utils.merger._self_save_( - target or name, - utils.merger._self_swap_( - utils.merger._self_load_(name), - utils.merger._self_libs_(libs,list) - ) - ) +function unicode.ustring(s) + return format("U+%05X",type(s) == "number" and s or utfbyte(s)) end -function utils.merger.selfclean(name) - utils.merger._self_save_( - name, - utils.merger._self_swap_( - utils.merger._self_load_(name), - "" - ) - ) +function unicode.xstring(s) + return format("0x%05X",type(s) == "number" and s or utfbyte(s)) end -function utils.lua.compile(luafile, lucfile, cleanup, strip) -- defaults: cleanup=false strip=true - -- utils.report("compiling",luafile,"into",lucfile) - os.remove(lucfile) - local command = "-o " .. string.quote(lucfile) .. " " .. string.quote(luafile) - if strip ~= false then - command = "-s " .. command - end - local done = (os.spawn("texluac " .. command) == 0) or (os.spawn("luac " .. command) == 0) - if done and cleanup == true and lfs.isfile(lucfile) and lfs.isfile(luafile) then - -- utils.report("removing",luafile) - os.remove(luafile) - end - return done + +local lpegmatch = lpeg.match +local utftype = lpeg.patterns.utftype + +function unicode.filetype(data) + return data and lpegmatch(utftype,data) or "unknown" end + end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['l-aux'] = { +if not modules then modules = { } end modules ['l-math'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -3371,606 +3711,2538 @@ if not modules then modules = { } end modules ['l-aux'] = { license = "see context related readme files" } --- for inline, no store split : for s in string.gmatch(str,",* *([^,]+)") do .. end - -aux = aux or { } +local floor, sin, cos, tan = math.floor, math.sin, math.cos, math.tan -local concat, format, gmatch = table.concat, string.format, string.gmatch -local tostring, type = tostring, type -local lpegmatch = lpeg.match +if not math.round then + function math.round(x) return floor(x + 0.5) end +end -local P, R, V = lpeg.P, lpeg.R, lpeg.V +if not math.div then + function math.div(n,m) return floor(n/m) end +end -local escape, left, right = P("\\"), P('{'), P('}') +if not math.mod then + function math.mod(n,m) return n % m end +end -lpeg.patterns.balanced = P { - [1] = ((escape * (left+right)) + (1 - (left+right)) + V(2))^0, - [2] = left * V(1) * right -} +local pipi = 2*math.pi/360 -local space = lpeg.P(' ') -local equal = lpeg.P("=") -local comma = lpeg.P(",") -local lbrace = lpeg.P("{") -local rbrace = lpeg.P("}") -local nobrace = 1 - (lbrace+rbrace) -local nested = lpeg.P { lbrace * (nobrace + lpeg.V(1))^0 * rbrace } -local spaces = space^0 +if not math.sind then + function math.sind(d) return sin(d*pipi) end + function math.cosd(d) return cos(d*pipi) end + function math.tand(d) return tan(d*pipi) end +end -local value = lpeg.P(lbrace * lpeg.C((nobrace + nested)^0) * rbrace) + lpeg.C((nested + (1-comma))^0) +if not math.odd then + function math.odd (n) return n % 2 == 0 end + function math.even(n) return n % 2 ~= 0 end +end -local key = lpeg.C((1-equal-comma)^1) -local pattern_a = (space+comma)^0 * (key * equal * value + key * lpeg.C("")) -local pattern_c = (space+comma)^0 * (key * equal * value) -local key = lpeg.C((1-space-equal-comma)^1) -local pattern_b = spaces * comma^0 * spaces * (key * ((spaces * equal * spaces * value) + lpeg.C(""))) +end -- of closure --- "a=1, b=2, c=3, d={a{b,c}d}, e=12345, f=xx{a{b,c}d}xx, g={}" : outer {} removes, leading spaces ignored +do -- create closure to overcome 200 locals limit -local hash = { } +if not modules then modules = { } end modules ['util-tab'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} -local function set(key,value) -- using Carg is slower here - hash[key] = value -end +utilities = utilities or {} +utilities.tables = utilities.tables or { } +local tables = utilities.tables -local pattern_a_s = (pattern_a/set)^1 -local pattern_b_s = (pattern_b/set)^1 -local pattern_c_s = (pattern_c/set)^1 +local format, gmatch = string.format, string.gmatch +local concat, insert, remove = table.concat, table.insert, table.remove +local setmetatable, getmetatable, tonumber, tostring = setmetatable, getmetatable, tonumber, tostring -aux.settings_to_hash_pattern_a = pattern_a_s -aux.settings_to_hash_pattern_b = pattern_b_s -aux.settings_to_hash_pattern_c = pattern_c_s +function tables.definetable(target) -- defines undefined tables + local composed, t, n = nil, { }, 0 + for name in gmatch(target,"([^%.]+)") do + n = n + 1 + if composed then + composed = composed .. "." .. name + else + composed = name + end + t[n] = format("%s = %s or { }",composed,composed) + end + return concat(t,"\n") +end -function aux.make_settings_to_hash_pattern(set,how) - if how == "strict" then - return (pattern_c/set)^1 - elseif how == "tolerant" then - return (pattern_b/set)^1 - else - return (pattern_a/set)^1 +function tables.accesstable(target) + local t = _G + for name in gmatch(target,"([^%.]+)") do + t = t[name] end + return t end -function aux.settings_to_hash(str,existing) - if str and str ~= "" then - hash = existing or { } - if moretolerant then - lpegmatch(pattern_b_s,str) - else - lpegmatch(pattern_a_s,str) +function tables.removevalue(t,value) -- todo: n + if value then + for i=1,#t do + if t[i] == value then + remove(t,i) + -- remove all, so no: return + end end - return hash - else - return { } end end -function aux.settings_to_hash_tolerant(str,existing) - if str and str ~= "" then - hash = existing or { } - lpegmatch(pattern_b_s,str) - return hash - else - return { } +function tables.insertbeforevalue(t,value,extra) + for i=1,#t do + if t[i] == extra then + remove(t,i) + end end + for i=1,#t do + if t[i] == value then + insert(t,i,extra) + return + end + end + insert(t,1,extra) end -function aux.settings_to_hash_strict(str,existing) - if str and str ~= "" then - hash = existing or { } - lpegmatch(pattern_c_s,str) - return next(hash) and hash - else - return nil +function tables.insertaftervalue(t,value,extra) + for i=1,#t do + if t[i] == extra then + remove(t,i) + end + end + for i=1,#t do + if t[i] == value then + insert(t,i+1,extra) + return + end end + insert(t,#t+1,extra) end -local separator = comma * space^0 -local value = lpeg.P(lbrace * lpeg.C((nobrace + nested)^0) * rbrace) + lpeg.C((nested + (1-comma))^0) -local pattern = lpeg.Ct(value*(separator*value)^0) - --- "aap, {noot}, mies" : outer {} removes, leading spaces ignored - -aux.settings_to_array_pattern = pattern +-- experimental --- we could use a weak table as cache +local function toxml(t,d,result) + for k, v in table.sortedpairs(t) do + if type(v) == "table" then + result[#result+1] = format("%s<%s>",d,k) + toxml(v,d.." ",result) + result[#result+1] = format("%s",d,k) + elseif tonumber(k) then + result[#result+1] = format("%s%s",d,k,v,k) + else + result[#result+1] = format("%s<%s>%s",d,k,tostring(v),k) + end + end +end -function aux.settings_to_array(str) - if not str or str == "" then - return { } +function table.toxml(t,name,nobanner) + local noroot = name == false + local result = (nobanner or noroot) and { } or { "" } + if noroot then + toxml( t, "", result) else - return lpegmatch(pattern,str) + toxml( { [name or "root"] = t }, "", result) end + return concat(result,"\n") end -local function set(t,v) - t[#t+1] = v -end -local value = lpeg.P(lpeg.Carg(1)*value) / set -local pattern = value*(separator*value)^0 * lpeg.Carg(1) +end -- of closure -function aux.add_settings_to_array(t,str) - return lpegmatch(pattern,str,nil,t) -end +do -- create closure to overcome 200 locals limit -function aux.hash_to_string(h,separator,yes,no,strict,omit) - if h then - local t, s = { }, table.sortedkeys(h) - omit = omit and table.tohash(omit) - for i=1,#s do - local key = s[i] - if not omit or not omit[key] then - local value = h[key] - if type(value) == "boolean" then - if yes and no then - if value then - t[#t+1] = key .. '=' .. yes - elseif not strict then - t[#t+1] = key .. '=' .. no - end - elseif value or not strict then - t[#t+1] = key .. '=' .. tostring(value) - end - else - t[#t+1] = key .. '=' .. value - end - end - end - return concat(t,separator or ",") - else - return "" - end -end +if not modules then modules = { } end modules ['util-sto'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} -function aux.array_to_string(a,separator) - if a then - return concat(a,separator or ",") - else - return "" +local setmetatable, getmetatable = setmetatable, getmetatable + +utilities = utilities or { } +utilities.storage = utilities.storage or { } +local storage = utilities.storage + +function storage.mark(t) + if not t then + texio.write_nl("fatal error: storage '%s' cannot be marked",t) + os.exit() + end + local m = getmetatable(t) + if not m then + m = { } + setmetatable(t,m) end + m.__storage__ = true + return t end -function aux.settings_to_set(str,t) +function storage.allocate(t) t = t or { } - for s in gmatch(str,"%s*([^,]+)") do - t[s] = true + local m = getmetatable(t) + if not m then + m = { } + setmetatable(t,m) end + m.__storage__ = true return t end -local value = lbrace * lpeg.C((nobrace + nested)^0) * rbrace -local pattern = lpeg.Ct((space + value)^0) +function storage.marked(t) + local m = getmetatable(t) + return m and m.__storage__ +end -function aux.arguments_to_table(str) - return lpegmatch(pattern,str) +function storage.checked(t) + if not t then + texio.write_nl("fatal error: storage '%s' has not been allocated",t) + os.exit() + end + return t end --- temporary here -function aux.getparameters(self,class,parentclass,settings) - local sc = self[class] - if not sc then - sc = table.clone(self[parent]) - self[class] = sc +function storage.setinitializer(data,initialize) + local m = getmetatable(data) or { } + m.__index = function(data,k) + m.__index = nil -- so that we can access the entries during initializing + initialize() + return data[k] end - aux.settings_to_hash(settings,sc) + setmetatable(data, m) end --- temporary here +local keyisvalue = { __index = function(t,k) + t[k] = k + return k +end } -local digit = lpeg.R("09") -local period = lpeg.P(".") -local zero = lpeg.P("0") -local trailingzeros = zero^0 * -digit -- suggested by Roberto R -local case_1 = period * trailingzeros / "" -local case_2 = period * (digit - trailingzeros)^1 * (trailingzeros / "") -local number = digit^1 * (case_1 + case_2) -local stripper = lpeg.Cs((number + 1)^0) +function storage.sparse(t) + t = t or { } + setmetatable(t,keyisvalue) + return t +end ---~ local sample = "bla 11.00 bla 11 bla 0.1100 bla 1.00100 bla 0.00 bla 0.001 bla 1.1100 bla 0.100100100 bla 0.00100100100" ---~ collectgarbage("collect") ---~ str = string.rep(sample,10000) ---~ local ts = os.clock() ---~ lpegmatch(stripper,str) ---~ print(#str, os.clock()-ts, lpegmatch(stripper,sample)) +-- table namespace ? -lpeg.patterns.strip_zeros = stripper +local function f_empty () return "" end -- t,k +local function f_self (t,k) t[k] = k return k end +local function f_ignore() end -- t,k,v -function aux.strip_zeros(str) - return lpegmatch(stripper,str) -end +local t_empty = { __index = empty } +local t_self = { __index = self } +local t_ignore = { __newindex = ignore } -function aux.definetable(target) -- defines undefined tables - local composed, t = nil, { } - for name in gmatch(target,"([^%.]+)") do - if composed then - composed = composed .. "." .. name +function table.setmetatableindex(t,f) + local m = getmetatable(t) + if m then + if f == "empty" then + m.__index = f_empty + elseif f == "key" then + m.__index = f_self else - composed = name + m.__index = f + end + else + if f == "empty" then + setmetatable(t, t_empty) + elseif f == "key" then + setmetatable(t, t_self) + else + setmetatable(t,{ __index = f }) end - t[#t+1] = format("%s = %s or { }",composed,composed) end - return concat(t,"\n") end -function aux.accesstable(target) - local t = _G - for name in gmatch(target,"([^%.]+)") do - t = t[name] +function table.setmetatablenewindex(t,f) + local m = getmetatable(t) + if m then + if f == "ignore" then + m.__newindex = f_ignore + else + m.__newindex = f + end + else + if f == "ignore" then + setmetatable(t, t_ignore) + else + setmetatable(t,{ __newindex = f }) + end end - return t end ---~ function string.commaseparated(str) ---~ return gmatch(str,"([^,%s]+)") ---~ end +function table.setmetatablecall(t,f) + local m = getmetatable(t) + if m then + m.__call = f + else + setmetatable(t,{ __call = f }) + end +end --- as we use this a lot ... +function table.setmetatablekey(t,key,value) + local m = getmetatable(t) + if not m then + m = { } + setmetatable(t,m) + end + m[key] = value +end ---~ function aux.cachefunction(action,weak) ---~ local cache = { } ---~ if weak then ---~ setmetatable(cache, { __mode = "kv" } ) ---~ end ---~ local function reminder(str) ---~ local found = cache[str] ---~ if not found then ---~ found = action(str) ---~ cache[str] = found ---~ end ---~ return found ---~ end ---~ return reminder, cache ---~ end +function table.getmetatablekey(t,key,value) + local m = getmetatable(t) + return m and m[key] +end end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['trac-tra'] = { +if not modules then modules = { } end modules ['util-mrg'] = { version = 1.001, - comment = "companion to trac-tra.mkiv", + comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } --- the tag is kind of generic and used for functions that are not --- bound to a variable, like node.new, node.copy etc (contrary to for instance --- node.has_attribute which is bound to a has_attribute local variable in mkiv) - -local debug = require "debug" +-- hm, quite unreadable -local getinfo = debug.getinfo -local type, next = type, next +local gsub, format = string.gsub, string.format local concat = table.concat -local format, find, lower, gmatch, gsub = string.format, string.find, string.lower, string.gmatch, string.gsub - -debugger = debugger or { } +local type, next = type, next -local counters = { } -local names = { } +utilities = utilities or {} +utilities.merger = utilities.merger or { } -- maybe mergers +utilities.report = logs and logs.reporter("system") or print --- one +local merger = utilities.merger -local function hook() - local f = getinfo(2,"f").func - local n = getinfo(2,"Sn") --- if n.what == "C" and n.name then print (n.namewhat .. ': ' .. n.name) end - if f then - local cf = counters[f] - if cf == nil then - counters[f] = 1 - names[f] = n - else - counters[f] = cf + 1 - end - end -end -local function getname(func) - local n = names[func] - if n then - if n.what == "C" then - return n.name or '' - else - -- source short_src linedefined what name namewhat nups func - local name = n.name or n.namewhat or n.what - if not name or name == "" then name = "?" end - return format("%s : %s : %s", n.short_src or "unknown source", n.linedefined or "--", name) - end - else - return "unknown" - end -end -function debugger.showstats(printer,threshold) - printer = printer or texio.write or print - threshold = threshold or 0 - local total, grandtotal, functions = 0, 0, 0 - printer("\n") -- ugly but ok - -- table.sort(counters) - for func, count in next, counters do - if count > threshold then - local name = getname(func) - if not find(name,"for generator") then - printer(format("%8i %s", count, name)) - total = total + count - end - end - grandtotal = grandtotal + count - functions = functions + 1 - end - printer(format("functions: %s, total: %s, grand total: %s, threshold: %s\n", functions, total, grandtotal, threshold)) -end +merger.strip_comment = true --- two +local m_begin_merge = "begin library merge" +local m_end_merge = "end library merge" +local m_begin_closure = "do -- create closure to overcome 200 locals limit" +local m_end_closure = "end -- of closure" ---~ local function hook() ---~ local n = getinfo(2) ---~ if n.what=="C" and not n.name then ---~ local f = tostring(debug.traceback()) ---~ local cf = counters[f] ---~ if cf == nil then ---~ counters[f] = 1 ---~ names[f] = n ---~ else ---~ counters[f] = cf + 1 ---~ end ---~ end ---~ end ---~ function debugger.showstats(printer,threshold) ---~ printer = printer or texio.write or print ---~ threshold = threshold or 0 ---~ local total, grandtotal, functions = 0, 0, 0 ---~ printer("\n") -- ugly but ok ---~ -- table.sort(counters) ---~ for func, count in next, counters do ---~ if count > threshold then ---~ printer(format("%8i %s", count, func)) ---~ total = total + count ---~ end ---~ grandtotal = grandtotal + count ---~ functions = functions + 1 ---~ end ---~ printer(format("functions: %s, total: %s, grand total: %s, threshold: %s\n", functions, total, grandtotal, threshold)) ---~ end +local m_pattern = + "%c+" .. + "%-%-%s+" .. m_begin_merge .. + "%c+(.-)%c+" .. + "%-%-%s+" .. m_end_merge .. + "%c+" --- rest +local m_format = + "\n\n-- " .. m_begin_merge .. + "\n%s\n" .. + "-- " .. m_end_merge .. "\n\n" -function debugger.savestats(filename,threshold) - local f = io.open(filename,'w') - if f then - debugger.showstats(function(str) f:write(str) end,threshold) - f:close() - end -end +local m_faked = + "-- " .. "created merged file" .. "\n\n" .. + "-- " .. m_begin_merge .. "\n\n" .. + "-- " .. m_end_merge .. "\n\n" -function debugger.enable() - debug.sethook(hook,"c") +local function self_fake() + return m_faked end -function debugger.disable() - debug.sethook() ---~ counters[debug.getinfo(2,"f").func] = nil +local function self_nothing() + return "" end -function debugger.tracing() - local n = tonumber(os.env['MTX.TRACE.CALLS']) or tonumber(os.env['MTX_TRACE_CALLS']) or 0 - if n > 0 then - function debugger.tracing() return true end ; return true +local function self_load(name) + local data = io.loaddata(name) or "" + if data == "" then + utilities.report("merge: unknown file %s",name) else - function debugger.tracing() return false end ; return false + utilities.report("merge: inserting %s",name) end + return data or "" end ---~ debugger.enable() - ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) - ---~ debugger.disable() - ---~ print("") ---~ debugger.showstats() ---~ print("") ---~ debugger.showstats(print,3) - -setters = setters or { } -setters.data = setters.data or { } +local function self_save(name, data) + if data ~= "" then + if merger.strip_comment then + -- saves some 20K + local n = #data + data = gsub(data,"%-%-~[^\n\r]*[\r\n]","") + utilities.report("merge: %s bytes of comment stripped, %s bytes of code left",n-#data,#data) + end + io.savedata(name,data) + utilities.report("merge: saving %s",name) + end +end ---~ local function set(t,what,value) ---~ local data, done = t.data, t.done ---~ if type(what) == "string" then ---~ what = aux.settings_to_array(what) -- inefficient but ok ---~ end ---~ for i=1,#what do ---~ local w = what[i] ---~ for d, f in next, data do ---~ if done[d] then ---~ -- prevent recursion due to wildcards ---~ elseif find(d,w) then ---~ done[d] = true ---~ for i=1,#f do ---~ f[i](value) ---~ end ---~ end ---~ end ---~ end ---~ end +local function self_swap(data,code) + return data ~= "" and (gsub(data,m_pattern, function() return format(m_format,code) end, 1)) or "" +end -local function set(t,what,value) - local data, done = t.data, t.done - if type(what) == "string" then - what = aux.settings_to_hash(what) -- inefficient but ok - end - for w, v in next, what do - if v == "" then - v = value - else - v = toboolean(v) +local function self_libs(libs,list) + local result, f, frozen, foundpath = { }, nil, false, nil + result[#result+1] = "\n" + if type(libs) == 'string' then libs = { libs } end + if type(list) == 'string' then list = { list } end + for i=1,#libs do + local lib = libs[i] + for j=1,#list do + local pth = gsub(list[j],"\\","/") -- file.clean_path + utilities.report("merge: checking library path %s",pth) + local name = pth .. "/" .. lib + if lfs.isfile(name) then + foundpath = pth + end end - for d, f in next, data do - if done[d] then - -- prevent recursion due to wildcards - elseif find(d,w) then - done[d] = true - for i=1,#f do - f[i](v) - end + if foundpath then break end + end + if foundpath then + utilities.report("merge: using library path %s",foundpath) + local right, wrong = { }, { } + for i=1,#libs do + local lib = libs[i] + local fullname = foundpath .. "/" .. lib + if lfs.isfile(fullname) then + utilities.report("merge: using library %s",fullname) + right[#right+1] = lib + result[#result+1] = m_begin_closure + result[#result+1] = io.loaddata(fullname,true) + result[#result+1] = m_end_closure + else + utilities.report("merge: skipping library %s",fullname) + wrong[#wrong+1] = lib end end + if #right > 0 then + utilities.report("merge: used libraries: %s",concat(right," ")) + end + if #wrong > 0 then + utilities.report("merge: skipped libraries: %s",concat(wrong," ")) + end + else + utilities.report("merge: no valid library path found") end + return concat(result, "\n\n") end -local function reset(t) - for d, f in next, t.data do - for i=1,#f do - f[i](false) - end +function merger.selfcreate(libs,list,target) + if target then + self_save(target,self_swap(self_fake(),self_libs(libs,list))) end end -local function enable(t,what) - set(t,what,true) +function merger.selfmerge(name,libs,list,target) + self_save(target or name,self_swap(self_load(name),self_libs(libs,list))) end -local function disable(t,what) - local data = t.data - if not what or what == "" then - t.done = { } - reset(t) - else - set(t,what,false) - end +function merger.selfclean(name) + self_save(name,self_swap(self_load(name),self_nothing())) end -function setters.register(t,what,...) - local data = t.data - what = lower(what) - local w = data[what] - if not w then - w = { } - data[what] = w + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['util-lua'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +utilities = utilities or {} +utilities.lua = utilities.lua or { } +utilities.report = logs and logs.reporter("system") or print + +function utilities.lua.compile(luafile,lucfile,cleanup,strip) -- defaults: cleanup=false strip=true + utilities.report("lua: compiling %s into %s",luafile,lucfile) + os.remove(lucfile) + local command = "-o " .. string.quoted(lucfile) .. " " .. string.quoted(luafile) + if strip ~= false then + command = "-s " .. command end - for _, fnc in next, { ... } do - local typ = type(fnc) - if typ == "function" then - w[#w+1] = fnc - elseif typ == "string" then - w[#w+1] = function(value) set(t,fnc,value,nesting) end - end + local done = os.spawn("texluac " .. command) == 0 or os.spawn("luac " .. command) == 0 + if done and cleanup == true and lfs.isfile(lucfile) and lfs.isfile(luafile) then + utilities.report("lua: removing %s",luafile) + os.remove(luafile) end + return done end -function setters.enable(t,what) - local e = t.enable - t.enable, t.done = enable, { } - enable(t,string.simpleesc(tostring(what))) - t.enable, t.done = e, { } -end -function setters.disable(t,what) - local e = t.disable - t.disable, t.done = disable, { } - disable(t,string.simpleesc(tostring(what))) - t.disable, t.done = e, { } -end -function setters.reset(t) - t.done = { } - reset(t) -end -function setters.list(t) -- pattern - local list = table.sortedkeys(t.data) - local user, system = { }, { } - for l=1,#list do - local what = list[l] - if find(what,"^%*") then + + + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['util-prs'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local P, R, V, C, Ct, Carg = lpeg.P, lpeg.R, lpeg.V, lpeg.C, lpeg.Ct, lpeg.Carg +local lpegmatch = lpeg.match +local concat, format, gmatch = table.concat, string.format, string.gmatch +local tostring, type, next = tostring, type, next + +utilities = utilities or {} +utilities.parsers = utilities.parsers or { } +local parsers = utilities.parsers +parsers.patterns = parsers.patterns or { } + +local setmetatableindex = table.setmetatableindex +local sortedhash = table.sortedhash + +-- we could use a Cf Cg construct + +local escape, left, right = P("\\"), P('{'), P('}') + +lpeg.patterns.balanced = P { + [1] = ((escape * (left+right)) + (1 - (left+right)) + V(2))^0, + [2] = left * V(1) * right +} + +local space = P(' ') +local equal = P("=") +local comma = P(",") +local lbrace = P("{") +local rbrace = P("}") +local nobrace = 1 - (lbrace+rbrace) +local nested = P { lbrace * (nobrace + V(1))^0 * rbrace } +local spaces = space^0 + +lpeg.patterns.nested = nested + +local value = P(lbrace * C((nobrace + nested)^0) * rbrace) + C((nested + (1-comma))^0) + +local key = C((1-equal-comma)^1) +local pattern_a = (space+comma)^0 * (key * equal * value + key * C("")) +local pattern_c = (space+comma)^0 * (key * equal * value) + +local key = C((1-space-equal-comma)^1) +local pattern_b = spaces * comma^0 * spaces * (key * ((spaces * equal * spaces * value) + C(""))) + +-- "a=1, b=2, c=3, d={a{b,c}d}, e=12345, f=xx{a{b,c}d}xx, g={}" : outer {} removes, leading spaces ignored + +local hash = { } + +local function set(key,value) + hash[key] = value +end + +local function set(key,value) + hash[key] = value +end + +local pattern_a_s = (pattern_a/set)^1 +local pattern_b_s = (pattern_b/set)^1 +local pattern_c_s = (pattern_c/set)^1 + +parsers.patterns.settings_to_hash_a = pattern_a_s +parsers.patterns.settings_to_hash_b = pattern_b_s +parsers.patterns.settings_to_hash_c = pattern_c_s + +function parsers.make_settings_to_hash_pattern(set,how) + if how == "strict" then + return (pattern_c/set)^1 + elseif how == "tolerant" then + return (pattern_b/set)^1 + else + return (pattern_a/set)^1 + end +end + +function parsers.settings_to_hash(str,existing) + if str and str ~= "" then + hash = existing or { } + lpegmatch(pattern_a_s,str) + return hash + else + return { } + end +end + +function parsers.settings_to_hash_tolerant(str,existing) + if str and str ~= "" then + hash = existing or { } + lpegmatch(pattern_b_s,str) + return hash + else + return { } + end +end + +function parsers.settings_to_hash_strict(str,existing) + if str and str ~= "" then + hash = existing or { } + lpegmatch(pattern_c_s,str) + return next(hash) and hash + else + return nil + end +end + +local separator = comma * space^0 +local value = P(lbrace * C((nobrace + nested)^0) * rbrace) + C((nested + (1-comma))^0) +local pattern = Ct(value*(separator*value)^0) + +-- "aap, {noot}, mies" : outer {} removes, leading spaces ignored + +parsers.patterns.settings_to_array = pattern + +-- we could use a weak table as cache + +function parsers.settings_to_array(str) + if not str or str == "" then + return { } + else + return lpegmatch(pattern,str) + end +end + +local function set(t,v) + t[#t+1] = v +end + +local value = P(Carg(1)*value) / set +local pattern = value*(separator*value)^0 * Carg(1) + +function parsers.add_settings_to_array(t,str) + return lpegmatch(pattern,str,nil,t) +end + +function parsers.hash_to_string(h,separator,yes,no,strict,omit) + if h then + local t, tn, s = { }, 0, table.sortedkeys(h) + omit = omit and table.tohash(omit) + for i=1,#s do + local key = s[i] + if not omit or not omit[key] then + local value = h[key] + if type(value) == "boolean" then + if yes and no then + if value then + tn = tn + 1 + t[tn] = key .. '=' .. yes + elseif not strict then + tn = tn + 1 + t[tn] = key .. '=' .. no + end + elseif value or not strict then + tn = tn + 1 + t[tn] = key .. '=' .. tostring(value) + end + else + tn = tn + 1 + t[tn] = key .. '=' .. value + end + end + end + return concat(t,separator or ",") + else + return "" + end +end + +function parsers.array_to_string(a,separator) + if a then + return concat(a,separator or ",") + else + return "" + end +end + +function parsers.settings_to_set(str,t) -- tohash? -- todo: lpeg -- duplicate anyway + t = t or { } +-- for s in gmatch(str,"%s*([^, ]+)") do -- space added + for s in gmatch(str,"[^, ]+") do -- space added + t[s] = true + end + return t +end + +function parsers.simple_hash_to_string(h, separator) + local t, tn = { }, 0 + for k, v in sortedhash(h) do + if v then + tn = tn + 1 + t[tn] = k + end + end + return concat(t,separator or ",") +end + +local value = lbrace * C((nobrace + nested)^0) * rbrace +local pattern = Ct((space + value)^0) + +function parsers.arguments_to_table(str) + return lpegmatch(pattern,str) +end + +-- temporary here (unoptimized) + +function parsers.getparameters(self,class,parentclass,settings) + local sc = self[class] + if not sc then + sc = { } + self[class] = sc + if parentclass then + local sp = self[parentclass] + if not sp then + sp = { } + self[parentclass] = sp + end + setmetatableindex(sc,sp) + end + end + parsers.settings_to_hash(settings,sc) +end + +function parsers.listitem(str) + return gmatch(str,"[^, ]+") +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['util-fmt'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +utilities = utilities or { } +utilities.formatters = utilities.formatters or { } +local formatters = utilities.formatters + +local concat, format = table.concat, string.format +local tostring, type = tostring, type +local strip = string.strip + +local P, R, Cs = lpeg.P, lpeg.R, lpeg.Cs +local lpegmatch = lpeg.match + +-- temporary here + +local digit = R("09") +local period = P(".") +local zero = P("0") +local trailingzeros = zero^0 * -digit -- suggested by Roberto R +local case_1 = period * trailingzeros / "" +local case_2 = period * (digit - trailingzeros)^1 * (trailingzeros / "") +local number = digit^1 * (case_1 + case_2) +local stripper = Cs((number + 1)^0) + + +lpeg.patterns.stripzeros = stripper + +function formatters.stripzeros(str) + return lpegmatch(stripper,str) +end + +function formatters.formatcolumns(result,between) + if result and #result > 0 then + between = between or " " + local widths, numbers = { }, { } + local first = result[1] + local n = #first + for i=1,n do + widths[i] = 0 + end + for i=1,#result do + local r = result[i] + for j=1,n do + local rj = r[j] + local tj = type(rj) + if tj == "number" then + numbers[j] = true + end + if tj ~= "string" then + rj = tostring(rj) + r[j] = rj + end + local w = #rj + if w > widths[j] then + widths[j] = w + end + end + end + for i=1,n do + local w = widths[i] + if numbers[i] then + if w > 80 then + widths[i] = "%s" .. between + else + widths[i] = "%0" .. w .. "i" .. between + end + else + if w > 80 then + widths[i] = "%s" .. between + elseif w > 0 then + widths[i] = "%-" .. w .. "s" .. between + else + widths[i] = "%s" + end + end + end + local template = strip(concat(widths)) + for i=1,#result do + local str = format(template,unpack(result[i])) + result[i] = strip(str) + end + end + return result +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['util.deb'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- the tag is kind of generic and used for functions that are not +-- bound to a variable, like node.new, node.copy etc (contrary to for instance +-- node.has_attribute which is bound to a has_attribute local variable in mkiv) + +local debug = require "debug" + +local getinfo = debug.getinfo +local type, next, tostring = type, next, tostring +local format, find = string.format, string.find +local is_boolean = string.is_boolean + +utilities = utilities or { } +utilities.debugger = utilities.debugger or { } +local debugger = utilities.debugger + +local counters = { } +local names = { } + +-- one + +local function hook() + local f = getinfo(2,"f").func + local n = getinfo(2,"Sn") +-- if n.what == "C" and n.name then print (n.namewhat .. ': ' .. n.name) end + if f then + local cf = counters[f] + if cf == nil then + counters[f] = 1 + names[f] = n + else + counters[f] = cf + 1 + end + end +end + +local function getname(func) + local n = names[func] + if n then + if n.what == "C" then + return n.name or '' + else + -- source short_src linedefined what name namewhat nups func + local name = n.name or n.namewhat or n.what + if not name or name == "" then name = "?" end + return format("%s : %s : %s", n.short_src or "unknown source", n.linedefined or "--", name) + end + else + return "unknown" + end +end + +function debugger.showstats(printer,threshold) + printer = printer or texio.write or print + threshold = threshold or 0 + local total, grandtotal, functions = 0, 0, 0 + printer("\n") -- ugly but ok + -- table.sort(counters) + for func, count in next, counters do + if count > threshold then + local name = getname(func) + if not find(name,"for generator") then + printer(format("%8i %s", count, name)) + total = total + count + end + end + grandtotal = grandtotal + count + functions = functions + 1 + end + printer(format("functions: %s, total: %s, grand total: %s, threshold: %s\n", functions, total, grandtotal, threshold)) +end + +-- two + + +-- rest + +function debugger.savestats(filename,threshold) + local f = io.open(filename,'w') + if f then + debugger.showstats(function(str) f:write(str) end,threshold) + f:close() + end +end + +function debugger.enable() + debug.sethook(hook,"c") +end + +function debugger.disable() + debug.sethook() +end + + + + + +local is_node = node and node.is_node + +function inspect(i) -- global function + local ti = type(i) + if ti == "table" then + table.print(i,"table") + elseif is_node and is_node(i) then + table.print(nodes.astable(i),tostring(i)) + else + print(tostring(i)) + end +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['trac-inf'] = { + version = 1.001, + comment = "companion to trac-inf.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- As we want to protect the global tables, we no longer store the timing +-- in the tables themselves but in a hidden timers table so that we don't +-- get warnings about assignments. This is more efficient than using rawset +-- and rawget. + +local format = string.format +local clock = os.gettimeofday or os.clock -- should go in environment +local write_nl = texio.write_nl + +statistics = statistics or { } +local statistics = statistics + +statistics.enable = true +statistics.threshold = 0.05 + +local statusinfo, n, registered, timers = { }, 0, { }, { } + +local function hastiming(instance) + return instance and timers[instance] +end + +local function resettiming(instance) + timers[instance or "notimer"] = { timing = 0, loadtime = 0 } +end + +local function starttiming(instance) + local timer = timers[instance or "notimer"] + if not timer then + timer = { } + timers[instance or "notimer"] = timer + end + local it = timer.timing + if not it then + it = 0 + end + if it == 0 then + timer.starttime = clock() + if not timer.loadtime then + timer.loadtime = 0 + end + end + timer.timing = it + 1 +end + +local function stoptiming(instance, report) + local timer = timers[instance or "notimer"] + local it = timer.timing + if it > 1 then + timer.timing = it - 1 + else + local starttime = timer.starttime + if starttime then + local stoptime = clock() + local loadtime = stoptime - starttime + timer.stoptime = stoptime + timer.loadtime = timer.loadtime + loadtime + if report then + statistics.report("load time %0.3f",loadtime) + end + timer.timing = 0 + return loadtime + end + end + return 0 +end + +local function elapsedtime(instance) + local timer = timers[instance or "notimer"] + return format("%0.3f",timer and timer.loadtime or 0) +end + +local function elapsedindeed(instance) + local timer = timers[instance or "notimer"] + return (timer and timer.loadtime or 0) > statistics.threshold +end + +local function elapsedseconds(instance,rest) -- returns nil if 0 seconds + if elapsedindeed(instance) then + return format("%s seconds %s", elapsedtime(instance),rest or "") + end +end + +statistics.hastiming = hastiming +statistics.resettiming = resettiming +statistics.starttiming = starttiming +statistics.stoptiming = stoptiming +statistics.elapsedtime = elapsedtime +statistics.elapsedindeed = elapsedindeed +statistics.elapsedseconds = elapsedseconds + +-- general function + +function statistics.register(tag,fnc) + if statistics.enable and type(fnc) == "function" then + local rt = registered[tag] or (#statusinfo + 1) + statusinfo[rt] = { tag, fnc } + registered[tag] = rt + if #tag > n then n = #tag end + end +end + +function statistics.show(reporter) + if statistics.enable then + if not reporter then reporter = function(tag,data,n) write_nl(tag .. " " .. data) end end + -- this code will move + local register = statistics.register + register("luatex banner", function() + return string.lower(status.banner) + end) + register("control sequences", function() + return format("%s of %s", status.cs_count, status.hash_size+status.hash_extra) + end) + register("callbacks", function() + local total, indirect = status.callbacks or 0, status.indirect_callbacks or 0 + return format("%s direct, %s indirect, %s total", total-indirect, indirect, total) + end) + collectgarbage("collect") + register("current memory usage", statistics.memused) + register("runtime",statistics.runtime) + for i=1,#statusinfo do + local s = statusinfo[i] + local r = s[2]() + if r then + reporter(s[1],r,n) + end + end + write_nl("") -- final newline + statistics.enable = false + end +end + +local template, report_statistics, nn = nil, nil, 0 -- we only calcute it once + +function statistics.showjobstat(tag,data,n) + if not logs then + -- sorry + elseif type(data) == "table" then + for i=1,#data do + statistics.showjobstat(tag,data[i],n) + end + else + if not template or n > nn then + template, n = format("%%-%ss - %%s",n), nn + report_statistics = logs.reporter("mkiv lua stats") + end + report_statistics(format(template,tag,data)) + end +end + +function statistics.memused() -- no math.round yet -) + local round = math.round or math.floor + return format("%s MB (ctx: %s MB)",round(collectgarbage("count")/1000), round(status.luastate_bytes/1000000)) +end + +starttiming(statistics) + +function statistics.formatruntime(runtime) -- indirect so it can be overloaded and + return format("%s seconds", runtime) -- indeed that happens in cure-uti.lua +end + +function statistics.runtime() + stoptiming(statistics) + return statistics.formatruntime(elapsedtime(statistics)) +end + +function statistics.timed(action,report) + report = report or logs.reporter("system") + starttiming("run") + action() + stoptiming("run") + report("total runtime: %s",elapsedtime("run")) +end + +-- where, not really the best spot for this: + +commands = commands or { } + +function commands.resettimer(name) + resettiming(name or "whatever") + starttiming(name or "whatever") +end + +function commands.elapsedtime(name) + stoptiming(name or "whatever") + tex.sprint(elapsedtime(name or "whatever")) +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['trac-set'] = { -- might become util-set.lua + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local type, next, tostring = type, next, tostring +local concat = table.concat +local format, find, lower, gsub, escapedpattern = string.format, string.find, string.lower, string.gsub, string.escapedpattern +local is_boolean = string.is_boolean +local settings_to_hash = utilities.parsers.settings_to_hash +local allocate = utilities.storage.allocate + +utilities = utilities or { } +local utilities = utilities +utilities.setters = utilities.setters or { } +local setters = utilities.setters + +local data = { } -- maybe just local + +-- We can initialize from the cnf file. This is sort of tricky as +-- later defined setters also need to be initialized then. If set +-- this way, we need to ensure that they are not reset later on. + +local trace_initialize = false -- only for testing during development + +function setters.initialize(filename,name,values) -- filename only for diagnostics + local setter = data[name] + if setter then + local data = setter.data + if data then + for key, value in next, values do + -- key = gsub(key,"_",".") + value = is_boolean(value,value) + local functions = data[key] + if functions then + if #functions > 0 and not functions.value then + if trace_initialize then + setter.report("executing %s (%s -> %s)",key,filename,tostring(value)) + end + for i=1,#functions do + functions[i](value) + end + functions.value = value + else + if trace_initialize then + setter.report("skipping %s (%s -> %s)",key,filename,tostring(value)) + end + end + else + -- we do a simple preregistration i.e. not in the + -- list as it might be an obsolete entry + functions = { default = value } + data[key] = functions + if trace_initialize then + setter.report("storing %s (%s -> %s)",key,filename,tostring(value)) + end + end + end + return true + end + end +end + +-- user interface code + +local function set(t,what,newvalue) + local data, done = t.data, t.done + if type(what) == "string" then + what = settings_to_hash(what) -- inefficient but ok + end + if type(what) ~= "table" then + return + end + for w, value in next, what do + if value == "" then + value = newvalue + elseif not value then + value = false -- catch nil + else + value = is_boolean(value,value) + end + w = "^" .. escapedpattern(w,true) .. "$" -- new: anchored + for name, functions in next, data do + if done[name] then + -- prevent recursion due to wildcards + elseif find(name,w) then + done[name] = true + for i=1,#functions do + functions[i](value) + end + functions.value = value + end + end + end +end + +local function reset(t) + for name, functions in next, t.data do + for i=1,#functions do + functions[i](false) + end + functions.value = false + end +end + +local function enable(t,what) + set(t,what,true) +end + +local function disable(t,what) + local data = t.data + if not what or what == "" then + t.done = { } + reset(t) + else + set(t,what,false) + end +end + +function setters.register(t,what,...) + local data = t.data + what = lower(what) + local functions = data[what] + if not functions then + functions = { } + data[what] = functions + if trace_initialize then + t.report("defining %s",what) + end + end + local default = functions.default -- can be set from cnf file + for _, fnc in next, { ... } do + local typ = type(fnc) + if typ == "string" then + if trace_initialize then + t.report("coupling %s to %s",what,fnc) + end + local s = fnc -- else wrong reference + fnc = function(value) set(t,s,value) end + elseif typ ~= "function" then + fnc = nil + end + if fnc then + functions[#functions+1] = fnc + -- default: set at command line or in cnf file + -- value : set in tex run (needed when loading runtime) + local value = functions.value or default + if value ~= nil then + fnc(value) + functions.value = value + end + end + end + return false -- so we can use it in an assignment +end + +function setters.enable(t,what) + local e = t.enable + t.enable, t.done = enable, { } + enable(t,what) + t.enable, t.done = e, { } +end + +function setters.disable(t,what) + local e = t.disable + t.disable, t.done = disable, { } + disable(t,what) + t.disable, t.done = e, { } +end + +function setters.reset(t) + t.done = { } + reset(t) +end + +function setters.list(t) -- pattern + local list = table.sortedkeys(t.data) + local user, system = { }, { } + for l=1,#list do + local what = list[l] + if find(what,"^%*") then system[#system+1] = what else - user[#user+1] = what + user[#user+1] = what + end + end + return user, system +end + +function setters.show(t) + local category = t.name + local list = setters.list(t) + t.report() + for k=1,#list do + local name = list[k] + local functions = t.data[name] + if functions then + local value, default, modules = functions.value, functions.default, #functions + value = value == nil and "unset" or tostring(value) + default = default == nil and "unset" or tostring(default) + t.report("%-30s modules: %2i default: %6s value: %6s",name,modules,default,value) + end + end + t.report() +end + +-- we could have used a bit of oo and the trackers:enable syntax but +-- there is already a lot of code around using the singular tracker + +-- we could make this into a module but we also want the rest avaliable + +local enable, disable, register, list, show = setters.enable, setters.disable, setters.register, setters.list, setters.show + +local function report(setter,...) + local report = logs and logs.report + if report then + report(setter.name,...) + else -- fallback, as this module is loaded before the logger + write_nl(format("%-15s : %s\n",setter.name,format(...))) + end +end + +function setters.new(name) + local setter -- we need to access it in setter itself + setter = { + data = allocate(), -- indexed, but also default and value fields + name = name, + report = function(...) report (setter,...) end, + enable = function(...) enable (setter,...) end, + disable = function(...) disable (setter,...) end, + register = function(...) register(setter,...) end, + list = function(...) list (setter,...) end, + show = function(...) show (setter,...) end, + } + data[name] = setter + return setter +end + +trackers = setters.new("trackers") +directives = setters.new("directives") +experiments = setters.new("experiments") + +local t_enable, t_disable, t_report = trackers .enable, trackers .disable, trackers .report +local d_enable, d_disable, d_report = directives .enable, directives .disable, directives .report +local e_enable, e_disable, e_report = experiments.enable, experiments.disable, experiments.report + +-- nice trick: we overload two of the directives related functions with variants that +-- do tracing (itself using a tracker) .. proof of concept + +local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end) +local trace_experiments = false local trace_experiments = false trackers.register("system.experiments", function(v) trace_experiments = v end) + +function directives.enable(...) + if trace_directives then + d_report("enabling: %s",concat({...}," ")) + end + d_enable(...) +end + +function directives.disable(...) + if trace_directives then + d_report("disabling: %s",concat({...}," ")) + end + d_disable(...) +end + +function experiments.enable(...) + if trace_experiments then + e_report("enabling: %s",concat({...}," ")) + end + e_enable(...) +end + +function experiments.disable(...) + if trace_experiments then + e_report("disabling: %s",concat({...}," ")) + end + e_disable(...) +end + +-- a useful example + +directives.register("system.nostatistics", function(v) + statistics.enable = not v +end) + +directives.register("system.nolibraries", function(v) + libraries = nil -- we discard this tracing for security +end) + +-- experiment + +local flags = environment and environment.engineflags + +if flags then + if trackers and flags.trackers then + setters.initialize("flags","trackers", settings_to_hash(flags.trackers)) + -- t_enable(flags.trackers) + end + if directives and flags.directives then + setters.initialize("flags","directives", settings_to_hash(flags.directives)) + -- d_enable(flags.directives) + end +end + +-- here + +if texconfig then + + local function set(k,v) + v = tonumber(v) + if v then + texconfig[k] = v + end + end + + directives.register("luatex.expanddepth", function(v) set("expand_depth",v) end) + directives.register("luatex.hashextra", function(v) set("hash_extra",v) end) + directives.register("luatex.nestsize", function(v) set("nest_size",v) end) + directives.register("luatex.maxinopen", function(v) set("max_in_open",v) end) + directives.register("luatex.maxprintline", function(v) set("max_print_line",v) end) + directives.register("luatex.maxstrings", function(v) set("max_strings",v) end) + directives.register("luatex.paramsize", function(v) set("param_size",v) end) + directives.register("luatex.savesize", function(v) set("save_size",v) end) + directives.register("luatex.stacksize", function(v) set("stack_size",v) end) + +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['trac-log'] = { + version = 1.001, + comment = "companion to trac-log.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- todo: less categories, more subcategories (e.g. nodes) + + +local write_nl, write = texio and texio.write_nl or print, texio and texio.write or io.write +local format, gmatch, find = string.format, string.gmatch, string.find +local concat, insert, remove = table.concat, table.insert, table.remove +local escapedpattern = string.escapedpattern +local texcount = tex and tex.count +local next, type = next, type + +local setmetatableindex = table.setmetatableindex + +--[[ldx-- +

This is a prelude to a more extensive logging module. We no longer +provide based logging a sparsing is relatively easy anyway.

+--ldx]]-- + +logs = logs or { } +local logs = logs + +local moreinfo = [[ +More information about ConTeXt and the tools that come with it can be found at: + +maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context +webpage : http://www.pragma-ade.nl / http://tex.aanhet.net +wiki : http://contextgarden.net +]] + +-- basic loggers + +local function ignore() end + +setmetatableindex(logs, function(t,k) t[k] = ignore ; return ignore end) + +local report, subreport, status, settarget, setformats, settranslations + +local direct, subdirect, writer, pushtarget, poptarget + +if tex and tex.jobname or tex.formatname then + + local valueiskey = { __index = function(t,k) t[k] = k return k end } -- will be helper + + local target = "term and log" + + logs.flush = io.flush + + local formats = { } setmetatable(formats, valueiskey) + local translations = { } setmetatable(translations,valueiskey) + + writer = function(...) + write_nl(target,...) + end + + report = function(a,b,c,...) + if c then + write_nl(target,format("%-15s > %s\n",translations[a],format(formats[b],c,...))) + elseif b then + write_nl(target,format("%-15s > %s\n",translations[a],formats[b])) + elseif a then + write_nl(target,format("%-15s >\n", translations[a])) + else + write_nl(target,"\n") + end + end + + direct = function(a,b,c,...) + if c then + return format("%-15s > %s",translations[a],format(formats[b],c,...)) + elseif b then + return format("%-15s > %s",translations[a],formats[b]) + elseif a then + return format("%-15s >", translations[a]) + else + return "" + end + end + + subreport = function(a,s,b,c,...) + if c then + write_nl(target,format("%-15s > %s > %s\n",translations[a],translations[s],format(formats[b],c,...))) + elseif b then + write_nl(target,format("%-15s > %s > %s\n",translations[a],translations[s],formats[b])) + elseif a then + write_nl(target,format("%-15s > %s >\n", translations[a],translations[s])) + else + write_nl(target,"\n") + end + end + + subdirect = function(a,s,b,c,...) + if c then + return format("%-15s > %s > %s",translations[a],translations[s],format(formats[b],c,...)) + elseif b then + return format("%-15s > %s > %s",translations[a],translations[s],formats[b]) + elseif a then + return format("%-15s > %s >", translations[a],translations[s]) + else + return "" + end + end + + status = function(a,b,c,...) + if c then + write_nl(target,format("%-15s : %s\n",translations[a],format(formats[b],c,...))) + elseif b then + write_nl(target,format("%-15s : %s\n",translations[a],formats[b])) + elseif a then + write_nl(target,format("%-15s :\n", translations[a])) + else + write_nl(target,"\n") + end + end + + local targets = { + logfile = "log", + log = "log", + file = "log", + console = "term", + terminal = "term", + both = "term and log", + } + + settarget = function(whereto) + target = targets[whereto or "both"] or targets.both + if target == "term" or target == "term and log" then + logs.flush = io.flush + else + logs.flush = ignore + end + end + + local stack = { } + + pushtarget = function(newtarget) + insert(stack,target) + settarget(newtarget) + end + + poptarget = function() + if #stack > 0 then + settarget(remove(stack)) + end + end + + setformats = function(f) + formats = f + end + + settranslations = function(t) + translations = t + end + +else + + logs.flush = ignore + + writer = write_nl + + report = function(a,b,c,...) + if c then + write_nl(format("%-15s | %s",a,format(b,c,...))) + elseif b then + write_nl(format("%-15s | %s",a,b)) + elseif a then + write_nl(format("%-15s |", a)) + else + write_nl("") + end + end + + subreport = function(a,sub,b,c,...) + if c then + write_nl(format("%-15s | %s | %s",a,sub,format(b,c,...))) + elseif b then + write_nl(format("%-15s | %s | %s",a,sub,b)) + elseif a then + write_nl(format("%-15s | %s |", a,sub)) + else + write_nl("") + end + end + + status = function(a,b,c,...) -- not to be used in lua anyway + if c then + write_nl(format("%-15s : %s\n",a,format(b,c,...))) + elseif b then + write_nl(format("%-15s : %s\n",a,b)) -- b can have %'s + elseif a then + write_nl(format("%-15s :\n", a)) + else + write_nl("\n") + end + end + + direct = ignore + subdirect = ignore + + settarget = ignore + pushtarget = ignore + poptarget = ignore + setformats = ignore + settranslations = ignore + +end + +logs.report = report +logs.subreport = subreport +logs.status = status +logs.settarget = settarget +logs.pushtarget = pushtarget +logs.poptarget = poptarget +logs.setformats = setformats +logs.settranslations = settranslations + +logs.direct = direct +logs.subdirect = subdirect +logs.writer = writer + +-- installer + +-- todo: renew (un) locks when a new one is added and wildcard + +local data, states = { }, nil + +function logs.reporter(category,subcategory) + local logger = data[category] + if not logger then + local state = false + if states == true then + state = true + elseif type(states) == "table" then + for c, _ in next, states do + if find(category,c) then + state = true + break + end + end + end + logger = { + reporters = { }, + state = state, + } + data[category] = logger + end + local reporter = logger.reporters[subcategory or "default"] + if not reporter then + if subcategory then + reporter = function(...) + if not logger.state then + subreport(category,subcategory,...) + end + end + logger.reporters[subcategory] = reporter + else + local tag = category + reporter = function(...) + if not logger.state then + report(category,...) + end + end + logger.reporters.default = reporter + end + end + return reporter +end + +logs.new = logs.reporter -- for old times sake + +-- context specicific: this ends up in the macro stream + +local ctxreport = logs.writer + +function logs.setmessenger(m) + ctxreport = m +end + +function logs.messenger(category,subcategory) + -- we need to avoid catcode mess (todo: fast context) + if subcategory then + return function(...) + ctxreport(subdirect(category,subcategory,...)) + end + else + return function(...) + ctxreport(direct(category,...)) + end + end +end + +-- so far + +local function setblocked(category,value) + if category == true then + -- lock all + category, value = "*", true + elseif category == false then + -- unlock all + category, value = "*", false + elseif value == nil then + -- lock selective + value = true + end + if category == "*" then + states = value + for k, v in next, data do + v.state = value + end + else + states = utilities.parsers.settings_to_hash(category) + for c, _ in next, states do + if data[c] then + v.state = value + else + c = escapedpattern(c,true) + for k, v in next, data do + if find(k,c) then + v.state = value + end + end + end + end + end +end + +function logs.disable(category,value) + setblocked(category,value == nil and true or value) +end + +function logs.enable(category) + setblocked(category,false) +end + +function logs.categories() + return table.sortedkeys(data) +end + +function logs.show() + local n, c, s, max = 0, 0, 0, 0 + for category, v in table.sortedpairs(data) do + n = n + 1 + local state = v.state + local reporters = v.reporters + local nc = #category + if nc > c then + c = nc + end + for subcategory, _ in next, reporters do + local ns = #subcategory + if ns > c then + s = ns + end + local m = nc + ns + if m > max then + max = m + end + end + local subcategories = concat(table.sortedkeys(reporters),", ") + if state == true then + state = "disabled" + elseif state == false then + state = "enabled" + else + state = "unknown" + end + -- no new here + report("logging","category: '%s', subcategories: '%s', state: '%s'",category,subcategories,state) + end + report("logging","categories: %s, max category: %s, max subcategory: %s, max combined: %s",n,c,s,max) +end + +directives.register("logs.blocked", function(v) + setblocked(v,true) +end) + +directives.register("logs.target", function(v) + settarget(v) +end) + +-- tex specific loggers (might move elsewhere) + +local report_pages = logs.reporter("pages") -- not needed but saves checking when we grep for it + +local real, user, sub + +function logs.start_page_number() + real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno +end + +function logs.stop_page_number() + if real > 0 then + if user > 0 then + if sub > 0 then + report_pages("flushing realpage %s, userpage %s, subpage %s",real,user,sub) + else + report_pages("flushing realpage %s, userpage %s",real,user) + end + else + report_pages("flushing realpage %s",real) + end + else + report_pages("flushing page") + end + logs.flush() +end + +logs.report_job_stat = statistics and statistics.showjobstat + +local report_files = logs.reporter("files") + +local nesting = 0 +local verbose = false +local hasscheme = url.hasscheme + +-- we don't have show_open and show_close callbacks yet + +function logs.show_open(name) + -- if hasscheme(name) ~= "virtual" then + -- if verbose then + -- nesting = nesting + 1 + -- report_files("level %s, opening %s",nesting,name) + -- else + -- write(format("(%s",name)) -- tex adds a space + -- end + -- end +end + +function logs.show_close(name) + -- if hasscheme(name) ~= "virtual" then + -- if verbose then + -- report_files("level %s, closing %s",nesting,name) + -- nesting = nesting - 1 + -- else + -- write(")") -- tex adds a space + -- end + -- end +end + +function logs.show_load(name) + -- if hasscheme(name) ~= "virtual" then + -- if verbose then + -- report_files("level %s, loading %s",nesting+1,name) + -- else + -- write(format("(%s)",name)) + -- end + -- end +end + +-- there may be scripts out there using this: + +local simple = logs.reporter("comment") + +logs.simple = simple +logs.simpleline = simple + +-- obsolete + +function logs.setprogram () end -- obsolete +function logs.extendbanner() end -- obsolete +function logs.reportlines () end -- obsolete +function logs.reportbanner() end -- obsolete +function logs.reportline () end -- obsolete +function logs.simplelines () end -- obsolete +function logs.help () end -- obsolete + +-- applications + +local function reportlines(t,str) + if str then + for line in gmatch(str,"(.-)[\n\r]") do + t.report(line) + end + end +end + +local function reportbanner(t) + local banner = t.banner + if banner then + t.report(banner) + t.report() + end +end + +local function reporthelp(t,...) + local helpinfo = t.helpinfo + if type(helpinfo) == "string" then + reportlines(t,helpinfo) + elseif type(helpinfo) == "table" then + local tags = { ... } + for i=1,#tags do + reportlines(t,t.helpinfo[tags[i]]) + if i < #tags then + t.report() + end + end + end +end + +local function reportinfo(t) + t.report() + reportlines(t,moreinfo) +end + +function logs.application(t) + t.name = t.name or "unknown" + t.banner = t.banner + t.report = logs.reporter(t.name) + t.help = function(...) reportbanner(t) ; reporthelp(t,...) ; reportinfo(t) end + t.identify = function() reportbanner(t) end + return t +end + +-- somewhat special + +-- logging to a file + + +function logs.system(whereto,process,jobname,category,...) + local message = format("%s %s => %s => %s => %s\r",os.date("%d/%m/%y %H:%m:%S"),process,jobname,category,format(...)) + for i=1,10 do + local f = io.open(whereto,"a") -- we can consider keepint the file open + if f then + f:write(message) + f:close() + break + else + sleep(0.1) + end + end +end + +local report_system = logs.reporter("system","logs") + +function logs.obsolete(old,new) + local o = loadstring("return " .. new)() + if type(o) == "function" then + return function(...) + report_system("function %s is obsolete, use %s",old,new) + loadstring(old .. "=" .. new .. " return ".. old)()(...) + end + elseif type(o) == "table" then + local t, m = { }, { } + m.__index = function(t,k) + report_system("table %s is obsolete, use %s",old,new) + m.__index, m.__newindex = o, o + return o[k] + end + m.__newindex = function(t,k,v) + report_system("table %s is obsolete, use %s",old,new) + m.__index, m.__newindex = o, o + o[k] = v + end + if libraries then + libraries.obsolete[old] = t -- true + end + setmetatable(t,m) + return t + end +end + +if utilities then + utilities.report = report_system +end + +if tex and tex.error then + function logs.texerrormessage(...) -- for the moment we put this function here + tex.error(format(...), { }) + end +else + function logs.texerrormessage(...) + print(format(...)) + end +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['trac-pro'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local getmetatable, setmetatable, rawset, type = getmetatable, setmetatable, rawset, type + +-- The protection implemented here is probably not that tight but good enough to catch +-- problems due to naive usage. +-- +-- There's a more extensive version (trac-xxx.lua) that supports nesting. +-- +-- This will change when we have _ENV in lua 5.2+ + +local trace_namespaces = false trackers.register("system.namespaces", function(v) trace_namespaces = v end) + +local report_system = logs.reporter("system","protection") + +namespaces = namespaces or { } +local namespaces = namespaces + +local registered = { } + +local function report_index(k,name) + if trace_namespaces then + report_system("reference to '%s' in protected namespace '%s', %s",k,name,debug.traceback()) + else + report_system("reference to '%s' in protected namespace '%s'",k,name) + end +end + +local function report_newindex(k,name) + if trace_namespaces then + report_system("assignment to '%s' in protected namespace '%s', %s",k,name,debug.traceback()) + else + report_system("assignment to '%s' in protected namespace '%s'",k,name) + end +end + +local function register(name) + local data = name == "global" and _G or _G[name] + if not data then + return -- error + end + registered[name] = data + local m = getmetatable(data) + if not m then + m = { } + setmetatable(data,m) + end + local index, newindex = { }, { } + m.__saved__index = m.__index + m.__no__index = function(t,k) + if not index[k] then + index[k] = true + report_index(k,name) + end + return nil + end + m.__saved__newindex = m.__newindex + m.__no__newindex = function(t,k,v) + if not newindex[k] then + newindex[k] = true + report_newindex(k,name) + end + rawset(t,k,v) + end + m.__protection__depth = 0 +end + +local function private(name) -- maybe save name + local data = registered[name] + if not data then + data = _G[name] + if not data then + data = { } + _G[name] = data + end + register(name) + end + return data +end + +local function protect(name) + local data = registered[name] + if not data then + return + end + local m = getmetatable(data) + local pd = m.__protection__depth + if pd > 0 then + m.__protection__depth = pd + 1 + else + m.__save_d_index, m.__saved__newindex = m.__index, m.__newindex + m.__index, m.__newindex = m.__no__index, m.__no__newindex + m.__protection__depth = 1 + end +end + +local function unprotect(name) + local data = registered[name] + if not data then + return + end + local m = getmetatable(data) + local pd = m.__protection__depth + if pd > 1 then + m.__protection__depth = pd - 1 + else + m.__index, m.__newindex = m.__saved__index, m.__saved__newindex + m.__protection__depth = 0 + end +end + +local function protectall() + for name, _ in next, registered do + if name ~= "global" then + protect(name) + end + end +end + +local function unprotectall() + for name, _ in next, registered do + if name ~= "global" then + unprotect(name) + end + end +end + +namespaces.register = register -- register when defined +namespaces.private = private -- allocate and register if needed +namespaces.protect = protect +namespaces.unprotect = unprotect +namespaces.protectall = protectall +namespaces.unprotectall = unprotectall + +namespaces.private("namespaces") registered = { } register("global") -- unreachable + +directives.register("system.protect", function(v) + if v then + protectall() + else + unprotectall() + end +end) + +directives.register("system.checkglobals", function(v) + if v then + report_system("enabling global namespace guard") + protect("global") + else + report_system("disabling global namespace guard") + unprotect("global") + end +end) + +-- dummy section (will go to luat-dum.lua) + + + + + + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['luat-env'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- A former version provided functionality for non embeded core +-- scripts i.e. runtime library loading. Given the amount of +-- Lua code we use now, this no longer makes sense. Much of this +-- evolved before bytecode arrays were available and so a lot of +-- code has disappeared already. + +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) + +local report_lua = logs.reporter("resolvers","lua") + +local allocate, mark = utilities.storage.allocate, utilities.storage.mark + +local format, sub, match, gsub, find = string.format, string.sub, string.match, string.gsub, string.find +local unquoted, quoted = string.unquoted, string.quoted +local concat = table.concat + +-- precautions + +os.setlocale(nil,nil) -- useless feature and even dangerous in luatex + +function os.setlocale() + -- no way you can mess with it +end + +-- dirty tricks + +if arg and (arg[0] == 'luatex' or arg[0] == 'luatex.exe') and arg[1] == "--luaonly" then + arg[-1] = arg[0] + arg[ 0] = arg[2] + for k=3,#arg do + arg[k-2] = arg[k] + end + arg[#arg] = nil -- last + arg[#arg] = nil -- pre-last +end + +-- environment + +environment = environment or { } +local environment = environment + +environment.arguments = allocate() +environment.files = allocate() +environment.sortedflags = nil + +local mt = { + __index = function(_,k) + if k == "version" then + local version = tex.toks and tex.toks.contextversiontoks + if version and version ~= "" then + rawset(environment,"version",version) + return version + else + return "unknown" + end + elseif k == "jobname" or k == "formatname" then + local name = tex and tex[k] + if name or name== "" then + rawset(environment,k,name) + return name + else + return "unknown" + end + elseif k == "outputfilename" then + local name = environment.jobname + rawset(environment,k,name) + return name + end + end +} + +setmetatable(environment,mt) + +function environment.initializearguments(arg) + local arguments, files = { }, { } + environment.arguments, environment.files, environment.sortedflags = arguments, files, nil + for index=1,#arg do + local argument = arg[index] + if index > 0 then + local flag, value = match(argument,"^%-+(.-)=(.-)$") + if flag then + arguments[flag] = unquoted(value or "") + else + flag = match(argument,"^%-+(.+)") + if flag then + arguments[flag] = true + else + files[#files+1] = argument + end + end + end + end + environment.ownname = environment.ownname or arg[0] or 'unknown.lua' +end + +function environment.setargument(name,value) + environment.arguments[name] = value +end + +-- todo: defaults, better checks e.g on type (boolean versus string) +-- +-- tricky: too many hits when we support partials unless we add +-- a registration of arguments so from now on we have 'partial' + +function environment.argument(name,partial) + local arguments, sortedflags = environment.arguments, environment.sortedflags + if arguments[name] then + return arguments[name] + elseif partial then + if not sortedflags then + sortedflags = allocate(table.sortedkeys(arguments)) + for k=1,#sortedflags do + sortedflags[k] = "^" .. sortedflags[k] + end + environment.sortedflags = sortedflags + end + -- example of potential clash: ^mode ^modefile + for k=1,#sortedflags do + local v = sortedflags[k] + if find(name,v) then + return arguments[sub(v,2,#v)] + end end end - return user, system + return nil end -function setters.show(t) - commands.writestatus("","") - local list = setters.list(t) - for k=1,#list do - commands.writestatus(t.name,list[k]) +function environment.splitarguments(separator) -- rather special, cut-off before separator + local done, before, after = false, { }, { } + local originalarguments = environment.originalarguments + for k=1,#originalarguments do + local v = originalarguments[k] + if not done and v == separator then + done = true + elseif done then + after[#after+1] = v + else + before[#before+1] = v + end end - commands.writestatus("","") + return before, after end --- we could have used a bit of oo and the trackers:enable syntax but --- there is already a lot of code around using the singular tracker +function environment.reconstructcommandline(arg,noquote) + arg = arg or environment.originalarguments + if noquote and #arg == 1 then + -- we could just do: return unquoted(resolvers.resolve(arg[i])) + local a = arg[1] + a = resolvers.resolve(a) + a = unquoted(a) + return a + elseif #arg > 0 then + local result = { } + for i=1,#arg do + -- we could just do: result[#result+1] = format("%q",unquoted(resolvers.resolve(arg[i]))) + local a = arg[i] + a = resolvers.resolve(a) + a = unquoted(a) + a = gsub(a,'"','\\"') -- tricky + if find(a," ") then + result[#result+1] = quoted(a) + else + result[#result+1] = a + end + end + return concat(result," ") + else + return "" + end +end --- we could make this into a module -function setters.new(name) - local t - t = { - data = { }, - name = name, - enable = function(...) setters.enable (t,...) end, - disable = function(...) setters.disable (t,...) end, - register = function(...) setters.register(t,...) end, - list = function(...) setters.list (t,...) end, - show = function(...) setters.show (t,...) end, - } - setters.data[name] = t - return t -end +if arg then -trackers = setters.new("trackers") -directives = setters.new("directives") -experiments = setters.new("experiments") + -- new, reconstruct quoted snippets (maybe better just remove the " then and add them later) + local newarg, instring = { }, false --- nice trick: we overload two of the directives related functions with variants that --- do tracing (itself using a tracker) .. proof of concept + for index=1,#arg do + local argument = arg[index] + if find(argument,"^\"") then + newarg[#newarg+1] = gsub(argument,"^\"","") + if not find(argument,"\"$") then + instring = true + end + elseif find(argument,"\"$") then + newarg[#newarg] = newarg[#newarg] .. " " .. gsub(argument,"\"$","") + instring = false + elseif instring then + newarg[#newarg] = newarg[#newarg] .. " " .. argument + else + newarg[#newarg+1] = argument + end + end + for i=1,-5,-1 do + newarg[i] = arg[i] + end -local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end) -local trace_experiments = false local trace_experiments = false trackers.register("system.experiments", function(v) trace_experiments = v end) + environment.initializearguments(newarg) -local e = directives.enable -local d = directives.disable + environment.originalarguments = mark(newarg) + environment.rawarguments = mark(arg) -function directives.enable(...) - commands.writestatus("directives","enabling: %s",concat({...}," ")) - e(...) -end + arg = { } -- prevent duplicate handling -function directives.disable(...) - commands.writestatus("directives","disabling: %s",concat({...}," ")) - d(...) end -local e = experiments.enable -local d = experiments.disable +-- weird place ... depends on a not yet loaded module -function experiments.enable(...) - commands.writestatus("experiments","enabling: %s",concat({...}," ")) - e(...) +function environment.texfile(filename) + return resolvers.findfile(filename,'tex') end -function experiments.disable(...) - commands.writestatus("experiments","disabling: %s",concat({...}," ")) - d(...) +function environment.luafile(filename) + local resolved = resolvers.findfile(filename,'tex') or "" + if resolved ~= "" then + return resolved + end + resolved = resolvers.findfile(filename,'texmfscripts') or "" + if resolved ~= "" then + return resolved + end + return resolvers.findfile(filename,'luatexlibs') or "" end --- a useful example +environment.loadedluacode = loadfile -- can be overloaded -directives.register("system.nostatistics", function(v) - statistics.enable = not v -end) +function environment.luafilechunk(filename,silent) -- used for loading lua bytecode in the format + filename = file.replacesuffix(filename, "lua") + local fullname = environment.luafile(filename) + if fullname and fullname ~= "" then + local data = environment.loadedluacode(fullname) + if trace_locating then + report_lua("loading file %s%s", fullname, not data and " failed" or "") + elseif not silent then + texio.write("<",data and "+ " or "- ",fullname,">") + end + return data + else + if trace_locating then + report_lua("unknown file %s", filename) + end + return nil + end +end + +-- the next ones can use the previous ones / combine +function environment.loadluafile(filename, version) + local lucname, luaname, chunk + local basename = file.removesuffix(filename) + if basename == filename then + lucname, luaname = basename .. ".luc", basename .. ".lua" + else + lucname, luaname = nil, basename -- forced suffix + end + -- when not overloaded by explicit suffix we look for a luc file first + local fullname = (lucname and environment.luafile(lucname)) or "" + if fullname ~= "" then + if trace_locating then + report_lua("loading %s", fullname) + end + chunk = loadfile(fullname) -- this way we don't need a file exists check + end + if chunk then + assert(chunk)() + if version then + -- we check of the version number of this chunk matches + local v = version -- can be nil + if modules and modules[filename] then + v = modules[filename].version -- new method + elseif versions and versions[filename] then + v = versions[filename] -- old method + end + if v == version then + return true + else + if trace_locating then + report_lua("version mismatch for %s: lua=%s, luc=%s", filename, v, version) + end + environment.loadluafile(filename) + end + else + return true + end + end + fullname = (luaname and environment.luafile(luaname)) or "" + if fullname ~= "" then + if trace_locating then + report_lua("loading %s", fullname) + end + chunk = loadfile(fullname) -- this way we don't need a file exists check + if not chunk then + if trace_locating then + report_lua("unknown file %s", filename) + end + else + assert(chunk)() + return true + end + end + return false +end end -- of closure @@ -3991,6 +6263,8 @@ if not modules then modules = { } end modules ['lxml-tab'] = { local trace_entities = false trackers.register("xml.entities", function(v) trace_entities = v end) +local report_xml = logs and logs.reporter("xml","core") or function(...) print(format(...)) end + --[[ldx--

The parser used here is inspired by the variant discussed in the lua book, but handles comment and processing instructions, has a different structure, provides @@ -4001,11 +6275,15 @@ The find based parser can be found in l-xml-edu.lua along with other older code.

Beware, the interface may change. For instance at, ns, tg, dt may get more verbose names. Once the code is stable we will also remove some tracing and optimize the code.

+ +

I might even decide to reimplement the parser using the latest trickery +as the current variant was written when showed up and it's easier now to +build tables in one go.

--ldx]]-- xml = xml or { } +local xml = xml ---~ local xml = xml local concat, remove, insert = table.concat, table.remove, table.insert local type, next, setmetatable, getmetatable, tonumber = type, next, setmetatable, getmetatable, tonumber @@ -4129,7 +6407,7 @@ local dcache, hcache, acache = { }, { }, { } local mt = { } -function initialize_mt(root) +local function initialize_mt(root) mt = { __index = root } -- will be redefined later end @@ -4137,8 +6415,8 @@ function xml.setproperty(root,k,v) getmetatable(root).__index[k] = v end -function xml.check_error(top,toclose) - return "" +function xml.checkerror(top,toclose) + return "" -- can be set end local function add_attribute(namespace,tag,value) @@ -4194,9 +6472,9 @@ local function add_end(spacing, namespace, tag) local toclose = remove(stack) top = stack[#stack] if #stack < 1 then - errorstr = format("nothing to close with %s %s", tag, xml.check_error(top,toclose) or "") + errorstr = format("nothing to close with %s %s", tag, xml.checkerror(top,toclose) or "") elseif toclose.tg ~= tag then -- no namespace check - errorstr = format("unable to close %s with %s %s", toclose.tg, tag, xml.check_error(top,toclose) or "") + errorstr = format("unable to close %s with %s %s", toclose.tg, tag, xml.checkerror(top,toclose) or "") end dt = top.dt dt[#dt+1] = toclose @@ -4233,24 +6511,29 @@ local reported_attribute_errors = { } local function attribute_value_error(str) if not reported_attribute_errors[str] then - logs.report("xml","invalid attribute value: %q",str) + report_xml("invalid attribute value: %q",str) reported_attribute_errors[str] = true at._error_ = str end return str end + local function attribute_specification_error(str) if not reported_attribute_errors[str] then - logs.report("xml","invalid attribute specification: %q",str) + report_xml("invalid attribute specification: %q",str) reported_attribute_errors[str] = true at._error_ = str end return str end -function xml.unknown_dec_entity_format(str) return (str == "" and "&error;") or format("&%s;",str) end -function xml.unknown_hex_entity_format(str) return format("&#x%s;",str) end -function xml.unknown_any_entity_format(str) return format("&#x%s;",str) end +xml.placeholders = { + unknown_dec_entity = function(str) return (str == "" and "&error;") or format("&%s;",str) end, + unknown_hex_entity = function(str) return format("&#x%s;",str) end, + unknown_any_entity = function(str) return format("&#x%s;",str) end, +} + +local placeholders = xml.placeholders local function fromhex(s) local n = tonumber(s,16) @@ -4304,18 +6587,18 @@ local function handle_hex_entity(str) h = unify_predefined and predefined_unified[n] if h then if trace_entities then - logs.report("xml","utfize, converting hex entity &#x%s; into %s",str,h) + report_xml("utfize, converting hex entity &#x%s; into %s",str,h) end elseif utfize then - h = (n and utfchar(n)) or xml.unknown_hex_entity_format(str) or "" + h = (n and utfchar(n)) or xml.unknown_hex_entity(str) or "" if not n then - logs.report("xml","utfize, ignoring hex entity &#x%s;",str) + report_xml("utfize, ignoring hex entity &#x%s;",str) elseif trace_entities then - logs.report("xml","utfize, converting hex entity &#x%s; into %s",str,h) + report_xml("utfize, converting hex entity &#x%s; into %s",str,h) end else if trace_entities then - logs.report("xml","found entity &#x%s;",str) + report_xml("found entity &#x%s;",str) end h = "&#x" .. str .. ";" end @@ -4331,18 +6614,18 @@ local function handle_dec_entity(str) d = unify_predefined and predefined_unified[n] if d then if trace_entities then - logs.report("xml","utfize, converting dec entity &#%s; into %s",str,d) + report_xml("utfize, converting dec entity &#%s; into %s",str,d) end elseif utfize then - d = (n and utfchar(n)) or xml.unknown_dec_entity_format(str) or "" + d = (n and utfchar(n)) or placeholders.unknown_dec_entity(str) or "" if not n then - logs.report("xml","utfize, ignoring dec entity &#%s;",str) + report_xml("utfize, ignoring dec entity &#%s;",str) elseif trace_entities then - logs.report("xml","utfize, converting dec entity &#%s; into %s",str,h) + report_xml("utfize, converting dec entity &#%s; into %s",str,h) end else if trace_entities then - logs.report("xml","found entity &#%s;",str) + report_xml("found entity &#%s;",str) end d = "&#" .. str .. ";" end @@ -4367,20 +6650,21 @@ local function handle_any_entity(str) end if a then if trace_entities then - logs.report("xml","resolved entity &%s; -> %s (internal)",str,a) + report_xml("resolved entity &%s; -> %s (internal)",str,a) end a = lpegmatch(parsedentity,a) or a else - if xml.unknown_any_entity_format then - a = xml.unknown_any_entity_format(str) or "" + local unknown_any_entity = placeholders.unknown_any_entity + if unknown_any_entity then + a = unknown_any_entity(str) or "" end if a then if trace_entities then - logs.report("xml","resolved entity &%s; -> %s (external)",str,a) + report_xml("resolved entity &%s; -> %s (external)",str,a) end else if trace_entities then - logs.report("xml","keeping entity &%s;",str) + report_xml("keeping entity &%s;",str) end if str == "" then a = "&error;" @@ -4392,7 +6676,7 @@ local function handle_any_entity(str) acache[str] = a elseif trace_entities then if not acache[str] then - logs.report("xml","converting entity &%s; into %s",str,a) + report_xml("converting entity &%s; into %s",str,a) acache[str] = a end end @@ -4401,7 +6685,7 @@ local function handle_any_entity(str) local a = acache[str] if not a then if trace_entities then - logs.report("xml","found entity &%s;",str) + report_xml("found entity &%s;",str) end a = resolve_predefined and predefined_simplified[str] if a then @@ -4420,7 +6704,7 @@ local function handle_any_entity(str) end local function handle_end_entity(chr) - logs.report("xml","error in entity, %q found instead of ';'",chr) + report_xml("error in entity, %q found instead of ';'",chr) end local space = S(' \r\n\t') @@ -4555,7 +6839,7 @@ local function xmlconvert(data, settings) resolve_predefined = settings.resolve_predefined_entities -- in case we have escaped entities unify_predefined = settings.unify_predefined_entities -- & -> & cleanup = settings.text_cleanup - stack, top, at, xmlns, errorstr, result, entities = { }, { }, { }, { }, nil, nil, settings.entities or { } + stack, top, at, xmlns, errorstr, entities = { }, { }, { }, { }, nil, settings.entities or { } acache, hcache, dcache = { }, { }, { } -- not stored reported_attribute_errors = { } if settings.parent_root then @@ -4583,16 +6867,17 @@ local function xmlconvert(data, settings) else errorstr = "invalid xml file - no text at all" end + local result if errorstr and errorstr ~= "" then result = { dt = { { ns = "", tg = "error", dt = { errorstr }, at={ }, er = true } } } setmetatable(stack, mt) - local error_handler = settings.error_handler - if error_handler == false then + local errorhandler = settings.error_handler + if errorhandler == false then -- no error message else - error_handler = error_handler or xml.error_handler - if error_handler then - xml.error_handler("load",errorstr) + errorhandler = errorhandler or xml.errorhandler + if errorhandler then + xml.errorhandler("load",errorstr) end end else @@ -4652,7 +6937,7 @@ function xml.is_valid(root) return root and not root.error end -xml.error_handler = (logs and logs.report) or (input and logs.report) or print +xml.errorhandler = report --[[ldx--

We cannot load an from a filehandle so we need to load @@ -4763,7 +7048,7 @@ local function verbose_element(e,handlers) ats[#ats+1] = format('%s=%q',k,v) end end - if ern and trace_remap and ern ~= ens then + if ern and trace_entities and ern ~= ens then ens = ern end if ens ~= "" then @@ -4868,7 +7153,7 @@ local function serialize(e,handlers,...) -- elseif type(e) == "string" then -- functions["@tx@"](e,handlers) else - functions["@dc@"](e,handlers) + functions["@dc@"](e,handlers) -- dc ? end if finalize then return finalize() @@ -4894,7 +7179,7 @@ local function newhandlers(settings) if settings then for k,v in next, settings do if type(v) == "table" then - tk = t[k] if not tk then tk = { } t[k] = tk end + local tk = t[k] if not tk then tk = { } t[k] = tk end for kk,vv in next, v do tk[kk] = vv end @@ -4906,6 +7191,7 @@ local function newhandlers(settings) handlers[settings.name] = t end end + utilities.storage.mark(t) return t end @@ -5005,7 +7291,7 @@ local function xmltext(root) -- inline return (root and xmltostring(root)) or "" end -function initialize_mt(root) +initialize_mt = function(root) -- redefinition mt = { __tostring = xmltext, __index = root } end @@ -5040,7 +7326,6 @@ xml.string = xmlstring

A few helpers:

--ldx]]-- ---~ xmlsetproperty(root,"settings",settings) function xml.settings(e) while e do @@ -5150,6 +7435,7 @@ function xml.makestandalone(root) end end end + return root end @@ -5166,11 +7452,14 @@ if not modules then modules = { } end modules ['lxml-pth'] = { } -- e.ni is only valid after a filter run +-- todo: B/C/[get first match] local concat, remove, insert = table.concat, table.remove, table.insert local type, next, tonumber, tostring, setmetatable, loadstring = type, next, tonumber, tostring, setmetatable, loadstring local format, upper, lower, gmatch, gsub, find, rep = string.format, string.upper, string.lower, string.gmatch, string.gsub, string.find, string.rep -local lpegmatch = lpeg.match +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns + +local setmetatableindex = table.setmetatableindex -- beware, this is not xpath ... e.g. position is different (currently) and -- we have reverse-sibling as reversed preceding sibling @@ -5202,23 +7491,33 @@ local trace_lpath = false if trackers then trackers.register("xml.path", local trace_lparse = false if trackers then trackers.register("xml.parse", function(v) trace_lparse = v end) end local trace_lprofile = false if trackers then trackers.register("xml.profile", function(v) trace_lpath = v trace_lparse = v trace_lprofile = v end) end +local report_lpath = logs.reporter("xml","lpath") + --[[ldx--

We've now arrived at an interesting part: accessing the tree using a subset of and since we're not compatible we call it . We will explain more about its usage in other documents.

--ldx]]-- +local xml = xml + local lpathcalls = 0 function xml.lpathcalls () return lpathcalls end local lpathcached = 0 function xml.lpathcached() return lpathcached end -xml.functions = xml.functions or { } -- internal -xml.expressions = xml.expressions or { } -- in expressions -xml.finalizers = xml.finalizers or { } -- fast do-with ... (with return value other than collection) -xml.specialhandler = xml.specialhandler or { } +xml.functions = xml.functions or { } -- internal +local functions = xml.functions + +xml.expressions = xml.expressions or { } -- in expressions +local expressions = xml.expressions + +xml.finalizers = xml.finalizers or { } -- fast do-with ... (with return value other than collection) +local finalizers = xml.finalizers -local functions = xml.functions -local expressions = xml.expressions -local finalizers = xml.finalizers +xml.specialhandler = xml.specialhandler or { } +local specialhandler = xml.specialhandler + +lpegpatterns.xml = lpegpatterns.xml or { } +local xmlpatterns = lpegpatterns.xml finalizers.xml = finalizers.xml or { } finalizers.tex = finalizers.tex or { } @@ -5228,14 +7527,14 @@ local function fallback (t, name) if fn then t[name] = fn else - logs.report("xml","unknown sub finalizer '%s'",tostring(name)) + report_lpath("unknown sub finalizer '%s'",tostring(name)) fn = function() end end return fn end -setmetatable(finalizers.xml, { __index = fallback }) -setmetatable(finalizers.tex, { __index = fallback }) +setmetatableindex(finalizers.xml, fallback) +setmetatableindex(finalizers.tex, fallback) xml.defaultprotocol = "xml" @@ -5283,102 +7582,106 @@ apply_axis['root'] = function(list) rt = ll end end - collected[#collected+1] = rt + collected[l] = rt end return collected end apply_axis['self'] = function(list) ---~ local collected = { } ---~ for l=1,#list do ---~ collected[#collected+1] = list[l] ---~ end ---~ return collected return list end apply_axis['child'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local dt = ll.dt - local en = 0 - for k=1,#dt do - local dk = dt[k] - if dk.tg then - collected[#collected+1] = dk - dk.ni = k -- refresh - en = en + 1 - dk.ei = en + if dt then -- weird that this is needed + local en = 0 + for k=1,#dt do + local dk = dt[k] + if dk.tg then + c = c + 1 + collected[c] = dk + dk.ni = k -- refresh + en = en + 1 + dk.ei = en + end end + ll.en = en end - ll.en = en end return collected end -local function collect(list,collected) +local function collect(list,collected,c) local dt = list.dt if dt then local en = 0 for k=1,#dt do local dk = dt[k] if dk.tg then - collected[#collected+1] = dk + c = c + 1 + collected[c] = dk dk.ni = k -- refresh en = en + 1 dk.ei = en - collect(dk,collected) + c = collect(dk,collected,c) end end list.en = en end + return c end apply_axis['descendant'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do - collect(list[l],collected) + c = collect(list[l],collected,c) end return collected end -local function collect(list,collected) +local function collect(list,collected,c) local dt = list.dt if dt then local en = 0 for k=1,#dt do local dk = dt[k] if dk.tg then - collected[#collected+1] = dk + c = c + 1 + collected[c] = dk dk.ni = k -- refresh en = en + 1 dk.ei = en - collect(dk,collected) + c = collect(dk,collected,c) end end list.en = en end + return c end apply_axis['descendant-or-self'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] if ll.special ~= true then -- catch double root - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end - collect(ll,collected) + c = collect(ll,collected,c) end return collected end apply_axis['ancestor'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] while ll do ll = ll.__p__ if ll then - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end end end @@ -5386,14 +7689,16 @@ apply_axis['ancestor'] = function(list) end apply_axis['ancestor-or-self'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll while ll do ll = ll.__p__ if ll then - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end end end @@ -5401,11 +7706,12 @@ apply_axis['ancestor-or-self'] = function(list) end apply_axis['parent'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local pl = list[l].__p__ if pl then - collected[#collected+1] = pl + c = c + 1 + collected[c] = pl end end return collected @@ -5420,43 +7726,15 @@ apply_axis['namespace'] = function(list) end apply_axis['following'] = function(list) -- incomplete ---~ local collected = { } ---~ for l=1,#list do ---~ local ll = list[l] ---~ local p = ll.__p__ ---~ local d = p.dt ---~ for i=ll.ni+1,#d do ---~ local di = d[i] ---~ if type(di) == "table" then ---~ collected[#collected+1] = di ---~ break ---~ end ---~ end ---~ end ---~ return collected return { } end apply_axis['preceding'] = function(list) -- incomplete ---~ local collected = { } ---~ for l=1,#list do ---~ local ll = list[l] ---~ local p = ll.__p__ ---~ local d = p.dt ---~ for i=ll.ni-1,1,-1 do ---~ local di = d[i] ---~ if type(di) == "table" then ---~ collected[#collected+1] = di ---~ break ---~ end ---~ end ---~ end ---~ return collected return { } end apply_axis['following-sibling'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local p = ll.__p__ @@ -5464,7 +7742,8 @@ apply_axis['following-sibling'] = function(list) for i=ll.ni+1,#d do local di = d[i] if type(di) == "table" then - collected[#collected+1] = di + c = c + 1 + collected[c] = di end end end @@ -5472,7 +7751,7 @@ apply_axis['following-sibling'] = function(list) end apply_axis['preceding-sibling'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local p = ll.__p__ @@ -5480,7 +7759,8 @@ apply_axis['preceding-sibling'] = function(list) for i=1,ll.ni-1 do local di = d[i] if type(di) == "table" then - collected[#collected+1] = di + c = c + 1 + collected[c] = di end end end @@ -5488,7 +7768,7 @@ apply_axis['preceding-sibling'] = function(list) end apply_axis['reverse-sibling'] = function(list) -- reverse preceding - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local p = ll.__p__ @@ -5496,7 +7776,8 @@ apply_axis['reverse-sibling'] = function(list) -- reverse preceding for i=ll.ni-1,1,-1 do local di = d[i] if type(di) == "table" then - collected[#collected+1] = di + c = c + 1 + collected[c] = di end end end @@ -5522,7 +7803,7 @@ local function apply_nodes(list,directive,nodes) return { } end else - local collected, m, p = { }, 0, nil + local collected, c, m, p = { }, 0, 0, nil if not nns then -- only check tag for l=1,#list do local ll = list[l] @@ -5531,11 +7812,13 @@ local function apply_nodes(list,directive,nodes) if directive then if ntg == ltg then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif ntg ~= ltg then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -5547,11 +7830,13 @@ local function apply_nodes(list,directive,nodes) if directive then if lns == nns then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif lns ~= nns then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -5565,11 +7850,13 @@ local function apply_nodes(list,directive,nodes) if directive then if ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif not ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -5577,7 +7864,7 @@ local function apply_nodes(list,directive,nodes) return collected end else - local collected, m, p = { }, 0, nil + local collected, c, m, p = { }, 0, 0, nil for l=1,#list do local ll = list[l] local ltg = ll.tg @@ -5594,11 +7881,13 @@ local function apply_nodes(list,directive,nodes) if directive then if ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif not ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -5609,12 +7898,13 @@ end local quit_expression = false local function apply_expression(list,expression,order) - local collected = { } + local collected, c = { }, 0 quit_expression = false for l=1,#list do local ll = list[l] if expression(list,ll,l,order) then -- nasty, order alleen valid als n=1 - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end if quit_expression then break @@ -5653,7 +7943,9 @@ local lp_builtin = P ( P("ns") / "ll.ns" ) * ((spaces * P("(") * spaces * P(")"))/"") -local lp_attribute = (P("@") + P("attribute::")) / "" * Cc("(ll.at and ll.at['") * R("az","AZ","--","__")^1 * Cc("'])") +-- for the moment we keep namespaces with attributes + +local lp_attribute = (P("@") + P("attribute::")) / "" * Cc("(ll.at and ll.at['") * ((R("az","AZ") + S("-_:"))^1) * Cc("'])") local lp_fastpos_p = ((P("+")^0 * R("09")^1 * P(-1)) / function(s) return "l==" .. s end) local lp_fastpos_n = ((P("-") * R("09")^1 * P(-1)) / function(s) return "(" .. s .. "<0 and (#list+".. s .. "==l))" end) local lp_fastpos = lp_fastpos_n + lp_fastpos_p @@ -5714,14 +8006,12 @@ local converter = Cs ( ) cleaner = Cs ( ( ---~ lp_fastpos + lp_reserved + lp_number + lp_string + 1 )^1 ) ---~ expr local template_e = [[ local expr = xml.expressions @@ -5772,13 +8062,13 @@ local skip = { } local function errorrunner_e(str,cnv) if not skip[str] then - logs.report("lpath","error in expression: %s => %s",str,cnv) + report_lpath("error in expression: %s => %s",str,cnv) skip[str] = cnv or str end return false end local function errorrunner_f(str,arg) - logs.report("lpath","error in finalizer: %s(%s)",str,arg or "") + report_lpath("error in finalizer: %s(%s)",str,arg or "") return false end @@ -5829,7 +8119,7 @@ local special_1 = P("*") * Cc(register_auto_descendant) * Cc(register_all_nodes local special_2 = P("/") * Cc(register_auto_self) local special_3 = P("") * Cc(register_auto_self) -local parser = Ct { "patterns", -- can be made a bit faster by moving pattern outside +local pathparser = Ct { "patterns", -- can be made a bit faster by moving pattern outside patterns = spaces * V("protocol") * spaces * ( ( V("special") * spaces * P(-1) ) + @@ -5901,6 +8191,8 @@ local parser = Ct { "patterns", -- can be made a bit faster by moving pattern ou } +xmlpatterns.pathparser = pathparser + local cache = { } local function nodesettostring(set,nodetest) @@ -5910,7 +8202,7 @@ local function nodesettostring(set,nodetest) if not ns or ns == "" then ns = "*" end if not tg or tg == "" then tg = "*" end tg = (tg == "@rt@" and "[root]") or format("%s:%s",ns,tg) - t[#t+1] = (directive and tg) or format("not(%s)",tg) + t[i] = (directive and tg) or format("not(%s)",tg) end if nodetest == false then return format("not(%s)",concat(t,"|")) @@ -5929,7 +8221,7 @@ local function tagstostring(list) local ns, tg = li.ns, li.tg if not ns or ns == "" then ns = "*" end if not tg or tg == "" then tg = "*" end - t[#t+1] = (tg == "@rt@" and "[root]") or format("%s:%s",ns,tg) + t[i] = (tg == "@rt@" and "[root]") or format("%s:%s",ns,tg) end return concat(t," ") end @@ -5937,16 +8229,16 @@ end xml.nodesettostring = nodesettostring -local parse_pattern -- we have a harmless kind of circular reference +local lpath -- we have a harmless kind of circular reference + +local lshowoptions = { functions = false } local function lshow(parsed) if type(parsed) == "string" then - parsed = parse_pattern(parsed) + parsed = lpath(parsed) end - local s = table.serialize_functions -- ugly - table.serialize_functions = false -- ugly - logs.report("lpath","%s://%s => %s",parsed.protocol or xml.defaultprotocol,parsed.pattern,table.serialize(parsed,false)) - table.serialize_functions = s -- ugly + report_lpath("%s://%s => %s",parsed.protocol or xml.defaultprotocol,parsed.pattern, + table.serialize(parsed,false,lshowoptions)) end xml.lshow = lshow @@ -5960,7 +8252,7 @@ local function add_comment(p,str) end end -parse_pattern = function (pattern) -- the gain of caching is rather minimal +lpath = function (pattern) -- the gain of caching is rather minimal lpathcalls = lpathcalls + 1 if type(pattern) == "table" then return pattern @@ -5969,13 +8261,13 @@ parse_pattern = function (pattern) -- the gain of caching is rather minimal if parsed then lpathcached = lpathcached + 1 else - parsed = lpegmatch(parser,pattern) + parsed = lpegmatch(pathparser,pattern) if parsed then parsed.pattern = pattern local np = #parsed if np == 0 then parsed = { pattern = pattern, register_self, state = "parsing error" } - logs.report("lpath","parsing error in '%s'",pattern) + report_lpath("parsing error in '%s'",pattern) lshow(parsed) else -- we could have done this with a more complex parser but this @@ -6017,6 +8309,8 @@ parse_pattern = function (pattern) -- the gain of caching is rather minimal end end +xml.lpath = lpath + -- we can move all calls inline and then merge the trace back -- technically we can combine axis and the next nodes which is -- what we did before but this a bit cleaner (but slower too) @@ -6079,32 +8373,32 @@ local function traced_apply(list,parsed,nofparsed,order) if trace_lparse then lshow(parsed) end - logs.report("lpath", "collecting : %s",parsed.pattern) - logs.report("lpath", " root tags : %s",tagstostring(list)) - logs.report("lpath", " order : %s",order or "unset") + report_lpath("collecting: %s",parsed.pattern) + report_lpath("root tags : %s",tagstostring(list)) + report_lpath("order : %s",order or "unset") local collected = list for i=1,nofparsed do local pi = parsed[i] local kind = pi.kind if kind == "axis" then collected = apply_axis[pi.axis](collected) - logs.report("lpath", "% 10i : ax : %s",(collected and #collected) or 0,pi.axis) + report_lpath("% 10i : ax : %s",(collected and #collected) or 0,pi.axis) elseif kind == "nodes" then collected = apply_nodes(collected,pi.nodetest,pi.nodes) - logs.report("lpath", "% 10i : ns : %s",(collected and #collected) or 0,nodesettostring(pi.nodes,pi.nodetest)) + report_lpath("% 10i : ns : %s",(collected and #collected) or 0,nodesettostring(pi.nodes,pi.nodetest)) elseif kind == "expression" then collected = apply_expression(collected,pi.evaluator,order) - logs.report("lpath", "% 10i : ex : %s -> %s",(collected and #collected) or 0,pi.expression,pi.converted) + report_lpath("% 10i : ex : %s -> %s",(collected and #collected) or 0,pi.expression,pi.converted) elseif kind == "finalizer" then collected = pi.finalizer(collected) - logs.report("lpath", "% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pi.name,pi.arguments or "") + report_lpath("% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pi.name,pi.arguments or "") return collected end if not collected or #collected == 0 then local pn = i < nofparsed and parsed[nofparsed] if pn and pn.kind == "finalizer" then collected = pn.finalizer(collected) - logs.report("lpath", "% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pn.name,pn.arguments or "") + report_lpath("% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pn.name,pn.arguments or "") return collected end return nil @@ -6141,8 +8435,11 @@ local function normal_apply(list,parsed,nofparsed,order) return collected end -local function parse_apply(list,pattern) - -- we avoid an extra call + +local function applylpath(list,pattern) + if not list then + return + end local parsed = cache[pattern] if parsed then lpathcalls = lpathcalls + 1 @@ -6151,7 +8448,7 @@ local function parse_apply(list,pattern) lpathcalls = lpathcalls + 1 parsed = pattern else - parsed = parse_pattern(pattern) or pattern + parsed = lpath(pattern) or pattern end if not parsed then return @@ -6160,25 +8457,32 @@ local function parse_apply(list,pattern) if nofparsed == 0 then return -- something is wrong end - local one = list[1] - if not one then - return -- something is wrong - elseif not trace_lpath then - return normal_apply(list,parsed,nofparsed,one.mi) + if not trace_lpath then + return normal_apply ({ list },parsed,nofparsed,list.mi) elseif trace_lprofile then - return profiled_apply(list,parsed,nofparsed,one.mi) + return profiled_apply({ list },parsed,nofparsed,list.mi) else - return traced_apply(list,parsed,nofparsed,one.mi) + return traced_apply ({ list },parsed,nofparsed,list.mi) end end +xml.applylpath = applylpath -- takes a table as first argment, which is what xml.filter will do + +--[[ldx-- +

This is the main filter function. It returns whatever is asked for.

+--ldx]]-- + +function xml.filter(root,pattern) -- no longer funny attribute handling here + return applylpath(root,pattern) +end + -- internal (parsed) expressions.child = function(e,pattern) - return parse_apply({ e },pattern) -- todo: cache + return applylpath(e,pattern) -- todo: cache end expressions.count = function(e,pattern) - local collected = parse_apply({ e },pattern) -- todo: cache + local collected = applylpath(e,pattern) -- todo: cache return (collected and #collected) or 0 end @@ -6188,7 +8492,7 @@ expressions.oneof = function(s,...) -- slow local t = {...} for i=1,#t do if s == t[i] then return true end end return false end expressions.error = function(str) - xml.error_handler("unknown function in lpath expression",tostring(str or "?")) + xml.errorhandler("unknown function in lpath expression",tostring(str or "?")) return false end expressions.undefined = function(s) @@ -6217,8 +8521,8 @@ expressions.boolean = toboolean -- user interface local function traverse(root,pattern,handle) - logs.report("xml","use 'xml.selection' instead for '%s'",pattern) - local collected = parse_apply({ root },pattern) + report_lpath("use 'xml.selection' instead for '%s'",pattern) + local collected = applylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6229,7 +8533,7 @@ local function traverse(root,pattern,handle) end local function selection(root,pattern,handle) - local collected = parse_apply({ root },pattern) + local collected = applylpath(root,pattern) if collected then if handle then for c=1,#collected do @@ -6241,19 +8545,9 @@ local function selection(root,pattern,handle) end end -xml.parse_parser = parser -xml.parse_pattern = parse_pattern -xml.parse_apply = parse_apply xml.traverse = traverse -- old method, r, d, k xml.selection = selection -- new method, simple handle -local lpath = parse_pattern - -xml.lpath = lpath - -function xml.cached_patterns() - return cache -end -- generic function finalizer (independant namespace) @@ -6265,13 +8559,13 @@ local function dofunction(collected,fnc) f(collected[c]) end else - logs.report("xml","unknown function '%s'",fnc) + report_lpath("unknown function '%s'",fnc) end end end -xml.finalizers.xml["function"] = dofunction -xml.finalizers.tex["function"] = dofunction +finalizers.xml["function"] = dofunction +finalizers.tex["function"] = dofunction -- functions @@ -6363,14 +8657,6 @@ expressions.tag = function(e,n) -- only tg end end ---[[ldx-- -

This is the main filter function. It returns whatever is asked for.

---ldx]]-- - -function xml.filter(root,pattern) -- no longer funny attribute handling here - return parse_apply({ root },pattern) -end - --[[ldx--

Often using an iterators looks nicer in the code than passing handler functions. The book describes how to use coroutines for that @@ -6390,7 +8676,7 @@ end local wrap, yield = coroutine.wrap, coroutine.yield function xml.elements(root,pattern,reverse) -- r, d, k - local collected = parse_apply({ root },pattern) + local collected = applylpath(root,pattern) if collected then if reverse then return wrap(function() for c=#collected,1,-1 do @@ -6406,7 +8692,7 @@ function xml.elements(root,pattern,reverse) -- r, d, k end function xml.collected(root,pattern,reverse) -- e - local collected = parse_apply({ root },pattern) + local collected = applylpath(root,pattern) if collected then if reverse then return wrap(function() for c=#collected,1,-1 do yield(collected[c]) end end) @@ -6417,6 +8703,15 @@ function xml.collected(root,pattern,reverse) -- e return wrap(function() end) end +-- handy + +function xml.inspect(collection,pattern) + pattern = pattern or "." + for e in xml.collected(collection,pattern or ".") do + report_lpath("pattern %q\n\n%s\n",pattern,xml.tostring(e)) + end +end + end -- of closure @@ -6430,10 +8725,16 @@ if not modules then modules = { } end modules ['lxml-mis'] = { license = "see context related readme files" } +local xml, lpeg, string = xml, lpeg, string + local concat = table.concat local type, next, tonumber, tostring, setmetatable, loadstring = type, next, tonumber, tostring, setmetatable, loadstring local format, gsub, match = string.format, string.gsub, string.match -local lpegmatch = lpeg.match +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns +local P, S, R, C, V, Cc, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.Cc, lpeg.Cs + +lpegpatterns.xml = lpegpatterns.xml or { } +local xmlpatterns = lpegpatterns.xml --[[ldx--

The following helper functions best belong to the lxml-ini @@ -6457,9 +8758,8 @@ local function xmlgsub(t,old,new) -- will be replaced end end ---~ xml.gsub = xmlgsub -function xml.strip_leading_spaces(dk,d,k) -- cosmetic, for manual +function xml.stripleadingspaces(dk,d,k) -- cosmetic, for manual if d and k then local dkm = d[k-1] if dkm and type(dkm) == "string" then @@ -6469,14 +8769,7 @@ function xml.strip_leading_spaces(dk,d,k) -- cosmetic, for manual end end ---~ xml.escapes = { ['&'] = '&', ['<'] = '<', ['>'] = '>', ['"'] = '"' } ---~ xml.unescapes = { } for k,v in next, xml.escapes do xml.unescapes[v] = k end ---~ function xml.escaped (str) return (gsub(str,"(.)" , xml.escapes )) end ---~ function xml.unescaped(str) return (gsub(str,"(&.-;)", xml.unescapes)) end ---~ function xml.cleansed (str) return (gsub(str,"<.->" , '' )) end -- "%b<>" - -local P, S, R, C, V, Cc, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.Cc, lpeg.Cs -- 100 * 2500 * "oeps< oeps> oeps&" : gsub:lpeg|lpeg|lpeg -- @@ -6502,9 +8795,9 @@ local unescaped = Cs(normal * (special * normal)^0) local cleansed = Cs(((P("<") * (1-P(">"))^0 * P(">"))/"" + 1)^0) -xml.escaped_pattern = escaped -xml.unescaped_pattern = unescaped -xml.cleansed_pattern = cleansed +xmlpatterns.escaped = escaped +xmlpatterns.unescaped = unescaped +xmlpatterns.cleansed = cleansed function xml.escaped (str) return lpegmatch(escaped,str) end function xml.unescaped(str) return lpegmatch(unescaped,str) end @@ -6540,15 +8833,20 @@ if not modules then modules = { } end modules ['lxml-aux'] = { local trace_manipulations = false trackers.register("lxml.manipulations", function(v) trace_manipulations = v end) -local xmlparseapply, xmlconvert, xmlcopy, xmlname = xml.parse_apply, xml.convert, xml.copy, xml.name +local report_xml = logs.reporter("xml") + +local xml = xml + +local xmlconvert, xmlcopy, xmlname = xml.convert, xml.copy, xml.name local xmlinheritedconvert = xml.inheritedconvert +local xmlapplylpath = xml.applylpath -local type = type -local insert, remove = table.insert, table.remove +local type, setmetatable, getmetatable = type, setmetatable, getmetatable +local insert, remove, fastcopy = table.insert, table.remove, table.fastcopy local gmatch, gsub = string.gmatch, string.gsub local function report(what,pattern,c,e) - logs.report("xml","%s element '%s' (root: '%s', position: %s, index: %s, pattern: %s)",what,xmlname(e),xmlname(e.__p__),c,e.ni,pattern) + report_xml("%s element '%s' (root: '%s', position: %s, index: %s, pattern: %s)",what,xmlname(e),xmlname(e.__p__),c,e.ni,pattern) end local function withelements(e,handle,depth) @@ -6602,10 +8900,8 @@ function xml.withelement(e,n,handle) -- slow end end -xml.elements_only = xml.collected - -function xml.each_element(root,pattern,handle,reverse) - local collected = xmlparseapply({ root },pattern) +function xml.each(root,pattern,handle,reverse) + local collected = xmlapplylpath(root,pattern) if collected then if reverse then for c=#collected,1,-1 do @@ -6620,10 +8916,8 @@ function xml.each_element(root,pattern,handle,reverse) end end -xml.process_elements = xml.each_element - -function xml.process_attributes(root,pattern,handle) - local collected = xmlparseapply({ root },pattern) +function xml.processattributes(root,pattern,handle) + local collected = xmlapplylpath(root,pattern) if collected and handle then for c=1,#collected do handle(collected[c].at) @@ -6638,12 +8932,12 @@ end -- are these still needed -> lxml-cmp.lua -function xml.collect_elements(root, pattern) - return xmlparseapply({ root },pattern) +function xml.collect(root, pattern) + return xmlapplylpath(root,pattern) end -function xml.collect_texts(root, pattern, flatten) -- todo: variant with handle - local collected = xmlparseapply({ root },pattern) +function xml.collecttexts(root, pattern, flatten) -- todo: variant with handle + local collected = xmlapplylpath(root,pattern) if collected and flatten then local xmltostring = xml.tostring for c=1,#collected do @@ -6654,18 +8948,19 @@ function xml.collect_texts(root, pattern, flatten) -- todo: variant with handle end function xml.collect_tags(root, pattern, nonamespace) - local collected = xmlparseapply({ root },pattern) + local collected = xmlapplylpath(root,pattern) if collected then - local t = { } + local t, n = { }, 0 for c=1,#collected do local e = collected[c] local ns, tg = e.ns, e.tg + n = n + 1 if nonamespace then - t[#t+1] = tg + t[n] = tg elseif ns == "" then - t[#t+1] = tg + t[n] = tg else - t[#t+1] = ns .. ":" .. tg + t[n] = ns .. ":" .. tg end end return t @@ -6678,7 +8973,7 @@ end local no_root = { no_root = true } -function xml.redo_ni(d) +local function redo_ni(d) for k=1,#d do local dk = d[k] if type(dk) == "table" then @@ -6701,12 +8996,7 @@ local function xmltoelement(whatever,root) return whatever -- string end if element then - --~ if element.ri then - --~ element = element.dt[element.ri].dt - --~ else - --~ element = element.dt - --~ end - end + end return element end @@ -6724,8 +9014,8 @@ local function copiedelement(element,newparent) end end -function xml.delete_element(root,pattern) - local collected = xmlparseapply({ root },pattern) +function xml.delete(root,pattern) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6736,15 +9026,15 @@ function xml.delete_element(root,pattern) end local d = p.dt remove(d,e.ni) - xml.redo_ni(d) -- can be made faster and inlined + redo_ni(d) -- can be made faster and inlined end end end end -function xml.replace_element(root,pattern,whatever) +function xml.replace(root,pattern,whatever) local element = root and xmltoelement(whatever,root) - local collected = element and xmlparseapply({ root },pattern) + local collected = element and xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6755,15 +9045,50 @@ function xml.replace_element(root,pattern,whatever) end local d = p.dt d[e.ni] = copiedelement(element,p) - xml.redo_ni(d) -- probably not needed + redo_ni(d) -- probably not needed + end + end + end +end + +local function wrap(e,wrapper) + local t = { + rn = e.rn, + tg = e.tg, + ns = e.ns, + at = e.at, + dt = e.dt, + __p__ = e, + } + setmetatable(t,getmetatable(e)) + e.rn = wrapper.rn or e.rn or "" + e.tg = wrapper.tg or e.tg or "" + e.ns = wrapper.ns or e.ns or "" + e.at = fastcopy(wrapper.at) + e.dt = { t } +end + +function xml.wrap(root,pattern,whatever) + if whatever then + local wrapper = xmltoelement(whatever,root) + local collected = xmlapplylpath(root,pattern) + if collected then + for c=1,#collected do + local e = collected[c] + if trace_manipulations then + report('wrapping',pattern,c,e) + end + wrap(e,wrapper) end end + else + wrap(root,xmltoelement(pattern)) end end local function inject_element(root,pattern,whatever,prepend) local element = root and xmltoelement(whatever,root) - local collected = element and xmlparseapply({ root },pattern) + local collected = element and xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6778,15 +9103,17 @@ local function inject_element(root,pattern,whatever,prepend) else be, af = edt, cp end + local bn = #be for i=1,#af do - be[#be+1] = af[i] + bn = bn + 1 + be[bn] = af[i] end if rri then r.dt[rri].dt = be else d[k].dt = be end - xml.redo_ni(d) + redo_ni(d) end end end @@ -6794,7 +9121,7 @@ end local function insert_element(root,pattern,whatever,before) -- todo: element als functie local element = root and xmltoelement(whatever,root) - local collected = element and xmlparseapply({ root },pattern) + local collected = element and xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6804,24 +9131,23 @@ local function insert_element(root,pattern,whatever,before) -- todo: element als k = k + 1 end insert(d,k,copiedelement(element,r)) - xml.redo_ni(d) + redo_ni(d) end end end -xml.insert_element = insert_element -xml.insert_element_after = insert_element -xml.insert_element_before = function(r,p,e) insert_element(r,p,e,true) end -xml.inject_element = inject_element -xml.inject_element_after = inject_element -xml.inject_element_before = function(r,p,e) inject_element(r,p,e,true) end +xml.insert_element = insert_element +xml.insertafter = insert_element +xml.insertbefore = function(r,p,e) insert_element(r,p,e,true) end +xml.injectafter = inject_element +xml.injectbefore = function(r,p,e) inject_element(r,p,e,true) end local function include(xmldata,pattern,attribute,recursive,loaddata) -- parse="text" (default: xml), encoding="" (todo) -- attribute = attribute or 'href' pattern = pattern or 'include' loaddata = loaddata or io.loaddata - local collected = xmlparseapply({ xmldata },pattern) + local collected = xmlapplylpath(xmldata,pattern) if collected then for c=1,#collected do local ek = collected[c] @@ -6830,7 +9156,7 @@ local function include(xmldata,pattern,attribute,recursive,loaddata) local ekat = ek.at local epdt = ek.__p__.dt if not attribute or attribute == "" then - name = (type(ekdt) == "table" and ekdt[1]) or ekdt -- ckeck, probably always tab or str + name = (type(ekdt) == "table" and ekdt[1]) or ekdt -- check, probably always tab or str end if not name then for a in gmatch(attribute or "href","([^|]+)") do @@ -6845,9 +9171,6 @@ local function include(xmldata,pattern,attribute,recursive,loaddata) -- for the moment hard coded epdt[ek.ni] = xml.escaped(data) -- d[k] = xml.escaped(data) else ---~ local settings = xmldata.settings ---~ settings.parent_root = xmldata -- to be tested ---~ local xi = xmlconvert(data,settings) local xi = xmlinheritedconvert(data,xmldata) if not xi then epdt[ek.ni] = "" -- xml.empty(d,k) @@ -6864,136 +9187,88 @@ end xml.include = include ---~ local function manipulate(xmldata,pattern,manipulator) -- untested and might go away ---~ local collected = xmlparseapply({ xmldata },pattern) ---~ if collected then ---~ local xmltostring = xml.tostring ---~ for c=1,#collected do ---~ local e = collected[c] ---~ local data = manipulator(xmltostring(e)) ---~ if data == "" then ---~ epdt[e.ni] = "" ---~ else ---~ local xi = xmlinheritedconvert(data,xmldata) ---~ if not xi then ---~ epdt[e.ni] = "" ---~ else ---~ epdt[e.ni] = xml.body(xi) -- xml.assign(d,k,xi) ---~ end ---~ end ---~ end ---~ end ---~ end - ---~ xml.manipulate = manipulate - -function xml.strip_whitespace(root, pattern, nolines) -- strips all leading and trailing space ! - local collected = xmlparseapply({ root },pattern) - if collected then - for i=1,#collected do - local e = collected[i] - local edt = e.dt - if edt then - local t = { } - for i=1,#edt do - local str = edt[i] - if type(str) == "string" then - if str == "" then - -- stripped - else - if nolines then - str = gsub(str,"[ \n\r\t]+"," ") - end - if str == "" then - -- stripped - else - t[#t+1] = str - end - end +local function stripelement(e,nolines,anywhere) + local edt = e.dt + if edt then + if anywhere then + local t, n = { }, 0 + for e=1,#edt do + local str = edt[e] + if type(str) ~= "string" then + n = n + 1 + t[n] = str + elseif str ~= "" then + -- todo: lpeg for each case + if nolines then + str = gsub(str,"%s+"," ") + end + str = gsub(str,"^%s*(.-)%s*$","%1") + if str ~= "" then + n = n + 1 + t[n] = str + end + end + end + e.dt = t + else + -- we can assume a regular sparse xml table with no successive strings + -- otherwise we should use a while loop + if #edt > 0 then + -- strip front + local str = edt[1] + if type(str) ~= "string" then + -- nothing + elseif str == "" then + remove(edt,1) + else + if nolines then + str = gsub(str,"%s+"," ") + end + str = gsub(str,"^%s+","") + if str == "" then + remove(edt,1) + else + edt[1] = str + end + end + end + local nedt = #edt + if nedt > 0 then + -- strip end + local str = edt[nedt] + if type(str) ~= "string" then + -- nothing + elseif str == "" then + remove(edt) + else + if nolines then + str = gsub(str,"%s+"," ") + end + str = gsub(str,"%s+$","") + if str == "" then + remove(edt) else - --~ str.ni = i - t[#t+1] = str + edt[nedt] = str end end - e.dt = t end end end + return e -- convenient end -function xml.strip_whitespace(root, pattern, nolines, anywhere) -- strips all leading and trailing spacing - local collected = xmlparseapply({ root },pattern) -- beware, indices no longer are valid now +xml.stripelement = stripelement + +function xml.strip(root,pattern,nolines,anywhere) -- strips all leading and trailing spacing + local collected = xmlapplylpath(root,pattern) -- beware, indices no longer are valid now if collected then for i=1,#collected do - local e = collected[i] - local edt = e.dt - if edt then - if anywhere then - local t = { } - for e=1,#edt do - local str = edt[e] - if type(str) ~= "string" then - t[#t+1] = str - elseif str ~= "" then - -- todo: lpeg for each case - if nolines then - str = gsub(str,"%s+"," ") - end - str = gsub(str,"^%s*(.-)%s*$","%1") - if str ~= "" then - t[#t+1] = str - end - end - end - e.dt = t - else - -- we can assume a regular sparse xml table with no successive strings - -- otherwise we should use a while loop - if #edt > 0 then - -- strip front - local str = edt[1] - if type(str) ~= "string" then - -- nothing - elseif str == "" then - remove(edt,1) - else - if nolines then - str = gsub(str,"%s+"," ") - end - str = gsub(str,"^%s+","") - if str == "" then - remove(edt,1) - else - edt[1] = str - end - end - end - if #edt > 1 then - -- strip end - local str = edt[#edt] - if type(str) ~= "string" then - -- nothing - elseif str == "" then - remove(edt) - else - if nolines then - str = gsub(str,"%s+"," ") - end - str = gsub(str,"%s+$","") - if str == "" then - remove(edt) - else - edt[#edt] = str - end - end - end - end - end + stripelement(collected[i],nolines,anywhere) end end end -local function rename_space(root, oldspace, newspace) -- fast variant +local function renamespace(root, oldspace, newspace) -- fast variant local ndt = #root.dt for i=1,ndt or 0 do local e = root[i] @@ -7006,16 +9281,16 @@ local function rename_space(root, oldspace, newspace) -- fast variant end local edt = e.dt if edt then - rename_space(edt, oldspace, newspace) + renamespace(edt, oldspace, newspace) end end end end -xml.rename_space = rename_space +xml.renamespace = renamespace -function xml.remap_tag(root, pattern, newtg) - local collected = xmlparseapply({ root },pattern) +function xml.remaptag(root, pattern, newtg) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do collected[c].tg = newtg @@ -7023,8 +9298,8 @@ function xml.remap_tag(root, pattern, newtg) end end -function xml.remap_namespace(root, pattern, newns) - local collected = xmlparseapply({ root },pattern) +function xml.remapnamespace(root, pattern, newns) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do collected[c].ns = newns @@ -7032,8 +9307,8 @@ function xml.remap_namespace(root, pattern, newns) end end -function xml.check_namespace(root, pattern, newns) - local collected = xmlparseapply({ root },pattern) +function xml.checknamespace(root, pattern, newns) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -7044,8 +9319,8 @@ function xml.check_namespace(root, pattern, newns) end end -function xml.remap_name(root, pattern, newtg, newns, newrn) - local collected = xmlparseapply({ root },pattern) +function xml.remapname(root, pattern, newtg, newns, newrn) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -7058,18 +9333,34 @@ end

Here are a few synonyms.

--ldx]]-- -xml.each = xml.each_element -xml.process = xml.process_element -xml.strip = xml.strip_whitespace -xml.collect = xml.collect_elements -xml.all = xml.collect_elements - -xml.insert = xml.insert_element_after -xml.inject = xml.inject_element_after -xml.after = xml.insert_element_after -xml.before = xml.insert_element_before -xml.delete = xml.delete_element -xml.replace = xml.replace_element +xml.all = xml.each +xml.insert = xml.insertafter +xml.inject = xml.injectafter +xml.after = xml.insertafter +xml.before = xml.insertbefore +xml.process = xml.each + +-- obsolete + +xml.obsolete = xml.obsolete or { } +local obsolete = xml.obsolete + +xml.strip_whitespace = xml.strip obsolete.strip_whitespace = xml.strip +xml.collect_elements = xml.collect obsolete.collect_elements = xml.collect +xml.delete_element = xml.delete obsolete.delete_element = xml.delete +xml.replace_element = xml.replace obsolete.replace_element = xml.replacet +xml.each_element = xml.each obsolete.each_element = xml.each +xml.process_elements = xml.process obsolete.process_elements = xml.process +xml.insert_element_after = xml.insertafter obsolete.insert_element_after = xml.insertafter +xml.insert_element_before = xml.insertbefore obsolete.insert_element_before = xml.insertbefore +xml.inject_element_after = xml.injectafter obsolete.inject_element_after = xml.injectafter +xml.inject_element_before = xml.injectbefore obsolete.inject_element_before = xml.injectbefore +xml.process_attributes = xml.processattributes obsolete.process_attributes = xml.processattributes +xml.collect_texts = xml.collecttexts obsolete.collect_texts = xml.collecttexts +xml.inject_element = xml.inject obsolete.inject_element = xml.inject +xml.remap_tag = xml.remaptag obsolete.remap_tag = xml.remaptag +xml.remap_name = xml.remapname obsolete.remap_name = xml.remapname +xml.remap_namespace = xml.remapnamespace obsolete.remap_namespace = xml.remapnamespace end -- of closure @@ -7084,10 +9375,15 @@ if not modules then modules = { } end modules ['lxml-xml'] = { license = "see context related readme files" } +local concat = string.concat + +local xml = xml + local finalizers = xml.finalizers.xml local xmlfilter = xml.filter -- we could inline this one for speed local xmltostring = xml.tostring local xmlserialize = xml.serialize +local xmlcollected = xml.collected local function first(collected) -- wrong ? return collected and collected[1] @@ -7101,15 +9397,8 @@ local function all(collected) return collected end -local function reverse(collected) - if collected then - local reversed = { } - for c=#collected,1,-1 do - reversed[#reversed+1] = collected[c] - end - return reversed - end -end + +local reverse = table.reversed local function attribute(collected,name) if collected and #collected > 0 then @@ -7200,11 +9489,12 @@ end local function texts(collected) if collected then - local t = { } + local t, n = { }, 0 for c=1,#collected do - local e = collection[c] + local e = collected[c] if e and e.dt then - t[#t+1] = e.dt + n = n + 1 + t[n] = e.dt end end return t @@ -7247,14 +9537,15 @@ end local function tags(collected,nonamespace) if collected then - local t = { } + local t, n = { }, 0 for c=1,#collected do local e = collected[c] local ns, tg = e.ns, e.tg + n = n + 1 if nonamespace or ns == "" then - t[#t+1] = tg + t[n] = tg else - t[#t+1] = ns .. ":" .. tg + t[n] = ns .. ":" .. tg end end return t @@ -7365,1812 +9656,1937 @@ xml.all = xml.filter xml.index = xml.position xml.found = xml.filter +-- a nice one: + +local function totable(x) + local t = { } + for e in xmlcollected(x[1] or x,"/*") do + t[e.tg] = xmltostring(e.dt) or "" + end + return next(t) and t or nil +end + +xml.table = totable +finalizers.table = totable + +local function textonly(e,t) + if e then + local edt = e.dt + if edt then + for i=1,#edt do + local e = edt[i] + if type(e) == "table" then + textonly(e,t) + else + t[#t+1] = e + end + end + end + end + return t +end + +function xml.textonly(e) -- no pattern + return concat(textonly(e,{})) +end + end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['luat-env'] = { +if not modules then modules = { } end modules ['data-ini'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" + license = "see context related readme files", } --- A former version provided functionality for non embeded core --- scripts i.e. runtime library loading. Given the amount of --- Lua code we use now, this no longer makes sense. Much of this --- evolved before bytecode arrays were available and so a lot of --- code has disappeared already. +local gsub, find, gmatch = string.gsub, string.find, string.gmatch +local concat = table.concat +local next, type = next, type -local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local filedirname, filebasename, fileextname, filejoin = file.dirname, file.basename, file.extname, file.join -local format, sub, match, gsub, find = string.format, string.sub, string.match, string.gsub, string.find -local unquote, quote = string.unquote, string.quote +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_detail = false trackers.register("resolvers.details", function(v) trace_detail = v end) +local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end) --- precautions +local report_initialization = logs.reporter("resolvers","initialization") -os.setlocale(nil,nil) -- useless feature and even dangerous in luatex +local ostype, osname, ossetenv, osgetenv = os.type, os.name, os.setenv, os.getenv -function os.setlocale() - -- no way you can mess with it -end +-- The code here used to be part of a data-res but for convenience +-- we now split it over multiple files. As this file is now the +-- starting point we introduce resolvers here. --- dirty tricks +resolvers = resolvers or { } +local resolvers = resolvers + +-- We don't want the kpse library to kick in. Also, we want to be able to +-- execute programs. Control over execution is implemented later. + +texconfig.kpse_init = false +texconfig.shell_escape = 't' + +kpse = { original = kpse } + +setmetatable(kpse, { + __index = function(kp,name) + report_initialization("fatal error: kpse library is accessed (key: %s)",name) + os.exit() + end +} ) + +-- First we check a couple of environment variables. Some might be +-- set already but we need then later on. We start with the system +-- font path. + +do + + local osfontdir = osgetenv("OSFONTDIR") + + if osfontdir and osfontdir ~= "" then + -- ok + elseif osname == "windows" then + ossetenv("OSFONTDIR","c:/windows/fonts//") + elseif osname == "macosx" then + ossetenv("OSFONTDIR","$HOME/Library/Fonts//;/Library/Fonts//;/System/Library/Fonts//") + end -if arg and (arg[0] == 'luatex' or arg[0] == 'luatex.exe') and arg[1] == "--luaonly" then - arg[-1]=arg[0] arg[0]=arg[2] for k=3,#arg do arg[k-2]=arg[k] end arg[#arg]=nil arg[#arg]=nil end -if profiler and os.env["MTX_PROFILE_RUN"] == "YES" then - profiler.start("luatex-profile.log") +-- Next comes the user's home path. We need this as later on we have +-- to replace ~ with its value. + +do + + local homedir = osgetenv(ostype == "windows" and 'USERPROFILE' or 'HOME') or '' + + if not homedir or homedir == "" then + homedir = string.char(127) -- we need a value, later we wil trigger on it + end + + homedir = file.collapsepath(homedir) + + ossetenv("HOME", homedir) -- can be used in unix cnf files + ossetenv("USERPROFILE",homedir) -- can be used in windows cnf files + + environment.homedir = homedir + end --- environment +-- The following code sets the name of the own binary and its +-- path. This is fallback code as we have os.selfdir now. -environment = environment or { } -environment.arguments = { } -environment.files = { } -environment.sortedflags = nil +do -if not environment.jobname or environment.jobname == "" then if tex then environment.jobname = tex.jobname end end -if not environment.version or environment.version == "" then environment.version = "unknown" end -if not environment.jobname then environment.jobname = "unknown" end + local args = environment.originalarguments or arg -- this needs a cleanup -function environment.initialize_arguments(arg) - local arguments, files = { }, { } - environment.arguments, environment.files, environment.sortedflags = arguments, files, nil - for index=1,#arg do - local argument = arg[index] - if index > 0 then - local flag, value = match(argument,"^%-+(.-)=(.-)$") - if flag then - arguments[flag] = unquote(value or "") - else - flag = match(argument,"^%-+(.+)") - if flag then - arguments[flag] = true - else - files[#files+1] = argument + local ownbin = environment.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex" + local ownpath = environment.ownpath or os.selfdir + + ownbin = file.collapsepath(ownbin) + ownpath = file.collapsepath(ownpath) + + if not ownpath or ownpath == "" or ownpath == "unset" then + ownpath = args[-1] or arg[-1] + ownpath = ownpath and filedirname(gsub(ownpath,"\\","/")) + if not ownpath or ownpath == "" then + ownpath = args[-0] or arg[-0] + ownpath = ownpath and filedirname(gsub(ownpath,"\\","/")) + end + local binary = ownbin + if not ownpath or ownpath == "" then + ownpath = ownpath and filedirname(binary) + end + if not ownpath or ownpath == "" then + if os.binsuffix ~= "" then + binary = file.replacesuffix(binary,os.binsuffix) + end + local path = osgetenv("PATH") + if path then + for p in gmatch(path,"[^"..io.pathseparator.."]+") do + local b = filejoin(p,binary) + if lfs.isfile(b) then + -- we assume that after changing to the path the currentdir function + -- resolves to the real location and use this side effect here; this + -- trick is needed because on the mac installations use symlinks in the + -- path instead of real locations + local olddir = lfs.currentdir() + if lfs.chdir(p) then + local pp = lfs.currentdir() + if trace_locating and p ~= pp then + report_initialization("following symlink '%s' to '%s'",p,pp) + end + ownpath = pp + lfs.chdir(olddir) + else + if trace_locating then + report_initialization("unable to check path '%s'",p) + end + ownpath = p + end + break + end end end end + if not ownpath or ownpath == "" then + ownpath = "." + report_initialization("forcing fallback ownpath .") + elseif trace_locating then + report_initialization("using ownpath '%s'",ownpath) + end end - environment.ownname = environment.ownname or arg[0] or 'unknown.lua' + + environment.ownbin = ownbin + environment.ownpath = ownpath + end -function environment.setargument(name,value) - environment.arguments[name] = value +resolvers.ownpath = environment.ownpath + +function resolvers.getownpath() + return environment.ownpath end --- todo: defaults, better checks e.g on type (boolean versus string) --- --- tricky: too many hits when we support partials unless we add --- a registration of arguments so from now on we have 'partial' +-- The self variables permit us to use only a few (or even no) +-- environment variables. -function environment.argument(name,partial) - local arguments, sortedflags = environment.arguments, environment.sortedflags - if arguments[name] then - return arguments[name] - elseif partial then - if not sortedflags then - sortedflags = table.sortedkeys(arguments) - for k=1,#sortedflags do - sortedflags[k] = "^" .. sortedflags[k] - end - environment.sortedflags = sortedflags - end - -- example of potential clash: ^mode ^modefile - for k=1,#sortedflags do - local v = sortedflags[k] - if find(name,v) then - return arguments[sub(v,2,#v)] - end - end +do + + local ownpath = environment.ownpath or dir.current() + + if ownpath then + ossetenv('SELFAUTOLOC', file.collapsepath(ownpath)) + ossetenv('SELFAUTODIR', file.collapsepath(ownpath .. "/..")) + ossetenv('SELFAUTOPARENT', file.collapsepath(ownpath .. "/../..")) + else + report_initialization("error: unable to locate ownpath") + os.exit() end - return nil + end -environment.argument("x",true) +-- The running os: -function environment.split_arguments(separator) -- rather special, cut-off before separator - local done, before, after = false, { }, { } - local original_arguments = environment.original_arguments - for k=1,#original_arguments do - local v = original_arguments[k] - if not done and v == separator then - done = true - elseif done then - after[#after+1] = v - else - before[#before+1] = v - end - end - return before, after +-- todo: check is context sits here os.platform is more trustworthy +-- that the bin check as mtx-update runs from another path + +local texos = environment.texos or osgetenv("TEXOS") +local texmfos = environment.texmfos or osgetenv('SELFAUTODIR') + +if not texos or texos == "" then + texos = file.basename(texmfos) end -function environment.reconstruct_commandline(arg,noquote) - arg = arg or environment.original_arguments - if noquote and #arg == 1 then - local a = arg[1] - a = resolvers.resolve(a) - a = unquote(a) - return a - elseif #arg > 0 then - local result = { } - for i=1,#arg do - local a = arg[i] - a = resolvers.resolve(a) - a = unquote(a) - a = gsub(a,'"','\\"') -- tricky - if find(a," ") then - result[#result+1] = quote(a) - else - result[#result+1] = a - end - end - return table.join(result," ") - else - return "" +ossetenv('TEXMFOS', texmfos) -- full bin path +ossetenv('TEXOS', texos) -- partial bin parent +ossetenv('SELFAUTOSYSTEM',os.platform) -- bonus + +environment.texos = texos +environment.texmfos = texmfos + +-- The current root: + +local texroot = environment.texroot or osgetenv("TEXROOT") + +if not texroot or texroot == "" then + texroot = osgetenv('SELFAUTOPARENT') + ossetenv('TEXROOT',texroot) +end + +environment.texroot = file.collapsepath(texroot) + +-- Tracing. Todo ... + +function resolvers.settrace(n) -- no longer number but: 'locating' or 'detail' + if n then + trackers.disable("resolvers.*") + trackers.enable("resolvers."..n) end end -if arg then +resolvers.settrace(osgetenv("MTX_INPUT_TRACE")) + +-- todo: + +-- if profiler and osgetenv("MTX_PROFILE_RUN") == "YES" then +-- profiler.start("luatex-profile.log") +-- end + +-- a forward definition + +if not resolvers.resolve then + function resolvers.resolve (s) return s end + function resolvers.unresolve(s) return s end + function resolvers.repath (s) return s end +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-exp'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +local format, find, gmatch, lower = string.format, string.find, string.gmatch, string.lower +local concat, sort = table.concat, table.sort +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns +local Ct, Cs, Cc, P, C, S = lpeg.Ct, lpeg.Cs, lpeg.Cc, lpeg.P, lpeg.C, lpeg.S +local type, next = type, next - -- new, reconstruct quoted snippets (maybe better just remove the " then and add them later) - local newarg, instring = { }, false +local ostype = os.type +local collapsepath = file.collapsepath - for index=1,#arg do - local argument = arg[index] - if find(argument,"^\"") then - newarg[#newarg+1] = gsub(argument,"^\"","") - if not find(argument,"\"$") then - instring = true - end - elseif find(argument,"\"$") then - newarg[#newarg] = newarg[#newarg] .. " " .. gsub(argument,"\"$","") - instring = false - elseif instring then - newarg[#newarg] = newarg[#newarg] .. " " .. argument - else - newarg[#newarg+1] = argument - end - end - for i=1,-5,-1 do - newarg[i] = arg[i] - end +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end) - environment.initialize_arguments(newarg) - environment.original_arguments = newarg - environment.raw_arguments = arg +local report_expansions = logs.reporter("resolvers","expansions") - arg = { } -- prevent duplicate handling +local resolvers = resolvers -end +-- As this bit of code is somewhat special it gets its own module. After +-- all, when working on the main resolver code, I don't want to scroll +-- past this every time. See data-obs.lua for the gsub variant. --- weird place ... depends on a not yet loaded module +-- {a,b,c,d} +-- a,b,c/{p,q,r},d +-- a,b,c/{p,q,r}/d/{x,y,z}// +-- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} +-- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} +-- a{b,c}{d,e}f +-- {a,b,c,d} +-- {a,b,c/{p,q,r},d} +-- {a,b,c/{p,q,r}/d/{x,y,z}//} +-- {a,b,c/{p,q/{x,y,z}},d/{p,q,r}} +-- {a,b,c/{p,q/{x,y,z},w}v,d/{p,q,r}} +-- {$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c} -function environment.texfile(filename) - return resolvers.find_file(filename,'tex') +local function f_first(a,b) + local t, n = { }, 0 + for s in gmatch(b,"[^,]+") do + n = n + 1 ; t[n] = a .. s + end + return concat(t,",") end -function environment.luafile(filename) - local resolved = resolvers.find_file(filename,'tex') or "" - if resolved ~= "" then - return resolved +local function f_second(a,b) + local t, n = { }, 0 + for s in gmatch(a,"[^,]+") do + n = n + 1 ; t[n] = s .. b end - resolved = resolvers.find_file(filename,'texmfscripts') or "" - if resolved ~= "" then - return resolved + return concat(t,",") +end + +local function f_both(a,b) + local t, n = { }, 0 + for sa in gmatch(a,"[^,]+") do + for sb in gmatch(b,"[^,]+") do + n = n + 1 ; t[n] = sa .. sb + end end - return resolvers.find_file(filename,'luatexlibs') or "" + return concat(t,",") end -environment.loadedluacode = loadfile -- can be overloaded +local left = P("{") +local right = P("}") +local var = P((1 - S("{}" ))^0) +local set = P((1 - S("{},"))^0) +local other = P(1) ---~ function environment.loadedluacode(name) ---~ if os.spawn("texluac -s -o texluac.luc " .. name) == 0 then ---~ local chunk = loadstring(io.loaddata("texluac.luc")) ---~ os.remove("texluac.luc") ---~ return chunk ---~ else ---~ environment.loadedluacode = loadfile -- can be overloaded ---~ return loadfile(name) ---~ end ---~ end - -function environment.luafilechunk(filename) -- used for loading lua bytecode in the format - filename = file.replacesuffix(filename, "lua") - local fullname = environment.luafile(filename) - if fullname and fullname ~= "" then - if trace_locating then - logs.report("fileio","loading file %s", fullname) +local l_first = Cs( ( Cc("{") * (C(set) * left * C(var) * right / f_first) * Cc("}") + other )^0 ) +local l_second = Cs( ( Cc("{") * (left * C(var) * right * C(set) / f_second) * Cc("}") + other )^0 ) +local l_both = Cs( ( Cc("{") * (left * C(var) * right * left * C(var) * right / f_both) * Cc("}") + other )^0 ) +local l_rest = Cs( ( left * var * (left/"") * var * (right/"") * var * right + other )^0 ) + +local stripper_1 = lpeg.stripper ("{}@") +local replacer_1 = lpeg.replacer { { ",}", ",@}" }, { "{,", "{@," }, } + +local function splitpathexpr(str, newlist, validate) -- I couldn't resist lpegging it (nice exercise). + if trace_expansions then + report_expansions("expanding variable '%s'",str) + end + local t, ok, done = newlist or { }, false, false + local n = #t + str = lpegmatch(replacer_1,str) + repeat local old = str + repeat local old = str ; str = lpegmatch(l_first, str) until old == str + repeat local old = str ; str = lpegmatch(l_second,str) until old == str + repeat local old = str ; str = lpegmatch(l_both, str) until old == str + repeat local old = str ; str = lpegmatch(l_rest, str) until old == str + until old == str -- or not find(str,"{") + str = lpegmatch(stripper_1,str) + if validate then + for s in gmatch(str,"[^,]+") do + s = validate(s) + if s then + n = n + 1 ; t[n] = s + end end - return environment.loadedluacode(fullname) else - if trace_locating then - logs.report("fileio","unknown file %s", filename) + for s in gmatch(str,"[^,]+") do + n = n + 1 ; t[n] = s + end + end + if trace_expansions then + for k=1,#t do + report_expansions("% 4i: %s",k,t[k]) end - return nil end + return t end --- the next ones can use the previous ones / combine +-- We could make the previous one public. -function environment.loadluafile(filename, version) - local lucname, luaname, chunk - local basename = file.removesuffix(filename) - if basename == filename then - lucname, luaname = basename .. ".luc", basename .. ".lua" - else - lucname, luaname = nil, basename -- forced suffix - end - -- when not overloaded by explicit suffix we look for a luc file first - local fullname = (lucname and environment.luafile(lucname)) or "" - if fullname ~= "" then - if trace_locating then - logs.report("fileio","loading %s", fullname) - end - chunk = loadfile(fullname) -- this way we don't need a file exists check +local function validate(s) + s = collapsepath(s) -- already keeps the // + return s ~= "" and not find(s,"^!*unset/*$") and s +end + +resolvers.validatedpath = validate -- keeps the trailing // + +function resolvers.expandedpathfromlist(pathlist) + local newlist = { } + for k=1,#pathlist do + splitpathexpr(pathlist[k],newlist,validate) end - if chunk then - assert(chunk)() - if version then - -- we check of the version number of this chunk matches - local v = version -- can be nil - if modules and modules[filename] then - v = modules[filename].version -- new method - elseif versions and versions[filename] then - v = versions[filename] -- old method + return newlist +end + +local cleanup = lpeg.replacer { + { "!" , "" }, + { "\\" , "/" }, +} + +local homedir + +function resolvers.cleanpath(str) + if not homedir then + homedir = lpegmatch(cleanup,environment.homedir or "") + if homedir == string.char(127) or homedir == "" or not lfs.isdir(homedir) then + if trace_expansions then + report_expansions("no home dir set, ignoring dependent paths") end - if v == version then - return true - else - if trace_locating then - logs.report("fileio","version mismatch for %s: lua=%s, luc=%s", filename, v, version) + function resolvers.cleanpath(str) + if find(str,"~") then + return "" -- special case + else + return str and lpegmatch(cleanup,str) end - environment.loadluafile(filename) end else - return true - end - end - fullname = (luaname and environment.luafile(luaname)) or "" - if fullname ~= "" then - if trace_locating then - logs.report("fileio","loading %s", fullname) - end - chunk = loadfile(fullname) -- this way we don't need a file exists check - if not chunk then - if trace_locating then - logs.report("fileio","unknown file %s", filename) + cleanup = lpeg.replacer { + { "!" , "" }, + { "\\" , "/" }, + { "~" , homedir }, + } + function resolvers.cleanpath(str) + return str and lpegmatch(cleanup,str) end - else - assert(chunk)() - return true end end - return false + return resolvers.cleanpath(str) end +-- This one strips quotes and funny tokens. -end -- of closure - -do -- create closure to overcome 200 locals limit +local expandhome = P("~") / "$HOME" -- environment.homedir -if not modules then modules = { } end modules ['trac-inf'] = { - version = 1.001, - comment = "companion to trac-inf.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} +local dodouble = P('"')/"" * (expandhome + (1 - P('"')))^0 * P('"')/"" +local dosingle = P("'")/"" * (expandhome + (1 - P("'")))^0 * P("'")/"" +local dostring = (expandhome + 1 )^0 -local format = string.format +local stripper = Cs( + lpegpatterns.unspacer * (dosingle + dodouble + dostring) * lpegpatterns.unspacer +) -local statusinfo, n, registered = { }, 0, { } +function resolvers.checkedvariable(str) -- assumes str is a string + return lpegmatch(stripper,str) or str +end -statistics = statistics or { } +-- The path splitter: -statistics.enable = true -statistics.threshold = 0.05 +-- A config (optionally) has the paths split in tables. Internally +-- we join them and split them after the expansion has taken place. This +-- is more convenient. --- timing functions +local cache = { } -local clock = os.gettimeofday or os.clock +---- splitter = Ct(lpeg.splitat(S(ostype == "windows" and ";" or ":;"))) -- maybe add , +local splitter = Ct(lpeg.splitat(";")) -- as we move towards urls, prefixes and use tables we no longer do : -local notimer +local backslashswapper = lpeg.replacer("\\","/") -function statistics.hastimer(instance) - return instance and instance.starttime +local function splitconfigurationpath(str) -- beware, this can be either a path or a { specification } + if str then + local found = cache[str] + if not found then + if str == "" then + found = { } + else + local split = lpegmatch(splitter,lpegmatch(backslashswapper,str)) -- can be combined + found = { } + local noffound = 0 + for i=1,#split do + local s = split[i] + if not find(s,"^{*unset}*") then + noffound = noffound + 1 + found[noffound] = s + end + end + if trace_expansions then + report_expansions("splitting path specification '%s'",str) + for k=1,noffound do + report_expansions("% 4i: %s",k,found[k]) + end + end + cache[str] = found + end + end + return found + end end -function statistics.resettiming(instance) - if not instance then - notimer = { timing = 0, loadtime = 0 } +resolvers.splitconfigurationpath = splitconfigurationpath + +function resolvers.splitpath(str) + if type(str) == 'table' then + return str else - instance.timing, instance.loadtime = 0, 0 + return splitconfigurationpath(str) end end -function statistics.starttiming(instance) - if not instance then - notimer = { } - instance = notimer - end - local it = instance.timing - if not it then - it = 0 - end - if it == 0 then - instance.starttime = clock() - if not instance.loadtime then - instance.loadtime = 0 - end +function resolvers.joinpath(str) + if type(str) == 'table' then + return file.joinpath(str) else ---~ logs.report("system","nested timing (%s)",tostring(instance)) + return str end - instance.timing = it + 1 end -function statistics.stoptiming(instance, report) - if not instance then - instance = notimer - end - if instance then - local it = instance.timing - if it > 1 then - instance.timing = it - 1 - else - local starttime = instance.starttime - if starttime then - local stoptime = clock() - local loadtime = stoptime - starttime - instance.stoptime = stoptime - instance.loadtime = instance.loadtime + loadtime - if report then - statistics.report("load time %0.3f",loadtime) +-- The next function scans directories and returns a hash where the +-- entries are either strings or tables. + +-- starting with . or .. etc or funny char + + + + +local weird = P(".")^1 + lpeg.anywhere(S("~`!#$%^&*()={}[]:;\"\'||<>,?\n\r\t")) + +local attributes, directory = lfs.attributes, lfs.dir + +local function scan(files,spec,path,n,m,r) + local full = (path == "" and spec) or (spec .. path .. '/') + local dirs, nofdirs = { }, 0 + for name in directory(full) do + if not lpegmatch(weird,name) then + local mode = attributes(full..name,'mode') + if mode == 'file' then + n = n + 1 + local f = files[name] + if f then + if type(f) == 'string' then + files[name] = { f, path } + else + f[#f+1] = path + end + else -- probably unique anyway + files[name] = path + local lower = lower(name) + if name ~= lower then + files["remap:"..lower] = name + r = r + 1 + end + end + elseif mode == 'directory' then + m = m + 1 + nofdirs = nofdirs + 1 + if path ~= "" then + dirs[nofdirs] = path..'/'..name + else + dirs[nofdirs] = name end - instance.timing = 0 - return loadtime end end end - return 0 -end - -function statistics.elapsedtime(instance) - if not instance then - instance = notimer + if nofdirs > 0 then + sort(dirs) + for i=1,nofdirs do + files, n, m, r = scan(files,spec,dirs[i],n,m,r) + end end - return format("%0.3f",(instance and instance.loadtime) or 0) + return files, n, m, r end -function statistics.elapsedindeed(instance) - if not instance then - instance = notimer +function resolvers.scanfiles(path,branch) + if trace_locating then + report_expansions("scanning path '%s', branch '%s'",path, branch or path) + end + local realpath = resolvers.resolve(path) -- no shortcut + local files, n, m, r = scan({ },realpath .. '/',"",0,0,0) + files.__path__ = path -- can be selfautoparent:texmf-whatever + files.__files__ = n + files.__directories__ = m + files.__remappings__ = r + if trace_locating then + report_expansions("%s files found on %s directories with %s uppercase remappings",n,m,r) end - local t = (instance and instance.loadtime) or 0 - return t > statistics.threshold + return files end -function statistics.elapsedseconds(instance,rest) -- returns nil if 0 seconds - if statistics.elapsedindeed(instance) then - return format("%s seconds %s", statistics.elapsedtime(instance),rest or "") - end -end --- general function -function statistics.register(tag,fnc) - if statistics.enable and type(fnc) == "function" then - local rt = registered[tag] or (#statusinfo + 1) - statusinfo[rt] = { tag, fnc } - registered[tag] = rt - if #tag > n then n = #tag end - end -end +end -- of closure -function statistics.show(reporter) - if statistics.enable then - if not reporter then reporter = function(tag,data,n) texio.write_nl(tag .. " " .. data) end end - -- this code will move - local register = statistics.register - register("luatex banner", function() - return string.lower(status.banner) - end) - register("control sequences", function() - return format("%s of %s", status.cs_count, status.hash_size+status.hash_extra) - end) - register("callbacks", function() - local total, indirect = status.callbacks or 0, status.indirect_callbacks or 0 - return format("direct: %s, indirect: %s, total: %s", total-indirect, indirect, total) - end) - register("current memory usage", statistics.memused) - register("runtime",statistics.runtime) --- -- - for i=1,#statusinfo do - local s = statusinfo[i] - local r = s[2]() - if r then - reporter(s[1],r,n) +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-env'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +local lower, gsub = string.lower, string.gsub + +local resolvers = resolvers + +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex +local fileextname = file.extname + +local formats = allocate() +local suffixes = allocate() +local dangerous = allocate() +local suffixmap = allocate() + +resolvers.formats = formats +resolvers.suffixes = suffixes +resolvers.dangerous = dangerous +resolvers.suffixmap = suffixmap + +local relations = allocate { -- todo: handlers also here + core = { + ofm = { -- will become obsolete + names = { "ofm", "omega font metric", "omega font metrics" }, + variable = 'OFMFONTS', + suffixes = { 'ofm', 'tfm' }, + }, + ovf = { -- will become obsolete + names = { "ovf", "omega virtual font", "omega virtual fonts" }, + variable = 'OVFFONTS', + suffixes = { 'ovf', 'vf' }, + }, + tfm = { + names = { "tfm", "tex font metric", "tex font metrics" }, + variable = 'TFMFONTS', + suffixes = { 'tfm' }, + }, + vf = { + names = { "vf", "virtual font", "virtual fonts" }, + variable = 'VFFONTS', + suffixes = { 'vf' }, + }, + otf = { + names = { "otf", "opentype", "opentype font", "opentype fonts"}, + variable = 'OPENTYPEFONTS', + suffixes = { 'otf' }, + }, + ttf = { + names = { "ttf", "truetype", "truetype font", "truetype fonts", "truetype collection", "truetype collections", "truetype dictionary", "truetype dictionaries" }, + variable = 'TTFONTS', + suffixes = { 'ttf', 'ttc', 'dfont' }, + }, + afm = { + names = { "afm", "adobe font metric", "adobe font metrics" }, + variable = "AFMFONTS", + suffixes = { "afm" }, + }, + pfb = { + names = { "pfb", "type1", "type 1", "type1 font", "type 1 font", "type1 fonts", "type 1 fonts" }, + variable = 'T1FONTS', + suffixes = { 'pfb', 'pfa' }, + }, + fea = { + names = { "fea", "font feature", "font features", "font feature file", "font feature files" }, + variable = 'FONTFEATURES', + suffixes = { 'fea' }, + }, + cid = { + names = { "cid", "cid map", "cid maps", "cid file", "cid files" }, + variable = 'FONTCIDMAPS', + suffixes = { 'cid', 'cidmap' }, + }, + fmt = { + names = { "fmt", "format", "tex format" }, + variable = 'TEXFORMATS', + suffixes = { 'fmt' }, + }, + mem = { -- will become obsolete + names = { 'mem', "metapost format" }, + variable = 'MPMEMS', + suffixes = { 'mem' }, + }, + mp = { + names = { "mp" }, + variable = 'MPINPUTS', + suffixes = { 'mp' }, + }, + tex = { + names = { "tex" }, + variable = 'TEXINPUTS', + suffixes = { 'tex', "mkiv", "mkiv", "mkii" }, + }, + icc = { + names = { "icc", "icc profile", "icc profiles" }, + variable = 'ICCPROFILES', + suffixes = { 'icc' }, + }, + texmfscripts = { + names = { "texmfscript", "texmfscripts", "script", "scripts" }, + variable = 'TEXMFSCRIPTS', + suffixes = { 'rb', 'pl', 'py' }, + }, + lua = { + names = { "lua" }, + variable = 'LUAINPUTS', + suffixes = { 'lua', 'luc', 'tma', 'tmc' }, + }, + lib = { + names = { "lib" }, + variable = 'CLUAINPUTS', + suffixes = os.libsuffix and { os.libsuffix } or { 'dll', 'so' }, + }, + bib = { + names = { 'bib' }, + suffixes = { 'bib' }, + }, + bst = { + names = { 'bst' }, + suffixes = { 'bst' }, + }, + fontconfig = { + names = { 'fontconfig', 'fontconfig file', 'fontconfig files' }, + variable = 'FONTCONFIG_PATH', + }, + }, + obsolete = { + enc = { + names = { "enc", "enc files", "enc file", "encoding files", "encoding file" }, + variable = 'ENCFONTS', + suffixes = { 'enc' }, + }, + map = { + names = { "map", "map files", "map file" }, + variable = 'TEXFONTMAPS', + suffixes = { 'map' }, + }, + lig = { + names = { "lig files", "lig file", "ligature file", "ligature files" }, + variable = 'LIGFONTS', + suffixes = { 'lig' }, + }, + opl = { + names = { "opl" }, + variable = 'OPLFONTS', + suffixes = { 'opl' }, + }, + ovp = { + names = { "ovp" }, + variable = 'OVPFONTS', + suffixes = { 'ovp' }, + }, + }, + kpse = { -- subset + base = { + names = { 'base', "metafont format" }, + variable = 'MFBASES', + suffixes = { 'base', 'bas' }, + }, + cmap = { + names = { 'cmap', 'cmap files', 'cmap file' }, + variable = 'CMAPFONTS', + suffixes = { 'cmap' }, + }, + cnf = { + names = { 'cnf' }, + suffixes = { 'cnf' }, + }, + web = { + names = { 'web' }, + suffixes = { 'web', 'ch' } + }, + cweb = { + names = { 'cweb' }, + suffixes = { 'w', 'web', 'ch' }, + }, + gf = { + names = { 'gf' }, + suffixes = { 'gf' }, + }, + mf = { + names = { 'mf' }, + variable = 'MFINPUTS', + suffixes = { 'mf' }, + }, + mft = { + names = { 'mft' }, + suffixes = { 'mft' }, + }, + pk = { + names = { 'pk' }, + suffixes = { 'pk' }, + }, + }, +} + +resolvers.relations = relations + +-- formats: maps a format onto a variable + +function resolvers.updaterelations() + for category, categories in next, relations do + for name, relation in next, categories do + local rn = relation.names + local rv = relation.variable + local rs = relation.suffixes + if rn and rv then + for i=1,#rn do + local rni = lower(gsub(rn[i]," ","")) + formats[rni] = rv + if rs then + suffixes[rni] = rs + for i=1,#rs do + local rsi = rs[i] + suffixmap[rsi] = rni + end + end + end + end + if rs then end end - texio.write_nl("") -- final newline - statistics.enable = false end end -function statistics.show_job_stat(tag,data,n) - texio.write_nl(format("%-15s: %s - %s","mkiv lua stats",tag:rpadd(n," "),data)) +resolvers.updaterelations() -- push this in the metatable -> newindex + +local function simplified(t,k) + return rawget(t,lower(gsub(k," ",""))) end -function statistics.memused() -- no math.round yet -) - local round = math.round or math.floor - return format("%s MB (ctx: %s MB)",round(collectgarbage("count")/1000), round(status.luastate_bytes/1000000)) +setmetatableindex(formats, simplified) +setmetatableindex(suffixes, simplified) +setmetatableindex(suffixmap, simplified) + +-- A few accessors, mostly for command line tool. + +function resolvers.suffixofformat(str) + local s = suffixes[str] + return s and s[1] or "" end -if statistics.runtime then - -- already loaded and set -elseif luatex and luatex.starttime then - statistics.starttime = luatex.starttime - statistics.loadtime = 0 - statistics.timing = 0 -else - statistics.starttiming(statistics) +function resolvers.suffixofformat(str) + return suffixes[str] or { } end -function statistics.runtime() - statistics.stoptiming(statistics) - return statistics.formatruntime(statistics.elapsedtime(statistics)) +for name, format in next, formats do + dangerous[name] = true -- still needed ? end -function statistics.formatruntime(runtime) - return format("%s seconds", statistics.elapsedtime(statistics)) -end +-- because vf searching is somewhat dangerous, we want to prevent +-- too liberal searching esp because we do a lookup on the current +-- path anyway; only tex (or any) is safe + +dangerous.tex = nil -function statistics.timed(action,report) - local timer = { } - report = report or logs.simple - statistics.starttiming(timer) - action() - statistics.stoptiming(timer) - report("total runtime: %s",statistics.elapsedtime(timer)) -end --- where, not really the best spot for this: +-- more helpers -commands = commands or { } +function resolvers.formatofvariable(str) + return formats[str] or '' +end -local timer +function resolvers.formatofsuffix(str) -- of file + return suffixmap[fileextname(str)] or 'tex' -- so many map onto tex (like mkiv, cld etc) +end -function commands.resettimer() - statistics.resettiming(timer) - statistics.starttiming(timer) +function resolvers.variableofformat(str) + return formats[str] or '' end -function commands.elapsedtime() - statistics.stoptiming(timer) - tex.sprint(statistics.elapsedtime(timer)) +function resolvers.variableofformatorsuffix(str) + local v = formats[str] + if v then + return v + end + v = suffixmap[fileextname(str)] + if v then + return formats[v] + end + return '' end -commands.resettimer() end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['trac-log'] = { - version = 1.001, - comment = "companion to trac-log.mkiv", +if not modules then modules = { } end modules ['data-tmp'] = { + version = 1.100, + comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } --- this is old code that needs an overhaul - ---~ io.stdout:setvbuf("no") ---~ io.stderr:setvbuf("no") - -local write_nl, write = texio.write_nl or print, texio.write or io.write -local format, gmatch = string.format, string.gmatch -local texcount = tex and tex.count - -if texlua then - write_nl = print - write = io.write -end - --[[ldx-- -

This is a prelude to a more extensive logging module. For the sake -of parsing log files, in addition to the standard logging we will -provide an structured file. Actually, any logging that -is hooked into callbacks will be \XML\ by default.

---ldx]]-- +

This module deals with caching data. It sets up the paths and +implements loaders and savers for tables. Best is to set the +following variable. When not set, the usual paths will be +checked. Personally I prefer the (users) temporary path.

-logs = logs or { } -logs.xml = logs.xml or { } -logs.tex = logs.tex or { } + +TEXMFCACHE=$TMP;$TEMP;$TMPDIR;$TEMPDIR;$HOME;$TEXMFVAR;$VARTEXMF;. + ---[[ldx-- -

This looks pretty ugly but we need to speed things up a bit.

+

Currently we do no locking when we write files. This is no real +problem because most caching involves fonts and the chance of them +being written at the same time is small. We also need to extend +luatools with a recache feature.

--ldx]]-- -logs.moreinfo = [[ -more information about ConTeXt and the tools that come with it can be found at: +local format, lower, gsub, concat = string.format, string.lower, string.gsub, table.concat +local mkdirs, isdir = dir.mkdirs, lfs.isdir -maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context -webpage : http://www.pragma-ade.nl / http://tex.aanhet.net -wiki : http://contextgarden.net -]] +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) -logs.levels = { - ['error'] = 1, - ['warning'] = 2, - ['info'] = 3, - ['debug'] = 4, -} +local report_caches = logs.reporter("resolvers","caches") +local report_resolvers = logs.reporter("resolvers","caching") -logs.functions = { - 'report', 'start', 'stop', 'push', 'pop', 'line', 'direct', - 'start_run', 'stop_run', - 'start_page_number', 'stop_page_number', - 'report_output_pages', 'report_output_log', - 'report_tex_stat', 'report_job_stat', - 'show_open', 'show_close', 'show_load', -} +local resolvers = resolvers -logs.tracers = { -} +-- intermezzo -logs.level = 0 -logs.mode = string.lower((os.getenv("MTX.LOG.MODE") or os.getenv("MTX_LOG_MODE") or "tex")) +local directive_cleanup = false directives.register("system.compile.cleanup", function(v) directive_cleanup = v end) +local directive_strip = true directives.register("system.compile.strip", function(v) directive_strip = v end) -function logs.set_level(level) - logs.level = logs.levels[level] or level -end +local compile = utilities.lua.compile -function logs.set_method(method) - for _, v in next, logs.functions do - logs[v] = logs[method][v] or function() end - end +function utilities.lua.compile(luafile,lucfile,cleanup,strip) + if cleanup == nil then cleanup = directive_cleanup end + if strip == nil then strip = directive_strip end + return compile(luafile,lucfile,cleanup,strip) end --- tex logging +-- end of intermezzo -function logs.tex.report(category,fmt,...) -- new - if fmt then - write_nl(category .. " | " .. format(fmt,...)) - else - write_nl(category .. " |") - end -end +caches = caches or { } +local caches = caches -function logs.tex.line(fmt,...) -- new - if fmt then - write_nl(format(fmt,...)) +caches.base = caches.base or "luatex-cache" +caches.more = caches.more or "context" +caches.direct = false -- true is faster but may need huge amounts of memory +caches.tree = false +caches.force = true +caches.ask = false +caches.relocate = false +caches.defaults = { "TMPDIR", "TEMPDIR", "TMP", "TEMP", "HOME", "HOMEPATH" } + +local writable, readables, usedreadables = nil, { }, { } + +-- we could use a metatable for writable and readable but not yet + +local function identify() + -- Combining the loops makes it messy. First we check the format cache path + -- and when the last component is not present we try to create it. + local texmfcaches = resolvers.cleanpathlist("TEXMFCACHE") + if texmfcaches then + for k=1,#texmfcaches do + local cachepath = texmfcaches[k] + if cachepath ~= "" then + cachepath = resolvers.resolve(cachepath) + cachepath = resolvers.cleanpath(cachepath) + cachepath = file.collapsepath(cachepath) + local valid = isdir(cachepath) + if valid then + if file.is_readable(cachepath) then + readables[#readables+1] = cachepath + if not writable and file.is_writable(cachepath) then + writable = cachepath + end + end + elseif not writable and caches.force then + local cacheparent = file.dirname(cachepath) + if file.is_writable(cacheparent) then + if not caches.ask or io.ask(format("\nShould I create the cache path %s?",cachepath), "no", { "yes", "no" }) == "yes" then + mkdirs(cachepath) + if isdir(cachepath) and file.is_writable(cachepath) then + report_caches("created: %s",cachepath) + writable = cachepath + readables[#readables+1] = cachepath + end + end + end + end + end + end + end + -- As a last resort we check some temporary paths but this time we don't + -- create them. + local texmfcaches = caches.defaults + if texmfcaches then + for k=1,#texmfcaches do + local cachepath = texmfcaches[k] + cachepath = resolvers.expansion(cachepath) -- was getenv + if cachepath ~= "" then + cachepath = resolvers.resolve(cachepath) + cachepath = resolvers.cleanpath(cachepath) + local valid = isdir(cachepath) + if valid and file.is_readable(cachepath) then + if not writable and file.is_writable(cachepath) then + readables[#readables+1] = cachepath + writable = cachepath + break + end + end + end + end + end + -- Some extra checking. If we have no writable or readable path then we simply + -- quit. + if not writable then + report_caches("fatal error: there is no valid writable cache path defined") + os.exit() + elseif #readables == 0 then + report_caches("fatal error: there is no valid readable cache path defined") + os.exit() + end + -- why here + writable = dir.expandname(resolvers.cleanpath(writable)) -- just in case + -- moved here + local base, more, tree = caches.base, caches.more, caches.tree or caches.treehash() -- we have only one writable tree + if tree then + caches.tree = tree + writable = mkdirs(writable,base,more,tree) + for i=1,#readables do + readables[i] = file.join(readables[i],base,more,tree) + end else - write_nl("") + writable = mkdirs(writable,base,more) + for i=1,#readables do + readables[i] = file.join(readables[i],base,more) + end end + -- end + if trace_cache then + for i=1,#readables do + report_caches("using readable path '%s' (order %s)",readables[i],i) + end + report_caches("using writable path '%s'",writable) + end + identify = function() + return writable, readables + end + return writable, readables end ---~ function logs.tex.start_page_number() ---~ local real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno ---~ if real > 0 then ---~ if user > 0 then ---~ if sub > 0 then ---~ write(format("[%s.%s.%s",real,user,sub)) ---~ else ---~ write(format("[%s.%s",real,user)) ---~ end ---~ else ---~ write(format("[%s",real)) ---~ end ---~ else ---~ write("[-") ---~ end ---~ end - ---~ function logs.tex.stop_page_number() ---~ write("]") ---~ end - -local real, user, sub - -function logs.tex.start_page_number() - real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno -end - -function logs.tex.stop_page_number() - if real > 0 then - if user > 0 then - if sub > 0 then - logs.report("pages", "flushing realpage %s, userpage %s, subpage %s",real,user,sub) - else - logs.report("pages", "flushing realpage %s, userpage %s",real,user) +function caches.usedpaths() + local writable, readables = identify() + if #readables > 1 then + local result = { } + for i=1,#readables do + local readable = readables[i] + if usedreadables[i] or readable == writable then + result[#result+1] = format("readable: '%s' (order %s)",readable,i) end - else - logs.report("pages", "flushing realpage %s",real) end + result[#result+1] = format("writable: '%s'",writable) + return result else - logs.report("pages", "flushing page") + return writable end - io.flush() end -logs.tex.report_job_stat = statistics.show_job_stat - --- xml logging +function caches.configfiles() + return table.concat(resolvers.instance.specification,";") +end -function logs.xml.report(category,fmt,...) -- new - if fmt then - write_nl(format("%s",category,format(fmt,...))) - else - write_nl(format("",category)) +function caches.hashed(tree) + tree = gsub(tree,"\\$","/") + tree = gsub(tree,"/+$","") + tree = lower(tree) + local hash = md5.hex(tree) + if trace_cache or trace_locating then + report_caches("hashing tree %s, hash %s",tree,hash) end + return hash end -function logs.xml.line(fmt,...) -- new - if fmt then - write_nl(format("%s",format(fmt,...))) + +function caches.treehash() + local tree = caches.configfiles() + if not tree or tree == "" then + return false else - write_nl("") + return caches.hashed(tree) end end -function logs.xml.start() if logs.level > 0 then tw("<%s>" ) end end -function logs.xml.stop () if logs.level > 0 then tw("") end end -function logs.xml.push () if logs.level > 0 then tw("" ) end end - -function logs.xml.start_run() - write_nl("") - write_nl("") -- xmlns='www.pragma-ade.com/luatex/schemas/context-job.rng' - write_nl("") -end +local r_cache, w_cache = { }, { } -- normally w in in r but who cares -function logs.xml.stop_run() - write_nl("") +local function getreadablepaths(...) -- we can optimize this as we have at most 2 tags + local tags = { ... } + local hash = concat(tags,"/") + local done = r_cache[hash] + if not done then + local writable, readables = identify() -- exit if not found + if #tags > 0 then + done = { } + for i=1,#readables do + done[i] = file.join(readables[i],...) + end + else + done = readables + end + r_cache[hash] = done + end + return done end -function logs.xml.start_page_number() - write_nl(format("

0 then + done = mkdirs(writable,...) + else + done = writable + end + w_cache[hash] = done + end + return done end -function logs.xml.stop_page_number() - write("/>") - write_nl("") -end +caches.getreadablepaths = getreadablepaths +caches.getwritablepath = getwritablepath -function logs.xml.report_output_pages(p,b) - write_nl(format("", p)) - write_nl(format("", b)) - write_nl("") +function caches.getfirstreadablefile(filename,...) + local rd = getreadablepaths(...) + for i=1,#rd do + local path = rd[i] + local fullname = file.join(path,filename) + if file.is_readable(fullname) then + usedreadables[i] = true + return fullname, path + end + end + return caches.setfirstwritablefile(filename,...) end -function logs.xml.report_output_log() +function caches.setfirstwritablefile(filename,...) + local wr = getwritablepath(...) + local fullname = file.join(wr,filename) + return fullname, wr end -function logs.xml.report_tex_stat(k,v) - texiowrite_nl("log",""..tostring(v).."") +function caches.define(category,subcategory) -- for old times sake + return function() + return getwritablepath(category,subcategory) + end end -local level = 0 - -function logs.xml.show_open(name) - level = level + 1 - texiowrite_nl(format("",level,name)) +function caches.setluanames(path,name) + return path .. "/" .. name .. ".tma", path .. "/" .. name .. ".tmc" end -function logs.xml.show_close(name) - texiowrite(" ") - level = level - 1 +function caches.loaddata(readables,name) + if type(readables) == "string" then + readables = { readables } + end + for i=1,#readables do + local path = readables[i] + local tmaname, tmcname = caches.setluanames(path,name) + local loader = loadfile(tmcname) or loadfile(tmaname) + if loader then + loader = loader() + collectgarbage("step") + return loader + end + end + return false end -function logs.xml.show_load(name) - texiowrite_nl(format("",level+1,name)) +function caches.is_writable(filepath,filename) + local tmaname, tmcname = caches.setluanames(filepath,filename) + return file.is_writable(tmaname) end --- - -local name, banner = 'report', 'context' +local saveoptions = { compact = true } -local function report(category,fmt,...) - if fmt then - write_nl(format("%s | %s: %s",name,category,format(fmt,...))) - elseif category then - write_nl(format("%s | %s",name,category)) - else - write_nl(format("%s |",name)) +function caches.savedata(filepath,filename,data,raw) + local tmaname, tmcname = caches.setluanames(filepath,filename) + local reduce, simplify = true, true + if raw then + reduce, simplify = false, false end -end - -local function simple(fmt,...) - if fmt then - write_nl(format("%s | %s",name,format(fmt,...))) + data.cache_uuid = os.uuid() + if caches.direct then + file.savedata(tmaname,table.serialize(data,true,saveoptions)) else - write_nl(format("%s |",name)) + table.tofile(tmaname,data,true,saveoptions) end + utilities.lua.compile(tmaname,tmcname) end -function logs.setprogram(_name_,_banner_,_verbose_) - name, banner = _name_, _banner_ - if _verbose_ then - trackers.enable("resolvers.locating") - end - logs.set_method("tex") - logs.report = report -- also used in libraries - logs.simple = simple -- only used in scripts ! - if utils then - utils.report = simple - end - logs.verbose = _verbose_ -end +-- moved from data-res: -function logs.setverbose(what) - if what then - trackers.enable("resolvers.locating") - else - trackers.disable("resolvers.locating") - end - logs.verbose = what or false -end +local content_state = { } -function logs.extendbanner(_banner_,_verbose_) - banner = banner .. " | ".. _banner_ - if _verbose_ ~= nil then - logs.setverbose(what) - end +function caches.contentstate() + return content_state or { } end -logs.verbose = false -logs.report = logs.tex.report -logs.simple = logs.tex.report - -function logs.reportlines(str) -- todo: - for line in gmatch(str,"(.-)[\n\r]") do - logs.report(line) +function caches.loadcontent(cachename,dataname) + local name = caches.hashed(cachename) + local full, path = caches.getfirstreadablefile(name ..".lua","trees") + local filename = file.join(path,name) + local blob = loadfile(filename .. ".luc") or loadfile(filename .. ".lua") + if blob then + local data = blob() + if data and data.content then + if data.type == dataname then + if data.version == resolvers.cacheversion then + content_state[#content_state+1] = data.uuid + if trace_locating then + report_resolvers("loading '%s' for '%s' from '%s'",dataname,cachename,filename) + end + return data.content + else + report_resolvers("skipping '%s' for '%s' from '%s' (version mismatch)",dataname,cachename,filename) + end + else + report_resolvers("skipping '%s' for '%s' from '%s' (datatype mismatch)",dataname,cachename,filename) + end + elseif trace_locating then + report_resolvers("skipping '%s' for '%s' from '%s' (no content)",dataname,cachename,filename) + end + elseif trace_locating then + report_resolvers("skipping '%s' for '%s' from '%s' (invalid file)",dataname,cachename,filename) end end -function logs.reportline() -- for scripts too - logs.report() -end - -logs.simpleline = logs.reportline - -function logs.reportbanner() -- for scripts too - logs.report(banner) -end - -function logs.help(message,option) - logs.reportbanner() - logs.reportline() - logs.reportlines(message) - local moreinfo = logs.moreinfo or "" - if moreinfo ~= "" and option ~= "nomoreinfo" then - logs.reportline() - logs.reportlines(moreinfo) +function caches.collapsecontent(content) + for k, v in next, content do + if type(v) == "table" and #v == 1 then + content[k] = v[1] + end end end -logs.set_level('error') -logs.set_method('tex') - -function logs.system(whereto,process,jobname,category,...) - for i=1,10 do - local f = io.open(whereto,"a") - if f then - f:write(format("%s %s => %s => %s => %s\r",os.date("%d/%m/%y %H:%m:%S"),process,jobname,category,format(...))) - f:close() - break +function caches.savecontent(cachename,dataname,content) + local name = caches.hashed(cachename) + local full, path = caches.setfirstwritablefile(name ..".lua","trees") + local filename = file.join(path,name) -- is full + local luaname, lucname = filename .. ".lua", filename .. ".luc" + if trace_locating then + report_resolvers("preparing '%s' for '%s'",dataname,cachename) + end + local data = { + type = dataname, + root = cachename, + version = resolvers.cacheversion, + date = os.date("%Y-%m-%d"), + time = os.date("%H:%M:%S"), + content = content, + uuid = os.uuid(), + } + local ok = io.savedata(luaname,table.serialize(data,true)) + if ok then + if trace_locating then + report_resolvers("category '%s', cachename '%s' saved in '%s'",dataname,cachename,luaname) + end + if utilities.lua.compile(luaname,lucname) then + if trace_locating then + report_resolvers("'%s' compiled to '%s'",dataname,lucname) + end + return true else - sleep(0.1) + if trace_locating then + report_resolvers("compiling failed for '%s', deleting file '%s'",dataname,lucname) + end + os.remove(lucname) end + elseif trace_locating then + report_resolvers("unable to save '%s' in '%s' (access error)",dataname,luaname) end end ---~ local syslogname = "oeps.xxx" ---~ ---~ for i=1,10 do ---~ logs.system(syslogname,"context","test","fonts","font %s recached due to newer version (%s)","blabla","123") ---~ end - -function logs.fatal(where,...) - logs.report(where,"fatal error: %s, aborting now",format(...)) - os.exit() -end - end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['data-inp'] = { - version = 1.001, +if not modules then modules = { } end modules ['data-met'] = { + version = 1.100, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files", + license = "see context related readme files" } --- After a few years using the code the large luat-inp.lua file --- has been split up a bit. In the process some functionality was --- dropped: --- --- * support for reading lsr files --- * selective scanning (subtrees) --- * some public auxiliary functions were made private --- --- TODO: os.getenv -> os.env[] --- TODO: instances.[hashes,cnffiles,configurations,522] --- TODO: check escaping in find etc, too much, too slow +local find, format = string.find, string.format +local sequenced = table.sequenced +local addurlscheme, urlhashed = url.addscheme, url.hashed --- This lib is multi-purpose and can be loaded again later on so that --- additional functionality becomes available. We will split thislogs.report("fileio", --- module in components once we're done with prototyping. This is the --- first code I wrote for LuaTeX, so it needs some cleanup. Before changing --- something in this module one can best check with Taco or Hans first; there --- is some nasty trickery going on that relates to traditional kpse support. +local trace_locating = false --- To be considered: hash key lowercase, first entry in table filename --- (any case), rest paths (so no need for optimization). Or maybe a --- separate table that matches lowercase names to mixed case when --- present. In that case the lower() cases can go away. I will do that --- only when we run into problems with names ... well ... Iwona-Regular. +trackers.register("resolvers.locating", function(v) trace_methods = v end) +trackers.register("resolvers.methods", function(v) trace_methods = v end) --- Beware, loading and saving is overloaded in luat-tmp! -local format, gsub, find, lower, upper, match, gmatch = string.format, string.gsub, string.find, string.lower, string.upper, string.match, string.gmatch -local concat, insert, sortedkeys = table.concat, table.insert, table.sortedkeys -local next, type = next, type -local lpegmatch = lpeg.match +local report_methods = logs.reporter("resolvers","methods") + +local allocate = utilities.storage.allocate -local trace_locating, trace_detail, trace_expansions = false, false, false +local resolvers = resolvers -trackers.register("resolvers.locating", function(v) trace_locating = v end) -trackers.register("resolvers.details", function(v) trace_detail = v end) -trackers.register("resolvers.expansions", function(v) trace_expansions = v end) -- todo +local registered = { } -if not resolvers then - resolvers = { - suffixes = { }, - formats = { }, - dangerous = { }, - suffixmap = { }, - alternatives = { }, - locators = { }, -- locate databases - hashers = { }, -- load databases - generators = { }, -- generate databases - } +local function splitmethod(filename) -- todo: filetype in specification + if not filename then + return { scheme = "unknown", original = filename } + end + if type(filename) == "table" then + return filename -- already split + end + filename = file.collapsepath(filename) + if not find(filename,"://") then + return { scheme = "file", path = filename, original = filename, filename = filename } + end + local specification = url.hashed(filename) + if not specification.scheme or specification.scheme == "" then + return { scheme = "file", path = filename, original = filename, filename = filename } + else + return specification + end end -local resolvers = resolvers +resolvers.splitmethod = splitmethod -- bad name but ok -resolvers.locators .notfound = { nil } -resolvers.hashers .notfound = { nil } -resolvers.generators.notfound = { nil } - -resolvers.cacheversion = '1.0.1' -resolvers.cnfname = 'texmf.cnf' -resolvers.luaname = 'texmfcnf.lua' -resolvers.homedir = os.env[os.type == "windows" and 'USERPROFILE'] or os.env['HOME'] or '~' -resolvers.cnfdefault = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c}' - -local dummy_path_expr = "^!*unset/*$" - -local formats = resolvers.formats -local suffixes = resolvers.suffixes -local dangerous = resolvers.dangerous -local suffixmap = resolvers.suffixmap -local alternatives = resolvers.alternatives - -formats['afm'] = 'AFMFONTS' suffixes['afm'] = { 'afm' } -formats['enc'] = 'ENCFONTS' suffixes['enc'] = { 'enc' } -formats['fmt'] = 'TEXFORMATS' suffixes['fmt'] = { 'fmt' } -formats['map'] = 'TEXFONTMAPS' suffixes['map'] = { 'map' } -formats['mp'] = 'MPINPUTS' suffixes['mp'] = { 'mp' } -formats['ocp'] = 'OCPINPUTS' suffixes['ocp'] = { 'ocp' } -formats['ofm'] = 'OFMFONTS' suffixes['ofm'] = { 'ofm', 'tfm' } -formats['otf'] = 'OPENTYPEFONTS' suffixes['otf'] = { 'otf' } -- 'ttf' -formats['opl'] = 'OPLFONTS' suffixes['opl'] = { 'opl' } -formats['otp'] = 'OTPINPUTS' suffixes['otp'] = { 'otp' } -formats['ovf'] = 'OVFFONTS' suffixes['ovf'] = { 'ovf', 'vf' } -formats['ovp'] = 'OVPFONTS' suffixes['ovp'] = { 'ovp' } -formats['tex'] = 'TEXINPUTS' suffixes['tex'] = { 'tex' } -formats['tfm'] = 'TFMFONTS' suffixes['tfm'] = { 'tfm' } -formats['ttf'] = 'TTFONTS' suffixes['ttf'] = { 'ttf', 'ttc', 'dfont' } -formats['pfb'] = 'T1FONTS' suffixes['pfb'] = { 'pfb', 'pfa' } -formats['vf'] = 'VFFONTS' suffixes['vf'] = { 'vf' } - -formats['fea'] = 'FONTFEATURES' suffixes['fea'] = { 'fea' } -formats['cid'] = 'FONTCIDMAPS' suffixes['cid'] = { 'cid', 'cidmap' } - -formats ['texmfscripts'] = 'TEXMFSCRIPTS' -- new -suffixes['texmfscripts'] = { 'rb', 'pl', 'py' } -- 'lua' - -formats ['lua'] = 'LUAINPUTS' -- new -suffixes['lua'] = { 'lua', 'luc', 'tma', 'tmc' } - --- backward compatible ones - -alternatives['map files'] = 'map' -alternatives['enc files'] = 'enc' -alternatives['cid maps'] = 'cid' -- great, why no cid files -alternatives['font feature files'] = 'fea' -- and fea files here -alternatives['opentype fonts'] = 'otf' -alternatives['truetype fonts'] = 'ttf' -alternatives['truetype collections'] = 'ttc' -alternatives['truetype dictionary'] = 'dfont' -alternatives['type1 fonts'] = 'pfb' - --- obscure ones - -formats ['misc fonts'] = '' -suffixes['misc fonts'] = { } - -formats ['sfd'] = 'SFDFONTS' -suffixes ['sfd'] = { 'sfd' } -alternatives['subfont definition files'] = 'sfd' - --- lib paths - -formats ['lib'] = 'CLUAINPUTS' -- new (needs checking) -suffixes['lib'] = (os.libsuffix and { os.libsuffix }) or { 'dll', 'so' } +-- the second argument is always analyzed (saves time later on) and the original +-- gets passed as original but also as argument --- In practice we will work within one tds tree, but i want to keep --- the option open to build tools that look at multiple trees, which is --- why we keep the tree specific data in a table. We used to pass the --- instance but for practical pusposes we now avoid this and use a --- instance variable. +local function methodhandler(what,first,...) -- filename can be nil or false + local method = registered[what] + if method then + local how, namespace = method.how, method.namespace + if how == "uri" or how == "url" then + local specification = splitmethod(first) + local scheme = specification.scheme + local resolver = namespace and namespace[scheme] + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, scheme=%s, argument=%s",what,how,scheme,first) + end + return resolver(specification,...) + else + resolver = namespace.default or namespace.file + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, default, argument=%s",what,how,first) + end + return resolver(specification,...) + elseif trace_methods then + report_methods("resolver: method=%s, how=%s, no handler",what,how) + end + end + elseif how == "tag" then + local resolver = namespace and namespace[first] + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, tag=%s",what,how,first) + end + return resolver(...) + else + resolver = namespace.default or namespace.file + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, default",what,how) + end + return resolver(...) + elseif trace_methods then + report_methods("resolver: method=%s, how=%s, unknown",what,how) + end + end + end + else + report_methods("resolver: method=%s, unknown",what) + end +end --- here we catch a few new thingies (todo: add these paths to context.tmf) --- --- FONTFEATURES = .;$TEXMF/fonts/fea// --- FONTCIDMAPS = .;$TEXMF/fonts/cid// +resolvers.methodhandler = methodhandler + +function resolvers.registermethod(name,namespace,how) + registered[name] = { how = how or "tag", namespace = namespace } + namespace["byscheme"] = function(scheme,filename,...) + if scheme == "file" then + return methodhandler(name,filename,...) + else + return methodhandler(name,addurlscheme(filename,scheme),...) + end + end +end --- we always have one instance active +local concatinators = allocate { notfound = file.join } -- concatinate paths +local locators = allocate { notfound = function() end } -- locate databases +local hashers = allocate { notfound = function() end } -- load databases +local generators = allocate { notfound = function() end } -- generate databases -resolvers.instance = resolvers.instance or nil -- the current one (slow access) -local instance = resolvers.instance or nil -- the current one (fast access) +resolvers.concatinators = concatinators +resolvers.locators = locators +resolvers.hashers = hashers +resolvers.generators = generators -function resolvers.newinstance() +local registermethod = resolvers.registermethod - -- store once, freeze and faster (once reset we can best use - -- instance.environment) maybe better have a register suffix - -- function +registermethod("concatinators",concatinators,"tag") +registermethod("locators", locators, "uri") +registermethod("hashers", hashers, "uri") +registermethod("generators", generators, "uri") - for k, v in next, suffixes do - for i=1,#v do - local vi = v[i] - if vi then - suffixmap[vi] = k - end - end - end - -- because vf searching is somewhat dangerous, we want to prevent - -- too liberal searching esp because we do a lookup on the current - -- path anyway; only tex (or any) is safe +end -- of closure - for k, v in next, formats do - dangerous[k] = true - end - dangerous.tex = nil +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-res'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +-- In practice we will work within one tds tree, but i want to keep +-- the option open to build tools that look at multiple trees, which is +-- why we keep the tree specific data in a table. We used to pass the +-- instance but for practical purposes we now avoid this and use a +-- instance variable. We always have one instance active (sort of global). + +-- todo: cache:/// home:/// + +local format, gsub, find, lower, upper, match, gmatch = string.format, string.gsub, string.find, string.lower, string.upper, string.match, string.gmatch +local concat, insert, sortedkeys = table.concat, table.insert, table.sortedkeys +local next, type, rawget = next, type, rawget +local os = os - -- the instance +local P, S, R, C, Cc, Cs, Ct, Carg = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Carg +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns - local newinstance = { - rootpath = '', - treepath = '', - progname = 'context', - engine = 'luatex', - format = '', - environment = { }, - variables = { }, - expansions = { }, - files = { }, - remap = { }, - configuration = { }, - setup = { }, - order = { }, - found = { }, - foundintrees = { }, - kpsevars = { }, - hashes = { }, - cnffiles = { }, - luafiles = { }, - lists = { }, - remember = true, - diskcache = true, - renewcache = false, - scandisk = true, - cachepath = nil, - loaderror = false, - sortdata = false, - savelists = true, - cleanuppaths = true, - allresults = false, - pattern = nil, -- lists - data = { }, -- only for loading - force_suffixes = true, - fakepaths = { }, - } +local filedirname = file.dirname +local filebasename = file.basename +local fileextname = file.extname +local filejoin = file.join +local collapsepath = file.collapsepath +local joinpath = file.joinpath +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex - local ne = newinstance.environment +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_detail = false trackers.register("resolvers.details", function(v) trace_detail = v end) +local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end) - for k,v in next, os.env do - ne[k] = resolvers.bare_variable(v) - end +local report_resolving = logs.reporter("resolvers","resolving") - return newinstance +local resolvers = resolvers -end +local expandedpathfromlist = resolvers.expandedpathfromlist +local checkedvariable = resolvers.checkedvariable +local splitconfigurationpath = resolvers.splitconfigurationpath +local methodhandler = resolvers.methodhandler -function resolvers.setinstance(someinstance) - instance = someinstance - resolvers.instance = someinstance - return someinstance -end +local initializesetter = utilities.setters.initialize -function resolvers.reset() - return resolvers.setinstance(resolvers.newinstance()) -end +local ostype, osname, osenv, ossetenv, osgetenv = os.type, os.name, os.env, os.setenv, os.getenv -local function reset_hashes() - instance.lists = { } - instance.found = { } -end +resolvers.cacheversion = '1.0.1' +resolvers.configbanner = '' +resolvers.homedir = environment.homedir +resolvers.criticalvars = allocate { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF", "TEXMF", "TEXOS" } +resolvers.luacnfname = 'texmfcnf.lua' +resolvers.luacnfstate = "unknown" -local function check_configuration() -- not yet ok, no time for debugging now - if os.env["OSFONTDIR"] then - -- ok - elseif os.type == "windows" then - os.setenv("OSFONTDIR","c:/windows/fonts//") - elseif os.type == "macosx" then - os.setenv("OSFONTDIR","$HOME/Library/Fonts//;/Library/Fonts//;/System/Library/Fonts//") - end -end +-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path +resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}' -function resolvers.bare_variable(str) -- assumes str is a string - return (gsub(str,"\s*([\"\']?)(.+)%1\s*", "%2")) -end -function resolvers.settrace(n) -- no longer number but: 'locating' or 'detail' - if n then - trackers.disable("resolvers.*") - trackers.enable("resolvers."..n) - end -end -resolvers.settrace(os.getenv("MTX_INPUT_TRACE")) +local unset_variable = "unset" -function resolvers.osenv(key) - local ie = instance.environment - local value = ie[key] - if value == nil then - -- local e = os.getenv(key) - local e = os.env[key] - if e == nil then - -- value = "" -- false - else - value = resolvers.bare_variable(e) - end - ie[key] = value - end - return value or "" -end +local formats = resolvers.formats +local suffixes = resolvers.suffixes +local dangerous = resolvers.dangerous +local suffixmap = resolvers.suffixmap -function resolvers.env(key) - return instance.environment[key] or resolvers.osenv(key) -end +resolvers.defaultsuffixes = { "tex" } -- "mkiv", "cld" -- too tricky --- +resolvers.instance = resolvers.instance or nil -- the current one (slow access) +local instance = resolvers.instance or nil -- the current one (fast access) -local function expand_vars(lst) -- simple vars - local variables, env = instance.variables, resolvers.env - local function resolve(a) - return variables[a] or env(a) - end - for k=1,#lst do - lst[k] = gsub(lst[k],"%$([%a%d%_%-]+)",resolve) - end -end +-- An instance has an environment (coming from the outside, kept raw), variables +-- (coming from the configuration file), and expansions (variables with nested +-- variables replaced). One can push something into the outer environment and +-- its internal copy, but only the later one will be the raw unprefixed variant. -local function expanded_var(var) -- simple vars - local function resolve(a) - return instance.variables[a] or resolvers.env(a) +function resolvers.setenv(key,value,raw) + if instance then + -- this one will be consulted first when we stay inside + -- the current environment + instance.environment[key] = value + -- we feed back into the environment, and as this is used + -- by other applications (via os.execute) we need to make + -- sure that prefixes are resolve + ossetenv(key,raw and value or resolvers.resolve(value)) end - return (gsub(var,"%$([%a%d%_%-]+)",resolve)) end -local function entry(entries,name) - if name and (name ~= "") then - name = gsub(name,'%$','') - local result = entries[name..'.'..instance.progname] or entries[name] - if result then - return result - else - result = resolvers.env(name) - if result then - instance.variables[name] = result - resolvers.expand_variables() - return instance.expansions[name] or "" - end - end - end - return "" -end +-- Beware we don't want empty here as this one can be called early on +-- and therefore we use rawget. -local function is_entry(entries,name) - if name and name ~= "" then - name = gsub(name,'%$','') - return (entries[name..'.'..instance.progname] or entries[name]) ~= nil +local function getenv(key) + local value = rawget(instance.environment,key) + if value and value ~= "" then + return value else - return false + local e = osgetenv(key) + return e ~= nil and e ~= "" and checkedvariable(e) or "" end end --- {a,b,c,d} --- a,b,c/{p,q,r},d --- a,b,c/{p,q,r}/d/{x,y,z}// --- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} --- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} --- a{b,c}{d,e}f --- {a,b,c,d} --- {a,b,c/{p,q,r},d} --- {a,b,c/{p,q,r}/d/{x,y,z}//} --- {a,b,c/{p,q/{x,y,z}},d/{p,q,r}} --- {a,b,c/{p,q/{x,y,z},w}v,d/{p,q,r}} --- {$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c} +resolvers.getenv = getenv +resolvers.env = getenv --- this one is better and faster, but it took me a while to realize --- that this kind of replacement is cleaner than messy parsing and --- fuzzy concatenating we can probably gain a bit with selectively --- applying lpeg, but experiments with lpeg parsing this proved not to --- work that well; the parsing is ok, but dealing with the resulting --- table is a pain because we need to work inside-out recursively +-- We are going to use some metatable trickery where we backtrack from +-- expansion to variable to environment. -local function do_first(a,b) - local t = { } - for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end - return "{" .. concat(t,",") .. "}" +local function resolve(k) + return instance.expansions[k] end -local function do_second(a,b) - local t = { } - for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end - return "{" .. concat(t,",") .. "}" -end +local dollarstripper = lpeg.stripper("$") +local inhibitstripper = P("!")^0 * Cs(P(1)^0) +local backslashswapper = lpeg.replacer("\\","/") -local function do_both(a,b) - local t = { } - for sa in gmatch(a,"[^,]+") do - for sb in gmatch(b,"[^,]+") do - t[#t+1] = sa .. sb - end - end - return "{" .. concat(t,",") .. "}" -end +local somevariable = P("$") / "" +local somekey = C(R("az","AZ","09","__","--")^1) +local somethingelse = P(";") * ((1-S("!{}/\\"))^1 * P(";") / "") + + P(";") * (P(";") / "") + + P(1) +local variableexpander = Cs( (somevariable * (somekey/resolve) + somethingelse)^1 ) -local function do_three(a,b,c) - return a .. b.. c -end +local cleaner = P("\\") / "/" + P(";") * S("!{}/\\")^0 * P(";")^1 / ";" +local variablecleaner = Cs((cleaner + P(1))^0) -local function splitpathexpr(str, t, validate) - -- no need for further optimization as it is only called a - -- few times, we can use lpeg for the sub - if trace_expansions then - logs.report("fileio","expanding variable '%s'",str) - end - t = t or { } - str = gsub(str,",}",",@}") - str = gsub(str,"{,","{@,") - -- str = "@" .. str .. "@" - local ok, done - while true do - done = false - while true do - str, ok = gsub(str,"([^{},]+){([^{}]+)}",do_first) - if ok > 0 then done = true else break end - end - while true do - str, ok = gsub(str,"{([^{}]+)}([^{},]+)",do_second) - if ok > 0 then done = true else break end - end - while true do - str, ok = gsub(str,"{([^{}]+)}{([^{}]+)}",do_both) - if ok > 0 then done = true else break end - end - str, ok = gsub(str,"({[^{}]*){([^{}]+)}([^{}]*})",do_three) - if ok > 0 then done = true end - if not done then break end - end - str = gsub(str,"[{}]", "") - str = gsub(str,"@","") - if validate then - for s in gmatch(str,"[^,]+") do - s = validate(s) - if s then t[#t+1] = s end - end - else - for s in gmatch(str,"[^,]+") do - t[#t+1] = s - end - end - if trace_expansions then - for k=1,#t do - logs.report("fileio","% 4i: %s",k,t[k]) - end - end - return t -end +local somevariable = R("az","AZ","09","__","--")^1 / resolve +local variable = (P("$")/"") * (somevariable + (P("{")/"") * somevariable * (P("}")/"")) +local variableresolver = Cs((variable + P(1))^0) -local function expanded_path_from_list(pathlist) -- maybe not a list, just a path - -- a previous version fed back into pathlist - local newlist, ok = { }, false - for k=1,#pathlist do - if find(pathlist[k],"[{}]") then - ok = true - break - end - end - if ok then - local function validate(s) - s = file.collapse_path(s) - return s ~= "" and not find(s,dummy_path_expr) and s - end - for k=1,#pathlist do - splitpathexpr(pathlist[k],newlist,validate) - end - else - for k=1,#pathlist do - for p in gmatch(pathlist[k],"([^,]+)") do - p = file.collapse_path(p) - if p ~= "" then newlist[#newlist+1] = p end - end - end - end - return newlist +local function expandedvariable(var) + return lpegmatch(variableexpander,var) or var end --- we follow a rather traditional approach: --- --- (1) texmf.cnf given in TEXMFCNF --- (2) texmf.cnf searched in default variable --- --- also we now follow the stupid route: if not set then just assume *one* --- cnf file under texmf (i.e. distribution) +function resolvers.newinstance() -- todo: all vars will become lowercase and alphanum only -local args = environment and environment.original_arguments or arg -- this needs a cleanup + if trace_locating then + report_resolving("creating instance") + end -resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex" -resolvers.ownbin = gsub(resolvers.ownbin,"\\","/") + local environment, variables, expansions, order = allocate(), allocate(), allocate(), allocate() -function resolvers.getownpath() - local ownpath = resolvers.ownpath or os.selfdir - if not ownpath or ownpath == "" or ownpath == "unset" then - ownpath = args[-1] or arg[-1] - ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/")) - if not ownpath or ownpath == "" then - ownpath = args[-0] or arg[-0] - ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/")) - end - local binary = resolvers.ownbin - if not ownpath or ownpath == "" then - ownpath = ownpath and file.dirname(binary) - end - if not ownpath or ownpath == "" then - if os.binsuffix ~= "" then - binary = file.replacesuffix(binary,os.binsuffix) - end - for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do - local b = file.join(p,binary) - if lfs.isfile(b) then - -- we assume that after changing to the path the currentdir function - -- resolves to the real location and use this side effect here; this - -- trick is needed because on the mac installations use symlinks in the - -- path instead of real locations - local olddir = lfs.currentdir() - if lfs.chdir(p) then - local pp = lfs.currentdir() - if trace_locating and p ~= pp then - logs.report("fileio","following symlink '%s' to '%s'",p,pp) - end - ownpath = pp - lfs.chdir(olddir) - else - if trace_locating then - logs.report("fileio","unable to check path '%s'",p) - end - ownpath = p - end - break - end + local newinstance = { + environment = environment, + variables = variables, + expansions = expansions, + order = order, + files = allocate(), + setups = allocate(), + found = allocate(), + foundintrees = allocate(), + hashes = allocate(), + hashed = allocate(), + specification = allocate(), + lists = allocate(), + data = allocate(), -- only for loading + fakepaths = allocate(), + remember = true, + diskcache = true, + renewcache = false, + loaderror = false, + savelists = true, + pattern = nil, -- lists + force_suffixes = true, + } + + setmetatableindex(variables,function(t,k) + local v + for i=1,#order do + v = order[i][k] + if v ~= nil then + t[k] = v + return v end end - if not ownpath or ownpath == "" then - ownpath = "." - logs.report("fileio","forcing fallback ownpath .") - elseif trace_locating then - logs.report("fileio","using ownpath '%s'",ownpath) + if v == nil then + v = "" end - end - resolvers.ownpath = ownpath - function resolvers.getownpath() - return resolvers.ownpath - end - return ownpath -end - -local own_places = { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF" } + t[k] = v + return v + end) -local function identify_own() - local ownpath = resolvers.getownpath() or dir.current() - local ie = instance.environment - if ownpath then - if resolvers.env('SELFAUTOLOC') == "" then os.env['SELFAUTOLOC'] = file.collapse_path(ownpath) end - if resolvers.env('SELFAUTODIR') == "" then os.env['SELFAUTODIR'] = file.collapse_path(ownpath .. "/..") end - if resolvers.env('SELFAUTOPARENT') == "" then os.env['SELFAUTOPARENT'] = file.collapse_path(ownpath .. "/../..") end - else - logs.report("fileio","error: unable to locate ownpath") - os.exit() - end - if resolvers.env('TEXMFCNF') == "" then os.env['TEXMFCNF'] = resolvers.cnfdefault end - if resolvers.env('TEXOS') == "" then os.env['TEXOS'] = resolvers.env('SELFAUTODIR') end - if resolvers.env('TEXROOT') == "" then os.env['TEXROOT'] = resolvers.env('SELFAUTOPARENT') end - if trace_locating then - for i=1,#own_places do - local v = own_places[i] - logs.report("fileio","variable '%s' set to '%s'",v,resolvers.env(v) or "unknown") + setmetatableindex(environment, function(t,k) + local v = osgetenv(k) + if v == nil then + v = variables[k] end - end - identify_own = function() end -end - -function resolvers.identify_cnf() - if #instance.cnffiles == 0 then - -- fallback - identify_own() - -- the real search - resolvers.expand_variables() - local t = resolvers.split_path(resolvers.env('TEXMFCNF')) - t = expanded_path_from_list(t) - expand_vars(t) -- redundant - local function locate(filename,list) - for i=1,#t do - local ti = t[i] - local texmfcnf = file.collapse_path(file.join(ti,filename)) - if lfs.isfile(texmfcnf) then - list[#list+1] = texmfcnf - end - end + if v ~= nil then + v = checkedvariable(v) or "" end - locate(resolvers.luaname,instance.luafiles) - locate(resolvers.cnfname,instance.cnffiles) - end -end + v = resolvers.repath(v) -- for taco who has a : separated osfontdir + t[k] = v + return v + end) -local function load_cnf_file(fname) - fname = resolvers.clean_path(fname) - local lname = file.replacesuffix(fname,'lua') - if lfs.isfile(lname) then - local dname = file.dirname(fname) -- fname ? - if not instance.configuration[dname] then - resolvers.load_data(dname,'configuration',lname and file.basename(lname)) - instance.order[#instance.order+1] = instance.configuration[dname] - end - else - f = io.open(fname) - if f then - if trace_locating then - logs.report("fileio","loading configuration file %s", fname) - end - local line, data, n, k, v - local dname = file.dirname(fname) - if not instance.configuration[dname] then - instance.configuration[dname] = { } - instance.order[#instance.order+1] = instance.configuration[dname] - end - local data = instance.configuration[dname] - while true do - local line, n = f:read(), 0 - if line then - while true do -- join lines - line, n = gsub(line,"\\%s*$", "") - if n > 0 then - line = line .. f:read() - else - break - end - end - if not find(line,"^[%%#]") then - local l = gsub(line,"%s*%%.*$","") - local k, v = match(l,"%s*(.-)%s*=%s*(.-)%s*$") - if k and v and not data[k] then - v = gsub(v,"[%%#].*",'') - data[k] = gsub(v,"~","$HOME") - instance.kpsevars[k] = true - end - end - else - break - end - end - f:close() - elseif trace_locating then - logs.report("fileio","skipping configuration file '%s'", fname) + setmetatableindex(expansions, function(t,k) + local v = environment[k] + if type(v) == "string" then + v = lpegmatch(variableresolver,v) + v = lpegmatch(variablecleaner,v) end - end + t[k] = v + return v + end) + + return newinstance + end -local function collapse_cnf_data() -- potential optimization: pass start index (setup and configuration are shared) - local order = instance.order - for i=1,#order do - local c = order[i] - for k,v in next, c do - if not instance.variables[k] then - if instance.environment[k] then - instance.variables[k] = instance.environment[k] - else - instance.kpsevars[k] = true - instance.variables[k] = resolvers.bare_variable(v) - end - end - end - end +function resolvers.setinstance(someinstance) -- only one instance is active + instance = someinstance + resolvers.instance = someinstance + return someinstance end -function resolvers.load_cnf() - local function loadoldconfigdata() - local cnffiles = instance.cnffiles - for i=1,#cnffiles do - load_cnf_file(cnffiles[i]) - end - end - -- instance.cnffiles contain complete names now ! - -- we still use a funny mix of cnf and new but soon - -- we will switch to lua exclusively as we only use - -- the file to collect the tree roots - if #instance.cnffiles == 0 then - if trace_locating then - logs.report("fileio","no cnf files found (TEXMFCNF may not be set/known)") - end - else - local cnffiles = instance.cnffiles - instance.rootpath = cnffiles[1] - for k=1,#cnffiles do - instance.cnffiles[k] = file.collapse_path(cnffiles[k]) - end - for i=1,3 do - instance.rootpath = file.dirname(instance.rootpath) - end - instance.rootpath = file.collapse_path(instance.rootpath) - if instance.diskcache and not instance.renewcache then - resolvers.loadoldconfig(instance.cnffiles) - if instance.loaderror then - loadoldconfigdata() - resolvers.saveoldconfig() - end - else - loadoldconfigdata() - if instance.renewcache then - resolvers.saveoldconfig() - end - end - collapse_cnf_data() - end - check_configuration() +function resolvers.reset() + return resolvers.setinstance(resolvers.newinstance()) end -function resolvers.load_lua() - if #instance.luafiles == 0 then - -- yet harmless - else - instance.rootpath = instance.luafiles[1] - local luafiles = instance.luafiles - for k=1,#luafiles do - instance.luafiles[k] = file.collapse_path(luafiles[k]) - end - for i=1,3 do - instance.rootpath = file.dirname(instance.rootpath) - end - instance.rootpath = file.collapse_path(instance.rootpath) - resolvers.loadnewconfig() - collapse_cnf_data() - end - check_configuration() +local function reset_hashes() + instance.lists = { } + instance.found = { } end --- database loading +local slash = P("/") -function resolvers.load_hash() - resolvers.locatelists() - if instance.diskcache and not instance.renewcache then - resolvers.loadfiles() - if instance.loaderror then - resolvers.loadlists() - resolvers.savefiles() - end +local pathexpressionpattern = Cs ( + Cc("^") * ( + Cc("%") * S(".-") + + slash^2 * P(-1) / "/.*" + + slash^2 / "/.-/" + + (1-slash) * P(-1) * Cc("/") + + P(1) + )^1 * Cc("$") -- yes or no $ +) + +local cache = { } + +local function makepathexpression(str) + if str == "." then + return "^%./$" else - resolvers.loadlists() - if instance.renewcache then - resolvers.savefiles() + local c = cache[str] + if not c then + c = lpegmatch(pathexpressionpattern,str) + cache[str] = c end + return c end end -function resolvers.append_hash(type,tag,name) - if trace_locating then - logs.report("fileio","hash '%s' appended",tag) - end - insert(instance.hashes, { ['type']=type, ['tag']=tag, ['name']=name } ) -end - -function resolvers.prepend_hash(type,tag,name) +local function reportcriticalvariables() if trace_locating then - logs.report("fileio","hash '%s' prepended",tag) - end - insert(instance.hashes, 1, { ['type']=type, ['tag']=tag, ['name']=name } ) -end - -function resolvers.extend_texmf_var(specification) -- crap, we could better prepend the hash --- local t = resolvers.expanded_path_list('TEXMF') -- full expansion - local t = resolvers.split_path(resolvers.env('TEXMF')) - insert(t,1,specification) - local newspec = concat(t,";") - if instance.environment["TEXMF"] then - instance.environment["TEXMF"] = newspec - elseif instance.variables["TEXMF"] then - instance.variables["TEXMF"] = newspec - else - -- weird + for i=1,#resolvers.criticalvars do + local k = resolvers.criticalvars[i] + local v = resolvers.getenv(k) or "unknown" -- this one will not resolve ! + report_resolving("variable '%s' set to '%s'",k,v) + end + report_resolving() end - resolvers.expand_variables() - reset_hashes() + reportcriticalvariables = function() end end --- locators - -function resolvers.locatelists() - local texmfpaths = resolvers.clean_path_list('TEXMF') - for i=1,#texmfpaths do - local path = texmfpaths[i] +local function identify_configuration_files() + local specification = instance.specification + if #specification == 0 then + local cnfspec = getenv('TEXMFCNF') + if cnfspec == "" then + cnfspec = resolvers.luacnfspec + resolvers.luacnfstate = "default" + else + resolvers.luacnfstate = "environment" + end + reportcriticalvariables() + local cnfpaths = expandedpathfromlist(resolvers.splitpath(cnfspec)) + local luacnfname = resolvers.luacnfname + for i=1,#cnfpaths do + local filename = collapsepath(filejoin(cnfpaths[i],luacnfname)) + local realname = resolvers.resolve(filename) + if lfs.isfile(realname) then + specification[#specification+1] = filename + if trace_locating then + report_resolving("found configuration file '%s'",realname) + end + elseif trace_locating then + report_resolving("unknown configuration file '%s'",realname) + end + end if trace_locating then - logs.report("fileio","locating list of '%s'",path) + report_resolving() end - resolvers.locatedatabase(file.collapse_path(path)) - end -end - -function resolvers.locatedatabase(specification) - return resolvers.methodhandler('locators', specification) -end + elseif trace_locating then + report_resolving("configuration files already identified") + end +end + +local function load_configuration_files() + local specification = instance.specification + if #specification > 0 then + local luacnfname = resolvers.luacnfname + for i=1,#specification do + local filename = specification[i] + local pathname = filedirname(filename) + local filename = filejoin(pathname,luacnfname) + local realname = resolvers.resolve(filename) -- no shortcut + local blob = loadfile(realname) + if blob then + local setups = instance.setups + local data = blob() + data = data and data.content + if data then + if trace_locating then + report_resolving("loading configuration file '%s'",filename) + report_resolving() + end + local variables = data.variables or { } + local warning = false + for k, v in next, data do + local variant = type(v) + if variant == "table" then + initializesetter(filename,k,v) + elseif variables[k] == nil then + if trace_locating and not warning then + report_resolving("variables like '%s' in configuration file '%s' should move to the 'variables' subtable", + k,resolvers.resolve(filename)) + warning = true + end + variables[k] = v + end + end + setups[pathname] = variables + if resolvers.luacnfstate == "default" then + -- the following code is not tested + local cnfspec = variables["TEXMFCNF"] + if cnfspec then + if trace_locating then + report_resolving("reloading configuration due to TEXMF redefinition") + end + -- we push the value into the main environment (osenv) so + -- that it takes precedence over the default one and therefore + -- also over following definitions + resolvers.setenv('TEXMFCNF',cnfspec) -- resolves prefixes + -- we now identify and load the specified configuration files + instance.specification = { } + identify_configuration_files() + load_configuration_files() + -- we prevent further overload of the configuration variable + resolvers.luacnfstate = "configuration" + -- we quit the outer loop + break + end + end -function resolvers.locators.tex(specification) - if specification and specification ~= '' and lfs.isdir(specification) then - if trace_locating then - logs.report("fileio","tex locator '%s' found",specification) + else + if trace_locating then + report_resolving("skipping configuration file '%s' (no content)",filename) + end + setups[pathname] = { } + instance.loaderror = true + end + elseif trace_locating then + report_resolving("skipping configuration file '%s' (no file)",filename) + end + instance.order[#instance.order+1] = instance.setups[pathname] + if instance.loaderror then + break + end end - resolvers.append_hash('file',specification,filename) elseif trace_locating then - logs.report("fileio","tex locator '%s' not found",specification) + report_resolving("warning: no lua configuration files found") end end --- hashers - -function resolvers.hashdatabase(tag,name) - return resolvers.methodhandler('hashers',tag,name) -end +-- scheme magic ... database loading -function resolvers.loadfiles() - instance.loaderror = false - instance.files = { } +local function load_file_databases() + instance.loaderror, instance.files = false, allocate() if not instance.renewcache then local hashes = instance.hashes for k=1,#hashes do local hash = hashes[k] - resolvers.hashdatabase(hash.tag,hash.name) + resolvers.hashers.byscheme(hash.type,hash.name) if instance.loaderror then break end end end end -function resolvers.hashers.tex(tag,name) - resolvers.load_data(tag,'files') -end - --- generators: - -function resolvers.loadlists() - local hashes = instance.hashes - for i=1,#hashes do - resolvers.generatedatabase(hashes[i].tag) - end -end - -function resolvers.generatedatabase(specification) - return resolvers.methodhandler('generators', specification) -end - --- starting with . or .. etc or funny char - -local weird = lpeg.P(".")^1 + lpeg.anywhere(lpeg.S("~`!#$%^&*()={}[]:;\"\'||<>,?\n\r\t")) - ---~ local l_forbidden = lpeg.S("~`!#$%^&*()={}[]:;\"\'||\\/<>,?\n\r\t") ---~ local l_confusing = lpeg.P(" ") ---~ local l_character = lpeg.patterns.utf8 ---~ local l_dangerous = lpeg.P(".") - ---~ local l_normal = (l_character - l_forbidden - l_confusing - l_dangerous) * (l_character - l_forbidden - l_confusing^2)^0 * lpeg.P(-1) ---~ ----- l_normal = l_normal * lpeg.Cc(true) + lpeg.Cc(false) - ---~ local function test(str) ---~ print(str,lpeg.match(l_normal,str)) ---~ end ---~ test("ヒラギノ明朝 Pro W3") ---~ test("..ヒラギノ明朝 Pro W3") ---~ test(":ヒラギノ明朝 Pro W3;") ---~ test("ヒラギノ明朝 /Pro W3;") ---~ test("ヒラギノ明朝 Pro W3") - -function resolvers.generators.tex(specification) - local tag = specification - if trace_locating then - logs.report("fileio","scanning path '%s'",specification) - end - instance.files[tag] = { } - local files = instance.files[tag] - local n, m, r = 0, 0, 0 - local spec = specification .. '/' - local attributes = lfs.attributes - local directory = lfs.dir - local function action(path) - local full - if path then - full = spec .. path .. '/' - else - full = spec - end - for name in directory(full) do - if not lpegmatch(weird,name) then - -- if lpegmatch(l_normal,name) then - local mode = attributes(full..name,'mode') - if mode == 'file' then - if path then - n = n + 1 - local f = files[name] - if f then - if type(f) == 'string' then - files[name] = { f, path } - else - f[#f+1] = path - end - else -- probably unique anyway - files[name] = path - local lower = lower(name) - if name ~= lower then - files["remap:"..lower] = name - r = r + 1 - end - end - end - elseif mode == 'directory' then - m = m + 1 - if path then - action(path..'/'..name) +local function locate_file_databases() + -- todo: cache:// and tree:// (runtime) + local texmfpaths = resolvers.expandedpathlist('TEXMF') + if #texmfpaths > 0 then + for i=1,#texmfpaths do + local path = collapsepath(texmfpaths[i]) + local stripped = lpegmatch(inhibitstripper,path) -- the !! thing + if stripped ~= "" then + local runtime = stripped == path + path = resolvers.cleanpath(path) + local spec = resolvers.splitmethod(stripped) + if spec.scheme == "cache" or spec.scheme == "file" then + stripped = spec.path + elseif runtime and (spec.noscheme or spec.scheme == "file") then + stripped = "tree:///" .. stripped + end + if trace_locating then + if runtime then + report_resolving("locating list of '%s' (runtime)",path) else - action(name) + report_resolving("locating list of '%s' (cached)",path) end end + methodhandler('locators',stripped) end end - end - action() - if trace_locating then - logs.report("fileio","%s files found on %s directories with %s uppercase remappings",n,m,r) + if trace_locating then + report_resolving() + end + elseif trace_locating then + report_resolving("no texmf paths are defined (using TEXMF)") end end --- savers, todo - -function resolvers.savefiles() - resolvers.save_data('files') +local function generate_file_databases() + local hashes = instance.hashes + for k=1,#hashes do + local hash = hashes[k] + methodhandler('generators',hash.name) + end + if trace_locating then + report_resolving() + end end --- A config (optionally) has the paths split in tables. Internally --- we join them and split them after the expansion has taken place. This --- is more convenient. - ---~ local checkedsplit = string.checkedsplit - -local cache = { } - -local splitter = lpeg.Ct(lpeg.splitat(lpeg.S(os.type == "windows" and ";" or ":;"))) - -local function split_kpse_path(str) -- beware, this can be either a path or a {specification} - local found = cache[str] - if not found then - if str == "" then - found = { } - else - str = gsub(str,"\\","/") ---~ local split = (find(str,";") and checkedsplit(str,";")) or checkedsplit(str,io.pathseparator) -local split = lpegmatch(splitter,str) - found = { } - for i=1,#split do - local s = split[i] - if not find(s,"^{*unset}*") then - found[#found+1] = s - end - end - if trace_expansions then - logs.report("fileio","splitting path specification '%s'",str) - for k=1,#found do - logs.report("fileio","% 4i: %s",k,found[k]) - end +local function save_file_databases() -- will become cachers + for i=1,#instance.hashes do + local hash = instance.hashes[i] + local cachename = hash.name + if hash.cache then + local content = instance.files[cachename] + caches.collapsecontent(content) + if trace_locating then + report_resolving("saving tree '%s'",cachename) end - cache[str] = found + caches.savecontent(cachename,"files",content) + elseif trace_locating then + report_resolving("not saving runtime tree '%s'",cachename) end end - return found end -resolvers.split_kpse_path = split_kpse_path - -function resolvers.splitconfig() - for i=1,#instance do - local c = instance[i] - for k,v in next, c do - if type(v) == 'string' then - local t = split_kpse_path(v) - if #t > 1 then - c[k] = t - end - end +local function load_databases() + locate_file_databases() + if instance.diskcache and not instance.renewcache then + load_file_databases() + if instance.loaderror then + generate_file_databases() + save_file_databases() + end + else + generate_file_databases() + if instance.renewcache then + save_file_databases() end end end -function resolvers.joinconfig() - local order = instance.order - for i=1,#order do - local c = order[i] - for k,v in next, c do -- indexed? - if type(v) == 'table' then - c[k] = file.join_path(v) - end +function resolvers.appendhash(type,name,cache) + -- safeguard ... tricky as it's actually a bug when seen twice + if not instance.hashed[name] then + if trace_locating then + report_resolving("hash '%s' appended",name) end + insert(instance.hashes, { type = type, name = name, cache = cache } ) + instance.hashed[name] = cache end end -function resolvers.split_path(str) - if type(str) == 'table' then - return str - else - return split_kpse_path(str) +function resolvers.prependhash(type,name,cache) + -- safeguard ... tricky as it's actually a bug when seen twice + if not instance.hashed[name] then + if trace_locating then + report_resolving("hash '%s' prepended",name) + end + insert(instance.hashes, 1, { type = type, name = name, cache = cache } ) + instance.hashed[name] = cache end end -function resolvers.join_path(str) - if type(str) == 'table' then - return file.join_path(str) +function resolvers.extendtexmfvariable(specification) -- crap, we could better prepend the hash + local t = resolvers.splitpath(getenv('TEXMF')) + insert(t,1,specification) + local newspec = concat(t,";") + if instance.environment["TEXMF"] then + instance.environment["TEXMF"] = newspec + elseif instance.variables["TEXMF"] then + instance.variables["TEXMF"] = newspec else - return str + -- weird end + reset_hashes() end function resolvers.splitexpansions() local ie = instance.expansions for k,v in next, ie do - local t, h, p = { }, { }, split_kpse_path(v) + local t, tn, h, p = { }, 0, { }, splitconfigurationpath(v) for kk=1,#p do local vv = p[kk] if vv ~= "" and not h[vv] then - t[#t+1] = vv + tn = tn + 1 + t[tn] = vv h[vv] = true end end @@ -9184,343 +11600,92 @@ end -- end of split/join code -function resolvers.saveoldconfig() - resolvers.splitconfig() - resolvers.save_data('configuration') - resolvers.joinconfig() -end - -resolvers.configbanner = [[ --- This is a Luatex configuration file created by 'luatools.lua' or --- 'luatex.exe' directly. For comment, suggestions and questions you can --- contact the ConTeXt Development Team. This configuration file is --- not copyrighted. [HH & TH] -]] - -function resolvers.serialize(files) - -- This version is somewhat optimized for the kind of - -- tables that we deal with, so it's much faster than - -- the generic serializer. This makes sense because - -- luatools and mtxtools are called frequently. Okay, - -- we pay a small price for properly tabbed tables. - local t = { } - local function dump(k,v,m) -- could be moved inline - if type(v) == 'string' then - return m .. "['" .. k .. "']='" .. v .. "'," - elseif #v == 1 then - return m .. "['" .. k .. "']='" .. v[1] .. "'," - else - return m .. "['" .. k .. "']={'" .. concat(v,"','").. "'}," - end - end - t[#t+1] = "return {" - if instance.sortdata then - local sortedfiles = sortedkeys(files) - for i=1,#sortedfiles do - local k = sortedfiles[i] - local fk = files[k] - if type(fk) == 'table' then - t[#t+1] = "\t['" .. k .. "']={" - local sortedfk = sortedkeys(fk) - for j=1,#sortedfk do - local kk = sortedfk[j] - t[#t+1] = dump(kk,fk[kk],"\t\t") - end - t[#t+1] = "\t}," - else - t[#t+1] = dump(k,fk,"\t") - end - end - else - for k, v in next, files do - if type(v) == 'table' then - t[#t+1] = "\t['" .. k .. "']={" - for kk,vv in next, v do - t[#t+1] = dump(kk,vv,"\t\t") - end - t[#t+1] = "\t}," - else - t[#t+1] = dump(k,v,"\t") - end - end - end - t[#t+1] = "}" - return concat(t,"\n") -end - -local data_state = { } - -function resolvers.data_state() - return data_state or { } -end - -function resolvers.save_data(dataname, makename) -- untested without cache overload - for cachename, files in next, instance[dataname] do - local name = (makename or file.join)(cachename,dataname) - local luaname, lucname = name .. ".lua", name .. ".luc" - if trace_locating then - logs.report("fileio","preparing '%s' for '%s'",dataname,cachename) - end - for k, v in next, files do - if type(v) == "table" and #v == 1 then - files[k] = v[1] - end - end - local data = { - type = dataname, - root = cachename, - version = resolvers.cacheversion, - date = os.date("%Y-%m-%d"), - time = os.date("%H:%M:%S"), - content = files, - uuid = os.uuid(), - } - local ok = io.savedata(luaname,resolvers.serialize(data)) - if ok then - if trace_locating then - logs.report("fileio","'%s' saved in '%s'",dataname,luaname) - end - if utils.lua.compile(luaname,lucname,false,true) then -- no cleanup but strip - if trace_locating then - logs.report("fileio","'%s' compiled to '%s'",dataname,lucname) - end - else - if trace_locating then - logs.report("fileio","compiling failed for '%s', deleting file '%s'",dataname,lucname) - end - os.remove(lucname) - end - elseif trace_locating then - logs.report("fileio","unable to save '%s' in '%s' (access error)",dataname,luaname) - end - end -end - -function resolvers.load_data(pathname,dataname,filename,makename) -- untested without cache overload - filename = ((not filename or (filename == "")) and dataname) or filename - filename = (makename and makename(dataname,filename)) or file.join(pathname,filename) - local blob = loadfile(filename .. ".luc") or loadfile(filename .. ".lua") - if blob then - local data = blob() - if data and data.content and data.type == dataname and data.version == resolvers.cacheversion then - data_state[#data_state+1] = data.uuid - if trace_locating then - logs.report("fileio","loading '%s' for '%s' from '%s'",dataname,pathname,filename) - end - instance[dataname][pathname] = data.content - else - if trace_locating then - logs.report("fileio","skipping '%s' for '%s' from '%s'",dataname,pathname,filename) - end - instance[dataname][pathname] = { } - instance.loaderror = true - end - elseif trace_locating then - logs.report("fileio","skipping '%s' for '%s' from '%s'",dataname,pathname,filename) - end -end - --- some day i'll use the nested approach, but not yet (actually we even drop --- engine/progname support since we have only luatex now) --- --- first texmfcnf.lua files are located, next the cached texmf.cnf files --- --- return { --- TEXMFBOGUS = 'effe checken of dit werkt', --- } - -function resolvers.resetconfig() - identify_own() - instance.configuration, instance.setup, instance.order, instance.loaderror = { }, { }, { }, false -end - -function resolvers.loadnewconfig() - local luafiles = instance.luafiles - for i=1,#luafiles do - local cnf = luafiles[i] - local pathname = file.dirname(cnf) - local filename = file.join(pathname,resolvers.luaname) - local blob = loadfile(filename) - if blob then - local data = blob() - if data then - if trace_locating then - logs.report("fileio","loading configuration file '%s'",filename) - end - if true then - -- flatten to variable.progname - local t = { } - for k, v in next, data do -- v = progname - if type(v) == "string" then - t[k] = v - else - for kk, vv in next, v do -- vv = variable - if type(vv) == "string" then - t[vv.."."..v] = kk - end - end - end - end - instance['setup'][pathname] = t - else - instance['setup'][pathname] = data - end - else - if trace_locating then - logs.report("fileio","skipping configuration file '%s'",filename) - end - instance['setup'][pathname] = { } - instance.loaderror = true - end - elseif trace_locating then - logs.report("fileio","skipping configuration file '%s'",filename) - end - instance.order[#instance.order+1] = instance.setup[pathname] - if instance.loaderror then break end - end -end - -function resolvers.loadoldconfig() - if not instance.renewcache then - local cnffiles = instance.cnffiles - for i=1,#cnffiles do - local cnf = cnffiles[i] - local dname = file.dirname(cnf) - resolvers.load_data(dname,'configuration') - instance.order[#instance.order+1] = instance.configuration[dname] - if instance.loaderror then break end - end - end - resolvers.joinconfig() -end +-- we used to have 'files' and 'configurations' so therefore the following +-- shared function -function resolvers.expand_variables() - local expansions, environment, variables = { }, instance.environment, instance.variables - local env = resolvers.env - instance.expansions = expansions - local engine, progname = instance.engine, instance.progname - if type(engine) ~= "string" then instance.engine, engine = "", "" end - if type(progname) ~= "string" then instance.progname, progname = "", "" end - if engine ~= "" then environment['engine'] = engine end - if progname ~= "" then environment['progname'] = progname end - for k,v in next, environment do - local a, b = match(k,"^(%a+)%_(.*)%s*$") - if a and b then - expansions[a..'.'..b] = v - else - expansions[k] = v - end - end - for k,v in next, environment do -- move environment to expansions - if not expansions[k] then expansions[k] = v end - end - for k,v in next, variables do -- move variables to expansions - if not expansions[k] then expansions[k] = v end - end - local busy = false - local function resolve(a) - busy = true - return expansions[a] or env(a) - end - while true do - busy = false - for k,v in next, expansions do - local s, n = gsub(v,"%$([%a%d%_%-]+)",resolve) - local s, m = gsub(s,"%$%{([%a%d%_%-]+)%}",resolve) - if n > 0 or m > 0 then - expansions[k]= s - end - end - if not busy then break end - end - for k,v in next, expansions do - expansions[k] = gsub(v,"\\", '/') - end +function resolvers.datastate() + return caches.contentstate() end function resolvers.variable(name) - return entry(instance.variables,name) + local name = name and lpegmatch(dollarstripper,name) + local result = name and instance.variables[name] + return result ~= nil and result or "" end function resolvers.expansion(name) - return entry(instance.expansions,name) -end - -function resolvers.is_variable(name) - return is_entry(instance.variables,name) -end - -function resolvers.is_expansion(name) - return is_entry(instance.expansions,name) + local name = name and lpegmatch(dollarstripper,name) + local result = name and instance.expansions[name] + return result ~= nil and result or "" end -function resolvers.unexpanded_path_list(str) +function resolvers.unexpandedpathlist(str) local pth = resolvers.variable(str) - local lst = resolvers.split_path(pth) - return expanded_path_from_list(lst) + local lst = resolvers.splitpath(pth) + return expandedpathfromlist(lst) end -function resolvers.unexpanded_path(str) - return file.join_path(resolvers.unexpanded_path_list(str)) +function resolvers.unexpandedpath(str) + return joinpath(resolvers.unexpandedpathlist(str)) end -do -- no longer needed - - local done = { } +local done = { } - function resolvers.reset_extra_path() - local ep = instance.extra_paths - if not ep then - ep, done = { }, { } - instance.extra_paths = ep - elseif #ep > 0 then - instance.lists, done = { }, { } - end +function resolvers.resetextrapath() + local ep = instance.extra_paths + if not ep then + ep, done = { }, { } + instance.extra_paths = ep + elseif #ep > 0 then + instance.lists, done = { }, { } end +end - function resolvers.register_extra_path(paths,subpaths) - local ep = instance.extra_paths or { } - local n = #ep - if paths and paths ~= "" then - if subpaths and subpaths ~= "" then - for p in gmatch(paths,"[^,]+") do - -- we gmatch each step again, not that fast, but used seldom - for s in gmatch(subpaths,"[^,]+") do - local ps = p .. "/" .. s - if not done[ps] then - ep[#ep+1] = resolvers.clean_path(ps) - done[ps] = true - end - end - end - else - for p in gmatch(paths,"[^,]+") do - if not done[p] then - ep[#ep+1] = resolvers.clean_path(p) - done[p] = true - end - end - end - elseif subpaths and subpaths ~= "" then - for i=1,n do +function resolvers.registerextrapath(paths,subpaths) + local ep = instance.extra_paths or { } + local oldn = #ep + local newn = oldn + if paths and paths ~= "" then + if subpaths and subpaths ~= "" then + for p in gmatch(paths,"[^,]+") do -- we gmatch each step again, not that fast, but used seldom for s in gmatch(subpaths,"[^,]+") do - local ps = ep[i] .. "/" .. s + local ps = p .. "/" .. s if not done[ps] then - ep[#ep+1] = resolvers.clean_path(ps) + newn = newn + 1 + ep[newn] = resolvers.cleanpath(ps) done[ps] = true end end end + else + for p in gmatch(paths,"[^,]+") do + if not done[p] then + newn = newn + 1 + ep[newn] = resolvers.cleanpath(p) + done[p] = true + end + end end - if #ep > 0 then - instance.extra_paths = ep -- register paths - end - if #ep > n then - instance.lists = { } -- erase the cache + elseif subpaths and subpaths ~= "" then + for i=1,oldn do + -- we gmatch each step again, not that fast, but used seldom + for s in gmatch(subpaths,"[^,]+") do + local ps = ep[i] .. "/" .. s + if not done[ps] then + newn = newn + 1 + ep[newn] = resolvers.cleanpath(ps) + done[ps] = true + end + end end end - + if newn > 0 then + instance.extra_paths = ep -- register paths + end + if newn > oldn then + instance.lists = { } -- erase the cache + end end local function made_list(instance,list) @@ -9528,14 +11693,15 @@ local function made_list(instance,list) if not ep or #ep == 0 then return list else - local done, new = { }, { } + local done, new, newn = { }, { }, 0 -- honour . .. ../.. but only when at the start for k=1,#list do local v = list[k] if not done[v] then if find(v,"^[%.%/]$") then done[v] = true - new[#new+1] = v + newn = newn + 1 + new[newn] = v else break end @@ -9546,7 +11712,8 @@ local function made_list(instance,list) local v = ep[k] if not done[v] then done[v] = true - new[#new+1] = v + newn = newn + 1 + new[newn] = v end end -- next the formal paths @@ -9554,118 +11721,95 @@ local function made_list(instance,list) local v = list[k] if not done[v] then done[v] = true - new[#new+1] = v + newn = newn + 1 + new[newn] = v end end return new end end -function resolvers.clean_path_list(str) - local t = resolvers.expanded_path_list(str) +function resolvers.cleanpathlist(str) + local t = resolvers.expandedpathlist(str) if t then for i=1,#t do - t[i] = file.collapse_path(resolvers.clean_path(t[i])) + t[i] = collapsepath(resolvers.cleanpath(t[i])) end end return t end -function resolvers.expand_path(str) - return file.join_path(resolvers.expanded_path_list(str)) +function resolvers.expandpath(str) + return joinpath(resolvers.expandedpathlist(str)) end -function resolvers.expanded_path_list(str) +function resolvers.expandedpathlist(str) if not str then - return ep or { } -- ep ? + return { } elseif instance.savelists then - -- engine+progname hash - str = gsub(str,"%$","") + str = lpegmatch(dollarstripper,str) if not instance.lists[str] then -- cached - local lst = made_list(instance,resolvers.split_path(resolvers.expansion(str))) - instance.lists[str] = expanded_path_from_list(lst) + local lst = made_list(instance,resolvers.splitpath(resolvers.expansion(str))) + instance.lists[str] = expandedpathfromlist(lst) end return instance.lists[str] else - local lst = resolvers.split_path(resolvers.expansion(str)) - return made_list(instance,expanded_path_from_list(lst)) - end -end - -function resolvers.expanded_path_list_from_var(str) -- brrr - local tmp = resolvers.var_of_format_or_suffix(gsub(str,"%$","")) - if tmp ~= "" then - return resolvers.expanded_path_list(tmp) - else - return resolvers.expanded_path_list(str) + local lst = resolvers.splitpath(resolvers.expansion(str)) + return made_list(instance,expandedpathfromlist(lst)) end end -function resolvers.expand_path_from_var(str) - return file.join_path(resolvers.expanded_path_list_from_var(str)) +function resolvers.expandedpathlistfromvariable(str) -- brrr + str = lpegmatch(dollarstripper,str) + local tmp = resolvers.variableofformatorsuffix(str) + return resolvers.expandedpathlist(tmp ~= "" and tmp or str) end -function resolvers.format_of_var(str) - return formats[str] or formats[alternatives[str]] or '' -end -function resolvers.format_of_suffix(str) - return suffixmap[file.extname(str)] or 'tex' +function resolvers.expandpathfromvariable(str) + return joinpath(resolvers.expandedpathlistfromvariable(str)) end -function resolvers.variable_of_format(str) - return formats[str] or formats[alternatives[str]] or '' +function resolvers.expandbraces(str) -- output variable and brace expansion of STRING + local ori = resolvers.variable(str) + local pth = expandedpathfromlist(resolvers.splitpath(ori)) + return joinpath(pth) end -function resolvers.var_of_format_or_suffix(str) - local v = formats[str] - if v then - return v - end - v = formats[alternatives[str]] - if v then - return v - end - v = suffixmap[file.extname(str)] - if v then - return formats[isf] +function resolvers.registerfilehash(name,content,someerror) + if content then + instance.files[name] = content + else + instance.files[name] = { } + if somerror == true then -- can be unset + instance.loaderror = someerror + end end - return '' -end - -function resolvers.expand_braces(str) -- output variable and brace expansion of STRING - local ori = resolvers.variable(str) - local pth = expanded_path_from_list(resolvers.split_path(ori)) - return file.join_path(pth) end -resolvers.isreadable = { } - -function resolvers.isreadable.file(name) - local readable = lfs.isfile(name) -- brrr +local function isreadable(name) + local readable = lfs.isfile(name) -- not file.is_readable(name) asit can be a dir if trace_detail then if readable then - logs.report("fileio","file '%s' is readable",name) + report_resolving("file '%s' is readable",name) else - logs.report("fileio","file '%s' is not readable", name) + report_resolving("file '%s' is not readable", name) end end return readable end -resolvers.isreadable.tex = resolvers.isreadable.file - -- name -- name/name local function collect_files(names) - local filelist = { } + local filelist, noffiles = { }, 0 for k=1,#names do local fname = names[k] if trace_detail then - logs.report("fileio","checking name '%s'",fname) + report_resolving("checking name '%s'",fname) end - local bname = file.basename(fname) - local dname = file.dirname(fname) + local bname = filebasename(fname) + local dname = filedirname(fname) if dname == "" or find(dname,"^%.") then dname = false else @@ -9674,11 +11818,11 @@ local function collect_files(names) local hashes = instance.hashes for h=1,#hashes do local hash = hashes[h] - local blobpath = hash.tag + local blobpath = hash.name local files = blobpath and instance.files[blobpath] if files then if trace_detail then - logs.report("fileio","deep checking '%s' (%s)",blobpath,bname) + report_resolving("deep checking '%s' (%s)",blobpath,bname) end local blobfile = files[bname] if not blobfile then @@ -9690,62 +11834,51 @@ local function collect_files(names) end end if blobfile then + local blobroot = files.__path__ or blobpath if type(blobfile) == 'string' then if not dname or find(blobfile,dname) then - filelist[#filelist+1] = { - hash.type, - file.join(blobpath,blobfile,bname), -- search - resolvers.concatinators[hash.type](blobpath,blobfile,bname) -- result - } + local variant = hash.type + -- local search = filejoin(blobpath,blobfile,bname) + local search = filejoin(blobroot,blobfile,bname) + local result = methodhandler('concatinators',hash.type,blobroot,blobfile,bname) + if trace_detail then + report_resolving("match: variant '%s', search '%s', result '%s'",variant,search,result) + end + noffiles = noffiles + 1 + filelist[noffiles] = { variant, search, result } end else for kk=1,#blobfile do local vv = blobfile[kk] if not dname or find(vv,dname) then - filelist[#filelist+1] = { - hash.type, - file.join(blobpath,vv,bname), -- search - resolvers.concatinators[hash.type](blobpath,vv,bname) -- result - } + local variant = hash.type + -- local search = filejoin(blobpath,vv,bname) + local search = filejoin(blobroot,vv,bname) + local result = methodhandler('concatinators',hash.type,blobroot,vv,bname) + if trace_detail then + report_resolving("match: variant '%s', search '%s', result '%s'",variant,search,result) + end + noffiles = noffiles + 1 + filelist[noffiles] = { variant, search, result } end end end end elseif trace_locating then - logs.report("fileio","no match in '%s' (%s)",blobpath,bname) + report_resolving("no match in '%s' (%s)",blobpath,bname) end end end - if #filelist > 0 then - return filelist - else - return nil - end -end - -function resolvers.suffix_of_format(str) - if suffixes[str] then - return suffixes[str][1] - else - return "" - end -end - -function resolvers.suffixes_of_format(str) - if suffixes[str] then - return suffixes[str] - else - return {} - end + return noffiles > 0 and filelist or nil end -function resolvers.register_in_trees(name) +function resolvers.registerintrees(name) if not find(name,"^%.") then instance.foundintrees[name] = (instance.foundintrees[name] or 0) + 1 -- maybe only one end end --- split the next one up for readability (bu this module needs a cleanup anyway) +-- split the next one up for readability (but this module needs a cleanup anyway) local function can_be_dir(name) -- can become local local fakepaths = instance.fakepaths @@ -9756,61 +11889,62 @@ local function can_be_dir(name) -- can become local fakepaths[name] = 2 -- no directory end end - return (fakepaths[name] == 1) + return fakepaths[name] == 1 end -local function collect_instance_files(filename,collected) -- todo : plugin (scanners, checkers etc) - local result = collected or { } +local preparetreepattern = Cs((P(".")/"%%." + P("-")/"%%-" + P(1))^0 * Cc("$")) + +-- this one is split in smaller functions but it needs testing + +local function collect_instance_files(filename,askedformat,allresults) -- todo : plugin (scanners, checkers etc) + local result = { } local stamp = nil - filename = file.collapse_path(filename) + askedformat = askedformat or "" + filename = collapsepath(filename) -- speed up / beware: format problem - if instance.remember then - stamp = filename .. "--" .. instance.engine .. "--" .. instance.progname .. "--" .. instance.format + if instance.remember and not allresults then + stamp = filename .. "--" .. askedformat if instance.found[stamp] then if trace_locating then - logs.report("fileio","remembering file '%s'",filename) + report_resolving("remembered file '%s'",filename) end + resolvers.registerintrees(filename) -- for tracing used files return instance.found[stamp] end end - if not dangerous[instance.format or "?"] then - if resolvers.isreadable.file(filename) then + if not dangerous[askedformat] then + if isreadable(filename) then if trace_detail then - logs.report("fileio","file '%s' found directly",filename) + report_resolving("file '%s' found directly",filename) + end + if stamp then + instance.found[stamp] = { filename } end - instance.found[stamp] = { filename } return { filename } end end if find(filename,'%*') then if trace_locating then - logs.report("fileio","checking wildcard '%s'", filename) + report_resolving("checking wildcard '%s'", filename) end - result = resolvers.find_wildcard_files(filename) + result = resolvers.findwildcardfiles(filename) -- we can use th elocal elseif file.is_qualified_path(filename) then - if resolvers.isreadable.file(filename) then + if isreadable(filename) then if trace_locating then - logs.report("fileio","qualified name '%s'", filename) + report_resolving("qualified name '%s'", filename) end result = { filename } else - local forcedname, ok, suffix = "", false, file.extname(filename) + local forcedname, ok, suffix = "", false, fileextname(filename) if suffix == "" then -- why - if instance.format == "" then - forcedname = filename .. ".tex" - if resolvers.isreadable.file(forcedname) then - if trace_locating then - logs.report("fileio","no suffix, forcing standard filetype 'tex'") - end - result, ok = { forcedname }, true - end - else - local suffixes = resolvers.suffixes_of_format(instance.format) - for _, s in next, suffixes do + local format_suffixes = askedformat == "" and resolvers.defaultsuffixes or suffixes[askedformat] + if format_suffixes then + for i=1,#format_suffixes do + local s = format_suffixes[i] forcedname = filename .. "." .. s - if resolvers.isreadable.file(forcedname) then + if isreadable(forcedname) then if trace_locating then - logs.report("fileio","no suffix, forcing format filetype '%s'", s) + report_resolving("no suffix, forcing format filetype '%s'", s) end result, ok = { forcedname }, true break @@ -9821,23 +11955,24 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan if not ok and suffix ~= "" then -- try to find in tree (no suffix manipulation), here we search for the -- matching last part of the name - local basename = file.basename(filename) - local pattern = gsub(filename .. "$","([%.%-])","%%%1") - local savedformat = instance.format + local basename = filebasename(filename) + local pattern = lpegmatch(preparetreepattern,filename) + -- messy .. to be sorted out + local savedformat = askedformat local format = savedformat or "" if format == "" then - instance.format = resolvers.format_of_suffix(suffix) + askedformat = resolvers.formatofsuffix(suffix) end if not format then - instance.format = "othertextfiles" -- kind of everything, maybe texinput is better + askedformat = "othertextfiles" -- kind of everything, maybe texinput is better end -- if basename ~= filename then - local resolved = collect_instance_files(basename) - if #result == 0 then + local resolved = collect_instance_files(basename,askedformat,allresults) + if #result == 0 then -- shouldn't this be resolved ? local lowered = lower(basename) if filename ~= lowered then - resolved = collect_instance_files(lowered) + resolved = collect_instance_files(lowered,askedformat,allresults) end end resolvers.format = savedformat @@ -9862,57 +11997,60 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan -- end end if not ok and trace_locating then - logs.report("fileio","qualified name '%s'", filename) + report_resolving("qualified name '%s'", filename) end end else -- search spec - local filetype, extra, done, wantedfiles, ext = '', nil, false, { }, file.extname(filename) - if ext == "" then - if not instance.force_suffixes then - wantedfiles[#wantedfiles+1] = filename - end - else - wantedfiles[#wantedfiles+1] = filename - end - if instance.format == "" then - if ext == "" then - local forcedname = filename .. '.tex' - wantedfiles[#wantedfiles+1] = forcedname - filetype = resolvers.format_of_suffix(forcedname) - if trace_locating then - logs.report("fileio","forcing filetype '%s'",filetype) + local filetype, done, wantedfiles, ext = '', false, { }, fileextname(filename) + -- -- tricky as filename can be bla.1.2.3 + -- if not suffixmap[ext] then --- probably needs to be done elsewhere too + -- wantedfiles[#wantedfiles+1] = filename + -- end + wantedfiles[#wantedfiles+1] = filename + if askedformat == "" then + if ext == "" or not suffixmap[ext] then + local defaultsuffixes = resolvers.defaultsuffixes + for i=1,#defaultsuffixes do + local forcedname = filename .. '.' .. defaultsuffixes[i] + wantedfiles[#wantedfiles+1] = forcedname + filetype = resolvers.formatofsuffix(forcedname) + if trace_locating then + report_resolving("forcing filetype '%s'",filetype) + end end else - filetype = resolvers.format_of_suffix(filename) + filetype = resolvers.formatofsuffix(filename) if trace_locating then - logs.report("fileio","using suffix based filetype '%s'",filetype) + report_resolving("using suffix based filetype '%s'",filetype) end end else - if ext == "" then - local suffixes = resolvers.suffixes_of_format(instance.format) - for _, s in next, suffixes do - wantedfiles[#wantedfiles+1] = filename .. "." .. s + if ext == "" or not suffixmap[ext] then + local format_suffixes = suffixes[askedformat] + if format_suffixes then + for i=1,#format_suffixes do + wantedfiles[#wantedfiles+1] = filename .. "." .. format_suffixes[i] + end end end - filetype = instance.format + filetype = askedformat if trace_locating then - logs.report("fileio","using given filetype '%s'",filetype) + report_resolving("using given filetype '%s'",filetype) end end - local typespec = resolvers.variable_of_format(filetype) - local pathlist = resolvers.expanded_path_list(typespec) + local typespec = resolvers.variableofformat(filetype) + local pathlist = resolvers.expandedpathlist(typespec) if not pathlist or #pathlist == 0 then -- no pathlist, access check only / todo == wildcard if trace_detail then - logs.report("fileio","checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | ")) + report_resolving("checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | ")) end for k=1,#wantedfiles do local fname = wantedfiles[k] - if fname and resolvers.isreadable.file(fname) then + if fname and isreadable(fname) then filename, done = fname, true - result[#result+1] = file.join('.',fname) + result[#result+1] = filejoin('.',fname) break end end @@ -9920,8 +12058,8 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan local filelist = collect_files(wantedfiles) local fl = filelist and filelist[1] if fl then - filename = fl[3] - result[#result+1] = filename + filename = fl[3] -- not local? + result[#result+1] = resolvers.resolve(filename) done = true end else @@ -9930,76 +12068,65 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan local dirlist = { } if filelist then for i=1,#filelist do - dirlist[i] = file.dirname(filelist[i][2]) .. "/" + dirlist[i] = filedirname(filelist[i][3]) .. "/" -- was [2] .. gamble end end if trace_detail then - logs.report("fileio","checking filename '%s'",filename) + report_resolving("checking filename '%s'",filename) end - -- a bit messy ... esp the doscan setting here - local doscan for k=1,#pathlist do local path = pathlist[k] - if find(path,"^!!") then doscan = false else doscan = true end - local pathname = gsub(path,"^!+", '') + local pathname = lpegmatch(inhibitstripper,path) + local doscan = path == pathname -- no ^!! done = false -- using file list if filelist then - local expression -- compare list entries with permitted pattern -- /xx /xx// - if not find(pathname,"/$") then - expression = pathname .. "/" - else - expression = pathname - end - expression = gsub(expression,"([%-%.])","%%%1") -- this also influences - expression = gsub(expression,"//+$", '/.*') -- later usage of pathname - expression = gsub(expression,"//", '/.-/') -- not ok for /// but harmless - expression = "^" .. expression .. "$" + local expression = makepathexpression(pathname) if trace_detail then - logs.report("fileio","using pattern '%s' for path '%s'",expression,pathname) + report_resolving("using pattern '%s' for path '%s'",expression,pathname) end for k=1,#filelist do local fl = filelist[k] local f = fl[2] local d = dirlist[k] if find(d,expression) then - --- todo, test for readable - result[#result+1] = fl[3] - resolvers.register_in_trees(f) -- for tracing used files + -- todo, test for readable + result[#result+1] = resolvers.resolve(fl[3]) -- no shortcut done = true - if instance.allresults then + if allresults then if trace_detail then - logs.report("fileio","match in hash for file '%s' on path '%s', continue scanning",f,d) + report_resolving("match to '%s' in hash for file '%s' and path '%s', continue scanning",expression,f,d) end else if trace_detail then - logs.report("fileio","match in hash for file '%s' on path '%s', quit scanning",f,d) + report_resolving("match to '%s' in hash for file '%s' and path '%s', quit scanning",expression,f,d) end break end elseif trace_detail then - logs.report("fileio","no match in hash for file '%s' on path '%s'",f,d) + report_resolving("no match to '%s' in hash for file '%s' and path '%s'",expression,f,d) end end end if not done and doscan then -- check if on disk / unchecked / does not work at all / also zips - if resolvers.splitmethod(pathname).scheme == 'file' then -- ? + local scheme = url.hasscheme(pathname) + if not scheme or scheme == "file" then local pname = gsub(pathname,"%.%*$",'') if not find(pname,"%*") then local ppname = gsub(pname,"/+$","") if can_be_dir(ppname) then for k=1,#wantedfiles do local w = wantedfiles[k] - local fname = file.join(ppname,w) - if resolvers.isreadable.file(fname) then + local fname = filejoin(ppname,w) + if isreadable(fname) then if trace_detail then - logs.report("fileio","found '%s' by scanning",fname) + report_resolving("found '%s' by scanning",fname) end result[#result+1] = fname done = true - if not instance.allresults then break end + if not allresults then break end end end else @@ -10009,56 +12136,66 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan end end if not done and doscan then - -- todo: slow path scanning + -- todo: slow path scanning ... although we now have tree:// supported in $TEXMF end - if done and not instance.allresults then break end + if done and not allresults then break end end end end for k=1,#result do - result[k] = file.collapse_path(result[k]) + local rk = collapsepath(result[k]) + result[k] = rk + resolvers.registerintrees(rk) -- for tracing used files end - if instance.remember then + if stamp then instance.found[stamp] = result end return result end -if not resolvers.concatinators then resolvers.concatinators = { } end +-- -- -- begin of main file search routing -- -- -- -resolvers.concatinators.tex = file.join -resolvers.concatinators.file = resolvers.concatinators.tex -function resolvers.find_files(filename,filetype,mustexist) - if type(mustexist) == boolean then - -- all set - elseif type(filetype) == 'boolean' then - filetype, mustexist = nil, false - elseif type(filetype) ~= 'string' then - filetype, mustexist = nil, false - end - instance.format = filetype or '' - local result = collect_instance_files(filename) + + + + + + + + +-- -- -- end of main file search routing -- -- -- + +local function findfiles(filename,filetype,allresults) + local result = collect_instance_files(filename,filetype or "",allresults) if #result == 0 then local lowered = lower(filename) if filename ~= lowered then - return collect_instance_files(lowered) + return collect_instance_files(lowered,filetype or "",allresults) end end - instance.format = '' return result end -function resolvers.find_file(filename,filetype,mustexist) - return (resolvers.find_files(filename,filetype,mustexist)[1] or "") +function resolvers.findfiles(filename,filetype) + return findfiles(filename,filetype,true) +end + +function resolvers.findfile(filename,filetype) + return findfiles(filename,filetype,false)[1] or "" +end + +function resolvers.findpath(filename,filetype) + return filedirname(findfiles(filename,filetype,false)[1] or "") end -function resolvers.find_given_files(filename) - local bname, result = file.basename(filename), { } +local function findgivenfiles(filename,allresults) + local bname, result = filebasename(filename), { } local hashes = instance.hashes + local noffound = 0 for k=1,#hashes do local hash = hashes[k] - local files = instance.files[hash.tag] or { } + local files = instance.files[hash.name] or { } local blist = files[bname] if not blist then local rname = "remap:"..bname @@ -10070,13 +12207,21 @@ function resolvers.find_given_files(filename) end if blist then if type(blist) == 'string' then - result[#result+1] = resolvers.concatinators[hash.type](hash.tag,blist,bname) or "" - if not instance.allresults then break end + local found = methodhandler('concatinators',hash.type,hash.name,blist,bname) or "" + if found ~= "" then + noffound = noffound + 1 + result[noffound] = resolvers.resolve(found) + if not allresults then break end + end else for kk=1,#blist do local vv = blist[kk] - result[#result+1] = resolvers.concatinators[hash.type](hash.tag,vv,bname) or "" - if not instance.allresults then break end + local found = methodhandler('concatinators',hash.type,hash.name,vv,bname) or "" + if found ~= "" then + noffound = noffound + 1 + result[noffound] = resolvers.resolve(found) + if not allresults then break end + end end end end @@ -10084,24 +12229,31 @@ function resolvers.find_given_files(filename) return result end -function resolvers.find_given_file(filename) - return (resolvers.find_given_files(filename)[1] or "") +function resolvers.findgivenfiles(filename) + return findgivenfiles(filename,true) end -local function doit(path,blist,bname,tag,kind,result,allresults) +function resolvers.findgivenfile(filename) + return findgivenfiles(filename,false)[1] or "" +end + +local function doit(path,blist,bname,tag,variant,result,allresults) local done = false - if blist and kind then + if blist and variant then + local resolve = resolvers.resolve -- added if type(blist) == 'string' then -- make function and share code if find(lower(blist),path) then - result[#result+1] = resolvers.concatinators[kind](tag,blist,bname) or "" + local full = methodhandler('concatinators',variant,tag,blist,bname) or "" + result[#result+1] = resolve(full) done = true end else for kk=1,#blist do local vv = blist[kk] if find(lower(vv),path) then - result[#result+1] = resolvers.concatinators[kind](tag,vv,bname) or "" + local full = methodhandler('concatinators',variant,tag,vv,bname) or "" + result[#result+1] = resolve(full) done = true if not allresults then break end end @@ -10111,30 +12263,32 @@ local function doit(path,blist,bname,tag,kind,result,allresults) return done end -function resolvers.find_wildcard_files(filename) -- todo: remap: - local result = { } - local bname, dname = file.basename(filename), file.dirname(filename) - local path = gsub(dname,"^*/","") - path = gsub(path,"*",".*") - path = gsub(path,"-","%%-") - if dname == "" then - path = ".*" - end - local name = bname - name = gsub(name,"*",".*") - name = gsub(name,"-","%%-") - path = lower(path) - name = lower(name) - local files, allresults, done = instance.files, instance.allresults, false + +local makewildcard = Cs( + (P("^")^0 * P("/") * P(-1) + P(-1)) /".*" + + (P("^")^0 * P("/") / "")^0 * (P("*")/".*" + P("-")/"%%-" + P(".")/"%%." + P("?")/"."+ P("\\")/"/" + P(1))^0 +) + +function resolvers.wildcardpattern(pattern) + return lpegmatch(makewildcard,pattern) or pattern +end + +local function findwildcardfiles(filename,allresults,result) -- todo: remap: and lpeg + result = result or { } + local base = filebasename(filename) + local dirn = filedirname(filename) + local path = lower(lpegmatch(makewildcard,dirn) or dirn) + local name = lower(lpegmatch(makewildcard,base) or base) + local files, done = instance.files, false if find(name,"%*") then local hashes = instance.hashes for k=1,#hashes do local hash = hashes[k] - local tag, kind = hash.tag, hash.type - for kk, hh in next, files[hash.tag] do + local hashname, hashtype = hash.name, hash.type + for kk, hh in next, files[hashname] do if not find(kk,"^remap:") then if find(lower(kk),name) then - if doit(path,hh,kk,tag,kind,result,allresults) then done = true end + if doit(path,hh,kk,hashname,hashtype,result,allresults) then done = true end if done and not allresults then break end end end @@ -10144,8 +12298,8 @@ function resolvers.find_wildcard_files(filename) -- todo: remap: local hashes = instance.hashes for k=1,#hashes do local hash = hashes[k] - local tag, kind = hash.tag, hash.type - if doit(path,files[tag][bname],bname,tag,kind,result,allresults) then done = true end + local hashname, hashtype = hash.name, hash.type + if doit(path,files[hashname][bname],bname,hashname,hashtype,result,allresults) then done = true end if done and not allresults then break end end end @@ -10154,8 +12308,12 @@ function resolvers.find_wildcard_files(filename) -- todo: remap: return result end -function resolvers.find_wildcard_file(filename) - return (resolvers.find_wildcard_files(filename)[1] or "") +function resolvers.findwildcardfiles(filename,result) + return findwildcardfiles(filename,true,result) +end + +function resolvers.findwildcardfile(filename) + return findwildcardfiles(filename,false)[1] or "" end -- main user functions @@ -10166,34 +12324,33 @@ end function resolvers.load(option) statistics.starttiming(instance) - resolvers.resetconfig() - resolvers.identify_cnf() - resolvers.load_lua() -- will become the new method - resolvers.expand_variables() - resolvers.load_cnf() -- will be skipped when we have a lua file - resolvers.expand_variables() + identify_configuration_files() + load_configuration_files() if option ~= "nofiles" then - resolvers.load_hash() + load_databases() resolvers.automount() end statistics.stoptiming(instance) + local files = instance.files + return files and next(files) and true +end + +local function report(str) + if trace_locating then + report_resolving(str) -- has already verbose + else + print(str) + end end -function resolvers.for_files(command, files, filetype, mustexist) +function resolvers.dowithfilesandreport(command, files, ...) -- will move if files and #files > 0 then - local function report(str) - if trace_locating then - logs.report("fileio",str) -- has already verbose - else - print(str) - end - end if trace_locating then report('') -- ? end for f=1,#files do local file = files[f] - local result = command(file,filetype,mustexist) + local result = command(file,...) if type(result) == 'string' then report(result) else @@ -10205,21 +12362,16 @@ function resolvers.for_files(command, files, filetype, mustexist) end end --- strtab +-- obsolete -resolvers.var_value = resolvers.variable -- output the value of variable $STRING. -resolvers.expand_var = resolvers.expansion -- output variable expansion of STRING. +-- resolvers.varvalue = resolvers.variable -- output the value of variable $STRING. +-- resolvers.expandvar = resolvers.expansion -- output variable expansion of STRING. -function resolvers.show_path(str) -- output search path for file type NAME - return file.join_path(resolvers.expanded_path_list(resolvers.format_of_var(str))) +function resolvers.showpath(str) -- output search path for file type NAME + return joinpath(resolvers.expandedpathlist(resolvers.formatofvariable(str))) end --- resolvers.find_file(filename) --- resolvers.find_file(filename, filetype, mustexist) --- resolvers.find_file(filename, mustexist) --- resolvers.find_file(filename, filetype) - -function resolvers.register_file(files, name, path) +function resolvers.registerfile(files, name, path) if files[name] then if type(files[name]) == 'string' then files[name] = { files[name], path } @@ -10231,101 +12383,24 @@ function resolvers.register_file(files, name, path) end end -function resolvers.splitmethod(filename) - if not filename then - return { } -- safeguard - elseif type(filename) == "table" then - return filename -- already split - elseif not find(filename,"://") then - return { scheme="file", path = filename, original=filename } -- quick hack - else - return url.hashed(filename) - end -end - -function table.sequenced(t,sep) -- temp here - local s = { } - for k, v in next, t do -- indexed? - s[#s+1] = k .. "=" .. tostring(v) - end - return concat(s, sep or " | ") -end - -function resolvers.methodhandler(what, filename, filetype) -- ... - filename = file.collapse_path(filename) - local specification = (type(filename) == "string" and resolvers.splitmethod(filename)) or filename -- no or { }, let it bomb - local scheme = specification.scheme - if resolvers[what][scheme] then - if trace_locating then - logs.report("fileio","handler '%s' -> '%s' -> '%s'",specification.original,what,table.sequenced(specification)) - end - return resolvers[what][scheme](filename,filetype) -- todo: specification - else - return resolvers[what].tex(filename,filetype) -- todo: specification - end -end - -function resolvers.clean_path(str) - if str then - str = gsub(str,"\\","/") - str = gsub(str,"^!+","") - str = gsub(str,"^~",resolvers.homedir) - return str - else - return nil - end -end - -function resolvers.do_with_path(name,func) - local pathlist = resolvers.expanded_path_list(name) +function resolvers.dowithpath(name,func) + local pathlist = resolvers.expandedpathlist(name) for i=1,#pathlist do - func("^"..resolvers.clean_path(pathlist[i])) + func("^"..resolvers.cleanpath(pathlist[i])) end end -function resolvers.do_with_var(name,func) - func(expanded_var(name)) -end - -function resolvers.with_files(pattern,handle) - local hashes = instance.hashes - for i=1,#hashes do - local hash = hashes[i] - local blobpath = hash.tag - local blobtype = hash.type - if blobpath then - local files = instance.files[blobpath] - if files then - for k,v in next, files do - if find(k,"^remap:") then - k = files[k] - v = files[k] -- chained - end - if find(k,pattern) then - if type(v) == "string" then - handle(blobtype,blobpath,v,k) - else - for _,vv in next, v do -- indexed - handle(blobtype,blobpath,vv,k) - end - end - end - end - end - end - end +function resolvers.dowithvariable(name,func) + func(expandedvariable(name)) end -function resolvers.locate_format(name) - local barename, fmtname = gsub(name,"%.%a+$",""), "" - if resolvers.usecache then - local path = file.join(caches.setpath("formats")) -- maybe platform - fmtname = file.join(path,barename..".fmt") or "" - end +function resolvers.locateformat(name) + local barename = file.removesuffix(name) -- gsub(name,"%.%a+$","") + local fmtname = caches.getfirstreadablefile(barename..".fmt","formats") or "" if fmtname == "" then - fmtname = resolvers.find_files(barename..".fmt")[1] or "" + fmtname = resolvers.findfile(barename..".fmt") + fmtname = resolvers.cleanpath(fmtname) end - fmtname = resolvers.clean_path(fmtname) if fmtname ~= "" then local barename = file.removesuffix(fmtname) local luaname, lucname, luiname = barename .. ".lua", barename .. ".luc", barename .. ".lui" @@ -10340,7 +12415,7 @@ function resolvers.locate_format(name) return nil, nil end -function resolvers.boolean_variable(str,default) +function resolvers.booleanvariable(str,default) local b = resolvers.expansion(str) if b == "" then return default @@ -10350,204 +12425,62 @@ function resolvers.boolean_variable(str,default) end end -texconfig.kpse_init = false - -kpse = { original = kpse } setmetatable(kpse, { __index = function(k,v) return resolvers[v] end } ) - --- for a while - -input = resolvers - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['data-tmp'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - ---[[ldx-- -

This module deals with caching data. It sets up the paths and -implements loaders and savers for tables. Best is to set the -following variable. When not set, the usual paths will be -checked. Personally I prefer the (users) temporary path.

- - -TEXMFCACHE=$TMP;$TEMP;$TMPDIR;$TEMPDIR;$HOME;$TEXMFVAR;$VARTEXMF;. - - -

Currently we do no locking when we write files. This is no real -problem because most caching involves fonts and the chance of them -being written at the same time is small. We also need to extend -luatools with a recache feature.

---ldx]]-- - -local format, lower, gsub = string.format, string.lower, string.gsub - -local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) -- not used yet - -caches = caches or { } - -caches.path = caches.path or nil -caches.base = caches.base or "luatex-cache" -caches.more = caches.more or "context" -caches.direct = false -- true is faster but may need huge amounts of memory -caches.tree = false -caches.paths = caches.paths or nil -caches.force = true -- changed for TEXLIVE by TH -caches.defaults = { "TEXMFCACHE", "TMPDIR", "TEMPDIR", "TMP", "TEMP", "HOME", "HOMEPATH" } - -function caches.temp() - local cachepath = nil - local function check(list,isenv) - if not cachepath then - for k=1,#list do - local v = list[k] - cachepath = (isenv and (os.env[v] or "")) or v or "" - if cachepath == "" then - -- next - else - cachepath = resolvers.clean_path(cachepath) - if lfs.isdir(cachepath) and file.iswritable(cachepath) then -- lfs.attributes(cachepath,"mode") == "directory" - break - elseif caches.force or io.ask(format("\nShould I create the cache path %s?",cachepath), "no", { "yes", "no" }) == "yes" then - dir.mkdirs(cachepath) - if lfs.isdir(cachepath) and file.iswritable(cachepath) then - break +function resolvers.dowithfilesintree(pattern,handle,before,after) -- will move, can be a nice iterator instead + local instance = resolvers.instance + local hashes = instance.hashes + for i=1,#hashes do + local hash = hashes[i] + local blobtype = hash.type + local blobpath = hash.name + if blobpath then + if before then + before(blobtype,blobpath,pattern) + end + local files = instance.files[blobpath] + local total, checked, done = 0, 0, 0 + if files then + for k,v in next, files do + total = total + 1 + if find(k,"^remap:") then + k = files[k] + v = k -- files[k] -- chained + end + if find(k,pattern) then + if type(v) == "string" then + checked = checked + 1 + if handle(blobtype,blobpath,v,k) then + done = done + 1 + end + else + checked = checked + #v + for i=1,#v do + if handle(blobtype,blobpath,v[i],k) then + done = done + 1 + end + end end end end - cachepath = nil + end + if after then + after(blobtype,blobpath,pattern,total,checked,done) end end end - check(resolvers.clean_path_list("TEXMFCACHE") or { }) - check(caches.defaults,true) - if not cachepath then - print("\nfatal error: there is no valid (writable) cache path defined\n") - os.exit() - elseif not lfs.isdir(cachepath) then -- lfs.attributes(cachepath,"mode") ~= "directory" - print(format("\nfatal error: cache path %s is not a directory\n",cachepath)) - os.exit() - end - cachepath = file.collapse_path(cachepath) - function caches.temp() - return cachepath - end - return cachepath -end - -function caches.configpath() - return table.concat(resolvers.instance.cnffiles,";") -end - -function caches.hashed(tree) - return md5.hex(gsub(lower(tree),"[\\\/]+","/")) -end - -function caches.treehash() - local tree = caches.configpath() - if not tree or tree == "" then - return false - else - return caches.hashed(tree) - end -end - -function caches.setpath(...) - if not caches.path then - if not caches.path then - caches.path = caches.temp() - end - caches.path = resolvers.clean_path(caches.path) -- to be sure - caches.tree = caches.tree or caches.treehash() - if caches.tree then - caches.path = dir.mkdirs(caches.path,caches.base,caches.more,caches.tree) - else - caches.path = dir.mkdirs(caches.path,caches.base,caches.more) - end - end - if not caches.path then - caches.path = '.' - end - caches.path = resolvers.clean_path(caches.path) - local dirs = { ... } - if #dirs > 0 then - local pth = dir.mkdirs(caches.path,...) - return pth - end - caches.path = dir.expand_name(caches.path) - return caches.path -end - -function caches.definepath(category,subcategory) - return function() - return caches.setpath(category,subcategory) - end -end - -function caches.setluanames(path,name) - return path .. "/" .. name .. ".tma", path .. "/" .. name .. ".tmc" -end - -function caches.loaddata(path,name) - local tmaname, tmcname = caches.setluanames(path,name) - local loader = loadfile(tmcname) or loadfile(tmaname) - if loader then - loader = loader() - collectgarbage("step") - return loader - else - return false - end -end - ---~ function caches.loaddata(path,name) ---~ local tmaname, tmcname = caches.setluanames(path,name) ---~ return dofile(tmcname) or dofile(tmaname) ---~ end - -function caches.iswritable(filepath,filename) - local tmaname, tmcname = caches.setluanames(filepath,filename) - return file.iswritable(tmaname) -end - -function caches.savedata(filepath,filename,data,raw) - local tmaname, tmcname = caches.setluanames(filepath,filename) - local reduce, simplify = true, true - if raw then - reduce, simplify = false, false - end - data.cache_uuid = os.uuid() - if caches.direct then - file.savedata(tmaname, table.serialize(data,'return',false,true,false)) -- no hex - else - table.tofile(tmaname, data,'return',false,true,false) -- maybe not the last true - end - local cleanup = resolvers.boolean_variable("PURGECACHE", false) - local strip = resolvers.boolean_variable("LUACSTRIP", true) - utils.lua.compile(tmaname, tmcname, cleanup, strip) end --- here we use the cache for format loading (texconfig.[formatname|jobname]) +resolvers.obsolete = resolvers.obsolete or { } +local obsolete = resolvers.obsolete ---~ if tex and texconfig and texconfig.formatname and texconfig.formatname == "" then -if tex and texconfig and (not texconfig.formatname or texconfig.formatname == "") and input and resolvers.instance then - if not texconfig.luaname then texconfig.luaname = "cont-en.lua" end -- or luc - texconfig.formatname = caches.setpath("formats") .. "/" .. gsub(texconfig.luaname,"%.lu.$",".fmt") -end +resolvers.find_file = resolvers.findfile obsolete.find_file = resolvers.findfile +resolvers.find_files = resolvers.findfiles obsolete.find_files = resolvers.findfiles end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['data-res'] = { +if not modules then modules = { } end modules ['data-pre'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -10555,17 +12488,28 @@ if not modules then modules = { } end modules ['data-res'] = { license = "see context related readme files" } ---~ print(resolvers.resolve("abc env:tmp file:cont-en.tex path:cont-en.tex full:cont-en.tex rel:zapf/one/p-chars.tex")) +-- It could be interesting to hook the resolver in the file +-- opener so that unresolved prefixes travel around and we +-- get more abstraction. -local upper, lower, gsub = string.upper, string.lower, string.gsub +-- As we use this beforehand we will move this up in the chain +-- of loading. -local prefixes = { } + +local resolvers = resolvers +local prefixes = utilities.storage.allocate() +resolvers.prefixes = prefixes + +local gsub = string.gsub +local cleanpath, findgivenfile, expansion = resolvers.cleanpath, resolvers.findgivenfile, resolvers.expansion +local getenv = resolvers.getenv -- we can probably also use resolvers.expansion +local P, Cs, lpegmatch = lpeg.P, lpeg.Cs, lpeg.match prefixes.environment = function(str) - return resolvers.clean_path(os.getenv(str) or os.getenv(upper(str)) or os.getenv(lower(str)) or "") + return cleanpath(expansion(str)) end -prefixes.relative = function(str,n) +prefixes.relative = function(str,n) -- lfs.isfile if io.exists(str) then -- nothing elseif io.exists("./" .. str) then @@ -10581,7 +12525,7 @@ prefixes.relative = function(str,n) end end end - return resolvers.clean_path(str) + return cleanpath(str) end prefixes.auto = function(str) @@ -10593,18 +12537,34 @@ prefixes.auto = function(str) end prefixes.locate = function(str) - local fullname = resolvers.find_given_file(str) or "" - return resolvers.clean_path((fullname ~= "" and fullname) or str) + local fullname = findgivenfile(str) or "" + return cleanpath((fullname ~= "" and fullname) or str) end prefixes.filename = function(str) - local fullname = resolvers.find_given_file(str) or "" - return resolvers.clean_path(file.basename((fullname ~= "" and fullname) or str)) + local fullname = findgivenfile(str) or "" + return cleanpath(file.basename((fullname ~= "" and fullname) or str)) end prefixes.pathname = function(str) - local fullname = resolvers.find_given_file(str) or "" - return resolvers.clean_path(file.dirname((fullname ~= "" and fullname) or str)) + local fullname = findgivenfile(str) or "" + return cleanpath(file.dirname((fullname ~= "" and fullname) or str)) +end + +prefixes.selfautoloc = function(str) + return cleanpath(file.join(getenv('SELFAUTOLOC'),str)) +end + +prefixes.selfautoparent = function(str) + return cleanpath(file.join(getenv('SELFAUTOPARENT'),str)) +end + +prefixes.selfautodir = function(str) + return cleanpath(file.join(getenv('SELFAUTODIR'),str)) +end + +prefixes.home = function(str) + return cleanpath(file.join(getenv('HOME'),str)) end prefixes.env = prefixes.environment @@ -10633,26 +12593,71 @@ local function _resolve_(method,target) end end -local function resolve(str) - if type(str) == "table" then - for k=1,#str do - local v = str[k] - str[k] = resolve(v) or v +local resolved, abstract = { }, { } + +function resolvers.resetresolve(str) + resolved, abstract = { }, { } +end + +local function resolve(str) -- use schemes, this one is then for the commandline only + local res = resolved[str] + if not res then + res = gsub(str,"([a-z][a-z]+):([^ \"\']*)",_resolve_) + resolved[str] = res + abstract[res] = str + end + return res +end + +local function unresolve(str) + return abstract[str] or str +end + +resolvers.resolve = resolve +resolvers.unresolve = unresolve + +if os.uname then + + for k, v in next, os.uname() do + if not prefixes[k] then + prefixes[k] = function() return v end + end + end + +end + +if os.type == "unix" then + + local pattern + + local function makepattern(t,k,v) + local colon = P(":") + local p + for k, v in table.sortedpairs(prefixes) do + if p then + p = P(k) + p + else + p = P(k) + end + end + pattern = Cs((p * colon + colon/";" + P(1))^0) + if t then + t[k] = v end - elseif str and str ~= "" then - str = gsub(str,"([a-z]+):([^ \"\']*)",_resolve_) end - return str -end -resolvers.resolve = resolve + makepattern() -if os.uname then + getmetatable(prefixes).__newindex = makepattern - for k, v in next, os.uname() do - if not prefixes[k] then - prefixes[k] = function() return v end - end + function resolvers.repath(str) + return lpegmatch(pattern,str) + end + +else -- already the default: + + function resolvers.repath(str) + return str end end @@ -10670,13 +12675,23 @@ if not modules then modules = { } end modules ['data-inp'] = { license = "see context related readme files" } -resolvers.finders = resolvers.finders or { } -resolvers.openers = resolvers.openers or { } -resolvers.loaders = resolvers.loaders or { } +local allocate = utilities.storage.allocate +local resolvers = resolvers + +local methodhandler = resolvers.methodhandler +local registermethod = resolvers.registermethod -resolvers.finders.notfound = { nil } -resolvers.openers.notfound = { nil } -resolvers.loaders.notfound = { false, nil, 0 } +local finders = allocate { helpers = { }, notfound = function() end } +local openers = allocate { helpers = { }, notfound = function() end } +local loaders = allocate { helpers = { }, notfound = function() return false, nil, 0 end } + +registermethod("finders", finders, "uri") +registermethod("openers", openers, "uri") +registermethod("loaders", loaders, "uri") + +resolvers.finders = finders +resolvers.openers = openers +resolvers.loaders = loaders end -- of closure @@ -10691,15 +12706,23 @@ if not modules then modules = { } end modules ['data-out'] = { license = "see context related readme files" } -outputs = outputs or { } +local allocate = utilities.storage.allocate +local resolvers = resolvers + +local registermethod = resolvers.registermethod +local savers = allocate { helpers = { } } + +resolvers.savers = savers + +registermethod("savers", savers, "uri") end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['data-con'] = { +if not modules then modules = { } end modules ['data-fil'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -10707,6 +12730,124 @@ if not modules then modules = { } end modules ['data-con'] = { license = "see context related readme files" } +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) + +local report_files = logs.reporter("resolvers","files") + +local resolvers = resolvers + +local finders, openers, loaders, savers = resolvers.finders, resolvers.openers, resolvers.loaders, resolvers.savers +local locators, hashers, generators, concatinators = resolvers.locators, resolvers.hashers, resolvers.generators, resolvers.concatinators + +local checkgarbage = utilities.garbagecollector and utilities.garbagecollector.check + +function locators.file(specification) + local name = specification.filename + local realname = resolvers.resolve(name) -- no shortcut + if realname and realname ~= '' and lfs.isdir(realname) then + if trace_locating then + report_files("file locator '%s' found as '%s'",name,realname) + end + resolvers.appendhash('file',name,true) -- cache + elseif trace_locating then + report_files("file locator '%s' not found",name) + end +end + +function hashers.file(specification) + local name = specification.filename + local content = caches.loadcontent(name,'files') + resolvers.registerfilehash(name,content,content==nil) +end + +function generators.file(specification) + local path = specification.filename + local content = resolvers.scanfiles(path) + resolvers.registerfilehash(path,content,true) +end + +concatinators.file = file.join + +function finders.file(specification,filetype) + local filename = specification.filename + local foundname = resolvers.findfile(filename,filetype) + if foundname and foundname ~= "" then + if trace_locating then + report_files("file finder: '%s' found",filename) + end + return foundname + else + if trace_locating then + report_files("file finder: %s' not found",filename) + end + return finders.notfound() + end +end + +-- The default textopener will be overloaded later on. + +function openers.helpers.textopener(tag,filename,f) + return { + reader = function() return f:read () end, + close = function() logs.show_close(filename) return f:close() end, + } +end + +function openers.file(specification,filetype) + local filename = specification.filename + if filename and filename ~= "" then + local f = io.open(filename,"r") + if f then + if trace_locating then + report_files("file opener, '%s' opened",filename) + end + return openers.helpers.textopener("file",filename,f) + end + end + if trace_locating then + report_files("file opener, '%s' not found",filename) + end + return openers.notfound() +end + +function loaders.file(specification,filetype) + local filename = specification.filename + if filename and filename ~= "" then + local f = io.open(filename,"rb") + if f then + logs.show_load(filename) + if trace_locating then + report_files("file loader, '%s' loaded",filename) + end + local s = f:read("*a") + if checkgarbage then + checkgarbage(#s) + end + f:close() + if s then + return true, s, #s + end + end + end + if trace_locating then + report_files("file loader, '%s' not found",filename) + end + return loaders.notfound() +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-con'] = { + version = 1.100, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + local format, lower, gsub = string.format, string.lower, string.gsub local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) @@ -10726,50 +12867,63 @@ table structures without bothering about the disk cache.

Examples of usage can be found in the font related code.

--ldx]]-- -containers = containers or { } - +containers = containers or { } +local containers = containers containers.usecache = true +local report_containers = logs.reporter("resolvers","containers") + local function report(container,tag,name) if trace_cache or trace_containers then - logs.report(format("%s cache",container.subcategory),"%s: %s",tag,name or 'invalid') + report_containers("container: %s, tag: %s, name: %s",container.subcategory,tag,name or 'invalid') end end local allocated = { } --- tracing +local mt = { + __index = function(t,k) + if k == "writable" then + local writable = caches.getwritablepath(t.category,t.subcategory) or { "." } + t.writable = writable + return writable + elseif k == "readables" then + local readables = caches.getreadablepaths(t.category,t.subcategory) or { "." } + t.readables = readables + return readables + end + end, + __storage__ = true +} function containers.define(category, subcategory, version, enabled) - return function() - if category and subcategory then - local c = allocated[category] - if not c then - c = { } - allocated[category] = c - end - local s = c[subcategory] - if not s then - s = { - category = category, - subcategory = subcategory, - storage = { }, - enabled = enabled, - version = version or 1.000, - trace = false, - path = caches and caches.setpath and caches.setpath(category,subcategory), - } - c[subcategory] = s - end - return s - else - return nil + if category and subcategory then + local c = allocated[category] + if not c then + c = { } + allocated[category] = c + end + local s = c[subcategory] + if not s then + s = { + category = category, + subcategory = subcategory, + storage = { }, + enabled = enabled, + version = version or math.pi, -- after all, this is TeX + trace = false, + -- writable = caches.getwritablepath and caches.getwritablepath (category,subcategory) or { "." }, + -- readables = caches.getreadablepaths and caches.getreadablepaths(category,subcategory) or { "." }, + } + setmetatable(s,mt) + c[subcategory] = s end + return s end end function containers.is_usable(container, name) - return container.enabled and caches and caches.iswritable(container.path, name) + return container.enabled and caches and caches.is_writable(container.writable, name) end function containers.is_valid(container, name) @@ -10782,18 +12936,20 @@ function containers.is_valid(container, name) end function containers.read(container,name) - if container.enabled and caches and not container.storage[name] and containers.usecache then - container.storage[name] = caches.loaddata(container.path,name) - if containers.is_valid(container,name) then + local storage = container.storage + local stored = storage[name] + if not stored and container.enabled and caches and containers.usecache then + stored = caches.loaddata(container.readables,name) + if stored and stored.cache_version == container.version then report(container,"loaded",name) else - container.storage[name] = nil + stored = nil end - end - if container.storage[name] then + storage[name] = stored + elseif stored then report(container,"reusing",name) end - return container.storage[name] + return stored end function containers.write(container, name, data) @@ -10802,7 +12958,7 @@ function containers.write(container, name, data) if container.enabled and caches then local unique, shared = data.unique, data.shared data.unique, data.shared = nil, nil - caches.savedata(container.path, name, data) + caches.savedata(container.writable, name, data) report(container,"saved",name) data.unique, data.shared = unique, shared end @@ -10837,50 +12993,18 @@ local format, lower, gsub, find = string.format, string.lower, string.gsub, stri local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) --- since we want to use the cache instead of the tree, we will now --- reimplement the saver. - -local save_data = resolvers.save_data -local load_data = resolvers.load_data - -resolvers.cachepath = nil -- public, for tracing -resolvers.usecache = true -- public, for tracing +local report_mounts = logs.reporter("resolvers","mounts") -function resolvers.save_data(dataname) - save_data(dataname, function(cachename,dataname) - resolvers.usecache = not toboolean(resolvers.expansion("CACHEINTDS") or "false",true) - if resolvers.usecache then - resolvers.cachepath = resolvers.cachepath or caches.definepath("trees") - return file.join(resolvers.cachepath(),caches.hashed(cachename)) - else - return file.join(cachename,dataname) - end - end) -end - -function resolvers.load_data(pathname,dataname,filename) - load_data(pathname,dataname,filename,function(dataname,filename) - resolvers.usecache = not toboolean(resolvers.expansion("CACHEINTDS") or "false",true) - if resolvers.usecache then - resolvers.cachepath = resolvers.cachepath or caches.definepath("trees") - return file.join(resolvers.cachepath(),caches.hashed(pathname)) - else - if not filename or (filename == "") then - filename = dataname - end - return file.join(pathname,filename) - end - end) -end +local resolvers = resolvers -- we will make a better format, maybe something xml or just text or lua resolvers.automounted = resolvers.automounted or { } function resolvers.automount(usecache) - local mountpaths = resolvers.clean_path_list(resolvers.expansion('TEXMFMOUNT')) + local mountpaths = resolvers.cleanpathlist(resolvers.expansion('TEXMFMOUNT')) if (not mountpaths or #mountpaths == 0) and usecache then - mountpaths = { caches.setpath("mount") } + mountpaths = caches.getreadablepaths("mount") end if mountpaths and #mountpaths > 0 then statistics.starttiming(resolvers.instance) @@ -10894,7 +13018,7 @@ function resolvers.automount(usecache) -- skip elseif find(line,"^zip://") then if trace_locating then - logs.report("fileio","mounting %s",line) + report_mounts("mounting %s",line) end table.insert(resolvers.automounted,line) resolvers.usezipfile(line) @@ -10910,40 +13034,40 @@ end -- status info -statistics.register("used config path", function() return caches.configpath() end) -statistics.register("used cache path", function() return caches.temp() or "?" end) +statistics.register("used config file", function() return caches.configfiles() end) +statistics.register("used cache path", function() return caches.usedpaths() end) -- experiment (code will move) -function statistics.save_fmt_status(texname,formatbanner,sourcefile) -- texname == formatname +function statistics.savefmtstatus(texname,formatbanner,sourcefile) -- texname == formatname local enginebanner = status.list().banner if formatbanner and enginebanner and sourcefile then local luvname = file.replacesuffix(texname,"luv") local luvdata = { enginebanner = enginebanner, formatbanner = formatbanner, - sourcehash = md5.hex(io.loaddata(resolvers.find_file(sourcefile)) or "unknown"), + sourcehash = md5.hex(io.loaddata(resolvers.findfile(sourcefile)) or "unknown"), sourcefile = sourcefile, } io.savedata(luvname,table.serialize(luvdata,true)) end end -function statistics.check_fmt_status(texname) +function statistics.checkfmtstatus(texname) local enginebanner = status.list().banner if enginebanner and texname then local luvname = file.replacesuffix(texname,"luv") if lfs.isfile(luvname) then local luv = dofile(luvname) if luv and luv.sourcefile then - local sourcehash = md5.hex(io.loaddata(resolvers.find_file(luv.sourcefile)) or "unknown") + local sourcehash = md5.hex(io.loaddata(resolvers.findfile(luv.sourcefile)) or "unknown") local luvbanner = luv.enginebanner or "?" if luvbanner ~= enginebanner then - return string.format("engine mismatch (luv:%s <> bin:%s)",luvbanner,enginebanner) + return format("engine mismatch (luv: %s <> bin: %s)",luvbanner,enginebanner) end local luvhash = luv.sourcehash or "?" if luvhash ~= sourcehash then - return string.format("source mismatch (luv:%s <> bin:%s)",luvhash,sourcehash) + return format("source mismatch (luv: %s <> bin: %s)",luvhash,sourcehash) end else return "invalid status file" @@ -10968,25 +13092,30 @@ if not modules then modules = { } end modules ['data-zip'] = { license = "see context related readme files" } +-- partly redone .. needs testing + local format, find, match = string.format, string.find, string.match -local unpack = unpack or table.unpack local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local report_zip = logs.reporter("resolvers","zip") + -- zip:///oeps.zip?name=bla/bla.tex -- zip:///oeps.zip?tree=tex/texmf-local -- zip:///texmf.zip?tree=/tex/texmf -- zip:///texmf.zip?tree=/tex/texmf-local -- zip:///texmf-mine.zip?tree=/tex/texmf-projects -zip = zip or { } -zip.archives = zip.archives or { } -zip.registeredfiles = zip.registeredfiles or { } +local resolvers = resolvers -local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders -local locators, hashers, concatinators = resolvers.locators, resolvers.hashers, resolvers.concatinators +zip = zip or { } +local zip = zip -local archives = zip.archives +zip.archives = zip.archives or { } +local archives = zip.archives + +zip.registeredfiles = zip.registeredfiles or { } +local registeredfiles = zip.registeredfiles local function validzip(str) -- todo: use url splitter if not find(str,"^zip://") then @@ -11002,7 +13131,7 @@ function zip.openarchive(name) else local arch = archives[name] if not arch then - local full = resolvers.find_file(name) or "" + local full = resolvers.findfile(name) or "" arch = (full ~= "" and zip.open(full)) or false archives[name] = arch end @@ -11017,163 +13146,162 @@ function zip.closearchive(name) end end -function locators.zip(specification) -- where is this used? startup zips (untested) - specification = resolvers.splitmethod(specification) - local zipfile = specification.path - local zfile = zip.openarchive(name) -- tricky, could be in to be initialized tree +function resolvers.locators.zip(specification) + local archive = specification.filename + local zipfile = archive and archive ~= "" and zip.openarchive(archive) -- tricky, could be in to be initialized tree if trace_locating then - if zfile then - logs.report("fileio","zip locator, archive '%s' found",specification.original) + if zipfile then + report_zip("locator, archive '%s' found",archive) else - logs.report("fileio","zip locator, archive '%s' not found",specification.original) + report_zip("locator, archive '%s' not found",archive) end end end -function hashers.zip(tag,name) +function resolvers.hashers.zip(specification) + local archive = specification.filename if trace_locating then - logs.report("fileio","loading zip file '%s' as '%s'",name,tag) + report_zip("loading file '%s'",archive) end - resolvers.usezipfile(format("%s?tree=%s",tag,name)) + resolvers.usezipfile(specification.original) end -function concatinators.zip(tag,path,name) +function resolvers.concatinators.zip(zipfile,path,name) -- ok ? if not path or path == "" then - return format('%s?name=%s',tag,name) + return format('%s?name=%s',zipfile,name) else - return format('%s?name=%s/%s',tag,path,name) + return format('%s?name=%s/%s',zipfile,path,name) end end -function resolvers.isreadable.zip(name) - return true -end - -function finders.zip(specification,filetype) - specification = resolvers.splitmethod(specification) - if specification.path then - local q = url.query(specification.query) - if q.name then - local zfile = zip.openarchive(specification.path) +function resolvers.finders.zip(specification) + local original = specification.original + local archive = specification.filename + if archive then + local query = url.query(specification.query) + local queryname = query.name + if queryname then + local zfile = zip.openarchive(archive) if zfile then if trace_locating then - logs.report("fileio","zip finder, archive '%s' found",specification.path) + report_zip("finder, archive '%s' found",archive) end - local dfile = zfile:open(q.name) + local dfile = zfile:open(queryname) if dfile then dfile = zfile:close() if trace_locating then - logs.report("fileio","zip finder, file '%s' found",q.name) + report_zip("finder, file '%s' found",queryname) end return specification.original elseif trace_locating then - logs.report("fileio","zip finder, file '%s' not found",q.name) + report_zip("finder, file '%s' not found",queryname) end elseif trace_locating then - logs.report("fileio","zip finder, unknown archive '%s'",specification.path) + report_zip("finder, unknown archive '%s'",archive) end end end if trace_locating then - logs.report("fileio","zip finder, '%s' not found",filename) + report_zip("finder, '%s' not found",original) end - return unpack(finders.notfound) + return resolvers.finders.notfound() end -function openers.zip(specification) - local zipspecification = resolvers.splitmethod(specification) - if zipspecification.path then - local q = url.query(zipspecification.query) - if q.name then - local zfile = zip.openarchive(zipspecification.path) +function resolvers.openers.zip(specification) + local original = specification.original + local archive = specification.filename + if archive then + local query = url.query(specification.query) + local queryname = query.name + if queryname then + local zfile = zip.openarchive(archive) if zfile then if trace_locating then - logs.report("fileio","zip opener, archive '%s' opened",zipspecification.path) + report_zip("opener, archive '%s' opened",archive) end - local dfile = zfile:open(q.name) + local dfile = zfile:open(queryname) if dfile then - logs.show_open(specification) if trace_locating then - logs.report("fileio","zip opener, file '%s' found",q.name) + report_zip("opener, file '%s' found",queryname) end - return openers.text_opener(specification,dfile,'zip') + return resolvers.openers.helpers.textopener('zip',original,dfile) elseif trace_locating then - logs.report("fileio","zip opener, file '%s' not found",q.name) + report_zip("opener, file '%s' not found",queryname) end elseif trace_locating then - logs.report("fileio","zip opener, unknown archive '%s'",zipspecification.path) + report_zip("opener, unknown archive '%s'",archive) end end end if trace_locating then - logs.report("fileio","zip opener, '%s' not found",filename) + report_zip("opener, '%s' not found",original) end - return unpack(openers.notfound) + return resolvers.openers.notfound() end -function loaders.zip(specification) - specification = resolvers.splitmethod(specification) - if specification.path then - local q = url.query(specification.query) - if q.name then - local zfile = zip.openarchive(specification.path) +function resolvers.loaders.zip(specification) + local original = specification.original + local archive = specification.filename + if archive then + local query = url.query(specification.query) + local queryname = query.name + if queryname then + local zfile = zip.openarchive(archive) if zfile then if trace_locating then - logs.report("fileio","zip loader, archive '%s' opened",specification.path) + report_zip("loader, archive '%s' opened",archive) end - local dfile = zfile:open(q.name) + local dfile = zfile:open(queryname) if dfile then - logs.show_load(filename) + logs.show_load(original) if trace_locating then - logs.report("fileio","zip loader, file '%s' loaded",filename) + report_zip("loader, file '%s' loaded",original) end local s = dfile:read("*all") dfile:close() return true, s, #s elseif trace_locating then - logs.report("fileio","zip loader, file '%s' not found",q.name) + report_zip("loader, file '%s' not found",queryname) end elseif trace_locating then - logs.report("fileio","zip loader, unknown archive '%s'",specification.path) + report_zip("loader, unknown archive '%s'",archive) end end end if trace_locating then - logs.report("fileio","zip loader, '%s' not found",filename) + report_zip("loader, '%s' not found",original) end - return unpack(openers.notfound) + return resolvers.openers.notfound() end -- zip:///somefile.zip -- zip:///somefile.zip?tree=texmf-local -> mount -function resolvers.usezipfile(zipname) - zipname = validzip(zipname) - local specification = resolvers.splitmethod(zipname) - local zipfile = specification.path - if zipfile and not zip.registeredfiles[zipname] then - local tree = url.query(specification.query).tree or "" - local z = zip.openarchive(zipfile) +function resolvers.usezipfile(archive) + local specification = resolvers.splitmethod(archive) -- to be sure + local archive = specification.filename + if archive and not registeredfiles[archive] then + local z = zip.openarchive(archive) if z then - local instance = resolvers.instance + local tree = url.query(specification.query).tree or "" if trace_locating then - logs.report("fileio","zip registering, registering archive '%s'",zipname) - end - statistics.starttiming(instance) - resolvers.prepend_hash('zip',zipname,zipfile) - resolvers.extend_texmf_var(zipname) -- resets hashes too - zip.registeredfiles[zipname] = z - instance.files[zipname] = resolvers.register_zip_file(z,tree or "") - statistics.stoptiming(instance) + report_zip("registering, registering archive '%s'",archive) + end + statistics.starttiming(resolvers.instance) + resolvers.prependhash('zip',archive) + resolvers.extendtexmfvariable(archive) -- resets hashes too + registeredfiles[archive] = z + instance.files[archive] = resolvers.registerzipfile(z,tree) + statistics.stoptiming(resolvers.instance) elseif trace_locating then - logs.report("fileio","zip registering, unknown archive '%s'",zipname) + report_zip("registering, unknown archive '%s'",archive) end elseif trace_locating then - logs.report("fileio","zip registering, '%s' not found",zipname) + report_zip("registering, '%s' not found",archive) end end -function resolvers.register_zip_file(z,tree) +function resolvers.registerzipfile(z,tree) local files, filter = { }, "" if tree == "" then filter = "^(.+)/(.-)$" @@ -11181,9 +13309,9 @@ function resolvers.register_zip_file(z,tree) filter = format("^%s/(.+)/(.-)$",tree) end if trace_locating then - logs.report("fileio","zip registering, using filter '%s'",filter) + report_zip("registering, using filter '%s'",filter) end - local register, n = resolvers.register_file, 0 + local register, n = resolvers.registerfile, 0 for i in z:files() do local path, name = match(i.filename,filter) if path then @@ -11198,11 +13326,89 @@ function resolvers.register_zip_file(z,tree) n = n + 1 end end - logs.report("fileio","zip registering, %s files registered",n) + report_zip("registering, %s files registered",n) return files end +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-tre'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- \input tree://oeps1/**/oeps.tex + +local find, gsub, format = string.find, string.gsub, string.format + +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) + +local report_trees = logs.reporter("resolvers","trees") + +local resolvers = resolvers + +local done, found, notfound = { }, { }, resolvers.finders.notfound + +function resolvers.finders.tree(specification) + local spec = specification.filename + local fnd = found[spec] + if fnd == nil then + if spec ~= "" then + local path, name = file.dirname(spec), file.basename(spec) + if path == "" then path = "." end + local hash = done[path] + if not hash then + local pattern = path .. "/*" -- we will use the proper splitter + hash = dir.glob(pattern) + done[path] = hash + end + local pattern = "/" .. gsub(name,"([%.%-%+])", "%%%1") .. "$" + for k=1,#hash do + local v = hash[k] + if find(v,pattern) then + found[spec] = v + return v + end + end + end + fnd = notfound() -- false + found[spec] = fnd + end + return fnd +end + +function resolvers.locators.tree(specification) + local name = specification.filename + if name ~= '' and lfs.isdir(name) then + if trace_locating then + report_trees("locator '%s' found",name) + end + resolvers.appendhash('tree',name,false) -- don't cache + elseif trace_locating then + report_trees("locator '%s' not found",name) + end +end + +function resolvers.hashers.tree(specification) + local name = specification.filename + if trace_locating then + report_trees("analysing '%s'",name) + end + resolvers.methodhandler("hashers",name) +end + +resolvers.concatinators.tree = resolvers.concatinators.file +resolvers.generators.tree = resolvers.generators.file +resolvers.openers.tree = resolvers.openers.file +resolvers.loaders.tree = resolvers.loaders.file + + end -- of closure do -- create closure to overcome 200 locals limit @@ -11215,58 +13421,59 @@ if not modules then modules = { } end modules ['data-crl'] = { license = "see context related readme files" } -local gsub = string.gsub +-- this one is replaced by data-sch.lua -- -curl = curl or { } +local gsub = string.gsub -curl.cached = { } -curl.cachepath = caches.definepath("curl") +local resolvers = resolvers local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders -function curl.fetch(protocol, name) - local cachename = curl.cachepath() .. "/" .. gsub(name,"[^%a%d%.]+","-") --- cachename = gsub(cachename,"[\\/]", io.fileseparator) - cachename = gsub(cachename,"[\\]", "/") -- cleanup - if not curl.cached[name] then +resolvers.curl = resolvers.curl or { } +local curl = resolvers.curl + +local cached = { } + +local function runcurl(specification) + local original = specification.original + -- local scheme = specification.scheme + local cleanname = gsub(original,"[^%a%d%.]+","-") + local cachename = caches.setfirstwritablefile(cleanname,"curl") + if not cached[original] then if not io.exists(cachename) then - curl.cached[name] = cachename - local command = "curl --silent --create-dirs --output " .. cachename .. " " .. name -- no protocol .. "://" + cached[original] = cachename + local command = "curl --silent --create-dirs --output " .. cachename .. " " .. original os.spawn(command) end if io.exists(cachename) then - curl.cached[name] = cachename + cached[original] = cachename else - curl.cached[name] = "" + cached[original] = "" end end - return curl.cached[name] -end - -function finders.curl(protocol,filename) - local foundname = curl.fetch(protocol, filename) - return finders.generic(protocol,foundname,filetype) + return cached[original] end -function openers.curl(protocol,filename) - return openers.generic(protocol,filename) -end +-- old code: we could be cleaner using specification (see schemes) -function loaders.curl(protocol,filename) - return loaders.generic(protocol,filename) +local function finder(specification,filetype) + return resolvers.methodhandler("finders",runcurl(specification),filetype) end --- todo: metamethod +local opener = openers.file +local loader = loaders.file -function curl.install(protocol) - finders[protocol] = function (filename,filetype) return finders.curl(protocol,filename) end - openers[protocol] = function (filename) return openers.curl(protocol,filename) end - loaders[protocol] = function (filename) return loaders.curl(protocol,filename) end +local function install(scheme) + finders[scheme] = finder + openers[scheme] = opener + loaders[scheme] = loader end -curl.install('http') -curl.install('https') -curl.install('ftp') +resolvers.curl.install = install + +install('http') +install('https') +install('ftp') end -- of closure @@ -11287,9 +13494,13 @@ if not modules then modules = { } end modules ['data-lua'] = { local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local report_libraries = logs.reporter("resolvers","libraries") + local gsub, insert = string.gsub, table.insert local unpack = unpack or table.unpack +local resolvers, package = resolvers, package + local libformats = { 'luatexlibs', 'tex', 'texmfscripts', 'othertextfiles' } -- 'luainputs' local clibformats = { 'lib' } @@ -11298,7 +13509,7 @@ local _path_, libpaths, _cpath_, clibpaths function package.libpaths() if not _path_ or package.path ~= _path_ then _path_ = package.path - libpaths = file.split_path(_path_,";") + libpaths = file.splitpath(_path_,";") end return libpaths end @@ -11306,7 +13517,7 @@ end function package.clibpaths() if not _cpath_ or package.cpath ~= _cpath_ then _cpath_ = package.cpath - clibpaths = file.split_path(_cpath_,";") + clibpaths = file.splitpath(_cpath_,";") end return clibpaths end @@ -11315,18 +13526,18 @@ local function thepath(...) local t = { ... } t[#t+1] = "?.lua" local path = file.join(unpack(t)) if trace_locating then - logs.report("fileio","! appending '%s' to 'package.path'",path) + report_libraries("! appending '%s' to 'package.path'",path) end return path end local p_libpaths, a_libpaths = { }, { } -function package.append_libpath(...) +function package.appendtolibpath(...) insert(a_libpath,thepath(...)) end -function package.prepend_libpath(...) +function package.prependtolibpath(...) insert(p_libpaths,1,thepath(...)) end @@ -11337,31 +13548,30 @@ local function loaded(libpaths,name,simple) local libpath = libpaths[i] local resolved = gsub(libpath,"%?",simple) if trace_locating then -- more detail - logs.report("fileio","! checking for '%s' on 'package.path': '%s' => '%s'",simple,libpath,resolved) + report_libraries("! checking for '%s' on 'package.path': '%s' => '%s'",simple,libpath,resolved) end - if resolvers.isreadable.file(resolved) then + if file.is_readable(resolved) then if trace_locating then - logs.report("fileio","! lib '%s' located via 'package.path': '%s'",name,resolved) + report_libraries("! lib '%s' located via 'package.path': '%s'",name,resolved) end return loadfile(resolved) end end end - package.loaders[2] = function(name) -- was [#package.loaders+1] if trace_locating then -- mode detail - logs.report("fileio","! locating '%s'",name) + report_libraries("! locating '%s'",name) end for i=1,#libformats do local format = libformats[i] - local resolved = resolvers.find_file(name,format) or "" + local resolved = resolvers.findfile(name,format) or "" if trace_locating then -- mode detail - logs.report("fileio","! checking for '%s' using 'libformat path': '%s'",name,format) + report_libraries("! checking for '%s' using 'libformat path': '%s'",name,format) end if resolved ~= "" then if trace_locating then - logs.report("fileio","! lib '%s' located via environment: '%s'",name,resolved) + report_libraries("! lib '%s' located via environment: '%s'",name,resolved) end return loadfile(resolved) end @@ -11379,16 +13589,16 @@ package.loaders[2] = function(name) -- was [#package.loaders+1] for i=1,#clibformats do -- better have a dedicated loop local format = clibformats[i] - local paths = resolvers.expanded_path_list_from_var(format) + local paths = resolvers.expandedpathlistfromvariable(format) for p=1,#paths do local path = paths[p] local resolved = file.join(path,libname) if trace_locating then -- mode detail - logs.report("fileio","! checking for '%s' using 'clibformat path': '%s'",libname,path) + report_libraries("! checking for '%s' using 'clibformat path': '%s'",libname,path) end - if resolvers.isreadable.file(resolved) then + if file.is_readable(resolved) then if trace_locating then - logs.report("fileio","! lib '%s' located via 'clibformat': '%s'",libname,resolved) + report_libraries("! lib '%s' located via 'clibformat': '%s'",libname,resolved) end return package.loadlib(resolved,name) end @@ -11398,140 +13608,43 @@ package.loaders[2] = function(name) -- was [#package.loaders+1] local libpath = clibpaths[i] local resolved = gsub(libpath,"?",simple) if trace_locating then -- more detail - logs.report("fileio","! checking for '%s' on 'package.cpath': '%s'",simple,libpath) + report_libraries("! checking for '%s' on 'package.cpath': '%s'",simple,libpath) end - if resolvers.isreadable.file(resolved) then + if file.is_readable(resolved) then if trace_locating then - logs.report("fileio","! lib '%s' located via 'package.cpath': '%s'",name,resolved) + report_libraries("! lib '%s' located via 'package.cpath': '%s'",name,resolved) end return package.loadlib(resolved,name) end end -- just in case the distribution is messed up if trace_loading then -- more detail - logs.report("fileio","! checking for '%s' using 'luatexlibs': '%s'",name) + report_libraries("! checking for '%s' using 'luatexlibs': '%s'",name) end - local resolved = resolvers.find_file(file.basename(name),'luatexlibs') or "" + local resolved = resolvers.findfile(file.basename(name),'luatexlibs') or "" if resolved ~= "" then if trace_locating then - logs.report("fileio","! lib '%s' located by basename via environment: '%s'",name,resolved) + report_libraries("! lib '%s' located by basename via environment: '%s'",name,resolved) end return loadfile(resolved) end if trace_locating then - logs.report("fileio",'? unable to locate lib: %s',name) + report_libraries('? unable to locate lib: %s',name) end -- return "unable to locate " .. name end resolvers.loadlualib = require +-- -- -- -- -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['luat-kps'] = { - version = 1.001, - comment = "companion to luatools.lua", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - ---[[ldx-- -

This file is used when we want the input handlers to behave like -kpsewhich. What to do with the following:

- - -{$SELFAUTOLOC,$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c} -$SELFAUTOLOC : /usr/tex/bin/platform -$SELFAUTODIR : /usr/tex/bin -$SELFAUTOPARENT : /usr/tex - - -

How about just forgetting about them?

---ldx]]-- - -local suffixes = resolvers.suffixes -local formats = resolvers.formats - -suffixes['gf'] = { 'gf' } -suffixes['pk'] = { 'pk' } -suffixes['base'] = { 'base' } -suffixes['bib'] = { 'bib' } -suffixes['bst'] = { 'bst' } -suffixes['cnf'] = { 'cnf' } -suffixes['mem'] = { 'mem' } -suffixes['mf'] = { 'mf' } -suffixes['mfpool'] = { 'pool' } -suffixes['mft'] = { 'mft' } -suffixes['mppool'] = { 'pool' } -suffixes['graphic/figure'] = { 'eps', 'epsi' } -suffixes['texpool'] = { 'pool' } -suffixes['PostScript header'] = { 'pro' } -suffixes['ist'] = { 'ist' } -suffixes['web'] = { 'web', 'ch' } -suffixes['cweb'] = { 'w', 'web', 'ch' } -suffixes['cmap files'] = { 'cmap' } -suffixes['lig files'] = { 'lig' } -suffixes['bitmap font'] = { } -suffixes['MetaPost support'] = { } -suffixes['TeX system documentation'] = { } -suffixes['TeX system sources'] = { } -suffixes['dvips config'] = { } -suffixes['type42 fonts'] = { } -suffixes['web2c files'] = { } -suffixes['other text files'] = { } -suffixes['other binary files'] = { } -suffixes['opentype fonts'] = { 'otf' } - -suffixes['fmt'] = { 'fmt' } -suffixes['texmfscripts'] = { 'rb','lua','py','pl' } - -suffixes['pdftex config'] = { } -suffixes['Troff fonts'] = { } - -suffixes['ls-R'] = { } +package.obsolete = package.obsolete or { } ---[[ldx-- -

If you wondered abou tsome of the previous mappings, how about -the next bunch:

---ldx]]-- +package.append_libpath = appendtolibpath -- will become obsolete +package.prepend_libpath = prependtolibpath -- will become obsolete -formats['bib'] = '' -formats['bst'] = '' -formats['mft'] = '' -formats['ist'] = '' -formats['web'] = '' -formats['cweb'] = '' -formats['MetaPost support'] = '' -formats['TeX system documentation'] = '' -formats['TeX system sources'] = '' -formats['Troff fonts'] = '' -formats['dvips config'] = '' -formats['graphic/figure'] = '' -formats['ls-R'] = '' -formats['other text files'] = '' -formats['other binary files'] = '' - -formats['gf'] = '' -formats['pk'] = '' -formats['base'] = 'MFBASES' -formats['cnf'] = '' -formats['mem'] = 'MPMEMS' -formats['mf'] = 'MFINPUTS' -formats['mfpool'] = 'MFPOOL' -formats['mppool'] = 'MPPOOL' -formats['texpool'] = 'TEXPOOL' -formats['PostScript header'] = 'TEXPSHEADERS' -formats['cmap files'] = 'CMAPFONTS' -formats['type42 fonts'] = 'T42FONTS' -formats['web2c files'] = 'WEB2C' -formats['pdftex config'] = 'PDFTEXCONFIG' -formats['texmfscripts'] = 'TEXMFSCRIPTS' -formats['bitmap font'] = '' -formats['lig files'] = 'LIGFONTS' +package.obsolete.append_libpath = appendtolibpath -- will become obsolete +package.obsolete.prepend_libpath = prependtolibpath -- will become obsolete end -- of closure @@ -11547,49 +13660,54 @@ if not modules then modules = { } end modules ['data-aux'] = { } local find = string.find +local type, next = type, next local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) -function resolvers.update_script(oldname,newname) -- oldname -> own.name, not per se a suffix +local resolvers = resolvers + +local report_scripts = logs.reporter("resolvers","scripts") + +function resolvers.updatescript(oldname,newname) -- oldname -> own.name, not per se a suffix local scriptpath = "scripts/context/lua" newname = file.addsuffix(newname,"lua") - local oldscript = resolvers.clean_path(oldname) + local oldscript = resolvers.cleanpath(oldname) if trace_locating then - logs.report("fileio","to be replaced old script %s", oldscript) + report_scripts("to be replaced old script %s", oldscript) end - local newscripts = resolvers.find_files(newname) or { } + local newscripts = resolvers.findfiles(newname) or { } if #newscripts == 0 then if trace_locating then - logs.report("fileio","unable to locate new script") + report_scripts("unable to locate new script") end else for i=1,#newscripts do - local newscript = resolvers.clean_path(newscripts[i]) + local newscript = resolvers.cleanpath(newscripts[i]) if trace_locating then - logs.report("fileio","checking new script %s", newscript) + report_scripts("checking new script %s", newscript) end if oldscript == newscript then if trace_locating then - logs.report("fileio","old and new script are the same") + report_scripts("old and new script are the same") end elseif not find(newscript,scriptpath) then if trace_locating then - logs.report("fileio","new script should come from %s",scriptpath) + report_scripts("new script should come from %s",scriptpath) end elseif not (find(oldscript,file.removesuffix(newname).."$") or find(oldscript,newname.."$")) then if trace_locating then - logs.report("fileio","invalid new script name") + report_scripts("invalid new script name") end else local newdata = io.loaddata(newscript) if newdata then if trace_locating then - logs.report("fileio","old script content replaced by new content") + report_scripts("old script content replaced by new content") end io.savedata(oldscript,newdata) break elseif trace_locating then - logs.report("fileio","unable to load new script") + report_scripts("unable to load new script") end end end @@ -11609,72 +13727,133 @@ if not modules then modules = { } end modules ['data-tmf'] = { license = "see context related readme files" } -local find, gsub, match = string.find, string.gsub, string.match -local getenv, setenv = os.getenv, os.setenv +local resolvers = resolvers --- loads *.tmf files in minimal tree roots (to be optimized and documented) +local report_tds = logs.reporter("resolvers","tds") -function resolvers.check_environment(tree) - logs.simpleline() - setenv('TMP', getenv('TMP') or getenv('TEMP') or getenv('TMPDIR') or getenv('HOME')) - setenv('TEXOS', getenv('TEXOS') or ("texmf-" .. os.platform)) - setenv('TEXPATH', gsub(tree or "tex","\/+$",'')) - setenv('TEXMFOS', getenv('TEXPATH') .. "/" .. getenv('TEXOS')) - logs.simpleline() - logs.simple("preset : TEXPATH => %s", getenv('TEXPATH')) - logs.simple("preset : TEXOS => %s", getenv('TEXOS')) - logs.simple("preset : TEXMFOS => %s", getenv('TEXMFOS')) - logs.simple("preset : TMP => %s", getenv('TMP')) - logs.simple('') -end +-- = << +-- ? ?? +-- < += +-- > =+ -function resolvers.load_environment(name) -- todo: key=value as well as lua - local f = io.open(name) - if f then - for line in f:lines() do - if find(line,"^[%%%#]") then - -- skip comment - else - local key, how, value = match(line,"^(.-)%s*([<=>%?]+)%s*(.*)%s*$") - if how then - value = gsub(value,"%%(.-)%%", function(v) return getenv(v) or "" end) - if how == "=" or how == "<<" then - setenv(key,value) - elseif how == "?" or how == "??" then - setenv(key,getenv(key) or value) - elseif how == "<" or how == "+=" then - if getenv(key) then - setenv(key,getenv(key) .. io.fileseparator .. value) - else - setenv(key,value) - end - elseif how == ">" or how == "=+" then - if getenv(key) then - setenv(key,value .. io.pathseparator .. getenv(key)) - else - setenv(key,value) - end - end - end - end +function resolvers.load_tree(tree,resolve) + if type(tree) == "string" and tree ~= "" then + + local getenv, setenv = resolvers.getenv, resolvers.setenv + + -- later might listen to the raw osenv var as well + local texos = "texmf-" .. os.platform + + local oldroot = environment.texroot + local newroot = file.collapsepath(tree) + + local newtree = file.join(newroot,texos) + local newpath = file.join(newtree,"bin") + + if not lfs.isdir(newtree) then + report_tds("no '%s' under tree %s",texos,tree) + os.exit() end - f:close() + if not lfs.isdir(newpath) then + report_tds("no '%s/bin' under tree %s",texos,tree) + os.exit() + end + + local texmfos = newtree + + environment.texroot = newroot + environment.texos = texos + environment.texmfos = texmfos + + -- Beware, we need to obey the relocatable autoparent so we + -- set TEXMFCNF to its raw value. This is somewhat tricky when + -- we run a mkii job from within. Therefore, in mtxrun, there + -- is a resolve applied when we're in mkii/kpse mode. + + setenv('SELFAUTOPARENT', newroot) + setenv('SELFAUTODIR', newtree) + setenv('SELFAUTOLOC', newpath) + setenv('TEXROOT', newroot) + setenv('TEXOS', texos) + setenv('TEXMFOS', texmfos) + setenv('TEXMFCNF', resolvers.luacnfspec, not resolve) + setenv("PATH", newpath .. io.pathseparator .. getenv("PATH")) + + report_tds("changing from root '%s' to '%s'",oldroot,newroot) + report_tds("prepending '%s' to binary path",newpath) + report_tds() end end -function resolvers.load_tree(tree) - if tree and tree ~= "" then - local setuptex = 'setuptex.tmf' - if lfs.attributes(tree, "mode") == "directory" then -- check if not nil - setuptex = tree .. "/" .. setuptex - else - setuptex = tree + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-lst'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- used in mtxrun, can be loaded later .. todo + +local find, concat, upper, format = string.find, table.concat, string.upper, string.format + +resolvers.listers = resolvers.listers or { } + +local resolvers = resolvers + +local report_lists = logs.reporter("resolvers","lists") + +local function tabstr(str) + if type(str) == 'table' then + return concat(str," | ") + else + return str + end +end + +function resolvers.listers.variables(pattern) + local instance = resolvers.instance + local environment = instance.environment + local variables = instance.variables + local expansions = instance.expansions + local pattern = upper(pattern or "") + local configured = { } + local order = instance.order + for i=1,#order do + for k, v in next, order[i] do + if v ~= nil and configured[k] == nil then + configured[k] = v + end end - if io.exists(setuptex) then - resolvers.check_environment(tree) - resolvers.load_environment(setuptex) + end + local env = table.fastcopy(environment) + local var = table.fastcopy(variables) + local exp = table.fastcopy(expansions) + for key, value in table.sortedpairs(configured) do + if key ~= "" and (pattern == "" or find(upper(key),pattern)) then + report_lists(key) + report_lists(" env: %s",tabstr(rawget(environment,key)) or "unset") + report_lists(" var: %s",tabstr(configured[key]) or "unset") + report_lists(" exp: %s",tabstr(expansions[key]) or "unset") + report_lists(" res: %s",resolvers.resolve(expansions[key]) or "unset") end end + instance.environment = table.fastcopy(env) + instance.variables = table.fastcopy(var) + instance.expansions = table.fastcopy(exp) +end + +function resolvers.listers.configurations(report) + local configurations = resolvers.instance.specification + local report = report or texio.write_nl + for i=1,#configurations do + report(resolvers.resolve(configurations[i])) + end end @@ -11691,12 +13870,18 @@ if not modules then modules = { } end modules ['luat-sta'] = { -- this code is used in the updater -local gmatch, match = string.gmatch, string.match -local type = type +local gmatch, match = string.gmatch, string.match +local type = type + +states = states or { } +local states = states + +states.data = states.data or { } +local data = states.data + +states.hash = states.hash or { } +local hash = states.hash -states = states or { } -states.data = states.data or { } -states.hash = states.hash or { } states.tag = states.tag or "" states.filename = states.filename or "" @@ -11706,7 +13891,7 @@ function states.save(filename,tag) io.savedata(filename, "-- generator : luat-sta.lua\n" .. "-- state tag : " .. tag .. "\n\n" .. - table.serialize(states.data[tag or states.tag] or {},true) + table.serialize(data[tag or states.tag] or {},true) ) end @@ -11714,11 +13899,11 @@ function states.load(filename,tag) states.filename = filename states.tag = tag or "whatever" states.filename = file.addsuffix(states.filename,'lus') - states.data[states.tag], states.hash[states.tag] = (io.exists(filename) and dofile(filename)) or { }, { } + data[states.tag], hash[states.tag] = (io.exists(filename) and dofile(filename)) or { }, { } end -function states.set_by_tag(tag,key,value,default,persistent) - local d, h = states.data[tag], states.hash[tag] +local function set_by_tag(tag,key,value,default,persistent) + local d, h = data[tag], hash[tag] if d then if type(d) == "table" then local dkey, hkey = key, key @@ -11738,8 +13923,10 @@ function states.set_by_tag(tag,key,value,default,persistent) end dkey, hkey = post, key end - if type(value) == nil then - value = value or default + if value == nil then + value = default + elseif value == false then + -- special case elseif persistent then value = value or d[dkey] or default else @@ -11748,144 +13935,202 @@ function states.set_by_tag(tag,key,value,default,persistent) d[dkey], h[hkey] = value, value elseif type(d) == "string" then -- weird - states.data[tag], states.hash[tag] = value, value + data[tag], hash[tag] = value, value end end end -function states.get_by_tag(tag,key,default) - local h = states.hash[tag] +local function get_by_tag(tag,key,default) + local h = hash[tag] if h and h[key] then return h[key] else - local d = states.data[tag] + local d = data[tag] if d then for k in gmatch(key,"[^%.]+") do local dk = d[k] - if dk then + if dk ~= nil then d = dk else return default end end - return d or default + if d == false then + return false + else + return d or default + end end end end +states.set_by_tag = set_by_tag +states.get_by_tag = get_by_tag + function states.set(key,value,default,persistent) - states.set_by_tag(states.tag,key,value,default,persistent) + set_by_tag(states.tag,key,value,default,persistent) end function states.get(key,default) - return states.get_by_tag(states.tag,key,default) -end - ---~ states.data.update = { ---~ ["version"] = { ---~ ["major"] = 0, ---~ ["minor"] = 1, ---~ }, ---~ ["rsync"] = { ---~ ["server"] = "contextgarden.net", ---~ ["module"] = "minimals", ---~ ["repository"] = "current", ---~ ["flags"] = "-rpztlv --stats", ---~ }, ---~ ["tasks"] = { ---~ ["update"] = true, ---~ ["make"] = true, ---~ ["delete"] = false, ---~ }, ---~ ["platform"] = { ---~ ["host"] = true, ---~ ["other"] = { ---~ ["mswin"] = false, ---~ ["linux"] = false, ---~ ["linux-64"] = false, ---~ ["osx-intel"] = false, ---~ ["osx-ppc"] = false, ---~ ["sun"] = false, ---~ }, ---~ }, ---~ ["context"] = { ---~ ["available"] = {"current", "beta", "alpha", "experimental"}, ---~ ["selected"] = "current", ---~ }, ---~ ["formats"] = { ---~ ["cont-en"] = true, ---~ ["cont-nl"] = true, ---~ ["cont-de"] = false, ---~ ["cont-cz"] = false, ---~ ["cont-fr"] = false, ---~ ["cont-ro"] = false, ---~ }, ---~ ["engine"] = { ---~ ["pdftex"] = { ---~ ["install"] = true, ---~ ["formats"] = { ---~ ["pdftex"] = true, ---~ }, ---~ }, ---~ ["luatex"] = { ---~ ["install"] = true, ---~ ["formats"] = { ---~ }, ---~ }, ---~ ["xetex"] = { ---~ ["install"] = true, ---~ ["formats"] = { ---~ ["xetex"] = false, ---~ }, ---~ }, ---~ ["metapost"] = { ---~ ["install"] = true, ---~ ["formats"] = { ---~ ["mpost"] = true, ---~ ["metafun"] = true, ---~ }, ---~ }, ---~ }, ---~ ["fonts"] = { ---~ }, ---~ ["doc"] = { ---~ }, ---~ ["modules"] = { ---~ ["f-urwgaramond"] = false, ---~ ["f-urwgothic"] = false, ---~ ["t-bnf"] = false, ---~ ["t-chromato"] = false, ---~ ["t-cmscbf"] = false, ---~ ["t-cmttbf"] = false, ---~ ["t-construction-plan"] = false, ---~ ["t-degrade"] = false, ---~ ["t-french"] = false, ---~ ["t-lettrine"] = false, ---~ ["t-lilypond"] = false, ---~ ["t-mathsets"] = false, ---~ ["t-tikz"] = false, ---~ ["t-typearea"] = false, ---~ ["t-vim"] = false, ---~ }, ---~ } - ---~ states.save("teststate", "update") ---~ states.load("teststate", "update") - ---~ print(states.get_by_tag("update","rsync.server","unknown")) ---~ states.set_by_tag("update","rsync.server","oeps") ---~ print(states.get_by_tag("update","rsync.server","unknown")) ---~ states.save("teststate", "update") ---~ states.load("teststate", "update") ---~ print(states.get_by_tag("update","rsync.server","unknown")) + return get_by_tag(states.tag,key,default) +end + + + + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['luat-fmt'] = { + version = 1.001, + comment = "companion to mtxrun", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + + +local format = string.format + +local report_format = logs.reporter("resolvers","formats") + +-- helper for mtxrun + +local quoted = string.quoted + +local function primaryflags() -- not yet ok + local trackers = environment.argument("trackers") + local directives = environment.argument("directives") + local flags = "" + if trackers and trackers ~= "" then + flags = flags .. "--trackers=" .. quoted(trackers) + end + if directives and directives ~= "" then + flags = flags .. "--directives=" .. quoted(directives) + end + return flags +end + +function environment.make_format(name) + -- change to format path (early as we need expanded paths) + local olddir = lfs.currentdir() + local path = caches.getwritablepath("formats") or "" -- maybe platform + if path ~= "" then + lfs.chdir(path) + end + report_format("format path: %s",lfs.currentdir()) + -- check source file + local texsourcename = file.addsuffix(name,"mkiv") + local fulltexsourcename = resolvers.findfile(texsourcename,"tex") or "" + if fulltexsourcename == "" then + texsourcename = file.addsuffix(name,"tex") + fulltexsourcename = resolvers.findfile(texsourcename,"tex") or "" + end + if fulltexsourcename == "" then + report_format("no tex source file with name: %s (mkiv or tex)",name) + lfs.chdir(olddir) + return + else + report_format("using tex source file: %s",fulltexsourcename) + end + local texsourcepath = dir.expandname(file.dirname(fulltexsourcename)) -- really needed + -- check specification + local specificationname = file.replacesuffix(fulltexsourcename,"lus") + local fullspecificationname = resolvers.findfile(specificationname,"tex") or "" + if fullspecificationname == "" then + specificationname = file.join(texsourcepath,"context.lus") + fullspecificationname = resolvers.findfile(specificationname,"tex") or "" + end + if fullspecificationname == "" then + report_format("unknown stub specification: %s",specificationname) + lfs.chdir(olddir) + return + end + local specificationpath = file.dirname(fullspecificationname) + -- load specification + local usedluastub = nil + local usedlualibs = dofile(fullspecificationname) + if type(usedlualibs) == "string" then + usedluastub = file.join(file.dirname(fullspecificationname),usedlualibs) + elseif type(usedlualibs) == "table" then + report_format("using stub specification: %s",fullspecificationname) + local texbasename = file.basename(name) + local luastubname = file.addsuffix(texbasename,"lua") + local lucstubname = file.addsuffix(texbasename,"luc") + -- pack libraries in stub + report_format("creating initialization file: %s",luastubname) + utilities.merger.selfcreate(usedlualibs,specificationpath,luastubname) + -- compile stub file (does not save that much as we don't use this stub at startup any more) + local strip = resolvers.booleanvariable("LUACSTRIP", true) + if utilities.lua.compile(luastubname,lucstubname) and lfs.isfile(lucstubname) then + report_format("using compiled initialization file: %s",lucstubname) + usedluastub = lucstubname + else + report_format("using uncompiled initialization file: %s",luastubname) + usedluastub = luastubname + end + else + report_format("invalid stub specification: %s",fullspecificationname) + lfs.chdir(olddir) + return + end + -- generate format + local command = format("luatex --ini %s --lua=%s %s %sdump",primaryflags(),quoted(usedluastub),quoted(fulltexsourcename),os.platform == "unix" and "\\\\" or "\\") + report_format("running command: %s\n",command) + os.spawn(command) + -- remove related mem files + local pattern = file.removesuffix(file.basename(usedluastub)).."-*.mem" + -- report_format("removing related mplib format with pattern '%s'", pattern) + local mp = dir.glob(pattern) + if mp then + for i=1,#mp do + local name = mp[i] + report_format("removing related mplib format %s", file.basename(name)) + os.remove(name) + end + end + lfs.chdir(olddir) +end + +function environment.run_format(name,data,more) + -- hm, rather old code here; we can now use the file.whatever functions + if name and name ~= "" then + local barename = file.removesuffix(name) + local fmtname = caches.getfirstreadablefile(file.addsuffix(barename,"fmt"),"formats") + if fmtname == "" then + fmtname = resolvers.findfile(file.addsuffix(barename,"fmt")) or "" + end + fmtname = resolvers.cleanpath(fmtname) + if fmtname == "" then + report_format("no format with name: %s",name) + else + local barename = file.removesuffix(name) -- expanded name + local luaname = file.addsuffix(barename,"luc") + if not lfs.isfile(luaname) then + luaname = file.addsuffix(barename,"lua") + end + if not lfs.isfile(luaname) then + report_format("using format name: %s",fmtname) + report_format("no luc/lua with name: %s",barename) + else + local command = format("luatex %s --fmt=%s --lua=%s %s %s",primaryflags(),quoted(barename),quoted(luaname),quoted(data),more ~= "" and quoted(more) or "") + report_format("running command: %s",command) + os.spawn(command) + end + end + end +end end -- of closure -- end library merge -own = { } -- not local +own = { } -- not local, might change + +own.libs = { -- order can be made better -own.libs = { -- todo: check which ones are really needed 'l-string.lua', 'l-lpeg.lua', 'l-table.lua', @@ -11898,39 +14143,55 @@ own.libs = { -- todo: check which ones are really needed 'l-url.lua', 'l-dir.lua', 'l-boolean.lua', + 'l-unicode.lua', 'l-math.lua', --- 'l-unicode.lua', --- 'l-tex.lua', - 'l-utils.lua', - 'l-aux.lua', --- 'l-xml.lua', - 'trac-tra.lua', + + 'util-tab.lua', + 'util-sto.lua', + 'util-mrg.lua', + 'util-lua.lua', + 'util-prs.lua', + 'util-fmt.lua', + 'util-deb.lua', + + 'trac-inf.lua', + 'trac-set.lua', + 'trac-log.lua', + 'trac-pro.lua', + + 'luat-env.lua', -- can come before inf (as in mkiv) + 'lxml-tab.lua', 'lxml-lpt.lua', --- 'lxml-ent.lua', + -- 'lxml-ent.lua', 'lxml-mis.lua', 'lxml-aux.lua', 'lxml-xml.lua', - 'luat-env.lua', - 'trac-inf.lua', - 'trac-log.lua', - 'data-res.lua', + + 'data-ini.lua', + 'data-exp.lua', + 'data-env.lua', 'data-tmp.lua', + 'data-met.lua', + 'data-res.lua', 'data-pre.lua', 'data-inp.lua', 'data-out.lua', + 'data-fil.lua', 'data-con.lua', 'data-use.lua', -- 'data-tex.lua', -- 'data-bin.lua', 'data-zip.lua', + 'data-tre.lua', 'data-crl.lua', 'data-lua.lua', - 'data-kps.lua', -- so that we can replace kpsewhich 'data-aux.lua', -- updater - 'data-tmf.lua', -- tree files - -- needed ? - 'luat-sta.lua', -- states + 'data-tmf.lua', + 'data-lst.lua', + + 'luat-sta.lua', + 'luat-fmt.lua', } -- We need this hack till luatex is fixed. @@ -11943,35 +14204,62 @@ end -- End of hack. -own.name = (environment and environment.ownname) or arg[0] or 'luatools.lua' +local format, gsub, gmatch, match = string.format, string.gsub, string.gmatch, string.match +local concat = table.concat + +own.name = (environment and environment.ownname) or arg[0] or 'mtxrun.lua' +own.path = gsub(match(own.name,"^(.+)[\\/].-$") or ".","\\","/") + +local ownpath, owntree = own.path, environment and environment.ownpath or own.path + +own.list = { + '.', + ownpath , + ownpath .. "/../sources", -- HH's development path + owntree .. "/../../texmf-local/tex/context/base", + owntree .. "/../../texmf-context/tex/context/base", + owntree .. "/../../texmf-dist/tex/context/base", + owntree .. "/../../texmf/tex/context/base", + owntree .. "/../../../texmf-local/tex/context/base", + owntree .. "/../../../texmf-context/tex/context/base", + owntree .. "/../../../texmf-dist/tex/context/base", + owntree .. "/../../../texmf/tex/context/base", +} +if own.path == "." then table.remove(own.list,1) end -own.path = string.match(own.name,"^(.+)[\\/].-$") or "." -own.list = { '.' } -if own.path ~= '.' then - table.insert(own.list,own.path) +local function locate_libs() + for l=1,#own.libs do + local lib = own.libs[l] + for p =1,#own.list do + local pth = own.list[p] + local filename = pth .. "/" .. lib + local found = lfs.isfile(filename) + if found then + package.path = package.path .. ";" .. pth .. "/?.lua" -- in case l-* does a require + return pth + end + end + end end -table.insert(own.list,own.path.."/../../texmf-dist/tex/context/base") -table.insert(own.list,own.path.."/../../../tex/context/base") -table.insert(own.list,own.path.."/mtx") -table.insert(own.list,own.path.."/../sources") -local function locate_libs() - for _, lib in pairs(own.libs) do - for _, pth in pairs(own.list) do - local filename = string.gsub(pth .. "/" .. lib,"\\","/") +local function load_libs() + local found = locate_libs() + if found then + for l=1,#own.libs do + local filename = found .. "/" .. own.libs[l] local codeblob = loadfile(filename) if codeblob then codeblob() - own.list = { pth } -- speed up te search - break end end + else + resolvers = nil end end if not resolvers then - locate_libs() + load_libs() end if not resolvers then @@ -11983,20 +14271,56 @@ if not resolvers then os.exit() end -logs.setprogram('MTXrun',"TDS Runner Tool 1.24",environment.arguments["verbose"] or false) +-- verbosity -local instance = resolvers.reset() +local e_verbose = environment.arguments["verbose"] + +if e_verbose then + trackers.enable("resolvers.locating") +end + +-- some common flags (also passed through environment) + +local e_silent = environment.argument("silent") +local e_noconsole = environment.argument("noconsole") + +local e_trackers = environment.argument("trackers") +local e_directives = environment.argument("directives") +local e_experiments = environment.argument("experiments") + +if e_silent == true then + e_silent = "*" +end -local trackspec = environment.argument("trackers") or environment.argument("track") +if type(e_silent) == "string" then + if type(e_directives) == "string" then + e_directives = format("%s,logs.blocked={%s}",e_directives,e_silent) + else + e_directives = format("logs.blocked={%s}",e_silent) + end +end -if trackspec then - trackers.enable(trackspec) +if e_noconsole then + if type(e_directives) == "string" then + e_directives = format("%s,logs.target=file",e_directives) + else + e_directives = format("logs.target=file") + end end -runners = runners or { } -- global -messages = messages or { } +if e_trackers then trackers .enable(e_trackers) end +if e_directives then directives .enable(e_directives) end +if e_experiments then experiments.enable(e_experiments) end + +if not environment.trackers then environment.trackers = e_trackers end +if not environment.directives then environment.directives = e_directives end +if not environment.experiments then environment.experiments = e_experiments end + +-- + +local instance = resolvers.reset() -messages.help = [[ +local helpinfo = [[ --script run an mtx script (lua prefered method) (--noquotes), no script gives list --execute run a script or program (texmfstart method) (--noquotes) --resolve resolve prefixed arguments @@ -12011,15 +14335,14 @@ messages.help = [[ --ifchanged=filename only execute when given file has changed (md checksum) --iftouched=old,new only execute when given file has changed (time stamp) ---make create stubs for (context related) scripts ---remove remove stubs (context related) scripts +--makestubs create stubs for (context related) scripts +--removestubs remove stubs (context related) scripts --stubpath=binpath paths where stubs wil be written --windows create windows (mswin) stubs --unix create unix (linux) stubs --verbose give a bit more info --trackers=list enable given trackers ---engine=str target engine --progname=str format or backend --edit launch editor with found file @@ -12032,8 +14355,35 @@ messages.help = [[ --forcekpse force using kpse (handy when no mkiv and cache installed but less functionality) --prefixes show supported prefixes + +--generate generate file database + +--variables show configuration variables +--configurations show configuration order + +--expand-braces expand complex variable +--expand-path expand variable (resolve paths) +--expand-var expand variable (resolve references) +--show-path show path expansion of ... +--var-value report value of variable +--find-file report file location +--find-path report path of file + +--pattern=str filter variables ]] +local application = logs.application { + name = "mtxrun", + banner = "ConTeXt TDS Runner Tool 1.30", + helpinfo = helpinfo, +} + +local report = application.report + +messages = messages or { } -- for the moment + +runners = runners or { } -- global (might become local) + runners.applications = { ["lua"] = "luatex --luaonly", ["luc"] = "luatex --luaonly", @@ -12056,7 +14406,7 @@ runners.registered = { makempy = { 'makempy.pl', true }, mptopdf = { 'mptopdf.pl', true }, pstopdf = { 'pstopdf.rb', true }, -- converts ps (and some more) images, does some cleaning (replaced) --- examplex = { 'examplex.rb', false }, + -- examplex = { 'examplex.rb', false }, concheck = { 'concheck.rb', false }, runtools = { 'runtools.rb', true }, textools = { 'textools.rb', true }, @@ -12065,9 +14415,9 @@ runners.registered = { rlxtools = { 'rlxtools.rb', true }, pdftools = { 'pdftools.rb', true }, mpstools = { 'mpstools.rb', true }, --- exatools = { 'exatools.rb', true }, + -- exatools = { 'exatools.rb', true }, xmltools = { 'xmltools.rb', true }, --- luatools = { 'luatools.lua', true }, + -- luatools = { 'luatools.lua', true }, mtxtools = { 'mtxtools.rb', true }, pdftrimwhite = { 'pdftrimwhite.pl', false } } @@ -12086,45 +14436,39 @@ end function runners.prepare() local checkname = environment.argument("ifchanged") - if checkname and checkname ~= "" then + if type(checkname) == "string" and checkname ~= "" then local oldchecksum = file.loadchecksum(checkname) local newchecksum = file.checksum(checkname) if oldchecksum == newchecksum then - logs.simple("file '%s' is unchanged",checkname) + if e_verbose then + report("file '%s' is unchanged",checkname) + end return "skip" - else - logs.simple("file '%s' is changed, processing started",checkname) + elseif e_verbose then + report("file '%s' is changed, processing started",checkname) end file.savechecksum(checkname) end - local oldname, newname = string.split(environment.argument("iftouched") or "", ",") - if oldname and newname and oldname ~= "" and newname ~= "" then - if not file.needs_updating(oldname,newname) then - logs.simple("file '%s' and '%s' have same age",oldname,newname) - return "skip" - else - logs.simple("file '%s' is older than '%s'",oldname,newname) - end - end - local tree = environment.argument('tree') or "" - if environment.argument('autotree') then - tree = os.getenv('TEXMFSTART_TREE') or os.getenv('TEXMFSTARTTREE') or tree - end - if tree and tree ~= "" then - resolvers.load_tree(tree) - end - local env = environment.argument('environment') or "" - if env and env ~= "" then - for _,e in pairs(string.split(env)) do - -- maybe force suffix when not given - resolvers.load_tree(e) + local touchname = environment.argument("iftouched") + if type(touchname) == "string" and touchname ~= "" then + local oldname, newname = string.split(touchname, ",") + if oldname and newname and oldname ~= "" and newname ~= "" then + if not file.needs_updating(oldname,newname) then + if e_verbose then + report("file '%s' and '%s' have same age",oldname,newname) + end + return "skip" + elseif e_verbose then + report("file '%s' is older than '%s'",oldname,newname) + end end end local runpath = environment.argument("path") - if runpath and not lfs.chdir(runpath) then - logs.simple("unable to change to path '%s'",runpath) + if type(runpath) == "string" and not lfs.chdir(runpath) then + report("unable to change to path '%s'",runpath) return "error" end + runners.prepare = function() end return "run" end @@ -12137,8 +14481,6 @@ function runners.execute_script(fullname,internal,nosplit) elseif state == 'skip' then return true elseif state == "run" then - instance.progname = environment.argument("progname") or instance.progname - instance.format = environment.argument("format") or instance.format local path, name, suffix, result = file.dirname(fullname), file.basename(fullname), file.extname(fullname), "" if path ~= "" then result = fullname @@ -12155,21 +14497,21 @@ function runners.execute_script(fullname,internal,nosplit) if suffix == "" then -- loop over known suffixes for _,s in pairs(runners.suffixes) do - result = resolvers.find_file(name .. "." .. s, 'texmfscripts') + result = resolvers.findfile(name .. "." .. s, 'texmfscripts') if result ~= "" then break end end elseif runners.applications[suffix] then - result = resolvers.find_file(name, 'texmfscripts') + result = resolvers.findfile(name, 'texmfscripts') else -- maybe look on path - result = resolvers.find_file(name, 'other text files') + result = resolvers.findfile(name, 'other text files') end end if result and result ~= "" then if not no_split then - local before, after = environment.split_arguments(fullname) -- already done + local before, after = environment.splitarguments(fullname) -- already done environment.arguments_before, environment.arguments_after = before, after end if internal then @@ -12181,12 +14523,12 @@ function runners.execute_script(fullname,internal,nosplit) if binary and binary ~= "" then result = binary .. " " .. result end - local command = result .. " " .. environment.reconstruct_commandline(environment.arguments_after,noquote) - if logs.verbose then - logs.simpleline() - logs.simple("executing: %s",command) - logs.simpleline() - logs.simpleline() + local command = result .. " " .. environment.reconstructcommandline(environment.arguments_after,noquote) + if e_verbose then + report() + report("executing: %s",command) + report() + report() io.flush() end -- no os.exec because otherwise we get the wrong return value @@ -12196,14 +14538,14 @@ function runners.execute_script(fullname,internal,nosplit) else if binary then binary = file.addsuffix(binary,os.binsuffix) - for p in string.gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do + for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do if lfs.isfile(file.join(p,binary)) then return false end end - logs.simpleline() - logs.simple("This script needs '%s' which seems not to be installed.",binary) - logs.simpleline() + report() + report("This script needs '%s' which seems not to be installed.",binary) + report() end return false end @@ -12223,14 +14565,15 @@ function runners.execute_program(fullname) elseif state == 'skip' then return true elseif state == "run" then - local before, after = environment.split_arguments(fullname) - environment.initialize_arguments(after) + local before, after = environment.splitarguments(fullname) + for k=1,#after do after[k] = resolvers.resolve(after[k]) end + environment.initializearguments(after) fullname = fullname:gsub("^bin:","") - local command = fullname .. " " .. (environment.reconstruct_commandline(after or "",noquote) or "") - logs.simpleline() - logs.simple("executing: %s",command) - logs.simpleline() - logs.simpleline() + local command = fullname .. " " .. (environment.reconstructcommandline(after or "",noquote) or "") + report() + report("executing: %s",command) + report() + report() io.flush() local code = os.exec(command) -- (fullname,unpack(after)) does not work / maybe spawn return code == 0 @@ -12239,7 +14582,7 @@ function runners.execute_program(fullname) return false end --- the --usekpse flag will fallback on kpse (hm, we can better update mtx-stubs) +-- the --usekpse flag will fallback (not default) on kpse (hm, we can better update mtx-stubs) local windows_stub = '@echo off\013\010setlocal\013\010set ownpath=%%~dp0%%\013\010texlua "%%ownpath%%mtxrun.lua" --usekpse --execute %s %%*\013\010endlocal\013\010' local unix_stub = '#!/bin/sh\010mtxrun --usekpse --execute %s \"$@\"\010' @@ -12258,22 +14601,22 @@ function runners.handle_stubs(create) for _,v in pairs(runners.registered) do local name, doit = v[1], v[2] if doit then - local base = string.gsub(file.basename(name), "%.(.-)$", "") + local base = gsub(file.basename(name), "%.(.-)$", "") if create then if windows then - io.savedata(file.join(stubpath,base..".bat"),string.format(windows_stub,name)) - logs.simple("windows stub for '%s' created",base) + io.savedata(file.join(stubpath,base..".bat"),format(windows_stub,name)) + report("windows stub for '%s' created",base) end if unix then - io.savedata(file.join(stubpath,base),string.format(unix_stub,name)) - logs.simple("unix stub for '%s' created",base) + io.savedata(file.join(stubpath,base),format(unix_stub,name)) + report("unix stub for '%s' created",base) end else if windows and (os.remove(file.join(stubpath,base..'.bat')) or os.remove(file.join(stubpath,base..'.cmd'))) then - logs.simple("windows stub for '%s' removed", base) + report("windows stub for '%s' removed", base) end if unix and (os.remove(file.join(stubpath,base)) or os.remove(file.join(stubpath,base..'.sh'))) then - logs.simple("unix stub for '%s' removed",base) + report("unix stub for '%s' removed",base) end end end @@ -12289,7 +14632,7 @@ end function runners.locate_file(filename) -- differs from texmfstart where locate appends .com .exe .bat ... todo if filename and filename ~= "" then - runners.report_location(resolvers.find_given_file(filename)) + runners.report_location(resolvers.findgivenfile(filename)) end end @@ -12298,28 +14641,28 @@ function runners.locate_platform() end function runners.report_location(result) - if logs.verbose then - logs.simpleline() + if e_verbose then + reportline() if result and result ~= "" then - logs.simple(result) + report(result) else - logs.simple("not found") + report("not found") end else io.write(result) end end -function runners.edit_script(filename) -- we assume that vim is present on most systems - local editor = os.getenv("MTXRUN_EDITOR") or os.getenv("TEXMFSTART_EDITOR") or os.getenv("EDITOR") or 'vim' +function runners.edit_script(filename) -- we assume that gvim is present on most systems (todo: also in cnf file) + local editor = os.getenv("MTXRUN_EDITOR") or os.getenv("TEXMFSTART_EDITOR") or os.getenv("EDITOR") or 'gvim' local rest = resolvers.resolve(filename) if rest ~= "" then local command = editor .. " " .. rest - if logs.verbose then - logs.simpleline() - logs.simple("starting editor: %s",command) - logs.simple_line() - logs.simple_line() + if e_verbose then + report() + report("starting editor: %s",command) + report() + report() end os.launch(command) end @@ -12362,33 +14705,33 @@ end function runners.launch_file(filename) instance.allresults = true - logs.setverbose(true) + trackers.enable("resolvers.locating") local pattern = environment.arguments["pattern"] if not pattern or pattern == "" then pattern = filename end if not pattern or pattern == "" then - logs.simple("provide name or --pattern=") + report("provide name or --pattern=") else - local t = resolvers.find_files(pattern) + local t = resolvers.findfiles(pattern) if not t or #t == 0 then - t = resolvers.find_files("*/" .. pattern) + t = resolvers.findfiles("*/" .. pattern) end if not t or #t == 0 then - t = resolvers.find_files("*/" .. pattern .. "*") + t = resolvers.findfiles("*/" .. pattern .. "*") end if t and #t > 0 then if environment.arguments["all"] then for _, v in pairs(t) do - logs.simple("launching %s", v) + report("launching %s", v) resolvers.launch(v) end else - logs.simple("launching %s", t[1]) + report("launching %s", t[1]) resolvers.launch(t[1]) end else - logs.simple("no match for %s", pattern) + report("no match for %s", pattern) end end end @@ -12421,33 +14764,45 @@ function runners.find_mtx_script(filename) local mtxprefix = (filename:find("^mtx%-") and "") or "mtx-" -- context namespace, mtx- fullname = mtxprefix .. filename - fullname = found(fullname) or resolvers.find_file(fullname) + fullname = found(fullname) or resolvers.findfile(fullname) if fullname and fullname ~= "" then return fullname end -- context namespace, mtx-s fullname = mtxprefix .. basename .. "s" .. "." .. suffix - fullname = found(fullname) or resolvers.find_file(fullname) + fullname = found(fullname) or resolvers.findfile(fullname) if fullname and fullname ~= "" then return fullname end -- context namespace, mtx- fullname = mtxprefix .. basename:gsub("s$","") .. "." .. suffix - fullname = found(fullname) or resolvers.find_file(fullname) + fullname = found(fullname) or resolvers.findfile(fullname) if fullname and fullname ~= "" then return fullname end -- context namespace, just - fullname = resolvers.find_file(filename) + fullname = resolvers.findfile(filename) return fullname end -function runners.execute_ctx_script(filename) +function runners.register_arguments(...) + local arguments = environment.arguments_after + local passedon = { ... } + for i=#passedon,1,-1 do + local pi = passedon[i] + if pi then + table.insert(arguments,1,pi) + end + end +end + +function runners.execute_ctx_script(filename,...) + runners.register_arguments(...) local arguments = environment.arguments_after local fullname = runners.find_mtx_script(filename) or "" if file.extname(fullname) == "cld" then -- handy in editors where we force --autopdf - logs.simple("running cld script: %s",filename) + report("running cld script: %s",filename) table.insert(arguments,1,fullname) table.insert(arguments,"--autopdf") fullname = runners.find_mtx_script("context") or "" @@ -12455,7 +14810,7 @@ function runners.execute_ctx_script(filename) -- retry after generate but only if --autogenerate if fullname == "" and environment.argument("autogenerate") then -- might become the default instance.renewcache = true - logs.setverbose(true) + trackers.enable("resolvers.locating") resolvers.load() -- fullname = runners.find_mtx_script(filename) or "" @@ -12470,7 +14825,7 @@ function runners.execute_ctx_script(filename) elseif state == "run" then -- load and save ... kind of undocumented arg = { } for _,v in pairs(arguments) do arg[#arg+1] = resolvers.resolve(v) end - environment.initialize_arguments(arg) + environment.initializearguments(arg) local loadname = environment.arguments['load'] if loadname then if type(loadname) ~= "string" then loadname = file.basename(fullname) end @@ -12478,8 +14833,8 @@ function runners.execute_ctx_script(filename) runners.load_script_session(loadname) end filename = environment.files[1] - if logs.verbose then - logs.simple("using script: %s\n",fullname) + if e_verbose then + report("using script: %s\n",fullname) end environment.ownscript = fullname dofile(fullname) @@ -12495,44 +14850,42 @@ function runners.execute_ctx_script(filename) return true end else - -- logs.setverbose(true) if filename == "" or filename == "help" then - local context = resolvers.find_file("mtx-context.lua") - logs.setverbose(true) + local context = resolvers.findfile("mtx-context.lua") + trackers.enable("resolvers.locating") if context ~= "" then - local result = dir.glob((string.gsub(context,"mtx%-context","mtx-*"))) -- () needed + local result = dir.glob((gsub(context,"mtx%-context","mtx-*"))) -- () needed local valid = { } table.sort(result) for i=1,#result do local scriptname = result[i] - local scriptbase = string.match(scriptname,".*mtx%-([^%-]-)%.lua") + local scriptbase = match(scriptname,".*mtx%-([^%-]-)%.lua") if scriptbase then local data = io.loaddata(scriptname) - local banner, version = string.match(data,"[\n\r]logs%.extendbanner%s*%(%s*[\"\']([^\n\r]+)%s*(%d+%.%d+)") + local banner, version = match(data,"[\n\r]logs%.extendbanner%s*%(%s*[\"\']([^\n\r]+)%s*(%d+%.%d+)") if banner then valid[#valid+1] = { scriptbase, version, banner } end end end if #valid > 0 then - logs.reportbanner() - logs.reportline() - logs.simple("no script name given, known scripts:") - logs.simple() + application.identify() + report("no script name given, known scripts:") + report() for k=1,#valid do local v = valid[k] - logs.simple("%-12s %4s %s",v[1],v[2],v[3]) + report("%-12s %4s %s",v[1],v[2],v[3]) end end else - logs.simple("no script name given") + report("no script name given") end else filename = file.addsuffix(filename,"lua") if file.is_qualified_path(filename) then - logs.simple("unknown script '%s'",filename) + report("unknown script '%s'",filename) else - logs.simple("unknown script '%s' or 'mtx-%s'",filename,filename) + report("unknown script '%s' or 'mtx-%s'",filename,filename) end end return false @@ -12540,9 +14893,9 @@ function runners.execute_ctx_script(filename) end function runners.prefixes() - logs.reportbanner() - logs.reportline() - logs.simple(table.concat(resolvers.allprefixes(true)," ")) + application.identify() + report() + report(concat(resolvers.allprefixes(true)," ")) end function runners.timedrun(filename) -- just for me @@ -12562,13 +14915,11 @@ end local filename = environment.files[1] or "" local ok = true -local before, after = environment.split_arguments(filename) +local before, after = environment.splitarguments(filename) environment.arguments_before, environment.arguments_after = before, after -environment.initialize_arguments(before) +environment.initializearguments(before) -instance.engine = environment.argument("engine") or 'luatex' -instance.progname = environment.argument("progname") or 'context' -instance.lsrmode = environment.argument("lsr") or false +instance.lsrmode = environment.argument("lsr") or false -- maybe the unset has to go to this level @@ -12576,36 +14927,40 @@ local is_mkii_stub = runners.registered[file.removesuffix(file.basename(filename if environment.argument("usekpse") or environment.argument("forcekpse") or is_mkii_stub then + resolvers.load_tree(environment.argument('tree'),true) -- force resolve of TEXMFCNF + os.setenv("engine","") os.setenv("progname","") local remapper = { - otf = "opentype fonts", - ttf = "truetype fonts", - ttc = "truetype fonts", - pfb = "type1 fonts", + otf = "opentype fonts", + ttf = "truetype fonts", + ttc = "truetype fonts", + pfb = "type1 fonts", other = "other text files", } + local progname = environment.argument("progname") or 'context' + local function kpse_initialized() texconfig.kpse_init = true local t = os.clock() - local k = kpse.original.new("luatex",instance.progname) + local k = kpse.original.new("luatex",progname) local dummy = k:find_file("mtxrun.lua") -- so that we're initialized - logs.simple("kpse fallback with progname '%s' initialized in %s seconds",instance.progname,os.clock()-t) + report("kpse fallback with progname '%s' initialized in %s seconds",progname,os.clock()-t) kpse_initialized = function() return k end return k end - local find_file = resolvers.find_file - local show_path = resolvers.show_path + local findfile = resolvers.findfile + local showpath = resolvers.showpath if environment.argument("forcekpse") then - function resolvers.find_file(name,kind) - return (kpse_initialized():find_file(resolvers.clean_path(name),(kind ~= "" and (remapper[kind] or kind)) or "tex") or "") or "" + function resolvers.findfile(name,kind) + return (kpse_initialized():find_file(resolvers.cleanpath(name),(kind ~= "" and (remapper[kind] or kind)) or "tex") or "") or "" end - function resolvers.show_path(name) + function resolvers.showpath(name) return (kpse_initialized():show_path(name)) or "" end @@ -12613,16 +14968,16 @@ if environment.argument("usekpse") or environment.argument("forcekpse") or is_mk resolvers.load() - function resolvers.find_file(name,kind) - local found = find_file(name,kind) or "" + function resolvers.findfile(name,kind) + local found = findfile(name,kind) or "" if found ~= "" then return found else - return (kpse_initialized():find_file(resolvers.clean_path(name),(kind ~= "" and (remapper[kind] or kind)) or "tex") or "") or "" + return (kpse_initialized():find_file(resolvers.cleanpath(name),(kind ~= "" and (remapper[kind] or kind)) or "tex") or "") or "" end end - function resolvers.show_path(name) - local found = show_path(name) or "" + function resolvers.showpath(name) + local found = showpath(name) or "" if found ~= "" then return found else @@ -12632,80 +14987,317 @@ if environment.argument("usekpse") or environment.argument("forcekpse") or is_mk end + function runners.loadbase() + end + else - resolvers.load() + function runners.loadbase(...) + if not resolvers.load(...) then + report("forcing cache reload") + instance.renewcache = true + trackers.enable("resolvers.locating") + if not resolvers.load(...) then + report("the resolver databases are not present or outdated") + end + end + end + + resolvers.load_tree(environment.argument('tree')) end + if environment.argument("selfmerge") then + -- embed used libraries - utils.merger.selfmerge(own.name,own.libs,own.list) + + runners.loadbase() + local found = locate_libs() + if found then + utilities.merger.selfmerge(own.name,own.libs,{ found }) + end + elseif environment.argument("selfclean") then + -- remove embedded libraries - utils.merger.selfclean(own.name) + + runners.loadbase() + utilities.merger.selfclean(own.name) + elseif environment.argument("selfupdate") then - logs.setverbose(true) - resolvers.update_script(own.name,"mtxrun") + + runners.loadbase() + trackers.enable("resolvers.locating") + resolvers.updatescript(own.name,"mtxrun") + elseif environment.argument("ctxlua") or environment.argument("internal") then + -- run a script by loading it (using libs) + + runners.loadbase() ok = runners.execute_script(filename,true) + elseif environment.argument("script") or environment.argument("scripts") then + -- run a script by loading it (using libs), pass args + + runners.loadbase() if is_mkii_stub then - -- execute mkii script ok = runners.execute_script(filename,false,true) else ok = runners.execute_ctx_script(filename) end + elseif environment.argument("execute") then + -- execute script + + runners.loadbase() ok = runners.execute_script(filename) + elseif environment.argument("direct") then + -- equals bin: + + runners.loadbase() ok = runners.execute_program(filename) + elseif environment.argument("edit") then + -- edit file + + runners.loadbase() runners.edit_script(filename) + elseif environment.argument("launch") then + + runners.loadbase() runners.launch_file(filename) -elseif environment.argument("make") then - -- make stubs + +elseif environment.argument("makestubs") then + + -- make stubs (depricated) + runners.handle_stubs(true) -elseif environment.argument("remove") then - -- remove stub + +elseif environment.argument("removestubs") then + + -- remove stub (depricated) + + runners.loadbase() runners.handle_stubs(false) + elseif environment.argument("resolve") then + -- resolve string + + runners.loadbase() runners.resolve_string(filename) + elseif environment.argument("locate") then + -- locate file + + runners.loadbase() runners.locate_file(filename) -elseif environment.argument("platform")then + +elseif environment.argument("platform") or environment.argument("show-platform") then + -- locate platform + + runners.loadbase() runners.locate_platform() + elseif environment.argument("prefixes") then + + runners.loadbase() runners.prefixes() + elseif environment.argument("timedrun") then + -- locate platform + + runners.loadbase() runners.timedrun(filename) + +elseif environment.argument("variables") or environment.argument("show-variables") or environment.argument("expansions") or environment.argument("show-expansions") then + + -- luatools: runners.execute_ctx_script("mtx-base","--expansions",filename) + + resolvers.load("nofiles") + resolvers.listers.variables(environment.argument("pattern")) + +elseif environment.argument("configurations") or environment.argument("show-configurations") then + + -- luatools: runners.execute_ctx_script("mtx-base","--configurations",filename) + + resolvers.load("nofiles") + resolvers.listers.configurations() + +elseif environment.argument("find-file") then + + -- luatools: runners.execute_ctx_script("mtx-base","--find-file",filename) + + resolvers.load() + local e_pattern = environment.argument("pattern") + local e_format = environment.arguments("format") + if not e_pattern then + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.findfiles,environment.files,e_format) + elseif type(e_pattern) == "string" then + instance.allresults = true -- brrrr + resolvers.dowithfilesandreport(resolvers.findfiles,{ e_pattern }, e_format) + end + +elseif environment.argument("find-path") then + + -- luatools: runners.execute_ctx_script("mtx-base","--find-path",filename) + + resolvers.load() + local path = resolvers.findpath(filename, instance.my_format) + if e_verbose then + report(path) + else + print(path) + end + +elseif environment.argument("expand-braces") then + + -- luatools: runners.execute_ctx_script("mtx-base","--expand-braces",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.expandbraces, environment.files) + +elseif environment.argument("expand-path") then + + -- luatools: runners.execute_ctx_script("mtx-base","--expand-path",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.expandpath, environment.files) + +elseif environment.argument("expand-var") or environment.argument("expand-variable") then + + -- luatools: runners.execute_ctx_script("mtx-base","--expand-var",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.expansion, environment.files) + +elseif environment.argument("show-path") or environment.argument("path-value") then + + -- luatools: runners.execute_ctx_script("mtx-base","--show-path",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.showpath, environment.files) + +elseif environment.argument("var-value") or environment.argument("show-value") then + + -- luatools: runners.execute_ctx_script("mtx-base","--show-value",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.variable,environment.files) + +elseif environment.argument("format-path") then + + -- luatools: runners.execute_ctx_script("mtx-base","--format-path",filename) + + resolvers.load() + report(caches.getwritablepath("format")) + +elseif environment.argument("pattern") then + + -- luatools + + runners.execute_ctx_script("mtx-base","--pattern='" .. environment.argument("pattern") .. "'",filename) + +elseif environment.argument("generate") then + + -- luatools + + instance.renewcache = true + trackers.enable("resolvers.locating") + resolvers.load() + +elseif environment.argument("make") or environment.argument("ini") or environment.argument("compile") then + + -- luatools: runners.execute_ctx_script("mtx-base","--make",filename) + + resolvers.load() + trackers.enable("resolvers.locating") + environment.make_format(filename) + +elseif environment.argument("run") then + + -- luatools + + runners.execute_ctx_script("mtx-base","--run",filename) + +elseif environment.argument("fmt") then + + -- luatools + + runners.execute_ctx_script("mtx-base","--fmt",filename) + +elseif environment.argument("help") and filename=='base' then + + -- luatools + + runners.execute_ctx_script("mtx-base","--help") + elseif environment.argument("help") or filename=='help' or filename == "" then - logs.help(messages.help) - -- execute script + + application.help() + elseif filename:find("^bin:") then + + runners.loadbase() ok = runners.execute_program(filename) + elseif is_mkii_stub then + -- execute mkii script + + runners.loadbase() ok = runners.execute_script(filename,false,true) -else + +elseif false then + + runners.loadbase() ok = runners.execute_ctx_script(filename) if not ok then ok = runners.execute_script(filename) end + +elseif environment.files[1] == 'texmfcnf.lua' then -- so that we don't need to load mtx-base + + resolvers.load("nofiles") + resolvers.listers.configurations() + +else + + runners.loadbase() + runners.execute_ctx_script("mtx-base",filename) + +end + +if e_verbose then + report() + report("runtime: %0.3f seconds",os.runtime()) end -if os.platform == "unix" then - io.write("\n") +if os.type ~= "windows" then + texio.write("\n") -- is this still valid? end if ok == false then ok = 1 elseif ok == true then ok = 0 end diff --git a/Master/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c b/Master/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c index 27841c68764..400ed677882 100644 --- a/Master/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c +++ b/Master/texmf-dist/scripts/context/stubs/source/mtxrun_dll.c @@ -5,8 +5,8 @@ Public Domain Originally written in 2010 by Tomasz M. Trzeciak and Hans Hagen - This program is derived from the 'runscript' program originally - written in 2009 by T.M. Trzeciak. It has been adapted for use in + This program is derived from the 'runscript' program originally + written in 2009 by T.M. Trzeciak. It has been adapted for use in ConTeXt MkIV. Comment: @@ -18,26 +18,26 @@ mtxrun --script font --reload Here mtxrun is a lua script. In order to avoid the usage of a cmd - file on windows this runner will start texlua directly. If the - shared library luatex.dll is available, texlua will be started in - the same process avoiding thus any additional overhead. Otherwise + file on windows this runner will start texlua directly. If the + shared library luatex.dll is available, texlua will be started in + the same process avoiding thus any additional overhead. Otherwise it will be spawned in a new proces. We also don't want to use other runners, like those that use kpse to locate the script as this is exactly what mtxrun itself is doing already. Therefore the runscript program is adapted to a more direct approach suitable for mtxrun. - + Compilation: with gcc (size optimized): - gcc -Os -s -shared -o mtxrun.dll mtxrun_dll.c + gcc -Os -s -shared -o mtxrun.dll mtxrun_dll.c gcc -Os -s -o mtxrun.exe mtxrun_exe.c -L./ -lmtxrun with tcc (extra small size): - - tcc -shared -o mtxrun.dll mtxrun_dll.c + + tcc -shared -o mtxrun.dll mtxrun_dll.c tcc -o mtxrun.exe mtxrun_exe.c mtxrun.def ************************************************************************/ @@ -65,9 +65,9 @@ HMODULE dllluatex = NULL; typedef int ( *mainlikeproc )( int, char ** ); #ifdef STATIC -int main( int argc, char *argv[] ) +int main( int argc, char *argv[] ) #else -__declspec(dllexport) int dllrunscript( int argc, char *argv[] ) +__declspec(dllexport) int dllrunscript( int argc, char *argv[] ) #endif { char *s, *luatexfname, *argstr, **lua_argv; @@ -75,44 +75,52 @@ __declspec(dllexport) int dllrunscript( int argc, char *argv[] ) int passprogname = 0; // directory of this module/executable - - HMODULE module_handle = GetModuleHandle( "mtxrun.dll" ); + + HMODULE module_handle = GetModuleHandle( "mtxrun.dll" ); // if ( module_handle == NULL ) exe path will be used, which is OK too k = (int) GetModuleFileName( module_handle, dirpath, MAX_PATH ); - if ( !k || ( k == MAX_PATH ) ) + if ( !k || ( k == MAX_PATH ) ) DIE( "unable to determine a valid module name\n" ); s = strrchr(dirpath, '\\'); if ( s == NULL ) DIE( "no directory part in module path: %s\n", dirpath ); *(++s) = '\0'; //remove file name, leave trailing backslash - + // program name - + k = strlen(argv[0]); while ( k && (argv[0][k-1] != '/') && (argv[0][k-1] != '\\') ) k--; strcpy(progname, &argv[0][k]); s = progname; if ( s = strrchr(s, '.') ) *s = '\0'; // remove file extension part - + // script path - + strcpy( scriptpath, dirpath ); k = strlen(progname); if ( k < 6 ) k = 6; // in case the program name is shorter than "mtxrun" - if ( strlen(dirpath) + k + 4 >= MAX_PATH ) + if ( strlen(dirpath) + k + 4 >= MAX_PATH ) DIE( "path too long: %s%s\n", dirpath, progname ); - if ( ( strcmpi(progname,"mtxrun") == 0 ) || ( strcmpi(progname,"luatools") == 0 ) ) { + + if ( strcmpi(progname,"mtxrun") == 0 ) { strcat( scriptpath, progname ); strcat( scriptpath, ".lua" ); + } else if ( strcmpi(progname,"luatools") == 0 ) { + strcat( scriptpath, "mtxrun.lua" ); + strcpy( progname, "base" ); + passprogname = 1; + } else if ( strcmpi(progname,"texmfstart") == 0 ) { + strcat( scriptpath, "mtxrun.lua" ); } else { strcat( scriptpath, "mtxrun.lua" ); - if ( strcmpi(progname,"texmfstart") != 0 ) passprogname = 1; + passprogname = 1; } - if ( GetFileAttributes(scriptpath) == INVALID_FILE_ATTRIBUTES ) + + if ( GetFileAttributes(scriptpath) == INVALID_FILE_ATTRIBUTES ) DIE( "file not found: %s\n", scriptpath ); - + // find texlua.exe - - if ( !SearchPath( + + if ( !SearchPath( getenv( "PATH" ), // path to search (optional) "texlua.exe", // file name to search NULL, // file extension to add (optional) @@ -120,7 +128,7 @@ __declspec(dllexport) int dllrunscript( int argc, char *argv[] ) luatexpath, // output buffer pointer &luatexfname ) // pointer to a file part in the output buffer (optional) ) - if ( !SearchPath( + if ( !SearchPath( dirpath, // path to search (optional) "texlua.exe", // file name to search NULL, // file extension to add (optional) @@ -136,11 +144,11 @@ __declspec(dllexport) int dllrunscript( int argc, char *argv[] ) if ( dllluatex = LoadLibrary(luatexpath) ) { mainlikeproc dllluatexmain = (mainlikeproc) GetProcAddress( dllluatex, "dllluatexmain" ); - if ( dllluatexmain == NULL ) + if ( dllluatexmain == NULL ) DIE( "unable to locate dllluatexmain procedure in luatex.dll" ); - + // set up argument list for texlua script - + lua_argv = (char **)malloc( (argc + 4) * sizeof(char *) ); if ( lua_argv == NULL ) DIE( "out of memory\n" ); lua_argv[lua_argc=0] = texlua_name; @@ -148,18 +156,18 @@ __declspec(dllexport) int dllrunscript( int argc, char *argv[] ) if (passprogname) { lua_argv[++lua_argc] = "--script"; lua_argv[++lua_argc] = progname; - } + } for ( k = 1; k < argc; k++ ) lua_argv[++lua_argc] = argv[k]; lua_argv[++lua_argc] = NULL; // call texlua interpreter // dllluatexmain never returns, but we pretend that it does - + k = dllluatexmain( lua_argc, lua_argv ); if (lua_argv) free( lua_argv ); return k; } - + // we are still here, so no luatex.dll; spawn texlua.exe instead strcpy( luatexfname, "texlua.exe" ); @@ -172,24 +180,24 @@ __declspec(dllexport) int dllrunscript( int argc, char *argv[] ) strcat( cmdline, " --script " ); strcat( cmdline, progname ); } - + argstr = GetCommandLine(); // get the command line of this process if ( argstr == NULL ) DIE( "unable to retrieve the command line string\n" ); // skip over argv[0] in the argument string // (it can contain embedded double quotes if launched from cmd.exe!) - - for ( quoted = 0; (*argstr) && ( !IS_WHITESPACE(*argstr) || quoted ); argstr++ ) + + for ( quoted = 0; (*argstr) && ( !IS_WHITESPACE(*argstr) || quoted ); argstr++ ) if (*argstr == '"') quoted = !quoted; - + // pass through all the arguments - - if ( strlen(cmdline) + strlen(argstr) >= MAX_CMD ) + + if ( strlen(cmdline) + strlen(argstr) >= MAX_CMD ) DIE( "command line string too long:\n%s%s\n", cmdline, argstr ); - strcat( cmdline, argstr ); - + strcat( cmdline, argstr ); + // create child process - + STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory( &si, sizeof(si) ); @@ -201,7 +209,7 @@ __declspec(dllexport) int dllrunscript( int argc, char *argv[] ) si.hStdOutput = GetStdHandle( STD_OUTPUT_HANDLE ); si.hStdError = GetStdHandle( STD_ERROR_HANDLE ); ZeroMemory( &pi, sizeof(pi) ); - + if( !CreateProcess( NULL, // module name (uses command line if NULL) cmdline, // command line @@ -214,17 +222,17 @@ __declspec(dllexport) int dllrunscript( int argc, char *argv[] ) &si, // STARTUPINFO structure &pi ) // PROCESS_INFORMATION structure ) DIE( "command execution failed: %s\n", cmdline ); - + DWORD ret = 0; CloseHandle( pi.hThread ); // thread handle is not needed if ( WaitForSingleObject( pi.hProcess, INFINITE ) == WAIT_OBJECT_0 ) { - if ( !GetExitCodeProcess( pi.hProcess, &ret) ) + if ( !GetExitCodeProcess( pi.hProcess, &ret) ) DIE( "unable to retrieve process exit code: %s\n", cmdline ); } else DIE( "failed to wait for process termination: %s\n", cmdline ); CloseHandle( pi.hProcess ); - + // propagate exit code from the child process - - return ret; - + + return ret; + } diff --git a/Master/texmf-dist/scripts/context/stubs/unix/luatools b/Master/texmf-dist/scripts/context/stubs/unix/luatools index c060beff8fe..c17b483be53 100755 --- a/Master/texmf-dist/scripts/context/stubs/unix/luatools +++ b/Master/texmf-dist/scripts/context/stubs/unix/luatools @@ -1,8312 +1,2 @@ -#!/usr/bin/env texlua - -if not modules then modules = { } end modules ['luatools'] = { - version = 1.001, - comment = "companion to context.tex", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local format = string.format - --- one can make a stub: --- --- #!/bin/sh --- env LUATEXDIR=/....../texmf/scripts/context/lua texlua luatools.lua "$@" - --- Although this script is part of the ConTeXt distribution it is --- relatively indepent of ConTeXt. The same is true for some of --- the luat files. We may may make them even less dependent in --- the future. As long as Luatex is under development the --- interfaces and names of functions may change. - --- For the sake of independence we optionally can merge the library --- code here. It's too much code, but that does not harm. Much of the --- library code is used elsewhere. We don't want dependencies on --- Lua library paths simply because these scripts are located in the --- texmf tree and not in some Lua path. Normally this merge is not --- needed when texmfstart is used, or when the proper stub is used or --- when (windows) suffix binding is active. - -texlua = true - --- begin library merge - - - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-string'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local sub, gsub, find, match, gmatch, format, char, byte, rep, lower = string.sub, string.gsub, string.find, string.match, string.gmatch, string.format, string.char, string.byte, string.rep, string.lower -local lpegmatch = lpeg.match - --- some functions may disappear as they are not used anywhere - -if not string.split then - - -- this will be overloaded by a faster lpeg variant - - function string:split(pattern) - if #self > 0 then - local t = { } - for s in gmatch(self..pattern,"(.-)"..pattern) do - t[#t+1] = s - end - return t - else - return { } - end - end - -end - -local chr_to_esc = { - ["%"] = "%%", - ["."] = "%.", - ["+"] = "%+", ["-"] = "%-", ["*"] = "%*", - ["^"] = "%^", ["$"] = "%$", - ["["] = "%[", ["]"] = "%]", - ["("] = "%(", [")"] = "%)", - ["{"] = "%{", ["}"] = "%}" -} - -string.chr_to_esc = chr_to_esc - -function string:esc() -- variant 2 - return (gsub(self,"(.)",chr_to_esc)) -end - -function string:unquote() - return (gsub(self,"^([\"\'])(.*)%1$","%2")) -end - ---~ function string:unquote() ---~ if find(self,"^[\'\"]") then ---~ return sub(self,2,-2) ---~ else ---~ return self ---~ end ---~ end - -function string:quote() -- we could use format("%q") - return format("%q",self) -end - -function string:count(pattern) -- variant 3 - local n = 0 - for _ in gmatch(self,pattern) do - n = n + 1 - end - return n -end - -function string:limit(n,sentinel) - if #self > n then - sentinel = sentinel or " ..." - return sub(self,1,(n-#sentinel)) .. sentinel - else - return self - end -end - ---~ function string:strip() -- the .- is quite efficient ---~ -- return match(self,"^%s*(.-)%s*$") or "" ---~ -- return match(self,'^%s*(.*%S)') or '' -- posted on lua list ---~ return find(s,'^%s*$') and '' or match(s,'^%s*(.*%S)') ---~ end - -do -- roberto's variant: - local space = lpeg.S(" \t\v\n") - local nospace = 1 - space - local stripper = space^0 * lpeg.C((space^0 * nospace^1)^0) - function string.strip(str) - return lpegmatch(stripper,str) or "" - end -end - -function string:is_empty() - return not find(self,"%S") -end - -function string:enhance(pattern,action) - local ok, n = true, 0 - while ok do - ok = false - self = gsub(self,pattern, function(...) - ok, n = true, n + 1 - return action(...) - end) - end - return self, n -end - -local chr_to_hex, hex_to_chr = { }, { } - -for i=0,255 do - local c, h = char(i), format("%02X",i) - chr_to_hex[c], hex_to_chr[h] = h, c -end - -function string:to_hex() - return (gsub(self or "","(.)",chr_to_hex)) -end - -function string:from_hex() - return (gsub(self or "","(..)",hex_to_chr)) -end - -if not string.characters then - - local function nextchar(str, index) - index = index + 1 - return (index <= #str) and index or nil, sub(str,index,index) - end - function string:characters() - return nextchar, self, 0 - end - local function nextbyte(str, index) - index = index + 1 - return (index <= #str) and index or nil, byte(sub(str,index,index)) - end - function string:bytes() - return nextbyte, self, 0 - end - -end - --- we can use format for this (neg n) - -function string:rpadd(n,chr) - local m = n-#self - if m > 0 then - return self .. rep(chr or " ",m) - else - return self - end -end - -function string:lpadd(n,chr) - local m = n-#self - if m > 0 then - return rep(chr or " ",m) .. self - else - return self - end -end - -string.padd = string.rpadd - -function is_number(str) -- tonumber - return find(str,"^[%-%+]?[%d]-%.?[%d+]$") == 1 -end - ---~ print(is_number("1")) ---~ print(is_number("1.1")) ---~ print(is_number(".1")) ---~ print(is_number("-0.1")) ---~ print(is_number("+0.1")) ---~ print(is_number("-.1")) ---~ print(is_number("+.1")) - -function string:split_settings() -- no {} handling, see l-aux for lpeg variant - if find(self,"=") then - local t = { } - for k,v in gmatch(self,"(%a+)=([^%,]*)") do - t[k] = v - end - return t - else - return nil - end -end - -local patterns_escapes = { - ["-"] = "%-", - ["."] = "%.", - ["+"] = "%+", - ["*"] = "%*", - ["%"] = "%%", - ["("] = "%)", - [")"] = "%)", - ["["] = "%[", - ["]"] = "%]", -} - -function string:pattesc() - return (gsub(self,".",patterns_escapes)) -end - -local simple_escapes = { - ["-"] = "%-", - ["."] = "%.", - ["?"] = ".", - ["*"] = ".*", -} - -function string:simpleesc() - return (gsub(self,".",simple_escapes)) -end - -function string:tohash() - local t = { } - for s in gmatch(self,"([^, ]+)") do -- lpeg - t[s] = true - end - return t -end - -local pattern = lpeg.Ct(lpeg.C(1)^0) - -function string:totable() - return lpegmatch(pattern,self) -end - ---~ local t = { ---~ "1234567123456712345671234567", ---~ "a\tb\tc", ---~ "aa\tbb\tcc", ---~ "aaa\tbbb\tccc", ---~ "aaaa\tbbbb\tcccc", ---~ "aaaaa\tbbbbb\tccccc", ---~ "aaaaaa\tbbbbbb\tcccccc", ---~ } ---~ for k,v do ---~ print(string.tabtospace(t[k])) ---~ end - -function string.tabtospace(str,tab) - -- we don't handle embedded newlines - while true do - local s = find(str,"\t") - if s then - if not tab then tab = 7 end -- only when found - local d = tab-(s-1) % tab - if d > 0 then - str = gsub(str,"\t",rep(" ",d),1) - else - str = gsub(str,"\t","",1) - end - else - break - end - end - return str -end - -function string:compactlong() -- strips newlines and leading spaces - self = gsub(self,"[\n\r]+ *","") - self = gsub(self,"^ *","") - return self -end - -function string:striplong() -- strips newlines and leading spaces - self = gsub(self,"^%s*","") - self = gsub(self,"[\n\r]+ *","\n") - return self -end - -function string:topattern(lowercase,strict) - if lowercase then - self = lower(self) - end - self = gsub(self,".",simple_escapes) - if self == "" then - self = ".*" - elseif strict then - self = "^" .. self .. "$" - end - return self -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-lpeg'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local lpeg = require("lpeg") - -lpeg.patterns = lpeg.patterns or { } -- so that we can share -local patterns = lpeg.patterns - -local P, R, S, Ct, C, Cs, Cc, V = lpeg.P, lpeg.R, lpeg.S, lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.V -local match = lpeg.match - -local digit, sign = R('09'), S('+-') -local cr, lf, crlf = P("\r"), P("\n"), P("\r\n") -local utf8byte = R("\128\191") - -patterns.utf8byte = utf8byte -patterns.utf8one = R("\000\127") -patterns.utf8two = R("\194\223") * utf8byte -patterns.utf8three = R("\224\239") * utf8byte * utf8byte -patterns.utf8four = R("\240\244") * utf8byte * utf8byte * utf8byte - -patterns.digit = digit -patterns.sign = sign -patterns.cardinal = sign^0 * digit^1 -patterns.integer = sign^0 * digit^1 -patterns.float = sign^0 * digit^0 * P('.') * digit^1 -patterns.number = patterns.float + patterns.integer -patterns.oct = P("0") * R("07")^1 -patterns.octal = patterns.oct -patterns.HEX = P("0x") * R("09","AF")^1 -patterns.hex = P("0x") * R("09","af")^1 -patterns.hexadecimal = P("0x") * R("09","AF","af")^1 -patterns.lowercase = R("az") -patterns.uppercase = R("AZ") -patterns.letter = patterns.lowercase + patterns.uppercase -patterns.space = S(" ") -patterns.eol = S("\n\r") -patterns.spacer = S(" \t\f\v") -- + string.char(0xc2, 0xa0) if we want utf (cf mail roberto) -patterns.newline = crlf + cr + lf -patterns.nonspace = 1 - patterns.space -patterns.nonspacer = 1 - patterns.spacer -patterns.whitespace = patterns.eol + patterns.spacer -patterns.nonwhitespace = 1 - patterns.whitespace -patterns.utf8 = patterns.utf8one + patterns.utf8two + patterns.utf8three + patterns.utf8four -patterns.utfbom = P('\000\000\254\255') + P('\255\254\000\000') + P('\255\254') + P('\254\255') + P('\239\187\191') - -function lpeg.anywhere(pattern) --slightly adapted from website - return P { P(pattern) + 1 * V(1) } -- why so complex? -end - -function lpeg.splitter(pattern, action) - return (((1-P(pattern))^1)/action+1)^0 -end - -local spacing = patterns.spacer^0 * patterns.newline -- sort of strip -local empty = spacing * Cc("") -local nonempty = Cs((1-spacing)^1) * spacing^-1 -local content = (empty + nonempty)^1 - -local capture = Ct(content^0) - -function string:splitlines() - return match(capture,self) -end - -patterns.textline = content - ---~ local p = lpeg.splitat("->",false) print(match(p,"oeps->what->more")) -- oeps what more ---~ local p = lpeg.splitat("->",true) print(match(p,"oeps->what->more")) -- oeps what->more ---~ local p = lpeg.splitat("->",false) print(match(p,"oeps")) -- oeps ---~ local p = lpeg.splitat("->",true) print(match(p,"oeps")) -- oeps - -local splitters_s, splitters_m = { }, { } - -local function splitat(separator,single) - local splitter = (single and splitters_s[separator]) or splitters_m[separator] - if not splitter then - separator = P(separator) - if single then - local other, any = C((1 - separator)^0), P(1) - splitter = other * (separator * C(any^0) + "") -- ? - splitters_s[separator] = splitter - else - local other = C((1 - separator)^0) - splitter = other * (separator * other)^0 - splitters_m[separator] = splitter - end - end - return splitter -end - -lpeg.splitat = splitat - -local cache = { } - -function lpeg.split(separator,str) - local c = cache[separator] - if not c then - c = Ct(splitat(separator)) - cache[separator] = c - end - return match(c,str) -end - -function string:split(separator) - local c = cache[separator] - if not c then - c = Ct(splitat(separator)) - cache[separator] = c - end - return match(c,self) -end - -lpeg.splitters = cache - -local cache = { } - -function lpeg.checkedsplit(separator,str) - local c = cache[separator] - if not c then - separator = P(separator) - local other = C((1 - separator)^0) - c = Ct(separator^0 * other * (separator^1 * other)^0) - cache[separator] = c - end - return match(c,str) -end - -function string:checkedsplit(separator) - local c = cache[separator] - if not c then - separator = P(separator) - local other = C((1 - separator)^0) - c = Ct(separator^0 * other * (separator^1 * other)^0) - cache[separator] = c - end - return match(c,self) -end - ---~ function lpeg.append(list,pp) ---~ local p = pp ---~ for l=1,#list do ---~ if p then ---~ p = p + P(list[l]) ---~ else ---~ p = P(list[l]) ---~ end ---~ end ---~ return p ---~ end - ---~ from roberto's site: - -local f1 = string.byte - -local function f2(s) local c1, c2 = f1(s,1,2) return c1 * 64 + c2 - 12416 end -local function f3(s) local c1, c2, c3 = f1(s,1,3) return (c1 * 64 + c2) * 64 + c3 - 925824 end -local function f4(s) local c1, c2, c3, c4 = f1(s,1,4) return ((c1 * 64 + c2) * 64 + c3) * 64 + c4 - 63447168 end - -patterns.utf8byte = patterns.utf8one/f1 + patterns.utf8two/f2 + patterns.utf8three/f3 + patterns.utf8four/f4 - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-table'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -table.join = table.concat - -local concat, sort, insert, remove = table.concat, table.sort, table.insert, table.remove -local format, find, gsub, lower, dump, match = string.format, string.find, string.gsub, string.lower, string.dump, string.match -local getmetatable, setmetatable = getmetatable, setmetatable -local type, next, tostring, tonumber, ipairs = type, next, tostring, tonumber, ipairs - --- Starting with version 5.2 Lua no longer provide ipairs, which makes --- sense. As we already used the for loop and # in most places the --- impact on ConTeXt was not that large; the remaining ipairs already --- have been replaced. In a similar fashio we also hardly used pairs. --- --- Just in case, we provide the fallbacks as discussed in Programming --- in Lua (http://www.lua.org/pil/7.3.html): - -if not ipairs then - - -- for k, v in ipairs(t) do ... end - -- for k=1,#t do local v = t[k] ... end - - local function iterate(a,i) - i = i + 1 - local v = a[i] - if v ~= nil then - return i, v --, nil - end - end - - function ipairs(a) - return iterate, a, 0 - end - -end - -if not pairs then - - -- for k, v in pairs(t) do ... end - -- for k, v in next, t do ... end - - function pairs(t) - return next, t -- , nil - end - -end - --- Also, unpack has been moved to the table table, and for compatiility --- reasons we provide both now. - -if not table.unpack then - table.unpack = _G.unpack -elseif not unpack then - _G.unpack = table.unpack -end - --- extra functions, some might go (when not used) - -function table.strip(tab) - local lst = { } - for i=1,#tab do - local s = gsub(tab[i],"^%s*(.-)%s*$","%1") - if s == "" then - -- skip this one - else - lst[#lst+1] = s - end - end - return lst -end - -function table.keys(t) - local k = { } - for key, _ in next, t do - k[#k+1] = key - end - return k -end - -local function compare(a,b) - return (tostring(a) < tostring(b)) -end - -local function sortedkeys(tab) - local srt, kind = { }, 0 -- 0=unknown 1=string, 2=number 3=mixed - for key,_ in next, tab do - srt[#srt+1] = key - if kind == 3 then - -- no further check - else - local tkey = type(key) - if tkey == "string" then - -- if kind == 2 then kind = 3 else kind = 1 end - kind = (kind == 2 and 3) or 1 - elseif tkey == "number" then - -- if kind == 1 then kind = 3 else kind = 2 end - kind = (kind == 1 and 3) or 2 - else - kind = 3 - end - end - end - if kind == 0 or kind == 3 then - sort(srt,compare) - else - sort(srt) - end - return srt -end - -local function sortedhashkeys(tab) -- fast one - local srt = { } - for key,_ in next, tab do - srt[#srt+1] = key - end - sort(srt) - return srt -end - -table.sortedkeys = sortedkeys -table.sortedhashkeys = sortedhashkeys - -function table.sortedhash(t) - local s = sortedhashkeys(t) -- maybe just sortedkeys - local n = 0 - local function kv(s) - n = n + 1 - local k = s[n] - return k, t[k] - end - return kv, s -end - -table.sortedpairs = table.sortedhash - -function table.append(t, list) - for _,v in next, list do - insert(t,v) - end -end - -function table.prepend(t, list) - for k,v in next, list do - insert(t,k,v) - end -end - -function table.merge(t, ...) -- first one is target - t = t or {} - local lst = {...} - for i=1,#lst do - for k, v in next, lst[i] do - t[k] = v - end - end - return t -end - -function table.merged(...) - local tmp, lst = { }, {...} - for i=1,#lst do - for k, v in next, lst[i] do - tmp[k] = v - end - end - return tmp -end - -function table.imerge(t, ...) - local lst = {...} - for i=1,#lst do - local nst = lst[i] - for j=1,#nst do - t[#t+1] = nst[j] - end - end - return t -end - -function table.imerged(...) - local tmp, lst = { }, {...} - for i=1,#lst do - local nst = lst[i] - for j=1,#nst do - tmp[#tmp+1] = nst[j] - end - end - return tmp -end - -local function fastcopy(old) -- fast one - if old then - local new = { } - for k,v in next, old do - if type(v) == "table" then - new[k] = fastcopy(v) -- was just table.copy - else - new[k] = v - end - end - -- optional second arg - local mt = getmetatable(old) - if mt then - setmetatable(new,mt) - end - return new - else - return { } - end -end - -local function copy(t, tables) -- taken from lua wiki, slightly adapted - tables = tables or { } - local tcopy = {} - if not tables[t] then - tables[t] = tcopy - end - for i,v in next, t do -- brrr, what happens with sparse indexed - if type(i) == "table" then - if tables[i] then - i = tables[i] - else - i = copy(i, tables) - end - end - if type(v) ~= "table" then - tcopy[i] = v - elseif tables[v] then - tcopy[i] = tables[v] - else - tcopy[i] = copy(v, tables) - end - end - local mt = getmetatable(t) - if mt then - setmetatable(tcopy,mt) - end - return tcopy -end - -table.fastcopy = fastcopy -table.copy = copy - --- roughly: copy-loop : unpack : sub == 0.9 : 0.4 : 0.45 (so in critical apps, use unpack) - -function table.sub(t,i,j) - return { unpack(t,i,j) } -end - -function table.replace(a,b) - for k,v in next, b do - a[k] = v - end -end - --- slower than #t on indexed tables (#t only returns the size of the numerically indexed slice) - -function table.is_empty(t) -- obolete, use inline code instead - return not t or not next(t) -end - -function table.one_entry(t) -- obolete, use inline code instead - local n = next(t) - return n and not next(t,n) -end - ---~ function table.starts_at(t) -- obsolete, not nice anyway ---~ return ipairs(t,1)(t,0) ---~ end - -function table.tohash(t,value) - local h = { } - if t then - if value == nil then value = true end - for _, v in next, t do -- no ipairs here - h[v] = value - end - end - return h -end - -function table.fromhash(t) - local h = { } - for k, v in next, t do -- no ipairs here - if v then h[#h+1] = k end - end - return h -end - ---~ print(table.serialize(t), "\n") ---~ print(table.serialize(t,"name"), "\n") ---~ print(table.serialize(t,false), "\n") ---~ print(table.serialize(t,true), "\n") ---~ print(table.serialize(t,"name",true), "\n") ---~ print(table.serialize(t,"name",true,true), "\n") - -table.serialize_functions = true -table.serialize_compact = true -table.serialize_inline = true - -local noquotes, hexify, handle, reduce, compact, inline, functions - -local reserved = table.tohash { -- intercept a language flaw, no reserved words as key - 'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', 'if', - 'in', 'local', 'nil', 'not', 'or', 'repeat', 'return', 'then', 'true', 'until', 'while', -} - -local function simple_table(t) - if #t > 0 then - local n = 0 - for _,v in next, t do - n = n + 1 - end - if n == #t then - local tt = { } - for i=1,#t do - local v = t[i] - local tv = type(v) - if tv == "number" then - if hexify then - tt[#tt+1] = format("0x%04X",v) - else - tt[#tt+1] = tostring(v) -- tostring not needed - end - elseif tv == "boolean" then - tt[#tt+1] = tostring(v) - elseif tv == "string" then - tt[#tt+1] = format("%q",v) - else - tt = nil - break - end - end - return tt - end - end - return nil -end - --- Because this is a core function of mkiv I moved some function calls --- inline. --- --- twice as fast in a test: --- --- local propername = lpeg.P(lpeg.R("AZ","az","__") * lpeg.R("09","AZ","az", "__")^0 * lpeg.P(-1) ) - --- problem: there no good number_to_string converter with the best resolution - -local function do_serialize(root,name,depth,level,indexed) - if level > 0 then - depth = depth .. " " - if indexed then - handle(format("%s{",depth)) - elseif name then - --~ handle(format("%s%s={",depth,key(name))) - if type(name) == "number" then -- or find(k,"^%d+$") then - if hexify then - handle(format("%s[0x%04X]={",depth,name)) - else - handle(format("%s[%s]={",depth,name)) - end - elseif noquotes and not reserved[name] and find(name,"^%a[%w%_]*$") then - handle(format("%s%s={",depth,name)) - else - handle(format("%s[%q]={",depth,name)) - end - else - handle(format("%s{",depth)) - end - end - -- we could check for k (index) being number (cardinal) - if root and next(root) then - local first, last = nil, 0 -- #root cannot be trusted here (will be ok in 5.2 when ipairs is gone) - if compact then - -- NOT: for k=1,#root do (we need to quit at nil) - for k,v in ipairs(root) do -- can we use next? - if not first then first = k end - last = last + 1 - end - end - local sk = sortedkeys(root) - for i=1,#sk do - local k = sk[i] - local v = root[k] - --~ if v == root then - -- circular - --~ else - local t = type(v) - if compact and first and type(k) == "number" and k >= first and k <= last then - if t == "number" then - if hexify then - handle(format("%s 0x%04X,",depth,v)) - else - handle(format("%s %s,",depth,v)) -- %.99g - end - elseif t == "string" then - if reduce and tonumber(v) then - handle(format("%s %s,",depth,v)) - else - handle(format("%s %q,",depth,v)) - end - elseif t == "table" then - if not next(v) then - handle(format("%s {},",depth)) - elseif inline then -- and #t > 0 - local st = simple_table(v) - if st then - handle(format("%s { %s },",depth,concat(st,", "))) - else - do_serialize(v,k,depth,level+1,true) - end - else - do_serialize(v,k,depth,level+1,true) - end - elseif t == "boolean" then - handle(format("%s %s,",depth,tostring(v))) - elseif t == "function" then - if functions then - handle(format('%s loadstring(%q),',depth,dump(v))) - else - handle(format('%s "function",',depth)) - end - else - handle(format("%s %q,",depth,tostring(v))) - end - elseif k == "__p__" then -- parent - if false then - handle(format("%s __p__=nil,",depth)) - end - elseif t == "number" then - --~ if hexify then - --~ handle(format("%s %s=0x%04X,",depth,key(k),v)) - --~ else - --~ handle(format("%s %s=%s,",depth,key(k),v)) -- %.99g - --~ end - if type(k) == "number" then -- or find(k,"^%d+$") then - if hexify then - handle(format("%s [0x%04X]=0x%04X,",depth,k,v)) - else - handle(format("%s [%s]=%s,",depth,k,v)) -- %.99g - end - elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then - if hexify then - handle(format("%s %s=0x%04X,",depth,k,v)) - else - handle(format("%s %s=%s,",depth,k,v)) -- %.99g - end - else - if hexify then - handle(format("%s [%q]=0x%04X,",depth,k,v)) - else - handle(format("%s [%q]=%s,",depth,k,v)) -- %.99g - end - end - elseif t == "string" then - if reduce and tonumber(v) then - --~ handle(format("%s %s=%s,",depth,key(k),v)) - if type(k) == "number" then -- or find(k,"^%d+$") then - if hexify then - handle(format("%s [0x%04X]=%s,",depth,k,v)) - else - handle(format("%s [%s]=%s,",depth,k,v)) - end - elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then - handle(format("%s %s=%s,",depth,k,v)) - else - handle(format("%s [%q]=%s,",depth,k,v)) - end - else - --~ handle(format("%s %s=%q,",depth,key(k),v)) - if type(k) == "number" then -- or find(k,"^%d+$") then - if hexify then - handle(format("%s [0x%04X]=%q,",depth,k,v)) - else - handle(format("%s [%s]=%q,",depth,k,v)) - end - elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then - handle(format("%s %s=%q,",depth,k,v)) - else - handle(format("%s [%q]=%q,",depth,k,v)) - end - end - elseif t == "table" then - if not next(v) then - --~ handle(format("%s %s={},",depth,key(k))) - if type(k) == "number" then -- or find(k,"^%d+$") then - if hexify then - handle(format("%s [0x%04X]={},",depth,k)) - else - handle(format("%s [%s]={},",depth,k)) - end - elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then - handle(format("%s %s={},",depth,k)) - else - handle(format("%s [%q]={},",depth,k)) - end - elseif inline then - local st = simple_table(v) - if st then - --~ handle(format("%s %s={ %s },",depth,key(k),concat(st,", "))) - if type(k) == "number" then -- or find(k,"^%d+$") then - if hexify then - handle(format("%s [0x%04X]={ %s },",depth,k,concat(st,", "))) - else - handle(format("%s [%s]={ %s },",depth,k,concat(st,", "))) - end - elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then - handle(format("%s %s={ %s },",depth,k,concat(st,", "))) - else - handle(format("%s [%q]={ %s },",depth,k,concat(st,", "))) - end - else - do_serialize(v,k,depth,level+1) - end - else - do_serialize(v,k,depth,level+1) - end - elseif t == "boolean" then - --~ handle(format("%s %s=%s,",depth,key(k),tostring(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then - if hexify then - handle(format("%s [0x%04X]=%s,",depth,k,tostring(v))) - else - handle(format("%s [%s]=%s,",depth,k,tostring(v))) - end - elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then - handle(format("%s %s=%s,",depth,k,tostring(v))) - else - handle(format("%s [%q]=%s,",depth,k,tostring(v))) - end - elseif t == "function" then - if functions then - --~ handle(format('%s %s=loadstring(%q),',depth,key(k),dump(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then - if hexify then - handle(format("%s [0x%04X]=loadstring(%q),",depth,k,dump(v))) - else - handle(format("%s [%s]=loadstring(%q),",depth,k,dump(v))) - end - elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then - handle(format("%s %s=loadstring(%q),",depth,k,dump(v))) - else - handle(format("%s [%q]=loadstring(%q),",depth,k,dump(v))) - end - end - else - --~ handle(format("%s %s=%q,",depth,key(k),tostring(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then - if hexify then - handle(format("%s [0x%04X]=%q,",depth,k,tostring(v))) - else - handle(format("%s [%s]=%q,",depth,k,tostring(v))) - end - elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then - handle(format("%s %s=%q,",depth,k,tostring(v))) - else - handle(format("%s [%q]=%q,",depth,k,tostring(v))) - end - end - --~ end - end - end - if level > 0 then - handle(format("%s},",depth)) - end -end - --- replacing handle by a direct t[#t+1] = ... (plus test) is not much --- faster (0.03 on 1.00 for zapfino.tma) - -local function serialize(root,name,_handle,_reduce,_noquotes,_hexify) - noquotes = _noquotes - hexify = _hexify - handle = _handle or print - reduce = _reduce or false - compact = table.serialize_compact - inline = compact and table.serialize_inline - functions = table.serialize_functions - local tname = type(name) - if tname == "string" then - if name == "return" then - handle("return {") - else - handle(name .. "={") - end - elseif tname == "number" then - if hexify then - handle(format("[0x%04X]={",name)) - else - handle("[" .. name .. "]={") - end - elseif tname == "boolean" then - if name then - handle("return {") - else - handle("{") - end - else - handle("t={") - end - if root and next(root) then - do_serialize(root,name,"",0,indexed) - end - handle("}") -end - ---~ name: ---~ ---~ true : return { } ---~ false : { } ---~ nil : t = { } ---~ string : string = { } ---~ 'return' : return { } ---~ number : [number] = { } - -function table.serialize(root,name,reduce,noquotes,hexify) - local t = { } - local function flush(s) - t[#t+1] = s - end - serialize(root,name,flush,reduce,noquotes,hexify) - return concat(t,"\n") -end - -function table.tohandle(handle,root,name,reduce,noquotes,hexify) - serialize(root,name,handle,reduce,noquotes,hexify) -end - --- sometimes tables are real use (zapfino extra pro is some 85M) in which --- case a stepwise serialization is nice; actually, we could consider: --- --- for line in table.serializer(root,name,reduce,noquotes) do --- ...(line) --- end --- --- so this is on the todo list - -table.tofile_maxtab = 2*1024 - -function table.tofile(filename,root,name,reduce,noquotes,hexify) - local f = io.open(filename,'w') - if f then - local maxtab = table.tofile_maxtab - if maxtab > 1 then - local t = { } - local function flush(s) - t[#t+1] = s - if #t > maxtab then - f:write(concat(t,"\n"),"\n") -- hm, write(sometable) should be nice - t = { } - end - end - serialize(root,name,flush,reduce,noquotes,hexify) - f:write(concat(t,"\n"),"\n") - else - local function flush(s) - f:write(s,"\n") - end - serialize(root,name,flush,reduce,noquotes,hexify) - end - f:close() - end -end - -local function flatten(t,f,complete) -- is this used? meybe a variant with next, ... - for i=1,#t do - local v = t[i] - if type(v) == "table" then - if complete or type(v[1]) == "table" then - flatten(v,f,complete) - else - f[#f+1] = v - end - else - f[#f+1] = v - end - end -end - -function table.flatten(t) - local f = { } - flatten(t,f,true) - return f -end - -function table.unnest(t) -- bad name - local f = { } - flatten(t,f,false) - return f -end - -table.flatten_one_level = table.unnest - --- a better one: - -local function flattened(t,f) - if not f then - f = { } - end - for k, v in next, t do - if type(v) == "table" then - flattened(v,f) - else - f[k] = v - end - end - return f -end - -table.flattened = flattened - --- the next three may disappear - -function table.remove_value(t,value) -- todo: n - if value then - for i=1,#t do - if t[i] == value then - remove(t,i) - -- remove all, so no: return - end - end - end -end - -function table.insert_before_value(t,value,str) - if str then - if value then - for i=1,#t do - if t[i] == value then - insert(t,i,str) - return - end - end - end - insert(t,1,str) - elseif value then - insert(t,1,value) - end -end - -function table.insert_after_value(t,value,str) - if str then - if value then - for i=1,#t do - if t[i] == value then - insert(t,i+1,str) - return - end - end - end - t[#t+1] = str - elseif value then - t[#t+1] = value - end -end - -local function are_equal(a,b,n,m) -- indexed - if a and b and #a == #b then - n = n or 1 - m = m or #a - for i=n,m do - local ai, bi = a[i], b[i] - if ai==bi then - -- same - elseif type(ai)=="table" and type(bi)=="table" then - if not are_equal(ai,bi) then - return false - end - else - return false - end - end - return true - else - return false - end -end - -local function identical(a,b) -- assumes same structure - for ka, va in next, a do - local vb = b[k] - if va == vb then - -- same - elseif type(va) == "table" and type(vb) == "table" then - if not identical(va,vb) then - return false - end - else - return false - end - end - return true -end - -table.are_equal = are_equal -table.identical = identical - --- maybe also make a combined one - -function table.compact(t) - if t then - for k,v in next, t do - if not next(v) then - t[k] = nil - end - end - end -end - -function table.contains(t, v) - if t then - for i=1, #t do - if t[i] == v then - return i - end - end - end - return false -end - -function table.count(t) - local n, e = 0, next(t) - while e do - n, e = n + 1, next(t,e) - end - return n -end - -function table.swapped(t) - local s = { } - for k, v in next, t do - s[v] = k - end - return s -end - ---~ function table.are_equal(a,b) ---~ return table.serialize(a) == table.serialize(b) ---~ end - -function table.clone(t,p) -- t is optional or nil or table - if not p then - t, p = { }, t or { } - elseif not t then - t = { } - end - setmetatable(t, { __index = function(_,key) return p[key] end }) -- why not __index = p ? - return t -end - -function table.hexed(t,seperator) - local tt = { } - for i=1,#t do tt[i] = format("0x%04X",t[i]) end - return concat(tt,seperator or " ") -end - -function table.reverse_hash(h) - local r = { } - for k,v in next, h do - r[v] = lower(gsub(k," ","")) - end - return r -end - -function table.reverse(t) - local tt = { } - if #t > 0 then - for i=#t,1,-1 do - tt[#tt+1] = t[i] - end - end - return tt -end - -function table.insert_before_value(t,value,extra) - for i=1,#t do - if t[i] == extra then - remove(t,i) - end - end - for i=1,#t do - if t[i] == value then - insert(t,i,extra) - return - end - end - insert(t,1,extra) -end - -function table.insert_after_value(t,value,extra) - for i=1,#t do - if t[i] == extra then - remove(t,i) - end - end - for i=1,#t do - if t[i] == value then - insert(t,i+1,extra) - return - end - end - insert(t,#t+1,extra) -end - - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-io'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local byte, find, gsub = string.byte, string.find, string.gsub - -if string.find(os.getenv("PATH"),";") then - io.fileseparator, io.pathseparator = "\\", ";" -else - io.fileseparator, io.pathseparator = "/" , ":" -end - -function io.loaddata(filename,textmode) - local f = io.open(filename,(textmode and 'r') or 'rb') - if f then - -- collectgarbage("step") -- sometimes makes a big difference in mem consumption - local data = f:read('*all') - -- garbagecollector.check(data) - f:close() - return data - else - return nil - end -end - -function io.savedata(filename,data,joiner) - local f = io.open(filename,"wb") - if f then - if type(data) == "table" then - f:write(table.join(data,joiner or "")) - elseif type(data) == "function" then - data(f) - else - f:write(data or "") - end - f:close() - return true - else - return false - end -end - -function io.exists(filename) - local f = io.open(filename) - if f == nil then - return false - else - assert(f:close()) - return true - end -end - -function io.size(filename) - local f = io.open(filename) - if f == nil then - return 0 - else - local s = f:seek("end") - assert(f:close()) - return s - end -end - -function io.noflines(f) - local n = 0 - for _ in f:lines() do - n = n + 1 - end - f:seek('set',0) - return n -end - -local nextchar = { - [ 4] = function(f) - return f:read(1,1,1,1) - end, - [ 2] = function(f) - return f:read(1,1) - end, - [ 1] = function(f) - return f:read(1) - end, - [-2] = function(f) - local a, b = f:read(1,1) - return b, a - end, - [-4] = function(f) - local a, b, c, d = f:read(1,1,1,1) - return d, c, b, a - end -} - -function io.characters(f,n) - if f then - return nextchar[n or 1], f - else - return nil, nil - end -end - -local nextbyte = { - [4] = function(f) - local a, b, c, d = f:read(1,1,1,1) - if d then - return byte(a), byte(b), byte(c), byte(d) - else - return nil, nil, nil, nil - end - end, - [2] = function(f) - local a, b = f:read(1,1) - if b then - return byte(a), byte(b) - else - return nil, nil - end - end, - [1] = function (f) - local a = f:read(1) - if a then - return byte(a) - else - return nil - end - end, - [-2] = function (f) - local a, b = f:read(1,1) - if b then - return byte(b), byte(a) - else - return nil, nil - end - end, - [-4] = function(f) - local a, b, c, d = f:read(1,1,1,1) - if d then - return byte(d), byte(c), byte(b), byte(a) - else - return nil, nil, nil, nil - end - end -} - -function io.bytes(f,n) - if f then - return nextbyte[n or 1], f - else - return nil, nil - end -end - -function io.ask(question,default,options) - while true do - io.write(question) - if options then - io.write(string.format(" [%s]",table.concat(options,"|"))) - end - if default then - io.write(string.format(" [%s]",default)) - end - io.write(string.format(" ")) - local answer = io.read() - answer = gsub(answer,"^%s*(.*)%s*$","%1") - if answer == "" and default then - return default - elseif not options then - return answer - else - for k=1,#options do - if options[k] == answer then - return answer - end - end - local pattern = "^" .. answer - for k=1,#options do - local v = options[k] - if find(v,pattern) then - return v - end - end - end - end -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-number'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local tostring = tostring -local format, floor, insert, match = string.format, math.floor, table.insert, string.match -local lpegmatch = lpeg.match - -number = number or { } - --- a,b,c,d,e,f = number.toset(100101) - -function number.toset(n) - return match(tostring(n),"(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)") -end - -function number.toevenhex(n) - local s = format("%X",n) - if #s % 2 == 0 then - return s - else - return "0" .. s - end -end - --- the lpeg way is slower on 8 digits, but faster on 4 digits, some 7.5% --- on --- --- for i=1,1000000 do --- local a,b,c,d,e,f,g,h = number.toset(12345678) --- local a,b,c,d = number.toset(1234) --- local a,b,c = number.toset(123) --- end --- --- of course dedicated "(.)(.)(.)(.)" matches are even faster - -local one = lpeg.C(1-lpeg.S(''))^1 - -function number.toset(n) - return lpegmatch(one,tostring(n)) -end - -function number.bits(n,zero) - local t, i = { }, (zero and 0) or 1 - while n > 0 do - local m = n % 2 - if m > 0 then - insert(t,1,i) - end - n = floor(n/2) - i = i + 1 - end - return t -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-set'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -set = set or { } - -local nums = { } -local tabs = { } -local concat = table.concat -local next, type = next, type - -set.create = table.tohash - -function set.tonumber(t) - if next(t) then - local s = "" - -- we could save mem by sorting, but it slows down - for k, v in next, t do - if v then - -- why bother about the leading space - s = s .. " " .. k - end - end - local n = nums[s] - if not n then - n = #tabs + 1 - tabs[n] = t - nums[s] = n - end - return n - else - return 0 - end -end - -function set.totable(n) - if n == 0 then - return { } - else - return tabs[n] or { } - end -end - -function set.tolist(n) - if n == 0 or not tabs[n] then - return "" - else - local t = { } - for k, v in next, tabs[n] do - if v then - t[#t+1] = k - end - end - return concat(t," ") - end -end - -function set.contains(n,s) - if type(n) == "table" then - return n[s] - elseif n == 0 then - return false - else - local t = tabs[n] - return t and t[s] - end -end - ---~ local c = set.create{'aap','noot','mies'} ---~ local s = set.tonumber(c) ---~ local t = set.totable(s) ---~ print(t['aap']) ---~ local c = set.create{'zus','wim','jet'} ---~ local s = set.tonumber(c) ---~ local t = set.totable(s) ---~ print(t['aap']) ---~ print(t['jet']) ---~ print(set.contains(t,'jet')) ---~ print(set.contains(t,'aap')) - - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-os'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- maybe build io.flush in os.execute - -local find, format, gsub = string.find, string.format, string.gsub -local random, ceil = math.random, math.ceil - -local execute, spawn, exec, ioflush = os.execute, os.spawn or os.execute, os.exec or os.execute, io.flush - -function os.execute(...) ioflush() return execute(...) end -function os.spawn (...) ioflush() return spawn (...) end -function os.exec (...) ioflush() return exec (...) end - -function os.resultof(command) - ioflush() -- else messed up logging - local handle = io.popen(command,"r") - if not handle then - -- print("unknown command '".. command .. "' in os.resultof") - return "" - else - return handle:read("*all") or "" - end -end - ---~ os.type : windows | unix (new, we already guessed os.platform) ---~ os.name : windows | msdos | linux | macosx | solaris | .. | generic (new) ---~ os.platform : extended os.name with architecture - -if not io.fileseparator then - if find(os.getenv("PATH"),";") then - io.fileseparator, io.pathseparator, os.type = "\\", ";", os.type or "mswin" - else - io.fileseparator, io.pathseparator, os.type = "/" , ":", os.type or "unix" - end -end - -os.type = os.type or (io.pathseparator == ";" and "windows") or "unix" -os.name = os.name or (os.type == "windows" and "mswin" ) or "linux" - -if os.type == "windows" then - os.libsuffix, os.binsuffix = 'dll', 'exe' -else - os.libsuffix, os.binsuffix = 'so', '' -end - -function os.launch(str) - if os.type == "windows" then - os.execute("start " .. str) -- os.spawn ? - else - os.execute(str .. " &") -- os.spawn ? - end -end - -if not os.times then - -- utime = user time - -- stime = system time - -- cutime = children user time - -- cstime = children system time - function os.times() - return { - utime = os.gettimeofday(), -- user - stime = 0, -- system - cutime = 0, -- children user - cstime = 0, -- children system - } - end -end - -os.gettimeofday = os.gettimeofday or os.clock - -local startuptime = os.gettimeofday() - -function os.runtime() - return os.gettimeofday() - startuptime -end - ---~ print(os.gettimeofday()-os.time()) ---~ os.sleep(1.234) ---~ print (">>",os.runtime()) ---~ print(os.date("%H:%M:%S",os.gettimeofday())) ---~ print(os.date("%H:%M:%S",os.time())) - --- no need for function anymore as we have more clever code and helpers now --- this metatable trickery might as well disappear - -os.resolvers = os.resolvers or { } - -local resolvers = os.resolvers - -local osmt = getmetatable(os) or { __index = function(t,k) t[k] = "unset" return "unset" end } -- maybe nil -local osix = osmt.__index - -osmt.__index = function(t,k) - return (resolvers[k] or osix)(t,k) -end - -setmetatable(os,osmt) - -if not os.setenv then - - -- we still store them but they won't be seen in - -- child processes although we might pass them some day - -- using command concatination - - local env, getenv = { }, os.getenv - - function os.setenv(k,v) - env[k] = v - end - - function os.getenv(k) - return env[k] or getenv(k) - end - -end - --- we can use HOSTTYPE on some platforms - -local name, platform = os.name or "linux", os.getenv("MTX_PLATFORM") or "" - -local function guess() - local architecture = os.resultof("uname -m") or "" - if architecture ~= "" then - return architecture - end - architecture = os.getenv("HOSTTYPE") or "" - if architecture ~= "" then - return architecture - end - return os.resultof("echo $HOSTTYPE") or "" -end - -if platform ~= "" then - - os.platform = platform - -elseif os.type == "windows" then - - -- we could set the variable directly, no function needed here - - function os.resolvers.platform(t,k) - local platform, architecture = "", os.getenv("PROCESSOR_ARCHITECTURE") or "" - if find(architecture,"AMD64") then - platform = "mswin-64" - else - platform = "mswin" - end - os.setenv("MTX_PLATFORM",platform) - os.platform = platform - return platform - end - -elseif name == "linux" then - - function os.resolvers.platform(t,k) - -- we sometims have HOSTTYPE set so let's check that first - local platform, architecture = "", os.getenv("HOSTTYPE") or os.resultof("uname -m") or "" - if find(architecture,"x86_64") then - platform = "linux-64" - elseif find(architecture,"ppc") then - platform = "linux-ppc" - else - platform = "linux" - end - os.setenv("MTX_PLATFORM",platform) - os.platform = platform - return platform - end - -elseif name == "macosx" then - - --[[ - Identifying the architecture of OSX is quite a mess and this - is the best we can come up with. For some reason $HOSTTYPE is - a kind of pseudo environment variable, not known to the current - environment. And yes, uname cannot be trusted either, so there - is a change that you end up with a 32 bit run on a 64 bit system. - Also, some proper 64 bit intel macs are too cheap (low-end) and - therefore not permitted to run the 64 bit kernel. - ]]-- - - function os.resolvers.platform(t,k) - -- local platform, architecture = "", os.getenv("HOSTTYPE") or "" - -- if architecture == "" then - -- architecture = os.resultof("echo $HOSTTYPE") or "" - -- end - local platform, architecture = "", os.resultof("echo $HOSTTYPE") or "" - if architecture == "" then - -- print("\nI have no clue what kind of OSX you're running so let's assume an 32 bit intel.\n") - platform = "osx-intel" - elseif find(architecture,"i386") then - platform = "osx-intel" - elseif find(architecture,"x86_64") then - platform = "osx-64" - else - platform = "osx-ppc" - end - os.setenv("MTX_PLATFORM",platform) - os.platform = platform - return platform - end - -elseif name == "sunos" then - - function os.resolvers.platform(t,k) - local platform, architecture = "", os.resultof("uname -m") or "" - if find(architecture,"sparc") then - platform = "solaris-sparc" - else -- if architecture == 'i86pc' - platform = "solaris-intel" - end - os.setenv("MTX_PLATFORM",platform) - os.platform = platform - return platform - end - -elseif name == "freebsd" then - - function os.resolvers.platform(t,k) - local platform, architecture = "", os.resultof("uname -m") or "" - if find(architecture,"amd64") then - platform = "freebsd-amd64" - else - platform = "freebsd" - end - os.setenv("MTX_PLATFORM",platform) - os.platform = platform - return platform - end - -elseif name == "kfreebsd" then - - function os.resolvers.platform(t,k) - -- we sometims have HOSTTYPE set so let's check that first - local platform, architecture = "", os.getenv("HOSTTYPE") or os.resultof("uname -m") or "" - if find(architecture,"x86_64") then - platform = "kfreebsd-64" - else - platform = "kfreebsd-i386" - end - os.setenv("MTX_PLATFORM",platform) - os.platform = platform - return platform - end - -else - - -- platform = "linux" - -- os.setenv("MTX_PLATFORM",platform) - -- os.platform = platform - - function os.resolvers.platform(t,k) - local platform = "linux" - os.setenv("MTX_PLATFORM",platform) - os.platform = platform - return platform - end - -end - --- beware, we set the randomseed - --- from wikipedia: Version 4 UUIDs use a scheme relying only on random numbers. This algorithm sets the --- version number as well as two reserved bits. All other bits are set using a random or pseudorandom --- data source. Version 4 UUIDs have the form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx with hexadecimal --- digits x and hexadecimal digits 8, 9, A, or B for y. e.g. f47ac10b-58cc-4372-a567-0e02b2c3d479. --- --- as we don't call this function too often there is not so much risk on repetition - -local t = { 8, 9, "a", "b" } - -function os.uuid() - return format("%04x%04x-4%03x-%s%03x-%04x-%04x%04x%04x", - random(0xFFFF),random(0xFFFF), - random(0x0FFF), - t[ceil(random(4))] or 8,random(0x0FFF), - random(0xFFFF), - random(0xFFFF),random(0xFFFF),random(0xFFFF) - ) -end - -local d - -function os.timezone(delta) - d = d or tonumber(tonumber(os.date("%H")-os.date("!%H"))) - if delta then - if d > 0 then - return format("+%02i:00",d) - else - return format("-%02i:00",-d) - end - else - return 1 - end -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-file'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- needs a cleanup - -file = file or { } - -local concat = table.concat -local find, gmatch, match, gsub, sub, char = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char -local lpegmatch = lpeg.match - -function file.removesuffix(filename) - return (gsub(filename,"%.[%a%d]+$","")) -end - -function file.addsuffix(filename, suffix) - if not suffix or suffix == "" then - return filename - elseif not find(filename,"%.[%a%d]+$") then - return filename .. "." .. suffix - else - return filename - end -end - -function file.replacesuffix(filename, suffix) - return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix -end - -function file.dirname(name,default) - return match(name,"^(.+)[/\\].-$") or (default or "") -end - -function file.basename(name) - return match(name,"^.+[/\\](.-)$") or name -end - -function file.nameonly(name) - return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) -end - -function file.extname(name,default) - return match(name,"^.+%.([^/\\]-)$") or default or "" -end - -file.suffix = file.extname - ---~ function file.join(...) ---~ local pth = concat({...},"/") ---~ pth = gsub(pth,"\\","/") ---~ local a, b = match(pth,"^(.*://)(.*)$") ---~ if a and b then ---~ return a .. gsub(b,"//+","/") ---~ end ---~ a, b = match(pth,"^(//)(.*)$") ---~ if a and b then ---~ return a .. gsub(b,"//+","/") ---~ end ---~ return (gsub(pth,"//+","/")) ---~ end - -local trick_1 = char(1) -local trick_2 = "^" .. trick_1 .. "/+" - -function file.join(...) - local lst = { ... } - local a, b = lst[1], lst[2] - if a == "" then - lst[1] = trick_1 - elseif b and find(a,"^/+$") and find(b,"^/") then - lst[1] = "" - lst[2] = gsub(b,"^/+","") - end - local pth = concat(lst,"/") - pth = gsub(pth,"\\","/") - local a, b = match(pth,"^(.*://)(.*)$") - if a and b then - return a .. gsub(b,"//+","/") - end - a, b = match(pth,"^(//)(.*)$") - if a and b then - return a .. gsub(b,"//+","/") - end - pth = gsub(pth,trick_2,"") - return (gsub(pth,"//+","/")) -end - ---~ print(file.join("//","/y")) ---~ print(file.join("/","/y")) ---~ print(file.join("","/y")) ---~ print(file.join("/x/","/y")) ---~ print(file.join("x/","/y")) ---~ print(file.join("http://","/y")) ---~ print(file.join("http://a","/y")) ---~ print(file.join("http:///a","/y")) ---~ print(file.join("//nas-1","/y")) - -function file.iswritable(name) - local a = lfs.attributes(name) or lfs.attributes(file.dirname(name,".")) - return a and sub(a.permissions,2,2) == "w" -end - -function file.isreadable(name) - local a = lfs.attributes(name) - return a and sub(a.permissions,1,1) == "r" -end - -file.is_readable = file.isreadable -file.is_writable = file.iswritable - --- todo: lpeg - ---~ function file.split_path(str) ---~ local t = { } ---~ str = gsub(str,"\\", "/") ---~ str = gsub(str,"(%a):([;/])", "%1\001%2") ---~ for name in gmatch(str,"([^;:]+)") do ---~ if name ~= "" then ---~ t[#t+1] = gsub(name,"\001",":") ---~ end ---~ end ---~ return t ---~ end - -local checkedsplit = string.checkedsplit - -function file.split_path(str,separator) - str = gsub(str,"\\","/") - return checkedsplit(str,separator or io.pathseparator) -end - -function file.join_path(tab) - return concat(tab,io.pathseparator) -- can have trailing // -end - --- we can hash them weakly - - -local insert = table.insert - -function file.collapse_path(str,anchor) - if anchor and not find(str,"^/") and not find(str,"^%a:") then - str = getcurrentdir() .. "/" .. str - end - if str == "" or str =="." then - return "." - elseif find(str,"^%.%.") then - str = gsub(str,"\\","/") - return str - elseif not find(str,"%.") then - str = gsub(str,"\\","/") - return str - end - str = gsub(str,"\\","/") - local starter, rest = match(str,"^(%a+:/*)(.-)$") - if starter then - str = rest - end - local oldelements = checkedsplit(str,"/") - local newelements = { } - local i = #oldelements - while i > 0 do - local element = oldelements[i] - if element == '.' then - -- do nothing - elseif element == '..' then - local n = i -1 - while n > 0 do - local element = oldelements[n] - if element ~= '..' and element ~= '.' then - oldelements[n] = '.' - break - else - n = n - 1 - end - end - if n < 1 then - insert(newelements,1,'..') - end - elseif element ~= "" then - insert(newelements,1,element) - end - i = i - 1 - end - if #newelements == 0 then - return starter or "." - elseif starter then - return starter .. concat(newelements, '/') - elseif find(str,"^/") then - return "/" .. concat(newelements,'/') - else - return concat(newelements, '/') - end -end -function file.xcollapse_path(str) - print('collapse', str) - if str == "" or str =="." then - return "." - elseif find(str,"^%.%.") then - return str - elseif not find(str,"%.") then - return str - end - str = gsub(str,"^%./",lfs.currentdir() .. "/") -- ./xx in qualified - str = gsub(str,"\\","/") - local oldelements = checkedsplit(str,"/") - local newelements = { } - local i = #oldelements - while i > 0 do - local element = oldelements[i] - if element == '.' then - -- do nothing - elseif element == '..' then - local n = i -1 - while n > 0 do - local element = oldelements[n] - if element ~= '..' and element ~= '.' then - oldelements[n] = '.' - break - else - n = n - 1 - end - end - if n<1 then - insert(newelements,1,'..') - end - elseif element ~= "" then - insert(newelements,1,element) - end - i = i - 1 - end - if #newelements == 0 then - return "." - elseif find(str,"^/") then - return "/" .. concat(newelements,'/') - else - return concat(newelements, '/') - end -end - ---~ print(file.collapse_path("/a")) ---~ print(file.collapse_path("a/./b/..")) ---~ print(file.collapse_path("a/aa/../b/bb")) ---~ print(file.collapse_path("a/../..")) ---~ print(file.collapse_path("a/.././././b/..")) ---~ print(file.collapse_path("a/./././b/..")) ---~ print(file.collapse_path("a/b/c/../..")) - -function file.robustname(str) - return (gsub(str,"[^%a%d%/%-%.\\]+","-")) -end - -file.readdata = io.loaddata -file.savedata = io.savedata - -function file.copy(oldname,newname) - file.savedata(newname,io.loaddata(oldname)) -end - --- lpeg variants, slightly faster, not always - ---~ local period = lpeg.P(".") ---~ local slashes = lpeg.S("\\/") ---~ local noperiod = 1-period ---~ local noslashes = 1-slashes ---~ local name = noperiod^1 - ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.C(noperiod^1) * -1 - ---~ function file.extname(name) ---~ return lpegmatch(pattern,name) or "" ---~ end - ---~ local pattern = lpeg.Cs(((period * noperiod^1 * -1)/"" + 1)^1) - ---~ function file.removesuffix(name) ---~ return lpegmatch(pattern,name) ---~ end - ---~ local pattern = (noslashes^0 * slashes)^1 * lpeg.C(noslashes^1) * -1 - ---~ function file.basename(name) ---~ return lpegmatch(pattern,name) or name ---~ end - ---~ local pattern = (noslashes^0 * slashes)^1 * lpeg.Cp() * noslashes^1 * -1 - ---~ function file.dirname(name) ---~ local p = lpegmatch(pattern,name) ---~ if p then ---~ return sub(name,1,p-2) ---~ else ---~ return "" ---~ end ---~ end - ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.Cp() * noperiod^1 * -1 - ---~ function file.addsuffix(name, suffix) ---~ local p = lpegmatch(pattern,name) ---~ if p then ---~ return name ---~ else ---~ return name .. "." .. suffix ---~ end ---~ end - ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.Cp() * noperiod^1 * -1 - ---~ function file.replacesuffix(name,suffix) ---~ local p = lpegmatch(pattern,name) ---~ if p then ---~ return sub(name,1,p-2) .. "." .. suffix ---~ else ---~ return name .. "." .. suffix ---~ end ---~ end - ---~ local pattern = (noslashes^0 * slashes)^0 * lpeg.Cp() * ((noperiod^1 * period)^1 * lpeg.Cp() + lpeg.P(true)) * noperiod^1 * -1 - ---~ function file.nameonly(name) ---~ local a, b = lpegmatch(pattern,name) ---~ if b then ---~ return sub(name,a,b-2) ---~ elseif a then ---~ return sub(name,a) ---~ else ---~ return name ---~ end ---~ end - ---~ local test = file.extname ---~ local test = file.basename ---~ local test = file.dirname ---~ local test = file.addsuffix ---~ local test = file.replacesuffix ---~ local test = file.nameonly - ---~ print(1,test("./a/b/c/abd.def.xxx","!!!")) ---~ print(2,test("./../b/c/abd.def.xxx","!!!")) ---~ print(3,test("a/b/c/abd.def.xxx","!!!")) ---~ print(4,test("a/b/c/def.xxx","!!!")) ---~ print(5,test("a/b/c/def","!!!")) ---~ print(6,test("def","!!!")) ---~ print(7,test("def.xxx","!!!")) - ---~ local tim = os.clock() for i=1,250000 do local ext = test("abd.def.xxx","!!!") end print(os.clock()-tim) - --- also rewrite previous - -local letter = lpeg.R("az","AZ") + lpeg.S("_-+") -local separator = lpeg.P("://") - -local qualified = lpeg.P(".")^0 * lpeg.P("/") + letter*lpeg.P(":") + letter^1*separator + letter^1 * lpeg.P("/") -local rootbased = lpeg.P("/") + letter*lpeg.P(":") - --- ./name ../name /name c: :// name/name - -function file.is_qualified_path(filename) - return lpegmatch(qualified,filename) ~= nil -end - -function file.is_rootbased_path(filename) - return lpegmatch(rootbased,filename) ~= nil -end - -local slash = lpeg.S("\\/") -local period = lpeg.P(".") -local drive = lpeg.C(lpeg.R("az","AZ")) * lpeg.P(":") -local path = lpeg.C(((1-slash)^0 * slash)^0) -local suffix = period * lpeg.C(lpeg.P(1-period)^0 * lpeg.P(-1)) -local base = lpeg.C((1-suffix)^0) - -local pattern = (drive + lpeg.Cc("")) * (path + lpeg.Cc("")) * (base + lpeg.Cc("")) * (suffix + lpeg.Cc("")) - -function file.splitname(str) -- returns drive, path, base, suffix - return lpegmatch(pattern,str) -end - --- function test(t) for k, v in next, t do print(v, "=>", file.splitname(v)) end end --- --- test { "c:", "c:/aa", "c:/aa/bb", "c:/aa/bb/cc", "c:/aa/bb/cc.dd", "c:/aa/bb/cc.dd.ee" } --- test { "c:", "c:aa", "c:aa/bb", "c:aa/bb/cc", "c:aa/bb/cc.dd", "c:aa/bb/cc.dd.ee" } --- test { "/aa", "/aa/bb", "/aa/bb/cc", "/aa/bb/cc.dd", "/aa/bb/cc.dd.ee" } --- test { "aa", "aa/bb", "aa/bb/cc", "aa/bb/cc.dd", "aa/bb/cc.dd.ee" } - ---~ -- todo: ---~ ---~ if os.type == "windows" then ---~ local currentdir = lfs.currentdir ---~ function lfs.currentdir() ---~ return (gsub(currentdir(),"\\","/")) ---~ end ---~ end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-md5'] = { - version = 1.001, - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- This also provides file checksums and checkers. - -local gsub, format, byte = string.gsub, string.format, string.byte - -local function convert(str,fmt) - return (gsub(md5.sum(str),".",function(chr) return format(fmt,byte(chr)) end)) -end - -if not md5.HEX then function md5.HEX(str) return convert(str,"%02X") end end -if not md5.hex then function md5.hex(str) return convert(str,"%02x") end end -if not md5.dec then function md5.dec(str) return convert(str,"%03i") end end - ---~ if not md5.HEX then ---~ local function remap(chr) return format("%02X",byte(chr)) end ---~ function md5.HEX(str) return (gsub(md5.sum(str),".",remap)) end ---~ end ---~ if not md5.hex then ---~ local function remap(chr) return format("%02x",byte(chr)) end ---~ function md5.hex(str) return (gsub(md5.sum(str),".",remap)) end ---~ end ---~ if not md5.dec then ---~ local function remap(chr) return format("%03i",byte(chr)) end ---~ function md5.dec(str) return (gsub(md5.sum(str),".",remap)) end ---~ end - -file.needs_updating_threshold = 1 - -function file.needs_updating(oldname,newname) -- size modification access change - local oldtime = lfs.attributes(oldname, modification) - local newtime = lfs.attributes(newname, modification) - if newtime >= oldtime then - return false - elseif oldtime - newtime < file.needs_updating_threshold then - return false - else - return true - end -end - -function file.checksum(name) - if md5 then - local data = io.loaddata(name) - if data then - return md5.HEX(data) - end - end - return nil -end - -function file.loadchecksum(name) - if md5 then - local data = io.loaddata(name .. ".md5") - return data and (gsub(data,"%s","")) - end - return nil -end - -function file.savechecksum(name, checksum) - if not checksum then checksum = file.checksum(name) end - if checksum then - io.savedata(name .. ".md5",checksum) - return checksum - end - return nil -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-url'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local char, gmatch, gsub = string.char, string.gmatch, string.gsub -local tonumber, type = tonumber, type -local lpegmatch = lpeg.match - --- from the spec (on the web): --- --- foo://example.com:8042/over/there?name=ferret#nose --- \_/ \______________/\_________/ \_________/ \__/ --- | | | | | --- scheme authority path query fragment --- | _____________________|__ --- / \ / \ --- urn:example:animal:ferret:nose - -url = url or { } - -local function tochar(s) - return char(tonumber(s,16)) -end - -local colon, qmark, hash, slash, percent, endofstring = lpeg.P(":"), lpeg.P("?"), lpeg.P("#"), lpeg.P("/"), lpeg.P("%"), lpeg.P(-1) - -local hexdigit = lpeg.R("09","AF","af") -local plus = lpeg.P("+") -local escaped = (plus / " ") + (percent * lpeg.C(hexdigit * hexdigit) / tochar) - --- we assume schemes with more than 1 character (in order to avoid problems with windows disks) - -local scheme = lpeg.Cs((escaped+(1-colon-slash-qmark-hash))^2) * colon + lpeg.Cc("") -local authority = slash * slash * lpeg.Cs((escaped+(1- slash-qmark-hash))^0) + lpeg.Cc("") -local path = slash * lpeg.Cs((escaped+(1- qmark-hash))^0) + lpeg.Cc("") -local query = qmark * lpeg.Cs((escaped+(1- hash))^0) + lpeg.Cc("") -local fragment = hash * lpeg.Cs((escaped+(1- endofstring))^0) + lpeg.Cc("") - -local parser = lpeg.Ct(scheme * authority * path * query * fragment) - --- todo: reconsider Ct as we can as well have five return values (saves a table) --- so we can have two parsers, one with and one without - -function url.split(str) - return (type(str) == "string" and lpegmatch(parser,str)) or str -end - --- todo: cache them - -function url.hashed(str) - local s = url.split(str) - local somescheme = s[1] ~= "" - return { - scheme = (somescheme and s[1]) or "file", - authority = s[2], - path = s[3], - query = s[4], - fragment = s[5], - original = str, - noscheme = not somescheme, - } -end - -function url.hasscheme(str) - return url.split(str)[1] ~= "" -end - -function url.addscheme(str,scheme) - return (url.hasscheme(str) and str) or ((scheme or "file:///") .. str) -end - -function url.construct(hash) - local fullurl = hash.sheme .. "://".. hash.authority .. hash.path - if hash.query then - fullurl = fullurl .. "?".. hash.query - end - if hash.fragment then - fullurl = fullurl .. "?".. hash.fragment - end - return fullurl -end - -function url.filename(filename) - local t = url.hashed(filename) - return (t.scheme == "file" and (gsub(t.path,"^/([a-zA-Z])([:|])/)","%1:"))) or filename -end - -function url.query(str) - if type(str) == "string" then - local t = { } - for k, v in gmatch(str,"([^&=]*)=([^&=]*)") do - t[k] = v - end - return t - else - return str - end -end - ---~ print(url.filename("file:///c:/oeps.txt")) ---~ print(url.filename("c:/oeps.txt")) ---~ print(url.filename("file:///oeps.txt")) ---~ print(url.filename("file:///etc/test.txt")) ---~ print(url.filename("/oeps.txt")) - ---~ from the spec on the web (sort of): ---~ ---~ function test(str) ---~ print(table.serialize(url.hashed(str))) ---~ end ---~ ---~ test("%56pass%20words") ---~ test("file:///c:/oeps.txt") ---~ test("file:///c|/oeps.txt") ---~ test("file:///etc/oeps.txt") ---~ test("file://./etc/oeps.txt") ---~ test("file:////etc/oeps.txt") ---~ test("ftp://ftp.is.co.za/rfc/rfc1808.txt") ---~ test("http://www.ietf.org/rfc/rfc2396.txt") ---~ test("ldap://[2001:db8::7]/c=GB?objectClass?one#what") ---~ test("mailto:John.Doe@example.com") ---~ test("news:comp.infosystems.www.servers.unix") ---~ test("tel:+1-816-555-1212") ---~ test("telnet://192.0.2.16:80/") ---~ test("urn:oasis:names:specification:docbook:dtd:xml:4.1.2") ---~ test("/etc/passwords") ---~ test("http://www.pragma-ade.com/spaced%20name") - ---~ test("zip:///oeps/oeps.zip#bla/bla.tex") ---~ test("zip:///oeps/oeps.zip?bla/bla.tex") - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-dir'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- dir.expand_name will be merged with cleanpath and collapsepath - -local type = type -local find, gmatch, match, gsub = string.find, string.gmatch, string.match, string.gsub -local lpegmatch = lpeg.match - -dir = dir or { } - --- handy - -function dir.current() - return (gsub(lfs.currentdir(),"\\","/")) -end - --- optimizing for no string.find (*) does not save time - -local attributes = lfs.attributes -local walkdir = lfs.dir - -local function glob_pattern(path,patt,recurse,action) - local ok, scanner - if path == "/" then - ok, scanner = xpcall(function() return walkdir(path..".") end, function() end) -- kepler safe - else - ok, scanner = xpcall(function() return walkdir(path) end, function() end) -- kepler safe - end - if ok and type(scanner) == "function" then - if not find(path,"/$") then path = path .. '/' end - for name in scanner do - local full = path .. name - local mode = attributes(full,'mode') - if mode == 'file' then - if find(full,patt) then - action(full) - end - elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then - glob_pattern(full,patt,recurse,action) - end - end - end -end - -dir.glob_pattern = glob_pattern - -local function collect_pattern(path,patt,recurse,result) - local ok, scanner - result = result or { } - if path == "/" then - ok, scanner = xpcall(function() return walkdir(path..".") end, function() end) -- kepler safe - else - ok, scanner = xpcall(function() return walkdir(path) end, function() end) -- kepler safe - end - if ok and type(scanner) == "function" then - if not find(path,"/$") then path = path .. '/' end - for name in scanner do - local full = path .. name - local attr = attributes(full) - local mode = attr.mode - if mode == 'file' then - if find(full,patt) then - result[name] = attr - end - elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then - attr.list = collect_pattern(full,patt,recurse) - result[name] = attr - end - end - end - return result -end - -dir.collect_pattern = collect_pattern - -local P, S, R, C, Cc, Cs, Ct, Cv, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cv, lpeg.V - -local pattern = Ct { - [1] = (C(P(".") + P("/")^1) + C(R("az","AZ") * P(":") * P("/")^0) + Cc("./")) * V(2) * V(3), - [2] = C(((1-S("*?/"))^0 * P("/"))^0), - [3] = C(P(1)^0) -} - -local filter = Cs ( ( - P("**") / ".*" + - P("*") / "[^/]*" + - P("?") / "[^/]" + - P(".") / "%%." + - P("+") / "%%+" + - P("-") / "%%-" + - P(1) -)^0 ) - -local function glob(str,t) - if type(t) == "function" then - if type(str) == "table" then - for s=1,#str do - glob(str[s],t) - end - elseif lfs.isfile(str) then - t(str) - else - local split = lpegmatch(pattern,str) - if split then - local root, path, base = split[1], split[2], split[3] - local recurse = find(base,"%*%*") - local start = root .. path - local result = lpegmatch(filter,start .. base) - glob_pattern(start,result,recurse,t) - end - end - else - if type(str) == "table" then - local t = t or { } - for s=1,#str do - glob(str[s],t) - end - return t - elseif lfs.isfile(str) then - local t = t or { } - t[#t+1] = str - return t - else - local split = lpegmatch(pattern,str) - if split then - local t = t or { } - local action = action or function(name) t[#t+1] = name end - local root, path, base = split[1], split[2], split[3] - local recurse = find(base,"%*%*") - local start = root .. path - local result = lpegmatch(filter,start .. base) - glob_pattern(start,result,recurse,action) - return t - else - return { } - end - end - end -end - -dir.glob = glob - ---~ list = dir.glob("**/*.tif") ---~ list = dir.glob("/**/*.tif") ---~ list = dir.glob("./**/*.tif") ---~ list = dir.glob("oeps/**/*.tif") ---~ list = dir.glob("/oeps/**/*.tif") - -local function globfiles(path,recurse,func,files) -- func == pattern or function - if type(func) == "string" then - local s = func -- alas, we need this indirect way - func = function(name) return find(name,s) end - end - files = files or { } - for name in walkdir(path) do - if find(name,"^%.") then - --- skip - else - local mode = attributes(name,'mode') - if mode == "directory" then - if recurse then - globfiles(path .. "/" .. name,recurse,func,files) - end - elseif mode == "file" then - if func then - if func(name) then - files[#files+1] = path .. "/" .. name - end - else - files[#files+1] = path .. "/" .. name - end - end - end - end - return files -end - -dir.globfiles = globfiles - --- t = dir.glob("c:/data/develop/context/sources/**/????-*.tex") --- t = dir.glob("c:/data/develop/tex/texmf/**/*.tex") --- t = dir.glob("c:/data/develop/context/texmf/**/*.tex") --- t = dir.glob("f:/minimal/tex/**/*") --- print(dir.ls("f:/minimal/tex/**/*")) --- print(dir.ls("*.tex")) - -function dir.ls(pattern) - return table.concat(glob(pattern),"\n") -end - ---~ mkdirs("temp") ---~ mkdirs("a/b/c") ---~ mkdirs(".","/a/b/c") ---~ mkdirs("a","b","c") - -local make_indeed = true -- false - -if string.find(os.getenv("PATH"),";") then -- os.type == "windows" - - function dir.mkdirs(...) - local str, pth, t = "", "", { ... } - for i=1,#t do - local s = t[i] - if s ~= "" then - if str ~= "" then - str = str .. "/" .. s - else - str = s - end - end - end - local first, middle, last - local drive = false - first, middle, last = match(str,"^(//)(//*)(.*)$") - if first then - -- empty network path == local path - else - first, last = match(str,"^(//)/*(.-)$") - if first then - middle, last = match(str,"([^/]+)/+(.-)$") - if middle then - pth = "//" .. middle - else - pth = "//" .. last - last = "" - end - else - first, middle, last = match(str,"^([a-zA-Z]:)(/*)(.-)$") - if first then - pth, drive = first .. middle, true - else - middle, last = match(str,"^(/*)(.-)$") - if not middle then - last = str - end - end - end - end - for s in gmatch(last,"[^/]+") do - if pth == "" then - pth = s - elseif drive then - pth, drive = pth .. s, false - else - pth = pth .. "/" .. s - end - if make_indeed and not lfs.isdir(pth) then - lfs.mkdir(pth) - end - end - return pth, (lfs.isdir(pth) == true) - end - ---~ print(dir.mkdirs("","","a","c")) ---~ print(dir.mkdirs("a")) ---~ print(dir.mkdirs("a:")) ---~ print(dir.mkdirs("a:/b/c")) ---~ print(dir.mkdirs("a:b/c")) ---~ print(dir.mkdirs("a:/bbb/c")) ---~ print(dir.mkdirs("/a/b/c")) ---~ print(dir.mkdirs("/aaa/b/c")) ---~ print(dir.mkdirs("//a/b/c")) ---~ print(dir.mkdirs("///a/b/c")) ---~ print(dir.mkdirs("a/bbb//ccc/")) - - function dir.expand_name(str) -- will be merged with cleanpath and collapsepath - local first, nothing, last = match(str,"^(//)(//*)(.*)$") - if first then - first = dir.current() .. "/" - end - if not first then - first, last = match(str,"^(//)/*(.*)$") - end - if not first then - first, last = match(str,"^([a-zA-Z]:)(.*)$") - if first and not find(last,"^/") then - local d = lfs.currentdir() - if lfs.chdir(first) then - first = dir.current() - end - lfs.chdir(d) - end - end - if not first then - first, last = dir.current(), str - end - last = gsub(last,"//","/") - last = gsub(last,"/%./","/") - last = gsub(last,"^/*","") - first = gsub(first,"/*$","") - if last == "" then - return first - else - return first .. "/" .. last - end - end - -else - - function dir.mkdirs(...) - local str, pth, t = "", "", { ... } - for i=1,#t do - local s = t[i] - if s ~= "" then - if str ~= "" then - str = str .. "/" .. s - else - str = s - end - end - end - str = gsub(str,"/+","/") - if find(str,"^/") then - pth = "/" - for s in gmatch(str,"[^/]+") do - local first = (pth == "/") - if first then - pth = pth .. s - else - pth = pth .. "/" .. s - end - if make_indeed and not first and not lfs.isdir(pth) then - lfs.mkdir(pth) - end - end - else - pth = "." - for s in gmatch(str,"[^/]+") do - pth = pth .. "/" .. s - if make_indeed and not lfs.isdir(pth) then - lfs.mkdir(pth) - end - end - end - return pth, (lfs.isdir(pth) == true) - end - ---~ print(dir.mkdirs("","","a","c")) ---~ print(dir.mkdirs("a")) ---~ print(dir.mkdirs("/a/b/c")) ---~ print(dir.mkdirs("/aaa/b/c")) ---~ print(dir.mkdirs("//a/b/c")) ---~ print(dir.mkdirs("///a/b/c")) ---~ print(dir.mkdirs("a/bbb//ccc/")) - - function dir.expand_name(str) -- will be merged with cleanpath and collapsepath - if not find(str,"^/") then - str = lfs.currentdir() .. "/" .. str - end - str = gsub(str,"//","/") - str = gsub(str,"/%./","/") - return str - end - -end - -dir.makedirs = dir.mkdirs - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-boolean'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -boolean = boolean or { } - -local type, tonumber = type, tonumber - -function boolean.tonumber(b) - if b then return 1 else return 0 end -end - -function toboolean(str,tolerant) - if tolerant then - local tstr = type(str) - if tstr == "string" then - return str == "true" or str == "yes" or str == "on" or str == "1" or str == "t" - elseif tstr == "number" then - return tonumber(str) ~= 0 - elseif tstr == "nil" then - return false - else - return str - end - elseif str == "true" then - return true - elseif str == "false" then - return false - else - return str - end -end - -function string.is_boolean(str) - if type(str) == "string" then - if str == "true" or str == "yes" or str == "on" or str == "t" then - return true - elseif str == "false" or str == "no" or str == "off" or str == "f" then - return false - end - end - return nil -end - -function boolean.alwaystrue() - return true -end - -function boolean.falsetrue() - return false -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-unicode'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -if not unicode then - - unicode = { utf8 = { } } - - local floor, char = math.floor, string.char - - function unicode.utf8.utfchar(n) - if n < 0x80 then - return char(n) - elseif n < 0x800 then - return char(0xC0 + floor(n/0x40)) .. char(0x80 + (n % 0x40)) - elseif n < 0x10000 then - return char(0xE0 + floor(n/0x1000)) .. char(0x80 + (floor(n/0x40) % 0x40)) .. char(0x80 + (n % 0x40)) - elseif n < 0x40000 then - return char(0xF0 + floor(n/0x40000)) .. char(0x80 + floor(n/0x1000)) .. char(0x80 + (floor(n/0x40) % 0x40)) .. char(0x80 + (n % 0x40)) - else -- wrong: - -- return char(0xF1 + floor(n/0x1000000)) .. char(0x80 + floor(n/0x40000)) .. char(0x80 + floor(n/0x1000)) .. char(0x80 + (floor(n/0x40) % 0x40)) .. char(0x80 + (n % 0x40)) - return "?" - end - end - -end - -utf = utf or unicode.utf8 - -local concat, utfchar, utfgsub = table.concat, utf.char, utf.gsub -local char, byte, find, bytepairs = string.char, string.byte, string.find, string.bytepairs - --- 0 EF BB BF UTF-8 --- 1 FF FE UTF-16-little-endian --- 2 FE FF UTF-16-big-endian --- 3 FF FE 00 00 UTF-32-little-endian --- 4 00 00 FE FF UTF-32-big-endian - -unicode.utfname = { - [0] = 'utf-8', - [1] = 'utf-16-le', - [2] = 'utf-16-be', - [3] = 'utf-32-le', - [4] = 'utf-32-be' -} - --- \000 fails in <= 5.0 but is valid in >=5.1 where %z is depricated - -function unicode.utftype(f) - local str = f:read(4) - if not str then - f:seek('set') - return 0 - -- elseif find(str,"^%z%z\254\255") then -- depricated - -- elseif find(str,"^\000\000\254\255") then -- not permitted and bugged - elseif find(str,"\000\000\254\255",1,true) then -- seems to work okay (TH) - return 4 - -- elseif find(str,"^\255\254%z%z") then -- depricated - -- elseif find(str,"^\255\254\000\000") then -- not permitted and bugged - elseif find(str,"\255\254\000\000",1,true) then -- seems to work okay (TH) - return 3 - elseif find(str,"^\254\255") then - f:seek('set',2) - return 2 - elseif find(str,"^\255\254") then - f:seek('set',2) - return 1 - elseif find(str,"^\239\187\191") then - f:seek('set',3) - return 0 - else - f:seek('set') - return 0 - end -end - -function unicode.utf16_to_utf8(str, endian) -- maybe a gsub is faster or an lpeg - local result, tmp, n, m, p = { }, { }, 0, 0, 0 - -- lf | cr | crlf / (cr:13, lf:10) - local function doit() - if n == 10 then - if p ~= 13 then - result[#result+1] = concat(tmp) - tmp = { } - p = 0 - end - elseif n == 13 then - result[#result+1] = concat(tmp) - tmp = { } - p = n - else - tmp[#tmp+1] = utfchar(n) - p = 0 - end - end - for l,r in bytepairs(str) do - if r then - if endian then - n = l*256 + r - else - n = r*256 + l - end - if m > 0 then - n = (m-0xD800)*0x400 + (n-0xDC00) + 0x10000 - m = 0 - doit() - elseif n >= 0xD800 and n <= 0xDBFF then - m = n - else - doit() - end - end - end - if #tmp > 0 then - result[#result+1] = concat(tmp) - end - return result -end - -function unicode.utf32_to_utf8(str, endian) - local result = { } - local tmp, n, m, p = { }, 0, -1, 0 - -- lf | cr | crlf / (cr:13, lf:10) - local function doit() - if n == 10 then - if p ~= 13 then - result[#result+1] = concat(tmp) - tmp = { } - p = 0 - end - elseif n == 13 then - result[#result+1] = concat(tmp) - tmp = { } - p = n - else - tmp[#tmp+1] = utfchar(n) - p = 0 - end - end - for a,b in bytepairs(str) do - if a and b then - if m < 0 then - if endian then - m = a*256*256*256 + b*256*256 - else - m = b*256 + a - end - else - if endian then - n = m + a*256 + b - else - n = m + b*256*256*256 + a*256*256 - end - m = -1 - doit() - end - else - break - end - end - if #tmp > 0 then - result[#result+1] = concat(tmp) - end - return result -end - -local function little(c) - local b = byte(c) -- b = c:byte() - if b < 0x10000 then - return char(b%256,b/256) - else - b = b - 0x10000 - local b1, b2 = b/1024 + 0xD800, b%1024 + 0xDC00 - return char(b1%256,b1/256,b2%256,b2/256) - end -end - -local function big(c) - local b = byte(c) - if b < 0x10000 then - return char(b/256,b%256) - else - b = b - 0x10000 - local b1, b2 = b/1024 + 0xD800, b%1024 + 0xDC00 - return char(b1/256,b1%256,b2/256,b2%256) - end -end - -function unicode.utf8_to_utf16(str,littleendian) - if littleendian then - return char(255,254) .. utfgsub(str,".",little) - else - return char(254,255) .. utfgsub(str,".",big) - end -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-math'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local floor, sin, cos, tan = math.floor, math.sin, math.cos, math.tan - -if not math.round then - function math.round(x) - return floor(x + 0.5) - end -end - -if not math.div then - function math.div(n,m) - return floor(n/m) - end -end - -if not math.mod then - function math.mod(n,m) - return n % m - end -end - -local pipi = 2*math.pi/360 - -function math.sind(d) - return sin(d*pipi) -end - -function math.cosd(d) - return cos(d*pipi) -end - -function math.tand(d) - return tan(d*pipi) -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-utils'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- hm, quite unreadable - -local gsub = string.gsub -local concat = table.concat -local type, next = type, next - -if not utils then utils = { } end -if not utils.merger then utils.merger = { } end -if not utils.lua then utils.lua = { } end - -utils.merger.m_begin = "begin library merge" -utils.merger.m_end = "end library merge" -utils.merger.pattern = - "%c+" .. - "%-%-%s+" .. utils.merger.m_begin .. - "%c+(.-)%c+" .. - "%-%-%s+" .. utils.merger.m_end .. - "%c+" - -function utils.merger._self_fake_() - return - "-- " .. "created merged file" .. "\n\n" .. - "-- " .. utils.merger.m_begin .. "\n\n" .. - "-- " .. utils.merger.m_end .. "\n\n" -end - -function utils.report(...) - print(...) -end - -utils.merger.strip_comment = true - -function utils.merger._self_load_(name) - local f, data = io.open(name), "" - if f then - utils.report("reading merge from %s",name) - data = f:read("*all") - f:close() - else - utils.report("unknown file to merge %s",name) - end - if data and utils.merger.strip_comment then - -- saves some 20K - data = gsub(data,"%-%-~[^\n\r]*[\r\n]", "") - end - return data or "" -end - -function utils.merger._self_save_(name, data) - if data ~= "" then - local f = io.open(name,'w') - if f then - utils.report("saving merge from %s",name) - f:write(data) - f:close() - end - end -end - -function utils.merger._self_swap_(data,code) - if data ~= "" then - return (gsub(data,utils.merger.pattern, function(s) - return "\n\n" .. "-- "..utils.merger.m_begin .. "\n" .. code .. "\n" .. "-- "..utils.merger.m_end .. "\n\n" - end, 1)) - else - return "" - end -end - ---~ stripper: ---~ ---~ data = gsub(data,"%-%-~[^\n]*\n","") ---~ data = gsub(data,"\n\n+","\n") - -function utils.merger._self_libs_(libs,list) - local result, f, frozen = { }, nil, false - result[#result+1] = "\n" - if type(libs) == 'string' then libs = { libs } end - if type(list) == 'string' then list = { list } end - local foundpath = nil - for i=1,#libs do - local lib = libs[i] - for j=1,#list do - local pth = gsub(list[j],"\\","/") -- file.clean_path - utils.report("checking library path %s",pth) - local name = pth .. "/" .. lib - if lfs.isfile(name) then - foundpath = pth - end - end - if foundpath then break end - end - if foundpath then - utils.report("using library path %s",foundpath) - local right, wrong = { }, { } - for i=1,#libs do - local lib = libs[i] - local fullname = foundpath .. "/" .. lib - if lfs.isfile(fullname) then - -- right[#right+1] = lib - utils.report("merging library %s",fullname) - result[#result+1] = "do -- create closure to overcome 200 locals limit" - result[#result+1] = io.loaddata(fullname,true) - result[#result+1] = "end -- of closure" - else - -- wrong[#wrong+1] = lib - utils.report("no library %s",fullname) - end - end - if #right > 0 then - utils.report("merged libraries: %s",concat(right," ")) - end - if #wrong > 0 then - utils.report("skipped libraries: %s",concat(wrong," ")) - end - else - utils.report("no valid library path found") - end - return concat(result, "\n\n") -end - -function utils.merger.selfcreate(libs,list,target) - if target then - utils.merger._self_save_( - target, - utils.merger._self_swap_( - utils.merger._self_fake_(), - utils.merger._self_libs_(libs,list) - ) - ) - end -end - -function utils.merger.selfmerge(name,libs,list,target) - utils.merger._self_save_( - target or name, - utils.merger._self_swap_( - utils.merger._self_load_(name), - utils.merger._self_libs_(libs,list) - ) - ) -end - -function utils.merger.selfclean(name) - utils.merger._self_save_( - name, - utils.merger._self_swap_( - utils.merger._self_load_(name), - "" - ) - ) -end - -function utils.lua.compile(luafile, lucfile, cleanup, strip) -- defaults: cleanup=false strip=true - -- utils.report("compiling",luafile,"into",lucfile) - os.remove(lucfile) - local command = "-o " .. string.quote(lucfile) .. " " .. string.quote(luafile) - if strip ~= false then - command = "-s " .. command - end - local done = (os.spawn("texluac " .. command) == 0) or (os.spawn("luac " .. command) == 0) - if done and cleanup == true and lfs.isfile(lucfile) and lfs.isfile(luafile) then - -- utils.report("removing",luafile) - os.remove(luafile) - end - return done -end - - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-aux'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- for inline, no store split : for s in string.gmatch(str,",* *([^,]+)") do .. end - -aux = aux or { } - -local concat, format, gmatch = table.concat, string.format, string.gmatch -local tostring, type = tostring, type -local lpegmatch = lpeg.match - -local P, R, V = lpeg.P, lpeg.R, lpeg.V - -local escape, left, right = P("\\"), P('{'), P('}') - -lpeg.patterns.balanced = P { - [1] = ((escape * (left+right)) + (1 - (left+right)) + V(2))^0, - [2] = left * V(1) * right -} - -local space = lpeg.P(' ') -local equal = lpeg.P("=") -local comma = lpeg.P(",") -local lbrace = lpeg.P("{") -local rbrace = lpeg.P("}") -local nobrace = 1 - (lbrace+rbrace) -local nested = lpeg.P { lbrace * (nobrace + lpeg.V(1))^0 * rbrace } -local spaces = space^0 - -local value = lpeg.P(lbrace * lpeg.C((nobrace + nested)^0) * rbrace) + lpeg.C((nested + (1-comma))^0) - -local key = lpeg.C((1-equal-comma)^1) -local pattern_a = (space+comma)^0 * (key * equal * value + key * lpeg.C("")) -local pattern_c = (space+comma)^0 * (key * equal * value) - -local key = lpeg.C((1-space-equal-comma)^1) -local pattern_b = spaces * comma^0 * spaces * (key * ((spaces * equal * spaces * value) + lpeg.C(""))) - --- "a=1, b=2, c=3, d={a{b,c}d}, e=12345, f=xx{a{b,c}d}xx, g={}" : outer {} removes, leading spaces ignored - -local hash = { } - -local function set(key,value) -- using Carg is slower here - hash[key] = value -end - -local pattern_a_s = (pattern_a/set)^1 -local pattern_b_s = (pattern_b/set)^1 -local pattern_c_s = (pattern_c/set)^1 - -aux.settings_to_hash_pattern_a = pattern_a_s -aux.settings_to_hash_pattern_b = pattern_b_s -aux.settings_to_hash_pattern_c = pattern_c_s - -function aux.make_settings_to_hash_pattern(set,how) - if how == "strict" then - return (pattern_c/set)^1 - elseif how == "tolerant" then - return (pattern_b/set)^1 - else - return (pattern_a/set)^1 - end -end - -function aux.settings_to_hash(str,existing) - if str and str ~= "" then - hash = existing or { } - if moretolerant then - lpegmatch(pattern_b_s,str) - else - lpegmatch(pattern_a_s,str) - end - return hash - else - return { } - end -end - -function aux.settings_to_hash_tolerant(str,existing) - if str and str ~= "" then - hash = existing or { } - lpegmatch(pattern_b_s,str) - return hash - else - return { } - end -end - -function aux.settings_to_hash_strict(str,existing) - if str and str ~= "" then - hash = existing or { } - lpegmatch(pattern_c_s,str) - return next(hash) and hash - else - return nil - end -end - -local separator = comma * space^0 -local value = lpeg.P(lbrace * lpeg.C((nobrace + nested)^0) * rbrace) + lpeg.C((nested + (1-comma))^0) -local pattern = lpeg.Ct(value*(separator*value)^0) - --- "aap, {noot}, mies" : outer {} removes, leading spaces ignored - -aux.settings_to_array_pattern = pattern - --- we could use a weak table as cache - -function aux.settings_to_array(str) - if not str or str == "" then - return { } - else - return lpegmatch(pattern,str) - end -end - -local function set(t,v) - t[#t+1] = v -end - -local value = lpeg.P(lpeg.Carg(1)*value) / set -local pattern = value*(separator*value)^0 * lpeg.Carg(1) - -function aux.add_settings_to_array(t,str) - return lpegmatch(pattern,str,nil,t) -end - -function aux.hash_to_string(h,separator,yes,no,strict,omit) - if h then - local t, s = { }, table.sortedkeys(h) - omit = omit and table.tohash(omit) - for i=1,#s do - local key = s[i] - if not omit or not omit[key] then - local value = h[key] - if type(value) == "boolean" then - if yes and no then - if value then - t[#t+1] = key .. '=' .. yes - elseif not strict then - t[#t+1] = key .. '=' .. no - end - elseif value or not strict then - t[#t+1] = key .. '=' .. tostring(value) - end - else - t[#t+1] = key .. '=' .. value - end - end - end - return concat(t,separator or ",") - else - return "" - end -end - -function aux.array_to_string(a,separator) - if a then - return concat(a,separator or ",") - else - return "" - end -end - -function aux.settings_to_set(str,t) - t = t or { } - for s in gmatch(str,"%s*([^,]+)") do - t[s] = true - end - return t -end - -local value = lbrace * lpeg.C((nobrace + nested)^0) * rbrace -local pattern = lpeg.Ct((space + value)^0) - -function aux.arguments_to_table(str) - return lpegmatch(pattern,str) -end - --- temporary here - -function aux.getparameters(self,class,parentclass,settings) - local sc = self[class] - if not sc then - sc = table.clone(self[parent]) - self[class] = sc - end - aux.settings_to_hash(settings,sc) -end - --- temporary here - -local digit = lpeg.R("09") -local period = lpeg.P(".") -local zero = lpeg.P("0") -local trailingzeros = zero^0 * -digit -- suggested by Roberto R -local case_1 = period * trailingzeros / "" -local case_2 = period * (digit - trailingzeros)^1 * (trailingzeros / "") -local number = digit^1 * (case_1 + case_2) -local stripper = lpeg.Cs((number + 1)^0) - ---~ local sample = "bla 11.00 bla 11 bla 0.1100 bla 1.00100 bla 0.00 bla 0.001 bla 1.1100 bla 0.100100100 bla 0.00100100100" ---~ collectgarbage("collect") ---~ str = string.rep(sample,10000) ---~ local ts = os.clock() ---~ lpegmatch(stripper,str) ---~ print(#str, os.clock()-ts, lpegmatch(stripper,sample)) - -lpeg.patterns.strip_zeros = stripper - -function aux.strip_zeros(str) - return lpegmatch(stripper,str) -end - -function aux.definetable(target) -- defines undefined tables - local composed, t = nil, { } - for name in gmatch(target,"([^%.]+)") do - if composed then - composed = composed .. "." .. name - else - composed = name - end - t[#t+1] = format("%s = %s or { }",composed,composed) - end - return concat(t,"\n") -end - -function aux.accesstable(target) - local t = _G - for name in gmatch(target,"([^%.]+)") do - t = t[name] - end - return t -end - ---~ function string.commaseparated(str) ---~ return gmatch(str,"([^,%s]+)") ---~ end - --- as we use this a lot ... - ---~ function aux.cachefunction(action,weak) ---~ local cache = { } ---~ if weak then ---~ setmetatable(cache, { __mode = "kv" } ) ---~ end ---~ local function reminder(str) ---~ local found = cache[str] ---~ if not found then ---~ found = action(str) ---~ cache[str] = found ---~ end ---~ return found ---~ end ---~ return reminder, cache ---~ end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['trac-tra'] = { - version = 1.001, - comment = "companion to trac-tra.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- the tag is kind of generic and used for functions that are not --- bound to a variable, like node.new, node.copy etc (contrary to for instance --- node.has_attribute which is bound to a has_attribute local variable in mkiv) - -local debug = require "debug" - -local getinfo = debug.getinfo -local type, next = type, next -local concat = table.concat -local format, find, lower, gmatch, gsub = string.format, string.find, string.lower, string.gmatch, string.gsub - -debugger = debugger or { } - -local counters = { } -local names = { } - --- one - -local function hook() - local f = getinfo(2,"f").func - local n = getinfo(2,"Sn") --- if n.what == "C" and n.name then print (n.namewhat .. ': ' .. n.name) end - if f then - local cf = counters[f] - if cf == nil then - counters[f] = 1 - names[f] = n - else - counters[f] = cf + 1 - end - end -end -local function getname(func) - local n = names[func] - if n then - if n.what == "C" then - return n.name or '' - else - -- source short_src linedefined what name namewhat nups func - local name = n.name or n.namewhat or n.what - if not name or name == "" then name = "?" end - return format("%s : %s : %s", n.short_src or "unknown source", n.linedefined or "--", name) - end - else - return "unknown" - end -end -function debugger.showstats(printer,threshold) - printer = printer or texio.write or print - threshold = threshold or 0 - local total, grandtotal, functions = 0, 0, 0 - printer("\n") -- ugly but ok - -- table.sort(counters) - for func, count in next, counters do - if count > threshold then - local name = getname(func) - if not find(name,"for generator") then - printer(format("%8i %s", count, name)) - total = total + count - end - end - grandtotal = grandtotal + count - functions = functions + 1 - end - printer(format("functions: %s, total: %s, grand total: %s, threshold: %s\n", functions, total, grandtotal, threshold)) -end - --- two - ---~ local function hook() ---~ local n = getinfo(2) ---~ if n.what=="C" and not n.name then ---~ local f = tostring(debug.traceback()) ---~ local cf = counters[f] ---~ if cf == nil then ---~ counters[f] = 1 ---~ names[f] = n ---~ else ---~ counters[f] = cf + 1 ---~ end ---~ end ---~ end ---~ function debugger.showstats(printer,threshold) ---~ printer = printer or texio.write or print ---~ threshold = threshold or 0 ---~ local total, grandtotal, functions = 0, 0, 0 ---~ printer("\n") -- ugly but ok ---~ -- table.sort(counters) ---~ for func, count in next, counters do ---~ if count > threshold then ---~ printer(format("%8i %s", count, func)) ---~ total = total + count ---~ end ---~ grandtotal = grandtotal + count ---~ functions = functions + 1 ---~ end ---~ printer(format("functions: %s, total: %s, grand total: %s, threshold: %s\n", functions, total, grandtotal, threshold)) ---~ end - --- rest - -function debugger.savestats(filename,threshold) - local f = io.open(filename,'w') - if f then - debugger.showstats(function(str) f:write(str) end,threshold) - f:close() - end -end - -function debugger.enable() - debug.sethook(hook,"c") -end - -function debugger.disable() - debug.sethook() ---~ counters[debug.getinfo(2,"f").func] = nil -end - -function debugger.tracing() - local n = tonumber(os.env['MTX.TRACE.CALLS']) or tonumber(os.env['MTX_TRACE_CALLS']) or 0 - if n > 0 then - function debugger.tracing() return true end ; return true - else - function debugger.tracing() return false end ; return false - end -end - ---~ debugger.enable() - ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) - ---~ debugger.disable() - ---~ print("") ---~ debugger.showstats() ---~ print("") ---~ debugger.showstats(print,3) - -setters = setters or { } -setters.data = setters.data or { } - ---~ local function set(t,what,value) ---~ local data, done = t.data, t.done ---~ if type(what) == "string" then ---~ what = aux.settings_to_array(what) -- inefficient but ok ---~ end ---~ for i=1,#what do ---~ local w = what[i] ---~ for d, f in next, data do ---~ if done[d] then ---~ -- prevent recursion due to wildcards ---~ elseif find(d,w) then ---~ done[d] = true ---~ for i=1,#f do ---~ f[i](value) ---~ end ---~ end ---~ end ---~ end ---~ end - -local function set(t,what,value) - local data, done = t.data, t.done - if type(what) == "string" then - what = aux.settings_to_hash(what) -- inefficient but ok - end - for w, v in next, what do - if v == "" then - v = value - else - v = toboolean(v) - end - for d, f in next, data do - if done[d] then - -- prevent recursion due to wildcards - elseif find(d,w) then - done[d] = true - for i=1,#f do - f[i](v) - end - end - end - end -end - -local function reset(t) - for d, f in next, t.data do - for i=1,#f do - f[i](false) - end - end -end - -local function enable(t,what) - set(t,what,true) -end - -local function disable(t,what) - local data = t.data - if not what or what == "" then - t.done = { } - reset(t) - else - set(t,what,false) - end -end - -function setters.register(t,what,...) - local data = t.data - what = lower(what) - local w = data[what] - if not w then - w = { } - data[what] = w - end - for _, fnc in next, { ... } do - local typ = type(fnc) - if typ == "function" then - w[#w+1] = fnc - elseif typ == "string" then - w[#w+1] = function(value) set(t,fnc,value,nesting) end - end - end -end - -function setters.enable(t,what) - local e = t.enable - t.enable, t.done = enable, { } - enable(t,string.simpleesc(tostring(what))) - t.enable, t.done = e, { } -end - -function setters.disable(t,what) - local e = t.disable - t.disable, t.done = disable, { } - disable(t,string.simpleesc(tostring(what))) - t.disable, t.done = e, { } -end - -function setters.reset(t) - t.done = { } - reset(t) -end - -function setters.list(t) -- pattern - local list = table.sortedkeys(t.data) - local user, system = { }, { } - for l=1,#list do - local what = list[l] - if find(what,"^%*") then - system[#system+1] = what - else - user[#user+1] = what - end - end - return user, system -end - -function setters.show(t) - commands.writestatus("","") - local list = setters.list(t) - for k=1,#list do - commands.writestatus(t.name,list[k]) - end - commands.writestatus("","") -end - --- we could have used a bit of oo and the trackers:enable syntax but --- there is already a lot of code around using the singular tracker - --- we could make this into a module - -function setters.new(name) - local t - t = { - data = { }, - name = name, - enable = function(...) setters.enable (t,...) end, - disable = function(...) setters.disable (t,...) end, - register = function(...) setters.register(t,...) end, - list = function(...) setters.list (t,...) end, - show = function(...) setters.show (t,...) end, - } - setters.data[name] = t - return t -end - -trackers = setters.new("trackers") -directives = setters.new("directives") -experiments = setters.new("experiments") - --- nice trick: we overload two of the directives related functions with variants that --- do tracing (itself using a tracker) .. proof of concept - -local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end) -local trace_experiments = false local trace_experiments = false trackers.register("system.experiments", function(v) trace_experiments = v end) - -local e = directives.enable -local d = directives.disable - -function directives.enable(...) - commands.writestatus("directives","enabling: %s",concat({...}," ")) - e(...) -end - -function directives.disable(...) - commands.writestatus("directives","disabling: %s",concat({...}," ")) - d(...) -end - -local e = experiments.enable -local d = experiments.disable - -function experiments.enable(...) - commands.writestatus("experiments","enabling: %s",concat({...}," ")) - e(...) -end - -function experiments.disable(...) - commands.writestatus("experiments","disabling: %s",concat({...}," ")) - d(...) -end - --- a useful example - -directives.register("system.nostatistics", function(v) - statistics.enable = not v -end) - - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['luat-env'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- A former version provided functionality for non embeded core --- scripts i.e. runtime library loading. Given the amount of --- Lua code we use now, this no longer makes sense. Much of this --- evolved before bytecode arrays were available and so a lot of --- code has disappeared already. - -local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) - -local format, sub, match, gsub, find = string.format, string.sub, string.match, string.gsub, string.find -local unquote, quote = string.unquote, string.quote - --- precautions - -os.setlocale(nil,nil) -- useless feature and even dangerous in luatex - -function os.setlocale() - -- no way you can mess with it -end - --- dirty tricks - -if arg and (arg[0] == 'luatex' or arg[0] == 'luatex.exe') and arg[1] == "--luaonly" then - arg[-1]=arg[0] arg[0]=arg[2] for k=3,#arg do arg[k-2]=arg[k] end arg[#arg]=nil arg[#arg]=nil -end - -if profiler and os.env["MTX_PROFILE_RUN"] == "YES" then - profiler.start("luatex-profile.log") -end - --- environment - -environment = environment or { } -environment.arguments = { } -environment.files = { } -environment.sortedflags = nil - -if not environment.jobname or environment.jobname == "" then if tex then environment.jobname = tex.jobname end end -if not environment.version or environment.version == "" then environment.version = "unknown" end -if not environment.jobname then environment.jobname = "unknown" end - -function environment.initialize_arguments(arg) - local arguments, files = { }, { } - environment.arguments, environment.files, environment.sortedflags = arguments, files, nil - for index=1,#arg do - local argument = arg[index] - if index > 0 then - local flag, value = match(argument,"^%-+(.-)=(.-)$") - if flag then - arguments[flag] = unquote(value or "") - else - flag = match(argument,"^%-+(.+)") - if flag then - arguments[flag] = true - else - files[#files+1] = argument - end - end - end - end - environment.ownname = environment.ownname or arg[0] or 'unknown.lua' -end - -function environment.setargument(name,value) - environment.arguments[name] = value -end - --- todo: defaults, better checks e.g on type (boolean versus string) --- --- tricky: too many hits when we support partials unless we add --- a registration of arguments so from now on we have 'partial' - -function environment.argument(name,partial) - local arguments, sortedflags = environment.arguments, environment.sortedflags - if arguments[name] then - return arguments[name] - elseif partial then - if not sortedflags then - sortedflags = table.sortedkeys(arguments) - for k=1,#sortedflags do - sortedflags[k] = "^" .. sortedflags[k] - end - environment.sortedflags = sortedflags - end - -- example of potential clash: ^mode ^modefile - for k=1,#sortedflags do - local v = sortedflags[k] - if find(name,v) then - return arguments[sub(v,2,#v)] - end - end - end - return nil -end - -environment.argument("x",true) - -function environment.split_arguments(separator) -- rather special, cut-off before separator - local done, before, after = false, { }, { } - local original_arguments = environment.original_arguments - for k=1,#original_arguments do - local v = original_arguments[k] - if not done and v == separator then - done = true - elseif done then - after[#after+1] = v - else - before[#before+1] = v - end - end - return before, after -end - -function environment.reconstruct_commandline(arg,noquote) - arg = arg or environment.original_arguments - if noquote and #arg == 1 then - local a = arg[1] - a = resolvers.resolve(a) - a = unquote(a) - return a - elseif #arg > 0 then - local result = { } - for i=1,#arg do - local a = arg[i] - a = resolvers.resolve(a) - a = unquote(a) - a = gsub(a,'"','\\"') -- tricky - if find(a," ") then - result[#result+1] = quote(a) - else - result[#result+1] = a - end - end - return table.join(result," ") - else - return "" - end -end - -if arg then - - -- new, reconstruct quoted snippets (maybe better just remove the " then and add them later) - local newarg, instring = { }, false - - for index=1,#arg do - local argument = arg[index] - if find(argument,"^\"") then - newarg[#newarg+1] = gsub(argument,"^\"","") - if not find(argument,"\"$") then - instring = true - end - elseif find(argument,"\"$") then - newarg[#newarg] = newarg[#newarg] .. " " .. gsub(argument,"\"$","") - instring = false - elseif instring then - newarg[#newarg] = newarg[#newarg] .. " " .. argument - else - newarg[#newarg+1] = argument - end - end - for i=1,-5,-1 do - newarg[i] = arg[i] - end - - environment.initialize_arguments(newarg) - environment.original_arguments = newarg - environment.raw_arguments = arg - - arg = { } -- prevent duplicate handling - -end - --- weird place ... depends on a not yet loaded module - -function environment.texfile(filename) - return resolvers.find_file(filename,'tex') -end - -function environment.luafile(filename) - local resolved = resolvers.find_file(filename,'tex') or "" - if resolved ~= "" then - return resolved - end - resolved = resolvers.find_file(filename,'texmfscripts') or "" - if resolved ~= "" then - return resolved - end - return resolvers.find_file(filename,'luatexlibs') or "" -end - -environment.loadedluacode = loadfile -- can be overloaded - ---~ function environment.loadedluacode(name) ---~ if os.spawn("texluac -s -o texluac.luc " .. name) == 0 then ---~ local chunk = loadstring(io.loaddata("texluac.luc")) ---~ os.remove("texluac.luc") ---~ return chunk ---~ else ---~ environment.loadedluacode = loadfile -- can be overloaded ---~ return loadfile(name) ---~ end ---~ end - -function environment.luafilechunk(filename) -- used for loading lua bytecode in the format - filename = file.replacesuffix(filename, "lua") - local fullname = environment.luafile(filename) - if fullname and fullname ~= "" then - if trace_locating then - logs.report("fileio","loading file %s", fullname) - end - return environment.loadedluacode(fullname) - else - if trace_locating then - logs.report("fileio","unknown file %s", filename) - end - return nil - end -end - --- the next ones can use the previous ones / combine - -function environment.loadluafile(filename, version) - local lucname, luaname, chunk - local basename = file.removesuffix(filename) - if basename == filename then - lucname, luaname = basename .. ".luc", basename .. ".lua" - else - lucname, luaname = nil, basename -- forced suffix - end - -- when not overloaded by explicit suffix we look for a luc file first - local fullname = (lucname and environment.luafile(lucname)) or "" - if fullname ~= "" then - if trace_locating then - logs.report("fileio","loading %s", fullname) - end - chunk = loadfile(fullname) -- this way we don't need a file exists check - end - if chunk then - assert(chunk)() - if version then - -- we check of the version number of this chunk matches - local v = version -- can be nil - if modules and modules[filename] then - v = modules[filename].version -- new method - elseif versions and versions[filename] then - v = versions[filename] -- old method - end - if v == version then - return true - else - if trace_locating then - logs.report("fileio","version mismatch for %s: lua=%s, luc=%s", filename, v, version) - end - environment.loadluafile(filename) - end - else - return true - end - end - fullname = (luaname and environment.luafile(luaname)) or "" - if fullname ~= "" then - if trace_locating then - logs.report("fileio","loading %s", fullname) - end - chunk = loadfile(fullname) -- this way we don't need a file exists check - if not chunk then - if trace_locating then - logs.report("fileio","unknown file %s", filename) - end - else - assert(chunk)() - return true - end - end - return false -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['trac-inf'] = { - version = 1.001, - comment = "companion to trac-inf.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local format = string.format - -local statusinfo, n, registered = { }, 0, { } - -statistics = statistics or { } - -statistics.enable = true -statistics.threshold = 0.05 - --- timing functions - -local clock = os.gettimeofday or os.clock - -local notimer - -function statistics.hastimer(instance) - return instance and instance.starttime -end - -function statistics.resettiming(instance) - if not instance then - notimer = { timing = 0, loadtime = 0 } - else - instance.timing, instance.loadtime = 0, 0 - end -end - -function statistics.starttiming(instance) - if not instance then - notimer = { } - instance = notimer - end - local it = instance.timing - if not it then - it = 0 - end - if it == 0 then - instance.starttime = clock() - if not instance.loadtime then - instance.loadtime = 0 - end - else ---~ logs.report("system","nested timing (%s)",tostring(instance)) - end - instance.timing = it + 1 -end - -function statistics.stoptiming(instance, report) - if not instance then - instance = notimer - end - if instance then - local it = instance.timing - if it > 1 then - instance.timing = it - 1 - else - local starttime = instance.starttime - if starttime then - local stoptime = clock() - local loadtime = stoptime - starttime - instance.stoptime = stoptime - instance.loadtime = instance.loadtime + loadtime - if report then - statistics.report("load time %0.3f",loadtime) - end - instance.timing = 0 - return loadtime - end - end - end - return 0 -end - -function statistics.elapsedtime(instance) - if not instance then - instance = notimer - end - return format("%0.3f",(instance and instance.loadtime) or 0) -end - -function statistics.elapsedindeed(instance) - if not instance then - instance = notimer - end - local t = (instance and instance.loadtime) or 0 - return t > statistics.threshold -end - -function statistics.elapsedseconds(instance,rest) -- returns nil if 0 seconds - if statistics.elapsedindeed(instance) then - return format("%s seconds %s", statistics.elapsedtime(instance),rest or "") - end -end - --- general function - -function statistics.register(tag,fnc) - if statistics.enable and type(fnc) == "function" then - local rt = registered[tag] or (#statusinfo + 1) - statusinfo[rt] = { tag, fnc } - registered[tag] = rt - if #tag > n then n = #tag end - end -end - -function statistics.show(reporter) - if statistics.enable then - if not reporter then reporter = function(tag,data,n) texio.write_nl(tag .. " " .. data) end end - -- this code will move - local register = statistics.register - register("luatex banner", function() - return string.lower(status.banner) - end) - register("control sequences", function() - return format("%s of %s", status.cs_count, status.hash_size+status.hash_extra) - end) - register("callbacks", function() - local total, indirect = status.callbacks or 0, status.indirect_callbacks or 0 - return format("direct: %s, indirect: %s, total: %s", total-indirect, indirect, total) - end) - register("current memory usage", statistics.memused) - register("runtime",statistics.runtime) --- -- - for i=1,#statusinfo do - local s = statusinfo[i] - local r = s[2]() - if r then - reporter(s[1],r,n) - end - end - texio.write_nl("") -- final newline - statistics.enable = false - end -end - -function statistics.show_job_stat(tag,data,n) - texio.write_nl(format("%-15s: %s - %s","mkiv lua stats",tag:rpadd(n," "),data)) -end - -function statistics.memused() -- no math.round yet -) - local round = math.round or math.floor - return format("%s MB (ctx: %s MB)",round(collectgarbage("count")/1000), round(status.luastate_bytes/1000000)) -end - -if statistics.runtime then - -- already loaded and set -elseif luatex and luatex.starttime then - statistics.starttime = luatex.starttime - statistics.loadtime = 0 - statistics.timing = 0 -else - statistics.starttiming(statistics) -end - -function statistics.runtime() - statistics.stoptiming(statistics) - return statistics.formatruntime(statistics.elapsedtime(statistics)) -end - -function statistics.formatruntime(runtime) - return format("%s seconds", statistics.elapsedtime(statistics)) -end - -function statistics.timed(action,report) - local timer = { } - report = report or logs.simple - statistics.starttiming(timer) - action() - statistics.stoptiming(timer) - report("total runtime: %s",statistics.elapsedtime(timer)) -end - --- where, not really the best spot for this: - -commands = commands or { } - -local timer - -function commands.resettimer() - statistics.resettiming(timer) - statistics.starttiming(timer) -end - -function commands.elapsedtime() - statistics.stoptiming(timer) - tex.sprint(statistics.elapsedtime(timer)) -end - -commands.resettimer() - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['trac-log'] = { - version = 1.001, - comment = "companion to trac-log.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- this is old code that needs an overhaul - ---~ io.stdout:setvbuf("no") ---~ io.stderr:setvbuf("no") - -local write_nl, write = texio.write_nl or print, texio.write or io.write -local format, gmatch = string.format, string.gmatch -local texcount = tex and tex.count - -if texlua then - write_nl = print - write = io.write -end - ---[[ldx-- -

This is a prelude to a more extensive logging module. For the sake -of parsing log files, in addition to the standard logging we will -provide an structured file. Actually, any logging that -is hooked into callbacks will be \XML\ by default.

---ldx]]-- - -logs = logs or { } -logs.xml = logs.xml or { } -logs.tex = logs.tex or { } - ---[[ldx-- -

This looks pretty ugly but we need to speed things up a bit.

---ldx]]-- - -logs.moreinfo = [[ -more information about ConTeXt and the tools that come with it can be found at: - -maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context -webpage : http://www.pragma-ade.nl / http://tex.aanhet.net -wiki : http://contextgarden.net -]] - -logs.levels = { - ['error'] = 1, - ['warning'] = 2, - ['info'] = 3, - ['debug'] = 4, -} - -logs.functions = { - 'report', 'start', 'stop', 'push', 'pop', 'line', 'direct', - 'start_run', 'stop_run', - 'start_page_number', 'stop_page_number', - 'report_output_pages', 'report_output_log', - 'report_tex_stat', 'report_job_stat', - 'show_open', 'show_close', 'show_load', -} - -logs.tracers = { -} - -logs.level = 0 -logs.mode = string.lower((os.getenv("MTX.LOG.MODE") or os.getenv("MTX_LOG_MODE") or "tex")) - -function logs.set_level(level) - logs.level = logs.levels[level] or level -end - -function logs.set_method(method) - for _, v in next, logs.functions do - logs[v] = logs[method][v] or function() end - end -end - --- tex logging - -function logs.tex.report(category,fmt,...) -- new - if fmt then - write_nl(category .. " | " .. format(fmt,...)) - else - write_nl(category .. " |") - end -end - -function logs.tex.line(fmt,...) -- new - if fmt then - write_nl(format(fmt,...)) - else - write_nl("") - end -end - ---~ function logs.tex.start_page_number() ---~ local real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno ---~ if real > 0 then ---~ if user > 0 then ---~ if sub > 0 then ---~ write(format("[%s.%s.%s",real,user,sub)) ---~ else ---~ write(format("[%s.%s",real,user)) ---~ end ---~ else ---~ write(format("[%s",real)) ---~ end ---~ else ---~ write("[-") ---~ end ---~ end - ---~ function logs.tex.stop_page_number() ---~ write("]") ---~ end - -local real, user, sub - -function logs.tex.start_page_number() - real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno -end - -function logs.tex.stop_page_number() - if real > 0 then - if user > 0 then - if sub > 0 then - logs.report("pages", "flushing realpage %s, userpage %s, subpage %s",real,user,sub) - else - logs.report("pages", "flushing realpage %s, userpage %s",real,user) - end - else - logs.report("pages", "flushing realpage %s",real) - end - else - logs.report("pages", "flushing page") - end - io.flush() -end - -logs.tex.report_job_stat = statistics.show_job_stat - --- xml logging - -function logs.xml.report(category,fmt,...) -- new - if fmt then - write_nl(format("%s",category,format(fmt,...))) - else - write_nl(format("",category)) - end -end -function logs.xml.line(fmt,...) -- new - if fmt then - write_nl(format("%s",format(fmt,...))) - else - write_nl("") - end -end - -function logs.xml.start() if logs.level > 0 then tw("<%s>" ) end end -function logs.xml.stop () if logs.level > 0 then tw("") end end -function logs.xml.push () if logs.level > 0 then tw("" ) end end - -function logs.xml.start_run() - write_nl("") - write_nl("") -- xmlns='www.pragma-ade.com/luatex/schemas/context-job.rng' - write_nl("") -end - -function logs.xml.stop_run() - write_nl("") -end - -function logs.xml.start_page_number() - write_nl(format("

") - write_nl("") -end - -function logs.xml.report_output_pages(p,b) - write_nl(format("", p)) - write_nl(format("", b)) - write_nl("") -end - -function logs.xml.report_output_log() -end - -function logs.xml.report_tex_stat(k,v) - texiowrite_nl("log",""..tostring(v).."") -end - -local level = 0 - -function logs.xml.show_open(name) - level = level + 1 - texiowrite_nl(format("",level,name)) -end - -function logs.xml.show_close(name) - texiowrite(" ") - level = level - 1 -end - -function logs.xml.show_load(name) - texiowrite_nl(format("",level+1,name)) -end - --- - -local name, banner = 'report', 'context' - -local function report(category,fmt,...) - if fmt then - write_nl(format("%s | %s: %s",name,category,format(fmt,...))) - elseif category then - write_nl(format("%s | %s",name,category)) - else - write_nl(format("%s |",name)) - end -end - -local function simple(fmt,...) - if fmt then - write_nl(format("%s | %s",name,format(fmt,...))) - else - write_nl(format("%s |",name)) - end -end - -function logs.setprogram(_name_,_banner_,_verbose_) - name, banner = _name_, _banner_ - if _verbose_ then - trackers.enable("resolvers.locating") - end - logs.set_method("tex") - logs.report = report -- also used in libraries - logs.simple = simple -- only used in scripts ! - if utils then - utils.report = simple - end - logs.verbose = _verbose_ -end - -function logs.setverbose(what) - if what then - trackers.enable("resolvers.locating") - else - trackers.disable("resolvers.locating") - end - logs.verbose = what or false -end - -function logs.extendbanner(_banner_,_verbose_) - banner = banner .. " | ".. _banner_ - if _verbose_ ~= nil then - logs.setverbose(what) - end -end - -logs.verbose = false -logs.report = logs.tex.report -logs.simple = logs.tex.report - -function logs.reportlines(str) -- todo: - for line in gmatch(str,"(.-)[\n\r]") do - logs.report(line) - end -end - -function logs.reportline() -- for scripts too - logs.report() -end - -logs.simpleline = logs.reportline - -function logs.reportbanner() -- for scripts too - logs.report(banner) -end - -function logs.help(message,option) - logs.reportbanner() - logs.reportline() - logs.reportlines(message) - local moreinfo = logs.moreinfo or "" - if moreinfo ~= "" and option ~= "nomoreinfo" then - logs.reportline() - logs.reportlines(moreinfo) - end -end - -logs.set_level('error') -logs.set_method('tex') - -function logs.system(whereto,process,jobname,category,...) - for i=1,10 do - local f = io.open(whereto,"a") - if f then - f:write(format("%s %s => %s => %s => %s\r",os.date("%d/%m/%y %H:%m:%S"),process,jobname,category,format(...))) - f:close() - break - else - sleep(0.1) - end - end -end - ---~ local syslogname = "oeps.xxx" ---~ ---~ for i=1,10 do ---~ logs.system(syslogname,"context","test","fonts","font %s recached due to newer version (%s)","blabla","123") ---~ end - -function logs.fatal(where,...) - logs.report(where,"fatal error: %s, aborting now",format(...)) - os.exit() -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['data-inp'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files", -} - --- After a few years using the code the large luat-inp.lua file --- has been split up a bit. In the process some functionality was --- dropped: --- --- * support for reading lsr files --- * selective scanning (subtrees) --- * some public auxiliary functions were made private --- --- TODO: os.getenv -> os.env[] --- TODO: instances.[hashes,cnffiles,configurations,522] --- TODO: check escaping in find etc, too much, too slow - --- This lib is multi-purpose and can be loaded again later on so that --- additional functionality becomes available. We will split thislogs.report("fileio", --- module in components once we're done with prototyping. This is the --- first code I wrote for LuaTeX, so it needs some cleanup. Before changing --- something in this module one can best check with Taco or Hans first; there --- is some nasty trickery going on that relates to traditional kpse support. - --- To be considered: hash key lowercase, first entry in table filename --- (any case), rest paths (so no need for optimization). Or maybe a --- separate table that matches lowercase names to mixed case when --- present. In that case the lower() cases can go away. I will do that --- only when we run into problems with names ... well ... Iwona-Regular. - --- Beware, loading and saving is overloaded in luat-tmp! - -local format, gsub, find, lower, upper, match, gmatch = string.format, string.gsub, string.find, string.lower, string.upper, string.match, string.gmatch -local concat, insert, sortedkeys = table.concat, table.insert, table.sortedkeys -local next, type = next, type -local lpegmatch = lpeg.match - -local trace_locating, trace_detail, trace_expansions = false, false, false - -trackers.register("resolvers.locating", function(v) trace_locating = v end) -trackers.register("resolvers.details", function(v) trace_detail = v end) -trackers.register("resolvers.expansions", function(v) trace_expansions = v end) -- todo - -if not resolvers then - resolvers = { - suffixes = { }, - formats = { }, - dangerous = { }, - suffixmap = { }, - alternatives = { }, - locators = { }, -- locate databases - hashers = { }, -- load databases - generators = { }, -- generate databases - } -end - -local resolvers = resolvers - -resolvers.locators .notfound = { nil } -resolvers.hashers .notfound = { nil } -resolvers.generators.notfound = { nil } - -resolvers.cacheversion = '1.0.1' -resolvers.cnfname = 'texmf.cnf' -resolvers.luaname = 'texmfcnf.lua' -resolvers.homedir = os.env[os.type == "windows" and 'USERPROFILE'] or os.env['HOME'] or '~' -resolvers.cnfdefault = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c}' - -local dummy_path_expr = "^!*unset/*$" - -local formats = resolvers.formats -local suffixes = resolvers.suffixes -local dangerous = resolvers.dangerous -local suffixmap = resolvers.suffixmap -local alternatives = resolvers.alternatives - -formats['afm'] = 'AFMFONTS' suffixes['afm'] = { 'afm' } -formats['enc'] = 'ENCFONTS' suffixes['enc'] = { 'enc' } -formats['fmt'] = 'TEXFORMATS' suffixes['fmt'] = { 'fmt' } -formats['map'] = 'TEXFONTMAPS' suffixes['map'] = { 'map' } -formats['mp'] = 'MPINPUTS' suffixes['mp'] = { 'mp' } -formats['ocp'] = 'OCPINPUTS' suffixes['ocp'] = { 'ocp' } -formats['ofm'] = 'OFMFONTS' suffixes['ofm'] = { 'ofm', 'tfm' } -formats['otf'] = 'OPENTYPEFONTS' suffixes['otf'] = { 'otf' } -- 'ttf' -formats['opl'] = 'OPLFONTS' suffixes['opl'] = { 'opl' } -formats['otp'] = 'OTPINPUTS' suffixes['otp'] = { 'otp' } -formats['ovf'] = 'OVFFONTS' suffixes['ovf'] = { 'ovf', 'vf' } -formats['ovp'] = 'OVPFONTS' suffixes['ovp'] = { 'ovp' } -formats['tex'] = 'TEXINPUTS' suffixes['tex'] = { 'tex' } -formats['tfm'] = 'TFMFONTS' suffixes['tfm'] = { 'tfm' } -formats['ttf'] = 'TTFONTS' suffixes['ttf'] = { 'ttf', 'ttc', 'dfont' } -formats['pfb'] = 'T1FONTS' suffixes['pfb'] = { 'pfb', 'pfa' } -formats['vf'] = 'VFFONTS' suffixes['vf'] = { 'vf' } - -formats['fea'] = 'FONTFEATURES' suffixes['fea'] = { 'fea' } -formats['cid'] = 'FONTCIDMAPS' suffixes['cid'] = { 'cid', 'cidmap' } - -formats ['texmfscripts'] = 'TEXMFSCRIPTS' -- new -suffixes['texmfscripts'] = { 'rb', 'pl', 'py' } -- 'lua' - -formats ['lua'] = 'LUAINPUTS' -- new -suffixes['lua'] = { 'lua', 'luc', 'tma', 'tmc' } - --- backward compatible ones - -alternatives['map files'] = 'map' -alternatives['enc files'] = 'enc' -alternatives['cid maps'] = 'cid' -- great, why no cid files -alternatives['font feature files'] = 'fea' -- and fea files here -alternatives['opentype fonts'] = 'otf' -alternatives['truetype fonts'] = 'ttf' -alternatives['truetype collections'] = 'ttc' -alternatives['truetype dictionary'] = 'dfont' -alternatives['type1 fonts'] = 'pfb' - --- obscure ones - -formats ['misc fonts'] = '' -suffixes['misc fonts'] = { } - -formats ['sfd'] = 'SFDFONTS' -suffixes ['sfd'] = { 'sfd' } -alternatives['subfont definition files'] = 'sfd' - --- lib paths - -formats ['lib'] = 'CLUAINPUTS' -- new (needs checking) -suffixes['lib'] = (os.libsuffix and { os.libsuffix }) or { 'dll', 'so' } - --- In practice we will work within one tds tree, but i want to keep --- the option open to build tools that look at multiple trees, which is --- why we keep the tree specific data in a table. We used to pass the --- instance but for practical pusposes we now avoid this and use a --- instance variable. - --- here we catch a few new thingies (todo: add these paths to context.tmf) --- --- FONTFEATURES = .;$TEXMF/fonts/fea// --- FONTCIDMAPS = .;$TEXMF/fonts/cid// - --- we always have one instance active - -resolvers.instance = resolvers.instance or nil -- the current one (slow access) -local instance = resolvers.instance or nil -- the current one (fast access) - -function resolvers.newinstance() - - -- store once, freeze and faster (once reset we can best use - -- instance.environment) maybe better have a register suffix - -- function - - for k, v in next, suffixes do - for i=1,#v do - local vi = v[i] - if vi then - suffixmap[vi] = k - end - end - end - - -- because vf searching is somewhat dangerous, we want to prevent - -- too liberal searching esp because we do a lookup on the current - -- path anyway; only tex (or any) is safe - - for k, v in next, formats do - dangerous[k] = true - end - dangerous.tex = nil - - -- the instance - - local newinstance = { - rootpath = '', - treepath = '', - progname = 'context', - engine = 'luatex', - format = '', - environment = { }, - variables = { }, - expansions = { }, - files = { }, - remap = { }, - configuration = { }, - setup = { }, - order = { }, - found = { }, - foundintrees = { }, - kpsevars = { }, - hashes = { }, - cnffiles = { }, - luafiles = { }, - lists = { }, - remember = true, - diskcache = true, - renewcache = false, - scandisk = true, - cachepath = nil, - loaderror = false, - sortdata = false, - savelists = true, - cleanuppaths = true, - allresults = false, - pattern = nil, -- lists - data = { }, -- only for loading - force_suffixes = true, - fakepaths = { }, - } - - local ne = newinstance.environment - - for k,v in next, os.env do - ne[k] = resolvers.bare_variable(v) - end - - return newinstance - -end - -function resolvers.setinstance(someinstance) - instance = someinstance - resolvers.instance = someinstance - return someinstance -end - -function resolvers.reset() - return resolvers.setinstance(resolvers.newinstance()) -end - -local function reset_hashes() - instance.lists = { } - instance.found = { } -end - -local function check_configuration() -- not yet ok, no time for debugging now - if os.env["OSFONTDIR"] then - -- ok - elseif os.type == "windows" then - os.setenv("OSFONTDIR","c:/windows/fonts//") - elseif os.type == "macosx" then - os.setenv("OSFONTDIR","$HOME/Library/Fonts//;/Library/Fonts//;/System/Library/Fonts//") - end -end - -function resolvers.bare_variable(str) -- assumes str is a string - return (gsub(str,"\s*([\"\']?)(.+)%1\s*", "%2")) -end - -function resolvers.settrace(n) -- no longer number but: 'locating' or 'detail' - if n then - trackers.disable("resolvers.*") - trackers.enable("resolvers."..n) - end -end - -resolvers.settrace(os.getenv("MTX_INPUT_TRACE")) - -function resolvers.osenv(key) - local ie = instance.environment - local value = ie[key] - if value == nil then - -- local e = os.getenv(key) - local e = os.env[key] - if e == nil then - -- value = "" -- false - else - value = resolvers.bare_variable(e) - end - ie[key] = value - end - return value or "" -end - -function resolvers.env(key) - return instance.environment[key] or resolvers.osenv(key) -end - --- - -local function expand_vars(lst) -- simple vars - local variables, env = instance.variables, resolvers.env - local function resolve(a) - return variables[a] or env(a) - end - for k=1,#lst do - lst[k] = gsub(lst[k],"%$([%a%d%_%-]+)",resolve) - end -end - -local function expanded_var(var) -- simple vars - local function resolve(a) - return instance.variables[a] or resolvers.env(a) - end - return (gsub(var,"%$([%a%d%_%-]+)",resolve)) -end - -local function entry(entries,name) - if name and (name ~= "") then - name = gsub(name,'%$','') - local result = entries[name..'.'..instance.progname] or entries[name] - if result then - return result - else - result = resolvers.env(name) - if result then - instance.variables[name] = result - resolvers.expand_variables() - return instance.expansions[name] or "" - end - end - end - return "" -end - -local function is_entry(entries,name) - if name and name ~= "" then - name = gsub(name,'%$','') - return (entries[name..'.'..instance.progname] or entries[name]) ~= nil - else - return false - end -end - --- {a,b,c,d} --- a,b,c/{p,q,r},d --- a,b,c/{p,q,r}/d/{x,y,z}// --- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} --- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} --- a{b,c}{d,e}f --- {a,b,c,d} --- {a,b,c/{p,q,r},d} --- {a,b,c/{p,q,r}/d/{x,y,z}//} --- {a,b,c/{p,q/{x,y,z}},d/{p,q,r}} --- {a,b,c/{p,q/{x,y,z},w}v,d/{p,q,r}} --- {$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c} - --- this one is better and faster, but it took me a while to realize --- that this kind of replacement is cleaner than messy parsing and --- fuzzy concatenating we can probably gain a bit with selectively --- applying lpeg, but experiments with lpeg parsing this proved not to --- work that well; the parsing is ok, but dealing with the resulting --- table is a pain because we need to work inside-out recursively - -local function do_first(a,b) - local t = { } - for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end - return "{" .. concat(t,",") .. "}" -end - -local function do_second(a,b) - local t = { } - for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end - return "{" .. concat(t,",") .. "}" -end - -local function do_both(a,b) - local t = { } - for sa in gmatch(a,"[^,]+") do - for sb in gmatch(b,"[^,]+") do - t[#t+1] = sa .. sb - end - end - return "{" .. concat(t,",") .. "}" -end - -local function do_three(a,b,c) - return a .. b.. c -end - -local function splitpathexpr(str, t, validate) - -- no need for further optimization as it is only called a - -- few times, we can use lpeg for the sub - if trace_expansions then - logs.report("fileio","expanding variable '%s'",str) - end - t = t or { } - str = gsub(str,",}",",@}") - str = gsub(str,"{,","{@,") - -- str = "@" .. str .. "@" - local ok, done - while true do - done = false - while true do - str, ok = gsub(str,"([^{},]+){([^{}]+)}",do_first) - if ok > 0 then done = true else break end - end - while true do - str, ok = gsub(str,"{([^{}]+)}([^{},]+)",do_second) - if ok > 0 then done = true else break end - end - while true do - str, ok = gsub(str,"{([^{}]+)}{([^{}]+)}",do_both) - if ok > 0 then done = true else break end - end - str, ok = gsub(str,"({[^{}]*){([^{}]+)}([^{}]*})",do_three) - if ok > 0 then done = true end - if not done then break end - end - str = gsub(str,"[{}]", "") - str = gsub(str,"@","") - if validate then - for s in gmatch(str,"[^,]+") do - s = validate(s) - if s then t[#t+1] = s end - end - else - for s in gmatch(str,"[^,]+") do - t[#t+1] = s - end - end - if trace_expansions then - for k=1,#t do - logs.report("fileio","% 4i: %s",k,t[k]) - end - end - return t -end - -local function expanded_path_from_list(pathlist) -- maybe not a list, just a path - -- a previous version fed back into pathlist - local newlist, ok = { }, false - for k=1,#pathlist do - if find(pathlist[k],"[{}]") then - ok = true - break - end - end - if ok then - local function validate(s) - s = file.collapse_path(s) - return s ~= "" and not find(s,dummy_path_expr) and s - end - for k=1,#pathlist do - splitpathexpr(pathlist[k],newlist,validate) - end - else - for k=1,#pathlist do - for p in gmatch(pathlist[k],"([^,]+)") do - p = file.collapse_path(p) - if p ~= "" then newlist[#newlist+1] = p end - end - end - end - return newlist -end - --- we follow a rather traditional approach: --- --- (1) texmf.cnf given in TEXMFCNF --- (2) texmf.cnf searched in default variable --- --- also we now follow the stupid route: if not set then just assume *one* --- cnf file under texmf (i.e. distribution) - -local args = environment and environment.original_arguments or arg -- this needs a cleanup - -resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex" -resolvers.ownbin = gsub(resolvers.ownbin,"\\","/") - -function resolvers.getownpath() - local ownpath = resolvers.ownpath or os.selfdir - if not ownpath or ownpath == "" or ownpath == "unset" then - ownpath = args[-1] or arg[-1] - ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/")) - if not ownpath or ownpath == "" then - ownpath = args[-0] or arg[-0] - ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/")) - end - local binary = resolvers.ownbin - if not ownpath or ownpath == "" then - ownpath = ownpath and file.dirname(binary) - end - if not ownpath or ownpath == "" then - if os.binsuffix ~= "" then - binary = file.replacesuffix(binary,os.binsuffix) - end - for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do - local b = file.join(p,binary) - if lfs.isfile(b) then - -- we assume that after changing to the path the currentdir function - -- resolves to the real location and use this side effect here; this - -- trick is needed because on the mac installations use symlinks in the - -- path instead of real locations - local olddir = lfs.currentdir() - if lfs.chdir(p) then - local pp = lfs.currentdir() - if trace_locating and p ~= pp then - logs.report("fileio","following symlink '%s' to '%s'",p,pp) - end - ownpath = pp - lfs.chdir(olddir) - else - if trace_locating then - logs.report("fileio","unable to check path '%s'",p) - end - ownpath = p - end - break - end - end - end - if not ownpath or ownpath == "" then - ownpath = "." - logs.report("fileio","forcing fallback ownpath .") - elseif trace_locating then - logs.report("fileio","using ownpath '%s'",ownpath) - end - end - resolvers.ownpath = ownpath - function resolvers.getownpath() - return resolvers.ownpath - end - return ownpath -end - -local own_places = { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF" } - -local function identify_own() - local ownpath = resolvers.getownpath() or dir.current() - local ie = instance.environment - if ownpath then - if resolvers.env('SELFAUTOLOC') == "" then os.env['SELFAUTOLOC'] = file.collapse_path(ownpath) end - if resolvers.env('SELFAUTODIR') == "" then os.env['SELFAUTODIR'] = file.collapse_path(ownpath .. "/..") end - if resolvers.env('SELFAUTOPARENT') == "" then os.env['SELFAUTOPARENT'] = file.collapse_path(ownpath .. "/../..") end - else - logs.report("fileio","error: unable to locate ownpath") - os.exit() - end - if resolvers.env('TEXMFCNF') == "" then os.env['TEXMFCNF'] = resolvers.cnfdefault end - if resolvers.env('TEXOS') == "" then os.env['TEXOS'] = resolvers.env('SELFAUTODIR') end - if resolvers.env('TEXROOT') == "" then os.env['TEXROOT'] = resolvers.env('SELFAUTOPARENT') end - if trace_locating then - for i=1,#own_places do - local v = own_places[i] - logs.report("fileio","variable '%s' set to '%s'",v,resolvers.env(v) or "unknown") - end - end - identify_own = function() end -end - -function resolvers.identify_cnf() - if #instance.cnffiles == 0 then - -- fallback - identify_own() - -- the real search - resolvers.expand_variables() - local t = resolvers.split_path(resolvers.env('TEXMFCNF')) - t = expanded_path_from_list(t) - expand_vars(t) -- redundant - local function locate(filename,list) - for i=1,#t do - local ti = t[i] - local texmfcnf = file.collapse_path(file.join(ti,filename)) - if lfs.isfile(texmfcnf) then - list[#list+1] = texmfcnf - end - end - end - locate(resolvers.luaname,instance.luafiles) - locate(resolvers.cnfname,instance.cnffiles) - end -end - -local function load_cnf_file(fname) - fname = resolvers.clean_path(fname) - local lname = file.replacesuffix(fname,'lua') - if lfs.isfile(lname) then - local dname = file.dirname(fname) -- fname ? - if not instance.configuration[dname] then - resolvers.load_data(dname,'configuration',lname and file.basename(lname)) - instance.order[#instance.order+1] = instance.configuration[dname] - end - else - f = io.open(fname) - if f then - if trace_locating then - logs.report("fileio","loading configuration file %s", fname) - end - local line, data, n, k, v - local dname = file.dirname(fname) - if not instance.configuration[dname] then - instance.configuration[dname] = { } - instance.order[#instance.order+1] = instance.configuration[dname] - end - local data = instance.configuration[dname] - while true do - local line, n = f:read(), 0 - if line then - while true do -- join lines - line, n = gsub(line,"\\%s*$", "") - if n > 0 then - line = line .. f:read() - else - break - end - end - if not find(line,"^[%%#]") then - local l = gsub(line,"%s*%%.*$","") - local k, v = match(l,"%s*(.-)%s*=%s*(.-)%s*$") - if k and v and not data[k] then - v = gsub(v,"[%%#].*",'') - data[k] = gsub(v,"~","$HOME") - instance.kpsevars[k] = true - end - end - else - break - end - end - f:close() - elseif trace_locating then - logs.report("fileio","skipping configuration file '%s'", fname) - end - end -end - -local function collapse_cnf_data() -- potential optimization: pass start index (setup and configuration are shared) - local order = instance.order - for i=1,#order do - local c = order[i] - for k,v in next, c do - if not instance.variables[k] then - if instance.environment[k] then - instance.variables[k] = instance.environment[k] - else - instance.kpsevars[k] = true - instance.variables[k] = resolvers.bare_variable(v) - end - end - end - end -end - -function resolvers.load_cnf() - local function loadoldconfigdata() - local cnffiles = instance.cnffiles - for i=1,#cnffiles do - load_cnf_file(cnffiles[i]) - end - end - -- instance.cnffiles contain complete names now ! - -- we still use a funny mix of cnf and new but soon - -- we will switch to lua exclusively as we only use - -- the file to collect the tree roots - if #instance.cnffiles == 0 then - if trace_locating then - logs.report("fileio","no cnf files found (TEXMFCNF may not be set/known)") - end - else - local cnffiles = instance.cnffiles - instance.rootpath = cnffiles[1] - for k=1,#cnffiles do - instance.cnffiles[k] = file.collapse_path(cnffiles[k]) - end - for i=1,3 do - instance.rootpath = file.dirname(instance.rootpath) - end - instance.rootpath = file.collapse_path(instance.rootpath) - if instance.diskcache and not instance.renewcache then - resolvers.loadoldconfig(instance.cnffiles) - if instance.loaderror then - loadoldconfigdata() - resolvers.saveoldconfig() - end - else - loadoldconfigdata() - if instance.renewcache then - resolvers.saveoldconfig() - end - end - collapse_cnf_data() - end - check_configuration() -end - -function resolvers.load_lua() - if #instance.luafiles == 0 then - -- yet harmless - else - instance.rootpath = instance.luafiles[1] - local luafiles = instance.luafiles - for k=1,#luafiles do - instance.luafiles[k] = file.collapse_path(luafiles[k]) - end - for i=1,3 do - instance.rootpath = file.dirname(instance.rootpath) - end - instance.rootpath = file.collapse_path(instance.rootpath) - resolvers.loadnewconfig() - collapse_cnf_data() - end - check_configuration() -end - --- database loading - -function resolvers.load_hash() - resolvers.locatelists() - if instance.diskcache and not instance.renewcache then - resolvers.loadfiles() - if instance.loaderror then - resolvers.loadlists() - resolvers.savefiles() - end - else - resolvers.loadlists() - if instance.renewcache then - resolvers.savefiles() - end - end -end - -function resolvers.append_hash(type,tag,name) - if trace_locating then - logs.report("fileio","hash '%s' appended",tag) - end - insert(instance.hashes, { ['type']=type, ['tag']=tag, ['name']=name } ) -end - -function resolvers.prepend_hash(type,tag,name) - if trace_locating then - logs.report("fileio","hash '%s' prepended",tag) - end - insert(instance.hashes, 1, { ['type']=type, ['tag']=tag, ['name']=name } ) -end - -function resolvers.extend_texmf_var(specification) -- crap, we could better prepend the hash --- local t = resolvers.expanded_path_list('TEXMF') -- full expansion - local t = resolvers.split_path(resolvers.env('TEXMF')) - insert(t,1,specification) - local newspec = concat(t,";") - if instance.environment["TEXMF"] then - instance.environment["TEXMF"] = newspec - elseif instance.variables["TEXMF"] then - instance.variables["TEXMF"] = newspec - else - -- weird - end - resolvers.expand_variables() - reset_hashes() -end - --- locators - -function resolvers.locatelists() - local texmfpaths = resolvers.clean_path_list('TEXMF') - for i=1,#texmfpaths do - local path = texmfpaths[i] - if trace_locating then - logs.report("fileio","locating list of '%s'",path) - end - resolvers.locatedatabase(file.collapse_path(path)) - end -end - -function resolvers.locatedatabase(specification) - return resolvers.methodhandler('locators', specification) -end - -function resolvers.locators.tex(specification) - if specification and specification ~= '' and lfs.isdir(specification) then - if trace_locating then - logs.report("fileio","tex locator '%s' found",specification) - end - resolvers.append_hash('file',specification,filename) - elseif trace_locating then - logs.report("fileio","tex locator '%s' not found",specification) - end -end - --- hashers - -function resolvers.hashdatabase(tag,name) - return resolvers.methodhandler('hashers',tag,name) -end - -function resolvers.loadfiles() - instance.loaderror = false - instance.files = { } - if not instance.renewcache then - local hashes = instance.hashes - for k=1,#hashes do - local hash = hashes[k] - resolvers.hashdatabase(hash.tag,hash.name) - if instance.loaderror then break end - end - end -end - -function resolvers.hashers.tex(tag,name) - resolvers.load_data(tag,'files') -end - --- generators: - -function resolvers.loadlists() - local hashes = instance.hashes - for i=1,#hashes do - resolvers.generatedatabase(hashes[i].tag) - end -end - -function resolvers.generatedatabase(specification) - return resolvers.methodhandler('generators', specification) -end - --- starting with . or .. etc or funny char - -local weird = lpeg.P(".")^1 + lpeg.anywhere(lpeg.S("~`!#$%^&*()={}[]:;\"\'||<>,?\n\r\t")) - ---~ local l_forbidden = lpeg.S("~`!#$%^&*()={}[]:;\"\'||\\/<>,?\n\r\t") ---~ local l_confusing = lpeg.P(" ") ---~ local l_character = lpeg.patterns.utf8 ---~ local l_dangerous = lpeg.P(".") - ---~ local l_normal = (l_character - l_forbidden - l_confusing - l_dangerous) * (l_character - l_forbidden - l_confusing^2)^0 * lpeg.P(-1) ---~ ----- l_normal = l_normal * lpeg.Cc(true) + lpeg.Cc(false) - ---~ local function test(str) ---~ print(str,lpeg.match(l_normal,str)) ---~ end ---~ test("ヒラギノ明朝 Pro W3") ---~ test("..ヒラギノ明朝 Pro W3") ---~ test(":ヒラギノ明朝 Pro W3;") ---~ test("ヒラギノ明朝 /Pro W3;") ---~ test("ヒラギノ明朝 Pro W3") - -function resolvers.generators.tex(specification) - local tag = specification - if trace_locating then - logs.report("fileio","scanning path '%s'",specification) - end - instance.files[tag] = { } - local files = instance.files[tag] - local n, m, r = 0, 0, 0 - local spec = specification .. '/' - local attributes = lfs.attributes - local directory = lfs.dir - local function action(path) - local full - if path then - full = spec .. path .. '/' - else - full = spec - end - for name in directory(full) do - if not lpegmatch(weird,name) then - -- if lpegmatch(l_normal,name) then - local mode = attributes(full..name,'mode') - if mode == 'file' then - if path then - n = n + 1 - local f = files[name] - if f then - if type(f) == 'string' then - files[name] = { f, path } - else - f[#f+1] = path - end - else -- probably unique anyway - files[name] = path - local lower = lower(name) - if name ~= lower then - files["remap:"..lower] = name - r = r + 1 - end - end - end - elseif mode == 'directory' then - m = m + 1 - if path then - action(path..'/'..name) - else - action(name) - end - end - end - end - end - action() - if trace_locating then - logs.report("fileio","%s files found on %s directories with %s uppercase remappings",n,m,r) - end -end - --- savers, todo - -function resolvers.savefiles() - resolvers.save_data('files') -end - --- A config (optionally) has the paths split in tables. Internally --- we join them and split them after the expansion has taken place. This --- is more convenient. - ---~ local checkedsplit = string.checkedsplit - -local cache = { } - -local splitter = lpeg.Ct(lpeg.splitat(lpeg.S(os.type == "windows" and ";" or ":;"))) - -local function split_kpse_path(str) -- beware, this can be either a path or a {specification} - local found = cache[str] - if not found then - if str == "" then - found = { } - else - str = gsub(str,"\\","/") ---~ local split = (find(str,";") and checkedsplit(str,";")) or checkedsplit(str,io.pathseparator) -local split = lpegmatch(splitter,str) - found = { } - for i=1,#split do - local s = split[i] - if not find(s,"^{*unset}*") then - found[#found+1] = s - end - end - if trace_expansions then - logs.report("fileio","splitting path specification '%s'",str) - for k=1,#found do - logs.report("fileio","% 4i: %s",k,found[k]) - end - end - cache[str] = found - end - end - return found -end - -resolvers.split_kpse_path = split_kpse_path - -function resolvers.splitconfig() - for i=1,#instance do - local c = instance[i] - for k,v in next, c do - if type(v) == 'string' then - local t = split_kpse_path(v) - if #t > 1 then - c[k] = t - end - end - end - end -end - -function resolvers.joinconfig() - local order = instance.order - for i=1,#order do - local c = order[i] - for k,v in next, c do -- indexed? - if type(v) == 'table' then - c[k] = file.join_path(v) - end - end - end -end - -function resolvers.split_path(str) - if type(str) == 'table' then - return str - else - return split_kpse_path(str) - end -end - -function resolvers.join_path(str) - if type(str) == 'table' then - return file.join_path(str) - else - return str - end -end - -function resolvers.splitexpansions() - local ie = instance.expansions - for k,v in next, ie do - local t, h, p = { }, { }, split_kpse_path(v) - for kk=1,#p do - local vv = p[kk] - if vv ~= "" and not h[vv] then - t[#t+1] = vv - h[vv] = true - end - end - if #t > 1 then - ie[k] = t - else - ie[k] = t[1] - end - end -end - --- end of split/join code - -function resolvers.saveoldconfig() - resolvers.splitconfig() - resolvers.save_data('configuration') - resolvers.joinconfig() -end - -resolvers.configbanner = [[ --- This is a Luatex configuration file created by 'luatools.lua' or --- 'luatex.exe' directly. For comment, suggestions and questions you can --- contact the ConTeXt Development Team. This configuration file is --- not copyrighted. [HH & TH] -]] - -function resolvers.serialize(files) - -- This version is somewhat optimized for the kind of - -- tables that we deal with, so it's much faster than - -- the generic serializer. This makes sense because - -- luatools and mtxtools are called frequently. Okay, - -- we pay a small price for properly tabbed tables. - local t = { } - local function dump(k,v,m) -- could be moved inline - if type(v) == 'string' then - return m .. "['" .. k .. "']='" .. v .. "'," - elseif #v == 1 then - return m .. "['" .. k .. "']='" .. v[1] .. "'," - else - return m .. "['" .. k .. "']={'" .. concat(v,"','").. "'}," - end - end - t[#t+1] = "return {" - if instance.sortdata then - local sortedfiles = sortedkeys(files) - for i=1,#sortedfiles do - local k = sortedfiles[i] - local fk = files[k] - if type(fk) == 'table' then - t[#t+1] = "\t['" .. k .. "']={" - local sortedfk = sortedkeys(fk) - for j=1,#sortedfk do - local kk = sortedfk[j] - t[#t+1] = dump(kk,fk[kk],"\t\t") - end - t[#t+1] = "\t}," - else - t[#t+1] = dump(k,fk,"\t") - end - end - else - for k, v in next, files do - if type(v) == 'table' then - t[#t+1] = "\t['" .. k .. "']={" - for kk,vv in next, v do - t[#t+1] = dump(kk,vv,"\t\t") - end - t[#t+1] = "\t}," - else - t[#t+1] = dump(k,v,"\t") - end - end - end - t[#t+1] = "}" - return concat(t,"\n") -end - -local data_state = { } - -function resolvers.data_state() - return data_state or { } -end - -function resolvers.save_data(dataname, makename) -- untested without cache overload - for cachename, files in next, instance[dataname] do - local name = (makename or file.join)(cachename,dataname) - local luaname, lucname = name .. ".lua", name .. ".luc" - if trace_locating then - logs.report("fileio","preparing '%s' for '%s'",dataname,cachename) - end - for k, v in next, files do - if type(v) == "table" and #v == 1 then - files[k] = v[1] - end - end - local data = { - type = dataname, - root = cachename, - version = resolvers.cacheversion, - date = os.date("%Y-%m-%d"), - time = os.date("%H:%M:%S"), - content = files, - uuid = os.uuid(), - } - local ok = io.savedata(luaname,resolvers.serialize(data)) - if ok then - if trace_locating then - logs.report("fileio","'%s' saved in '%s'",dataname,luaname) - end - if utils.lua.compile(luaname,lucname,false,true) then -- no cleanup but strip - if trace_locating then - logs.report("fileio","'%s' compiled to '%s'",dataname,lucname) - end - else - if trace_locating then - logs.report("fileio","compiling failed for '%s', deleting file '%s'",dataname,lucname) - end - os.remove(lucname) - end - elseif trace_locating then - logs.report("fileio","unable to save '%s' in '%s' (access error)",dataname,luaname) - end - end -end - -function resolvers.load_data(pathname,dataname,filename,makename) -- untested without cache overload - filename = ((not filename or (filename == "")) and dataname) or filename - filename = (makename and makename(dataname,filename)) or file.join(pathname,filename) - local blob = loadfile(filename .. ".luc") or loadfile(filename .. ".lua") - if blob then - local data = blob() - if data and data.content and data.type == dataname and data.version == resolvers.cacheversion then - data_state[#data_state+1] = data.uuid - if trace_locating then - logs.report("fileio","loading '%s' for '%s' from '%s'",dataname,pathname,filename) - end - instance[dataname][pathname] = data.content - else - if trace_locating then - logs.report("fileio","skipping '%s' for '%s' from '%s'",dataname,pathname,filename) - end - instance[dataname][pathname] = { } - instance.loaderror = true - end - elseif trace_locating then - logs.report("fileio","skipping '%s' for '%s' from '%s'",dataname,pathname,filename) - end -end - --- some day i'll use the nested approach, but not yet (actually we even drop --- engine/progname support since we have only luatex now) --- --- first texmfcnf.lua files are located, next the cached texmf.cnf files --- --- return { --- TEXMFBOGUS = 'effe checken of dit werkt', --- } - -function resolvers.resetconfig() - identify_own() - instance.configuration, instance.setup, instance.order, instance.loaderror = { }, { }, { }, false -end - -function resolvers.loadnewconfig() - local luafiles = instance.luafiles - for i=1,#luafiles do - local cnf = luafiles[i] - local pathname = file.dirname(cnf) - local filename = file.join(pathname,resolvers.luaname) - local blob = loadfile(filename) - if blob then - local data = blob() - if data then - if trace_locating then - logs.report("fileio","loading configuration file '%s'",filename) - end - if true then - -- flatten to variable.progname - local t = { } - for k, v in next, data do -- v = progname - if type(v) == "string" then - t[k] = v - else - for kk, vv in next, v do -- vv = variable - if type(vv) == "string" then - t[vv.."."..v] = kk - end - end - end - end - instance['setup'][pathname] = t - else - instance['setup'][pathname] = data - end - else - if trace_locating then - logs.report("fileio","skipping configuration file '%s'",filename) - end - instance['setup'][pathname] = { } - instance.loaderror = true - end - elseif trace_locating then - logs.report("fileio","skipping configuration file '%s'",filename) - end - instance.order[#instance.order+1] = instance.setup[pathname] - if instance.loaderror then break end - end -end - -function resolvers.loadoldconfig() - if not instance.renewcache then - local cnffiles = instance.cnffiles - for i=1,#cnffiles do - local cnf = cnffiles[i] - local dname = file.dirname(cnf) - resolvers.load_data(dname,'configuration') - instance.order[#instance.order+1] = instance.configuration[dname] - if instance.loaderror then break end - end - end - resolvers.joinconfig() -end - -function resolvers.expand_variables() - local expansions, environment, variables = { }, instance.environment, instance.variables - local env = resolvers.env - instance.expansions = expansions - local engine, progname = instance.engine, instance.progname - if type(engine) ~= "string" then instance.engine, engine = "", "" end - if type(progname) ~= "string" then instance.progname, progname = "", "" end - if engine ~= "" then environment['engine'] = engine end - if progname ~= "" then environment['progname'] = progname end - for k,v in next, environment do - local a, b = match(k,"^(%a+)%_(.*)%s*$") - if a and b then - expansions[a..'.'..b] = v - else - expansions[k] = v - end - end - for k,v in next, environment do -- move environment to expansions - if not expansions[k] then expansions[k] = v end - end - for k,v in next, variables do -- move variables to expansions - if not expansions[k] then expansions[k] = v end - end - local busy = false - local function resolve(a) - busy = true - return expansions[a] or env(a) - end - while true do - busy = false - for k,v in next, expansions do - local s, n = gsub(v,"%$([%a%d%_%-]+)",resolve) - local s, m = gsub(s,"%$%{([%a%d%_%-]+)%}",resolve) - if n > 0 or m > 0 then - expansions[k]= s - end - end - if not busy then break end - end - for k,v in next, expansions do - expansions[k] = gsub(v,"\\", '/') - end -end - -function resolvers.variable(name) - return entry(instance.variables,name) -end - -function resolvers.expansion(name) - return entry(instance.expansions,name) -end - -function resolvers.is_variable(name) - return is_entry(instance.variables,name) -end - -function resolvers.is_expansion(name) - return is_entry(instance.expansions,name) -end - -function resolvers.unexpanded_path_list(str) - local pth = resolvers.variable(str) - local lst = resolvers.split_path(pth) - return expanded_path_from_list(lst) -end - -function resolvers.unexpanded_path(str) - return file.join_path(resolvers.unexpanded_path_list(str)) -end - -do -- no longer needed - - local done = { } - - function resolvers.reset_extra_path() - local ep = instance.extra_paths - if not ep then - ep, done = { }, { } - instance.extra_paths = ep - elseif #ep > 0 then - instance.lists, done = { }, { } - end - end - - function resolvers.register_extra_path(paths,subpaths) - local ep = instance.extra_paths or { } - local n = #ep - if paths and paths ~= "" then - if subpaths and subpaths ~= "" then - for p in gmatch(paths,"[^,]+") do - -- we gmatch each step again, not that fast, but used seldom - for s in gmatch(subpaths,"[^,]+") do - local ps = p .. "/" .. s - if not done[ps] then - ep[#ep+1] = resolvers.clean_path(ps) - done[ps] = true - end - end - end - else - for p in gmatch(paths,"[^,]+") do - if not done[p] then - ep[#ep+1] = resolvers.clean_path(p) - done[p] = true - end - end - end - elseif subpaths and subpaths ~= "" then - for i=1,n do - -- we gmatch each step again, not that fast, but used seldom - for s in gmatch(subpaths,"[^,]+") do - local ps = ep[i] .. "/" .. s - if not done[ps] then - ep[#ep+1] = resolvers.clean_path(ps) - done[ps] = true - end - end - end - end - if #ep > 0 then - instance.extra_paths = ep -- register paths - end - if #ep > n then - instance.lists = { } -- erase the cache - end - end - -end - -local function made_list(instance,list) - local ep = instance.extra_paths - if not ep or #ep == 0 then - return list - else - local done, new = { }, { } - -- honour . .. ../.. but only when at the start - for k=1,#list do - local v = list[k] - if not done[v] then - if find(v,"^[%.%/]$") then - done[v] = true - new[#new+1] = v - else - break - end - end - end - -- first the extra paths - for k=1,#ep do - local v = ep[k] - if not done[v] then - done[v] = true - new[#new+1] = v - end - end - -- next the formal paths - for k=1,#list do - local v = list[k] - if not done[v] then - done[v] = true - new[#new+1] = v - end - end - return new - end -end - -function resolvers.clean_path_list(str) - local t = resolvers.expanded_path_list(str) - if t then - for i=1,#t do - t[i] = file.collapse_path(resolvers.clean_path(t[i])) - end - end - return t -end - -function resolvers.expand_path(str) - return file.join_path(resolvers.expanded_path_list(str)) -end - -function resolvers.expanded_path_list(str) - if not str then - return ep or { } -- ep ? - elseif instance.savelists then - -- engine+progname hash - str = gsub(str,"%$","") - if not instance.lists[str] then -- cached - local lst = made_list(instance,resolvers.split_path(resolvers.expansion(str))) - instance.lists[str] = expanded_path_from_list(lst) - end - return instance.lists[str] - else - local lst = resolvers.split_path(resolvers.expansion(str)) - return made_list(instance,expanded_path_from_list(lst)) - end -end - -function resolvers.expanded_path_list_from_var(str) -- brrr - local tmp = resolvers.var_of_format_or_suffix(gsub(str,"%$","")) - if tmp ~= "" then - return resolvers.expanded_path_list(tmp) - else - return resolvers.expanded_path_list(str) - end -end - -function resolvers.expand_path_from_var(str) - return file.join_path(resolvers.expanded_path_list_from_var(str)) -end - -function resolvers.format_of_var(str) - return formats[str] or formats[alternatives[str]] or '' -end -function resolvers.format_of_suffix(str) - return suffixmap[file.extname(str)] or 'tex' -end - -function resolvers.variable_of_format(str) - return formats[str] or formats[alternatives[str]] or '' -end - -function resolvers.var_of_format_or_suffix(str) - local v = formats[str] - if v then - return v - end - v = formats[alternatives[str]] - if v then - return v - end - v = suffixmap[file.extname(str)] - if v then - return formats[isf] - end - return '' -end - -function resolvers.expand_braces(str) -- output variable and brace expansion of STRING - local ori = resolvers.variable(str) - local pth = expanded_path_from_list(resolvers.split_path(ori)) - return file.join_path(pth) -end - -resolvers.isreadable = { } - -function resolvers.isreadable.file(name) - local readable = lfs.isfile(name) -- brrr - if trace_detail then - if readable then - logs.report("fileio","file '%s' is readable",name) - else - logs.report("fileio","file '%s' is not readable", name) - end - end - return readable -end - -resolvers.isreadable.tex = resolvers.isreadable.file - --- name --- name/name - -local function collect_files(names) - local filelist = { } - for k=1,#names do - local fname = names[k] - if trace_detail then - logs.report("fileio","checking name '%s'",fname) - end - local bname = file.basename(fname) - local dname = file.dirname(fname) - if dname == "" or find(dname,"^%.") then - dname = false - else - dname = "/" .. dname .. "$" - end - local hashes = instance.hashes - for h=1,#hashes do - local hash = hashes[h] - local blobpath = hash.tag - local files = blobpath and instance.files[blobpath] - if files then - if trace_detail then - logs.report("fileio","deep checking '%s' (%s)",blobpath,bname) - end - local blobfile = files[bname] - if not blobfile then - local rname = "remap:"..bname - blobfile = files[rname] - if blobfile then - bname = files[rname] - blobfile = files[bname] - end - end - if blobfile then - if type(blobfile) == 'string' then - if not dname or find(blobfile,dname) then - filelist[#filelist+1] = { - hash.type, - file.join(blobpath,blobfile,bname), -- search - resolvers.concatinators[hash.type](blobpath,blobfile,bname) -- result - } - end - else - for kk=1,#blobfile do - local vv = blobfile[kk] - if not dname or find(vv,dname) then - filelist[#filelist+1] = { - hash.type, - file.join(blobpath,vv,bname), -- search - resolvers.concatinators[hash.type](blobpath,vv,bname) -- result - } - end - end - end - end - elseif trace_locating then - logs.report("fileio","no match in '%s' (%s)",blobpath,bname) - end - end - end - if #filelist > 0 then - return filelist - else - return nil - end -end - -function resolvers.suffix_of_format(str) - if suffixes[str] then - return suffixes[str][1] - else - return "" - end -end - -function resolvers.suffixes_of_format(str) - if suffixes[str] then - return suffixes[str] - else - return {} - end -end - -function resolvers.register_in_trees(name) - if not find(name,"^%.") then - instance.foundintrees[name] = (instance.foundintrees[name] or 0) + 1 -- maybe only one - end -end - --- split the next one up for readability (bu this module needs a cleanup anyway) - -local function can_be_dir(name) -- can become local - local fakepaths = instance.fakepaths - if not fakepaths[name] then - if lfs.isdir(name) then - fakepaths[name] = 1 -- directory - else - fakepaths[name] = 2 -- no directory - end - end - return (fakepaths[name] == 1) -end - -local function collect_instance_files(filename,collected) -- todo : plugin (scanners, checkers etc) - local result = collected or { } - local stamp = nil - filename = file.collapse_path(filename) - -- speed up / beware: format problem - if instance.remember then - stamp = filename .. "--" .. instance.engine .. "--" .. instance.progname .. "--" .. instance.format - if instance.found[stamp] then - if trace_locating then - logs.report("fileio","remembering file '%s'",filename) - end - return instance.found[stamp] - end - end - if not dangerous[instance.format or "?"] then - if resolvers.isreadable.file(filename) then - if trace_detail then - logs.report("fileio","file '%s' found directly",filename) - end - instance.found[stamp] = { filename } - return { filename } - end - end - if find(filename,'%*') then - if trace_locating then - logs.report("fileio","checking wildcard '%s'", filename) - end - result = resolvers.find_wildcard_files(filename) - elseif file.is_qualified_path(filename) then - if resolvers.isreadable.file(filename) then - if trace_locating then - logs.report("fileio","qualified name '%s'", filename) - end - result = { filename } - else - local forcedname, ok, suffix = "", false, file.extname(filename) - if suffix == "" then -- why - if instance.format == "" then - forcedname = filename .. ".tex" - if resolvers.isreadable.file(forcedname) then - if trace_locating then - logs.report("fileio","no suffix, forcing standard filetype 'tex'") - end - result, ok = { forcedname }, true - end - else - local suffixes = resolvers.suffixes_of_format(instance.format) - for _, s in next, suffixes do - forcedname = filename .. "." .. s - if resolvers.isreadable.file(forcedname) then - if trace_locating then - logs.report("fileio","no suffix, forcing format filetype '%s'", s) - end - result, ok = { forcedname }, true - break - end - end - end - end - if not ok and suffix ~= "" then - -- try to find in tree (no suffix manipulation), here we search for the - -- matching last part of the name - local basename = file.basename(filename) - local pattern = gsub(filename .. "$","([%.%-])","%%%1") - local savedformat = instance.format - local format = savedformat or "" - if format == "" then - instance.format = resolvers.format_of_suffix(suffix) - end - if not format then - instance.format = "othertextfiles" -- kind of everything, maybe texinput is better - end - -- - if basename ~= filename then - local resolved = collect_instance_files(basename) - if #result == 0 then - local lowered = lower(basename) - if filename ~= lowered then - resolved = collect_instance_files(lowered) - end - end - resolvers.format = savedformat - -- - for r=1,#resolved do - local rr = resolved[r] - if find(rr,pattern) then - result[#result+1], ok = rr, true - end - end - end - -- a real wildcard: - -- - -- if not ok then - -- local filelist = collect_files({basename}) - -- for f=1,#filelist do - -- local ff = filelist[f][3] or "" - -- if find(ff,pattern) then - -- result[#result+1], ok = ff, true - -- end - -- end - -- end - end - if not ok and trace_locating then - logs.report("fileio","qualified name '%s'", filename) - end - end - else - -- search spec - local filetype, extra, done, wantedfiles, ext = '', nil, false, { }, file.extname(filename) - if ext == "" then - if not instance.force_suffixes then - wantedfiles[#wantedfiles+1] = filename - end - else - wantedfiles[#wantedfiles+1] = filename - end - if instance.format == "" then - if ext == "" then - local forcedname = filename .. '.tex' - wantedfiles[#wantedfiles+1] = forcedname - filetype = resolvers.format_of_suffix(forcedname) - if trace_locating then - logs.report("fileio","forcing filetype '%s'",filetype) - end - else - filetype = resolvers.format_of_suffix(filename) - if trace_locating then - logs.report("fileio","using suffix based filetype '%s'",filetype) - end - end - else - if ext == "" then - local suffixes = resolvers.suffixes_of_format(instance.format) - for _, s in next, suffixes do - wantedfiles[#wantedfiles+1] = filename .. "." .. s - end - end - filetype = instance.format - if trace_locating then - logs.report("fileio","using given filetype '%s'",filetype) - end - end - local typespec = resolvers.variable_of_format(filetype) - local pathlist = resolvers.expanded_path_list(typespec) - if not pathlist or #pathlist == 0 then - -- no pathlist, access check only / todo == wildcard - if trace_detail then - logs.report("fileio","checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | ")) - end - for k=1,#wantedfiles do - local fname = wantedfiles[k] - if fname and resolvers.isreadable.file(fname) then - filename, done = fname, true - result[#result+1] = file.join('.',fname) - break - end - end - -- this is actually 'other text files' or 'any' or 'whatever' - local filelist = collect_files(wantedfiles) - local fl = filelist and filelist[1] - if fl then - filename = fl[3] - result[#result+1] = filename - done = true - end - else - -- list search - local filelist = collect_files(wantedfiles) - local dirlist = { } - if filelist then - for i=1,#filelist do - dirlist[i] = file.dirname(filelist[i][2]) .. "/" - end - end - if trace_detail then - logs.report("fileio","checking filename '%s'",filename) - end - -- a bit messy ... esp the doscan setting here - local doscan - for k=1,#pathlist do - local path = pathlist[k] - if find(path,"^!!") then doscan = false else doscan = true end - local pathname = gsub(path,"^!+", '') - done = false - -- using file list - if filelist then - local expression - -- compare list entries with permitted pattern -- /xx /xx// - if not find(pathname,"/$") then - expression = pathname .. "/" - else - expression = pathname - end - expression = gsub(expression,"([%-%.])","%%%1") -- this also influences - expression = gsub(expression,"//+$", '/.*') -- later usage of pathname - expression = gsub(expression,"//", '/.-/') -- not ok for /// but harmless - expression = "^" .. expression .. "$" - if trace_detail then - logs.report("fileio","using pattern '%s' for path '%s'",expression,pathname) - end - for k=1,#filelist do - local fl = filelist[k] - local f = fl[2] - local d = dirlist[k] - if find(d,expression) then - --- todo, test for readable - result[#result+1] = fl[3] - resolvers.register_in_trees(f) -- for tracing used files - done = true - if instance.allresults then - if trace_detail then - logs.report("fileio","match in hash for file '%s' on path '%s', continue scanning",f,d) - end - else - if trace_detail then - logs.report("fileio","match in hash for file '%s' on path '%s', quit scanning",f,d) - end - break - end - elseif trace_detail then - logs.report("fileio","no match in hash for file '%s' on path '%s'",f,d) - end - end - end - if not done and doscan then - -- check if on disk / unchecked / does not work at all / also zips - if resolvers.splitmethod(pathname).scheme == 'file' then -- ? - local pname = gsub(pathname,"%.%*$",'') - if not find(pname,"%*") then - local ppname = gsub(pname,"/+$","") - if can_be_dir(ppname) then - for k=1,#wantedfiles do - local w = wantedfiles[k] - local fname = file.join(ppname,w) - if resolvers.isreadable.file(fname) then - if trace_detail then - logs.report("fileio","found '%s' by scanning",fname) - end - result[#result+1] = fname - done = true - if not instance.allresults then break end - end - end - else - -- no access needed for non existing path, speedup (esp in large tree with lots of fake) - end - end - end - end - if not done and doscan then - -- todo: slow path scanning - end - if done and not instance.allresults then break end - end - end - end - for k=1,#result do - result[k] = file.collapse_path(result[k]) - end - if instance.remember then - instance.found[stamp] = result - end - return result -end - -if not resolvers.concatinators then resolvers.concatinators = { } end - -resolvers.concatinators.tex = file.join -resolvers.concatinators.file = resolvers.concatinators.tex - -function resolvers.find_files(filename,filetype,mustexist) - if type(mustexist) == boolean then - -- all set - elseif type(filetype) == 'boolean' then - filetype, mustexist = nil, false - elseif type(filetype) ~= 'string' then - filetype, mustexist = nil, false - end - instance.format = filetype or '' - local result = collect_instance_files(filename) - if #result == 0 then - local lowered = lower(filename) - if filename ~= lowered then - return collect_instance_files(lowered) - end - end - instance.format = '' - return result -end - -function resolvers.find_file(filename,filetype,mustexist) - return (resolvers.find_files(filename,filetype,mustexist)[1] or "") -end - -function resolvers.find_given_files(filename) - local bname, result = file.basename(filename), { } - local hashes = instance.hashes - for k=1,#hashes do - local hash = hashes[k] - local files = instance.files[hash.tag] or { } - local blist = files[bname] - if not blist then - local rname = "remap:"..bname - blist = files[rname] - if blist then - bname = files[rname] - blist = files[bname] - end - end - if blist then - if type(blist) == 'string' then - result[#result+1] = resolvers.concatinators[hash.type](hash.tag,blist,bname) or "" - if not instance.allresults then break end - else - for kk=1,#blist do - local vv = blist[kk] - result[#result+1] = resolvers.concatinators[hash.type](hash.tag,vv,bname) or "" - if not instance.allresults then break end - end - end - end - end - return result -end - -function resolvers.find_given_file(filename) - return (resolvers.find_given_files(filename)[1] or "") -end - -local function doit(path,blist,bname,tag,kind,result,allresults) - local done = false - if blist and kind then - if type(blist) == 'string' then - -- make function and share code - if find(lower(blist),path) then - result[#result+1] = resolvers.concatinators[kind](tag,blist,bname) or "" - done = true - end - else - for kk=1,#blist do - local vv = blist[kk] - if find(lower(vv),path) then - result[#result+1] = resolvers.concatinators[kind](tag,vv,bname) or "" - done = true - if not allresults then break end - end - end - end - end - return done -end - -function resolvers.find_wildcard_files(filename) -- todo: remap: - local result = { } - local bname, dname = file.basename(filename), file.dirname(filename) - local path = gsub(dname,"^*/","") - path = gsub(path,"*",".*") - path = gsub(path,"-","%%-") - if dname == "" then - path = ".*" - end - local name = bname - name = gsub(name,"*",".*") - name = gsub(name,"-","%%-") - path = lower(path) - name = lower(name) - local files, allresults, done = instance.files, instance.allresults, false - if find(name,"%*") then - local hashes = instance.hashes - for k=1,#hashes do - local hash = hashes[k] - local tag, kind = hash.tag, hash.type - for kk, hh in next, files[hash.tag] do - if not find(kk,"^remap:") then - if find(lower(kk),name) then - if doit(path,hh,kk,tag,kind,result,allresults) then done = true end - if done and not allresults then break end - end - end - end - end - else - local hashes = instance.hashes - for k=1,#hashes do - local hash = hashes[k] - local tag, kind = hash.tag, hash.type - if doit(path,files[tag][bname],bname,tag,kind,result,allresults) then done = true end - if done and not allresults then break end - end - end - -- we can consider also searching the paths not in the database, but then - -- we end up with a messy search (all // in all path specs) - return result -end - -function resolvers.find_wildcard_file(filename) - return (resolvers.find_wildcard_files(filename)[1] or "") -end - --- main user functions - -function resolvers.automount() - -- implemented later -end - -function resolvers.load(option) - statistics.starttiming(instance) - resolvers.resetconfig() - resolvers.identify_cnf() - resolvers.load_lua() -- will become the new method - resolvers.expand_variables() - resolvers.load_cnf() -- will be skipped when we have a lua file - resolvers.expand_variables() - if option ~= "nofiles" then - resolvers.load_hash() - resolvers.automount() - end - statistics.stoptiming(instance) -end - -function resolvers.for_files(command, files, filetype, mustexist) - if files and #files > 0 then - local function report(str) - if trace_locating then - logs.report("fileio",str) -- has already verbose - else - print(str) - end - end - if trace_locating then - report('') -- ? - end - for f=1,#files do - local file = files[f] - local result = command(file,filetype,mustexist) - if type(result) == 'string' then - report(result) - else - for i=1,#result do - report(result[i]) -- could be unpack - end - end - end - end -end - --- strtab - -resolvers.var_value = resolvers.variable -- output the value of variable $STRING. -resolvers.expand_var = resolvers.expansion -- output variable expansion of STRING. - -function resolvers.show_path(str) -- output search path for file type NAME - return file.join_path(resolvers.expanded_path_list(resolvers.format_of_var(str))) -end - --- resolvers.find_file(filename) --- resolvers.find_file(filename, filetype, mustexist) --- resolvers.find_file(filename, mustexist) --- resolvers.find_file(filename, filetype) - -function resolvers.register_file(files, name, path) - if files[name] then - if type(files[name]) == 'string' then - files[name] = { files[name], path } - else - files[name] = path - end - else - files[name] = path - end -end - -function resolvers.splitmethod(filename) - if not filename then - return { } -- safeguard - elseif type(filename) == "table" then - return filename -- already split - elseif not find(filename,"://") then - return { scheme="file", path = filename, original=filename } -- quick hack - else - return url.hashed(filename) - end -end - -function table.sequenced(t,sep) -- temp here - local s = { } - for k, v in next, t do -- indexed? - s[#s+1] = k .. "=" .. tostring(v) - end - return concat(s, sep or " | ") -end - -function resolvers.methodhandler(what, filename, filetype) -- ... - filename = file.collapse_path(filename) - local specification = (type(filename) == "string" and resolvers.splitmethod(filename)) or filename -- no or { }, let it bomb - local scheme = specification.scheme - if resolvers[what][scheme] then - if trace_locating then - logs.report("fileio","handler '%s' -> '%s' -> '%s'",specification.original,what,table.sequenced(specification)) - end - return resolvers[what][scheme](filename,filetype) -- todo: specification - else - return resolvers[what].tex(filename,filetype) -- todo: specification - end -end - -function resolvers.clean_path(str) - if str then - str = gsub(str,"\\","/") - str = gsub(str,"^!+","") - str = gsub(str,"^~",resolvers.homedir) - return str - else - return nil - end -end - -function resolvers.do_with_path(name,func) - local pathlist = resolvers.expanded_path_list(name) - for i=1,#pathlist do - func("^"..resolvers.clean_path(pathlist[i])) - end -end - -function resolvers.do_with_var(name,func) - func(expanded_var(name)) -end - -function resolvers.with_files(pattern,handle) - local hashes = instance.hashes - for i=1,#hashes do - local hash = hashes[i] - local blobpath = hash.tag - local blobtype = hash.type - if blobpath then - local files = instance.files[blobpath] - if files then - for k,v in next, files do - if find(k,"^remap:") then - k = files[k] - v = files[k] -- chained - end - if find(k,pattern) then - if type(v) == "string" then - handle(blobtype,blobpath,v,k) - else - for _,vv in next, v do -- indexed - handle(blobtype,blobpath,vv,k) - end - end - end - end - end - end - end -end - -function resolvers.locate_format(name) - local barename, fmtname = gsub(name,"%.%a+$",""), "" - if resolvers.usecache then - local path = file.join(caches.setpath("formats")) -- maybe platform - fmtname = file.join(path,barename..".fmt") or "" - end - if fmtname == "" then - fmtname = resolvers.find_files(barename..".fmt")[1] or "" - end - fmtname = resolvers.clean_path(fmtname) - if fmtname ~= "" then - local barename = file.removesuffix(fmtname) - local luaname, lucname, luiname = barename .. ".lua", barename .. ".luc", barename .. ".lui" - if lfs.isfile(luiname) then - return barename, luiname - elseif lfs.isfile(lucname) then - return barename, lucname - elseif lfs.isfile(luaname) then - return barename, luaname - end - end - return nil, nil -end - -function resolvers.boolean_variable(str,default) - local b = resolvers.expansion(str) - if b == "" then - return default - else - b = toboolean(b) - return (b == nil and default) or b - end -end - -texconfig.kpse_init = false - -kpse = { original = kpse } setmetatable(kpse, { __index = function(k,v) return resolvers[v] end } ) - --- for a while - -input = resolvers - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['data-tmp'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - ---[[ldx-- -

This module deals with caching data. It sets up the paths and -implements loaders and savers for tables. Best is to set the -following variable. When not set, the usual paths will be -checked. Personally I prefer the (users) temporary path.

- - -TEXMFCACHE=$TMP;$TEMP;$TMPDIR;$TEMPDIR;$HOME;$TEXMFVAR;$VARTEXMF;. - - -

Currently we do no locking when we write files. This is no real -problem because most caching involves fonts and the chance of them -being written at the same time is small. We also need to extend -luatools with a recache feature.

---ldx]]-- - -local format, lower, gsub = string.format, string.lower, string.gsub - -local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) -- not used yet - -caches = caches or { } - -caches.path = caches.path or nil -caches.base = caches.base or "luatex-cache" -caches.more = caches.more or "context" -caches.direct = false -- true is faster but may need huge amounts of memory -caches.tree = false -caches.paths = caches.paths or nil -caches.force = true -- changed for TEXLIVE by TH -caches.defaults = { "TEXMFCACHE", "TMPDIR", "TEMPDIR", "TMP", "TEMP", "HOME", "HOMEPATH" } - -function caches.temp() - local cachepath = nil - local function check(list,isenv) - if not cachepath then - for k=1,#list do - local v = list[k] - cachepath = (isenv and (os.env[v] or "")) or v or "" - if cachepath == "" then - -- next - else - cachepath = resolvers.clean_path(cachepath) - if lfs.isdir(cachepath) and file.iswritable(cachepath) then -- lfs.attributes(cachepath,"mode") == "directory" - break - elseif caches.force or io.ask(format("\nShould I create the cache path %s?",cachepath), "no", { "yes", "no" }) == "yes" then - dir.mkdirs(cachepath) - if lfs.isdir(cachepath) and file.iswritable(cachepath) then - break - end - end - end - cachepath = nil - end - end - end - check(resolvers.clean_path_list("TEXMFCACHE") or { }) - check(caches.defaults,true) - if not cachepath then - print("\nfatal error: there is no valid (writable) cache path defined\n") - os.exit() - elseif not lfs.isdir(cachepath) then -- lfs.attributes(cachepath,"mode") ~= "directory" - print(format("\nfatal error: cache path %s is not a directory\n",cachepath)) - os.exit() - end - cachepath = file.collapse_path(cachepath) - function caches.temp() - return cachepath - end - return cachepath -end - -function caches.configpath() - return table.concat(resolvers.instance.cnffiles,";") -end - -function caches.hashed(tree) - return md5.hex(gsub(lower(tree),"[\\\/]+","/")) -end - -function caches.treehash() - local tree = caches.configpath() - if not tree or tree == "" then - return false - else - return caches.hashed(tree) - end -end - -function caches.setpath(...) - if not caches.path then - if not caches.path then - caches.path = caches.temp() - end - caches.path = resolvers.clean_path(caches.path) -- to be sure - caches.tree = caches.tree or caches.treehash() - if caches.tree then - caches.path = dir.mkdirs(caches.path,caches.base,caches.more,caches.tree) - else - caches.path = dir.mkdirs(caches.path,caches.base,caches.more) - end - end - if not caches.path then - caches.path = '.' - end - caches.path = resolvers.clean_path(caches.path) - local dirs = { ... } - if #dirs > 0 then - local pth = dir.mkdirs(caches.path,...) - return pth - end - caches.path = dir.expand_name(caches.path) - return caches.path -end - -function caches.definepath(category,subcategory) - return function() - return caches.setpath(category,subcategory) - end -end - -function caches.setluanames(path,name) - return path .. "/" .. name .. ".tma", path .. "/" .. name .. ".tmc" -end - -function caches.loaddata(path,name) - local tmaname, tmcname = caches.setluanames(path,name) - local loader = loadfile(tmcname) or loadfile(tmaname) - if loader then - loader = loader() - collectgarbage("step") - return loader - else - return false - end -end - ---~ function caches.loaddata(path,name) ---~ local tmaname, tmcname = caches.setluanames(path,name) ---~ return dofile(tmcname) or dofile(tmaname) ---~ end - -function caches.iswritable(filepath,filename) - local tmaname, tmcname = caches.setluanames(filepath,filename) - return file.iswritable(tmaname) -end - -function caches.savedata(filepath,filename,data,raw) - local tmaname, tmcname = caches.setluanames(filepath,filename) - local reduce, simplify = true, true - if raw then - reduce, simplify = false, false - end - data.cache_uuid = os.uuid() - if caches.direct then - file.savedata(tmaname, table.serialize(data,'return',false,true,false)) -- no hex - else - table.tofile(tmaname, data,'return',false,true,false) -- maybe not the last true - end - local cleanup = resolvers.boolean_variable("PURGECACHE", false) - local strip = resolvers.boolean_variable("LUACSTRIP", true) - utils.lua.compile(tmaname, tmcname, cleanup, strip) -end - --- here we use the cache for format loading (texconfig.[formatname|jobname]) - ---~ if tex and texconfig and texconfig.formatname and texconfig.formatname == "" then -if tex and texconfig and (not texconfig.formatname or texconfig.formatname == "") and input and resolvers.instance then - if not texconfig.luaname then texconfig.luaname = "cont-en.lua" end -- or luc - texconfig.formatname = caches.setpath("formats") .. "/" .. gsub(texconfig.luaname,"%.lu.$",".fmt") -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['data-inp'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -resolvers.finders = resolvers.finders or { } -resolvers.openers = resolvers.openers or { } -resolvers.loaders = resolvers.loaders or { } - -resolvers.finders.notfound = { nil } -resolvers.openers.notfound = { nil } -resolvers.loaders.notfound = { false, nil, 0 } - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['data-out'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -outputs = outputs or { } - - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['data-con'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local format, lower, gsub = string.format, string.lower, string.gsub - -local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) -local trace_containers = false trackers.register("resolvers.containers", function(v) trace_containers = v end) -local trace_storage = false trackers.register("resolvers.storage", function(v) trace_storage = v end) - ---[[ldx-- -

Once we found ourselves defining similar cache constructs -several times, containers were introduced. Containers are used -to collect tables in memory and reuse them when possible based -on (unique) hashes (to be provided by the calling function).

- -

Caching to disk is disabled by default. Version numbers are -stored in the saved table which makes it possible to change the -table structures without bothering about the disk cache.

- -

Examples of usage can be found in the font related code.

---ldx]]-- - -containers = containers or { } - -containers.usecache = true - -local function report(container,tag,name) - if trace_cache or trace_containers then - logs.report(format("%s cache",container.subcategory),"%s: %s",tag,name or 'invalid') - end -end - -local allocated = { } - --- tracing - -function containers.define(category, subcategory, version, enabled) - return function() - if category and subcategory then - local c = allocated[category] - if not c then - c = { } - allocated[category] = c - end - local s = c[subcategory] - if not s then - s = { - category = category, - subcategory = subcategory, - storage = { }, - enabled = enabled, - version = version or 1.000, - trace = false, - path = caches and caches.setpath and caches.setpath(category,subcategory), - } - c[subcategory] = s - end - return s - else - return nil - end - end -end - -function containers.is_usable(container, name) - return container.enabled and caches and caches.iswritable(container.path, name) -end - -function containers.is_valid(container, name) - if name and name ~= "" then - local storage = container.storage[name] - return storage and storage.cache_version == container.version - else - return false - end -end - -function containers.read(container,name) - if container.enabled and caches and not container.storage[name] and containers.usecache then - container.storage[name] = caches.loaddata(container.path,name) - if containers.is_valid(container,name) then - report(container,"loaded",name) - else - container.storage[name] = nil - end - end - if container.storage[name] then - report(container,"reusing",name) - end - return container.storage[name] -end - -function containers.write(container, name, data) - if data then - data.cache_version = container.version - if container.enabled and caches then - local unique, shared = data.unique, data.shared - data.unique, data.shared = nil, nil - caches.savedata(container.path, name, data) - report(container,"saved",name) - data.unique, data.shared = unique, shared - end - report(container,"stored",name) - container.storage[name] = data - end - return data -end - -function containers.content(container,name) - return container.storage[name] -end - -function containers.cleanname(name) - return (gsub(lower(name),"[^%w%d]+","-")) -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['data-use'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local format, lower, gsub, find = string.format, string.lower, string.gsub, string.find - -local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) - --- since we want to use the cache instead of the tree, we will now --- reimplement the saver. - -local save_data = resolvers.save_data -local load_data = resolvers.load_data - -resolvers.cachepath = nil -- public, for tracing -resolvers.usecache = true -- public, for tracing - -function resolvers.save_data(dataname) - save_data(dataname, function(cachename,dataname) - resolvers.usecache = not toboolean(resolvers.expansion("CACHEINTDS") or "false",true) - if resolvers.usecache then - resolvers.cachepath = resolvers.cachepath or caches.definepath("trees") - return file.join(resolvers.cachepath(),caches.hashed(cachename)) - else - return file.join(cachename,dataname) - end - end) -end - -function resolvers.load_data(pathname,dataname,filename) - load_data(pathname,dataname,filename,function(dataname,filename) - resolvers.usecache = not toboolean(resolvers.expansion("CACHEINTDS") or "false",true) - if resolvers.usecache then - resolvers.cachepath = resolvers.cachepath or caches.definepath("trees") - return file.join(resolvers.cachepath(),caches.hashed(pathname)) - else - if not filename or (filename == "") then - filename = dataname - end - return file.join(pathname,filename) - end - end) -end - --- we will make a better format, maybe something xml or just text or lua - -resolvers.automounted = resolvers.automounted or { } - -function resolvers.automount(usecache) - local mountpaths = resolvers.clean_path_list(resolvers.expansion('TEXMFMOUNT')) - if (not mountpaths or #mountpaths == 0) and usecache then - mountpaths = { caches.setpath("mount") } - end - if mountpaths and #mountpaths > 0 then - statistics.starttiming(resolvers.instance) - for k=1,#mountpaths do - local root = mountpaths[k] - local f = io.open(root.."/url.tmi") - if f then - for line in f:lines() do - if line then - if find(line,"^[%%#%-]") then -- or %W - -- skip - elseif find(line,"^zip://") then - if trace_locating then - logs.report("fileio","mounting %s",line) - end - table.insert(resolvers.automounted,line) - resolvers.usezipfile(line) - end - end - end - f:close() - end - end - statistics.stoptiming(resolvers.instance) - end -end - --- status info - -statistics.register("used config path", function() return caches.configpath() end) -statistics.register("used cache path", function() return caches.temp() or "?" end) - --- experiment (code will move) - -function statistics.save_fmt_status(texname,formatbanner,sourcefile) -- texname == formatname - local enginebanner = status.list().banner - if formatbanner and enginebanner and sourcefile then - local luvname = file.replacesuffix(texname,"luv") - local luvdata = { - enginebanner = enginebanner, - formatbanner = formatbanner, - sourcehash = md5.hex(io.loaddata(resolvers.find_file(sourcefile)) or "unknown"), - sourcefile = sourcefile, - } - io.savedata(luvname,table.serialize(luvdata,true)) - end -end - -function statistics.check_fmt_status(texname) - local enginebanner = status.list().banner - if enginebanner and texname then - local luvname = file.replacesuffix(texname,"luv") - if lfs.isfile(luvname) then - local luv = dofile(luvname) - if luv and luv.sourcefile then - local sourcehash = md5.hex(io.loaddata(resolvers.find_file(luv.sourcefile)) or "unknown") - local luvbanner = luv.enginebanner or "?" - if luvbanner ~= enginebanner then - return string.format("engine mismatch (luv:%s <> bin:%s)",luvbanner,enginebanner) - end - local luvhash = luv.sourcehash or "?" - if luvhash ~= sourcehash then - return string.format("source mismatch (luv:%s <> bin:%s)",luvhash,sourcehash) - end - else - return "invalid status file" - end - else - return "missing status file" - end - end - return true -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['luat-kps'] = { - version = 1.001, - comment = "companion to luatools.lua", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - ---[[ldx-- -

This file is used when we want the input handlers to behave like -kpsewhich. What to do with the following:

- - -{$SELFAUTOLOC,$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c} -$SELFAUTOLOC : /usr/tex/bin/platform -$SELFAUTODIR : /usr/tex/bin -$SELFAUTOPARENT : /usr/tex - - -

How about just forgetting about them?

---ldx]]-- - -local suffixes = resolvers.suffixes -local formats = resolvers.formats - -suffixes['gf'] = { 'gf' } -suffixes['pk'] = { 'pk' } -suffixes['base'] = { 'base' } -suffixes['bib'] = { 'bib' } -suffixes['bst'] = { 'bst' } -suffixes['cnf'] = { 'cnf' } -suffixes['mem'] = { 'mem' } -suffixes['mf'] = { 'mf' } -suffixes['mfpool'] = { 'pool' } -suffixes['mft'] = { 'mft' } -suffixes['mppool'] = { 'pool' } -suffixes['graphic/figure'] = { 'eps', 'epsi' } -suffixes['texpool'] = { 'pool' } -suffixes['PostScript header'] = { 'pro' } -suffixes['ist'] = { 'ist' } -suffixes['web'] = { 'web', 'ch' } -suffixes['cweb'] = { 'w', 'web', 'ch' } -suffixes['cmap files'] = { 'cmap' } -suffixes['lig files'] = { 'lig' } -suffixes['bitmap font'] = { } -suffixes['MetaPost support'] = { } -suffixes['TeX system documentation'] = { } -suffixes['TeX system sources'] = { } -suffixes['dvips config'] = { } -suffixes['type42 fonts'] = { } -suffixes['web2c files'] = { } -suffixes['other text files'] = { } -suffixes['other binary files'] = { } -suffixes['opentype fonts'] = { 'otf' } - -suffixes['fmt'] = { 'fmt' } -suffixes['texmfscripts'] = { 'rb','lua','py','pl' } - -suffixes['pdftex config'] = { } -suffixes['Troff fonts'] = { } - -suffixes['ls-R'] = { } - ---[[ldx-- -

If you wondered abou tsome of the previous mappings, how about -the next bunch:

---ldx]]-- - -formats['bib'] = '' -formats['bst'] = '' -formats['mft'] = '' -formats['ist'] = '' -formats['web'] = '' -formats['cweb'] = '' -formats['MetaPost support'] = '' -formats['TeX system documentation'] = '' -formats['TeX system sources'] = '' -formats['Troff fonts'] = '' -formats['dvips config'] = '' -formats['graphic/figure'] = '' -formats['ls-R'] = '' -formats['other text files'] = '' -formats['other binary files'] = '' - -formats['gf'] = '' -formats['pk'] = '' -formats['base'] = 'MFBASES' -formats['cnf'] = '' -formats['mem'] = 'MPMEMS' -formats['mf'] = 'MFINPUTS' -formats['mfpool'] = 'MFPOOL' -formats['mppool'] = 'MPPOOL' -formats['texpool'] = 'TEXPOOL' -formats['PostScript header'] = 'TEXPSHEADERS' -formats['cmap files'] = 'CMAPFONTS' -formats['type42 fonts'] = 'T42FONTS' -formats['web2c files'] = 'WEB2C' -formats['pdftex config'] = 'PDFTEXCONFIG' -formats['texmfscripts'] = 'TEXMFSCRIPTS' -formats['bitmap font'] = '' -formats['lig files'] = 'LIGFONTS' - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['data-aux'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local find = string.find - -local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) - -function resolvers.update_script(oldname,newname) -- oldname -> own.name, not per se a suffix - local scriptpath = "scripts/context/lua" - newname = file.addsuffix(newname,"lua") - local oldscript = resolvers.clean_path(oldname) - if trace_locating then - logs.report("fileio","to be replaced old script %s", oldscript) - end - local newscripts = resolvers.find_files(newname) or { } - if #newscripts == 0 then - if trace_locating then - logs.report("fileio","unable to locate new script") - end - else - for i=1,#newscripts do - local newscript = resolvers.clean_path(newscripts[i]) - if trace_locating then - logs.report("fileio","checking new script %s", newscript) - end - if oldscript == newscript then - if trace_locating then - logs.report("fileio","old and new script are the same") - end - elseif not find(newscript,scriptpath) then - if trace_locating then - logs.report("fileio","new script should come from %s",scriptpath) - end - elseif not (find(oldscript,file.removesuffix(newname).."$") or find(oldscript,newname.."$")) then - if trace_locating then - logs.report("fileio","invalid new script name") - end - else - local newdata = io.loaddata(newscript) - if newdata then - if trace_locating then - logs.report("fileio","old script content replaced by new content") - end - io.savedata(oldscript,newdata) - break - elseif trace_locating then - logs.report("fileio","unable to load new script") - end - end - end - end -end - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['data-lst'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- used in mtxrun - -local find, concat, upper, format = string.find, table.concat, string.upper, string.format - -resolvers.listers = resolvers.listers or { } - -local function tabstr(str) - if type(str) == 'table' then - return concat(str," | ") - else - return str - end -end - -local function list(list,report) - local instance = resolvers.instance - local pat = upper(pattern or "","") - local report = report or texio.write_nl - local sorted = table.sortedkeys(list) - for i=1,#sorted do - local key = sorted[i] - if instance.pattern == "" or find(upper(key),pat) then - if instance.kpseonly then - if instance.kpsevars[key] then - report(format("%s=%s",key,tabstr(list[key]))) - end - else - report(format('%s %s=%s',(instance.kpsevars[key] and 'K') or 'E',key,tabstr(list[key]))) - end - end - end -end - -function resolvers.listers.variables () list(resolvers.instance.variables ) end -function resolvers.listers.expansions() list(resolvers.instance.expansions) end - -function resolvers.listers.configurations(report) - local report = report or texio.write_nl - local instance = resolvers.instance - local sorted = table.sortedkeys(instance.kpsevars) - for i=1,#sorted do - local key = sorted[i] - if not instance.pattern or (instance.pattern=="") or find(key,instance.pattern) then - report(format("%s\n",key)) - local order = instance.order - for i=1,#order do - local str = order[i][key] - if str then - report(format("\t%s\t%s",i,str)) - end - end - report("") - end - end -end - - -end -- of closure --- end library merge - --- We initialize some characteristics of this program. We need to --- do this before we load the libraries, else own.name will not be --- properly set (handy for selfcleaning the file). It's an ugly --- looking piece of code. - -own = { } - -own.libs = { -- todo: check which ones are really needed - 'l-string.lua', - 'l-lpeg.lua', - 'l-table.lua', - 'l-io.lua', - 'l-number.lua', - 'l-set.lua', - 'l-os.lua', - 'l-file.lua', - 'l-md5.lua', - 'l-url.lua', - 'l-dir.lua', - 'l-boolean.lua', - 'l-unicode.lua', - 'l-math.lua', - 'l-utils.lua', - 'l-aux.lua', - 'trac-tra.lua', - 'luat-env.lua', - 'trac-inf.lua', - 'trac-log.lua', - 'data-res.lua', - 'data-tmp.lua', --- 'data-pre.lua', - 'data-inp.lua', - 'data-out.lua', - 'data-con.lua', - 'data-use.lua', --- 'data-tex.lua', --- 'data-bin.lua', --- 'data-zip.lua', --- 'data-crl.lua', --- 'data-lua.lua', - 'data-kps.lua', -- so that we can replace kpsewhich - 'data-aux.lua', -- updater - 'data-lst.lua', -- lister -} - --- We need this hack till luatex is fixed. - -if arg and arg[0] == 'luatex' and arg[1] == "--luaonly" then - arg[-1]=arg[0] arg[0]=arg[2] for k=3,#arg do arg[k-2]=arg[k] end arg[#arg]=nil arg[#arg]=nil -end - --- End of hack. - -own.name = (environment and environment.ownname) or arg[0] or 'luatools.lua' -own.path = string.match(own.name,"^(.+)[\\/].-$") or "." -own.list = { '.' } - -if own.path ~= '.' then - table.insert(own.list,own.path) -end - -table.insert(own.list,own.path.."/../../texmf-dist/tex/context/base") -table.insert(own.list,own.path.."/../../../tex/context/base") -table.insert(own.list,own.path.."/mtx") -table.insert(own.list,own.path.."/../sources") - -function locate_libs() - for _, lib in pairs(own.libs) do - for _, pth in pairs(own.list) do - local filename = string.gsub(pth .. "/" .. lib,"\\","/") - local codeblob = loadfile(filename) - if codeblob then - codeblob() - own.list = { pth } -- speed up te search - break - end - end - end -end - -if not resolvers then - locate_libs() -end - -if not resolvers then - print("") - print("Luatools is unable to start up due to lack of libraries. You may") - print("try to run 'lua luatools.lua --selfmerge' in the path where this") - print("script is located (normally under ..../scripts/context/lua) which") - print("will make luatools library independent.") - os.exit() -end - -logs.setprogram('LuaTools',"TDS Management Tool 1.32",environment.arguments["verbose"] or false) - -local instance = resolvers.reset() - -resolvers.defaultlibs = { -- not all are needed (this will become: context.lus (lua spec) - 'l-string.lua', - 'l-lpeg.lua', - 'l-table.lua', - 'l-boolean.lua', - 'l-number.lua', - 'l-unicode.lua', - 'l-os.lua', - 'l-io.lua', - 'l-file.lua', - 'l-md5.lua', - 'l-url.lua', - 'l-dir.lua', - 'l-utils.lua', - 'l-dimen.lua', - 'trac-inf.lua', - 'trac-tra.lua', - 'trac-log.lua', - 'luat-env.lua', -- here ? - 'data-res.lua', - 'data-inp.lua', - 'data-out.lua', - 'data-tmp.lua', - 'data-con.lua', - 'data-use.lua', --- 'data-pre.lua', - 'data-tex.lua', - 'data-bin.lua', --- 'data-zip.lua', --- 'data-clr.lua', - 'data-lua.lua', - 'data-ctx.lua', - 'luat-fio.lua', - 'luat-cnf.lua', -} - -instance.engine = environment.arguments["engine"] or 'luatex' -instance.progname = environment.arguments["progname"] or 'context' -instance.luaname = environment.arguments["luafile"] or "" -- environment.ownname or "" -instance.lualibs = environment.arguments["lualibs"] or table.concat(resolvers.defaultlibs,",") -instance.allresults = environment.arguments["all"] or false -instance.pattern = environment.arguments["pattern"] or nil -instance.sortdata = environment.arguments["sort"] or false -instance.kpseonly = not environment.arguments["all"] or false -instance.my_format = environment.arguments["format"] or instance.format - -if type(instance.pattern) == 'boolean' then - logs.simple("invalid pattern specification") - instance.pattern = nil -end - -if environment.arguments["trace"] then resolvers.settrace(environment.arguments["trace"]) end - -local trackspec = environment.argument("trackers") or environment.argument("track") - -if trackspec then - trackers.enable(trackspec) -end - -runners = runners or { } -messages = messages or { } - -messages.no_ini_file = [[ -There is no lua initialization file found. This file can be forced by the -"--progname" directive, or specified with "--luaname", or it is derived -automatically from the formatname (aka jobname). It may be that you have -to regenerate the file database using "luatools --generate". -]] - -messages.help = [[ ---generate generate file database ---variables show configuration variables ---expansions show expanded variables ---configurations show configuration order ---expand-braces expand complex variable ---expand-path expand variable (resolve paths) ---expand-var expand variable (resolve references) ---show-path show path expansion of ... ---var-value report value of variable ---find-file report file location ---find-path report path of file ---make or --ini make luatex format ---run or --fmt= run luatex format ---luafile=str lua inifile (default is .lua) ---lualibs=list libraries to assemble (optional when --compile) ---compile assemble and compile lua inifile ---verbose give a bit more info ---all show all found files ---sort sort cached data ---engine=str target engine ---progname=str format or backend ---pattern=str filter variables ---trackers=list enable given trackers -]] - -function runners.make_format(texname) - local instance = resolvers.instance - if texname and texname ~= "" then - if resolvers.usecache then - local path = file.join(caches.setpath("formats")) -- maybe platform - if path and lfs then - lfs.chdir(path) - end - end - local barename = texname:gsub("%.%a+$","") - if barename == texname then - texname = texname .. ".tex" - end - local fullname = resolvers.find_files(texname)[1] or "" - if fullname == "" then - logs.simple("no tex file with name: %s",texname) - else - local luaname, lucname, luapath, lualibs = "", "", "", { } - -- the following is optional, since context.lua can also - -- handle this collect and compile business - if environment.arguments["compile"] then - if luaname == "" then luaname = barename end - logs.simple("creating initialization file: %s",luaname) - luapath = file.dirname(luaname) - if luapath == "" then - luapath = file.dirname(texname) - end - if luapath == "" then - luapath = file.dirname(resolvers.find_files(texname)[1] or "") - end - lualibs = string.split(instance.lualibs,",") - luaname = file.basename(barename .. ".lua") - lucname = file.basename(barename .. ".luc") - -- todo: when this fails, we can just copy the merged libraries from - -- luatools since they are normally the same, at least for context - if lualibs[1] then - local firstlib = file.join(luapath,lualibs[1]) - if not lfs.isfile(firstlib) then - local foundname = resolvers.find_files(lualibs[1])[1] - if foundname then - logs.simple("located library path: %s",luapath) - luapath = file.dirname(foundname) - end - end - end - logs.simple("using library path: %s",luapath) - logs.simple("using lua libraries: %s",table.join(lualibs," ")) - utils.merger.selfcreate(lualibs,luapath,luaname) - local strip = resolvers.boolean_variable("LUACSTRIP", true) - if utils.lua.compile(luaname,lucname,false,strip) and io.exists(lucname) then - luaname = lucname - logs.simple("using compiled initialization file: %s",lucname) - else - logs.simple("using uncompiled initialization file: %s",luaname) - end - else - local what = { instance.luaname, instance.progname, barename } - for k=1,#what do - local v = string.gsub(what[k]..".lua","%.lua%.lua$",".lua") - if v and (v ~= "") then - luaname = resolvers.find_files(v)[1] or "" - if luaname ~= "" then - break - end - end - end - end - if environment.arguments["noluc"] then - luaname = luaname:gsub("%.luc$",".lua") -- make this an option - end - if luaname == "" then - if logs.verbose then - logs.simplelines(messages.no_ini_file) - logs.simple("texname : %s",texname) - logs.simple("luaname : %s",instance.luaname) - logs.simple("progname: %s",instance.progname) - logs.simple("barename: %s",barename) - end - else - logs.simple("using lua initialization file: %s",luaname) - local mp = dir.glob(file.removesuffix(file.basename(luaname)).."-*.mem") - if mp and #mp > 0 then - for i=1,#mp do - local name = mp[i] - logs.simple("removing related mplib format %s", file.basename(name)) - os.remove(name) - end - end - local flags = { - "--ini", - "--lua=" .. string.quote(luaname) - } - local bs = (os.platform == "unix" and "\\\\") or "\\" -- todo: make a function - local command = "luatex ".. table.concat(flags," ") .. " " .. string.quote(fullname) .. " " .. bs .. "dump" - logs.simple("running command: %s\n",command) - os.spawn(command) - -- todo: do a dummy run that generates the related metafun and mfplain formats - end - end - else - logs.simple("no tex file given") - end -end - -function runners.run_format(name,data,more) - -- hm, rather old code here; we can now use the file.whatever functions - if name and (name ~= "") then - local barename = name:gsub("%.%a+$","") - local fmtname = "" - if resolvers.usecache then - local path = file.join(caches.setpath("formats")) -- maybe platform - fmtname = file.join(path,barename..".fmt") or "" - end - if fmtname == "" then - fmtname = resolvers.find_files(barename..".fmt")[1] or "" - end - fmtname = resolvers.clean_path(fmtname) - barename = fmtname:gsub("%.%a+$","") - if fmtname == "" then - logs.simple("no format with name: %s",name) - else - local luaname = barename .. ".luc" - local f = io.open(luaname) - if not f then - luaname = barename .. ".lua" - f = io.open(luaname) - end - if f then - f:close() - local command = "luatex --fmt=" .. string.quote(barename) .. " --lua=" .. string.quote(luaname) .. " " .. string.quote(data) .. " " .. (more ~= "" and string.quote(more) or "") - logs.simple("running command: %s",command) - os.spawn(command) - else - logs.simple("using format name: %s",fmtname) - logs.simple("no luc/lua with name: %s",barename) - end - end - end -end - -local ok = true - --- private option --noluc for testing errors in the stub - -if environment.arguments["find-file"] then - resolvers.load() - instance.format = environment.arguments["format"] or instance.format - if instance.pattern then - instance.allresults = true - resolvers.for_files(resolvers.find_files, { instance.pattern }, instance.my_format) - else - resolvers.for_files(resolvers.find_files, environment.files, instance.my_format) - end -elseif environment.arguments["find-path"] then - resolvers.load() - local path = resolvers.find_file(environment.files[1], instance.my_format) - if logs.verbose then - logs.simple(file.dirname(path)) - else - print(file.dirname(path)) - end -elseif environment.arguments["run"] then - resolvers.load("nofiles") -- ! no need for loading databases - logs.setverbose(true) - runners.run_format(environment.files[1] or "",environment.files[2] or "",environment.files[3] or "") -elseif environment.arguments["fmt"] then - resolvers.load("nofiles") -- ! no need for loading databases - logs.setverbose(true) - runners.run_format(environment.arguments["fmt"], environment.files[1] or "",environment.files[2] or "") -elseif environment.arguments["expand-braces"] then - resolvers.load("nofiles") - resolvers.for_files(resolvers.expand_braces, environment.files) -elseif environment.arguments["expand-path"] then - resolvers.load("nofiles") - resolvers.for_files(resolvers.expand_path, environment.files) -elseif environment.arguments["expand-var"] or environment.arguments["expand-variable"] then - resolvers.load("nofiles") - resolvers.for_files(resolvers.expand_var, environment.files) -elseif environment.arguments["show-path"] or environment.arguments["path-value"] then - resolvers.load("nofiles") - resolvers.for_files(resolvers.show_path, environment.files) -elseif environment.arguments["var-value"] or environment.arguments["show-value"] then - resolvers.load("nofiles") - resolvers.for_files(resolvers.var_value, environment.files) -elseif environment.arguments["format-path"] then - resolvers.load() - logs.simple(caches.setpath("format")) -elseif instance.pattern then -- brrr - resolvers.load() - instance.format = environment.arguments["format"] or instance.format - instance.allresults = true - resolvers.for_files(resolvers.find_files, { instance.pattern }, instance.my_format) -elseif environment.arguments["generate"] then - instance.renewcache = true - logs.setverbose(true) - resolvers.load() -elseif environment.arguments["make"] or environment.arguments["ini"] or environment.arguments["compile"] then - resolvers.load() - logs.setverbose(true) - runners.make_format(environment.files[1] or "") -elseif environment.arguments["selfmerge"] then - utils.merger.selfmerge(own.name,own.libs,own.list) -elseif environment.arguments["selfclean"] then - utils.merger.selfclean(own.name) -elseif environment.arguments["selfupdate"] then - resolvers.load() - logs.setverbose(true) - resolvers.update_script(own.name,"luatools") -elseif environment.arguments["variables"] or environment.arguments["show-variables"] then - resolvers.load("nofiles") - resolvers.listers.variables() -elseif environment.arguments["expansions"] or environment.arguments["show-expansions"] then - resolvers.load("nofiles") - resolvers.listers.expansions() -elseif environment.arguments["configurations"] or environment.arguments["show-configurations"] then - resolvers.load("nofiles") - resolvers.listers.configurations() -elseif environment.arguments["help"] or (environment.files[1]=='help') or (#environment.files==0) then - logs.help(messages.help) -else - resolvers.load() - resolvers.for_files(resolvers.find_files, environment.files, instance.my_format) -end - -if logs.verbose then - logs.simpleline() - logs.simple("runtime: %0.3f seconds",os.runtime()) -end - -if os.platform == "unix" then - io.write("\n") -end +#!/bin/sh +mtxrun --script base "$@" diff --git a/Master/texmf-dist/scripts/context/stubs/unix/metatex b/Master/texmf-dist/scripts/context/stubs/unix/metatex deleted file mode 100755 index f0c6b65d42f..00000000000 --- a/Master/texmf-dist/scripts/context/stubs/unix/metatex +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -mtxrun --script metatex "$@" diff --git a/Master/texmf-dist/scripts/context/stubs/unix/mtxrun b/Master/texmf-dist/scripts/context/stubs/unix/mtxrun index 2bdd1b8f020..cc5ebb478ac 100755 --- a/Master/texmf-dist/scripts/context/stubs/unix/mtxrun +++ b/Master/texmf-dist/scripts/context/stubs/unix/mtxrun @@ -8,7 +8,6 @@ if not modules then modules = { } end modules ['mtxrun'] = { license = "see context related readme files" } - -- one can make a stub: -- -- #!/bin/sh @@ -38,8 +37,6 @@ if not modules then modules = { } end modules ['mtxrun'] = { -- remember for subruns: _CTX_K_S_#{original}_ -- remember for subruns: TEXMFSTART.#{original} [tex.rb texmfstart.rb] -texlua = true - -- begin library merge @@ -54,8 +51,9 @@ if not modules then modules = { } end modules ['l-string'] = { license = "see context related readme files" } +local string = string local sub, gsub, find, match, gmatch, format, char, byte, rep, lower = string.sub, string.gsub, string.find, string.match, string.gmatch, string.format, string.char, string.byte, string.rep, string.lower -local lpegmatch = lpeg.match +local lpegmatch, S, C, Ct = lpeg.match, lpeg.S, lpeg.C, lpeg.Ct -- some functions may disappear as they are not used anywhere @@ -63,196 +61,68 @@ if not string.split then -- this will be overloaded by a faster lpeg variant - function string:split(pattern) - if #self > 0 then - local t = { } - for s in gmatch(self..pattern,"(.-)"..pattern) do - t[#t+1] = s + function string.split(str,pattern) + local t = { } + if #str > 0 then + local n = 1 + for s in gmatch(str..pattern,"(.-)"..pattern) do + t[n] = s + n = n + 1 end - return t - else - return { } end + return t end end -local chr_to_esc = { - ["%"] = "%%", - ["."] = "%.", - ["+"] = "%+", ["-"] = "%-", ["*"] = "%*", - ["^"] = "%^", ["$"] = "%$", - ["["] = "%[", ["]"] = "%]", - ["("] = "%(", [")"] = "%)", - ["{"] = "%{", ["}"] = "%}" -} - -string.chr_to_esc = chr_to_esc - -function string:esc() -- variant 2 - return (gsub(self,"(.)",chr_to_esc)) -end - -function string:unquote() - return (gsub(self,"^([\"\'])(.*)%1$","%2")) +function string.unquoted(str) + return (gsub(str,"^([\"\'])(.*)%1$","%2")) end ---~ function string:unquote() ---~ if find(self,"^[\'\"]") then ---~ return sub(self,2,-2) ---~ else ---~ return self ---~ end ---~ end -function string:quote() -- we could use format("%q") - return format("%q",self) +function string.quoted(str) + return format("%q",str) -- always " end -function string:count(pattern) -- variant 3 +function string.count(str,pattern) -- variant 3 local n = 0 - for _ in gmatch(self,pattern) do + for _ in gmatch(str,pattern) do -- not for utf n = n + 1 end return n end -function string:limit(n,sentinel) - if #self > n then - sentinel = sentinel or " ..." - return sub(self,1,(n-#sentinel)) .. sentinel - else - return self - end -end - ---~ function string:strip() -- the .- is quite efficient ---~ -- return match(self,"^%s*(.-)%s*$") or "" ---~ -- return match(self,'^%s*(.*%S)') or '' -- posted on lua list ---~ return find(s,'^%s*$') and '' or match(s,'^%s*(.*%S)') ---~ end - -do -- roberto's variant: - local space = lpeg.S(" \t\v\n") - local nospace = 1 - space - local stripper = space^0 * lpeg.C((space^0 * nospace^1)^0) - function string.strip(str) - return lpegmatch(stripper,str) or "" - end -end - -function string:is_empty() - return not find(self,"%S") -end - -function string:enhance(pattern,action) - local ok, n = true, 0 - while ok do - ok = false - self = gsub(self,pattern, function(...) - ok, n = true, n + 1 - return action(...) - end) - end - return self, n -end - -local chr_to_hex, hex_to_chr = { }, { } - -for i=0,255 do - local c, h = char(i), format("%02X",i) - chr_to_hex[c], hex_to_chr[h] = h, c -end - -function string:to_hex() - return (gsub(self or "","(.)",chr_to_hex)) -end - -function string:from_hex() - return (gsub(self or "","(..)",hex_to_chr)) -end - -if not string.characters then - - local function nextchar(str, index) - index = index + 1 - return (index <= #str) and index or nil, sub(str,index,index) - end - function string:characters() - return nextchar, self, 0 - end - local function nextbyte(str, index) - index = index + 1 - return (index <= #str) and index or nil, byte(sub(str,index,index)) - end - function string:bytes() - return nextbyte, self, 0 - end - -end - --- we can use format for this (neg n) - -function string:rpadd(n,chr) - local m = n-#self - if m > 0 then - return self .. rep(chr or " ",m) +function string.limit(str,n,sentinel) -- not utf proof + if #str > n then + sentinel = sentinel or "..." + return sub(str,1,(n-#sentinel)) .. sentinel else - return self - end -end - -function string:lpadd(n,chr) - local m = n-#self - if m > 0 then - return rep(chr or " ",m) .. self - else - return self + return str end end -string.padd = string.rpadd +local space = S(" \t\v\n") +local nospace = 1 - space +local stripper = space^0 * C((space^0 * nospace^1)^0) -- roberto's code -function is_number(str) -- tonumber - return find(str,"^[%-%+]?[%d]-%.?[%d+]$") == 1 +function string.strip(str) + return lpegmatch(stripper,str) or "" end ---~ print(is_number("1")) ---~ print(is_number("1.1")) ---~ print(is_number(".1")) ---~ print(is_number("-0.1")) ---~ print(is_number("+0.1")) ---~ print(is_number("-.1")) ---~ print(is_number("+.1")) - -function string:split_settings() -- no {} handling, see l-aux for lpeg variant - if find(self,"=") then - local t = { } - for k,v in gmatch(self,"(%a+)=([^%,]*)") do - t[k] = v - end - return t - else - return nil - end +function string.is_empty(str) + return not find(str,"%S") end local patterns_escapes = { - ["-"] = "%-", - ["."] = "%.", - ["+"] = "%+", - ["*"] = "%*", ["%"] = "%%", - ["("] = "%)", - [")"] = "%)", - ["["] = "%[", - ["]"] = "%]", + ["."] = "%.", + ["+"] = "%+", ["-"] = "%-", ["*"] = "%*", + ["["] = "%[", ["]"] = "%]", + ["("] = "%(", [")"] = "%)", + -- ["{"] = "%{", ["}"] = "%}" + -- ["^"] = "%^", ["$"] = "%$", } -function string:pattesc() - return (gsub(self,".",patterns_escapes)) -end - local simple_escapes = { ["-"] = "%-", ["."] = "%.", @@ -260,80 +130,30 @@ local simple_escapes = { ["*"] = ".*", } -function string:simpleesc() - return (gsub(self,".",simple_escapes)) -end - -function string:tohash() - local t = { } - for s in gmatch(self,"([^, ]+)") do -- lpeg - t[s] = true - end - return t -end - -local pattern = lpeg.Ct(lpeg.C(1)^0) - -function string:totable() - return lpegmatch(pattern,self) +function string.escapedpattern(str,simple) + return (gsub(str,".",simple and simple_escapes or patterns_escapes)) end ---~ local t = { ---~ "1234567123456712345671234567", ---~ "a\tb\tc", ---~ "aa\tbb\tcc", ---~ "aaa\tbbb\tccc", ---~ "aaaa\tbbbb\tcccc", ---~ "aaaaa\tbbbbb\tccccc", ---~ "aaaaaa\tbbbbbb\tcccccc", ---~ } ---~ for k,v do ---~ print(string.tabtospace(t[k])) ---~ end - -function string.tabtospace(str,tab) - -- we don't handle embedded newlines - while true do - local s = find(str,"\t") - if s then - if not tab then tab = 7 end -- only when found - local d = tab-(s-1) % tab - if d > 0 then - str = gsub(str,"\t",rep(" ",d),1) - else - str = gsub(str,"\t","",1) - end +function string.topattern(str,lowercase,strict) + if str == "" then + return ".*" + else + str = gsub(str,".",simple_escapes) + if lowercase then + str = lower(str) + end + if strict then + return "^" .. str .. "$" else - break + return str end end - return str end -function string:compactlong() -- strips newlines and leading spaces - self = gsub(self,"[\n\r]+ *","") - self = gsub(self,"^ *","") - return self -end - -function string:striplong() -- strips newlines and leading spaces - self = gsub(self,"^%s*","") - self = gsub(self,"[\n\r]+ *","\n") - return self -end +-- obsolete names: -function string:topattern(lowercase,strict) - if lowercase then - self = lower(self) - end - self = gsub(self,".",simple_escapes) - if self == "" then - self = ".*" - elseif strict then - self = "^" .. self .. "$" - end - return self -end +string.quote = string.quoted +string.unquote = string.unquoted end -- of closure @@ -350,28 +170,75 @@ if not modules then modules = { } end modules ['l-lpeg'] = { local lpeg = require("lpeg") +local type = type + +-- Beware, we predefine a bunch of patterns here and one reason for doing so +-- is that we get consistent behaviour in some of the visualizers. + lpeg.patterns = lpeg.patterns or { } -- so that we can share local patterns = lpeg.patterns -local P, R, S, Ct, C, Cs, Cc, V = lpeg.P, lpeg.R, lpeg.S, lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.V -local match = lpeg.match +local P, R, S, V, match = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.match +local Ct, C, Cs, Cc = lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc +local lpegtype = lpeg.type + +local utfcharacters = string.utfcharacters +local utfgmatch = unicode and unicode.utf8.gmatch + +local anything = P(1) +local endofstring = P(-1) +local alwaysmatched = P(true) + +patterns.anything = anything +patterns.endofstring = endofstring +patterns.beginofstring = alwaysmatched +patterns.alwaysmatched = alwaysmatched local digit, sign = R('09'), S('+-') local cr, lf, crlf = P("\r"), P("\n"), P("\r\n") -local utf8byte = R("\128\191") +local newline = crlf + cr + lf +local escaped = P("\\") * anything +local squote = P("'") +local dquote = P('"') +local space = P(" ") + +local utfbom_32_be = P('\000\000\254\255') +local utfbom_32_le = P('\255\254\000\000') +local utfbom_16_be = P('\255\254') +local utfbom_16_le = P('\254\255') +local utfbom_8 = P('\239\187\191') +local utfbom = utfbom_32_be + utfbom_32_le + + utfbom_16_be + utfbom_16_le + + utfbom_8 +local utftype = utfbom_32_be / "utf-32-be" + utfbom_32_le / "utf-32-le" + + utfbom_16_be / "utf-16-be" + utfbom_16_le / "utf-16-le" + + utfbom_8 / "utf-8" + alwaysmatched / "unknown" + +local utf8next = R("\128\191") -patterns.utf8byte = utf8byte patterns.utf8one = R("\000\127") -patterns.utf8two = R("\194\223") * utf8byte -patterns.utf8three = R("\224\239") * utf8byte * utf8byte -patterns.utf8four = R("\240\244") * utf8byte * utf8byte * utf8byte +patterns.utf8two = R("\194\223") * utf8next +patterns.utf8three = R("\224\239") * utf8next * utf8next +patterns.utf8four = R("\240\244") * utf8next * utf8next * utf8next +patterns.utfbom = utfbom +patterns.utftype = utftype + +local utf8char = patterns.utf8one + patterns.utf8two + patterns.utf8three + patterns.utf8four +local validutf8char = utf8char^0 * endofstring * Cc(true) + Cc(false) + +patterns.utf8 = utf8char +patterns.utf8char = utf8char +patterns.validutf8 = validutf8char +patterns.validutf8char = validutf8char patterns.digit = digit patterns.sign = sign patterns.cardinal = sign^0 * digit^1 patterns.integer = sign^0 * digit^1 patterns.float = sign^0 * digit^0 * P('.') * digit^1 +patterns.cfloat = sign^0 * digit^0 * P(',') * digit^1 patterns.number = patterns.float + patterns.integer +patterns.cnumber = patterns.cfloat + patterns.integer patterns.oct = P("0") * R("07")^1 patterns.octal = patterns.oct patterns.HEX = P("0x") * R("09","AF")^1 @@ -380,16 +247,42 @@ patterns.hexadecimal = P("0x") * R("09","AF","af")^1 patterns.lowercase = R("az") patterns.uppercase = R("AZ") patterns.letter = patterns.lowercase + patterns.uppercase -patterns.space = S(" ") +patterns.space = space +patterns.tab = P("\t") +patterns.spaceortab = patterns.space + patterns.tab patterns.eol = S("\n\r") patterns.spacer = S(" \t\f\v") -- + string.char(0xc2, 0xa0) if we want utf (cf mail roberto) -patterns.newline = crlf + cr + lf -patterns.nonspace = 1 - patterns.space +patterns.newline = newline +patterns.emptyline = newline^1 patterns.nonspacer = 1 - patterns.spacer patterns.whitespace = patterns.eol + patterns.spacer patterns.nonwhitespace = 1 - patterns.whitespace -patterns.utf8 = patterns.utf8one + patterns.utf8two + patterns.utf8three + patterns.utf8four -patterns.utfbom = P('\000\000\254\255') + P('\255\254\000\000') + P('\255\254') + P('\254\255') + P('\239\187\191') +patterns.equal = P("=") +patterns.comma = P(",") +patterns.commaspacer = P(",") * patterns.spacer^0 +patterns.period = P(".") +patterns.colon = P(":") +patterns.semicolon = P(";") +patterns.underscore = P("_") +patterns.escaped = escaped +patterns.squote = squote +patterns.dquote = dquote +patterns.nosquote = (escaped + (1-squote))^0 +patterns.nodquote = (escaped + (1-dquote))^0 +patterns.unsingle = (squote/"") * patterns.nosquote * (squote/"") +patterns.undouble = (dquote/"") * patterns.nodquote * (dquote/"") +patterns.unquoted = patterns.undouble + patterns.unsingle -- more often undouble +patterns.unspacer = ((patterns.spacer^1)/"")^0 + +patterns.somecontent = (anything - newline - space)^1 -- (utf8char - newline - space)^1 +patterns.beginline = #(1-newline) + +local unquoted = Cs(patterns.unquoted * endofstring) -- not C + +function string.unquoted(str) + return match(unquoted,str) or str +end + function lpeg.anywhere(pattern) --slightly adapted from website return P { P(pattern) + 1 * V(1) } -- why so complex? @@ -399,36 +292,18 @@ function lpeg.splitter(pattern, action) return (((1-P(pattern))^1)/action+1)^0 end -local spacing = patterns.spacer^0 * patterns.newline -- sort of strip -local empty = spacing * Cc("") -local nonempty = Cs((1-spacing)^1) * spacing^-1 -local content = (empty + nonempty)^1 - -local capture = Ct(content^0) - -function string:splitlines() - return match(capture,self) -end - -patterns.textline = content - ---~ local p = lpeg.splitat("->",false) print(match(p,"oeps->what->more")) -- oeps what more ---~ local p = lpeg.splitat("->",true) print(match(p,"oeps->what->more")) -- oeps what->more ---~ local p = lpeg.splitat("->",false) print(match(p,"oeps")) -- oeps ---~ local p = lpeg.splitat("->",true) print(match(p,"oeps")) -- oeps - local splitters_s, splitters_m = { }, { } local function splitat(separator,single) local splitter = (single and splitters_s[separator]) or splitters_m[separator] if not splitter then separator = P(separator) + local other = C((1 - separator)^0) if single then - local other, any = C((1 - separator)^0), P(1) + local any = anything splitter = other * (separator * C(any^0) + "") -- ? splitters_s[separator] = splitter else - local other = C((1 - separator)^0) splitter = other * (separator * other)^0 splitters_m[separator] = splitter end @@ -438,6 +313,7 @@ end lpeg.splitat = splitat + local cache = { } function lpeg.split(separator,str) @@ -449,16 +325,39 @@ function lpeg.split(separator,str) return match(c,str) end -function string:split(separator) +function string.split(str,separator) local c = cache[separator] if not c then c = Ct(splitat(separator)) cache[separator] = c end - return match(c,self) + return match(c,str) +end + +local spacing = patterns.spacer^0 * newline -- sort of strip +local empty = spacing * Cc("") +local nonempty = Cs((1-spacing)^1) * spacing^-1 +local content = (empty + nonempty)^1 + +patterns.textline = content + + +local linesplitter = Ct(splitat(newline)) + +patterns.linesplitter = linesplitter + +function string.splitlines(str) + return match(linesplitter,str) +end + +local utflinesplitter = utfbom^-1 * Ct(splitat(newline)) + +patterns.utflinesplitter = utflinesplitter + +function string.utfsplitlines(str) + return match(utflinesplitter,str) end -lpeg.splitters = cache local cache = { } @@ -466,37 +365,24 @@ function lpeg.checkedsplit(separator,str) local c = cache[separator] if not c then separator = P(separator) - local other = C((1 - separator)^0) + local other = C((1 - separator)^1) c = Ct(separator^0 * other * (separator^1 * other)^0) cache[separator] = c end return match(c,str) end -function string:checkedsplit(separator) +function string.checkedsplit(str,separator) local c = cache[separator] if not c then separator = P(separator) - local other = C((1 - separator)^0) + local other = C((1 - separator)^1) c = Ct(separator^0 * other * (separator^1 * other)^0) cache[separator] = c end - return match(c,self) + return match(c,str) end ---~ function lpeg.append(list,pp) ---~ local p = pp ---~ for l=1,#list do ---~ if p then ---~ p = p + P(list[l]) ---~ else ---~ p = P(list[l]) ---~ end ---~ end ---~ return p ---~ end - ---~ from roberto's site: local f1 = string.byte @@ -504,170 +390,459 @@ local function f2(s) local c1, c2 = f1(s,1,2) return c1 * 64 + c2 local function f3(s) local c1, c2, c3 = f1(s,1,3) return (c1 * 64 + c2) * 64 + c3 - 925824 end local function f4(s) local c1, c2, c3, c4 = f1(s,1,4) return ((c1 * 64 + c2) * 64 + c3) * 64 + c4 - 63447168 end -patterns.utf8byte = patterns.utf8one/f1 + patterns.utf8two/f2 + patterns.utf8three/f3 + patterns.utf8four/f4 - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['l-table'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -table.join = table.concat +local utf8byte = patterns.utf8one/f1 + patterns.utf8two/f2 + patterns.utf8three/f3 + patterns.utf8four/f4 -local concat, sort, insert, remove = table.concat, table.sort, table.insert, table.remove -local format, find, gsub, lower, dump, match = string.format, string.find, string.gsub, string.lower, string.dump, string.match -local getmetatable, setmetatable = getmetatable, setmetatable -local type, next, tostring, tonumber, ipairs = type, next, tostring, tonumber, ipairs +patterns.utf8byte = utf8byte --- Starting with version 5.2 Lua no longer provide ipairs, which makes --- sense. As we already used the for loop and # in most places the --- impact on ConTeXt was not that large; the remaining ipairs already --- have been replaced. In a similar fashio we also hardly used pairs. --- --- Just in case, we provide the fallbacks as discussed in Programming --- in Lua (http://www.lua.org/pil/7.3.html): -if not ipairs then - -- for k, v in ipairs(t) do ... end - -- for k=1,#t do local v = t[k] ... end +local cache = { } - local function iterate(a,i) - i = i + 1 - local v = a[i] - if v ~= nil then - return i, v --, nil +function lpeg.stripper(str) + if type(str) == "string" then + local s = cache[str] + if not s then + s = Cs(((S(str)^1)/"" + 1)^0) + cache[str] = s end + return s + else + return Cs(((str^1)/"" + 1)^0) end - - function ipairs(a) - return iterate, a, 0 - end - end -if not pairs then - - -- for k, v in pairs(t) do ... end - -- for k, v in next, t do ... end +local cache = { } - function pairs(t) - return next, t -- , nil +function lpeg.keeper(str) + if type(str) == "string" then + local s = cache[str] + if not s then + s = Cs((((1-S(str))^1)/"" + 1)^0) + cache[str] = s + end + return s + else + return Cs((((1-str)^1)/"" + 1)^0) end - end --- Also, unpack has been moved to the table table, and for compatiility --- reasons we provide both now. +function lpeg.frontstripper(str) -- or pattern (yet undocumented) + return (P(str) + P(true)) * Cs(P(1)^0) +end -if not table.unpack then - table.unpack = _G.unpack -elseif not unpack then - _G.unpack = table.unpack +function lpeg.endstripper(str) -- or pattern (yet undocumented) + return Cs((1 - P(str) * P(-1))^0) end --- extra functions, some might go (when not used) +-- Just for fun I looked at the used bytecode and +-- p = (p and p + pp) or pp gets one more (testset). -function table.strip(tab) - local lst = { } - for i=1,#tab do - local s = gsub(tab[i],"^%s*(.-)%s*$","%1") - if s == "" then - -- skip this one - else - lst[#lst+1] = s +function lpeg.replacer(one,two) + if type(one) == "table" then + local no = #one + if no > 0 then + local p + for i=1,no do + local o = one[i] + local pp = P(o[1]) / o[2] + if p then + p = p + pp + else + p = pp + end + end + return Cs((p + 1)^0) end + else + two = two or "" + return Cs((P(one)/two + 1)^0) end - return lst end -function table.keys(t) - local k = { } - for key, _ in next, t do - k[#k+1] = key - end - return k -end +local splitters_f, splitters_s = { }, { } -local function compare(a,b) - return (tostring(a) < tostring(b)) +function lpeg.firstofsplit(separator) -- always return value + local splitter = splitters_f[separator] + if not splitter then + separator = P(separator) + splitter = C((1 - separator)^0) + splitters_f[separator] = splitter + end + return splitter end -local function sortedkeys(tab) - local srt, kind = { }, 0 -- 0=unknown 1=string, 2=number 3=mixed - for key,_ in next, tab do - srt[#srt+1] = key - if kind == 3 then - -- no further check - else - local tkey = type(key) - if tkey == "string" then - -- if kind == 2 then kind = 3 else kind = 1 end - kind = (kind == 2 and 3) or 1 - elseif tkey == "number" then - -- if kind == 1 then kind = 3 else kind = 2 end - kind = (kind == 1 and 3) or 2 - else - kind = 3 - end - end - end - if kind == 0 or kind == 3 then - sort(srt,compare) - else - sort(srt) +function lpeg.secondofsplit(separator) -- nil if not split + local splitter = splitters_s[separator] + if not splitter then + separator = P(separator) + splitter = (1 - separator)^0 * separator * C(anything^0) + splitters_s[separator] = splitter end - return srt + return splitter end -local function sortedhashkeys(tab) -- fast one - local srt = { } - for key,_ in next, tab do - srt[#srt+1] = key - end - sort(srt) - return srt +function lpeg.balancer(left,right) + left, right = P(left), P(right) + return P { left * ((1 - left - right) + V(1))^0 * right } end -table.sortedkeys = sortedkeys -table.sortedhashkeys = sortedhashkeys -function table.sortedhash(t) - local s = sortedhashkeys(t) -- maybe just sortedkeys - local n = 0 - local function kv(s) - n = n + 1 - local k = s[n] - return k, t[k] - end - return kv, s -end -table.sortedpairs = table.sortedhash +local nany = utf8char/"" -function table.append(t, list) - for _,v in next, list do - insert(t,v) +function lpeg.counter(pattern) + pattern = Cs((P(pattern)/" " + nany)^0) + return function(str) + return #match(pattern,str) end end -function table.prepend(t, list) - for k,v in next, list do - insert(t,k,v) - end -end +if utfgmatch then -function table.merge(t, ...) -- first one is target - t = t or {} - local lst = {...} - for i=1,#lst do + function lpeg.count(str,what) -- replaces string.count + if type(what) == "string" then + local n = 0 + for _ in utfgmatch(str,what) do + n = n + 1 + end + return n + else -- 4 times slower but still faster than / function + return #match(Cs((P(what)/" " + nany)^0),str) + end + end + +else + + local cache = { } + + function lpeg.count(str,what) -- replaces string.count + if type(what) == "string" then + local p = cache[what] + if not p then + p = Cs((P(what)/" " + nany)^0) + cache[p] = p + end + return #match(p,str) + else -- 4 times slower but still faster than / function + return #match(Cs((P(what)/" " + nany)^0),str) + end + end + +end + +local patterns_escapes = { -- also defines in l-string + ["%"] = "%%", + ["."] = "%.", + ["+"] = "%+", ["-"] = "%-", ["*"] = "%*", + ["["] = "%[", ["]"] = "%]", + ["("] = "%)", [")"] = "%)", + -- ["{"] = "%{", ["}"] = "%}" + -- ["^"] = "%^", ["$"] = "%$", +} + +local simple_escapes = { -- also defines in l-string + ["-"] = "%-", + ["."] = "%.", + ["?"] = ".", + ["*"] = ".*", +} + +local p = Cs((S("-.+*%()[]") / patterns_escapes + anything)^0) +local s = Cs((S("-.+*%()[]") / simple_escapes + anything)^0) + +function string.escapedpattern(str,simple) + return match(simple and s or p,str) +end + +-- utf extensies + +lpeg.UP = lpeg.P + +if utfcharacters then + + function lpeg.US(str) + local p + for uc in utfcharacters(str) do + if p then + p = p + P(uc) + else + p = P(uc) + end + end + return p + end + + +elseif utfgmatch then + + function lpeg.US(str) + local p + for uc in utfgmatch(str,".") do + if p then + p = p + P(uc) + else + p = P(uc) + end + end + return p + end + +else + + function lpeg.US(str) + local p + local f = function(uc) + if p then + p = p + P(uc) + else + p = P(uc) + end + end + match((utf8char/f)^0,str) + return p + end + +end + +local range = Cs(utf8byte) * (Cs(utf8byte) + Cc(false)) + +local utfchar = unicode and unicode.utf8 and unicode.utf8.char + +function lpeg.UR(str,more) + local first, last + if type(str) == "number" then + first = str + last = more or first + else + first, last = match(range,str) + if not last then + return P(str) + end + end + if first == last then + return P(str) + elseif utfchar and last - first < 8 then -- a somewhat arbitrary criterium + local p + for i=first,last do + if p then + p = p + P(utfchar(i)) + else + p = P(utfchar(i)) + end + end + return p -- nil when invalid range + else + local f = function(b) + return b >= first and b <= last + end + return utf8byte / f -- nil when invalid range + end +end + + + +function lpeg.oneof(list,...) -- lpeg.oneof("elseif","else","if","then") + if type(list) ~= "table" then + list = { list, ... } + end + -- sort(list) -- longest match first + local p = P(list[1]) + for l=2,#list do + p = p + P(list[l]) + end + return p +end + +function lpeg.is_lpeg(p) + return p and lpegtype(p) == "pattern" +end + + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['l-table'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local type, next, tostring, tonumber, ipairs, table, string = type, next, tostring, tonumber, ipairs, table, string +local concat, sort, insert, remove = table.concat, table.sort, table.insert, table.remove +local format, find, gsub, lower, dump, match = string.format, string.find, string.gsub, string.lower, string.dump, string.match +local getmetatable, setmetatable = getmetatable, setmetatable + +-- Starting with version 5.2 Lua no longer provide ipairs, which makes +-- sense. As we already used the for loop and # in most places the +-- impact on ConTeXt was not that large; the remaining ipairs already +-- have been replaced. In a similar fashio we also hardly used pairs. +-- +-- Just in case, we provide the fallbacks as discussed in Programming +-- in Lua (http://www.lua.org/pil/7.3.html): + +if not ipairs then + + -- for k, v in ipairs(t) do ... end + -- for k=1,#t do local v = t[k] ... end + + local function iterate(a,i) + i = i + 1 + local v = a[i] + if v ~= nil then + return i, v --, nil + end + end + + function ipairs(a) + return iterate, a, 0 + end + +end + +if not pairs then + + -- for k, v in pairs(t) do ... end + -- for k, v in next, t do ... end + + function pairs(t) + return next, t -- , nil + end + +end + +-- Also, unpack has been moved to the table table, and for compatiility +-- reasons we provide both now. + +if not table.unpack then + table.unpack = _G.unpack +elseif not unpack then + _G.unpack = table.unpack +end + +-- extra functions, some might go (when not used) + +function table.strip(tab) + local lst, l = { }, 0 + for i=1,#tab do + local s = gsub(tab[i],"^%s*(.-)%s*$","%1") + if s == "" then + -- skip this one + else + l = l + 1 + lst[l] = s + end + end + return lst +end + +function table.keys(t) + local keys, k = { }, 0 + for key, _ in next, t do + k = k + 1 + keys[k] = key + end + return keys +end + +local function compare(a,b) + local ta, tb = type(a), type(b) -- needed, else 11 < 2 + if ta == tb then + return a < b + else + return tostring(a) < tostring(b) + end +end + +local function sortedkeys(tab) + local srt, category, s = { }, 0, 0 -- 0=unknown 1=string, 2=number 3=mixed + for key,_ in next, tab do + s = s + 1 + srt[s] = key + if category == 3 then + -- no further check + else + local tkey = type(key) + if tkey == "string" then + category = (category == 2 and 3) or 1 + elseif tkey == "number" then + category = (category == 1 and 3) or 2 + else + category = 3 + end + end + end + if category == 0 or category == 3 then + sort(srt,compare) + else + sort(srt) + end + return srt +end + +local function sortedhashkeys(tab) -- fast one + local srt, s = { }, 0 + for key,_ in next, tab do + if key then + s= s + 1 + srt[s] = key + end + end + sort(srt) + return srt +end + +table.sortedkeys = sortedkeys +table.sortedhashkeys = sortedhashkeys + +local function nothing() end + +local function sortedhash(t) + if t then + local n, s = 0, sortedkeys(t) -- the robust one + local function kv(s) + n = n + 1 + local k = s[n] + return k, t[k] + end + return kv, s + else + return nothing + end +end + +table.sortedhash = sortedhash +table.sortedpairs = sortedhash + +function table.append(t, list) + local n = #t + for i=1,#list do + n = n + 1 + t[n] = list[i] + end + return t +end + +function table.prepend(t, list) + local nl = #list + local nt = nl + #t + for i=#t,1,-1 do + t[nt] = t[i] + nt = nt - 1 + end + for i=1,#list do + t[i] = list[i] + end + return t +end + +function table.merge(t, ...) -- first one is target + t = t or { } + local lst = { ... } + for i=1,#lst do for k, v in next, lst[i] do t[k] = v end @@ -676,7 +851,7 @@ function table.merge(t, ...) -- first one is target end function table.merged(...) - local tmp, lst = { }, {...} + local tmp, lst = { }, { ... } for i=1,#lst do for k, v in next, lst[i] do tmp[k] = v @@ -686,41 +861,45 @@ function table.merged(...) end function table.imerge(t, ...) - local lst = {...} + local lst, nt = { ... }, #t for i=1,#lst do local nst = lst[i] for j=1,#nst do - t[#t+1] = nst[j] + nt = nt + 1 + t[nt] = nst[j] end end return t end function table.imerged(...) - local tmp, lst = { }, {...} + local tmp, ntmp, lst = { }, 0, {...} for i=1,#lst do local nst = lst[i] for j=1,#nst do - tmp[#tmp+1] = nst[j] + ntmp = ntmp + 1 + tmp[ntmp] = nst[j] end end return tmp end -local function fastcopy(old) -- fast one +local function fastcopy(old,metatabletoo) -- fast one if old then local new = { } for k,v in next, old do if type(v) == "table" then - new[k] = fastcopy(v) -- was just table.copy + new[k] = fastcopy(v,metatabletoo) -- was just table.copy else new[k] = v end end - -- optional second arg - local mt = getmetatable(old) - if mt then - setmetatable(new,mt) + if metatabletoo then + -- optional second arg + local mt = getmetatable(old) + if mt then + setmetatable(new,mt) + end end return new else @@ -728,6 +907,8 @@ local function fastcopy(old) -- fast one end end +-- todo : copy without metatable + local function copy(t, tables) -- taken from lua wiki, slightly adapted tables = tables or { } local tcopy = {} @@ -760,33 +941,14 @@ end table.fastcopy = fastcopy table.copy = copy --- roughly: copy-loop : unpack : sub == 0.9 : 0.4 : 0.45 (so in critical apps, use unpack) - -function table.sub(t,i,j) - return { unpack(t,i,j) } -end - -function table.replace(a,b) - for k,v in next, b do - a[k] = v +function table.derive(parent) + local child = { } + if parent then + setmetatable(child,{ __index = parent }) end + return child end --- slower than #t on indexed tables (#t only returns the size of the numerically indexed slice) - -function table.is_empty(t) -- obolete, use inline code instead - return not t or not next(t) -end - -function table.one_entry(t) -- obolete, use inline code instead - local n = next(t) - return n and not next(t,n) -end - ---~ function table.starts_at(t) -- obsolete, not nice anyway ---~ return ipairs(t,1)(t,0) ---~ end - function table.tohash(t,value) local h = { } if t then @@ -799,27 +961,19 @@ function table.tohash(t,value) end function table.fromhash(t) - local h = { } + local hsh, h = { }, 0 for k, v in next, t do -- no ipairs here - if v then h[#h+1] = k end + if v then + h = h + 1 + hsh[h] = k + end end - return h + return hsh end ---~ print(table.serialize(t), "\n") ---~ print(table.serialize(t,"name"), "\n") ---~ print(table.serialize(t,false), "\n") ---~ print(table.serialize(t,true), "\n") ---~ print(table.serialize(t,"name",true), "\n") ---~ print(table.serialize(t,"name",true,true), "\n") - -table.serialize_functions = true -table.serialize_compact = true -table.serialize_inline = true - local noquotes, hexify, handle, reduce, compact, inline, functions -local reserved = table.tohash { -- intercept a language flaw, no reserved words as key +local reserved = table.tohash { -- intercept a language inconvenience: no reserved words as key 'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat', 'return', 'then', 'true', 'until', 'while', } @@ -831,20 +985,23 @@ local function simple_table(t) n = n + 1 end if n == #t then - local tt = { } + local tt, nt = { }, 0 for i=1,#t do local v = t[i] local tv = type(v) if tv == "number" then + nt = nt + 1 if hexify then - tt[#tt+1] = format("0x%04X",v) + tt[nt] = format("0x%04X",v) else - tt[#tt+1] = tostring(v) -- tostring not needed + tt[nt] = tostring(v) -- tostring not needed end elseif tv == "boolean" then - tt[#tt+1] = tostring(v) + nt = nt + 1 + tt[nt] = tostring(v) elseif tv == "string" then - tt[#tt+1] = format("%q",v) + nt = nt + 1 + tt[nt] = format("%q",v) else tt = nil break @@ -870,21 +1027,25 @@ local function do_serialize(root,name,depth,level,indexed) depth = depth .. " " if indexed then handle(format("%s{",depth)) - elseif name then - --~ handle(format("%s%s={",depth,key(name))) - if type(name) == "number" then -- or find(k,"^%d+$") then + else + local tn = type(name) + if tn == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s[0x%04X]={",depth,name)) else handle(format("%s[%s]={",depth,name)) end - elseif noquotes and not reserved[name] and find(name,"^%a[%w%_]*$") then - handle(format("%s%s={",depth,name)) + elseif tn == "string" then + if noquotes and not reserved[name] and find(name,"^%a[%w%_]*$") then + handle(format("%s%s={",depth,name)) + else + handle(format("%s[%q]={",depth,name)) + end + elseif tn == "boolean" then + handle(format("%s[%s]={",depth,tostring(name))) else - handle(format("%s[%q]={",depth,name)) + handle(format("%s{",depth)) end - else - handle(format("%s{",depth)) end end -- we could check for k (index) being number (cardinal) @@ -901,11 +1062,9 @@ local function do_serialize(root,name,depth,level,indexed) for i=1,#sk do local k = sk[i] local v = root[k] - --~ if v == root then - -- circular - --~ else - local t = type(v) - if compact and first and type(k) == "number" and k >= first and k <= last then + -- circular + local t, tk = type(v), type(k) + if compact and first and tk == "number" and k >= first and k <= last then if t == "number" then if hexify then handle(format("%s 0x%04X,",depth,v)) @@ -947,17 +1106,18 @@ local function do_serialize(root,name,depth,level,indexed) handle(format("%s __p__=nil,",depth)) end elseif t == "number" then - --~ if hexify then - --~ handle(format("%s %s=0x%04X,",depth,key(k),v)) - --~ else - --~ handle(format("%s %s=%s,",depth,key(k),v)) -- %.99g - --~ end - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=0x%04X,",depth,k,v)) else handle(format("%s [%s]=%s,",depth,k,v)) -- %.99g end + elseif tk == "boolean" then + if hexify then + handle(format("%s [%s]=0x%04X,",depth,tostring(k),v)) + else + handle(format("%s [%s]=%s,",depth,tostring(k),v)) -- %.99g + end elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then if hexify then handle(format("%s %s=0x%04X,",depth,k,v)) @@ -973,26 +1133,28 @@ local function do_serialize(root,name,depth,level,indexed) end elseif t == "string" then if reduce and tonumber(v) then - --~ handle(format("%s %s=%s,",depth,key(k),v)) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%s,",depth,k,v)) else handle(format("%s [%s]=%s,",depth,k,v)) end + elseif tk == "boolean" then + handle(format("%s [%s]=%s,",depth,tostring(k),v)) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%s,",depth,k,v)) else handle(format("%s [%q]=%s,",depth,k,v)) end else - --~ handle(format("%s %s=%q,",depth,key(k),v)) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%q,",depth,k,v)) else handle(format("%s [%s]=%q,",depth,k,v)) end + elseif tk == "boolean" then + handle(format("%s [%s]=%q,",depth,tostring(k),v)) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%q,",depth,k,v)) else @@ -1001,13 +1163,14 @@ local function do_serialize(root,name,depth,level,indexed) end elseif t == "table" then if not next(v) then - --~ handle(format("%s %s={},",depth,key(k))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]={},",depth,k)) else handle(format("%s [%s]={},",depth,k)) end + elseif tk == "boolean" then + handle(format("%s [%s]={},",depth,tostring(k))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s={},",depth,k)) else @@ -1016,13 +1179,14 @@ local function do_serialize(root,name,depth,level,indexed) elseif inline then local st = simple_table(v) if st then - --~ handle(format("%s %s={ %s },",depth,key(k),concat(st,", "))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]={ %s },",depth,k,concat(st,", "))) else handle(format("%s [%s]={ %s },",depth,k,concat(st,", "))) end + elseif tk == "boolean" then -- or find(k,"^%d+$") then + handle(format("%s [%s]={ %s },",depth,tostring(k),concat(st,", "))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s={ %s },",depth,k,concat(st,", "))) else @@ -1035,13 +1199,14 @@ local function do_serialize(root,name,depth,level,indexed) do_serialize(v,k,depth,level+1) end elseif t == "boolean" then - --~ handle(format("%s %s=%s,",depth,key(k),tostring(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%s,",depth,k,tostring(v))) else handle(format("%s [%s]=%s,",depth,k,tostring(v))) end + elseif tk == "boolean" then -- or find(k,"^%d+$") then + handle(format("%s [%s]=%s,",depth,tostring(k),tostring(v))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%s,",depth,k,tostring(v))) else @@ -1049,35 +1214,37 @@ local function do_serialize(root,name,depth,level,indexed) end elseif t == "function" then if functions then - --~ handle(format('%s %s=loadstring(%q),',depth,key(k),dump(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=loadstring(%q),",depth,k,dump(v))) else handle(format("%s [%s]=loadstring(%q),",depth,k,dump(v))) end + elseif tk == "boolean" then + handle(format("%s [%s]=loadstring(%q),",depth,tostring(k),dump(v))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=loadstring(%q),",depth,k,dump(v))) else - handle(format("%s [%q]=loadstring(%q),",depth,k,dump(v))) + -- handle(format("%s [%q]=loadstring(%q),",depth,k,dump(v))) + handle(format("%s [%q]=loadstring(%q),",depth,k,debug.getinfo(v).what == "C" and "C code" or dump(v))) end end else - --~ handle(format("%s %s=%q,",depth,key(k),tostring(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%q,",depth,k,tostring(v))) else handle(format("%s [%s]=%q,",depth,k,tostring(v))) end + elseif tk == "boolean" then -- or find(k,"^%d+$") then + handle(format("%s [%s]=%q,",depth,tostring(k),tostring(v))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%q,",depth,k,tostring(v))) else handle(format("%s [%q]=%q,",depth,k,tostring(v))) end end - --~ end - end + end end if level > 0 then handle(format("%s},",depth)) @@ -1087,15 +1254,34 @@ end -- replacing handle by a direct t[#t+1] = ... (plus test) is not much -- faster (0.03 on 1.00 for zapfino.tma) -local function serialize(root,name,_handle,_reduce,_noquotes,_hexify) - noquotes = _noquotes - hexify = _hexify - handle = _handle or print - reduce = _reduce or false - compact = table.serialize_compact - inline = compact and table.serialize_inline - functions = table.serialize_functions +local function serialize(_handle,root,name,specification) -- handle wins local tname = type(name) + if type(specification) == "table" then + noquotes = specification.noquotes + hexify = specification.hexify + handle = _handle or specification.handle or print + reduce = specification.reduce or false + functions = specification.functions + compact = specification.compact + inline = specification.inline and compact + if functions == nil then + functions = true + end + if compact == nil then + compact = true + end + if inline == nil then + inline = compact + end + else + noquotes = false + hexify = false + handle = _handle or print + reduce = false + compact = true + inline = true + functions = true + end if tname == "string" then if name == "return" then handle("return {") @@ -1117,33 +1303,33 @@ local function serialize(root,name,_handle,_reduce,_noquotes,_hexify) else handle("t={") end - if root and next(root) then - do_serialize(root,name,"",0,indexed) + if root then + -- The dummy access will initialize a table that has a delayed initialization + -- using a metatable. (maybe explicitly test for metatable) + if getmetatable(root) then -- todo: make this an option, maybe even per subtable + local dummy = root._w_h_a_t_e_v_e_r_ + root._w_h_a_t_e_v_e_r_ = nil + end + -- Let's forget about empty tables. + if next(root) then + do_serialize(root,name,"",0) + end end handle("}") end ---~ name: ---~ ---~ true : return { } ---~ false : { } ---~ nil : t = { } ---~ string : string = { } ---~ 'return' : return { } ---~ number : [number] = { } -function table.serialize(root,name,reduce,noquotes,hexify) - local t = { } +function table.serialize(root,name,specification) + local t, n = { }, 0 local function flush(s) - t[#t+1] = s + n = n + 1 + t[n] = s end - serialize(root,name,flush,reduce,noquotes,hexify) + serialize(flush,root,name,specification) return concat(t,"\n") end -function table.tohandle(handle,root,name,reduce,noquotes,hexify) - serialize(root,name,handle,reduce,noquotes,hexify) -end +table.tohandle = serialize -- sometimes tables are real use (zapfino extra pro is some 85M) in which -- case a stepwise serialization is nice; actually, we could consider: @@ -1154,73 +1340,63 @@ end -- -- so this is on the todo list -table.tofile_maxtab = 2*1024 +local maxtab = 2*1024 -function table.tofile(filename,root,name,reduce,noquotes,hexify) +function table.tofile(filename,root,name,specification) local f = io.open(filename,'w') if f then - local maxtab = table.tofile_maxtab if maxtab > 1 then - local t = { } + local t, n = { }, 0 local function flush(s) - t[#t+1] = s - if #t > maxtab then + n = n + 1 + t[n] = s + if n > maxtab then f:write(concat(t,"\n"),"\n") -- hm, write(sometable) should be nice - t = { } + t, n = { }, 0 -- we could recycle t if needed end end - serialize(root,name,flush,reduce,noquotes,hexify) + serialize(flush,root,name,specification) f:write(concat(t,"\n"),"\n") else local function flush(s) f:write(s,"\n") end - serialize(root,name,flush,reduce,noquotes,hexify) + serialize(flush,root,name,specification) end f:close() + io.flush() end end -local function flatten(t,f,complete) -- is this used? meybe a variant with next, ... - for i=1,#t do - local v = t[i] - if type(v) == "table" then - if complete or type(v[1]) == "table" then - flatten(v,f,complete) +local function flattened(t,f,depth) + if f == nil then + f = { } + depth = 0xFFFF + elseif tonumber(f) then + -- assume then only two arguments are given + depth = f + f = { } + elseif not depth then + depth = 0xFFFF + end + for k, v in next, t do + if type(k) ~= "number" then + if depth > 0 and type(v) == "table" then + flattened(v,f,depth-1) else - f[#f+1] = v + f[k] = v end - else - f[#f+1] = v end end -end - -function table.flatten(t) - local f = { } - flatten(t,f,true) - return f -end - -function table.unnest(t) -- bad name - local f = { } - flatten(t,f,false) - return f -end - -table.flatten_one_level = table.unnest - --- a better one: - -local function flattened(t,f) - if not f then - f = { } - end - for k, v in next, t do - if type(v) == "table" then - flattened(v,f) + local n = #f + for k=1,#t do + local v = t[k] + if depth > 0 and type(v) == "table" then + flattened(v,f,depth-1) + n = #f else - f[k] = v + n = n + 1 + f[n] = v end end return f @@ -1228,49 +1404,27 @@ end table.flattened = flattened --- the next three may disappear - -function table.remove_value(t,value) -- todo: n - if value then - for i=1,#t do - if t[i] == value then - remove(t,i) - -- remove all, so no: return - end - end +local function unnest(t,f) -- only used in mk, for old times sake + if not f then -- and only relevant for token lists + f = { } end -end - -function table.insert_before_value(t,value,str) - if str then - if value then - for i=1,#t do - if t[i] == value then - insert(t,i,str) - return - end + for i=1,#t do + local v = t[i] + if type(v) == "table" then + if type(v[1]) == "table" then + unnest(v,f) + else + f[#f+1] = v end + else + f[#f+1] = v end - insert(t,1,str) - elseif value then - insert(t,1,value) end + return f end -function table.insert_after_value(t,value,str) - if str then - if value then - for i=1,#t do - if t[i] == value then - insert(t,i+1,str) - return - end - end - end - t[#t+1] = str - elseif value then - t[#t+1] = value - end +function table.unnest(t) -- bad name + return unnest(t) end local function are_equal(a,b,n,m) -- indexed @@ -1297,7 +1451,7 @@ end local function identical(a,b) -- assumes same structure for ka, va in next, a do - local vb = b[k] + local vb = b[ka] if va == vb then -- same elseif type(va) == "table" and type(vb) == "table" then @@ -1311,8 +1465,8 @@ local function identical(a,b) -- assumes same structure return true end -table.are_equal = are_equal table.identical = identical +table.are_equal = are_equal -- maybe also make a combined one @@ -1338,89 +1492,84 @@ function table.contains(t, v) end function table.count(t) - local n, e = 0, next(t) - while e do - n, e = n + 1, next(t,e) + local n = 0 + for k, v in next, t do + n = n + 1 end return n end -function table.swapped(t) - local s = { } +function table.swapped(t,s) -- hash + local n = { } + if s then + for k, v in next, s do + n[k] = v + end + end for k, v in next, t do - s[v] = k + n[v] = k end - return s + return n end ---~ function table.are_equal(a,b) ---~ return table.serialize(a) == table.serialize(b) ---~ end - -function table.clone(t,p) -- t is optional or nil or table - if not p then - t, p = { }, t or { } - elseif not t then - t = { } +function table.reversed(t) + if t then + local tt, tn = { }, #t + if tn > 0 then + local ttn = 0 + for i=tn,1,-1 do + ttn = ttn + 1 + tt[ttn] = t[i] + end + end + return tt end - setmetatable(t, { __index = function(_,key) return p[key] end }) -- why not __index = p ? - return t end -function table.hexed(t,seperator) - local tt = { } - for i=1,#t do tt[i] = format("0x%04X",t[i]) end - return concat(tt,seperator or " ") -end - -function table.reverse_hash(h) - local r = { } - for k,v in next, h do - r[v] = lower(gsub(k," ","")) +function table.sequenced(t,sep,simple) -- hash only + local s, n = { }, 0 + for k, v in sortedhash(t) do + if simple then + if v == true then + n = n + 1 + s[n] = k + elseif v and v~= "" then + n = n + 1 + s[n] = k .. "=" .. tostring(v) + end + else + n = n + 1 + s[n] = k .. "=" .. tostring(v) + end end - return r + return concat(s, sep or " | ") end -function table.reverse(t) - local tt = { } - if #t > 0 then - for i=#t,1,-1 do - tt[#tt+1] = t[i] - end +function table.print(t,...) + if type(t) ~= "table" then + print(tostring(t)) + else + table.tohandle(print,t,...) end - return tt end -function table.insert_before_value(t,value,extra) - for i=1,#t do - if t[i] == extra then - remove(t,i) - end - end - for i=1,#t do - if t[i] == value then - insert(t,i,extra) - return - end - end - insert(t,1,extra) +-- -- -- obsolete but we keep them for a while and might comment them later -- -- -- + +-- roughly: copy-loop : unpack : sub == 0.9 : 0.4 : 0.45 (so in critical apps, use unpack) + +function table.sub(t,i,j) + return { unpack(t,i,j) } end -function table.insert_after_value(t,value,extra) - for i=1,#t do - if t[i] == extra then - remove(t,i) - end - end - for i=1,#t do - if t[i] == value then - insert(t,i+1,extra) - return - end - end - insert(t,#t+1,extra) +-- slower than #t on indexed tables (#t only returns the size of the numerically indexed slice) + +function table.is_empty(t) + return not t or not next(t) end +function table.has_one_entry(t) + return t and not next(t,next(t)) +end end -- of closure @@ -1435,7 +1584,10 @@ if not modules then modules = { } end modules ['l-io'] = { license = "see context related readme files" } -local byte, find, gsub = string.byte, string.find, string.gsub +local io = io +local byte, find, gsub, format = string.byte, string.find, string.gsub, string.format +local concat = table.concat +local type = type if string.find(os.getenv("PATH"),";") then io.fileseparator, io.pathseparator = "\\", ";" @@ -1446,9 +1598,7 @@ end function io.loaddata(filename,textmode) local f = io.open(filename,(textmode and 'r') or 'rb') if f then - -- collectgarbage("step") -- sometimes makes a big difference in mem consumption local data = f:read('*all') - -- garbagecollector.check(data) f:close() return data else @@ -1460,13 +1610,14 @@ function io.savedata(filename,data,joiner) local f = io.open(filename,"wb") if f then if type(data) == "table" then - f:write(table.join(data,joiner or "")) + f:write(concat(data,joiner or "")) elseif type(data) == "function" then data(f) else f:write(data or "") end f:close() + io.flush() return true else return false @@ -1495,12 +1646,19 @@ function io.size(filename) end function io.noflines(f) - local n = 0 - for _ in f:lines() do - n = n + 1 + if type(f) == "string" then + local f = io.open(filename) + local n = f and io.noflines(f) or 0 + assert(f:close()) + return n + else + local n = 0 + for _ in f:lines() do + n = n + 1 + end + f:seek('set',0) + return n end - f:seek('set',0) - return n end local nextchar = { @@ -1526,8 +1684,6 @@ local nextchar = { function io.characters(f,n) if f then return nextchar[n or 1], f - else - return nil, nil end end @@ -1536,40 +1692,42 @@ local nextbyte = { local a, b, c, d = f:read(1,1,1,1) if d then return byte(a), byte(b), byte(c), byte(d) - else - return nil, nil, nil, nil + end + end, + [3] = function(f) + local a, b, c = f:read(1,1,1) + if b then + return byte(a), byte(b), byte(c) end end, [2] = function(f) local a, b = f:read(1,1) if b then return byte(a), byte(b) - else - return nil, nil end end, [1] = function (f) local a = f:read(1) if a then return byte(a) - else - return nil end end, [-2] = function (f) local a, b = f:read(1,1) if b then return byte(b), byte(a) - else - return nil, nil + end + end, + [-3] = function(f) + local a, b, c = f:read(1,1,1) + if b then + return byte(c), byte(b), byte(a) end end, [-4] = function(f) local a, b, c, d = f:read(1,1,1,1) if d then return byte(d), byte(c), byte(b), byte(a) - else - return nil, nil, nil, nil end end } @@ -1586,12 +1744,13 @@ function io.ask(question,default,options) while true do io.write(question) if options then - io.write(string.format(" [%s]",table.concat(options,"|"))) + io.write(format(" [%s]",concat(options,"|"))) end if default then - io.write(string.format(" [%s]",default)) + io.write(format(" [%s]",default)) end - io.write(string.format(" ")) + io.write(format(" ")) + io.flush() local answer = io.read() answer = gsub(answer,"^%s*(.*)%s*$","%1") if answer == "" and default then @@ -1615,6 +1774,63 @@ function io.ask(question,default,options) end end +local function readnumber(f,n,m) + if m then + f:seek("set",n) + n = m + end + if n == 1 then + return byte(f:read(1)) + elseif n == 2 then + local a, b = byte(f:read(2),1,2) + return 256 * a + b + elseif n == 3 then + local a, b, c = byte(f:read(3),1,3) + return 256*256 * a + 256 * b + c + elseif n == 4 then + local a, b, c, d = byte(f:read(4),1,4) + return 256*256*256 * a + 256*256 * b + 256 * c + d + elseif n == 8 then + local a, b = readnumber(f,4), readnumber(f,4) + return 256 * a + b + elseif n == 12 then + local a, b, c = readnumber(f,4), readnumber(f,4), readnumber(f,4) + return 256*256 * a + 256 * b + c + elseif n == -2 then + local b, a = byte(f:read(2),1,2) + return 256*a + b + elseif n == -3 then + local c, b, a = byte(f:read(3),1,3) + return 256*256 * a + 256 * b + c + elseif n == -4 then + local d, c, b, a = byte(f:read(4),1,4) + return 256*256*256 * a + 256*256 * b + 256*c + d + elseif n == -8 then + local h, g, f, e, d, c, b, a = byte(f:read(8),1,8) + return 256*256*256*256*256*256*256 * a + + 256*256*256*256*256*256 * b + + 256*256*256*256*256 * c + + 256*256*256*256 * d + + 256*256*256 * e + + 256*256 * f + + 256 * g + + h + else + return 0 + end +end + +io.readnumber = readnumber + +function io.readstring(f,n,m) + if m then + f:seek("set",n) + n = m + end + local str = gsub(f:read(n),"%z","") + return str +end + end -- of closure @@ -1628,11 +1844,15 @@ if not modules then modules = { } end modules ['l-number'] = { license = "see context related readme files" } +-- this module will be replaced when we have the bit library + local tostring = tostring -local format, floor, insert, match = string.format, math.floor, table.insert, string.match +local format, floor, match, rep = string.format, math.floor, string.match, string.rep +local concat, insert = table.concat, table.insert local lpegmatch = lpeg.match -number = number or { } +number = number or { } +local number = number -- a,b,c,d,e,f = number.toset(100101) @@ -1680,6 +1900,54 @@ function number.bits(n,zero) end +function number.bit(p) + return 2 ^ (p - 1) -- 1-based indexing +end + +function number.hasbit(x, p) -- typical call: if hasbit(x, bit(3)) then ... + return x % (p + p) >= p +end + +function number.setbit(x, p) + return hasbit(x, p) and x or x + p +end + +function number.clearbit(x, p) + return hasbit(x, p) and x - p or x +end + + +function number.tobitstring(n,m) + if n == 0 then + if m then + rep("00000000",m) + else + return "00000000" + end + else + local t = { } + while n > 0 do + insert(t,1,n % 2 > 0 and 1 or 0) + n = floor(n/2) + end + local nn = 8 - #t % 8 + if nn > 0 and nn < 8 then + for i=1,nn do + insert(t,1,0) + end + end + if m then + m = m * 8 - #t + if m > 0 then + insert(t,1,rep("0",m)) + end + end + return concat(t) + end +end + + + end -- of closure do -- create closure to overcome 200 locals limit @@ -1692,6 +1960,8 @@ if not modules then modules = { } end modules ['l-set'] = { license = "see context related readme files" } +-- This will become obsolete when we have the bitset library embedded. + set = set or { } local nums = { } @@ -1735,10 +2005,11 @@ function set.tolist(n) if n == 0 or not tabs[n] then return "" else - local t = { } + local t, n = { }, 0 for k, v in next, tabs[n] do if v then - t[#t+1] = k + n = n + 1 + t[n] = k end end return concat(t," ") @@ -1756,17 +2027,6 @@ function set.contains(n,s) end end ---~ local c = set.create{'aap','noot','mies'} ---~ local s = set.tonumber(c) ---~ local t = set.totable(s) ---~ print(t['aap']) ---~ local c = set.create{'zus','wim','jet'} ---~ local s = set.tonumber(c) ---~ local t = set.totable(s) ---~ print(t['aap']) ---~ print(t['jet']) ---~ print(set.contains(t,'jet')) ---~ print(set.contains(t,'aap')) @@ -1782,32 +2042,119 @@ if not modules then modules = { } end modules ['l-os'] = { license = "see context related readme files" } +-- This file deals with some operating system issues. Please don't bother me +-- with the pros and cons of operating systems as they all have their flaws +-- and benefits. Bashing one of them won't help solving problems and fixing +-- bugs faster and is a waste of time and energy. +-- +-- path separators: / or \ ... we can use / everywhere +-- suffixes : dll so exe ... no big deal +-- quotes : we can use "" in most cases +-- expansion : unless "" are used * might give side effects +-- piping/threads : somewhat different for each os +-- locations : specific user file locations and settings can change over time +-- +-- os.type : windows | unix (new, we already guessed os.platform) +-- os.name : windows | msdos | linux | macosx | solaris | .. | generic (new) +-- os.platform : extended os.name with architecture + -- maybe build io.flush in os.execute -local find, format, gsub = string.find, string.format, string.gsub +local os = os +local find, format, gsub, upper = string.find, string.format, string.gsub, string.upper +local concat = table.concat local random, ceil = math.random, math.ceil +local rawget, rawset, type, getmetatable, setmetatable, tonumber = rawget, rawset, type, getmetatable, setmetatable, tonumber + +-- The following code permits traversing the environment table, at least +-- in luatex. Internally all environment names are uppercase. + +if not os.__getenv__ then + + os.__getenv__ = os.getenv + os.__setenv__ = os.setenv + + if os.env then + + local osgetenv = os.getenv + local ossetenv = os.setenv + local osenv = os.env local _ = osenv.PATH -- initialize the table + + function os.setenv(k,v) + if v == nil then + v = "" + end + local K = upper(k) + osenv[K] = v + if type(v) == "table" then + v = concat(v,";") -- path + end + ossetenv(K,v) + end + + function os.getenv(k) + local K = upper(k) + local v = osenv[K] or osenv[k] or osgetenv(K) or osgetenv(k) + if v == "" then + return nil + else + return v + end + end + + else + + local ossetenv = os.setenv + local osgetenv = os.getenv + local osenv = { } + + function os.setenv(k,v) + if v == nil then + v = "" + end + local K = upper(k) + osenv[K] = v + end + + function os.getenv(k) + local K = upper(k) + local v = osenv[K] or osgetenv(K) or osgetenv(k) + if v == "" then + return nil + else + return v + end + end + + local function __index(t,k) + return os.getenv(k) + end + local function __newindex(t,k,v) + os.setenv(k,v) + end + + os.env = { } + + setmetatable(os.env, { __index = __index, __newindex = __newindex } ) + + end + +end + +-- end of environment hack -local execute, spawn, exec, ioflush = os.execute, os.spawn or os.execute, os.exec or os.execute, io.flush +local execute, spawn, exec, iopopen, ioflush = os.execute, os.spawn or os.execute, os.exec or os.execute, io.popen, io.flush function os.execute(...) ioflush() return execute(...) end function os.spawn (...) ioflush() return spawn (...) end function os.exec (...) ioflush() return exec (...) end +function io.popen (...) ioflush() return iopopen(...) end function os.resultof(command) - ioflush() -- else messed up logging local handle = io.popen(command,"r") - if not handle then - -- print("unknown command '".. command .. "' in os.resultof") - return "" - else - return handle:read("*all") or "" - end + return handle and handle:read("*all") or "" end ---~ os.type : windows | unix (new, we already guessed os.platform) ---~ os.name : windows | msdos | linux | macosx | solaris | .. | generic (new) ---~ os.platform : extended os.name with architecture - if not io.fileseparator then if find(os.getenv("PATH"),";") then io.fileseparator, io.pathseparator, os.type = "\\", ";", os.type or "mswin" @@ -1856,16 +2203,11 @@ function os.runtime() return os.gettimeofday() - startuptime end ---~ print(os.gettimeofday()-os.time()) ---~ os.sleep(1.234) ---~ print (">>",os.runtime()) ---~ print(os.date("%H:%M:%S",os.gettimeofday())) ---~ print(os.date("%H:%M:%S",os.time())) -- no need for function anymore as we have more clever code and helpers now -- this metatable trickery might as well disappear -os.resolvers = os.resolvers or { } +os.resolvers = os.resolvers or { } -- will become private local resolvers = os.resolvers @@ -1878,24 +2220,6 @@ end setmetatable(os,osmt) -if not os.setenv then - - -- we still store them but they won't be seen in - -- child processes although we might pass them some day - -- using command concatination - - local env, getenv = { }, os.getenv - - function os.setenv(k,v) - env[k] = v - end - - function os.getenv(k) - return env[k] or getenv(k) - end - -end - -- we can use HOSTTYPE on some platforms local name, platform = os.name or "linux", os.getenv("MTX_PLATFORM") or "" @@ -1935,7 +2259,7 @@ elseif os.type == "windows" then elseif name == "linux" then function os.resolvers.platform(t,k) - -- we sometims have HOSTTYPE set so let's check that first + -- we sometimes have HOSTTYPE set so let's check that first local platform, architecture = "", os.getenv("HOSTTYPE") or os.resultof("uname -m") or "" if find(architecture,"x86_64") then platform = "linux-64" @@ -2013,10 +2337,10 @@ elseif name == "freebsd" then elseif name == "kfreebsd" then function os.resolvers.platform(t,k) - -- we sometims have HOSTTYPE set so let's check that first + -- we sometimes have HOSTTYPE set so let's check that first local platform, architecture = "", os.getenv("HOSTTYPE") or os.resultof("uname -m") or "" if find(architecture,"x86_64") then - platform = "kfreebsd-64" + platform = "kfreebsd-amd64" else platform = "kfreebsd-i386" end @@ -2091,61 +2415,86 @@ if not modules then modules = { } end modules ['l-file'] = { -- needs a cleanup -file = file or { } +file = file or { } +local file = file -local concat = table.concat -local find, gmatch, match, gsub, sub, char = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char +local insert, concat = table.insert, table.concat +local find, gmatch, match, gsub, sub, char, lower = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char, string.lower local lpegmatch = lpeg.match +local getcurrentdir, attributes = lfs.currentdir, lfs.attributes -function file.removesuffix(filename) - return (gsub(filename,"%.[%a%d]+$","")) +local P, R, S, C, Cs, Cp, Cc = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc + +local function dirname(name,default) + return match(name,"^(.+)[/\\].-$") or (default or "") end -function file.addsuffix(filename, suffix) - if not suffix or suffix == "" then - return filename - elseif not find(filename,"%.[%a%d]+$") then - return filename .. "." .. suffix - else - return filename - end +local function basename(name) + return match(name,"^.+[/\\](.-)$") or name end -function file.replacesuffix(filename, suffix) - return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix +local function nameonly(name) + return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) end -function file.dirname(name,default) - return match(name,"^(.+)[/\\].-$") or (default or "") +local function extname(name,default) + return match(name,"^.+%.([^/\\]-)$") or default or "" end -function file.basename(name) - return match(name,"^.+[/\\](.-)$") or name +local function splitname(name) + local n, s = match(name,"^(.+)%.([^/\\]-)$") + return n or name, s or "" end -function file.nameonly(name) - return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) +file.basename = basename +file.dirname = dirname +file.nameonly = nameonly +file.extname = extname +file.suffix = extname + +function file.removesuffix(filename) + return (gsub(filename,"%.[%a%d]+$","")) end -function file.extname(name,default) - return match(name,"^.+%.([^/\\]-)$") or default or "" +function file.addsuffix(filename, suffix, criterium) + if not suffix or suffix == "" then + return filename + elseif criterium == true then + return filename .. "." .. suffix + elseif not criterium then + local n, s = splitname(filename) + if not s or s == "" then + return filename .. "." .. suffix + else + return filename + end + else + local n, s = splitname(filename) + if s and s ~= "" then + local t = type(criterium) + if t == "table" then + -- keep if in criterium + for i=1,#criterium do + if s == criterium[i] then + return filename + end + end + elseif t == "string" then + -- keep if criterium + if s == criterium then + return filename + end + end + end + return n .. "." .. suffix + end end -file.suffix = file.extname ---~ function file.join(...) ---~ local pth = concat({...},"/") ---~ pth = gsub(pth,"\\","/") ---~ local a, b = match(pth,"^(.*://)(.*)$") ---~ if a and b then ---~ return a .. gsub(b,"//+","/") ---~ end ---~ a, b = match(pth,"^(//)(.*)$") ---~ if a and b then ---~ return a .. gsub(b,"//+","/") ---~ end ---~ return (gsub(pth,"//+","/")) ---~ end +function file.replacesuffix(filename, suffix) + return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix +end + local trick_1 = char(1) local trick_2 = "^" .. trick_1 .. "/+" @@ -2173,60 +2522,37 @@ function file.join(...) return (gsub(pth,"//+","/")) end ---~ print(file.join("//","/y")) ---~ print(file.join("/","/y")) ---~ print(file.join("","/y")) ---~ print(file.join("/x/","/y")) ---~ print(file.join("x/","/y")) ---~ print(file.join("http://","/y")) ---~ print(file.join("http://a","/y")) ---~ print(file.join("http:///a","/y")) ---~ print(file.join("//nas-1","/y")) -function file.iswritable(name) - local a = lfs.attributes(name) or lfs.attributes(file.dirname(name,".")) +function file.is_writable(name) + local a = attributes(name) or attributes(dirname(name,".")) return a and sub(a.permissions,2,2) == "w" end -function file.isreadable(name) - local a = lfs.attributes(name) +function file.is_readable(name) + local a = attributes(name) return a and sub(a.permissions,1,1) == "r" end -file.is_readable = file.isreadable -file.is_writable = file.iswritable +file.isreadable = file.is_readable -- depricated +file.iswritable = file.is_writable -- depricated --- todo: lpeg - ---~ function file.split_path(str) ---~ local t = { } ---~ str = gsub(str,"\\", "/") ---~ str = gsub(str,"(%a):([;/])", "%1\001%2") ---~ for name in gmatch(str,"([^;:]+)") do ---~ if name ~= "" then ---~ t[#t+1] = gsub(name,"\001",":") ---~ end ---~ end ---~ return t ---~ end +-- todo: lpeg \\ / .. does not save much local checkedsplit = string.checkedsplit -function file.split_path(str,separator) +function file.splitpath(str,separator) -- string str = gsub(str,"\\","/") return checkedsplit(str,separator or io.pathseparator) end -function file.join_path(tab) - return concat(tab,io.pathseparator) -- can have trailing // +function file.joinpath(tab,separator) -- table + return concat(tab,separator or io.pathseparator) -- can have trailing // end -- we can hash them weakly -local insert = table.insert - -function file.collapse_path(str,anchor) +function file.collapsepath(str,anchor) if anchor and not find(str,"^/") and not find(str,"^%a:") then str = getcurrentdir() .. "/" .. str end @@ -2280,62 +2606,15 @@ function file.collapse_path(str,anchor) return concat(newelements, '/') end end -function file.xcollapse_path(str) - print('collapse', str) - if str == "" or str =="." then - return "." - elseif find(str,"^%.%.") then - return str - elseif not find(str,"%.") then - return str - end - str = gsub(str,"^%./",lfs.currentdir() .. "/") -- ./xx in qualified - str = gsub(str,"\\","/") - local oldelements = checkedsplit(str,"/") - local newelements = { } - local i = #oldelements - while i > 0 do - local element = oldelements[i] - if element == '.' then - -- do nothing - elseif element == '..' then - local n = i -1 - while n > 0 do - local element = oldelements[n] - if element ~= '..' and element ~= '.' then - oldelements[n] = '.' - break - else - n = n - 1 - end - end - if n<1 then - insert(newelements,1,'..') - end - elseif element ~= "" then - insert(newelements,1,element) - end - i = i - 1 - end - if #newelements == 0 then - return "." - elseif find(str,"^/") then - return "/" .. concat(newelements,'/') - else - return concat(newelements, '/') - end -end ---~ print(file.collapse_path("/a")) ---~ print(file.collapse_path("a/./b/..")) ---~ print(file.collapse_path("a/aa/../b/bb")) ---~ print(file.collapse_path("a/../..")) ---~ print(file.collapse_path("a/.././././b/..")) ---~ print(file.collapse_path("a/./././b/..")) ---~ print(file.collapse_path("a/b/c/../..")) -function file.robustname(str) - return (gsub(str,"[^%a%d%/%-%.\\]+","-")) +function file.robustname(str,strict) + str = gsub(str,"[^%a%d%/%-%.\\]+","-") + if strict then + return lower(gsub(str,"^%-*(.-)%-*$","%1")) + else + return str + end end file.readdata = io.loaddata @@ -2347,100 +2626,34 @@ end -- lpeg variants, slightly faster, not always ---~ local period = lpeg.P(".") ---~ local slashes = lpeg.S("\\/") ---~ local noperiod = 1-period ---~ local noslashes = 1-slashes ---~ local name = noperiod^1 - ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.C(noperiod^1) * -1 - ---~ function file.extname(name) ---~ return lpegmatch(pattern,name) or "" ---~ end - ---~ local pattern = lpeg.Cs(((period * noperiod^1 * -1)/"" + 1)^1) - ---~ function file.removesuffix(name) ---~ return lpegmatch(pattern,name) ---~ end - ---~ local pattern = (noslashes^0 * slashes)^1 * lpeg.C(noslashes^1) * -1 - ---~ function file.basename(name) ---~ return lpegmatch(pattern,name) or name ---~ end - ---~ local pattern = (noslashes^0 * slashes)^1 * lpeg.Cp() * noslashes^1 * -1 - ---~ function file.dirname(name) ---~ local p = lpegmatch(pattern,name) ---~ if p then ---~ return sub(name,1,p-2) ---~ else ---~ return "" ---~ end ---~ end - ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.Cp() * noperiod^1 * -1 - ---~ function file.addsuffix(name, suffix) ---~ local p = lpegmatch(pattern,name) ---~ if p then ---~ return name ---~ else ---~ return name .. "." .. suffix ---~ end ---~ end - ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.Cp() * noperiod^1 * -1 - ---~ function file.replacesuffix(name,suffix) ---~ local p = lpegmatch(pattern,name) ---~ if p then ---~ return sub(name,1,p-2) .. "." .. suffix ---~ else ---~ return name .. "." .. suffix ---~ end ---~ end - ---~ local pattern = (noslashes^0 * slashes)^0 * lpeg.Cp() * ((noperiod^1 * period)^1 * lpeg.Cp() + lpeg.P(true)) * noperiod^1 * -1 - ---~ function file.nameonly(name) ---~ local a, b = lpegmatch(pattern,name) ---~ if b then ---~ return sub(name,a,b-2) ---~ elseif a then ---~ return sub(name,a) ---~ else ---~ return name ---~ end ---~ end - ---~ local test = file.extname ---~ local test = file.basename ---~ local test = file.dirname ---~ local test = file.addsuffix ---~ local test = file.replacesuffix ---~ local test = file.nameonly - ---~ print(1,test("./a/b/c/abd.def.xxx","!!!")) ---~ print(2,test("./../b/c/abd.def.xxx","!!!")) ---~ print(3,test("a/b/c/abd.def.xxx","!!!")) ---~ print(4,test("a/b/c/def.xxx","!!!")) ---~ print(5,test("a/b/c/def","!!!")) ---~ print(6,test("def","!!!")) ---~ print(7,test("def.xxx","!!!")) - ---~ local tim = os.clock() for i=1,250000 do local ext = test("abd.def.xxx","!!!") end print(os.clock()-tim) + + + + + + + + + + + + + + + + + -- also rewrite previous -local letter = lpeg.R("az","AZ") + lpeg.S("_-+") -local separator = lpeg.P("://") +local letter = R("az","AZ") + S("_-+") +local separator = P("://") + +local qualified = P(".")^0 * P("/") + letter*P(":") + letter^1*separator + letter^1 * P("/") +local rootbased = P("/") + letter*P(":") -local qualified = lpeg.P(".")^0 * lpeg.P("/") + letter*lpeg.P(":") + letter^1*separator + letter^1 * lpeg.P("/") -local rootbased = lpeg.P("/") + letter*lpeg.P(":") +lpeg.patterns.qualified = qualified +lpeg.patterns.rootbased = rootbased -- ./name ../name /name c: :// name/name @@ -2452,14 +2665,16 @@ function file.is_rootbased_path(filename) return lpegmatch(rootbased,filename) ~= nil end -local slash = lpeg.S("\\/") -local period = lpeg.P(".") -local drive = lpeg.C(lpeg.R("az","AZ")) * lpeg.P(":") -local path = lpeg.C(((1-slash)^0 * slash)^0) -local suffix = period * lpeg.C(lpeg.P(1-period)^0 * lpeg.P(-1)) -local base = lpeg.C((1-suffix)^0) +-- actually these are schemes -local pattern = (drive + lpeg.Cc("")) * (path + lpeg.Cc("")) * (base + lpeg.Cc("")) * (suffix + lpeg.Cc("")) +local slash = S("\\/") +local period = P(".") +local drive = C(R("az","AZ")) * P(":") +local path = C(((1-slash)^0 * slash)^0) +local suffix = period * C(P(1-period)^0 * P(-1)) +local base = C((1-suffix)^0) + +local pattern = (drive + Cc("")) * (path + Cc("")) * (base + Cc("")) * (suffix + Cc("")) function file.splitname(str) -- returns drive, path, base, suffix return lpegmatch(pattern,str) @@ -2472,14 +2687,13 @@ end -- test { "/aa", "/aa/bb", "/aa/bb/cc", "/aa/bb/cc.dd", "/aa/bb/cc.dd.ee" } -- test { "aa", "aa/bb", "aa/bb/cc", "aa/bb/cc.dd", "aa/bb/cc.dd.ee" } ---~ -- todo: ---~ ---~ if os.type == "windows" then ---~ local currentdir = lfs.currentdir ---~ function lfs.currentdir() ---~ return (gsub(currentdir(),"\\","/")) ---~ end ---~ end + +-- for myself: + +function file.strip(name,dir) + local b, a = match(name,"^(.-)" .. dir .. "(.*)$") + return a ~= "" and a or name +end end -- of closure @@ -2495,6 +2709,7 @@ if not modules then modules = { } end modules ['l-md5'] = { -- This also provides file checksums and checkers. +local md5, file = md5, file local gsub, format, byte = string.gsub, string.format, string.byte local function convert(str,fmt) @@ -2505,27 +2720,13 @@ if not md5.HEX then function md5.HEX(str) return convert(str,"%02X") end end if not md5.hex then function md5.hex(str) return convert(str,"%02x") end end if not md5.dec then function md5.dec(str) return convert(str,"%03i") end end ---~ if not md5.HEX then ---~ local function remap(chr) return format("%02X",byte(chr)) end ---~ function md5.HEX(str) return (gsub(md5.sum(str),".",remap)) end ---~ end ---~ if not md5.hex then ---~ local function remap(chr) return format("%02x",byte(chr)) end ---~ function md5.hex(str) return (gsub(md5.sum(str),".",remap)) end ---~ end ---~ if not md5.dec then ---~ local function remap(chr) return format("%03i",byte(chr)) end ---~ function md5.dec(str) return (gsub(md5.sum(str),".",remap)) end ---~ end - -file.needs_updating_threshold = 1 - -function file.needs_updating(oldname,newname) -- size modification access change + +function file.needs_updating(oldname,newname,threshold) -- size modification access change local oldtime = lfs.attributes(oldname, modification) local newtime = lfs.attributes(newname, modification) if newtime >= oldtime then return false - elseif oldtime - newtime < file.needs_updating_threshold then + elseif oldtime - newtime < (threshold or 1) then return false else return true @@ -2572,86 +2773,171 @@ if not modules then modules = { } end modules ['l-url'] = { license = "see context related readme files" } -local char, gmatch, gsub = string.char, string.gmatch, string.gsub +local char, gmatch, gsub, format, byte, find = string.char, string.gmatch, string.gsub, string.format, string.byte, string.find +local concat = table.concat local tonumber, type = tonumber, type -local lpegmatch = lpeg.match +local P, C, R, S, Cs, Cc, Ct = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cs, lpeg.Cc, lpeg.Ct +local lpegmatch, lpegpatterns, replacer = lpeg.match, lpeg.patterns, lpeg.replacer --- from the spec (on the web): +-- from wikipedia: -- --- foo://example.com:8042/over/there?name=ferret#nose --- \_/ \______________/\_________/ \_________/ \__/ --- | | | | | --- scheme authority path query fragment --- | _____________________|__ --- / \ / \ --- urn:example:animal:ferret:nose +-- foo://username:password@example.com:8042/over/there/index.dtb?type=animal;name=narwhal#nose +-- \_/ \_______________/ \_________/ \__/ \___/ \_/ \______________________/ \__/ +-- | | | | | | | | +-- | userinfo hostname port | | query fragment +-- | \________________________________/\_____________|____|/ +-- scheme | | | | +-- | authority path | | +-- | | | +-- | path interpretable as filename +-- | ___________|____________ | +-- / \ / \ | +-- urn:example:animal:ferret:nose interpretable as extension + +url = url or { } +local url = url + +local tochar = function(s) return char(tonumber(s,16)) end + +local colon = P(":") +local qmark = P("?") +local hash = P("#") +local slash = P("/") +local percent = P("%") +local endofstring = P(-1) + +local hexdigit = R("09","AF","af") +local plus = P("+") +local nothing = Cc("") +local escaped = (plus / " ") + (percent * C(hexdigit * hexdigit) / tochar) -url = url or { } +-- we assume schemes with more than 1 character (in order to avoid problems with windows disks) -local function tochar(s) - return char(tonumber(s,16)) -end +local scheme = Cs((escaped+(1-colon-slash-qmark-hash))^2) * colon + nothing +local authority = slash * slash * Cs((escaped+(1- slash-qmark-hash))^0) + nothing +local path = slash * Cs((escaped+(1- qmark-hash))^0) + nothing +local query = qmark * Cs((escaped+(1- hash))^0) + nothing +local fragment = hash * Cs((escaped+(1- endofstring))^0) + nothing -local colon, qmark, hash, slash, percent, endofstring = lpeg.P(":"), lpeg.P("?"), lpeg.P("#"), lpeg.P("/"), lpeg.P("%"), lpeg.P(-1) +local validurl = scheme * authority * path * query * fragment +local parser = Ct(validurl) -local hexdigit = lpeg.R("09","AF","af") -local plus = lpeg.P("+") -local escaped = (plus / " ") + (percent * lpeg.C(hexdigit * hexdigit) / tochar) +lpegpatterns.url = validurl +lpegpatterns.urlsplitter = parser --- we assume schemes with more than 1 character (in order to avoid problems with windows disks) +local escapes = { } ; for i=0,255 do escapes[i] = format("%%%02X",i) end -local scheme = lpeg.Cs((escaped+(1-colon-slash-qmark-hash))^2) * colon + lpeg.Cc("") -local authority = slash * slash * lpeg.Cs((escaped+(1- slash-qmark-hash))^0) + lpeg.Cc("") -local path = slash * lpeg.Cs((escaped+(1- qmark-hash))^0) + lpeg.Cc("") -local query = qmark * lpeg.Cs((escaped+(1- hash))^0) + lpeg.Cc("") -local fragment = hash * lpeg.Cs((escaped+(1- endofstring))^0) + lpeg.Cc("") +local escaper = Cs((R("09","AZ","az") + S("-./_") + P(1) / escapes)^0) -local parser = lpeg.Ct(scheme * authority * path * query * fragment) +lpegpatterns.urlescaper = escaper -- todo: reconsider Ct as we can as well have five return values (saves a table) -- so we can have two parsers, one with and one without -function url.split(str) +local function split(str) return (type(str) == "string" and lpegmatch(parser,str)) or str end +local function hasscheme(str) + local scheme = lpegmatch(scheme,str) -- at least one character + return scheme and scheme ~= "" +end + -- todo: cache them -function url.hashed(str) - local s = url.split(str) +local rootletter = R("az","AZ") + + S("_-+") +local separator = P("://") +local qualified = P(".")^0 * P("/") + + rootletter * P(":") + + rootletter^1 * separator + + rootletter^1 * P("/") +local rootbased = P("/") + + rootletter * P(":") + +local barswapper = replacer("|",":") +local backslashswapper = replacer("\\","/") + +local function hashed(str) -- not yet ok (/test?test) + local s = split(str) local somescheme = s[1] ~= "" - return { - scheme = (somescheme and s[1]) or "file", - authority = s[2], - path = s[3], - query = s[4], - fragment = s[5], - original = str, - noscheme = not somescheme, - } + local somequery = s[4] ~= "" + if not somescheme and not somequery then + s = { + scheme = "file", + authority = "", + path = str, + query = "", + fragment = "", + original = str, + noscheme = true, + filename = str, + } + else -- not always a filename but handy anyway + local authority, path, filename = s[2], s[3] + if authority == "" then + filename = path + else + filename = authority .. "/" .. path + end + s = { + scheme = s[1], + authority = authority, + path = path, + query = s[4], + fragment = s[5], + original = str, + noscheme = false, + filename = filename, + } + end + return s end -function url.hasscheme(str) - return url.split(str)[1] ~= "" -end +-- Here we assume: +-- +-- files: /// = relative +-- files: //// = absolute (!) + -function url.addscheme(str,scheme) - return (url.hasscheme(str) and str) or ((scheme or "file:///") .. str) + +url.split = split +url.hasscheme = hasscheme +url.hashed = hashed + +function url.addscheme(str,scheme) -- no authority + if hasscheme(str) then + return str + elseif not scheme then + return "file:///" .. str + else + return scheme .. ":///" .. str + end end -function url.construct(hash) - local fullurl = hash.sheme .. "://".. hash.authority .. hash.path - if hash.query then - fullurl = fullurl .. "?".. hash.query +function url.construct(hash) -- dodo: we need to escape ! + local fullurl, f = { }, 0 + local scheme, authority, path, query, fragment = hash.scheme, hash.authority, hash.path, hash.query, hash.fragment + if scheme and scheme ~= "" then + f = f + 1 ; fullurl[f] = scheme .. "://" + end + if authority and authority ~= "" then + f = f + 1 ; fullurl[f] = authority + end + if path and path ~= "" then + f = f + 1 ; fullurl[f] = "/" .. path + end + if query and query ~= "" then + f = f + 1 ; fullurl[f] = "?".. query end - if hash.fragment then - fullurl = fullurl .. "?".. hash.fragment + if fragment and fragment ~= "" then + f = f + 1 ; fullurl[f] = "#".. fragment end - return fullurl + return lpegmatch(escaper,concat(fullurl)) end function url.filename(filename) - local t = url.hashed(filename) + local t = hashed(filename) return (t.scheme == "file" and (gsub(t.path,"^/([a-zA-Z])([:|])/)","%1:"))) or filename end @@ -2667,37 +2953,13 @@ function url.query(str) end end ---~ print(url.filename("file:///c:/oeps.txt")) ---~ print(url.filename("c:/oeps.txt")) ---~ print(url.filename("file:///oeps.txt")) ---~ print(url.filename("file:///etc/test.txt")) ---~ print(url.filename("/oeps.txt")) - ---~ from the spec on the web (sort of): ---~ ---~ function test(str) ---~ print(table.serialize(url.hashed(str))) ---~ end ---~ ---~ test("%56pass%20words") ---~ test("file:///c:/oeps.txt") ---~ test("file:///c|/oeps.txt") ---~ test("file:///etc/oeps.txt") ---~ test("file://./etc/oeps.txt") ---~ test("file:////etc/oeps.txt") ---~ test("ftp://ftp.is.co.za/rfc/rfc1808.txt") ---~ test("http://www.ietf.org/rfc/rfc2396.txt") ---~ test("ldap://[2001:db8::7]/c=GB?objectClass?one#what") ---~ test("mailto:John.Doe@example.com") ---~ test("news:comp.infosystems.www.servers.unix") ---~ test("tel:+1-816-555-1212") ---~ test("telnet://192.0.2.16:80/") ---~ test("urn:oasis:names:specification:docbook:dtd:xml:4.1.2") ---~ test("/etc/passwords") ---~ test("http://www.pragma-ade.com/spaced%20name") - ---~ test("zip:///oeps/oeps.zip#bla/bla.tex") ---~ test("zip:///oeps/oeps.zip?bla/bla.tex") + + + + + + + end -- of closure @@ -2712,35 +2974,53 @@ if not modules then modules = { } end modules ['l-dir'] = { license = "see context related readme files" } --- dir.expand_name will be merged with cleanpath and collapsepath +-- dir.expandname will be merged with cleanpath and collapsepath local type = type local find, gmatch, match, gsub = string.find, string.gmatch, string.match, string.gsub +local concat, insert, remove = table.concat, table.insert, table.remove local lpegmatch = lpeg.match +local P, S, R, C, Cc, Cs, Ct, Cv, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cv, lpeg.V + dir = dir or { } +local dir = dir +local lfs = lfs + +local attributes = lfs.attributes +local walkdir = lfs.dir +local isdir = lfs.isdir +local isfile = lfs.isfile +local mkdir = lfs.mkdir +local chdir = lfs.chdir +local currentdir = lfs.currentdir -- handy function dir.current() - return (gsub(lfs.currentdir(),"\\","/")) + return (gsub(currentdir(),"\\","/")) end --- optimizing for no string.find (*) does not save time +-- optimizing for no find (*) does not save time -local attributes = lfs.attributes -local walkdir = lfs.dir -local function glob_pattern(path,patt,recurse,action) - local ok, scanner +local lfsisdir = isdir + +local function isdir(path) + path = gsub(path,"[/\\]+$","") + return lfsisdir(path) +end + +lfs.isdir = isdir + +local function globpattern(path,patt,recurse,action) if path == "/" then - ok, scanner = xpcall(function() return walkdir(path..".") end, function() end) -- kepler safe - else - ok, scanner = xpcall(function() return walkdir(path) end, function() end) -- kepler safe + path = path .. "." + elseif not find(path,"/$") then + path = path .. '/' end - if ok and type(scanner) == "function" then - if not find(path,"/$") then path = path .. '/' end - for name in scanner do + if isdir(path) then -- lfs.isdir does not like trailing / + for name in walkdir(path) do -- lfs.dir accepts trailing / local full = path .. name local mode = attributes(full,'mode') if mode == 'file' then @@ -2748,15 +3028,15 @@ local function glob_pattern(path,patt,recurse,action) action(full) end elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then - glob_pattern(full,patt,recurse,action) + globpattern(full,patt,recurse,action) end end end end -dir.glob_pattern = glob_pattern +dir.globpattern = globpattern -local function collect_pattern(path,patt,recurse,result) +local function collectpattern(path,patt,recurse,result) local ok, scanner result = result or { } if path == "/" then @@ -2775,7 +3055,7 @@ local function collect_pattern(path,patt,recurse,result) result[name] = attr end elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then - attr.list = collect_pattern(full,patt,recurse) + attr.list = collectpattern(full,patt,recurse) result[name] = attr end end @@ -2783,9 +3063,7 @@ local function collect_pattern(path,patt,recurse,result) return result end -dir.collect_pattern = collect_pattern - -local P, S, R, C, Cc, Cs, Ct, Cv, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cv, lpeg.V +dir.collectpattern = collectpattern local pattern = Ct { [1] = (C(P(".") + P("/")^1) + C(R("az","AZ") * P(":") * P("/")^0) + Cc("./")) * V(2) * V(3), @@ -2809,16 +3087,16 @@ local function glob(str,t) for s=1,#str do glob(str[s],t) end - elseif lfs.isfile(str) then + elseif isfile(str) then t(str) else - local split = lpegmatch(pattern,str) + local split = lpegmatch(pattern,str) -- we could use the file splitter if split then local root, path, base = split[1], split[2], split[3] local recurse = find(base,"%*%*") local start = root .. path local result = lpegmatch(filter,start .. base) - glob_pattern(start,result,recurse,t) + globpattern(start,result,recurse,t) end end else @@ -2828,12 +3106,15 @@ local function glob(str,t) glob(str[s],t) end return t - elseif lfs.isfile(str) then - local t = t or { } - t[#t+1] = str - return t + elseif isfile(str) then + if t then + t[#t+1] = str + return t + else + return { str } + end else - local split = lpegmatch(pattern,str) + local split = lpegmatch(pattern,str) -- we could use the file splitter if split then local t = t or { } local action = action or function(name) t[#t+1] = name end @@ -2841,7 +3122,7 @@ local function glob(str,t) local recurse = find(base,"%*%*") local start = root .. path local result = lpegmatch(filter,start .. base) - glob_pattern(start,result,recurse,action) + globpattern(start,result,recurse,action) return t else return { } @@ -2852,18 +3133,14 @@ end dir.glob = glob ---~ list = dir.glob("**/*.tif") ---~ list = dir.glob("/**/*.tif") ---~ list = dir.glob("./**/*.tif") ---~ list = dir.glob("oeps/**/*.tif") ---~ list = dir.glob("/oeps/**/*.tif") local function globfiles(path,recurse,func,files) -- func == pattern or function if type(func) == "string" then - local s = func -- alas, we need this indirect way + local s = func func = function(name) return find(name,s) end end files = files or { } + local noffiles = #files for name in walkdir(path) do if find(name,"^%.") then --- skip @@ -2874,12 +3151,9 @@ local function globfiles(path,recurse,func,files) -- func == pattern or function globfiles(path .. "/" .. name,recurse,func,files) end elseif mode == "file" then - if func then - if func(name) then - files[#files+1] = path .. "/" .. name - end - else - files[#files+1] = path .. "/" .. name + if not func or func(name) then + noffiles = noffiles + 1 + files[noffiles] = path .. "/" .. name end end end @@ -2897,17 +3171,15 @@ dir.globfiles = globfiles -- print(dir.ls("*.tex")) function dir.ls(pattern) - return table.concat(glob(pattern),"\n") + return concat(glob(pattern),"\n") end ---~ mkdirs("temp") ---~ mkdirs("a/b/c") ---~ mkdirs(".","/a/b/c") ---~ mkdirs("a","b","c") local make_indeed = true -- false -if string.find(os.getenv("PATH"),";") then -- os.type == "windows" +local onwindows = os.type == "windows" or find(os.getenv("PATH"),";") + +if onwindows then function dir.mkdirs(...) local str, pth, t = "", "", { ... } @@ -2956,64 +3228,21 @@ if string.find(os.getenv("PATH"),";") then -- os.type == "windows" else pth = pth .. "/" .. s end - if make_indeed and not lfs.isdir(pth) then - lfs.mkdir(pth) - end - end - return pth, (lfs.isdir(pth) == true) - end - ---~ print(dir.mkdirs("","","a","c")) ---~ print(dir.mkdirs("a")) ---~ print(dir.mkdirs("a:")) ---~ print(dir.mkdirs("a:/b/c")) ---~ print(dir.mkdirs("a:b/c")) ---~ print(dir.mkdirs("a:/bbb/c")) ---~ print(dir.mkdirs("/a/b/c")) ---~ print(dir.mkdirs("/aaa/b/c")) ---~ print(dir.mkdirs("//a/b/c")) ---~ print(dir.mkdirs("///a/b/c")) ---~ print(dir.mkdirs("a/bbb//ccc/")) - - function dir.expand_name(str) -- will be merged with cleanpath and collapsepath - local first, nothing, last = match(str,"^(//)(//*)(.*)$") - if first then - first = dir.current() .. "/" - end - if not first then - first, last = match(str,"^(//)/*(.*)$") - end - if not first then - first, last = match(str,"^([a-zA-Z]:)(.*)$") - if first and not find(last,"^/") then - local d = lfs.currentdir() - if lfs.chdir(first) then - first = dir.current() - end - lfs.chdir(d) + if make_indeed and not isdir(pth) then + mkdir(pth) end end - if not first then - first, last = dir.current(), str - end - last = gsub(last,"//","/") - last = gsub(last,"/%./","/") - last = gsub(last,"^/*","") - first = gsub(first,"/*$","") - if last == "" then - return first - else - return first .. "/" .. last - end + return pth, (isdir(pth) == true) end + else function dir.mkdirs(...) local str, pth, t = "", "", { ... } for i=1,#t do local s = t[i] - if s ~= "" then + if s and s ~= "" then -- we catch nil and false if str ~= "" then str = str .. "/" .. s else @@ -3031,42 +3260,92 @@ else else pth = pth .. "/" .. s end - if make_indeed and not first and not lfs.isdir(pth) then - lfs.mkdir(pth) + if make_indeed and not first and not isdir(pth) then + mkdir(pth) end end else pth = "." for s in gmatch(str,"[^/]+") do pth = pth .. "/" .. s - if make_indeed and not lfs.isdir(pth) then - lfs.mkdir(pth) + if make_indeed and not isdir(pth) then + mkdir(pth) + end + end + end + return pth, (isdir(pth) == true) + end + + +end + +dir.makedirs = dir.mkdirs + +-- we can only define it here as it uses dir.current + +if onwindows then + + function dir.expandname(str) -- will be merged with cleanpath and collapsepath + local first, nothing, last = match(str,"^(//)(//*)(.*)$") + if first then + first = dir.current() .. "/" + end + if not first then + first, last = match(str,"^(//)/*(.*)$") + end + if not first then + first, last = match(str,"^([a-zA-Z]:)(.*)$") + if first and not find(last,"^/") then + local d = currentdir() + if chdir(first) then + first = dir.current() end + chdir(d) end end - return pth, (lfs.isdir(pth) == true) + if not first then + first, last = dir.current(), str + end + last = gsub(last,"//","/") + last = gsub(last,"/%./","/") + last = gsub(last,"^/*","") + first = gsub(first,"/*$","") + if last == "" or last == "." then + return first + else + return first .. "/" .. last + end end ---~ print(dir.mkdirs("","","a","c")) ---~ print(dir.mkdirs("a")) ---~ print(dir.mkdirs("/a/b/c")) ---~ print(dir.mkdirs("/aaa/b/c")) ---~ print(dir.mkdirs("//a/b/c")) ---~ print(dir.mkdirs("///a/b/c")) ---~ print(dir.mkdirs("a/bbb//ccc/")) +else - function dir.expand_name(str) -- will be merged with cleanpath and collapsepath + function dir.expandname(str) -- will be merged with cleanpath and collapsepath if not find(str,"^/") then - str = lfs.currentdir() .. "/" .. str + str = currentdir() .. "/" .. str end str = gsub(str,"//","/") str = gsub(str,"/%./","/") + str = gsub(str,"(.)/%.$","%1") return str end end -dir.makedirs = dir.mkdirs +file.expandname = dir.expandname -- for convenience + +local stack = { } + +function dir.push(newdir) + insert(stack,lfs.currentdir()) +end + +function dir.pop() + local d = remove(stack) + if d then + lfs.chdir(d) + end + return d +end end -- of closure @@ -3081,12 +3360,17 @@ if not modules then modules = { } end modules ['l-boolean'] = { license = "see context related readme files" } +local type, tonumber = type, tonumber + boolean = boolean or { } +local boolean = boolean -local type, tonumber = type, tonumber +-- function boolean.tonumber(b) +-- return b and 1 or 0 -- test and test and return or return +-- end function boolean.tonumber(b) - if b then return 1 else return 0 end + if b then return 1 else return 0 end -- test and return or return end function toboolean(str,tolerant) @@ -3110,7 +3394,9 @@ function toboolean(str,tolerant) end end -function string.is_boolean(str) +string.toboolean = toboolean + +function string.is_boolean(str,default) if type(str) == "string" then if str == "true" or str == "yes" or str == "on" or str == "t" then return true @@ -3118,15 +3404,7 @@ function string.is_boolean(str) return false end end - return nil -end - -function boolean.alwaystrue() - return true -end - -function boolean.falsetrue() - return false + return default end @@ -3134,7 +3412,7 @@ end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['l-math'] = { +if not modules then modules = { } end modules ['l-unicode'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -3142,228 +3420,290 @@ if not modules then modules = { } end modules ['l-math'] = { license = "see context related readme files" } -local floor, sin, cos, tan = math.floor, math.sin, math.cos, math.tan +if not unicode then -if not math.round then - function math.round(x) - return floor(x + 0.5) - end -end + unicode = { utf8 = { } } -if not math.div then - function math.div(n,m) - return floor(n/m) - end -end + local floor, char = math.floor, string.char -if not math.mod then - function math.mod(n,m) - return n % m + function unicode.utf8.utfchar(n) + if n < 0x80 then + return char(n) + elseif n < 0x800 then + return char( + 0xC0 + floor(n/0x40), + 0x80 + (n % 0x40) + ) + elseif n < 0x10000 then + return char( + 0xE0 + floor(n/0x1000), + 0x80 + (floor(n/0x40) % 0x40), + 0x80 + (n % 0x40) + ) + elseif n < 0x40000 then + return char( + 0xF0 + floor(n/0x40000), + 0x80 + floor(n/0x1000), + 0x80 + (floor(n/0x40) % 0x40), + 0x80 + (n % 0x40) + ) + else + -- return char( + -- 0xF1 + floor(n/0x1000000), + -- 0x80 + floor(n/0x40000), + -- 0x80 + floor(n/0x1000), + -- 0x80 + (floor(n/0x40) % 0x40), + -- 0x80 + (n % 0x40) + -- ) + return "?" + end end + end -local pipi = 2*math.pi/360 +local unicode = unicode -function math.sind(d) - return sin(d*pipi) -end - -function math.cosd(d) - return cos(d*pipi) -end - -function math.tand(d) - return tan(d*pipi) -end +utf = utf or unicode.utf8 +local concat = table.concat +local utfchar, utfbyte, utfgsub = utf.char, utf.byte, utf.gsub +local char, byte, find, bytepairs, utfvalues, format = string.char, string.byte, string.find, string.bytepairs, string.utfvalues, string.format +local type = type -end -- of closure +local utfsplitlines = string.utfsplitlines -do -- create closure to overcome 200 locals limit +-- 0 EF BB BF UTF-8 +-- 1 FF FE UTF-16-little-endian +-- 2 FE FF UTF-16-big-endian +-- 3 FF FE 00 00 UTF-32-little-endian +-- 4 00 00 FE FF UTF-32-big-endian -if not modules then modules = { } end modules ['l-utils'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" +unicode.utfname = { + [0] = 'utf-8', + [1] = 'utf-16-le', + [2] = 'utf-16-be', + [3] = 'utf-32-le', + [4] = 'utf-32-be' } --- hm, quite unreadable +-- \000 fails in <= 5.0 but is valid in >=5.1 where %z is depricated -local gsub = string.gsub -local concat = table.concat -local type, next = type, next +function unicode.utftype(f) + local str = f:read(4) + if not str then + f:seek('set') + return 0 + -- elseif find(str,"^%z%z\254\255") then -- depricated + -- elseif find(str,"^\000\000\254\255") then -- not permitted and bugged + elseif find(str,"\000\000\254\255",1,true) then -- seems to work okay (TH) + return 4 + -- elseif find(str,"^\255\254%z%z") then -- depricated + -- elseif find(str,"^\255\254\000\000") then -- not permitted and bugged + elseif find(str,"\255\254\000\000",1,true) then -- seems to work okay (TH) + return 3 + elseif find(str,"^\254\255") then + f:seek('set',2) + return 2 + elseif find(str,"^\255\254") then + f:seek('set',2) + return 1 + elseif find(str,"^\239\187\191") then + f:seek('set',3) + return 0 + else + f:seek('set') + return 0 + end +end -if not utils then utils = { } end -if not utils.merger then utils.merger = { } end -if not utils.lua then utils.lua = { } end -utils.merger.m_begin = "begin library merge" -utils.merger.m_end = "end library merge" -utils.merger.pattern = - "%c+" .. - "%-%-%s+" .. utils.merger.m_begin .. - "%c+(.-)%c+" .. - "%-%-%s+" .. utils.merger.m_end .. - "%c+" -function utils.merger._self_fake_() - return - "-- " .. "created merged file" .. "\n\n" .. - "-- " .. utils.merger.m_begin .. "\n\n" .. - "-- " .. utils.merger.m_end .. "\n\n" +local function utf16_to_utf8_be(t) + if type(t) == "string" then + t = utfsplitlines(str) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, 0 + for left, right in bytepairs(t[i]) do + if right then + local now = 256*left + right + if more > 0 then + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 + more = 0 + r = r + 1 + result[r] = utfchar(now) + elseif now >= 0xD800 and now <= 0xDBFF then + more = now + else + r = r + 1 + result[r] = utfchar(now) + end + end + end + t[i] = concat(result,"",1,r) -- we reused tmp, hence t + end + return t end -function utils.report(...) - print(...) +local function utf16_to_utf8_le(t) + if type(t) == "string" then + t = utfsplitlines(str) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, 0 + for left, right in bytepairs(t[i]) do + if right then + local now = 256*right + left + if more > 0 then + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 + more = 0 + r = r + 1 + result[r] = utfchar(now) + elseif now >= 0xD800 and now <= 0xDBFF then + more = now + else + r = r + 1 + result[r] = utfchar(now) + end + end + end + t[i] = concat(result,"",1,r) -- we reused tmp, hence t + end + return t end -utils.merger.strip_comment = true - -function utils.merger._self_load_(name) - local f, data = io.open(name), "" - if f then - utils.report("reading merge from %s",name) - data = f:read("*all") - f:close() - else - utils.report("unknown file to merge %s",name) +local function utf32_to_utf8_be(str) + if type(t) == "string" then + t = utfsplitlines(str) end - if data and utils.merger.strip_comment then - -- saves some 20K - data = gsub(data,"%-%-~[^\n\r]*[\r\n]", "") + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, -1 + for a,b in bytepairs(str) do + if a and b then + if more < 0 then + more = 256*256*256*a + 256*256*b + else + r = r + 1 + result[t] = utfchar(more + 256*a + b) + more = -1 + end + else + break + end + end + t[i] = concat(result,"",1,r) end - return data or "" + return result end -function utils.merger._self_save_(name, data) - if data ~= "" then - local f = io.open(name,'w') - if f then - utils.report("saving merge from %s",name) - f:write(data) - f:close() +local function utf32_to_utf8_le(str) + if type(t) == "string" then + t = utfsplitlines(str) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, -1 + for a,b in bytepairs(str) do + if a and b then + if more < 0 then + more = 256*b + a + else + r = r + 1 + result[t] = utfchar(more + 256*256*256*b + 256*256*a) + more = -1 + end + else + break + end end + t[i] = concat(result,"",1,r) end + return result end -function utils.merger._self_swap_(data,code) - if data ~= "" then - return (gsub(data,utils.merger.pattern, function(s) - return "\n\n" .. "-- "..utils.merger.m_begin .. "\n" .. code .. "\n" .. "-- "..utils.merger.m_end .. "\n\n" - end, 1)) +unicode.utf32_to_utf8_be = utf32_to_utf8_be +unicode.utf32_to_utf8_le = utf32_to_utf8_le +unicode.utf16_to_utf8_be = utf16_to_utf8_be +unicode.utf16_to_utf8_le = utf16_to_utf8_le + +function unicode.utf8_to_utf8(t) + return type(t) == "string" and utfsplitlines(t) or t +end + +function unicode.utf16_to_utf8(t,endian) + return endian and utf16_to_utf8_be(t) or utf16_to_utf8_le(t) or t +end + +function unicode.utf32_to_utf8(t,endian) + return endian and utf32_to_utf8_be(t) or utf32_to_utf8_le(t) or t +end + +local function little(c) + local b = byte(c) + if b < 0x10000 then + return char(b%256,b/256) else - return "" + b = b - 0x10000 + local b1, b2 = b/1024 + 0xD800, b%1024 + 0xDC00 + return char(b1%256,b1/256,b2%256,b2/256) end end ---~ stripper: ---~ ---~ data = gsub(data,"%-%-~[^\n]*\n","") ---~ data = gsub(data,"\n\n+","\n") - -function utils.merger._self_libs_(libs,list) - local result, f, frozen = { }, nil, false - result[#result+1] = "\n" - if type(libs) == 'string' then libs = { libs } end - if type(list) == 'string' then list = { list } end - local foundpath = nil - for i=1,#libs do - local lib = libs[i] - for j=1,#list do - local pth = gsub(list[j],"\\","/") -- file.clean_path - utils.report("checking library path %s",pth) - local name = pth .. "/" .. lib - if lfs.isfile(name) then - foundpath = pth - end - end - if foundpath then break end +local function big(c) + local b = byte(c) + if b < 0x10000 then + return char(b/256,b%256) + else + b = b - 0x10000 + local b1, b2 = b/1024 + 0xD800, b%1024 + 0xDC00 + return char(b1/256,b1%256,b2/256,b2%256) end - if foundpath then - utils.report("using library path %s",foundpath) - local right, wrong = { }, { } - for i=1,#libs do - local lib = libs[i] - local fullname = foundpath .. "/" .. lib - if lfs.isfile(fullname) then - -- right[#right+1] = lib - utils.report("merging library %s",fullname) - result[#result+1] = "do -- create closure to overcome 200 locals limit" - result[#result+1] = io.loaddata(fullname,true) - result[#result+1] = "end -- of closure" - else - -- wrong[#wrong+1] = lib - utils.report("no library %s",fullname) - end - end - if #right > 0 then - utils.report("merged libraries: %s",concat(right," ")) - end - if #wrong > 0 then - utils.report("skipped libraries: %s",concat(wrong," ")) - end +end + +function unicode.utf8_to_utf16(str,littleendian) + if littleendian then + return char(255,254) .. utfgsub(str,".",little) else - utils.report("no valid library path found") + return char(254,255) .. utfgsub(str,".",big) end - return concat(result, "\n\n") end -function utils.merger.selfcreate(libs,list,target) - if target then - utils.merger._self_save_( - target, - utils.merger._self_swap_( - utils.merger._self_fake_(), - utils.merger._self_libs_(libs,list) - ) - ) +function unicode.utfcodes(str) + local t, n = { }, 0 + for u in utfvalues(str) do + n = n + 1 + t[n] = format("0x%04X",u) end + return concat(t,separator or " ") end -function utils.merger.selfmerge(name,libs,list,target) - utils.merger._self_save_( - target or name, - utils.merger._self_swap_( - utils.merger._self_load_(name), - utils.merger._self_libs_(libs,list) - ) - ) +function unicode.ustring(s) + return format("U+%05X",type(s) == "number" and s or utfbyte(s)) end -function utils.merger.selfclean(name) - utils.merger._self_save_( - name, - utils.merger._self_swap_( - utils.merger._self_load_(name), - "" - ) - ) +function unicode.xstring(s) + return format("0x%05X",type(s) == "number" and s or utfbyte(s)) end -function utils.lua.compile(luafile, lucfile, cleanup, strip) -- defaults: cleanup=false strip=true - -- utils.report("compiling",luafile,"into",lucfile) - os.remove(lucfile) - local command = "-o " .. string.quote(lucfile) .. " " .. string.quote(luafile) - if strip ~= false then - command = "-s " .. command - end - local done = (os.spawn("texluac " .. command) == 0) or (os.spawn("luac " .. command) == 0) - if done and cleanup == true and lfs.isfile(lucfile) and lfs.isfile(luafile) then - -- utils.report("removing",luafile) - os.remove(luafile) - end - return done + +local lpegmatch = lpeg.match +local utftype = lpeg.patterns.utftype + +function unicode.filetype(data) + return data and lpegmatch(utftype,data) or "unknown" end + end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['l-aux'] = { +if not modules then modules = { } end modules ['l-math'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -3371,606 +3711,2538 @@ if not modules then modules = { } end modules ['l-aux'] = { license = "see context related readme files" } --- for inline, no store split : for s in string.gmatch(str,",* *([^,]+)") do .. end - -aux = aux or { } +local floor, sin, cos, tan = math.floor, math.sin, math.cos, math.tan -local concat, format, gmatch = table.concat, string.format, string.gmatch -local tostring, type = tostring, type -local lpegmatch = lpeg.match +if not math.round then + function math.round(x) return floor(x + 0.5) end +end -local P, R, V = lpeg.P, lpeg.R, lpeg.V +if not math.div then + function math.div(n,m) return floor(n/m) end +end -local escape, left, right = P("\\"), P('{'), P('}') +if not math.mod then + function math.mod(n,m) return n % m end +end -lpeg.patterns.balanced = P { - [1] = ((escape * (left+right)) + (1 - (left+right)) + V(2))^0, - [2] = left * V(1) * right -} +local pipi = 2*math.pi/360 -local space = lpeg.P(' ') -local equal = lpeg.P("=") -local comma = lpeg.P(",") -local lbrace = lpeg.P("{") -local rbrace = lpeg.P("}") -local nobrace = 1 - (lbrace+rbrace) -local nested = lpeg.P { lbrace * (nobrace + lpeg.V(1))^0 * rbrace } -local spaces = space^0 +if not math.sind then + function math.sind(d) return sin(d*pipi) end + function math.cosd(d) return cos(d*pipi) end + function math.tand(d) return tan(d*pipi) end +end -local value = lpeg.P(lbrace * lpeg.C((nobrace + nested)^0) * rbrace) + lpeg.C((nested + (1-comma))^0) +if not math.odd then + function math.odd (n) return n % 2 == 0 end + function math.even(n) return n % 2 ~= 0 end +end -local key = lpeg.C((1-equal-comma)^1) -local pattern_a = (space+comma)^0 * (key * equal * value + key * lpeg.C("")) -local pattern_c = (space+comma)^0 * (key * equal * value) -local key = lpeg.C((1-space-equal-comma)^1) -local pattern_b = spaces * comma^0 * spaces * (key * ((spaces * equal * spaces * value) + lpeg.C(""))) +end -- of closure --- "a=1, b=2, c=3, d={a{b,c}d}, e=12345, f=xx{a{b,c}d}xx, g={}" : outer {} removes, leading spaces ignored +do -- create closure to overcome 200 locals limit -local hash = { } +if not modules then modules = { } end modules ['util-tab'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} -local function set(key,value) -- using Carg is slower here - hash[key] = value -end +utilities = utilities or {} +utilities.tables = utilities.tables or { } +local tables = utilities.tables -local pattern_a_s = (pattern_a/set)^1 -local pattern_b_s = (pattern_b/set)^1 -local pattern_c_s = (pattern_c/set)^1 +local format, gmatch = string.format, string.gmatch +local concat, insert, remove = table.concat, table.insert, table.remove +local setmetatable, getmetatable, tonumber, tostring = setmetatable, getmetatable, tonumber, tostring -aux.settings_to_hash_pattern_a = pattern_a_s -aux.settings_to_hash_pattern_b = pattern_b_s -aux.settings_to_hash_pattern_c = pattern_c_s +function tables.definetable(target) -- defines undefined tables + local composed, t, n = nil, { }, 0 + for name in gmatch(target,"([^%.]+)") do + n = n + 1 + if composed then + composed = composed .. "." .. name + else + composed = name + end + t[n] = format("%s = %s or { }",composed,composed) + end + return concat(t,"\n") +end -function aux.make_settings_to_hash_pattern(set,how) - if how == "strict" then - return (pattern_c/set)^1 - elseif how == "tolerant" then - return (pattern_b/set)^1 - else - return (pattern_a/set)^1 +function tables.accesstable(target) + local t = _G + for name in gmatch(target,"([^%.]+)") do + t = t[name] end + return t end -function aux.settings_to_hash(str,existing) - if str and str ~= "" then - hash = existing or { } - if moretolerant then - lpegmatch(pattern_b_s,str) - else - lpegmatch(pattern_a_s,str) +function tables.removevalue(t,value) -- todo: n + if value then + for i=1,#t do + if t[i] == value then + remove(t,i) + -- remove all, so no: return + end end - return hash - else - return { } end end -function aux.settings_to_hash_tolerant(str,existing) - if str and str ~= "" then - hash = existing or { } - lpegmatch(pattern_b_s,str) - return hash - else - return { } +function tables.insertbeforevalue(t,value,extra) + for i=1,#t do + if t[i] == extra then + remove(t,i) + end end + for i=1,#t do + if t[i] == value then + insert(t,i,extra) + return + end + end + insert(t,1,extra) end -function aux.settings_to_hash_strict(str,existing) - if str and str ~= "" then - hash = existing or { } - lpegmatch(pattern_c_s,str) - return next(hash) and hash - else - return nil +function tables.insertaftervalue(t,value,extra) + for i=1,#t do + if t[i] == extra then + remove(t,i) + end + end + for i=1,#t do + if t[i] == value then + insert(t,i+1,extra) + return + end end + insert(t,#t+1,extra) end -local separator = comma * space^0 -local value = lpeg.P(lbrace * lpeg.C((nobrace + nested)^0) * rbrace) + lpeg.C((nested + (1-comma))^0) -local pattern = lpeg.Ct(value*(separator*value)^0) - --- "aap, {noot}, mies" : outer {} removes, leading spaces ignored - -aux.settings_to_array_pattern = pattern +-- experimental --- we could use a weak table as cache +local function toxml(t,d,result) + for k, v in table.sortedpairs(t) do + if type(v) == "table" then + result[#result+1] = format("%s<%s>",d,k) + toxml(v,d.." ",result) + result[#result+1] = format("%s",d,k) + elseif tonumber(k) then + result[#result+1] = format("%s%s",d,k,v,k) + else + result[#result+1] = format("%s<%s>%s",d,k,tostring(v),k) + end + end +end -function aux.settings_to_array(str) - if not str or str == "" then - return { } +function table.toxml(t,name,nobanner) + local noroot = name == false + local result = (nobanner or noroot) and { } or { "" } + if noroot then + toxml( t, "", result) else - return lpegmatch(pattern,str) + toxml( { [name or "root"] = t }, "", result) end + return concat(result,"\n") end -local function set(t,v) - t[#t+1] = v -end -local value = lpeg.P(lpeg.Carg(1)*value) / set -local pattern = value*(separator*value)^0 * lpeg.Carg(1) +end -- of closure -function aux.add_settings_to_array(t,str) - return lpegmatch(pattern,str,nil,t) -end +do -- create closure to overcome 200 locals limit -function aux.hash_to_string(h,separator,yes,no,strict,omit) - if h then - local t, s = { }, table.sortedkeys(h) - omit = omit and table.tohash(omit) - for i=1,#s do - local key = s[i] - if not omit or not omit[key] then - local value = h[key] - if type(value) == "boolean" then - if yes and no then - if value then - t[#t+1] = key .. '=' .. yes - elseif not strict then - t[#t+1] = key .. '=' .. no - end - elseif value or not strict then - t[#t+1] = key .. '=' .. tostring(value) - end - else - t[#t+1] = key .. '=' .. value - end - end - end - return concat(t,separator or ",") - else - return "" - end -end +if not modules then modules = { } end modules ['util-sto'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} -function aux.array_to_string(a,separator) - if a then - return concat(a,separator or ",") - else - return "" +local setmetatable, getmetatable = setmetatable, getmetatable + +utilities = utilities or { } +utilities.storage = utilities.storage or { } +local storage = utilities.storage + +function storage.mark(t) + if not t then + texio.write_nl("fatal error: storage '%s' cannot be marked",t) + os.exit() + end + local m = getmetatable(t) + if not m then + m = { } + setmetatable(t,m) end + m.__storage__ = true + return t end -function aux.settings_to_set(str,t) +function storage.allocate(t) t = t or { } - for s in gmatch(str,"%s*([^,]+)") do - t[s] = true + local m = getmetatable(t) + if not m then + m = { } + setmetatable(t,m) end + m.__storage__ = true return t end -local value = lbrace * lpeg.C((nobrace + nested)^0) * rbrace -local pattern = lpeg.Ct((space + value)^0) +function storage.marked(t) + local m = getmetatable(t) + return m and m.__storage__ +end -function aux.arguments_to_table(str) - return lpegmatch(pattern,str) +function storage.checked(t) + if not t then + texio.write_nl("fatal error: storage '%s' has not been allocated",t) + os.exit() + end + return t end --- temporary here -function aux.getparameters(self,class,parentclass,settings) - local sc = self[class] - if not sc then - sc = table.clone(self[parent]) - self[class] = sc +function storage.setinitializer(data,initialize) + local m = getmetatable(data) or { } + m.__index = function(data,k) + m.__index = nil -- so that we can access the entries during initializing + initialize() + return data[k] end - aux.settings_to_hash(settings,sc) + setmetatable(data, m) end --- temporary here +local keyisvalue = { __index = function(t,k) + t[k] = k + return k +end } -local digit = lpeg.R("09") -local period = lpeg.P(".") -local zero = lpeg.P("0") -local trailingzeros = zero^0 * -digit -- suggested by Roberto R -local case_1 = period * trailingzeros / "" -local case_2 = period * (digit - trailingzeros)^1 * (trailingzeros / "") -local number = digit^1 * (case_1 + case_2) -local stripper = lpeg.Cs((number + 1)^0) +function storage.sparse(t) + t = t or { } + setmetatable(t,keyisvalue) + return t +end ---~ local sample = "bla 11.00 bla 11 bla 0.1100 bla 1.00100 bla 0.00 bla 0.001 bla 1.1100 bla 0.100100100 bla 0.00100100100" ---~ collectgarbage("collect") ---~ str = string.rep(sample,10000) ---~ local ts = os.clock() ---~ lpegmatch(stripper,str) ---~ print(#str, os.clock()-ts, lpegmatch(stripper,sample)) +-- table namespace ? -lpeg.patterns.strip_zeros = stripper +local function f_empty () return "" end -- t,k +local function f_self (t,k) t[k] = k return k end +local function f_ignore() end -- t,k,v -function aux.strip_zeros(str) - return lpegmatch(stripper,str) -end +local t_empty = { __index = empty } +local t_self = { __index = self } +local t_ignore = { __newindex = ignore } -function aux.definetable(target) -- defines undefined tables - local composed, t = nil, { } - for name in gmatch(target,"([^%.]+)") do - if composed then - composed = composed .. "." .. name +function table.setmetatableindex(t,f) + local m = getmetatable(t) + if m then + if f == "empty" then + m.__index = f_empty + elseif f == "key" then + m.__index = f_self else - composed = name + m.__index = f + end + else + if f == "empty" then + setmetatable(t, t_empty) + elseif f == "key" then + setmetatable(t, t_self) + else + setmetatable(t,{ __index = f }) end - t[#t+1] = format("%s = %s or { }",composed,composed) end - return concat(t,"\n") end -function aux.accesstable(target) - local t = _G - for name in gmatch(target,"([^%.]+)") do - t = t[name] +function table.setmetatablenewindex(t,f) + local m = getmetatable(t) + if m then + if f == "ignore" then + m.__newindex = f_ignore + else + m.__newindex = f + end + else + if f == "ignore" then + setmetatable(t, t_ignore) + else + setmetatable(t,{ __newindex = f }) + end end - return t end ---~ function string.commaseparated(str) ---~ return gmatch(str,"([^,%s]+)") ---~ end +function table.setmetatablecall(t,f) + local m = getmetatable(t) + if m then + m.__call = f + else + setmetatable(t,{ __call = f }) + end +end --- as we use this a lot ... +function table.setmetatablekey(t,key,value) + local m = getmetatable(t) + if not m then + m = { } + setmetatable(t,m) + end + m[key] = value +end ---~ function aux.cachefunction(action,weak) ---~ local cache = { } ---~ if weak then ---~ setmetatable(cache, { __mode = "kv" } ) ---~ end ---~ local function reminder(str) ---~ local found = cache[str] ---~ if not found then ---~ found = action(str) ---~ cache[str] = found ---~ end ---~ return found ---~ end ---~ return reminder, cache ---~ end +function table.getmetatablekey(t,key,value) + local m = getmetatable(t) + return m and m[key] +end end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['trac-tra'] = { +if not modules then modules = { } end modules ['util-mrg'] = { version = 1.001, - comment = "companion to trac-tra.mkiv", + comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } --- the tag is kind of generic and used for functions that are not --- bound to a variable, like node.new, node.copy etc (contrary to for instance --- node.has_attribute which is bound to a has_attribute local variable in mkiv) - -local debug = require "debug" +-- hm, quite unreadable -local getinfo = debug.getinfo -local type, next = type, next +local gsub, format = string.gsub, string.format local concat = table.concat -local format, find, lower, gmatch, gsub = string.format, string.find, string.lower, string.gmatch, string.gsub - -debugger = debugger or { } +local type, next = type, next -local counters = { } -local names = { } +utilities = utilities or {} +utilities.merger = utilities.merger or { } -- maybe mergers +utilities.report = logs and logs.reporter("system") or print --- one +local merger = utilities.merger -local function hook() - local f = getinfo(2,"f").func - local n = getinfo(2,"Sn") --- if n.what == "C" and n.name then print (n.namewhat .. ': ' .. n.name) end - if f then - local cf = counters[f] - if cf == nil then - counters[f] = 1 - names[f] = n - else - counters[f] = cf + 1 - end - end -end -local function getname(func) - local n = names[func] - if n then - if n.what == "C" then - return n.name or '' - else - -- source short_src linedefined what name namewhat nups func - local name = n.name or n.namewhat or n.what - if not name or name == "" then name = "?" end - return format("%s : %s : %s", n.short_src or "unknown source", n.linedefined or "--", name) - end - else - return "unknown" - end -end -function debugger.showstats(printer,threshold) - printer = printer or texio.write or print - threshold = threshold or 0 - local total, grandtotal, functions = 0, 0, 0 - printer("\n") -- ugly but ok - -- table.sort(counters) - for func, count in next, counters do - if count > threshold then - local name = getname(func) - if not find(name,"for generator") then - printer(format("%8i %s", count, name)) - total = total + count - end - end - grandtotal = grandtotal + count - functions = functions + 1 - end - printer(format("functions: %s, total: %s, grand total: %s, threshold: %s\n", functions, total, grandtotal, threshold)) -end +merger.strip_comment = true --- two +local m_begin_merge = "begin library merge" +local m_end_merge = "end library merge" +local m_begin_closure = "do -- create closure to overcome 200 locals limit" +local m_end_closure = "end -- of closure" ---~ local function hook() ---~ local n = getinfo(2) ---~ if n.what=="C" and not n.name then ---~ local f = tostring(debug.traceback()) ---~ local cf = counters[f] ---~ if cf == nil then ---~ counters[f] = 1 ---~ names[f] = n ---~ else ---~ counters[f] = cf + 1 ---~ end ---~ end ---~ end ---~ function debugger.showstats(printer,threshold) ---~ printer = printer or texio.write or print ---~ threshold = threshold or 0 ---~ local total, grandtotal, functions = 0, 0, 0 ---~ printer("\n") -- ugly but ok ---~ -- table.sort(counters) ---~ for func, count in next, counters do ---~ if count > threshold then ---~ printer(format("%8i %s", count, func)) ---~ total = total + count ---~ end ---~ grandtotal = grandtotal + count ---~ functions = functions + 1 ---~ end ---~ printer(format("functions: %s, total: %s, grand total: %s, threshold: %s\n", functions, total, grandtotal, threshold)) ---~ end +local m_pattern = + "%c+" .. + "%-%-%s+" .. m_begin_merge .. + "%c+(.-)%c+" .. + "%-%-%s+" .. m_end_merge .. + "%c+" --- rest +local m_format = + "\n\n-- " .. m_begin_merge .. + "\n%s\n" .. + "-- " .. m_end_merge .. "\n\n" -function debugger.savestats(filename,threshold) - local f = io.open(filename,'w') - if f then - debugger.showstats(function(str) f:write(str) end,threshold) - f:close() - end -end +local m_faked = + "-- " .. "created merged file" .. "\n\n" .. + "-- " .. m_begin_merge .. "\n\n" .. + "-- " .. m_end_merge .. "\n\n" -function debugger.enable() - debug.sethook(hook,"c") +local function self_fake() + return m_faked end -function debugger.disable() - debug.sethook() ---~ counters[debug.getinfo(2,"f").func] = nil +local function self_nothing() + return "" end -function debugger.tracing() - local n = tonumber(os.env['MTX.TRACE.CALLS']) or tonumber(os.env['MTX_TRACE_CALLS']) or 0 - if n > 0 then - function debugger.tracing() return true end ; return true +local function self_load(name) + local data = io.loaddata(name) or "" + if data == "" then + utilities.report("merge: unknown file %s",name) else - function debugger.tracing() return false end ; return false + utilities.report("merge: inserting %s",name) end + return data or "" end ---~ debugger.enable() - ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) - ---~ debugger.disable() - ---~ print("") ---~ debugger.showstats() ---~ print("") ---~ debugger.showstats(print,3) - -setters = setters or { } -setters.data = setters.data or { } +local function self_save(name, data) + if data ~= "" then + if merger.strip_comment then + -- saves some 20K + local n = #data + data = gsub(data,"%-%-~[^\n\r]*[\r\n]","") + utilities.report("merge: %s bytes of comment stripped, %s bytes of code left",n-#data,#data) + end + io.savedata(name,data) + utilities.report("merge: saving %s",name) + end +end ---~ local function set(t,what,value) ---~ local data, done = t.data, t.done ---~ if type(what) == "string" then ---~ what = aux.settings_to_array(what) -- inefficient but ok ---~ end ---~ for i=1,#what do ---~ local w = what[i] ---~ for d, f in next, data do ---~ if done[d] then ---~ -- prevent recursion due to wildcards ---~ elseif find(d,w) then ---~ done[d] = true ---~ for i=1,#f do ---~ f[i](value) ---~ end ---~ end ---~ end ---~ end ---~ end +local function self_swap(data,code) + return data ~= "" and (gsub(data,m_pattern, function() return format(m_format,code) end, 1)) or "" +end -local function set(t,what,value) - local data, done = t.data, t.done - if type(what) == "string" then - what = aux.settings_to_hash(what) -- inefficient but ok - end - for w, v in next, what do - if v == "" then - v = value - else - v = toboolean(v) +local function self_libs(libs,list) + local result, f, frozen, foundpath = { }, nil, false, nil + result[#result+1] = "\n" + if type(libs) == 'string' then libs = { libs } end + if type(list) == 'string' then list = { list } end + for i=1,#libs do + local lib = libs[i] + for j=1,#list do + local pth = gsub(list[j],"\\","/") -- file.clean_path + utilities.report("merge: checking library path %s",pth) + local name = pth .. "/" .. lib + if lfs.isfile(name) then + foundpath = pth + end end - for d, f in next, data do - if done[d] then - -- prevent recursion due to wildcards - elseif find(d,w) then - done[d] = true - for i=1,#f do - f[i](v) - end + if foundpath then break end + end + if foundpath then + utilities.report("merge: using library path %s",foundpath) + local right, wrong = { }, { } + for i=1,#libs do + local lib = libs[i] + local fullname = foundpath .. "/" .. lib + if lfs.isfile(fullname) then + utilities.report("merge: using library %s",fullname) + right[#right+1] = lib + result[#result+1] = m_begin_closure + result[#result+1] = io.loaddata(fullname,true) + result[#result+1] = m_end_closure + else + utilities.report("merge: skipping library %s",fullname) + wrong[#wrong+1] = lib end end + if #right > 0 then + utilities.report("merge: used libraries: %s",concat(right," ")) + end + if #wrong > 0 then + utilities.report("merge: skipped libraries: %s",concat(wrong," ")) + end + else + utilities.report("merge: no valid library path found") end + return concat(result, "\n\n") end -local function reset(t) - for d, f in next, t.data do - for i=1,#f do - f[i](false) - end +function merger.selfcreate(libs,list,target) + if target then + self_save(target,self_swap(self_fake(),self_libs(libs,list))) end end -local function enable(t,what) - set(t,what,true) +function merger.selfmerge(name,libs,list,target) + self_save(target or name,self_swap(self_load(name),self_libs(libs,list))) end -local function disable(t,what) - local data = t.data - if not what or what == "" then - t.done = { } - reset(t) - else - set(t,what,false) - end +function merger.selfclean(name) + self_save(name,self_swap(self_load(name),self_nothing())) end -function setters.register(t,what,...) - local data = t.data - what = lower(what) - local w = data[what] - if not w then - w = { } - data[what] = w + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['util-lua'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +utilities = utilities or {} +utilities.lua = utilities.lua or { } +utilities.report = logs and logs.reporter("system") or print + +function utilities.lua.compile(luafile,lucfile,cleanup,strip) -- defaults: cleanup=false strip=true + utilities.report("lua: compiling %s into %s",luafile,lucfile) + os.remove(lucfile) + local command = "-o " .. string.quoted(lucfile) .. " " .. string.quoted(luafile) + if strip ~= false then + command = "-s " .. command end - for _, fnc in next, { ... } do - local typ = type(fnc) - if typ == "function" then - w[#w+1] = fnc - elseif typ == "string" then - w[#w+1] = function(value) set(t,fnc,value,nesting) end - end + local done = os.spawn("texluac " .. command) == 0 or os.spawn("luac " .. command) == 0 + if done and cleanup == true and lfs.isfile(lucfile) and lfs.isfile(luafile) then + utilities.report("lua: removing %s",luafile) + os.remove(luafile) end + return done end -function setters.enable(t,what) - local e = t.enable - t.enable, t.done = enable, { } - enable(t,string.simpleesc(tostring(what))) - t.enable, t.done = e, { } -end -function setters.disable(t,what) - local e = t.disable - t.disable, t.done = disable, { } - disable(t,string.simpleesc(tostring(what))) - t.disable, t.done = e, { } -end -function setters.reset(t) - t.done = { } - reset(t) -end -function setters.list(t) -- pattern - local list = table.sortedkeys(t.data) - local user, system = { }, { } - for l=1,#list do - local what = list[l] - if find(what,"^%*") then + + + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['util-prs'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local P, R, V, C, Ct, Carg = lpeg.P, lpeg.R, lpeg.V, lpeg.C, lpeg.Ct, lpeg.Carg +local lpegmatch = lpeg.match +local concat, format, gmatch = table.concat, string.format, string.gmatch +local tostring, type, next = tostring, type, next + +utilities = utilities or {} +utilities.parsers = utilities.parsers or { } +local parsers = utilities.parsers +parsers.patterns = parsers.patterns or { } + +local setmetatableindex = table.setmetatableindex +local sortedhash = table.sortedhash + +-- we could use a Cf Cg construct + +local escape, left, right = P("\\"), P('{'), P('}') + +lpeg.patterns.balanced = P { + [1] = ((escape * (left+right)) + (1 - (left+right)) + V(2))^0, + [2] = left * V(1) * right +} + +local space = P(' ') +local equal = P("=") +local comma = P(",") +local lbrace = P("{") +local rbrace = P("}") +local nobrace = 1 - (lbrace+rbrace) +local nested = P { lbrace * (nobrace + V(1))^0 * rbrace } +local spaces = space^0 + +lpeg.patterns.nested = nested + +local value = P(lbrace * C((nobrace + nested)^0) * rbrace) + C((nested + (1-comma))^0) + +local key = C((1-equal-comma)^1) +local pattern_a = (space+comma)^0 * (key * equal * value + key * C("")) +local pattern_c = (space+comma)^0 * (key * equal * value) + +local key = C((1-space-equal-comma)^1) +local pattern_b = spaces * comma^0 * spaces * (key * ((spaces * equal * spaces * value) + C(""))) + +-- "a=1, b=2, c=3, d={a{b,c}d}, e=12345, f=xx{a{b,c}d}xx, g={}" : outer {} removes, leading spaces ignored + +local hash = { } + +local function set(key,value) + hash[key] = value +end + +local function set(key,value) + hash[key] = value +end + +local pattern_a_s = (pattern_a/set)^1 +local pattern_b_s = (pattern_b/set)^1 +local pattern_c_s = (pattern_c/set)^1 + +parsers.patterns.settings_to_hash_a = pattern_a_s +parsers.patterns.settings_to_hash_b = pattern_b_s +parsers.patterns.settings_to_hash_c = pattern_c_s + +function parsers.make_settings_to_hash_pattern(set,how) + if how == "strict" then + return (pattern_c/set)^1 + elseif how == "tolerant" then + return (pattern_b/set)^1 + else + return (pattern_a/set)^1 + end +end + +function parsers.settings_to_hash(str,existing) + if str and str ~= "" then + hash = existing or { } + lpegmatch(pattern_a_s,str) + return hash + else + return { } + end +end + +function parsers.settings_to_hash_tolerant(str,existing) + if str and str ~= "" then + hash = existing or { } + lpegmatch(pattern_b_s,str) + return hash + else + return { } + end +end + +function parsers.settings_to_hash_strict(str,existing) + if str and str ~= "" then + hash = existing or { } + lpegmatch(pattern_c_s,str) + return next(hash) and hash + else + return nil + end +end + +local separator = comma * space^0 +local value = P(lbrace * C((nobrace + nested)^0) * rbrace) + C((nested + (1-comma))^0) +local pattern = Ct(value*(separator*value)^0) + +-- "aap, {noot}, mies" : outer {} removes, leading spaces ignored + +parsers.patterns.settings_to_array = pattern + +-- we could use a weak table as cache + +function parsers.settings_to_array(str) + if not str or str == "" then + return { } + else + return lpegmatch(pattern,str) + end +end + +local function set(t,v) + t[#t+1] = v +end + +local value = P(Carg(1)*value) / set +local pattern = value*(separator*value)^0 * Carg(1) + +function parsers.add_settings_to_array(t,str) + return lpegmatch(pattern,str,nil,t) +end + +function parsers.hash_to_string(h,separator,yes,no,strict,omit) + if h then + local t, tn, s = { }, 0, table.sortedkeys(h) + omit = omit and table.tohash(omit) + for i=1,#s do + local key = s[i] + if not omit or not omit[key] then + local value = h[key] + if type(value) == "boolean" then + if yes and no then + if value then + tn = tn + 1 + t[tn] = key .. '=' .. yes + elseif not strict then + tn = tn + 1 + t[tn] = key .. '=' .. no + end + elseif value or not strict then + tn = tn + 1 + t[tn] = key .. '=' .. tostring(value) + end + else + tn = tn + 1 + t[tn] = key .. '=' .. value + end + end + end + return concat(t,separator or ",") + else + return "" + end +end + +function parsers.array_to_string(a,separator) + if a then + return concat(a,separator or ",") + else + return "" + end +end + +function parsers.settings_to_set(str,t) -- tohash? -- todo: lpeg -- duplicate anyway + t = t or { } +-- for s in gmatch(str,"%s*([^, ]+)") do -- space added + for s in gmatch(str,"[^, ]+") do -- space added + t[s] = true + end + return t +end + +function parsers.simple_hash_to_string(h, separator) + local t, tn = { }, 0 + for k, v in sortedhash(h) do + if v then + tn = tn + 1 + t[tn] = k + end + end + return concat(t,separator or ",") +end + +local value = lbrace * C((nobrace + nested)^0) * rbrace +local pattern = Ct((space + value)^0) + +function parsers.arguments_to_table(str) + return lpegmatch(pattern,str) +end + +-- temporary here (unoptimized) + +function parsers.getparameters(self,class,parentclass,settings) + local sc = self[class] + if not sc then + sc = { } + self[class] = sc + if parentclass then + local sp = self[parentclass] + if not sp then + sp = { } + self[parentclass] = sp + end + setmetatableindex(sc,sp) + end + end + parsers.settings_to_hash(settings,sc) +end + +function parsers.listitem(str) + return gmatch(str,"[^, ]+") +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['util-fmt'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +utilities = utilities or { } +utilities.formatters = utilities.formatters or { } +local formatters = utilities.formatters + +local concat, format = table.concat, string.format +local tostring, type = tostring, type +local strip = string.strip + +local P, R, Cs = lpeg.P, lpeg.R, lpeg.Cs +local lpegmatch = lpeg.match + +-- temporary here + +local digit = R("09") +local period = P(".") +local zero = P("0") +local trailingzeros = zero^0 * -digit -- suggested by Roberto R +local case_1 = period * trailingzeros / "" +local case_2 = period * (digit - trailingzeros)^1 * (trailingzeros / "") +local number = digit^1 * (case_1 + case_2) +local stripper = Cs((number + 1)^0) + + +lpeg.patterns.stripzeros = stripper + +function formatters.stripzeros(str) + return lpegmatch(stripper,str) +end + +function formatters.formatcolumns(result,between) + if result and #result > 0 then + between = between or " " + local widths, numbers = { }, { } + local first = result[1] + local n = #first + for i=1,n do + widths[i] = 0 + end + for i=1,#result do + local r = result[i] + for j=1,n do + local rj = r[j] + local tj = type(rj) + if tj == "number" then + numbers[j] = true + end + if tj ~= "string" then + rj = tostring(rj) + r[j] = rj + end + local w = #rj + if w > widths[j] then + widths[j] = w + end + end + end + for i=1,n do + local w = widths[i] + if numbers[i] then + if w > 80 then + widths[i] = "%s" .. between + else + widths[i] = "%0" .. w .. "i" .. between + end + else + if w > 80 then + widths[i] = "%s" .. between + elseif w > 0 then + widths[i] = "%-" .. w .. "s" .. between + else + widths[i] = "%s" + end + end + end + local template = strip(concat(widths)) + for i=1,#result do + local str = format(template,unpack(result[i])) + result[i] = strip(str) + end + end + return result +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['util.deb'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- the tag is kind of generic and used for functions that are not +-- bound to a variable, like node.new, node.copy etc (contrary to for instance +-- node.has_attribute which is bound to a has_attribute local variable in mkiv) + +local debug = require "debug" + +local getinfo = debug.getinfo +local type, next, tostring = type, next, tostring +local format, find = string.format, string.find +local is_boolean = string.is_boolean + +utilities = utilities or { } +utilities.debugger = utilities.debugger or { } +local debugger = utilities.debugger + +local counters = { } +local names = { } + +-- one + +local function hook() + local f = getinfo(2,"f").func + local n = getinfo(2,"Sn") +-- if n.what == "C" and n.name then print (n.namewhat .. ': ' .. n.name) end + if f then + local cf = counters[f] + if cf == nil then + counters[f] = 1 + names[f] = n + else + counters[f] = cf + 1 + end + end +end + +local function getname(func) + local n = names[func] + if n then + if n.what == "C" then + return n.name or '' + else + -- source short_src linedefined what name namewhat nups func + local name = n.name or n.namewhat or n.what + if not name or name == "" then name = "?" end + return format("%s : %s : %s", n.short_src or "unknown source", n.linedefined or "--", name) + end + else + return "unknown" + end +end + +function debugger.showstats(printer,threshold) + printer = printer or texio.write or print + threshold = threshold or 0 + local total, grandtotal, functions = 0, 0, 0 + printer("\n") -- ugly but ok + -- table.sort(counters) + for func, count in next, counters do + if count > threshold then + local name = getname(func) + if not find(name,"for generator") then + printer(format("%8i %s", count, name)) + total = total + count + end + end + grandtotal = grandtotal + count + functions = functions + 1 + end + printer(format("functions: %s, total: %s, grand total: %s, threshold: %s\n", functions, total, grandtotal, threshold)) +end + +-- two + + +-- rest + +function debugger.savestats(filename,threshold) + local f = io.open(filename,'w') + if f then + debugger.showstats(function(str) f:write(str) end,threshold) + f:close() + end +end + +function debugger.enable() + debug.sethook(hook,"c") +end + +function debugger.disable() + debug.sethook() +end + + + + + +local is_node = node and node.is_node + +function inspect(i) -- global function + local ti = type(i) + if ti == "table" then + table.print(i,"table") + elseif is_node and is_node(i) then + table.print(nodes.astable(i),tostring(i)) + else + print(tostring(i)) + end +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['trac-inf'] = { + version = 1.001, + comment = "companion to trac-inf.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- As we want to protect the global tables, we no longer store the timing +-- in the tables themselves but in a hidden timers table so that we don't +-- get warnings about assignments. This is more efficient than using rawset +-- and rawget. + +local format = string.format +local clock = os.gettimeofday or os.clock -- should go in environment +local write_nl = texio.write_nl + +statistics = statistics or { } +local statistics = statistics + +statistics.enable = true +statistics.threshold = 0.05 + +local statusinfo, n, registered, timers = { }, 0, { }, { } + +local function hastiming(instance) + return instance and timers[instance] +end + +local function resettiming(instance) + timers[instance or "notimer"] = { timing = 0, loadtime = 0 } +end + +local function starttiming(instance) + local timer = timers[instance or "notimer"] + if not timer then + timer = { } + timers[instance or "notimer"] = timer + end + local it = timer.timing + if not it then + it = 0 + end + if it == 0 then + timer.starttime = clock() + if not timer.loadtime then + timer.loadtime = 0 + end + end + timer.timing = it + 1 +end + +local function stoptiming(instance, report) + local timer = timers[instance or "notimer"] + local it = timer.timing + if it > 1 then + timer.timing = it - 1 + else + local starttime = timer.starttime + if starttime then + local stoptime = clock() + local loadtime = stoptime - starttime + timer.stoptime = stoptime + timer.loadtime = timer.loadtime + loadtime + if report then + statistics.report("load time %0.3f",loadtime) + end + timer.timing = 0 + return loadtime + end + end + return 0 +end + +local function elapsedtime(instance) + local timer = timers[instance or "notimer"] + return format("%0.3f",timer and timer.loadtime or 0) +end + +local function elapsedindeed(instance) + local timer = timers[instance or "notimer"] + return (timer and timer.loadtime or 0) > statistics.threshold +end + +local function elapsedseconds(instance,rest) -- returns nil if 0 seconds + if elapsedindeed(instance) then + return format("%s seconds %s", elapsedtime(instance),rest or "") + end +end + +statistics.hastiming = hastiming +statistics.resettiming = resettiming +statistics.starttiming = starttiming +statistics.stoptiming = stoptiming +statistics.elapsedtime = elapsedtime +statistics.elapsedindeed = elapsedindeed +statistics.elapsedseconds = elapsedseconds + +-- general function + +function statistics.register(tag,fnc) + if statistics.enable and type(fnc) == "function" then + local rt = registered[tag] or (#statusinfo + 1) + statusinfo[rt] = { tag, fnc } + registered[tag] = rt + if #tag > n then n = #tag end + end +end + +function statistics.show(reporter) + if statistics.enable then + if not reporter then reporter = function(tag,data,n) write_nl(tag .. " " .. data) end end + -- this code will move + local register = statistics.register + register("luatex banner", function() + return string.lower(status.banner) + end) + register("control sequences", function() + return format("%s of %s", status.cs_count, status.hash_size+status.hash_extra) + end) + register("callbacks", function() + local total, indirect = status.callbacks or 0, status.indirect_callbacks or 0 + return format("%s direct, %s indirect, %s total", total-indirect, indirect, total) + end) + collectgarbage("collect") + register("current memory usage", statistics.memused) + register("runtime",statistics.runtime) + for i=1,#statusinfo do + local s = statusinfo[i] + local r = s[2]() + if r then + reporter(s[1],r,n) + end + end + write_nl("") -- final newline + statistics.enable = false + end +end + +local template, report_statistics, nn = nil, nil, 0 -- we only calcute it once + +function statistics.showjobstat(tag,data,n) + if not logs then + -- sorry + elseif type(data) == "table" then + for i=1,#data do + statistics.showjobstat(tag,data[i],n) + end + else + if not template or n > nn then + template, n = format("%%-%ss - %%s",n), nn + report_statistics = logs.reporter("mkiv lua stats") + end + report_statistics(format(template,tag,data)) + end +end + +function statistics.memused() -- no math.round yet -) + local round = math.round or math.floor + return format("%s MB (ctx: %s MB)",round(collectgarbage("count")/1000), round(status.luastate_bytes/1000000)) +end + +starttiming(statistics) + +function statistics.formatruntime(runtime) -- indirect so it can be overloaded and + return format("%s seconds", runtime) -- indeed that happens in cure-uti.lua +end + +function statistics.runtime() + stoptiming(statistics) + return statistics.formatruntime(elapsedtime(statistics)) +end + +function statistics.timed(action,report) + report = report or logs.reporter("system") + starttiming("run") + action() + stoptiming("run") + report("total runtime: %s",elapsedtime("run")) +end + +-- where, not really the best spot for this: + +commands = commands or { } + +function commands.resettimer(name) + resettiming(name or "whatever") + starttiming(name or "whatever") +end + +function commands.elapsedtime(name) + stoptiming(name or "whatever") + tex.sprint(elapsedtime(name or "whatever")) +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['trac-set'] = { -- might become util-set.lua + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local type, next, tostring = type, next, tostring +local concat = table.concat +local format, find, lower, gsub, escapedpattern = string.format, string.find, string.lower, string.gsub, string.escapedpattern +local is_boolean = string.is_boolean +local settings_to_hash = utilities.parsers.settings_to_hash +local allocate = utilities.storage.allocate + +utilities = utilities or { } +local utilities = utilities +utilities.setters = utilities.setters or { } +local setters = utilities.setters + +local data = { } -- maybe just local + +-- We can initialize from the cnf file. This is sort of tricky as +-- later defined setters also need to be initialized then. If set +-- this way, we need to ensure that they are not reset later on. + +local trace_initialize = false -- only for testing during development + +function setters.initialize(filename,name,values) -- filename only for diagnostics + local setter = data[name] + if setter then + local data = setter.data + if data then + for key, value in next, values do + -- key = gsub(key,"_",".") + value = is_boolean(value,value) + local functions = data[key] + if functions then + if #functions > 0 and not functions.value then + if trace_initialize then + setter.report("executing %s (%s -> %s)",key,filename,tostring(value)) + end + for i=1,#functions do + functions[i](value) + end + functions.value = value + else + if trace_initialize then + setter.report("skipping %s (%s -> %s)",key,filename,tostring(value)) + end + end + else + -- we do a simple preregistration i.e. not in the + -- list as it might be an obsolete entry + functions = { default = value } + data[key] = functions + if trace_initialize then + setter.report("storing %s (%s -> %s)",key,filename,tostring(value)) + end + end + end + return true + end + end +end + +-- user interface code + +local function set(t,what,newvalue) + local data, done = t.data, t.done + if type(what) == "string" then + what = settings_to_hash(what) -- inefficient but ok + end + if type(what) ~= "table" then + return + end + for w, value in next, what do + if value == "" then + value = newvalue + elseif not value then + value = false -- catch nil + else + value = is_boolean(value,value) + end + w = "^" .. escapedpattern(w,true) .. "$" -- new: anchored + for name, functions in next, data do + if done[name] then + -- prevent recursion due to wildcards + elseif find(name,w) then + done[name] = true + for i=1,#functions do + functions[i](value) + end + functions.value = value + end + end + end +end + +local function reset(t) + for name, functions in next, t.data do + for i=1,#functions do + functions[i](false) + end + functions.value = false + end +end + +local function enable(t,what) + set(t,what,true) +end + +local function disable(t,what) + local data = t.data + if not what or what == "" then + t.done = { } + reset(t) + else + set(t,what,false) + end +end + +function setters.register(t,what,...) + local data = t.data + what = lower(what) + local functions = data[what] + if not functions then + functions = { } + data[what] = functions + if trace_initialize then + t.report("defining %s",what) + end + end + local default = functions.default -- can be set from cnf file + for _, fnc in next, { ... } do + local typ = type(fnc) + if typ == "string" then + if trace_initialize then + t.report("coupling %s to %s",what,fnc) + end + local s = fnc -- else wrong reference + fnc = function(value) set(t,s,value) end + elseif typ ~= "function" then + fnc = nil + end + if fnc then + functions[#functions+1] = fnc + -- default: set at command line or in cnf file + -- value : set in tex run (needed when loading runtime) + local value = functions.value or default + if value ~= nil then + fnc(value) + functions.value = value + end + end + end + return false -- so we can use it in an assignment +end + +function setters.enable(t,what) + local e = t.enable + t.enable, t.done = enable, { } + enable(t,what) + t.enable, t.done = e, { } +end + +function setters.disable(t,what) + local e = t.disable + t.disable, t.done = disable, { } + disable(t,what) + t.disable, t.done = e, { } +end + +function setters.reset(t) + t.done = { } + reset(t) +end + +function setters.list(t) -- pattern + local list = table.sortedkeys(t.data) + local user, system = { }, { } + for l=1,#list do + local what = list[l] + if find(what,"^%*") then system[#system+1] = what else - user[#user+1] = what + user[#user+1] = what + end + end + return user, system +end + +function setters.show(t) + local category = t.name + local list = setters.list(t) + t.report() + for k=1,#list do + local name = list[k] + local functions = t.data[name] + if functions then + local value, default, modules = functions.value, functions.default, #functions + value = value == nil and "unset" or tostring(value) + default = default == nil and "unset" or tostring(default) + t.report("%-30s modules: %2i default: %6s value: %6s",name,modules,default,value) + end + end + t.report() +end + +-- we could have used a bit of oo and the trackers:enable syntax but +-- there is already a lot of code around using the singular tracker + +-- we could make this into a module but we also want the rest avaliable + +local enable, disable, register, list, show = setters.enable, setters.disable, setters.register, setters.list, setters.show + +local function report(setter,...) + local report = logs and logs.report + if report then + report(setter.name,...) + else -- fallback, as this module is loaded before the logger + write_nl(format("%-15s : %s\n",setter.name,format(...))) + end +end + +function setters.new(name) + local setter -- we need to access it in setter itself + setter = { + data = allocate(), -- indexed, but also default and value fields + name = name, + report = function(...) report (setter,...) end, + enable = function(...) enable (setter,...) end, + disable = function(...) disable (setter,...) end, + register = function(...) register(setter,...) end, + list = function(...) list (setter,...) end, + show = function(...) show (setter,...) end, + } + data[name] = setter + return setter +end + +trackers = setters.new("trackers") +directives = setters.new("directives") +experiments = setters.new("experiments") + +local t_enable, t_disable, t_report = trackers .enable, trackers .disable, trackers .report +local d_enable, d_disable, d_report = directives .enable, directives .disable, directives .report +local e_enable, e_disable, e_report = experiments.enable, experiments.disable, experiments.report + +-- nice trick: we overload two of the directives related functions with variants that +-- do tracing (itself using a tracker) .. proof of concept + +local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end) +local trace_experiments = false local trace_experiments = false trackers.register("system.experiments", function(v) trace_experiments = v end) + +function directives.enable(...) + if trace_directives then + d_report("enabling: %s",concat({...}," ")) + end + d_enable(...) +end + +function directives.disable(...) + if trace_directives then + d_report("disabling: %s",concat({...}," ")) + end + d_disable(...) +end + +function experiments.enable(...) + if trace_experiments then + e_report("enabling: %s",concat({...}," ")) + end + e_enable(...) +end + +function experiments.disable(...) + if trace_experiments then + e_report("disabling: %s",concat({...}," ")) + end + e_disable(...) +end + +-- a useful example + +directives.register("system.nostatistics", function(v) + statistics.enable = not v +end) + +directives.register("system.nolibraries", function(v) + libraries = nil -- we discard this tracing for security +end) + +-- experiment + +local flags = environment and environment.engineflags + +if flags then + if trackers and flags.trackers then + setters.initialize("flags","trackers", settings_to_hash(flags.trackers)) + -- t_enable(flags.trackers) + end + if directives and flags.directives then + setters.initialize("flags","directives", settings_to_hash(flags.directives)) + -- d_enable(flags.directives) + end +end + +-- here + +if texconfig then + + local function set(k,v) + v = tonumber(v) + if v then + texconfig[k] = v + end + end + + directives.register("luatex.expanddepth", function(v) set("expand_depth",v) end) + directives.register("luatex.hashextra", function(v) set("hash_extra",v) end) + directives.register("luatex.nestsize", function(v) set("nest_size",v) end) + directives.register("luatex.maxinopen", function(v) set("max_in_open",v) end) + directives.register("luatex.maxprintline", function(v) set("max_print_line",v) end) + directives.register("luatex.maxstrings", function(v) set("max_strings",v) end) + directives.register("luatex.paramsize", function(v) set("param_size",v) end) + directives.register("luatex.savesize", function(v) set("save_size",v) end) + directives.register("luatex.stacksize", function(v) set("stack_size",v) end) + +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['trac-log'] = { + version = 1.001, + comment = "companion to trac-log.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- todo: less categories, more subcategories (e.g. nodes) + + +local write_nl, write = texio and texio.write_nl or print, texio and texio.write or io.write +local format, gmatch, find = string.format, string.gmatch, string.find +local concat, insert, remove = table.concat, table.insert, table.remove +local escapedpattern = string.escapedpattern +local texcount = tex and tex.count +local next, type = next, type + +local setmetatableindex = table.setmetatableindex + +--[[ldx-- +

This is a prelude to a more extensive logging module. We no longer +provide based logging a sparsing is relatively easy anyway.

+--ldx]]-- + +logs = logs or { } +local logs = logs + +local moreinfo = [[ +More information about ConTeXt and the tools that come with it can be found at: + +maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context +webpage : http://www.pragma-ade.nl / http://tex.aanhet.net +wiki : http://contextgarden.net +]] + +-- basic loggers + +local function ignore() end + +setmetatableindex(logs, function(t,k) t[k] = ignore ; return ignore end) + +local report, subreport, status, settarget, setformats, settranslations + +local direct, subdirect, writer, pushtarget, poptarget + +if tex and tex.jobname or tex.formatname then + + local valueiskey = { __index = function(t,k) t[k] = k return k end } -- will be helper + + local target = "term and log" + + logs.flush = io.flush + + local formats = { } setmetatable(formats, valueiskey) + local translations = { } setmetatable(translations,valueiskey) + + writer = function(...) + write_nl(target,...) + end + + report = function(a,b,c,...) + if c then + write_nl(target,format("%-15s > %s\n",translations[a],format(formats[b],c,...))) + elseif b then + write_nl(target,format("%-15s > %s\n",translations[a],formats[b])) + elseif a then + write_nl(target,format("%-15s >\n", translations[a])) + else + write_nl(target,"\n") + end + end + + direct = function(a,b,c,...) + if c then + return format("%-15s > %s",translations[a],format(formats[b],c,...)) + elseif b then + return format("%-15s > %s",translations[a],formats[b]) + elseif a then + return format("%-15s >", translations[a]) + else + return "" + end + end + + subreport = function(a,s,b,c,...) + if c then + write_nl(target,format("%-15s > %s > %s\n",translations[a],translations[s],format(formats[b],c,...))) + elseif b then + write_nl(target,format("%-15s > %s > %s\n",translations[a],translations[s],formats[b])) + elseif a then + write_nl(target,format("%-15s > %s >\n", translations[a],translations[s])) + else + write_nl(target,"\n") + end + end + + subdirect = function(a,s,b,c,...) + if c then + return format("%-15s > %s > %s",translations[a],translations[s],format(formats[b],c,...)) + elseif b then + return format("%-15s > %s > %s",translations[a],translations[s],formats[b]) + elseif a then + return format("%-15s > %s >", translations[a],translations[s]) + else + return "" + end + end + + status = function(a,b,c,...) + if c then + write_nl(target,format("%-15s : %s\n",translations[a],format(formats[b],c,...))) + elseif b then + write_nl(target,format("%-15s : %s\n",translations[a],formats[b])) + elseif a then + write_nl(target,format("%-15s :\n", translations[a])) + else + write_nl(target,"\n") + end + end + + local targets = { + logfile = "log", + log = "log", + file = "log", + console = "term", + terminal = "term", + both = "term and log", + } + + settarget = function(whereto) + target = targets[whereto or "both"] or targets.both + if target == "term" or target == "term and log" then + logs.flush = io.flush + else + logs.flush = ignore + end + end + + local stack = { } + + pushtarget = function(newtarget) + insert(stack,target) + settarget(newtarget) + end + + poptarget = function() + if #stack > 0 then + settarget(remove(stack)) + end + end + + setformats = function(f) + formats = f + end + + settranslations = function(t) + translations = t + end + +else + + logs.flush = ignore + + writer = write_nl + + report = function(a,b,c,...) + if c then + write_nl(format("%-15s | %s",a,format(b,c,...))) + elseif b then + write_nl(format("%-15s | %s",a,b)) + elseif a then + write_nl(format("%-15s |", a)) + else + write_nl("") + end + end + + subreport = function(a,sub,b,c,...) + if c then + write_nl(format("%-15s | %s | %s",a,sub,format(b,c,...))) + elseif b then + write_nl(format("%-15s | %s | %s",a,sub,b)) + elseif a then + write_nl(format("%-15s | %s |", a,sub)) + else + write_nl("") + end + end + + status = function(a,b,c,...) -- not to be used in lua anyway + if c then + write_nl(format("%-15s : %s\n",a,format(b,c,...))) + elseif b then + write_nl(format("%-15s : %s\n",a,b)) -- b can have %'s + elseif a then + write_nl(format("%-15s :\n", a)) + else + write_nl("\n") + end + end + + direct = ignore + subdirect = ignore + + settarget = ignore + pushtarget = ignore + poptarget = ignore + setformats = ignore + settranslations = ignore + +end + +logs.report = report +logs.subreport = subreport +logs.status = status +logs.settarget = settarget +logs.pushtarget = pushtarget +logs.poptarget = poptarget +logs.setformats = setformats +logs.settranslations = settranslations + +logs.direct = direct +logs.subdirect = subdirect +logs.writer = writer + +-- installer + +-- todo: renew (un) locks when a new one is added and wildcard + +local data, states = { }, nil + +function logs.reporter(category,subcategory) + local logger = data[category] + if not logger then + local state = false + if states == true then + state = true + elseif type(states) == "table" then + for c, _ in next, states do + if find(category,c) then + state = true + break + end + end + end + logger = { + reporters = { }, + state = state, + } + data[category] = logger + end + local reporter = logger.reporters[subcategory or "default"] + if not reporter then + if subcategory then + reporter = function(...) + if not logger.state then + subreport(category,subcategory,...) + end + end + logger.reporters[subcategory] = reporter + else + local tag = category + reporter = function(...) + if not logger.state then + report(category,...) + end + end + logger.reporters.default = reporter + end + end + return reporter +end + +logs.new = logs.reporter -- for old times sake + +-- context specicific: this ends up in the macro stream + +local ctxreport = logs.writer + +function logs.setmessenger(m) + ctxreport = m +end + +function logs.messenger(category,subcategory) + -- we need to avoid catcode mess (todo: fast context) + if subcategory then + return function(...) + ctxreport(subdirect(category,subcategory,...)) + end + else + return function(...) + ctxreport(direct(category,...)) + end + end +end + +-- so far + +local function setblocked(category,value) + if category == true then + -- lock all + category, value = "*", true + elseif category == false then + -- unlock all + category, value = "*", false + elseif value == nil then + -- lock selective + value = true + end + if category == "*" then + states = value + for k, v in next, data do + v.state = value + end + else + states = utilities.parsers.settings_to_hash(category) + for c, _ in next, states do + if data[c] then + v.state = value + else + c = escapedpattern(c,true) + for k, v in next, data do + if find(k,c) then + v.state = value + end + end + end + end + end +end + +function logs.disable(category,value) + setblocked(category,value == nil and true or value) +end + +function logs.enable(category) + setblocked(category,false) +end + +function logs.categories() + return table.sortedkeys(data) +end + +function logs.show() + local n, c, s, max = 0, 0, 0, 0 + for category, v in table.sortedpairs(data) do + n = n + 1 + local state = v.state + local reporters = v.reporters + local nc = #category + if nc > c then + c = nc + end + for subcategory, _ in next, reporters do + local ns = #subcategory + if ns > c then + s = ns + end + local m = nc + ns + if m > max then + max = m + end + end + local subcategories = concat(table.sortedkeys(reporters),", ") + if state == true then + state = "disabled" + elseif state == false then + state = "enabled" + else + state = "unknown" + end + -- no new here + report("logging","category: '%s', subcategories: '%s', state: '%s'",category,subcategories,state) + end + report("logging","categories: %s, max category: %s, max subcategory: %s, max combined: %s",n,c,s,max) +end + +directives.register("logs.blocked", function(v) + setblocked(v,true) +end) + +directives.register("logs.target", function(v) + settarget(v) +end) + +-- tex specific loggers (might move elsewhere) + +local report_pages = logs.reporter("pages") -- not needed but saves checking when we grep for it + +local real, user, sub + +function logs.start_page_number() + real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno +end + +function logs.stop_page_number() + if real > 0 then + if user > 0 then + if sub > 0 then + report_pages("flushing realpage %s, userpage %s, subpage %s",real,user,sub) + else + report_pages("flushing realpage %s, userpage %s",real,user) + end + else + report_pages("flushing realpage %s",real) + end + else + report_pages("flushing page") + end + logs.flush() +end + +logs.report_job_stat = statistics and statistics.showjobstat + +local report_files = logs.reporter("files") + +local nesting = 0 +local verbose = false +local hasscheme = url.hasscheme + +-- we don't have show_open and show_close callbacks yet + +function logs.show_open(name) + -- if hasscheme(name) ~= "virtual" then + -- if verbose then + -- nesting = nesting + 1 + -- report_files("level %s, opening %s",nesting,name) + -- else + -- write(format("(%s",name)) -- tex adds a space + -- end + -- end +end + +function logs.show_close(name) + -- if hasscheme(name) ~= "virtual" then + -- if verbose then + -- report_files("level %s, closing %s",nesting,name) + -- nesting = nesting - 1 + -- else + -- write(")") -- tex adds a space + -- end + -- end +end + +function logs.show_load(name) + -- if hasscheme(name) ~= "virtual" then + -- if verbose then + -- report_files("level %s, loading %s",nesting+1,name) + -- else + -- write(format("(%s)",name)) + -- end + -- end +end + +-- there may be scripts out there using this: + +local simple = logs.reporter("comment") + +logs.simple = simple +logs.simpleline = simple + +-- obsolete + +function logs.setprogram () end -- obsolete +function logs.extendbanner() end -- obsolete +function logs.reportlines () end -- obsolete +function logs.reportbanner() end -- obsolete +function logs.reportline () end -- obsolete +function logs.simplelines () end -- obsolete +function logs.help () end -- obsolete + +-- applications + +local function reportlines(t,str) + if str then + for line in gmatch(str,"(.-)[\n\r]") do + t.report(line) + end + end +end + +local function reportbanner(t) + local banner = t.banner + if banner then + t.report(banner) + t.report() + end +end + +local function reporthelp(t,...) + local helpinfo = t.helpinfo + if type(helpinfo) == "string" then + reportlines(t,helpinfo) + elseif type(helpinfo) == "table" then + local tags = { ... } + for i=1,#tags do + reportlines(t,t.helpinfo[tags[i]]) + if i < #tags then + t.report() + end + end + end +end + +local function reportinfo(t) + t.report() + reportlines(t,moreinfo) +end + +function logs.application(t) + t.name = t.name or "unknown" + t.banner = t.banner + t.report = logs.reporter(t.name) + t.help = function(...) reportbanner(t) ; reporthelp(t,...) ; reportinfo(t) end + t.identify = function() reportbanner(t) end + return t +end + +-- somewhat special + +-- logging to a file + + +function logs.system(whereto,process,jobname,category,...) + local message = format("%s %s => %s => %s => %s\r",os.date("%d/%m/%y %H:%m:%S"),process,jobname,category,format(...)) + for i=1,10 do + local f = io.open(whereto,"a") -- we can consider keepint the file open + if f then + f:write(message) + f:close() + break + else + sleep(0.1) + end + end +end + +local report_system = logs.reporter("system","logs") + +function logs.obsolete(old,new) + local o = loadstring("return " .. new)() + if type(o) == "function" then + return function(...) + report_system("function %s is obsolete, use %s",old,new) + loadstring(old .. "=" .. new .. " return ".. old)()(...) + end + elseif type(o) == "table" then + local t, m = { }, { } + m.__index = function(t,k) + report_system("table %s is obsolete, use %s",old,new) + m.__index, m.__newindex = o, o + return o[k] + end + m.__newindex = function(t,k,v) + report_system("table %s is obsolete, use %s",old,new) + m.__index, m.__newindex = o, o + o[k] = v + end + if libraries then + libraries.obsolete[old] = t -- true + end + setmetatable(t,m) + return t + end +end + +if utilities then + utilities.report = report_system +end + +if tex and tex.error then + function logs.texerrormessage(...) -- for the moment we put this function here + tex.error(format(...), { }) + end +else + function logs.texerrormessage(...) + print(format(...)) + end +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['trac-pro'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local getmetatable, setmetatable, rawset, type = getmetatable, setmetatable, rawset, type + +-- The protection implemented here is probably not that tight but good enough to catch +-- problems due to naive usage. +-- +-- There's a more extensive version (trac-xxx.lua) that supports nesting. +-- +-- This will change when we have _ENV in lua 5.2+ + +local trace_namespaces = false trackers.register("system.namespaces", function(v) trace_namespaces = v end) + +local report_system = logs.reporter("system","protection") + +namespaces = namespaces or { } +local namespaces = namespaces + +local registered = { } + +local function report_index(k,name) + if trace_namespaces then + report_system("reference to '%s' in protected namespace '%s', %s",k,name,debug.traceback()) + else + report_system("reference to '%s' in protected namespace '%s'",k,name) + end +end + +local function report_newindex(k,name) + if trace_namespaces then + report_system("assignment to '%s' in protected namespace '%s', %s",k,name,debug.traceback()) + else + report_system("assignment to '%s' in protected namespace '%s'",k,name) + end +end + +local function register(name) + local data = name == "global" and _G or _G[name] + if not data then + return -- error + end + registered[name] = data + local m = getmetatable(data) + if not m then + m = { } + setmetatable(data,m) + end + local index, newindex = { }, { } + m.__saved__index = m.__index + m.__no__index = function(t,k) + if not index[k] then + index[k] = true + report_index(k,name) + end + return nil + end + m.__saved__newindex = m.__newindex + m.__no__newindex = function(t,k,v) + if not newindex[k] then + newindex[k] = true + report_newindex(k,name) + end + rawset(t,k,v) + end + m.__protection__depth = 0 +end + +local function private(name) -- maybe save name + local data = registered[name] + if not data then + data = _G[name] + if not data then + data = { } + _G[name] = data + end + register(name) + end + return data +end + +local function protect(name) + local data = registered[name] + if not data then + return + end + local m = getmetatable(data) + local pd = m.__protection__depth + if pd > 0 then + m.__protection__depth = pd + 1 + else + m.__save_d_index, m.__saved__newindex = m.__index, m.__newindex + m.__index, m.__newindex = m.__no__index, m.__no__newindex + m.__protection__depth = 1 + end +end + +local function unprotect(name) + local data = registered[name] + if not data then + return + end + local m = getmetatable(data) + local pd = m.__protection__depth + if pd > 1 then + m.__protection__depth = pd - 1 + else + m.__index, m.__newindex = m.__saved__index, m.__saved__newindex + m.__protection__depth = 0 + end +end + +local function protectall() + for name, _ in next, registered do + if name ~= "global" then + protect(name) + end + end +end + +local function unprotectall() + for name, _ in next, registered do + if name ~= "global" then + unprotect(name) + end + end +end + +namespaces.register = register -- register when defined +namespaces.private = private -- allocate and register if needed +namespaces.protect = protect +namespaces.unprotect = unprotect +namespaces.protectall = protectall +namespaces.unprotectall = unprotectall + +namespaces.private("namespaces") registered = { } register("global") -- unreachable + +directives.register("system.protect", function(v) + if v then + protectall() + else + unprotectall() + end +end) + +directives.register("system.checkglobals", function(v) + if v then + report_system("enabling global namespace guard") + protect("global") + else + report_system("disabling global namespace guard") + unprotect("global") + end +end) + +-- dummy section (will go to luat-dum.lua) + + + + + + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['luat-env'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- A former version provided functionality for non embeded core +-- scripts i.e. runtime library loading. Given the amount of +-- Lua code we use now, this no longer makes sense. Much of this +-- evolved before bytecode arrays were available and so a lot of +-- code has disappeared already. + +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) + +local report_lua = logs.reporter("resolvers","lua") + +local allocate, mark = utilities.storage.allocate, utilities.storage.mark + +local format, sub, match, gsub, find = string.format, string.sub, string.match, string.gsub, string.find +local unquoted, quoted = string.unquoted, string.quoted +local concat = table.concat + +-- precautions + +os.setlocale(nil,nil) -- useless feature and even dangerous in luatex + +function os.setlocale() + -- no way you can mess with it +end + +-- dirty tricks + +if arg and (arg[0] == 'luatex' or arg[0] == 'luatex.exe') and arg[1] == "--luaonly" then + arg[-1] = arg[0] + arg[ 0] = arg[2] + for k=3,#arg do + arg[k-2] = arg[k] + end + arg[#arg] = nil -- last + arg[#arg] = nil -- pre-last +end + +-- environment + +environment = environment or { } +local environment = environment + +environment.arguments = allocate() +environment.files = allocate() +environment.sortedflags = nil + +local mt = { + __index = function(_,k) + if k == "version" then + local version = tex.toks and tex.toks.contextversiontoks + if version and version ~= "" then + rawset(environment,"version",version) + return version + else + return "unknown" + end + elseif k == "jobname" or k == "formatname" then + local name = tex and tex[k] + if name or name== "" then + rawset(environment,k,name) + return name + else + return "unknown" + end + elseif k == "outputfilename" then + local name = environment.jobname + rawset(environment,k,name) + return name + end + end +} + +setmetatable(environment,mt) + +function environment.initializearguments(arg) + local arguments, files = { }, { } + environment.arguments, environment.files, environment.sortedflags = arguments, files, nil + for index=1,#arg do + local argument = arg[index] + if index > 0 then + local flag, value = match(argument,"^%-+(.-)=(.-)$") + if flag then + arguments[flag] = unquoted(value or "") + else + flag = match(argument,"^%-+(.+)") + if flag then + arguments[flag] = true + else + files[#files+1] = argument + end + end + end + end + environment.ownname = environment.ownname or arg[0] or 'unknown.lua' +end + +function environment.setargument(name,value) + environment.arguments[name] = value +end + +-- todo: defaults, better checks e.g on type (boolean versus string) +-- +-- tricky: too many hits when we support partials unless we add +-- a registration of arguments so from now on we have 'partial' + +function environment.argument(name,partial) + local arguments, sortedflags = environment.arguments, environment.sortedflags + if arguments[name] then + return arguments[name] + elseif partial then + if not sortedflags then + sortedflags = allocate(table.sortedkeys(arguments)) + for k=1,#sortedflags do + sortedflags[k] = "^" .. sortedflags[k] + end + environment.sortedflags = sortedflags + end + -- example of potential clash: ^mode ^modefile + for k=1,#sortedflags do + local v = sortedflags[k] + if find(name,v) then + return arguments[sub(v,2,#v)] + end end end - return user, system + return nil end -function setters.show(t) - commands.writestatus("","") - local list = setters.list(t) - for k=1,#list do - commands.writestatus(t.name,list[k]) +function environment.splitarguments(separator) -- rather special, cut-off before separator + local done, before, after = false, { }, { } + local originalarguments = environment.originalarguments + for k=1,#originalarguments do + local v = originalarguments[k] + if not done and v == separator then + done = true + elseif done then + after[#after+1] = v + else + before[#before+1] = v + end end - commands.writestatus("","") + return before, after end --- we could have used a bit of oo and the trackers:enable syntax but --- there is already a lot of code around using the singular tracker +function environment.reconstructcommandline(arg,noquote) + arg = arg or environment.originalarguments + if noquote and #arg == 1 then + -- we could just do: return unquoted(resolvers.resolve(arg[i])) + local a = arg[1] + a = resolvers.resolve(a) + a = unquoted(a) + return a + elseif #arg > 0 then + local result = { } + for i=1,#arg do + -- we could just do: result[#result+1] = format("%q",unquoted(resolvers.resolve(arg[i]))) + local a = arg[i] + a = resolvers.resolve(a) + a = unquoted(a) + a = gsub(a,'"','\\"') -- tricky + if find(a," ") then + result[#result+1] = quoted(a) + else + result[#result+1] = a + end + end + return concat(result," ") + else + return "" + end +end --- we could make this into a module -function setters.new(name) - local t - t = { - data = { }, - name = name, - enable = function(...) setters.enable (t,...) end, - disable = function(...) setters.disable (t,...) end, - register = function(...) setters.register(t,...) end, - list = function(...) setters.list (t,...) end, - show = function(...) setters.show (t,...) end, - } - setters.data[name] = t - return t -end +if arg then -trackers = setters.new("trackers") -directives = setters.new("directives") -experiments = setters.new("experiments") + -- new, reconstruct quoted snippets (maybe better just remove the " then and add them later) + local newarg, instring = { }, false --- nice trick: we overload two of the directives related functions with variants that --- do tracing (itself using a tracker) .. proof of concept + for index=1,#arg do + local argument = arg[index] + if find(argument,"^\"") then + newarg[#newarg+1] = gsub(argument,"^\"","") + if not find(argument,"\"$") then + instring = true + end + elseif find(argument,"\"$") then + newarg[#newarg] = newarg[#newarg] .. " " .. gsub(argument,"\"$","") + instring = false + elseif instring then + newarg[#newarg] = newarg[#newarg] .. " " .. argument + else + newarg[#newarg+1] = argument + end + end + for i=1,-5,-1 do + newarg[i] = arg[i] + end -local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end) -local trace_experiments = false local trace_experiments = false trackers.register("system.experiments", function(v) trace_experiments = v end) + environment.initializearguments(newarg) -local e = directives.enable -local d = directives.disable + environment.originalarguments = mark(newarg) + environment.rawarguments = mark(arg) -function directives.enable(...) - commands.writestatus("directives","enabling: %s",concat({...}," ")) - e(...) -end + arg = { } -- prevent duplicate handling -function directives.disable(...) - commands.writestatus("directives","disabling: %s",concat({...}," ")) - d(...) end -local e = experiments.enable -local d = experiments.disable +-- weird place ... depends on a not yet loaded module -function experiments.enable(...) - commands.writestatus("experiments","enabling: %s",concat({...}," ")) - e(...) +function environment.texfile(filename) + return resolvers.findfile(filename,'tex') end -function experiments.disable(...) - commands.writestatus("experiments","disabling: %s",concat({...}," ")) - d(...) +function environment.luafile(filename) + local resolved = resolvers.findfile(filename,'tex') or "" + if resolved ~= "" then + return resolved + end + resolved = resolvers.findfile(filename,'texmfscripts') or "" + if resolved ~= "" then + return resolved + end + return resolvers.findfile(filename,'luatexlibs') or "" end --- a useful example +environment.loadedluacode = loadfile -- can be overloaded -directives.register("system.nostatistics", function(v) - statistics.enable = not v -end) +function environment.luafilechunk(filename,silent) -- used for loading lua bytecode in the format + filename = file.replacesuffix(filename, "lua") + local fullname = environment.luafile(filename) + if fullname and fullname ~= "" then + local data = environment.loadedluacode(fullname) + if trace_locating then + report_lua("loading file %s%s", fullname, not data and " failed" or "") + elseif not silent then + texio.write("<",data and "+ " or "- ",fullname,">") + end + return data + else + if trace_locating then + report_lua("unknown file %s", filename) + end + return nil + end +end + +-- the next ones can use the previous ones / combine +function environment.loadluafile(filename, version) + local lucname, luaname, chunk + local basename = file.removesuffix(filename) + if basename == filename then + lucname, luaname = basename .. ".luc", basename .. ".lua" + else + lucname, luaname = nil, basename -- forced suffix + end + -- when not overloaded by explicit suffix we look for a luc file first + local fullname = (lucname and environment.luafile(lucname)) or "" + if fullname ~= "" then + if trace_locating then + report_lua("loading %s", fullname) + end + chunk = loadfile(fullname) -- this way we don't need a file exists check + end + if chunk then + assert(chunk)() + if version then + -- we check of the version number of this chunk matches + local v = version -- can be nil + if modules and modules[filename] then + v = modules[filename].version -- new method + elseif versions and versions[filename] then + v = versions[filename] -- old method + end + if v == version then + return true + else + if trace_locating then + report_lua("version mismatch for %s: lua=%s, luc=%s", filename, v, version) + end + environment.loadluafile(filename) + end + else + return true + end + end + fullname = (luaname and environment.luafile(luaname)) or "" + if fullname ~= "" then + if trace_locating then + report_lua("loading %s", fullname) + end + chunk = loadfile(fullname) -- this way we don't need a file exists check + if not chunk then + if trace_locating then + report_lua("unknown file %s", filename) + end + else + assert(chunk)() + return true + end + end + return false +end end -- of closure @@ -3991,6 +6263,8 @@ if not modules then modules = { } end modules ['lxml-tab'] = { local trace_entities = false trackers.register("xml.entities", function(v) trace_entities = v end) +local report_xml = logs and logs.reporter("xml","core") or function(...) print(format(...)) end + --[[ldx--

The parser used here is inspired by the variant discussed in the lua book, but handles comment and processing instructions, has a different structure, provides @@ -4001,11 +6275,15 @@ The find based parser can be found in l-xml-edu.lua along with other older code.

Beware, the interface may change. For instance at, ns, tg, dt may get more verbose names. Once the code is stable we will also remove some tracing and optimize the code.

+ +

I might even decide to reimplement the parser using the latest trickery +as the current variant was written when showed up and it's easier now to +build tables in one go.

--ldx]]-- xml = xml or { } +local xml = xml ---~ local xml = xml local concat, remove, insert = table.concat, table.remove, table.insert local type, next, setmetatable, getmetatable, tonumber = type, next, setmetatable, getmetatable, tonumber @@ -4129,7 +6407,7 @@ local dcache, hcache, acache = { }, { }, { } local mt = { } -function initialize_mt(root) +local function initialize_mt(root) mt = { __index = root } -- will be redefined later end @@ -4137,8 +6415,8 @@ function xml.setproperty(root,k,v) getmetatable(root).__index[k] = v end -function xml.check_error(top,toclose) - return "" +function xml.checkerror(top,toclose) + return "" -- can be set end local function add_attribute(namespace,tag,value) @@ -4194,9 +6472,9 @@ local function add_end(spacing, namespace, tag) local toclose = remove(stack) top = stack[#stack] if #stack < 1 then - errorstr = format("nothing to close with %s %s", tag, xml.check_error(top,toclose) or "") + errorstr = format("nothing to close with %s %s", tag, xml.checkerror(top,toclose) or "") elseif toclose.tg ~= tag then -- no namespace check - errorstr = format("unable to close %s with %s %s", toclose.tg, tag, xml.check_error(top,toclose) or "") + errorstr = format("unable to close %s with %s %s", toclose.tg, tag, xml.checkerror(top,toclose) or "") end dt = top.dt dt[#dt+1] = toclose @@ -4233,24 +6511,29 @@ local reported_attribute_errors = { } local function attribute_value_error(str) if not reported_attribute_errors[str] then - logs.report("xml","invalid attribute value: %q",str) + report_xml("invalid attribute value: %q",str) reported_attribute_errors[str] = true at._error_ = str end return str end + local function attribute_specification_error(str) if not reported_attribute_errors[str] then - logs.report("xml","invalid attribute specification: %q",str) + report_xml("invalid attribute specification: %q",str) reported_attribute_errors[str] = true at._error_ = str end return str end -function xml.unknown_dec_entity_format(str) return (str == "" and "&error;") or format("&%s;",str) end -function xml.unknown_hex_entity_format(str) return format("&#x%s;",str) end -function xml.unknown_any_entity_format(str) return format("&#x%s;",str) end +xml.placeholders = { + unknown_dec_entity = function(str) return (str == "" and "&error;") or format("&%s;",str) end, + unknown_hex_entity = function(str) return format("&#x%s;",str) end, + unknown_any_entity = function(str) return format("&#x%s;",str) end, +} + +local placeholders = xml.placeholders local function fromhex(s) local n = tonumber(s,16) @@ -4304,18 +6587,18 @@ local function handle_hex_entity(str) h = unify_predefined and predefined_unified[n] if h then if trace_entities then - logs.report("xml","utfize, converting hex entity &#x%s; into %s",str,h) + report_xml("utfize, converting hex entity &#x%s; into %s",str,h) end elseif utfize then - h = (n and utfchar(n)) or xml.unknown_hex_entity_format(str) or "" + h = (n and utfchar(n)) or xml.unknown_hex_entity(str) or "" if not n then - logs.report("xml","utfize, ignoring hex entity &#x%s;",str) + report_xml("utfize, ignoring hex entity &#x%s;",str) elseif trace_entities then - logs.report("xml","utfize, converting hex entity &#x%s; into %s",str,h) + report_xml("utfize, converting hex entity &#x%s; into %s",str,h) end else if trace_entities then - logs.report("xml","found entity &#x%s;",str) + report_xml("found entity &#x%s;",str) end h = "&#x" .. str .. ";" end @@ -4331,18 +6614,18 @@ local function handle_dec_entity(str) d = unify_predefined and predefined_unified[n] if d then if trace_entities then - logs.report("xml","utfize, converting dec entity &#%s; into %s",str,d) + report_xml("utfize, converting dec entity &#%s; into %s",str,d) end elseif utfize then - d = (n and utfchar(n)) or xml.unknown_dec_entity_format(str) or "" + d = (n and utfchar(n)) or placeholders.unknown_dec_entity(str) or "" if not n then - logs.report("xml","utfize, ignoring dec entity &#%s;",str) + report_xml("utfize, ignoring dec entity &#%s;",str) elseif trace_entities then - logs.report("xml","utfize, converting dec entity &#%s; into %s",str,h) + report_xml("utfize, converting dec entity &#%s; into %s",str,h) end else if trace_entities then - logs.report("xml","found entity &#%s;",str) + report_xml("found entity &#%s;",str) end d = "&#" .. str .. ";" end @@ -4367,20 +6650,21 @@ local function handle_any_entity(str) end if a then if trace_entities then - logs.report("xml","resolved entity &%s; -> %s (internal)",str,a) + report_xml("resolved entity &%s; -> %s (internal)",str,a) end a = lpegmatch(parsedentity,a) or a else - if xml.unknown_any_entity_format then - a = xml.unknown_any_entity_format(str) or "" + local unknown_any_entity = placeholders.unknown_any_entity + if unknown_any_entity then + a = unknown_any_entity(str) or "" end if a then if trace_entities then - logs.report("xml","resolved entity &%s; -> %s (external)",str,a) + report_xml("resolved entity &%s; -> %s (external)",str,a) end else if trace_entities then - logs.report("xml","keeping entity &%s;",str) + report_xml("keeping entity &%s;",str) end if str == "" then a = "&error;" @@ -4392,7 +6676,7 @@ local function handle_any_entity(str) acache[str] = a elseif trace_entities then if not acache[str] then - logs.report("xml","converting entity &%s; into %s",str,a) + report_xml("converting entity &%s; into %s",str,a) acache[str] = a end end @@ -4401,7 +6685,7 @@ local function handle_any_entity(str) local a = acache[str] if not a then if trace_entities then - logs.report("xml","found entity &%s;",str) + report_xml("found entity &%s;",str) end a = resolve_predefined and predefined_simplified[str] if a then @@ -4420,7 +6704,7 @@ local function handle_any_entity(str) end local function handle_end_entity(chr) - logs.report("xml","error in entity, %q found instead of ';'",chr) + report_xml("error in entity, %q found instead of ';'",chr) end local space = S(' \r\n\t') @@ -4555,7 +6839,7 @@ local function xmlconvert(data, settings) resolve_predefined = settings.resolve_predefined_entities -- in case we have escaped entities unify_predefined = settings.unify_predefined_entities -- & -> & cleanup = settings.text_cleanup - stack, top, at, xmlns, errorstr, result, entities = { }, { }, { }, { }, nil, nil, settings.entities or { } + stack, top, at, xmlns, errorstr, entities = { }, { }, { }, { }, nil, settings.entities or { } acache, hcache, dcache = { }, { }, { } -- not stored reported_attribute_errors = { } if settings.parent_root then @@ -4583,16 +6867,17 @@ local function xmlconvert(data, settings) else errorstr = "invalid xml file - no text at all" end + local result if errorstr and errorstr ~= "" then result = { dt = { { ns = "", tg = "error", dt = { errorstr }, at={ }, er = true } } } setmetatable(stack, mt) - local error_handler = settings.error_handler - if error_handler == false then + local errorhandler = settings.error_handler + if errorhandler == false then -- no error message else - error_handler = error_handler or xml.error_handler - if error_handler then - xml.error_handler("load",errorstr) + errorhandler = errorhandler or xml.errorhandler + if errorhandler then + xml.errorhandler("load",errorstr) end end else @@ -4652,7 +6937,7 @@ function xml.is_valid(root) return root and not root.error end -xml.error_handler = (logs and logs.report) or (input and logs.report) or print +xml.errorhandler = report --[[ldx--

We cannot load an from a filehandle so we need to load @@ -4763,7 +7048,7 @@ local function verbose_element(e,handlers) ats[#ats+1] = format('%s=%q',k,v) end end - if ern and trace_remap and ern ~= ens then + if ern and trace_entities and ern ~= ens then ens = ern end if ens ~= "" then @@ -4868,7 +7153,7 @@ local function serialize(e,handlers,...) -- elseif type(e) == "string" then -- functions["@tx@"](e,handlers) else - functions["@dc@"](e,handlers) + functions["@dc@"](e,handlers) -- dc ? end if finalize then return finalize() @@ -4894,7 +7179,7 @@ local function newhandlers(settings) if settings then for k,v in next, settings do if type(v) == "table" then - tk = t[k] if not tk then tk = { } t[k] = tk end + local tk = t[k] if not tk then tk = { } t[k] = tk end for kk,vv in next, v do tk[kk] = vv end @@ -4906,6 +7191,7 @@ local function newhandlers(settings) handlers[settings.name] = t end end + utilities.storage.mark(t) return t end @@ -5005,7 +7291,7 @@ local function xmltext(root) -- inline return (root and xmltostring(root)) or "" end -function initialize_mt(root) +initialize_mt = function(root) -- redefinition mt = { __tostring = xmltext, __index = root } end @@ -5040,7 +7326,6 @@ xml.string = xmlstring

A few helpers:

--ldx]]-- ---~ xmlsetproperty(root,"settings",settings) function xml.settings(e) while e do @@ -5150,6 +7435,7 @@ function xml.makestandalone(root) end end end + return root end @@ -5166,11 +7452,14 @@ if not modules then modules = { } end modules ['lxml-pth'] = { } -- e.ni is only valid after a filter run +-- todo: B/C/[get first match] local concat, remove, insert = table.concat, table.remove, table.insert local type, next, tonumber, tostring, setmetatable, loadstring = type, next, tonumber, tostring, setmetatable, loadstring local format, upper, lower, gmatch, gsub, find, rep = string.format, string.upper, string.lower, string.gmatch, string.gsub, string.find, string.rep -local lpegmatch = lpeg.match +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns + +local setmetatableindex = table.setmetatableindex -- beware, this is not xpath ... e.g. position is different (currently) and -- we have reverse-sibling as reversed preceding sibling @@ -5202,23 +7491,33 @@ local trace_lpath = false if trackers then trackers.register("xml.path", local trace_lparse = false if trackers then trackers.register("xml.parse", function(v) trace_lparse = v end) end local trace_lprofile = false if trackers then trackers.register("xml.profile", function(v) trace_lpath = v trace_lparse = v trace_lprofile = v end) end +local report_lpath = logs.reporter("xml","lpath") + --[[ldx--

We've now arrived at an interesting part: accessing the tree using a subset of and since we're not compatible we call it . We will explain more about its usage in other documents.

--ldx]]-- +local xml = xml + local lpathcalls = 0 function xml.lpathcalls () return lpathcalls end local lpathcached = 0 function xml.lpathcached() return lpathcached end -xml.functions = xml.functions or { } -- internal -xml.expressions = xml.expressions or { } -- in expressions -xml.finalizers = xml.finalizers or { } -- fast do-with ... (with return value other than collection) -xml.specialhandler = xml.specialhandler or { } +xml.functions = xml.functions or { } -- internal +local functions = xml.functions + +xml.expressions = xml.expressions or { } -- in expressions +local expressions = xml.expressions + +xml.finalizers = xml.finalizers or { } -- fast do-with ... (with return value other than collection) +local finalizers = xml.finalizers -local functions = xml.functions -local expressions = xml.expressions -local finalizers = xml.finalizers +xml.specialhandler = xml.specialhandler or { } +local specialhandler = xml.specialhandler + +lpegpatterns.xml = lpegpatterns.xml or { } +local xmlpatterns = lpegpatterns.xml finalizers.xml = finalizers.xml or { } finalizers.tex = finalizers.tex or { } @@ -5228,14 +7527,14 @@ local function fallback (t, name) if fn then t[name] = fn else - logs.report("xml","unknown sub finalizer '%s'",tostring(name)) + report_lpath("unknown sub finalizer '%s'",tostring(name)) fn = function() end end return fn end -setmetatable(finalizers.xml, { __index = fallback }) -setmetatable(finalizers.tex, { __index = fallback }) +setmetatableindex(finalizers.xml, fallback) +setmetatableindex(finalizers.tex, fallback) xml.defaultprotocol = "xml" @@ -5283,102 +7582,106 @@ apply_axis['root'] = function(list) rt = ll end end - collected[#collected+1] = rt + collected[l] = rt end return collected end apply_axis['self'] = function(list) ---~ local collected = { } ---~ for l=1,#list do ---~ collected[#collected+1] = list[l] ---~ end ---~ return collected return list end apply_axis['child'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local dt = ll.dt - local en = 0 - for k=1,#dt do - local dk = dt[k] - if dk.tg then - collected[#collected+1] = dk - dk.ni = k -- refresh - en = en + 1 - dk.ei = en + if dt then -- weird that this is needed + local en = 0 + for k=1,#dt do + local dk = dt[k] + if dk.tg then + c = c + 1 + collected[c] = dk + dk.ni = k -- refresh + en = en + 1 + dk.ei = en + end end + ll.en = en end - ll.en = en end return collected end -local function collect(list,collected) +local function collect(list,collected,c) local dt = list.dt if dt then local en = 0 for k=1,#dt do local dk = dt[k] if dk.tg then - collected[#collected+1] = dk + c = c + 1 + collected[c] = dk dk.ni = k -- refresh en = en + 1 dk.ei = en - collect(dk,collected) + c = collect(dk,collected,c) end end list.en = en end + return c end apply_axis['descendant'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do - collect(list[l],collected) + c = collect(list[l],collected,c) end return collected end -local function collect(list,collected) +local function collect(list,collected,c) local dt = list.dt if dt then local en = 0 for k=1,#dt do local dk = dt[k] if dk.tg then - collected[#collected+1] = dk + c = c + 1 + collected[c] = dk dk.ni = k -- refresh en = en + 1 dk.ei = en - collect(dk,collected) + c = collect(dk,collected,c) end end list.en = en end + return c end apply_axis['descendant-or-self'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] if ll.special ~= true then -- catch double root - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end - collect(ll,collected) + c = collect(ll,collected,c) end return collected end apply_axis['ancestor'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] while ll do ll = ll.__p__ if ll then - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end end end @@ -5386,14 +7689,16 @@ apply_axis['ancestor'] = function(list) end apply_axis['ancestor-or-self'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll while ll do ll = ll.__p__ if ll then - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end end end @@ -5401,11 +7706,12 @@ apply_axis['ancestor-or-self'] = function(list) end apply_axis['parent'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local pl = list[l].__p__ if pl then - collected[#collected+1] = pl + c = c + 1 + collected[c] = pl end end return collected @@ -5420,43 +7726,15 @@ apply_axis['namespace'] = function(list) end apply_axis['following'] = function(list) -- incomplete ---~ local collected = { } ---~ for l=1,#list do ---~ local ll = list[l] ---~ local p = ll.__p__ ---~ local d = p.dt ---~ for i=ll.ni+1,#d do ---~ local di = d[i] ---~ if type(di) == "table" then ---~ collected[#collected+1] = di ---~ break ---~ end ---~ end ---~ end ---~ return collected return { } end apply_axis['preceding'] = function(list) -- incomplete ---~ local collected = { } ---~ for l=1,#list do ---~ local ll = list[l] ---~ local p = ll.__p__ ---~ local d = p.dt ---~ for i=ll.ni-1,1,-1 do ---~ local di = d[i] ---~ if type(di) == "table" then ---~ collected[#collected+1] = di ---~ break ---~ end ---~ end ---~ end ---~ return collected return { } end apply_axis['following-sibling'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local p = ll.__p__ @@ -5464,7 +7742,8 @@ apply_axis['following-sibling'] = function(list) for i=ll.ni+1,#d do local di = d[i] if type(di) == "table" then - collected[#collected+1] = di + c = c + 1 + collected[c] = di end end end @@ -5472,7 +7751,7 @@ apply_axis['following-sibling'] = function(list) end apply_axis['preceding-sibling'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local p = ll.__p__ @@ -5480,7 +7759,8 @@ apply_axis['preceding-sibling'] = function(list) for i=1,ll.ni-1 do local di = d[i] if type(di) == "table" then - collected[#collected+1] = di + c = c + 1 + collected[c] = di end end end @@ -5488,7 +7768,7 @@ apply_axis['preceding-sibling'] = function(list) end apply_axis['reverse-sibling'] = function(list) -- reverse preceding - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local p = ll.__p__ @@ -5496,7 +7776,8 @@ apply_axis['reverse-sibling'] = function(list) -- reverse preceding for i=ll.ni-1,1,-1 do local di = d[i] if type(di) == "table" then - collected[#collected+1] = di + c = c + 1 + collected[c] = di end end end @@ -5522,7 +7803,7 @@ local function apply_nodes(list,directive,nodes) return { } end else - local collected, m, p = { }, 0, nil + local collected, c, m, p = { }, 0, 0, nil if not nns then -- only check tag for l=1,#list do local ll = list[l] @@ -5531,11 +7812,13 @@ local function apply_nodes(list,directive,nodes) if directive then if ntg == ltg then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif ntg ~= ltg then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -5547,11 +7830,13 @@ local function apply_nodes(list,directive,nodes) if directive then if lns == nns then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif lns ~= nns then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -5565,11 +7850,13 @@ local function apply_nodes(list,directive,nodes) if directive then if ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif not ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -5577,7 +7864,7 @@ local function apply_nodes(list,directive,nodes) return collected end else - local collected, m, p = { }, 0, nil + local collected, c, m, p = { }, 0, 0, nil for l=1,#list do local ll = list[l] local ltg = ll.tg @@ -5594,11 +7881,13 @@ local function apply_nodes(list,directive,nodes) if directive then if ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif not ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -5609,12 +7898,13 @@ end local quit_expression = false local function apply_expression(list,expression,order) - local collected = { } + local collected, c = { }, 0 quit_expression = false for l=1,#list do local ll = list[l] if expression(list,ll,l,order) then -- nasty, order alleen valid als n=1 - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end if quit_expression then break @@ -5653,7 +7943,9 @@ local lp_builtin = P ( P("ns") / "ll.ns" ) * ((spaces * P("(") * spaces * P(")"))/"") -local lp_attribute = (P("@") + P("attribute::")) / "" * Cc("(ll.at and ll.at['") * R("az","AZ","--","__")^1 * Cc("'])") +-- for the moment we keep namespaces with attributes + +local lp_attribute = (P("@") + P("attribute::")) / "" * Cc("(ll.at and ll.at['") * ((R("az","AZ") + S("-_:"))^1) * Cc("'])") local lp_fastpos_p = ((P("+")^0 * R("09")^1 * P(-1)) / function(s) return "l==" .. s end) local lp_fastpos_n = ((P("-") * R("09")^1 * P(-1)) / function(s) return "(" .. s .. "<0 and (#list+".. s .. "==l))" end) local lp_fastpos = lp_fastpos_n + lp_fastpos_p @@ -5714,14 +8006,12 @@ local converter = Cs ( ) cleaner = Cs ( ( ---~ lp_fastpos + lp_reserved + lp_number + lp_string + 1 )^1 ) ---~ expr local template_e = [[ local expr = xml.expressions @@ -5772,13 +8062,13 @@ local skip = { } local function errorrunner_e(str,cnv) if not skip[str] then - logs.report("lpath","error in expression: %s => %s",str,cnv) + report_lpath("error in expression: %s => %s",str,cnv) skip[str] = cnv or str end return false end local function errorrunner_f(str,arg) - logs.report("lpath","error in finalizer: %s(%s)",str,arg or "") + report_lpath("error in finalizer: %s(%s)",str,arg or "") return false end @@ -5829,7 +8119,7 @@ local special_1 = P("*") * Cc(register_auto_descendant) * Cc(register_all_nodes local special_2 = P("/") * Cc(register_auto_self) local special_3 = P("") * Cc(register_auto_self) -local parser = Ct { "patterns", -- can be made a bit faster by moving pattern outside +local pathparser = Ct { "patterns", -- can be made a bit faster by moving pattern outside patterns = spaces * V("protocol") * spaces * ( ( V("special") * spaces * P(-1) ) + @@ -5901,6 +8191,8 @@ local parser = Ct { "patterns", -- can be made a bit faster by moving pattern ou } +xmlpatterns.pathparser = pathparser + local cache = { } local function nodesettostring(set,nodetest) @@ -5910,7 +8202,7 @@ local function nodesettostring(set,nodetest) if not ns or ns == "" then ns = "*" end if not tg or tg == "" then tg = "*" end tg = (tg == "@rt@" and "[root]") or format("%s:%s",ns,tg) - t[#t+1] = (directive and tg) or format("not(%s)",tg) + t[i] = (directive and tg) or format("not(%s)",tg) end if nodetest == false then return format("not(%s)",concat(t,"|")) @@ -5929,7 +8221,7 @@ local function tagstostring(list) local ns, tg = li.ns, li.tg if not ns or ns == "" then ns = "*" end if not tg or tg == "" then tg = "*" end - t[#t+1] = (tg == "@rt@" and "[root]") or format("%s:%s",ns,tg) + t[i] = (tg == "@rt@" and "[root]") or format("%s:%s",ns,tg) end return concat(t," ") end @@ -5937,16 +8229,16 @@ end xml.nodesettostring = nodesettostring -local parse_pattern -- we have a harmless kind of circular reference +local lpath -- we have a harmless kind of circular reference + +local lshowoptions = { functions = false } local function lshow(parsed) if type(parsed) == "string" then - parsed = parse_pattern(parsed) + parsed = lpath(parsed) end - local s = table.serialize_functions -- ugly - table.serialize_functions = false -- ugly - logs.report("lpath","%s://%s => %s",parsed.protocol or xml.defaultprotocol,parsed.pattern,table.serialize(parsed,false)) - table.serialize_functions = s -- ugly + report_lpath("%s://%s => %s",parsed.protocol or xml.defaultprotocol,parsed.pattern, + table.serialize(parsed,false,lshowoptions)) end xml.lshow = lshow @@ -5960,7 +8252,7 @@ local function add_comment(p,str) end end -parse_pattern = function (pattern) -- the gain of caching is rather minimal +lpath = function (pattern) -- the gain of caching is rather minimal lpathcalls = lpathcalls + 1 if type(pattern) == "table" then return pattern @@ -5969,13 +8261,13 @@ parse_pattern = function (pattern) -- the gain of caching is rather minimal if parsed then lpathcached = lpathcached + 1 else - parsed = lpegmatch(parser,pattern) + parsed = lpegmatch(pathparser,pattern) if parsed then parsed.pattern = pattern local np = #parsed if np == 0 then parsed = { pattern = pattern, register_self, state = "parsing error" } - logs.report("lpath","parsing error in '%s'",pattern) + report_lpath("parsing error in '%s'",pattern) lshow(parsed) else -- we could have done this with a more complex parser but this @@ -6017,6 +8309,8 @@ parse_pattern = function (pattern) -- the gain of caching is rather minimal end end +xml.lpath = lpath + -- we can move all calls inline and then merge the trace back -- technically we can combine axis and the next nodes which is -- what we did before but this a bit cleaner (but slower too) @@ -6079,32 +8373,32 @@ local function traced_apply(list,parsed,nofparsed,order) if trace_lparse then lshow(parsed) end - logs.report("lpath", "collecting : %s",parsed.pattern) - logs.report("lpath", " root tags : %s",tagstostring(list)) - logs.report("lpath", " order : %s",order or "unset") + report_lpath("collecting: %s",parsed.pattern) + report_lpath("root tags : %s",tagstostring(list)) + report_lpath("order : %s",order or "unset") local collected = list for i=1,nofparsed do local pi = parsed[i] local kind = pi.kind if kind == "axis" then collected = apply_axis[pi.axis](collected) - logs.report("lpath", "% 10i : ax : %s",(collected and #collected) or 0,pi.axis) + report_lpath("% 10i : ax : %s",(collected and #collected) or 0,pi.axis) elseif kind == "nodes" then collected = apply_nodes(collected,pi.nodetest,pi.nodes) - logs.report("lpath", "% 10i : ns : %s",(collected and #collected) or 0,nodesettostring(pi.nodes,pi.nodetest)) + report_lpath("% 10i : ns : %s",(collected and #collected) or 0,nodesettostring(pi.nodes,pi.nodetest)) elseif kind == "expression" then collected = apply_expression(collected,pi.evaluator,order) - logs.report("lpath", "% 10i : ex : %s -> %s",(collected and #collected) or 0,pi.expression,pi.converted) + report_lpath("% 10i : ex : %s -> %s",(collected and #collected) or 0,pi.expression,pi.converted) elseif kind == "finalizer" then collected = pi.finalizer(collected) - logs.report("lpath", "% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pi.name,pi.arguments or "") + report_lpath("% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pi.name,pi.arguments or "") return collected end if not collected or #collected == 0 then local pn = i < nofparsed and parsed[nofparsed] if pn and pn.kind == "finalizer" then collected = pn.finalizer(collected) - logs.report("lpath", "% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pn.name,pn.arguments or "") + report_lpath("% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pn.name,pn.arguments or "") return collected end return nil @@ -6141,8 +8435,11 @@ local function normal_apply(list,parsed,nofparsed,order) return collected end -local function parse_apply(list,pattern) - -- we avoid an extra call + +local function applylpath(list,pattern) + if not list then + return + end local parsed = cache[pattern] if parsed then lpathcalls = lpathcalls + 1 @@ -6151,7 +8448,7 @@ local function parse_apply(list,pattern) lpathcalls = lpathcalls + 1 parsed = pattern else - parsed = parse_pattern(pattern) or pattern + parsed = lpath(pattern) or pattern end if not parsed then return @@ -6160,25 +8457,32 @@ local function parse_apply(list,pattern) if nofparsed == 0 then return -- something is wrong end - local one = list[1] - if not one then - return -- something is wrong - elseif not trace_lpath then - return normal_apply(list,parsed,nofparsed,one.mi) + if not trace_lpath then + return normal_apply ({ list },parsed,nofparsed,list.mi) elseif trace_lprofile then - return profiled_apply(list,parsed,nofparsed,one.mi) + return profiled_apply({ list },parsed,nofparsed,list.mi) else - return traced_apply(list,parsed,nofparsed,one.mi) + return traced_apply ({ list },parsed,nofparsed,list.mi) end end +xml.applylpath = applylpath -- takes a table as first argment, which is what xml.filter will do + +--[[ldx-- +

This is the main filter function. It returns whatever is asked for.

+--ldx]]-- + +function xml.filter(root,pattern) -- no longer funny attribute handling here + return applylpath(root,pattern) +end + -- internal (parsed) expressions.child = function(e,pattern) - return parse_apply({ e },pattern) -- todo: cache + return applylpath(e,pattern) -- todo: cache end expressions.count = function(e,pattern) - local collected = parse_apply({ e },pattern) -- todo: cache + local collected = applylpath(e,pattern) -- todo: cache return (collected and #collected) or 0 end @@ -6188,7 +8492,7 @@ expressions.oneof = function(s,...) -- slow local t = {...} for i=1,#t do if s == t[i] then return true end end return false end expressions.error = function(str) - xml.error_handler("unknown function in lpath expression",tostring(str or "?")) + xml.errorhandler("unknown function in lpath expression",tostring(str or "?")) return false end expressions.undefined = function(s) @@ -6217,8 +8521,8 @@ expressions.boolean = toboolean -- user interface local function traverse(root,pattern,handle) - logs.report("xml","use 'xml.selection' instead for '%s'",pattern) - local collected = parse_apply({ root },pattern) + report_lpath("use 'xml.selection' instead for '%s'",pattern) + local collected = applylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6229,7 +8533,7 @@ local function traverse(root,pattern,handle) end local function selection(root,pattern,handle) - local collected = parse_apply({ root },pattern) + local collected = applylpath(root,pattern) if collected then if handle then for c=1,#collected do @@ -6241,19 +8545,9 @@ local function selection(root,pattern,handle) end end -xml.parse_parser = parser -xml.parse_pattern = parse_pattern -xml.parse_apply = parse_apply xml.traverse = traverse -- old method, r, d, k xml.selection = selection -- new method, simple handle -local lpath = parse_pattern - -xml.lpath = lpath - -function xml.cached_patterns() - return cache -end -- generic function finalizer (independant namespace) @@ -6265,13 +8559,13 @@ local function dofunction(collected,fnc) f(collected[c]) end else - logs.report("xml","unknown function '%s'",fnc) + report_lpath("unknown function '%s'",fnc) end end end -xml.finalizers.xml["function"] = dofunction -xml.finalizers.tex["function"] = dofunction +finalizers.xml["function"] = dofunction +finalizers.tex["function"] = dofunction -- functions @@ -6363,14 +8657,6 @@ expressions.tag = function(e,n) -- only tg end end ---[[ldx-- -

This is the main filter function. It returns whatever is asked for.

---ldx]]-- - -function xml.filter(root,pattern) -- no longer funny attribute handling here - return parse_apply({ root },pattern) -end - --[[ldx--

Often using an iterators looks nicer in the code than passing handler functions. The book describes how to use coroutines for that @@ -6390,7 +8676,7 @@ end local wrap, yield = coroutine.wrap, coroutine.yield function xml.elements(root,pattern,reverse) -- r, d, k - local collected = parse_apply({ root },pattern) + local collected = applylpath(root,pattern) if collected then if reverse then return wrap(function() for c=#collected,1,-1 do @@ -6406,7 +8692,7 @@ function xml.elements(root,pattern,reverse) -- r, d, k end function xml.collected(root,pattern,reverse) -- e - local collected = parse_apply({ root },pattern) + local collected = applylpath(root,pattern) if collected then if reverse then return wrap(function() for c=#collected,1,-1 do yield(collected[c]) end end) @@ -6417,6 +8703,15 @@ function xml.collected(root,pattern,reverse) -- e return wrap(function() end) end +-- handy + +function xml.inspect(collection,pattern) + pattern = pattern or "." + for e in xml.collected(collection,pattern or ".") do + report_lpath("pattern %q\n\n%s\n",pattern,xml.tostring(e)) + end +end + end -- of closure @@ -6430,10 +8725,16 @@ if not modules then modules = { } end modules ['lxml-mis'] = { license = "see context related readme files" } +local xml, lpeg, string = xml, lpeg, string + local concat = table.concat local type, next, tonumber, tostring, setmetatable, loadstring = type, next, tonumber, tostring, setmetatable, loadstring local format, gsub, match = string.format, string.gsub, string.match -local lpegmatch = lpeg.match +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns +local P, S, R, C, V, Cc, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.Cc, lpeg.Cs + +lpegpatterns.xml = lpegpatterns.xml or { } +local xmlpatterns = lpegpatterns.xml --[[ldx--

The following helper functions best belong to the lxml-ini @@ -6457,9 +8758,8 @@ local function xmlgsub(t,old,new) -- will be replaced end end ---~ xml.gsub = xmlgsub -function xml.strip_leading_spaces(dk,d,k) -- cosmetic, for manual +function xml.stripleadingspaces(dk,d,k) -- cosmetic, for manual if d and k then local dkm = d[k-1] if dkm and type(dkm) == "string" then @@ -6469,14 +8769,7 @@ function xml.strip_leading_spaces(dk,d,k) -- cosmetic, for manual end end ---~ xml.escapes = { ['&'] = '&', ['<'] = '<', ['>'] = '>', ['"'] = '"' } ---~ xml.unescapes = { } for k,v in next, xml.escapes do xml.unescapes[v] = k end ---~ function xml.escaped (str) return (gsub(str,"(.)" , xml.escapes )) end ---~ function xml.unescaped(str) return (gsub(str,"(&.-;)", xml.unescapes)) end ---~ function xml.cleansed (str) return (gsub(str,"<.->" , '' )) end -- "%b<>" - -local P, S, R, C, V, Cc, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.Cc, lpeg.Cs -- 100 * 2500 * "oeps< oeps> oeps&" : gsub:lpeg|lpeg|lpeg -- @@ -6502,9 +8795,9 @@ local unescaped = Cs(normal * (special * normal)^0) local cleansed = Cs(((P("<") * (1-P(">"))^0 * P(">"))/"" + 1)^0) -xml.escaped_pattern = escaped -xml.unescaped_pattern = unescaped -xml.cleansed_pattern = cleansed +xmlpatterns.escaped = escaped +xmlpatterns.unescaped = unescaped +xmlpatterns.cleansed = cleansed function xml.escaped (str) return lpegmatch(escaped,str) end function xml.unescaped(str) return lpegmatch(unescaped,str) end @@ -6540,15 +8833,20 @@ if not modules then modules = { } end modules ['lxml-aux'] = { local trace_manipulations = false trackers.register("lxml.manipulations", function(v) trace_manipulations = v end) -local xmlparseapply, xmlconvert, xmlcopy, xmlname = xml.parse_apply, xml.convert, xml.copy, xml.name +local report_xml = logs.reporter("xml") + +local xml = xml + +local xmlconvert, xmlcopy, xmlname = xml.convert, xml.copy, xml.name local xmlinheritedconvert = xml.inheritedconvert +local xmlapplylpath = xml.applylpath -local type = type -local insert, remove = table.insert, table.remove +local type, setmetatable, getmetatable = type, setmetatable, getmetatable +local insert, remove, fastcopy = table.insert, table.remove, table.fastcopy local gmatch, gsub = string.gmatch, string.gsub local function report(what,pattern,c,e) - logs.report("xml","%s element '%s' (root: '%s', position: %s, index: %s, pattern: %s)",what,xmlname(e),xmlname(e.__p__),c,e.ni,pattern) + report_xml("%s element '%s' (root: '%s', position: %s, index: %s, pattern: %s)",what,xmlname(e),xmlname(e.__p__),c,e.ni,pattern) end local function withelements(e,handle,depth) @@ -6602,10 +8900,8 @@ function xml.withelement(e,n,handle) -- slow end end -xml.elements_only = xml.collected - -function xml.each_element(root,pattern,handle,reverse) - local collected = xmlparseapply({ root },pattern) +function xml.each(root,pattern,handle,reverse) + local collected = xmlapplylpath(root,pattern) if collected then if reverse then for c=#collected,1,-1 do @@ -6620,10 +8916,8 @@ function xml.each_element(root,pattern,handle,reverse) end end -xml.process_elements = xml.each_element - -function xml.process_attributes(root,pattern,handle) - local collected = xmlparseapply({ root },pattern) +function xml.processattributes(root,pattern,handle) + local collected = xmlapplylpath(root,pattern) if collected and handle then for c=1,#collected do handle(collected[c].at) @@ -6638,12 +8932,12 @@ end -- are these still needed -> lxml-cmp.lua -function xml.collect_elements(root, pattern) - return xmlparseapply({ root },pattern) +function xml.collect(root, pattern) + return xmlapplylpath(root,pattern) end -function xml.collect_texts(root, pattern, flatten) -- todo: variant with handle - local collected = xmlparseapply({ root },pattern) +function xml.collecttexts(root, pattern, flatten) -- todo: variant with handle + local collected = xmlapplylpath(root,pattern) if collected and flatten then local xmltostring = xml.tostring for c=1,#collected do @@ -6654,18 +8948,19 @@ function xml.collect_texts(root, pattern, flatten) -- todo: variant with handle end function xml.collect_tags(root, pattern, nonamespace) - local collected = xmlparseapply({ root },pattern) + local collected = xmlapplylpath(root,pattern) if collected then - local t = { } + local t, n = { }, 0 for c=1,#collected do local e = collected[c] local ns, tg = e.ns, e.tg + n = n + 1 if nonamespace then - t[#t+1] = tg + t[n] = tg elseif ns == "" then - t[#t+1] = tg + t[n] = tg else - t[#t+1] = ns .. ":" .. tg + t[n] = ns .. ":" .. tg end end return t @@ -6678,7 +8973,7 @@ end local no_root = { no_root = true } -function xml.redo_ni(d) +local function redo_ni(d) for k=1,#d do local dk = d[k] if type(dk) == "table" then @@ -6701,12 +8996,7 @@ local function xmltoelement(whatever,root) return whatever -- string end if element then - --~ if element.ri then - --~ element = element.dt[element.ri].dt - --~ else - --~ element = element.dt - --~ end - end + end return element end @@ -6724,8 +9014,8 @@ local function copiedelement(element,newparent) end end -function xml.delete_element(root,pattern) - local collected = xmlparseapply({ root },pattern) +function xml.delete(root,pattern) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6736,15 +9026,15 @@ function xml.delete_element(root,pattern) end local d = p.dt remove(d,e.ni) - xml.redo_ni(d) -- can be made faster and inlined + redo_ni(d) -- can be made faster and inlined end end end end -function xml.replace_element(root,pattern,whatever) +function xml.replace(root,pattern,whatever) local element = root and xmltoelement(whatever,root) - local collected = element and xmlparseapply({ root },pattern) + local collected = element and xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6755,15 +9045,50 @@ function xml.replace_element(root,pattern,whatever) end local d = p.dt d[e.ni] = copiedelement(element,p) - xml.redo_ni(d) -- probably not needed + redo_ni(d) -- probably not needed + end + end + end +end + +local function wrap(e,wrapper) + local t = { + rn = e.rn, + tg = e.tg, + ns = e.ns, + at = e.at, + dt = e.dt, + __p__ = e, + } + setmetatable(t,getmetatable(e)) + e.rn = wrapper.rn or e.rn or "" + e.tg = wrapper.tg or e.tg or "" + e.ns = wrapper.ns or e.ns or "" + e.at = fastcopy(wrapper.at) + e.dt = { t } +end + +function xml.wrap(root,pattern,whatever) + if whatever then + local wrapper = xmltoelement(whatever,root) + local collected = xmlapplylpath(root,pattern) + if collected then + for c=1,#collected do + local e = collected[c] + if trace_manipulations then + report('wrapping',pattern,c,e) + end + wrap(e,wrapper) end end + else + wrap(root,xmltoelement(pattern)) end end local function inject_element(root,pattern,whatever,prepend) local element = root and xmltoelement(whatever,root) - local collected = element and xmlparseapply({ root },pattern) + local collected = element and xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6778,15 +9103,17 @@ local function inject_element(root,pattern,whatever,prepend) else be, af = edt, cp end + local bn = #be for i=1,#af do - be[#be+1] = af[i] + bn = bn + 1 + be[bn] = af[i] end if rri then r.dt[rri].dt = be else d[k].dt = be end - xml.redo_ni(d) + redo_ni(d) end end end @@ -6794,7 +9121,7 @@ end local function insert_element(root,pattern,whatever,before) -- todo: element als functie local element = root and xmltoelement(whatever,root) - local collected = element and xmlparseapply({ root },pattern) + local collected = element and xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -6804,24 +9131,23 @@ local function insert_element(root,pattern,whatever,before) -- todo: element als k = k + 1 end insert(d,k,copiedelement(element,r)) - xml.redo_ni(d) + redo_ni(d) end end end -xml.insert_element = insert_element -xml.insert_element_after = insert_element -xml.insert_element_before = function(r,p,e) insert_element(r,p,e,true) end -xml.inject_element = inject_element -xml.inject_element_after = inject_element -xml.inject_element_before = function(r,p,e) inject_element(r,p,e,true) end +xml.insert_element = insert_element +xml.insertafter = insert_element +xml.insertbefore = function(r,p,e) insert_element(r,p,e,true) end +xml.injectafter = inject_element +xml.injectbefore = function(r,p,e) inject_element(r,p,e,true) end local function include(xmldata,pattern,attribute,recursive,loaddata) -- parse="text" (default: xml), encoding="" (todo) -- attribute = attribute or 'href' pattern = pattern or 'include' loaddata = loaddata or io.loaddata - local collected = xmlparseapply({ xmldata },pattern) + local collected = xmlapplylpath(xmldata,pattern) if collected then for c=1,#collected do local ek = collected[c] @@ -6830,7 +9156,7 @@ local function include(xmldata,pattern,attribute,recursive,loaddata) local ekat = ek.at local epdt = ek.__p__.dt if not attribute or attribute == "" then - name = (type(ekdt) == "table" and ekdt[1]) or ekdt -- ckeck, probably always tab or str + name = (type(ekdt) == "table" and ekdt[1]) or ekdt -- check, probably always tab or str end if not name then for a in gmatch(attribute or "href","([^|]+)") do @@ -6845,9 +9171,6 @@ local function include(xmldata,pattern,attribute,recursive,loaddata) -- for the moment hard coded epdt[ek.ni] = xml.escaped(data) -- d[k] = xml.escaped(data) else ---~ local settings = xmldata.settings ---~ settings.parent_root = xmldata -- to be tested ---~ local xi = xmlconvert(data,settings) local xi = xmlinheritedconvert(data,xmldata) if not xi then epdt[ek.ni] = "" -- xml.empty(d,k) @@ -6864,136 +9187,88 @@ end xml.include = include ---~ local function manipulate(xmldata,pattern,manipulator) -- untested and might go away ---~ local collected = xmlparseapply({ xmldata },pattern) ---~ if collected then ---~ local xmltostring = xml.tostring ---~ for c=1,#collected do ---~ local e = collected[c] ---~ local data = manipulator(xmltostring(e)) ---~ if data == "" then ---~ epdt[e.ni] = "" ---~ else ---~ local xi = xmlinheritedconvert(data,xmldata) ---~ if not xi then ---~ epdt[e.ni] = "" ---~ else ---~ epdt[e.ni] = xml.body(xi) -- xml.assign(d,k,xi) ---~ end ---~ end ---~ end ---~ end ---~ end - ---~ xml.manipulate = manipulate - -function xml.strip_whitespace(root, pattern, nolines) -- strips all leading and trailing space ! - local collected = xmlparseapply({ root },pattern) - if collected then - for i=1,#collected do - local e = collected[i] - local edt = e.dt - if edt then - local t = { } - for i=1,#edt do - local str = edt[i] - if type(str) == "string" then - if str == "" then - -- stripped - else - if nolines then - str = gsub(str,"[ \n\r\t]+"," ") - end - if str == "" then - -- stripped - else - t[#t+1] = str - end - end +local function stripelement(e,nolines,anywhere) + local edt = e.dt + if edt then + if anywhere then + local t, n = { }, 0 + for e=1,#edt do + local str = edt[e] + if type(str) ~= "string" then + n = n + 1 + t[n] = str + elseif str ~= "" then + -- todo: lpeg for each case + if nolines then + str = gsub(str,"%s+"," ") + end + str = gsub(str,"^%s*(.-)%s*$","%1") + if str ~= "" then + n = n + 1 + t[n] = str + end + end + end + e.dt = t + else + -- we can assume a regular sparse xml table with no successive strings + -- otherwise we should use a while loop + if #edt > 0 then + -- strip front + local str = edt[1] + if type(str) ~= "string" then + -- nothing + elseif str == "" then + remove(edt,1) + else + if nolines then + str = gsub(str,"%s+"," ") + end + str = gsub(str,"^%s+","") + if str == "" then + remove(edt,1) + else + edt[1] = str + end + end + end + local nedt = #edt + if nedt > 0 then + -- strip end + local str = edt[nedt] + if type(str) ~= "string" then + -- nothing + elseif str == "" then + remove(edt) + else + if nolines then + str = gsub(str,"%s+"," ") + end + str = gsub(str,"%s+$","") + if str == "" then + remove(edt) else - --~ str.ni = i - t[#t+1] = str + edt[nedt] = str end end - e.dt = t end end end + return e -- convenient end -function xml.strip_whitespace(root, pattern, nolines, anywhere) -- strips all leading and trailing spacing - local collected = xmlparseapply({ root },pattern) -- beware, indices no longer are valid now +xml.stripelement = stripelement + +function xml.strip(root,pattern,nolines,anywhere) -- strips all leading and trailing spacing + local collected = xmlapplylpath(root,pattern) -- beware, indices no longer are valid now if collected then for i=1,#collected do - local e = collected[i] - local edt = e.dt - if edt then - if anywhere then - local t = { } - for e=1,#edt do - local str = edt[e] - if type(str) ~= "string" then - t[#t+1] = str - elseif str ~= "" then - -- todo: lpeg for each case - if nolines then - str = gsub(str,"%s+"," ") - end - str = gsub(str,"^%s*(.-)%s*$","%1") - if str ~= "" then - t[#t+1] = str - end - end - end - e.dt = t - else - -- we can assume a regular sparse xml table with no successive strings - -- otherwise we should use a while loop - if #edt > 0 then - -- strip front - local str = edt[1] - if type(str) ~= "string" then - -- nothing - elseif str == "" then - remove(edt,1) - else - if nolines then - str = gsub(str,"%s+"," ") - end - str = gsub(str,"^%s+","") - if str == "" then - remove(edt,1) - else - edt[1] = str - end - end - end - if #edt > 1 then - -- strip end - local str = edt[#edt] - if type(str) ~= "string" then - -- nothing - elseif str == "" then - remove(edt) - else - if nolines then - str = gsub(str,"%s+"," ") - end - str = gsub(str,"%s+$","") - if str == "" then - remove(edt) - else - edt[#edt] = str - end - end - end - end - end + stripelement(collected[i],nolines,anywhere) end end end -local function rename_space(root, oldspace, newspace) -- fast variant +local function renamespace(root, oldspace, newspace) -- fast variant local ndt = #root.dt for i=1,ndt or 0 do local e = root[i] @@ -7006,16 +9281,16 @@ local function rename_space(root, oldspace, newspace) -- fast variant end local edt = e.dt if edt then - rename_space(edt, oldspace, newspace) + renamespace(edt, oldspace, newspace) end end end end -xml.rename_space = rename_space +xml.renamespace = renamespace -function xml.remap_tag(root, pattern, newtg) - local collected = xmlparseapply({ root },pattern) +function xml.remaptag(root, pattern, newtg) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do collected[c].tg = newtg @@ -7023,8 +9298,8 @@ function xml.remap_tag(root, pattern, newtg) end end -function xml.remap_namespace(root, pattern, newns) - local collected = xmlparseapply({ root },pattern) +function xml.remapnamespace(root, pattern, newns) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do collected[c].ns = newns @@ -7032,8 +9307,8 @@ function xml.remap_namespace(root, pattern, newns) end end -function xml.check_namespace(root, pattern, newns) - local collected = xmlparseapply({ root },pattern) +function xml.checknamespace(root, pattern, newns) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -7044,8 +9319,8 @@ function xml.check_namespace(root, pattern, newns) end end -function xml.remap_name(root, pattern, newtg, newns, newrn) - local collected = xmlparseapply({ root },pattern) +function xml.remapname(root, pattern, newtg, newns, newrn) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -7058,18 +9333,34 @@ end

Here are a few synonyms.

--ldx]]-- -xml.each = xml.each_element -xml.process = xml.process_element -xml.strip = xml.strip_whitespace -xml.collect = xml.collect_elements -xml.all = xml.collect_elements - -xml.insert = xml.insert_element_after -xml.inject = xml.inject_element_after -xml.after = xml.insert_element_after -xml.before = xml.insert_element_before -xml.delete = xml.delete_element -xml.replace = xml.replace_element +xml.all = xml.each +xml.insert = xml.insertafter +xml.inject = xml.injectafter +xml.after = xml.insertafter +xml.before = xml.insertbefore +xml.process = xml.each + +-- obsolete + +xml.obsolete = xml.obsolete or { } +local obsolete = xml.obsolete + +xml.strip_whitespace = xml.strip obsolete.strip_whitespace = xml.strip +xml.collect_elements = xml.collect obsolete.collect_elements = xml.collect +xml.delete_element = xml.delete obsolete.delete_element = xml.delete +xml.replace_element = xml.replace obsolete.replace_element = xml.replacet +xml.each_element = xml.each obsolete.each_element = xml.each +xml.process_elements = xml.process obsolete.process_elements = xml.process +xml.insert_element_after = xml.insertafter obsolete.insert_element_after = xml.insertafter +xml.insert_element_before = xml.insertbefore obsolete.insert_element_before = xml.insertbefore +xml.inject_element_after = xml.injectafter obsolete.inject_element_after = xml.injectafter +xml.inject_element_before = xml.injectbefore obsolete.inject_element_before = xml.injectbefore +xml.process_attributes = xml.processattributes obsolete.process_attributes = xml.processattributes +xml.collect_texts = xml.collecttexts obsolete.collect_texts = xml.collecttexts +xml.inject_element = xml.inject obsolete.inject_element = xml.inject +xml.remap_tag = xml.remaptag obsolete.remap_tag = xml.remaptag +xml.remap_name = xml.remapname obsolete.remap_name = xml.remapname +xml.remap_namespace = xml.remapnamespace obsolete.remap_namespace = xml.remapnamespace end -- of closure @@ -7084,10 +9375,15 @@ if not modules then modules = { } end modules ['lxml-xml'] = { license = "see context related readme files" } +local concat = string.concat + +local xml = xml + local finalizers = xml.finalizers.xml local xmlfilter = xml.filter -- we could inline this one for speed local xmltostring = xml.tostring local xmlserialize = xml.serialize +local xmlcollected = xml.collected local function first(collected) -- wrong ? return collected and collected[1] @@ -7101,15 +9397,8 @@ local function all(collected) return collected end -local function reverse(collected) - if collected then - local reversed = { } - for c=#collected,1,-1 do - reversed[#reversed+1] = collected[c] - end - return reversed - end -end + +local reverse = table.reversed local function attribute(collected,name) if collected and #collected > 0 then @@ -7200,11 +9489,12 @@ end local function texts(collected) if collected then - local t = { } + local t, n = { }, 0 for c=1,#collected do - local e = collection[c] + local e = collected[c] if e and e.dt then - t[#t+1] = e.dt + n = n + 1 + t[n] = e.dt end end return t @@ -7247,14 +9537,15 @@ end local function tags(collected,nonamespace) if collected then - local t = { } + local t, n = { }, 0 for c=1,#collected do local e = collected[c] local ns, tg = e.ns, e.tg + n = n + 1 if nonamespace or ns == "" then - t[#t+1] = tg + t[n] = tg else - t[#t+1] = ns .. ":" .. tg + t[n] = ns .. ":" .. tg end end return t @@ -7365,1812 +9656,1937 @@ xml.all = xml.filter xml.index = xml.position xml.found = xml.filter +-- a nice one: + +local function totable(x) + local t = { } + for e in xmlcollected(x[1] or x,"/*") do + t[e.tg] = xmltostring(e.dt) or "" + end + return next(t) and t or nil +end + +xml.table = totable +finalizers.table = totable + +local function textonly(e,t) + if e then + local edt = e.dt + if edt then + for i=1,#edt do + local e = edt[i] + if type(e) == "table" then + textonly(e,t) + else + t[#t+1] = e + end + end + end + end + return t +end + +function xml.textonly(e) -- no pattern + return concat(textonly(e,{})) +end + end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['luat-env'] = { +if not modules then modules = { } end modules ['data-ini'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" + license = "see context related readme files", } --- A former version provided functionality for non embeded core --- scripts i.e. runtime library loading. Given the amount of --- Lua code we use now, this no longer makes sense. Much of this --- evolved before bytecode arrays were available and so a lot of --- code has disappeared already. +local gsub, find, gmatch = string.gsub, string.find, string.gmatch +local concat = table.concat +local next, type = next, type -local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local filedirname, filebasename, fileextname, filejoin = file.dirname, file.basename, file.extname, file.join -local format, sub, match, gsub, find = string.format, string.sub, string.match, string.gsub, string.find -local unquote, quote = string.unquote, string.quote +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_detail = false trackers.register("resolvers.details", function(v) trace_detail = v end) +local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end) --- precautions +local report_initialization = logs.reporter("resolvers","initialization") -os.setlocale(nil,nil) -- useless feature and even dangerous in luatex +local ostype, osname, ossetenv, osgetenv = os.type, os.name, os.setenv, os.getenv -function os.setlocale() - -- no way you can mess with it -end +-- The code here used to be part of a data-res but for convenience +-- we now split it over multiple files. As this file is now the +-- starting point we introduce resolvers here. --- dirty tricks +resolvers = resolvers or { } +local resolvers = resolvers + +-- We don't want the kpse library to kick in. Also, we want to be able to +-- execute programs. Control over execution is implemented later. + +texconfig.kpse_init = false +texconfig.shell_escape = 't' + +kpse = { original = kpse } + +setmetatable(kpse, { + __index = function(kp,name) + report_initialization("fatal error: kpse library is accessed (key: %s)",name) + os.exit() + end +} ) + +-- First we check a couple of environment variables. Some might be +-- set already but we need then later on. We start with the system +-- font path. + +do + + local osfontdir = osgetenv("OSFONTDIR") + + if osfontdir and osfontdir ~= "" then + -- ok + elseif osname == "windows" then + ossetenv("OSFONTDIR","c:/windows/fonts//") + elseif osname == "macosx" then + ossetenv("OSFONTDIR","$HOME/Library/Fonts//;/Library/Fonts//;/System/Library/Fonts//") + end -if arg and (arg[0] == 'luatex' or arg[0] == 'luatex.exe') and arg[1] == "--luaonly" then - arg[-1]=arg[0] arg[0]=arg[2] for k=3,#arg do arg[k-2]=arg[k] end arg[#arg]=nil arg[#arg]=nil end -if profiler and os.env["MTX_PROFILE_RUN"] == "YES" then - profiler.start("luatex-profile.log") +-- Next comes the user's home path. We need this as later on we have +-- to replace ~ with its value. + +do + + local homedir = osgetenv(ostype == "windows" and 'USERPROFILE' or 'HOME') or '' + + if not homedir or homedir == "" then + homedir = string.char(127) -- we need a value, later we wil trigger on it + end + + homedir = file.collapsepath(homedir) + + ossetenv("HOME", homedir) -- can be used in unix cnf files + ossetenv("USERPROFILE",homedir) -- can be used in windows cnf files + + environment.homedir = homedir + end --- environment +-- The following code sets the name of the own binary and its +-- path. This is fallback code as we have os.selfdir now. -environment = environment or { } -environment.arguments = { } -environment.files = { } -environment.sortedflags = nil +do -if not environment.jobname or environment.jobname == "" then if tex then environment.jobname = tex.jobname end end -if not environment.version or environment.version == "" then environment.version = "unknown" end -if not environment.jobname then environment.jobname = "unknown" end + local args = environment.originalarguments or arg -- this needs a cleanup -function environment.initialize_arguments(arg) - local arguments, files = { }, { } - environment.arguments, environment.files, environment.sortedflags = arguments, files, nil - for index=1,#arg do - local argument = arg[index] - if index > 0 then - local flag, value = match(argument,"^%-+(.-)=(.-)$") - if flag then - arguments[flag] = unquote(value or "") - else - flag = match(argument,"^%-+(.+)") - if flag then - arguments[flag] = true - else - files[#files+1] = argument + local ownbin = environment.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex" + local ownpath = environment.ownpath or os.selfdir + + ownbin = file.collapsepath(ownbin) + ownpath = file.collapsepath(ownpath) + + if not ownpath or ownpath == "" or ownpath == "unset" then + ownpath = args[-1] or arg[-1] + ownpath = ownpath and filedirname(gsub(ownpath,"\\","/")) + if not ownpath or ownpath == "" then + ownpath = args[-0] or arg[-0] + ownpath = ownpath and filedirname(gsub(ownpath,"\\","/")) + end + local binary = ownbin + if not ownpath or ownpath == "" then + ownpath = ownpath and filedirname(binary) + end + if not ownpath or ownpath == "" then + if os.binsuffix ~= "" then + binary = file.replacesuffix(binary,os.binsuffix) + end + local path = osgetenv("PATH") + if path then + for p in gmatch(path,"[^"..io.pathseparator.."]+") do + local b = filejoin(p,binary) + if lfs.isfile(b) then + -- we assume that after changing to the path the currentdir function + -- resolves to the real location and use this side effect here; this + -- trick is needed because on the mac installations use symlinks in the + -- path instead of real locations + local olddir = lfs.currentdir() + if lfs.chdir(p) then + local pp = lfs.currentdir() + if trace_locating and p ~= pp then + report_initialization("following symlink '%s' to '%s'",p,pp) + end + ownpath = pp + lfs.chdir(olddir) + else + if trace_locating then + report_initialization("unable to check path '%s'",p) + end + ownpath = p + end + break + end end end end + if not ownpath or ownpath == "" then + ownpath = "." + report_initialization("forcing fallback ownpath .") + elseif trace_locating then + report_initialization("using ownpath '%s'",ownpath) + end end - environment.ownname = environment.ownname or arg[0] or 'unknown.lua' + + environment.ownbin = ownbin + environment.ownpath = ownpath + end -function environment.setargument(name,value) - environment.arguments[name] = value +resolvers.ownpath = environment.ownpath + +function resolvers.getownpath() + return environment.ownpath end --- todo: defaults, better checks e.g on type (boolean versus string) --- --- tricky: too many hits when we support partials unless we add --- a registration of arguments so from now on we have 'partial' +-- The self variables permit us to use only a few (or even no) +-- environment variables. -function environment.argument(name,partial) - local arguments, sortedflags = environment.arguments, environment.sortedflags - if arguments[name] then - return arguments[name] - elseif partial then - if not sortedflags then - sortedflags = table.sortedkeys(arguments) - for k=1,#sortedflags do - sortedflags[k] = "^" .. sortedflags[k] - end - environment.sortedflags = sortedflags - end - -- example of potential clash: ^mode ^modefile - for k=1,#sortedflags do - local v = sortedflags[k] - if find(name,v) then - return arguments[sub(v,2,#v)] - end - end +do + + local ownpath = environment.ownpath or dir.current() + + if ownpath then + ossetenv('SELFAUTOLOC', file.collapsepath(ownpath)) + ossetenv('SELFAUTODIR', file.collapsepath(ownpath .. "/..")) + ossetenv('SELFAUTOPARENT', file.collapsepath(ownpath .. "/../..")) + else + report_initialization("error: unable to locate ownpath") + os.exit() end - return nil + end -environment.argument("x",true) +-- The running os: -function environment.split_arguments(separator) -- rather special, cut-off before separator - local done, before, after = false, { }, { } - local original_arguments = environment.original_arguments - for k=1,#original_arguments do - local v = original_arguments[k] - if not done and v == separator then - done = true - elseif done then - after[#after+1] = v - else - before[#before+1] = v - end - end - return before, after +-- todo: check is context sits here os.platform is more trustworthy +-- that the bin check as mtx-update runs from another path + +local texos = environment.texos or osgetenv("TEXOS") +local texmfos = environment.texmfos or osgetenv('SELFAUTODIR') + +if not texos or texos == "" then + texos = file.basename(texmfos) end -function environment.reconstruct_commandline(arg,noquote) - arg = arg or environment.original_arguments - if noquote and #arg == 1 then - local a = arg[1] - a = resolvers.resolve(a) - a = unquote(a) - return a - elseif #arg > 0 then - local result = { } - for i=1,#arg do - local a = arg[i] - a = resolvers.resolve(a) - a = unquote(a) - a = gsub(a,'"','\\"') -- tricky - if find(a," ") then - result[#result+1] = quote(a) - else - result[#result+1] = a - end - end - return table.join(result," ") - else - return "" +ossetenv('TEXMFOS', texmfos) -- full bin path +ossetenv('TEXOS', texos) -- partial bin parent +ossetenv('SELFAUTOSYSTEM',os.platform) -- bonus + +environment.texos = texos +environment.texmfos = texmfos + +-- The current root: + +local texroot = environment.texroot or osgetenv("TEXROOT") + +if not texroot or texroot == "" then + texroot = osgetenv('SELFAUTOPARENT') + ossetenv('TEXROOT',texroot) +end + +environment.texroot = file.collapsepath(texroot) + +-- Tracing. Todo ... + +function resolvers.settrace(n) -- no longer number but: 'locating' or 'detail' + if n then + trackers.disable("resolvers.*") + trackers.enable("resolvers."..n) end end -if arg then +resolvers.settrace(osgetenv("MTX_INPUT_TRACE")) + +-- todo: + +-- if profiler and osgetenv("MTX_PROFILE_RUN") == "YES" then +-- profiler.start("luatex-profile.log") +-- end + +-- a forward definition + +if not resolvers.resolve then + function resolvers.resolve (s) return s end + function resolvers.unresolve(s) return s end + function resolvers.repath (s) return s end +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-exp'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +local format, find, gmatch, lower = string.format, string.find, string.gmatch, string.lower +local concat, sort = table.concat, table.sort +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns +local Ct, Cs, Cc, P, C, S = lpeg.Ct, lpeg.Cs, lpeg.Cc, lpeg.P, lpeg.C, lpeg.S +local type, next = type, next - -- new, reconstruct quoted snippets (maybe better just remove the " then and add them later) - local newarg, instring = { }, false +local ostype = os.type +local collapsepath = file.collapsepath - for index=1,#arg do - local argument = arg[index] - if find(argument,"^\"") then - newarg[#newarg+1] = gsub(argument,"^\"","") - if not find(argument,"\"$") then - instring = true - end - elseif find(argument,"\"$") then - newarg[#newarg] = newarg[#newarg] .. " " .. gsub(argument,"\"$","") - instring = false - elseif instring then - newarg[#newarg] = newarg[#newarg] .. " " .. argument - else - newarg[#newarg+1] = argument - end - end - for i=1,-5,-1 do - newarg[i] = arg[i] - end +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end) - environment.initialize_arguments(newarg) - environment.original_arguments = newarg - environment.raw_arguments = arg +local report_expansions = logs.reporter("resolvers","expansions") - arg = { } -- prevent duplicate handling +local resolvers = resolvers -end +-- As this bit of code is somewhat special it gets its own module. After +-- all, when working on the main resolver code, I don't want to scroll +-- past this every time. See data-obs.lua for the gsub variant. --- weird place ... depends on a not yet loaded module +-- {a,b,c,d} +-- a,b,c/{p,q,r},d +-- a,b,c/{p,q,r}/d/{x,y,z}// +-- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} +-- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} +-- a{b,c}{d,e}f +-- {a,b,c,d} +-- {a,b,c/{p,q,r},d} +-- {a,b,c/{p,q,r}/d/{x,y,z}//} +-- {a,b,c/{p,q/{x,y,z}},d/{p,q,r}} +-- {a,b,c/{p,q/{x,y,z},w}v,d/{p,q,r}} +-- {$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c} -function environment.texfile(filename) - return resolvers.find_file(filename,'tex') +local function f_first(a,b) + local t, n = { }, 0 + for s in gmatch(b,"[^,]+") do + n = n + 1 ; t[n] = a .. s + end + return concat(t,",") end -function environment.luafile(filename) - local resolved = resolvers.find_file(filename,'tex') or "" - if resolved ~= "" then - return resolved +local function f_second(a,b) + local t, n = { }, 0 + for s in gmatch(a,"[^,]+") do + n = n + 1 ; t[n] = s .. b end - resolved = resolvers.find_file(filename,'texmfscripts') or "" - if resolved ~= "" then - return resolved + return concat(t,",") +end + +local function f_both(a,b) + local t, n = { }, 0 + for sa in gmatch(a,"[^,]+") do + for sb in gmatch(b,"[^,]+") do + n = n + 1 ; t[n] = sa .. sb + end end - return resolvers.find_file(filename,'luatexlibs') or "" + return concat(t,",") end -environment.loadedluacode = loadfile -- can be overloaded +local left = P("{") +local right = P("}") +local var = P((1 - S("{}" ))^0) +local set = P((1 - S("{},"))^0) +local other = P(1) ---~ function environment.loadedluacode(name) ---~ if os.spawn("texluac -s -o texluac.luc " .. name) == 0 then ---~ local chunk = loadstring(io.loaddata("texluac.luc")) ---~ os.remove("texluac.luc") ---~ return chunk ---~ else ---~ environment.loadedluacode = loadfile -- can be overloaded ---~ return loadfile(name) ---~ end ---~ end - -function environment.luafilechunk(filename) -- used for loading lua bytecode in the format - filename = file.replacesuffix(filename, "lua") - local fullname = environment.luafile(filename) - if fullname and fullname ~= "" then - if trace_locating then - logs.report("fileio","loading file %s", fullname) +local l_first = Cs( ( Cc("{") * (C(set) * left * C(var) * right / f_first) * Cc("}") + other )^0 ) +local l_second = Cs( ( Cc("{") * (left * C(var) * right * C(set) / f_second) * Cc("}") + other )^0 ) +local l_both = Cs( ( Cc("{") * (left * C(var) * right * left * C(var) * right / f_both) * Cc("}") + other )^0 ) +local l_rest = Cs( ( left * var * (left/"") * var * (right/"") * var * right + other )^0 ) + +local stripper_1 = lpeg.stripper ("{}@") +local replacer_1 = lpeg.replacer { { ",}", ",@}" }, { "{,", "{@," }, } + +local function splitpathexpr(str, newlist, validate) -- I couldn't resist lpegging it (nice exercise). + if trace_expansions then + report_expansions("expanding variable '%s'",str) + end + local t, ok, done = newlist or { }, false, false + local n = #t + str = lpegmatch(replacer_1,str) + repeat local old = str + repeat local old = str ; str = lpegmatch(l_first, str) until old == str + repeat local old = str ; str = lpegmatch(l_second,str) until old == str + repeat local old = str ; str = lpegmatch(l_both, str) until old == str + repeat local old = str ; str = lpegmatch(l_rest, str) until old == str + until old == str -- or not find(str,"{") + str = lpegmatch(stripper_1,str) + if validate then + for s in gmatch(str,"[^,]+") do + s = validate(s) + if s then + n = n + 1 ; t[n] = s + end end - return environment.loadedluacode(fullname) else - if trace_locating then - logs.report("fileio","unknown file %s", filename) + for s in gmatch(str,"[^,]+") do + n = n + 1 ; t[n] = s + end + end + if trace_expansions then + for k=1,#t do + report_expansions("% 4i: %s",k,t[k]) end - return nil end + return t end --- the next ones can use the previous ones / combine +-- We could make the previous one public. -function environment.loadluafile(filename, version) - local lucname, luaname, chunk - local basename = file.removesuffix(filename) - if basename == filename then - lucname, luaname = basename .. ".luc", basename .. ".lua" - else - lucname, luaname = nil, basename -- forced suffix - end - -- when not overloaded by explicit suffix we look for a luc file first - local fullname = (lucname and environment.luafile(lucname)) or "" - if fullname ~= "" then - if trace_locating then - logs.report("fileio","loading %s", fullname) - end - chunk = loadfile(fullname) -- this way we don't need a file exists check +local function validate(s) + s = collapsepath(s) -- already keeps the // + return s ~= "" and not find(s,"^!*unset/*$") and s +end + +resolvers.validatedpath = validate -- keeps the trailing // + +function resolvers.expandedpathfromlist(pathlist) + local newlist = { } + for k=1,#pathlist do + splitpathexpr(pathlist[k],newlist,validate) end - if chunk then - assert(chunk)() - if version then - -- we check of the version number of this chunk matches - local v = version -- can be nil - if modules and modules[filename] then - v = modules[filename].version -- new method - elseif versions and versions[filename] then - v = versions[filename] -- old method + return newlist +end + +local cleanup = lpeg.replacer { + { "!" , "" }, + { "\\" , "/" }, +} + +local homedir + +function resolvers.cleanpath(str) + if not homedir then + homedir = lpegmatch(cleanup,environment.homedir or "") + if homedir == string.char(127) or homedir == "" or not lfs.isdir(homedir) then + if trace_expansions then + report_expansions("no home dir set, ignoring dependent paths") end - if v == version then - return true - else - if trace_locating then - logs.report("fileio","version mismatch for %s: lua=%s, luc=%s", filename, v, version) + function resolvers.cleanpath(str) + if find(str,"~") then + return "" -- special case + else + return str and lpegmatch(cleanup,str) end - environment.loadluafile(filename) end else - return true - end - end - fullname = (luaname and environment.luafile(luaname)) or "" - if fullname ~= "" then - if trace_locating then - logs.report("fileio","loading %s", fullname) - end - chunk = loadfile(fullname) -- this way we don't need a file exists check - if not chunk then - if trace_locating then - logs.report("fileio","unknown file %s", filename) + cleanup = lpeg.replacer { + { "!" , "" }, + { "\\" , "/" }, + { "~" , homedir }, + } + function resolvers.cleanpath(str) + return str and lpegmatch(cleanup,str) end - else - assert(chunk)() - return true end end - return false + return resolvers.cleanpath(str) end +-- This one strips quotes and funny tokens. -end -- of closure - -do -- create closure to overcome 200 locals limit +local expandhome = P("~") / "$HOME" -- environment.homedir -if not modules then modules = { } end modules ['trac-inf'] = { - version = 1.001, - comment = "companion to trac-inf.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} +local dodouble = P('"')/"" * (expandhome + (1 - P('"')))^0 * P('"')/"" +local dosingle = P("'")/"" * (expandhome + (1 - P("'")))^0 * P("'")/"" +local dostring = (expandhome + 1 )^0 -local format = string.format +local stripper = Cs( + lpegpatterns.unspacer * (dosingle + dodouble + dostring) * lpegpatterns.unspacer +) -local statusinfo, n, registered = { }, 0, { } +function resolvers.checkedvariable(str) -- assumes str is a string + return lpegmatch(stripper,str) or str +end -statistics = statistics or { } +-- The path splitter: -statistics.enable = true -statistics.threshold = 0.05 +-- A config (optionally) has the paths split in tables. Internally +-- we join them and split them after the expansion has taken place. This +-- is more convenient. --- timing functions +local cache = { } -local clock = os.gettimeofday or os.clock +---- splitter = Ct(lpeg.splitat(S(ostype == "windows" and ";" or ":;"))) -- maybe add , +local splitter = Ct(lpeg.splitat(";")) -- as we move towards urls, prefixes and use tables we no longer do : -local notimer +local backslashswapper = lpeg.replacer("\\","/") -function statistics.hastimer(instance) - return instance and instance.starttime +local function splitconfigurationpath(str) -- beware, this can be either a path or a { specification } + if str then + local found = cache[str] + if not found then + if str == "" then + found = { } + else + local split = lpegmatch(splitter,lpegmatch(backslashswapper,str)) -- can be combined + found = { } + local noffound = 0 + for i=1,#split do + local s = split[i] + if not find(s,"^{*unset}*") then + noffound = noffound + 1 + found[noffound] = s + end + end + if trace_expansions then + report_expansions("splitting path specification '%s'",str) + for k=1,noffound do + report_expansions("% 4i: %s",k,found[k]) + end + end + cache[str] = found + end + end + return found + end end -function statistics.resettiming(instance) - if not instance then - notimer = { timing = 0, loadtime = 0 } +resolvers.splitconfigurationpath = splitconfigurationpath + +function resolvers.splitpath(str) + if type(str) == 'table' then + return str else - instance.timing, instance.loadtime = 0, 0 + return splitconfigurationpath(str) end end -function statistics.starttiming(instance) - if not instance then - notimer = { } - instance = notimer - end - local it = instance.timing - if not it then - it = 0 - end - if it == 0 then - instance.starttime = clock() - if not instance.loadtime then - instance.loadtime = 0 - end +function resolvers.joinpath(str) + if type(str) == 'table' then + return file.joinpath(str) else ---~ logs.report("system","nested timing (%s)",tostring(instance)) + return str end - instance.timing = it + 1 end -function statistics.stoptiming(instance, report) - if not instance then - instance = notimer - end - if instance then - local it = instance.timing - if it > 1 then - instance.timing = it - 1 - else - local starttime = instance.starttime - if starttime then - local stoptime = clock() - local loadtime = stoptime - starttime - instance.stoptime = stoptime - instance.loadtime = instance.loadtime + loadtime - if report then - statistics.report("load time %0.3f",loadtime) +-- The next function scans directories and returns a hash where the +-- entries are either strings or tables. + +-- starting with . or .. etc or funny char + + + + +local weird = P(".")^1 + lpeg.anywhere(S("~`!#$%^&*()={}[]:;\"\'||<>,?\n\r\t")) + +local attributes, directory = lfs.attributes, lfs.dir + +local function scan(files,spec,path,n,m,r) + local full = (path == "" and spec) or (spec .. path .. '/') + local dirs, nofdirs = { }, 0 + for name in directory(full) do + if not lpegmatch(weird,name) then + local mode = attributes(full..name,'mode') + if mode == 'file' then + n = n + 1 + local f = files[name] + if f then + if type(f) == 'string' then + files[name] = { f, path } + else + f[#f+1] = path + end + else -- probably unique anyway + files[name] = path + local lower = lower(name) + if name ~= lower then + files["remap:"..lower] = name + r = r + 1 + end + end + elseif mode == 'directory' then + m = m + 1 + nofdirs = nofdirs + 1 + if path ~= "" then + dirs[nofdirs] = path..'/'..name + else + dirs[nofdirs] = name end - instance.timing = 0 - return loadtime end end end - return 0 -end - -function statistics.elapsedtime(instance) - if not instance then - instance = notimer + if nofdirs > 0 then + sort(dirs) + for i=1,nofdirs do + files, n, m, r = scan(files,spec,dirs[i],n,m,r) + end end - return format("%0.3f",(instance and instance.loadtime) or 0) + return files, n, m, r end -function statistics.elapsedindeed(instance) - if not instance then - instance = notimer +function resolvers.scanfiles(path,branch) + if trace_locating then + report_expansions("scanning path '%s', branch '%s'",path, branch or path) + end + local realpath = resolvers.resolve(path) -- no shortcut + local files, n, m, r = scan({ },realpath .. '/',"",0,0,0) + files.__path__ = path -- can be selfautoparent:texmf-whatever + files.__files__ = n + files.__directories__ = m + files.__remappings__ = r + if trace_locating then + report_expansions("%s files found on %s directories with %s uppercase remappings",n,m,r) end - local t = (instance and instance.loadtime) or 0 - return t > statistics.threshold + return files end -function statistics.elapsedseconds(instance,rest) -- returns nil if 0 seconds - if statistics.elapsedindeed(instance) then - return format("%s seconds %s", statistics.elapsedtime(instance),rest or "") - end -end --- general function -function statistics.register(tag,fnc) - if statistics.enable and type(fnc) == "function" then - local rt = registered[tag] or (#statusinfo + 1) - statusinfo[rt] = { tag, fnc } - registered[tag] = rt - if #tag > n then n = #tag end - end -end +end -- of closure -function statistics.show(reporter) - if statistics.enable then - if not reporter then reporter = function(tag,data,n) texio.write_nl(tag .. " " .. data) end end - -- this code will move - local register = statistics.register - register("luatex banner", function() - return string.lower(status.banner) - end) - register("control sequences", function() - return format("%s of %s", status.cs_count, status.hash_size+status.hash_extra) - end) - register("callbacks", function() - local total, indirect = status.callbacks or 0, status.indirect_callbacks or 0 - return format("direct: %s, indirect: %s, total: %s", total-indirect, indirect, total) - end) - register("current memory usage", statistics.memused) - register("runtime",statistics.runtime) --- -- - for i=1,#statusinfo do - local s = statusinfo[i] - local r = s[2]() - if r then - reporter(s[1],r,n) +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-env'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +local lower, gsub = string.lower, string.gsub + +local resolvers = resolvers + +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex +local fileextname = file.extname + +local formats = allocate() +local suffixes = allocate() +local dangerous = allocate() +local suffixmap = allocate() + +resolvers.formats = formats +resolvers.suffixes = suffixes +resolvers.dangerous = dangerous +resolvers.suffixmap = suffixmap + +local relations = allocate { -- todo: handlers also here + core = { + ofm = { -- will become obsolete + names = { "ofm", "omega font metric", "omega font metrics" }, + variable = 'OFMFONTS', + suffixes = { 'ofm', 'tfm' }, + }, + ovf = { -- will become obsolete + names = { "ovf", "omega virtual font", "omega virtual fonts" }, + variable = 'OVFFONTS', + suffixes = { 'ovf', 'vf' }, + }, + tfm = { + names = { "tfm", "tex font metric", "tex font metrics" }, + variable = 'TFMFONTS', + suffixes = { 'tfm' }, + }, + vf = { + names = { "vf", "virtual font", "virtual fonts" }, + variable = 'VFFONTS', + suffixes = { 'vf' }, + }, + otf = { + names = { "otf", "opentype", "opentype font", "opentype fonts"}, + variable = 'OPENTYPEFONTS', + suffixes = { 'otf' }, + }, + ttf = { + names = { "ttf", "truetype", "truetype font", "truetype fonts", "truetype collection", "truetype collections", "truetype dictionary", "truetype dictionaries" }, + variable = 'TTFONTS', + suffixes = { 'ttf', 'ttc', 'dfont' }, + }, + afm = { + names = { "afm", "adobe font metric", "adobe font metrics" }, + variable = "AFMFONTS", + suffixes = { "afm" }, + }, + pfb = { + names = { "pfb", "type1", "type 1", "type1 font", "type 1 font", "type1 fonts", "type 1 fonts" }, + variable = 'T1FONTS', + suffixes = { 'pfb', 'pfa' }, + }, + fea = { + names = { "fea", "font feature", "font features", "font feature file", "font feature files" }, + variable = 'FONTFEATURES', + suffixes = { 'fea' }, + }, + cid = { + names = { "cid", "cid map", "cid maps", "cid file", "cid files" }, + variable = 'FONTCIDMAPS', + suffixes = { 'cid', 'cidmap' }, + }, + fmt = { + names = { "fmt", "format", "tex format" }, + variable = 'TEXFORMATS', + suffixes = { 'fmt' }, + }, + mem = { -- will become obsolete + names = { 'mem', "metapost format" }, + variable = 'MPMEMS', + suffixes = { 'mem' }, + }, + mp = { + names = { "mp" }, + variable = 'MPINPUTS', + suffixes = { 'mp' }, + }, + tex = { + names = { "tex" }, + variable = 'TEXINPUTS', + suffixes = { 'tex', "mkiv", "mkiv", "mkii" }, + }, + icc = { + names = { "icc", "icc profile", "icc profiles" }, + variable = 'ICCPROFILES', + suffixes = { 'icc' }, + }, + texmfscripts = { + names = { "texmfscript", "texmfscripts", "script", "scripts" }, + variable = 'TEXMFSCRIPTS', + suffixes = { 'rb', 'pl', 'py' }, + }, + lua = { + names = { "lua" }, + variable = 'LUAINPUTS', + suffixes = { 'lua', 'luc', 'tma', 'tmc' }, + }, + lib = { + names = { "lib" }, + variable = 'CLUAINPUTS', + suffixes = os.libsuffix and { os.libsuffix } or { 'dll', 'so' }, + }, + bib = { + names = { 'bib' }, + suffixes = { 'bib' }, + }, + bst = { + names = { 'bst' }, + suffixes = { 'bst' }, + }, + fontconfig = { + names = { 'fontconfig', 'fontconfig file', 'fontconfig files' }, + variable = 'FONTCONFIG_PATH', + }, + }, + obsolete = { + enc = { + names = { "enc", "enc files", "enc file", "encoding files", "encoding file" }, + variable = 'ENCFONTS', + suffixes = { 'enc' }, + }, + map = { + names = { "map", "map files", "map file" }, + variable = 'TEXFONTMAPS', + suffixes = { 'map' }, + }, + lig = { + names = { "lig files", "lig file", "ligature file", "ligature files" }, + variable = 'LIGFONTS', + suffixes = { 'lig' }, + }, + opl = { + names = { "opl" }, + variable = 'OPLFONTS', + suffixes = { 'opl' }, + }, + ovp = { + names = { "ovp" }, + variable = 'OVPFONTS', + suffixes = { 'ovp' }, + }, + }, + kpse = { -- subset + base = { + names = { 'base', "metafont format" }, + variable = 'MFBASES', + suffixes = { 'base', 'bas' }, + }, + cmap = { + names = { 'cmap', 'cmap files', 'cmap file' }, + variable = 'CMAPFONTS', + suffixes = { 'cmap' }, + }, + cnf = { + names = { 'cnf' }, + suffixes = { 'cnf' }, + }, + web = { + names = { 'web' }, + suffixes = { 'web', 'ch' } + }, + cweb = { + names = { 'cweb' }, + suffixes = { 'w', 'web', 'ch' }, + }, + gf = { + names = { 'gf' }, + suffixes = { 'gf' }, + }, + mf = { + names = { 'mf' }, + variable = 'MFINPUTS', + suffixes = { 'mf' }, + }, + mft = { + names = { 'mft' }, + suffixes = { 'mft' }, + }, + pk = { + names = { 'pk' }, + suffixes = { 'pk' }, + }, + }, +} + +resolvers.relations = relations + +-- formats: maps a format onto a variable + +function resolvers.updaterelations() + for category, categories in next, relations do + for name, relation in next, categories do + local rn = relation.names + local rv = relation.variable + local rs = relation.suffixes + if rn and rv then + for i=1,#rn do + local rni = lower(gsub(rn[i]," ","")) + formats[rni] = rv + if rs then + suffixes[rni] = rs + for i=1,#rs do + local rsi = rs[i] + suffixmap[rsi] = rni + end + end + end + end + if rs then end end - texio.write_nl("") -- final newline - statistics.enable = false end end -function statistics.show_job_stat(tag,data,n) - texio.write_nl(format("%-15s: %s - %s","mkiv lua stats",tag:rpadd(n," "),data)) +resolvers.updaterelations() -- push this in the metatable -> newindex + +local function simplified(t,k) + return rawget(t,lower(gsub(k," ",""))) end -function statistics.memused() -- no math.round yet -) - local round = math.round or math.floor - return format("%s MB (ctx: %s MB)",round(collectgarbage("count")/1000), round(status.luastate_bytes/1000000)) +setmetatableindex(formats, simplified) +setmetatableindex(suffixes, simplified) +setmetatableindex(suffixmap, simplified) + +-- A few accessors, mostly for command line tool. + +function resolvers.suffixofformat(str) + local s = suffixes[str] + return s and s[1] or "" end -if statistics.runtime then - -- already loaded and set -elseif luatex and luatex.starttime then - statistics.starttime = luatex.starttime - statistics.loadtime = 0 - statistics.timing = 0 -else - statistics.starttiming(statistics) +function resolvers.suffixofformat(str) + return suffixes[str] or { } end -function statistics.runtime() - statistics.stoptiming(statistics) - return statistics.formatruntime(statistics.elapsedtime(statistics)) +for name, format in next, formats do + dangerous[name] = true -- still needed ? end -function statistics.formatruntime(runtime) - return format("%s seconds", statistics.elapsedtime(statistics)) -end +-- because vf searching is somewhat dangerous, we want to prevent +-- too liberal searching esp because we do a lookup on the current +-- path anyway; only tex (or any) is safe + +dangerous.tex = nil -function statistics.timed(action,report) - local timer = { } - report = report or logs.simple - statistics.starttiming(timer) - action() - statistics.stoptiming(timer) - report("total runtime: %s",statistics.elapsedtime(timer)) -end --- where, not really the best spot for this: +-- more helpers -commands = commands or { } +function resolvers.formatofvariable(str) + return formats[str] or '' +end -local timer +function resolvers.formatofsuffix(str) -- of file + return suffixmap[fileextname(str)] or 'tex' -- so many map onto tex (like mkiv, cld etc) +end -function commands.resettimer() - statistics.resettiming(timer) - statistics.starttiming(timer) +function resolvers.variableofformat(str) + return formats[str] or '' end -function commands.elapsedtime() - statistics.stoptiming(timer) - tex.sprint(statistics.elapsedtime(timer)) +function resolvers.variableofformatorsuffix(str) + local v = formats[str] + if v then + return v + end + v = suffixmap[fileextname(str)] + if v then + return formats[v] + end + return '' end -commands.resettimer() end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['trac-log'] = { - version = 1.001, - comment = "companion to trac-log.mkiv", +if not modules then modules = { } end modules ['data-tmp'] = { + version = 1.100, + comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } --- this is old code that needs an overhaul - ---~ io.stdout:setvbuf("no") ---~ io.stderr:setvbuf("no") - -local write_nl, write = texio.write_nl or print, texio.write or io.write -local format, gmatch = string.format, string.gmatch -local texcount = tex and tex.count - -if texlua then - write_nl = print - write = io.write -end - --[[ldx-- -

This is a prelude to a more extensive logging module. For the sake -of parsing log files, in addition to the standard logging we will -provide an structured file. Actually, any logging that -is hooked into callbacks will be \XML\ by default.

---ldx]]-- +

This module deals with caching data. It sets up the paths and +implements loaders and savers for tables. Best is to set the +following variable. When not set, the usual paths will be +checked. Personally I prefer the (users) temporary path.

-logs = logs or { } -logs.xml = logs.xml or { } -logs.tex = logs.tex or { } + +TEXMFCACHE=$TMP;$TEMP;$TMPDIR;$TEMPDIR;$HOME;$TEXMFVAR;$VARTEXMF;. + ---[[ldx-- -

This looks pretty ugly but we need to speed things up a bit.

+

Currently we do no locking when we write files. This is no real +problem because most caching involves fonts and the chance of them +being written at the same time is small. We also need to extend +luatools with a recache feature.

--ldx]]-- -logs.moreinfo = [[ -more information about ConTeXt and the tools that come with it can be found at: +local format, lower, gsub, concat = string.format, string.lower, string.gsub, table.concat +local mkdirs, isdir = dir.mkdirs, lfs.isdir -maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context -webpage : http://www.pragma-ade.nl / http://tex.aanhet.net -wiki : http://contextgarden.net -]] +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) -logs.levels = { - ['error'] = 1, - ['warning'] = 2, - ['info'] = 3, - ['debug'] = 4, -} +local report_caches = logs.reporter("resolvers","caches") +local report_resolvers = logs.reporter("resolvers","caching") -logs.functions = { - 'report', 'start', 'stop', 'push', 'pop', 'line', 'direct', - 'start_run', 'stop_run', - 'start_page_number', 'stop_page_number', - 'report_output_pages', 'report_output_log', - 'report_tex_stat', 'report_job_stat', - 'show_open', 'show_close', 'show_load', -} +local resolvers = resolvers -logs.tracers = { -} +-- intermezzo -logs.level = 0 -logs.mode = string.lower((os.getenv("MTX.LOG.MODE") or os.getenv("MTX_LOG_MODE") or "tex")) +local directive_cleanup = false directives.register("system.compile.cleanup", function(v) directive_cleanup = v end) +local directive_strip = true directives.register("system.compile.strip", function(v) directive_strip = v end) -function logs.set_level(level) - logs.level = logs.levels[level] or level -end +local compile = utilities.lua.compile -function logs.set_method(method) - for _, v in next, logs.functions do - logs[v] = logs[method][v] or function() end - end +function utilities.lua.compile(luafile,lucfile,cleanup,strip) + if cleanup == nil then cleanup = directive_cleanup end + if strip == nil then strip = directive_strip end + return compile(luafile,lucfile,cleanup,strip) end --- tex logging +-- end of intermezzo -function logs.tex.report(category,fmt,...) -- new - if fmt then - write_nl(category .. " | " .. format(fmt,...)) - else - write_nl(category .. " |") - end -end +caches = caches or { } +local caches = caches -function logs.tex.line(fmt,...) -- new - if fmt then - write_nl(format(fmt,...)) +caches.base = caches.base or "luatex-cache" +caches.more = caches.more or "context" +caches.direct = false -- true is faster but may need huge amounts of memory +caches.tree = false +caches.force = true +caches.ask = false +caches.relocate = false +caches.defaults = { "TMPDIR", "TEMPDIR", "TMP", "TEMP", "HOME", "HOMEPATH" } + +local writable, readables, usedreadables = nil, { }, { } + +-- we could use a metatable for writable and readable but not yet + +local function identify() + -- Combining the loops makes it messy. First we check the format cache path + -- and when the last component is not present we try to create it. + local texmfcaches = resolvers.cleanpathlist("TEXMFCACHE") + if texmfcaches then + for k=1,#texmfcaches do + local cachepath = texmfcaches[k] + if cachepath ~= "" then + cachepath = resolvers.resolve(cachepath) + cachepath = resolvers.cleanpath(cachepath) + cachepath = file.collapsepath(cachepath) + local valid = isdir(cachepath) + if valid then + if file.is_readable(cachepath) then + readables[#readables+1] = cachepath + if not writable and file.is_writable(cachepath) then + writable = cachepath + end + end + elseif not writable and caches.force then + local cacheparent = file.dirname(cachepath) + if file.is_writable(cacheparent) then + if not caches.ask or io.ask(format("\nShould I create the cache path %s?",cachepath), "no", { "yes", "no" }) == "yes" then + mkdirs(cachepath) + if isdir(cachepath) and file.is_writable(cachepath) then + report_caches("created: %s",cachepath) + writable = cachepath + readables[#readables+1] = cachepath + end + end + end + end + end + end + end + -- As a last resort we check some temporary paths but this time we don't + -- create them. + local texmfcaches = caches.defaults + if texmfcaches then + for k=1,#texmfcaches do + local cachepath = texmfcaches[k] + cachepath = resolvers.expansion(cachepath) -- was getenv + if cachepath ~= "" then + cachepath = resolvers.resolve(cachepath) + cachepath = resolvers.cleanpath(cachepath) + local valid = isdir(cachepath) + if valid and file.is_readable(cachepath) then + if not writable and file.is_writable(cachepath) then + readables[#readables+1] = cachepath + writable = cachepath + break + end + end + end + end + end + -- Some extra checking. If we have no writable or readable path then we simply + -- quit. + if not writable then + report_caches("fatal error: there is no valid writable cache path defined") + os.exit() + elseif #readables == 0 then + report_caches("fatal error: there is no valid readable cache path defined") + os.exit() + end + -- why here + writable = dir.expandname(resolvers.cleanpath(writable)) -- just in case + -- moved here + local base, more, tree = caches.base, caches.more, caches.tree or caches.treehash() -- we have only one writable tree + if tree then + caches.tree = tree + writable = mkdirs(writable,base,more,tree) + for i=1,#readables do + readables[i] = file.join(readables[i],base,more,tree) + end else - write_nl("") + writable = mkdirs(writable,base,more) + for i=1,#readables do + readables[i] = file.join(readables[i],base,more) + end end + -- end + if trace_cache then + for i=1,#readables do + report_caches("using readable path '%s' (order %s)",readables[i],i) + end + report_caches("using writable path '%s'",writable) + end + identify = function() + return writable, readables + end + return writable, readables end ---~ function logs.tex.start_page_number() ---~ local real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno ---~ if real > 0 then ---~ if user > 0 then ---~ if sub > 0 then ---~ write(format("[%s.%s.%s",real,user,sub)) ---~ else ---~ write(format("[%s.%s",real,user)) ---~ end ---~ else ---~ write(format("[%s",real)) ---~ end ---~ else ---~ write("[-") ---~ end ---~ end - ---~ function logs.tex.stop_page_number() ---~ write("]") ---~ end - -local real, user, sub - -function logs.tex.start_page_number() - real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno -end - -function logs.tex.stop_page_number() - if real > 0 then - if user > 0 then - if sub > 0 then - logs.report("pages", "flushing realpage %s, userpage %s, subpage %s",real,user,sub) - else - logs.report("pages", "flushing realpage %s, userpage %s",real,user) +function caches.usedpaths() + local writable, readables = identify() + if #readables > 1 then + local result = { } + for i=1,#readables do + local readable = readables[i] + if usedreadables[i] or readable == writable then + result[#result+1] = format("readable: '%s' (order %s)",readable,i) end - else - logs.report("pages", "flushing realpage %s",real) end + result[#result+1] = format("writable: '%s'",writable) + return result else - logs.report("pages", "flushing page") + return writable end - io.flush() end -logs.tex.report_job_stat = statistics.show_job_stat - --- xml logging +function caches.configfiles() + return table.concat(resolvers.instance.specification,";") +end -function logs.xml.report(category,fmt,...) -- new - if fmt then - write_nl(format("%s",category,format(fmt,...))) - else - write_nl(format("",category)) +function caches.hashed(tree) + tree = gsub(tree,"\\$","/") + tree = gsub(tree,"/+$","") + tree = lower(tree) + local hash = md5.hex(tree) + if trace_cache or trace_locating then + report_caches("hashing tree %s, hash %s",tree,hash) end + return hash end -function logs.xml.line(fmt,...) -- new - if fmt then - write_nl(format("%s",format(fmt,...))) + +function caches.treehash() + local tree = caches.configfiles() + if not tree or tree == "" then + return false else - write_nl("") + return caches.hashed(tree) end end -function logs.xml.start() if logs.level > 0 then tw("<%s>" ) end end -function logs.xml.stop () if logs.level > 0 then tw("") end end -function logs.xml.push () if logs.level > 0 then tw("" ) end end - -function logs.xml.start_run() - write_nl("") - write_nl("") -- xmlns='www.pragma-ade.com/luatex/schemas/context-job.rng' - write_nl("") -end +local r_cache, w_cache = { }, { } -- normally w in in r but who cares -function logs.xml.stop_run() - write_nl("") +local function getreadablepaths(...) -- we can optimize this as we have at most 2 tags + local tags = { ... } + local hash = concat(tags,"/") + local done = r_cache[hash] + if not done then + local writable, readables = identify() -- exit if not found + if #tags > 0 then + done = { } + for i=1,#readables do + done[i] = file.join(readables[i],...) + end + else + done = readables + end + r_cache[hash] = done + end + return done end -function logs.xml.start_page_number() - write_nl(format("

0 then + done = mkdirs(writable,...) + else + done = writable + end + w_cache[hash] = done + end + return done end -function logs.xml.stop_page_number() - write("/>") - write_nl("") -end +caches.getreadablepaths = getreadablepaths +caches.getwritablepath = getwritablepath -function logs.xml.report_output_pages(p,b) - write_nl(format("", p)) - write_nl(format("", b)) - write_nl("") +function caches.getfirstreadablefile(filename,...) + local rd = getreadablepaths(...) + for i=1,#rd do + local path = rd[i] + local fullname = file.join(path,filename) + if file.is_readable(fullname) then + usedreadables[i] = true + return fullname, path + end + end + return caches.setfirstwritablefile(filename,...) end -function logs.xml.report_output_log() +function caches.setfirstwritablefile(filename,...) + local wr = getwritablepath(...) + local fullname = file.join(wr,filename) + return fullname, wr end -function logs.xml.report_tex_stat(k,v) - texiowrite_nl("log",""..tostring(v).."") +function caches.define(category,subcategory) -- for old times sake + return function() + return getwritablepath(category,subcategory) + end end -local level = 0 - -function logs.xml.show_open(name) - level = level + 1 - texiowrite_nl(format("",level,name)) +function caches.setluanames(path,name) + return path .. "/" .. name .. ".tma", path .. "/" .. name .. ".tmc" end -function logs.xml.show_close(name) - texiowrite(" ") - level = level - 1 +function caches.loaddata(readables,name) + if type(readables) == "string" then + readables = { readables } + end + for i=1,#readables do + local path = readables[i] + local tmaname, tmcname = caches.setluanames(path,name) + local loader = loadfile(tmcname) or loadfile(tmaname) + if loader then + loader = loader() + collectgarbage("step") + return loader + end + end + return false end -function logs.xml.show_load(name) - texiowrite_nl(format("",level+1,name)) +function caches.is_writable(filepath,filename) + local tmaname, tmcname = caches.setluanames(filepath,filename) + return file.is_writable(tmaname) end --- - -local name, banner = 'report', 'context' +local saveoptions = { compact = true } -local function report(category,fmt,...) - if fmt then - write_nl(format("%s | %s: %s",name,category,format(fmt,...))) - elseif category then - write_nl(format("%s | %s",name,category)) - else - write_nl(format("%s |",name)) +function caches.savedata(filepath,filename,data,raw) + local tmaname, tmcname = caches.setluanames(filepath,filename) + local reduce, simplify = true, true + if raw then + reduce, simplify = false, false end -end - -local function simple(fmt,...) - if fmt then - write_nl(format("%s | %s",name,format(fmt,...))) + data.cache_uuid = os.uuid() + if caches.direct then + file.savedata(tmaname,table.serialize(data,true,saveoptions)) else - write_nl(format("%s |",name)) + table.tofile(tmaname,data,true,saveoptions) end + utilities.lua.compile(tmaname,tmcname) end -function logs.setprogram(_name_,_banner_,_verbose_) - name, banner = _name_, _banner_ - if _verbose_ then - trackers.enable("resolvers.locating") - end - logs.set_method("tex") - logs.report = report -- also used in libraries - logs.simple = simple -- only used in scripts ! - if utils then - utils.report = simple - end - logs.verbose = _verbose_ -end +-- moved from data-res: -function logs.setverbose(what) - if what then - trackers.enable("resolvers.locating") - else - trackers.disable("resolvers.locating") - end - logs.verbose = what or false -end +local content_state = { } -function logs.extendbanner(_banner_,_verbose_) - banner = banner .. " | ".. _banner_ - if _verbose_ ~= nil then - logs.setverbose(what) - end +function caches.contentstate() + return content_state or { } end -logs.verbose = false -logs.report = logs.tex.report -logs.simple = logs.tex.report - -function logs.reportlines(str) -- todo: - for line in gmatch(str,"(.-)[\n\r]") do - logs.report(line) +function caches.loadcontent(cachename,dataname) + local name = caches.hashed(cachename) + local full, path = caches.getfirstreadablefile(name ..".lua","trees") + local filename = file.join(path,name) + local blob = loadfile(filename .. ".luc") or loadfile(filename .. ".lua") + if blob then + local data = blob() + if data and data.content then + if data.type == dataname then + if data.version == resolvers.cacheversion then + content_state[#content_state+1] = data.uuid + if trace_locating then + report_resolvers("loading '%s' for '%s' from '%s'",dataname,cachename,filename) + end + return data.content + else + report_resolvers("skipping '%s' for '%s' from '%s' (version mismatch)",dataname,cachename,filename) + end + else + report_resolvers("skipping '%s' for '%s' from '%s' (datatype mismatch)",dataname,cachename,filename) + end + elseif trace_locating then + report_resolvers("skipping '%s' for '%s' from '%s' (no content)",dataname,cachename,filename) + end + elseif trace_locating then + report_resolvers("skipping '%s' for '%s' from '%s' (invalid file)",dataname,cachename,filename) end end -function logs.reportline() -- for scripts too - logs.report() -end - -logs.simpleline = logs.reportline - -function logs.reportbanner() -- for scripts too - logs.report(banner) -end - -function logs.help(message,option) - logs.reportbanner() - logs.reportline() - logs.reportlines(message) - local moreinfo = logs.moreinfo or "" - if moreinfo ~= "" and option ~= "nomoreinfo" then - logs.reportline() - logs.reportlines(moreinfo) +function caches.collapsecontent(content) + for k, v in next, content do + if type(v) == "table" and #v == 1 then + content[k] = v[1] + end end end -logs.set_level('error') -logs.set_method('tex') - -function logs.system(whereto,process,jobname,category,...) - for i=1,10 do - local f = io.open(whereto,"a") - if f then - f:write(format("%s %s => %s => %s => %s\r",os.date("%d/%m/%y %H:%m:%S"),process,jobname,category,format(...))) - f:close() - break +function caches.savecontent(cachename,dataname,content) + local name = caches.hashed(cachename) + local full, path = caches.setfirstwritablefile(name ..".lua","trees") + local filename = file.join(path,name) -- is full + local luaname, lucname = filename .. ".lua", filename .. ".luc" + if trace_locating then + report_resolvers("preparing '%s' for '%s'",dataname,cachename) + end + local data = { + type = dataname, + root = cachename, + version = resolvers.cacheversion, + date = os.date("%Y-%m-%d"), + time = os.date("%H:%M:%S"), + content = content, + uuid = os.uuid(), + } + local ok = io.savedata(luaname,table.serialize(data,true)) + if ok then + if trace_locating then + report_resolvers("category '%s', cachename '%s' saved in '%s'",dataname,cachename,luaname) + end + if utilities.lua.compile(luaname,lucname) then + if trace_locating then + report_resolvers("'%s' compiled to '%s'",dataname,lucname) + end + return true else - sleep(0.1) + if trace_locating then + report_resolvers("compiling failed for '%s', deleting file '%s'",dataname,lucname) + end + os.remove(lucname) end + elseif trace_locating then + report_resolvers("unable to save '%s' in '%s' (access error)",dataname,luaname) end end ---~ local syslogname = "oeps.xxx" ---~ ---~ for i=1,10 do ---~ logs.system(syslogname,"context","test","fonts","font %s recached due to newer version (%s)","blabla","123") ---~ end - -function logs.fatal(where,...) - logs.report(where,"fatal error: %s, aborting now",format(...)) - os.exit() -end - end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['data-inp'] = { - version = 1.001, +if not modules then modules = { } end modules ['data-met'] = { + version = 1.100, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files", + license = "see context related readme files" } --- After a few years using the code the large luat-inp.lua file --- has been split up a bit. In the process some functionality was --- dropped: --- --- * support for reading lsr files --- * selective scanning (subtrees) --- * some public auxiliary functions were made private --- --- TODO: os.getenv -> os.env[] --- TODO: instances.[hashes,cnffiles,configurations,522] --- TODO: check escaping in find etc, too much, too slow +local find, format = string.find, string.format +local sequenced = table.sequenced +local addurlscheme, urlhashed = url.addscheme, url.hashed --- This lib is multi-purpose and can be loaded again later on so that --- additional functionality becomes available. We will split thislogs.report("fileio", --- module in components once we're done with prototyping. This is the --- first code I wrote for LuaTeX, so it needs some cleanup. Before changing --- something in this module one can best check with Taco or Hans first; there --- is some nasty trickery going on that relates to traditional kpse support. +local trace_locating = false --- To be considered: hash key lowercase, first entry in table filename --- (any case), rest paths (so no need for optimization). Or maybe a --- separate table that matches lowercase names to mixed case when --- present. In that case the lower() cases can go away. I will do that --- only when we run into problems with names ... well ... Iwona-Regular. +trackers.register("resolvers.locating", function(v) trace_methods = v end) +trackers.register("resolvers.methods", function(v) trace_methods = v end) --- Beware, loading and saving is overloaded in luat-tmp! -local format, gsub, find, lower, upper, match, gmatch = string.format, string.gsub, string.find, string.lower, string.upper, string.match, string.gmatch -local concat, insert, sortedkeys = table.concat, table.insert, table.sortedkeys -local next, type = next, type -local lpegmatch = lpeg.match +local report_methods = logs.reporter("resolvers","methods") + +local allocate = utilities.storage.allocate -local trace_locating, trace_detail, trace_expansions = false, false, false +local resolvers = resolvers -trackers.register("resolvers.locating", function(v) trace_locating = v end) -trackers.register("resolvers.details", function(v) trace_detail = v end) -trackers.register("resolvers.expansions", function(v) trace_expansions = v end) -- todo +local registered = { } -if not resolvers then - resolvers = { - suffixes = { }, - formats = { }, - dangerous = { }, - suffixmap = { }, - alternatives = { }, - locators = { }, -- locate databases - hashers = { }, -- load databases - generators = { }, -- generate databases - } +local function splitmethod(filename) -- todo: filetype in specification + if not filename then + return { scheme = "unknown", original = filename } + end + if type(filename) == "table" then + return filename -- already split + end + filename = file.collapsepath(filename) + if not find(filename,"://") then + return { scheme = "file", path = filename, original = filename, filename = filename } + end + local specification = url.hashed(filename) + if not specification.scheme or specification.scheme == "" then + return { scheme = "file", path = filename, original = filename, filename = filename } + else + return specification + end end -local resolvers = resolvers +resolvers.splitmethod = splitmethod -- bad name but ok -resolvers.locators .notfound = { nil } -resolvers.hashers .notfound = { nil } -resolvers.generators.notfound = { nil } - -resolvers.cacheversion = '1.0.1' -resolvers.cnfname = 'texmf.cnf' -resolvers.luaname = 'texmfcnf.lua' -resolvers.homedir = os.env[os.type == "windows" and 'USERPROFILE'] or os.env['HOME'] or '~' -resolvers.cnfdefault = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c}' - -local dummy_path_expr = "^!*unset/*$" - -local formats = resolvers.formats -local suffixes = resolvers.suffixes -local dangerous = resolvers.dangerous -local suffixmap = resolvers.suffixmap -local alternatives = resolvers.alternatives - -formats['afm'] = 'AFMFONTS' suffixes['afm'] = { 'afm' } -formats['enc'] = 'ENCFONTS' suffixes['enc'] = { 'enc' } -formats['fmt'] = 'TEXFORMATS' suffixes['fmt'] = { 'fmt' } -formats['map'] = 'TEXFONTMAPS' suffixes['map'] = { 'map' } -formats['mp'] = 'MPINPUTS' suffixes['mp'] = { 'mp' } -formats['ocp'] = 'OCPINPUTS' suffixes['ocp'] = { 'ocp' } -formats['ofm'] = 'OFMFONTS' suffixes['ofm'] = { 'ofm', 'tfm' } -formats['otf'] = 'OPENTYPEFONTS' suffixes['otf'] = { 'otf' } -- 'ttf' -formats['opl'] = 'OPLFONTS' suffixes['opl'] = { 'opl' } -formats['otp'] = 'OTPINPUTS' suffixes['otp'] = { 'otp' } -formats['ovf'] = 'OVFFONTS' suffixes['ovf'] = { 'ovf', 'vf' } -formats['ovp'] = 'OVPFONTS' suffixes['ovp'] = { 'ovp' } -formats['tex'] = 'TEXINPUTS' suffixes['tex'] = { 'tex' } -formats['tfm'] = 'TFMFONTS' suffixes['tfm'] = { 'tfm' } -formats['ttf'] = 'TTFONTS' suffixes['ttf'] = { 'ttf', 'ttc', 'dfont' } -formats['pfb'] = 'T1FONTS' suffixes['pfb'] = { 'pfb', 'pfa' } -formats['vf'] = 'VFFONTS' suffixes['vf'] = { 'vf' } - -formats['fea'] = 'FONTFEATURES' suffixes['fea'] = { 'fea' } -formats['cid'] = 'FONTCIDMAPS' suffixes['cid'] = { 'cid', 'cidmap' } - -formats ['texmfscripts'] = 'TEXMFSCRIPTS' -- new -suffixes['texmfscripts'] = { 'rb', 'pl', 'py' } -- 'lua' - -formats ['lua'] = 'LUAINPUTS' -- new -suffixes['lua'] = { 'lua', 'luc', 'tma', 'tmc' } - --- backward compatible ones - -alternatives['map files'] = 'map' -alternatives['enc files'] = 'enc' -alternatives['cid maps'] = 'cid' -- great, why no cid files -alternatives['font feature files'] = 'fea' -- and fea files here -alternatives['opentype fonts'] = 'otf' -alternatives['truetype fonts'] = 'ttf' -alternatives['truetype collections'] = 'ttc' -alternatives['truetype dictionary'] = 'dfont' -alternatives['type1 fonts'] = 'pfb' - --- obscure ones - -formats ['misc fonts'] = '' -suffixes['misc fonts'] = { } - -formats ['sfd'] = 'SFDFONTS' -suffixes ['sfd'] = { 'sfd' } -alternatives['subfont definition files'] = 'sfd' - --- lib paths - -formats ['lib'] = 'CLUAINPUTS' -- new (needs checking) -suffixes['lib'] = (os.libsuffix and { os.libsuffix }) or { 'dll', 'so' } +-- the second argument is always analyzed (saves time later on) and the original +-- gets passed as original but also as argument --- In practice we will work within one tds tree, but i want to keep --- the option open to build tools that look at multiple trees, which is --- why we keep the tree specific data in a table. We used to pass the --- instance but for practical pusposes we now avoid this and use a --- instance variable. +local function methodhandler(what,first,...) -- filename can be nil or false + local method = registered[what] + if method then + local how, namespace = method.how, method.namespace + if how == "uri" or how == "url" then + local specification = splitmethod(first) + local scheme = specification.scheme + local resolver = namespace and namespace[scheme] + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, scheme=%s, argument=%s",what,how,scheme,first) + end + return resolver(specification,...) + else + resolver = namespace.default or namespace.file + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, default, argument=%s",what,how,first) + end + return resolver(specification,...) + elseif trace_methods then + report_methods("resolver: method=%s, how=%s, no handler",what,how) + end + end + elseif how == "tag" then + local resolver = namespace and namespace[first] + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, tag=%s",what,how,first) + end + return resolver(...) + else + resolver = namespace.default or namespace.file + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, default",what,how) + end + return resolver(...) + elseif trace_methods then + report_methods("resolver: method=%s, how=%s, unknown",what,how) + end + end + end + else + report_methods("resolver: method=%s, unknown",what) + end +end --- here we catch a few new thingies (todo: add these paths to context.tmf) --- --- FONTFEATURES = .;$TEXMF/fonts/fea// --- FONTCIDMAPS = .;$TEXMF/fonts/cid// +resolvers.methodhandler = methodhandler + +function resolvers.registermethod(name,namespace,how) + registered[name] = { how = how or "tag", namespace = namespace } + namespace["byscheme"] = function(scheme,filename,...) + if scheme == "file" then + return methodhandler(name,filename,...) + else + return methodhandler(name,addurlscheme(filename,scheme),...) + end + end +end --- we always have one instance active +local concatinators = allocate { notfound = file.join } -- concatinate paths +local locators = allocate { notfound = function() end } -- locate databases +local hashers = allocate { notfound = function() end } -- load databases +local generators = allocate { notfound = function() end } -- generate databases -resolvers.instance = resolvers.instance or nil -- the current one (slow access) -local instance = resolvers.instance or nil -- the current one (fast access) +resolvers.concatinators = concatinators +resolvers.locators = locators +resolvers.hashers = hashers +resolvers.generators = generators -function resolvers.newinstance() +local registermethod = resolvers.registermethod - -- store once, freeze and faster (once reset we can best use - -- instance.environment) maybe better have a register suffix - -- function +registermethod("concatinators",concatinators,"tag") +registermethod("locators", locators, "uri") +registermethod("hashers", hashers, "uri") +registermethod("generators", generators, "uri") - for k, v in next, suffixes do - for i=1,#v do - local vi = v[i] - if vi then - suffixmap[vi] = k - end - end - end - -- because vf searching is somewhat dangerous, we want to prevent - -- too liberal searching esp because we do a lookup on the current - -- path anyway; only tex (or any) is safe +end -- of closure - for k, v in next, formats do - dangerous[k] = true - end - dangerous.tex = nil +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-res'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +-- In practice we will work within one tds tree, but i want to keep +-- the option open to build tools that look at multiple trees, which is +-- why we keep the tree specific data in a table. We used to pass the +-- instance but for practical purposes we now avoid this and use a +-- instance variable. We always have one instance active (sort of global). + +-- todo: cache:/// home:/// + +local format, gsub, find, lower, upper, match, gmatch = string.format, string.gsub, string.find, string.lower, string.upper, string.match, string.gmatch +local concat, insert, sortedkeys = table.concat, table.insert, table.sortedkeys +local next, type, rawget = next, type, rawget +local os = os - -- the instance +local P, S, R, C, Cc, Cs, Ct, Carg = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Carg +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns - local newinstance = { - rootpath = '', - treepath = '', - progname = 'context', - engine = 'luatex', - format = '', - environment = { }, - variables = { }, - expansions = { }, - files = { }, - remap = { }, - configuration = { }, - setup = { }, - order = { }, - found = { }, - foundintrees = { }, - kpsevars = { }, - hashes = { }, - cnffiles = { }, - luafiles = { }, - lists = { }, - remember = true, - diskcache = true, - renewcache = false, - scandisk = true, - cachepath = nil, - loaderror = false, - sortdata = false, - savelists = true, - cleanuppaths = true, - allresults = false, - pattern = nil, -- lists - data = { }, -- only for loading - force_suffixes = true, - fakepaths = { }, - } +local filedirname = file.dirname +local filebasename = file.basename +local fileextname = file.extname +local filejoin = file.join +local collapsepath = file.collapsepath +local joinpath = file.joinpath +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex - local ne = newinstance.environment +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_detail = false trackers.register("resolvers.details", function(v) trace_detail = v end) +local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end) - for k,v in next, os.env do - ne[k] = resolvers.bare_variable(v) - end +local report_resolving = logs.reporter("resolvers","resolving") - return newinstance +local resolvers = resolvers -end +local expandedpathfromlist = resolvers.expandedpathfromlist +local checkedvariable = resolvers.checkedvariable +local splitconfigurationpath = resolvers.splitconfigurationpath +local methodhandler = resolvers.methodhandler -function resolvers.setinstance(someinstance) - instance = someinstance - resolvers.instance = someinstance - return someinstance -end +local initializesetter = utilities.setters.initialize -function resolvers.reset() - return resolvers.setinstance(resolvers.newinstance()) -end +local ostype, osname, osenv, ossetenv, osgetenv = os.type, os.name, os.env, os.setenv, os.getenv -local function reset_hashes() - instance.lists = { } - instance.found = { } -end +resolvers.cacheversion = '1.0.1' +resolvers.configbanner = '' +resolvers.homedir = environment.homedir +resolvers.criticalvars = allocate { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF", "TEXMF", "TEXOS" } +resolvers.luacnfname = 'texmfcnf.lua' +resolvers.luacnfstate = "unknown" -local function check_configuration() -- not yet ok, no time for debugging now - if os.env["OSFONTDIR"] then - -- ok - elseif os.type == "windows" then - os.setenv("OSFONTDIR","c:/windows/fonts//") - elseif os.type == "macosx" then - os.setenv("OSFONTDIR","$HOME/Library/Fonts//;/Library/Fonts//;/System/Library/Fonts//") - end -end +-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path +resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}' -function resolvers.bare_variable(str) -- assumes str is a string - return (gsub(str,"\s*([\"\']?)(.+)%1\s*", "%2")) -end -function resolvers.settrace(n) -- no longer number but: 'locating' or 'detail' - if n then - trackers.disable("resolvers.*") - trackers.enable("resolvers."..n) - end -end -resolvers.settrace(os.getenv("MTX_INPUT_TRACE")) +local unset_variable = "unset" -function resolvers.osenv(key) - local ie = instance.environment - local value = ie[key] - if value == nil then - -- local e = os.getenv(key) - local e = os.env[key] - if e == nil then - -- value = "" -- false - else - value = resolvers.bare_variable(e) - end - ie[key] = value - end - return value or "" -end +local formats = resolvers.formats +local suffixes = resolvers.suffixes +local dangerous = resolvers.dangerous +local suffixmap = resolvers.suffixmap -function resolvers.env(key) - return instance.environment[key] or resolvers.osenv(key) -end +resolvers.defaultsuffixes = { "tex" } -- "mkiv", "cld" -- too tricky --- +resolvers.instance = resolvers.instance or nil -- the current one (slow access) +local instance = resolvers.instance or nil -- the current one (fast access) -local function expand_vars(lst) -- simple vars - local variables, env = instance.variables, resolvers.env - local function resolve(a) - return variables[a] or env(a) - end - for k=1,#lst do - lst[k] = gsub(lst[k],"%$([%a%d%_%-]+)",resolve) - end -end +-- An instance has an environment (coming from the outside, kept raw), variables +-- (coming from the configuration file), and expansions (variables with nested +-- variables replaced). One can push something into the outer environment and +-- its internal copy, but only the later one will be the raw unprefixed variant. -local function expanded_var(var) -- simple vars - local function resolve(a) - return instance.variables[a] or resolvers.env(a) +function resolvers.setenv(key,value,raw) + if instance then + -- this one will be consulted first when we stay inside + -- the current environment + instance.environment[key] = value + -- we feed back into the environment, and as this is used + -- by other applications (via os.execute) we need to make + -- sure that prefixes are resolve + ossetenv(key,raw and value or resolvers.resolve(value)) end - return (gsub(var,"%$([%a%d%_%-]+)",resolve)) end -local function entry(entries,name) - if name and (name ~= "") then - name = gsub(name,'%$','') - local result = entries[name..'.'..instance.progname] or entries[name] - if result then - return result - else - result = resolvers.env(name) - if result then - instance.variables[name] = result - resolvers.expand_variables() - return instance.expansions[name] or "" - end - end - end - return "" -end +-- Beware we don't want empty here as this one can be called early on +-- and therefore we use rawget. -local function is_entry(entries,name) - if name and name ~= "" then - name = gsub(name,'%$','') - return (entries[name..'.'..instance.progname] or entries[name]) ~= nil +local function getenv(key) + local value = rawget(instance.environment,key) + if value and value ~= "" then + return value else - return false + local e = osgetenv(key) + return e ~= nil and e ~= "" and checkedvariable(e) or "" end end --- {a,b,c,d} --- a,b,c/{p,q,r},d --- a,b,c/{p,q,r}/d/{x,y,z}// --- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} --- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} --- a{b,c}{d,e}f --- {a,b,c,d} --- {a,b,c/{p,q,r},d} --- {a,b,c/{p,q,r}/d/{x,y,z}//} --- {a,b,c/{p,q/{x,y,z}},d/{p,q,r}} --- {a,b,c/{p,q/{x,y,z},w}v,d/{p,q,r}} --- {$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c} +resolvers.getenv = getenv +resolvers.env = getenv --- this one is better and faster, but it took me a while to realize --- that this kind of replacement is cleaner than messy parsing and --- fuzzy concatenating we can probably gain a bit with selectively --- applying lpeg, but experiments with lpeg parsing this proved not to --- work that well; the parsing is ok, but dealing with the resulting --- table is a pain because we need to work inside-out recursively +-- We are going to use some metatable trickery where we backtrack from +-- expansion to variable to environment. -local function do_first(a,b) - local t = { } - for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end - return "{" .. concat(t,",") .. "}" +local function resolve(k) + return instance.expansions[k] end -local function do_second(a,b) - local t = { } - for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end - return "{" .. concat(t,",") .. "}" -end +local dollarstripper = lpeg.stripper("$") +local inhibitstripper = P("!")^0 * Cs(P(1)^0) +local backslashswapper = lpeg.replacer("\\","/") -local function do_both(a,b) - local t = { } - for sa in gmatch(a,"[^,]+") do - for sb in gmatch(b,"[^,]+") do - t[#t+1] = sa .. sb - end - end - return "{" .. concat(t,",") .. "}" -end +local somevariable = P("$") / "" +local somekey = C(R("az","AZ","09","__","--")^1) +local somethingelse = P(";") * ((1-S("!{}/\\"))^1 * P(";") / "") + + P(";") * (P(";") / "") + + P(1) +local variableexpander = Cs( (somevariable * (somekey/resolve) + somethingelse)^1 ) -local function do_three(a,b,c) - return a .. b.. c -end +local cleaner = P("\\") / "/" + P(";") * S("!{}/\\")^0 * P(";")^1 / ";" +local variablecleaner = Cs((cleaner + P(1))^0) -local function splitpathexpr(str, t, validate) - -- no need for further optimization as it is only called a - -- few times, we can use lpeg for the sub - if trace_expansions then - logs.report("fileio","expanding variable '%s'",str) - end - t = t or { } - str = gsub(str,",}",",@}") - str = gsub(str,"{,","{@,") - -- str = "@" .. str .. "@" - local ok, done - while true do - done = false - while true do - str, ok = gsub(str,"([^{},]+){([^{}]+)}",do_first) - if ok > 0 then done = true else break end - end - while true do - str, ok = gsub(str,"{([^{}]+)}([^{},]+)",do_second) - if ok > 0 then done = true else break end - end - while true do - str, ok = gsub(str,"{([^{}]+)}{([^{}]+)}",do_both) - if ok > 0 then done = true else break end - end - str, ok = gsub(str,"({[^{}]*){([^{}]+)}([^{}]*})",do_three) - if ok > 0 then done = true end - if not done then break end - end - str = gsub(str,"[{}]", "") - str = gsub(str,"@","") - if validate then - for s in gmatch(str,"[^,]+") do - s = validate(s) - if s then t[#t+1] = s end - end - else - for s in gmatch(str,"[^,]+") do - t[#t+1] = s - end - end - if trace_expansions then - for k=1,#t do - logs.report("fileio","% 4i: %s",k,t[k]) - end - end - return t -end +local somevariable = R("az","AZ","09","__","--")^1 / resolve +local variable = (P("$")/"") * (somevariable + (P("{")/"") * somevariable * (P("}")/"")) +local variableresolver = Cs((variable + P(1))^0) -local function expanded_path_from_list(pathlist) -- maybe not a list, just a path - -- a previous version fed back into pathlist - local newlist, ok = { }, false - for k=1,#pathlist do - if find(pathlist[k],"[{}]") then - ok = true - break - end - end - if ok then - local function validate(s) - s = file.collapse_path(s) - return s ~= "" and not find(s,dummy_path_expr) and s - end - for k=1,#pathlist do - splitpathexpr(pathlist[k],newlist,validate) - end - else - for k=1,#pathlist do - for p in gmatch(pathlist[k],"([^,]+)") do - p = file.collapse_path(p) - if p ~= "" then newlist[#newlist+1] = p end - end - end - end - return newlist +local function expandedvariable(var) + return lpegmatch(variableexpander,var) or var end --- we follow a rather traditional approach: --- --- (1) texmf.cnf given in TEXMFCNF --- (2) texmf.cnf searched in default variable --- --- also we now follow the stupid route: if not set then just assume *one* --- cnf file under texmf (i.e. distribution) +function resolvers.newinstance() -- todo: all vars will become lowercase and alphanum only -local args = environment and environment.original_arguments or arg -- this needs a cleanup + if trace_locating then + report_resolving("creating instance") + end -resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex" -resolvers.ownbin = gsub(resolvers.ownbin,"\\","/") + local environment, variables, expansions, order = allocate(), allocate(), allocate(), allocate() -function resolvers.getownpath() - local ownpath = resolvers.ownpath or os.selfdir - if not ownpath or ownpath == "" or ownpath == "unset" then - ownpath = args[-1] or arg[-1] - ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/")) - if not ownpath or ownpath == "" then - ownpath = args[-0] or arg[-0] - ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/")) - end - local binary = resolvers.ownbin - if not ownpath or ownpath == "" then - ownpath = ownpath and file.dirname(binary) - end - if not ownpath or ownpath == "" then - if os.binsuffix ~= "" then - binary = file.replacesuffix(binary,os.binsuffix) - end - for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do - local b = file.join(p,binary) - if lfs.isfile(b) then - -- we assume that after changing to the path the currentdir function - -- resolves to the real location and use this side effect here; this - -- trick is needed because on the mac installations use symlinks in the - -- path instead of real locations - local olddir = lfs.currentdir() - if lfs.chdir(p) then - local pp = lfs.currentdir() - if trace_locating and p ~= pp then - logs.report("fileio","following symlink '%s' to '%s'",p,pp) - end - ownpath = pp - lfs.chdir(olddir) - else - if trace_locating then - logs.report("fileio","unable to check path '%s'",p) - end - ownpath = p - end - break - end + local newinstance = { + environment = environment, + variables = variables, + expansions = expansions, + order = order, + files = allocate(), + setups = allocate(), + found = allocate(), + foundintrees = allocate(), + hashes = allocate(), + hashed = allocate(), + specification = allocate(), + lists = allocate(), + data = allocate(), -- only for loading + fakepaths = allocate(), + remember = true, + diskcache = true, + renewcache = false, + loaderror = false, + savelists = true, + pattern = nil, -- lists + force_suffixes = true, + } + + setmetatableindex(variables,function(t,k) + local v + for i=1,#order do + v = order[i][k] + if v ~= nil then + t[k] = v + return v end end - if not ownpath or ownpath == "" then - ownpath = "." - logs.report("fileio","forcing fallback ownpath .") - elseif trace_locating then - logs.report("fileio","using ownpath '%s'",ownpath) + if v == nil then + v = "" end - end - resolvers.ownpath = ownpath - function resolvers.getownpath() - return resolvers.ownpath - end - return ownpath -end - -local own_places = { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF" } + t[k] = v + return v + end) -local function identify_own() - local ownpath = resolvers.getownpath() or dir.current() - local ie = instance.environment - if ownpath then - if resolvers.env('SELFAUTOLOC') == "" then os.env['SELFAUTOLOC'] = file.collapse_path(ownpath) end - if resolvers.env('SELFAUTODIR') == "" then os.env['SELFAUTODIR'] = file.collapse_path(ownpath .. "/..") end - if resolvers.env('SELFAUTOPARENT') == "" then os.env['SELFAUTOPARENT'] = file.collapse_path(ownpath .. "/../..") end - else - logs.report("fileio","error: unable to locate ownpath") - os.exit() - end - if resolvers.env('TEXMFCNF') == "" then os.env['TEXMFCNF'] = resolvers.cnfdefault end - if resolvers.env('TEXOS') == "" then os.env['TEXOS'] = resolvers.env('SELFAUTODIR') end - if resolvers.env('TEXROOT') == "" then os.env['TEXROOT'] = resolvers.env('SELFAUTOPARENT') end - if trace_locating then - for i=1,#own_places do - local v = own_places[i] - logs.report("fileio","variable '%s' set to '%s'",v,resolvers.env(v) or "unknown") + setmetatableindex(environment, function(t,k) + local v = osgetenv(k) + if v == nil then + v = variables[k] end - end - identify_own = function() end -end - -function resolvers.identify_cnf() - if #instance.cnffiles == 0 then - -- fallback - identify_own() - -- the real search - resolvers.expand_variables() - local t = resolvers.split_path(resolvers.env('TEXMFCNF')) - t = expanded_path_from_list(t) - expand_vars(t) -- redundant - local function locate(filename,list) - for i=1,#t do - local ti = t[i] - local texmfcnf = file.collapse_path(file.join(ti,filename)) - if lfs.isfile(texmfcnf) then - list[#list+1] = texmfcnf - end - end + if v ~= nil then + v = checkedvariable(v) or "" end - locate(resolvers.luaname,instance.luafiles) - locate(resolvers.cnfname,instance.cnffiles) - end -end + v = resolvers.repath(v) -- for taco who has a : separated osfontdir + t[k] = v + return v + end) -local function load_cnf_file(fname) - fname = resolvers.clean_path(fname) - local lname = file.replacesuffix(fname,'lua') - if lfs.isfile(lname) then - local dname = file.dirname(fname) -- fname ? - if not instance.configuration[dname] then - resolvers.load_data(dname,'configuration',lname and file.basename(lname)) - instance.order[#instance.order+1] = instance.configuration[dname] - end - else - f = io.open(fname) - if f then - if trace_locating then - logs.report("fileio","loading configuration file %s", fname) - end - local line, data, n, k, v - local dname = file.dirname(fname) - if not instance.configuration[dname] then - instance.configuration[dname] = { } - instance.order[#instance.order+1] = instance.configuration[dname] - end - local data = instance.configuration[dname] - while true do - local line, n = f:read(), 0 - if line then - while true do -- join lines - line, n = gsub(line,"\\%s*$", "") - if n > 0 then - line = line .. f:read() - else - break - end - end - if not find(line,"^[%%#]") then - local l = gsub(line,"%s*%%.*$","") - local k, v = match(l,"%s*(.-)%s*=%s*(.-)%s*$") - if k and v and not data[k] then - v = gsub(v,"[%%#].*",'') - data[k] = gsub(v,"~","$HOME") - instance.kpsevars[k] = true - end - end - else - break - end - end - f:close() - elseif trace_locating then - logs.report("fileio","skipping configuration file '%s'", fname) + setmetatableindex(expansions, function(t,k) + local v = environment[k] + if type(v) == "string" then + v = lpegmatch(variableresolver,v) + v = lpegmatch(variablecleaner,v) end - end + t[k] = v + return v + end) + + return newinstance + end -local function collapse_cnf_data() -- potential optimization: pass start index (setup and configuration are shared) - local order = instance.order - for i=1,#order do - local c = order[i] - for k,v in next, c do - if not instance.variables[k] then - if instance.environment[k] then - instance.variables[k] = instance.environment[k] - else - instance.kpsevars[k] = true - instance.variables[k] = resolvers.bare_variable(v) - end - end - end - end +function resolvers.setinstance(someinstance) -- only one instance is active + instance = someinstance + resolvers.instance = someinstance + return someinstance end -function resolvers.load_cnf() - local function loadoldconfigdata() - local cnffiles = instance.cnffiles - for i=1,#cnffiles do - load_cnf_file(cnffiles[i]) - end - end - -- instance.cnffiles contain complete names now ! - -- we still use a funny mix of cnf and new but soon - -- we will switch to lua exclusively as we only use - -- the file to collect the tree roots - if #instance.cnffiles == 0 then - if trace_locating then - logs.report("fileio","no cnf files found (TEXMFCNF may not be set/known)") - end - else - local cnffiles = instance.cnffiles - instance.rootpath = cnffiles[1] - for k=1,#cnffiles do - instance.cnffiles[k] = file.collapse_path(cnffiles[k]) - end - for i=1,3 do - instance.rootpath = file.dirname(instance.rootpath) - end - instance.rootpath = file.collapse_path(instance.rootpath) - if instance.diskcache and not instance.renewcache then - resolvers.loadoldconfig(instance.cnffiles) - if instance.loaderror then - loadoldconfigdata() - resolvers.saveoldconfig() - end - else - loadoldconfigdata() - if instance.renewcache then - resolvers.saveoldconfig() - end - end - collapse_cnf_data() - end - check_configuration() +function resolvers.reset() + return resolvers.setinstance(resolvers.newinstance()) end -function resolvers.load_lua() - if #instance.luafiles == 0 then - -- yet harmless - else - instance.rootpath = instance.luafiles[1] - local luafiles = instance.luafiles - for k=1,#luafiles do - instance.luafiles[k] = file.collapse_path(luafiles[k]) - end - for i=1,3 do - instance.rootpath = file.dirname(instance.rootpath) - end - instance.rootpath = file.collapse_path(instance.rootpath) - resolvers.loadnewconfig() - collapse_cnf_data() - end - check_configuration() +local function reset_hashes() + instance.lists = { } + instance.found = { } end --- database loading +local slash = P("/") -function resolvers.load_hash() - resolvers.locatelists() - if instance.diskcache and not instance.renewcache then - resolvers.loadfiles() - if instance.loaderror then - resolvers.loadlists() - resolvers.savefiles() - end +local pathexpressionpattern = Cs ( + Cc("^") * ( + Cc("%") * S(".-") + + slash^2 * P(-1) / "/.*" + + slash^2 / "/.-/" + + (1-slash) * P(-1) * Cc("/") + + P(1) + )^1 * Cc("$") -- yes or no $ +) + +local cache = { } + +local function makepathexpression(str) + if str == "." then + return "^%./$" else - resolvers.loadlists() - if instance.renewcache then - resolvers.savefiles() + local c = cache[str] + if not c then + c = lpegmatch(pathexpressionpattern,str) + cache[str] = c end + return c end end -function resolvers.append_hash(type,tag,name) - if trace_locating then - logs.report("fileio","hash '%s' appended",tag) - end - insert(instance.hashes, { ['type']=type, ['tag']=tag, ['name']=name } ) -end - -function resolvers.prepend_hash(type,tag,name) +local function reportcriticalvariables() if trace_locating then - logs.report("fileio","hash '%s' prepended",tag) - end - insert(instance.hashes, 1, { ['type']=type, ['tag']=tag, ['name']=name } ) -end - -function resolvers.extend_texmf_var(specification) -- crap, we could better prepend the hash --- local t = resolvers.expanded_path_list('TEXMF') -- full expansion - local t = resolvers.split_path(resolvers.env('TEXMF')) - insert(t,1,specification) - local newspec = concat(t,";") - if instance.environment["TEXMF"] then - instance.environment["TEXMF"] = newspec - elseif instance.variables["TEXMF"] then - instance.variables["TEXMF"] = newspec - else - -- weird + for i=1,#resolvers.criticalvars do + local k = resolvers.criticalvars[i] + local v = resolvers.getenv(k) or "unknown" -- this one will not resolve ! + report_resolving("variable '%s' set to '%s'",k,v) + end + report_resolving() end - resolvers.expand_variables() - reset_hashes() + reportcriticalvariables = function() end end --- locators - -function resolvers.locatelists() - local texmfpaths = resolvers.clean_path_list('TEXMF') - for i=1,#texmfpaths do - local path = texmfpaths[i] +local function identify_configuration_files() + local specification = instance.specification + if #specification == 0 then + local cnfspec = getenv('TEXMFCNF') + if cnfspec == "" then + cnfspec = resolvers.luacnfspec + resolvers.luacnfstate = "default" + else + resolvers.luacnfstate = "environment" + end + reportcriticalvariables() + local cnfpaths = expandedpathfromlist(resolvers.splitpath(cnfspec)) + local luacnfname = resolvers.luacnfname + for i=1,#cnfpaths do + local filename = collapsepath(filejoin(cnfpaths[i],luacnfname)) + local realname = resolvers.resolve(filename) + if lfs.isfile(realname) then + specification[#specification+1] = filename + if trace_locating then + report_resolving("found configuration file '%s'",realname) + end + elseif trace_locating then + report_resolving("unknown configuration file '%s'",realname) + end + end if trace_locating then - logs.report("fileio","locating list of '%s'",path) + report_resolving() end - resolvers.locatedatabase(file.collapse_path(path)) - end -end - -function resolvers.locatedatabase(specification) - return resolvers.methodhandler('locators', specification) -end + elseif trace_locating then + report_resolving("configuration files already identified") + end +end + +local function load_configuration_files() + local specification = instance.specification + if #specification > 0 then + local luacnfname = resolvers.luacnfname + for i=1,#specification do + local filename = specification[i] + local pathname = filedirname(filename) + local filename = filejoin(pathname,luacnfname) + local realname = resolvers.resolve(filename) -- no shortcut + local blob = loadfile(realname) + if blob then + local setups = instance.setups + local data = blob() + data = data and data.content + if data then + if trace_locating then + report_resolving("loading configuration file '%s'",filename) + report_resolving() + end + local variables = data.variables or { } + local warning = false + for k, v in next, data do + local variant = type(v) + if variant == "table" then + initializesetter(filename,k,v) + elseif variables[k] == nil then + if trace_locating and not warning then + report_resolving("variables like '%s' in configuration file '%s' should move to the 'variables' subtable", + k,resolvers.resolve(filename)) + warning = true + end + variables[k] = v + end + end + setups[pathname] = variables + if resolvers.luacnfstate == "default" then + -- the following code is not tested + local cnfspec = variables["TEXMFCNF"] + if cnfspec then + if trace_locating then + report_resolving("reloading configuration due to TEXMF redefinition") + end + -- we push the value into the main environment (osenv) so + -- that it takes precedence over the default one and therefore + -- also over following definitions + resolvers.setenv('TEXMFCNF',cnfspec) -- resolves prefixes + -- we now identify and load the specified configuration files + instance.specification = { } + identify_configuration_files() + load_configuration_files() + -- we prevent further overload of the configuration variable + resolvers.luacnfstate = "configuration" + -- we quit the outer loop + break + end + end -function resolvers.locators.tex(specification) - if specification and specification ~= '' and lfs.isdir(specification) then - if trace_locating then - logs.report("fileio","tex locator '%s' found",specification) + else + if trace_locating then + report_resolving("skipping configuration file '%s' (no content)",filename) + end + setups[pathname] = { } + instance.loaderror = true + end + elseif trace_locating then + report_resolving("skipping configuration file '%s' (no file)",filename) + end + instance.order[#instance.order+1] = instance.setups[pathname] + if instance.loaderror then + break + end end - resolvers.append_hash('file',specification,filename) elseif trace_locating then - logs.report("fileio","tex locator '%s' not found",specification) + report_resolving("warning: no lua configuration files found") end end --- hashers - -function resolvers.hashdatabase(tag,name) - return resolvers.methodhandler('hashers',tag,name) -end +-- scheme magic ... database loading -function resolvers.loadfiles() - instance.loaderror = false - instance.files = { } +local function load_file_databases() + instance.loaderror, instance.files = false, allocate() if not instance.renewcache then local hashes = instance.hashes for k=1,#hashes do local hash = hashes[k] - resolvers.hashdatabase(hash.tag,hash.name) + resolvers.hashers.byscheme(hash.type,hash.name) if instance.loaderror then break end end end end -function resolvers.hashers.tex(tag,name) - resolvers.load_data(tag,'files') -end - --- generators: - -function resolvers.loadlists() - local hashes = instance.hashes - for i=1,#hashes do - resolvers.generatedatabase(hashes[i].tag) - end -end - -function resolvers.generatedatabase(specification) - return resolvers.methodhandler('generators', specification) -end - --- starting with . or .. etc or funny char - -local weird = lpeg.P(".")^1 + lpeg.anywhere(lpeg.S("~`!#$%^&*()={}[]:;\"\'||<>,?\n\r\t")) - ---~ local l_forbidden = lpeg.S("~`!#$%^&*()={}[]:;\"\'||\\/<>,?\n\r\t") ---~ local l_confusing = lpeg.P(" ") ---~ local l_character = lpeg.patterns.utf8 ---~ local l_dangerous = lpeg.P(".") - ---~ local l_normal = (l_character - l_forbidden - l_confusing - l_dangerous) * (l_character - l_forbidden - l_confusing^2)^0 * lpeg.P(-1) ---~ ----- l_normal = l_normal * lpeg.Cc(true) + lpeg.Cc(false) - ---~ local function test(str) ---~ print(str,lpeg.match(l_normal,str)) ---~ end ---~ test("ヒラギノ明朝 Pro W3") ---~ test("..ヒラギノ明朝 Pro W3") ---~ test(":ヒラギノ明朝 Pro W3;") ---~ test("ヒラギノ明朝 /Pro W3;") ---~ test("ヒラギノ明朝 Pro W3") - -function resolvers.generators.tex(specification) - local tag = specification - if trace_locating then - logs.report("fileio","scanning path '%s'",specification) - end - instance.files[tag] = { } - local files = instance.files[tag] - local n, m, r = 0, 0, 0 - local spec = specification .. '/' - local attributes = lfs.attributes - local directory = lfs.dir - local function action(path) - local full - if path then - full = spec .. path .. '/' - else - full = spec - end - for name in directory(full) do - if not lpegmatch(weird,name) then - -- if lpegmatch(l_normal,name) then - local mode = attributes(full..name,'mode') - if mode == 'file' then - if path then - n = n + 1 - local f = files[name] - if f then - if type(f) == 'string' then - files[name] = { f, path } - else - f[#f+1] = path - end - else -- probably unique anyway - files[name] = path - local lower = lower(name) - if name ~= lower then - files["remap:"..lower] = name - r = r + 1 - end - end - end - elseif mode == 'directory' then - m = m + 1 - if path then - action(path..'/'..name) +local function locate_file_databases() + -- todo: cache:// and tree:// (runtime) + local texmfpaths = resolvers.expandedpathlist('TEXMF') + if #texmfpaths > 0 then + for i=1,#texmfpaths do + local path = collapsepath(texmfpaths[i]) + local stripped = lpegmatch(inhibitstripper,path) -- the !! thing + if stripped ~= "" then + local runtime = stripped == path + path = resolvers.cleanpath(path) + local spec = resolvers.splitmethod(stripped) + if spec.scheme == "cache" or spec.scheme == "file" then + stripped = spec.path + elseif runtime and (spec.noscheme or spec.scheme == "file") then + stripped = "tree:///" .. stripped + end + if trace_locating then + if runtime then + report_resolving("locating list of '%s' (runtime)",path) else - action(name) + report_resolving("locating list of '%s' (cached)",path) end end + methodhandler('locators',stripped) end end - end - action() - if trace_locating then - logs.report("fileio","%s files found on %s directories with %s uppercase remappings",n,m,r) + if trace_locating then + report_resolving() + end + elseif trace_locating then + report_resolving("no texmf paths are defined (using TEXMF)") end end --- savers, todo - -function resolvers.savefiles() - resolvers.save_data('files') +local function generate_file_databases() + local hashes = instance.hashes + for k=1,#hashes do + local hash = hashes[k] + methodhandler('generators',hash.name) + end + if trace_locating then + report_resolving() + end end --- A config (optionally) has the paths split in tables. Internally --- we join them and split them after the expansion has taken place. This --- is more convenient. - ---~ local checkedsplit = string.checkedsplit - -local cache = { } - -local splitter = lpeg.Ct(lpeg.splitat(lpeg.S(os.type == "windows" and ";" or ":;"))) - -local function split_kpse_path(str) -- beware, this can be either a path or a {specification} - local found = cache[str] - if not found then - if str == "" then - found = { } - else - str = gsub(str,"\\","/") ---~ local split = (find(str,";") and checkedsplit(str,";")) or checkedsplit(str,io.pathseparator) -local split = lpegmatch(splitter,str) - found = { } - for i=1,#split do - local s = split[i] - if not find(s,"^{*unset}*") then - found[#found+1] = s - end - end - if trace_expansions then - logs.report("fileio","splitting path specification '%s'",str) - for k=1,#found do - logs.report("fileio","% 4i: %s",k,found[k]) - end +local function save_file_databases() -- will become cachers + for i=1,#instance.hashes do + local hash = instance.hashes[i] + local cachename = hash.name + if hash.cache then + local content = instance.files[cachename] + caches.collapsecontent(content) + if trace_locating then + report_resolving("saving tree '%s'",cachename) end - cache[str] = found + caches.savecontent(cachename,"files",content) + elseif trace_locating then + report_resolving("not saving runtime tree '%s'",cachename) end end - return found end -resolvers.split_kpse_path = split_kpse_path - -function resolvers.splitconfig() - for i=1,#instance do - local c = instance[i] - for k,v in next, c do - if type(v) == 'string' then - local t = split_kpse_path(v) - if #t > 1 then - c[k] = t - end - end +local function load_databases() + locate_file_databases() + if instance.diskcache and not instance.renewcache then + load_file_databases() + if instance.loaderror then + generate_file_databases() + save_file_databases() + end + else + generate_file_databases() + if instance.renewcache then + save_file_databases() end end end -function resolvers.joinconfig() - local order = instance.order - for i=1,#order do - local c = order[i] - for k,v in next, c do -- indexed? - if type(v) == 'table' then - c[k] = file.join_path(v) - end +function resolvers.appendhash(type,name,cache) + -- safeguard ... tricky as it's actually a bug when seen twice + if not instance.hashed[name] then + if trace_locating then + report_resolving("hash '%s' appended",name) end + insert(instance.hashes, { type = type, name = name, cache = cache } ) + instance.hashed[name] = cache end end -function resolvers.split_path(str) - if type(str) == 'table' then - return str - else - return split_kpse_path(str) +function resolvers.prependhash(type,name,cache) + -- safeguard ... tricky as it's actually a bug when seen twice + if not instance.hashed[name] then + if trace_locating then + report_resolving("hash '%s' prepended",name) + end + insert(instance.hashes, 1, { type = type, name = name, cache = cache } ) + instance.hashed[name] = cache end end -function resolvers.join_path(str) - if type(str) == 'table' then - return file.join_path(str) +function resolvers.extendtexmfvariable(specification) -- crap, we could better prepend the hash + local t = resolvers.splitpath(getenv('TEXMF')) + insert(t,1,specification) + local newspec = concat(t,";") + if instance.environment["TEXMF"] then + instance.environment["TEXMF"] = newspec + elseif instance.variables["TEXMF"] then + instance.variables["TEXMF"] = newspec else - return str + -- weird end + reset_hashes() end function resolvers.splitexpansions() local ie = instance.expansions for k,v in next, ie do - local t, h, p = { }, { }, split_kpse_path(v) + local t, tn, h, p = { }, 0, { }, splitconfigurationpath(v) for kk=1,#p do local vv = p[kk] if vv ~= "" and not h[vv] then - t[#t+1] = vv + tn = tn + 1 + t[tn] = vv h[vv] = true end end @@ -9184,343 +11600,92 @@ end -- end of split/join code -function resolvers.saveoldconfig() - resolvers.splitconfig() - resolvers.save_data('configuration') - resolvers.joinconfig() -end - -resolvers.configbanner = [[ --- This is a Luatex configuration file created by 'luatools.lua' or --- 'luatex.exe' directly. For comment, suggestions and questions you can --- contact the ConTeXt Development Team. This configuration file is --- not copyrighted. [HH & TH] -]] - -function resolvers.serialize(files) - -- This version is somewhat optimized for the kind of - -- tables that we deal with, so it's much faster than - -- the generic serializer. This makes sense because - -- luatools and mtxtools are called frequently. Okay, - -- we pay a small price for properly tabbed tables. - local t = { } - local function dump(k,v,m) -- could be moved inline - if type(v) == 'string' then - return m .. "['" .. k .. "']='" .. v .. "'," - elseif #v == 1 then - return m .. "['" .. k .. "']='" .. v[1] .. "'," - else - return m .. "['" .. k .. "']={'" .. concat(v,"','").. "'}," - end - end - t[#t+1] = "return {" - if instance.sortdata then - local sortedfiles = sortedkeys(files) - for i=1,#sortedfiles do - local k = sortedfiles[i] - local fk = files[k] - if type(fk) == 'table' then - t[#t+1] = "\t['" .. k .. "']={" - local sortedfk = sortedkeys(fk) - for j=1,#sortedfk do - local kk = sortedfk[j] - t[#t+1] = dump(kk,fk[kk],"\t\t") - end - t[#t+1] = "\t}," - else - t[#t+1] = dump(k,fk,"\t") - end - end - else - for k, v in next, files do - if type(v) == 'table' then - t[#t+1] = "\t['" .. k .. "']={" - for kk,vv in next, v do - t[#t+1] = dump(kk,vv,"\t\t") - end - t[#t+1] = "\t}," - else - t[#t+1] = dump(k,v,"\t") - end - end - end - t[#t+1] = "}" - return concat(t,"\n") -end - -local data_state = { } - -function resolvers.data_state() - return data_state or { } -end - -function resolvers.save_data(dataname, makename) -- untested without cache overload - for cachename, files in next, instance[dataname] do - local name = (makename or file.join)(cachename,dataname) - local luaname, lucname = name .. ".lua", name .. ".luc" - if trace_locating then - logs.report("fileio","preparing '%s' for '%s'",dataname,cachename) - end - for k, v in next, files do - if type(v) == "table" and #v == 1 then - files[k] = v[1] - end - end - local data = { - type = dataname, - root = cachename, - version = resolvers.cacheversion, - date = os.date("%Y-%m-%d"), - time = os.date("%H:%M:%S"), - content = files, - uuid = os.uuid(), - } - local ok = io.savedata(luaname,resolvers.serialize(data)) - if ok then - if trace_locating then - logs.report("fileio","'%s' saved in '%s'",dataname,luaname) - end - if utils.lua.compile(luaname,lucname,false,true) then -- no cleanup but strip - if trace_locating then - logs.report("fileio","'%s' compiled to '%s'",dataname,lucname) - end - else - if trace_locating then - logs.report("fileio","compiling failed for '%s', deleting file '%s'",dataname,lucname) - end - os.remove(lucname) - end - elseif trace_locating then - logs.report("fileio","unable to save '%s' in '%s' (access error)",dataname,luaname) - end - end -end - -function resolvers.load_data(pathname,dataname,filename,makename) -- untested without cache overload - filename = ((not filename or (filename == "")) and dataname) or filename - filename = (makename and makename(dataname,filename)) or file.join(pathname,filename) - local blob = loadfile(filename .. ".luc") or loadfile(filename .. ".lua") - if blob then - local data = blob() - if data and data.content and data.type == dataname and data.version == resolvers.cacheversion then - data_state[#data_state+1] = data.uuid - if trace_locating then - logs.report("fileio","loading '%s' for '%s' from '%s'",dataname,pathname,filename) - end - instance[dataname][pathname] = data.content - else - if trace_locating then - logs.report("fileio","skipping '%s' for '%s' from '%s'",dataname,pathname,filename) - end - instance[dataname][pathname] = { } - instance.loaderror = true - end - elseif trace_locating then - logs.report("fileio","skipping '%s' for '%s' from '%s'",dataname,pathname,filename) - end -end - --- some day i'll use the nested approach, but not yet (actually we even drop --- engine/progname support since we have only luatex now) --- --- first texmfcnf.lua files are located, next the cached texmf.cnf files --- --- return { --- TEXMFBOGUS = 'effe checken of dit werkt', --- } - -function resolvers.resetconfig() - identify_own() - instance.configuration, instance.setup, instance.order, instance.loaderror = { }, { }, { }, false -end - -function resolvers.loadnewconfig() - local luafiles = instance.luafiles - for i=1,#luafiles do - local cnf = luafiles[i] - local pathname = file.dirname(cnf) - local filename = file.join(pathname,resolvers.luaname) - local blob = loadfile(filename) - if blob then - local data = blob() - if data then - if trace_locating then - logs.report("fileio","loading configuration file '%s'",filename) - end - if true then - -- flatten to variable.progname - local t = { } - for k, v in next, data do -- v = progname - if type(v) == "string" then - t[k] = v - else - for kk, vv in next, v do -- vv = variable - if type(vv) == "string" then - t[vv.."."..v] = kk - end - end - end - end - instance['setup'][pathname] = t - else - instance['setup'][pathname] = data - end - else - if trace_locating then - logs.report("fileio","skipping configuration file '%s'",filename) - end - instance['setup'][pathname] = { } - instance.loaderror = true - end - elseif trace_locating then - logs.report("fileio","skipping configuration file '%s'",filename) - end - instance.order[#instance.order+1] = instance.setup[pathname] - if instance.loaderror then break end - end -end - -function resolvers.loadoldconfig() - if not instance.renewcache then - local cnffiles = instance.cnffiles - for i=1,#cnffiles do - local cnf = cnffiles[i] - local dname = file.dirname(cnf) - resolvers.load_data(dname,'configuration') - instance.order[#instance.order+1] = instance.configuration[dname] - if instance.loaderror then break end - end - end - resolvers.joinconfig() -end +-- we used to have 'files' and 'configurations' so therefore the following +-- shared function -function resolvers.expand_variables() - local expansions, environment, variables = { }, instance.environment, instance.variables - local env = resolvers.env - instance.expansions = expansions - local engine, progname = instance.engine, instance.progname - if type(engine) ~= "string" then instance.engine, engine = "", "" end - if type(progname) ~= "string" then instance.progname, progname = "", "" end - if engine ~= "" then environment['engine'] = engine end - if progname ~= "" then environment['progname'] = progname end - for k,v in next, environment do - local a, b = match(k,"^(%a+)%_(.*)%s*$") - if a and b then - expansions[a..'.'..b] = v - else - expansions[k] = v - end - end - for k,v in next, environment do -- move environment to expansions - if not expansions[k] then expansions[k] = v end - end - for k,v in next, variables do -- move variables to expansions - if not expansions[k] then expansions[k] = v end - end - local busy = false - local function resolve(a) - busy = true - return expansions[a] or env(a) - end - while true do - busy = false - for k,v in next, expansions do - local s, n = gsub(v,"%$([%a%d%_%-]+)",resolve) - local s, m = gsub(s,"%$%{([%a%d%_%-]+)%}",resolve) - if n > 0 or m > 0 then - expansions[k]= s - end - end - if not busy then break end - end - for k,v in next, expansions do - expansions[k] = gsub(v,"\\", '/') - end +function resolvers.datastate() + return caches.contentstate() end function resolvers.variable(name) - return entry(instance.variables,name) + local name = name and lpegmatch(dollarstripper,name) + local result = name and instance.variables[name] + return result ~= nil and result or "" end function resolvers.expansion(name) - return entry(instance.expansions,name) -end - -function resolvers.is_variable(name) - return is_entry(instance.variables,name) -end - -function resolvers.is_expansion(name) - return is_entry(instance.expansions,name) + local name = name and lpegmatch(dollarstripper,name) + local result = name and instance.expansions[name] + return result ~= nil and result or "" end -function resolvers.unexpanded_path_list(str) +function resolvers.unexpandedpathlist(str) local pth = resolvers.variable(str) - local lst = resolvers.split_path(pth) - return expanded_path_from_list(lst) + local lst = resolvers.splitpath(pth) + return expandedpathfromlist(lst) end -function resolvers.unexpanded_path(str) - return file.join_path(resolvers.unexpanded_path_list(str)) +function resolvers.unexpandedpath(str) + return joinpath(resolvers.unexpandedpathlist(str)) end -do -- no longer needed - - local done = { } +local done = { } - function resolvers.reset_extra_path() - local ep = instance.extra_paths - if not ep then - ep, done = { }, { } - instance.extra_paths = ep - elseif #ep > 0 then - instance.lists, done = { }, { } - end +function resolvers.resetextrapath() + local ep = instance.extra_paths + if not ep then + ep, done = { }, { } + instance.extra_paths = ep + elseif #ep > 0 then + instance.lists, done = { }, { } end +end - function resolvers.register_extra_path(paths,subpaths) - local ep = instance.extra_paths or { } - local n = #ep - if paths and paths ~= "" then - if subpaths and subpaths ~= "" then - for p in gmatch(paths,"[^,]+") do - -- we gmatch each step again, not that fast, but used seldom - for s in gmatch(subpaths,"[^,]+") do - local ps = p .. "/" .. s - if not done[ps] then - ep[#ep+1] = resolvers.clean_path(ps) - done[ps] = true - end - end - end - else - for p in gmatch(paths,"[^,]+") do - if not done[p] then - ep[#ep+1] = resolvers.clean_path(p) - done[p] = true - end - end - end - elseif subpaths and subpaths ~= "" then - for i=1,n do +function resolvers.registerextrapath(paths,subpaths) + local ep = instance.extra_paths or { } + local oldn = #ep + local newn = oldn + if paths and paths ~= "" then + if subpaths and subpaths ~= "" then + for p in gmatch(paths,"[^,]+") do -- we gmatch each step again, not that fast, but used seldom for s in gmatch(subpaths,"[^,]+") do - local ps = ep[i] .. "/" .. s + local ps = p .. "/" .. s if not done[ps] then - ep[#ep+1] = resolvers.clean_path(ps) + newn = newn + 1 + ep[newn] = resolvers.cleanpath(ps) done[ps] = true end end end + else + for p in gmatch(paths,"[^,]+") do + if not done[p] then + newn = newn + 1 + ep[newn] = resolvers.cleanpath(p) + done[p] = true + end + end end - if #ep > 0 then - instance.extra_paths = ep -- register paths - end - if #ep > n then - instance.lists = { } -- erase the cache + elseif subpaths and subpaths ~= "" then + for i=1,oldn do + -- we gmatch each step again, not that fast, but used seldom + for s in gmatch(subpaths,"[^,]+") do + local ps = ep[i] .. "/" .. s + if not done[ps] then + newn = newn + 1 + ep[newn] = resolvers.cleanpath(ps) + done[ps] = true + end + end end end - + if newn > 0 then + instance.extra_paths = ep -- register paths + end + if newn > oldn then + instance.lists = { } -- erase the cache + end end local function made_list(instance,list) @@ -9528,14 +11693,15 @@ local function made_list(instance,list) if not ep or #ep == 0 then return list else - local done, new = { }, { } + local done, new, newn = { }, { }, 0 -- honour . .. ../.. but only when at the start for k=1,#list do local v = list[k] if not done[v] then if find(v,"^[%.%/]$") then done[v] = true - new[#new+1] = v + newn = newn + 1 + new[newn] = v else break end @@ -9546,7 +11712,8 @@ local function made_list(instance,list) local v = ep[k] if not done[v] then done[v] = true - new[#new+1] = v + newn = newn + 1 + new[newn] = v end end -- next the formal paths @@ -9554,118 +11721,95 @@ local function made_list(instance,list) local v = list[k] if not done[v] then done[v] = true - new[#new+1] = v + newn = newn + 1 + new[newn] = v end end return new end end -function resolvers.clean_path_list(str) - local t = resolvers.expanded_path_list(str) +function resolvers.cleanpathlist(str) + local t = resolvers.expandedpathlist(str) if t then for i=1,#t do - t[i] = file.collapse_path(resolvers.clean_path(t[i])) + t[i] = collapsepath(resolvers.cleanpath(t[i])) end end return t end -function resolvers.expand_path(str) - return file.join_path(resolvers.expanded_path_list(str)) +function resolvers.expandpath(str) + return joinpath(resolvers.expandedpathlist(str)) end -function resolvers.expanded_path_list(str) +function resolvers.expandedpathlist(str) if not str then - return ep or { } -- ep ? + return { } elseif instance.savelists then - -- engine+progname hash - str = gsub(str,"%$","") + str = lpegmatch(dollarstripper,str) if not instance.lists[str] then -- cached - local lst = made_list(instance,resolvers.split_path(resolvers.expansion(str))) - instance.lists[str] = expanded_path_from_list(lst) + local lst = made_list(instance,resolvers.splitpath(resolvers.expansion(str))) + instance.lists[str] = expandedpathfromlist(lst) end return instance.lists[str] else - local lst = resolvers.split_path(resolvers.expansion(str)) - return made_list(instance,expanded_path_from_list(lst)) - end -end - -function resolvers.expanded_path_list_from_var(str) -- brrr - local tmp = resolvers.var_of_format_or_suffix(gsub(str,"%$","")) - if tmp ~= "" then - return resolvers.expanded_path_list(tmp) - else - return resolvers.expanded_path_list(str) + local lst = resolvers.splitpath(resolvers.expansion(str)) + return made_list(instance,expandedpathfromlist(lst)) end end -function resolvers.expand_path_from_var(str) - return file.join_path(resolvers.expanded_path_list_from_var(str)) +function resolvers.expandedpathlistfromvariable(str) -- brrr + str = lpegmatch(dollarstripper,str) + local tmp = resolvers.variableofformatorsuffix(str) + return resolvers.expandedpathlist(tmp ~= "" and tmp or str) end -function resolvers.format_of_var(str) - return formats[str] or formats[alternatives[str]] or '' -end -function resolvers.format_of_suffix(str) - return suffixmap[file.extname(str)] or 'tex' +function resolvers.expandpathfromvariable(str) + return joinpath(resolvers.expandedpathlistfromvariable(str)) end -function resolvers.variable_of_format(str) - return formats[str] or formats[alternatives[str]] or '' +function resolvers.expandbraces(str) -- output variable and brace expansion of STRING + local ori = resolvers.variable(str) + local pth = expandedpathfromlist(resolvers.splitpath(ori)) + return joinpath(pth) end -function resolvers.var_of_format_or_suffix(str) - local v = formats[str] - if v then - return v - end - v = formats[alternatives[str]] - if v then - return v - end - v = suffixmap[file.extname(str)] - if v then - return formats[isf] +function resolvers.registerfilehash(name,content,someerror) + if content then + instance.files[name] = content + else + instance.files[name] = { } + if somerror == true then -- can be unset + instance.loaderror = someerror + end end - return '' -end - -function resolvers.expand_braces(str) -- output variable and brace expansion of STRING - local ori = resolvers.variable(str) - local pth = expanded_path_from_list(resolvers.split_path(ori)) - return file.join_path(pth) end -resolvers.isreadable = { } - -function resolvers.isreadable.file(name) - local readable = lfs.isfile(name) -- brrr +local function isreadable(name) + local readable = lfs.isfile(name) -- not file.is_readable(name) asit can be a dir if trace_detail then if readable then - logs.report("fileio","file '%s' is readable",name) + report_resolving("file '%s' is readable",name) else - logs.report("fileio","file '%s' is not readable", name) + report_resolving("file '%s' is not readable", name) end end return readable end -resolvers.isreadable.tex = resolvers.isreadable.file - -- name -- name/name local function collect_files(names) - local filelist = { } + local filelist, noffiles = { }, 0 for k=1,#names do local fname = names[k] if trace_detail then - logs.report("fileio","checking name '%s'",fname) + report_resolving("checking name '%s'",fname) end - local bname = file.basename(fname) - local dname = file.dirname(fname) + local bname = filebasename(fname) + local dname = filedirname(fname) if dname == "" or find(dname,"^%.") then dname = false else @@ -9674,11 +11818,11 @@ local function collect_files(names) local hashes = instance.hashes for h=1,#hashes do local hash = hashes[h] - local blobpath = hash.tag + local blobpath = hash.name local files = blobpath and instance.files[blobpath] if files then if trace_detail then - logs.report("fileio","deep checking '%s' (%s)",blobpath,bname) + report_resolving("deep checking '%s' (%s)",blobpath,bname) end local blobfile = files[bname] if not blobfile then @@ -9690,62 +11834,51 @@ local function collect_files(names) end end if blobfile then + local blobroot = files.__path__ or blobpath if type(blobfile) == 'string' then if not dname or find(blobfile,dname) then - filelist[#filelist+1] = { - hash.type, - file.join(blobpath,blobfile,bname), -- search - resolvers.concatinators[hash.type](blobpath,blobfile,bname) -- result - } + local variant = hash.type + -- local search = filejoin(blobpath,blobfile,bname) + local search = filejoin(blobroot,blobfile,bname) + local result = methodhandler('concatinators',hash.type,blobroot,blobfile,bname) + if trace_detail then + report_resolving("match: variant '%s', search '%s', result '%s'",variant,search,result) + end + noffiles = noffiles + 1 + filelist[noffiles] = { variant, search, result } end else for kk=1,#blobfile do local vv = blobfile[kk] if not dname or find(vv,dname) then - filelist[#filelist+1] = { - hash.type, - file.join(blobpath,vv,bname), -- search - resolvers.concatinators[hash.type](blobpath,vv,bname) -- result - } + local variant = hash.type + -- local search = filejoin(blobpath,vv,bname) + local search = filejoin(blobroot,vv,bname) + local result = methodhandler('concatinators',hash.type,blobroot,vv,bname) + if trace_detail then + report_resolving("match: variant '%s', search '%s', result '%s'",variant,search,result) + end + noffiles = noffiles + 1 + filelist[noffiles] = { variant, search, result } end end end end elseif trace_locating then - logs.report("fileio","no match in '%s' (%s)",blobpath,bname) + report_resolving("no match in '%s' (%s)",blobpath,bname) end end end - if #filelist > 0 then - return filelist - else - return nil - end -end - -function resolvers.suffix_of_format(str) - if suffixes[str] then - return suffixes[str][1] - else - return "" - end -end - -function resolvers.suffixes_of_format(str) - if suffixes[str] then - return suffixes[str] - else - return {} - end + return noffiles > 0 and filelist or nil end -function resolvers.register_in_trees(name) +function resolvers.registerintrees(name) if not find(name,"^%.") then instance.foundintrees[name] = (instance.foundintrees[name] or 0) + 1 -- maybe only one end end --- split the next one up for readability (bu this module needs a cleanup anyway) +-- split the next one up for readability (but this module needs a cleanup anyway) local function can_be_dir(name) -- can become local local fakepaths = instance.fakepaths @@ -9756,61 +11889,62 @@ local function can_be_dir(name) -- can become local fakepaths[name] = 2 -- no directory end end - return (fakepaths[name] == 1) + return fakepaths[name] == 1 end -local function collect_instance_files(filename,collected) -- todo : plugin (scanners, checkers etc) - local result = collected or { } +local preparetreepattern = Cs((P(".")/"%%." + P("-")/"%%-" + P(1))^0 * Cc("$")) + +-- this one is split in smaller functions but it needs testing + +local function collect_instance_files(filename,askedformat,allresults) -- todo : plugin (scanners, checkers etc) + local result = { } local stamp = nil - filename = file.collapse_path(filename) + askedformat = askedformat or "" + filename = collapsepath(filename) -- speed up / beware: format problem - if instance.remember then - stamp = filename .. "--" .. instance.engine .. "--" .. instance.progname .. "--" .. instance.format + if instance.remember and not allresults then + stamp = filename .. "--" .. askedformat if instance.found[stamp] then if trace_locating then - logs.report("fileio","remembering file '%s'",filename) + report_resolving("remembered file '%s'",filename) end + resolvers.registerintrees(filename) -- for tracing used files return instance.found[stamp] end end - if not dangerous[instance.format or "?"] then - if resolvers.isreadable.file(filename) then + if not dangerous[askedformat] then + if isreadable(filename) then if trace_detail then - logs.report("fileio","file '%s' found directly",filename) + report_resolving("file '%s' found directly",filename) + end + if stamp then + instance.found[stamp] = { filename } end - instance.found[stamp] = { filename } return { filename } end end if find(filename,'%*') then if trace_locating then - logs.report("fileio","checking wildcard '%s'", filename) + report_resolving("checking wildcard '%s'", filename) end - result = resolvers.find_wildcard_files(filename) + result = resolvers.findwildcardfiles(filename) -- we can use th elocal elseif file.is_qualified_path(filename) then - if resolvers.isreadable.file(filename) then + if isreadable(filename) then if trace_locating then - logs.report("fileio","qualified name '%s'", filename) + report_resolving("qualified name '%s'", filename) end result = { filename } else - local forcedname, ok, suffix = "", false, file.extname(filename) + local forcedname, ok, suffix = "", false, fileextname(filename) if suffix == "" then -- why - if instance.format == "" then - forcedname = filename .. ".tex" - if resolvers.isreadable.file(forcedname) then - if trace_locating then - logs.report("fileio","no suffix, forcing standard filetype 'tex'") - end - result, ok = { forcedname }, true - end - else - local suffixes = resolvers.suffixes_of_format(instance.format) - for _, s in next, suffixes do + local format_suffixes = askedformat == "" and resolvers.defaultsuffixes or suffixes[askedformat] + if format_suffixes then + for i=1,#format_suffixes do + local s = format_suffixes[i] forcedname = filename .. "." .. s - if resolvers.isreadable.file(forcedname) then + if isreadable(forcedname) then if trace_locating then - logs.report("fileio","no suffix, forcing format filetype '%s'", s) + report_resolving("no suffix, forcing format filetype '%s'", s) end result, ok = { forcedname }, true break @@ -9821,23 +11955,24 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan if not ok and suffix ~= "" then -- try to find in tree (no suffix manipulation), here we search for the -- matching last part of the name - local basename = file.basename(filename) - local pattern = gsub(filename .. "$","([%.%-])","%%%1") - local savedformat = instance.format + local basename = filebasename(filename) + local pattern = lpegmatch(preparetreepattern,filename) + -- messy .. to be sorted out + local savedformat = askedformat local format = savedformat or "" if format == "" then - instance.format = resolvers.format_of_suffix(suffix) + askedformat = resolvers.formatofsuffix(suffix) end if not format then - instance.format = "othertextfiles" -- kind of everything, maybe texinput is better + askedformat = "othertextfiles" -- kind of everything, maybe texinput is better end -- if basename ~= filename then - local resolved = collect_instance_files(basename) - if #result == 0 then + local resolved = collect_instance_files(basename,askedformat,allresults) + if #result == 0 then -- shouldn't this be resolved ? local lowered = lower(basename) if filename ~= lowered then - resolved = collect_instance_files(lowered) + resolved = collect_instance_files(lowered,askedformat,allresults) end end resolvers.format = savedformat @@ -9862,57 +11997,60 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan -- end end if not ok and trace_locating then - logs.report("fileio","qualified name '%s'", filename) + report_resolving("qualified name '%s'", filename) end end else -- search spec - local filetype, extra, done, wantedfiles, ext = '', nil, false, { }, file.extname(filename) - if ext == "" then - if not instance.force_suffixes then - wantedfiles[#wantedfiles+1] = filename - end - else - wantedfiles[#wantedfiles+1] = filename - end - if instance.format == "" then - if ext == "" then - local forcedname = filename .. '.tex' - wantedfiles[#wantedfiles+1] = forcedname - filetype = resolvers.format_of_suffix(forcedname) - if trace_locating then - logs.report("fileio","forcing filetype '%s'",filetype) + local filetype, done, wantedfiles, ext = '', false, { }, fileextname(filename) + -- -- tricky as filename can be bla.1.2.3 + -- if not suffixmap[ext] then --- probably needs to be done elsewhere too + -- wantedfiles[#wantedfiles+1] = filename + -- end + wantedfiles[#wantedfiles+1] = filename + if askedformat == "" then + if ext == "" or not suffixmap[ext] then + local defaultsuffixes = resolvers.defaultsuffixes + for i=1,#defaultsuffixes do + local forcedname = filename .. '.' .. defaultsuffixes[i] + wantedfiles[#wantedfiles+1] = forcedname + filetype = resolvers.formatofsuffix(forcedname) + if trace_locating then + report_resolving("forcing filetype '%s'",filetype) + end end else - filetype = resolvers.format_of_suffix(filename) + filetype = resolvers.formatofsuffix(filename) if trace_locating then - logs.report("fileio","using suffix based filetype '%s'",filetype) + report_resolving("using suffix based filetype '%s'",filetype) end end else - if ext == "" then - local suffixes = resolvers.suffixes_of_format(instance.format) - for _, s in next, suffixes do - wantedfiles[#wantedfiles+1] = filename .. "." .. s + if ext == "" or not suffixmap[ext] then + local format_suffixes = suffixes[askedformat] + if format_suffixes then + for i=1,#format_suffixes do + wantedfiles[#wantedfiles+1] = filename .. "." .. format_suffixes[i] + end end end - filetype = instance.format + filetype = askedformat if trace_locating then - logs.report("fileio","using given filetype '%s'",filetype) + report_resolving("using given filetype '%s'",filetype) end end - local typespec = resolvers.variable_of_format(filetype) - local pathlist = resolvers.expanded_path_list(typespec) + local typespec = resolvers.variableofformat(filetype) + local pathlist = resolvers.expandedpathlist(typespec) if not pathlist or #pathlist == 0 then -- no pathlist, access check only / todo == wildcard if trace_detail then - logs.report("fileio","checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | ")) + report_resolving("checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | ")) end for k=1,#wantedfiles do local fname = wantedfiles[k] - if fname and resolvers.isreadable.file(fname) then + if fname and isreadable(fname) then filename, done = fname, true - result[#result+1] = file.join('.',fname) + result[#result+1] = filejoin('.',fname) break end end @@ -9920,8 +12058,8 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan local filelist = collect_files(wantedfiles) local fl = filelist and filelist[1] if fl then - filename = fl[3] - result[#result+1] = filename + filename = fl[3] -- not local? + result[#result+1] = resolvers.resolve(filename) done = true end else @@ -9930,76 +12068,65 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan local dirlist = { } if filelist then for i=1,#filelist do - dirlist[i] = file.dirname(filelist[i][2]) .. "/" + dirlist[i] = filedirname(filelist[i][3]) .. "/" -- was [2] .. gamble end end if trace_detail then - logs.report("fileio","checking filename '%s'",filename) + report_resolving("checking filename '%s'",filename) end - -- a bit messy ... esp the doscan setting here - local doscan for k=1,#pathlist do local path = pathlist[k] - if find(path,"^!!") then doscan = false else doscan = true end - local pathname = gsub(path,"^!+", '') + local pathname = lpegmatch(inhibitstripper,path) + local doscan = path == pathname -- no ^!! done = false -- using file list if filelist then - local expression -- compare list entries with permitted pattern -- /xx /xx// - if not find(pathname,"/$") then - expression = pathname .. "/" - else - expression = pathname - end - expression = gsub(expression,"([%-%.])","%%%1") -- this also influences - expression = gsub(expression,"//+$", '/.*') -- later usage of pathname - expression = gsub(expression,"//", '/.-/') -- not ok for /// but harmless - expression = "^" .. expression .. "$" + local expression = makepathexpression(pathname) if trace_detail then - logs.report("fileio","using pattern '%s' for path '%s'",expression,pathname) + report_resolving("using pattern '%s' for path '%s'",expression,pathname) end for k=1,#filelist do local fl = filelist[k] local f = fl[2] local d = dirlist[k] if find(d,expression) then - --- todo, test for readable - result[#result+1] = fl[3] - resolvers.register_in_trees(f) -- for tracing used files + -- todo, test for readable + result[#result+1] = resolvers.resolve(fl[3]) -- no shortcut done = true - if instance.allresults then + if allresults then if trace_detail then - logs.report("fileio","match in hash for file '%s' on path '%s', continue scanning",f,d) + report_resolving("match to '%s' in hash for file '%s' and path '%s', continue scanning",expression,f,d) end else if trace_detail then - logs.report("fileio","match in hash for file '%s' on path '%s', quit scanning",f,d) + report_resolving("match to '%s' in hash for file '%s' and path '%s', quit scanning",expression,f,d) end break end elseif trace_detail then - logs.report("fileio","no match in hash for file '%s' on path '%s'",f,d) + report_resolving("no match to '%s' in hash for file '%s' and path '%s'",expression,f,d) end end end if not done and doscan then -- check if on disk / unchecked / does not work at all / also zips - if resolvers.splitmethod(pathname).scheme == 'file' then -- ? + local scheme = url.hasscheme(pathname) + if not scheme or scheme == "file" then local pname = gsub(pathname,"%.%*$",'') if not find(pname,"%*") then local ppname = gsub(pname,"/+$","") if can_be_dir(ppname) then for k=1,#wantedfiles do local w = wantedfiles[k] - local fname = file.join(ppname,w) - if resolvers.isreadable.file(fname) then + local fname = filejoin(ppname,w) + if isreadable(fname) then if trace_detail then - logs.report("fileio","found '%s' by scanning",fname) + report_resolving("found '%s' by scanning",fname) end result[#result+1] = fname done = true - if not instance.allresults then break end + if not allresults then break end end end else @@ -10009,56 +12136,66 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan end end if not done and doscan then - -- todo: slow path scanning + -- todo: slow path scanning ... although we now have tree:// supported in $TEXMF end - if done and not instance.allresults then break end + if done and not allresults then break end end end end for k=1,#result do - result[k] = file.collapse_path(result[k]) + local rk = collapsepath(result[k]) + result[k] = rk + resolvers.registerintrees(rk) -- for tracing used files end - if instance.remember then + if stamp then instance.found[stamp] = result end return result end -if not resolvers.concatinators then resolvers.concatinators = { } end +-- -- -- begin of main file search routing -- -- -- -resolvers.concatinators.tex = file.join -resolvers.concatinators.file = resolvers.concatinators.tex -function resolvers.find_files(filename,filetype,mustexist) - if type(mustexist) == boolean then - -- all set - elseif type(filetype) == 'boolean' then - filetype, mustexist = nil, false - elseif type(filetype) ~= 'string' then - filetype, mustexist = nil, false - end - instance.format = filetype or '' - local result = collect_instance_files(filename) + + + + + + + + +-- -- -- end of main file search routing -- -- -- + +local function findfiles(filename,filetype,allresults) + local result = collect_instance_files(filename,filetype or "",allresults) if #result == 0 then local lowered = lower(filename) if filename ~= lowered then - return collect_instance_files(lowered) + return collect_instance_files(lowered,filetype or "",allresults) end end - instance.format = '' return result end -function resolvers.find_file(filename,filetype,mustexist) - return (resolvers.find_files(filename,filetype,mustexist)[1] or "") +function resolvers.findfiles(filename,filetype) + return findfiles(filename,filetype,true) +end + +function resolvers.findfile(filename,filetype) + return findfiles(filename,filetype,false)[1] or "" +end + +function resolvers.findpath(filename,filetype) + return filedirname(findfiles(filename,filetype,false)[1] or "") end -function resolvers.find_given_files(filename) - local bname, result = file.basename(filename), { } +local function findgivenfiles(filename,allresults) + local bname, result = filebasename(filename), { } local hashes = instance.hashes + local noffound = 0 for k=1,#hashes do local hash = hashes[k] - local files = instance.files[hash.tag] or { } + local files = instance.files[hash.name] or { } local blist = files[bname] if not blist then local rname = "remap:"..bname @@ -10070,13 +12207,21 @@ function resolvers.find_given_files(filename) end if blist then if type(blist) == 'string' then - result[#result+1] = resolvers.concatinators[hash.type](hash.tag,blist,bname) or "" - if not instance.allresults then break end + local found = methodhandler('concatinators',hash.type,hash.name,blist,bname) or "" + if found ~= "" then + noffound = noffound + 1 + result[noffound] = resolvers.resolve(found) + if not allresults then break end + end else for kk=1,#blist do local vv = blist[kk] - result[#result+1] = resolvers.concatinators[hash.type](hash.tag,vv,bname) or "" - if not instance.allresults then break end + local found = methodhandler('concatinators',hash.type,hash.name,vv,bname) or "" + if found ~= "" then + noffound = noffound + 1 + result[noffound] = resolvers.resolve(found) + if not allresults then break end + end end end end @@ -10084,24 +12229,31 @@ function resolvers.find_given_files(filename) return result end -function resolvers.find_given_file(filename) - return (resolvers.find_given_files(filename)[1] or "") +function resolvers.findgivenfiles(filename) + return findgivenfiles(filename,true) end -local function doit(path,blist,bname,tag,kind,result,allresults) +function resolvers.findgivenfile(filename) + return findgivenfiles(filename,false)[1] or "" +end + +local function doit(path,blist,bname,tag,variant,result,allresults) local done = false - if blist and kind then + if blist and variant then + local resolve = resolvers.resolve -- added if type(blist) == 'string' then -- make function and share code if find(lower(blist),path) then - result[#result+1] = resolvers.concatinators[kind](tag,blist,bname) or "" + local full = methodhandler('concatinators',variant,tag,blist,bname) or "" + result[#result+1] = resolve(full) done = true end else for kk=1,#blist do local vv = blist[kk] if find(lower(vv),path) then - result[#result+1] = resolvers.concatinators[kind](tag,vv,bname) or "" + local full = methodhandler('concatinators',variant,tag,vv,bname) or "" + result[#result+1] = resolve(full) done = true if not allresults then break end end @@ -10111,30 +12263,32 @@ local function doit(path,blist,bname,tag,kind,result,allresults) return done end -function resolvers.find_wildcard_files(filename) -- todo: remap: - local result = { } - local bname, dname = file.basename(filename), file.dirname(filename) - local path = gsub(dname,"^*/","") - path = gsub(path,"*",".*") - path = gsub(path,"-","%%-") - if dname == "" then - path = ".*" - end - local name = bname - name = gsub(name,"*",".*") - name = gsub(name,"-","%%-") - path = lower(path) - name = lower(name) - local files, allresults, done = instance.files, instance.allresults, false + +local makewildcard = Cs( + (P("^")^0 * P("/") * P(-1) + P(-1)) /".*" + + (P("^")^0 * P("/") / "")^0 * (P("*")/".*" + P("-")/"%%-" + P(".")/"%%." + P("?")/"."+ P("\\")/"/" + P(1))^0 +) + +function resolvers.wildcardpattern(pattern) + return lpegmatch(makewildcard,pattern) or pattern +end + +local function findwildcardfiles(filename,allresults,result) -- todo: remap: and lpeg + result = result or { } + local base = filebasename(filename) + local dirn = filedirname(filename) + local path = lower(lpegmatch(makewildcard,dirn) or dirn) + local name = lower(lpegmatch(makewildcard,base) or base) + local files, done = instance.files, false if find(name,"%*") then local hashes = instance.hashes for k=1,#hashes do local hash = hashes[k] - local tag, kind = hash.tag, hash.type - for kk, hh in next, files[hash.tag] do + local hashname, hashtype = hash.name, hash.type + for kk, hh in next, files[hashname] do if not find(kk,"^remap:") then if find(lower(kk),name) then - if doit(path,hh,kk,tag,kind,result,allresults) then done = true end + if doit(path,hh,kk,hashname,hashtype,result,allresults) then done = true end if done and not allresults then break end end end @@ -10144,8 +12298,8 @@ function resolvers.find_wildcard_files(filename) -- todo: remap: local hashes = instance.hashes for k=1,#hashes do local hash = hashes[k] - local tag, kind = hash.tag, hash.type - if doit(path,files[tag][bname],bname,tag,kind,result,allresults) then done = true end + local hashname, hashtype = hash.name, hash.type + if doit(path,files[hashname][bname],bname,hashname,hashtype,result,allresults) then done = true end if done and not allresults then break end end end @@ -10154,8 +12308,12 @@ function resolvers.find_wildcard_files(filename) -- todo: remap: return result end -function resolvers.find_wildcard_file(filename) - return (resolvers.find_wildcard_files(filename)[1] or "") +function resolvers.findwildcardfiles(filename,result) + return findwildcardfiles(filename,true,result) +end + +function resolvers.findwildcardfile(filename) + return findwildcardfiles(filename,false)[1] or "" end -- main user functions @@ -10166,34 +12324,33 @@ end function resolvers.load(option) statistics.starttiming(instance) - resolvers.resetconfig() - resolvers.identify_cnf() - resolvers.load_lua() -- will become the new method - resolvers.expand_variables() - resolvers.load_cnf() -- will be skipped when we have a lua file - resolvers.expand_variables() + identify_configuration_files() + load_configuration_files() if option ~= "nofiles" then - resolvers.load_hash() + load_databases() resolvers.automount() end statistics.stoptiming(instance) + local files = instance.files + return files and next(files) and true +end + +local function report(str) + if trace_locating then + report_resolving(str) -- has already verbose + else + print(str) + end end -function resolvers.for_files(command, files, filetype, mustexist) +function resolvers.dowithfilesandreport(command, files, ...) -- will move if files and #files > 0 then - local function report(str) - if trace_locating then - logs.report("fileio",str) -- has already verbose - else - print(str) - end - end if trace_locating then report('') -- ? end for f=1,#files do local file = files[f] - local result = command(file,filetype,mustexist) + local result = command(file,...) if type(result) == 'string' then report(result) else @@ -10205,21 +12362,16 @@ function resolvers.for_files(command, files, filetype, mustexist) end end --- strtab +-- obsolete -resolvers.var_value = resolvers.variable -- output the value of variable $STRING. -resolvers.expand_var = resolvers.expansion -- output variable expansion of STRING. +-- resolvers.varvalue = resolvers.variable -- output the value of variable $STRING. +-- resolvers.expandvar = resolvers.expansion -- output variable expansion of STRING. -function resolvers.show_path(str) -- output search path for file type NAME - return file.join_path(resolvers.expanded_path_list(resolvers.format_of_var(str))) +function resolvers.showpath(str) -- output search path for file type NAME + return joinpath(resolvers.expandedpathlist(resolvers.formatofvariable(str))) end --- resolvers.find_file(filename) --- resolvers.find_file(filename, filetype, mustexist) --- resolvers.find_file(filename, mustexist) --- resolvers.find_file(filename, filetype) - -function resolvers.register_file(files, name, path) +function resolvers.registerfile(files, name, path) if files[name] then if type(files[name]) == 'string' then files[name] = { files[name], path } @@ -10231,101 +12383,24 @@ function resolvers.register_file(files, name, path) end end -function resolvers.splitmethod(filename) - if not filename then - return { } -- safeguard - elseif type(filename) == "table" then - return filename -- already split - elseif not find(filename,"://") then - return { scheme="file", path = filename, original=filename } -- quick hack - else - return url.hashed(filename) - end -end - -function table.sequenced(t,sep) -- temp here - local s = { } - for k, v in next, t do -- indexed? - s[#s+1] = k .. "=" .. tostring(v) - end - return concat(s, sep or " | ") -end - -function resolvers.methodhandler(what, filename, filetype) -- ... - filename = file.collapse_path(filename) - local specification = (type(filename) == "string" and resolvers.splitmethod(filename)) or filename -- no or { }, let it bomb - local scheme = specification.scheme - if resolvers[what][scheme] then - if trace_locating then - logs.report("fileio","handler '%s' -> '%s' -> '%s'",specification.original,what,table.sequenced(specification)) - end - return resolvers[what][scheme](filename,filetype) -- todo: specification - else - return resolvers[what].tex(filename,filetype) -- todo: specification - end -end - -function resolvers.clean_path(str) - if str then - str = gsub(str,"\\","/") - str = gsub(str,"^!+","") - str = gsub(str,"^~",resolvers.homedir) - return str - else - return nil - end -end - -function resolvers.do_with_path(name,func) - local pathlist = resolvers.expanded_path_list(name) +function resolvers.dowithpath(name,func) + local pathlist = resolvers.expandedpathlist(name) for i=1,#pathlist do - func("^"..resolvers.clean_path(pathlist[i])) + func("^"..resolvers.cleanpath(pathlist[i])) end end -function resolvers.do_with_var(name,func) - func(expanded_var(name)) -end - -function resolvers.with_files(pattern,handle) - local hashes = instance.hashes - for i=1,#hashes do - local hash = hashes[i] - local blobpath = hash.tag - local blobtype = hash.type - if blobpath then - local files = instance.files[blobpath] - if files then - for k,v in next, files do - if find(k,"^remap:") then - k = files[k] - v = files[k] -- chained - end - if find(k,pattern) then - if type(v) == "string" then - handle(blobtype,blobpath,v,k) - else - for _,vv in next, v do -- indexed - handle(blobtype,blobpath,vv,k) - end - end - end - end - end - end - end +function resolvers.dowithvariable(name,func) + func(expandedvariable(name)) end -function resolvers.locate_format(name) - local barename, fmtname = gsub(name,"%.%a+$",""), "" - if resolvers.usecache then - local path = file.join(caches.setpath("formats")) -- maybe platform - fmtname = file.join(path,barename..".fmt") or "" - end +function resolvers.locateformat(name) + local barename = file.removesuffix(name) -- gsub(name,"%.%a+$","") + local fmtname = caches.getfirstreadablefile(barename..".fmt","formats") or "" if fmtname == "" then - fmtname = resolvers.find_files(barename..".fmt")[1] or "" + fmtname = resolvers.findfile(barename..".fmt") + fmtname = resolvers.cleanpath(fmtname) end - fmtname = resolvers.clean_path(fmtname) if fmtname ~= "" then local barename = file.removesuffix(fmtname) local luaname, lucname, luiname = barename .. ".lua", barename .. ".luc", barename .. ".lui" @@ -10340,7 +12415,7 @@ function resolvers.locate_format(name) return nil, nil end -function resolvers.boolean_variable(str,default) +function resolvers.booleanvariable(str,default) local b = resolvers.expansion(str) if b == "" then return default @@ -10350,204 +12425,62 @@ function resolvers.boolean_variable(str,default) end end -texconfig.kpse_init = false - -kpse = { original = kpse } setmetatable(kpse, { __index = function(k,v) return resolvers[v] end } ) - --- for a while - -input = resolvers - - -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['data-tmp'] = { - version = 1.001, - comment = "companion to luat-lib.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - ---[[ldx-- -

This module deals with caching data. It sets up the paths and -implements loaders and savers for tables. Best is to set the -following variable. When not set, the usual paths will be -checked. Personally I prefer the (users) temporary path.

- - -TEXMFCACHE=$TMP;$TEMP;$TMPDIR;$TEMPDIR;$HOME;$TEXMFVAR;$VARTEXMF;. - - -

Currently we do no locking when we write files. This is no real -problem because most caching involves fonts and the chance of them -being written at the same time is small. We also need to extend -luatools with a recache feature.

---ldx]]-- - -local format, lower, gsub = string.format, string.lower, string.gsub - -local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) -- not used yet - -caches = caches or { } - -caches.path = caches.path or nil -caches.base = caches.base or "luatex-cache" -caches.more = caches.more or "context" -caches.direct = false -- true is faster but may need huge amounts of memory -caches.tree = false -caches.paths = caches.paths or nil -caches.force = true -- changed for TEXLIVE by TH -caches.defaults = { "TEXMFCACHE", "TMPDIR", "TEMPDIR", "TMP", "TEMP", "HOME", "HOMEPATH" } - -function caches.temp() - local cachepath = nil - local function check(list,isenv) - if not cachepath then - for k=1,#list do - local v = list[k] - cachepath = (isenv and (os.env[v] or "")) or v or "" - if cachepath == "" then - -- next - else - cachepath = resolvers.clean_path(cachepath) - if lfs.isdir(cachepath) and file.iswritable(cachepath) then -- lfs.attributes(cachepath,"mode") == "directory" - break - elseif caches.force or io.ask(format("\nShould I create the cache path %s?",cachepath), "no", { "yes", "no" }) == "yes" then - dir.mkdirs(cachepath) - if lfs.isdir(cachepath) and file.iswritable(cachepath) then - break +function resolvers.dowithfilesintree(pattern,handle,before,after) -- will move, can be a nice iterator instead + local instance = resolvers.instance + local hashes = instance.hashes + for i=1,#hashes do + local hash = hashes[i] + local blobtype = hash.type + local blobpath = hash.name + if blobpath then + if before then + before(blobtype,blobpath,pattern) + end + local files = instance.files[blobpath] + local total, checked, done = 0, 0, 0 + if files then + for k,v in next, files do + total = total + 1 + if find(k,"^remap:") then + k = files[k] + v = k -- files[k] -- chained + end + if find(k,pattern) then + if type(v) == "string" then + checked = checked + 1 + if handle(blobtype,blobpath,v,k) then + done = done + 1 + end + else + checked = checked + #v + for i=1,#v do + if handle(blobtype,blobpath,v[i],k) then + done = done + 1 + end + end end end end - cachepath = nil + end + if after then + after(blobtype,blobpath,pattern,total,checked,done) end end end - check(resolvers.clean_path_list("TEXMFCACHE") or { }) - check(caches.defaults,true) - if not cachepath then - print("\nfatal error: there is no valid (writable) cache path defined\n") - os.exit() - elseif not lfs.isdir(cachepath) then -- lfs.attributes(cachepath,"mode") ~= "directory" - print(format("\nfatal error: cache path %s is not a directory\n",cachepath)) - os.exit() - end - cachepath = file.collapse_path(cachepath) - function caches.temp() - return cachepath - end - return cachepath -end - -function caches.configpath() - return table.concat(resolvers.instance.cnffiles,";") -end - -function caches.hashed(tree) - return md5.hex(gsub(lower(tree),"[\\\/]+","/")) -end - -function caches.treehash() - local tree = caches.configpath() - if not tree or tree == "" then - return false - else - return caches.hashed(tree) - end -end - -function caches.setpath(...) - if not caches.path then - if not caches.path then - caches.path = caches.temp() - end - caches.path = resolvers.clean_path(caches.path) -- to be sure - caches.tree = caches.tree or caches.treehash() - if caches.tree then - caches.path = dir.mkdirs(caches.path,caches.base,caches.more,caches.tree) - else - caches.path = dir.mkdirs(caches.path,caches.base,caches.more) - end - end - if not caches.path then - caches.path = '.' - end - caches.path = resolvers.clean_path(caches.path) - local dirs = { ... } - if #dirs > 0 then - local pth = dir.mkdirs(caches.path,...) - return pth - end - caches.path = dir.expand_name(caches.path) - return caches.path -end - -function caches.definepath(category,subcategory) - return function() - return caches.setpath(category,subcategory) - end -end - -function caches.setluanames(path,name) - return path .. "/" .. name .. ".tma", path .. "/" .. name .. ".tmc" -end - -function caches.loaddata(path,name) - local tmaname, tmcname = caches.setluanames(path,name) - local loader = loadfile(tmcname) or loadfile(tmaname) - if loader then - loader = loader() - collectgarbage("step") - return loader - else - return false - end -end - ---~ function caches.loaddata(path,name) ---~ local tmaname, tmcname = caches.setluanames(path,name) ---~ return dofile(tmcname) or dofile(tmaname) ---~ end - -function caches.iswritable(filepath,filename) - local tmaname, tmcname = caches.setluanames(filepath,filename) - return file.iswritable(tmaname) -end - -function caches.savedata(filepath,filename,data,raw) - local tmaname, tmcname = caches.setluanames(filepath,filename) - local reduce, simplify = true, true - if raw then - reduce, simplify = false, false - end - data.cache_uuid = os.uuid() - if caches.direct then - file.savedata(tmaname, table.serialize(data,'return',false,true,false)) -- no hex - else - table.tofile(tmaname, data,'return',false,true,false) -- maybe not the last true - end - local cleanup = resolvers.boolean_variable("PURGECACHE", false) - local strip = resolvers.boolean_variable("LUACSTRIP", true) - utils.lua.compile(tmaname, tmcname, cleanup, strip) end --- here we use the cache for format loading (texconfig.[formatname|jobname]) +resolvers.obsolete = resolvers.obsolete or { } +local obsolete = resolvers.obsolete ---~ if tex and texconfig and texconfig.formatname and texconfig.formatname == "" then -if tex and texconfig and (not texconfig.formatname or texconfig.formatname == "") and input and resolvers.instance then - if not texconfig.luaname then texconfig.luaname = "cont-en.lua" end -- or luc - texconfig.formatname = caches.setpath("formats") .. "/" .. gsub(texconfig.luaname,"%.lu.$",".fmt") -end +resolvers.find_file = resolvers.findfile obsolete.find_file = resolvers.findfile +resolvers.find_files = resolvers.findfiles obsolete.find_files = resolvers.findfiles end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['data-res'] = { +if not modules then modules = { } end modules ['data-pre'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -10555,17 +12488,28 @@ if not modules then modules = { } end modules ['data-res'] = { license = "see context related readme files" } ---~ print(resolvers.resolve("abc env:tmp file:cont-en.tex path:cont-en.tex full:cont-en.tex rel:zapf/one/p-chars.tex")) +-- It could be interesting to hook the resolver in the file +-- opener so that unresolved prefixes travel around and we +-- get more abstraction. -local upper, lower, gsub = string.upper, string.lower, string.gsub +-- As we use this beforehand we will move this up in the chain +-- of loading. -local prefixes = { } + +local resolvers = resolvers +local prefixes = utilities.storage.allocate() +resolvers.prefixes = prefixes + +local gsub = string.gsub +local cleanpath, findgivenfile, expansion = resolvers.cleanpath, resolvers.findgivenfile, resolvers.expansion +local getenv = resolvers.getenv -- we can probably also use resolvers.expansion +local P, Cs, lpegmatch = lpeg.P, lpeg.Cs, lpeg.match prefixes.environment = function(str) - return resolvers.clean_path(os.getenv(str) or os.getenv(upper(str)) or os.getenv(lower(str)) or "") + return cleanpath(expansion(str)) end -prefixes.relative = function(str,n) +prefixes.relative = function(str,n) -- lfs.isfile if io.exists(str) then -- nothing elseif io.exists("./" .. str) then @@ -10581,7 +12525,7 @@ prefixes.relative = function(str,n) end end end - return resolvers.clean_path(str) + return cleanpath(str) end prefixes.auto = function(str) @@ -10593,18 +12537,34 @@ prefixes.auto = function(str) end prefixes.locate = function(str) - local fullname = resolvers.find_given_file(str) or "" - return resolvers.clean_path((fullname ~= "" and fullname) or str) + local fullname = findgivenfile(str) or "" + return cleanpath((fullname ~= "" and fullname) or str) end prefixes.filename = function(str) - local fullname = resolvers.find_given_file(str) or "" - return resolvers.clean_path(file.basename((fullname ~= "" and fullname) or str)) + local fullname = findgivenfile(str) or "" + return cleanpath(file.basename((fullname ~= "" and fullname) or str)) end prefixes.pathname = function(str) - local fullname = resolvers.find_given_file(str) or "" - return resolvers.clean_path(file.dirname((fullname ~= "" and fullname) or str)) + local fullname = findgivenfile(str) or "" + return cleanpath(file.dirname((fullname ~= "" and fullname) or str)) +end + +prefixes.selfautoloc = function(str) + return cleanpath(file.join(getenv('SELFAUTOLOC'),str)) +end + +prefixes.selfautoparent = function(str) + return cleanpath(file.join(getenv('SELFAUTOPARENT'),str)) +end + +prefixes.selfautodir = function(str) + return cleanpath(file.join(getenv('SELFAUTODIR'),str)) +end + +prefixes.home = function(str) + return cleanpath(file.join(getenv('HOME'),str)) end prefixes.env = prefixes.environment @@ -10633,26 +12593,71 @@ local function _resolve_(method,target) end end -local function resolve(str) - if type(str) == "table" then - for k=1,#str do - local v = str[k] - str[k] = resolve(v) or v +local resolved, abstract = { }, { } + +function resolvers.resetresolve(str) + resolved, abstract = { }, { } +end + +local function resolve(str) -- use schemes, this one is then for the commandline only + local res = resolved[str] + if not res then + res = gsub(str,"([a-z][a-z]+):([^ \"\']*)",_resolve_) + resolved[str] = res + abstract[res] = str + end + return res +end + +local function unresolve(str) + return abstract[str] or str +end + +resolvers.resolve = resolve +resolvers.unresolve = unresolve + +if os.uname then + + for k, v in next, os.uname() do + if not prefixes[k] then + prefixes[k] = function() return v end + end + end + +end + +if os.type == "unix" then + + local pattern + + local function makepattern(t,k,v) + local colon = P(":") + local p + for k, v in table.sortedpairs(prefixes) do + if p then + p = P(k) + p + else + p = P(k) + end + end + pattern = Cs((p * colon + colon/";" + P(1))^0) + if t then + t[k] = v end - elseif str and str ~= "" then - str = gsub(str,"([a-z]+):([^ \"\']*)",_resolve_) end - return str -end -resolvers.resolve = resolve + makepattern() -if os.uname then + getmetatable(prefixes).__newindex = makepattern - for k, v in next, os.uname() do - if not prefixes[k] then - prefixes[k] = function() return v end - end + function resolvers.repath(str) + return lpegmatch(pattern,str) + end + +else -- already the default: + + function resolvers.repath(str) + return str end end @@ -10670,13 +12675,23 @@ if not modules then modules = { } end modules ['data-inp'] = { license = "see context related readme files" } -resolvers.finders = resolvers.finders or { } -resolvers.openers = resolvers.openers or { } -resolvers.loaders = resolvers.loaders or { } +local allocate = utilities.storage.allocate +local resolvers = resolvers + +local methodhandler = resolvers.methodhandler +local registermethod = resolvers.registermethod -resolvers.finders.notfound = { nil } -resolvers.openers.notfound = { nil } -resolvers.loaders.notfound = { false, nil, 0 } +local finders = allocate { helpers = { }, notfound = function() end } +local openers = allocate { helpers = { }, notfound = function() end } +local loaders = allocate { helpers = { }, notfound = function() return false, nil, 0 end } + +registermethod("finders", finders, "uri") +registermethod("openers", openers, "uri") +registermethod("loaders", loaders, "uri") + +resolvers.finders = finders +resolvers.openers = openers +resolvers.loaders = loaders end -- of closure @@ -10691,15 +12706,23 @@ if not modules then modules = { } end modules ['data-out'] = { license = "see context related readme files" } -outputs = outputs or { } +local allocate = utilities.storage.allocate +local resolvers = resolvers + +local registermethod = resolvers.registermethod +local savers = allocate { helpers = { } } + +resolvers.savers = savers + +registermethod("savers", savers, "uri") end -- of closure do -- create closure to overcome 200 locals limit -if not modules then modules = { } end modules ['data-con'] = { +if not modules then modules = { } end modules ['data-fil'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -10707,6 +12730,124 @@ if not modules then modules = { } end modules ['data-con'] = { license = "see context related readme files" } +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) + +local report_files = logs.reporter("resolvers","files") + +local resolvers = resolvers + +local finders, openers, loaders, savers = resolvers.finders, resolvers.openers, resolvers.loaders, resolvers.savers +local locators, hashers, generators, concatinators = resolvers.locators, resolvers.hashers, resolvers.generators, resolvers.concatinators + +local checkgarbage = utilities.garbagecollector and utilities.garbagecollector.check + +function locators.file(specification) + local name = specification.filename + local realname = resolvers.resolve(name) -- no shortcut + if realname and realname ~= '' and lfs.isdir(realname) then + if trace_locating then + report_files("file locator '%s' found as '%s'",name,realname) + end + resolvers.appendhash('file',name,true) -- cache + elseif trace_locating then + report_files("file locator '%s' not found",name) + end +end + +function hashers.file(specification) + local name = specification.filename + local content = caches.loadcontent(name,'files') + resolvers.registerfilehash(name,content,content==nil) +end + +function generators.file(specification) + local path = specification.filename + local content = resolvers.scanfiles(path) + resolvers.registerfilehash(path,content,true) +end + +concatinators.file = file.join + +function finders.file(specification,filetype) + local filename = specification.filename + local foundname = resolvers.findfile(filename,filetype) + if foundname and foundname ~= "" then + if trace_locating then + report_files("file finder: '%s' found",filename) + end + return foundname + else + if trace_locating then + report_files("file finder: %s' not found",filename) + end + return finders.notfound() + end +end + +-- The default textopener will be overloaded later on. + +function openers.helpers.textopener(tag,filename,f) + return { + reader = function() return f:read () end, + close = function() logs.show_close(filename) return f:close() end, + } +end + +function openers.file(specification,filetype) + local filename = specification.filename + if filename and filename ~= "" then + local f = io.open(filename,"r") + if f then + if trace_locating then + report_files("file opener, '%s' opened",filename) + end + return openers.helpers.textopener("file",filename,f) + end + end + if trace_locating then + report_files("file opener, '%s' not found",filename) + end + return openers.notfound() +end + +function loaders.file(specification,filetype) + local filename = specification.filename + if filename and filename ~= "" then + local f = io.open(filename,"rb") + if f then + logs.show_load(filename) + if trace_locating then + report_files("file loader, '%s' loaded",filename) + end + local s = f:read("*a") + if checkgarbage then + checkgarbage(#s) + end + f:close() + if s then + return true, s, #s + end + end + end + if trace_locating then + report_files("file loader, '%s' not found",filename) + end + return loaders.notfound() +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-con'] = { + version = 1.100, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + local format, lower, gsub = string.format, string.lower, string.gsub local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) @@ -10726,50 +12867,63 @@ table structures without bothering about the disk cache.

Examples of usage can be found in the font related code.

--ldx]]-- -containers = containers or { } - +containers = containers or { } +local containers = containers containers.usecache = true +local report_containers = logs.reporter("resolvers","containers") + local function report(container,tag,name) if trace_cache or trace_containers then - logs.report(format("%s cache",container.subcategory),"%s: %s",tag,name or 'invalid') + report_containers("container: %s, tag: %s, name: %s",container.subcategory,tag,name or 'invalid') end end local allocated = { } --- tracing +local mt = { + __index = function(t,k) + if k == "writable" then + local writable = caches.getwritablepath(t.category,t.subcategory) or { "." } + t.writable = writable + return writable + elseif k == "readables" then + local readables = caches.getreadablepaths(t.category,t.subcategory) or { "." } + t.readables = readables + return readables + end + end, + __storage__ = true +} function containers.define(category, subcategory, version, enabled) - return function() - if category and subcategory then - local c = allocated[category] - if not c then - c = { } - allocated[category] = c - end - local s = c[subcategory] - if not s then - s = { - category = category, - subcategory = subcategory, - storage = { }, - enabled = enabled, - version = version or 1.000, - trace = false, - path = caches and caches.setpath and caches.setpath(category,subcategory), - } - c[subcategory] = s - end - return s - else - return nil + if category and subcategory then + local c = allocated[category] + if not c then + c = { } + allocated[category] = c + end + local s = c[subcategory] + if not s then + s = { + category = category, + subcategory = subcategory, + storage = { }, + enabled = enabled, + version = version or math.pi, -- after all, this is TeX + trace = false, + -- writable = caches.getwritablepath and caches.getwritablepath (category,subcategory) or { "." }, + -- readables = caches.getreadablepaths and caches.getreadablepaths(category,subcategory) or { "." }, + } + setmetatable(s,mt) + c[subcategory] = s end + return s end end function containers.is_usable(container, name) - return container.enabled and caches and caches.iswritable(container.path, name) + return container.enabled and caches and caches.is_writable(container.writable, name) end function containers.is_valid(container, name) @@ -10782,18 +12936,20 @@ function containers.is_valid(container, name) end function containers.read(container,name) - if container.enabled and caches and not container.storage[name] and containers.usecache then - container.storage[name] = caches.loaddata(container.path,name) - if containers.is_valid(container,name) then + local storage = container.storage + local stored = storage[name] + if not stored and container.enabled and caches and containers.usecache then + stored = caches.loaddata(container.readables,name) + if stored and stored.cache_version == container.version then report(container,"loaded",name) else - container.storage[name] = nil + stored = nil end - end - if container.storage[name] then + storage[name] = stored + elseif stored then report(container,"reusing",name) end - return container.storage[name] + return stored end function containers.write(container, name, data) @@ -10802,7 +12958,7 @@ function containers.write(container, name, data) if container.enabled and caches then local unique, shared = data.unique, data.shared data.unique, data.shared = nil, nil - caches.savedata(container.path, name, data) + caches.savedata(container.writable, name, data) report(container,"saved",name) data.unique, data.shared = unique, shared end @@ -10837,50 +12993,18 @@ local format, lower, gsub, find = string.format, string.lower, string.gsub, stri local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) --- since we want to use the cache instead of the tree, we will now --- reimplement the saver. - -local save_data = resolvers.save_data -local load_data = resolvers.load_data - -resolvers.cachepath = nil -- public, for tracing -resolvers.usecache = true -- public, for tracing +local report_mounts = logs.reporter("resolvers","mounts") -function resolvers.save_data(dataname) - save_data(dataname, function(cachename,dataname) - resolvers.usecache = not toboolean(resolvers.expansion("CACHEINTDS") or "false",true) - if resolvers.usecache then - resolvers.cachepath = resolvers.cachepath or caches.definepath("trees") - return file.join(resolvers.cachepath(),caches.hashed(cachename)) - else - return file.join(cachename,dataname) - end - end) -end - -function resolvers.load_data(pathname,dataname,filename) - load_data(pathname,dataname,filename,function(dataname,filename) - resolvers.usecache = not toboolean(resolvers.expansion("CACHEINTDS") or "false",true) - if resolvers.usecache then - resolvers.cachepath = resolvers.cachepath or caches.definepath("trees") - return file.join(resolvers.cachepath(),caches.hashed(pathname)) - else - if not filename or (filename == "") then - filename = dataname - end - return file.join(pathname,filename) - end - end) -end +local resolvers = resolvers -- we will make a better format, maybe something xml or just text or lua resolvers.automounted = resolvers.automounted or { } function resolvers.automount(usecache) - local mountpaths = resolvers.clean_path_list(resolvers.expansion('TEXMFMOUNT')) + local mountpaths = resolvers.cleanpathlist(resolvers.expansion('TEXMFMOUNT')) if (not mountpaths or #mountpaths == 0) and usecache then - mountpaths = { caches.setpath("mount") } + mountpaths = caches.getreadablepaths("mount") end if mountpaths and #mountpaths > 0 then statistics.starttiming(resolvers.instance) @@ -10894,7 +13018,7 @@ function resolvers.automount(usecache) -- skip elseif find(line,"^zip://") then if trace_locating then - logs.report("fileio","mounting %s",line) + report_mounts("mounting %s",line) end table.insert(resolvers.automounted,line) resolvers.usezipfile(line) @@ -10910,40 +13034,40 @@ end -- status info -statistics.register("used config path", function() return caches.configpath() end) -statistics.register("used cache path", function() return caches.temp() or "?" end) +statistics.register("used config file", function() return caches.configfiles() end) +statistics.register("used cache path", function() return caches.usedpaths() end) -- experiment (code will move) -function statistics.save_fmt_status(texname,formatbanner,sourcefile) -- texname == formatname +function statistics.savefmtstatus(texname,formatbanner,sourcefile) -- texname == formatname local enginebanner = status.list().banner if formatbanner and enginebanner and sourcefile then local luvname = file.replacesuffix(texname,"luv") local luvdata = { enginebanner = enginebanner, formatbanner = formatbanner, - sourcehash = md5.hex(io.loaddata(resolvers.find_file(sourcefile)) or "unknown"), + sourcehash = md5.hex(io.loaddata(resolvers.findfile(sourcefile)) or "unknown"), sourcefile = sourcefile, } io.savedata(luvname,table.serialize(luvdata,true)) end end -function statistics.check_fmt_status(texname) +function statistics.checkfmtstatus(texname) local enginebanner = status.list().banner if enginebanner and texname then local luvname = file.replacesuffix(texname,"luv") if lfs.isfile(luvname) then local luv = dofile(luvname) if luv and luv.sourcefile then - local sourcehash = md5.hex(io.loaddata(resolvers.find_file(luv.sourcefile)) or "unknown") + local sourcehash = md5.hex(io.loaddata(resolvers.findfile(luv.sourcefile)) or "unknown") local luvbanner = luv.enginebanner or "?" if luvbanner ~= enginebanner then - return string.format("engine mismatch (luv:%s <> bin:%s)",luvbanner,enginebanner) + return format("engine mismatch (luv: %s <> bin: %s)",luvbanner,enginebanner) end local luvhash = luv.sourcehash or "?" if luvhash ~= sourcehash then - return string.format("source mismatch (luv:%s <> bin:%s)",luvhash,sourcehash) + return format("source mismatch (luv: %s <> bin: %s)",luvhash,sourcehash) end else return "invalid status file" @@ -10968,25 +13092,30 @@ if not modules then modules = { } end modules ['data-zip'] = { license = "see context related readme files" } +-- partly redone .. needs testing + local format, find, match = string.format, string.find, string.match -local unpack = unpack or table.unpack local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local report_zip = logs.reporter("resolvers","zip") + -- zip:///oeps.zip?name=bla/bla.tex -- zip:///oeps.zip?tree=tex/texmf-local -- zip:///texmf.zip?tree=/tex/texmf -- zip:///texmf.zip?tree=/tex/texmf-local -- zip:///texmf-mine.zip?tree=/tex/texmf-projects -zip = zip or { } -zip.archives = zip.archives or { } -zip.registeredfiles = zip.registeredfiles or { } +local resolvers = resolvers -local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders -local locators, hashers, concatinators = resolvers.locators, resolvers.hashers, resolvers.concatinators +zip = zip or { } +local zip = zip -local archives = zip.archives +zip.archives = zip.archives or { } +local archives = zip.archives + +zip.registeredfiles = zip.registeredfiles or { } +local registeredfiles = zip.registeredfiles local function validzip(str) -- todo: use url splitter if not find(str,"^zip://") then @@ -11002,7 +13131,7 @@ function zip.openarchive(name) else local arch = archives[name] if not arch then - local full = resolvers.find_file(name) or "" + local full = resolvers.findfile(name) or "" arch = (full ~= "" and zip.open(full)) or false archives[name] = arch end @@ -11017,163 +13146,162 @@ function zip.closearchive(name) end end -function locators.zip(specification) -- where is this used? startup zips (untested) - specification = resolvers.splitmethod(specification) - local zipfile = specification.path - local zfile = zip.openarchive(name) -- tricky, could be in to be initialized tree +function resolvers.locators.zip(specification) + local archive = specification.filename + local zipfile = archive and archive ~= "" and zip.openarchive(archive) -- tricky, could be in to be initialized tree if trace_locating then - if zfile then - logs.report("fileio","zip locator, archive '%s' found",specification.original) + if zipfile then + report_zip("locator, archive '%s' found",archive) else - logs.report("fileio","zip locator, archive '%s' not found",specification.original) + report_zip("locator, archive '%s' not found",archive) end end end -function hashers.zip(tag,name) +function resolvers.hashers.zip(specification) + local archive = specification.filename if trace_locating then - logs.report("fileio","loading zip file '%s' as '%s'",name,tag) + report_zip("loading file '%s'",archive) end - resolvers.usezipfile(format("%s?tree=%s",tag,name)) + resolvers.usezipfile(specification.original) end -function concatinators.zip(tag,path,name) +function resolvers.concatinators.zip(zipfile,path,name) -- ok ? if not path or path == "" then - return format('%s?name=%s',tag,name) + return format('%s?name=%s',zipfile,name) else - return format('%s?name=%s/%s',tag,path,name) + return format('%s?name=%s/%s',zipfile,path,name) end end -function resolvers.isreadable.zip(name) - return true -end - -function finders.zip(specification,filetype) - specification = resolvers.splitmethod(specification) - if specification.path then - local q = url.query(specification.query) - if q.name then - local zfile = zip.openarchive(specification.path) +function resolvers.finders.zip(specification) + local original = specification.original + local archive = specification.filename + if archive then + local query = url.query(specification.query) + local queryname = query.name + if queryname then + local zfile = zip.openarchive(archive) if zfile then if trace_locating then - logs.report("fileio","zip finder, archive '%s' found",specification.path) + report_zip("finder, archive '%s' found",archive) end - local dfile = zfile:open(q.name) + local dfile = zfile:open(queryname) if dfile then dfile = zfile:close() if trace_locating then - logs.report("fileio","zip finder, file '%s' found",q.name) + report_zip("finder, file '%s' found",queryname) end return specification.original elseif trace_locating then - logs.report("fileio","zip finder, file '%s' not found",q.name) + report_zip("finder, file '%s' not found",queryname) end elseif trace_locating then - logs.report("fileio","zip finder, unknown archive '%s'",specification.path) + report_zip("finder, unknown archive '%s'",archive) end end end if trace_locating then - logs.report("fileio","zip finder, '%s' not found",filename) + report_zip("finder, '%s' not found",original) end - return unpack(finders.notfound) + return resolvers.finders.notfound() end -function openers.zip(specification) - local zipspecification = resolvers.splitmethod(specification) - if zipspecification.path then - local q = url.query(zipspecification.query) - if q.name then - local zfile = zip.openarchive(zipspecification.path) +function resolvers.openers.zip(specification) + local original = specification.original + local archive = specification.filename + if archive then + local query = url.query(specification.query) + local queryname = query.name + if queryname then + local zfile = zip.openarchive(archive) if zfile then if trace_locating then - logs.report("fileio","zip opener, archive '%s' opened",zipspecification.path) + report_zip("opener, archive '%s' opened",archive) end - local dfile = zfile:open(q.name) + local dfile = zfile:open(queryname) if dfile then - logs.show_open(specification) if trace_locating then - logs.report("fileio","zip opener, file '%s' found",q.name) + report_zip("opener, file '%s' found",queryname) end - return openers.text_opener(specification,dfile,'zip') + return resolvers.openers.helpers.textopener('zip',original,dfile) elseif trace_locating then - logs.report("fileio","zip opener, file '%s' not found",q.name) + report_zip("opener, file '%s' not found",queryname) end elseif trace_locating then - logs.report("fileio","zip opener, unknown archive '%s'",zipspecification.path) + report_zip("opener, unknown archive '%s'",archive) end end end if trace_locating then - logs.report("fileio","zip opener, '%s' not found",filename) + report_zip("opener, '%s' not found",original) end - return unpack(openers.notfound) + return resolvers.openers.notfound() end -function loaders.zip(specification) - specification = resolvers.splitmethod(specification) - if specification.path then - local q = url.query(specification.query) - if q.name then - local zfile = zip.openarchive(specification.path) +function resolvers.loaders.zip(specification) + local original = specification.original + local archive = specification.filename + if archive then + local query = url.query(specification.query) + local queryname = query.name + if queryname then + local zfile = zip.openarchive(archive) if zfile then if trace_locating then - logs.report("fileio","zip loader, archive '%s' opened",specification.path) + report_zip("loader, archive '%s' opened",archive) end - local dfile = zfile:open(q.name) + local dfile = zfile:open(queryname) if dfile then - logs.show_load(filename) + logs.show_load(original) if trace_locating then - logs.report("fileio","zip loader, file '%s' loaded",filename) + report_zip("loader, file '%s' loaded",original) end local s = dfile:read("*all") dfile:close() return true, s, #s elseif trace_locating then - logs.report("fileio","zip loader, file '%s' not found",q.name) + report_zip("loader, file '%s' not found",queryname) end elseif trace_locating then - logs.report("fileio","zip loader, unknown archive '%s'",specification.path) + report_zip("loader, unknown archive '%s'",archive) end end end if trace_locating then - logs.report("fileio","zip loader, '%s' not found",filename) + report_zip("loader, '%s' not found",original) end - return unpack(openers.notfound) + return resolvers.openers.notfound() end -- zip:///somefile.zip -- zip:///somefile.zip?tree=texmf-local -> mount -function resolvers.usezipfile(zipname) - zipname = validzip(zipname) - local specification = resolvers.splitmethod(zipname) - local zipfile = specification.path - if zipfile and not zip.registeredfiles[zipname] then - local tree = url.query(specification.query).tree or "" - local z = zip.openarchive(zipfile) +function resolvers.usezipfile(archive) + local specification = resolvers.splitmethod(archive) -- to be sure + local archive = specification.filename + if archive and not registeredfiles[archive] then + local z = zip.openarchive(archive) if z then - local instance = resolvers.instance + local tree = url.query(specification.query).tree or "" if trace_locating then - logs.report("fileio","zip registering, registering archive '%s'",zipname) - end - statistics.starttiming(instance) - resolvers.prepend_hash('zip',zipname,zipfile) - resolvers.extend_texmf_var(zipname) -- resets hashes too - zip.registeredfiles[zipname] = z - instance.files[zipname] = resolvers.register_zip_file(z,tree or "") - statistics.stoptiming(instance) + report_zip("registering, registering archive '%s'",archive) + end + statistics.starttiming(resolvers.instance) + resolvers.prependhash('zip',archive) + resolvers.extendtexmfvariable(archive) -- resets hashes too + registeredfiles[archive] = z + instance.files[archive] = resolvers.registerzipfile(z,tree) + statistics.stoptiming(resolvers.instance) elseif trace_locating then - logs.report("fileio","zip registering, unknown archive '%s'",zipname) + report_zip("registering, unknown archive '%s'",archive) end elseif trace_locating then - logs.report("fileio","zip registering, '%s' not found",zipname) + report_zip("registering, '%s' not found",archive) end end -function resolvers.register_zip_file(z,tree) +function resolvers.registerzipfile(z,tree) local files, filter = { }, "" if tree == "" then filter = "^(.+)/(.-)$" @@ -11181,9 +13309,9 @@ function resolvers.register_zip_file(z,tree) filter = format("^%s/(.+)/(.-)$",tree) end if trace_locating then - logs.report("fileio","zip registering, using filter '%s'",filter) + report_zip("registering, using filter '%s'",filter) end - local register, n = resolvers.register_file, 0 + local register, n = resolvers.registerfile, 0 for i in z:files() do local path, name = match(i.filename,filter) if path then @@ -11198,11 +13326,89 @@ function resolvers.register_zip_file(z,tree) n = n + 1 end end - logs.report("fileio","zip registering, %s files registered",n) + report_zip("registering, %s files registered",n) return files end +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-tre'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- \input tree://oeps1/**/oeps.tex + +local find, gsub, format = string.find, string.gsub, string.format + +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) + +local report_trees = logs.reporter("resolvers","trees") + +local resolvers = resolvers + +local done, found, notfound = { }, { }, resolvers.finders.notfound + +function resolvers.finders.tree(specification) + local spec = specification.filename + local fnd = found[spec] + if fnd == nil then + if spec ~= "" then + local path, name = file.dirname(spec), file.basename(spec) + if path == "" then path = "." end + local hash = done[path] + if not hash then + local pattern = path .. "/*" -- we will use the proper splitter + hash = dir.glob(pattern) + done[path] = hash + end + local pattern = "/" .. gsub(name,"([%.%-%+])", "%%%1") .. "$" + for k=1,#hash do + local v = hash[k] + if find(v,pattern) then + found[spec] = v + return v + end + end + end + fnd = notfound() -- false + found[spec] = fnd + end + return fnd +end + +function resolvers.locators.tree(specification) + local name = specification.filename + if name ~= '' and lfs.isdir(name) then + if trace_locating then + report_trees("locator '%s' found",name) + end + resolvers.appendhash('tree',name,false) -- don't cache + elseif trace_locating then + report_trees("locator '%s' not found",name) + end +end + +function resolvers.hashers.tree(specification) + local name = specification.filename + if trace_locating then + report_trees("analysing '%s'",name) + end + resolvers.methodhandler("hashers",name) +end + +resolvers.concatinators.tree = resolvers.concatinators.file +resolvers.generators.tree = resolvers.generators.file +resolvers.openers.tree = resolvers.openers.file +resolvers.loaders.tree = resolvers.loaders.file + + end -- of closure do -- create closure to overcome 200 locals limit @@ -11215,58 +13421,59 @@ if not modules then modules = { } end modules ['data-crl'] = { license = "see context related readme files" } -local gsub = string.gsub +-- this one is replaced by data-sch.lua -- -curl = curl or { } +local gsub = string.gsub -curl.cached = { } -curl.cachepath = caches.definepath("curl") +local resolvers = resolvers local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders -function curl.fetch(protocol, name) - local cachename = curl.cachepath() .. "/" .. gsub(name,"[^%a%d%.]+","-") --- cachename = gsub(cachename,"[\\/]", io.fileseparator) - cachename = gsub(cachename,"[\\]", "/") -- cleanup - if not curl.cached[name] then +resolvers.curl = resolvers.curl or { } +local curl = resolvers.curl + +local cached = { } + +local function runcurl(specification) + local original = specification.original + -- local scheme = specification.scheme + local cleanname = gsub(original,"[^%a%d%.]+","-") + local cachename = caches.setfirstwritablefile(cleanname,"curl") + if not cached[original] then if not io.exists(cachename) then - curl.cached[name] = cachename - local command = "curl --silent --create-dirs --output " .. cachename .. " " .. name -- no protocol .. "://" + cached[original] = cachename + local command = "curl --silent --create-dirs --output " .. cachename .. " " .. original os.spawn(command) end if io.exists(cachename) then - curl.cached[name] = cachename + cached[original] = cachename else - curl.cached[name] = "" + cached[original] = "" end end - return curl.cached[name] -end - -function finders.curl(protocol,filename) - local foundname = curl.fetch(protocol, filename) - return finders.generic(protocol,foundname,filetype) + return cached[original] end -function openers.curl(protocol,filename) - return openers.generic(protocol,filename) -end +-- old code: we could be cleaner using specification (see schemes) -function loaders.curl(protocol,filename) - return loaders.generic(protocol,filename) +local function finder(specification,filetype) + return resolvers.methodhandler("finders",runcurl(specification),filetype) end --- todo: metamethod +local opener = openers.file +local loader = loaders.file -function curl.install(protocol) - finders[protocol] = function (filename,filetype) return finders.curl(protocol,filename) end - openers[protocol] = function (filename) return openers.curl(protocol,filename) end - loaders[protocol] = function (filename) return loaders.curl(protocol,filename) end +local function install(scheme) + finders[scheme] = finder + openers[scheme] = opener + loaders[scheme] = loader end -curl.install('http') -curl.install('https') -curl.install('ftp') +resolvers.curl.install = install + +install('http') +install('https') +install('ftp') end -- of closure @@ -11287,9 +13494,13 @@ if not modules then modules = { } end modules ['data-lua'] = { local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local report_libraries = logs.reporter("resolvers","libraries") + local gsub, insert = string.gsub, table.insert local unpack = unpack or table.unpack +local resolvers, package = resolvers, package + local libformats = { 'luatexlibs', 'tex', 'texmfscripts', 'othertextfiles' } -- 'luainputs' local clibformats = { 'lib' } @@ -11298,7 +13509,7 @@ local _path_, libpaths, _cpath_, clibpaths function package.libpaths() if not _path_ or package.path ~= _path_ then _path_ = package.path - libpaths = file.split_path(_path_,";") + libpaths = file.splitpath(_path_,";") end return libpaths end @@ -11306,7 +13517,7 @@ end function package.clibpaths() if not _cpath_ or package.cpath ~= _cpath_ then _cpath_ = package.cpath - clibpaths = file.split_path(_cpath_,";") + clibpaths = file.splitpath(_cpath_,";") end return clibpaths end @@ -11315,18 +13526,18 @@ local function thepath(...) local t = { ... } t[#t+1] = "?.lua" local path = file.join(unpack(t)) if trace_locating then - logs.report("fileio","! appending '%s' to 'package.path'",path) + report_libraries("! appending '%s' to 'package.path'",path) end return path end local p_libpaths, a_libpaths = { }, { } -function package.append_libpath(...) +function package.appendtolibpath(...) insert(a_libpath,thepath(...)) end -function package.prepend_libpath(...) +function package.prependtolibpath(...) insert(p_libpaths,1,thepath(...)) end @@ -11337,31 +13548,30 @@ local function loaded(libpaths,name,simple) local libpath = libpaths[i] local resolved = gsub(libpath,"%?",simple) if trace_locating then -- more detail - logs.report("fileio","! checking for '%s' on 'package.path': '%s' => '%s'",simple,libpath,resolved) + report_libraries("! checking for '%s' on 'package.path': '%s' => '%s'",simple,libpath,resolved) end - if resolvers.isreadable.file(resolved) then + if file.is_readable(resolved) then if trace_locating then - logs.report("fileio","! lib '%s' located via 'package.path': '%s'",name,resolved) + report_libraries("! lib '%s' located via 'package.path': '%s'",name,resolved) end return loadfile(resolved) end end end - package.loaders[2] = function(name) -- was [#package.loaders+1] if trace_locating then -- mode detail - logs.report("fileio","! locating '%s'",name) + report_libraries("! locating '%s'",name) end for i=1,#libformats do local format = libformats[i] - local resolved = resolvers.find_file(name,format) or "" + local resolved = resolvers.findfile(name,format) or "" if trace_locating then -- mode detail - logs.report("fileio","! checking for '%s' using 'libformat path': '%s'",name,format) + report_libraries("! checking for '%s' using 'libformat path': '%s'",name,format) end if resolved ~= "" then if trace_locating then - logs.report("fileio","! lib '%s' located via environment: '%s'",name,resolved) + report_libraries("! lib '%s' located via environment: '%s'",name,resolved) end return loadfile(resolved) end @@ -11379,16 +13589,16 @@ package.loaders[2] = function(name) -- was [#package.loaders+1] for i=1,#clibformats do -- better have a dedicated loop local format = clibformats[i] - local paths = resolvers.expanded_path_list_from_var(format) + local paths = resolvers.expandedpathlistfromvariable(format) for p=1,#paths do local path = paths[p] local resolved = file.join(path,libname) if trace_locating then -- mode detail - logs.report("fileio","! checking for '%s' using 'clibformat path': '%s'",libname,path) + report_libraries("! checking for '%s' using 'clibformat path': '%s'",libname,path) end - if resolvers.isreadable.file(resolved) then + if file.is_readable(resolved) then if trace_locating then - logs.report("fileio","! lib '%s' located via 'clibformat': '%s'",libname,resolved) + report_libraries("! lib '%s' located via 'clibformat': '%s'",libname,resolved) end return package.loadlib(resolved,name) end @@ -11398,140 +13608,43 @@ package.loaders[2] = function(name) -- was [#package.loaders+1] local libpath = clibpaths[i] local resolved = gsub(libpath,"?",simple) if trace_locating then -- more detail - logs.report("fileio","! checking for '%s' on 'package.cpath': '%s'",simple,libpath) + report_libraries("! checking for '%s' on 'package.cpath': '%s'",simple,libpath) end - if resolvers.isreadable.file(resolved) then + if file.is_readable(resolved) then if trace_locating then - logs.report("fileio","! lib '%s' located via 'package.cpath': '%s'",name,resolved) + report_libraries("! lib '%s' located via 'package.cpath': '%s'",name,resolved) end return package.loadlib(resolved,name) end end -- just in case the distribution is messed up if trace_loading then -- more detail - logs.report("fileio","! checking for '%s' using 'luatexlibs': '%s'",name) + report_libraries("! checking for '%s' using 'luatexlibs': '%s'",name) end - local resolved = resolvers.find_file(file.basename(name),'luatexlibs') or "" + local resolved = resolvers.findfile(file.basename(name),'luatexlibs') or "" if resolved ~= "" then if trace_locating then - logs.report("fileio","! lib '%s' located by basename via environment: '%s'",name,resolved) + report_libraries("! lib '%s' located by basename via environment: '%s'",name,resolved) end return loadfile(resolved) end if trace_locating then - logs.report("fileio",'? unable to locate lib: %s',name) + report_libraries('? unable to locate lib: %s',name) end -- return "unable to locate " .. name end resolvers.loadlualib = require +-- -- -- -- -end -- of closure - -do -- create closure to overcome 200 locals limit - -if not modules then modules = { } end modules ['luat-kps'] = { - version = 1.001, - comment = "companion to luatools.lua", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - ---[[ldx-- -

This file is used when we want the input handlers to behave like -kpsewhich. What to do with the following:

- - -{$SELFAUTOLOC,$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c} -$SELFAUTOLOC : /usr/tex/bin/platform -$SELFAUTODIR : /usr/tex/bin -$SELFAUTOPARENT : /usr/tex - - -

How about just forgetting about them?

---ldx]]-- - -local suffixes = resolvers.suffixes -local formats = resolvers.formats - -suffixes['gf'] = { 'gf' } -suffixes['pk'] = { 'pk' } -suffixes['base'] = { 'base' } -suffixes['bib'] = { 'bib' } -suffixes['bst'] = { 'bst' } -suffixes['cnf'] = { 'cnf' } -suffixes['mem'] = { 'mem' } -suffixes['mf'] = { 'mf' } -suffixes['mfpool'] = { 'pool' } -suffixes['mft'] = { 'mft' } -suffixes['mppool'] = { 'pool' } -suffixes['graphic/figure'] = { 'eps', 'epsi' } -suffixes['texpool'] = { 'pool' } -suffixes['PostScript header'] = { 'pro' } -suffixes['ist'] = { 'ist' } -suffixes['web'] = { 'web', 'ch' } -suffixes['cweb'] = { 'w', 'web', 'ch' } -suffixes['cmap files'] = { 'cmap' } -suffixes['lig files'] = { 'lig' } -suffixes['bitmap font'] = { } -suffixes['MetaPost support'] = { } -suffixes['TeX system documentation'] = { } -suffixes['TeX system sources'] = { } -suffixes['dvips config'] = { } -suffixes['type42 fonts'] = { } -suffixes['web2c files'] = { } -suffixes['other text files'] = { } -suffixes['other binary files'] = { } -suffixes['opentype fonts'] = { 'otf' } - -suffixes['fmt'] = { 'fmt' } -suffixes['texmfscripts'] = { 'rb','lua','py','pl' } - -suffixes['pdftex config'] = { } -suffixes['Troff fonts'] = { } - -suffixes['ls-R'] = { } +package.obsolete = package.obsolete or { } ---[[ldx-- -

If you wondered abou tsome of the previous mappings, how about -the next bunch:

---ldx]]-- +package.append_libpath = appendtolibpath -- will become obsolete +package.prepend_libpath = prependtolibpath -- will become obsolete -formats['bib'] = '' -formats['bst'] = '' -formats['mft'] = '' -formats['ist'] = '' -formats['web'] = '' -formats['cweb'] = '' -formats['MetaPost support'] = '' -formats['TeX system documentation'] = '' -formats['TeX system sources'] = '' -formats['Troff fonts'] = '' -formats['dvips config'] = '' -formats['graphic/figure'] = '' -formats['ls-R'] = '' -formats['other text files'] = '' -formats['other binary files'] = '' - -formats['gf'] = '' -formats['pk'] = '' -formats['base'] = 'MFBASES' -formats['cnf'] = '' -formats['mem'] = 'MPMEMS' -formats['mf'] = 'MFINPUTS' -formats['mfpool'] = 'MFPOOL' -formats['mppool'] = 'MPPOOL' -formats['texpool'] = 'TEXPOOL' -formats['PostScript header'] = 'TEXPSHEADERS' -formats['cmap files'] = 'CMAPFONTS' -formats['type42 fonts'] = 'T42FONTS' -formats['web2c files'] = 'WEB2C' -formats['pdftex config'] = 'PDFTEXCONFIG' -formats['texmfscripts'] = 'TEXMFSCRIPTS' -formats['bitmap font'] = '' -formats['lig files'] = 'LIGFONTS' +package.obsolete.append_libpath = appendtolibpath -- will become obsolete +package.obsolete.prepend_libpath = prependtolibpath -- will become obsolete end -- of closure @@ -11547,49 +13660,54 @@ if not modules then modules = { } end modules ['data-aux'] = { } local find = string.find +local type, next = type, next local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) -function resolvers.update_script(oldname,newname) -- oldname -> own.name, not per se a suffix +local resolvers = resolvers + +local report_scripts = logs.reporter("resolvers","scripts") + +function resolvers.updatescript(oldname,newname) -- oldname -> own.name, not per se a suffix local scriptpath = "scripts/context/lua" newname = file.addsuffix(newname,"lua") - local oldscript = resolvers.clean_path(oldname) + local oldscript = resolvers.cleanpath(oldname) if trace_locating then - logs.report("fileio","to be replaced old script %s", oldscript) + report_scripts("to be replaced old script %s", oldscript) end - local newscripts = resolvers.find_files(newname) or { } + local newscripts = resolvers.findfiles(newname) or { } if #newscripts == 0 then if trace_locating then - logs.report("fileio","unable to locate new script") + report_scripts("unable to locate new script") end else for i=1,#newscripts do - local newscript = resolvers.clean_path(newscripts[i]) + local newscript = resolvers.cleanpath(newscripts[i]) if trace_locating then - logs.report("fileio","checking new script %s", newscript) + report_scripts("checking new script %s", newscript) end if oldscript == newscript then if trace_locating then - logs.report("fileio","old and new script are the same") + report_scripts("old and new script are the same") end elseif not find(newscript,scriptpath) then if trace_locating then - logs.report("fileio","new script should come from %s",scriptpath) + report_scripts("new script should come from %s",scriptpath) end elseif not (find(oldscript,file.removesuffix(newname).."$") or find(oldscript,newname.."$")) then if trace_locating then - logs.report("fileio","invalid new script name") + report_scripts("invalid new script name") end else local newdata = io.loaddata(newscript) if newdata then if trace_locating then - logs.report("fileio","old script content replaced by new content") + report_scripts("old script content replaced by new content") end io.savedata(oldscript,newdata) break elseif trace_locating then - logs.report("fileio","unable to load new script") + report_scripts("unable to load new script") end end end @@ -11609,72 +13727,133 @@ if not modules then modules = { } end modules ['data-tmf'] = { license = "see context related readme files" } -local find, gsub, match = string.find, string.gsub, string.match -local getenv, setenv = os.getenv, os.setenv +local resolvers = resolvers --- loads *.tmf files in minimal tree roots (to be optimized and documented) +local report_tds = logs.reporter("resolvers","tds") -function resolvers.check_environment(tree) - logs.simpleline() - setenv('TMP', getenv('TMP') or getenv('TEMP') or getenv('TMPDIR') or getenv('HOME')) - setenv('TEXOS', getenv('TEXOS') or ("texmf-" .. os.platform)) - setenv('TEXPATH', gsub(tree or "tex","\/+$",'')) - setenv('TEXMFOS', getenv('TEXPATH') .. "/" .. getenv('TEXOS')) - logs.simpleline() - logs.simple("preset : TEXPATH => %s", getenv('TEXPATH')) - logs.simple("preset : TEXOS => %s", getenv('TEXOS')) - logs.simple("preset : TEXMFOS => %s", getenv('TEXMFOS')) - logs.simple("preset : TMP => %s", getenv('TMP')) - logs.simple('') -end +-- = << +-- ? ?? +-- < += +-- > =+ -function resolvers.load_environment(name) -- todo: key=value as well as lua - local f = io.open(name) - if f then - for line in f:lines() do - if find(line,"^[%%%#]") then - -- skip comment - else - local key, how, value = match(line,"^(.-)%s*([<=>%?]+)%s*(.*)%s*$") - if how then - value = gsub(value,"%%(.-)%%", function(v) return getenv(v) or "" end) - if how == "=" or how == "<<" then - setenv(key,value) - elseif how == "?" or how == "??" then - setenv(key,getenv(key) or value) - elseif how == "<" or how == "+=" then - if getenv(key) then - setenv(key,getenv(key) .. io.fileseparator .. value) - else - setenv(key,value) - end - elseif how == ">" or how == "=+" then - if getenv(key) then - setenv(key,value .. io.pathseparator .. getenv(key)) - else - setenv(key,value) - end - end - end - end +function resolvers.load_tree(tree,resolve) + if type(tree) == "string" and tree ~= "" then + + local getenv, setenv = resolvers.getenv, resolvers.setenv + + -- later might listen to the raw osenv var as well + local texos = "texmf-" .. os.platform + + local oldroot = environment.texroot + local newroot = file.collapsepath(tree) + + local newtree = file.join(newroot,texos) + local newpath = file.join(newtree,"bin") + + if not lfs.isdir(newtree) then + report_tds("no '%s' under tree %s",texos,tree) + os.exit() end - f:close() + if not lfs.isdir(newpath) then + report_tds("no '%s/bin' under tree %s",texos,tree) + os.exit() + end + + local texmfos = newtree + + environment.texroot = newroot + environment.texos = texos + environment.texmfos = texmfos + + -- Beware, we need to obey the relocatable autoparent so we + -- set TEXMFCNF to its raw value. This is somewhat tricky when + -- we run a mkii job from within. Therefore, in mtxrun, there + -- is a resolve applied when we're in mkii/kpse mode. + + setenv('SELFAUTOPARENT', newroot) + setenv('SELFAUTODIR', newtree) + setenv('SELFAUTOLOC', newpath) + setenv('TEXROOT', newroot) + setenv('TEXOS', texos) + setenv('TEXMFOS', texmfos) + setenv('TEXMFCNF', resolvers.luacnfspec, not resolve) + setenv("PATH", newpath .. io.pathseparator .. getenv("PATH")) + + report_tds("changing from root '%s' to '%s'",oldroot,newroot) + report_tds("prepending '%s' to binary path",newpath) + report_tds() end end -function resolvers.load_tree(tree) - if tree and tree ~= "" then - local setuptex = 'setuptex.tmf' - if lfs.attributes(tree, "mode") == "directory" then -- check if not nil - setuptex = tree .. "/" .. setuptex - else - setuptex = tree + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['data-lst'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- used in mtxrun, can be loaded later .. todo + +local find, concat, upper, format = string.find, table.concat, string.upper, string.format + +resolvers.listers = resolvers.listers or { } + +local resolvers = resolvers + +local report_lists = logs.reporter("resolvers","lists") + +local function tabstr(str) + if type(str) == 'table' then + return concat(str," | ") + else + return str + end +end + +function resolvers.listers.variables(pattern) + local instance = resolvers.instance + local environment = instance.environment + local variables = instance.variables + local expansions = instance.expansions + local pattern = upper(pattern or "") + local configured = { } + local order = instance.order + for i=1,#order do + for k, v in next, order[i] do + if v ~= nil and configured[k] == nil then + configured[k] = v + end end - if io.exists(setuptex) then - resolvers.check_environment(tree) - resolvers.load_environment(setuptex) + end + local env = table.fastcopy(environment) + local var = table.fastcopy(variables) + local exp = table.fastcopy(expansions) + for key, value in table.sortedpairs(configured) do + if key ~= "" and (pattern == "" or find(upper(key),pattern)) then + report_lists(key) + report_lists(" env: %s",tabstr(rawget(environment,key)) or "unset") + report_lists(" var: %s",tabstr(configured[key]) or "unset") + report_lists(" exp: %s",tabstr(expansions[key]) or "unset") + report_lists(" res: %s",resolvers.resolve(expansions[key]) or "unset") end end + instance.environment = table.fastcopy(env) + instance.variables = table.fastcopy(var) + instance.expansions = table.fastcopy(exp) +end + +function resolvers.listers.configurations(report) + local configurations = resolvers.instance.specification + local report = report or texio.write_nl + for i=1,#configurations do + report(resolvers.resolve(configurations[i])) + end end @@ -11691,12 +13870,18 @@ if not modules then modules = { } end modules ['luat-sta'] = { -- this code is used in the updater -local gmatch, match = string.gmatch, string.match -local type = type +local gmatch, match = string.gmatch, string.match +local type = type + +states = states or { } +local states = states + +states.data = states.data or { } +local data = states.data + +states.hash = states.hash or { } +local hash = states.hash -states = states or { } -states.data = states.data or { } -states.hash = states.hash or { } states.tag = states.tag or "" states.filename = states.filename or "" @@ -11706,7 +13891,7 @@ function states.save(filename,tag) io.savedata(filename, "-- generator : luat-sta.lua\n" .. "-- state tag : " .. tag .. "\n\n" .. - table.serialize(states.data[tag or states.tag] or {},true) + table.serialize(data[tag or states.tag] or {},true) ) end @@ -11714,11 +13899,11 @@ function states.load(filename,tag) states.filename = filename states.tag = tag or "whatever" states.filename = file.addsuffix(states.filename,'lus') - states.data[states.tag], states.hash[states.tag] = (io.exists(filename) and dofile(filename)) or { }, { } + data[states.tag], hash[states.tag] = (io.exists(filename) and dofile(filename)) or { }, { } end -function states.set_by_tag(tag,key,value,default,persistent) - local d, h = states.data[tag], states.hash[tag] +local function set_by_tag(tag,key,value,default,persistent) + local d, h = data[tag], hash[tag] if d then if type(d) == "table" then local dkey, hkey = key, key @@ -11738,8 +13923,10 @@ function states.set_by_tag(tag,key,value,default,persistent) end dkey, hkey = post, key end - if type(value) == nil then - value = value or default + if value == nil then + value = default + elseif value == false then + -- special case elseif persistent then value = value or d[dkey] or default else @@ -11748,144 +13935,202 @@ function states.set_by_tag(tag,key,value,default,persistent) d[dkey], h[hkey] = value, value elseif type(d) == "string" then -- weird - states.data[tag], states.hash[tag] = value, value + data[tag], hash[tag] = value, value end end end -function states.get_by_tag(tag,key,default) - local h = states.hash[tag] +local function get_by_tag(tag,key,default) + local h = hash[tag] if h and h[key] then return h[key] else - local d = states.data[tag] + local d = data[tag] if d then for k in gmatch(key,"[^%.]+") do local dk = d[k] - if dk then + if dk ~= nil then d = dk else return default end end - return d or default + if d == false then + return false + else + return d or default + end end end end +states.set_by_tag = set_by_tag +states.get_by_tag = get_by_tag + function states.set(key,value,default,persistent) - states.set_by_tag(states.tag,key,value,default,persistent) + set_by_tag(states.tag,key,value,default,persistent) end function states.get(key,default) - return states.get_by_tag(states.tag,key,default) -end - ---~ states.data.update = { ---~ ["version"] = { ---~ ["major"] = 0, ---~ ["minor"] = 1, ---~ }, ---~ ["rsync"] = { ---~ ["server"] = "contextgarden.net", ---~ ["module"] = "minimals", ---~ ["repository"] = "current", ---~ ["flags"] = "-rpztlv --stats", ---~ }, ---~ ["tasks"] = { ---~ ["update"] = true, ---~ ["make"] = true, ---~ ["delete"] = false, ---~ }, ---~ ["platform"] = { ---~ ["host"] = true, ---~ ["other"] = { ---~ ["mswin"] = false, ---~ ["linux"] = false, ---~ ["linux-64"] = false, ---~ ["osx-intel"] = false, ---~ ["osx-ppc"] = false, ---~ ["sun"] = false, ---~ }, ---~ }, ---~ ["context"] = { ---~ ["available"] = {"current", "beta", "alpha", "experimental"}, ---~ ["selected"] = "current", ---~ }, ---~ ["formats"] = { ---~ ["cont-en"] = true, ---~ ["cont-nl"] = true, ---~ ["cont-de"] = false, ---~ ["cont-cz"] = false, ---~ ["cont-fr"] = false, ---~ ["cont-ro"] = false, ---~ }, ---~ ["engine"] = { ---~ ["pdftex"] = { ---~ ["install"] = true, ---~ ["formats"] = { ---~ ["pdftex"] = true, ---~ }, ---~ }, ---~ ["luatex"] = { ---~ ["install"] = true, ---~ ["formats"] = { ---~ }, ---~ }, ---~ ["xetex"] = { ---~ ["install"] = true, ---~ ["formats"] = { ---~ ["xetex"] = false, ---~ }, ---~ }, ---~ ["metapost"] = { ---~ ["install"] = true, ---~ ["formats"] = { ---~ ["mpost"] = true, ---~ ["metafun"] = true, ---~ }, ---~ }, ---~ }, ---~ ["fonts"] = { ---~ }, ---~ ["doc"] = { ---~ }, ---~ ["modules"] = { ---~ ["f-urwgaramond"] = false, ---~ ["f-urwgothic"] = false, ---~ ["t-bnf"] = false, ---~ ["t-chromato"] = false, ---~ ["t-cmscbf"] = false, ---~ ["t-cmttbf"] = false, ---~ ["t-construction-plan"] = false, ---~ ["t-degrade"] = false, ---~ ["t-french"] = false, ---~ ["t-lettrine"] = false, ---~ ["t-lilypond"] = false, ---~ ["t-mathsets"] = false, ---~ ["t-tikz"] = false, ---~ ["t-typearea"] = false, ---~ ["t-vim"] = false, ---~ }, ---~ } - ---~ states.save("teststate", "update") ---~ states.load("teststate", "update") - ---~ print(states.get_by_tag("update","rsync.server","unknown")) ---~ states.set_by_tag("update","rsync.server","oeps") ---~ print(states.get_by_tag("update","rsync.server","unknown")) ---~ states.save("teststate", "update") ---~ states.load("teststate", "update") ---~ print(states.get_by_tag("update","rsync.server","unknown")) + return get_by_tag(states.tag,key,default) +end + + + + + +end -- of closure + +do -- create closure to overcome 200 locals limit + +if not modules then modules = { } end modules ['luat-fmt'] = { + version = 1.001, + comment = "companion to mtxrun", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + + +local format = string.format + +local report_format = logs.reporter("resolvers","formats") + +-- helper for mtxrun + +local quoted = string.quoted + +local function primaryflags() -- not yet ok + local trackers = environment.argument("trackers") + local directives = environment.argument("directives") + local flags = "" + if trackers and trackers ~= "" then + flags = flags .. "--trackers=" .. quoted(trackers) + end + if directives and directives ~= "" then + flags = flags .. "--directives=" .. quoted(directives) + end + return flags +end + +function environment.make_format(name) + -- change to format path (early as we need expanded paths) + local olddir = lfs.currentdir() + local path = caches.getwritablepath("formats") or "" -- maybe platform + if path ~= "" then + lfs.chdir(path) + end + report_format("format path: %s",lfs.currentdir()) + -- check source file + local texsourcename = file.addsuffix(name,"mkiv") + local fulltexsourcename = resolvers.findfile(texsourcename,"tex") or "" + if fulltexsourcename == "" then + texsourcename = file.addsuffix(name,"tex") + fulltexsourcename = resolvers.findfile(texsourcename,"tex") or "" + end + if fulltexsourcename == "" then + report_format("no tex source file with name: %s (mkiv or tex)",name) + lfs.chdir(olddir) + return + else + report_format("using tex source file: %s",fulltexsourcename) + end + local texsourcepath = dir.expandname(file.dirname(fulltexsourcename)) -- really needed + -- check specification + local specificationname = file.replacesuffix(fulltexsourcename,"lus") + local fullspecificationname = resolvers.findfile(specificationname,"tex") or "" + if fullspecificationname == "" then + specificationname = file.join(texsourcepath,"context.lus") + fullspecificationname = resolvers.findfile(specificationname,"tex") or "" + end + if fullspecificationname == "" then + report_format("unknown stub specification: %s",specificationname) + lfs.chdir(olddir) + return + end + local specificationpath = file.dirname(fullspecificationname) + -- load specification + local usedluastub = nil + local usedlualibs = dofile(fullspecificationname) + if type(usedlualibs) == "string" then + usedluastub = file.join(file.dirname(fullspecificationname),usedlualibs) + elseif type(usedlualibs) == "table" then + report_format("using stub specification: %s",fullspecificationname) + local texbasename = file.basename(name) + local luastubname = file.addsuffix(texbasename,"lua") + local lucstubname = file.addsuffix(texbasename,"luc") + -- pack libraries in stub + report_format("creating initialization file: %s",luastubname) + utilities.merger.selfcreate(usedlualibs,specificationpath,luastubname) + -- compile stub file (does not save that much as we don't use this stub at startup any more) + local strip = resolvers.booleanvariable("LUACSTRIP", true) + if utilities.lua.compile(luastubname,lucstubname) and lfs.isfile(lucstubname) then + report_format("using compiled initialization file: %s",lucstubname) + usedluastub = lucstubname + else + report_format("using uncompiled initialization file: %s",luastubname) + usedluastub = luastubname + end + else + report_format("invalid stub specification: %s",fullspecificationname) + lfs.chdir(olddir) + return + end + -- generate format + local command = format("luatex --ini %s --lua=%s %s %sdump",primaryflags(),quoted(usedluastub),quoted(fulltexsourcename),os.platform == "unix" and "\\\\" or "\\") + report_format("running command: %s\n",command) + os.spawn(command) + -- remove related mem files + local pattern = file.removesuffix(file.basename(usedluastub)).."-*.mem" + -- report_format("removing related mplib format with pattern '%s'", pattern) + local mp = dir.glob(pattern) + if mp then + for i=1,#mp do + local name = mp[i] + report_format("removing related mplib format %s", file.basename(name)) + os.remove(name) + end + end + lfs.chdir(olddir) +end + +function environment.run_format(name,data,more) + -- hm, rather old code here; we can now use the file.whatever functions + if name and name ~= "" then + local barename = file.removesuffix(name) + local fmtname = caches.getfirstreadablefile(file.addsuffix(barename,"fmt"),"formats") + if fmtname == "" then + fmtname = resolvers.findfile(file.addsuffix(barename,"fmt")) or "" + end + fmtname = resolvers.cleanpath(fmtname) + if fmtname == "" then + report_format("no format with name: %s",name) + else + local barename = file.removesuffix(name) -- expanded name + local luaname = file.addsuffix(barename,"luc") + if not lfs.isfile(luaname) then + luaname = file.addsuffix(barename,"lua") + end + if not lfs.isfile(luaname) then + report_format("using format name: %s",fmtname) + report_format("no luc/lua with name: %s",barename) + else + local command = format("luatex %s --fmt=%s --lua=%s %s %s",primaryflags(),quoted(barename),quoted(luaname),quoted(data),more ~= "" and quoted(more) or "") + report_format("running command: %s",command) + os.spawn(command) + end + end + end +end end -- of closure -- end library merge -own = { } -- not local +own = { } -- not local, might change + +own.libs = { -- order can be made better -own.libs = { -- todo: check which ones are really needed 'l-string.lua', 'l-lpeg.lua', 'l-table.lua', @@ -11898,39 +14143,55 @@ own.libs = { -- todo: check which ones are really needed 'l-url.lua', 'l-dir.lua', 'l-boolean.lua', + 'l-unicode.lua', 'l-math.lua', --- 'l-unicode.lua', --- 'l-tex.lua', - 'l-utils.lua', - 'l-aux.lua', --- 'l-xml.lua', - 'trac-tra.lua', + + 'util-tab.lua', + 'util-sto.lua', + 'util-mrg.lua', + 'util-lua.lua', + 'util-prs.lua', + 'util-fmt.lua', + 'util-deb.lua', + + 'trac-inf.lua', + 'trac-set.lua', + 'trac-log.lua', + 'trac-pro.lua', + + 'luat-env.lua', -- can come before inf (as in mkiv) + 'lxml-tab.lua', 'lxml-lpt.lua', --- 'lxml-ent.lua', + -- 'lxml-ent.lua', 'lxml-mis.lua', 'lxml-aux.lua', 'lxml-xml.lua', - 'luat-env.lua', - 'trac-inf.lua', - 'trac-log.lua', - 'data-res.lua', + + 'data-ini.lua', + 'data-exp.lua', + 'data-env.lua', 'data-tmp.lua', + 'data-met.lua', + 'data-res.lua', 'data-pre.lua', 'data-inp.lua', 'data-out.lua', + 'data-fil.lua', 'data-con.lua', 'data-use.lua', -- 'data-tex.lua', -- 'data-bin.lua', 'data-zip.lua', + 'data-tre.lua', 'data-crl.lua', 'data-lua.lua', - 'data-kps.lua', -- so that we can replace kpsewhich 'data-aux.lua', -- updater - 'data-tmf.lua', -- tree files - -- needed ? - 'luat-sta.lua', -- states + 'data-tmf.lua', + 'data-lst.lua', + + 'luat-sta.lua', + 'luat-fmt.lua', } -- We need this hack till luatex is fixed. @@ -11943,35 +14204,62 @@ end -- End of hack. -own.name = (environment and environment.ownname) or arg[0] or 'luatools.lua' +local format, gsub, gmatch, match = string.format, string.gsub, string.gmatch, string.match +local concat = table.concat + +own.name = (environment and environment.ownname) or arg[0] or 'mtxrun.lua' +own.path = gsub(match(own.name,"^(.+)[\\/].-$") or ".","\\","/") + +local ownpath, owntree = own.path, environment and environment.ownpath or own.path + +own.list = { + '.', + ownpath , + ownpath .. "/../sources", -- HH's development path + owntree .. "/../../texmf-local/tex/context/base", + owntree .. "/../../texmf-context/tex/context/base", + owntree .. "/../../texmf-dist/tex/context/base", + owntree .. "/../../texmf/tex/context/base", + owntree .. "/../../../texmf-local/tex/context/base", + owntree .. "/../../../texmf-context/tex/context/base", + owntree .. "/../../../texmf-dist/tex/context/base", + owntree .. "/../../../texmf/tex/context/base", +} +if own.path == "." then table.remove(own.list,1) end -own.path = string.match(own.name,"^(.+)[\\/].-$") or "." -own.list = { '.' } -if own.path ~= '.' then - table.insert(own.list,own.path) +local function locate_libs() + for l=1,#own.libs do + local lib = own.libs[l] + for p =1,#own.list do + local pth = own.list[p] + local filename = pth .. "/" .. lib + local found = lfs.isfile(filename) + if found then + package.path = package.path .. ";" .. pth .. "/?.lua" -- in case l-* does a require + return pth + end + end + end end -table.insert(own.list,own.path.."/../../texmf-dist/tex/context/base") -table.insert(own.list,own.path.."/../../../tex/context/base") -table.insert(own.list,own.path.."/mtx") -table.insert(own.list,own.path.."/../sources") -local function locate_libs() - for _, lib in pairs(own.libs) do - for _, pth in pairs(own.list) do - local filename = string.gsub(pth .. "/" .. lib,"\\","/") +local function load_libs() + local found = locate_libs() + if found then + for l=1,#own.libs do + local filename = found .. "/" .. own.libs[l] local codeblob = loadfile(filename) if codeblob then codeblob() - own.list = { pth } -- speed up te search - break end end + else + resolvers = nil end end if not resolvers then - locate_libs() + load_libs() end if not resolvers then @@ -11983,20 +14271,56 @@ if not resolvers then os.exit() end -logs.setprogram('MTXrun',"TDS Runner Tool 1.24",environment.arguments["verbose"] or false) +-- verbosity -local instance = resolvers.reset() +local e_verbose = environment.arguments["verbose"] + +if e_verbose then + trackers.enable("resolvers.locating") +end + +-- some common flags (also passed through environment) + +local e_silent = environment.argument("silent") +local e_noconsole = environment.argument("noconsole") + +local e_trackers = environment.argument("trackers") +local e_directives = environment.argument("directives") +local e_experiments = environment.argument("experiments") + +if e_silent == true then + e_silent = "*" +end -local trackspec = environment.argument("trackers") or environment.argument("track") +if type(e_silent) == "string" then + if type(e_directives) == "string" then + e_directives = format("%s,logs.blocked={%s}",e_directives,e_silent) + else + e_directives = format("logs.blocked={%s}",e_silent) + end +end -if trackspec then - trackers.enable(trackspec) +if e_noconsole then + if type(e_directives) == "string" then + e_directives = format("%s,logs.target=file",e_directives) + else + e_directives = format("logs.target=file") + end end -runners = runners or { } -- global -messages = messages or { } +if e_trackers then trackers .enable(e_trackers) end +if e_directives then directives .enable(e_directives) end +if e_experiments then experiments.enable(e_experiments) end + +if not environment.trackers then environment.trackers = e_trackers end +if not environment.directives then environment.directives = e_directives end +if not environment.experiments then environment.experiments = e_experiments end + +-- + +local instance = resolvers.reset() -messages.help = [[ +local helpinfo = [[ --script run an mtx script (lua prefered method) (--noquotes), no script gives list --execute run a script or program (texmfstart method) (--noquotes) --resolve resolve prefixed arguments @@ -12011,15 +14335,14 @@ messages.help = [[ --ifchanged=filename only execute when given file has changed (md checksum) --iftouched=old,new only execute when given file has changed (time stamp) ---make create stubs for (context related) scripts ---remove remove stubs (context related) scripts +--makestubs create stubs for (context related) scripts +--removestubs remove stubs (context related) scripts --stubpath=binpath paths where stubs wil be written --windows create windows (mswin) stubs --unix create unix (linux) stubs --verbose give a bit more info --trackers=list enable given trackers ---engine=str target engine --progname=str format or backend --edit launch editor with found file @@ -12032,8 +14355,35 @@ messages.help = [[ --forcekpse force using kpse (handy when no mkiv and cache installed but less functionality) --prefixes show supported prefixes + +--generate generate file database + +--variables show configuration variables +--configurations show configuration order + +--expand-braces expand complex variable +--expand-path expand variable (resolve paths) +--expand-var expand variable (resolve references) +--show-path show path expansion of ... +--var-value report value of variable +--find-file report file location +--find-path report path of file + +--pattern=str filter variables ]] +local application = logs.application { + name = "mtxrun", + banner = "ConTeXt TDS Runner Tool 1.30", + helpinfo = helpinfo, +} + +local report = application.report + +messages = messages or { } -- for the moment + +runners = runners or { } -- global (might become local) + runners.applications = { ["lua"] = "luatex --luaonly", ["luc"] = "luatex --luaonly", @@ -12056,7 +14406,7 @@ runners.registered = { makempy = { 'makempy.pl', true }, mptopdf = { 'mptopdf.pl', true }, pstopdf = { 'pstopdf.rb', true }, -- converts ps (and some more) images, does some cleaning (replaced) --- examplex = { 'examplex.rb', false }, + -- examplex = { 'examplex.rb', false }, concheck = { 'concheck.rb', false }, runtools = { 'runtools.rb', true }, textools = { 'textools.rb', true }, @@ -12065,9 +14415,9 @@ runners.registered = { rlxtools = { 'rlxtools.rb', true }, pdftools = { 'pdftools.rb', true }, mpstools = { 'mpstools.rb', true }, --- exatools = { 'exatools.rb', true }, + -- exatools = { 'exatools.rb', true }, xmltools = { 'xmltools.rb', true }, --- luatools = { 'luatools.lua', true }, + -- luatools = { 'luatools.lua', true }, mtxtools = { 'mtxtools.rb', true }, pdftrimwhite = { 'pdftrimwhite.pl', false } } @@ -12086,45 +14436,39 @@ end function runners.prepare() local checkname = environment.argument("ifchanged") - if checkname and checkname ~= "" then + if type(checkname) == "string" and checkname ~= "" then local oldchecksum = file.loadchecksum(checkname) local newchecksum = file.checksum(checkname) if oldchecksum == newchecksum then - logs.simple("file '%s' is unchanged",checkname) + if e_verbose then + report("file '%s' is unchanged",checkname) + end return "skip" - else - logs.simple("file '%s' is changed, processing started",checkname) + elseif e_verbose then + report("file '%s' is changed, processing started",checkname) end file.savechecksum(checkname) end - local oldname, newname = string.split(environment.argument("iftouched") or "", ",") - if oldname and newname and oldname ~= "" and newname ~= "" then - if not file.needs_updating(oldname,newname) then - logs.simple("file '%s' and '%s' have same age",oldname,newname) - return "skip" - else - logs.simple("file '%s' is older than '%s'",oldname,newname) - end - end - local tree = environment.argument('tree') or "" - if environment.argument('autotree') then - tree = os.getenv('TEXMFSTART_TREE') or os.getenv('TEXMFSTARTTREE') or tree - end - if tree and tree ~= "" then - resolvers.load_tree(tree) - end - local env = environment.argument('environment') or "" - if env and env ~= "" then - for _,e in pairs(string.split(env)) do - -- maybe force suffix when not given - resolvers.load_tree(e) + local touchname = environment.argument("iftouched") + if type(touchname) == "string" and touchname ~= "" then + local oldname, newname = string.split(touchname, ",") + if oldname and newname and oldname ~= "" and newname ~= "" then + if not file.needs_updating(oldname,newname) then + if e_verbose then + report("file '%s' and '%s' have same age",oldname,newname) + end + return "skip" + elseif e_verbose then + report("file '%s' is older than '%s'",oldname,newname) + end end end local runpath = environment.argument("path") - if runpath and not lfs.chdir(runpath) then - logs.simple("unable to change to path '%s'",runpath) + if type(runpath) == "string" and not lfs.chdir(runpath) then + report("unable to change to path '%s'",runpath) return "error" end + runners.prepare = function() end return "run" end @@ -12137,8 +14481,6 @@ function runners.execute_script(fullname,internal,nosplit) elseif state == 'skip' then return true elseif state == "run" then - instance.progname = environment.argument("progname") or instance.progname - instance.format = environment.argument("format") or instance.format local path, name, suffix, result = file.dirname(fullname), file.basename(fullname), file.extname(fullname), "" if path ~= "" then result = fullname @@ -12155,21 +14497,21 @@ function runners.execute_script(fullname,internal,nosplit) if suffix == "" then -- loop over known suffixes for _,s in pairs(runners.suffixes) do - result = resolvers.find_file(name .. "." .. s, 'texmfscripts') + result = resolvers.findfile(name .. "." .. s, 'texmfscripts') if result ~= "" then break end end elseif runners.applications[suffix] then - result = resolvers.find_file(name, 'texmfscripts') + result = resolvers.findfile(name, 'texmfscripts') else -- maybe look on path - result = resolvers.find_file(name, 'other text files') + result = resolvers.findfile(name, 'other text files') end end if result and result ~= "" then if not no_split then - local before, after = environment.split_arguments(fullname) -- already done + local before, after = environment.splitarguments(fullname) -- already done environment.arguments_before, environment.arguments_after = before, after end if internal then @@ -12181,12 +14523,12 @@ function runners.execute_script(fullname,internal,nosplit) if binary and binary ~= "" then result = binary .. " " .. result end - local command = result .. " " .. environment.reconstruct_commandline(environment.arguments_after,noquote) - if logs.verbose then - logs.simpleline() - logs.simple("executing: %s",command) - logs.simpleline() - logs.simpleline() + local command = result .. " " .. environment.reconstructcommandline(environment.arguments_after,noquote) + if e_verbose then + report() + report("executing: %s",command) + report() + report() io.flush() end -- no os.exec because otherwise we get the wrong return value @@ -12196,14 +14538,14 @@ function runners.execute_script(fullname,internal,nosplit) else if binary then binary = file.addsuffix(binary,os.binsuffix) - for p in string.gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do + for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do if lfs.isfile(file.join(p,binary)) then return false end end - logs.simpleline() - logs.simple("This script needs '%s' which seems not to be installed.",binary) - logs.simpleline() + report() + report("This script needs '%s' which seems not to be installed.",binary) + report() end return false end @@ -12223,14 +14565,15 @@ function runners.execute_program(fullname) elseif state == 'skip' then return true elseif state == "run" then - local before, after = environment.split_arguments(fullname) - environment.initialize_arguments(after) + local before, after = environment.splitarguments(fullname) + for k=1,#after do after[k] = resolvers.resolve(after[k]) end + environment.initializearguments(after) fullname = fullname:gsub("^bin:","") - local command = fullname .. " " .. (environment.reconstruct_commandline(after or "",noquote) or "") - logs.simpleline() - logs.simple("executing: %s",command) - logs.simpleline() - logs.simpleline() + local command = fullname .. " " .. (environment.reconstructcommandline(after or "",noquote) or "") + report() + report("executing: %s",command) + report() + report() io.flush() local code = os.exec(command) -- (fullname,unpack(after)) does not work / maybe spawn return code == 0 @@ -12239,7 +14582,7 @@ function runners.execute_program(fullname) return false end --- the --usekpse flag will fallback on kpse (hm, we can better update mtx-stubs) +-- the --usekpse flag will fallback (not default) on kpse (hm, we can better update mtx-stubs) local windows_stub = '@echo off\013\010setlocal\013\010set ownpath=%%~dp0%%\013\010texlua "%%ownpath%%mtxrun.lua" --usekpse --execute %s %%*\013\010endlocal\013\010' local unix_stub = '#!/bin/sh\010mtxrun --usekpse --execute %s \"$@\"\010' @@ -12258,22 +14601,22 @@ function runners.handle_stubs(create) for _,v in pairs(runners.registered) do local name, doit = v[1], v[2] if doit then - local base = string.gsub(file.basename(name), "%.(.-)$", "") + local base = gsub(file.basename(name), "%.(.-)$", "") if create then if windows then - io.savedata(file.join(stubpath,base..".bat"),string.format(windows_stub,name)) - logs.simple("windows stub for '%s' created",base) + io.savedata(file.join(stubpath,base..".bat"),format(windows_stub,name)) + report("windows stub for '%s' created",base) end if unix then - io.savedata(file.join(stubpath,base),string.format(unix_stub,name)) - logs.simple("unix stub for '%s' created",base) + io.savedata(file.join(stubpath,base),format(unix_stub,name)) + report("unix stub for '%s' created",base) end else if windows and (os.remove(file.join(stubpath,base..'.bat')) or os.remove(file.join(stubpath,base..'.cmd'))) then - logs.simple("windows stub for '%s' removed", base) + report("windows stub for '%s' removed", base) end if unix and (os.remove(file.join(stubpath,base)) or os.remove(file.join(stubpath,base..'.sh'))) then - logs.simple("unix stub for '%s' removed",base) + report("unix stub for '%s' removed",base) end end end @@ -12289,7 +14632,7 @@ end function runners.locate_file(filename) -- differs from texmfstart where locate appends .com .exe .bat ... todo if filename and filename ~= "" then - runners.report_location(resolvers.find_given_file(filename)) + runners.report_location(resolvers.findgivenfile(filename)) end end @@ -12298,28 +14641,28 @@ function runners.locate_platform() end function runners.report_location(result) - if logs.verbose then - logs.simpleline() + if e_verbose then + reportline() if result and result ~= "" then - logs.simple(result) + report(result) else - logs.simple("not found") + report("not found") end else io.write(result) end end -function runners.edit_script(filename) -- we assume that vim is present on most systems - local editor = os.getenv("MTXRUN_EDITOR") or os.getenv("TEXMFSTART_EDITOR") or os.getenv("EDITOR") or 'vim' +function runners.edit_script(filename) -- we assume that gvim is present on most systems (todo: also in cnf file) + local editor = os.getenv("MTXRUN_EDITOR") or os.getenv("TEXMFSTART_EDITOR") or os.getenv("EDITOR") or 'gvim' local rest = resolvers.resolve(filename) if rest ~= "" then local command = editor .. " " .. rest - if logs.verbose then - logs.simpleline() - logs.simple("starting editor: %s",command) - logs.simple_line() - logs.simple_line() + if e_verbose then + report() + report("starting editor: %s",command) + report() + report() end os.launch(command) end @@ -12362,33 +14705,33 @@ end function runners.launch_file(filename) instance.allresults = true - logs.setverbose(true) + trackers.enable("resolvers.locating") local pattern = environment.arguments["pattern"] if not pattern or pattern == "" then pattern = filename end if not pattern or pattern == "" then - logs.simple("provide name or --pattern=") + report("provide name or --pattern=") else - local t = resolvers.find_files(pattern) + local t = resolvers.findfiles(pattern) if not t or #t == 0 then - t = resolvers.find_files("*/" .. pattern) + t = resolvers.findfiles("*/" .. pattern) end if not t or #t == 0 then - t = resolvers.find_files("*/" .. pattern .. "*") + t = resolvers.findfiles("*/" .. pattern .. "*") end if t and #t > 0 then if environment.arguments["all"] then for _, v in pairs(t) do - logs.simple("launching %s", v) + report("launching %s", v) resolvers.launch(v) end else - logs.simple("launching %s", t[1]) + report("launching %s", t[1]) resolvers.launch(t[1]) end else - logs.simple("no match for %s", pattern) + report("no match for %s", pattern) end end end @@ -12421,33 +14764,45 @@ function runners.find_mtx_script(filename) local mtxprefix = (filename:find("^mtx%-") and "") or "mtx-" -- context namespace, mtx- fullname = mtxprefix .. filename - fullname = found(fullname) or resolvers.find_file(fullname) + fullname = found(fullname) or resolvers.findfile(fullname) if fullname and fullname ~= "" then return fullname end -- context namespace, mtx-s fullname = mtxprefix .. basename .. "s" .. "." .. suffix - fullname = found(fullname) or resolvers.find_file(fullname) + fullname = found(fullname) or resolvers.findfile(fullname) if fullname and fullname ~= "" then return fullname end -- context namespace, mtx- fullname = mtxprefix .. basename:gsub("s$","") .. "." .. suffix - fullname = found(fullname) or resolvers.find_file(fullname) + fullname = found(fullname) or resolvers.findfile(fullname) if fullname and fullname ~= "" then return fullname end -- context namespace, just - fullname = resolvers.find_file(filename) + fullname = resolvers.findfile(filename) return fullname end -function runners.execute_ctx_script(filename) +function runners.register_arguments(...) + local arguments = environment.arguments_after + local passedon = { ... } + for i=#passedon,1,-1 do + local pi = passedon[i] + if pi then + table.insert(arguments,1,pi) + end + end +end + +function runners.execute_ctx_script(filename,...) + runners.register_arguments(...) local arguments = environment.arguments_after local fullname = runners.find_mtx_script(filename) or "" if file.extname(fullname) == "cld" then -- handy in editors where we force --autopdf - logs.simple("running cld script: %s",filename) + report("running cld script: %s",filename) table.insert(arguments,1,fullname) table.insert(arguments,"--autopdf") fullname = runners.find_mtx_script("context") or "" @@ -12455,7 +14810,7 @@ function runners.execute_ctx_script(filename) -- retry after generate but only if --autogenerate if fullname == "" and environment.argument("autogenerate") then -- might become the default instance.renewcache = true - logs.setverbose(true) + trackers.enable("resolvers.locating") resolvers.load() -- fullname = runners.find_mtx_script(filename) or "" @@ -12470,7 +14825,7 @@ function runners.execute_ctx_script(filename) elseif state == "run" then -- load and save ... kind of undocumented arg = { } for _,v in pairs(arguments) do arg[#arg+1] = resolvers.resolve(v) end - environment.initialize_arguments(arg) + environment.initializearguments(arg) local loadname = environment.arguments['load'] if loadname then if type(loadname) ~= "string" then loadname = file.basename(fullname) end @@ -12478,8 +14833,8 @@ function runners.execute_ctx_script(filename) runners.load_script_session(loadname) end filename = environment.files[1] - if logs.verbose then - logs.simple("using script: %s\n",fullname) + if e_verbose then + report("using script: %s\n",fullname) end environment.ownscript = fullname dofile(fullname) @@ -12495,44 +14850,42 @@ function runners.execute_ctx_script(filename) return true end else - -- logs.setverbose(true) if filename == "" or filename == "help" then - local context = resolvers.find_file("mtx-context.lua") - logs.setverbose(true) + local context = resolvers.findfile("mtx-context.lua") + trackers.enable("resolvers.locating") if context ~= "" then - local result = dir.glob((string.gsub(context,"mtx%-context","mtx-*"))) -- () needed + local result = dir.glob((gsub(context,"mtx%-context","mtx-*"))) -- () needed local valid = { } table.sort(result) for i=1,#result do local scriptname = result[i] - local scriptbase = string.match(scriptname,".*mtx%-([^%-]-)%.lua") + local scriptbase = match(scriptname,".*mtx%-([^%-]-)%.lua") if scriptbase then local data = io.loaddata(scriptname) - local banner, version = string.match(data,"[\n\r]logs%.extendbanner%s*%(%s*[\"\']([^\n\r]+)%s*(%d+%.%d+)") + local banner, version = match(data,"[\n\r]logs%.extendbanner%s*%(%s*[\"\']([^\n\r]+)%s*(%d+%.%d+)") if banner then valid[#valid+1] = { scriptbase, version, banner } end end end if #valid > 0 then - logs.reportbanner() - logs.reportline() - logs.simple("no script name given, known scripts:") - logs.simple() + application.identify() + report("no script name given, known scripts:") + report() for k=1,#valid do local v = valid[k] - logs.simple("%-12s %4s %s",v[1],v[2],v[3]) + report("%-12s %4s %s",v[1],v[2],v[3]) end end else - logs.simple("no script name given") + report("no script name given") end else filename = file.addsuffix(filename,"lua") if file.is_qualified_path(filename) then - logs.simple("unknown script '%s'",filename) + report("unknown script '%s'",filename) else - logs.simple("unknown script '%s' or 'mtx-%s'",filename,filename) + report("unknown script '%s' or 'mtx-%s'",filename,filename) end end return false @@ -12540,9 +14893,9 @@ function runners.execute_ctx_script(filename) end function runners.prefixes() - logs.reportbanner() - logs.reportline() - logs.simple(table.concat(resolvers.allprefixes(true)," ")) + application.identify() + report() + report(concat(resolvers.allprefixes(true)," ")) end function runners.timedrun(filename) -- just for me @@ -12562,13 +14915,11 @@ end local filename = environment.files[1] or "" local ok = true -local before, after = environment.split_arguments(filename) +local before, after = environment.splitarguments(filename) environment.arguments_before, environment.arguments_after = before, after -environment.initialize_arguments(before) +environment.initializearguments(before) -instance.engine = environment.argument("engine") or 'luatex' -instance.progname = environment.argument("progname") or 'context' -instance.lsrmode = environment.argument("lsr") or false +instance.lsrmode = environment.argument("lsr") or false -- maybe the unset has to go to this level @@ -12576,36 +14927,40 @@ local is_mkii_stub = runners.registered[file.removesuffix(file.basename(filename if environment.argument("usekpse") or environment.argument("forcekpse") or is_mkii_stub then + resolvers.load_tree(environment.argument('tree'),true) -- force resolve of TEXMFCNF + os.setenv("engine","") os.setenv("progname","") local remapper = { - otf = "opentype fonts", - ttf = "truetype fonts", - ttc = "truetype fonts", - pfb = "type1 fonts", + otf = "opentype fonts", + ttf = "truetype fonts", + ttc = "truetype fonts", + pfb = "type1 fonts", other = "other text files", } + local progname = environment.argument("progname") or 'context' + local function kpse_initialized() texconfig.kpse_init = true local t = os.clock() - local k = kpse.original.new("luatex",instance.progname) + local k = kpse.original.new("luatex",progname) local dummy = k:find_file("mtxrun.lua") -- so that we're initialized - logs.simple("kpse fallback with progname '%s' initialized in %s seconds",instance.progname,os.clock()-t) + report("kpse fallback with progname '%s' initialized in %s seconds",progname,os.clock()-t) kpse_initialized = function() return k end return k end - local find_file = resolvers.find_file - local show_path = resolvers.show_path + local findfile = resolvers.findfile + local showpath = resolvers.showpath if environment.argument("forcekpse") then - function resolvers.find_file(name,kind) - return (kpse_initialized():find_file(resolvers.clean_path(name),(kind ~= "" and (remapper[kind] or kind)) or "tex") or "") or "" + function resolvers.findfile(name,kind) + return (kpse_initialized():find_file(resolvers.cleanpath(name),(kind ~= "" and (remapper[kind] or kind)) or "tex") or "") or "" end - function resolvers.show_path(name) + function resolvers.showpath(name) return (kpse_initialized():show_path(name)) or "" end @@ -12613,16 +14968,16 @@ if environment.argument("usekpse") or environment.argument("forcekpse") or is_mk resolvers.load() - function resolvers.find_file(name,kind) - local found = find_file(name,kind) or "" + function resolvers.findfile(name,kind) + local found = findfile(name,kind) or "" if found ~= "" then return found else - return (kpse_initialized():find_file(resolvers.clean_path(name),(kind ~= "" and (remapper[kind] or kind)) or "tex") or "") or "" + return (kpse_initialized():find_file(resolvers.cleanpath(name),(kind ~= "" and (remapper[kind] or kind)) or "tex") or "") or "" end end - function resolvers.show_path(name) - local found = show_path(name) or "" + function resolvers.showpath(name) + local found = showpath(name) or "" if found ~= "" then return found else @@ -12632,80 +14987,317 @@ if environment.argument("usekpse") or environment.argument("forcekpse") or is_mk end + function runners.loadbase() + end + else - resolvers.load() + function runners.loadbase(...) + if not resolvers.load(...) then + report("forcing cache reload") + instance.renewcache = true + trackers.enable("resolvers.locating") + if not resolvers.load(...) then + report("the resolver databases are not present or outdated") + end + end + end + + resolvers.load_tree(environment.argument('tree')) end + if environment.argument("selfmerge") then + -- embed used libraries - utils.merger.selfmerge(own.name,own.libs,own.list) + + runners.loadbase() + local found = locate_libs() + if found then + utilities.merger.selfmerge(own.name,own.libs,{ found }) + end + elseif environment.argument("selfclean") then + -- remove embedded libraries - utils.merger.selfclean(own.name) + + runners.loadbase() + utilities.merger.selfclean(own.name) + elseif environment.argument("selfupdate") then - logs.setverbose(true) - resolvers.update_script(own.name,"mtxrun") + + runners.loadbase() + trackers.enable("resolvers.locating") + resolvers.updatescript(own.name,"mtxrun") + elseif environment.argument("ctxlua") or environment.argument("internal") then + -- run a script by loading it (using libs) + + runners.loadbase() ok = runners.execute_script(filename,true) + elseif environment.argument("script") or environment.argument("scripts") then + -- run a script by loading it (using libs), pass args + + runners.loadbase() if is_mkii_stub then - -- execute mkii script ok = runners.execute_script(filename,false,true) else ok = runners.execute_ctx_script(filename) end + elseif environment.argument("execute") then + -- execute script + + runners.loadbase() ok = runners.execute_script(filename) + elseif environment.argument("direct") then + -- equals bin: + + runners.loadbase() ok = runners.execute_program(filename) + elseif environment.argument("edit") then + -- edit file + + runners.loadbase() runners.edit_script(filename) + elseif environment.argument("launch") then + + runners.loadbase() runners.launch_file(filename) -elseif environment.argument("make") then - -- make stubs + +elseif environment.argument("makestubs") then + + -- make stubs (depricated) + runners.handle_stubs(true) -elseif environment.argument("remove") then - -- remove stub + +elseif environment.argument("removestubs") then + + -- remove stub (depricated) + + runners.loadbase() runners.handle_stubs(false) + elseif environment.argument("resolve") then + -- resolve string + + runners.loadbase() runners.resolve_string(filename) + elseif environment.argument("locate") then + -- locate file + + runners.loadbase() runners.locate_file(filename) -elseif environment.argument("platform")then + +elseif environment.argument("platform") or environment.argument("show-platform") then + -- locate platform + + runners.loadbase() runners.locate_platform() + elseif environment.argument("prefixes") then + + runners.loadbase() runners.prefixes() + elseif environment.argument("timedrun") then + -- locate platform + + runners.loadbase() runners.timedrun(filename) + +elseif environment.argument("variables") or environment.argument("show-variables") or environment.argument("expansions") or environment.argument("show-expansions") then + + -- luatools: runners.execute_ctx_script("mtx-base","--expansions",filename) + + resolvers.load("nofiles") + resolvers.listers.variables(environment.argument("pattern")) + +elseif environment.argument("configurations") or environment.argument("show-configurations") then + + -- luatools: runners.execute_ctx_script("mtx-base","--configurations",filename) + + resolvers.load("nofiles") + resolvers.listers.configurations() + +elseif environment.argument("find-file") then + + -- luatools: runners.execute_ctx_script("mtx-base","--find-file",filename) + + resolvers.load() + local e_pattern = environment.argument("pattern") + local e_format = environment.arguments("format") + if not e_pattern then + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.findfiles,environment.files,e_format) + elseif type(e_pattern) == "string" then + instance.allresults = true -- brrrr + resolvers.dowithfilesandreport(resolvers.findfiles,{ e_pattern }, e_format) + end + +elseif environment.argument("find-path") then + + -- luatools: runners.execute_ctx_script("mtx-base","--find-path",filename) + + resolvers.load() + local path = resolvers.findpath(filename, instance.my_format) + if e_verbose then + report(path) + else + print(path) + end + +elseif environment.argument("expand-braces") then + + -- luatools: runners.execute_ctx_script("mtx-base","--expand-braces",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.expandbraces, environment.files) + +elseif environment.argument("expand-path") then + + -- luatools: runners.execute_ctx_script("mtx-base","--expand-path",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.expandpath, environment.files) + +elseif environment.argument("expand-var") or environment.argument("expand-variable") then + + -- luatools: runners.execute_ctx_script("mtx-base","--expand-var",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.expansion, environment.files) + +elseif environment.argument("show-path") or environment.argument("path-value") then + + -- luatools: runners.execute_ctx_script("mtx-base","--show-path",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.showpath, environment.files) + +elseif environment.argument("var-value") or environment.argument("show-value") then + + -- luatools: runners.execute_ctx_script("mtx-base","--show-value",filename) + + resolvers.load("nofiles") + runners.register_arguments(filename) + environment.initializearguments(environment.arguments_after) + resolvers.dowithfilesandreport(resolvers.variable,environment.files) + +elseif environment.argument("format-path") then + + -- luatools: runners.execute_ctx_script("mtx-base","--format-path",filename) + + resolvers.load() + report(caches.getwritablepath("format")) + +elseif environment.argument("pattern") then + + -- luatools + + runners.execute_ctx_script("mtx-base","--pattern='" .. environment.argument("pattern") .. "'",filename) + +elseif environment.argument("generate") then + + -- luatools + + instance.renewcache = true + trackers.enable("resolvers.locating") + resolvers.load() + +elseif environment.argument("make") or environment.argument("ini") or environment.argument("compile") then + + -- luatools: runners.execute_ctx_script("mtx-base","--make",filename) + + resolvers.load() + trackers.enable("resolvers.locating") + environment.make_format(filename) + +elseif environment.argument("run") then + + -- luatools + + runners.execute_ctx_script("mtx-base","--run",filename) + +elseif environment.argument("fmt") then + + -- luatools + + runners.execute_ctx_script("mtx-base","--fmt",filename) + +elseif environment.argument("help") and filename=='base' then + + -- luatools + + runners.execute_ctx_script("mtx-base","--help") + elseif environment.argument("help") or filename=='help' or filename == "" then - logs.help(messages.help) - -- execute script + + application.help() + elseif filename:find("^bin:") then + + runners.loadbase() ok = runners.execute_program(filename) + elseif is_mkii_stub then + -- execute mkii script + + runners.loadbase() ok = runners.execute_script(filename,false,true) -else + +elseif false then + + runners.loadbase() ok = runners.execute_ctx_script(filename) if not ok then ok = runners.execute_script(filename) end + +elseif environment.files[1] == 'texmfcnf.lua' then -- so that we don't need to load mtx-base + + resolvers.load("nofiles") + resolvers.listers.configurations() + +else + + runners.loadbase() + runners.execute_ctx_script("mtx-base",filename) + +end + +if e_verbose then + report() + report("runtime: %0.3f seconds",os.runtime()) end -if os.platform == "unix" then - io.write("\n") +if os.type ~= "windows" then + texio.write("\n") -- is this still valid? end if ok == false then ok = 1 elseif ok == true then ok = 0 end diff --git a/Master/texmf-dist/tex/context/base/anch-pgr.mkii b/Master/texmf-dist/tex/context/base/anch-pgr.mkii index 194f1975517..cc7ae77f4c5 100644 --- a/Master/texmf-dist/tex/context/base/anch-pgr.mkii +++ b/Master/texmf-dist/tex/context/base/anch-pgr.mkii @@ -66,10 +66,14 @@ \def\registerpageposition#1% this one is flushed first ! {\ifpositioning\ifcase\realpageno\or - \ifdim\printpaperheight=\paperheight\else - \ifdim\printpaperwidth=\paperwidth\else + \ifdim\printpaperheight=\paperheight + \ifdim\printpaperwidth=\paperwidth + % not needed, + \else \setbox#1\hbox{\hpos\pageanchor{\box#1}}% \fi + \else + \setbox#1\ruledhbox{\hpos\pageanchor{\box#1}}% \fi \fi\fi} diff --git a/Master/texmf-dist/tex/context/base/anch-pgr.mkiv b/Master/texmf-dist/tex/context/base/anch-pgr.mkiv index 248b9ca5e31..afa88193384 100644 --- a/Master/texmf-dist/tex/context/base/anch-pgr.mkiv +++ b/Master/texmf-dist/tex/context/base/anch-pgr.mkiv @@ -69,10 +69,14 @@ \def\registerpageposition#1% this one is flushed first ! {\ifpositioning\ifcase\realpageno\or - \ifdim\printpaperheight=\paperheight\else - \ifdim\printpaperwidth=\paperwidth\else + \ifdim\printpaperheight=\paperheight + \ifdim\printpaperwidth=\paperwidth + % not needed, + \else \setbox#1\hbox{\hpos\pageanchor{\box#1}}% \fi + \else + \setbox#1\ruledhbox{\hpos\pageanchor{\box#1}}% \fi \fi\fi} @@ -143,11 +147,6 @@ \def\MPanchoridentifier{mpa} % {mp-anchor} \def\MPoverlayposprefix{MO::} -% obsolete and wrong anyway -% -% \long\unexpanded\def\defineMPpositiongraphic#1% -% {\long\setvalue{\MPoverlayposprefix#1}} - %D The rest of the definitions concerning such overlays may %D look complicated, @@ -213,16 +212,6 @@ \fi \fi} -% \def\cleanuppositionaction#1% not in trialtypesetting -% {\ifcsname\POSactionprefix#1++\endcsname -% \the\everycleanpositionaction -% \iflocalpositioning -% \global\expandafter\let\csname\POSactionprefix#1++\endcsname\empty -% \else -% \global\expandafter\let\csname\POSactionprefix#1++\expandafter\endcsname\csname\POSactionprefix#1++\endcsname -% \fi -% \fi} - \def\handlepositionaction#1\with#2\on#3% {\bgroup \ifx\currentpositionoverlay\empty @@ -627,6 +616,7 @@ \appendtoks % a position can be mid paragraph in which case we're behind + % this will change when we move positions to lua \initializeparbackgrounds \to \everystarttext @@ -842,42 +832,6 @@ \def\calculatenexttextpardimensions {\docalculatetextpardimensions\nextbtbanchor\nextetbanchor\relax} -% \def\docalculatetextpardimensions#1#2#3% #1=\btbanchor #2=\etbanchor -% {\scratchcounter\numexpr\MPp#2-\MPp#1\relax -% \edef\textparpages{\the\scratchcounter}% -% \ifcase\scratchcounter -% % one page -% \scratchdimen\dimexpr\MPy#1-\MPy#2\relax -% \else -% % two or more pages -% \ifnum\scratchcounter>2 -% \ifnum\scratchcounter<5 -% % more pages -% \scratchdimen\textheight -% \advance\scratchcounter \minusone -% \multiply\scratchdimen \scratchcounter -% \else -% % keep'm small -% \scratchdimen5\textheight -% \fi -% \else -% \scratchdimen\dimexpr\MPy#1-\MPy#2-\MPy\textanchor+\MPy\textanchor+\MPh\textanchor\relax -% \fi -% \fi -% \edef\textparheight{\the\scratchdimen}% -% \ifcase\scratchcounter -% % one page -% \scratchdimen\dimexpr\MPx#2-\MPx#1\relax -% \else -% % two or more pages / maybe also hang -% \ifx#3\relax -% \scratchdimen\makeupwidth % \textwidth -% \else -% \scratchdimen\dimexpr\MPw\MPparanchor-\MPl\MPparanchor-\MPr\MPparanchor\relax -% \fi -% \fi -% \edef\textparwidth{\the\scratchdimen}} - \def\docalculatetextpardimensions#1#2#3% #1=\btbanchor #2=\etbanchor (adapted 8/6/2009) {\scratchcounter\numexpr\MPp#2-\MPp#1\relax \edef\textparpages @@ -1017,8 +971,6 @@ \ifx\basegrid\undefined \else \letvalue\v!grid=\basegrid \fi -% lelijk, aanpassen, opties - \setupMPvariables [mpos:connect] [linecolor=red, @@ -1109,226 +1061,187 @@ \def\stackposleft {\dostackposbox{\copy\nextbox\hskip\nextboxwd\hskip\stackposdistance}} \def\stackposright{\dostackposbox{\hskip\stackposdistance\hskip\nextboxwd\flushnextbox}} -%D \macros -%D {stackeddown} -%D -%D However, a better implementation is possible with the -%D following macro. We now have an extra key \type {stack} for -%D margin settings. When set to \type {yes}, this macro comes -%D into action. - -% Because there can be many stacked items in a line and successive lines, we -% play dirty and adapt the position and height of the current node so that -% this becomes visible to a next pass. +% obsolete % -% \startbuffer -% \inleft {test 1} test 1 \inleft {test 2} test 2 \endgraf -% \inleft {test 3} test 3 -% \stopbuffer -% \getbuffer \typebuffer \flushstatus \page +% %D \macros +% %D {stackeddown} +% %D +% %D However, a better implementation is possible with the +% %D following macro. We now have an extra key \type {stack} for +% %D margin settings. When set to \type {yes}, this macro comes +% %D into action. % -% \startbuffer -% \inleft {test 1} test 1 \inleft {test 2} test 2 \inleft {test 3} test 3 \endgraf -% \inleft {test 4} test 4 -% \stopbuffer -% \getbuffer \typebuffer \flushstatus \page +% % Because there can be many stacked items in a line and successive lines, we +% % play dirty and adapt the position and height of the current node so that +% % this becomes visible to a next pass. +% % +% % \startbuffer +% % \inleft {test 1} test 1 \inleft {test 2} test 2 \endgraf +% % \inleft {test 3} test 3 +% % \stopbuffer +% % \getbuffer \typebuffer \flushstatus \page +% % +% % \startbuffer +% % \inleft {test 1} test 1 \inleft {test 2} test 2 \inleft {test 3} test 3 \endgraf +% % \inleft {test 4} test 4 +% % \stopbuffer +% % \getbuffer \typebuffer \flushstatus \page +% % +% % \startbuffer +% % \inleft {test 1} test 1 \endgraf +% % \inleft {test 2} test 2 \endgraf +% % \inleft {test 3} test 3 +% % \stopbuffer +% % \getbuffer \typebuffer \flushstatus \page +% % +% % \startbuffer +% % \inleft {test 1\\test 1} test 1 \inleft {test 2} test 2 \endgraf +% % \inleft {test 3} test 3 +% % \stopbuffer +% % \getbuffer \typebuffer \flushstatus \page +% % +% % \startbuffer +% % \inleft {test 1\\test 1\\test 1\\test 1\\test 1} test 1 \endgraf +% % test 2 \endgraf +% % \inleft {test 3} test 3 +% % \stopbuffer +% % \getbuffer \typebuffer \flushstatus \page +% % +% % \startbuffer +% % \inleft{test 1} test \inleft{test 2} test \inleft{test 3\\test 3} test +% % \stopbuffer +% % \getbuffer \typebuffer \flushstatus \page +% % +% % \startbuffer +% % \inleft{test 1\\test 1\\test 1} test \inleft{test 2\\test 2} test \inleft{test 3\\test 3\\test 3} test \endgraf +% % \inleft{test 1\\test 1\\test 1} test \inleft{test 2\\test 2} test \inleft{test 3\\test 3\\test 3} test +% % \stopbuffer +% % \getbuffer \typebuffer \flushstatus \page % -% \startbuffer -% \inleft {test 1} test 1 \endgraf -% \inleft {test 2} test 2 \endgraf -% \inleft {test 3} test 3 -% \stopbuffer -% \getbuffer \typebuffer \flushstatus \page +% \newdimen\laststackvmove % use \scratchdimenone instead of skip % -% \startbuffer -% \inleft {test 1\\test 1} test 1 \inleft {test 2} test 2 \endgraf -% \inleft {test 3} test 3 -% \stopbuffer -% \getbuffer \typebuffer \flushstatus \page +% \def\stackeddown +% {\bgroup +% % this macro assumes a few things and is meant to work for margin notes +% \dowithnextbox +% {\global\advance\currentautopos\plusone +% \global\laststackvmove\zeropoint +% \hpos{\POSstackprefix\number\currentautopos} +% {\edef\next +% {\nextboxht\the\nextboxht +% \nextboxdp\the\nextboxdp +% \nextboxwd\the\nextboxwd}% +% \previousautopos\currentautopos +% \scratchdimen\zeropoint +% \scratchcounter\zerocount +% \doloop +% {\advance\previousautopos\minusone +% \edef\currentposition {\POSstackprefix\number\currentautopos}% +% \edef\previousposition{\POSstackprefix\number\previousautopos}% +% \ifnum\MPp\currentposition=\MPp\previousposition\relax +% %\registerstatus{doing \number\currentautopos/\number\previousautopos}% +% \doifoverlappingelse\currentposition\previousposition +% {\scratchskip\dimexpr +% \MPy\currentposition +% -\MPy\previousposition +% -\MPd\currentposition % untested +% +\MPd\previousposition % untested +% +\MPh\currentposition +% \relax\relax % second relax realy needed, forgotten while dimexpressing +% % todo: also take depth into account +% \ifdim\scratchskip<\scratchdimen +% %\registerstatus{no \the\scratchskip}% +% \else +% %\registerstatus{yes \the\scratchskip}% +% \scratchdimen\scratchskip +% \fi}% +% \donothing % {\registerstatus{next}}% +% \ifnum\previousautopos<\zerocount\exitloop\fi +% \else +% \exitloop +% \fi}% +% \ifdim\scratchdimen=\zeropoint \else +% \bgroup +% \edef\currentposition{\POSstackprefix\number\currentautopos}% +% \scratchskip\scratchdimen +% \advance\scratchskip\MPh\currentposition +% \scratchdimen-\scratchdimen +% \advance\scratchdimen\MPy\currentposition +% %\registerstatus{old \number\currentautopos: \MPy\currentposition/\MPh\currentposition}% +% \expanded{\replacepospxywhd +% {\currentposition}{\MPp\currentposition}{\MPx\currentposition}{\the\scratchdimen}% +% {\MPw\currentposition}{\the\scratchskip}{\MPd\currentposition}}% +% %\registerstatus{new \number\currentautopos: \MPy\currentposition/\MPh\currentposition}% +% \egroup +% \global\laststackvmove\scratchdimen % new +% \setbox\nextbox\iftracepositions\@EA\ruledhbox\else\@EA\hbox\fi +% {\lower\scratchdimen\flushnextbox}% +% \next +% %\registerstatus{\strut}% +% \fi +% \flushnextbox}% +% \egroup}} % -% \startbuffer -% \inleft {test 1\\test 1\\test 1\\test 1\\test 1} test 1 \endgraf -% test 2 \endgraf -% \inleft {test 3} test 3 -% \stopbuffer -% \getbuffer \typebuffer \flushstatus \page +% %D The next hack make sure that margin texts near faulty +% %D strutted lines are handled ok. % -% \startbuffer -% \inleft{test 1} test \inleft{test 2} test \inleft{test 3\\test 3} test -% \stopbuffer -% \getbuffer \typebuffer \flushstatus \page +% \newif\ifrepositionmarginbox \repositionmarginboxtrue % -% \startbuffer -% \inleft{test 1\\test 1\\test 1} test \inleft{test 2\\test 2} test \inleft{test 3\\test 3\\test 3} test \endgraf -% \inleft{test 1\\test 1\\test 1} test \inleft{test 2\\test 2} test \inleft{test 3\\test 3\\test 3} test -% \stopbuffer -% \getbuffer \typebuffer \flushstatus \page - -\newdimen\laststackvmove % use \scratchdimenone instead of skip - -\def\stackeddown - {\bgroup - % this macro assumes a few things and is meant to work for margin notes - \dowithnextbox - {\global\advance\currentautopos\plusone - \global\laststackvmove\zeropoint - \hpos{\POSstackprefix\number\currentautopos} - {\edef\next - {\nextboxht\the\nextboxht - \nextboxdp\the\nextboxdp - \nextboxwd\the\nextboxwd}% - \previousautopos\currentautopos - \scratchdimen\zeropoint - \scratchcounter\zerocount - \doloop - {\advance\previousautopos\minusone - \edef\currentposition {\POSstackprefix\number\currentautopos}% - \edef\previousposition{\POSstackprefix\number\previousautopos}% - \ifnum\MPp\currentposition=\MPp\previousposition\relax - %\registerstatus{doing \number\currentautopos/\number\previousautopos}% - \doifoverlappingelse\currentposition\previousposition - {\scratchskip\dimexpr - \MPy\currentposition - -\MPy\previousposition - -\MPd\currentposition % untested - +\MPd\previousposition % untested - +\MPh\currentposition - \relax\relax % second relax realy needed, forgotten while dimexpressing - % todo: also take depth into account - \ifdim\scratchskip<\scratchdimen - %\registerstatus{no \the\scratchskip}% - \else - %\registerstatus{yes \the\scratchskip}% - \scratchdimen\scratchskip - \fi}% - \donothing % {\registerstatus{next}}% - \ifnum\previousautopos<\zerocount\exitloop\fi - \else - \exitloop - \fi}% - \ifdim\scratchdimen=\zeropoint \else - \bgroup - \edef\currentposition{\POSstackprefix\number\currentautopos}% - \scratchskip\scratchdimen - \advance\scratchskip\MPh\currentposition - \scratchdimen-\scratchdimen - \advance\scratchdimen\MPy\currentposition - %\registerstatus{old \number\currentautopos: \MPy\currentposition/\MPh\currentposition}% - \expanded{\replacepospxywhd - {\currentposition}{\MPp\currentposition}{\MPx\currentposition}{\the\scratchdimen}% - {\MPw\currentposition}{\the\scratchskip}{\MPd\currentposition}}% - %\registerstatus{new \number\currentautopos: \MPy\currentposition/\MPh\currentposition}% - \egroup - \global\laststackvmove\scratchdimen % new - \setbox\nextbox\iftracepositions\@EA\ruledhbox\else\@EA\hbox\fi - {\lower\scratchdimen\flushnextbox}% - \next - %\registerstatus{\strut}% - \fi - \flushnextbox}% - \egroup}} - -%D The next hack make sure that margin texts near faulty -%D strutted lines are handled ok. - -\newif\ifrepositionmarginbox \repositionmarginboxtrue - -\newcount\currentmarginpos - -\def\dopositionmarginbox#1% - {\bgroup - \ifrepositionmarginbox - \global\advance\currentmarginpos\plusone - %\setposition{\s!margin:\number\currentmarginpos}% not always - \ifcase\marginrepositionmethod - % nothing - \or - % nothing - \or - % stack / page check yet untested - \setposition{\s!margin:\number\currentmarginpos}% - \scratchdimen\MPy{\s!margin:\number\currentmarginpos}% - \global\advance\currentmarginpos\plusone - \advance\scratchdimen -\MPy{\s!margin:\number\currentmarginpos}% - \advance\scratchdimen -\strutdp - % new but bugged - % \setbox#1\hbox - % {\hskip-\MPx{\s!margin:\number\currentmarginpos}% - % \hskip\MPx{head:\the\realpageno}% - % \box#1}% - % so far - \setbox#1\hbox - {\setposition{\s!margin:\number\currentmarginpos}% - \raise\scratchdimen\box#1}% - \or - % move up - \setposition{\s!margin:\number\currentmarginpos}% - \ifnum\MPp{p:\number\parposcounter}=\MPp{\s!margin:\number\currentmarginpos}\relax - \scratchdimen\dimexpr\MPy{p:\number\parposcounter}-\MPy{\s!margin:\number\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 - \setposition{\s!margin:\number\currentmarginpos}% - \ifnum\MPp{p:\number\parposcounter}=\MPp{\s!margin:\number\currentmarginpos}\relax - \getnoflines\margincontentheight - \advance\noflines\minusone - \scratchdimen\noflines\lineheight - \else - \scratchdimen\dimexpr\MPy{p:\number\parposcounter}-\MPy{\s!margin:\number\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{\dontleavehmode\box#1}% dontleavehmode is needed to get direction right - \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. -%D -%D \starttyping -%D right_menu_button (n, p, s=0/1/2, x, y, w, h, d) ; -%D \stoptyping -%D -%D Here, n is the number of the button, s a status variable, -%D while the rest is positional info. The status variable is -%D 0, 1 or~2: not found, found and found but current page. - -% 0=not found 1=found 2=current page - -% geen leeg - -\newtoks\MPmenutoks - -\def\MPmenubuttons#1{\the\MPmenutoks} - -\appendtoks \global\MPmenutoks\emptytoks \to \everyshipout - -% 0=notfound 1=found 2=currentpage - -\def\domenuitemposition#1#2#3% - {\doifelsevalue{\??am#1\c!position}\v!yes - {\doglobal\increment\currentamposition - \doifreferencefoundelse{#2}% 0=not found, 1=same page, >1=elsewhere - {\chardef\currentamrealpage\ifnum\currentreferencerealpage=\realpageno\plusone\else\plustwo\fi}% - {\chardef\currentamrealpage\plustwo}% - \expanded - {\doglobal\noexpand\appendtoks - #1_menu_button(\number\currentamposition,\the\currentamrealpage,\MPpos{#1:\currentamposition}) ; - \to \MPmenutoks}% - \hpos{#1:\currentamposition}{#3}} - {#3}} - -\def\dowholemenuposition#1% - {\ifnum\currentamposition>0 - \dowithnextbox{\hpos{menu:#1:\the\realpageno}{\flushnextbox}}\hbox - \fi} +% \newcount\currentmarginpos +% +% \def\dopositionmarginbox#1% +% {\bgroup +% \ifrepositionmarginbox +% \global\advance\currentmarginpos\plusone +% %\setposition{\s!margin:\number\currentmarginpos}% not always +% \ifcase\marginrepositionmethod +% % nothing +% \or +% % nothing +% \or +% % stack / page check yet untested +% \setposition{\s!margin:\number\currentmarginpos}% +% \scratchdimen\MPy{\s!margin:\number\currentmarginpos}% +% \global\advance\currentmarginpos\plusone +% \advance\scratchdimen -\MPy{\s!margin:\number\currentmarginpos}% +% \advance\scratchdimen -\strutdp +% % new but bugged +% % \setbox#1\hbox +% % {\hskip-\MPx{\s!margin:\number\currentmarginpos}% +% % \hskip\MPx{head:\the\realpageno}% +% % \box#1}% +% % so far +% \setbox#1\hbox +% {\setposition{\s!margin:\number\currentmarginpos}% +% \raise\scratchdimen\box#1}% +% \or +% % move up +% \setposition{\s!margin:\number\currentmarginpos}% +% \ifnum\MPp{p:\number\parposcounter}=\MPp{\s!margin:\number\currentmarginpos}\relax +% \scratchdimen\dimexpr\MPy{p:\number\parposcounter}-\MPy{\s!margin:\number\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 +% \setposition{\s!margin:\number\currentmarginpos}% +% \ifnum\MPp{p:\number\parposcounter}=\MPp{\s!margin:\number\currentmarginpos}\relax +% \getnoflines\margincontentheight +% \advance\noflines\minusone +% \scratchdimen\noflines\lineheight +% \else +% \scratchdimen\dimexpr\MPy{p:\number\parposcounter}-\MPy{\s!margin:\number\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{\dontleavehmode\box#1}% dontleavehmode is needed to get direction right +% \egroup} +% +% % \setnewconstant\marginrepositionmethod\plusone % sidemethod +% % \setnewconstant\margincontentmethod \plusthree % textmethod % beware: 1 = old method +% % \setnewconstant\marginpagecheckmethod \plusone % splitmethod %D \macros %D {GFC, GTC, GSC} @@ -1348,11 +1261,6 @@ \def\tbPOSprefix {tbp:\number\noftabpositions:} -% \def\tableposindeed -% {\scratchtoks\posXCtoks -% \global\posXCtoks\emptytoks -% \the\scratchtoks} - \def\tablepos {\normalexpanded{\global\posXCtoks\emptytoks\the\posXCtoks}} @@ -1453,14 +1361,6 @@ \hskip-\wd\scratchbox \box\scratchbox} -\def\tabulatenormalcolumn#1% overloaded later in node-bck - {&\iftabulateequal\tabulateequalpos\else\tabulatenormalpos\fi - &\global\chardef\tabulatetype#1&} - -\def\tabulateequalcolumn#1% overloaded - {&\tabulateequalpos - &\global\chardef\tabulatetype#1&} - \appendtoks \global\advance\noftabpositions\plusone \global\setfalse\tablehaspositions @@ -1481,17 +1381,8 @@ \gdef\doflushtabulateepos{\epos{#1}}% \fi} -\def\splitofftabulatebox % overloaded in node-bck - {\dontcomplain - \global\setbox\tabulatebox % % % global ? % % % - \vsplit\tablebox\tabulatecolumn to \lineheight - \setbox\tabulatebox\normalvbox - {\unvbox\tabulatebox}% - \setbox\tabulatebox\hbox to \wd\tabulatebox - {\hss\dotabulatehook{\box\tabulatebox}\hss}% - \ht\tabulatebox\strutht - \dp\tabulatebox\strutdp - \box\tabulatebox +\def\flushtabulatesplitbox + {\box\tabulatebox \iftrialtypesetting\else\ifconditional\tablehaspositions\doflushtabulateepos\fi\fi} \appendtoks diff --git a/Master/texmf-dist/tex/context/base/anch-pos.lua b/Master/texmf-dist/tex/context/base/anch-pos.lua index 8066af4ceba..789e1aefe71 100644 --- a/Master/texmf-dist/tex/context/base/anch-pos.lua +++ b/Master/texmf-dist/tex/context/base/anch-pos.lua @@ -12,155 +12,375 @@ can we store much more information in but it's also more efficient.

--ldx]]-- -local concat, format = table.concat, string.format -local texprint, ctxcatcodes = tex.print, tex.ctxcatcodes +-- to be considered: store as numbers instead of string +-- maybe replace texsp by our own converter (stay at the lua end) + +local tostring = tostring +local concat, format, gmatch = table.concat, string.format, string.gmatch local lpegmatch = lpeg.match +local allocate, mark = utilities.storage.allocate, utilities.storage.mark +local texsp = tex.sp +----- texsp = string.todimen -- because we cache this is much faster but no rounding -jobpositions = jobpositions or { } -jobpositions.collected = jobpositions.collected or { } -jobpositions.tobesaved = jobpositions.tobesaved or { } +local collected = allocate() +local tobesaved = allocate() --- these are global since they are used often at the tex end +local jobpositions = { + collected = collected, + tobesaved = tobesaved, +} --- \the\dimexpr #2\ifnum\positionanchormode=\plusone-\MPx\pageanchor\fi\relax --- \the\dimexpr #3\ifnum\positionanchormode=\plusone-\MPy\pageanchor\fi\relax +job.positions = jobpositions -ptbs, pcol = jobpositions.tobesaved, jobpositions.collected -- global +_ptbs_, _pcol_ = tobesaved, collected -- global -local dx, dy = "0pt", "0pt" +local dx, dy, nx, ny = "0pt", "0pt", 0, 0 local function initializer() - ptbs, pcol = jobpositions.tobesaved, jobpositions.collected - local p = pcol["page:0"] -- page:1 - if p then --- to be checked ! ---~ dx, dy = p[2] or "0pt", p[3] or "0pt" - end + tobesaved = jobpositions.tobesaved + collected = jobpositions.collected + _ptbs_ = tobesaved -- global + _pcol_ = collected -- global + -- local p = collected["page:0"] -- page:1 + -- if p then + -- dx, nx = p[2] or "0pt", 0 + -- dy, ny = p[3] or "0pt", 0 + -- end end -job.register('jobpositions.collected', jobpositions.tobesaved, initializer) +job.register('job.positions.collected', tobesaved, initializer) function jobpositions.copy(target,source) - jobpositions.collected[target] = jobpositions.collected[source] or ptbs[source] + collected[target] = collected[source] or tobesaved[source] end function jobpositions.replace(name,...) - jobpositions.collected[name] = {...} + collected[name] = {...} +end + +function jobpositions.page(id) + local jpi = collected[id] or tobesaved[id] + if jpi then + return texsp(jpi[1]) + else + return 0 + end +end + +function jobpositions.x(id) + local jpi = collected[id] or tobesaved[id] + if jpi then + return texsp(jpi[2]) - nx + else + return 0 + end end -function jobpositions.doifelse(name) - commands.testcase(jobpositions.collected[name] or ptbs[name]) +function jobpositions.y(id) + local jpi = collected[id] or tobesaved[id] + if jpi then + return texsp(jpi[3]) - ny + else + return 0 + end end -function jobpositions.MPp(id) local jpi = pcol[id] or ptbs[id] texprint(ctxcatcodes,(jpi and jpi[1]) or '0' ) end -function jobpositions.MPx(id) local jpi = pcol[id] or ptbs[id] texprint(ctxcatcodes,(jpi and jpi[2]) or '0pt') end -function jobpositions.MPy(id) local jpi = pcol[id] or ptbs[id] texprint(ctxcatcodes,(jpi and jpi[3]) or '0pt') end -function jobpositions.MPw(id) local jpi = pcol[id] or ptbs[id] texprint(ctxcatcodes,(jpi and jpi[4]) or '0pt') end -function jobpositions.MPh(id) local jpi = pcol[id] or ptbs[id] texprint(ctxcatcodes,(jpi and jpi[5]) or '0pt') end -function jobpositions.MPd(id) local jpi = pcol[id] or ptbs[id] texprint(ctxcatcodes,(jpi and jpi[6]) or '0pt') end +function jobpositions.width(id) + local jpi = collected[id] or tobesaved[id] + if jpi then + return texsp(jpi[4]) + else + return 0 + end +end +function jobpositions.height(id) + local jpi = collected[id] or tobesaved[id] + if jpi then + return texsp(jpi[5]) + else + return 0 + end +end -function jobpositions.MPx(id) - local jpi = pcol[id] or ptbs[id] +function jobpositions.depth(id) + local jpi = collected[id] or tobesaved[id] + if jpi then + return texsp(jpi[6]) + else + return 0 + end +end + +function jobpositions.xy(id) + local jpi = collected[id] or tobesaved[id] + if jpi then + return texsp(jpi[2]) - nx, texsp(jpi[3]) - ny + else + return 0, 0 + end +end + +function jobpositions.lowerleft(id) + local jpi = collected[id] or tobesaved[id] + if jpi then + return texsp(jpi[2]) - nx, texsp(jpi[3]) - texsp(jpi[6]) - ny + else + return 0, 0 + end +end + +function jobpositions.lowerright(id) + local jpi = collected[id] or tobesaved[id] + if jpi then + return texsp(jpi[2]) + texsp(jpi[4]) - nx, texsp(jpi[3]) - texsp(jpi[6]) - ny + else + return 0, 0 + end +end + +function jobpositions.upperright(id) + local jpi = collected[id] or tobesaved[id] + if jpi then + return texsp(jpi[2]) + texsp(jpi[4]) - nx, texsp(jpi[3]) + texsp(jpi[5]) - ny + else + return 0, 0 + end +end + +function jobpositions.upperleft(id) + local jpi = collected[id] or tobesaved[id] + if jpi then + return texsp(jpi[2]) - nx, texsp(jpi[3]) + texsp(jpi[5]) - ny + else + return 0, 0 + end +end + +function jobpositions.position(id) + local jpi = collected[id] or tobesaved[id] + if jpi then + return texsp(jpi[1]), texsp(jpi[2]), texsp(jpi[3]), texsp(jpi[4]), texsp(jpi[5]), texsp(jpi[6]) + else + return 0, 0, 0, 0, 0, 0 + end +end + +function jobpositions.extra(id,n,default) -- assume numbers + local jpi = collected[id] or tobesaved[id] + if not jpi then + return default + else + local split = jpi[0] + if not split then + split = lpegmatch(splitter,jpi[7]) + jpi[0] = split + end + return texsp(split[n]) or default + end +end + +local function overlapping(one,two,overlappingmargin) + one = collected[one] or tobesaved[one] + two = collected[two] or tobesaved[two] + if one and two and one[1] == two[1] then + if not overlappingmargin then + overlappingmargin = 2 + end + local x_one = one[2] + local x_two = two[2] + local w_two = two[4] + local llx_one = x_one - overlappingmargin + local urx_two = x_two + w_two + overlappingmargin + if llx_one > urx_two then + return false + end + local w_one = one[4] + local urx_one = x_one + w_one + overlappingmargin + local llx_two = x_two - overlappingmargin + if urx_one < llx_two then + return false + end + local y_one = one[3] + local y_two = two[3] + local d_one = one[6] + local h_two = two[5] + local lly_one = y_one - d_one - overlappingmargin + local ury_two = y_two + h_two + overlappingmargin + if lly_one > ury_two then + return false + end + local h_one = one[5] + local d_two = two[6] + local ury_one = y_one + h_one + overlappingmargin + local lly_two = y_two - d_two - overlappingmargin + if ury_one < lly_two then + return false + end + return true + end +end + +local function onsamepage(list,page) + for id in gmatch(list,"(, )") do + local jpi = collected[id] or tobesaved[id] + if jpi then + local p = jpi[1] + if not page then + page = p + elseif page ~= p then + return false + end + end + end + return page +end + +jobpositions.overlapping = overlapping +jobpositions.onsamepage = onsamepage + +-- interface + +commands.replacepospxywhd = jobpositions.replace +commands.copyposition = jobpositions.copy + +function commands.MPp(id) + local jpi = collected[id] or tobesaved[id] + context(jpi and jpi[1] or '0') +end + +function commands.MPx(id) + local jpi = collected[id] or tobesaved[id] local x = jpi and jpi[2] if x then - texprint(ctxcatcodes,format('\\the\\dimexpr%s-%s\\relax',x,dx)) -- no space after dimexpr ! + if nx == 0 then + context(x) + else + context('\\the\\dimexpr%s-%s\\relax',x,dx) + end else - texprint(ctxcatcodes,'0pt') + context('0pt') end end -function jobpositions.MPy(id) - local jpi = pcol[id] or ptbs[id] +function commands.MPy(id) + local jpi = collected[id] or tobesaved[id] local y = jpi and jpi[3] if y then - texprint(ctxcatcodes,format('\\the\\dimexpr%s-%s\\relax',y,dy)) -- no space after dimexpr ! + if ny == 0 then + context(y) + else + context('\\the\\dimexpr%s-%s\\relax',y,dy) + end else - texprint(ctxcatcodes,'0pt') + context('0pt') end end --- the following are only for MP so there we can leave out the pt +function commands.MPw(id) + local jpi = collected[id] or tobesaved[id] + context(jpi and jpi[4] or '0pt') +end --- can be writes and no format needed any more +function commands.MPh(id) + local jpi = collected[id] or tobesaved[id] + context(jpi and jpi[5] or '0pt') +end + +function commands.MPd(id) + local jpi = collected[id] or tobesaved[id] + context(jpi and jpi[6] or '0pt') +end -function jobpositions.MPxy(id) - local jpi = pcol[id] or ptbs[id] +function commands.MPxy(id) + local jpi = collected[id] or tobesaved[id] if jpi then - texprint(ctxcatcodes,format('(%s-%s,%s-%s)',jpi[2],dx,jpi[3],dy)) ---~ texprint(ctxcatcodes,'(',jpi[2],'-',dx,',',jpi[3],'-',dy,')') + context('(%s-%s,%s-%s)',jpi[2],dx,jpi[3],dy) else - texprint(ctxcatcodes,'(0,0)') + context('(0,0)') end end -function jobpositions.MPll(id) - local jpi = pcol[id] or ptbs[id] +function commands.MPll(id) + local jpi = collected[id] or tobesaved[id] if jpi then - texprint(ctxcatcodes,format('(%s-%s,%s-%s-%s)',jpi[2],dx,jpi[3],jpi[6],dy)) ---~ texprint(ctxcatcodes,'(',jpi[2],'-',dx,',',jpi[3],'-',jpi[6],'-',dy,')') + context('(%s-%s,%s-%s-%s)',jpi[2],dx,jpi[3],jpi[6],dy) else - texprint(ctxcatcodes,'(0,0)') + context('(0,0)') end end -function jobpositions.MPlr(id) - local jpi = pcol[id] or ptbs[id] +function commands.MPlr(id) + local jpi = collected[id] or tobesaved[id] if jpi then - texprint(ctxcatcodes,format('(%s+%s-%s,%s-%s-%s)',jpi[2],jpi[4],dx,jpi[3],jpi[6],dy)) ---~ texprint(ctxcatcodes,'(',jpi[2],'+',jpi[4],'-',dx,',',jpi[3],'-',jpi[6],'-',dy,')') + context('(%s+%s-%s,%s-%s-%s)',jpi[2],jpi[4],dx,jpi[3],jpi[6],dy) else - texprint(ctxcatcodes,'(0,0)') + context('(0,0)') end end -function jobpositions.MPur(id) - local jpi = pcol[id] or ptbs[id] +function commands.MPur(id) + local jpi = collected[id] or tobesaved[id] if jpi then - texprint(ctxcatcodes,format('(%s+%s-%s,%s+%s-%s)',jpi[2],jpi[4],dx,jpi[3],jpi[5],dy)) ---~ texprint(ctxcatcodes,'(',jpi[2],'+',jpi[4],'-',dx,',',jpi[3],'+',jpi[5],'-',dy,')') + context('(%s+%s-%s,%s+%s-%s)',jpi[2],jpi[4],dx,jpi[3],jpi[5],dy) else - texprint(ctxcatcodes,'(0,0)') + context('(0,0)') end end -function jobpositions.MPul(id) - local jpi = pcol[id] or ptbs[id] +function commands.MPul(id) + local jpi = collected[id] or tobesaved[id] if jpi then - texprint(ctxcatcodes,format('(%s-%s,%s+%s-%s)',jpi[2],dx,jpi[3],jpi[5],dy)) ---~ texprint(ctxcatcodes,'(',jpi[2],'-',dx,',',jpi[3],'+',jpi[5],'-',dy,')') + context('(%s-%s,%s+%s-%s)',jpi[2],dx,jpi[3],jpi[5],dy) else - texprint(ctxcatcodes,'(0,0)') + context('(0,0)') end end -function jobpositions.MPpos(id) - local jpi = pcol[id] or ptbs[id] +function commands.MPpos(id) + local jpi = collected[id] or tobesaved[id] if jpi then - texprint(ctxcatcodes,concat(jpi,',',1,6)) + context(concat(jpi,',',1,6)) else - texprint(ctxcatcodes,'0,0,0,0,0,0') + context('0,0,0,0,0,0') end end local splitter = lpeg.Ct(lpeg.splitat(",")) -function jobpositions.MPplus(id,n,default) - local jpi = pcol[id] or ptbs[id] +function commands.MPplus(id,n,default) + local jpi = collected[id] or tobesaved[id] if not jpi then - texprint(ctxcatcodes,default) + context(default) else local split = jpi[0] if not split then split = lpegmatch(splitter,jpi[7]) jpi[0] = split end - texprint(ctxcatcodes,split[n] or default) + context(split[n] or default) end end -function jobpositions.MPrest(id,default) - local jpi = pcol[id] or ptbs[id] - -- texprint(ctxcatcodes,(jpi and jpi[7] and concat(jpi,",",7,#jpi)) or default) - texprint(ctxcatcodes,(jpi and jpi[7]) or default) +function commands.MPrest(id,default) + local jpi = collected[id] or tobesaved[id] + context(jpi and jpi[7] or default) +end + +-- is testcase already defined? if so, then local + +function commands.doifpositionelse(name) + commands.testcase(collected[name] or tobesaved[name]) +end + +function commands.doifoverlappingelse(one,two,overlappingmargin) + commands.testcase(overlapping(one,two,overlappingmargin)) +end + +function commands.doifpositionsonsamepageelse(list,page) + commands.testcase(onsamepage(list)) +end + +function commands.doifpositionsonthispageelse(list) + commands.testcase(onsamepage(list,tostring(tex.count.realpageno))) end diff --git a/Master/texmf-dist/tex/context/base/anch-pos.mkii b/Master/texmf-dist/tex/context/base/anch-pos.mkii index 589c4aa26d5..c793f7ba4a8 100644 --- a/Master/texmf-dist/tex/context/base/anch-pos.mkii +++ b/Master/texmf-dist/tex/context/base/anch-pos.mkii @@ -637,7 +637,13 @@ \iftracepositions\registerparsymbol\fi} \def\traceposstring#1#2#3% - {\iftracepositions\smashedhbox{#1{\infofont#2#3}}\fi} + {\iftracepositions + \smashedhbox + {#1{\infofont#2#3}% + \scratchdimen.5\points + \kern-2\scratchdimen + \vrule\!!width4\scratchdimen\!!height\scratchdimen\!!depth\scratchdimen}% + \fi} \def\registerparsymbol {\iftracepositions diff --git a/Master/texmf-dist/tex/context/base/anch-pos.mkiv b/Master/texmf-dist/tex/context/base/anch-pos.mkiv index e454747daf2..dc231bcff82 100644 --- a/Master/texmf-dist/tex/context/base/anch-pos.mkiv +++ b/Master/texmf-dist/tex/context/base/anch-pos.mkiv @@ -15,7 +15,6 @@ % related code to meta-pos % shorter tags, ..:achtergrond:.. etc in pos actions - % dubbele text- * pos's eruit % class pos -> als gelijk aan vorige, dan niet niet definieren @@ -35,7 +34,8 @@ % at some point (when we no longer share code) we will move to numbers % do that we have less garbage collection and hashing % -% the global table ptbs is equivalent to jobpositions.tobesaved +% the global table _ptbs_ is equivalent to job.positions.tobesaved +% the global table _pcol_ is equivalent to job.positions.collected % % btw, using a function is more efficient than passing longer code % snippets to ctxlua @@ -106,32 +106,30 @@ %D method is implemented in a special driver. If needed, the %D driver can fall back on the following macros. -% are the next 6 still used? - -\def\dolazysaveposition #1#2#3#4{\normalexpanded{\ctxlatelua{ptbs['#1']={#2,"#3","#4"}}}} -\def\dolazysavepositionwhd #1#2#3#4#5#6#7{\normalexpanded{\ctxlatelua{ptbs['#1']={#2,"#3","#4","#5","#6","#7"}}}} -\def\dolazysavepositionplus#1#2#3#4#5#6#7#8{\normalexpanded{\ctxlatelua{ptbs['#1']={#2,"#3","#4","#5","#6","#7","#8"}}}} -\def\dosaveposition #1#2#3#4{\normalexpanded{\ctxlua {ptbs['#1']={#2,"#3","#4"}}}} -\def\dosavepositionwhd #1#2#3#4#5#6#7{\normalexpanded{\ctxlua {ptbs['#1']={#2,"#3","#4","#5","#6","#7"}}}} -\def\dosavepositionplus #1#2#3#4#5#6#7#8{\normalexpanded{\ctxlua {ptbs['#1']={#2,"#3","#4","#5","#6","#7","#8"}}}} +\def\dolazysaveposition #1#2#3#4{\normalexpanded{\ctxlatelua{_ptbs_['#1']={#2,"#3","#4"}}}} +\def\dolazysavepositionwhd #1#2#3#4#5#6#7{\normalexpanded{\ctxlatelua{_ptbs_['#1']={#2,"#3","#4","#5","#6","#7"}}}} +\def\dolazysavepositionplus#1#2#3#4#5#6#7#8{\normalexpanded{\ctxlatelua{_ptbs_['#1']={#2,"#3","#4","#5","#6","#7","#8"}}}} +\def\dosaveposition #1#2#3#4{\normalexpanded{\ctxlua {_ptbs_['#1']={#2,"#3","#4"}}}} +\def\dosavepositionwhd #1#2#3#4#5#6#7{\normalexpanded{\ctxlua {_ptbs_['#1']={#2,"#3","#4","#5","#6","#7"}}}} +\def\dosavepositionplus #1#2#3#4#5#6#7#8{\normalexpanded{\ctxlua {_ptbs_['#1']={#2,"#3","#4","#5","#6","#7","#8"}}}} \def\lastsavedpositionx {\the\dimexpr\pdflastxpos\scaledpoint\relax} \def\lastsavedpositiony {\the\dimexpr\pdflastypos\scaledpoint\relax} \let\savecurrentposition\pdfsavepos -\def\dosetposition#1% +\def\dosetposition#1% will become commands.setposition {\savecurrentposition - \normalexpanded{\ctxlatelua{ptbs['#1']={% + \normalexpanded{\ctxlatelua{_ptbs_['#1']={% \noexpand\realfolio,"\noexpand\lastsavedpositionx","\noexpand\lastsavedpositiony"}}}} \def\dosetpositionwhd#1#2#3#4% {\savecurrentposition - \normalexpanded{\ctxlatelua{ptbs['#1']={% + \normalexpanded{\ctxlatelua{_ptbs_['#1']={% \noexpand\realfolio,"\noexpand\lastsavedpositionx","\noexpand\lastsavedpositiony","#2","#3","#4"}}}} \def\dosetpositionplus#1#2#3#4#5% {\savecurrentposition - \normalexpanded{\ctxlatelua{ptbs['#1']={% + \normalexpanded{\ctxlatelua{_ptbs_['#1']={% \noexpand\realfolio,"\noexpand\lastsavedpositionx","\noexpand\lastsavedpositiony","#2","#3","#4","#5"}}}} \let\dosetpositionpapersize\gobbletwoarguments @@ -149,18 +147,13 @@ %D page box and therefore flushed first. So, when present, it %D is applied to all positions except itself. -\chardef\positionanchormode=0 % don't relocate page origin -\chardef\positionanchormode=1 % relocate page origin once - -%D The core set macros. +% 0 = don't relocate page origin 1 = relocate page origin once -\let\pospxy \gobblefourarguments -\let\pospxywhd \gobblesevenarguments -\let\pospxyplus\gobbleeightarguments +\setnewconstant\positionanchormode\plusone %D Sometimes we want to trick the position handler a bit: -\def\replacepospxywhd#1#2#3#4#5#6#7{\ctxlua{jobpositions.replace('#1',\number#2,"\the\dimexpr#3\relax","\the\dimexpr#4\relax","\the\dimexpr#5\relax","\the\dimexpr#6\relax","\the\dimexpr#7\relax")}} +\def\replacepospxywhd#1#2#3#4#5#6#7{\ctxcommand{replacepospxywhd('#1',\number#2,"\the\dimexpr#3\relax","\the\dimexpr#4\relax","\the\dimexpr#5\relax","\the\dimexpr#6\relax","\the\dimexpr#7\relax")}} %D For postprocessing purposes, we save the number of %D positions. @@ -176,47 +169,39 @@ %D not applicable when the content floats indeed. In such %D situations one can treat positions and graphics local. -\newif\iflocalpositioning +\newif\iflocalpositioning % todo: conditional %D Watch out: sometimes a pagebreak occurs inside a float %D placement, so there we need to disable local mode. \appendtoks - \localpositioningtrue + \localpositioningtrue \to \everyinsidefloat \appendtoks - \localpositioningfalse + \localpositioningfalse \to \everypagebody -%D Since the positional values are to be fully expandable, we -%D need to preload them as soon as possible, which is why we -%D load the data when we start a text. - -% \appendtoks \checkpositions \to \everystarttext - %D \macros %D {MPp, MPx, MPy, MPw, MPh, MPd, %D MPxy, MPll, MPlr, MPur, MPul, MPpos} %D %D Access to the positional information is provided by macros -%D with short names that are clearly meant for \METAPOST. - -% \the\dimexpr\noexpand\lastsavedpositionx\ifnum\positionanchormode=\plusone-\MPx\pageanchor\fi\relax -% \the\dimexpr\noexpand\lastsavedpositiony\ifnum\positionanchormode=\plusone-\MPx\pageanchor\fi\relax - -\def\MPp #1{\ctxlua{jobpositions.MPp("#1")}} -\def\MPx #1{\ctxlua{jobpositions.MPx("#1")}} -\def\MPy #1{\ctxlua{jobpositions.MPy("#1")}} -\def\MPw #1{\ctxlua{jobpositions.MPw("#1")}} -\def\MPh #1{\ctxlua{jobpositions.MPh("#1")}} -\def\MPd #1{\ctxlua{jobpositions.MPd("#1")}} -\def\MPxy #1{\ctxlua{jobpositions.MPxy("#1")}} -\def\MPll #1{\ctxlua{jobpositions.MPll("#1")}} -\def\MPlr #1{\ctxlua{jobpositions.MPlr("#1")}} -\def\MPur #1{\ctxlua{jobpositions.MPur("#1")}} -\def\MPul #1{\ctxlua{jobpositions.MPul("#1")}} -\def\MPpos#1{\ctxlua{jobpositions.MPpos("#1")}} +%D with short names that are clearly meant for \METAPOST\ but +%D nowadays also used for other purposes. + +\def\MPp #1{\ctxcommand{MPp("#1")}} +\def\MPx #1{\ctxcommand{MPx("#1")}} +\def\MPy #1{\ctxcommand{MPy("#1")}} +\def\MPw #1{\ctxcommand{MPw("#1")}} +\def\MPh #1{\ctxcommand{MPh("#1")}} +\def\MPd #1{\ctxcommand{MPd("#1")}} +\def\MPxy #1{\ctxcommand{MPxy("#1")}} +\def\MPll #1{\ctxcommand{MPll("#1")}} +\def\MPlr #1{\ctxcommand{MPlr("#1")}} +\def\MPur #1{\ctxcommand{MPur("#1")}} +\def\MPul #1{\ctxcommand{MPul("#1")}} +\def\MPpos#1{\ctxcommand{MPpos("#1")}} %D \macros %D {MPplus, MPrest, MPv, MPvv} @@ -238,8 +223,8 @@ %D %D The extra parameters are not treated. -\def\MPplus#1#2#3{\ctxlua{jobpositions.MPplus("#1",#2,"#3")}} \let\MPv \MPplus -\def\MPrest #1#2{\ctxlua{jobpositions.MPrest("#1","#2")}} \let\MPvv\MPrest +\def\MPplus#1#2#3{\ctxcommand{MPplus("#1",#2,"#3")}} \let\MPv \MPplus +\def\MPrest #1#2{\ctxcommand{MPrest("#1","#2")}} \let\MPvv\MPrest %D \macros %D {MPanchor} @@ -248,14 +233,6 @@ \def\MPanchor{\MPpos} -%D \macros -%D {POSp, POSx, POSy, POSh, POSd, POSw} -%D -%D and: - -\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 %D position. @@ -263,9 +240,7 @@ \def\initializenextposition {\ifpositioning \else \global\positioningtrue - \dosetpositionpapersize - {\printpaperwidth }% - {\printpaperheight}% + \dosetpositionpapersize\printpaperwidth\printpaperheight \fi \global\advance\currentpositions\plusone} @@ -400,7 +375,7 @@ %D %D Again, this is a global action. -\def\copyposition#1#2{\ctxlua{jobpositions.copy('#1','#2')}} +\def\copyposition#1#2{\ctxcommand{copyposition('#1','#2')}} %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 @@ -410,7 +385,7 @@ %D \doifpositionelse {identifier} {found action} {not found action} %D \stoptyping -\def\doifpositionelse#1{\ctxlua{jobpositions.doifelse('#1')}} +\def\doifpositionelse#1{\ctxcommand{doifpositionelse('#1')}} %D We have now arrived at a few macros that would make sense as %D support macros, but ended up in the core. @@ -499,7 +474,6 @@ \newcount\parposcounter \newif \ifpositioningpar -\chardef \parposstrut = 1 % 0 => no strut data, so fall backs used \newif \iftracepositions % we can check for used entries, and if not, then not add one @@ -515,15 +489,11 @@ \let\registerparoptions\relax \def\doregisterparoptions - {\ifpositioningpar \ifpositioning \iftrialtypesetting \else + {\iftrialtypesetting \else \ifinpagebody \else \ifmmode \else \ifinformula \else - \ifprocessingverbatim - \iflinepar \dodoregisterparoptions \fi - \else - \dodoregisterparoptions - \fi + \dodoregisterparoptions \fi \fi \fi - \fi \fi \fi} + \fi} \def\dodoregisterparoptions {\global\advance\parposcounter\plusone @@ -537,7 +507,13 @@ \iftracepositions\registerparsymbol\fi} \def\traceposstring#1#2#3% - {\iftracepositions\smashedhbox{#1{\infofont#2#3}}\fi} + {\iftracepositions + \smashedhbox + {#1{\infofont#2#3}% + \scratchdimen.5\points + \kern-2\scratchdimen + \vrule\!!width4\scratchdimen\!!height\scratchdimen\!!depth\scratchdimen}% + \fi} \def\registerparsymbol {\iftracepositions @@ -592,7 +568,7 @@ \def\getnodelocationn#1{\countervalue{\@@noden#1}} \def\getnodelocationo#1{\getvalue {\@@nodeo#1}} -\chardef\nodelocationmode\plusone +\setnewconstant\nodelocationmode\plusone \def\analyzenodelocation#1% {\ifcsname\@@noden#1\endcsname @@ -680,67 +656,14 @@ %D {action when not overlapping} %D \stoptyping -\def\overlappingmargin{-2\scaledpoint} - -\def\overlappingcheckone#1#2% - {\ifdim#1<\!!dimena \else \ifdim#1>\!!dimenb \else - \ifdim#2<\!!dimenc \else \ifdim#2>\!!dimend \else - \donetrue - \fi\fi - \fi\fi} - -\def\overlappingchecktwo#1#2% - {\ifdim#1<\!!dimene \else \ifdim#1>\!!dimenf \else - \ifdim#2<\!!dimeng \else \ifdim#2>\!!dimenh \else - \donetrue - \fi\fi - \fi\fi} - -\def\doifoverlappingelse#1#2% maybe do this in lua - {\begingroup - \donefalse - \edef\!!stringa{#1}\edef\!!stringb{#2}% - \ifnum\MPp\!!stringa=\MPp\!!stringb\relax - \!!dimena\MPx\!!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\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 - \advance\!!dimenc-\overlappingmargin - \advance\!!dimend+\overlappingmargin - \advance\!!dimene-\overlappingmargin - \advance\!!dimenf+\overlappingmargin - \advance\!!dimeng-\overlappingmargin - \advance\!!dimenh+\overlappingmargin - \fi - % more often eh fb eg fg - \overlappingcheckone\!!dimene\!!dimeng \ifdone \else - \overlappingcheckone\!!dimene\!!dimenh \ifdone \else - \overlappingcheckone\!!dimenf\!!dimeng \ifdone \else - \overlappingcheckone\!!dimenf\!!dimenh \ifdone \else - \overlappingchecktwo\!!dimena\!!dimenc \ifdone \else - \overlappingchecktwo\!!dimena\!!dimend \ifdone \else - \overlappingchecktwo\!!dimenb\!!dimene \ifdone \else - \overlappingchecktwo\!!dimenb\!!dimenc \fi \fi \fi \fi \fi \fi \fi - \fi - \ifdone - \endgroup\expandafter\firstoftwoarguments - \else - \endgroup\expandafter\secondoftwoarguments - \fi} +\def\doifoverlappingelse#1#2{\ctxcommand{doifoverlappingelse("#1","#2")}} %D \macros %D {doifpositionsonsamepageelse, %D doifpositionsonthispageelse} %D %D Instead of letting the user handle fuzzy expansion, we -%D provide a simple test on positione being on the same page. +%D provide a simple test on positions being on the same page. %D %D \starttyping %D \doifpositionsonsamepageelse{point a}{point b} @@ -751,33 +674,20 @@ %D {action when not on this page} %D \stoptyping -\def\dododoifpositionsonsamepageelse#1% - {\ifcase\scratchcounter - \scratchcounter\MPp{##}\donetrue - \else - \ifnum\scratchcounter=\MPp{#1}\relax\else\donefalse\fi - \fi}% - -\def\dodoifpositionsonsamepageelse#1#2% - {\begingroup - \scratchcounter#1\donefalse - \rawprocesscommalist[#2]\dododoifpositionsonsamepageelse - \ifdone - \endgroup\expandafter\firstoftwoarguments - \else - \endgroup\expandafter\secondoftwoarguments - \fi} - -\def\doifpositionsonsamepageelse{\dodoifpositionsonsamepageelse\!!zerocount} -\def\doifpositionsonthispageelse{\dodoifpositionsonsamepageelse\realfolio } +\def\doifpositionsonsamepageelse#1{\ctxcommand{doifpositionsonsamepageelse("#1")}} +\def\doifpositionsonthispageelse#1{\ctxcommand{doifpositionsonthispageelse("#1")}} %D Plugins: -\let\MPv \MPplus -\let\MPvv\MPrest - +\let\MPv \MPplus +\let\MPvv \MPrest \let\MPanchor\MPpos +%D \macros +%D {POSp, POSx, POSy, POSh, POSd, POSw} +%D +%D This is obsolete in \MKIV: + \let\POSp\MPp \let\POSx\MPx \let\POSy\MPy \let\POSh\MPh \let\POSd\MPd \let\POSw\MPw diff --git a/Master/texmf-dist/tex/context/base/attr-col.lua b/Master/texmf-dist/tex/context/base/attr-col.lua new file mode 100644 index 00000000000..871ac3e03cf --- /dev/null +++ b/Master/texmf-dist/tex/context/base/attr-col.lua @@ -0,0 +1,516 @@ +if not modules then modules = { } end modules ['attr-col'] = { + version = 1.001, + comment = "companion to attr-col.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- this module is being reconstructed and code will move to other places +-- we can also do the nsnone via a metatable and then also se index 0 + +local type = type +local format = string.format +local concat = table.concat + +local attributes, nodes = attributes, nodes + +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex + +local report_attributes = logs.reporter("attributes","colors") +local report_colors = logs.reporter("colors","support") +local report_transparencies = logs.reporter("transparencies","support") + +-- todo: document this but first reimplement this as it reflects the early +-- days of luatex / mkiv and we have better ways now + +-- nb: attributes: color etc is much slower than normal (marks + literals) but ... +-- nb. too many "0 g"s + +local states = attributes.states +local tasks = nodes.tasks +local nodeinjections = backends.nodeinjections +local registrations = backends.registrations +local unsetvalue = attributes.unsetvalue + +-- We can distinguish between rules and glyphs but it's not worth the trouble. A +-- first implementation did that and while it saves a bit for glyphs and rules, it +-- costs more resourses for transparencies. So why bother. + +-- +-- colors +-- + +-- we can also collapse the two attributes: n, n+1, n+2 and then +-- at the tex end add 0, 1, 2, but this is not faster and less +-- flexible (since sometimes we freeze color attribute values at +-- the lua end of the game +-- +-- we also need to store the colorvalues because we need then in mp +-- +-- This is a compromis between speed and simplicity. We used to store the +-- values and data in one array, which made in neccessary to store the +-- converters that need node constructor into strings and evaluate them +-- at runtime (after reading from storage). Think of: +-- +-- colors.strings = colors.strings or { } +-- +-- if environment.initex then +-- colors.strings[color] = "return colors." .. colorspace .. "(" .. concat({...},",") .. ")" +-- end +-- +-- storage.register("attributes/colors/data", colors.strings, "attributes.colors.data") -- evaluated +-- +-- We assume that only processcolors are defined in the format. + +attributes.colors = attributes.colors or { } +local colors = attributes.colors + +local a_color = attributes.private('color') +local a_selector = attributes.private('colormodel') + +colors.data = allocate() +colors.values = colors.values or { } +colors.registered = colors.registered or { } +colors.weightgray = true +colors.attribute = a_color +colors.selector = a_selector +colors.default = 1 +colors.main = nil +colors.triggering = true +colors.supported = true + +storage.register("attributes/colors/values", colors.values, "attributes.colors.values") +storage.register("attributes/colors/registered", colors.registered, "attributes.colors.registered") + +local templates = { + rgb = "r:%s:%s:%s", + cmyk = "c:%s:%s:%s:%s", + gray = "s:%s", + spot = "p:%s:%s:%s:%s" +} + +local models = { + [interfaces.variables.none] = unsetvalue, + black = unsetvalue, + bw = unsetvalue, + all = 1, + gray = 2, + rgb = 3, + cmyk = 4, +} + +colors.model = "all" + +local data = colors.data +local values = colors.values +local registered = colors.registered + +local numbers = attributes.numbers +local list = attributes.list + +local min, max, floor = math.min, math.max, math.floor + +local function rgbtocmyk(r,g,b) -- we could reduce + return 1-r, 1-g, 1-b, 0 +end + +local function cmyktorgb(c,m,y,k) + return 1.0 - min(1.0,c+k), 1.0 - min(1.0,m+k), 1.0 - min(1.0,y+k) +end + +local function rgbtogray(r,g,b) + if colors.weightgray then + return .30*r+.59*g+.11*b + else + return r/3+g/3+b/3 + end +end + +local function cmyktogray(c,m,y,k) + return rgbtogray(cmyktorgb(c,m,y,k)) +end + +-- http://en.wikipedia.org/wiki/HSI_color_space +-- http://nl.wikipedia.org/wiki/HSV_(kleurruimte) + +local function hsvtorgb(h,s,v) + -- h = h % 360 + local hd = h/60 + local hf = floor(hd) + local hi = hf % 6 + -- local f = hd - hi + local f = hd - hf + local p = v * (1 - s) + local q = v * (1 - f * s) + local t = v * (1 - (1 - f) * s) + if hi == 0 then + return v, t, p + elseif hi == 1 then + return q, v, p + elseif hi == 2 then + return p, v, t + elseif hi == 3 then + return p, q, v + elseif hi == 4 then + return t, p, v + elseif hi == 5 then + return v, p, q + else + print("error in hsv -> rgb",hi,h,s,v) + end +end + +local function rgbtohsv(r,g,b) + local offset, maximum, other_1, other_2 + if r >= g and r >= b then + offset, maximum, other_1, other_2 = 0, r, g, b + elseif g >= r and g >= b then + offset, maximum, other_1, other_2 = 2, g, b, r + else + offset, maximum, other_1, other_2 = 4, b, r, g + end + if maximum == 0 then + return 0, 0, 0 + end + local minimum = other_1 < other_2 and other_1 or other_2 + if maximum == minimum then + return 0, 0, maximum + end + local delta = maximum - minimum + return (offset + (other_1-other_2)/delta)*60, delta/maximum, maximum +end + +local function graytorgb(s) -- unweighted + return 1-s, 1-s, 1-s +end + +local function hsvtogray(h,s,v) + return rgb_to_gray(hsv_to_rgb(h,s,v)) +end + +local function graytohsv(s) + return 0, 0, s +end + +colors.rgbtocmyk = rgbtocmyk +colors.rgbtogray = rgbtogray +colors.cmyktorgb = cmyktorgb +colors.cmyktogray = cmyktogray +colors.rgbtohsv = rgbtohsv +colors.hsvtorgb = hsvtorgb +colors.hsvtogray = hsvtogray +colors.graytohsv = graytohsv + +-- we can share some *data by using s, rgb and cmyk hashes, but +-- normally the amount of colors is not that large; storing the +-- components costs a bit of extra runtime, but we expect to gain +-- some back because we have them at hand; the number indicates the +-- default color space + +function colors.gray(s) + return { 2, s, s, s, s, 0, 0, 0, 1-s } +end + +function colors.rgb(r,g,b) + local s = rgbtogray(r,g,b) + local c, m, y, k = rgbtocmyk(r,g,b) + return { 3, s, r, g, b, c, m, y, k } +end + +function colors.cmyk(c,m,y,k) + local s = cmyktogray(c,m,y,k) + local r, g, b = cmyktorgb(c,m,y,k) + return { 4, s, r, g, b, c, m, y, k } +end + +--~ function colors.spot(parent,f,d,p) +--~ return { 5, .5, .5, .5, .5, 0, 0, 0, .5, parent, f, d, p } +--~ end + +function colors.spot(parent,f,d,p) + if type(p) == "number" then + local n = list[numbers.color][parent] -- hard coded ref to color number + if n then + local v = values[n] + if v then + -- the via cmyk hack is dirty, but it scales better + local c, m, y, k = p*v[6], p*v[7], p*v[8], p*v[8] + local r, g, b = cmyktorgb(c,m,y,k) + local s = cmyktogray(c,m,y,k) + return { 5, s, r, g, b, c, m, y, k, parent, f, d, p } + end + end + else + -- todo, multitone (maybe p should be a table) + end + return { 5, .5, .5, .5, .5, 0, 0, 0, .5, parent, f, d, p } +end + +local function graycolor(...) graycolor = nodeinjections.graycolor return graycolor(...) end +local function rgbcolor (...) rgbcolor = nodeinjections.rgbcolor return rgbcolor (...) end +local function cmykcolor(...) cmykcolor = nodeinjections.cmykcolor return cmykcolor(...) end +local function spotcolor(...) spotcolor = nodeinjections.spotcolor return spotcolor(...) end + +local function extender(colors,key) + if colors.supported and key == "none" then + local d = graycolor(0) + colors.none = d + return d + end +end + +local function reviver(data,n) + if colors.supported then + local v = values[n] + local d + if not v then + local gray = graycolor(0) + d = { gray, gray, gray, gray } + report_attributes("unable to revive color %s",n or "?") + else + local model = colors.forcedmodel(v[1]) + if model == 2 then + local gray= graycolor(v[2]) + d = { gray, gray, gray, gray } + elseif model == 3 then + local gray, rgb, cmyk = graycolor(v[2]), rgbcolor(v[3],v[4],v[5]), cmykcolor(v[6],v[7],v[8],v[9]) + d = { rgb, gray, rgb, cmyk } + elseif model == 4 then + local gray, rgb, cmyk = graycolor(v[2]), rgbcolor(v[3],v[4],v[5]), cmykcolor(v[6],v[7],v[8],v[9]) + d = { cmyk, gray, rgb, cmyk } + elseif model == 5 then + local spot = spotcolor(v[10],v[11],v[12],v[13]) + -- d = { spot, gray, rgb, cmyk } + d = { spot, spot, spot, spot } + end + end + data[n] = d + return d + end +end + +setmetatableindex(colors, extender) +setmetatableindex(colors.data, reviver) + +function colors.filter(n) + return concat(data[n],":",5) +end + +function colors.setmodel(name,weightgray) + colors.model = name + colors.default = models[name] or 1 + colors.weightgray = weightgray ~= false + return colors.default +end + +function colors.register(name, colorspace, ...) -- passing 9 vars is faster (but not called that often) + local stamp = format(templates[colorspace],...) + local color = registered[stamp] + if not color then + color = #values + 1 + values[color] = colors[colorspace](...) + registered[stamp] = color + -- colors.reviver(color) + end + if name then + list[a_color][name] = color -- not grouped, so only global colors + end + return registered[stamp] +end + +function colors.value(id) + return values[id] +end + +attributes.colors.handler = nodes.installattributehandler { + name = "color", + namespace = colors, + initializer = states.initialize, + finalizer = states.finalize, + processor = states.selective, + resolver = function() return colors.main end, +} + +function colors.enable(value) + if value == false or not colors.supported then + tasks.disableaction("shipouts","attributes.colors.handler") + else + tasks.enableaction("shipouts","attributes.colors.handler") + end +end + +function colors.forcesupport(value) -- can move to attr-div + colors.supported = value + report_colors("color is %ssupported",value and "" or "not ") + colors.enable(value) +end + +-- transparencies + +attributes.transparencies = attributes.transparencies or { } +local transparencies = attributes.transparencies +transparencies.registered = transparencies.registered or { } +transparencies.data = allocate() +transparencies.values = transparencies.values or { } +transparencies.triggering = true +transparencies.attribute = attributes.private('transparency') +transparencies.supported = true + +storage.register("attributes/transparencies/registered", transparencies.registered, "attributes.transparencies.registered") +storage.register("attributes/transparencies/values", transparencies.values, "attributes.transparencies.values") + +local registered = transparencies.registered -- we could use a 2 dimensional table instead +local data = transparencies.data +local values = transparencies.values +local template = "%s:%s" + +local function inject_transparency (...) + inject_transparency = nodeinjections.transparency + return inject_transparency(...) +end + +local function register_transparency(...) + register_transparency = registrations.transparency + return register_transparency(...) +end + +function transparencies.register(name,a,t,force) -- name is irrelevant here (can even be nil) + -- Force needed here for metapost converter. We could always force + -- but then we'd end up with transparencies resources even if we + -- would not use transparencies (but define them only). This is + -- somewhat messy. + local stamp = format(template,a,t) + local n = registered[stamp] + if not n then + n = #values + 1 + values[n] = { a, t } + registered[stamp] = n + if force then + register_transparency(n,a,t) + end + elseif force and not data[n] then + register_transparency(n,a,t) + end + return registered[stamp] +end + +local function extender(transparencies,key) + if colors.supported and key == "none" then + local d = inject_transparency(0) + transparencies.none = d + return d + end +end + +local function reviver(data,n) + if transparencies.supported then + local v = values[n] + local d + if not v then + d = inject_transparency(0) + else + d = inject_transparency(n) + register_transparency(n,v[1],v[2]) + end + data[n] = d + return d + else + return "" + end +end + +setmetatableindex(transparencies, extender) +setmetatableindex(transparencies.data, reviver) -- register if used + +-- check if there is an identity + +function transparencies.value(id) + return values[id] +end + +attributes.transparencies.handler = nodes.installattributehandler { + name = "transparency", + namespace = transparencies, + initializer = states.initialize, + finalizer = states.finalize, + processor = states.process, +} + +function transparencies.enable(value) -- nil is enable + if value == false or not transparencies.supported then + tasks.disableaction("shipouts","attributes.transparencies.handler") + else + tasks.enableaction("shipouts","attributes.transparencies.handler") + end +end + +function transparencies.forcesupport(value) -- can move to attr-div + transparencies.supported = value + report_transparencies("transparency is %ssupported",value and "" or "not ") + transparencies.enable(value) +end + +--- colorintents: overprint / knockout + +attributes.colorintents = attributes.colorintents or { } +local colorintents = attributes.colorintents +colorintents.data = allocate() -- colorintents.data or { } +colorintents.attribute = attributes.private('colorintent') + +colorintents.registered = allocate { + overprint = 1, + knockout = 2, +} + +local data, registered = colorintents.data, colorintents.registered + +local function extender(colorintents,key) + if key == "none" then + local d = data[2] + colorintents.none = d + return d + end +end + +local function reviver(data,n) + if n == 1 then + local d = nodeinjections.overprint() -- called once + data[1] = d + return d + elseif n == 2 then + local d = nodeinjections.knockout() -- called once + data[2] = d + return d + end +end + +setmetatableindex(colorintents, extender) +setmetatableindex(colorintents.data, reviver) + +function colorintents.register(stamp) + return registered[stamp] or registered.overprint +end + +colorintents.handler = nodes.installattributehandler { + name = "colorintent", + namespace = colorintents, + initializer = states.initialize, + finalizer = states.finalize, + processor = states.process, +} + +function colorintents.enable() + tasks.enableaction("shipouts","attributes.colorintents.handler") +end + +-- interface + +commands.enablecolor = colors.enable +commands.enabletransparency = transparencies.enable +commands.enablecolorintents = colorintents.enable + +function commands.registercolor (...) context(colors .register(...)) end +function commands.registertransparency(...) context(transparencies.register(...)) end +function commands.registercolorintent (...) context(colorintents .register(...)) end diff --git a/Master/texmf-dist/tex/context/base/attr-col.mkiv b/Master/texmf-dist/tex/context/base/attr-col.mkiv new file mode 100644 index 00000000000..8d61ee8aeff --- /dev/null +++ b/Master/texmf-dist/tex/context/base/attr-col.mkiv @@ -0,0 +1,82 @@ +%D \module +%D [ file=attr-col, +%D version=2007.06.06, +%D title=\CONTEXT\ Attribute Macros, +%D subtitle=Color, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{ConTeXt Attribute Macros / Color} + +\registerctxluafile{attr-col}{1.001} + +\unprotect + +% todo: no need for 'color' argument, we can set that once at startup; currently +% a bit inconsistent + +% 1=off 2=gray 3=spot 4=rgb 5=cmyk 6=cmy % only 1/2/4/5 are supported +% +% We could combine this in one attribute but this is not faster and also +% less flexible because sometimes we want to freeze the attribute bit. + +% % color (layer on top) +% +% \def\dosetcolormodel#1% overloaded later +% {\ctxcommand{setcolormodel('#1')}} % sets attribute +% +% \dosetcolormodel{all} +% +% \def\registerrgbcolor#1#2#3#4% not used +% {\setevalue{(cs:#1)}{\attribute\colorattribute\ctxcommand{registercolor('#1','rgb' ,#2,#3,#4)}}} +% +% \def\registercmykcolor#1#2#3#4#5% not used +% {\setevalue{(cs:#1)}{\attribute\colorattribute\ctxcommand{registercolor('#1','cmyk',#2,#3,#4,#5)}}} +% +% \def\registergraycolor#1#2% not used +% {\setevalue{(cs:#1)}{\attribute\colorattribute\ctxcommand{registercolor('#1','gray',#2)}}} + +% % transparency (layer on top) +% +% \def\registertransparency#1#2#3% +% {\setevalue{(ts:#1)}{\attribute\transparencyattribute\ctxcommand{registertransparency(#2,#3)} }} +% +% \def\sometransparencyswitch#1% +% {\csname(ts:#1)\endcsname} +% +% \def\sometransparencyswitch +% {\ctxcommand{enabletransparency()}% +% \gdef\sometransparencyswitch##1{\csname(ts:##1)\endcsname}% +% \sometransparencyswitch} +% +% \registertransparency {one} {1} {.5} +% \registertransparency {two} {1} {.6} + +% overprint + +\def\registercolorintent#1#2% + {\setevalue{(os:#1)}{\attribute\colorintentattribute\ctxcommand{registercolorintent('#2')} }} + +\def\dotriggercolorintent + {\ctxcommand{enablecolorintents()}% + \gdef\dotriggercolorintent##1{\csname(os:##1)\endcsname}% + \dotriggercolorintent} + +\registercolorintent{knockout} {knockout} +\registercolorintent{overprint}{overprint} + +\installattributestack\colorintentattribute + +\setevalue{(os:#\v!none}{\attribute\colorintentattribute\attributeunsetvalue} % does this work out ok? + +\protect \endinput + +% test case +% +% {\green \hbox to \hsize{\leaders\hrule \hfill a}\par} +% {\red \hbox to \hsize{\leaders\hbox{x}\hfill a}\par} diff --git a/Master/texmf-dist/tex/context/base/attr-eff.lua b/Master/texmf-dist/tex/context/base/attr-eff.lua new file mode 100644 index 00000000000..023d1c51b53 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/attr-eff.lua @@ -0,0 +1,97 @@ +if not modules then modules = { } end modules ['attr-eff'] = { + version = 1.001, + comment = "companion to attr-eff.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local format = string.format + +local attributes, nodes = attributes, nodes + +local states = attributes.states +local tasks = nodes.tasks +local nodeinjections = backends.nodeinjections +local settexattribute = tex.setattribute +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex + +attributes.effects = attributes.effects or { } +local effects = attributes.effects + +local a_effect = attributes.private('effect') + +effects.data = allocate() +effects.values = effects.values or { } +effects.registered = effects.registered or { } +effects.attribute = a_effect + +storage.register("attributes/effects/registered", effects.registered, "attributes.effects.registered") +storage.register("attributes/effects/values", effects.values, "attributes.effects.values") + +local template = "%s:%s:%s" + +local data = effects.data +local registered = effects.registered +local values = effects.values + +-- valid effects: normal inner outer both hidden (stretch,rulethickness,effect) + +local function effect(...) effect = nodeinjections.effect return effect(...) end + +local function extender(effects,key) + if key == "none" then + local d = effect(0,0,0) + effects.none = d + return d + end +end + +local function reviver(data,n) + local e = values[n] -- we could nil values[n] now but hardly needed + local d = effect(e[1],e[2],e[3]) + data[n] = d + return d +end + +setmetatableindex(effects, extender) +setmetatableindex(effects.data, reviver) + +effects.handler = nodes.installattributehandler { + name = "effect", + namespace = effects, + initializer = states.initialize, + finalizer = states.finalize, + processor = states.process, +} + +local function register(effect,stretch,rulethickness) + local stamp = format(template,effect,stretch,rulethickness) + local n = registered[stamp] + if not n then + n = #values + 1 + values[n] = { effect, stretch, rulethickness } + registered[stamp] = n + end + return n +end + +local function enable() + tasks.enableaction("shipouts","attributes.effects.handler") +end + +effects.register = register +effects.enable = enable + +-- interface + +local enabled = false + +function commands.triggereffect(effect,stretch,rulethickness) + if not enabled then + enable() + enabled = true + end + settexattribute(a_effect,register(effect,stretch,rulethickness)) +end diff --git a/Master/texmf-dist/tex/context/base/attr-eff.mkiv b/Master/texmf-dist/tex/context/base/attr-eff.mkiv new file mode 100644 index 00000000000..3526276c7e7 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/attr-eff.mkiv @@ -0,0 +1,74 @@ +%D \module +%D [ file=attr-eff, +%D version=2007.06.06, +%D title=\CONTEXT\ Attribute Macros, +%D subtitle=Effects, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{ConTeXt Attribute Macros / Effects} + +\registerctxluafile{attr-eff}{1.001} + +\unprotect + +% \def\registereffect#1#2#3% #2=stretch #3=rulethickness +% {\setxvalue{(es:#1:#2:\number\dimexpr#3\relax)}% todo: set attribute at lua end +% {\attribute\effectattribute\ctxcommand{registereffect('#1',#2,\number\dimexpr#3\relax)}\relax}} +% +% \def\dotriggereffect +% {\ctxcommand{enableeffect()}% can then move to caller +% \gdef\dotriggereffect##1##2##3% +% {\ifcsname(es:##1:##2:\number\dimexpr##3\relax)\endcsname\else\registereffect{##1}{##2}{##3}\fi +% \csname(es:##1:##2:\number\dimexpr##3\relax)\endcsname}% +% \dotriggereffect} +% +% \def\registereffect#1#2#3% #2=stretch #3=rulethickness +% {\setxvalue{(es:#1:#2:\number\dimexpr#3\relax)}% todo: set attribute at lua end +% {\attribute\effectattribute\ctxcommand{registereffect('#1',#2,\number\dimexpr#3\relax)}\relax}} + +\gdef\dotriggereffect#1#2#3% + {\ctxcommand{triggereffect('#1',#2,\number\dimexpr#3\relax)}} + +\unexpanded\def\setupeffect + {\dodoubleargument\dosetupeffect} + +\def\dosetupeffect[#1][#2]% + {\getparameters[\??et#1][#2]} + +\unexpanded\def\defineeffect + {\dodoubleargument\dodefineeffect} + +\def\dodefineeffect[#1][#2]% + {\getparameters[\??et#1][\c!method=\v!none,\c!stretch=0,\c!rulethickness=\zeropoint,\c!alternative=\v!normal,#2]% + \doif{\getvalue{\??et#1\c!method}}\v!command + {\setugvalue{\e!start#1}{\starteffect[#1]}% + \setugvalue{\e!stop #1}{\stopeffect}}} + +% yes or no grouped + +\unexpanded\def\starteffect[#1]% + {\dotriggereffect + {\csname\??et#1\c!alternative \endcsname}% + {\csname\??et#1\c!stretch \endcsname}% + {\csname\??et#1\c!rulethickness\endcsname}} + +\unexpanded\def\stopeffect % can be special + {\dotriggereffect\v!normal0\zeropoint} + +\unexpanded\def\effect[#1]% + {\groupedcommand{\starteffect[#1]}{\stopeffect}} + +\defineeffect [\v!inner] [\c!alternative=\v!inner,\c!rulethickness=.25pt] +\defineeffect [\v!outer] [\c!alternative=\v!outer,\c!rulethickness=.25pt] +\defineeffect [\v!both] [\c!alternative=\v!both, \c!rulethickness=.25pt] +\defineeffect [\v!normal] [\c!alternative=\v!normal] +\defineeffect [\v!hidden] [\c!alternative=\v!hidden] +\defineeffect [\v!stretch] [\c!alternative=\v!stretch,\c!stretch=1] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/attr-ini.lua b/Master/texmf-dist/tex/context/base/attr-ini.lua index 81c2f4744ca..96d7c7228c7 100644 --- a/Master/texmf-dist/tex/context/base/attr-ini.lua +++ b/Master/texmf-dist/tex/context/base/attr-ini.lua @@ -6,643 +6,101 @@ if not modules then modules = { } end modules ['attr-ini'] = { license = "see context related readme files" } --- this module is being reconstructed --- we can also do the nsnone via a metatable and then also se index 0 +local next, type = next, type -local type = type -local format, gmatch = string.format, string.gmatch -local concat = table.concat -local texsprint = tex.sprint +--[[ldx-- +

We start with a registration system for atributes so that we can use the +symbolic names later on.

+--ldx]]-- -local ctxcatcodes = tex.ctxcatcodes -local unsetvalue = attributes.unsetvalue +attributes = attributes or { } --- todo: document this but first reimplement this as it reflects the early --- days of luatex / mkiv and we have better ways now +local attributes, nodes = attributes, nodes --- nb: attributes: color etc is much slower than normal (marks + literals) but ... --- nb. too many "0 g"s +-- todo: local and then gobals ... first loaded anyway -nodes = nodes or { } -states = states or { } -shipouts = shipouts or { } +attributes.names = attributes.names or { } +attributes.numbers = attributes.numbers or { } +attributes.list = attributes.list or { } +attributes.states = attributes.states or { } +attributes.handlers = attributes.handlers or { } +attributes.unsetvalue = -0x7FFFFFFF --- We can distinguish between rules and glyphs but it's not worth the trouble. A --- first implementation did that and while it saves a bit for glyphs and rules, it --- costs more resourses for transparencies. So why bother. +local names, numbers, list = attributes.names, attributes.numbers, attributes.list --- --- colors --- - --- we can also collapse the two attributes: n, n+1, n+2 and then --- at the tex end add 0, 1, 2, but this is not faster and less --- flexible (since sometimes we freeze color attribute values at --- the lua end of the game --- --- we also need to store the colorvalues because we need then in mp --- --- This is a compromis between speed and simplicity. We used to store the --- values and data in one array, which made in neccessary to store the --- converters that need node constructor into strings and evaluate them --- at runtime (after reading from storage). Think of: --- --- colors.strings = colors.strings or { } --- --- if environment.initex then --- colors.strings[color] = "return colors." .. colorspace .. "(" .. concat({...},",") .. ")" --- end --- --- storage.register("colors/data", colors.strings, "colors.data") -- evaluated --- --- We assume that only processcolors are defined in the format. - -colors = colors or { } -colors.data = colors.data or { } -colors.values = colors.values or { } -colors.registered = colors.registered or { } - -colors.weightgray = true -colors.attribute = attributes.private('color') -colors.selector = attributes.private('colormodel') -colors.default = 1 -colors.main = nil -colors.triggering = true - -storage.register("colors/values", colors.values, "colors.values") -storage.register("colors/registered", colors.registered, "colors.registered") - -local templates = { - rgb = "r:%s:%s:%s", - cmyk = "c:%s:%s:%s:%s", - gray = "s:%s", - spot = "p:%s:%s:%s:%s" -} - -local models = { - [interfaces.variables.none] = unsetvalue, - black = unsetvalue, - bw = unsetvalue, - all = 1, - gray = 2, - rgb = 3, - cmyk = 4, -} - -colors.model = "all" - -local data = colors.data -local values = colors.values -local registered = colors.registered - -local numbers = attributes.numbers -local list = attributes.list - -local min, max, floor = math.min, math.max, math.floor - -local nodeinjections = backends.nodeinjections -local codeinjections = backends.codeinjections -local registrations = backends.registrations - -local function rgbtocmyk(r,g,b) -- we could reduce - return 1-r, 1-g, 1-b, 0 -end - -local function cmyktorgb(c,m,y,k) - return 1.0 - min(1.0,c+k), 1.0 - min(1.0,m+k), 1.0 - min(1.0,y+k) -end - -local function rgbtogray(r,g,b) - if colors.weightgray then - return .30*r+.59*g+.11*b - else - return r/3+g/3+b/3 - end -end - -local function cmyktogray(c,m,y,k) - return rgbtogray(cmyktorgb(c,m,y,k)) -end - --- http://en.wikipedia.org/wiki/HSI_color_space --- http://nl.wikipedia.org/wiki/HSV_(kleurruimte) - - -local function hsvtorgb(h,s,v) - -- h = h % 360 - local hd = h/60 - local hf = floor(hd) - local hi = hf % 6 - -- local f = hd - hi - local f = hd - hf - local p = v * (1 - s) - local q = v * (1 - f * s) - local t = v * (1 - (1 - f) * s) - if hi == 0 then - return v, t, p - elseif hi == 1 then - return q, v, p - elseif hi == 2 then - return p, v, t - elseif hi == 3 then - return p, q, v - elseif hi == 4 then - return t, p, v - elseif hi == 5 then - return v, p, q - else - print("error in hsv -> rgb",hi,h,s,v) - end -end - -function rgbtohsv(r,g,b) - local offset, maximum, other_1, other_2 - if r >= g and r >= b then - offset, maximum, other_1, other_2 = 0, r, g, b - elseif g >= r and g >= b then - offset, maximum, other_1, other_2 = 2, g, b, r - else - offset, maximum, other_1, other_2 = 4, b, r, g - end - if maximum == 0 then - return 0, 0, 0 - end - local minimum = other_1 < other_2 and other_1 or other_2 - if maximum == minimum then - return 0, 0, maximum - end - local delta = maximum - minimum - return (offset + (other_1-other_2)/delta)*60, delta/maximum, maximum -end - -function graytorgb(s) -- unweighted - return 1-s, 1-s, 1-s -end +storage.register("attributes/names", names, "attributes.names") +storage.register("attributes/numbers", numbers, "attributes.numbers") +storage.register("attributes/list", list, "attributes.list") -function hsvtogray(h,s,v) - return rgb_to_gray(hsv_to_rgb(h,s,v)) -end - -function grayto_hsv(s) - return 0, 0, s -end - -colors.rgbtocmyk = rgbtocmyk -colors.rgbtogray = rgbtogray -colors.cmyktorgb = cmyktorgb -colors.cmyktogray = cmyktogray -colors.rgbtohsv = rgbtohsv -colors.hsvtorgb = hsvtorgb -colors.hsvtogray = hsvtogray -colors.graytohsv = graytohsv - --- we can share some *data by using s, rgb and cmyk hashes, but --- normally the amount of colors is not that large; storing the --- components costs a bit of extra runtime, but we expect to gain --- some back because we have them at hand; the number indicates the --- default color space - -function colors.gray(s) - return { 2, s, s, s, s, 0, 0, 0, 1-s } -end - -function colors.rgb(r,g,b) - local s = rgbtogray(r,g,b) - local c, m, y, k = rgbtocmyk(r,g,b) - return { 3, s, r, g, b, c, m, y, k } -end - -function colors.cmyk(c,m,y,k) - local s = cmyktogray(c,m,y,k) - local r, g, b = cmyktorgb(c,m,y,k) - return { 4, s, r, g, b, c, m, y, k } -end - ---~ function colors.spot(parent,f,d,p) ---~ return { 5, .5, .5, .5, .5, 0, 0, 0, .5, parent, f, d, p } ---~ end - -function colors.spot(parent,f,d,p) - if type(p) == "number" then - local n = list[numbers.color][parent] -- hard coded ref to color number - if n then - local v = values[n] - if v then - -- the via cmyk hack is dirty, but it scales better - local c, m, y, k = p*v[6], p*v[7], p*v[8], p*v[8] - local r, g, b = cmyktorgb(c,m,y,k) - local s = cmyktogray(c,m,y,k) - return { 5, s, r, g, b, c, m, y, k, parent, f, d, p } - end - end - else - -- todo, multitone (maybe p should be a table) +function attributes.define(name,number) -- at the tex end + if not numbers[name] then + numbers[name], names[number], list[number] = number, name, { } end - return { 5, .5, .5, .5, .5, 0, 0, 0, .5, parent, f, d, p } end -local function graycolor(...) graycolor = nodeinjections.graycolor return graycolor(...) end -local function rgbcolor (...) rgbcolor = nodeinjections.rgbcolor return rgbcolor (...) end -local function cmykcolor(...) cmykcolor = nodeinjections.cmykcolor return cmykcolor(...) end -local function spotcolor(...) spotcolor = nodeinjections.spotcolor return spotcolor(...) end +--[[ldx-- +

We can use the attributes in the range 127-255 (outside user space). These +are only used when no attribute is set at the \TEX\ end which normally +happens in .

+--ldx]]-- -local function extender(colors,key) - if key == "none" then - local d = graycolor(0) - colors.none = d - return d - end -end +storage.shared.attributes_last_private = storage.shared.attributes_last_private or 127 -local function reviver(data,n) - local v = values[n] - local d - if not v then - local gray = graycolor(0) - d = { gray, gray, gray, gray } - logs.report("attributes","unable to revive color %s",n or "?") - else - local kind = v[1] - if kind == 2 then - local gray= graycolor(v[2]) - d = { gray, gray, gray, gray } - elseif kind == 3 then - local gray, rgb, cmyk = graycolor(v[2]), rgbcolor(v[3],v[4],v[5]), cmykcolor(v[6],v[7],v[8],v[9]) - d = { rgb, gray, rgb, cmyk } - elseif kind == 4 then - local gray, rgb, cmyk = graycolor(v[2]), rgbcolor(v[3],v[4],v[5]), cmykcolor(v[6],v[7],v[8],v[9]) - d = { cmyk, gray, rgb, cmyk } - elseif kind == 5 then - local spot = spotcolor(v[10],v[11],v[12],v[13]) - -- d = { spot, gray, rgb, cmyk } - d = { spot, spot, spot, spot } +-- to be considered (so that we can use an array access): +-- +-- local private = { } attributes.private = private +-- +-- setmetatable(private, { +-- __index = function(t,name) +-- local number = storage.shared.attributes_last_private or 127 +-- if number < 1023 then -- tex.count.minallocatedattribute - 1 +-- number = number + 1 +-- storage.shared.attributes_last_private = number +-- end +-- numbers[name], names[number], list[number] = number, name, { } +-- private[name] = number +-- return number +-- end, +-- __call = function(t,name) +-- return t[name] +-- end +-- } ) + +function attributes.private(name) -- at the lua end (hidden from user) + local number = numbers[name] + if not number then + local last = storage.shared.attributes_last_private or 127 + if last < 1023 then -- tex.count.minallocatedattribute - 1 + last = last + 1 + storage.shared.attributes_last_private = last + else + report_attribute("no more room for private attributes") -- fatal + os.exit() end + number = last + numbers[name], names[number], list[number] = number, name, { } end - data[n] = d - return d -end - -setmetatable(colors, { __index = extender }) -setmetatable(colors.data, { __index = reviver }) - -function colors.filter(n) - return concat(data[n],":",5) -end - -function colors.setmodel(name,weightgray) - colors.model = name - colors.default = models[name] or 1 - colors.weightgray = weightgray ~= false - return colors.default -end - -function colors.register(name, colorspace, ...) -- passing 9 vars is faster (but not called that often) - local stamp = format(templates[colorspace],...) - local color = registered[stamp] - if not color then - color = #values + 1 - values[color] = colors[colorspace](...) - registered[stamp] = color - -- colors.reviver(color) - end - if name then - list[colors.attribute][name] = color -- not grouped, so only global colors - end - return registered[stamp] + return number end -function colors.value(id) - return values[id] -end - -shipouts.handle_color = nodes.install_attribute_handler { - name = "color", - namespace = colors, - initializer = states.initialize, - finalizer = states.finalize, - processor = states.selective, - resolver = function() return colors.main end, -} - -function colors.enable() - tasks.enableaction("shipouts","shipouts.handle_color") -end +-- new (actually a tracer) --- transparencies - -transparencies = transparencies or { } -transparencies.registered = transparencies.registered or { } -transparencies.data = transparencies.data or { } -transparencies.values = transparencies.values or { } -transparencies.triggering = true -transparencies.attribute = attributes.private('transparency') - -storage.register("transparencies/registered", transparencies.registered, "transparencies.registered") -storage.register("transparencies/values", transparencies.values, "transparencies.values") - -local registered = transparencies.registered -- we could use a 2 dimensional table instead -local data = transparencies.data -local values = transparencies.values -local template = "%s:%s" - -local function inject_transparency (...) - inject_transparency = nodeinjections.transparency - return inject_transparency(...) -end - -local function register_transparency(...) - register_transparency = registrations.transparency - return register_transparency(...) -end - -function transparencies.register(name,a,t,force) -- name is irrelevant here (can even be nil) - -- Force needed here for metapost converter. We could always force - -- but then we'd end up with transparencies resources even if we - -- would not use transparencies (but define them only). This is - -- somewhat messy. - local stamp = format(template,a,t) - local n = registered[stamp] - if not n then - n = #values + 1 - values[n] = { a, t } - registered[stamp] = n - if force then - register_transparency(n,a,t) +function attributes.ofnode(n) + local a = n.attr + if a then + a = a.next + while a do + local number, value = a.number, a.value + texio.write_nl(format("%s : attribute %3i, value %4i, name %s",tostring(n),number,value,names[number] or '?')) + a = a.next end - elseif force and not data[n] then - register_transparency(n,a,t) - end - return registered[stamp] -end - -local function extender(transparencies,key) - if key == "none" then - local d = inject_transparency(0) - transparencies.none = d - return d - end -end - -local function reviver(data,n) - local v = values[n] - local d - if not v then - d = inject_transparency(0) - else - d = inject_transparency(n) - register_transparency(n,v[1],v[2]) - end - data[n] = d - return d -end - -setmetatable(transparencies, { __index = extender }) -setmetatable(transparencies.data, { __index = reviver }) -- register if used - --- check if there is an identity - -function transparencies.value(id) - return values[id] -end - -shipouts.handle_transparency = nodes.install_attribute_handler { - name = "transparency", - namespace = transparencies, - initializer = states.initialize, - finalizer = states.finalize, - processor = states.process, -} - -function transparencies.enable() - tasks.enableaction("shipouts","shipouts.handle_transparency") -end - ---- colorintents: overprint / knockout - -colorintents = colorintents or { } -colorintents.data = colorintents.data or { } -colorintents.attribute = attributes.private('colorintent') - -colorintents.registered = { - overprint = 1, - knockout = 2, -} - -local data, registered = colorintents.data, colorintents.registered - -local function extender(colorintents,key) - if key == "none" then - local d = data[2] - colorintents.none = d - return d - end -end - -local function reviver(data,n) - if n == 1 then - local d = nodeinjections.overprint() -- called once - data[1] = d - return d - elseif n == 2 then - local d = nodeinjections.knockout() -- called once - data[2] = d - return d - end -end - -setmetatable(colorintents, { __index = extender }) -setmetatable(colorintents.data, { __index = reviver }) - -function colorintents.register(stamp) - return registered[stamp] or registered.overprint -end - -shipouts.handle_colorintent = nodes.install_attribute_handler { - name = "colorintent", - namespace = colorintents, - initializer = states.initialize, - finalizer = states.finalize, - processor = states.process, -} - -function colorintents.enable() - tasks.enableaction("shipouts","shipouts.handle_colorintent") -end - ---- negative / positive - -negatives = negatives or { } -negatives.data = negatives.data or { } -negatives.attribute = attributes.private("negative") - -negatives.registered = { - positive = 1, - negative = 2, -} - -local data, registered = negatives.data, negatives.registered - -local function extender(negatives,key) - if key == "none" then - local d = data[1] - negatives.none = d - return d - end -end - -local function reviver(data,n) - if n == 1 then - local d = nodeinjections.positive() -- called once - data[1] = d - return d - elseif n == 2 then - local d = nodeinjections.negative() -- called once - data[2] = d - return d - end + end end -setmetatable(negatives, { __index = extender }) -setmetatable(negatives.data, { __index = reviver }) +-- interface -function negatives.register(stamp) - return registered[stamp] or registered.positive -end - -shipouts.handle_negative = nodes.install_attribute_handler { - name = "negative", - namespace = negatives, - initializer = states.initialize, - finalizer = states.finalize, - processor = states.process, -} - -function negatives.enable() - tasks.enableaction("shipouts","shipouts.handle_negative") -end - --- effects -- can be optimized (todo: metatables) - -effects = effects or { } -effects.data = effects.data or { } -effects.values = effects.values or { } -effects.registered = effects.registered or { } -effects.stamp = "%s:%s:%s" -effects.attribute = attributes.private("effect") - -storage.register("effects/registered", effects.registered, "effects.registered") -storage.register("effects/values", effects.values, "effects.values") - -local data, registered, values = effects.data, effects.registered, effects.values - --- valid effects: normal inner outer both hidden (stretch,rulethickness,effect) - -local function effect(...) effect = nodeinjections.effect return effect(...) end - -local function extender(effects,key) - if key == "none" then - local d = effect(0,0,0) - effects.none = d - return d - end -end - -local function reviver(data,n) - local e = values[n] -- we could nil values[n] now but hardly needed - local d = effect(e[1],e[2],e[3]) - data[n] = d - return d -end - -setmetatable(effects, { __index = extender }) -setmetatable(effects.data, { __index = reviver }) - -function effects.register(effect,stretch,rulethickness) - local stamp = format(effects.stamp,effect,stretch,rulethickness) - local n = registered[stamp] - if not n then - n = #values + 1 - values[n] = { effect, stretch, rulethickness } - registered[stamp] = n - end - return n -end - -shipouts.handle_effect = nodes.install_attribute_handler { - name = "effect", - namespace = effects, - initializer = states.initialize, - finalizer = states.finalize, - processor = states.process, -} - -function effects.enable() - tasks.enableaction("shipouts","shipouts.handle_effect") -end - --- layers (ugly code, due to no grouping and such); currently we use exclusive layers --- but when we need it stacked layers might show up too; the next function based --- approach can be replaced by static (metatable driven) resolvers - -viewerlayers = viewerlayers or { } -viewerlayers.data = viewerlayers.data or { } -viewerlayers.registered = viewerlayers.registered or { } -viewerlayers.values = viewerlayers.values or { } -viewerlayers.listwise = viewerlayers.listwise or { } -viewerlayers.attribute = attributes.private("viewerlayer") - -storage.register("viewerlayers/registered", viewerlayers.registered, "viewerlayers.registered") -storage.register("viewerlayers/values", viewerlayers.values, "viewerlayers.values") - -local data = viewerlayers.data -local values = viewerlayers.values -local listwise = viewerlayers.listwise -local registered = viewerlayers.registered -local template = "%s" - --- stacked - -local function extender(viewerlayers,key) - if key == "none" then - local d = nodeinjections.stoplayer() - viewerlayers.none = d - return d - end -end - -local function reviver(data,n) - local d = nodeinjections.startlayer(values[n]) - data[n] = d - return d -end - -setmetatable(viewerlayers, { __index = extender }) -setmetatable(viewerlayers.data, { __index = reviver }) - -local function initializer(...) - return states.initialize(...) -end - -viewerlayers.register = function(name,lw) -- if not inimode redefine data[n] in first call - local stamp = format(template,name) - local n = registered[stamp] - if not n then - n = #values + 1 - values[n] = name - registered[stamp] = n - listwise[n] = lw or false - end - return registered[stamp] -- == n -end - -shipouts.handle_viewerlayer = nodes.install_attribute_handler { - name = "viewerlayer", - namespace = viewerlayers, - initializer = initializer, - finalizer = states.finalize, - processor = states.stacked, -} +commands.defineattribute = attributes.define -function viewerlayers.enable() - tasks.enableaction("shipouts","shipouts.handle_viewerlayer") +function commands.getprivateattribute(name) + context(attributes.private(name)) end diff --git a/Master/texmf-dist/tex/context/base/attr-ini.mkiv b/Master/texmf-dist/tex/context/base/attr-ini.mkiv index 87d06c48a44..ba6ca369fc5 100644 --- a/Master/texmf-dist/tex/context/base/attr-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/attr-ini.mkiv @@ -14,14 +14,13 @@ \writestatus{loading}{ConTeXt Attribute Macros / Initialization} %D Although it's still somewhat experimental, here we introduce code -%D related to attributes. +%D related to attributes. Housekeeping will move completely to Lua +%D and \newattribute will go away. \unprotect \registerctxluafile{attr-ini}{1.001} -%D This might move: - \def\pushattribute#1% {\global\advance\csname\??ae:\string#1\endcsname\plusone \global\expandafter\mathchardef\csname\??ae:\string#1:\number\csname\??ae:\string#1\endcsname\endcsname\attribute#1} @@ -33,138 +32,64 @@ \def\installattributestack#1% {\expandafter\newcount\csname\??ae:\string#1\endcsname} -%D For the moment we put this here (later it will move to where it's used): - -\definesystemattribute[state] -\definesystemattribute[skip] -\definesystemattribute[penalty] -\definesystemattribute[colormodel][global] \chardef\colormodelattribute \dogetattributeid{colormodel} -\definesystemattribute[color] \chardef\colorattribute \dogetattributeid{color} -\definesystemattribute[transparency] \chardef\transparencyattribute \dogetattributeid{transparency} -\definesystemattribute[background] \chardef\backgroundattribute \dogetattributeid{background} -\definesystemattribute[colorintent] \chardef\colorintentattribute \dogetattributeid{colorintent} -\definesystemattribute[negative] \chardef\negativeattribute \dogetattributeid{negative} -\definesystemattribute[effect] \chardef\effectattribute \dogetattributeid{effect} -\definesystemattribute[viewerlayer] \chardef\viewerlayerattribute \dogetattributeid{viewerlayer} -\definesystemattribute[layoutcomponent] \chardef\layoutcomponentattribute\dogetattributeid{layoutcomponent} -\definesystemattribute[reference] \chardef\referenceattribute \dogetattributeid{reference} -\definesystemattribute[destination] \chardef\destinationattribute \dogetattributeid{destination} -\definesystemattribute[graphicvadjust] \chardef\graphicvadjustattribute \dogetattributeid{graphicvadjust} -\definesystemattribute[ruled] \chardef\ruledattribute \dogetattributeid{ruled} -\definesystemattribute[shifted] \chardef\shiftedattribute \dogetattributeid{shifted} - -% \definesystemattribute[ignore] -% -% \edef\startignorecontent{\dosetattribute{ignore}\plusone} -% \edef\stopignorecontent {\doresetattribute{ignore}} - -% todo: no need for 'color' argument, we can set that once at startup; currently -% a bit inconsistent - -% 1=off 2=gray 3=spot 4=rgb 5=cmyk 6=cmy % only 1/2/4/5 are supported -% -% We could combine this in one attribute but this is not faster and also -% less flexible because sometimes we want to freeze the attribute bit. -% -% Watch out: real color support will be implemented later. - -\newcount\currentcolormodel - -\def\dosetcolormodel#1% - {\currentcolormodel\ctxlua{tex.print(colors.setmodel('#1'))}% - \attribute\colormodelattribute\currentcolormodel} - -\dosetcolormodel{all} - -\appendtoks - \dosetcolormodel{all}% redundant? -\to \everyjob - -\def\registerrgbcolor #1#2#3#4{\ctxlua{colors.register('#1','rgb' ,#2,#3,#4)}} -\def\registercmykcolor#1#2#3#4#5{\ctxlua{colors.register('#1','cmyk',#2,#3,#4,#5)}} -\def\registergraycolor #1#2{\ctxlua{colors.register('#1','gray',#2)}} - -% transparency - -\def\registertransparency#1#2#3% - {\setevalue{(ts:#1)}{\attribute\transparencyattribute\ctxlua{tex.write(transparencies.register(#2,#3))} }} +\newtoks \attributesresetlist -\def\sometransparencyswitch#1{\csname(ts:#1)\endcsname} +\ifdefined \s!global \else \def\s!global{global} \fi % for metatex % or hard check later +\ifdefined \s!public \else \def\s!public{public} \fi % for metatex % or hard check later -\def\sometransparencyswitch - {\ctxlua{transparencies.enable()}% - \gdef\sometransparencyswitch##1{\csname(ts:##1)\endcsname}% - \sometransparencyswitch} +\unexpanded\def\defineattribute + {\dodoubleempty\dodefineattribute} -% \registertransparency {one} {1} {.5} -% \registertransparency {two} {1} {.6} +\def\dodefineattribute[#1][#2]% alternatively we can let lua do the housekeeping + {\expandafter\newattribute\csname @attr@#1\endcsname + \expandafter\newconstant \csname :attr:#1\endcsname + \csname :attr:#1\endcsname\lastallocatedattribute + \ctxcommand{defineattribute("#1",\number\lastallocatedattribute)}% + %\writestatus\m!system{defining attribute #1 with number \number\lastallocatedattribute}% + \doifnotinset\s!global{#2}{\appendetoks\csname @attr@#1\endcsname\attributeunsetvalue\to\attributesresetlist}% + \doifinset \s!public{#2}{\expandafter\let\csname#1attribute\expandafter\endcsname\csname :attr:#1\endcsname}} -% overprint +\unexpanded\def\definesystemattribute + {\dodoubleempty\dodefinesystemattribute} -\def\registercolorintent#1#2% - {\setevalue{(os:#1)}{\attribute\colorintentattribute\ctxlua{tex.write(colorintents.register('#2'))} }} +\def\dodefinesystemattribute[#1][#2]% alternatively we can let lua do the housekeeping + {\scratchcounter\ctxcommand{getprivateattribute("#1")}\relax + \expandafter\attributedef\csname @attr@#1\endcsname\scratchcounter + \expandafter\newconstant \csname :attr:#1\endcsname + \csname :attr:#1\endcsname\scratchcounter + %\writestatus\m!system{defining system attribute #1 with number \number\scratchcounter}% + \doifnotinset\s!global{#2}{\appendetoks\csname @attr@#1\endcsname\attributeunsetvalue\to\attributesresetlist}% + \doifinset \s!public{#2}{\expandafter\let\csname#1attribute\expandafter\endcsname\csname :attr:#1\endcsname}} -\def\dotriggercolorintent - {\ctxlua{colorintents.enable()}% - \gdef\dotriggercolorintent##1{\csname(os:##1)\endcsname}% - \dotriggercolorintent} +% expandable so we can \edef them for speed -\registercolorintent{knockout} {knockout} -\registercolorintent{overprint}{overprint} +\def\dosetattribute#1#2{\csname @attr@#1\endcsname#2\relax} +\def\doresetattribute#1{\csname @attr@#1\endcsname\attributeunsetvalue} +\def\dogetattribute #1{\number\csname @attr@#1\endcsname} +\def\dogetattributeid#1{\number\csname :attr:#1\endcsname} -\installattributestack\colorintentattribute +\let\dompattribute\gobbletwoarguments -\setevalue{(os:#\v!none}{\attribute\colorintentattribute\attributeunsetvalue} % does this work out ok? +\def\resetallattributes{\the\attributesresetlist} -% negative - -\def\registernegative#1#2% - {\setevalue{(ns:#1)}{\attribute\negativeattribute\ctxlua{tex.write(negatives.register('#2'))} }} - -\def\dotriggernegative - {\ctxlua{negatives.enable()}% - \gdef\dotriggernegative##1{\csname(ns:##1)\endcsname}% - \dotriggernegative} - -\registernegative{positive}{positive} -\registernegative{negative}{negative} - -% effect - -\def\registereffect#1#2#3% #2=stretch #3=rulethickness - {\setxvalue{(es:#1:#2:\number\dimexpr#3\relax)}% - {\attribute\effectattribute\ctxlua{tex.write(effects.register('#1',#2,\number\dimexpr#3\relax))} }} - -\def\dotriggereffect - {\ctxlua{effects.enable()}% - \gdef\dotriggereffect##1##2##3% - {\ifcsname(es:##1:##2:\number\dimexpr##3\relax)\endcsname\else\registereffect{##1}{##2}{##3}\fi - \csname(es:##1:##2:\number\dimexpr##3\relax)\endcsname}% - \dotriggereffect} - -% \registereffect{normal} -% \registereffect{inner} -% \registereffect{outer} -% \registereffect{both} -% \registereffect{hidden} - -% viewerlayers (will probably change a bit) - -% needs to work over stopitemize grouping etc - -\def\registerviewerlayer#1#2% global ! - {\setxvalue{(vl:#1)}{\global\attribute\viewerlayerattribute\ctxlua{tex.write(viewerlayers.register('#2'))} }} - -\setevalue{(vl:)}{\global\attribute\viewerlayerattribute\attributeunsetvalue} +%D For the moment we put this here (later it will move to where it's used): -\def\dotriggerviewerlayer - {\ctxlua{viewerlayers.enable()}% - \gdef\dotriggerviewerlayer##1{\csname(vl:##1)\endcsname}% - \dotriggerviewerlayer} +\definesystemattribute [state] +\definesystemattribute [skip] +\definesystemattribute [penalty] +\definesystemattribute [colormodel] [public,global] +\definesystemattribute [color] [public] +\definesystemattribute [transparency] [public] +\definesystemattribute [background] [public] +\definesystemattribute [colorintent] [public] +\definesystemattribute [negative] [public] +\definesystemattribute [effect] [public] +\definesystemattribute [viewerlayer] [public] +\definesystemattribute [layoutcomponent] [public] +\definesystemattribute [reference] [public] +\definesystemattribute [destination] [public] +\definesystemattribute [internal] [public] +\definesystemattribute [ruled] [public] +\definesystemattribute [shifted] [public] \protect \endinput - -% test case -% -% {\green \hbox to \hsize{\leaders\hrule \hfill a}\par} -% {\red \hbox to \hsize{\leaders\hbox{x}\hfill a}\par} diff --git a/Master/texmf-dist/tex/context/base/attr-lay.lua b/Master/texmf-dist/tex/context/base/attr-lay.lua new file mode 100644 index 00000000000..e12938fa45e --- /dev/null +++ b/Master/texmf-dist/tex/context/base/attr-lay.lua @@ -0,0 +1,191 @@ +if not modules then modules = { } end modules ['attr-lay'] = { + version = 1.001, + comment = "companion to attr-lay.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- layers (ugly code, due to no grouping and such); currently we use exclusive layers +-- but when we need it stacked layers might show up too; the next function based +-- approach can be replaced by static (metatable driven) resolvers + +local type = type +local format = string.format +local insert, remove = table.insert, table.remove + +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex + +local report_viewerlayers = logs.reporter("viewerlayers") + +-- todo: document this but first reimplement this as it reflects the early +-- days of luatex / mkiv and we have better ways now + +-- nb: attributes: color etc is much slower than normal (marks + literals) but ... +-- nb. too many "0 g"s +-- nb: more local tables + +local attributes, nodes = attributes, nodes + +attributes.viewerlayers = attributes.viewerlayers or { } +local viewerlayers = attributes.viewerlayers + +local variables = interfaces.variables +local v_local = variables["local"] +local v_global = variables["global"] + +local a_viewerlayer = attributes.private("viewerlayer") + +viewerlayers = viewerlayers or { } +viewerlayers.data = allocate() +viewerlayers.registered = viewerlayers.registered or { } +viewerlayers.values = viewerlayers.values or { } +viewerlayers.scopes = viewerlayers.scopes or { } +viewerlayers.listwise = allocate() +viewerlayers.attribute = a_viewerlayer +viewerlayers.supported = true +viewerlayers.hasorder = true + +local states = attributes.states +local tasks = nodes.tasks +local nodeinjections = backends.nodeinjections +local codeinjections = backends.codeinjections + +local texsetattribute = tex.setattribute +local texgetattribute = tex.getattribute +local texsettokenlist = tex.settoks +local unsetvalue = attributes.unsetvalue + +storage.register("attributes/viewerlayers/registered", viewerlayers.registered, "attributes.viewerlayers.registered") +storage.register("attributes/viewerlayers/values", viewerlayers.values, "attributes.viewerlayers.values") +storage.register("attributes/viewerlayers/scopes", viewerlayers.scopes, "attributes.viewerlayers.scopes") + +local data = viewerlayers.data +local values = viewerlayers.values +local listwise = viewerlayers.listwise +local registered = viewerlayers.registered +local scopes = viewerlayers.scopes +local template = "%s" + +-- stacked + +local function extender(viewerlayers,key) + if viewerlayers.supported and key == "none" then + local d = nodeinjections.stoplayer() + viewerlayers.none = d + return d + end +end + +local function reviver(data,n) + if viewerlayers.supported then + local v = values[n] + if v then + local d = nodeinjections.startlayer(v) + data[n] = d + return d + else + report_viewerlayers("error, unknown reference '%s'",tostring(n)) + end + end +end + +setmetatableindex(viewerlayers, extender) +setmetatableindex(viewerlayers.data, reviver) + +local function initializer(...) + return states.initialize(...) +end + +local function register(name,lw) -- if not inimode redefine data[n] in first call + local stamp = format(template,name) + local n = registered[stamp] + if not n then + n = #values + 1 + values[n] = name + registered[stamp] = n + listwise[n] = lw or false + end + return registered[stamp] -- == n +end + +viewerlayers.register = register + +attributes.viewerlayers.handler = nodes.installattributehandler { + name = "viewerlayer", + namespace = viewerlayers, + initializer = initializer, + finalizer = states.finalize, + processor = states.stacked, +} + +function viewerlayers.enable(value) + if value == false or not viewerlayers.supported then + tasks.disableaction("shipouts","attributes.viewerlayers.handler") + else + tasks.enableaction("shipouts","attributes.viewerlayers.handler") + end +end + +function viewerlayers.forcesupport(value) + viewerlayers.supported = value + report_viewerlayers("viewerlayers are %ssupported",value and "" or "not ") + viewerlayers.enable(value) +end + +function viewerlayers.setfeatures(hasorder) + viewerlayers.hasorder = hasorder +end + +local stack, enabled, global = { }, false, false + +function viewerlayers.start(name) + if not enabled then + viewerlayers.enable(true) + end + insert(stack,texgetattribute(a_viewerlayer)) + local a = register(name) or unsetvalue + if global or scopes[name] == v_global then + scopes[a] = v_global -- messy but we don't know the attributes yet + texsetattribute("global",a_viewerlayer,a) + else + texsetattribute(a_viewerlayer,a) + end + texsettokenlist("currentviewerlayertoks",name) +end + +function viewerlayers.stop() + local a = remove(stack) + if a >= 0 then + if global or scopes[a] == v_global then + texsetattribute("global",a_viewerlayer,a) + else + texsetattribute(a_viewerlayer,a) + end + texsettokenlist("currentviewerlayertoks",values[a]) + else + if global or scopes[a] == v_global then + texsetattribute("global",a_viewerlayer,unsetvalue) + else + texsetattribute(a_viewerlayer,unsetvalue) + end + texsettokenlist("currentviewerlayertoks","") + end +end + +function viewerlayers.define(settings) + local tag = settings.tag + if not tag or tag == "" then + -- error + elseif not scopes[tag] then -- prevent duplicates + local title = settings.title + if not title or title == "" then + settings.title = tag + end + scopes[tag] = settings.scope or v_local + codeinjections.defineviewerlayer(settings) + end +end + +commands.defineviewerlayer = viewerlayers.define diff --git a/Master/texmf-dist/tex/context/base/attr-lay.mkiv b/Master/texmf-dist/tex/context/base/attr-lay.mkiv new file mode 100644 index 00000000000..b1f3c944e46 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/attr-lay.mkiv @@ -0,0 +1,106 @@ +%D \module +%D [ file=attr-lay, +%D version=2007.06.06, +%D title=\CONTEXT\ Attribute Macros, +%D subtitle=Viewerlayers, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{ConTeXt Attribute Macros / Viewerlayers} + +\unprotect + +\def\c!printable{printable} % todo + +\registerctxluafile{attr-lay}{1.001} + +% needs to work over stopitemize grouping etc + +\def\registerviewerlayer#1#2% global ! + {\setxvalue{(vl:#1)}{\global\attribute\viewerlayerattribute\ctxlua{tex.write(attributes.viewerlayers.register('#2'))} }} + +\setevalue{(vl:)}{\global\attribute\viewerlayerattribute\attributeunsetvalue} + +\def\dotriggerviewerlayer % move to lua + {\ctxlua{attributes.viewerlayers.enable()}% + \gdef\dotriggerviewerlayer##1{\csname(vl:##1)\endcsname}% + \dotriggerviewerlayer} + +\getparameters + [\??lr] + [\c!state=\v!start, + \c!title=, + \c!printable=\v!yes, + \c!scope=\v!local, % maybe global but needs checking with layout + \c!method=\v!none] + +\def\defineviewerlayer + {\dodoubleargument\dodefineviewerlayer} + +\def\dodefineviewerlayer[#1][#2]% document wide properties + {\begingroup + \getparameters[\??lr][#2]% + \ctxcommand{defineviewerlayer{ + tag = "#1", + title = "\@@lrtitle", + visible = "\@@lrstate", + editable = "\v!yes", + printable = "\@@lrprintable", + scope = "\@@lrscope" + }}% + \doif\@@lrmethod\v!command + {\setugvalue{\e!start#1}{\startviewerlayer[#1]}% + \setugvalue{\e!stop #1}{\stopviewerlayer }}% + \endgroup} + +\unexpanded\def\startviewerlayer[#1]{\ctxlua{attributes.viewerlayers.start("#1")}} % not grouped +\unexpanded\def\stopviewerlayer {\ctxlua{attributes.viewerlayers.stop()}} % not grouped +\unexpanded\def\viewerlayer [#1]{\groupedcommand{\startviewerlayer[#1]}{\stopviewerlayer}} % grouped + +% some day we will keep this at the lua end as the info is only needed there + +\let\currentviewerlayer\empty \newtoks\currentviewerlayertoks % soon we can set macros at the lua end + +\def\currentviewerlayer{\the\currentviewerlayertoks} + +\appendtoks + \let\currentviewerlayer\empty +\to \everypagebody + +% layout components are implemented rather directly (speed) + +\def\doinitializelayoutcomponent#1#2% + {\ctxcommand{defineviewerlayer{% this will move to the lua end i.e be merged with register + tag = "#1:#2", + title = "#1 #2", + visible = "\v!start", + editable = "\v!yes", + printable = "\v!yes" + }}% + \edef\layoutcomponentboxattribute{attr \viewerlayerattribute \ctxlua{tex.write(attributes.viewerlayers.register('#1:#2',true))}\relax}% + \expandafter\glet\csname\??ly>#1:#2\endcsname\layoutcomponentboxattribute} + +\def\dosetlayoutcomponentattribute#1#2% make this faster + {\expandafter\let\expandafter\layoutcomponentboxattribute\csname\??ly>#1:#2\endcsname + \ifx\layoutcomponentboxattribute\relax + \doinitializelayoutcomponent{#1}{#2}% get rid of { } + \fi} + +\def\doresetlayoutcomponentattribute + {\let\layoutcomponentboxattribute\empty} + +\let\setlayoutcomponentattribute \gobbletwoarguments +\let\resetlayoutcomponentattribute\relax +\let\layoutcomponentboxattribute \empty + +\def\showlayoutcomponents + {\ctxlua{attributes.viewerlayers.enable()}% + \let\setlayoutcomponentattribute \dosetlayoutcomponentattribute + \let\resetlayoutcomponentattribute\doresetlayoutcomponentattribute} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/attr-neg.lua b/Master/texmf-dist/tex/context/base/attr-neg.lua new file mode 100644 index 00000000000..766295a16fd --- /dev/null +++ b/Master/texmf-dist/tex/context/base/attr-neg.lua @@ -0,0 +1,95 @@ +if not modules then modules = { } end modules ['attr-neg'] = { + version = 1.001, + comment = "companion to attr-neg.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- this module is being reconstructed and code will move to other places +-- we can also do the nsnone via a metatable and then also se index 0 + +local format = string.format + + +local attributes, nodes = attributes, nodes + +local states = attributes.states +local tasks = nodes.tasks +local nodeinjections = backends.nodeinjections +local settexattribute = tex.setattribute +local variables = interfaces.variables +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex + +--- negative / positive + +attributes.negatives = attributes.negatives or { } +local negatives = attributes.negatives + +local a_negative = attributes.private("negative") + +negatives.data = allocate() +negatives.attribute = a_negative + +negatives.registered = allocate { + [variables.positive] = 1, + [variables.negative] = 2, +} + +local data = negatives.data +local registered = negatives.registered + +local function extender(negatives,key) + if key == "none" then + local d = data[1] + negatives.none = d + return d + end +end + +local function reviver(data,n) + if n == 1 then + local d = nodeinjections.positive() -- called once + data[1] = d + return d + elseif n == 2 then + local d = nodeinjections.negative() -- called once + data[2] = d + return d + end +end + +setmetatableindex(negatives, extender) +setmetatableindex(negatives.data, reviver) + +negatives.handler = nodes.installattributehandler { + name = "negative", + namespace = negatives, + initializer = states.initialize, + finalizer = states.finalize, + processor = states.process, +} + +local function register(stamp) + return registered[stamp] or registered.positive +end + +local function enable() + tasks.enableaction("shipouts","attributes.negatives.handler") +end + +negatives.register = register +negatives.enable = enable + +-- interface + +local enabled = false + +function commands.triggernegative(stamp) + if not enabled then + enable() + enabled = true + end + settexattribute(a_negative,register(stamp)) +end diff --git a/Master/texmf-dist/tex/context/base/attr-neg.mkiv b/Master/texmf-dist/tex/context/base/attr-neg.mkiv new file mode 100644 index 00000000000..2b817bb711a --- /dev/null +++ b/Master/texmf-dist/tex/context/base/attr-neg.mkiv @@ -0,0 +1,30 @@ +%D \module +%D [ file=attr-neg, +%D version=2007.06.06, +%D title=\CONTEXT\ Attribute Macros, +%D subtitle=Negation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{ConTeXt Attribute Macros / Negation} + +\registerctxluafile{attr-neg}{1.001} + +\unprotect + +% positive and negative are preregistered + +\def\dotriggernegative#1{\ctxcommand{triggernegative('#1'))}} + +\unexpanded\def\startnegative{\dotriggernegative\v!negative} +\unexpanded\def\stopnegative {\dotriggernegative\v!positive} + +\unexpanded\def\startpositive{\dotriggernegative\v!positive} +\unexpanded\def\stoppositive {\dotriggernegative\v!negative} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/back-exp.lua b/Master/texmf-dist/tex/context/base/back-exp.lua new file mode 100644 index 00000000000..7f52223a17b --- /dev/null +++ b/Master/texmf-dist/tex/context/base/back-exp.lua @@ -0,0 +1,1381 @@ +if not modules then modules = { } end modules ['back-exp'] = { + version = 1.001, + comment = "companion to back-exp.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- language -> only mainlanguage, local languages should happen through start/stoplanguage +-- tocs/registers -> maybe add a stripper (i.e. just don't flush entries in final tree) + +-- Because we need to look ahead we now always build a tree (this was optional in +-- the beginning). The extra overhead in the frontend is neglectable. + +-- We can consider replacing attributes by the hash entry ... slower in resolving but it's still +-- quite okay. + +-- todo: less attributes e.g. internal only first node +-- todo: build xml tree in mem (handy for cleaning) + +-- delimited: left/right string (needs marking) + +local nodecodes = nodes.nodecodes +local traverse_nodes = node.traverse +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist + +local function locate(start,wantedid,wantedsubtype) + for n in traverse_nodes(start) do + local id = n.id + if id == wantedid then + if not wantedsubtype or n.subtype == wantedsubtype then + return n + end + elseif id == hlist_code or id == vlist_code then + local found = locate(n.list,wantedid,wantedsubtype) + if found then + return found + end + end + end +end + +nodes.locate = locate + +local next, type = next, type +local format, match, concat, rep, sub, gsub, gmatch = string.format, string.match, table.concat, string.rep, string.sub, string.gsub, string.gmatch +local lpegmatch = lpeg.match +local utfchar, utfsub = utf.char, utf.sub +local insert, remove = table.insert, table.remove + +local trace_export = false trackers.register ("structures.export", function(v) trace_export = v end) +local trace_spaces = false trackers.register ("structures.export.spaces", function(v) trace_spaces = v end) +local trace_tree = false trackers.register ("structures.export.showtree", function(v) trace_tree = v end) +local less_state = false directives.register("structures.export.lessstate", function(v) less_state = v end) +local page_breaks = false directives.register("structures.export.pagebreaks", function(v) page_breaks = v end) + +local report_export = logs.reporter("backend","export") + +local nodes = nodes +local attributes = attributes +local variables = interfaces.variables + +local settings_to_array = utilities.parsers.settings_to_array + +local setmetatableindex = table.setmetatableindex +local tasks = nodes.tasks +local fontchar = fonts.hashes.characters +local languagenames = languages.numbers + +local nodecodes = nodes.nodecodes +local skipcodes = nodes.skipcodes +local whatsitcodes = nodes.whatsitcodes +local listcodes = nodes.listcodes + +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist +local glyph_code = nodecodes.glyph +local glue_code = nodecodes.glue +local kern_code = nodecodes.kern +local disc_code = nodecodes.disc +local insert_code = nodecodes.insert +local whatsit_code = nodecodes.whatsit +local refximage_code = whatsitcodes.pdfrefximage + +local userskip_code = skipcodes.userskip +local rightskip_code = skipcodes.rightskip +local parfillskip_code = skipcodes.parfillskip + +local line_code = listcodes.line + +local a_tagged = attributes.private('tagged') +local a_image = attributes.private('image') + +local a_taggedalign = attributes.private("taggedalign") +local a_taggedcolumns = attributes.private("taggedcolumns") +local a_taggedrows = attributes.private("taggedrows") +local a_taggedpar = attributes.private("taggedpar") +local a_taggedpacked = attributes.private("taggedpacked") +local a_taggedsymbol = attributes.private("taggedsymbol") +local a_taggedinsert = attributes.private("taggedinsert") +local a_taggedtag = attributes.private("taggedtag") + +local a_reference = attributes.private('reference') + +local has_attribute = node.has_attribute +local traverse_nodes = node.traverse +local slide_nodelist = node.slide +local texattribute = tex.attribute +local unsetvalue = attributes.unsetvalue +local locate_node = nodes.locate + +local references = structures.references +local structurestags = structures.tags +local taglist = structurestags.taglist +local properties = structurestags.properties +local userdata = structurestags.userdata -- might be combines with taglist +local tagdata = structurestags.data + +local starttiming = statistics.starttiming +local stoptiming = statistics.stoptiming + +-- todo: more locals (and optimize) + +local version = "0.20" +local result = nil -- todo: nofresult +local entry = nil +local attributehash = { } +local hyphen = utfchar(0xAD) -- todo: also emdash etc +local colonsplitter = lpeg.splitat(":") +local dashsplitter = lpeg.splitat("-") +local threshold = 65536 +local indexing = false +local linedone = false +local inlinedepth = 0 +local tree = { data = { }, depth = 0 } -- root +local treestack = { } +local treehash = { } +local extras = { } +local nofbreaks = 0 +local used = { } +local exporting = false +local last = nil +local lastpar = nil + +setmetatableindex(used, function(t,k) + if k then + local v = { } + t[k] = v + return v + end +end) + +local joiner_1 = " " +local joiner_2 = " " -- todo: test if this one can always be "" +local joiner_3 = " " +local joiner_4 = " " +local joiner_5 = " " +local joiner_6 = " " +local joiner_7 = "\n" +local joiner_8 = " " +local joiner_9 = " " +local joiner_0 = " " + +local namespaced = { + -- filled on +} + +local namespaces = { + msubsup = "m", + msub = "m", + msup = "m", + mn = "m", + mi = "m", + ms = "m", + mo = "m", + mtext = "m", + mrow = "m", + mfrac = "m", + mroot = "m", + msqrt = "m", + munderover = "m", + munder = "m", + mover = "m", + merror = "m", + math = "m", + mrow = "m", +} + +setmetatableindex(namespaced, function(t,k) + local namespace = namespaces[k] + local v = namespace and namespace .. ":" .. k or k + t[k] = v + return v +end) + +-- local P, C, Cc = lpeg.P, lpeg.C, lpeg.Cc +-- +-- local dash, colon = P("-"), P(":") +-- +-- local precolon, predash, rest = P((1-colon)^1), P((1-dash )^1), P(1)^1 +-- +-- local tagsplitter = C(precolon) * colon * C(predash) * dash * C(rest) + +-- C(predash) * dash * Cc(nil) * C(rest) + +local listdata = { } + +local function hashlistdata() + local c = structures.lists.collected + for i=1,#c do + local ci = c[i] + local tag = ci.references.tag + if tag then + listdata[ci.metadata.kind .. ":" .. ci.metadata.name .. "-" .. tag] = ci + end + end +end + +local spaces = { } -- watch how we also moved the -1 in depth-1 to the creator + +setmetatableindex(spaces, function(t,k) t[k] = rep(" ",k-1) return t[k] end) + +properties.vspace = { export = "break", nature = "display" } +properties.pbreak = { export = "pagebreak", nature = "display" } + +local function makebreak(entry) + nofbreaks = nofbreaks + 1 + local t, tl = { }, entry[1] + if tl then + for i=1,#tl do + t[i] = tl[i] + end + end + t[#t+1] = "break-" .. nofbreaks + return { t, { "" }, 0, 0 } +end + +local function makebreaknode(node) + nofbreaks = nofbreaks + 1 + return { + tg = "break", + fulltag = "break-" .. nofbreaks, + n = nofbreaks, + depth = node.depth, + element = "break", + nature = "display", + data = { }, + attribute = { } , + parnumber = 0, + } +end + +local fields = { "title", "subtitle", "author", "keywords" } + +function extras.document(handle,element,detail,n,fulltag,hash) + handle:write(format(" language=%q",languagenames[tex.count.mainlanguagenumber])) + if not less_state then + handle:write(format(" file=%q",tex.jobname)) + handle:write(format(" date=%q",os.date())) + handle:write(format(" context=%q",environment.version)) + handle:write(format(" version=%q",version)) + handle:write(format(" xmlns:m=%q","http://www.w3.org/1998/Math/MathML")) + local identity = interactions.general.getidentity() + for i=1,#fields do + local key = fields[i] + local value = identity[key] + if value and value ~= "" then + handle:write(format(" %s=%q",key,value)) + end + end + end +end + +local snames, snumbers = { }, { } + +function structurestags.setitemgroup(packed,symbol,di) + local s = snumbers[symbol] + if not s then + s = #snames + 1 + snames[s], snumbers[symbol] = symbol, s + end + texattribute[a_taggedpacked] = packed and 1 or unsetvalue + texattribute[a_taggedsymbol] = s +end + +-- todo: per class + +local synonymnames, synonymnumbers = { }, { } -- can be one hash + +function structurestags.setsynonym(class,tag) + local s = synonymnumbers[tag] + if not s then + s = #synonymnames + 1 + synonymnames[s], synonymnumbers[tag] = tag, s + end + texattribute[a_taggedtag] = s +end + +local sortingnames, sortingnumbers = { }, { } -- can be one hash + +function structurestags.setsorting(class,tag) + local s = sortingnumbers[tag] + if not s then + s = #sortingnames + 1 + sortingnames[s], sortingnumbers[tag] = tag, s + end + texattribute[a_taggedtag] = s +end + +local insertids = { } + +function structurestags.setdescriptionid(tag,n) + local nd = structures.notes.get(tag,n) -- todo: use listdata instead + if nd then + local r = nd.references + texattribute[a_taggedinsert] = r.internal or unsetvalue + else + texattribute[a_taggedinsert] = unsetvalue + end +end + +function extras.descriptiontag(handle,element,detail,n,fulltag,di) + local hash = attributehash[fulltag] + if hash then + local v = hash.insert + v = v and insertids[v] + if v then + handle:write(" insert='",v,"'") + end + end +end + +function extras.descriptionsymbol(handle,element,detail,n,fulltag,di) + local hash = attributehash[fulltag] + if hash then + local v = hash.insert + v = v and insertids[v] + if v then + handle:write(" insert='",v,"'") + end + end +end + +function extras.synonym(handle,element,detail,n,fulltag,di) + local hash = attributehash[fulltag] + if hash then + local v = hash.tag + v = v and synonymnames[v] + if v then + handle:write(" tag='",v,"'") + end + end +end + +function extras.sorting(handle,element,detail,n,fulltag,di) + local hash = attributehash[fulltag] + if hash then + local v = hash.tag + v = v and sortingnames[v] + if v then + handle:write(" tag='",v,"'") + end + end +end + +function extras.image(handle,element,detail,n,fulltag,di) + local hash = attributehash[fulltag] + if hash then + local v = hash.imageindex + if v then + local figure = img.ofindex(v) + if figure then + local fullname = figure.filepath + local name = file.basename(fullname) + local path = file.dirname(fullname) + local page = figure.page or 1 + if name ~= "" then + handle:write(" name='",name,"'") + end + if path ~= "" then + handle:write(" path='",path,"'") + end + if page > 1 then + handle:write(" page='",page,"'") + end + end + end + end +end + +-- quite some code deals with exporting references -- + +local evaluators = { } +local specials = { } + +evaluators.inner = function(handle,var) + local inner = var.inner + if var.inner then + handle:write(" location='",inner,"'") + end +end + +evaluators.outer = function(handle,var) + local file, url = references.checkedfileorurl(var.outer,var.outer) + if url then + handle:write(" url='",url,"'") + elseif file then + handle:write(" file='",file,"'") + end +end + +evaluators["outer with inner"] = function(handle,var) + local file = references.checkedfile(var.f) + if file then + handle:write(" file='",file,"'") + end + local inner = var.inner + if var.inner then + handle:write(" location='",inner,"'") + end +end + +evaluators.special = function(handle,var) + local handler = specials[var.special] + if handler then + handler(handle,var) + end +end + +evaluators["special outer with operation"] = evaluators.special +evaluators["special operation"] = evaluators.special +evaluators["special operation with arguments"] = evaluators.special + +function specials.url(handle,var) + local url = references.checkedurl(var.operation) + if url then + handle:write(" url='",url,"'") + end +end + +function specials.file(handle,var) + local file = references.checkedfile(var.operation) + if file then + handle:write(" file='",file,"'") + end +end + +function specials.fileorurl(handle,var) + local file, url = references.checkedfileorurl(var.operation,var.operation) + if url then + handle:write(" url='",url,"'") + elseif file then + handle:write(" file='",file,"'") + end +end + +function specials.internal(handle,var) + local internal = references.checkedurl(var.operation) + if internal then + handle:write(" location='aut:",internal,"'") + end +end + +local function adddestination(handle,references) -- todo: specials -> exporters and then concat + if references then + local reference = references.reference + if reference and reference ~= "" then + local prefix = references.prefix + if prefix and prefix ~= "" then + handle:write(" prefix='",prefix,"'") + end + handle:write(" destination='",reference,"'") + for i=1,#references do + local r = references[i] + local e = evaluators[r.kind] + if e then + e(handle,r) + end + end + end + end +end + +local function addreference(handle,references) + if references then + local reference = references.reference + if reference and reference ~= "" then + local prefix = references.prefix + if prefix and prefix ~= "" then + handle:write(" prefix='",prefix,"'") + end + handle:write(" reference='",reference,"'") + end + local internal = references.internal + if internal and internal ~= "" then + handle:write(" location='aut:",internal,"'") + end + end +end + +function extras.link(handle,element,detail,n,fulltag,di) + -- for instance in lists a link has nested elements and no own text + local hash = attributehash[fulltag] + if hash then + local references = hash.reference + if references then + adddestination(handle,structures.references.get(references)) + end + return true + else + local data = di.data + if data then + for i=1,#data do + local di = data[i] + if di and extras.link(handle,element,detail,n,di.fulltag,di) then + return true + end + end + end + end +end + +function extras.section(handle,element,detail,n,fulltag,di) + local data = listdata[fulltag] + if data then + addreference(handle,data.references) + return true + else + local data = di.data + if data then + for i=1,#data do + local di = data[i] + if di then + local ft = di.fulltag + if ft and extras.section(handle,element,detail,n,ft,di) then + return true + end + end + end + end + end +end + +function extras.float(handle,element,detail,n,fulltag,di) + local data = listdata[fulltag] + if data then + addreference(handle,data.references) + return true + else + local data = di.data + if data then + for i=1,#data do + local di = data[i] + if di and extras.section(handle,element,detail,n,di.fulltag,di) then + return true + end + end + end + end +end + +function extras.itemgroup(handle,element,detail,n,fulltag,di) + local data = di.data + for i=1,#data do + local di = data[i] + if type(di) == "table" and di.tg == "item" then + local ddata = di.data + for i=1,#ddata do + local ddi = ddata[i] + if type(ddi) == "table" then + local tg = ddi.tg + if tg == "itemtag" or tg == "itemcontent" then + local hash = attributehash[ddi.fulltag] + if hash then + local v = hash.packed + if v and v == 1 then + handle:write(" packed='yes'") + end + local v = hash.symbol + if v then + handle:write(" symbol='",snames[v],"'") + end + return + end + end + end + end + end + end +end + +function extras.tablecell(handle,element,detail,n,fulltag,di) + local hash = attributehash[fulltag] + if hash then + local v = hash.align + if not v or v == 0 then + -- normal + elseif v == 1 then + handle:write(" align='flushright'") + elseif v == 2 then + handle:write(" align='middle'") + elseif v == 3 then + handle:write(" align='flushleft'") + end + local v = hash.columns + if v and v > 1 then + handle:write(" columns='",v,"'") + end + local v = hash.rows + if v and v > 1 then + handle:write(" rows='",v,"'") + end + end +end + +function extras.tabulatecell(handle,element,detail,n,fulltag,di) + local hash = attributehash[fulltag] + if hash then + local v = hash.align + if not v or v == 0 then + -- normal + elseif v == 1 then + handle:write(" align='flushright'") + elseif v == 2 then + handle:write(" align='middle'") + elseif v == 3 then + handle:write(" align='flushleft'") + end + end +end + +local function emptytag(handle,element,nature,depth) + handle:write("\n",spaces[depth],"<",namespaced[element],"/>\n") +end + +local function begintag(handle,element,nature,depth,di,empty) + local detail, n, fulltag = di.detail, di.n, di.fulltag + if nature == "inline" then + linedone = false + inlinedepth = inlinedepth + 1 + elseif nature == "mixed" then + if inlinedepth > 0 then + elseif linedone then + handle:write(spaces[depth]) + else + handle:write("\n",spaces[depth]) + linedone = false + end + inlinedepth = inlinedepth + 1 + else + if inlinedepth > 0 then + elseif linedone then + handle:write(spaces[depth]) + else + handle:write("\n",spaces[depth]) + linedone = false + end + end + handle:write("<",namespaced[element]) + if detail then + handle:write(" detail='",detail,"'") + end + if indexing and n then + handle:write(" n='",n,"'") + end + local extra = extras[element] + if extra then + extra(handle,element,detail,n,fulltag,di) + end + local u = userdata[fulltag] + if u then + for k, v in next, u do + handle:write(format(" %s=%q",k,v)) + end + end + if not empty then + handle:write(">") + if inlinedepth > 0 then + elseif nature == "display" then + handle:write("\n") + linedone = true + end + end + used[element][detail or ""] = nature +end + +local function endtag(handle,element,nature,depth,empty) + if nature == "display" then + if inlinedepth == 0 then + if empty then + handle:write("\n") + else + if not linedone then + handle:write("\n") + end + handle:write(spaces[depth],"\n") + end + linedone = true + else + if empty then + handle:write("/>") + else + handle:write("") + end + end + else + inlinedepth = inlinedepth - 1 + if empty then + handle:write("/>") + else + handle:write("") + end + linedone = false + end +end + +local function push(fulltag,depth,entry) + local attribute, parnumber = entry[3], entry[4] + -- local tg, detail, n = lpegmatch(tagsplitter,fulltag) + local tag, n = lpegmatch(dashsplitter,fulltag) + local tg, detail = lpegmatch(colonsplitter,tag) + local element, nature + if detail then + local pd = properties[tag] + local pt = properties[tg] + element = pd and pd.export or pt and pt.export or tg + nature = pd and pd.nature or pt and pt.nature or "inline" + else + local p = properties[tg] + element = p and p.export or tg + nature = p and p.nature or "inline" + end + local t = { + -- parent = tree, + tg = tg, + fulltag = fulltag, + detail = detail, + n = tonumber(n), -- more efficient + depth = depth, + element = element, + nature = nature, + data = { }, + attribute = attribute, + parnumber = parnumber, + -- node = entry[5], -- will go + } + local treedata = tree.data + treedata[#treedata+1] = t + insert(treestack,tree) + tree = t + local h = treehash[fulltag] + if h then + h[#h+1] = t + else + treehash[fulltag] = { t } + end +end + +local function pop() + tree = remove(treestack) +end + +local function flushresult(entry) + local current, content = entry[1], entry[2] + if not content then + -- skip, normally this cannot happen + else + local newdepth, olddepth, content = #current, #treestack, concat(content) + if trace_export then + report_export("%s => %s : handling: %s",olddepth,newdepth,current[newdepth]) + end + if olddepth <= 0 then + for i=1,newdepth do + if trace_export then + report_export("[1] push : %s",current[i]) + end + push(current[i],i,entry) + end + if content then + tree.data[#tree.data+1] = content + end + elseif newdepth < olddepth then + for i=newdepth,olddepth-1 do + if trace_export then + report_export("[2a] pop : %s",current[i]) + end + pop() + end + -- we can have a pagebreak and for instance a new chapter + -- will mess up the structure then + for i=newdepth,1,-1 do + if current[i] ~= treestack[i].fulltag then -- needs checking + if trace_export then + report_export("[2b] pop : %s",current[i]) + end + pop() + else + break + end + end + olddepth = #treestack + for i=olddepth+1,newdepth do + if trace_export then + report_export("[2] push : %s",current[i]) + end + push(current[i],i,entry) + end + if content then + tree.data[#tree.data+1] = content + end + elseif newdepth > olddepth then + for i=olddepth,1,-1 do + if current[i] ~= treestack[i].fulltag then + if trace_export then + report_export("[3] pop : %s",current[i]) + end + pop() + else + break + end + end + olddepth = #treestack + for i=olddepth+1,newdepth do + if trace_export then + report_export("[3] push : %s",current[i]) + end + push(current[i],i,entry) + end + if content then + tree.data[#tree.data+1] = content + end + elseif current[newdepth] == treestack[olddepth] then --move up ? + -- continuation + if content then + tree.data[#tree.data+1] = content + end + else + for i=olddepth,1,-1 do + if current[i] ~= treestack[i].fulltag then + if trace_export then + report_export("[4] pop : %s",current[i]) + end + pop() + else + break + end + end + olddepth = #treestack + for i=olddepth+1,newdepth do + if trace_export then + report_export("[4] push : %s",current[i]) + end + push(current[i],i,entry) + end + if content then + tree.data[#tree.data+1] = content + end + end + end +end + +local function checkinserts(data) + local nofinserts = 0 + for i=1,#data do + local di = data[i] + if type(di) == "table" then -- id ~= false + if di.element == "descriptionsymbol" then + local hash = attributehash[di.fulltag] + if hash then + local i = hash.insert + if i then + nofinserts = nofinserts + 1 + insertids[i] = nofinserts + end + else + -- something is wrong + end + end + if di.data then + checkinserts(di.data) + end + end + end +end + +local function flushtree(handle,data,nature) + local nofdata = #data + for i=1,nofdata do + local di = data[i] + if not di then + -- collapsed + elseif type(di) == "string" then +if i == nofdata and sub(di,-1) == joiner_7 then + if nature == "inline" or nature == "mixed" then + handle:write(sub(di,1,-2)) + else + handle:write(sub(di,1,-2)," ") + end +else + handle:write(di) +end + linedone = false + elseif not di.collapsed then + local element = di.element + if element == "break" or element == "pagebreak" then + emptytag(handle,element,nature,di.depth) + else + local nature, depth = di.nature, di.depth + local did = di.data + local nid = #did + if nid == 0 or (nid == 1 and did[1] == "") then + begintag(handle,element,nature,depth,di,true) + -- no content + endtag(handle,element,nature,depth,true) + else + begintag(handle,element,nature,depth,di) + flushtree(handle,did,nature) + endtag(handle,element,nature,depth) + end + end + end + end +end + +local function collapsetree() + for k, v in next, treehash do + local d = v[1].data + local nd = #d + for i=2,#v do + local vi = v[i] + local vd = vi.data + local done = false + local lpn = v[i-1].parnumber + if lpn and lpn == 0 then lpn = nil end + if type(d[1]) ~= "string" then lpn = nil end -- no need anyway so no further testing needed +local justdone = false + for j=1,#vd do + local vdj = vd[j] + if type(vdj) == "string" then +--~ print(vdj) + -- experiment, should be improved + -- can be simplified ... lpn instead of done + if done then + nd = nd + 1 + d[nd] = joiner_1 + else + done = true + local pn = vi.parnumber + if not pn then + nd = nd + 1 + d[nd] = joiner_2 + lpn = nil + elseif not lpn then + nd = nd + 1 + d[nd] = joiner_3 + lpn = pn + elseif pn and pn ~= lpn then + nd = nd + 1 + d[nd] = makebreaknode(vi) + lpn = pn + else + -- nd = nd + 1 + -- d[nd] = joiner_4 -- we need to be more clever + end + end + else +--~ nd = nd + 1 +--~ d[nd] = joiner_3 + -- lpn = nil + end + if vdj ~= "" then + nd = nd + 1 + d[nd] = vdj -- hm, any? + end + vd[j] = false + end + v[i].collapsed = true + end + end +end + +local function prunetree(tree) + if not tree.collapsed then + local data = tree.data + if data then + local p, np = { }, 0 + for i=1,#data do + local d = data[i] + if type(d) == "table" then + if not d.collapsed then + prunetree(d) + np = np + 1 + p[np] = d + end + elseif type(d) == "string" then + np = np + 1 + p[np] = d + end + end + tree.data = np > 0 and p + end + end +end + +local function finishexport() + if entry then + local result = entry[2] + if result and result[#result] == " " then + result[#result] = nil -- nicer, remove last space + end + flushresult(entry) + end + for i=#treestack,1,-1 do + pop() + end +end + +local displaymapping = { + inline = "inline", + display = "block", + mixed = "inline", +} + +local e_template = [[ +%s { + display: %s ; +}]] + +local d_template = [[ +%s[detail=%s] { + display: %s ; +}]] + +-- encoding='utf-8' + +local xmlpreamble = [[ + + + + + + +]] + +local csspreamble = [[ + + +]] + +local cssfile, xhtmlfile = nil, nil + +directives.register("backend.export.css", function(v) cssfile = v end) +directives.register("backend.export.xhtml",function(v) xhtmlfile = v end) + +local function stopexport(v) + starttiming(treehash) + report_export("finalizing") + finishexport() + collapsetree() + if trace_tree then + prunetree(tree) + report_export(table.serialize(tree,"root")) + end + checkinserts(tree.data) + hashlistdata() + if type(v) ~= "string" or v == variables.yes or v == "" then + v = tex.jobname + end + local xmlfile = file.addsuffix(v,"export") + local handle = io.open(xmlfile,"wb") + if handle then + local files = { } + local specification = { + name = file.removesuffix(v), + identifier = os.uuid(), + files = files, + } + report_export("saving xml data in '%s",xmlfile) + handle:write(format(xmlpreamble,tex.jobname,os.date(),environment.version,version)) + if type(cssfile) == "string" then + local cssfiles = settings_to_array(cssfile) + for i=1,#cssfiles do + local cssfile = cssfiles[i] + files[#files+1] = cssfile + if type(cssfile) ~= "string" or cssfile == variables.yes or cssfile == "" or cssfile == xmlfile then + cssfile = file.replacesuffix(xmlfile,"css") + else + cssfile = file.addsuffix(cssfile,"css") + end + report_export("adding css reference '%s",cssfile) + handle:write(format(csspreamble,cssfile)) + end + end + flushtree(handle,tree.data) + handle:close() + -- css template file + local cssfile = file.replacesuffix(xmlfile,"template") + report_export("saving css template in '%s",cssfile) + local templates = { format("/* template for file %s */",xmlfile) } + for element, details in table.sortedhash(used) do + templates[#templates+1] = format("/* category: %s */",element) + for detail, nature in table.sortedhash(details) do + local d = displaymapping[nature or "display"] or "block" + if detail == "" then + templates[#templates+1] = format(e_template,element,d) + else + templates[#templates+1] = format(d_template,element,detail,d) + end + end + end + io.savedata(cssfile,concat(templates,"\n\n")) + -- xhtml references + if xhtmlfile then + -- messy + if type(v) ~= "string" or xhtmlfile == true or xhtmlfile == variables.yes or xhtmlfile == "" or xhtmlfile == xmlfile then + xhtmlfile = file.replacesuffix(xmlfile,"xhtml") + else + xhtmlfile = file.addsuffix(xhtmlfile,"xhtml") + end + report_export("saving xhtml variant in '%s",xhtmlfile) + local xmltree = xml.load(xmlfile) + if xmltree then + local xmlwrap = xml.wrap + for e in xml.collected(xmltree,"/document") do + e.at["xmlns:xhtml"] = "http://www.w3.org/1999/xhtml" + break + end + local wrapper = { tg = "a", ns = "xhtml", at = { href = "unknown" } } + for e in xml.collected(xmltree,"link") do + local location = e.at.location + if location then + wrapper.at.href = "#" .. gsub(location,":","_") + xmlwrap(e,wrapper) + end + end + local wrapper = { tg = "a", ns = "xhtml", at = { name = "unknown" } } + for e in xml.collected(xmltree,"!link[@location]") do + local location = e.at.location + if location then + wrapper.at.name = gsub(location,":","_") + xmlwrap(e,wrapper) + end + end + xml.save(xmltree,xhtmlfile) + end + files[#files+1] = xhtmlfile + specification.root = xhtmlfile + local specfile = file.replacesuffix(xmlfile,"specification") + report_export("saving specification in '%s' (mtxrun --script epub --make %s)",specfile,specfile) + io.savedata(specfile,table.serialize(specification,true)) + end + else + report_export("unable to saving xml in '%s",xmlfile) + end + stoptiming(treehash) +end + +local function startexport(v) + if v and not exporting then + nodes.tasks.appendaction("shipouts", "normalizers", "nodes.handlers.export") + report_export("enabling export to xml") + luatex.registerstopactions(function() stopexport(v) end) + if trace_spaces then + joiner_1 = "" joiner_2 = "" joiner_3 = "" joiner_4 = "" joiner_5 = "" + joiner_6 = "" joiner_7 = "" joiner_8 = "" joiner_9 = "" joiner_0 = "" + end + exporting = true + end +end + +directives.register("backend.export",startexport) -- maybe .name + +local function injectbreak() + flushresult(entry) + flushresult(makebreak(entry)) + result = { } + entry = { entry[1], result, last, lastpar } -- entry[1] ? +end + +local function injectspace(a,joiner) + flushresult(entry) + result = { joiner } + local tl = taglist[a] + entry = { tl , result, a, lastpar, n } +end + +local function collectresults(head,list,p) + local preceding = p or false + for n in traverse_nodes(head) do + local id = n.id -- 14: image, 8: literal (mp) + if id == glyph_code then + local at = has_attribute(n,a_tagged) + if not at then + -- we need to tag the pagebody stuff as being valid skippable + -- + -- report_export("skipping character: 0x%05X %s (no attribute)",n.char,utfchar(n.char)) + else + -- we could add tonunicodes for ligatures (todo) + local components = n.components + if components then -- we loose data + collectresults(components,nil,preceding) +--~ preceding = true + else + if last ~= at then + local tl = taglist[at] + if entry then + flushresult(entry) + end + if preceding then + preceding = false + result = { joiner_5 } + else + result = { } + end + lastpar = has_attribute(n,a_taggedpar) + entry = { tl, result, at, lastpar, n } + local ah = { -- this includes detail ! + align = has_attribute(n,a_taggedalign ), + columns = has_attribute(n,a_taggedcolumns), + rows = has_attribute(n,a_taggedrows ), + packed = has_attribute(n,a_taggedpacked ), + symbol = has_attribute(n,a_taggedsymbol ), + insert = has_attribute(n,a_taggedinsert ), + reference = has_attribute(n,a_reference ), + tag = has_attribute(n,a_taggedtag ), -- used for synonyms + } + if next(ah) then + attributehash[tl[#tl]] = ah + end + last = at + elseif last then + local at = has_attribute(n,a_taggedpar) + if at ~= lastpar then + injectbreak() + lastpar = at + end + end + local c = n.char + if c == 0x26 then + result[#result+1] = "&" + elseif c == 0x3E then + result[#result+1] = ">" + elseif c == 0x3C then + result[#result+1] = "<" + elseif c == 0 then + result[#result+1] = "" -- utfchar(0) -- todo: check if "" is needed + else + local fc = fontchar[n.font] + if fc then + fc = fc and fc[c] + if fc then + local u = fc.tounicode + if u and u ~= "" then + for s in gmatch(u,"....") do -- is this ok? + result[#result+1] = utfchar(tonumber(s,16)) + end + else + result[#result+1] = utfchar(c) + end + else -- weird, happens in hz (we really need to get rid of the pseudo fonts) + result[#result+1] = utfchar(c) + end + else + result[#result+1] = utfchar(c) + end + end + end + end + elseif id == hlist_code or id == vlist_code then + local ai = has_attribute(n,a_image) + if ai then + local at = has_attribute(n,a_tagged) + if entry then + flushresult(entry) + result = { } + entry[2] = result -- mess, to be sorted out, but otherwise duplicates (still some spacing issues) + end + local tl = taglist[at] + local i = locate_node(n,whatsit_code,refximage_code) + if i then + attributehash[tl[#tl]] = { imageindex = i.index } + end + flushresult { tl, { }, 0, 0 } -- has an index, todo: flag empty element + last = nil + lastpar = nil + else +--~ if result and #result > 0 then -- and n.subtype == line_code then +--~ local r = result[#result] +--~ if type(r) == "string" and r ~= " " then +--~ local s = utfsub(r,-1) +--~ if s == hyphen then +--~ result[#result] = utfsub(r,1,-2) +--~ elseif s ~= joiner_7 then +--~ result[#result] = r .. joiner_7 +--~ --~ preceding = true +--~ end +--~ end +--~ preceding = false +--~ end + -- we need to determine an end-of-line + preceding = collectresults(n.list,n,preceding) + preceding = false + end + elseif id == disc_code then -- probably too late + collectresults(n.replace,nil) + preceding = false + elseif id == glue_code then + -- we need to distinguish between hskips and vskips + local subtype = n.subtype + if subtype == userskip_code then -- todo space_code + if n.spec.width > threshold then +--~ preceding = true + if result and last and #result > 0 and result[#result] ~= " " then + local a = has_attribute(n,a_tagged) + if a == last then + result[#result+1] = joiner_6 + preceding = false + elseif a then + -- e.g LOGOLOGO + preceding = false + last = a + injectspace(last,joiner_6) + end + end + end + elseif subtype == rightskip_code or subtype == parfillskip_code then +if result and #result > 0 then -- and n.subtype == line_code then + local r = result[#result] + if type(r) == "string" and r ~= " " then + local s = utfsub(r,-1) + if s == hyphen then + result[#result] = utfsub(r,1,-2) + elseif s ~= joiner_7 then + result[#result] = r .. joiner_7 +--~ preceding = true + end + end + preceding = false +end + end + elseif id == kern_code then + if n.kern > threshold then +--~ preceding = true + if result and last and #result > 0 and result[#result] ~= " " then + local a = has_attribute(n,a_tagged) + if a == last then + result[#result+1] = joiner_8 + preceding = false + elseif a then + -- e.g LOGOLOGO + preceding = false + last = a + injectspace(last,joiner_8) + end + end + end + end + end + return preceding +end + +function nodes.handlers.export(head) + if result then + -- maybe we need a better test for what is in result so far + if page_breaks then + joiner_0 = "" + end + result[#result+1] = joiner_0 + end + starttiming(treehash) + collectresults(head) + -- no flush here, pending page stuff + stoptiming(treehash) + return head, true +end + +statistics.register("xml exporting time", function() + if exporting then + return format("%s seconds", statistics.elapsedtime(treehash)) + end +end) diff --git a/Master/texmf-dist/tex/context/base/back-exp.mkiv b/Master/texmf-dist/tex/context/base/back-exp.mkiv new file mode 100644 index 00000000000..88272fca70c --- /dev/null +++ b/Master/texmf-dist/tex/context/base/back-exp.mkiv @@ -0,0 +1,127 @@ +%D \module +%D [ file=back-exp, +%D version=2010.08.22, +%D title=\CONTEXT\ Backend Macros, +%D subtitle=XML export, +%D author=Hans Hagen, +%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. + +\writestatus{loading}{ConTeXt Backend Macros / XML export} + +\registerctxluafile{back-exp.lua}{1.001} + +%D This is an experimental exporter and a logical follow up on tagging. The +%D exporter assumes a properly tagged document. Some elements get a couple +%D of attributes becaus eitherwise rendering information would get lost. In +%D general we assume that when the \XML\ is converted to \HTML\ some stylesheet +%D is applied anyway. + +\unprotect + +% we can replace this by a more generic attributeset mechanism where we bind +% to any element (needed anyway, see userdata thingies) + +\definesystemattribute[taggedrows] [public] +\definesystemattribute[taggedcolumns][public] +\definesystemattribute[taggedalign] [public] +\definesystemattribute[taggedpar] [public] +\definesystemattribute[taggedpacked] [public] +\definesystemattribute[taggedsymbol] [public] +\definesystemattribute[taggedinsert] [public] +\definesystemattribute[taggedtag] [public] + +\def\setelementexporttag + {\dotripleargument\dosetelementexporttag} + +\def\dosetelementexporttag[#1][#2][#3]% + {\ifthirdargument + \ctxlua{structures.tags.settagproperty("#1","#2", "#3")}% + \else\ifsecondargument + \ctxlua{structures.tags.settagproperty("#1","export", "#2")}% + \fi\fi} + +\newcount\tagparcounter + +\let\dotagsetparcounter\relax + +\appendtoks + \dotagsetparcounter +\to \everypar + +\appendtoks + \dotagsetparcounter +\to \neverypar + +\appendtoks + \dotagsetparcounter +\to \everytabulatepar % tricky, maybe this should be neverypar + +\appendtoks + \def\dotagnoftablecolumns{\attribute\taggedcolumnsattribute\!!counta}% + \def\dotagnoftablerows {\attribute\taggedrowsattribute \!!countb}% +\to \everyenableelements + +\appendtoks + \def\dotagTABLEalign{\attribute\taggedalignattribute\raggedstatus}% + \def\dotagTABLEcell {\char\zerocount}% +\to \everyenableelements + +\appendtoks + \def\dotagtabulatealign{\attribute\taggedalignattribute\ifcase\tabulatealign\attributeunsetvalue\or\plusthree\or\plusone\or\plustwo\or\attributeunsetvalue\fi}% +\to \everyenableelements + +\appendtoks + \def\dotagsynonym{\ctxlua{structures.tags.setsynonym("\currentsynonym","\currentsynonymtag")}}% +\to \everyenableelements + +\appendtoks + \def\dotagsorting{\ctxlua{structures.tags.setsorting("\currentsorting","\currentsortingtag")}}% +\to \everyenableelements + +\appendtoks + \def\dotagsetparcounter{\global\advance\tagparcounter\plusone\attribute\taggedparattribute\tagparcounter}% +\to \everyenableelements + +\appendtoks + \def\dotagsetitemize{\ctxlua{structures.tags.setitemgroup(\ifconditional\packlistitem true\else false\fi,"\currentitemsymbol")}}% +\to \everyenableelements + +\appendtoks + \def\dotagsetdescriptiontag{\ctxlua{structures.tags.setdescriptionid("\currentdescription",\currentdescriptionnumberentry)}}% +\to \everyenableelements + +\appendtoks + \def\dotagsetnotesymbol{\ctxlua{structures.tags.setdescriptionid("\currentnote",\currentnotenumber)}}% +\to \everyenableelements + +\appendtoks + \unexpanded\def\doverbatimspace{\char32\relax}% will be done permanently +\to \everyenableelements + +% The action: \setupbackend[export=yes] % or filename + +\def\c!export {export} % maybe: option={css,xhtml} +\def\c!css {css} +\def\c!xhtml {xhtml} + +\appendtoks + \doifsomething{\backendparameter\c!xhtml} + {\enabledirectives[backend.export.xhtml=\backendparameter\c!xhtml]}% + \doifsomething{\backendparameter\c!css} + {\enabledirectives[backend.export.css={\backendparameter\c!css}]}% +\to \everysetupbackend + +\appendtoks + \doifsomething{\backendparameter\c!export} + {\setupstructure + [\c!state=\v!start]% + \enabledirectives + [backend.export=\backendparameter\c!export]}% +\to \everysetupbackend + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/back-ini.lua b/Master/texmf-dist/tex/context/base/back-ini.lua index 12a487dd4dc..39de73741e2 100644 --- a/Master/texmf-dist/tex/context/base/back-ini.lua +++ b/Master/texmf-dist/tex/context/base/back-ini.lua @@ -6,99 +6,48 @@ if not modules then modules = { } end modules ['back-ini'] = { license = "see context related readme files" } -backends = backends or { } -local trace_backend = false +backends = backends or { } +local backends = backends -local function nothing() return nil end - -backends.nothing = nothing - -backends.nodeinjections = { - rgbcolor = nothing, - cmykcolor = nothing, - graycolor = nothing, - spotcolor = nothing, - transparency = nothing, - overprint = nothing, - knockout = nothing, - positive = nothing, - negative = nothing, - effect = nothing, - startlayer = nothing, - stoplayer = nothing, - switchlayer = nothing, - - reference = nothing, - destination = nothing, - -} - -backends.codeinjections = { - - prerollreference = nothing, - - insertmovie = nothing, - insertsound = nothing, +local trace_backend = false trackers.register("backend.initializers", function(v) trace_finalizers = v end) - presetsymbollist = nothing, - registersymbol = nothing, - registeredsymbol = nothing, +local report_backend = logs.reporter("backend","initializing") - registercomment = nothing, - embedfile = nothing, - attachfile = nothing, - adddocumentinfo = nothing, - setupidentity = nothing, - setpagetransition = nothing, - defineviewerlayer = nothing, - addbookmarks = nothing, - addtransparencygroup = nothing, +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex - typesetfield = nothing, - doiffieldelse = nothing, - doiffieldgroupelse = nothing, - definefield = nothing, - clonefield = nothing, - definefieldset = nothing, - getfieldgroup = nothing, - setformsmethod = nothing, - getdefaultfieldvalue = nothing, - - setupcanvas = nothing, +local function nothing() return nil end - initializepage = nothing, - initializedocument = nothing, - finalizepage = nothing, - finalizedocument = nothing, +backends.nothing = nothing - flushpageactions = nothing, - flushdocumentactions = nothing, +local nodeinjections = { } +local codeinjections = { } +local registrations = { } +local tables = allocate() - insertrenderingwindow = nothing, - processrendering = nothing, - kindofrendering = nothing, - flushrenderingwindow = nothing, +local function donothing(t,k) + t[k] = nothing + return nothing +end - setfigurecolorspace = nothing, - setfigurealternative = nothing, +setmetatableindex(nodeinjections, donothing) +setmetatableindex(codeinjections, donothing) +setmetatableindex(registrations, donothing) +local defaults = { + nodeinjections = nodeinjections, + codeinjections = codeinjections, + registrations = registrations, + tables = tables, } -backends.registrations = { - grayspotcolor = nothing, - rgbspotcolor = nothing, - cmykspotcolor = nothing, - grayindexcolor = nothing, - rgbindexcolor = nothing, - cmykindexcolor = nothing, - spotcolorname = nothing, - transparency = nothing, -} +backends.defaults = defaults -local nodeinjections = backends.nodeinjections -local codeinjections = backends.codeinjections -local registrations = backends.registrations +backends.nodeinjections = { } setmetatableindex(backends.nodeinjections, nodeinjections) +backends.codeinjections = { } setmetatableindex(backends.codeinjections, codeinjections) +backends.registrations = { } setmetatableindex(backends.registrations, registrations) +backends.tables = { } setmetatableindex(backends.tables, tables) backends.current = "unknown" @@ -107,28 +56,16 @@ function backends.install(what) local backend = backends[what] if backend then if trace_backend then - logs.report("backend", "initializing backend %s (%s)",what,backend.comment or "no comment") + report_backend("initializing backend %s (%s)",what,backend.comment or "no comment") end backends.current = what - for _, category in next, { "nodeinjections", "codeinjections", "registrations"} do - local plugin = backend[category] - if plugin then - local whereto = backends[category] - for name, meaning in next, whereto do - if plugin[name] then - whereto[name] = plugin[name] - -- logs.report("backend", "installing function %s in category %s of %s",name,category,what) - elseif trace_backend then - logs.report("backend", "no function %s in category %s of %s",name,category,what) - end - end - elseif trace_backend then - logs.report("backend", "no category %s in %s",category,what) - end + for category, default in next, defaults do + local target, plugin = backends[category], backend[category] + setmetatableindex(plugin, default) + setmetatableindex(target, plugin) end - backends.helpers = backend.helpers elseif trace_backend then - logs.report("backend", "no backend named %s",what) + report_backend("no backend named %s",what) end end end @@ -141,3 +78,14 @@ statistics.register("used backend", function() return nil end end) + +local comment = { "comment", "" } + +tables.vfspecials = allocate { + red = comment, + green = comment, + blue = comment, + black = comment, + startslant = comment, + stopslant = comment, +} diff --git a/Master/texmf-dist/tex/context/base/back-ini.mkiv b/Master/texmf-dist/tex/context/base/back-ini.mkiv index b7bbdb56f01..a3cf2ca54c4 100644 --- a/Master/texmf-dist/tex/context/base/back-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/back-ini.mkiv @@ -127,22 +127,6 @@ \let \doloadmapfile \gobbletwoarguments % + - = | filename \let \doloadmapline \gobbletwoarguments % + - = | fileline -%D \macros -%D {ifusepagedestinations} -%D -%D In \PDF\ version 1.0 only page references were supported, -%D while in \DVIWINDO\ 1.N only named references were accepted. -%D Therefore \CONTEXT\ supports both methods of referencing. In -%D \PDF\ version 1.1 named destinations arrived. Lack of -%D continuous support of version 1.1 viewers for \MSDOS\ -%D therefore sometimes forces us to prefer page references. As -%D a bonus, they are faster too and have no limitations. How -%D fortunate we were having both mechanisms available when the -%D version 3.0 (\PDF\ version 1.2) viewers proved to be too -%D bugged to support named destinations. - -\newif\ifusepagedestinations % not yet interfaced in mkiv - %D \macros %D {jobsuffix} %D @@ -153,7 +137,7 @@ \def\jobsuffix{pdf} -\ifdefined\resetsystemmode \else +\ifdefined\resetsystemmode \else % can't happen \let\setsystemmode \gobbleoneargument \let\resetsystemmode\gobbleoneargument \fi @@ -165,4 +149,14 @@ \unexpanded\def\setupoutput[#1]{} % will be command line switch +%D New: + +\newtoks\everysetupbackend + +\def\backendparameter#1{\csname\ifcsname\??bc#1\endcsname\??bc#1\else\s!empty\fi\endcsname} + +\def\setupbackend[#1]% + {\getparameters[\??bc][#1]% + \the\everysetupbackend} + \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/back-pdf.lua b/Master/texmf-dist/tex/context/base/back-pdf.lua index 54e22f1a2bd..33cb8c97558 100644 --- a/Master/texmf-dist/tex/context/base/back-pdf.lua +++ b/Master/texmf-dist/tex/context/base/back-pdf.lua @@ -6,7 +6,9 @@ if not modules then modules = { } end modules ['back-pdf'] = { license = "see context related readme files" } --- we will move code to lpdf-* files (second cleanup stage) +-- we will move code to lpdf-* files (second cleanup stage in 2011/2012) + +-- the push/pop is a mess (only needed for calculate ...) .. will be done differently --[[ldx--

This module implements a couple of cleanup methods. We need these @@ -20,29 +22,30 @@ local char, byte, format, gsub, rep, gmatch = string.char, string.byte, string.f local concat = table.concat local round = math.round local utfcharacters, utfvalues = string.utfcharacters, string.utfvalues -local texsprint, texwrite = tex.sprint, tex.write -local ctxcatcodes = tex.ctxcatcodes -local copy_node = node.copy +local backends, lpdf, nodes, node = backends, lpdf, nodes, node + +local copy_node = node.copy + +local nodeinjections = backends.pdf.nodeinjections +local codeinjections = backends.pdf.codeinjections +local registrations = backends.pdf.registrations -local nodeinjections = backends.pdf.nodeinjections -local codeinjections = backends.pdf.codeinjections -local registrations = backends.pdf.registrations +local nodepool = nodes.pool -local pdfliteral, register = nodes.pdfliteral, nodes.register +local register = nodepool.register -local pdfconstant = lpdf.constant -local pdfstring = lpdf.string -local pdfdictionary = lpdf.dictionary -local pdfarray = lpdf.array -local pdfreference = lpdf.reference -local pdfverbose = lpdf.verbose -local pdfflushobject = lpdf.flushobject -local pdfreserveobject = lpdf.reserveobject -local pdfannotation = nodes.pdfannotation +local pdfconstant = lpdf.constant +local pdfstring = lpdf.string +local pdfdictionary = lpdf.dictionary +local pdfarray = lpdf.array +local pdfreference = lpdf.reference +local pdfverbose = lpdf.verbose +local pdfflushobject = lpdf.flushobject +local pdfimmediateobject = lpdf.immediateobject -local pdfreserveobj = pdf.reserveobj -local pdfimmediateobj = pdf.immediateobj +local pdfliteral = nodepool.pdfliteral +local pdfannotation_node = nodepool.pdfannotation function nodeinjections.rgbcolor(r,g,b) return register(pdfliteral(format("%s %s %s rg %s %s %s RG",r,g,b,r,g,b))) @@ -86,9 +89,19 @@ end local cache = { } +function codeinjections.startlayer(name) + codeinjections.useviewerlayer(name) + return format("/OC /%s BDC",name) +end + +function codeinjections.stoplayer(name) + return "EMC" +end + function nodeinjections.startlayer(name) local c = cache[name] if not c then + codeinjections.useviewerlayer(name) c = register(pdfliteral(format("/OC /%s BDC",name))) cache[name] = c end @@ -103,17 +116,18 @@ end local cache = { } -function nodeinjections.switchlayer(name) +function nodeinjections.switchlayer(name) -- not used, optimization local c = cache[name] if not c then + codeinjections.useviewerlayer(name) c = register(pdfliteral(format("EMC /OC /%s BDC",name))) end return copy_node(c) end --- code +-- code, will move to lpdf-* -function codeinjections.insertmovie(specification) +function nodeinjections.insertmovie(specification) -- managed in figure inclusion: width, height, factor, repeat, controls, preview, label, foundname local width = specification.width local height = specification.height @@ -134,12 +148,12 @@ function codeinjections.insertmovie(specification) Movie = moviedict, A = controldict, } - node.write(pdfannotation(width,height,0,action())) + node.write(pdfannotation_node(width,height,0,action())) end -function codeinjections.insertsound(specification) +function nodeinjections.insertsound(specification) -- rmanaged in interaction: repeat, label, foundname - local soundclip = interactions.soundclip(specification.label) + local soundclip = interactions.soundclips.soundclip(specification.label) if soundclip then local controldict = pdfdictionary { Mode = (specification["repeat"] and pdfconstant("Repeat")) or nil @@ -154,7 +168,7 @@ function codeinjections.insertsound(specification) Movie = sounddict, A = controldict, } - node.write(pdfannotation(0,0,0,action())) + node.write(pdfannotation_node(0,0,0,action())) end end @@ -179,14 +193,22 @@ local gray_function = "%s mul" local documentcolorspaces = pdfdictionary() local spotcolorhash = { } -- not needed -local spotcolornames = { } -local indexcolorhash = { } -local delayedindexcolors = { } +local spotcolornames = { } +local indexcolorhash = { } +local delayedindexcolors = { } function registrations.spotcolorname(name,e) spotcolornames[name] = e or name end +function registrations.getspotcolorreference(name) + return spotcolorhash[name] +end + +-- beware: xpdf/okular/evince cannot handle the spot->process shade + +local processcolors + local function registersomespotcolor(name,noffractions,names,p,colorspace,range,funct) noffractions = tonumber(noffractions) or 1 -- to be checked if noffractions == 0 then @@ -197,14 +219,20 @@ local function registersomespotcolor(name,noffractions,names,p,colorspace,range, Domain = { 0, 1 }, Range = range, } - local n = pdfimmediateobj("stream",format("{ %s }",funct),dictionary()) + local calculations = pdfimmediateobject("stream",format("{ %s }",funct),dictionary()) -- todo: lpdf.stream + -- local calculations = pdfobject { + -- type = "stream", + -- immediate = true, + -- string = format("{ %s }",funct), + -- attr = dictionary(), + -- } local array = pdfarray { pdf_separation, pdfconstant(spotcolornames[name] or name), colorspace, - pdfreference(n), + pdfreference(calculations), } - local m = pdfimmediateobj(tostring(array)) + local m = pdfimmediateobject(tostring(array)) local mr = pdfreference(m) spotcolorhash[name] = m documentcolorspaces[name] = mr @@ -212,24 +240,55 @@ local function registersomespotcolor(name,noffractions,names,p,colorspace,range, else local cnames = pdfarray() local domain = pdfarray() + local colorants = pdfdictionary() for n in gmatch(names,"[^,]+") do - cnames[#cnames+1] = pdfconstant(spotcolornames[n] or n) + local name = spotcolornames[n] or n + if n == "cyan" then + name = "Cyan" + elseif n == "magenta" then + name = "Magenta" + elseif n == "yellow" then + name = "Yellow" + elseif n == "black" then + name = "Black" + else + colorants[name] = pdfreference(spotcolorhash[name] or spotcolorhash[n]) + end + cnames[#cnames+1] = pdfconstant(name) domain[#domain+1] = 0 domain[#domain+1] = 1 end + if not processcolors then + local specification = pdfdictionary { + ColorSpace = pdfconstant("DeviceCMYK"), + Components = pdfarray { + pdfconstant("Cyan"), + pdfconstant("Magenta"), + pdfconstant("Yellow"), + pdfconstant("Black") + } + } + processcolors = pdfreference(pdfimmediateobject(tostring(specification))) + end local dictionary = pdfdictionary { FunctionType = 4, Domain = domain, Range = range, } - local n = pdfimmediateobj("stream",format("{ %s %s }",rep("pop ",noffractions),funct),dictionary()) + local calculation = pdfimmediateobject("stream",format("{ %s %s }",rep("pop ",noffractions),funct),dictionary()) + local channels = pdfdictionary { + Subtype = pdfconstant("NChannel"), + Colorants = colorants, + Process = processcolors, + } local array = pdfarray { pdf_device_n, cnames, colorspace, - pdfreference(n), + pdfreference(calculation), + lpdf.shareobjectreference(tostring(channels)), -- optional but needed for shades } - local m = pdfimmediateobj(tostring(array)) + local m = pdfimmediateobject(tostring(array)) local mr = pdfreference(m) spotcolorhash[name] = m documentcolorspaces[name] = mr @@ -237,7 +296,9 @@ local function registersomespotcolor(name,noffractions,names,p,colorspace,range, end end -function registersomeindexcolor(name,noffractions,names,p,colorspace,range,funct) +-- wrong name + +local function registersomeindexcolor(name,noffractions,names,p,colorspace,range,funct) noffractions = tonumber(noffractions) or 1 -- to be checked local cnames = pdfarray() local domain = pdfarray() @@ -256,7 +317,7 @@ function registersomeindexcolor(name,noffractions,names,p,colorspace,range,funct Domain = domain, Range = range, } - local n = pdfimmediateobj("stream",format("{ %s %s }",rep("exch pop ",noffractions),funct),dictionary()) -- exch pop + local n = pdfimmediateobject("stream",format("{ %s %s }",rep("exch pop ",noffractions),funct),dictionary()) -- exch pop local a = pdfarray { pdf_device_n, cnames, @@ -280,7 +341,7 @@ function registersomeindexcolor(name,noffractions,names,p,colorspace,range,funct vector[#vector+1] = concat(set) end vector = pdfverbose { "<", concat(vector, " "), ">" } - local n = pdfimmediateobj(tostring(pdfarray{ pdf_indexed, a, 255, vector })) + local n = pdfimmediateobject(tostring(pdfarray{ pdf_indexed, a, 255, vector })) lpdf.adddocumentcolorspace(format("%s_indexed",name),pdfreference(n)) return n end @@ -289,13 +350,11 @@ end local function delayindexcolor(name,names,func) local hash = (names ~= "" and names) or name - -- logs.report("index colors","delaying '%s'",name) delayedindexcolors[hash] = func end local function indexcolorref(name) -- actually, names (parent) is the hash if not indexcolorhash[name] then - -- logs.report("index colors","registering '%s'",name) local delayedindexcolor = delayedindexcolors[name] if type(delayedindexcolor) == "function" then indexcolorhash[name] = delayedindexcolor() @@ -395,7 +454,7 @@ function registrations.transparency(n,a,t) BM = transparencies[1], AIS = false, } - local m = pdfimmediateobj(tostring(d)) + local m = pdfimmediateobject(tostring(d)) local mr = pdfreference(m) transparencyhash[0] = m documenttransparencies[0] = mr @@ -407,10 +466,10 @@ function registrations.transparency(n,a,t) Type = pdf_extgstate, ca = tonumber(t), CA = tonumber(t), - BM = transparencies[a] or transparencies[0], + BM = transparencies[tonumber(a)] or transparencies[0], AIS = false, } - local m = pdfimmediateobj(tostring(d)) + local m = pdfimmediateobject(tostring(d)) local mr = pdfreference(m) transparencyhash[n] = m documenttransparencies[n] = mr @@ -418,6 +477,8 @@ function registrations.transparency(n,a,t) end end +-- overloaded in lpdf-xmp: + function codeinjections.adddocumentinfo(key,value) lpdf.addtoinfo(key,lpdf.tosixteen(value)) end @@ -425,11 +486,11 @@ end -- graphics function codeinjections.setfigurealternative(data,figure) - local display = data.request.display + local request = data.request + local display = request.display if display and display ~= "" then - local request = data.request - figures.push { - name = request.display, + local nested = figures.push { + name = display, page = request.page, size = request.size, prefix = request.prefix, @@ -442,28 +503,112 @@ function codeinjections.setfigurealternative(data,figure) if displayfigure then -- figure.aform = true img.immediatewrite(figure) - local a = lpdf.array { - lpdf.dictionary { - Image = lpdf.reference(figure.objnum), + local a = pdfarray { + pdfdictionary { + Image = pdfreference(figure.objnum), DefaultForPrinting = true, } } - local d = lpdf.dictionary { - Alternates = lpdf.reference(pdf.immediateobj(tostring(a))), + local d = pdfdictionary { + Alternates = pdfreference(pdfimmediateobject(tostring(a))), } displayfigure.attr = d() - return displayfigure, figures.current() + figures.pop() + return displayfigure, nested + else + figures.pop() end end end --- eventually we need to load this runtime --- --- backends.install((environment and environment.arguments and environment.arguments.backend) or "pdf") --- --- but now we need to force this as we also load the pdf tex part which hooks into all kind of places +function codeinjections.getpreviewfigure(request) + local figure = figures.initialize(request) + if not figure then + return + end + figure = figures.identify(figure) + if not figure then + return + end + figure = figures.check(figure) + if not figure then + return + end + local image = figure.status.private + if image then + img.immediatewrite(image) + end + return figure +end + +function codeinjections.setfiguremask(data,figure) -- mark + local request = data.request + local mask = request.mask + if mask and mask ~= "" then + figures.push { + name = mask, + page = request.page, + size = request.size, + prefix = request.prefix, + cache = request.cache, + width = request.width, + height = request.height, + } + figures.identify() + local maskfigure = figures.check() + if maskfigure then + local image = maskfigure.status.private + if image then + img.immediatewrite(image) + local d = pdfdictionary { + Interpolate = false, + SMask = pdfreference(image.objnum), + } + figure.attr = d() + end + end + figures.pop() + end +end + +local outputfilename + +function codeinjections.getoutputfilename() + if not outputfilename then + outputfilename = file.addsuffix(tex.jobname,"pdf") + end + return outputfilename +end + +-- temp hack + +local factor = number.dimenfactors.bp + +function img.package(image) + local boundingbox = image.bbox + local imagetag = "Im" .. image.index + local resources = pdfdictionary { + ProcSet = pdfarray { + pdfconstant("PDF"), + pdfconstant("ImageC") + }, + Resources = pdfdictionary { + XObject = pdfdictionary { + [imagetag] = pdfreference(image.objnum) + } + } + } + local width = boundingbox[3] + local height = boundingbox[4] + local xform = img.scan { + attr = resources(), + stream = format("%s 0 0 %s 0 0 cm /%s Do",width,height,imagetag), + bbox = { 0, 0, width/factor, height/factor }, + } + img.immediatewrite(xform) + return xform +end -codeinjections.finalizepage = lpdf.finalizepage -codeinjections.finalizedocument = lpdf.finalizedocument +-- till here backends.install("pdf") diff --git a/Master/texmf-dist/tex/context/base/back-pdf.mkiv b/Master/texmf-dist/tex/context/base/back-pdf.mkiv index a10afd5b901..5b7de128de4 100644 --- a/Master/texmf-dist/tex/context/base/back-pdf.mkiv +++ b/Master/texmf-dist/tex/context/base/back-pdf.mkiv @@ -13,30 +13,71 @@ \writestatus{loading}{ConTeXt Backend Macros / PDF} -\registerctxluafile{back-pdf}{1.001} % this will change +\registerctxluafile{lpdf-ini}{1.001} +\registerctxluafile{lpdf-col}{1.000} +\registerctxluafile{lpdf-xmp}{1.001} +\registerctxluafile{lpdf-nod}{1.001} +\registerctxluafile{lpdf-mis}{1.001} +\registerctxluafile{lpdf-ano}{1.001} +\registerctxluafile{lpdf-ren}{1.001} +\registerctxluafile{lpdf-grp}{1.001} +\registerctxluafile{lpdf-wid}{1.001} +\registerctxluafile{lpdf-fld}{1.001} +\registerctxluafile{lpdf-u3d}{1.001} +\registerctxluafile{lpdf-swf}{1.001} +\registerctxluafile{lpdf-tag}{1.001} +\registerctxluafile{lpdf-fmt}{1.001} +\registerctxluafile{lpdf-epd}{1.001} +\registerctxluafile{lpdf-epa}{1.001} + +\registerctxluafile{back-pdf}{1.001} % some code will move to lpdf-* \unprotect %D We will minimize the number of calls to \PDF\ specific primitives %D and delegate all management and injection of code to the backend. %D -%D Here we initialize some internal quantities. - -\pdfoutput = 1 -\pdfhorigin = 1 true in -\pdfvorigin = 1 true in -\pdfimageresolution = 300 -\pdfpkresolution = 600 -\pdfdecimaldigits = 10 -\pdfinclusionerrorlevel = 0 -\pdfminorversion = 6 % maybe even 7 -%pdfuniqueresname = 1 +%D Here we initialize some internal quantities. We also protect them. + +\pdfoutput 1 \let\pdfoutput \undefined \newcount\pdfoutput \pdfoutput 1 +\pdfhorigin 1 true in \let\pdfhorigin\undefined \newdimen\pdfhorigin \pdfhorigin 1 true in +\pdfvorigin 1 true in \let\pdfvorigin\undefined \newdimen\pdfvorigin \pdfvorigin 1 true in + +% most of these will be protected as well + +\pdfimageresolution 300 +\pdfpkresolution 600 +\pdfdecimaldigits 10 +\pdfinclusionerrorlevel 0 +\pdfminorversion 6 % use setupbackend for changes %D This one can be consulted by users although the suffix is also %D a system mode. \setjobsuffix{pdf} +%D PDF/X (matbe combine the two lua calls) + +\setupbackend + [xmpfile=] + +\appendtoks + \doifsomething{\backendparameter{xmpfile}} + {\ctxcommand{setxmpfile("\backendparameter{xmpfile}")}}% +\to \everysetupbackend + +\appendtoks + \doifsomething{\backendparameter\c!format} + {\ctxcommand{setformat { + format = "\backendparameter\c!format", + level = "\backendparameter\c!level", + option = "\backendparameter\c!option", + profile = "\backendparameter\c!profile", + intent = "\backendparameter\c!intent", + file = "\backendparameter\c!file", + }}}% +\to \everysetupbackend + %D For the moment we keep these. \newtoks \pdfbackendeveryximage @@ -59,6 +100,8 @@ \def\pdfbackendcurrentresources {\ctxlua{lpdf.collectedresources()}} +\def\pdfcolor #1{\ctxlua{lpdf.pdfcolor(\thecolorattribute{#1})}} \let\PDFcolor\pdfcolor + %D Let's block these: \let\pdfcatalog \relax \newtoks\pdfcatalog @@ -77,16 +120,6 @@ \pdfbackendsetinfo{ConTeXt.Url} {www.pragma-ade.com}% \to \everylastbackendshipout -%D Unfortunately this is still needed (also for \METAPOST\ to -%D \PDF\ converter): - -% \def\doresetmapfilelist -% {\global\let\doresetmapfilelist\relax -% \pdfmapfile{original-empty.map}} -% -% \appendtoksonce \loadallfontmapfiles \to \pdfbackendeveryxform -% \appendtoksonce \loadallfontmapfiles \to \pdfbackendeveryximage - %D Transformations. Some day we will use primitives (once they're fixed). \def\dostartrotation#1% grouped @@ -119,7 +152,7 @@ %D The following will move to the backend \LUA\ code: \appendtoks \ctxlua{backends.codeinjections.finalizepage ()}\to \everybackendshipout % is immediate -\appendtoks \ctxlua{backends.codeinjections.finalizedocument()}\to \everylastbackendshipout % is immediate +%appendtoks \ctxlua{backends.codeinjections.finalizedocument()}\to \everylastbackendshipout % is immediate %D Temporary hack, will be removed or improved or default. @@ -157,14 +190,6 @@ \donothing \endgroup} -\def\doPDFgetobjectpage#1#2#3% - {\dogetobjectreferencepage{#1}{#2}#3% - \ifx#3\empty\def#3{\realfolio}\fi} - -\def\doPDFgetobjectpagereference#1#2#3% - {\dogetobjectreferencepage{#1}{#2}#3% - \doPDFgetpagereference{\ifx#3\empty\realfolio\else#3\fi}#3} - \let\lastpredefinedsymbol\empty % some day we can do more at the lua end \def\predefinesymbol[#1]% @@ -175,4 +200,244 @@ \ctxlua{backends.codeinjections.registersymbol("#1",\lastref)}% \endgroup} +% for the moment here + +%D \macros +%D {doovalbox} +%D +%D Drawing frames with round corners is inherited from the +%D main module. +%D +%D For drawing ovals we use quite raw \PDF\ code. The next +%D implementation does not differ that much from the one +%D implemented in the \POSTSCRIPT\ driver. This code is +%D somewhat obsolete as we now have metapost embedded. + +\def\doPDFovalcalc#1#2#3% + {\PointsToBigPoints{\dimexpr#1+#2\relax}#3} + +\def\doovalbox#1#2#3#4#5#6#7#8% todo: \scratchdimen/\scatchbox + {\forcecolorhack + \bgroup + \dimen0=#4\divide\dimen0 \plustwo + \doPDFovalcalc{0pt}{+\dimen0}\xmin + \doPDFovalcalc{#1}{-\dimen0}\xmax + \doPDFovalcalc{#2}{-\dimen0}\ymax + \doPDFovalcalc{-#3}{+\dimen0}\ymin + \advance\dimen0 by #5% + \doPDFovalcalc{0pt}{+\dimen0}\xxmin + \doPDFovalcalc{#1}{-\dimen0}\xxmax + \doPDFovalcalc{#2}{-\dimen0}\yymax + \doPDFovalcalc{-#3}{+\dimen0}\yymin + \doPDFovalcalc{#4}{\zeropoint}\stroke + \doPDFovalcalc{#5}{\zeropoint}\radius + \edef\dostroke{#6}% + \edef\dofill{#7}% + \edef\mode{\number#8 \space}% + % no \ifcase, else \relax in pdfcode + \setbox\scratchbox\hbox + {\ifnum\dostroke\dofill>\zerocount + \pdfliteral + {q + \stroke\space w + \ifcase\mode + \xxmin\space \ymin \space m + \xxmax\space \ymin \space l + \xmax \space \ymin \space \xmax \space \yymin\space y + \xmax \space \yymax\space l + \xmax \space \ymax \space \xxmax\space \ymax \space y + \xxmin\space \ymax \space l + \xmin \space \ymax \space \xmin \space \yymax\space y + \xmin \space \yymin\space l + \xmin \space \ymin \space \xxmin\space \ymin \space y + h + \or % 1 + \xxmin\space \ymin \space m + \xxmax\space \ymin \space l + \xmax \space \ymin \space \xmax \space \yymin\space y + \xmax \space \ymax \space l + \xmin \space \ymax \space l + \xmin \space \yymin\space l + \xmin \space \ymin \space \xxmin\space \ymin \space y + h + \or % 2 + \xxmin\space \ymin \space m + \xmax \space \ymin \space l + \xmax \space \ymax \space l + \xxmin\space \ymax \space l + \xmin \space \ymax \space \xmin \space \yymax\space y + \xmin \space \yymin\space l + \xmin \space \ymin \space \xxmin\space \ymin \space y + h + \or % 3 + \xmin \space \ymin \space m + \xmax \space \ymin \space l + \xmax \space \yymax\space l + \xmax \space \ymax \space \xxmax\space \ymax \space y + \xxmin\space \ymax \space l + \xmin \space \ymax \space \xmin \space \yymax\space y + \xmin \space \ymin \space l + h + \or % 4 + \xmin \space \ymin \space m + \xxmax\space \ymin \space l + \xmax \space \ymin \space \xmax \space \yymin\space y + \xmax \space \yymax\space l + \xmax \space \ymax \space \xxmax\space \ymax \space y + \xmin \space \ymax \space l + \xmin \space \ymin\space l + h + \or % 5 + \xmin \space \ymin \space m + \xmax \space \ymin \space l + \xmax \space \yymax\space l + \xmax \space \ymax \space \xxmax\space \ymax \space y + \xmin \space \ymax \space l + \xmin \space \ymin \space l + h + \or % 6 + \xmin \space \ymin \space m + \xxmax\space \ymin \space l + \xmax \space \ymin \space \xmax \space \yymin\space y + \xmax \space \ymax \space l + \xmin \space \ymax \space l + \xmin \space \ymin \space l + h + \or + \xxmin\space \ymin \space m + \xmax \space \ymin \space l + \xmax \space \ymax \space l + \xmin \space \ymax \space l + \xmin \space \yymin\space l + \xmin \space \ymin \space \xxmin\space \ymin \space y + h + \or + \xmin \space \ymin \space m + \xmax \space \ymin \space l + \xmax \space \ymax \space l + \xxmin\space \ymax \space l + \xmin \space \ymax \space \xmin \space \yymax\space y + \xmin \space \ymin \space l + h + \or % 9 top open + \xmin \space \ymax \space m + \xmin \space \yymin\space l + \xmin \space \ymin \space \xxmin\space \ymin \space y + \xxmax\space \ymin \space l + \xmax \space \ymin \space \xmax \space \yymin\space y + \xmax \space \ymax \space l + \or % 10 right open + \xmax \space \ymax \space m + \xxmin\space \ymax \space l + \xmin \space \ymax \space \xmin \space \yymax\space y + \xmin \space \yymin\space l + \xmin \space \ymin \space \xxmin\space \ymin \space y + \xmax\space \ymin \space l + \or % 11 bottom open + \xmax \space \ymin \space m + \xmax \space \yymax\space l + \xmax \space \ymax \space \xxmax \space \ymax\space y + \xxmin\space \ymax \space l + \xmin \space \ymax \space \xmin \space \yymax\space y + \xmin \space \ymin \space l + \or % 12 left open + \xmin \space \ymax \space m + \xxmax\space \ymax \space l + \xmax \space \ymax \space \xmax \space \yymax\space y + \xmax \space \yymin\space l + \xmax \space \ymin \space \xxmax\space \ymin \space y + \xmin \space \ymin \space l + \or % 13 + \xmin \space \ymax \space m + \xxmax\space \ymax \space l + \xmax \space \ymax \space \xmax \space \yymax\space y + \xmax\space \ymin \space l + \or % 14 + \xmax \space \ymax \space m + \xmax \space \yymin\space l + \xmax \space \ymin \space \xxmax\space \ymin \space y + \xmin \space \ymin \space l + \or % 15 + \xmax \space \ymin \space m + \xxmin\space \ymin \space l + \xmin \space \ymin \space \xmin \space \yymin\space y + \xmin \space \ymax \space l + \or % 16 + \xmin \space \ymin \space m + \xmin \space \yymax\space l + \xmin \space \ymax \space \xxmin\space \ymax \space y + \xmax \space \ymax \space l + \or % 17 + \xxmax\space \ymax \space m + \xmax \space \ymax \space \xmax \space \yymax\space y + \or % 18 + \xmax \space \yymin\space m + \xmax \space \ymin \space \xxmax\space \ymin \space y + \or % 19 + \xxmin\space \ymin \space m + \xmin \space \ymin \space \xmin \space \yymin\space y + \or % 20 + \xmin \space \yymax\space m + \xmin \space \ymax \space \xxmin\space \ymax \space y + \or % 21 + \xxmax\space \ymax \space m + \xmax \space \ymax \space \xmax \space \yymax\space y + \xmin \space \yymax\space m + \xmin \space \ymax \space \xxmin\space \ymax \space y + \or % 22 + \xxmax\space \ymax \space m + \xmax \space \ymax \space \xmax \space \yymax\space y + \xmax \space \yymin\space m + \xmax \space \ymin \space \xxmax\space \ymin \space y + \or % 23 + \xmax \space \yymin\space m + \xmax \space \ymin \space \xxmax\space \ymin \space y + \xxmin\space \ymin \space m + \xmin \space \ymin \space \xmin \space \yymin\space y + \or % 24 + \xxmin\space \ymin \space m + \xmin \space \ymin \space \xmin \space \yymin\space y + \xmin \space \yymax\space m + \xmin \space \ymax \space \xxmin\space \ymax \space y + \or % 25 + \xxmax\space \ymax \space m + \xmax \space \ymax \space \xmax \space \yymax\space y + \xmax \space \yymin\space m + \xmax \space \ymin \space \xxmax\space \ymin \space y + \xxmin\space \ymin \space m + \xmin \space \ymin \space \xmin \space \yymin\space y + \xmin \space \yymax\space m + \xmin \space \ymax \space \xxmin\space \ymax \space y + \or % 26 + \xmax \space \yymin\space m + \xmax \space \ymin \space \xxmax\space \ymin \space y + \xmin \space \yymax\space m + \xmin \space \ymax \space \xxmin\space \ymax \space y + \or % 27 + \xxmax\space \ymax \space m + \xmax \space \ymax \space \xmax \space \yymax\space y + \xxmin\space \ymin \space m + \xmin \space \ymin \space \xmin \space \yymin\space y + \or % 28 + \fi + \ifnum\mode>8 + S + \else + \ifnum\dostroke=\plusone S \fi + \ifnum\dofill =\plusone f \fi + \fi + Q}% + \fi}% + \wd\scratchbox#1\ht\scratchbox#2\dp\scratchbox#3\box\scratchbox + \egroup} + +\unexpanded\def\pdfactualtext#1#2% + {\pdfliteral direct{/Span <> BDC}% + #1% + \pdfliteral direct{EMC}} + +% \starttext +% text \pdfactualtext{Meier}{Müller} text +% \stoptext + \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/back-u3d.mkiv b/Master/texmf-dist/tex/context/base/back-u3d.mkiv index 398159feb2c..e2609449650 100644 --- a/Master/texmf-dist/tex/context/base/back-u3d.mkiv +++ b/Master/texmf-dist/tex/context/base/back-u3d.mkiv @@ -124,28 +124,31 @@ toolbar = true, preview = 'cloudq.png' \stopluaparameterset + \startluaparameterset[u3d:myset:display:3] toolbar = true, - tree = false, + tree = false, preview = 'area.png' \stopluaparameterset + \startluaparameterset[u3d:myset:display:4] toolbar = true, - tree = false, - view = { - name = 'view', - bg = {0.1,0.1,0.1}, - c2c = {-1,-1,0}, - roo = 50, - aac = 2.5, - roll = 45, + tree = false, + view = { + name = 'view', + bg = {0.1,0.1,0.1}, + c2c = {-1,-1,0}, + roo = 50, + aac = 2.5, + roll = 45, lights = 'Red' } \stopluaparameterset + \startluaparameterset[u3d:myset:display:5] toolbar = true, - tree = false, - view = 'ortho' + tree = false, + view = 'ortho' \stopluaparameterset \placefigure[here]{none}{\externalfigure[cloudq][display=u3d:myset:display:2]} diff --git a/Master/texmf-dist/tex/context/base/bibl-bib.lua b/Master/texmf-dist/tex/context/base/bibl-bib.lua index 3c0dad2fa4e..e0e5a6c3a42 100644 --- a/Master/texmf-dist/tex/context/base/bibl-bib.lua +++ b/Master/texmf-dist/tex/context/base/bibl-bib.lua @@ -16,20 +16,28 @@ local utf = unicode.utf8 local lower, format, gsub, concat = string.lower, string.format, string.gsub, table.concat local next = next local utfchar = utf.char -local lpegmatch = lpeg.match +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns local textoutf = characters and characters.tex.toutf local variables = interfaces and interfaces.variables - +local settings_to_hash = utilities.parsers.settings_to_hash local finalizers = xml.finalizers.tex -local xmlfilter, xmltext = xml.filter, xml.text +local xmlfilter, xmltext, getid = xml.filter, xml.text, lxml.getid + +local P, R, S, C, Cc, Cs, Ct = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct local trace_bibxml = false trackers.register("publications.bibxml", function(v) trace_bibtex = v end) -bibtex = bibtex or { } +local report_xml = logs.reporter("publications","xml") -bibtex.size = 0 -bibtex.definitions = 0 -bibtex.shortcuts = 0 +bibtex = bibtex or { } +local bibtex = bibtex + +bibtex.statistics = bibtex.statistics or { } +local bibtexstats = bibtex.statistics + +bibtexstats.nofbytes = 0 +bibtexstats.nofdefinitions = 0 +bibtexstats.nofshortcuts = 0 local defaultshortcuts = { jan = "1", @@ -55,7 +63,7 @@ local entries -- hashed again. local function do_shortcut(tag,key,value) - bibtex.shortcuts = bibtex.shortcuts + 1 + bibtexstats.nofshortcuts = bibtexstats.nofshortcuts + 1 if lower(tag) == "@string" then shortcuts[key] = value end @@ -63,7 +71,7 @@ end local function do_definition(tag,key,tab) -- maybe check entries here (saves memory) if not entries or entries[key] then - bibtex.definitions = bibtex.definitions + 1 + bibtexstats.nofdefinitions = bibtexstats.nofdefinitions + 1 local t = { } for i=1,#tab,2 do t[tab[i]] = tab[i+1] @@ -81,8 +89,6 @@ local function resolve(s) return shortcuts[s] or defaultshortcuts[s] or s -- can be number end -local P, R, S, C, Cc, Cs, Ct = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct - local percent = P("%") local start = P("@") local comma = P(",") @@ -101,10 +107,10 @@ local collapsed = (space^1)/ " " local function add(a,b) if b then return a..b else return a end end -local keyword = C((lpeg.R("az","AZ","09") + S("@_:-"))^1) -- lpeg.C((1-space)^1) +local keyword = C((R("az","AZ","09") + S("@_:-"))^1) -- C((1-space)^1) local s_quoted = ((escape*single) + collapsed + (1-single))^0 local d_quoted = ((escape*double) + collapsed + (1-double))^0 -local balanced = lpeg.patterns.balanced +local balanced = lpegpatterns.balanced local s_value = (single/"") * s_quoted * (single/"") local d_value = (double/"") * d_quoted * (double/"") @@ -116,7 +122,7 @@ local value = Cs((somevalue * ((spacing * hash * spacing)/"" * somevalue)^0 local assignment = spacing * keyword * spacing * equal * spacing * value * spacing local shortcut = keyword * spacing * left * spacing * (assignment * comma^0)^0 * spacing * right -local definition = keyword * spacing * left * spacing * keyword * comma * lpeg.Ct((assignment * comma^0)^0) * spacing * right +local definition = keyword * spacing * left * spacing * keyword * comma * Ct((assignment * comma^0)^0) * spacing * right local comment = keyword * spacing * left * (1-right)^0 * spacing * right local forget = percent^1 * (1-lineending)^0 @@ -127,21 +133,20 @@ local grammar = (space + forget + shortcut/do_shortcut + definition/do_definitio function bibtex.convert(session,content) statistics.starttiming(bibtex) data, shortcuts, entries = session.data, session.shortcuts, session.entries - -- session.size = session.size + #content - bibtex.size = bibtex.size + #content - session.size = session.size + #content + bibtexstats.nofbytes = bibtexstats.nofbytes + #content + session.nofbytes = session.nofbytes + #content lpegmatch(grammar,content or "") statistics.stoptiming(bibtex) end function bibtex.load(session,filename) - local filename = resolvers.find_file(filename,"bib") + local filename = resolvers.findfile(filename,"bib") if filename ~= "" then local data = io.loaddata(filename) or "" if data == "" then - logs.report("publications","empty file '%s', no conversion to xml",filename) + report_xml("empty file '%s', no conversion to xml",filename) elseif trace_bibxml then - logs.report("publications","converting file '%s' to xml",filename) + report_xml("converting file '%s' to xml",filename) end bibtex.convert(session,data) end @@ -149,16 +154,16 @@ end function bibtex.new() return { - data = { }, + data = { }, shortcuts = { }, - xml = xml.convert("\n"), - size = 0, - entries = nil, - loaded = false, + xml = xml.convert("\n"), + nofbytes = 0, + entries = nil, + loaded = false, } end -local escaped_pattern = xml.escaped_pattern +local escaped_pattern = lpegpatterns.xml.escaped local ihatethis = { f = "\\f", @@ -193,12 +198,12 @@ function bibtex.toxml(session,options) -- we can always speed this up if needed -- format slows down things a bit but who cares statistics.starttiming(bibtex) - local result = { } - local options = aux.settings_to_hash(options) + local result, r = { }, 0 + local options = settings_to_hash(options) local convert = options.convert -- todo: interface local strip = options.strip -- todo: interface local entries = session.entries - result[#result+1] = format("") + r = r + 1 ; result[r] = format("") result[#result+1] = format("") for id, categories in next, session.data do id = lower(gsub(id,"^@","")) @@ -218,14 +223,14 @@ function bibtex.toxml(session,options) -- kind of hackery ... bibtex databases are quite unportable value = lpegmatch(filter,value) or value end - result[#result+1] = format(" %s",key,value) + r = r + 1 ; result[r] = format(" %s",key,value) end end - result[#result+1] = format("") + r = r + 1 ; result[r] = format("") end end end - result[#result+1] = format("") + r = r + 1 ; result[r] = format("") result = concat(result,"\n") -- alternatively we could use lxml.convert session.xml = xml.convert(result, { @@ -240,10 +245,10 @@ function bibtex.toxml(session,options) end statistics.register("bibtex load time", function() - local size = bibtex.size - if size > 0 then + local nofbytes = bibtexstats.nofbytes + if nofbytes > 0 then return format("%s seconds (%s bytes, %s definitions, %s shortcuts)", - statistics.elapsedtime(bibtex),size,bibtex.definitions,bibtex.shortcuts) + statistics.elapsedtime(bibtex),nofbytes,bibtexstats.nofdefinitions,bibtexstats.nofshortcuts) else return nil end @@ -264,14 +269,14 @@ end) --~ local session = bibtex.new() --~ bibtex.convert(session,str) --~ bibtex.toxml(session) ---~ print(session.size,statistics.elapsedtime(bibtex)) +--~ print(session.nofbytes,statistics.elapsedtime(bibtex)) --~ local session = bibtex.new() --~ bibtex.load(session,"IEEEabrv.bib") --~ bibtex.load(session,"IEEEfull.bib") --~ bibtex.load(session,"IEEEexample.bib") --~ bibtex.toxml(session) ---~ print(session.size,statistics.elapsedtime(bibtex)) +--~ print(session.nofbytes,statistics.elapsedtime(bibtex)) --~ local session = bibtex.new() --~ bibtex.load(session,"gut.bib") @@ -284,27 +289,29 @@ end) --~ bibtex.load(session,"texnique.bib") --~ bibtex.load(session,"tugboat.bib") --~ bibtex.toxml(session) ---~ print(session.size,statistics.elapsedtime(bibtex)) +--~ print(session.nofbytes,statistics.elapsedtime(bibtex)) --~ print(table.serialize(session.data)) --~ print(table.serialize(session.shortcuts)) --~ print(xml.serialize(session.xml)) -if not characters then dofile(resolvers.find_file("char-def.lua")) end +if not characters then dofile(resolvers.findfile("char-def.lua")) end local chardata = characters.data local concat = table.concat -local P, Ct, lpegmatch = lpeg.P, lpeg.Ct, lpeg.match +local lpeg = lpeg + +local P, Ct, lpegmatch, lpegpatterns = lpeg.P, lpeg.Ct, lpeg.match, lpeg.patterns local space, comma = P(" "), P(",") local andsplitter = Ct(lpeg.splitat(space^1 * "and" * space^1)) local commasplitter = Ct(lpeg.splitat(space^0 * comma * space^0)) local spacesplitter = Ct(lpeg.splitat(space^1)) -local firstcharacter = lpeg.patterns.utf8byte +local firstcharacter = lpegpatterns.utf8byte -function is_upper(str) +local function is_upper(str) local first = lpegmatch(firstcharacter,str) local okay = chardata[first] return okay and okay.category == "lu" @@ -578,8 +585,8 @@ end -- pays off. local function collectauthoryears(id,list) - list = aux.settings_to_hash(list) - id = lxml.get_id(id) + list = settings_to_hash(list) + id = getid(id) local found = { } for e in xml.collected(id,"/bibtex/entry") do if list[e.at.tag] then @@ -631,9 +638,6 @@ end if commands then - local texsprint = tex and tex.sprint - local ctxcatcodes = tex and tex.ctxcatcodes - local sessions = { } function commands.definebibtexsession(name) @@ -667,7 +671,7 @@ if commands then if collected then local author = collected[1].dt[1] or "" if author ~= "" then - texsprint(ctxcatcodes,authors.concat(author,method,what,settings)) + context(authors.concat(author,method,what,settings)) end end end @@ -677,7 +681,7 @@ if commands then local c = collected[1] local year = xmlfilter(c,"xml://field[@name='year']/text()") local author = xmlfilter(c,"xml://field[@name='author']/text()") - texsprint(ctxcatcodes,authors.short(author,year)) + context(authors.short(author,year)) end end @@ -711,31 +715,32 @@ if commands then function bibtex.authorref(id,list) local result = collectauthoryears(id,list,method,what) for author, years in next, result do - texsprint(ctxcatcodes,authors.concat(author,method,what,settings)) + context(authors.concat(author,method,what,settings)) end end function bibtex.authoryearref(id,list) local result = collectauthoryears(id,list,method,what) for author, years in next, result do - texsprint(ctxcatcodes,authors.concat(author,method,what,settings)," (",concat(years,", "),")") + context("%s (%s)",authors.concat(author,method,what,settings),concat(years,", ")) end end function bibtex.authoryearsref(id,list) local result = collectauthoryears(id,list,method,what) for author, years in next, result do - texsprint(ctxcatcodes,"(",authors.concat(author,method,what,settings),", ",concat(years,", "),")") + context("(%s, %s)",authors.concat(author,method,what,settings),concat(years,", ")) end end - function bibtex.singular_or_plural(singular,plural) + function bibtex.singularorplural(singular,plural) if lastconcatsize and lastconcatsize > 1 then - texsprint(ctxcatcodes,plural) + context(plural) else - texsprint(ctxcatcodes,singular) + context(singular) end end + end diff --git a/Master/texmf-dist/tex/context/base/bibl-bib.mkiv b/Master/texmf-dist/tex/context/base/bibl-bib.mkiv index 10abe5cb8a7..681be325f2b 100644 --- a/Master/texmf-dist/tex/context/base/bibl-bib.mkiv +++ b/Master/texmf-dist/tex/context/base/bibl-bib.mkiv @@ -118,16 +118,16 @@ \newtoks \everysetupbibtexsession \setfalse \tracebibtexformat -\unexpanded\def\definebibtexsession {\dosingleargument\dodefinebibtexsession} +\unexpanded\def\definebibtexsession{\dosingleargument\dodefinebibtexsession} \def\preparebibtexsession {\dodoubleempty \dopreparebibtexsession} -\unexpanded\def\setupbibtexsession {\dodoubleargument\dosetupbibtexsession} +\unexpanded\def\setupbibtexsession {\dodoubleargument\dosetupbibtexsession} \def\dodefinebibtexsession [#1]{\edef\currentbibtexsession{#1}% - \ctxlua{commands.definebibtexsession("#1")}% + \ctxcommand{definebibtexsession("#1")}% \the\everydefinebibtexsession} \def\dopreparebibtexsession[#1][#2]{\edef\currentbibtexsession{#1}% - \ctxlua{commands.preparebibtexsession("#1","bibtex:#1","#2")}% + \ctxcommand{preparebibtexsession("#1","bibtex:#1","#2")}% \the\everypreparebibtexsession} \def\dosetupbibtexsession [#1][#2]{\edef\currentbibtexsession{#1}% @@ -138,8 +138,8 @@ \def\registerbibtexentry {\dodoubleargument\doregisterbibtexentry} \def\applytobibtexsession {\dodoubleargument\doapplytobibtexsession} -\def\doregisterbibtexfile [#1][#2]{\ctxlua{commands.registerbibtexfile("#1","#2")}} -\def\doregisterbibtexentry [#1][#2]{\ctxlua{commands.registerbibtexentry("#1","#2")}} +\def\doregisterbibtexfile [#1][#2]{\ctxcommand{registerbibtexfile("#1","#2")}} +\def\doregisterbibtexentry [#1][#2]{\ctxcommand{registerbibtexentry("#1","#2")}} \def\doapplytobibtexsession[#1][#2]{\xmlprocessregistered{bibtex:#1}{#2}{#2}} \unexpanded\def\bibtexcommand#1% @@ -169,7 +169,7 @@ \def\bibxmlflush #1{\xmlcontext \currentbibxmlnode{/field[@name='#1']}} \def\bibxmlsetup {\xmlsetup \currentbibxmlnode} % {#1} -\def\currentbibtexformat{apa} % ho wto interface this, maybe split loading and key +\def\currentbibtexformat{apa} % how to interface this, maybe split loading and key \def\currentbibxmlnode {unset} \def\currentbibxmltag {unset} @@ -280,7 +280,6 @@ *doi* \stopxmlsetups - \startxmlsetups bibtex:format:doi % \bibdoifelse{\@@pb@biburl}{#1\expanded{\bibgotoURL{\@@pb@thekey}{\@@pb@biburl}}#2}{#3} *url* @@ -299,7 +298,7 @@ % lists \def\bibtexlistprocessor - {\ctxlua{bibtex.hacks.add(structure.lists.uservalue("\currentlist",\currentlistindex,"bibref"),\currentlistindex)}} + {\ctxlua{bibtex.hacks.add(structures.lists.uservalue("\currentlist",\currentlistindex,"bibref"),\currentlistindex)}} \appendtoks \definelist[\currentbibtexsession]% @@ -456,17 +455,23 @@ \def\dodoloadbibtexpublicationalternative#1% {\doonlyonce{#1} - {\readsysfile{bxml-#1.mkiv} + {\startreadingfile + \readsysfile{bxml-#1.mkiv} {\showmessage\m!publications{6}{bxml-#1}} - {\showmessage\m!publications{1}{bxml-#1}}}} + {\showmessage\m!publications{1}{bxml-#1}}% + \stopreadingfile}} \appendtoks \doloadbibtexpublicationalternative \to \everysetupbibtexpublications -\appendtoks - \doloadbibtexpublicationalternative -\to \everyjob +% we expect at least one invocation of the setup commands +% because otherwise we always load the apa style even if +% no publications are used +% +% \appendtoks +% \doloadbibtexpublicationalternative +% \to \everystarttext % whatever, should be key @@ -578,7 +583,7 @@ {\ifx\currentbibtexnumbering\v!short \setbox\scratchbox\hbox{\bibtexpublicationsparameter\c!numbercommand{\bibtexpublicationsparameter\c!samplesize}}% \else - \setbox\scratchbox\hbox{\bibtexpublicationsparameter\c!numbercommand{\ctxlua{tex.write(structure.lists.size())}}}% + \setbox\scratchbox\hbox{\bibtexpublicationsparameter\c!numbercommand{\ctxlua{tex.write(structures.lists.size())}}}% \fi \bibtexnumberwidth\wd\scratchbox \setuplist[\currentbibtexsession][\c!distance=\zeropoint]} @@ -615,10 +620,12 @@ \doifelse{\bibtexpublicationsparameter\c!method}\v!local {\ctxlua{bibtex.hacks.reset(1)}}% function can take method {\ctxlua{bibtex.hacks.reset(2)}}% - \placestructurelist + \doplacestructurelist {\currentbibtexsession} {\currentbibtexcriterium} {\namedlistparameter\currentbibtexsession\c!number}% + {\namedlistparameter\currentbibtexsession\c!extras}% + {\namedlistparameter\currentbibtexsession\c!order}% \ctxlua{bibtex.hacks.flush("\bibtexpublicationsparameter\c!sorttype")}% \doendoflist} @@ -627,7 +634,7 @@ \ifx\currentbibtexsessiontag\empty % can't really happen \else\ifx\currentbibtexcriterium\v!all - \doplacepublicationindeed + \dotypesetbibtexpublication % was \doplacepublicationindeed \else \ctxlua{bibtex.hacks.doifalreadyplaced("\currentbibtexsessiontag")} \donothing @@ -822,17 +829,17 @@ \def\inbibtexlink#1#2% {\doifreferencefoundelse{\bibtexrefprefix#1} {\goto{#2}[\bibtexrefprefix#1]} - {!#1!\unknownreference{#1}}} + {!#1!}} \def\dobibtexgotolink#1#2% {\doifreferencefoundelse{\bibtexrefprefix#1} {\goto{#2}[\bibtexrefprefix#1]} - {!#1!\unknownreference{#1}}} + {!#1!}} \def\dobibattexlink#1#2% {\doifreferencefoundelse{\bibtexrefprefix#1} {\at{#2}[\bibtexrefprefix#1]} - {!#1!\unknownreference{#1}}} + {!#1!}} \def\dobibtexurllink#1#2% {\expanded{\useURL[bibtex:url:#1][#2]}% @@ -940,7 +947,7 @@ % \setuppublications[\c!refcommand=num]% % \cite[#1]% % \endgroup} -% {\unknownreference{#1}}} +% {}} % compress years % andtext namesep @@ -956,7 +963,7 @@ \def\dodobibtexauthoryearref #1{\ctxlua{bibtex.authoryearref ("bibtex:\currentbibtexsession","#1","normal","author")}} \def\dodobibtexauthoryearsref#1{\ctxlua{bibtex.authoryearsref("bibtex:\currentbibtexsession","#1","normal","author")}} -\unexpanded\def\bibtexsingularplural#1#2{\ctxlua{bibtex.singular_or_plural(\!!bs#1\!!es,\!!bs#2\!!es)}} +\unexpanded\def\bibtexsingularplural#1#2{\ctxlua{bibtex.singularorplural(\!!bs#1\!!es,\!!bs#2\!!es)}} \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/bibl-tra.lua b/Master/texmf-dist/tex/context/base/bibl-tra.lua index 44223102859..4ae81188d87 100644 --- a/Master/texmf-dist/tex/context/base/bibl-tra.lua +++ b/Master/texmf-dist/tex/context/base/bibl-tra.lua @@ -6,21 +6,28 @@ if not modules then modules = { } end modules ['bibl-bib'] = { license = "see context related readme files" } -bibtex = bibtex or { } +bibtex = bibtex or { } +local bibtex = bibtex + bibtex.hacks = bibtex.hacks or { } +local hacks = bibtex.hacks local match, gmatch, format, concat, sort = string.match, string.gmatch, string.format, table.concat, table.sort -local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes local variables, constants = interfaces.variables, interfaces.constants local trace_bibtex = false trackers.register("publications.bibtex", function(v) trace_bibtex = v end) -local hacks = bibtex.hacks +local report_tex = logs.reporter("publications","tex") + +local context, structures = context, structures + +local references = structures.references +local sections = structures.sections local list, done, alldone, used, registered, ordered = { }, { }, { }, { }, { }, { } local mode = 0 -local template = string.striplong([[ +local template = utilities.strings.striplong([[ \citation{*} \bibstyle{cont-%s} \bibdata{%s} @@ -34,7 +41,7 @@ function hacks.process(settings) interfaces.showmessage("publications",3) io.savedata(file.addsuffix(jobname,"aux"),format(template,style,database)) if trace_bibtex then - logs.report("publications","processing bibtex file '%s'",jobname) + report_tex("processing bibtex file '%s'",jobname) end os.execute(format("bibtex %s",jobname)) -- purge 'm @@ -43,12 +50,16 @@ end function hacks.register(str) if trace_bibtex then - logs.report("publications","registering bibtex entry '%s'",str) + report_tex("registering bibtex entry '%s'",str) end registered[#registered+1] = str ordered[str] = #registered end +function hacks.nofregistered() + return #registered +end + function hacks.reset(m) mode, list, done = m, { }, { } end @@ -58,14 +69,14 @@ function hacks.add(str,listindex) -- skip elseif mode == 1 then -- all locals but no duplicates - local sc = structure.sections.currentid() + local sc = sections.currentid() if done[str] ~= sc then done[str], alldone[str] = sc, true list[#list+1] = { str, listindex } end elseif mode == 2 then -- all locals but no preceding - local sc = structure.sections.currentid() + local sc = sections.currentid() if not alldone[str] and done[str] ~= sc then done[str], alldone[str] = sc, true list[#list+1] = { str, listindex } @@ -73,13 +84,13 @@ function hacks.add(str,listindex) end end -local function compare(a,b) - local aa, bb = a[1], b[1] +local function compare(a,b) -- quite some checking for non-nil + local aa, bb = a and a[1], b and b[1] if aa and bb then - return ordered[aa] < ordered[bb] - else - return true + local oa, ob = ordered[aa], ordered[bb] + return oa and ob and oa < ob end + return false end function hacks.flush(sortvariant) @@ -93,6 +104,12 @@ function hacks.flush(sortvariant) end end +function hacks.filterall() + for i=1,#registered do + list[i] = { registered[i], i } + end +end + function hacks.registerplaced(str) used[str] = true end @@ -106,15 +123,16 @@ end -- we look forward local function compare(a,b) - return a[3] < b[3] + local aa, bb = a and a[3], b and b[3] + return aa and bb and aa < bb end function hacks.resolve(prefix,block,reference) -- maybe already feed it split - local subset = jobreferences.collected[prefix or ""] or jobreferences.collected[""] + local subset = references.collected[prefix or ""] or references.collected[""] if subset then - local result, done = { }, { } + local result, nofresult, done = { }, 0, { } block = tonumber(block) - for rest in gmatch(reference,"([^,%s]+)") do + for rest in gmatch(reference,"[^, ]+") do local blk, tag, found = block, nil, nil if block then tag = blk .. ":" .. rest @@ -136,9 +154,10 @@ function hacks.resolve(prefix,block,reference) -- maybe already feed it split found = subset[tag] end if found then - local current = found.entries and found.entries.text + local current = tonumber(found.entries and found.entries.text) -- tonumber needed if current and not done[current] then - result[#result+1] = { blk, rest, current } + nofresult = nofresult + 1 + result[nofresult] = { blk, rest, current } done[current] = true end end @@ -146,8 +165,8 @@ function hacks.resolve(prefix,block,reference) -- maybe already feed it split -- todo: ranges so the interface will change sort(result,compare) local first, last, firsti, lasti, firstr, lastr - local collected = { } - for i=1,#result do + local collected, nofcollected = { }, 0 + for i=1,nofresult do local r = result[i] local current = r[3] if not first then @@ -156,28 +175,34 @@ function hacks.resolve(prefix,block,reference) -- maybe already feed it split last, lasti, lastr = current, i, r else if last > first + 1 then - collected[#collected+1] = { firstr[1], firstr[2], lastr[1], lastr[2] } + nofcollected = nofcollected + 1 + collected[nofcollected] = { firstr[1], firstr[2], lastr[1], lastr[2] } else - collected[#collected+1] = { firstr[1], firstr[2] } + nofcollected = nofcollected + 1 + collected[nofcollected] = { firstr[1], firstr[2] } if last > first then - collected[#collected+1] = { lastr[1], lastr[2] } + nofcollected = nofcollected + 1 + collected[nofcollected] = { lastr[1], lastr[2] } end end first, last, firsti, lasti, firstr, lastr = current, current, i, i, r, r end end - if first then + if first and last then if last > first + 1 then - collected[#collected+1] = { firstr[1], firstr[2], lastr[1], lastr[2] } + nofcollected = nofcollected + 1 + collected[nofcollected] = { firstr[1], firstr[2], lastr[1], lastr[2] } else - collected[#collected+1] = { firstr[1], firstr[2] } + nofcollected = nofcollected + 1 + collected[nofcollected] = { firstr[1], firstr[2] } if last > first then - collected[#collected+1] = { lastr[1], lastr[2] } + nofcollected = nofcollected + 1 + collected[nofcollected] = { lastr[1], lastr[2] } end end end - if #collected > 0 then - for i=1,#collected do + if nofcollected > 0 then + for i=1,nofcollected do local c = collected[i] if c[3] then context.dowithbibtexnumrefrange(#collected,i,prefix,c[1],c[2],c[3],c[4]) diff --git a/Master/texmf-dist/tex/context/base/bibl-tra.mkii b/Master/texmf-dist/tex/context/base/bibl-tra.mkii index 087781db9b1..2c03a7f9160 100644 --- a/Master/texmf-dist/tex/context/base/bibl-tra.mkii +++ b/Master/texmf-dist/tex/context/base/bibl-tra.mkii @@ -506,6 +506,8 @@ {#1\@EA\cite\@EA[\@@pb@crossref]#2} {#3}} +\let\insertcrossref\gobblethreearguments + \appendtoks\let\insertcrossref\bibinsertcrossref\to\initializebibdefinitions %D \macros{complexbibdef,specialbibinsert} diff --git a/Master/texmf-dist/tex/context/base/bibl-tra.mkiv b/Master/texmf-dist/tex/context/base/bibl-tra.mkiv index 519af0c6f77..8e2f61641f3 100644 --- a/Master/texmf-dist/tex/context/base/bibl-tra.mkiv +++ b/Master/texmf-dist/tex/context/base/bibl-tra.mkiv @@ -185,10 +185,11 @@ \setuplist [pubs] [\c!state=\v!start, + \c!criterium=\@@pbcriterium, \c!width=] \installstructurelistprocessor{pubs:userdata}% - {\ctxlua{bibtex.hacks.add(structure.lists.uservalue("\currentlist",\currentlistindex,"bibref"),\currentlistindex)}} + {\ctxlua{bibtex.hacks.add(structures.lists.uservalue("\currentlist",\currentlistindex,"bibref"),\currentlistindex)}} \newcount\bibtexblock \bibtexblock\plusone @@ -295,28 +296,18 @@ %D We can omit already shown references (\v!global) or use fresh %D lists each time (\v!local). -\chardef\bibtexoncemode\plusone % 0=disable, 1=local, 2=global +\setnewconstant\bibtexoncemode\plusone % 0=disable, 1=local, 2=global \appendtoks \doifelse\@@pbmethod\v!local - {\chardef\bibtexoncemode\plusone}% - {\chardef\bibtexoncemode\plustwo}% + {\bibtexoncemode\plusone}% + {\bibtexoncemode\plustwo}% \to \everysetuppublications %D Cite lists are compressed, if possible. This is set later on. \newif\ifbibcitecompress\bibcitecompresstrue -% \appendtoks -% \processaction -% [\@@pbnumbering] -% [ \v!yes=>\let\@@pbinumbercommand\firstofoneargument, -% \v!no=>\let\@@pbinumbercommand\gobbleoneargument, -% \v!short=>\def\@@pbinumbercommand##1{\bibgetvars\currentpublicationkey}, -% \v!bib=>\def\@@pbinumbercommand##1{\bibgetvarn\currentpublicationkey}, -% \s!unknown=>\let\@@pbinumbercommand\firstofoneargument]% -% \to \everysetuppublications - \def\@@pbinumbercommand{\executeifdefined{\??pb:\c!numbercommand:\@@pbnumbering}\firstofoneargument} \letvalue{\??pb:\c!numbercommand:\v!yes }\firstofoneargument @@ -348,16 +339,10 @@ \def\usepublications[#1]% {\processcommalist[#1]\dousepublications} -% \def\dousepublications#1% -% {\doonlyonce{#1.\f!bibextension} -% {\readfile{#1.\f!bibextension} -% {\showmessage\m!publications{4}{#1.\f!bibextension}} -% {\showmessage\m!publications{2}{#1.\f!bibextension}}}} - \def\dousepublications#1% {\doonlyonce{#1.\f!bibextension}{\dodousepublications{#1}}} -\def\dodousepublications#1% +\def\dodousepublications#1% brr, this par stuff {\let\@@savedpar\par \let\par\ignorespaces \ifhmode\kern\zeropoint\fi @@ -394,7 +379,10 @@ \let\normalsetuppublicationlayout\setuppublicationlayout -\setuppublicationlist[\c!title=,\c!command=\dospecialbibinsert,\c!maybeyear=\v!on] +\setuppublicationlist + [\c!title=, + \c!command=\dospecialbibinsert, + \c!maybeyear=\v!on] %D \macros{bibalternative} %D @@ -442,20 +430,6 @@ \processcommacommand[\bibcommandlist]\simplebibdef -% \def\bibinsertdoi#1#2#3% -% {\begingroup -% \bibdoifelse{\@@pb@doi}% -% {\edef\ascii{\detokenize\expandafter{\@@pb@doi}}% probably not ok, to less expansion -% #1\expanded{\bibgotoDOI{\@@pb@thekey}{\ascii}}#2}{#3}% -% \endgroup} -% -% \def\bibinsertbiburl#1#2#3% -% {\begingroup -% \bibdoifelse{\@@pb@biburl}% -% {\edef\ascii{\detokenize\expandafter{\@@pb@biburl}}% probably not ok, to less expansion -% #1\expanded{\bibgotoURL{\@@pb@thekey}{\ascii}}#2}{#3}% -% \endgroup} - \def\bibinsertdoi#1#2#3% let's see how this fails {\bibdoifelse{\@@pb@doi}{#1\expanded{\bibgotoDOI{\@@pb@thekey}{\@@pb@doi}}#2}{#3}} @@ -506,19 +480,6 @@ %D \specialbibinsert{author}{\author@num}{}{}{} %D \stoptyping -% \def\docomplexbibdef#1% -% {\def\currentype{#1}% -% \dosingleempty\dodocomplexbibdef} - -% \def\dodocomplexbibdef[#1]#2% -% {\def\firstarg{#1}\def\secondarg{#2}% -% \dosingleempty\dododocomplexbibdef} - -% \def\dododocomplexbibdef[#1]#2#3% -% {\@EA\increment\csname\currentype @num\endcsname -% \setevalue{\??pb @\currentype\csname \currentype @num\endcsname}% -% {{\secondarg}{#2}{#3}{#1}{\firstarg}}\ignorespaces} - \def\docomplexbibdef#1% {\dodoubleempty\dodocomplexbibdef[#1]} @@ -583,29 +544,6 @@ %D \#2 = number of items to be typeset %D \#3 = commacommand containing authors -% \def\dospecialbibinsert#1#2#3% -% {\getcommacommandsize[#3]% -% \scratchcounter\zerocount -% \def\processauthoritem##1% -% {\advance\scratchcounter\plusone -% \ifnum\numexpr\scratchcounter-\plusone\relax<#2\relax -% \publicationlistparameter{#1}##1% -% \ifnum\scratchcounter=#2\relax -% \ifnum\etallimitcounter<\commalistsize\relax -% \bibalternative{#1etaltext}% -% \fi -% \else\ifnum\numexpr\scratchcounter+\plusone\relax=#2\relax -% \ifnum\commalistsize>\plustwo -% \bibalternative\c!finalnamesep -% \else -% \bibalternative\c!lastnamesep -% \fi -% \else -% \bibalternative\c!namesep -% \fi\fi -% \fi}% -% \processcommacommand[#3]\processauthoritem} - \def\doprocessauthoritem#1#2#3% {\advance\scratchcounter\plusone \ifnum\numexpr\scratchcounter-\plusone\relax<#2\relax @@ -678,22 +616,6 @@ \def\clearbibitem#1{\setvalue{\??pb @#1}{}}% -% \def\clearbibitemtwo#1% -% {\letvalue{#1@num}\!!zerocount -% \doloop -% {\doifdefinedelse{\??pb @#1\recurselevel} -% {\letvalue{\??pb @#1\recurselevel}\empty} % why not undefined? -% {\exitloop}}} - -% \def\clearbibitemtwo#1% -% {\letvalue{#1@num}\!!zerocount -% \doloop -% {\ifcsname\??pb @#1\recurselevel\endcsname -% \expandafter\let\csname\??pb @#1\recurselevel\undefined -% \else -% \exitloop -% \fi}} - \def\clearbibitemtwo#1% is this reset really needed? after all we reset the counter and we are local {%\dofastrecurse\plusone{\csname#1@num\endcsname}\plusone{\expandafter\let\csname\??pb @#1\recurselevel\undefined}% \letvalue{#1@num}\!!zerocount} @@ -735,7 +657,7 @@ \unexpanded\def\startpublication {\begingroup - \catcode`\%=\othercatcode + \catcode\commentasciicode\othercatcode \dosingleempty\dostartpublication} \let\stoppublication\relax @@ -786,7 +708,7 @@ {\preloadbiblist \doifdefinedelse{pbd:#1} \firstoftwoarguments - {\showmessage\m!publications{5}{#1 is unknown}\secondoftwoarguments}} + {\showmessage\m!publications{5}{#1}\secondoftwoarguments}} %D \macros{bib@crossref} %D @@ -804,6 +726,8 @@ \def\bibinsertcrossref#1#2#3% {\bibdoifelse\@@pb@crossref{#1\cite[\@@pb@crossref]#2}{#3}} +\let\insertcrossref\gobblethreearguments + \appendtoks\let\insertcrossref\bibinsertcrossref\to\initializebibdefinitions %D The next macro is needed because the number command of the @@ -814,17 +738,28 @@ \def\doprocessbibtexentry#1{\typesetapublication{#1}} \def\typesetpubslist - {\dobeginoflist + {\preloadbiblist + \dobeginoflist % \the\initializebibdefinitions % COMMENTED \edef\currentlist{pubs}% - \doif{\listparameter\c!criterium}\v!cite{\setuplist[pubs][\c!criterium=\v!here]}% \ctxlua{bibtex.hacks.reset(\number\bibtexoncemode)}% - \placestructurelist{pubs}{\listparameter\c!criterium}{\listparameter\c!number}% + \doifelse{\listparameter\c!criterium}\v!all + {\showmessage\m!publications{7}{}% + \ctxlua{bibtex.hacks.filterall()}} + {\doif{\listparameter\c!criterium}\v!cite + {\setuplist[pubs][\c!criterium=\v!here]}% + \doplacestructurelist + {pubs}% + {\listparameter\c!criterium}% + {\listparameter\c!number}% + {\listparameter\c!extras}% + {\listparameter\c!order}}% \ctxlua{bibtex.hacks.flush("\@@pbsorttype")}% \doendoflist} \newif\ifinpublist + \def\initializepubslist {\def\currentlist{pubs}% \edef\@@pbnumbering{\@@pbnumbering}% @@ -832,7 +767,10 @@ {\ifx\@@pbnumbering\v!short \setbox\scratchbox\hbox{\@@pbnumbercommand{\listparameter\c!samplesize}}% \else - \setbox\scratchbox\hbox{\@@pbnumbercommand{\ctxlua{tex.write(structure.lists.size())}}}% + \doifelse{\listparameter\c!criterium}\v!all + {\setbox\scratchbox\hbox{\@@pbnumbercommand{\ctxlua{tex.write{bibtex.hacks.nofregistered()}}}}} + {\determinelistcharacteristics[pubs]% + \setbox\scratchbox\hbox{\@@pbnumbercommand{\structurelistsize}}}% \fi \edef\publistnumberbox{\hbox to \the\wd\scratchbox}% \expanded{\setuplist[pubs][\c!width=\the\wd\scratchbox,\c!distance=\zeropoint]}% @@ -871,7 +809,8 @@ \def\docompletepublications[#1]% {\begingroup - \setuplist[pubs][\c!criterium=\v!previous,#1] +% \setuplist[pubs][\c!criterium=\v!previous,#1] + \setuplist[pubs][#1] \doifelsenothing{\publicationlistparameter\c!title} {\systemsuppliedchapter[pubs]{\headtext{pubs}}} {\normalexpanded{\systemsuppliedchapter[pubs]{\publicationlistparameter\c!title}}}% @@ -886,7 +825,8 @@ \def\doplacepublications[#1]% {\begingroup - \setuplist[pubs][\c!criterium=\v!previous,#1]% +% \setuplist[pubs][\c!criterium=\v!previous,#1]% + \setuplist[pubs][#1]% \dodoplacepublications} \def\dodoplacepublications @@ -901,6 +841,9 @@ \global\advance\bibtexblock\plusone} %D \subsubject{What's in a publication} +%D +%D Watch out: here all means all publications in database, so use +%D text when you want text only. \unexpanded\def\typesetapublication#1% {\doifsomething{#1} @@ -970,17 +913,6 @@ %D \type{\cite} commands with a braced argument (these might appear %D in included data from the \type{.bib} file). -% \unexpanded\def\cite -% {\doifnextoptionalelse\dodocite\dobibref} -% \def\dobibref#1% -% {\docite[#1][]} -% \def\dodocite[#1]% -% {\startstrictinspectnextcharacter -% \dodoubleempty\dododocite[#1]} -% \def\dododocite % [#1][#2] -% {\stopstrictinspectnextcharacter -% \docite} - \unexpanded\def\cite {\strictdoifnextoptionalelse\dodocite\dobibref} @@ -1283,9 +1215,9 @@ %D %D The final task is looping over that list until a match is found. -\def\gotobiblink#1[#2]{\doifreferencefoundelse{\bibrefprefix#2}{\goto{#1}[\bibrefprefix#2]}{\unknownreference{#2}}} -\def\atbiblink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\at [\bibrefprefix#1]}{\unknownreference{#1}}} -\def\inbiblink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\expanded{\goto{\currentreferencetext}}[\bibrefprefix#1]}{\unknownreference{#1}}} +\def\gotobiblink#1[#2]{\doifreferencefoundelse{\bibrefprefix#2}{\goto{#1}[\bibrefprefix#2]}{}} +\def\atbiblink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\at [\bibrefprefix#1]}{}} +\def\inbiblink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\expanded{\goto{\currentreferencetext}}[\bibrefprefix#1]}{}} %D \macros{bibauthoryearref,bibauthoryearsref,bibauthorref,bibyearref} %D @@ -1386,7 +1318,7 @@ {\bibinsertrefsep \doifbibreferencefoundelse{#1} {\gotobiblink{\bibgetvars{#1}}[#1]} - {\unknownreference{#1}}} + {}} \def\bibserialref[#1]% {\bibalternative\v!left @@ -1397,7 +1329,7 @@ {\bibinsertrefsep \doifbibreferencefoundelse{#1} {\gotobiblink{\bibgetvarn{#1}}[#1]} - {\unknownreference{#1}}} + {}} \def\bibkeyref[#1]% {\bibalternative\v!left @@ -1424,7 +1356,7 @@ {\bibinsertrefsep \doifbibreferencefoundelse{#1} {\expanded{\bibgotoDOI{#1}{\bibgetvaro{#1}}}} - {\unknownreference{#1}}} + {}} \def\biburlref[#1]% {\bibalternative\v!left @@ -1440,7 +1372,7 @@ {\bibinsertrefsep \doifbibreferencefoundelse{#1} {\expanded{\bibgotoURL{#1}{\bibgetvaru{#1}}}} - {\unknownreference{#1}}} + {}} \def\bibtyperef[#1]% {\bibalternative\v!left @@ -1451,7 +1383,7 @@ {\bibinsertrefsep \doifbibreferencefoundelse{#1} {\gotobiblink{\bibgetvart{#1}}[#1]} - {\unknownreference{#1}}} + {}} \def\bibpageref[#1]% {\bibalternative\v!left @@ -1473,7 +1405,7 @@ {\bibinsertrefsep \doifbibreferencefoundelse{#1} {\dotypesetapublication{#1}} - {\unknownreference{#1}}} + {}} \let\bibnoneref\nocite @@ -1529,7 +1461,7 @@ \setuppublications[\c!refcommand=num]% \cite[#1]% \endgroup} - {\unknownreference{#1}}} + {}} %D And some defaults are loaded from bibl-apa: @@ -1539,6 +1471,8 @@ [\c!monthconversion=, \c!alternative=apa, \c!method=\v!global, + %\c!criterium=\v!previous, + \c!criterium=\v!cite, % mojca wants this so bother her, not me \c!refcommand=num, \c!numbercommand=\bibleftnumber] diff --git a/Master/texmf-dist/tex/context/base/blob-ini.lua b/Master/texmf-dist/tex/context/base/blob-ini.lua index 0f7ccee26c5..48cf4e39314 100644 --- a/Master/texmf-dist/tex/context/base/blob-ini.lua +++ b/Master/texmf-dist/tex/context/base/blob-ini.lua @@ -6,8 +6,11 @@ if not modules then modules = { } end modules ['blob-ini'] = { license = "see context related readme files" } --- later we will consider an OO variant. - +-- Experimental ... names and functionality will change ... just a +-- place to collect code, so: +-- +-- DON'T USE THESE FUNCTIONS AS THEY WILL CHANGE! +-- -- This module is just a playground. Occasionally we need to typeset -- at the lua and and this is one method. In principle we can construct -- pages this way too which sometimes makes sense in dumb cases. Actually, @@ -20,17 +23,22 @@ if not modules then modules = { } end modules ['blob-ini'] = { -- collapse or new pars -- interline spacing etc --- DON'T USE THESE FUNCTIONS AS THEY WILL CHANGE! +-- blob.char +-- blob.line +-- blob.paragraph +-- blob.page local type = type - -local utfvalues = string.utfvalues local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns -local fontdata = fonts.identifiers +local report_blobs = logs.reporter("blobs") + +local fontdata = fonts.hashes.identifiers + +local nodepool = nodes.pool -local new_glyph_node = nodes.glyph -local new_glue_node = nodes.glyph +local new_glyph = nodepool.glyph +local new_glue = nodepool.glue local copy_node = node.copy local copy_node_list = node.copy_list @@ -57,70 +65,34 @@ local ctxtextcapture = lpeg.Ct ( ( ) )^0) -local function tonodes(str,fnt,attr) -- (str,template_glyph) - if not str or str == "" then - return - end - local head, tail, space, fnt, template = nil, nil, nil, nil, nil - if not fnt then - fnt = current_font() - elseif type(fnt) ~= "number" and fnt.id == "glyph" then - fnt, template = nil, fnt - -- else - -- already a number - end - for s in utfvalues(str) do - local n - if s == 32 then - if not space then - local parameters = fontdata[fnt].parameters - space = new_glue_node(parameters.space,parameters.space_stretch,parameters.space_shrink) - n = space - else - n = copy_node(space) - end - elseif template then - n = copy_node(template) - n.char = s - else - n = new_glyph_node(fnt,s) - end - if attr then -- normall false when template - n.attr = copy_node_list(attr) - end - if head then - insert_node_after(head,tail,n) - else - head = n - end - tail = n - end - return head, tail -end - -blobs.tonodes = tonodes - function blobs.new() return { list = { }, } end -function blobs.append(t,str) - local kind = type(str) +function blobs.append(t,str) -- will be link nodes.link + local typ = type(str) local dummy = nil - if kind == "string" then + if typ == "number" then + str = tostring(str) + typ = "string" + end + local list = t.list + if typ == "string" then local pars = lpegmatch(ctxtextcapture,str) - local list = t.list + local noflist = #list for p=1,#pars do local str = pars[p] if #str == 0 then - list[#list+1 ] = { head = nil, tail = nil } + noflist = noflist + 1 + list[noflist] = { head = nil, tail = nil } else - local l = list[#list] + local l = list[noflist] if not l then l = { head = nil, tail = nil } - list[#list+1 ] = l + noflist = noflist + 1 + list[noflist] = l end local head, tail = tonodes(str,nil,nil) if head then @@ -147,7 +119,7 @@ function blobs.pack(t,how) if how == "vertical" then -- we need to prepend a local par node -- list[i].pack = node.vpack(list[i].head,"exactly") - logs.report("blobs","vpack not yet supported") + report_blobs("vpack not yet supported") else list[i].pack = hpack_node_list(list[i].head,"exactly") end @@ -163,3 +135,25 @@ function blobs.write(t) end end end + + +-- blob.char +-- blob.line: head, tail +-- blob.paragraph +-- blob.page + +--~ local lineblob = { +--~ type = "line", +--~ head = false, +--~ tail = false, +--~ pack = false, +--~ properties = { }, +--~ end + +--~ local parblob = { +--~ type = "line", +--~ head = false, +--~ tail = false, +--~ pack = false, +--~ properties = { }, +--~ end diff --git a/Master/texmf-dist/tex/context/base/buff-imp-default.lua b/Master/texmf-dist/tex/context/base/buff-imp-default.lua new file mode 100644 index 00000000000..72a49d6253b --- /dev/null +++ b/Master/texmf-dist/tex/context/base/buff-imp-default.lua @@ -0,0 +1,42 @@ +if not modules then modules = { } end modules ['buff-imp-default'] = { + version = 1.001, + comment = "companion to buff-imp-default.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local patterns, P, V = lpeg.patterns, lpeg.P, lpeg.V +local makepattern = visualizers.makepattern + +local handler = visualizers.newhandler() + +local grammar = { "visualizer", + + -- basic + + signal = makepattern(handler,"signal", visualizers.signalpattern), + emptyline = makepattern(handler,"emptyline",patterns.emptyline), + beginline = makepattern(handler,"beginline",patterns.beginline), + newline = makepattern(handler,"newline", patterns.newline), + space = makepattern(handler,"space", patterns.space), + default = makepattern(handler,"default", patterns.utf8char), + content = makepattern(handler,"default", patterns.somecontent), -- not too efficient + + -- handy + + -- line = V("newline") * V("emptyline")^0 * V("beginline"), + line = V("newline") * V("emptyline")^0 * V("beginline") + V("emptyline") + V("newline"), + whitespace = (V("space") + V("line"))^1, + optionalwhitespace = (V("space") + V("line"))^0, + + -- used + + pattern = V("line") + V("space") + V("signal") + V("content"), + visualizer = V("pattern")^1 + +} + +local parser = P(grammar) + +visualizers.register("default", { parser = parser, handler = handler, grammar = grammar }) diff --git a/Master/texmf-dist/tex/context/base/buff-imp-default.mkiv b/Master/texmf-dist/tex/context/base/buff-imp-default.mkiv new file mode 100644 index 00000000000..7a935e218b8 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/buff-imp-default.mkiv @@ -0,0 +1,43 @@ +%D \module +%D [ file=buff-imp-default, +%D version=2010.10.19, +%D title=\CONTEXT\ Visualizer Macros, +%D subtitle=Default, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\registerctxluafile{buff-imp-default.lua}{1.001} + +\unprotect + +\definestartstop + [DefaultSnippet] + [\c!before=\blank, + \c!after=\blank, + \c!style=\tt] + +% Name +% NamePrimitive +% NamePlain +% NameMetafun +% Group +% Boundary +% Special +% Comment +% Constructor +% Key +% Entity +% String +% Equal +% Cdata +% Instruction + +% Value +% Quote + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/buff-imp-escaped.lua b/Master/texmf-dist/tex/context/base/buff-imp-escaped.lua new file mode 100644 index 00000000000..159921e2a85 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/buff-imp-escaped.lua @@ -0,0 +1,14 @@ +if not modules then modules = { } end modules ['buff-imp-escaped'] = { + version = 1.001, + comment = "companion to buff-imp-escaped.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +visualizers.registerescapepattern("/BTEX/ETEX","/BTEX","/ETEX") + +visualizers.register("escaped", { + parser = visualizers.escapepatterns["/BTEX/ETEX"], + handler = visualizers.newhandler(), +}) diff --git a/Master/texmf-dist/tex/context/base/buff-imp-escaped.mkiv b/Master/texmf-dist/tex/context/base/buff-imp-escaped.mkiv new file mode 100644 index 00000000000..55d2fb093bd --- /dev/null +++ b/Master/texmf-dist/tex/context/base/buff-imp-escaped.mkiv @@ -0,0 +1,18 @@ +%D \module +%D [ file=buff-imp-escaped, +%D version=2010.10.19, +%D title=\CONTEXT\ Visualizer Macros, +%D subtitle=Escaped, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\registerctxluafile{buff-imp-escaped.lua}{1.001} + +\unprotect + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/buff-imp-lua.lua b/Master/texmf-dist/tex/context/base/buff-imp-lua.lua new file mode 100644 index 00000000000..3a3bb3d2c08 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/buff-imp-lua.lua @@ -0,0 +1,208 @@ +if not modules then modules = { } end modules ['buff-imp-lua'] = { + version = 1.001, + comment = "companion to buff-imp-lua.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- borrowed from scite +-- +-- depricated: +-- +-- gcinfo unpack getfenv setfenv loadlib +-- table.maxn table.getn table.setn +-- math.log10 math.mod math.modf math.fmod + +local format, tohash = string.format, table.tohash +local P, S, V, patterns = lpeg.P, lpeg.S, lpeg.V, lpeg.patterns +local C, Cs, Cg, Cb, Cmt, Carg = lpeg.C, lpeg.Cs, lpeg.Cg, lpeg.Cb, lpeg.Cmt, lpeg.Carg + +local core = tohash { + "and", "break", "do", "else", "elseif", "end", "false", "for", "function", + "if", "in", "local", "nil", "not", "or", "repeat", "return", "then", + "true", "until", "while" +} + +local base = tohash { + "assert", "collectgarbage", "dofile", "error", "loadfile", + "loadstring", "print", "rawget", "rawset", "require", "tonumber", + "tostring", "type", "_G", "getmetatable", "ipairs", "next", "pairs", + "pcall", "rawequal", "setmetatable", "xpcall", "module", "select", +} + +local libraries = { + coroutine = tohash { + "create", "resume", "status", "wrap", "yield", "running", + }, + package = tohash{ + "cpath", "loaded", "loadlib", "path", "config", "preload", "seeall", + }, + io = tohash{ + "close", "flush", "input", "lines", "open", "output", "read", "tmpfile", + "type", "write", "stdin", "stdout", "stderr", "popen", + }, + math = tohash{ + "abs", "acos", "asin", "atan", "atan2", "ceil", "cos", "deg", "exp", + "floor ", "ldexp", "log", "max", "min", "pi", "pow", "rad", "random", + "randomseed", "sin", "sqrt", "tan", "cosh", "sinh", "tanh", "huge", + }, + string = tohash{ + "byte", "char", "dump", "find", "len", "lower", "rep", "sub", "upper", + "format", "gfind", "gsub", "gmatch", "match", "reverse", + }, + table = tohash{ + "concat", "foreach", "foreachi", "sort", "insert", "remove", "pack", + "unpack", + }, + os = tohash{ + "clock", "date", "difftime", "execute", "exit", "getenv", "remove", + "rename", "setlocale", "time", "tmpname", + }, + lpeg = tohash{ + "print", "match", "locale", "type", "version", "setmaxstack", + "P", "R", "S", "C", "V", "Cs", "Ct", "Cs", "Cp", "Carg", + "Cg", "Cb", "Cmt", "Cf", "B", + }, + -- bit + -- debug +} + +local context = context +local verbatim = context.verbatim +local makepattern = visualizers.makepattern + +local LuaSnippet = context.LuaSnippet +local startLuaSnippet = context.startLuaSnippet +local stopLuaSnippet = context.stopLuaSnippet + +local LuaSnippetBoundary = verbatim.LuaSnippetBoundary +local LuaSnippetQuote = verbatim.LuaSnippetQuote +local LuaSnippetString = verbatim.LuaSnippetString +local LuaSnippetSpecial = verbatim.LuaSnippetSpecial +local LuaSnippetComment = verbatim.LuaSnippetComment +local LuaSnippetNameCore = verbatim.LuaSnippetNameCore +local LuaSnippetNameBase = verbatim.LuaSnippetNameBase +local LuaSnippetNameLibraries = verbatim.LuaSnippetNameLibraries +local LuaSnippetName = verbatim.LuaSnippetName + +local namespace + +local function visualizename_a(s) + if core[s] then + namespace = nil + LuaSnippetNameCore(s) + elseif base[s] then + namespace = nil + LuaSnippetNameBase(s) + else + namespace = libraries[s] + if namespace then + LuaSnippetNameLibraries(s) + else + LuaSnippetName(s) + end + end +end + +local function visualizename_b(s) + if namespace and namespace[s] then + namespace = nil + LuaSnippetNameLibraries(s) + else + LuaSnippetName(s) + end +end + +local function visualizename_c(s) + LuaSnippetName(s) +end + +local handler = visualizers.newhandler { + startinline = function() LuaSnippet(false,"{") end, + stopinline = function() context("}") end, + startdisplay = function() startLuaSnippet() end, + stopdisplay = function() stopLuaSnippet() end , + boundary = function(s) LuaSnippetBoundary(s) end, + special = function(s) LuaSnippetSpecial(s) end, + comment = function(s) LuaSnippetComment(s) end, + quote = function(s) LuaSnippetQuote(s) end, + string = function(s) LuaSnippetString(s) end, + period = function(s) verbatim(s) end, + name_a = visualizename_a, + name_b = visualizename_b, + name_c = visualizename_c, +} + +local comment = P("--") +local name = (patterns.letter + patterns.underscore) + * (patterns.letter + patterns.underscore + patterns.digit)^0 +local boundary = S('()[]{}') +local special = S("-+/*^%=#") + P("..") + +-- The following longstring parser is taken from Roberto's documentation +-- that can be found at http://www.inf.puc-rio.br/~roberto/lpeg/lpeg.html. + +local equals = P("=")^0 +local open = P("[") * Cg(equals, "init") * P("[") * P("\n")^-1 -- maybe better: patterns.newline^-1 +local close = P("]") * C(equals) * P("]") +local closeeq = Cmt(close * Cb("init"), function(s,i,a,b) return a == b end) +local longstring = open * Cs((P(1) - closeeq)^0) * close * Carg(1) + +local function long(content,equals,settings) + handler.boundary(format("[%s[",equals or "")) + visualizers.write(content,settings) -- unhandled + handler.boundary(format("]%s]",equals or "")) +end + +local grammar = visualizers.newgrammar("default", { "visualizer", + sstring = + makepattern(handler,"quote",patterns.dquote) + * (V("whitespace") + makepattern(handler,"string",1-patterns.dquote))^0 -- patterns.nodquote + * makepattern(handler,"quote",patterns.dquote), + dstring = + makepattern(handler,"quote",patterns.squote) + * (V("whitespace") + makepattern(handler,"string",1-patterns.squote))^0 -- patterns.nosquote + * makepattern(handler,"quote",patterns.squote), + longstring = + longstring / long, + comment = + makepattern(handler,"comment",comment) + * (V("space") + V("content"))^0, + longcomment = + makepattern(handler,"comment",comment) + * longstring / long, + name = + makepattern(handler,"name_a",name) + * ( V("optionalwhitespace") + * makepattern(handler,"default",patterns.period) + * V("optionalwhitespace") + * makepattern(handler,"name_b",name) + )^-1 + * ( V("optionalwhitespace") + * makepattern(handler,"default",patterns.period) + * V("optionalwhitespace") + * makepattern(handler,"name_c",name) + )^0, + + pattern = + V("longcomment") + + V("comment") + + V("longstring") + + V("dstring") + + V("sstring") + + V("name") + + makepattern(handler,"boundary",boundary) + + makepattern(handler,"special",special) + + + V("space") + + V("line") + + V("default"), + + visualizer = + V("pattern")^1 +} ) + +local parser = P(grammar) + +visualizers.register("lua", { parser = parser, handler = handler, grammar = grammar } ) diff --git a/Master/texmf-dist/tex/context/base/buff-imp-lua.mkiv b/Master/texmf-dist/tex/context/base/buff-imp-lua.mkiv new file mode 100644 index 00000000000..a04e2385143 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/buff-imp-lua.mkiv @@ -0,0 +1,69 @@ +%D \module +%D [ file=buff-imp-lua, +%D version=2010.10.19, +%D title=\CONTEXT\ Visualizer Macros, +%D subtitle=\LUA, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\registerctxluafile{buff-imp-lua.lua}{1.001} + +\unprotect + +\definestartstop + [LuaSnippet] + [DefaultSnippet] + +\definestartstop + [LuaSnippetName] + [\c!color=, + \c!style=boldface] + +\definestartstop + [LuaSnippetNameCore] + [\c!color=darkgreen, + \c!style=boldface] + +\definestartstop + [LuaSnippetNameBase] + [\c!color=darkgreen, + \c!style=boldface] + +\definestartstop + [LuaSnippetNameLibraries] + [\c!color=darkgreen, + \c!style=boldface] + +\definestartstop + [LuaSnippetBoundary] + [\c!color=darkblue, + \c!style=boldface] + +\definestartstop + [LuaSnippetString] + [LuaSnippet] + +\definestartstop + [LuaSnippetQuote] + [LuaSnippetBoundary] + +\definestartstop + [LuaSnippetSpecial] + [\c!color=darkred, + \c!style=boldface] + +\definestartstop + [LuaSnippetComment] + [\c!color=darkyellow, + \c!style=boldface] + +\definetyping + [LUA] + [\c!option=lua] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/buff-imp-mp.lua b/Master/texmf-dist/tex/context/base/buff-imp-mp.lua new file mode 100644 index 00000000000..6b8a2653661 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/buff-imp-mp.lua @@ -0,0 +1,176 @@ +if not modules then modules = { } end modules ['buff-imp-mp'] = { + version = 1.001, + comment = "companion to buff-imp-mp.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local P, S, V, patterns = lpeg.P, lpeg.S, lpeg.V, lpeg.patterns + +local primitives = table.tohash { + 'charcode', 'day', 'linecap', 'linejoin', 'miterlimit', 'month', 'pausing', + 'prologues', 'showstopping', 'time', 'tracingcapsules', 'tracingchoices', + 'tracingcommands', 'tracingequations', 'tracinglostchars', + 'tracingmacros', 'tracingonline', 'tracingoutput', 'tracingrestores', + 'tracingspecs', 'tracingstats', 'tracingtitles', 'truecorners', + 'warningcheck', 'year', 'mpprocset', + 'false', 'nullpicture', 'pencircle', 'true', + 'and', 'angle', 'arclength', 'arctime', 'ASCII', 'bluepart', 'boolean', 'bot', + 'char', 'color', 'cosd', 'cycle', 'decimal', 'directiontime', 'floor', 'fontsize', + 'greenpart', 'hex', 'infont', 'intersectiontimes', 'known', 'length', 'llcorner', + 'lrcorner', 'makepath', 'makepen', 'mexp', 'mlog', 'normaldeviate', 'not', + 'numeric', 'oct', 'odd', 'or', 'path', 'pair', 'pen', 'penoffset', 'picture', 'point', + 'postcontrol', 'precontrol', 'redpart', 'reverse', 'rotated', 'scaled', + 'shifted', 'sind', 'slanted', 'sqrt', 'str', 'string', 'subpath', 'substring', + 'transform', 'transformed', 'ulcorner', 'uniformdeviate', 'unknown', + 'urcorner', 'xpart', 'xscaled', 'xxpart', 'xypart', 'ypart', 'yscaled', 'yxpart', + 'yypart', 'zscaled', + 'addto', 'clip', 'input', 'interim', 'let', 'newinternal', 'save', 'setbounds', + 'shipout', 'show', 'showdependencies', 'showtoken', 'showvariable', + 'special', + 'begingroup', 'endgroup', 'of', 'curl', 'tension', 'and', 'controls', + 'reflectedabout', 'rotatedaround', 'interpath', 'on', 'off', 'beginfig', + 'endfig', 'def', 'vardef', 'enddef', 'epxr', 'suffix', 'text', 'primary', 'secondary', + 'tertiary', 'primarydef', 'secondarydef', 'tertiarydef', 'top', 'bottom', + 'ulft', 'urt', 'llft', 'lrt', 'randomseed', 'also', 'contour', 'doublepath', + 'withcolor', 'withpen', 'dashed', 'if', 'else', 'elseif', 'fi', 'for', 'endfor', 'forever', 'exitif', + 'forsuffixes', 'downto', 'upto', 'step', 'until', + 'charlist', 'extensible', 'fontdimen', 'headerbyte', 'kern', 'ligtable', + 'boundarychar', 'chardp', 'charext', 'charht', 'charic', 'charwd', 'designsize', + 'fontmaking', 'charexists', + 'cullit', 'currenttransform', 'gfcorners', 'grayfont', 'hround', + 'imagerules', 'lowres_fix', 'nodisplays', 'notransforms', 'openit', + 'displaying', 'currentwindow', 'screen_rows', 'screen_cols', + 'pixels_per_inch', 'cull', 'display', 'openwindow', 'numspecial', + 'totalweight', 'autorounding', 'fillin', 'proofing', 'tracingpens', + 'xoffset', 'chardx', 'granularity', 'smoothing', 'turningcheck', 'yoffset', + 'chardy', 'hppp', 'tracingedges', 'vppp', + 'extra_beginfig', 'extra_endfig', 'mpxbreak', + 'end', 'btex', 'etex', 'verbatimtex' +} + +local plain = table.tohash { + 'ahangle', 'ahlength', 'bboxmargin', 'defaultpen', 'defaultscale', + 'labeloffset', 'background', 'currentpen', 'currentpicture', 'cuttings', + 'defaultfont', 'extra_beginfig', 'extra_endfig', + 'beveled', 'black', 'blue', 'bp', 'butt', 'cc', 'cm', 'dd', 'ditto', 'down', 'epsilon', + 'evenly', 'fullcircle', 'green', 'halfcircle', 'identity', 'in', 'infinity', 'left', + 'mitered', 'mm', 'origin', 'pensquare', 'pt', 'quartercircle', 'red', 'right', + 'rounded', 'squared', 'unitsquare', 'up', 'white', 'withdots', + 'abs', 'bbox', 'ceiling', 'center', 'cutafter', 'cutbefore', 'dir', + 'directionpoint', 'div', 'dotprod', 'intersectionpoint', 'inverse', 'mod', 'lft', + 'round', 'rt', 'unitvector', 'whatever', + 'cutdraw', 'draw', 'drawarrow', 'drawdblarrow', 'fill', 'filldraw', 'drawdot', + 'loggingall', 'pickup', 'tracingall', 'tracingnone', 'undraw', 'unfill', + 'unfilldraw', + 'buildcycle', 'dashpattern', 'decr', 'dotlabel', 'dotlabels', 'drawoptions', + 'incr', 'label', 'labels', 'max', 'min', 'thelabel', 'z', + 'beginchar', 'blacker', 'capsule_end', 'change_width', + 'define_blacker_pixels', 'define_corrected_pixels', + 'define_good_x_pixels', 'define_good_y_pixels', + 'define_horizontal_corrected_pixels', 'define_pixels', + 'define_whole_blacker_pixels', 'define_whole_pixels', + 'define_whole_vertical_blacker_pixels', + 'define_whole_vertical_pixels', 'endchar', 'extra_beginchar', + 'extra_endchar', 'extra_setup', 'font_coding_scheme', + 'font_extra_space' +} + +local metafun = table.tohash { + 'unitcircle', 'fulldiamond', 'unitdiamond', + 'halfcircle', 'quartercircle', + 'llcircle', 'lrcircle', 'urcircle', 'ulcircle', + 'tcircle', 'bcircle', 'lcircle', 'rcircle', + 'lltriangle', 'lrtriangle', 'urtriangle', 'ultriangle', + 'smoothed', 'cornered', 'superellipsed', 'randomized', 'squeezed', + 'punked', 'curved', 'unspiked', 'simplified', 'blownup', 'stretched', + 'paralled', 'enlonged', 'shortened', + 'enlarged', 'leftenlarged', 'topenlarged', 'rightenlarged', 'bottomenlarged', + 'llenlarged', 'lrenlarged', 'urenlarged', 'ulenlarged', + 'llmoved', 'lrmoved', 'urmoved', 'ulmoved', + 'boundingbox', 'innerboundingbox', 'outerboundingbox', + 'bottomboundary', 'leftboundary', 'topboundary', 'rightboundary', + 'xsized', 'ysized', 'xysized', + 'cmyk', 'transparent', 'withshade', 'spotcolor', + 'drawfill', 'undrawfill', + 'inverted', 'uncolored', 'softened', 'grayed', + 'textext', 'graphictext', + 'loadfigure', 'externalfigure' +} + +local context = context +local verbatim = context.verbatim +local makepattern = visualizers.makepattern + +local MetapostSnippet = context.MetapostSnippet +local startMetapostSnippet = context.startMetapostSnippet +local stopMetapostSnippet = context.stopMetapostSnippet + +local MetapostSnippetConstructor = verbatim.MetapostSnippetConstructor +local MetapostSnippetBoundary = verbatim.MetapostSnippetBoundary +local MetapostSnippetSpecial = verbatim.MetapostSnippetSpecial +local MetapostSnippetComment = verbatim.MetapostSnippetComment +local MetapostSnippetNamePrimitive = verbatim.MetapostSnippetNamePrimitive +local MetapostSnippetNamePlain = verbatim.MetapostSnippetNamePlain +local MetapostSnippetNameMetafun = verbatim.MetapostSnippetNameMetafun +local MetapostSnippetName = verbatim.MetapostSnippetName + +local function visualizename(s) + if primitives[s] then + MetapostSnippetNamePrimitive(s) + elseif plain[s] then + MetapostSnippetNamePlain(s) + elseif metafun[s] then + MetapostSnippetNameMetafun(s) + else + MetapostSnippetName(s) + end +end + +local handler = visualizers.newhandler { + startinline = function() MetapostSnippet(false,"{") end, + stopinline = function() context("}") end, + startdisplay = function() startMetapostSnippet() end, + stopdisplay = function() stopMetapostSnippet() end , + constructor = function(s) MetapostSnippetConstructor(s) end, + boundary = function(s) MetapostSnippetBoundary(s) end, + special = function(s) MetapostSnippetSpecial(s) end, + comment = function(s) MetapostSnippetComment(s) end, + string = function(s) MetapostSnippetString(s) end, + quote = function(s) MetapostSnippetQuote(s) end, + name = visualizename, +} + +local comment = S("%") +local name = (patterns.letter + S("_"))^1 +local constructor = S("$@#") +local boundary = S('()[]:=<>;"') +local special = S("-+/*|`!?^&%.,") + +local grammar = visualizers.newgrammar("default", { "visualizer", + + comment = makepattern(handler,"comment",comment) + * (V("space") + V("content"))^0, + dstring = makepattern(handler,"quote",patterns.dquote) + * makepattern(handler,"string",patterns.nodquote) + * makepattern(handler,"quote",patterns.dquote), + name = makepattern(handler,"name",name), + constructor = makepattern(handler,"constructor",constructor), + boundary = makepattern(handler,"boundary",boundary), + special = makepattern(handler,"special",special), + + pattern = + V("comment") + V("dstring") + V("name") + V("constructor") + V("boundary") + V("special") + + V("newline") * V("emptyline")^0 * V("beginline") + + V("space") + + V("default"), + + visualizer = + V("pattern")^1 + +} ) + +local parser = P(grammar) + +visualizers.register("mp", { parser = parser, handler = handler, grammar = grammar } ) diff --git a/Master/texmf-dist/tex/context/base/buff-imp-mp.mkiv b/Master/texmf-dist/tex/context/base/buff-imp-mp.mkiv new file mode 100644 index 00000000000..55e13b12da1 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/buff-imp-mp.mkiv @@ -0,0 +1,76 @@ +%D \module +%D [ file=buff-imp-mp, +%D version=2010.10.19, +%D title=\CONTEXT\ Visualizer Macros, +%D subtitle=\METAPOST, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\registerctxluafile{buff-imp-mp.lua}{1.001} + +\unprotect + +\definestartstop + [MetapostSnippet] + [DefaultSnippet] + +\definestartstop + [MetapostSnippetName] + [\c!color=darkgreen, + \c!style=boldface] + +\definestartstop + [MetapostSnippetNamePrimitive] + [\c!color=darkgreen, + \c!style=swapface] + +\definestartstop + [MetapostSnippetNamePlain] + [\c!color=darkblue, + \c!color=darkgreen, + \c!style=swapface] + +\definestartstop + [MetapostSnippetNameMetafun] + [\c!color=darkred, + \c!color=darkgreen, + \c!style=swapface] + +\definestartstop + [MetapostSnippetConstructor] + [\c!color=darkred, + \c!style=boldface] + +\definestartstop + [MetapostSnippetBoundary] + [\c!color=darkblue, + \c!style=boldface] + +\definestartstop + [MetapostSnippetQuote] + [MetapostSnippetBoundary] + +\definestartstop + [MetapostSnippetSpecial] + [\c!color=darkyellow, + \c!style=boldface] + +\definestartstop + [MetapostSnippetString] + [MetapostSnippet] + +\definestartstop + [MetapostSnippetComment] + [\c!color=darkyellow, + \c!style=boldface] + +\definetyping + [MP] + [\c!option=mp] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/buff-imp-nested.lua b/Master/texmf-dist/tex/context/base/buff-imp-nested.lua new file mode 100644 index 00000000000..019cd996d6e --- /dev/null +++ b/Master/texmf-dist/tex/context/base/buff-imp-nested.lua @@ -0,0 +1,80 @@ +if not modules then modules = { } end modules ['buff-imp-nested'] = { + version = 1.001, + comment = "companion to buff-imp-nested.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local lpegmatch, patterns = lpeg.match, lpeg.patterns +local P, V, Carg = lpeg.P, lpeg.V, lpeg.Carg + +local context = context +local verbatim = context.verbatim +local variables = interfaces.variables + +local makepattern = visualizers.makepattern +local getvisualizer = visualizers.getvisualizer + +local nested = nil + +local donestedtypingstart = context.donestedtypingstart +local donestedtypingstop = context.donestedtypingstop + +local v_none = variables.none +local v_slanted = variables.slanted + +local handler = visualizers.newhandler { + initialize = function(settings) + local option = settings and settings.option + if not option or option == "" then + nested = nil + elseif option == v_slanted then + nested = nil + elseif option == v_none then + nested = nil + else + nested = getvisualizer(option,"direct") + end + end, + open = function() + donestedtypingstart() + end, + close = function() + donestedtypingstop() + end, + content = function(s) + if nested then + nested(s) + else + verbatim(s) + end + end, +} + +local open = P("<<") +local close = P(">>") +local rest = (1 - open - close - patterns.space - patterns.newline)^1 + +local grammar = visualizers.newgrammar("default", { + + initialize = patterns.beginofstring * Carg(1) / handler.initialize, + + open = makepattern(handler,"open",open), + close = makepattern(handler,"close",close), + rest = makepattern(handler,"content",rest), + + nested = V("open") * (V("pattern")^0) * V("close"), + pattern = V("line") + V("space") + V("nested") + V("rest"), + + visualizer = V("initialize") * (V("pattern")^1) + +} ) + +local parser = P(grammar) + +visualizers.register("nested", { parser = parser, handler = handler, grammar = grammar } ) + +-- lpeg.match(parser,[[<>tf<>tf>>]]) context.par() +-- lpeg.match(parser,[[<>sl>>tf>>]]) context.par() +-- lpeg.match(parser,[[sl<>tf>>sl]]) context.par() diff --git a/Master/texmf-dist/tex/context/base/buff-imp-nested.mkiv b/Master/texmf-dist/tex/context/base/buff-imp-nested.mkiv new file mode 100644 index 00000000000..627acc68508 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/buff-imp-nested.mkiv @@ -0,0 +1,21 @@ +%D \module +%D [ file=buff-imp-nested, +%D version=2010.10.19, +%D title=\CONTEXT\ Visualizer Macros, +%D subtitle=Nested, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\registerctxluafile{buff-imp-nested.lua}{1.001} + +\unprotect + +\unexpanded\def\donestedtypingstart{\bgroup\swaptypeface{}} +\unexpanded\def\donestedtypingstop {\egroup{}} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/buff-imp-parsed-xml.lua b/Master/texmf-dist/tex/context/base/buff-imp-parsed-xml.lua new file mode 100644 index 00000000000..22611ac8ab7 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/buff-imp-parsed-xml.lua @@ -0,0 +1,101 @@ +if not modules then modules = { } end modules ['buff-imp-parsed-xml'] = { + version = 1.001, + comment = "companion to buff-imp-parsed-xml.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local format = string.format + +local context = context +local verbatim = context.verbatim + +local write = visualizers.write +local writespace = visualizers.writespace +local writeargument = visualizers.writeargument + +local ParsedXmlSnippetKey = context.ParsedXmlSnippetKey +local ParsedXmlSnippetValue = context.ParsedXmlSnippetValue + +local ParsedXmlSnippetElement = verbatim.ParsedXmlSnippetElement +local ParsedXmlSnippetInstruction = verbatim.ParsedXmlSnippetInstruction +local ParsedXmlSnippetComment = verbatim.ParsedXmlSnippetComment +local ParsedXmlSnippetCdata = verbatim.ParsedXmlSnippetCdata +local ParsedXmlSnippetDoctype = verbatim.ParsedXmlSnippetDoctype + +local startParsedXmlSnippet = context.startParsedXmlSnippet +local stopParsedXmlSnippet = context.stopParsedXmlSnippet + +local parsedxmlhandler = xml.newhandlers { -- todo: treat spaces and tabs + name = "parsedxml", + handle = function(...) + print("error:",...) -- we need a handler as fallback, even if not used + end, + functions = { + ["@el@"] = function(e,handler) + local at = e.at + if at and next(at) then + ParsedXmlSnippetElement(format("<%s",e.tg)) + for k, v in next, at do + writespace() + ParsedXmlSnippetKey() + writeargument(k) + verbatim("=") + ParsedXmlSnippetValue() + writeargument(format("%q",k)) + end + ParsedXmlSnippetElement(">") + else + ParsedXmlSnippetElement(format("<%s>",e.tg)) + end + handler.serialize(e.dt,handler) + ParsedXmlSnippetElement(format("",e.tg)) + end, + ["@pi@"] = function(e,handler) + ParsedXmlSnippetInstruction("") + end , + ["@cm@"] = function(e,handler) + ParsedXmlSnippetComment("") + end, + ["@cd@"] = function(e,handler) + ParsedXmlSnippetCdata("") + end, + ["@dt@"] = function(e,handler) + ParsedXmlSnippetDoctype("") + end, + ["@tx@"] = function(s,handler) + write(s) + end, + } +} + +local function parsedxml(root,pattern) + if root then + if pattern then + root = xml.filter(root,pattern) + end + if root then + context.startParsedXmlSnippet() + xml.serialize(root,parsedxmlhandler) + context.stopParsedXmlSnippet() + end + end +end + +local function parser(str,settings) + parsedxml(xml.convert(str),settings and settings.pattern) +end + +visualizers.parsedxml = parsedxml -- for use at the lua end (maybe namespace needed) + +visualizers.register("parsed-xml", { parser = parser } ) + diff --git a/Master/texmf-dist/tex/context/base/buff-imp-parsed-xml.mkiv b/Master/texmf-dist/tex/context/base/buff-imp-parsed-xml.mkiv new file mode 100644 index 00000000000..1aa8fbc7411 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/buff-imp-parsed-xml.mkiv @@ -0,0 +1,70 @@ +%D \module +%D [ file=buff-imp-parsed-xml, +%D version=2010.10.19, +%D title=\CONTEXT\ Visualizer Macros, +%D subtitle=Parsed \XML, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% todo: color specific elements + +\registerctxluafile{buff-imp-parsed-xml.lua}{1.001} + +\unprotect + +\definestartstop + [ParsedXmlSnippet] + [%\c!before=\blank, + %\c!after=\blank, + \c!style=\tt] + +\definestartstop + [ParsedXmlSnippetDocType] + [\c!style=boldface, + \c!color=darkgreen] + +\definestartstop + [ParsedXmlSnippetElement] + [\c!style=boldface, + \c!color=darkblue] + +\definestartstop + [ParsedXmlSnippetInstruction] + [\c!style=boldface, + \c!color=darkgreen] + +\definestartstop + [ParsedXmlSnippetCdata] + [\c!style=boldface, + \c!color=darkgreen] + +\definestartstop + [ParsedXmlSnippetComment] + [\c!style=boldface, + \c!color=darkgreen] + +\definestartstop + [ParsedXmlSnippetKey] + [\c!style=boldface, + \c!color=darkred] + +% \definestartstop +% [ParsedXmlSnippetQuote] +% [\c!style=, +% \c!color=] + +\definestartstop + [ParsedXmlSnippetValue] + [\c!style=, + \c!color=] + +\definetyping + [PARSEDXML] + [option=parsed-xml] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/buff-imp-tex.lua b/Master/texmf-dist/tex/context/base/buff-imp-tex.lua new file mode 100644 index 00000000000..29fd8c0c5fe --- /dev/null +++ b/Master/texmf-dist/tex/context/base/buff-imp-tex.lua @@ -0,0 +1,130 @@ +if not modules then modules = { } end modules ['buff-imp-tex'] = { + version = 1.001, + comment = "companion to v-tex.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local P, S, V, patterns = lpeg.P, lpeg.S, lpeg.V, lpeg.patterns + +local context = context +local verbatim = context.verbatim +local makepattern = visualizers.makepattern +local makenested = visualizers.makenested +local getvisualizer = visualizers.getvisualizer + +local TexSnippet = context.TexSnippet +local startTexSnippet = context.startTexSnippet +local stopTexSnippet = context.stopTexSnippet + +local TexSnippetName = verbatim.TexSnippetName +local TexSnippetGroup = verbatim.TexSnippetGroup +local TexSnippetBoundary = verbatim.TexSnippetBoundary +local TexSnippetSpecial = verbatim.TexSnippetSpecial +local TexSnippetComment = verbatim.TexSnippetComment + +local handler = visualizers.newhandler { + startinline = function() TexSnippet(false,"{") end, + stopinline = function() context("}") end, + startdisplay = function() startTexSnippet() end, + stopdisplay = function() stopTexSnippet() end , + name = function(s) TexSnippetName(s) end, + group = function(s) TexSnippetGroup(s) end, + boundary = function(s) TexSnippetBoundary(s) end, + special = function(s) TexSnippetSpecial(s) end, + comment = function(s) TexSnippetComment(s) end, +} + +-- todo: unicode letters in control sequences (slow as we need to test the nature) + +local comment = S("%") +local name = P("\\") * (patterns.letter + S("@!?"))^1 +local escape = P("\\") * (patterns.anything - patterns.newline)^-1 -- else we get \n +local group = S("${}") +local boundary = S('[]()<>#="') +local special = S("/^_-&+'`|") + +local p_comment = makepattern(handler,"comment",comment) + * (V("space") + V("content"))^0 +local p_name = makepattern(handler,"name",name) +local p_escape = makepattern(handler,"name",escape) +local p_group = makepattern(handler,"group",group) +local p_boundary = makepattern(handler,"boundary",boundary) +local p_special = makepattern(handler,"special",special) +local p_somespace = V("newline") * V("emptyline")^0 * V("beginline") + + V("space") + +--~ local pattern = visualizers.pattern + +local grammar = visualizers.newgrammar("default", { "visualizer", + + comment = p_comment, + name = p_name, + escape = p_escape, + group = p_group, + boundary = p_boundary, + special = p_special, + somespace = p_somespace, + + pattern = V("comment") + + V("name") + V("escape") + V("group") + V("boundary") + V("special") + + V("newline") * V("emptyline")^0 * V("beginline") + + V("space") + + V("default"), + + visualizer = V("pattern")^1 + +} ) + +local parser = P(grammar) + +visualizers.register("tex", { parser = parser, handler = handler, grammar = grammar } ) + +local function makecommand(handler,how,start,left,right) + local c, l, r, f = P(start), P(left), P(right), how + local n = ( P { l * ((1 - (l + r)) + V(1))^0 * r } + P(1-r) )^0 + if type(how) == "string" then + f = function(s) getvisualizer(how,"direct")(s) end + end + return makepattern(handler,"name",c) + * V("somespace")^0 + * makepattern(handler,"group",l) + * (n/f) + * makepattern(handler,"group",r) +end + +local grammar = visualizers.newgrammar("default", { "visualizer", + + comment = p_comment, + name = p_name, + escape = p_escape, + group = p_group, + boundary = p_boundary, + special = p_special, + somespace = p_somespace, + + mpcode = makenested(handler,"mp","\\startMPcode","\\stopMPcode") + + makenested(handler,"mp","\\startMPgraphic","\\stopMPgraphic") + + makenested(handler,"mp","\\startuseMPgraphic","\\stopuseMPgraphic") + + makenested(handler,"mp","\\startreusableMPgraphic","\\stopreusableMPgraphic") + + makenested(handler,"mp","\\startuniqueMPgraphic","\\stopuniqueMPgraphic") + + makenested(handler,"mp","\\startMPpage","\\stopMPpage"), + + luacode = makenested (handler,"lua","\\startluacode","\\stopluacode") + + makecommand(handler,"lua","\\ctxlua","{","}"), + + pattern = V("comment") + + V("mpcode") + V("luacode") + + V("name") + V("escape") + V("group") + V("boundary") + V("special") + + V("newline") * V("emptyline")^0 * V("beginline") + + V("space") + + V("default"), + + visualizer = V("pattern")^1 + +} ) + +local parser = P(grammar) + +visualizers.register("context", { parser = parser, handler = handler, grammar = grammar } ) diff --git a/Master/texmf-dist/tex/context/base/buff-imp-tex.mkiv b/Master/texmf-dist/tex/context/base/buff-imp-tex.mkiv new file mode 100644 index 00000000000..3849757292b --- /dev/null +++ b/Master/texmf-dist/tex/context/base/buff-imp-tex.mkiv @@ -0,0 +1,51 @@ +%D \module +%D [ file=buff-imp-tex, +%D version=2010.10.19, +%D title=\CONTEXT\ Visualizer Macros, +%D subtitle=\TEX, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\registerctxluafile{buff-imp-tex.lua}{1.001} + +\unprotect + +\definestartstop + [TexSnippet] + [DefaultSnippet] + +\definestartstop + [TexSnippetName] + [\c!color=darkgreen, + \c!style=boldface] + +\definestartstop + [TexSnippetGroup] + [\c!color=darkred, + \c!style=boldface] + +\definestartstop + [TexSnippetBoundary] + [\c!color=darkblue, + \c!style=boldface] + +\definestartstop + [TexSnippetSpecial] + [\c!color=darkyellow, + \c!style=boldface] + +\definestartstop + [TexSnippetComment] + [\c!color=darkyellow, + \c!style=boldface] + +\definetyping + [TEX] + [\c!option=tex] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/buff-imp-xml.lua b/Master/texmf-dist/tex/context/base/buff-imp-xml.lua new file mode 100644 index 00000000000..baf290d4ce7 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/buff-imp-xml.lua @@ -0,0 +1,133 @@ +if not modules then modules = { } end modules ['buff-imp-xml'] = { + version = 1.001, + comment = "companion to v-xml.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local P, S, V, patterns = lpeg.P, lpeg.S, lpeg.V, lpeg.patterns + +local context = context +local verbatim = context.verbatim +local makepattern = visualizers.makepattern + +local XmlSnippet = context.XmlSnippet +local startXmlSnippet = context.startXmlSnippet +local stopXmlSnippet = context.stopXmlSnippet + +local XmlSnippetName = verbatim.XmlSnippetName +local XmlSnippetKey = verbatim.XmlSnippetKey +local XmlSnippetBoundary = verbatim.XmlSnippetBoundary +local XmlSnippetString = verbatim.XmlSnippetString +local XmlSnippetEqual = verbatim.XmlSnippetEqual +local XmlSnippetEntity = verbatim.XmlSnippetEntity +local XmlSnippetComment = verbatim.XmlSnippetComment +local XmlSnippetCdata = verbatim.XmlSnippetCdata + +local handler = visualizers.newhandler { + startinline = function() XmlSnippet(false,"{") end, + stopinline = function() context("}") end, + startdisplay = function() startXmlSnippet() end, + stopdisplay = function() stopXmlSnippet () end, + name = function(s) XmlSnippetName(s) end, + key = function(s) XmlSnippetKey(s) end, + boundary = function(s) XmlSnippetBoundary(s) end, + string = function(s) XmlSnippetString(s) end, + equal = function(s) XmlSnippetEqual(s) end, + entity = function(s) XmlSnippetEntity(s) end, + comment = function(s) XmlSnippetComment(s) end, + cdata = function(s) XmlSnippetCdata(s) end, +} + +local comment = P("--") +local name = (patterns.letter + patterns.digit + S('_-.'))^1 +local entity = P("&") * (1-P(";"))^1 * P(";") +local openbegin = P("<") +local openend = P("") + P(">") +local closeend = P(">") +local opencomment = P("") +local openinstruction = P("") +local opencdata = P("") + +local grammar = visualizers.newgrammar("default", { "visualizer", + sstring = + makepattern(handler,"string",patterns.dquote) + * (V("whitespace") + makepattern(handler,"default",1-patterns.dquote))^0 + * makepattern(handler,"string",patterns.dquote), + dstring = + makepattern(handler,"string",patterns.squote) + * (V("whitespace") + makepattern(handler,"default",1-patterns.squote))^0 + * makepattern(handler,"string",patterns.squote), + entity = + makepattern(handler,"entity",entity), + name = + makepattern(handler,"name",name) + * ( + makepattern(handler,"default",patterns.colon) + * makepattern(handler,"name",name) + )^0, + key = + makepattern(handler,"key",name) + * ( + makepattern(handler,"default",patterns.colon) + * makepattern(handler,"key",name) + )^0, + attributes = ( + V("optionalwhitespace") + * V("key") + * V("optionalwhitespace") + * makepattern(handler,"equal",patterns.equal) + * V("optionalwhitespace") + * (V("dstring") + V("sstring")) + * V("optionalwhitespace") + )^0, + open = + makepattern(handler,"boundary",openbegin) + * V("name") + * V("optionalwhitespace") + * V("attributes") + * makepattern(handler,"boundary",closebegin), + close = + makepattern(handler,"boundary",openend) + * V("name") + * V("optionalwhitespace") + * makepattern(handler,"boundary",closeend), + comment = + makepattern(handler,"boundary",opencomment) + * (V("whitespace") + makepattern(handler,"comment",(1-closecomment)))^0 -- slow + * makepattern(handler,"boundary",closecomment), + cdata = + makepattern(handler,"boundary",opencdata) + * (V("whitespace") + makepattern(handler,"comment",(1-closecdata)))^0 -- slow + * makepattern(handler,"boundary",closecdata), + instruction = + makepattern(handler,"boundary",openinstruction) + * V("name") + * V("optionalwhitespace") + * V("attributes") + * V("optionalwhitespace") + * makepattern(handler,"boundary",closeinstruction), + + pattern = + V("comment") + + V("instruction") + + V("cdata") + + V("close") + + V("open") + + V("entity") + + V("space") + + V("line") + + V("default"), + + visualizer = + V("pattern")^1 +} ) + +local parser = P(grammar) + +visualizers.register("xml", { parser = parser, handler = handler, grammar = grammar } ) diff --git a/Master/texmf-dist/tex/context/base/buff-imp-xml.mkiv b/Master/texmf-dist/tex/context/base/buff-imp-xml.mkiv new file mode 100644 index 00000000000..68dc9ed1394 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/buff-imp-xml.mkiv @@ -0,0 +1,71 @@ +%D \module +%D [ file=buff-imp-xml, +%D version=2010.10.19, +%D title=\CONTEXT\ Visualizer Macros, +%D subtitle=\XML, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\registerctxluafile{buff-imp-xml.lua}{1.001} + +\unprotect + +\definestartstop + [XmlSnippet] + [DefaultSnippet] + +\definestartstop + [XmlSnippetName] + [\c!color=darkblue, + \c!style=boldface] + +\definestartstop + [XmlSnippetKey] + [\c!color=darkgreen, + \c!style=boldface] + +\definestartstop + [XmlSnippetBoundary] + [\c!color=darkblue, + \c!style=boldface] + +\definestartstop + [XmlSnippetEntity] + [\c!color=darkred, + \c!style=boldface] + +\definestartstop + [XmlSnippetString] + [\c!color=darkblue, + \c!style=boldface] + +\definestartstop + [XmlSnippetEqual] + [\c!color=darkblue, + \c!style=boldface] + +\definestartstop + [XmlSnippetComment] + [\c!color=darkyellow, + \c!style=boldface] + +\definestartstop + [XmlSnippetCdata] + [\c!color=darkyellow, + \c!style=boldface] + +\definestartstop + [XmlSnippetInstruction] + [\c!color=darkyellow, + \c!style=boldface] + +\definetyping + [XML] + [\c!option=xml] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/buff-ini.lua b/Master/texmf-dist/tex/context/base/buff-ini.lua index 6b1af8f96f3..70328f0f198 100644 --- a/Master/texmf-dist/tex/context/base/buff-ini.lua +++ b/Master/texmf-dist/tex/context/base/buff-ini.lua @@ -1,266 +1,137 @@ if not modules then modules = { } end modules ['buff-ini'] = { version = 1.001, - comment = "companion to core-buf.mkiv", + comment = "companion to buff-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } --- ctx lua reference model / hooks and such --- to be optimized - --- redefine buffers.get - -buffers = { } -buffers.data = { } -buffers.hooks = { } -buffers.flags = { } -buffers.commands = { } -buffers.visualizers = { } - --- if needed we can make 'm local - local trace_run = false trackers.register("buffers.run", function(v) trace_run = v end) local trace_visualize = false trackers.register("buffers.visualize", function(v) trace_visualize = v end) -local utf = unicode.utf8 +local report_buffers = logs.reporter("buffers","usage") -local concat, texsprint, texprint, texwrite = table.concat, tex.sprint, tex.print, tex.write -local utfbyte, utffind, utfgsub = utf.byte, utf.find, utf.gsub +local concat = table.concat local type, next = type, next -local huge = math.huge -local byte, sub, find, char, gsub, rep, lower, format, gmatch, match = string.byte, string.sub, string.find, string.char, string.gsub, string.rep, string.lower, string.format, string.gmatch, string.match -local utfcharacters, utfvalues = string.utfcharacters, string.utfvalues -local ctxcatcodes = tex.ctxcatcodes +local sub, format, count, splitlines = string.sub, string.format, string.count, string.splitlines + local variables = interfaces.variables -local lpegmatch = lpeg.match +local settings_to_array = utilities.parsers.settings_to_array +local texprint, ctxcatcodes = tex.print, tex.ctxcatcodes + +buffers = { } -local data, flags, hooks, visualizers = buffers.data, buffers.flags, buffers.hooks, buffers.visualizers +local buffers = buffers +local context = context -visualizers.defaultname = variables.typing +local data = { } function buffers.raw(name) - return data[name] or { } + return data[name] or "" end -function buffers.erase(name) +local function erase(name) data[name] = nil end -function buffers.set(name, str) - data[name] = { str } -- CHECK THIS +local function assign(name,str) + data[name] = str end -function buffers.append(name, str) +local function append(name,str) data[name] = (data[name] or "") .. str end +local function exists(name) + return data[name] ~= nil +end -buffers.flags.store_as_table = true - --- to be sorted out: crlf + \ ; slow now +local function getcontent(name) -- == raw + return data[name] or "" +end -local n = 0 +local function getlines(name) + local d = name and data[name] + return d and splitlines(d) +end -function buffers.grab(name,begintag,endtag,bufferdata) - local dn = data[name] or "" - if dn == "" then - buffers.level = 0 +local function collectcontent(names,separator) -- no print + if type(names) == "string" then + names = settings_to_array(names) end - buffers.level = buffers.level + bufferdata:count("\\"..begintag) - bufferdata:count("\\"..endtag) - local more = buffers.level > 0 - if more then - dn = dn .. bufferdata .. endtag - buffers.level = buffers.level - 1 + if #names == 1 then + return getcontent(names[1]) else - if dn == "" then - dn = sub(bufferdata,1,#bufferdata-1) - else - dn = dn .. "\n" .. sub(bufferdata,1,#bufferdata-1) - end - dn = gsub(dn,"[\010\013]$","") - if flags.store_as_table then - dn = dn:splitlines() + local t, n = { }, 0 + for i=1,#names do + local c = getcontent(names[i]) + if c ~= "" then + n = n + 1 + t[n] = c + end end + return concat(t,separator or "\n") -- was \r end - data[name] = dn - cs.testcase(more) end -function buffers.exists(name) - return data[name] ~= nil -end +buffers.erase = erase +buffers.assign = assign +buffers.append = append +buffers.exists = exists +buffers.getcontent = getcontent +buffers.getlines = getlines +buffers.collectcontent = collectcontent -function buffers.doifelsebuffer(name) - cs.testcase(data[name] ~= nil) -end +-- the context interface -flags.optimize_verbatim = true -flags.count_empty_lines = false - -local no_break_command = "\\doverbatimnobreak" -local do_break_command = "\\doverbatimgoodbreak" -local begin_of_line_command = "\\doverbatimbeginofline" -local end_of_line_command = "\\doverbatimendofline" -local empty_line_command = "\\doverbatimemptyline" - -local begin_of_display_command = "\\doverbatimbeginofdisplay" -local end_of_display_command = "\\doverbatimendofdisplay" -local begin_of_inline_command = "\\doverbatimbeginofinline" -local end_of_inline_command = "\\doverbatimendofinline" - -function buffers.verbatimbreak(n,m) - if flags.optimize_verbatim then - if n == 2 or n == m then - texsprint(no_break_command) - elseif n > 1 then - texsprint(do_break_command) - end - end -end +commands.erasebuffer = erase +commands.assignbuffer = assign -function buffers.strip(lines,first,last) - local first, last = first or 1, last or #lines - for i=first,last do - local li = lines[i] - if #li == 0 or find(li,"^%s*$") then - first = first + 1 - else - break - end - end - for i=last,first,-1 do - local li = lines[i] - if #li == 0 or find(li,"^%s*$") then - last = last - 1 - else - break - end - end - return first, last, last - first + 1 -end +local P, patterns, lpegmatch = lpeg.P, lpeg.patterns, lpeg.match -function buffers.range(lines,first,last,range) -- 1,3 1,+3 fromhere,tothere - local first, last = first or 1, last or #lines - local what = aux.settings_to_array(range) - local r_first, r_last = what[1], what[2] - local f, l = tonumber(r_first), tonumber(r_last) - if r_first then - if f then - if f > first then - first = f - end - else - for i=first,last do - if find(lines[i],r_first) then - first, strip = i + 1 - break - end - end - end - end - if r_last then - if l then - if find(r_last,"^[%+]") then -- 1,+3 - l = first + l - end - if l < last then - last = l - end - else - for i=first,last do - if find(lines[i],r_last) then - last = i - 1 - break - end - end - end - end - return first, last +local function countnesting(b,e) + local n + local g = P(b) / function() n = n + 1 end + + P(e) / function() n = n - 1 end + + patterns.anything + local p = patterns.alwaysmatched / function() n = 0 end + * g^0 + * patterns.alwaysmatched / function() return n end + return p end -function buffers.type(name,realign,range) - local lines = data[name] - local action = buffers.typeline - if lines then - if type(lines) == "string" then - lines = lines:splitlines() - data[name] = lines - end - if realign then - lines = buffers.realign(lines,realign) - end - local line, n = 0, 0 - local first, last, m = buffers.strip(lines) - if range then - first, last = buffers.range(lines,first,last,range) - first, last = buffers.strip(lines,first,last) - end - hooks.begin_of_display() - for i=first,last do - n, line = action(lines[i], n, m, line) - end - hooks.end_of_display() - end -end +local counters = { } +local nesting = 0 -function buffers.loaddata(filename) -- this one might go away - -- this will be cleaned up when we have split supp-fil completely - -- instead of half-half - local ok, str, n = resolvers.loaders.tex(filename) - if not str then - ok, str, n = resolvers.loaders.tex(file.addsuffix(filename,'tex')) +function commands.grabbuffer(name,begintag,endtag,bufferdata) -- maybe move \\ to call + local dn = getcontent(name) + if dn == "" then + nesting = 0 end -end - -function buffers.loaddata(filename) -- this one might go away - local foundname = resolvers.findtexfile(filename) or "" - if foundname == "" then - foundname = resolvers.findtexfile(file.addsuffix(filename,'tex')) or "" + -- nesting = nesting + count(bufferdata,"\\"..begintag) - count(bufferdata,"\\"..endtag) + local counter = counters[begintag] + if not counter then + counter = countnesting(begintag,endtag) + counters[begintag] = counter end - if foundname == "" then - return "" + nesting = nesting + lpegmatch(counter,bufferdata) + local more = nesting > 0 + if more then + dn = dn .. bufferdata .. endtag + nesting = nesting - 1 else - return resolvers.loadtexfile(foundname) - end -end - -function buffers.typefile(name,realign,range) -- still somewhat messy, since name can be be suffixless - local str = buffers.loaddata(name) - if str and str~= "" then - local lines = str:splitlines() - if realign then - lines = buffers.realign(lines,realign) - end - local line, n, action = 0, 0, buffers.typeline - local first, last, m = buffers.strip(lines) - hooks.begin_of_display() - if range then - first, last = buffers.range(lines,first,last,range) - first, last = buffers.strip(lines,first,last) + if dn == "" then + dn = sub(bufferdata,1,-2) + else + dn = dn .. "\n" .. sub(bufferdata,1,-2) -- no \r, \n is more generic end - for i=first,last do - n, line = action(lines[i], n, m, line) + local last = sub(dn,-1) + if last == "\n" or last == "\r" then -- \n is unlikely as \r is the endlinechar + dn = sub(dn,1,-2) end - hooks.end_of_display() end -end - -function buffers.typeline(str,n,m,line) - n = n + 1 - buffers.verbatimbreak(n,m) - if find(str,"%S") then - line = line + 1 - hooks.begin_of_line(line) - hooks.flush_line(hooks.line(str)) - hooks.end_of_line() - else - if flags.count_empty_lines then - line = line + 1 - end - hooks.empty_line(line) - end - return n, line + assign(name,dn) + commands.testcase(more) end -- The optional prefix hack is there for the typesetbuffer feature and @@ -273,7 +144,7 @@ local function prepared(name,list) -- list is optional if not name or name == "" then name = tex.jobname .. "-" .. list .. ".tmp" end - local content = buffers.collect(list,nil) or "" + local content = collectcontent(list,nil) or "" if content == "" then content = "empty buffer" end @@ -283,556 +154,56 @@ end local capsule = "\\starttext\n%s\n\\stoptext\n" local command = "context %s" -function buffers.save(name,list,encapsulate) -- list is optional - local name, content = prepared(name,list) - io.savedata(name, (encapsulate and format(capsule,content)) or content) -end - -function commands.savebuffer(list,name) -- name is optional - buffers.save(name,list) -end - -function buffers.run(name,list,encapsulate) +function commands.runbuffer(name,list,encapsulate) local name, content = prepared(name,list) + if encapsulate then + content = format(capsule,content) + end local data = io.loaddata(name) - content = (encapsulate and format(capsule,content)) or content if data ~= content then if trace_run then - commands.writestatus("buffers","changes in '%s', processing forced",name) + report_buffers("changes in '%s', processing forced",name) end io.savedata(name,content) os.execute(format(command,name)) elseif trace_run then - commands.writestatus("buffers","no changes in '%s', not processed",name) + report_buffers("no changes in '%s', not processed",name) end end -local printer = (lpeg.patterns.textline/texprint)^0 - -function buffers.get(name) - local b = buffers.data[name] - if b then - if type(b) == "table" then - for i=1,#b do - texprint(b[i]) - end - else - lpegmatch(printer,b) - end - end -end - -local function content(name,separator) -- no print - local b = data[name] - if b then - if type(b) == "table" then - return concat(b,separator or "\n") - else - return b - end - else - return "" - end -end - -buffers.content = content - -function buffers.collect(names,separator) -- no print - -- maybe we should always store a buffer as table so - -- that we can pass it directly - if type(names) == "string" then - names = aux.settings_to_array(names) - end - local t = { } - for i=1,#names do - local c = content(names[i],separator) - if c ~= "" then - t[#t+1] = c - end - end - return concat(t,separator or "\r") -- "\n" is safer due to comments and such -end - -function buffers.feedback(names,separator) - -- don't change the texprint into texsprint as it fails on mp buffers - -- because (penddef) becomes penddef then - texprint(ctxcatcodes,string.splitlines(buffers.collect(names,separator))) -end - -local function tobyte(c) - return " [" .. utfbyte(c) .. "] " -end - -function buffers.inspect(name) - local b = data[name] - if b then - if type(b) == "table" then - for k=1,#b do - local v = b[k] - if v == "" then - texsprint(ctxcatcodes,"[crlf]\\par ") -- space ? - else - texsprint(ctxcatcodes,(gsub(v,"(.)",tobyte)),"\\par") - end - end - else - texsprint(ctxcatcodes,(gsub(b,"(.)",tobyte))) - end - end -end - --- maybe just line(n,str) empty(n,str) - -visualizers.tablength = 7 -visualizers.enabletab = true -- false -visualizers.obeyspace = true - -function buffers.settablength(tablength) - visualizers.tablength = tablength and tonumber(tablength) or 7 -end - -visualizers.handlers = visualizers.handlers or { } - -local handlers = visualizers.handlers - -function buffers.newvisualizer(name) - name = lower(name) - local handler = { } - handlers[name] = handler - return handler -end - -function buffers.getvisualizer(name) - name = lower(name) - return handlers[name] or buffers.loadvisualizer(name) -end - -function buffers.loadvisualizer(name) - name = lower(name) - local hn = handlers[name] - if hn then - return hn - else - environment.loadluafile("pret-" .. name) - local hn = handlers[name] - if not hn then - -- hn = buffers.newvisualizer(name) - hn = handlers[visualizers.defaultname] - handlers[name] = hn - if trace_visualize then - logs.report("buffers","mapping '%s' visualizer onto '%s'",name,visualizers.defaultname) - end - elseif trace_visualize then - logs.report("buffers","loading '%s' visualizer",name) - end - return hn - end -end - --- was "default", should be set at tex end (todo) - -local default = buffers.newvisualizer(visualizers.defaultname) - ---~ print(variables.typing) os.exit() - --- will become cleaner - -local currentvisualizer, currenthandler - -function buffers.setvisualizer(str) - currentvisualizer = lower(str) - currenthandler = handlers[currentvisualizer] - if currenthandler then - -- if trace_visualize then - -- logs.report("buffers","enabling specific '%s' visualizer",currentvisualizer) - -- end - else - currentvisualizer = visualizers.defaultname - currenthandler = handlers.default - -- if trace_visualize then - -- logs.report("buffers","enabling default visualizer '%s'",currentvisualizer) - -- end - end - if currenthandler.reset then - currenthandler.reset() - end -end - -function buffers.resetvisualizer() - currentvisualizer = visualizers.defaultname - currenthandler = handlers.default - if currenthandler.reset then - currenthandler.reset() - end -end - -buffers.setvisualizer(visualizers.defaultname) - -function visualizers.reset() -end - -function buffers.doifelsevisualizer(str) - cs.testcase((str ~= "") and (handlers[lower(str)] ~= nil)) -end - --- calling routines, don't change - -function hooks.begin_of_display() - (currenthandler.begin_of_display or default.begin_of_display)(currentvisualizer) -end - -function hooks.end_of_display() - (currenthandler.end_of_display or default.end_of_display)() -end - -function hooks.begin_of_inline() - (currenthandler.begin_of_inline or default.begin_of_inline)(currentvisualizer) -end - -function hooks.end_of_inline() - (currenthandler.end_of_inline or default.end_of_inline)() -end - -function hooks.flush_line(str,nesting) - local fl = currenthandler.flush_line - if fl then - str = gsub(str," *[\n\r]+ *"," ") ; -- semi colon needed - fl(str,nesting) - else - -- gsub done later - default.flush_line(str,nesting) - end -end - -function hooks.flush_inline(str,nesting) - hooks.begin_of_inline() - hooks.flush_line(str,nesting) - hooks.end_of_inline() -end - -function hooks.begin_of_line(n) - (currenthandler.begin_of_line or default.begin_of_line)(n) -end - -function hooks.end_of_line() - (currenthandler.end_of_line or default.end_of_line)() -end - -function hooks.empty_line() - (currenthandler.empty_line or default.empty_line)() -end - -function hooks.line(str) - if visualizers.enabletab then - str = string.tabtospace(str,visualizers.tablength) - else - str = gsub(str,"\t"," ") - end - return (currenthandler.line or default.line)(str) -end - --- defaults - -function default.begin_of_display(currentvisualizer) - texsprint(ctxcatcodes,begin_of_display_command,"{",currentvisualizer,"}") -end - -function default.end_of_display() - texsprint(ctxcatcodes,end_of_display_command) -end - -function default.begin_of_inline(currentvisualizer) - texsprint(ctxcatcodes,begin_of_inline_command,"{",currentvisualizer,"}") -end - -function default.end_of_inline() - texsprint(ctxcatcodes,end_of_inline_command) -end - -function default.begin_of_line(n) - texsprint(ctxcatcodes, begin_of_line_command,"{",n,"}") -end - -function default.end_of_line() - texsprint(ctxcatcodes,end_of_line_command) -end - -function default.empty_line() - texsprint(ctxcatcodes,empty_line_command) -end - -function default.line(str) - return str -end - -function default.flush_line(str) - str = gsub(str," *[\n\r]+ *"," ") - if visualizers.obeyspace then - for c in utfcharacters(str) do - if c == " " then - texsprint(ctxcatcodes,"\\obs") - else - texwrite(c) - end - end - else - texwrite(str) - end -end - --- not needed any more - -local function escaped_token(c) - if utffind(c,"^(%a%d)$") then - return c - elseif c == " " then - return "\\obs " - else - return "\\char" .. utfbyte(c) .. " " - end -end - -buffers.escaped_token = escaped_token - -function buffers.escaped(str) - -- use the utfcharacters loop - return (utfgsub(str,"(.)", escaped_token)) +function commands.savebuffer(list,name) -- name is optional + local name, content = prepared(name,list) + io.savedata(name,content) end --- special one - -buffers.commands.nested = "\\switchslantedtype " - --- todo : utf + faster, direct print and such. no \\char, vrb catcodes, see end - -function visualizers.flush_nested(str, enable) -- no utf, kind of obsolete mess - str = gsub(str," *[\n\r]+ *"," ") - local result, c, nested, i = "", "", 0, 1 - local commands = buffers.commands -- otherwise wrong commands - while i < #str do -- slow - c = sub(str,i,i+1) - if c == "<<" then - nested = nested + 1 - if enable then - result = result .. "{" .. commands.nested - else - result = result .. "{" - end - i = i + 2 - elseif c == ">>" then - if nested > 0 then - nested = nested - 1 - result = result .. "}" - end - i = i + 2 - else - c = sub(str,i,i) - if c == " " then - result = result .. "\\obs " - elseif find(c,"%a") then - result = result .. c - else - result = result .. "\\char" .. byte(c) .. " " - end - i = i + 1 - end +function commands.getbuffer(name) + local str = data[name] + if str and str ~= "" then + context.viafile(str) end - result = result .. "\\char" .. byte(sub(str,i,i)) .. " " .. rep("}",nested) - texsprint(ctxcatcodes,result) end --- handy helpers --- --- \sop[color] switch_of_pretty --- \bop[color] begin_of_pretty --- \eop end_of_pretty --- \obs obeyedspace --- \char special characters - -buffers.currentcolors = { } - -function buffers.change_state(n, state) - if n then - if state ~= n then - if state > 0 then - texsprint(ctxcatcodes,"\\sop[",buffers.currentcolors[n],"]") - else - texsprint(ctxcatcodes,"\\bop[",buffers.currentcolors[n],"]") - end - return n - end - elseif state > 0 then - texsprint(ctxcatcodes,"\\eop") - return 0 - end - return state +function commands.getbuffermkvi(name) + context.viafile(resolvers.macros.preprocessed(getcontent(name))) end -function buffers.finish_state(state) - if state > 0 then - texsprint(ctxcatcodes,"\\eop") - return 0 +function commands.getbufferctxlua(name) + local ok = loadstring(getcontent(name)) + if ok then + ok() else - return state + report_buffers("invalid lua code in buffer '%s'",name) end end -buffers.open_nested = rep("\\char"..byte('<').." ",2) -buffers.close_nested = rep("\\char"..byte('>').." ",2) - -function buffers.replace_nested(result) - result = gsub(result,buffers.open_nested, "{") - result = gsub(result,buffers.close_nested,"}") - return result -end - -function buffers.flush_result(result,nested) - if nested then - texsprint(ctxcatcodes,buffers.replace_nested(concat(result,""))) - else - texsprint(ctxcatcodes,concat(result,"")) - end +function commands.doifelsebuffer(name) + commands.testcase(exists(name)) end --- new +-- This only used for mp buffers and is a kludge. Don't +-- change the texprint into texsprint as it fails because +-- "penddef" becomes "penddef" then. -function buffers.realign(name,forced_n) -- no, auto, - local n, d - if type(name) == "string" then - d = data[name] - if type(d) == "string" then - d = d:splitlines() - end - else - d = name -- already a buffer - end - forced_n = (forced_n == variables.auto and huge) or tonumber(forced_n) - if forced_n then - for i=1, #d do - local spaces = find(d[i],"%S") - if not spaces then - -- empty line - elseif not n then - n = spaces - elseif spaces == 0 then - n = 0 - break - elseif n > spaces then - n = spaces - end - end - if n > 0 then - if n > forced_n then - n = forced_n - end - for i=1,#d do - d[i] = sub(d[i],n) - end - end - end - return d -end - --- escapes: buffers.set_escape("tex","/BTEX","/ETEX") - -local function flush_escaped_line(str,pattern,flushline) - while true do - local a, b, c = match(str,pattern) - if a and a ~= "" then - flushline(a) - end - if b and b ~= "" then - texsprint(ctxcatcodes,"{",b,"}") - end - if c then - if c == "" then - break - else - str = c - end - else - flushline(str) - break - end - end -end - -function buffers.set_escape(name,pair) - if pair and pair ~= "" then - local visualizer = buffers.getvisualizer(name) - visualizer.normal_flush_line = visualizer.normal_flush_line or visualizer.flush_line - if pair == variables.no then - visualizer.flush_line = visualizer.normal_flush_line or visualizer.flush_line - if trace_visualize then - logs.report("buffers","resetting escape range for visualizer '%s'",name) - end - else - local start, stop - if pair == variables.yes then - start, stop = "/BTEX", "/ETEX" - else - pair = string.split(pair,",") - start, stop = string.esc(pair[1] or ""), string.esc(pair[2] or "") - end - if start ~= "" then - local pattern - if stop == "" then - pattern = "^(.-)" .. start .. "(.*)(.*)$" - else - pattern = "^(.-)" .. start .. "(.-)" .. stop .. "(.*)$" - end - function visualizer.flush_line(str) - flush_escaped_line(str,pattern,visualizer.normal_flush_line) - end - if trace_visualize then - logs.report("buffers","setting escape range for visualizer '%s' to %s -> %s",name,start,stop) - end - elseif trace_visualize then - logs.report("buffers","problematic escape specification '%s' for visualizer '%s'",pair,name) - end - end - end +function commands.feedback(names) + texprint(ctxcatcodes,splitlines(collectcontent(names))) end - --- THIS WILL BECOME A FRAMEWORK: the problem with prety printing is that --- we deal with snippets and therefore we need tolerant parsing - ---~ local type = type - ---~ visualizers = visualizers or { } - ---~ local function fallback(s) return s end - ---~ function visualizers.visualize(visualizer,kind,pattern) ---~ if type(visualizer) == "table" and type(kind) == "string" then ---~ kind = visualizer[kind] or visualizer.default or fallback ---~ else ---~ kind = fallback ---~ end ---~ return (lpeg.C(pattern))/kind ---~ end - ---~ local flusher = texio.write ---~ local format = string.format - ---~ local visualizer = { ---~ word = function(s) return flusher(format("\\bold{%s}",s)) end, ---~ number = function(s) return flusher(format("\\slanted{%s}",s)) end, ---~ default = function(s) return flusher(s) end, ---~ } - ---~ local word = lpeg.R("AZ","az")^1 ---~ local number = lpeg.R("09")^1 ---~ local any = lpeg.P(1) - ---~ local pattern = lpeg.P { "start", ---~ start = ( ---~ visualizers.visualize(visualizer,"word",word) + ---~ visualizers.visualize(visualizer,"number",number) + ---~ visualizers.visualize(visualizer,"default",any) ---~ )^1 ---~ } - ---~ str = [[test 123 test $oeps$]] - ---~ lpegmatch(pattern,str) diff --git a/Master/texmf-dist/tex/context/base/buff-ini.mkiv b/Master/texmf-dist/tex/context/base/buff-ini.mkiv index 86b0fa3c530..7bd382fe2e9 100644 --- a/Master/texmf-dist/tex/context/base/buff-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/buff-ini.mkiv @@ -1,6 +1,6 @@ %D \module -%D [ file=buff-ini, % was core-buf, % blocks are moved to core-blk -%D version=2000.01.05, +%D [ file=buff-ini, +%D version=2011.11.22, % previous big effort 2000.01.05, %D title=\CONTEXT\ Buffer Macros, %D subtitle=Buffers, %D author=Hans Hagen, @@ -15,72 +15,32 @@ \registerctxluafile{buff-ini}{1.001} -% todo: -% -% \startluacode -% local locations = { } -% function document.set_number(name) -% locations[name] = { -% line = status.linenumber, -% file = status.filename -% } -% end -% function document.add_number(name) -% local b, l = buffers.raw(name), locations[name] -% if b and l then -% for i=1,#b do -% b[i] = string.gsub(b[i],"# line: ","# line: " .. l.line + 2) -% end -% end -% end -% \stopluacode -% -% \starttext -% -% \ctxlua{document.set_number("oeps")} -% \startbuffer[oeps] -% # line: -% -% test -% test -% \stopbuffer -% \ctxlua{document.add_number("oeps")} -% -% \typebuffer[oeps] -% -% \stoptext - -\ifdefined\doinitializeverbatim \else% temp hack - \def\doinitializeverbatim{\tttf} -\fi - \unprotect -\chardef\buffernestmode\plusone % 0: not nested, 1: startbuffer nested, 2: all buffers nested +% number is messy and not needed as we store the number anyway +% we can get rid of \c!number -\newif\ifsegmentatebuffer -\newif\ifemptybufferline +\newcount\nofdefinedbuffers -\def\currentbuffer{\jobname} +\let\currentbuffer\empty -\def\setcurrentbuffer#1% - {\doifelsenothing{#1}{\edef\currentbuffer{\jobname}}{\edef\currentbuffer{#1}}} +\def\doifelsebuffer#1% + {\ctxcommand{doifelsebuffer("#1")}} \def\resetbuffer {\dosingleempty\doresetbuffer} \def\doresetbuffer[#1]% - {\begingroup - \setcurrentbuffer{#1}% - \ctxlua{buffers.erase("\currentbuffer")}% - \endgroup} + {\ctxcommand{erasebuffer("#1")}} -\def\dostartbuffer +\unexpanded\def\dostartdefinedbuffer {\bgroup - \obeylines % nodig, anders gaat 't fout als direct \starttable (bv) + \obeylines \doquadrupleempty\dodostartbuffer} -\def\dodostartbuffer[#1][#2][#3][#4]% upward compatible +\let\dostartbuffer\dostartdefinedbuffer % used in some modules + +\def\dodostartbuffer[#1][#2][#3][#4]% [category] [name] [start] [stop] {\iffourthargument \def\next{\dododostartbuffer{#1}{#2}{#3}{#4}}% \else @@ -88,63 +48,43 @@ \fi \next} -\def\dododostartbuffer#1#2#3#4% - {%\showmessage\m!systems{15}{#2}% - \doifelsevalue{\??bu#1\c!paragraph}\v!yes - {\segmentatebuffertrue} % todo in mkiv - {\doifnumberelse{\getvalue{\??bu#1\c!paragraph}}\segmentatebuffertrue\segmentatebufferfalse}% - \doifvalue{\??bu#1\c!local}\v!yes - {\chardef\buffernestmode\plustwo}% permit nesting - \setcurrentbuffer{#2}% - \doifelsenothing{#4} - {\normalexpanded{\noexpand\setbuffercapsules{\e!start\v!buffer}{\e!stop\v!buffer}}% - \letvalue\bufferstop\relax} - %{\@EA\setbuffercapsules\@EA{\csname#3\@EA\endcsname\@EA}\@EA{\csname#4\endcsname}}% if we strip later - {\setbuffercapsules{#3}{#4}}% - \normalexpanded{\noexpand\dodowithbuffer - {\currentbuffer} - {\bufferstart} - {\bufferstop} - {\donothing} - {\egroup - \noexpand\getvalue{\bufferstop}}}} - -\letvalue{\e!start\v!buffer}\dostartbuffer - -\let\endbuffer\undefined % to please the dep parser +\def\dododostartbuffer#1#2#3#4% \donothing needed ! + {\normalexpanded{\dodowithbuffer{#2}{#3}{#4}{\donothing}{\egroup\noexpand\getvalue{#4}}}} + +\setvalue{\e!start\v!buffer}% + {\bgroup + \obeylines + \dosingleempty\redostartbuffer} + +\def\redostartbuffer[#1]% + {\dododostartbuffer{}{#1}{\e!start\v!buffer}{\e!stop\v!buffer}} \def\dowithbuffer#1#2#3% name, startsequence, stopsequence, before, after - {\setbuffercapsules{#2}{#3}% - \normalexpanded{\noexpand\dodowithbuffer{#1}{\bufferstart}{\bufferstop}}} + {\normalexpanded{\dodowithbuffer{#1}{#2}{#3}}} -\long\def\dodowithbuffer#1#2#3#4#5% name, startsequence, stopsequence, before, after +\unexpanded\long\def\dodowithbuffer#1#2#3#4#5% name, startsequence, stopsequence, before, after {#4% \bgroup + \ctxcommand{erasebuffer("#1")}% \setcatcodetable \vrbcatcodes - \catcode`\\=12 - \ctxlua{buffers.erase("#1")}% \long\def\nododowithbuffer {\egroup #5}% \long\def\dododowithbuffer##1#3% is detokenize needed? TEST - {\ctxlua - {buffers.grab("#1","#2","#3",\!!bs\detokenize{##1}\!!es)} - \dododowithbuffer - \nododowithbuffer}% + {\ctxcommand{grabbuffer("#1","#2","#3",\!!bs\detokenize{##1}\!!es)} % space ? + \dododowithbuffer + \nododowithbuffer}% \dododowithbuffer} -\def\setbuffercapsules#1#2% \scantextokens not needed (had a reason at some point) - {\edef\bufferstart{#1}\edef\bufferstart{\scantextokens\expandafter{\bufferstart}}% - \edef\bufferstop {#2}\edef\bufferstop {\scantextokens\expandafter{\bufferstop }}} - \def\setbuffer {\dosingleempty\dosetbuffer} +\let\endbuffer\relax + \long\def\dosetbuffer[#1]#2\endbuffer % seldom used so we just pass #2 - {\begingroup - \setcurrentbuffer{#1}% - \ctxlua{buffers.set("\currentbuffer", \!!bs\detokenize{#2}\!!es)}% - \endgroup} + {\ctxcommand{assignbuffer("#1", \!!bs\detokenize{#2}\!!es)}} + +\def\namedbufferparameter#1#2{\csname\??bu#1#2\endcsname} \unexpanded\def\setupbuffer {\dodoubleempty\dosetupbuffer} @@ -156,188 +96,65 @@ \getparameters[\??bu][#1]% \fi} -\def\dodefinebuffer[#1][#2]% - {\iffirstargument % else problems - \doglobal\increment\nofdefinedbuffers - \letvalue{\??bu#1\c!number }\nofdefinedbuffers - \letvalue{\??bu#1\c!paragraph}\v!no - \setuevalue{\e!start#1}{\noexpand\dostartbuffer[#1][def-\nofdefinedbuffers][\e!start#1][\e!stop#1]}% maybe also relax stop - \setuevalue{\e!get #1}{\noexpand\dogetbuffer [#1][def-\nofdefinedbuffers]}% - \setuevalue{\e!type #1}{\noexpand\dotypebuffer [#1][def-\nofdefinedbuffers]}% - \getparameters[\??bu#1][#2]% - \fi} +\newtoks\everydefinebuffer \unexpanded\def\definebuffer {\dodoubleempty\dodefinebuffer} -\def\thebuffernumber#1% - {\csname\??bu#1\c!number\endcsname} - -\unexpanded\def\getbuffer - {\dodoubleempty\dogetbuffer} - -\def\dogetbuffer[#1][#2]% - {\ifsecondargument - \dodogetbuffer[#1][#2]% - \else - \dodogetbuffer[][#1]% - \fi} - -\def\dogetbufferasis{\ctxlua{buffers.get("\currentbuffer")}} - -\def\dodogetbuffer[#1][#2]% - {\getvalue{\??bu#1\c!before}% - \dobuffer{16}{#2}\dogetbufferasis - \getvalue{\??bu#1\c!after}} - -\unexpanded\def\typebuffer - {\dodoubleempty\dotypebuffer} - -\def\doprocessbufferverbatim - {\doinitializeverbatim - \ctxlua{buffers.type("\currentbuffer","\typingparameter\c!strip")}} - -\def\doprocessbufferlinesverbatim#1#2#3% - {#2% - % todo, set up numbers - \doinitializeverbatim - \ctxlua{buffers.type("\currentbuffer","\typingparameter\c!strip")} - #3} - -\def\doifelsebuffer#1% - {\ctxlua{buffers.doifelsebuffer("#1")}} - -\def\dodotypebuffer#1#2#3% see dodotypefile - {\doifelsebuffer{#3} - {\dosometyping{#1}{#2}{#3}\doprocessbufferverbatim\doprocessbufferlinesverbatim} - {\reporttypingerror{#3}}} - -\def\dotypefilebuffer{\dodotypebuffer{\v!file}{}{\currentbuffer}}% - -\def\dotypebuffer[#1][#2]% +\def\dodefinebuffer[#1][#2]% {\iffirstargument - \dobuffer{17}{#1}\dotypefilebuffer + \global\advance\nofdefinedbuffers\plusone + \setevalue{\??bu#1\c!number}{\number\nofdefinedbuffers}% + \def\currentbuffer{#1}% + \getparameters[\??bu#1][#2]% + \the\everydefinebuffer \else - \dobuffer{17}{#2}\dotypefilebuffer + % fatal error \fi} -\def\dobuffer#1#2#3% - {\doifelsenothing{#2} - {\dodobuffer#3\jobname} - {\processcommalist[#2]{\dodobuffer#3}}} - -\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}% - #1% - \popmacro\currentbuffer} +\def\thebuffernumber #1{\csname\??bu#1\c!number\endcsname} +\def\thedefinedbuffer#1{def-\csname\??bu#1\c!number\endcsname} -\def\processTEXbuffer{\getbuffer} % handy +\appendtoks + \setuevalue{\e!start\currentbuffer}% + {\noexpand\dostartdefinedbuffer + [\currentbuffer]% + [def-\number\nofdefinedbuffers]% + [\e!start\currentbuffer]% + [\e!stop\currentbuffer]}% + \setuevalue{\e!get\currentbuffer}% + {\noexpand\dogetdefinedbuffer + [\currentbuffer]% + [def-\number\nofdefinedbuffers]}% +\to \everydefinebuffer -% extras: +\def\doprocessbufferlist#1#2% + {\doifelsenothing{#1} + {\dododogetbuffer\empty} + {\processcommalist[#1]#2}} -\def\inspectbuffer - {\dosingleempty\doinspectbuffer} +\unexpanded\def\getbuffer % no [settings yet] + {\dosingleempty\dogetbuffer} -\def\doinspectbuffer[#1]% - {\setcurrentbuffer{#1}% - \ctxlua{buffers.inspect("\currentbuffer")}} - -% seldom used, only in a few projects that demanded more speed - -\let\usememorybuffers\relax -\let\usefilebuffers \relax - -% 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 +\unexpanded\def\dogetbuffer[#1]% [name] + {\namedbufferparameter\empty\c!before + \doprocessbufferlist{#1}\dododogetbuffer + \namedbufferparameter\empty\c!after} -\def\skippedbufferparagraphs{0} +\def\dogetdefinedbuffer[#1][#2]% + {\namedbufferparameter{#1}\c!before + \dododogetbuffer{#2}% + \namedbufferparameter{#1}\c!after} -\let\startbufferparagraph\relax -\let\stopbufferparagraph \par % \relax +\def\dododogetbuffer#1% + {\ctxcommand{getbuffer("#1")}} -\newcount\currentbufferparagraph +\definebuffer[\v!hiding] \setupbuffer[\v!hiding][\c!before=,\c!after=] -\def\getbufferparagraphs - {\dodoubleempty\dogetbufferparagraphs} - -\def\dosetbufferoffset#1% - {\doifnumberelse{\getvalue{\??bu#1\c!paragraph}} - {\currentbufferparagraph-\getvalue{\??bu#1\c!paragraph}} - {\currentbufferparagraph \zerocount}% - \relax} - -\def\dogetbufferparagraphs[#1][#2]% - {\iffirstargument - \ifsecondargument - \dosetbufferoffset{#1}% - \doifelse{#2}\v!all - {\unexpanded\def\startbufferparagraph{\normalbufferparagraph{#1}}} - {\unexpanded\def\startbufferparagraph{\filterbufferparagraph{#1}{#2}}}% - \unexpanded\def\stopbufferparagraph{\dostopbufferparagraph{#1}}% - \def\next{\getparagraphedbuffer[#1]}% - \else - \dosetbufferoffset\empty - \unexpanded\def\startbufferparagraph{\filterbufferparagraph{}{#1}}% - \unexpanded\def\stopbufferparagraph{\dostopbufferparagraph{}}% - \def\next{\getparagraphedbuffer[]}% - \fi - \else - \dosetbufferoffset\empty - \unexpanded\def\startbufferparagraph{\normalbufferparagraph{}}% - \unexpanded\def\stopbufferparagraph{\dostopbufferparagraph{}}% - \def\next{\getparagraphedbuffer[]}% - \fi - \next} - -\def\dotypeparagraphbuffer{\ctxlua{buffers.get("\currentbuffer")}} - -\def\getparagraphedbuffer[#1]% - {\dobuffer{16}{#1}\dotypeparagraphbuffer} - -\def\dostopbufferparagraph#1% - {\getvalue{\??bu#1\c!after}\par} - -\def\dostartbufferparagraph#1% - {\par\getvalue{\??bu#1\c!before}} - -\def\normalbufferparagraph - {\advance\currentbufferparagraph \plusone - \ifnum\currentbufferparagraph>\zerocount - \expandafter\dostartbufferparagraph - \else - \expandafter\gobbleoneargument - \fi} - -\def\filterbufferparagraph#1#2% - {\advance\currentbufferparagraph \plusone - \ifcase\currentbufferparagraph - \@EA\gobblebufferparagraph - \else - \doifinsetelse{\the\currentbufferparagraph}{#2} - {\@EA\dostartbufferparagraph} - {\@EA\fakebufferparagraph}% - \fi - {#1}} - -\long\def\gobblebufferparagraph#1#2\stopbufferparagraph - {} - -\def\fakebufferparagraph#1% - {\bgroup - \unexpanded\def\stopbufferparagraph{\dostopbufferparagraph{#1}\egroup\egroup}% - \setbox\scratchbox\vbox\bgroup\dostartbufferparagraph{#1}} - -% definitions - -\definebuffer[\v!hiding] \setupbuffer[\v!hiding][\c!local=\v!yes] +\let\processTEXbuffer\getbuffer % handy synonym \setupbuffer - [\c!paragraph=\v!no, - \c!before=, + [\c!before=, \c!after=] % only mkiv: @@ -350,6 +167,24 @@ \unexpanded\def\savebuffer{\dodoubleempty\dosavebuffer} -\def\dosavebuffer[#1][#2]{\ctxlua{commands.savebuffer("#1","#2")}} +\def\dosavebuffer[#1][#2]{\ctxcommand{savebuffer("#1","#2")}} + +%D Experimental: no expansion of commands in buffer! + +% \startbuffer[what] +% tex.print("WHAT") +% \stopbuffer +% \startbuffer +% tex.print("JOBNAME") +% \stopbuffer +% +% \ctxluabuffer[what] \ctxluabuffer + +\def\ctxluabuffer {\dosingleempty\doctxluabuffer} +\def\mkvibuffer {\dosingleempty\domkvibuffer} +\def\mkvibufferraw{\dosingleempty\domkvibufferraw} + +\def\doctxluabuffer [#1]{\ctxcommand{getbufferctxlua("#1")}} +\def\domkvibuffer [#1]{\ctxcommand{getbuffermkvi("#1")}} \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/buff-par.lua b/Master/texmf-dist/tex/context/base/buff-par.lua new file mode 100644 index 00000000000..2015b0bc0a4 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/buff-par.lua @@ -0,0 +1,179 @@ +if not modules then modules = { } end modules ['buff-ini'] = { + version = 1.001, + comment = "companion to buff-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local trace_parallel = false trackers.register("buffers.parallel", function(v) trace_parallel = v end) + +local report_parallel = logs.reporter("buffers","parallel") + +local insert, remove, find, gmatch = table.insert, table.remove, string.find, string.gmatch +local strip, format = string.strip, string.format + +local variables = interfaces.variables + +buffers.parallel = { } local parallel = buffers.parallel + +local data = { } + +function parallel.define(category,tags) + local tags = utilities.parsers.settings_to_array(tags) + local entries = { } + data[category] = { + tags = tags, + entries = entries, + } + for i=1,#tags do + entries[tags[i]] = { + lines = { }, + number = 0, + } + end +end + +function parallel.reset(category,tags) + if not tags or tags == "" or tags == variables.all then + tags = table.keys(entries) + else + tags = utilities.parsers.settings_to_array(tags) + end + for i=1,#tags do + entries[tags[i]] = { + lines = { }, + number = 0, + } + end +end + +function parallel.next(category) + local dc = data[category] + local tags = dc.tags + local entries = dc.entries + for i=1,#tags do + insert(entries[tags[i]].lines, { }) + end +end + +function parallel.save(category,tag,content) + local dc = data[category] + if not dc then + return + end + local entries = dc.entries[tag] + if not entries then + return + end + local lines = entries.lines + if not lines then + return + end + local line = lines[#lines] + if not line then + return + end + -- maybe no strip + -- use lpeg + if find(content,"^%s*%[") then + local done = false + for label, content in gmatch(content,"%s*%[(.-)%]%s*([^%[]+)") do + if done then + line = { } + insert(lines,line) + else + done = true + end + if trace_parallel and label ~= "" then + report_parallel("reference found: category '%s', tag '%s', label '%s'",category,tag,label) + end + line.label = label + line.content = strip(content) + end + else + line.content = strip(content) + line.label = "" + end +end + +function parallel.hassomecontent(category,tags) + local dc = data[category] + if not dc then + return false + end + local entries = dc.entries + if not tags or tags == "" or tags == variables.all then + tags = table.keys(entries) + else + tags = utilities.parsers.settings_to_array(tags) + end + for t=1,#tags do + local tag = tags[t] + local lines = entries[tag].lines + for i=1,#lines do + local content = lines[i].content + if content and content ~= "" then + return true + end + end + end + return false +end + +local save = resolvers.savers.byscheme + +function parallel.place(category,tags,options) + local dc = data[category] + if not dc then + return + end + local entries = dc.entries + local tags = utilities.parsers.settings_to_array(tags) + local options = utilities.parsers.settings_to_hash(options) + local start, n, criterium = options.start, options.n, options.criterium + start, n = start and tonumber(start), n and tonumber(n) + local max = 1 + if n then + max = n + elseif criterium == variables.all then + max = 0 + for t=1,#tags do + local tag = tags[t] + local lines = entries[tag].lines + if #lines > max then + max = #lines + end + end + end + for i=1,max do + for t=1,#tags do + local tag = tags[t] + local entry = entries[tag] + if entry then + local lines = entry.lines + local number = entry.number + 1 + entry.number = number + local line = remove(lines,1) + if line and line.content then + local content = format("\\input{%s}",save("virtual","parallel",line.content)) + context.doflushparallel(tag,1,number,line.label,content) + else + context.doflushparallel(tag,0,number,"","") + end + end + end + end +end + +-- interface + +commands.defineparallel = parallel.define +commands.nextparallel = parallel.next +commands.saveparallel = parallel.save +commands.placeparallel = parallel.place +commands.resetparallel = parallel.reset + +function commands.doifelseparallel(category,tags) + commands.testcase(parallel.hassomecontent(category,tags)) +end diff --git a/Master/texmf-dist/tex/context/base/buff-par.mkiv b/Master/texmf-dist/tex/context/base/buff-par.mkiv new file mode 100644 index 00000000000..c44a75050b1 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/buff-par.mkiv @@ -0,0 +1,151 @@ +%D \module +%D [ file=buff-par, +%D version=2010.12.05, +%D title=\CONTEXT\ Buffer Macros, +%D subtitle=Parallel, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{ConTeXt Buffer Macros / Parallel} + +\registerctxluafile{buff-par}{1.001} + +%D This module is developped for Thomas Schmitz as part of +%D a project. + +\unprotect + +\letvalue{\??px:}\empty + +\def\parallelparameter#1% + {\csname\??px:% + \ifcsname\??px:\currentparallel:\currentparallelinstance:#1\endcsname + \currentparallel:\currentparallelinstance:#1% + \else\ifcsname\??px:\currentparallel:#1\endcsname + \currentparallel:#1% + \else\ifcsname\??px:#1\endcsname + #1% + \fi\fi\fi + \endcsname} + +\unexpanded\def\defineparallel + {\dodoubleargument\dodefineparallel} + +\def\dodefineparallel[#1][#2]% + {\ctxcommand{defineparallel("#1","#2")}% + \processcommalist[#2]\dododefineparallel + \setuvalue{\e!start#1}{\dostartparallelset{#1}}% + \setuvalue{\e!stop #1}{\dostopparallelset}} + +\def\dododefineparallel#1% + {\definebuffer[#1]%% + \setuvalue{\e!stop#1}{\dowithparallel{#1}}} + +\def\dostartparallelset#1% + {\def\currentparallel{#1}% + \ctxcommand{nextparallel("\currentparallel")}} + +\def\dostopparallelset#1% + {} + +\def\dowithparallel#1% defined moet ook aan de lua kant kunnen + {\ctxcommand{saveparallel("\currentparallel","#1",buffers.raw("\thedefinedbuffer{#1}"))}} + +\unexpanded\def\placeparallel + {\dotripleempty\doplaceparallel} + +\def\doplaceparallel[#1][#2][#3]% + {\begingroup + \def\currentparallel{#1}% + \ctxcommand{placeparallel("\currentparallel","#2","#3")}% + \endgroup} + +% was: \parallelparameter\c!command} + +\def\doflushparallel#1#2#3#4#5% {instance}{status}{line}{label}{content} + {\begingroup + \def\currentparallelinstance{#1}% + \def\currentparallelnumber {#2}% + \def\currentparallelline {#3}% + \def\currentparallellabel {#4}% + \def\currentparallelcontent {#5}% + \ifcase#2\relax + \expandafter\noflushparalleldefault + \or + \expandafter\doflushparalleldefault + \fi + \endgroup} + +\def\noflushparalleldefault{} +\def\doflushparalleldefault{\directsetup{\parallelparameter\c!setups}} + +\startsetups parallel:place:default + \hangafter1 + \hangindent4em + \dontleavehmode + \hbox to 3em \bgroup + \hss + \bf + \doifsomething \currentparallellabel { + \textreference[\currentparallellabel]{\currentparallelline} + } + \currentparallelline + \quad + \egroup + \currentparallelcontent + \par +\stopsetups + +\unexpanded\def\setupparallel + {\dotripleempty\dosetupparallel} + +\def\dosetupparallel[#1][#2][#3]% + {\ifthirdargument + \getparameters[\??px:#1:#2:][#3]% + \else\ifsecondargument + \getparameters[\??px:#1:][#2]% + \else + \getparameters[\??px:][#1]% maybe no : here + \fi\fi} + +\setupparallel +% [\c!command=\doflushparalleldefault] + [\c!setups=parallel:place:default] + +\def\doifelseparallel#1#2% + {\cldcontext{commands.doifelseparallel("#1","#2")}} + +\def\resetparallel + {\dodoubleempty\doresetparallel} + +\def\resetparallel[#1][#2]% + {\ctxcommand{resetparallel("#1","#2"))}} + +% default + +% \def\doflushparalleldefault#1#2#3#4% todo: setups instead +% {\ifcase#1\or +% \begingroup +% \hangafter1 +% \hangindent4em +% \dontleavehmode +% \hbox to 3em{\hss\bf\doifsomething{#3}{\textreference[#3]{#2}}#2\quad}#4\par +% \endgroup +% \fi} + +\protect \endinput + +% \def\dododefineparallel#1% +% {\setuvalue{\e!stop #1}{}% +% \setuvalue{\e!start#1}{\dostartparallel{#1}}} +% +% \def\dostartparallel#1% +% {\grabuntil{\e!stop#1}{\dododostartparallel{#1}}} +% +% \def\dododostartparallel#1#2% +% {\ctxcommand{saveparallel("\currentparallel","#1",\!!bs\detokenize{#2}\!!es)}} diff --git a/Master/texmf-dist/tex/context/base/buff-ver.lua b/Master/texmf-dist/tex/context/base/buff-ver.lua new file mode 100644 index 00000000000..bd274a36a7b --- /dev/null +++ b/Master/texmf-dist/tex/context/base/buff-ver.lua @@ -0,0 +1,670 @@ +if not modules then modules = { } end modules ['buff-ver'] = { + version = 1.001, + comment = "companion to buff-ver.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- The default visualizers have reserved names starting with buff-imp-*. Users are +-- supposed to use different names for their own variants. +-- +-- todo: skip=auto + +local type, next, rawset, rawget, setmetatable, getmetatable = type, next, rawset, rawget, setmetatable, getmetatable +local format, lower, upper,match, find, sub = string.format, string.lower, string.upper, string.match, string.find, string.sub +local splitlines = string.splitlines +local concat = table.concat +local C, P, R, V, Carg, Cc, Cs = lpeg.C, lpeg.P, lpeg.R, lpeg.V, lpeg.Carg, lpeg.Cc, lpeg.Cs +local patterns, lpegmatch, is_lpeg = lpeg.patterns, lpeg.match, lpeg.is_lpeg + +local trace_visualize = false trackers.register("buffers.visualize", function(v) trace_visualize = v end) +local report_visualizers = logs.reporter("buffers","visualizers") + +local allocate = utilities.storage.allocate + +visualizers = visualizers or { } +local specifications = allocate() +visualizers.specifications = specifications + +local tabtospace = utilities.strings.tabtospace +local variables = interfaces.variables +local settings_to_array = utilities.parsers.settings_to_array +local verbatim = context.verbatim +local variables = interfaces.variables +local findfile = resolvers.findfile +local addsuffix = file.addsuffix + +local v_auto = variables.auto +local v_yes = variables.yes + +-- beware, these all get an argument (like newline) + +local doinlineverbatimnewline = context.doinlineverbatimnewline +local doinlineverbatimbeginline = context.doinlineverbatimbeginline +local doinlineverbatimemptyline = context.doinlineverbatimemptyline +local doinlineverbatimstart = context.doinlineverbatimstart +local doinlineverbatimstop = context.doinlineverbatimstop + +local dodisplayverbatimnewline = context.dodisplayverbatimnewline +local dodisplayverbatimbeginline = context.dodisplayverbatimbeginline +local dodisplayverbatimemptyline = context.dodisplayverbatimemptyline +local dodisplayverbatimstart = context.dodisplayverbatimstart +local dodisplayverbatimstop = context.dodisplayverbatimstop + +local doverbatimspace = context.doverbatimspace + +local CargOne = Carg(1) + +local function f_emptyline(s,settings) + if settings and settings.nature == "inline" then + doinlineverbatimemptyline() + else + dodisplayverbatimemptyline() + end +end + +local function f_beginline(s,settings) + if settings and settings.nature == "inline" then + doinlineverbatimbeginline() + else + dodisplayverbatimbeginline() + end +end + +local function f_newline(s,settings) + if settings and settings.nature == "inline" then + doinlineverbatimnewline() + else + dodisplayverbatimnewline() + end +end + +local function f_start(s,settings) + if settings and settings.nature == "inline" then + doinlineverbatimstart() + else + dodisplayverbatimstart() + end +end + +local function f_stop(s,settings) + if settings and settings.nature == "inline" then + doinlineverbatimstop() + else + dodisplayverbatimstop() + end +end + +local function f_default(s) -- (s,settings) + verbatim(s) +end + +local function f_space() -- (s,settings) + doverbatimspace() +end + +local function f_signal() -- (s,settings) + -- we use these for special purposes +end + +local signal = "\000" + +visualizers.signal = signal +visualizers.signalpattern = P(signal) + +local functions = { __index = { + emptyline = f_emptyline, + newline = f_newline, + default = f_default, + beginline = f_beginline, + space = f_space, + start = f_start, + stop = f_stop, + signal = f_signal, + } +} + +local handlers = { } + +function visualizers.newhandler(name,data) + local tname, tdata = type(name), type(data) + if tname == "table" then -- (data) + setmetatable(name,getmetatable(name) or functions) + return name + elseif tname == "string" then + if tdata == "string" then -- ("name","parent") + local result = { } + setmetatable(result,getmetatable(handlers[data]) or functions) + handlers[name] = result + return result + elseif tdata == "table" then -- ("name",data) + setmetatable(data,getmetatable(data) or functions) + handlers[name] = data + return data + else -- ("name") + local result = { } + setmetatable(result,functions) + handlers[name] = result + return result + end + else -- () + local result = { } + setmetatable(result,functions) + return result + end +end + +function visualizers.newgrammar(name,t) + name = lower(name) + t = t or { } + local g = visualizers.specifications[name] + g = g and g.grammar + if g then + if trace_visualize then + report_visualizers("cloning grammar '%s'",name) + end + for k,v in next, g do + if not t[k] then + t[k] = v + end + if is_lpeg(v) then + t[name..":"..k] = v + end + end + end + return t +end + +local function getvisualizer(method,nature) + method = lower(method) + local m = specifications[method] or specifications.default + if nature then + if trace_visualize then + report_visualizers("getting visualizer '%s' with nature '%s'",method,nature) + end + return m and (m[nature] or m.parser) or nil + else + if trace_visualize then + report_visualizers("getting visualizer '%s'",method) + end + return m and m.parser or nil + end +end + +local fallback = context.verbatim + +local function makepattern(visualizer,replacement,pattern) + if not pattern then + report_visualizers("error in visualizer: %s",replacement) + return patterns.alwaystrue + else + if type(visualizer) == "table" and type(replacement) == "string" then + replacement = visualizer[replacement] or fallback + else + replacement = fallback + end + return (C(pattern) * CargOne) / replacement + end +end + +local function makenested(handler,how,start,stop) + local b, e, f = P(start), P(stop), how + if type(how) == "string" then + f = function(s) getvisualizer(how,"direct")(s) end + end + return makepattern(handler,"name",b) + * ((1-e)^1/f) + * makepattern(handler,"name",e) +end + +visualizers.pattern = makepattern +visualizers.makepattern = makepattern +visualizers.makenested = makenested + +function visualizers.load(name) + name = lower(name) + if rawget(specifications,name) == nil then + name = lower(name) + local texname = findfile(format("buff-imp-%s.mkiv",name)) + local luaname = findfile(format("buff-imp-%s.lua" ,name)) + if texname == "" or luaname == "" then + -- assume a user specific file + luaname = findfile(addsuffix(name,"mkiv")) + texname = findfile(addsuffix(name,"lua" )) + end + if texname == "" or luaname == "" then + if trace_visualize then + report_visualizers("unknown visualizer '%s'",name) + end + else + if trace_visualize then + report_visualizers("loading visualizer '%s'",name) + end + lua.registercode(luaname) + context.input(texname) + end + if rawget(specifications,name) == nil then + rawset(specifications,name,false) + end + end +end + +function commands.doifelsevisualizer(name) + commands.testcase(specifications[lower(name)]) +end + +function visualizers.register(name,specification) + name = lower(name) + if trace_visualize then + report_visualizers("registering visualizer '%s'",name) + end + specifications[name] = specification + local parser, handler = specification.parser, specification.handler + local displayparser = specification.display or parser + local inlineparser = specification.inline or parser + local isparser = is_lpeg(parser) + local start, stop + if isparser then + start = makepattern(handler,"start",patterns.alwaysmatched) + stop = makepattern(handler,"stop",patterns.alwaysmatched) + end + if handler then + if isparser then + specification.display = function(content,settings) + if handler.startdisplay then handler.startdisplay(settings) end + lpegmatch(start * displayparser * stop,content,1,settings) + if handler.stopdisplay then handler.stopdisplay(settings) end + end + specification.inline = function(content,settings) + if handler.startinline then handler.startinline(settings) end + lpegmatch(start * inlineparser * stop,content,1,settings) + if handler.stopinline then handler.stopinline(settings) end + end + specification.direct = function(content,settings) + lpegmatch(parser,content,1,settings) + end + elseif parser then + specification.display = function(content,settings) + if handler.startdisplay then handler.startdisplay(settings) end + parser(content,settings) + if handler.stopdisplay then handler.stopdisplay(settings) end + end + specification.inline = function(content,settings) + if handler.startinline then handler.startinline(settings) end + parser(content,settings) + if handler.stopinline then handler.stopinline(settings) end + end + specification.direct = parser + end + elseif isparser then + specification.display = function(content,settings) + lpegmatch(start * displayparser * stop,content,1,settings) + end + specification.inline = function(content,settings) + lpegmatch(start * inlineparser * stop,content,1,settings) + end + specification.direct = function(content,settings) + lpegmatch(parser,content,1,settings) + end + elseif parser then + specification.display = parser + specification.inline = parser + specification.direct = parser + end + return specification +end + +local escapepatterns = allocate() +visualizers.escapepatterns = escapepatterns + +local function texmethod(s) + context.bgroup() + context(s) + context.egroup() +end + +local function texcommand(s) + context[s]() +end + +local function defaultmethod(s,settings) + lpegmatch(getvisualizer("default"),lower(s),1,settings) +end + +-- we can consider using a nested instead + +local space_pattern = patterns.space^0 +local name_pattern = R("az","AZ")^1 + +-- the hack is needed in order to retain newlines when an escape happens at the +-- at the begin of a line; it also ensures proper line numbering; a bit messy + +local function hack(pattern) + return Cs(pattern * Cc(signal)) +end + +function visualizers.registerescapepattern(name,before,after,normalmethod,escapemethod) + local escapepattern = escapepatterns[name] + if not escapepattern then + if trace_visualize then + report_visualizers("registering escape pattern, name: '%s', before: '%s', after: '%s'",name,before,after) + end + before, after = P(before) * space_pattern, space_pattern * P(after) + escapepattern = ( + (before / "") + * ((1 - after)^0 / (escapemethod or texmethod)) + * (after / "") + + hack((1 - before)^1) / (normalmethod or defaultmethod) + )^0 + escapepatterns[name] = escapepattern + end + return escapepattern +end + +function visualizers.registerescapecommand(name,token,normalmethod,escapecommand) + local escapepattern = escapepatterns[name] + if not escapepattern then + if trace_visualize then + report_visualizers("registering escape token, name: '%s', token: '%s'",name,token) + end + token = P(token) + local notoken = hack((1 - token)^1) + local cstoken = name_pattern * space_pattern + escapepattern = ( + (token / "") + * (cstoken / (escapecommand or texcommand)) + + (notoken / (normalmethod or defaultmethod)) + )^0 + escapepatterns[name] = escapepattern + end + return escapepattern +end + +local escapedvisualizers = { } + +local function visualize(content,settings) -- maybe also method in settings + if content and content ~= "" then + local method = lower(settings.method or "default") + local m + local e = settings.escape + if e and e ~= "" then + local newname = format("%s-%s",e,method) + local newspec = specifications[newname] + if newspec then + m = newspec + else + local start, stop + if e == v_yes then + start, stop = "/BTEX", "/ETEX" + else + start, stop = match(e,"^(.-),(.-)$") -- todo: lpeg + end + local oldvisualizer = specifications[method] or specifications.default + local oldparser = oldvisualizer.direct + local newparser + if start and stop then + newparser = visualizers.registerescapepattern(newname,start,stop,oldparser) + else -- for old times sake: /em + newparser = visualizers.registerescapecommand(newname,e,oldparser) + end + m = visualizers.register(newname, { + parser = newparser, + handler = oldvisualizer.handler, + }) + end + else + m = specifications[method] or specifications.default + end + local nature = settings.nature or "display" + local n = m and m[nature] + if n then + if trace_visualize then + report_visualizers("visualize using method '%s' and nature '%s'",method,nature) + end + n(content,settings) + else + if trace_visualize then + report_visualizers("visualize using method '%s'",method) + end + fallback(content,1,settings) + end + end +end + +visualizers.visualize = visualize +visualizers.getvisualizer = getvisualizer + +local function checkedsettings(settings,nature) + if not settings then + return { nature = nature } + else + if not settings.nature then + settings.nature = nature + end + return settings + end +end + +function visualizers.visualizestring(content,settings) + visualize(content,checkedsettings(settings,"inline")) +end + +function visualizers.visualizefile(name,settings) + visualize(resolvers.loadtexfile(name),checkedsettings(settings,"display")) +end + +function visualizers.visualizebuffer(name,settings) + visualize(buffers.getcontent(name),checkedsettings(settings,"display")) +end + +-- -- + +local space = C(patterns.space) * CargOne / f_space +local newline = C(patterns.newline) * CargOne / f_newline +local emptyline = C(patterns.emptyline) * CargOne / f_emptyline +local beginline = C(patterns.beginline) * CargOne / f_beginline +local anything = C(patterns.somecontent) * CargOne / f_default + +----- verbosed = (space + newline * (emptyline^0) * beginline + anything)^0 +local verbosed = (space + newline * (emptyline^0) * beginline + emptyline + newline + anything)^0 + +local function write(s,settings) -- bad name + lpegmatch(verbosed,s,1,settings or false) +end + +visualizers.write = write +visualizers.writenewline = f_newline +visualizers.writeemptyline = f_emptyline +visualizers.writespace = f_space +visualizers.writedefault = f_default + +function visualizers.writeargument(...) + context("{") -- If we didn't have tracing then we could + write(...) -- use a faster print to tex variant for the + context("}") -- { } tokens as they always have ctxcatcodes. +end + +-- helpers + +local function realign(lines,forced_n) -- no, auto, + forced_n = (forced_n == v_auto and huge) or tonumber(forced_n) + if forced_n then + local n = 0 + for i=1, #lines do + local spaces = find(lines[i],"%S") + if not spaces then + -- empty line + elseif not n then + n = spaces + elseif spaces == 0 then + n = 0 + break + elseif n > spaces then + n = spaces + end + end + if n > 0 then + if n > forced_n then + n = forced_n + end + for i=1,#d do + lines[i] = sub(lines[i],n) + end + end + end + return lines +end + +local function getstrip(lines,first,last) + local first, last = first or 1, last or #lines + for i=first,last do + local li = lines[i] + if #li == 0 or find(li,"^%s*$") then + first = first + 1 + else + break + end + end + for i=last,first,-1 do + local li = lines[i] + if #li == 0 or find(li,"^%s*$") then + last = last - 1 + else + break + end + end + return first, last, last - first + 1 +end + +local function getrange(lines,first,last,range) -- 1,3 1,+3 fromhere,tothere + local noflines = #lines + local first, last = first or 1, last or noflines + if last < 0 then + last = noflines + last + end + local what = settings_to_array(range) + local r_first, r_last = what[1], what[2] + local f, l = tonumber(r_first), tonumber(r_last) + if r_first then + if f then + if f > first then + first = f + end + else + for i=first,last do + if find(lines[i],r_first) then + first = i + 1 + break + end + end + end + end + if r_last then + if l then + if l < 0 then + l = noflines + l + end + if find(r_last,"^[%+]") then -- 1,+3 + l = first + l + end + if l < last then + last = l + end + else + for i=first,last do + if find(lines[i],r_last) then + last = i - 1 + break + end + end + end + end + return first, last +end + +local tablength = 7 + +local function dotabs(content,settings) + local tab = settings.tab + tab = tab and (tab == v_yes and tablength or tonumber(tab)) + if tab then + return tabtospace(content,tab) + else + return content + end +end + +local function filter(lines,settings) -- todo: inline or display in settings + local strip = settings.strip + if strip == v_yes then + lines = realign(lines,strip) + end + local line, n = 0, 0 + local first, last, m = getstrip(lines) + if range then + first, last = getrange(lines,first,last,range) + first, last = getstrip(lines,first,last) + end + -- \r is \endlinechar but \n would is more generic so this choice is debatable + local content = concat(lines,(settings.nature == "inline" and " ") or "\n",first,last) + return content, m +end + +-- main functions + +local getlines = buffers.getlines + +function commands.typebuffer(settings) + local lines = getlines(settings.name) + if lines then + local content, m = filter(lines,settings) + if content and content ~= "" then + content = dotabs(content,settings) + visualize(content,checkedsettings(settings,"display")) + end + end +end + +function commands.processbuffer(settings) + local lines = getlines(settings.name) + if lines then + local content, m = filter(lines,settings) + if content and content ~= "" then + content = dotabs(content,settings) + visualize(content,checkedsettings(settings,"direct")) + end + end +end + +-- not really buffers but it's closely related + +function commands.typestring(settings) + local content = settings.data + if content and content ~= "" then + -- content = dotabs(content,settings) + visualize(content,checkedsettings(settings,"inline")) + end +end + +function commands.typefile(settings) + local filename = settings.name + local foundname = resolvers.findtexfile(filename) + if foundname and foundname ~= "" then + local str = resolvers.loadtexfile(foundname) + if str and str ~= "" then + local regime = settings.regime + if regime and regime ~= "" then + str = regimes.translate(str,regime) + end + if str and str~= "" then + local lines = splitlines(str) + local content, m = filter(lines,settings) + if content and content ~= "" then + content = dotabs(content,settings) + visualize(content,checkedsettings(settings,"display")) + end + end + end + end +end diff --git a/Master/texmf-dist/tex/context/base/buff-ver.mkii b/Master/texmf-dist/tex/context/base/buff-ver.mkii index e7ad5474f37..3552961010f 100644 --- a/Master/texmf-dist/tex/context/base/buff-ver.mkii +++ b/Master/texmf-dist/tex/context/base/buff-ver.mkii @@ -626,7 +626,6 @@ {\let\currenttypingclass\??ty \initializetype \verbatimcolor - %\setcatcodetable \typcatcodesa \catcode`\{=\@@begingroup \catcode`\}=\@@endgroup} diff --git a/Master/texmf-dist/tex/context/base/buff-ver.mkiv b/Master/texmf-dist/tex/context/base/buff-ver.mkiv index dacbdb7ac99..c8f07ddb4b9 100644 --- a/Master/texmf-dist/tex/context/base/buff-ver.mkiv +++ b/Master/texmf-dist/tex/context/base/buff-ver.mkiv @@ -13,157 +13,148 @@ \writestatus{loading}{ConTeXt Buffer Macros / Verbatim} -%D We can optimize esp the initializations a bit. +\registerctxluafile{buff-ver}{1.001} \unprotect -\ifdefined\startlinenumbering\else \let\startlinenumbering \relax \fi -\ifdefined\stoplinenumbering \else \let\stoplinenumbering \relax \fi -\ifdefined\setuplinenumbering\else \unexpanded\def\setuplinenumbering[#1]{} \fi - -% D \macros -% D {iflinepar} -% D -% D A careful reader will see that \type{\linepar} is reset. -% D This boolean can be used to determine if the current line is -% D the first line in a pseudo paragraph and this boolean is set -% D after each empty line. The \type{\relax} can be used to -% D determine the end of the line when one implements a scanner -% D routine. -% -% will become obsolete - -\newif\iflinepar +\definesystemattribute[verbatimline][public] -% \type{ char} geeft bagger +\appendtoksonce \attribute\verbatimlineattribute \attributeunsetvalue \to \everyforgetall -%D We are going to embed the general verbatim support macros in -%D a proper environment. First we show the common setup -%D macro, so we know what features are supported. The options -%D are hooked into the support macros via the \type{\obey} -%D macros. +%D Initializations. -\newif\ifslantedtypeactivated -\newif\ifslantedtypepermitted +\newtoks\everyinitializeverbatim -\def\switchslantedtype - {\ifslantedtypepermitted - \ifslantedtypeactivated - \slantedtypeactivatedfalse\tttf - \else - \slantedtypeactivatedtrue\ttsl - \fi - \fi} +\appendtoks + \the\everyresettypesetting + \resetfontfeature + \resetcharacterspacing +\to \everyinitializeverbatim -\def\prettyidentifier {TEX} -\def\prettypalet {} - -\def\installprettytype - {\dodoubleargument\doinstallprettytype} - -\def\doinstallprettytype[#1][#2]% map #1 onto #2 - {\uppercasestring#1\to\asciia - \uppercasestring#2\to\asciib - \setevalue{\??ty\??ty\asciia}{\asciib}} - -\unexpanded\def\setupprettiesintype#1% - {\uppercasestring#1\to\ascii - \edef\prettyidentifier{\executeifdefined{\??ty\??ty\ascii}{TEX}}% - \begingroup - % we can move this to lua - % \lowercasestring \f!prettyprefix\prettyidentifier\to\filename - % \doonlyonce\filename{\ctxloadluafile\filename\empty}% - \ctxlua{buffers.loadvisualizer("\ascii")}% - \endgroup} - -\unexpanded\def\setupprettytype - {\processingverbatimtrue % will move - \ctxlua{buffers.visualizers.reset()}} - -\def\setverbatimspaceskip - {\setbox\scratchbox\hbox{x}% - \spaceskip\wd\scratchbox +\def\setverbatimspaceskip % to be checked: must happen after font switch + {\spaceskip\fontcharwd\font`x\relax \xspaceskip\spaceskip} -\let\obeycharacters\relax % tab mess can go +\unexpanded\def\specialcontrolspace{\hskip\zeropoint\fastcontrolspace\hskip\zeropoint} \setvalue{\??tp:\c!lines:\v!yes }{\obeybreakpoints} \setvalue{\??tp:\c!lines:\v!hyphenated}{\obeyhyphens} -%setvalue{\??tp:\c!empty:\v!yes }{\obeyemptylines} -%setvalue{\??tp:\c!empty:\v!all }{\obeyallemptylines} - -\setvalue{\??tp:\c!option:\v!none }{\let\obeycharacters\relax} -\setvalue{\??tp:\c!option:\empty }{\let\obeycharacters\relax} -\setvalue{\??tp:\c!option:\v!color }{\setupprettiesintype{\typingparameter\c!option}% - \let\obeycharacters\setupprettytype} -\setvalue{\??tp:\c!option:\v!normal }{\let\obeycharacters\setupgroupedtype} -\setvalue{\??tp:\c!option:\v!slanted }{\let\obeycharacters\setupslantedtype} -\setvalue{\??tp:\c!option:\s!unknown }{\setupprettiesintype{\typingparameter\c!option}% - \let\obeycharacters\setupprettytype} -%setvalue{\??tp:\c!option:\v!commands }{\def\obeycharacters{\setupcommandsintype}} - -\def\dosetverbatimfont - {\redoconvertfont\dosetfontattribute{\currenttypingclass\currenttyping}\c!style - \normalnoligatures\font} - -\unexpanded\def\setupcommonverbatim - {\let\prettyidentifier\s!default - % - \def\prettyidentifierfont{\typingparameter\c!icommand}% - \def\prettyvariablefont {\typingparameter\c!vcommand}% - \def\prettynaturalfont {\typingparameter\c!ccommand}% - % - \ignorehyphens % default - \getvalue{\??tp:\c!lines:\typingparameter\c!lines}% - \getvalue{\??tp:\c!empty:\typingparameter\c!empty}% - \getvalue{\??tp:\c!option:\ifcsname\??tp:\c!option:\typingparameter\c!option\endcsname\typingparameter\c!option\else\s!unknown\fi}% - \setupverbatimcolor} - -\newtoks \everyinitializeverbatim - -\def\ignorebeginofpretty [#1]{} -\def\ignoreendofpretty {} - -\def\doverbatimbop{\bgroup\beginofpretty} -\def\doverbatimeop{\endofpretty\egroup} -\def\doverbatimsop{\endofpretty\egroup\bgroup\beginofpretty} - -\let\noverbatimbop\ignorebeginofpretty -\let\noverbatimeop\ignoreendofpretty -\let\noverbatimsop\ignorebeginofpretty - -\def\doinitializeverbatim % todo: combine all in one call is faster - {\ctxlua{buffers.visualizers.reset()}% - \doifelse{\typingparameter\c!space}\v!on - {\let\obs\fastcontrolspace}% - {\let\obs\specialobeyedspace}% - \edef\askedverbatimtab{\typingparameter\c!tab}% - \doifelse\askedverbatimtab\v!no - {\ctxlua{buffers.settablength(1)}} - {\doifnumberelse{\askedverbatimtab} - {\ctxlua{buffers.settablength(\askedverbatimtab)}} - {\ctxlua{buffers.settablength()}}}% - \ctxlua{buffers.doifelsevisualizer("\prettyidentifier")} - {\ctxlua{buffers.setvisualizer("\prettyidentifier")}% - \let\bop\doverbatimbop - \let\eop\doverbatimeop - \let\sop\doverbatimsop}% - {\ctxlua{buffers.setvisualizer("\v!typing")}% or resetdefaultvisualizer - \let\bop\noverbatimbop - \let\eop\noverbatimeop - \let\sop\noverbatimsop}% +\setvalue{\??tp:\c!space:\v!on }{\let\obeyedspace\specialcontrolspace} +\setvalue{\??tp:\c!space:\v!stretch }{\let\obeyedspace\specialstretchedspace} +\setvalue{\??tp:\c!space:\v!normal }{} +\setvalue{\??tp:\c!space:\v!fixed }{\let\obeyedspace\specialfixedspace} + +\setvalue{\??tp:\c!blank:\v!standard }{\ctxparskip} +\setvalue{\??tp:\c!blank:\v!small }{\smallskipamount} +\setvalue{\??tp:\c!blank:\v!medium }{\medskipamount} +\setvalue{\??tp:\c!blank:\v!big }{\bigskipamount} +\setvalue{\??tp:\c!blank:\v!halfline }{.5\baselineskip} +\setvalue{\??tp:\c!blank:\v!line }{\baselineskip} +\setvalue{\??tp:\c!blank:\v!none }{\zeropoint} + +\def\secondstageinitializetype + {\let\obeyedspace\specialobeyedspace + \csname\??tp:\c!space:\typeparameter\c!space\endcsname \relax\the\everyinitializeverbatim\relax} +\def\secondstageinitializetyping + {\let\obeyedspace\specialobeyedspace + \csname\??tp:\c!space:\typingparameter\c!space\endcsname + \csname\??tp:\c!lines:\typingparameter\c!lines\endcsname + \relax\the\everyinitializeverbatim\relax} + +\def\firststageinitializetype + {\let\obeylines\ignorelines + \ignorehyphens % default + \dosettypeattributes\c!style\c!color + \setcatcodetable\vrbcatcodes} + +\let\doverbatimsetlinemargin\relax + +\def\dodoverbatimsetlinemargin + {\getpagestatus + \ifrightpage + \hskip\typingparameter\c!oddmargin\relax + \else + \hskip\typingparameter\c!evenmargin\relax + \fi} + +\def\docheckverbatimmargins + {\scratchskip\typingparameter\c!oddmargin\relax + \ifzeropt\scratchskip + \else + \let\doverbatimsetlinemargin\dodoverbatimsetlinemargin + \fi + \scratchskip\typingparameter\c!evenmargin\relax + \ifzeropt\scratchskip + \else + \let\doverbatimsetlinemargin\dodoverbatimsetlinemargin + \fi + \ifx\doverbatimsetlinemargin\relax + \doadaptleftskip{\typingparameter\c!margin}% + \fi} + +\def\firststageinitializetyping + {\switchtobodyfont[\typingparameter\c!bodyfont]% + \docheckverbatimmargins + \dosettypingattributes\c!style\c!color + \doifsomething{\typingparameter\c!align}{\setupalign[\typingparameter\c!align]}% + \ignorehyphens} % default + +%D \macros +%D {definetype,setuptype} +%D +%D Specific inline verbatim commands can be defined with the +%D following command. + +\installcommandhandler{\??ty}{type}{\??ty} + \appendtoks - \resetfontfeature - \resetcharacterspacing -\to \everyinitializeverbatim + \normalexpanded{\dodefinetype{\currenttype}}% +\to \everydefinetype -% BEWARE: the noligatures will globally change the verbatim font's behaviour +\unexpanded\def\dodefinetype#1% + {\setuvalue{#1}{\dotype{#1}}} + +\appendtoks + \doinitializevisualizer{\typeparameter\c!option}% +\to \everysetuptype + +%D \macros +%D {definetyping,setuptyping} +%D +%D For most users the standard \type{\start}||\type{\stop}||pair +%D will suffice, but for documentation purposes the next +%D definition command can be of use: +%D +%D \starttyping +%D \definetyping[extratyping][margin=3em] +%D +%D \startextratyping +%D these extra ones are indented by 1 em +%D \stopextratyping +%D \stoptyping +%D +%D The definitions default to the standard typing values. + +\installcommandhandler{\??tp}{typing}{\??tp} + +\appendtoks + \normalexpanded{\dodefinetyping{\currenttyping}}% +\to \everydefinetyping + +\unexpanded\def\dodefinetyping#1% + {\setvalue{\e!start#1}{\dostarttyping{#1}}% + \setvalue{\e!stop #1}{\dostoptyping {#1}}} + +\appendtoks + \doinitializevisualizer{\typingparameter\c!option}% we can check at the tex end +\to \everysetuptyping + +\def\doinitializevisualizer#1% + {\ifproductionrun\ctxlua{visualizers.load("#1")}\fi} -% test case: -% % \definetype[typeTEX][option=tex] % % \typeTEX|\example---oeps|. this---ligates---again. @@ -210,33 +201,9 @@ %D %D \typebuffer \start \getbuffer \stop -\unexpanded\def\setupcommandsintype - {\ctxlua{buffers.set_escape("\currenttyping",\!!bs\typingparameter\c!escape\!!es)}} - -\appendtoks - \setupcommandsintype -\to \everyinitializeverbatim - -\unexpanded\def\setupslantedtype - {\slantedtypepermittedtrue} - -\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 -%D history. Most users of \CONTEXT\ probably will never use -%D some of the features, but I've kept in mind that when one is -%D writing a users manual, about everything can and undoubtly -%D will be subject to a verbatim treatment. -%D %D Verbatim command are very sensitive to argument processing, %D which is a direct result of the \CATCODES\ being fixed at -%D reading time. With our growing understanding of \TEX, -%D especially of the mechanism that can be used for looking -%D ahead and manipulating \CATCODES, the verbatim support -%D became more and more advanced and natural. +%D reading time. %D %D Typesetting inline verbatim can be accomplished by %D \type{\type}, which in this sentence was typeset by saying @@ -253,14 +220,11 @@ %D \type{<<} and \type{>>} as delimiters. This alternative can %D be used in situations where slanted typeseting is needed. -% todo: we can use \letter... here: - \def\lesscharacter {<} \def\morecharacter {>} - -\chardef\texescape = `\\ -\chardef\leftargument = `\{ -\chardef\rightargument = `\} +\let\texescape \textbackslash +\let\leftargument \textbraceleft +\let\rightargument \textbraceright %D \macros %D {type} @@ -268,17 +232,17 @@ %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 -% normal: \par \type{xx<..xx.. >..>xx} \par \type{<....>} \par \type{<....>} -% \setuptype[option=slanted] -% slanted: \par \type{xx<<..sl..<> xx>>..sl..>>xx} \par \type<<..xx..>> \par \type<<..<>..>> \par -% slanted: \par \type{xx<<..sl.. xx>..sl..>>xx} \par \type<<..xx..>> \par \type<<....>> \par -% \setuptype[option=none] -% none: \par \type{xx<<..xx..<> >>..>>xx} \par \type<<....>> \par \type<<..<>..>> \par -% \stoptyping - +%D +%D \starttyping +%D normal: \par \type{xx<<..xx..<> >>..>>xx} \par \type<<....>> \par \type<<..<>..>> \par +%D normal: \par \type{xx<..xx.. >..>xx} \par \type{<....>} \par \type{<....>} +%D \setuptype[option=slanted] +%D slanted: \par \type{xx<<..sl..<> xx>>..sl..>>xx} \par \type<<..xx..>> \par \type<<..<>..>> \par +%D slanted: \par \type{xx<<..sl.. xx>..sl..>>xx} \par \type<<..xx..>> \par \type<<....>> \par +%D \setuptype[option=none] +%D none: \par \type{xx<<..xx..<> >>..>>xx} \par \type<<....>> \par \type<<..<>..>> \par +%D \stoptyping +%D %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 @@ -287,7 +251,7 @@ %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 %D The following lines show what happens when we set %D \type {option=commands}. %D @@ -306,120 +270,110 @@ %D %D \typebuffer +% beware, the command is supposed to do something like +% \framed and not manipulate content i.e. it gets no +% argument but something b/egrouped instead +% +% so, if we only had left and right it woul dbe: +% +% \def\doleftoftype {\typeparameter\c!left\bgroup} % we need the grouping in order +% \def\dorightoftype{\egroup\typeparameter\c!right} % to get the normal font +% +% but with command: + +\def\doleftoftype {\typeparameter\c!left\typeparameter\c!command\bgroup} +\def\dorightoftype{\egroup\typeparameter\c!right} + \unexpanded\def\type{\dotype\empty} +\unexpanded\def\typ {\dotyp \empty} -\def\dotype#1% was \dotype - {\dontleavehmode \bgroup - % new, \strut enables leading space in \type { abc } at par start / begstrut - % else no hyphenation (replaced by \dontleavehmode which saves unboxing) - % \begstrut - \let\currenttypingclass\??ty - \edef\currenttyping{#1}% - \catcode`\<=\@@other - \catcode`\>=\@@other - \futurelet\next\dodotype} +\def\dotype#1% + {\dontleavehmode + \bgroup + \edef\currenttype{#1}% + \doifnextoptionalelse\redotype\dodotype} + +\def\redotype[#1]% + {\getparameters[\??ty\currenttype][#1]% + \dodotype} \def\dodotype + {\doleftoftype + \futurelet\next\dodotypeone} + +\def\dotyp#1% + {\dontleavehmode + \bgroup + \edef\currenttype{#1}% + \lettypeparameter\v!lines\v!hyphenated + \let\specialobeyedspace\specialstretchedspace + \doifnextoptionalelse\redotype\dodotype} + +\def\dodotypeone {\ifx\next\bgroup \@EA\dodotypeA \else - \@EA\dodotypeAD + \@EA\dodotypetwo \fi} -\def\dodotypeAD +\def\dodotypetwo + {\catcode`<=\othercatcode % old precaution + \catcode`>=\othercatcode % old precaution + \futurelet\next\dodotypethree} + +\def\dodotypethree {\if\next<% - \doifelse{\typingparameter\c!option}\v!none{\@EA\dodotypeB}{\@EA\dodotypeC}% + \@EA\dodotypeB \else - \@EA\dodotypeD + \@EA\dodotypeC \fi} \def\dodotypeA - {\initializetype % probably too much - \verbatimcolor - \dosetverbatimfont - \setcatcodetable \typcatcodesa - \dodotypeAA} - -\def\dodotypeAA#1% - {\doinitializeverbatim - \def\obs{\obeyedspace}% - \ctxlua{buffers.hooks.flush_inline(\!!bs\detokenize{#1}\!!es)}% - \egroup} + {\firststageinitializetype + \setcatcodetable\tpacatcodes + \dodotypenormal} \def\dodotypeB#1% - {\initializetype - \verbatimcolor - \dosetverbatimfont - \setcatcodetable \typcatcodesb - \dodotypeBB} - -\def\dodotypeBB#1% - {\doinitializeverbatim - \ctxlua{buffers.visualizers.flush_nested(\!!bs\detokenize{#1}\!!es,false)}% - \egroup - \gobbleoneargument} % grab last > + {\firststageinitializetype + \setcatcodetable\tpbcatcodes + \dodotypenested} \def\dodotypeC#1% - {\initializetype - \verbatimcolor - \dosetverbatimfont - \setcatcodetable \typcatcodesb - \dodotypeCC} - -\def\dodotypeCC#1% - {\doinitializeverbatim - \ifx\obeycharacters\setupprettytype % temp hack, we need a proper signal - \ctxlua{buffers.hooks.flush_inline([\!!bs\detokenize{#1}\!!es,true)}% - \else - \def\obs{\obeyedspace}% - \ctxlua{buffers.visualizers.flush_nested(\!!bs\detokenize{#1}\!!es,true)}% - \fi - \egroup - \gobbleoneargument} % grab last > + {\firststageinitializetype + \setcatcodetable\vrbcatcodes + \def\next##1#1{\dodotypenormal{##1}}% + \next} + +\def\dodotypenormal#1% + {\secondstageinitializetype + \dostarttagged\t!verbatim\currenttype + \ctxcommand{typestring { + data = \!!bs\detokenize{#1}\!!es, + tab = "\typeparameter\c!tab", + method = "\typeparameter\c!option", + nature = "inline", + }}% + \dostoptagged + \dorightoftype + \egroup} -\def\dodotypeD#1% - {\initializetype - \verbatimcolor - \dosetverbatimfont - \setcatcodetable \typcatcodesa - \def\dodotypeDD##1#1{\dodotypeAA{##1}}% - \dodotypeDD} - -\def\dodotypeDD#1% - {\doinitializeverbatim - \ctxlua{buffers.hooks.flush_inline(\!!bs\detokenize{#1}\!!es,true)}% +\def\dodotypenested#1% + {\secondstageinitializetype + \dostarttagged\t!verbatim\currenttype + \ctxcommand{typestring { + data = \!!bs\detokenize{#1}\!!es, + tab = "\typeparameter\c!tab", + method = "nested", % we force a special visualizer + option = "\typeparameter\c!option", % extra visualizer (maybe: nested,\typeparameter\c!option) + nature = "inline", + }}% + \dostoptagged + \dorightoftype \egroup \gobbleoneargument} % grab last > -%D The neccessary initializations are done by calling -%D \type{\initializetype} which in return calls for the support -%D macro \type{\setupinlineverbatim}. - -\def\initializetype - {\let\obeylines\ignorelines - \setupcommonverbatim - %\dosetverbatimfont - %\setverbatimspaceskip - %\setupcopyverbatim % not needed - \setcatcodetable\vrbcatcodes} - -%D \macros -%D {setuptype} -%D -%D Some characteristics of \type{\type} can be set up by: - -\unexpanded\def\setuptype - {\dodoubleempty\dosetuptype} - -\def\dosetuptype[#1][#2]% - {\ifsecondargument - \getparameters[\??ty#1][#2]% - \else - \getparameters[\??ty][#1]% - \fi} - %D \macros -%D {typ,obeyhyphens,obeybreakpoints} +%D {obeyhyphens,obeybreakpoints} %D %D Although it's not clear from the macros, one character %D trait of this macros, which are build on top of the support @@ -428,11 +382,13 @@ %D works all right, but a decent hyphenation support of %D \type{\tt} text will be implemented soon. -\def\specialobeyedspace {\hskip\interwordspace\relax} % better than spaceskip -\def\specialcontrolspace{\hskip\zeropoint\hbox{\normalcontrolspace}\hskip\zeropoint\relax} +\def\specialfixedspace {\kern\interwordspace\relax} +\def\specialobeyedspace {\hskip\interwordspace\relax} % better than spaceskip +\def\specialstretchedspace{\hskip.5\interwordspace\!!plus.125\interwordstretch\relax} % more but not less +\def\specialcontrolspace {\hskip\zeropoint\hbox{\normalcontrolspace}\hskip\zeropoint\relax} \def\obeyhyphens - {\let\obeyedspace \specialobeyedspace + {\let\obeyedspace \specialobeyedspace % maybe \specialstretchedspace \let\controlspace\specialcontrolspace \spaceskip.25em\relax} % hm a bit of stretch ! @@ -446,11 +402,6 @@ \let\controlspace\specialcontrolspace \spaceskip.5em\relax} -\unexpanded\def\typ - {\bgroup - \let\@@tylines\v!hyphenated - \futurelet\next\dodotype} - %D \macros %D {tex,arg,mat,dis} %D @@ -461,38 +412,11 @@ %D but we've decided not to use that slow and sometimes %D troublesome solution. Instead we stick to some 'old' %D \CONTEXT\ macros for typesetting typical \TEX\ characters. -%D -%D The next implementation is more clear but less versatile, -%D so we treated it for a beter one. -%D -%D \starttyping -%D \def\dospecialtype#1#2% -%D {\bgroup -%D \initializetype -%D \catcode`\{=\@@begingroup -%D \catcode`\}=\@@endgroup -%D \def\dospecialtype% -%D {\def\dospecialtype{#2\egroup}% -%D \bgroup -%D \aftergroup\dospecialtype -%D #1}% -%D \afterassignment\dospecialtype -%D \let\next=} -%D -%D \unexpanded\def\tex{\dospecialtype\texescape\relax} -%D \unexpanded\def\arg{\dospecialtype\leftargument\rightargument} -%D \unexpanded\def\mat{\dospecialtype\$\$} -%D \unexpanded\def\dis{\dospecialtype{\$\$}{\$\$}} -%D \stoptyping \def\setgroupedtype - {\let\currenttypingclass\??ty - \initializetype - \verbatimcolor - \dosetverbatimfont - %\setcatcodetable \typcatcodesa - \catcode`\{=\@@begingroup - \catcode`\}=\@@endgroup} + {\firststageinitializetype + \catcode\leftbraceasciicode \begingroupcatcode + \catcode\rightbraceasciicode\endgroupcatcode} \unexpanded\def\tex{\groupedcommand{\setgroupedtype\texescape}{\relax}} \unexpanded\def\arg{\groupedcommand{\setgroupedtype\leftargument}{\rightargument}} @@ -504,118 +428,17 @@ \let\normaltextmat\mat \let\normaltextdis\dis -\def\astype - {\groupedcommand\dorawtype\relax} - -\def\dorawtype - {\let\currenttypingclass\??ty - \normalverbatimcolor % \verbatimcolor - \dosetverbatimfont} - -%D \macros -%D {starttyping} -%D -%D Display verbatim is realized far more easy, which is mostly -%D due to the fact that we use \type{\stop...} as delimiter. -%D The implementation inherits some features, for instance the -%D support of linenumbering, which can best be studied in the -%D documented support module. - -\let\currenttyping \empty -\let\currenttypingclass\??ty % saveguard - -\def\typingparameter#1% - {\ifcsname\currenttypingclass\currenttyping#1\endcsname - \csname\currenttypingclass\currenttyping#1\endcsname - \else\ifcsname\currenttypingclass#1\endcsname - \csname\currenttypingclass#1\endcsname - \fi\fi} - -\def\settypingparameter#1#2% - {\setvalue{\currenttypingclass\currenttyping#1}{#2}} - -\def\setxtypingparameter#1#2% - {\setxvalue{\currenttypingclass\currenttyping#1}{#2}} - -\setvalue{\??tp:\c!blank:\v!standard}{\ctxparskip} -\setvalue{\??tp:\c!blank:\v!small }{\smallskipamount} -\setvalue{\??tp:\c!blank:\v!medium }{\medskipamount} -\setvalue{\??tp:\c!blank:\v!big }{\bigskipamount} -\setvalue{\??tp:\c!blank:\v!halfline}{.5\baselineskip} -\setvalue{\??tp:\c!blank:\v!line }{\baselineskip} -\setvalue{\??tp:\c!blank:\v!none }{\zeropoint} - -\def\doopenupverbatimlineindeed - {\getpagestatus - \ifrightpage - \hskip\typingparameter\c!oddmargin\relax - \else - \hskip\typingparameter\c!evenmargin\relax - \fi} - -\def\initializetyping - {%\donefalse - \switchtobodyfont[\typingparameter\c!bodyfont]% - \donefalse - \scratchskip\typingparameter\c!oddmargin\relax - \ifzeropt\scratchskip\else\donetrue\fi - \scratchskip\typingparameter\c!evenmargin\relax - \ifzeropt\scratchskip\else\donetrue\fi - \ifdone - \let\doopenupverbatimline\doopenupverbatimlineindeed - \else - \doadaptleftskip{\typingparameter\c!margin}% - \fi - % no symbolic blanks ! - \edef\!!stringa{\executeifdefined{\??bo\typingparameter\c!blank}{\typingparameter\c!blank}}% - \scratchskip\executeifdefined{\??tp:\c!blank:\!!stringa}\!!stringa\relax - \ifgridsnapping - % this will be adapted - \ifdim\scratchskip=.5\baselineskip\relax - \edef\verbatimbaselineskip{\the\scratchskip}% new - \else - \edef\verbatimbaselineskip{\the\baselineskip}% - \fi - \else - \edef\verbatimbaselineskip{\the\scratchskip}% - \fi -\doifsomething{\typingparameter\c!align}{\setupalign[\typingparameter\c!align]}% - \setupcommonverbatim} +\def\astype{\groupedcommand{\dosettypeattributes\c!style\c!color}{}} %D The basic display verbatim commands are defined in an %D indirect way. As we will see, they are a specific case of a %D more general mechanism. -\newif\ifoptimizeverbatim \optimizeverbatimtrue - -\let \beginofverbatimlines \relax -\let \endofverbatimlines \relax - -\def\doverbatimnobreak - {\ifoptimizeverbatim\penalty500 \fi} - -\def\doverbatimgoodbreak - {\ifoptimizeverbatim\penalty\linepenalty\fi} - -% \def\doflushverbatimline -% {\expandafter\dodoverbatimline\expandafter{\savedverbatimline}} -% \def\doverbatimbeginofline#1% linenumber (optional provided by mkiv / todo) -% {\dontleavehmode -% \strut -% \the\everyline} -% \def\doverbatimendofline -% {\par} -% \def\doverbatimemptyline -% {\strut -% \par} -% \let\handleverbatimline=\relax - -% we need this hack because otherwise verbatim skips -% the first line (everything after the initial command) +\let\beginofverbatimlines\relax +\let\endofverbatimlines \relax \def\dostarttyping#1% tricky non standard lookahead {\bgroup - \let\currenttypingclass\??tp \edef\currenttyping{#1}% \obeylines \futurelet\nexttoken\dodostarttyping} @@ -630,36 +453,40 @@ \def\nododostarttyping {\dododostarttyping[]} -\def\dotypefileverbatim - {\doinitializeverbatim - \beginofverbatimlines - \ctxlua{buffers.typefile("\readfilename","\typingparameter\c!strip","\typingparameter\c!range")}% - \endofverbatimlines} - -\def\dotypefilelinesverbatim#1#2% - {#1\dotypefileverbatim#2} +\def\dododostarttyping[#1]% + {\typingparameter\c!before + \startpacked[\v!blank] + \doifassignmentelse{#1} + {\setuptyping[\currenttyping][#1]} + {\doifinset\v!continue{#1}{\setuptyping[\currenttyping][\c!continue=\v!yes]}}% + \dosetuptypelinenumbering + \firststageinitializetyping + \normalexpanded{\dotypeblockverbatim{\e!start\currenttyping}{\e!stop\currenttyping}}} \unexpanded\def\dotypeblockverbatim#1#2% - {\dowithbuffer{_typing_}{#1}{#2} - {} - {\doinitializeverbatim - \beginofverbatimlines - \ctxlua{buffers.type("_typing_","\typingparameter\c!strip","\typingparameter\c!range")}% - \endofverbatimlines - \csname#2\endcsname}} + {\dowithbuffer{_typing_}{#1}{#2}{}{\dodotypeblockverbatim{#1}{#2}}} -\def\dododostarttyping[#1]% - {\typingparameter\c!before - \startpacked % includes \bgroup - \dosetuptypelinenumbering{#1}% - \initializetyping - \dosetverbatimfont - \startverbatimcolor - \normalexpanded{\dotypeblockverbatim{\e!start\currenttyping}{\e!stop\currenttyping}}} % was s!start +\def\dodotypeblockverbatim#1#2% + {\secondstageinitializetyping + \dostarttagged\t!verbatimblock\currenttyping + \beginofverbatimlines + \dostarttagged\t!verbatimlines\empty + \ctxcommand{typebuffer { + name = "_typing_", + strip = "\typingparameter\c!strip", + range = "\typingparameter\c!range", + tab = "\typingparameter\c!tab", + method = "\typingparameter\c!option", + escape = \!!bs\typingparameter\c!escape\!!es, + nature = "display", + }}% + \dostoptagged + \endofverbatimlines + \dostoptagged + \csname#2\endcsname} \def\dostoptyping#1% hm, currenttyping - {\stopverbatimcolor - \stoppacked % includes \egroup + {\stoppacked \typingparameter\c!after \normalexpanded{\egroup\checknextindentation[\typingparameter\c!indentnext]}% \dorechecknextindentation} @@ -700,8 +527,7 @@ %D %D \starttext %D -%D % \typefile[file][range={3,6}]{whatever.tex} -%D +%D % \typefile[file][range={3,6}] {whatever.tex} %D % \typefile[file][range={3,+2}]{whatever.tex} %D %D \typefile[file][range={label:start:one,label:stop:one}]{whatever.tex} @@ -709,128 +535,6 @@ %D \stoptext %D \stoptyping -%D \macros -%D {setuptyping} -%D -%D The setup of typing accepts two arguments. The optional -%D first one identifies the user defined ones. If only one -%D argument is given, the values apply to both the standard -%D command \type{\starttyping} and \type{\typefile}. - -\def\dosetuptyping[#1][#2]% - {\ifsecondargument - \getparameters[\??tp#1][#2]% - \else - \getparameters[\??tp][#1]% - \fi} - -\unexpanded\def\setuptyping - {\dodoubleempty\dosetuptyping} - -%D \macros -%D {definetype} -%D -%D Specific inline verbatim commands can be defined with the -%D following command. - -\unexpanded\def\definetype - {\dodoubleempty\dodefinetype} - -\def\dodefinetype[#1][#2]% - {\setuvalue{#1}{\dotype{#1}}% - \getparameters[\??ty#1][#2]} - -%D \macros -%D {definetyping} -%D -%D For most users the standard \type{\start}||\type{\stop}||pair -%D will suffice, but for documentation purposes the next -%D definition command can be of use: -%D -%D \starttyping -%D \definetyping[extratyping][margin=3em] -%D -%D \startextratyping -%D these extra ones are indented by 1 em -%D \stopextratyping -%D \stoptyping -%D -%D The definitions default to the standard typing values. - -% TODO: parent etc ! - -\def\presettyping[#1][#2]% brrr also use parent here - {\copyparameters[\??tp#1][\??tp][\c!color,\c!style]% - \getparameters [\??tp#1][#2]} - -\def\dodefinetyping[#1][#2]% - {\setvalue{\e!start#1}{\dostarttyping{#1}}% - \setvalue{\e!stop #1}{\dostoptyping {#1}}% - \presettyping[#1][#2]} - -\unexpanded\def\definetyping - {\dodoubleempty\dodefinetyping} - -%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. -%D -%D \starttyping -%D \unexpanded\def\setupverbatimcolor% -%D {\edef\prettypalet{\prettyidentifier\typingparameter\c!palet}% -%D \def\beginofpretty[##1]{\startcolormode{\prettypalet:##1}}% -%D \def\endofpretty {\stopcolormode}} -%D \stoptyping -%D -%D Since we support a global color too, the folowing -%D definition is better: - -\def\normalbeginofpretty [#1]{\startcolor[\prettypalet:#1]}% -\def\normalendofpretty {\stopcolor} -\def\normalstartverbatimcolor{\startcolor[\typingparameter\c!color]}% -\def\normalstopverbatimcolor {\stopcolor} -\def\normalverbatimcolor {\getvalue{\typingparameter\c!color}}% command ! - -\unexpanded\def\setupnormalprettyverbatim - {\edef\prettypalet{\prettyidentifier\prettypalet}% - \let\beginofpretty \normalbeginofpretty - \let\endofpretty \normalendofpretty - \let\startverbatimcolor\normalstartverbatimcolor - \let\stopverbatimcolor \normalstopverbatimcolor - \let\verbatimcolor \normalverbatimcolor} - -\unexpanded\def\setupignoreprettyverbatim - {\let\prettypalet \empty - \let\beginofpretty \ignorebeginofpretty - \let\endofpretty \ignoreendofpretty - \let\startverbatimcolor\normalstartverbatimcolor - \let\stopverbatimcolor \normalstopverbatimcolor - \let\verbatimcolor \normalverbatimcolor} - -\unexpanded\def\setupverbatimcolor - {\edef\prettypalet{\typingparameter\c!palet}% - \ifx\prettypalet\empty - \setupignoreprettyverbatim - \else - \setupnormalprettyverbatim - \fi} - -\let\beginofpretty \ignorebeginofpretty -\let\endofpretty \ignoreendofpretty -\let\prettypalet \empty -\let\startverbatimcolor\relax -\let\stopverbatimcolor \relax -\let\verbatimcolor \relax - -%D \macros -%D {EveryPar, EveryLine, iflinepar} -%D -%D One of the features of these commands is the support of -%D \type{\EveryPar}, \type{\EveryLine} and \type{\iflinepar}. -%D In the documentation of the verbatim support module we give -%D some examples of line- and paragraph numbering using these -%D macros. - %D \macros %D {typefile} %D @@ -839,118 +543,95 @@ %D setup values are inherited from display verbatim. %D The implementation of \type{\typefile} is straightforward: -% new feature (not yet 100\% ok) -% -% \setuptyping[file][numbering=file] -% -% \typefile[start=2,nlines=3]{zapf} -% \typefile[start=continue,nlines=13]{zapf} -% \typefile{zapf} -% -% \setuptyping[file][numbering=line] -% -% \typefile[start=4,step=3]{zapf} -% \typefile{zapf} +% [category] [settings] {name} % for historic reasons, all filenames are {} \def\typefile {\dodoubleempty\dotypefile} \def\dotypefile[#1][#2]#3% - {\ifsecondargument - \dodotypefile[#1][#2]{#3}% + {\bgroup + \ifsecondargument + \setuptyping[#1][#2]% + \dododotypefile{#1}{#3}% \else\iffirstargument \doifassignmentelse{#1} - {\dodotypefile[\v!file][#1]{#3}} - {\dodotypefile[#1][]{#3}}% + {\setuptyping[\v!file][#1] + \dododotypefile\v!file{#3}} + {\dododotypefile{#1}{#3}}% \else - \dodotypefile[\v!file][]{#3}% - \fi\fi} - -\def\dosetuptypelinenumbering#1% fuzzy - {%\ifcsname\currenttypingclass\currenttyping\c!start\endcsname \else - % \setuptyping[\currenttyping][\c!start=1,\c!stop=,\c!step=1,\c!continue=\v!no,\c!nlines=]% - %\fi - \doifassignmentelse{#1}{\setuptyping[\currenttyping][#1]}\donothing - \doifelse{\typingparameter\c!numbering}\v!file - {% kind of special: filters lines ! - \setuplinenumbering[\currenttyping][\c!method=\v!file]% - \donetrue} - {\doifelse{\typingparameter\c!numbering}\v!line - {\doifinset\v!continue{#1}{\setuptyping[\currenttyping][\c!continue=\v!yes]}% fails: \settypingparameter\c!continue{\v!yes} - \donetrue} - {\donefalse}}% - \ifdone - \edef\beginofverbatimlines{\noexpand\startlinenumbering - [\currenttyping]% - [\c!continue=\typingparameter\c!continue, - \c!method=\v!type, - \c!start=\typingparameter\c!start, - \c!stop=\typingparameter\c!stop, % ? - \c!step=\typingparameter\c!step]% - }% - \def\endofverbatimlines{\stoplinenumbering}% - \fi} - -\def\reporttypingerror#1% temp hack - {\blank - \dontleavehmode\hbox\bgroup - \expanded{\defconvertedargument\noexpand\ascii{#1}}% - \tttf[\makemessage\m!verbatims1\ascii]% - \showmessage\m!verbatims1\ascii - \egroup - \blank} - -\def\dosometyping#1#2#3#4#5% - {\bgroup - \let\currenttypingclass\??tp - \edef\currenttyping{#1}% - \typingparameter\c!before - \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 - \dosetverbatimfont - \startverbatimcolor - \scratchcounter - \ifcsname\currenttypingclass#3\v!global\c!start\endcsname - \numexpr\csname\currenttypingclass#3\v!global\c!start\endcsname+\plusone\relax - \else - \plusone - \fi - \setxvalue{\currenttypingclass#3\v!global\c!start}{\the\scratchcounter}% no direct setxvalue as it defines beforehand - \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 + \dododotypefile\v!file{#3}% + \fi\fi \egroup} +\def\dododotypefile#1#2% + {\doifelsetypingfile{#2} + {\dodododotypefile{#1}\readfilename} + {\showmessage\m!verbatims1{#2}}} + \def\doifelsetypingfile#1% sets \readfilename (we will make this proper mkiv i.e. less messy) {\doiflocfileelse{#1} {\firstoftwoarguments} {\doifinputfileelse{#1} -% {\def\readfilename{\pathplusfile\filepath{#1}}\firstoftwoarguments} % messy, looks wrong too {\def\readfilename{#1}\firstoftwoarguments} % messy, looks wrong too {\secondoftwoarguments}}} -\def\dodotypefile[#1][#2]#3% - {\doifelsetypingfile{#3} - {\dosometyping{#1}{#2}{#3}\dotypefileverbatim\dotypefilelinesverbatim} - {\reporttypingerror{#3}}} +\def\dodododotypefile#1#2% category name + {\edef\currenttyping{#1}% + \typingparameter\c!before + \startpacked[\v!blank] + \dosetuptypelinenumbering + \firststageinitializetyping + \secondstageinitializetyping + \dostarttagged\t!verbatimblock\currenttyping + \beginofverbatimlines + \dostarttagged\t!verbatimlines\empty + \ctxcommand{typefile { + name = "#2", + strip = "\typingparameter\c!strip", + range = "\typingparameter\c!range", + regime = "\currentregime", + tab = "\typingparameter\c!tab", + method = "\typingparameter\c!option", + nature = "display", + }}% + \dostoptagged + \endofverbatimlines + \dostoptagged + \stoppacked + \typingparameter\c!after} + +%D Line numbering: + +\newconditional\verbatimnumberinglines + +\def\beginofverbatimlinenumbering + {\startlinenumbering + [\currenttyping]% + [\c!continue=\typingparameter\c!continue, + \c!method=\v!type, + \c!start=\typingparameter\c!start, + \c!stop=\typingparameter\c!stop, % ? + \c!step=\typingparameter\c!step]} + +\def\endofverbatimlinenumbering + {\stoplinenumbering} + +\def\dosetuptypelinenumbering + {\ifdefined\startlinenumbering + \edef\currenttypingnumbering{\typingparameter\c!numbering}% + \ifx\currenttypingnumbering\v!file + \setuplinenumbering[\currenttyping][\c!method=\v!file]% + \settrue\verbatimnumberinglines + \else\ifx\currenttypingnumbering\v!line + \settrue\verbatimnumberinglines + \else + \setfalse\verbatimnumberinglines + \fi\fi + \ifconditional\verbatimnumberinglines + \let\beginofverbatimlines\beginofverbatimlinenumbering + \let\endofverbatimlines \endofverbatimlinenumbering + \fi + \fi} %D \macros %D {filename} @@ -965,9 +646,12 @@ \unexpanded\def\filename#1{{\tttf\hyphenatedfilename{#1}}} -%D And a bonus macro: +%D \macros +%D {verbatim} +%d +%D And a bonus macro, an unexpanded detokenize: -\def\verbatim#1{\defconvertedargument\ascii{#1}\ascii} +\unexpanded\def\verbatim#1{\detokenize{#1}} %D The setups for display verbatim and file verbatim are %D shared. One can adapt the extra defined typing environments, @@ -977,217 +661,191 @@ \setuptyping [ \c!before=\blank, \c!after=\blank, - \c!bodyfont=, - \c!color=, + %\c!bodyfont=, + %\c!color=, \c!space=\v!off, \c!page=\v!no, - \c!tab=\s!ascii, + \c!tab=\v!yes, % what is this: \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=, % yes | no | START,STOP BTEX,ETEX + %\c!escape=, % yes | no | {START,STOP} | default when yes: {BTEX,ETEX} \c!numbering=\v!no, - \c!lines=, - \c!range=, - \c!empty=, + %\c!lines=, + %\c!range=, \c!start=1, - \c!stop=, + %\c!stop=, \c!step=1, - \c!continue=, - \c!strip=\v!no, % auto or number - \c!nlines=] + %\c!continue=, + \c!strip=\v!no] %auto or number \definetyping[\v!typing] -\presettyping[\v!file][] - -% \setuptyping % not needed -% [\v!file] -% [\c!start=1, -% \c!stop=, -% \c!step=1, -% \c!continue=, -% \c!nlines=] +\setuptyping[\v!file] [\s!parent=\??tp\v!typing] % we don't want \start..\stop overload +\setuptyping[\v!buffer][\s!parent=\??tp\v!file] % we don't want \start..\stop overload %D The setups for inline verbatim default to: \setuptype [ \c!space=\v!off, - \c!color=, + %\c!color=, \c!style=\tt\tf, % \tttf gives problems with {\tx \type...} + %\c!option=\v!normal, \c!page=\v!no, - \c!tab=\v!yes, - \c!palet=colorpretty, - \c!option=\v!normal] - -%D Beware: only a few are currently (re)implemented in \MKIV. - -\definetyping[RAW] [\c!option=RAW] -\definetyping[MP] [\c!option=MP] % done -\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] % done -\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] % done - -\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] - -%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] - -% patched from verb-ini (todo) - -% \let\beginverbatimline\relax -% \let\endverbatimline \relax - -% \appendtoks whatever\par\to\everyverbatimbeginofdisplay -% \appendtoks whatever\to\everyverbatimendofdisplay -% \appendtoks [\to\everyverbatimbeginofinline -% \appendtoks ]\to\everyverbatimendofinline - -\let\doopenupverbatimline\empty - -\newtoks\everyverbatimbeginofdisplay -\newtoks\everyverbatimendofdisplay -\newtoks\everyverbatimbeginofinline -\newtoks\everyverbatimendofinline - -\let\currentverbatimpretty\empty - -\def\doverbatimbeginofdisplay#1% - {\edef\currentverbatimpretty{#1}% - \the\everyverbatimbeginofdisplay} - -\def\doverbatimendofdisplay - {\the\everyverbatimendofdisplay} - -\def\doverbatimbeginofinline#1% - {\edef\currentverbatimpretty{#1}% - \the\everyverbatimbeginofinline} - -\def\doverbatimendofinline - {\the\everyverbatimendofinline} - -\def\doverbatimbeginofline#1% linenumber - {\bgroup % due to pretty status - \iflinepar\else\EveryPar{}\fi - \noindent % was wrong: \dontleavehmode - \xdef\dokeepverbatimlinedata % hm, still needed? - {\parindent \the\parindent - \hangindent\the\hangindent - \hangafter \the\hangafter - \leftskip \the\leftskip - \rightskip \the\rightskip}% - \egroup - \dokeepverbatimlinedata - \doopenupverbatimline + \c!tab=\v!yes] + +%D Buffers + +% [name] [settings] | [name] | [settings] + +\unexpanded\def\typebuffer + {\dodoubleempty\dotypebuffer} + +\unexpanded\def\dotypedefinedbuffer + {\dotripleempty\dodotypedefinedbuffer} + +\appendtoks + \setuevalue{\e!type\currentbuffer}% + {\noexpand\dotypedefinedbuffer + [\v!buffer]% + [def-\number\nofdefinedbuffers]}% +\to \everydefinebuffer + +\def\dotypebuffer[#1][#2]% + {\bgroup + \ifsecondargument + \setuptyping[\v!buffer][#2]% + \processcommalist[#1]{\dododotypebuffer\v!buffer}% [name] [settings] + \else\iffirstargument + \doifassignmentelse{#1} + {\setuptyping[\v!buffer][#1]% + \dododotypebuffer\v!buffer\empty}% [settings] + {\processcommalist[#1]{\dododotypebuffer\v!buffer}}% [name] + \else + \dododotypebuffer\v!buffer\empty% [] + \fi\fi + \egroup} + +\def\dodotypedefinedbuffer[#1][#2][#3]% category name settings + {\bgroup + \ifthirdargument + \setuptyping[#1][#3]% + \fi + \dododotypebuffer{#1}{#2}% + \egroup} + +\def\dododotypebuffer#1#2% category name + {\edef\currenttyping{#1}% + \typingparameter\c!before + \startpacked[\v!blank] + \dosetuptypelinenumbering + \firststageinitializetyping + \secondstageinitializetyping + \beginofverbatimlines + \dostarttagged\t!verbatimblock{#1}% + \ctxcommand{typebuffer { + name = "#2", + strip = "\typingparameter\c!strip", + range = "\typingparameter\c!range", + regime = "\currentregime", + tab = "\typingparameter\c!tab", + method = "\typingparameter\c!option", + escape = \!!bs\typingparameter\c!escape\!!es, + nature = "display", + }}% + \dostoptagged + \endofverbatimlines + \stoppacked + \typingparameter\c!after} + +% process buffers .. settings + +\unexpanded\def\processbuffer + {\dodoubleempty\doprocessbuffer} + +\def\doprocessbuffer[#1][#2]% + {\bgroup + \ifsecondargument + \setuptyping[\v!buffer][#2]% + \processcommalist[#1]{\dodoprocessbuffer\v!buffer}% [name] [settings] + \else\iffirstargument + \doifassignmentelse{#1} + {\setuptyping[\v!buffer][#1]% + \dodoprocessbuffer\v!buffer\empty}% [settings] + {\processcommalist[#1]{\dodoprocessbuffer\v!buffer}}% [name] + \else + \dodoprocessbuffer\v!buffer\empty% [] + \fi\fi + \egroup} + +% get : before/after of buffer +% typing : before/after of typing +% process : no before/after (special case anyway) + +\def\dodoprocessbuffer#1#2% + {\edef\currenttyping{#1}% + \ctxcommand{processbuffer { + name = "#2", + strip = "\typingparameter\c!strip", + tab = "\typingparameter\c!tab", + method = "\typingparameter\c!option", + nature = "direct", + }}} + +% line numbering, keep broken lines together + +\newcount\nofverbatimlines + +\def\doverbatimbeginofline + {\ifconditional\verbatimnumberinglines + \global\advance\nofverbatimlines\plusone + \attribute\verbatimlineattribute\nofverbatimlines + \fi + \noindent + \doverbatimsetlinemargin \the\everyline\strut - }%\beginverbatimline} + \dostarttagged\t!verbatimline\empty} \def\doverbatimendofline - {%\endverbatimline - \global\lineparfalse - \obeyedline\par} + {\dostoptagged + \obeyedline % still needed? + \par + \ifconditional\verbatimnumberinglines + \attribute\verbatimlineattribute\attributeunsetvalue + \fi} \def\doverbatimemptyline - {\strut - \par - \global\linepartrue} + {\dostoptagged + \ifconditional\verbatimnumberinglines + \par\strut\par % this will be an option where we use a signal instead of a strut + \else + \blank[\typingparameter\c!blank]% + \fi + \dostarttagged\t!verbatimlines\empty} + +% hooks: + +\def\doinlineverbatimstart {} +\def\doinlineverbatimstop {} +\def\doinlineverbatimbeginline {} +\def\doinlineverbatimnewline {\obeyedspace} +\def\doinlineverbatimemptyline {\obeyedspace} + +\def\dodisplayverbatimstart {\doverbatimbeginofline} +\def\dodisplayverbatimstop {\doverbatimendofline} +\def\dodisplayverbatimbeginline {\doverbatimbeginofline} +\def\dodisplayverbatimnewline {\doverbatimendofline\par} +\def\dodisplayverbatimemptyline {\doverbatimemptyline} + +\def\doverbatimspace {\obeyedspace} + +\loadmarkfile{buff-imp-default} % preloaded as otherwise spurious spaces inline due to loading +\loadmarkfile{buff-imp-nested} % preloaded as otherwise spurious spaces inline due to loading +\loadmarkfile{buff-imp-escaped} % for completeness \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/catc-act.mkii b/Master/texmf-dist/tex/context/base/catc-act.mkii new file mode 100644 index 00000000000..41b7e8b981d --- /dev/null +++ b/Master/texmf-dist/tex/context/base/catc-act.mkii @@ -0,0 +1,65 @@ +%D \module +%D [ file=catc-act, +%D version=2006.09.18, +%D title=\CONTEXT\ Catcode Macros, +%D subtitle=Default Catcode Tables, +%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 deals with some active character handling. Use +%D with care. + +%D \macros +%D {installactivecharacter} + +\def\installactivecharacter#1 % + {\edef\temp{\detokenize{#1}}% + \cctcounterc\expandafter`\temp\relax % relax needed + \expandafter\startextendcatcodetable + \expandafter\ctxcatcodes\expandafter\catcode\the\cctcounterc\activecatcode + \stopextendcatcodetable + \letcatcodecommand \ctxcatcodes \cctcounterc \temp \relax + \ifnum\currentcatcodetable=\ctxcatcodes \setcatcodetable\ctxcatcodes \fi} + +%D \macros +%D {defineactivecharacter} +%D +%D Use this one with care, esp in combination with catcode +%D vectors. There are better ways now. + +\chardef\activehackcode=`~ + +\def\defineactivecharacter #1#2 #3% + {\cctcounterc\uccode\activehackcode + \if#1"\uccode\activehackcode\expandafter\doifnumberelse\expandafter{\string#1#2}\empty #1#2\else + \uccode\activehackcode\expandafter\doifnumberelse\expandafter{\string#1#2}\empty`#1#2\fi + \catcode\uccode\activehackcode\activecatcode + \uppercase{\def\next{~}}% + \uccode\activehackcode\cctcounterc + \expandafter\expandafter\expandafter\def\expandafter\next\expandafter + {\expandafter\dohandleactivecharacter\next{#3}}} + +\chardef\activecharactermode\plusone % overloading still backward compatible + +\def\dodohandleactivecharacter#1#2{#2} +\def\donthandleactivecharacter#1#2{\noexpand#1} + +\def\dohandleactivecharacter + {\ifcase\activecharactermode + \expandafter\donthandleactivecharacter + \else + \expandafter\dodohandleactivecharacter + \fi} + +\def\makecharacteractive #1 {\catcode`#1\active} + +% \def\installanddefineactivecharacter #1 % #2% +% {\normalexpanded{\noexpand\installactivecharacter \utfchar{#1} }% wrong +% \defineactivecharacter #1 }% {#2}} + +\endinput diff --git a/Master/texmf-dist/tex/context/base/catc-act.mkiv b/Master/texmf-dist/tex/context/base/catc-act.mkiv new file mode 100644 index 00000000000..2cde28e44f1 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/catc-act.mkiv @@ -0,0 +1,65 @@ +%D \module +%D [ file=catc-act, +%D version=2006.09.18, +%D title=\CONTEXT\ Catcode Macros, +%D subtitle=Default Catcode Tables, +%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 deals with some active character handling. Use +%D with care. + +%D \macros +%D {installactivecharacter} + +\def\installactivecharacter#1 % + {\edef\temp{\detokenize{#1}}% + \cctcounterc\expandafter`\temp\relax % relax needed + \expandafter\startextendcatcodetable + \expandafter\ctxcatcodes\expandafter\catcode\the\cctcounterc\activecatcode + \stopextendcatcodetable + \letcatcodecommand \ctxcatcodes \cctcounterc \temp \relax + \ifnum\currentcatcodetable=\ctxcatcodes \setcatcodetable\ctxcatcodes \fi} + +%D \macros +%D {defineactivecharacter} +%D +%D Use this one with care, esp in combination with catcode +%D vectors. There are better ways now. + +\chardef\activehackcode=`~ + +\def\defineactivecharacter #1#2 #3% + {\cctcounterc\uccode\activehackcode + \if#1"\uccode\activehackcode\expandafter\doifnumberelse\expandafter{\string#1#2}\empty #1#2\else + \uccode\activehackcode\expandafter\doifnumberelse\expandafter{\string#1#2}\empty`#1#2\fi + \catcode\uccode\activehackcode\activecatcode + \uppercase{\def\next{~}}% + \uccode\activehackcode\cctcounterc + \expandafter\expandafter\expandafter\def\expandafter\next\expandafter + {\expandafter\dohandleactivecharacter\next{#3}}} + +\chardef\activecharactermode\plusone % overloading still backward compatible + +\def\dodohandleactivecharacter#1#2{#2} +\def\donthandleactivecharacter#1#2{\noexpand#1} + +\def\dohandleactivecharacter + {\ifcase\activecharactermode + \expandafter\donthandleactivecharacter + \else + \expandafter\dodohandleactivecharacter + \fi} + +\def\makecharacteractive #1 {\catcode`#1\active} + +\def\installanddefineactivecharacter #1 % #2% + {\normalexpanded{\noexpand\installactivecharacter \utfchar{#1} }% + \defineactivecharacter #1 }% {#2}} + +\endinput diff --git a/Master/texmf-dist/tex/context/base/catc-act.tex b/Master/texmf-dist/tex/context/base/catc-act.tex deleted file mode 100644 index bc24562d7fe..00000000000 --- a/Master/texmf-dist/tex/context/base/catc-act.tex +++ /dev/null @@ -1,61 +0,0 @@ -%D \module -%D [ file=catc-act, -%D version=2006.09.18, -%D title=\CONTEXT\ Catcode Macros, -%D subtitle=Default Catcode Tables, -%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 deals with some active character handling. Use -%D with care. - -%D \macros -%D {installactivecharacter} - -\def\installactivecharacter#1 % - {\edef\temp{\detokenize{#1}}% - \cctcounterc\expandafter`\temp\relax % relax needed - \expandafter\startextendcatcodetable - \expandafter\ctxcatcodes\expandafter\catcode\the\cctcounterc\activecatcode - \stopextendcatcodetable - \letcatcodecommand \ctxcatcodes \cctcounterc \temp \relax - \ifnum\currentcatcodetable=\ctxcatcodes \setcatcodetable\ctxcatcodes \fi} - -%D \macros -%D {defineactivecharacter} -%D -%D Use this one with care, esp in combination with catcode -%D vectors. There are better ways now. - -\chardef\activehackcode=`~ - -\def\defineactivecharacter #1#2 #3% - {\cctcounterc\uccode\activehackcode - \if#1"\uccode\activehackcode\expandafter\doifnumberelse\expandafter{\string#1#2}\empty #1#2\else - \uccode\activehackcode\expandafter\doifnumberelse\expandafter{\string#1#2}\empty`#1#2\fi - \catcode\uccode\activehackcode\activecatcode - \uppercase{\def\next{~}}% - \uccode\activehackcode\cctcounterc - \expandafter\expandafter\expandafter\def\expandafter\next\expandafter - {\expandafter\dohandleactivecharacter\next{#3}}} - -\chardef\activecharactermode\plusone % overloading still backward compatible - -\def\dodohandleactivecharacter#1#2{#2} -\def\donthandleactivecharacter#1#2{\noexpand#1} - -\def\dohandleactivecharacter - {\ifcase\activecharactermode - \expandafter\donthandleactivecharacter - \else - \expandafter\dodohandleactivecharacter - \fi} - -\def\makecharacteractive #1 {\catcode`#1\active} - -\endinput diff --git a/Master/texmf-dist/tex/context/base/catc-ctx.mkii b/Master/texmf-dist/tex/context/base/catc-ctx.mkii new file mode 100644 index 00000000000..6bf4e9cfb24 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/catc-ctx.mkii @@ -0,0 +1,76 @@ +%D \module +%D [ file=catc-cys, +%D version=2006.09.18, +%D title=\CONTEXT\ Catcode Macros, +%D subtitle=Extra Tables, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D We prefer to define relevant catcode tables in this file instead +%D of everywhere around. + +\ifdefined \ctxcatcodes \else \newcatcodetable \ctxcatcodes \fi +\ifdefined \prtcatcodes \else \newcatcodetable \prtcatcodes \fi + +\startcatcodetable \ctxcatcodes + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode \endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\circumflexasciicode\superscriptcatcode + \catcode\underscoreasciicode\subscriptcatcode + \catcode\ampersandasciicode \alignmentcatcode + \catcode\backslashasciicode \escapecatcode + \catcode\leftbraceasciicode \begingroupcatcode + \catcode\rightbraceasciicode\endgroupcatcode + \catcode\dollarasciicode \mathshiftcatcode + \catcode\hashasciicode \parametercatcode + \catcode\commentasciicode \commentcatcode + \catcode\tildeasciicode \activecatcode + \catcode\barasciicode \activecatcode +\stopcatcodetable + +\startcatcodetable \prtcatcodes + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode \endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\circumflexasciicode\superscriptcatcode + \catcode\underscoreasciicode\subscriptcatcode + \catcode\ampersandasciicode \alignmentcatcode + \catcode\backslashasciicode \escapecatcode + \catcode\leftbraceasciicode \begingroupcatcode + \catcode\rightbraceasciicode\endgroupcatcode + \catcode\dollarasciicode \mathshiftcatcode + \catcode\hashasciicode \parametercatcode + \catcode\commentasciicode \commentcatcode + \catcode`\@ \lettercatcode + \catcode`\! \lettercatcode + \catcode`\? \lettercatcode + \catcode\tildeasciicode \activecatcode + \catcode\barasciicode \activecatcode +\stopcatcodetable + +\letcatcodecommand \ctxcatcodes \barasciicode \relax +\letcatcodecommand \ctxcatcodes \tildeasciicode \relax + + \catcodetable \ctxcatcodes +\let \defaultcatcodetable \ctxcatcodes + +% for the moment here: + +\def\starttexcode + {\pushcatcodetable + \catcodetable\prtcatcodes} + +\def\stoptexcode + {\popcatcodetable} + +\endinput diff --git a/Master/texmf-dist/tex/context/base/catc-ctx.mkiv b/Master/texmf-dist/tex/context/base/catc-ctx.mkiv new file mode 100644 index 00000000000..bdba6aeee0e --- /dev/null +++ b/Master/texmf-dist/tex/context/base/catc-ctx.mkiv @@ -0,0 +1,131 @@ +%D \module +%D [ file=catc-cys, +%D version=2006.09.18, +%D title=\CONTEXT\ Catcode Macros, +%D subtitle=Extra Tables, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D We prefer to define relevant catcode tables in this file instead +%D of everywhere around. + +\ifdefined \ctxcatcodes \else \newcatcodetable \ctxcatcodes \fi +\ifdefined \prtcatcodes \else \newcatcodetable \prtcatcodes \fi +\ifdefined \txtcatcodes \else \newcatcodetable \txtcatcodes \fi +%ifdefined \mthcatcodes \else \newcatcodetable \mthcatcodes \fi % math, not used, too tricky +\ifdefined \tpacatcodes \else \newcatcodetable \tpacatcodes \fi % { } +\ifdefined \tpbcatcodes \else \newcatcodetable \tpbcatcodes \fi % < > + +\startcatcodetable \ctxcatcodes + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode \endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\circumflexasciicode\superscriptcatcode + \catcode\underscoreasciicode\subscriptcatcode + \catcode\ampersandasciicode \alignmentcatcode + \catcode\backslashasciicode \escapecatcode + \catcode\leftbraceasciicode \begingroupcatcode + \catcode\rightbraceasciicode\endgroupcatcode + \catcode\dollarasciicode \mathshiftcatcode + \catcode\hashasciicode \parametercatcode + \catcode\commentasciicode \commentcatcode + \catcode\tildeasciicode \activecatcode + \catcode\barasciicode \activecatcode +\stopcatcodetable + +\startcatcodetable \prtcatcodes + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode \endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\circumflexasciicode\superscriptcatcode + \catcode\underscoreasciicode\lettercatcode + \catcode\ampersandasciicode \alignmentcatcode + \catcode\backslashasciicode \escapecatcode + \catcode\leftbraceasciicode \begingroupcatcode + \catcode\rightbraceasciicode\endgroupcatcode + \catcode\dollarasciicode \mathshiftcatcode + \catcode\hashasciicode \parametercatcode + \catcode\commentasciicode \commentcatcode + \catcode`\@ \lettercatcode + \catcode`\! \lettercatcode + \catcode`\? \lettercatcode + \catcode\tildeasciicode \activecatcode + \catcode\barasciicode \activecatcode +\stopcatcodetable + +%startcatcodetable \mthcatcodes +% \catcode\tabasciicode \spacecatcode +% \catcode\endoflineasciicode \endoflinecatcode +% %\catcode\newlineasciicode \spacecatcode +% \catcode\formfeedasciicode \endoflinecatcode +% \catcode\spaceasciicode \spacecatcode +% \catcode\endoffileasciicode \ignorecatcode +% \catcode\circumflexasciicode\superscriptcatcode +% \catcode\underscoreasciicode\subscriptcatcode +% \catcode\ampersandasciicode \alignmentcatcode +% \catcode\backslashasciicode \escapecatcode +% \catcode\leftbraceasciicode \begingroupcatcode +% \catcode\rightbraceasciicode\endgroupcatcode +% \catcode\dollarasciicode \mathshiftcatcode +% \catcode\hashasciicode \parametercatcode +% \catcode\commentasciicode \commentcatcode +% %\catcode\tildeasciicode \activecatcode +% %\catcode\barasciicode \activecatcode +%stopcatcodetable + +\startcatcodetable \tpacatcodes + \catcode\tabasciicode \othercatcode + \catcode\endoflineasciicode \othercatcode + \catcode\formfeedasciicode \othercatcode + \catcode\spaceasciicode \othercatcode + \catcode\endoffileasciicode \othercatcode + \catcode\leftbraceasciicode \begingroupcatcode + \catcode\rightbraceasciicode\endgroupcatcode +\stopcatcodetable + +\startcatcodetable \tpbcatcodes + \catcode\tabasciicode \othercatcode + \catcode\endoflineasciicode \othercatcode + \catcode\formfeedasciicode \othercatcode + \catcode\spaceasciicode \othercatcode + \catcode\endoffileasciicode \othercatcode + \catcode`\< \begingroupcatcode + \catcode`\> \endgroupcatcode +\stopcatcodetable + +\startcatcodetable \txtcatcodes + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode \endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\backslashasciicode \escapecatcode + \catcode\leftbraceasciicode \begingroupcatcode + \catcode\rightbraceasciicode\endgroupcatcode +\stopcatcodetable + +\letcatcodecommand \ctxcatcodes \barasciicode \relax +\letcatcodecommand \ctxcatcodes \tildeasciicode \relax + + \catcodetable \ctxcatcodes +\let \defaultcatcodetable \ctxcatcodes + +% for the moment here: + +\def\starttexcode + {\pushcatcodetable + \catcodetable\prtcatcodes} + +\def\stoptexcode + {\popcatcodetable} + +\endinput diff --git a/Master/texmf-dist/tex/context/base/catc-ctx.tex b/Master/texmf-dist/tex/context/base/catc-ctx.tex deleted file mode 100644 index 21e7d013641..00000000000 --- a/Master/texmf-dist/tex/context/base/catc-ctx.tex +++ /dev/null @@ -1,250 +0,0 @@ -%D \module -%D [ file=catc-cys, -%D version=2006.09.18, -%D title=\CONTEXT\ Catcode Macros, -%D subtitle=Extra Tables, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -%D We prefer to define relevant catcode tables in this file instead -%D of everywhere around. - -\ifdefined \ctxcatcodes \else \newcatcodetable \ctxcatcodes \fi -\ifdefined \mthcatcodes \else \newcatcodetable \mthcatcodes \fi % math, not used, too tricky -\ifdefined \xmlcatcodesn \else \newcatcodetable \xmlcatcodesn \fi % normal -\ifdefined \xmlcatcodese \else \newcatcodetable \xmlcatcodese \fi % entitle -\ifdefined \xmlcatcodesr \else \newcatcodetable \xmlcatcodesr \fi % reduce -\ifdefined \typcatcodesa \else \newcatcodetable \typcatcodesa \fi % { } -\ifdefined \typcatcodesb \else \newcatcodetable \typcatcodesb \fi % < > - -\startcatcodetable \ctxcatcodes - \catcode`\^^I = 10 - \catcode`\^^M = 5 - % \catcode`\^^J = 10 % new - \catcode`\^^L = 5 - \catcode`\ = 10 - \catcode`\^^Z = 9 - \catcode`\\ = 0 - \catcode`\{ = 1 - \catcode`\} = 2 - \catcode`\$ = 3 - \catcode`\& = 4 - \catcode`\# = 6 - \catcode`\^ = 7 - \catcode`\_ = 8 - \catcode`\% = 14 - \catcode`\~ = 13 - \catcode`\| = 13 -\stopcatcodetable - -\startcatcodetable \prtcatcodes - \catcode`\^^I = 10 - \catcode`\^^M = 5 - \catcode`\^^L = 5 - \catcode`\ = 10 - \catcode`\^^Z = 9 - \catcode`\\ = 0 - \catcode`\{ = 1 - \catcode`\} = 2 - \catcode`\$ = 3 - \catcode`\& = 4 - \catcode`\# = 6 - \catcode`\^ = 7 - \catcode`\_ = 8 - \catcode`\% = 14 - \catcode`\@ = 11 - \catcode`\! = 11 - \catcode`\? = 11 - \catcode`\~ = 13 - \catcode`\| = 13 -\stopcatcodetable - -\startcatcodetable \mthcatcodes - \catcode`\^^I = 10 - \catcode`\^^M = 5 - %\catcode`\^^J = 10 % new - \catcode`\^^L = 5 - \catcode`\ = 10 - \catcode`\^^Z = 9 - \catcode`\\ = 0 - \catcode`\{ = 1 - \catcode`\} = 2 - \catcode`\$ = 3 - \catcode`\& = 4 - \catcode`\# = 6 - \catcode`\^ = 7 - \catcode`\_ = 8 - \catcode`\% = 14 - %\catcode`\~ = 13 - %\catcode`\| = 13 -\stopcatcodetable - -\startcatcodetable \xmlcatcodesn - \catcode`\^^I = 10 % ascii tab is a blank space - \catcode`\^^M = 5 % ascii return is end-line - \catcode`\^^L = 5 % ascii form-feed - \catcode`\ = 10 % ascii space is blank space - \catcode`\^^Z = 9 % ascii eof is ignored - \catcode`\& = 13 % entity - \catcode`\< = 13 % element - \catcode`\> = 12 - \catcode`\" = 12 % probably not needed any more - \catcode`\/ = 12 % probably not needed any more - \catcode`\' = 12 % probably not needed any more - \catcode`\~ = 12 % probably not needed any more - \catcode`\# = 12 % probably not needed any more - \catcode`\\ = 12 % probably not needed any more -\stopcatcodetable - -\startcatcodetable \xmlcatcodese - \catcode`\^^I = 10 % ascii tab is a blank space - \catcode`\^^M = 5 % ascii return is end-line - \catcode`\^^L = 5 % ascii form-feed - \catcode`\ = 10 % ascii space is blank space - \catcode`\^^Z = 9 % ascii eof is ignored - \catcode`\& = 13 % entity - \catcode`\< = 13 % element - \catcode`\> = 12 - \catcode`\# = 13 - \catcode`\$ = 13 - \catcode`\% = 13 - \catcode`\\ = 13 - \catcode`\^ = 13 - \catcode`\_ = 13 - \catcode`\{ = 13 - \catcode`\} = 13 - \catcode`\| = 13 - \catcode`\~ = 13 -\stopcatcodetable - -\startcatcodetable \xmlcatcodesr - \catcode`\^^I = 10 % ascii tab is a blank space - \catcode`\^^M = 5 % ascii return is end-line - \catcode`\^^L = 5 % ascii form-feed - \catcode`\ = 10 % ascii space is blank space - \catcode`\^^Z = 9 % ascii eof is ignored - \catcode`\& = 13 % entity - \catcode`\< = 13 % element - \catcode`\> = 12 - \catcode`\# = 13 - \catcode`\$ = 13 - \catcode`\% = 13 - \catcode`\\ = 13 - \catcode`\^ = 13 - \catcode`\_ = 13 - \catcode`\{ = 13 - \catcode`\} = 13 - \catcode`\| = 13 - \catcode`\~ = 13 -\stopcatcodetable - -\startcatcodetable \typcatcodesa - \catcode`\^^I = 12 - \catcode`\^^M = 12 - \catcode`\^^L = 12 - \catcode`\ = 12 - \catcode`\^^Z = 12 - \catcode`\{ = 1 - \catcode`\} = 2 -\stopcatcodetable - -\startcatcodetable \typcatcodesb - \catcode`\^^I = 12 - \catcode`\^^M = 12 - \catcode`\^^L = 12 - \catcode`\ = 12 - \catcode`\^^Z = 12 - \catcode`\< = 1 - \catcode`\> = 2 -\stopcatcodetable - -\letcatcodecommand \ctxcatcodes `\| \relax -\letcatcodecommand \ctxcatcodes `\~ \relax - -%letcatcodecommand \prtcatcodes `\| \relax % falls back on ctx -%letcatcodecommand \prtcatcodes `\~ \relax % falls back on ctx - -\letcatcodecommand \xmlcatcodesn `\& \relax -\letcatcodecommand \xmlcatcodesn `\< \relax - -\letcatcodecommand \xmlcatcodese `\& \relax -\letcatcodecommand \xmlcatcodese `\< \relax - -\letcatcodecommand \xmlcatcodesr `\& \relax -\letcatcodecommand \xmlcatcodesr `\< \relax - -\letcatcodecommand \xmlcatcodese `\# \relax -\letcatcodecommand \xmlcatcodese `\$ \relax -\letcatcodecommand \xmlcatcodese `\% \relax -\letcatcodecommand \xmlcatcodese `\\ \relax -\letcatcodecommand \xmlcatcodese `\^ \relax -\letcatcodecommand \xmlcatcodese `\_ \relax -\letcatcodecommand \xmlcatcodese `\{ \relax -\letcatcodecommand \xmlcatcodese `\} \relax -\letcatcodecommand \xmlcatcodese `\| \relax -\letcatcodecommand \xmlcatcodese `\~ \relax - -\letcatcodecommand \xmlcatcodesr `\# \relax -\letcatcodecommand \xmlcatcodesr `\$ \relax -\letcatcodecommand \xmlcatcodesr `\% \relax -\letcatcodecommand \xmlcatcodesr `\\ \relax -\letcatcodecommand \xmlcatcodesr `\^ \relax -\letcatcodecommand \xmlcatcodesr `\_ \relax -\letcatcodecommand \xmlcatcodesr `\{ \relax -\letcatcodecommand \xmlcatcodesr `\} \relax -\letcatcodecommand \xmlcatcodesr `\| \relax -\letcatcodecommand \xmlcatcodesr `\~ \relax - - \catcodetable \ctxcatcodes -\let\defaultcatcodetable\ctxcatcodes -\let\xmlcatcodes \xmlcatcodesn % beware, in mkiv we use \notcatcodes - -\endinput - -% under consideration: -% -% \newcatcodetable\txtcatcodes -% -% \startcatcodetable \txtcatcodes -% \catcode`\^^I = 10 -% \catcode`\^^M = 5 -% \catcode`\^^L = 5 -% \catcode`\ = 10 -% \catcode`\\ = 0 -% \catcode`\{ = 1 -% \catcode`\} = 2 -% \stopcatcodetable -% -% \newcount\relaxedcatcodedepth -% -% \def\startrelaxedcatcodes -% {\global\chardef\relaxedcatcodeparent\catcodetable -% \global\advance\relaxedcatcodedepth\plusone -% \nonknuthmode\setcatcodetable\txtcatcodes} -% -% \def\stoprelaxedcatcodes -% {\ifcase\relaxedcatcodedepth -% % error -% \or -% \setcatcodetable\relaxedcatcodeparent -% \global\relaxedcatcodedepth\zerocount -% \else -% \global\advance\relaxedcatcodedepth\minusone -% \setcatcodetable\txtcatcodes -% \fi} -% -% \starttext -% -% \startrelaxedcatcodes -% \startcomment test \stopcomment -% test $ test 10% whatever|test \mathematics{x^2=1} -% \stoprelaxedcatcodes -% -% $x^2=1$ -% -% \stoptext diff --git a/Master/texmf-dist/tex/context/base/catc-def.mkii b/Master/texmf-dist/tex/context/base/catc-def.mkii new file mode 100644 index 00000000000..275a9a6cda4 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/catc-def.mkii @@ -0,0 +1,142 @@ +%D \module +%D [ file=catc-def, +%D version=2006.09.18, +%D title=\CONTEXT\ Catcode Macros, +%D subtitle=Default Tables, +%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 The following catcode tables are rather \CONTEXT\ independent. + +\ifdefined\nilcatcodes \else \newcatcodetable \nilcatcodes \fi +\ifdefined\texcatcodes \else \newcatcodetable \texcatcodes \fi +\ifdefined\luacatcodes \else \newcatcodetable \luacatcodes \fi +\ifdefined\notcatcodes \else \newcatcodetable \notcatcodes \fi +\ifdefined\vrbcatcodes \else \newcatcodetable \vrbcatcodes \fi +\ifdefined\prtcatcodes \else \newcatcodetable \prtcatcodes \fi + +\startcatcodetable \nilcatcodes + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode\endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode\ignorecatcode +\stopcatcodetable + +\startcatcodetable \texcatcodes + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode \endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\circumflexasciicode\superscriptcatcode + \catcode\underscoreasciicode\subscriptcatcode + \catcode\ampersandasciicode \alignmentcatcode + \catcode\backslashasciicode \escapecatcode + \catcode\leftbraceasciicode \begingroupcatcode + \catcode\rightbraceasciicode\endgroupcatcode + \catcode\dollarasciicode \mathshiftcatcode + \catcode\hashasciicode \parametercatcode + \catcode\commentasciicode \commentcatcode +\stopcatcodetable + +\startcatcodetable \luacatcodes + \catcode\tabasciicode \othercatcode + \catcode\endoflineasciicode \othercatcode + \catcode\formfeedasciicode \othercatcode + \catcode\spaceasciicode \othercatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\circumflexasciicode\othercatcode + \catcode\underscoreasciicode\othercatcode + \catcode\ampersandasciicode \othercatcode + \catcode\backslashasciicode \escapecatcode + \catcode\commentasciicode \othercatcode + \catcode\hashasciicode \othercatcode + \catcode\barasciicode \othercatcode + \catcode\leftbraceasciicode \othercatcode + \catcode\rightbraceasciicode\othercatcode + \catcode\tildeasciicode \othercatcode + \catcode\dollarasciicode \othercatcode +\stopcatcodetable + +\startcatcodetable \notcatcodes % probably less needed + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode \endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\circumflexasciicode\othercatcode + \catcode\underscoreasciicode\othercatcode + \catcode\ampersandasciicode \othercatcode + \catcode\tildeasciicode \othercatcode + \catcode\hashasciicode \othercatcode + \catcode\dollarasciicode \othercatcode + \catcode\commentasciicode \othercatcode + \catcode`\< \othercatcode + \catcode`\> \othercatcode + \catcode\leftbraceasciicode \othercatcode + \catcode\rightbraceasciicode\othercatcode + \catcode`\" \othercatcode + \catcode`\' \othercatcode + \catcode`\/ \othercatcode + \catcode\backslashasciicode \othercatcode + \catcode\barasciicode \othercatcode +\stopcatcodetable + +\startcatcodetable \vrbcatcodes % probably less needed + \catcode\tabasciicode \othercatcode + \catcode\endoflineasciicode\othercatcode + \catcode\formfeedasciicode \othercatcode + \catcode\spaceasciicode \othercatcode + \catcode\endoffileasciicode\othercatcode +\stopcatcodetable + +\startcatcodetable \prtcatcodes + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode \endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\circumflexasciicode\superscriptcatcode + \catcode\underscoreasciicode\subscriptcatcode + \catcode\ampersandasciicode \alignmentcatcode + \catcode\backslashasciicode \escapecatcode + \catcode\leftbraceasciicode \begingroupcatcode + \catcode\rightbraceasciicode\endgroupcatcode + \catcode\dollarasciicode \mathshiftcatcode + \catcode\hashasciicode \parametercatcode + \catcode\commentasciicode \commentcatcode + \catcode`\@ \lettercatcode + \catcode`\! \lettercatcode + \catcode`\? \lettercatcode + \catcode\tildeasciicode \activecatcode + \catcode\barasciicode \activecatcode +\stopcatcodetable + +%D Because some characters have a special meaning, we provide +%D shortcuts to their character representation. + +\chardef\^=\circumflexasciicode +\chardef\_=\underscoreasciicode % but way too wide in lm, so ... until that's fixed: +\chardef\&=\ampersandasciicode +\chardef\%=\commentasciicode +\chardef\#=\hashasciicode +\chardef\$=\dollarasciicode +\chardef\{=\leftbraceasciicode +\chardef\}=\rightbraceasciicode +\chardef\\=\backslashasciicode + +%def\_{\leavevmode \kern.06em \vbox{\hrule width.3em}} +\def\_{\dontleavehmode \kern.06em \vbox{\hrule width.3em}} + +%D From now on we can use the protection mechanisms. + +\def\unprotect {\pushcatcodetable\setcatcodetable\prtcatcodes} +\def\protect {\popcatcodetable} + +\endinput diff --git a/Master/texmf-dist/tex/context/base/catc-def.mkiv b/Master/texmf-dist/tex/context/base/catc-def.mkiv new file mode 100644 index 00000000000..0bd7deed72b --- /dev/null +++ b/Master/texmf-dist/tex/context/base/catc-def.mkiv @@ -0,0 +1,143 @@ +%D \module +%D [ file=catc-def, +%D version=2006.09.18, +%D title=\CONTEXT\ Catcode Macros, +%D subtitle=Default Tables, +%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 The following catcode tables are rather \CONTEXT\ independent. + +\ifdefined\nilcatcodes \else \newcatcodetable \nilcatcodes \fi +\ifdefined\texcatcodes \else \newcatcodetable \texcatcodes \fi +\ifdefined\luacatcodes \else \newcatcodetable \luacatcodes \fi +\ifdefined\notcatcodes \else \newcatcodetable \notcatcodes \fi +\ifdefined\vrbcatcodes \else \newcatcodetable \vrbcatcodes \fi +\ifdefined\prtcatcodes \else \newcatcodetable \prtcatcodes \fi + +\startcatcodetable \nilcatcodes + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode\endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode\ignorecatcode +\stopcatcodetable + +\startcatcodetable \texcatcodes + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode \endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\circumflexasciicode\superscriptcatcode + \catcode\underscoreasciicode\subscriptcatcode + \catcode\ampersandasciicode \alignmentcatcode + \catcode\backslashasciicode \escapecatcode + \catcode\leftbraceasciicode \begingroupcatcode + \catcode\rightbraceasciicode\endgroupcatcode + \catcode\dollarasciicode \mathshiftcatcode + \catcode\hashasciicode \parametercatcode + \catcode\commentasciicode \commentcatcode +\stopcatcodetable + +\startcatcodetable \luacatcodes + \catcode\tabasciicode \othercatcode + \catcode\endoflineasciicode \othercatcode + \catcode\formfeedasciicode \othercatcode + \catcode\spaceasciicode \othercatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\circumflexasciicode\othercatcode + \catcode\underscoreasciicode\othercatcode + \catcode\ampersandasciicode \othercatcode + \catcode\backslashasciicode \escapecatcode + \catcode\commentasciicode \othercatcode + \catcode\hashasciicode \othercatcode + \catcode\barasciicode \othercatcode + \catcode\leftbraceasciicode \othercatcode + \catcode\rightbraceasciicode\othercatcode + \catcode\tildeasciicode \othercatcode + \catcode\dollarasciicode \othercatcode +\stopcatcodetable + +\startcatcodetable \notcatcodes % probably less needed + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode \endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\circumflexasciicode\othercatcode + \catcode\underscoreasciicode\othercatcode + \catcode\ampersandasciicode \othercatcode + \catcode\tildeasciicode \othercatcode + \catcode\hashasciicode \othercatcode + \catcode\dollarasciicode \othercatcode + \catcode\commentasciicode \othercatcode + \catcode`\< \othercatcode + \catcode`\> \othercatcode + \catcode\leftbraceasciicode \othercatcode + \catcode\rightbraceasciicode\othercatcode + \catcode`\" \othercatcode + \catcode`\' \othercatcode + \catcode`\/ \othercatcode + \catcode\backslashasciicode \othercatcode + \catcode\barasciicode \othercatcode +\stopcatcodetable + +\startcatcodetable \vrbcatcodes % probably less needed + \catcode\tabasciicode \othercatcode + \catcode\endoflineasciicode\othercatcode + \catcode\formfeedasciicode \othercatcode + \catcode\spaceasciicode \othercatcode + \catcode\endoffileasciicode\othercatcode +\stopcatcodetable + +\startcatcodetable \prtcatcodes + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode \endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\circumflexasciicode\superscriptcatcode +% \catcode\underscoreasciicode\subscriptcatcode + \catcode\underscoreasciicode\lettercatcode + \catcode\ampersandasciicode \alignmentcatcode + \catcode\backslashasciicode \escapecatcode + \catcode\leftbraceasciicode \begingroupcatcode + \catcode\rightbraceasciicode\endgroupcatcode + \catcode\dollarasciicode \mathshiftcatcode + \catcode\hashasciicode \parametercatcode + \catcode\commentasciicode \commentcatcode + \catcode`\@ \lettercatcode + \catcode`\! \lettercatcode + \catcode`\? \lettercatcode + \catcode\tildeasciicode \activecatcode + \catcode\barasciicode \activecatcode +\stopcatcodetable + +%D Because some characters have a special meaning, we provide +%D shortcuts to their character representation. + +\chardef\^=\circumflexasciicode +\chardef\_=\underscoreasciicode % but way too wide in lm, so ... until that's fixed: +\chardef\&=\ampersandasciicode +\chardef\%=\commentasciicode +\chardef\#=\hashasciicode +\chardef\$=\dollarasciicode +\chardef\{=\leftbraceasciicode +\chardef\}=\rightbraceasciicode +\chardef\\=\backslashasciicode + +%def\_{\leavevmode \kern.06em \vbox{\hrule width.3em}} +\def\_{\dontleavehmode \kern.06em \vbox{\hrule width.3em}} + +%D From now on we can use the protection mechanisms. + +\def\unprotect {\pushcatcodetable\setcatcodetable\prtcatcodes} +\def\protect {\popcatcodetable} + +\endinput diff --git a/Master/texmf-dist/tex/context/base/catc-def.tex b/Master/texmf-dist/tex/context/base/catc-def.tex deleted file mode 100644 index e80cfe12539..00000000000 --- a/Master/texmf-dist/tex/context/base/catc-def.tex +++ /dev/null @@ -1,142 +0,0 @@ -%D \module -%D [ file=catc-def, -%D version=2006.09.18, -%D title=\CONTEXT\ Catcode Macros, -%D subtitle=Default Tables, -%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 The following catcode tables are rather \CONTEXT\ independent. - -\ifdefined\nilcatcodes \else \newcatcodetable \nilcatcodes \fi -\ifdefined\texcatcodes \else \newcatcodetable \texcatcodes \fi -\ifdefined\luacatcodes \else \newcatcodetable \luacatcodes \fi -\ifdefined\notcatcodes \else \newcatcodetable \notcatcodes \fi -\ifdefined\vrbcatcodes \else \newcatcodetable \vrbcatcodes \fi -\ifdefined\prtcatcodes \else \newcatcodetable \prtcatcodes \fi - -\startcatcodetable \nilcatcodes - \catcode`\^^I = 10 % ascii tab is a blank space - \catcode`\^^M = 5 % ascii return is end-line - \catcode`\^^L = 5 % ascii form-feed - \catcode`\ = 10 % ascii space is blank space - \catcode`\^^Z = 9 % ascii eof is ignored -\stopcatcodetable - -\startcatcodetable \texcatcodes - \catcode`\^^I = 10 - \catcode`\^^M = 5 - \catcode`\^^L = 5 - \catcode`\ = 10 - \catcode`\^^Z = 9 - \catcode`\\ = 0 - \catcode`\{ = 1 - \catcode`\} = 2 - \catcode`\$ = 3 - \catcode`\& = 4 - \catcode`\# = 6 - \catcode`\^ = 7 - \catcode`\_ = 8 - \catcode`\% = 14 -\stopcatcodetable - -\startcatcodetable \luacatcodes - \catcode`\^^I = 12 % ascii tab is a blank space - \catcode`\^^M = 12 % ascii return is end-line - \catcode`\^^L = 12 % ascii form-feed - \catcode`\ = 12 % ascii space is blank space - \catcode`\^^Z = 9 % ascii eof is ignored - \catcode`\\ = 0 - \catcode`\% = 12 - \catcode`\# = 12 - \catcode`\_ = 12 - \catcode`\^ = 12 - \catcode`\& = 12 - \catcode`\| = 12 - \catcode`\{ = 12 - \catcode`\} = 12 - \catcode`\~ = 12 - \catcode`\$ = 12 -\stopcatcodetable - -\startcatcodetable \notcatcodes - \catcode`\^^I = 10 % ascii tab is a blank space - \catcode`\^^M = 5 % ascii return is end-line - \catcode`\^^L = 5 % ascii form-feed - \catcode`\ = 10 % ascii space is blank space - \catcode`\^^Z = 9 % ascii eof is ignored - \catcode`\~ = 12 - \catcode`\# = 12 % probably too much, in principle - \catcode`\$ = 12 % nilcatcodes would be ok too - \catcode`\% = 12 - \catcode`\^ = 12 - \catcode`\& = 12 - \catcode`\_ = 12 - \catcode`\< = 12 - \catcode`\> = 12 - \catcode`\{ = 12 - \catcode`\} = 12 - \catcode`\" = 12 - \catcode`\' = 12 - \catcode`\/ = 12 - \catcode`\\ = 12 - \catcode`\| = 12 -\stopcatcodetable - -\startcatcodetable \vrbcatcodes % probably less needed - \catcode`\^^I = 12 - \catcode`\^^M = 12 - \catcode`\^^L = 12 - \catcode`\ = 12 - \catcode`\^^Z = 12 -\stopcatcodetable - -\startcatcodetable \prtcatcodes - \catcode`\^^I = 10 - \catcode`\^^M = 5 - \catcode`\^^L = 5 - \catcode`\ = 10 - \catcode`\^^Z = 9 - \catcode`\\ = 0 - \catcode`\{ = 1 - \catcode`\} = 2 - \catcode`\$ = 3 - \catcode`\& = 4 - \catcode`\# = 6 - \catcode`\^ = 7 - \catcode`\_ = 8 - \catcode`\% = 14 - \catcode`\@ = 11 - \catcode`\! = 11 - \catcode`\? = 11 - \catcode`\~ = 13 - \catcode`\| = 13 -\stopcatcodetable - -%D Because some characters have a special meaning, we provide -%D shortcuts to their character representation. - -\chardef\%=`\% -\chardef\&=`\& -\chardef\#=`\# -\chardef\$=`\$ -\chardef\{=`\{ -\chardef\}=`\} -\chardef\\=`\\ -\chardef\^=`\^ -\chardef\_=`\_ % but way too wide in lm, so ... until that's fixed: - -%def\_{\leavevmode \kern.06em \vbox{\hrule width.3em}} -\def\_{\dontleavehmode \kern.06em \vbox{\hrule width.3em}} - -%D From now on we can use the protection mechanisms. - -\def\unprotect {\pushcatcodetable\setcatcodetable\prtcatcodes} -\def\protect {\popcatcodetable} - -\endinput diff --git a/Master/texmf-dist/tex/context/base/catc-ini.mkii b/Master/texmf-dist/tex/context/base/catc-ini.mkii index dee15290ac0..900f617563a 100644 --- a/Master/texmf-dist/tex/context/base/catc-ini.mkii +++ b/Master/texmf-dist/tex/context/base/catc-ini.mkii @@ -22,21 +22,41 @@ \ifx\plusone \undefined \chardef \plusone = 1 \fi \ifx\minusone \undefined \newcount\minusone \minusone =-1 \fi -\chardef\escapecatcode = 0 -\chardef\begingroupcatcode = 1 -\chardef\endgroupcatcode = 2 -\chardef\mathshiftcatcode = 3 -\chardef\alignmentcatcode = 4 -\chardef\endoflinecatcode = 5 -\chardef\parametercatcode = 6 -\chardef\superscriptcatcode = 7 -\chardef\subscriptcatcode = 8 -\chardef\ignorecatcode = 9 -\chardef\spacecatcode = 10 -\chardef\lettercatcode = 11 -\chardef\othercatcode = 12 \chardef\other = 12 -\chardef\activecatcode = 13 \chardef\active = 13 -\chardef\commentcatcode = 14 +\chardef\escapecatcode = 0 +\chardef\begingroupcatcode = 1 +\chardef\endgroupcatcode = 2 +\chardef\mathshiftcatcode = 3 +\chardef\alignmentcatcode = 4 +\chardef\endoflinecatcode = 5 +\chardef\parametercatcode = 6 +\chardef\superscriptcatcode = 7 +\chardef\subscriptcatcode = 8 +\chardef\ignorecatcode = 9 +\chardef\spacecatcode = 10 +\chardef\lettercatcode = 11 +\chardef\othercatcode = 12 \chardef\other = 12 +\chardef\activecatcode = 13 \chardef\active = 13 +\chardef\commentcatcode = 14 +\chardef\invalidcatcode = 15 + +\chardef\tabasciicode = 9 % ^^I +\chardef\newlineasciicode = 10 % ^^J don't confuse this one with \endoflineasciicode +\chardef\formfeedasciicode = 12 % ^^L +\chardef\endoflineasciicode = 13 % ^^M somewhat messy but this can be the active \par +\chardef\endoffileasciicode = 26 % ^^Z +\chardef\spaceasciicode = 32 +\chardef\hashasciicode = 35 +\chardef\dollarasciicode = 36 +\chardef\commentasciicode = 37 +\chardef\ampersandasciicode = 38 +\chardef\backslashasciicode = 92 % `\\ +\chardef\circumflexasciicode = 94 +\chardef\underscoreasciicode = 95 +\chardef\leftbraceasciicode = 123 % `\{ +\chardef\barasciicode = 124 % `\| +\chardef\rightbraceasciicode = 125 % `\} +\chardef\tildeasciicode = 126 % `\~ +\chardef\delasciicode = 127 \newif \ifrecatcodeuppercharacters % only used in good old tex diff --git a/Master/texmf-dist/tex/context/base/catc-ini.mkiv b/Master/texmf-dist/tex/context/base/catc-ini.mkiv index 269330a1bbd..9221d17c51f 100644 --- a/Master/texmf-dist/tex/context/base/catc-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/catc-ini.mkiv @@ -14,32 +14,66 @@ %D We've split the functionality of syst-cat.* over more files %D now so that we can load more selectively. -\registerctxluafile{catc-ini} {1.001} +\registerctxluafile{catc-ini}{1.001} %D A long standing wish has been the availability of catcode %D arrays. Because traditional \TEX\ does not provide this we %D implement a fake method in the \MKII\ file. There is some %D overlap in code with \MKII\ but we take that for granted. -\ifx\zerocount\undefined \chardef \zerocount= 0 \fi -\ifx\plusone \undefined \chardef \plusone = 1 \fi -\ifx\minusone \undefined \newcount\minusone \minusone =-1 \fi - -\chardef\escapecatcode = 0 -\chardef\begingroupcatcode = 1 -\chardef\endgroupcatcode = 2 -\chardef\mathshiftcatcode = 3 -\chardef\alignmentcatcode = 4 -\chardef\endoflinecatcode = 5 -\chardef\parametercatcode = 6 -\chardef\superscriptcatcode = 7 -\chardef\subscriptcatcode = 8 -\chardef\ignorecatcode = 9 -\chardef\spacecatcode = 10 -\chardef\lettercatcode = 11 -\chardef\othercatcode = 12 \chardef\other = 12 -\chardef\activecatcode = 13 \chardef\active = 13 -\chardef\commentcatcode = 14 +\setnewconstant\escapecatcode 0 +\setnewconstant\begingroupcatcode 1 +\setnewconstant\endgroupcatcode 2 +\setnewconstant\mathshiftcatcode 3 +\setnewconstant\alignmentcatcode 4 +\setnewconstant\endoflinecatcode 5 +\setnewconstant\parametercatcode 6 +\setnewconstant\superscriptcatcode 7 +\setnewconstant\subscriptcatcode 8 +\setnewconstant\ignorecatcode 9 +\setnewconstant\spacecatcode 10 +\setnewconstant\lettercatcode 11 +\setnewconstant\othercatcode 12 \let\other \othercatcode +\setnewconstant\activecatcode 13 \let\active\activecatcode +\setnewconstant\commentcatcode 14 +\setnewconstant\invalidcatcode 15 + +\setnewconstant\tabasciicode 9 +\setnewconstant\newlineasciicode 10 % don't confuse this one with \endoflineasciicode +\setnewconstant\formfeedasciicode 12 +\setnewconstant\endoflineasciicode 13 % somewhat messy but this can be the active \par +\setnewconstant\endoffileasciicode 26 +\setnewconstant\spaceasciicode 32 +\setnewconstant\hashasciicode 35 +\setnewconstant\dollarasciicode 36 +\setnewconstant\commentasciicode 37 +\setnewconstant\ampersandasciicode 38 +\setnewconstant\backslashasciicode 92 % `\\ +\setnewconstant\circumflexasciicode 94 +\setnewconstant\underscoreasciicode 95 +\setnewconstant\leftbraceasciicode 123 % `\{ +\setnewconstant\barasciicode 124 % `\| +\setnewconstant\rightbraceasciicode 125 % `\} +\setnewconstant\tildeasciicode 126 % `\~ +\setnewconstant\delasciicode 127 + +\bgroup + \catcode \tabasciicode \activecatcode \gdef\activetabtoken {^^I} + \gdef\outputnewlinechar {^^J} + \catcode \formfeedasciicode \activecatcode \gdef\activeformfeedtoken {^^L} + \catcode \endoflineasciicode \activecatcode \gdef\activeendoflinetoken{^^M} +\egroup + +% \endlinechar = \endoflineasciicode % appended to input lines +% \newlinechar = \newlineasciicode % can be used in write + +% rather special and used in writing to file: \let\par\outputnewlinechar + +\def\initializenewlinechar % operating system dependent + {\bgroup + \newlinechar\newlineasciicode + \xdef\outputnewlinechar{^^J}% + \egroup} \ifx\gobbleoneargument\undefined \long\def\gobbleoneargument#1{} \fi @@ -54,21 +88,20 @@ \def\newcatcodetable#1% {\global\advance\cctdefcounter\plusone \expandafter\xdef\csname @@ccn:\number\cctdefcounter\endcsname{\string#1}% logging - \global\chardef#1\cctdefcounter - \ctxlua{catcodes.register("\expandafter\gobbleoneargument\string#1",\number#1)}% - % we have two ways to access catcodetable numbers - \startruntimectxluacode tex.\expandafter\gobbleoneargument\string#1 = \number#1 ;\stopruntimectxluacode} + \newconstant#1% + #1\cctdefcounter + \ctxlua{catcodes.register("\expandafter\gobbleoneargument\string#1",\number#1)}} \newcatcodetable \scratchcatcodes \initcatcodetable\scratchcatcodes \newtoks \setdefaultcatcodes \setdefaultcatcodes - {\catcode`\\ \othercatcode - \catcode`\^^M \othercatcode - \catcode`\ \othercatcode - \catcode`\% \othercatcode - \catcode127 \othercatcode} + {\catcode\backslashasciicode\othercatcode + \catcode\endoflineasciicode\othercatcode + \catcode\spaceasciicode \othercatcode + \catcode\commentasciicode \othercatcode + \catcode\delasciicode \othercatcode} \long\normalprotected\def\startcatcodetable#1#2\stopcatcodetable {\bgroup @@ -78,6 +111,11 @@ \savecatcodetable#1\relax \egroup} +\def\permitcircumflexescape % to be used grouped + {\catcode\circumflexasciicode\superscriptcatcode} + +\let\permitcaretescape\permitcircumflexescape + \newcatcodetable\dummycatcodes \long\normalprotected\def\startextendcatcodetable#1#2\stopextendcatcodetable @@ -111,7 +149,7 @@ %D mechanism? Future versions of \MKIV\ might only use %D active characters for very special cases. -\chardef\activehackcode=`\~ +\setnewconstant\activehackcode \tildeasciicode %D Once a catcode is assigned, the next assignments will happen faster. @@ -187,7 +225,7 @@ \uppercase{\normalprotected\xdef~{\noexpand\catcodecommand{\number\cctcounterb}}}% \egroup} -\chardef\defaultcatcodetable\zerocount +\newconstant\defaultcatcodetable \def\catcodecommand#1% {\csname CCC:\number @@ -197,8 +235,7 @@ :\number#1\endcsname} %D \macros -%D {restorecatcodes, -%D beginrestorecatcodes,endrestorecatcodes} +%D {restorecatcodes,pushcatcodetable,popcatcodetable} %D %D We're not finished dealing \CATCODES\ yet. In \CONTEXT\ we %D use only one auxiliary file, which deals with tables of @@ -210,16 +247,19 @@ %D what the next macros do. Saving the catcodes can be %D disabled by saying \type{\localcatcodestrue}. +% quite likely we will define \unexpanded earlier on so +% that \normalprotected will go + \let\savedcatcodetable\relax \newcount\catcoderestorelevel -\def\pushcatcodetable +\normalprotected\def\pushcatcodetable {\advance\catcoderestorelevel\plusone \tracepushcatcodetable \expandafter\chardef\csname scct:\number\catcoderestorelevel\endcsname\currentcatcodetable} -\def\popcatcodetable +\normalprotected\def\popcatcodetable {\ifcase\catcoderestorelevel \showcatcodenestingerror \else @@ -228,22 +268,22 @@ \advance\catcoderestorelevel\minusone \fi} -\def\showcatcodenestingerror % can be overloaded +\normalprotected\def\showcatcodenestingerror % can be overloaded {\immediate\write16{}% \immediate\write16{Fatal error: catcode push/pop mismatch. Fix this!}\wait\end \immediate\write16{}} -\def\restorecatcodes % takes previous level +\normalprotected\def\restorecatcodes % takes previous level {\ifnum\catcoderestorelevel>\plusone \expandafter\catcodetable\csname scct:\number\numexpr\catcoderestorelevel-1\relax\endcsname \fi} \newtoks\everycatcodetable -\def\setcatcodetable#1% - {\catcodetable#1% - \the\everycatcodetable - \tracesetcatcodetable} +\normalprotected\def\setcatcodetable#1% + {\catcodetable#1% + \the\everycatcodetable + \tracesetcatcodetable} \def\dotracecatcodetable#1{\immediate\write16{[#1]}} @@ -272,46 +312,43 @@ \let\tracepushcatcodetable\empty \let\tracepopcatcodetable \empty -\def\beginrestorecatcodes{\pushcatcodetable} -\def\endrestorecatcodes {\popcatcodetable} - %D Handy for debugging: % \tracecatcodetables -%D Only in \MKIV\ (to be used when crossing pages with changed catcodes -%D in the current vector): -%D -%D \starttyping -%D \normalprotected\def\startcrap -%D {\bgroup -%D \pushcatcodes -%D \whitespace -%D \obeylines -%D \activatespacehandler\v!yes -%D \strut} -%D -%D \normalprotected\def\stopcrap -%D {\popcatcodes -%D \egroup} -%D \stoptyping - -\newcount\catcodetablelevel - -\def\pushcatcodes - {\bgroup - \global\advance\catcodetablelevel\plusone - \ifcsname @@ccf:\number\catcodetablelevel\endcsname \else - \global\advance\cctdefcounter\plusone - \expandafter\global\expandafter\chardef\csname @@ccf:\number\catcodetablelevel\endcsname\cctdefcounter - \fi - \catcodetable\ctxcatcodes - \expandafter\savecatcodetable\csname @@ccf:\number\catcodetablelevel\endcsname - \egroup - \expandafter\catcodetable\csname @@ccf:\number\catcodetablelevel\endcsname} - -\def\popcatcodes - {\global\advance\catcodetablelevel\minusone} +% D Only in \MKIV\ (to be used when crossing pages with changed catcodes +% D in the current vector): +% D +% D \starttyping +% D \normalprotected\def\startcrap +% D {\bgroup +% D \pushcatcodes +% D \whitespace +% D \obeylines +% D \activatespacehandler\v!yes +% D \strut} +% D +% D \normalprotected\def\stopcrap +% D {\popcatcodes +% D \egroup} +% D \stoptyping +% +% \newcount\catcodetablelevel +% +% \def\pushcatcodes +% {\bgroup +% \global\advance\catcodetablelevel\plusone +% \ifcsname @@ccf:\number\catcodetablelevel\endcsname \else +% \global\advance\cctdefcounter\plusone +% \expandafter\global\expandafter\chardef\csname @@ccf:\number\catcodetablelevel\endcsname\cctdefcounter +% \fi +% \catcodetable\ctxcatcodes +% \expandafter\savecatcodetable\csname @@ccf:\number\catcodetablelevel\endcsname +% \egroup +% \expandafter\catcodetable\csname @@ccf:\number\catcodetablelevel\endcsname} +% +% \def\popcatcodes +% {\global\advance\catcodetablelevel\minusone} \endinput diff --git a/Master/texmf-dist/tex/context/base/catc-sym.mkii b/Master/texmf-dist/tex/context/base/catc-sym.mkii new file mode 100644 index 00000000000..91cac5f90d7 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/catc-sym.mkii @@ -0,0 +1,187 @@ +%D \module +%D [ file=catc-sym, +%D version=1997.01.03, % moved code +%D title=\CONTEXT\ Catcode Macros, +%D subtitle=Some Handy Constants, +%D author=Hans Hagen, +%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. + +% we now have loaded syst-* so we have all @@catcode constants + +%D We want to have access to the raw alternatives of the +%D special characters. We use a \type {\xdef} instead of +%D \type {\let} because we need an expandable token in a +%D \type {\write}. + +\bgroup + +\catcode`B=\begingroupcatcode +\catcode`E=\endgroupcatcode +\catcode`.=\escapecatcode + +.catcode `.{ 12 .xdef .letteropenbrace B.string{E +.catcode `.} 12 .xdef .letterclosebrace B.string}E +.catcode `.& 12 .xdef .letterampersand B.string&E +.catcode `.< 12 .xdef .letterless B.string 12 .xdef .lettermore B.string>E +.catcode `.# 12 .xdef .letterhash B.string#E +.catcode `." 12 .xdef .letterdoublequote B.string"E +.catcode `.' 12 .xdef .lettersinglequote B.string'E +.catcode `.$ 12 .xdef .letterdollar B.string$E +.catcode `.% 12 .xdef .letterpercent B.string%E +.catcode `.^ 12 .xdef .letterhat B.string^E +.catcode `._ 12 .xdef .letterunderscore B.string_E +.catcode `.| 12 .xdef .letterbar B.string|E +.catcode `.~ 12 .xdef .lettertilde B.string~E +.catcode `.\ 12 .xdef .letterbackslash B.string\E +.catcode `./ 12 .xdef .letterslash B.string/E +.catcode `.? 12 .xdef .letterquestionmark B.string?E +.catcode `.! 12 .xdef .letterexclamationmark B.string!E +.catcode `.@ 12 .xdef .letterat B.string@E +.catcode `.: 12 .xdef .lettercolon B.string:E + + .global .let .letterescape .letterbackslash + .global .let .letterbgroup .letteropenbrace + .global .let .letteregroup .letterclosebrace + .global .let .letterleftbrace .letteropenbrace + .global .let .letterrightbrace .letterclosebrace + +.egroup + +%D \macros +%D {uncatcodespecials,setnaturalcatcodes,setnormalcatcodes, +%D uncatcodecharacters,uncatcodeallcharacters, +%D uncatcodespacetokens} +%D +%D The following macros are more or less replaced by switching +%D to a catcode table (which we simulate in \MKII) but we keep +%D them for convenience and compatibility. Some old engine code +%D has been removed. + +\def\uncatcodespecials {\setcatcodetable\nilcatcodes \uncatcodespacetokens} +\def\setnaturalcatcodes {\setcatcodetable\nilcatcodes} +\def\setnormalcatcodes {\setcatcodetable\ctxcatcodes} % maybe \texcatcodes +\def\uncatcodecharacters {\setcatcodetable\nilcatcodes} % was fast version, gone now +\def\uncatcodeallcharacters{\setcatcodetable\nilcatcodes} % was slow one, with restore + +\def\uncatcodespacetokens + {\catcode\spaceasciicode \spacecatcode + \catcode\formfeedasciicode \ignorecatcode + \catcode\endoflineasciicode\endoflinecatcode + \catcode\delasciicode \ignorecatcode} + +%D \macros +%D {setverbosecharacter,setverbosecscharacters} +%D +%D Next follows a definition that lets some shortcuts expand to +%D themselves. This macro is meant for \POSTSCRIPT\ and \PDF\ +%D code passed on to the backend. + +\newtoks\everyverbosechacters + +\def\setverbosecscharacter#1% + {\edef#1{\string#1}} + +\def\setverbosecscharacters + {\the\everyverbosechacters} + +\bgroup + + % if used often we can move the code inline + + \catcode\barasciicode \activecatcode + \catcode\tildeasciicode\activecatcode + + \global \everyverbosechacters = + {\setverbosecscharacter |\setverbosecscharacter ~% context specific + \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\/} + +\egroup + +%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 +%D backslash, dollar, ampersand, hash and some more characters get +%D their special meaning. If you want to process tokens under a +%D certain catcode regime, passing arguments can interfere badly. +%D +%D \startbuffer[a] +%D \def\whatever#1{[#1]} +%D \whatever{whatever \type {\whatever{you want}} $or$ not!} +%D \stopbuffer +%D +%D \typebuffer[a] +%D +%D Here we pass an argument to \type {\whatever} but part of that +%D argument is to be processed under a different catcode regime, i.e.\ +%D all characters that need to be typeset verbatim need to get +%D the catcode that makes it a letter. This is what we get when we typeset +%D the text verbatim: +%D +%D \starttyping +%D whatever \type {\whatever{you want}} $or$ not! +%D \stoptyping +%D +%D However, when passed to \type {\whatever} we get: +%D +%D \getbuffer[a] +%D +%D In \ETEX\ one can use \type {\scantokens} to circumvent this problem. +%D +%D \startbuffer[b] +%D \def\rescan#1{\scantokens{#1}} +%D \def\whatever#1{[\rescan{#1}]} +%D \whatever{whatever \type {\whatever{you want}} $or$ not!} +%D \stopbuffer +%D +%D \getbuffer[b] \typebuffer[b] +%D +%D This time the \type {\whatever} call gives: +%D +%D \getbuffer[b] +%D +%D In this example, two spaces have crept in. The first one, after the +%D macro name, is inserted by \TEX\ and cannot be avoided. The last space +%D is inserted by \type {\scantokens}, and is the consequence of the fact +%D that this macro mimics reading from a file. You can avoid the last +%D space by a slightly different definition: +%D +%D \startbuffer[c] +%D \def\rescan#1{\scantokens{#1\ignorespaces}} +%D \def\whatever#1{[\rescan{#1}]} +%D \whatever{whatever \type {\whatever{you want}} $or$ not!} +%D \stopbuffer +%D +%D \typebuffer[c] +%D +%D Unfortunately we still keep the first space, but at least it's better than +%D a failure: +%D +%D \getbuffer[c] + +\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 + +\endinput diff --git a/Master/texmf-dist/tex/context/base/catc-sym.mkiv b/Master/texmf-dist/tex/context/base/catc-sym.mkiv new file mode 100644 index 00000000000..91cac5f90d7 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/catc-sym.mkiv @@ -0,0 +1,187 @@ +%D \module +%D [ file=catc-sym, +%D version=1997.01.03, % moved code +%D title=\CONTEXT\ Catcode Macros, +%D subtitle=Some Handy Constants, +%D author=Hans Hagen, +%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. + +% we now have loaded syst-* so we have all @@catcode constants + +%D We want to have access to the raw alternatives of the +%D special characters. We use a \type {\xdef} instead of +%D \type {\let} because we need an expandable token in a +%D \type {\write}. + +\bgroup + +\catcode`B=\begingroupcatcode +\catcode`E=\endgroupcatcode +\catcode`.=\escapecatcode + +.catcode `.{ 12 .xdef .letteropenbrace B.string{E +.catcode `.} 12 .xdef .letterclosebrace B.string}E +.catcode `.& 12 .xdef .letterampersand B.string&E +.catcode `.< 12 .xdef .letterless B.string 12 .xdef .lettermore B.string>E +.catcode `.# 12 .xdef .letterhash B.string#E +.catcode `." 12 .xdef .letterdoublequote B.string"E +.catcode `.' 12 .xdef .lettersinglequote B.string'E +.catcode `.$ 12 .xdef .letterdollar B.string$E +.catcode `.% 12 .xdef .letterpercent B.string%E +.catcode `.^ 12 .xdef .letterhat B.string^E +.catcode `._ 12 .xdef .letterunderscore B.string_E +.catcode `.| 12 .xdef .letterbar B.string|E +.catcode `.~ 12 .xdef .lettertilde B.string~E +.catcode `.\ 12 .xdef .letterbackslash B.string\E +.catcode `./ 12 .xdef .letterslash B.string/E +.catcode `.? 12 .xdef .letterquestionmark B.string?E +.catcode `.! 12 .xdef .letterexclamationmark B.string!E +.catcode `.@ 12 .xdef .letterat B.string@E +.catcode `.: 12 .xdef .lettercolon B.string:E + + .global .let .letterescape .letterbackslash + .global .let .letterbgroup .letteropenbrace + .global .let .letteregroup .letterclosebrace + .global .let .letterleftbrace .letteropenbrace + .global .let .letterrightbrace .letterclosebrace + +.egroup + +%D \macros +%D {uncatcodespecials,setnaturalcatcodes,setnormalcatcodes, +%D uncatcodecharacters,uncatcodeallcharacters, +%D uncatcodespacetokens} +%D +%D The following macros are more or less replaced by switching +%D to a catcode table (which we simulate in \MKII) but we keep +%D them for convenience and compatibility. Some old engine code +%D has been removed. + +\def\uncatcodespecials {\setcatcodetable\nilcatcodes \uncatcodespacetokens} +\def\setnaturalcatcodes {\setcatcodetable\nilcatcodes} +\def\setnormalcatcodes {\setcatcodetable\ctxcatcodes} % maybe \texcatcodes +\def\uncatcodecharacters {\setcatcodetable\nilcatcodes} % was fast version, gone now +\def\uncatcodeallcharacters{\setcatcodetable\nilcatcodes} % was slow one, with restore + +\def\uncatcodespacetokens + {\catcode\spaceasciicode \spacecatcode + \catcode\formfeedasciicode \ignorecatcode + \catcode\endoflineasciicode\endoflinecatcode + \catcode\delasciicode \ignorecatcode} + +%D \macros +%D {setverbosecharacter,setverbosecscharacters} +%D +%D Next follows a definition that lets some shortcuts expand to +%D themselves. This macro is meant for \POSTSCRIPT\ and \PDF\ +%D code passed on to the backend. + +\newtoks\everyverbosechacters + +\def\setverbosecscharacter#1% + {\edef#1{\string#1}} + +\def\setverbosecscharacters + {\the\everyverbosechacters} + +\bgroup + + % if used often we can move the code inline + + \catcode\barasciicode \activecatcode + \catcode\tildeasciicode\activecatcode + + \global \everyverbosechacters = + {\setverbosecscharacter |\setverbosecscharacter ~% context specific + \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\/} + +\egroup + +%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 +%D backslash, dollar, ampersand, hash and some more characters get +%D their special meaning. If you want to process tokens under a +%D certain catcode regime, passing arguments can interfere badly. +%D +%D \startbuffer[a] +%D \def\whatever#1{[#1]} +%D \whatever{whatever \type {\whatever{you want}} $or$ not!} +%D \stopbuffer +%D +%D \typebuffer[a] +%D +%D Here we pass an argument to \type {\whatever} but part of that +%D argument is to be processed under a different catcode regime, i.e.\ +%D all characters that need to be typeset verbatim need to get +%D the catcode that makes it a letter. This is what we get when we typeset +%D the text verbatim: +%D +%D \starttyping +%D whatever \type {\whatever{you want}} $or$ not! +%D \stoptyping +%D +%D However, when passed to \type {\whatever} we get: +%D +%D \getbuffer[a] +%D +%D In \ETEX\ one can use \type {\scantokens} to circumvent this problem. +%D +%D \startbuffer[b] +%D \def\rescan#1{\scantokens{#1}} +%D \def\whatever#1{[\rescan{#1}]} +%D \whatever{whatever \type {\whatever{you want}} $or$ not!} +%D \stopbuffer +%D +%D \getbuffer[b] \typebuffer[b] +%D +%D This time the \type {\whatever} call gives: +%D +%D \getbuffer[b] +%D +%D In this example, two spaces have crept in. The first one, after the +%D macro name, is inserted by \TEX\ and cannot be avoided. The last space +%D is inserted by \type {\scantokens}, and is the consequence of the fact +%D that this macro mimics reading from a file. You can avoid the last +%D space by a slightly different definition: +%D +%D \startbuffer[c] +%D \def\rescan#1{\scantokens{#1\ignorespaces}} +%D \def\whatever#1{[\rescan{#1}]} +%D \whatever{whatever \type {\whatever{you want}} $or$ not!} +%D \stopbuffer +%D +%D \typebuffer[c] +%D +%D Unfortunately we still keep the first space, but at least it's better than +%D a failure: +%D +%D \getbuffer[c] + +\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 + +\endinput diff --git a/Master/texmf-dist/tex/context/base/catc-sym.tex b/Master/texmf-dist/tex/context/base/catc-sym.tex deleted file mode 100644 index 067e192c85a..00000000000 --- a/Master/texmf-dist/tex/context/base/catc-sym.tex +++ /dev/null @@ -1,187 +0,0 @@ -%D \module -%D [ file=catc-sym, -%D version=1997.01.03, % moved code -%D title=\CONTEXT\ Catcode Macros, -%D subtitle=Some Handy Constants, -%D author=Hans Hagen, -%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. - -% we now have loaded syst-* so we have all @@catcode constants - -%D We want to have access to the raw alternatives of the -%D special characters. We use a \type {\xdef} instead of -%D \type {\let} because we need an expandable token in a -%D \type {\write}. - -\bgroup - -\catcode`B=\begingroupcatcode -\catcode`E=\endgroupcatcode -\catcode`.=\escapecatcode - -.catcode `.{ 12 .xdef .letteropenbrace B.string{E -.catcode `.} 12 .xdef .letterclosebrace B.string}E -.catcode `.& 12 .xdef .letterampersand B.string&E -.catcode `.< 12 .xdef .letterless B.string 12 .xdef .lettermore B.string>E -.catcode `.# 12 .xdef .letterhash B.string#E -.catcode `." 12 .xdef .letterdoublequote B.string"E -.catcode `.' 12 .xdef .lettersinglequote B.string'E -.catcode `.$ 12 .xdef .letterdollar B.string$E -.catcode `.% 12 .xdef .letterpercent B.string%E -.catcode `.^ 12 .xdef .letterhat B.string^E -.catcode `._ 12 .xdef .letterunderscore B.string_E -.catcode `.| 12 .xdef .letterbar B.string|E -.catcode `.~ 12 .xdef .lettertilde B.string~E -.catcode `.\ 12 .xdef .letterbackslash B.string\E -.catcode `./ 12 .xdef .letterslash B.string/E -.catcode `.? 12 .xdef .letterquestionmark B.string?E -.catcode `.! 12 .xdef .letterexclamationmark B.string!E -.catcode `.@ 12 .xdef .letterat B.string@E -.catcode `.: 12 .xdef .lettercolon B.string:E - - .global .let .letterescape .letterbackslash - .global .let .letterbgroup .letteropenbrace - .global .let .letteregroup .letterclosebrace - .global .let .letterleftbrace .letteropenbrace - .global .let .letterrightbrace .letterclosebrace - -.egroup - -%D \macros -%D {uncatcodespecials,setnaturalcatcodes,setnormalcatcodes, -%D uncatcodecharacters,uncatcodeallcharacters, -%D uncatcodespacetokens} -%D -%D The following macros are more or less replaced by switching -%D to a catcode table (which we simulate in \MKII) but we keep -%D them for convenience and compatibility. Some old engine code -%D has been removed. - -\def\uncatcodespecials {\setcatcodetable\nilcatcodes \uncatcodespacetokens} -\def\setnaturalcatcodes {\setcatcodetable\nilcatcodes} -\def\setnormalcatcodes {\setcatcodetable\ctxcatcodes} % maybe \texcatcodes -\def\uncatcodecharacters {\setcatcodetable\nilcatcodes} % was fast version, gone now -\def\uncatcodeallcharacters{\setcatcodetable\nilcatcodes} % was slow one, with restore - -\def\uncatcodespacetokens - {\catcode`\ =\spacecatcode - \catcode`\^^L=\ignorecatcode - \catcode`\^^M=\endoflinecatcode - \catcode`\^^?=\ignorecatcode} - -%D \macros -%D {setverbosecharacter,setverbosecscharacters} -%D -%D Next follows a definition that lets some shortcuts expand to -%D themselves. This macro is meant for \POSTSCRIPT\ and \PDF\ -%D code passed on to the backend. - -\newtoks\everyverbosechacters - -\def\setverbosecscharacter#1% - {\edef#1{\string#1}} - -\def\setverbosecscharacters - {\the\everyverbosechacters} - -\bgroup - - % if used often we can move the code inline - - \catcode`\|=\activecatcode - \catcode`\~=\activecatcode - - \global \everyverbosechacters = - {\setverbosecscharacter |\setverbosecscharacter ~% context specific - \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\/} - -\egroup - -%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 -%D backslash, dollar, ampersand, hash and some more characters get -%D their special meaning. If you want to process tokens under a -%D certain catcode regime, passing arguments can interfere badly. -%D -%D \startbuffer[a] -%D \def\whatever#1{[#1]} -%D \whatever{whatever \type {\whatever{you want}} $or$ not!} -%D \stopbuffer -%D -%D \typebuffer[a] -%D -%D Here we pass an argument to \type {\whatever} but part of that -%D argument is to be processed under a different catcode regime, i.e.\ -%D all characters that need to be typeset verbatim need to get -%D the catcode that makes it a letter. This is what we get when we typeset -%D the text verbatim: -%D -%D \starttyping -%D whatever \type {\whatever{you want}} $or$ not! -%D \stoptyping -%D -%D However, when passed to \type {\whatever} we get: -%D -%D \getbuffer[a] -%D -%D In \ETEX\ one can use \type {\scantokens} to circumvent this problem. -%D -%D \startbuffer[b] -%D \def\rescan#1{\scantokens{#1}} -%D \def\whatever#1{[\rescan{#1}]} -%D \whatever{whatever \type {\whatever{you want}} $or$ not!} -%D \stopbuffer -%D -%D \getbuffer[b] \typebuffer[b] -%D -%D This time the \type {\whatever} call gives: -%D -%D \getbuffer[b] -%D -%D In this example, two spaces have crept in. The first one, after the -%D macro name, is inserted by \TEX\ and cannot be avoided. The last space -%D is inserted by \type {\scantokens}, and is the consequence of the fact -%D that this macro mimics reading from a file. You can avoid the last -%D space by a slightly different definition: -%D -%D \startbuffer[c] -%D \def\rescan#1{\scantokens{#1\ignorespaces}} -%D \def\whatever#1{[\rescan{#1}]} -%D \whatever{whatever \type {\whatever{you want}} $or$ not!} -%D \stopbuffer -%D -%D \typebuffer[c] -%D -%D Unfortunately we still keep the first space, but at least it's better than -%D a failure: -%D -%D \getbuffer[c] - -\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 - -\endinput diff --git a/Master/texmf-dist/tex/context/base/catc-xml.mkii b/Master/texmf-dist/tex/context/base/catc-xml.mkii new file mode 100644 index 00000000000..2349e01a247 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/catc-xml.mkii @@ -0,0 +1,114 @@ +%D \module +%D [ file=catc-xml, +%D version=2006.09.18, +%D title=\CONTEXT\ Catcode Macros, +%D subtitle=\XML\ Catcode Tables, +%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 Catcode Regimes / XML} + +\ifdefined \xmlcatcodesn \else \newcatcodetable \xmlcatcodesn \fi % normal +\ifdefined \xmlcatcodese \else \newcatcodetable \xmlcatcodese \fi % entitle +\ifdefined \xmlcatcodesr \else \newcatcodetable \xmlcatcodesr \fi % reduce + +\startcatcodetable \xmlcatcodesn + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode \endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\ampersandasciicode \activecatcode + \catcode`\< \activecatcode + \catcode`\> \othercatcode + \catcode`\" \othercatcode % probably not needed any more + \catcode`\/ \othercatcode % probably not needed any more + \catcode`\' \othercatcode % probably not needed any more + \catcode\tildeasciicode \othercatcode % probably not needed any more + \catcode\hashasciicode \othercatcode % probably not needed any more + \catcode\backslashasciicode \othercatcode % probably not needed any more +\stopcatcodetable + +\startcatcodetable \xmlcatcodese + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode \endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\ampersandasciicode \activecatcode + \catcode`\< \activecatcode + \catcode`\> \activecatcode + \catcode\hashasciicode \activecatcode + \catcode\dollarasciicode \activecatcode + \catcode\commentasciicode \activecatcode + \catcode\backslashasciicode \activecatcode + \catcode\circumflexasciicode\activecatcode + \catcode\underscoreasciicode\activecatcode + \catcode\leftbraceasciicode \activecatcode + \catcode\rightbraceasciicode\activecatcode + \catcode\barasciicode \activecatcode + \catcode\tildeasciicode \activecatcode +\stopcatcodetable + +\startcatcodetable \xmlcatcodesr + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode \endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\ampersandasciicode \activecatcode + \catcode`\< \activecatcode + \catcode`\> \activecatcode + \catcode\hashasciicode \activecatcode + \catcode\dollarasciicode \activecatcode + \catcode\commentasciicode \activecatcode + \catcode\backslashasciicode \activecatcode + \catcode\circumflexasciicode\activecatcode + \catcode\underscoreasciicode\activecatcode + \catcode\leftbraceasciicode \activecatcode + \catcode\rightbraceasciicode\activecatcode + \catcode\barasciicode \activecatcode + \catcode\tildeasciicode \activecatcode +\stopcatcodetable + +%D Next we hook in some active character definitions. + +\letcatcodecommand \xmlcatcodesn \ampersandasciicode \relax +\letcatcodecommand \xmlcatcodesn `\< \relax + +\letcatcodecommand \xmlcatcodese \ampersandasciicode \relax +\letcatcodecommand \xmlcatcodese `\< \relax + +\letcatcodecommand \xmlcatcodesr \ampersandasciicode \relax +\letcatcodecommand \xmlcatcodesr `\< \relax + +\letcatcodecommand \xmlcatcodese \hashasciicode \relax +\letcatcodecommand \xmlcatcodese \dollarasciicode \relax +\letcatcodecommand \xmlcatcodese \commentasciicode \relax +\letcatcodecommand \xmlcatcodese \backslashasciicode \relax +\letcatcodecommand \xmlcatcodese \circumflexasciicode \relax +\letcatcodecommand \xmlcatcodese \underscoreasciicode \relax +\letcatcodecommand \xmlcatcodese \leftbraceasciicode \relax +\letcatcodecommand \xmlcatcodese \rightbraceasciicode \relax +\letcatcodecommand \xmlcatcodese \barasciicode \relax +\letcatcodecommand \xmlcatcodese \tildeasciicode \relax + +\letcatcodecommand \xmlcatcodesr \hashasciicode \relax +\letcatcodecommand \xmlcatcodesr \dollarasciicode \relax +\letcatcodecommand \xmlcatcodesr \commentasciicode \relax +\letcatcodecommand \xmlcatcodesr \backslashasciicode \relax +\letcatcodecommand \xmlcatcodesr \circumflexasciicode \relax +\letcatcodecommand \xmlcatcodesr \underscoreasciicode \relax +\letcatcodecommand \xmlcatcodesr \leftbraceasciicode \relax +\letcatcodecommand \xmlcatcodesr \rightbraceasciicode \relax +\letcatcodecommand \xmlcatcodesr \barasciicode \relax +\letcatcodecommand \xmlcatcodesr \tildeasciicode \relax + +\let\xmlcatcodes \xmlcatcodesn % beware, in mkiv we use \notcatcodes + +\endinput diff --git a/Master/texmf-dist/tex/context/base/catc-xml.mkiv b/Master/texmf-dist/tex/context/base/catc-xml.mkiv new file mode 100644 index 00000000000..1f11d353a27 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/catc-xml.mkiv @@ -0,0 +1,133 @@ +%D \module +%D [ file=catc-xml, +%D version=2006.09.18, +%D title=\CONTEXT\ Catcode Macros, +%D subtitle=\XML\ Catcode Tables, +%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 Catcode Regimes / XML} + +\ifdefined \xmlcatcodesn \else \newcatcodetable \xmlcatcodesn \fi % normal +\ifdefined \xmlcatcodese \else \newcatcodetable \xmlcatcodese \fi % entitle +\ifdefined \xmlcatcodesr \else \newcatcodetable \xmlcatcodesr \fi % reduce + +\startcatcodetable \xmlcatcodesn + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode \endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\ampersandasciicode \activecatcode + \catcode`\< \activecatcode + \catcode`\> \othercatcode + \catcode`\" \othercatcode % probably not needed any more + \catcode`\/ \othercatcode % probably not needed any more + \catcode`\' \othercatcode % probably not needed any more + \catcode\tildeasciicode \othercatcode % probably not needed any more + \catcode\hashasciicode \othercatcode % probably not needed any more + \catcode\backslashasciicode \othercatcode % probably not needed any more +\stopcatcodetable + +\startcatcodetable \xmlcatcodese + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode \endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\ampersandasciicode \activecatcode + \catcode`\< \activecatcode + \catcode`\> \activecatcode + \catcode\hashasciicode \activecatcode + \catcode\dollarasciicode \activecatcode + \catcode\commentasciicode \activecatcode + \catcode\backslashasciicode \activecatcode + \catcode\circumflexasciicode\activecatcode + \catcode\underscoreasciicode\activecatcode + \catcode\leftbraceasciicode \activecatcode + \catcode\rightbraceasciicode\activecatcode + \catcode\barasciicode \activecatcode + \catcode\tildeasciicode \activecatcode +\stopcatcodetable + +\startcatcodetable \xmlcatcodesr + \catcode\tabasciicode \spacecatcode + \catcode\endoflineasciicode \endoflinecatcode + \catcode\formfeedasciicode \endoflinecatcode + \catcode\spaceasciicode \spacecatcode + \catcode\endoffileasciicode \ignorecatcode + \catcode\ampersandasciicode \activecatcode + \catcode`\< \activecatcode + \catcode`\> \activecatcode + \catcode\hashasciicode \activecatcode + \catcode\dollarasciicode \activecatcode + \catcode\commentasciicode \activecatcode + \catcode\backslashasciicode \activecatcode + \catcode\circumflexasciicode\activecatcode + \catcode\underscoreasciicode\activecatcode + \catcode\leftbraceasciicode \activecatcode + \catcode\rightbraceasciicode\activecatcode + \catcode\barasciicode \activecatcode + \catcode\tildeasciicode \activecatcode +\stopcatcodetable + +%D Next we hook in some active character definitions. + +\letcatcodecommand \xmlcatcodesn \ampersandasciicode \relax +\letcatcodecommand \xmlcatcodesn `\< \relax + +\letcatcodecommand \xmlcatcodese \ampersandasciicode \relax +\letcatcodecommand \xmlcatcodese `\< \relax + +\letcatcodecommand \xmlcatcodesr \ampersandasciicode \relax +\letcatcodecommand \xmlcatcodesr `\< \relax + +\letcatcodecommand \xmlcatcodese \hashasciicode \relax +\letcatcodecommand \xmlcatcodese \dollarasciicode \relax +\letcatcodecommand \xmlcatcodese \commentasciicode \relax +\letcatcodecommand \xmlcatcodese \backslashasciicode \relax +\letcatcodecommand \xmlcatcodese \circumflexasciicode \relax +\letcatcodecommand \xmlcatcodese \underscoreasciicode \relax +\letcatcodecommand \xmlcatcodese \leftbraceasciicode \relax +\letcatcodecommand \xmlcatcodese \rightbraceasciicode \relax +\letcatcodecommand \xmlcatcodese \barasciicode \relax +\letcatcodecommand \xmlcatcodese \tildeasciicode \relax + +\letcatcodecommand \xmlcatcodesr \hashasciicode \relax +\letcatcodecommand \xmlcatcodesr \dollarasciicode \relax +\letcatcodecommand \xmlcatcodesr \commentasciicode \relax +\letcatcodecommand \xmlcatcodesr \backslashasciicode \relax +\letcatcodecommand \xmlcatcodesr \circumflexasciicode \relax +\letcatcodecommand \xmlcatcodesr \underscoreasciicode \relax +\letcatcodecommand \xmlcatcodesr \leftbraceasciicode \relax +\letcatcodecommand \xmlcatcodesr \rightbraceasciicode \relax +\letcatcodecommand \xmlcatcodesr \barasciicode \relax +\letcatcodecommand \xmlcatcodesr \tildeasciicode \relax + +\let\xmlcatcodes \xmlcatcodesn % beware, in mkiv we use \notcatcodes + +%D We register the catcodetables at the \LUA\ end where some further +%D initializations take place. + +\ctxlua { + characters.define( + { % letter catcodes + \number\xmlcatcodesn, + \number\xmlcatcodese, + \number\xmlcatcodesr, + }, + { % activate catcodes + \number\xmlcatcodesn, + \number\xmlcatcodese, + \number\xmlcatcodesr, + } + ) + catcodes.register("xmlcatcodes",\number\xmlcatcodes) +} + +\endinput diff --git a/Master/texmf-dist/tex/context/base/char-act.mkiv b/Master/texmf-dist/tex/context/base/char-act.mkiv index 2dc7823f0bf..1045d59758c 100644 --- a/Master/texmf-dist/tex/context/base/char-act.mkiv +++ b/Master/texmf-dist/tex/context/base/char-act.mkiv @@ -49,12 +49,12 @@ \def\controlspace{\hbox{\char32}} % rather tex \def\normalspace { } -\def\normalspaces{\catcode`\ =\@@space} +\def\normalspaces{\catcode\spaceasciicode\spacecatcode} \bgroup -\catcode`\ =\@@active -\gdef\obeyspaces{\catcode`\ =\@@active\def {\obeyedspace}} -\gdef\setcontrolspaces{\catcode`\ =\@@active\def {\controlspace}} +\catcode\spaceasciicode\activecatcode +\gdef\obeyspaces{\catcode\spaceasciicode\activecatcode\def {\obeyedspace}} +\gdef\setcontrolspaces{\catcode\spaceasciicode\activecatcode\def {\controlspace}} \egroup %D \macros @@ -66,27 +66,44 @@ %D \NEWPAGE\ character locally, we redefine the meaning of %D this (often already) active character. -\catcode`\^^L=\@@active \def^^L{\par} +% \bgroup \permitcircumflexescape + +% \catcode\formfeedasciicode\activecatcode + +% \gdef^^L{\par} + +% \egroup + +\expandafter\def\activeformfeedtoken{\par} %D The following indirect definitions enable us to implement %D all kind of \type{\obeyed} handlers. -\bgroup +% \bgroup \permitcircumflexescape -\catcode`\^^I=\@@active -\catcode`\^^M=\@@active -\catcode`\^^L=\@@active +% \catcode\tabasciicode \activecatcode +% \catcode\endoflineasciicode\activecatcode +% \catcode\formfeedasciicode \activecatcode -\gdef\obeytabs {\catcode`\^^I=\@@active\def^^I{\obeyedtab}} -\gdef\obeylines {\catcode`\^^M=\@@active\def^^M{\obeyedline}} -\gdef\obeypages {\catcode`\^^L=\@@active\def^^L{\obeyedpage}} +% \gdef\obeytabs {\catcode\tabasciicode \activecatcode\def^^I{\obeyedtab }} +% \gdef\obeylines {\catcode\endoflineasciicode\activecatcode\def^^M{\obeyedline}} +% \gdef\obeypages {\catcode\formfeedasciicode \activecatcode\def^^L{\obeyedpage}} -\gdef\ignoretabs {\catcode`\^^I=\@@active\def^^I{\obeyedspace}} -\gdef\ignorelines {\catcode`\^^M=\@@active\def^^M{\obeyedspace}} -\gdef\ignorepages {\catcode`\^^L=\@@ignore} % \@@active\def^^L{\obeyedline}} -\gdef\ignoreeofs {\catcode`\^^Z=\@@ignore} +% \gdef\ignoretabs {\catcode\tabasciicode \activecatcode\def^^I{\obeyedspace}} +% \gdef\ignorelines{\catcode\endoflineasciicode\activecatcode\def^^M{\obeyedspace}} +% \gdef\ignorepages{\catcode\formfeedasciicode \ignorecatcode} +% \gdef\ignoreeofs {\catcode\endoffileasciicode\ignorecatcode} -\egroup +% \egroup + +\def\obeytabs {\catcode\tabasciicode \activecatcode\expandafter\def\activetabtoken {\obeyedtab }} +\def\obeylines {\catcode\endoflineasciicode\activecatcode\expandafter\def\activeendoflinetoken{\obeyedline}} +\def\obeypages {\catcode\formfeedasciicode \activecatcode\expandafter\def\activeformfeedtoken {\obeyedpage}} + +\def\ignoretabs {\catcode\tabasciicode \activecatcode\expandafter\def\activetabtoken {\obeyedspace}} +\def\ignorelines{\catcode\endoflineasciicode\activecatcode\expandafter\def\activeendoflinetoken{\obeyedspace}} +\def\ignorepages{\catcode\formfeedasciicode \ignorecatcode} +\def\ignoreeofs {\catcode\endoffileasciicode\ignorecatcode} %D \macros %D {naturaltextext} @@ -102,19 +119,6 @@ \prettynaturalfont{\scantextokens\expandafter{\ascii}\ifhmode\unskip\fi}% \egroup} -%D What-a-mess: - -% \def\normalspacecodes -% {\catcode`\^^I = 10 -% \catcode`\^^M = 5 -% \catcode`\^^L = 5 -% \catcode`\ = 10 -% \catcode`\^^Z = 9 } - -% \appendtoks -% \normalspacecodes -% \to \everybeforeoutput - \endinput \protect % obsolete (old hack for idris) diff --git a/Master/texmf-dist/tex/context/base/char-cjk.lua b/Master/texmf-dist/tex/context/base/char-cjk.lua new file mode 100644 index 00000000000..067371c6478 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/char-cjk.lua @@ -0,0 +1,366 @@ +if not modules then modules = { } end modules ['char-cjk'] = { + version = 1.001, + comment = "companion to char-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local setmetatable = setmetatable +local insert = table.insert +local floor = math.floor +local format = string.format +local utfchar = utf.char + +local ranges = characters.ranges + +-- Hangul Syllable + +-- The following conversion is taken from unicode.org/reports/tr15/tr15-23.html#Hangul +-- but adapted to our needs. + +-- local SBase = 0xAC00 +-- +-- local LBase, LCount = 0x1100, 19 +-- local VBase, VCount = 0x1161, 21 +-- local TBase, TCount = 0x11A7, 28 +-- +-- local NCount = VCount * TCount +-- local SCount = LCount * NCount +-- +-- local function decomposed(unicode) +-- local SIndex = unicode - SBase +-- if SIndex >= 0 and SIndex < SCount then +-- local lead_consonant = LBase + floor( SIndex / NCount) +-- local medial_vowel = VBase + floor((SIndex % NCount) / TCount) +-- local tail_consonant = TBase + SIndex % TCount +-- if tail_consonant ~= TBase then +-- return lead_consonant, medial_vowel, tail_consonant +-- else +-- return lead_consonant, medial_vowel +-- end +-- end +-- end +-- +-- Lua will optimize the inline constants so the next variant is +-- 10% faster. In practice this will go unnoticed, but it's also less +-- code, so let's do it. Pushing the constant section into the +-- function body saves 5%. + +local function decomposed(unicode) + local index = unicode - 0xAC00 + if index >= 0 and index < 19 * 21 * 28 then + local lead_consonant = 0x1100 + floor( index / (21 * 28)) + local medial_vowel = 0x1161 + floor((index % (21 * 28)) / 28) + local tail_consonant = 0x11A7 + index % 28 + if tail_consonant ~= 0x11A7 then + return lead_consonant, medial_vowel, tail_consonant + else + return lead_consonant, medial_vowel + end + end +end + +local lead_consonants = { [0] = + "G", "GG", "N", "D", "DD", "R", "M", "B", "BB", + "S", "SS", "", "J", "JJ", "C", "K", "T", "P", "H" +} + +local medial_vowels = { [0] = + "A", "AE", "YA", "YAE", "EO", "E", "YEO", "YE", "O", + "WA", "WAE", "OE", "YO", "U", "WEO", "WE", "WI", + "YU", "EU", "YI", "I" +} + +local tail_consonants = { [0] = + "", "G", "GG", "GS", "N", "NJ", "NH", "D", "L", "LG", "LM", + "LB", "LS", "LT", "LP", "LH", "M", "B", "BS", + "S", "SS", "NG", "J", "C", "K", "T", "P", "H" +} + +-- local function description(unicode) +-- local index = unicode - 0xAC00 +-- if index >= 0 and index < 19 * 21 * 28 then +-- local lead_consonant = floor( index / NCount) +-- local medial_vowel = floor((index % NCount) / TCount) +-- local tail_consonant = index % TCount +-- return format( +-- "HANGUL SYLLABLE %s%s%s", +-- lead_consonants[lead_consonant], +-- medial_vowels [medial_vowel ], +-- tail_consonants[tail_consonant] +-- ) +-- end +-- end + +local function description(unicode) + local index = unicode - 0xAC00 + if index >= 0 and index < 19 * 21 * 28 then + local lead_consonant = floor( index / (21 * 28)) + local medial_vowel = floor((index % (21 * 28)) / 28) + local tail_consonant = index % 28 + return format( + "HANGUL SYLLABLE %s%s%s", + lead_consonants[lead_consonant], + medial_vowels [medial_vowel ], + tail_consonants[tail_consonant] + ) + end +end + +-- so far + +-- We have a [lead consonant,medial vowel,tail consonant] where the last one +-- is optional. For sort ranges we need the first one but some are collapsed. +-- Beware, we map to modern so the font should support it. + +local function leadconsonant(unicode) + return + -- unicode < 0xAC00 and nil -- original + -- unicode > 0xD7AF and nil or -- original + unicode >= 0xD558 and 0x314E or -- 하 => ㅎ + unicode >= 0xD30C and 0x314D or -- 파 => ㅍ + unicode >= 0xD0C0 and 0x314C or -- 타 => ㅌ + unicode >= 0xCE74 and 0x314B or -- 카 => ㅋ + unicode >= 0xCC28 and 0x314A or -- 차 => ㅊ + unicode >= 0xC790 and 0x3148 or -- 자 => ㅈ + unicode >= 0xC544 and 0x3147 or -- 아 => ㅇ + unicode >= 0xC0AC and 0x3145 or -- 사 => ㅅ + unicode >= 0xBC14 and 0x3142 or -- 바 => ㅂ + unicode >= 0xB9C8 and 0x3141 or -- 마 => ㅁ + unicode >= 0xB77C and 0x3139 or -- 라 => ㄹ + unicode >= 0xB2E4 and 0x3137 or -- 다 => ㄷ + unicode >= 0xB098 and 0x3134 or -- 나 => ㄴ + unicode >= 0xAC00 and 0x3131 or -- 가 => ㄱ + nil -- can't happen +end + +local remapped = { -- this might be merged into char-def.lua + [0x1100] = 0x3131, -- G + [0x1101] = 0x3132, -- GG + [0x1102] = 0x3134, -- N + [0x1103] = 0x3137, -- D + [0x1104] = 0x3138, -- DD + [0x1105] = 0x3139, -- R + -- [0X111A] = 0x3140, -- LH used for last sound + [0x1106] = 0x3141, -- M + [0x1107] = 0x3142, -- B + [0x1108] = 0x3143, -- BB + -- [0x1121] = 0x3144, -- BS used for last sound + [0x1109] = 0x3145, -- S + [0x110A] = 0x3146, -- SS + [0x110B] = 0x3147, -- (IEUNG) no sound but has form + [0x110C] = 0x3148, -- J + [0x110D] = 0x3149, -- JJ + [0x110E] = 0x314A, -- C + [0x110F] = 0x314B, -- K + [0x1110] = 0x314C, -- T + [0x1111] = 0x314D, -- P + [0x1112] = 0x314E, -- H + + [0x1161] = 0x314F, -- A + [0x1162] = 0x3150, -- AE + [0x1163] = 0x3151, -- YA + [0x1164] = 0x3152, -- YAE + [0x1165] = 0x3153, -- EO + [0x1166] = 0x3154, -- E + [0x1167] = 0x3155, -- YEO + [0x1168] = 0x3156, -- YE + [0x1169] = 0x3157, -- O + [0x116A] = 0x3158, -- WA + [0x116B] = 0x3159, -- WAE + [0x116C] = 0x315A, -- OE + [0x116D] = 0x315B, -- YO + [0x116E] = 0x315C, -- U + [0x116F] = 0x315D, -- WEO + [0x1170] = 0x315E, -- WE + [0x1171] = 0x315F, -- WI + [0x1172] = 0x3160, -- YU + [0x1173] = 0x3161, -- EU + [0x1174] = 0x3162, -- YI + [0x1175] = 0x3163, -- I + + [0x11A8] = 0x3131, -- G + [0x11A9] = 0x3132, -- GG + [0x11AA] = 0x3133, -- GS + [0x11AB] = 0x3134, -- N + [0x11AC] = 0x3135, -- NJ + [0x11AD] = 0x3136, -- NH + [0x11AE] = 0x3137, -- D + [0x11AF] = 0x3139, -- L + [0x11B0] = 0x313A, -- LG + [0x11B1] = 0x313B, -- LM + [0x11B2] = 0x313C, -- LB + [0x11B3] = 0x313D, -- LS + [0x11B4] = 0x313E, -- LT + [0x11B5] = 0x313F, -- LP + [0x11B6] = 0x3140, -- LH + [0x11B7] = 0x3141, -- M + [0x11B8] = 0x3142, -- B + [0x11B9] = 0x3144, -- BS + [0x11BA] = 0x3145, -- S + [0x11BB] = 0x3146, -- SS + [0x11BC] = 0x3147, -- NG + [0x11BD] = 0x3148, -- J + [0x11BE] = 0x314A, -- C + [0x11BF] = 0x314B, -- K + [0x11C0] = 0x314C, -- T + [0x11C1] = 0x314D, -- P + [0x11C2] = 0x314E, -- H +} + +characters.hangul = { + decomposed = decomposed, + description = description, + leadconsonant = leadconsonant, + remapped = remapped, +} + +-- so far + +local hangul_syllable_basetable = { + category = "lo", + cjkwd = "w", + description = "", + direction = "l", + linebreak = "h2", +} + +--~ local hangul_syllable_metatable = { +--~ __index = function(t,k) +--~ local u = t.unicodeslot +--~ if k == "fscode" then +--~ -- no need to cache this as we normally use fscodes +--~ return leadconsonant(u) +--~ elseif k == "shcode" then +--~ return { decomposed(u) } +--~ elseif k == "specials" then +--~ return { "char", decomposed(u) } +--~ elseif k == "description" then +--~ return description(u) +--~ else +--~ return hangul_syllable_basetable[k] +--~ end +--~ end +--~ } + +local hangul_syllable_metatable = { + __index = function(t,k) + local u = t.unicodeslot + if k == "fscode" then + return leadconsonant(u) + elseif k == "decomposed" then + return { decomposed(u) } + elseif k == "specials" then + return { "char", decomposed(u) } + elseif k == "description" then + return description(u) + else + return hangul_syllable_basetable[k] + end + end +} + +local hangul_syllable_extender = function(k,v) + local t = { + unicodeslot = k, + } + setmetatable(t,hangul_syllable_metatable) + return t +end + +local hangul_syllable_range = { + first = 0xAC00, + last = 0xD7A3, + extender = hangul_syllable_extender, +} + +setmetatable(hangul_syllable_range, hangul_syllable_metatable) + +-- CJK Ideograph + +local cjk_ideograph_metatable = { + __index = { + category = "lo", + cjkwd = "w", + description = "", + direction = "l", + linebreak = "id", + } +} + +local cjk_ideograph_extender = function(k,v) + local t = { + -- shcode = shcode, + unicodeslot = k, + } + setmetatable(t,cjk_ideograph_metatable) + return t +end + +local cjk_ideograph_range = { + first = 0x4E00, + last = 0x9FBB, + extender = cjk_ideograph_extender, +} + +-- CJK Ideograph Extension A + +local cjk_ideograph_extension_a_metatable = { + __index = { + category = "lo", + cjkwd = "w", + description = "", + direction = "l", + linebreak = "id", + } +} + +local cjk_ideograph_extension_a_extender = function(k,v) + local t = { + -- shcode = shcode, + unicodeslot = k, + } + setmetatable(t,cjk_ideograph_extension_a_metatable) + return t +end + +local cjk_ideograph_extension_a_range = { + first = 0x3400, + last = 0x4DB5, + extender = cjk_ideograph_extension_a_extender, +} + +-- CJK Ideograph Extension B + +local cjk_ideograph_extension_b_metatable = { + __index = { + category = "lo", + cjkwd = "w", + description = "", + direction = "l", + linebreak = "id", + } +} + +local cjk_ideograph_extension_b_extender = function(k,v) + local t = { + -- shcode = shcode, + unicodeslot = k, + } + setmetatable(t,cjk_ideograph_extension_b_metatable) + return t +end + +local cjk_ideograph_extension_b_range = { + first = 0x20000, + last = 0x2A6D6, + extender = cjk_ideograph_extension_b_extender, +} + +-- Ranges + +insert(ranges, hangul_syllable_range) +insert(ranges, cjk_ideograph_range) +insert(ranges, cjk_ideograph_extension_a_range) +insert(ranges, cjk_ideograph_extension_b_range) diff --git a/Master/texmf-dist/tex/context/base/char-cmp.lua b/Master/texmf-dist/tex/context/base/char-cmp.lua deleted file mode 100644 index c7deb79010f..00000000000 --- a/Master/texmf-dist/tex/context/base/char-cmp.lua +++ /dev/null @@ -1,268 +0,0 @@ -if not modules then modules = { } end modules ['char-cmp'] = { - version = 1.001, - comment = "companion to char-ini.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local utf = unicode.utf8 -local unpack = unpack or table.unpack - -characters = characters or { } -characters.uncomposed = characters.uncomposed or { } - ---[[ldx-- -

The code defined here may move to the big character table.

---ldx]]-- - -characters.basedigits = { - ['zero'] = 48, ['one'] = 49, - ['two'] = 50, ['three'] = 51, - ['four'] = 52, ['five'] = 53, - ['six'] = 54, ['seven'] = 55, - ['eight'] = 56, ['nine'] = 57 -} - ---[[ldx-- -

The next three tables can for instance be be used to enhance -kerning tables that lack kerning pairs for these special characters. -Of course they may come in handy elsewhere too

---ldx]]-- - --- we can use shcodes, but then we also need slcode and srcode --- --- AEligature --- => slcode == ub('A') --- => srcode == ub('E') --- or --- => shcode == { ub('A'), ub('E') } --- => reduction = "AE" --- --- eacute --- => shcode == ub('A') --- or --- => shcode == { ub('a') } --- => reduction = "a" - -characters.uncomposed.left = { - AEligature = "A", aeligature = "a", - OEligature = "O", oeligature = "o", - IJligature = "I", ijligature = "i", - AE = "A", ae = "a", - OE = "O", oe = "o", - IJ = "I", ij = "i", - Ssharp = "S", ssharp = "s", -} - -characters.uncomposed.right = { - AEligature = "E", aeligature = "e", - OEligature = "E", oeligature = "e", - IJligature = "J", ijligature = "j", - AE = "E", ae = "e", - OE = "E", oe = "e", - IJ = "J", ij = "j", - Ssharp = "S", ssharp = "s", -} - -characters.uncomposed.both = { - Acircumflex = "A", acircumflex = "a", - Ccircumflex = "C", ccircumflex = "c", - Ecircumflex = "E", ecircumflex = "e", - Gcircumflex = "G", gcircumflex = "g", - Hcircumflex = "H", hcircumflex = "h", - Icircumflex = "I", icircumflex = "i", - Jcircumflex = "J", jcircumflex = "j", - Ocircumflex = "O", ocircumflex = "o", - Scircumflex = "S", scircumflex = "s", - Ucircumflex = "U", ucircumflex = "u", - Wcircumflex = "W", wcircumflex = "w", - Ycircumflex = "Y", ycircumflex = "y", - - Agrave = "A", agrave = "a", - Egrave = "E", egrave = "e", - Igrave = "I", igrave = "i", - Ograve = "O", ograve = "o", - Ugrave = "U", ugrave = "u", - Ygrave = "Y", ygrave = "y", - - Atilde = "A", atilde = "a", - Itilde = "I", itilde = "i", - Otilde = "O", otilde = "o", - Utilde = "U", utilde = "u", - Ntilde = "N", ntilde = "n", - - Adiaeresis = "A", adiaeresis = "a", Adieresis = "A", adieresis = "a", - Ediaeresis = "E", ediaeresis = "e", Edieresis = "E", edieresis = "e", - Idiaeresis = "I", idiaeresis = "i", Idieresis = "I", idieresis = "i", - Odiaeresis = "O", odiaeresis = "o", Odieresis = "O", odieresis = "o", - Udiaeresis = "U", udiaeresis = "u", Udieresis = "U", udieresis = "u", - Ydiaeresis = "Y", ydiaeresis = "y", Ydieresis = "Y", ydieresis = "y", - - Aacute = "A", aacute = "a", - Cacute = "C", cacute = "c", - Eacute = "E", eacute = "e", - Iacute = "I", iacute = "i", - Lacute = "L", lacute = "l", - Nacute = "N", nacute = "n", - Oacute = "O", oacute = "o", - Racute = "R", racute = "r", - Sacute = "S", sacute = "s", - Uacute = "U", uacute = "u", - Yacute = "Y", yacute = "y", - Zacute = "Z", zacute = "z", - - Dstroke = "D", dstroke = "d", - Hstroke = "H", hstroke = "h", - Tstroke = "T", tstroke = "t", - - Cdotaccent = "C", cdotaccent = "c", - Edotaccent = "E", edotaccent = "e", - Gdotaccent = "G", gdotaccent = "g", - Idotaccent = "I", idotaccent = "i", - Zdotaccent = "Z", zdotaccent = "z", - - Amacron = "A", amacron = "a", - Emacron = "E", emacron = "e", - Imacron = "I", imacron = "i", - Omacron = "O", omacron = "o", - Umacron = "U", umacron = "u", - - Ccedilla = "C", ccedilla = "c", - Kcedilla = "K", kcedilla = "k", - Lcedilla = "L", lcedilla = "l", - Ncedilla = "N", ncedilla = "n", - Rcedilla = "R", rcedilla = "r", - Scedilla = "S", scedilla = "s", - Tcedilla = "T", tcedilla = "t", - - Ohungarumlaut = "O", ohungarumlaut = "o", - Uhungarumlaut = "U", uhungarumlaut = "u", - - Aogonek = "A", aogonek = "a", - Eogonek = "E", eogonek = "e", - Iogonek = "I", iogonek = "i", - Uogonek = "U", uogonek = "u", - - Aring = "A", aring = "a", - Uring = "U", uring = "u", - - Abreve = "A", abreve = "a", - Ebreve = "E", ebreve = "e", - Gbreve = "G", gbreve = "g", - Ibreve = "I", ibreve = "i", - Obreve = "O", obreve = "o", - Ubreve = "U", ubreve = "u", - - Ccaron = "C", ccaron = "c", - Dcaron = "D", dcaron = "d", - Ecaron = "E", ecaron = "e", - Lcaron = "L", lcaron = "l", - Ncaron = "N", ncaron = "n", - Rcaron = "R", rcaron = "r", - Scaron = "S", scaron = "s", - Tcaron = "T", tcaron = "t", - Zcaron = "Z", zcaron = "z", - - dotlessI = "I", dotlessi = "i", - dotlessJ = "J", dotlessj = "j", - - AEligature = "AE", aeligature = "ae", AE = "AE", ae = "ae", - OEligature = "OE", oeligature = "oe", OE = "OE", oe = "oe", - IJligature = "IJ", ijligature = "ij", IJ = "IJ", ij = "ij", - - Lstroke = "L", lstroke = "l", Lslash = "L", lslash = "l", - Ostroke = "O", ostroke = "o", Oslash = "O", oslash = "o", - - Ssharp = "SS", ssharp = "ss", - - Aumlaut = "A", aumlaut = "a", - Eumlaut = "E", eumlaut = "e", - Iumlaut = "I", iumlaut = "i", - Oumlaut = "O", oumlaut = "o", - Uumlaut = "U", uumlaut = "u", - -} - ---[[ldx-- -

The following function is used in the indexing code, where -we need some sort of default fallback mapping.

---ldx]]-- - -function characters.uncompose(n) -- n == string|number, returns string - local cdn - if type(n) == "string" then - cdn = characters.data[utf.byte(n)] - else - cdn = characters.data[n] - end - -- return characters.shape(n) - if cdn then - local shcode = cdn.shcode - if not shcode then - return characters.uncomposed.both[cdn.contextname] or n - elseif type(shcode) == "table" then - return utf.char(unpack(cdn.shcode)) - else - return utf.char(cdn.shcode) - end - end - return n -end - ---[[ldx-- -

Only characters with a code smaller than 128 make sense, -anything larger is encoding dependent. An interesting complication -is that a character can be in an encoding twice but is hashed -once.

---ldx]]-- - -characters.ligatures = { - ['f'] = { - { 'f', 'ff' }, - { 'i', 'fi' }, - { 'l', 'fl' }, - }, - ['ff'] = { - { 'i', 'ffi' } - }, - ['fi'] = { - { 'i', 'fii' } - }, - ['fl'] = { - { 'i', 'fli' } - }, - ['s'] = { - { 't', 'st' } - }, - ['i'] = { - { 'j', 'ij' } - }, -} - -characters.texligatures = { - -- ['space'] = { - -- { 'L', 'Lslash' }, - -- { 'l', 'lslash' } - -- }, - -- ['question'] = { - -- { 'quoteleft', 'questiondown' } - -- }, - -- ['exclam'] = { - -- { 'quoteleft', 'exclamdown' } - -- }, - ['quoteleft'] = { - { 'quoteleft', 'quotedblleft' } - }, - ['quoteright'] = { - { 'quoteright', 'quotedblright' } - }, - ['hyphen'] = { - { 'hyphen', 'endash' } - }, - ['endash'] = { - { 'hyphen', 'emdash' } - } -} - ---~ U+2019: right single quotation mark / quoteright diff --git a/Master/texmf-dist/tex/context/base/char-def.lua b/Master/texmf-dist/tex/context/base/char-def.lua index b7abee0fbf6..c830774cbfa 100644 --- a/Master/texmf-dist/tex/context/base/char-def.lua +++ b/Master/texmf-dist/tex/context/base/char-def.lua @@ -25,6 +25,7 @@ characters.data={ unicodeslot=0x0000, }, { + adobename="controlSTX", category="cc", description="START OF HEADING", direction="bn", @@ -32,6 +33,7 @@ characters.data={ unicodeslot=0x0001, }, { + adobename="controlSOT", category="cc", description="START OF TEXT", direction="bn", @@ -39,6 +41,7 @@ characters.data={ unicodeslot=0x0002, }, { + adobename="controlETX", category="cc", description="END OF TEXT", direction="bn", @@ -46,6 +49,7 @@ characters.data={ unicodeslot=0x0003, }, { + adobename="controlEOT", category="cc", description="END OF TRANSMISSION", direction="bn", @@ -53,6 +57,7 @@ characters.data={ unicodeslot=0x0004, }, { + adobename="controlENQ", category="cc", description="ENQUIRY", direction="bn", @@ -60,6 +65,7 @@ characters.data={ unicodeslot=0x0005, }, { + adobename="controlACK", category="cc", description="ACKNOWLEDGE", direction="bn", @@ -67,6 +73,7 @@ characters.data={ unicodeslot=0x0006, }, { + adobename="controlBEL", category="cc", description="BELL", direction="bn", @@ -74,6 +81,7 @@ characters.data={ unicodeslot=0x0007, }, { + adobename="controlBS", category="cc", description="BACKSPACE", direction="bn", @@ -81,6 +89,7 @@ characters.data={ unicodeslot=0x0008, }, { + adobename="controlHT", category="cc", description="CHARACTER TABULATION", direction="s", @@ -88,6 +97,7 @@ characters.data={ unicodeslot=0x0009, }, { + adobename="controlLF", category="cc", description="LINE FEED (LF)", direction="b", @@ -95,6 +105,7 @@ characters.data={ unicodeslot=0x000A, }, { + adobename="controlVT", category="cc", description="LINE TABULATION", direction="s", @@ -102,6 +113,7 @@ characters.data={ unicodeslot=0x000B, }, { + adobename="controlFF", category="cc", description="FORM FEED (FF)", direction="ws", @@ -109,6 +121,7 @@ characters.data={ unicodeslot=0x000C, }, { + adobename="controlCR", category="cc", description="CARRIAGE RETURN (CR)", direction="b", @@ -116,6 +129,7 @@ characters.data={ unicodeslot=0x000D, }, { + adobename="controlSO", category="cc", description="SHIFT OUT", direction="bn", @@ -123,6 +137,7 @@ characters.data={ unicodeslot=0x000E, }, { + adobename="controlSI", category="cc", description="SHIFT IN", direction="bn", @@ -130,6 +145,7 @@ characters.data={ unicodeslot=0x000F, }, { + adobename="controlDLE", category="cc", description="DATA LINK ESCAPE", direction="bn", @@ -137,6 +153,7 @@ characters.data={ unicodeslot=0x0010, }, { + adobename="controlDC1", category="cc", description="DEVICE CONTROL ONE", direction="bn", @@ -144,6 +161,7 @@ characters.data={ unicodeslot=0x0011, }, { + adobename="controlDC2", category="cc", description="DEVICE CONTROL TWO", direction="bn", @@ -151,6 +169,7 @@ characters.data={ unicodeslot=0x0012, }, { + adobename="controlDC3", category="cc", description="DEVICE CONTROL THREE", direction="bn", @@ -158,6 +177,7 @@ characters.data={ unicodeslot=0x0013, }, { + adobename="controlDC4", category="cc", description="DEVICE CONTROL FOUR", direction="bn", @@ -165,6 +185,7 @@ characters.data={ unicodeslot=0x0014, }, { + adobename="controlNAK", category="cc", description="NEGATIVE ACKNOWLEDGE", direction="bn", @@ -172,6 +193,7 @@ characters.data={ unicodeslot=0x0015, }, { + adobename="controlSYN", category="cc", description="SYNCHRONOUS IDLE", direction="bn", @@ -179,6 +201,7 @@ characters.data={ unicodeslot=0x0016, }, { + adobename="controlETB", category="cc", description="END OF TRANSMISSION BLOCK", direction="bn", @@ -186,6 +209,7 @@ characters.data={ unicodeslot=0x0017, }, { + adobename="controlCAN", category="cc", description="CANCEL", direction="bn", @@ -193,6 +217,7 @@ characters.data={ unicodeslot=0x0018, }, { + adobename="controlEM", category="cc", description="END OF MEDIUM", direction="bn", @@ -200,6 +225,7 @@ characters.data={ unicodeslot=0x0019, }, { + adobename="controlSUB", category="cc", description="SUBSTITUTE", direction="bn", @@ -207,6 +233,7 @@ characters.data={ unicodeslot=0x001A, }, { + adobename="controlESC", category="cc", description="ESCAPE", direction="bn", @@ -214,6 +241,7 @@ characters.data={ unicodeslot=0x001B, }, { + adobename="controlFS", category="cc", description="INFORMATION SEPARATOR FOUR", direction="b", @@ -221,6 +249,7 @@ characters.data={ unicodeslot=0x001C, }, { + adobename="controlGS", category="cc", description="INFORMATION SEPARATOR THREE", direction="b", @@ -228,6 +257,7 @@ characters.data={ unicodeslot=0x001D, }, { + adobename="controlRS", category="cc", description="INFORMATION SEPARATOR TWO", direction="b", @@ -235,6 +265,7 @@ characters.data={ unicodeslot=0x001E, }, { + adobename="controlUS", category="cc", description="INFORMATION SEPARATOR ONE", direction="s", @@ -267,8 +298,8 @@ characters.data={ contextname="quotedbl", description="QUOTATION MARK", direction="on", - mathclass="default", linebreak="qu", + mathclass="default", unicodeslot=0x0022, }, { @@ -372,10 +403,16 @@ characters.data={ description="COMMA", direction="cs", linebreak="is", - mathclass="punctuation", + mathclass="punctuation", -- redundant mathspec={ - { class="punctuation", name="textcomma" }, - { class="ord", name="mathcomma" }, + { + class="punctuation", + name="textcomma", + }, + { + class="ord", + name="mathcomma", + }, }, unicodeslot=0x002C, }, @@ -398,9 +435,18 @@ characters.data={ linebreak="is", mathclass="ord", mathspec={ - { class="ord", name="mathperiod" }, - { class="punctuation", name="textperiod" }, - { class="punctuation", name="ldotp" }, + { + class="ord", + name="mathperiod", + }, + { + class="punctuation", + name="textperiod", + }, + { + class="punctuation", + name="ldotp", + }, }, unicodeslot=0x002E, }, @@ -519,12 +565,11 @@ characters.data={ adobename="colon", category="po", cjkwd="na", + comment="mathclass=punctuation,mathname=colon", description="COLON", direction="cs", linebreak="is", ---~ mathclass="punctuation", mathclass="relation", --- mathname="colon", unicodeslot=0x003A, }, { @@ -544,7 +589,7 @@ characters.data={ description="LESS-THAN SIGN", direction="on", linebreak="al", - mathclass="binary", + mathclass="relation", mathname="lt", mirror=0x003E, unicodeslot=0x003C, @@ -553,10 +598,10 @@ characters.data={ adobename="equal", category="sm", cjkwd="na", + comment="mathclass=binary", description="EQUALS SIGN", direction="on", linebreak="al", ---~ mathclass="binary", mathclass="relation", mathname="eq", unicodeslot=0x003D, @@ -568,7 +613,7 @@ characters.data={ description="GREATER-THAN SIGN", direction="on", linebreak="al", - mathclass="binary", + mathclass="relation", mathname="gt", mirror=0x003C, unicodeslot=0x003E, @@ -685,6 +730,7 @@ characters.data={ adobename="I", category="lu", cjkwd="na", + contextname="dotlessI", description="LATIN CAPITAL LETTER I", direction="l", lccode=0x0069, @@ -696,6 +742,7 @@ characters.data={ adobename="J", category="lu", cjkwd="na", + contextname="dotlessJ", description="LATIN CAPITAL LETTER J", direction="l", lccode=0x006A, @@ -942,10 +989,10 @@ characters.data={ cjkwd="na", contextname="textgrave", description="GRAVE ACCENT", - mathclass="accent", - mathname="grave", direction="on", linebreak="al", + mathclass="accent", + mathname="grave", unicodeslot=0x0060, }, { @@ -1244,25 +1291,40 @@ characters.data={ direction="on", linebreak="op", mathclass="open", - mathname="lbrace", -- was false + mathname="lbrace", mirror=0x007D, unicodeslot=0x007B, }, { - adobename="bar", + adobename="verticalbar", category="sm", cjkwd="na", + comment="mathclass=binary,mathname=bar", contextname="textbar", description="VERTICAL LINE", direction="on", linebreak="ba", mathspec={ --- { class="binary", name="bar" }, - { class="nothing", name="arrowvert" }, - { class="delimiter", name="vert" }, - { class="open", name="lvert" }, - { class="close", name="rvert" }, - { class="relation", name="mid" }, + { + class="nothing", + name="arrowvert", + }, + { + class="delimiter", + name="vert", + }, + { + class="open", + name="lvert", + }, + { + class="close", + name="rvert", + }, + { + class="relation", + name="mid", + }, }, unicodeslot=0x007C, }, @@ -1275,7 +1337,7 @@ characters.data={ direction="on", linebreak="cl", mathclass="close", - mathname="rbrace", -- was false + mathname="rbrace", mirror=0x007B, unicodeslot=0x007D, }, @@ -1290,6 +1352,7 @@ characters.data={ unicodeslot=0x007E, }, { + adobename="controlDEL", category="cc", description="DELETE", direction="bn", @@ -1521,6 +1584,7 @@ characters.data={ unicodeslot=0x009F, }, { + adobename="nonbreakingspace", category="zs", contextname="nobreakspace", description="NO-BREAK SPACE", @@ -1655,12 +1719,19 @@ characters.data={ direction="on", linebreak="al", mathspec={ - { class="ord", name="lnot" }, - { class="ord", name="neg" }, + { + class="ord", + name="lnot", + }, + { + class="ord", + name="neg", + }, }, unicodeslot=0x00AC, }, { + adobename="softhyphen", category="cf", cjkwd="a", contextname="softhyphen", @@ -1715,6 +1786,7 @@ characters.data={ unicodeslot=0x00B1, }, { + adobename="twosuperior", category="no", cjkwd="a", contextname="twosuperior", @@ -1725,6 +1797,7 @@ characters.data={ unicodeslot=0x00B2, }, { + adobename="threesuperior", category="no", cjkwd="a", contextname="threesuperior", @@ -1748,7 +1821,7 @@ characters.data={ unicodeslot=0x00B4, }, { - adobename="mu", + adobename="mu1", category="ll", contextname="textmu", description="MICRO SIGN", @@ -1794,6 +1867,7 @@ characters.data={ unicodeslot=0x00B8, }, { + adobename="onesuperior", category="no", cjkwd="a", contextname="onesuperior", @@ -2245,7 +2319,7 @@ characters.data={ description="LATIN SMALL LETTER SHARP S", direction="l", linebreak="al", - uccodes={ 0x0053, 0x0053 }, + uccode={ 0x0053, 0x0053 }, unicodeslot=0x00DF, }, { @@ -2330,7 +2404,7 @@ characters.data={ description="LATIN SMALL LETTER AE", direction="l", linebreak="al", - shcode={ 0x00E6, 0x00EA }, + shcode={ 0x0061, 0x0065 }, uccode=0x00C6, unicodeslot=0x00E6, }, @@ -2451,7 +2525,7 @@ characters.data={ adobename="eth", category="ll", cjkwd="a", - --~ contextname="eth", -- AM: Should this be defined in text mode? + comment="contextname=eth", description="LATIN SMALL LETTER ETH", direction="l", linebreak="al", @@ -2838,7 +2912,7 @@ characters.data={ unicodeslot=0x010F, }, { - adobename="Dcroat", + adobename="Dslash", category="lu", contextname="Dstroke", description="LATIN CAPITAL LETTER D WITH STROKE", @@ -2849,7 +2923,7 @@ characters.data={ unicodeslot=0x0110, }, { - adobename="dcroat", + adobename="dmacron", category="ll", cjkwd="a", contextname="dstroke", @@ -3405,7 +3479,7 @@ characters.data={ unicodeslot=0x013E, }, { - adobename="Ldot", + adobename="Ldotaccent", category="lu", cjkwd="a", contextname="Ldotmiddle", @@ -3418,7 +3492,7 @@ characters.data={ unicodeslot=0x013F, }, { - adobename="ldot", + adobename="ldotaccent", category="ll", cjkwd="a", contextname="ldotmiddle", @@ -3529,7 +3603,7 @@ characters.data={ unicodeslot=0x0148, }, { - adobename="napostrophe", + adobename="quoterightn", category="ll", cjkwd="a", contextname="napostrophe", @@ -4176,7 +4250,7 @@ characters.data={ unicodeslot=0x017E, }, { - adobename="longs", + adobename="slong", category="ll", contextname="slong", description="LATIN SMALL LETTER LONG S", @@ -4187,6 +4261,7 @@ characters.data={ unicodeslot=0x017F, }, { + adobename="bstroke", category="ll", contextname="bstroke", description="LATIN SMALL LETTER B WITH STROKE", @@ -4197,6 +4272,7 @@ characters.data={ unicodeslot=0x0180, }, { + adobename="Bhook", category="lu", contextname="Bhook", description="LATIN CAPITAL LETTER B WITH HOOK", @@ -4207,6 +4283,7 @@ characters.data={ unicodeslot=0x0181, }, { + adobename="Btopbar", category="lu", description="LATIN CAPITAL LETTER B WITH TOPBAR", direction="l", @@ -4216,6 +4293,7 @@ characters.data={ unicodeslot=0x0182, }, { + adobename="btopbar", category="ll", description="LATIN SMALL LETTER B WITH TOPBAR", direction="l", @@ -4225,6 +4303,7 @@ characters.data={ unicodeslot=0x0183, }, { + adobename="Tonesix", category="lu", description="LATIN CAPITAL LETTER TONE SIX", direction="l", @@ -4233,6 +4312,7 @@ characters.data={ unicodeslot=0x0184, }, { + adobename="tonesix", category="ll", description="LATIN SMALL LETTER TONE SIX", direction="l", @@ -4241,6 +4321,7 @@ characters.data={ unicodeslot=0x0185, }, { + adobename="Oopen", category="lu", description="LATIN CAPITAL LETTER OPEN O", direction="l", @@ -4249,6 +4330,7 @@ characters.data={ unicodeslot=0x0186, }, { + adobename="Chook", category="lu", contextname="Chook", description="LATIN CAPITAL LETTER C WITH HOOK", @@ -4259,6 +4341,7 @@ characters.data={ unicodeslot=0x0187, }, { + adobename="chook", category="ll", contextname="chook", description="LATIN SMALL LETTER C WITH HOOK", @@ -4269,6 +4352,7 @@ characters.data={ unicodeslot=0x0188, }, { + adobename="Dafrican", category="lu", contextname="Dafrican", description="LATIN CAPITAL LETTER AFRICAN D", @@ -4278,6 +4362,7 @@ characters.data={ unicodeslot=0x0189, }, { + adobename="Dhook", category="lu", contextname="Dhook", description="LATIN CAPITAL LETTER D WITH HOOK", @@ -4288,6 +4373,7 @@ characters.data={ unicodeslot=0x018A, }, { + adobename="Dtopbar", category="lu", description="LATIN CAPITAL LETTER D WITH TOPBAR", direction="l", @@ -4297,6 +4383,7 @@ characters.data={ unicodeslot=0x018B, }, { + adobename="dtopbar", category="ll", description="LATIN SMALL LETTER D WITH TOPBAR", direction="l", @@ -4306,6 +4393,7 @@ characters.data={ unicodeslot=0x018C, }, { + adobename="deltaturned", category="ll", description="LATIN SMALL LETTER TURNED DELTA", direction="l", @@ -4313,6 +4401,7 @@ characters.data={ unicodeslot=0x018D, }, { + adobename="Ereversed", category="lu", description="LATIN CAPITAL LETTER REVERSED E", direction="l", @@ -4321,6 +4410,7 @@ characters.data={ unicodeslot=0x018E, }, { + adobename="Schwa", category="lu", contextname="Schwa", description="LATIN CAPITAL LETTER SCHWA", @@ -4330,6 +4420,7 @@ characters.data={ unicodeslot=0x018F, }, { + adobename="Eopen", category="lu", description="LATIN CAPITAL LETTER OPEN E", direction="l", @@ -4338,6 +4429,7 @@ characters.data={ unicodeslot=0x0190, }, { + adobename="Fhook", category="lu", contextname="Fhook", description="LATIN CAPITAL LETTER F WITH HOOK", @@ -4359,6 +4451,7 @@ characters.data={ unicodeslot=0x0192, }, { + adobename="Ghook", category="lu", contextname="Ghook", description="LATIN CAPITAL LETTER G WITH HOOK", @@ -4369,6 +4462,7 @@ characters.data={ unicodeslot=0x0193, }, { + adobename="Gammaafrican", category="lu", description="LATIN CAPITAL LETTER GAMMA", direction="l", @@ -4377,6 +4471,7 @@ characters.data={ unicodeslot=0x0194, }, { + adobename="hv", category="ll", description="LATIN SMALL LETTER HV", direction="l", @@ -4385,6 +4480,7 @@ characters.data={ unicodeslot=0x0195, }, { + adobename="Iotaafrican", category="lu", description="LATIN CAPITAL LETTER IOTA", direction="l", @@ -4393,6 +4489,7 @@ characters.data={ unicodeslot=0x0196, }, { + adobename="Istroke", category="lu", contextname="Istroke", description="LATIN CAPITAL LETTER I WITH STROKE", @@ -4403,6 +4500,7 @@ characters.data={ unicodeslot=0x0197, }, { + adobename="Khook", category="lu", contextname="Khook", description="LATIN CAPITAL LETTER K WITH HOOK", @@ -4413,6 +4511,7 @@ characters.data={ unicodeslot=0x0198, }, { + adobename="khook", category="ll", contextname="khook", description="LATIN SMALL LETTER K WITH HOOK", @@ -4423,6 +4522,7 @@ characters.data={ unicodeslot=0x0199, }, { + adobename="lbar", category="ll", contextname="lbar", description="LATIN SMALL LETTER L WITH BAR", @@ -4433,6 +4533,7 @@ characters.data={ unicodeslot=0x019A, }, { + adobename="lambdastroke", category="ll", description="LATIN SMALL LETTER LAMBDA WITH STROKE", direction="l", @@ -4440,6 +4541,7 @@ characters.data={ unicodeslot=0x019B, }, { + adobename="Mturned", category="lu", description="LATIN CAPITAL LETTER TURNED M", direction="l", @@ -4448,6 +4550,7 @@ characters.data={ unicodeslot=0x019C, }, { + adobename="Nhookleft", category="lu", description="LATIN CAPITAL LETTER N WITH LEFT HOOK", direction="l", @@ -4457,6 +4560,7 @@ characters.data={ unicodeslot=0x019D, }, { + adobename="nlegrightlong", category="ll", description="LATIN SMALL LETTER N WITH LONG RIGHT LEG", direction="l", @@ -4466,6 +4570,7 @@ characters.data={ unicodeslot=0x019E, }, { + adobename="Ocenteredtilde", category="lu", description="LATIN CAPITAL LETTER O WITH MIDDLE TILDE", direction="l", @@ -4499,6 +4604,7 @@ characters.data={ unicodeslot=0x01A1, }, { + adobename="Oi", category="lu", description="LATIN CAPITAL LETTER OI", direction="l", @@ -4507,6 +4613,7 @@ characters.data={ unicodeslot=0x01A2, }, { + adobename="oi", category="ll", description="LATIN SMALL LETTER OI", direction="l", @@ -4515,6 +4622,7 @@ characters.data={ unicodeslot=0x01A3, }, { + adobename="Phook", category="lu", contextname="Phook", description="LATIN CAPITAL LETTER P WITH HOOK", @@ -4525,6 +4633,7 @@ characters.data={ unicodeslot=0x01A4, }, { + adobename="phook", category="ll", contextname="phook", description="LATIN SMALL LETTER P WITH HOOK", @@ -4535,6 +4644,7 @@ characters.data={ unicodeslot=0x01A5, }, { + adobename="yr", category="lu", description="LATIN LETTER YR", direction="l", @@ -4543,6 +4653,7 @@ characters.data={ unicodeslot=0x01A6, }, { + adobename="Tonetwo", category="lu", description="LATIN CAPITAL LETTER TONE TWO", direction="l", @@ -4551,6 +4662,7 @@ characters.data={ unicodeslot=0x01A7, }, { + adobename="tonetwo", category="ll", description="LATIN SMALL LETTER TONE TWO", direction="l", @@ -4559,6 +4671,7 @@ characters.data={ unicodeslot=0x01A8, }, { + adobename="Esh", category="lu", description="LATIN CAPITAL LETTER ESH", direction="l", @@ -4567,6 +4680,7 @@ characters.data={ unicodeslot=0x01A9, }, { + adobename="eshreversedloop", category="ll", description="LATIN LETTER REVERSED ESH LOOP", direction="l", @@ -4574,6 +4688,7 @@ characters.data={ unicodeslot=0x01AA, }, { + adobename="tpalatalhook", category="ll", description="LATIN SMALL LETTER T WITH PALATAL HOOK", direction="l", @@ -4582,6 +4697,7 @@ characters.data={ unicodeslot=0x01AB, }, { + adobename="Thook", category="lu", contextname="Thook", description="LATIN CAPITAL LETTER T WITH HOOK", @@ -4592,6 +4708,7 @@ characters.data={ unicodeslot=0x01AC, }, { + adobename="thook", category="ll", contextname="thook", description="LATIN SMALL LETTER T WITH HOOK", @@ -4602,6 +4719,7 @@ characters.data={ unicodeslot=0x01AD, }, { + adobename="Tretroflexhook", category="lu", description="LATIN CAPITAL LETTER T WITH RETROFLEX HOOK", direction="l", @@ -4635,6 +4753,7 @@ characters.data={ unicodeslot=0x01B0, }, { + adobename="Upsilonafrican", category="lu", description="LATIN CAPITAL LETTER UPSILON", direction="l", @@ -4643,6 +4762,7 @@ characters.data={ unicodeslot=0x01B1, }, { + adobename="Vhook", category="lu", contextname="Uhook", description="LATIN CAPITAL LETTER V WITH HOOK", @@ -4653,6 +4773,7 @@ characters.data={ unicodeslot=0x01B2, }, { + adobename="Yhook", category="lu", contextname="Yhook", description="LATIN CAPITAL LETTER Y WITH HOOK", @@ -4663,6 +4784,7 @@ characters.data={ unicodeslot=0x01B3, }, { + adobename="yhook", category="ll", contextname="yhook", description="LATIN SMALL LETTER Y WITH HOOK", @@ -4673,6 +4795,7 @@ characters.data={ unicodeslot=0x01B4, }, { + adobename="Zstroke", category="lu", contextname="Zstroke", description="LATIN CAPITAL LETTER Z WITH STROKE", @@ -4683,6 +4806,7 @@ characters.data={ unicodeslot=0x01B5, }, { + adobename="zstroke", category="ll", contextname="zstroke", description="LATIN SMALL LETTER Z WITH STROKE", @@ -4693,6 +4817,7 @@ characters.data={ unicodeslot=0x01B6, }, { + adobename="Ezh", category="lu", description="LATIN CAPITAL LETTER EZH", direction="l", @@ -4701,6 +4826,7 @@ characters.data={ unicodeslot=0x01B7, }, { + adobename="Ezhreversed", category="lu", description="LATIN CAPITAL LETTER EZH REVERSED", direction="l", @@ -4709,6 +4835,7 @@ characters.data={ unicodeslot=0x01B8, }, { + adobename="ezhreversed", category="ll", description="LATIN SMALL LETTER EZH REVERSED", direction="l", @@ -4717,6 +4844,7 @@ characters.data={ unicodeslot=0x01B9, }, { + adobename="ezhtail", category="ll", description="LATIN SMALL LETTER EZH WITH TAIL", direction="l", @@ -4725,6 +4853,7 @@ characters.data={ unicodeslot=0x01BA, }, { + adobename="twostroke", category="lo", description="LATIN LETTER TWO WITH STROKE", direction="l", @@ -4732,6 +4861,7 @@ characters.data={ unicodeslot=0x01BB, }, { + adobename="Tonefive", category="lu", description="LATIN CAPITAL LETTER TONE FIVE", direction="l", @@ -4740,6 +4870,7 @@ characters.data={ unicodeslot=0x01BC, }, { + adobename="tonefive", category="ll", description="LATIN SMALL LETTER TONE FIVE", direction="l", @@ -4748,6 +4879,7 @@ characters.data={ unicodeslot=0x01BD, }, { + adobename="glottalinvertedstroke", category="ll", description="LATIN LETTER INVERTED GLOTTAL STOP WITH STROKE", direction="l", @@ -4755,6 +4887,7 @@ characters.data={ unicodeslot=0x01BE, }, { + adobename="wynn", category="ll", description="LATIN LETTER WYNN", direction="l", @@ -4763,6 +4896,7 @@ characters.data={ unicodeslot=0x01BF, }, { + adobename="clickdental", category="lo", description="LATIN LETTER DENTAL CLICK", direction="l", @@ -4770,6 +4904,7 @@ characters.data={ unicodeslot=0x01C0, }, { + adobename="clicklateral", category="lo", description="LATIN LETTER LATERAL CLICK", direction="l", @@ -4777,6 +4912,7 @@ characters.data={ unicodeslot=0x01C1, }, { + adobename="clickalveolar", category="lo", description="LATIN LETTER ALVEOLAR CLICK", direction="l", @@ -4784,6 +4920,7 @@ characters.data={ unicodeslot=0x01C2, }, { + adobename="clickretroflex", category="lo", description="LATIN LETTER RETROFLEX CLICK", direction="l", @@ -4791,6 +4928,7 @@ characters.data={ unicodeslot=0x01C3, }, { + adobename="DZcaron", category="lu", contextname="DZcaronligature", description="LATIN CAPITAL LETTER DZ WITH CARON", @@ -4803,6 +4941,7 @@ characters.data={ unicodeslot=0x01C4, }, { + adobename="Dzcaron", category="lt", contextname="Dzcaronligature", description="LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON", @@ -4815,6 +4954,7 @@ characters.data={ unicodeslot=0x01C5, }, { + adobename="dzcaron", category="ll", contextname="dzcaronligature", description="LATIN SMALL LETTER DZ WITH CARON", @@ -4826,6 +4966,7 @@ characters.data={ unicodeslot=0x01C6, }, { + adobename="LJ", category="lu", contextname="LJligature", description="LATIN CAPITAL LETTER LJ", @@ -4838,6 +4979,7 @@ characters.data={ unicodeslot=0x01C7, }, { + adobename="Lj", category="lt", contextname="Ljligature", description="LATIN CAPITAL LETTER L WITH SMALL LETTER J", @@ -4850,6 +4992,7 @@ characters.data={ unicodeslot=0x01C8, }, { + adobename="lj", category="ll", contextname="ljligature", description="LATIN SMALL LETTER LJ", @@ -4861,6 +5004,7 @@ characters.data={ unicodeslot=0x01C9, }, { + adobename="NJ", category="lu", contextname="NJligature", description="LATIN CAPITAL LETTER NJ", @@ -4873,6 +5017,7 @@ characters.data={ unicodeslot=0x01CA, }, { + adobename="Nj", category="lt", contextname="Njligature", description="LATIN CAPITAL LETTER N WITH SMALL LETTER J", @@ -4885,6 +5030,7 @@ characters.data={ unicodeslot=0x01CB, }, { + adobename="nj", category="ll", contextname="njligature", description="LATIN SMALL LETTER NJ", @@ -4896,6 +5042,7 @@ characters.data={ unicodeslot=0x01CC, }, { + adobename="Acaron", category="lu", contextname="Acaron", description="LATIN CAPITAL LETTER A WITH CARON", @@ -4907,6 +5054,7 @@ characters.data={ unicodeslot=0x01CD, }, { + adobename="acaron", category="ll", cjkwd="a", contextname="acaron", @@ -4919,6 +5067,7 @@ characters.data={ unicodeslot=0x01CE, }, { + adobename="Icaron", category="lu", contextname="Icaron", description="LATIN CAPITAL LETTER I WITH CARON", @@ -4930,6 +5079,7 @@ characters.data={ unicodeslot=0x01CF, }, { + adobename="icaron", category="ll", cjkwd="a", contextname="icaron", @@ -4942,6 +5092,7 @@ characters.data={ unicodeslot=0x01D0, }, { + adobename="Ocaron", category="lu", contextname="Ocaron", description="LATIN CAPITAL LETTER O WITH CARON", @@ -4953,6 +5104,7 @@ characters.data={ unicodeslot=0x01D1, }, { + adobename="ocaron", category="ll", cjkwd="a", contextname="ocaron", @@ -4965,6 +5117,7 @@ characters.data={ unicodeslot=0x01D2, }, { + adobename="Ucaron", category="lu", contextname="Ucaron", description="LATIN CAPITAL LETTER U WITH CARON", @@ -4976,6 +5129,7 @@ characters.data={ unicodeslot=0x01D3, }, { + adobename="ucaron", category="ll", cjkwd="a", contextname="ucaron", @@ -4988,6 +5142,7 @@ characters.data={ unicodeslot=0x01D4, }, { + adobename="Udieresismacron", category="lu", contextname="Udiaeresismacron", description="LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON", @@ -4999,6 +5154,7 @@ characters.data={ unicodeslot=0x01D5, }, { + adobename="udieresismacron", category="ll", cjkwd="a", contextname="udiaeresismacron", @@ -5011,6 +5167,7 @@ characters.data={ unicodeslot=0x01D6, }, { + adobename="Udieresisacute", category="lu", contextname="Udiaeresisacute", description="LATIN CAPITAL LETTER U WITH DIAERESIS AND ACUTE", @@ -5022,6 +5179,7 @@ characters.data={ unicodeslot=0x01D7, }, { + adobename="udieresisacute", category="ll", cjkwd="a", contextname="udiaeresisacute", @@ -5034,6 +5192,7 @@ characters.data={ unicodeslot=0x01D8, }, { + adobename="Udieresiscaron", category="lu", contextname="Udiaeresiscaron", description="LATIN CAPITAL LETTER U WITH DIAERESIS AND CARON", @@ -5045,6 +5204,7 @@ characters.data={ unicodeslot=0x01D9, }, { + adobename="udieresiscaron", category="ll", cjkwd="a", contextname="udiaeresiscaron", @@ -5057,6 +5217,7 @@ characters.data={ unicodeslot=0x01DA, }, { + adobename="Udieresisgrave", category="lu", contextname="Udiaeresisgrave", description="LATIN CAPITAL LETTER U WITH DIAERESIS AND GRAVE", @@ -5068,6 +5229,7 @@ characters.data={ unicodeslot=0x01DB, }, { + adobename="udieresisgrave", category="ll", cjkwd="a", contextname="udiaeresisgrave", @@ -5080,6 +5242,7 @@ characters.data={ unicodeslot=0x01DC, }, { + adobename="eturned", category="ll", description="LATIN SMALL LETTER TURNED E", direction="l", @@ -5088,6 +5251,7 @@ characters.data={ unicodeslot=0x01DD, }, { + adobename="Adieresismacron", category="lu", contextname="Adiaeresismacron", description="LATIN CAPITAL LETTER A WITH DIAERESIS AND MACRON", @@ -5099,6 +5263,7 @@ characters.data={ unicodeslot=0x01DE, }, { + adobename="adieresismacron", category="ll", contextname="adiaeresismacron", description="LATIN SMALL LETTER A WITH DIAERESIS AND MACRON", @@ -5110,6 +5275,7 @@ characters.data={ unicodeslot=0x01DF, }, { + adobename="Adotmacron", category="lu", contextname="Adotaccentmacron", description="LATIN CAPITAL LETTER A WITH DOT ABOVE AND MACRON", @@ -5121,6 +5287,7 @@ characters.data={ unicodeslot=0x01E0, }, { + adobename="adotmacron", category="ll", contextname="adotaccentmacron", description="LATIN SMALL LETTER A WITH DOT ABOVE AND MACRON", @@ -5132,6 +5299,7 @@ characters.data={ unicodeslot=0x01E1, }, { + adobename="AEmacron", category="lu", contextname="AEmacron", description="LATIN CAPITAL LETTER AE WITH MACRON", @@ -5143,6 +5311,7 @@ characters.data={ unicodeslot=0x01E2, }, { + adobename="aemacron", category="ll", contextname="aemacron", description="LATIN SMALL LETTER AE WITH MACRON", @@ -5154,6 +5323,7 @@ characters.data={ unicodeslot=0x01E3, }, { + adobename="Gstroke", category="lu", contextname="Gstroke", description="LATIN CAPITAL LETTER G WITH STROKE", @@ -5164,6 +5334,7 @@ characters.data={ unicodeslot=0x01E4, }, { + adobename="gstroke", category="ll", contextname="gstroke", description="LATIN SMALL LETTER G WITH STROKE", @@ -5198,6 +5369,7 @@ characters.data={ unicodeslot=0x01E7, }, { + adobename="Kcaron", category="lu", contextname="Kcaron", description="LATIN CAPITAL LETTER K WITH CARON", @@ -5209,6 +5381,7 @@ characters.data={ unicodeslot=0x01E8, }, { + adobename="kcaron", category="ll", contextname="kcaron", description="LATIN SMALL LETTER K WITH CARON", @@ -5220,6 +5393,7 @@ characters.data={ unicodeslot=0x01E9, }, { + adobename="Oogonek", category="lu", contextname="Oogonek", description="LATIN CAPITAL LETTER O WITH OGONEK", @@ -5231,6 +5405,7 @@ characters.data={ unicodeslot=0x01EA, }, { + adobename="oogonek", category="ll", contextname="oogonek", description="LATIN SMALL LETTER O WITH OGONEK", @@ -5242,6 +5417,7 @@ characters.data={ unicodeslot=0x01EB, }, { + adobename="Oogonekmacron", category="lu", contextname="Oogonekmacron", description="LATIN CAPITAL LETTER O WITH OGONEK AND MACRON", @@ -5253,6 +5429,7 @@ characters.data={ unicodeslot=0x01EC, }, { + adobename="oogonekmacron", category="ll", contextname="oogonekmacron", description="LATIN SMALL LETTER O WITH OGONEK AND MACRON", @@ -5264,6 +5441,7 @@ characters.data={ unicodeslot=0x01ED, }, { + adobename="Ezhcaron", category="lu", description="LATIN CAPITAL LETTER EZH WITH CARON", direction="l", @@ -5274,6 +5452,7 @@ characters.data={ unicodeslot=0x01EE, }, { + adobename="ezhcaron", category="ll", description="LATIN SMALL LETTER EZH WITH CARON", direction="l", @@ -5284,6 +5463,7 @@ characters.data={ unicodeslot=0x01EF, }, { + adobename="jcaron", category="ll", contextname="jcaron", description="LATIN SMALL LETTER J WITH CARON", @@ -5294,6 +5474,7 @@ characters.data={ unicodeslot=0x01F0, }, { + adobename="DZ", category="lu", contextname="DZligature", description="LATIN CAPITAL LETTER DZ", @@ -5305,6 +5486,7 @@ characters.data={ unicodeslot=0x01F1, }, { + adobename="Dz", category="lt", contextname="Dzligature", description="LATIN CAPITAL LETTER D WITH SMALL LETTER Z", @@ -5317,6 +5499,7 @@ characters.data={ unicodeslot=0x01F2, }, { + adobename="dz", category="ll", contextname="dzligature", description="LATIN SMALL LETTER DZ", @@ -5327,6 +5510,7 @@ characters.data={ unicodeslot=0x01F3, }, { + adobename="Gacute", category="lu", contextname="Gacute", description="LATIN CAPITAL LETTER G WITH ACUTE", @@ -5338,6 +5522,7 @@ characters.data={ unicodeslot=0x01F4, }, { + adobename="gacute", category="ll", contextname="gacute", description="LATIN SMALL LETTER G WITH ACUTE", @@ -5435,7 +5620,7 @@ characters.data={ unicodeslot=0x01FD, }, { - adobename="Oslashacute", + adobename="Ostrokeacute", category="lu", contextname="Ostrokeacute", description="LATIN CAPITAL LETTER O WITH STROKE AND ACUTE", @@ -5447,7 +5632,7 @@ characters.data={ unicodeslot=0x01FE, }, { - adobename="oslashacute", + adobename="ostrokeacute", category="ll", contextname="ostrokeacute", description="LATIN SMALL LETTER O WITH STROKE AND ACUTE", @@ -5459,6 +5644,7 @@ characters.data={ unicodeslot=0x01FF, }, { + adobename="Adblgrave", category="lu", contextname="Adoublegrave", description="LATIN CAPITAL LETTER A WITH DOUBLE GRAVE", @@ -5470,6 +5656,7 @@ characters.data={ unicodeslot=0x0200, }, { + adobename="adblgrave", category="ll", contextname="adoublegrave", description="LATIN SMALL LETTER A WITH DOUBLE GRAVE", @@ -5481,6 +5668,7 @@ characters.data={ unicodeslot=0x0201, }, { + adobename="Ainvertedbreve", category="lu", contextname="Ainvertedbreve", description="LATIN CAPITAL LETTER A WITH INVERTED BREVE", @@ -5492,6 +5680,7 @@ characters.data={ unicodeslot=0x0202, }, { + adobename="ainvertedbreve", category="ll", contextname="ainvertedbreve", description="LATIN SMALL LETTER A WITH INVERTED BREVE", @@ -5503,6 +5692,7 @@ characters.data={ unicodeslot=0x0203, }, { + adobename="Edblgrave", category="lu", contextname="Edoublegrave", description="LATIN CAPITAL LETTER E WITH DOUBLE GRAVE", @@ -5514,6 +5704,7 @@ characters.data={ unicodeslot=0x0204, }, { + adobename="edblgrave", category="ll", contextname="edoublegrave", description="LATIN SMALL LETTER E WITH DOUBLE GRAVE", @@ -5525,6 +5716,7 @@ characters.data={ unicodeslot=0x0205, }, { + adobename="Einvertedbreve", category="lu", contextname="Einvertedbreve", description="LATIN CAPITAL LETTER E WITH INVERTED BREVE", @@ -5536,6 +5728,7 @@ characters.data={ unicodeslot=0x0206, }, { + adobename="einvertedbreve", category="ll", contextname="einvertedbreve", description="LATIN SMALL LETTER E WITH INVERTED BREVE", @@ -5547,6 +5740,7 @@ characters.data={ unicodeslot=0x0207, }, { + adobename="Idblgrave", category="lu", contextname="Idoublegrave", description="LATIN CAPITAL LETTER I WITH DOUBLE GRAVE", @@ -5558,6 +5752,7 @@ characters.data={ unicodeslot=0x0208, }, { + adobename="idblgrave", category="ll", contextname="idoublegrave", description="LATIN SMALL LETTER I WITH DOUBLE GRAVE", @@ -5569,6 +5764,7 @@ characters.data={ unicodeslot=0x0209, }, { + adobename="Iinvertedbreve", category="lu", contextname="Iinvertedbreve", description="LATIN CAPITAL LETTER I WITH INVERTED BREVE", @@ -5580,6 +5776,7 @@ characters.data={ unicodeslot=0x020A, }, { + adobename="iinvertedbreve", category="ll", contextname="iinvertedbreve", description="LATIN SMALL LETTER I WITH INVERTED BREVE", @@ -5591,6 +5788,7 @@ characters.data={ unicodeslot=0x020B, }, { + adobename="Odblgrave", category="lu", contextname="Odoublegrave", description="LATIN CAPITAL LETTER O WITH DOUBLE GRAVE", @@ -5602,6 +5800,7 @@ characters.data={ unicodeslot=0x020C, }, { + adobename="odblgrave", category="ll", contextname="odoublegrave", description="LATIN SMALL LETTER O WITH DOUBLE GRAVE", @@ -5613,6 +5812,7 @@ characters.data={ unicodeslot=0x020D, }, { + adobename="Oinvertedbreve", category="lu", contextname="Oinvertedbreve", description="LATIN CAPITAL LETTER O WITH INVERTED BREVE", @@ -5624,6 +5824,7 @@ characters.data={ unicodeslot=0x020E, }, { + adobename="oinvertedbreve", category="ll", contextname="oinvertedbreve", description="LATIN SMALL LETTER O WITH INVERTED BREVE", @@ -5635,6 +5836,7 @@ characters.data={ unicodeslot=0x020F, }, { + adobename="Rdblgrave", category="lu", contextname="Rdoublegrave", description="LATIN CAPITAL LETTER R WITH DOUBLE GRAVE", @@ -5646,6 +5848,7 @@ characters.data={ unicodeslot=0x0210, }, { + adobename="rdblgrave", category="ll", contextname="rdoublegrave", description="LATIN SMALL LETTER R WITH DOUBLE GRAVE", @@ -5657,6 +5860,7 @@ characters.data={ unicodeslot=0x0211, }, { + adobename="Rinvertedbreve", category="lu", contextname="Rinvertedbreve", description="LATIN CAPITAL LETTER R WITH INVERTED BREVE", @@ -5668,6 +5872,7 @@ characters.data={ unicodeslot=0x0212, }, { + adobename="rinvertedbreve", category="ll", contextname="rinvertedbreve", description="LATIN SMALL LETTER R WITH INVERTED BREVE", @@ -5679,6 +5884,7 @@ characters.data={ unicodeslot=0x0213, }, { + adobename="Udblgrave", category="lu", contextname="Udoublegrave", description="LATIN CAPITAL LETTER U WITH DOUBLE GRAVE", @@ -5690,6 +5896,7 @@ characters.data={ unicodeslot=0x0214, }, { + adobename="udblgrave", category="ll", contextname="udoublegrave", description="LATIN SMALL LETTER U WITH DOUBLE GRAVE", @@ -5701,6 +5908,7 @@ characters.data={ unicodeslot=0x0215, }, { + adobename="Uinvertedbreve", category="lu", contextname="Uinvertedbreve", description="LATIN CAPITAL LETTER U WITH INVERTED BREVE", @@ -5712,6 +5920,7 @@ characters.data={ unicodeslot=0x0216, }, { + adobename="uinvertedbreve", category="ll", contextname="uinvertedbreve", description="LATIN SMALL LETTER U WITH INVERTED BREVE", @@ -6259,6 +6468,7 @@ characters.data={ unicodeslot=0x024F, }, { + adobename="aturned", category="ll", description="LATIN SMALL LETTER TURNED A", direction="l", @@ -6266,6 +6476,7 @@ characters.data={ unicodeslot=0x0250, }, { + adobename="ascript", category="ll", cjkwd="a", description="LATIN SMALL LETTER ALPHA", @@ -6274,6 +6485,7 @@ characters.data={ unicodeslot=0x0251, }, { + adobename="ascriptturned", category="ll", description="LATIN SMALL LETTER TURNED ALPHA", direction="l", @@ -6281,6 +6493,7 @@ characters.data={ unicodeslot=0x0252, }, { + adobename="bhook", category="ll", contextname="bhook", description="LATIN SMALL LETTER B WITH HOOK", @@ -6291,6 +6504,7 @@ characters.data={ unicodeslot=0x0253, }, { + adobename="oopen", category="ll", description="LATIN SMALL LETTER OPEN O", direction="l", @@ -6299,6 +6513,7 @@ characters.data={ unicodeslot=0x0254, }, { + adobename="ccurl", category="ll", contextname="ccurl", description="LATIN SMALL LETTER C WITH CURL", @@ -6308,6 +6523,7 @@ characters.data={ unicodeslot=0x0255, }, { + adobename="dtail", category="ll", contextname="dtail", description="LATIN SMALL LETTER D WITH TAIL", @@ -6318,6 +6534,7 @@ characters.data={ unicodeslot=0x0256, }, { + adobename="dhook", category="ll", contextname="dhook", description="LATIN SMALL LETTER D WITH HOOK", @@ -6328,6 +6545,7 @@ characters.data={ unicodeslot=0x0257, }, { + adobename="ereversed", category="ll", description="LATIN SMALL LETTER REVERSED E", direction="l", @@ -6335,6 +6553,7 @@ characters.data={ unicodeslot=0x0258, }, { + adobename="schwa", category="ll", contextname="schwa", description="LATIN SMALL LETTER SCHWA", @@ -6344,6 +6563,7 @@ characters.data={ unicodeslot=0x0259, }, { + adobename="schwahook", category="ll", contextname="schwahook", description="LATIN SMALL LETTER SCHWA WITH HOOK", @@ -6353,6 +6573,7 @@ characters.data={ unicodeslot=0x025A, }, { + adobename="eopen", category="ll", description="LATIN SMALL LETTER OPEN E", direction="l", @@ -6361,6 +6582,7 @@ characters.data={ unicodeslot=0x025B, }, { + adobename="eopenreversed", category="ll", description="LATIN SMALL LETTER REVERSED OPEN E", direction="l", @@ -6368,6 +6590,7 @@ characters.data={ unicodeslot=0x025C, }, { + adobename="eopenreversedhook", category="ll", description="LATIN SMALL LETTER REVERSED OPEN E WITH HOOK", direction="l", @@ -6375,6 +6598,7 @@ characters.data={ unicodeslot=0x025D, }, { + adobename="eopenreversedclosed", category="ll", description="LATIN SMALL LETTER CLOSED REVERSED OPEN E", direction="l", @@ -6382,6 +6606,7 @@ characters.data={ unicodeslot=0x025E, }, { + adobename="jdotlessstroke", category="ll", contextname="dotlessjstroke", description="LATIN SMALL LETTER DOTLESS J WITH STROKE", @@ -6390,6 +6615,7 @@ characters.data={ unicodeslot=0x025F, }, { + adobename="ghook", category="ll", description="LATIN SMALL LETTER G WITH HOOK", direction="l", @@ -6399,6 +6625,7 @@ characters.data={ unicodeslot=0x0260, }, { + adobename="gscript", category="ll", cjkwd="a", description="LATIN SMALL LETTER SCRIPT G", @@ -6414,6 +6641,7 @@ characters.data={ unicodeslot=0x0262, }, { + adobename="gammalatinsmall", category="ll", description="LATIN SMALL LETTER GAMMA", direction="l", @@ -6422,6 +6650,7 @@ characters.data={ unicodeslot=0x0263, }, { + adobename="ramshorn", category="ll", description="LATIN SMALL LETTER RAMS HORN", direction="l", @@ -6429,6 +6658,7 @@ characters.data={ unicodeslot=0x0264, }, { + adobename="hturned", category="ll", description="LATIN SMALL LETTER TURNED H", direction="l", @@ -6436,6 +6666,7 @@ characters.data={ unicodeslot=0x0265, }, { + adobename="hhook", category="ll", description="LATIN SMALL LETTER H WITH HOOK", direction="l", @@ -6444,6 +6675,7 @@ characters.data={ unicodeslot=0x0266, }, { + adobename="henghook", category="ll", description="LATIN SMALL LETTER HENG WITH HOOK", direction="l", @@ -6451,6 +6683,7 @@ characters.data={ unicodeslot=0x0267, }, { + adobename="istroke", category="ll", description="LATIN SMALL LETTER I WITH STROKE", direction="l", @@ -6460,6 +6693,7 @@ characters.data={ unicodeslot=0x0268, }, { + adobename="iotalatin", category="ll", description="LATIN SMALL LETTER IOTA", direction="l", @@ -6475,6 +6709,7 @@ characters.data={ unicodeslot=0x026A, }, { + adobename="lmiddletilde", category="ll", description="LATIN SMALL LETTER L WITH MIDDLE TILDE", direction="l", @@ -6484,6 +6719,7 @@ characters.data={ unicodeslot=0x026B, }, { + adobename="lbelt", category="ll", description="LATIN SMALL LETTER L WITH BELT", direction="l", @@ -6492,6 +6728,7 @@ characters.data={ unicodeslot=0x026C, }, { + adobename="lhookretroflex", category="ll", description="LATIN SMALL LETTER L WITH RETROFLEX HOOK", direction="l", @@ -6500,6 +6737,7 @@ characters.data={ unicodeslot=0x026D, }, { + adobename="lezh", category="ll", description="LATIN SMALL LETTER LEZH", direction="l", @@ -6507,6 +6745,7 @@ characters.data={ unicodeslot=0x026E, }, { + adobename="mturned", category="ll", description="LATIN SMALL LETTER TURNED M", direction="l", @@ -6515,6 +6754,7 @@ characters.data={ unicodeslot=0x026F, }, { + adobename="mlonglegturned", category="ll", description="LATIN SMALL LETTER TURNED M WITH LONG LEG", direction="l", @@ -6522,6 +6762,7 @@ characters.data={ unicodeslot=0x0270, }, { + adobename="mhook", category="ll", description="LATIN SMALL LETTER M WITH HOOK", direction="l", @@ -6530,6 +6771,7 @@ characters.data={ unicodeslot=0x0271, }, { + adobename="nhookleft", category="ll", description="LATIN SMALL LETTER N WITH LEFT HOOK", direction="l", @@ -6539,6 +6781,7 @@ characters.data={ unicodeslot=0x0272, }, { + adobename="nhookretroflex", category="ll", description="LATIN SMALL LETTER N WITH RETROFLEX HOOK", direction="l", @@ -6554,6 +6797,7 @@ characters.data={ unicodeslot=0x0274, }, { + adobename="obarred", category="ll", description="LATIN SMALL LETTER BARRED O", direction="l", @@ -6569,6 +6813,7 @@ characters.data={ unicodeslot=0x0276, }, { + adobename="omegalatinclosed", category="ll", description="LATIN SMALL LETTER CLOSED OMEGA", direction="l", @@ -6576,6 +6821,7 @@ characters.data={ unicodeslot=0x0277, }, { + adobename="philatin", category="ll", description="LATIN SMALL LETTER PHI", direction="l", @@ -6583,6 +6829,7 @@ characters.data={ unicodeslot=0x0278, }, { + adobename="rturned", category="ll", description="LATIN SMALL LETTER TURNED R", direction="l", @@ -6590,6 +6837,7 @@ characters.data={ unicodeslot=0x0279, }, { + adobename="rlonglegturned", category="ll", description="LATIN SMALL LETTER TURNED R WITH LONG LEG", direction="l", @@ -6597,6 +6845,7 @@ characters.data={ unicodeslot=0x027A, }, { + adobename="rhookturned", category="ll", description="LATIN SMALL LETTER TURNED R WITH HOOK", direction="l", @@ -6604,6 +6853,7 @@ characters.data={ unicodeslot=0x027B, }, { + adobename="rlongleg", category="ll", description="LATIN SMALL LETTER R WITH LONG LEG", direction="l", @@ -6612,6 +6862,7 @@ characters.data={ unicodeslot=0x027C, }, { + adobename="rhook", category="ll", description="LATIN SMALL LETTER R WITH TAIL", direction="l", @@ -6621,6 +6872,7 @@ characters.data={ unicodeslot=0x027D, }, { + adobename="rfishhook", category="ll", description="LATIN SMALL LETTER R WITH FISHHOOK", direction="l", @@ -6629,6 +6881,7 @@ characters.data={ unicodeslot=0x027E, }, { + adobename="rfishhookreversed", category="ll", description="LATIN SMALL LETTER REVERSED R WITH FISHHOOK", direction="l", @@ -6644,6 +6897,7 @@ characters.data={ unicodeslot=0x0280, }, { + adobename="Rsmallinverted", category="ll", description="LATIN LETTER SMALL CAPITAL INVERTED R", direction="l", @@ -6651,6 +6905,7 @@ characters.data={ unicodeslot=0x0281, }, { + adobename="shook", category="ll", description="LATIN SMALL LETTER S WITH HOOK", direction="l", @@ -6659,6 +6914,7 @@ characters.data={ unicodeslot=0x0282, }, { + adobename="esh", category="ll", description="LATIN SMALL LETTER ESH", direction="l", @@ -6667,6 +6923,7 @@ characters.data={ unicodeslot=0x0283, }, { + adobename="dotlessjstrokehook", category="ll", description="LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK", direction="l", @@ -6674,6 +6931,7 @@ characters.data={ unicodeslot=0x0284, }, { + adobename="eshsquatreversed", category="ll", description="LATIN SMALL LETTER SQUAT REVERSED ESH", direction="l", @@ -6681,6 +6939,7 @@ characters.data={ unicodeslot=0x0285, }, { + adobename="eshcurl", category="ll", description="LATIN SMALL LETTER ESH WITH CURL", direction="l", @@ -6689,6 +6948,7 @@ characters.data={ unicodeslot=0x0286, }, { + adobename="tturned", category="ll", description="LATIN SMALL LETTER TURNED T", direction="l", @@ -6696,6 +6956,7 @@ characters.data={ unicodeslot=0x0287, }, { + adobename="tretroflexhook", category="ll", description="LATIN SMALL LETTER T WITH RETROFLEX HOOK", direction="l", @@ -6705,6 +6966,7 @@ characters.data={ unicodeslot=0x0288, }, { + adobename="ubar", category="ll", description="LATIN SMALL LETTER U BAR", direction="l", @@ -6713,6 +6975,7 @@ characters.data={ unicodeslot=0x0289, }, { + adobename="upsilonlatin", category="ll", description="LATIN SMALL LETTER UPSILON", direction="l", @@ -6721,6 +6984,7 @@ characters.data={ unicodeslot=0x028A, }, { + adobename="vhook", category="ll", description="LATIN SMALL LETTER V WITH HOOK", direction="l", @@ -6730,6 +6994,7 @@ characters.data={ unicodeslot=0x028B, }, { + adobename="vturned", category="ll", description="LATIN SMALL LETTER TURNED V", direction="l", @@ -6738,6 +7003,7 @@ characters.data={ unicodeslot=0x028C, }, { + adobename="wturned", category="ll", description="LATIN SMALL LETTER TURNED W", direction="l", @@ -6745,6 +7011,7 @@ characters.data={ unicodeslot=0x028D, }, { + adobename="yturned", category="ll", description="LATIN SMALL LETTER TURNED Y", direction="l", @@ -6759,6 +7026,7 @@ characters.data={ unicodeslot=0x028F, }, { + adobename="zretroflexhook", category="ll", description="LATIN SMALL LETTER Z WITH RETROFLEX HOOK", direction="l", @@ -6767,6 +7035,7 @@ characters.data={ unicodeslot=0x0290, }, { + adobename="zcurl", category="ll", description="LATIN SMALL LETTER Z WITH CURL", direction="l", @@ -6775,6 +7044,7 @@ characters.data={ unicodeslot=0x0291, }, { + adobename="ezh", category="ll", description="LATIN SMALL LETTER EZH", direction="l", @@ -6783,6 +7053,7 @@ characters.data={ unicodeslot=0x0292, }, { + adobename="ezhcurl", category="ll", description="LATIN SMALL LETTER EZH WITH CURL", direction="l", @@ -6791,6 +7062,7 @@ characters.data={ unicodeslot=0x0293, }, { + adobename="glottalstop", category="lo", description="LATIN LETTER GLOTTAL STOP", direction="l", @@ -6798,6 +7070,7 @@ characters.data={ unicodeslot=0x0294, }, { + adobename="glottalstopreversed", category="ll", description="LATIN LETTER PHARYNGEAL VOICED FRICATIVE", direction="l", @@ -6805,6 +7078,7 @@ characters.data={ unicodeslot=0x0295, }, { + adobename="glottalstopinverted", category="ll", description="LATIN LETTER INVERTED GLOTTAL STOP", direction="l", @@ -6812,6 +7086,7 @@ characters.data={ unicodeslot=0x0296, }, { + adobename="cstretched", category="ll", description="LATIN LETTER STRETCHED C", direction="l", @@ -6819,6 +7094,7 @@ characters.data={ unicodeslot=0x0297, }, { + adobename="bilabialclick", category="ll", description="LATIN LETTER BILABIAL CLICK", direction="l", @@ -6833,6 +7109,7 @@ characters.data={ unicodeslot=0x0299, }, { + adobename="eopenclosed", category="ll", description="LATIN SMALL LETTER CLOSED OPEN E", direction="l", @@ -6840,6 +7117,7 @@ characters.data={ unicodeslot=0x029A, }, { + adobename="Gsmallhook", category="ll", description="LATIN LETTER SMALL CAPITAL G WITH HOOK", direction="l", @@ -6854,6 +7132,7 @@ characters.data={ unicodeslot=0x029C, }, { + adobename="jcrossedtail", category="ll", description="LATIN SMALL LETTER J WITH CROSSED-TAIL", direction="l", @@ -6862,6 +7141,7 @@ characters.data={ unicodeslot=0x029D, }, { + adobename="kturned", category="ll", description="LATIN SMALL LETTER TURNED K", direction="l", @@ -6876,6 +7156,7 @@ characters.data={ unicodeslot=0x029F, }, { + adobename="qhook", category="ll", description="LATIN SMALL LETTER Q WITH HOOK", direction="l", @@ -6884,6 +7165,7 @@ characters.data={ unicodeslot=0x02A0, }, { + adobename="glottalstopstroke", category="ll", description="LATIN LETTER GLOTTAL STOP WITH STROKE", direction="l", @@ -6891,6 +7173,7 @@ characters.data={ unicodeslot=0x02A1, }, { + adobename="glottalstopstrokereversed", category="ll", description="LATIN LETTER REVERSED GLOTTAL STOP WITH STROKE", direction="l", @@ -6898,6 +7181,7 @@ characters.data={ unicodeslot=0x02A2, }, { + adobename="dzaltone", category="ll", description="LATIN SMALL LETTER DZ DIGRAPH", direction="l", @@ -6905,6 +7189,7 @@ characters.data={ unicodeslot=0x02A3, }, { + adobename="dezh", category="ll", description="LATIN SMALL LETTER DEZH DIGRAPH", direction="l", @@ -6912,6 +7197,7 @@ characters.data={ unicodeslot=0x02A4, }, { + adobename="dzcurl", category="ll", description="LATIN SMALL LETTER DZ DIGRAPH WITH CURL", direction="l", @@ -6919,6 +7205,7 @@ characters.data={ unicodeslot=0x02A5, }, { + adobename="ts", category="ll", description="LATIN SMALL LETTER TS DIGRAPH", direction="l", @@ -6926,6 +7213,7 @@ characters.data={ unicodeslot=0x02A6, }, { + adobename="tesh", category="ll", description="LATIN SMALL LETTER TESH DIGRAPH", direction="l", @@ -6933,6 +7221,7 @@ characters.data={ unicodeslot=0x02A7, }, { + adobename="tccurl", category="ll", description="LATIN SMALL LETTER TC DIGRAPH WITH CURL", direction="l", @@ -6989,6 +7278,7 @@ characters.data={ unicodeslot=0x02AF, }, { + adobename="hsuperior", category="lm", description="MODIFIER LETTER SMALL H", direction="l", @@ -6997,6 +7287,7 @@ characters.data={ unicodeslot=0x02B0, }, { + adobename="hhooksuperior", category="lm", description="MODIFIER LETTER SMALL H WITH HOOK", direction="l", @@ -7005,6 +7296,7 @@ characters.data={ unicodeslot=0x02B1, }, { + adobename="jsuperior", category="lm", description="MODIFIER LETTER SMALL J", direction="l", @@ -7021,6 +7313,7 @@ characters.data={ unicodeslot=0x02B3, }, { + adobename="rturnedsuperior", category="lm", description="MODIFIER LETTER SMALL TURNED R", direction="l", @@ -7029,6 +7322,7 @@ characters.data={ unicodeslot=0x02B4, }, { + adobename="rhookturnedsuperior", category="lm", description="MODIFIER LETTER SMALL TURNED R WITH HOOK", direction="l", @@ -7037,6 +7331,7 @@ characters.data={ unicodeslot=0x02B5, }, { + adobename="Rsmallinvertedsuperior", category="lm", description="MODIFIER LETTER SMALL CAPITAL INVERTED R", direction="l", @@ -7045,6 +7340,7 @@ characters.data={ unicodeslot=0x02B6, }, { + adobename="wsuperior", category="lm", description="MODIFIER LETTER SMALL W", direction="l", @@ -7053,6 +7349,7 @@ characters.data={ unicodeslot=0x02B7, }, { + adobename="ysuperior", category="lm", description="MODIFIER LETTER SMALL Y", direction="l", @@ -7061,6 +7358,7 @@ characters.data={ unicodeslot=0x02B8, }, { + adobename="primemod", category="lm", description="MODIFIER LETTER PRIME", direction="on", @@ -7068,6 +7366,7 @@ characters.data={ unicodeslot=0x02B9, }, { + adobename="dblprimemod", category="lm", description="MODIFIER LETTER DOUBLE PRIME", direction="on", @@ -7075,6 +7374,7 @@ characters.data={ unicodeslot=0x02BA, }, { + adobename="commaturnedmod", category="lm", description="MODIFIER LETTER TURNED COMMA", direction="l", @@ -7082,7 +7382,7 @@ characters.data={ unicodeslot=0x02BB, }, { - adobename="afii57929", + adobename="apostrophemod", category="lm", description="MODIFIER LETTER APOSTROPHE", direction="l", @@ -7090,7 +7390,7 @@ characters.data={ unicodeslot=0x02BC, }, { - adobename="afii64937", + adobename="commareversedmod", category="lm", description="MODIFIER LETTER REVERSED COMMA", direction="l", @@ -7098,6 +7398,7 @@ characters.data={ unicodeslot=0x02BD, }, { + adobename="ringhalfright", category="lm", description="MODIFIER LETTER RIGHT HALF RING", direction="l", @@ -7105,6 +7406,7 @@ characters.data={ unicodeslot=0x02BE, }, { + adobename="ringhalfleft", category="lm", description="MODIFIER LETTER LEFT HALF RING", direction="l", @@ -7112,6 +7414,7 @@ characters.data={ unicodeslot=0x02BF, }, { + adobename="glottalstopmod", category="lm", description="MODIFIER LETTER GLOTTAL STOP", direction="l", @@ -7119,6 +7422,7 @@ characters.data={ unicodeslot=0x02C0, }, { + adobename="glottalstopreversedmod", category="lm", description="MODIFIER LETTER REVERSED GLOTTAL STOP", direction="l", @@ -7126,6 +7430,7 @@ characters.data={ unicodeslot=0x02C1, }, { + adobename="arrowheadleftmod", category="sk", description="MODIFIER LETTER LEFT ARROWHEAD", direction="on", @@ -7133,6 +7438,7 @@ characters.data={ unicodeslot=0x02C2, }, { + adobename="arrowheadrightmod", category="sk", description="MODIFIER LETTER RIGHT ARROWHEAD", direction="on", @@ -7140,6 +7446,7 @@ characters.data={ unicodeslot=0x02C3, }, { + adobename="arrowheadupmod", category="sk", cjkwd="a", description="MODIFIER LETTER UP ARROWHEAD", @@ -7148,6 +7455,7 @@ characters.data={ unicodeslot=0x02C4, }, { + adobename="arrowheaddownmod", category="sk", description="MODIFIER LETTER DOWN ARROWHEAD", direction="on", @@ -7180,6 +7488,7 @@ characters.data={ unicodeslot=0x02C7, }, { + adobename="verticallinemod", category="lm", description="MODIFIER LETTER VERTICAL LINE", direction="on", @@ -7187,6 +7496,7 @@ characters.data={ unicodeslot=0x02C8, }, { + adobename="firsttonechinese", category="lm", cjkwd="a", description="MODIFIER LETTER MACRON", @@ -7195,6 +7505,7 @@ characters.data={ unicodeslot=0x02C9, }, { + adobename="secondtonechinese", category="lm", cjkwd="a", description="MODIFIER LETTER ACUTE ACCENT", @@ -7203,6 +7514,7 @@ characters.data={ unicodeslot=0x02CA, }, { + adobename="fourthtonechinese", category="lm", cjkwd="a", description="MODIFIER LETTER GRAVE ACCENT", @@ -7211,6 +7523,7 @@ characters.data={ unicodeslot=0x02CB, }, { + adobename="verticallinelowmod", category="lm", description="MODIFIER LETTER LOW VERTICAL LINE", direction="on", @@ -7218,6 +7531,7 @@ characters.data={ unicodeslot=0x02CC, }, { + adobename="macronlowmod", category="lm", cjkwd="a", description="MODIFIER LETTER LOW MACRON", @@ -7226,6 +7540,7 @@ characters.data={ unicodeslot=0x02CD, }, { + adobename="gravelowmod", category="lm", description="MODIFIER LETTER LOW GRAVE ACCENT", direction="on", @@ -7233,6 +7548,7 @@ characters.data={ unicodeslot=0x02CE, }, { + adobename="acutelowmod", category="lm", description="MODIFIER LETTER LOW ACUTE ACCENT", direction="on", @@ -7240,6 +7556,7 @@ characters.data={ unicodeslot=0x02CF, }, { + adobename="colontriangularmod", category="lm", cjkwd="a", description="MODIFIER LETTER TRIANGULAR COLON", @@ -7248,6 +7565,7 @@ characters.data={ unicodeslot=0x02D0, }, { + adobename="colontriangularhalfmod", category="lm", description="MODIFIER LETTER HALF TRIANGULAR COLON", direction="l", @@ -7255,6 +7573,7 @@ characters.data={ unicodeslot=0x02D1, }, { + adobename="ringhalfrightcentered", category="sk", description="MODIFIER LETTER CENTRED RIGHT HALF RING", direction="on", @@ -7262,6 +7581,7 @@ characters.data={ unicodeslot=0x02D2, }, { + adobename="ringhalfleftcentered", category="sk", description="MODIFIER LETTER CENTRED LEFT HALF RING", direction="on", @@ -7269,6 +7589,7 @@ characters.data={ unicodeslot=0x02D3, }, { + adobename="uptackmod", category="sk", description="MODIFIER LETTER UP TACK", direction="on", @@ -7276,6 +7597,7 @@ characters.data={ unicodeslot=0x02D4, }, { + adobename="downtackmod", category="sk", description="MODIFIER LETTER DOWN TACK", direction="on", @@ -7283,6 +7605,7 @@ characters.data={ unicodeslot=0x02D5, }, { + adobename="plusmod", category="sk", description="MODIFIER LETTER PLUS SIGN", direction="on", @@ -7290,6 +7613,7 @@ characters.data={ unicodeslot=0x02D6, }, { + adobename="minusmod", category="sk", description="MODIFIER LETTER MINUS SIGN", direction="on", @@ -7370,6 +7694,7 @@ characters.data={ unicodeslot=0x02DD, }, { + adobename="rhotichookmod", category="sk", description="MODIFIER LETTER RHOTIC HOOK", direction="on", @@ -7385,6 +7710,7 @@ characters.data={ unicodeslot=0x02DF, }, { + adobename="gammasuperior", category="lm", description="MODIFIER LETTER SMALL GAMMA", direction="l", @@ -7409,6 +7735,7 @@ characters.data={ unicodeslot=0x02E2, }, { + adobename="xsuperior", category="lm", description="MODIFIER LETTER SMALL X", direction="l", @@ -7417,6 +7744,7 @@ characters.data={ unicodeslot=0x02E3, }, { + adobename="glottalstopreversedsuperior", category="lm", description="MODIFIER LETTER SMALL REVERSED GLOTTAL STOP", direction="l", @@ -7425,6 +7753,7 @@ characters.data={ unicodeslot=0x02E4, }, { + adobename="tonebarextrahighmod", category="sk", description="MODIFIER LETTER EXTRA-HIGH TONE BAR", direction="on", @@ -7432,6 +7761,7 @@ characters.data={ unicodeslot=0x02E5, }, { + adobename="tonebarhighmod", category="sk", description="MODIFIER LETTER HIGH TONE BAR", direction="on", @@ -7439,6 +7769,7 @@ characters.data={ unicodeslot=0x02E6, }, { + adobename="tonebarmidmod", category="sk", description="MODIFIER LETTER MID TONE BAR", direction="on", @@ -7446,6 +7777,7 @@ characters.data={ unicodeslot=0x02E7, }, { + adobename="tonebarlowmod", category="sk", description="MODIFIER LETTER LOW TONE BAR", direction="on", @@ -7453,6 +7785,7 @@ characters.data={ unicodeslot=0x02E8, }, { + adobename="tonebarextralowmod", category="sk", description="MODIFIER LETTER EXTRA-LOW TONE BAR", direction="on", @@ -7632,6 +7965,7 @@ characters.data={ unicodeslot=0x0301, }, { + adobename="circumflexcmb", category="mn", cjkwd="a", description="COMBINING CIRCUMFLEX ACCENT", @@ -7651,6 +7985,7 @@ characters.data={ unicodeslot=0x0303, }, { + adobename="macroncmb", category="mn", cjkwd="a", description="COMBINING MACRON", @@ -7659,6 +7994,7 @@ characters.data={ unicodeslot=0x0304, }, { + adobename="overlinecmb", category="mn", cjkwd="a", description="COMBINING OVERLINE", @@ -7667,6 +8003,7 @@ characters.data={ unicodeslot=0x0305, }, { + adobename="brevecmb", category="mn", cjkwd="a", description="COMBINING BREVE", @@ -7675,6 +8012,7 @@ characters.data={ unicodeslot=0x0306, }, { + adobename="dotaccentcmb", category="mn", cjkwd="a", description="COMBINING DOT ABOVE", @@ -7683,6 +8021,7 @@ characters.data={ unicodeslot=0x0307, }, { + adobename="dieresiscmb", category="mn", cjkwd="a", description="COMBINING DIAERESIS", @@ -7691,7 +8030,7 @@ characters.data={ unicodeslot=0x0308, }, { - adobename="hookabovecomb", + adobename="hookcmb", category="mn", cjkwd="a", description="COMBINING HOOK ABOVE", @@ -7700,6 +8039,7 @@ characters.data={ unicodeslot=0x0309, }, { + adobename="ringcmb", category="mn", cjkwd="a", description="COMBINING RING ABOVE", @@ -7708,6 +8048,7 @@ characters.data={ unicodeslot=0x030A, }, { + adobename="hungarumlautcmb", category="mn", cjkwd="a", description="COMBINING DOUBLE ACUTE ACCENT", @@ -7716,6 +8057,7 @@ characters.data={ unicodeslot=0x030B, }, { + adobename="caroncmb", category="mn", cjkwd="a", description="COMBINING CARON", @@ -7724,6 +8066,7 @@ characters.data={ unicodeslot=0x030C, }, { + adobename="verticallineabovecmb", category="mn", cjkwd="a", description="COMBINING VERTICAL LINE ABOVE", @@ -7732,6 +8075,7 @@ characters.data={ unicodeslot=0x030D, }, { + adobename="dblverticallineabovecmb", category="mn", cjkwd="a", description="COMBINING DOUBLE VERTICAL LINE ABOVE", @@ -7740,6 +8084,7 @@ characters.data={ unicodeslot=0x030E, }, { + adobename="dblgravecmb", category="mn", cjkwd="a", description="COMBINING DOUBLE GRAVE ACCENT", @@ -7748,6 +8093,7 @@ characters.data={ unicodeslot=0x030F, }, { + adobename="candrabinducmb", category="mn", cjkwd="a", description="COMBINING CANDRABINDU", @@ -7756,6 +8102,7 @@ characters.data={ unicodeslot=0x0310, }, { + adobename="breveinvertedcmb", category="mn", cjkwd="a", description="COMBINING INVERTED BREVE", @@ -7764,6 +8111,7 @@ characters.data={ unicodeslot=0x0311, }, { + adobename="commaturnedabovecmb", category="mn", cjkwd="a", description="COMBINING TURNED COMMA ABOVE", @@ -7772,6 +8120,7 @@ characters.data={ unicodeslot=0x0312, }, { + adobename="commaabovecmb", category="mn", cjkwd="a", description="COMBINING COMMA ABOVE", @@ -7780,6 +8129,7 @@ characters.data={ unicodeslot=0x0313, }, { + adobename="commareversedabovecmb", category="mn", cjkwd="a", description="COMBINING REVERSED COMMA ABOVE", @@ -7788,6 +8138,7 @@ characters.data={ unicodeslot=0x0314, }, { + adobename="commaaboverightcmb", category="mn", cjkwd="a", description="COMBINING COMMA ABOVE RIGHT", @@ -7796,6 +8147,7 @@ characters.data={ unicodeslot=0x0315, }, { + adobename="gravebelowcmb", category="mn", cjkwd="a", description="COMBINING GRAVE ACCENT BELOW", @@ -7804,6 +8156,7 @@ characters.data={ unicodeslot=0x0316, }, { + adobename="acutebelowcmb", category="mn", cjkwd="a", description="COMBINING ACUTE ACCENT BELOW", @@ -7812,6 +8165,7 @@ characters.data={ unicodeslot=0x0317, }, { + adobename="lefttackbelowcmb", category="mn", cjkwd="a", description="COMBINING LEFT TACK BELOW", @@ -7820,6 +8174,7 @@ characters.data={ unicodeslot=0x0318, }, { + adobename="righttackbelowcmb", category="mn", cjkwd="a", description="COMBINING RIGHT TACK BELOW", @@ -7828,6 +8183,7 @@ characters.data={ unicodeslot=0x0319, }, { + adobename="leftangleabovecmb", category="mn", cjkwd="a", description="COMBINING LEFT ANGLE ABOVE", @@ -7836,6 +8192,7 @@ characters.data={ unicodeslot=0x031A, }, { + adobename="horncmb", category="mn", cjkwd="a", description="COMBINING HORN", @@ -7844,6 +8201,7 @@ characters.data={ unicodeslot=0x031B, }, { + adobename="ringhalfleftbelowcmb", category="mn", cjkwd="a", description="COMBINING LEFT HALF RING BELOW", @@ -7852,6 +8210,7 @@ characters.data={ unicodeslot=0x031C, }, { + adobename="uptackbelowcmb", category="mn", cjkwd="a", description="COMBINING UP TACK BELOW", @@ -7860,6 +8219,7 @@ characters.data={ unicodeslot=0x031D, }, { + adobename="downtackbelowcmb", category="mn", cjkwd="a", description="COMBINING DOWN TACK BELOW", @@ -7868,6 +8228,7 @@ characters.data={ unicodeslot=0x031E, }, { + adobename="plusbelowcmb", category="mn", cjkwd="a", description="COMBINING PLUS SIGN BELOW", @@ -7876,6 +8237,7 @@ characters.data={ unicodeslot=0x031F, }, { + adobename="minusbelowcmb", category="mn", cjkwd="a", description="COMBINING MINUS SIGN BELOW", @@ -7884,6 +8246,7 @@ characters.data={ unicodeslot=0x0320, }, { + adobename="hookpalatalizedbelowcmb", category="mn", cjkwd="a", description="COMBINING PALATALIZED HOOK BELOW", @@ -7892,6 +8255,7 @@ characters.data={ unicodeslot=0x0321, }, { + adobename="hookretroflexbelowcmb", category="mn", cjkwd="a", description="COMBINING RETROFLEX HOOK BELOW", @@ -7910,6 +8274,7 @@ characters.data={ unicodeslot=0x0323, }, { + adobename="dieresisbelowcmb", category="mn", cjkwd="a", description="COMBINING DIAERESIS BELOW", @@ -7918,6 +8283,7 @@ characters.data={ unicodeslot=0x0324, }, { + adobename="ringbelowcmb", category="mn", cjkwd="a", description="COMBINING RING BELOW", @@ -7935,6 +8301,7 @@ characters.data={ unicodeslot=0x0326, }, { + adobename="cedillacmb", category="mn", cjkwd="a", description="COMBINING CEDILLA", @@ -7943,6 +8310,7 @@ characters.data={ unicodeslot=0x0327, }, { + adobename="ogonekcmb", category="mn", cjkwd="a", description="COMBINING OGONEK", @@ -7951,6 +8319,7 @@ characters.data={ unicodeslot=0x0328, }, { + adobename="verticallinebelowcmb", category="mn", cjkwd="a", description="COMBINING VERTICAL LINE BELOW", @@ -7959,6 +8328,7 @@ characters.data={ unicodeslot=0x0329, }, { + adobename="bridgebelowcmb", category="mn", cjkwd="a", description="COMBINING BRIDGE BELOW", @@ -7967,6 +8337,7 @@ characters.data={ unicodeslot=0x032A, }, { + adobename="dblarchinvertedbelowcmb", category="mn", cjkwd="a", description="COMBINING INVERTED DOUBLE ARCH BELOW", @@ -7975,6 +8346,7 @@ characters.data={ unicodeslot=0x032B, }, { + adobename="caronbelowcmb", category="mn", cjkwd="a", description="COMBINING CARON BELOW", @@ -7983,6 +8355,7 @@ characters.data={ unicodeslot=0x032C, }, { + adobename="circumflexbelowcmb", category="mn", cjkwd="a", description="COMBINING CIRCUMFLEX ACCENT BELOW", @@ -7991,6 +8364,7 @@ characters.data={ unicodeslot=0x032D, }, { + adobename="brevebelowcmb", category="mn", cjkwd="a", description="COMBINING BREVE BELOW", @@ -7999,6 +8373,7 @@ characters.data={ unicodeslot=0x032E, }, { + adobename="breveinvertedbelowcmb", category="mn", cjkwd="a", description="COMBINING INVERTED BREVE BELOW", @@ -8007,6 +8382,7 @@ characters.data={ unicodeslot=0x032F, }, { + adobename="tildebelowcmb", category="mn", cjkwd="a", description="COMBINING TILDE BELOW", @@ -8015,6 +8391,7 @@ characters.data={ unicodeslot=0x0330, }, { + adobename="macronbelowcmb", category="mn", cjkwd="a", description="COMBINING MACRON BELOW", @@ -8023,6 +8400,7 @@ characters.data={ unicodeslot=0x0331, }, { + adobename="lowlinecmb", category="mn", cjkwd="a", description="COMBINING LOW LINE", @@ -8031,6 +8409,7 @@ characters.data={ unicodeslot=0x0332, }, { + adobename="dbllowlinecmb", category="mn", cjkwd="a", description="COMBINING DOUBLE LOW LINE", @@ -8039,6 +8418,7 @@ characters.data={ unicodeslot=0x0333, }, { + adobename="tildeoverlaycmb", category="mn", cjkwd="a", description="COMBINING TILDE OVERLAY", @@ -8047,6 +8427,7 @@ characters.data={ unicodeslot=0x0334, }, { + adobename="strokeshortoverlaycmb", category="mn", cjkwd="a", description="COMBINING SHORT STROKE OVERLAY", @@ -8055,6 +8436,7 @@ characters.data={ unicodeslot=0x0335, }, { + adobename="strokelongoverlaycmb", category="mn", cjkwd="a", description="COMBINING LONG STROKE OVERLAY", @@ -8063,6 +8445,7 @@ characters.data={ unicodeslot=0x0336, }, { + adobename="solidusshortoverlaycmb", category="mn", cjkwd="a", description="COMBINING SHORT SOLIDUS OVERLAY", @@ -8071,6 +8454,7 @@ characters.data={ unicodeslot=0x0337, }, { + adobename="soliduslongoverlaycmb", category="mn", cjkwd="a", description="COMBINING LONG SOLIDUS OVERLAY", @@ -8081,6 +8465,7 @@ characters.data={ unicodeslot=0x0338, }, { + adobename="ringhalfrightbelowcmb", category="mn", cjkwd="a", description="COMBINING RIGHT HALF RING BELOW", @@ -8089,6 +8474,7 @@ characters.data={ unicodeslot=0x0339, }, { + adobename="bridgeinvertedbelowcmb", category="mn", cjkwd="a", description="COMBINING INVERTED BRIDGE BELOW", @@ -8097,6 +8483,7 @@ characters.data={ unicodeslot=0x033A, }, { + adobename="squarebelowcmb", category="mn", cjkwd="a", description="COMBINING SQUARE BELOW", @@ -8105,6 +8492,7 @@ characters.data={ unicodeslot=0x033B, }, { + adobename="seagullbelowcmb", category="mn", cjkwd="a", description="COMBINING SEAGULL BELOW", @@ -8113,6 +8501,7 @@ characters.data={ unicodeslot=0x033C, }, { + adobename="xabovecmb", category="mn", cjkwd="a", description="COMBINING X ABOVE", @@ -8121,6 +8510,7 @@ characters.data={ unicodeslot=0x033D, }, { + adobename="tildeverticalcmb", category="mn", cjkwd="a", description="COMBINING VERTICAL TILDE", @@ -8129,6 +8519,7 @@ characters.data={ unicodeslot=0x033E, }, { + adobename="dbloverlinecmb", category="mn", cjkwd="a", description="COMBINING DOUBLE OVERLINE", @@ -8137,6 +8528,7 @@ characters.data={ unicodeslot=0x033F, }, { + adobename="gravetonecmb", category="mn", cjkwd="a", description="COMBINING GRAVE TONE MARK", @@ -8146,6 +8538,7 @@ characters.data={ unicodeslot=0x0340, }, { + adobename="acutetonecmb", category="mn", cjkwd="a", description="COMBINING ACUTE TONE MARK", @@ -8155,6 +8548,7 @@ characters.data={ unicodeslot=0x0341, }, { + adobename="perispomenigreekcmb", category="mn", cjkwd="a", description="COMBINING GREEK PERISPOMENI", @@ -8163,6 +8557,7 @@ characters.data={ unicodeslot=0x0342, }, { + adobename="koroniscmb", category="mn", cjkwd="a", description="COMBINING GREEK KORONIS", @@ -8172,6 +8567,7 @@ characters.data={ unicodeslot=0x0343, }, { + adobename="dialytikatonoscmb", category="mn", cjkwd="a", description="COMBINING GREEK DIALYTIKA TONOS", @@ -8181,6 +8577,7 @@ characters.data={ unicodeslot=0x0344, }, { + adobename="ypogegrammenigreekcmb", category="mn", cjkwd="a", description="COMBINING GREEK YPOGEGRAMMENI", @@ -8398,6 +8795,7 @@ characters.data={ unicodeslot=0x035F, }, { + adobename="tildedoublecmb", category="mn", cjkwd="a", description="COMBINING DOUBLE TILDE", @@ -8406,6 +8804,7 @@ characters.data={ unicodeslot=0x0360, }, { + adobename="breveinverteddoublecmb", category="mn", cjkwd="a", description="COMBINING DOUBLE INVERTED BREVE", @@ -8526,6 +8925,7 @@ characters.data={ unicodeslot=0x036F, }, [0x0374]={ + adobename="numeralsigngreek", category="sk", description="GREEK NUMERAL SIGN", direction="on", @@ -8534,6 +8934,7 @@ characters.data={ unicodeslot=0x0374, }, [0x0375]={ + adobename="numeralsignlowergreek", category="sk", description="GREEK LOWER NUMERAL SIGN", direction="on", @@ -8541,6 +8942,7 @@ characters.data={ unicodeslot=0x0375, }, [0x037A]={ + adobename="ypogegrammeni", category="lm", description="GREEK YPOGEGRAMMENI", direction="l", @@ -8573,6 +8975,7 @@ characters.data={ unicodeslot=0x037D, }, [0x037E]={ + adobename="questiongreek", category="po", description="GREEK QUESTION MARK", direction="on", @@ -8712,9 +9115,9 @@ characters.data={ description="GREEK CAPITAL LETTER ALPHA", direction="l", lccode=0x03B1, + linebreak="al", mathclass="variable", mathname="Alpha", - linebreak="al", unicodeslot=0x0391, }, [0x0392]={ @@ -8725,9 +9128,9 @@ characters.data={ description="GREEK CAPITAL LETTER BETA", direction="l", lccode=0x03B2, + linebreak="al", mathclass="variable", mathname="Beta", - linebreak="al", unicodeslot=0x0392, }, [0x0393]={ @@ -8737,22 +9140,23 @@ characters.data={ contextname="greekGamma", description="GREEK CAPITAL LETTER GAMMA", direction="l", - mathclass="variable", - mathname="Gamma", lccode=0x03B3, linebreak="al", + mathclass="variable", + mathname="Gamma", unicodeslot=0x0393, }, [0x0394]={ + adobename="Deltagreek", category="lu", cjkwd="a", contextname="greekDelta", description="GREEK CAPITAL LETTER DELTA", direction="l", - mathclass="variable", - mathname="Delta", lccode=0x03B4, linebreak="al", + mathclass="variable", + mathname="Delta", unicodeslot=0x0394, }, [0x0395]={ @@ -8762,10 +9166,10 @@ characters.data={ contextname="greekEpsilon", description="GREEK CAPITAL LETTER EPSILON", direction="l", - mathclass="variable", - mathname="Epsilon", lccode=0x03B5, linebreak="al", + mathclass="variable", + mathname="Epsilon", unicodeslot=0x0395, }, [0x0396]={ @@ -8775,10 +9179,10 @@ characters.data={ contextname="greekZeta", description="GREEK CAPITAL LETTER ZETA", direction="l", - mathclass="variable", - mathname="Zeta", lccode=0x03B6, linebreak="al", + mathclass="variable", + mathname="Zeta", unicodeslot=0x0396, }, [0x0397]={ @@ -8788,10 +9192,10 @@ characters.data={ contextname="greekEta", description="GREEK CAPITAL LETTER ETA", direction="l", - mathclass="variable", - mathname="Eta", lccode=0x03B7, linebreak="al", + mathclass="variable", + mathname="Eta", unicodeslot=0x0397, }, [0x0398]={ @@ -8801,10 +9205,10 @@ characters.data={ contextname="greekTheta", description="GREEK CAPITAL LETTER THETA", direction="l", - mathclass="variable", - mathname="Theta", lccode=0x03B8, linebreak="al", + mathclass="variable", + mathname="Theta", unicodeslot=0x0398, }, [0x0399]={ @@ -8814,10 +9218,10 @@ characters.data={ contextname="greekIota", description="GREEK CAPITAL LETTER IOTA", direction="l", - mathclass="variable", - mathname="Iota", lccode=0x03B9, linebreak="al", + mathclass="variable", + mathname="Iota", unicodeslot=0x0399, }, [0x039A]={ @@ -8827,10 +9231,10 @@ characters.data={ contextname="greekKappa", description="GREEK CAPITAL LETTER KAPPA", direction="l", - mathclass="variable", - mathname="Kappa", lccode=0x03BA, linebreak="al", + mathclass="variable", + mathname="Kappa", unicodeslot=0x039A, }, [0x039B]={ @@ -8840,10 +9244,10 @@ characters.data={ contextname="greekLambda", description="GREEK CAPITAL LETTER LAMDA", direction="l", - mathclass="variable", - mathname="Lambda", lccode=0x03BB, linebreak="al", + mathclass="variable", + mathname="Lambda", unicodeslot=0x039B, }, [0x039C]={ @@ -8853,10 +9257,10 @@ characters.data={ contextname="greekMu", description="GREEK CAPITAL LETTER MU", direction="l", - mathclass="variable", - mathname="Mu", lccode=0x03BC, linebreak="al", + mathclass="variable", + mathname="Mu", unicodeslot=0x039C, }, [0x039D]={ @@ -8866,10 +9270,10 @@ characters.data={ contextname="greekNu", description="GREEK CAPITAL LETTER NU", direction="l", - mathclass="variable", - mathname="Nu", lccode=0x03BD, linebreak="al", + mathclass="variable", + mathname="Nu", unicodeslot=0x039D, }, [0x039E]={ @@ -8879,10 +9283,10 @@ characters.data={ contextname="greekXi", description="GREEK CAPITAL LETTER XI", direction="l", - mathclass="variable", - mathname="Xi", lccode=0x03BE, linebreak="al", + mathclass="variable", + mathname="Xi", unicodeslot=0x039E, }, [0x039F]={ @@ -8892,10 +9296,10 @@ characters.data={ contextname="greekOmicron", description="GREEK CAPITAL LETTER OMICRON", direction="l", - mathclass="variable", - mathname="Omicron", lccode=0x03BF, linebreak="al", + mathclass="variable", + mathname="Omicron", unicodeslot=0x039F, }, [0x03A0]={ @@ -8905,10 +9309,10 @@ characters.data={ contextname="greekPi", description="GREEK CAPITAL LETTER PI", direction="l", - mathclass="variable", - mathname="Pi", lccode=0x03C0, linebreak="al", + mathclass="variable", + mathname="Pi", unicodeslot=0x03A0, }, [0x03A1]={ @@ -8918,10 +9322,10 @@ characters.data={ contextname="greekRho", description="GREEK CAPITAL LETTER RHO", direction="l", - mathclass="variable", - mathname="Rho", lccode=0x03C1, linebreak="al", + mathclass="variable", + mathname="Rho", unicodeslot=0x03A1, }, [0x03A3]={ @@ -8931,10 +9335,10 @@ characters.data={ contextname="greekSigma", description="GREEK CAPITAL LETTER SIGMA", direction="l", - mathclass="variable", - mathname="Sigma", lccode=0x03C3, linebreak="al", + mathclass="variable", + mathname="Sigma", unicodeslot=0x03A3, }, [0x03A4]={ @@ -8944,10 +9348,10 @@ characters.data={ contextname="greekTau", description="GREEK CAPITAL LETTER TAU", direction="l", - mathclass="variable", - mathname="Tau", lccode=0x03C4, linebreak="al", + mathclass="variable", + mathname="Tau", unicodeslot=0x03A4, }, [0x03A5]={ @@ -8957,10 +9361,10 @@ characters.data={ contextname="greekUpsilon", description="GREEK CAPITAL LETTER UPSILON", direction="l", - mathclass="variable", - mathname="Upsilon", lccode=0x03C5, linebreak="al", + mathclass="variable", + mathname="Upsilon", unicodeslot=0x03A5, }, [0x03A6]={ @@ -8970,10 +9374,10 @@ characters.data={ contextname="greekPhi", description="GREEK CAPITAL LETTER PHI", direction="l", - mathclass="variable", - mathname="Phi", lccode=0x03C6, linebreak="al", + mathclass="variable", + mathname="Phi", unicodeslot=0x03A6, }, [0x03A7]={ @@ -8983,10 +9387,10 @@ characters.data={ contextname="greekChi", description="GREEK CAPITAL LETTER CHI", direction="l", - mathclass="variable", - mathname="Chi", lccode=0x03C7, linebreak="al", + mathclass="variable", + mathname="Chi", unicodeslot=0x03A7, }, [0x03A8]={ @@ -8996,22 +9400,23 @@ characters.data={ contextname="greekPsi", description="GREEK CAPITAL LETTER PSI", direction="l", - mathclass="variable", - mathname="Psi", lccode=0x03C8, linebreak="al", + mathclass="variable", + mathname="Psi", unicodeslot=0x03A8, }, [0x03A9]={ + adobename="Omegagreek", category="lu", cjkwd="a", contextname="greekOmega", description="GREEK CAPITAL LETTER OMEGA", direction="l", - mathclass="variable", - mathname="Omega", lccode=0x03C9, linebreak="al", + mathclass="variable", + mathname="Omega", unicodeslot=0x03A9, }, [0x03AA]={ @@ -9241,6 +9646,7 @@ characters.data={ unicodeslot=0x03BB, }, [0x03BC]={ + adobename="mugreek", category="ll", cjkwd="a", contextname="greekmu", @@ -9318,7 +9724,7 @@ characters.data={ unicodeslot=0x03C1, }, [0x03C2]={ - adobename="sigma1", + adobename="sigmafinal", category="ll", contextname="greekfinalsigma", description="GREEK SMALL LETTER FINAL SIGMA", @@ -9481,6 +9887,7 @@ characters.data={ unicodeslot=0x03CE, }, [0x03D0]={ + adobename="betasymbolgreek", category="ll", description="GREEK BETA SYMBOL", direction="l", @@ -9490,7 +9897,7 @@ characters.data={ unicodeslot=0x03D0, }, [0x03D1]={ - adobename="theta1", + adobename="thetasymbolgreek", category="ll", contextname="greekthetaalt", description="GREEK THETA SYMBOL", @@ -9503,7 +9910,7 @@ characters.data={ unicodeslot=0x03D1, }, [0x03D2]={ - adobename="Upsilon1", + adobename="Upsilonhooksymbol", category="lu", description="GREEK UPSILON WITH HOOK SYMBOL", direction="l", @@ -9512,6 +9919,7 @@ characters.data={ unicodeslot=0x03D2, }, [0x03D3]={ + adobename="Upsilonacutehooksymbolgreek", category="lu", description="GREEK UPSILON WITH ACUTE AND HOOK SYMBOL", direction="l", @@ -9520,6 +9928,7 @@ characters.data={ unicodeslot=0x03D3, }, [0x03D4]={ + adobename="Upsilondieresishooksymbolgreek", category="lu", description="GREEK UPSILON WITH DIAERESIS AND HOOK SYMBOL", direction="l", @@ -9528,20 +9937,20 @@ characters.data={ unicodeslot=0x03D4, }, [0x03D5]={ - adobename="phi1", + adobename="phisymbolgreek", category="ll", contextname="greekphialt", description="GREEK PHI SYMBOL", direction="l", linebreak="al", - specials={ "compat", 0x03C6 }, mathclass="variable", mathname="phi", + specials={ "compat", 0x03C6 }, uccode=0x03A6, unicodeslot=0x03D5, }, [0x03D6]={ - adobename="omega1", + adobename="pisymbolgreek", category="ll", contextname="greekpialt", description="GREEK PI SYMBOL", @@ -9578,6 +9987,7 @@ characters.data={ unicodeslot=0x03D9, }, [0x03DA]={ + adobename="Stigmagreek", category="lu", description="GREEK LETTER STIGMA", direction="l", @@ -9595,6 +10005,7 @@ characters.data={ unicodeslot=0x03DB, }, [0x03DC]={ + adobename="Digammagreek", category="lu", description="GREEK LETTER DIGAMMA", direction="l", @@ -9614,6 +10025,7 @@ characters.data={ unicodeslot=0x03DD, }, [0x03DE]={ + adobename="Koppagreek", category="lu", description="GREEK LETTER KOPPA", direction="l", @@ -9631,6 +10043,7 @@ characters.data={ unicodeslot=0x03DF, }, [0x03E0]={ + adobename="Sampigreek", category="lu", description="GREEK LETTER SAMPI", direction="l", @@ -9648,6 +10061,7 @@ characters.data={ unicodeslot=0x03E1, }, [0x03E2]={ + adobename="Sheicoptic", category="lu", description="COPTIC CAPITAL LETTER SHEI", direction="l", @@ -9656,6 +10070,7 @@ characters.data={ unicodeslot=0x03E2, }, [0x03E3]={ + adobename="sheicoptic", category="ll", description="COPTIC SMALL LETTER SHEI", direction="l", @@ -9664,6 +10079,7 @@ characters.data={ unicodeslot=0x03E3, }, [0x03E4]={ + adobename="Feicoptic", category="lu", description="COPTIC CAPITAL LETTER FEI", direction="l", @@ -9672,6 +10088,7 @@ characters.data={ unicodeslot=0x03E4, }, [0x03E5]={ + adobename="feicoptic", category="ll", description="COPTIC SMALL LETTER FEI", direction="l", @@ -9680,6 +10097,7 @@ characters.data={ unicodeslot=0x03E5, }, [0x03E6]={ + adobename="Kheicoptic", category="lu", description="COPTIC CAPITAL LETTER KHEI", direction="l", @@ -9688,6 +10106,7 @@ characters.data={ unicodeslot=0x03E6, }, [0x03E7]={ + adobename="kheicoptic", category="ll", description="COPTIC SMALL LETTER KHEI", direction="l", @@ -9696,6 +10115,7 @@ characters.data={ unicodeslot=0x03E7, }, [0x03E8]={ + adobename="Horicoptic", category="lu", description="COPTIC CAPITAL LETTER HORI", direction="l", @@ -9704,6 +10124,7 @@ characters.data={ unicodeslot=0x03E8, }, [0x03E9]={ + adobename="horicoptic", category="ll", description="COPTIC SMALL LETTER HORI", direction="l", @@ -9712,6 +10133,7 @@ characters.data={ unicodeslot=0x03E9, }, [0x03EA]={ + adobename="Gangiacoptic", category="lu", description="COPTIC CAPITAL LETTER GANGIA", direction="l", @@ -9720,6 +10142,7 @@ characters.data={ unicodeslot=0x03EA, }, [0x03EB]={ + adobename="gangiacoptic", category="ll", description="COPTIC SMALL LETTER GANGIA", direction="l", @@ -9728,6 +10151,7 @@ characters.data={ unicodeslot=0x03EB, }, [0x03EC]={ + adobename="Shimacoptic", category="lu", description="COPTIC CAPITAL LETTER SHIMA", direction="l", @@ -9736,6 +10160,7 @@ characters.data={ unicodeslot=0x03EC, }, [0x03ED]={ + adobename="shimacoptic", category="ll", description="COPTIC SMALL LETTER SHIMA", direction="l", @@ -9744,6 +10169,7 @@ characters.data={ unicodeslot=0x03ED, }, [0x03EE]={ + adobename="Deicoptic", category="lu", description="COPTIC CAPITAL LETTER DEI", direction="l", @@ -9752,6 +10178,7 @@ characters.data={ unicodeslot=0x03EE, }, [0x03EF]={ + adobename="deicoptic", category="ll", description="COPTIC SMALL LETTER DEI", direction="l", @@ -9760,17 +10187,19 @@ characters.data={ unicodeslot=0x03EF, }, [0x03F0]={ + adobename="kappasymbolgreek", category="ll", description="GREEK KAPPA SYMBOL", direction="l", linebreak="al", - specials={ "compat", 0x03BA }, mathclass="ord", mathname="varkappa", + specials={ "compat", 0x03BA }, uccode=0x039A, unicodeslot=0x03F0, }, [0x03F1]={ + adobename="rhosymbolgreek", category="ll", contextname="greekrhoalt", description="GREEK RHO SYMBOL", @@ -9781,6 +10210,7 @@ characters.data={ unicodeslot=0x03F1, }, [0x03F2]={ + adobename="sigmalunatesymbolgreek", category="ll", contextname="greeksigmalunate", description="GREEK LUNATE SIGMA SYMBOL", @@ -9791,6 +10221,7 @@ characters.data={ unicodeslot=0x03F2, }, [0x03F3]={ + adobename="yotgreek", category="ll", description="GREEK LETTER YOT", direction="l", @@ -10433,7 +10864,7 @@ characters.data={ unicodeslot=0x0430, }, [0x0431]={ - adobename="afii10066", + adobename="becyrillic", category="ll", cjkwd="a", contextname="cyrillicb", @@ -10444,7 +10875,7 @@ characters.data={ unicodeslot=0x0431, }, [0x0432]={ - adobename="afii10067", + adobename="vecyrillic", category="ll", cjkwd="a", contextname="cyrillicv", @@ -10455,7 +10886,7 @@ characters.data={ unicodeslot=0x0432, }, [0x0433]={ - adobename="afii10068", + adobename="gecyrillic", category="ll", cjkwd="a", contextname="cyrillicg", @@ -10466,7 +10897,7 @@ characters.data={ unicodeslot=0x0433, }, [0x0434]={ - adobename="afii10069", + adobename="decyrillic", category="ll", cjkwd="a", contextname="cyrillicd", @@ -10477,7 +10908,7 @@ characters.data={ unicodeslot=0x0434, }, [0x0435]={ - adobename="afii10070", + adobename="iecyrillic", category="ll", cjkwd="a", contextname="cyrillice", @@ -10488,7 +10919,7 @@ characters.data={ unicodeslot=0x0435, }, [0x0436]={ - adobename="afii10072", + adobename="zhecyrillic", category="ll", cjkwd="a", contextname="cyrilliczh", @@ -10499,7 +10930,7 @@ characters.data={ unicodeslot=0x0436, }, [0x0437]={ - adobename="afii10073", + adobename="zecyrillic", category="ll", cjkwd="a", contextname="cyrillicz", @@ -10510,7 +10941,7 @@ characters.data={ unicodeslot=0x0437, }, [0x0438]={ - adobename="afii10074", + adobename="iicyrillic", category="ll", cjkwd="a", contextname="cyrillici", @@ -10521,7 +10952,7 @@ characters.data={ unicodeslot=0x0438, }, [0x0439]={ - adobename="afii10075", + adobename="iishortcyrillic", category="ll", cjkwd="a", contextname="cyrillicishrt", @@ -10533,7 +10964,7 @@ characters.data={ unicodeslot=0x0439, }, [0x043A]={ - adobename="afii10076", + adobename="kacyrillic", category="ll", cjkwd="a", contextname="cyrillick", @@ -10544,7 +10975,7 @@ characters.data={ unicodeslot=0x043A, }, [0x043B]={ - adobename="afii10077", + adobename="elcyrillic", category="ll", cjkwd="a", contextname="cyrillicl", @@ -10555,7 +10986,7 @@ characters.data={ unicodeslot=0x043B, }, [0x043C]={ - adobename="afii10078", + adobename="emcyrillic", category="ll", cjkwd="a", contextname="cyrillicm", @@ -10566,7 +10997,7 @@ characters.data={ unicodeslot=0x043C, }, [0x043D]={ - adobename="afii10079", + adobename="encyrillic", category="ll", cjkwd="a", contextname="cyrillicn", @@ -10577,7 +11008,7 @@ characters.data={ unicodeslot=0x043D, }, [0x043E]={ - adobename="afii10080", + adobename="ocyrillic", category="ll", cjkwd="a", contextname="cyrillico", @@ -10588,7 +11019,7 @@ characters.data={ unicodeslot=0x043E, }, [0x043F]={ - adobename="afii10081", + adobename="pecyrillic", category="ll", cjkwd="a", contextname="cyrillicp", @@ -10599,7 +11030,7 @@ characters.data={ unicodeslot=0x043F, }, [0x0440]={ - adobename="afii10082", + adobename="ercyrillic", category="ll", cjkwd="a", contextname="cyrillicr", @@ -10610,7 +11041,7 @@ characters.data={ unicodeslot=0x0440, }, [0x0441]={ - adobename="afii10083", + adobename="escyrillic", category="ll", cjkwd="a", contextname="cyrillics", @@ -10621,7 +11052,7 @@ characters.data={ unicodeslot=0x0441, }, [0x0442]={ - adobename="afii10084", + adobename="tecyrillic", category="ll", cjkwd="a", contextname="cyrillict", @@ -10632,7 +11063,7 @@ characters.data={ unicodeslot=0x0442, }, [0x0443]={ - adobename="afii10085", + adobename="ucyrillic", category="ll", cjkwd="a", contextname="cyrillicu", @@ -10643,7 +11074,7 @@ characters.data={ unicodeslot=0x0443, }, [0x0444]={ - adobename="afii10086", + adobename="efcyrillic", category="ll", cjkwd="a", contextname="cyrillicf", @@ -10654,7 +11085,7 @@ characters.data={ unicodeslot=0x0444, }, [0x0445]={ - adobename="afii10087", + adobename="khacyrillic", category="ll", cjkwd="a", contextname="cyrillich", @@ -10665,7 +11096,7 @@ characters.data={ unicodeslot=0x0445, }, [0x0446]={ - adobename="afii10088", + adobename="tsecyrillic", category="ll", cjkwd="a", contextname="cyrillicc", @@ -10676,7 +11107,7 @@ characters.data={ unicodeslot=0x0446, }, [0x0447]={ - adobename="afii10089", + adobename="checyrillic", category="ll", cjkwd="a", contextname="cyrillicch", @@ -10687,7 +11118,7 @@ characters.data={ unicodeslot=0x0447, }, [0x0448]={ - adobename="afii10090", + adobename="shacyrillic", category="ll", cjkwd="a", contextname="cyrillicsh", @@ -10698,7 +11129,7 @@ characters.data={ unicodeslot=0x0448, }, [0x0449]={ - adobename="afii10091", + adobename="shchacyrillic", category="ll", cjkwd="a", contextname="cyrillicshch", @@ -10709,7 +11140,7 @@ characters.data={ unicodeslot=0x0449, }, [0x044A]={ - adobename="afii10092", + adobename="hardsigncyrillic", category="ll", cjkwd="a", contextname="cyrillichrdsn", @@ -10720,7 +11151,7 @@ characters.data={ unicodeslot=0x044A, }, [0x044B]={ - adobename="afii10093", + adobename="yericyrillic", category="ll", cjkwd="a", contextname="cyrillicery", @@ -10731,7 +11162,7 @@ characters.data={ unicodeslot=0x044B, }, [0x044C]={ - adobename="afii10094", + adobename="softsigncyrillic", category="ll", cjkwd="a", contextname="cyrillicsftsn", @@ -10742,7 +11173,7 @@ characters.data={ unicodeslot=0x044C, }, [0x044D]={ - adobename="afii10095", + adobename="ereversedcyrillic", category="ll", cjkwd="a", contextname="cyrillicerev", @@ -10753,7 +11184,7 @@ characters.data={ unicodeslot=0x044D, }, [0x044E]={ - adobename="afii10096", + adobename="iucyrillic", category="ll", cjkwd="a", contextname="cyrillicyu", @@ -10764,7 +11195,7 @@ characters.data={ unicodeslot=0x044E, }, [0x044F]={ - adobename="afii10097", + adobename="iacyrillic", category="ll", cjkwd="a", contextname="cyrillicya", @@ -10786,7 +11217,7 @@ characters.data={ unicodeslot=0x0450, }, [0x0451]={ - adobename="afii10071", + adobename="iocyrillic", category="ll", cjkwd="a", contextname="cyrillicyo", @@ -10798,7 +11229,7 @@ characters.data={ unicodeslot=0x0451, }, [0x0452]={ - adobename="afii10099", + adobename="djecyrillic", category="ll", contextname="cyrillicdje", description="CYRILLIC SMALL LETTER DJE", @@ -10808,7 +11239,7 @@ characters.data={ unicodeslot=0x0452, }, [0x0453]={ - adobename="afii10100", + adobename="gjecyrillic", category="ll", contextname="cyrillicgje", description="CYRILLIC SMALL LETTER GJE", @@ -10819,7 +11250,7 @@ characters.data={ unicodeslot=0x0453, }, [0x0454]={ - adobename="afii10101", + adobename="ecyrillic", category="ll", contextname="cyrillicie", description="CYRILLIC SMALL LETTER UKRAINIAN IE", @@ -10829,7 +11260,7 @@ characters.data={ unicodeslot=0x0454, }, [0x0455]={ - adobename="afii10102", + adobename="dzecyrillic", category="ll", contextname="cyrillicdze", description="CYRILLIC SMALL LETTER DZE", @@ -10839,7 +11270,7 @@ characters.data={ unicodeslot=0x0455, }, [0x0456]={ - adobename="afii10103", + adobename="icyrillic", category="ll", contextname="cyrillicii", description="CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I", @@ -10849,7 +11280,7 @@ characters.data={ unicodeslot=0x0456, }, [0x0457]={ - adobename="afii10104", + adobename="yicyrillic", category="ll", contextname="cyrillicyi", description="CYRILLIC SMALL LETTER YI", @@ -10860,7 +11291,7 @@ characters.data={ unicodeslot=0x0457, }, [0x0458]={ - adobename="afii10105", + adobename="jecyrillic", category="ll", contextname="cyrillicje", description="CYRILLIC SMALL LETTER JE", @@ -10870,7 +11301,7 @@ characters.data={ unicodeslot=0x0458, }, [0x0459]={ - adobename="afii10106", + adobename="ljecyrillic", category="ll", contextname="cyrilliclje", description="CYRILLIC SMALL LETTER LJE", @@ -10880,7 +11311,7 @@ characters.data={ unicodeslot=0x0459, }, [0x045A]={ - adobename="afii10107", + adobename="njecyrillic", category="ll", contextname="cyrillicnje", description="CYRILLIC SMALL LETTER NJE", @@ -10890,7 +11321,7 @@ characters.data={ unicodeslot=0x045A, }, [0x045B]={ - adobename="afii10108", + adobename="tshecyrillic", category="ll", contextname="cyrillictshe", description="CYRILLIC SMALL LETTER TSHE", @@ -10900,7 +11331,7 @@ characters.data={ unicodeslot=0x045B, }, [0x045C]={ - adobename="afii10109", + adobename="kjecyrillic", category="ll", contextname="cyrillickje", description="CYRILLIC SMALL LETTER KJE", @@ -10922,7 +11353,7 @@ characters.data={ unicodeslot=0x045D, }, [0x045E]={ - adobename="afii10110", + adobename="ushortcyrillic", category="ll", contextname="cyrillicushrt", description="CYRILLIC SMALL LETTER SHORT U", @@ -10933,7 +11364,7 @@ characters.data={ unicodeslot=0x045E, }, [0x045F]={ - adobename="afii10193", + adobename="dzhecyrillic", category="ll", contextname="cyrillicdzhe", description="CYRILLIC SMALL LETTER DZHE", @@ -10943,6 +11374,7 @@ characters.data={ unicodeslot=0x045F, }, [0x0460]={ + adobename="Omegacyrillic", category="lu", contextname="cyrillicOMEGA", description="CYRILLIC CAPITAL LETTER OMEGA", @@ -10952,6 +11384,7 @@ characters.data={ unicodeslot=0x0460, }, [0x0461]={ + adobename="omegacyrillic", category="ll", contextname="cyrillicomega", description="CYRILLIC SMALL LETTER OMEGA", @@ -10971,7 +11404,7 @@ characters.data={ unicodeslot=0x0462, }, [0x0463]={ - adobename="afii10194", + adobename="yatcyrillic", category="ll", contextname="cyrillicyat", description="CYRILLIC SMALL LETTER YAT", @@ -10981,6 +11414,7 @@ characters.data={ unicodeslot=0x0463, }, [0x0464]={ + adobename="Eiotifiedcyrillic", category="lu", contextname="cyrillicEiotified", description="CYRILLIC CAPITAL LETTER IOTIFIED E", @@ -10990,6 +11424,7 @@ characters.data={ unicodeslot=0x0464, }, [0x0465]={ + adobename="eiotifiedcyrillic", category="ll", contextname="cyrilliceiotified", description="CYRILLIC SMALL LETTER IOTIFIED E", @@ -10999,6 +11434,7 @@ characters.data={ unicodeslot=0x0465, }, [0x0466]={ + adobename="Yuslittlecyrillic", category="lu", contextname="cyrillicLITTLEYUS", description="CYRILLIC CAPITAL LETTER LITTLE YUS", @@ -11008,6 +11444,7 @@ characters.data={ unicodeslot=0x0466, }, [0x0467]={ + adobename="yuslittlecyrillic", category="ll", contextname="cyrilliclittleyus", description="CYRILLIC SMALL LETTER LITTLE YUS", @@ -11017,6 +11454,7 @@ characters.data={ unicodeslot=0x0467, }, [0x0468]={ + adobename="Yuslittleiotifiedcyrillic", category="lu", contextname="cyrillicLITTLEYUSiotified", description="CYRILLIC CAPITAL LETTER IOTIFIED LITTLE YUS", @@ -11026,6 +11464,7 @@ characters.data={ unicodeslot=0x0468, }, [0x0469]={ + adobename="yuslittleiotifiedcyrillic", category="ll", contextname="cyrilliclittleyusiotified", description="CYRILLIC SMALL LETTER IOTIFIED LITTLE YUS", @@ -11035,6 +11474,7 @@ characters.data={ unicodeslot=0x0469, }, [0x046A]={ + adobename="Yusbigcyrillic", category="lu", contextname="cyrillicBIGYUS", description="CYRILLIC CAPITAL LETTER BIG YUS", @@ -11044,6 +11484,7 @@ characters.data={ unicodeslot=0x046A, }, [0x046B]={ + adobename="yusbigcyrillic", category="ll", contextname="cyrillicbigyus", description="CYRILLIC SMALL LETTER BIG YUS", @@ -11053,6 +11494,7 @@ characters.data={ unicodeslot=0x046B, }, [0x046C]={ + adobename="Yusbigiotifiedcyrillic", category="lu", contextname="cyrillicBIGYUSiotified", description="CYRILLIC CAPITAL LETTER IOTIFIED BIG YUS", @@ -11062,6 +11504,7 @@ characters.data={ unicodeslot=0x046C, }, [0x046D]={ + adobename="yusbigiotifiedcyrillic", category="ll", contextname="cyrillicbigyusiotified", description="CYRILLIC SMALL LETTER IOTIFIED BIG YUS", @@ -11071,6 +11514,7 @@ characters.data={ unicodeslot=0x046D, }, [0x046E]={ + adobename="Ksicyrillic", category="lu", contextname="cyrillicKSI", description="CYRILLIC CAPITAL LETTER KSI", @@ -11080,6 +11524,7 @@ characters.data={ unicodeslot=0x046E, }, [0x046F]={ + adobename="ksicyrillic", category="ll", contextname="cyrillicksi", description="CYRILLIC SMALL LETTER KSI", @@ -11089,6 +11534,7 @@ characters.data={ unicodeslot=0x046F, }, [0x0470]={ + adobename="Psicyrillic", category="lu", contextname="cyrillicPSI", description="CYRILLIC CAPITAL LETTER PSI", @@ -11098,6 +11544,7 @@ characters.data={ unicodeslot=0x0470, }, [0x0471]={ + adobename="psicyrillic", category="ll", contextname="cyrillicpsi", description="CYRILLIC SMALL LETTER PSI", @@ -11117,7 +11564,7 @@ characters.data={ unicodeslot=0x0472, }, [0x0473]={ - adobename="afii10195", + adobename="fitacyrillic", category="ll", contextname="cyrillicfita", description="CYRILLIC SMALL LETTER FITA", @@ -11137,7 +11584,7 @@ characters.data={ unicodeslot=0x0474, }, [0x0475]={ - adobename="afii10196", + adobename="izhitsacyrillic", category="ll", contextname="cyrillicizhitsa", description="CYRILLIC SMALL LETTER IZHITSA", @@ -11147,6 +11594,7 @@ characters.data={ unicodeslot=0x0475, }, [0x0476]={ + adobename="Izhitsadblgravecyrillic", category="lu", contextname="cyrillicIZHITSAdoublegrave", description="CYRILLIC CAPITAL LETTER IZHITSA WITH DOUBLE GRAVE ACCENT", @@ -11158,6 +11606,7 @@ characters.data={ unicodeslot=0x0476, }, [0x0477]={ + adobename="izhitsadblgravecyrillic", category="ll", contextname="cyrillicizhitsadoublegrave", description="CYRILLIC SMALL LETTER IZHITSA WITH DOUBLE GRAVE ACCENT", @@ -11169,6 +11618,7 @@ characters.data={ unicodeslot=0x0477, }, [0x0478]={ + adobename="Ukcyrillic", category="lu", contextname="cyrillicUK", description="CYRILLIC CAPITAL LETTER UK", @@ -11178,6 +11628,7 @@ characters.data={ unicodeslot=0x0478, }, [0x0479]={ + adobename="ukcyrillic", category="ll", contextname="cyrillicuk", description="CYRILLIC SMALL LETTER UK", @@ -11187,6 +11638,7 @@ characters.data={ unicodeslot=0x0479, }, [0x047A]={ + adobename="Omegaroundcyrillic", category="lu", contextname="cyrillicOMEGAround", description="CYRILLIC CAPITAL LETTER ROUND OMEGA", @@ -11196,6 +11648,7 @@ characters.data={ unicodeslot=0x047A, }, [0x047B]={ + adobename="omegaroundcyrillic", category="ll", contextname="cyrillicomegaround", description="CYRILLIC SMALL LETTER ROUND OMEGA", @@ -11205,6 +11658,7 @@ characters.data={ unicodeslot=0x047B, }, [0x047C]={ + adobename="Omegatitlocyrillic", category="lu", contextname="cyrillicOMEGAtitlo", description="CYRILLIC CAPITAL LETTER OMEGA WITH TITLO", @@ -11215,6 +11669,7 @@ characters.data={ unicodeslot=0x047C, }, [0x047D]={ + adobename="omegatitlocyrillic", category="ll", contextname="cyrillicomegatitlo", description="CYRILLIC SMALL LETTER OMEGA WITH TITLO", @@ -11225,6 +11680,7 @@ characters.data={ unicodeslot=0x047D, }, [0x047E]={ + adobename="Otcyrillic", category="lu", contextname="cyrillicOT", description="CYRILLIC CAPITAL LETTER OT", @@ -11234,6 +11690,7 @@ characters.data={ unicodeslot=0x047E, }, [0x047F]={ + adobename="otcyrillic", category="ll", contextname="cyrillicot", description="CYRILLIC SMALL LETTER OT", @@ -11243,6 +11700,7 @@ characters.data={ unicodeslot=0x047F, }, [0x0480]={ + adobename="Koppacyrillic", category="lu", contextname="cyrillicKOPPA", description="CYRILLIC CAPITAL LETTER KOPPA", @@ -11252,6 +11710,7 @@ characters.data={ unicodeslot=0x0480, }, [0x0481]={ + adobename="koppacyrillic", category="ll", contextname="cyrillickoppa", description="CYRILLIC SMALL LETTER KOPPA", @@ -11261,6 +11720,7 @@ characters.data={ unicodeslot=0x0481, }, [0x0482]={ + adobename="thousandcyrillic", category="so", description="CYRILLIC THOUSANDS SIGN", direction="l", @@ -11268,6 +11728,7 @@ characters.data={ unicodeslot=0x0482, }, [0x0483]={ + adobename="titlocyrilliccmb", category="mn", contextname="cyrillicTITLO", description="COMBINING CYRILLIC TITLO", @@ -11276,6 +11737,7 @@ characters.data={ unicodeslot=0x0483, }, [0x0484]={ + adobename="palatalizationcyrilliccmb", category="mn", contextname="cyrillicPALATALIZATION", description="COMBINING CYRILLIC PALATALIZATION", @@ -11284,6 +11746,7 @@ characters.data={ unicodeslot=0x0484, }, [0x0485]={ + adobename="dasiapneumatacyrilliccmb", category="mn", contextname="cyrillicDASIAPNEUMATA", description="COMBINING CYRILLIC DASIA PNEUMATA", @@ -11292,6 +11755,7 @@ characters.data={ unicodeslot=0x0485, }, [0x0486]={ + adobename="psilipneumatacyrilliccmb", category="mn", contextname="cyrillicPSILIPNEUMATA", description="COMBINING CYRILLIC PSILI PNEUMATA", @@ -11381,7 +11845,7 @@ characters.data={ unicodeslot=0x0490, }, [0x0491]={ - adobename="afii10098", + adobename="gheupturncyrillic", category="ll", contextname="cyrillicgheupturn", description="CYRILLIC SMALL LETTER GHE WITH UPTURN", @@ -11392,6 +11856,7 @@ characters.data={ unicodeslot=0x0491, }, [0x0492]={ + adobename="Ghestrokecyrillic", category="lu", contextname="cyrillicGHEstroke", description="CYRILLIC CAPITAL LETTER GHE WITH STROKE", @@ -11402,6 +11867,7 @@ characters.data={ unicodeslot=0x0492, }, [0x0493]={ + adobename="ghestrokecyrillic", category="ll", contextname="cyrillicghestroke", description="CYRILLIC SMALL LETTER GHE WITH STROKE", @@ -11412,6 +11878,7 @@ characters.data={ unicodeslot=0x0493, }, [0x0494]={ + adobename="Ghemiddlehookcyrillic", category="lu", contextname="cyrillicGHEmidhook", description="CYRILLIC CAPITAL LETTER GHE WITH MIDDLE HOOK", @@ -11422,6 +11889,7 @@ characters.data={ unicodeslot=0x0494, }, [0x0495]={ + adobename="ghemiddlehookcyrillic", category="ll", contextname="cyrillicghemidhook", description="CYRILLIC SMALL LETTER GHE WITH MIDDLE HOOK", @@ -11432,6 +11900,7 @@ characters.data={ unicodeslot=0x0495, }, [0x0496]={ + adobename="Zhedescendercyrillic", category="lu", contextname="cyrillicZHEdescender", description="CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER", @@ -11442,6 +11911,7 @@ characters.data={ unicodeslot=0x0496, }, [0x0497]={ + adobename="zhedescendercyrillic", category="ll", contextname="cyrilliczhedescender", description="CYRILLIC SMALL LETTER ZHE WITH DESCENDER", @@ -11452,6 +11922,7 @@ characters.data={ unicodeslot=0x0497, }, [0x0498]={ + adobename="Zedescendercyrillic", category="lu", contextname="cyrillicZDSC", description="CYRILLIC CAPITAL LETTER ZE WITH DESCENDER", @@ -11462,6 +11933,7 @@ characters.data={ unicodeslot=0x0498, }, [0x0499]={ + adobename="zedescendercyrillic", category="ll", contextname="cyrilliczdsc", description="CYRILLIC SMALL LETTER ZE WITH DESCENDER", @@ -11472,6 +11944,7 @@ characters.data={ unicodeslot=0x0499, }, [0x049A]={ + adobename="Kadescendercyrillic", category="lu", contextname="cyrillicKADC", description="CYRILLIC CAPITAL LETTER KA WITH DESCENDER", @@ -11482,6 +11955,7 @@ characters.data={ unicodeslot=0x049A, }, [0x049B]={ + adobename="kadescendercyrillic", category="ll", contextname="cyrillickadc", description="CYRILLIC SMALL LETTER KA WITH DESCENDER", @@ -11492,6 +11966,7 @@ characters.data={ unicodeslot=0x049B, }, [0x049C]={ + adobename="Kaverticalstrokecyrillic", category="lu", contextname="cyrillicKAvertstroke", description="CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE", @@ -11502,6 +11977,7 @@ characters.data={ unicodeslot=0x049C, }, [0x049D]={ + adobename="kaverticalstrokecyrillic", category="ll", contextname="cyrillickavertstroke", description="CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE", @@ -11512,6 +11988,7 @@ characters.data={ unicodeslot=0x049D, }, [0x049E]={ + adobename="Kastrokecyrillic", category="lu", contextname="cyrillicKAstroke", description="CYRILLIC CAPITAL LETTER KA WITH STROKE", @@ -11522,6 +11999,7 @@ characters.data={ unicodeslot=0x049E, }, [0x049F]={ + adobename="kastrokecyrillic", category="ll", contextname="cyrillickastroke", description="CYRILLIC SMALL LETTER KA WITH STROKE", @@ -11532,6 +12010,7 @@ characters.data={ unicodeslot=0x049F, }, [0x04A0]={ + adobename="Kabashkircyrillic", category="lu", contextname="cyrillicKAbashkir", description="CYRILLIC CAPITAL LETTER BASHKIR KA", @@ -11541,6 +12020,7 @@ characters.data={ unicodeslot=0x04A0, }, [0x04A1]={ + adobename="kabashkircyrillic", category="ll", contextname="cyrillickabashkir", description="CYRILLIC SMALL LETTER BASHKIR KA", @@ -11550,6 +12030,7 @@ characters.data={ unicodeslot=0x04A1, }, [0x04A2]={ + adobename="Endescendercyrillic", category="lu", contextname="cyrillicENDC", description="CYRILLIC CAPITAL LETTER EN WITH DESCENDER", @@ -11560,6 +12041,7 @@ characters.data={ unicodeslot=0x04A2, }, [0x04A3]={ + adobename="endescendercyrillic", category="ll", contextname="cyrillicendc", description="CYRILLIC SMALL LETTER EN WITH DESCENDER", @@ -11570,6 +12052,7 @@ characters.data={ unicodeslot=0x04A3, }, [0x04A4]={ + adobename="Enghecyrillic", category="lu", contextname="cyrillicENGHE", description="CYRILLIC CAPITAL LIGATURE EN GHE", @@ -11579,6 +12062,7 @@ characters.data={ unicodeslot=0x04A4, }, [0x04A5]={ + adobename="enghecyrillic", category="ll", contextname="cyrillicenghe", description="CYRILLIC SMALL LIGATURE EN GHE", @@ -11588,6 +12072,7 @@ characters.data={ unicodeslot=0x04A5, }, [0x04A6]={ + adobename="Pemiddlehookcyrillic", category="lu", contextname="cyrillicPEmidhook", description="CYRILLIC CAPITAL LETTER PE WITH MIDDLE HOOK", @@ -11598,6 +12083,7 @@ characters.data={ unicodeslot=0x04A6, }, [0x04A7]={ + adobename="pemiddlehookcyrillic", category="ll", contextname="cyrillicpemidhook", description="CYRILLIC SMALL LETTER PE WITH MIDDLE HOOK", @@ -11608,6 +12094,7 @@ characters.data={ unicodeslot=0x04A7, }, [0x04A8]={ + adobename="Haabkhasiancyrillic", category="lu", contextname="cyrillicHA", description="CYRILLIC CAPITAL LETTER ABKHASIAN HA", @@ -11617,6 +12104,7 @@ characters.data={ unicodeslot=0x04A8, }, [0x04A9]={ + adobename="haabkhasiancyrillic", category="ll", contextname="cyrillicha", description="CYRILLIC SMALL LETTER ABKHASIAN HA", @@ -11626,6 +12114,7 @@ characters.data={ unicodeslot=0x04A9, }, [0x04AA]={ + adobename="Esdescendercyrillic", category="lu", contextname="cyrillicSDSC", description="CYRILLIC CAPITAL LETTER ES WITH DESCENDER", @@ -11636,6 +12125,7 @@ characters.data={ unicodeslot=0x04AA, }, [0x04AB]={ + adobename="esdescendercyrillic", category="ll", contextname="cyrillicsdsc", description="CYRILLIC SMALL LETTER ES WITH DESCENDER", @@ -11646,6 +12136,7 @@ characters.data={ unicodeslot=0x04AB, }, [0x04AC]={ + adobename="Tedescendercyrillic", category="lu", contextname="cyrillicTEDC", description="CYRILLIC CAPITAL LETTER TE WITH DESCENDER", @@ -11656,6 +12147,7 @@ characters.data={ unicodeslot=0x04AC, }, [0x04AD]={ + adobename="tedescendercyrillic", category="ll", contextname="cyrillictedc", description="CYRILLIC SMALL LETTER TE WITH DESCENDER", @@ -11666,6 +12158,7 @@ characters.data={ unicodeslot=0x04AD, }, [0x04AE]={ + adobename="Ustraightcyrillic", category="lu", contextname="cyrillicYstr", description="CYRILLIC CAPITAL LETTER STRAIGHT U", @@ -11675,6 +12168,7 @@ characters.data={ unicodeslot=0x04AE, }, [0x04AF]={ + adobename="ustraightcyrillic", category="ll", contextname="cyrillicystr", description="CYRILLIC SMALL LETTER STRAIGHT U", @@ -11684,6 +12178,7 @@ characters.data={ unicodeslot=0x04AF, }, [0x04B0]={ + adobename="Ustraightstrokecyrillic", category="lu", contextname="cyrillicYstrstroke", description="CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE", @@ -11693,6 +12188,7 @@ characters.data={ unicodeslot=0x04B0, }, [0x04B1]={ + adobename="ustraightstrokecyrillic", category="ll", contextname="cyrillicystrstroke", description="CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE", @@ -11702,6 +12198,7 @@ characters.data={ unicodeslot=0x04B1, }, [0x04B2]={ + adobename="Hadescendercyrillic", category="lu", contextname="cyrillicHADC", description="CYRILLIC CAPITAL LETTER HA WITH DESCENDER", @@ -11712,6 +12209,7 @@ characters.data={ unicodeslot=0x04B2, }, [0x04B3]={ + adobename="hadescendercyrillic", category="ll", contextname="cyrillichadc", description="CYRILLIC SMALL LETTER HA WITH DESCENDER", @@ -11722,6 +12220,7 @@ characters.data={ unicodeslot=0x04B3, }, [0x04B4]={ + adobename="Tetsecyrillic", category="lu", contextname="cyrillicTETSE", description="CYRILLIC CAPITAL LIGATURE TE TSE", @@ -11731,6 +12230,7 @@ characters.data={ unicodeslot=0x04B4, }, [0x04B5]={ + adobename="tetsecyrillic", category="ll", contextname="cyrillictetse", description="CYRILLIC SMALL LIGATURE TE TSE", @@ -11740,6 +12240,7 @@ characters.data={ unicodeslot=0x04B5, }, [0x04B6]={ + adobename="Chedescendercyrillic", category="lu", contextname="cyrillicCHEDC", description="CYRILLIC CAPITAL LETTER CHE WITH DESCENDER", @@ -11750,6 +12251,7 @@ characters.data={ unicodeslot=0x04B6, }, [0x04B7]={ + adobename="chedescendercyrillic", category="ll", contextname="cyrillicchedc", description="CYRILLIC SMALL LETTER CHE WITH DESCENDER", @@ -11760,6 +12262,7 @@ characters.data={ unicodeslot=0x04B7, }, [0x04B8]={ + adobename="Cheverticalstrokecyrillic", category="lu", contextname="cyrillicCHEvertstroke", description="CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE", @@ -11770,6 +12273,7 @@ characters.data={ unicodeslot=0x04B8, }, [0x04B9]={ + adobename="cheverticalstrokecyrillic", category="ll", contextname="cyrillicchevertstroke", description="CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE", @@ -11780,6 +12284,7 @@ characters.data={ unicodeslot=0x04B9, }, [0x04BA]={ + adobename="Shhacyrillic", category="lu", contextname="cyrillicSHHA", description="CYRILLIC CAPITAL LETTER SHHA", @@ -11789,6 +12294,7 @@ characters.data={ unicodeslot=0x04BA, }, [0x04BB]={ + adobename="shhacyrillic", category="ll", contextname="cyrillicshha", description="CYRILLIC SMALL LETTER SHHA", @@ -11798,6 +12304,7 @@ characters.data={ unicodeslot=0x04BB, }, [0x04BC]={ + adobename="Cheabkhasiancyrillic", category="lu", contextname="cyrillicCHEabkhasian", description="CYRILLIC CAPITAL LETTER ABKHASIAN CHE", @@ -11807,6 +12314,7 @@ characters.data={ unicodeslot=0x04BC, }, [0x04BD]={ + adobename="cheabkhasiancyrillic", category="ll", contextname="cyrilliccheabkhasian", description="CYRILLIC SMALL LETTER ABKHASIAN CHE", @@ -11816,6 +12324,7 @@ characters.data={ unicodeslot=0x04BD, }, [0x04BE]={ + adobename="Chedescenderabkhasiancyrillic", category="lu", contextname="cyrillicCHEDCabkhasian", description="CYRILLIC CAPITAL LETTER ABKHASIAN CHE WITH DESCENDER", @@ -11825,6 +12334,7 @@ characters.data={ unicodeslot=0x04BE, }, [0x04BF]={ + adobename="chedescenderabkhasiancyrillic", category="ll", contextname="cyrillicchedcabkhasian", description="CYRILLIC SMALL LETTER ABKHASIAN CHE WITH DESCENDER", @@ -11834,6 +12344,7 @@ characters.data={ unicodeslot=0x04BF, }, [0x04C0]={ + adobename="palochkacyrillic", category="lu", contextname="cyrillicPALOCHKA", description="CYRILLIC LETTER PALOCHKA", @@ -11843,6 +12354,7 @@ characters.data={ unicodeslot=0x04C0, }, [0x04C1]={ + adobename="Zhebrevecyrillic", category="lu", contextname="cyrillicZHEbreve", description="CYRILLIC CAPITAL LETTER ZHE WITH BREVE", @@ -11854,6 +12366,7 @@ characters.data={ unicodeslot=0x04C1, }, [0x04C2]={ + adobename="zhebrevecyrillic", category="ll", contextname="cyrilliczhebreve", description="CYRILLIC SMALL LETTER ZHE WITH BREVE", @@ -11865,6 +12378,7 @@ characters.data={ unicodeslot=0x04C2, }, [0x04C3]={ + adobename="Kahookcyrillic", category="lu", contextname="cyrillicKAhook", description="CYRILLIC CAPITAL LETTER KA WITH HOOK", @@ -11875,6 +12389,7 @@ characters.data={ unicodeslot=0x04C3, }, [0x04C4]={ + adobename="kahookcyrillic", category="ll", contextname="cyrillickahook", description="CYRILLIC SMALL LETTER KA WITH HOOK", @@ -11905,6 +12420,7 @@ characters.data={ unicodeslot=0x04C6, }, [0x04C7]={ + adobename="Enhookcyrillic", category="lu", contextname="cyrillicENhook", description="CYRILLIC CAPITAL LETTER EN WITH HOOK", @@ -11915,6 +12431,7 @@ characters.data={ unicodeslot=0x04C7, }, [0x04C8]={ + adobename="enhookcyrillic", category="ll", contextname="cyrillicenhook", description="CYRILLIC SMALL LETTER EN WITH HOOK", @@ -11945,6 +12462,7 @@ characters.data={ unicodeslot=0x04CA, }, [0x04CB]={ + adobename="Chekhakassiancyrillic", category="lu", contextname="cyrillicCHEkhakassian", description="CYRILLIC CAPITAL LETTER KHAKASSIAN CHE", @@ -11954,6 +12472,7 @@ characters.data={ unicodeslot=0x04CB, }, [0x04CC]={ + adobename="chekhakassiancyrillic", category="ll", contextname="cyrillicchekhakassian", description="CYRILLIC SMALL LETTER KHAKASSIAN CHE", @@ -11991,6 +12510,7 @@ characters.data={ unicodeslot=0x04CF, }, [0x04D0]={ + adobename="Abrevecyrillic", category="lu", contextname="cyrillicAbreve", description="CYRILLIC CAPITAL LETTER A WITH BREVE", @@ -12002,6 +12522,7 @@ characters.data={ unicodeslot=0x04D0, }, [0x04D1]={ + adobename="abrevecyrillic", category="ll", contextname="cyrillicabreve", description="CYRILLIC SMALL LETTER A WITH BREVE", @@ -12013,6 +12534,7 @@ characters.data={ unicodeslot=0x04D1, }, [0x04D2]={ + adobename="Adieresiscyrillic", category="lu", contextname="cyrillicAdiaeresis", description="CYRILLIC CAPITAL LETTER A WITH DIAERESIS", @@ -12024,6 +12546,7 @@ characters.data={ unicodeslot=0x04D2, }, [0x04D3]={ + adobename="adieresiscyrillic", category="ll", contextname="cyrillicadiaeresis", description="CYRILLIC SMALL LETTER A WITH DIAERESIS", @@ -12035,6 +12558,7 @@ characters.data={ unicodeslot=0x04D3, }, [0x04D4]={ + adobename="Aiecyrillic", category="lu", contextname="cyrillicAE", description="CYRILLIC CAPITAL LIGATURE A IE", @@ -12044,6 +12568,7 @@ characters.data={ unicodeslot=0x04D4, }, [0x04D5]={ + adobename="aiecyrillic", category="ll", contextname="cyrillicae", description="CYRILLIC SMALL LIGATURE A IE", @@ -12053,6 +12578,7 @@ characters.data={ unicodeslot=0x04D5, }, [0x04D6]={ + adobename="Iebrevecyrillic", category="lu", contextname="cyrillicEbreve", description="CYRILLIC CAPITAL LETTER IE WITH BREVE", @@ -12064,6 +12590,7 @@ characters.data={ unicodeslot=0x04D6, }, [0x04D7]={ + adobename="iebrevecyrillic", category="ll", contextname="cyrillicebreve", description="CYRILLIC SMALL LETTER IE WITH BREVE", @@ -12075,6 +12602,7 @@ characters.data={ unicodeslot=0x04D7, }, [0x04D8]={ + adobename="Schwacyrillic", category="lu", contextname="cyrillicSCHWA", description="CYRILLIC CAPITAL LETTER SCHWA", @@ -12084,7 +12612,7 @@ characters.data={ unicodeslot=0x04D8, }, [0x04D9]={ - adobename="afii10846", + adobename="schwacyrillic", category="ll", contextname="cyrillicschwa", description="CYRILLIC SMALL LETTER SCHWA", @@ -12094,6 +12622,7 @@ characters.data={ unicodeslot=0x04D9, }, [0x04DA]={ + adobename="Schwadieresiscyrillic", category="lu", contextname="cyrillicSCHWAdiaeresis", description="CYRILLIC CAPITAL LETTER SCHWA WITH DIAERESIS", @@ -12105,6 +12634,7 @@ characters.data={ unicodeslot=0x04DA, }, [0x04DB]={ + adobename="schwadieresiscyrillic", category="ll", contextname="cyrillicschwadiaeresis", description="CYRILLIC SMALL LETTER SCHWA WITH DIAERESIS", @@ -12116,6 +12646,7 @@ characters.data={ unicodeslot=0x04DB, }, [0x04DC]={ + adobename="Zhedieresiscyrillic", category="lu", contextname="cyrillicZHEdiaeresis", description="CYRILLIC CAPITAL LETTER ZHE WITH DIAERESIS", @@ -12127,6 +12658,7 @@ characters.data={ unicodeslot=0x04DC, }, [0x04DD]={ + adobename="zhedieresiscyrillic", category="ll", contextname="cyrilliczhediaeresis", description="CYRILLIC SMALL LETTER ZHE WITH DIAERESIS", @@ -12138,6 +12670,7 @@ characters.data={ unicodeslot=0x04DD, }, [0x04DE]={ + adobename="Zedieresiscyrillic", category="lu", contextname="cyrillicZEdiaeresis", description="CYRILLIC CAPITAL LETTER ZE WITH DIAERESIS", @@ -12149,6 +12682,7 @@ characters.data={ unicodeslot=0x04DE, }, [0x04DF]={ + adobename="zedieresiscyrillic", category="ll", contextname="cyrilliczediaeresis", description="CYRILLIC SMALL LETTER ZE WITH DIAERESIS", @@ -12160,6 +12694,7 @@ characters.data={ unicodeslot=0x04DF, }, [0x04E0]={ + adobename="Dzeabkhasiancyrillic", category="lu", contextname="cyrillicDZEabkhasian", description="CYRILLIC CAPITAL LETTER ABKHASIAN DZE", @@ -12169,6 +12704,7 @@ characters.data={ unicodeslot=0x04E0, }, [0x04E1]={ + adobename="dzeabkhasiancyrillic", category="ll", contextname="cyrillicdzeabkhasian", description="CYRILLIC SMALL LETTER ABKHASIAN DZE", @@ -12178,6 +12714,7 @@ characters.data={ unicodeslot=0x04E1, }, [0x04E2]={ + adobename="Imacroncyrillic", category="lu", contextname="cyrillicImacron", description="CYRILLIC CAPITAL LETTER I WITH MACRON", @@ -12189,6 +12726,7 @@ characters.data={ unicodeslot=0x04E2, }, [0x04E3]={ + adobename="imacroncyrillic", category="ll", contextname="cyrillicimacron", description="CYRILLIC SMALL LETTER I WITH MACRON", @@ -12200,6 +12738,7 @@ characters.data={ unicodeslot=0x04E3, }, [0x04E4]={ + adobename="Idieresiscyrillic", category="lu", contextname="cyrillicIdiaeresis", description="CYRILLIC CAPITAL LETTER I WITH DIAERESIS", @@ -12211,6 +12750,7 @@ characters.data={ unicodeslot=0x04E4, }, [0x04E5]={ + adobename="idieresiscyrillic", category="ll", contextname="cyrillicidiaeresis", description="CYRILLIC SMALL LETTER I WITH DIAERESIS", @@ -12222,6 +12762,7 @@ characters.data={ unicodeslot=0x04E5, }, [0x04E6]={ + adobename="Odieresiscyrillic", category="lu", contextname="cyrillicOdiaeresis", description="CYRILLIC CAPITAL LETTER O WITH DIAERESIS", @@ -12233,6 +12774,7 @@ characters.data={ unicodeslot=0x04E6, }, [0x04E7]={ + adobename="odieresiscyrillic", category="ll", contextname="cyrillicodiaeresis", description="CYRILLIC SMALL LETTER O WITH DIAERESIS", @@ -12244,6 +12786,7 @@ characters.data={ unicodeslot=0x04E7, }, [0x04E8]={ + adobename="Obarredcyrillic", category="lu", contextname="cyrillicObarred", description="CYRILLIC CAPITAL LETTER BARRED O", @@ -12253,6 +12796,7 @@ characters.data={ unicodeslot=0x04E8, }, [0x04E9]={ + adobename="obarredcyrillic", category="ll", contextname="cyrillicobarred", description="CYRILLIC SMALL LETTER BARRED O", @@ -12262,6 +12806,7 @@ characters.data={ unicodeslot=0x04E9, }, [0x04EA]={ + adobename="Obarreddieresiscyrillic", category="lu", contextname="cyrillicObarreddiaeresis", description="CYRILLIC CAPITAL LETTER BARRED O WITH DIAERESIS", @@ -12272,6 +12817,7 @@ characters.data={ unicodeslot=0x04EA, }, [0x04EB]={ + adobename="obarreddieresiscyrillic", category="ll", contextname="cyrillicobarreddiaeresis", description="CYRILLIC SMALL LETTER BARRED O WITH DIAERESIS", @@ -12304,6 +12850,7 @@ characters.data={ unicodeslot=0x04ED, }, [0x04EE]={ + adobename="Umacroncyrillic", category="lu", contextname="cyrillicUmacron", description="CYRILLIC CAPITAL LETTER U WITH MACRON", @@ -12315,6 +12862,7 @@ characters.data={ unicodeslot=0x04EE, }, [0x04EF]={ + adobename="umacroncyrillic", category="ll", contextname="cyrillicumacron", description="CYRILLIC SMALL LETTER U WITH MACRON", @@ -12326,6 +12874,7 @@ characters.data={ unicodeslot=0x04EF, }, [0x04F0]={ + adobename="Udieresiscyrillic", category="lu", contextname="cyrillicUdiaeresis", description="CYRILLIC CAPITAL LETTER U WITH DIAERESIS", @@ -12337,6 +12886,7 @@ characters.data={ unicodeslot=0x04F0, }, [0x04F1]={ + adobename="udieresiscyrillic", category="ll", contextname="cyrillicudiaeresis", description="CYRILLIC SMALL LETTER U WITH DIAERESIS", @@ -12348,6 +12898,7 @@ characters.data={ unicodeslot=0x04F1, }, [0x04F2]={ + adobename="Uhungarumlautcyrillic", category="lu", contextname="cyrillicUdoubleacute", description="CYRILLIC CAPITAL LETTER U WITH DOUBLE ACUTE", @@ -12359,6 +12910,7 @@ characters.data={ unicodeslot=0x04F2, }, [0x04F3]={ + adobename="uhungarumlautcyrillic", category="ll", contextname="cyrillicudoubleacute", description="CYRILLIC SMALL LETTER U WITH DOUBLE ACUTE", @@ -12370,6 +12922,7 @@ characters.data={ unicodeslot=0x04F3, }, [0x04F4]={ + adobename="Chedieresiscyrillic", category="lu", contextname="cyrillicCHEdiaeresis", description="CYRILLIC CAPITAL LETTER CHE WITH DIAERESIS", @@ -12381,6 +12934,7 @@ characters.data={ unicodeslot=0x04F4, }, [0x04F5]={ + adobename="chedieresiscyrillic", category="ll", contextname="cyrillicchediaeresis", description="CYRILLIC SMALL LETTER CHE WITH DIAERESIS", @@ -12410,6 +12964,7 @@ characters.data={ unicodeslot=0x04F7, }, [0x04F8]={ + adobename="Yerudieresiscyrillic", category="lu", contextname="cyrillicYERUdiaeresis", description="CYRILLIC CAPITAL LETTER YERU WITH DIAERESIS", @@ -12421,6 +12976,7 @@ characters.data={ unicodeslot=0x04F8, }, [0x04F9]={ + adobename="yerudieresiscyrillic", category="ll", contextname="cyrillicyerudiaeresis", description="CYRILLIC SMALL LETTER YERU WITH DIAERESIS", @@ -12648,6 +13204,7 @@ characters.data={ unicodeslot=0x0513, }, [0x0531]={ + adobename="Aybarmenian", category="lu", description="ARMENIAN CAPITAL LETTER AYB", direction="l", @@ -12656,6 +13213,7 @@ characters.data={ unicodeslot=0x0531, }, [0x0532]={ + adobename="Benarmenian", category="lu", description="ARMENIAN CAPITAL LETTER BEN", direction="l", @@ -12664,6 +13222,7 @@ characters.data={ unicodeslot=0x0532, }, [0x0533]={ + adobename="Gimarmenian", category="lu", description="ARMENIAN CAPITAL LETTER GIM", direction="l", @@ -12672,6 +13231,7 @@ characters.data={ unicodeslot=0x0533, }, [0x0534]={ + adobename="Daarmenian", category="lu", description="ARMENIAN CAPITAL LETTER DA", direction="l", @@ -12680,6 +13240,7 @@ characters.data={ unicodeslot=0x0534, }, [0x0535]={ + adobename="Echarmenian", category="lu", description="ARMENIAN CAPITAL LETTER ECH", direction="l", @@ -12688,6 +13249,7 @@ characters.data={ unicodeslot=0x0535, }, [0x0536]={ + adobename="Zaarmenian", category="lu", description="ARMENIAN CAPITAL LETTER ZA", direction="l", @@ -12696,6 +13258,7 @@ characters.data={ unicodeslot=0x0536, }, [0x0537]={ + adobename="Eharmenian", category="lu", description="ARMENIAN CAPITAL LETTER EH", direction="l", @@ -12704,6 +13267,7 @@ characters.data={ unicodeslot=0x0537, }, [0x0538]={ + adobename="Etarmenian", category="lu", description="ARMENIAN CAPITAL LETTER ET", direction="l", @@ -12712,6 +13276,7 @@ characters.data={ unicodeslot=0x0538, }, [0x0539]={ + adobename="Toarmenian", category="lu", description="ARMENIAN CAPITAL LETTER TO", direction="l", @@ -12720,6 +13285,7 @@ characters.data={ unicodeslot=0x0539, }, [0x053A]={ + adobename="Zhearmenian", category="lu", description="ARMENIAN CAPITAL LETTER ZHE", direction="l", @@ -12728,6 +13294,7 @@ characters.data={ unicodeslot=0x053A, }, [0x053B]={ + adobename="Iniarmenian", category="lu", description="ARMENIAN CAPITAL LETTER INI", direction="l", @@ -12736,6 +13303,7 @@ characters.data={ unicodeslot=0x053B, }, [0x053C]={ + adobename="Liwnarmenian", category="lu", description="ARMENIAN CAPITAL LETTER LIWN", direction="l", @@ -12744,6 +13312,7 @@ characters.data={ unicodeslot=0x053C, }, [0x053D]={ + adobename="Xeharmenian", category="lu", description="ARMENIAN CAPITAL LETTER XEH", direction="l", @@ -12752,6 +13321,7 @@ characters.data={ unicodeslot=0x053D, }, [0x053E]={ + adobename="Caarmenian", category="lu", description="ARMENIAN CAPITAL LETTER CA", direction="l", @@ -12760,6 +13330,7 @@ characters.data={ unicodeslot=0x053E, }, [0x053F]={ + adobename="Kenarmenian", category="lu", description="ARMENIAN CAPITAL LETTER KEN", direction="l", @@ -12768,6 +13339,7 @@ characters.data={ unicodeslot=0x053F, }, [0x0540]={ + adobename="Hoarmenian", category="lu", description="ARMENIAN CAPITAL LETTER HO", direction="l", @@ -12776,6 +13348,7 @@ characters.data={ unicodeslot=0x0540, }, [0x0541]={ + adobename="Jaarmenian", category="lu", description="ARMENIAN CAPITAL LETTER JA", direction="l", @@ -12784,6 +13357,7 @@ characters.data={ unicodeslot=0x0541, }, [0x0542]={ + adobename="Ghadarmenian", category="lu", description="ARMENIAN CAPITAL LETTER GHAD", direction="l", @@ -12792,6 +13366,7 @@ characters.data={ unicodeslot=0x0542, }, [0x0543]={ + adobename="Cheharmenian", category="lu", description="ARMENIAN CAPITAL LETTER CHEH", direction="l", @@ -12800,6 +13375,7 @@ characters.data={ unicodeslot=0x0543, }, [0x0544]={ + adobename="Menarmenian", category="lu", description="ARMENIAN CAPITAL LETTER MEN", direction="l", @@ -12808,6 +13384,7 @@ characters.data={ unicodeslot=0x0544, }, [0x0545]={ + adobename="Yiarmenian", category="lu", description="ARMENIAN CAPITAL LETTER YI", direction="l", @@ -12816,6 +13393,7 @@ characters.data={ unicodeslot=0x0545, }, [0x0546]={ + adobename="Nowarmenian", category="lu", description="ARMENIAN CAPITAL LETTER NOW", direction="l", @@ -12824,6 +13402,7 @@ characters.data={ unicodeslot=0x0546, }, [0x0547]={ + adobename="Shaarmenian", category="lu", description="ARMENIAN CAPITAL LETTER SHA", direction="l", @@ -12832,6 +13411,7 @@ characters.data={ unicodeslot=0x0547, }, [0x0548]={ + adobename="Voarmenian", category="lu", description="ARMENIAN CAPITAL LETTER VO", direction="l", @@ -12840,6 +13420,7 @@ characters.data={ unicodeslot=0x0548, }, [0x0549]={ + adobename="Chaarmenian", category="lu", description="ARMENIAN CAPITAL LETTER CHA", direction="l", @@ -12848,6 +13429,7 @@ characters.data={ unicodeslot=0x0549, }, [0x054A]={ + adobename="Peharmenian", category="lu", description="ARMENIAN CAPITAL LETTER PEH", direction="l", @@ -12856,6 +13438,7 @@ characters.data={ unicodeslot=0x054A, }, [0x054B]={ + adobename="Jheharmenian", category="lu", description="ARMENIAN CAPITAL LETTER JHEH", direction="l", @@ -12864,6 +13447,7 @@ characters.data={ unicodeslot=0x054B, }, [0x054C]={ + adobename="Raarmenian", category="lu", description="ARMENIAN CAPITAL LETTER RA", direction="l", @@ -12872,6 +13456,7 @@ characters.data={ unicodeslot=0x054C, }, [0x054D]={ + adobename="Seharmenian", category="lu", description="ARMENIAN CAPITAL LETTER SEH", direction="l", @@ -12880,6 +13465,7 @@ characters.data={ unicodeslot=0x054D, }, [0x054E]={ + adobename="Vewarmenian", category="lu", description="ARMENIAN CAPITAL LETTER VEW", direction="l", @@ -12888,6 +13474,7 @@ characters.data={ unicodeslot=0x054E, }, [0x054F]={ + adobename="Tiwnarmenian", category="lu", description="ARMENIAN CAPITAL LETTER TIWN", direction="l", @@ -12896,6 +13483,7 @@ characters.data={ unicodeslot=0x054F, }, [0x0550]={ + adobename="Reharmenian", category="lu", description="ARMENIAN CAPITAL LETTER REH", direction="l", @@ -12904,6 +13492,7 @@ characters.data={ unicodeslot=0x0550, }, [0x0551]={ + adobename="Coarmenian", category="lu", description="ARMENIAN CAPITAL LETTER CO", direction="l", @@ -12912,6 +13501,7 @@ characters.data={ unicodeslot=0x0551, }, [0x0552]={ + adobename="Yiwnarmenian", category="lu", description="ARMENIAN CAPITAL LETTER YIWN", direction="l", @@ -12920,6 +13510,7 @@ characters.data={ unicodeslot=0x0552, }, [0x0553]={ + adobename="Piwrarmenian", category="lu", description="ARMENIAN CAPITAL LETTER PIWR", direction="l", @@ -12928,6 +13519,7 @@ characters.data={ unicodeslot=0x0553, }, [0x0554]={ + adobename="Keharmenian", category="lu", description="ARMENIAN CAPITAL LETTER KEH", direction="l", @@ -12936,6 +13528,7 @@ characters.data={ unicodeslot=0x0554, }, [0x0555]={ + adobename="Oharmenian", category="lu", description="ARMENIAN CAPITAL LETTER OH", direction="l", @@ -12944,6 +13537,7 @@ characters.data={ unicodeslot=0x0555, }, [0x0556]={ + adobename="Feharmenian", category="lu", description="ARMENIAN CAPITAL LETTER FEH", direction="l", @@ -12952,6 +13546,7 @@ characters.data={ unicodeslot=0x0556, }, [0x0559]={ + adobename="ringhalfleftarmenian", category="lm", description="ARMENIAN MODIFIER LETTER LEFT HALF RING", direction="l", @@ -12959,6 +13554,7 @@ characters.data={ unicodeslot=0x0559, }, [0x055A]={ + adobename="apostrophearmenian", category="po", description="ARMENIAN APOSTROPHE", direction="l", @@ -12966,6 +13562,7 @@ characters.data={ unicodeslot=0x055A, }, [0x055B]={ + adobename="emphasismarkarmenian", category="po", description="ARMENIAN EMPHASIS MARK", direction="l", @@ -12973,6 +13570,7 @@ characters.data={ unicodeslot=0x055B, }, [0x055C]={ + adobename="exclamarmenian", category="po", description="ARMENIAN EXCLAMATION MARK", direction="l", @@ -12980,6 +13578,7 @@ characters.data={ unicodeslot=0x055C, }, [0x055D]={ + adobename="commaarmenian", category="po", description="ARMENIAN COMMA", direction="l", @@ -12987,6 +13586,7 @@ characters.data={ unicodeslot=0x055D, }, [0x055E]={ + adobename="questionarmenian", category="po", description="ARMENIAN QUESTION MARK", direction="l", @@ -12994,6 +13594,7 @@ characters.data={ unicodeslot=0x055E, }, [0x055F]={ + adobename="abbreviationmarkarmenian", category="po", description="ARMENIAN ABBREVIATION MARK", direction="l", @@ -13001,6 +13602,7 @@ characters.data={ unicodeslot=0x055F, }, [0x0561]={ + adobename="aybarmenian", category="ll", description="ARMENIAN SMALL LETTER AYB", direction="l", @@ -13009,6 +13611,7 @@ characters.data={ unicodeslot=0x0561, }, [0x0562]={ + adobename="benarmenian", category="ll", description="ARMENIAN SMALL LETTER BEN", direction="l", @@ -13017,6 +13620,7 @@ characters.data={ unicodeslot=0x0562, }, [0x0563]={ + adobename="gimarmenian", category="ll", description="ARMENIAN SMALL LETTER GIM", direction="l", @@ -13025,6 +13629,7 @@ characters.data={ unicodeslot=0x0563, }, [0x0564]={ + adobename="daarmenian", category="ll", description="ARMENIAN SMALL LETTER DA", direction="l", @@ -13033,6 +13638,7 @@ characters.data={ unicodeslot=0x0564, }, [0x0565]={ + adobename="echarmenian", category="ll", description="ARMENIAN SMALL LETTER ECH", direction="l", @@ -13041,6 +13647,7 @@ characters.data={ unicodeslot=0x0565, }, [0x0566]={ + adobename="zaarmenian", category="ll", description="ARMENIAN SMALL LETTER ZA", direction="l", @@ -13049,6 +13656,7 @@ characters.data={ unicodeslot=0x0566, }, [0x0567]={ + adobename="eharmenian", category="ll", description="ARMENIAN SMALL LETTER EH", direction="l", @@ -13057,6 +13665,7 @@ characters.data={ unicodeslot=0x0567, }, [0x0568]={ + adobename="etarmenian", category="ll", description="ARMENIAN SMALL LETTER ET", direction="l", @@ -13065,6 +13674,7 @@ characters.data={ unicodeslot=0x0568, }, [0x0569]={ + adobename="toarmenian", category="ll", description="ARMENIAN SMALL LETTER TO", direction="l", @@ -13073,6 +13683,7 @@ characters.data={ unicodeslot=0x0569, }, [0x056A]={ + adobename="zhearmenian", category="ll", description="ARMENIAN SMALL LETTER ZHE", direction="l", @@ -13081,6 +13692,7 @@ characters.data={ unicodeslot=0x056A, }, [0x056B]={ + adobename="iniarmenian", category="ll", description="ARMENIAN SMALL LETTER INI", direction="l", @@ -13089,6 +13701,7 @@ characters.data={ unicodeslot=0x056B, }, [0x056C]={ + adobename="liwnarmenian", category="ll", description="ARMENIAN SMALL LETTER LIWN", direction="l", @@ -13097,6 +13710,7 @@ characters.data={ unicodeslot=0x056C, }, [0x056D]={ + adobename="xeharmenian", category="ll", description="ARMENIAN SMALL LETTER XEH", direction="l", @@ -13105,6 +13719,7 @@ characters.data={ unicodeslot=0x056D, }, [0x056E]={ + adobename="caarmenian", category="ll", description="ARMENIAN SMALL LETTER CA", direction="l", @@ -13113,6 +13728,7 @@ characters.data={ unicodeslot=0x056E, }, [0x056F]={ + adobename="kenarmenian", category="ll", description="ARMENIAN SMALL LETTER KEN", direction="l", @@ -13121,6 +13737,7 @@ characters.data={ unicodeslot=0x056F, }, [0x0570]={ + adobename="hoarmenian", category="ll", description="ARMENIAN SMALL LETTER HO", direction="l", @@ -13129,6 +13746,7 @@ characters.data={ unicodeslot=0x0570, }, [0x0571]={ + adobename="jaarmenian", category="ll", description="ARMENIAN SMALL LETTER JA", direction="l", @@ -13137,6 +13755,7 @@ characters.data={ unicodeslot=0x0571, }, [0x0572]={ + adobename="ghadarmenian", category="ll", description="ARMENIAN SMALL LETTER GHAD", direction="l", @@ -13145,6 +13764,7 @@ characters.data={ unicodeslot=0x0572, }, [0x0573]={ + adobename="cheharmenian", category="ll", description="ARMENIAN SMALL LETTER CHEH", direction="l", @@ -13153,6 +13773,7 @@ characters.data={ unicodeslot=0x0573, }, [0x0574]={ + adobename="menarmenian", category="ll", description="ARMENIAN SMALL LETTER MEN", direction="l", @@ -13161,6 +13782,7 @@ characters.data={ unicodeslot=0x0574, }, [0x0575]={ + adobename="yiarmenian", category="ll", description="ARMENIAN SMALL LETTER YI", direction="l", @@ -13169,6 +13791,7 @@ characters.data={ unicodeslot=0x0575, }, [0x0576]={ + adobename="nowarmenian", category="ll", description="ARMENIAN SMALL LETTER NOW", direction="l", @@ -13177,6 +13800,7 @@ characters.data={ unicodeslot=0x0576, }, [0x0577]={ + adobename="shaarmenian", category="ll", description="ARMENIAN SMALL LETTER SHA", direction="l", @@ -13185,6 +13809,7 @@ characters.data={ unicodeslot=0x0577, }, [0x0578]={ + adobename="voarmenian", category="ll", description="ARMENIAN SMALL LETTER VO", direction="l", @@ -13193,6 +13818,7 @@ characters.data={ unicodeslot=0x0578, }, [0x0579]={ + adobename="chaarmenian", category="ll", description="ARMENIAN SMALL LETTER CHA", direction="l", @@ -13201,6 +13827,7 @@ characters.data={ unicodeslot=0x0579, }, [0x057A]={ + adobename="peharmenian", category="ll", description="ARMENIAN SMALL LETTER PEH", direction="l", @@ -13209,6 +13836,7 @@ characters.data={ unicodeslot=0x057A, }, [0x057B]={ + adobename="jheharmenian", category="ll", description="ARMENIAN SMALL LETTER JHEH", direction="l", @@ -13217,6 +13845,7 @@ characters.data={ unicodeslot=0x057B, }, [0x057C]={ + adobename="raarmenian", category="ll", description="ARMENIAN SMALL LETTER RA", direction="l", @@ -13225,6 +13854,7 @@ characters.data={ unicodeslot=0x057C, }, [0x057D]={ + adobename="seharmenian", category="ll", description="ARMENIAN SMALL LETTER SEH", direction="l", @@ -13233,6 +13863,7 @@ characters.data={ unicodeslot=0x057D, }, [0x057E]={ + adobename="vewarmenian", category="ll", description="ARMENIAN SMALL LETTER VEW", direction="l", @@ -13241,6 +13872,7 @@ characters.data={ unicodeslot=0x057E, }, [0x057F]={ + adobename="tiwnarmenian", category="ll", description="ARMENIAN SMALL LETTER TIWN", direction="l", @@ -13249,6 +13881,7 @@ characters.data={ unicodeslot=0x057F, }, [0x0580]={ + adobename="reharmenian", category="ll", description="ARMENIAN SMALL LETTER REH", direction="l", @@ -13257,6 +13890,7 @@ characters.data={ unicodeslot=0x0580, }, [0x0581]={ + adobename="coarmenian", category="ll", description="ARMENIAN SMALL LETTER CO", direction="l", @@ -13265,6 +13899,7 @@ characters.data={ unicodeslot=0x0581, }, [0x0582]={ + adobename="yiwnarmenian", category="ll", description="ARMENIAN SMALL LETTER YIWN", direction="l", @@ -13273,6 +13908,7 @@ characters.data={ unicodeslot=0x0582, }, [0x0583]={ + adobename="piwrarmenian", category="ll", description="ARMENIAN SMALL LETTER PIWR", direction="l", @@ -13281,6 +13917,7 @@ characters.data={ unicodeslot=0x0583, }, [0x0584]={ + adobename="keharmenian", category="ll", description="ARMENIAN SMALL LETTER KEH", direction="l", @@ -13289,6 +13926,7 @@ characters.data={ unicodeslot=0x0584, }, [0x0585]={ + adobename="oharmenian", category="ll", description="ARMENIAN SMALL LETTER OH", direction="l", @@ -13297,6 +13935,7 @@ characters.data={ unicodeslot=0x0585, }, [0x0586]={ + adobename="feharmenian", category="ll", description="ARMENIAN SMALL LETTER FEH", direction="l", @@ -13305,6 +13944,7 @@ characters.data={ unicodeslot=0x0586, }, [0x0587]={ + adobename="echyiwnarmenian", category="ll", description="ARMENIAN SMALL LIGATURE ECH YIWN", direction="l", @@ -13313,6 +13953,7 @@ characters.data={ unicodeslot=0x0587, }, [0x0589]={ + adobename="periodarmenian", category="po", description="ARMENIAN FULL STOP", direction="l", @@ -13327,6 +13968,7 @@ characters.data={ unicodeslot=0x058A, }, [0x0591]={ + adobename="etnahtalefthebrew", category="mn", description="HEBREW ACCENT ETNAHTA", direction="nsm", @@ -13334,6 +13976,7 @@ characters.data={ unicodeslot=0x0591, }, [0x0592]={ + adobename="segoltahebrew", category="mn", description="HEBREW ACCENT SEGOL", direction="nsm", @@ -13341,6 +13984,7 @@ characters.data={ unicodeslot=0x0592, }, [0x0593]={ + adobename="shalshelethebrew", category="mn", description="HEBREW ACCENT SHALSHELET", direction="nsm", @@ -13348,6 +13992,7 @@ characters.data={ unicodeslot=0x0593, }, [0x0594]={ + adobename="zaqefqatanhebrew", category="mn", description="HEBREW ACCENT ZAQEF QATAN", direction="nsm", @@ -13355,6 +14000,7 @@ characters.data={ unicodeslot=0x0594, }, [0x0595]={ + adobename="zaqefgadolhebrew", category="mn", description="HEBREW ACCENT ZAQEF GADOL", direction="nsm", @@ -13362,6 +14008,7 @@ characters.data={ unicodeslot=0x0595, }, [0x0596]={ + adobename="tipehalefthebrew", category="mn", description="HEBREW ACCENT TIPEHA", direction="nsm", @@ -13369,6 +14016,7 @@ characters.data={ unicodeslot=0x0596, }, [0x0597]={ + adobename="reviamugrashhebrew", category="mn", description="HEBREW ACCENT REVIA", direction="nsm", @@ -13376,6 +14024,7 @@ characters.data={ unicodeslot=0x0597, }, [0x0598]={ + adobename="zarqahebrew", category="mn", description="HEBREW ACCENT ZARQA", direction="nsm", @@ -13383,6 +14032,7 @@ characters.data={ unicodeslot=0x0598, }, [0x0599]={ + adobename="pashtahebrew", category="mn", description="HEBREW ACCENT PASHTA", direction="nsm", @@ -13390,6 +14040,7 @@ characters.data={ unicodeslot=0x0599, }, [0x059A]={ + adobename="yetivhebrew", category="mn", description="HEBREW ACCENT YETIV", direction="nsm", @@ -13397,6 +14048,7 @@ characters.data={ unicodeslot=0x059A, }, [0x059B]={ + adobename="tevirlefthebrew", category="mn", description="HEBREW ACCENT TEVIR", direction="nsm", @@ -13404,6 +14056,7 @@ characters.data={ unicodeslot=0x059B, }, [0x059C]={ + adobename="gereshaccenthebrew", category="mn", description="HEBREW ACCENT GERESH", direction="nsm", @@ -13411,6 +14064,7 @@ characters.data={ unicodeslot=0x059C, }, [0x059D]={ + adobename="gereshmuqdamhebrew", category="mn", description="HEBREW ACCENT GERESH MUQDAM", direction="nsm", @@ -13418,6 +14072,7 @@ characters.data={ unicodeslot=0x059D, }, [0x059E]={ + adobename="gershayimaccenthebrew", category="mn", description="HEBREW ACCENT GERSHAYIM", direction="nsm", @@ -13425,6 +14080,7 @@ characters.data={ unicodeslot=0x059E, }, [0x059F]={ + adobename="qarneyparahebrew", category="mn", description="HEBREW ACCENT QARNEY PARA", direction="nsm", @@ -13432,6 +14088,7 @@ characters.data={ unicodeslot=0x059F, }, [0x05A0]={ + adobename="telishagedolahebrew", category="mn", description="HEBREW ACCENT TELISHA GEDOLA", direction="nsm", @@ -13439,6 +14096,7 @@ characters.data={ unicodeslot=0x05A0, }, [0x05A1]={ + adobename="pazerhebrew", category="mn", description="HEBREW ACCENT PAZER", direction="nsm", @@ -13453,6 +14111,7 @@ characters.data={ unicodeslot=0x05A2, }, [0x05A3]={ + adobename="munahlefthebrew", category="mn", description="HEBREW ACCENT MUNAH", direction="nsm", @@ -13460,6 +14119,7 @@ characters.data={ unicodeslot=0x05A3, }, [0x05A4]={ + adobename="mahapakhlefthebrew", category="mn", description="HEBREW ACCENT MAHAPAKH", direction="nsm", @@ -13467,6 +14127,7 @@ characters.data={ unicodeslot=0x05A4, }, [0x05A5]={ + adobename="merkhalefthebrew", category="mn", description="HEBREW ACCENT MERKHA", direction="nsm", @@ -13474,6 +14135,7 @@ characters.data={ unicodeslot=0x05A5, }, [0x05A6]={ + adobename="merkhakefulalefthebrew", category="mn", description="HEBREW ACCENT MERKHA KEFULA", direction="nsm", @@ -13481,6 +14143,7 @@ characters.data={ unicodeslot=0x05A6, }, [0x05A7]={ + adobename="dargalefthebrew", category="mn", description="HEBREW ACCENT DARGA", direction="nsm", @@ -13488,6 +14151,7 @@ characters.data={ unicodeslot=0x05A7, }, [0x05A8]={ + adobename="qadmahebrew", category="mn", description="HEBREW ACCENT QADMA", direction="nsm", @@ -13495,6 +14159,7 @@ characters.data={ unicodeslot=0x05A8, }, [0x05A9]={ + adobename="telishaqetanahebrew", category="mn", description="HEBREW ACCENT TELISHA QETANA", direction="nsm", @@ -13502,6 +14167,7 @@ characters.data={ unicodeslot=0x05A9, }, [0x05AA]={ + adobename="yerahbenyomolefthebrew", category="mn", description="HEBREW ACCENT YERAH BEN YOMO", direction="nsm", @@ -13509,6 +14175,7 @@ characters.data={ unicodeslot=0x05AA, }, [0x05AB]={ + adobename="olehebrew", category="mn", description="HEBREW ACCENT OLE", direction="nsm", @@ -13516,6 +14183,7 @@ characters.data={ unicodeslot=0x05AB, }, [0x05AC]={ + adobename="iluyhebrew", category="mn", description="HEBREW ACCENT ILUY", direction="nsm", @@ -13523,6 +14191,7 @@ characters.data={ unicodeslot=0x05AC, }, [0x05AD]={ + adobename="dehihebrew", category="mn", description="HEBREW ACCENT DEHI", direction="nsm", @@ -13530,6 +14199,7 @@ characters.data={ unicodeslot=0x05AD, }, [0x05AE]={ + adobename="zinorhebrew", category="mn", description="HEBREW ACCENT ZINOR", direction="nsm", @@ -13537,6 +14207,7 @@ characters.data={ unicodeslot=0x05AE, }, [0x05AF]={ + adobename="masoracirclehebrew", category="mn", description="HEBREW MARK MASORA CIRCLE", direction="nsm", @@ -13544,7 +14215,7 @@ characters.data={ unicodeslot=0x05AF, }, [0x05B0]={ - adobename="afii57799", + adobename="shevawidehebrew", category="mn", description="HEBREW POINT SHEVA", direction="nsm", @@ -13552,7 +14223,7 @@ characters.data={ unicodeslot=0x05B0, }, [0x05B1]={ - adobename="afii57801", + adobename="hatafsegolwidehebrew", category="mn", description="HEBREW POINT HATAF SEGOL", direction="nsm", @@ -13560,7 +14231,7 @@ characters.data={ unicodeslot=0x05B1, }, [0x05B2]={ - adobename="afii57800", + adobename="hatafpatahwidehebrew", category="mn", description="HEBREW POINT HATAF PATAH", direction="nsm", @@ -13568,7 +14239,7 @@ characters.data={ unicodeslot=0x05B2, }, [0x05B3]={ - adobename="afii57802", + adobename="hatafqamatswidehebrew", category="mn", description="HEBREW POINT HATAF QAMATS", direction="nsm", @@ -13576,7 +14247,7 @@ characters.data={ unicodeslot=0x05B3, }, [0x05B4]={ - adobename="afii57793", + adobename="hiriqwidehebrew", category="mn", description="HEBREW POINT HIRIQ", direction="nsm", @@ -13584,7 +14255,7 @@ characters.data={ unicodeslot=0x05B4, }, [0x05B5]={ - adobename="afii57794", + adobename="tserewidehebrew", category="mn", description="HEBREW POINT TSERE", direction="nsm", @@ -13592,7 +14263,7 @@ characters.data={ unicodeslot=0x05B5, }, [0x05B6]={ - adobename="afii57795", + adobename="segolwidehebrew", category="mn", description="HEBREW POINT SEGOL", direction="nsm", @@ -13600,7 +14271,7 @@ characters.data={ unicodeslot=0x05B6, }, [0x05B7]={ - adobename="afii57798", + adobename="patahwidehebrew", category="mn", description="HEBREW POINT PATAH", direction="nsm", @@ -13608,7 +14279,7 @@ characters.data={ unicodeslot=0x05B7, }, [0x05B8]={ - adobename="afii57797", + adobename="qamatswidehebrew", category="mn", description="HEBREW POINT QAMATS", direction="nsm", @@ -13616,7 +14287,7 @@ characters.data={ unicodeslot=0x05B8, }, [0x05B9]={ - adobename="afii57806", + adobename="holamwidehebrew", category="mn", description="HEBREW POINT HOLAM", direction="nsm", @@ -13631,7 +14302,7 @@ characters.data={ unicodeslot=0x05BA, }, [0x05BB]={ - adobename="afii57796", + adobename="qubutswidehebrew", category="mn", description="HEBREW POINT QUBUTS", direction="nsm", @@ -13639,7 +14310,7 @@ characters.data={ unicodeslot=0x05BB, }, [0x05BC]={ - adobename="afii57807", + adobename="dageshhebrew", category="mn", description="HEBREW POINT DAGESH OR MAPIQ", direction="nsm", @@ -13647,7 +14318,7 @@ characters.data={ unicodeslot=0x05BC, }, [0x05BD]={ - adobename="afii57839", + adobename="siluqlefthebrew", category="mn", description="HEBREW POINT METEG", direction="nsm", @@ -13655,7 +14326,7 @@ characters.data={ unicodeslot=0x05BD, }, [0x05BE]={ - adobename="afii57645", + adobename="maqafhebrew", category="po", description="HEBREW PUNCTUATION MAQAF", direction="r", @@ -13663,7 +14334,7 @@ characters.data={ unicodeslot=0x05BE, }, [0x05BF]={ - adobename="afii57841", + adobename="rafehebrew", category="mn", description="HEBREW POINT RAFE", direction="nsm", @@ -13671,7 +14342,7 @@ characters.data={ unicodeslot=0x05BF, }, [0x05C0]={ - adobename="afii57842", + adobename="paseqhebrew", category="po", description="HEBREW PUNCTUATION PASEQ", direction="r", @@ -13679,7 +14350,7 @@ characters.data={ unicodeslot=0x05C0, }, [0x05C1]={ - adobename="afii57804", + adobename="shindothebrew", category="mn", description="HEBREW POINT SHIN DOT", direction="nsm", @@ -13687,7 +14358,7 @@ characters.data={ unicodeslot=0x05C1, }, [0x05C2]={ - adobename="afii57803", + adobename="sindothebrew", category="mn", description="HEBREW POINT SIN DOT", direction="nsm", @@ -13695,7 +14366,7 @@ characters.data={ unicodeslot=0x05C2, }, [0x05C3]={ - adobename="afii57658", + adobename="sofpasuqhebrew", category="po", description="HEBREW PUNCTUATION SOF PASUQ", direction="r", @@ -13703,6 +14374,7 @@ characters.data={ unicodeslot=0x05C3, }, [0x05C4]={ + adobename="upperdothebrew", category="mn", description="HEBREW MARK UPPER DOT", direction="nsm", @@ -13731,7 +14403,7 @@ characters.data={ unicodeslot=0x05C7, }, [0x05D0]={ - adobename="afii57664", + adobename="alefhebrew", category="lo", contextname="hebrewAlef", description="HEBREW LETTER ALEF", @@ -13740,7 +14412,7 @@ characters.data={ unicodeslot=0x05D0, }, [0x05D1]={ - adobename="afii57665", + adobename="bethebrew", category="lo", contextname="hebrewBet", description="HEBREW LETTER BET", @@ -13749,7 +14421,7 @@ characters.data={ unicodeslot=0x05D1, }, [0x05D2]={ - adobename="afii57666", + adobename="gimelhebrew", category="lo", contextname="hebrewGimel", description="HEBREW LETTER GIMEL", @@ -13758,7 +14430,7 @@ characters.data={ unicodeslot=0x05D2, }, [0x05D3]={ - adobename="afii57667", + adobename="dalettserehebrew", category="lo", contextname="hebrewDalet", description="HEBREW LETTER DALET", @@ -13767,7 +14439,7 @@ characters.data={ unicodeslot=0x05D3, }, [0x05D4]={ - adobename="afii57668", + adobename="hehebrew", category="lo", contextname="hebrewHe", description="HEBREW LETTER HE", @@ -13776,7 +14448,7 @@ characters.data={ unicodeslot=0x05D4, }, [0x05D5]={ - adobename="afii57669", + adobename="vavhebrew", category="lo", contextname="hebrewVav", description="HEBREW LETTER VAV", @@ -13785,7 +14457,7 @@ characters.data={ unicodeslot=0x05D5, }, [0x05D6]={ - adobename="afii57670", + adobename="zayinhebrew", category="lo", contextname="hebrewZayin", description="HEBREW LETTER ZAYIN", @@ -13794,7 +14466,7 @@ characters.data={ unicodeslot=0x05D6, }, [0x05D7]={ - adobename="afii57671", + adobename="hethebrew", category="lo", contextname="hebrewHet", description="HEBREW LETTER HET", @@ -13803,7 +14475,7 @@ characters.data={ unicodeslot=0x05D7, }, [0x05D8]={ - adobename="afii57672", + adobename="tethebrew", category="lo", contextname="hebrewTet", description="HEBREW LETTER TET", @@ -13812,7 +14484,7 @@ characters.data={ unicodeslot=0x05D8, }, [0x05D9]={ - adobename="afii57673", + adobename="yodhebrew", category="lo", contextname="hebrewYod", description="HEBREW LETTER YOD", @@ -13821,7 +14493,7 @@ characters.data={ unicodeslot=0x05D9, }, [0x05DA]={ - adobename="afii57674", + adobename="finalkafshevahebrew", category="lo", contextname="hebrewKaffinal", description="HEBREW LETTER FINAL KAF", @@ -13830,7 +14502,7 @@ characters.data={ unicodeslot=0x05DA, }, [0x05DB]={ - adobename="afii57675", + adobename="kafhebrew", category="lo", contextname="hebrewKaf", description="HEBREW LETTER KAF", @@ -13839,7 +14511,7 @@ characters.data={ unicodeslot=0x05DB, }, [0x05DC]={ - adobename="afii57676", + adobename="lamedholamhebrew", category="lo", contextname="hebrewLamed", description="HEBREW LETTER LAMED", @@ -13848,7 +14520,7 @@ characters.data={ unicodeslot=0x05DC, }, [0x05DD]={ - adobename="afii57677", + adobename="finalmemhebrew", category="lo", contextname="hebrewMemfinal", description="HEBREW LETTER FINAL MEM", @@ -13857,7 +14529,7 @@ characters.data={ unicodeslot=0x05DD, }, [0x05DE]={ - adobename="afii57678", + adobename="memhebrew", category="lo", contextname="hebrewMem", description="HEBREW LETTER MEM", @@ -13866,7 +14538,7 @@ characters.data={ unicodeslot=0x05DE, }, [0x05DF]={ - adobename="afii57679", + adobename="finalnunhebrew", category="lo", contextname="hebrewNunfinal", description="HEBREW LETTER FINAL NUN", @@ -13875,7 +14547,7 @@ characters.data={ unicodeslot=0x05DF, }, [0x05E0]={ - adobename="afii57680", + adobename="nunhebrew", category="lo", contextname="hebrewNun", description="HEBREW LETTER NUN", @@ -13884,7 +14556,7 @@ characters.data={ unicodeslot=0x05E0, }, [0x05E1]={ - adobename="afii57681", + adobename="samekhhebrew", category="lo", contextname="hebrewSamekh", description="HEBREW LETTER SAMEKH", @@ -13893,7 +14565,7 @@ characters.data={ unicodeslot=0x05E1, }, [0x05E2]={ - adobename="afii57682", + adobename="ayinhebrew", category="lo", contextname="hebrewAyin", description="HEBREW LETTER AYIN", @@ -13902,7 +14574,7 @@ characters.data={ unicodeslot=0x05E2, }, [0x05E3]={ - adobename="afii57683", + adobename="finalpehebrew", category="lo", contextname="hebrewPefinal", description="HEBREW LETTER FINAL PE", @@ -13911,7 +14583,7 @@ characters.data={ unicodeslot=0x05E3, }, [0x05E4]={ - adobename="afii57684", + adobename="pehebrew", category="lo", contextname="hebrewPe", description="HEBREW LETTER PE", @@ -13920,7 +14592,7 @@ characters.data={ unicodeslot=0x05E4, }, [0x05E5]={ - adobename="afii57685", + adobename="finaltsadihebrew", category="lo", contextname="hebrewTsadifinal", description="HEBREW LETTER FINAL TSADI", @@ -13929,7 +14601,7 @@ characters.data={ unicodeslot=0x05E5, }, [0x05E6]={ - adobename="afii57686", + adobename="tsadihebrew", category="lo", contextname="hebrewTsadi", description="HEBREW LETTER TSADI", @@ -13938,7 +14610,7 @@ characters.data={ unicodeslot=0x05E6, }, [0x05E7]={ - adobename="afii57687", + adobename="qoftserehebrew", category="lo", contextname="hebrewQof", description="HEBREW LETTER QOF", @@ -13947,7 +14619,7 @@ characters.data={ unicodeslot=0x05E7, }, [0x05E8]={ - adobename="afii57688", + adobename="reshtserehebrew", category="lo", contextname="hebrewResh", description="HEBREW LETTER RESH", @@ -13956,7 +14628,7 @@ characters.data={ unicodeslot=0x05E8, }, [0x05E9]={ - adobename="afii57689", + adobename="shinhebrew", category="lo", contextname="hebrewShin", description="HEBREW LETTER SHIN", @@ -13965,7 +14637,7 @@ characters.data={ unicodeslot=0x05E9, }, [0x05EA]={ - adobename="afii57690", + adobename="tavhebrew", category="lo", contextname="hebrewTav", description="HEBREW LETTER TAV", @@ -13974,7 +14646,7 @@ characters.data={ unicodeslot=0x05EA, }, [0x05F0]={ - adobename="afii57716", + adobename="vavvavhebrew", category="lo", description="HEBREW LIGATURE YIDDISH DOUBLE VAV", direction="r", @@ -13982,7 +14654,7 @@ characters.data={ unicodeslot=0x05F0, }, [0x05F1]={ - adobename="afii57717", + adobename="vavyodhebrew", category="lo", description="HEBREW LIGATURE YIDDISH VAV YOD", direction="r", @@ -13990,7 +14662,7 @@ characters.data={ unicodeslot=0x05F1, }, [0x05F2]={ - adobename="afii57718", + adobename="yodyodhebrew", category="lo", description="HEBREW LIGATURE YIDDISH DOUBLE YOD", direction="r", @@ -13998,6 +14670,7 @@ characters.data={ unicodeslot=0x05F2, }, [0x05F3]={ + adobename="gereshhebrew", category="po", description="HEBREW PUNCTUATION GERESH", direction="r", @@ -14005,6 +14678,7 @@ characters.data={ unicodeslot=0x05F3, }, [0x05F4]={ + adobename="gershayimhebrew", category="po", description="HEBREW PUNCTUATION GERSHAYIM", direction="r", @@ -14015,33 +14689,33 @@ characters.data={ category="cf", description="ARABIC NUMBER SIGN", direction="an", - visible="yes", linebreak="al", unicodeslot=0x0600, + visible="yes", }, [0x0601]={ category="cf", description="ARABIC SIGN SANAH", direction="an", - visible="yes", linebreak="al", unicodeslot=0x0601, + visible="yes", }, [0x0602]={ category="cf", description="ARABIC FOOTNOTE MARKER", direction="an", - visible="yes", linebreak="al", unicodeslot=0x0602, + visible="yes", }, [0x0603]={ category="cf", description="ARABIC SIGN SAFHA", direction="an", - visible="yes", linebreak="al", unicodeslot=0x0603, + visible="yes", }, [0x060B]={ category="sc", @@ -14051,7 +14725,7 @@ characters.data={ unicodeslot=0x060B, }, [0x060C]={ - adobename="afii57388", + adobename="commaarabic", category="po", description="ARABIC COMMA", direction="cs", @@ -14122,7 +14796,7 @@ characters.data={ unicodeslot=0x0615, }, [0x061B]={ - adobename="afii57403", + adobename="semicolonarabic", category="po", description="ARABIC SEMICOLON", direction="al", @@ -14137,7 +14811,7 @@ characters.data={ unicodeslot=0x061E, }, [0x061F]={ - adobename="afii57407", + adobename="questionarabic", category="po", description="ARABIC QUESTION MARK", direction="al", @@ -14145,7 +14819,7 @@ characters.data={ unicodeslot=0x061F, }, [0x0621]={ - adobename="afii57409", + adobename="hamzasukunarabic", category="lo", description="ARABIC LETTER HAMZA", direction="al", @@ -14153,7 +14827,7 @@ characters.data={ unicodeslot=0x0621, }, [0x0622]={ - adobename="afii57410", + adobename="alefmaddaabovearabic", category="lo", description="ARABIC LETTER ALEF WITH MADDA ABOVE", direction="al", @@ -14163,7 +14837,7 @@ characters.data={ unicodeslot=0x0622, }, [0x0623]={ - adobename="afii57411", + adobename="alefhamzaabovearabic", category="lo", description="ARABIC LETTER ALEF WITH HAMZA ABOVE", direction="al", @@ -14173,7 +14847,7 @@ characters.data={ unicodeslot=0x0623, }, [0x0624]={ - adobename="afii57412", + adobename="wawhamzaabovearabic", category="lo", description="ARABIC LETTER WAW WITH HAMZA ABOVE", direction="al", @@ -14183,7 +14857,7 @@ characters.data={ unicodeslot=0x0624, }, [0x0625]={ - adobename="afii57413", + adobename="alefhamzabelowarabic", category="lo", description="ARABIC LETTER ALEF WITH HAMZA BELOW", direction="al", @@ -14193,7 +14867,7 @@ characters.data={ unicodeslot=0x0625, }, [0x0626]={ - adobename="afii57414", + adobename="yehhamzaabovearabic", category="lo", description="ARABIC LETTER YEH WITH HAMZA ABOVE", direction="al", @@ -14203,7 +14877,7 @@ characters.data={ unicodeslot=0x0626, }, [0x0627]={ - adobename="afii57415", + adobename="alefarabic", category="lo", description="ARABIC LETTER ALEF", direction="al", @@ -14211,7 +14885,7 @@ characters.data={ unicodeslot=0x0627, }, [0x0628]={ - adobename="afii57416", + adobename="beharabic", category="lo", description="ARABIC LETTER BEH", direction="al", @@ -14219,7 +14893,7 @@ characters.data={ unicodeslot=0x0628, }, [0x0629]={ - adobename="afii57417", + adobename="tehmarbutaarabic", category="lo", description="ARABIC LETTER TEH MARBUTA", direction="al", @@ -14227,7 +14901,7 @@ characters.data={ unicodeslot=0x0629, }, [0x062A]={ - adobename="afii57418", + adobename="teharabic", category="lo", description="ARABIC LETTER TEH", direction="al", @@ -14235,7 +14909,7 @@ characters.data={ unicodeslot=0x062A, }, [0x062B]={ - adobename="afii57419", + adobename="theharabic", category="lo", description="ARABIC LETTER THEH", direction="al", @@ -14243,7 +14917,7 @@ characters.data={ unicodeslot=0x062B, }, [0x062C]={ - adobename="afii57420", + adobename="jeemarabic", category="lo", description="ARABIC LETTER JEEM", direction="al", @@ -14251,7 +14925,7 @@ characters.data={ unicodeslot=0x062C, }, [0x062D]={ - adobename="afii57421", + adobename="haharabic", category="lo", description="ARABIC LETTER HAH", direction="al", @@ -14259,7 +14933,7 @@ characters.data={ unicodeslot=0x062D, }, [0x062E]={ - adobename="afii57422", + adobename="khaharabic", category="lo", description="ARABIC LETTER KHAH", direction="al", @@ -14267,7 +14941,7 @@ characters.data={ unicodeslot=0x062E, }, [0x062F]={ - adobename="afii57423", + adobename="dalarabic", category="lo", description="ARABIC LETTER DAL", direction="al", @@ -14275,7 +14949,7 @@ characters.data={ unicodeslot=0x062F, }, [0x0630]={ - adobename="afii57424", + adobename="thalarabic", category="lo", description="ARABIC LETTER THAL", direction="al", @@ -14283,7 +14957,7 @@ characters.data={ unicodeslot=0x0630, }, [0x0631]={ - adobename="afii57425", + adobename="rehyehaleflamarabic", category="lo", description="ARABIC LETTER REH", direction="al", @@ -14291,7 +14965,7 @@ characters.data={ unicodeslot=0x0631, }, [0x0632]={ - adobename="afii57426", + adobename="zainarabic", category="lo", description="ARABIC LETTER ZAIN", direction="al", @@ -14299,7 +14973,7 @@ characters.data={ unicodeslot=0x0632, }, [0x0633]={ - adobename="afii57427", + adobename="seenarabic", category="lo", description="ARABIC LETTER SEEN", direction="al", @@ -14307,7 +14981,7 @@ characters.data={ unicodeslot=0x0633, }, [0x0634]={ - adobename="afii57428", + adobename="sheenarabic", category="lo", description="ARABIC LETTER SHEEN", direction="al", @@ -14315,7 +14989,7 @@ characters.data={ unicodeslot=0x0634, }, [0x0635]={ - adobename="afii57429", + adobename="sadarabic", category="lo", description="ARABIC LETTER SAD", direction="al", @@ -14323,7 +14997,7 @@ characters.data={ unicodeslot=0x0635, }, [0x0636]={ - adobename="afii57430", + adobename="dadarabic", category="lo", description="ARABIC LETTER DAD", direction="al", @@ -14331,7 +15005,7 @@ characters.data={ unicodeslot=0x0636, }, [0x0637]={ - adobename="afii57431", + adobename="taharabic", category="lo", description="ARABIC LETTER TAH", direction="al", @@ -14339,7 +15013,7 @@ characters.data={ unicodeslot=0x0637, }, [0x0638]={ - adobename="afii57432", + adobename="zaharabic", category="lo", description="ARABIC LETTER ZAH", direction="al", @@ -14347,7 +15021,7 @@ characters.data={ unicodeslot=0x0638, }, [0x0639]={ - adobename="afii57433", + adobename="ainarabic", category="lo", description="ARABIC LETTER AIN", direction="al", @@ -14355,7 +15029,7 @@ characters.data={ unicodeslot=0x0639, }, [0x063A]={ - adobename="afii57434", + adobename="ghainarabic", category="lo", description="ARABIC LETTER GHAIN", direction="al", @@ -14363,7 +15037,7 @@ characters.data={ unicodeslot=0x063A, }, [0x0640]={ - adobename="afii57440", + adobename="tatweelarabic", category="lm", description="ARABIC TATWEEL", direction="al", @@ -14371,7 +15045,7 @@ characters.data={ unicodeslot=0x0640, }, [0x0641]={ - adobename="afii57441", + adobename="feharabic", category="lo", description="ARABIC LETTER FEH", direction="al", @@ -14379,7 +15053,7 @@ characters.data={ unicodeslot=0x0641, }, [0x0642]={ - adobename="afii57442", + adobename="qafarabic", category="lo", description="ARABIC LETTER QAF", direction="al", @@ -14387,7 +15061,7 @@ characters.data={ unicodeslot=0x0642, }, [0x0643]={ - adobename="afii57443", + adobename="kafarabic", category="lo", description="ARABIC LETTER KAF", direction="al", @@ -14395,7 +15069,7 @@ characters.data={ unicodeslot=0x0643, }, [0x0644]={ - adobename="afii57444", + adobename="lamarabic", category="lo", description="ARABIC LETTER LAM", direction="al", @@ -14403,7 +15077,7 @@ characters.data={ unicodeslot=0x0644, }, [0x0645]={ - adobename="afii57445", + adobename="meemarabic", category="lo", description="ARABIC LETTER MEEM", direction="al", @@ -14411,7 +15085,7 @@ characters.data={ unicodeslot=0x0645, }, [0x0646]={ - adobename="afii57446", + adobename="noonarabic", category="lo", description="ARABIC LETTER NOON", direction="al", @@ -14419,7 +15093,7 @@ characters.data={ unicodeslot=0x0646, }, [0x0647]={ - adobename="afii57470", + adobename="heharabic", category="lo", description="ARABIC LETTER HEH", direction="al", @@ -14427,7 +15101,7 @@ characters.data={ unicodeslot=0x0647, }, [0x0648]={ - adobename="afii57448", + adobename="wawarabic", category="lo", description="ARABIC LETTER WAW", direction="al", @@ -14435,7 +15109,7 @@ characters.data={ unicodeslot=0x0648, }, [0x0649]={ - adobename="afii57449", + adobename="alefmaksuraarabic", category="lo", description="ARABIC LETTER ALEF MAKSURA", direction="al", @@ -14443,7 +15117,7 @@ characters.data={ unicodeslot=0x0649, }, [0x064A]={ - adobename="afii57450", + adobename="yeharabic", category="lo", description="ARABIC LETTER YEH", direction="al", @@ -14451,7 +15125,7 @@ characters.data={ unicodeslot=0x064A, }, [0x064B]={ - adobename="afii57451", + adobename="fathatanarabic", category="mn", description="ARABIC FATHATAN", direction="nsm", @@ -14459,7 +15133,7 @@ characters.data={ unicodeslot=0x064B, }, [0x064C]={ - adobename="afii57452", + adobename="dammatanarabic", category="mn", description="ARABIC DAMMATAN", direction="nsm", @@ -14467,7 +15141,7 @@ characters.data={ unicodeslot=0x064C, }, [0x064D]={ - adobename="afii57453", + adobename="kasratanarabic", category="mn", description="ARABIC KASRATAN", direction="nsm", @@ -14475,7 +15149,7 @@ characters.data={ unicodeslot=0x064D, }, [0x064E]={ - adobename="afii57454", + adobename="fathalowarabic", category="mn", description="ARABIC FATHA", direction="nsm", @@ -14483,7 +15157,7 @@ characters.data={ unicodeslot=0x064E, }, [0x064F]={ - adobename="afii57455", + adobename="dammalowarabic", category="mn", description="ARABIC DAMMA", direction="nsm", @@ -14491,7 +15165,7 @@ characters.data={ unicodeslot=0x064F, }, [0x0650]={ - adobename="afii57456", + adobename="kasraarabic", category="mn", description="ARABIC KASRA", direction="nsm", @@ -14499,7 +15173,7 @@ characters.data={ unicodeslot=0x0650, }, [0x0651]={ - adobename="afii57457", + adobename="shaddafathatanarabic", category="mn", description="ARABIC SHADDA", direction="nsm", @@ -14507,7 +15181,7 @@ characters.data={ unicodeslot=0x0651, }, [0x0652]={ - adobename="afii57458", + adobename="sukunarabic", category="mn", description="ARABIC SUKUN", direction="nsm", @@ -14599,7 +15273,7 @@ characters.data={ unicodeslot=0x065E, }, [0x0660]={ - adobename="afii57392", + adobename="zerohackarabic", category="nd", description="ARABIC-INDIC DIGIT ZERO", direction="an", @@ -14607,7 +15281,7 @@ characters.data={ unicodeslot=0x0660, }, [0x0661]={ - adobename="afii57393", + adobename="onehackarabic", category="nd", description="ARABIC-INDIC DIGIT ONE", direction="an", @@ -14615,7 +15289,7 @@ characters.data={ unicodeslot=0x0661, }, [0x0662]={ - adobename="afii57394", + adobename="twohackarabic", category="nd", description="ARABIC-INDIC DIGIT TWO", direction="an", @@ -14623,7 +15297,7 @@ characters.data={ unicodeslot=0x0662, }, [0x0663]={ - adobename="afii57395", + adobename="threehackarabic", category="nd", description="ARABIC-INDIC DIGIT THREE", direction="an", @@ -14631,7 +15305,7 @@ characters.data={ unicodeslot=0x0663, }, [0x0664]={ - adobename="afii57396", + adobename="fourhackarabic", category="nd", description="ARABIC-INDIC DIGIT FOUR", direction="an", @@ -14639,7 +15313,7 @@ characters.data={ unicodeslot=0x0664, }, [0x0665]={ - adobename="afii57397", + adobename="fivehackarabic", category="nd", description="ARABIC-INDIC DIGIT FIVE", direction="an", @@ -14647,7 +15321,7 @@ characters.data={ unicodeslot=0x0665, }, [0x0666]={ - adobename="afii57398", + adobename="sixhackarabic", category="nd", description="ARABIC-INDIC DIGIT SIX", direction="an", @@ -14655,7 +15329,7 @@ characters.data={ unicodeslot=0x0666, }, [0x0667]={ - adobename="afii57399", + adobename="sevenhackarabic", category="nd", description="ARABIC-INDIC DIGIT SEVEN", direction="an", @@ -14663,7 +15337,7 @@ characters.data={ unicodeslot=0x0667, }, [0x0668]={ - adobename="afii57400", + adobename="eighthackarabic", category="nd", description="ARABIC-INDIC DIGIT EIGHT", direction="an", @@ -14671,7 +15345,7 @@ characters.data={ unicodeslot=0x0668, }, [0x0669]={ - adobename="afii57401", + adobename="ninehackarabic", category="nd", description="ARABIC-INDIC DIGIT NINE", direction="an", @@ -14679,7 +15353,7 @@ characters.data={ unicodeslot=0x0669, }, [0x066A]={ - adobename="afii57381", + adobename="percentarabic", category="po", description="ARABIC PERCENT SIGN", direction="et", @@ -14687,6 +15361,7 @@ characters.data={ unicodeslot=0x066A, }, [0x066B]={ + adobename="decimalseparatorpersian", category="po", description="ARABIC DECIMAL SEPARATOR", direction="an", @@ -14694,6 +15369,7 @@ characters.data={ unicodeslot=0x066B, }, [0x066C]={ + adobename="thousandsseparatorpersian", category="po", description="ARABIC THOUSANDS SEPARATOR", direction="an", @@ -14701,7 +15377,7 @@ characters.data={ unicodeslot=0x066C, }, [0x066D]={ - adobename="afii63167", + adobename="asteriskarabic", category="po", description="ARABIC FIVE POINTED STAR", direction="al", @@ -14793,7 +15469,7 @@ characters.data={ unicodeslot=0x0678, }, [0x0679]={ - adobename="afii57511", + adobename="tteharabic", category="lo", description="ARABIC LETTER TTEH", direction="al", @@ -14831,7 +15507,7 @@ characters.data={ unicodeslot=0x067D, }, [0x067E]={ - adobename="afii57506", + adobename="peharabic", category="lo", description="ARABIC LETTER PEH", direction="al", @@ -14891,7 +15567,7 @@ characters.data={ unicodeslot=0x0685, }, [0x0686]={ - adobename="afii57507", + adobename="tcheharabic", category="lo", description="ARABIC LETTER TCHEH", direction="al", @@ -14906,7 +15582,7 @@ characters.data={ unicodeslot=0x0687, }, [0x0688]={ - adobename="afii57512", + adobename="ddalarabic", category="lo", description="ARABIC LETTER DDAL", direction="al", @@ -14975,7 +15651,7 @@ characters.data={ unicodeslot=0x0690, }, [0x0691]={ - adobename="afii57513", + adobename="rreharabic", category="lo", description="ARABIC LETTER RREH", direction="al", @@ -15031,7 +15707,7 @@ characters.data={ unicodeslot=0x0697, }, [0x0698]={ - adobename="afii57508", + adobename="jeharabic", category="lo", description="ARABIC LETTER JEH", direction="al", @@ -15126,7 +15802,7 @@ characters.data={ unicodeslot=0x06A3, }, [0x06A4]={ - adobename="afii57505", + adobename="veharabic", category="lo", description="ARABIC LETTER VEH", direction="al", @@ -15210,7 +15886,7 @@ characters.data={ unicodeslot=0x06AE, }, [0x06AF]={ - adobename="afii57509", + adobename="gafarabic", category="lo", description="ARABIC LETTER GAF", direction="al", @@ -15296,7 +15972,7 @@ characters.data={ unicodeslot=0x06B9, }, [0x06BA]={ - adobename="afii57514", + adobename="noonghunnaarabic", category="lo", description="ARABIC LETTER NOON GHUNNA", direction="al", @@ -15351,6 +16027,7 @@ characters.data={ unicodeslot=0x06C0, }, [0x06C1]={ + adobename="hehaltonearabic", category="lo", description="ARABIC LETTER HEH GOAL", direction="al", @@ -15469,6 +16146,7 @@ characters.data={ unicodeslot=0x06D0, }, [0x06D1]={ + adobename="yehthreedotsbelowarabic", category="lo", description="ARABIC LETTER YEH WITH THREE DOTS BELOW", direction="al", @@ -15477,7 +16155,7 @@ characters.data={ unicodeslot=0x06D1, }, [0x06D2]={ - adobename="afii57519", + adobename="yehbarreearabic", category="lo", description="ARABIC LETTER YEH BARREE", direction="al", @@ -15560,9 +16238,9 @@ characters.data={ category="cf", description="ARABIC END OF AYAH", direction="an", - visible="yes", linebreak="al", unicodeslot=0x06DD, + visible="yes", }, [0x06DE]={ category="me", @@ -15693,6 +16371,7 @@ characters.data={ unicodeslot=0x06EF, }, [0x06F0]={ + adobename="zeropersian", category="nd", description="EXTENDED ARABIC-INDIC DIGIT ZERO", direction="en", @@ -15700,6 +16379,7 @@ characters.data={ unicodeslot=0x06F0, }, [0x06F1]={ + adobename="onepersian", category="nd", description="EXTENDED ARABIC-INDIC DIGIT ONE", direction="en", @@ -15707,6 +16387,7 @@ characters.data={ unicodeslot=0x06F1, }, [0x06F2]={ + adobename="twopersian", category="nd", description="EXTENDED ARABIC-INDIC DIGIT TWO", direction="en", @@ -15714,6 +16395,7 @@ characters.data={ unicodeslot=0x06F2, }, [0x06F3]={ + adobename="threepersian", category="nd", description="EXTENDED ARABIC-INDIC DIGIT THREE", direction="en", @@ -15721,6 +16403,7 @@ characters.data={ unicodeslot=0x06F3, }, [0x06F4]={ + adobename="fourpersian", category="nd", description="EXTENDED ARABIC-INDIC DIGIT FOUR", direction="en", @@ -15728,6 +16411,7 @@ characters.data={ unicodeslot=0x06F4, }, [0x06F5]={ + adobename="fivepersian", category="nd", description="EXTENDED ARABIC-INDIC DIGIT FIVE", direction="en", @@ -15735,6 +16419,7 @@ characters.data={ unicodeslot=0x06F5, }, [0x06F6]={ + adobename="sixpersian", category="nd", description="EXTENDED ARABIC-INDIC DIGIT SIX", direction="en", @@ -15742,6 +16427,7 @@ characters.data={ unicodeslot=0x06F6, }, [0x06F7]={ + adobename="sevenpersian", category="nd", description="EXTENDED ARABIC-INDIC DIGIT SEVEN", direction="en", @@ -15749,6 +16435,7 @@ characters.data={ unicodeslot=0x06F7, }, [0x06F8]={ + adobename="eightpersian", category="nd", description="EXTENDED ARABIC-INDIC DIGIT EIGHT", direction="en", @@ -15756,6 +16443,7 @@ characters.data={ unicodeslot=0x06F8, }, [0x06F9]={ + adobename="ninepersian", category="nd", description="EXTENDED ARABIC-INDIC DIGIT NINE", direction="en", @@ -15910,9 +16598,9 @@ characters.data={ category="cf", description="SYRIAC ABBREVIATION MARK", direction="bn", - visible="yes", linebreak="al", unicodeslot=0x070F, + visible="yes", }, [0x0710]={ category="lo", @@ -17352,6 +18040,7 @@ characters.data={ unicodeslot=0x07FA, }, [0x0901]={ + adobename="candrabindudeva", category="mn", description="DEVANAGARI SIGN CANDRABINDU", direction="nsm", @@ -17359,6 +18048,7 @@ characters.data={ unicodeslot=0x0901, }, [0x0902]={ + adobename="anusvaradeva", category="mn", description="DEVANAGARI SIGN ANUSVARA", direction="nsm", @@ -17366,6 +18056,7 @@ characters.data={ unicodeslot=0x0902, }, [0x0903]={ + adobename="visargadeva", category="mc", description="DEVANAGARI SIGN VISARGA", direction="l", @@ -17380,6 +18071,7 @@ characters.data={ unicodeslot=0x0904, }, [0x0905]={ + adobename="adeva", category="lo", description="DEVANAGARI LETTER A", direction="l", @@ -17387,6 +18079,7 @@ characters.data={ unicodeslot=0x0905, }, [0x0906]={ + adobename="aadeva", category="lo", description="DEVANAGARI LETTER AA", direction="l", @@ -17394,6 +18087,7 @@ characters.data={ unicodeslot=0x0906, }, [0x0907]={ + adobename="ideva", category="lo", description="DEVANAGARI LETTER I", direction="l", @@ -17401,6 +18095,7 @@ characters.data={ unicodeslot=0x0907, }, [0x0908]={ + adobename="iideva", category="lo", description="DEVANAGARI LETTER II", direction="l", @@ -17408,6 +18103,7 @@ characters.data={ unicodeslot=0x0908, }, [0x0909]={ + adobename="udeva", category="lo", description="DEVANAGARI LETTER U", direction="l", @@ -17415,6 +18111,7 @@ characters.data={ unicodeslot=0x0909, }, [0x090A]={ + adobename="uudeva", category="lo", description="DEVANAGARI LETTER UU", direction="l", @@ -17422,6 +18119,7 @@ characters.data={ unicodeslot=0x090A, }, [0x090B]={ + adobename="rvocalicdeva", category="lo", description="DEVANAGARI LETTER VOCALIC R", direction="l", @@ -17429,6 +18127,7 @@ characters.data={ unicodeslot=0x090B, }, [0x090C]={ + adobename="lvocalicdeva", category="lo", description="DEVANAGARI LETTER VOCALIC L", direction="l", @@ -17436,6 +18135,7 @@ characters.data={ unicodeslot=0x090C, }, [0x090D]={ + adobename="ecandradeva", category="lo", description="DEVANAGARI LETTER CANDRA E", direction="l", @@ -17443,6 +18143,7 @@ characters.data={ unicodeslot=0x090D, }, [0x090E]={ + adobename="eshortdeva", category="lo", description="DEVANAGARI LETTER SHORT E", direction="l", @@ -17450,6 +18151,7 @@ characters.data={ unicodeslot=0x090E, }, [0x090F]={ + adobename="edeva", category="lo", description="DEVANAGARI LETTER E", direction="l", @@ -17457,6 +18159,7 @@ characters.data={ unicodeslot=0x090F, }, [0x0910]={ + adobename="aideva", category="lo", description="DEVANAGARI LETTER AI", direction="l", @@ -17464,6 +18167,7 @@ characters.data={ unicodeslot=0x0910, }, [0x0911]={ + adobename="ocandradeva", category="lo", description="DEVANAGARI LETTER CANDRA O", direction="l", @@ -17471,6 +18175,7 @@ characters.data={ unicodeslot=0x0911, }, [0x0912]={ + adobename="oshortdeva", category="lo", description="DEVANAGARI LETTER SHORT O", direction="l", @@ -17478,6 +18183,7 @@ characters.data={ unicodeslot=0x0912, }, [0x0913]={ + adobename="odeva", category="lo", description="DEVANAGARI LETTER O", direction="l", @@ -17485,6 +18191,7 @@ characters.data={ unicodeslot=0x0913, }, [0x0914]={ + adobename="audeva", category="lo", description="DEVANAGARI LETTER AU", direction="l", @@ -17492,6 +18199,7 @@ characters.data={ unicodeslot=0x0914, }, [0x0915]={ + adobename="kadeva", category="lo", description="DEVANAGARI LETTER KA", direction="l", @@ -17499,6 +18207,7 @@ characters.data={ unicodeslot=0x0915, }, [0x0916]={ + adobename="khadeva", category="lo", description="DEVANAGARI LETTER KHA", direction="l", @@ -17506,6 +18215,7 @@ characters.data={ unicodeslot=0x0916, }, [0x0917]={ + adobename="gadeva", category="lo", description="DEVANAGARI LETTER GA", direction="l", @@ -17513,6 +18223,7 @@ characters.data={ unicodeslot=0x0917, }, [0x0918]={ + adobename="ghadeva", category="lo", description="DEVANAGARI LETTER GHA", direction="l", @@ -17520,6 +18231,7 @@ characters.data={ unicodeslot=0x0918, }, [0x0919]={ + adobename="ngadeva", category="lo", description="DEVANAGARI LETTER NGA", direction="l", @@ -17527,6 +18239,7 @@ characters.data={ unicodeslot=0x0919, }, [0x091A]={ + adobename="cadeva", category="lo", description="DEVANAGARI LETTER CA", direction="l", @@ -17534,6 +18247,7 @@ characters.data={ unicodeslot=0x091A, }, [0x091B]={ + adobename="chadeva", category="lo", description="DEVANAGARI LETTER CHA", direction="l", @@ -17541,6 +18255,7 @@ characters.data={ unicodeslot=0x091B, }, [0x091C]={ + adobename="jadeva", category="lo", description="DEVANAGARI LETTER JA", direction="l", @@ -17548,6 +18263,7 @@ characters.data={ unicodeslot=0x091C, }, [0x091D]={ + adobename="jhadeva", category="lo", description="DEVANAGARI LETTER JHA", direction="l", @@ -17555,6 +18271,7 @@ characters.data={ unicodeslot=0x091D, }, [0x091E]={ + adobename="nyadeva", category="lo", description="DEVANAGARI LETTER NYA", direction="l", @@ -17562,6 +18279,7 @@ characters.data={ unicodeslot=0x091E, }, [0x091F]={ + adobename="ttadeva", category="lo", description="DEVANAGARI LETTER TTA", direction="l", @@ -17569,6 +18287,7 @@ characters.data={ unicodeslot=0x091F, }, [0x0920]={ + adobename="tthadeva", category="lo", description="DEVANAGARI LETTER TTHA", direction="l", @@ -17576,6 +18295,7 @@ characters.data={ unicodeslot=0x0920, }, [0x0921]={ + adobename="ddadeva", category="lo", description="DEVANAGARI LETTER DDA", direction="l", @@ -17583,6 +18303,7 @@ characters.data={ unicodeslot=0x0921, }, [0x0922]={ + adobename="ddhadeva", category="lo", description="DEVANAGARI LETTER DDHA", direction="l", @@ -17590,6 +18311,7 @@ characters.data={ unicodeslot=0x0922, }, [0x0923]={ + adobename="nnadeva", category="lo", description="DEVANAGARI LETTER NNA", direction="l", @@ -17597,6 +18319,7 @@ characters.data={ unicodeslot=0x0923, }, [0x0924]={ + adobename="tadeva", category="lo", description="DEVANAGARI LETTER TA", direction="l", @@ -17604,6 +18327,7 @@ characters.data={ unicodeslot=0x0924, }, [0x0925]={ + adobename="thadeva", category="lo", description="DEVANAGARI LETTER THA", direction="l", @@ -17611,6 +18335,7 @@ characters.data={ unicodeslot=0x0925, }, [0x0926]={ + adobename="dadeva", category="lo", description="DEVANAGARI LETTER DA", direction="l", @@ -17618,6 +18343,7 @@ characters.data={ unicodeslot=0x0926, }, [0x0927]={ + adobename="dhadeva", category="lo", description="DEVANAGARI LETTER DHA", direction="l", @@ -17625,6 +18351,7 @@ characters.data={ unicodeslot=0x0927, }, [0x0928]={ + adobename="nadeva", category="lo", description="DEVANAGARI LETTER NA", direction="l", @@ -17632,6 +18359,7 @@ characters.data={ unicodeslot=0x0928, }, [0x0929]={ + adobename="nnnadeva", category="lo", description="DEVANAGARI LETTER NNNA", direction="l", @@ -17640,6 +18368,7 @@ characters.data={ unicodeslot=0x0929, }, [0x092A]={ + adobename="padeva", category="lo", description="DEVANAGARI LETTER PA", direction="l", @@ -17647,6 +18376,7 @@ characters.data={ unicodeslot=0x092A, }, [0x092B]={ + adobename="phadeva", category="lo", description="DEVANAGARI LETTER PHA", direction="l", @@ -17654,6 +18384,7 @@ characters.data={ unicodeslot=0x092B, }, [0x092C]={ + adobename="badeva", category="lo", description="DEVANAGARI LETTER BA", direction="l", @@ -17661,6 +18392,7 @@ characters.data={ unicodeslot=0x092C, }, [0x092D]={ + adobename="bhadeva", category="lo", description="DEVANAGARI LETTER BHA", direction="l", @@ -17668,6 +18400,7 @@ characters.data={ unicodeslot=0x092D, }, [0x092E]={ + adobename="madeva", category="lo", description="DEVANAGARI LETTER MA", direction="l", @@ -17675,6 +18408,7 @@ characters.data={ unicodeslot=0x092E, }, [0x092F]={ + adobename="yadeva", category="lo", description="DEVANAGARI LETTER YA", direction="l", @@ -17682,6 +18416,7 @@ characters.data={ unicodeslot=0x092F, }, [0x0930]={ + adobename="radeva", category="lo", description="DEVANAGARI LETTER RA", direction="l", @@ -17689,6 +18424,7 @@ characters.data={ unicodeslot=0x0930, }, [0x0931]={ + adobename="rradeva", category="lo", description="DEVANAGARI LETTER RRA", direction="l", @@ -17697,6 +18433,7 @@ characters.data={ unicodeslot=0x0931, }, [0x0932]={ + adobename="ladeva", category="lo", description="DEVANAGARI LETTER LA", direction="l", @@ -17704,6 +18441,7 @@ characters.data={ unicodeslot=0x0932, }, [0x0933]={ + adobename="lladeva", category="lo", description="DEVANAGARI LETTER LLA", direction="l", @@ -17711,6 +18449,7 @@ characters.data={ unicodeslot=0x0933, }, [0x0934]={ + adobename="llladeva", category="lo", description="DEVANAGARI LETTER LLLA", direction="l", @@ -17719,6 +18458,7 @@ characters.data={ unicodeslot=0x0934, }, [0x0935]={ + adobename="vadeva", category="lo", description="DEVANAGARI LETTER VA", direction="l", @@ -17726,6 +18466,7 @@ characters.data={ unicodeslot=0x0935, }, [0x0936]={ + adobename="shadeva", category="lo", description="DEVANAGARI LETTER SHA", direction="l", @@ -17733,6 +18474,7 @@ characters.data={ unicodeslot=0x0936, }, [0x0937]={ + adobename="ssadeva", category="lo", description="DEVANAGARI LETTER SSA", direction="l", @@ -17740,6 +18482,7 @@ characters.data={ unicodeslot=0x0937, }, [0x0938]={ + adobename="sadeva", category="lo", description="DEVANAGARI LETTER SA", direction="l", @@ -17747,6 +18490,7 @@ characters.data={ unicodeslot=0x0938, }, [0x0939]={ + adobename="hadeva", category="lo", description="DEVANAGARI LETTER HA", direction="l", @@ -17754,6 +18498,7 @@ characters.data={ unicodeslot=0x0939, }, [0x093C]={ + adobename="nuktadeva", category="mn", description="DEVANAGARI SIGN NUKTA", direction="nsm", @@ -17761,6 +18506,7 @@ characters.data={ unicodeslot=0x093C, }, [0x093D]={ + adobename="avagrahadeva", category="lo", description="DEVANAGARI SIGN AVAGRAHA", direction="l", @@ -17768,6 +18514,7 @@ characters.data={ unicodeslot=0x093D, }, [0x093E]={ + adobename="aavowelsigndeva", category="mc", description="DEVANAGARI VOWEL SIGN AA", direction="l", @@ -17775,6 +18522,7 @@ characters.data={ unicodeslot=0x093E, }, [0x093F]={ + adobename="ivowelsigndeva", category="mc", description="DEVANAGARI VOWEL SIGN I", direction="l", @@ -17782,6 +18530,7 @@ characters.data={ unicodeslot=0x093F, }, [0x0940]={ + adobename="iivowelsigndeva", category="mc", description="DEVANAGARI VOWEL SIGN II", direction="l", @@ -17789,6 +18538,7 @@ characters.data={ unicodeslot=0x0940, }, [0x0941]={ + adobename="uvowelsigndeva", category="mn", description="DEVANAGARI VOWEL SIGN U", direction="nsm", @@ -17796,6 +18546,7 @@ characters.data={ unicodeslot=0x0941, }, [0x0942]={ + adobename="uuvowelsigndeva", category="mn", description="DEVANAGARI VOWEL SIGN UU", direction="nsm", @@ -17803,6 +18554,7 @@ characters.data={ unicodeslot=0x0942, }, [0x0943]={ + adobename="rvocalicvowelsigndeva", category="mn", description="DEVANAGARI VOWEL SIGN VOCALIC R", direction="nsm", @@ -17810,6 +18562,7 @@ characters.data={ unicodeslot=0x0943, }, [0x0944]={ + adobename="rrvocalicvowelsigndeva", category="mn", description="DEVANAGARI VOWEL SIGN VOCALIC RR", direction="nsm", @@ -17817,6 +18570,7 @@ characters.data={ unicodeslot=0x0944, }, [0x0945]={ + adobename="ecandravowelsigndeva", category="mn", description="DEVANAGARI VOWEL SIGN CANDRA E", direction="nsm", @@ -17824,6 +18578,7 @@ characters.data={ unicodeslot=0x0945, }, [0x0946]={ + adobename="eshortvowelsigndeva", category="mn", description="DEVANAGARI VOWEL SIGN SHORT E", direction="nsm", @@ -17831,6 +18586,7 @@ characters.data={ unicodeslot=0x0946, }, [0x0947]={ + adobename="evowelsigndeva", category="mn", description="DEVANAGARI VOWEL SIGN E", direction="nsm", @@ -17838,6 +18594,7 @@ characters.data={ unicodeslot=0x0947, }, [0x0948]={ + adobename="aivowelsigndeva", category="mn", description="DEVANAGARI VOWEL SIGN AI", direction="nsm", @@ -17845,6 +18602,7 @@ characters.data={ unicodeslot=0x0948, }, [0x0949]={ + adobename="ocandravowelsigndeva", category="mc", description="DEVANAGARI VOWEL SIGN CANDRA O", direction="l", @@ -17852,6 +18610,7 @@ characters.data={ unicodeslot=0x0949, }, [0x094A]={ + adobename="oshortvowelsigndeva", category="mc", description="DEVANAGARI VOWEL SIGN SHORT O", direction="l", @@ -17859,6 +18618,7 @@ characters.data={ unicodeslot=0x094A, }, [0x094B]={ + adobename="ovowelsigndeva", category="mc", description="DEVANAGARI VOWEL SIGN O", direction="l", @@ -17866,6 +18626,7 @@ characters.data={ unicodeslot=0x094B, }, [0x094C]={ + adobename="auvowelsigndeva", category="mc", description="DEVANAGARI VOWEL SIGN AU", direction="l", @@ -17873,6 +18634,7 @@ characters.data={ unicodeslot=0x094C, }, [0x094D]={ + adobename="viramadeva", category="mn", description="DEVANAGARI SIGN VIRAMA", direction="nsm", @@ -17880,6 +18642,7 @@ characters.data={ unicodeslot=0x094D, }, [0x0950]={ + adobename="omdeva", category="lo", description="DEVANAGARI OM", direction="l", @@ -17887,6 +18650,7 @@ characters.data={ unicodeslot=0x0950, }, [0x0951]={ + adobename="udattadeva", category="mn", description="DEVANAGARI STRESS SIGN UDATTA", direction="nsm", @@ -17894,6 +18658,7 @@ characters.data={ unicodeslot=0x0951, }, [0x0952]={ + adobename="anudattadeva", category="mn", description="DEVANAGARI STRESS SIGN ANUDATTA", direction="nsm", @@ -17901,6 +18666,7 @@ characters.data={ unicodeslot=0x0952, }, [0x0953]={ + adobename="gravedeva", category="mn", description="DEVANAGARI GRAVE ACCENT", direction="nsm", @@ -17908,6 +18674,7 @@ characters.data={ unicodeslot=0x0953, }, [0x0954]={ + adobename="acutedeva", category="mn", description="DEVANAGARI ACUTE ACCENT", direction="nsm", @@ -17915,6 +18682,7 @@ characters.data={ unicodeslot=0x0954, }, [0x0958]={ + adobename="qadeva", category="lo", description="DEVANAGARI LETTER QA", direction="l", @@ -17923,6 +18691,7 @@ characters.data={ unicodeslot=0x0958, }, [0x0959]={ + adobename="khhadeva", category="lo", description="DEVANAGARI LETTER KHHA", direction="l", @@ -17931,6 +18700,7 @@ characters.data={ unicodeslot=0x0959, }, [0x095A]={ + adobename="ghhadeva", category="lo", description="DEVANAGARI LETTER GHHA", direction="l", @@ -17939,6 +18709,7 @@ characters.data={ unicodeslot=0x095A, }, [0x095B]={ + adobename="zadeva", category="lo", description="DEVANAGARI LETTER ZA", direction="l", @@ -17947,6 +18718,7 @@ characters.data={ unicodeslot=0x095B, }, [0x095C]={ + adobename="dddhadeva", category="lo", description="DEVANAGARI LETTER DDDHA", direction="l", @@ -17955,6 +18727,7 @@ characters.data={ unicodeslot=0x095C, }, [0x095D]={ + adobename="rhadeva", category="lo", description="DEVANAGARI LETTER RHA", direction="l", @@ -17963,6 +18736,7 @@ characters.data={ unicodeslot=0x095D, }, [0x095E]={ + adobename="fadeva", category="lo", description="DEVANAGARI LETTER FA", direction="l", @@ -17971,6 +18745,7 @@ characters.data={ unicodeslot=0x095E, }, [0x095F]={ + adobename="yyadeva", category="lo", description="DEVANAGARI LETTER YYA", direction="l", @@ -17979,6 +18754,7 @@ characters.data={ unicodeslot=0x095F, }, [0x0960]={ + adobename="rrvocalicdeva", category="lo", description="DEVANAGARI LETTER VOCALIC RR", direction="l", @@ -17986,6 +18762,7 @@ characters.data={ unicodeslot=0x0960, }, [0x0961]={ + adobename="llvocalicdeva", category="lo", description="DEVANAGARI LETTER VOCALIC LL", direction="l", @@ -17993,6 +18770,7 @@ characters.data={ unicodeslot=0x0961, }, [0x0962]={ + adobename="lvocalicvowelsigndeva", category="mn", description="DEVANAGARI VOWEL SIGN VOCALIC L", direction="nsm", @@ -18000,6 +18778,7 @@ characters.data={ unicodeslot=0x0962, }, [0x0963]={ + adobename="llvocalicvowelsigndeva", category="mn", description="DEVANAGARI VOWEL SIGN VOCALIC LL", direction="nsm", @@ -18007,6 +18786,7 @@ characters.data={ unicodeslot=0x0963, }, [0x0964]={ + adobename="danda", category="po", description="DEVANAGARI DANDA", direction="l", @@ -18014,6 +18794,7 @@ characters.data={ unicodeslot=0x0964, }, [0x0965]={ + adobename="dbldanda", category="po", description="DEVANAGARI DOUBLE DANDA", direction="l", @@ -18021,6 +18802,7 @@ characters.data={ unicodeslot=0x0965, }, [0x0966]={ + adobename="zerodeva", category="nd", description="DEVANAGARI DIGIT ZERO", direction="l", @@ -18028,6 +18810,7 @@ characters.data={ unicodeslot=0x0966, }, [0x0967]={ + adobename="onedeva", category="nd", description="DEVANAGARI DIGIT ONE", direction="l", @@ -18035,6 +18818,7 @@ characters.data={ unicodeslot=0x0967, }, [0x0968]={ + adobename="twodeva", category="nd", description="DEVANAGARI DIGIT TWO", direction="l", @@ -18042,6 +18826,7 @@ characters.data={ unicodeslot=0x0968, }, [0x0969]={ + adobename="threedeva", category="nd", description="DEVANAGARI DIGIT THREE", direction="l", @@ -18049,6 +18834,7 @@ characters.data={ unicodeslot=0x0969, }, [0x096A]={ + adobename="fourdeva", category="nd", description="DEVANAGARI DIGIT FOUR", direction="l", @@ -18056,6 +18842,7 @@ characters.data={ unicodeslot=0x096A, }, [0x096B]={ + adobename="fivedeva", category="nd", description="DEVANAGARI DIGIT FIVE", direction="l", @@ -18063,6 +18850,7 @@ characters.data={ unicodeslot=0x096B, }, [0x096C]={ + adobename="sixdeva", category="nd", description="DEVANAGARI DIGIT SIX", direction="l", @@ -18070,6 +18858,7 @@ characters.data={ unicodeslot=0x096C, }, [0x096D]={ + adobename="sevendeva", category="nd", description="DEVANAGARI DIGIT SEVEN", direction="l", @@ -18077,6 +18866,7 @@ characters.data={ unicodeslot=0x096D, }, [0x096E]={ + adobename="eightdeva", category="nd", description="DEVANAGARI DIGIT EIGHT", direction="l", @@ -18084,6 +18874,7 @@ characters.data={ unicodeslot=0x096E, }, [0x096F]={ + adobename="ninedeva", category="nd", description="DEVANAGARI DIGIT NINE", direction="l", @@ -18091,6 +18882,7 @@ characters.data={ unicodeslot=0x096F, }, [0x0970]={ + adobename="abbreviationsigndeva", category="po", description="DEVANAGARI ABBREVIATION SIGN", direction="l", @@ -18133,6 +18925,7 @@ characters.data={ unicodeslot=0x097F, }, [0x0981]={ + adobename="candrabindubengali", category="mn", description="BENGALI SIGN CANDRABINDU", direction="nsm", @@ -18140,6 +18933,7 @@ characters.data={ unicodeslot=0x0981, }, [0x0982]={ + adobename="anusvarabengali", category="mc", description="BENGALI SIGN ANUSVARA", direction="l", @@ -18147,6 +18941,7 @@ characters.data={ unicodeslot=0x0982, }, [0x0983]={ + adobename="visargabengali", category="mc", description="BENGALI SIGN VISARGA", direction="l", @@ -18154,6 +18949,7 @@ characters.data={ unicodeslot=0x0983, }, [0x0985]={ + adobename="abengali", category="lo", description="BENGALI LETTER A", direction="l", @@ -18161,6 +18957,7 @@ characters.data={ unicodeslot=0x0985, }, [0x0986]={ + adobename="aabengali", category="lo", description="BENGALI LETTER AA", direction="l", @@ -18168,6 +18965,7 @@ characters.data={ unicodeslot=0x0986, }, [0x0987]={ + adobename="ibengali", category="lo", description="BENGALI LETTER I", direction="l", @@ -18175,6 +18973,7 @@ characters.data={ unicodeslot=0x0987, }, [0x0988]={ + adobename="iibengali", category="lo", description="BENGALI LETTER II", direction="l", @@ -18182,6 +18981,7 @@ characters.data={ unicodeslot=0x0988, }, [0x0989]={ + adobename="ubengali", category="lo", description="BENGALI LETTER U", direction="l", @@ -18189,6 +18989,7 @@ characters.data={ unicodeslot=0x0989, }, [0x098A]={ + adobename="uubengali", category="lo", description="BENGALI LETTER UU", direction="l", @@ -18196,6 +18997,7 @@ characters.data={ unicodeslot=0x098A, }, [0x098B]={ + adobename="rvocalicbengali", category="lo", description="BENGALI LETTER VOCALIC R", direction="l", @@ -18203,6 +19005,7 @@ characters.data={ unicodeslot=0x098B, }, [0x098C]={ + adobename="lvocalicbengali", category="lo", description="BENGALI LETTER VOCALIC L", direction="l", @@ -18210,6 +19013,7 @@ characters.data={ unicodeslot=0x098C, }, [0x098F]={ + adobename="ebengali", category="lo", description="BENGALI LETTER E", direction="l", @@ -18217,6 +19021,7 @@ characters.data={ unicodeslot=0x098F, }, [0x0990]={ + adobename="aibengali", category="lo", description="BENGALI LETTER AI", direction="l", @@ -18224,6 +19029,7 @@ characters.data={ unicodeslot=0x0990, }, [0x0993]={ + adobename="obengali", category="lo", description="BENGALI LETTER O", direction="l", @@ -18231,6 +19037,7 @@ characters.data={ unicodeslot=0x0993, }, [0x0994]={ + adobename="aubengali", category="lo", description="BENGALI LETTER AU", direction="l", @@ -18238,6 +19045,7 @@ characters.data={ unicodeslot=0x0994, }, [0x0995]={ + adobename="kabengali", category="lo", description="BENGALI LETTER KA", direction="l", @@ -18245,6 +19053,7 @@ characters.data={ unicodeslot=0x0995, }, [0x0996]={ + adobename="khabengali", category="lo", description="BENGALI LETTER KHA", direction="l", @@ -18252,6 +19061,7 @@ characters.data={ unicodeslot=0x0996, }, [0x0997]={ + adobename="gabengali", category="lo", description="BENGALI LETTER GA", direction="l", @@ -18259,6 +19069,7 @@ characters.data={ unicodeslot=0x0997, }, [0x0998]={ + adobename="ghabengali", category="lo", description="BENGALI LETTER GHA", direction="l", @@ -18266,6 +19077,7 @@ characters.data={ unicodeslot=0x0998, }, [0x0999]={ + adobename="ngabengali", category="lo", description="BENGALI LETTER NGA", direction="l", @@ -18273,6 +19085,7 @@ characters.data={ unicodeslot=0x0999, }, [0x099A]={ + adobename="cabengali", category="lo", description="BENGALI LETTER CA", direction="l", @@ -18280,6 +19093,7 @@ characters.data={ unicodeslot=0x099A, }, [0x099B]={ + adobename="chabengali", category="lo", description="BENGALI LETTER CHA", direction="l", @@ -18287,6 +19101,7 @@ characters.data={ unicodeslot=0x099B, }, [0x099C]={ + adobename="jabengali", category="lo", description="BENGALI LETTER JA", direction="l", @@ -18294,6 +19109,7 @@ characters.data={ unicodeslot=0x099C, }, [0x099D]={ + adobename="jhabengali", category="lo", description="BENGALI LETTER JHA", direction="l", @@ -18301,6 +19117,7 @@ characters.data={ unicodeslot=0x099D, }, [0x099E]={ + adobename="nyabengali", category="lo", description="BENGALI LETTER NYA", direction="l", @@ -18308,6 +19125,7 @@ characters.data={ unicodeslot=0x099E, }, [0x099F]={ + adobename="ttabengali", category="lo", description="BENGALI LETTER TTA", direction="l", @@ -18315,6 +19133,7 @@ characters.data={ unicodeslot=0x099F, }, [0x09A0]={ + adobename="tthabengali", category="lo", description="BENGALI LETTER TTHA", direction="l", @@ -18322,6 +19141,7 @@ characters.data={ unicodeslot=0x09A0, }, [0x09A1]={ + adobename="ddabengali", category="lo", description="BENGALI LETTER DDA", direction="l", @@ -18329,6 +19149,7 @@ characters.data={ unicodeslot=0x09A1, }, [0x09A2]={ + adobename="ddhabengali", category="lo", description="BENGALI LETTER DDHA", direction="l", @@ -18336,6 +19157,7 @@ characters.data={ unicodeslot=0x09A2, }, [0x09A3]={ + adobename="nnabengali", category="lo", description="BENGALI LETTER NNA", direction="l", @@ -18343,6 +19165,7 @@ characters.data={ unicodeslot=0x09A3, }, [0x09A4]={ + adobename="tabengali", category="lo", description="BENGALI LETTER TA", direction="l", @@ -18350,6 +19173,7 @@ characters.data={ unicodeslot=0x09A4, }, [0x09A5]={ + adobename="thabengali", category="lo", description="BENGALI LETTER THA", direction="l", @@ -18357,6 +19181,7 @@ characters.data={ unicodeslot=0x09A5, }, [0x09A6]={ + adobename="dabengali", category="lo", description="BENGALI LETTER DA", direction="l", @@ -18364,6 +19189,7 @@ characters.data={ unicodeslot=0x09A6, }, [0x09A7]={ + adobename="dhabengali", category="lo", description="BENGALI LETTER DHA", direction="l", @@ -18371,6 +19197,7 @@ characters.data={ unicodeslot=0x09A7, }, [0x09A8]={ + adobename="nabengali", category="lo", description="BENGALI LETTER NA", direction="l", @@ -18378,6 +19205,7 @@ characters.data={ unicodeslot=0x09A8, }, [0x09AA]={ + adobename="pabengali", category="lo", description="BENGALI LETTER PA", direction="l", @@ -18385,6 +19213,7 @@ characters.data={ unicodeslot=0x09AA, }, [0x09AB]={ + adobename="phabengali", category="lo", description="BENGALI LETTER PHA", direction="l", @@ -18392,6 +19221,7 @@ characters.data={ unicodeslot=0x09AB, }, [0x09AC]={ + adobename="babengali", category="lo", description="BENGALI LETTER BA", direction="l", @@ -18399,6 +19229,7 @@ characters.data={ unicodeslot=0x09AC, }, [0x09AD]={ + adobename="bhabengali", category="lo", description="BENGALI LETTER BHA", direction="l", @@ -18406,6 +19237,7 @@ characters.data={ unicodeslot=0x09AD, }, [0x09AE]={ + adobename="mabengali", category="lo", description="BENGALI LETTER MA", direction="l", @@ -18413,6 +19245,7 @@ characters.data={ unicodeslot=0x09AE, }, [0x09AF]={ + adobename="yabengali", category="lo", description="BENGALI LETTER YA", direction="l", @@ -18420,6 +19253,7 @@ characters.data={ unicodeslot=0x09AF, }, [0x09B0]={ + adobename="rabengali", category="lo", description="BENGALI LETTER RA", direction="l", @@ -18427,6 +19261,7 @@ characters.data={ unicodeslot=0x09B0, }, [0x09B2]={ + adobename="labengali", category="lo", description="BENGALI LETTER LA", direction="l", @@ -18434,6 +19269,7 @@ characters.data={ unicodeslot=0x09B2, }, [0x09B6]={ + adobename="shabengali", category="lo", description="BENGALI LETTER SHA", direction="l", @@ -18441,6 +19277,7 @@ characters.data={ unicodeslot=0x09B6, }, [0x09B7]={ + adobename="ssabengali", category="lo", description="BENGALI LETTER SSA", direction="l", @@ -18448,6 +19285,7 @@ characters.data={ unicodeslot=0x09B7, }, [0x09B8]={ + adobename="sabengali", category="lo", description="BENGALI LETTER SA", direction="l", @@ -18455,6 +19293,7 @@ characters.data={ unicodeslot=0x09B8, }, [0x09B9]={ + adobename="habengali", category="lo", description="BENGALI LETTER HA", direction="l", @@ -18462,6 +19301,7 @@ characters.data={ unicodeslot=0x09B9, }, [0x09BC]={ + adobename="nuktabengali", category="mn", description="BENGALI SIGN NUKTA", direction="nsm", @@ -18476,6 +19316,7 @@ characters.data={ unicodeslot=0x09BD, }, [0x09BE]={ + adobename="aavowelsignbengali", category="mc", description="BENGALI VOWEL SIGN AA", direction="l", @@ -18483,6 +19324,7 @@ characters.data={ unicodeslot=0x09BE, }, [0x09BF]={ + adobename="ivowelsignbengali", category="mc", description="BENGALI VOWEL SIGN I", direction="l", @@ -18490,6 +19332,7 @@ characters.data={ unicodeslot=0x09BF, }, [0x09C0]={ + adobename="iivowelsignbengali", category="mc", description="BENGALI VOWEL SIGN II", direction="l", @@ -18497,6 +19340,7 @@ characters.data={ unicodeslot=0x09C0, }, [0x09C1]={ + adobename="uvowelsignbengali", category="mn", description="BENGALI VOWEL SIGN U", direction="nsm", @@ -18504,6 +19348,7 @@ characters.data={ unicodeslot=0x09C1, }, [0x09C2]={ + adobename="uuvowelsignbengali", category="mn", description="BENGALI VOWEL SIGN UU", direction="nsm", @@ -18511,6 +19356,7 @@ characters.data={ unicodeslot=0x09C2, }, [0x09C3]={ + adobename="rvocalicvowelsignbengali", category="mn", description="BENGALI VOWEL SIGN VOCALIC R", direction="nsm", @@ -18518,6 +19364,7 @@ characters.data={ unicodeslot=0x09C3, }, [0x09C4]={ + adobename="rrvocalicvowelsignbengali", category="mn", description="BENGALI VOWEL SIGN VOCALIC RR", direction="nsm", @@ -18525,6 +19372,7 @@ characters.data={ unicodeslot=0x09C4, }, [0x09C7]={ + adobename="evowelsignbengali", category="mc", description="BENGALI VOWEL SIGN E", direction="l", @@ -18532,6 +19380,7 @@ characters.data={ unicodeslot=0x09C7, }, [0x09C8]={ + adobename="aivowelsignbengali", category="mc", description="BENGALI VOWEL SIGN AI", direction="l", @@ -18539,6 +19388,7 @@ characters.data={ unicodeslot=0x09C8, }, [0x09CB]={ + adobename="ovowelsignbengali", category="mc", description="BENGALI VOWEL SIGN O", direction="l", @@ -18547,6 +19397,7 @@ characters.data={ unicodeslot=0x09CB, }, [0x09CC]={ + adobename="auvowelsignbengali", category="mc", description="BENGALI VOWEL SIGN AU", direction="l", @@ -18555,6 +19406,7 @@ characters.data={ unicodeslot=0x09CC, }, [0x09CD]={ + adobename="viramabengali", category="mn", description="BENGALI SIGN VIRAMA", direction="nsm", @@ -18569,6 +19421,7 @@ characters.data={ unicodeslot=0x09CE, }, [0x09D7]={ + adobename="aulengthmarkbengali", category="mc", description="BENGALI AU LENGTH MARK", direction="l", @@ -18576,6 +19429,7 @@ characters.data={ unicodeslot=0x09D7, }, [0x09DC]={ + adobename="rrabengali", category="lo", description="BENGALI LETTER RRA", direction="l", @@ -18584,6 +19438,7 @@ characters.data={ unicodeslot=0x09DC, }, [0x09DD]={ + adobename="rhabengali", category="lo", description="BENGALI LETTER RHA", direction="l", @@ -18592,6 +19447,7 @@ characters.data={ unicodeslot=0x09DD, }, [0x09DF]={ + adobename="yyabengali", category="lo", description="BENGALI LETTER YYA", direction="l", @@ -18600,6 +19456,7 @@ characters.data={ unicodeslot=0x09DF, }, [0x09E0]={ + adobename="rrvocalicbengali", category="lo", description="BENGALI LETTER VOCALIC RR", direction="l", @@ -18607,6 +19464,7 @@ characters.data={ unicodeslot=0x09E0, }, [0x09E1]={ + adobename="llvocalicbengali", category="lo", description="BENGALI LETTER VOCALIC LL", direction="l", @@ -18614,6 +19472,7 @@ characters.data={ unicodeslot=0x09E1, }, [0x09E2]={ + adobename="lvocalicvowelsignbengali", category="mn", description="BENGALI VOWEL SIGN VOCALIC L", direction="nsm", @@ -18621,6 +19480,7 @@ characters.data={ unicodeslot=0x09E2, }, [0x09E3]={ + adobename="llvocalicvowelsignbengali", category="mn", description="BENGALI VOWEL SIGN VOCALIC LL", direction="nsm", @@ -18628,6 +19488,7 @@ characters.data={ unicodeslot=0x09E3, }, [0x09E6]={ + adobename="zerobengali", category="nd", description="BENGALI DIGIT ZERO", direction="l", @@ -18635,6 +19496,7 @@ characters.data={ unicodeslot=0x09E6, }, [0x09E7]={ + adobename="onebengali", category="nd", description="BENGALI DIGIT ONE", direction="l", @@ -18642,6 +19504,7 @@ characters.data={ unicodeslot=0x09E7, }, [0x09E8]={ + adobename="twobengali", category="nd", description="BENGALI DIGIT TWO", direction="l", @@ -18649,6 +19512,7 @@ characters.data={ unicodeslot=0x09E8, }, [0x09E9]={ + adobename="threebengali", category="nd", description="BENGALI DIGIT THREE", direction="l", @@ -18656,6 +19520,7 @@ characters.data={ unicodeslot=0x09E9, }, [0x09EA]={ + adobename="fourbengali", category="nd", description="BENGALI DIGIT FOUR", direction="l", @@ -18663,6 +19528,7 @@ characters.data={ unicodeslot=0x09EA, }, [0x09EB]={ + adobename="fivebengali", category="nd", description="BENGALI DIGIT FIVE", direction="l", @@ -18670,6 +19536,7 @@ characters.data={ unicodeslot=0x09EB, }, [0x09EC]={ + adobename="sixbengali", category="nd", description="BENGALI DIGIT SIX", direction="l", @@ -18677,6 +19544,7 @@ characters.data={ unicodeslot=0x09EC, }, [0x09ED]={ + adobename="sevenbengali", category="nd", description="BENGALI DIGIT SEVEN", direction="l", @@ -18684,6 +19552,7 @@ characters.data={ unicodeslot=0x09ED, }, [0x09EE]={ + adobename="eightbengali", category="nd", description="BENGALI DIGIT EIGHT", direction="l", @@ -18691,6 +19560,7 @@ characters.data={ unicodeslot=0x09EE, }, [0x09EF]={ + adobename="ninebengali", category="nd", description="BENGALI DIGIT NINE", direction="l", @@ -18698,6 +19568,7 @@ characters.data={ unicodeslot=0x09EF, }, [0x09F0]={ + adobename="ramiddlediagonalbengali", category="lo", description="BENGALI LETTER RA WITH MIDDLE DIAGONAL", direction="l", @@ -18706,6 +19577,7 @@ characters.data={ unicodeslot=0x09F0, }, [0x09F1]={ + adobename="ralowerdiagonalbengali", category="lo", description="BENGALI LETTER RA WITH LOWER DIAGONAL", direction="l", @@ -18714,6 +19586,7 @@ characters.data={ unicodeslot=0x09F1, }, [0x09F2]={ + adobename="rupeemarkbengali", category="sc", description="BENGALI RUPEE MARK", direction="et", @@ -18721,6 +19594,7 @@ characters.data={ unicodeslot=0x09F2, }, [0x09F3]={ + adobename="rupeesignbengali", category="sc", description="BENGALI RUPEE SIGN", direction="et", @@ -18728,6 +19602,7 @@ characters.data={ unicodeslot=0x09F3, }, [0x09F4]={ + adobename="onenumeratorbengali", category="no", description="BENGALI CURRENCY NUMERATOR ONE", direction="l", @@ -18735,6 +19610,7 @@ characters.data={ unicodeslot=0x09F4, }, [0x09F5]={ + adobename="twonumeratorbengali", category="no", description="BENGALI CURRENCY NUMERATOR TWO", direction="l", @@ -18742,6 +19618,7 @@ characters.data={ unicodeslot=0x09F5, }, [0x09F6]={ + adobename="threenumeratorbengali", category="no", description="BENGALI CURRENCY NUMERATOR THREE", direction="l", @@ -18749,6 +19626,7 @@ characters.data={ unicodeslot=0x09F6, }, [0x09F7]={ + adobename="fournumeratorbengali", category="no", description="BENGALI CURRENCY NUMERATOR FOUR", direction="l", @@ -18756,6 +19634,7 @@ characters.data={ unicodeslot=0x09F7, }, [0x09F8]={ + adobename="denominatorminusonenumeratorbengali", category="no", description="BENGALI CURRENCY NUMERATOR ONE LESS THAN THE DENOMINATOR", direction="l", @@ -18763,6 +19642,7 @@ characters.data={ unicodeslot=0x09F8, }, [0x09F9]={ + adobename="sixteencurrencydenominatorbengali", category="no", description="BENGALI CURRENCY DENOMINATOR SIXTEEN", direction="l", @@ -18770,6 +19650,7 @@ characters.data={ unicodeslot=0x09F9, }, [0x09FA]={ + adobename="issharbengali", category="so", description="BENGALI ISSHAR", direction="l", @@ -18784,6 +19665,7 @@ characters.data={ unicodeslot=0x0A01, }, [0x0A02]={ + adobename="bindigurmukhi", category="mn", description="GURMUKHI SIGN BINDI", direction="nsm", @@ -18798,6 +19680,7 @@ characters.data={ unicodeslot=0x0A03, }, [0x0A05]={ + adobename="agurmukhi", category="lo", description="GURMUKHI LETTER A", direction="l", @@ -18805,6 +19688,7 @@ characters.data={ unicodeslot=0x0A05, }, [0x0A06]={ + adobename="aagurmukhi", category="lo", description="GURMUKHI LETTER AA", direction="l", @@ -18812,6 +19696,7 @@ characters.data={ unicodeslot=0x0A06, }, [0x0A07]={ + adobename="igurmukhi", category="lo", description="GURMUKHI LETTER I", direction="l", @@ -18819,6 +19704,7 @@ characters.data={ unicodeslot=0x0A07, }, [0x0A08]={ + adobename="iigurmukhi", category="lo", description="GURMUKHI LETTER II", direction="l", @@ -18826,6 +19712,7 @@ characters.data={ unicodeslot=0x0A08, }, [0x0A09]={ + adobename="ugurmukhi", category="lo", description="GURMUKHI LETTER U", direction="l", @@ -18833,6 +19720,7 @@ characters.data={ unicodeslot=0x0A09, }, [0x0A0A]={ + adobename="uugurmukhi", category="lo", description="GURMUKHI LETTER UU", direction="l", @@ -18840,6 +19728,7 @@ characters.data={ unicodeslot=0x0A0A, }, [0x0A0F]={ + adobename="eegurmukhi", category="lo", description="GURMUKHI LETTER EE", direction="l", @@ -18847,6 +19736,7 @@ characters.data={ unicodeslot=0x0A0F, }, [0x0A10]={ + adobename="aigurmukhi", category="lo", description="GURMUKHI LETTER AI", direction="l", @@ -18854,6 +19744,7 @@ characters.data={ unicodeslot=0x0A10, }, [0x0A13]={ + adobename="oogurmukhi", category="lo", description="GURMUKHI LETTER OO", direction="l", @@ -18861,6 +19752,7 @@ characters.data={ unicodeslot=0x0A13, }, [0x0A14]={ + adobename="augurmukhi", category="lo", description="GURMUKHI LETTER AU", direction="l", @@ -18868,6 +19760,7 @@ characters.data={ unicodeslot=0x0A14, }, [0x0A15]={ + adobename="kagurmukhi", category="lo", description="GURMUKHI LETTER KA", direction="l", @@ -18875,6 +19768,7 @@ characters.data={ unicodeslot=0x0A15, }, [0x0A16]={ + adobename="khagurmukhi", category="lo", description="GURMUKHI LETTER KHA", direction="l", @@ -18882,6 +19776,7 @@ characters.data={ unicodeslot=0x0A16, }, [0x0A17]={ + adobename="gagurmukhi", category="lo", description="GURMUKHI LETTER GA", direction="l", @@ -18889,6 +19784,7 @@ characters.data={ unicodeslot=0x0A17, }, [0x0A18]={ + adobename="ghagurmukhi", category="lo", description="GURMUKHI LETTER GHA", direction="l", @@ -18896,6 +19792,7 @@ characters.data={ unicodeslot=0x0A18, }, [0x0A19]={ + adobename="ngagurmukhi", category="lo", description="GURMUKHI LETTER NGA", direction="l", @@ -18903,6 +19800,7 @@ characters.data={ unicodeslot=0x0A19, }, [0x0A1A]={ + adobename="cagurmukhi", category="lo", description="GURMUKHI LETTER CA", direction="l", @@ -18910,6 +19808,7 @@ characters.data={ unicodeslot=0x0A1A, }, [0x0A1B]={ + adobename="chagurmukhi", category="lo", description="GURMUKHI LETTER CHA", direction="l", @@ -18917,6 +19816,7 @@ characters.data={ unicodeslot=0x0A1B, }, [0x0A1C]={ + adobename="jagurmukhi", category="lo", description="GURMUKHI LETTER JA", direction="l", @@ -18924,6 +19824,7 @@ characters.data={ unicodeslot=0x0A1C, }, [0x0A1D]={ + adobename="jhagurmukhi", category="lo", description="GURMUKHI LETTER JHA", direction="l", @@ -18931,6 +19832,7 @@ characters.data={ unicodeslot=0x0A1D, }, [0x0A1E]={ + adobename="nyagurmukhi", category="lo", description="GURMUKHI LETTER NYA", direction="l", @@ -18938,6 +19840,7 @@ characters.data={ unicodeslot=0x0A1E, }, [0x0A1F]={ + adobename="ttagurmukhi", category="lo", description="GURMUKHI LETTER TTA", direction="l", @@ -18945,6 +19848,7 @@ characters.data={ unicodeslot=0x0A1F, }, [0x0A20]={ + adobename="tthagurmukhi", category="lo", description="GURMUKHI LETTER TTHA", direction="l", @@ -18952,6 +19856,7 @@ characters.data={ unicodeslot=0x0A20, }, [0x0A21]={ + adobename="ddagurmukhi", category="lo", description="GURMUKHI LETTER DDA", direction="l", @@ -18959,6 +19864,7 @@ characters.data={ unicodeslot=0x0A21, }, [0x0A22]={ + adobename="ddhagurmukhi", category="lo", description="GURMUKHI LETTER DDHA", direction="l", @@ -18966,6 +19872,7 @@ characters.data={ unicodeslot=0x0A22, }, [0x0A23]={ + adobename="nnagurmukhi", category="lo", description="GURMUKHI LETTER NNA", direction="l", @@ -18973,6 +19880,7 @@ characters.data={ unicodeslot=0x0A23, }, [0x0A24]={ + adobename="tagurmukhi", category="lo", description="GURMUKHI LETTER TA", direction="l", @@ -18980,6 +19888,7 @@ characters.data={ unicodeslot=0x0A24, }, [0x0A25]={ + adobename="thagurmukhi", category="lo", description="GURMUKHI LETTER THA", direction="l", @@ -18987,6 +19896,7 @@ characters.data={ unicodeslot=0x0A25, }, [0x0A26]={ + adobename="dagurmukhi", category="lo", description="GURMUKHI LETTER DA", direction="l", @@ -18994,6 +19904,7 @@ characters.data={ unicodeslot=0x0A26, }, [0x0A27]={ + adobename="dhagurmukhi", category="lo", description="GURMUKHI LETTER DHA", direction="l", @@ -19001,6 +19912,7 @@ characters.data={ unicodeslot=0x0A27, }, [0x0A28]={ + adobename="nagurmukhi", category="lo", description="GURMUKHI LETTER NA", direction="l", @@ -19008,6 +19920,7 @@ characters.data={ unicodeslot=0x0A28, }, [0x0A2A]={ + adobename="pagurmukhi", category="lo", description="GURMUKHI LETTER PA", direction="l", @@ -19015,6 +19928,7 @@ characters.data={ unicodeslot=0x0A2A, }, [0x0A2B]={ + adobename="phagurmukhi", category="lo", description="GURMUKHI LETTER PHA", direction="l", @@ -19022,6 +19936,7 @@ characters.data={ unicodeslot=0x0A2B, }, [0x0A2C]={ + adobename="bagurmukhi", category="lo", description="GURMUKHI LETTER BA", direction="l", @@ -19029,6 +19944,7 @@ characters.data={ unicodeslot=0x0A2C, }, [0x0A2D]={ + adobename="bhagurmukhi", category="lo", description="GURMUKHI LETTER BHA", direction="l", @@ -19036,6 +19952,7 @@ characters.data={ unicodeslot=0x0A2D, }, [0x0A2E]={ + adobename="magurmukhi", category="lo", description="GURMUKHI LETTER MA", direction="l", @@ -19043,6 +19960,7 @@ characters.data={ unicodeslot=0x0A2E, }, [0x0A2F]={ + adobename="yagurmukhi", category="lo", description="GURMUKHI LETTER YA", direction="l", @@ -19050,6 +19968,7 @@ characters.data={ unicodeslot=0x0A2F, }, [0x0A30]={ + adobename="ragurmukhi", category="lo", description="GURMUKHI LETTER RA", direction="l", @@ -19057,6 +19976,7 @@ characters.data={ unicodeslot=0x0A30, }, [0x0A32]={ + adobename="lagurmukhi", category="lo", description="GURMUKHI LETTER LA", direction="l", @@ -19072,6 +19992,7 @@ characters.data={ unicodeslot=0x0A33, }, [0x0A35]={ + adobename="vagurmukhi", category="lo", description="GURMUKHI LETTER VA", direction="l", @@ -19079,6 +20000,7 @@ characters.data={ unicodeslot=0x0A35, }, [0x0A36]={ + adobename="shagurmukhi", category="lo", description="GURMUKHI LETTER SHA", direction="l", @@ -19087,6 +20009,7 @@ characters.data={ unicodeslot=0x0A36, }, [0x0A38]={ + adobename="sagurmukhi", category="lo", description="GURMUKHI LETTER SA", direction="l", @@ -19094,6 +20017,7 @@ characters.data={ unicodeslot=0x0A38, }, [0x0A39]={ + adobename="hagurmukhi", category="lo", description="GURMUKHI LETTER HA", direction="l", @@ -19101,6 +20025,7 @@ characters.data={ unicodeslot=0x0A39, }, [0x0A3C]={ + adobename="nuktagurmukhi", category="mn", description="GURMUKHI SIGN NUKTA", direction="nsm", @@ -19108,6 +20033,7 @@ characters.data={ unicodeslot=0x0A3C, }, [0x0A3E]={ + adobename="aamatragurmukhi", category="mc", description="GURMUKHI VOWEL SIGN AA", direction="l", @@ -19115,6 +20041,7 @@ characters.data={ unicodeslot=0x0A3E, }, [0x0A3F]={ + adobename="imatragurmukhi", category="mc", description="GURMUKHI VOWEL SIGN I", direction="l", @@ -19122,6 +20049,7 @@ characters.data={ unicodeslot=0x0A3F, }, [0x0A40]={ + adobename="iimatragurmukhi", category="mc", description="GURMUKHI VOWEL SIGN II", direction="l", @@ -19129,6 +20057,7 @@ characters.data={ unicodeslot=0x0A40, }, [0x0A41]={ + adobename="umatragurmukhi", category="mn", description="GURMUKHI VOWEL SIGN U", direction="nsm", @@ -19136,6 +20065,7 @@ characters.data={ unicodeslot=0x0A41, }, [0x0A42]={ + adobename="uumatragurmukhi", category="mn", description="GURMUKHI VOWEL SIGN UU", direction="nsm", @@ -19143,6 +20073,7 @@ characters.data={ unicodeslot=0x0A42, }, [0x0A47]={ + adobename="eematragurmukhi", category="mn", description="GURMUKHI VOWEL SIGN EE", direction="nsm", @@ -19150,6 +20081,7 @@ characters.data={ unicodeslot=0x0A47, }, [0x0A48]={ + adobename="aimatragurmukhi", category="mn", description="GURMUKHI VOWEL SIGN AI", direction="nsm", @@ -19157,6 +20089,7 @@ characters.data={ unicodeslot=0x0A48, }, [0x0A4B]={ + adobename="oomatragurmukhi", category="mn", description="GURMUKHI VOWEL SIGN OO", direction="nsm", @@ -19164,6 +20097,7 @@ characters.data={ unicodeslot=0x0A4B, }, [0x0A4C]={ + adobename="aumatragurmukhi", category="mn", description="GURMUKHI VOWEL SIGN AU", direction="nsm", @@ -19171,6 +20105,7 @@ characters.data={ unicodeslot=0x0A4C, }, [0x0A4D]={ + adobename="halantgurmukhi", category="mn", description="GURMUKHI SIGN VIRAMA", direction="nsm", @@ -19178,6 +20113,7 @@ characters.data={ unicodeslot=0x0A4D, }, [0x0A59]={ + adobename="khhagurmukhi", category="lo", description="GURMUKHI LETTER KHHA", direction="l", @@ -19186,6 +20122,7 @@ characters.data={ unicodeslot=0x0A59, }, [0x0A5A]={ + adobename="ghhagurmukhi", category="lo", description="GURMUKHI LETTER GHHA", direction="l", @@ -19194,6 +20131,7 @@ characters.data={ unicodeslot=0x0A5A, }, [0x0A5B]={ + adobename="zagurmukhi", category="lo", description="GURMUKHI LETTER ZA", direction="l", @@ -19202,6 +20140,7 @@ characters.data={ unicodeslot=0x0A5B, }, [0x0A5C]={ + adobename="rragurmukhi", category="lo", description="GURMUKHI LETTER RRA", direction="l", @@ -19209,6 +20148,7 @@ characters.data={ unicodeslot=0x0A5C, }, [0x0A5E]={ + adobename="fagurmukhi", category="lo", description="GURMUKHI LETTER FA", direction="l", @@ -19217,6 +20157,7 @@ characters.data={ unicodeslot=0x0A5E, }, [0x0A66]={ + adobename="zerogurmukhi", category="nd", description="GURMUKHI DIGIT ZERO", direction="l", @@ -19224,6 +20165,7 @@ characters.data={ unicodeslot=0x0A66, }, [0x0A67]={ + adobename="onegurmukhi", category="nd", description="GURMUKHI DIGIT ONE", direction="l", @@ -19231,6 +20173,7 @@ characters.data={ unicodeslot=0x0A67, }, [0x0A68]={ + adobename="twogurmukhi", category="nd", description="GURMUKHI DIGIT TWO", direction="l", @@ -19238,6 +20181,7 @@ characters.data={ unicodeslot=0x0A68, }, [0x0A69]={ + adobename="threegurmukhi", category="nd", description="GURMUKHI DIGIT THREE", direction="l", @@ -19245,6 +20189,7 @@ characters.data={ unicodeslot=0x0A69, }, [0x0A6A]={ + adobename="fourgurmukhi", category="nd", description="GURMUKHI DIGIT FOUR", direction="l", @@ -19252,6 +20197,7 @@ characters.data={ unicodeslot=0x0A6A, }, [0x0A6B]={ + adobename="fivegurmukhi", category="nd", description="GURMUKHI DIGIT FIVE", direction="l", @@ -19259,6 +20205,7 @@ characters.data={ unicodeslot=0x0A6B, }, [0x0A6C]={ + adobename="sixgurmukhi", category="nd", description="GURMUKHI DIGIT SIX", direction="l", @@ -19266,6 +20213,7 @@ characters.data={ unicodeslot=0x0A6C, }, [0x0A6D]={ + adobename="sevengurmukhi", category="nd", description="GURMUKHI DIGIT SEVEN", direction="l", @@ -19273,6 +20221,7 @@ characters.data={ unicodeslot=0x0A6D, }, [0x0A6E]={ + adobename="eightgurmukhi", category="nd", description="GURMUKHI DIGIT EIGHT", direction="l", @@ -19280,6 +20229,7 @@ characters.data={ unicodeslot=0x0A6E, }, [0x0A6F]={ + adobename="ninegurmukhi", category="nd", description="GURMUKHI DIGIT NINE", direction="l", @@ -19287,6 +20237,7 @@ characters.data={ unicodeslot=0x0A6F, }, [0x0A70]={ + adobename="tippigurmukhi", category="mn", description="GURMUKHI TIPPI", direction="nsm", @@ -19294,6 +20245,7 @@ characters.data={ unicodeslot=0x0A70, }, [0x0A71]={ + adobename="addakgurmukhi", category="mn", description="GURMUKHI ADDAK", direction="nsm", @@ -19301,6 +20253,7 @@ characters.data={ unicodeslot=0x0A71, }, [0x0A72]={ + adobename="irigurmukhi", category="lo", description="GURMUKHI IRI", direction="l", @@ -19308,6 +20261,7 @@ characters.data={ unicodeslot=0x0A72, }, [0x0A73]={ + adobename="uragurmukhi", category="lo", description="GURMUKHI URA", direction="l", @@ -19315,6 +20269,7 @@ characters.data={ unicodeslot=0x0A73, }, [0x0A74]={ + adobename="ekonkargurmukhi", category="lo", description="GURMUKHI EK ONKAR", direction="l", @@ -19322,6 +20277,7 @@ characters.data={ unicodeslot=0x0A74, }, [0x0A81]={ + adobename="candrabindugujarati", category="mn", description="GUJARATI SIGN CANDRABINDU", direction="nsm", @@ -19329,6 +20285,7 @@ characters.data={ unicodeslot=0x0A81, }, [0x0A82]={ + adobename="anusvaragujarati", category="mn", description="GUJARATI SIGN ANUSVARA", direction="nsm", @@ -19336,6 +20293,7 @@ characters.data={ unicodeslot=0x0A82, }, [0x0A83]={ + adobename="visargagujarati", category="mc", description="GUJARATI SIGN VISARGA", direction="l", @@ -19343,6 +20301,7 @@ characters.data={ unicodeslot=0x0A83, }, [0x0A85]={ + adobename="agujarati", category="lo", description="GUJARATI LETTER A", direction="l", @@ -19350,6 +20309,7 @@ characters.data={ unicodeslot=0x0A85, }, [0x0A86]={ + adobename="aagujarati", category="lo", description="GUJARATI LETTER AA", direction="l", @@ -19357,6 +20317,7 @@ characters.data={ unicodeslot=0x0A86, }, [0x0A87]={ + adobename="igujarati", category="lo", description="GUJARATI LETTER I", direction="l", @@ -19364,6 +20325,7 @@ characters.data={ unicodeslot=0x0A87, }, [0x0A88]={ + adobename="iigujarati", category="lo", description="GUJARATI LETTER II", direction="l", @@ -19371,6 +20333,7 @@ characters.data={ unicodeslot=0x0A88, }, [0x0A89]={ + adobename="ugujarati", category="lo", description="GUJARATI LETTER U", direction="l", @@ -19378,6 +20341,7 @@ characters.data={ unicodeslot=0x0A89, }, [0x0A8A]={ + adobename="uugujarati", category="lo", description="GUJARATI LETTER UU", direction="l", @@ -19385,6 +20349,7 @@ characters.data={ unicodeslot=0x0A8A, }, [0x0A8B]={ + adobename="rvocalicgujarati", category="lo", description="GUJARATI LETTER VOCALIC R", direction="l", @@ -19399,6 +20364,7 @@ characters.data={ unicodeslot=0x0A8C, }, [0x0A8D]={ + adobename="ecandragujarati", category="lo", description="GUJARATI VOWEL CANDRA E", direction="l", @@ -19406,6 +20372,7 @@ characters.data={ unicodeslot=0x0A8D, }, [0x0A8F]={ + adobename="egujarati", category="lo", description="GUJARATI LETTER E", direction="l", @@ -19413,6 +20380,7 @@ characters.data={ unicodeslot=0x0A8F, }, [0x0A90]={ + adobename="aigujarati", category="lo", description="GUJARATI LETTER AI", direction="l", @@ -19420,6 +20388,7 @@ characters.data={ unicodeslot=0x0A90, }, [0x0A91]={ + adobename="ocandragujarati", category="lo", description="GUJARATI VOWEL CANDRA O", direction="l", @@ -19427,6 +20396,7 @@ characters.data={ unicodeslot=0x0A91, }, [0x0A93]={ + adobename="ogujarati", category="lo", description="GUJARATI LETTER O", direction="l", @@ -19434,6 +20404,7 @@ characters.data={ unicodeslot=0x0A93, }, [0x0A94]={ + adobename="augujarati", category="lo", description="GUJARATI LETTER AU", direction="l", @@ -19441,6 +20412,7 @@ characters.data={ unicodeslot=0x0A94, }, [0x0A95]={ + adobename="kagujarati", category="lo", description="GUJARATI LETTER KA", direction="l", @@ -19448,6 +20420,7 @@ characters.data={ unicodeslot=0x0A95, }, [0x0A96]={ + adobename="khagujarati", category="lo", description="GUJARATI LETTER KHA", direction="l", @@ -19455,6 +20428,7 @@ characters.data={ unicodeslot=0x0A96, }, [0x0A97]={ + adobename="gagujarati", category="lo", description="GUJARATI LETTER GA", direction="l", @@ -19462,6 +20436,7 @@ characters.data={ unicodeslot=0x0A97, }, [0x0A98]={ + adobename="ghagujarati", category="lo", description="GUJARATI LETTER GHA", direction="l", @@ -19469,6 +20444,7 @@ characters.data={ unicodeslot=0x0A98, }, [0x0A99]={ + adobename="ngagujarati", category="lo", description="GUJARATI LETTER NGA", direction="l", @@ -19476,6 +20452,7 @@ characters.data={ unicodeslot=0x0A99, }, [0x0A9A]={ + adobename="cagujarati", category="lo", description="GUJARATI LETTER CA", direction="l", @@ -19483,6 +20460,7 @@ characters.data={ unicodeslot=0x0A9A, }, [0x0A9B]={ + adobename="chagujarati", category="lo", description="GUJARATI LETTER CHA", direction="l", @@ -19490,6 +20468,7 @@ characters.data={ unicodeslot=0x0A9B, }, [0x0A9C]={ + adobename="jagujarati", category="lo", description="GUJARATI LETTER JA", direction="l", @@ -19497,6 +20476,7 @@ characters.data={ unicodeslot=0x0A9C, }, [0x0A9D]={ + adobename="jhagujarati", category="lo", description="GUJARATI LETTER JHA", direction="l", @@ -19504,6 +20484,7 @@ characters.data={ unicodeslot=0x0A9D, }, [0x0A9E]={ + adobename="nyagujarati", category="lo", description="GUJARATI LETTER NYA", direction="l", @@ -19511,6 +20492,7 @@ characters.data={ unicodeslot=0x0A9E, }, [0x0A9F]={ + adobename="ttagujarati", category="lo", description="GUJARATI LETTER TTA", direction="l", @@ -19518,6 +20500,7 @@ characters.data={ unicodeslot=0x0A9F, }, [0x0AA0]={ + adobename="tthagujarati", category="lo", description="GUJARATI LETTER TTHA", direction="l", @@ -19525,6 +20508,7 @@ characters.data={ unicodeslot=0x0AA0, }, [0x0AA1]={ + adobename="ddagujarati", category="lo", description="GUJARATI LETTER DDA", direction="l", @@ -19532,6 +20516,7 @@ characters.data={ unicodeslot=0x0AA1, }, [0x0AA2]={ + adobename="ddhagujarati", category="lo", description="GUJARATI LETTER DDHA", direction="l", @@ -19539,6 +20524,7 @@ characters.data={ unicodeslot=0x0AA2, }, [0x0AA3]={ + adobename="nnagujarati", category="lo", description="GUJARATI LETTER NNA", direction="l", @@ -19546,6 +20532,7 @@ characters.data={ unicodeslot=0x0AA3, }, [0x0AA4]={ + adobename="tagujarati", category="lo", description="GUJARATI LETTER TA", direction="l", @@ -19553,6 +20540,7 @@ characters.data={ unicodeslot=0x0AA4, }, [0x0AA5]={ + adobename="thagujarati", category="lo", description="GUJARATI LETTER THA", direction="l", @@ -19560,6 +20548,7 @@ characters.data={ unicodeslot=0x0AA5, }, [0x0AA6]={ + adobename="dagujarati", category="lo", description="GUJARATI LETTER DA", direction="l", @@ -19567,6 +20556,7 @@ characters.data={ unicodeslot=0x0AA6, }, [0x0AA7]={ + adobename="dhagujarati", category="lo", description="GUJARATI LETTER DHA", direction="l", @@ -19574,6 +20564,7 @@ characters.data={ unicodeslot=0x0AA7, }, [0x0AA8]={ + adobename="nagujarati", category="lo", description="GUJARATI LETTER NA", direction="l", @@ -19581,6 +20572,7 @@ characters.data={ unicodeslot=0x0AA8, }, [0x0AAA]={ + adobename="pagujarati", category="lo", description="GUJARATI LETTER PA", direction="l", @@ -19588,6 +20580,7 @@ characters.data={ unicodeslot=0x0AAA, }, [0x0AAB]={ + adobename="phagujarati", category="lo", description="GUJARATI LETTER PHA", direction="l", @@ -19595,6 +20588,7 @@ characters.data={ unicodeslot=0x0AAB, }, [0x0AAC]={ + adobename="bagujarati", category="lo", description="GUJARATI LETTER BA", direction="l", @@ -19602,6 +20596,7 @@ characters.data={ unicodeslot=0x0AAC, }, [0x0AAD]={ + adobename="bhagujarati", category="lo", description="GUJARATI LETTER BHA", direction="l", @@ -19609,6 +20604,7 @@ characters.data={ unicodeslot=0x0AAD, }, [0x0AAE]={ + adobename="magujarati", category="lo", description="GUJARATI LETTER MA", direction="l", @@ -19616,6 +20612,7 @@ characters.data={ unicodeslot=0x0AAE, }, [0x0AAF]={ + adobename="yagujarati", category="lo", description="GUJARATI LETTER YA", direction="l", @@ -19623,6 +20620,7 @@ characters.data={ unicodeslot=0x0AAF, }, [0x0AB0]={ + adobename="ragujarati", category="lo", description="GUJARATI LETTER RA", direction="l", @@ -19630,6 +20628,7 @@ characters.data={ unicodeslot=0x0AB0, }, [0x0AB2]={ + adobename="lagujarati", category="lo", description="GUJARATI LETTER LA", direction="l", @@ -19637,6 +20636,7 @@ characters.data={ unicodeslot=0x0AB2, }, [0x0AB3]={ + adobename="llagujarati", category="lo", description="GUJARATI LETTER LLA", direction="l", @@ -19644,6 +20644,7 @@ characters.data={ unicodeslot=0x0AB3, }, [0x0AB5]={ + adobename="vagujarati", category="lo", description="GUJARATI LETTER VA", direction="l", @@ -19651,6 +20652,7 @@ characters.data={ unicodeslot=0x0AB5, }, [0x0AB6]={ + adobename="shagujarati", category="lo", description="GUJARATI LETTER SHA", direction="l", @@ -19658,6 +20660,7 @@ characters.data={ unicodeslot=0x0AB6, }, [0x0AB7]={ + adobename="ssagujarati", category="lo", description="GUJARATI LETTER SSA", direction="l", @@ -19665,6 +20668,7 @@ characters.data={ unicodeslot=0x0AB7, }, [0x0AB8]={ + adobename="sagujarati", category="lo", description="GUJARATI LETTER SA", direction="l", @@ -19672,6 +20676,7 @@ characters.data={ unicodeslot=0x0AB8, }, [0x0AB9]={ + adobename="hagujarati", category="lo", description="GUJARATI LETTER HA", direction="l", @@ -19679,6 +20684,7 @@ characters.data={ unicodeslot=0x0AB9, }, [0x0ABC]={ + adobename="nuktagujarati", category="mn", description="GUJARATI SIGN NUKTA", direction="nsm", @@ -19693,6 +20699,7 @@ characters.data={ unicodeslot=0x0ABD, }, [0x0ABE]={ + adobename="aavowelsigngujarati", category="mc", description="GUJARATI VOWEL SIGN AA", direction="l", @@ -19700,6 +20707,7 @@ characters.data={ unicodeslot=0x0ABE, }, [0x0ABF]={ + adobename="ivowelsigngujarati", category="mc", description="GUJARATI VOWEL SIGN I", direction="l", @@ -19707,6 +20715,7 @@ characters.data={ unicodeslot=0x0ABF, }, [0x0AC0]={ + adobename="iivowelsigngujarati", category="mc", description="GUJARATI VOWEL SIGN II", direction="l", @@ -19714,6 +20723,7 @@ characters.data={ unicodeslot=0x0AC0, }, [0x0AC1]={ + adobename="uvowelsigngujarati", category="mn", description="GUJARATI VOWEL SIGN U", direction="nsm", @@ -19721,6 +20731,7 @@ characters.data={ unicodeslot=0x0AC1, }, [0x0AC2]={ + adobename="uuvowelsigngujarati", category="mn", description="GUJARATI VOWEL SIGN UU", direction="nsm", @@ -19728,6 +20739,7 @@ characters.data={ unicodeslot=0x0AC2, }, [0x0AC3]={ + adobename="rvocalicvowelsigngujarati", category="mn", description="GUJARATI VOWEL SIGN VOCALIC R", direction="nsm", @@ -19735,6 +20747,7 @@ characters.data={ unicodeslot=0x0AC3, }, [0x0AC4]={ + adobename="rrvocalicvowelsigngujarati", category="mn", description="GUJARATI VOWEL SIGN VOCALIC RR", direction="nsm", @@ -19742,6 +20755,7 @@ characters.data={ unicodeslot=0x0AC4, }, [0x0AC5]={ + adobename="ecandravowelsigngujarati", category="mn", description="GUJARATI VOWEL SIGN CANDRA E", direction="nsm", @@ -19749,6 +20763,7 @@ characters.data={ unicodeslot=0x0AC5, }, [0x0AC7]={ + adobename="evowelsigngujarati", category="mn", description="GUJARATI VOWEL SIGN E", direction="nsm", @@ -19756,6 +20771,7 @@ characters.data={ unicodeslot=0x0AC7, }, [0x0AC8]={ + adobename="aivowelsigngujarati", category="mn", description="GUJARATI VOWEL SIGN AI", direction="nsm", @@ -19763,6 +20779,7 @@ characters.data={ unicodeslot=0x0AC8, }, [0x0AC9]={ + adobename="ocandravowelsigngujarati", category="mc", description="GUJARATI VOWEL SIGN CANDRA O", direction="l", @@ -19770,6 +20787,7 @@ characters.data={ unicodeslot=0x0AC9, }, [0x0ACB]={ + adobename="ovowelsigngujarati", category="mc", description="GUJARATI VOWEL SIGN O", direction="l", @@ -19777,6 +20795,7 @@ characters.data={ unicodeslot=0x0ACB, }, [0x0ACC]={ + adobename="auvowelsigngujarati", category="mc", description="GUJARATI VOWEL SIGN AU", direction="l", @@ -19784,6 +20803,7 @@ characters.data={ unicodeslot=0x0ACC, }, [0x0ACD]={ + adobename="viramagujarati", category="mn", description="GUJARATI SIGN VIRAMA", direction="nsm", @@ -19791,6 +20811,7 @@ characters.data={ unicodeslot=0x0ACD, }, [0x0AD0]={ + adobename="omgujarati", category="lo", description="GUJARATI OM", direction="l", @@ -19798,6 +20819,7 @@ characters.data={ unicodeslot=0x0AD0, }, [0x0AE0]={ + adobename="rrvocalicgujarati", category="lo", description="GUJARATI LETTER VOCALIC RR", direction="l", @@ -19826,6 +20848,7 @@ characters.data={ unicodeslot=0x0AE3, }, [0x0AE6]={ + adobename="zerogujarati", category="nd", description="GUJARATI DIGIT ZERO", direction="l", @@ -19833,6 +20856,7 @@ characters.data={ unicodeslot=0x0AE6, }, [0x0AE7]={ + adobename="onegujarati", category="nd", description="GUJARATI DIGIT ONE", direction="l", @@ -19840,6 +20864,7 @@ characters.data={ unicodeslot=0x0AE7, }, [0x0AE8]={ + adobename="twogujarati", category="nd", description="GUJARATI DIGIT TWO", direction="l", @@ -19847,6 +20872,7 @@ characters.data={ unicodeslot=0x0AE8, }, [0x0AE9]={ + adobename="threegujarati", category="nd", description="GUJARATI DIGIT THREE", direction="l", @@ -19854,6 +20880,7 @@ characters.data={ unicodeslot=0x0AE9, }, [0x0AEA]={ + adobename="fourgujarati", category="nd", description="GUJARATI DIGIT FOUR", direction="l", @@ -19861,6 +20888,7 @@ characters.data={ unicodeslot=0x0AEA, }, [0x0AEB]={ + adobename="fivegujarati", category="nd", description="GUJARATI DIGIT FIVE", direction="l", @@ -19868,6 +20896,7 @@ characters.data={ unicodeslot=0x0AEB, }, [0x0AEC]={ + adobename="sixgujarati", category="nd", description="GUJARATI DIGIT SIX", direction="l", @@ -19875,6 +20904,7 @@ characters.data={ unicodeslot=0x0AEC, }, [0x0AED]={ + adobename="sevengujarati", category="nd", description="GUJARATI DIGIT SEVEN", direction="l", @@ -19882,6 +20912,7 @@ characters.data={ unicodeslot=0x0AED, }, [0x0AEE]={ + adobename="eightgujarati", category="nd", description="GUJARATI DIGIT EIGHT", direction="l", @@ -19889,6 +20920,7 @@ characters.data={ unicodeslot=0x0AEE, }, [0x0AEF]={ + adobename="ninegujarati", category="nd", description="GUJARATI DIGIT NINE", direction="l", @@ -23257,6 +24289,7 @@ characters.data={ unicodeslot=0x0DF4, }, [0x0E01]={ + adobename="kokaithai", category="lo", description="THAI CHARACTER KO KAI", direction="l", @@ -23264,6 +24297,7 @@ characters.data={ unicodeslot=0x0E01, }, [0x0E02]={ + adobename="khokhaithai", category="lo", description="THAI CHARACTER KHO KHAI", direction="l", @@ -23271,6 +24305,7 @@ characters.data={ unicodeslot=0x0E02, }, [0x0E03]={ + adobename="khokhuatthai", category="lo", description="THAI CHARACTER KHO KHUAT", direction="l", @@ -23278,6 +24313,7 @@ characters.data={ unicodeslot=0x0E03, }, [0x0E04]={ + adobename="khokhwaithai", category="lo", description="THAI CHARACTER KHO KHWAI", direction="l", @@ -23285,6 +24321,7 @@ characters.data={ unicodeslot=0x0E04, }, [0x0E05]={ + adobename="khokhonthai", category="lo", description="THAI CHARACTER KHO KHON", direction="l", @@ -23292,6 +24329,7 @@ characters.data={ unicodeslot=0x0E05, }, [0x0E06]={ + adobename="khorakhangthai", category="lo", description="THAI CHARACTER KHO RAKHANG", direction="l", @@ -23299,6 +24337,7 @@ characters.data={ unicodeslot=0x0E06, }, [0x0E07]={ + adobename="ngonguthai", category="lo", description="THAI CHARACTER NGO NGU", direction="l", @@ -23306,6 +24345,7 @@ characters.data={ unicodeslot=0x0E07, }, [0x0E08]={ + adobename="chochanthai", category="lo", description="THAI CHARACTER CHO CHAN", direction="l", @@ -23313,6 +24353,7 @@ characters.data={ unicodeslot=0x0E08, }, [0x0E09]={ + adobename="chochingthai", category="lo", description="THAI CHARACTER CHO CHING", direction="l", @@ -23320,6 +24361,7 @@ characters.data={ unicodeslot=0x0E09, }, [0x0E0A]={ + adobename="chochangthai", category="lo", description="THAI CHARACTER CHO CHANG", direction="l", @@ -23327,6 +24369,7 @@ characters.data={ unicodeslot=0x0E0A, }, [0x0E0B]={ + adobename="sosothai", category="lo", description="THAI CHARACTER SO SO", direction="l", @@ -23334,6 +24377,7 @@ characters.data={ unicodeslot=0x0E0B, }, [0x0E0C]={ + adobename="chochoethai", category="lo", description="THAI CHARACTER CHO CHOE", direction="l", @@ -23341,6 +24385,7 @@ characters.data={ unicodeslot=0x0E0C, }, [0x0E0D]={ + adobename="yoyingthai", category="lo", description="THAI CHARACTER YO YING", direction="l", @@ -23348,6 +24393,7 @@ characters.data={ unicodeslot=0x0E0D, }, [0x0E0E]={ + adobename="dochadathai", category="lo", description="THAI CHARACTER DO CHADA", direction="l", @@ -23355,6 +24401,7 @@ characters.data={ unicodeslot=0x0E0E, }, [0x0E0F]={ + adobename="topatakthai", category="lo", description="THAI CHARACTER TO PATAK", direction="l", @@ -23362,6 +24409,7 @@ characters.data={ unicodeslot=0x0E0F, }, [0x0E10]={ + adobename="thothanthai", category="lo", description="THAI CHARACTER THO THAN", direction="l", @@ -23369,6 +24417,7 @@ characters.data={ unicodeslot=0x0E10, }, [0x0E11]={ + adobename="thonangmonthothai", category="lo", description="THAI CHARACTER THO NANGMONTHO", direction="l", @@ -23376,6 +24425,7 @@ characters.data={ unicodeslot=0x0E11, }, [0x0E12]={ + adobename="thophuthaothai", category="lo", description="THAI CHARACTER THO PHUTHAO", direction="l", @@ -23383,6 +24433,7 @@ characters.data={ unicodeslot=0x0E12, }, [0x0E13]={ + adobename="nonenthai", category="lo", description="THAI CHARACTER NO NEN", direction="l", @@ -23390,6 +24441,7 @@ characters.data={ unicodeslot=0x0E13, }, [0x0E14]={ + adobename="dodekthai", category="lo", description="THAI CHARACTER DO DEK", direction="l", @@ -23397,6 +24449,7 @@ characters.data={ unicodeslot=0x0E14, }, [0x0E15]={ + adobename="totaothai", category="lo", description="THAI CHARACTER TO TAO", direction="l", @@ -23404,6 +24457,7 @@ characters.data={ unicodeslot=0x0E15, }, [0x0E16]={ + adobename="thothungthai", category="lo", description="THAI CHARACTER THO THUNG", direction="l", @@ -23411,6 +24465,7 @@ characters.data={ unicodeslot=0x0E16, }, [0x0E17]={ + adobename="thothahanthai", category="lo", description="THAI CHARACTER THO THAHAN", direction="l", @@ -23418,6 +24473,7 @@ characters.data={ unicodeslot=0x0E17, }, [0x0E18]={ + adobename="thothongthai", category="lo", description="THAI CHARACTER THO THONG", direction="l", @@ -23425,6 +24481,7 @@ characters.data={ unicodeslot=0x0E18, }, [0x0E19]={ + adobename="nonuthai", category="lo", description="THAI CHARACTER NO NU", direction="l", @@ -23432,6 +24489,7 @@ characters.data={ unicodeslot=0x0E19, }, [0x0E1A]={ + adobename="bobaimaithai", category="lo", description="THAI CHARACTER BO BAIMAI", direction="l", @@ -23439,6 +24497,7 @@ characters.data={ unicodeslot=0x0E1A, }, [0x0E1B]={ + adobename="poplathai", category="lo", description="THAI CHARACTER PO PLA", direction="l", @@ -23446,6 +24505,7 @@ characters.data={ unicodeslot=0x0E1B, }, [0x0E1C]={ + adobename="phophungthai", category="lo", description="THAI CHARACTER PHO PHUNG", direction="l", @@ -23453,6 +24513,7 @@ characters.data={ unicodeslot=0x0E1C, }, [0x0E1D]={ + adobename="fofathai", category="lo", description="THAI CHARACTER FO FA", direction="l", @@ -23460,6 +24521,7 @@ characters.data={ unicodeslot=0x0E1D, }, [0x0E1E]={ + adobename="phophanthai", category="lo", description="THAI CHARACTER PHO PHAN", direction="l", @@ -23467,6 +24529,7 @@ characters.data={ unicodeslot=0x0E1E, }, [0x0E1F]={ + adobename="fofanthai", category="lo", description="THAI CHARACTER FO FAN", direction="l", @@ -23474,6 +24537,7 @@ characters.data={ unicodeslot=0x0E1F, }, [0x0E20]={ + adobename="phosamphaothai", category="lo", description="THAI CHARACTER PHO SAMPHAO", direction="l", @@ -23481,6 +24545,7 @@ characters.data={ unicodeslot=0x0E20, }, [0x0E21]={ + adobename="momathai", category="lo", description="THAI CHARACTER MO MA", direction="l", @@ -23488,6 +24553,7 @@ characters.data={ unicodeslot=0x0E21, }, [0x0E22]={ + adobename="yoyakthai", category="lo", description="THAI CHARACTER YO YAK", direction="l", @@ -23495,6 +24561,7 @@ characters.data={ unicodeslot=0x0E22, }, [0x0E23]={ + adobename="roruathai", category="lo", description="THAI CHARACTER RO RUA", direction="l", @@ -23502,6 +24569,7 @@ characters.data={ unicodeslot=0x0E23, }, [0x0E24]={ + adobename="ruthai", category="lo", description="THAI CHARACTER RU", direction="l", @@ -23509,6 +24577,7 @@ characters.data={ unicodeslot=0x0E24, }, [0x0E25]={ + adobename="lolingthai", category="lo", description="THAI CHARACTER LO LING", direction="l", @@ -23516,6 +24585,7 @@ characters.data={ unicodeslot=0x0E25, }, [0x0E26]={ + adobename="luthai", category="lo", description="THAI CHARACTER LU", direction="l", @@ -23523,6 +24593,7 @@ characters.data={ unicodeslot=0x0E26, }, [0x0E27]={ + adobename="wowaenthai", category="lo", description="THAI CHARACTER WO WAEN", direction="l", @@ -23530,6 +24601,7 @@ characters.data={ unicodeslot=0x0E27, }, [0x0E28]={ + adobename="sosalathai", category="lo", description="THAI CHARACTER SO SALA", direction="l", @@ -23537,6 +24609,7 @@ characters.data={ unicodeslot=0x0E28, }, [0x0E29]={ + adobename="sorusithai", category="lo", description="THAI CHARACTER SO RUSI", direction="l", @@ -23544,6 +24617,7 @@ characters.data={ unicodeslot=0x0E29, }, [0x0E2A]={ + adobename="sosuathai", category="lo", description="THAI CHARACTER SO SUA", direction="l", @@ -23551,6 +24625,7 @@ characters.data={ unicodeslot=0x0E2A, }, [0x0E2B]={ + adobename="hohipthai", category="lo", description="THAI CHARACTER HO HIP", direction="l", @@ -23558,6 +24633,7 @@ characters.data={ unicodeslot=0x0E2B, }, [0x0E2C]={ + adobename="lochulathai", category="lo", description="THAI CHARACTER LO CHULA", direction="l", @@ -23565,6 +24641,7 @@ characters.data={ unicodeslot=0x0E2C, }, [0x0E2D]={ + adobename="oangthai", category="lo", description="THAI CHARACTER O ANG", direction="l", @@ -23572,6 +24649,7 @@ characters.data={ unicodeslot=0x0E2D, }, [0x0E2E]={ + adobename="honokhukthai", category="lo", description="THAI CHARACTER HO NOKHUK", direction="l", @@ -23579,6 +24657,7 @@ characters.data={ unicodeslot=0x0E2E, }, [0x0E2F]={ + adobename="paiyannoithai", category="lo", description="THAI CHARACTER PAIYANNOI", direction="l", @@ -23586,6 +24665,7 @@ characters.data={ unicodeslot=0x0E2F, }, [0x0E30]={ + adobename="saraathai", category="lo", description="THAI CHARACTER SARA A", direction="l", @@ -23593,6 +24673,7 @@ characters.data={ unicodeslot=0x0E30, }, [0x0E31]={ + adobename="maihanakatthai", category="mn", description="THAI CHARACTER MAI HAN-AKAT", direction="nsm", @@ -23600,6 +24681,7 @@ characters.data={ unicodeslot=0x0E31, }, [0x0E32]={ + adobename="saraaathai", category="lo", description="THAI CHARACTER SARA AA", direction="l", @@ -23607,6 +24689,7 @@ characters.data={ unicodeslot=0x0E32, }, [0x0E33]={ + adobename="saraamthai", category="lo", description="THAI CHARACTER SARA AM", direction="l", @@ -23615,6 +24698,7 @@ characters.data={ unicodeslot=0x0E33, }, [0x0E34]={ + adobename="saraithai", category="mn", description="THAI CHARACTER SARA I", direction="nsm", @@ -23622,6 +24706,7 @@ characters.data={ unicodeslot=0x0E34, }, [0x0E35]={ + adobename="saraiithai", category="mn", description="THAI CHARACTER SARA II", direction="nsm", @@ -23629,6 +24714,7 @@ characters.data={ unicodeslot=0x0E35, }, [0x0E36]={ + adobename="sarauethai", category="mn", description="THAI CHARACTER SARA UE", direction="nsm", @@ -23636,6 +24722,7 @@ characters.data={ unicodeslot=0x0E36, }, [0x0E37]={ + adobename="saraueethai", category="mn", description="THAI CHARACTER SARA UEE", direction="nsm", @@ -23643,6 +24730,7 @@ characters.data={ unicodeslot=0x0E37, }, [0x0E38]={ + adobename="sarauthai", category="mn", description="THAI CHARACTER SARA U", direction="nsm", @@ -23650,6 +24738,7 @@ characters.data={ unicodeslot=0x0E38, }, [0x0E39]={ + adobename="sarauuthai", category="mn", description="THAI CHARACTER SARA UU", direction="nsm", @@ -23657,6 +24746,7 @@ characters.data={ unicodeslot=0x0E39, }, [0x0E3A]={ + adobename="phinthuthai", category="mn", description="THAI CHARACTER PHINTHU", direction="nsm", @@ -23664,6 +24754,7 @@ characters.data={ unicodeslot=0x0E3A, }, [0x0E3F]={ + adobename="bahtthai", category="sc", description="THAI CURRENCY SYMBOL BAHT", direction="et", @@ -23671,6 +24762,7 @@ characters.data={ unicodeslot=0x0E3F, }, [0x0E40]={ + adobename="saraethai", category="lo", description="THAI CHARACTER SARA E", direction="l", @@ -23678,6 +24770,7 @@ characters.data={ unicodeslot=0x0E40, }, [0x0E41]={ + adobename="saraaethai", category="lo", description="THAI CHARACTER SARA AE", direction="l", @@ -23685,6 +24778,7 @@ characters.data={ unicodeslot=0x0E41, }, [0x0E42]={ + adobename="saraothai", category="lo", description="THAI CHARACTER SARA O", direction="l", @@ -23692,6 +24786,7 @@ characters.data={ unicodeslot=0x0E42, }, [0x0E43]={ + adobename="saraaimaimuanthai", category="lo", description="THAI CHARACTER SARA AI MAIMUAN", direction="l", @@ -23699,6 +24794,7 @@ characters.data={ unicodeslot=0x0E43, }, [0x0E44]={ + adobename="saraaimaimalaithai", category="lo", description="THAI CHARACTER SARA AI MAIMALAI", direction="l", @@ -23706,6 +24802,7 @@ characters.data={ unicodeslot=0x0E44, }, [0x0E45]={ + adobename="lakkhangyaothai", category="lo", description="THAI CHARACTER LAKKHANGYAO", direction="l", @@ -23713,6 +24810,7 @@ characters.data={ unicodeslot=0x0E45, }, [0x0E46]={ + adobename="maiyamokthai", category="lm", description="THAI CHARACTER MAIYAMOK", direction="l", @@ -23720,6 +24818,7 @@ characters.data={ unicodeslot=0x0E46, }, [0x0E47]={ + adobename="maitaikhuthai", category="mn", description="THAI CHARACTER MAITAIKHU", direction="nsm", @@ -23727,6 +24826,7 @@ characters.data={ unicodeslot=0x0E47, }, [0x0E48]={ + adobename="maiekthai", category="mn", description="THAI CHARACTER MAI EK", direction="nsm", @@ -23734,6 +24834,7 @@ characters.data={ unicodeslot=0x0E48, }, [0x0E49]={ + adobename="maithothai", category="mn", description="THAI CHARACTER MAI THO", direction="nsm", @@ -23741,6 +24842,7 @@ characters.data={ unicodeslot=0x0E49, }, [0x0E4A]={ + adobename="maitrithai", category="mn", description="THAI CHARACTER MAI TRI", direction="nsm", @@ -23748,6 +24850,7 @@ characters.data={ unicodeslot=0x0E4A, }, [0x0E4B]={ + adobename="maichattawathai", category="mn", description="THAI CHARACTER MAI CHATTAWA", direction="nsm", @@ -23755,6 +24858,7 @@ characters.data={ unicodeslot=0x0E4B, }, [0x0E4C]={ + adobename="thanthakhatthai", category="mn", description="THAI CHARACTER THANTHAKHAT", direction="nsm", @@ -23762,6 +24866,7 @@ characters.data={ unicodeslot=0x0E4C, }, [0x0E4D]={ + adobename="nikhahitthai", category="mn", description="THAI CHARACTER NIKHAHIT", direction="nsm", @@ -23769,6 +24874,7 @@ characters.data={ unicodeslot=0x0E4D, }, [0x0E4E]={ + adobename="yamakkanthai", category="mn", description="THAI CHARACTER YAMAKKAN", direction="nsm", @@ -23776,6 +24882,7 @@ characters.data={ unicodeslot=0x0E4E, }, [0x0E4F]={ + adobename="fongmanthai", category="po", description="THAI CHARACTER FONGMAN", direction="l", @@ -23783,6 +24890,7 @@ characters.data={ unicodeslot=0x0E4F, }, [0x0E50]={ + adobename="zerothai", category="nd", description="THAI DIGIT ZERO", direction="l", @@ -23790,6 +24898,7 @@ characters.data={ unicodeslot=0x0E50, }, [0x0E51]={ + adobename="onethai", category="nd", description="THAI DIGIT ONE", direction="l", @@ -23797,6 +24906,7 @@ characters.data={ unicodeslot=0x0E51, }, [0x0E52]={ + adobename="twothai", category="nd", description="THAI DIGIT TWO", direction="l", @@ -23804,6 +24914,7 @@ characters.data={ unicodeslot=0x0E52, }, [0x0E53]={ + adobename="threethai", category="nd", description="THAI DIGIT THREE", direction="l", @@ -23811,6 +24922,7 @@ characters.data={ unicodeslot=0x0E53, }, [0x0E54]={ + adobename="fourthai", category="nd", description="THAI DIGIT FOUR", direction="l", @@ -23818,6 +24930,7 @@ characters.data={ unicodeslot=0x0E54, }, [0x0E55]={ + adobename="fivethai", category="nd", description="THAI DIGIT FIVE", direction="l", @@ -23825,6 +24938,7 @@ characters.data={ unicodeslot=0x0E55, }, [0x0E56]={ + adobename="sixthai", category="nd", description="THAI DIGIT SIX", direction="l", @@ -23832,6 +24946,7 @@ characters.data={ unicodeslot=0x0E56, }, [0x0E57]={ + adobename="seventhai", category="nd", description="THAI DIGIT SEVEN", direction="l", @@ -23839,6 +24954,7 @@ characters.data={ unicodeslot=0x0E57, }, [0x0E58]={ + adobename="eightthai", category="nd", description="THAI DIGIT EIGHT", direction="l", @@ -23846,6 +24962,7 @@ characters.data={ unicodeslot=0x0E58, }, [0x0E59]={ + adobename="ninethai", category="nd", description="THAI DIGIT NINE", direction="l", @@ -23853,6 +24970,7 @@ characters.data={ unicodeslot=0x0E59, }, [0x0E5A]={ + adobename="angkhankhuthai", category="po", description="THAI CHARACTER ANGKHANKHU", direction="l", @@ -23860,6 +24978,7 @@ characters.data={ unicodeslot=0x0E5A, }, [0x0E5B]={ + adobename="khomutthai", category="po", description="THAI CHARACTER KHOMUT", direction="l", @@ -43684,6 +44803,7 @@ characters.data={ unicodeslot=0x1DFF, }, [0x1E00]={ + adobename="Aringbelow", category="lu", description="LATIN CAPITAL LETTER A WITH RING BELOW", direction="l", @@ -43694,6 +44814,7 @@ characters.data={ unicodeslot=0x1E00, }, [0x1E01]={ + adobename="aringbelow", category="ll", description="LATIN SMALL LETTER A WITH RING BELOW", direction="l", @@ -43704,6 +44825,7 @@ characters.data={ unicodeslot=0x1E01, }, [0x1E02]={ + adobename="Bdotaccent", category="lu", description="LATIN CAPITAL LETTER B WITH DOT ABOVE", direction="l", @@ -43714,6 +44836,7 @@ characters.data={ unicodeslot=0x1E02, }, [0x1E03]={ + adobename="bdotaccent", category="ll", description="LATIN SMALL LETTER B WITH DOT ABOVE", direction="l", @@ -43724,6 +44847,7 @@ characters.data={ unicodeslot=0x1E03, }, [0x1E04]={ + adobename="Bdotbelow", category="lu", description="LATIN CAPITAL LETTER B WITH DOT BELOW", direction="l", @@ -43734,6 +44858,7 @@ characters.data={ unicodeslot=0x1E04, }, [0x1E05]={ + adobename="bdotbelow", category="ll", description="LATIN SMALL LETTER B WITH DOT BELOW", direction="l", @@ -43744,6 +44869,7 @@ characters.data={ unicodeslot=0x1E05, }, [0x1E06]={ + adobename="Blinebelow", category="lu", description="LATIN CAPITAL LETTER B WITH LINE BELOW", direction="l", @@ -43754,6 +44880,7 @@ characters.data={ unicodeslot=0x1E06, }, [0x1E07]={ + adobename="blinebelow", category="ll", description="LATIN SMALL LETTER B WITH LINE BELOW", direction="l", @@ -43764,6 +44891,7 @@ characters.data={ unicodeslot=0x1E07, }, [0x1E08]={ + adobename="Ccedillaacute", category="lu", description="LATIN CAPITAL LETTER C WITH CEDILLA AND ACUTE", direction="l", @@ -43774,6 +44902,7 @@ characters.data={ unicodeslot=0x1E08, }, [0x1E09]={ + adobename="ccedillaacute", category="ll", description="LATIN SMALL LETTER C WITH CEDILLA AND ACUTE", direction="l", @@ -43784,6 +44913,7 @@ characters.data={ unicodeslot=0x1E09, }, [0x1E0A]={ + adobename="Ddotaccent", category="lu", description="LATIN CAPITAL LETTER D WITH DOT ABOVE", direction="l", @@ -43794,6 +44924,7 @@ characters.data={ unicodeslot=0x1E0A, }, [0x1E0B]={ + adobename="ddotaccent", category="ll", description="LATIN SMALL LETTER D WITH DOT ABOVE", direction="l", @@ -43804,6 +44935,7 @@ characters.data={ unicodeslot=0x1E0B, }, [0x1E0C]={ + adobename="Ddotbelow", category="lu", description="LATIN CAPITAL LETTER D WITH DOT BELOW", direction="l", @@ -43814,6 +44946,7 @@ characters.data={ unicodeslot=0x1E0C, }, [0x1E0D]={ + adobename="ddotbelow", category="ll", description="LATIN SMALL LETTER D WITH DOT BELOW", direction="l", @@ -43824,6 +44957,7 @@ characters.data={ unicodeslot=0x1E0D, }, [0x1E0E]={ + adobename="Dlinebelow", category="lu", description="LATIN CAPITAL LETTER D WITH LINE BELOW", direction="l", @@ -43834,6 +44968,7 @@ characters.data={ unicodeslot=0x1E0E, }, [0x1E0F]={ + adobename="dlinebelow", category="ll", description="LATIN SMALL LETTER D WITH LINE BELOW", direction="l", @@ -43844,6 +44979,7 @@ characters.data={ unicodeslot=0x1E0F, }, [0x1E10]={ + adobename="Dcedilla", category="lu", description="LATIN CAPITAL LETTER D WITH CEDILLA", direction="l", @@ -43854,6 +44990,7 @@ characters.data={ unicodeslot=0x1E10, }, [0x1E11]={ + adobename="dcedilla", category="ll", description="LATIN SMALL LETTER D WITH CEDILLA", direction="l", @@ -43864,6 +45001,7 @@ characters.data={ unicodeslot=0x1E11, }, [0x1E12]={ + adobename="Dcircumflexbelow", category="lu", description="LATIN CAPITAL LETTER D WITH CIRCUMFLEX BELOW", direction="l", @@ -43874,6 +45012,7 @@ characters.data={ unicodeslot=0x1E12, }, [0x1E13]={ + adobename="dcircumflexbelow", category="ll", description="LATIN SMALL LETTER D WITH CIRCUMFLEX BELOW", direction="l", @@ -43884,6 +45023,7 @@ characters.data={ unicodeslot=0x1E13, }, [0x1E14]={ + adobename="Emacrongrave", category="lu", description="LATIN CAPITAL LETTER E WITH MACRON AND GRAVE", direction="l", @@ -43894,6 +45034,7 @@ characters.data={ unicodeslot=0x1E14, }, [0x1E15]={ + adobename="emacrongrave", category="ll", description="LATIN SMALL LETTER E WITH MACRON AND GRAVE", direction="l", @@ -43904,6 +45045,7 @@ characters.data={ unicodeslot=0x1E15, }, [0x1E16]={ + adobename="Emacronacute", category="lu", description="LATIN CAPITAL LETTER E WITH MACRON AND ACUTE", direction="l", @@ -43914,6 +45056,7 @@ characters.data={ unicodeslot=0x1E16, }, [0x1E17]={ + adobename="emacronacute", category="ll", description="LATIN SMALL LETTER E WITH MACRON AND ACUTE", direction="l", @@ -43924,6 +45067,7 @@ characters.data={ unicodeslot=0x1E17, }, [0x1E18]={ + adobename="Ecircumflexbelow", category="lu", description="LATIN CAPITAL LETTER E WITH CIRCUMFLEX BELOW", direction="l", @@ -43934,6 +45078,7 @@ characters.data={ unicodeslot=0x1E18, }, [0x1E19]={ + adobename="ecircumflexbelow", category="ll", description="LATIN SMALL LETTER E WITH CIRCUMFLEX BELOW", direction="l", @@ -43944,6 +45089,7 @@ characters.data={ unicodeslot=0x1E19, }, [0x1E1A]={ + adobename="Etildebelow", category="lu", description="LATIN CAPITAL LETTER E WITH TILDE BELOW", direction="l", @@ -43954,6 +45100,7 @@ characters.data={ unicodeslot=0x1E1A, }, [0x1E1B]={ + adobename="etildebelow", category="ll", description="LATIN SMALL LETTER E WITH TILDE BELOW", direction="l", @@ -43964,6 +45111,7 @@ characters.data={ unicodeslot=0x1E1B, }, [0x1E1C]={ + adobename="Ecedillabreve", category="lu", description="LATIN CAPITAL LETTER E WITH CEDILLA AND BREVE", direction="l", @@ -43974,6 +45122,7 @@ characters.data={ unicodeslot=0x1E1C, }, [0x1E1D]={ + adobename="ecedillabreve", category="ll", description="LATIN SMALL LETTER E WITH CEDILLA AND BREVE", direction="l", @@ -43984,6 +45133,7 @@ characters.data={ unicodeslot=0x1E1D, }, [0x1E1E]={ + adobename="Fdotaccent", category="lu", description="LATIN CAPITAL LETTER F WITH DOT ABOVE", direction="l", @@ -43994,6 +45144,7 @@ characters.data={ unicodeslot=0x1E1E, }, [0x1E1F]={ + adobename="fdotaccent", category="ll", description="LATIN SMALL LETTER F WITH DOT ABOVE", direction="l", @@ -44004,6 +45155,7 @@ characters.data={ unicodeslot=0x1E1F, }, [0x1E20]={ + adobename="Gmacron", category="lu", description="LATIN CAPITAL LETTER G WITH MACRON", direction="l", @@ -44014,6 +45166,7 @@ characters.data={ unicodeslot=0x1E20, }, [0x1E21]={ + adobename="gmacron", category="ll", description="LATIN SMALL LETTER G WITH MACRON", direction="l", @@ -44024,6 +45177,7 @@ characters.data={ unicodeslot=0x1E21, }, [0x1E22]={ + adobename="Hdotaccent", category="lu", description="LATIN CAPITAL LETTER H WITH DOT ABOVE", direction="l", @@ -44034,6 +45188,7 @@ characters.data={ unicodeslot=0x1E22, }, [0x1E23]={ + adobename="hdotaccent", category="ll", description="LATIN SMALL LETTER H WITH DOT ABOVE", direction="l", @@ -44044,6 +45199,7 @@ characters.data={ unicodeslot=0x1E23, }, [0x1E24]={ + adobename="Hdotbelow", category="lu", description="LATIN CAPITAL LETTER H WITH DOT BELOW", direction="l", @@ -44054,6 +45210,7 @@ characters.data={ unicodeslot=0x1E24, }, [0x1E25]={ + adobename="hdotbelow", category="ll", description="LATIN SMALL LETTER H WITH DOT BELOW", direction="l", @@ -44064,6 +45221,7 @@ characters.data={ unicodeslot=0x1E25, }, [0x1E26]={ + adobename="Hdieresis", category="lu", description="LATIN CAPITAL LETTER H WITH DIAERESIS", direction="l", @@ -44074,6 +45232,7 @@ characters.data={ unicodeslot=0x1E26, }, [0x1E27]={ + adobename="hdieresis", category="ll", description="LATIN SMALL LETTER H WITH DIAERESIS", direction="l", @@ -44084,6 +45243,7 @@ characters.data={ unicodeslot=0x1E27, }, [0x1E28]={ + adobename="Hcedilla", category="lu", description="LATIN CAPITAL LETTER H WITH CEDILLA", direction="l", @@ -44094,6 +45254,7 @@ characters.data={ unicodeslot=0x1E28, }, [0x1E29]={ + adobename="hcedilla", category="ll", description="LATIN SMALL LETTER H WITH CEDILLA", direction="l", @@ -44104,6 +45265,7 @@ characters.data={ unicodeslot=0x1E29, }, [0x1E2A]={ + adobename="Hbrevebelow", category="lu", description="LATIN CAPITAL LETTER H WITH BREVE BELOW", direction="l", @@ -44114,6 +45276,7 @@ characters.data={ unicodeslot=0x1E2A, }, [0x1E2B]={ + adobename="hbrevebelow", category="ll", description="LATIN SMALL LETTER H WITH BREVE BELOW", direction="l", @@ -44124,6 +45287,7 @@ characters.data={ unicodeslot=0x1E2B, }, [0x1E2C]={ + adobename="Itildebelow", category="lu", description="LATIN CAPITAL LETTER I WITH TILDE BELOW", direction="l", @@ -44134,6 +45298,7 @@ characters.data={ unicodeslot=0x1E2C, }, [0x1E2D]={ + adobename="itildebelow", category="ll", description="LATIN SMALL LETTER I WITH TILDE BELOW", direction="l", @@ -44144,6 +45309,7 @@ characters.data={ unicodeslot=0x1E2D, }, [0x1E2E]={ + adobename="Idieresisacute", category="lu", description="LATIN CAPITAL LETTER I WITH DIAERESIS AND ACUTE", direction="l", @@ -44154,6 +45320,7 @@ characters.data={ unicodeslot=0x1E2E, }, [0x1E2F]={ + adobename="idieresisacute", category="ll", description="LATIN SMALL LETTER I WITH DIAERESIS AND ACUTE", direction="l", @@ -44164,6 +45331,7 @@ characters.data={ unicodeslot=0x1E2F, }, [0x1E30]={ + adobename="Kacute", category="lu", description="LATIN CAPITAL LETTER K WITH ACUTE", direction="l", @@ -44174,6 +45342,7 @@ characters.data={ unicodeslot=0x1E30, }, [0x1E31]={ + adobename="kacute", category="ll", description="LATIN SMALL LETTER K WITH ACUTE", direction="l", @@ -44184,6 +45353,7 @@ characters.data={ unicodeslot=0x1E31, }, [0x1E32]={ + adobename="Kdotbelow", category="lu", description="LATIN CAPITAL LETTER K WITH DOT BELOW", direction="l", @@ -44194,6 +45364,7 @@ characters.data={ unicodeslot=0x1E32, }, [0x1E33]={ + adobename="kdotbelow", category="ll", description="LATIN SMALL LETTER K WITH DOT BELOW", direction="l", @@ -44204,6 +45375,7 @@ characters.data={ unicodeslot=0x1E33, }, [0x1E34]={ + adobename="Klinebelow", category="lu", description="LATIN CAPITAL LETTER K WITH LINE BELOW", direction="l", @@ -44214,6 +45386,7 @@ characters.data={ unicodeslot=0x1E34, }, [0x1E35]={ + adobename="klinebelow", category="ll", description="LATIN SMALL LETTER K WITH LINE BELOW", direction="l", @@ -44224,6 +45397,7 @@ characters.data={ unicodeslot=0x1E35, }, [0x1E36]={ + adobename="Ldotbelow", category="lu", description="LATIN CAPITAL LETTER L WITH DOT BELOW", direction="l", @@ -44234,6 +45408,7 @@ characters.data={ unicodeslot=0x1E36, }, [0x1E37]={ + adobename="ldotbelow", category="ll", description="LATIN SMALL LETTER L WITH DOT BELOW", direction="l", @@ -44244,6 +45419,7 @@ characters.data={ unicodeslot=0x1E37, }, [0x1E38]={ + adobename="Ldotbelowmacron", category="lu", description="LATIN CAPITAL LETTER L WITH DOT BELOW AND MACRON", direction="l", @@ -44254,6 +45430,7 @@ characters.data={ unicodeslot=0x1E38, }, [0x1E39]={ + adobename="ldotbelowmacron", category="ll", description="LATIN SMALL LETTER L WITH DOT BELOW AND MACRON", direction="l", @@ -44264,6 +45441,7 @@ characters.data={ unicodeslot=0x1E39, }, [0x1E3A]={ + adobename="Llinebelow", category="lu", description="LATIN CAPITAL LETTER L WITH LINE BELOW", direction="l", @@ -44274,6 +45452,7 @@ characters.data={ unicodeslot=0x1E3A, }, [0x1E3B]={ + adobename="llinebelow", category="ll", description="LATIN SMALL LETTER L WITH LINE BELOW", direction="l", @@ -44284,6 +45463,7 @@ characters.data={ unicodeslot=0x1E3B, }, [0x1E3C]={ + adobename="Lcircumflexbelow", category="lu", description="LATIN CAPITAL LETTER L WITH CIRCUMFLEX BELOW", direction="l", @@ -44294,6 +45474,7 @@ characters.data={ unicodeslot=0x1E3C, }, [0x1E3D]={ + adobename="lcircumflexbelow", category="ll", description="LATIN SMALL LETTER L WITH CIRCUMFLEX BELOW", direction="l", @@ -44304,6 +45485,7 @@ characters.data={ unicodeslot=0x1E3D, }, [0x1E3E]={ + adobename="Macute", category="lu", description="LATIN CAPITAL LETTER M WITH ACUTE", direction="l", @@ -44314,6 +45496,7 @@ characters.data={ unicodeslot=0x1E3E, }, [0x1E3F]={ + adobename="macute", category="ll", description="LATIN SMALL LETTER M WITH ACUTE", direction="l", @@ -44324,6 +45507,7 @@ characters.data={ unicodeslot=0x1E3F, }, [0x1E40]={ + adobename="Mdotaccent", category="lu", description="LATIN CAPITAL LETTER M WITH DOT ABOVE", direction="l", @@ -44334,6 +45518,7 @@ characters.data={ unicodeslot=0x1E40, }, [0x1E41]={ + adobename="mdotaccent", category="ll", description="LATIN SMALL LETTER M WITH DOT ABOVE", direction="l", @@ -44344,6 +45529,7 @@ characters.data={ unicodeslot=0x1E41, }, [0x1E42]={ + adobename="Mdotbelow", category="lu", description="LATIN CAPITAL LETTER M WITH DOT BELOW", direction="l", @@ -44354,6 +45540,7 @@ characters.data={ unicodeslot=0x1E42, }, [0x1E43]={ + adobename="mdotbelow", category="ll", description="LATIN SMALL LETTER M WITH DOT BELOW", direction="l", @@ -44364,6 +45551,7 @@ characters.data={ unicodeslot=0x1E43, }, [0x1E44]={ + adobename="Ndotaccent", category="lu", description="LATIN CAPITAL LETTER N WITH DOT ABOVE", direction="l", @@ -44374,6 +45562,7 @@ characters.data={ unicodeslot=0x1E44, }, [0x1E45]={ + adobename="ndotaccent", category="ll", description="LATIN SMALL LETTER N WITH DOT ABOVE", direction="l", @@ -44384,6 +45573,7 @@ characters.data={ unicodeslot=0x1E45, }, [0x1E46]={ + adobename="Ndotbelow", category="lu", description="LATIN CAPITAL LETTER N WITH DOT BELOW", direction="l", @@ -44394,6 +45584,7 @@ characters.data={ unicodeslot=0x1E46, }, [0x1E47]={ + adobename="ndotbelow", category="ll", description="LATIN SMALL LETTER N WITH DOT BELOW", direction="l", @@ -44404,6 +45595,7 @@ characters.data={ unicodeslot=0x1E47, }, [0x1E48]={ + adobename="Nlinebelow", category="lu", description="LATIN CAPITAL LETTER N WITH LINE BELOW", direction="l", @@ -44414,6 +45606,7 @@ characters.data={ unicodeslot=0x1E48, }, [0x1E49]={ + adobename="nlinebelow", category="ll", description="LATIN SMALL LETTER N WITH LINE BELOW", direction="l", @@ -44424,6 +45617,7 @@ characters.data={ unicodeslot=0x1E49, }, [0x1E4A]={ + adobename="Ncircumflexbelow", category="lu", description="LATIN CAPITAL LETTER N WITH CIRCUMFLEX BELOW", direction="l", @@ -44434,6 +45628,7 @@ characters.data={ unicodeslot=0x1E4A, }, [0x1E4B]={ + adobename="ncircumflexbelow", category="ll", description="LATIN SMALL LETTER N WITH CIRCUMFLEX BELOW", direction="l", @@ -44444,6 +45639,7 @@ characters.data={ unicodeslot=0x1E4B, }, [0x1E4C]={ + adobename="Otildeacute", category="lu", description="LATIN CAPITAL LETTER O WITH TILDE AND ACUTE", direction="l", @@ -44454,6 +45650,7 @@ characters.data={ unicodeslot=0x1E4C, }, [0x1E4D]={ + adobename="otildeacute", category="ll", description="LATIN SMALL LETTER O WITH TILDE AND ACUTE", direction="l", @@ -44464,6 +45661,7 @@ characters.data={ unicodeslot=0x1E4D, }, [0x1E4E]={ + adobename="Otildedieresis", category="lu", description="LATIN CAPITAL LETTER O WITH TILDE AND DIAERESIS", direction="l", @@ -44474,6 +45672,7 @@ characters.data={ unicodeslot=0x1E4E, }, [0x1E4F]={ + adobename="otildedieresis", category="ll", description="LATIN SMALL LETTER O WITH TILDE AND DIAERESIS", direction="l", @@ -44484,6 +45683,7 @@ characters.data={ unicodeslot=0x1E4F, }, [0x1E50]={ + adobename="Omacrongrave", category="lu", description="LATIN CAPITAL LETTER O WITH MACRON AND GRAVE", direction="l", @@ -44494,6 +45694,7 @@ characters.data={ unicodeslot=0x1E50, }, [0x1E51]={ + adobename="omacrongrave", category="ll", description="LATIN SMALL LETTER O WITH MACRON AND GRAVE", direction="l", @@ -44504,6 +45705,7 @@ characters.data={ unicodeslot=0x1E51, }, [0x1E52]={ + adobename="Omacronacute", category="lu", description="LATIN CAPITAL LETTER O WITH MACRON AND ACUTE", direction="l", @@ -44514,6 +45716,7 @@ characters.data={ unicodeslot=0x1E52, }, [0x1E53]={ + adobename="omacronacute", category="ll", description="LATIN SMALL LETTER O WITH MACRON AND ACUTE", direction="l", @@ -44524,6 +45727,7 @@ characters.data={ unicodeslot=0x1E53, }, [0x1E54]={ + adobename="Pacute", category="lu", description="LATIN CAPITAL LETTER P WITH ACUTE", direction="l", @@ -44534,6 +45738,7 @@ characters.data={ unicodeslot=0x1E54, }, [0x1E55]={ + adobename="pacute", category="ll", description="LATIN SMALL LETTER P WITH ACUTE", direction="l", @@ -44544,6 +45749,7 @@ characters.data={ unicodeslot=0x1E55, }, [0x1E56]={ + adobename="Pdotaccent", category="lu", description="LATIN CAPITAL LETTER P WITH DOT ABOVE", direction="l", @@ -44554,6 +45760,7 @@ characters.data={ unicodeslot=0x1E56, }, [0x1E57]={ + adobename="pdotaccent", category="ll", description="LATIN SMALL LETTER P WITH DOT ABOVE", direction="l", @@ -44564,6 +45771,7 @@ characters.data={ unicodeslot=0x1E57, }, [0x1E58]={ + adobename="Rdotaccent", category="lu", description="LATIN CAPITAL LETTER R WITH DOT ABOVE", direction="l", @@ -44574,6 +45782,7 @@ characters.data={ unicodeslot=0x1E58, }, [0x1E59]={ + adobename="rdotaccent", category="ll", description="LATIN SMALL LETTER R WITH DOT ABOVE", direction="l", @@ -44584,6 +45793,7 @@ characters.data={ unicodeslot=0x1E59, }, [0x1E5A]={ + adobename="Rdotbelow", category="lu", description="LATIN CAPITAL LETTER R WITH DOT BELOW", direction="l", @@ -44594,6 +45804,7 @@ characters.data={ unicodeslot=0x1E5A, }, [0x1E5B]={ + adobename="rdotbelow", category="ll", description="LATIN SMALL LETTER R WITH DOT BELOW", direction="l", @@ -44604,6 +45815,7 @@ characters.data={ unicodeslot=0x1E5B, }, [0x1E5C]={ + adobename="Rdotbelowmacron", category="lu", description="LATIN CAPITAL LETTER R WITH DOT BELOW AND MACRON", direction="l", @@ -44614,6 +45826,7 @@ characters.data={ unicodeslot=0x1E5C, }, [0x1E5D]={ + adobename="rdotbelowmacron", category="ll", description="LATIN SMALL LETTER R WITH DOT BELOW AND MACRON", direction="l", @@ -44624,6 +45837,7 @@ characters.data={ unicodeslot=0x1E5D, }, [0x1E5E]={ + adobename="Rlinebelow", category="lu", description="LATIN CAPITAL LETTER R WITH LINE BELOW", direction="l", @@ -44634,6 +45848,7 @@ characters.data={ unicodeslot=0x1E5E, }, [0x1E5F]={ + adobename="rlinebelow", category="ll", description="LATIN SMALL LETTER R WITH LINE BELOW", direction="l", @@ -44644,6 +45859,7 @@ characters.data={ unicodeslot=0x1E5F, }, [0x1E60]={ + adobename="Sdotaccent", category="lu", description="LATIN CAPITAL LETTER S WITH DOT ABOVE", direction="l", @@ -44654,6 +45870,7 @@ characters.data={ unicodeslot=0x1E60, }, [0x1E61]={ + adobename="sdotaccent", category="ll", description="LATIN SMALL LETTER S WITH DOT ABOVE", direction="l", @@ -44664,6 +45881,7 @@ characters.data={ unicodeslot=0x1E61, }, [0x1E62]={ + adobename="Sdotbelow", category="lu", description="LATIN CAPITAL LETTER S WITH DOT BELOW", direction="l", @@ -44674,6 +45892,7 @@ characters.data={ unicodeslot=0x1E62, }, [0x1E63]={ + adobename="sdotbelow", category="ll", description="LATIN SMALL LETTER S WITH DOT BELOW", direction="l", @@ -44684,6 +45903,7 @@ characters.data={ unicodeslot=0x1E63, }, [0x1E64]={ + adobename="Sacutedotaccent", category="lu", description="LATIN CAPITAL LETTER S WITH ACUTE AND DOT ABOVE", direction="l", @@ -44694,6 +45914,7 @@ characters.data={ unicodeslot=0x1E64, }, [0x1E65]={ + adobename="sacutedotaccent", category="ll", description="LATIN SMALL LETTER S WITH ACUTE AND DOT ABOVE", direction="l", @@ -44704,6 +45925,7 @@ characters.data={ unicodeslot=0x1E65, }, [0x1E66]={ + adobename="Scarondotaccent", category="lu", description="LATIN CAPITAL LETTER S WITH CARON AND DOT ABOVE", direction="l", @@ -44714,6 +45936,7 @@ characters.data={ unicodeslot=0x1E66, }, [0x1E67]={ + adobename="scarondotaccent", category="ll", description="LATIN SMALL LETTER S WITH CARON AND DOT ABOVE", direction="l", @@ -44724,6 +45947,7 @@ characters.data={ unicodeslot=0x1E67, }, [0x1E68]={ + adobename="Sdotbelowdotaccent", category="lu", description="LATIN CAPITAL LETTER S WITH DOT BELOW AND DOT ABOVE", direction="l", @@ -44734,6 +45958,7 @@ characters.data={ unicodeslot=0x1E68, }, [0x1E69]={ + adobename="sdotbelowdotaccent", category="ll", description="LATIN SMALL LETTER S WITH DOT BELOW AND DOT ABOVE", direction="l", @@ -44744,6 +45969,7 @@ characters.data={ unicodeslot=0x1E69, }, [0x1E6A]={ + adobename="Tdotaccent", category="lu", description="LATIN CAPITAL LETTER T WITH DOT ABOVE", direction="l", @@ -44754,6 +45980,7 @@ characters.data={ unicodeslot=0x1E6A, }, [0x1E6B]={ + adobename="tdotaccent", category="ll", description="LATIN SMALL LETTER T WITH DOT ABOVE", direction="l", @@ -44764,6 +45991,7 @@ characters.data={ unicodeslot=0x1E6B, }, [0x1E6C]={ + adobename="Tdotbelow", category="lu", description="LATIN CAPITAL LETTER T WITH DOT BELOW", direction="l", @@ -44774,6 +46002,7 @@ characters.data={ unicodeslot=0x1E6C, }, [0x1E6D]={ + adobename="tdotbelow", category="ll", description="LATIN SMALL LETTER T WITH DOT BELOW", direction="l", @@ -44784,6 +46013,7 @@ characters.data={ unicodeslot=0x1E6D, }, [0x1E6E]={ + adobename="Tlinebelow", category="lu", description="LATIN CAPITAL LETTER T WITH LINE BELOW", direction="l", @@ -44794,6 +46024,7 @@ characters.data={ unicodeslot=0x1E6E, }, [0x1E6F]={ + adobename="tlinebelow", category="ll", description="LATIN SMALL LETTER T WITH LINE BELOW", direction="l", @@ -44804,6 +46035,7 @@ characters.data={ unicodeslot=0x1E6F, }, [0x1E70]={ + adobename="Tcircumflexbelow", category="lu", description="LATIN CAPITAL LETTER T WITH CIRCUMFLEX BELOW", direction="l", @@ -44814,6 +46046,7 @@ characters.data={ unicodeslot=0x1E70, }, [0x1E71]={ + adobename="tcircumflexbelow", category="ll", description="LATIN SMALL LETTER T WITH CIRCUMFLEX BELOW", direction="l", @@ -44824,6 +46057,7 @@ characters.data={ unicodeslot=0x1E71, }, [0x1E72]={ + adobename="Udieresisbelow", category="lu", description="LATIN CAPITAL LETTER U WITH DIAERESIS BELOW", direction="l", @@ -44834,6 +46068,7 @@ characters.data={ unicodeslot=0x1E72, }, [0x1E73]={ + adobename="udieresisbelow", category="ll", description="LATIN SMALL LETTER U WITH DIAERESIS BELOW", direction="l", @@ -44844,6 +46079,7 @@ characters.data={ unicodeslot=0x1E73, }, [0x1E74]={ + adobename="Utildebelow", category="lu", description="LATIN CAPITAL LETTER U WITH TILDE BELOW", direction="l", @@ -44854,6 +46090,7 @@ characters.data={ unicodeslot=0x1E74, }, [0x1E75]={ + adobename="utildebelow", category="ll", description="LATIN SMALL LETTER U WITH TILDE BELOW", direction="l", @@ -44864,6 +46101,7 @@ characters.data={ unicodeslot=0x1E75, }, [0x1E76]={ + adobename="Ucircumflexbelow", category="lu", description="LATIN CAPITAL LETTER U WITH CIRCUMFLEX BELOW", direction="l", @@ -44874,6 +46112,7 @@ characters.data={ unicodeslot=0x1E76, }, [0x1E77]={ + adobename="ucircumflexbelow", category="ll", description="LATIN SMALL LETTER U WITH CIRCUMFLEX BELOW", direction="l", @@ -44884,6 +46123,7 @@ characters.data={ unicodeslot=0x1E77, }, [0x1E78]={ + adobename="Utildeacute", category="lu", description="LATIN CAPITAL LETTER U WITH TILDE AND ACUTE", direction="l", @@ -44894,6 +46134,7 @@ characters.data={ unicodeslot=0x1E78, }, [0x1E79]={ + adobename="utildeacute", category="ll", description="LATIN SMALL LETTER U WITH TILDE AND ACUTE", direction="l", @@ -44904,6 +46145,7 @@ characters.data={ unicodeslot=0x1E79, }, [0x1E7A]={ + adobename="Umacrondieresis", category="lu", description="LATIN CAPITAL LETTER U WITH MACRON AND DIAERESIS", direction="l", @@ -44914,6 +46156,7 @@ characters.data={ unicodeslot=0x1E7A, }, [0x1E7B]={ + adobename="umacrondieresis", category="ll", description="LATIN SMALL LETTER U WITH MACRON AND DIAERESIS", direction="l", @@ -44924,6 +46167,7 @@ characters.data={ unicodeslot=0x1E7B, }, [0x1E7C]={ + adobename="Vtilde", category="lu", description="LATIN CAPITAL LETTER V WITH TILDE", direction="l", @@ -44934,6 +46178,7 @@ characters.data={ unicodeslot=0x1E7C, }, [0x1E7D]={ + adobename="vtilde", category="ll", description="LATIN SMALL LETTER V WITH TILDE", direction="l", @@ -44944,6 +46189,7 @@ characters.data={ unicodeslot=0x1E7D, }, [0x1E7E]={ + adobename="Vdotbelow", category="lu", description="LATIN CAPITAL LETTER V WITH DOT BELOW", direction="l", @@ -44954,6 +46200,7 @@ characters.data={ unicodeslot=0x1E7E, }, [0x1E7F]={ + adobename="vdotbelow", category="ll", description="LATIN SMALL LETTER V WITH DOT BELOW", direction="l", @@ -45030,6 +46277,7 @@ characters.data={ unicodeslot=0x1E85, }, [0x1E86]={ + adobename="Wdotaccent", category="lu", description="LATIN CAPITAL LETTER W WITH DOT ABOVE", direction="l", @@ -45040,6 +46288,7 @@ characters.data={ unicodeslot=0x1E86, }, [0x1E87]={ + adobename="wdotaccent", category="ll", description="LATIN SMALL LETTER W WITH DOT ABOVE", direction="l", @@ -45050,6 +46299,7 @@ characters.data={ unicodeslot=0x1E87, }, [0x1E88]={ + adobename="Wdotbelow", category="lu", description="LATIN CAPITAL LETTER W WITH DOT BELOW", direction="l", @@ -45060,6 +46310,7 @@ characters.data={ unicodeslot=0x1E88, }, [0x1E89]={ + adobename="wdotbelow", category="ll", description="LATIN SMALL LETTER W WITH DOT BELOW", direction="l", @@ -45070,6 +46321,7 @@ characters.data={ unicodeslot=0x1E89, }, [0x1E8A]={ + adobename="Xdotaccent", category="lu", description="LATIN CAPITAL LETTER X WITH DOT ABOVE", direction="l", @@ -45080,6 +46332,7 @@ characters.data={ unicodeslot=0x1E8A, }, [0x1E8B]={ + adobename="xdotaccent", category="ll", description="LATIN SMALL LETTER X WITH DOT ABOVE", direction="l", @@ -45090,6 +46343,7 @@ characters.data={ unicodeslot=0x1E8B, }, [0x1E8C]={ + adobename="Xdieresis", category="lu", description="LATIN CAPITAL LETTER X WITH DIAERESIS", direction="l", @@ -45100,6 +46354,7 @@ characters.data={ unicodeslot=0x1E8C, }, [0x1E8D]={ + adobename="xdieresis", category="ll", description="LATIN SMALL LETTER X WITH DIAERESIS", direction="l", @@ -45110,6 +46365,7 @@ characters.data={ unicodeslot=0x1E8D, }, [0x1E8E]={ + adobename="Ydotaccent", category="lu", description="LATIN CAPITAL LETTER Y WITH DOT ABOVE", direction="l", @@ -45120,6 +46376,7 @@ characters.data={ unicodeslot=0x1E8E, }, [0x1E8F]={ + adobename="ydotaccent", category="ll", description="LATIN SMALL LETTER Y WITH DOT ABOVE", direction="l", @@ -45130,6 +46387,7 @@ characters.data={ unicodeslot=0x1E8F, }, [0x1E90]={ + adobename="Zcircumflex", category="lu", description="LATIN CAPITAL LETTER Z WITH CIRCUMFLEX", direction="l", @@ -45140,6 +46398,7 @@ characters.data={ unicodeslot=0x1E90, }, [0x1E91]={ + adobename="zcircumflex", category="ll", description="LATIN SMALL LETTER Z WITH CIRCUMFLEX", direction="l", @@ -45150,6 +46409,7 @@ characters.data={ unicodeslot=0x1E91, }, [0x1E92]={ + adobename="Zdotbelow", category="lu", description="LATIN CAPITAL LETTER Z WITH DOT BELOW", direction="l", @@ -45160,6 +46420,7 @@ characters.data={ unicodeslot=0x1E92, }, [0x1E93]={ + adobename="zdotbelow", category="ll", description="LATIN SMALL LETTER Z WITH DOT BELOW", direction="l", @@ -45170,6 +46431,7 @@ characters.data={ unicodeslot=0x1E93, }, [0x1E94]={ + adobename="Zlinebelow", category="lu", description="LATIN CAPITAL LETTER Z WITH LINE BELOW", direction="l", @@ -45180,6 +46442,7 @@ characters.data={ unicodeslot=0x1E94, }, [0x1E95]={ + adobename="zlinebelow", category="ll", description="LATIN SMALL LETTER Z WITH LINE BELOW", direction="l", @@ -45190,6 +46453,7 @@ characters.data={ unicodeslot=0x1E95, }, [0x1E96]={ + adobename="hlinebelow", category="ll", description="LATIN SMALL LETTER H WITH LINE BELOW", direction="l", @@ -45199,6 +46463,7 @@ characters.data={ unicodeslot=0x1E96, }, [0x1E97]={ + adobename="tdieresis", category="ll", description="LATIN SMALL LETTER T WITH DIAERESIS", direction="l", @@ -45208,6 +46473,7 @@ characters.data={ unicodeslot=0x1E97, }, [0x1E98]={ + adobename="wring", category="ll", description="LATIN SMALL LETTER W WITH RING ABOVE", direction="l", @@ -45217,6 +46483,7 @@ characters.data={ unicodeslot=0x1E98, }, [0x1E99]={ + adobename="yring", category="ll", description="LATIN SMALL LETTER Y WITH RING ABOVE", direction="l", @@ -45226,6 +46493,7 @@ characters.data={ unicodeslot=0x1E99, }, [0x1E9A]={ + adobename="arighthalfring", category="ll", description="LATIN SMALL LETTER A WITH RIGHT HALF RING", direction="l", @@ -45235,6 +46503,7 @@ characters.data={ unicodeslot=0x1E9A, }, [0x1E9B]={ + adobename="slongdotaccent", category="ll", description="LATIN SMALL LETTER LONG S WITH DOT ABOVE", direction="l", @@ -45244,6 +46513,7 @@ characters.data={ unicodeslot=0x1E9B, }, [0x1EA0]={ + adobename="Adotbelow", category="lu", contextname="Adotbelow", description="LATIN CAPITAL LETTER A WITH DOT BELOW", @@ -45255,6 +46525,7 @@ characters.data={ unicodeslot=0x1EA0, }, [0x1EA1]={ + adobename="adotbelow", category="ll", contextname="adotbelow", description="LATIN SMALL LETTER A WITH DOT BELOW", @@ -45266,6 +46537,7 @@ characters.data={ unicodeslot=0x1EA1, }, [0x1EA2]={ + adobename="Ahookabove", category="lu", contextname="Ahook", description="LATIN CAPITAL LETTER A WITH HOOK ABOVE", @@ -45277,6 +46549,7 @@ characters.data={ unicodeslot=0x1EA2, }, [0x1EA3]={ + adobename="ahookabove", category="ll", contextname="ahook", description="LATIN SMALL LETTER A WITH HOOK ABOVE", @@ -45288,6 +46561,7 @@ characters.data={ unicodeslot=0x1EA3, }, [0x1EA4]={ + adobename="Acircumflexacute", category="lu", contextname="Acircumflexacute", description="LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE", @@ -45299,6 +46573,7 @@ characters.data={ unicodeslot=0x1EA4, }, [0x1EA5]={ + adobename="acircumflexacute", category="ll", contextname="acircumflexacute", description="LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE", @@ -45310,6 +46585,7 @@ characters.data={ unicodeslot=0x1EA5, }, [0x1EA6]={ + adobename="Acircumflexgrave", category="lu", contextname="Acircumflexgrave", description="LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE", @@ -45321,6 +46597,7 @@ characters.data={ unicodeslot=0x1EA6, }, [0x1EA7]={ + adobename="acircumflexgrave", category="ll", contextname="acircumflexgrave", description="LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE", @@ -45332,6 +46609,7 @@ characters.data={ unicodeslot=0x1EA7, }, [0x1EA8]={ + adobename="Acircumflexhookabove", category="lu", contextname="Acircumflexhook", description="LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE", @@ -45343,6 +46621,7 @@ characters.data={ unicodeslot=0x1EA8, }, [0x1EA9]={ + adobename="acircumflexhookabove", category="ll", contextname="acircumflexhook", description="LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE", @@ -45354,6 +46633,7 @@ characters.data={ unicodeslot=0x1EA9, }, [0x1EAA]={ + adobename="Acircumflextilde", category="lu", contextname="Acircumflextilde", description="LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE", @@ -45365,6 +46645,7 @@ characters.data={ unicodeslot=0x1EAA, }, [0x1EAB]={ + adobename="acircumflextilde", category="ll", contextname="acircumflextilde", description="LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE", @@ -45376,6 +46657,7 @@ characters.data={ unicodeslot=0x1EAB, }, [0x1EAC]={ + adobename="Acircumflexdotbelow", category="lu", contextname="Acircumflexdotbelow", description="LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW", @@ -45387,6 +46669,7 @@ characters.data={ unicodeslot=0x1EAC, }, [0x1EAD]={ + adobename="acircumflexdotbelow", category="ll", contextname="acircumflexdotbelow", description="LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW", @@ -45398,6 +46681,7 @@ characters.data={ unicodeslot=0x1EAD, }, [0x1EAE]={ + adobename="Abreveacute", category="lu", contextname="Abreveacute", description="LATIN CAPITAL LETTER A WITH BREVE AND ACUTE", @@ -45409,6 +46693,7 @@ characters.data={ unicodeslot=0x1EAE, }, [0x1EAF]={ + adobename="abreveacute", category="ll", contextname="abreveacute", description="LATIN SMALL LETTER A WITH BREVE AND ACUTE", @@ -45420,6 +46705,7 @@ characters.data={ unicodeslot=0x1EAF, }, [0x1EB0]={ + adobename="Abrevegrave", category="lu", contextname="Abrevegrave", description="LATIN CAPITAL LETTER A WITH BREVE AND GRAVE", @@ -45431,6 +46717,7 @@ characters.data={ unicodeslot=0x1EB0, }, [0x1EB1]={ + adobename="abrevegrave", category="ll", contextname="abrevegrave", description="LATIN SMALL LETTER A WITH BREVE AND GRAVE", @@ -45442,6 +46729,7 @@ characters.data={ unicodeslot=0x1EB1, }, [0x1EB2]={ + adobename="Abrevehookabove", category="lu", contextname="Abrevehook", description="LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE", @@ -45453,6 +46741,7 @@ characters.data={ unicodeslot=0x1EB2, }, [0x1EB3]={ + adobename="abrevehookabove", category="ll", contextname="abrevehook", description="LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE", @@ -45464,6 +46753,7 @@ characters.data={ unicodeslot=0x1EB3, }, [0x1EB4]={ + adobename="Abrevetilde", category="lu", contextname="Abrevetilde", description="LATIN CAPITAL LETTER A WITH BREVE AND TILDE", @@ -45475,6 +46765,7 @@ characters.data={ unicodeslot=0x1EB4, }, [0x1EB5]={ + adobename="abrevetilde", category="ll", contextname="abrevetilde", description="LATIN SMALL LETTER A WITH BREVE AND TILDE", @@ -45486,6 +46777,7 @@ characters.data={ unicodeslot=0x1EB5, }, [0x1EB6]={ + adobename="Abrevedotbelow", category="lu", contextname="Abrevedotbelow", description="LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW", @@ -45497,6 +46789,7 @@ characters.data={ unicodeslot=0x1EB6, }, [0x1EB7]={ + adobename="abrevedotbelow", category="ll", contextname="abrevedotbelow", description="LATIN SMALL LETTER A WITH BREVE AND DOT BELOW", @@ -45508,6 +46801,7 @@ characters.data={ unicodeslot=0x1EB7, }, [0x1EB8]={ + adobename="Edotbelow", category="lu", contextname="Edotbelow", description="LATIN CAPITAL LETTER E WITH DOT BELOW", @@ -45519,6 +46813,7 @@ characters.data={ unicodeslot=0x1EB8, }, [0x1EB9]={ + adobename="edotbelow", category="ll", contextname="edotbelow", description="LATIN SMALL LETTER E WITH DOT BELOW", @@ -45530,6 +46825,7 @@ characters.data={ unicodeslot=0x1EB9, }, [0x1EBA]={ + adobename="Ehookabove", category="lu", contextname="Ehook", description="LATIN CAPITAL LETTER E WITH HOOK ABOVE", @@ -45541,6 +46837,7 @@ characters.data={ unicodeslot=0x1EBA, }, [0x1EBB]={ + adobename="ehookabove", category="ll", contextname="ehook", description="LATIN SMALL LETTER E WITH HOOK ABOVE", @@ -45552,6 +46849,7 @@ characters.data={ unicodeslot=0x1EBB, }, [0x1EBC]={ + adobename="Etilde", category="lu", contextname="Etilde", description="LATIN CAPITAL LETTER E WITH TILDE", @@ -45563,6 +46861,7 @@ characters.data={ unicodeslot=0x1EBC, }, [0x1EBD]={ + adobename="etilde", category="ll", contextname="etilde", description="LATIN SMALL LETTER E WITH TILDE", @@ -45574,6 +46873,7 @@ characters.data={ unicodeslot=0x1EBD, }, [0x1EBE]={ + adobename="Ecircumflexacute", category="lu", contextname="Ecircumflexacute", description="LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE", @@ -45585,6 +46885,7 @@ characters.data={ unicodeslot=0x1EBE, }, [0x1EBF]={ + adobename="ecircumflexacute", category="ll", contextname="ecircumflexacute", description="LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE", @@ -45596,6 +46897,7 @@ characters.data={ unicodeslot=0x1EBF, }, [0x1EC0]={ + adobename="Ecircumflexgrave", category="lu", contextname="Ecircumflexgrave", description="LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE", @@ -45607,6 +46909,7 @@ characters.data={ unicodeslot=0x1EC0, }, [0x1EC1]={ + adobename="ecircumflexgrave", category="ll", contextname="ecircumflexgrave", description="LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE", @@ -45618,6 +46921,7 @@ characters.data={ unicodeslot=0x1EC1, }, [0x1EC2]={ + adobename="Ecircumflexhookabove", category="lu", contextname="Ecircumflexhook", description="LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE", @@ -45629,6 +46933,7 @@ characters.data={ unicodeslot=0x1EC2, }, [0x1EC3]={ + adobename="ecircumflexhookabove", category="ll", contextname="ecircumflexhook", description="LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE", @@ -45640,6 +46945,7 @@ characters.data={ unicodeslot=0x1EC3, }, [0x1EC4]={ + adobename="Ecircumflextilde", category="lu", contextname="Ecircumflextilde", description="LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE", @@ -45651,6 +46957,7 @@ characters.data={ unicodeslot=0x1EC4, }, [0x1EC5]={ + adobename="ecircumflextilde", category="ll", contextname="ecircumflextilde", description="LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE", @@ -45662,6 +46969,7 @@ characters.data={ unicodeslot=0x1EC5, }, [0x1EC6]={ + adobename="Ecircumflexdotbelow", category="lu", contextname="Ecircumflexdotbelow", description="LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW", @@ -45673,6 +46981,7 @@ characters.data={ unicodeslot=0x1EC6, }, [0x1EC7]={ + adobename="ecircumflexdotbelow", category="ll", contextname="ecircumflexdotbelow", description="LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW", @@ -45684,6 +46993,7 @@ characters.data={ unicodeslot=0x1EC7, }, [0x1EC8]={ + adobename="Ihookabove", category="lu", contextname="Ihook", description="LATIN CAPITAL LETTER I WITH HOOK ABOVE", @@ -45695,6 +47005,7 @@ characters.data={ unicodeslot=0x1EC8, }, [0x1EC9]={ + adobename="ihookabove", category="ll", contextname="ihook", description="LATIN SMALL LETTER I WITH HOOK ABOVE", @@ -45706,6 +47017,7 @@ characters.data={ unicodeslot=0x1EC9, }, [0x1ECA]={ + adobename="Idotbelow", category="lu", contextname="Idotbelow", description="LATIN CAPITAL LETTER I WITH DOT BELOW", @@ -45717,6 +47029,7 @@ characters.data={ unicodeslot=0x1ECA, }, [0x1ECB]={ + adobename="idotbelow", category="ll", contextname="idotbelow", description="LATIN SMALL LETTER I WITH DOT BELOW", @@ -45728,6 +47041,7 @@ characters.data={ unicodeslot=0x1ECB, }, [0x1ECC]={ + adobename="Odotbelow", category="lu", contextname="Odotbelow", description="LATIN CAPITAL LETTER O WITH DOT BELOW", @@ -45739,6 +47053,7 @@ characters.data={ unicodeslot=0x1ECC, }, [0x1ECD]={ + adobename="odotbelow", category="ll", contextname="odotbelow", description="LATIN SMALL LETTER O WITH DOT BELOW", @@ -45750,6 +47065,7 @@ characters.data={ unicodeslot=0x1ECD, }, [0x1ECE]={ + adobename="Ohookabove", category="lu", contextname="Ohook", description="LATIN CAPITAL LETTER O WITH HOOK ABOVE", @@ -45761,6 +47077,7 @@ characters.data={ unicodeslot=0x1ECE, }, [0x1ECF]={ + adobename="ohookabove", category="ll", contextname="ohook", description="LATIN SMALL LETTER O WITH HOOK ABOVE", @@ -45772,6 +47089,7 @@ characters.data={ unicodeslot=0x1ECF, }, [0x1ED0]={ + adobename="Ocircumflexacute", category="lu", contextname="Ocircumflexacute", description="LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE", @@ -45783,6 +47101,7 @@ characters.data={ unicodeslot=0x1ED0, }, [0x1ED1]={ + adobename="ocircumflexacute", category="ll", contextname="ocircumflexacute", description="LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE", @@ -45794,6 +47113,7 @@ characters.data={ unicodeslot=0x1ED1, }, [0x1ED2]={ + adobename="Ocircumflexgrave", category="lu", contextname="Ocircumflexgrave", description="LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE", @@ -45805,6 +47125,7 @@ characters.data={ unicodeslot=0x1ED2, }, [0x1ED3]={ + adobename="ocircumflexgrave", category="ll", contextname="ocircumflexgrave", description="LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE", @@ -45816,6 +47137,7 @@ characters.data={ unicodeslot=0x1ED3, }, [0x1ED4]={ + adobename="Ocircumflexhookabove", category="lu", contextname="Ocircumflexhook", description="LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE", @@ -45827,6 +47149,7 @@ characters.data={ unicodeslot=0x1ED4, }, [0x1ED5]={ + adobename="ocircumflexhookabove", category="ll", contextname="ocircumflexhook", description="LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE", @@ -45838,6 +47161,7 @@ characters.data={ unicodeslot=0x1ED5, }, [0x1ED6]={ + adobename="Ocircumflextilde", category="lu", contextname="Ocircumflextilde", description="LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE", @@ -45849,6 +47173,7 @@ characters.data={ unicodeslot=0x1ED6, }, [0x1ED7]={ + adobename="ocircumflextilde", category="ll", contextname="ocircumflextilde", description="LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE", @@ -45860,6 +47185,7 @@ characters.data={ unicodeslot=0x1ED7, }, [0x1ED8]={ + adobename="Ocircumflexdotbelow", category="lu", contextname="Ocircumflexdotbelow", description="LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW", @@ -45871,6 +47197,7 @@ characters.data={ unicodeslot=0x1ED8, }, [0x1ED9]={ + adobename="ocircumflexdotbelow", category="ll", contextname="ocircumflexdotbelow", description="LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW", @@ -45882,6 +47209,7 @@ characters.data={ unicodeslot=0x1ED9, }, [0x1EDA]={ + adobename="Ohornacute", category="lu", contextname="Ohornacute", description="LATIN CAPITAL LETTER O WITH HORN AND ACUTE", @@ -45893,6 +47221,7 @@ characters.data={ unicodeslot=0x1EDA, }, [0x1EDB]={ + adobename="ohornacute", category="ll", contextname="ohornacute", description="LATIN SMALL LETTER O WITH HORN AND ACUTE", @@ -45904,6 +47233,7 @@ characters.data={ unicodeslot=0x1EDB, }, [0x1EDC]={ + adobename="Ohorngrave", category="lu", contextname="Ohorngrave", description="LATIN CAPITAL LETTER O WITH HORN AND GRAVE", @@ -45915,6 +47245,7 @@ characters.data={ unicodeslot=0x1EDC, }, [0x1EDD]={ + adobename="ohorngrave", category="ll", contextname="ohorngrave", description="LATIN SMALL LETTER O WITH HORN AND GRAVE", @@ -45926,6 +47257,7 @@ characters.data={ unicodeslot=0x1EDD, }, [0x1EDE]={ + adobename="Ohornhookabove", category="lu", contextname="Ohornhook", description="LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE", @@ -45937,6 +47269,7 @@ characters.data={ unicodeslot=0x1EDE, }, [0x1EDF]={ + adobename="ohornhookabove", category="ll", contextname="ohornhook", description="LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE", @@ -45948,6 +47281,7 @@ characters.data={ unicodeslot=0x1EDF, }, [0x1EE0]={ + adobename="Ohorntilde", category="lu", contextname="Ohorntilde", description="LATIN CAPITAL LETTER O WITH HORN AND TILDE", @@ -45959,6 +47293,7 @@ characters.data={ unicodeslot=0x1EE0, }, [0x1EE1]={ + adobename="ohorntilde", category="ll", contextname="ohorntilde", description="LATIN SMALL LETTER O WITH HORN AND TILDE", @@ -45970,6 +47305,7 @@ characters.data={ unicodeslot=0x1EE1, }, [0x1EE2]={ + adobename="Ohorndotbelow", category="lu", contextname="Ohorndotbelow", description="LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW", @@ -45981,6 +47317,7 @@ characters.data={ unicodeslot=0x1EE2, }, [0x1EE3]={ + adobename="ohorndotbelow", category="ll", contextname="ohorndotbelow", description="LATIN SMALL LETTER O WITH HORN AND DOT BELOW", @@ -45992,6 +47329,7 @@ characters.data={ unicodeslot=0x1EE3, }, [0x1EE4]={ + adobename="Udotbelow", category="lu", contextname="Udotbelow", description="LATIN CAPITAL LETTER U WITH DOT BELOW", @@ -46003,6 +47341,7 @@ characters.data={ unicodeslot=0x1EE4, }, [0x1EE5]={ + adobename="udotbelow", category="ll", contextname="udotbelow", description="LATIN SMALL LETTER U WITH DOT BELOW", @@ -46014,6 +47353,7 @@ characters.data={ unicodeslot=0x1EE5, }, [0x1EE6]={ + adobename="Uhookabove", category="lu", contextname="Uhook", description="LATIN CAPITAL LETTER U WITH HOOK ABOVE", @@ -46025,6 +47365,7 @@ characters.data={ unicodeslot=0x1EE6, }, [0x1EE7]={ + adobename="uhookabove", category="ll", contextname="uhook", description="LATIN SMALL LETTER U WITH HOOK ABOVE", @@ -46036,6 +47377,7 @@ characters.data={ unicodeslot=0x1EE7, }, [0x1EE8]={ + adobename="Uhornacute", category="lu", contextname="Uhornacute", description="LATIN CAPITAL LETTER U WITH HORN AND ACUTE", @@ -46047,6 +47389,7 @@ characters.data={ unicodeslot=0x1EE8, }, [0x1EE9]={ + adobename="uhornacute", category="ll", contextname="uhornacute", description="LATIN SMALL LETTER U WITH HORN AND ACUTE", @@ -46058,6 +47401,7 @@ characters.data={ unicodeslot=0x1EE9, }, [0x1EEA]={ + adobename="Uhorngrave", category="lu", contextname="Uhorngrave", description="LATIN CAPITAL LETTER U WITH HORN AND GRAVE", @@ -46069,6 +47413,7 @@ characters.data={ unicodeslot=0x1EEA, }, [0x1EEB]={ + adobename="uhorngrave", category="ll", contextname="uhorngrave", description="LATIN SMALL LETTER U WITH HORN AND GRAVE", @@ -46080,6 +47425,7 @@ characters.data={ unicodeslot=0x1EEB, }, [0x1EEC]={ + adobename="Uhornhookabove", category="lu", contextname="Uhornhook", description="LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE", @@ -46091,6 +47437,7 @@ characters.data={ unicodeslot=0x1EEC, }, [0x1EED]={ + adobename="uhornhookabove", category="ll", contextname="uhornhook", description="LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE", @@ -46102,6 +47449,7 @@ characters.data={ unicodeslot=0x1EED, }, [0x1EEE]={ + adobename="Uhorntilde", category="lu", contextname="Uhorntilde", description="LATIN CAPITAL LETTER U WITH HORN AND TILDE", @@ -46113,6 +47461,7 @@ characters.data={ unicodeslot=0x1EEE, }, [0x1EEF]={ + adobename="uhorntilde", category="ll", contextname="uhorntilde", description="LATIN SMALL LETTER U WITH HORN AND TILDE", @@ -46124,6 +47473,7 @@ characters.data={ unicodeslot=0x1EEF, }, [0x1EF0]={ + adobename="Uhorndotbelow", category="lu", contextname="Uhorndotbelow", description="LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW", @@ -46135,6 +47485,7 @@ characters.data={ unicodeslot=0x1EF0, }, [0x1EF1]={ + adobename="uhorndotbelow", category="ll", contextname="uhorndotbelow", description="LATIN SMALL LETTER U WITH HORN AND DOT BELOW", @@ -46170,6 +47521,7 @@ characters.data={ unicodeslot=0x1EF3, }, [0x1EF4]={ + adobename="Ydotbelow", category="lu", contextname="Ydotbelow", description="LATIN CAPITAL LETTER Y WITH DOT BELOW", @@ -46181,6 +47533,7 @@ characters.data={ unicodeslot=0x1EF4, }, [0x1EF5]={ + adobename="ydotbelow", category="ll", contextname="ydotbelow", description="LATIN SMALL LETTER Y WITH DOT BELOW", @@ -46192,6 +47545,7 @@ characters.data={ unicodeslot=0x1EF5, }, [0x1EF6]={ + adobename="Yhookabove", category="lu", contextname="Yhook", description="LATIN CAPITAL LETTER Y WITH HOOK ABOVE", @@ -46203,6 +47557,7 @@ characters.data={ unicodeslot=0x1EF6, }, [0x1EF7]={ + adobename="yhookabove", category="ll", contextname="yhook", description="LATIN SMALL LETTER Y WITH HOOK ABOVE", @@ -46214,6 +47569,7 @@ characters.data={ unicodeslot=0x1EF7, }, [0x1EF8]={ + adobename="Ytilde", category="lu", contextname="Ytilde", description="LATIN CAPITAL LETTER Y WITH TILDE", @@ -46225,6 +47581,7 @@ characters.data={ unicodeslot=0x1EF8, }, [0x1EF9]={ + adobename="ytilde", category="ll", contextname="ytilde", description="LATIN SMALL LETTER Y WITH TILDE", @@ -48759,6 +50116,7 @@ characters.data={ unicodeslot=0x2001, }, [0x2002]={ + adobename="enspace", category="zs", contextname="enspace", description="EN SPACE", @@ -48840,6 +50198,7 @@ characters.data={ unicodeslot=0x200A, }, [0x200B]={ + adobename="zerowidthspace", category="cf", contextname="zerowidthspace", description="ZERO WIDTH SPACE", @@ -48848,7 +50207,7 @@ characters.data={ unicodeslot=0x200B, }, [0x200C]={ - adobename="afii61664", + adobename="zerowidthnonjoiner", category="cf", contextname="zwnj", description="ZERO WIDTH NON-JOINER", @@ -48882,6 +50241,7 @@ characters.data={ unicodeslot=0x200F, }, [0x2010]={ + adobename="hyphentwo", category="pd", cjkwd="a", description="HYPHEN", @@ -48927,7 +50287,7 @@ characters.data={ unicodeslot=0x2014, }, [0x2015]={ - adobename="afii208", + adobename="horizontalbar", category="pd", cjkwd="a", contextname="texthorizontalbar", @@ -48937,11 +50297,30 @@ characters.data={ unicodeslot=0x2015, }, [0x2016]={ + adobename="dblverticalbar", category="po", cjkwd="a", description="DOUBLE VERTICAL LINE", direction="on", linebreak="ai", + mathspec={ + { + class="delimiter", + name="Vert", + }, + { + class="nothing", + name="Arrowvert", + }, + { + class="open", + name="lVert", + }, + { + class="close", + name="rVert", + }, + }, unicodeslot=0x2016, }, [0x2017]={ @@ -49035,8 +50414,14 @@ characters.data={ direction="on", linebreak="ai", mathspec={ - { class="binary", name="dagger" }, - { class="box", name="dag" }, + { + class="binary", + name="dagger", + }, + { + class="box", + name="dag", + }, }, unicodeslot=0x2020, }, @@ -49049,8 +50434,14 @@ characters.data={ direction="on", linebreak="ai", mathspec={ - { class="binary", name="ddagger" }, - { class="box", name="ddag" }, + { + class="binary", + name="ddagger", + }, + { + class="box", + name="ddag", + }, }, unicodeslot=0x2021, }, @@ -49084,7 +50475,7 @@ characters.data={ unicodeslot=0x2024, }, [0x2025]={ - adobename="twodotenleader", + adobename="twodotleader", category="po", cjkwd="a", description="TWO DOT LEADER", @@ -49222,6 +50613,7 @@ characters.data={ unicodeslot=0x2034, }, [0x2035]={ + adobename="primereversed", category="po", cjkwd="a", description="REVERSED PRIME", @@ -49273,6 +50665,7 @@ characters.data={ unicodeslot=0x203A, }, [0x203B]={ + adobename="referencemark", category="po", cjkwd="a", description="REFERENCE MARK", @@ -49297,6 +50690,7 @@ characters.data={ unicodeslot=0x203D, }, [0x203E]={ + adobename="overline", category="po", cjkwd="a", description="OVERLINE", @@ -49327,6 +50721,7 @@ characters.data={ unicodeslot=0x2041, }, [0x2042]={ + adobename="asterism", category="po", description="ASTERISM", direction="on", @@ -49348,8 +50743,14 @@ characters.data={ direction="cs", linebreak="is", mathspec={ - { class="binary", name="slash" }, - { class="close", name="solidus" }, + { + class="binary", + name="slash", + }, + { + class="close", + name="solidus", + }, }, unicodeslot=0x2044, }, @@ -49623,6 +51024,7 @@ characters.data={ unicodeslot=0x206F, }, [0x2070]={ + adobename="zerosuperior", category="no", description="SUPERSCRIPT ZERO", direction="en", @@ -49639,6 +51041,7 @@ characters.data={ unicodeslot=0x2071, }, [0x2074]={ + adobename="foursuperior", category="no", cjkwd="a", description="SUPERSCRIPT FOUR", @@ -49648,6 +51051,7 @@ characters.data={ unicodeslot=0x2074, }, [0x2075]={ + adobename="fivesuperior", category="no", description="SUPERSCRIPT FIVE", direction="en", @@ -49656,6 +51060,7 @@ characters.data={ unicodeslot=0x2075, }, [0x2076]={ + adobename="sixsuperior", category="no", description="SUPERSCRIPT SIX", direction="en", @@ -49664,6 +51069,7 @@ characters.data={ unicodeslot=0x2076, }, [0x2077]={ + adobename="sevensuperior", category="no", description="SUPERSCRIPT SEVEN", direction="en", @@ -49672,6 +51078,7 @@ characters.data={ unicodeslot=0x2077, }, [0x2078]={ + adobename="eightsuperior", category="no", description="SUPERSCRIPT EIGHT", direction="en", @@ -49680,6 +51087,7 @@ characters.data={ unicodeslot=0x2078, }, [0x2079]={ + adobename="ninesuperior", category="no", description="SUPERSCRIPT NINE", direction="en", @@ -49688,6 +51096,7 @@ characters.data={ unicodeslot=0x2079, }, [0x207A]={ + adobename="plussuperior", category="sm", description="SUPERSCRIPT PLUS SIGN", direction="es", @@ -49704,6 +51113,7 @@ characters.data={ unicodeslot=0x207B, }, [0x207C]={ + adobename="equalsuperior", category="sm", description="SUPERSCRIPT EQUALS SIGN", direction="on", @@ -49712,6 +51122,7 @@ characters.data={ unicodeslot=0x207C, }, [0x207D]={ + adobename="parenleftsuperior", category="ps", description="SUPERSCRIPT LEFT PARENTHESIS", direction="on", @@ -49721,6 +51132,7 @@ characters.data={ unicodeslot=0x207D, }, [0x207E]={ + adobename="parenrightsuperior", category="pe", description="SUPERSCRIPT RIGHT PARENTHESIS", direction="on", @@ -49730,6 +51142,7 @@ characters.data={ unicodeslot=0x207E, }, [0x207F]={ + adobename="nsuperior", category="ll", cjkwd="a", description="SUPERSCRIPT LATIN SMALL LETTER N", @@ -49739,6 +51152,7 @@ characters.data={ unicodeslot=0x207F, }, [0x2080]={ + adobename="zeroinferior", category="no", description="SUBSCRIPT ZERO", direction="en", @@ -49747,6 +51161,7 @@ characters.data={ unicodeslot=0x2080, }, [0x2081]={ + adobename="oneinferior", category="no", cjkwd="a", description="SUBSCRIPT ONE", @@ -49756,6 +51171,7 @@ characters.data={ unicodeslot=0x2081, }, [0x2082]={ + adobename="twoinferior", category="no", cjkwd="a", description="SUBSCRIPT TWO", @@ -49765,6 +51181,7 @@ characters.data={ unicodeslot=0x2082, }, [0x2083]={ + adobename="threeinferior", category="no", cjkwd="a", description="SUBSCRIPT THREE", @@ -49774,6 +51191,7 @@ characters.data={ unicodeslot=0x2083, }, [0x2084]={ + adobename="fourinferior", category="no", cjkwd="a", description="SUBSCRIPT FOUR", @@ -49783,6 +51201,7 @@ characters.data={ unicodeslot=0x2084, }, [0x2085]={ + adobename="fiveinferior", category="no", description="SUBSCRIPT FIVE", direction="en", @@ -49791,6 +51210,7 @@ characters.data={ unicodeslot=0x2085, }, [0x2086]={ + adobename="sixinferior", category="no", description="SUBSCRIPT SIX", direction="en", @@ -49799,6 +51219,7 @@ characters.data={ unicodeslot=0x2086, }, [0x2087]={ + adobename="seveninferior", category="no", description="SUBSCRIPT SEVEN", direction="en", @@ -49807,6 +51228,7 @@ characters.data={ unicodeslot=0x2087, }, [0x2088]={ + adobename="eightinferior", category="no", description="SUBSCRIPT EIGHT", direction="en", @@ -49815,6 +51237,7 @@ characters.data={ unicodeslot=0x2088, }, [0x2089]={ + adobename="nineinferior", category="no", description="SUBSCRIPT NINE", direction="en", @@ -49847,6 +51270,7 @@ characters.data={ unicodeslot=0x208C, }, [0x208D]={ + adobename="parenleftinferior", category="ps", description="SUBSCRIPT LEFT PARENTHESIS", direction="on", @@ -49856,6 +51280,7 @@ characters.data={ unicodeslot=0x208D, }, [0x208E]={ + adobename="parenrightinferior", category="pe", description="SUBSCRIPT RIGHT PARENTHESIS", direction="on", @@ -49912,7 +51337,7 @@ characters.data={ unicodeslot=0x20A0, }, [0x20A1]={ - adobename="colonmonetary", + adobename="colonsign", category="sc", description="COLON SIGN", direction="et", @@ -49920,6 +51345,7 @@ characters.data={ unicodeslot=0x20A1, }, [0x20A2]={ + adobename="cruzeiro", category="sc", description="CRUZEIRO SIGN", direction="et", @@ -49973,6 +51399,7 @@ characters.data={ unicodeslot=0x20A8, }, [0x20A9]={ + adobename="won", category="sc", cjkwd="h", description="WON SIGN", @@ -49981,7 +51408,7 @@ characters.data={ unicodeslot=0x20A9, }, [0x20AA]={ - adobename="afii57636", + adobename="sheqelhebrew", category="sc", description="NEW SHEQEL SIGN", direction="et", @@ -49998,7 +51425,7 @@ characters.data={ unicodeslot=0x20AB, }, [0x20AC]={ - adobename="Euro", + adobename="euro", category="sc", cjkwd="a", contextname="texteuro", @@ -50171,8 +51598,14 @@ characters.data={ direction="nsm", linebreak="cm", mathspec={ - { class="default",name="bigcircle" }, - { class="binary",name="bigcircle" }, + { + class="default", + name="bigcircle", + }, + { + class="binary", + name="bigcircle", + }, }, unicodeslot=0x20DD, }, @@ -50334,10 +51767,11 @@ characters.data={ unicodeslot=0x2102, }, [0x2103]={ + adobename="centigrade", category="so", cjkwd="a", - description="DEGREE CELSIUS", contextname="textcelsius", + description="DEGREE CELSIUS", direction="on", linebreak="po", specials={ "compat", 0x00B0, 0x0043 }, @@ -50351,7 +51785,7 @@ characters.data={ unicodeslot=0x2104, }, [0x2105]={ - adobename="afii61248", + adobename="careof", category="so", cjkwd="a", description="CARE OF", @@ -50373,6 +51807,8 @@ characters.data={ description="EULER CONSTANT", direction="l", linebreak="al", + mathclass="variable", + mathname="Eulerconst", specials={ "compat", 0x0190 }, unicodeslot=0x2107, }, @@ -50384,6 +51820,7 @@ characters.data={ unicodeslot=0x2108, }, [0x2109]={ + adobename="fahrenheit", category="so", cjkwd="a", description="DEGREE FAHRENHEIT", @@ -50429,6 +51866,8 @@ characters.data={ description="PLANCK CONSTANT", direction="l", linebreak="al", + mathclass="variable", + mathname="Plankconst", specials={ "font", 0x0068 }, unicodeslot=0x210E, }, @@ -50470,7 +51909,7 @@ characters.data={ unicodeslot=0x2112, }, [0x2113]={ - adobename="afii61289", + adobename="lsquare", category="ll", cjkwd="a", description="SCRIPT SMALL L", @@ -50499,7 +51938,7 @@ characters.data={ unicodeslot=0x2115, }, [0x2116]={ - adobename="afii61352", + adobename="numero", category="so", cjkwd="a", contextname="textnumero", @@ -50600,6 +52039,7 @@ characters.data={ unicodeslot=0x2120, }, [0x2121]={ + adobename="telephone", category="so", cjkwd="a", description="TELEPHONE SIGN", @@ -50648,20 +52088,20 @@ characters.data={ adobename="Omega", category="lu", cjkwd="a", - description="OHM SIGN", contextname="textohm", + description="OHM SIGN", direction="l", - lccode=0x03C9, --AM: Not sure? + lccode=0x03C9, linebreak="al", mathclass="variable", - mathname="ohm", --AM: Should we do this or does specials take care of it + mathname="ohm", specials={ "char", 0x03A9 }, unicodeslot=0x2126, }, [0x2127]={ category="so", - description="INVERTED OHM SIGN", contextname="textmho", + description="INVERTED OHM SIGN", direction="on", linebreak="al", mathclass="variable", @@ -50681,24 +52121,27 @@ characters.data={ description="TURNED GREEK SMALL LETTER IOTA", direction="on", linebreak="al", + mathclass="variable", + mathname="turnediota", unicodeslot=0x2129, }, [0x212A]={ category="lu", + contextname="textkelvin", description="KELVIN SIGN", direction="l", - contextname="textkelvin", lccode=0x006B, linebreak="al", specials={ "char", 0x004B }, unicodeslot=0x212A, }, [0x212B]={ + adobename="angstrom", category="lu", cjkwd="a", + contextname="textAngstrom", description="ANGSTROM SIGN", direction="l", - contextname="textAngstrom", lccode=0x00E5, linebreak="ai", mathclass="variable", @@ -50796,7 +52239,7 @@ characters.data={ description="BET SYMBOL", direction="l", linebreak="al", - mathclass="ord", + mathclass="default", mathname="beth", specials={ "compat", 0x05D1 }, unicodeslot=0x2136, @@ -50806,7 +52249,7 @@ characters.data={ description="GIMEL SYMBOL", direction="l", linebreak="al", - mathclass="ord", + mathclass="default", mathname="gimel", specials={ "compat", 0x05D2 }, unicodeslot=0x2137, @@ -50816,7 +52259,7 @@ characters.data={ description="DALET SYMBOL", direction="l", linebreak="al", - mathclass="ord", + mathclass="default", mathname="daleth", specials={ "compat", 0x05D3 }, unicodeslot=0x2138, @@ -50895,23 +52338,29 @@ characters.data={ }, [0x2142]={ category="sm", + comment="mathname=sansLturned", description="TURNED SANS-SERIF CAPITAL L", direction="on", linebreak="al", + mathclass="ord", unicodeslot=0x2142, }, [0x2143]={ category="sm", + comment="mathname=sansLmirrored", description="REVERSED SANS-SERIF CAPITAL L", direction="on", linebreak="al", + mathclass="ord", unicodeslot=0x2143, }, [0x2144]={ category="sm", + comment="mathname=Yup", description="TURNED SANS-SERIF CAPITAL Y", direction="on", linebreak="al", + mathclass="ord", unicodeslot=0x2144, }, [0x2145]={ @@ -50969,6 +52418,8 @@ characters.data={ description="PROPERTY LINE", direction="on", linebreak="al", + mathclass="ord", + mathname="PropertyLine", unicodeslot=0x214A, }, [0x214B]={ @@ -50976,6 +52427,8 @@ characters.data={ description="TURNED AMPERSAND", direction="on", linebreak="al", + mathclass="bin", + mathname="upand", unicodeslot=0x214B, }, [0x214C]={ @@ -51129,6 +52582,7 @@ characters.data={ unicodeslot=0x215F, }, [0x2160]={ + adobename="Oneroman", category="nl", cjkwd="a", contextname="romanI", @@ -51140,6 +52594,7 @@ characters.data={ unicodeslot=0x2160, }, [0x2161]={ + adobename="Tworoman", category="nl", cjkwd="a", contextname="romanII", @@ -51151,6 +52606,7 @@ characters.data={ unicodeslot=0x2161, }, [0x2162]={ + adobename="Threeroman", category="nl", cjkwd="a", contextname="romanIII", @@ -51162,6 +52618,7 @@ characters.data={ unicodeslot=0x2162, }, [0x2163]={ + adobename="Fourroman", category="nl", cjkwd="a", contextname="romanIV", @@ -51173,6 +52630,7 @@ characters.data={ unicodeslot=0x2163, }, [0x2164]={ + adobename="Fiveroman", category="nl", cjkwd="a", contextname="romanV", @@ -51184,6 +52642,7 @@ characters.data={ unicodeslot=0x2164, }, [0x2165]={ + adobename="Sixroman", category="nl", cjkwd="a", contextname="romanVI", @@ -51195,6 +52654,7 @@ characters.data={ unicodeslot=0x2165, }, [0x2166]={ + adobename="Sevenroman", category="nl", cjkwd="a", contextname="romanVII", @@ -51206,6 +52666,7 @@ characters.data={ unicodeslot=0x2166, }, [0x2167]={ + adobename="Eightroman", category="nl", cjkwd="a", contextname="romanVIII", @@ -51217,6 +52678,7 @@ characters.data={ unicodeslot=0x2167, }, [0x2168]={ + adobename="Nineroman", category="nl", cjkwd="a", contextname="romanIX", @@ -51228,6 +52690,7 @@ characters.data={ unicodeslot=0x2168, }, [0x2169]={ + adobename="Tenroman", category="nl", cjkwd="a", contextname="romanX", @@ -51239,6 +52702,7 @@ characters.data={ unicodeslot=0x2169, }, [0x216A]={ + adobename="Elevenroman", category="nl", cjkwd="a", contextname="romanXI", @@ -51250,6 +52714,7 @@ characters.data={ unicodeslot=0x216A, }, [0x216B]={ + adobename="Twelveroman", category="nl", cjkwd="a", contextname="romanXII", @@ -51301,6 +52766,7 @@ characters.data={ unicodeslot=0x216F, }, [0x2170]={ + adobename="oneroman", category="nl", cjkwd="a", contextname="romani", @@ -51312,6 +52778,7 @@ characters.data={ unicodeslot=0x2170, }, [0x2171]={ + adobename="tworoman", category="nl", cjkwd="a", contextname="romanii", @@ -51323,6 +52790,7 @@ characters.data={ unicodeslot=0x2171, }, [0x2172]={ + adobename="threeroman", category="nl", cjkwd="a", contextname="romaniii", @@ -51334,6 +52802,7 @@ characters.data={ unicodeslot=0x2172, }, [0x2173]={ + adobename="fourroman", category="nl", cjkwd="a", contextname="romaniv", @@ -51345,6 +52814,7 @@ characters.data={ unicodeslot=0x2173, }, [0x2174]={ + adobename="fiveroman", category="nl", cjkwd="a", contextname="romanv", @@ -51356,6 +52826,7 @@ characters.data={ unicodeslot=0x2174, }, [0x2175]={ + adobename="sixroman", category="nl", cjkwd="a", contextname="romanvi", @@ -51367,6 +52838,7 @@ characters.data={ unicodeslot=0x2175, }, [0x2176]={ + adobename="sevenroman", category="nl", cjkwd="a", contextname="romanvii", @@ -51378,6 +52850,7 @@ characters.data={ unicodeslot=0x2176, }, [0x2177]={ + adobename="eightroman", category="nl", cjkwd="a", contextname="romanviii", @@ -51389,6 +52862,7 @@ characters.data={ unicodeslot=0x2177, }, [0x2178]={ + adobename="nineroman", category="nl", cjkwd="a", contextname="romanix", @@ -51400,6 +52874,7 @@ characters.data={ unicodeslot=0x2178, }, [0x2179]={ + adobename="tenroman", category="nl", cjkwd="a", contextname="romanx", @@ -51411,6 +52886,7 @@ characters.data={ unicodeslot=0x2179, }, [0x217A]={ + adobename="elevenroman", category="nl", contextname="romanxi", description="SMALL ROMAN NUMERAL ELEVEN", @@ -51421,6 +52897,7 @@ characters.data={ unicodeslot=0x217A, }, [0x217B]={ + adobename="twelveroman", category="nl", contextname="romanxii", description="SMALL ROMAN NUMERAL TWELVE", @@ -51515,10 +52992,22 @@ characters.data={ direction="on", linebreak="ai", mathspec={ - { class="relation", name="leftarrow" }, - { class="relation", name="gets" }, - { class="under", name="underleftarrow" }, - { class="over", name="overleftarrow" }, + { + class="relation", + name="leftarrow", + }, + { + class="relation", + name="gets", + }, + { + class="under", + name="underleftarrow", + }, + { + class="over", + name="overleftarrow", + }, }, mathstretch="h", unicodeslot=0x2190, @@ -51542,10 +53031,22 @@ characters.data={ direction="on", linebreak="ai", mathspec={ - { class="relation",name="rightarrow" }, - { class="relation",name="to" }, - { class="under", name="underrightarrow" }, - { class="over", name="overrightarrow" }, + { + class="relation", + name="rightarrow", + }, + { + class="relation", + name="to", + }, + { + class="under", + name="underrightarrow", + }, + { + class="over", + name="overrightarrow", + }, }, mathstretch="h", unicodeslot=0x2192, @@ -51584,6 +53085,7 @@ characters.data={ unicodeslot=0x2195, }, [0x2196]={ + adobename="arrowupleft", category="so", cjkwd="a", description="NORTH WEST ARROW", @@ -51594,6 +53096,7 @@ characters.data={ unicodeslot=0x2196, }, [0x2197]={ + adobename="arrowupright", category="so", cjkwd="a", description="NORTH EAST ARROW", @@ -51604,6 +53107,7 @@ characters.data={ unicodeslot=0x2197, }, [0x2198]={ + adobename="arrowdownright", category="so", cjkwd="a", description="SOUTH EAST ARROW", @@ -51614,6 +53118,7 @@ characters.data={ unicodeslot=0x2198, }, [0x2199]={ + adobename="arrowdownleft", category="so", cjkwd="a", description="SOUTH WEST ARROW", @@ -51648,6 +53153,8 @@ characters.data={ description="LEFTWARDS WAVE ARROW", direction="on", linebreak="al", + mathclass="relation", + mathname="leftwavearrow", unicodeslot=0x219C, }, [0x219D]={ @@ -51655,6 +53162,8 @@ characters.data={ description="RIGHTWARDS WAVE ARROW", direction="on", linebreak="al", + mathclass="relation", + mathname="rightwavearrow", unicodeslot=0x219D, }, [0x219E]={ @@ -51672,7 +53181,7 @@ characters.data={ direction="on", linebreak="al", mathclass="relation", - mathname="twoheadupleftarrow", + mathname="twoheaduparrow", unicodeslot=0x219F, }, [0x21A0]={ @@ -51690,7 +53199,7 @@ characters.data={ direction="on", linebreak="al", mathclass="relation", - mathname="twoheaddownleftarrow", + mathname="twoheaddownarrow", unicodeslot=0x21A1, }, [0x21A2]={ @@ -51716,6 +53225,8 @@ characters.data={ description="LEFTWARDS ARROW FROM BAR", direction="on", linebreak="al", + mathclass="relation", + mathname="mapsfrom", unicodeslot=0x21A4, }, [0x21A5]={ @@ -51723,6 +53234,8 @@ characters.data={ description="UPWARDS ARROW FROM BAR", direction="on", linebreak="al", + mathclass="relation", + mathname="mapsup", unicodeslot=0x21A5, }, [0x21A6]={ @@ -51730,7 +53243,6 @@ characters.data={ description="RIGHTWARDS ARROW FROM BAR", direction="on", linebreak="al", - fallback=[[\mapstochar\rightarrow]], mathclass="relation", mathname="mapsto", unicodeslot=0x21A6, @@ -51740,14 +53252,18 @@ characters.data={ description="DOWNWARDS ARROW FROM BAR", direction="on", linebreak="al", + mathclass="relation", + mathname="mapsdown", unicodeslot=0x21A7, }, [0x21A8]={ - adobename="arrowupdnbse", + adobename="arrowupdownbase", category="so", description="UP DOWN ARROW WITH BASE", direction="on", linebreak="al", + mathclass="ord", + mathname="updownarrowbar", unicodeslot=0x21A8, }, [0x21A9]={ @@ -51755,7 +53271,6 @@ characters.data={ description="LEFTWARDS ARROW WITH HOOK", direction="on", linebreak="al", - fallback=[[\leftarrow\joinrel\rhook]], mathclass="relation", mathname="hookleftarrow", unicodeslot=0x21A9, @@ -51765,7 +53280,6 @@ characters.data={ description="RIGHTWARDS ARROW WITH HOOK", direction="on", linebreak="al", - fallback=[[\lhook\joinrel\rightarrow]], mathclass="relation", mathname="hookrightarrow", unicodeslot=0x21AA, @@ -51812,6 +53326,8 @@ characters.data={ description="DOWNWARDS ZIGZAG ARROW", direction="on", linebreak="al", + mathclass="relation", + mathname="downzigzagarrow", unicodeslot=0x21AF, }, [0x21B0]={ @@ -51838,7 +53354,7 @@ characters.data={ direction="on", linebreak="al", mathclass="relation", - mathname="dlsh", -- from mathabx + mathname="Ldsh", unicodeslot=0x21B2, }, [0x21B3]={ @@ -51847,7 +53363,7 @@ characters.data={ direction="on", linebreak="al", mathclass="relation", - mathname="drsh", -- from mathabx + mathname="Rdsh", unicodeslot=0x21B3, }, [0x21B4]={ @@ -51855,15 +53371,19 @@ characters.data={ description="RIGHTWARDS ARROW WITH CORNER DOWNWARDS", direction="on", linebreak="al", + mathclass="ord", + mathname="linefeed", unicodeslot=0x21B4, }, [0x21B5]={ adobename="carriagereturn", - contextname="carriagereturn", category="so", + contextname="carriagereturn", description="DOWNWARDS ARROW WITH CORNER LEFTWARDS", direction="on", linebreak="al", + mathclass="ord", + mathname="carriagereturn", unicodeslot=0x21B5, }, [0x21B6]={ @@ -51890,6 +53410,8 @@ characters.data={ description="NORTH WEST ARROW TO LONG BAR", direction="on", linebreak="al", + mathclass="relation", + mathname="barovernorthwestarrow", unicodeslot=0x21B8, }, [0x21B9]={ @@ -51898,6 +53420,8 @@ characters.data={ description="LEFTWARDS ARROW TO BAR OVER RIGHTWARDS ARROW TO BAR", direction="on", linebreak="al", + mathclass="relation", + mathname="barleftarrowrightarrowbar", unicodeslot=0x21B9, }, [0x21BA]={ @@ -51905,8 +53429,16 @@ characters.data={ description="ANTICLOCKWISE OPEN CIRCLE ARROW", direction="on", linebreak="al", - mathclass="relation", - mathname="circlearrowright", + mathspec={ + { + class="relation", + name="circlearrowright", + }, + { + class="relation", + name="acwopencirclearrow", + }, + }, unicodeslot=0x21BA, }, [0x21BB]={ @@ -51914,11 +53446,20 @@ characters.data={ description="CLOCKWISE OPEN CIRCLE ARROW", direction="on", linebreak="al", - mathclass="relation", - mathname="circlearrowleft", + mathspec={ + { + class="relation", + name="circlearrowleft", + }, + { + class="relation", + name="cwopencirclearrow", + }, + }, unicodeslot=0x21BB, }, [0x21BC]={ + adobename="harpoonleftbarbup", category="so", description="LEFTWARDS HARPOON WITH BARB UPWARDS", direction="on", @@ -51942,8 +53483,14 @@ characters.data={ direction="on", linebreak="al", mathspec={ - { class="relation", name="upharpoonright" }, - { class="relation", name="restriction" }, + { + class="relation", + name="upharpoonright", + }, + { + class="relation", + name="restriction", + }, }, unicodeslot=0x21BE, }, @@ -51957,6 +53504,7 @@ characters.data={ unicodeslot=0x21BF, }, [0x21C0]={ + adobename="harpoonrightbarbup", category="so", description="RIGHTWARDS HARPOON WITH BARB UPWARDS", direction="on", @@ -51993,6 +53541,7 @@ characters.data={ unicodeslot=0x21C3, }, [0x21C4]={ + adobename="arrowrightoverleft", category="so", description="RIGHTWARDS ARROW OVER LEFTWARDS ARROW", direction="on", @@ -52002,6 +53551,7 @@ characters.data={ unicodeslot=0x21C4, }, [0x21C5]={ + adobename="arrowupleftofdown", category="so", description="UPWARDS ARROW LEFTWARDS OF DOWNWARDS ARROW", direction="on", @@ -52011,6 +53561,7 @@ characters.data={ unicodeslot=0x21C5, }, [0x21C6]={ + adobename="arrowleftoverright", category="so", description="LEFTWARDS ARROW OVER RIGHTWARDS ARROW", direction="on", @@ -52074,6 +53625,7 @@ characters.data={ unicodeslot=0x21CC, }, [0x21CD]={ + adobename="arrowleftdblstroke", category="so", description="LEFTWARDS DOUBLE ARROW WITH STROKE", direction="on", @@ -52094,6 +53646,7 @@ characters.data={ unicodeslot=0x21CE, }, [0x21CF]={ + adobename="arrowrightdblstroke", category="sm", description="RIGHTWARDS DOUBLE ARROW WITH STROKE", direction="on", @@ -52104,7 +53657,7 @@ characters.data={ unicodeslot=0x21CF, }, [0x21D0]={ - adobename="arrowdblleft", + adobename="arrowleftdbl", category="so", description="LEFTWARDS DOUBLE ARROW", direction="on", @@ -52124,7 +53677,7 @@ characters.data={ unicodeslot=0x21D1, }, [0x21D2]={ - adobename="arrowdblright", + adobename="dblarrowright", category="sm", cjkwd="a", description="RIGHTWARDS DOUBLE ARROW", @@ -52145,7 +53698,7 @@ characters.data={ unicodeslot=0x21D3, }, [0x21D4]={ - adobename="arrowdblboth", + adobename="dblarrowleft", category="sm", cjkwd="a", description="LEFT RIGHT DOUBLE ARROW", @@ -52233,107 +53786,148 @@ characters.data={ direction="on", linebreak="al", mathspec={ - { class="relation",name="rightsquigarrow" }, - { class="relation",name="leadsto" }, + { + class="relation", + name="rightsquigarrow", + }, + { + class="relation", + name="leadsto", + }, }, unicodeslot=0x21DD, }, [0x21DE]={ + adobename="pageup", category="so", description="UPWARDS ARROW WITH DOUBLE STROKE", direction="on", linebreak="al", + mathclass="relation", + mathname="nHuparrow", unicodeslot=0x21DE, }, [0x21DF]={ + adobename="pagedown", category="so", description="DOWNWARDS ARROW WITH DOUBLE STROKE", direction="on", linebreak="al", + mathclass="relation", + mathname="nHdownarrow", unicodeslot=0x21DF, }, [0x21E0]={ + adobename="arrowdashleft", category="so", description="LEFTWARDS DASHED ARROW", direction="on", linebreak="al", mathclass="relation", - mathname="dashleftarrow", + mathname="leftdasharrow", unicodeslot=0x21E0, }, [0x21E1]={ + adobename="arrowdashup", category="so", description="UPWARDS DASHED ARROW", direction="on", linebreak="al", mathclass="relation", - mathname="dashuparrow", + mathname="updasharrow", unicodeslot=0x21E1, }, [0x21E2]={ + adobename="arrowdashright", category="so", description="RIGHTWARDS DASHED ARROW", direction="on", linebreak="al", mathspec={ - { class="relation", name="dashrightarrow" } , - { class="relation", name="dasharrow" } , + { + class="relation", + name="rightdasharrow", + }, + { + class="relation", + name="dasharrow", + }, }, unicodeslot=0x21E2, }, [0x21E3]={ + adobename="arrowdashdown", category="so", description="DOWNWARDS DASHED ARROW", direction="on", linebreak="al", mathclass="relation", - mathname="dashdownarrow", + mathname="downdasharrow", unicodeslot=0x21E3, }, [0x21E4]={ + adobename="arrowtableft", category="so", description="LEFTWARDS ARROW TO BAR", direction="on", linebreak="al", + mathclass="relation", + mathname="barleftarrow", unicodeslot=0x21E4, }, [0x21E5]={ + adobename="arrowtabright", category="so", description="RIGHTWARDS ARROW TO BAR", direction="on", linebreak="al", + mathclass="relation", + mathname="rightarrowbar", unicodeslot=0x21E5, }, [0x21E6]={ + adobename="arrowleftwhite", category="so", description="LEFTWARDS WHITE ARROW", direction="on", linebreak="al", + mathclass="ord", + mathname="leftwhitearrow", unicodeslot=0x21E6, }, [0x21E7]={ + adobename="arrowupwhite", category="so", cjkwd="a", description="UPWARDS WHITE ARROW", direction="on", linebreak="al", + mathclass="ord", + mathname="upwhitearrow", unicodeslot=0x21E7, }, [0x21E8]={ + adobename="arrowrightwhite", category="so", description="RIGHTWARDS WHITE ARROW", direction="on", linebreak="al", + mathclass="ord", + mathname="rightwhitearrow", unicodeslot=0x21E8, }, [0x21E9]={ + adobename="arrowdownwhite", category="so", description="DOWNWARDS WHITE ARROW", direction="on", linebreak="al", + mathclass="ord", + mathname="downwhitearrow", unicodeslot=0x21E9, }, [0x21EA]={ + adobename="capslock", category="so", description="UPWARDS WHITE ARROW FROM BAR", direction="on", @@ -52345,6 +53939,8 @@ characters.data={ description="UPWARDS WHITE ARROW ON PEDESTAL", direction="on", linebreak="al", + mathclass="ord", + mathname="whitearrowupfrombar", unicodeslot=0x21EB, }, [0x21EC]={ @@ -52408,6 +54004,8 @@ characters.data={ description="RIGHT ARROW WITH SMALL CIRCLE", direction="on", linebreak="al", + mathclass="relation", + mathname="circleonrightarrow", unicodeslot=0x21F4, }, [0x21F5]={ @@ -52415,6 +54013,8 @@ characters.data={ description="DOWNWARDS ARROW LEFTWARDS OF UPWARDS ARROW", direction="on", linebreak="al", + mathclass="relation", + mathname="downuparrows", unicodeslot=0x21F5, }, [0x21F6]={ @@ -52422,6 +54022,8 @@ characters.data={ description="THREE RIGHTWARDS ARROWS", direction="on", linebreak="al", + mathclass="relation", + mathname="rightthreearrows", unicodeslot=0x21F6, }, [0x21F7]={ @@ -52429,6 +54031,8 @@ characters.data={ description="LEFTWARDS ARROW WITH VERTICAL STROKE", direction="on", linebreak="al", + mathclass="relation", + mathname="nvleftarrow", unicodeslot=0x21F7, }, [0x21F8]={ @@ -52436,6 +54040,8 @@ characters.data={ description="RIGHTWARDS ARROW WITH VERTICAL STROKE", direction="on", linebreak="al", + mathclass="relation", + mathname="nvrightarrow", unicodeslot=0x21F8, }, [0x21F9]={ @@ -52443,6 +54049,8 @@ characters.data={ description="LEFT RIGHT ARROW WITH VERTICAL STROKE", direction="on", linebreak="al", + mathclass="relation", + mathname="nvleftrightarrow", unicodeslot=0x21F9, }, [0x21FA]={ @@ -52450,6 +54058,8 @@ characters.data={ description="LEFTWARDS ARROW WITH DOUBLE VERTICAL STROKE", direction="on", linebreak="al", + mathclass="relation", + mathname="nVleftarrow", unicodeslot=0x21FA, }, [0x21FB]={ @@ -52457,6 +54067,8 @@ characters.data={ description="RIGHTWARDS ARROW WITH DOUBLE VERTICAL STROKE", direction="on", linebreak="al", + mathclass="relation", + mathname="nVrightarrow", unicodeslot=0x21FB, }, [0x21FC]={ @@ -52464,6 +54076,8 @@ characters.data={ description="LEFT RIGHT ARROW WITH DOUBLE VERTICAL STROKE", direction="on", linebreak="al", + mathclass="relation", + mathname="nVleftrightarrow", unicodeslot=0x21FC, }, [0x21FD]={ @@ -52525,7 +54139,7 @@ characters.data={ unicodeslot=0x2202, }, [0x2203]={ - adobename="existential", + adobename="thereexists", category="sm", cjkwd="a", description="THERE EXISTS", @@ -52556,7 +54170,7 @@ characters.data={ unicodeslot=0x2205, }, [0x2206]={ - adobename="Delta", + adobename="increment", category="sm", description="INCREMENT", direction="on", @@ -52564,7 +54178,7 @@ characters.data={ unicodeslot=0x2206, }, [0x2207]={ - adobename="gradient", + adobename="nabla", category="sm", cjkwd="a", description="NABLA", @@ -52585,14 +54199,14 @@ characters.data={ unicodeslot=0x2208, }, [0x2209]={ - adobename="notelement", + adobename="notelementof", category="sm", description="NOT AN ELEMENT OF", direction="on", linebreak="al", - mirror=0x220C, mathclass="relation", mathname="nin", + mirror=0x220C, specials={ "char", 0x2208, 0x0338 }, unicodeslot=0x2209, }, @@ -52612,23 +54226,36 @@ characters.data={ direction="on", linebreak="ai", mathspec={ - { class="relation", name="ni" }, - { class="relation", name="owns" }, + { + class="relation", + name="ni", + }, + { + class="relation", + name="owns", + }, }, mirror=0x2208, unicodeslot=0x220B, }, [0x220C]={ + adobename="notcontains", category="sm", description="DOES NOT CONTAIN AS MEMBER", direction="on", linebreak="al", - mirror=0x2209, - specials={ "char", 0x220B, 0x0338 }, mathspec={ - { class="relation", name="nni" }, - { class="relation", name="nowns" }, + { + class="relation", + name="nni", + }, + { + class="relation", + name="nowns", + }, }, + mirror=0x2209, + specials={ "char", 0x220B, 0x0338 }, unicodeslot=0x220C, }, [0x220D]={ @@ -52657,7 +54284,7 @@ characters.data={ mathname="prod", unicodeslot=0x220F, }, -[0x2210]={ + [0x2210]={ category="sm", description="N-ARY COPRODUCT", direction="on", @@ -52687,6 +54314,7 @@ characters.data={ unicodeslot=0x2212, }, [0x2213]={ + adobename="minusplus", category="sm", description="MINUS-OR-PLUS SIGN", direction="et", @@ -52705,26 +54333,27 @@ characters.data={ unicodeslot=0x2214, }, [0x2215]={ + adobename="divisionslash", category="sm", cjkwd="a", + comment="mathclass=ord,mathname=diagup", description="DIVISION SLASH", direction="on", linebreak="ai", - --~ mathclass="ord", - --~ mathname="diagup", mirror=0x29F5, unicodeslot=0x2215, }, - -- AM: diagup and diagdown are mapped to 2215 and 2216 by Tralics, - -- but ams uses different symbols for setminus and diagdown. [0x2216]={ category="sm", + comment="mathclass=ord,mathname=diagdown", description="SET MINUS", direction="on", linebreak="al", mathspec={ - { class="binary", name="setminus" }, - --~ { class="ord", name="diagdown" }, + { + class="binary", + name="setminus", + }, }, unicodeslot=0x2216, }, @@ -52748,6 +54377,7 @@ characters.data={ unicodeslot=0x2218, }, [0x2219]={ + adobename="bulletoperator", category="sm", description="BULLET OPERATOR", direction="on", @@ -52804,14 +54434,14 @@ characters.data={ unicodeslot=0x221E, }, [0x221F]={ - adobename="orthogonal", + adobename="rightangle", category="sm", cjkwd="a", description="RIGHT ANGLE", direction="on", + linebreak="ai", mathclass="ord", mathname="rightangle", - linebreak="ai", unicodeslot=0x221F, }, [0x2220]={ @@ -52844,6 +54474,7 @@ characters.data={ unicodeslot=0x2222, }, [0x2223]={ + adobename="divides", category="sm", cjkwd="a", description="DIVIDES", @@ -52858,29 +54489,36 @@ characters.data={ description="DOES NOT DIVIDE", direction="on", linebreak="al", - specials={ "char", 0x2223, 0x0338 }, mathspec={ - { class="binary", name="ndivides", }, - { class="relation", name="nmid", }, + { + class="binary", + name="ndivides", + }, + { + class="relation", + name="nmid", + }, }, + specials={ "char", 0x2223, 0x0338 }, unicodeslot=0x2224, }, [0x2225]={ + adobename="parallel", category="sm", cjkwd="a", description="PARALLEL TO", direction="on", linebreak="ai", mathspec={ - { class="relation", name="parallel" }, - { class="delimiter", name="Vert" }, - { class="nothing", name="Arrowvert" }, - { class="open", name="lVert" }, - { class="close", name="rVert" }, + { + class="relation", + name="parallel", + }, }, unicodeslot=0x2225, }, [0x2226]={ + adobename="notparallel", category="sm", description="NOT PARALLEL TO", direction="on", @@ -52898,8 +54536,14 @@ characters.data={ direction="on", linebreak="ai", mathspec={ - { class="binary", name="wedge" }, - { class="binary", name="land" }, + { + class="binary", + name="wedge", + }, + { + class="binary", + name="land", + }, }, unicodeslot=0x2227, }, @@ -52911,8 +54555,14 @@ characters.data={ direction="on", linebreak="ai", mathspec={ - { class="bin",name="vee" }, - { class="bin",name="lor" }, + { + class="bin", + name="vee", + }, + { + class="bin", + name="lor", + }, }, unicodeslot=0x2228, }, @@ -52946,22 +54596,35 @@ characters.data={ direction="on", linebreak="ai", mathspec={ - { class="nothing", name="intop" }, - { class="limop" , name="int" }, + { + class="nothing", + name="intop", + }, + { + class="limop", + name="int", + }, }, unicodeslot=0x222B, }, [0x222C]={ + adobename="dblintegral", category="sm", cjkwd="a", description="DOUBLE INTEGRAL", direction="on", linebreak="ai", - specials={ "compat", 0x222B, 0x222B }, mathspec={ - { class="nothing", name="iintop" }, - { class="limop" , name="iint" }, + { + class="nothing", + name="iintop", + }, + { + class="limop", + name="iint", + }, }, + specials={ "compat", 0x222B, 0x222B }, unicodeslot=0x222C, }, [0x222D]={ @@ -52969,14 +54632,21 @@ characters.data={ description="TRIPLE INTEGRAL", direction="on", linebreak="al", - specials={ "compat", 0x222B, 0x222B, 0x222B }, mathspec={ - { class="nothing", name="iiintop" }, - { class="limop" , name="iiint" }, + { + class="nothing", + name="iiintop", + }, + { + class="limop", + name="iiint", + }, }, + specials={ "compat", 0x222B, 0x222B, 0x222B }, unicodeslot=0x222D, }, [0x222E]={ + adobename="contourintegral", category="sm", cjkwd="a", description="CONTOUR INTEGRAL", @@ -53045,6 +54715,7 @@ characters.data={ unicodeslot=0x2234, }, [0x2235]={ + adobename="because", category="sm", cjkwd="a", description="BECAUSE", @@ -53055,6 +54726,7 @@ characters.data={ unicodeslot=0x2235, }, [0x2236]={ + adobename="ratio", category="sm", cjkwd="a", description="RATIO", @@ -53065,6 +54737,7 @@ characters.data={ unicodeslot=0x2236, }, [0x2237]={ + adobename="proportion", category="sm", cjkwd="a", description="PROPORTION", @@ -53107,7 +54780,7 @@ characters.data={ unicodeslot=0x223B, }, [0x223C]={ - adobename="similar", + adobename="tildeoperator", category="sm", cjkwd="a", description="TILDE OPERATOR", @@ -53119,6 +54792,7 @@ characters.data={ unicodeslot=0x223C, }, [0x223D]={ + adobename="reversedtilde", category="sm", cjkwd="a", description="REVERSED TILDE", @@ -53172,6 +54846,7 @@ characters.data={ unicodeslot=0x2242, }, [0x2243]={ + adobename="asymptoticallyequal", category="sm", description="ASYMPTOTICALLY EQUAL TO", direction="on", @@ -53186,9 +54861,9 @@ characters.data={ description="NOT ASYMPTOTICALLY EQUAL TO", direction="on", linebreak="al", - specials={ "char", 0x2243, 0x0338 }, mathclass="relation", mathname="nsimeq", + specials={ "char", 0x2243, 0x0338 }, unicodeslot=0x2244, }, [0x2245]={ @@ -53198,8 +54873,14 @@ characters.data={ direction="on", linebreak="al", mathspec={ - { class="relation", name="approxEq"}, - { class="relation", name="cong"}, + { + class="relation", + name="approxEq", + }, + { + class="relation", + name="cong", + }, }, unicodeslot=0x2245, }, @@ -53209,8 +54890,14 @@ characters.data={ direction="on", linebreak="al", mathspec={ - { class="relation", name="napproxEq"}, - { class="relation", name="ncong"}, + { + class="relation", + name="napproxEq", + }, + { + class="relation", + name="ncong", + }, }, unicodeslot=0x2246, }, @@ -53249,9 +54936,9 @@ characters.data={ category="sm", description="ALMOST EQUAL OR EQUAL TO", direction="on", + linebreak="al", mathclass="relation", mathname="approxeq", - linebreak="al", unicodeslot=0x224A, }, [0x224B]={ @@ -53262,6 +54949,7 @@ characters.data={ unicodeslot=0x224B, }, [0x224C]={ + adobename="allequal", category="sm", cjkwd="a", description="ALL EQUAL TO", @@ -53296,6 +54984,7 @@ characters.data={ unicodeslot=0x224F, }, [0x2250]={ + adobename="approaches", category="sm", description="APPROACHES THE LIMIT", direction="on", @@ -53303,35 +54992,44 @@ characters.data={ unicodeslot=0x2250, }, [0x2251]={ + adobename="geometricallyequal", category="sm", description="GEOMETRICALLY EQUAL TO", direction="on", linebreak="al", mathspec={ - { class="relation", name="doteqdot" }, - { class="relation", name="Doteq" }, + { + class="relation", + name="doteqdot", + }, + { + class="relation", + name="Doteq", + }, }, unicodeslot=0x2251, }, [0x2252]={ + adobename="approxequalorimage", category="sm", cjkwd="a", description="APPROXIMATELY EQUAL TO OR THE IMAGE OF", direction="on", linebreak="ai", - mirror=0x2253, mathclass="relation", mathname="fallingdotseq", + mirror=0x2253, unicodeslot=0x2252, }, [0x2253]={ + adobename="imageorapproximatelyequal", category="sm", description="IMAGE OF OR APPROXIMATELY EQUAL TO", direction="on", linebreak="al", - mirror=0x2252, mathclass="relation", mathname="risingdotseq", + mirror=0x2252, unicodeslot=0x2253, }, [0x2254]={ @@ -53339,9 +55037,9 @@ characters.data={ description="COLON EQUALS", direction="on", linebreak="al", - mirror=0x2255, mathclass="relation", mathname="colonequals", + mirror=0x2255, unicodeslot=0x2254, }, [0x2255]={ @@ -53349,9 +55047,9 @@ characters.data={ description="EQUALS COLON", direction="on", linebreak="al", - mirror=0x2254, mathclass="relation", mathname="equalscolon", + mirror=0x2254, unicodeslot=0x2255, }, [0x2256]={ @@ -53383,11 +55081,10 @@ characters.data={ category="sm", description="ESTIMATES", direction="on", - fallback=[[\buildrel\wedge\over=]], linebreak="al", - unicodeslot=0x2259, mathclass="relation", mathname="wedgeeq", + unicodeslot=0x2259, }, [0x225A]={ category="sm", @@ -53451,8 +55148,14 @@ characters.data={ direction="on", linebreak="ai", mathspec={ - { class="relation", name="neq" }, - { class="relation", name="ne" }, + { + class="relation", + name="neq", + }, + { + class="relation", + name="ne", + }, }, specials={ "char", 0x003D, 0x0338 }, unicodeslot=0x2260, @@ -53469,6 +55172,7 @@ characters.data={ unicodeslot=0x2261, }, [0x2262]={ + adobename="notidentical", category="sm", description="NOT IDENTICAL TO", direction="on", @@ -53493,8 +55197,14 @@ characters.data={ direction="on", linebreak="ai", mathspec={ - { class="relation", name="leq" }, - { class="relation", name="le" }, + { + class="relation", + name="leq", + }, + { + class="relation", + name="le", + }, }, mirror=0x2265, unicodeslot=0x2264, @@ -53507,13 +55217,20 @@ characters.data={ direction="on", linebreak="ai", mathspec={ - { class="relation", name="geq" }, - { class="relation", name="ge" }, + { + class="relation", + name="geq", + }, + { + class="relation", + name="ge", + }, }, mirror=0x2264, unicodeslot=0x2265, }, [0x2266]={ + adobename="lessoverequal", category="sm", cjkwd="a", description="LESS-THAN OVER EQUAL TO", @@ -53525,6 +55242,7 @@ characters.data={ unicodeslot=0x2266, }, [0x2267]={ + adobename="greateroverequal", category="sm", cjkwd="a", description="GREATER-THAN OVER EQUAL TO", @@ -53556,6 +55274,7 @@ characters.data={ unicodeslot=0x2269, }, [0x226A]={ + adobename="muchless", category="sm", cjkwd="a", description="MUCH LESS-THAN", @@ -53567,6 +55286,7 @@ characters.data={ unicodeslot=0x226A, }, [0x226B]={ + adobename="muchgreater", category="sm", cjkwd="a", description="MUCH GREATER-THAN", @@ -53597,6 +55317,7 @@ characters.data={ unicodeslot=0x226D, }, [0x226E]={ + adobename="notless", category="sm", cjkwd="a", description="NOT LESS-THAN", @@ -53609,6 +55330,7 @@ characters.data={ unicodeslot=0x226E, }, [0x226F]={ + adobename="notgreater", category="sm", cjkwd="a", description="NOT GREATER-THAN", @@ -53621,6 +55343,7 @@ characters.data={ unicodeslot=0x226F, }, [0x2270]={ + adobename="notlessnorequal", category="sm", description="NEITHER LESS-THAN NOR EQUAL TO", direction="on", @@ -53632,6 +55355,7 @@ characters.data={ unicodeslot=0x2270, }, [0x2271]={ + adobename="notgreaternorequal", category="sm", description="NEITHER GREATER-THAN NOR EQUAL TO", direction="on", @@ -53643,6 +55367,7 @@ characters.data={ unicodeslot=0x2271, }, [0x2272]={ + adobename="lessorequivalent", category="sm", description="LESS-THAN OR EQUIVALENT TO", direction="on", @@ -53653,6 +55378,7 @@ characters.data={ unicodeslot=0x2272, }, [0x2273]={ + adobename="greaterorequivalent", category="sm", description="GREATER-THAN OR EQUIVALENT TO", direction="on", @@ -53685,6 +55411,7 @@ characters.data={ unicodeslot=0x2275, }, [0x2276]={ + adobename="lessorgreater", category="sm", description="LESS-THAN OR GREATER-THAN", direction="on", @@ -53695,6 +55422,7 @@ characters.data={ unicodeslot=0x2276, }, [0x2277]={ + adobename="greaterorless", category="sm", description="GREATER-THAN OR LESS-THAN", direction="on", @@ -53716,6 +55444,7 @@ characters.data={ unicodeslot=0x2278, }, [0x2279]={ + adobename="notgreaternorless", category="sm", description="NEITHER GREATER-THAN NOR LESS-THAN", direction="on", @@ -53727,6 +55456,7 @@ characters.data={ unicodeslot=0x2279, }, [0x227A]={ + adobename="precedes", category="sm", description="PRECEDES", direction="on", @@ -53737,6 +55467,7 @@ characters.data={ unicodeslot=0x227A, }, [0x227B]={ + adobename="succeeds", category="sm", description="SUCCEEDS", direction="on", @@ -53787,6 +55518,7 @@ characters.data={ unicodeslot=0x227F, }, [0x2280]={ + adobename="notprecedes", category="sm", description="DOES NOT PRECEDE", direction="on", @@ -53798,6 +55530,7 @@ characters.data={ unicodeslot=0x2280, }, [0x2281]={ + adobename="notsucceeds", category="sm", description="DOES NOT SUCCEED", direction="on", @@ -53809,19 +55542,19 @@ characters.data={ unicodeslot=0x2281, }, [0x2282]={ - adobename="propersubset", + adobename="subset", category="sm", cjkwd="a", description="SUBSET OF", direction="on", linebreak="ai", mathclass="relation", - mathname="subset", -- Subset + mathname="subset", mirror=0x2283, unicodeslot=0x2282, }, [0x2283]={ - adobename="propersuperset", + adobename="superset", category="sm", cjkwd="a", description="SUPERSET OF", @@ -53837,19 +55570,18 @@ characters.data={ category="sm", description="NOT A SUBSET OF", direction="on", - fallback=[[\not\subset]], + linebreak="al", mathclass="relation", mathname="nsubset", - linebreak="al", mirror=0x2285, specials={ "char", 0x2282, 0x0338 }, unicodeslot=0x2284, }, [0x2285]={ + adobename="notsuperset", category="sm", description="NOT A SUPERSET OF", direction="on", - fallback=[[\not\supset]], linebreak="al", mathclass="relation", mathname="nsupset", @@ -53858,7 +55590,7 @@ characters.data={ unicodeslot=0x2285, }, [0x2286]={ - adobename="reflexsubset", + adobename="subsetorequal", category="sm", cjkwd="a", description="SUBSET OF OR EQUAL TO", @@ -53870,7 +55602,7 @@ characters.data={ unicodeslot=0x2286, }, [0x2287]={ - adobename="reflexsuperset", + adobename="supersetorequal", category="sm", cjkwd="a", description="SUPERSET OF OR EQUAL TO", @@ -53904,6 +55636,7 @@ characters.data={ unicodeslot=0x2289, }, [0x228A]={ + adobename="subsetnotequal", category="sm", description="SUBSET OF WITH NOT EQUAL TO", direction="on", @@ -53914,6 +55647,7 @@ characters.data={ unicodeslot=0x228A, }, [0x228B]={ + adobename="supersetnotequal", category="sm", description="SUPERSET OF WITH NOT EQUAL TO", direction="on", @@ -54005,7 +55739,7 @@ characters.data={ unicodeslot=0x2294, }, [0x2295]={ - adobename="circleplus", + adobename="pluscircle", category="sm", cjkwd="a", description="CIRCLED PLUS", @@ -54016,6 +55750,7 @@ characters.data={ unicodeslot=0x2295, }, [0x2296]={ + adobename="minuscircle", category="sm", description="CIRCLED MINUS", direction="on", @@ -54025,7 +55760,7 @@ characters.data={ unicodeslot=0x2296, }, [0x2297]={ - adobename="circlemultiply", + adobename="timescircle", category="sm", description="CIRCLED TIMES", direction="on", @@ -54045,6 +55780,7 @@ characters.data={ unicodeslot=0x2298, }, [0x2299]={ + adobename="circleot", category="sm", cjkwd="a", description="CIRCLED DOT OPERATOR", @@ -54137,6 +55873,7 @@ characters.data={ unicodeslot=0x22A2, }, [0x22A3]={ + adobename="tackleft", category="sm", description="LEFT TACK", direction="on", @@ -54147,6 +55884,7 @@ characters.data={ unicodeslot=0x22A3, }, [0x22A4]={ + adobename="tackdown", category="sm", description="DOWN TACK", direction="on", @@ -54163,8 +55901,14 @@ characters.data={ direction="on", linebreak="ai", mathspec={ - { class="default", name="bot" }, - { class="relation", name="perp" }, + { + class="default", + name="bot", + }, + { + class="relation", + name="perp", + }, }, unicodeslot=0x22A5, }, @@ -54181,7 +55925,6 @@ characters.data={ description="MODELS", direction="on", linebreak="al", - fallback=[[\mathrel|\joinrel=]], mathclass="relation", mathname="models", unicodeslot=0x22A7, @@ -54191,9 +55934,9 @@ characters.data={ description="TRUE", direction="on", linebreak="al", - mirror=0x2AE4, mathclass="relation", mathname="vDash", + mirror=0x2AE4, unicodeslot=0x22A8, }, [0x22A9]={ @@ -54201,9 +55944,9 @@ characters.data={ description="FORCES", direction="on", linebreak="al", - mirror=0x2AE3, mathclass="relation", mathname="Vdash", + mirror=0x2AE3, unicodeslot=0x22A9, }, [0x22AA]={ @@ -54220,9 +55963,9 @@ characters.data={ description="DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE", direction="on", linebreak="al", - mirror=0x2AE5, mathclass="relation", mathname="VDash", + mirror=0x2AE5, unicodeslot=0x22AB, }, [0x22AC]={ @@ -54391,6 +56134,7 @@ characters.data={ unicodeslot=0x22BE, }, [0x22BF]={ + adobename="righttriangle", category="sm", cjkwd="a", description="RIGHT TRIANGLE", @@ -54450,8 +56194,14 @@ characters.data={ direction="on", linebreak="al", mathspec={ - { class="binary", name="cdot" }, - { class="punctuation", name="cdotp" }, + { + class="binary", + name="cdot", + }, + { + class="punctuation", + name="cdotp", + }, }, unicodeslot=0x22C5, }, @@ -54478,10 +56228,15 @@ characters.data={ description="BOWTIE", direction="on", linebreak="al", - fallback=[[\mathrel\triangleright\joinrel\mathrel\triangleleft]], mathspec={ - { class="relation", name="bowtie" }, - { class="relation", name="Join" }, -- AM: Maybe wrong + { + class="relation", + name="bowtie", + }, + { + class="relation", + name="Join", + }, }, unicodeslot=0x22C8, }, @@ -54534,6 +56289,7 @@ characters.data={ unicodeslot=0x22CD, }, [0x22CE]={ + adobename="curlyor", category="sm", description="CURLY LOGICAL OR", direction="on", @@ -54543,6 +56299,7 @@ characters.data={ unicodeslot=0x22CE, }, [0x22CF]={ + adobename="curlyand", category="sm", description="CURLY LOGICAL AND", direction="on", @@ -54577,8 +56334,14 @@ characters.data={ direction="on", linebreak="al", mathspec={ - { class="binary", name="Cap" }, - { class="binary", name="doublecap"}, + { + class="binary", + name="Cap", + }, + { + class="binary", + name="doublecap", + }, }, unicodeslot=0x22D2, }, @@ -54588,8 +56351,14 @@ characters.data={ direction="on", linebreak="al", mathspec={ - { class="binary", name="Cup" }, - { class="binary", name="doublecup"}, + { + class="binary", + name="Cup", + }, + { + class="binary", + name="doublecup", + }, }, unicodeslot=0x22D3, }, @@ -54635,8 +56404,14 @@ characters.data={ direction="on", linebreak="al", mathspec={ - { class="relation", name="lll"}, - { class="relation", name="llless"}, + { + class="relation", + name="lll", + }, + { + class="relation", + name="llless", + }, }, mirror=0x22D9, unicodeslot=0x22D8, @@ -54647,30 +56422,38 @@ characters.data={ direction="on", linebreak="al", mathspec={ - { class="relation", name="ggg"}, - { class="relation", name="gggtr"}, + { + class="relation", + name="ggg", + }, + { + class="relation", + name="gggtr", + }, }, mirror=0x22D8, unicodeslot=0x22D9, }, [0x22DA]={ + adobename="lessequalorgreater", category="sm", description="LESS-THAN EQUAL TO OR GREATER-THAN", direction="on", linebreak="al", - mirror=0x22DB, mathclass="relation", mathname="lesseqgtr", + mirror=0x22DB, unicodeslot=0x22DA, }, [0x22DB]={ + adobename="greaterequalorless", category="sm", description="GREATER-THAN EQUAL TO OR LESS-THAN", direction="on", linebreak="al", - mirror=0x22DA, mathclass="relation", mathname="gtreqless", + mirror=0x22DA, unicodeslot=0x22DB, }, [0x22DC]={ @@ -54698,9 +56481,9 @@ characters.data={ description="EQUAL TO OR PRECEDES", direction="on", linebreak="al", - mirror=0x22DF, mathclass="relation", mathname="curlyeqprec", + mirror=0x22DF, unicodeslot=0x22DE, }, [0x22DF]={ @@ -54708,9 +56491,9 @@ characters.data={ description="EQUAL TO OR SUCCEEDS", direction="on", linebreak="al", - mirror=0x22DE, mathclass="relation", mathname="curlyeqsucc", + mirror=0x22DE, unicodeslot=0x22DF, }, [0x22E0]={ @@ -54718,9 +56501,9 @@ characters.data={ description="DOES NOT PRECEDE OR EQUAL", direction="on", linebreak="al", - mirror=0x22E1, mathclass="relation", mathname="npreccurlyeq", + mirror=0x22E1, specials={ "char", 0x227C, 0x0338 }, unicodeslot=0x22E0, }, @@ -54729,9 +56512,9 @@ characters.data={ description="DOES NOT SUCCEED OR EQUAL", direction="on", linebreak="al", - mirror=0x22E0, mathclass="relation", mathname="nsucccurlyeq", + mirror=0x22E0, specials={ "char", 0x227D, 0x0338 }, unicodeslot=0x22E1, }, @@ -54862,6 +56645,7 @@ characters.data={ unicodeslot=0x22ED, }, [0x22EE]={ + adobename="ellipsisvertical", category="sm", description="VERTICAL ELLIPSIS", direction="on", @@ -55032,6 +56816,7 @@ characters.data={ unicodeslot=0x2302, }, [0x2303]={ + adobename="control", category="so", description="UP ARROWHEAD", direction="on", @@ -55046,6 +56831,7 @@ characters.data={ unicodeslot=0x2304, }, [0x2305]={ + adobename="projective", category="so", description="PROJECTIVE", direction="on", @@ -55150,6 +56936,7 @@ characters.data={ unicodeslot=0x2311, }, [0x2312]={ + adobename="arc", category="so", cjkwd="a", description="ARC", @@ -55193,6 +56980,7 @@ characters.data={ unicodeslot=0x2317, }, [0x2318]={ + adobename="propellor", category="so", description="PLACE OF INTEREST SIGN", direction="on", @@ -55298,6 +57086,7 @@ characters.data={ unicodeslot=0x2324, }, [0x2325]={ + adobename="option", category="so", description="OPTION KEY", direction="on", @@ -55305,6 +57094,7 @@ characters.data={ unicodeslot=0x2325, }, [0x2326]={ + adobename="deleteright", category="so", description="ERASE TO THE RIGHT", direction="on", @@ -55312,6 +57102,7 @@ characters.data={ unicodeslot=0x2326, }, [0x2327]={ + adobename="clear", category="so", description="X IN A RECTANGLE BOX", direction="on", @@ -55348,6 +57139,7 @@ characters.data={ unicodeslot=0x232A, }, [0x232B]={ + adobename="deleteleft", category="so", description="ERASE TO THE LEFT", direction="on", @@ -56930,6 +58722,7 @@ characters.data={ unicodeslot=0x2422, }, [0x2423]={ + adobename="blank", category="so", description="OPEN BOX", direction="on", @@ -57035,6 +58828,7 @@ characters.data={ unicodeslot=0x244A, }, [0x2460]={ + adobename="onecircle", category="no", cjkwd="a", description="CIRCLED DIGIT ONE", @@ -57044,6 +58838,7 @@ characters.data={ unicodeslot=0x2460, }, [0x2461]={ + adobename="twocircle", category="no", cjkwd="a", description="CIRCLED DIGIT TWO", @@ -57053,6 +58848,7 @@ characters.data={ unicodeslot=0x2461, }, [0x2462]={ + adobename="threecircle", category="no", cjkwd="a", description="CIRCLED DIGIT THREE", @@ -57062,6 +58858,7 @@ characters.data={ unicodeslot=0x2462, }, [0x2463]={ + adobename="fourcircle", category="no", cjkwd="a", description="CIRCLED DIGIT FOUR", @@ -57071,6 +58868,7 @@ characters.data={ unicodeslot=0x2463, }, [0x2464]={ + adobename="fivecircle", category="no", cjkwd="a", description="CIRCLED DIGIT FIVE", @@ -57080,6 +58878,7 @@ characters.data={ unicodeslot=0x2464, }, [0x2465]={ + adobename="sixcircle", category="no", cjkwd="a", description="CIRCLED DIGIT SIX", @@ -57089,6 +58888,7 @@ characters.data={ unicodeslot=0x2465, }, [0x2466]={ + adobename="sevencircle", category="no", cjkwd="a", description="CIRCLED DIGIT SEVEN", @@ -57098,6 +58898,7 @@ characters.data={ unicodeslot=0x2466, }, [0x2467]={ + adobename="eightcircle", category="no", cjkwd="a", description="CIRCLED DIGIT EIGHT", @@ -57107,6 +58908,7 @@ characters.data={ unicodeslot=0x2467, }, [0x2468]={ + adobename="ninecircle", category="no", cjkwd="a", description="CIRCLED DIGIT NINE", @@ -57116,6 +58918,7 @@ characters.data={ unicodeslot=0x2468, }, [0x2469]={ + adobename="tencircle", category="no", cjkwd="a", description="CIRCLED NUMBER TEN", @@ -57125,6 +58928,7 @@ characters.data={ unicodeslot=0x2469, }, [0x246A]={ + adobename="elevencircle", category="no", cjkwd="a", description="CIRCLED NUMBER ELEVEN", @@ -57134,6 +58938,7 @@ characters.data={ unicodeslot=0x246A, }, [0x246B]={ + adobename="twelvecircle", category="no", cjkwd="a", description="CIRCLED NUMBER TWELVE", @@ -57143,6 +58948,7 @@ characters.data={ unicodeslot=0x246B, }, [0x246C]={ + adobename="thirteencircle", category="no", cjkwd="a", description="CIRCLED NUMBER THIRTEEN", @@ -57152,6 +58958,7 @@ characters.data={ unicodeslot=0x246C, }, [0x246D]={ + adobename="fourteencircle", category="no", cjkwd="a", description="CIRCLED NUMBER FOURTEEN", @@ -57161,6 +58968,7 @@ characters.data={ unicodeslot=0x246D, }, [0x246E]={ + adobename="fifteencircle", category="no", cjkwd="a", description="CIRCLED NUMBER FIFTEEN", @@ -57170,6 +58978,7 @@ characters.data={ unicodeslot=0x246E, }, [0x246F]={ + adobename="sixteencircle", category="no", cjkwd="a", description="CIRCLED NUMBER SIXTEEN", @@ -57179,6 +58988,7 @@ characters.data={ unicodeslot=0x246F, }, [0x2470]={ + adobename="seventeencircle", category="no", cjkwd="a", description="CIRCLED NUMBER SEVENTEEN", @@ -57188,6 +58998,7 @@ characters.data={ unicodeslot=0x2470, }, [0x2471]={ + adobename="eighteencircle", category="no", cjkwd="a", description="CIRCLED NUMBER EIGHTEEN", @@ -57197,6 +59008,7 @@ characters.data={ unicodeslot=0x2471, }, [0x2472]={ + adobename="nineteencircle", category="no", cjkwd="a", description="CIRCLED NUMBER NINETEEN", @@ -57206,6 +59018,7 @@ characters.data={ unicodeslot=0x2472, }, [0x2473]={ + adobename="twentycircle", category="no", cjkwd="a", description="CIRCLED NUMBER TWENTY", @@ -57215,6 +59028,7 @@ characters.data={ unicodeslot=0x2473, }, [0x2474]={ + adobename="oneparen", category="no", cjkwd="a", description="PARENTHESIZED DIGIT ONE", @@ -57224,6 +59038,7 @@ characters.data={ unicodeslot=0x2474, }, [0x2475]={ + adobename="twoparen", category="no", cjkwd="a", description="PARENTHESIZED DIGIT TWO", @@ -57233,6 +59048,7 @@ characters.data={ unicodeslot=0x2475, }, [0x2476]={ + adobename="threeparen", category="no", cjkwd="a", description="PARENTHESIZED DIGIT THREE", @@ -57242,6 +59058,7 @@ characters.data={ unicodeslot=0x2476, }, [0x2477]={ + adobename="fourparen", category="no", cjkwd="a", description="PARENTHESIZED DIGIT FOUR", @@ -57251,6 +59068,7 @@ characters.data={ unicodeslot=0x2477, }, [0x2478]={ + adobename="fiveparen", category="no", cjkwd="a", description="PARENTHESIZED DIGIT FIVE", @@ -57260,6 +59078,7 @@ characters.data={ unicodeslot=0x2478, }, [0x2479]={ + adobename="sixparen", category="no", cjkwd="a", description="PARENTHESIZED DIGIT SIX", @@ -57269,6 +59088,7 @@ characters.data={ unicodeslot=0x2479, }, [0x247A]={ + adobename="sevenparen", category="no", cjkwd="a", description="PARENTHESIZED DIGIT SEVEN", @@ -57278,6 +59098,7 @@ characters.data={ unicodeslot=0x247A, }, [0x247B]={ + adobename="eightparen", category="no", cjkwd="a", description="PARENTHESIZED DIGIT EIGHT", @@ -57287,6 +59108,7 @@ characters.data={ unicodeslot=0x247B, }, [0x247C]={ + adobename="nineparen", category="no", cjkwd="a", description="PARENTHESIZED DIGIT NINE", @@ -57296,6 +59118,7 @@ characters.data={ unicodeslot=0x247C, }, [0x247D]={ + adobename="tenparen", category="no", cjkwd="a", description="PARENTHESIZED NUMBER TEN", @@ -57305,6 +59128,7 @@ characters.data={ unicodeslot=0x247D, }, [0x247E]={ + adobename="elevenparen", category="no", cjkwd="a", description="PARENTHESIZED NUMBER ELEVEN", @@ -57314,6 +59138,7 @@ characters.data={ unicodeslot=0x247E, }, [0x247F]={ + adobename="twelveparen", category="no", cjkwd="a", description="PARENTHESIZED NUMBER TWELVE", @@ -57323,6 +59148,7 @@ characters.data={ unicodeslot=0x247F, }, [0x2480]={ + adobename="thirteenparen", category="no", cjkwd="a", description="PARENTHESIZED NUMBER THIRTEEN", @@ -57332,6 +59158,7 @@ characters.data={ unicodeslot=0x2480, }, [0x2481]={ + adobename="fourteenparen", category="no", cjkwd="a", description="PARENTHESIZED NUMBER FOURTEEN", @@ -57341,6 +59168,7 @@ characters.data={ unicodeslot=0x2481, }, [0x2482]={ + adobename="fifteenparen", category="no", cjkwd="a", description="PARENTHESIZED NUMBER FIFTEEN", @@ -57350,6 +59178,7 @@ characters.data={ unicodeslot=0x2482, }, [0x2483]={ + adobename="sixteenparen", category="no", cjkwd="a", description="PARENTHESIZED NUMBER SIXTEEN", @@ -57359,6 +59188,7 @@ characters.data={ unicodeslot=0x2483, }, [0x2484]={ + adobename="seventeenparen", category="no", cjkwd="a", description="PARENTHESIZED NUMBER SEVENTEEN", @@ -57368,6 +59198,7 @@ characters.data={ unicodeslot=0x2484, }, [0x2485]={ + adobename="eighteenparen", category="no", cjkwd="a", description="PARENTHESIZED NUMBER EIGHTEEN", @@ -57377,6 +59208,7 @@ characters.data={ unicodeslot=0x2485, }, [0x2486]={ + adobename="nineteenparen", category="no", cjkwd="a", description="PARENTHESIZED NUMBER NINETEEN", @@ -57386,6 +59218,7 @@ characters.data={ unicodeslot=0x2486, }, [0x2487]={ + adobename="twentyparen", category="no", cjkwd="a", description="PARENTHESIZED NUMBER TWENTY", @@ -57395,6 +59228,7 @@ characters.data={ unicodeslot=0x2487, }, [0x2488]={ + adobename="oneperiod", category="no", cjkwd="a", description="DIGIT ONE FULL STOP", @@ -57404,6 +59238,7 @@ characters.data={ unicodeslot=0x2488, }, [0x2489]={ + adobename="twoperiod", category="no", cjkwd="a", description="DIGIT TWO FULL STOP", @@ -57413,6 +59248,7 @@ characters.data={ unicodeslot=0x2489, }, [0x248A]={ + adobename="threeperiod", category="no", cjkwd="a", description="DIGIT THREE FULL STOP", @@ -57422,6 +59258,7 @@ characters.data={ unicodeslot=0x248A, }, [0x248B]={ + adobename="fourperiod", category="no", cjkwd="a", description="DIGIT FOUR FULL STOP", @@ -57431,6 +59268,7 @@ characters.data={ unicodeslot=0x248B, }, [0x248C]={ + adobename="fiveperiod", category="no", cjkwd="a", description="DIGIT FIVE FULL STOP", @@ -57440,6 +59278,7 @@ characters.data={ unicodeslot=0x248C, }, [0x248D]={ + adobename="sixperiod", category="no", cjkwd="a", description="DIGIT SIX FULL STOP", @@ -57449,6 +59288,7 @@ characters.data={ unicodeslot=0x248D, }, [0x248E]={ + adobename="sevenperiod", category="no", cjkwd="a", description="DIGIT SEVEN FULL STOP", @@ -57458,6 +59298,7 @@ characters.data={ unicodeslot=0x248E, }, [0x248F]={ + adobename="eightperiod", category="no", cjkwd="a", description="DIGIT EIGHT FULL STOP", @@ -57467,6 +59308,7 @@ characters.data={ unicodeslot=0x248F, }, [0x2490]={ + adobename="nineperiod", category="no", cjkwd="a", description="DIGIT NINE FULL STOP", @@ -57476,6 +59318,7 @@ characters.data={ unicodeslot=0x2490, }, [0x2491]={ + adobename="tenperiod", category="no", cjkwd="a", description="NUMBER TEN FULL STOP", @@ -57485,6 +59328,7 @@ characters.data={ unicodeslot=0x2491, }, [0x2492]={ + adobename="elevenperiod", category="no", cjkwd="a", description="NUMBER ELEVEN FULL STOP", @@ -57494,6 +59338,7 @@ characters.data={ unicodeslot=0x2492, }, [0x2493]={ + adobename="twelveperiod", category="no", cjkwd="a", description="NUMBER TWELVE FULL STOP", @@ -57503,6 +59348,7 @@ characters.data={ unicodeslot=0x2493, }, [0x2494]={ + adobename="thirteenperiod", category="no", cjkwd="a", description="NUMBER THIRTEEN FULL STOP", @@ -57512,6 +59358,7 @@ characters.data={ unicodeslot=0x2494, }, [0x2495]={ + adobename="fourteenperiod", category="no", cjkwd="a", description="NUMBER FOURTEEN FULL STOP", @@ -57521,6 +59368,7 @@ characters.data={ unicodeslot=0x2495, }, [0x2496]={ + adobename="fifteenperiod", category="no", cjkwd="a", description="NUMBER FIFTEEN FULL STOP", @@ -57530,6 +59378,7 @@ characters.data={ unicodeslot=0x2496, }, [0x2497]={ + adobename="sixteenperiod", category="no", cjkwd="a", description="NUMBER SIXTEEN FULL STOP", @@ -57539,6 +59388,7 @@ characters.data={ unicodeslot=0x2497, }, [0x2498]={ + adobename="seventeenperiod", category="no", cjkwd="a", description="NUMBER SEVENTEEN FULL STOP", @@ -57548,6 +59398,7 @@ characters.data={ unicodeslot=0x2498, }, [0x2499]={ + adobename="eighteenperiod", category="no", cjkwd="a", description="NUMBER EIGHTEEN FULL STOP", @@ -57557,6 +59408,7 @@ characters.data={ unicodeslot=0x2499, }, [0x249A]={ + adobename="nineteenperiod", category="no", cjkwd="a", description="NUMBER NINETEEN FULL STOP", @@ -57566,6 +59418,7 @@ characters.data={ unicodeslot=0x249A, }, [0x249B]={ + adobename="twentyperiod", category="no", cjkwd="a", description="NUMBER TWENTY FULL STOP", @@ -57575,6 +59428,7 @@ characters.data={ unicodeslot=0x249B, }, [0x249C]={ + adobename="aparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER A", @@ -57584,6 +59438,7 @@ characters.data={ unicodeslot=0x249C, }, [0x249D]={ + adobename="bparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER B", @@ -57593,6 +59448,7 @@ characters.data={ unicodeslot=0x249D, }, [0x249E]={ + adobename="cparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER C", @@ -57602,6 +59458,7 @@ characters.data={ unicodeslot=0x249E, }, [0x249F]={ + adobename="dparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER D", @@ -57611,6 +59468,7 @@ characters.data={ unicodeslot=0x249F, }, [0x24A0]={ + adobename="eparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER E", @@ -57620,6 +59478,7 @@ characters.data={ unicodeslot=0x24A0, }, [0x24A1]={ + adobename="fparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER F", @@ -57629,6 +59488,7 @@ characters.data={ unicodeslot=0x24A1, }, [0x24A2]={ + adobename="gparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER G", @@ -57638,6 +59498,7 @@ characters.data={ unicodeslot=0x24A2, }, [0x24A3]={ + adobename="hparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER H", @@ -57647,6 +59508,7 @@ characters.data={ unicodeslot=0x24A3, }, [0x24A4]={ + adobename="iparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER I", @@ -57656,6 +59518,7 @@ characters.data={ unicodeslot=0x24A4, }, [0x24A5]={ + adobename="jparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER J", @@ -57665,6 +59528,7 @@ characters.data={ unicodeslot=0x24A5, }, [0x24A6]={ + adobename="kparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER K", @@ -57674,6 +59538,7 @@ characters.data={ unicodeslot=0x24A6, }, [0x24A7]={ + adobename="lparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER L", @@ -57683,6 +59548,7 @@ characters.data={ unicodeslot=0x24A7, }, [0x24A8]={ + adobename="mparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER M", @@ -57692,6 +59558,7 @@ characters.data={ unicodeslot=0x24A8, }, [0x24A9]={ + adobename="nparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER N", @@ -57701,6 +59568,7 @@ characters.data={ unicodeslot=0x24A9, }, [0x24AA]={ + adobename="oparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER O", @@ -57710,6 +59578,7 @@ characters.data={ unicodeslot=0x24AA, }, [0x24AB]={ + adobename="pparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER P", @@ -57719,6 +59588,7 @@ characters.data={ unicodeslot=0x24AB, }, [0x24AC]={ + adobename="qparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER Q", @@ -57728,6 +59598,7 @@ characters.data={ unicodeslot=0x24AC, }, [0x24AD]={ + adobename="rparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER R", @@ -57737,6 +59608,7 @@ characters.data={ unicodeslot=0x24AD, }, [0x24AE]={ + adobename="sparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER S", @@ -57746,6 +59618,7 @@ characters.data={ unicodeslot=0x24AE, }, [0x24AF]={ + adobename="tparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER T", @@ -57755,6 +59628,7 @@ characters.data={ unicodeslot=0x24AF, }, [0x24B0]={ + adobename="uparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER U", @@ -57764,6 +59638,7 @@ characters.data={ unicodeslot=0x24B0, }, [0x24B1]={ + adobename="vparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER V", @@ -57773,6 +59648,7 @@ characters.data={ unicodeslot=0x24B1, }, [0x24B2]={ + adobename="wparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER W", @@ -57782,6 +59658,7 @@ characters.data={ unicodeslot=0x24B2, }, [0x24B3]={ + adobename="xparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER X", @@ -57791,6 +59668,7 @@ characters.data={ unicodeslot=0x24B3, }, [0x24B4]={ + adobename="yparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER Y", @@ -57800,6 +59678,7 @@ characters.data={ unicodeslot=0x24B4, }, [0x24B5]={ + adobename="zparen", category="so", cjkwd="a", description="PARENTHESIZED LATIN SMALL LETTER Z", @@ -57809,6 +59688,7 @@ characters.data={ unicodeslot=0x24B5, }, [0x24B6]={ + adobename="Acircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER A", @@ -57819,6 +59699,7 @@ characters.data={ unicodeslot=0x24B6, }, [0x24B7]={ + adobename="Bcircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER B", @@ -57829,6 +59710,7 @@ characters.data={ unicodeslot=0x24B7, }, [0x24B8]={ + adobename="Ccircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER C", @@ -57839,6 +59721,7 @@ characters.data={ unicodeslot=0x24B8, }, [0x24B9]={ + adobename="Dcircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER D", @@ -57849,6 +59732,7 @@ characters.data={ unicodeslot=0x24B9, }, [0x24BA]={ + adobename="Ecircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER E", @@ -57859,6 +59743,7 @@ characters.data={ unicodeslot=0x24BA, }, [0x24BB]={ + adobename="Fcircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER F", @@ -57869,6 +59754,7 @@ characters.data={ unicodeslot=0x24BB, }, [0x24BC]={ + adobename="Gcircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER G", @@ -57879,6 +59765,7 @@ characters.data={ unicodeslot=0x24BC, }, [0x24BD]={ + adobename="Hcircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER H", @@ -57889,6 +59776,7 @@ characters.data={ unicodeslot=0x24BD, }, [0x24BE]={ + adobename="Icircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER I", @@ -57899,6 +59787,7 @@ characters.data={ unicodeslot=0x24BE, }, [0x24BF]={ + adobename="Jcircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER J", @@ -57909,6 +59798,7 @@ characters.data={ unicodeslot=0x24BF, }, [0x24C0]={ + adobename="Kcircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER K", @@ -57919,6 +59809,7 @@ characters.data={ unicodeslot=0x24C0, }, [0x24C1]={ + adobename="Lcircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER L", @@ -57929,6 +59820,7 @@ characters.data={ unicodeslot=0x24C1, }, [0x24C2]={ + adobename="Mcircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER M", @@ -57939,6 +59831,7 @@ characters.data={ unicodeslot=0x24C2, }, [0x24C3]={ + adobename="Ncircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER N", @@ -57949,6 +59842,7 @@ characters.data={ unicodeslot=0x24C3, }, [0x24C4]={ + adobename="Ocircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER O", @@ -57959,6 +59853,7 @@ characters.data={ unicodeslot=0x24C4, }, [0x24C5]={ + adobename="Pcircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER P", @@ -57969,6 +59864,7 @@ characters.data={ unicodeslot=0x24C5, }, [0x24C6]={ + adobename="Qcircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER Q", @@ -57979,6 +59875,7 @@ characters.data={ unicodeslot=0x24C6, }, [0x24C7]={ + adobename="Rcircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER R", @@ -57991,6 +59888,7 @@ characters.data={ unicodeslot=0x24C7, }, [0x24C8]={ + adobename="Scircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER S", @@ -58003,6 +59901,7 @@ characters.data={ unicodeslot=0x24C8, }, [0x24C9]={ + adobename="Tcircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER T", @@ -58013,6 +59912,7 @@ characters.data={ unicodeslot=0x24C9, }, [0x24CA]={ + adobename="Ucircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER U", @@ -58023,6 +59923,7 @@ characters.data={ unicodeslot=0x24CA, }, [0x24CB]={ + adobename="Vcircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER V", @@ -58033,6 +59934,7 @@ characters.data={ unicodeslot=0x24CB, }, [0x24CC]={ + adobename="Wcircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER W", @@ -58043,6 +59945,7 @@ characters.data={ unicodeslot=0x24CC, }, [0x24CD]={ + adobename="Xcircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER X", @@ -58053,6 +59956,7 @@ characters.data={ unicodeslot=0x24CD, }, [0x24CE]={ + adobename="Ycircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER Y", @@ -58063,6 +59967,7 @@ characters.data={ unicodeslot=0x24CE, }, [0x24CF]={ + adobename="Zcircle", category="so", cjkwd="a", description="CIRCLED LATIN CAPITAL LETTER Z", @@ -58073,6 +59978,7 @@ characters.data={ unicodeslot=0x24CF, }, [0x24D0]={ + adobename="acircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER A", @@ -58083,6 +59989,7 @@ characters.data={ unicodeslot=0x24D0, }, [0x24D1]={ + adobename="bcircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER B", @@ -58093,6 +60000,7 @@ characters.data={ unicodeslot=0x24D1, }, [0x24D2]={ + adobename="ccircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER C", @@ -58103,6 +60011,7 @@ characters.data={ unicodeslot=0x24D2, }, [0x24D3]={ + adobename="dcircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER D", @@ -58113,6 +60022,7 @@ characters.data={ unicodeslot=0x24D3, }, [0x24D4]={ + adobename="ecircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER E", @@ -58123,6 +60033,7 @@ characters.data={ unicodeslot=0x24D4, }, [0x24D5]={ + adobename="fcircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER F", @@ -58133,6 +60044,7 @@ characters.data={ unicodeslot=0x24D5, }, [0x24D6]={ + adobename="gcircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER G", @@ -58143,6 +60055,7 @@ characters.data={ unicodeslot=0x24D6, }, [0x24D7]={ + adobename="hcircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER H", @@ -58153,6 +60066,7 @@ characters.data={ unicodeslot=0x24D7, }, [0x24D8]={ + adobename="icircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER I", @@ -58163,6 +60077,7 @@ characters.data={ unicodeslot=0x24D8, }, [0x24D9]={ + adobename="jcircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER J", @@ -58173,6 +60088,7 @@ characters.data={ unicodeslot=0x24D9, }, [0x24DA]={ + adobename="kcircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER K", @@ -58183,6 +60099,7 @@ characters.data={ unicodeslot=0x24DA, }, [0x24DB]={ + adobename="lcircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER L", @@ -58193,6 +60110,7 @@ characters.data={ unicodeslot=0x24DB, }, [0x24DC]={ + adobename="mcircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER M", @@ -58203,6 +60121,7 @@ characters.data={ unicodeslot=0x24DC, }, [0x24DD]={ + adobename="ncircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER N", @@ -58213,6 +60132,7 @@ characters.data={ unicodeslot=0x24DD, }, [0x24DE]={ + adobename="ocircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER O", @@ -58223,6 +60143,7 @@ characters.data={ unicodeslot=0x24DE, }, [0x24DF]={ + adobename="pcircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER P", @@ -58233,6 +60154,7 @@ characters.data={ unicodeslot=0x24DF, }, [0x24E0]={ + adobename="qcircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER Q", @@ -58243,6 +60165,7 @@ characters.data={ unicodeslot=0x24E0, }, [0x24E1]={ + adobename="rcircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER R", @@ -58253,6 +60176,7 @@ characters.data={ unicodeslot=0x24E1, }, [0x24E2]={ + adobename="scircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER S", @@ -58263,6 +60187,7 @@ characters.data={ unicodeslot=0x24E2, }, [0x24E3]={ + adobename="tcircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER T", @@ -58273,6 +60198,7 @@ characters.data={ unicodeslot=0x24E3, }, [0x24E4]={ + adobename="ucircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER U", @@ -58283,6 +60209,7 @@ characters.data={ unicodeslot=0x24E4, }, [0x24E5]={ + adobename="vcircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER V", @@ -58293,6 +60220,7 @@ characters.data={ unicodeslot=0x24E5, }, [0x24E6]={ + adobename="wcircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER W", @@ -58303,6 +60231,7 @@ characters.data={ unicodeslot=0x24E6, }, [0x24E7]={ + adobename="xcircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER X", @@ -58313,6 +60242,7 @@ characters.data={ unicodeslot=0x24E7, }, [0x24E8]={ + adobename="ycircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER Y", @@ -58323,6 +60253,7 @@ characters.data={ unicodeslot=0x24E8, }, [0x24E9]={ + adobename="zcircle", category="so", cjkwd="a", description="CIRCLED LATIN SMALL LETTER Z", @@ -58607,7 +60538,7 @@ characters.data={ unicodeslot=0x250B, }, [0x250C]={ - adobename="SF10000", + adobename="SF010000", category="so", cjkwd="a", description="BOX DRAWINGS LIGHT DOWN AND RIGHT", @@ -58640,7 +60571,7 @@ characters.data={ unicodeslot=0x250F, }, [0x2510]={ - adobename="SF30000", + adobename="SF030000", category="so", cjkwd="a", description="BOX DRAWINGS LIGHT DOWN AND LEFT", @@ -58673,7 +60604,7 @@ characters.data={ unicodeslot=0x2513, }, [0x2514]={ - adobename="SF20000", + adobename="SF020000", category="so", cjkwd="a", description="BOX DRAWINGS LIGHT UP AND RIGHT", @@ -58706,7 +60637,7 @@ characters.data={ unicodeslot=0x2517, }, [0x2518]={ - adobename="SF40000", + adobename="SF040000", category="so", cjkwd="a", description="BOX DRAWINGS LIGHT UP AND LEFT", @@ -58739,7 +60670,7 @@ characters.data={ unicodeslot=0x251B, }, [0x251C]={ - adobename="SF80000", + adobename="SF080000", category="so", cjkwd="a", description="BOX DRAWINGS LIGHT VERTICAL AND RIGHT", @@ -58804,7 +60735,7 @@ characters.data={ unicodeslot=0x2523, }, [0x2524]={ - adobename="SF90000", + adobename="SF090000", category="so", cjkwd="a", description="BOX DRAWINGS LIGHT VERTICAL AND LEFT", @@ -58869,7 +60800,7 @@ characters.data={ unicodeslot=0x252B, }, [0x252C]={ - adobename="SF60000", + adobename="SF060000", category="so", cjkwd="a", description="BOX DRAWINGS LIGHT DOWN AND HORIZONTAL", @@ -58934,7 +60865,7 @@ characters.data={ unicodeslot=0x2533, }, [0x2534]={ - adobename="SF70000", + adobename="SF070000", category="so", cjkwd="a", description="BOX DRAWINGS LIGHT UP AND HORIZONTAL", @@ -58999,7 +60930,7 @@ characters.data={ unicodeslot=0x253B, }, [0x253C]={ - adobename="SF50000", + adobename="SF050000", category="so", cjkwd="a", description="BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL", @@ -59697,7 +61628,7 @@ characters.data={ unicodeslot=0x2590, }, [0x2591]={ - adobename="ltshade", + adobename="shadelight", category="so", description="LIGHT SHADE", direction="on", @@ -59705,7 +61636,7 @@ characters.data={ unicodeslot=0x2591, }, [0x2592]={ - adobename="shade", + adobename="shademedium", category="so", cjkwd="a", description="MEDIUM SHADE", @@ -59714,7 +61645,7 @@ characters.data={ unicodeslot=0x2592, }, [0x2593]={ - adobename="dkshade", + adobename="shadedark", category="so", cjkwd="a", description="DARK SHADE", @@ -59818,15 +61749,21 @@ characters.data={ unicodeslot=0x25A0, }, [0x25A1]={ - adobename="H22073", + adobename="whitesquare", category="so", cjkwd="a", description="WHITE SQUARE", direction="on", linebreak="ai", mathspec={ - { class="ord", name="square" }, - { class="ord", name="Box" }, + { + class="ord", + name="square", + }, + { + class="ord", + name="Box", + }, }, unicodeslot=0x25A1, }, @@ -59840,6 +61777,7 @@ characters.data={ unicodeslot=0x25A2, }, [0x25A3]={ + adobename="squarewhitewithsmallblack", category="so", cjkwd="a", description="WHITE SQUARE CONTAINING BLACK SMALL SQUARE", @@ -59848,6 +61786,7 @@ characters.data={ unicodeslot=0x25A3, }, [0x25A4]={ + adobename="squarehorizontalfill", category="so", cjkwd="a", description="SQUARE WITH HORIZONTAL FILL", @@ -59856,6 +61795,7 @@ characters.data={ unicodeslot=0x25A4, }, [0x25A5]={ + adobename="squareverticalfill", category="so", cjkwd="a", description="SQUARE WITH VERTICAL FILL", @@ -59864,6 +61804,7 @@ characters.data={ unicodeslot=0x25A5, }, [0x25A6]={ + adobename="squareorthogonalcrosshatchfill", category="so", cjkwd="a", description="SQUARE WITH ORTHOGONAL CROSSHATCH FILL", @@ -59872,6 +61813,7 @@ characters.data={ unicodeslot=0x25A6, }, [0x25A7]={ + adobename="squareupperlefttolowerrightfill", category="so", cjkwd="a", description="SQUARE WITH UPPER LEFT TO LOWER RIGHT FILL", @@ -59880,6 +61822,7 @@ characters.data={ unicodeslot=0x25A7, }, [0x25A8]={ + adobename="squareupperrighttolowerleftfill", category="so", cjkwd="a", description="SQUARE WITH UPPER RIGHT TO LOWER LEFT FILL", @@ -59888,6 +61831,7 @@ characters.data={ unicodeslot=0x25A8, }, [0x25A9]={ + adobename="squarediagonalcrosshatchfill", category="so", cjkwd="a", description="SQUARE WITH DIAGONAL CROSSHATCH FILL", @@ -59896,7 +61840,7 @@ characters.data={ unicodeslot=0x25A9, }, [0x25AA]={ - adobename="H18543", + adobename="blacksmallsquare", category="so", description="BLACK SMALL SQUARE", direction="on", @@ -59904,7 +61848,7 @@ characters.data={ unicodeslot=0x25AA, }, [0x25AB]={ - adobename="H18551", + adobename="whitesmallsquare", category="so", description="WHITE SMALL SQUARE", direction="on", @@ -59964,18 +61908,26 @@ characters.data={ unicodeslot=0x25B2, }, [0x25B3]={ + adobename="whiteuppointingtriangle", category="so", cjkwd="a", description="WHITE UP-POINTING TRIANGLE", direction="on", linebreak="ai", mathspec={ - { class="ord", name="triangle" }, - { class="binary", name="bigtriangleup" }, + { + class="ord", + name="triangle", + }, + { + class="binary", + name="bigtriangleup", + }, }, unicodeslot=0x25B3, }, [0x25B4]={ + adobename="blackuppointingsmalltriangle", category="so", description="BLACK UP-POINTING SMALL TRIANGLE", direction="on", @@ -59983,6 +61935,7 @@ characters.data={ unicodeslot=0x25B4, }, [0x25B5]={ + adobename="whiteuppointingsmalltriangle", category="so", description="WHITE UP-POINTING SMALL TRIANGLE", direction="on", @@ -59990,6 +61943,7 @@ characters.data={ unicodeslot=0x25B5, }, [0x25B6]={ + adobename="blackrightpointingtriangle", category="so", cjkwd="a", description="BLACK RIGHT-POINTING TRIANGLE", @@ -60000,6 +61954,7 @@ characters.data={ unicodeslot=0x25B6, }, [0x25B7]={ + adobename="whiterightpointingtriangle", category="sm", cjkwd="a", description="WHITE RIGHT-POINTING TRIANGLE", @@ -60017,6 +61972,7 @@ characters.data={ unicodeslot=0x25B8, }, [0x25B9]={ + adobename="whiterightpointingsmalltriangle", category="so", description="WHITE RIGHT-POINTING SMALL TRIANGLE", direction="on", @@ -60048,6 +62004,7 @@ characters.data={ unicodeslot=0x25BC, }, [0x25BD]={ + adobename="whitedownpointingtriangle", category="so", cjkwd="a", description="WHITE DOWN-POINTING TRIANGLE", @@ -60065,6 +62022,7 @@ characters.data={ unicodeslot=0x25BE, }, [0x25BF]={ + adobename="whitedownpointingsmalltriangle", category="so", description="WHITE DOWN-POINTING SMALL TRIANGLE", direction="on", @@ -60072,6 +62030,7 @@ characters.data={ unicodeslot=0x25BF, }, [0x25C0]={ + adobename="blackleftpointingtriangle", category="so", cjkwd="a", description="BLACK LEFT-POINTING TRIANGLE", @@ -60080,6 +62039,7 @@ characters.data={ unicodeslot=0x25C0, }, [0x25C1]={ + adobename="whiteleftpointingtriangle", category="sm", cjkwd="a", description="WHITE LEFT-POINTING TRIANGLE", @@ -60095,6 +62055,7 @@ characters.data={ unicodeslot=0x25C2, }, [0x25C3]={ + adobename="whiteleftpointingsmalltriangle", category="so", description="WHITE LEFT-POINTING SMALL TRIANGLE", direction="on", @@ -60117,6 +62078,7 @@ characters.data={ unicodeslot=0x25C5, }, [0x25C6]={ + adobename="blackdiamond", category="so", cjkwd="a", description="BLACK DIAMOND", @@ -60125,6 +62087,7 @@ characters.data={ unicodeslot=0x25C6, }, [0x25C7]={ + adobename="whitediamond", category="so", cjkwd="a", description="WHITE DIAMOND", @@ -60133,6 +62096,7 @@ characters.data={ unicodeslot=0x25C7, }, [0x25C8]={ + adobename="whitediamondcontainingblacksmalldiamond", category="so", cjkwd="a", description="WHITE DIAMOND CONTAINING BLACK SMALL DIAMOND", @@ -60141,6 +62105,7 @@ characters.data={ unicodeslot=0x25C8, }, [0x25C9]={ + adobename="fisheye", category="so", description="FISHEYE", direction="on", @@ -60158,7 +62123,7 @@ characters.data={ unicodeslot=0x25CA, }, [0x25CB]={ - adobename="circle", + adobename="whitecircle", category="so", cjkwd="a", description="WHITE CIRCLE", @@ -60167,6 +62132,7 @@ characters.data={ unicodeslot=0x25CB, }, [0x25CC]={ + adobename="dottedcircle", category="so", description="DOTTED CIRCLE", direction="on", @@ -60181,6 +62147,7 @@ characters.data={ unicodeslot=0x25CD, }, [0x25CE]={ + adobename="bullseye", category="so", cjkwd="a", description="BULLSEYE", @@ -60189,7 +62156,7 @@ characters.data={ unicodeslot=0x25CE, }, [0x25CF]={ - adobename="H18533", + adobename="blackcircle", category="so", cjkwd="a", description="BLACK CIRCLE", @@ -60198,6 +62165,7 @@ characters.data={ unicodeslot=0x25CF, }, [0x25D0]={ + adobename="circlewithlefthalfblack", category="so", cjkwd="a", description="CIRCLE WITH LEFT HALF BLACK", @@ -60206,6 +62174,7 @@ characters.data={ unicodeslot=0x25D0, }, [0x25D1]={ + adobename="circlewithrighthalfblack", category="so", cjkwd="a", description="CIRCLE WITH RIGHT HALF BLACK", @@ -60264,7 +62233,7 @@ characters.data={ unicodeslot=0x25D8, }, [0x25D9]={ - adobename="invcircle", + adobename="whitecircleinverse", category="so", description="INVERSE WHITE CIRCLE", direction="on", @@ -60328,6 +62297,7 @@ characters.data={ unicodeslot=0x25E1, }, [0x25E2]={ + adobename="blacklowerrighttriangle", category="so", cjkwd="a", description="BLACK LOWER RIGHT TRIANGLE", @@ -60336,6 +62306,7 @@ characters.data={ unicodeslot=0x25E2, }, [0x25E3]={ + adobename="blacklowerlefttriangle", category="so", cjkwd="a", description="BLACK LOWER LEFT TRIANGLE", @@ -60344,6 +62315,7 @@ characters.data={ unicodeslot=0x25E3, }, [0x25E4]={ + adobename="blackupperlefttriangle", category="so", cjkwd="a", description="BLACK UPPER LEFT TRIANGLE", @@ -60352,6 +62324,7 @@ characters.data={ unicodeslot=0x25E4, }, [0x25E5]={ + adobename="blackupperrighttriangle", category="so", cjkwd="a", description="BLACK UPPER RIGHT TRIANGLE", @@ -60360,7 +62333,7 @@ characters.data={ unicodeslot=0x25E5, }, [0x25E6]={ - adobename="openbullet", + adobename="whitebullet", category="so", description="WHITE BULLET", direction="on", @@ -60424,6 +62397,7 @@ characters.data={ unicodeslot=0x25EE, }, [0x25EF]={ + adobename="largecircle", category="so", cjkwd="a", description="LARGE CIRCLE", @@ -60581,6 +62555,7 @@ characters.data={ unicodeslot=0x2604, }, [0x2605]={ + adobename="blackstar", category="so", cjkwd="a", description="BLACK STAR", @@ -60591,6 +62566,7 @@ characters.data={ unicodeslot=0x2605, }, [0x2606]={ + adobename="whitestar", category="so", cjkwd="a", description="WHITE STAR", @@ -60649,6 +62625,7 @@ characters.data={ unicodeslot=0x260D, }, [0x260E]={ + adobename="telephoneblack", category="so", cjkwd="a", description="BLACK TELEPHONE", @@ -60657,6 +62634,7 @@ characters.data={ unicodeslot=0x260E, }, [0x260F]={ + adobename="whitetelephone", category="so", cjkwd="a", description="WHITE TELEPHONE", @@ -60751,6 +62729,7 @@ characters.data={ unicodeslot=0x261B, }, [0x261C]={ + adobename="pointingindexleftwhite", category="so", cjkwd="a", description="WHITE LEFT POINTING INDEX", @@ -60759,6 +62738,7 @@ characters.data={ unicodeslot=0x261C, }, [0x261D]={ + adobename="pointingindexupwhite", category="so", description="WHITE UP POINTING INDEX", direction="on", @@ -60766,6 +62746,7 @@ characters.data={ unicodeslot=0x261D, }, [0x261E]={ + adobename="pointingindexrightwhite", category="so", cjkwd="a", description="WHITE RIGHT POINTING INDEX", @@ -60774,6 +62755,7 @@ characters.data={ unicodeslot=0x261E, }, [0x261F]={ + adobename="pointingindexdownwhite", category="so", description="WHITE DOWN POINTING INDEX", direction="on", @@ -60886,6 +62868,7 @@ characters.data={ unicodeslot=0x262E, }, [0x262F]={ + adobename="yinyang", category="so", description="YIN YANG", direction="on", @@ -60963,7 +62946,7 @@ characters.data={ unicodeslot=0x2639, }, [0x263A]={ - adobename="smileface", + adobename="whitesmilingface", category="so", description="WHITE SMILING FACE", direction="on", @@ -61008,7 +62991,7 @@ characters.data={ unicodeslot=0x263F, }, [0x2640]={ - adobename="female", + adobename="venus", category="so", cjkwd="a", description="FEMALE SIGN", @@ -61017,6 +63000,7 @@ characters.data={ unicodeslot=0x2640, }, [0x2641]={ + adobename="earth", category="so", description="EARTH", direction="on", @@ -61024,7 +63008,7 @@ characters.data={ unicodeslot=0x2641, }, [0x2642]={ - adobename="male", + adobename="mars", category="so", cjkwd="a", description="MALE SIGN", @@ -61236,7 +63220,7 @@ characters.data={ unicodeslot=0x265F, }, [0x2660]={ - adobename="spade", + adobename="spadesuitblack", category="so", cjkwd="a", description="BLACK SPADE SUIT", @@ -61247,6 +63231,7 @@ characters.data={ unicodeslot=0x2660, }, [0x2661]={ + adobename="heartsuitwhite", category="so", cjkwd="a", description="WHITE HEART SUIT", @@ -61257,6 +63242,7 @@ characters.data={ unicodeslot=0x2661, }, [0x2662]={ + adobename="diamondsuitwhite", category="so", description="WHITE DIAMOND SUIT", direction="on", @@ -61266,7 +63252,7 @@ characters.data={ unicodeslot=0x2662, }, [0x2663]={ - adobename="club", + adobename="clubsuitblack", category="so", cjkwd="a", description="BLACK CLUB SUIT", @@ -61277,6 +63263,7 @@ characters.data={ unicodeslot=0x2663, }, [0x2664]={ + adobename="spadesuitwhite", category="so", cjkwd="a", description="WHITE SPADE SUIT", @@ -61285,7 +63272,7 @@ characters.data={ unicodeslot=0x2664, }, [0x2665]={ - adobename="heart", + adobename="heartsuitblack", category="so", cjkwd="a", description="BLACK HEART SUIT", @@ -61302,6 +63289,7 @@ characters.data={ unicodeslot=0x2666, }, [0x2667]={ + adobename="clubsuitwhite", category="so", cjkwd="a", description="WHITE CLUB SUIT", @@ -61310,6 +63298,7 @@ characters.data={ unicodeslot=0x2667, }, [0x2668]={ + adobename="hotsprings", category="so", cjkwd="a", description="HOT SPRINGS", @@ -61318,6 +63307,7 @@ characters.data={ unicodeslot=0x2668, }, [0x2669]={ + adobename="quarternote", category="so", cjkwd="a", description="QUARTER NOTE", @@ -61343,6 +63333,7 @@ characters.data={ unicodeslot=0x266B, }, [0x266C]={ + adobename="beamedsixteenthnotes", category="so", cjkwd="a", description="BEAMED SIXTEENTH NOTES", @@ -61351,6 +63342,7 @@ characters.data={ unicodeslot=0x266C, }, [0x266D]={ + adobename="musicflatsign", category="so", cjkwd="a", description="MUSIC FLAT SIGN", @@ -61370,6 +63362,7 @@ characters.data={ unicodeslot=0x266E, }, [0x266F]={ + adobename="musicsharpsign", category="sm", cjkwd="a", description="MUSIC SHARP SIGN", @@ -61933,6 +63926,7 @@ characters.data={ unicodeslot=0x2712, }, [0x2713]={ + adobename="checkmark", category="so", description="CHECK MARK", direction="on", @@ -62732,6 +64726,7 @@ characters.data={ unicodeslot=0x2789, }, [0x278A]={ + adobename="onecircleinversesansserif", category="no", description="DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE", direction="on", @@ -62739,6 +64734,7 @@ characters.data={ unicodeslot=0x278A, }, [0x278B]={ + adobename="twocircleinversesansserif", category="no", description="DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT TWO", direction="on", @@ -62746,6 +64742,7 @@ characters.data={ unicodeslot=0x278B, }, [0x278C]={ + adobename="threecircleinversesansserif", category="no", description="DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT THREE", direction="on", @@ -62753,6 +64750,7 @@ characters.data={ unicodeslot=0x278C, }, [0x278D]={ + adobename="fourcircleinversesansserif", category="no", description="DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT FOUR", direction="on", @@ -62760,6 +64758,7 @@ characters.data={ unicodeslot=0x278D, }, [0x278E]={ + adobename="fivecircleinversesansserif", category="no", description="DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT FIVE", direction="on", @@ -62767,6 +64766,7 @@ characters.data={ unicodeslot=0x278E, }, [0x278F]={ + adobename="sixcircleinversesansserif", category="no", description="DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT SIX", direction="on", @@ -62774,6 +64774,7 @@ characters.data={ unicodeslot=0x278F, }, [0x2790]={ + adobename="sevencircleinversesansserif", category="no", description="DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT SEVEN", direction="on", @@ -62781,6 +64782,7 @@ characters.data={ unicodeslot=0x2790, }, [0x2791]={ + adobename="eightcircleinversesansserif", category="no", description="DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT EIGHT", direction="on", @@ -62788,6 +64790,7 @@ characters.data={ unicodeslot=0x2791, }, [0x2792]={ + adobename="ninecircleinversesansserif", category="no", description="DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT NINE", direction="on", @@ -62851,6 +64854,7 @@ characters.data={ unicodeslot=0x279D, }, [0x279E]={ + adobename="arrowrightheavy", category="so", description="HEAVY TRIANGLE-HEADED RIGHTWARDS ARROW", direction="on", @@ -63385,6 +65389,46 @@ characters.data={ mirror=0x27EA, unicodeslot=0x27EB, }, + [0x27EC]={ + category="ps", + cjkwd="na", + description="MATHEMATICAL LEFT WHITE TORTOISE SHELL BRACKET", + direction="on", + linebreak="op", + mirror=0x27ED, + unicodeslot=0x27EC, + }, + [0x27ED]={ + category="pe", + cjkwd="na", + description="MATHEMATICAL RIGHT WHITE TORTOISE SHELL BRACKET", + direction="on", + linebreak="cl", + mirror=0x27EC, + unicodeslot=0x27ED, + }, + [0x27EE]={ + category="ps", + cjkwd="na", + description="MATHEMATICAL LEFT FLATTENED PARENTHESIS", + direction="on", + linebreak="op", + mathclass="open", + mathname="lgroup", + mirror=0x27EF, + unicodeslot=0x27EE, + }, + [0x27EF]={ + category="pe", + cjkwd="na", + description="MATHEMATICAL RIGHT FLATTENED PARENTHESIS", + direction="on", + linebreak="cl", + mathclass="close", + mathname="rgroup", + mirror=0x27EE, + unicodeslot=0x27EF, + }, [0x27F0]={ category="sm", description="UPWARDS QUADRUPLE ARROW", @@ -63425,7 +65469,6 @@ characters.data={ description="LONG LEFTWARDS ARROW", direction="on", linebreak="al", - fallback=[[\leftarrow\joinrel\relbar]], mathclass="relation", mathname="longleftarrow", unicodeslot=0x27F5, @@ -63435,7 +65478,6 @@ characters.data={ description="LONG RIGHTWARDS ARROW", direction="on", linebreak="al", - fallback=[[\relbar\joinrel\rightarrow]], mathclass="relation", mathname="longrightarrow", unicodeslot=0x27F6, @@ -63445,7 +65487,6 @@ characters.data={ description="LONG LEFT RIGHT ARROW", direction="on", linebreak="al", - fallback=[[\leftarrow\joinrel\rightarrow]], mathclass="relation", mathname="longleftrightarrow", unicodeslot=0x27F7, @@ -63455,7 +65496,6 @@ characters.data={ description="LONG LEFTWARDS DOUBLE ARROW", direction="on", linebreak="al", - fallback=[[\Leftarrow\joinrel\Relbar]], mathclass="relation", mathname="Longleftarrow", unicodeslot=0x27F8, @@ -63465,7 +65505,6 @@ characters.data={ description="LONG RIGHTWARDS DOUBLE ARROW", direction="on", linebreak="al", - fallback=[[\Relbar\joinrel\Rightarrow]], mathclass="relation", mathname="Longrightarrow", unicodeslot=0x27F9, @@ -63475,7 +65514,6 @@ characters.data={ description="LONG LEFT RIGHT DOUBLE ARROW", direction="on", linebreak="al", - fallback=[[\Leftarrow\joinrel\Rightarrow]], mathclass="relation", mathname="Longleftrightarrow", unicodeslot=0x27FA, @@ -63485,7 +65523,6 @@ characters.data={ description="LONG LEFTWARDS ARROW FROM BAR", direction="on", linebreak="al", - fallback=[[\longleftarrow\mapstochar]], -- untested mathclass="relation", mathname="longmapsfrom", unicodeslot=0x27FB, @@ -63495,7 +65532,6 @@ characters.data={ description="LONG RIGHTWARDS ARROW FROM BAR", direction="on", linebreak="al", - fallback=[[\mapstochar\longrightarrow]], mathclass="relation", mathname="longmapsto", unicodeslot=0x27FC, @@ -68743,18 +70779,18 @@ characters.data={ category="sm", description="SUBSET OF ABOVE NOT EQUAL TO", direction="on", + linebreak="al", mathclass="relation", mathname="subsetneqq", - linebreak="al", unicodeslot=0x2ACB, }, [0x2ACC]={ category="sm", description="SUPERSET OF ABOVE NOT EQUAL TO", direction="on", + linebreak="al", mathclass="relation", mathname="supsetneqq", - linebreak="al", unicodeslot=0x2ACC, }, [0x2ACD]={ @@ -75530,6 +77566,7 @@ characters.data={ unicodeslot=0x2FFB, }, [0x3000]={ + adobename="ideographicspace", category="zs", cjkwd="f", contextname="ideographicspace", @@ -75540,6 +77577,7 @@ characters.data={ unicodeslot=0x3000, }, [0x3001]={ + adobename="ideographiccomma", category="po", cjkwd="w", description="IDEOGRAPHIC COMMA", @@ -75548,6 +77586,7 @@ characters.data={ unicodeslot=0x3001, }, [0x3002]={ + adobename="ideographicperiod", category="po", cjkwd="w", description="IDEOGRAPHIC FULL STOP", @@ -75556,6 +77595,7 @@ characters.data={ unicodeslot=0x3002, }, [0x3003]={ + adobename="dittomark", category="po", cjkwd="w", description="DITTO MARK", @@ -75564,6 +77604,7 @@ characters.data={ unicodeslot=0x3003, }, [0x3004]={ + adobename="jis", category="so", cjkwd="w", description="JAPANESE INDUSTRIAL STANDARD SYMBOL", @@ -75572,6 +77613,7 @@ characters.data={ unicodeslot=0x3004, }, [0x3005]={ + adobename="ideographiciterationmark", category="lm", cjkwd="w", description="IDEOGRAPHIC ITERATION MARK", @@ -75580,6 +77622,7 @@ characters.data={ unicodeslot=0x3005, }, [0x3006]={ + adobename="ideographicclose", category="lo", cjkwd="w", description="IDEOGRAPHIC CLOSING MARK", @@ -75588,6 +77631,7 @@ characters.data={ unicodeslot=0x3006, }, [0x3007]={ + adobename="ideographiczero", category="nl", cjkwd="w", description="IDEOGRAPHIC NUMBER ZERO", @@ -75596,6 +77640,7 @@ characters.data={ unicodeslot=0x3007, }, [0x3008]={ + adobename="anglebracketleft", category="ps", cjkwd="w", description="LEFT ANGLE BRACKET", @@ -75605,6 +77650,7 @@ characters.data={ unicodeslot=0x3008, }, [0x3009]={ + adobename="anglebracketright", category="pe", cjkwd="w", description="RIGHT ANGLE BRACKET", @@ -75614,6 +77660,7 @@ characters.data={ unicodeslot=0x3009, }, [0x300A]={ + adobename="dblanglebracketleft", category="ps", cjkwd="w", description="LEFT DOUBLE ANGLE BRACKET", @@ -75623,6 +77670,7 @@ characters.data={ unicodeslot=0x300A, }, [0x300B]={ + adobename="dblanglebracketright", category="pe", cjkwd="w", description="RIGHT DOUBLE ANGLE BRACKET", @@ -75632,6 +77680,7 @@ characters.data={ unicodeslot=0x300B, }, [0x300C]={ + adobename="cornerbracketleft", category="ps", cjkwd="w", description="LEFT CORNER BRACKET", @@ -75641,6 +77690,7 @@ characters.data={ unicodeslot=0x300C, }, [0x300D]={ + adobename="cornerbracketright", category="pe", cjkwd="w", description="RIGHT CORNER BRACKET", @@ -75650,6 +77700,7 @@ characters.data={ unicodeslot=0x300D, }, [0x300E]={ + adobename="whitecornerbracketleft", category="ps", cjkwd="w", description="LEFT WHITE CORNER BRACKET", @@ -75659,6 +77710,7 @@ characters.data={ unicodeslot=0x300E, }, [0x300F]={ + adobename="whitecornerbracketright", category="pe", cjkwd="w", description="RIGHT WHITE CORNER BRACKET", @@ -75668,6 +77720,7 @@ characters.data={ unicodeslot=0x300F, }, [0x3010]={ + adobename="blacklenticularbracketleft", category="ps", cjkwd="w", description="LEFT BLACK LENTICULAR BRACKET", @@ -75677,6 +77730,7 @@ characters.data={ unicodeslot=0x3010, }, [0x3011]={ + adobename="blacklenticularbracketright", category="pe", cjkwd="w", description="RIGHT BLACK LENTICULAR BRACKET", @@ -75686,6 +77740,7 @@ characters.data={ unicodeslot=0x3011, }, [0x3012]={ + adobename="postalmark", category="so", cjkwd="w", description="POSTAL MARK", @@ -75694,6 +77749,7 @@ characters.data={ unicodeslot=0x3012, }, [0x3013]={ + adobename="getamark", category="so", cjkwd="w", description="GETA MARK", @@ -75702,28 +77758,27 @@ characters.data={ unicodeslot=0x3013, }, [0x3014]={ + adobename="tortoiseshellbracketleft", category="ps", cjkwd="w", description="LEFT TORTOISE SHELL BRACKET", direction="on", linebreak="op", mirror=0x3015, - mathclass="open", - mathname="lgroup", unicodeslot=0x3014, }, [0x3015]={ + adobename="tortoiseshellbracketright", category="pe", cjkwd="w", description="RIGHT TORTOISE SHELL BRACKET", direction="on", linebreak="cl", mirror=0x3014, - mathclass="close", - mathname="rgroup", unicodeslot=0x3015, }, [0x3016]={ + adobename="whitelenticularbracketleft", category="ps", cjkwd="w", description="LEFT WHITE LENTICULAR BRACKET", @@ -75733,6 +77788,7 @@ characters.data={ unicodeslot=0x3016, }, [0x3017]={ + adobename="whitelenticularbracketright", category="pe", cjkwd="w", description="RIGHT WHITE LENTICULAR BRACKET", @@ -75742,6 +77798,7 @@ characters.data={ unicodeslot=0x3017, }, [0x3018]={ + adobename="whitetortoiseshellbracketleft", category="ps", cjkwd="w", description="LEFT WHITE TORTOISE SHELL BRACKET", @@ -75751,6 +77808,7 @@ characters.data={ unicodeslot=0x3018, }, [0x3019]={ + adobename="whitetortoiseshellbracketright", category="pe", cjkwd="w", description="RIGHT WHITE TORTOISE SHELL BRACKET", @@ -75778,6 +77836,7 @@ characters.data={ unicodeslot=0x301B, }, [0x301C]={ + adobename="wavedash", category="pd", cjkwd="w", description="WAVE DASH", @@ -75786,6 +77845,7 @@ characters.data={ unicodeslot=0x301C, }, [0x301D]={ + adobename="quotedblprimereversed", category="ps", cjkwd="w", description="REVERSED DOUBLE PRIME QUOTATION MARK", @@ -75794,6 +77854,7 @@ characters.data={ unicodeslot=0x301D, }, [0x301E]={ + adobename="quotedblprime", category="pe", cjkwd="w", description="DOUBLE PRIME QUOTATION MARK", @@ -75810,6 +77871,7 @@ characters.data={ unicodeslot=0x301F, }, [0x3020]={ + adobename="postalmarkface", category="so", cjkwd="w", description="POSTAL MARK FACE", @@ -75818,6 +77880,7 @@ characters.data={ unicodeslot=0x3020, }, [0x3021]={ + adobename="onehangzhou", category="nl", cjkwd="w", description="HANGZHOU NUMERAL ONE", @@ -75826,6 +77889,7 @@ characters.data={ unicodeslot=0x3021, }, [0x3022]={ + adobename="twohangzhou", category="nl", cjkwd="w", description="HANGZHOU NUMERAL TWO", @@ -75834,6 +77898,7 @@ characters.data={ unicodeslot=0x3022, }, [0x3023]={ + adobename="threehangzhou", category="nl", cjkwd="w", description="HANGZHOU NUMERAL THREE", @@ -75842,6 +77907,7 @@ characters.data={ unicodeslot=0x3023, }, [0x3024]={ + adobename="fourhangzhou", category="nl", cjkwd="w", description="HANGZHOU NUMERAL FOUR", @@ -75850,6 +77916,7 @@ characters.data={ unicodeslot=0x3024, }, [0x3025]={ + adobename="fivehangzhou", category="nl", cjkwd="w", description="HANGZHOU NUMERAL FIVE", @@ -75858,6 +77925,7 @@ characters.data={ unicodeslot=0x3025, }, [0x3026]={ + adobename="sixhangzhou", category="nl", cjkwd="w", description="HANGZHOU NUMERAL SIX", @@ -75866,6 +77934,7 @@ characters.data={ unicodeslot=0x3026, }, [0x3027]={ + adobename="sevenhangzhou", category="nl", cjkwd="w", description="HANGZHOU NUMERAL SEVEN", @@ -75874,6 +77943,7 @@ characters.data={ unicodeslot=0x3027, }, [0x3028]={ + adobename="eighthangzhou", category="nl", cjkwd="w", description="HANGZHOU NUMERAL EIGHT", @@ -75882,6 +77952,7 @@ characters.data={ unicodeslot=0x3028, }, [0x3029]={ + adobename="ninehangzhou", category="nl", cjkwd="w", description="HANGZHOU NUMERAL NINE", @@ -75986,6 +78057,7 @@ characters.data={ unicodeslot=0x3035, }, [0x3036]={ + adobename="circlepostalmark", category="so", cjkwd="w", description="CIRCLED POSTAL MARK", @@ -76070,6 +78142,7 @@ characters.data={ unicodeslot=0x303F, }, [0x3041]={ + adobename="asmallhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER SMALL A", @@ -76078,6 +78151,7 @@ characters.data={ unicodeslot=0x3041, }, [0x3042]={ + adobename="ahiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER A", @@ -76086,6 +78160,7 @@ characters.data={ unicodeslot=0x3042, }, [0x3043]={ + adobename="ismallhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER SMALL I", @@ -76094,6 +78169,7 @@ characters.data={ unicodeslot=0x3043, }, [0x3044]={ + adobename="ihiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER I", @@ -76102,6 +78178,7 @@ characters.data={ unicodeslot=0x3044, }, [0x3045]={ + adobename="usmallhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER SMALL U", @@ -76110,6 +78187,7 @@ characters.data={ unicodeslot=0x3045, }, [0x3046]={ + adobename="uhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER U", @@ -76118,6 +78196,7 @@ characters.data={ unicodeslot=0x3046, }, [0x3047]={ + adobename="esmallhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER SMALL E", @@ -76126,6 +78205,7 @@ characters.data={ unicodeslot=0x3047, }, [0x3048]={ + adobename="ehiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER E", @@ -76134,6 +78214,7 @@ characters.data={ unicodeslot=0x3048, }, [0x3049]={ + adobename="osmallhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER SMALL O", @@ -76142,6 +78223,7 @@ characters.data={ unicodeslot=0x3049, }, [0x304A]={ + adobename="ohiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER O", @@ -76150,6 +78232,7 @@ characters.data={ unicodeslot=0x304A, }, [0x304B]={ + adobename="kahiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER KA", @@ -76158,6 +78241,7 @@ characters.data={ unicodeslot=0x304B, }, [0x304C]={ + adobename="gahiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER GA", @@ -76167,6 +78251,7 @@ characters.data={ unicodeslot=0x304C, }, [0x304D]={ + adobename="kihiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER KI", @@ -76175,6 +78260,7 @@ characters.data={ unicodeslot=0x304D, }, [0x304E]={ + adobename="gihiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER GI", @@ -76184,6 +78270,7 @@ characters.data={ unicodeslot=0x304E, }, [0x304F]={ + adobename="kuhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER KU", @@ -76192,6 +78279,7 @@ characters.data={ unicodeslot=0x304F, }, [0x3050]={ + adobename="guhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER GU", @@ -76201,6 +78289,7 @@ characters.data={ unicodeslot=0x3050, }, [0x3051]={ + adobename="kehiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER KE", @@ -76209,6 +78298,7 @@ characters.data={ unicodeslot=0x3051, }, [0x3052]={ + adobename="gehiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER GE", @@ -76218,6 +78308,7 @@ characters.data={ unicodeslot=0x3052, }, [0x3053]={ + adobename="kohiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER KO", @@ -76226,6 +78317,7 @@ characters.data={ unicodeslot=0x3053, }, [0x3054]={ + adobename="gohiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER GO", @@ -76235,6 +78327,7 @@ characters.data={ unicodeslot=0x3054, }, [0x3055]={ + adobename="sahiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER SA", @@ -76243,6 +78336,7 @@ characters.data={ unicodeslot=0x3055, }, [0x3056]={ + adobename="zahiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER ZA", @@ -76252,6 +78346,7 @@ characters.data={ unicodeslot=0x3056, }, [0x3057]={ + adobename="sihiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER SI", @@ -76260,6 +78355,7 @@ characters.data={ unicodeslot=0x3057, }, [0x3058]={ + adobename="zihiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER ZI", @@ -76269,6 +78365,7 @@ characters.data={ unicodeslot=0x3058, }, [0x3059]={ + adobename="suhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER SU", @@ -76277,6 +78374,7 @@ characters.data={ unicodeslot=0x3059, }, [0x305A]={ + adobename="zuhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER ZU", @@ -76286,6 +78384,7 @@ characters.data={ unicodeslot=0x305A, }, [0x305B]={ + adobename="sehiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER SE", @@ -76294,6 +78393,7 @@ characters.data={ unicodeslot=0x305B, }, [0x305C]={ + adobename="zehiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER ZE", @@ -76303,6 +78403,7 @@ characters.data={ unicodeslot=0x305C, }, [0x305D]={ + adobename="sohiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER SO", @@ -76311,6 +78412,7 @@ characters.data={ unicodeslot=0x305D, }, [0x305E]={ + adobename="zohiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER ZO", @@ -76320,6 +78422,7 @@ characters.data={ unicodeslot=0x305E, }, [0x305F]={ + adobename="tahiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER TA", @@ -76328,6 +78431,7 @@ characters.data={ unicodeslot=0x305F, }, [0x3060]={ + adobename="dahiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER DA", @@ -76337,6 +78441,7 @@ characters.data={ unicodeslot=0x3060, }, [0x3061]={ + adobename="tihiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER TI", @@ -76345,6 +78450,7 @@ characters.data={ unicodeslot=0x3061, }, [0x3062]={ + adobename="dihiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER DI", @@ -76354,6 +78460,7 @@ characters.data={ unicodeslot=0x3062, }, [0x3063]={ + adobename="tusmallhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER SMALL TU", @@ -76362,6 +78469,7 @@ characters.data={ unicodeslot=0x3063, }, [0x3064]={ + adobename="tuhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER TU", @@ -76370,6 +78478,7 @@ characters.data={ unicodeslot=0x3064, }, [0x3065]={ + adobename="duhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER DU", @@ -76379,6 +78488,7 @@ characters.data={ unicodeslot=0x3065, }, [0x3066]={ + adobename="tehiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER TE", @@ -76387,6 +78497,7 @@ characters.data={ unicodeslot=0x3066, }, [0x3067]={ + adobename="dehiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER DE", @@ -76396,6 +78507,7 @@ characters.data={ unicodeslot=0x3067, }, [0x3068]={ + adobename="tohiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER TO", @@ -76404,6 +78516,7 @@ characters.data={ unicodeslot=0x3068, }, [0x3069]={ + adobename="dohiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER DO", @@ -76413,6 +78526,7 @@ characters.data={ unicodeslot=0x3069, }, [0x306A]={ + adobename="nahiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER NA", @@ -76421,6 +78535,7 @@ characters.data={ unicodeslot=0x306A, }, [0x306B]={ + adobename="nihiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER NI", @@ -76429,6 +78544,7 @@ characters.data={ unicodeslot=0x306B, }, [0x306C]={ + adobename="nuhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER NU", @@ -76437,6 +78553,7 @@ characters.data={ unicodeslot=0x306C, }, [0x306D]={ + adobename="nehiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER NE", @@ -76445,6 +78562,7 @@ characters.data={ unicodeslot=0x306D, }, [0x306E]={ + adobename="nohiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER NO", @@ -76453,6 +78571,7 @@ characters.data={ unicodeslot=0x306E, }, [0x306F]={ + adobename="hahiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER HA", @@ -76461,6 +78580,7 @@ characters.data={ unicodeslot=0x306F, }, [0x3070]={ + adobename="bahiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER BA", @@ -76470,6 +78590,7 @@ characters.data={ unicodeslot=0x3070, }, [0x3071]={ + adobename="pahiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER PA", @@ -76479,6 +78600,7 @@ characters.data={ unicodeslot=0x3071, }, [0x3072]={ + adobename="hihiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER HI", @@ -76487,6 +78609,7 @@ characters.data={ unicodeslot=0x3072, }, [0x3073]={ + adobename="bihiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER BI", @@ -76496,6 +78619,7 @@ characters.data={ unicodeslot=0x3073, }, [0x3074]={ + adobename="pihiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER PI", @@ -76505,6 +78629,7 @@ characters.data={ unicodeslot=0x3074, }, [0x3075]={ + adobename="huhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER HU", @@ -76513,6 +78638,7 @@ characters.data={ unicodeslot=0x3075, }, [0x3076]={ + adobename="buhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER BU", @@ -76522,6 +78648,7 @@ characters.data={ unicodeslot=0x3076, }, [0x3077]={ + adobename="puhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER PU", @@ -76531,6 +78658,7 @@ characters.data={ unicodeslot=0x3077, }, [0x3078]={ + adobename="hehiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER HE", @@ -76539,6 +78667,7 @@ characters.data={ unicodeslot=0x3078, }, [0x3079]={ + adobename="behiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER BE", @@ -76548,6 +78677,7 @@ characters.data={ unicodeslot=0x3079, }, [0x307A]={ + adobename="pehiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER PE", @@ -76557,6 +78687,7 @@ characters.data={ unicodeslot=0x307A, }, [0x307B]={ + adobename="hohiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER HO", @@ -76565,6 +78696,7 @@ characters.data={ unicodeslot=0x307B, }, [0x307C]={ + adobename="bohiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER BO", @@ -76574,6 +78706,7 @@ characters.data={ unicodeslot=0x307C, }, [0x307D]={ + adobename="pohiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER PO", @@ -76583,6 +78716,7 @@ characters.data={ unicodeslot=0x307D, }, [0x307E]={ + adobename="mahiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER MA", @@ -76591,6 +78725,7 @@ characters.data={ unicodeslot=0x307E, }, [0x307F]={ + adobename="mihiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER MI", @@ -76599,6 +78734,7 @@ characters.data={ unicodeslot=0x307F, }, [0x3080]={ + adobename="muhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER MU", @@ -76607,6 +78743,7 @@ characters.data={ unicodeslot=0x3080, }, [0x3081]={ + adobename="mehiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER ME", @@ -76615,6 +78752,7 @@ characters.data={ unicodeslot=0x3081, }, [0x3082]={ + adobename="mohiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER MO", @@ -76623,6 +78761,7 @@ characters.data={ unicodeslot=0x3082, }, [0x3083]={ + adobename="yasmallhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER SMALL YA", @@ -76631,6 +78770,7 @@ characters.data={ unicodeslot=0x3083, }, [0x3084]={ + adobename="yahiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER YA", @@ -76639,6 +78779,7 @@ characters.data={ unicodeslot=0x3084, }, [0x3085]={ + adobename="yusmallhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER SMALL YU", @@ -76647,6 +78788,7 @@ characters.data={ unicodeslot=0x3085, }, [0x3086]={ + adobename="yuhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER YU", @@ -76655,6 +78797,7 @@ characters.data={ unicodeslot=0x3086, }, [0x3087]={ + adobename="yosmallhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER SMALL YO", @@ -76663,6 +78806,7 @@ characters.data={ unicodeslot=0x3087, }, [0x3088]={ + adobename="yohiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER YO", @@ -76671,6 +78815,7 @@ characters.data={ unicodeslot=0x3088, }, [0x3089]={ + adobename="rahiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER RA", @@ -76679,6 +78824,7 @@ characters.data={ unicodeslot=0x3089, }, [0x308A]={ + adobename="rihiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER RI", @@ -76687,6 +78833,7 @@ characters.data={ unicodeslot=0x308A, }, [0x308B]={ + adobename="ruhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER RU", @@ -76695,6 +78842,7 @@ characters.data={ unicodeslot=0x308B, }, [0x308C]={ + adobename="rehiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER RE", @@ -76703,6 +78851,7 @@ characters.data={ unicodeslot=0x308C, }, [0x308D]={ + adobename="rohiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER RO", @@ -76711,6 +78860,7 @@ characters.data={ unicodeslot=0x308D, }, [0x308E]={ + adobename="wasmallhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER SMALL WA", @@ -76719,6 +78869,7 @@ characters.data={ unicodeslot=0x308E, }, [0x308F]={ + adobename="wahiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER WA", @@ -76727,6 +78878,7 @@ characters.data={ unicodeslot=0x308F, }, [0x3090]={ + adobename="wihiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER WI", @@ -76735,6 +78887,7 @@ characters.data={ unicodeslot=0x3090, }, [0x3091]={ + adobename="wehiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER WE", @@ -76743,6 +78896,7 @@ characters.data={ unicodeslot=0x3091, }, [0x3092]={ + adobename="wohiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER WO", @@ -76751,6 +78905,7 @@ characters.data={ unicodeslot=0x3092, }, [0x3093]={ + adobename="nhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER N", @@ -76759,6 +78914,7 @@ characters.data={ unicodeslot=0x3093, }, [0x3094]={ + adobename="vuhiragana", category="lo", cjkwd="w", description="HIRAGANA LETTER VU", @@ -76800,6 +78956,7 @@ characters.data={ unicodeslot=0x309A, }, [0x309B]={ + adobename="voicedmarkkana", category="sk", cjkwd="w", description="KATAKANA-HIRAGANA VOICED SOUND MARK", @@ -76809,6 +78966,7 @@ characters.data={ unicodeslot=0x309B, }, [0x309C]={ + adobename="semivoicedmarkkana", category="sk", cjkwd="w", description="KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK", @@ -76818,6 +78976,7 @@ characters.data={ unicodeslot=0x309C, }, [0x309D]={ + adobename="iterationhiragana", category="lm", cjkwd="w", description="HIRAGANA ITERATION MARK", @@ -76826,6 +78985,7 @@ characters.data={ unicodeslot=0x309D, }, [0x309E]={ + adobename="voicediterationhiragana", category="lm", cjkwd="w", description="HIRAGANA VOICED ITERATION MARK", @@ -76852,6 +79012,7 @@ characters.data={ unicodeslot=0x30A0, }, [0x30A1]={ + adobename="asmallkatakana", category="lo", cjkwd="w", description="KATAKANA LETTER SMALL A", @@ -76860,6 +79021,7 @@ characters.data={ unicodeslot=0x30A1, }, [0x30A2]={ + adobename="akatakana", category="lo", cjkwd="w", description="KATAKANA LETTER A", @@ -76868,6 +79030,7 @@ characters.data={ unicodeslot=0x30A2, }, [0x30A3]={ + adobename="ismallkatakana", category="lo", cjkwd="w", description="KATAKANA LETTER SMALL I", @@ -76876,6 +79039,7 @@ characters.data={ unicodeslot=0x30A3, }, [0x30A4]={ + adobename="ikatakana", category="lo", cjkwd="w", description="KATAKANA LETTER I", @@ -76884,6 +79048,7 @@ characters.data={ unicodeslot=0x30A4, }, [0x30A5]={ + adobename="usmallkatakana", category="lo", cjkwd="w", description="KATAKANA LETTER SMALL U", @@ -76892,6 +79057,7 @@ characters.data={ unicodeslot=0x30A5, }, [0x30A6]={ + adobename="ukatakana", category="lo", cjkwd="w", description="KATAKANA LETTER U", @@ -76900,6 +79066,7 @@ characters.data={ unicodeslot=0x30A6, }, [0x30A7]={ + adobename="esmallkatakana", category="lo", cjkwd="w", description="KATAKANA LETTER SMALL E", @@ -76908,6 +79075,7 @@ characters.data={ unicodeslot=0x30A7, }, [0x30A8]={ + adobename="ekatakana", category="lo", cjkwd="w", description="KATAKANA LETTER E", @@ -76916,6 +79084,7 @@ characters.data={ unicodeslot=0x30A8, }, [0x30A9]={ + adobename="osmallkatakana", category="lo", cjkwd="w", description="KATAKANA LETTER SMALL O", @@ -76924,6 +79093,7 @@ characters.data={ unicodeslot=0x30A9, }, [0x30AA]={ + adobename="okatakana", category="lo", cjkwd="w", description="KATAKANA LETTER O", @@ -76932,6 +79102,7 @@ characters.data={ unicodeslot=0x30AA, }, [0x30AB]={ + adobename="kakatakana", category="lo", cjkwd="w", description="KATAKANA LETTER KA", @@ -76940,6 +79111,7 @@ characters.data={ unicodeslot=0x30AB, }, [0x30AC]={ + adobename="gakatakana", category="lo", cjkwd="w", description="KATAKANA LETTER GA", @@ -76949,6 +79121,7 @@ characters.data={ unicodeslot=0x30AC, }, [0x30AD]={ + adobename="kikatakana", category="lo", cjkwd="w", description="KATAKANA LETTER KI", @@ -76957,6 +79130,7 @@ characters.data={ unicodeslot=0x30AD, }, [0x30AE]={ + adobename="gikatakana", category="lo", cjkwd="w", description="KATAKANA LETTER GI", @@ -76966,6 +79140,7 @@ characters.data={ unicodeslot=0x30AE, }, [0x30AF]={ + adobename="kukatakana", category="lo", cjkwd="w", description="KATAKANA LETTER KU", @@ -76974,6 +79149,7 @@ characters.data={ unicodeslot=0x30AF, }, [0x30B0]={ + adobename="gukatakana", category="lo", cjkwd="w", description="KATAKANA LETTER GU", @@ -76983,6 +79159,7 @@ characters.data={ unicodeslot=0x30B0, }, [0x30B1]={ + adobename="kekatakana", category="lo", cjkwd="w", description="KATAKANA LETTER KE", @@ -76991,6 +79168,7 @@ characters.data={ unicodeslot=0x30B1, }, [0x30B2]={ + adobename="gekatakana", category="lo", cjkwd="w", description="KATAKANA LETTER GE", @@ -77000,6 +79178,7 @@ characters.data={ unicodeslot=0x30B2, }, [0x30B3]={ + adobename="kokatakana", category="lo", cjkwd="w", description="KATAKANA LETTER KO", @@ -77008,6 +79187,7 @@ characters.data={ unicodeslot=0x30B3, }, [0x30B4]={ + adobename="gokatakana", category="lo", cjkwd="w", description="KATAKANA LETTER GO", @@ -77017,6 +79197,7 @@ characters.data={ unicodeslot=0x30B4, }, [0x30B5]={ + adobename="sakatakana", category="lo", cjkwd="w", description="KATAKANA LETTER SA", @@ -77025,6 +79206,7 @@ characters.data={ unicodeslot=0x30B5, }, [0x30B6]={ + adobename="zakatakana", category="lo", cjkwd="w", description="KATAKANA LETTER ZA", @@ -77034,6 +79216,7 @@ characters.data={ unicodeslot=0x30B6, }, [0x30B7]={ + adobename="sikatakana", category="lo", cjkwd="w", description="KATAKANA LETTER SI", @@ -77042,6 +79225,7 @@ characters.data={ unicodeslot=0x30B7, }, [0x30B8]={ + adobename="zikatakana", category="lo", cjkwd="w", description="KATAKANA LETTER ZI", @@ -77051,6 +79235,7 @@ characters.data={ unicodeslot=0x30B8, }, [0x30B9]={ + adobename="sukatakana", category="lo", cjkwd="w", description="KATAKANA LETTER SU", @@ -77059,6 +79244,7 @@ characters.data={ unicodeslot=0x30B9, }, [0x30BA]={ + adobename="zukatakana", category="lo", cjkwd="w", description="KATAKANA LETTER ZU", @@ -77068,6 +79254,7 @@ characters.data={ unicodeslot=0x30BA, }, [0x30BB]={ + adobename="sekatakana", category="lo", cjkwd="w", description="KATAKANA LETTER SE", @@ -77076,6 +79263,7 @@ characters.data={ unicodeslot=0x30BB, }, [0x30BC]={ + adobename="zekatakana", category="lo", cjkwd="w", description="KATAKANA LETTER ZE", @@ -77085,6 +79273,7 @@ characters.data={ unicodeslot=0x30BC, }, [0x30BD]={ + adobename="sokatakana", category="lo", cjkwd="w", description="KATAKANA LETTER SO", @@ -77093,6 +79282,7 @@ characters.data={ unicodeslot=0x30BD, }, [0x30BE]={ + adobename="zokatakana", category="lo", cjkwd="w", description="KATAKANA LETTER ZO", @@ -77102,6 +79292,7 @@ characters.data={ unicodeslot=0x30BE, }, [0x30BF]={ + adobename="takatakana", category="lo", cjkwd="w", description="KATAKANA LETTER TA", @@ -77110,6 +79301,7 @@ characters.data={ unicodeslot=0x30BF, }, [0x30C0]={ + adobename="dakatakana", category="lo", cjkwd="w", description="KATAKANA LETTER DA", @@ -77119,6 +79311,7 @@ characters.data={ unicodeslot=0x30C0, }, [0x30C1]={ + adobename="tikatakana", category="lo", cjkwd="w", description="KATAKANA LETTER TI", @@ -77127,6 +79320,7 @@ characters.data={ unicodeslot=0x30C1, }, [0x30C2]={ + adobename="dikatakana", category="lo", cjkwd="w", description="KATAKANA LETTER DI", @@ -77136,6 +79330,7 @@ characters.data={ unicodeslot=0x30C2, }, [0x30C3]={ + adobename="tusmallkatakana", category="lo", cjkwd="w", description="KATAKANA LETTER SMALL TU", @@ -77144,6 +79339,7 @@ characters.data={ unicodeslot=0x30C3, }, [0x30C4]={ + adobename="tukatakana", category="lo", cjkwd="w", description="KATAKANA LETTER TU", @@ -77152,6 +79348,7 @@ characters.data={ unicodeslot=0x30C4, }, [0x30C5]={ + adobename="dukatakana", category="lo", cjkwd="w", description="KATAKANA LETTER DU", @@ -77161,6 +79358,7 @@ characters.data={ unicodeslot=0x30C5, }, [0x30C6]={ + adobename="tekatakana", category="lo", cjkwd="w", description="KATAKANA LETTER TE", @@ -77169,6 +79367,7 @@ characters.data={ unicodeslot=0x30C6, }, [0x30C7]={ + adobename="dekatakana", category="lo", cjkwd="w", description="KATAKANA LETTER DE", @@ -77178,6 +79377,7 @@ characters.data={ unicodeslot=0x30C7, }, [0x30C8]={ + adobename="tokatakana", category="lo", cjkwd="w", description="KATAKANA LETTER TO", @@ -77186,6 +79386,7 @@ characters.data={ unicodeslot=0x30C8, }, [0x30C9]={ + adobename="dokatakana", category="lo", cjkwd="w", description="KATAKANA LETTER DO", @@ -77195,6 +79396,7 @@ characters.data={ unicodeslot=0x30C9, }, [0x30CA]={ + adobename="nakatakana", category="lo", cjkwd="w", description="KATAKANA LETTER NA", @@ -77203,6 +79405,7 @@ characters.data={ unicodeslot=0x30CA, }, [0x30CB]={ + adobename="nikatakana", category="lo", cjkwd="w", description="KATAKANA LETTER NI", @@ -77211,6 +79414,7 @@ characters.data={ unicodeslot=0x30CB, }, [0x30CC]={ + adobename="nukatakana", category="lo", cjkwd="w", description="KATAKANA LETTER NU", @@ -77219,6 +79423,7 @@ characters.data={ unicodeslot=0x30CC, }, [0x30CD]={ + adobename="nekatakana", category="lo", cjkwd="w", description="KATAKANA LETTER NE", @@ -77227,6 +79432,7 @@ characters.data={ unicodeslot=0x30CD, }, [0x30CE]={ + adobename="nokatakana", category="lo", cjkwd="w", description="KATAKANA LETTER NO", @@ -77235,6 +79441,7 @@ characters.data={ unicodeslot=0x30CE, }, [0x30CF]={ + adobename="hakatakana", category="lo", cjkwd="w", description="KATAKANA LETTER HA", @@ -77243,6 +79450,7 @@ characters.data={ unicodeslot=0x30CF, }, [0x30D0]={ + adobename="bakatakana", category="lo", cjkwd="w", description="KATAKANA LETTER BA", @@ -77252,6 +79460,7 @@ characters.data={ unicodeslot=0x30D0, }, [0x30D1]={ + adobename="pakatakana", category="lo", cjkwd="w", description="KATAKANA LETTER PA", @@ -77261,6 +79470,7 @@ characters.data={ unicodeslot=0x30D1, }, [0x30D2]={ + adobename="hikatakana", category="lo", cjkwd="w", description="KATAKANA LETTER HI", @@ -77269,6 +79479,7 @@ characters.data={ unicodeslot=0x30D2, }, [0x30D3]={ + adobename="bikatakana", category="lo", cjkwd="w", description="KATAKANA LETTER BI", @@ -77278,6 +79489,7 @@ characters.data={ unicodeslot=0x30D3, }, [0x30D4]={ + adobename="pikatakana", category="lo", cjkwd="w", description="KATAKANA LETTER PI", @@ -77287,6 +79499,7 @@ characters.data={ unicodeslot=0x30D4, }, [0x30D5]={ + adobename="hukatakana", category="lo", cjkwd="w", description="KATAKANA LETTER HU", @@ -77295,6 +79508,7 @@ characters.data={ unicodeslot=0x30D5, }, [0x30D6]={ + adobename="bukatakana", category="lo", cjkwd="w", description="KATAKANA LETTER BU", @@ -77304,6 +79518,7 @@ characters.data={ unicodeslot=0x30D6, }, [0x30D7]={ + adobename="pukatakana", category="lo", cjkwd="w", description="KATAKANA LETTER PU", @@ -77313,6 +79528,7 @@ characters.data={ unicodeslot=0x30D7, }, [0x30D8]={ + adobename="hekatakana", category="lo", cjkwd="w", description="KATAKANA LETTER HE", @@ -77321,6 +79537,7 @@ characters.data={ unicodeslot=0x30D8, }, [0x30D9]={ + adobename="bekatakana", category="lo", cjkwd="w", description="KATAKANA LETTER BE", @@ -77330,6 +79547,7 @@ characters.data={ unicodeslot=0x30D9, }, [0x30DA]={ + adobename="pekatakana", category="lo", cjkwd="w", description="KATAKANA LETTER PE", @@ -77339,6 +79557,7 @@ characters.data={ unicodeslot=0x30DA, }, [0x30DB]={ + adobename="hokatakana", category="lo", cjkwd="w", description="KATAKANA LETTER HO", @@ -77347,6 +79566,7 @@ characters.data={ unicodeslot=0x30DB, }, [0x30DC]={ + adobename="bokatakana", category="lo", cjkwd="w", description="KATAKANA LETTER BO", @@ -77356,6 +79576,7 @@ characters.data={ unicodeslot=0x30DC, }, [0x30DD]={ + adobename="pokatakana", category="lo", cjkwd="w", description="KATAKANA LETTER PO", @@ -77365,6 +79586,7 @@ characters.data={ unicodeslot=0x30DD, }, [0x30DE]={ + adobename="makatakana", category="lo", cjkwd="w", description="KATAKANA LETTER MA", @@ -77373,6 +79595,7 @@ characters.data={ unicodeslot=0x30DE, }, [0x30DF]={ + adobename="mikatakana", category="lo", cjkwd="w", description="KATAKANA LETTER MI", @@ -77381,6 +79604,7 @@ characters.data={ unicodeslot=0x30DF, }, [0x30E0]={ + adobename="mukatakana", category="lo", cjkwd="w", description="KATAKANA LETTER MU", @@ -77389,6 +79613,7 @@ characters.data={ unicodeslot=0x30E0, }, [0x30E1]={ + adobename="mekatakana", category="lo", cjkwd="w", description="KATAKANA LETTER ME", @@ -77397,6 +79622,7 @@ characters.data={ unicodeslot=0x30E1, }, [0x30E2]={ + adobename="mokatakana", category="lo", cjkwd="w", description="KATAKANA LETTER MO", @@ -77405,6 +79631,7 @@ characters.data={ unicodeslot=0x30E2, }, [0x30E3]={ + adobename="yasmallkatakana", category="lo", cjkwd="w", description="KATAKANA LETTER SMALL YA", @@ -77413,6 +79640,7 @@ characters.data={ unicodeslot=0x30E3, }, [0x30E4]={ + adobename="yakatakana", category="lo", cjkwd="w", description="KATAKANA LETTER YA", @@ -77421,6 +79649,7 @@ characters.data={ unicodeslot=0x30E4, }, [0x30E5]={ + adobename="yusmallkatakana", category="lo", cjkwd="w", description="KATAKANA LETTER SMALL YU", @@ -77429,6 +79658,7 @@ characters.data={ unicodeslot=0x30E5, }, [0x30E6]={ + adobename="yukatakana", category="lo", cjkwd="w", description="KATAKANA LETTER YU", @@ -77437,6 +79667,7 @@ characters.data={ unicodeslot=0x30E6, }, [0x30E7]={ + adobename="yosmallkatakana", category="lo", cjkwd="w", description="KATAKANA LETTER SMALL YO", @@ -77445,6 +79676,7 @@ characters.data={ unicodeslot=0x30E7, }, [0x30E8]={ + adobename="yokatakana", category="lo", cjkwd="w", description="KATAKANA LETTER YO", @@ -77453,6 +79685,7 @@ characters.data={ unicodeslot=0x30E8, }, [0x30E9]={ + adobename="rakatakana", category="lo", cjkwd="w", description="KATAKANA LETTER RA", @@ -77461,6 +79694,7 @@ characters.data={ unicodeslot=0x30E9, }, [0x30EA]={ + adobename="rikatakana", category="lo", cjkwd="w", description="KATAKANA LETTER RI", @@ -77469,6 +79703,7 @@ characters.data={ unicodeslot=0x30EA, }, [0x30EB]={ + adobename="rukatakana", category="lo", cjkwd="w", description="KATAKANA LETTER RU", @@ -77477,6 +79712,7 @@ characters.data={ unicodeslot=0x30EB, }, [0x30EC]={ + adobename="rekatakana", category="lo", cjkwd="w", description="KATAKANA LETTER RE", @@ -77485,6 +79721,7 @@ characters.data={ unicodeslot=0x30EC, }, [0x30ED]={ + adobename="rokatakana", category="lo", cjkwd="w", description="KATAKANA LETTER RO", @@ -77493,6 +79730,7 @@ characters.data={ unicodeslot=0x30ED, }, [0x30EE]={ + adobename="wasmallkatakana", category="lo", cjkwd="w", description="KATAKANA LETTER SMALL WA", @@ -77501,6 +79739,7 @@ characters.data={ unicodeslot=0x30EE, }, [0x30EF]={ + adobename="wakatakana", category="lo", cjkwd="w", description="KATAKANA LETTER WA", @@ -77509,6 +79748,7 @@ characters.data={ unicodeslot=0x30EF, }, [0x30F0]={ + adobename="wikatakana", category="lo", cjkwd="w", description="KATAKANA LETTER WI", @@ -77517,6 +79757,7 @@ characters.data={ unicodeslot=0x30F0, }, [0x30F1]={ + adobename="wekatakana", category="lo", cjkwd="w", description="KATAKANA LETTER WE", @@ -77525,6 +79766,7 @@ characters.data={ unicodeslot=0x30F1, }, [0x30F2]={ + adobename="wokatakana", category="lo", cjkwd="w", description="KATAKANA LETTER WO", @@ -77533,6 +79775,7 @@ characters.data={ unicodeslot=0x30F2, }, [0x30F3]={ + adobename="nkatakana", category="lo", cjkwd="w", description="KATAKANA LETTER N", @@ -77541,6 +79784,7 @@ characters.data={ unicodeslot=0x30F3, }, [0x30F4]={ + adobename="vukatakana", category="lo", cjkwd="w", description="KATAKANA LETTER VU", @@ -77550,6 +79794,7 @@ characters.data={ unicodeslot=0x30F4, }, [0x30F5]={ + adobename="kasmallkatakana", category="lo", cjkwd="w", description="KATAKANA LETTER SMALL KA", @@ -77558,6 +79803,7 @@ characters.data={ unicodeslot=0x30F5, }, [0x30F6]={ + adobename="kesmallkatakana", category="lo", cjkwd="w", description="KATAKANA LETTER SMALL KE", @@ -77566,6 +79812,7 @@ characters.data={ unicodeslot=0x30F6, }, [0x30F7]={ + adobename="vakatakana", category="lo", cjkwd="w", description="KATAKANA LETTER VA", @@ -77575,6 +79822,7 @@ characters.data={ unicodeslot=0x30F7, }, [0x30F8]={ + adobename="vikatakana", category="lo", cjkwd="w", description="KATAKANA LETTER VI", @@ -77584,6 +79832,7 @@ characters.data={ unicodeslot=0x30F8, }, [0x30F9]={ + adobename="vekatakana", category="lo", cjkwd="w", description="KATAKANA LETTER VE", @@ -77593,6 +79842,7 @@ characters.data={ unicodeslot=0x30F9, }, [0x30FA]={ + adobename="vokatakana", category="lo", cjkwd="w", description="KATAKANA LETTER VO", @@ -77602,6 +79852,7 @@ characters.data={ unicodeslot=0x30FA, }, [0x30FB]={ + adobename="dotkatakana", category="po", cjkwd="w", description="KATAKANA MIDDLE DOT", @@ -77610,6 +79861,7 @@ characters.data={ unicodeslot=0x30FB, }, [0x30FC]={ + adobename="prolongedkana", category="lm", cjkwd="w", description="KATAKANA-HIRAGANA PROLONGED SOUND MARK", @@ -77618,6 +79870,7 @@ characters.data={ unicodeslot=0x30FC, }, [0x30FD]={ + adobename="iterationkatakana", category="lm", cjkwd="w", description="KATAKANA ITERATION MARK", @@ -77626,6 +79879,7 @@ characters.data={ unicodeslot=0x30FD, }, [0x30FE]={ + adobename="voicediterationkatakana", category="lm", cjkwd="w", description="KATAKANA VOICED ITERATION MARK", @@ -77644,6 +79898,7 @@ characters.data={ unicodeslot=0x30FF, }, [0x3105]={ + adobename="bbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER B", @@ -77652,6 +79907,7 @@ characters.data={ unicodeslot=0x3105, }, [0x3106]={ + adobename="pbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER P", @@ -77660,6 +79916,7 @@ characters.data={ unicodeslot=0x3106, }, [0x3107]={ + adobename="mbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER M", @@ -77668,6 +79925,7 @@ characters.data={ unicodeslot=0x3107, }, [0x3108]={ + adobename="fbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER F", @@ -77676,6 +79934,7 @@ characters.data={ unicodeslot=0x3108, }, [0x3109]={ + adobename="dbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER D", @@ -77684,6 +79943,7 @@ characters.data={ unicodeslot=0x3109, }, [0x310A]={ + adobename="tbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER T", @@ -77692,6 +79952,7 @@ characters.data={ unicodeslot=0x310A, }, [0x310B]={ + adobename="nbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER N", @@ -77700,6 +79961,7 @@ characters.data={ unicodeslot=0x310B, }, [0x310C]={ + adobename="lbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER L", @@ -77708,6 +79970,7 @@ characters.data={ unicodeslot=0x310C, }, [0x310D]={ + adobename="gbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER G", @@ -77716,6 +79979,7 @@ characters.data={ unicodeslot=0x310D, }, [0x310E]={ + adobename="kbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER K", @@ -77724,6 +79988,7 @@ characters.data={ unicodeslot=0x310E, }, [0x310F]={ + adobename="hbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER H", @@ -77732,6 +79997,7 @@ characters.data={ unicodeslot=0x310F, }, [0x3110]={ + adobename="jbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER J", @@ -77740,6 +80006,7 @@ characters.data={ unicodeslot=0x3110, }, [0x3111]={ + adobename="qbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER Q", @@ -77748,6 +80015,7 @@ characters.data={ unicodeslot=0x3111, }, [0x3112]={ + adobename="xbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER X", @@ -77756,6 +80024,7 @@ characters.data={ unicodeslot=0x3112, }, [0x3113]={ + adobename="zhbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER ZH", @@ -77764,6 +80033,7 @@ characters.data={ unicodeslot=0x3113, }, [0x3114]={ + adobename="chbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER CH", @@ -77772,6 +80042,7 @@ characters.data={ unicodeslot=0x3114, }, [0x3115]={ + adobename="shbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER SH", @@ -77780,6 +80051,7 @@ characters.data={ unicodeslot=0x3115, }, [0x3116]={ + adobename="rbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER R", @@ -77788,6 +80060,7 @@ characters.data={ unicodeslot=0x3116, }, [0x3117]={ + adobename="zbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER Z", @@ -77796,6 +80069,7 @@ characters.data={ unicodeslot=0x3117, }, [0x3118]={ + adobename="cbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER C", @@ -77804,6 +80078,7 @@ characters.data={ unicodeslot=0x3118, }, [0x3119]={ + adobename="sbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER S", @@ -77812,6 +80087,7 @@ characters.data={ unicodeslot=0x3119, }, [0x311A]={ + adobename="abopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER A", @@ -77820,6 +80096,7 @@ characters.data={ unicodeslot=0x311A, }, [0x311B]={ + adobename="obopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER O", @@ -77828,6 +80105,7 @@ characters.data={ unicodeslot=0x311B, }, [0x311C]={ + adobename="ebopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER E", @@ -77836,6 +80114,7 @@ characters.data={ unicodeslot=0x311C, }, [0x311D]={ + adobename="ehbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER EH", @@ -77844,6 +80123,7 @@ characters.data={ unicodeslot=0x311D, }, [0x311E]={ + adobename="aibopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER AI", @@ -77852,6 +80132,7 @@ characters.data={ unicodeslot=0x311E, }, [0x311F]={ + adobename="eibopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER EI", @@ -77860,6 +80141,7 @@ characters.data={ unicodeslot=0x311F, }, [0x3120]={ + adobename="aubopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER AU", @@ -77868,6 +80150,7 @@ characters.data={ unicodeslot=0x3120, }, [0x3121]={ + adobename="oubopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER OU", @@ -77876,6 +80159,7 @@ characters.data={ unicodeslot=0x3121, }, [0x3122]={ + adobename="anbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER AN", @@ -77884,6 +80168,7 @@ characters.data={ unicodeslot=0x3122, }, [0x3123]={ + adobename="enbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER EN", @@ -77892,6 +80177,7 @@ characters.data={ unicodeslot=0x3123, }, [0x3124]={ + adobename="angbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER ANG", @@ -77900,6 +80186,7 @@ characters.data={ unicodeslot=0x3124, }, [0x3125]={ + adobename="engbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER ENG", @@ -77908,6 +80195,7 @@ characters.data={ unicodeslot=0x3125, }, [0x3126]={ + adobename="erbopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER ER", @@ -77916,6 +80204,7 @@ characters.data={ unicodeslot=0x3126, }, [0x3127]={ + adobename="ibopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER I", @@ -77924,6 +80213,7 @@ characters.data={ unicodeslot=0x3127, }, [0x3128]={ + adobename="ubopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER U", @@ -77932,6 +80222,7 @@ characters.data={ unicodeslot=0x3128, }, [0x3129]={ + adobename="iubopomofo", category="lo", cjkwd="w", description="BOPOMOFO LETTER IU", @@ -77964,6 +80255,7 @@ characters.data={ unicodeslot=0x312C, }, [0x3131]={ + adobename="kiyeokkorean", category="lo", cjkwd="w", description="HANGUL LETTER KIYEOK", @@ -77973,6 +80265,7 @@ characters.data={ unicodeslot=0x3131, }, [0x3132]={ + adobename="ssangkiyeokkorean", category="lo", cjkwd="w", description="HANGUL LETTER SSANGKIYEOK", @@ -77982,6 +80275,7 @@ characters.data={ unicodeslot=0x3132, }, [0x3133]={ + adobename="kiyeoksioskorean", category="lo", cjkwd="w", description="HANGUL LETTER KIYEOK-SIOS", @@ -77991,6 +80285,7 @@ characters.data={ unicodeslot=0x3133, }, [0x3134]={ + adobename="nieunkorean", category="lo", cjkwd="w", description="HANGUL LETTER NIEUN", @@ -78000,6 +80295,7 @@ characters.data={ unicodeslot=0x3134, }, [0x3135]={ + adobename="nieuncieuckorean", category="lo", cjkwd="w", description="HANGUL LETTER NIEUN-CIEUC", @@ -78009,6 +80305,7 @@ characters.data={ unicodeslot=0x3135, }, [0x3136]={ + adobename="nieunhieuhkorean", category="lo", cjkwd="w", description="HANGUL LETTER NIEUN-HIEUH", @@ -78018,6 +80315,7 @@ characters.data={ unicodeslot=0x3136, }, [0x3137]={ + adobename="tikeutkorean", category="lo", cjkwd="w", description="HANGUL LETTER TIKEUT", @@ -78027,6 +80325,7 @@ characters.data={ unicodeslot=0x3137, }, [0x3138]={ + adobename="ssangtikeutkorean", category="lo", cjkwd="w", description="HANGUL LETTER SSANGTIKEUT", @@ -78036,6 +80335,7 @@ characters.data={ unicodeslot=0x3138, }, [0x3139]={ + adobename="rieulkorean", category="lo", cjkwd="w", description="HANGUL LETTER RIEUL", @@ -78045,6 +80345,7 @@ characters.data={ unicodeslot=0x3139, }, [0x313A]={ + adobename="rieulkiyeokkorean", category="lo", cjkwd="w", description="HANGUL LETTER RIEUL-KIYEOK", @@ -78054,6 +80355,7 @@ characters.data={ unicodeslot=0x313A, }, [0x313B]={ + adobename="rieulmieumkorean", category="lo", cjkwd="w", description="HANGUL LETTER RIEUL-MIEUM", @@ -78063,6 +80365,7 @@ characters.data={ unicodeslot=0x313B, }, [0x313C]={ + adobename="rieulpieupkorean", category="lo", cjkwd="w", description="HANGUL LETTER RIEUL-PIEUP", @@ -78072,6 +80375,7 @@ characters.data={ unicodeslot=0x313C, }, [0x313D]={ + adobename="rieulsioskorean", category="lo", cjkwd="w", description="HANGUL LETTER RIEUL-SIOS", @@ -78081,6 +80385,7 @@ characters.data={ unicodeslot=0x313D, }, [0x313E]={ + adobename="rieulthieuthkorean", category="lo", cjkwd="w", description="HANGUL LETTER RIEUL-THIEUTH", @@ -78090,6 +80395,7 @@ characters.data={ unicodeslot=0x313E, }, [0x313F]={ + adobename="rieulphieuphkorean", category="lo", cjkwd="w", description="HANGUL LETTER RIEUL-PHIEUPH", @@ -78099,6 +80405,7 @@ characters.data={ unicodeslot=0x313F, }, [0x3140]={ + adobename="rieulhieuhkorean", category="lo", cjkwd="w", description="HANGUL LETTER RIEUL-HIEUH", @@ -78108,6 +80415,7 @@ characters.data={ unicodeslot=0x3140, }, [0x3141]={ + adobename="mieumkorean", category="lo", cjkwd="w", description="HANGUL LETTER MIEUM", @@ -78117,6 +80425,7 @@ characters.data={ unicodeslot=0x3141, }, [0x3142]={ + adobename="pieupkorean", category="lo", cjkwd="w", description="HANGUL LETTER PIEUP", @@ -78126,6 +80435,7 @@ characters.data={ unicodeslot=0x3142, }, [0x3143]={ + adobename="ssangpieupkorean", category="lo", cjkwd="w", description="HANGUL LETTER SSANGPIEUP", @@ -78135,6 +80445,7 @@ characters.data={ unicodeslot=0x3143, }, [0x3144]={ + adobename="pieupsioskorean", category="lo", cjkwd="w", description="HANGUL LETTER PIEUP-SIOS", @@ -78144,6 +80455,7 @@ characters.data={ unicodeslot=0x3144, }, [0x3145]={ + adobename="sioskorean", category="lo", cjkwd="w", description="HANGUL LETTER SIOS", @@ -78153,6 +80465,7 @@ characters.data={ unicodeslot=0x3145, }, [0x3146]={ + adobename="ssangsioskorean", category="lo", cjkwd="w", description="HANGUL LETTER SSANGSIOS", @@ -78162,6 +80475,7 @@ characters.data={ unicodeslot=0x3146, }, [0x3147]={ + adobename="ieungkorean", category="lo", cjkwd="w", description="HANGUL LETTER IEUNG", @@ -78171,6 +80485,7 @@ characters.data={ unicodeslot=0x3147, }, [0x3148]={ + adobename="cieuckorean", category="lo", cjkwd="w", description="HANGUL LETTER CIEUC", @@ -78180,6 +80495,7 @@ characters.data={ unicodeslot=0x3148, }, [0x3149]={ + adobename="ssangcieuckorean", category="lo", cjkwd="w", description="HANGUL LETTER SSANGCIEUC", @@ -78189,6 +80505,7 @@ characters.data={ unicodeslot=0x3149, }, [0x314A]={ + adobename="chieuchkorean", category="lo", cjkwd="w", description="HANGUL LETTER CHIEUCH", @@ -78198,6 +80515,7 @@ characters.data={ unicodeslot=0x314A, }, [0x314B]={ + adobename="khieukhkorean", category="lo", cjkwd="w", description="HANGUL LETTER KHIEUKH", @@ -78207,6 +80525,7 @@ characters.data={ unicodeslot=0x314B, }, [0x314C]={ + adobename="thieuthkorean", category="lo", cjkwd="w", description="HANGUL LETTER THIEUTH", @@ -78216,6 +80535,7 @@ characters.data={ unicodeslot=0x314C, }, [0x314D]={ + adobename="phieuphkorean", category="lo", cjkwd="w", description="HANGUL LETTER PHIEUPH", @@ -78225,6 +80545,7 @@ characters.data={ unicodeslot=0x314D, }, [0x314E]={ + adobename="hieuhkorean", category="lo", cjkwd="w", description="HANGUL LETTER HIEUH", @@ -78234,6 +80555,7 @@ characters.data={ unicodeslot=0x314E, }, [0x314F]={ + adobename="akorean", category="lo", cjkwd="w", description="HANGUL LETTER A", @@ -78243,6 +80565,7 @@ characters.data={ unicodeslot=0x314F, }, [0x3150]={ + adobename="aekorean", category="lo", cjkwd="w", description="HANGUL LETTER AE", @@ -78252,6 +80575,7 @@ characters.data={ unicodeslot=0x3150, }, [0x3151]={ + adobename="yakorean", category="lo", cjkwd="w", description="HANGUL LETTER YA", @@ -78261,6 +80585,7 @@ characters.data={ unicodeslot=0x3151, }, [0x3152]={ + adobename="yaekorean", category="lo", cjkwd="w", description="HANGUL LETTER YAE", @@ -78270,6 +80595,7 @@ characters.data={ unicodeslot=0x3152, }, [0x3153]={ + adobename="eokorean", category="lo", cjkwd="w", description="HANGUL LETTER EO", @@ -78279,6 +80605,7 @@ characters.data={ unicodeslot=0x3153, }, [0x3154]={ + adobename="ekorean", category="lo", cjkwd="w", description="HANGUL LETTER E", @@ -78288,6 +80615,7 @@ characters.data={ unicodeslot=0x3154, }, [0x3155]={ + adobename="yeokorean", category="lo", cjkwd="w", description="HANGUL LETTER YEO", @@ -78297,6 +80625,7 @@ characters.data={ unicodeslot=0x3155, }, [0x3156]={ + adobename="yekorean", category="lo", cjkwd="w", description="HANGUL LETTER YE", @@ -78306,6 +80635,7 @@ characters.data={ unicodeslot=0x3156, }, [0x3157]={ + adobename="okorean", category="lo", cjkwd="w", description="HANGUL LETTER O", @@ -78315,6 +80645,7 @@ characters.data={ unicodeslot=0x3157, }, [0x3158]={ + adobename="wakorean", category="lo", cjkwd="w", description="HANGUL LETTER WA", @@ -78324,6 +80655,7 @@ characters.data={ unicodeslot=0x3158, }, [0x3159]={ + adobename="waekorean", category="lo", cjkwd="w", description="HANGUL LETTER WAE", @@ -78333,6 +80665,7 @@ characters.data={ unicodeslot=0x3159, }, [0x315A]={ + adobename="oekorean", category="lo", cjkwd="w", description="HANGUL LETTER OE", @@ -78342,6 +80675,7 @@ characters.data={ unicodeslot=0x315A, }, [0x315B]={ + adobename="yokorean", category="lo", cjkwd="w", description="HANGUL LETTER YO", @@ -78351,6 +80685,7 @@ characters.data={ unicodeslot=0x315B, }, [0x315C]={ + adobename="ukorean", category="lo", cjkwd="w", description="HANGUL LETTER U", @@ -78360,6 +80695,7 @@ characters.data={ unicodeslot=0x315C, }, [0x315D]={ + adobename="weokorean", category="lo", cjkwd="w", description="HANGUL LETTER WEO", @@ -78369,6 +80705,7 @@ characters.data={ unicodeslot=0x315D, }, [0x315E]={ + adobename="wekorean", category="lo", cjkwd="w", description="HANGUL LETTER WE", @@ -78378,6 +80715,7 @@ characters.data={ unicodeslot=0x315E, }, [0x315F]={ + adobename="wikorean", category="lo", cjkwd="w", description="HANGUL LETTER WI", @@ -78387,6 +80725,7 @@ characters.data={ unicodeslot=0x315F, }, [0x3160]={ + adobename="yukorean", category="lo", cjkwd="w", description="HANGUL LETTER YU", @@ -78396,6 +80735,7 @@ characters.data={ unicodeslot=0x3160, }, [0x3161]={ + adobename="eukorean", category="lo", cjkwd="w", description="HANGUL LETTER EU", @@ -78405,6 +80745,7 @@ characters.data={ unicodeslot=0x3161, }, [0x3162]={ + adobename="yikorean", category="lo", cjkwd="w", description="HANGUL LETTER YI", @@ -78414,6 +80755,7 @@ characters.data={ unicodeslot=0x3162, }, [0x3163]={ + adobename="ikorean", category="lo", cjkwd="w", description="HANGUL LETTER I", @@ -78423,6 +80765,7 @@ characters.data={ unicodeslot=0x3163, }, [0x3164]={ + adobename="hangulfiller", category="lo", cjkwd="w", description="HANGUL FILLER", @@ -78432,6 +80775,7 @@ characters.data={ unicodeslot=0x3164, }, [0x3165]={ + adobename="ssangnieunkorean", category="lo", cjkwd="w", description="HANGUL LETTER SSANGNIEUN", @@ -78441,6 +80785,7 @@ characters.data={ unicodeslot=0x3165, }, [0x3166]={ + adobename="nieuntikeutkorean", category="lo", cjkwd="w", description="HANGUL LETTER NIEUN-TIKEUT", @@ -78450,6 +80795,7 @@ characters.data={ unicodeslot=0x3166, }, [0x3167]={ + adobename="nieunsioskorean", category="lo", cjkwd="w", description="HANGUL LETTER NIEUN-SIOS", @@ -78459,6 +80805,7 @@ characters.data={ unicodeslot=0x3167, }, [0x3168]={ + adobename="nieunpansioskorean", category="lo", cjkwd="w", description="HANGUL LETTER NIEUN-PANSIOS", @@ -78468,6 +80815,7 @@ characters.data={ unicodeslot=0x3168, }, [0x3169]={ + adobename="rieulkiyeoksioskorean", category="lo", cjkwd="w", description="HANGUL LETTER RIEUL-KIYEOK-SIOS", @@ -78477,6 +80825,7 @@ characters.data={ unicodeslot=0x3169, }, [0x316A]={ + adobename="rieultikeutkorean", category="lo", cjkwd="w", description="HANGUL LETTER RIEUL-TIKEUT", @@ -78486,6 +80835,7 @@ characters.data={ unicodeslot=0x316A, }, [0x316B]={ + adobename="rieulpieupsioskorean", category="lo", cjkwd="w", description="HANGUL LETTER RIEUL-PIEUP-SIOS", @@ -78495,6 +80845,7 @@ characters.data={ unicodeslot=0x316B, }, [0x316C]={ + adobename="rieulpansioskorean", category="lo", cjkwd="w", description="HANGUL LETTER RIEUL-PANSIOS", @@ -78504,6 +80855,7 @@ characters.data={ unicodeslot=0x316C, }, [0x316D]={ + adobename="rieulyeorinhieuhkorean", category="lo", cjkwd="w", description="HANGUL LETTER RIEUL-YEORINHIEUH", @@ -78513,6 +80865,7 @@ characters.data={ unicodeslot=0x316D, }, [0x316E]={ + adobename="mieumpieupkorean", category="lo", cjkwd="w", description="HANGUL LETTER MIEUM-PIEUP", @@ -78522,6 +80875,7 @@ characters.data={ unicodeslot=0x316E, }, [0x316F]={ + adobename="mieumsioskorean", category="lo", cjkwd="w", description="HANGUL LETTER MIEUM-SIOS", @@ -78531,6 +80885,7 @@ characters.data={ unicodeslot=0x316F, }, [0x3170]={ + adobename="mieumpansioskorean", category="lo", cjkwd="w", description="HANGUL LETTER MIEUM-PANSIOS", @@ -78540,6 +80895,7 @@ characters.data={ unicodeslot=0x3170, }, [0x3171]={ + adobename="kapyeounmieumkorean", category="lo", cjkwd="w", description="HANGUL LETTER KAPYEOUNMIEUM", @@ -78549,6 +80905,7 @@ characters.data={ unicodeslot=0x3171, }, [0x3172]={ + adobename="pieupkiyeokkorean", category="lo", cjkwd="w", description="HANGUL LETTER PIEUP-KIYEOK", @@ -78558,6 +80915,7 @@ characters.data={ unicodeslot=0x3172, }, [0x3173]={ + adobename="pieuptikeutkorean", category="lo", cjkwd="w", description="HANGUL LETTER PIEUP-TIKEUT", @@ -78567,6 +80925,7 @@ characters.data={ unicodeslot=0x3173, }, [0x3174]={ + adobename="pieupsioskiyeokkorean", category="lo", cjkwd="w", description="HANGUL LETTER PIEUP-SIOS-KIYEOK", @@ -78576,6 +80935,7 @@ characters.data={ unicodeslot=0x3174, }, [0x3175]={ + adobename="pieupsiostikeutkorean", category="lo", cjkwd="w", description="HANGUL LETTER PIEUP-SIOS-TIKEUT", @@ -78585,6 +80945,7 @@ characters.data={ unicodeslot=0x3175, }, [0x3176]={ + adobename="pieupcieuckorean", category="lo", cjkwd="w", description="HANGUL LETTER PIEUP-CIEUC", @@ -78594,6 +80955,7 @@ characters.data={ unicodeslot=0x3176, }, [0x3177]={ + adobename="pieupthieuthkorean", category="lo", cjkwd="w", description="HANGUL LETTER PIEUP-THIEUTH", @@ -78603,6 +80965,7 @@ characters.data={ unicodeslot=0x3177, }, [0x3178]={ + adobename="kapyeounpieupkorean", category="lo", cjkwd="w", description="HANGUL LETTER KAPYEOUNPIEUP", @@ -78612,6 +80975,7 @@ characters.data={ unicodeslot=0x3178, }, [0x3179]={ + adobename="kapyeounssangpieupkorean", category="lo", cjkwd="w", description="HANGUL LETTER KAPYEOUNSSANGPIEUP", @@ -78621,6 +80985,7 @@ characters.data={ unicodeslot=0x3179, }, [0x317A]={ + adobename="sioskiyeokkorean", category="lo", cjkwd="w", description="HANGUL LETTER SIOS-KIYEOK", @@ -78630,6 +80995,7 @@ characters.data={ unicodeslot=0x317A, }, [0x317B]={ + adobename="siosnieunkorean", category="lo", cjkwd="w", description="HANGUL LETTER SIOS-NIEUN", @@ -78639,6 +81005,7 @@ characters.data={ unicodeslot=0x317B, }, [0x317C]={ + adobename="siostikeutkorean", category="lo", cjkwd="w", description="HANGUL LETTER SIOS-TIKEUT", @@ -78648,6 +81015,7 @@ characters.data={ unicodeslot=0x317C, }, [0x317D]={ + adobename="siospieupkorean", category="lo", cjkwd="w", description="HANGUL LETTER SIOS-PIEUP", @@ -78657,6 +81025,7 @@ characters.data={ unicodeslot=0x317D, }, [0x317E]={ + adobename="sioscieuckorean", category="lo", cjkwd="w", description="HANGUL LETTER SIOS-CIEUC", @@ -78666,6 +81035,7 @@ characters.data={ unicodeslot=0x317E, }, [0x317F]={ + adobename="pansioskorean", category="lo", cjkwd="w", description="HANGUL LETTER PANSIOS", @@ -78675,6 +81045,7 @@ characters.data={ unicodeslot=0x317F, }, [0x3180]={ + adobename="ssangieungkorean", category="lo", cjkwd="w", description="HANGUL LETTER SSANGIEUNG", @@ -78684,6 +81055,7 @@ characters.data={ unicodeslot=0x3180, }, [0x3181]={ + adobename="yesieungkorean", category="lo", cjkwd="w", description="HANGUL LETTER YESIEUNG", @@ -78693,6 +81065,7 @@ characters.data={ unicodeslot=0x3181, }, [0x3182]={ + adobename="yesieungsioskorean", category="lo", cjkwd="w", description="HANGUL LETTER YESIEUNG-SIOS", @@ -78702,6 +81075,7 @@ characters.data={ unicodeslot=0x3182, }, [0x3183]={ + adobename="yesieungpansioskorean", category="lo", cjkwd="w", description="HANGUL LETTER YESIEUNG-PANSIOS", @@ -78711,6 +81085,7 @@ characters.data={ unicodeslot=0x3183, }, [0x3184]={ + adobename="kapyeounphieuphkorean", category="lo", cjkwd="w", description="HANGUL LETTER KAPYEOUNPHIEUPH", @@ -78720,6 +81095,7 @@ characters.data={ unicodeslot=0x3184, }, [0x3185]={ + adobename="ssanghieuhkorean", category="lo", cjkwd="w", description="HANGUL LETTER SSANGHIEUH", @@ -78729,6 +81105,7 @@ characters.data={ unicodeslot=0x3185, }, [0x3186]={ + adobename="yeorinhieuhkorean", category="lo", cjkwd="w", description="HANGUL LETTER YEORINHIEUH", @@ -78738,6 +81115,7 @@ characters.data={ unicodeslot=0x3186, }, [0x3187]={ + adobename="yoyakorean", category="lo", cjkwd="w", description="HANGUL LETTER YO-YA", @@ -78747,6 +81125,7 @@ characters.data={ unicodeslot=0x3187, }, [0x3188]={ + adobename="yoyaekorean", category="lo", cjkwd="w", description="HANGUL LETTER YO-YAE", @@ -78756,6 +81135,7 @@ characters.data={ unicodeslot=0x3188, }, [0x3189]={ + adobename="yoikorean", category="lo", cjkwd="w", description="HANGUL LETTER YO-I", @@ -78765,6 +81145,7 @@ characters.data={ unicodeslot=0x3189, }, [0x318A]={ + adobename="yuyeokorean", category="lo", cjkwd="w", description="HANGUL LETTER YU-YEO", @@ -78774,6 +81155,7 @@ characters.data={ unicodeslot=0x318A, }, [0x318B]={ + adobename="yuyekorean", category="lo", cjkwd="w", description="HANGUL LETTER YU-YE", @@ -78783,6 +81165,7 @@ characters.data={ unicodeslot=0x318B, }, [0x318C]={ + adobename="yuikorean", category="lo", cjkwd="w", description="HANGUL LETTER YU-I", @@ -78792,6 +81175,7 @@ characters.data={ unicodeslot=0x318C, }, [0x318D]={ + adobename="araeakorean", category="lo", cjkwd="w", description="HANGUL LETTER ARAEA", @@ -78801,6 +81185,7 @@ characters.data={ unicodeslot=0x318D, }, [0x318E]={ + adobename="araeaekorean", category="lo", cjkwd="w", description="HANGUL LETTER ARAEAE", @@ -79400,6 +81785,7 @@ characters.data={ unicodeslot=0x31FF, }, [0x3200]={ + adobename="kiyeokparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL KIYEOK", @@ -79409,6 +81795,7 @@ characters.data={ unicodeslot=0x3200, }, [0x3201]={ + adobename="nieunparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL NIEUN", @@ -79418,6 +81805,7 @@ characters.data={ unicodeslot=0x3201, }, [0x3202]={ + adobename="tikeutparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL TIKEUT", @@ -79427,6 +81815,7 @@ characters.data={ unicodeslot=0x3202, }, [0x3203]={ + adobename="rieulparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL RIEUL", @@ -79436,6 +81825,7 @@ characters.data={ unicodeslot=0x3203, }, [0x3204]={ + adobename="mieumparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL MIEUM", @@ -79445,6 +81835,7 @@ characters.data={ unicodeslot=0x3204, }, [0x3205]={ + adobename="pieupparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL PIEUP", @@ -79454,6 +81845,7 @@ characters.data={ unicodeslot=0x3205, }, [0x3206]={ + adobename="siosparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL SIOS", @@ -79463,6 +81855,7 @@ characters.data={ unicodeslot=0x3206, }, [0x3207]={ + adobename="ieungparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL IEUNG", @@ -79472,6 +81865,7 @@ characters.data={ unicodeslot=0x3207, }, [0x3208]={ + adobename="cieucparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL CIEUC", @@ -79481,6 +81875,7 @@ characters.data={ unicodeslot=0x3208, }, [0x3209]={ + adobename="chieuchparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL CHIEUCH", @@ -79490,6 +81885,7 @@ characters.data={ unicodeslot=0x3209, }, [0x320A]={ + adobename="khieukhparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL KHIEUKH", @@ -79499,6 +81895,7 @@ characters.data={ unicodeslot=0x320A, }, [0x320B]={ + adobename="thieuthparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL THIEUTH", @@ -79508,6 +81905,7 @@ characters.data={ unicodeslot=0x320B, }, [0x320C]={ + adobename="phieuphparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL PHIEUPH", @@ -79517,6 +81915,7 @@ characters.data={ unicodeslot=0x320C, }, [0x320D]={ + adobename="hieuhparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL HIEUH", @@ -79526,6 +81925,7 @@ characters.data={ unicodeslot=0x320D, }, [0x320E]={ + adobename="kiyeokaparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL KIYEOK A", @@ -79535,6 +81935,7 @@ characters.data={ unicodeslot=0x320E, }, [0x320F]={ + adobename="nieunaparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL NIEUN A", @@ -79544,6 +81945,7 @@ characters.data={ unicodeslot=0x320F, }, [0x3210]={ + adobename="tikeutaparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL TIKEUT A", @@ -79553,6 +81955,7 @@ characters.data={ unicodeslot=0x3210, }, [0x3211]={ + adobename="rieulaparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL RIEUL A", @@ -79562,6 +81965,7 @@ characters.data={ unicodeslot=0x3211, }, [0x3212]={ + adobename="mieumaparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL MIEUM A", @@ -79571,6 +81975,7 @@ characters.data={ unicodeslot=0x3212, }, [0x3213]={ + adobename="pieupaparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL PIEUP A", @@ -79580,6 +81985,7 @@ characters.data={ unicodeslot=0x3213, }, [0x3214]={ + adobename="siosaparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL SIOS A", @@ -79589,6 +81995,7 @@ characters.data={ unicodeslot=0x3214, }, [0x3215]={ + adobename="ieungaparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL IEUNG A", @@ -79598,6 +82005,7 @@ characters.data={ unicodeslot=0x3215, }, [0x3216]={ + adobename="cieucaparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL CIEUC A", @@ -79607,6 +82015,7 @@ characters.data={ unicodeslot=0x3216, }, [0x3217]={ + adobename="chieuchaparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL CHIEUCH A", @@ -79616,6 +82025,7 @@ characters.data={ unicodeslot=0x3217, }, [0x3218]={ + adobename="khieukhaparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL KHIEUKH A", @@ -79625,6 +82035,7 @@ characters.data={ unicodeslot=0x3218, }, [0x3219]={ + adobename="thieuthaparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL THIEUTH A", @@ -79634,6 +82045,7 @@ characters.data={ unicodeslot=0x3219, }, [0x321A]={ + adobename="phieuphaparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL PHIEUPH A", @@ -79643,6 +82055,7 @@ characters.data={ unicodeslot=0x321A, }, [0x321B]={ + adobename="hieuhaparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL HIEUH A", @@ -79652,6 +82065,7 @@ characters.data={ unicodeslot=0x321B, }, [0x321C]={ + adobename="cieucuparenkorean", category="so", cjkwd="w", description="PARENTHESIZED HANGUL CIEUC U", @@ -79679,6 +82093,7 @@ characters.data={ unicodeslot=0x321E, }, [0x3220]={ + adobename="oneideographicparen", category="no", cjkwd="w", description="PARENTHESIZED IDEOGRAPH ONE", @@ -79688,6 +82103,7 @@ characters.data={ unicodeslot=0x3220, }, [0x3221]={ + adobename="twoideographicparen", category="no", cjkwd="w", description="PARENTHESIZED IDEOGRAPH TWO", @@ -79697,6 +82113,7 @@ characters.data={ unicodeslot=0x3221, }, [0x3222]={ + adobename="threeideographicparen", category="no", cjkwd="w", description="PARENTHESIZED IDEOGRAPH THREE", @@ -79706,6 +82123,7 @@ characters.data={ unicodeslot=0x3222, }, [0x3223]={ + adobename="fourideographicparen", category="no", cjkwd="w", description="PARENTHESIZED IDEOGRAPH FOUR", @@ -79715,6 +82133,7 @@ characters.data={ unicodeslot=0x3223, }, [0x3224]={ + adobename="fiveideographicparen", category="no", cjkwd="w", description="PARENTHESIZED IDEOGRAPH FIVE", @@ -79724,6 +82143,7 @@ characters.data={ unicodeslot=0x3224, }, [0x3225]={ + adobename="sixideographicparen", category="no", cjkwd="w", description="PARENTHESIZED IDEOGRAPH SIX", @@ -79733,6 +82153,7 @@ characters.data={ unicodeslot=0x3225, }, [0x3226]={ + adobename="sevenideographicparen", category="no", cjkwd="w", description="PARENTHESIZED IDEOGRAPH SEVEN", @@ -79742,6 +82163,7 @@ characters.data={ unicodeslot=0x3226, }, [0x3227]={ + adobename="eightideographicparen", category="no", cjkwd="w", description="PARENTHESIZED IDEOGRAPH EIGHT", @@ -79751,6 +82173,7 @@ characters.data={ unicodeslot=0x3227, }, [0x3228]={ + adobename="nineideographicparen", category="no", cjkwd="w", description="PARENTHESIZED IDEOGRAPH NINE", @@ -79760,6 +82183,7 @@ characters.data={ unicodeslot=0x3228, }, [0x3229]={ + adobename="tenideographicparen", category="no", cjkwd="w", description="PARENTHESIZED IDEOGRAPH TEN", @@ -79769,6 +82193,7 @@ characters.data={ unicodeslot=0x3229, }, [0x322A]={ + adobename="ideographicmoonparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH MOON", @@ -79778,6 +82203,7 @@ characters.data={ unicodeslot=0x322A, }, [0x322B]={ + adobename="ideographicfireparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH FIRE", @@ -79787,6 +82213,7 @@ characters.data={ unicodeslot=0x322B, }, [0x322C]={ + adobename="ideographicwaterparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH WATER", @@ -79796,6 +82223,7 @@ characters.data={ unicodeslot=0x322C, }, [0x322D]={ + adobename="ideographicwoodparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH WOOD", @@ -79805,6 +82233,7 @@ characters.data={ unicodeslot=0x322D, }, [0x322E]={ + adobename="ideographicmetalparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH METAL", @@ -79814,6 +82243,7 @@ characters.data={ unicodeslot=0x322E, }, [0x322F]={ + adobename="ideographicearthparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH EARTH", @@ -79823,6 +82253,7 @@ characters.data={ unicodeslot=0x322F, }, [0x3230]={ + adobename="ideographicsunparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH SUN", @@ -79832,6 +82263,7 @@ characters.data={ unicodeslot=0x3230, }, [0x3231]={ + adobename="ideographicstockparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH STOCK", @@ -79841,6 +82273,7 @@ characters.data={ unicodeslot=0x3231, }, [0x3232]={ + adobename="ideographichaveparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH HAVE", @@ -79850,6 +82283,7 @@ characters.data={ unicodeslot=0x3232, }, [0x3233]={ + adobename="ideographicsocietyparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH SOCIETY", @@ -79859,6 +82293,7 @@ characters.data={ unicodeslot=0x3233, }, [0x3234]={ + adobename="ideographicnameparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH NAME", @@ -79868,6 +82303,7 @@ characters.data={ unicodeslot=0x3234, }, [0x3235]={ + adobename="ideographicspecialparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH SPECIAL", @@ -79877,6 +82313,7 @@ characters.data={ unicodeslot=0x3235, }, [0x3236]={ + adobename="ideographicfinancialparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH FINANCIAL", @@ -79886,6 +82323,7 @@ characters.data={ unicodeslot=0x3236, }, [0x3237]={ + adobename="ideographiccongratulationparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH CONGRATULATION", @@ -79895,6 +82333,7 @@ characters.data={ unicodeslot=0x3237, }, [0x3238]={ + adobename="ideographiclaborparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH LABOR", @@ -79904,6 +82343,7 @@ characters.data={ unicodeslot=0x3238, }, [0x3239]={ + adobename="ideographicrepresentparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH REPRESENT", @@ -79913,6 +82353,7 @@ characters.data={ unicodeslot=0x3239, }, [0x323A]={ + adobename="ideographiccallparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH CALL", @@ -79922,6 +82363,7 @@ characters.data={ unicodeslot=0x323A, }, [0x323B]={ + adobename="ideographicstudyparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH STUDY", @@ -79931,6 +82373,7 @@ characters.data={ unicodeslot=0x323B, }, [0x323C]={ + adobename="ideographicsuperviseparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH SUPERVISE", @@ -79940,6 +82383,7 @@ characters.data={ unicodeslot=0x323C, }, [0x323D]={ + adobename="ideographicenterpriseparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH ENTERPRISE", @@ -79949,6 +82393,7 @@ characters.data={ unicodeslot=0x323D, }, [0x323E]={ + adobename="ideographicresourceparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH RESOURCE", @@ -79958,6 +82403,7 @@ characters.data={ unicodeslot=0x323E, }, [0x323F]={ + adobename="ideographicallianceparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH ALLIANCE", @@ -79967,6 +82413,7 @@ characters.data={ unicodeslot=0x323F, }, [0x3240]={ + adobename="ideographicfestivalparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH FESTIVAL", @@ -79985,6 +82432,7 @@ characters.data={ unicodeslot=0x3241, }, [0x3242]={ + adobename="ideographicselfparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH SELF", @@ -79994,6 +82442,7 @@ characters.data={ unicodeslot=0x3242, }, [0x3243]={ + adobename="ideographicreachparen", category="so", cjkwd="w", description="PARENTHESIZED IDEOGRAPH REACH", @@ -80147,6 +82596,7 @@ characters.data={ unicodeslot=0x325F, }, [0x3260]={ + adobename="kiyeokcirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL KIYEOK", @@ -80156,6 +82606,7 @@ characters.data={ unicodeslot=0x3260, }, [0x3261]={ + adobename="nieuncirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL NIEUN", @@ -80165,6 +82616,7 @@ characters.data={ unicodeslot=0x3261, }, [0x3262]={ + adobename="tikeutcirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL TIKEUT", @@ -80174,6 +82626,7 @@ characters.data={ unicodeslot=0x3262, }, [0x3263]={ + adobename="rieulcirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL RIEUL", @@ -80183,6 +82636,7 @@ characters.data={ unicodeslot=0x3263, }, [0x3264]={ + adobename="mieumcirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL MIEUM", @@ -80192,6 +82646,7 @@ characters.data={ unicodeslot=0x3264, }, [0x3265]={ + adobename="pieupcirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL PIEUP", @@ -80201,6 +82656,7 @@ characters.data={ unicodeslot=0x3265, }, [0x3266]={ + adobename="sioscirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL SIOS", @@ -80210,6 +82666,7 @@ characters.data={ unicodeslot=0x3266, }, [0x3267]={ + adobename="ieungcirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL IEUNG", @@ -80219,6 +82676,7 @@ characters.data={ unicodeslot=0x3267, }, [0x3268]={ + adobename="cieuccirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL CIEUC", @@ -80228,6 +82686,7 @@ characters.data={ unicodeslot=0x3268, }, [0x3269]={ + adobename="chieuchcirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL CHIEUCH", @@ -80237,6 +82696,7 @@ characters.data={ unicodeslot=0x3269, }, [0x326A]={ + adobename="khieukhcirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL KHIEUKH", @@ -80246,6 +82706,7 @@ characters.data={ unicodeslot=0x326A, }, [0x326B]={ + adobename="thieuthcirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL THIEUTH", @@ -80255,6 +82716,7 @@ characters.data={ unicodeslot=0x326B, }, [0x326C]={ + adobename="phieuphcirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL PHIEUPH", @@ -80264,6 +82726,7 @@ characters.data={ unicodeslot=0x326C, }, [0x326D]={ + adobename="hieuhcirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL HIEUH", @@ -80273,6 +82736,7 @@ characters.data={ unicodeslot=0x326D, }, [0x326E]={ + adobename="kiyeokacirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL KIYEOK A", @@ -80282,6 +82746,7 @@ characters.data={ unicodeslot=0x326E, }, [0x326F]={ + adobename="nieunacirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL NIEUN A", @@ -80291,6 +82756,7 @@ characters.data={ unicodeslot=0x326F, }, [0x3270]={ + adobename="tikeutacirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL TIKEUT A", @@ -80300,6 +82766,7 @@ characters.data={ unicodeslot=0x3270, }, [0x3271]={ + adobename="rieulacirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL RIEUL A", @@ -80309,6 +82776,7 @@ characters.data={ unicodeslot=0x3271, }, [0x3272]={ + adobename="mieumacirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL MIEUM A", @@ -80318,6 +82786,7 @@ characters.data={ unicodeslot=0x3272, }, [0x3273]={ + adobename="pieupacirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL PIEUP A", @@ -80327,6 +82796,7 @@ characters.data={ unicodeslot=0x3273, }, [0x3274]={ + adobename="siosacirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL SIOS A", @@ -80336,6 +82806,7 @@ characters.data={ unicodeslot=0x3274, }, [0x3275]={ + adobename="ieungacirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL IEUNG A", @@ -80345,6 +82816,7 @@ characters.data={ unicodeslot=0x3275, }, [0x3276]={ + adobename="cieucacirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL CIEUC A", @@ -80354,6 +82826,7 @@ characters.data={ unicodeslot=0x3276, }, [0x3277]={ + adobename="chieuchacirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL CHIEUCH A", @@ -80363,6 +82836,7 @@ characters.data={ unicodeslot=0x3277, }, [0x3278]={ + adobename="khieukhacirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL KHIEUKH A", @@ -80372,6 +82846,7 @@ characters.data={ unicodeslot=0x3278, }, [0x3279]={ + adobename="thieuthacirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL THIEUTH A", @@ -80381,6 +82856,7 @@ characters.data={ unicodeslot=0x3279, }, [0x327A]={ + adobename="phieuphacirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL PHIEUPH A", @@ -80390,6 +82866,7 @@ characters.data={ unicodeslot=0x327A, }, [0x327B]={ + adobename="hieuhacirclekorean", category="so", cjkwd="w", description="CIRCLED HANGUL HIEUH A", @@ -80426,6 +82903,7 @@ characters.data={ unicodeslot=0x327E, }, [0x327F]={ + adobename="koreanstandardsymbol", category="so", cjkwd="w", description="KOREAN STANDARD SYMBOL", @@ -80524,6 +83002,7 @@ characters.data={ unicodeslot=0x3289, }, [0x328A]={ + adobename="ideographmooncircle", category="so", cjkwd="w", description="CIRCLED IDEOGRAPH MOON", @@ -80533,6 +83012,7 @@ characters.data={ unicodeslot=0x328A, }, [0x328B]={ + adobename="ideographfirecircle", category="so", cjkwd="w", description="CIRCLED IDEOGRAPH FIRE", @@ -80542,6 +83022,7 @@ characters.data={ unicodeslot=0x328B, }, [0x328C]={ + adobename="ideographwatercircle", category="so", cjkwd="w", description="CIRCLED IDEOGRAPH WATER", @@ -80551,6 +83032,7 @@ characters.data={ unicodeslot=0x328C, }, [0x328D]={ + adobename="ideographwoodcircle", category="so", cjkwd="w", description="CIRCLED IDEOGRAPH WOOD", @@ -80560,6 +83042,7 @@ characters.data={ unicodeslot=0x328D, }, [0x328E]={ + adobename="ideographmetalcircle", category="so", cjkwd="w", description="CIRCLED IDEOGRAPH METAL", @@ -80569,6 +83052,7 @@ characters.data={ unicodeslot=0x328E, }, [0x328F]={ + adobename="ideographearthcircle", category="so", cjkwd="w", description="CIRCLED IDEOGRAPH EARTH", @@ -80578,6 +83062,7 @@ characters.data={ unicodeslot=0x328F, }, [0x3290]={ + adobename="ideographsuncircle", category="so", cjkwd="w", description="CIRCLED IDEOGRAPH SUN", @@ -80614,6 +83099,7 @@ characters.data={ unicodeslot=0x3293, }, [0x3294]={ + adobename="ideographnamecircle", category="so", cjkwd="w", description="CIRCLED IDEOGRAPH NAME", @@ -80632,6 +83118,7 @@ characters.data={ unicodeslot=0x3295, }, [0x3296]={ + adobename="ideographicfinancialcircle", category="so", cjkwd="w", description="CIRCLED IDEOGRAPH FINANCIAL", @@ -80650,6 +83137,7 @@ characters.data={ unicodeslot=0x3297, }, [0x3298]={ + adobename="ideographiclaborcircle", category="so", cjkwd="w", description="CIRCLED IDEOGRAPH LABOR", @@ -80659,6 +83147,7 @@ characters.data={ unicodeslot=0x3298, }, [0x3299]={ + adobename="ideographicsecretcircle", category="so", cjkwd="w", description="CIRCLED IDEOGRAPH SECRET", @@ -80695,6 +83184,7 @@ characters.data={ unicodeslot=0x329C, }, [0x329D]={ + adobename="ideographicexcellentcircle", category="so", cjkwd="w", description="CIRCLED IDEOGRAPH EXCELLENT", @@ -80704,6 +83194,7 @@ characters.data={ unicodeslot=0x329D, }, [0x329E]={ + adobename="ideographicprintcircle", category="so", cjkwd="w", description="CIRCLED IDEOGRAPH PRINT", @@ -80749,6 +83240,7 @@ characters.data={ unicodeslot=0x32A2, }, [0x32A3]={ + adobename="ideographiccorrectcircle", category="so", cjkwd="w", description="CIRCLED IDEOGRAPH CORRECT", @@ -80758,6 +83250,7 @@ characters.data={ unicodeslot=0x32A3, }, [0x32A4]={ + adobename="ideographichighcircle", category="so", cjkwd="w", description="CIRCLED IDEOGRAPH HIGH", @@ -80767,6 +83260,7 @@ characters.data={ unicodeslot=0x32A4, }, [0x32A5]={ + adobename="ideographiccentrecircle", category="so", cjkwd="w", description="CIRCLED IDEOGRAPH CENTRE", @@ -80776,6 +83270,7 @@ characters.data={ unicodeslot=0x32A5, }, [0x32A6]={ + adobename="ideographiclowcircle", category="so", cjkwd="w", description="CIRCLED IDEOGRAPH LOW", @@ -80785,6 +83280,7 @@ characters.data={ unicodeslot=0x32A6, }, [0x32A7]={ + adobename="ideographicleftcircle", category="so", cjkwd="w", description="CIRCLED IDEOGRAPH LEFT", @@ -80794,6 +83290,7 @@ characters.data={ unicodeslot=0x32A7, }, [0x32A8]={ + adobename="ideographicrightcircle", category="so", cjkwd="w", description="CIRCLED IDEOGRAPH RIGHT", @@ -80803,6 +83300,7 @@ characters.data={ unicodeslot=0x32A8, }, [0x32A9]={ + adobename="ideographicmedicinecircle", category="so", cjkwd="w", description="CIRCLED IDEOGRAPH MEDICINE", @@ -81577,6 +84075,7 @@ characters.data={ unicodeslot=0x32FE, }, [0x3300]={ + adobename="apaatosquare", category="so", cjkwd="w", description="SQUARE APAATO", @@ -81604,6 +84103,7 @@ characters.data={ unicodeslot=0x3302, }, [0x3303]={ + adobename="aarusquare", category="so", cjkwd="w", description="SQUARE AARU", @@ -81622,6 +84122,7 @@ characters.data={ unicodeslot=0x3304, }, [0x3305]={ + adobename="intisquare", category="so", cjkwd="w", description="SQUARE INTI", @@ -81694,6 +84195,7 @@ characters.data={ unicodeslot=0x330C, }, [0x330D]={ + adobename="karoriisquare", category="so", cjkwd="w", description="SQUARE KARORII", @@ -81757,6 +84259,7 @@ characters.data={ unicodeslot=0x3313, }, [0x3314]={ + adobename="kirosquare", category="so", cjkwd="w", description="SQUARE KIRO", @@ -81766,6 +84269,7 @@ characters.data={ unicodeslot=0x3314, }, [0x3315]={ + adobename="kiroguramusquare", category="so", cjkwd="w", description="SQUARE KIROGURAMU", @@ -81775,6 +84279,7 @@ characters.data={ unicodeslot=0x3315, }, [0x3316]={ + adobename="kiromeetorusquare", category="so", cjkwd="w", description="SQUARE KIROMEETORU", @@ -81793,6 +84298,7 @@ characters.data={ unicodeslot=0x3317, }, [0x3318]={ + adobename="guramusquare", category="so", cjkwd="w", description="SQUARE GURAMU", @@ -81847,6 +84353,7 @@ characters.data={ unicodeslot=0x331D, }, [0x331E]={ + adobename="kooposquare", category="so", cjkwd="w", description="SQUARE KOOPO", @@ -81883,6 +84390,7 @@ characters.data={ unicodeslot=0x3321, }, [0x3322]={ + adobename="sentisquare", category="so", cjkwd="w", description="SQUARE SENTI", @@ -81892,6 +84400,7 @@ characters.data={ unicodeslot=0x3322, }, [0x3323]={ + adobename="sentosquare", category="so", cjkwd="w", description="SQUARE SENTO", @@ -81919,6 +84428,7 @@ characters.data={ unicodeslot=0x3325, }, [0x3326]={ + adobename="dorusquare", category="so", cjkwd="w", description="SQUARE DORU", @@ -81928,6 +84438,7 @@ characters.data={ unicodeslot=0x3326, }, [0x3327]={ + adobename="tonsquare", category="so", cjkwd="w", description="SQUARE TON", @@ -81955,6 +84466,7 @@ characters.data={ unicodeslot=0x3329, }, [0x332A]={ + adobename="haitusquare", category="so", cjkwd="w", description="SQUARE HAITU", @@ -81964,6 +84476,7 @@ characters.data={ unicodeslot=0x332A, }, [0x332B]={ + adobename="paasentosquare", category="so", cjkwd="w", description="SQUARE PAASENTO", @@ -82018,6 +84531,7 @@ characters.data={ unicodeslot=0x3330, }, [0x3331]={ + adobename="birusquare", category="so", cjkwd="w", description="SQUARE BIRU", @@ -82036,6 +84550,7 @@ characters.data={ unicodeslot=0x3332, }, [0x3333]={ + adobename="huiitosquare", category="so", cjkwd="w", description="SQUARE HUIITO", @@ -82063,6 +84578,7 @@ characters.data={ unicodeslot=0x3335, }, [0x3336]={ + adobename="hekutaarusquare", category="so", cjkwd="w", description="SQUARE HEKUTAARU", @@ -82090,6 +84606,7 @@ characters.data={ unicodeslot=0x3338, }, [0x3339]={ + adobename="herutusquare", category="so", cjkwd="w", description="SQUARE HERUTU", @@ -82108,6 +84625,7 @@ characters.data={ unicodeslot=0x333A, }, [0x333B]={ + adobename="peezisquare", category="so", cjkwd="w", description="SQUARE PEEZI", @@ -82171,6 +84689,7 @@ characters.data={ unicodeslot=0x3341, }, [0x3342]={ + adobename="hoonsquare", category="so", cjkwd="w", description="SQUARE HOON", @@ -82216,6 +84735,7 @@ characters.data={ unicodeslot=0x3346, }, [0x3347]={ + adobename="mansyonsquare", category="so", cjkwd="w", description="SQUARE MANSYON", @@ -82234,6 +84754,7 @@ characters.data={ unicodeslot=0x3348, }, [0x3349]={ + adobename="mirisquare", category="so", cjkwd="w", description="SQUARE MIRI", @@ -82243,6 +84764,7 @@ characters.data={ unicodeslot=0x3349, }, [0x334A]={ + adobename="miribaarusquare", category="so", cjkwd="w", description="SQUARE MIRIBAARU", @@ -82270,6 +84792,7 @@ characters.data={ unicodeslot=0x334C, }, [0x334D]={ + adobename="meetorusquare", category="so", cjkwd="w", description="SQUARE MEETORU", @@ -82279,6 +84802,7 @@ characters.data={ unicodeslot=0x334D, }, [0x334E]={ + adobename="yaadosquare", category="so", cjkwd="w", description="SQUARE YAADO", @@ -82306,6 +84830,7 @@ characters.data={ unicodeslot=0x3350, }, [0x3351]={ + adobename="rittorusquare", category="so", cjkwd="w", description="SQUARE RITTORU", @@ -82360,6 +84885,7 @@ characters.data={ unicodeslot=0x3356, }, [0x3357]={ + adobename="wattosquare", category="so", cjkwd="w", description="SQUARE WATTO", @@ -82684,6 +85210,7 @@ characters.data={ unicodeslot=0x337A, }, [0x337B]={ + adobename="heiseierasquare", category="so", cjkwd="w", description="SQUARE ERA NAME HEISEI", @@ -82693,6 +85220,7 @@ characters.data={ unicodeslot=0x337B, }, [0x337C]={ + adobename="syouwaerasquare", category="so", cjkwd="w", description="SQUARE ERA NAME SYOUWA", @@ -82702,6 +85230,7 @@ characters.data={ unicodeslot=0x337C, }, [0x337D]={ + adobename="taisyouerasquare", category="so", cjkwd="w", description="SQUARE ERA NAME TAISYOU", @@ -82711,6 +85240,7 @@ characters.data={ unicodeslot=0x337D, }, [0x337E]={ + adobename="meizierasquare", category="so", cjkwd="w", description="SQUARE ERA NAME MEIZI", @@ -82720,6 +85250,7 @@ characters.data={ unicodeslot=0x337E, }, [0x337F]={ + adobename="corporationsquare", category="so", cjkwd="w", description="SQUARE CORPORATION", @@ -82729,6 +85260,7 @@ characters.data={ unicodeslot=0x337F, }, [0x3380]={ + adobename="paampssquare", category="so", cjkwd="w", description="SQUARE PA AMPS", @@ -82738,6 +85270,7 @@ characters.data={ unicodeslot=0x3380, }, [0x3381]={ + adobename="nasquare", category="so", cjkwd="w", description="SQUARE NA", @@ -82747,6 +85280,7 @@ characters.data={ unicodeslot=0x3381, }, [0x3382]={ + adobename="muasquare", category="so", cjkwd="w", description="SQUARE MU A", @@ -82756,6 +85290,7 @@ characters.data={ unicodeslot=0x3382, }, [0x3383]={ + adobename="masquare", category="so", cjkwd="w", description="SQUARE MA", @@ -82765,6 +85300,7 @@ characters.data={ unicodeslot=0x3383, }, [0x3384]={ + adobename="kasquare", category="so", cjkwd="w", description="SQUARE KA", @@ -82774,6 +85310,7 @@ characters.data={ unicodeslot=0x3384, }, [0x3385]={ + adobename="KBsquare", category="so", cjkwd="w", description="SQUARE KB", @@ -82783,6 +85320,7 @@ characters.data={ unicodeslot=0x3385, }, [0x3386]={ + adobename="MBsquare", category="so", cjkwd="w", description="SQUARE MB", @@ -82792,6 +85330,7 @@ characters.data={ unicodeslot=0x3386, }, [0x3387]={ + adobename="GBsquare", category="so", cjkwd="w", description="SQUARE GB", @@ -82801,6 +85340,7 @@ characters.data={ unicodeslot=0x3387, }, [0x3388]={ + adobename="calsquare", category="so", cjkwd="w", description="SQUARE CAL", @@ -82810,6 +85350,7 @@ characters.data={ unicodeslot=0x3388, }, [0x3389]={ + adobename="kcalsquare", category="so", cjkwd="w", description="SQUARE KCAL", @@ -82819,6 +85360,7 @@ characters.data={ unicodeslot=0x3389, }, [0x338A]={ + adobename="pfsquare", category="so", cjkwd="w", description="SQUARE PF", @@ -82828,6 +85370,7 @@ characters.data={ unicodeslot=0x338A, }, [0x338B]={ + adobename="nfsquare", category="so", cjkwd="w", description="SQUARE NF", @@ -82837,6 +85380,7 @@ characters.data={ unicodeslot=0x338B, }, [0x338C]={ + adobename="mufsquare", category="so", cjkwd="w", description="SQUARE MU F", @@ -82846,6 +85390,7 @@ characters.data={ unicodeslot=0x338C, }, [0x338D]={ + adobename="mugsquare", category="so", cjkwd="w", description="SQUARE MU G", @@ -82855,6 +85400,7 @@ characters.data={ unicodeslot=0x338D, }, [0x338E]={ + adobename="squaremg", category="so", cjkwd="w", description="SQUARE MG", @@ -82864,6 +85410,7 @@ characters.data={ unicodeslot=0x338E, }, [0x338F]={ + adobename="squarekg", category="so", cjkwd="w", description="SQUARE KG", @@ -82873,6 +85420,7 @@ characters.data={ unicodeslot=0x338F, }, [0x3390]={ + adobename="Hzsquare", category="so", cjkwd="w", description="SQUARE HZ", @@ -82882,6 +85430,7 @@ characters.data={ unicodeslot=0x3390, }, [0x3391]={ + adobename="khzsquare", category="so", cjkwd="w", description="SQUARE KHZ", @@ -82891,6 +85440,7 @@ characters.data={ unicodeslot=0x3391, }, [0x3392]={ + adobename="mhzsquare", category="so", cjkwd="w", description="SQUARE MHZ", @@ -82900,6 +85450,7 @@ characters.data={ unicodeslot=0x3392, }, [0x3393]={ + adobename="ghzsquare", category="so", cjkwd="w", description="SQUARE GHZ", @@ -82909,6 +85460,7 @@ characters.data={ unicodeslot=0x3393, }, [0x3394]={ + adobename="thzsquare", category="so", cjkwd="w", description="SQUARE THZ", @@ -82918,6 +85470,7 @@ characters.data={ unicodeslot=0x3394, }, [0x3395]={ + adobename="mulsquare", category="so", cjkwd="w", description="SQUARE MU L", @@ -82927,6 +85480,7 @@ characters.data={ unicodeslot=0x3395, }, [0x3396]={ + adobename="mlsquare", category="so", cjkwd="w", description="SQUARE ML", @@ -82936,6 +85490,7 @@ characters.data={ unicodeslot=0x3396, }, [0x3397]={ + adobename="dlsquare", category="so", cjkwd="w", description="SQUARE DL", @@ -82945,6 +85500,7 @@ characters.data={ unicodeslot=0x3397, }, [0x3398]={ + adobename="klsquare", category="so", cjkwd="w", description="SQUARE KL", @@ -82954,6 +85510,7 @@ characters.data={ unicodeslot=0x3398, }, [0x3399]={ + adobename="fmsquare", category="so", cjkwd="w", description="SQUARE FM", @@ -82963,6 +85520,7 @@ characters.data={ unicodeslot=0x3399, }, [0x339A]={ + adobename="nmsquare", category="so", cjkwd="w", description="SQUARE NM", @@ -82972,6 +85530,7 @@ characters.data={ unicodeslot=0x339A, }, [0x339B]={ + adobename="mumsquare", category="so", cjkwd="w", description="SQUARE MU M", @@ -82981,6 +85540,7 @@ characters.data={ unicodeslot=0x339B, }, [0x339C]={ + adobename="squaremm", category="so", cjkwd="w", description="SQUARE MM", @@ -82990,6 +85550,7 @@ characters.data={ unicodeslot=0x339C, }, [0x339D]={ + adobename="squarecm", category="so", cjkwd="w", description="SQUARE CM", @@ -82999,6 +85560,7 @@ characters.data={ unicodeslot=0x339D, }, [0x339E]={ + adobename="squarekm", category="so", cjkwd="w", description="SQUARE KM", @@ -83008,6 +85570,7 @@ characters.data={ unicodeslot=0x339E, }, [0x339F]={ + adobename="mmsquaredsquare", category="so", cjkwd="w", description="SQUARE MM SQUARED", @@ -83017,6 +85580,7 @@ characters.data={ unicodeslot=0x339F, }, [0x33A0]={ + adobename="cmsquaredsquare", category="so", cjkwd="w", description="SQUARE CM SQUARED", @@ -83026,6 +85590,7 @@ characters.data={ unicodeslot=0x33A0, }, [0x33A1]={ + adobename="squaremsquared", category="so", cjkwd="w", description="SQUARE M SQUARED", @@ -83035,6 +85600,7 @@ characters.data={ unicodeslot=0x33A1, }, [0x33A2]={ + adobename="kmsquaredsquare", category="so", cjkwd="w", description="SQUARE KM SQUARED", @@ -83044,6 +85610,7 @@ characters.data={ unicodeslot=0x33A2, }, [0x33A3]={ + adobename="mmcubedsquare", category="so", cjkwd="w", description="SQUARE MM CUBED", @@ -83053,6 +85620,7 @@ characters.data={ unicodeslot=0x33A3, }, [0x33A4]={ + adobename="cmcubedsquare", category="so", cjkwd="w", description="SQUARE CM CUBED", @@ -83062,6 +85630,7 @@ characters.data={ unicodeslot=0x33A4, }, [0x33A5]={ + adobename="mcubedsquare", category="so", cjkwd="w", description="SQUARE M CUBED", @@ -83071,6 +85640,7 @@ characters.data={ unicodeslot=0x33A5, }, [0x33A6]={ + adobename="kmcubedsquare", category="so", cjkwd="w", description="SQUARE KM CUBED", @@ -83080,6 +85650,7 @@ characters.data={ unicodeslot=0x33A6, }, [0x33A7]={ + adobename="moverssquare", category="so", cjkwd="w", description="SQUARE M OVER S", @@ -83089,6 +85660,7 @@ characters.data={ unicodeslot=0x33A7, }, [0x33A8]={ + adobename="moverssquaredsquare", category="so", cjkwd="w", description="SQUARE M OVER S SQUARED", @@ -83098,6 +85670,7 @@ characters.data={ unicodeslot=0x33A8, }, [0x33A9]={ + adobename="pasquare", category="so", cjkwd="w", description="SQUARE PA", @@ -83107,6 +85680,7 @@ characters.data={ unicodeslot=0x33A9, }, [0x33AA]={ + adobename="kpasquare", category="so", cjkwd="w", description="SQUARE KPA", @@ -83116,6 +85690,7 @@ characters.data={ unicodeslot=0x33AA, }, [0x33AB]={ + adobename="mpasquare", category="so", cjkwd="w", description="SQUARE MPA", @@ -83125,6 +85700,7 @@ characters.data={ unicodeslot=0x33AB, }, [0x33AC]={ + adobename="gpasquare", category="so", cjkwd="w", description="SQUARE GPA", @@ -83134,6 +85710,7 @@ characters.data={ unicodeslot=0x33AC, }, [0x33AD]={ + adobename="radsquare", category="so", cjkwd="w", description="SQUARE RAD", @@ -83143,6 +85720,7 @@ characters.data={ unicodeslot=0x33AD, }, [0x33AE]={ + adobename="radoverssquare", category="so", cjkwd="w", description="SQUARE RAD OVER S", @@ -83152,6 +85730,7 @@ characters.data={ unicodeslot=0x33AE, }, [0x33AF]={ + adobename="radoverssquaredsquare", category="so", cjkwd="w", description="SQUARE RAD OVER S SQUARED", @@ -83161,6 +85740,7 @@ characters.data={ unicodeslot=0x33AF, }, [0x33B0]={ + adobename="pssquare", category="so", cjkwd="w", description="SQUARE PS", @@ -83170,6 +85750,7 @@ characters.data={ unicodeslot=0x33B0, }, [0x33B1]={ + adobename="nssquare", category="so", cjkwd="w", description="SQUARE NS", @@ -83179,6 +85760,7 @@ characters.data={ unicodeslot=0x33B1, }, [0x33B2]={ + adobename="mussquare", category="so", cjkwd="w", description="SQUARE MU S", @@ -83188,6 +85770,7 @@ characters.data={ unicodeslot=0x33B2, }, [0x33B3]={ + adobename="mssquare", category="so", cjkwd="w", description="SQUARE MS", @@ -83197,6 +85780,7 @@ characters.data={ unicodeslot=0x33B3, }, [0x33B4]={ + adobename="pvsquare", category="so", cjkwd="w", description="SQUARE PV", @@ -83206,6 +85790,7 @@ characters.data={ unicodeslot=0x33B4, }, [0x33B5]={ + adobename="nvsquare", category="so", cjkwd="w", description="SQUARE NV", @@ -83215,6 +85800,7 @@ characters.data={ unicodeslot=0x33B5, }, [0x33B6]={ + adobename="muvsquare", category="so", cjkwd="w", description="SQUARE MU V", @@ -83224,6 +85810,7 @@ characters.data={ unicodeslot=0x33B6, }, [0x33B7]={ + adobename="mvsquare", category="so", cjkwd="w", description="SQUARE MV", @@ -83233,6 +85820,7 @@ characters.data={ unicodeslot=0x33B7, }, [0x33B8]={ + adobename="kvsquare", category="so", cjkwd="w", description="SQUARE KV", @@ -83242,6 +85830,7 @@ characters.data={ unicodeslot=0x33B8, }, [0x33B9]={ + adobename="mvmegasquare", category="so", cjkwd="w", description="SQUARE MV MEGA", @@ -83251,6 +85840,7 @@ characters.data={ unicodeslot=0x33B9, }, [0x33BA]={ + adobename="pwsquare", category="so", cjkwd="w", description="SQUARE PW", @@ -83260,6 +85850,7 @@ characters.data={ unicodeslot=0x33BA, }, [0x33BB]={ + adobename="nwsquare", category="so", cjkwd="w", description="SQUARE NW", @@ -83269,6 +85860,7 @@ characters.data={ unicodeslot=0x33BB, }, [0x33BC]={ + adobename="muwsquare", category="so", cjkwd="w", description="SQUARE MU W", @@ -83278,6 +85870,7 @@ characters.data={ unicodeslot=0x33BC, }, [0x33BD]={ + adobename="mwsquare", category="so", cjkwd="w", description="SQUARE MW", @@ -83287,6 +85880,7 @@ characters.data={ unicodeslot=0x33BD, }, [0x33BE]={ + adobename="kwsquare", category="so", cjkwd="w", description="SQUARE KW", @@ -83296,6 +85890,7 @@ characters.data={ unicodeslot=0x33BE, }, [0x33BF]={ + adobename="mwmegasquare", category="so", cjkwd="w", description="SQUARE MW MEGA", @@ -83305,6 +85900,7 @@ characters.data={ unicodeslot=0x33BF, }, [0x33C0]={ + adobename="kohmsquare", category="so", cjkwd="w", description="SQUARE K OHM", @@ -83314,6 +85910,7 @@ characters.data={ unicodeslot=0x33C0, }, [0x33C1]={ + adobename="mohmsquare", category="so", cjkwd="w", description="SQUARE M OHM", @@ -83323,6 +85920,7 @@ characters.data={ unicodeslot=0x33C1, }, [0x33C2]={ + adobename="amsquare", category="so", cjkwd="w", description="SQUARE AM", @@ -83332,6 +85930,7 @@ characters.data={ unicodeslot=0x33C2, }, [0x33C3]={ + adobename="bqsquare", category="so", cjkwd="w", description="SQUARE BQ", @@ -83341,6 +85940,7 @@ characters.data={ unicodeslot=0x33C3, }, [0x33C4]={ + adobename="squarecc", category="so", cjkwd="w", description="SQUARE CC", @@ -83350,6 +85950,7 @@ characters.data={ unicodeslot=0x33C4, }, [0x33C5]={ + adobename="cdsquare", category="so", cjkwd="w", description="SQUARE CD", @@ -83359,6 +85960,7 @@ characters.data={ unicodeslot=0x33C5, }, [0x33C6]={ + adobename="coverkgsquare", category="so", cjkwd="w", description="SQUARE C OVER KG", @@ -83368,6 +85970,7 @@ characters.data={ unicodeslot=0x33C6, }, [0x33C7]={ + adobename="cosquare", category="so", cjkwd="w", description="SQUARE CO", @@ -83377,6 +85980,7 @@ characters.data={ unicodeslot=0x33C7, }, [0x33C8]={ + adobename="dbsquare", category="so", cjkwd="w", description="SQUARE DB", @@ -83386,6 +85990,7 @@ characters.data={ unicodeslot=0x33C8, }, [0x33C9]={ + adobename="gysquare", category="so", cjkwd="w", description="SQUARE GY", @@ -83395,6 +86000,7 @@ characters.data={ unicodeslot=0x33C9, }, [0x33CA]={ + adobename="hasquare", category="so", cjkwd="w", description="SQUARE HA", @@ -83404,6 +86010,7 @@ characters.data={ unicodeslot=0x33CA, }, [0x33CB]={ + adobename="HPsquare", category="so", cjkwd="w", description="SQUARE HP", @@ -83422,6 +86029,7 @@ characters.data={ unicodeslot=0x33CC, }, [0x33CD]={ + adobename="KKsquare", category="so", cjkwd="w", description="SQUARE KK", @@ -83431,6 +86039,7 @@ characters.data={ unicodeslot=0x33CD, }, [0x33CE]={ + adobename="squarekmcapital", category="so", cjkwd="w", description="SQUARE KM CAPITAL", @@ -83440,6 +86049,7 @@ characters.data={ unicodeslot=0x33CE, }, [0x33CF]={ + adobename="ktsquare", category="so", cjkwd="w", description="SQUARE KT", @@ -83449,6 +86059,7 @@ characters.data={ unicodeslot=0x33CF, }, [0x33D0]={ + adobename="lmsquare", category="so", cjkwd="w", description="SQUARE LM", @@ -83458,6 +86069,7 @@ characters.data={ unicodeslot=0x33D0, }, [0x33D1]={ + adobename="squareln", category="so", cjkwd="w", description="SQUARE LN", @@ -83467,6 +86079,7 @@ characters.data={ unicodeslot=0x33D1, }, [0x33D2]={ + adobename="squarelog", category="so", cjkwd="w", description="SQUARE LOG", @@ -83476,6 +86089,7 @@ characters.data={ unicodeslot=0x33D2, }, [0x33D3]={ + adobename="lxsquare", category="so", cjkwd="w", description="SQUARE LX", @@ -83485,6 +86099,7 @@ characters.data={ unicodeslot=0x33D3, }, [0x33D4]={ + adobename="mbsquare", category="so", cjkwd="w", description="SQUARE MB SMALL", @@ -83494,6 +86109,7 @@ characters.data={ unicodeslot=0x33D4, }, [0x33D5]={ + adobename="squaremil", category="so", cjkwd="w", description="SQUARE MIL", @@ -83503,6 +86119,7 @@ characters.data={ unicodeslot=0x33D5, }, [0x33D6]={ + adobename="molsquare", category="so", cjkwd="w", description="SQUARE MOL", @@ -83521,6 +86138,7 @@ characters.data={ unicodeslot=0x33D7, }, [0x33D8]={ + adobename="pmsquare", category="so", cjkwd="w", description="SQUARE PM", @@ -83548,6 +86166,7 @@ characters.data={ unicodeslot=0x33DA, }, [0x33DB]={ + adobename="srsquare", category="so", cjkwd="w", description="SQUARE SR", @@ -83557,6 +86176,7 @@ characters.data={ unicodeslot=0x33DB, }, [0x33DC]={ + adobename="svsquare", category="so", cjkwd="w", description="SQUARE SV", @@ -83566,6 +86186,7 @@ characters.data={ unicodeslot=0x33DC, }, [0x33DD]={ + adobename="wbsquare", category="so", cjkwd="w", description="SQUARE WB", @@ -83880,15 +86501,6 @@ characters.data={ specials={ "square", 0x0067, 0x0061, 0x006C }, unicodeslot=0x33FF, }, - [0x3400]={ - category="lo", - cjkwd="w", - description="", - direction="l", - linebreak="id", - unicodeslot=0x3400, - range= 0x4DB5, - }, [0x4DC0]={ category="so", description="HEXAGRAM FOR THE CREATIVE HEAVEN", @@ -84337,15 +86949,6 @@ characters.data={ linebreak="al", unicodeslot=0x4DFF, }, - [0x4E00]={ - category="lo", - cjkwd="w", - description="", - direction="l", - linebreak="id", - unicodeslot=0x4E00, - range=0x9FBB, - }, [0xA000]={ category="lo", cjkwd="w", @@ -95009,15 +97612,6 @@ characters.data={ linebreak="ex", unicodeslot=0xA877, }, - [0xAC00]={ - category="lo", - cjkwd="w", - description="", - direction="l", - linebreak="h2", - unicodeslot=0xAC00, - range=0xD7A3, - }, [0xD800]={ category="cs", description="", @@ -95068,6 +97662,7 @@ characters.data={ unicodeslot=0xE000, }, [0xF8FF]={ + adobename="apple", category="co", cjkwd="a", description="", @@ -99266,6 +101861,7 @@ characters.data={ unicodeslot=0xFAD9, }, [0xFB00]={ + adobename="ff", category="ll", contextname="ffligature", description="LATIN SMALL LIGATURE FF", @@ -99275,6 +101871,7 @@ characters.data={ unicodeslot=0xFB00, }, [0xFB01]={ + adobename="fi", category="ll", contextname="filigature", description="LATIN SMALL LIGATURE FI", @@ -99285,6 +101882,7 @@ characters.data={ unicodeslot=0xFB01, }, [0xFB02]={ + adobename="fl", category="ll", contextname="flligature", description="LATIN SMALL LIGATURE FL", @@ -99295,6 +101893,7 @@ characters.data={ unicodeslot=0xFB02, }, [0xFB03]={ + adobename="ffi", category="ll", contextname="ffiligature", description="LATIN SMALL LIGATURE FFI", @@ -99305,6 +101904,7 @@ characters.data={ unicodeslot=0xFB03, }, [0xFB04]={ + adobename="ffl", category="ll", contextname="fflligature", description="LATIN SMALL LIGATURE FFL", @@ -99389,6 +101989,7 @@ characters.data={ unicodeslot=0xFB1E, }, [0xFB1F]={ + adobename="yodyodpatahhebrew", category="lo", description="HEBREW LIGATURE YIDDISH YOD YOD PATAH", direction="r", @@ -99397,6 +101998,7 @@ characters.data={ unicodeslot=0xFB1F, }, [0xFB20]={ + adobename="ayinaltonehebrew", category="lo", description="HEBREW LETTER ALTERNATIVE AYIN", direction="r", @@ -99477,6 +102079,7 @@ characters.data={ unicodeslot=0xFB29, }, [0xFB2A]={ + adobename="shinshindothebrew", category="lo", description="HEBREW LETTER SHIN WITH SHIN DOT", direction="r", @@ -99486,6 +102089,7 @@ characters.data={ unicodeslot=0xFB2A, }, [0xFB2B]={ + adobename="shinsindothebrew", category="lo", description="HEBREW LETTER SHIN WITH SIN DOT", direction="r", @@ -99495,6 +102099,7 @@ characters.data={ unicodeslot=0xFB2B, }, [0xFB2C]={ + adobename="shindageshshindothebrew", category="lo", description="HEBREW LETTER SHIN WITH DAGESH AND SHIN DOT", direction="r", @@ -99504,6 +102109,7 @@ characters.data={ unicodeslot=0xFB2C, }, [0xFB2D]={ + adobename="shindageshsindothebrew", category="lo", description="HEBREW LETTER SHIN WITH DAGESH AND SIN DOT", direction="r", @@ -99513,6 +102119,7 @@ characters.data={ unicodeslot=0xFB2D, }, [0xFB2E]={ + adobename="alefpatahhebrew", category="lo", description="HEBREW LETTER ALEF WITH PATAH", direction="r", @@ -99522,6 +102129,7 @@ characters.data={ unicodeslot=0xFB2E, }, [0xFB2F]={ + adobename="alefqamatshebrew", category="lo", description="HEBREW LETTER ALEF WITH QAMATS", direction="r", @@ -99531,6 +102139,7 @@ characters.data={ unicodeslot=0xFB2F, }, [0xFB30]={ + adobename="alefdageshhebrew", category="lo", description="HEBREW LETTER ALEF WITH MAPIQ", direction="r", @@ -99540,6 +102149,7 @@ characters.data={ unicodeslot=0xFB30, }, [0xFB31]={ + adobename="betdageshhebrew", category="lo", description="HEBREW LETTER BET WITH DAGESH", direction="r", @@ -99549,6 +102159,7 @@ characters.data={ unicodeslot=0xFB31, }, [0xFB32]={ + adobename="gimeldageshhebrew", category="lo", description="HEBREW LETTER GIMEL WITH DAGESH", direction="r", @@ -99558,6 +102169,7 @@ characters.data={ unicodeslot=0xFB32, }, [0xFB33]={ + adobename="daletdageshhebrew", category="lo", description="HEBREW LETTER DALET WITH DAGESH", direction="r", @@ -99567,6 +102179,7 @@ characters.data={ unicodeslot=0xFB33, }, [0xFB34]={ + adobename="hedageshhebrew", category="lo", description="HEBREW LETTER HE WITH MAPIQ", direction="r", @@ -99576,6 +102189,7 @@ characters.data={ unicodeslot=0xFB34, }, [0xFB35]={ + adobename="vavdageshhebrew", category="lo", description="HEBREW LETTER VAV WITH DAGESH", direction="r", @@ -99585,6 +102199,7 @@ characters.data={ unicodeslot=0xFB35, }, [0xFB36]={ + adobename="zayindageshhebrew", category="lo", description="HEBREW LETTER ZAYIN WITH DAGESH", direction="r", @@ -99594,6 +102209,7 @@ characters.data={ unicodeslot=0xFB36, }, [0xFB38]={ + adobename="tetdageshhebrew", category="lo", description="HEBREW LETTER TET WITH DAGESH", direction="r", @@ -99603,6 +102219,7 @@ characters.data={ unicodeslot=0xFB38, }, [0xFB39]={ + adobename="yoddageshhebrew", category="lo", description="HEBREW LETTER YOD WITH DAGESH", direction="r", @@ -99612,6 +102229,7 @@ characters.data={ unicodeslot=0xFB39, }, [0xFB3A]={ + adobename="finalkafdageshhebrew", category="lo", description="HEBREW LETTER FINAL KAF WITH DAGESH", direction="r", @@ -99620,6 +102238,7 @@ characters.data={ unicodeslot=0xFB3A, }, [0xFB3B]={ + adobename="kafdageshhebrew", category="lo", description="HEBREW LETTER KAF WITH DAGESH", direction="r", @@ -99629,6 +102248,7 @@ characters.data={ unicodeslot=0xFB3B, }, [0xFB3C]={ + adobename="lameddageshhebrew", category="lo", description="HEBREW LETTER LAMED WITH DAGESH", direction="r", @@ -99638,6 +102258,7 @@ characters.data={ unicodeslot=0xFB3C, }, [0xFB3E]={ + adobename="memdageshhebrew", category="lo", description="HEBREW LETTER MEM WITH DAGESH", direction="r", @@ -99647,6 +102268,7 @@ characters.data={ unicodeslot=0xFB3E, }, [0xFB40]={ + adobename="nundageshhebrew", category="lo", description="HEBREW LETTER NUN WITH DAGESH", direction="r", @@ -99656,6 +102278,7 @@ characters.data={ unicodeslot=0xFB40, }, [0xFB41]={ + adobename="samekhdageshhebrew", category="lo", description="HEBREW LETTER SAMEKH WITH DAGESH", direction="r", @@ -99665,6 +102288,7 @@ characters.data={ unicodeslot=0xFB41, }, [0xFB43]={ + adobename="pefinaldageshhebrew", category="lo", description="HEBREW LETTER FINAL PE WITH DAGESH", direction="r", @@ -99673,6 +102297,7 @@ characters.data={ unicodeslot=0xFB43, }, [0xFB44]={ + adobename="pedageshhebrew", category="lo", description="HEBREW LETTER PE WITH DAGESH", direction="r", @@ -99682,6 +102307,7 @@ characters.data={ unicodeslot=0xFB44, }, [0xFB46]={ + adobename="tsadidageshhebrew", category="lo", description="HEBREW LETTER TSADI WITH DAGESH", direction="r", @@ -99691,6 +102317,7 @@ characters.data={ unicodeslot=0xFB46, }, [0xFB47]={ + adobename="qofdageshhebrew", category="lo", description="HEBREW LETTER QOF WITH DAGESH", direction="r", @@ -99700,6 +102327,7 @@ characters.data={ unicodeslot=0xFB47, }, [0xFB48]={ + adobename="reshdageshhebrew", category="lo", description="HEBREW LETTER RESH WITH DAGESH", direction="r", @@ -99709,6 +102337,7 @@ characters.data={ unicodeslot=0xFB48, }, [0xFB49]={ + adobename="shindageshhebrew", category="lo", description="HEBREW LETTER SHIN WITH DAGESH", direction="r", @@ -99718,6 +102347,7 @@ characters.data={ unicodeslot=0xFB49, }, [0xFB4A]={ + adobename="tavdageshhebrew", category="lo", description="HEBREW LETTER TAV WITH DAGESH", direction="r", @@ -99727,6 +102357,7 @@ characters.data={ unicodeslot=0xFB4A, }, [0xFB4B]={ + adobename="vavholamhebrew", category="lo", description="HEBREW LETTER VAV WITH HOLAM", direction="r", @@ -99736,6 +102367,7 @@ characters.data={ unicodeslot=0xFB4B, }, [0xFB4C]={ + adobename="betrafehebrew", category="lo", description="HEBREW LETTER BET WITH RAFE", direction="r", @@ -99745,6 +102377,7 @@ characters.data={ unicodeslot=0xFB4C, }, [0xFB4D]={ + adobename="kafrafehebrew", category="lo", description="HEBREW LETTER KAF WITH RAFE", direction="r", @@ -99754,6 +102387,7 @@ characters.data={ unicodeslot=0xFB4D, }, [0xFB4E]={ + adobename="perafehebrew", category="lo", description="HEBREW LETTER PE WITH RAFE", direction="r", @@ -99763,6 +102397,7 @@ characters.data={ unicodeslot=0xFB4E, }, [0xFB4F]={ + adobename="aleflamedhebrew", category="lo", description="HEBREW LIGATURE ALEF LAMED", direction="r", @@ -99827,6 +102462,7 @@ characters.data={ unicodeslot=0xFB56, }, [0xFB57]={ + adobename="pehfinalarabic", category="lo", description="ARABIC LETTER PEH FINAL FORM", direction="al", @@ -99835,6 +102471,7 @@ characters.data={ unicodeslot=0xFB57, }, [0xFB58]={ + adobename="pehinitialarabic", category="lo", description="ARABIC LETTER PEH INITIAL FORM", direction="al", @@ -99843,6 +102480,7 @@ characters.data={ unicodeslot=0xFB58, }, [0xFB59]={ + adobename="pehmedialarabic", category="lo", description="ARABIC LETTER PEH MEDIAL FORM", direction="al", @@ -99955,6 +102593,7 @@ characters.data={ unicodeslot=0xFB66, }, [0xFB67]={ + adobename="ttehfinalarabic", category="lo", description="ARABIC LETTER TTEH FINAL FORM", direction="al", @@ -99963,6 +102602,7 @@ characters.data={ unicodeslot=0xFB67, }, [0xFB68]={ + adobename="ttehinitialarabic", category="lo", description="ARABIC LETTER TTEH INITIAL FORM", direction="al", @@ -99971,6 +102611,7 @@ characters.data={ unicodeslot=0xFB68, }, [0xFB69]={ + adobename="ttehmedialarabic", category="lo", description="ARABIC LETTER TTEH MEDIAL FORM", direction="al", @@ -99987,6 +102628,7 @@ characters.data={ unicodeslot=0xFB6A, }, [0xFB6B]={ + adobename="vehfinalarabic", category="lo", description="ARABIC LETTER VEH FINAL FORM", direction="al", @@ -99995,6 +102637,7 @@ characters.data={ unicodeslot=0xFB6B, }, [0xFB6C]={ + adobename="vehinitialarabic", category="lo", description="ARABIC LETTER VEH INITIAL FORM", direction="al", @@ -100003,6 +102646,7 @@ characters.data={ unicodeslot=0xFB6C, }, [0xFB6D]={ + adobename="vehmedialarabic", category="lo", description="ARABIC LETTER VEH MEDIAL FORM", direction="al", @@ -100115,6 +102759,7 @@ characters.data={ unicodeslot=0xFB7A, }, [0xFB7B]={ + adobename="tchehfinalarabic", category="lo", description="ARABIC LETTER TCHEH FINAL FORM", direction="al", @@ -100123,6 +102768,7 @@ characters.data={ unicodeslot=0xFB7B, }, [0xFB7C]={ + adobename="tchehmeeminitialarabic", category="lo", description="ARABIC LETTER TCHEH INITIAL FORM", direction="al", @@ -100131,6 +102777,7 @@ characters.data={ unicodeslot=0xFB7C, }, [0xFB7D]={ + adobename="tchehmedialarabic", category="lo", description="ARABIC LETTER TCHEH MEDIAL FORM", direction="al", @@ -100227,6 +102874,7 @@ characters.data={ unicodeslot=0xFB88, }, [0xFB89]={ + adobename="ddalfinalarabic", category="lo", description="ARABIC LETTER DDAL FINAL FORM", direction="al", @@ -100243,6 +102891,7 @@ characters.data={ unicodeslot=0xFB8A, }, [0xFB8B]={ + adobename="jehfinalarabic", category="lo", description="ARABIC LETTER JEH FINAL FORM", direction="al", @@ -100259,6 +102908,7 @@ characters.data={ unicodeslot=0xFB8C, }, [0xFB8D]={ + adobename="rrehfinalarabic", category="lo", description="ARABIC LETTER RREH FINAL FORM", direction="al", @@ -100307,6 +102957,7 @@ characters.data={ unicodeslot=0xFB92, }, [0xFB93]={ + adobename="gaffinalarabic", category="lo", description="ARABIC LETTER GAF FINAL FORM", direction="al", @@ -100315,6 +102966,7 @@ characters.data={ unicodeslot=0xFB93, }, [0xFB94]={ + adobename="gafinitialarabic", category="lo", description="ARABIC LETTER GAF INITIAL FORM", direction="al", @@ -100323,6 +102975,7 @@ characters.data={ unicodeslot=0xFB94, }, [0xFB95]={ + adobename="gafmedialarabic", category="lo", description="ARABIC LETTER GAF MEDIAL FORM", direction="al", @@ -100403,6 +103056,7 @@ characters.data={ unicodeslot=0xFB9E, }, [0xFB9F]={ + adobename="noonghunnafinalarabic", category="lo", description="ARABIC LETTER NOON GHUNNA FINAL FORM", direction="al", @@ -100443,6 +103097,7 @@ characters.data={ unicodeslot=0xFBA3, }, [0xFBA4]={ + adobename="hehhamzaaboveisolatedarabic", category="lo", description="ARABIC LETTER HEH WITH YEH ABOVE ISOLATED FORM", direction="al", @@ -100452,6 +103107,7 @@ characters.data={ unicodeslot=0xFBA4, }, [0xFBA5]={ + adobename="hehhamzaabovefinalarabic", category="lo", description="ARABIC LETTER HEH WITH YEH ABOVE FINAL FORM", direction="al", @@ -100469,6 +103125,7 @@ characters.data={ unicodeslot=0xFBA6, }, [0xFBA7]={ + adobename="hehfinalaltonearabic", category="lo", description="ARABIC LETTER HEH GOAL FINAL FORM", direction="al", @@ -100477,6 +103134,7 @@ characters.data={ unicodeslot=0xFBA7, }, [0xFBA8]={ + adobename="hehinitialaltonearabic", category="lo", description="ARABIC LETTER HEH GOAL INITIAL FORM", direction="al", @@ -100485,6 +103143,7 @@ characters.data={ unicodeslot=0xFBA8, }, [0xFBA9]={ + adobename="hehmedialaltonearabic", category="lo", description="ARABIC LETTER HEH GOAL MEDIAL FORM", direction="al", @@ -100533,6 +103192,7 @@ characters.data={ unicodeslot=0xFBAE, }, [0xFBAF]={ + adobename="yehbarreefinalarabic", category="lo", description="ARABIC LETTER YEH BARREE FINAL FORM", direction="al", @@ -100982,6 +103642,7 @@ characters.data={ unicodeslot=0xFC07, }, [0xFC08]={ + adobename="behmeemisolatedarabic", category="lo", description="ARABIC LIGATURE BEH WITH MEEM ISOLATED FORM", direction="al", @@ -101006,6 +103667,7 @@ characters.data={ unicodeslot=0xFC0A, }, [0xFC0B]={ + adobename="tehjeemisolatedarabic", category="lo", description="ARABIC LIGATURE TEH WITH JEEM ISOLATED FORM", direction="al", @@ -101014,6 +103676,7 @@ characters.data={ unicodeslot=0xFC0B, }, [0xFC0C]={ + adobename="tehhahisolatedarabic", category="lo", description="ARABIC LIGATURE TEH WITH HAH ISOLATED FORM", direction="al", @@ -101030,6 +103693,7 @@ characters.data={ unicodeslot=0xFC0D, }, [0xFC0E]={ + adobename="tehmeemisolatedarabic", category="lo", description="ARABIC LIGATURE TEH WITH MEEM ISOLATED FORM", direction="al", @@ -101494,6 +104158,7 @@ characters.data={ unicodeslot=0xFC47, }, [0xFC48]={ + adobename="meemmeemisolatedarabic", category="lo", description="ARABIC LIGATURE MEEM WITH MEEM ISOLATED FORM", direction="al", @@ -101518,6 +104183,7 @@ characters.data={ unicodeslot=0xFC4A, }, [0xFC4B]={ + adobename="noonjeemisolatedarabic", category="lo", description="ARABIC LIGATURE NOON WITH JEEM ISOLATED FORM", direction="al", @@ -101542,6 +104208,7 @@ characters.data={ unicodeslot=0xFC4D, }, [0xFC4E]={ + adobename="noonmeemisolatedarabic", category="lo", description="ARABIC LIGATURE NOON WITH MEEM ISOLATED FORM", direction="al", @@ -101622,6 +104289,7 @@ characters.data={ unicodeslot=0xFC57, }, [0xFC58]={ + adobename="yehmeemisolatedarabic", category="lo", description="ARABIC LIGATURE YEH WITH MEEM ISOLATED FORM", direction="al", @@ -101670,6 +104338,7 @@ characters.data={ unicodeslot=0xFC5D, }, [0xFC5E]={ + adobename="shaddadammatanarabic", category="lo", description="ARABIC LIGATURE SHADDA WITH DAMMATAN ISOLATED FORM", direction="al", @@ -101678,6 +104347,7 @@ characters.data={ unicodeslot=0xFC5E, }, [0xFC5F]={ + adobename="shaddakasratanarabic", category="lo", description="ARABIC LIGATURE SHADDA WITH KASRATAN ISOLATED FORM", direction="al", @@ -101686,6 +104356,7 @@ characters.data={ unicodeslot=0xFC5F, }, [0xFC60]={ + adobename="shaddafathaarabic", category="lo", description="ARABIC LIGATURE SHADDA WITH FATHA ISOLATED FORM", direction="al", @@ -101694,6 +104365,7 @@ characters.data={ unicodeslot=0xFC60, }, [0xFC61]={ + adobename="shaddadammaarabic", category="lo", description="ARABIC LIGATURE SHADDA WITH DAMMA ISOLATED FORM", direction="al", @@ -101702,6 +104374,7 @@ characters.data={ unicodeslot=0xFC61, }, [0xFC62]={ + adobename="shaddakasraarabic", category="lo", description="ARABIC LIGATURE SHADDA WITH KASRA ISOLATED FORM", direction="al", @@ -101790,6 +104463,7 @@ characters.data={ unicodeslot=0xFC6C, }, [0xFC6D]={ + adobename="behnoonfinalarabic", category="lo", description="ARABIC LIGATURE BEH WITH NOON FINAL FORM", direction="al", @@ -101838,6 +104512,7 @@ characters.data={ unicodeslot=0xFC72, }, [0xFC73]={ + adobename="tehnoonfinalarabic", category="lo", description="ARABIC LIGATURE TEH WITH NOON FINAL FORM", direction="al", @@ -102046,6 +104721,7 @@ characters.data={ unicodeslot=0xFC8C, }, [0xFC8D]={ + adobename="noonnoonfinalarabic", category="lo", description="ARABIC LIGATURE NOON WITH NOON FINAL FORM", direction="al", @@ -102102,6 +104778,7 @@ characters.data={ unicodeslot=0xFC93, }, [0xFC94]={ + adobename="yehnoonfinalarabic", category="lo", description="ARABIC LIGATURE YEH WITH NOON FINAL FORM", direction="al", @@ -102190,6 +104867,7 @@ characters.data={ unicodeslot=0xFC9E, }, [0xFC9F]={ + adobename="behmeeminitialarabic", category="lo", description="ARABIC LIGATURE BEH WITH MEEM INITIAL FORM", direction="al", @@ -102206,6 +104884,7 @@ characters.data={ unicodeslot=0xFCA0, }, [0xFCA1]={ + adobename="tehjeeminitialarabic", category="lo", description="ARABIC LIGATURE TEH WITH JEEM INITIAL FORM", direction="al", @@ -102214,6 +104893,7 @@ characters.data={ unicodeslot=0xFCA1, }, [0xFCA2]={ + adobename="tehhahinitialarabic", category="lo", description="ARABIC LIGATURE TEH WITH HAH INITIAL FORM", direction="al", @@ -102230,6 +104910,7 @@ characters.data={ unicodeslot=0xFCA3, }, [0xFCA4]={ + adobename="tehmeeminitialarabic", category="lo", description="ARABIC LIGATURE TEH WITH MEEM INITIAL FORM", direction="al", @@ -102526,6 +105207,7 @@ characters.data={ unicodeslot=0xFCC8, }, [0xFCC9]={ + adobename="lamjeeminitialarabic", category="lo", description="ARABIC LIGATURE LAM WITH JEEM INITIAL FORM", direction="al", @@ -102534,6 +105216,7 @@ characters.data={ unicodeslot=0xFCC9, }, [0xFCCA]={ + adobename="lamhahinitialarabic", category="lo", description="ARABIC LIGATURE LAM WITH HAH INITIAL FORM", direction="al", @@ -102542,6 +105225,7 @@ characters.data={ unicodeslot=0xFCCA, }, [0xFCCB]={ + adobename="lamkhahinitialarabic", category="lo", description="ARABIC LIGATURE LAM WITH KHAH INITIAL FORM", direction="al", @@ -102550,6 +105234,7 @@ characters.data={ unicodeslot=0xFCCB, }, [0xFCCC]={ + adobename="lammeeminitialarabic", category="lo", description="ARABIC LIGATURE LAM WITH MEEM INITIAL FORM", direction="al", @@ -102590,6 +105275,7 @@ characters.data={ unicodeslot=0xFCD0, }, [0xFCD1]={ + adobename="meemmeeminitialarabic", category="lo", description="ARABIC LIGATURE MEEM WITH MEEM INITIAL FORM", direction="al", @@ -102598,6 +105284,7 @@ characters.data={ unicodeslot=0xFCD1, }, [0xFCD2]={ + adobename="noonjeeminitialarabic", category="lo", description="ARABIC LIGATURE NOON WITH JEEM INITIAL FORM", direction="al", @@ -102622,6 +105309,7 @@ characters.data={ unicodeslot=0xFCD4, }, [0xFCD5]={ + adobename="noonmeeminitialarabic", category="lo", description="ARABIC LIGATURE NOON WITH MEEM INITIAL FORM", direction="al", @@ -102686,6 +105374,7 @@ characters.data={ unicodeslot=0xFCDC, }, [0xFCDD]={ + adobename="yehmeeminitialarabic", category="lo", description="ARABIC LIGATURE YEH WITH MEEM INITIAL FORM", direction="al", @@ -103462,6 +106151,7 @@ characters.data={ unicodeslot=0xFD3D, }, [0xFD3E]={ + adobename="parenleftaltonearabic", category="ps", description="ORNATE LEFT PARENTHESIS", direction="on", @@ -103469,6 +106159,7 @@ characters.data={ unicodeslot=0xFD3E, }, [0xFD3F]={ + adobename="parenrightaltonearabic", category="pe", description="ORNATE RIGHT PARENTHESIS", direction="on", @@ -103924,6 +106615,7 @@ characters.data={ unicodeslot=0xFD87, }, [0xFD88]={ + adobename="lammeemhahinitialarabic", category="lo", description="ARABIC LIGATURE LAM WITH MEEM WITH HAH INITIAL FORM", direction="al", @@ -104436,6 +107128,7 @@ characters.data={ unicodeslot=0xFDF1, }, [0xFDF2]={ + adobename="lamlamhehisolatedarabic", category="lo", description="ARABIC LIGATURE ALLAH ISOLATED FORM", direction="al", @@ -104500,6 +107193,7 @@ characters.data={ unicodeslot=0xFDF9, }, [0xFDFA]={ + adobename="sallallahoualayhewasallamarabic", category="lo", description="ARABIC LIGATURE SALLALLAHOU ALAYHE WASALLAM", direction="al", @@ -104733,7 +107427,8 @@ characters.data={ [0xFE18]={ category="pe", cjkwd="w", - description="PRESENTATION FORM FOR VERTICAL RIGHT WHITE LENTICULAR BRAKCET", + comment="corrected description: brakcet", + description="PRESENTATION FORM FOR VERTICAL RIGHT WHITE LENTICULAR BRACKET", direction="on", linebreak="cl", specials={ "vertical", 0x3017 }, @@ -104777,6 +107472,7 @@ characters.data={ unicodeslot=0xFE23, }, [0xFE30]={ + adobename="twodotleadervertical", category="po", cjkwd="w", description="PRESENTATION FORM FOR VERTICAL TWO DOT LEADER", @@ -104786,6 +107482,7 @@ characters.data={ unicodeslot=0xFE30, }, [0xFE31]={ + adobename="emdashvertical", category="pd", cjkwd="w", description="PRESENTATION FORM FOR VERTICAL EM DASH", @@ -104795,6 +107492,7 @@ characters.data={ unicodeslot=0xFE31, }, [0xFE32]={ + adobename="endashvertical", category="pd", cjkwd="w", description="PRESENTATION FORM FOR VERTICAL EN DASH", @@ -104804,6 +107502,7 @@ characters.data={ unicodeslot=0xFE32, }, [0xFE33]={ + adobename="underscorevertical", category="pc", cjkwd="w", description="PRESENTATION FORM FOR VERTICAL LOW LINE", @@ -104813,6 +107512,7 @@ characters.data={ unicodeslot=0xFE33, }, [0xFE34]={ + adobename="wavyunderscorevertical", category="pc", cjkwd="w", description="PRESENTATION FORM FOR VERTICAL WAVY LOW LINE", @@ -104822,6 +107522,7 @@ characters.data={ unicodeslot=0xFE34, }, [0xFE35]={ + adobename="parenleftvertical", category="ps", cjkwd="w", description="PRESENTATION FORM FOR VERTICAL LEFT PARENTHESIS", @@ -104831,6 +107532,7 @@ characters.data={ unicodeslot=0xFE35, }, [0xFE36]={ + adobename="parenrightvertical", category="pe", cjkwd="w", description="PRESENTATION FORM FOR VERTICAL RIGHT PARENTHESIS", @@ -104840,26 +107542,31 @@ characters.data={ unicodeslot=0xFE36, }, [0xFE37]={ + adobename="braceleftvertical", category="ps", cjkwd="w", + comment="weird math needed for mathml", description="PRESENTATION FORM FOR VERTICAL LEFT CURLY BRACKET", direction="on", linebreak="op", - mathfiller="downbracefill", -- funny, chinese, no math, wrong but for the moment we need it for buggy mathml + mathfiller="downbracefill", specials={ "vertical", 0x007B }, unicodeslot=0xFE37, }, [0xFE38]={ + adobename="bracerightvertical", category="pe", cjkwd="w", + comment="weird math needed for mathml", description="PRESENTATION FORM FOR VERTICAL RIGHT CURLY BRACKET", direction="on", linebreak="cl", - mathfiller="upbracefill", -- funny, chinese, no math, wrong but for the moment we need it for buggy mathml + mathfiller="upbracefill", specials={ "vertical", 0x007D }, unicodeslot=0xFE38, }, [0xFE39]={ + adobename="tortoiseshellbracketleftvertical", category="ps", cjkwd="w", description="PRESENTATION FORM FOR VERTICAL LEFT TORTOISE SHELL BRACKET", @@ -104869,6 +107576,7 @@ characters.data={ unicodeslot=0xFE39, }, [0xFE3A]={ + adobename="tortoiseshellbracketrightvertical", category="pe", cjkwd="w", description="PRESENTATION FORM FOR VERTICAL RIGHT TORTOISE SHELL BRACKET", @@ -104878,6 +107586,7 @@ characters.data={ unicodeslot=0xFE3A, }, [0xFE3B]={ + adobename="blacklenticularbracketleftvertical", category="ps", cjkwd="w", description="PRESENTATION FORM FOR VERTICAL LEFT BLACK LENTICULAR BRACKET", @@ -104887,6 +107596,7 @@ characters.data={ unicodeslot=0xFE3B, }, [0xFE3C]={ + adobename="blacklenticularbracketrightvertical", category="pe", cjkwd="w", description="PRESENTATION FORM FOR VERTICAL RIGHT BLACK LENTICULAR BRACKET", @@ -104896,6 +107606,7 @@ characters.data={ unicodeslot=0xFE3C, }, [0xFE3D]={ + adobename="dblanglebracketleftvertical", category="ps", cjkwd="w", description="PRESENTATION FORM FOR VERTICAL LEFT DOUBLE ANGLE BRACKET", @@ -104905,6 +107616,7 @@ characters.data={ unicodeslot=0xFE3D, }, [0xFE3E]={ + adobename="dblanglebracketrightvertical", category="pe", cjkwd="w", description="PRESENTATION FORM FOR VERTICAL RIGHT DOUBLE ANGLE BRACKET", @@ -104914,6 +107626,7 @@ characters.data={ unicodeslot=0xFE3E, }, [0xFE3F]={ + adobename="anglebracketleftvertical", category="ps", cjkwd="w", description="PRESENTATION FORM FOR VERTICAL LEFT ANGLE BRACKET", @@ -104923,6 +107636,7 @@ characters.data={ unicodeslot=0xFE3F, }, [0xFE40]={ + adobename="anglebracketrightvertical", category="pe", cjkwd="w", description="PRESENTATION FORM FOR VERTICAL RIGHT ANGLE BRACKET", @@ -104932,6 +107646,7 @@ characters.data={ unicodeslot=0xFE40, }, [0xFE41]={ + adobename="cornerbracketleftvertical", category="ps", cjkwd="w", description="PRESENTATION FORM FOR VERTICAL LEFT CORNER BRACKET", @@ -104941,6 +107656,7 @@ characters.data={ unicodeslot=0xFE41, }, [0xFE42]={ + adobename="cornerbracketrightvertical", category="pe", cjkwd="w", description="PRESENTATION FORM FOR VERTICAL RIGHT CORNER BRACKET", @@ -104950,6 +107666,7 @@ characters.data={ unicodeslot=0xFE42, }, [0xFE43]={ + adobename="whitecornerbracketleftvertical", category="ps", cjkwd="w", description="PRESENTATION FORM FOR VERTICAL LEFT WHITE CORNER BRACKET", @@ -104959,6 +107676,7 @@ characters.data={ unicodeslot=0xFE43, }, [0xFE44]={ + adobename="whitecornerbracketrightvertical", category="pe", cjkwd="w", description="PRESENTATION FORM FOR VERTICAL RIGHT WHITE CORNER BRACKET", @@ -105002,6 +107720,7 @@ characters.data={ unicodeslot=0xFE48, }, [0xFE49]={ + adobename="overlinedashed", category="po", cjkwd="w", description="DASHED OVERLINE", @@ -105011,6 +107730,7 @@ characters.data={ unicodeslot=0xFE49, }, [0xFE4A]={ + adobename="overlinecenterline", category="po", cjkwd="w", description="CENTRELINE OVERLINE", @@ -105020,6 +107740,7 @@ characters.data={ unicodeslot=0xFE4A, }, [0xFE4B]={ + adobename="overlinewavy", category="po", cjkwd="w", description="WAVY OVERLINE", @@ -105029,6 +107750,7 @@ characters.data={ unicodeslot=0xFE4B, }, [0xFE4C]={ + adobename="overlinedblwavy", category="po", cjkwd="w", description="DOUBLE WAVY OVERLINE", @@ -105038,6 +107760,7 @@ characters.data={ unicodeslot=0xFE4C, }, [0xFE4D]={ + adobename="lowlinedashed", category="pc", cjkwd="w", description="DASHED LOW LINE", @@ -105047,6 +107770,7 @@ characters.data={ unicodeslot=0xFE4D, }, [0xFE4E]={ + adobename="lowlinecenterline", category="pc", cjkwd="w", description="CENTRELINE LOW LINE", @@ -105056,6 +107780,7 @@ characters.data={ unicodeslot=0xFE4E, }, [0xFE4F]={ + adobename="underscorewavy", category="pc", cjkwd="w", description="WAVY LOW LINE", @@ -105065,6 +107790,7 @@ characters.data={ unicodeslot=0xFE4F, }, [0xFE50]={ + adobename="commasmall", category="po", cjkwd="w", description="SMALL COMMA", @@ -105083,6 +107809,7 @@ characters.data={ unicodeslot=0xFE51, }, [0xFE52]={ + adobename="periodsmall", category="po", cjkwd="w", description="SMALL FULL STOP", @@ -105092,6 +107819,7 @@ characters.data={ unicodeslot=0xFE52, }, [0xFE54]={ + adobename="semicolonsmall", category="po", cjkwd="w", description="SMALL SEMICOLON", @@ -105101,6 +107829,7 @@ characters.data={ unicodeslot=0xFE54, }, [0xFE55]={ + adobename="colonsmall", category="po", cjkwd="w", description="SMALL COLON", @@ -105137,6 +107866,7 @@ characters.data={ unicodeslot=0xFE58, }, [0xFE59]={ + adobename="parenleftsmall", category="ps", cjkwd="w", description="SMALL LEFT PARENTHESIS", @@ -105147,6 +107877,7 @@ characters.data={ unicodeslot=0xFE59, }, [0xFE5A]={ + adobename="parenrightsmall", category="pe", cjkwd="w", description="SMALL RIGHT PARENTHESIS", @@ -105157,6 +107888,7 @@ characters.data={ unicodeslot=0xFE5A, }, [0xFE5B]={ + adobename="braceleftsmall", category="ps", cjkwd="w", description="SMALL LEFT CURLY BRACKET", @@ -105167,6 +107899,7 @@ characters.data={ unicodeslot=0xFE5B, }, [0xFE5C]={ + adobename="bracerightsmall", category="pe", cjkwd="w", description="SMALL RIGHT CURLY BRACKET", @@ -105177,6 +107910,7 @@ characters.data={ unicodeslot=0xFE5C, }, [0xFE5D]={ + adobename="tortoiseshellbracketleftsmall", category="ps", cjkwd="w", description="SMALL LEFT TORTOISE SHELL BRACKET", @@ -105187,6 +107921,7 @@ characters.data={ unicodeslot=0xFE5D, }, [0xFE5E]={ + adobename="tortoiseshellbracketrightsmall", category="pe", cjkwd="w", description="SMALL RIGHT TORTOISE SHELL BRACKET", @@ -105197,6 +107932,7 @@ characters.data={ unicodeslot=0xFE5E, }, [0xFE5F]={ + adobename="numbersignsmall", category="po", cjkwd="w", description="SMALL NUMBER SIGN", @@ -105215,6 +107951,7 @@ characters.data={ unicodeslot=0xFE60, }, [0xFE61]={ + adobename="asterisksmall", category="po", cjkwd="w", description="SMALL ASTERISK", @@ -105224,6 +107961,7 @@ characters.data={ unicodeslot=0xFE61, }, [0xFE62]={ + adobename="plussmall", category="sm", cjkwd="w", description="SMALL PLUS SIGN", @@ -105233,6 +107971,7 @@ characters.data={ unicodeslot=0xFE62, }, [0xFE63]={ + adobename="hyphensmall", category="pd", cjkwd="w", description="SMALL HYPHEN-MINUS", @@ -105242,6 +107981,7 @@ characters.data={ unicodeslot=0xFE63, }, [0xFE64]={ + adobename="lesssmall", category="sm", cjkwd="w", description="SMALL LESS-THAN SIGN", @@ -105252,6 +107992,7 @@ characters.data={ unicodeslot=0xFE64, }, [0xFE65]={ + adobename="greatersmall", category="sm", cjkwd="w", description="SMALL GREATER-THAN SIGN", @@ -105262,6 +108003,7 @@ characters.data={ unicodeslot=0xFE65, }, [0xFE66]={ + adobename="equalsmall", category="sm", cjkwd="w", description="SMALL EQUALS SIGN", @@ -105280,6 +108022,7 @@ characters.data={ unicodeslot=0xFE68, }, [0xFE69]={ + adobename="dollarsmall", category="sc", cjkwd="w", description="SMALL DOLLAR SIGN", @@ -105289,6 +108032,7 @@ characters.data={ unicodeslot=0xFE69, }, [0xFE6A]={ + adobename="percentsmall", category="po", cjkwd="w", description="SMALL PERCENT SIGN", @@ -105298,6 +108042,7 @@ characters.data={ unicodeslot=0xFE6A, }, [0xFE6B]={ + adobename="atsmall", category="po", cjkwd="w", description="SMALL COMMERCIAL AT", @@ -105443,6 +108188,7 @@ characters.data={ unicodeslot=0xFE81, }, [0xFE82]={ + adobename="alefmaddaabovefinalarabic", category="lo", description="ARABIC LETTER ALEF WITH MADDA ABOVE FINAL FORM", direction="al", @@ -105461,6 +108207,7 @@ characters.data={ unicodeslot=0xFE83, }, [0xFE84]={ + adobename="alefhamzaabovefinalarabic", category="lo", description="ARABIC LETTER ALEF WITH HAMZA ABOVE FINAL FORM", direction="al", @@ -105479,6 +108226,7 @@ characters.data={ unicodeslot=0xFE85, }, [0xFE86]={ + adobename="wawhamzaabovefinalarabic", category="lo", description="ARABIC LETTER WAW WITH HAMZA ABOVE FINAL FORM", direction="al", @@ -105497,6 +108245,7 @@ characters.data={ unicodeslot=0xFE87, }, [0xFE88]={ + adobename="alefhamzabelowfinalarabic", category="lo", description="ARABIC LETTER ALEF WITH HAMZA BELOW FINAL FORM", direction="al", @@ -105515,6 +108264,7 @@ characters.data={ unicodeslot=0xFE89, }, [0xFE8A]={ + adobename="yehhamzaabovefinalarabic", category="lo", description="ARABIC LETTER YEH WITH HAMZA ABOVE FINAL FORM", direction="al", @@ -105524,6 +108274,7 @@ characters.data={ unicodeslot=0xFE8A, }, [0xFE8B]={ + adobename="yehhamzaaboveinitialarabic", category="lo", description="ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM", direction="al", @@ -105533,6 +108284,7 @@ characters.data={ unicodeslot=0xFE8B, }, [0xFE8C]={ + adobename="yehhamzaabovemedialarabic", category="lo", description="ARABIC LETTER YEH WITH HAMZA ABOVE MEDIAL FORM", direction="al", @@ -105550,6 +108302,7 @@ characters.data={ unicodeslot=0xFE8D, }, [0xFE8E]={ + adobename="aleffinalarabic", category="lo", description="ARABIC LETTER ALEF FINAL FORM", direction="al", @@ -105566,6 +108319,7 @@ characters.data={ unicodeslot=0xFE8F, }, [0xFE90]={ + adobename="behfinalarabic", category="lo", description="ARABIC LETTER BEH FINAL FORM", direction="al", @@ -105574,6 +108328,7 @@ characters.data={ unicodeslot=0xFE90, }, [0xFE91]={ + adobename="behinitialarabic", category="lo", description="ARABIC LETTER BEH INITIAL FORM", direction="al", @@ -105582,6 +108337,7 @@ characters.data={ unicodeslot=0xFE91, }, [0xFE92]={ + adobename="behmedialarabic", category="lo", description="ARABIC LETTER BEH MEDIAL FORM", direction="al", @@ -105598,6 +108354,7 @@ characters.data={ unicodeslot=0xFE93, }, [0xFE94]={ + adobename="tehmarbutafinalarabic", category="lo", description="ARABIC LETTER TEH MARBUTA FINAL FORM", direction="al", @@ -105614,6 +108371,7 @@ characters.data={ unicodeslot=0xFE95, }, [0xFE96]={ + adobename="tehfinalarabic", category="lo", description="ARABIC LETTER TEH FINAL FORM", direction="al", @@ -105622,6 +108380,7 @@ characters.data={ unicodeslot=0xFE96, }, [0xFE97]={ + adobename="tehinitialarabic", category="lo", description="ARABIC LETTER TEH INITIAL FORM", direction="al", @@ -105630,6 +108389,7 @@ characters.data={ unicodeslot=0xFE97, }, [0xFE98]={ + adobename="tehmedialarabic", category="lo", description="ARABIC LETTER TEH MEDIAL FORM", direction="al", @@ -105646,6 +108406,7 @@ characters.data={ unicodeslot=0xFE99, }, [0xFE9A]={ + adobename="thehfinalarabic", category="lo", description="ARABIC LETTER THEH FINAL FORM", direction="al", @@ -105654,6 +108415,7 @@ characters.data={ unicodeslot=0xFE9A, }, [0xFE9B]={ + adobename="thehinitialarabic", category="lo", description="ARABIC LETTER THEH INITIAL FORM", direction="al", @@ -105662,6 +108424,7 @@ characters.data={ unicodeslot=0xFE9B, }, [0xFE9C]={ + adobename="thehmedialarabic", category="lo", description="ARABIC LETTER THEH MEDIAL FORM", direction="al", @@ -105678,6 +108441,7 @@ characters.data={ unicodeslot=0xFE9D, }, [0xFE9E]={ + adobename="jeemfinalarabic", category="lo", description="ARABIC LETTER JEEM FINAL FORM", direction="al", @@ -105686,6 +108450,7 @@ characters.data={ unicodeslot=0xFE9E, }, [0xFE9F]={ + adobename="jeeminitialarabic", category="lo", description="ARABIC LETTER JEEM INITIAL FORM", direction="al", @@ -105694,6 +108459,7 @@ characters.data={ unicodeslot=0xFE9F, }, [0xFEA0]={ + adobename="jeemmedialarabic", category="lo", description="ARABIC LETTER JEEM MEDIAL FORM", direction="al", @@ -105710,6 +108476,7 @@ characters.data={ unicodeslot=0xFEA1, }, [0xFEA2]={ + adobename="hahfinalarabic", category="lo", description="ARABIC LETTER HAH FINAL FORM", direction="al", @@ -105718,6 +108485,7 @@ characters.data={ unicodeslot=0xFEA2, }, [0xFEA3]={ + adobename="hahinitialarabic", category="lo", description="ARABIC LETTER HAH INITIAL FORM", direction="al", @@ -105726,6 +108494,7 @@ characters.data={ unicodeslot=0xFEA3, }, [0xFEA4]={ + adobename="hahmedialarabic", category="lo", description="ARABIC LETTER HAH MEDIAL FORM", direction="al", @@ -105742,6 +108511,7 @@ characters.data={ unicodeslot=0xFEA5, }, [0xFEA6]={ + adobename="khahfinalarabic", category="lo", description="ARABIC LETTER KHAH FINAL FORM", direction="al", @@ -105750,6 +108520,7 @@ characters.data={ unicodeslot=0xFEA6, }, [0xFEA7]={ + adobename="khahinitialarabic", category="lo", description="ARABIC LETTER KHAH INITIAL FORM", direction="al", @@ -105758,6 +108529,7 @@ characters.data={ unicodeslot=0xFEA7, }, [0xFEA8]={ + adobename="khahmedialarabic", category="lo", description="ARABIC LETTER KHAH MEDIAL FORM", direction="al", @@ -105774,6 +108546,7 @@ characters.data={ unicodeslot=0xFEA9, }, [0xFEAA]={ + adobename="dalfinalarabic", category="lo", description="ARABIC LETTER DAL FINAL FORM", direction="al", @@ -105790,6 +108563,7 @@ characters.data={ unicodeslot=0xFEAB, }, [0xFEAC]={ + adobename="thalfinalarabic", category="lo", description="ARABIC LETTER THAL FINAL FORM", direction="al", @@ -105806,6 +108580,7 @@ characters.data={ unicodeslot=0xFEAD, }, [0xFEAE]={ + adobename="rehfinalarabic", category="lo", description="ARABIC LETTER REH FINAL FORM", direction="al", @@ -105822,6 +108597,7 @@ characters.data={ unicodeslot=0xFEAF, }, [0xFEB0]={ + adobename="zainfinalarabic", category="lo", description="ARABIC LETTER ZAIN FINAL FORM", direction="al", @@ -105838,6 +108614,7 @@ characters.data={ unicodeslot=0xFEB1, }, [0xFEB2]={ + adobename="seenfinalarabic", category="lo", description="ARABIC LETTER SEEN FINAL FORM", direction="al", @@ -105846,6 +108623,7 @@ characters.data={ unicodeslot=0xFEB2, }, [0xFEB3]={ + adobename="seeninitialarabic", category="lo", description="ARABIC LETTER SEEN INITIAL FORM", direction="al", @@ -105854,6 +108632,7 @@ characters.data={ unicodeslot=0xFEB3, }, [0xFEB4]={ + adobename="seenmedialarabic", category="lo", description="ARABIC LETTER SEEN MEDIAL FORM", direction="al", @@ -105870,6 +108649,7 @@ characters.data={ unicodeslot=0xFEB5, }, [0xFEB6]={ + adobename="sheenfinalarabic", category="lo", description="ARABIC LETTER SHEEN FINAL FORM", direction="al", @@ -105878,6 +108658,7 @@ characters.data={ unicodeslot=0xFEB6, }, [0xFEB7]={ + adobename="sheeninitialarabic", category="lo", description="ARABIC LETTER SHEEN INITIAL FORM", direction="al", @@ -105886,6 +108667,7 @@ characters.data={ unicodeslot=0xFEB7, }, [0xFEB8]={ + adobename="sheenmedialarabic", category="lo", description="ARABIC LETTER SHEEN MEDIAL FORM", direction="al", @@ -105902,6 +108684,7 @@ characters.data={ unicodeslot=0xFEB9, }, [0xFEBA]={ + adobename="sadfinalarabic", category="lo", description="ARABIC LETTER SAD FINAL FORM", direction="al", @@ -105910,6 +108693,7 @@ characters.data={ unicodeslot=0xFEBA, }, [0xFEBB]={ + adobename="sadinitialarabic", category="lo", description="ARABIC LETTER SAD INITIAL FORM", direction="al", @@ -105918,6 +108702,7 @@ characters.data={ unicodeslot=0xFEBB, }, [0xFEBC]={ + adobename="sadmedialarabic", category="lo", description="ARABIC LETTER SAD MEDIAL FORM", direction="al", @@ -105934,6 +108719,7 @@ characters.data={ unicodeslot=0xFEBD, }, [0xFEBE]={ + adobename="dadfinalarabic", category="lo", description="ARABIC LETTER DAD FINAL FORM", direction="al", @@ -105942,6 +108728,7 @@ characters.data={ unicodeslot=0xFEBE, }, [0xFEBF]={ + adobename="dadinitialarabic", category="lo", description="ARABIC LETTER DAD INITIAL FORM", direction="al", @@ -105950,6 +108737,7 @@ characters.data={ unicodeslot=0xFEBF, }, [0xFEC0]={ + adobename="dadmedialarabic", category="lo", description="ARABIC LETTER DAD MEDIAL FORM", direction="al", @@ -105966,6 +108754,7 @@ characters.data={ unicodeslot=0xFEC1, }, [0xFEC2]={ + adobename="tahfinalarabic", category="lo", description="ARABIC LETTER TAH FINAL FORM", direction="al", @@ -105974,6 +108763,7 @@ characters.data={ unicodeslot=0xFEC2, }, [0xFEC3]={ + adobename="tahinitialarabic", category="lo", description="ARABIC LETTER TAH INITIAL FORM", direction="al", @@ -105982,6 +108772,7 @@ characters.data={ unicodeslot=0xFEC3, }, [0xFEC4]={ + adobename="tahmedialarabic", category="lo", description="ARABIC LETTER TAH MEDIAL FORM", direction="al", @@ -105998,6 +108789,7 @@ characters.data={ unicodeslot=0xFEC5, }, [0xFEC6]={ + adobename="zahfinalarabic", category="lo", description="ARABIC LETTER ZAH FINAL FORM", direction="al", @@ -106006,6 +108798,7 @@ characters.data={ unicodeslot=0xFEC6, }, [0xFEC7]={ + adobename="zahinitialarabic", category="lo", description="ARABIC LETTER ZAH INITIAL FORM", direction="al", @@ -106014,6 +108807,7 @@ characters.data={ unicodeslot=0xFEC7, }, [0xFEC8]={ + adobename="zahmedialarabic", category="lo", description="ARABIC LETTER ZAH MEDIAL FORM", direction="al", @@ -106030,6 +108824,7 @@ characters.data={ unicodeslot=0xFEC9, }, [0xFECA]={ + adobename="ainfinalarabic", category="lo", description="ARABIC LETTER AIN FINAL FORM", direction="al", @@ -106038,6 +108833,7 @@ characters.data={ unicodeslot=0xFECA, }, [0xFECB]={ + adobename="aininitialarabic", category="lo", description="ARABIC LETTER AIN INITIAL FORM", direction="al", @@ -106046,6 +108842,7 @@ characters.data={ unicodeslot=0xFECB, }, [0xFECC]={ + adobename="ainmedialarabic", category="lo", description="ARABIC LETTER AIN MEDIAL FORM", direction="al", @@ -106062,6 +108859,7 @@ characters.data={ unicodeslot=0xFECD, }, [0xFECE]={ + adobename="ghainfinalarabic", category="lo", description="ARABIC LETTER GHAIN FINAL FORM", direction="al", @@ -106070,6 +108868,7 @@ characters.data={ unicodeslot=0xFECE, }, [0xFECF]={ + adobename="ghaininitialarabic", category="lo", description="ARABIC LETTER GHAIN INITIAL FORM", direction="al", @@ -106078,6 +108877,7 @@ characters.data={ unicodeslot=0xFECF, }, [0xFED0]={ + adobename="ghainmedialarabic", category="lo", description="ARABIC LETTER GHAIN MEDIAL FORM", direction="al", @@ -106094,6 +108894,7 @@ characters.data={ unicodeslot=0xFED1, }, [0xFED2]={ + adobename="fehfinalarabic", category="lo", description="ARABIC LETTER FEH FINAL FORM", direction="al", @@ -106102,6 +108903,7 @@ characters.data={ unicodeslot=0xFED2, }, [0xFED3]={ + adobename="fehinitialarabic", category="lo", description="ARABIC LETTER FEH INITIAL FORM", direction="al", @@ -106110,6 +108912,7 @@ characters.data={ unicodeslot=0xFED3, }, [0xFED4]={ + adobename="fehmedialarabic", category="lo", description="ARABIC LETTER FEH MEDIAL FORM", direction="al", @@ -106126,6 +108929,7 @@ characters.data={ unicodeslot=0xFED5, }, [0xFED6]={ + adobename="qaffinalarabic", category="lo", description="ARABIC LETTER QAF FINAL FORM", direction="al", @@ -106134,6 +108938,7 @@ characters.data={ unicodeslot=0xFED6, }, [0xFED7]={ + adobename="qafinitialarabic", category="lo", description="ARABIC LETTER QAF INITIAL FORM", direction="al", @@ -106142,6 +108947,7 @@ characters.data={ unicodeslot=0xFED7, }, [0xFED8]={ + adobename="qafmedialarabic", category="lo", description="ARABIC LETTER QAF MEDIAL FORM", direction="al", @@ -106158,6 +108964,7 @@ characters.data={ unicodeslot=0xFED9, }, [0xFEDA]={ + adobename="kaffinalarabic", category="lo", description="ARABIC LETTER KAF FINAL FORM", direction="al", @@ -106166,6 +108973,7 @@ characters.data={ unicodeslot=0xFEDA, }, [0xFEDB]={ + adobename="kafinitialarabic", category="lo", description="ARABIC LETTER KAF INITIAL FORM", direction="al", @@ -106174,6 +108982,7 @@ characters.data={ unicodeslot=0xFEDB, }, [0xFEDC]={ + adobename="kafmedialarabic", category="lo", description="ARABIC LETTER KAF MEDIAL FORM", direction="al", @@ -106190,6 +108999,7 @@ characters.data={ unicodeslot=0xFEDD, }, [0xFEDE]={ + adobename="lamfinalarabic", category="lo", description="ARABIC LETTER LAM FINAL FORM", direction="al", @@ -106198,6 +109008,7 @@ characters.data={ unicodeslot=0xFEDE, }, [0xFEDF]={ + adobename="lammeemkhahinitialarabic", category="lo", description="ARABIC LETTER LAM INITIAL FORM", direction="al", @@ -106206,6 +109017,7 @@ characters.data={ unicodeslot=0xFEDF, }, [0xFEE0]={ + adobename="lammedialarabic", category="lo", description="ARABIC LETTER LAM MEDIAL FORM", direction="al", @@ -106222,6 +109034,7 @@ characters.data={ unicodeslot=0xFEE1, }, [0xFEE2]={ + adobename="meemfinalarabic", category="lo", description="ARABIC LETTER MEEM FINAL FORM", direction="al", @@ -106230,6 +109043,7 @@ characters.data={ unicodeslot=0xFEE2, }, [0xFEE3]={ + adobename="meeminitialarabic", category="lo", description="ARABIC LETTER MEEM INITIAL FORM", direction="al", @@ -106238,6 +109052,7 @@ characters.data={ unicodeslot=0xFEE3, }, [0xFEE4]={ + adobename="meemmedialarabic", category="lo", description="ARABIC LETTER MEEM MEDIAL FORM", direction="al", @@ -106254,6 +109069,7 @@ characters.data={ unicodeslot=0xFEE5, }, [0xFEE6]={ + adobename="noonfinalarabic", category="lo", description="ARABIC LETTER NOON FINAL FORM", direction="al", @@ -106262,6 +109078,7 @@ characters.data={ unicodeslot=0xFEE6, }, [0xFEE7]={ + adobename="nooninitialarabic", category="lo", description="ARABIC LETTER NOON INITIAL FORM", direction="al", @@ -106270,6 +109087,7 @@ characters.data={ unicodeslot=0xFEE7, }, [0xFEE8]={ + adobename="noonmedialarabic", category="lo", description="ARABIC LETTER NOON MEDIAL FORM", direction="al", @@ -106286,6 +109104,7 @@ characters.data={ unicodeslot=0xFEE9, }, [0xFEEA]={ + adobename="hehfinalarabic", category="lo", description="ARABIC LETTER HEH FINAL FORM", direction="al", @@ -106294,6 +109113,7 @@ characters.data={ unicodeslot=0xFEEA, }, [0xFEEB]={ + adobename="hehinitialarabic", category="lo", description="ARABIC LETTER HEH INITIAL FORM", direction="al", @@ -106302,6 +109122,7 @@ characters.data={ unicodeslot=0xFEEB, }, [0xFEEC]={ + adobename="hehmedialarabic", category="lo", description="ARABIC LETTER HEH MEDIAL FORM", direction="al", @@ -106318,6 +109139,7 @@ characters.data={ unicodeslot=0xFEED, }, [0xFEEE]={ + adobename="wawfinalarabic", category="lo", description="ARABIC LETTER WAW FINAL FORM", direction="al", @@ -106334,6 +109156,7 @@ characters.data={ unicodeslot=0xFEEF, }, [0xFEF0]={ + adobename="alefmaksurafinalarabic", category="lo", description="ARABIC LETTER ALEF MAKSURA FINAL FORM", direction="al", @@ -106350,6 +109173,7 @@ characters.data={ unicodeslot=0xFEF1, }, [0xFEF2]={ + adobename="yehfinalarabic", category="lo", description="ARABIC LETTER YEH FINAL FORM", direction="al", @@ -106358,6 +109182,7 @@ characters.data={ unicodeslot=0xFEF2, }, [0xFEF3]={ + adobename="yehinitialarabic", category="lo", description="ARABIC LETTER YEH INITIAL FORM", direction="al", @@ -106366,6 +109191,7 @@ characters.data={ unicodeslot=0xFEF3, }, [0xFEF4]={ + adobename="yehmedialarabic", category="lo", description="ARABIC LETTER YEH MEDIAL FORM", direction="al", @@ -106374,6 +109200,7 @@ characters.data={ unicodeslot=0xFEF4, }, [0xFEF5]={ + adobename="lamalefmaddaaboveisolatedarabic", category="lo", description="ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE ISOLATED FORM", direction="al", @@ -106382,6 +109209,7 @@ characters.data={ unicodeslot=0xFEF5, }, [0xFEF6]={ + adobename="lamalefmaddaabovefinalarabic", category="lo", description="ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE FINAL FORM", direction="al", @@ -106390,6 +109218,7 @@ characters.data={ unicodeslot=0xFEF6, }, [0xFEF7]={ + adobename="lamalefhamzaaboveisolatedarabic", category="lo", description="ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE ISOLATED FORM", direction="al", @@ -106398,6 +109227,7 @@ characters.data={ unicodeslot=0xFEF7, }, [0xFEF8]={ + adobename="lamalefhamzaabovefinalarabic", category="lo", description="ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE FINAL FORM", direction="al", @@ -106406,6 +109236,7 @@ characters.data={ unicodeslot=0xFEF8, }, [0xFEF9]={ + adobename="lamalefhamzabelowisolatedarabic", category="lo", description="ARABIC LIGATURE LAM WITH ALEF WITH HAMZA BELOW ISOLATED FORM", direction="al", @@ -106414,6 +109245,7 @@ characters.data={ unicodeslot=0xFEF9, }, [0xFEFA]={ + adobename="lamalefhamzabelowfinalarabic", category="lo", description="ARABIC LIGATURE LAM WITH ALEF WITH HAMZA BELOW FINAL FORM", direction="al", @@ -106422,6 +109254,7 @@ characters.data={ unicodeslot=0xFEFA, }, [0xFEFB]={ + adobename="lamalefisolatedarabic", category="lo", description="ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM", direction="al", @@ -106430,6 +109263,7 @@ characters.data={ unicodeslot=0xFEFB, }, [0xFEFC]={ + adobename="lamaleffinalarabic", category="lo", description="ARABIC LIGATURE LAM WITH ALEF FINAL FORM", direction="al", @@ -106438,6 +109272,7 @@ characters.data={ unicodeslot=0xFEFC, }, [0xFEFF]={ + adobename="zerowidthjoiner", category="cf", contextname="zerowidthnobreakspace", description="ZERO WIDTH NO-BREAK SPACE", @@ -106446,6 +109281,7 @@ characters.data={ unicodeslot=0xFEFF, }, [0xFF01]={ + adobename="exclammonospace", category="po", cjkwd="f", description="FULLWIDTH EXCLAMATION MARK", @@ -106455,6 +109291,7 @@ characters.data={ unicodeslot=0xFF01, }, [0xFF02]={ + adobename="quotedblmonospace", category="po", cjkwd="f", description="FULLWIDTH QUOTATION MARK", @@ -106464,6 +109301,7 @@ characters.data={ unicodeslot=0xFF02, }, [0xFF03]={ + adobename="numbersignmonospace", category="po", cjkwd="f", description="FULLWIDTH NUMBER SIGN", @@ -106473,6 +109311,7 @@ characters.data={ unicodeslot=0xFF03, }, [0xFF04]={ + adobename="dollarmonospace", category="sc", cjkwd="f", description="FULLWIDTH DOLLAR SIGN", @@ -106482,6 +109321,7 @@ characters.data={ unicodeslot=0xFF04, }, [0xFF05]={ + adobename="percentmonospace", category="po", cjkwd="f", description="FULLWIDTH PERCENT SIGN", @@ -106491,6 +109331,7 @@ characters.data={ unicodeslot=0xFF05, }, [0xFF06]={ + adobename="ampersandmonospace", category="po", cjkwd="f", description="FULLWIDTH AMPERSAND", @@ -106500,6 +109341,7 @@ characters.data={ unicodeslot=0xFF06, }, [0xFF07]={ + adobename="quotesinglemonospace", category="po", cjkwd="f", description="FULLWIDTH APOSTROPHE", @@ -106509,6 +109351,7 @@ characters.data={ unicodeslot=0xFF07, }, [0xFF08]={ + adobename="parenleftmonospace", category="ps", cjkwd="f", description="FULLWIDTH LEFT PARENTHESIS", @@ -106519,6 +109362,7 @@ characters.data={ unicodeslot=0xFF08, }, [0xFF09]={ + adobename="parenrightmonospace", category="pe", cjkwd="f", description="FULLWIDTH RIGHT PARENTHESIS", @@ -106529,6 +109373,7 @@ characters.data={ unicodeslot=0xFF09, }, [0xFF0A]={ + adobename="asteriskmonospace", category="po", cjkwd="f", description="FULLWIDTH ASTERISK", @@ -106538,6 +109383,7 @@ characters.data={ unicodeslot=0xFF0A, }, [0xFF0B]={ + adobename="plusmonospace", category="sm", cjkwd="f", description="FULLWIDTH PLUS SIGN", @@ -106547,6 +109393,7 @@ characters.data={ unicodeslot=0xFF0B, }, [0xFF0C]={ + adobename="commamonospace", category="po", cjkwd="f", description="FULLWIDTH COMMA", @@ -106556,6 +109403,7 @@ characters.data={ unicodeslot=0xFF0C, }, [0xFF0D]={ + adobename="hyphenmonospace", category="pd", cjkwd="f", description="FULLWIDTH HYPHEN-MINUS", @@ -106565,6 +109413,7 @@ characters.data={ unicodeslot=0xFF0D, }, [0xFF0E]={ + adobename="periodmonospace", category="po", cjkwd="f", description="FULLWIDTH FULL STOP", @@ -106574,6 +109423,7 @@ characters.data={ unicodeslot=0xFF0E, }, [0xFF0F]={ + adobename="slashmonospace", category="po", cjkwd="f", description="FULLWIDTH SOLIDUS", @@ -106583,6 +109433,7 @@ characters.data={ unicodeslot=0xFF0F, }, [0xFF10]={ + adobename="zeromonospace", category="nd", cjkwd="f", description="FULLWIDTH DIGIT ZERO", @@ -106592,6 +109443,7 @@ characters.data={ unicodeslot=0xFF10, }, [0xFF11]={ + adobename="onemonospace", category="nd", cjkwd="f", description="FULLWIDTH DIGIT ONE", @@ -106601,6 +109453,7 @@ characters.data={ unicodeslot=0xFF11, }, [0xFF12]={ + adobename="twomonospace", category="nd", cjkwd="f", description="FULLWIDTH DIGIT TWO", @@ -106610,6 +109463,7 @@ characters.data={ unicodeslot=0xFF12, }, [0xFF13]={ + adobename="threemonospace", category="nd", cjkwd="f", description="FULLWIDTH DIGIT THREE", @@ -106619,6 +109473,7 @@ characters.data={ unicodeslot=0xFF13, }, [0xFF14]={ + adobename="fourmonospace", category="nd", cjkwd="f", description="FULLWIDTH DIGIT FOUR", @@ -106628,6 +109483,7 @@ characters.data={ unicodeslot=0xFF14, }, [0xFF15]={ + adobename="fivemonospace", category="nd", cjkwd="f", description="FULLWIDTH DIGIT FIVE", @@ -106637,6 +109493,7 @@ characters.data={ unicodeslot=0xFF15, }, [0xFF16]={ + adobename="sixmonospace", category="nd", cjkwd="f", description="FULLWIDTH DIGIT SIX", @@ -106646,6 +109503,7 @@ characters.data={ unicodeslot=0xFF16, }, [0xFF17]={ + adobename="sevenmonospace", category="nd", cjkwd="f", description="FULLWIDTH DIGIT SEVEN", @@ -106655,6 +109513,7 @@ characters.data={ unicodeslot=0xFF17, }, [0xFF18]={ + adobename="eightmonospace", category="nd", cjkwd="f", description="FULLWIDTH DIGIT EIGHT", @@ -106664,6 +109523,7 @@ characters.data={ unicodeslot=0xFF18, }, [0xFF19]={ + adobename="ninemonospace", category="nd", cjkwd="f", description="FULLWIDTH DIGIT NINE", @@ -106673,6 +109533,7 @@ characters.data={ unicodeslot=0xFF19, }, [0xFF1A]={ + adobename="colonmonospace", category="po", cjkwd="f", description="FULLWIDTH COLON", @@ -106682,6 +109543,7 @@ characters.data={ unicodeslot=0xFF1A, }, [0xFF1B]={ + adobename="semicolonmonospace", category="po", cjkwd="f", description="FULLWIDTH SEMICOLON", @@ -106691,6 +109553,7 @@ characters.data={ unicodeslot=0xFF1B, }, [0xFF1C]={ + adobename="lessmonospace", category="sm", cjkwd="f", description="FULLWIDTH LESS-THAN SIGN", @@ -106701,6 +109564,7 @@ characters.data={ unicodeslot=0xFF1C, }, [0xFF1D]={ + adobename="equalmonospace", category="sm", cjkwd="f", description="FULLWIDTH EQUALS SIGN", @@ -106710,6 +109574,7 @@ characters.data={ unicodeslot=0xFF1D, }, [0xFF1E]={ + adobename="greatermonospace", category="sm", cjkwd="f", description="FULLWIDTH GREATER-THAN SIGN", @@ -106720,6 +109585,7 @@ characters.data={ unicodeslot=0xFF1E, }, [0xFF1F]={ + adobename="questionmonospace", category="po", cjkwd="f", description="FULLWIDTH QUESTION MARK", @@ -106729,6 +109595,7 @@ characters.data={ unicodeslot=0xFF1F, }, [0xFF20]={ + adobename="atmonospace", category="po", cjkwd="f", description="FULLWIDTH COMMERCIAL AT", @@ -106738,6 +109605,7 @@ characters.data={ unicodeslot=0xFF20, }, [0xFF21]={ + adobename="Amonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER A", @@ -106748,6 +109616,7 @@ characters.data={ unicodeslot=0xFF21, }, [0xFF22]={ + adobename="Bmonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER B", @@ -106758,6 +109627,7 @@ characters.data={ unicodeslot=0xFF22, }, [0xFF23]={ + adobename="Cmonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER C", @@ -106768,6 +109638,7 @@ characters.data={ unicodeslot=0xFF23, }, [0xFF24]={ + adobename="Dmonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER D", @@ -106778,6 +109649,7 @@ characters.data={ unicodeslot=0xFF24, }, [0xFF25]={ + adobename="Emonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER E", @@ -106788,6 +109660,7 @@ characters.data={ unicodeslot=0xFF25, }, [0xFF26]={ + adobename="Fmonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER F", @@ -106798,6 +109671,7 @@ characters.data={ unicodeslot=0xFF26, }, [0xFF27]={ + adobename="Gmonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER G", @@ -106808,6 +109682,7 @@ characters.data={ unicodeslot=0xFF27, }, [0xFF28]={ + adobename="Hmonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER H", @@ -106818,6 +109693,7 @@ characters.data={ unicodeslot=0xFF28, }, [0xFF29]={ + adobename="Imonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER I", @@ -106828,6 +109704,7 @@ characters.data={ unicodeslot=0xFF29, }, [0xFF2A]={ + adobename="Jmonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER J", @@ -106838,6 +109715,7 @@ characters.data={ unicodeslot=0xFF2A, }, [0xFF2B]={ + adobename="Kmonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER K", @@ -106848,6 +109726,7 @@ characters.data={ unicodeslot=0xFF2B, }, [0xFF2C]={ + adobename="Lmonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER L", @@ -106858,6 +109737,7 @@ characters.data={ unicodeslot=0xFF2C, }, [0xFF2D]={ + adobename="Mmonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER M", @@ -106868,6 +109748,7 @@ characters.data={ unicodeslot=0xFF2D, }, [0xFF2E]={ + adobename="Nmonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER N", @@ -106878,6 +109759,7 @@ characters.data={ unicodeslot=0xFF2E, }, [0xFF2F]={ + adobename="Omonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER O", @@ -106888,6 +109770,7 @@ characters.data={ unicodeslot=0xFF2F, }, [0xFF30]={ + adobename="Pmonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER P", @@ -106898,6 +109781,7 @@ characters.data={ unicodeslot=0xFF30, }, [0xFF31]={ + adobename="Qmonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER Q", @@ -106908,6 +109792,7 @@ characters.data={ unicodeslot=0xFF31, }, [0xFF32]={ + adobename="Rmonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER R", @@ -106918,6 +109803,7 @@ characters.data={ unicodeslot=0xFF32, }, [0xFF33]={ + adobename="Smonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER S", @@ -106928,6 +109814,7 @@ characters.data={ unicodeslot=0xFF33, }, [0xFF34]={ + adobename="Tmonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER T", @@ -106938,6 +109825,7 @@ characters.data={ unicodeslot=0xFF34, }, [0xFF35]={ + adobename="Umonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER U", @@ -106948,6 +109836,7 @@ characters.data={ unicodeslot=0xFF35, }, [0xFF36]={ + adobename="Vmonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER V", @@ -106958,6 +109847,7 @@ characters.data={ unicodeslot=0xFF36, }, [0xFF37]={ + adobename="Wmonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER W", @@ -106968,6 +109858,7 @@ characters.data={ unicodeslot=0xFF37, }, [0xFF38]={ + adobename="Xmonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER X", @@ -106978,6 +109869,7 @@ characters.data={ unicodeslot=0xFF38, }, [0xFF39]={ + adobename="Ymonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER Y", @@ -106988,6 +109880,7 @@ characters.data={ unicodeslot=0xFF39, }, [0xFF3A]={ + adobename="Zmonospace", category="lu", cjkwd="f", description="FULLWIDTH LATIN CAPITAL LETTER Z", @@ -106998,6 +109891,7 @@ characters.data={ unicodeslot=0xFF3A, }, [0xFF3B]={ + adobename="bracketleftmonospace", category="ps", cjkwd="f", description="FULLWIDTH LEFT SQUARE BRACKET", @@ -107008,6 +109902,7 @@ characters.data={ unicodeslot=0xFF3B, }, [0xFF3C]={ + adobename="backslashmonospace", category="po", cjkwd="f", description="FULLWIDTH REVERSE SOLIDUS", @@ -107017,6 +109912,7 @@ characters.data={ unicodeslot=0xFF3C, }, [0xFF3D]={ + adobename="bracketrightmonospace", category="pe", cjkwd="f", description="FULLWIDTH RIGHT SQUARE BRACKET", @@ -107027,6 +109923,7 @@ characters.data={ unicodeslot=0xFF3D, }, [0xFF3E]={ + adobename="asciicircummonospace", category="sk", cjkwd="f", description="FULLWIDTH CIRCUMFLEX ACCENT", @@ -107036,6 +109933,7 @@ characters.data={ unicodeslot=0xFF3E, }, [0xFF3F]={ + adobename="underscoremonospace", category="pc", cjkwd="f", description="FULLWIDTH LOW LINE", @@ -107045,6 +109943,7 @@ characters.data={ unicodeslot=0xFF3F, }, [0xFF40]={ + adobename="gravemonospace", category="sk", cjkwd="f", description="FULLWIDTH GRAVE ACCENT", @@ -107054,6 +109953,7 @@ characters.data={ unicodeslot=0xFF40, }, [0xFF41]={ + adobename="amonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER A", @@ -107064,6 +109964,7 @@ characters.data={ unicodeslot=0xFF41, }, [0xFF42]={ + adobename="bmonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER B", @@ -107074,6 +109975,7 @@ characters.data={ unicodeslot=0xFF42, }, [0xFF43]={ + adobename="cmonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER C", @@ -107084,6 +109986,7 @@ characters.data={ unicodeslot=0xFF43, }, [0xFF44]={ + adobename="dmonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER D", @@ -107094,6 +109997,7 @@ characters.data={ unicodeslot=0xFF44, }, [0xFF45]={ + adobename="emonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER E", @@ -107104,6 +110008,7 @@ characters.data={ unicodeslot=0xFF45, }, [0xFF46]={ + adobename="fmonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER F", @@ -107114,6 +110019,7 @@ characters.data={ unicodeslot=0xFF46, }, [0xFF47]={ + adobename="gmonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER G", @@ -107124,6 +110030,7 @@ characters.data={ unicodeslot=0xFF47, }, [0xFF48]={ + adobename="hmonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER H", @@ -107134,6 +110041,7 @@ characters.data={ unicodeslot=0xFF48, }, [0xFF49]={ + adobename="imonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER I", @@ -107144,6 +110052,7 @@ characters.data={ unicodeslot=0xFF49, }, [0xFF4A]={ + adobename="jmonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER J", @@ -107154,6 +110063,7 @@ characters.data={ unicodeslot=0xFF4A, }, [0xFF4B]={ + adobename="kmonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER K", @@ -107164,6 +110074,7 @@ characters.data={ unicodeslot=0xFF4B, }, [0xFF4C]={ + adobename="lmonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER L", @@ -107174,6 +110085,7 @@ characters.data={ unicodeslot=0xFF4C, }, [0xFF4D]={ + adobename="mmonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER M", @@ -107184,6 +110096,7 @@ characters.data={ unicodeslot=0xFF4D, }, [0xFF4E]={ + adobename="nmonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER N", @@ -107194,6 +110107,7 @@ characters.data={ unicodeslot=0xFF4E, }, [0xFF4F]={ + adobename="omonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER O", @@ -107204,6 +110118,7 @@ characters.data={ unicodeslot=0xFF4F, }, [0xFF50]={ + adobename="pmonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER P", @@ -107214,6 +110129,7 @@ characters.data={ unicodeslot=0xFF50, }, [0xFF51]={ + adobename="qmonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER Q", @@ -107224,6 +110140,7 @@ characters.data={ unicodeslot=0xFF51, }, [0xFF52]={ + adobename="rmonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER R", @@ -107234,6 +110151,7 @@ characters.data={ unicodeslot=0xFF52, }, [0xFF53]={ + adobename="smonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER S", @@ -107244,6 +110162,7 @@ characters.data={ unicodeslot=0xFF53, }, [0xFF54]={ + adobename="tmonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER T", @@ -107254,6 +110173,7 @@ characters.data={ unicodeslot=0xFF54, }, [0xFF55]={ + adobename="umonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER U", @@ -107264,6 +110184,7 @@ characters.data={ unicodeslot=0xFF55, }, [0xFF56]={ + adobename="vmonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER V", @@ -107274,6 +110195,7 @@ characters.data={ unicodeslot=0xFF56, }, [0xFF57]={ + adobename="wmonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER W", @@ -107284,6 +110206,7 @@ characters.data={ unicodeslot=0xFF57, }, [0xFF58]={ + adobename="xmonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER X", @@ -107294,6 +110217,7 @@ characters.data={ unicodeslot=0xFF58, }, [0xFF59]={ + adobename="ymonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER Y", @@ -107304,6 +110228,7 @@ characters.data={ unicodeslot=0xFF59, }, [0xFF5A]={ + adobename="zmonospace", category="ll", cjkwd="f", description="FULLWIDTH LATIN SMALL LETTER Z", @@ -107314,6 +110239,7 @@ characters.data={ unicodeslot=0xFF5A, }, [0xFF5B]={ + adobename="braceleftmonospace", category="ps", cjkwd="f", description="FULLWIDTH LEFT CURLY BRACKET", @@ -107324,6 +110250,7 @@ characters.data={ unicodeslot=0xFF5B, }, [0xFF5C]={ + adobename="barmonospace", category="sm", cjkwd="f", description="FULLWIDTH VERTICAL LINE", @@ -107333,6 +110260,7 @@ characters.data={ unicodeslot=0xFF5C, }, [0xFF5D]={ + adobename="bracerightmonospace", category="pe", cjkwd="f", description="FULLWIDTH RIGHT CURLY BRACKET", @@ -107343,6 +110271,7 @@ characters.data={ unicodeslot=0xFF5D, }, [0xFF5E]={ + adobename="asciitildemonospace", category="sm", cjkwd="f", description="FULLWIDTH TILDE", @@ -107372,6 +110301,7 @@ characters.data={ unicodeslot=0xFF60, }, [0xFF61]={ + adobename="periodhalfwidth", category="po", cjkwd="h", description="HALFWIDTH IDEOGRAPHIC FULL STOP", @@ -107381,6 +110311,7 @@ characters.data={ unicodeslot=0xFF61, }, [0xFF62]={ + adobename="cornerbracketlefthalfwidth", category="ps", cjkwd="h", description="HALFWIDTH LEFT CORNER BRACKET", @@ -107391,6 +110322,7 @@ characters.data={ unicodeslot=0xFF62, }, [0xFF63]={ + adobename="cornerbracketrighthalfwidth", category="pe", cjkwd="h", description="HALFWIDTH RIGHT CORNER BRACKET", @@ -107401,6 +110333,7 @@ characters.data={ unicodeslot=0xFF63, }, [0xFF64]={ + adobename="ideographiccommaleft", category="po", cjkwd="h", description="HALFWIDTH IDEOGRAPHIC COMMA", @@ -107410,6 +110343,7 @@ characters.data={ unicodeslot=0xFF64, }, [0xFF65]={ + adobename="middledotkatakanahalfwidth", category="po", cjkwd="h", description="HALFWIDTH KATAKANA MIDDLE DOT", @@ -107419,6 +110353,7 @@ characters.data={ unicodeslot=0xFF65, }, [0xFF66]={ + adobename="wokatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER WO", @@ -107428,6 +110363,7 @@ characters.data={ unicodeslot=0xFF66, }, [0xFF67]={ + adobename="asmallkatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER SMALL A", @@ -107437,6 +110373,7 @@ characters.data={ unicodeslot=0xFF67, }, [0xFF68]={ + adobename="ismallkatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER SMALL I", @@ -107446,6 +110383,7 @@ characters.data={ unicodeslot=0xFF68, }, [0xFF69]={ + adobename="usmallkatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER SMALL U", @@ -107455,6 +110393,7 @@ characters.data={ unicodeslot=0xFF69, }, [0xFF6A]={ + adobename="esmallkatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER SMALL E", @@ -107464,6 +110403,7 @@ characters.data={ unicodeslot=0xFF6A, }, [0xFF6B]={ + adobename="osmallkatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER SMALL O", @@ -107473,6 +110413,7 @@ characters.data={ unicodeslot=0xFF6B, }, [0xFF6C]={ + adobename="yasmallkatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER SMALL YA", @@ -107482,6 +110423,7 @@ characters.data={ unicodeslot=0xFF6C, }, [0xFF6D]={ + adobename="yusmallkatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER SMALL YU", @@ -107491,6 +110433,7 @@ characters.data={ unicodeslot=0xFF6D, }, [0xFF6E]={ + adobename="yosmallkatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER SMALL YO", @@ -107500,6 +110443,7 @@ characters.data={ unicodeslot=0xFF6E, }, [0xFF6F]={ + adobename="tusmallkatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER SMALL TU", @@ -107509,6 +110453,7 @@ characters.data={ unicodeslot=0xFF6F, }, [0xFF70]={ + adobename="katahiraprolongmarkhalfwidth", category="lm", cjkwd="h", description="HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK", @@ -107518,6 +110463,7 @@ characters.data={ unicodeslot=0xFF70, }, [0xFF71]={ + adobename="akatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER A", @@ -107527,6 +110473,7 @@ characters.data={ unicodeslot=0xFF71, }, [0xFF72]={ + adobename="ikatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER I", @@ -107536,6 +110483,7 @@ characters.data={ unicodeslot=0xFF72, }, [0xFF73]={ + adobename="ukatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER U", @@ -107545,6 +110493,7 @@ characters.data={ unicodeslot=0xFF73, }, [0xFF74]={ + adobename="ekatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER E", @@ -107554,6 +110503,7 @@ characters.data={ unicodeslot=0xFF74, }, [0xFF75]={ + adobename="okatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER O", @@ -107563,6 +110513,7 @@ characters.data={ unicodeslot=0xFF75, }, [0xFF76]={ + adobename="kakatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER KA", @@ -107572,6 +110523,7 @@ characters.data={ unicodeslot=0xFF76, }, [0xFF77]={ + adobename="kikatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER KI", @@ -107581,6 +110533,7 @@ characters.data={ unicodeslot=0xFF77, }, [0xFF78]={ + adobename="kukatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER KU", @@ -107590,6 +110543,7 @@ characters.data={ unicodeslot=0xFF78, }, [0xFF79]={ + adobename="kekatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER KE", @@ -107599,6 +110553,7 @@ characters.data={ unicodeslot=0xFF79, }, [0xFF7A]={ + adobename="kokatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER KO", @@ -107608,6 +110563,7 @@ characters.data={ unicodeslot=0xFF7A, }, [0xFF7B]={ + adobename="sakatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER SA", @@ -107617,6 +110573,7 @@ characters.data={ unicodeslot=0xFF7B, }, [0xFF7C]={ + adobename="sikatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER SI", @@ -107626,6 +110583,7 @@ characters.data={ unicodeslot=0xFF7C, }, [0xFF7D]={ + adobename="sukatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER SU", @@ -107635,6 +110593,7 @@ characters.data={ unicodeslot=0xFF7D, }, [0xFF7E]={ + adobename="sekatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER SE", @@ -107644,6 +110603,7 @@ characters.data={ unicodeslot=0xFF7E, }, [0xFF7F]={ + adobename="sokatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER SO", @@ -107653,6 +110613,7 @@ characters.data={ unicodeslot=0xFF7F, }, [0xFF80]={ + adobename="takatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER TA", @@ -107662,6 +110623,7 @@ characters.data={ unicodeslot=0xFF80, }, [0xFF81]={ + adobename="tikatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER TI", @@ -107671,6 +110633,7 @@ characters.data={ unicodeslot=0xFF81, }, [0xFF82]={ + adobename="tukatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER TU", @@ -107680,6 +110643,7 @@ characters.data={ unicodeslot=0xFF82, }, [0xFF83]={ + adobename="tekatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER TE", @@ -107689,6 +110653,7 @@ characters.data={ unicodeslot=0xFF83, }, [0xFF84]={ + adobename="tokatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER TO", @@ -107698,6 +110663,7 @@ characters.data={ unicodeslot=0xFF84, }, [0xFF85]={ + adobename="nakatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER NA", @@ -107707,6 +110673,7 @@ characters.data={ unicodeslot=0xFF85, }, [0xFF86]={ + adobename="nikatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER NI", @@ -107716,6 +110683,7 @@ characters.data={ unicodeslot=0xFF86, }, [0xFF87]={ + adobename="nukatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER NU", @@ -107725,6 +110693,7 @@ characters.data={ unicodeslot=0xFF87, }, [0xFF88]={ + adobename="nekatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER NE", @@ -107734,6 +110703,7 @@ characters.data={ unicodeslot=0xFF88, }, [0xFF89]={ + adobename="nokatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER NO", @@ -107743,6 +110713,7 @@ characters.data={ unicodeslot=0xFF89, }, [0xFF8A]={ + adobename="hakatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER HA", @@ -107752,6 +110723,7 @@ characters.data={ unicodeslot=0xFF8A, }, [0xFF8B]={ + adobename="hikatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER HI", @@ -107761,6 +110733,7 @@ characters.data={ unicodeslot=0xFF8B, }, [0xFF8C]={ + adobename="hukatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER HU", @@ -107770,6 +110743,7 @@ characters.data={ unicodeslot=0xFF8C, }, [0xFF8D]={ + adobename="hekatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER HE", @@ -107779,6 +110753,7 @@ characters.data={ unicodeslot=0xFF8D, }, [0xFF8E]={ + adobename="hokatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER HO", @@ -107788,6 +110763,7 @@ characters.data={ unicodeslot=0xFF8E, }, [0xFF8F]={ + adobename="makatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER MA", @@ -107797,6 +110773,7 @@ characters.data={ unicodeslot=0xFF8F, }, [0xFF90]={ + adobename="mikatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER MI", @@ -107806,6 +110783,7 @@ characters.data={ unicodeslot=0xFF90, }, [0xFF91]={ + adobename="mukatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER MU", @@ -107815,6 +110793,7 @@ characters.data={ unicodeslot=0xFF91, }, [0xFF92]={ + adobename="mekatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER ME", @@ -107824,6 +110803,7 @@ characters.data={ unicodeslot=0xFF92, }, [0xFF93]={ + adobename="mokatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER MO", @@ -107833,6 +110813,7 @@ characters.data={ unicodeslot=0xFF93, }, [0xFF94]={ + adobename="yakatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER YA", @@ -107842,6 +110823,7 @@ characters.data={ unicodeslot=0xFF94, }, [0xFF95]={ + adobename="yukatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER YU", @@ -107851,6 +110833,7 @@ characters.data={ unicodeslot=0xFF95, }, [0xFF96]={ + adobename="yokatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER YO", @@ -107860,6 +110843,7 @@ characters.data={ unicodeslot=0xFF96, }, [0xFF97]={ + adobename="rakatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER RA", @@ -107869,6 +110853,7 @@ characters.data={ unicodeslot=0xFF97, }, [0xFF98]={ + adobename="rikatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER RI", @@ -107878,6 +110863,7 @@ characters.data={ unicodeslot=0xFF98, }, [0xFF99]={ + adobename="rukatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER RU", @@ -107887,6 +110873,7 @@ characters.data={ unicodeslot=0xFF99, }, [0xFF9A]={ + adobename="rekatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER RE", @@ -107896,6 +110883,7 @@ characters.data={ unicodeslot=0xFF9A, }, [0xFF9B]={ + adobename="rokatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER RO", @@ -107905,6 +110893,7 @@ characters.data={ unicodeslot=0xFF9B, }, [0xFF9C]={ + adobename="wakatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER WA", @@ -107914,6 +110903,7 @@ characters.data={ unicodeslot=0xFF9C, }, [0xFF9D]={ + adobename="nkatakanahalfwidth", category="lo", cjkwd="h", description="HALFWIDTH KATAKANA LETTER N", @@ -107923,6 +110913,7 @@ characters.data={ unicodeslot=0xFF9D, }, [0xFF9E]={ + adobename="voicedmarkkanahalfwidth", category="lm", cjkwd="h", description="HALFWIDTH KATAKANA VOICED SOUND MARK", @@ -107932,6 +110923,7 @@ characters.data={ unicodeslot=0xFF9E, }, [0xFF9F]={ + adobename="semivoicedmarkkanahalfwidth", category="lm", cjkwd="h", description="HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK", @@ -108409,6 +111401,7 @@ characters.data={ unicodeslot=0xFFDC, }, [0xFFE0]={ + adobename="centmonospace", category="sc", cjkwd="f", description="FULLWIDTH CENT SIGN", @@ -108418,6 +111411,7 @@ characters.data={ unicodeslot=0xFFE0, }, [0xFFE1]={ + adobename="sterlingmonospace", category="sc", cjkwd="f", description="FULLWIDTH POUND SIGN", @@ -108436,6 +111430,7 @@ characters.data={ unicodeslot=0xFFE2, }, [0xFFE3]={ + adobename="macronmonospace", category="sk", cjkwd="f", description="FULLWIDTH MACRON", @@ -108454,6 +111449,7 @@ characters.data={ unicodeslot=0xFFE4, }, [0xFFE5]={ + adobename="yenmonospace", category="sc", cjkwd="f", description="FULLWIDTH YEN SIGN", @@ -108463,6 +111459,7 @@ characters.data={ unicodeslot=0xFFE5, }, [0xFFE6]={ + adobename="wonmonospace", category="sc", cjkwd="f", description="FULLWIDTH WON SIGN", @@ -108538,25 +111535,25 @@ characters.data={ category="cf", description="INTERLINEAR ANNOTATION ANCHOR", direction="on", - visible="yes", linebreak="cm", unicodeslot=0xFFF9, + visible="yes", }, [0xFFFA]={ category="cf", description="INTERLINEAR ANNOTATION SEPARATOR", direction="on", - visible="yes", linebreak="cm", unicodeslot=0xFFFA, + visible="yes", }, [0xFFFB]={ category="cf", description="INTERLINEAR ANNOTATION TERMINATOR", direction="on", - visible="yes", linebreak="cm", unicodeslot=0xFFFB, + visible="yes", }, [0xFFFC]={ category="so", @@ -126218,7 +129215,6 @@ characters.data={ description="MATHEMATICAL ITALIC CAPITAL V", direction="l", linebreak="al", ---mathclass="variable", specials={ "font", 0x0056 }, unicodeslot=0x1D449, }, @@ -133610,15 +136606,6 @@ characters.data={ specials={ "font", 0x0039 }, unicodeslot=0x1D7FF, }, - [0x20000]={ - category="lo", - cjkwd="w", - description="", - direction="l", - linebreak="id", - unicodeslot=0x20000, - range=0x2A6D6, - }, [0x2F800]={ category="lo", cjkwd="w", @@ -141096,32 +144083,4 @@ characters.data={ linebreak="cm", unicodeslot=0xE01EF, }, ---~ [0xF0000]={ ---~ category="co", ---~ cjkwd="a", ---~ description="", ---~ direction="l", ---~ unicodeslot=0xF0000, ---~ }, ---~ [0xFFFFD]={ ---~ category="co", ---~ cjkwd="a", ---~ description="", ---~ direction="l", ---~ unicodeslot=0xFFFFD, ---~ }, ---~ [0x100000]={ ---~ category="co", ---~ cjkwd="a", ---~ description="", ---~ direction="l", ---~ unicodeslot=0x100000, ---~ }, ---~ [0x10FFFD]={ ---~ category="co", ---~ cjkwd="a", ---~ description="", ---~ direction="l", ---~ unicodeslot=0x10FFFD, ---~ }, } diff --git a/Master/texmf-dist/tex/context/base/char-enc.lua b/Master/texmf-dist/tex/context/base/char-enc.lua index 45f404ee985..ef6805e54f3 100644 --- a/Master/texmf-dist/tex/context/base/char-enc.lua +++ b/Master/texmf-dist/tex/context/base/char-enc.lua @@ -6,11 +6,14 @@ if not modules then modules = { } end modules ['char-syn'] = { license = "see context related readme files" } --- thanks to tex4ht for these mappings +-- Thanks to tex4ht for these mappings. -characters = characters or { } +local allocate, setinitializer = utilities.storage.allocate, utilities.storage.setinitializer -characters.synonyms = { +characters = characters or { } +local characters = characters + +characters.synonyms = allocate { -- afm mess angle = 0x2220, anticlockwise = 0x21BA, arrowaxisleft = 0x2190, @@ -141,23 +144,42 @@ characters.synonyms = { Yen = 0x00A5, } -if not characters.enccodes then +--~ if not characters.enccodes then +--~ +--~ local enccodes = { } characters.enccodes = enccodes +--~ +--~ for unicode, data in next, characters.data do +--~ local encname = data.adobename or data.contextname +--~ if encname then +--~ enccodes[encname] = unicode +--~ end +--~ end +--~ +--~ for name, unicode in next, characters.synonyms do +--~ if not enccodes[name] then enccodes[name] = unicode end +--~ end +--~ +--~ +--~ end +--~ +--~ storage.register("characters.enccodes", characters.enccodes, "characters.enccodes") + +-- As this table is seldom used, we can delay its definition. Beware, this means +-- that table.print would not work on this file unless it is accessed once. This +-- why the serializer does a dummy access. - local enccodes = { } +local enccodes = allocate() characters.enccodes = enccodes +local function initialize() for unicode, data in next, characters.data do local encname = data.adobename or data.contextname if encname then enccodes[encname] = unicode end end - for name, unicode in next, characters.synonyms do if not enccodes[name] then enccodes[name] = unicode end end - - characters.enccodes = enccodes - end -storage.register("characters.enccodes", characters.enccodes, "characters.enccodes") +setinitializer(enccodes,initialize) diff --git a/Master/texmf-dist/tex/context/base/char-ini.lua b/Master/texmf-dist/tex/context/base/char-ini.lua index 5c4a40bad51..89f8336f826 100644 --- a/Master/texmf-dist/tex/context/base/char-ini.lua +++ b/Master/texmf-dist/tex/context/base/char-ini.lua @@ -6,19 +6,32 @@ if not modules then modules = { } end modules ['char-ini'] = { license = "see context related readme files" } -tex = tex or { } -xml = xml or { } +-- todo: make two files, one for format generation, one for format use +local tex = tex local utf = unicode.utf8 local utfchar, utfbyte, utfvalues = utf.char, utf.byte, string.utfvalues -local concat = table.concat -local next, tonumber = next, tonumber +local ustring = unicode.ustring +local concat, unpack = table.concat, table.unpack +local next, tonumber, type, rawget, rawset = next, tonumber, type, rawget, rawset local texsprint, texprint = tex.sprint, tex.print local format, lower, gsub, match, gmatch = string.format, string.lower, string.gsub, string.match, string.match, string.gmatch +local P, R, lpegmatch = lpeg.P, lpeg.R, lpeg.match -local ctxcatcodes = tex.ctxcatcodes -local texcatcodes = tex.texcatcodes +local allocate = utilities.storage.allocate +local mark = utilities.storage.mark +local texsetlccode = tex.setlccode +local texsetuccode = tex.setuccode +local texsetsfcode = tex.setsfcode +local texsetcatcode = tex.setcatcode +local ctxcatcodes = tex.ctxcatcodes +local texcatcodes = tex.texcatcodes +local setmetatableindex = table.setmetatableindex + +local trace_defining = false trackers.register("characters.defining", function(v) characters_defining = v end) + +local report_defining = logs.reporter("characters") --[[ldx--

This module implements some methods and creates additional datastructured @@ -29,215 +42,279 @@ from the big character table that we use for all kind of purposes: loaded!

--ldx]]-- -characters = characters or { } -characters.data = characters.data or { } +characters = characters or { } +local characters = characters -local data = characters.data +local data = characters.data -if not characters.ranges then - characters.ranges = { } - for k, v in next, data do - characters.ranges[#characters.ranges+1] = k +if data then + mark(data) -- why does this fail +else + report_defining("fatal error: 'char-def.lua' is not loaded") + os.exit() +end + +--[[ldx-- +

This converts a string (if given) into a number.

+--ldx]]-- + +local pattern = (P("0x") + P("U+")) * ((R("09","AF")^1 * P(-1)) / function(s) return tonumber(s,16) end) + +lpeg.patterns.chartonumber = pattern + +local function chartonumber(k) + if type(k) == "string" then + local u = lpegmatch(pattern,k) + if u then + return utfbyte(u) + else + return utfbyte(k) or 0 + end + else + return k or 0 end end -storage.register("characters/ranges",characters.ranges,"characters.ranges") +local function charfromnumber(k) + if type(k) == "number" then + return utfchar(k) or "" + else + local u = lpegmatch(pattern,k) + if u then + return utfchar(u) + else + return k + end + end +end -local ranges = characters.ranges +--~ print(chartonumber(97), chartonumber("a"), chartonumber("0x61"), chartonumber("U+61")) -setmetatable(data, { - __index = function(t,k) +characters.tonumber = chartonumber +characters.fromnumber = charfromnumber + +local private = { + description = "PRIVATE SLOT", +} + +local ranges = allocate() +characters.ranges = ranges + +setmetatableindex(data, function(t,k) + local tk = type(k) + if tk == "string" then + k = lpegmatch(pattern,k) or utfbyte(k) + if k then + local tk = rawget(t,k) + if tk then + return tk + else + -- goes to ranges + end + else + return private + end + end + if tk == "number" and k < 0xF0000 then for r=1,#ranges do - local rr = ranges[r] -- first in range - if k > rr and k <= data[rr].range then - t[k] = t[rr] - return t[k] + local rr = ranges[r] + if k >= rr.first and k <= rr.last then + local extender = rr.extender + if extender then + v = extender(k,v) + end + t[k] = v + return v end end - return nil end -}) - -characters.blocks = { - ["aegeannumbers"] = { 0x10100, 0x1013F, "Aegean Numbers" }, - ["alphabeticpresentationforms"] = { 0x0FB00, 0x0FB4F, "Alphabetic Presentation Forms" }, - ["ancientgreekmusicalnotation"] = { 0x1D200, 0x1D24F, "Ancient Greek Musical Notation" }, - ["ancientgreeknumbers"] = { 0x10140, 0x1018F, "Ancient Greek Numbers" }, - ["ancientsymbols"] = { 0x10190, 0x101CF, "Ancient Symbols" }, - ["arabic"] = { 0x00600, 0x006FF, "Arabic" }, - ["arabicpresentationformsa"] = { 0x0FB50, 0x0FDFF, "Arabic Presentation Forms-A" }, - ["arabicpresentationformsb"] = { 0x0FE70, 0x0FEFF, "Arabic Presentation Forms-B" }, - ["arabicsupplement"] = { 0x00750, 0x0077F, "Arabic Supplement" }, - ["armenian"] = { 0x00530, 0x0058F, "Armenian" }, - ["arrows"] = { 0x02190, 0x021FF, "Arrows" }, - ["balinese"] = { 0x01B00, 0x01B7F, "Balinese" }, - ["basiclatin"] = { 0x00000, 0x0007F, "Basic Latin" }, - ["bengali"] = { 0x00980, 0x009FF, "Bengali" }, - ["blockelements"] = { 0x02580, 0x0259F, "Block Elements" }, - ["bopomofo"] = { 0x03100, 0x0312F, "Bopomofo" }, - ["bopomofoextended"] = { 0x031A0, 0x031BF, "Bopomofo Extended" }, - ["boxdrawing"] = { 0x02500, 0x0257F, "Box Drawing" }, - ["braillepatterns"] = { 0x02800, 0x028FF, "Braille Patterns" }, - ["buginese"] = { 0x01A00, 0x01A1F, "Buginese" }, - ["buhid"] = { 0x01740, 0x0175F, "Buhid" }, - ["byzantinemusicalsymbols"] = { 0x1D000, 0x1D0FF, "Byzantine Musical Symbols" }, - ["carian"] = { 0x102A0, 0x102DF, "Carian" }, - ["cham"] = { 0x0AA00, 0x0AA5F, "Cham" }, - ["cherokee"] = { 0x013A0, 0x013FF, "Cherokee" }, - ["cjkcompatibility"] = { 0x03300, 0x033FF, "CJK Compatibility" }, - ["cjkcompatibilityforms"] = { 0x0FE30, 0x0FE4F, "CJK Compatibility Forms" }, - ["cjkcompatibilityideographs"] = { 0x0F900, 0x0FAFF, "CJK Compatibility Ideographs" }, - ["cjkcompatibilityideographssupplement"] = { 0x2F800, 0x2FA1F, "CJK Compatibility Ideographs Supplement" }, - ["cjkradicalssupplement"] = { 0x02E80, 0x02EFF, "CJK Radicals Supplement" }, - ["cjkstrokes"] = { 0x031C0, 0x031EF, "CJK Strokes" }, - ["cjksymbolsandpunctuation"] = { 0x03000, 0x0303F, "CJK Symbols and Punctuation" }, - ["cjkunifiedideographs"] = { 0x04E00, 0x09FFF, "CJK Unified Ideographs" }, - ["cjkunifiedideographsextensiona"] = { 0x03400, 0x04DBF, "CJK Unified Ideographs Extension A" }, - ["cjkunifiedideographsextensionb"] = { 0x20000, 0x2A6DF, "CJK Unified Ideographs Extension B" }, - ["combiningdiacriticalmarks"] = { 0x00300, 0x0036F, "Combining Diacritical Marks" }, - ["combiningdiacriticalmarksforsymbols"] = { 0x020D0, 0x020FF, "Combining Diacritical Marks for Symbols" }, - ["combiningdiacriticalmarkssupplement"] = { 0x01DC0, 0x01DFF, "Combining Diacritical Marks Supplement" }, - ["combininghalfmarks"] = { 0x0FE20, 0x0FE2F, "Combining Half Marks" }, - ["controlpictures"] = { 0x02400, 0x0243F, "Control Pictures" }, - ["coptic"] = { 0x02C80, 0x02CFF, "Coptic" }, - ["countingrodnumerals"] = { 0x1D360, 0x1D37F, "Counting Rod Numerals" }, - ["cuneiform"] = { 0x12000, 0x123FF, "Cuneiform" }, - ["cuneiformnumbersandpunctuation"] = { 0x12400, 0x1247F, "Cuneiform Numbers and Punctuation" }, - ["currencysymbols"] = { 0x020A0, 0x020CF, "Currency Symbols" }, - ["cypriotsyllabary"] = { 0x10800, 0x1083F, "Cypriot Syllabary" }, - ["cyrillic"] = { 0x00400, 0x004FF, "Cyrillic" }, - ["cyrillicextendeda"] = { 0x02DE0, 0x02DFF, "Cyrillic Extended-A" }, - ["cyrillicextendedb"] = { 0x0A640, 0x0A69F, "Cyrillic Extended-B" }, - ["cyrillicsupplement"] = { 0x00500, 0x0052F, "Cyrillic Supplement" }, - ["deseret"] = { 0x10400, 0x1044F, "Deseret" }, - ["devanagari"] = { 0x00900, 0x0097F, "Devanagari" }, - ["dingbats"] = { 0x02700, 0x027BF, "Dingbats" }, - ["dominotiles"] = { 0x1F030, 0x1F09F, "Domino Tiles" }, - ["enclosedalphanumerics"] = { 0x02460, 0x024FF, "Enclosed Alphanumerics" }, - ["enclosedcjklettersandmonths"] = { 0x03200, 0x032FF, "Enclosed CJK Letters and Months" }, - ["ethiopic"] = { 0x01200, 0x0137F, "Ethiopic" }, - ["ethiopicextended"] = { 0x02D80, 0x02DDF, "Ethiopic Extended" }, - ["ethiopicsupplement"] = { 0x01380, 0x0139F, "Ethiopic Supplement" }, - ["generalpunctuation"] = { 0x02000, 0x0206F, "General Punctuation" }, - ["geometricshapes"] = { 0x025A0, 0x025FF, "Geometric Shapes" }, - ["georgian"] = { 0x010A0, 0x010FF, "Georgian" }, - ["georgiansupplement"] = { 0x02D00, 0x02D2F, "Georgian Supplement" }, - ["glagolitic"] = { 0x02C00, 0x02C5F, "Glagolitic" }, - ["gothic"] = { 0x10330, 0x1034F, "Gothic" }, - ["greekandcoptic"] = { 0x00370, 0x003FF, "Greek and Coptic" }, - ["greekextended"] = { 0x01F00, 0x01FFF, "Greek Extended" }, - ["gujarati"] = { 0x00A80, 0x00AFF, "Gujarati" }, - ["gurmukhi"] = { 0x00A00, 0x00A7F, "Gurmukhi" }, - ["halfwidthandfullwidthforms"] = { 0x0FF00, 0x0FFEF, "Halfwidth and Fullwidth Forms" }, - ["hangulcompatibilityjamo"] = { 0x03130, 0x0318F, "Hangul Compatibility Jamo" }, - ["hanguljamo"] = { 0x01100, 0x011FF, "Hangul Jamo" }, - ["hangulsyllables"] = { 0x0AC00, 0x0D7AF, "Hangul Syllables" }, - ["hanunoo"] = { 0x01720, 0x0173F, "Hanunoo" }, - ["hebrew"] = { 0x00590, 0x005FF, "Hebrew" }, - ["highprivateusesurrogates"] = { 0x0DB80, 0x0DBFF, "High Private Use Surrogates" }, - ["highsurrogates"] = { 0x0D800, 0x0DB7F, "High Surrogates" }, - ["hiragana"] = { 0x03040, 0x0309F, "Hiragana" }, - ["ideographicdescriptioncharacters"] = { 0x02FF0, 0x02FFF, "Ideographic Description Characters" }, - ["ipaextensions"] = { 0x00250, 0x02AF, "IPA Extensions" }, - ["kanbun"] = { 0x03190, 0x0319F, "Kanbun" }, - ["kangxiradicals"] = { 0x02F00, 0x02FDF, "Kangxi Radicals" }, - ["kannada"] = { 0x00C80, 0x00CFF, "Kannada" }, - ["katakana"] = { 0x030A0, 0x030FF, "Katakana" }, - ["katakanaphoneticextensions"] = { 0x031F0, 0x031FF, "Katakana Phonetic Extensions" }, - ["kayahli"] = { 0x0A900, 0x0A92F, "Kayah Li" }, - ["kharoshthi"] = { 0x10A00, 0x10A5F, "Kharoshthi" }, - ["khmer"] = { 0x01780, 0x017FF, "Khmer" }, - ["khmersymbols"] = { 0x019E0, 0x019FF, "Khmer Symbols" }, - ["lao"] = { 0x00E80, 0x00EFF, "Lao" }, - ["latinextendeda"] = { 0x00100, 0x0017F, "Latin Extended-A" }, - ["latinextendedadditional"] = { 0x01E00, 0x01EFF, "Latin Extended Additional" }, - ["latinextendedb"] = { 0x00180, 0x0024F, "Latin Extended-B" }, - ["latinextendedc"] = { 0x02C60, 0x02C7F, "Latin Extended-C" }, - ["latinextendedd"] = { 0x0A720, 0x0A7FF, "Latin Extended-D" }, - ["latinsupplement"] = { 0x00080, 0x000FF, "Latin-1 Supplement" }, - ["lepcha"] = { 0x01C00, 0x01C4F, "Lepcha" }, - ["letterlikesymbols"] = { 0x02100, 0x0214F, "Letterlike Symbols" }, - ["limbu"] = { 0x01900, 0x0194F, "Limbu" }, - ["linearbideograms"] = { 0x10080, 0x100FF, "Linear B Ideograms" }, - ["linearbsyllabary"] = { 0x10000, 0x1007F, "Linear B Syllabary" }, - ["lowsurrogates"] = { 0x0DC00, 0x0DFFF, "Low Surrogates" }, - ["lycian"] = { 0x10280, 0x1029F, "Lycian" }, - ["lydian"] = { 0x10920, 0x1093F, "Lydian" }, - ["mahjongtiles"] = { 0x1F000, 0x1F02F, "Mahjong Tiles" }, - ["malayalam"] = { 0x00D00, 0x00D7F, "Malayalam" }, - ["mathematicalalphanumericsymbols"] = { 0x1D400, 0x1D7FF, "Mathematical Alphanumeric Symbols" }, - ["mathematicaloperators"] = { 0x02200, 0x022FF, "Mathematical Operators" }, - ["miscellaneousmathematicalsymbolsa"] = { 0x027C0, 0x027EF, "Miscellaneous Mathematical Symbols-A" }, - ["miscellaneousmathematicalsymbolsb"] = { 0x02980, 0x029FF, "Miscellaneous Mathematical Symbols-B" }, - ["miscellaneoussymbols"] = { 0x02600, 0x026FF, "Miscellaneous Symbols" }, - ["miscellaneoussymbolsandarrows"] = { 0x02B00, 0x02BFF, "Miscellaneous Symbols and Arrows" }, - ["miscellaneoustechnical"] = { 0x02300, 0x023FF, "Miscellaneous Technical" }, - ["modifiertoneletters"] = { 0x0A700, 0x0A71F, "Modifier Tone Letters" }, - ["mongolian"] = { 0x01800, 0x018AF, "Mongolian" }, - ["musicalsymbols"] = { 0x1D100, 0x1D1FF, "Musical Symbols" }, - ["myanmar"] = { 0x01000, 0x0109F, "Myanmar" }, - ["newtailue"] = { 0x01980, 0x019DF, "New Tai Lue" }, - ["nko"] = { 0x007C0, 0x007FF, "NKo" }, - ["numberforms"] = { 0x02150, 0x0218F, "Number Forms" }, - ["ogham"] = { 0x01680, 0x0169F, "Ogham" }, - ["olchiki"] = { 0x01C50, 0x01C7F, "Ol Chiki" }, - ["olditalic"] = { 0x10300, 0x1032F, "Old Italic" }, - ["oldpersian"] = { 0x103A0, 0x103DF, "Old Persian" }, - ["opticalcharacterrecognition"] = { 0x02440, 0x0245F, "Optical Character Recognition" }, - ["oriya"] = { 0x00B00, 0x00B7F, "Oriya" }, - ["osmanya"] = { 0x10480, 0x104AF, "Osmanya" }, - ["phagspa"] = { 0x0A840, 0x0A87F, "Phags-pa" }, - ["phaistosdisc"] = { 0x101D0, 0x101FF, "Phaistos Disc" }, - ["phoenician"] = { 0x10900, 0x1091F, "Phoenician" }, - ["phoneticextensions"] = { 0x01D00, 0x01D7F, "Phonetic Extensions" }, - ["phoneticextensionssupplement"] = { 0x01D80, 0x01DBF, "Phonetic Extensions Supplement" }, - ["privateusearea"] = { 0x0E000, 0x0F8FF, "Private Use Area" }, - ["rejang"] = { 0x0A930, 0x0A95F, "Rejang" }, - ["runic"] = { 0x016A0, 0x016FF, "Runic" }, - ["saurashtra"] = { 0x0A880, 0x0A8DF, "Saurashtra" }, - ["shavian"] = { 0x10450, 0x1047F, "Shavian" }, - ["sinhala"] = { 0x00D80, 0x00DFF, "Sinhala" }, - ["smallformvariants"] = { 0x0FE50, 0x0FE6F, "Small Form Variants" }, - ["spacingmodifierletters"] = { 0x002B0, 0x002FF, "Spacing Modifier Letters" }, - ["specials"] = { 0x0FFF0, 0x0FFFF, "Specials" }, - ["sundanese"] = { 0x01B80, 0x01BBF, "Sundanese" }, - ["superscriptsandsubscripts"] = { 0x02070, 0x0209F, "Superscripts and Subscripts" }, - ["supplementalarrowsa"] = { 0x027F0, 0x027FF, "Supplemental Arrows-A" }, - ["supplementalarrowsb"] = { 0x02900, 0x0297F, "Supplemental Arrows-B" }, - ["supplementalmathematicaloperators"] = { 0x02A00, 0x02AFF, "Supplemental Mathematical Operators" }, - ["supplementalpunctuation"] = { 0x02E00, 0x02E7F, "Supplemental Punctuation" }, - ["supplementaryprivateuseareaa"] = { 0xF0000, 0xFFFFF, "Supplementary Private Use Area-A" }, - ["supplementaryprivateuseareab"] = { 0x100000,0x10FFFF,"Supplementary Private Use Area-B" }, - ["sylotinagri"] = { 0x0A800, 0x0A82F, "Syloti Nagri" }, - ["syriac"] = { 0x00700, 0x0074F, "Syriac" }, - ["tagalog"] = { 0x01700, 0x0171F, "Tagalog" }, - ["tagbanwa"] = { 0x01760, 0x0177F, "Tagbanwa" }, - ["tags"] = { 0xE0000, 0xE007F, "Tags" }, - ["taile"] = { 0x01950, 0x0197F, "Tai Le" }, - ["taixuanjingsymbols"] = { 0x1D300, 0x1D35F, "Tai Xuan Jing Symbols" }, - ["tamil"] = { 0x00B80, 0x00BFF, "Tamil" }, - ["telugu"] = { 0x00C00, 0x00C7F, "Telugu" }, - ["thaana"] = { 0x00780, 0x007BF, "Thaana" }, - ["thai"] = { 0x00E00, 0x00E7F, "Thai" }, - ["tibetan"] = { 0x00F00, 0x00FFF, "Tibetan" }, - ["tifinagh"] = { 0x02D30, 0x02D7F, "Tifinagh" }, - ["ugaritic"] = { 0x10380, 0x1039F, "Ugaritic" }, - ["unifiedcanadianaboriginalsyllabics"] = { 0x01400, 0x0167F, "Unified Canadian Aboriginal Syllabics" }, - ["vai"] = { 0x0A500, 0x0A63F, "Vai" }, - ["variationselectors"] = { 0x0FE00, 0x0FE0F, "Variation Selectors" }, - ["variationselectorssupplement"] = { 0xE0100, 0xE01EF, "Variation Selectors Supplement" }, - ["verticalforms"] = { 0x0FE10, 0x0FE1F, "Vertical Forms" }, - ["yijinghexagramsymbols"] = { 0x04DC0, 0x04DFF, "Yijing Hexagram Symbols" }, - ["yiradicals"] = { 0x0A490, 0x0A4CF, "Yi Radicals" }, - ["yisyllables"] = { 0x0A000, 0x0A48F, "Yi Syllables" }, + return private -- handy for when we loop over characters in fonts and check for a property +end) + +local blocks = allocate { + ["aegeannumbers"] = { first = 0x10100, last = 0x1013F, description = "Aegean Numbers" }, + ["alphabeticpresentationforms"] = { first = 0x0FB00, last = 0x0FB4F, description = "Alphabetic Presentation Forms" }, + ["ancientgreekmusicalnotation"] = { first = 0x1D200, last = 0x1D24F, description = "Ancient Greek Musical Notation" }, + ["ancientgreeknumbers"] = { first = 0x10140, last = 0x1018F, description = "Ancient Greek Numbers" }, + ["ancientsymbols"] = { first = 0x10190, last = 0x101CF, description = "Ancient Symbols" }, + ["arabic"] = { first = 0x00600, last = 0x006FF, description = "Arabic" }, + ["arabicpresentationformsa"] = { first = 0x0FB50, last = 0x0FDFF, description = "Arabic Presentation Forms-A" }, + ["arabicpresentationformsb"] = { first = 0x0FE70, last = 0x0FEFF, description = "Arabic Presentation Forms-B" }, + ["arabicsupplement"] = { first = 0x00750, last = 0x0077F, description = "Arabic Supplement" }, + ["armenian"] = { first = 0x00530, last = 0x0058F, description = "Armenian" }, + ["arrows"] = { first = 0x02190, last = 0x021FF, description = "Arrows" }, + ["balinese"] = { first = 0x01B00, last = 0x01B7F, description = "Balinese" }, + ["basiclatin"] = { first = 0x00000, last = 0x0007F, description = "Basic Latin" }, + ["bengali"] = { first = 0x00980, last = 0x009FF, description = "Bengali" }, + ["blockelements"] = { first = 0x02580, last = 0x0259F, description = "Block Elements" }, + ["bopomofo"] = { first = 0x03100, last = 0x0312F, description = "Bopomofo" }, + ["bopomofoextended"] = { first = 0x031A0, last = 0x031BF, description = "Bopomofo Extended" }, + ["boxdrawing"] = { first = 0x02500, last = 0x0257F, description = "Box Drawing" }, + ["braillepatterns"] = { first = 0x02800, last = 0x028FF, description = "Braille Patterns" }, + ["buginese"] = { first = 0x01A00, last = 0x01A1F, description = "Buginese" }, + ["buhid"] = { first = 0x01740, last = 0x0175F, description = "Buhid" }, + ["byzantinemusicalsymbols"] = { first = 0x1D000, last = 0x1D0FF, description = "Byzantine Musical Symbols" }, + ["carian"] = { first = 0x102A0, last = 0x102DF, description = "Carian" }, + ["cham"] = { first = 0x0AA00, last = 0x0AA5F, description = "Cham" }, + ["cherokee"] = { first = 0x013A0, last = 0x013FF, description = "Cherokee" }, + ["cjkcompatibility"] = { first = 0x03300, last = 0x033FF, description = "CJK Compatibility" }, + ["cjkcompatibilityforms"] = { first = 0x0FE30, last = 0x0FE4F, description = "CJK Compatibility Forms" }, + ["cjkcompatibilityideographs"] = { first = 0x0F900, last = 0x0FAFF, description = "CJK Compatibility Ideographs" }, + ["cjkcompatibilityideographssupplement"] = { first = 0x2F800, last = 0x2FA1F, description = "CJK Compatibility Ideographs Supplement" }, + ["cjkradicalssupplement"] = { first = 0x02E80, last = 0x02EFF, description = "CJK Radicals Supplement" }, + ["cjkstrokes"] = { first = 0x031C0, last = 0x031EF, description = "CJK Strokes" }, + ["cjksymbolsandpunctuation"] = { first = 0x03000, last = 0x0303F, description = "CJK Symbols and Punctuation" }, + ["cjkunifiedideographs"] = { first = 0x04E00, last = 0x09FFF, description = "CJK Unified Ideographs" }, + ["cjkunifiedideographsextensiona"] = { first = 0x03400, last = 0x04DBF, description = "CJK Unified Ideographs Extension A" }, + ["cjkunifiedideographsextensionb"] = { first = 0x20000, last = 0x2A6DF, description = "CJK Unified Ideographs Extension B" }, + ["combiningdiacriticalmarks"] = { first = 0x00300, last = 0x0036F, description = "Combining Diacritical Marks" }, + ["combiningdiacriticalmarksforsymbols"] = { first = 0x020D0, last = 0x020FF, description = "Combining Diacritical Marks for Symbols" }, + ["combiningdiacriticalmarkssupplement"] = { first = 0x01DC0, last = 0x01DFF, description = "Combining Diacritical Marks Supplement" }, + ["combininghalfmarks"] = { first = 0x0FE20, last = 0x0FE2F, description = "Combining Half Marks" }, + ["controlpictures"] = { first = 0x02400, last = 0x0243F, description = "Control Pictures" }, + ["coptic"] = { first = 0x02C80, last = 0x02CFF, description = "Coptic" }, + ["countingrodnumerals"] = { first = 0x1D360, last = 0x1D37F, description = "Counting Rod Numerals" }, + ["cuneiform"] = { first = 0x12000, last = 0x123FF, description = "Cuneiform" }, + ["cuneiformnumbersandpunctuation"] = { first = 0x12400, last = 0x1247F, description = "Cuneiform Numbers and Punctuation" }, + ["currencysymbols"] = { first = 0x020A0, last = 0x020CF, description = "Currency Symbols" }, + ["cypriotsyllabary"] = { first = 0x10800, last = 0x1083F, description = "Cypriot Syllabary" }, + ["cyrillic"] = { first = 0x00400, last = 0x004FF, description = "Cyrillic" }, + ["cyrillicextendeda"] = { first = 0x02DE0, last = 0x02DFF, description = "Cyrillic Extended-A" }, + ["cyrillicextendedb"] = { first = 0x0A640, last = 0x0A69F, description = "Cyrillic Extended-B" }, + ["cyrillicsupplement"] = { first = 0x00500, last = 0x0052F, description = "Cyrillic Supplement" }, + ["deseret"] = { first = 0x10400, last = 0x1044F, description = "Deseret" }, + ["devanagari"] = { first = 0x00900, last = 0x0097F, description = "Devanagari" }, + ["dingbats"] = { first = 0x02700, last = 0x027BF, description = "Dingbats" }, + ["dominotiles"] = { first = 0x1F030, last = 0x1F09F, description = "Domino Tiles" }, + ["enclosedalphanumerics"] = { first = 0x02460, last = 0x024FF, description = "Enclosed Alphanumerics" }, + ["enclosedcjklettersandmonths"] = { first = 0x03200, last = 0x032FF, description = "Enclosed CJK Letters and Months" }, + ["ethiopic"] = { first = 0x01200, last = 0x0137F, description = "Ethiopic" }, + ["ethiopicextended"] = { first = 0x02D80, last = 0x02DDF, description = "Ethiopic Extended" }, + ["ethiopicsupplement"] = { first = 0x01380, last = 0x0139F, description = "Ethiopic Supplement" }, + ["generalpunctuation"] = { first = 0x02000, last = 0x0206F, description = "General Punctuation" }, + ["geometricshapes"] = { first = 0x025A0, last = 0x025FF, description = "Geometric Shapes" }, + ["georgian"] = { first = 0x010A0, last = 0x010FF, description = "Georgian" }, + ["georgiansupplement"] = { first = 0x02D00, last = 0x02D2F, description = "Georgian Supplement" }, + ["glagolitic"] = { first = 0x02C00, last = 0x02C5F, description = "Glagolitic" }, + ["gothic"] = { first = 0x10330, last = 0x1034F, description = "Gothic" }, + ["greekandcoptic"] = { first = 0x00370, last = 0x003FF, description = "Greek and Coptic" }, + ["greekextended"] = { first = 0x01F00, last = 0x01FFF, description = "Greek Extended" }, + ["gujarati"] = { first = 0x00A80, last = 0x00AFF, description = "Gujarati" }, + ["gurmukhi"] = { first = 0x00A00, last = 0x00A7F, description = "Gurmukhi" }, + ["halfwidthandfullwidthforms"] = { first = 0x0FF00, last = 0x0FFEF, description = "Halfwidth and Fullwidth Forms" }, + ["hangulcompatibilityjamo"] = { first = 0x03130, last = 0x0318F, description = "Hangul Compatibility Jamo" }, + ["hanguljamo"] = { first = 0x01100, last = 0x011FF, description = "Hangul Jamo" }, + ["hangulsyllables"] = { first = 0x0AC00, last = 0x0D7AF, description = "Hangul Syllables" }, + ["hanunoo"] = { first = 0x01720, last = 0x0173F, description = "Hanunoo" }, + ["hebrew"] = { first = 0x00590, last = 0x005FF, description = "Hebrew" }, + ["highprivateusesurrogates"] = { first = 0x0DB80, last = 0x0DBFF, description = "High Private Use Surrogates" }, + ["highsurrogates"] = { first = 0x0D800, last = 0x0DB7F, description = "High Surrogates" }, + ["hiragana"] = { first = 0x03040, last = 0x0309F, description = "Hiragana" }, + ["ideographicdescriptioncharacters"] = { first = 0x02FF0, last = 0x02FFF, description = "Ideographic Description Characters" }, + ["ipaextensions"] = { first = 0x00250, last = 0x002AF, description = "IPA Extensions" }, + ["kanbun"] = { first = 0x03190, last = 0x0319F, description = "Kanbun" }, + ["kangxiradicals"] = { first = 0x02F00, last = 0x02FDF, description = "Kangxi Radicals" }, + ["kannada"] = { first = 0x00C80, last = 0x00CFF, description = "Kannada" }, + ["katakana"] = { first = 0x030A0, last = 0x030FF, description = "Katakana" }, + ["katakanaphoneticextensions"] = { first = 0x031F0, last = 0x031FF, description = "Katakana Phonetic Extensions" }, + ["kayahli"] = { first = 0x0A900, last = 0x0A92F, description = "Kayah Li" }, + ["kharoshthi"] = { first = 0x10A00, last = 0x10A5F, description = "Kharoshthi" }, + ["khmer"] = { first = 0x01780, last = 0x017FF, description = "Khmer" }, + ["khmersymbols"] = { first = 0x019E0, last = 0x019FF, description = "Khmer Symbols" }, + ["lao"] = { first = 0x00E80, last = 0x00EFF, description = "Lao" }, + ["latinextendeda"] = { first = 0x00100, last = 0x0017F, description = "Latin Extended-A" }, + ["latinextendedadditional"] = { first = 0x01E00, last = 0x01EFF, description = "Latin Extended Additional" }, + ["latinextendedb"] = { first = 0x00180, last = 0x0024F, description = "Latin Extended-B" }, + ["latinextendedc"] = { first = 0x02C60, last = 0x02C7F, description = "Latin Extended-C" }, + ["latinextendedd"] = { first = 0x0A720, last = 0x0A7FF, description = "Latin Extended-D" }, + ["latinsupplement"] = { first = 0x00080, last = 0x000FF, description = "Latin-1 Supplement" }, + ["lepcha"] = { first = 0x01C00, last = 0x01C4F, description = "Lepcha" }, + ["letterlikesymbols"] = { first = 0x02100, last = 0x0214F, description = "Letterlike Symbols" }, + ["limbu"] = { first = 0x01900, last = 0x0194F, description = "Limbu" }, + ["linearbideograms"] = { first = 0x10080, last = 0x100FF, description = "Linear B Ideograms" }, + ["linearbsyllabary"] = { first = 0x10000, last = 0x1007F, description = "Linear B Syllabary" }, + ["lowsurrogates"] = { first = 0x0DC00, last = 0x0DFFF, description = "Low Surrogates" }, + ["lycian"] = { first = 0x10280, last = 0x1029F, description = "Lycian" }, + ["lydian"] = { first = 0x10920, last = 0x1093F, description = "Lydian" }, + ["mahjongtiles"] = { first = 0x1F000, last = 0x1F02F, description = "Mahjong Tiles" }, + ["malayalam"] = { first = 0x00D00, last = 0x00D7F, description = "Malayalam" }, + ["mathematicalalphanumericsymbols"] = { first = 0x1D400, last = 0x1D7FF, description = "Mathematical Alphanumeric Symbols" }, + ["mathematicaloperators"] = { first = 0x02200, last = 0x022FF, description = "Mathematical Operators" }, + ["miscellaneousmathematicalsymbolsa"] = { first = 0x027C0, last = 0x027EF, description = "Miscellaneous Mathematical Symbols-A" }, + ["miscellaneousmathematicalsymbolsb"] = { first = 0x02980, last = 0x029FF, description = "Miscellaneous Mathematical Symbols-B" }, + ["miscellaneoussymbols"] = { first = 0x02600, last = 0x026FF, description = "Miscellaneous Symbols" }, + ["miscellaneoussymbolsandarrows"] = { first = 0x02B00, last = 0x02BFF, description = "Miscellaneous Symbols and Arrows" }, + ["miscellaneoustechnical"] = { first = 0x02300, last = 0x023FF, description = "Miscellaneous Technical" }, + ["modifiertoneletters"] = { first = 0x0A700, last = 0x0A71F, description = "Modifier Tone Letters" }, + ["mongolian"] = { first = 0x01800, last = 0x018AF, description = "Mongolian" }, + ["musicalsymbols"] = { first = 0x1D100, last = 0x1D1FF, description = "Musical Symbols" }, + ["myanmar"] = { first = 0x01000, last = 0x0109F, description = "Myanmar" }, + ["newtailue"] = { first = 0x01980, last = 0x019DF, description = "New Tai Lue" }, + ["nko"] = { first = 0x007C0, last = 0x007FF, description = "NKo" }, + ["numberforms"] = { first = 0x02150, last = 0x0218F, description = "Number Forms" }, + ["ogham"] = { first = 0x01680, last = 0x0169F, description = "Ogham" }, + ["olchiki"] = { first = 0x01C50, last = 0x01C7F, description = "Ol Chiki" }, + ["olditalic"] = { first = 0x10300, last = 0x1032F, description = "Old Italic" }, + ["oldpersian"] = { first = 0x103A0, last = 0x103DF, description = "Old Persian" }, + ["opticalcharacterrecognition"] = { first = 0x02440, last = 0x0245F, description = "Optical Character Recognition" }, + ["oriya"] = { first = 0x00B00, last = 0x00B7F, description = "Oriya" }, + ["osmanya"] = { first = 0x10480, last = 0x104AF, description = "Osmanya" }, + ["phagspa"] = { first = 0x0A840, last = 0x0A87F, description = "Phags-pa" }, + ["phaistosdisc"] = { first = 0x101D0, last = 0x101FF, description = "Phaistos Disc" }, + ["phoenician"] = { first = 0x10900, last = 0x1091F, description = "Phoenician" }, + ["phoneticextensions"] = { first = 0x01D00, last = 0x01D7F, description = "Phonetic Extensions" }, + ["phoneticextensionssupplement"] = { first = 0x01D80, last = 0x01DBF, description = "Phonetic Extensions Supplement" }, + ["privateusearea"] = { first = 0x0E000, last = 0x0F8FF, description = "Private Use Area" }, + ["rejang"] = { first = 0x0A930, last = 0x0A95F, description = "Rejang" }, + ["runic"] = { first = 0x016A0, last = 0x016FF, description = "Runic" }, + ["saurashtra"] = { first = 0x0A880, last = 0x0A8DF, description = "Saurashtra" }, + ["shavian"] = { first = 0x10450, last = 0x1047F, description = "Shavian" }, + ["sinhala"] = { first = 0x00D80, last = 0x00DFF, description = "Sinhala" }, + ["smallformvariants"] = { first = 0x0FE50, last = 0x0FE6F, description = "Small Form Variants" }, + ["spacingmodifierletters"] = { first = 0x002B0, last = 0x002FF, description = "Spacing Modifier Letters" }, + ["specials"] = { first = 0x0FFF0, last = 0x0FFFF, description = "Specials" }, + ["sundanese"] = { first = 0x01B80, last = 0x01BBF, description = "Sundanese" }, + ["superscriptsandsubscripts"] = { first = 0x02070, last = 0x0209F, description = "Superscripts and Subscripts" }, + ["supplementalarrowsa"] = { first = 0x027F0, last = 0x027FF, description = "Supplemental Arrows-A" }, + ["supplementalarrowsb"] = { first = 0x02900, last = 0x0297F, description = "Supplemental Arrows-B" }, + ["supplementalmathematicaloperators"] = { first = 0x02A00, last = 0x02AFF, description = "Supplemental Mathematical Operators" }, + ["supplementalpunctuation"] = { first = 0x02E00, last = 0x02E7F, description = "Supplemental Punctuation" }, + ["supplementaryprivateuseareaa"] = { first = 0xF0000, last = 0xFFFFF, description = "Supplementary Private Use Area-A" }, + ["supplementaryprivateuseareab"] = { first = 0x100000,last = 0x10FFFF,description = "Supplementary Private Use Area-B" }, + ["sylotinagri"] = { first = 0x0A800, last = 0x0A82F, description = "Syloti Nagri" }, + ["syriac"] = { first = 0x00700, last = 0x0074F, description = "Syriac" }, + ["tagalog"] = { first = 0x01700, last = 0x0171F, description = "Tagalog" }, + ["tagbanwa"] = { first = 0x01760, last = 0x0177F, description = "Tagbanwa" }, + ["tags"] = { first = 0xE0000, last = 0xE007F, description = "Tags" }, + ["taile"] = { first = 0x01950, last = 0x0197F, description = "Tai Le" }, + ["taixuanjingsymbols"] = { first = 0x1D300, last = 0x1D35F, description = "Tai Xuan Jing Symbols" }, + ["tamil"] = { first = 0x00B80, last = 0x00BFF, description = "Tamil" }, + ["telugu"] = { first = 0x00C00, last = 0x00C7F, description = "Telugu" }, + ["thaana"] = { first = 0x00780, last = 0x007BF, description = "Thaana" }, + ["thai"] = { first = 0x00E00, last = 0x00E7F, description = "Thai" }, + ["tibetan"] = { first = 0x00F00, last = 0x00FFF, description = "Tibetan" }, + ["tifinagh"] = { first = 0x02D30, last = 0x02D7F, description = "Tifinagh" }, + ["ugaritic"] = { first = 0x10380, last = 0x1039F, description = "Ugaritic" }, + ["unifiedcanadianaboriginalsyllabics"] = { first = 0x01400, last = 0x0167F, description = "Unified Canadian Aboriginal Syllabics" }, + ["vai"] = { first = 0x0A500, last = 0x0A63F, description = "Vai" }, + ["variationselectors"] = { first = 0x0FE00, last = 0x0FE0F, description = "Variation Selectors" }, + ["variationselectorssupplement"] = { first = 0xE0100, last = 0xE01EF, description = "Variation Selectors Supplement" }, + ["verticalforms"] = { first = 0x0FE10, last = 0x0FE1F, description = "Vertical Forms" }, + ["yijinghexagramsymbols"] = { first = 0x04DC0, last = 0x04DFF, description = "Yijing Hexagram Symbols" }, + ["yiradicals"] = { first = 0x0A490, last = 0x0A4CF, description = "Yi Radicals" }, + ["yisyllables"] = { first = 0x0A000, last = 0x0A48F, description = "Yi Syllables" }, } -function characters.getrange(name) - local tag = lower(name) - tag = gsub(name,"[^a-z]", "") - local range = characters.blocks[tag] +characters.blocks = blocks + +setmetatableindex(blocks, function(t,k) + return k and rawget(t,lower(gsub(k,"[^a-zA-Z]",""))) +end) + +function characters.getrange(name) -- used in font fallback definitions (name or range) + local range = blocks[name] if range then - return range[1], range[2], range[3] + return range.first, range.last, range.description end name = gsub(name,'"',"0x") -- goodie: tex hex notation local start, stop = match(name,"^(.-)[%-%:](.-)$") @@ -251,7 +328,7 @@ function characters.getrange(name) return slot, slot, nil end -characters.categories = { +local categorytags = allocate { lu = "Letter Uppercase", ll = "Letter Lowercase", lt = "Letter Titlecase", @@ -284,26 +361,58 @@ characters.categories = { cn = "Other Not Assigned", } +characters.categorytags = categorytags + --~ special : cf (softhyphen) zs (emspace) --~ characters: ll lm lo lt lu mn nl no pc pd pe pf pi po ps sc sk sm so -characters.is_character = table.tohash { +local is_character = allocate ( table.tohash { "lu","ll","lt","lm","lo", "nd","nl","no", "mn", "nl","no", "pc","pd","ps","pe","pi","pf","po", "sm","sc","sk","so" -} +} ) -characters.is_letter = table.tohash { +local is_letter = allocate ( table.tohash { "ll","lm","lo","lt","lu" -} +} ) -characters.is_command = table.tohash { +local is_command = allocate ( table.tohash { "cf","zs" +} ) + +local is_spacing = allocate ( table.tohash { + "zs", "zl","zp", +} ) + +local is_mark = allocate ( table.tohash { + "mn", "ms", +} ) + +characters.is_character = is_character +characters.is_letter = is_letter +characters.is_command = is_command +characters.is_spacing = is_spacing +characters.is_mark = is_mark + +local mt = { -- yes or no ? + __index = function(t,k) + if type(k) == "number" then + local c = characters.data[k].category + return c and rawget(t,c) + else + -- avoid auto conversion in data.characters lookups + end + end } +setmetatableindex(characters.is_character, mt) +setmetatableindex(characters.is_letter, mt) +setmetatableindex(characters.is_command, mt) +setmetatableindex(characters.is_spacing, mt) + -- linebreak: todo: hash -- -- normative : BK CR LF CM SG GL CB SP ZW NL WJ JL JV JT H2 H3 @@ -313,7 +422,7 @@ characters.is_command = table.tohash { -- -- N A H W F Na -characters.bidi = { +characters.bidi = allocate { l = "Left-to-Right", lre = "Left-to-Right Embedding", lro = "Left-to-Right Override", @@ -335,14 +444,6 @@ characters.bidi = { on = "Other Neutrals", } -local _empty_table_ = { __index = function(t,k) return "" end } - -function table.set_empty_metatable(t) - setmetatable(t,_empty_table_) -end - -table.set_empty_metatable(data) - --[[ldx--

At this point we assume that the big data table is loaded. From this table we derive a few more.

@@ -350,6 +451,8 @@ table we derive a few more.

if not characters.fallbacks then + -- we could the definition by using a metatable + characters.fallbacks = { } characters.directions = { } @@ -368,8 +471,8 @@ if not characters.fallbacks then end -storage.register("characters.fallbacks", characters.fallbacks, "characters.fallbacks") -storage.register("characters.directions", characters.directions, "characters.directions") +storage.register("characters/fallbacks", characters.fallbacks, "characters.fallbacks") -- accents and such +storage.register("characters/directions", characters.directions, "characters.directions") --[[ldx--

The context namespace is used to store methods and data @@ -383,108 +486,149 @@ use the table. After all, we have this information available anyway.

function characters.makeactive(n,name) -- let ? texsprint(ctxcatcodes,format("\\catcode%s=13\\unexpanded\\def %s{\\%s}",n,utfchar(n),name)) + -- context("\\catcode%s=13\\unexpanded\\def %s{\\%s}",n,utfchar(n),name) end -function tex.uprint(n) - texsprint(ctxcatcodes,utfchar(n)) +function tex.uprint(c,n) + if n then + -- texsprint(c,charfromnumber(n)) + texsprint(c,utfchar(n)) + else + -- texsprint(charfromnumber(c)) + texsprint(utfchar(c)) + end end -local template_a = "\\startextendcatcodetable{%s}\\chardef\\l=11\\chardef\\a=13\\let\\c\\catcode%s\\let\\a\\undefined\\let\\l\\undefined\\let\\c\\undefined\\stopextendcatcodetable" -local template_b = "\\chardef\\l=11\\chardef\\a=13\\let\\c\\catcode%s\\let\\a\\undefined\\let\\l\\undefined\\let\\c\\undefined" +function characters.define(tobelettered, tobeactivated) -- catcodetables + + if trace_defining then + report_defining("defining active character commands") + end --- we need a function for setting the codes .... + local activated, a = { }, 0 -function characters.define(tobelettered, tobeactivated) -- catcodetables - local is_character, is_command, is_letter = characters.is_character, characters.is_command, characters.is_letter - local lettered, activated = { }, { } - for u, chr in next, data do - -- we can use a macro instead of direct settings + for u, chr in next, data do -- these will be commands local fallback = chr.fallback if fallback then - -- texprint(format("{\\catcode %s=13\\unexpanded\\gdef %s{\\checkedchar{%s}{%s}}}",u,utfchar(u),u,fallback)) texsprint("{\\catcode",u,"=13\\unexpanded\\gdef ",utfchar(u),"{\\checkedchar{",u,"}{",fallback,"}}}") -- no texprint - activated[#activated+1] = "\\c"..u.."\\a" + a = a + 1 + activated[a] = u else local contextname = chr.contextname - local category = chr.category if contextname then + local category = chr.category if is_character[category] then - -- by this time, we're still in normal catcode mode - -- subtle: not "\\",contextname but "\\"..contextname if chr.unicodeslot < 128 then - -- texprint(ctxcatcodes, "\\chardef\\"..contextname,"=",u) - texprint(ctxcatcodes,format("\\chardef\\%s=%s",contextname,u)) - else - -- texprint(ctxcatcodes, "\\let\\"..contextname,"=",utfchar(u)) - texprint(ctxcatcodes,format("\\let\\%s=%s",contextname,utfchar(u))) if is_letter[category] then - lettered[#lettered+1] = "\\c"..u.."\\l" + texprint(ctxcatcodes,format("\\def\\%s{%s}",contextname,utfchar(u))) + else + texprint(ctxcatcodes,format("\\chardef\\%s=%s",contextname,u)) end + else + texprint(ctxcatcodes,format("\\def\\%s{%s}",contextname,utfchar(u))) end elseif is_command[category] then - -- this might change: contextcommand ipv contextname - -- texprint(format("{\\catcode %s=13\\unexpanded\\gdef %s{\\%s}}",u,utfchar(u),contextname)) texsprint("{\\catcode",u,"=13\\unexpanded\\gdef ",utfchar(u),"{\\"..contextname,"}}") -- no texprint - activated[#activated+1] = "\\c"..u.."\\a" - end - elseif is_letter[category] then - if u >= 128 and u <= 65536 then -- catch private mess - lettered[#lettered+1] = "\\c"..u.."\\l" + a = a + 1 + activated[a] = u end end end - if chr.range then - lettered[#lettered+1] = format('\\dofastrecurse{"%05X}{"%05X}{1}{\\c\\fastrecursecounter\\l}',u,chr.range) - end end - -- if false then - lettered[#lettered+1] = "\\c"..0x200C.."\\l" -- non-joiner - lettered[#lettered+1] = "\\c"..0x200D.."\\l" -- joiner - -- fi - if tobelettered then - lettered = concat(lettered) - if true then - texsprint(ctxcatcodes,format(template_b,lettered)) - else - for l=1,#tobelettered do - texsprint(ctxcatcodes,format(template_a,tobelettered[l],lettered)) + + if tobelettered then -- shared + local saved = tex.catcodetable + for i=1,#tobelettered do + tex.catcodetable = tobelettered[i] + if trace_defining then + report_defining("defining letters (global, shared)") + end + for u, chr in next, data do + if not chr.fallback and is_letter[chr.category] and u >= 128 and u <= 65536 then + texsetcatcode(u,11) + end + local range = chr.range + if range then + for i=1,range.first,range.last do + texsetcatcode(i,11) + end + end end + texsetcatcode(0x200C,11) -- non-joiner + texsetcatcode(0x200D,11) -- joiner end + tex.catcodetable = saved end - if tobeactivated then - activated = concat(activated) - for a=1,#tobeactivated do - texsprint(ctxcatcodes,format(template_a,tobeactivated[a],activated)) + + local nofactivated = #tobeactivated + if tobeactivated and nofactivated > 0 then + for i=1,nofactivated do + local u = activated[i] + report_defining("character 0x%05X is active in sets %s (%s)",u,concat(tobeactivated,","),data[u].description) + end + local saved = tex.catcodetable + for i=1,#tobeactivated do + local vector = tobeactivated[i] + if trace_defining then + report_defining("defining %s active characters in vector %s",nofactivated,vector) + end + tex.catcodetable = vector + for i=1,nofactivated do + texsetcatcode(activated[i],13) + end end + tex.catcodetable = saved end -end -function characters.charcode(box) - local b = tex.box[box] - local l = b.list - texsprint((l and l.id == node.id('glyph') and l.char) or 0) end --[[ldx--

Setting the lccodes is also done in a loop over the data table.

--ldx]]-- +--~ function tex.setsfcode (index,sf) ... end +--~ function tex.setlccode (index,lc,[uc]) ... end -- optional third value, safes call +--~ function tex.setuccode (index,uc,[lc]) ... end +--~ function tex.setcatcode(index,cc) ... end + -- we need a function ... +--~ tex.lccode +--~ tex.uccode +--~ tex.sfcode +--~ tex.catcode + function characters.setcodes() + if trace_defining then + report_defining("defining lc and uc codes") + end for code, chr in next, data do local cc = chr.category - if cc == 'll' or cc == 'lu' or cc == 'lt' then - local lc, uc = chr.lccode, chr.uccode - if not lc then chr.lccode, lc = code, code end - if not uc then chr.uccode, uc = code, code end - texsprint(ctxcatcodes,format("\\setcclcuc{%i}{%i}{%i}",code,lc,uc)) - end - if cc == "lu" then - texprint(ctxcatcodes,"\\sfcode ",code,"999 ") - end - if cc == "lo" and chr.range then - texsprint(ctxcatcodes,format('\\dofastrecurse{"%05X}{"%05X}{1}{\\setcclcucself\\fastrecursecounter}',code,chr.range)) + if is_letter[cc] then + local range = chr.range + if range then + for i=range.first,range.last do + texsetcatcode(i,11) -- letter + texsetlccode(i,i,i) -- self self + end + else + local lc, uc = chr.lccode, chr.uccode + if not lc then chr.lccode, lc = code, code end + if not uc then chr.uccode, uc = code, code end + texsetcatcode(code,11) -- letter + if type(lc) == "table" then + lc = code + end + if type(uc) == "table" then + uc = code + end + texsetlccode(code,lc,uc) + if cc == "lu" then + texsetsfcode(code,999) + end + end + elseif is_mark[cc] then + texsetlccode(code,code,code) -- for hyphenation end end end @@ -495,88 +639,236 @@ of the official .

--ldx]]-- --[[ldx-- -

This converts a string (if given) into a number.

+

A couple of convenience methods. Beware, these are slower than directly +accessing the data table.

--ldx]]-- -function characters.number(n) - if type(n) == "string" then return tonumber(n,16) else return n end -end +-- we could make them virtual: characters.contextnames[n] ---[[ldx-- -

Checking for valid characters.

---ldx]]-- +function characters.contextname(n) return data[n].contextname or "" end +function characters.adobename (n) return data[n].adobename or "" end +function characters.description(n) return data[n].description or "" end +-------- characters.category (n) return data[n].category or "" end -function characters.is_valid(s) - return s or "" +function characters.category(n,verbose) + local c = data[n].category + if not c then + return "" + elseif verbose then + return categorytags[c] + else + return c + end end -function characters.checked(s, default) - return s or default +-- xml support (moved) + +function characters.remapentity(chr,slot) + texsprint(format("{\\catcode%s=13\\xdef%s{\\string%s}}",slot,utfchar(slot),chr)) end -characters.valid = characters.is_valid +characters.activeoffset = 0x10000 -- there will be remapped in that byte range ---[[ldx-- -

---ldx]]-- --- set a table entry; index is number (can be different from unicodeslot) +-- xml.entities = xml.entities or { } +-- +-- storage.register("xml/entities",xml.entities,"xml.entities") -- this will move to lxml +-- +-- function characters.setmkiventities() +-- local entities = xml.entities +-- entities.lt = "<" +-- entities.amp = "&" +-- entities.gt = ">" +-- end +-- +-- function characters.setmkiientities() +-- local entities = xml.entities +-- entities.lt = utfchar(characters.activeoffset + utfbyte("<")) +-- entities.amp = utfchar(characters.activeoffset + utfbyte("&")) +-- entities.gt = utfchar(characters.activeoffset + utfbyte(">")) +-- end + +-- some day we will make a table -function characters.set(n, c) - data[characters.number(n)] = c +local function utfstring(s) + if type(s) == "table" then + return utfchar(unpack(s)) -- concat { utfchar( unpack(s) ) } + else + return utfchar(s) + end end ---[[ldx-- -

Get a table entry happens by number. Keep in mind that the unicodeslot -can be different (not likely).

---ldx]]-- +utf.string = utf.string or utfstring -function characters.get(n) - return data[characters.number(n)] -end +local categories = allocate() characters.categories = categories -- lazy table ---[[ldx-- -

A couple of convenience methods. Beware, these are not that fast due -to the checking.

---ldx]]-- +setmetatableindex(categories, function(t,u) if u then local c = data[u] c = c and c.category or u t[u] = c return c end end) -function characters.hexindex(n) - return format("%04X", characters.valid(data[characters.number(n)].unicodeslot)) -end +local lccodes = allocate() characters.lccodes = lccodes -- lazy table +local uccodes = allocate() characters.uccodes = uccodes -- lazy table +local shcodes = allocate() characters.shcodes = shcodes -- lazy table +local fscodes = allocate() characters.fscodes = fscodes -- lazy table + +setmetatableindex(lccodes, function(t,u) if u then local c = data[u] c = c and c.lccode or (type(u) == "string" and utfbyte(u)) or u t[u] = c return c end end) +setmetatableindex(uccodes, function(t,u) if u then local c = data[u] c = c and c.uccode or (type(u) == "string" and utfbyte(u)) or u t[u] = c return c end end) +setmetatableindex(shcodes, function(t,u) if u then local c = data[u] c = c and c.shcode or (type(u) == "string" and utfbyte(u)) or u t[u] = c return c end end) +setmetatableindex(fscodes, function(t,u) if u then local c = data[u] c = c and c.fscode or (type(u) == "string" and utfbyte(u)) or u t[u] = c return c end end) + +local lcchars = allocate() characters.lcchars = lcchars -- lazy table +local ucchars = allocate() characters.ucchars = ucchars -- lazy table +local shchars = allocate() characters.shchars = shchars -- lazy table +local fschars = allocate() characters.fschars = fschars -- lazy table + +setmetatableindex(lcchars, function(t,u) if u then local c = data[u] c = c and c.lccode c = c and utfstring(c) or (type(u) == "number" and utfchar(u)) or u t[u] = c return c end end) +setmetatableindex(ucchars, function(t,u) if u then local c = data[u] c = c and c.uccode c = c and utfstring(c) or (type(u) == "number" and utfchar(u)) or u t[u] = c return c end end) +setmetatableindex(shchars, function(t,u) if u then local c = data[u] c = c and c.shcode c = c and utfstring(c) or (type(u) == "number" and utfchar(u)) or u t[u] = c return c end end) +setmetatableindex(fschars, function(t,u) if u then local c = data[u] c = c and c.fscode c = c and utfstring(c) or (type(u) == "number" and utfchar(u)) or u t[u] = c return c end end) -function characters.contextname(n) - return characters.valid(data[characters.number(n)].contextname) +local decomposed = allocate() characters.decomposed = decomposed -- lazy table + +setmetatableindex(decomposed, function(t,u) -- either a table or false + if u then + local c = data[u] + local s = c and c.decomposed or false + t[u] = s + return s + end +end) + +local specialchars = allocate() characters.specialchars = specialchars -- lazy table +local descriptions = allocate() characters.descriptions = descriptions -- lazy table + +setmetatableindex(specialchars, function(t,u) + if u then + local c = data[u] + local s = c and c.specials + if s then + local tt, ttn = { }, 0 + for i=2,#s do + local si = s[i] + local c = data[si] + if is_letter[c.category] then + ttn = ttn + 1 + tt[ttn] = utfchar(si) + end + end + c = concat(tt) + t[u] = c + return c + else + if type(u) == "number" then + u = utfchar(u) + end + t[u] = u + return u + end + end +end) + +setmetatableindex(descriptions, function(t,k) + -- 0.05 - 0.10 sec + for u, c in next, data do + local d = c.description + if d then + d = gsub(d," ","") + d = lower(d) + t[d] = u + end + end + local d = rawget(t,k) + if not d then + t[k] = k + end + return d +end) + +function characters.unicodechar(asked) + local n = tonumber(asked) + if n then + return n + elseif type(asked) == "string" then + asked = gsub(asked," ","") + return descriptions[asked] + end end -function characters.adobename(n) - return characters.valid(data[characters.number(n)].adobename) +function characters.lower(str) + local new, n = { }, 0 + for u in utfvalues(str) do + n = n + 1 + new[n] = lcchars[u] + end + return concat(new) end -function characters.description(n) - return characters.valid(data[characters.number(n)].description) +function characters.upper(str) + local new, n = { }, 0 + for u in utfvalues(str) do + n = n + 1 + new[n] = ucchars[u] + end + return concat(new) end -function characters.category(n) - return characters.valid(data[characters.number(n)].category) +function characters.shaped(str) + local new, n = { }, 0 + for u in utfvalues(str) do + n = n + 1 + new[n] = shchars[u] + end + return concat(new) end +function characters.lettered(str,spacing) + local new, n = { }, 0 + if spacing then + local done = false + for u in utfvalues(str) do + local c = data[u].category + if is_letter[c] then + if done and n > 1 then + n = n + 1 + new[n] = " " + done = false + end + n = n + 1 + new[n] = utfchar(u) + elseif spacing and is_spacing[c] then + done = true + end + end + else + for u in utfvalues(str) do + if is_letter[data[u].category] then + n = n + 1 + new[n] = utfchar(u) + end + end + end + return concat(new) +end --[[ldx--

Requesting lower and uppercase codes:

--ldx]]-- -function characters.uccode(n) return data[n].uccode or n end -function characters.lccode(n) return data[n].lccode or n end +function characters.uccode(n) return uccodes[n] end -- obsolete +function characters.lccode(n) return lccodes[n] end -- obsolete -function characters.flush(n) +function characters.flush(n,direct) local c = data[n] if c and c.contextname then - texsprint(texcatcodes, "\\"..c.contextname) + c = "\\" .. c.contextname else - texsprint(utfchar(n)) + c = utfchar(n) + end + if direct then + return c + else + texsprint(c) end end function characters.shape(n) - local shcode = data[n].shcode + local shcode = shcodes[n] if not shcode then return n, nil elseif type(shcode) == "table" then @@ -586,72 +878,6 @@ function characters.shape(n) end end ---[[ldx-- -

Categories play an important role, so here are some checkers.

---ldx]]-- - -function characters.is_of_category(token,category) - if type(token) == "string" then - return data[utfbyte(token)].category == category - else - return data[token].category == category - end -end - -function characters.i_is_of_category(i,category) -- by index (number) - local cd = data[i] - return cd and cd.category == category -end - -function characters.n_is_of_category(n,category) -- by name (string) - local cd = data[utfbyte(n)] - return cd and cd.category == category -end - --- xml support (moved) - -function characters.remapentity(chr,slot) - texsprint(format("{\\catcode%s=13\\xdef%s{\\string%s}}",slot,utfchar(slot),chr)) -end - -characters.active_offset = 0x10000 -- there will be remapped in that byte range - --- xml.entities = xml.entities or { } --- --- storage.register("xml/entities",xml.entities,"xml.entities") -- this will move to lxml --- --- function characters.setmkiventities() --- local entities = xml.entities --- entities.lt = "<" --- entities.amp = "&" --- entities.gt = ">" --- end --- --- function characters.setmkiientities() --- local entities = xml.entities --- entities.lt = utfchar(characters.active_offset + utfbyte("<")) --- entities.amp = utfchar(characters.active_offset + utfbyte("&")) --- entities.gt = utfchar(characters.active_offset + utfbyte(">")) --- end - --- some day we will make a table - -function characters.lower(str) - local new = { } - for u in utfvalues(str) do - new[#new+1] = utfchar(data[u].lccode or u) - end - return concat(new) -end - -function characters.upper(str) - local new = { } - for u in utfvalues(str) do - new[#new+1] = utfchar(data[u].uccode or u) - end - return concat(new) -end - -- -- some day we might go this route, but it does not really save that much -- -- so not now (we can generate a lot using mtx-unicode that operates on the -- -- database) @@ -696,3 +922,67 @@ end -- end --~ characters.data, characters.groups = chardata, groupdata + +--~ [0xF0000]={ +--~ category="co", +--~ cjkwd="a", +--~ description="", +--~ direction="l", +--~ unicodeslot=0xF0000, +--~ }, +--~ [0xFFFFD]={ +--~ category="co", +--~ cjkwd="a", +--~ description="", +--~ direction="l", +--~ unicodeslot=0xFFFFD, +--~ }, +--~ [0x100000]={ +--~ category="co", +--~ cjkwd="a", +--~ description="", +--~ direction="l", +--~ unicodeslot=0x100000, +--~ }, +--~ [0x10FFFD]={ +--~ category="co", +--~ cjkwd="a", +--~ description="", +--~ direction="l", +--~ unicodeslot=0x10FFFD, +--~ }, + +if not characters.superscripts then + + local superscripts = allocate() characters.superscripts = superscripts + local subscripts = allocate() characters.subscripts = subscripts + + -- skipping U+02120 (service mark) U+02122 (trademark) + + for k, v in next, data do + local specials = v.specials + if specials then + local what = specials[1] + if what == "super" then + if #specials == 2 then + superscripts[k] = specials[2] + else + report_defining("ignoring superscript %s %s: %s",ustring(k),utfchar(k),v.description) + end + elseif what == "sub" then + if #specials == 2 then + subscripts[k] = specials[2] + else + report_defining("ignoring subscript %s %s: %s",ustring(k),utfchar(k),v.description) + end + end + end + end + + -- print(table.serialize(superscripts, "superscripts", { hexify = true })) + -- print(table.serialize(subscripts, "subscripts", { hexify = true })) + + storage.register("characters/superscripts", superscripts, "characters.superscripts") + storage.register("characters/subscripts", subscripts, "characters.subscripts") + +end diff --git a/Master/texmf-dist/tex/context/base/char-ini.mkiv b/Master/texmf-dist/tex/context/base/char-ini.mkiv index 0d5e16bb04b..68bc3b49702 100644 --- a/Master/texmf-dist/tex/context/base/char-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/char-ini.mkiv @@ -15,12 +15,26 @@ \registerctxluafile{char-def}{1.001} % let's load this one first \registerctxluafile{char-ini}{1.001} -\registerctxluafile{char-cmp}{1.001} % maybe we will load this someplace else +\registerctxluafile{char-cjk}{1.001} \registerctxluafile{char-map}{1.001} % maybe we will load this someplace else \registerctxluafile{char-tex}{1.001} \unprotect +% ¨äëïöüÿ +% ´áćéíĺńóŕśúýź +% ˙ċėġiż +% ¯āēīōū +% ˝őű +% ˆâĉêĝĥîĵôŝûŵŷ +% `àèìòùỳ +% ¸çķļņŗşţ +% ˛ąęįų +% ˚åů +% ˘ăĕğĭŏŭ +% ˇčďěľňřšťž +% ˜ãĩñõũ + % \def\checkedchar#1% #2% % {\relax\iffontchar\font#1 \expandafter\firstoftwoarguments\else\expandafter\secondoftwoarguments\fi{\char#1}} % @@ -31,21 +45,25 @@ \def\checkedmathchar#1#2{#2} \def\checkedtextchar #1{\iffontchar\font#1 \expandafter\firstoftwoarguments\else\expandafter\secondoftwoarguments\fi{\char#1}} +\unexpanded\def\textormathchar#1% + {\relax\ifmmode + \char#1\relax + \else\iffontchar\font#1\relax + \char#1\relax + \else + $\char#1$% + \fi\fi} + %D The codes are stored in the format, so we don't need to reinitialize %D them (unless of course we have adapted the table). It is on the agenda %D to do this with \type {tex.lccode} cum suis once they're available. -\def\setcclcuc#1#2#3{\global\catcode#1=\@@letter\global\lccode#1=#2\global\uccode#1=#3\relax} -\def\setcclcucself#1{\global\catcode#1=\@@letter\global\lccode#1=#1\global\uccode#1=#1\relax } +% \def\setcclcuc#1#2#3{\global\catcode#1=\lettercatcode\global\lccode#1=#2\global\uccode#1=#3\relax} +% \def\setcclcucself#1{\global\catcode#1=\lettercatcode\global\lccode#1=#1\global\uccode#1=#1\relax } \ctxlua{characters.setcodes()} -%D There may be a problem with the turkisch patterns. By now it's taken care of in -%D ctxtools (thanks to Mojca). There seems to be a bug in the patterns (^^11 refers -%D to a double quote but it should be ^^19 since the original is in ec encoding). - -% \setcclcuc "201C "201C "201C -% \setcclcuc "201D "201D "201D +% Is setting up vrb tpa and tpb needed? \ctxlua { characters.define( @@ -53,24 +71,26 @@ \number\texcatcodes, \number\ctxcatcodes, \number\notcatcodes, - \number\mthcatcodes, + %number\mthcatcodes, \number\vrbcatcodes, \number\prtcatcodes, - \number\xmlcatcodesn, - \number\xmlcatcodese, - \number\xmlcatcodesr, - \number\typcatcodesa, - \number\typcatcodesb, +% \number\xmlcatcodesn, +% \number\xmlcatcodese, +% \number\xmlcatcodesr, + \number\tpacatcodes, + \number\tpbcatcodes, + \number\txtcatcodes, }, { % activate catcodes \number\ctxcatcodes, \number\notcatcodes, - \number\xmlcatcodesn, - \number\xmlcatcodese, - \number\xmlcatcodesr, + \number\prtcatcodes, % new +% \number\xmlcatcodesn, +% \number\xmlcatcodese, +% \number\xmlcatcodesr, } ) - catcodes.register("xmlcatcodes",\number\xmlcatcodes) +% catcodes.register("xmlcatcodes",\number\xmlcatcodes) } \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/char-map.lua b/Master/texmf-dist/tex/context/base/char-map.lua index 3f8cc3b3d3c..376ebf343b9 100644 --- a/Master/texmf-dist/tex/context/base/char-map.lua +++ b/Master/texmf-dist/tex/context/base/char-map.lua @@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['char-map'] = { license = "see context related readme files" } +-- not yet used + characters = characters or { } characters.casemap={ diff --git a/Master/texmf-dist/tex/context/base/char-tex.lua b/Master/texmf-dist/tex/context/base/char-tex.lua index ed9a244d781..e6d6c41e0fa 100644 --- a/Master/texmf-dist/tex/context/base/char-tex.lua +++ b/Master/texmf-dist/tex/context/base/char-tex.lua @@ -6,12 +6,131 @@ if not modules then modules = { } end modules ['char-tex'] = { license = "see context related readme files" } -characters = characters or { } -characters.tex = characters.tex or { } +local lpeg = lpeg local find = string.find +local P, C, R, S, Cs, Cc = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cs, lpeg.Cc +local U, lpegmatch = lpeg.patterns.utf8, lpeg.match + +local allocate, mark = utilities.storage.allocate, utilities.storage.mark + +characters = characters or { } +local characters = characters +characters.tex = characters.tex or { } + +local accentmapping = allocate { + ['"'] = { [""] = "¨", + A = "Ä", a = "ä", + E = "Ë", e = "ë", + I = "Ï", i = "ï", ["ı"] = "ï", + O = "Ö", o = "ö", + U = "Ü", u = "ü", + Y = "Ÿ", y = "ÿ", + }, + ["'"] = { [""] = "´", + A = "Á", a = "á", + C = "Ć", c = "ć", + E = "É", e = "é", + I = "Í", i = "í", ["ı"] = "í", + L = "Ĺ", l = "ĺ", + N = "Ń", n = "ń", + O = "Ó", o = "ó", + R = "Ŕ", r = "ŕ", + S = "Ś", s = "ś", + U = "Ú", u = "ú", + Y = "Ý", y = "ý", + Z = "Ź", z = "ź", + }, + ["."] = { [""] = "˙", + C = "Ċ", c = "ċ", + E = "Ė", e = "ė", + G = "Ġ", g = "ġ", + I = "İ", i = "i", ["ı"] = "i", + Z = "Ż", z = "ż", + }, + ["="] = { [""] = "¯", + A = "Ā", a = "ā", + E = "Ē", e = "ē", + I = "Ī", i = "ī", ["ı"] = "ī", + O = "Ō", o = "ō", + U = "Ū", u = "ū", + }, + ["H"] = { [""] = "˝", + O = "Ő", o = "ő", + U = "Ű", u = "ű", + }, + ["^"] = { [""] = "ˆ", + A = "Â", a = "â", + C = "Ĉ", c = "ĉ", + E = "Ê", e = "ê", + G = "Ĝ", g = "ĝ", + H = "Ĥ", h = "ĥ", + I = "Î", i = "î", ["ı"] = "î", + J = "Ĵ", j = "ĵ", + O = "Ô", o = "ô", + S = "Ŝ", s = "ŝ", + U = "Û", u = "û", + W = "Ŵ", w = "ŵ", + Y = "Ŷ", y = "ŷ", + }, + ["`"] = { [""] = "`", + A = "À", a = "à", + E = "È", e = "è", + I = "Ì", i = "ì", ["ı"] = "ì", + O = "Ò", o = "ò", + U = "Ù", u = "ù", + Y = "Ỳ", y = "ỳ", + }, + ["c"] = { [""] = "¸", + C = "Ç", c = "ç", + K = "Ķ", k = "ķ", + L = "Ļ", l = "ļ", + N = "Ņ", n = "ņ", + R = "Ŗ", r = "ŗ", + S = "Ş", s = "ş", + T = "Ţ", t = "ţ", + }, + ["k"] = { [""] = "˛", + A = "Ą", a = "ą", + E = "Ę", e = "ę", + I = "Į", i = "į", + U = "Ų", u = "ų", + }, + ["r"] = { [""] = "˚", + A = "Å", a = "å", + U = "Ů", u = "ů", + }, + ["u"] = { [""] = "˘", + A = "Ă", a = "ă", + E = "Ĕ", e = "ĕ", + G = "Ğ", g = "ğ", + I = "Ĭ", i = "ĭ", ["ı"] = "ĭ", + O = "Ŏ", o = "ŏ", + U = "Ŭ", u = "ŭ", + }, + ["v"] = { [""] = "ˇ", + C = "Č", c = "č", + D = "Ď", d = "ď", + E = "Ě", e = "ě", + L = "Ľ", l = "ľ", + N = "Ň", n = "ň", + R = "Ř", r = "ř", + S = "Š", s = "š", + T = "Ť", t = "ť", + Z = "Ž", z = "ž", + }, + ["~"] = { [""] = "˜", + A = "Ã", a = "ã", + I = "Ĩ", i = "ĩ", ["ı"] = "ĩ", + N = "Ñ", n = "ñ", + O = "Õ", o = "õ", + U = "Ũ", u = "ũ", + }, +} + +characters.tex.accentmapping = accentmapping -local accent_map = { +local accent_map = allocate { -- incomplete ['~'] = "̃" , -- ̃ Ẽ ['"'] = "̈" , -- ̈ Ë ["`"] = "̀" , -- ̀ È @@ -44,7 +163,7 @@ local function remap_accents(a,c,braced) end end -local command_map = { +local command_map = allocate { ["i"] = "ı" } @@ -57,9 +176,6 @@ local function remap_commands(c) end end -local P, C, R, S, Cs, Cc = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cs, lpeg.Cc -local U, lpegmatch = lpeg.patterns.utf8, lpeg.match - local accents = (P('\\') * C(S(accents)) * (P("{") * C(U) * P("}" * Cc(true)) + C(U) * Cc(false))) / remap_accents local commands = (P('\\') * C(R("az","AZ")^1)) / remap_commands @@ -73,13 +189,11 @@ local convert_accents_strip = Cs((no_l * accents * no_r + accents + P(1))^0) local convert_commands_strip = Cs((no_l * commands * no_r + commands + P(1))^0) function characters.tex.toutf(str,strip) - if find(str,"\\") then -- we can start at teh found position + if find(str,"\\") then -- we can start at the found position if strip then - str = lpegmatch(convert_commands_strip,str) - str = lpegmatch(convert_accents_strip,str) + return lpegmatch(convert_accents_strip,lpegmatch(convert_commands_strip,str)) else - str = lpegmatch(convert_commands,str) - str = lpegmatch(convert_accents,str) + return lpegmatch(convert_accents, lpegmatch(convert_commands, str)) end end return str @@ -87,3 +201,12 @@ end --~ print(characters.tex.toutf([[\"{e}]]),true) --~ print(characters.tex.toutf([[{\"{e}}]],true)) + +function characters.tex.defineaccents() + for accent, group in next, accentmapping do + context.dodefineaccentcommand(accent) + for character, mapping in next, group do + context.dodefineaccent(accent,character,mapping) + end + end +end diff --git a/Master/texmf-dist/tex/context/base/char-utf.lua b/Master/texmf-dist/tex/context/base/char-utf.lua index 6dd85fdc87d..30124a6a2a6 100644 --- a/Master/texmf-dist/tex/context/base/char-utf.lua +++ b/Master/texmf-dist/tex/context/base/char-utf.lua @@ -19,57 +19,118 @@ in special kinds of output (for instance ).

over a string.

--ldx]]-- -local utf = unicode.utf8 -local concat, gmatch = table.concat, string.gmatch +local utfchar, utfbyte, utfgsub = utf.char, utf.byte, utf.gsub +local concat, gmatch, gsub, find = table.concat, string.gmatch, string.gsub, string.find local utfcharacters, utfvalues = string.utfcharacters, string.utfvalues +local allocate = utilities.storage.allocate -local ctxcatcodes = tex.ctxcatcodes +local charfromnumber = characters.fromnumber -characters = characters or { } -characters.graphemes = characters.graphemes or { } -characters.filters = characters.filters or { } -characters.filters.utf = characters.filters.utf or { } +-- todo: trackers -characters.filters.utf.initialized = false -characters.filters.utf.collapsing = true -characters.filters.utf.expanding = true +characters = characters or { } +local characters = characters -local graphemes = characters.graphemes -local utffilters = characters.filters.utf -local utfchar, utfbyte, utfgsub = utf.char, utf.byte, utf.gsub +characters.graphemes = allocate() +local graphemes = characters.graphemes + +characters.decomposed = allocate() +local decomposed = characters.decomposed + +characters.mathpairs = allocate() +local mathpairs = characters.mathpairs + +characters.filters = allocate() +local filters = characters.filters + +filters.utf = filters.utf or { } +local utffilters = characters.filters.utf --[[ldx--

It only makes sense to collapse at runtime, since we don't expect source code to depend on collapsing.

--ldx]]-- -function utffilters.initialize() - if utffilters.collapsing and not utffilters.initialized then - for k,v in next, characters.data do - -- using vs and first testing for length is faster (.02->.01 s) - local vs = v.specials - if vs and #vs == 3 and vs[1] == 'char' then - local first, second = utfchar(vs[2]), utfchar(vs[3]) - local cgf = graphemes[first] - if not cgf then - cgf = { } - graphemes[first] = cgf +-- for the moment, will be entries in char-def.lua + +local decomposed = allocate { + ["IJ"] = "IJ", + ["ij"] = "ij", + ["և"] = "եւ", + ["ff"] = "ff", + ["fi"] = "fi", + ["fl"] = "fl", + ["ffi"] = "ffi", + ["ffl"] = "ffl", + ["ſt"] = "ſt", + ["st"] = "st", + ["ﬓ"] = "մն", + ["ﬔ"] = "մե", + ["ﬕ"] = "մի", + ["ﬖ"] = "վն", + ["ﬗ"] = "մխ", +} +characters.decomposed = decomposed + +local function initialize() + for unicode, v in next, characters.data do + -- using vs and first testing for length is faster (.02->.01 s) + local vs = v.specials + if vs and #vs == 3 and vs[1] == 'char' then + local one, two = vs[2], vs[3] + local first, second, combined = utfchar(one), utfchar(two), utfchar(unicode) + local cgf = graphemes[first] + if not cgf then + cgf = { } + graphemes[first] = cgf + end + cgf[second] = combined + if v.mathclass or v.mathspec then + local mps = mathpairs[two] + if not mps then + mps = { } + mathpairs[two] = mps + end + mps[one] = unicode -- here unicode + local mps = mathpairs[second] + if not mps then + mps = { } + mathpairs[second] = mps end - cgf[second] = utfchar(k) + mps[first] = combined end + -- else + -- local description = v.description + -- if find(description,"LIGATURE") then + -- if vs then + -- local t = { } + -- for i=2,#vs do + -- t[#t+1] = utfchar(vs[i]) + -- end + -- decomposed[utfchar(unicode)] = concat(t) + -- else + -- local vs = v.shcode + -- if vs then + -- local t = { } + -- for i=1,#vs do + -- t[i] = utfchar(vs[i]) + -- end + -- decomposed[utfchar(unicode)] = concat(t) + -- end + -- end + -- end end - utffilters.initialized = true end + initialize = false end --- utffilters.add_grapheme(utfchar(318),'l','\string~') --- utffilters.add_grapheme('c','a','b') +-- utffilters.addgrapheme(utfchar(318),'l','\string~') +-- utffilters.addgrapheme('c','a','b') -function utffilters.add_grapheme(result,first,second) - local r, f, s = tonumber(result), tonumber(first), tonumber(second) - if r then result = utfchar(r) end - if f then first = utfchar(f) end - if s then second = utfchar(s) end +function utffilters.addgrapheme(result,first,second) -- can be U+ 0x string or utf or number + local result = charfromnumber(result) + local first = charfromnumber(first) + local second = charfromnumber(second) if not graphemes[first] then graphemes[first] = { [second] = result } else @@ -77,31 +138,6 @@ function utffilters.add_grapheme(result,first,second) end end -function utffilters.collapse(str) -- old one - if utffilters.collapsing and str and #str > 1 then - if not utffilters.initialized then -- saves a call - utffilters.initialize() - end - local tokens, first, done = { }, false, false - for second in utfcharacters(str) do - local cgf = graphemes[first] - if cgf and cgf[second] then - first, done = cgf[second], true - elseif first then - tokens[#tokens+1] = first - first = second - else - first = second - end - end - if done then - tokens[#tokens+1] = first - return concat(tokens) - end - end - return str -end - --[[ldx--

In order to deal with 8-bit output, we need to find a way to go from to 8-bit. This is handled in the @@ -120,18 +156,20 @@ to their right glyph there.

0x100000.

--ldx]]-- -utffilters.private = { - high = { }, - low = { }, - escapes = { }, +local low = allocate({ }) +local high = allocate({ }) +local escapes = allocate({ }) +local special = "~#$%^&_{}\\|" + +local private = { + low = low, + high = high, + escapes = escapes, } -local low = utffilters.private.low -local high = utffilters.private.high -local escapes = utffilters.private.escapes -local special = "~#$%^&_{}\\|" +utffilters.private = private -function utffilters.private.set(ch) +local function set(ch) local cb if type(ch) == "number" then cb, ch = ch, utfchar(ch) @@ -145,11 +183,11 @@ function utffilters.private.set(ch) end end -function utffilters.private.replace(str) return utfgsub(str,"(.)", low ) end -function utffilters.private.revert(str) return utfgsub(str,"(.)", high ) end -function utffilters.private.escape(str) return utfgsub(str,"(.)", escapes) end +private.set = set -local set = utffilters.private.set +function private.escape (str) return gsub(str,"(.)", escapes) end +function private.replace(str) return utfgsub(str,"(.)", low ) end +function private.revert (str) return utfgsub(str,"(.)", high ) end for ch in gmatch(special,".") do set(ch) end @@ -162,12 +200,7 @@ first snippet uses the relocated dollars.

[󰀤x󰀤] [$x$] ---ldx]]-- -local cr = utffilters.private.high -- kan via een lpeg -local cf = utffilters - ---[[ldx--

The next variant has lazy token collecting, on a 140 page mk.tex this saves about .25 seconds, which is understandable because we have no graphmes and not collecting tokens is not only faster but also saves garbage collecting. @@ -175,20 +208,129 @@ not collecting tokens is not only faster but also saves garbage collecting. --ldx]]-- -- lpeg variant is not faster +-- +-- I might use the combined loop at some point for the filter +-- some day. + +--~ function utffilters.collapse(str) -- not really tested (we could preallocate a table) +--~ if str and str ~= "" then +--~ local nstr = #str +--~ if nstr > 1 then +--~ if initialize then -- saves a call +--~ initialize() +--~ end +--~ local tokens, t, first, done, n = { }, 0, false, false, 0 +--~ for second in utfcharacters(str) do +--~ local dec = decomposed[second] +--~ if dec then +--~ if not done then +--~ if n > 0 then +--~ for s in utfcharacters(str) do +--~ if n == 1 then +--~ break +--~ else +--~ t = t + 1 +--~ tokens[t] = s +--~ n = n - 1 +--~ end +--~ end +--~ end +--~ done = true +--~ elseif first then +--~ t = t + 1 +--~ tokens[t] = first +--~ end +--~ t = t + 1 +--~ tokens[t] = dec +--~ first = false +--~ elseif done then +--~ local crs = high[second] +--~ if crs then +--~ if first then +--~ t = t + 1 +--~ tokens[t] = first +--~ end +--~ first = crs +--~ else +--~ local cgf = graphemes[first] +--~ if cgf and cgf[second] then +--~ first = cgf[second] +--~ elseif first then +--~ t = t + 1 +--~ tokens[t] = first +--~ first = second +--~ else +--~ first = second +--~ end +--~ end +--~ else +--~ local crs = high[second] +--~ if crs then +--~ for s in utfcharacters(str) do +--~ if n == 1 then +--~ break +--~ else +--~ t = t + 1 +--~ tokens[t] = s +--~ n = n - 1 +--~ end +--~ end +--~ if first then +--~ t = t + 1 +--~ tokens[t] = first +--~ end +--~ first = crs +--~ done = true +--~ else +--~ local cgf = graphemes[first] +--~ if cgf and cgf[second] then +--~ for s in utfcharacters(str) do +--~ if n == 1 then +--~ break +--~ else +--~ t = t + 1 +--~ tokens[t] = s +--~ n = n - 1 +--~ end +--~ end +--~ first = cgf[second] +--~ done = true +--~ else +--~ first = second +--~ n = n + 1 +--~ end +--~ end +--~ end +--~ end +--~ if done then +--~ if first then +--~ t = t + 1 +--~ tokens[t] = first +--~ end +--~ return concat(tokens) -- seldom called +--~ end +--~ elseif nstr > 0 then +--~ return high[str] or str +--~ end +--~ end +--~ return str +--~ end function utffilters.collapse(str) -- not really tested (we could preallocate a table) - if cf.collapsing and str then - if #str > 1 then - if not cf.initialized then -- saves a call - cf.initialize() + if str and str ~= "" then + local nstr = #str + if nstr > 1 then + if initialize then -- saves a call + initialize() end - local tokens, first, done, n = { }, false, false, 0 + local tokens, t, first, done, n = { }, 0, false, false, 0 for second in utfcharacters(str) do if done then - local crs = cr[second] + local crs = high[second] if crs then if first then - tokens[#tokens+1] = first + t = t + 1 + tokens[t] = first end first = crs else @@ -196,26 +338,31 @@ function utffilters.collapse(str) -- not really tested (we could preallocate a t if cgf and cgf[second] then first = cgf[second] elseif first then - tokens[#tokens+1] = first + t = t + 1 + tokens[t] = first first = second else first = second end end else - local crs = cr[second] + local crs = high[second] if crs then for s in utfcharacters(str) do if n == 1 then break else - tokens[#tokens+1], n = s, n - 1 + t = t + 1 + tokens[t] = s + n = n - 1 end end if first then - tokens[#tokens+1] = first + t = t + 1 + tokens[t] = first end - first, done = crs, true + first = crs + done = true else local cgf = graphemes[first] if cgf and cgf[second] then @@ -223,51 +370,116 @@ function utffilters.collapse(str) -- not really tested (we could preallocate a t if n == 1 then break else - tokens[#tokens+1], n = s, n -1 + t = t + 1 + tokens[t] = s + n = n - 1 end end - first, done = cgf[second], true + first = cgf[second] + done = true else - first, n = second, n + 1 + first = second + n = n + 1 + end + end + end + end + if done then + if first then + t = t + 1 + tokens[t] = first + end + return concat(tokens) -- seldom called + end + elseif nstr > 0 then + return high[str] or str + end + end + return str +end + +function utffilters.decompose(str) + if str and str ~= "" then + local nstr = #str + if nstr > 1 then + -- if initialize then -- saves a call + -- initialize() + -- end + local tokens, t, done, n = { }, 0, false, 0 + for s in utfcharacters(str) do + local dec = decomposed[s] + if dec then + if not done then + if n > 0 then + for s in utfcharacters(str) do + if n == 1 then + break + else + t = t + 1 + tokens[t] = s + n = n - 1 + end + end end + done = true end + t = t + 1 + tokens[t] = dec + elseif done then + t = t + 1 + tokens[t] = s + else + n = n + 1 end end if done then - tokens[#tokens+1] = first return concat(tokens) -- seldom called end - elseif #str > 0 then - return cr[str] or str end end return str end +local textfileactions = resolvers.openers.helpers.textfileactions + +utilities.sequencers.appendaction (textfileactions,"system","characters.filters.utf.collapse") +utilities.sequencers.disableaction(textfileactions,"characters.filters.utf.collapse") + +utilities.sequencers.appendaction (textfileactions,"system","characters.filters.utf.decompose") +utilities.sequencers.disableaction(textfileactions,"characters.filters.utf.decompose") + +function characters.filters.utf.enable() + utilities.sequencers.enableaction(textfileactions,"characters.filters.utf.collapse") + utilities.sequencers.enableaction(textfileactions,"characters.filters.utf.decompose") +end + --[[ldx--

Next we implement some commands that are used in the user interface.

--ldx]]-- -commands = commands or { } - -function commands.uchar(first,second) - tex.sprint(ctxcatcodes,utfchar(first*256+second)) -end +-- commands = commands or { } +-- +-- function commands.uchar(first,second) +-- context(utfchar(first*256+second)) +-- end --[[ldx--

A few helpers (used to be luat-uni).

--ldx]]-- -function utf.split(str) - local t = { } - for snippet in utfcharacters(str) do - t[#t+1] = snippet - end - return t -end - -function utf.each(str,fnc) - for snippet in utfcharacters(str) do - fnc(snippet) - end -end +-- obsolete: +-- +-- function utf.split(str) +-- local t, n = { }, 0 +-- for snippet in utfcharacters(str) do +-- n = n + 1 +-- t[n+1] = snippet +-- end +-- return t +-- end +-- +-- function utf.each(str,fnc) +-- for snippet in utfcharacters(str) do +-- fnc(snippet) +-- end +-- end diff --git a/Master/texmf-dist/tex/context/base/char-utf.mkiv b/Master/texmf-dist/tex/context/base/char-utf.mkiv index 16b4029d8cb..2617356567d 100644 --- a/Master/texmf-dist/tex/context/base/char-utf.mkiv +++ b/Master/texmf-dist/tex/context/base/char-utf.mkiv @@ -28,11 +28,18 @@ %D since the source files are rather simple, we postpone the %D initialization till runtime. +% resolvers.filters.install('utf',characters.filters.utf.collapse) + +% \appendtoks +% \ctxlua{ +% local textfileactions = resolvers.openers.helpers.textfileactions +% utilities.sequencers.enableaction(textfileactions,"characters.filters.utf.collapse") +% utilities.sequencers.enableaction(textfileactions,"characters.filters.utf.decompose") +% }% +% \to \everyjob + \appendtoks - \ctxlua { - characters.filters.utf.collapsing = true - resolvers.install_text_filter('utf',characters.filters.utf.collapse) - }% + \ctxlua{characters.filters.utf.enable()}% \to \everyjob %D The next one influences input parsing. @@ -42,6 +49,6 @@ %D \stoptyping \unexpanded\def\definecomposedutf#1 #2 #3 % - {\ctxlua{characters.filters.utf.add_grapheme("#1","#2","#3")}} + {\ctxlua{characters.filters.utf.addgrapheme("#1","#2","#3")}} \protect diff --git a/Master/texmf-dist/tex/context/base/chem-ini.lua b/Master/texmf-dist/tex/context/base/chem-ini.lua index 90874909207..4d47982a220 100644 --- a/Master/texmf-dist/tex/context/base/chem-ini.lua +++ b/Master/texmf-dist/tex/context/base/chem-ini.lua @@ -6,14 +6,19 @@ if not modules then modules = { } end modules ['chem-ini'] = { license = "see context related readme files" } -local format, texsprint = string.format, tex.sprint +local format = string.format local lpegmatch = lpeg.match +local P, R, V, Cc, Cs = lpeg.P, lpeg.R, lpeg.V, lpeg.Cc, lpeg.Cs + local trace_molecules = false trackers.register("chemistry.molecules", function(v) trace_molecules = v end) -local ctxcatcodes = tex.ctxcatcodes +local report_chemistry = logs.reporter("chemistry") + +local context = context -chemicals = chemicals or { } +chemicals = chemicals or { } +local chemicals = chemicals --[[

The next code is an adaptation of code from Wolfgang Schuster @@ -25,38 +30,37 @@ of input then.

-- some lpeg, maybe i'll make an syst-lpg module -local lowercase = lpeg.R("az") -local uppercase = lpeg.R("AZ") -local backslash = lpeg.P("\\") -local csname = backslash * lpeg.P(1) * (1-backslash)^0 -local plus = lpeg.P("+") / "\\textplus " -local minus = lpeg.P("-") / "\\textminus " -local digit = lpeg.R("09") +local lowercase = R("az") +local uppercase = R("AZ") +local backslash = P("\\") +local csname = backslash * P(1) * (1-backslash)^0 +local plus = P("+") / "\\textplus " +local minus = P("-") / "\\textminus " +local digit = R("09") local sign = plus + minus local cardinal = digit^1 local integer = sign^0 * cardinal -local leftbrace = lpeg.P("{") -local rightbrace = lpeg.P("}") +local leftbrace = P("{") +local rightbrace = P("}") local nobrace = 1 - (leftbrace + rightbrace) -local nested = lpeg.P { leftbrace * (csname + sign + nobrace + lpeg.V(1))^0 * rightbrace } -local any = lpeg.P(1) +local nested = P { leftbrace * (csname + sign + nobrace + V(1))^0 * rightbrace } +local any = P(1) -local subscript = lpeg.P("_") -local superscript = lpeg.P("^") +local subscript = P("_") +local superscript = P("^") local somescript = subscript + superscript ---~ local content = lpeg.Cs(nested + integer + sign + any) -local content = lpeg.Cs(csname + nested + sign + any) +local content = Cs(csname + nested + sign + any) -- could be made more efficient -local lowhigh = lpeg.Cc("\\lohi{%s}{%s}") * subscript * content * superscript * content / format -local highlow = lpeg.Cc("\\hilo{%s}{%s}") * superscript * content * subscript * content / format -local low = lpeg.Cc("\\low{%s}") * subscript * content / format -local high = lpeg.Cc("\\high{%s}") * superscript * content / format +local lowhigh = Cc("\\lohi{%s}{%s}") * subscript * content * superscript * content / format +local highlow = Cc("\\hilo{%s}{%s}") * superscript * content * subscript * content / format +local low = Cc("\\low{%s}") * subscript * content / format +local high = Cc("\\high{%s}") * superscript * content / format local justtext = (1 - somescript)^1 -local parser = lpeg.Cs((csname + lowhigh + highlow + low + high + sign + any)^0) +local parser = Cs((csname + lowhigh + highlow + low + high + sign + any)^0) chemicals.moleculeparser = parser -- can be used to avoid functioncall @@ -67,9 +71,9 @@ end function commands.molecule(str) if trace_molecules then local rep = lpegmatch(parser,str) - logs.report("chemistry", "molecule %s => %s",str,rep) - texsprint(ctxcatcodes,rep) + report_chemistry("molecule %s => %s",str,rep) + context(rep) else - texsprint(ctxcatcodes,lpegmatch(parser,str)) + context(lpegmatch(parser,str)) end end diff --git a/Master/texmf-dist/tex/context/base/chem-ini.mkiv b/Master/texmf-dist/tex/context/base/chem-ini.mkiv index 5184fe1a7a0..c64575181db 100644 --- a/Master/texmf-dist/tex/context/base/chem-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/chem-ini.mkiv @@ -35,7 +35,7 @@ %D %D \typebuffer \getbuffer -\def\molecule#1{\ctxlua{commands.molecule(\!!bs#1\!!es)}} +\def\molecule#1{\ctxcommand{molecule(\!!bs#1\!!es)}} %D For old times sake: diff --git a/Master/texmf-dist/tex/context/base/chem-str.lua b/Master/texmf-dist/tex/context/base/chem-str.lua index ad4cc6c1be4..1a6ed4dc213 100644 --- a/Master/texmf-dist/tex/context/base/chem-str.lua +++ b/Master/texmf-dist/tex/context/base/chem-str.lua @@ -13,15 +13,21 @@ if not modules then modules = { } end modules ['chem-str'] = { local trace_structure = false trackers.register("chemistry.structure", function(v) trace_structure = v end) local trace_textstack = false trackers.register("chemistry.textstack", function(v) trace_textstack = v end) +local report_chemistry = logs.reporter("chemistry") + local format, gmatch, match, lower, gsub = string.format, string.gmatch, string.match, string.lower, string.gsub local concat, insert, remove = table.concat, table.insert, table.remove -local apply = structure.processors.apply -local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes +local apply = structures.processors.apply local lpegmatch = lpeg.match +local settings_to_array = utilities.parsers.settings_to_array + +local P, R, S, C, Cs, Ct, Cc = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Ct, lpeg.Cc local variables = interfaces.variables +local context = context chemicals = chemicals or { } +local chemicals = chemicals chemicals.instance = "metafun" -- "ppchtex" chemicals.format = "metafun" @@ -150,53 +156,52 @@ function chemicals.define(name,spec,text) local dn = definitions[name] if not dn then dn = { } definitions[name] = dn end dn[#dn+1] = { - spec = aux.settings_to_array(lower(spec)), - text = aux.settings_to_array(text), + spec = settings_to_array(lower(spec)), + text = settings_to_array(text), } end -local metacode, kind, keys, bonds, max, txt, textsize, rot, pstack +local metacode, variant, keys, bonds, max, txt, textsize, rot, pstack local molecule = chemicals.molecule -- or use lpegmatch(chemicals.moleculeparser,...) local function fetch(txt) local st = stack[txt] local t = st.text[st.n] ---~ st.n = st.n + 1 while not t and txt > 1 do txt = txt - 1 st = stack[txt] t = st.text[st.n] ---~ st.n = st.n + 1 end if t then if trace_textstack then - logs.report("chemical", "fetching from stack %s slot %s: %s",txt,st.n,t) + report_chemistry("fetching from stack %s slot %s: %s",txt,st.n,t) end -st.n = st.n + 1 + st.n = st.n + 1 end return txt, t end -local digit = lpeg.R("09")/tonumber -local colon = lpeg.P(":") -local equal = lpeg.P("=") +local digit = R("09")/tonumber +local colon = P(":") +local equal = P("=") local other = 1 - digit - colon - equal -local remapped = lpeg.S("+-") / remapper -local operation = lpeg.Cs((remapped^0 * other)^1) +local remapped = S("+-") / remapper +local operation = Cs((remapped^0 * other)^1) local amount = digit local single = digit -local special = (colon * lpeg.C(other^1)) + lpeg.Cc("") -local range = digit * lpeg.P("..") * digit -local set = lpeg.Ct(digit^2) -local text = (equal * lpeg.C(lpeg.P(1)^0)) + lpeg.Cc(false) +local special = (colon * C(other^1)) + Cc("") +local range = digit * P("..") * digit +local set = Ct(digit^2) +local text = (equal * C(P(1)^0)) + Cc(false) + local pattern = - (amount + lpeg.Cc(1)) * + (amount + Cc(1)) * operation * special * ( - range * lpeg.Cc(false) * text + - lpeg.Cc(false) * lpeg.Cc(false) * set * text + - single * lpeg.Cc(false) * lpeg.Cc(false) * text + - lpeg.Cc(false) * lpeg.Cc(false) * lpeg.Cc(false) * text + range * Cc(false) * text + + Cc(false) * Cc(false) * set * text + + single * Cc(false) * Cc(false) * text + + Cc(false) * Cc(false) * Cc(false) * text ) --~ local n, operation, index, upto, set, text = lpegmatch(pattern,"RZ1357") @@ -209,6 +214,7 @@ local pattern = local function process(spec,text,n,rulethickness,rulecolor,offset) insert(stack,{ spec=spec, text=text, n=n }) local txt = #stack + local m = #metacode for i=1,#spec do local s = spec[i] local d = definitions[s] @@ -220,8 +226,8 @@ local function process(spec,text,n,rulethickness,rulecolor,offset) else local rep, operation, special, index, upto, set, text = lpegmatch(pattern,s) if operation == "pb" then - insert(pstack,kind) - metacode[#metacode+1] = syntax.pb.direct + insert(pstack,variant) + m = m + 1 ; metacode[m] = syntax.pb.direct if keys[special] == "text" and index then if keys["c"..special] == "text" then -- can be option: auto ... metacode[#metacode+1] = format('chem_c%s(%s,%s,"");',special,bonds,index) @@ -230,22 +236,22 @@ local function process(spec,text,n,rulethickness,rulecolor,offset) end end elseif operation == "save" then - insert(pstack,kind) - metacode[#metacode+1] = syntax.save.direct + insert(pstack,variant) + m = m + 1 ; metacode[m] = syntax.save.direct elseif operation == "pe" or operation == "restore" then - kind = remove(pstack) - local ss = syntax[kind] + variant = remove(pstack) + local ss = syntax[variant] local prev = bonds or 6 keys, bonds, max, rot = ss.keys, ss.n, ss.max, 1 - metacode[#metacode+1] = syntax[operation].direct - metacode[#metacode+1] = format("chem_set(%s,%s) ;",prev,bonds) + m = m + 1 ; metacode[m] = syntax[operation].direct + m = m + 1 ; metacode[m] = format("chem_set(%s,%s) ;",prev,bonds) elseif operation == "front" then - if syntax[kind .. "_front"] then - kind = kind .. "_front" - local ss = syntax[kind] + if syntax[variant .. "_front"] then + variant = variant .. "_front" + local ss = syntax[variant] local prev = bonds or 6 keys, bonds, max, rot = ss.keys, ss.n, ss.max, 1 - metacode[#metacode+1] = format("chem_set(%s,%s) ;",prev,bonds) + m = m + 1 ; metacode[m] = format("chem_set(%s,%s) ;",prev,bonds) end elseif operation then local ss = syntax[operation] @@ -255,18 +261,18 @@ local function process(spec,text,n,rulethickness,rulecolor,offset) local sa = ss.arguments if sa == 1 then local one ; txt, one = fetch(txt) - metacode[#metacode+1] = format(ds,one or "") + m = m + 1 ; metacode[m] = format(ds,one or "") elseif sa ==2 then local one ; txt, one = fetch(txt) local two ; txt, two = fetch(txt) - metacode[#metacode+1] = format(ds,one or "",two or "") + m = m + 1 ; metacode[m] = format(ds,one or "",two or "") else - metacode[#metacode+1] = ds + m = m + 1 ; metacode[m] = ds end elseif ss.keys then local prev = bonds or 6 - kind, keys, bonds, max, rot = s, ss.keys, ss.n, ss.max, 1 - metacode[#metacode+1] = format("chem_set(%s,%s) ;",prev,bonds) + variant, keys, bonds, max, rot = s, ss.keys, ss.n, ss.max, 1 + m = m + 1 ; metacode[m] = format("chem_set(%s,%s) ;",prev,bonds) end else local what = keys[operation] @@ -274,35 +280,35 @@ local function process(spec,text,n,rulethickness,rulecolor,offset) if set then for i=1,#set do local si = set[i] - metacode[#metacode+1] = format("chem_%s(%s,%s,%s,%s,%s);",operation,bonds,si,si,rulethickness,rulecolor) + m = m + 1 ; metacode[m] = format("chem_%s(%s,%s,%s,%s,%s);",operation,bonds,si,si,rulethickness,rulecolor) end elseif upto then - metacode[#metacode+1] = format("chem_%s(%s,%s,%s,%s,%s);",operation,bonds,index,upto,rulethickness,rulecolor) + m = m + 1 ; metacode[m] = format("chem_%s(%s,%s,%s,%s,%s);",operation,bonds,index,upto,rulethickness,rulecolor) elseif index then - metacode[#metacode+1] = format("chem_%s(%s,%s,%s,%s,%s);",operation,bonds,index,index,rulethickness,rulecolor) + m = m + 1 ; metacode[m] = format("chem_%s(%s,%s,%s,%s,%s);",operation,bonds,index,index,rulethickness,rulecolor) else - metacode[#metacode+1] = format("chem_%s(%s,%s,%s,%s,%s);",operation,bonds,1,max,rulethickness,rulecolor) + m = m + 1 ; metacode[m] = format("chem_%s(%s,%s,%s,%s,%s);",operation,bonds,1,max,rulethickness,rulecolor) end elseif what == "number" then if set then for i=1,#set do local si = set[i] - metacode[#metacode+1] = format('chem_%s(%s,%s,"\\dochemicaltext{%s}");',operation,bonds,si,si) + m = m + 1 ; metacode[m] = format('chem_%s(%s,%s,"\\dochemicaltext{%s}");',operation,bonds,si,si) end elseif upto then for i=index,upto do local si = set[i] - metacode[#metacode+1] = format('chem_%s(%s,%s,"\\dochemicaltext{%s}");',operation,bonds,si,si) + m = m + 1 ; metacode[m] = format('chem_%s(%s,%s,"\\dochemicaltext{%s}");',operation,bonds,si,si) end elseif index then - metacode[#metacode+1] = format('chem_%s(%s,%s,"\\dochemicaltext{%s}");',operation,bonds,index,index) + m = m + 1 ; metacode[m] = format('chem_%s(%s,%s,"\\dochemicaltext{%s}");',operation,bonds,index,index) else for i=1,max do - metacode[#metacode+1] = format('chem_%s(%s,%s,"\\dochemicaltext{%s}");',operation,bonds,i,i) + m = m + 1 ; metacode[m] = format('chem_%s(%s,%s,"\\dochemicaltext{%s}");',operation,bonds,i,i) end end elseif what == "text" then - local align = syntax[kind].align + local align = syntax[variant].align align = align and align[operation] align = align and align[rot] if set then @@ -313,7 +319,7 @@ local function process(spec,text,n,rulethickness,rulecolor,offset) if t then local a = align and align[si] if a then a = "." .. a else a = "" end - metacode[#metacode+1] = format('chem_%s%s(%s,%s,"\\dochemicaltext{%s}");',operation,a,bonds,si,molecule(apply(t))) + m = m + 1 ; metacode[m] = format('chem_%s%s(%s,%s,"\\dochemicaltext{%s}");',operation,a,bonds,si,molecule(apply(t))) end end elseif upto then @@ -323,14 +329,14 @@ local function process(spec,text,n,rulethickness,rulecolor,offset) if t then local s = align and align[i] if s then s = "." .. s else s = "" end - metacode[#metacode+1] = format('chem_%s%s(%s,%s,"\\dochemicaltext{%s}");',operation,s,bonds,i,molecule(apply(t))) + m = m + 1 ; metacode[m] = format('chem_%s%s(%s,%s,"\\dochemicaltext{%s}");',operation,s,bonds,i,molecule(apply(t))) end end elseif index == 0 then local t = text if not t then txt, t = fetch(txt) end if t then - metacode[#metacode+1] = format('chem_%s_zero("\\dochemicaltext{%s}");',operation,molecule(apply(t))) + m = m + 1 ; metacode[m] = format('chem_%s_zero("\\dochemicaltext{%s}");',operation,molecule(apply(t))) end elseif index then local t = text @@ -338,7 +344,7 @@ local function process(spec,text,n,rulethickness,rulecolor,offset) if t then local s = align and align[index] if s then s = "." .. s else s = "" end - metacode[#metacode+1] = format('chem_%s%s(%s,%s,"\\dochemicaltext{%s}");',operation,s,bonds,index,molecule(apply(t))) + m = m + 1 ; metacode[m] = format('chem_%s%s(%s,%s,"\\dochemicaltext{%s}");',operation,s,bonds,index,molecule(apply(t))) end else for i=1,max do @@ -347,21 +353,21 @@ local function process(spec,text,n,rulethickness,rulecolor,offset) if t then local s = align and align[i] if s then s = "." .. s else s = "" end - metacode[#metacode+1] = format('chem_%s%s(%s,%s,"\\dochemicaltext{%s}");',operation,s,bonds,i,molecule(apply(t))) + m = m + 1 ; metacode[m] = format('chem_%s%s(%s,%s,"\\dochemicaltext{%s}");',operation,s,bonds,i,molecule(apply(t))) end end end elseif what == "transform" then if index then for r=1,rep do - metacode[#metacode+1] = format('chem_%s(%s,%s);',operation,bonds,index) + m = m + 1 ; metacode[m] = format('chem_%s(%s,%s);',operation,bonds,index) end if operation == "rot" then rot = index end end elseif what == "fixed" then - metacode[#metacode+1] = format("chem_%s(%s,%s,%s);",operation,bonds,rulethickness,rulecolor) + m = m + 1 ; metacode[m] = format("chem_%s(%s,%s,%s);",operation,bonds,rulethickness,rulecolor) end end end @@ -434,14 +440,14 @@ function chemicals.start(settings) l/25, r/25, t/25, b/25, scale, tostring(settings.axis == variables.on), tostring(width), tostring(height), tostring(offset) ) } - kind, keys, bonds, stack, rot, pstack = "six", { }, 6, { }, 1, { } + variant, keys, bonds, stack, rot, pstack = "six", { }, 6, { }, 1, { } end function chemicals.stop() metacode[#metacode+1] = "chem_stop_structure ;" local mpcode = concat(metacode,"\n") if trace_structure then - logs.report("chemical", "metapost code:\n%s", mpcode) + report_chemistry("metapost code:\n%s", mpcode) end metapost.graphic(chemicals.instance,chemicals.format,mpcode) metacode = nil @@ -449,8 +455,8 @@ end function chemicals.component(spec,text,settings) rulethickness, rulecolor, offset = settings.rulethickness, settings.rulecolor - local spec = aux.settings_to_array(lower(spec)) - local text = aux.settings_to_array(text) + local spec = settings_to_array(lower(spec)) + local text = settings_to_array(text) metacode[#metacode+1] = "chem_start_component ;" process(spec,text,1,rulethickness,rulecolor) metacode[#metacode+1] = "chem_stop_component ;" @@ -471,14 +477,14 @@ local inline = { -- todo: top / bottom function chemicals.inline(spec) - local spec = aux.settings_to_array(spec) + local spec = settings_to_array(spec) for i=1,#spec do local s = spec[i] local inl = inline[lower(s)] if inl then - texsprint(ctxcatcodes,inl) + context(inl) else - texsprint(ctxcatcodes,format("\\chemicalinline{%s}",molecule(s))) + context.chemicalinline(molecule(s)) end end end diff --git a/Master/texmf-dist/tex/context/base/chem-str.mkiv b/Master/texmf-dist/tex/context/base/chem-str.mkiv index 1e17218c875..6430830f73a 100644 --- a/Master/texmf-dist/tex/context/base/chem-str.mkiv +++ b/Master/texmf-dist/tex/context/base/chem-str.mkiv @@ -91,9 +91,6 @@ {\dosetfontattribute \??cm\c!style \dosetcolorattribute\??cm\c!color} -\def\dochemicaltext#1% - {\dosetchemicaltext\strut#1} % maybe also \setstrut - \edef\chemicaltoplocation{t} \edef\chemicalbotlocation{b} @@ -316,9 +313,24 @@ \unexpanded\def\chemicaltopright #1{\chemicalright{\chemicallefttop {#1}{}}} \unexpanded\def\chemicalbottomright #1{\chemicalright{\chemicalleftbottom {#1}{}}} -\unexpanded\def\chemicalcentered #1{\setbox\scratchbox\hbox{C}\hbox to \wd\scratchbox{\setstrut\strut\hss#1\hss}} -\unexpanded\def\chemicalleftcentered #1{\setbox\scratchbox\hbox{C}\hbox to \wd\scratchbox{\setstrut\strut #1\hss}} -\unexpanded\def\chemicalrightcentered#1{\setbox\scratchbox\hbox{C}\hbox to \wd\scratchbox{\setstrut\strut\hss#1}} +% \unexpanded\def\chemicalcentered #1{\hbox to \fontcharwd\font`C{\setstrut\strut\hss#1\hss}} +% \unexpanded\def\chemicalleftcentered #1{\hbox to \fontcharwd\font`C{\setstrut\strut #1\hss}} +% \unexpanded\def\chemicalrightcentered#1{\hbox to \fontcharwd\font`C{\setstrut\strut\hss#1}} + +% \let\chemicalsmashedmiddle\chemicalcentered +% \let\chemicalsmashedleft \chemicalleftcentered +% \let\chemicalsmashedright \chemicalrightcentered + +\unexpanded\def\chemicalalignedtext#1#2#3% + {\dontleavehmode + \begingroup + \dosetchemicaltext + \hbox to \fontcharwd\font`C{\setstrut\strut#1\molecule{#3}#2}% + \endgroup} + +\unexpanded\def\chemicalcentered {\chemicalalignedtext\hss \hss } +\unexpanded\def\chemicalleftcentered {\chemicalalignedtext\relax\hss } +\unexpanded\def\chemicalrightcentered{\chemicalalignedtext\hss \relax} \let\chemicalsmashedmiddle\chemicalcentered \let\chemicalsmashedleft \chemicalleftcentered @@ -391,6 +403,7 @@ {\the\everychemical \everychemical\emptytoks \quad \vcenter\bgroup + \dosetchemicaltext \ifthirdargument \ifsecondargument \halign{&\hss##\hss\cr#2\cr\molecule{#1}\cr#3\cr}% @@ -404,7 +417,7 @@ \quad} \def\inlinechemical#1% - {\dontleavehmode\hbox{\ctxlua{chemicals.inline(\!!bs#1\!!es)}}} + {\dontleavehmode\hbox{\dosetchemicaltext\ctxlua{chemicals.inline(\!!bs#1\!!es)}}} \def\chemicalbondrule{\hbox{\vrule\!!height.75ex\!!depth-\dimexpr.75ex-\linewidth\relax\!!width1em\relax}} @@ -458,15 +471,15 @@ \nointerlineskip \ifconditional\formulachemicalhastop \ifconditional\formulachemicalhasbot - \halign{&\hss##\hss\cr\the\formulachemicaltop\cr\the\formulachemicalmid\cr\the\formulachemicalbot\cr}% + \halign{&\hss\dosetchemicaltext##\hss\cr\the\formulachemicaltop\cr\the\formulachemicalmid\cr\the\formulachemicalbot\cr}% \else - \halign{&\hss##\hss\cr\the\formulachemicaltop\cr\the\formulachemicalmid\cr}% + \halign{&\hss\dosetchemicaltext##\hss\cr\the\formulachemicaltop\cr\the\formulachemicalmid\cr}% \fi \else \ifconditional\formulachemicalhasbot - \halign{&\hss##\hss\cr\the\formulachemicalmid\cr\the\formulachemicalbot\cr}% + \halign{&\hss\dosetchemicaltext##\hss\cr\the\formulachemicalmid\cr\the\formulachemicalbot\cr}% \else - \halign{&\hss##\hss\cr\the\formulachemicalmid\cr}% + \halign{&\hss\dosetchemicaltext##\hss\cr\the\formulachemicalmid\cr}% \fi \fi \egroup} @@ -474,7 +487,7 @@ \unexpanded\def\formulachemical {\relax\dotriplegroupempty\doformulachemical} -\def\doformulachemical#1#2#3% +\def\doformulachemical#1#2#3% we could do hboxes and measure {\ifthirdargument \doifelsenothing{#2}\noformulachemicaltop{\doformulachemicaltop{#2}}% \doifelsenothing{#3}\noformulachemicalbot{\doformulachemicalbot{#3}}% diff --git a/Master/texmf-dist/tex/context/base/cldf-com.lua b/Master/texmf-dist/tex/context/base/cldf-com.lua new file mode 100644 index 00000000000..e966b167b20 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cldf-com.lua @@ -0,0 +1,105 @@ +if not modules then modules = { } end modules ['cldf-com'] = { + version = 1.001, + comment = "companion to cldf-com.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local tostring, type = tostring, type +local format = string.format + +local context = context +local generics = context.generics +local variables = interfaces.variables + +generics.starttabulate = "start" .. variables.tabulate -- todo: e!start +generics.stoptabulate = "stop" .. variables.tabulate -- todo: e!stop + +local NC, NR = context.NC, context.NR + +local function tabulaterow(how,...) + local t = { ... } + for i=1,#t do + local ti = tostring(t[i]) + NC() + if how then + context[how](ti) + else + context(ti) + end + end + NC() + NR() +end + +function context.tabulaterow (...) tabulaterow(false, ...) end +function context.tabulaterowbold(...) tabulaterow("bold",...) end +function context.tabulaterowtype(...) tabulaterow("type",...) end +function context.tabulaterowtyp (...) tabulaterow("typ", ...) end + +-- these will move up, just after cld definitions + +function context.char(k) -- todo: if catcode == letter or other then just the utf + if type(k) == "table" then + for i=1,#k do + context(format([[\char%s\relax]],k[i])) + end + elseif k then + context(format([[\char%s\relax]],k)) + end +end + +function context.utfchar(k) + context(utfchar(k)) +end + +-- plain variants + +function context.chardef(cs,u) + context(format([[\chardef\%s=%s\relax]],k)) -- context does already do format +end + +function context.par() + context([[\par]]) -- no need to add {} there +end + +function context.bgroup() + context("{") +end + +function context.egroup() + context("}") +end + +local rule = nodes.pool.rule + +function context.hrule(w,h,d,dir) + if type(w) == "table" then + context(rule(w.width,w.height,w.depth,w.dir)) + else + context(rule(w,h,d,dir)) + end +end + +context.vrule = context.hrule + +--~ local hbox, bgroup, egroup = context.hbox, context.bgroup, context.egroup + +--~ function context.hbox(a,...) +--~ if type(a) == "table" then +--~ local s = { } +--~ if a.width then +--~ s[#s+1] = "to " .. a.width -- todo: check for number +--~ elseif a.spread then +--~ s[#s+1] = "spread " .. a.spread -- todo: check for number +--~ end +--~ -- todo: dir, attr etc +--~ hbox(false,table.concat(s," ")) +--~ bgroup() +--~ context(string.format(...)) +--~ egroup() +--~ else +--~ hbox(a,...) +--~ end +--~ end diff --git a/Master/texmf-dist/tex/context/base/cldf-com.mkiv b/Master/texmf-dist/tex/context/base/cldf-com.mkiv new file mode 100644 index 00000000000..43071a58053 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cldf-com.mkiv @@ -0,0 +1,19 @@ +%D \module +%D [ file=cldf-com, +%D version=2010.10.19,, +%D title=\CONTEXT\ \LUA\ Document Functions, +%D subtitle=Initialization, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=Hans Hagen] +%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 Lua Documents / Functions} + +\registerctxluafile{cldf-com}{1.001} +\registerctxluafile{cldf-ver}{1.001} + +\endinput diff --git a/Master/texmf-dist/tex/context/base/cldf-ini.lua b/Master/texmf-dist/tex/context/base/cldf-ini.lua new file mode 100644 index 00000000000..8edc0502321 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cldf-ini.lua @@ -0,0 +1,755 @@ +if not modules then modules = { } end modules ['cldf-ini'] = { + version = 1.001, + comment = "companion to cldf-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- This is an experiment: generating context code at the lua end. After all +-- it is surprisingly simple to implement due to metatables. I was wondering +-- if there was a more natural way to deal with commands at the lua end. +-- Of course it's a bit slower but often more readable when mixed with lua +-- code. It can also be handy when generating documents from databases or +-- when constructing large tables or so. +-- +-- Todo: optional checking against interface +-- Todo: coroutine trickery +-- Todo: maybe use txtcatcodes + +-- tflush needs checking ... sort of weird that it's not a table + +-- __flushlines is an experiment and rather ugly so it will go away + +local tex = tex + +context = context or { } +local context = context + +local format, find, gmatch, splitlines = string.format, string.find, string.gmatch, string.splitlines +local next, type, tostring, setmetatable = next, type, tostring, setmetatable +local insert, remove, concat = table.insert, table.remove, table.concat +local lpegmatch = lpeg.match + +local texsprint = tex.sprint +local textprint = tex.tprint +local texprint = tex.print +local texiowrite = texio.write +local texcount = tex.count + +local isnode = node.is_node -- after 0.65 just node.type +local writenode = node.write +local copynodelist = node.copy_list + +local ctxcatcodes = tex.ctxcatcodes +local prtcatcodes = tex.prtcatcodes +local texcatcodes = tex.texcatcodes +local txtcatcodes = tex.txtcatcodes +local vrbcatcodes = tex.vrbcatcodes +local xmlcatcodes = tex.xmlcatcodes + +local flush = texsprint + +local report_context = logs.reporter("cld","tex") +local report_cld = logs.reporter("cld","stack") + +local processlines = true -- experiments.register("context.processlines", function(v) processlines = v end) + +-- for tracing it's easier to have two stacks + +local _stack_f_, _n_f_ = { }, 0 +local _stack_n_, _n_n_ = { }, 0 + +local function _store_f_(ti) + _n_f_ = _n_f_ + 1 + _stack_f_[_n_f_] = ti + return _n_f_ +end + +local function _store_n_(ti) + _n_n_ = _n_n_ + 1 + _stack_n_[_n_n_] = ti + return _n_n_ +end + +local function _flush_f_(n) + local sn = _stack_f_[n] + if not sn then + report_cld("data with id %s cannot be found on stack",n) + else + local tn = type(sn) + if tn == "function" then + if not sn() and texcount["@@trialtypesetting"] == 0 then -- @@trialtypesetting is private! + _stack_f_[n] = nil + else + -- keep, beware, that way the stack can grow + end + else + if texcount["@@trialtypesetting"] == 0 then -- @@trialtypesetting is private! + writenode(sn) + _stack_f_[n] = nil + else + writenode(copynodelist(sn)) + -- keep, beware, that way the stack can grow + end + end + end +end + +local function _flush_n_(n) + local sn = _stack_n_[n] + if not sn then + report_cld("data with id %s cannot be found on stack",n) + elseif texcount["@@trialtypesetting"] == 0 then -- @@trialtypesetting is private! + writenode(sn) + _stack_n_[n] = nil + else + writenode(copynodelist(sn)) + -- keep, beware, that way the stack can grow + end +end + +function context.restart() + _stack_f_, _n_f_ = { }, 0 + _stack_n_, _n_n_ = { }, 0 +end + +context._stack_f_ = _stack_f_ +context._store_f_ = _store_f_ +context._flush_f_ = _flush_f_ _cldf_ = _flush_f_ + +context._stack_n_ = _stack_n_ +context._store_n_ = _store_n_ +context._flush_n_ = _flush_n_ _cldn_ = _flush_n_ + +-- Should we keep the catcodes with the function? + +local catcodestack = { } +local currentcatcodes = ctxcatcodes +local contentcatcodes = ctxcatcodes + +local catcodes = { + ctx = ctxcatcodes, ctxcatcodes = ctxcatcodes, context = ctxcatcodes, + prt = prtcatcodes, prtcatcodes = prtcatcodes, protect = prtcatcodes, + tex = texcatcodes, texcatcodes = texcatcodes, plain = texcatcodes, + txt = txtcatcodes, txtcatcodes = txtcatcodes, text = txtcatcodes, + vrb = vrbcatcodes, vrbcatcodes = vrbcatcodes, verbatim = vrbcatcodes, + xml = xmlcatcodes, xmlcatcodes = xmlcatcodes, +} + +function context.pushcatcodes(c) + insert(catcodestack,currentcatcodes) + currentcatcodes = (c and catcodes[c] or tonumber(c)) or currentcatcodes + contentcatcodes = currentcatcodes +end + +function context.popcatcodes() + currentcatcodes = remove(catcodestack) or currentcatcodes + contentcatcodes = currentcatcodes +end + +function tex.fprint(...) -- goodie + texsprint(currentcatcodes,format(...)) +end + +-- -- -- todo: tracing + +local newline = lpeg.patterns.newline +local space = lpeg.patterns.spacer +local spacing = newline * space^0 +local content = lpeg.C((1-spacing)^1) +local emptyline = space^0 * newline^2 +local endofline = space^0 * newline * space^0 +local simpleline = endofline * lpeg.P(-1) + +local function n_content(s) + flush(contentcatcodes,s) +end + +local function n_endofline() + texsprint(" \r") +end + +local function n_emptyline() + texprint("\r") +end + +local function n_simpleline() + texprint("\r") +end + +function lpeg.texlinesplitter(f_content,f_endofline,f_emptyline,f_simpleline) + local splitlines = + simpleline / (f_simpleline or n_simpleline) + + ( + emptyline / (f_emptyline or n_emptyline) + + endofline / (f_endofline or n_emptyline) + + content / (f_content or n_content) + )^0 + return function(str) return lpegmatch(splitlines,str) end +end + +local flushlines = lpeg.texlinesplitter(n_content,n_endofline,n_emptyline,n_simpleline) + +context.__flushlines = flushlines -- maybe context.helpers.flushtexlines +context.__flush = flush + +local printlines_ctx = ( + (newline) / function() texprint("") end + + (1-newline)^1 / function(s) texprint(ctxcatcodes,s) end * newline^-1 +)^0 + +local printlines_raw = ( + (newline) / function() texprint("") end + + (1-newline)^1 / function(s) texprint(s) end * newline^-1 +)^0 + +function context.printlines(str,raw) + if raw then + lpegmatch(printlines_raw,str) + else + lpegmatch(printlines_ctx,str) + end +end + +-- -- -- + +local methodhandler = resolvers.methodhandler + +function context.viafile(data) + -- this is the only way to deal with nested buffers + -- and other catcode sensitive data + if data and data ~= "" then + local filename = resolvers.savers.byscheme("virtual","viafile",data) + context.input(filename) + end +end + +-- -- -- + +local function writer(parent,command,first,...) + local t = { first, ... } + flush(currentcatcodes,command) -- todo: ctx|prt|texcatcodes + local direct = false + for i=1,#t do + local ti = t[i] + local typ = type(ti) + if direct then + if typ == "string" or typ == "number" then + flush(currentcatcodes,ti) + else -- node.write + report_context("error: invalid use of direct in '%s', only strings and numbers can be flushed directly, not '%s'",command,typ) + end + direct = false + elseif ti == nil then + -- nothing + elseif ti == "" then + flush(currentcatcodes,"{}") + elseif typ == "string" then + if processlines and find(ti,"[\n\r]") then -- we can check for ti == "\n" + flush(currentcatcodes,"{") + local flushlines = parent.__flushlines or flushlines + flushlines(ti) + flush(currentcatcodes,"}") + elseif currentcatcodes == contentcatcodes then + flush(currentcatcodes,"{",ti,"}") + else + flush(currentcatcodes,"{") + flush(contentcatcodes,ti) + flush(currentcatcodes,"}") + end + elseif typ == "number" then + -- numbers never have funny catcodes + flush(currentcatcodes,"{",ti,"}") + elseif typ == "table" then + local tn = #ti + if tn == 0 then + local done = false + for k, v in next, ti do + if done then + if v == "" then + flush(currentcatcodes,",",k,'=') + else + flush(currentcatcodes,",",k,'=',v) + end + else + if v == "" then + flush(currentcatcodes,"[",k,'=') + else + flush(currentcatcodes,"[",k,'=',v) + end + done = true + end + end + flush(currentcatcodes,"]") + elseif tn == 1 then -- some 20% faster than the next loop + local tj = ti[1] + if type(tj) == "function" then + flush(currentcatcodes,"[\\cldf{",_store_f_(tj),"}]") + else + flush(currentcatcodes,"[",tj,"]") + end + else -- is concat really faster than flushes here? probably needed anyway (print artifacts) + for j=1,tn do + local tj = ti[j] + if type(tj) == "function" then + ti[j] = "\\cldf{" .. _store_f_(tj) .. "}" + end + end + flush(currentcatcodes,"[",concat(ti,","),"]") + end + elseif typ == "function" then + flush(currentcatcodes,"{\\cldf{",_store_f_(ti),"}}") -- todo: ctx|prt|texcatcodes + elseif typ == "boolean" then + if ti then + -- flush(currentcatcodes,"^^M") + texprint("") + else + direct = true + end + elseif typ == "thread" then + report_context("coroutines not supported as we cannot yield across boundaries") + elseif isnode(ti) then -- slow + flush(currentcatcodes,"{\\cldn{",_store_n_(ti),"}}") + else + report_context("error: '%s' gets a weird argument '%s'",command,tostring(ti)) + end + end +end + +local generics = { } context.generics = generics + +local function indexer(parent,k) + local c = "\\" .. tostring(generics[k] or k) + local f = function(first,...) + if first == nil then + flush(currentcatcodes,c) + else + return writer(parent,c,first,...) + end + end + parent[k] = f + return f +end + +local function caller(parent,f,a,...) + if not parent then + -- so we don't need to test in the calling (slower but often no issue) (will go) + elseif f ~= nil then + local typ = type(f) + if typ == "string" then + if a then + flush(contentcatcodes,format(f,a,...)) -- was currentcatcodes + elseif processlines and find(f,"[\n\r]") then + local flushlines = parent.__flushlines or flushlines + flushlines(f) + else + flush(contentcatcodes,f) + end + elseif typ == "number" then + if a then + flush(currentcatcodes,f,a,...) + else + flush(currentcatcodes,f) + end + elseif typ == "function" then + -- ignored: a ... + flush(currentcatcodes,"{\\cldf{",_store_f_(f),"}}") -- todo: ctx|prt|texcatcodes + elseif typ == "boolean" then + if f then + if a ~= nil then + local flushlines = parent.__flushlines or flushlines + flushlines(f) + -- ignore ... maybe some day + else + -- flush(currentcatcodes,"^^M") + texprint("") + end + else + if a ~= nil then + -- no command, same as context(a,...) + writer(parent,"",a,...) + else + -- ignored + end + end + elseif typ == "thread" then + report_context("coroutines not supported as we cannot yield across boundaries") + elseif isnode(f) then -- slow + -- writenode(f) + flush(currentcatcodes,"\\cldn{",_store_n_(f),"}") + else + report_context("error: 'context' gets a weird argument '%s'",tostring(f)) + end + end +end + +local defaultcaller = caller + +setmetatable(context, { __index = indexer, __call = caller } ) + +-- now we tweak unprotect and protect + +function context.unprotect() + -- at the lua end + insert(catcodestack,currentcatcodes) + currentcatcodes = prtcatcodes + contentcatcodes = currentcatcodes + -- at the tex end + flush("\\unprotect") +end + +function context.protect() + -- at the tex end + flush("\\protect") + -- at the lua end + currentcatcodes = remove(catcodestack) or currentcatcodes + contentcatcodes = currentcatcodes +end + +-- logging + +local trace_stack = { } + +local normalflush = flush +local normalwriter = writer +local currenttrace = nil +local nofwriters = 0 +local nofflushes = 0 + +statistics.register("traced context", function() + if nofwriters > 0 or nofflushes > 0 then + return format("writers: %s, flushes: %s, maxstack: %s",nofwriters,nofflushes,_n_f_) + end +end) + +local tracedwriter = function(parent,...) + nofwriters = nofwriters + 1 + local t, f, n = { "w : " }, flush, 0 + flush = function(...) + n = n + 1 + t[n] = concat({...},"",2) + normalflush(...) + end + normalwriter(parent,...) + flush = f + currenttrace(concat(t)) +end + +local tracedflush = function(...) + nofflushes = nofflushes + 1 + normalflush(...) + local t = { ... } + t[1] = "f : " -- replaces the catcode + for i=2,#t do + local ti = t[i] + local tt = type(ti) + if tt == "string" then + -- ok + elseif tt == "number" then + -- ok + else + t[i] = format("<%s>",tostring(ti)) + end + -- currenttrace(format("%02i: %s",i-1,tostring(t[i]))) + end + currenttrace(concat(t)) +end + +local function pushlogger(trace) + insert(trace_stack,currenttrace) + currenttrace = trace + flush, writer = tracedflush, tracedwriter + context.__flush = flush +end + +local function poplogger() + currenttrace = remove(trace_stack) + if not currenttrace then + flush, writer = normalflush, normalwriter + context.__flush = flush + end +end + +local function settracing(v) + if v then + pushlogger(report_context) + else + poplogger() + end +end + +-- todo: share flushers so that we can define in other files + +trackers.register("context.trace",settracing) + +context.pushlogger = pushlogger +context.poplogger = poplogger +context.settracing = settracing + +local trace_cld = false trackers.register("context.files", function(v) trace_cld = v end) + +function context.runfile(filename) + local foundname = resolvers.findtexfile(file.addsuffix(filename,"cld")) or "" + if foundname ~= "" then + local ok = dofile(foundname) + if type(ok) == "function" then + if trace_cld then + report_context("begin of file '%s' (function call)",foundname) + end + ok() + if trace_cld then + report_context("end of file '%s' (function call)",foundname) + end + elseif ok then + report_context("file '%s' is processed and returns true",foundname) + else + report_context("file '%s' is processed and returns nothing",foundname) + end + else + report_context("unknown file '%s'",filename) + end +end + +-- some functions + +function context.direct(first,...) + if first ~= nil then + return writer(context,"",first,...) + end +end + +-- context.delayed (todo: lines) + +local delayed = { } context.delayed = delayed -- maybe also store them + +local function indexer(parent,k) + local f = function(...) + local a = { ... } + return function() + return context[k](unpack(a)) + end + end + parent[k] = f + return f +end + +local function caller(parent,...) -- todo: nodes + local a = { ... } + return function() + return context(unpack(a)) + end +end + +setmetatable(delayed, { __index = indexer, __call = caller } ) + +-- context.nested (todo: lines) + +local nested = { } context.nested = nested + +local function indexer(parent,k) + local f = function(...) + local t, savedflush, n = { }, flush, 0 + flush = function(c,f,s,...) -- catcodes are ignored + n = n + 1 + t[n] = s and concat{f,s,...} or f -- optimized for #args == 1 + end + context[k](...) + flush = savedflush + return concat(t) + end + parent[k] = f + return f +end + +local function caller(parent,...) + local t, savedflush, n = { }, flush, 0 + flush = function(c,f,s,...) -- catcodes are ignored + n = n + 1 + t[n] = s and concat{f,s,...} or f -- optimized for #args == 1 + end + context(...) + flush = savedflush + return concat(t) +end + +setmetatable(nested, { __index = indexer, __call = caller } ) + +-- verbatim + +local verbatim = { } context.verbatim = verbatim + +local function indexer(parent,k) + local command = context[k] + local f = function(...) + local savedcatcodes = contentcatcodes + contentcatcodes = vrbcatcodes + command(...) + contentcatcodes = savedcatcodes + end + parent[k] = f + return f +end + +local function caller(parent,...) + local savedcatcodes = contentcatcodes + contentcatcodes = vrbcatcodes + defaultcaller(parent,...) + contentcatcodes = savedcatcodes +end + +setmetatable(verbatim, { __index = indexer, __call = caller } ) + +-- metafun (this will move to another file) + +local metafun = { } context.metafun = metafun + +local mpdrawing = "\\MPdrawing" + +local function caller(parent,f,a,...) + if not parent then + -- skip + elseif f then + local typ = type(f) + if typ == "string" then + if a then + flush(currentcatcodes,mpdrawing,"{",format(f,a,...),"}") + else + flush(currentcatcodes,mpdrawing,"{",f,"}") + end + elseif typ == "number" then + if a then + flush(currentcatcodes,mpdrawing,"{",f,a,...,"}") + else + flush(currentcatcodes,mpdrawing,"{",f,"}") + end + elseif typ == "function" then + -- ignored: a ... + flush(currentcatcodes,mpdrawing,"{\\cldf{",store_(f),"}}") + elseif typ == "boolean" then + -- ignored: a ... + if f then + flush(currentcatcodes,mpdrawing,"{^^M}") + else + report_context("warning: 'metafun' gets argument 'false' which is currently unsupported") + end + else + report_context("error: 'metafun' gets a weird argument '%s'",tostring(f)) + end + end +end + +setmetatable(metafun, { __call = caller } ) + +function metafun.start() + context.resetMPdrawing() +end + +function metafun.stop() + context.MPdrawingdonetrue() + context.getMPdrawing() +end + +function metafun.color(name) + return format([[\MPcolor{%s}]],name) +end + +-- metafun.delayed + +local delayed = { } metafun.delayed = delayed + +local function indexer(parent,k) + local f = function(...) + local a = { ... } + return function() + return metafun[k](unpack(a)) + end + end + parent[k] = f + return f +end + + +local function caller(parent,...) + local a = { ... } + return function() + return metafun(unpack(a)) + end +end + +setmetatable(delayed, { __index = indexer, __call = caller } ) + +--~ Not that useful yet. Maybe something like this when the main loop +--~ is a coroutine. It also does not help taking care of nested calls. +--~ Even worse, it interferes with other mechanisms using context calls. +--~ +--~ local create, yield, resume = coroutine.create, coroutine.yield, coroutine.resume +--~ local getflush, setflush = context.getflush, context.setflush +--~ local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes +--~ +--~ function context.getflush() +--~ return flush +--~ end +--~ +--~ function context.setflush(newflush) +--~ local oldflush = flush +--~ flush = newflush or flush +--~ return oldflush +--~ end +--~ +--~ function context.direct(f) +--~ local routine = create(f) +--~ local oldflush = getflush() +--~ function newflush(...) +--~ oldflush(...) +--~ yield(true) +--~ end +--~ setflush(newflush) +--~ +--~ -- local function resumecontext() +--~ -- local done = resume(routine) +--~ -- if not done then +--~ -- return +--~ -- end +--~ -- resumecontext() -- stack overflow ... no tail recursion +--~ -- end +--~ -- context.resume = resumecontext +--~ -- texsprint(ctxcatcodes,"\\ctxlua{context.resume()}") +--~ +--~ local function resumecontext() +--~ local done = resume(routine) +--~ if not done then +--~ return +--~ end +--~ -- texsprint(ctxcatcodes,"\\exitloop") +--~ texsprint(ctxcatcodes,"\\ctxlua{context.resume()}") -- can be simple macro call +--~ end +--~ context.resume = resumecontext +--~ -- texsprint(ctxcatcodes,"\\doloop{\\ctxlua{context.resume()}}") -- can be fast loop at the tex end +--~ texsprint(ctxcatcodes,"\\ctxlua{context.resume()}") +--~ +--~ end +--~ +--~ function something() +--~ context("\\setbox0") +--~ context("\\hbox{hans hagen xx}") +--~ context("\\the\\wd0/\\box0") +--~ end +--~ +--~ context.direct(something) + +-- helpers: + +function context.concat(t,separator) + local done = false + for i=1,#t do + local ti = t[i] + if ti ~= "" then + if done then + context(separator) + end + context(ti) + done = true + end + end +end diff --git a/Master/texmf-dist/tex/context/base/cldf-ini.mkiv b/Master/texmf-dist/tex/context/base/cldf-ini.mkiv new file mode 100644 index 00000000000..8aef17f9340 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cldf-ini.mkiv @@ -0,0 +1,40 @@ +%D \module +%D [ file=cldf-ini, +%D version=2010.10.19,, +%D title=\CONTEXT\ \LUA\ Document Functions, +%D subtitle=Initialization, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=Hans Hagen] +%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 Lua Documents / Initialization} + +\registerctxluafile{cldf-ini}{1.001} + +%D With each new update of \MKIV\ we can join Within Temptation in +%D singing: +%D +%D \startbuffer +%D \startluacode +%D context("I go faster%s",string.rep(" and faster",6)) +%D \stopluacode +%D +%D \cldcontext{"I go faster\letterpercent s", +%D string.rep(" and faster",6)} +%D \stopbuffer +%D +%D \typebuffer \getbuffer + +\def\cldf#1{\directlua\zerocount{_cldf_(#1)}} % global (functions) +\def\cldn#1{\directlua\zerocount{_cldn_(#1)}} % global (nodes) + +\normalprotected\def\cldprocessfile#1{\directlua\zerocount{context.runfile("#1")}} + \def\cldcontext #1{\directlua\zerocount{context(#1)}} + \def\cldcommand #1{\directlua\zerocount{context.#1}} + % \def\cldverbatim #1{\directlua\zerocount{context.verbatim.#1}} % maybe make verbatim global + +\endinput diff --git a/Master/texmf-dist/tex/context/base/cldf-int.lua b/Master/texmf-dist/tex/context/base/cldf-int.lua new file mode 100644 index 00000000000..2291fd849f0 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cldf-int.lua @@ -0,0 +1,189 @@ +if not modules then modules = { } end modules ['mult-clm'] = { + version = 1.001, + comment = "companion to mult-clm.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- another experiment +-- needs upgrading +-- needs checking +-- todo: multilingual + +local texsprint, ctxcatcodes, vrbcatcodes = tex.sprint, tex.ctxcatcodes, tex.vrbcatcodes +local format, insert, remove, concat = string.format, table.insert, table.remove, table.concat +local unpack = unpack or table.unpack + +local trace_define = false trackers.register("context.define", function(v) trace_define = v end) + +interfaces = interfaces or { } + +_clmh_ = utilities.parsers.settings_to_array +_clma_ = utilities.parsers.settings_to_array + +local starters, stoppers, macros, stack = { }, { }, { }, { } + +local checkers = { + "\\dosingleempty", + "\\dodoubleempty", + "\\dotripleempty", + "\\doquadrupleempty", + "\\doquintupleempty", + "\\dosixtupleempty", +} + +function _clmm_(name,...) + macros[name](...) +end + +function _clmb_(name,...) + local sn = stack[name] + insert(sn,{...}) + starters[name](...) +end + +function _clme_(name) + local sn = stack[name] + local sv = remove(sn) + if sv then + stoppers[name](unpack(sv)) + else + -- nesting error + end +end + +_clmn_ = tonumber + +function interfaces.definecommand(name,specification) -- name is optional + if type(name) == "table" then + specification = name + name = specification.name + end + if name and specification then + local arguments = specification.arguments + local na = (arguments and #arguments) or 0 + local environment = specification.environment + if na == 0 then + if environment then + texsprint(ctxcatcodes,"\\clmb{",name,"}{\\ctxlua{_clmb_('",name,"')}}") + texsprint(ctxcatcodes,"\\clme{",name,"}{\\ctxlua{_clme_('",name,"')}}") + else + texsprint(ctxcatcodes,"\\clmm{",name,"}{\\ctxlua{_clmm_('",name,"')}}") + end + else + stack[name] = { } + local opt, done = 0, false + local mkivdo = "\\mkivdo" .. name -- maybe clddo + texsprint(ctxcatcodes,"\\def",mkivdo) + for i=1,na do + local a = arguments[i] + local variant = a[1] + if variant == "option" then + texsprint(ctxcatcodes,"[#",i,"]") + if not done then + opt = opt + 1 + end + else + done = true -- no more optional checking after this + texsprint(ctxcatcodes,"#",i) + end + end + if environment then + texsprint(ctxcatcodes,"{\\ctxlua{_clmb_('",name,"'") + else + texsprint(ctxcatcodes,"{\\ctxlua{_clmm_('",name,"'") + end + for i=1,na do + local a = arguments[i] + local variant = a[2] + if variant == "list" then + texsprint(ctxcatcodes,",_clma_([[#",i,"]])") + elseif variant == "hash" then + texsprint(ctxcatcodes,",_clmh_([[#",i,"]])") + elseif variant == "number" then + texsprint(ctxcatcodes,",_clmn_([[#",i,"]])") + else + texsprint(ctxcatcodes,",[[#",i,"]]") + end + end + texsprint(ctxcatcodes,")}}") + if environment then + texsprint(ctxcatcodes,"\\clme{",name,"}{\\ctxlua{_clme_('",name,"')}}") + texsprint(ctxcatcodes,"\\clmb{",name,"}{",checkers[opt],mkivdo,"}") + else + texsprint(ctxcatcodes,"\\clmm{",name,"}{",checkers[opt],mkivdo,"}") + end + end + if environment then + starters[name] = specification.starter + stoppers[name] = specification.stopper + else + macros[name] = specification.macro + end + end +end + +function interfaces.tolist(t) + local r = { } + for i=1,#t do + r[i] = t[i] + end + local n = #r + for k,v in table.sortedhash(t) do + if type(k) ~= "number" then + n = n + 1 + r[n] = k .. "=" .. v + end + end + return concat(r,", ") +end + +--~ \startluacode +--~ function test(opt_1, opt_2, arg_1) +--~ context.startnarrower() +--~ context("options 1: %s",interfaces.tolist(opt_1)) +--~ context.par() +--~ context("options 2: %s",interfaces.tolist(opt_2)) +--~ context.par() +--~ context("argument 1: %s",arg_1) +--~ context.stopnarrower() +--~ end + +--~ interfaces.definecommand { +--~ name = "test", +--~ arguments = { +--~ { "option", "list" }, +--~ { "option", "hash" }, +--~ { "content", "string" }, +--~ }, +--~ macro = test, +--~ } +--~ \stopluacode + +--~ test: \test[1][a=3]{whatever} + +--~ \startluacode +--~ local function startmore(opt_1) +--~ context.startnarrower() +--~ context("start more, options: %s",interfaces.tolist(opt_1)) +--~ context.startnarrower() +--~ end + +--~ local function stopmore(opt_1) +--~ context.stopnarrower() +--~ context("stop more, options: %s",interfaces.tolist(opt_1)) +--~ context.stopnarrower() +--~ end + +--~ interfaces.definecommand ( "more", { +--~ environment = true, +--~ arguments = { +--~ { "option", "list" }, +--~ }, +--~ starter = startmore, +--~ stopper = stopmore, +--~ } ) +--~ \stopluacode + +--~ more: \startmore[1] one \startmore[2] two \stopmore one \stopmore diff --git a/Master/texmf-dist/tex/context/base/cldf-int.mkiv b/Master/texmf-dist/tex/context/base/cldf-int.mkiv new file mode 100644 index 00000000000..cedac8fc0e2 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cldf-int.mkiv @@ -0,0 +1,24 @@ +%D \module +%D [ file=mult-ini, +%D version=2008.10.22, % 1996.06.01, +%D title=\CONTEXT\ Multilingual 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. + +\writestatus{loading}{ConTeXt Multilingual Macros / Lua} + +\registerctxluafile{cldf-int}{1.001} + +\unprotect + +\unexpanded\def\clmb#1{\unexpanded\expandafter\def\csname\e!start#1\endcsname} +\unexpanded\def\clme#1{\unexpanded\expandafter\def\csname\e!stop #1\endcsname} +\unexpanded\def\clmm#1{\unexpanded\expandafter\def\csname #1\endcsname} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/cldf-ver.lua b/Master/texmf-dist/tex/context/base/cldf-ver.lua new file mode 100644 index 00000000000..fc681e83047 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cldf-ver.lua @@ -0,0 +1,73 @@ +if not modules then modules = { } end modules ['cldf-ver'] = { + version = 1.001, + comment = "companion to cldf-ver.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- tex.print == line with endlinechar appended + +local concat, tohandle = table.concat, table.tohandle +local find, splitlines = string.find, string.splitlines +local tostring, type = tostring, type + +local context = context + +local function flush(...) + context(concat{...,"\r"}) -- was \n +end + +local function t_tocontext(...) + context.starttyping { "typing" } -- else [1] is intercepted + context.pushcatcodes("verbatim") + tohandle(flush,...) -- ok? + context.stoptyping() + context.popcatcodes() +end + +local function s_tocontext(...) -- we need to catch {\} + context.type() + context("{") + context.pushcatcodes("verbatim") + context(concat({...}," ")) + context.popcatcodes() + context("}") +end + +local function b_tocontext(b) + s_tocontext(tostring(b)) +end + +table .tocontext = t_tocontext +string .tocontext = s_tocontext +boolean.tocontext = b_tocontext + +function tocontext(first,...) + local t = type(first) + if t == "string" then + s_tocontext(first,...) + elseif t == "table" then + t_tocontext(first,...) + elseif t == "boolean" then + b_tocontext(first,...) + end +end + +function context.tobuffer(name,str) + context.startbuffer { name } + context.pushcatcodes("verbatim") + local lines = (type(str) == "string" and find(str,"[\n\r]") and splitlines(str)) or str + for i=1,#lines do + context(lines[i] .. " ") + end + context.stopbuffer() + context.popcatcodes() +end + +function context.tolines(str) + local lines = type(str) == "string" and splitlines(str) or str + for i=1,#lines do + context(lines[i] .. " ") + end +end diff --git a/Master/texmf-dist/tex/context/base/cldf-ver.mkiv b/Master/texmf-dist/tex/context/base/cldf-ver.mkiv new file mode 100644 index 00000000000..f85b28a0cf0 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cldf-ver.mkiv @@ -0,0 +1,18 @@ +%D \module +%D [ file=cldf-com, +%D version=2010.10.19,, +%D title=\CONTEXT\ \LUA\ Document Functions, +%D subtitle=Verbatim, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=Hans Hagen] +%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 Lua Documents / Verbatim} + +\registerctxluafile{cldf-ver}{1.001} + +\endinput diff --git a/Master/texmf-dist/tex/context/base/colo-ema.mkii b/Master/texmf-dist/tex/context/base/colo-ema.mkii new file mode 100644 index 00000000000..e5e90b2355e --- /dev/null +++ b/Master/texmf-dist/tex/context/base/colo-ema.mkii @@ -0,0 +1,590 @@ +%D \module +%D [ file=colo-ema, +%D version=2003.03.20, +%D title=\CONTEXT\ Color Macros, +%D subtitle=Emacs Colors, +%D author=Peter Rolf, +%D date=\currentdate, +%D copyright=PRAGMA ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% author : Peter Rolf +% last change : 17 march 2003 +% origin : /emacs/etc/rgb.txt +% +% USAGE: +% +% - select emacs menu: Edit -> Text Properties -> Display +% Colors, if you don't know what I'm talking about +% - copy this file to your /texmf/tex/context/user directory +% and add "\input colo-emacs" to your tex-file +% +% IMPORTANT NOTES: +% +% - all color names are written as ONE word in lowercase +% letters (no redundancy as in rgb.txt) so if you want to +% use the color "Light Sky Blue"/"light sky blue" it's new +% name is lightskyblue +% - the grayX values [X=0..100] can only be used with \color +% [grayX] +% - use it at your own risk :) +% +% HINT: +% +% I only include this file (\showcolor [ema]) until I've +% found the colors I want. Copy and paste the color +% definitions to a seperate file, to decrease compilation +% time (540 color definitions). + +\definecolor [snow] [r=1,g=.980392,b=.980392] +\definecolor [ghostwhite] [r=.972549,g=.972549,b=1] +\definecolor [whitesmoke] [s=.960784] +\definecolor [gainsboro] [s=.862745] +\definecolor [floralwhite] [r=1,g=.980392,b=.941176] +\definecolor [oldlace] [r=.992157,g=.960784,b=.901961] +\definecolor [linen] [r=.980392,g=.941176,b=.901961] +\definecolor [antiquewhite] [r=.980392,g=.921569,b=.843137] +\definecolor [papayawhip] [r=1,g=.937255,b=.835294] +\definecolor [blanchedalmond] [r=1,g=.921569,b=.803922] +\definecolor [bisque] [r=1,g=.894118,b=.768627] +\definecolor [peachpuff] [r=1,g=.854902,b=.72549] +\definecolor [navajowhite] [r=1,g=.870588,b=.678431] +\definecolor [moccasin] [r=1,g=.894118,b=.709804] +\definecolor [cornsilk] [r=1,g=.972549,b=.862745] +\definecolor [ivory] [r=1,g=1,b=.941176] +\definecolor [lemonchiffon] [r=1,g=.980392,b=.803922] +\definecolor [seashell] [r=1,g=.960784,b=.933333] +\definecolor [honeydew] [r=.941176,g=1,b=.941176] +\definecolor [mintcream] [r=.960784,g=1,b=.980392] +\definecolor [azure] [r=.941176,g=1,b=1] +\definecolor [aliceblue] [r=.941176,g=.972549,b=1] +\definecolor [lavender] [r=.901961,g=.901961,b=.980392] +\definecolor [lavenderblush] [r=1,g=.941176,b=.960784] +\definecolor [mistyrose] [r=1,g=.894118,b=.882353] +%definecolor[white] [s=1] +%definecolor[black] [s=0] +\definecolor [darkslategray] [r=.184314,g=.309804,b=.309804] +\definecolor [dimgray] [s=.411765] +\definecolor [slategray] [r=.439216,g=.501961,b=.564706] +\definecolor [lightslategray] [r=.466667,g=.533333,b=.6] +\definecolor [gray] [s=.745098] +\definecolor [lightgray] [s=.827451] +\definecolor [midnightblue] [r=.098039,g=.098039,b=.439216] +\definecolor [navy] [b=.501961] +\definecolor [navyblue] [navy] +\definecolor [cornflowerblue] [r=.392157,g=.584314,b=.929412] +\definecolor [darkslateblue] [r=.282353,g=.239216,b=.545098] +\definecolor [slateblue] [r=.415686,g=.352941,b=.803922] +\definecolor [mediumslateblue] [r=.482353,g=.407843,b=.933333] +\definecolor [lightslateblue] [r=.517647,g=.439216,b=1] +\definecolor [mediumblue] [b=.803922] +\definecolor [royalblue] [r=.254902,g=.411765,b=.882353] +%definecolor[blue] [b=1] +\definecolor [dodgerblue] [r=.117647,g=.564706,b=1] +\definecolor [deepskyblue] [g=.74902,b=1] +\definecolor [skyblue] [r=.529412,g=.807843,b=.921569] +\definecolor [lightskyblue] [r=.529412,g=.807843,b=.980392] +\definecolor [steelblue] [r=.27451,g=.509804,b=.705882] +\definecolor [lightsteelblue] [r=.690196,g=.768627,b=.870588] +\definecolor [lightblue] [r=.678431,g=.847059,b=.901961] +\definecolor [powderblue] [r=.690196,g=.878431,b=.901961] +\definecolor [paleturquoise] [r=.686275,g=.933333,b=.933333] +\definecolor [darkturquoise] [g=.807843,b=.819608] +\definecolor [mediumturquoise] [r=.282353,g=.819608,b=.8] +\definecolor [turquoise] [r=.25098,g=.878431,b=.815686] +%definecolor[cyan] [g=1,b=1] +\definecolor [lightcyan] [r=.878431,g=1,b=1] +\definecolor [cadetblue] [r=.372549,g=.619608,b=.627451] +\definecolor [mediumaquamarine] [r=.4,g=.803922,b=.666667] +\definecolor [aquamarine] [r=.498039,g=1,b=.831373] +\definecolor [darkgreen] [g=.392157] +\definecolor [darkolivegreen] [r=.333333,g=.419608,b=.184314] +\definecolor [darkseagreen] [r=.560784,g=.737255,b=.560784] +\definecolor [seagreen] [r=.180392,g=.545098,b=.341176] +\definecolor [mediumseagreen] [r=.235294,g=.701961,b=.443137] +\definecolor [lightseagreen] [r=.12549,g=.698039,b=.666667] +\definecolor [palegreen] [r=.596078,g=.984314,b=.596078] +\definecolor [springgreen] [g=1,b=.498039] +\definecolor [lawngreen] [r=.486275,g=.988235] +%definecolor[green] [g=1] +\definecolor [chartreuse] [r=.498039,g=1] +\definecolor [mediumspringgreen] [g=.980392,b=.603922] +\definecolor [greenyellow] [r=.678431,g=1,b=.184314] +\definecolor [limegreen] [r=.196078,g=.803922,b=.196078] +\definecolor [yellowgreen] [r=.603922,g=.803922,b=.196078] +\definecolor [forestgreen] [r=.133333,g=.545098,b=.133333] +\definecolor [olivedrab] [r=.419608,g=.556863,b=.137255] +\definecolor [darkkhaki] [r=.741176,g=.717647,b=.419608] +\definecolor [khaki] [r=.941176,g=.901961,b=.54902] +\definecolor [palegoldenrod] [r=.933333,g=.909804,b=.666667] +\definecolor [lightgoldenrodyellow] [r=.980392,g=.980392,b=.823529] +\definecolor [lightyellow] [r=1,g=1,b=.878431] +%definecolor[yellow] [r=1,g=1] +\definecolor [gold] [r=1,g=.843137] +\definecolor [lightgoldenrod] [r=.933333,g=.866667,b=.509804] +\definecolor [goldenrod] [r=.854902,g=.647059,b=.12549] +\definecolor [darkgoldenrod] [r=.721569,g=.52549,b=.043137] +\definecolor [rosybrown] [r=.737255,g=.560784,b=.560784] +\definecolor [indianred] [r=.803922,g=.360784,b=.360784] +\definecolor [saddlebrown] [r=.545098,g=.270588,b=.07451] +\definecolor [sienna] [r=.627451,g=.321569,b=.176471] +\definecolor [peru] [r=.803922,g=.521569,b=.247059] +\definecolor [burlywood] [r=.870588,g=.721569,b=.529412] +\definecolor [beige] [r=.960784,g=.960784,b=.862745] +\definecolor [wheat] [r=.960784,g=.870588,b=.701961] +\definecolor [sandybrown] [r=.956863,g=.643137,b=.376471] +\definecolor [tan] [r=.823529,g=.705882,b=.54902] +\definecolor [chocolate] [r=.823529,g=.411765,b=.117647] +\definecolor [firebrick] [r=.698039,g=.133333,b=.133333] +\definecolor [brown] [r=.647059,g=.164706,b=.164706] +\definecolor [darksalmon] [r=.913725,g=.588235,b=.478431] +\definecolor [salmon] [r=.980392,g=.501961,b=.447059] +\definecolor [lightsalmon] [r=1,g=.627451,b=.478431] +\definecolor [orange] [r=1,g=.647059] +\definecolor [darkorange] [r=1,g=.54902] +\definecolor [coral] [r=1,g=.498039,b=.313725] +\definecolor [lightcoral] [r=.941176,g=.501961,b=.501961] +\definecolor [tomato] [r=1,g=.388235,b=.278431] +\definecolor [orangered] [r=1,g=.270588] +%definecolor[red] [r=1] +\definecolor [hotpink] [r=1,g=.411765,b=.705882] +\definecolor [deeppink] [r=1,g=.078431,b=.576471] +\definecolor [pink] [r=1,g=.752941,b=.796078] +\definecolor [lightpink] [r=1,g=.713725,b=.756863] +\definecolor [palevioletred] [r=.858824,g=.439216,b=.576471] +\definecolor [maroon] [r=.690196,g=.188235,b=.376471] +\definecolor [mediumvioletred] [r=.780392,g=.082353,b=.521569] +\definecolor [violetred] [r=.815686,g=.12549,b=.564706] +%definecolor[magenta] [r=1,b=1] +\definecolor [violet] [r=.933333,g=.509804,b=.933333] +\definecolor [plum] [r=.866667,g=.627451,b=.866667] +\definecolor [orchid] [r=.854902,g=.439216,b=.839216] +\definecolor [mediumorchid] [r=.729412,g=.333333,b=.827451] +\definecolor [darkorchid] [r=.6,g=.196078,b=.8] +\definecolor [darkviolet] [r=.580392,b=.827451] +\definecolor [blueviolet] [r=.541176,g=.168627,b=.886275] +\definecolor [purple] [r=.627451,g=.12549,b=.941176] +\definecolor [mediumpurple] [r=.576471,g=.439216,b=.858824] +\definecolor [thistle] [r=.847059,g=.74902,b=.847059] +\definecolor [snow1] [r=1,g=.980392,b=.980392] +\definecolor [snow2] [r=.933333,g=.913725,b=.913725] +\definecolor [snow3] [r=.803922,g=.788235,b=.788235] +\definecolor [snow4] [r=.545098,g=.537255,b=.537255] +\definecolor [seashell1] [r=1,g=.960784,b=.933333] +\definecolor [seashell2] [r=.933333,g=.898039,b=.870588] +\definecolor [seashell3] [r=.803922,g=.772549,b=.74902] +\definecolor [seashell4] [r=.545098,g=.52549,b=.509804] +\definecolor [antiquewhite1] [r=1,g=.937255,b=.858824] +\definecolor [antiquewhite2] [r=.933333,g=.87451,b=.8] +\definecolor [antiquewhite3] [r=.803922,g=.752941,b=.690196] +\definecolor [antiquewhite4] [r=.545098,g=.513725,b=.470588] +\definecolor [bisque1] [r=1,g=.894118,b=.768627] +\definecolor [bisque2] [r=.933333,g=.835294,b=.717647] +\definecolor [bisque3] [r=.803922,g=.717647,b=.619608] +\definecolor [bisque4] [r=.545098,g=.490196,b=.419608] +\definecolor [peachpuff1] [r=1,g=.854902,b=.72549] +\definecolor [peachpuff2] [r=.933333,g=.796078,b=.678431] +\definecolor [peachpuff3] [r=.803922,g=.686275,b=.584314] +\definecolor [peachpuff4] [r=.545098,g=.466667,b=.396078] +\definecolor [navajowhite1] [r=1,g=.870588,b=.678431] +\definecolor [navajowhite2] [r=.933333,g=.811765,b=.631373] +\definecolor [navajowhite3] [r=.803922,g=.701961,b=.545098] +\definecolor [navajowhite4] [r=.545098,g=.47451,b=.368627] +\definecolor [lemonchiffon1] [r=1,g=.980392,b=.803922] +\definecolor [lemonchiffon2] [r=.933333,g=.913725,b=.74902] +\definecolor [lemonchiffon3] [r=.803922,g=.788235,b=.647059] +\definecolor [lemonchiffon4] [r=.545098,g=.537255,b=.439216] +\definecolor [cornsilk1] [r=1,g=.972549,b=.862745] +\definecolor [cornsilk2] [r=.933333,g=.909804,b=.803922] +\definecolor [cornsilk3] [r=.803922,g=.784314,b=.694118] +\definecolor [cornsilk4] [r=.545098,g=.533333,b=.470588] +\definecolor [ivory1] [r=1,g=1,b=.941176] +\definecolor [ivory2] [r=.933333,g=.933333,b=.878431] +\definecolor [ivory3] [r=.803922,g=.803922,b=.756863] +\definecolor [ivory4] [r=.545098,g=.545098,b=.513725] +\definecolor [honeydew1] [r=.941176,g=1,b=.941176] +\definecolor [honeydew2] [r=.878431,g=.933333,b=.878431] +\definecolor [honeydew3] [r=.756863,g=.803922,b=.756863] +\definecolor [honeydew4] [r=.513725,g=.545098,b=.513725] +\definecolor [lavenderblush1] [r=1,g=.941176,b=.960784] +\definecolor [lavenderblush2] [r=.933333,g=.878431,b=.898039] +\definecolor [lavenderblush3] [r=.803922,g=.756863,b=.772549] +\definecolor [lavenderblush4] [r=.545098,g=.513725,b=.52549] +\definecolor [mistyrose1] [r=1,g=.894118,b=.882353] +\definecolor [mistyrose2] [r=.933333,g=.835294,b=.823529] +\definecolor [mistyrose3] [r=.803922,g=.717647,b=.709804] +\definecolor [mistyrose4] [r=.545098,g=.490196,b=.482353] +\definecolor [azure1] [r=.941176,g=1,b=1] +\definecolor [azure2] [r=.878431,g=.933333,b=.933333] +\definecolor [azure3] [r=.756863,g=.803922,b=.803922] +\definecolor [azure4] [r=.513725,g=.545098,b=.545098] +\definecolor [slateblue1] [r=.513725,g=.435294,b=1] +\definecolor [slateblue2] [r=.478431,g=.403922,b=.933333] +\definecolor [slateblue3] [r=.411765,g=.34902,b=.803922] +\definecolor [slateblue4] [r=.278431,g=.235294,b=.545098] +\definecolor [royalblue1] [r=.282353,g=.462745,b=1] +\definecolor [royalblue2] [r=.262745,g=.431373,b=.933333] +\definecolor [royalblue3] [r=.227451,g=.372549,b=.803922] +\definecolor [royalblue4] [r=.152941,g=.25098,b=.545098] +\definecolor [blue1] [blue] +\definecolor [blue2] [b=.933333] +\definecolor [blue3] [b=.803922] +\definecolor [blue4] [b=.545098] +\definecolor [dodgerblue1] [r=.117647,g=.564706,b=1] +\definecolor [dodgerblue2] [r=.109804,g=.52549,b=.933333] +\definecolor [dodgerblue3] [r=.094118,g=.454902,b=.803922] +\definecolor [dodgerblue4] [r=.062745,g=.305882,b=.545098] +\definecolor [steelblue1] [r=.388235,g=.721569,b=1] +\definecolor [steelblue2] [r=.360784,g=.67451,b=.933333] +\definecolor [steelblue3] [r=.309804,g=.580392,b=.803922] +\definecolor [steelblue4] [r=.211765,g=.392157,b=.545098] +\definecolor [deepskyblue1] [g=.74902,b=1] +\definecolor [deepskyblue2] [g=.698039,b=.933333] +\definecolor [deepskyblue3] [g=.603922,b=.803922] +\definecolor [deepskyblue4] [g=.407843,b=.545098] +\definecolor [skyblue1] [r=.529412,g=.807843,b=1] +\definecolor [skyblue2] [r=.494118,g=.752941,b=.933333] +\definecolor [skyblue3] [r=.423529,g=.65098,b=.803922] +\definecolor [skyblue4] [r=.290196,g=.439216,b=.545098] +\definecolor [lightskyblue1] [r=.690196,g=.886275,b=1] +\definecolor [lightskyblue2] [r=.643137,g=.827451,b=.933333] +\definecolor [lightskyblue3] [r=.552941,g=.713725,b=.803922] +\definecolor [lightskyblue4] [r=.376471,g=.482353,b=.545098] +\definecolor [slategray1] [r=.776471,g=.886275,b=1] +\definecolor [slategray2] [r=.72549,g=.827451,b=.933333] +\definecolor [slategray3] [r=.623529,g=.713725,b=.803922] +\definecolor [slategray4] [r=.423529,g=.482353,b=.545098] +\definecolor [lightsteelblue1] [r=.792157,g=.882353,b=1] +\definecolor [lightsteelblue2] [r=.737255,g=.823529,b=.933333] +\definecolor [lightsteelblue3] [r=.635294,g=.709804,b=.803922] +\definecolor [lightsteelblue4] [r=.431373,g=.482353,b=.545098] +\definecolor [lightblue1] [r=.74902,g=.937255,b=1] +\definecolor [lightblue2] [r=.698039,g=.87451,b=.933333] +\definecolor [lightblue3] [r=.603922,g=.752941,b=.803922] +\definecolor [lightblue4] [r=.407843,g=.513725,b=.545098] +\definecolor [lightcyan1] [r=.878431,g=1,b=1] +\definecolor [lightcyan2] [r=.819608,g=.933333,b=.933333] +\definecolor [lightcyan3] [r=.705882,g=.803922,b=.803922] +\definecolor [lightcyan4] [r=.478431,g=.545098,b=.545098] +\definecolor [paleturquoise1] [r=.733333,g=1,b=1] +\definecolor [paleturquoise2] [r=.682353,g=.933333,b=.933333] +\definecolor [paleturquoise3] [r=.588235,g=.803922,b=.803922] +\definecolor [paleturquoise4] [r=.4,g=.545098,b=.545098] +\definecolor [cadetblue1] [r=.596078,g=.960784,b=1] +\definecolor [cadetblue2] [r=.556863,g=.898039,b=.933333] +\definecolor [cadetblue3] [r=.478431,g=.772549,b=.803922] +\definecolor [cadetblue4] [r=.32549,g=.52549,b=.545098] +\definecolor [turquoise1] [g=.960784,b=1] +\definecolor [turquoise2] [g=.898039,b=.933333] +\definecolor [turquoise3] [g=.772549,b=.803922] +\definecolor [turquoise4] [g=.52549,b=.545098] +\definecolor [cyan1] [cyan] +\definecolor [cyan2] [g=.933333,b=.933333] +\definecolor [cyan3] [g=.803922,b=.803922] +\definecolor [cyan4] [g=.545098,b=.545098] +\definecolor [darkslategray1] [r=.592157,g=1,b=1] +\definecolor [darkslategray2] [r=.552941,g=.933333,b=.933333] +\definecolor [darkslategray3] [r=.47451,g=.803922,b=.803922] +\definecolor [darkslategray4] [r=.321569,g=.545098,b=.545098] +\definecolor [aquamarine1] [r=.498039,g=1,b=.831373] +\definecolor [aquamarine2] [r=.462745,g=.933333,b=.776471] +\definecolor [aquamarine3] [r=.4,g=.803922,b=.666667] +\definecolor [aquamarine4] [r=.270588,g=.545098,b=.454902] +\definecolor [darkseagreen1] [r=.756863,g=1,b=.756863] +\definecolor [darkseagreen2] [r=.705882,g=.933333,b=.705882] +\definecolor [darkseagreen3] [r=.607843,g=.803922,b=.607843] +\definecolor [darkseagreen4] [r=.411765,g=.545098,b=.411765] +\definecolor [seagreen1] [r=.329412,g=1,b=.623529] +\definecolor [seagreen2] [r=.305882,g=.933333,b=.580392] +\definecolor [seagreen3] [r=.262745,g=.803922,b=.501961] +\definecolor [seagreen4] [r=.180392,g=.545098,b=.341176] +\definecolor [palegreen1] [r=.603922,g=1,b=.603922] +\definecolor [palegreen2] [r=.564706,g=.933333,b=.564706] +\definecolor [palegreen3] [r=.486275,g=.803922,b=.486275] +\definecolor [palegreen4] [r=.329412,g=.545098,b=.329412] +\definecolor [springgreen1] [g=1,b=.498039] +\definecolor [springgreen2] [g=.933333,b=.462745] +\definecolor [springgreen3] [g=.803922,b=.4] +\definecolor [springgreen4] [g=.545098,b=.270588] +\definecolor [green1] [green] +\definecolor [green2] [g=.933333] +\definecolor [green3] [g=.803922] +\definecolor [green4] [g=.545098] +\definecolor [chartreuse1] [r=.498039,g=1] +\definecolor [chartreuse2] [r=.462745,g=.933333] +\definecolor [chartreuse3] [r=.4,g=.803922] +\definecolor [chartreuse4] [r=.270588,g=.545098] +\definecolor [olivedrab1] [r=.752941,g=1,b=.243137] +\definecolor [olivedrab2] [r=.701961,g=.933333,b=.227451] +\definecolor [olivedrab3] [r=.603922,g=.803922,b=.196078] +\definecolor [olivedrab4] [r=.411765,g=.545098,b=.133333] +\definecolor [darkolivegreen1] [r=.792157,g=1,b=.439216] +\definecolor [darkolivegreen2] [r=.737255,g=.933333,b=.407843] +\definecolor [darkolivegreen3] [r=.635294,g=.803922,b=.352941] +\definecolor [darkolivegreen4] [r=.431373,g=.545098,b=.239216] +\definecolor [khaki1] [r=1,g=.964706,b=.560784] +\definecolor [khaki2] [r=.933333,g=.901961,b=.521569] +\definecolor [khaki3] [r=.803922,g=.776471,b=.45098] +\definecolor [khaki4] [r=.545098,g=.52549,b=.305882] +\definecolor [lightgoldenrod1] [r=1,g=.92549,b=.545098] +\definecolor [lightgoldenrod2] [r=.933333,g=.862745,b=.509804] +\definecolor [lightgoldenrod3] [r=.803922,g=.745098,b=.439216] +\definecolor [lightgoldenrod4] [r=.545098,g=.505882,b=.298039] +\definecolor [lightyellow1] [r=1,g=1,b=.878431] +\definecolor [lightyellow2] [r=.933333,g=.933333,b=.819608] +\definecolor [lightyellow3] [r=.803922,g=.803922,b=.705882] +\definecolor [lightyellow4] [r=.545098,g=.545098,b=.478431] +\definecolor [yellow1] [yellow] +\definecolor [yellow2] [r=.933333,g=.933333] +\definecolor [yellow3] [r=.803922,g=.803922] +\definecolor [yellow4] [r=.545098,g=.545098] +\definecolor [gold1] [r=1,g=.843137] +\definecolor [gold2] [r=.933333,g=.788235] +\definecolor [gold3] [r=.803922,g=.678431] +\definecolor [gold4] [r=.545098,g=.458824] +\definecolor [goldenrod1] [r=1,g=.756863,b=.145098] +\definecolor [goldenrod2] [r=.933333,g=.705882,b=.133333] +\definecolor [goldenrod3] [r=.803922,g=.607843,b=.113725] +\definecolor [goldenrod4] [r=.545098,g=.411765,b=.078431] +\definecolor [darkgoldenrod1] [r=1,g=.72549,b=.058824] +\definecolor [darkgoldenrod2] [r=.933333,g=.678431,b=.054902] +\definecolor [darkgoldenrod3] [r=.803922,g=.584314,b=.047059] +\definecolor [darkgoldenrod4] [r=.545098,g=.396078,b=.031373] +\definecolor [rosybrown1] [r=1,g=.756863,b=.756863] +\definecolor [rosybrown2] [r=.933333,g=.705882,b=.705882] +\definecolor [rosybrown3] [r=.803922,g=.607843,b=.607843] +\definecolor [rosybrown4] [r=.545098,g=.411765,b=.411765] +\definecolor [indianred1] [r=1,g=.415686,b=.415686] +\definecolor [indianred2] [r=.933333,g=.388235,b=.388235] +\definecolor [indianred3] [r=.803922,g=.333333,b=.333333] +\definecolor [indianred4] [r=.545098,g=.227451,b=.227451] +\definecolor [sienna1] [r=1,g=.509804,b=.278431] +\definecolor [sienna2] [r=.933333,g=.47451,b=.258824] +\definecolor [sienna3] [r=.803922,g=.407843,b=.223529] +\definecolor [sienna4] [r=.545098,g=.278431,b=.14902] +\definecolor [burlywood1] [r=1,g=.827451,b=.607843] +\definecolor [burlywood2] [r=.933333,g=.772549,b=.568627] +\definecolor [burlywood3] [r=.803922,g=.666667,b=.490196] +\definecolor [burlywood4] [r=.545098,g=.45098,b=.333333] +\definecolor [wheat1] [r=1,g=.905882,b=.729412] +\definecolor [wheat2] [r=.933333,g=.847059,b=.682353] +\definecolor [wheat3] [r=.803922,g=.729412,b=.588235] +\definecolor [wheat4] [r=.545098,g=.494118,b=.4] +\definecolor [tan1] [r=1,g=.647059,b=.309804] +\definecolor [tan2] [r=.933333,g=.603922,b=.286275] +\definecolor [tan3] [r=.803922,g=.521569,b=.247059] +\definecolor [tan4] [r=.545098,g=.352941,b=.168627] +\definecolor [chocolate1] [r=1,g=.498039,b=.141176] +\definecolor [chocolate2] [r=.933333,g=.462745,b=.129412] +\definecolor [chocolate3] [r=.803922,g=.4,b=.113725] +\definecolor [chocolate4] [r=.545098,g=.270588,b=.07451] +\definecolor [firebrick1] [r=1,g=.188235,b=.188235] +\definecolor [firebrick2] [r=.933333,g=.172549,b=.172549] +\definecolor [firebrick3] [r=.803922,g=.14902,b=.14902] +\definecolor [firebrick4] [r=.545098,g=.101961,b=.101961] +\definecolor [brown1] [r=1,g=.25098,b=.25098] +\definecolor [brown2] [r=.933333,g=.231373,b=.231373] +\definecolor [brown3] [r=.803922,g=.2,b=.2] +\definecolor [brown4] [r=.545098,g=.137255,b=.137255] +\definecolor [salmon1] [r=1,g=.54902,b=.411765] +\definecolor [salmon2] [r=.933333,g=.509804,b=.384314] +\definecolor [salmon3] [r=.803922,g=.439216,b=.329412] +\definecolor [salmon4] [r=.545098,g=.298039,b=.223529] +\definecolor [lightsalmon1] [r=1,g=.627451,b=.478431] +\definecolor [lightsalmon2] [r=.933333,g=.584314,b=.447059] +\definecolor [lightsalmon3] [r=.803922,g=.505882,b=.384314] +\definecolor [lightsalmon4] [r=.545098,g=.341176,b=.258824] +\definecolor [orange1] [r=1,g=.647059] +\definecolor [orange2] [r=.933333,g=.603922] +\definecolor [orange3] [r=.803922,g=.521569] +\definecolor [orange4] [r=.545098,g=.352941] +\definecolor [darkorange1] [r=1,g=.498039] +\definecolor [darkorange2] [r=.933333,g=.462745] +\definecolor [darkorange3] [r=.803922,g=.4] +\definecolor [darkorange4] [r=.545098,g=.270588] +\definecolor [coral1] [r=1,g=.447059,b=.337255] +\definecolor [coral2] [r=.933333,g=.415686,b=.313725] +\definecolor [coral3] [r=.803922,g=.356863,b=.270588] +\definecolor [coral4] [r=.545098,g=.243137,b=.184314] +\definecolor [tomato1] [r=1,g=.388235,b=.278431] +\definecolor [tomato2] [r=.933333,g=.360784,b=.258824] +\definecolor [tomato3] [r=.803922,g=.309804,b=.223529] +\definecolor [tomato4] [r=.545098,g=.211765,b=.14902] +\definecolor [orangered1] [r=1,g=.270588] +\definecolor [orangered2] [r=.933333,g=.25098] +\definecolor [orangered3] [r=.803922,g=.215686] +\definecolor [orangered4] [r=.545098,g=.145098] +\definecolor [red1] [red] +\definecolor [red2] [r=.933333] +\definecolor [red3] [r=.803922] +\definecolor [red4] [r=.545098] +\definecolor [deeppink1] [r=1,g=.078431,b=.576471] +\definecolor [deeppink2] [r=.933333,g=.070588,b=.537255] +\definecolor [deeppink3] [r=.803922,g=.062745,b=.462745] +\definecolor [deeppink4] [r=.545098,g=.039216,b=.313725] +\definecolor [hotpink1] [r=1,g=.431373,b=.705882] +\definecolor [hotpink2] [r=.933333,g=.415686,b=.654902] +\definecolor [hotpink3] [r=.803922,g=.376471,b=.564706] +\definecolor [hotpink4] [r=.545098,g=.227451,b=.384314] +\definecolor [pink1] [r=1,g=.709804,b=.772549] +\definecolor [pink2] [r=.933333,g=.662745,b=.721569] +\definecolor [pink3] [r=.803922,g=.568627,b=.619608] +\definecolor [pink4] [r=.545098,g=.388235,b=.423529] +\definecolor [lightpink1] [r=1,g=.682353,b=.72549] +\definecolor [lightpink2] [r=.933333,g=.635294,b=.678431] +\definecolor [lightpink3] [r=.803922,g=.54902,b=.584314] +\definecolor [lightpink4] [r=.545098,g=.372549,b=.396078] +\definecolor [palevioletred1] [r=1,g=.509804,b=.670588] +\definecolor [palevioletred2] [r=.933333,g=.47451,b=.623529] +\definecolor [palevioletred3] [r=.803922,g=.407843,b=.537255] +\definecolor [palevioletred4] [r=.545098,g=.278431,b=.364706] +\definecolor [maroon1] [r=1,g=.203922,b=.701961] +\definecolor [maroon2] [r=.933333,g=.188235,b=.654902] +\definecolor [maroon3] [r=.803922,g=.160784,b=.564706] +\definecolor [maroon4] [r=.545098,g=.109804,b=.384314] +\definecolor [violetred1] [r=1,g=.243137,b=.588235] +\definecolor [violetred2] [r=.933333,g=.227451,b=.54902] +\definecolor [violetred3] [r=.803922,g=.196078,b=.470588] +\definecolor [violetred4] [r=.545098,g=.133333,b=.321569] +\definecolor [magenta1] [magenta] +\definecolor [magenta2] [r=.933333,b=.933333] +\definecolor [magenta3] [r=.803922,b=.803922] +\definecolor [magenta4] [r=.545098,b=.545098] +\definecolor [orchid1] [r=1,g=.513725,b=.980392] +\definecolor [orchid2] [r=.933333,g=.478431,b=.913725] +\definecolor [orchid3] [r=.803922,g=.411765,b=.788235] +\definecolor [orchid4] [r=.545098,g=.278431,b=.537255] +\definecolor [plum1] [r=1,g=.733333,b=1] +\definecolor [plum2] [r=.933333,g=.682353,b=.933333] +\definecolor [plum3] [r=.803922,g=.588235,b=.803922] +\definecolor [plum4] [r=.545098,g=.4,b=.545098] +\definecolor [mediumorchid1] [r=.878431,g=.4,b=1] +\definecolor [mediumorchid2] [r=.819608,g=.372549,b=.933333] +\definecolor [mediumorchid3] [r=.705882,g=.321569,b=.803922] +\definecolor [mediumorchid4] [r=.478431,g=.215686,b=.545098] +\definecolor [darkorchid1] [r=.74902,g=.243137,b=1] +\definecolor [darkorchid2] [r=.698039,g=.227451,b=.933333] +\definecolor [darkorchid3] [r=.603922,g=.196078,b=.803922] +\definecolor [darkorchid4] [r=.407843,g=.133333,b=.545098] +\definecolor [purple1] [r=.607843,g=.188235,b=1] +\definecolor [purple2] [r=.568627,g=.172549,b=.933333] +\definecolor [purple3] [r=.490196,g=.14902,b=.803922] +\definecolor [purple4] [r=.333333,g=.101961,b=.545098] +\definecolor [mediumpurple1] [r=.670588,g=.509804,b=1] +\definecolor [mediumpurple2] [r=.623529,g=.47451,b=.933333] +\definecolor [mediumpurple3] [r=.537255,g=.407843,b=.803922] +\definecolor [mediumpurple4] [r=.364706,g=.278431,b=.545098] +\definecolor [thistle1] [r=1,g=.882353,b=1] +\definecolor [thistle2] [r=.933333,g=.823529,b=.933333] +\definecolor [thistle3] [r=.803922,g=.709804,b=.803922] +\definecolor [thistle4] [r=.545098,g=.482353,b=.545098] +\definecolor [gray0] [black] +\definecolor [gray1] [s=.01] +\definecolor [gray2] [s=.02] +\definecolor [gray3] [s=.03] +\definecolor [gray4] [s=.04] +\definecolor [gray5] [s=.05] +\definecolor [gray6] [s=.06] +\definecolor [gray7] [s=.07] +\definecolor [gray8] [s=.08] +\definecolor [gray9] [s=.09] +\definecolor [gray10] [s=.1] +\definecolor [gray11] [s=.11] +\definecolor [gray12] [s=.12] +\definecolor [gray13] [s=.13] +\definecolor [gray14] [s=.14] +\definecolor [gray15] [s=.15] +\definecolor [gray16] [s=.16] +\definecolor [gray17] [s=.17] +\definecolor [gray18] [s=.18] +\definecolor [gray19] [s=.19] +\definecolor [gray20] [s=.2] +\definecolor [gray21] [s=.21] +\definecolor [gray22] [s=.22] +\definecolor [gray23] [s=.23] +\definecolor [gray24] [s=.24] +\definecolor [gray25] [s=.25] +\definecolor [gray26] [s=.26] +\definecolor [gray27] [s=.27] +\definecolor [gray28] [s=.28] +\definecolor [gray29] [s=.29] +\definecolor [gray30] [s=.3] +\definecolor [gray31] [s=.31] +\definecolor [gray32] [s=.32] +\definecolor [gray33] [s=.33] +\definecolor [gray34] [s=.34] +\definecolor [gray35] [s=.35] +\definecolor [gray36] [s=.36] +\definecolor [gray37] [s=.37] +\definecolor [gray38] [s=.38] +\definecolor [gray39] [s=.39] +\definecolor [gray40] [s=.4] +\definecolor [gray41] [s=.41] +\definecolor [gray42] [s=.42] +\definecolor [gray43] [s=.43] +\definecolor [gray44] [s=.44] +\definecolor [gray45] [s=.45] +\definecolor [gray46] [s=.46] +\definecolor [gray47] [s=.47] +\definecolor [gray48] [s=.48] +\definecolor [gray49] [s=.49] +\definecolor [gray50] [s=.5] +\definecolor [gray51] [s=.51] +\definecolor [gray52] [s=.52] +\definecolor [gray53] [s=.53] +\definecolor [gray54] [s=.54] +\definecolor [gray55] [s=.55] +\definecolor [gray56] [s=.56] +\definecolor [gray57] [s=.57] +\definecolor [gray58] [s=.58] +\definecolor [gray59] [s=.59] +\definecolor [gray60] [s=.6] +\definecolor [gray61] [s=.61] +\definecolor [gray62] [s=.62] +\definecolor [gray63] [s=.63] +\definecolor [gray64] [s=.64] +\definecolor [gray65] [s=.65] +\definecolor [gray66] [s=.66] +\definecolor [gray67] [s=.67] +\definecolor [gray68] [s=.68] +\definecolor [gray69] [s=.69] +\definecolor [gray70] [s=.7] +\definecolor [gray71] [s=.71] +\definecolor [gray72] [s=.72] +\definecolor [gray73] [s=.73] +\definecolor [gray74] [s=.74] +\definecolor [gray75] [s=.75] +\definecolor [gray76] [s=.76] +\definecolor [gray77] [s=.77] +\definecolor [gray78] [s=.78] +\definecolor [gray79] [s=.79] +\definecolor [gray80] [s=.8] +\definecolor [gray81] [s=.81] +\definecolor [gray82] [s=.82] +\definecolor [gray83] [s=.83] +\definecolor [gray84] [s=.84] +\definecolor [gray85] [s=.85] +\definecolor [gray86] [s=.86] +\definecolor [gray87] [s=.87] +\definecolor [gray88] [s=.88] +\definecolor [gray89] [s=.89] +\definecolor [gray90] [s=.9] +\definecolor [gray91] [s=.91] +\definecolor [gray92] [s=.92] +\definecolor [gray93] [s=.93] +\definecolor [gray94] [s=.94] +\definecolor [gray95] [s=.95] +\definecolor [gray96] [s=.96] +\definecolor [gray97] [s=.97] +\definecolor [gray98] [s=.98] +\definecolor [gray99] [s=.99] +\definecolor [gray100] [white] +\definecolor [darkgray] [s=.662745] +\definecolor [darkblue] [b=.545098] +\definecolor [darkcyan] [g=.545098,b=.545098] +\definecolor [darkmagenta] [r=.545098,b=.545098] +\definecolor [darkred] [r=.545098] +\definecolor [lightgreen] [r=.564706,g=.933333,b=.564706] diff --git a/Master/texmf-dist/tex/context/base/colo-ema.tex b/Master/texmf-dist/tex/context/base/colo-ema.tex deleted file mode 100644 index e5e90b2355e..00000000000 --- a/Master/texmf-dist/tex/context/base/colo-ema.tex +++ /dev/null @@ -1,590 +0,0 @@ -%D \module -%D [ file=colo-ema, -%D version=2003.03.20, -%D title=\CONTEXT\ Color Macros, -%D subtitle=Emacs Colors, -%D author=Peter Rolf, -%D date=\currentdate, -%D copyright=PRAGMA ADE] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -% author : Peter Rolf -% last change : 17 march 2003 -% origin : /emacs/etc/rgb.txt -% -% USAGE: -% -% - select emacs menu: Edit -> Text Properties -> Display -% Colors, if you don't know what I'm talking about -% - copy this file to your /texmf/tex/context/user directory -% and add "\input colo-emacs" to your tex-file -% -% IMPORTANT NOTES: -% -% - all color names are written as ONE word in lowercase -% letters (no redundancy as in rgb.txt) so if you want to -% use the color "Light Sky Blue"/"light sky blue" it's new -% name is lightskyblue -% - the grayX values [X=0..100] can only be used with \color -% [grayX] -% - use it at your own risk :) -% -% HINT: -% -% I only include this file (\showcolor [ema]) until I've -% found the colors I want. Copy and paste the color -% definitions to a seperate file, to decrease compilation -% time (540 color definitions). - -\definecolor [snow] [r=1,g=.980392,b=.980392] -\definecolor [ghostwhite] [r=.972549,g=.972549,b=1] -\definecolor [whitesmoke] [s=.960784] -\definecolor [gainsboro] [s=.862745] -\definecolor [floralwhite] [r=1,g=.980392,b=.941176] -\definecolor [oldlace] [r=.992157,g=.960784,b=.901961] -\definecolor [linen] [r=.980392,g=.941176,b=.901961] -\definecolor [antiquewhite] [r=.980392,g=.921569,b=.843137] -\definecolor [papayawhip] [r=1,g=.937255,b=.835294] -\definecolor [blanchedalmond] [r=1,g=.921569,b=.803922] -\definecolor [bisque] [r=1,g=.894118,b=.768627] -\definecolor [peachpuff] [r=1,g=.854902,b=.72549] -\definecolor [navajowhite] [r=1,g=.870588,b=.678431] -\definecolor [moccasin] [r=1,g=.894118,b=.709804] -\definecolor [cornsilk] [r=1,g=.972549,b=.862745] -\definecolor [ivory] [r=1,g=1,b=.941176] -\definecolor [lemonchiffon] [r=1,g=.980392,b=.803922] -\definecolor [seashell] [r=1,g=.960784,b=.933333] -\definecolor [honeydew] [r=.941176,g=1,b=.941176] -\definecolor [mintcream] [r=.960784,g=1,b=.980392] -\definecolor [azure] [r=.941176,g=1,b=1] -\definecolor [aliceblue] [r=.941176,g=.972549,b=1] -\definecolor [lavender] [r=.901961,g=.901961,b=.980392] -\definecolor [lavenderblush] [r=1,g=.941176,b=.960784] -\definecolor [mistyrose] [r=1,g=.894118,b=.882353] -%definecolor[white] [s=1] -%definecolor[black] [s=0] -\definecolor [darkslategray] [r=.184314,g=.309804,b=.309804] -\definecolor [dimgray] [s=.411765] -\definecolor [slategray] [r=.439216,g=.501961,b=.564706] -\definecolor [lightslategray] [r=.466667,g=.533333,b=.6] -\definecolor [gray] [s=.745098] -\definecolor [lightgray] [s=.827451] -\definecolor [midnightblue] [r=.098039,g=.098039,b=.439216] -\definecolor [navy] [b=.501961] -\definecolor [navyblue] [navy] -\definecolor [cornflowerblue] [r=.392157,g=.584314,b=.929412] -\definecolor [darkslateblue] [r=.282353,g=.239216,b=.545098] -\definecolor [slateblue] [r=.415686,g=.352941,b=.803922] -\definecolor [mediumslateblue] [r=.482353,g=.407843,b=.933333] -\definecolor [lightslateblue] [r=.517647,g=.439216,b=1] -\definecolor [mediumblue] [b=.803922] -\definecolor [royalblue] [r=.254902,g=.411765,b=.882353] -%definecolor[blue] [b=1] -\definecolor [dodgerblue] [r=.117647,g=.564706,b=1] -\definecolor [deepskyblue] [g=.74902,b=1] -\definecolor [skyblue] [r=.529412,g=.807843,b=.921569] -\definecolor [lightskyblue] [r=.529412,g=.807843,b=.980392] -\definecolor [steelblue] [r=.27451,g=.509804,b=.705882] -\definecolor [lightsteelblue] [r=.690196,g=.768627,b=.870588] -\definecolor [lightblue] [r=.678431,g=.847059,b=.901961] -\definecolor [powderblue] [r=.690196,g=.878431,b=.901961] -\definecolor [paleturquoise] [r=.686275,g=.933333,b=.933333] -\definecolor [darkturquoise] [g=.807843,b=.819608] -\definecolor [mediumturquoise] [r=.282353,g=.819608,b=.8] -\definecolor [turquoise] [r=.25098,g=.878431,b=.815686] -%definecolor[cyan] [g=1,b=1] -\definecolor [lightcyan] [r=.878431,g=1,b=1] -\definecolor [cadetblue] [r=.372549,g=.619608,b=.627451] -\definecolor [mediumaquamarine] [r=.4,g=.803922,b=.666667] -\definecolor [aquamarine] [r=.498039,g=1,b=.831373] -\definecolor [darkgreen] [g=.392157] -\definecolor [darkolivegreen] [r=.333333,g=.419608,b=.184314] -\definecolor [darkseagreen] [r=.560784,g=.737255,b=.560784] -\definecolor [seagreen] [r=.180392,g=.545098,b=.341176] -\definecolor [mediumseagreen] [r=.235294,g=.701961,b=.443137] -\definecolor [lightseagreen] [r=.12549,g=.698039,b=.666667] -\definecolor [palegreen] [r=.596078,g=.984314,b=.596078] -\definecolor [springgreen] [g=1,b=.498039] -\definecolor [lawngreen] [r=.486275,g=.988235] -%definecolor[green] [g=1] -\definecolor [chartreuse] [r=.498039,g=1] -\definecolor [mediumspringgreen] [g=.980392,b=.603922] -\definecolor [greenyellow] [r=.678431,g=1,b=.184314] -\definecolor [limegreen] [r=.196078,g=.803922,b=.196078] -\definecolor [yellowgreen] [r=.603922,g=.803922,b=.196078] -\definecolor [forestgreen] [r=.133333,g=.545098,b=.133333] -\definecolor [olivedrab] [r=.419608,g=.556863,b=.137255] -\definecolor [darkkhaki] [r=.741176,g=.717647,b=.419608] -\definecolor [khaki] [r=.941176,g=.901961,b=.54902] -\definecolor [palegoldenrod] [r=.933333,g=.909804,b=.666667] -\definecolor [lightgoldenrodyellow] [r=.980392,g=.980392,b=.823529] -\definecolor [lightyellow] [r=1,g=1,b=.878431] -%definecolor[yellow] [r=1,g=1] -\definecolor [gold] [r=1,g=.843137] -\definecolor [lightgoldenrod] [r=.933333,g=.866667,b=.509804] -\definecolor [goldenrod] [r=.854902,g=.647059,b=.12549] -\definecolor [darkgoldenrod] [r=.721569,g=.52549,b=.043137] -\definecolor [rosybrown] [r=.737255,g=.560784,b=.560784] -\definecolor [indianred] [r=.803922,g=.360784,b=.360784] -\definecolor [saddlebrown] [r=.545098,g=.270588,b=.07451] -\definecolor [sienna] [r=.627451,g=.321569,b=.176471] -\definecolor [peru] [r=.803922,g=.521569,b=.247059] -\definecolor [burlywood] [r=.870588,g=.721569,b=.529412] -\definecolor [beige] [r=.960784,g=.960784,b=.862745] -\definecolor [wheat] [r=.960784,g=.870588,b=.701961] -\definecolor [sandybrown] [r=.956863,g=.643137,b=.376471] -\definecolor [tan] [r=.823529,g=.705882,b=.54902] -\definecolor [chocolate] [r=.823529,g=.411765,b=.117647] -\definecolor [firebrick] [r=.698039,g=.133333,b=.133333] -\definecolor [brown] [r=.647059,g=.164706,b=.164706] -\definecolor [darksalmon] [r=.913725,g=.588235,b=.478431] -\definecolor [salmon] [r=.980392,g=.501961,b=.447059] -\definecolor [lightsalmon] [r=1,g=.627451,b=.478431] -\definecolor [orange] [r=1,g=.647059] -\definecolor [darkorange] [r=1,g=.54902] -\definecolor [coral] [r=1,g=.498039,b=.313725] -\definecolor [lightcoral] [r=.941176,g=.501961,b=.501961] -\definecolor [tomato] [r=1,g=.388235,b=.278431] -\definecolor [orangered] [r=1,g=.270588] -%definecolor[red] [r=1] -\definecolor [hotpink] [r=1,g=.411765,b=.705882] -\definecolor [deeppink] [r=1,g=.078431,b=.576471] -\definecolor [pink] [r=1,g=.752941,b=.796078] -\definecolor [lightpink] [r=1,g=.713725,b=.756863] -\definecolor [palevioletred] [r=.858824,g=.439216,b=.576471] -\definecolor [maroon] [r=.690196,g=.188235,b=.376471] -\definecolor [mediumvioletred] [r=.780392,g=.082353,b=.521569] -\definecolor [violetred] [r=.815686,g=.12549,b=.564706] -%definecolor[magenta] [r=1,b=1] -\definecolor [violet] [r=.933333,g=.509804,b=.933333] -\definecolor [plum] [r=.866667,g=.627451,b=.866667] -\definecolor [orchid] [r=.854902,g=.439216,b=.839216] -\definecolor [mediumorchid] [r=.729412,g=.333333,b=.827451] -\definecolor [darkorchid] [r=.6,g=.196078,b=.8] -\definecolor [darkviolet] [r=.580392,b=.827451] -\definecolor [blueviolet] [r=.541176,g=.168627,b=.886275] -\definecolor [purple] [r=.627451,g=.12549,b=.941176] -\definecolor [mediumpurple] [r=.576471,g=.439216,b=.858824] -\definecolor [thistle] [r=.847059,g=.74902,b=.847059] -\definecolor [snow1] [r=1,g=.980392,b=.980392] -\definecolor [snow2] [r=.933333,g=.913725,b=.913725] -\definecolor [snow3] [r=.803922,g=.788235,b=.788235] -\definecolor [snow4] [r=.545098,g=.537255,b=.537255] -\definecolor [seashell1] [r=1,g=.960784,b=.933333] -\definecolor [seashell2] [r=.933333,g=.898039,b=.870588] -\definecolor [seashell3] [r=.803922,g=.772549,b=.74902] -\definecolor [seashell4] [r=.545098,g=.52549,b=.509804] -\definecolor [antiquewhite1] [r=1,g=.937255,b=.858824] -\definecolor [antiquewhite2] [r=.933333,g=.87451,b=.8] -\definecolor [antiquewhite3] [r=.803922,g=.752941,b=.690196] -\definecolor [antiquewhite4] [r=.545098,g=.513725,b=.470588] -\definecolor [bisque1] [r=1,g=.894118,b=.768627] -\definecolor [bisque2] [r=.933333,g=.835294,b=.717647] -\definecolor [bisque3] [r=.803922,g=.717647,b=.619608] -\definecolor [bisque4] [r=.545098,g=.490196,b=.419608] -\definecolor [peachpuff1] [r=1,g=.854902,b=.72549] -\definecolor [peachpuff2] [r=.933333,g=.796078,b=.678431] -\definecolor [peachpuff3] [r=.803922,g=.686275,b=.584314] -\definecolor [peachpuff4] [r=.545098,g=.466667,b=.396078] -\definecolor [navajowhite1] [r=1,g=.870588,b=.678431] -\definecolor [navajowhite2] [r=.933333,g=.811765,b=.631373] -\definecolor [navajowhite3] [r=.803922,g=.701961,b=.545098] -\definecolor [navajowhite4] [r=.545098,g=.47451,b=.368627] -\definecolor [lemonchiffon1] [r=1,g=.980392,b=.803922] -\definecolor [lemonchiffon2] [r=.933333,g=.913725,b=.74902] -\definecolor [lemonchiffon3] [r=.803922,g=.788235,b=.647059] -\definecolor [lemonchiffon4] [r=.545098,g=.537255,b=.439216] -\definecolor [cornsilk1] [r=1,g=.972549,b=.862745] -\definecolor [cornsilk2] [r=.933333,g=.909804,b=.803922] -\definecolor [cornsilk3] [r=.803922,g=.784314,b=.694118] -\definecolor [cornsilk4] [r=.545098,g=.533333,b=.470588] -\definecolor [ivory1] [r=1,g=1,b=.941176] -\definecolor [ivory2] [r=.933333,g=.933333,b=.878431] -\definecolor [ivory3] [r=.803922,g=.803922,b=.756863] -\definecolor [ivory4] [r=.545098,g=.545098,b=.513725] -\definecolor [honeydew1] [r=.941176,g=1,b=.941176] -\definecolor [honeydew2] [r=.878431,g=.933333,b=.878431] -\definecolor [honeydew3] [r=.756863,g=.803922,b=.756863] -\definecolor [honeydew4] [r=.513725,g=.545098,b=.513725] -\definecolor [lavenderblush1] [r=1,g=.941176,b=.960784] -\definecolor [lavenderblush2] [r=.933333,g=.878431,b=.898039] -\definecolor [lavenderblush3] [r=.803922,g=.756863,b=.772549] -\definecolor [lavenderblush4] [r=.545098,g=.513725,b=.52549] -\definecolor [mistyrose1] [r=1,g=.894118,b=.882353] -\definecolor [mistyrose2] [r=.933333,g=.835294,b=.823529] -\definecolor [mistyrose3] [r=.803922,g=.717647,b=.709804] -\definecolor [mistyrose4] [r=.545098,g=.490196,b=.482353] -\definecolor [azure1] [r=.941176,g=1,b=1] -\definecolor [azure2] [r=.878431,g=.933333,b=.933333] -\definecolor [azure3] [r=.756863,g=.803922,b=.803922] -\definecolor [azure4] [r=.513725,g=.545098,b=.545098] -\definecolor [slateblue1] [r=.513725,g=.435294,b=1] -\definecolor [slateblue2] [r=.478431,g=.403922,b=.933333] -\definecolor [slateblue3] [r=.411765,g=.34902,b=.803922] -\definecolor [slateblue4] [r=.278431,g=.235294,b=.545098] -\definecolor [royalblue1] [r=.282353,g=.462745,b=1] -\definecolor [royalblue2] [r=.262745,g=.431373,b=.933333] -\definecolor [royalblue3] [r=.227451,g=.372549,b=.803922] -\definecolor [royalblue4] [r=.152941,g=.25098,b=.545098] -\definecolor [blue1] [blue] -\definecolor [blue2] [b=.933333] -\definecolor [blue3] [b=.803922] -\definecolor [blue4] [b=.545098] -\definecolor [dodgerblue1] [r=.117647,g=.564706,b=1] -\definecolor [dodgerblue2] [r=.109804,g=.52549,b=.933333] -\definecolor [dodgerblue3] [r=.094118,g=.454902,b=.803922] -\definecolor [dodgerblue4] [r=.062745,g=.305882,b=.545098] -\definecolor [steelblue1] [r=.388235,g=.721569,b=1] -\definecolor [steelblue2] [r=.360784,g=.67451,b=.933333] -\definecolor [steelblue3] [r=.309804,g=.580392,b=.803922] -\definecolor [steelblue4] [r=.211765,g=.392157,b=.545098] -\definecolor [deepskyblue1] [g=.74902,b=1] -\definecolor [deepskyblue2] [g=.698039,b=.933333] -\definecolor [deepskyblue3] [g=.603922,b=.803922] -\definecolor [deepskyblue4] [g=.407843,b=.545098] -\definecolor [skyblue1] [r=.529412,g=.807843,b=1] -\definecolor [skyblue2] [r=.494118,g=.752941,b=.933333] -\definecolor [skyblue3] [r=.423529,g=.65098,b=.803922] -\definecolor [skyblue4] [r=.290196,g=.439216,b=.545098] -\definecolor [lightskyblue1] [r=.690196,g=.886275,b=1] -\definecolor [lightskyblue2] [r=.643137,g=.827451,b=.933333] -\definecolor [lightskyblue3] [r=.552941,g=.713725,b=.803922] -\definecolor [lightskyblue4] [r=.376471,g=.482353,b=.545098] -\definecolor [slategray1] [r=.776471,g=.886275,b=1] -\definecolor [slategray2] [r=.72549,g=.827451,b=.933333] -\definecolor [slategray3] [r=.623529,g=.713725,b=.803922] -\definecolor [slategray4] [r=.423529,g=.482353,b=.545098] -\definecolor [lightsteelblue1] [r=.792157,g=.882353,b=1] -\definecolor [lightsteelblue2] [r=.737255,g=.823529,b=.933333] -\definecolor [lightsteelblue3] [r=.635294,g=.709804,b=.803922] -\definecolor [lightsteelblue4] [r=.431373,g=.482353,b=.545098] -\definecolor [lightblue1] [r=.74902,g=.937255,b=1] -\definecolor [lightblue2] [r=.698039,g=.87451,b=.933333] -\definecolor [lightblue3] [r=.603922,g=.752941,b=.803922] -\definecolor [lightblue4] [r=.407843,g=.513725,b=.545098] -\definecolor [lightcyan1] [r=.878431,g=1,b=1] -\definecolor [lightcyan2] [r=.819608,g=.933333,b=.933333] -\definecolor [lightcyan3] [r=.705882,g=.803922,b=.803922] -\definecolor [lightcyan4] [r=.478431,g=.545098,b=.545098] -\definecolor [paleturquoise1] [r=.733333,g=1,b=1] -\definecolor [paleturquoise2] [r=.682353,g=.933333,b=.933333] -\definecolor [paleturquoise3] [r=.588235,g=.803922,b=.803922] -\definecolor [paleturquoise4] [r=.4,g=.545098,b=.545098] -\definecolor [cadetblue1] [r=.596078,g=.960784,b=1] -\definecolor [cadetblue2] [r=.556863,g=.898039,b=.933333] -\definecolor [cadetblue3] [r=.478431,g=.772549,b=.803922] -\definecolor [cadetblue4] [r=.32549,g=.52549,b=.545098] -\definecolor [turquoise1] [g=.960784,b=1] -\definecolor [turquoise2] [g=.898039,b=.933333] -\definecolor [turquoise3] [g=.772549,b=.803922] -\definecolor [turquoise4] [g=.52549,b=.545098] -\definecolor [cyan1] [cyan] -\definecolor [cyan2] [g=.933333,b=.933333] -\definecolor [cyan3] [g=.803922,b=.803922] -\definecolor [cyan4] [g=.545098,b=.545098] -\definecolor [darkslategray1] [r=.592157,g=1,b=1] -\definecolor [darkslategray2] [r=.552941,g=.933333,b=.933333] -\definecolor [darkslategray3] [r=.47451,g=.803922,b=.803922] -\definecolor [darkslategray4] [r=.321569,g=.545098,b=.545098] -\definecolor [aquamarine1] [r=.498039,g=1,b=.831373] -\definecolor [aquamarine2] [r=.462745,g=.933333,b=.776471] -\definecolor [aquamarine3] [r=.4,g=.803922,b=.666667] -\definecolor [aquamarine4] [r=.270588,g=.545098,b=.454902] -\definecolor [darkseagreen1] [r=.756863,g=1,b=.756863] -\definecolor [darkseagreen2] [r=.705882,g=.933333,b=.705882] -\definecolor [darkseagreen3] [r=.607843,g=.803922,b=.607843] -\definecolor [darkseagreen4] [r=.411765,g=.545098,b=.411765] -\definecolor [seagreen1] [r=.329412,g=1,b=.623529] -\definecolor [seagreen2] [r=.305882,g=.933333,b=.580392] -\definecolor [seagreen3] [r=.262745,g=.803922,b=.501961] -\definecolor [seagreen4] [r=.180392,g=.545098,b=.341176] -\definecolor [palegreen1] [r=.603922,g=1,b=.603922] -\definecolor [palegreen2] [r=.564706,g=.933333,b=.564706] -\definecolor [palegreen3] [r=.486275,g=.803922,b=.486275] -\definecolor [palegreen4] [r=.329412,g=.545098,b=.329412] -\definecolor [springgreen1] [g=1,b=.498039] -\definecolor [springgreen2] [g=.933333,b=.462745] -\definecolor [springgreen3] [g=.803922,b=.4] -\definecolor [springgreen4] [g=.545098,b=.270588] -\definecolor [green1] [green] -\definecolor [green2] [g=.933333] -\definecolor [green3] [g=.803922] -\definecolor [green4] [g=.545098] -\definecolor [chartreuse1] [r=.498039,g=1] -\definecolor [chartreuse2] [r=.462745,g=.933333] -\definecolor [chartreuse3] [r=.4,g=.803922] -\definecolor [chartreuse4] [r=.270588,g=.545098] -\definecolor [olivedrab1] [r=.752941,g=1,b=.243137] -\definecolor [olivedrab2] [r=.701961,g=.933333,b=.227451] -\definecolor [olivedrab3] [r=.603922,g=.803922,b=.196078] -\definecolor [olivedrab4] [r=.411765,g=.545098,b=.133333] -\definecolor [darkolivegreen1] [r=.792157,g=1,b=.439216] -\definecolor [darkolivegreen2] [r=.737255,g=.933333,b=.407843] -\definecolor [darkolivegreen3] [r=.635294,g=.803922,b=.352941] -\definecolor [darkolivegreen4] [r=.431373,g=.545098,b=.239216] -\definecolor [khaki1] [r=1,g=.964706,b=.560784] -\definecolor [khaki2] [r=.933333,g=.901961,b=.521569] -\definecolor [khaki3] [r=.803922,g=.776471,b=.45098] -\definecolor [khaki4] [r=.545098,g=.52549,b=.305882] -\definecolor [lightgoldenrod1] [r=1,g=.92549,b=.545098] -\definecolor [lightgoldenrod2] [r=.933333,g=.862745,b=.509804] -\definecolor [lightgoldenrod3] [r=.803922,g=.745098,b=.439216] -\definecolor [lightgoldenrod4] [r=.545098,g=.505882,b=.298039] -\definecolor [lightyellow1] [r=1,g=1,b=.878431] -\definecolor [lightyellow2] [r=.933333,g=.933333,b=.819608] -\definecolor [lightyellow3] [r=.803922,g=.803922,b=.705882] -\definecolor [lightyellow4] [r=.545098,g=.545098,b=.478431] -\definecolor [yellow1] [yellow] -\definecolor [yellow2] [r=.933333,g=.933333] -\definecolor [yellow3] [r=.803922,g=.803922] -\definecolor [yellow4] [r=.545098,g=.545098] -\definecolor [gold1] [r=1,g=.843137] -\definecolor [gold2] [r=.933333,g=.788235] -\definecolor [gold3] [r=.803922,g=.678431] -\definecolor [gold4] [r=.545098,g=.458824] -\definecolor [goldenrod1] [r=1,g=.756863,b=.145098] -\definecolor [goldenrod2] [r=.933333,g=.705882,b=.133333] -\definecolor [goldenrod3] [r=.803922,g=.607843,b=.113725] -\definecolor [goldenrod4] [r=.545098,g=.411765,b=.078431] -\definecolor [darkgoldenrod1] [r=1,g=.72549,b=.058824] -\definecolor [darkgoldenrod2] [r=.933333,g=.678431,b=.054902] -\definecolor [darkgoldenrod3] [r=.803922,g=.584314,b=.047059] -\definecolor [darkgoldenrod4] [r=.545098,g=.396078,b=.031373] -\definecolor [rosybrown1] [r=1,g=.756863,b=.756863] -\definecolor [rosybrown2] [r=.933333,g=.705882,b=.705882] -\definecolor [rosybrown3] [r=.803922,g=.607843,b=.607843] -\definecolor [rosybrown4] [r=.545098,g=.411765,b=.411765] -\definecolor [indianred1] [r=1,g=.415686,b=.415686] -\definecolor [indianred2] [r=.933333,g=.388235,b=.388235] -\definecolor [indianred3] [r=.803922,g=.333333,b=.333333] -\definecolor [indianred4] [r=.545098,g=.227451,b=.227451] -\definecolor [sienna1] [r=1,g=.509804,b=.278431] -\definecolor [sienna2] [r=.933333,g=.47451,b=.258824] -\definecolor [sienna3] [r=.803922,g=.407843,b=.223529] -\definecolor [sienna4] [r=.545098,g=.278431,b=.14902] -\definecolor [burlywood1] [r=1,g=.827451,b=.607843] -\definecolor [burlywood2] [r=.933333,g=.772549,b=.568627] -\definecolor [burlywood3] [r=.803922,g=.666667,b=.490196] -\definecolor [burlywood4] [r=.545098,g=.45098,b=.333333] -\definecolor [wheat1] [r=1,g=.905882,b=.729412] -\definecolor [wheat2] [r=.933333,g=.847059,b=.682353] -\definecolor [wheat3] [r=.803922,g=.729412,b=.588235] -\definecolor [wheat4] [r=.545098,g=.494118,b=.4] -\definecolor [tan1] [r=1,g=.647059,b=.309804] -\definecolor [tan2] [r=.933333,g=.603922,b=.286275] -\definecolor [tan3] [r=.803922,g=.521569,b=.247059] -\definecolor [tan4] [r=.545098,g=.352941,b=.168627] -\definecolor [chocolate1] [r=1,g=.498039,b=.141176] -\definecolor [chocolate2] [r=.933333,g=.462745,b=.129412] -\definecolor [chocolate3] [r=.803922,g=.4,b=.113725] -\definecolor [chocolate4] [r=.545098,g=.270588,b=.07451] -\definecolor [firebrick1] [r=1,g=.188235,b=.188235] -\definecolor [firebrick2] [r=.933333,g=.172549,b=.172549] -\definecolor [firebrick3] [r=.803922,g=.14902,b=.14902] -\definecolor [firebrick4] [r=.545098,g=.101961,b=.101961] -\definecolor [brown1] [r=1,g=.25098,b=.25098] -\definecolor [brown2] [r=.933333,g=.231373,b=.231373] -\definecolor [brown3] [r=.803922,g=.2,b=.2] -\definecolor [brown4] [r=.545098,g=.137255,b=.137255] -\definecolor [salmon1] [r=1,g=.54902,b=.411765] -\definecolor [salmon2] [r=.933333,g=.509804,b=.384314] -\definecolor [salmon3] [r=.803922,g=.439216,b=.329412] -\definecolor [salmon4] [r=.545098,g=.298039,b=.223529] -\definecolor [lightsalmon1] [r=1,g=.627451,b=.478431] -\definecolor [lightsalmon2] [r=.933333,g=.584314,b=.447059] -\definecolor [lightsalmon3] [r=.803922,g=.505882,b=.384314] -\definecolor [lightsalmon4] [r=.545098,g=.341176,b=.258824] -\definecolor [orange1] [r=1,g=.647059] -\definecolor [orange2] [r=.933333,g=.603922] -\definecolor [orange3] [r=.803922,g=.521569] -\definecolor [orange4] [r=.545098,g=.352941] -\definecolor [darkorange1] [r=1,g=.498039] -\definecolor [darkorange2] [r=.933333,g=.462745] -\definecolor [darkorange3] [r=.803922,g=.4] -\definecolor [darkorange4] [r=.545098,g=.270588] -\definecolor [coral1] [r=1,g=.447059,b=.337255] -\definecolor [coral2] [r=.933333,g=.415686,b=.313725] -\definecolor [coral3] [r=.803922,g=.356863,b=.270588] -\definecolor [coral4] [r=.545098,g=.243137,b=.184314] -\definecolor [tomato1] [r=1,g=.388235,b=.278431] -\definecolor [tomato2] [r=.933333,g=.360784,b=.258824] -\definecolor [tomato3] [r=.803922,g=.309804,b=.223529] -\definecolor [tomato4] [r=.545098,g=.211765,b=.14902] -\definecolor [orangered1] [r=1,g=.270588] -\definecolor [orangered2] [r=.933333,g=.25098] -\definecolor [orangered3] [r=.803922,g=.215686] -\definecolor [orangered4] [r=.545098,g=.145098] -\definecolor [red1] [red] -\definecolor [red2] [r=.933333] -\definecolor [red3] [r=.803922] -\definecolor [red4] [r=.545098] -\definecolor [deeppink1] [r=1,g=.078431,b=.576471] -\definecolor [deeppink2] [r=.933333,g=.070588,b=.537255] -\definecolor [deeppink3] [r=.803922,g=.062745,b=.462745] -\definecolor [deeppink4] [r=.545098,g=.039216,b=.313725] -\definecolor [hotpink1] [r=1,g=.431373,b=.705882] -\definecolor [hotpink2] [r=.933333,g=.415686,b=.654902] -\definecolor [hotpink3] [r=.803922,g=.376471,b=.564706] -\definecolor [hotpink4] [r=.545098,g=.227451,b=.384314] -\definecolor [pink1] [r=1,g=.709804,b=.772549] -\definecolor [pink2] [r=.933333,g=.662745,b=.721569] -\definecolor [pink3] [r=.803922,g=.568627,b=.619608] -\definecolor [pink4] [r=.545098,g=.388235,b=.423529] -\definecolor [lightpink1] [r=1,g=.682353,b=.72549] -\definecolor [lightpink2] [r=.933333,g=.635294,b=.678431] -\definecolor [lightpink3] [r=.803922,g=.54902,b=.584314] -\definecolor [lightpink4] [r=.545098,g=.372549,b=.396078] -\definecolor [palevioletred1] [r=1,g=.509804,b=.670588] -\definecolor [palevioletred2] [r=.933333,g=.47451,b=.623529] -\definecolor [palevioletred3] [r=.803922,g=.407843,b=.537255] -\definecolor [palevioletred4] [r=.545098,g=.278431,b=.364706] -\definecolor [maroon1] [r=1,g=.203922,b=.701961] -\definecolor [maroon2] [r=.933333,g=.188235,b=.654902] -\definecolor [maroon3] [r=.803922,g=.160784,b=.564706] -\definecolor [maroon4] [r=.545098,g=.109804,b=.384314] -\definecolor [violetred1] [r=1,g=.243137,b=.588235] -\definecolor [violetred2] [r=.933333,g=.227451,b=.54902] -\definecolor [violetred3] [r=.803922,g=.196078,b=.470588] -\definecolor [violetred4] [r=.545098,g=.133333,b=.321569] -\definecolor [magenta1] [magenta] -\definecolor [magenta2] [r=.933333,b=.933333] -\definecolor [magenta3] [r=.803922,b=.803922] -\definecolor [magenta4] [r=.545098,b=.545098] -\definecolor [orchid1] [r=1,g=.513725,b=.980392] -\definecolor [orchid2] [r=.933333,g=.478431,b=.913725] -\definecolor [orchid3] [r=.803922,g=.411765,b=.788235] -\definecolor [orchid4] [r=.545098,g=.278431,b=.537255] -\definecolor [plum1] [r=1,g=.733333,b=1] -\definecolor [plum2] [r=.933333,g=.682353,b=.933333] -\definecolor [plum3] [r=.803922,g=.588235,b=.803922] -\definecolor [plum4] [r=.545098,g=.4,b=.545098] -\definecolor [mediumorchid1] [r=.878431,g=.4,b=1] -\definecolor [mediumorchid2] [r=.819608,g=.372549,b=.933333] -\definecolor [mediumorchid3] [r=.705882,g=.321569,b=.803922] -\definecolor [mediumorchid4] [r=.478431,g=.215686,b=.545098] -\definecolor [darkorchid1] [r=.74902,g=.243137,b=1] -\definecolor [darkorchid2] [r=.698039,g=.227451,b=.933333] -\definecolor [darkorchid3] [r=.603922,g=.196078,b=.803922] -\definecolor [darkorchid4] [r=.407843,g=.133333,b=.545098] -\definecolor [purple1] [r=.607843,g=.188235,b=1] -\definecolor [purple2] [r=.568627,g=.172549,b=.933333] -\definecolor [purple3] [r=.490196,g=.14902,b=.803922] -\definecolor [purple4] [r=.333333,g=.101961,b=.545098] -\definecolor [mediumpurple1] [r=.670588,g=.509804,b=1] -\definecolor [mediumpurple2] [r=.623529,g=.47451,b=.933333] -\definecolor [mediumpurple3] [r=.537255,g=.407843,b=.803922] -\definecolor [mediumpurple4] [r=.364706,g=.278431,b=.545098] -\definecolor [thistle1] [r=1,g=.882353,b=1] -\definecolor [thistle2] [r=.933333,g=.823529,b=.933333] -\definecolor [thistle3] [r=.803922,g=.709804,b=.803922] -\definecolor [thistle4] [r=.545098,g=.482353,b=.545098] -\definecolor [gray0] [black] -\definecolor [gray1] [s=.01] -\definecolor [gray2] [s=.02] -\definecolor [gray3] [s=.03] -\definecolor [gray4] [s=.04] -\definecolor [gray5] [s=.05] -\definecolor [gray6] [s=.06] -\definecolor [gray7] [s=.07] -\definecolor [gray8] [s=.08] -\definecolor [gray9] [s=.09] -\definecolor [gray10] [s=.1] -\definecolor [gray11] [s=.11] -\definecolor [gray12] [s=.12] -\definecolor [gray13] [s=.13] -\definecolor [gray14] [s=.14] -\definecolor [gray15] [s=.15] -\definecolor [gray16] [s=.16] -\definecolor [gray17] [s=.17] -\definecolor [gray18] [s=.18] -\definecolor [gray19] [s=.19] -\definecolor [gray20] [s=.2] -\definecolor [gray21] [s=.21] -\definecolor [gray22] [s=.22] -\definecolor [gray23] [s=.23] -\definecolor [gray24] [s=.24] -\definecolor [gray25] [s=.25] -\definecolor [gray26] [s=.26] -\definecolor [gray27] [s=.27] -\definecolor [gray28] [s=.28] -\definecolor [gray29] [s=.29] -\definecolor [gray30] [s=.3] -\definecolor [gray31] [s=.31] -\definecolor [gray32] [s=.32] -\definecolor [gray33] [s=.33] -\definecolor [gray34] [s=.34] -\definecolor [gray35] [s=.35] -\definecolor [gray36] [s=.36] -\definecolor [gray37] [s=.37] -\definecolor [gray38] [s=.38] -\definecolor [gray39] [s=.39] -\definecolor [gray40] [s=.4] -\definecolor [gray41] [s=.41] -\definecolor [gray42] [s=.42] -\definecolor [gray43] [s=.43] -\definecolor [gray44] [s=.44] -\definecolor [gray45] [s=.45] -\definecolor [gray46] [s=.46] -\definecolor [gray47] [s=.47] -\definecolor [gray48] [s=.48] -\definecolor [gray49] [s=.49] -\definecolor [gray50] [s=.5] -\definecolor [gray51] [s=.51] -\definecolor [gray52] [s=.52] -\definecolor [gray53] [s=.53] -\definecolor [gray54] [s=.54] -\definecolor [gray55] [s=.55] -\definecolor [gray56] [s=.56] -\definecolor [gray57] [s=.57] -\definecolor [gray58] [s=.58] -\definecolor [gray59] [s=.59] -\definecolor [gray60] [s=.6] -\definecolor [gray61] [s=.61] -\definecolor [gray62] [s=.62] -\definecolor [gray63] [s=.63] -\definecolor [gray64] [s=.64] -\definecolor [gray65] [s=.65] -\definecolor [gray66] [s=.66] -\definecolor [gray67] [s=.67] -\definecolor [gray68] [s=.68] -\definecolor [gray69] [s=.69] -\definecolor [gray70] [s=.7] -\definecolor [gray71] [s=.71] -\definecolor [gray72] [s=.72] -\definecolor [gray73] [s=.73] -\definecolor [gray74] [s=.74] -\definecolor [gray75] [s=.75] -\definecolor [gray76] [s=.76] -\definecolor [gray77] [s=.77] -\definecolor [gray78] [s=.78] -\definecolor [gray79] [s=.79] -\definecolor [gray80] [s=.8] -\definecolor [gray81] [s=.81] -\definecolor [gray82] [s=.82] -\definecolor [gray83] [s=.83] -\definecolor [gray84] [s=.84] -\definecolor [gray85] [s=.85] -\definecolor [gray86] [s=.86] -\definecolor [gray87] [s=.87] -\definecolor [gray88] [s=.88] -\definecolor [gray89] [s=.89] -\definecolor [gray90] [s=.9] -\definecolor [gray91] [s=.91] -\definecolor [gray92] [s=.92] -\definecolor [gray93] [s=.93] -\definecolor [gray94] [s=.94] -\definecolor [gray95] [s=.95] -\definecolor [gray96] [s=.96] -\definecolor [gray97] [s=.97] -\definecolor [gray98] [s=.98] -\definecolor [gray99] [s=.99] -\definecolor [gray100] [white] -\definecolor [darkgray] [s=.662745] -\definecolor [darkblue] [b=.545098] -\definecolor [darkcyan] [g=.545098,b=.545098] -\definecolor [darkmagenta] [r=.545098,b=.545098] -\definecolor [darkred] [r=.545098] -\definecolor [lightgreen] [r=.564706,g=.933333,b=.564706] diff --git a/Master/texmf-dist/tex/context/base/colo-ext.mkiv b/Master/texmf-dist/tex/context/base/colo-ext.mkiv index b17608f59c1..771974d4d4f 100644 --- a/Master/texmf-dist/tex/context/base/colo-ext.mkiv +++ b/Master/texmf-dist/tex/context/base/colo-ext.mkiv @@ -76,14 +76,25 @@ \setupcolors[\c!intent=\v!none] % A goodie that replaces the startMPcolor hackery -% + % \definecolor[red-t] [r=1,t=0.5,a=1] % \definecolor[green-t][g=1,t=0.5,a=1] +% % \defineintermediatecolor[mycolora][0.5,red,green] % \defineintermediatecolor[mycolorb][0.5,red-t,green-t] +% +% \definecolor[mycolorc][.5(blue,red)] +% \definecolor[mycolord][.5(blue)] +% +% \enabledirectives[colors.pgf] +% \definecolor[mycolorx][magenta!50!yellow] +% % \starttext % test {\mycolora OEPS} test % test {\mycolorb OEPS} test +% test {\mycolorc OEPS} test +% test {\mycolord OEPS} test +% test {\mycolorx OEPS} test % \stoptext \unexpanded\def\defineintermediatecolor @@ -94,7 +105,7 @@ \def\dododefineintermediatecolor[#1][#2,#3,#4][#5]% {\ifconditional\collectcolorsinlist\collectcolorinlist{#1}\fi - \ctxlua{colors.defineintermediatecolor("#1","#2", + \ctxcommand{defineintermediatecolor("#1","#2", \thecolorattribute{#3},\thecolorattribute{#4}, \thetransparencyattribute{#3},\thetransparencyattribute{#4}, "#5",false,\iffreezecolors true\else false\fi)}% not global diff --git a/Master/texmf-dist/tex/context/base/colo-hex.mkiv b/Master/texmf-dist/tex/context/base/colo-hex.mkiv deleted file mode 100644 index f661b2445f1..00000000000 --- a/Master/texmf-dist/tex/context/base/colo-hex.mkiv +++ /dev/null @@ -1,28 +0,0 @@ -%D \module -%D [ file=colo-hex, -%D version=2004.06.23, -%D title=\CONTEXT\ Color Macros, -%D subtitle=Hex Colors, -%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 built in. - -% \definecolor[rgbtestcolor] [r=0.87843,g=0.87451,b=0.89020] % RGB(224,223,227) -% \definecolor[hextestcolor] [\letterhash E0DFE3] % or [h=E0DFE3] -% -% \startMPpage -% path p ; % example by Peter Rolf -% p := unitsquare xyscaled(5cm,5cm) ; -% fill (point 0 of p -- point 1 of p -- point 2 of p --cycle) withcolor \MPcolor{rgbtestcolor} ; % bottom right part of the square -% fill (point 0 of p -- point 3 of p -- point 2 of p --cycle) withcolor \MPcolor{hextestcolor} ; % top left part -% \stopMPpage - -\def\checkhexcolor[#1]{\doifcolorelse{#1}\donothing{\definecolor[#1][x=#1]}} % is this ok? - -\endinput diff --git a/Master/texmf-dist/tex/context/base/colo-hex.tex b/Master/texmf-dist/tex/context/base/colo-hex.tex deleted file mode 100644 index 7d223c131d9..00000000000 --- a/Master/texmf-dist/tex/context/base/colo-hex.tex +++ /dev/null @@ -1,3 +0,0 @@ -% this is just a stub - -\loadmarkfile{colo-hex} diff --git a/Master/texmf-dist/tex/context/base/colo-icc.lua b/Master/texmf-dist/tex/context/base/colo-icc.lua new file mode 100644 index 00000000000..904d42143d4 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/colo-icc.lua @@ -0,0 +1,120 @@ +if not modules then modules = { } end modules ['colo-ini'] = { + version = 1.000, + comment = "companion to colo-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local char, byte, gsub, match, format, strip = string.char, string.byte, string.gsub, string.match, string.format, string.strip +local readstring, readnumber = io.readstring, io.readnumber + +local colors = attributes and attributes.colors or { } -- when used in mtxrun + +local report_colors = logs.reporter("colors","icc") + +local R, Cs, lpegmatch = lpeg.R, lpeg.Cs, lpeg.match + +local invalid = R(char(0)..char(31)) +local cleaned = invalid^0 * Cs((1-invalid)^0) + +function colors.iccprofile(filename,verbose) + local fullname = resolvers.findfile(filename,"icc") or "" + if fullname == "" then + local locate = resolvers.finders.byscheme -- not in mtxrun + if locate then + fullname = locate("loc",filename) + end + end + if fullname == "" then + return nil, false, format("profile '%s' cannot be found",filename) + end + local f = io.open(fullname,"rb") + if not f then + return nil, false, format("profile '%s'cannot be loaded",fullname) + end + local header = { + size = readnumber(f,4), + cmmtype = readnumber(f,4), + version = readnumber(f,4), + deviceclass = strip(readstring(f,4)), + colorspace = strip(readstring(f,4)), + connectionspace = strip(readstring(f,4)), + datetime = { + year = readnumber(f,2), + month = readnumber(f,2), + day = readnumber(f,2), + hour = readnumber(f,2), + minutes = readnumber(f,2), + seconds = readnumber(f,2), + }, + filesignature = strip(readstring(f,4)), + platformsignature = strip(readstring(f,4)), + options = readnumber(f,4), + devicemanufacturer = strip(readstring(f,4)), + devicemodel = strip(readstring(f,4)), + deviceattributes = readnumber(f,4), + renderingintent = readnumber(f,4), + illuminantxyz = { + x = readnumber(f,4), + y = readnumber(f,4), + z = readnumber(f,4), + }, + profilecreator = readnumber(f,4), + id = strip(readstring(f,16)), + } + local tags = { } + for i=1,readnumber(f,128,4) do + tags[readstring(f,4)] = { + offset = readnumber(f,4), + length = readnumber(f,4), + } + end + local o = header.options + header.options = + o == 0 and "embedded" or + o == 1 and "dependent" or "unknown" + local d = header.deviceattributes + header.deviceattributes = { + [number.hasbit(d,1) and "transparency" or "reflective"] = true, + [number.hasbit(d,2) and "mate" or "glossy" ] = true, + [number.hasbit(d,3) and "negative" or "positive" ] = true, + [number.hasbit(d,4) and "bw" or "color" ] = true, + } + local r = header.renderingintent + header.renderingintent = + r == 0 and "perceptual" or + r == 1 and "relative" or + r == 2 and "saturation" or + r == 3 and "absolute" or "unknown" + for tag, spec in next, tags do + if tag then + local offset, length = spec.offset, spec.length + local variant = readstring(f,offset,4) + if variant == "text" or variant == "desc" then + local str = readstring(f,length-4) + tags[tag] = { + data = str, + cleaned = lpegmatch(cleaned,str), + } + else + if verbose then + report_colors("ignoring tag '%s' or type '%s' in profile '%s'",tag,variant,fullname) + end + tags[tag] = nil + end + end + end + f:close() + local profile = { + filename = filename, + fullname = fullname, + header = header, + tags = tags, + } + return profile, true, format("profile '%s' loaded",fullname) +end + +--~ local profile, error, message = colors.iccprofile("ussheetfedcoated.icc") +--~ print(error,message) +--~ table.print(profile) diff --git a/Master/texmf-dist/tex/context/base/colo-imp-ema.mkiv b/Master/texmf-dist/tex/context/base/colo-imp-ema.mkiv new file mode 100644 index 00000000000..e5e90b2355e --- /dev/null +++ b/Master/texmf-dist/tex/context/base/colo-imp-ema.mkiv @@ -0,0 +1,590 @@ +%D \module +%D [ file=colo-ema, +%D version=2003.03.20, +%D title=\CONTEXT\ Color Macros, +%D subtitle=Emacs Colors, +%D author=Peter Rolf, +%D date=\currentdate, +%D copyright=PRAGMA ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% author : Peter Rolf +% last change : 17 march 2003 +% origin : /emacs/etc/rgb.txt +% +% USAGE: +% +% - select emacs menu: Edit -> Text Properties -> Display +% Colors, if you don't know what I'm talking about +% - copy this file to your /texmf/tex/context/user directory +% and add "\input colo-emacs" to your tex-file +% +% IMPORTANT NOTES: +% +% - all color names are written as ONE word in lowercase +% letters (no redundancy as in rgb.txt) so if you want to +% use the color "Light Sky Blue"/"light sky blue" it's new +% name is lightskyblue +% - the grayX values [X=0..100] can only be used with \color +% [grayX] +% - use it at your own risk :) +% +% HINT: +% +% I only include this file (\showcolor [ema]) until I've +% found the colors I want. Copy and paste the color +% definitions to a seperate file, to decrease compilation +% time (540 color definitions). + +\definecolor [snow] [r=1,g=.980392,b=.980392] +\definecolor [ghostwhite] [r=.972549,g=.972549,b=1] +\definecolor [whitesmoke] [s=.960784] +\definecolor [gainsboro] [s=.862745] +\definecolor [floralwhite] [r=1,g=.980392,b=.941176] +\definecolor [oldlace] [r=.992157,g=.960784,b=.901961] +\definecolor [linen] [r=.980392,g=.941176,b=.901961] +\definecolor [antiquewhite] [r=.980392,g=.921569,b=.843137] +\definecolor [papayawhip] [r=1,g=.937255,b=.835294] +\definecolor [blanchedalmond] [r=1,g=.921569,b=.803922] +\definecolor [bisque] [r=1,g=.894118,b=.768627] +\definecolor [peachpuff] [r=1,g=.854902,b=.72549] +\definecolor [navajowhite] [r=1,g=.870588,b=.678431] +\definecolor [moccasin] [r=1,g=.894118,b=.709804] +\definecolor [cornsilk] [r=1,g=.972549,b=.862745] +\definecolor [ivory] [r=1,g=1,b=.941176] +\definecolor [lemonchiffon] [r=1,g=.980392,b=.803922] +\definecolor [seashell] [r=1,g=.960784,b=.933333] +\definecolor [honeydew] [r=.941176,g=1,b=.941176] +\definecolor [mintcream] [r=.960784,g=1,b=.980392] +\definecolor [azure] [r=.941176,g=1,b=1] +\definecolor [aliceblue] [r=.941176,g=.972549,b=1] +\definecolor [lavender] [r=.901961,g=.901961,b=.980392] +\definecolor [lavenderblush] [r=1,g=.941176,b=.960784] +\definecolor [mistyrose] [r=1,g=.894118,b=.882353] +%definecolor[white] [s=1] +%definecolor[black] [s=0] +\definecolor [darkslategray] [r=.184314,g=.309804,b=.309804] +\definecolor [dimgray] [s=.411765] +\definecolor [slategray] [r=.439216,g=.501961,b=.564706] +\definecolor [lightslategray] [r=.466667,g=.533333,b=.6] +\definecolor [gray] [s=.745098] +\definecolor [lightgray] [s=.827451] +\definecolor [midnightblue] [r=.098039,g=.098039,b=.439216] +\definecolor [navy] [b=.501961] +\definecolor [navyblue] [navy] +\definecolor [cornflowerblue] [r=.392157,g=.584314,b=.929412] +\definecolor [darkslateblue] [r=.282353,g=.239216,b=.545098] +\definecolor [slateblue] [r=.415686,g=.352941,b=.803922] +\definecolor [mediumslateblue] [r=.482353,g=.407843,b=.933333] +\definecolor [lightslateblue] [r=.517647,g=.439216,b=1] +\definecolor [mediumblue] [b=.803922] +\definecolor [royalblue] [r=.254902,g=.411765,b=.882353] +%definecolor[blue] [b=1] +\definecolor [dodgerblue] [r=.117647,g=.564706,b=1] +\definecolor [deepskyblue] [g=.74902,b=1] +\definecolor [skyblue] [r=.529412,g=.807843,b=.921569] +\definecolor [lightskyblue] [r=.529412,g=.807843,b=.980392] +\definecolor [steelblue] [r=.27451,g=.509804,b=.705882] +\definecolor [lightsteelblue] [r=.690196,g=.768627,b=.870588] +\definecolor [lightblue] [r=.678431,g=.847059,b=.901961] +\definecolor [powderblue] [r=.690196,g=.878431,b=.901961] +\definecolor [paleturquoise] [r=.686275,g=.933333,b=.933333] +\definecolor [darkturquoise] [g=.807843,b=.819608] +\definecolor [mediumturquoise] [r=.282353,g=.819608,b=.8] +\definecolor [turquoise] [r=.25098,g=.878431,b=.815686] +%definecolor[cyan] [g=1,b=1] +\definecolor [lightcyan] [r=.878431,g=1,b=1] +\definecolor [cadetblue] [r=.372549,g=.619608,b=.627451] +\definecolor [mediumaquamarine] [r=.4,g=.803922,b=.666667] +\definecolor [aquamarine] [r=.498039,g=1,b=.831373] +\definecolor [darkgreen] [g=.392157] +\definecolor [darkolivegreen] [r=.333333,g=.419608,b=.184314] +\definecolor [darkseagreen] [r=.560784,g=.737255,b=.560784] +\definecolor [seagreen] [r=.180392,g=.545098,b=.341176] +\definecolor [mediumseagreen] [r=.235294,g=.701961,b=.443137] +\definecolor [lightseagreen] [r=.12549,g=.698039,b=.666667] +\definecolor [palegreen] [r=.596078,g=.984314,b=.596078] +\definecolor [springgreen] [g=1,b=.498039] +\definecolor [lawngreen] [r=.486275,g=.988235] +%definecolor[green] [g=1] +\definecolor [chartreuse] [r=.498039,g=1] +\definecolor [mediumspringgreen] [g=.980392,b=.603922] +\definecolor [greenyellow] [r=.678431,g=1,b=.184314] +\definecolor [limegreen] [r=.196078,g=.803922,b=.196078] +\definecolor [yellowgreen] [r=.603922,g=.803922,b=.196078] +\definecolor [forestgreen] [r=.133333,g=.545098,b=.133333] +\definecolor [olivedrab] [r=.419608,g=.556863,b=.137255] +\definecolor [darkkhaki] [r=.741176,g=.717647,b=.419608] +\definecolor [khaki] [r=.941176,g=.901961,b=.54902] +\definecolor [palegoldenrod] [r=.933333,g=.909804,b=.666667] +\definecolor [lightgoldenrodyellow] [r=.980392,g=.980392,b=.823529] +\definecolor [lightyellow] [r=1,g=1,b=.878431] +%definecolor[yellow] [r=1,g=1] +\definecolor [gold] [r=1,g=.843137] +\definecolor [lightgoldenrod] [r=.933333,g=.866667,b=.509804] +\definecolor [goldenrod] [r=.854902,g=.647059,b=.12549] +\definecolor [darkgoldenrod] [r=.721569,g=.52549,b=.043137] +\definecolor [rosybrown] [r=.737255,g=.560784,b=.560784] +\definecolor [indianred] [r=.803922,g=.360784,b=.360784] +\definecolor [saddlebrown] [r=.545098,g=.270588,b=.07451] +\definecolor [sienna] [r=.627451,g=.321569,b=.176471] +\definecolor [peru] [r=.803922,g=.521569,b=.247059] +\definecolor [burlywood] [r=.870588,g=.721569,b=.529412] +\definecolor [beige] [r=.960784,g=.960784,b=.862745] +\definecolor [wheat] [r=.960784,g=.870588,b=.701961] +\definecolor [sandybrown] [r=.956863,g=.643137,b=.376471] +\definecolor [tan] [r=.823529,g=.705882,b=.54902] +\definecolor [chocolate] [r=.823529,g=.411765,b=.117647] +\definecolor [firebrick] [r=.698039,g=.133333,b=.133333] +\definecolor [brown] [r=.647059,g=.164706,b=.164706] +\definecolor [darksalmon] [r=.913725,g=.588235,b=.478431] +\definecolor [salmon] [r=.980392,g=.501961,b=.447059] +\definecolor [lightsalmon] [r=1,g=.627451,b=.478431] +\definecolor [orange] [r=1,g=.647059] +\definecolor [darkorange] [r=1,g=.54902] +\definecolor [coral] [r=1,g=.498039,b=.313725] +\definecolor [lightcoral] [r=.941176,g=.501961,b=.501961] +\definecolor [tomato] [r=1,g=.388235,b=.278431] +\definecolor [orangered] [r=1,g=.270588] +%definecolor[red] [r=1] +\definecolor [hotpink] [r=1,g=.411765,b=.705882] +\definecolor [deeppink] [r=1,g=.078431,b=.576471] +\definecolor [pink] [r=1,g=.752941,b=.796078] +\definecolor [lightpink] [r=1,g=.713725,b=.756863] +\definecolor [palevioletred] [r=.858824,g=.439216,b=.576471] +\definecolor [maroon] [r=.690196,g=.188235,b=.376471] +\definecolor [mediumvioletred] [r=.780392,g=.082353,b=.521569] +\definecolor [violetred] [r=.815686,g=.12549,b=.564706] +%definecolor[magenta] [r=1,b=1] +\definecolor [violet] [r=.933333,g=.509804,b=.933333] +\definecolor [plum] [r=.866667,g=.627451,b=.866667] +\definecolor [orchid] [r=.854902,g=.439216,b=.839216] +\definecolor [mediumorchid] [r=.729412,g=.333333,b=.827451] +\definecolor [darkorchid] [r=.6,g=.196078,b=.8] +\definecolor [darkviolet] [r=.580392,b=.827451] +\definecolor [blueviolet] [r=.541176,g=.168627,b=.886275] +\definecolor [purple] [r=.627451,g=.12549,b=.941176] +\definecolor [mediumpurple] [r=.576471,g=.439216,b=.858824] +\definecolor [thistle] [r=.847059,g=.74902,b=.847059] +\definecolor [snow1] [r=1,g=.980392,b=.980392] +\definecolor [snow2] [r=.933333,g=.913725,b=.913725] +\definecolor [snow3] [r=.803922,g=.788235,b=.788235] +\definecolor [snow4] [r=.545098,g=.537255,b=.537255] +\definecolor [seashell1] [r=1,g=.960784,b=.933333] +\definecolor [seashell2] [r=.933333,g=.898039,b=.870588] +\definecolor [seashell3] [r=.803922,g=.772549,b=.74902] +\definecolor [seashell4] [r=.545098,g=.52549,b=.509804] +\definecolor [antiquewhite1] [r=1,g=.937255,b=.858824] +\definecolor [antiquewhite2] [r=.933333,g=.87451,b=.8] +\definecolor [antiquewhite3] [r=.803922,g=.752941,b=.690196] +\definecolor [antiquewhite4] [r=.545098,g=.513725,b=.470588] +\definecolor [bisque1] [r=1,g=.894118,b=.768627] +\definecolor [bisque2] [r=.933333,g=.835294,b=.717647] +\definecolor [bisque3] [r=.803922,g=.717647,b=.619608] +\definecolor [bisque4] [r=.545098,g=.490196,b=.419608] +\definecolor [peachpuff1] [r=1,g=.854902,b=.72549] +\definecolor [peachpuff2] [r=.933333,g=.796078,b=.678431] +\definecolor [peachpuff3] [r=.803922,g=.686275,b=.584314] +\definecolor [peachpuff4] [r=.545098,g=.466667,b=.396078] +\definecolor [navajowhite1] [r=1,g=.870588,b=.678431] +\definecolor [navajowhite2] [r=.933333,g=.811765,b=.631373] +\definecolor [navajowhite3] [r=.803922,g=.701961,b=.545098] +\definecolor [navajowhite4] [r=.545098,g=.47451,b=.368627] +\definecolor [lemonchiffon1] [r=1,g=.980392,b=.803922] +\definecolor [lemonchiffon2] [r=.933333,g=.913725,b=.74902] +\definecolor [lemonchiffon3] [r=.803922,g=.788235,b=.647059] +\definecolor [lemonchiffon4] [r=.545098,g=.537255,b=.439216] +\definecolor [cornsilk1] [r=1,g=.972549,b=.862745] +\definecolor [cornsilk2] [r=.933333,g=.909804,b=.803922] +\definecolor [cornsilk3] [r=.803922,g=.784314,b=.694118] +\definecolor [cornsilk4] [r=.545098,g=.533333,b=.470588] +\definecolor [ivory1] [r=1,g=1,b=.941176] +\definecolor [ivory2] [r=.933333,g=.933333,b=.878431] +\definecolor [ivory3] [r=.803922,g=.803922,b=.756863] +\definecolor [ivory4] [r=.545098,g=.545098,b=.513725] +\definecolor [honeydew1] [r=.941176,g=1,b=.941176] +\definecolor [honeydew2] [r=.878431,g=.933333,b=.878431] +\definecolor [honeydew3] [r=.756863,g=.803922,b=.756863] +\definecolor [honeydew4] [r=.513725,g=.545098,b=.513725] +\definecolor [lavenderblush1] [r=1,g=.941176,b=.960784] +\definecolor [lavenderblush2] [r=.933333,g=.878431,b=.898039] +\definecolor [lavenderblush3] [r=.803922,g=.756863,b=.772549] +\definecolor [lavenderblush4] [r=.545098,g=.513725,b=.52549] +\definecolor [mistyrose1] [r=1,g=.894118,b=.882353] +\definecolor [mistyrose2] [r=.933333,g=.835294,b=.823529] +\definecolor [mistyrose3] [r=.803922,g=.717647,b=.709804] +\definecolor [mistyrose4] [r=.545098,g=.490196,b=.482353] +\definecolor [azure1] [r=.941176,g=1,b=1] +\definecolor [azure2] [r=.878431,g=.933333,b=.933333] +\definecolor [azure3] [r=.756863,g=.803922,b=.803922] +\definecolor [azure4] [r=.513725,g=.545098,b=.545098] +\definecolor [slateblue1] [r=.513725,g=.435294,b=1] +\definecolor [slateblue2] [r=.478431,g=.403922,b=.933333] +\definecolor [slateblue3] [r=.411765,g=.34902,b=.803922] +\definecolor [slateblue4] [r=.278431,g=.235294,b=.545098] +\definecolor [royalblue1] [r=.282353,g=.462745,b=1] +\definecolor [royalblue2] [r=.262745,g=.431373,b=.933333] +\definecolor [royalblue3] [r=.227451,g=.372549,b=.803922] +\definecolor [royalblue4] [r=.152941,g=.25098,b=.545098] +\definecolor [blue1] [blue] +\definecolor [blue2] [b=.933333] +\definecolor [blue3] [b=.803922] +\definecolor [blue4] [b=.545098] +\definecolor [dodgerblue1] [r=.117647,g=.564706,b=1] +\definecolor [dodgerblue2] [r=.109804,g=.52549,b=.933333] +\definecolor [dodgerblue3] [r=.094118,g=.454902,b=.803922] +\definecolor [dodgerblue4] [r=.062745,g=.305882,b=.545098] +\definecolor [steelblue1] [r=.388235,g=.721569,b=1] +\definecolor [steelblue2] [r=.360784,g=.67451,b=.933333] +\definecolor [steelblue3] [r=.309804,g=.580392,b=.803922] +\definecolor [steelblue4] [r=.211765,g=.392157,b=.545098] +\definecolor [deepskyblue1] [g=.74902,b=1] +\definecolor [deepskyblue2] [g=.698039,b=.933333] +\definecolor [deepskyblue3] [g=.603922,b=.803922] +\definecolor [deepskyblue4] [g=.407843,b=.545098] +\definecolor [skyblue1] [r=.529412,g=.807843,b=1] +\definecolor [skyblue2] [r=.494118,g=.752941,b=.933333] +\definecolor [skyblue3] [r=.423529,g=.65098,b=.803922] +\definecolor [skyblue4] [r=.290196,g=.439216,b=.545098] +\definecolor [lightskyblue1] [r=.690196,g=.886275,b=1] +\definecolor [lightskyblue2] [r=.643137,g=.827451,b=.933333] +\definecolor [lightskyblue3] [r=.552941,g=.713725,b=.803922] +\definecolor [lightskyblue4] [r=.376471,g=.482353,b=.545098] +\definecolor [slategray1] [r=.776471,g=.886275,b=1] +\definecolor [slategray2] [r=.72549,g=.827451,b=.933333] +\definecolor [slategray3] [r=.623529,g=.713725,b=.803922] +\definecolor [slategray4] [r=.423529,g=.482353,b=.545098] +\definecolor [lightsteelblue1] [r=.792157,g=.882353,b=1] +\definecolor [lightsteelblue2] [r=.737255,g=.823529,b=.933333] +\definecolor [lightsteelblue3] [r=.635294,g=.709804,b=.803922] +\definecolor [lightsteelblue4] [r=.431373,g=.482353,b=.545098] +\definecolor [lightblue1] [r=.74902,g=.937255,b=1] +\definecolor [lightblue2] [r=.698039,g=.87451,b=.933333] +\definecolor [lightblue3] [r=.603922,g=.752941,b=.803922] +\definecolor [lightblue4] [r=.407843,g=.513725,b=.545098] +\definecolor [lightcyan1] [r=.878431,g=1,b=1] +\definecolor [lightcyan2] [r=.819608,g=.933333,b=.933333] +\definecolor [lightcyan3] [r=.705882,g=.803922,b=.803922] +\definecolor [lightcyan4] [r=.478431,g=.545098,b=.545098] +\definecolor [paleturquoise1] [r=.733333,g=1,b=1] +\definecolor [paleturquoise2] [r=.682353,g=.933333,b=.933333] +\definecolor [paleturquoise3] [r=.588235,g=.803922,b=.803922] +\definecolor [paleturquoise4] [r=.4,g=.545098,b=.545098] +\definecolor [cadetblue1] [r=.596078,g=.960784,b=1] +\definecolor [cadetblue2] [r=.556863,g=.898039,b=.933333] +\definecolor [cadetblue3] [r=.478431,g=.772549,b=.803922] +\definecolor [cadetblue4] [r=.32549,g=.52549,b=.545098] +\definecolor [turquoise1] [g=.960784,b=1] +\definecolor [turquoise2] [g=.898039,b=.933333] +\definecolor [turquoise3] [g=.772549,b=.803922] +\definecolor [turquoise4] [g=.52549,b=.545098] +\definecolor [cyan1] [cyan] +\definecolor [cyan2] [g=.933333,b=.933333] +\definecolor [cyan3] [g=.803922,b=.803922] +\definecolor [cyan4] [g=.545098,b=.545098] +\definecolor [darkslategray1] [r=.592157,g=1,b=1] +\definecolor [darkslategray2] [r=.552941,g=.933333,b=.933333] +\definecolor [darkslategray3] [r=.47451,g=.803922,b=.803922] +\definecolor [darkslategray4] [r=.321569,g=.545098,b=.545098] +\definecolor [aquamarine1] [r=.498039,g=1,b=.831373] +\definecolor [aquamarine2] [r=.462745,g=.933333,b=.776471] +\definecolor [aquamarine3] [r=.4,g=.803922,b=.666667] +\definecolor [aquamarine4] [r=.270588,g=.545098,b=.454902] +\definecolor [darkseagreen1] [r=.756863,g=1,b=.756863] +\definecolor [darkseagreen2] [r=.705882,g=.933333,b=.705882] +\definecolor [darkseagreen3] [r=.607843,g=.803922,b=.607843] +\definecolor [darkseagreen4] [r=.411765,g=.545098,b=.411765] +\definecolor [seagreen1] [r=.329412,g=1,b=.623529] +\definecolor [seagreen2] [r=.305882,g=.933333,b=.580392] +\definecolor [seagreen3] [r=.262745,g=.803922,b=.501961] +\definecolor [seagreen4] [r=.180392,g=.545098,b=.341176] +\definecolor [palegreen1] [r=.603922,g=1,b=.603922] +\definecolor [palegreen2] [r=.564706,g=.933333,b=.564706] +\definecolor [palegreen3] [r=.486275,g=.803922,b=.486275] +\definecolor [palegreen4] [r=.329412,g=.545098,b=.329412] +\definecolor [springgreen1] [g=1,b=.498039] +\definecolor [springgreen2] [g=.933333,b=.462745] +\definecolor [springgreen3] [g=.803922,b=.4] +\definecolor [springgreen4] [g=.545098,b=.270588] +\definecolor [green1] [green] +\definecolor [green2] [g=.933333] +\definecolor [green3] [g=.803922] +\definecolor [green4] [g=.545098] +\definecolor [chartreuse1] [r=.498039,g=1] +\definecolor [chartreuse2] [r=.462745,g=.933333] +\definecolor [chartreuse3] [r=.4,g=.803922] +\definecolor [chartreuse4] [r=.270588,g=.545098] +\definecolor [olivedrab1] [r=.752941,g=1,b=.243137] +\definecolor [olivedrab2] [r=.701961,g=.933333,b=.227451] +\definecolor [olivedrab3] [r=.603922,g=.803922,b=.196078] +\definecolor [olivedrab4] [r=.411765,g=.545098,b=.133333] +\definecolor [darkolivegreen1] [r=.792157,g=1,b=.439216] +\definecolor [darkolivegreen2] [r=.737255,g=.933333,b=.407843] +\definecolor [darkolivegreen3] [r=.635294,g=.803922,b=.352941] +\definecolor [darkolivegreen4] [r=.431373,g=.545098,b=.239216] +\definecolor [khaki1] [r=1,g=.964706,b=.560784] +\definecolor [khaki2] [r=.933333,g=.901961,b=.521569] +\definecolor [khaki3] [r=.803922,g=.776471,b=.45098] +\definecolor [khaki4] [r=.545098,g=.52549,b=.305882] +\definecolor [lightgoldenrod1] [r=1,g=.92549,b=.545098] +\definecolor [lightgoldenrod2] [r=.933333,g=.862745,b=.509804] +\definecolor [lightgoldenrod3] [r=.803922,g=.745098,b=.439216] +\definecolor [lightgoldenrod4] [r=.545098,g=.505882,b=.298039] +\definecolor [lightyellow1] [r=1,g=1,b=.878431] +\definecolor [lightyellow2] [r=.933333,g=.933333,b=.819608] +\definecolor [lightyellow3] [r=.803922,g=.803922,b=.705882] +\definecolor [lightyellow4] [r=.545098,g=.545098,b=.478431] +\definecolor [yellow1] [yellow] +\definecolor [yellow2] [r=.933333,g=.933333] +\definecolor [yellow3] [r=.803922,g=.803922] +\definecolor [yellow4] [r=.545098,g=.545098] +\definecolor [gold1] [r=1,g=.843137] +\definecolor [gold2] [r=.933333,g=.788235] +\definecolor [gold3] [r=.803922,g=.678431] +\definecolor [gold4] [r=.545098,g=.458824] +\definecolor [goldenrod1] [r=1,g=.756863,b=.145098] +\definecolor [goldenrod2] [r=.933333,g=.705882,b=.133333] +\definecolor [goldenrod3] [r=.803922,g=.607843,b=.113725] +\definecolor [goldenrod4] [r=.545098,g=.411765,b=.078431] +\definecolor [darkgoldenrod1] [r=1,g=.72549,b=.058824] +\definecolor [darkgoldenrod2] [r=.933333,g=.678431,b=.054902] +\definecolor [darkgoldenrod3] [r=.803922,g=.584314,b=.047059] +\definecolor [darkgoldenrod4] [r=.545098,g=.396078,b=.031373] +\definecolor [rosybrown1] [r=1,g=.756863,b=.756863] +\definecolor [rosybrown2] [r=.933333,g=.705882,b=.705882] +\definecolor [rosybrown3] [r=.803922,g=.607843,b=.607843] +\definecolor [rosybrown4] [r=.545098,g=.411765,b=.411765] +\definecolor [indianred1] [r=1,g=.415686,b=.415686] +\definecolor [indianred2] [r=.933333,g=.388235,b=.388235] +\definecolor [indianred3] [r=.803922,g=.333333,b=.333333] +\definecolor [indianred4] [r=.545098,g=.227451,b=.227451] +\definecolor [sienna1] [r=1,g=.509804,b=.278431] +\definecolor [sienna2] [r=.933333,g=.47451,b=.258824] +\definecolor [sienna3] [r=.803922,g=.407843,b=.223529] +\definecolor [sienna4] [r=.545098,g=.278431,b=.14902] +\definecolor [burlywood1] [r=1,g=.827451,b=.607843] +\definecolor [burlywood2] [r=.933333,g=.772549,b=.568627] +\definecolor [burlywood3] [r=.803922,g=.666667,b=.490196] +\definecolor [burlywood4] [r=.545098,g=.45098,b=.333333] +\definecolor [wheat1] [r=1,g=.905882,b=.729412] +\definecolor [wheat2] [r=.933333,g=.847059,b=.682353] +\definecolor [wheat3] [r=.803922,g=.729412,b=.588235] +\definecolor [wheat4] [r=.545098,g=.494118,b=.4] +\definecolor [tan1] [r=1,g=.647059,b=.309804] +\definecolor [tan2] [r=.933333,g=.603922,b=.286275] +\definecolor [tan3] [r=.803922,g=.521569,b=.247059] +\definecolor [tan4] [r=.545098,g=.352941,b=.168627] +\definecolor [chocolate1] [r=1,g=.498039,b=.141176] +\definecolor [chocolate2] [r=.933333,g=.462745,b=.129412] +\definecolor [chocolate3] [r=.803922,g=.4,b=.113725] +\definecolor [chocolate4] [r=.545098,g=.270588,b=.07451] +\definecolor [firebrick1] [r=1,g=.188235,b=.188235] +\definecolor [firebrick2] [r=.933333,g=.172549,b=.172549] +\definecolor [firebrick3] [r=.803922,g=.14902,b=.14902] +\definecolor [firebrick4] [r=.545098,g=.101961,b=.101961] +\definecolor [brown1] [r=1,g=.25098,b=.25098] +\definecolor [brown2] [r=.933333,g=.231373,b=.231373] +\definecolor [brown3] [r=.803922,g=.2,b=.2] +\definecolor [brown4] [r=.545098,g=.137255,b=.137255] +\definecolor [salmon1] [r=1,g=.54902,b=.411765] +\definecolor [salmon2] [r=.933333,g=.509804,b=.384314] +\definecolor [salmon3] [r=.803922,g=.439216,b=.329412] +\definecolor [salmon4] [r=.545098,g=.298039,b=.223529] +\definecolor [lightsalmon1] [r=1,g=.627451,b=.478431] +\definecolor [lightsalmon2] [r=.933333,g=.584314,b=.447059] +\definecolor [lightsalmon3] [r=.803922,g=.505882,b=.384314] +\definecolor [lightsalmon4] [r=.545098,g=.341176,b=.258824] +\definecolor [orange1] [r=1,g=.647059] +\definecolor [orange2] [r=.933333,g=.603922] +\definecolor [orange3] [r=.803922,g=.521569] +\definecolor [orange4] [r=.545098,g=.352941] +\definecolor [darkorange1] [r=1,g=.498039] +\definecolor [darkorange2] [r=.933333,g=.462745] +\definecolor [darkorange3] [r=.803922,g=.4] +\definecolor [darkorange4] [r=.545098,g=.270588] +\definecolor [coral1] [r=1,g=.447059,b=.337255] +\definecolor [coral2] [r=.933333,g=.415686,b=.313725] +\definecolor [coral3] [r=.803922,g=.356863,b=.270588] +\definecolor [coral4] [r=.545098,g=.243137,b=.184314] +\definecolor [tomato1] [r=1,g=.388235,b=.278431] +\definecolor [tomato2] [r=.933333,g=.360784,b=.258824] +\definecolor [tomato3] [r=.803922,g=.309804,b=.223529] +\definecolor [tomato4] [r=.545098,g=.211765,b=.14902] +\definecolor [orangered1] [r=1,g=.270588] +\definecolor [orangered2] [r=.933333,g=.25098] +\definecolor [orangered3] [r=.803922,g=.215686] +\definecolor [orangered4] [r=.545098,g=.145098] +\definecolor [red1] [red] +\definecolor [red2] [r=.933333] +\definecolor [red3] [r=.803922] +\definecolor [red4] [r=.545098] +\definecolor [deeppink1] [r=1,g=.078431,b=.576471] +\definecolor [deeppink2] [r=.933333,g=.070588,b=.537255] +\definecolor [deeppink3] [r=.803922,g=.062745,b=.462745] +\definecolor [deeppink4] [r=.545098,g=.039216,b=.313725] +\definecolor [hotpink1] [r=1,g=.431373,b=.705882] +\definecolor [hotpink2] [r=.933333,g=.415686,b=.654902] +\definecolor [hotpink3] [r=.803922,g=.376471,b=.564706] +\definecolor [hotpink4] [r=.545098,g=.227451,b=.384314] +\definecolor [pink1] [r=1,g=.709804,b=.772549] +\definecolor [pink2] [r=.933333,g=.662745,b=.721569] +\definecolor [pink3] [r=.803922,g=.568627,b=.619608] +\definecolor [pink4] [r=.545098,g=.388235,b=.423529] +\definecolor [lightpink1] [r=1,g=.682353,b=.72549] +\definecolor [lightpink2] [r=.933333,g=.635294,b=.678431] +\definecolor [lightpink3] [r=.803922,g=.54902,b=.584314] +\definecolor [lightpink4] [r=.545098,g=.372549,b=.396078] +\definecolor [palevioletred1] [r=1,g=.509804,b=.670588] +\definecolor [palevioletred2] [r=.933333,g=.47451,b=.623529] +\definecolor [palevioletred3] [r=.803922,g=.407843,b=.537255] +\definecolor [palevioletred4] [r=.545098,g=.278431,b=.364706] +\definecolor [maroon1] [r=1,g=.203922,b=.701961] +\definecolor [maroon2] [r=.933333,g=.188235,b=.654902] +\definecolor [maroon3] [r=.803922,g=.160784,b=.564706] +\definecolor [maroon4] [r=.545098,g=.109804,b=.384314] +\definecolor [violetred1] [r=1,g=.243137,b=.588235] +\definecolor [violetred2] [r=.933333,g=.227451,b=.54902] +\definecolor [violetred3] [r=.803922,g=.196078,b=.470588] +\definecolor [violetred4] [r=.545098,g=.133333,b=.321569] +\definecolor [magenta1] [magenta] +\definecolor [magenta2] [r=.933333,b=.933333] +\definecolor [magenta3] [r=.803922,b=.803922] +\definecolor [magenta4] [r=.545098,b=.545098] +\definecolor [orchid1] [r=1,g=.513725,b=.980392] +\definecolor [orchid2] [r=.933333,g=.478431,b=.913725] +\definecolor [orchid3] [r=.803922,g=.411765,b=.788235] +\definecolor [orchid4] [r=.545098,g=.278431,b=.537255] +\definecolor [plum1] [r=1,g=.733333,b=1] +\definecolor [plum2] [r=.933333,g=.682353,b=.933333] +\definecolor [plum3] [r=.803922,g=.588235,b=.803922] +\definecolor [plum4] [r=.545098,g=.4,b=.545098] +\definecolor [mediumorchid1] [r=.878431,g=.4,b=1] +\definecolor [mediumorchid2] [r=.819608,g=.372549,b=.933333] +\definecolor [mediumorchid3] [r=.705882,g=.321569,b=.803922] +\definecolor [mediumorchid4] [r=.478431,g=.215686,b=.545098] +\definecolor [darkorchid1] [r=.74902,g=.243137,b=1] +\definecolor [darkorchid2] [r=.698039,g=.227451,b=.933333] +\definecolor [darkorchid3] [r=.603922,g=.196078,b=.803922] +\definecolor [darkorchid4] [r=.407843,g=.133333,b=.545098] +\definecolor [purple1] [r=.607843,g=.188235,b=1] +\definecolor [purple2] [r=.568627,g=.172549,b=.933333] +\definecolor [purple3] [r=.490196,g=.14902,b=.803922] +\definecolor [purple4] [r=.333333,g=.101961,b=.545098] +\definecolor [mediumpurple1] [r=.670588,g=.509804,b=1] +\definecolor [mediumpurple2] [r=.623529,g=.47451,b=.933333] +\definecolor [mediumpurple3] [r=.537255,g=.407843,b=.803922] +\definecolor [mediumpurple4] [r=.364706,g=.278431,b=.545098] +\definecolor [thistle1] [r=1,g=.882353,b=1] +\definecolor [thistle2] [r=.933333,g=.823529,b=.933333] +\definecolor [thistle3] [r=.803922,g=.709804,b=.803922] +\definecolor [thistle4] [r=.545098,g=.482353,b=.545098] +\definecolor [gray0] [black] +\definecolor [gray1] [s=.01] +\definecolor [gray2] [s=.02] +\definecolor [gray3] [s=.03] +\definecolor [gray4] [s=.04] +\definecolor [gray5] [s=.05] +\definecolor [gray6] [s=.06] +\definecolor [gray7] [s=.07] +\definecolor [gray8] [s=.08] +\definecolor [gray9] [s=.09] +\definecolor [gray10] [s=.1] +\definecolor [gray11] [s=.11] +\definecolor [gray12] [s=.12] +\definecolor [gray13] [s=.13] +\definecolor [gray14] [s=.14] +\definecolor [gray15] [s=.15] +\definecolor [gray16] [s=.16] +\definecolor [gray17] [s=.17] +\definecolor [gray18] [s=.18] +\definecolor [gray19] [s=.19] +\definecolor [gray20] [s=.2] +\definecolor [gray21] [s=.21] +\definecolor [gray22] [s=.22] +\definecolor [gray23] [s=.23] +\definecolor [gray24] [s=.24] +\definecolor [gray25] [s=.25] +\definecolor [gray26] [s=.26] +\definecolor [gray27] [s=.27] +\definecolor [gray28] [s=.28] +\definecolor [gray29] [s=.29] +\definecolor [gray30] [s=.3] +\definecolor [gray31] [s=.31] +\definecolor [gray32] [s=.32] +\definecolor [gray33] [s=.33] +\definecolor [gray34] [s=.34] +\definecolor [gray35] [s=.35] +\definecolor [gray36] [s=.36] +\definecolor [gray37] [s=.37] +\definecolor [gray38] [s=.38] +\definecolor [gray39] [s=.39] +\definecolor [gray40] [s=.4] +\definecolor [gray41] [s=.41] +\definecolor [gray42] [s=.42] +\definecolor [gray43] [s=.43] +\definecolor [gray44] [s=.44] +\definecolor [gray45] [s=.45] +\definecolor [gray46] [s=.46] +\definecolor [gray47] [s=.47] +\definecolor [gray48] [s=.48] +\definecolor [gray49] [s=.49] +\definecolor [gray50] [s=.5] +\definecolor [gray51] [s=.51] +\definecolor [gray52] [s=.52] +\definecolor [gray53] [s=.53] +\definecolor [gray54] [s=.54] +\definecolor [gray55] [s=.55] +\definecolor [gray56] [s=.56] +\definecolor [gray57] [s=.57] +\definecolor [gray58] [s=.58] +\definecolor [gray59] [s=.59] +\definecolor [gray60] [s=.6] +\definecolor [gray61] [s=.61] +\definecolor [gray62] [s=.62] +\definecolor [gray63] [s=.63] +\definecolor [gray64] [s=.64] +\definecolor [gray65] [s=.65] +\definecolor [gray66] [s=.66] +\definecolor [gray67] [s=.67] +\definecolor [gray68] [s=.68] +\definecolor [gray69] [s=.69] +\definecolor [gray70] [s=.7] +\definecolor [gray71] [s=.71] +\definecolor [gray72] [s=.72] +\definecolor [gray73] [s=.73] +\definecolor [gray74] [s=.74] +\definecolor [gray75] [s=.75] +\definecolor [gray76] [s=.76] +\definecolor [gray77] [s=.77] +\definecolor [gray78] [s=.78] +\definecolor [gray79] [s=.79] +\definecolor [gray80] [s=.8] +\definecolor [gray81] [s=.81] +\definecolor [gray82] [s=.82] +\definecolor [gray83] [s=.83] +\definecolor [gray84] [s=.84] +\definecolor [gray85] [s=.85] +\definecolor [gray86] [s=.86] +\definecolor [gray87] [s=.87] +\definecolor [gray88] [s=.88] +\definecolor [gray89] [s=.89] +\definecolor [gray90] [s=.9] +\definecolor [gray91] [s=.91] +\definecolor [gray92] [s=.92] +\definecolor [gray93] [s=.93] +\definecolor [gray94] [s=.94] +\definecolor [gray95] [s=.95] +\definecolor [gray96] [s=.96] +\definecolor [gray97] [s=.97] +\definecolor [gray98] [s=.98] +\definecolor [gray99] [s=.99] +\definecolor [gray100] [white] +\definecolor [darkgray] [s=.662745] +\definecolor [darkblue] [b=.545098] +\definecolor [darkcyan] [g=.545098,b=.545098] +\definecolor [darkmagenta] [r=.545098,b=.545098] +\definecolor [darkred] [r=.545098] +\definecolor [lightgreen] [r=.564706,g=.933333,b=.564706] diff --git a/Master/texmf-dist/tex/context/base/colo-imp-rgb.mkiv b/Master/texmf-dist/tex/context/base/colo-imp-rgb.mkiv new file mode 100644 index 00000000000..038e0ab0bf1 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/colo-imp-rgb.mkiv @@ -0,0 +1,530 @@ +%D \module +%D [ file=colo-rgb, +%D version=1995.01.01, +%D title=\CONTEXT\ Color Macros, +%D subtitle=RGB, +%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 Just to give users a start we define some colors. While +%D switching fonts is as international as can be, thanks to the +%D mnemonics, naming colors is very interface dependant. To +%D support international setups, we define both english and +%D interface dependant colors. We use the color inheritance +%D mechanisms to implement the interface dependant ones. + +%D First we define some simple primary \cap{RGB} and \cap{CMYK} +%D colors. All colors are defined in \cap{RGB} color space. + +\definecolor [red] [r=1, g=0, b=0] +\definecolor [green] [r=0, g=1, b=0] +\definecolor [blue] [r=0, g=0, b=1] + +\definecolor [cyan] [r=0, g=1, b=1] +\definecolor [magenta] [r=1, g=0, b=1] +\definecolor [yellow] [r=1, g=1, b=0] + +\definecolor [white] [s=1] % [r=1, g=1, b=1] +\definecolor [black] [s=0] +\definecolor [gray] [s=.9] + +\definecolor [darkred] [r=.8, g=0, b=0] +\definecolor [middlered] [r=.9, g=0, b=0] +\definecolor [lightred] [r=1, g=0, b=0] + +\definecolor [darkgreen] [r=0, g=.6, b=0] +\definecolor [middlegreen] [r=0, g=.8, b=0] +\definecolor [lightgreen] [r=0, g=1, b=0] + +\definecolor [darkblue] [r=0, g=0, b=.8] +\definecolor [middleblue] [r=0, g=0, b=.9] +\definecolor [lightblue] [r=0, g=0, b=1] + +\definecolor [darkcyan] [r=.6, g=.8, b=.8] +\definecolor [middlecyan] [r=0, g=.8, b=.8] + +\definecolor [darkmagenta] [r=.8, g=.6, b=.8] +\definecolor [middlemagenta] [r=1, g=0, b=.6] + +\definecolor [darkyellow] [r=.8, g=.8, b=.6] +\definecolor [middleyellow] [r=1, g=1, b=.2] + +\definecolor [darkgray] [s=.5] +\definecolor [middlegray] [s=.7] +\definecolor [lightgray] [s=.9] + +%D These colors are mapped to interface dependant colornames. + +\startinterface dutch + + \definecolor [rood] [red] + \definecolor [groen] [green] + \definecolor [blauw] [blue] + + \definecolor [cyaan] [cyan] + \definecolor [magenta] [magenta] + \definecolor [geel] [yellow] + + \definecolor [wit] [white] + \definecolor [grijs] [gray] + \definecolor [zwart] [black] + + \definecolor [donkerrood] [darkred] + \definecolor [middelrood] [middlered] + \definecolor [lichtrood] [lightred] + + \definecolor [donkergroen] [darkgreen] + \definecolor [middelgroen] [middlegreen] + \definecolor [lichtgroen] [lightgreen] + + \definecolor [donkerblauw] [darkblue] + \definecolor [middelblauw] [middleblue] + \definecolor [lichtblauw] [lightblue] + + \definecolor [donkercyaan] [darkcyan] + \definecolor [middelcyaan] [middlecyan] + + \definecolor [donkermagenta] [darkmagenta] + \definecolor [middelmagenta] [middlemagenta] + + \definecolor [donkergeel] [darkyellow] + \definecolor [middelgeel] [middleyellow] + + \definecolor [donkergrijs] [darkgray] + \definecolor [middengrijs] [middlegray] + \definecolor [lichtgrijs] [lightgray] + +\stopinterface + +\startinterface german + + \definecolor [rot] [red] + \definecolor [gruen] [green] + \definecolor [blau] [blue] + + \definecolor [cyan] [cyan] + \definecolor [magenta] [magenta] + \definecolor [gelb] [yellow] + + \definecolor [weiss] [white] + \definecolor [grau] [gray] + \definecolor [schwarz] [black] + + \definecolor [dunkelrot] [darkred] + \definecolor [mittelrot] [middlered] + \definecolor [hellrot] [lightred] + + \definecolor [dunkelgruen] [darkgreen] + \definecolor [mittelgruen] [middlegreen] + \definecolor [hellgruen] [lightgreen] + + \definecolor [dunkelblau] [darkblue] + \definecolor [mittelblau] [middleblue] + \definecolor [hellblau] [lightblue] + + \definecolor [dunkelcyan] [darkcyan] + \definecolor [mittelcyan] [middlecyan] + + \definecolor [dunkelmagenta] [darkmagenta] + \definecolor [mittelmagenta] [middlemagenta] + + \definecolor [dunkelgelb] [darkyellow] + \definecolor [mittelgelb] [middleyellow] + + \definecolor [dunkelgrau] [darkgray] + \definecolor [mittelgrau] [middlegray] + \definecolor [hellgrau] [lightgray] + +\stopinterface + +\startinterface czech + + \definecolor [cervena] [red] + \definecolor [zelena] [green] + \definecolor [modra] [blue] + + \definecolor [azurova] [cyan] + \definecolor [fialova] [magenta] + \definecolor [zluta] [yellow] + + \definecolor [bila] [white] + \definecolor [cerna] [black] + + \definecolor [tmavecervena] [darkred] + \definecolor [strednecervena] [middlered] + \definecolor [svetlecervena] [lightred] + + \definecolor [tmavezelena] [darkgreen] + \definecolor [strednezelena] [middlegreen] + \definecolor [svetlezelena] [lightgreen] + + \definecolor [tmavemodra] [darkblue] + \definecolor [strednemodra] [middleblue] + \definecolor [svetlemodra] [lightblue] + + \definecolor [tmaveazurova] [darkcyan] + \definecolor [stredneazurova] [middlecyan] + + \definecolor [tmavefialova] [darkmagenta] + \definecolor [strednefialova] [middlemagenta] + + \definecolor [tmavezluta] [darkyellow] + \definecolor [strednezluta] [middleyellow] + + \definecolor [tmaveseda] [darkgray] + \definecolor [stredneseda] [middlegray] + \definecolor [svetleseda] [lightgray] + +\stopinterface + +\startinterface italian + + \definecolor [rosso] [red] + \definecolor [verde] [green] + \definecolor [blu] [blue] + + \definecolor [azzurro] [cyan] + \definecolor [turchino] [cyan] + \definecolor [ciano] [cyan] + \definecolor [cremisi] [magenta] + \definecolor [giallo] [yellow] + + \definecolor [bianco] [white] + \definecolor [grigio] [gray] + \definecolor [nero] [black] + + \definecolor [rossoscuro] [darkred] + \definecolor [rossomedio] [middlered] + \definecolor [rossochiaro] [lightred] + + \definecolor [verdescuro] [darkgreen] + \definecolor [verdemedio] [middlegreen] + \definecolor [verdechiaro] [lightgreen] + + \definecolor [bluscuro] [darkblue] + \definecolor [blumedio] [middleblue] + \definecolor [bluchiaro] [lightblue] + + \definecolor [azzurroscuro] [darkcyan] + \definecolor [azzurrochiaro] [middlecyan] + + \definecolor [cremisiscuro] [darkmagenta] + \definecolor [cremisichiaro] [middlemagenta] + + + \definecolor [gialloscuro] [darkyellow] + \definecolor [giallomedio] [middleyellow] + + \definecolor [grigioscuro] [darkgray] + \definecolor [grigiomedio] [middlegray] + \definecolor [grigiochiaro] [lightgray] + +\stopinterface + +\startinterface romanian + + \definecolor [rosu] [red] + \definecolor [verde] [green] + \definecolor [albastru] [blue] + + \definecolor [cian] [cyan] + \definecolor [magenta] [magenta] + \definecolor [galben] [yellow] + + \definecolor [alb] [white] + \definecolor [gri] [gray] + \definecolor [negru] [black] + + \definecolor [rosuinchis] [darkred] + \definecolor [rosumediu] [middlered] + \definecolor [rosudeschis] [lightred] + + \definecolor [verdeinchis] [darkgreen] + \definecolor [verdemediu] [middlegreen] + \definecolor [verdedeschis] [lightgreen] + + \definecolor [albastruinchis] [darkblue] + \definecolor [albastrumediu] [middleblue] + \definecolor [albastrudeschis] [lightblue] + + \definecolor [cianinchis] [darkcyan] + \definecolor [cianmediu] [middlecyan] + + \definecolor [magentainchis] [darkmagenta] + \definecolor [magentamediu] [middlemagenta] + + \definecolor [galbeninchis] [darkyellow] + \definecolor [galbenmediu] [middleyellow] + + \definecolor [griinchis] [darkgray] + \definecolor [grimediu] [middlegray] + \definecolor [grideschis] [lightgray] + +\stopinterface + +%D Like colors, we first define the english colorgroups. These +%D colorgroups are tuned for distinctive gray scale printing. + +% todo : more efficient and real gray + +\definecolorgroup + [gray] + [0.95:0.95:0.95, + 0.90:0.90:0.90, + 0.80:0.80:0.80, + 0.70:0.70:0.70, + 0.60:0.60:0.60, + 0.50:0.50:0.50, + 0.40:0.40:0.40, + 0.30:0.30:0.30, + 0.20:0.20:0.20, + 0.10:0.10:0.10, + 0.00:0.00:0.00] + +\definecolorgroup + [red] + [1.00:0.90:0.90, + 1.00:0.80:0.80, + 1.00:0.70:0.70, + 1.00:0.55:0.55, + 1.00:0.40:0.40, + 1.00:0.25:0.25, + 1.00:0.15:0.15, + 0.90:0.00:0.00] + +\definecolorgroup + [green] + [0.90:1.00:0.90, + 0.70:1.00:0.70, + 0.50:1.00:0.50, + 0.30:1.00:0.30, + 0.15:0.90:0.15, + 0.00:0.80:0.00, + 0.00:0.65:0.00, + 0.00:0.50:0.00] + +\definecolorgroup + [blue] + [0.90:0.95:1.00, + 0.80:0.90:1.00, + 0.55:0.85:1.00, + 0.30:0.80:1.00, + 0.15:0.75:1.00, + 0.00:0.70:1.00, + 0.00:0.55:1.00, + 0.00:0.40:1.00] + +\definecolorgroup + [cyan] + [0.80:1.00:1.00, + 0.60:1.00:1.00, + 0.30:1.00:1.00, + 0.00:0.95:0.95, + 0.00:0.85:0.85, + 0.00:0.75:0.75, + 0.00:0.60:0.60, + 0.00:0.50:0.50] + +\definecolorgroup + [magenta] + [1.00:0.90:1.00, + 1.00:0.80:1.00, + 1.00:0.65:1.00, + 1.00:0.50:1.00, + 1.00:0.35:1.00, + 1.00:0.15:1.00, + 0.90:0.05:0.90, + 0.80:0.00:0.80] + +\definecolorgroup + [yellow] + [1.00:1.00:0.70, + 1.00:1.00:0.00, + 1.00:0.85:0.05, + 1.00:0.70:0.00, + 1.00:0.55:0.00, + 0.95:0.40:0.00, + 0.80:0.30:0.00, + 0.60:0.30:0.00] + +\definecolorgroup + [red*] + [1.00:0.95:0.95, + 1.00:0.90:0.90, + 1.00:0.80:0.80, + 1.00:0.70:0.70, + 1.00:0.60:0.60, + 1.00:0.50:0.50, + 1.00:0.40:0.40, + 1.00:0.30:0.30] + +\definecolorgroup + [green*] + [0.95:1.00:0.95, + 0.90:1.00:0.90, + 0.80:1.00:0.80, + 0.70:1.00:0.70, + 0.60:1.00:0.60, + 0.50:1.00:0.50, + 0.40:1.00:0.40, + 0.30:1.00:0.30] + +\definecolorgroup + [blue*] + [0.95:0.95:1.00, + 0.90:0.90:1.00, + 0.80:0.80:1.00, + 0.70:0.70:1.00, + 0.60:0.60:1.00, + 0.50:0.50:1.00, + 0.40:0.40:1.00, + 0.30:0.30:1.00] + +\definecolorgroup + [yellow*] + [1.00:1.00:0.10, + 1.00:1.00:0.00, + 0.90:0.90:0.00, + 0.80:0.80:0.00, + 0.70:0.70:0.00, + 0.60:0.60:0.00, + 0.50:0.50:0.00, + 0.40:0.40:0.00] + +%D For the sake of implementing interface dependant color +%D groups we support colorgroup duplication. + +\startinterface dutch + \definecolorgroup [grijs] [gray] + \definecolorgroup [rood] [red] + \definecolorgroup [groen] [green] + \definecolorgroup [blauw] [blue] + \definecolorgroup [cyaan] [cyan] + \definecolorgroup [magenta] [magenta] + \definecolorgroup [geel] [yellow] + \definecolorgroup [rood*] [red*] + \definecolorgroup [groen*] [green*] + \definecolorgroup [blauw*] [blue*] + \definecolorgroup [geel*] [yellow*] +\stopinterface + +\startinterface german + \definecolorgroup [grau] [gray] + \definecolorgroup [rot] [red] + \definecolorgroup [gruen] [green] + \definecolorgroup [blau] [blue] + \definecolorgroup [cyan] [cyan] + \definecolorgroup [magenta] [magenta] + \definecolorgroup [gelb] [yellow] + \definecolorgroup [rot*] [red*] + \definecolorgroup [gruen*] [green*] + \definecolorgroup [blau*] [blue*] + \definecolorgroup [gelb*] [yellow*] +\stopinterface + +\startinterface czech + \definecolorgroup [seda] [gray] + \definecolorgroup [cervena] [red] + \definecolorgroup [zelena] [green] + \definecolorgroup [modra] [blue] + \definecolorgroup [azurova] [cyan] + \definecolorgroup [fialova] [magenta] + \definecolorgroup [zluta] [yellow] + \definecolorgroup [cervena*] [red*] + \definecolorgroup [zelena*] [green*] + \definecolorgroup [modra*] [blue*] + \definecolorgroup [zluta*] [yellow*] +\stopinterface + +\startinterface italian + \definecolorgroup [grigio] [gray] + \definecolorgroup [rosso] [red] + \definecolorgroup [verde] [green] + \definecolorgroup [blu] [blue] + \definecolorgroup [ciano] [cyan] + \definecolorgroup [azzurro] [cyan] + \definecolorgroup [turchino][cyan] + \definecolorgroup [magenta] [magenta] + \definecolorgroup [cremisi] [magenta] + \definecolorgroup [giallo] [yellow] + \definecolorgroup [rosso*] [red*] + \definecolorgroup [verde*] [green*] + \definecolorgroup [blu*] [blue*] + \definecolorgroup [giallo*] [yellow*] +\stopinterface + +%D The next set of color palets is quite language independant. +%D These palets are meant as examples. + +\definepalet + [alfa] + [ top=red:7, + bottom=green:6, + up=blue:5, + down=cyan:4, + strange=magenta:3, + charm=yellow:2] + +\definepalet + [beta] + [ top=red:7, + bottom=green:5, + up=blue:3, + down=cyan:6, + strange=magenta:2, + charm=yellow:1] + +\definepalet + [gamma] + [ top=red:2, + bottom=green:5, + up=blue:3, + down=cyan:6, + strange=magenta:7, + charm=yellow:4] + +\definepalet + [delta] + [ top=yellow*:5, + bottom=yellow*:3, + up=yellow*:2, + down=magenta:6, + strange=blue:4, + charm=blue:1] + +\definepalet + [epsilon] + [ top=cyan:7, + bottom=cyan:5, + up=blue:3, + down=yellow:6, + strange=yellow:4, + charm=yellow:2] + +\definepalet + [zeta] + [ top=red:6, + bottom=green:5, + up=blue:7, + down=cyan:4, + strange=magenta:3, + charm=yellow:2] + +%D The next four colors are used for typesetting verbatim \TEX\ +%D in color. + +\definecolor [texcolorone] [middlered] +\definecolor [texcolortwo] [middlegreen] +\definecolor [texcolorthree] [middleblue] +\definecolor [texcolorfour] [darkyellow] + +%D Bonus (needed for FO test): + +\definecolor [orange] [r=1,g=.5] + +\endinput diff --git a/Master/texmf-dist/tex/context/base/colo-imp-x11.mkiv b/Master/texmf-dist/tex/context/base/colo-imp-x11.mkiv new file mode 100644 index 00000000000..45d3aac6248 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/colo-imp-x11.mkiv @@ -0,0 +1,677 @@ +%D \module +%D [ file=colo-x11, +%D version=2009.11.13, +%D title=\CONTEXT\ Color Macros, +%D subtitle=X11, +%D author=Alan Braslau] +%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 Standard X11 rgb colors (from \type {/usr/share/X11/rgb.txt}): + +\doifnotmode{mkiv} { + \input colo-hex.mkii +} + +\definecolor [snow] [h=fffafa] +\definecolor [ghostwhite] [h=f8f8ff] +\definecolor [whitesmoke] [s=0.96] +\definecolor [gainsboro] [s=0.86] +\definecolor [floralwhite] [h=fffaf0] +\definecolor [oldlace] [h=fdf5e6] +\definecolor [linen] [h=faf0e6] +\definecolor [antiquewhite] [h=faebd7] +\definecolor [papayawhip] [h=ffefd5] +\definecolor [blanchedalmond] [h=ffebcd] +\definecolor [bisque] [h=ffe4c4] +\definecolor [peachpuff] [h=ffdab9] +\definecolor [navajowhite] [h=ffdead] +\definecolor [moccasin] [h=ffe4b5] +\definecolor [cornsilk] [h=fff8dc] +\definecolor [ivory] [h=fffff0] +\definecolor [lemonchiffon] [h=fffacd] +\definecolor [seashell] [h=fff5ee] +\definecolor [honeydew] [h=f0fff0] +\definecolor [mintcream] [h=f5fffa] +\definecolor [azure] [h=f0ffff] +\definecolor [aliceblue] [h=f0f8ff] +\definecolor [lavender] [h=e6e6fa] +\definecolor [lavenderblush] [h=fff0f5] +\definecolor [mistyrose] [h=ffe4e1] +\definecolor [white] [s=1] +\definecolor [black] [s=0] +\definecolor [darkslategray] [h=2f4f4f] +\definecolor [darkslategrey] [darkslategray] +\definecolor [dimgray] [s=0.41] +\definecolor [dimgrey] [dimgray] +\definecolor [slategray] [h=708090] +\definecolor [slategrey] [slategray] +\definecolor [lightslategray] [h=778899] +\definecolor [lightslategrey] [lightslategray] +\definecolor [gray] [s=0.75] +\definecolor [grey] [gray] +\definecolor [lightgrey] [s=0.83] +\definecolor [lightgray] [lightgrey] +\definecolor [midnightblue] [h=191970] +\definecolor [navy] [h=000080] +\definecolor [navyblue] [navy] +\definecolor [cornflowerblue] [h=6495ed] +\definecolor [darkslateblue] [h=483d8b] +\definecolor [slateblue] [h=6a5acd] +\definecolor [mediumslateblue] [h=7b68ee] +\definecolor [lightslateblue] [h=8470ff] +\definecolor [mediumblue] [h=0000cd] +\definecolor [royalblue] [h=4169e1] +\definecolor [blue] [h=0000ff] +\definecolor [dodgerblue] [h=1e90ff] +\definecolor [deepskyblue] [h=00bfff] +\definecolor [skyblue] [h=87ceeb] +\definecolor [lightskyblue] [h=87cefa] +\definecolor [steelblue] [h=4682b4] +\definecolor [lightsteelblue] [h=b0c4de] +\definecolor [lightblue] [h=add8e6] +\definecolor [powderblue] [h=b0e0e6] +\definecolor [paleturquoise] [h=afeeee] +\definecolor [darkturquoise] [h=00ced1] +\definecolor [mediumturquoise] [h=48d1cc] +\definecolor [turquoise] [h=40e0d0] +\definecolor [cyan] [h=00ffff] +\definecolor [lightcyan] [h=e0ffff] +\definecolor [cadetblue] [h=5f9ea0] +\definecolor [mediumaquamarine] [h=66cdaa] +\definecolor [aquamarine] [h=7fffd4] +\definecolor [darkgreen] [h=006400] +\definecolor [darkolivegreen] [h=556b2f] +\definecolor [darkseagreen] [h=8fbc8f] +\definecolor [seagreen] [h=2e8b57] +\definecolor [mediumseagreen] [h=3cb371] +\definecolor [lightseagreen] [h=20b2aa] +\definecolor [palegreen] [h=98fb98] +\definecolor [springgreen] [h=00ff7f] +\definecolor [lawngreen] [h=7cfc00] +\definecolor [green] [h=00ff00] +\definecolor [chartreuse] [h=7fff00] +\definecolor [mediumspringgreen] [h=00fa9a] +\definecolor [greenyellow] [h=adff2f] +\definecolor [limegreen] [h=32cd32] +\definecolor [yellowgreen] [h=9acd32] +\definecolor [forestgreen] [h=228b22] +\definecolor [olivedrab] [h=6b8e23] +\definecolor [darkkhaki] [h=bdb76b] +\definecolor [khaki] [h=f0e68c] +\definecolor [palegoldenrod] [h=eee8aa] +\definecolor [lightgoldenrodyellow] [h=fafad2] +\definecolor [lightyellow] [h=ffffe0] +\definecolor [yellow] [h=ffff00] +\definecolor [gold] [h=ffd700] +\definecolor [lightgoldenrod] [h=eedd82] +\definecolor [goldenrod] [h=daa520] +\definecolor [darkgoldenrod] [h=b8860b] +\definecolor [rosybrown] [h=bc8f8f] +\definecolor [indianred] [h=cd5c5c] +\definecolor [saddlebrown] [h=8b4513] +\definecolor [sienna] [h=a0522d] +\definecolor [peru] [h=cd853f] +\definecolor [burlywood] [h=deb887] +\definecolor [beige] [h=f5f5dc] +\definecolor [wheat] [h=f5deb3] +\definecolor [sandybrown] [h=f4a460] +\definecolor [tan] [h=d2b48c] +\definecolor [chocolate] [h=d2691e] +\definecolor [firebrick] [h=b22222] +\definecolor [brown] [h=a52a2a] +\definecolor [darksalmon] [h=e9967a] +\definecolor [salmon] [h=fa8072] +\definecolor [lightsalmon] [h=ffa07a] +\definecolor [orange] [h=ffa500] +\definecolor [darkorange] [h=ff8c00] +\definecolor [coral] [h=ff7f50] +\definecolor [lightcoral] [h=f08080] +\definecolor [tomato] [h=ff6347] +\definecolor [orangered] [h=ff4500] +\definecolor [red] [h=ff0000] +\definecolor [hotpink] [h=ff69b4] +\definecolor [deeppink] [h=ff1493] +\definecolor [pink] [h=ffc0cb] +\definecolor [lightpink] [h=ffb6c1] +\definecolor [palevioletred] [h=db7093] +\definecolor [maroon] [h=b03060] +\definecolor [mediumvioletred] [h=c71585] +\definecolor [violetred] [h=d02090] +\definecolor [magenta] [h=ff00ff] +\definecolor [violet] [h=ee82ee] +\definecolor [plum] [h=dda0dd] +\definecolor [orchid] [h=da70d6] +\definecolor [mediumorchid] [h=ba55d3] +\definecolor [darkorchid] [h=9932cc] +\definecolor [darkviolet] [h=9400d3] +\definecolor [blueviolet] [h=8a2be2] +\definecolor [purple] [h=a020f0] +\definecolor [mediumpurple] [h=9370db] +\definecolor [thistle] [h=d8bfd8] +\definecolor [snow1] [h=fffafa] +\definecolor [snow2] [h=eee9e9] +\definecolor [snow3] [h=cdc9c9] +\definecolor [snow4] [h=8b8989] +\definecolor [seashell1] [h=fff5ee] +\definecolor [seashell2] [h=eee5de] +\definecolor [seashell3] [h=cdc5bf] +\definecolor [seashell4] [h=8b8682] +\definecolor [antiquewhite1] [h=ffefdb] +\definecolor [antiquewhite2] [h=eedfcc] +\definecolor [antiquewhite3] [h=cdc0b0] +\definecolor [antiquewhite4] [h=8b8378] +\definecolor [bisque1] [h=ffe4c4] +\definecolor [bisque2] [h=eed5b7] +\definecolor [bisque3] [h=cdb79e] +\definecolor [bisque4] [h=8b7d6b] +\definecolor [peachpuff1] [h=ffdab9] +\definecolor [peachpuff2] [h=eecbad] +\definecolor [peachpuff3] [h=cdaf95] +\definecolor [peachpuff4] [h=8b7765] +\definecolor [navajowhite1] [h=ffdead] +\definecolor [navajowhite2] [h=eecfa1] +\definecolor [navajowhite3] [h=cdb38b] +\definecolor [navajowhite4] [h=8b795e] +\definecolor [lemonchiffon1] [h=fffacd] +\definecolor [lemonchiffon2] [h=eee9bf] +\definecolor [lemonchiffon3] [h=cdc9a5] +\definecolor [lemonchiffon4] [h=8b8970] +\definecolor [cornsilk1] [h=fff8dc] +\definecolor [cornsilk2] [h=eee8cd] +\definecolor [cornsilk3] [h=cdc8b1] +\definecolor [cornsilk4] [h=8b8878] +\definecolor [ivory1] [h=fffff0] +\definecolor [ivory2] [h=eeeee0] +\definecolor [ivory3] [h=cdcdc1] +\definecolor [ivory4] [h=8b8b83] +\definecolor [honeydew1] [h=f0fff0] +\definecolor [honeydew2] [h=e0eee0] +\definecolor [honeydew3] [h=c1cdc1] +\definecolor [honeydew4] [h=838b83] +\definecolor [lavenderblush1] [h=fff0f5] +\definecolor [lavenderblush2] [h=eee0e5] +\definecolor [lavenderblush3] [h=cdc1c5] +\definecolor [lavenderblush4] [h=8b8386] +\definecolor [mistyrose1] [h=ffe4e1] +\definecolor [mistyrose2] [h=eed5d2] +\definecolor [mistyrose3] [h=cdb7b5] +\definecolor [mistyrose4] [h=8b7d7b] +\definecolor [azure1] [h=f0ffff] +\definecolor [azure2] [h=e0eeee] +\definecolor [azure3] [h=c1cdcd] +\definecolor [azure4] [h=838b8b] +\definecolor [slateblue1] [h=836fff] +\definecolor [slateblue2] [h=7a67ee] +\definecolor [slateblue3] [h=6959cd] +\definecolor [slateblue4] [h=473c8b] +\definecolor [royalblue1] [h=4876ff] +\definecolor [royalblue2] [h=436eee] +\definecolor [royalblue3] [h=3a5fcd] +\definecolor [royalblue4] [h=27408b] +\definecolor [blue1] [h=0000ff] +\definecolor [blue2] [h=0000ee] +\definecolor [blue3] [h=0000cd] +\definecolor [blue4] [h=00008b] +\definecolor [dodgerblue1] [h=1e90ff] +\definecolor [dodgerblue2] [h=1c86ee] +\definecolor [dodgerblue3] [h=1874cd] +\definecolor [dodgerblue4] [h=104e8b] +\definecolor [steelblue1] [h=63b8ff] +\definecolor [steelblue2] [h=5cacee] +\definecolor [steelblue3] [h=4f94cd] +\definecolor [steelblue4] [h=36648b] +\definecolor [deepskyblue1] [h=00bfff] +\definecolor [deepskyblue2] [h=00b2ee] +\definecolor [deepskyblue3] [h=009acd] +\definecolor [deepskyblue4] [h=00688b] +\definecolor [skyblue1] [h=87ceff] +\definecolor [skyblue2] [h=7ec0ee] +\definecolor [skyblue3] [h=6ca6cd] +\definecolor [skyblue4] [h=4a708b] +\definecolor [lightskyblue1] [h=b0e2ff] +\definecolor [lightskyblue2] [h=a4d3ee] +\definecolor [lightskyblue3] [h=8db6cd] +\definecolor [lightskyblue4] [h=607b8b] +\definecolor [slategray1] [h=c6e2ff] +\definecolor [slategray2] [h=b9d3ee] +\definecolor [slategray3] [h=9fb6cd] +\definecolor [slategray4] [h=6c7b8b] +\definecolor [lightsteelblue1] [h=cae1ff] +\definecolor [lightsteelblue2] [h=bcd2ee] +\definecolor [lightsteelblue3] [h=a2b5cd] +\definecolor [lightsteelblue4] [h=6e7b8b] +\definecolor [lightblue1] [h=bfefff] +\definecolor [lightblue2] [h=b2dfee] +\definecolor [lightblue3] [h=9ac0cd] +\definecolor [lightblue4] [h=68838b] +\definecolor [lightcyan1] [h=e0ffff] +\definecolor [lightcyan2] [h=d1eeee] +\definecolor [lightcyan3] [h=b4cdcd] +\definecolor [lightcyan4] [h=7a8b8b] +\definecolor [paleturquoise1] [h=bbffff] +\definecolor [paleturquoise2] [h=aeeeee] +\definecolor [paleturquoise3] [h=96cdcd] +\definecolor [paleturquoise4] [h=668b8b] +\definecolor [cadetblue1] [h=98f5ff] +\definecolor [cadetblue2] [h=8ee5ee] +\definecolor [cadetblue3] [h=7ac5cd] +\definecolor [cadetblue4] [h=53868b] +\definecolor [turquoise1] [h=00f5ff] +\definecolor [turquoise2] [h=00e5ee] +\definecolor [turquoise3] [h=00c5cd] +\definecolor [turquoise4] [h=00868b] +\definecolor [cyan1] [h=00ffff] +\definecolor [cyan2] [h=00eeee] +\definecolor [cyan3] [h=00cdcd] +\definecolor [cyan4] [h=008b8b] +\definecolor [darkslategray1] [h=97ffff] +\definecolor [darkslategray2] [h=8deeee] +\definecolor [darkslategray3] [h=79cdcd] +\definecolor [darkslategray4] [h=528b8b] +\definecolor [aquamarine1] [h=7fffd4] +\definecolor [aquamarine2] [h=76eec6] +\definecolor [aquamarine3] [h=66cdaa] +\definecolor [aquamarine4] [h=458b74] +\definecolor [darkseagreen1] [h=c1ffc1] +\definecolor [darkseagreen2] [h=b4eeb4] +\definecolor [darkseagreen3] [h=9bcd9b] +\definecolor [darkseagreen4] [h=698b69] +\definecolor [seagreen1] [h=54ff9f] +\definecolor [seagreen2] [h=4eee94] +\definecolor [seagreen3] [h=43cd80] +\definecolor [seagreen4] [h=2e8b57] +\definecolor [palegreen1] [h=9aff9a] +\definecolor [palegreen2] [h=90ee90] +\definecolor [palegreen3] [h=7ccd7c] +\definecolor [palegreen4] [h=548b54] +\definecolor [springgreen1] [h=00ff7f] +\definecolor [springgreen2] [h=00ee76] +\definecolor [springgreen3] [h=00cd66] +\definecolor [springgreen4] [h=008b45] +\definecolor [green1] [h=00ff00] +\definecolor [green2] [h=00ee00] +\definecolor [green3] [h=00cd00] +\definecolor [green4] [h=008b00] +\definecolor [chartreuse1] [h=7fff00] +\definecolor [chartreuse2] [h=76ee00] +\definecolor [chartreuse3] [h=66cd00] +\definecolor [chartreuse4] [h=458b00] +\definecolor [olivedrab1] [h=c0ff3e] +\definecolor [olivedrab2] [h=b3ee3a] +\definecolor [olivedrab3] [h=9acd32] +\definecolor [olivedrab4] [h=698b22] +\definecolor [darkolivegreen1] [h=caff70] +\definecolor [darkolivegreen2] [h=bcee68] +\definecolor [darkolivegreen3] [h=a2cd5a] +\definecolor [darkolivegreen4] [h=6e8b3d] +\definecolor [khaki1] [h=fff68f] +\definecolor [khaki2] [h=eee685] +\definecolor [khaki3] [h=cdc673] +\definecolor [khaki4] [h=8b864e] +\definecolor [lightgoldenrod1] [h=ffec8b] +\definecolor [lightgoldenrod2] [h=eedc82] +\definecolor [lightgoldenrod3] [h=cdbe70] +\definecolor [lightgoldenrod4] [h=8b814c] +\definecolor [lightyellow1] [h=ffffe0] +\definecolor [lightyellow2] [h=eeeed1] +\definecolor [lightyellow3] [h=cdcdb4] +\definecolor [lightyellow4] [h=8b8b7a] +\definecolor [yellow1] [h=ffff00] +\definecolor [yellow2] [h=eeee00] +\definecolor [yellow3] [h=cdcd00] +\definecolor [yellow4] [h=8b8b00] +\definecolor [gold1] [h=ffd700] +\definecolor [gold2] [h=eec900] +\definecolor [gold3] [h=cdad00] +\definecolor [gold4] [h=8b7500] +\definecolor [goldenrod1] [h=ffc125] +\definecolor [goldenrod2] [h=eeb422] +\definecolor [goldenrod3] [h=cd9b1d] +\definecolor [goldenrod4] [h=8b6914] +\definecolor [darkgoldenrod1] [h=ffb90f] +\definecolor [darkgoldenrod2] [h=eead0e] +\definecolor [darkgoldenrod3] [h=cd950c] +\definecolor [darkgoldenrod4] [h=8b6508] +\definecolor [rosybrown1] [h=ffc1c1] +\definecolor [rosybrown2] [h=eeb4b4] +\definecolor [rosybrown3] [h=cd9b9b] +\definecolor [rosybrown4] [h=8b6969] +\definecolor [indianred1] [h=ff6a6a] +\definecolor [indianred2] [h=ee6363] +\definecolor [indianred3] [h=cd5555] +\definecolor [indianred4] [h=8b3a3a] +\definecolor [sienna1] [h=ff8247] +\definecolor [sienna2] [h=ee7942] +\definecolor [sienna3] [h=cd6839] +\definecolor [sienna4] [h=8b4726] +\definecolor [burlywood1] [h=ffd39b] +\definecolor [burlywood2] [h=eec591] +\definecolor [burlywood3] [h=cdaa7d] +\definecolor [burlywood4] [h=8b7355] +\definecolor [wheat1] [h=ffe7ba] +\definecolor [wheat2] [h=eed8ae] +\definecolor [wheat3] [h=cdba96] +\definecolor [wheat4] [h=8b7e66] +\definecolor [tan1] [h=ffa54f] +\definecolor [tan2] [h=ee9a49] +\definecolor [tan3] [h=cd853f] +\definecolor [tan4] [h=8b5a2b] +\definecolor [chocolate1] [h=ff7f24] +\definecolor [chocolate2] [h=ee7621] +\definecolor [chocolate3] [h=cd661d] +\definecolor [chocolate4] [h=8b4513] +\definecolor [firebrick1] [h=ff3030] +\definecolor [firebrick2] [h=ee2c2c] +\definecolor [firebrick3] [h=cd2626] +\definecolor [firebrick4] [h=8b1a1a] +\definecolor [brown1] [h=ff4040] +\definecolor [brown2] [h=ee3b3b] +\definecolor [brown3] [h=cd3333] +\definecolor [brown4] [h=8b2323] +\definecolor [salmon1] [h=ff8c69] +\definecolor [salmon2] [h=ee8262] +\definecolor [salmon3] [h=cd7054] +\definecolor [salmon4] [h=8b4c39] +\definecolor [lightsalmon1] [h=ffa07a] +\definecolor [lightsalmon2] [h=ee9572] +\definecolor [lightsalmon3] [h=cd8162] +\definecolor [lightsalmon4] [h=8b5742] +\definecolor [orange1] [h=ffa500] +\definecolor [orange2] [h=ee9a00] +\definecolor [orange3] [h=cd8500] +\definecolor [orange4] [h=8b5a00] +\definecolor [darkorange1] [h=ff7f00] +\definecolor [darkorange2] [h=ee7600] +\definecolor [darkorange3] [h=cd6600] +\definecolor [darkorange4] [h=8b4500] +\definecolor [coral1] [h=ff7256] +\definecolor [coral2] [h=ee6a50] +\definecolor [coral3] [h=cd5b45] +\definecolor [coral4] [h=8b3e2f] +\definecolor [tomato1] [h=ff6347] +\definecolor [tomato2] [h=ee5c42] +\definecolor [tomato3] [h=cd4f39] +\definecolor [tomato4] [h=8b3626] +\definecolor [orangered1] [h=ff4500] +\definecolor [orangered2] [h=ee4000] +\definecolor [orangered3] [h=cd3700] +\definecolor [orangered4] [h=8b2500] +\definecolor [red1] [h=ff0000] +\definecolor [red2] [h=ee0000] +\definecolor [red3] [h=cd0000] +\definecolor [red4] [h=8b0000] +\definecolor [debianred] [h=d70751] +\definecolor [deeppink1] [h=ff1493] +\definecolor [deeppink2] [h=ee1289] +\definecolor [deeppink3] [h=cd1076] +\definecolor [deeppink4] [h=8b0a50] +\definecolor [hotpink1] [h=ff6eb4] +\definecolor [hotpink2] [h=ee6aa7] +\definecolor [hotpink3] [h=cd6090] +\definecolor [hotpink4] [h=8b3a62] +\definecolor [pink1] [h=ffb5c5] +\definecolor [pink2] [h=eea9b8] +\definecolor [pink3] [h=cd919e] +\definecolor [pink4] [h=8b636c] +\definecolor [lightpink1] [h=ffaeb9] +\definecolor [lightpink2] [h=eea2ad] +\definecolor [lightpink3] [h=cd8c95] +\definecolor [lightpink4] [h=8b5f65] +\definecolor [palevioletred1] [h=ff82ab] +\definecolor [palevioletred2] [h=ee799f] +\definecolor [palevioletred3] [h=cd6889] +\definecolor [palevioletred4] [h=8b475d] +\definecolor [maroon1] [h=ff34b3] +\definecolor [maroon2] [h=ee30a7] +\definecolor [maroon3] [h=cd2990] +\definecolor [maroon4] [h=8b1c62] +\definecolor [violetred1] [h=ff3e96] +\definecolor [violetred2] [h=ee3a8c] +\definecolor [violetred3] [h=cd3278] +\definecolor [violetred4] [h=8b2252] +\definecolor [magenta1] [h=ff00ff] +\definecolor [magenta2] [h=ee00ee] +\definecolor [magenta3] [h=cd00cd] +\definecolor [magenta4] [h=8b008b] +\definecolor [orchid1] [h=ff83fa] +\definecolor [orchid2] [h=ee7ae9] +\definecolor [orchid3] [h=cd69c9] +\definecolor [orchid4] [h=8b4789] +\definecolor [plum1] [h=ffbbff] +\definecolor [plum2] [h=eeaeee] +\definecolor [plum3] [h=cd96cd] +\definecolor [plum4] [h=8b668b] +\definecolor [mediumorchid1] [h=e066ff] +\definecolor [mediumorchid2] [h=d15fee] +\definecolor [mediumorchid3] [h=b452cd] +\definecolor [mediumorchid4] [h=7a378b] +\definecolor [darkorchid1] [h=bf3eff] +\definecolor [darkorchid2] [h=b23aee] +\definecolor [darkorchid3] [h=9a32cd] +\definecolor [darkorchid4] [h=68228b] +\definecolor [purple1] [h=9b30ff] +\definecolor [purple2] [h=912cee] +\definecolor [purple3] [h=7d26cd] +\definecolor [purple4] [h=551a8b] +\definecolor [mediumpurple1] [h=ab82ff] +\definecolor [mediumpurple2] [h=9f79ee] +\definecolor [mediumpurple3] [h=8968cd] +\definecolor [mediumpurple4] [h=5d478b] +\definecolor [thistle1] [h=ffe1ff] +\definecolor [thistle2] [h=eed2ee] +\definecolor [thistle3] [h=cdb5cd] +\definecolor [thistle4] [h=8b7b8b] +\definecolor [gray0] [s=0.00] +\definecolor [grey0] [gray0] +\definecolor [gray1] [s=0.01] +\definecolor [grey1] [gray1] +\definecolor [gray2] [s=0.02] +\definecolor [grey2] [gray2] +\definecolor [gray3] [s=0.03] +\definecolor [grey3] [gray3] +\definecolor [gray4] [s=0.04] +\definecolor [grey4] [gray4] +\definecolor [gray5] [s=0.05] +\definecolor [grey5] [gray5] +\definecolor [gray6] [s=0.06] +\definecolor [grey6] [gray6] +\definecolor [gray7] [s=0.07] +\definecolor [grey7] [gray7] +\definecolor [gray8] [s=0.08] +\definecolor [grey8] [gray8] +\definecolor [gray9] [s=0.09] +\definecolor [grey9] [gray9] +\definecolor [gray10] [s=0.10] +\definecolor [grey10] [gray10] +\definecolor [gray11] [s=0.11] +\definecolor [grey11] [gray11] +\definecolor [gray12] [s=0.12] +\definecolor [grey12] [gray12] +\definecolor [gray13] [s=0.13] +\definecolor [grey13] [gray13] +\definecolor [gray14] [s=0.14] +\definecolor [grey14] [gray14] +\definecolor [gray15] [s=0.15] +\definecolor [grey15] [gray15] +\definecolor [gray16] [s=0.16] +\definecolor [grey16] [gray16] +\definecolor [gray17] [s=0.17] +\definecolor [grey17] [gray17] +\definecolor [gray18] [s=0.18] +\definecolor [grey18] [gray18] +\definecolor [gray19] [s=0.19] +\definecolor [grey19] [gray19] +\definecolor [gray20] [s=0.20] +\definecolor [grey20] [gray20] +\definecolor [gray21] [s=0.21] +\definecolor [grey21] [gray21] +\definecolor [gray22] [s=0.22] +\definecolor [grey22] [gray22] +\definecolor [gray23] [s=0.23] +\definecolor [grey23] [gray23] +\definecolor [gray24] [s=0.24] +\definecolor [grey24] [gray24] +\definecolor [gray25] [s=0.25] +\definecolor [grey25] [gray25] +\definecolor [gray26] [s=0.26] +\definecolor [grey26] [gray26] +\definecolor [gray27] [s=0.27] +\definecolor [grey27] [gray27] +\definecolor [gray28] [s=0.28] +\definecolor [grey28] [gray28] +\definecolor [gray29] [s=0.29] +\definecolor [grey29] [gray29] +\definecolor [gray30] [s=0.30] +\definecolor [grey30] [gray30] +\definecolor [gray31] [s=0.31] +\definecolor [grey31] [gray31] +\definecolor [gray32] [s=0.32] +\definecolor [grey32] [gray32] +\definecolor [gray33] [s=0.33] +\definecolor [grey33] [gray33] +\definecolor [gray34] [s=0.34] +\definecolor [grey34] [gray34] +\definecolor [gray35] [s=0.35] +\definecolor [grey35] [gray35] +\definecolor [gray36] [s=0.36] +\definecolor [grey36] [gray36] +\definecolor [gray37] [s=0.37] +\definecolor [grey37] [gray37] +\definecolor [gray38] [s=0.38] +\definecolor [grey38] [gray38] +\definecolor [gray39] [s=0.39] +\definecolor [grey39] [gray39] +\definecolor [gray40] [s=0.40] +\definecolor [grey40] [gray40] +\definecolor [gray41] [s=0.41] +\definecolor [grey41] [gray41] +\definecolor [gray42] [s=0.42] +\definecolor [grey42] [gray42] +\definecolor [gray43] [s=0.43] +\definecolor [grey43] [gray43] +\definecolor [gray44] [s=0.44] +\definecolor [grey44] [gray44] +\definecolor [gray45] [s=0.45] +\definecolor [grey45] [gray45] +\definecolor [gray46] [s=0.46] +\definecolor [grey46] [gray46] +\definecolor [gray47] [s=0.47] +\definecolor [grey47] [gray47] +\definecolor [gray48] [s=0.48] +\definecolor [grey48] [gray48] +\definecolor [gray49] [s=0.49] +\definecolor [grey49] [gray49] +\definecolor [gray50] [s=0.50] +\definecolor [grey50] [gray50] +\definecolor [gray51] [s=0.51] +\definecolor [grey51] [gray51] +\definecolor [gray52] [s=0.52] +\definecolor [grey52] [gray52] +\definecolor [gray53] [s=0.53] +\definecolor [grey53] [gray53] +\definecolor [gray54] [s=0.54] +\definecolor [grey54] [gray54] +\definecolor [gray55] [s=0.55] +\definecolor [grey55] [gray55] +\definecolor [gray56] [s=0.56] +\definecolor [grey56] [gray56] +\definecolor [gray57] [s=0.57] +\definecolor [grey57] [gray57] +\definecolor [gray58] [s=0.58] +\definecolor [grey58] [gray58] +\definecolor [gray59] [s=0.59] +\definecolor [grey59] [gray59] +\definecolor [gray60] [s=0.60] +\definecolor [grey60] [gray60] +\definecolor [gray61] [s=0.61] +\definecolor [grey61] [gray61] +\definecolor [gray62] [s=0.62] +\definecolor [grey62] [gray62] +\definecolor [gray63] [s=0.63] +\definecolor [grey63] [gray63] +\definecolor [gray64] [s=0.64] +\definecolor [grey64] [gray64] +\definecolor [gray65] [s=0.65] +\definecolor [grey65] [gray65] +\definecolor [gray66] [s=0.66] +\definecolor [grey66] [gray66] +\definecolor [gray67] [s=0.67] +\definecolor [grey67] [gray67] +\definecolor [gray68] [s=0.68] +\definecolor [grey68] [gray68] +\definecolor [gray69] [s=0.69] +\definecolor [grey69] [gray69] +\definecolor [gray70] [s=0.70] +\definecolor [grey70] [gray70] +\definecolor [gray71] [s=0.71] +\definecolor [grey71] [gray71] +\definecolor [gray72] [s=0.72] +\definecolor [grey72] [gray72] +\definecolor [gray73] [s=0.73] +\definecolor [grey73] [gray73] +\definecolor [gray74] [s=0.74] +\definecolor [grey74] [gray74] +\definecolor [gray75] [s=0.75] +\definecolor [grey75] [gray75] +\definecolor [gray76] [s=0.76] +\definecolor [grey76] [gray76] +\definecolor [gray77] [s=0.77] +\definecolor [grey77] [gray77] +\definecolor [gray78] [s=0.78] +\definecolor [grey78] [gray78] +\definecolor [gray79] [s=0.79] +\definecolor [grey79] [gray79] +\definecolor [gray80] [s=0.80] +\definecolor [grey80] [gray80] +\definecolor [gray81] [s=0.81] +\definecolor [grey81] [gray81] +\definecolor [gray82] [s=0.82] +\definecolor [grey82] [gray82] +\definecolor [gray83] [s=0.83] +\definecolor [grey83] [gray83] +\definecolor [gray84] [s=0.84] +\definecolor [grey84] [gray84] +\definecolor [gray85] [s=0.85] +\definecolor [grey85] [gray85] +\definecolor [gray86] [s=0.86] +\definecolor [grey86] [gray86] +\definecolor [gray87] [s=0.87] +\definecolor [grey87] [gray87] +\definecolor [gray88] [s=0.88] +\definecolor [grey88] [gray88] +\definecolor [gray89] [s=0.89] +\definecolor [grey89] [gray89] +\definecolor [gray90] [s=0.90] +\definecolor [grey90] [gray90] +\definecolor [gray91] [s=0.91] +\definecolor [grey91] [gray91] +\definecolor [gray92] [s=0.92] +\definecolor [grey92] [gray92] +\definecolor [gray93] [s=0.93] +\definecolor [grey93] [gray93] +\definecolor [gray94] [s=0.94] +\definecolor [grey94] [gray94] +\definecolor [gray95] [s=0.95] +\definecolor [grey95] [gray95] +\definecolor [gray96] [s=0.96] +\definecolor [grey96] [gray96] +\definecolor [gray97] [s=0.97] +\definecolor [grey97] [gray97] +\definecolor [gray98] [s=0.98] +\definecolor [grey98] [gray98] +\definecolor [gray99] [s=0.99] +\definecolor [grey99] [gray99] +\definecolor [gray100] [s=1.00] +\definecolor [grey100] [gray100] +\definecolor [darkgrey] [s=0.66] +\definecolor [darkgray] [darkgrey] +\definecolor [darkblue] [h=00008b] +\definecolor [darkcyan] [h=008b8b] +\definecolor [darkmagenta] [h=8b008b] +\definecolor [darkred] [h=8b0000] +\definecolor [lightgreen] [h=90ee90] + +\endinput diff --git a/Master/texmf-dist/tex/context/base/colo-imp-xwi.mkiv b/Master/texmf-dist/tex/context/base/colo-imp-xwi.mkiv new file mode 100644 index 00000000000..81e09d871bc --- /dev/null +++ b/Master/texmf-dist/tex/context/base/colo-imp-xwi.mkiv @@ -0,0 +1,142 @@ +%D \module +%D [ file=colo-xwi, +%D version=1995.01.01, +%D title=\CONTEXT\ Color Macros, +%D subtitle=X Windows, +%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 I've forgotten where I got these definitions from, but maybe +%D they can be of use. + +\definecolor [aliceblue] [r=0.94,g=0.97,b=1.00] +\definecolor [antiquewhite] [r=0.98,g=0.92,b=0.84] +\definecolor [aquamarine] [r=0.50,g=1.00,b=0.83] +\definecolor [azure] [r=0.94,g=1.00,b=1.00] +\definecolor [beige] [r=0.96,g=0.96,b=0.86] +\definecolor [bisque] [r=1.00,g=0.89,b=0.77] +\definecolor [black] [s=0] % [r=0.00,g=0.00,b=0.00] +\definecolor [blanchedalmond] [r=1.00,g=0.92,b=0.80] +\definecolor [blue] [r=0.00,g=0.00,b=1.00] +\definecolor [blueviolet] [r=0.54,g=0.17,b=0.89] +\definecolor [brown] [r=0.65,g=0.16,b=0.16] +\definecolor [burlywood] [r=0.87,g=0.72,b=0.53] +\definecolor [cadetblue] [r=0.37,g=0.62,b=0.63] +\definecolor [chartreuse] [r=0.50,g=1.00,b=0.00] +\definecolor [chocolate] [r=0.82,g=0.41,b=0.12] +\definecolor [coral] [r=1.00,g=0.50,b=0.31] +\definecolor [cornflowerblue] [r=0.39,g=0.58,b=0.93] +\definecolor [cornsilk] [r=1.00,g=0.97,b=0.86] +\definecolor [cyan] [r=0.00,g=1.00,b=1.00] +\definecolor [darkgoldenrod] [r=0.72,g=0.53,b=0.04] +\definecolor [darkgreen] [r=0.00,g=0.39,b=0.00] +\definecolor [darkkhaki] [r=0.74,g=0.72,b=0.42] +\definecolor [darkolivegreen] [r=0.33,g=0.42,b=0.18] +\definecolor [darkorange] [r=1.00,g=0.55,b=0.00] +\definecolor [darkorchid] [r=0.60,g=0.20,b=0.80] +\definecolor [darksalmon] [r=0.91,g=0.59,b=0.48] +\definecolor [darkseagreen] [r=0.56,g=0.74,b=0.56] +\definecolor [darkslateblue] [r=0.28,g=0.24,b=0.55] +\definecolor [darkturquoise] [r=0.00,g=0.81,b=0.82] +\definecolor [darkviolet] [r=0.58,g=0.00,b=0.83] +\definecolor [deeppink] [r=1.00,g=0.08,b=0.58] +\definecolor [deepskyblue] [r=0.00,g=0.75,b=1.00] +\definecolor [dodgerblue] [r=0.12,g=0.56,b=1.00] +\definecolor [firebrick] [r=0.70,g=0.13,b=0.13] +\definecolor [floralwhite] [r=1.00,g=0.98,b=0.94] +\definecolor [forestgreen] [r=0.13,g=0.55,b=0.13] +\definecolor [gainsboro] [r=0.86,g=0.86,b=0.86] +\definecolor [ghostwhite] [r=0.97,g=0.97,b=1.00] +\definecolor [gold] [r=1.00,g=0.84,b=0.00] +\definecolor [goldenrod] [r=0.85,g=0.65,b=0.13] +\definecolor [green] [r=0.00,g=1.00,b=0.00] +\definecolor [greenyellow] [r=0.68,g=1.00,b=0.18] +\definecolor [honeydew] [r=0.94,g=1.00,b=0.94] +\definecolor [hotpink] [r=1.00,g=0.41,b=0.71] +\definecolor [indianred] [r=0.80,g=0.36,b=0.36] +\definecolor [ivory] [r=1.00,g=1.00,b=0.94] +\definecolor [khaki] [r=0.94,g=0.90,b=0.55] +\definecolor [lavender] [r=0.90,g=0.90,b=0.98] +\definecolor [lavenderblush] [r=1.00,g=0.94,b=0.96] +\definecolor [lawngreen] [r=0.49,g=0.99,b=0.00] +\definecolor [lemonchiffon] [r=1.00,g=0.98,b=0.80] +\definecolor [lightblue] [r=0.68,g=0.85,b=0.90] +\definecolor [lightcoral] [r=0.94,g=0.50,b=0.50] +\definecolor [lightcyan] [r=0.88,g=1.00,b=1.00] +\definecolor [lightgoldenrod] [r=0.93,g=0.87,b=0.51] +\definecolor [lightgoldenrodyellow] [r=0.98,g=0.98,b=0.82] +\definecolor [lightpink] [r=1.00,g=0.71,b=0.76] +\definecolor [lightsalmon] [r=1.00,g=0.63,b=0.48] +\definecolor [lightseagreen] [r=0.13,g=0.70,b=0.67] +\definecolor [lightskyblue] [r=0.53,g=0.81,b=0.98] +\definecolor [lightslateblue] [r=0.52,g=0.44,b=1.00] +\definecolor [lightsteelblue] [r=0.69,g=0.77,b=0.87] +\definecolor [lightyellow] [r=1.00,g=1.00,b=0.88] +\definecolor [limegreen] [r=0.20,g=0.80,b=0.20] +\definecolor [linen] [r=0.98,g=0.94,b=0.90] +\definecolor [magenta] [r=1.00,g=0.00,b=1.00] +\definecolor [maroon] [r=0.69,g=0.19,b=0.38] +\definecolor [mediumaquamarine] [r=0.40,g=0.80,b=0.67] +\definecolor [mediumblue] [r=0.00,g=0.00,b=0.80] +\definecolor [mediumorchid] [r=0.73,g=0.33,b=0.83] +\definecolor [mediumpurple] [r=0.58,g=0.44,b=0.86] +\definecolor [mediumseagreen] [r=0.24,g=0.70,b=0.44] +\definecolor [mediumslateblue] [r=0.48,g=0.41,b=0.93] +\definecolor [mediumspringgreen] [r=0.00,g=0.98,b=0.60] +\definecolor [mediumturquoise] [r=0.28,g=0.82,b=0.80] +\definecolor [mediumvioletred] [r=0.78,g=0.08,b=0.52] +\definecolor [midnightblue] [r=0.10,g=0.10,b=0.44] +\definecolor [mintcream] [r=0.96,g=1.00,b=0.98] +\definecolor [mistyrose] [r=1.00,g=0.89,b=0.88] +\definecolor [moccasin] [r=1.00,g=0.89,b=0.71] +\definecolor [navajowhite] [r=1.00,g=0.87,b=0.68] +\definecolor [navy] [r=0.00,g=0.00,b=0.50] +\definecolor [navyblue] [r=0.00,g=0.00,b=0.50] +\definecolor [oldlace] [r=0.99,g=0.96,b=0.90] +\definecolor [olivedrab] [r=0.42,g=0.56,b=0.14] +\definecolor [orange] [r=1.00,g=0.65,b=0.00] +\definecolor [orangered] [r=1.00,g=0.27,b=0.00] +\definecolor [orchid] [r=0.85,g=0.44,b=0.84] +\definecolor [palegoldenrod] [r=0.93,g=0.91,b=0.67] +\definecolor [palegreen] [r=0.60,g=0.98,b=0.60] +\definecolor [paleturquoise] [r=0.69,g=0.93,b=0.93] +\definecolor [palevioletred] [r=0.86,g=0.44,b=0.58] +\definecolor [papayawhip] [r=1.00,g=0.94,b=0.84] +\definecolor [peachpuff] [r=1.00,g=0.85,b=0.73] +\definecolor [peru] [r=0.80,g=0.52,b=0.25] +\definecolor [pink] [r=1.00,g=0.75,b=0.80] +\definecolor [plum] [r=0.87,g=0.63,b=0.87] +\definecolor [powderblue] [r=0.69,g=0.88,b=0.90] +\definecolor [purple] [r=0.63,g=0.13,b=0.94] +\definecolor [red ] [r=1.00,g=0.00,b=0.00] +\definecolor [rosybrown] [r=0.74,g=0.56,b=0.56] +\definecolor [royalblue] [r=0.25,g=0.41,b=0.88] +\definecolor [saddlebrown] [r=0.55,g=0.27,b=0.07] +\definecolor [salmon] [r=0.98,g=0.50,b=0.45] +\definecolor [sandybrown] [r=0.96,g=0.64,b=0.38] +\definecolor [seagreen] [r=0.18,g=0.55,b=0.34] +\definecolor [seashell] [r=1.00,g=0.96,b=0.93] +\definecolor [sienna] [r=0.63,g=0.32,b=0.18] +\definecolor [skyblue] [r=0.53,g=0.81,b=0.92] +\definecolor [slateblue] [r=0.42,g=0.35,b=0.80] +\definecolor [snow] [r=1.00,g=0.98,b=0.98] +\definecolor [springgreen] [r=0.00,g=1.00,b=0.50] +\definecolor [steelblue] [r=0.27,g=0.51,b=0.71] +\definecolor [tan ] [r=0.82,g=0.71,b=0.55] +\definecolor [thistle] [r=0.85,g=0.75,b=0.85] +\definecolor [tomato] [r=1.00,g=0.39,b=0.28] +\definecolor [turquoise] [r=0.25,g=0.88,b=0.82] +\definecolor [violet] [r=0.93,g=0.51,b=0.93] +\definecolor [violetred] [r=0.82,g=0.13,b=0.56] +\definecolor [wheat] [r=0.96,g=0.87,b=0.70] +\definecolor [white] [r=1.00,g=1.00,b=1.00] +\definecolor [whitesmoke] [s=0.96] % [r=0.96,g=0.96,b=0.96] +\definecolor [yellow] [r=1.00,g=1.00,b=0.00] +\definecolor [yellowgreen] [r=0.60,g=0.80,b=0.20] + +\endinput diff --git a/Master/texmf-dist/tex/context/base/colo-ini.lua b/Master/texmf-dist/tex/context/base/colo-ini.lua index 342d6110dca..c4e802ff587 100644 --- a/Master/texmf-dist/tex/context/base/colo-ini.lua +++ b/Master/texmf-dist/tex/context/base/colo-ini.lua @@ -6,25 +6,31 @@ if not modules then modules = { } end modules ['colo-ini'] = { license = "see context related readme files" } -local type = type +local type, tonumber = type, tonumber local concat = table.concat local format, gmatch, gsub, lower, match, find = string.format, string.gmatch, string.gsub, string.lower, string.match, string.find -local texsprint = tex.sprint -local ctxcatcodes = tex.ctxcatcodes +local P, R, C, Cc = lpeg.P, lpeg.R, lpeg.C, lpeg.Cc +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns local trace_define = false trackers.register("colors.define",function(v) trace_define = v end) -local settings_to_hash_strict = aux.settings_to_hash_strict +local report_colors = logs.reporter("colors","defining") -colors = colors or { } -transparencies = transparencies or { } +local attributes, context, commands = attributes, context, commands -local registrations = backends.registrations +local settings_to_hash_strict = utilities.parsers.settings_to_hash_strict -local a_color = attributes.private('color') -local a_transparency = attributes.private('transparency') -local a_colorspace = attributes.private('colormodel') -local a_background = attributes.private('background') +local colors = attributes.colors +local transparencies = attributes.transparencies +local colorintents = attributes.colorintents +local registrations = backends.registrations +local settexattribute = tex.setattribute +local gettexattribute = tex.getattribute + +local a_color = attributes.private('color') +local a_transparency = attributes.private('transparency') +local a_colorspace = attributes.private('colormodel') +local a_background = attributes.private('background') local register_color = colors.register local attributes_list = attributes.list @@ -33,12 +39,12 @@ local function definecolor(name, ca, global) if ca and ca > 0 then if global then if trace_define then - commands.writestatus("color","define global color '%s' with attribute: %s",name,ca) + report_colors("define global color '%s' with attribute: %s",name,ca) end context.colordefagc(name,ca) else if trace_define then - commands.writestatus("color","define local color '%s' with attribute: %s",name,ca) + report_colors("define local color '%s' with attribute: %s",name,ca) end context.colordefalc(name,ca) end @@ -55,12 +61,12 @@ local function inheritcolor(name, ca, global) if ca and ca ~= "" then if global then if trace_define then - commands.writestatus("color","inherit global color '%s' with attribute: %s",name,ca) + report_colors("inherit global color '%s' with attribute: %s",name,ca) end - context.colordeffgc(name,ca) + context.colordeffgc(name,ca) -- some day we will set the macro directly else if trace_define then - commands.writestatus("color","inherit local color '%s' with attribute: %s",name,ca) + report_colors("inherit local color '%s' with attribute: %s",name,ca) end context.colordefflc(name,ca) end @@ -77,12 +83,12 @@ local function definetransparent(name, ta, global) if ta and ta > 0 then if global then if trace_define then - commands.writestatus("color","define global transparency '%s' with attribute: %s",name,ta) + report_colors("define global transparency '%s' with attribute: %s",name,ta) end context.colordefagt(name,ta) else if trace_define then - commands.writestatus("color","define local transparency '%s' with attribute: %s",name,ta) + report_colors("define local transparency '%s' with attribute: %s",name,ta) end context.colordefalt(name,ta) end @@ -99,12 +105,12 @@ local function inherittransparent(name, ta, global) if ta and ta ~= "" then if global then if trace_define then - commands.writestatus("color","inherit global transparency '%s' with attribute: %s",name,ta) + report_colors("inherit global transparency '%s' with attribute: %s",name,ta) end context.colordeffgt(name,ta) else if trace_define then - commands.writestatus("color","inherit local transparency '%s' with attribute: %s",name,ta) + report_colors("inherit local transparency '%s' with attribute: %s",name,ta) end context.colordefflt(name,ta) end @@ -133,6 +139,60 @@ local transparent = { exclusion = 12, } +-- backend driven limitations + +colors.supported = true -- always true +transparencies.supported = true + +local gray_okay, rgb_okay, cmyk_okay, spot_okay, multichannel_okay, forced = true, true, true, true, true, false + +function colors.forcesupport(gray,rgb,cmyk,spot,multichannel) -- pdfx driven + gray_okay, rgb_okay, cmyk_okay, spot_okay, multichannel_okay, forced = gray, rgb, cmyk, spot, multichannel, true + report_colors("supported models: gray=%s, rgb=%s, cmyk=%s, spot=%s", -- multichannel=%s + tostring(gray), tostring(rgb), tostring(cmyk), tostring(spot)) -- tostring(multichannel) +end + +local function forcedmodel(model) -- delayed till the backend but mp directly + if not forced then + return model + elseif model == 2 then -- gray + if gray_okay then + -- okay + elseif cmyk_okay then + return 4 + elseif rgb_okay then + return 3 + end + elseif model == 3 then -- rgb + if rgb_okay then + -- okay + elseif cmyk_okay then + return 4 + elseif gray_okay then + return 2 + end + elseif model == 4 then -- cmyk + if cmyk_okay then + -- okay + elseif rgb_okay then + return 3 + elseif gray_okay then + return 2 + end + elseif model == 5 then -- spot + if cmyk_okay then + return 4 + elseif rgb_okay then + return 3 + elseif gray_okay then + return 2 + end + end + return model +end + +colors.forcedmodel = forcedmodel + -- By coupling we are downward compatible. When we decouple we need to do more tricky -- housekeeping (e.g. persist color independent transparencies when color bound ones -- are nil.) @@ -146,41 +206,43 @@ end local registered = { } local function do_registerspotcolor(parent,name,parentnumber,e,f,d,p) - if not registered[parentnumber] then + if not registered[parent] then +--~ print("!!!1",parent) local v = colors.values[parentnumber] if v then - local kind = colors.default -- else problems with shading etc - if kind == 1 then kind = v[1] end + local model = colors.default -- else problems with shading etc + if model == 1 then model = v[1] end if e and e ~= "" then registrations.spotcolorname(parent,e) -- before registration of the color end - if kind == 2 then -- name noffractions names p's r g b + if model == 2 then -- name noffractions names p's r g b registrations.grayspotcolor(parent,f,d,p,v[2]) - elseif kind == 3 then + elseif model == 3 then registrations.rgbspotcolor (parent,f,d,p,v[3],v[4],v[5]) - elseif kind == 4 then + elseif model == 4 then registrations.cmykspotcolor(parent,f,d,p,v[6],v[7],v[8],v[9]) end end - registered[parentnumber] = true + registered[parent] = true end end local function do_registermultitonecolor(parent,name,parentnumber,e,f,d,p) -- same as spot but different template - if not registered[parentnumber] then + if not registered[parent] then +--~ print("!!!2",parent) local v = colors.values[parentnumber] if v then - local kind = colors.default -- else problems with shading etc - if kind == 1 then kind = v[1] end - if kind == 2 then + local model = colors.default -- else problems with shading etc + if model == 1 then model = v[1] end + if model == 2 then registrations.grayindexcolor(parent,f,d,p,v[2]) - elseif kind == 3 then + elseif model == 3 then registrations.rgbindexcolor (parent,f,d,p,v[3],v[4],v[5]) - elseif kind == 4 then + elseif model == 4 then registrations.cmykindexcolor(parent,f,d,p,v[6],v[7],v[8],v[9]) end end - registered[parentnumber] = true + registered[parent] = true end end @@ -188,16 +250,53 @@ function colors.definesimplegray(name,s) return register_color(name,'gray',s) -- we still need to get rid of 'color' end +local hexdigit = R("09","AF","af") +local hexnumber = hexdigit * hexdigit / function(s) return tonumber(s,16)/255 end + Cc(0) +local hexpattern = hexnumber^-3 * P(-1) +local hexcolor = Cc("H") * P("#") * hexpattern + +local left = P("(") +local right = P(")") +local comma = P(",") +local mixnumber = lpegpatterns.number / tonumber +local mixname = C(P(1-left-right-comma)^1) +local mixcolor = Cc("M") * mixnumber * left * mixname * (comma * mixname)^-1 * right * P(-1) + +local exclamation = P("!") +local pgfnumber = lpegpatterns.digit^0 / function(s) return tonumber(s)/100 end +local pgfname = C(P(1-exclamation)^1) +local pgfcolor = Cc("P") * pgfname * exclamation * pgfnumber * (exclamation * pgfname)^-1 * P(-1) + +local specialcolor = hexcolor + mixcolor + +local l_color = attributes.list[a_color] +local l_transparency = attributes.list[a_transparency] + +directives.register("colors.pgf",function(v) + if v then + specialcolor = hexcolor + mixcolor + pgfcolor + else + specialcolor = hexcolor + mixcolor + end +end) + function colors.defineprocesscolor(name,str,global,freeze) -- still inconsistent color vs transparent - local x = match(str,"^#(.+)$") -- for old times sake (if we need to feed from xml or so) - if x then - local r, g, b = match(x .. "000000","(..)(..)(..)") -- watch the 255 - definecolor(name, register_color(name,'rgb',(tonumber(r,16) or 0)/255,(tonumber(g,16) or 0)/255,(tonumber(b,16) or 0)/255), global) + local what, one, two, three = lpegmatch(specialcolor,str) + if what == "H" then + -- for old times sake (if we need to feed from xml or so) + definecolor(name, register_color(name,'rgb',one,two,three),global) + elseif what == "M" then + -- intermediate + return colors.defineintermediatecolor(name,one,l_color[two],l_color[three],l_transparency[two],l_transparency[three],"",global,freeze) + elseif what == "P" then + -- pgf for tikz + return colors.defineintermediatecolor(name,two,l_color[one],l_color[three],l_transparency[one],l_transparency[three],"",global,freeze) else local settings = settings_to_hash_strict(str) if settings then local r, g, b = settings.r, settings.g, settings.b if r or g or b then + -- we can consider a combined rgb cmyk s definition definecolor(name, register_color(name,'rgb', tonumber(r) or 0, tonumber(g) or 0, tonumber(b) or 0), global) else local c, m, y, k = settings.c, settings.m, settings.y, settings.k @@ -211,8 +310,8 @@ function colors.defineprocesscolor(name,str,global,freeze) -- still inconsistent else local x = settings.x or h if x then - r, g, b = match(x .. "000000","(..)(..)(..)") -- watch the 255 - definecolor(name, register_color(name,'rgb',(tonumber(r,16) or 0)/255,(tonumber(g,16) or 0)/255,(tonumber(b,16) or 0)/255), global) + r, g, b = lpegmatch(hexpattern,x) -- can be inlined + definecolor(name, register_color(name,'rgb',r,g,b), global) else definecolor(name, register_color(name,'gray',tonumber(s) or 0), global) end @@ -289,24 +388,36 @@ function colors.registerspotcolor(parent, str) end function colors.definemultitonecolor(name,multispec,colorspec,selfspec) - local dd, pp, nn = { }, { }, { } - for k,v in gmatch(multispec,"(%a+)=([^%,]*)") do - dd[#dd+1] = k - pp[#pp+1] = v - nn[#nn+1] = k - nn[#nn+1] = format("%1.3g",tonumber(v) or 0) -- 0 can't happen + local dd, pp, nn, max = { }, { }, { }, 0 + for k,v in gmatch(multispec,"(%a+)=([^%,]*)") do -- use settings_to_array + max = max + 1 + dd[max] = k + pp[max] = v + nn[max] = format("%s_%1.3g",k,tonumber(v) or 0) -- 0 can't happen end ---~ v = tonumber(v) * p - local nof = #dd - if nof > 0 then - dd, pp, nn = concat(dd,','), concat(pp,','), concat(nn,'_') + if max > 0 then + nn = concat(nn,'_') local parent = gsub(lower(nn),"[^%d%a%.]+","_") - colors.defineprocesscolor(parent,colorspec..","..selfspec,true,true) +--~ if max == 2 and (not colorspec or colorspec == "") then +--~ colors.defineduocolor(parent,pp[1],l_color[dd[1]],pp[2],l_color[dd[2]],true,true) +--~ elseif (not colorspec or colorspec == "") then + if not colorspec or colorspec == "" then + local cc = { } for i=1,max do cc[i] = l_color[dd[i]] end + colors.definemixcolor(parent,pp,cc,global,freeze) -- can become local + else + if selfspec ~= "" then + colorspec = colorspec .. "," .. selfspec + end + colors.defineprocesscolor(parent,colorspec,true,true) + end local cp = attributes_list[a_color][parent] + dd, pp = concat(dd,','), concat(pp,',') +--~ print(name,multispec,colorspec,selfspec) +--~ print(parent,max,cp) if cp then - do_registerspotcolor(parent, name, cp, "", nof, dd, pp) - do_registermultitonecolor(parent, name, cp, "", nof, dd, pp) - definecolor(name, register_color(name, 'spot', parent, nof, dd, pp), true) + do_registerspotcolor(parent, name, cp, "", max, dd, pp) +--~ do_registermultitonecolor(parent, name, cp, "", max, dd, pp) -- done in previous ... check it + definecolor(name, register_color(name, 'spot', parent, max, dd, pp), true) local t = settings_to_hash_strict(selfspec) if t and t.a and t.t then definetransparent(name, transparencies.register(name,transparent[t.a] or tonumber(t.a) or 1,tonumber(t.t) or 1), global) @@ -318,13 +429,14 @@ function colors.definemultitonecolor(name,multispec,colorspec,selfspec) end end -function colors.mp(model,ca,ta,default) - local cv = colors.value(ca) -- faster when direct colors.values[ca] +function colors.mpcolor(model,ca,ta,default) -- will move to mlib-col + local cv = colors.supported and colors.value(ca) -- faster when direct colors.values[ca] if cv then - local tv = transparencies.value(ta) + local tv = transparencies.supported and transparencies.value(ta) if model == 1 then model = cv[1] end + model = forcedmodel(model) if tv then if model == 2 then return format("transparent(%s,%s,(%s,%s,%s))",tv[1],tv[2],cv[3],cv[4],cv[5]) @@ -355,7 +467,7 @@ end function colors.formatcolor(ca,separator) local cv = colors.value(ca) if cv then - local c, f, t, model = { }, 13, 13, cv[1] + local c, cn, f, t, model = { }, 0, 13, 13, cv[1] if model == 2 then f, t = 2, 2 elseif model == 3 then @@ -364,7 +476,8 @@ function colors.formatcolor(ca,separator) f, t = 6, 9 end for i=f,t do - c[#c+1] = format("%0.3f",cv[i]) + cn = cn + 1 + c[cn] = format("%0.3f",cv[i]) end return concat(c,separator) else @@ -451,20 +564,45 @@ end function colors.defineintermediatecolor(name,fraction,c_one,c_two,a_one,a_two,specs,global,freeze) fraction = tonumber(fraction) or 1 local one, two = colors.value(c_one), colors.value(c_two) - if one and two then - local csone, cstwo = one[1], two[1] - if csone == cstwo then - -- actually we can set all 8 values at once here but this is cleaner as we avoid - -- problems with weighted gray conversions and work with original values + if one then + if two then + local csone, cstwo = one[1], two[1] + -- if csone == cstwo then + -- actually we can set all 8 values at once here but this is cleaner as we avoid + -- problems with weighted gray conversions and work with original values + local ca + if csone == 2 then + ca = register_color(name,'gray',f(one,two,2,fraction)) + elseif csone == 3 then + ca = register_color(name,'rgb', f(one,two,3,fraction), + f(one,two,4,fraction), + f(one,two,5,fraction)) + elseif csone == 4 then + ca = register_color(name,'cmyk',f(one,two,6,fraction), + f(one,two,7,fraction), + f(one,two,8,fraction), + f(one,two,9,fraction)) + else + ca = register_color(name,'gray',f(one,two,2,fraction)) + end + definecolor(name,ca,global,freeze) + -- end + else + local csone = one[1] local ca if csone == 2 then - ca = register_color(name,'gray',f(one,two,2,fraction)) + ca = register_color(name,'gray',fraction*one[2]) elseif csone == 3 then - ca = register_color(name,'rgb',f(one,two,3,fraction),f(one,two,4,fraction),f(one,two,5,fraction)) + ca = register_color(name,'rgb', fraction*one[3], + fraction*one[4], + fraction*one[5]) elseif csone == 4 then - ca = register_color(name,'cmyk',f(one,two,6,fraction),f(one,two,7,fraction),f(one,two,8,fraction),f(one,two,9,fraction)) + ca = register_color(name,'cmyk',fraction*one[6], + fraction*one[7], + fraction*one[8], + fraction*one[9]) else - ca = register_color(name,'gray',f(one,two,2,fraction)) + ca = register_color(name,'gray',fraction*one[2]) end definecolor(name,ca,global,freeze) end @@ -474,7 +612,137 @@ function colors.defineintermediatecolor(name,fraction,c_one,c_two,a_one,a_two,sp local ta = tonumber((t and t.a) or (one and one[1]) or (two and two[1])) local tt = tonumber((t and t.t) or (one and two and f(one,two,2,fraction))) if ta and tt then ---~ print(ta,tt) definetransparent(name,transparencies.register(name,ta,tt),global) end end + +--~ local function f(one,two,i,fraction_one,fraction_two) +--~ local otf = fraction_one * one[i] + fraction_two * two[i] +--~ if otf > 1 then +--~ otf = 1 +--~ end +--~ return otf +--~ end + +--~ function colors.defineduocolor(name,fraction_one,c_one,fraction_two,c_two,global,freeze) +--~ local one, two = colors.value(c_one), colors.value(c_two) +--~ if one and two then +--~ fraction_one = tonumber(fraction_one) or 1 +--~ fraction_two = tonumber(fraction_two) or 1 +--~ local csone, cstwo = one[1], two[1] +--~ local ca +--~ if csone == 2 then +--~ ca = register_color(name,'gray',f(one,two,2,fraction_one,fraction_two)) +--~ elseif csone == 3 then +--~ ca = register_color(name,'rgb', f(one,two,3,fraction_one,fraction_two), +--~ f(one,two,4,fraction_one,fraction_two), +--~ f(one,two,5,fraction_one,fraction_two)) +--~ elseif csone == 4 then +--~ ca = register_color(name,'cmyk',f(one,two,6,fraction_one,fraction_two), +--~ f(one,two,7,fraction_one,fraction_two), +--~ f(one,two,8,fraction_one,fraction_two), +--~ f(one,two,9,fraction_one,fraction_two)) +--~ else +--~ ca = register_color(name,'gray',f(one,two,2,fraction_one,fraction_two)) +--~ end +--~ definecolor(name,ca,global,freeze) +--~ end +--~ end + + local function f(i,colors,fraction) + local otf = 0 + for c=1,#colors do + otf = otf + (tonumber(fraction[c]) or 1) * colors[c][i] + end + if otf > 1 then + otf = 1 + end + return otf + end + + function colors.definemixcolor(name,fractions,cs,global,freeze) + local values = { } + for i=1,#cs do -- do fraction in here + local v = colors.value(cs[i]) + if not v then + return + end + values[i] = v + end + local csone = values[1][1] + local ca + if csone == 2 then + ca = register_color(name,'gray',f(2,values,fractions)) + elseif csone == 3 then + ca = register_color(name,'rgb', f(3,values,fractions), + f(4,values,fractions), + f(5,values,fractions)) + elseif csone == 4 then + ca = register_color(name,'cmyk',f(6,values,fractions), + f(7,values,fractions), + f(8,values,fractions), + f(9,values,fractions)) + else + ca = register_color(name,'gray',f(2,values,fractions)) + end + definecolor(name,ca,global,freeze) + end + +-- for the moment downward compatible + +local patterns = { "colo-imp-%s.mkiv", "colo-imp-%s.tex", "colo-%s.mkiv", "colo-%s.tex" } + +function colors.usecolors(name) + commands.uselibrary(name,patterns,function(name,foundname) + context.startreadingfile() + context.input(foundname) + context.showcolormessage("colors",4,name) + context.stopreadingfile() + end, function(name) + context.showcolormessage("colors",5,name) + end) +end + +-- interface + +local setcolormodel = colors.setmodel + +function commands.setcolormodel(model,weight) + settexattribute(a_colorspace,setcolormodel(model,weight)) +end + +function commands.setrastercolor(name,s) + settexattribute(a_color,colors.definesimplegray(name,s)) +end + +function commands.registermaintextcolor(a) + colors.main = a +end + +commands.defineprocesscolor = colors.defineprocesscolor +commands.definespotcolor = colors.definespotcolor +commands.definemultitonecolor = colors.definemultitonecolor +commands.definetransparency = colors.definetransparency +commands.defineintermediatecolor = colors.defineintermediatecolor + +function commands.spotcolorname (a) context(colors.spotcolorname (a)) end +function commands.spotcolorparent (a) context(colors.spotcolorparent (a)) end +function commands.spotcolorvalue (a) context(colors.spotcolorvalue (a)) end +function commands.colorcomponents (a) context(colors.colorcomponents (a)) end +function commands.transparencycomponents(a) context(colors.transparencycomponents(a)) end +function commands.formatcolor (...) context(colors.formatcolor (...)) end +function commands.formatgray (...) context(colors.formatgray (...)) end + +function commands.mpcolor(model,ca,ta,default) + context(colors.mpcolor(model,ca,ta,default)) +end + +function commands.doifblackelse(a) + commands.doifelse(colors.isblack(a)) +end + +function commands.doifdrawingblackelse() + commands.doifelse(colors.isblack(gettexattribute(a_color))) +end + +commands.usecolors = colors.usecolors diff --git a/Master/texmf-dist/tex/context/base/colo-ini.mkii b/Master/texmf-dist/tex/context/base/colo-ini.mkii index 2d2a7bdaa13..484a085fe2b 100644 --- a/Master/texmf-dist/tex/context/base/colo-ini.mkii +++ b/Master/texmf-dist/tex/context/base/colo-ini.mkii @@ -271,9 +271,11 @@ \def\dodosetupcolor#1% {\makeshortfilename[\truefilename{\f!colorprefix#1}]% \startreadingfile - \readsysfile\shortfilename + \readsysfile{\shortfilename.\mksuffix} {\showmessage\m!colors4\colorstyle} - {\showmessage\m!colors5\colorstyle}% + {\readsysfile{\shortfilename.tex} + {\showmessage\m!colors4\colorstyle} + {\showmessage\m!colors5\colorstyle}}% \stopreadingfile} \let\usecolors\setupcolor diff --git a/Master/texmf-dist/tex/context/base/colo-ini.mkiv b/Master/texmf-dist/tex/context/base/colo-ini.mkiv index 1bceb5aa70a..45fe1463383 100644 --- a/Master/texmf-dist/tex/context/base/colo-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/colo-ini.mkiv @@ -20,10 +20,14 @@ %D different approach, this module only implements a few generic mechanisms. \registerctxluafile{colo-ini}{1.000} -\registerctxluafile{lpdf-col}{1.000} +\registerctxluafile{colo-icc}{1.000} \unprotect +%D In \MKIV\ we have independent color, colorspace and transparency +%D but I'm still not sure if I keep it that way as it's probably more +%D efficient to combine them (less attributes and finalizing). +%D %D We use a couple of local registers. That way we don't have %D to group when converting colors. By the way, this is not %D really faster. We can sqeeze half a second runtime for 50K @@ -140,24 +144,33 @@ %D \showsetup{color} %D \showsetup{graycolor} - \def\switchtocolor [#1]{\getvalue{#1}} +\unexpanded\def\switchtocolor [#1]{\csname#1\endcsname} \unexpanded\def\color [#1]{\groupedcommand{\doactivatecolor{#1}}{}} \unexpanded\def\startcolor [#1]{\begingroup\doactivatecolor{#1}} \unexpanded\def\stopcolor {\endgroup} \unexpanded\def\graycolor [#1]{\groupedcommand{\dosetcolormodel{gray}\getvalue{#1}}{}} \unexpanded\def\colored [#1]{\groupedcommand{\definecolor[@colored@][#1]\doactivatecolor{@colored@}}{}} \unexpanded\def\fastcolored [#1]#2{\begingroup\dodefinefastcolor[@colored@][#1]\doactivatecolor{@colored@}#2\endgroup} - \def\predefinecolor [#1]{\flushatshipout{\hbox{\color[#1]{}}}} - \def\predefineindexcolor[#1]{\flushatshipout{\hbox{\color[#1]{}}}} - \unexpanded\def\startcolorpage {\startcolor[\ifx\maintextcolor\empty\defaulttextcolor\else\maintextcolor\fi]} - \unexpanded\def\stopcolorpage {\stopcolor} - \unexpanded\def\startraster [#1]{\dosetrastercolor{#1}} - \unexpanded\def\stopraster {} - \def\raster [#1]{\groupedcommand{\dosetrastercolor{#1}}{}} - \def\faststartcolor [#1]{\doactivatecolor{#1}} - \def\faststopcolor {} +\unexpanded\def\predefinecolor [#1]{\flushatshipout{\hbox{\color[#1]{}}}} +\unexpanded\def\predefineindexcolor[#1]{\flushatshipout{\hbox{\color[#1]{}}}} + +% some of this will go away + +\unexpanded\def\startcolorpage {\startcolor[\ifx\maintextcolor\empty\defaulttextcolor\else\maintextcolor\fi]} +\unexpanded\def\stopcolorpage {\stopcolor} +\unexpanded\def\startraster [#1]{\dosetrastercolor{#1}} +\unexpanded\def\stopraster {} +\unexpanded\def\raster [#1]{\groupedcommand{\dosetrastercolor{#1}}{}} +\unexpanded\def\faststartcolor [#1]{\doactivatecolor{#1}} +\unexpanded\def\faststopcolor {} \unexpanded\def\dosetcolorattribute#1#2{\ifcsname#1#2\endcsname\doactivatecolor{\csname#1#2\endcsname}\fi} +\def\getcolorattributevalue#1#2% color macro (obsolete again, we have a better method) + {\begingroup + \doactivatecolor{#1}% + \normalexpanded{\endgroup\edef\noexpand#2% + {\ifnum\attribute\colorattribute=\attributeunsetvalue\else\number\attribute\colorattribute\fi}}} + \let\grey\graycolor %D Stacking: @@ -197,36 +210,18 @@ %D where \type{\f!colorprefix} is \unprotect {\tttf \f!colorprefix}. %D Loading such a file is done by \protect %D -%D \showsetup{setupcolor} +%D \showsetup{usecolors} %D %D Some default colors are specified in \type{colo-rgb.tex}, %D which is loaded into the format by: %D %D \starttyping -%D \setupcolor[rgb] +%D \usecolors[rgb] %D \stoptyping -\let\colorstyle\empty - -\unexpanded\def\setupcolor - {\dosingleargument\dosetupcolor} - -\def\dosetupcolor[#1]% - {\doifnot{#1}\colorstyle - {\def\colorstyle{#1}% - \processcommalist[#1]\dodosetupcolor}} - -\def\dodosetupcolor#1% - {\makeshortfilename[\truefilename{\f!colorprefix#1}]% - \startreadingfile - \readsysfile\shortfilename - {\showcolormessage\m!colors4\colorstyle} - {\showcolormessage\m!colors5\colorstyle}% - \stopreadingfile} +\unexpanded\def\usecolors[#1]{\ctxcommand{usecolors(\!!bs#1\!!es)}} -\let\usecolors\setupcolor - -% check: \startcolormode +\let\setupcolor\usecolors %D \macros %D {definetransparency} @@ -243,6 +238,9 @@ \newtoks\everysetupcolors +\let\dosetcolorvalue \setvalue +\def\colorfreezestate{false} + \def\dosetupcolors[#1]% some no longer make sense in MkIV {\getparameters[\??cl][#1]% \doifelse\@@clspot\v!yes @@ -254,6 +252,13 @@ \doifelse\@@clexpansion\v!yes \freezecolorstrue \freezecolorsfalse + \iffreezecolors + \let\dosetcolorvalue\setevalue + \def\colorfreezestate{true}% + \else + \let\dosetcolorvalue\setvalue + \def\colorfreezestate{false}% + \fi \doifelse\@@clfactor\v!no \weightGRAYfalse \weightGRAYtrue @@ -296,7 +301,7 @@ \fi\fi \doifelse\@@clstate\v!stop {\incolorfalse\forcegrayMPcolorstrue}% - {\ifincolor\else\showcolormessage\m!colors1\colorstyle\fi\incolortrue\let\@@clstate\v!start}% + {\incolortrue\let\@@clstate\v!start}% \dosetupcolormodel \the\everysetupcolors} @@ -371,7 +376,7 @@ \def\dodefinepalet[#1][#2]% {\doifassignmentelse{#2} {%\showcolormessage\m!colors6{#1}% - \letvalue{\??pa#1}\empty + \letvalueempty{\??pa#1}% \setevalue{\??pa\??pa#1}{#2}% \def\dodododefinepalet[##1=##2]% {\doifvaluesomething{\??pa#1} @@ -712,19 +717,15 @@ % draw btex test etex withprescript \mptexcolor{blue} ; % \stopMPpage -\ifx\currentcolormodel\undefined \newcount\currentcolormodel \fi +% \ifx\currentcolormodel\undefined \newcount\currentcolormodel \fi -% \def\setcolormodel#1% -% {\showcolormessage\m!colors1{#1}% -% \dosetcolormodel{#1}} +\def\currentcolormodel{\attribute\colormodelattribute} \def\dosetcolormodel#1% no message - {\currentcolormodel\ctxlua{tex.print(colors.setmodel('#1',\ifweightGRAY true\else false\fi))}% - \attribute\colormodelattribute\currentcolormodel} + {\ctxcommand{setcolormodel('#1',\ifweightGRAY true\else false\fi)}} % sets attribute \dosetcolormodel{all} - \def\dosetupcolormodel {\ifincolor \ifRGBsupported @@ -765,10 +766,10 @@ % Since we couple definitions, we could stick to one test. Todo. Same for mpcolor. -\letvalue{(cs:-}\empty -\letvalue{(ts:-}\empty +\letvalueempty{(cs:-} +\letvalueempty{(ts:-} -\def\doactivatecolor#1% : in currentpalet, maybe not, ugly +\def\doactivatecolor#1% : in currentpalet, maybe not, ugly (some day at the lua end) {\def\currentcolorname{#1}% \ifcsname(cs:\currentpalet#1)\endcsname \csname(cs:\currentpalet#1)\endcsname @@ -782,10 +783,12 @@ % if it becomes a bottleneck we can set up a more complex system with one shared % attribute for colorspace, color and transparency +% +% maybe always on \def\doactivatecolor {\ifproductionrun - \ctxlua{colors.enable() transparencies.enable()}% not that efficient but at least robust + \ctxcommand{enablecolor() commands.enabletransparency()}% not that efficient but at least robust \let\doactivatecolor\normaldoactivatecolor \expandafter\doactivatecolor \else @@ -804,44 +807,45 @@ \setfalse\collectcolorsinlist \def\collectcolorinlist#1{\doglobal\addtocommalist{#1}\colorlist} -\def\doregistercolor#1#2{\ctxlua{colors.defineprocesscolor("#1","#2",false,\iffreezecolors true\else false\fi)}} +\def\doregistercolor#1#2% + {\ctxcommand{defineprocesscolor("#1","#2",false,\colorfreezestate)}} \def\dodefinecolor[#1][#2]% {\ifconditional\collectcolorsinlist\collectcolorinlist{#1}\fi - \ctxlua{colors.defineprocesscolor("#1","#2",false,\iffreezecolors true\else false\fi)}% + \ctxcommand{defineprocesscolor("#1","#2",false,\colorfreezestate)}% \dodefinecolorcommand\setvalue{#1}} \def\dodefineglobalcolor[#1][#2]% {\ifconditional\collectcolorsinlist\collectcolorinlist{#1}\fi - \ctxlua{colors.defineprocesscolor("#1","#2",true,\iffreezecolors true\else false\fi)}% + \ctxcommand{defineprocesscolor("#1","#2",true,\colorfreezestate)}% \dodefinecolorcommand\setgvalue{#1}} \def\dodefinenamedcolor[#1][#2]% {\ifconditional\collectcolorsinlist\collectcolorinlist{#1}\fi - \ctxlua{colors.defineprocesscolor("#1","#2",false,\iffreezecolors true\else false\fi)}% + \ctxcommand{defineprocesscolor("#1","#2",false,\colorfreezestate)}% \dodefinecolorcommand\setvalue{#1}} \def\dodefinespotcolor[#1][#2][#3]% {\ifconditional\collectcolorsinlist\collectcolorinlist{#1}\fi - \ctxlua{colors.definespotcolor("#1","#2","#3",true)}% + \ctxcommand{definespotcolor("#1","#2","#3",true)}% \dodefinecolorcommand\setxvalue{#1}} \def\dodefinemultitonecolor[#1][#2][#3][#4]% - {\ctxlua{colors.definemultitonecolor("#1","#2","#3","#4",true)}% + {\ctxcommand{definemultitonecolor("#1","#2","#3","#4",true)}% \dodefinecolorcommand\setxvalue{#1}} \def\dodefinetransparency[#1][#2]% - {\ctxlua{colors.definetransparency("#1",#2)}} + {\ctxcommand{definetransparency("#1",#2)}} \def\dosetrastercolor#1% slow, we need a fast one {\edef\@@rastervalue{#1}% \ifx\@@rastervalue\empty \let\@@rastervalue\@@rsscreen \fi - \attribute\colorattribute\ctxlua{tex.sprint(colors.definesimplegray("_raster_",\@@rastervalue))}\relax} + \ctxcommand{setrastercolor("_raster_",\@@rastervalue)}} % sets attribute \def\dodefinefastcolor[#1][#2]% still not fast but ok - {\ctxlua{colors.defineprocesscolor("#1","#2",false,\iffreezecolors true\else false\fi)}% + {\ctxcommand{defineprocesscolor("#1","#2",false,\colorfreezestate)}% \dodefinecolorcommand\setvalue{#1}} %D \macros @@ -875,7 +879,7 @@ %D A bit like \type {\definedfont}: \unexpanded\def\colored[#1]% - {\ctxlua{colors.defineprocesscolor("@colored@","#1",false,false)}% + {\ctxcommand{defineprocesscolor("@colored@","#1",false,false)}% \groupedcommand{\doactivatecolor{@colored@}}{}} %D \macros @@ -915,7 +919,8 @@ \ifx\maintextcolor\empty\else\doactivatecolor\maintextcolor\fi \to \everybeforeoutput -\def\registermaintextcolor{\ctxlua{colors.main = \thecolorattribute\maintextcolor}} +\def\registermaintextcolor + {\ctxcommand{registermaintextcolor(\thecolorattribute\maintextcolor)}} \unexpanded\def\starttextcolor[#1]% {\doifsomething{#1} @@ -937,18 +942,34 @@ \appendtoks \initializemaintextcolor \to \everyjob \appendtoks \initializemaintextcolor \to \everysetupcolors +\def\doinheritdirectcs#1{\csname(cs:\ifcsname(cs:#1)\endcsname#1\fi)\endcsname} +\def\doinheritdirectca#1{\csname(ca:\ifcsname(ca:#1)\endcsname#1\fi)\endcsname} +\def\doinheritdirectts#1{\csname(ts:\ifcsname(ts:#1)\endcsname#1\fi)\endcsname} +\def\doinheritdirectta#1{\csname(ta:\ifcsname(ta:#1)\endcsname#1\fi)\endcsname} + +\def\doinheritpaletca#1#2{\csname(ca:\ifcsname(ca:\??pa#1:#2)\endcsname\??pa#1:#2\fi)\endcsname} +\def\doinheritpaletcs#1#2{\csname(cs:\ifcsname(cs:\??pa#1:#2)\endcsname\??pa#1:#2\fi)\endcsname} +\def\doinheritpaletta#1#2{\csname(ta:\ifcsname(ta:\??pa#1:#2)\endcsname\??pa#1:#2\fi)\endcsname} +\def\doinheritpaletts#1#2{\csname(ts:\ifcsname(ts:\??pa#1:#2)\endcsname\??pa#1:#2\fi)\endcsname} + \def\dodefinepaletcolor#1#2#3% {\doifassignmentelse{#3}% \definepalet[test][xx={y=.4}] {\definecolor[\??pa#1:#2][#3]% - \iffreezecolors\@EA\setevalue\else\@EA\setvalue\fi{(cs:#1:#2)}{\csname(cs:\??pa#1:#2)\endcsname}% - \iffreezecolors\@EA\setevalue\else\@EA\setvalue\fi{(ca:#1:#2)}{\csname(ca:\??pa#1:#2)\endcsname}} + \dosetcolorvalue{(cs:#1:#2)}{\doinheritpaletca{#1}{#2}}% + \dosetcolorvalue{(ca:#1:#2)}{\doinheritpaletcs{#1}{#2}}% + \dosetcolorvalue{(ts:#1:#2)}{\doinheritpaletta{#1}{#2}}% + \dosetcolorvalue{(ta:#1:#2)}{\doinheritpaletts{#1}{#2}}} {\ifcsname(cs:#3)\endcsname % \definepalet[test][xx=green] - \iffreezecolors\@EA\setevalue\else\@EA\setvalue\fi{(cs:#1:#2)}{\csname(cs:#3)\endcsname}% - \iffreezecolors\@EA\setevalue\else\@EA\setvalue\fi{(ca:#1:#2)}{\csname(ca:#3)\endcsname}% + \dosetcolorvalue{(cs:#1:#2)}{\doinheritdirectcs{#3}}% + \dosetcolorvalue{(ca:#1:#2)}{\doinheritdirectca{#3}}% + \dosetcolorvalue{(ts:#1:#2)}{\doinheritdirectts{#3}}% + \dosetcolorvalue{(ta:#1:#2)}{\doinheritdirectta{#3}}% \else % not entered when making format \localundefine{(cs:#1:#2)}% \letvalue{(cs:#1:#2)}\undefined \localundefine{(ca:#1:#2)}% \letvalue{(ca:#1:#2)}\undefined + \localundefine{(ts:#1:#2)}% \letvalue{(cs:#1:#2)}\undefined + \localundefine{(ta:#1:#2)}% \letvalue{(ca:#1:#2)}\undefined \fi}} \setvalue{(cs:)}{} \setvalue{(ca:)}{0} @@ -962,7 +983,7 @@ %D Low level defs: \def\colordefalc#1#2{\setevalue{(ca:#1)}{#2}\setvalue {(cs:#1)}{\attribute\colorattribute #2 }} -\def\colordefagc#1#2{\setxvalue{(ca:#1)}{#2}\setvalue {(cs:#1)}{\attribute\colorattribute #2 }} +\def\colordefagc#1#2{\setxvalue{(ca:#1)}{#2}\setgvalue{(cs:#1)}{\attribute\colorattribute #2 }} % was not g \def\colordefalt#1#2{\setevalue{(ta:#1)}{#2}\setvalue {(ts:#1)}{\attribute\transparencyattribute#2 }} \def\colordefagt#1#2{\setxvalue{(ta:#1)}{#2}\setgvalue{(ts:#1)}{\attribute\transparencyattribute#2 }} @@ -995,28 +1016,28 @@ %D \getbuffer %D \stopvoorbeeld -\def\colorformatseparator{ } - -\def\MPcolor#1{\ctxlua{tex.sprint(colors.mp(\number\currentcolormodel,\number\doinheritca{#1},\number\doinheritta{#1}))}} - \let\currentcolorname\s!black % todo \let\outercolorname \s!black % todo +\let\colorformatseparator\space + +\def\MPcolor #1{\ctxcommand{mpcolor(\number\currentcolormodel,\number\doinheritca{#1},\number\doinheritta{#1})}} + \def\thecolorattribute #1{\number\csname(ca:\ifcsname(ca:\currentpalet#1)\endcsname\currentpalet#1\else\ifcsname(ca:#1)\endcsname#1\fi\fi)\endcsname} \def\thetransparencyattribute#1{\number\csname(ta:\ifcsname(ta:\currentpalet#1)\endcsname\currentpalet#1\else\ifcsname(ta:#1)\endcsname#1\fi\fi)\endcsname} -\def\internalspotcolorname #1{\ctxlua{tex.sprint(colors.spotcolorname (\thecolorattribute{#1}))}} -\def\internalspotcolorparent#1{\ctxlua{tex.sprint(colors.spotcolorparent(\thecolorattribute{#1}))}} -\def\internalspotcolorsize #1{\ctxlua{tex.sprint(colors.spotcolorvalue (\thecolorattribute{#1}))}} +\def\internalspotcolorname #1{\ctxcommand{spotcolorname(\thecolorattribute{#1})}} +\def\internalspotcolorparent #1{\ctxcommand{spotcolorparent(\thecolorattribute{#1})}} +\def\internalspotcolorsize #1{\ctxcommand{spotcolorvalue(\thecolorattribute{#1})}} -\def\colorcomponents #1{\ctxlua{tex.sprint(colors.colorcomponents (\thecolorattribute {#1}))}} -\def\transparencycomponents#1{\ctxlua{tex.sprint(colors.transparencycomponents(\thetransparencyattribute{#1}))}} +\def\colorcomponents #1{\ctxcommand{colorcomponents(\thecolorattribute{#1})}} +\def\transparencycomponents #1{\ctxcommand{transparencycomponents(\thetransparencyattribute{#1})}} -\def\colorvalue#1{\ctxlua{tex.sprint(colors.formatcolor(\thecolorattribute{#1},"\colorformatseparator"))}} -\def\grayvalue #1{\ctxlua{tex.sprint(colors.formatgray (\thecolorattribute{#1},"\colorformatseparator"))}} +\def\colorvalue #1{\ctxcommand{formatcolor(\thecolorattribute{#1},"\colorformatseparator")}} +\def\grayvalue #1{\ctxcommand{formatgray (\thecolorattribute{#1},"\colorformatseparator")}} -\def\doifblackelse #1{\ctxlua{commands.doifelse(colors.isblack(\thecolorattribute{#1}))}} -\def\doifdrawingblackelse {\ctxlua{commands.doifelse(colors.isblack(tex.attribute[attributes.numbers['color']]))}} +\def\doifblackelse #1{\ctxcommand{doifblackelse(\thecolorattribute{#1})}} +\def\doifdrawingblackelse {\ctxcommand{doifdrawingblackelse()}} %D \macros %D {forcecolorhack} diff --git a/Master/texmf-dist/tex/context/base/colo-rgb.mkii b/Master/texmf-dist/tex/context/base/colo-rgb.mkii new file mode 100644 index 00000000000..038e0ab0bf1 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/colo-rgb.mkii @@ -0,0 +1,530 @@ +%D \module +%D [ file=colo-rgb, +%D version=1995.01.01, +%D title=\CONTEXT\ Color Macros, +%D subtitle=RGB, +%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 Just to give users a start we define some colors. While +%D switching fonts is as international as can be, thanks to the +%D mnemonics, naming colors is very interface dependant. To +%D support international setups, we define both english and +%D interface dependant colors. We use the color inheritance +%D mechanisms to implement the interface dependant ones. + +%D First we define some simple primary \cap{RGB} and \cap{CMYK} +%D colors. All colors are defined in \cap{RGB} color space. + +\definecolor [red] [r=1, g=0, b=0] +\definecolor [green] [r=0, g=1, b=0] +\definecolor [blue] [r=0, g=0, b=1] + +\definecolor [cyan] [r=0, g=1, b=1] +\definecolor [magenta] [r=1, g=0, b=1] +\definecolor [yellow] [r=1, g=1, b=0] + +\definecolor [white] [s=1] % [r=1, g=1, b=1] +\definecolor [black] [s=0] +\definecolor [gray] [s=.9] + +\definecolor [darkred] [r=.8, g=0, b=0] +\definecolor [middlered] [r=.9, g=0, b=0] +\definecolor [lightred] [r=1, g=0, b=0] + +\definecolor [darkgreen] [r=0, g=.6, b=0] +\definecolor [middlegreen] [r=0, g=.8, b=0] +\definecolor [lightgreen] [r=0, g=1, b=0] + +\definecolor [darkblue] [r=0, g=0, b=.8] +\definecolor [middleblue] [r=0, g=0, b=.9] +\definecolor [lightblue] [r=0, g=0, b=1] + +\definecolor [darkcyan] [r=.6, g=.8, b=.8] +\definecolor [middlecyan] [r=0, g=.8, b=.8] + +\definecolor [darkmagenta] [r=.8, g=.6, b=.8] +\definecolor [middlemagenta] [r=1, g=0, b=.6] + +\definecolor [darkyellow] [r=.8, g=.8, b=.6] +\definecolor [middleyellow] [r=1, g=1, b=.2] + +\definecolor [darkgray] [s=.5] +\definecolor [middlegray] [s=.7] +\definecolor [lightgray] [s=.9] + +%D These colors are mapped to interface dependant colornames. + +\startinterface dutch + + \definecolor [rood] [red] + \definecolor [groen] [green] + \definecolor [blauw] [blue] + + \definecolor [cyaan] [cyan] + \definecolor [magenta] [magenta] + \definecolor [geel] [yellow] + + \definecolor [wit] [white] + \definecolor [grijs] [gray] + \definecolor [zwart] [black] + + \definecolor [donkerrood] [darkred] + \definecolor [middelrood] [middlered] + \definecolor [lichtrood] [lightred] + + \definecolor [donkergroen] [darkgreen] + \definecolor [middelgroen] [middlegreen] + \definecolor [lichtgroen] [lightgreen] + + \definecolor [donkerblauw] [darkblue] + \definecolor [middelblauw] [middleblue] + \definecolor [lichtblauw] [lightblue] + + \definecolor [donkercyaan] [darkcyan] + \definecolor [middelcyaan] [middlecyan] + + \definecolor [donkermagenta] [darkmagenta] + \definecolor [middelmagenta] [middlemagenta] + + \definecolor [donkergeel] [darkyellow] + \definecolor [middelgeel] [middleyellow] + + \definecolor [donkergrijs] [darkgray] + \definecolor [middengrijs] [middlegray] + \definecolor [lichtgrijs] [lightgray] + +\stopinterface + +\startinterface german + + \definecolor [rot] [red] + \definecolor [gruen] [green] + \definecolor [blau] [blue] + + \definecolor [cyan] [cyan] + \definecolor [magenta] [magenta] + \definecolor [gelb] [yellow] + + \definecolor [weiss] [white] + \definecolor [grau] [gray] + \definecolor [schwarz] [black] + + \definecolor [dunkelrot] [darkred] + \definecolor [mittelrot] [middlered] + \definecolor [hellrot] [lightred] + + \definecolor [dunkelgruen] [darkgreen] + \definecolor [mittelgruen] [middlegreen] + \definecolor [hellgruen] [lightgreen] + + \definecolor [dunkelblau] [darkblue] + \definecolor [mittelblau] [middleblue] + \definecolor [hellblau] [lightblue] + + \definecolor [dunkelcyan] [darkcyan] + \definecolor [mittelcyan] [middlecyan] + + \definecolor [dunkelmagenta] [darkmagenta] + \definecolor [mittelmagenta] [middlemagenta] + + \definecolor [dunkelgelb] [darkyellow] + \definecolor [mittelgelb] [middleyellow] + + \definecolor [dunkelgrau] [darkgray] + \definecolor [mittelgrau] [middlegray] + \definecolor [hellgrau] [lightgray] + +\stopinterface + +\startinterface czech + + \definecolor [cervena] [red] + \definecolor [zelena] [green] + \definecolor [modra] [blue] + + \definecolor [azurova] [cyan] + \definecolor [fialova] [magenta] + \definecolor [zluta] [yellow] + + \definecolor [bila] [white] + \definecolor [cerna] [black] + + \definecolor [tmavecervena] [darkred] + \definecolor [strednecervena] [middlered] + \definecolor [svetlecervena] [lightred] + + \definecolor [tmavezelena] [darkgreen] + \definecolor [strednezelena] [middlegreen] + \definecolor [svetlezelena] [lightgreen] + + \definecolor [tmavemodra] [darkblue] + \definecolor [strednemodra] [middleblue] + \definecolor [svetlemodra] [lightblue] + + \definecolor [tmaveazurova] [darkcyan] + \definecolor [stredneazurova] [middlecyan] + + \definecolor [tmavefialova] [darkmagenta] + \definecolor [strednefialova] [middlemagenta] + + \definecolor [tmavezluta] [darkyellow] + \definecolor [strednezluta] [middleyellow] + + \definecolor [tmaveseda] [darkgray] + \definecolor [stredneseda] [middlegray] + \definecolor [svetleseda] [lightgray] + +\stopinterface + +\startinterface italian + + \definecolor [rosso] [red] + \definecolor [verde] [green] + \definecolor [blu] [blue] + + \definecolor [azzurro] [cyan] + \definecolor [turchino] [cyan] + \definecolor [ciano] [cyan] + \definecolor [cremisi] [magenta] + \definecolor [giallo] [yellow] + + \definecolor [bianco] [white] + \definecolor [grigio] [gray] + \definecolor [nero] [black] + + \definecolor [rossoscuro] [darkred] + \definecolor [rossomedio] [middlered] + \definecolor [rossochiaro] [lightred] + + \definecolor [verdescuro] [darkgreen] + \definecolor [verdemedio] [middlegreen] + \definecolor [verdechiaro] [lightgreen] + + \definecolor [bluscuro] [darkblue] + \definecolor [blumedio] [middleblue] + \definecolor [bluchiaro] [lightblue] + + \definecolor [azzurroscuro] [darkcyan] + \definecolor [azzurrochiaro] [middlecyan] + + \definecolor [cremisiscuro] [darkmagenta] + \definecolor [cremisichiaro] [middlemagenta] + + + \definecolor [gialloscuro] [darkyellow] + \definecolor [giallomedio] [middleyellow] + + \definecolor [grigioscuro] [darkgray] + \definecolor [grigiomedio] [middlegray] + \definecolor [grigiochiaro] [lightgray] + +\stopinterface + +\startinterface romanian + + \definecolor [rosu] [red] + \definecolor [verde] [green] + \definecolor [albastru] [blue] + + \definecolor [cian] [cyan] + \definecolor [magenta] [magenta] + \definecolor [galben] [yellow] + + \definecolor [alb] [white] + \definecolor [gri] [gray] + \definecolor [negru] [black] + + \definecolor [rosuinchis] [darkred] + \definecolor [rosumediu] [middlered] + \definecolor [rosudeschis] [lightred] + + \definecolor [verdeinchis] [darkgreen] + \definecolor [verdemediu] [middlegreen] + \definecolor [verdedeschis] [lightgreen] + + \definecolor [albastruinchis] [darkblue] + \definecolor [albastrumediu] [middleblue] + \definecolor [albastrudeschis] [lightblue] + + \definecolor [cianinchis] [darkcyan] + \definecolor [cianmediu] [middlecyan] + + \definecolor [magentainchis] [darkmagenta] + \definecolor [magentamediu] [middlemagenta] + + \definecolor [galbeninchis] [darkyellow] + \definecolor [galbenmediu] [middleyellow] + + \definecolor [griinchis] [darkgray] + \definecolor [grimediu] [middlegray] + \definecolor [grideschis] [lightgray] + +\stopinterface + +%D Like colors, we first define the english colorgroups. These +%D colorgroups are tuned for distinctive gray scale printing. + +% todo : more efficient and real gray + +\definecolorgroup + [gray] + [0.95:0.95:0.95, + 0.90:0.90:0.90, + 0.80:0.80:0.80, + 0.70:0.70:0.70, + 0.60:0.60:0.60, + 0.50:0.50:0.50, + 0.40:0.40:0.40, + 0.30:0.30:0.30, + 0.20:0.20:0.20, + 0.10:0.10:0.10, + 0.00:0.00:0.00] + +\definecolorgroup + [red] + [1.00:0.90:0.90, + 1.00:0.80:0.80, + 1.00:0.70:0.70, + 1.00:0.55:0.55, + 1.00:0.40:0.40, + 1.00:0.25:0.25, + 1.00:0.15:0.15, + 0.90:0.00:0.00] + +\definecolorgroup + [green] + [0.90:1.00:0.90, + 0.70:1.00:0.70, + 0.50:1.00:0.50, + 0.30:1.00:0.30, + 0.15:0.90:0.15, + 0.00:0.80:0.00, + 0.00:0.65:0.00, + 0.00:0.50:0.00] + +\definecolorgroup + [blue] + [0.90:0.95:1.00, + 0.80:0.90:1.00, + 0.55:0.85:1.00, + 0.30:0.80:1.00, + 0.15:0.75:1.00, + 0.00:0.70:1.00, + 0.00:0.55:1.00, + 0.00:0.40:1.00] + +\definecolorgroup + [cyan] + [0.80:1.00:1.00, + 0.60:1.00:1.00, + 0.30:1.00:1.00, + 0.00:0.95:0.95, + 0.00:0.85:0.85, + 0.00:0.75:0.75, + 0.00:0.60:0.60, + 0.00:0.50:0.50] + +\definecolorgroup + [magenta] + [1.00:0.90:1.00, + 1.00:0.80:1.00, + 1.00:0.65:1.00, + 1.00:0.50:1.00, + 1.00:0.35:1.00, + 1.00:0.15:1.00, + 0.90:0.05:0.90, + 0.80:0.00:0.80] + +\definecolorgroup + [yellow] + [1.00:1.00:0.70, + 1.00:1.00:0.00, + 1.00:0.85:0.05, + 1.00:0.70:0.00, + 1.00:0.55:0.00, + 0.95:0.40:0.00, + 0.80:0.30:0.00, + 0.60:0.30:0.00] + +\definecolorgroup + [red*] + [1.00:0.95:0.95, + 1.00:0.90:0.90, + 1.00:0.80:0.80, + 1.00:0.70:0.70, + 1.00:0.60:0.60, + 1.00:0.50:0.50, + 1.00:0.40:0.40, + 1.00:0.30:0.30] + +\definecolorgroup + [green*] + [0.95:1.00:0.95, + 0.90:1.00:0.90, + 0.80:1.00:0.80, + 0.70:1.00:0.70, + 0.60:1.00:0.60, + 0.50:1.00:0.50, + 0.40:1.00:0.40, + 0.30:1.00:0.30] + +\definecolorgroup + [blue*] + [0.95:0.95:1.00, + 0.90:0.90:1.00, + 0.80:0.80:1.00, + 0.70:0.70:1.00, + 0.60:0.60:1.00, + 0.50:0.50:1.00, + 0.40:0.40:1.00, + 0.30:0.30:1.00] + +\definecolorgroup + [yellow*] + [1.00:1.00:0.10, + 1.00:1.00:0.00, + 0.90:0.90:0.00, + 0.80:0.80:0.00, + 0.70:0.70:0.00, + 0.60:0.60:0.00, + 0.50:0.50:0.00, + 0.40:0.40:0.00] + +%D For the sake of implementing interface dependant color +%D groups we support colorgroup duplication. + +\startinterface dutch + \definecolorgroup [grijs] [gray] + \definecolorgroup [rood] [red] + \definecolorgroup [groen] [green] + \definecolorgroup [blauw] [blue] + \definecolorgroup [cyaan] [cyan] + \definecolorgroup [magenta] [magenta] + \definecolorgroup [geel] [yellow] + \definecolorgroup [rood*] [red*] + \definecolorgroup [groen*] [green*] + \definecolorgroup [blauw*] [blue*] + \definecolorgroup [geel*] [yellow*] +\stopinterface + +\startinterface german + \definecolorgroup [grau] [gray] + \definecolorgroup [rot] [red] + \definecolorgroup [gruen] [green] + \definecolorgroup [blau] [blue] + \definecolorgroup [cyan] [cyan] + \definecolorgroup [magenta] [magenta] + \definecolorgroup [gelb] [yellow] + \definecolorgroup [rot*] [red*] + \definecolorgroup [gruen*] [green*] + \definecolorgroup [blau*] [blue*] + \definecolorgroup [gelb*] [yellow*] +\stopinterface + +\startinterface czech + \definecolorgroup [seda] [gray] + \definecolorgroup [cervena] [red] + \definecolorgroup [zelena] [green] + \definecolorgroup [modra] [blue] + \definecolorgroup [azurova] [cyan] + \definecolorgroup [fialova] [magenta] + \definecolorgroup [zluta] [yellow] + \definecolorgroup [cervena*] [red*] + \definecolorgroup [zelena*] [green*] + \definecolorgroup [modra*] [blue*] + \definecolorgroup [zluta*] [yellow*] +\stopinterface + +\startinterface italian + \definecolorgroup [grigio] [gray] + \definecolorgroup [rosso] [red] + \definecolorgroup [verde] [green] + \definecolorgroup [blu] [blue] + \definecolorgroup [ciano] [cyan] + \definecolorgroup [azzurro] [cyan] + \definecolorgroup [turchino][cyan] + \definecolorgroup [magenta] [magenta] + \definecolorgroup [cremisi] [magenta] + \definecolorgroup [giallo] [yellow] + \definecolorgroup [rosso*] [red*] + \definecolorgroup [verde*] [green*] + \definecolorgroup [blu*] [blue*] + \definecolorgroup [giallo*] [yellow*] +\stopinterface + +%D The next set of color palets is quite language independant. +%D These palets are meant as examples. + +\definepalet + [alfa] + [ top=red:7, + bottom=green:6, + up=blue:5, + down=cyan:4, + strange=magenta:3, + charm=yellow:2] + +\definepalet + [beta] + [ top=red:7, + bottom=green:5, + up=blue:3, + down=cyan:6, + strange=magenta:2, + charm=yellow:1] + +\definepalet + [gamma] + [ top=red:2, + bottom=green:5, + up=blue:3, + down=cyan:6, + strange=magenta:7, + charm=yellow:4] + +\definepalet + [delta] + [ top=yellow*:5, + bottom=yellow*:3, + up=yellow*:2, + down=magenta:6, + strange=blue:4, + charm=blue:1] + +\definepalet + [epsilon] + [ top=cyan:7, + bottom=cyan:5, + up=blue:3, + down=yellow:6, + strange=yellow:4, + charm=yellow:2] + +\definepalet + [zeta] + [ top=red:6, + bottom=green:5, + up=blue:7, + down=cyan:4, + strange=magenta:3, + charm=yellow:2] + +%D The next four colors are used for typesetting verbatim \TEX\ +%D in color. + +\definecolor [texcolorone] [middlered] +\definecolor [texcolortwo] [middlegreen] +\definecolor [texcolorthree] [middleblue] +\definecolor [texcolorfour] [darkyellow] + +%D Bonus (needed for FO test): + +\definecolor [orange] [r=1,g=.5] + +\endinput diff --git a/Master/texmf-dist/tex/context/base/colo-rgb.tex b/Master/texmf-dist/tex/context/base/colo-rgb.tex deleted file mode 100644 index 038e0ab0bf1..00000000000 --- a/Master/texmf-dist/tex/context/base/colo-rgb.tex +++ /dev/null @@ -1,530 +0,0 @@ -%D \module -%D [ file=colo-rgb, -%D version=1995.01.01, -%D title=\CONTEXT\ Color Macros, -%D subtitle=RGB, -%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 Just to give users a start we define some colors. While -%D switching fonts is as international as can be, thanks to the -%D mnemonics, naming colors is very interface dependant. To -%D support international setups, we define both english and -%D interface dependant colors. We use the color inheritance -%D mechanisms to implement the interface dependant ones. - -%D First we define some simple primary \cap{RGB} and \cap{CMYK} -%D colors. All colors are defined in \cap{RGB} color space. - -\definecolor [red] [r=1, g=0, b=0] -\definecolor [green] [r=0, g=1, b=0] -\definecolor [blue] [r=0, g=0, b=1] - -\definecolor [cyan] [r=0, g=1, b=1] -\definecolor [magenta] [r=1, g=0, b=1] -\definecolor [yellow] [r=1, g=1, b=0] - -\definecolor [white] [s=1] % [r=1, g=1, b=1] -\definecolor [black] [s=0] -\definecolor [gray] [s=.9] - -\definecolor [darkred] [r=.8, g=0, b=0] -\definecolor [middlered] [r=.9, g=0, b=0] -\definecolor [lightred] [r=1, g=0, b=0] - -\definecolor [darkgreen] [r=0, g=.6, b=0] -\definecolor [middlegreen] [r=0, g=.8, b=0] -\definecolor [lightgreen] [r=0, g=1, b=0] - -\definecolor [darkblue] [r=0, g=0, b=.8] -\definecolor [middleblue] [r=0, g=0, b=.9] -\definecolor [lightblue] [r=0, g=0, b=1] - -\definecolor [darkcyan] [r=.6, g=.8, b=.8] -\definecolor [middlecyan] [r=0, g=.8, b=.8] - -\definecolor [darkmagenta] [r=.8, g=.6, b=.8] -\definecolor [middlemagenta] [r=1, g=0, b=.6] - -\definecolor [darkyellow] [r=.8, g=.8, b=.6] -\definecolor [middleyellow] [r=1, g=1, b=.2] - -\definecolor [darkgray] [s=.5] -\definecolor [middlegray] [s=.7] -\definecolor [lightgray] [s=.9] - -%D These colors are mapped to interface dependant colornames. - -\startinterface dutch - - \definecolor [rood] [red] - \definecolor [groen] [green] - \definecolor [blauw] [blue] - - \definecolor [cyaan] [cyan] - \definecolor [magenta] [magenta] - \definecolor [geel] [yellow] - - \definecolor [wit] [white] - \definecolor [grijs] [gray] - \definecolor [zwart] [black] - - \definecolor [donkerrood] [darkred] - \definecolor [middelrood] [middlered] - \definecolor [lichtrood] [lightred] - - \definecolor [donkergroen] [darkgreen] - \definecolor [middelgroen] [middlegreen] - \definecolor [lichtgroen] [lightgreen] - - \definecolor [donkerblauw] [darkblue] - \definecolor [middelblauw] [middleblue] - \definecolor [lichtblauw] [lightblue] - - \definecolor [donkercyaan] [darkcyan] - \definecolor [middelcyaan] [middlecyan] - - \definecolor [donkermagenta] [darkmagenta] - \definecolor [middelmagenta] [middlemagenta] - - \definecolor [donkergeel] [darkyellow] - \definecolor [middelgeel] [middleyellow] - - \definecolor [donkergrijs] [darkgray] - \definecolor [middengrijs] [middlegray] - \definecolor [lichtgrijs] [lightgray] - -\stopinterface - -\startinterface german - - \definecolor [rot] [red] - \definecolor [gruen] [green] - \definecolor [blau] [blue] - - \definecolor [cyan] [cyan] - \definecolor [magenta] [magenta] - \definecolor [gelb] [yellow] - - \definecolor [weiss] [white] - \definecolor [grau] [gray] - \definecolor [schwarz] [black] - - \definecolor [dunkelrot] [darkred] - \definecolor [mittelrot] [middlered] - \definecolor [hellrot] [lightred] - - \definecolor [dunkelgruen] [darkgreen] - \definecolor [mittelgruen] [middlegreen] - \definecolor [hellgruen] [lightgreen] - - \definecolor [dunkelblau] [darkblue] - \definecolor [mittelblau] [middleblue] - \definecolor [hellblau] [lightblue] - - \definecolor [dunkelcyan] [darkcyan] - \definecolor [mittelcyan] [middlecyan] - - \definecolor [dunkelmagenta] [darkmagenta] - \definecolor [mittelmagenta] [middlemagenta] - - \definecolor [dunkelgelb] [darkyellow] - \definecolor [mittelgelb] [middleyellow] - - \definecolor [dunkelgrau] [darkgray] - \definecolor [mittelgrau] [middlegray] - \definecolor [hellgrau] [lightgray] - -\stopinterface - -\startinterface czech - - \definecolor [cervena] [red] - \definecolor [zelena] [green] - \definecolor [modra] [blue] - - \definecolor [azurova] [cyan] - \definecolor [fialova] [magenta] - \definecolor [zluta] [yellow] - - \definecolor [bila] [white] - \definecolor [cerna] [black] - - \definecolor [tmavecervena] [darkred] - \definecolor [strednecervena] [middlered] - \definecolor [svetlecervena] [lightred] - - \definecolor [tmavezelena] [darkgreen] - \definecolor [strednezelena] [middlegreen] - \definecolor [svetlezelena] [lightgreen] - - \definecolor [tmavemodra] [darkblue] - \definecolor [strednemodra] [middleblue] - \definecolor [svetlemodra] [lightblue] - - \definecolor [tmaveazurova] [darkcyan] - \definecolor [stredneazurova] [middlecyan] - - \definecolor [tmavefialova] [darkmagenta] - \definecolor [strednefialova] [middlemagenta] - - \definecolor [tmavezluta] [darkyellow] - \definecolor [strednezluta] [middleyellow] - - \definecolor [tmaveseda] [darkgray] - \definecolor [stredneseda] [middlegray] - \definecolor [svetleseda] [lightgray] - -\stopinterface - -\startinterface italian - - \definecolor [rosso] [red] - \definecolor [verde] [green] - \definecolor [blu] [blue] - - \definecolor [azzurro] [cyan] - \definecolor [turchino] [cyan] - \definecolor [ciano] [cyan] - \definecolor [cremisi] [magenta] - \definecolor [giallo] [yellow] - - \definecolor [bianco] [white] - \definecolor [grigio] [gray] - \definecolor [nero] [black] - - \definecolor [rossoscuro] [darkred] - \definecolor [rossomedio] [middlered] - \definecolor [rossochiaro] [lightred] - - \definecolor [verdescuro] [darkgreen] - \definecolor [verdemedio] [middlegreen] - \definecolor [verdechiaro] [lightgreen] - - \definecolor [bluscuro] [darkblue] - \definecolor [blumedio] [middleblue] - \definecolor [bluchiaro] [lightblue] - - \definecolor [azzurroscuro] [darkcyan] - \definecolor [azzurrochiaro] [middlecyan] - - \definecolor [cremisiscuro] [darkmagenta] - \definecolor [cremisichiaro] [middlemagenta] - - - \definecolor [gialloscuro] [darkyellow] - \definecolor [giallomedio] [middleyellow] - - \definecolor [grigioscuro] [darkgray] - \definecolor [grigiomedio] [middlegray] - \definecolor [grigiochiaro] [lightgray] - -\stopinterface - -\startinterface romanian - - \definecolor [rosu] [red] - \definecolor [verde] [green] - \definecolor [albastru] [blue] - - \definecolor [cian] [cyan] - \definecolor [magenta] [magenta] - \definecolor [galben] [yellow] - - \definecolor [alb] [white] - \definecolor [gri] [gray] - \definecolor [negru] [black] - - \definecolor [rosuinchis] [darkred] - \definecolor [rosumediu] [middlered] - \definecolor [rosudeschis] [lightred] - - \definecolor [verdeinchis] [darkgreen] - \definecolor [verdemediu] [middlegreen] - \definecolor [verdedeschis] [lightgreen] - - \definecolor [albastruinchis] [darkblue] - \definecolor [albastrumediu] [middleblue] - \definecolor [albastrudeschis] [lightblue] - - \definecolor [cianinchis] [darkcyan] - \definecolor [cianmediu] [middlecyan] - - \definecolor [magentainchis] [darkmagenta] - \definecolor [magentamediu] [middlemagenta] - - \definecolor [galbeninchis] [darkyellow] - \definecolor [galbenmediu] [middleyellow] - - \definecolor [griinchis] [darkgray] - \definecolor [grimediu] [middlegray] - \definecolor [grideschis] [lightgray] - -\stopinterface - -%D Like colors, we first define the english colorgroups. These -%D colorgroups are tuned for distinctive gray scale printing. - -% todo : more efficient and real gray - -\definecolorgroup - [gray] - [0.95:0.95:0.95, - 0.90:0.90:0.90, - 0.80:0.80:0.80, - 0.70:0.70:0.70, - 0.60:0.60:0.60, - 0.50:0.50:0.50, - 0.40:0.40:0.40, - 0.30:0.30:0.30, - 0.20:0.20:0.20, - 0.10:0.10:0.10, - 0.00:0.00:0.00] - -\definecolorgroup - [red] - [1.00:0.90:0.90, - 1.00:0.80:0.80, - 1.00:0.70:0.70, - 1.00:0.55:0.55, - 1.00:0.40:0.40, - 1.00:0.25:0.25, - 1.00:0.15:0.15, - 0.90:0.00:0.00] - -\definecolorgroup - [green] - [0.90:1.00:0.90, - 0.70:1.00:0.70, - 0.50:1.00:0.50, - 0.30:1.00:0.30, - 0.15:0.90:0.15, - 0.00:0.80:0.00, - 0.00:0.65:0.00, - 0.00:0.50:0.00] - -\definecolorgroup - [blue] - [0.90:0.95:1.00, - 0.80:0.90:1.00, - 0.55:0.85:1.00, - 0.30:0.80:1.00, - 0.15:0.75:1.00, - 0.00:0.70:1.00, - 0.00:0.55:1.00, - 0.00:0.40:1.00] - -\definecolorgroup - [cyan] - [0.80:1.00:1.00, - 0.60:1.00:1.00, - 0.30:1.00:1.00, - 0.00:0.95:0.95, - 0.00:0.85:0.85, - 0.00:0.75:0.75, - 0.00:0.60:0.60, - 0.00:0.50:0.50] - -\definecolorgroup - [magenta] - [1.00:0.90:1.00, - 1.00:0.80:1.00, - 1.00:0.65:1.00, - 1.00:0.50:1.00, - 1.00:0.35:1.00, - 1.00:0.15:1.00, - 0.90:0.05:0.90, - 0.80:0.00:0.80] - -\definecolorgroup - [yellow] - [1.00:1.00:0.70, - 1.00:1.00:0.00, - 1.00:0.85:0.05, - 1.00:0.70:0.00, - 1.00:0.55:0.00, - 0.95:0.40:0.00, - 0.80:0.30:0.00, - 0.60:0.30:0.00] - -\definecolorgroup - [red*] - [1.00:0.95:0.95, - 1.00:0.90:0.90, - 1.00:0.80:0.80, - 1.00:0.70:0.70, - 1.00:0.60:0.60, - 1.00:0.50:0.50, - 1.00:0.40:0.40, - 1.00:0.30:0.30] - -\definecolorgroup - [green*] - [0.95:1.00:0.95, - 0.90:1.00:0.90, - 0.80:1.00:0.80, - 0.70:1.00:0.70, - 0.60:1.00:0.60, - 0.50:1.00:0.50, - 0.40:1.00:0.40, - 0.30:1.00:0.30] - -\definecolorgroup - [blue*] - [0.95:0.95:1.00, - 0.90:0.90:1.00, - 0.80:0.80:1.00, - 0.70:0.70:1.00, - 0.60:0.60:1.00, - 0.50:0.50:1.00, - 0.40:0.40:1.00, - 0.30:0.30:1.00] - -\definecolorgroup - [yellow*] - [1.00:1.00:0.10, - 1.00:1.00:0.00, - 0.90:0.90:0.00, - 0.80:0.80:0.00, - 0.70:0.70:0.00, - 0.60:0.60:0.00, - 0.50:0.50:0.00, - 0.40:0.40:0.00] - -%D For the sake of implementing interface dependant color -%D groups we support colorgroup duplication. - -\startinterface dutch - \definecolorgroup [grijs] [gray] - \definecolorgroup [rood] [red] - \definecolorgroup [groen] [green] - \definecolorgroup [blauw] [blue] - \definecolorgroup [cyaan] [cyan] - \definecolorgroup [magenta] [magenta] - \definecolorgroup [geel] [yellow] - \definecolorgroup [rood*] [red*] - \definecolorgroup [groen*] [green*] - \definecolorgroup [blauw*] [blue*] - \definecolorgroup [geel*] [yellow*] -\stopinterface - -\startinterface german - \definecolorgroup [grau] [gray] - \definecolorgroup [rot] [red] - \definecolorgroup [gruen] [green] - \definecolorgroup [blau] [blue] - \definecolorgroup [cyan] [cyan] - \definecolorgroup [magenta] [magenta] - \definecolorgroup [gelb] [yellow] - \definecolorgroup [rot*] [red*] - \definecolorgroup [gruen*] [green*] - \definecolorgroup [blau*] [blue*] - \definecolorgroup [gelb*] [yellow*] -\stopinterface - -\startinterface czech - \definecolorgroup [seda] [gray] - \definecolorgroup [cervena] [red] - \definecolorgroup [zelena] [green] - \definecolorgroup [modra] [blue] - \definecolorgroup [azurova] [cyan] - \definecolorgroup [fialova] [magenta] - \definecolorgroup [zluta] [yellow] - \definecolorgroup [cervena*] [red*] - \definecolorgroup [zelena*] [green*] - \definecolorgroup [modra*] [blue*] - \definecolorgroup [zluta*] [yellow*] -\stopinterface - -\startinterface italian - \definecolorgroup [grigio] [gray] - \definecolorgroup [rosso] [red] - \definecolorgroup [verde] [green] - \definecolorgroup [blu] [blue] - \definecolorgroup [ciano] [cyan] - \definecolorgroup [azzurro] [cyan] - \definecolorgroup [turchino][cyan] - \definecolorgroup [magenta] [magenta] - \definecolorgroup [cremisi] [magenta] - \definecolorgroup [giallo] [yellow] - \definecolorgroup [rosso*] [red*] - \definecolorgroup [verde*] [green*] - \definecolorgroup [blu*] [blue*] - \definecolorgroup [giallo*] [yellow*] -\stopinterface - -%D The next set of color palets is quite language independant. -%D These palets are meant as examples. - -\definepalet - [alfa] - [ top=red:7, - bottom=green:6, - up=blue:5, - down=cyan:4, - strange=magenta:3, - charm=yellow:2] - -\definepalet - [beta] - [ top=red:7, - bottom=green:5, - up=blue:3, - down=cyan:6, - strange=magenta:2, - charm=yellow:1] - -\definepalet - [gamma] - [ top=red:2, - bottom=green:5, - up=blue:3, - down=cyan:6, - strange=magenta:7, - charm=yellow:4] - -\definepalet - [delta] - [ top=yellow*:5, - bottom=yellow*:3, - up=yellow*:2, - down=magenta:6, - strange=blue:4, - charm=blue:1] - -\definepalet - [epsilon] - [ top=cyan:7, - bottom=cyan:5, - up=blue:3, - down=yellow:6, - strange=yellow:4, - charm=yellow:2] - -\definepalet - [zeta] - [ top=red:6, - bottom=green:5, - up=blue:7, - down=cyan:4, - strange=magenta:3, - charm=yellow:2] - -%D The next four colors are used for typesetting verbatim \TEX\ -%D in color. - -\definecolor [texcolorone] [middlered] -\definecolor [texcolortwo] [middlegreen] -\definecolor [texcolorthree] [middleblue] -\definecolor [texcolorfour] [darkyellow] - -%D Bonus (needed for FO test): - -\definecolor [orange] [r=1,g=.5] - -\endinput diff --git a/Master/texmf-dist/tex/context/base/colo-run.mkii b/Master/texmf-dist/tex/context/base/colo-run.mkii new file mode 100644 index 00000000000..d94ea980128 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/colo-run.mkii @@ -0,0 +1,257 @@ +%D \module +%D [ file=colo-run, +%D version=1997.04.01, +%D title=\CONTEXT\ Color Macros, +%D subtitle=Runtime loaded commands, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +% temp hack (not do be documented) + +% \gdef\doformatcolorP#1:#2:#3:#4:#5:#6\od % was undefined in colo-ini +% {#1\colorformatseparator +% \dodoformatcolor{#2}\colorformatseparator +% \dodoformatcolor{#3}\colorformatseparator +% \dodoformatcolor{#4}\colorformatseparator} + +% \gdef\doformatgrayP#1:#2:#3:#4:#5:#6\od +% {todo} + +% so far + +\gdef\showpalet + {\dodoubleargument\doshowpalet} + +\gdef\doshowpalet[#1][#2]% + {\doifdefined{\??pa#1} + {\doifinsetelse\v!vertical{#2} + {\showverticalpalet[#1][#2]} + {\showhorizontalpalet[#1][#2]}}} + +\gdef\showverticalpalet[#1][#2]% + {\localvbox + {\offinterlineskip + \setuppalet[#1] + \def\rule + {\vrule\!!width3em\!!height\strutht\!!depth\strutdp} + \tabskip\zeropoint + \def\doshowpalet##1% + {\doifinsetelse\v!number{#2}{##1\hskip.5em}{}& + \color[##1]{\rule}\graycolor[##1]{\rule}& + \doifinset\v!value{#2}{\hskip.5em\colorvalue{##1}}\crcr} + \halign + {\hss##&\hss##\hss&##\cr + &\doifinset{\v!name}{#2}{\strut#1}&\cr% + \processpalet[#1]\doshowpalet\crcr}}} + +\gdef\showhorizontalpalet[#1][#2]% + {\localvbox + {\offinterlineskip + \setuppalet[#1] + \tabskip\zeropoint + \!!widtha\zeropoint + \doifinset\v!number{#2} + {\def\doshowpalet##1% + {\setbox0\hbox{##1}% + \ifdim\!!widtha<\wd0\!!widtha\wd0\fi}% + \processpalet[#1]\doshowpalet}% + \advance\!!widtha 1em + \ifdim\!!widtha<5em + \!!widtha5em + \fi + \halign + {##&&\hbox to \!!widtha{\hss##\hss}\cr + \doifinset\v!number{#2} + {\def\doshowpalet##1{&\strut##1}% + \processpalet[#1]\doshowpalet}\cr + \doifinset\v!name{#2}{#1\hskip.5em}% + \def\doshowpalet##1% + {&\strut\color[##1]{\vrule\!!width\!!widtha\!!height\strutht\!!depth\zeropoint}}% + \processpalet[#1]\doshowpalet\crcr + \noalign{\vskip-\strutdepth}% + \def\doshowpalet##1% + {&\graycolor[##1]{\vrule\!!width\!!widtha\!!height\zeropoint\!!depth\strutdp}}% + \processpalet[#1]\doshowpalet\crcr + \doifinset\v!value{#2} + {\def\doshowpalet##1% + {&\vbox + {\hsize\!!widtha + \vskip.25ex + \everypar{\strut} + \veryraggedcenter + \let\colorformatseparator=\endgraf + \colorvalue{##1}}}% + \processpalet[#1]\doshowpalet}% + \crcr}}} + +\gdef\processpalet[#1]% + {\expanded{\globalprocesscommalist[\getvalue{\??pa#1}]}} + +\gdef\showcolorgroup + {\dodoubleargument\doshowcolorgroup} + +\gdef\doshowcolorgroup[#1][#2]% + {\doifcolor{#1:1} + {\doifinsetelse\v!vertical{#2} + {\showverticalcolorgroup[#1][#2]} + {\showhorizontalcolorgroup[#1][#2]}}} + +\gdef\showhorizontalcolorgroup[#1][#2]% + {\localvbox + {\offinterlineskip + \setuppalet + \tabskip\zeropoint + \def\rule + {\vrule\!!width4em\!!height\strutht\!!depth\strutdp} + \def\colorformatseparator{\strut\cr} + \def\dodoshowgroup##1% + {\halign + {\hss####\hss\cr + \doifinset\v!number{#2}{\strut##1}\cr + \color[#1:##1]{\vrule\!!width4em\!!height\strutht\!!depth\zeropoint}\cr + \graycolor[#1:##1]{\vrule\!!width4em\!!height\zeropoint\!!depth\strutdp}\cr + \doifinset\v!value{#2}{\colorvalue{#1:##1}\strut}\crcr}} + \def\doshowgroup##1% + {\doifcolor{#1:##1} + {\vbox{\dodoshowgroup{##1}}}}% + \hbox + {\doifinset\v!name{#2} + {\strut + \doifinsetelse\v!value{#2} + {\raise3\lineheight\hbox{#1\hskip.5em}} + {#1}% + \hskip.5em}% + \doshowgroup1\doshowgroup2\doshowgroup3\doshowgroup4% + \doshowgroup5\doshowgroup6\doshowgroup7\doshowgroup8}}} + +\gdef\showverticalcolorgroup[#1][#2]% + {\localvbox + {\offinterlineskip + \setuppalet + \tabskip\zeropoint + \def\rule + {\vrule\!!width2.5em\!!height\strutht\!!depth\strutdp}% + \def\doshowgroup##1% + {\doifcolor{#1:##1} + {\doifinset\v!number{#2}{##1\hskip.5em}& + \color[#1:##1]{\rule}\graycolor[#1:##1]{\rule}& + \doifinset\v!value{#2}{\hskip.5em\colorvalue{#1:##1}}\crcr}}% + \halign + {\hss##&\hss##\hss&##\hss\cr + &\doifinset\v!name{#2}{\strut#1}&\crcr + \doshowgroup1\doshowgroup2\doshowgroup3\doshowgroup4% + \doshowgroup5\doshowgroup6\doshowgroup7\doshowgroup8}}} + +\gdef\showcolor + {\dosingleempty\doshowcolor} + +\gdef\doshowcolor[#1]% + {\bgroup + \iffirstargument + \let\colorlist\empty % not really used, only for colo-run + \let\colorstyle\empty + \settrue\collectcolorsinlist + \setupcolor[#1]% + \fi + \def\rule + {\vrule\!!width4em\!!height\strutht\!!depth\strutdp}% + \def\docommand##1% + {\NC\graycolor[##1]{\rule}\NC\color[##1]{\rule}\NC\grayvalue{##1}\NC\colorvalue{##1}\NC##1\NC\NR}% + \starttabulate[|l|l|l|l|l|l|l|] + \expanded{\globalprocesscommalist[\colorlist]}\docommand + \stoptabulate + \egroup} + +\gdef\comparepalet + {\dosingleargument\docomparepalet} + +\gdef\docomparepalet[#1]% + {\doifdefined{\??pa#1} + {\hbox + {\dodocomparepalet\color[#1]% + \quad + \dodocomparepalet\graycolor[#1]}}} + +\gdef\dodocomparepalet#1[#2]% + {\localvbox + {\offinterlineskip + \setuppalet[#2] + \getcommacommandsize[\getvalue{\??pa#2}] + \!!widtha2em\relax + \hsize\commalistsize\!!widtha + \def\rule% + {\vrule\!!width.5\!!widtha\!!height2.25ex\!!depth-.75ex} + \def\dododocomparepalet##1% + {\hbox + {\setbox0\hbox + {#1[##1]{\vrule\!!width\hsize\!!height3ex}}% + \wd0\zeropoint + \box0 + \hbox to \hsize + {\def\dododocomparepalet####1% + {\hbox to \!!widtha + {\hss#1[####1]{\rule}\hss}}% + \processcommacommand[\getvalue{\??pa#2}]\dododocomparepalet}} + \endgraf} + \processcommacommand[\getvalue{\??pa#2}]\dododocomparepalet}} + +\gdef\comparecolorgroup + {\dosingleargument\docomparecolorgroup} + +\gdef\docomparecolorgroup[#1]% + {\doifcolor{#1:1} + {\hbox + {\dodocomparecolorgroup\color[#1]% + \quad + \dodocomparecolorgroup\graycolor[#1]}}} + +\gdef\dodocomparecolorgroup#1[#2]% + {\localvbox + {\!!counta\zerocount + \dorecurse{15} + {\doifcolor{#2:\recurselevel}{\advance\!!counta\plusone}} + \!!widtha2em\relax + \hsize\!!counta\!!widtha + \def\rule + {\vrule\!!width.5\!!widtha\!!height2.25ex\!!depth-.75ex} + \def\dododocomparecolorgroup##1% + {\hbox to \hsize + {\setbox0\hbox + {#1[#2:##1]{\vrule\!!width\hsize\!!height3ex}}% + \wd0\zeropoint + \box0 + \hbox to \hsize + {\hss\dorecurse\!!counta{#1[#2:\recurselevel]{\rule}\hss}}} + \endgraf} + \dorecurse\!!counta{\dododocomparecolorgroup\recurselevel}}} + +\gdef\dogetcolorcomponents#1% + {\doifelsenothing{#1} + {\appendtoks + \TB + \to \scratchtoks} + {\appendtoks + \NC\showcolorbar[#1]\NC#1\NC\transparencycomponents{#1}\NC\colorcomponents{#1}\NC \NR + \to \scratchtoks}} + +\gdef\showcolorbar[#1]% + {\backgroundline[#1]{\strut\enspace\color[white]{white}\enspace\color[black]{black}\enspace}} + +\gdef\showcolorcomponents[#1]% + {\begingroup + \scratchtoks{\TB}% + \processcommacommand[#1]\dogetcolorcomponents + \starttabulate[|lT|lT|lT|lT|] + \NC color \NC name \NC transparency \NC specification \NC\NR + \the\scratchtoks + \stoptabulate + \endgroup} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/colo-run.mkiv b/Master/texmf-dist/tex/context/base/colo-run.mkiv new file mode 100644 index 00000000000..d94ea980128 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/colo-run.mkiv @@ -0,0 +1,257 @@ +%D \module +%D [ file=colo-run, +%D version=1997.04.01, +%D title=\CONTEXT\ Color Macros, +%D subtitle=Runtime loaded commands, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +% temp hack (not do be documented) + +% \gdef\doformatcolorP#1:#2:#3:#4:#5:#6\od % was undefined in colo-ini +% {#1\colorformatseparator +% \dodoformatcolor{#2}\colorformatseparator +% \dodoformatcolor{#3}\colorformatseparator +% \dodoformatcolor{#4}\colorformatseparator} + +% \gdef\doformatgrayP#1:#2:#3:#4:#5:#6\od +% {todo} + +% so far + +\gdef\showpalet + {\dodoubleargument\doshowpalet} + +\gdef\doshowpalet[#1][#2]% + {\doifdefined{\??pa#1} + {\doifinsetelse\v!vertical{#2} + {\showverticalpalet[#1][#2]} + {\showhorizontalpalet[#1][#2]}}} + +\gdef\showverticalpalet[#1][#2]% + {\localvbox + {\offinterlineskip + \setuppalet[#1] + \def\rule + {\vrule\!!width3em\!!height\strutht\!!depth\strutdp} + \tabskip\zeropoint + \def\doshowpalet##1% + {\doifinsetelse\v!number{#2}{##1\hskip.5em}{}& + \color[##1]{\rule}\graycolor[##1]{\rule}& + \doifinset\v!value{#2}{\hskip.5em\colorvalue{##1}}\crcr} + \halign + {\hss##&\hss##\hss&##\cr + &\doifinset{\v!name}{#2}{\strut#1}&\cr% + \processpalet[#1]\doshowpalet\crcr}}} + +\gdef\showhorizontalpalet[#1][#2]% + {\localvbox + {\offinterlineskip + \setuppalet[#1] + \tabskip\zeropoint + \!!widtha\zeropoint + \doifinset\v!number{#2} + {\def\doshowpalet##1% + {\setbox0\hbox{##1}% + \ifdim\!!widtha<\wd0\!!widtha\wd0\fi}% + \processpalet[#1]\doshowpalet}% + \advance\!!widtha 1em + \ifdim\!!widtha<5em + \!!widtha5em + \fi + \halign + {##&&\hbox to \!!widtha{\hss##\hss}\cr + \doifinset\v!number{#2} + {\def\doshowpalet##1{&\strut##1}% + \processpalet[#1]\doshowpalet}\cr + \doifinset\v!name{#2}{#1\hskip.5em}% + \def\doshowpalet##1% + {&\strut\color[##1]{\vrule\!!width\!!widtha\!!height\strutht\!!depth\zeropoint}}% + \processpalet[#1]\doshowpalet\crcr + \noalign{\vskip-\strutdepth}% + \def\doshowpalet##1% + {&\graycolor[##1]{\vrule\!!width\!!widtha\!!height\zeropoint\!!depth\strutdp}}% + \processpalet[#1]\doshowpalet\crcr + \doifinset\v!value{#2} + {\def\doshowpalet##1% + {&\vbox + {\hsize\!!widtha + \vskip.25ex + \everypar{\strut} + \veryraggedcenter + \let\colorformatseparator=\endgraf + \colorvalue{##1}}}% + \processpalet[#1]\doshowpalet}% + \crcr}}} + +\gdef\processpalet[#1]% + {\expanded{\globalprocesscommalist[\getvalue{\??pa#1}]}} + +\gdef\showcolorgroup + {\dodoubleargument\doshowcolorgroup} + +\gdef\doshowcolorgroup[#1][#2]% + {\doifcolor{#1:1} + {\doifinsetelse\v!vertical{#2} + {\showverticalcolorgroup[#1][#2]} + {\showhorizontalcolorgroup[#1][#2]}}} + +\gdef\showhorizontalcolorgroup[#1][#2]% + {\localvbox + {\offinterlineskip + \setuppalet + \tabskip\zeropoint + \def\rule + {\vrule\!!width4em\!!height\strutht\!!depth\strutdp} + \def\colorformatseparator{\strut\cr} + \def\dodoshowgroup##1% + {\halign + {\hss####\hss\cr + \doifinset\v!number{#2}{\strut##1}\cr + \color[#1:##1]{\vrule\!!width4em\!!height\strutht\!!depth\zeropoint}\cr + \graycolor[#1:##1]{\vrule\!!width4em\!!height\zeropoint\!!depth\strutdp}\cr + \doifinset\v!value{#2}{\colorvalue{#1:##1}\strut}\crcr}} + \def\doshowgroup##1% + {\doifcolor{#1:##1} + {\vbox{\dodoshowgroup{##1}}}}% + \hbox + {\doifinset\v!name{#2} + {\strut + \doifinsetelse\v!value{#2} + {\raise3\lineheight\hbox{#1\hskip.5em}} + {#1}% + \hskip.5em}% + \doshowgroup1\doshowgroup2\doshowgroup3\doshowgroup4% + \doshowgroup5\doshowgroup6\doshowgroup7\doshowgroup8}}} + +\gdef\showverticalcolorgroup[#1][#2]% + {\localvbox + {\offinterlineskip + \setuppalet + \tabskip\zeropoint + \def\rule + {\vrule\!!width2.5em\!!height\strutht\!!depth\strutdp}% + \def\doshowgroup##1% + {\doifcolor{#1:##1} + {\doifinset\v!number{#2}{##1\hskip.5em}& + \color[#1:##1]{\rule}\graycolor[#1:##1]{\rule}& + \doifinset\v!value{#2}{\hskip.5em\colorvalue{#1:##1}}\crcr}}% + \halign + {\hss##&\hss##\hss&##\hss\cr + &\doifinset\v!name{#2}{\strut#1}&\crcr + \doshowgroup1\doshowgroup2\doshowgroup3\doshowgroup4% + \doshowgroup5\doshowgroup6\doshowgroup7\doshowgroup8}}} + +\gdef\showcolor + {\dosingleempty\doshowcolor} + +\gdef\doshowcolor[#1]% + {\bgroup + \iffirstargument + \let\colorlist\empty % not really used, only for colo-run + \let\colorstyle\empty + \settrue\collectcolorsinlist + \setupcolor[#1]% + \fi + \def\rule + {\vrule\!!width4em\!!height\strutht\!!depth\strutdp}% + \def\docommand##1% + {\NC\graycolor[##1]{\rule}\NC\color[##1]{\rule}\NC\grayvalue{##1}\NC\colorvalue{##1}\NC##1\NC\NR}% + \starttabulate[|l|l|l|l|l|l|l|] + \expanded{\globalprocesscommalist[\colorlist]}\docommand + \stoptabulate + \egroup} + +\gdef\comparepalet + {\dosingleargument\docomparepalet} + +\gdef\docomparepalet[#1]% + {\doifdefined{\??pa#1} + {\hbox + {\dodocomparepalet\color[#1]% + \quad + \dodocomparepalet\graycolor[#1]}}} + +\gdef\dodocomparepalet#1[#2]% + {\localvbox + {\offinterlineskip + \setuppalet[#2] + \getcommacommandsize[\getvalue{\??pa#2}] + \!!widtha2em\relax + \hsize\commalistsize\!!widtha + \def\rule% + {\vrule\!!width.5\!!widtha\!!height2.25ex\!!depth-.75ex} + \def\dododocomparepalet##1% + {\hbox + {\setbox0\hbox + {#1[##1]{\vrule\!!width\hsize\!!height3ex}}% + \wd0\zeropoint + \box0 + \hbox to \hsize + {\def\dododocomparepalet####1% + {\hbox to \!!widtha + {\hss#1[####1]{\rule}\hss}}% + \processcommacommand[\getvalue{\??pa#2}]\dododocomparepalet}} + \endgraf} + \processcommacommand[\getvalue{\??pa#2}]\dododocomparepalet}} + +\gdef\comparecolorgroup + {\dosingleargument\docomparecolorgroup} + +\gdef\docomparecolorgroup[#1]% + {\doifcolor{#1:1} + {\hbox + {\dodocomparecolorgroup\color[#1]% + \quad + \dodocomparecolorgroup\graycolor[#1]}}} + +\gdef\dodocomparecolorgroup#1[#2]% + {\localvbox + {\!!counta\zerocount + \dorecurse{15} + {\doifcolor{#2:\recurselevel}{\advance\!!counta\plusone}} + \!!widtha2em\relax + \hsize\!!counta\!!widtha + \def\rule + {\vrule\!!width.5\!!widtha\!!height2.25ex\!!depth-.75ex} + \def\dododocomparecolorgroup##1% + {\hbox to \hsize + {\setbox0\hbox + {#1[#2:##1]{\vrule\!!width\hsize\!!height3ex}}% + \wd0\zeropoint + \box0 + \hbox to \hsize + {\hss\dorecurse\!!counta{#1[#2:\recurselevel]{\rule}\hss}}} + \endgraf} + \dorecurse\!!counta{\dododocomparecolorgroup\recurselevel}}} + +\gdef\dogetcolorcomponents#1% + {\doifelsenothing{#1} + {\appendtoks + \TB + \to \scratchtoks} + {\appendtoks + \NC\showcolorbar[#1]\NC#1\NC\transparencycomponents{#1}\NC\colorcomponents{#1}\NC \NR + \to \scratchtoks}} + +\gdef\showcolorbar[#1]% + {\backgroundline[#1]{\strut\enspace\color[white]{white}\enspace\color[black]{black}\enspace}} + +\gdef\showcolorcomponents[#1]% + {\begingroup + \scratchtoks{\TB}% + \processcommacommand[#1]\dogetcolorcomponents + \starttabulate[|lT|lT|lT|lT|] + \NC color \NC name \NC transparency \NC specification \NC\NR + \the\scratchtoks + \stoptabulate + \endgroup} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/colo-run.tex b/Master/texmf-dist/tex/context/base/colo-run.tex deleted file mode 100644 index d94ea980128..00000000000 --- a/Master/texmf-dist/tex/context/base/colo-run.tex +++ /dev/null @@ -1,257 +0,0 @@ -%D \module -%D [ file=colo-run, -%D version=1997.04.01, -%D title=\CONTEXT\ Color Macros, -%D subtitle=Runtime loaded commands, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\unprotect - -% temp hack (not do be documented) - -% \gdef\doformatcolorP#1:#2:#3:#4:#5:#6\od % was undefined in colo-ini -% {#1\colorformatseparator -% \dodoformatcolor{#2}\colorformatseparator -% \dodoformatcolor{#3}\colorformatseparator -% \dodoformatcolor{#4}\colorformatseparator} - -% \gdef\doformatgrayP#1:#2:#3:#4:#5:#6\od -% {todo} - -% so far - -\gdef\showpalet - {\dodoubleargument\doshowpalet} - -\gdef\doshowpalet[#1][#2]% - {\doifdefined{\??pa#1} - {\doifinsetelse\v!vertical{#2} - {\showverticalpalet[#1][#2]} - {\showhorizontalpalet[#1][#2]}}} - -\gdef\showverticalpalet[#1][#2]% - {\localvbox - {\offinterlineskip - \setuppalet[#1] - \def\rule - {\vrule\!!width3em\!!height\strutht\!!depth\strutdp} - \tabskip\zeropoint - \def\doshowpalet##1% - {\doifinsetelse\v!number{#2}{##1\hskip.5em}{}& - \color[##1]{\rule}\graycolor[##1]{\rule}& - \doifinset\v!value{#2}{\hskip.5em\colorvalue{##1}}\crcr} - \halign - {\hss##&\hss##\hss&##\cr - &\doifinset{\v!name}{#2}{\strut#1}&\cr% - \processpalet[#1]\doshowpalet\crcr}}} - -\gdef\showhorizontalpalet[#1][#2]% - {\localvbox - {\offinterlineskip - \setuppalet[#1] - \tabskip\zeropoint - \!!widtha\zeropoint - \doifinset\v!number{#2} - {\def\doshowpalet##1% - {\setbox0\hbox{##1}% - \ifdim\!!widtha<\wd0\!!widtha\wd0\fi}% - \processpalet[#1]\doshowpalet}% - \advance\!!widtha 1em - \ifdim\!!widtha<5em - \!!widtha5em - \fi - \halign - {##&&\hbox to \!!widtha{\hss##\hss}\cr - \doifinset\v!number{#2} - {\def\doshowpalet##1{&\strut##1}% - \processpalet[#1]\doshowpalet}\cr - \doifinset\v!name{#2}{#1\hskip.5em}% - \def\doshowpalet##1% - {&\strut\color[##1]{\vrule\!!width\!!widtha\!!height\strutht\!!depth\zeropoint}}% - \processpalet[#1]\doshowpalet\crcr - \noalign{\vskip-\strutdepth}% - \def\doshowpalet##1% - {&\graycolor[##1]{\vrule\!!width\!!widtha\!!height\zeropoint\!!depth\strutdp}}% - \processpalet[#1]\doshowpalet\crcr - \doifinset\v!value{#2} - {\def\doshowpalet##1% - {&\vbox - {\hsize\!!widtha - \vskip.25ex - \everypar{\strut} - \veryraggedcenter - \let\colorformatseparator=\endgraf - \colorvalue{##1}}}% - \processpalet[#1]\doshowpalet}% - \crcr}}} - -\gdef\processpalet[#1]% - {\expanded{\globalprocesscommalist[\getvalue{\??pa#1}]}} - -\gdef\showcolorgroup - {\dodoubleargument\doshowcolorgroup} - -\gdef\doshowcolorgroup[#1][#2]% - {\doifcolor{#1:1} - {\doifinsetelse\v!vertical{#2} - {\showverticalcolorgroup[#1][#2]} - {\showhorizontalcolorgroup[#1][#2]}}} - -\gdef\showhorizontalcolorgroup[#1][#2]% - {\localvbox - {\offinterlineskip - \setuppalet - \tabskip\zeropoint - \def\rule - {\vrule\!!width4em\!!height\strutht\!!depth\strutdp} - \def\colorformatseparator{\strut\cr} - \def\dodoshowgroup##1% - {\halign - {\hss####\hss\cr - \doifinset\v!number{#2}{\strut##1}\cr - \color[#1:##1]{\vrule\!!width4em\!!height\strutht\!!depth\zeropoint}\cr - \graycolor[#1:##1]{\vrule\!!width4em\!!height\zeropoint\!!depth\strutdp}\cr - \doifinset\v!value{#2}{\colorvalue{#1:##1}\strut}\crcr}} - \def\doshowgroup##1% - {\doifcolor{#1:##1} - {\vbox{\dodoshowgroup{##1}}}}% - \hbox - {\doifinset\v!name{#2} - {\strut - \doifinsetelse\v!value{#2} - {\raise3\lineheight\hbox{#1\hskip.5em}} - {#1}% - \hskip.5em}% - \doshowgroup1\doshowgroup2\doshowgroup3\doshowgroup4% - \doshowgroup5\doshowgroup6\doshowgroup7\doshowgroup8}}} - -\gdef\showverticalcolorgroup[#1][#2]% - {\localvbox - {\offinterlineskip - \setuppalet - \tabskip\zeropoint - \def\rule - {\vrule\!!width2.5em\!!height\strutht\!!depth\strutdp}% - \def\doshowgroup##1% - {\doifcolor{#1:##1} - {\doifinset\v!number{#2}{##1\hskip.5em}& - \color[#1:##1]{\rule}\graycolor[#1:##1]{\rule}& - \doifinset\v!value{#2}{\hskip.5em\colorvalue{#1:##1}}\crcr}}% - \halign - {\hss##&\hss##\hss&##\hss\cr - &\doifinset\v!name{#2}{\strut#1}&\crcr - \doshowgroup1\doshowgroup2\doshowgroup3\doshowgroup4% - \doshowgroup5\doshowgroup6\doshowgroup7\doshowgroup8}}} - -\gdef\showcolor - {\dosingleempty\doshowcolor} - -\gdef\doshowcolor[#1]% - {\bgroup - \iffirstargument - \let\colorlist\empty % not really used, only for colo-run - \let\colorstyle\empty - \settrue\collectcolorsinlist - \setupcolor[#1]% - \fi - \def\rule - {\vrule\!!width4em\!!height\strutht\!!depth\strutdp}% - \def\docommand##1% - {\NC\graycolor[##1]{\rule}\NC\color[##1]{\rule}\NC\grayvalue{##1}\NC\colorvalue{##1}\NC##1\NC\NR}% - \starttabulate[|l|l|l|l|l|l|l|] - \expanded{\globalprocesscommalist[\colorlist]}\docommand - \stoptabulate - \egroup} - -\gdef\comparepalet - {\dosingleargument\docomparepalet} - -\gdef\docomparepalet[#1]% - {\doifdefined{\??pa#1} - {\hbox - {\dodocomparepalet\color[#1]% - \quad - \dodocomparepalet\graycolor[#1]}}} - -\gdef\dodocomparepalet#1[#2]% - {\localvbox - {\offinterlineskip - \setuppalet[#2] - \getcommacommandsize[\getvalue{\??pa#2}] - \!!widtha2em\relax - \hsize\commalistsize\!!widtha - \def\rule% - {\vrule\!!width.5\!!widtha\!!height2.25ex\!!depth-.75ex} - \def\dododocomparepalet##1% - {\hbox - {\setbox0\hbox - {#1[##1]{\vrule\!!width\hsize\!!height3ex}}% - \wd0\zeropoint - \box0 - \hbox to \hsize - {\def\dododocomparepalet####1% - {\hbox to \!!widtha - {\hss#1[####1]{\rule}\hss}}% - \processcommacommand[\getvalue{\??pa#2}]\dododocomparepalet}} - \endgraf} - \processcommacommand[\getvalue{\??pa#2}]\dododocomparepalet}} - -\gdef\comparecolorgroup - {\dosingleargument\docomparecolorgroup} - -\gdef\docomparecolorgroup[#1]% - {\doifcolor{#1:1} - {\hbox - {\dodocomparecolorgroup\color[#1]% - \quad - \dodocomparecolorgroup\graycolor[#1]}}} - -\gdef\dodocomparecolorgroup#1[#2]% - {\localvbox - {\!!counta\zerocount - \dorecurse{15} - {\doifcolor{#2:\recurselevel}{\advance\!!counta\plusone}} - \!!widtha2em\relax - \hsize\!!counta\!!widtha - \def\rule - {\vrule\!!width.5\!!widtha\!!height2.25ex\!!depth-.75ex} - \def\dododocomparecolorgroup##1% - {\hbox to \hsize - {\setbox0\hbox - {#1[#2:##1]{\vrule\!!width\hsize\!!height3ex}}% - \wd0\zeropoint - \box0 - \hbox to \hsize - {\hss\dorecurse\!!counta{#1[#2:\recurselevel]{\rule}\hss}}} - \endgraf} - \dorecurse\!!counta{\dododocomparecolorgroup\recurselevel}}} - -\gdef\dogetcolorcomponents#1% - {\doifelsenothing{#1} - {\appendtoks - \TB - \to \scratchtoks} - {\appendtoks - \NC\showcolorbar[#1]\NC#1\NC\transparencycomponents{#1}\NC\colorcomponents{#1}\NC \NR - \to \scratchtoks}} - -\gdef\showcolorbar[#1]% - {\backgroundline[#1]{\strut\enspace\color[white]{white}\enspace\color[black]{black}\enspace}} - -\gdef\showcolorcomponents[#1]% - {\begingroup - \scratchtoks{\TB}% - \processcommacommand[#1]\dogetcolorcomponents - \starttabulate[|lT|lT|lT|lT|] - \NC color \NC name \NC transparency \NC specification \NC\NR - \the\scratchtoks - \stoptabulate - \endgroup} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/colo-x11.mkii b/Master/texmf-dist/tex/context/base/colo-x11.mkii new file mode 100644 index 00000000000..45d3aac6248 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/colo-x11.mkii @@ -0,0 +1,677 @@ +%D \module +%D [ file=colo-x11, +%D version=2009.11.13, +%D title=\CONTEXT\ Color Macros, +%D subtitle=X11, +%D author=Alan Braslau] +%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 Standard X11 rgb colors (from \type {/usr/share/X11/rgb.txt}): + +\doifnotmode{mkiv} { + \input colo-hex.mkii +} + +\definecolor [snow] [h=fffafa] +\definecolor [ghostwhite] [h=f8f8ff] +\definecolor [whitesmoke] [s=0.96] +\definecolor [gainsboro] [s=0.86] +\definecolor [floralwhite] [h=fffaf0] +\definecolor [oldlace] [h=fdf5e6] +\definecolor [linen] [h=faf0e6] +\definecolor [antiquewhite] [h=faebd7] +\definecolor [papayawhip] [h=ffefd5] +\definecolor [blanchedalmond] [h=ffebcd] +\definecolor [bisque] [h=ffe4c4] +\definecolor [peachpuff] [h=ffdab9] +\definecolor [navajowhite] [h=ffdead] +\definecolor [moccasin] [h=ffe4b5] +\definecolor [cornsilk] [h=fff8dc] +\definecolor [ivory] [h=fffff0] +\definecolor [lemonchiffon] [h=fffacd] +\definecolor [seashell] [h=fff5ee] +\definecolor [honeydew] [h=f0fff0] +\definecolor [mintcream] [h=f5fffa] +\definecolor [azure] [h=f0ffff] +\definecolor [aliceblue] [h=f0f8ff] +\definecolor [lavender] [h=e6e6fa] +\definecolor [lavenderblush] [h=fff0f5] +\definecolor [mistyrose] [h=ffe4e1] +\definecolor [white] [s=1] +\definecolor [black] [s=0] +\definecolor [darkslategray] [h=2f4f4f] +\definecolor [darkslategrey] [darkslategray] +\definecolor [dimgray] [s=0.41] +\definecolor [dimgrey] [dimgray] +\definecolor [slategray] [h=708090] +\definecolor [slategrey] [slategray] +\definecolor [lightslategray] [h=778899] +\definecolor [lightslategrey] [lightslategray] +\definecolor [gray] [s=0.75] +\definecolor [grey] [gray] +\definecolor [lightgrey] [s=0.83] +\definecolor [lightgray] [lightgrey] +\definecolor [midnightblue] [h=191970] +\definecolor [navy] [h=000080] +\definecolor [navyblue] [navy] +\definecolor [cornflowerblue] [h=6495ed] +\definecolor [darkslateblue] [h=483d8b] +\definecolor [slateblue] [h=6a5acd] +\definecolor [mediumslateblue] [h=7b68ee] +\definecolor [lightslateblue] [h=8470ff] +\definecolor [mediumblue] [h=0000cd] +\definecolor [royalblue] [h=4169e1] +\definecolor [blue] [h=0000ff] +\definecolor [dodgerblue] [h=1e90ff] +\definecolor [deepskyblue] [h=00bfff] +\definecolor [skyblue] [h=87ceeb] +\definecolor [lightskyblue] [h=87cefa] +\definecolor [steelblue] [h=4682b4] +\definecolor [lightsteelblue] [h=b0c4de] +\definecolor [lightblue] [h=add8e6] +\definecolor [powderblue] [h=b0e0e6] +\definecolor [paleturquoise] [h=afeeee] +\definecolor [darkturquoise] [h=00ced1] +\definecolor [mediumturquoise] [h=48d1cc] +\definecolor [turquoise] [h=40e0d0] +\definecolor [cyan] [h=00ffff] +\definecolor [lightcyan] [h=e0ffff] +\definecolor [cadetblue] [h=5f9ea0] +\definecolor [mediumaquamarine] [h=66cdaa] +\definecolor [aquamarine] [h=7fffd4] +\definecolor [darkgreen] [h=006400] +\definecolor [darkolivegreen] [h=556b2f] +\definecolor [darkseagreen] [h=8fbc8f] +\definecolor [seagreen] [h=2e8b57] +\definecolor [mediumseagreen] [h=3cb371] +\definecolor [lightseagreen] [h=20b2aa] +\definecolor [palegreen] [h=98fb98] +\definecolor [springgreen] [h=00ff7f] +\definecolor [lawngreen] [h=7cfc00] +\definecolor [green] [h=00ff00] +\definecolor [chartreuse] [h=7fff00] +\definecolor [mediumspringgreen] [h=00fa9a] +\definecolor [greenyellow] [h=adff2f] +\definecolor [limegreen] [h=32cd32] +\definecolor [yellowgreen] [h=9acd32] +\definecolor [forestgreen] [h=228b22] +\definecolor [olivedrab] [h=6b8e23] +\definecolor [darkkhaki] [h=bdb76b] +\definecolor [khaki] [h=f0e68c] +\definecolor [palegoldenrod] [h=eee8aa] +\definecolor [lightgoldenrodyellow] [h=fafad2] +\definecolor [lightyellow] [h=ffffe0] +\definecolor [yellow] [h=ffff00] +\definecolor [gold] [h=ffd700] +\definecolor [lightgoldenrod] [h=eedd82] +\definecolor [goldenrod] [h=daa520] +\definecolor [darkgoldenrod] [h=b8860b] +\definecolor [rosybrown] [h=bc8f8f] +\definecolor [indianred] [h=cd5c5c] +\definecolor [saddlebrown] [h=8b4513] +\definecolor [sienna] [h=a0522d] +\definecolor [peru] [h=cd853f] +\definecolor [burlywood] [h=deb887] +\definecolor [beige] [h=f5f5dc] +\definecolor [wheat] [h=f5deb3] +\definecolor [sandybrown] [h=f4a460] +\definecolor [tan] [h=d2b48c] +\definecolor [chocolate] [h=d2691e] +\definecolor [firebrick] [h=b22222] +\definecolor [brown] [h=a52a2a] +\definecolor [darksalmon] [h=e9967a] +\definecolor [salmon] [h=fa8072] +\definecolor [lightsalmon] [h=ffa07a] +\definecolor [orange] [h=ffa500] +\definecolor [darkorange] [h=ff8c00] +\definecolor [coral] [h=ff7f50] +\definecolor [lightcoral] [h=f08080] +\definecolor [tomato] [h=ff6347] +\definecolor [orangered] [h=ff4500] +\definecolor [red] [h=ff0000] +\definecolor [hotpink] [h=ff69b4] +\definecolor [deeppink] [h=ff1493] +\definecolor [pink] [h=ffc0cb] +\definecolor [lightpink] [h=ffb6c1] +\definecolor [palevioletred] [h=db7093] +\definecolor [maroon] [h=b03060] +\definecolor [mediumvioletred] [h=c71585] +\definecolor [violetred] [h=d02090] +\definecolor [magenta] [h=ff00ff] +\definecolor [violet] [h=ee82ee] +\definecolor [plum] [h=dda0dd] +\definecolor [orchid] [h=da70d6] +\definecolor [mediumorchid] [h=ba55d3] +\definecolor [darkorchid] [h=9932cc] +\definecolor [darkviolet] [h=9400d3] +\definecolor [blueviolet] [h=8a2be2] +\definecolor [purple] [h=a020f0] +\definecolor [mediumpurple] [h=9370db] +\definecolor [thistle] [h=d8bfd8] +\definecolor [snow1] [h=fffafa] +\definecolor [snow2] [h=eee9e9] +\definecolor [snow3] [h=cdc9c9] +\definecolor [snow4] [h=8b8989] +\definecolor [seashell1] [h=fff5ee] +\definecolor [seashell2] [h=eee5de] +\definecolor [seashell3] [h=cdc5bf] +\definecolor [seashell4] [h=8b8682] +\definecolor [antiquewhite1] [h=ffefdb] +\definecolor [antiquewhite2] [h=eedfcc] +\definecolor [antiquewhite3] [h=cdc0b0] +\definecolor [antiquewhite4] [h=8b8378] +\definecolor [bisque1] [h=ffe4c4] +\definecolor [bisque2] [h=eed5b7] +\definecolor [bisque3] [h=cdb79e] +\definecolor [bisque4] [h=8b7d6b] +\definecolor [peachpuff1] [h=ffdab9] +\definecolor [peachpuff2] [h=eecbad] +\definecolor [peachpuff3] [h=cdaf95] +\definecolor [peachpuff4] [h=8b7765] +\definecolor [navajowhite1] [h=ffdead] +\definecolor [navajowhite2] [h=eecfa1] +\definecolor [navajowhite3] [h=cdb38b] +\definecolor [navajowhite4] [h=8b795e] +\definecolor [lemonchiffon1] [h=fffacd] +\definecolor [lemonchiffon2] [h=eee9bf] +\definecolor [lemonchiffon3] [h=cdc9a5] +\definecolor [lemonchiffon4] [h=8b8970] +\definecolor [cornsilk1] [h=fff8dc] +\definecolor [cornsilk2] [h=eee8cd] +\definecolor [cornsilk3] [h=cdc8b1] +\definecolor [cornsilk4] [h=8b8878] +\definecolor [ivory1] [h=fffff0] +\definecolor [ivory2] [h=eeeee0] +\definecolor [ivory3] [h=cdcdc1] +\definecolor [ivory4] [h=8b8b83] +\definecolor [honeydew1] [h=f0fff0] +\definecolor [honeydew2] [h=e0eee0] +\definecolor [honeydew3] [h=c1cdc1] +\definecolor [honeydew4] [h=838b83] +\definecolor [lavenderblush1] [h=fff0f5] +\definecolor [lavenderblush2] [h=eee0e5] +\definecolor [lavenderblush3] [h=cdc1c5] +\definecolor [lavenderblush4] [h=8b8386] +\definecolor [mistyrose1] [h=ffe4e1] +\definecolor [mistyrose2] [h=eed5d2] +\definecolor [mistyrose3] [h=cdb7b5] +\definecolor [mistyrose4] [h=8b7d7b] +\definecolor [azure1] [h=f0ffff] +\definecolor [azure2] [h=e0eeee] +\definecolor [azure3] [h=c1cdcd] +\definecolor [azure4] [h=838b8b] +\definecolor [slateblue1] [h=836fff] +\definecolor [slateblue2] [h=7a67ee] +\definecolor [slateblue3] [h=6959cd] +\definecolor [slateblue4] [h=473c8b] +\definecolor [royalblue1] [h=4876ff] +\definecolor [royalblue2] [h=436eee] +\definecolor [royalblue3] [h=3a5fcd] +\definecolor [royalblue4] [h=27408b] +\definecolor [blue1] [h=0000ff] +\definecolor [blue2] [h=0000ee] +\definecolor [blue3] [h=0000cd] +\definecolor [blue4] [h=00008b] +\definecolor [dodgerblue1] [h=1e90ff] +\definecolor [dodgerblue2] [h=1c86ee] +\definecolor [dodgerblue3] [h=1874cd] +\definecolor [dodgerblue4] [h=104e8b] +\definecolor [steelblue1] [h=63b8ff] +\definecolor [steelblue2] [h=5cacee] +\definecolor [steelblue3] [h=4f94cd] +\definecolor [steelblue4] [h=36648b] +\definecolor [deepskyblue1] [h=00bfff] +\definecolor [deepskyblue2] [h=00b2ee] +\definecolor [deepskyblue3] [h=009acd] +\definecolor [deepskyblue4] [h=00688b] +\definecolor [skyblue1] [h=87ceff] +\definecolor [skyblue2] [h=7ec0ee] +\definecolor [skyblue3] [h=6ca6cd] +\definecolor [skyblue4] [h=4a708b] +\definecolor [lightskyblue1] [h=b0e2ff] +\definecolor [lightskyblue2] [h=a4d3ee] +\definecolor [lightskyblue3] [h=8db6cd] +\definecolor [lightskyblue4] [h=607b8b] +\definecolor [slategray1] [h=c6e2ff] +\definecolor [slategray2] [h=b9d3ee] +\definecolor [slategray3] [h=9fb6cd] +\definecolor [slategray4] [h=6c7b8b] +\definecolor [lightsteelblue1] [h=cae1ff] +\definecolor [lightsteelblue2] [h=bcd2ee] +\definecolor [lightsteelblue3] [h=a2b5cd] +\definecolor [lightsteelblue4] [h=6e7b8b] +\definecolor [lightblue1] [h=bfefff] +\definecolor [lightblue2] [h=b2dfee] +\definecolor [lightblue3] [h=9ac0cd] +\definecolor [lightblue4] [h=68838b] +\definecolor [lightcyan1] [h=e0ffff] +\definecolor [lightcyan2] [h=d1eeee] +\definecolor [lightcyan3] [h=b4cdcd] +\definecolor [lightcyan4] [h=7a8b8b] +\definecolor [paleturquoise1] [h=bbffff] +\definecolor [paleturquoise2] [h=aeeeee] +\definecolor [paleturquoise3] [h=96cdcd] +\definecolor [paleturquoise4] [h=668b8b] +\definecolor [cadetblue1] [h=98f5ff] +\definecolor [cadetblue2] [h=8ee5ee] +\definecolor [cadetblue3] [h=7ac5cd] +\definecolor [cadetblue4] [h=53868b] +\definecolor [turquoise1] [h=00f5ff] +\definecolor [turquoise2] [h=00e5ee] +\definecolor [turquoise3] [h=00c5cd] +\definecolor [turquoise4] [h=00868b] +\definecolor [cyan1] [h=00ffff] +\definecolor [cyan2] [h=00eeee] +\definecolor [cyan3] [h=00cdcd] +\definecolor [cyan4] [h=008b8b] +\definecolor [darkslategray1] [h=97ffff] +\definecolor [darkslategray2] [h=8deeee] +\definecolor [darkslategray3] [h=79cdcd] +\definecolor [darkslategray4] [h=528b8b] +\definecolor [aquamarine1] [h=7fffd4] +\definecolor [aquamarine2] [h=76eec6] +\definecolor [aquamarine3] [h=66cdaa] +\definecolor [aquamarine4] [h=458b74] +\definecolor [darkseagreen1] [h=c1ffc1] +\definecolor [darkseagreen2] [h=b4eeb4] +\definecolor [darkseagreen3] [h=9bcd9b] +\definecolor [darkseagreen4] [h=698b69] +\definecolor [seagreen1] [h=54ff9f] +\definecolor [seagreen2] [h=4eee94] +\definecolor [seagreen3] [h=43cd80] +\definecolor [seagreen4] [h=2e8b57] +\definecolor [palegreen1] [h=9aff9a] +\definecolor [palegreen2] [h=90ee90] +\definecolor [palegreen3] [h=7ccd7c] +\definecolor [palegreen4] [h=548b54] +\definecolor [springgreen1] [h=00ff7f] +\definecolor [springgreen2] [h=00ee76] +\definecolor [springgreen3] [h=00cd66] +\definecolor [springgreen4] [h=008b45] +\definecolor [green1] [h=00ff00] +\definecolor [green2] [h=00ee00] +\definecolor [green3] [h=00cd00] +\definecolor [green4] [h=008b00] +\definecolor [chartreuse1] [h=7fff00] +\definecolor [chartreuse2] [h=76ee00] +\definecolor [chartreuse3] [h=66cd00] +\definecolor [chartreuse4] [h=458b00] +\definecolor [olivedrab1] [h=c0ff3e] +\definecolor [olivedrab2] [h=b3ee3a] +\definecolor [olivedrab3] [h=9acd32] +\definecolor [olivedrab4] [h=698b22] +\definecolor [darkolivegreen1] [h=caff70] +\definecolor [darkolivegreen2] [h=bcee68] +\definecolor [darkolivegreen3] [h=a2cd5a] +\definecolor [darkolivegreen4] [h=6e8b3d] +\definecolor [khaki1] [h=fff68f] +\definecolor [khaki2] [h=eee685] +\definecolor [khaki3] [h=cdc673] +\definecolor [khaki4] [h=8b864e] +\definecolor [lightgoldenrod1] [h=ffec8b] +\definecolor [lightgoldenrod2] [h=eedc82] +\definecolor [lightgoldenrod3] [h=cdbe70] +\definecolor [lightgoldenrod4] [h=8b814c] +\definecolor [lightyellow1] [h=ffffe0] +\definecolor [lightyellow2] [h=eeeed1] +\definecolor [lightyellow3] [h=cdcdb4] +\definecolor [lightyellow4] [h=8b8b7a] +\definecolor [yellow1] [h=ffff00] +\definecolor [yellow2] [h=eeee00] +\definecolor [yellow3] [h=cdcd00] +\definecolor [yellow4] [h=8b8b00] +\definecolor [gold1] [h=ffd700] +\definecolor [gold2] [h=eec900] +\definecolor [gold3] [h=cdad00] +\definecolor [gold4] [h=8b7500] +\definecolor [goldenrod1] [h=ffc125] +\definecolor [goldenrod2] [h=eeb422] +\definecolor [goldenrod3] [h=cd9b1d] +\definecolor [goldenrod4] [h=8b6914] +\definecolor [darkgoldenrod1] [h=ffb90f] +\definecolor [darkgoldenrod2] [h=eead0e] +\definecolor [darkgoldenrod3] [h=cd950c] +\definecolor [darkgoldenrod4] [h=8b6508] +\definecolor [rosybrown1] [h=ffc1c1] +\definecolor [rosybrown2] [h=eeb4b4] +\definecolor [rosybrown3] [h=cd9b9b] +\definecolor [rosybrown4] [h=8b6969] +\definecolor [indianred1] [h=ff6a6a] +\definecolor [indianred2] [h=ee6363] +\definecolor [indianred3] [h=cd5555] +\definecolor [indianred4] [h=8b3a3a] +\definecolor [sienna1] [h=ff8247] +\definecolor [sienna2] [h=ee7942] +\definecolor [sienna3] [h=cd6839] +\definecolor [sienna4] [h=8b4726] +\definecolor [burlywood1] [h=ffd39b] +\definecolor [burlywood2] [h=eec591] +\definecolor [burlywood3] [h=cdaa7d] +\definecolor [burlywood4] [h=8b7355] +\definecolor [wheat1] [h=ffe7ba] +\definecolor [wheat2] [h=eed8ae] +\definecolor [wheat3] [h=cdba96] +\definecolor [wheat4] [h=8b7e66] +\definecolor [tan1] [h=ffa54f] +\definecolor [tan2] [h=ee9a49] +\definecolor [tan3] [h=cd853f] +\definecolor [tan4] [h=8b5a2b] +\definecolor [chocolate1] [h=ff7f24] +\definecolor [chocolate2] [h=ee7621] +\definecolor [chocolate3] [h=cd661d] +\definecolor [chocolate4] [h=8b4513] +\definecolor [firebrick1] [h=ff3030] +\definecolor [firebrick2] [h=ee2c2c] +\definecolor [firebrick3] [h=cd2626] +\definecolor [firebrick4] [h=8b1a1a] +\definecolor [brown1] [h=ff4040] +\definecolor [brown2] [h=ee3b3b] +\definecolor [brown3] [h=cd3333] +\definecolor [brown4] [h=8b2323] +\definecolor [salmon1] [h=ff8c69] +\definecolor [salmon2] [h=ee8262] +\definecolor [salmon3] [h=cd7054] +\definecolor [salmon4] [h=8b4c39] +\definecolor [lightsalmon1] [h=ffa07a] +\definecolor [lightsalmon2] [h=ee9572] +\definecolor [lightsalmon3] [h=cd8162] +\definecolor [lightsalmon4] [h=8b5742] +\definecolor [orange1] [h=ffa500] +\definecolor [orange2] [h=ee9a00] +\definecolor [orange3] [h=cd8500] +\definecolor [orange4] [h=8b5a00] +\definecolor [darkorange1] [h=ff7f00] +\definecolor [darkorange2] [h=ee7600] +\definecolor [darkorange3] [h=cd6600] +\definecolor [darkorange4] [h=8b4500] +\definecolor [coral1] [h=ff7256] +\definecolor [coral2] [h=ee6a50] +\definecolor [coral3] [h=cd5b45] +\definecolor [coral4] [h=8b3e2f] +\definecolor [tomato1] [h=ff6347] +\definecolor [tomato2] [h=ee5c42] +\definecolor [tomato3] [h=cd4f39] +\definecolor [tomato4] [h=8b3626] +\definecolor [orangered1] [h=ff4500] +\definecolor [orangered2] [h=ee4000] +\definecolor [orangered3] [h=cd3700] +\definecolor [orangered4] [h=8b2500] +\definecolor [red1] [h=ff0000] +\definecolor [red2] [h=ee0000] +\definecolor [red3] [h=cd0000] +\definecolor [red4] [h=8b0000] +\definecolor [debianred] [h=d70751] +\definecolor [deeppink1] [h=ff1493] +\definecolor [deeppink2] [h=ee1289] +\definecolor [deeppink3] [h=cd1076] +\definecolor [deeppink4] [h=8b0a50] +\definecolor [hotpink1] [h=ff6eb4] +\definecolor [hotpink2] [h=ee6aa7] +\definecolor [hotpink3] [h=cd6090] +\definecolor [hotpink4] [h=8b3a62] +\definecolor [pink1] [h=ffb5c5] +\definecolor [pink2] [h=eea9b8] +\definecolor [pink3] [h=cd919e] +\definecolor [pink4] [h=8b636c] +\definecolor [lightpink1] [h=ffaeb9] +\definecolor [lightpink2] [h=eea2ad] +\definecolor [lightpink3] [h=cd8c95] +\definecolor [lightpink4] [h=8b5f65] +\definecolor [palevioletred1] [h=ff82ab] +\definecolor [palevioletred2] [h=ee799f] +\definecolor [palevioletred3] [h=cd6889] +\definecolor [palevioletred4] [h=8b475d] +\definecolor [maroon1] [h=ff34b3] +\definecolor [maroon2] [h=ee30a7] +\definecolor [maroon3] [h=cd2990] +\definecolor [maroon4] [h=8b1c62] +\definecolor [violetred1] [h=ff3e96] +\definecolor [violetred2] [h=ee3a8c] +\definecolor [violetred3] [h=cd3278] +\definecolor [violetred4] [h=8b2252] +\definecolor [magenta1] [h=ff00ff] +\definecolor [magenta2] [h=ee00ee] +\definecolor [magenta3] [h=cd00cd] +\definecolor [magenta4] [h=8b008b] +\definecolor [orchid1] [h=ff83fa] +\definecolor [orchid2] [h=ee7ae9] +\definecolor [orchid3] [h=cd69c9] +\definecolor [orchid4] [h=8b4789] +\definecolor [plum1] [h=ffbbff] +\definecolor [plum2] [h=eeaeee] +\definecolor [plum3] [h=cd96cd] +\definecolor [plum4] [h=8b668b] +\definecolor [mediumorchid1] [h=e066ff] +\definecolor [mediumorchid2] [h=d15fee] +\definecolor [mediumorchid3] [h=b452cd] +\definecolor [mediumorchid4] [h=7a378b] +\definecolor [darkorchid1] [h=bf3eff] +\definecolor [darkorchid2] [h=b23aee] +\definecolor [darkorchid3] [h=9a32cd] +\definecolor [darkorchid4] [h=68228b] +\definecolor [purple1] [h=9b30ff] +\definecolor [purple2] [h=912cee] +\definecolor [purple3] [h=7d26cd] +\definecolor [purple4] [h=551a8b] +\definecolor [mediumpurple1] [h=ab82ff] +\definecolor [mediumpurple2] [h=9f79ee] +\definecolor [mediumpurple3] [h=8968cd] +\definecolor [mediumpurple4] [h=5d478b] +\definecolor [thistle1] [h=ffe1ff] +\definecolor [thistle2] [h=eed2ee] +\definecolor [thistle3] [h=cdb5cd] +\definecolor [thistle4] [h=8b7b8b] +\definecolor [gray0] [s=0.00] +\definecolor [grey0] [gray0] +\definecolor [gray1] [s=0.01] +\definecolor [grey1] [gray1] +\definecolor [gray2] [s=0.02] +\definecolor [grey2] [gray2] +\definecolor [gray3] [s=0.03] +\definecolor [grey3] [gray3] +\definecolor [gray4] [s=0.04] +\definecolor [grey4] [gray4] +\definecolor [gray5] [s=0.05] +\definecolor [grey5] [gray5] +\definecolor [gray6] [s=0.06] +\definecolor [grey6] [gray6] +\definecolor [gray7] [s=0.07] +\definecolor [grey7] [gray7] +\definecolor [gray8] [s=0.08] +\definecolor [grey8] [gray8] +\definecolor [gray9] [s=0.09] +\definecolor [grey9] [gray9] +\definecolor [gray10] [s=0.10] +\definecolor [grey10] [gray10] +\definecolor [gray11] [s=0.11] +\definecolor [grey11] [gray11] +\definecolor [gray12] [s=0.12] +\definecolor [grey12] [gray12] +\definecolor [gray13] [s=0.13] +\definecolor [grey13] [gray13] +\definecolor [gray14] [s=0.14] +\definecolor [grey14] [gray14] +\definecolor [gray15] [s=0.15] +\definecolor [grey15] [gray15] +\definecolor [gray16] [s=0.16] +\definecolor [grey16] [gray16] +\definecolor [gray17] [s=0.17] +\definecolor [grey17] [gray17] +\definecolor [gray18] [s=0.18] +\definecolor [grey18] [gray18] +\definecolor [gray19] [s=0.19] +\definecolor [grey19] [gray19] +\definecolor [gray20] [s=0.20] +\definecolor [grey20] [gray20] +\definecolor [gray21] [s=0.21] +\definecolor [grey21] [gray21] +\definecolor [gray22] [s=0.22] +\definecolor [grey22] [gray22] +\definecolor [gray23] [s=0.23] +\definecolor [grey23] [gray23] +\definecolor [gray24] [s=0.24] +\definecolor [grey24] [gray24] +\definecolor [gray25] [s=0.25] +\definecolor [grey25] [gray25] +\definecolor [gray26] [s=0.26] +\definecolor [grey26] [gray26] +\definecolor [gray27] [s=0.27] +\definecolor [grey27] [gray27] +\definecolor [gray28] [s=0.28] +\definecolor [grey28] [gray28] +\definecolor [gray29] [s=0.29] +\definecolor [grey29] [gray29] +\definecolor [gray30] [s=0.30] +\definecolor [grey30] [gray30] +\definecolor [gray31] [s=0.31] +\definecolor [grey31] [gray31] +\definecolor [gray32] [s=0.32] +\definecolor [grey32] [gray32] +\definecolor [gray33] [s=0.33] +\definecolor [grey33] [gray33] +\definecolor [gray34] [s=0.34] +\definecolor [grey34] [gray34] +\definecolor [gray35] [s=0.35] +\definecolor [grey35] [gray35] +\definecolor [gray36] [s=0.36] +\definecolor [grey36] [gray36] +\definecolor [gray37] [s=0.37] +\definecolor [grey37] [gray37] +\definecolor [gray38] [s=0.38] +\definecolor [grey38] [gray38] +\definecolor [gray39] [s=0.39] +\definecolor [grey39] [gray39] +\definecolor [gray40] [s=0.40] +\definecolor [grey40] [gray40] +\definecolor [gray41] [s=0.41] +\definecolor [grey41] [gray41] +\definecolor [gray42] [s=0.42] +\definecolor [grey42] [gray42] +\definecolor [gray43] [s=0.43] +\definecolor [grey43] [gray43] +\definecolor [gray44] [s=0.44] +\definecolor [grey44] [gray44] +\definecolor [gray45] [s=0.45] +\definecolor [grey45] [gray45] +\definecolor [gray46] [s=0.46] +\definecolor [grey46] [gray46] +\definecolor [gray47] [s=0.47] +\definecolor [grey47] [gray47] +\definecolor [gray48] [s=0.48] +\definecolor [grey48] [gray48] +\definecolor [gray49] [s=0.49] +\definecolor [grey49] [gray49] +\definecolor [gray50] [s=0.50] +\definecolor [grey50] [gray50] +\definecolor [gray51] [s=0.51] +\definecolor [grey51] [gray51] +\definecolor [gray52] [s=0.52] +\definecolor [grey52] [gray52] +\definecolor [gray53] [s=0.53] +\definecolor [grey53] [gray53] +\definecolor [gray54] [s=0.54] +\definecolor [grey54] [gray54] +\definecolor [gray55] [s=0.55] +\definecolor [grey55] [gray55] +\definecolor [gray56] [s=0.56] +\definecolor [grey56] [gray56] +\definecolor [gray57] [s=0.57] +\definecolor [grey57] [gray57] +\definecolor [gray58] [s=0.58] +\definecolor [grey58] [gray58] +\definecolor [gray59] [s=0.59] +\definecolor [grey59] [gray59] +\definecolor [gray60] [s=0.60] +\definecolor [grey60] [gray60] +\definecolor [gray61] [s=0.61] +\definecolor [grey61] [gray61] +\definecolor [gray62] [s=0.62] +\definecolor [grey62] [gray62] +\definecolor [gray63] [s=0.63] +\definecolor [grey63] [gray63] +\definecolor [gray64] [s=0.64] +\definecolor [grey64] [gray64] +\definecolor [gray65] [s=0.65] +\definecolor [grey65] [gray65] +\definecolor [gray66] [s=0.66] +\definecolor [grey66] [gray66] +\definecolor [gray67] [s=0.67] +\definecolor [grey67] [gray67] +\definecolor [gray68] [s=0.68] +\definecolor [grey68] [gray68] +\definecolor [gray69] [s=0.69] +\definecolor [grey69] [gray69] +\definecolor [gray70] [s=0.70] +\definecolor [grey70] [gray70] +\definecolor [gray71] [s=0.71] +\definecolor [grey71] [gray71] +\definecolor [gray72] [s=0.72] +\definecolor [grey72] [gray72] +\definecolor [gray73] [s=0.73] +\definecolor [grey73] [gray73] +\definecolor [gray74] [s=0.74] +\definecolor [grey74] [gray74] +\definecolor [gray75] [s=0.75] +\definecolor [grey75] [gray75] +\definecolor [gray76] [s=0.76] +\definecolor [grey76] [gray76] +\definecolor [gray77] [s=0.77] +\definecolor [grey77] [gray77] +\definecolor [gray78] [s=0.78] +\definecolor [grey78] [gray78] +\definecolor [gray79] [s=0.79] +\definecolor [grey79] [gray79] +\definecolor [gray80] [s=0.80] +\definecolor [grey80] [gray80] +\definecolor [gray81] [s=0.81] +\definecolor [grey81] [gray81] +\definecolor [gray82] [s=0.82] +\definecolor [grey82] [gray82] +\definecolor [gray83] [s=0.83] +\definecolor [grey83] [gray83] +\definecolor [gray84] [s=0.84] +\definecolor [grey84] [gray84] +\definecolor [gray85] [s=0.85] +\definecolor [grey85] [gray85] +\definecolor [gray86] [s=0.86] +\definecolor [grey86] [gray86] +\definecolor [gray87] [s=0.87] +\definecolor [grey87] [gray87] +\definecolor [gray88] [s=0.88] +\definecolor [grey88] [gray88] +\definecolor [gray89] [s=0.89] +\definecolor [grey89] [gray89] +\definecolor [gray90] [s=0.90] +\definecolor [grey90] [gray90] +\definecolor [gray91] [s=0.91] +\definecolor [grey91] [gray91] +\definecolor [gray92] [s=0.92] +\definecolor [grey92] [gray92] +\definecolor [gray93] [s=0.93] +\definecolor [grey93] [gray93] +\definecolor [gray94] [s=0.94] +\definecolor [grey94] [gray94] +\definecolor [gray95] [s=0.95] +\definecolor [grey95] [gray95] +\definecolor [gray96] [s=0.96] +\definecolor [grey96] [gray96] +\definecolor [gray97] [s=0.97] +\definecolor [grey97] [gray97] +\definecolor [gray98] [s=0.98] +\definecolor [grey98] [gray98] +\definecolor [gray99] [s=0.99] +\definecolor [grey99] [gray99] +\definecolor [gray100] [s=1.00] +\definecolor [grey100] [gray100] +\definecolor [darkgrey] [s=0.66] +\definecolor [darkgray] [darkgrey] +\definecolor [darkblue] [h=00008b] +\definecolor [darkcyan] [h=008b8b] +\definecolor [darkmagenta] [h=8b008b] +\definecolor [darkred] [h=8b0000] +\definecolor [lightgreen] [h=90ee90] + +\endinput diff --git a/Master/texmf-dist/tex/context/base/colo-x11.tex b/Master/texmf-dist/tex/context/base/colo-x11.tex deleted file mode 100644 index 45d3aac6248..00000000000 --- a/Master/texmf-dist/tex/context/base/colo-x11.tex +++ /dev/null @@ -1,677 +0,0 @@ -%D \module -%D [ file=colo-x11, -%D version=2009.11.13, -%D title=\CONTEXT\ Color Macros, -%D subtitle=X11, -%D author=Alan Braslau] -%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 Standard X11 rgb colors (from \type {/usr/share/X11/rgb.txt}): - -\doifnotmode{mkiv} { - \input colo-hex.mkii -} - -\definecolor [snow] [h=fffafa] -\definecolor [ghostwhite] [h=f8f8ff] -\definecolor [whitesmoke] [s=0.96] -\definecolor [gainsboro] [s=0.86] -\definecolor [floralwhite] [h=fffaf0] -\definecolor [oldlace] [h=fdf5e6] -\definecolor [linen] [h=faf0e6] -\definecolor [antiquewhite] [h=faebd7] -\definecolor [papayawhip] [h=ffefd5] -\definecolor [blanchedalmond] [h=ffebcd] -\definecolor [bisque] [h=ffe4c4] -\definecolor [peachpuff] [h=ffdab9] -\definecolor [navajowhite] [h=ffdead] -\definecolor [moccasin] [h=ffe4b5] -\definecolor [cornsilk] [h=fff8dc] -\definecolor [ivory] [h=fffff0] -\definecolor [lemonchiffon] [h=fffacd] -\definecolor [seashell] [h=fff5ee] -\definecolor [honeydew] [h=f0fff0] -\definecolor [mintcream] [h=f5fffa] -\definecolor [azure] [h=f0ffff] -\definecolor [aliceblue] [h=f0f8ff] -\definecolor [lavender] [h=e6e6fa] -\definecolor [lavenderblush] [h=fff0f5] -\definecolor [mistyrose] [h=ffe4e1] -\definecolor [white] [s=1] -\definecolor [black] [s=0] -\definecolor [darkslategray] [h=2f4f4f] -\definecolor [darkslategrey] [darkslategray] -\definecolor [dimgray] [s=0.41] -\definecolor [dimgrey] [dimgray] -\definecolor [slategray] [h=708090] -\definecolor [slategrey] [slategray] -\definecolor [lightslategray] [h=778899] -\definecolor [lightslategrey] [lightslategray] -\definecolor [gray] [s=0.75] -\definecolor [grey] [gray] -\definecolor [lightgrey] [s=0.83] -\definecolor [lightgray] [lightgrey] -\definecolor [midnightblue] [h=191970] -\definecolor [navy] [h=000080] -\definecolor [navyblue] [navy] -\definecolor [cornflowerblue] [h=6495ed] -\definecolor [darkslateblue] [h=483d8b] -\definecolor [slateblue] [h=6a5acd] -\definecolor [mediumslateblue] [h=7b68ee] -\definecolor [lightslateblue] [h=8470ff] -\definecolor [mediumblue] [h=0000cd] -\definecolor [royalblue] [h=4169e1] -\definecolor [blue] [h=0000ff] -\definecolor [dodgerblue] [h=1e90ff] -\definecolor [deepskyblue] [h=00bfff] -\definecolor [skyblue] [h=87ceeb] -\definecolor [lightskyblue] [h=87cefa] -\definecolor [steelblue] [h=4682b4] -\definecolor [lightsteelblue] [h=b0c4de] -\definecolor [lightblue] [h=add8e6] -\definecolor [powderblue] [h=b0e0e6] -\definecolor [paleturquoise] [h=afeeee] -\definecolor [darkturquoise] [h=00ced1] -\definecolor [mediumturquoise] [h=48d1cc] -\definecolor [turquoise] [h=40e0d0] -\definecolor [cyan] [h=00ffff] -\definecolor [lightcyan] [h=e0ffff] -\definecolor [cadetblue] [h=5f9ea0] -\definecolor [mediumaquamarine] [h=66cdaa] -\definecolor [aquamarine] [h=7fffd4] -\definecolor [darkgreen] [h=006400] -\definecolor [darkolivegreen] [h=556b2f] -\definecolor [darkseagreen] [h=8fbc8f] -\definecolor [seagreen] [h=2e8b57] -\definecolor [mediumseagreen] [h=3cb371] -\definecolor [lightseagreen] [h=20b2aa] -\definecolor [palegreen] [h=98fb98] -\definecolor [springgreen] [h=00ff7f] -\definecolor [lawngreen] [h=7cfc00] -\definecolor [green] [h=00ff00] -\definecolor [chartreuse] [h=7fff00] -\definecolor [mediumspringgreen] [h=00fa9a] -\definecolor [greenyellow] [h=adff2f] -\definecolor [limegreen] [h=32cd32] -\definecolor [yellowgreen] [h=9acd32] -\definecolor [forestgreen] [h=228b22] -\definecolor [olivedrab] [h=6b8e23] -\definecolor [darkkhaki] [h=bdb76b] -\definecolor [khaki] [h=f0e68c] -\definecolor [palegoldenrod] [h=eee8aa] -\definecolor [lightgoldenrodyellow] [h=fafad2] -\definecolor [lightyellow] [h=ffffe0] -\definecolor [yellow] [h=ffff00] -\definecolor [gold] [h=ffd700] -\definecolor [lightgoldenrod] [h=eedd82] -\definecolor [goldenrod] [h=daa520] -\definecolor [darkgoldenrod] [h=b8860b] -\definecolor [rosybrown] [h=bc8f8f] -\definecolor [indianred] [h=cd5c5c] -\definecolor [saddlebrown] [h=8b4513] -\definecolor [sienna] [h=a0522d] -\definecolor [peru] [h=cd853f] -\definecolor [burlywood] [h=deb887] -\definecolor [beige] [h=f5f5dc] -\definecolor [wheat] [h=f5deb3] -\definecolor [sandybrown] [h=f4a460] -\definecolor [tan] [h=d2b48c] -\definecolor [chocolate] [h=d2691e] -\definecolor [firebrick] [h=b22222] -\definecolor [brown] [h=a52a2a] -\definecolor [darksalmon] [h=e9967a] -\definecolor [salmon] [h=fa8072] -\definecolor [lightsalmon] [h=ffa07a] -\definecolor [orange] [h=ffa500] -\definecolor [darkorange] [h=ff8c00] -\definecolor [coral] [h=ff7f50] -\definecolor [lightcoral] [h=f08080] -\definecolor [tomato] [h=ff6347] -\definecolor [orangered] [h=ff4500] -\definecolor [red] [h=ff0000] -\definecolor [hotpink] [h=ff69b4] -\definecolor [deeppink] [h=ff1493] -\definecolor [pink] [h=ffc0cb] -\definecolor [lightpink] [h=ffb6c1] -\definecolor [palevioletred] [h=db7093] -\definecolor [maroon] [h=b03060] -\definecolor [mediumvioletred] [h=c71585] -\definecolor [violetred] [h=d02090] -\definecolor [magenta] [h=ff00ff] -\definecolor [violet] [h=ee82ee] -\definecolor [plum] [h=dda0dd] -\definecolor [orchid] [h=da70d6] -\definecolor [mediumorchid] [h=ba55d3] -\definecolor [darkorchid] [h=9932cc] -\definecolor [darkviolet] [h=9400d3] -\definecolor [blueviolet] [h=8a2be2] -\definecolor [purple] [h=a020f0] -\definecolor [mediumpurple] [h=9370db] -\definecolor [thistle] [h=d8bfd8] -\definecolor [snow1] [h=fffafa] -\definecolor [snow2] [h=eee9e9] -\definecolor [snow3] [h=cdc9c9] -\definecolor [snow4] [h=8b8989] -\definecolor [seashell1] [h=fff5ee] -\definecolor [seashell2] [h=eee5de] -\definecolor [seashell3] [h=cdc5bf] -\definecolor [seashell4] [h=8b8682] -\definecolor [antiquewhite1] [h=ffefdb] -\definecolor [antiquewhite2] [h=eedfcc] -\definecolor [antiquewhite3] [h=cdc0b0] -\definecolor [antiquewhite4] [h=8b8378] -\definecolor [bisque1] [h=ffe4c4] -\definecolor [bisque2] [h=eed5b7] -\definecolor [bisque3] [h=cdb79e] -\definecolor [bisque4] [h=8b7d6b] -\definecolor [peachpuff1] [h=ffdab9] -\definecolor [peachpuff2] [h=eecbad] -\definecolor [peachpuff3] [h=cdaf95] -\definecolor [peachpuff4] [h=8b7765] -\definecolor [navajowhite1] [h=ffdead] -\definecolor [navajowhite2] [h=eecfa1] -\definecolor [navajowhite3] [h=cdb38b] -\definecolor [navajowhite4] [h=8b795e] -\definecolor [lemonchiffon1] [h=fffacd] -\definecolor [lemonchiffon2] [h=eee9bf] -\definecolor [lemonchiffon3] [h=cdc9a5] -\definecolor [lemonchiffon4] [h=8b8970] -\definecolor [cornsilk1] [h=fff8dc] -\definecolor [cornsilk2] [h=eee8cd] -\definecolor [cornsilk3] [h=cdc8b1] -\definecolor [cornsilk4] [h=8b8878] -\definecolor [ivory1] [h=fffff0] -\definecolor [ivory2] [h=eeeee0] -\definecolor [ivory3] [h=cdcdc1] -\definecolor [ivory4] [h=8b8b83] -\definecolor [honeydew1] [h=f0fff0] -\definecolor [honeydew2] [h=e0eee0] -\definecolor [honeydew3] [h=c1cdc1] -\definecolor [honeydew4] [h=838b83] -\definecolor [lavenderblush1] [h=fff0f5] -\definecolor [lavenderblush2] [h=eee0e5] -\definecolor [lavenderblush3] [h=cdc1c5] -\definecolor [lavenderblush4] [h=8b8386] -\definecolor [mistyrose1] [h=ffe4e1] -\definecolor [mistyrose2] [h=eed5d2] -\definecolor [mistyrose3] [h=cdb7b5] -\definecolor [mistyrose4] [h=8b7d7b] -\definecolor [azure1] [h=f0ffff] -\definecolor [azure2] [h=e0eeee] -\definecolor [azure3] [h=c1cdcd] -\definecolor [azure4] [h=838b8b] -\definecolor [slateblue1] [h=836fff] -\definecolor [slateblue2] [h=7a67ee] -\definecolor [slateblue3] [h=6959cd] -\definecolor [slateblue4] [h=473c8b] -\definecolor [royalblue1] [h=4876ff] -\definecolor [royalblue2] [h=436eee] -\definecolor [royalblue3] [h=3a5fcd] -\definecolor [royalblue4] [h=27408b] -\definecolor [blue1] [h=0000ff] -\definecolor [blue2] [h=0000ee] -\definecolor [blue3] [h=0000cd] -\definecolor [blue4] [h=00008b] -\definecolor [dodgerblue1] [h=1e90ff] -\definecolor [dodgerblue2] [h=1c86ee] -\definecolor [dodgerblue3] [h=1874cd] -\definecolor [dodgerblue4] [h=104e8b] -\definecolor [steelblue1] [h=63b8ff] -\definecolor [steelblue2] [h=5cacee] -\definecolor [steelblue3] [h=4f94cd] -\definecolor [steelblue4] [h=36648b] -\definecolor [deepskyblue1] [h=00bfff] -\definecolor [deepskyblue2] [h=00b2ee] -\definecolor [deepskyblue3] [h=009acd] -\definecolor [deepskyblue4] [h=00688b] -\definecolor [skyblue1] [h=87ceff] -\definecolor [skyblue2] [h=7ec0ee] -\definecolor [skyblue3] [h=6ca6cd] -\definecolor [skyblue4] [h=4a708b] -\definecolor [lightskyblue1] [h=b0e2ff] -\definecolor [lightskyblue2] [h=a4d3ee] -\definecolor [lightskyblue3] [h=8db6cd] -\definecolor [lightskyblue4] [h=607b8b] -\definecolor [slategray1] [h=c6e2ff] -\definecolor [slategray2] [h=b9d3ee] -\definecolor [slategray3] [h=9fb6cd] -\definecolor [slategray4] [h=6c7b8b] -\definecolor [lightsteelblue1] [h=cae1ff] -\definecolor [lightsteelblue2] [h=bcd2ee] -\definecolor [lightsteelblue3] [h=a2b5cd] -\definecolor [lightsteelblue4] [h=6e7b8b] -\definecolor [lightblue1] [h=bfefff] -\definecolor [lightblue2] [h=b2dfee] -\definecolor [lightblue3] [h=9ac0cd] -\definecolor [lightblue4] [h=68838b] -\definecolor [lightcyan1] [h=e0ffff] -\definecolor [lightcyan2] [h=d1eeee] -\definecolor [lightcyan3] [h=b4cdcd] -\definecolor [lightcyan4] [h=7a8b8b] -\definecolor [paleturquoise1] [h=bbffff] -\definecolor [paleturquoise2] [h=aeeeee] -\definecolor [paleturquoise3] [h=96cdcd] -\definecolor [paleturquoise4] [h=668b8b] -\definecolor [cadetblue1] [h=98f5ff] -\definecolor [cadetblue2] [h=8ee5ee] -\definecolor [cadetblue3] [h=7ac5cd] -\definecolor [cadetblue4] [h=53868b] -\definecolor [turquoise1] [h=00f5ff] -\definecolor [turquoise2] [h=00e5ee] -\definecolor [turquoise3] [h=00c5cd] -\definecolor [turquoise4] [h=00868b] -\definecolor [cyan1] [h=00ffff] -\definecolor [cyan2] [h=00eeee] -\definecolor [cyan3] [h=00cdcd] -\definecolor [cyan4] [h=008b8b] -\definecolor [darkslategray1] [h=97ffff] -\definecolor [darkslategray2] [h=8deeee] -\definecolor [darkslategray3] [h=79cdcd] -\definecolor [darkslategray4] [h=528b8b] -\definecolor [aquamarine1] [h=7fffd4] -\definecolor [aquamarine2] [h=76eec6] -\definecolor [aquamarine3] [h=66cdaa] -\definecolor [aquamarine4] [h=458b74] -\definecolor [darkseagreen1] [h=c1ffc1] -\definecolor [darkseagreen2] [h=b4eeb4] -\definecolor [darkseagreen3] [h=9bcd9b] -\definecolor [darkseagreen4] [h=698b69] -\definecolor [seagreen1] [h=54ff9f] -\definecolor [seagreen2] [h=4eee94] -\definecolor [seagreen3] [h=43cd80] -\definecolor [seagreen4] [h=2e8b57] -\definecolor [palegreen1] [h=9aff9a] -\definecolor [palegreen2] [h=90ee90] -\definecolor [palegreen3] [h=7ccd7c] -\definecolor [palegreen4] [h=548b54] -\definecolor [springgreen1] [h=00ff7f] -\definecolor [springgreen2] [h=00ee76] -\definecolor [springgreen3] [h=00cd66] -\definecolor [springgreen4] [h=008b45] -\definecolor [green1] [h=00ff00] -\definecolor [green2] [h=00ee00] -\definecolor [green3] [h=00cd00] -\definecolor [green4] [h=008b00] -\definecolor [chartreuse1] [h=7fff00] -\definecolor [chartreuse2] [h=76ee00] -\definecolor [chartreuse3] [h=66cd00] -\definecolor [chartreuse4] [h=458b00] -\definecolor [olivedrab1] [h=c0ff3e] -\definecolor [olivedrab2] [h=b3ee3a] -\definecolor [olivedrab3] [h=9acd32] -\definecolor [olivedrab4] [h=698b22] -\definecolor [darkolivegreen1] [h=caff70] -\definecolor [darkolivegreen2] [h=bcee68] -\definecolor [darkolivegreen3] [h=a2cd5a] -\definecolor [darkolivegreen4] [h=6e8b3d] -\definecolor [khaki1] [h=fff68f] -\definecolor [khaki2] [h=eee685] -\definecolor [khaki3] [h=cdc673] -\definecolor [khaki4] [h=8b864e] -\definecolor [lightgoldenrod1] [h=ffec8b] -\definecolor [lightgoldenrod2] [h=eedc82] -\definecolor [lightgoldenrod3] [h=cdbe70] -\definecolor [lightgoldenrod4] [h=8b814c] -\definecolor [lightyellow1] [h=ffffe0] -\definecolor [lightyellow2] [h=eeeed1] -\definecolor [lightyellow3] [h=cdcdb4] -\definecolor [lightyellow4] [h=8b8b7a] -\definecolor [yellow1] [h=ffff00] -\definecolor [yellow2] [h=eeee00] -\definecolor [yellow3] [h=cdcd00] -\definecolor [yellow4] [h=8b8b00] -\definecolor [gold1] [h=ffd700] -\definecolor [gold2] [h=eec900] -\definecolor [gold3] [h=cdad00] -\definecolor [gold4] [h=8b7500] -\definecolor [goldenrod1] [h=ffc125] -\definecolor [goldenrod2] [h=eeb422] -\definecolor [goldenrod3] [h=cd9b1d] -\definecolor [goldenrod4] [h=8b6914] -\definecolor [darkgoldenrod1] [h=ffb90f] -\definecolor [darkgoldenrod2] [h=eead0e] -\definecolor [darkgoldenrod3] [h=cd950c] -\definecolor [darkgoldenrod4] [h=8b6508] -\definecolor [rosybrown1] [h=ffc1c1] -\definecolor [rosybrown2] [h=eeb4b4] -\definecolor [rosybrown3] [h=cd9b9b] -\definecolor [rosybrown4] [h=8b6969] -\definecolor [indianred1] [h=ff6a6a] -\definecolor [indianred2] [h=ee6363] -\definecolor [indianred3] [h=cd5555] -\definecolor [indianred4] [h=8b3a3a] -\definecolor [sienna1] [h=ff8247] -\definecolor [sienna2] [h=ee7942] -\definecolor [sienna3] [h=cd6839] -\definecolor [sienna4] [h=8b4726] -\definecolor [burlywood1] [h=ffd39b] -\definecolor [burlywood2] [h=eec591] -\definecolor [burlywood3] [h=cdaa7d] -\definecolor [burlywood4] [h=8b7355] -\definecolor [wheat1] [h=ffe7ba] -\definecolor [wheat2] [h=eed8ae] -\definecolor [wheat3] [h=cdba96] -\definecolor [wheat4] [h=8b7e66] -\definecolor [tan1] [h=ffa54f] -\definecolor [tan2] [h=ee9a49] -\definecolor [tan3] [h=cd853f] -\definecolor [tan4] [h=8b5a2b] -\definecolor [chocolate1] [h=ff7f24] -\definecolor [chocolate2] [h=ee7621] -\definecolor [chocolate3] [h=cd661d] -\definecolor [chocolate4] [h=8b4513] -\definecolor [firebrick1] [h=ff3030] -\definecolor [firebrick2] [h=ee2c2c] -\definecolor [firebrick3] [h=cd2626] -\definecolor [firebrick4] [h=8b1a1a] -\definecolor [brown1] [h=ff4040] -\definecolor [brown2] [h=ee3b3b] -\definecolor [brown3] [h=cd3333] -\definecolor [brown4] [h=8b2323] -\definecolor [salmon1] [h=ff8c69] -\definecolor [salmon2] [h=ee8262] -\definecolor [salmon3] [h=cd7054] -\definecolor [salmon4] [h=8b4c39] -\definecolor [lightsalmon1] [h=ffa07a] -\definecolor [lightsalmon2] [h=ee9572] -\definecolor [lightsalmon3] [h=cd8162] -\definecolor [lightsalmon4] [h=8b5742] -\definecolor [orange1] [h=ffa500] -\definecolor [orange2] [h=ee9a00] -\definecolor [orange3] [h=cd8500] -\definecolor [orange4] [h=8b5a00] -\definecolor [darkorange1] [h=ff7f00] -\definecolor [darkorange2] [h=ee7600] -\definecolor [darkorange3] [h=cd6600] -\definecolor [darkorange4] [h=8b4500] -\definecolor [coral1] [h=ff7256] -\definecolor [coral2] [h=ee6a50] -\definecolor [coral3] [h=cd5b45] -\definecolor [coral4] [h=8b3e2f] -\definecolor [tomato1] [h=ff6347] -\definecolor [tomato2] [h=ee5c42] -\definecolor [tomato3] [h=cd4f39] -\definecolor [tomato4] [h=8b3626] -\definecolor [orangered1] [h=ff4500] -\definecolor [orangered2] [h=ee4000] -\definecolor [orangered3] [h=cd3700] -\definecolor [orangered4] [h=8b2500] -\definecolor [red1] [h=ff0000] -\definecolor [red2] [h=ee0000] -\definecolor [red3] [h=cd0000] -\definecolor [red4] [h=8b0000] -\definecolor [debianred] [h=d70751] -\definecolor [deeppink1] [h=ff1493] -\definecolor [deeppink2] [h=ee1289] -\definecolor [deeppink3] [h=cd1076] -\definecolor [deeppink4] [h=8b0a50] -\definecolor [hotpink1] [h=ff6eb4] -\definecolor [hotpink2] [h=ee6aa7] -\definecolor [hotpink3] [h=cd6090] -\definecolor [hotpink4] [h=8b3a62] -\definecolor [pink1] [h=ffb5c5] -\definecolor [pink2] [h=eea9b8] -\definecolor [pink3] [h=cd919e] -\definecolor [pink4] [h=8b636c] -\definecolor [lightpink1] [h=ffaeb9] -\definecolor [lightpink2] [h=eea2ad] -\definecolor [lightpink3] [h=cd8c95] -\definecolor [lightpink4] [h=8b5f65] -\definecolor [palevioletred1] [h=ff82ab] -\definecolor [palevioletred2] [h=ee799f] -\definecolor [palevioletred3] [h=cd6889] -\definecolor [palevioletred4] [h=8b475d] -\definecolor [maroon1] [h=ff34b3] -\definecolor [maroon2] [h=ee30a7] -\definecolor [maroon3] [h=cd2990] -\definecolor [maroon4] [h=8b1c62] -\definecolor [violetred1] [h=ff3e96] -\definecolor [violetred2] [h=ee3a8c] -\definecolor [violetred3] [h=cd3278] -\definecolor [violetred4] [h=8b2252] -\definecolor [magenta1] [h=ff00ff] -\definecolor [magenta2] [h=ee00ee] -\definecolor [magenta3] [h=cd00cd] -\definecolor [magenta4] [h=8b008b] -\definecolor [orchid1] [h=ff83fa] -\definecolor [orchid2] [h=ee7ae9] -\definecolor [orchid3] [h=cd69c9] -\definecolor [orchid4] [h=8b4789] -\definecolor [plum1] [h=ffbbff] -\definecolor [plum2] [h=eeaeee] -\definecolor [plum3] [h=cd96cd] -\definecolor [plum4] [h=8b668b] -\definecolor [mediumorchid1] [h=e066ff] -\definecolor [mediumorchid2] [h=d15fee] -\definecolor [mediumorchid3] [h=b452cd] -\definecolor [mediumorchid4] [h=7a378b] -\definecolor [darkorchid1] [h=bf3eff] -\definecolor [darkorchid2] [h=b23aee] -\definecolor [darkorchid3] [h=9a32cd] -\definecolor [darkorchid4] [h=68228b] -\definecolor [purple1] [h=9b30ff] -\definecolor [purple2] [h=912cee] -\definecolor [purple3] [h=7d26cd] -\definecolor [purple4] [h=551a8b] -\definecolor [mediumpurple1] [h=ab82ff] -\definecolor [mediumpurple2] [h=9f79ee] -\definecolor [mediumpurple3] [h=8968cd] -\definecolor [mediumpurple4] [h=5d478b] -\definecolor [thistle1] [h=ffe1ff] -\definecolor [thistle2] [h=eed2ee] -\definecolor [thistle3] [h=cdb5cd] -\definecolor [thistle4] [h=8b7b8b] -\definecolor [gray0] [s=0.00] -\definecolor [grey0] [gray0] -\definecolor [gray1] [s=0.01] -\definecolor [grey1] [gray1] -\definecolor [gray2] [s=0.02] -\definecolor [grey2] [gray2] -\definecolor [gray3] [s=0.03] -\definecolor [grey3] [gray3] -\definecolor [gray4] [s=0.04] -\definecolor [grey4] [gray4] -\definecolor [gray5] [s=0.05] -\definecolor [grey5] [gray5] -\definecolor [gray6] [s=0.06] -\definecolor [grey6] [gray6] -\definecolor [gray7] [s=0.07] -\definecolor [grey7] [gray7] -\definecolor [gray8] [s=0.08] -\definecolor [grey8] [gray8] -\definecolor [gray9] [s=0.09] -\definecolor [grey9] [gray9] -\definecolor [gray10] [s=0.10] -\definecolor [grey10] [gray10] -\definecolor [gray11] [s=0.11] -\definecolor [grey11] [gray11] -\definecolor [gray12] [s=0.12] -\definecolor [grey12] [gray12] -\definecolor [gray13] [s=0.13] -\definecolor [grey13] [gray13] -\definecolor [gray14] [s=0.14] -\definecolor [grey14] [gray14] -\definecolor [gray15] [s=0.15] -\definecolor [grey15] [gray15] -\definecolor [gray16] [s=0.16] -\definecolor [grey16] [gray16] -\definecolor [gray17] [s=0.17] -\definecolor [grey17] [gray17] -\definecolor [gray18] [s=0.18] -\definecolor [grey18] [gray18] -\definecolor [gray19] [s=0.19] -\definecolor [grey19] [gray19] -\definecolor [gray20] [s=0.20] -\definecolor [grey20] [gray20] -\definecolor [gray21] [s=0.21] -\definecolor [grey21] [gray21] -\definecolor [gray22] [s=0.22] -\definecolor [grey22] [gray22] -\definecolor [gray23] [s=0.23] -\definecolor [grey23] [gray23] -\definecolor [gray24] [s=0.24] -\definecolor [grey24] [gray24] -\definecolor [gray25] [s=0.25] -\definecolor [grey25] [gray25] -\definecolor [gray26] [s=0.26] -\definecolor [grey26] [gray26] -\definecolor [gray27] [s=0.27] -\definecolor [grey27] [gray27] -\definecolor [gray28] [s=0.28] -\definecolor [grey28] [gray28] -\definecolor [gray29] [s=0.29] -\definecolor [grey29] [gray29] -\definecolor [gray30] [s=0.30] -\definecolor [grey30] [gray30] -\definecolor [gray31] [s=0.31] -\definecolor [grey31] [gray31] -\definecolor [gray32] [s=0.32] -\definecolor [grey32] [gray32] -\definecolor [gray33] [s=0.33] -\definecolor [grey33] [gray33] -\definecolor [gray34] [s=0.34] -\definecolor [grey34] [gray34] -\definecolor [gray35] [s=0.35] -\definecolor [grey35] [gray35] -\definecolor [gray36] [s=0.36] -\definecolor [grey36] [gray36] -\definecolor [gray37] [s=0.37] -\definecolor [grey37] [gray37] -\definecolor [gray38] [s=0.38] -\definecolor [grey38] [gray38] -\definecolor [gray39] [s=0.39] -\definecolor [grey39] [gray39] -\definecolor [gray40] [s=0.40] -\definecolor [grey40] [gray40] -\definecolor [gray41] [s=0.41] -\definecolor [grey41] [gray41] -\definecolor [gray42] [s=0.42] -\definecolor [grey42] [gray42] -\definecolor [gray43] [s=0.43] -\definecolor [grey43] [gray43] -\definecolor [gray44] [s=0.44] -\definecolor [grey44] [gray44] -\definecolor [gray45] [s=0.45] -\definecolor [grey45] [gray45] -\definecolor [gray46] [s=0.46] -\definecolor [grey46] [gray46] -\definecolor [gray47] [s=0.47] -\definecolor [grey47] [gray47] -\definecolor [gray48] [s=0.48] -\definecolor [grey48] [gray48] -\definecolor [gray49] [s=0.49] -\definecolor [grey49] [gray49] -\definecolor [gray50] [s=0.50] -\definecolor [grey50] [gray50] -\definecolor [gray51] [s=0.51] -\definecolor [grey51] [gray51] -\definecolor [gray52] [s=0.52] -\definecolor [grey52] [gray52] -\definecolor [gray53] [s=0.53] -\definecolor [grey53] [gray53] -\definecolor [gray54] [s=0.54] -\definecolor [grey54] [gray54] -\definecolor [gray55] [s=0.55] -\definecolor [grey55] [gray55] -\definecolor [gray56] [s=0.56] -\definecolor [grey56] [gray56] -\definecolor [gray57] [s=0.57] -\definecolor [grey57] [gray57] -\definecolor [gray58] [s=0.58] -\definecolor [grey58] [gray58] -\definecolor [gray59] [s=0.59] -\definecolor [grey59] [gray59] -\definecolor [gray60] [s=0.60] -\definecolor [grey60] [gray60] -\definecolor [gray61] [s=0.61] -\definecolor [grey61] [gray61] -\definecolor [gray62] [s=0.62] -\definecolor [grey62] [gray62] -\definecolor [gray63] [s=0.63] -\definecolor [grey63] [gray63] -\definecolor [gray64] [s=0.64] -\definecolor [grey64] [gray64] -\definecolor [gray65] [s=0.65] -\definecolor [grey65] [gray65] -\definecolor [gray66] [s=0.66] -\definecolor [grey66] [gray66] -\definecolor [gray67] [s=0.67] -\definecolor [grey67] [gray67] -\definecolor [gray68] [s=0.68] -\definecolor [grey68] [gray68] -\definecolor [gray69] [s=0.69] -\definecolor [grey69] [gray69] -\definecolor [gray70] [s=0.70] -\definecolor [grey70] [gray70] -\definecolor [gray71] [s=0.71] -\definecolor [grey71] [gray71] -\definecolor [gray72] [s=0.72] -\definecolor [grey72] [gray72] -\definecolor [gray73] [s=0.73] -\definecolor [grey73] [gray73] -\definecolor [gray74] [s=0.74] -\definecolor [grey74] [gray74] -\definecolor [gray75] [s=0.75] -\definecolor [grey75] [gray75] -\definecolor [gray76] [s=0.76] -\definecolor [grey76] [gray76] -\definecolor [gray77] [s=0.77] -\definecolor [grey77] [gray77] -\definecolor [gray78] [s=0.78] -\definecolor [grey78] [gray78] -\definecolor [gray79] [s=0.79] -\definecolor [grey79] [gray79] -\definecolor [gray80] [s=0.80] -\definecolor [grey80] [gray80] -\definecolor [gray81] [s=0.81] -\definecolor [grey81] [gray81] -\definecolor [gray82] [s=0.82] -\definecolor [grey82] [gray82] -\definecolor [gray83] [s=0.83] -\definecolor [grey83] [gray83] -\definecolor [gray84] [s=0.84] -\definecolor [grey84] [gray84] -\definecolor [gray85] [s=0.85] -\definecolor [grey85] [gray85] -\definecolor [gray86] [s=0.86] -\definecolor [grey86] [gray86] -\definecolor [gray87] [s=0.87] -\definecolor [grey87] [gray87] -\definecolor [gray88] [s=0.88] -\definecolor [grey88] [gray88] -\definecolor [gray89] [s=0.89] -\definecolor [grey89] [gray89] -\definecolor [gray90] [s=0.90] -\definecolor [grey90] [gray90] -\definecolor [gray91] [s=0.91] -\definecolor [grey91] [gray91] -\definecolor [gray92] [s=0.92] -\definecolor [grey92] [gray92] -\definecolor [gray93] [s=0.93] -\definecolor [grey93] [gray93] -\definecolor [gray94] [s=0.94] -\definecolor [grey94] [gray94] -\definecolor [gray95] [s=0.95] -\definecolor [grey95] [gray95] -\definecolor [gray96] [s=0.96] -\definecolor [grey96] [gray96] -\definecolor [gray97] [s=0.97] -\definecolor [grey97] [gray97] -\definecolor [gray98] [s=0.98] -\definecolor [grey98] [gray98] -\definecolor [gray99] [s=0.99] -\definecolor [grey99] [gray99] -\definecolor [gray100] [s=1.00] -\definecolor [grey100] [gray100] -\definecolor [darkgrey] [s=0.66] -\definecolor [darkgray] [darkgrey] -\definecolor [darkblue] [h=00008b] -\definecolor [darkcyan] [h=008b8b] -\definecolor [darkmagenta] [h=8b008b] -\definecolor [darkred] [h=8b0000] -\definecolor [lightgreen] [h=90ee90] - -\endinput diff --git a/Master/texmf-dist/tex/context/base/colo-xwi.mkii b/Master/texmf-dist/tex/context/base/colo-xwi.mkii new file mode 100644 index 00000000000..81e09d871bc --- /dev/null +++ b/Master/texmf-dist/tex/context/base/colo-xwi.mkii @@ -0,0 +1,142 @@ +%D \module +%D [ file=colo-xwi, +%D version=1995.01.01, +%D title=\CONTEXT\ Color Macros, +%D subtitle=X Windows, +%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 I've forgotten where I got these definitions from, but maybe +%D they can be of use. + +\definecolor [aliceblue] [r=0.94,g=0.97,b=1.00] +\definecolor [antiquewhite] [r=0.98,g=0.92,b=0.84] +\definecolor [aquamarine] [r=0.50,g=1.00,b=0.83] +\definecolor [azure] [r=0.94,g=1.00,b=1.00] +\definecolor [beige] [r=0.96,g=0.96,b=0.86] +\definecolor [bisque] [r=1.00,g=0.89,b=0.77] +\definecolor [black] [s=0] % [r=0.00,g=0.00,b=0.00] +\definecolor [blanchedalmond] [r=1.00,g=0.92,b=0.80] +\definecolor [blue] [r=0.00,g=0.00,b=1.00] +\definecolor [blueviolet] [r=0.54,g=0.17,b=0.89] +\definecolor [brown] [r=0.65,g=0.16,b=0.16] +\definecolor [burlywood] [r=0.87,g=0.72,b=0.53] +\definecolor [cadetblue] [r=0.37,g=0.62,b=0.63] +\definecolor [chartreuse] [r=0.50,g=1.00,b=0.00] +\definecolor [chocolate] [r=0.82,g=0.41,b=0.12] +\definecolor [coral] [r=1.00,g=0.50,b=0.31] +\definecolor [cornflowerblue] [r=0.39,g=0.58,b=0.93] +\definecolor [cornsilk] [r=1.00,g=0.97,b=0.86] +\definecolor [cyan] [r=0.00,g=1.00,b=1.00] +\definecolor [darkgoldenrod] [r=0.72,g=0.53,b=0.04] +\definecolor [darkgreen] [r=0.00,g=0.39,b=0.00] +\definecolor [darkkhaki] [r=0.74,g=0.72,b=0.42] +\definecolor [darkolivegreen] [r=0.33,g=0.42,b=0.18] +\definecolor [darkorange] [r=1.00,g=0.55,b=0.00] +\definecolor [darkorchid] [r=0.60,g=0.20,b=0.80] +\definecolor [darksalmon] [r=0.91,g=0.59,b=0.48] +\definecolor [darkseagreen] [r=0.56,g=0.74,b=0.56] +\definecolor [darkslateblue] [r=0.28,g=0.24,b=0.55] +\definecolor [darkturquoise] [r=0.00,g=0.81,b=0.82] +\definecolor [darkviolet] [r=0.58,g=0.00,b=0.83] +\definecolor [deeppink] [r=1.00,g=0.08,b=0.58] +\definecolor [deepskyblue] [r=0.00,g=0.75,b=1.00] +\definecolor [dodgerblue] [r=0.12,g=0.56,b=1.00] +\definecolor [firebrick] [r=0.70,g=0.13,b=0.13] +\definecolor [floralwhite] [r=1.00,g=0.98,b=0.94] +\definecolor [forestgreen] [r=0.13,g=0.55,b=0.13] +\definecolor [gainsboro] [r=0.86,g=0.86,b=0.86] +\definecolor [ghostwhite] [r=0.97,g=0.97,b=1.00] +\definecolor [gold] [r=1.00,g=0.84,b=0.00] +\definecolor [goldenrod] [r=0.85,g=0.65,b=0.13] +\definecolor [green] [r=0.00,g=1.00,b=0.00] +\definecolor [greenyellow] [r=0.68,g=1.00,b=0.18] +\definecolor [honeydew] [r=0.94,g=1.00,b=0.94] +\definecolor [hotpink] [r=1.00,g=0.41,b=0.71] +\definecolor [indianred] [r=0.80,g=0.36,b=0.36] +\definecolor [ivory] [r=1.00,g=1.00,b=0.94] +\definecolor [khaki] [r=0.94,g=0.90,b=0.55] +\definecolor [lavender] [r=0.90,g=0.90,b=0.98] +\definecolor [lavenderblush] [r=1.00,g=0.94,b=0.96] +\definecolor [lawngreen] [r=0.49,g=0.99,b=0.00] +\definecolor [lemonchiffon] [r=1.00,g=0.98,b=0.80] +\definecolor [lightblue] [r=0.68,g=0.85,b=0.90] +\definecolor [lightcoral] [r=0.94,g=0.50,b=0.50] +\definecolor [lightcyan] [r=0.88,g=1.00,b=1.00] +\definecolor [lightgoldenrod] [r=0.93,g=0.87,b=0.51] +\definecolor [lightgoldenrodyellow] [r=0.98,g=0.98,b=0.82] +\definecolor [lightpink] [r=1.00,g=0.71,b=0.76] +\definecolor [lightsalmon] [r=1.00,g=0.63,b=0.48] +\definecolor [lightseagreen] [r=0.13,g=0.70,b=0.67] +\definecolor [lightskyblue] [r=0.53,g=0.81,b=0.98] +\definecolor [lightslateblue] [r=0.52,g=0.44,b=1.00] +\definecolor [lightsteelblue] [r=0.69,g=0.77,b=0.87] +\definecolor [lightyellow] [r=1.00,g=1.00,b=0.88] +\definecolor [limegreen] [r=0.20,g=0.80,b=0.20] +\definecolor [linen] [r=0.98,g=0.94,b=0.90] +\definecolor [magenta] [r=1.00,g=0.00,b=1.00] +\definecolor [maroon] [r=0.69,g=0.19,b=0.38] +\definecolor [mediumaquamarine] [r=0.40,g=0.80,b=0.67] +\definecolor [mediumblue] [r=0.00,g=0.00,b=0.80] +\definecolor [mediumorchid] [r=0.73,g=0.33,b=0.83] +\definecolor [mediumpurple] [r=0.58,g=0.44,b=0.86] +\definecolor [mediumseagreen] [r=0.24,g=0.70,b=0.44] +\definecolor [mediumslateblue] [r=0.48,g=0.41,b=0.93] +\definecolor [mediumspringgreen] [r=0.00,g=0.98,b=0.60] +\definecolor [mediumturquoise] [r=0.28,g=0.82,b=0.80] +\definecolor [mediumvioletred] [r=0.78,g=0.08,b=0.52] +\definecolor [midnightblue] [r=0.10,g=0.10,b=0.44] +\definecolor [mintcream] [r=0.96,g=1.00,b=0.98] +\definecolor [mistyrose] [r=1.00,g=0.89,b=0.88] +\definecolor [moccasin] [r=1.00,g=0.89,b=0.71] +\definecolor [navajowhite] [r=1.00,g=0.87,b=0.68] +\definecolor [navy] [r=0.00,g=0.00,b=0.50] +\definecolor [navyblue] [r=0.00,g=0.00,b=0.50] +\definecolor [oldlace] [r=0.99,g=0.96,b=0.90] +\definecolor [olivedrab] [r=0.42,g=0.56,b=0.14] +\definecolor [orange] [r=1.00,g=0.65,b=0.00] +\definecolor [orangered] [r=1.00,g=0.27,b=0.00] +\definecolor [orchid] [r=0.85,g=0.44,b=0.84] +\definecolor [palegoldenrod] [r=0.93,g=0.91,b=0.67] +\definecolor [palegreen] [r=0.60,g=0.98,b=0.60] +\definecolor [paleturquoise] [r=0.69,g=0.93,b=0.93] +\definecolor [palevioletred] [r=0.86,g=0.44,b=0.58] +\definecolor [papayawhip] [r=1.00,g=0.94,b=0.84] +\definecolor [peachpuff] [r=1.00,g=0.85,b=0.73] +\definecolor [peru] [r=0.80,g=0.52,b=0.25] +\definecolor [pink] [r=1.00,g=0.75,b=0.80] +\definecolor [plum] [r=0.87,g=0.63,b=0.87] +\definecolor [powderblue] [r=0.69,g=0.88,b=0.90] +\definecolor [purple] [r=0.63,g=0.13,b=0.94] +\definecolor [red ] [r=1.00,g=0.00,b=0.00] +\definecolor [rosybrown] [r=0.74,g=0.56,b=0.56] +\definecolor [royalblue] [r=0.25,g=0.41,b=0.88] +\definecolor [saddlebrown] [r=0.55,g=0.27,b=0.07] +\definecolor [salmon] [r=0.98,g=0.50,b=0.45] +\definecolor [sandybrown] [r=0.96,g=0.64,b=0.38] +\definecolor [seagreen] [r=0.18,g=0.55,b=0.34] +\definecolor [seashell] [r=1.00,g=0.96,b=0.93] +\definecolor [sienna] [r=0.63,g=0.32,b=0.18] +\definecolor [skyblue] [r=0.53,g=0.81,b=0.92] +\definecolor [slateblue] [r=0.42,g=0.35,b=0.80] +\definecolor [snow] [r=1.00,g=0.98,b=0.98] +\definecolor [springgreen] [r=0.00,g=1.00,b=0.50] +\definecolor [steelblue] [r=0.27,g=0.51,b=0.71] +\definecolor [tan ] [r=0.82,g=0.71,b=0.55] +\definecolor [thistle] [r=0.85,g=0.75,b=0.85] +\definecolor [tomato] [r=1.00,g=0.39,b=0.28] +\definecolor [turquoise] [r=0.25,g=0.88,b=0.82] +\definecolor [violet] [r=0.93,g=0.51,b=0.93] +\definecolor [violetred] [r=0.82,g=0.13,b=0.56] +\definecolor [wheat] [r=0.96,g=0.87,b=0.70] +\definecolor [white] [r=1.00,g=1.00,b=1.00] +\definecolor [whitesmoke] [s=0.96] % [r=0.96,g=0.96,b=0.96] +\definecolor [yellow] [r=1.00,g=1.00,b=0.00] +\definecolor [yellowgreen] [r=0.60,g=0.80,b=0.20] + +\endinput diff --git a/Master/texmf-dist/tex/context/base/colo-xwi.tex b/Master/texmf-dist/tex/context/base/colo-xwi.tex deleted file mode 100644 index 81e09d871bc..00000000000 --- a/Master/texmf-dist/tex/context/base/colo-xwi.tex +++ /dev/null @@ -1,142 +0,0 @@ -%D \module -%D [ file=colo-xwi, -%D version=1995.01.01, -%D title=\CONTEXT\ Color Macros, -%D subtitle=X Windows, -%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 I've forgotten where I got these definitions from, but maybe -%D they can be of use. - -\definecolor [aliceblue] [r=0.94,g=0.97,b=1.00] -\definecolor [antiquewhite] [r=0.98,g=0.92,b=0.84] -\definecolor [aquamarine] [r=0.50,g=1.00,b=0.83] -\definecolor [azure] [r=0.94,g=1.00,b=1.00] -\definecolor [beige] [r=0.96,g=0.96,b=0.86] -\definecolor [bisque] [r=1.00,g=0.89,b=0.77] -\definecolor [black] [s=0] % [r=0.00,g=0.00,b=0.00] -\definecolor [blanchedalmond] [r=1.00,g=0.92,b=0.80] -\definecolor [blue] [r=0.00,g=0.00,b=1.00] -\definecolor [blueviolet] [r=0.54,g=0.17,b=0.89] -\definecolor [brown] [r=0.65,g=0.16,b=0.16] -\definecolor [burlywood] [r=0.87,g=0.72,b=0.53] -\definecolor [cadetblue] [r=0.37,g=0.62,b=0.63] -\definecolor [chartreuse] [r=0.50,g=1.00,b=0.00] -\definecolor [chocolate] [r=0.82,g=0.41,b=0.12] -\definecolor [coral] [r=1.00,g=0.50,b=0.31] -\definecolor [cornflowerblue] [r=0.39,g=0.58,b=0.93] -\definecolor [cornsilk] [r=1.00,g=0.97,b=0.86] -\definecolor [cyan] [r=0.00,g=1.00,b=1.00] -\definecolor [darkgoldenrod] [r=0.72,g=0.53,b=0.04] -\definecolor [darkgreen] [r=0.00,g=0.39,b=0.00] -\definecolor [darkkhaki] [r=0.74,g=0.72,b=0.42] -\definecolor [darkolivegreen] [r=0.33,g=0.42,b=0.18] -\definecolor [darkorange] [r=1.00,g=0.55,b=0.00] -\definecolor [darkorchid] [r=0.60,g=0.20,b=0.80] -\definecolor [darksalmon] [r=0.91,g=0.59,b=0.48] -\definecolor [darkseagreen] [r=0.56,g=0.74,b=0.56] -\definecolor [darkslateblue] [r=0.28,g=0.24,b=0.55] -\definecolor [darkturquoise] [r=0.00,g=0.81,b=0.82] -\definecolor [darkviolet] [r=0.58,g=0.00,b=0.83] -\definecolor [deeppink] [r=1.00,g=0.08,b=0.58] -\definecolor [deepskyblue] [r=0.00,g=0.75,b=1.00] -\definecolor [dodgerblue] [r=0.12,g=0.56,b=1.00] -\definecolor [firebrick] [r=0.70,g=0.13,b=0.13] -\definecolor [floralwhite] [r=1.00,g=0.98,b=0.94] -\definecolor [forestgreen] [r=0.13,g=0.55,b=0.13] -\definecolor [gainsboro] [r=0.86,g=0.86,b=0.86] -\definecolor [ghostwhite] [r=0.97,g=0.97,b=1.00] -\definecolor [gold] [r=1.00,g=0.84,b=0.00] -\definecolor [goldenrod] [r=0.85,g=0.65,b=0.13] -\definecolor [green] [r=0.00,g=1.00,b=0.00] -\definecolor [greenyellow] [r=0.68,g=1.00,b=0.18] -\definecolor [honeydew] [r=0.94,g=1.00,b=0.94] -\definecolor [hotpink] [r=1.00,g=0.41,b=0.71] -\definecolor [indianred] [r=0.80,g=0.36,b=0.36] -\definecolor [ivory] [r=1.00,g=1.00,b=0.94] -\definecolor [khaki] [r=0.94,g=0.90,b=0.55] -\definecolor [lavender] [r=0.90,g=0.90,b=0.98] -\definecolor [lavenderblush] [r=1.00,g=0.94,b=0.96] -\definecolor [lawngreen] [r=0.49,g=0.99,b=0.00] -\definecolor [lemonchiffon] [r=1.00,g=0.98,b=0.80] -\definecolor [lightblue] [r=0.68,g=0.85,b=0.90] -\definecolor [lightcoral] [r=0.94,g=0.50,b=0.50] -\definecolor [lightcyan] [r=0.88,g=1.00,b=1.00] -\definecolor [lightgoldenrod] [r=0.93,g=0.87,b=0.51] -\definecolor [lightgoldenrodyellow] [r=0.98,g=0.98,b=0.82] -\definecolor [lightpink] [r=1.00,g=0.71,b=0.76] -\definecolor [lightsalmon] [r=1.00,g=0.63,b=0.48] -\definecolor [lightseagreen] [r=0.13,g=0.70,b=0.67] -\definecolor [lightskyblue] [r=0.53,g=0.81,b=0.98] -\definecolor [lightslateblue] [r=0.52,g=0.44,b=1.00] -\definecolor [lightsteelblue] [r=0.69,g=0.77,b=0.87] -\definecolor [lightyellow] [r=1.00,g=1.00,b=0.88] -\definecolor [limegreen] [r=0.20,g=0.80,b=0.20] -\definecolor [linen] [r=0.98,g=0.94,b=0.90] -\definecolor [magenta] [r=1.00,g=0.00,b=1.00] -\definecolor [maroon] [r=0.69,g=0.19,b=0.38] -\definecolor [mediumaquamarine] [r=0.40,g=0.80,b=0.67] -\definecolor [mediumblue] [r=0.00,g=0.00,b=0.80] -\definecolor [mediumorchid] [r=0.73,g=0.33,b=0.83] -\definecolor [mediumpurple] [r=0.58,g=0.44,b=0.86] -\definecolor [mediumseagreen] [r=0.24,g=0.70,b=0.44] -\definecolor [mediumslateblue] [r=0.48,g=0.41,b=0.93] -\definecolor [mediumspringgreen] [r=0.00,g=0.98,b=0.60] -\definecolor [mediumturquoise] [r=0.28,g=0.82,b=0.80] -\definecolor [mediumvioletred] [r=0.78,g=0.08,b=0.52] -\definecolor [midnightblue] [r=0.10,g=0.10,b=0.44] -\definecolor [mintcream] [r=0.96,g=1.00,b=0.98] -\definecolor [mistyrose] [r=1.00,g=0.89,b=0.88] -\definecolor [moccasin] [r=1.00,g=0.89,b=0.71] -\definecolor [navajowhite] [r=1.00,g=0.87,b=0.68] -\definecolor [navy] [r=0.00,g=0.00,b=0.50] -\definecolor [navyblue] [r=0.00,g=0.00,b=0.50] -\definecolor [oldlace] [r=0.99,g=0.96,b=0.90] -\definecolor [olivedrab] [r=0.42,g=0.56,b=0.14] -\definecolor [orange] [r=1.00,g=0.65,b=0.00] -\definecolor [orangered] [r=1.00,g=0.27,b=0.00] -\definecolor [orchid] [r=0.85,g=0.44,b=0.84] -\definecolor [palegoldenrod] [r=0.93,g=0.91,b=0.67] -\definecolor [palegreen] [r=0.60,g=0.98,b=0.60] -\definecolor [paleturquoise] [r=0.69,g=0.93,b=0.93] -\definecolor [palevioletred] [r=0.86,g=0.44,b=0.58] -\definecolor [papayawhip] [r=1.00,g=0.94,b=0.84] -\definecolor [peachpuff] [r=1.00,g=0.85,b=0.73] -\definecolor [peru] [r=0.80,g=0.52,b=0.25] -\definecolor [pink] [r=1.00,g=0.75,b=0.80] -\definecolor [plum] [r=0.87,g=0.63,b=0.87] -\definecolor [powderblue] [r=0.69,g=0.88,b=0.90] -\definecolor [purple] [r=0.63,g=0.13,b=0.94] -\definecolor [red ] [r=1.00,g=0.00,b=0.00] -\definecolor [rosybrown] [r=0.74,g=0.56,b=0.56] -\definecolor [royalblue] [r=0.25,g=0.41,b=0.88] -\definecolor [saddlebrown] [r=0.55,g=0.27,b=0.07] -\definecolor [salmon] [r=0.98,g=0.50,b=0.45] -\definecolor [sandybrown] [r=0.96,g=0.64,b=0.38] -\definecolor [seagreen] [r=0.18,g=0.55,b=0.34] -\definecolor [seashell] [r=1.00,g=0.96,b=0.93] -\definecolor [sienna] [r=0.63,g=0.32,b=0.18] -\definecolor [skyblue] [r=0.53,g=0.81,b=0.92] -\definecolor [slateblue] [r=0.42,g=0.35,b=0.80] -\definecolor [snow] [r=1.00,g=0.98,b=0.98] -\definecolor [springgreen] [r=0.00,g=1.00,b=0.50] -\definecolor [steelblue] [r=0.27,g=0.51,b=0.71] -\definecolor [tan ] [r=0.82,g=0.71,b=0.55] -\definecolor [thistle] [r=0.85,g=0.75,b=0.85] -\definecolor [tomato] [r=1.00,g=0.39,b=0.28] -\definecolor [turquoise] [r=0.25,g=0.88,b=0.82] -\definecolor [violet] [r=0.93,g=0.51,b=0.93] -\definecolor [violetred] [r=0.82,g=0.13,b=0.56] -\definecolor [wheat] [r=0.96,g=0.87,b=0.70] -\definecolor [white] [r=1.00,g=1.00,b=1.00] -\definecolor [whitesmoke] [s=0.96] % [r=0.96,g=0.96,b=0.96] -\definecolor [yellow] [r=1.00,g=1.00,b=0.00] -\definecolor [yellowgreen] [r=0.60,g=0.80,b=0.20] - -\endinput diff --git a/Master/texmf-dist/tex/context/base/cont-cs.mkii b/Master/texmf-dist/tex/context/base/cont-cs.mkii new file mode 100644 index 00000000000..714bf956869 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-cs.mkii @@ -0,0 +1,21 @@ +%D \module +%D [ file=cont-cs, +%D version=1998.12.02, +%D title=\CONTEXT, +%D subtitle=\CONTEXT\ Czech Format Generation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\catcode`\{=1 \catcode`\}=2 + +\def\defaultinterface {czech} +\def\defaultlanguagetag{cs} + +\input context.mkii + +\endinput diff --git a/Master/texmf-dist/tex/context/base/cont-cs.mkiv b/Master/texmf-dist/tex/context/base/cont-cs.mkiv new file mode 100644 index 00000000000..e1805b1c9ee --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-cs.mkiv @@ -0,0 +1,21 @@ +%D \module +%D [ file=cont-cs, +%D version=1998.12.02, +%D title=\CONTEXT, +%D subtitle=\CONTEXT\ Czech Format Generation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\catcode`\{=1 \catcode`\}=2 + +\def\defaultinterface {czech} +\def\defaultlanguagetag{cs} + +\input context.mkiv + +\endinput diff --git a/Master/texmf-dist/tex/context/base/cont-cs.tex b/Master/texmf-dist/tex/context/base/cont-cs.tex deleted file mode 100644 index f878920aac8..00000000000 --- a/Master/texmf-dist/tex/context/base/cont-cs.tex +++ /dev/null @@ -1,39 +0,0 @@ -%D \module -%D [ file=cont-cs, -%D version=1998.12.02, -%D title=\CONTEXT, -%D subtitle=\CONTEXT\ Czech Format Generation, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{czech} - -\input context.tex - -\unprotect - -\setupcurrentlanguage[\s!cs] - -\loaduserspecifications - -\installlanguage [\s!en] [\c!state=\v!start] -\installlanguage [\s!de] [\c!state=\v!start] -\installlanguage [\s!sk] [\c!state=\v!start] -\installlanguage [\s!cs] [\c!state=\v!start] - -\ifnum\texengine=\luatexengine - % will be runtime option: typeface - \appendtoks - \usetypescript[modern] - \setuptypeface[modern] - \to \everyjob -\else - \setupencoding[default=ec] \usetypescript[fallback][\defaultencoding] \setupbodyfont[rm,12pt] -\fi - -\protect \errorstopmode \dump \endinput diff --git a/Master/texmf-dist/tex/context/base/cont-de.mkii b/Master/texmf-dist/tex/context/base/cont-de.mkii new file mode 100644 index 00000000000..a110f67d2a4 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-de.mkii @@ -0,0 +1,21 @@ +%D \module +%D [ file=cont-de, +%D version=1997.08.19, +%D title=\CONTEXT, +%D subtitle=\CONTEXT\ German Format Generation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\catcode`\{=1 \catcode`\}=2 + +\def\defaultinterface {german} +\def\defaultlanguagetag{de} + +\input context.mkii + +\endinput diff --git a/Master/texmf-dist/tex/context/base/cont-de.mkiv b/Master/texmf-dist/tex/context/base/cont-de.mkiv new file mode 100644 index 00000000000..1f41797816c --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-de.mkiv @@ -0,0 +1,21 @@ +%D \module +%D [ file=cont-de, +%D version=1997.08.19, +%D title=\CONTEXT, +%D subtitle=\CONTEXT\ German Format Generation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\catcode`\{=1 \catcode`\}=2 + +\def\defaultinterface {german} +\def\defaultlanguagetag{de} + +\input context.mkiv + +\endinput diff --git a/Master/texmf-dist/tex/context/base/cont-de.tex b/Master/texmf-dist/tex/context/base/cont-de.tex deleted file mode 100644 index 460ca7eca1a..00000000000 --- a/Master/texmf-dist/tex/context/base/cont-de.tex +++ /dev/null @@ -1,44 +0,0 @@ -%D \module -%D [ file=cont-de, -%D version=1997.08.19, -%D title=\CONTEXT, -%D subtitle=\CONTEXT\ German Format Generation, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{german} - -\input context.tex - -\unprotect - -\setupcurrentlanguage[\s!de] - -\loaduserspecifications - -\installlanguage [\s!us] [\c!state=\v!start] -\installlanguage [\s!gb] [\c!state=\v!start] -\installlanguage [\s!de] [\c!state=\v!start] -\installlanguage [\s!fr] [\c!state=\v!start] -\installlanguage [\s!es] [\c!state=\v!start] -\installlanguage [\s!nl] [\c!state=\v!start] -\installlanguage [\s!it] [\c!state=\v!start] - -\installlanguage [deo] [\c!state=\v!start] - -\ifnum\texengine=\luatexengine - % will be runtime option: typeface - \appendtoks - \usetypescript[modern] - \setuptypeface[modern] - \to \everyjob -\else - \setupencoding[default=ec] \usetypescript[fallback][\defaultencoding] \setupbodyfont[rm,12pt] -\fi - -\protect \errorstopmode \dump \endinput diff --git a/Master/texmf-dist/tex/context/base/cont-en.mkii b/Master/texmf-dist/tex/context/base/cont-en.mkii new file mode 100644 index 00000000000..c3d510f981a --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-en.mkii @@ -0,0 +1,21 @@ +%D \module +%D [ file=cont-en, +%D version=1997.08.19, +%D title=\CONTEXT, +%D subtitle=\CONTEXT\ English Format Generation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\catcode`\{=1 \catcode`\}=2 + +\def\defaultinterface {english} +\def\defaultlanguagetag{en} + +\input context.mkii + +\endinput diff --git a/Master/texmf-dist/tex/context/base/cont-en.mkiv b/Master/texmf-dist/tex/context/base/cont-en.mkiv new file mode 100644 index 00000000000..1bf182cd8d4 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-en.mkiv @@ -0,0 +1,21 @@ +%D \module +%D [ file=cont-en, +%D version=1997.08.19, +%D title=\CONTEXT, +%D subtitle=\CONTEXT\ English Format Generation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\catcode`\{=1 \catcode`\}=2 + +\def\defaultinterface {english} +\def\defaultlanguagetag{en} + +\input context.mkiv + +\endinput diff --git a/Master/texmf-dist/tex/context/base/cont-en.tex b/Master/texmf-dist/tex/context/base/cont-en.tex deleted file mode 100644 index e2b09ecbe54..00000000000 --- a/Master/texmf-dist/tex/context/base/cont-en.tex +++ /dev/null @@ -1,46 +0,0 @@ -%D \module -%D [ file=cont-en, -%D version=1997.08.19, -%D title=\CONTEXT, -%D subtitle=\CONTEXT\ English Format Generation, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{english} - -\input context.tex - -\unprotect - -\setupcurrentlanguage[\s!en] - -\loaduserspecifications - -% Do we need more defaults? or maybe all languages? - -\installlanguage [\s!us] [\c!state=\v!start] -\installlanguage [\s!gb] [\c!state=\v!start] -\installlanguage [\s!de] [\c!state=\v!start] -\installlanguage [\s!fr] [\c!state=\v!start] -\installlanguage [\s!es] [\c!state=\v!start] -\installlanguage [\s!pt] [\c!state=\v!start] -\installlanguage [\s!it] [\c!state=\v!start] -\installlanguage [\s!nl] [\c!state=\v!start] -\installlanguage [\s!cs] [\c!state=\v!start] -\installlanguage [\s!sk] [\c!state=\v!start] -\installlanguage [\s!pl] [\c!state=\v!start] - -\ifnum\texengine=\luatexengine -% \prependtoks -% \the \everysetupdocument -% \to \everyjob -\else - \setupencoding[default=ec] \usetypescript[fallback][\defaultencoding] \setupbodyfont[rm,12pt] -\fi - -\protect \errorstopmode \dump \endinput diff --git a/Master/texmf-dist/tex/context/base/cont-err.mkii b/Master/texmf-dist/tex/context/base/cont-err.mkii new file mode 100644 index 00000000000..f01ce87aadb --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-err.mkii @@ -0,0 +1,18 @@ +%D \module +%D [ file=cont-err, +%D version=2003.08.12, +%D title=\CONTEXT\ System Files, +%D subtitle=Just A warning, +%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 + +\writestatus\m!systems{no file 'cont-sys.tex', using 'cont-sys.rme' instead} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/cont-err.tex b/Master/texmf-dist/tex/context/base/cont-err.tex deleted file mode 100644 index f01ce87aadb..00000000000 --- a/Master/texmf-dist/tex/context/base/cont-err.tex +++ /dev/null @@ -1,18 +0,0 @@ -%D \module -%D [ file=cont-err, -%D version=2003.08.12, -%D title=\CONTEXT\ System Files, -%D subtitle=Just A warning, -%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 - -\writestatus\m!systems{no file 'cont-sys.tex', using 'cont-sys.rme' instead} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/cont-fil.mkii b/Master/texmf-dist/tex/context/base/cont-fil.mkii new file mode 100644 index 00000000000..b295872ca0c --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-fil.mkii @@ -0,0 +1,124 @@ +%D \module +%D [ file=cont-fil, +%D version=1997.11.15, +%D title=\CONTEXT\ Miscellaneous Macros, +%D subtitle=File Synonyms, +%D author=J. 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 File Synonyms} + +\definefilesynonym [chemie] [chemic] +\definefilesynonym [chemics] [chemic] + +\definefilesynonym [unit] [units] +\definefilesynonym [eenheid] [units] +\definefilesynonym [einheit] [units] + +\definefilesynonym [pstric] [pstricks] +\definefilesynonym [pstrick] [pstricks] + +\definefilesynonym [finance] [financ] + +\definefilesynonym [con-01] [contml] % will go away + +%definefilesynonym [sch-base] [sch-00] +%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] +\definefilesynonym [xml-analyze] [xml-11] + +\definefilesynonym [int-load] [set-11] +\definefilesynonym [int-make] [set-12] + +\definefilesynonym [fig-base] [fig-00] +\definefilesynonym [fig-make] [fig-01] +\definefilesynonym [fig-fake] [fig-02] +\definefilesynonym [fig-missing] [fig-06] + +\definefilesynonym [exi-interface] [exi-21] + +\definefilesynonym [res-make] [res-01] +\definefilesynonym [res-base] [res-04] +\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] + +\definefilesynonym [pre-general] [pre-00] + +\definefilesynonym [pre-original] [pre-01] +\definefilesynonym [pre-green] [pre-02] +\definefilesynonym [pre-funny] [pre-03] +\definefilesynonym [pre-colorful] [pre-04] +\definefilesynonym [pre-fuzzy] [pre-05] +\definefilesynonym [pre-polish] [pre-06] +\definefilesynonym [pre-spider] [pre-07] +\definefilesynonym [pre-wonder] [pre-08] +\definefilesynonym [pre-windows] [pre-09] +\definefilesynonym [pre-grow] [pre-10] +\definefilesynonym [pre-stack] [pre-11] +\definefilesynonym [pre-arrows] [pre-12] +\definefilesynonym [pre-writing] [pre-13] +\definefilesynonym [pre-split] [pre-14] +\definefilesynonym [pre-balls] [pre-15] +\definefilesynonym [pre-knot] [pre-16] +\definefilesynonym [pre-weird] [pre-17] +\definefilesynonym [pre-shade] [pre-18] +\definefilesynonym [pre-organic] [pre-19] +\definefilesynonym [pre-speckle] [pre-20] +\definefilesynonym [pre-zoom] [pre-21] +\definefilesynonym [pre-cycle] [pre-22] +\definefilesynonym [pre-super] [pre-23] + +%definefilesynonym [pre-more] [pre-24] +%definefilesynonym [pre-more] [pre-25] + +\definefilesynonym [pre-more] [pre-26] + +%definefilesynonym [pre-more] [pre-27] +%definefilesynonym [pre-more] [pre-28] +%definefilesynonym [pre-more] [pre-29] +%definefilesynonym [pre-more] [pre-30] + +\definefilesynonym [pre-stepwise] [pre-60] +\definefilesynonym [pre-stepper] [pre-61] + +\definefilesynonym [pre-punk] [pre-70] +\definefilesynonym [pre-random] [pre-71] + +\definefilesynonym [abr-pseudocaps] [abr-01] +\definefilesynonym [abr-smallcaps] [abr-02] + +\definefilesynonym [chinese] [chi-00] +\definefilesynonym [japanese] [jap-00] + +%definefilesynonym [chi-simplified] [chi-01] +%definefilesynonym [chi-traditional] [chi-02] + +\definefilesynonym [greek] [grk-00] + +\definefilesynonym [unic-chi] [unic-cjk] +\definefilesynonym [unic-jap] [unic-cjk] + +%definefilesynonym [practexjournal] [ptj-01] +\definefilesynonym [pracjourn] [ptj-01] + +\definefilesynonym [maps] [map-10] +\definefilesynonym [map-se] [map-10] % for some time + +\definefilesynonym [mml] [mathml] +\definefilesynonym [cml] [chemml] + +\endinput diff --git a/Master/texmf-dist/tex/context/base/cont-fil.mkiv b/Master/texmf-dist/tex/context/base/cont-fil.mkiv new file mode 100644 index 00000000000..2468f299861 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-fil.mkiv @@ -0,0 +1,96 @@ +%D \module +%D [ file=cont-fil, +%D version=1997.11.15, +%D title=\CONTEXT\ Miscellaneous Macros, +%D subtitle=File Synonyms, +%D author=J. 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 File Synonyms} + +\definefilesynonym [chemics] [chemic] + +\definefilesynonym [unit] [units] + +\definefilesynonym [pstric] [pstricks] +\definefilesynonym [pstrick] [pstricks] + +\definefilesynonym [finance] [financ] + +\definefilesynonym [dir-make] [dir-01] +\definefilesynonym [dir-identify] [dir-05] + +\definefilesynonym [int-load] [set-11] +\definefilesynonym [int-make] [set-12] + + \definefilesynonym [fig-base] [fig-00] + \definefilesynonym [fig-make] [fig-01] + \definefilesynonym [fig-fake] [fig-02] + \definefilesynonym [fig-missing] [fig-06] + +\definefilesynonym [exi-interface] [exi-21] + + \definefilesynonym [res-make] [res-01] + \definefilesynonym [res-base] [res-04] + \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] + +\definefilesynonym [pre-general] [pre-00] + +\definefilesynonym [pre-original] [pre-01] +\definefilesynonym [pre-green] [pre-02] +\definefilesynonym [pre-funny] [pre-03] +\definefilesynonym [pre-colorful] [pre-04] +\definefilesynonym [pre-fuzzy] [pre-05] +\definefilesynonym [pre-polish] [pre-06] +\definefilesynonym [pre-spider] [pre-07] +\definefilesynonym [pre-wonder] [pre-08] +\definefilesynonym [pre-windows] [pre-09] +\definefilesynonym [pre-grow] [pre-10] +\definefilesynonym [pre-stack] [pre-11] +\definefilesynonym [pre-arrows] [pre-12] +\definefilesynonym [pre-writing] [pre-13] +\definefilesynonym [pre-split] [pre-14] +\definefilesynonym [pre-balls] [pre-15] +\definefilesynonym [pre-knot] [pre-16] +\definefilesynonym [pre-weird] [pre-17] +\definefilesynonym [pre-shade] [pre-18] +\definefilesynonym [pre-organic] [pre-19] +\definefilesynonym [pre-speckle] [pre-20] +\definefilesynonym [pre-zoom] [pre-21] +\definefilesynonym [pre-cycle] [pre-22] +\definefilesynonym [pre-super] [pre-23] + +%definefilesynonym [pre-more] [pre-24] +%definefilesynonym [pre-more] [pre-25] +\definefilesynonym [pre-more] [pre-26] +%definefilesynonym [pre-more] [pre-27] +%definefilesynonym [pre-more] [pre-28] +%definefilesynonym [pre-more] [pre-29] +%definefilesynonym [pre-more] [pre-30] + +\definefilesynonym [pre-stepwise] [pre-60] +\definefilesynonym [pre-stepper] [pre-61] + +\definefilesynonym [pre-punk] [pre-70] +\definefilesynonym [pre-random] [pre-71] + +\definefilesynonym [abr-pseudocaps] [abr-01] +\definefilesynonym [abr-smallcaps] [abr-02] + +\definefilesynonym [pracjourn] [ptj-01] +\definefilesynonym [maps] [map-10] + +\definefilesynonym [mml] [mathml] +\definefilesynonym [cml] [chemml] + +\endinput diff --git a/Master/texmf-dist/tex/context/base/cont-fil.tex b/Master/texmf-dist/tex/context/base/cont-fil.tex deleted file mode 100644 index b295872ca0c..00000000000 --- a/Master/texmf-dist/tex/context/base/cont-fil.tex +++ /dev/null @@ -1,124 +0,0 @@ -%D \module -%D [ file=cont-fil, -%D version=1997.11.15, -%D title=\CONTEXT\ Miscellaneous Macros, -%D subtitle=File Synonyms, -%D author=J. 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 File Synonyms} - -\definefilesynonym [chemie] [chemic] -\definefilesynonym [chemics] [chemic] - -\definefilesynonym [unit] [units] -\definefilesynonym [eenheid] [units] -\definefilesynonym [einheit] [units] - -\definefilesynonym [pstric] [pstricks] -\definefilesynonym [pstrick] [pstricks] - -\definefilesynonym [finance] [financ] - -\definefilesynonym [con-01] [contml] % will go away - -%definefilesynonym [sch-base] [sch-00] -%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] -\definefilesynonym [xml-analyze] [xml-11] - -\definefilesynonym [int-load] [set-11] -\definefilesynonym [int-make] [set-12] - -\definefilesynonym [fig-base] [fig-00] -\definefilesynonym [fig-make] [fig-01] -\definefilesynonym [fig-fake] [fig-02] -\definefilesynonym [fig-missing] [fig-06] - -\definefilesynonym [exi-interface] [exi-21] - -\definefilesynonym [res-make] [res-01] -\definefilesynonym [res-base] [res-04] -\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] - -\definefilesynonym [pre-general] [pre-00] - -\definefilesynonym [pre-original] [pre-01] -\definefilesynonym [pre-green] [pre-02] -\definefilesynonym [pre-funny] [pre-03] -\definefilesynonym [pre-colorful] [pre-04] -\definefilesynonym [pre-fuzzy] [pre-05] -\definefilesynonym [pre-polish] [pre-06] -\definefilesynonym [pre-spider] [pre-07] -\definefilesynonym [pre-wonder] [pre-08] -\definefilesynonym [pre-windows] [pre-09] -\definefilesynonym [pre-grow] [pre-10] -\definefilesynonym [pre-stack] [pre-11] -\definefilesynonym [pre-arrows] [pre-12] -\definefilesynonym [pre-writing] [pre-13] -\definefilesynonym [pre-split] [pre-14] -\definefilesynonym [pre-balls] [pre-15] -\definefilesynonym [pre-knot] [pre-16] -\definefilesynonym [pre-weird] [pre-17] -\definefilesynonym [pre-shade] [pre-18] -\definefilesynonym [pre-organic] [pre-19] -\definefilesynonym [pre-speckle] [pre-20] -\definefilesynonym [pre-zoom] [pre-21] -\definefilesynonym [pre-cycle] [pre-22] -\definefilesynonym [pre-super] [pre-23] - -%definefilesynonym [pre-more] [pre-24] -%definefilesynonym [pre-more] [pre-25] - -\definefilesynonym [pre-more] [pre-26] - -%definefilesynonym [pre-more] [pre-27] -%definefilesynonym [pre-more] [pre-28] -%definefilesynonym [pre-more] [pre-29] -%definefilesynonym [pre-more] [pre-30] - -\definefilesynonym [pre-stepwise] [pre-60] -\definefilesynonym [pre-stepper] [pre-61] - -\definefilesynonym [pre-punk] [pre-70] -\definefilesynonym [pre-random] [pre-71] - -\definefilesynonym [abr-pseudocaps] [abr-01] -\definefilesynonym [abr-smallcaps] [abr-02] - -\definefilesynonym [chinese] [chi-00] -\definefilesynonym [japanese] [jap-00] - -%definefilesynonym [chi-simplified] [chi-01] -%definefilesynonym [chi-traditional] [chi-02] - -\definefilesynonym [greek] [grk-00] - -\definefilesynonym [unic-chi] [unic-cjk] -\definefilesynonym [unic-jap] [unic-cjk] - -%definefilesynonym [practexjournal] [ptj-01] -\definefilesynonym [pracjourn] [ptj-01] - -\definefilesynonym [maps] [map-10] -\definefilesynonym [map-se] [map-10] % for some time - -\definefilesynonym [mml] [mathml] -\definefilesynonym [cml] [chemml] - -\endinput diff --git a/Master/texmf-dist/tex/context/base/cont-fr.mkii b/Master/texmf-dist/tex/context/base/cont-fr.mkii new file mode 100644 index 00000000000..6f1e806ad0e --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-fr.mkii @@ -0,0 +1,21 @@ +%D \module +%D [ file=cont-de, +%D version=1997.08.19, +%D title=\CONTEXT, +%D subtitle=\CONTEXT\ French Format Generation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\catcode`\{=1 \catcode`\}=2 + +\def\defaultinterface {french} +\def\defaultlanguagetag{fr} + +\input context.mkii + +\endinput diff --git a/Master/texmf-dist/tex/context/base/cont-fr.mkiv b/Master/texmf-dist/tex/context/base/cont-fr.mkiv new file mode 100644 index 00000000000..5b0946625e8 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-fr.mkiv @@ -0,0 +1,21 @@ +%D \module +%D [ file=cont-de, +%D version=1997.08.19, +%D title=\CONTEXT, +%D subtitle=\CONTEXT\ French Format Generation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\catcode`\{=1 \catcode`\}=2 + +\def\defaultinterface {french} +\def\defaultlanguagetag{fr} + +\input context.mkiv + +\endinput diff --git a/Master/texmf-dist/tex/context/base/cont-fr.tex b/Master/texmf-dist/tex/context/base/cont-fr.tex deleted file mode 100644 index d812b28f9b0..00000000000 --- a/Master/texmf-dist/tex/context/base/cont-fr.tex +++ /dev/null @@ -1,42 +0,0 @@ -%D \module -%D [ file=cont-de, -%D version=1997.08.19, -%D title=\CONTEXT, -%D subtitle=\CONTEXT\ French Format Generation, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{french} - -\input context.tex - -\unprotect - -\setupcurrentlanguage[\s!fr] - -\loaduserspecifications - -\installlanguage [\s!us] [\c!state=\v!start] -\installlanguage [\s!gb] [\c!state=\v!start] -\installlanguage [\s!de] [\c!state=\v!start] -\installlanguage [\s!fr] [\c!state=\v!start] -\installlanguage [\s!es] [\c!state=\v!start] -\installlanguage [\s!nl] [\c!state=\v!start] -\installlanguage [\s!it] [\c!state=\v!start] - -\ifnum\texengine=\luatexengine - % will be runtime option: typeface - \appendtoks - \usetypescript[modern] - \setuptypeface[modern] - \to \everyjob -\else - \setupencoding[default=ec] \usetypescript[fallback][\defaultencoding] \setupbodyfont[rm,12pt] -\fi - -\protect \errorstopmode \dump \endinput diff --git a/Master/texmf-dist/tex/context/base/cont-gb.mkii b/Master/texmf-dist/tex/context/base/cont-gb.mkii new file mode 100644 index 00000000000..35b7c85a4e5 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-gb.mkii @@ -0,0 +1,21 @@ +%D \module +%D [ file=cont-uk, +%D version=1997.08.19, +%D title=\CONTEXT, +%D subtitle=\CONTEXT\ English Format Generation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\catcode`\{=1 \catcode`\}=2 + +\def\defaultinterface {english} +\def\defaultlanguagetag{gb} + +\input context.mkii + +\endinput diff --git a/Master/texmf-dist/tex/context/base/cont-gb.mkiv b/Master/texmf-dist/tex/context/base/cont-gb.mkiv new file mode 100644 index 00000000000..3a4ed609bac --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-gb.mkiv @@ -0,0 +1,21 @@ +%D \module +%D [ file=cont-uk, +%D version=1997.08.19, +%D title=\CONTEXT, +%D subtitle=\CONTEXT\ English Format Generation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\catcode`\{=1 \catcode`\}=2 + +\def\defaultinterface {english} +\def\defaultlanguagetag{gb} + +\input context.mkiv + +\endinput diff --git a/Master/texmf-dist/tex/context/base/cont-gb.tex b/Master/texmf-dist/tex/context/base/cont-gb.tex deleted file mode 100644 index 99d2974257e..00000000000 --- a/Master/texmf-dist/tex/context/base/cont-gb.tex +++ /dev/null @@ -1,42 +0,0 @@ -%D \module -%D [ file=cont-uk, -%D version=1997.08.19, -%D title=\CONTEXT, -%D subtitle=\CONTEXT\ English Format Generation, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{english} - -\input context.tex - -\unprotect - -\setupcurrentlanguage[\s!gb] - -\loaduserspecifications - -\installlanguage [\s!us] [\c!state=\v!start] -\installlanguage [\s!gb] [\c!state=\v!start] -\installlanguage [\s!de] [\c!state=\v!start] -\installlanguage [\s!fr] [\c!state=\v!start] -\installlanguage [\s!es] [\c!state=\v!start] -\installlanguage [\s!nl] [\c!state=\v!start] -\installlanguage [\s!it] [\c!state=\v!start] - -\ifnum\texengine=\luatexengine - % will be runtime option: typeface - \appendtoks - \usetypescript[modern] - \setuptypeface[modern] - \to \everyjob -\else - \setupencoding[default=ec] \usetypescript[fallback][\defaultencoding] \setupbodyfont[rm,12pt] -\fi - -\protect \errorstopmode \dump \endinput diff --git a/Master/texmf-dist/tex/context/base/cont-it.mkii b/Master/texmf-dist/tex/context/base/cont-it.mkii new file mode 100644 index 00000000000..c594a0659cc --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-it.mkii @@ -0,0 +1,21 @@ +%D \module +%D [ file=cont-it, +%D version=1997.08.19, +%D title=\CONTEXT, +%D subtitle=\CONTEXT\ Italian Format Generation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\catcode`\{=1 \catcode`\}=2 + +\def\defaultinterface {italian} +\def\defaultlanguagetag{it} + +\input context.mkii + +\endinput diff --git a/Master/texmf-dist/tex/context/base/cont-it.mkiv b/Master/texmf-dist/tex/context/base/cont-it.mkiv new file mode 100644 index 00000000000..af7a1149e6f --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-it.mkiv @@ -0,0 +1,21 @@ +%D \module +%D [ file=cont-it, +%D version=1997.08.19, +%D title=\CONTEXT, +%D subtitle=\CONTEXT\ Italian Format Generation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\catcode`\{=1 \catcode`\}=2 + +\def\defaultinterface {italian} +\def\defaultlanguagetag{it} + +\input context.mkiv + +\endinput diff --git a/Master/texmf-dist/tex/context/base/cont-it.tex b/Master/texmf-dist/tex/context/base/cont-it.tex deleted file mode 100644 index 2141e3bc91b..00000000000 --- a/Master/texmf-dist/tex/context/base/cont-it.tex +++ /dev/null @@ -1,41 +0,0 @@ -%D \module -%D [ file=cont-it, -%D version=1997.08.19, -%D title=\CONTEXT, -%D subtitle=\CONTEXT\ Italian Format Generation, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{italian} - -\input context.tex - -\unprotect - -\setupcurrentlanguage[\s!it] - -\loaduserspecifications - -\installlanguage [\s!us] [\c!state=\v!start] -\installlanguage [\s!gb] [\c!state=\v!start] -\installlanguage [\s!de] [\c!state=\v!start] -\installlanguage [\s!fr] [\c!state=\v!start] -\installlanguage [\s!es] [\c!state=\v!start] -\installlanguage [\s!it] [\c!state=\v!start] - -\ifnum\texengine=\luatexengine - % will be runtime option: typeface - \appendtoks - \usetypescript[modern] - \setuptypeface[modern] - \to \everyjob -\else - \setupencoding[default=ec] \usetypescript[fallback][\defaultencoding] \setupbodyfont[rm,12pt] -\fi - -\protect \errorstopmode \dump \endinput diff --git a/Master/texmf-dist/tex/context/base/cont-log.mkii b/Master/texmf-dist/tex/context/base/cont-log.mkii new file mode 100644 index 00000000000..c89a2dd8f57 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-log.mkii @@ -0,0 +1,304 @@ +%D \module +%D [ file=cont-log, +%D version=1995.10.10, +%D title=\CONTEXT\ Miscellaneous Macros, +%D subtitle=\TEX\ Logos, +%D author=J. 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 TeX Logos} + +%D The system that is used to typeset this text is called \TEX, +%D typeset with an lowered~E. From te beginning of \TEX, +%D authors of macro packages adapted this raising and lowering +%D style. In this module we define some of those logos. + +%D The Computer Modern detection hack is gone as we now have Latin +%D Modern which has more kerning pairs. + +\unprotect + +\def\Mkern#1% + {{\setbox\scratchbox\hbox{M}\kern#1\wd\scratchbox}} + +\unexpanded\def\TeX + {T% + \Mkern{-.1667}\lower.5ex\hbox{E}% + \Mkern{-.125}X} + +\unexpanded\def\ConTeXt{Con\TeX t} +\unexpanded\def\PPCHTeX{ppch\TeX} +\unexpanded\def\PRAGMA {Pragma ADE} + +\unexpanded\def\LaTeX % requested by erik frambach + {{\setbox\scratchbox\hbox{L}% + \scratchdimen\ht\scratchbox + \setbox\scratchbox\hbox{\txx A}% + L\kern-.55\wd\scratchbox + \raise\scratchdimen\hbox{\lower\ht\scratchbox\copy\scratchbox}% + \kern-.2\wd\scratchbox\TeX}} + +\unexpanded\def\TaBlE + {T% + \kern-.27em\lower.5ex\hbox{A}% + \kern-.18emB% + \kern-.1em\lower.5ex\hbox{L}% + \kern-.075emE} + +\unexpanded\def\PiCTeX + {P% + \kern-.12em\lower.5ex\hbox{I}% + \kern-.075em C% + \kern-.11em\TeX} + +\def\AMSswitch#1% + {$\cal\ifdim\bodyfontsize>1.1em\scriptstyle\fi#1$} + +\unexpanded\def\AmSTeX + {\AMSswitch A% + \kern-.1667em\lower.5ex\hbox{\AMSswitch M}% + \kern-.125em\AMSswitch S% + -\TeX} + +\unexpanded\def\LamSTeX + {L% + \kern-.4em\raise.3ex\hbox{\AMSswitch A}% + \kern-.25em\lower.4ex\hbox{\AMSswitch M}% + \kern-.1em{\AMSswitch S}% + -\TeX} + +\unexpanded\def\AmSLaTeX + {\AMSswitch A% + \kern-.1667em\lower.5ex\hbox{\AMSswitch M}% + \kern-.125em\AMSswitch S% + -\LaTeX} + +%D Alternative \CONTEXT\ logo, first Idris S.~Hamid's version: +%D +%D \def\Context +%D {{\sc C\kern -.0667emo\kern -.0667emn\kern -.0549emt\kern +%D -.1667em\lower.5ex\hbox {e}\kern -.125emx\kern -.0549emt}} +%D +%D I changed this into one that adapts itself: + +\unexpanded\def\Context + {{C\kern -.0667em\getscaledglyph{.8}\empty{O\kern -.0667emN\kern + -.0549emT\doifitalicelse{\kern-.1em}{\kern-.1667em}\lower.5ex\hbox + {E}\doifitalicelse\empty{\kern-.11em}X\kern-.055emT}}} + +%D The \METAFONT\ and \METAPOST\ logos adapt themselves to the +%D current fontsize, an ugly but usefull hack. + +% rather hard coded +% +% \loadmapfile[original-base.map] % \loadmapfile[original-vogel-symbol] +% +% \unexpanded\def\setMFPfont +% {\font\logofont=logo% +% \ifnum\fam=\bffam\c!bf\else +% \ifnum\fam=\slfam\c!sl\else +% \ifnum\fam=\itfam\c!sl\else +% \ifnum\fam=\bsfam\c!bf\else +% \ifnum\fam=\bifam\c!bf\else +% \fi\fi\fi\fi\fi +% 10 at \currentfontscale\bodyfontsize +% \logofont} +% +% or: +% +% \definefontsynonym [MetaLogo] [logo10] +% \definefontsynonym [MetaLogoBold] [logobf10] +% \definefontsynonym [MetaLogoSlanted] [logosl10] +% \definefontsynonym [MetaLogoItalic] [logosl10] +% \definefontsynonym [MetaLogoBoldSlanted] [logobf10] +% \definefontsynonym [MetaLogoBoldtalic] [logobf10] +% +% \loadmapfile[original-base.map] % \loadmapfile[original-vogel-symbol] +% +% \def\setMFPfont{\symbolicfont{MetaLogo}} + +\let\logofont\nullfont + +\loadmapfile[original-base.map] + +\unexpanded\def\setMFPfont% more sensitive for low level changes + {\font\logofont=logo% + \ifx\fontalternative\c!bf\else + \ifx\fontalternative\c!it\else + \ifx\fontalternative\c!sl\else + \ifx\fontalternative\c!bi\else + \ifx\fontalternative\c!bs\else + \fi\fi\fi\fi\fi + 10 at \currentfontscale\bodyfontsize + \logofont} + +%\unexpanded\def\MetaFont% +% {\hbox{\setMFPfont METAFONT}} +% +%\unexpanded\def\MetaPost% +% {\hbox{\setMFPfont METAPOST}} + +\def\MetaHyphen% there is no hyphenchar in this font + {\discretionary{\vrule\!!height.33em\!!depth-.27em\!!width.33em}{}{}} + +\unexpanded\def\MetaFont + {{\setMFPfont META\MetaHyphen FONT}} + +\unexpanded\def\MetaPost + {{\setMFPfont META\MetaHyphen POST}} + +\unexpanded\def\MetaFun + {MetaFun} + +%D \macros +%D {TEX, METAFONT, METAPOST, METAFUN, +%D PICTEX, TABLE, +%D CONTEXT, PPCHTEX, +%D AMSTEX, LATEX, LAMSTEX} +%D +%D We define the funny written ones as well as the less +%D error prone upper case names (in \CONTEXT\ we tend to +%D write all user defined commands, like abbreviations, in +%D uppercase.) + +\unexpanded\def\METAFONT {\MetaFont} +\unexpanded\def\METAPOST {\MetaPost} +\unexpanded\def\PPCHTEX {\PPCHTeX} +\unexpanded\def\CONTEXT {\ConTeXt} +\unexpanded\def\METAFUN {\MetaFun} + +\unexpanded\def\TEX {\TeX} +\unexpanded\def\LATEX {\LaTeX} +\unexpanded\def\PICTEX {\PiCTeX} +\unexpanded\def\TABLE {\TaBlE} +\unexpanded\def\AMSTEX {\AmSTeX} +\unexpanded\def\LAMSTEX {\LamSTeX} +\unexpanded\def\INRSTEX {inrs\TeX} + +%D And this is how they show up: \TeX, \MetaFont, \MetaPost, +%D \PiCTeX, \TaBlE, \ConTeXt, \PPCHTeX, \AmSTeX, \LaTeX, +%D \LamSTeX. + +%D Some placeholders: + +\unexpanded\def\eTeX {\mathematics{\varepsilon}-\TeX} +\unexpanded\def\pdfTeX {pdf\TeX} +\unexpanded\def\pdfeTeX{pdfe-\TeX} +\unexpanded\def\luaTeX {lua\TeX} +\unexpanded\def\metaTeX{meta\TeX} +\unexpanded\def\XeTeX {X\lower.5ex\hbox{\kern-.15em\mirror{E}}\kern-.1667em\TeX} + +% Adapted from a patch by Mojca: + +\def\@XeTeX@ + {\setbox\scratchbox\hbox{E}% + \raise\dimexpr\ht\scratchbox+\dp\scratchbox\relax\hbox{\rotate[\c!rotation=180]{\box\scratchbox}}} + +\ifnum\texengine=\pdftexengine + + \unexpanded\def\XeTeX + {X\lower.5ex + \hbox + {\kern-.15em + \ifx\fontalternative\c!bf\mirror{E}\else + \ifx\fontalternative\c!it \@XeTeX@\else + \ifx\fontalternative\c!sl \@XeTeX@\else + \ifx\fontalternative\c!bi \@XeTeX@\else + \ifx\fontalternative\c!bs \@XeTeX@\else + \mirror{E}\fi\fi\fi\fi\fi}% + \kern-.1667em \TeX} + +\else + + \unexpanded\def\XeTeX + {X\lower.5ex + \hbox + {\kern-.15em + \iffontchar\font"018E\relax + \char"018E% + \else + \ifx\fontalternative\c!bf\mirror{E}\else + \ifx\fontalternative\c!it \@XeTeX@\else + \ifx\fontalternative\c!sl \@XeTeX@\else + \ifx\fontalternative\c!bi \@XeTeX@\else + \ifx\fontalternative\c!bs \@XeTeX@\else + \mirror{E}\fi\fi\fi\fi\fi + \fi}% + \kern-.1667em \TeX} + +\fi + +\let\ETEX \eTeX +\let\PDFTEX \pdfTeX +\let\PDFETEX\pdfeTeX +\let\LUATEX \luaTeX +\let\LuaTeX \luaTeX +\let\XETEX \XeTeX + +\unexpanded\def\MkApproved % joke, not used so it might move + {\dontleavehmode\rotate + [\c!rotation={\ifnum\texengine=\luatexengine\ctxlua{tex.write(45-45*\the\luatexversion/100)}\else0\fi}, + \c!align=\v!middle, + \c!foregroundstyle=\v!type, + \c!foregroundcolor=darkred, + \c!frame=\v!on, + \c!offset=1ex, + \c!background=\v!color, + \c!backgroundcolor=lightgray, + \c!framecolor=darkred, + \c!rulethickness=2pt] + {Mk\ifnum\texengine=\luatexengine IV\else II\fi\\approved}} + +% \unexpanded\def\luaTeX +% {\dontleavehmode\begingroup +% Lua% +% \setbox0\hbox{oT}% +% \setbox2\hbox{o\kern0ptT}% +% \ifdim\wd0=\wd2 +% \setbox0\hbox dir TRT{To}% +% \setbox2\hbox{T\kern0pto}% +% \hskip\dimexpr\wd0-\wd2\relax +% \fi +% \TeX +% \endgroup} +% +% a further iteration from the list, patched again + +% \ifx\fontalternative\c!it -\else +% \ifx\fontalternative\c!sl -\else +% \ifx\fontalternative\c!bi -\else +% \ifx\fontalternative\c!bs -\fi\fi\fi\fi + +\def\LuaTeX + {\dontleavehmode + \begingroup + Lua% + % hope for kerning, try aT + \setbox0\hbox{aT}% + \setbox2\hbox{a\kern\zeropoint T}% + \ifdim\wd0=\wd2 % kerns can go two ways + % no aT kerning, try oT as a is not symmetrical + \setbox0\hbox{oT}% + \setbox2\hbox{o\kern\zeropoint T}% + \ifdim\wd0=\wd2 % kerns can go two ways + % no aT and oT kerning, try To + \setbox0\hbox{To}% + \setbox2\hbox{T\kern\zeropoint o}% + % maybe we need to compensate for the angle (sl/it/bs/bi) + \fi + \ifdim\wd0=\wd2\else + \kern\dimexpr\wd0-\wd2\relax + \fi + \fi + \TeX + \endgroup} + +\let\luaTeX \LuaTeX +\let\LUATEX \LuaTeX + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/cont-log.mkiv b/Master/texmf-dist/tex/context/base/cont-log.mkiv new file mode 100644 index 00000000000..171949ba011 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-log.mkiv @@ -0,0 +1,253 @@ +%D \module +%D [ file=cont-log, +%D version=1995.10.10, +%D title=\CONTEXT\ Miscellaneous Macros, +%D subtitle=\TEX\ Logos, +%D author=J. 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 TeX Logos} + +%D The system that is used to typeset this text is called \TEX, +%D typeset with an lowered~E. From te beginning of \TEX, +%D authors of macro packages adapted this raising and lowering +%D style. In this module we define some of those logos. + +\unprotect + +\def\Mkern#1% + {{\setbox\scratchbox\hbox{M}\kern#1\wd\scratchbox}} + +\unexpanded\def\TeX + {T% + \Mkern{-.1667}\lower.5ex\hbox{E}% + \Mkern{-.125}X} + +\unexpanded\def\ConTeXt{Con\TeX t} +\unexpanded\def\PPCHTeX{ppch\TeX} +\unexpanded\def\PRAGMA {Pragma ADE} + +\unexpanded\def\LaTeX % requested by erik frambach + {{\setbox\scratchbox\hbox{L}% + \scratchdimen\ht\scratchbox + \setbox\scratchbox\hbox{\txx A}% + L\kern-.55\wd\scratchbox + \raise\scratchdimen\hbox{\lower\ht\scratchbox\copy\scratchbox}% + \kern-.2\wd\scratchbox\TeX}} + +\unexpanded\def\TaBlE + {T% + \kern-.27em\lower.5ex\hbox{A}% + \kern-.18emB% + \kern-.1em\lower.5ex\hbox{L}% + \kern-.075emE} + +\unexpanded\def\PiCTeX + {P% + \kern-.12em\lower.5ex\hbox{I}% + \kern-.075em C% + \kern-.11em\TeX} + +\def\AMSswitch#1% + {$\cal\ifdim\bodyfontsize>1.1em\scriptstyle\fi#1$} + +\unexpanded\def\AmSTeX + {\AMSswitch A% + \kern-.1667em\lower.5ex\hbox{\AMSswitch M}% + \kern-.125em\AMSswitch S% + -\TeX} + +\unexpanded\def\LamSTeX + {L% + \kern-.4em\raise.3ex\hbox{\AMSswitch A}% + \kern-.25em\lower.4ex\hbox{\AMSswitch M}% + \kern-.1em{\AMSswitch S}% + -\TeX} + +\unexpanded\def\AmSLaTeX + {\AMSswitch A% + \kern-.1667em\lower.5ex\hbox{\AMSswitch M}% + \kern-.125em\AMSswitch S% + -\LaTeX} + +%D Alternative \CONTEXT\ logo, first Idris S.~Hamid's version: +%D +%D \def\Context +%D {{\sc C\kern -.0667emo\kern -.0667emn\kern -.0549emt\kern +%D -.1667em\lower.5ex\hbox {e}\kern -.125emx\kern -.0549emt}} +%D +%D I changed this into one that adapts itself: + +\unexpanded\def\Context + {{C\kern -.0667em\getscaledglyph{.8}\empty{O\kern -.0667emN\kern + -.0549emT\doifitalicelse{\kern-.1em}{\kern-.1667em}\lower.5ex\hbox + {E}\doifitalicelse\empty{\kern-.11em}X\kern-.055emT}}} + +%D The \METAFONT\ and \METAPOST\ logos adapt themselves to the +%D current fontsize, an ugly but usefull hack. + +\let\logofont\nullfont + +\loadmapfile[original-base.map] + +\unexpanded\def\setMFPfont% more sensitive for low level changes + {\font\logofont=logo% + \ifx\fontalternative\c!bf\else + \ifx\fontalternative\c!it\else + \ifx\fontalternative\c!sl\else + \ifx\fontalternative\c!bi\else + \ifx\fontalternative\c!bs\else + \fi\fi\fi\fi\fi + 10 at \currentfontscale\bodyfontsize + \logofont} + +\def\MetaHyphen% there is no hyphenchar in this font + {\discretionary{\vrule\!!height.33em\!!depth-.27em\!!width.33em}{}{}} + +\unexpanded\def\MetaFont + {{\setMFPfont META\MetaHyphen FONT}} + +\unexpanded\def\MetaPost + {{\setMFPfont META\MetaHyphen POST}} + +\unexpanded\def\MetaFun + {MetaFun} + +%D \macros +%D {TEX, METAFONT, METAPOST, METAFUN, +%D PICTEX, TABLE, +%D CONTEXT, PPCHTEX, +%D AMSTEX, LATEX, LAMSTEX} +%D +%D We define the funny written ones as well as the less +%D error prone upper case names (in \CONTEXT\ we tend to +%D write all user defined commands, like abbreviations, in +%D uppercase.) + +\unexpanded\def\METAFONT {\MetaFont} +\unexpanded\def\METAPOST {\MetaPost} +\unexpanded\def\PPCHTEX {\PPCHTeX} +\unexpanded\def\CONTEXT {\ConTeXt} +\unexpanded\def\METAFUN {\MetaFun} + +\unexpanded\def\TEX {\TeX} +\unexpanded\def\LATEX {\LaTeX} +\unexpanded\def\PICTEX {\PiCTeX} +\unexpanded\def\TABLE {\TaBlE} +\unexpanded\def\AMSTEX {\AmSTeX} +\unexpanded\def\LAMSTEX {\LamSTeX} +\unexpanded\def\INRSTEX {inrs\TeX} + +%D And this is how they show up: \TeX, \MetaFont, \MetaPost, +%D \PiCTeX, \TaBlE, \ConTeXt, \PPCHTeX, \AmSTeX, \LaTeX, +%D \LamSTeX. + +%D Some placeholders: + +\unexpanded\def\eTeX {\mathematics{\varepsilon}-\TeX} +\unexpanded\def\pdfTeX {pdf\TeX} +\unexpanded\def\pdfeTeX{pdfe-\TeX} +\unexpanded\def\luaTeX {lua\TeX} +\unexpanded\def\metaTeX{meta\TeX} +\unexpanded\def\XeTeX {X\lower.5ex\hbox{\kern-.15em\mirror{E}}\kern-.1667em\TeX} + +% Adapted from a patch by Mojca: + +\def\@XeTeX@ + {\setbox\scratchbox\hbox{E}% + \raise\dimexpr\ht\scratchbox+\dp\scratchbox\relax\hbox{\rotate[\c!rotation=180]{\box\scratchbox}}} + +\unexpanded\def\XeTeX + {X\lower.5ex + \hbox + {\kern-.15em + \iffontchar\font"018E\relax + \char"018E% + \else + \ifx\fontalternative\c!bf\mirror{E}\else + \ifx\fontalternative\c!it \@XeTeX@\else + \ifx\fontalternative\c!sl \@XeTeX@\else + \ifx\fontalternative\c!bi \@XeTeX@\else + \ifx\fontalternative\c!bs \@XeTeX@\else + \mirror{E}\fi\fi\fi\fi\fi + \fi}% + \kern-.1667em \TeX} + +\let\ETEX \eTeX +\let\PDFTEX \pdfTeX +\let\PDFETEX\pdfeTeX +\let\LUATEX \luaTeX +\let\LuaTeX \luaTeX +\let\XETEX \XeTeX + +\unexpanded\def\MkApproved % joke, not used so it might move + {\dontleavehmode\rotate + [\c!rotation={\ifnum\texengine=\luatexengine\ctxlua{tex.write(45-45*\the\luatexversion/100)}\else0\fi}, + \c!align=\v!middle, + \c!foregroundstyle=\v!type, + \c!foregroundcolor=darkred, + \c!frame=\v!on, + \c!offset=1ex, + \c!background=\v!color, + \c!backgroundcolor=lightgray, + \c!framecolor=darkred, + \c!rulethickness=2pt] + {Mk\ifnum\texengine=\luatexengine IV\else II\fi\\approved}} + +% \unexpanded\def\luaTeX +% {\dontleavehmode\begingroup +% Lua% +% \setbox0\hbox{oT}% +% \setbox2\hbox{o\kern0ptT}% +% \ifdim\wd0=\wd2 +% \setbox0\hbox dir TRT{To}% +% \setbox2\hbox{T\kern0pto}% +% \hskip\dimexpr\wd0-\wd2\relax +% \fi +% \TeX +% \endgroup} +% +% a further iteration from the list, patched again + +% \ifx\fontalternative\c!it -\else +% \ifx\fontalternative\c!sl -\else +% \ifx\fontalternative\c!bi -\else +% \ifx\fontalternative\c!bs -\fi\fi\fi\fi + +\unexpanded\def\LuaTeX + {\dontleavehmode + \begingroup + Lua% + % hope for kerning, try aT + \setbox0\hbox{aT}% + \setbox2\hbox{a\kern\zeropoint T}% + \ifdim\wd0=\wd2 % kerns can go two ways + % no aT kerning, try oT as a is not symmetrical + \setbox0\hbox{oT}% + \setbox2\hbox{o\kern\zeropoint T}% + \ifdim\wd0=\wd2 % kerns can go two ways + % no aT and oT kerning, try To + \setbox0\hbox{To}% + \setbox2\hbox{T\kern\zeropoint o}% + % maybe we need to compensate for the angle (sl/it/bs/bi) + \fi + \ifdim\wd0=\wd2\else + \kern\dimexpr\wd0-\wd2\relax + \fi + \fi + \TeX + \endgroup} + +\let\luaTeX \LuaTeX +\let\LUATEX \LuaTeX + +\unexpanded\def\MKII{MkII} +\unexpanded\def\MKIV{MkIV} +\unexpanded\def\MKVI{MkVI} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/cont-log.tex b/Master/texmf-dist/tex/context/base/cont-log.tex deleted file mode 100644 index 9bfec299992..00000000000 --- a/Master/texmf-dist/tex/context/base/cont-log.tex +++ /dev/null @@ -1,359 +0,0 @@ -%D \module -%D [ file=cont-log, -%D version=1995.10.10, -%D title=\CONTEXT\ Miscellaneous Macros, -%D subtitle=\TEX\ Logos, -%D author=J. 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 TeX Logos} - -%D The system that is used to typeset this text is called \TEX, -%D typeset with an lowered~E. From te beginning of \TEX, -%D authors of macro packages adapted this raising and lowering -%D style. In this module we define some of those logos. -%D Watch the \type{cmr} detection hack. - -\unprotect - -\defconvertedargument\someCMRfont{cmr} % hm, we now have lm - -% \def\doifCMRfontelse#1#2% -% {\doifinstringelse{\someCMRfont}{\fontname\font} -% {\def\next{#1}} -% {\def\next{#2}}% -% \next} - -\def\doifCMRfontelse - {\doifinstringelse\someCMRfont{\fontname\font}} - -\unexpanded\def\CMRkern - {\doifCMRfontelse\kern{\scratchdimen=}} - -% \def\TeX -% {T% -% \kern-.1667em\lower.5ex\hbox{E}% -% \kern-.125emX} - -\def\Mkern#1% - {{\setbox\scratchbox\hbox{M}\kern#1\wd\scratchbox}} - -\unexpanded\def\TeX - {T% - \Mkern{-.1667}\lower.5ex\hbox{E}% - \Mkern{-.125}X} - -\unexpanded\def\ConTeXt - {C% - \CMRkern-.0333emo% - \CMRkern-.0333emn% -% \CMRkern-.1667em\TeX% - \CMRkern-.0667em\TeX% - \CMRkern-.0333emt} - -\unexpanded\def\PPCHTeX - {ppch\TeX} - -\unexpanded\def\PRAGMA - {Pragma ADE} - -%\def\LaTeX -% {L% -% \kern-.30em\raise.3ex\hbox{\txx A}% -% \kern-.18em\TeX} - -\unexpanded\def\LaTeX % requested by erik frambach - {{\setbox\scratchbox\hbox{L}% - \scratchdimen\ht\scratchbox - \setbox\scratchbox\hbox{\txx A}% - L\kern-.55\wd\scratchbox - \raise\scratchdimen\hbox{\lower\ht\scratchbox\copy\scratchbox}% - \kern-.2\wd\scratchbox\TeX}} - -\unexpanded\def\TaBlE - {T% - \kern-.27em\lower.5ex\hbox{A}% - \kern-.18emB% - \kern-.1em\lower.5ex\hbox{L}% - \kern-.075emE} - -\unexpanded\def\PiCTeX - {P% - \kern-.12em\lower.5ex\hbox{I}% - \kern-.075em C% - \kern-.11em\TeX} - -\def\AMSswitch#1% - {$\cal\ifdim\bodyfontsize>1.1em\scriptstyle\fi#1$} - -\unexpanded\def\AmSTeX - {\AMSswitch A% - \kern-.1667em\lower.5ex\hbox{\AMSswitch M}% - \kern-.125em\AMSswitch S% - -\TeX} - -\unexpanded\def\LamSTeX - {L% - \kern-.4em\raise.3ex\hbox{\AMSswitch A}% - \kern-.25em\lower.4ex\hbox{\AMSswitch M}% - \kern-.1em{\AMSswitch S}% - -\TeX} - -\unexpanded\def\AmSLaTeX - {\AMSswitch A% - \kern-.1667em\lower.5ex\hbox{\AMSswitch M}% - \kern-.125em\AMSswitch S% - -\LaTeX} - -%D Alternative \CONTEXT\ logo, first Idris S.~Hamid's version: -%D -%D \def\Context -%D {{\sc C\kern -.0667emo\kern -.0667emn\kern -.0549emt\kern -%D -.1667em\lower.5ex\hbox {e}\kern -.125emx\kern -.0549emt}} -%D -%D I changed this into one that adapts itself: - -\unexpanded\def\Context - {{C\kern -.0667em\getscaledglyph{.8}\empty{O\kern -.0667emN\kern - -.0549emT\doifitalicelse{\kern-.1em}{\kern-.1667em}\lower.5ex\hbox - {E}\doifitalicelse\empty{\kern-.11em}X\kern-.055emT}}} - -%D The \METAFONT\ and \METAPOST\ logos adapt themselves to the -%D current fontsize, an ugly but usefull hack. - -% rather hard coded -% -% \loadmapfile[original-base.map] % \loadmapfile[original-vogel-symbol] -% -% \unexpanded\def\setMFPfont -% {\font\logofont=logo% -% \ifnum\fam=\bffam\c!bf\else -% \ifnum\fam=\slfam\c!sl\else -% \ifnum\fam=\itfam\c!sl\else -% \ifnum\fam=\bsfam\c!bf\else -% \ifnum\fam=\bifam\c!bf\else -% \fi\fi\fi\fi\fi -% 10 at \currentfontscale\bodyfontsize -% \logofont} -% -% or: -% -% \definefontsynonym [MetaLogo] [logo10] -% \definefontsynonym [MetaLogoBold] [logobf10] -% \definefontsynonym [MetaLogoSlanted] [logosl10] -% \definefontsynonym [MetaLogoItalic] [logosl10] -% \definefontsynonym [MetaLogoBoldSlanted] [logobf10] -% \definefontsynonym [MetaLogoBoldtalic] [logobf10] -% -% \loadmapfile[original-base.map] % \loadmapfile[original-vogel-symbol] -% -% \def\setMFPfont{\symbolicfont{MetaLogo}} - -\let\logofont\nullfont - -\loadmapfile[original-base.map] - -\unexpanded\def\setMFPfont% more sensitive for low level changes - {\font\logofont=logo% - \ifx\fontalternative\c!bf\else - \ifx\fontalternative\c!it\else - \ifx\fontalternative\c!sl\else - \ifx\fontalternative\c!bi\else - \ifx\fontalternative\c!bs\else - \fi\fi\fi\fi\fi - 10 at \currentfontscale\bodyfontsize - \logofont} - -%\unexpanded\def\MetaFont% -% {\hbox{\setMFPfont METAFONT}} -% -%\unexpanded\def\MetaPost% -% {\hbox{\setMFPfont METAPOST}} - -\def\MetaHyphen% there is no hyphenchar in this font - {\discretionary{\vrule\!!height.33em\!!depth-.27em\!!width.33em}{}{}} - -\unexpanded\def\MetaFont - {{\setMFPfont META\MetaHyphen FONT}} - -\unexpanded\def\MetaPost - {{\setMFPfont META\MetaHyphen POST}} - -\unexpanded\def\MetaFun - {MetaFun} - -%D \macros -%D {TEX, METAFONT, METAPOST, METAFUN, -%D PICTEX, TABLE, -%D CONTEXT, PPCHTEX, -%D AMSTEX, LATEX, LAMSTEX} -%D -%D We define the funny written ones as well as th eless -%D error prone upper case names (in \CONTEXT\ we tend to -%D write all user defined commands, like abbreviations, in -%D uppercase.) - -\unexpanded\def\METAFONT {\MetaFont} -\unexpanded\def\METAPOST {\MetaPost} -\unexpanded\def\PPCHTEX {\PPCHTeX} -\unexpanded\def\CONTEXT {\ConTeXt} -\unexpanded\def\METAFUN {\MetaFun} - -\unexpanded\def\TEX {\TeX} -\unexpanded\def\LATEX {\LaTeX} -\unexpanded\def\PICTEX {\PiCTeX} -\unexpanded\def\TABLE {\TaBlE} -\unexpanded\def\AMSTEX {\AmSTeX} -\unexpanded\def\LAMSTEX {\LamSTeX} -\unexpanded\def\INRSTEX {inrs\TeX} - -%D And this is how they show up: \TeX, \MetaFont, \MetaPost, -%D \PiCTeX, \TaBlE, \ConTeXt, \PPCHTeX, \AmSTeX, \LaTeX, -%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} - -%D Some placeholders: - -\unexpanded\def\eTeX {\mathematics{\varepsilon}-\TeX} -\unexpanded\def\pdfTeX {pdf\TeX} -\unexpanded\def\pdfeTeX{pdfe-\TeX} -\unexpanded\def\luaTeX {lua\TeX} -\unexpanded\def\metaTeX{meta\TeX} -\unexpanded\def\XeTeX {X\lower.5ex\hbox{\kern-.15em\mirror{E}}\kern-.1667em\TeX} - -% Better, since lm has a mirrored E (don't ask me why) - -% \unexpanded\def\XeTeX -% {X\lower.5ex -% \hbox -% {\kern-.15em -% \ifx\XeTeXcharglyph\undefined -% \mirror{E}% -% \else\ifcase\XeTeXcharglyph"018E\relax -% \mirror{E}% -% \else -% \char"018E% -% \fi}% -% \kern-.1667em \TeX} - -% Adapted from a patch by Mojca: - -\def\@XeTeX@ - {\setbox\scratchbox\hbox{E}% - \raise\dimexpr\ht\scratchbox+\dp\scratchbox\relax\hbox{\rotate[\c!rotation=180]{\box\scratchbox}}} - -\ifnum\texengine=\pdftexengine - - \unexpanded\def\XeTeX - {X\lower.5ex - \hbox - {\kern-.15em - \ifx\fontalternative\c!bf\mirror{E}\else - \ifx\fontalternative\c!it \@XeTeX@\else - \ifx\fontalternative\c!sl \@XeTeX@\else - \ifx\fontalternative\c!bi \@XeTeX@\else - \ifx\fontalternative\c!bs \@XeTeX@\else - \mirror{E}\fi\fi\fi\fi\fi}% - \kern-.1667em \TeX} - -\else - - \unexpanded\def\XeTeX - {X\lower.5ex - \hbox - {\kern-.15em - \iffontchar\font"018E\relax - \char"018E% - \else - \ifx\fontalternative\c!bf\mirror{E}\else - \ifx\fontalternative\c!it \@XeTeX@\else - \ifx\fontalternative\c!sl \@XeTeX@\else - \ifx\fontalternative\c!bi \@XeTeX@\else - \ifx\fontalternative\c!bs \@XeTeX@\else - \mirror{E}\fi\fi\fi\fi\fi - \fi}% - \kern-.1667em \TeX} - -\fi - -\let\ETEX \eTeX -\let\PDFTEX \pdfTeX -\let\PDFETEX\pdfeTeX -\let\LUATEX \luaTeX -\let\LuaTeX \luaTeX -\let\XETEX \XeTeX - -\unexpanded\def\MkApproved - {\dontleavehmode\rotate - [\c!rotation={\ifnum\texengine=\luatexengine\ctxlua{tex.write(45-45*\the\luatexversion/100)}\else0\fi}, - \c!align=\v!middle, - \c!foregroundstyle=\v!type, - \c!foregroundcolor=darkred, - \c!frame=\v!on, - \c!offset=1ex, - \c!background=\v!color, - \c!backgroundcolor=lightgray, - \c!framecolor=darkred, - \c!rulethickness=2pt] - {Mk\ifnum\texengine=\luatexengine IV\else II\fi\\approved}} - - -% \unexpanded\def\luaTeX -% {\dontleavehmode\begingroup -% Lua% -% \setbox0\hbox{oT}% -% \setbox2\hbox{o\kern0ptT}% -% \ifdim\wd0=\wd2 -% \setbox0\hbox dir TRT{To}% -% \setbox2\hbox{T\kern0pto}% -% \hskip\dimexpr\wd0-\wd2\relax -% \fi -% \TeX -% \endgroup} -% -% a further iteration from the list, patched again - -% \ifx\fontalternative\c!it -\else -% \ifx\fontalternative\c!sl -\else -% \ifx\fontalternative\c!bi -\else -% \ifx\fontalternative\c!bs -\fi\fi\fi\fi - -\def\LuaTeX - {\dontleavehmode - \begingroup - Lua% - % hope for kerning, try aT - \setbox0\hbox{aT}% - \setbox2\hbox{a\kern\zeropoint T}% - \ifdim\wd0=\wd2 % kerns can go two ways - % no aT kerning, try oT as a is not symmetrical - \setbox0\hbox{oT}% - \setbox2\hbox{o\kern\zeropoint T}% - \ifdim\wd0=\wd2 % kerns can go two ways - % no aT and oT kerning, try To - \setbox0\hbox{To}% - \setbox2\hbox{T\kern\zeropoint o}% - % maybe we need to compensate for the angle (sl/it/bs/bi) - \fi - \ifdim\wd0=\wd2\else - \kern\dimexpr\wd0-\wd2\relax - \fi - \fi - \TeX - \endgroup} - -\let\luaTeX \LuaTeX -\let\LUATEX \LuaTeX - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/cont-mtx.tex b/Master/texmf-dist/tex/context/base/cont-mtx.tex deleted file mode 100644 index 833785a7f2b..00000000000 --- a/Master/texmf-dist/tex/context/base/cont-mtx.tex +++ /dev/null @@ -1,25 +0,0 @@ -%D \module -%D [ file=cont-mtx, -%D version=2006.01.01, % no date -) -%D title=\CONTEXT\ Miscellaneous Macros, -%D subtitle=Experimental MetaTeX 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. - -% format generation : texexec --make --all --luatex -% -% pdftex compatible run : texexec --luatex filename -% aleph compatible run : texexec --luatex --output=dvipdfmx filename -% -% or, at top of tex file : % engine=luatex - -% \loadcorefile{meta-xxx.tex} - -%D Here we load files that are not yet part of the core. - -\endinput diff --git a/Master/texmf-dist/tex/context/base/cont-new.mkii b/Master/texmf-dist/tex/context/base/cont-new.mkii index 2defba6d787..1a81454d6c9 100644 --- a/Master/texmf-dist/tex/context/base/cont-new.mkii +++ b/Master/texmf-dist/tex/context/base/cont-new.mkii @@ -11,7 +11,928 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\enablemode[mkii] +\newcontextversion{2011.05.18 18:04} + +%D This file is loaded at runtime, thereby providing an +%D excellent place for hacks, patches, extensions and new +%D features. + +\unprotect + +% it's about time to clean up this file ... + +\writestatus\m!systems{beware: some patches loaded from cont-new.mkii} + +% \ifx\pdfmapfile \undefined \else \pdfmapfile{ } \fi + +% \font\f=dummyfont \rpcode\f0=500 \hbox{..}\char0 +% todo: mp-new +% caption: grid=top|bottom in xml defs + +\def\fastscale#1% + {\begingroup + \ifnum#1=1000\relax + \setfalse\scaleboxdone + \else + \settrue\scaleboxdone + \edef\finalscaleboxxscale{\withoutpt\the\dimexpr#1pt/1000\relax}% + \let\finalscaleboxyscale\finalscaleboxxscale + \fi + \dowithnextbox{\doscaleboxindeed\flushnextbox\endgroup}\hbox} + +% \setupcaption [figure] [align=flushleft] +% \setupcaption [figure-1] [align=flushleft,leftmargin=10mm] +% \setupcaption [figure-2] [align=flushleft,leftmargin=10mm,rightmargin=-10mm,width=\textwidth] +% +% \startsetups somefigure +% \ifdim\floatsetupwidth>\textwidth +% \placesetupfloat[figure-2] +% \else +% \placesetupfloat[figure-1] +% \fi +% \stopsetups +% +% \placefloatwithsetups[somefigure]{}{\externalfigure[dummy][width=5cm,height=2cm]} + +\def\placefloatwithsetups + {\dotripleempty\doplacefloatwithsetups} + +\long\def\doplacefloatwithsetups[#1][#2][#3]#4% + {\def\floatsetupcaption {#4}% + \def\floatsetupcontent {\copy\nextbox}% + \def\floatsetupwidth {\wd\nextbox}% + \def\floatsetupheight {\ht\nextbox}% + \def\placesetupfloat[##1]{\placefloat[##1][#2][#3]{#4}{\floatsetupcontent}}% #4 and not \floatsetupcaption (unexpanded) + \dowithnextbox{\setups[#1]}\vbox} + +\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} + +% \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}} + +\definecomplexorsimple\widened + +% todo +% +% \def\definelocation{\dodoubleargument\dodefinelocation} +% \def\dodefinelocation[#1][#2]{\setvalue{loc:#1}{#2}} +% +% \definelocation[lt] [\v!left\v!top] +% \definelocation[tl] [\v!left\v!top] +% \definelocation[\v!top\v!left][\v!left\v!top] +% +% \def\getlocation#1{\executeifdefined{loc:#1}{#1}} + +% just in case we load something from a file (pdfr-ec for instance) + +\prependtoks \restoreendofline \to \everybeforeshipout + +% \let\cs\getvalue % no, we want \cs to be czech + +% experimental so this may change + +\def\startdescriptions + {\dosingleempty\dostartdescriptions} + +\def\dostartdescriptions[#1]% + {\begingroup + \def\item{\getvalue{#1}}% + \let\dostoppairdescription \donothing + \let\@@description \dostartpairdescription + \let\@@startsomedescription\dostartsomedescription} + +\def\stopdescriptions + {\dostoppairdescription + \endgroup} + +\def\dostartpairdescription[#1][#2]% + {\dostoppairdescription + \def\dostoppairdescription{\@@stopdescription{#1}}% + \bgroup + \def\currentdescription{#1}% + \doifelse{\descriptionparameter{\s!do\c!state}}\v!start + {\@@makedescription{#1}[#2]{}} + {\@@makedescription{#1}[#2]}} + +\def\dostartsomedescription% #1[#2]#3% + {\bgroup + \@@makedescription} % {#1}[#2]{#3}} + +% \starttext +% +% \definedescription[test] +% +% \startdescriptions +% \test{Foo} Bar bar bar +% \test{Foo} Bar bar bar +% \test{Foo} Bar bar bar +% \stopdescriptions +% +% \startdescriptions[test] +% \item{Foo} Bar bar bar +% \item{Foo} Bar bar bar +% \item{Foo} Bar bar bar +% \stopdescriptions +% +% \startdescriptions +% \starttest{Foo} Bar bar bar \stoptest +% \starttest{Foo} Bar bar bar \stoptest +% \starttest{Foo} Bar bar bar \stoptest +% \stopdescriptions +% +% \startdescriptions[test] +% \item{Foo} Bar bar bar +% \item{Foo} Bar bar bar +% \item{Foo} Bar bar bar +% \stopdescriptions +% +% \stoptext + +% to do: +% +% \def\defineshapesynonym +% {\dodoubleargument\dodefineshapesynonym} +% +% \def\dodefineshapesynonym[#1][#2]% +% {\setvalue{shsy:#1}{#2}} +% +% \def\shapesynonym#1% +% {\ifcsname shsy:#1\endcsname +% \expandafter\shapesynonym\csname shsy:#1\endcsname\else#1% +% \fi} +% +%\defineshapesynonym[eacute] [e] +%\defineshapesynonym[egrave] [e] +%\defineshapesynonym[eumlaut [e] +%\defineshapesynonym[eogonek][e] +% +% more reduction +% +%\defineshapesynonym[e][o] +%\defineshapesynonym[w][v] +%\defineshapesynonym[m][n] +% +% \shapesynonym{eacute} + +% this will be activated when + +% \newinsert\thispageinsert % <- installinsertion + +% \def\flushatthispage +% {\bgroup +% \dowithnextbox{\insert\thispageinsert{\box\nextbox}\egroup}% +% \hbox} + +% \appendtoks +% \ifvoid\thispageinsert\else\hbox{\smashedbox\thispageinsert}\fi +% \to \everyshipout + +% \definemarkedpage[nobackgrounds] +% \markpage[nobackgrounds] +% \doifmarkedpageelse{nobackgrounds} + +\newcounter\nofmarkedpages + +\def\definemarkedpage[#1]% + {\definetwopasslist{\v!page:#1}} + +\def\markpage[#1]% looks very much like domarginreference + {\iftrialtypesetting\else + \doglobal\increment\nofmarkedpages\relax + \lazysavetwopassdata{\v!page:#1}{\nofmarkedpages}{\noexpand\realfolio}% + \fi} + +\def\doifmarkedpageelse#1% + {\gettwopassdatalist{\v!page:#1}% + \expanded{\doifinsetelse{\realfolio}{\twopassdatalist}}} + +% Just a simple and fast hanger, for usage in macros. + +\def\setuphanging + {\dodoubleempty\getparameters[\??ha]} + +\setuphanging + [\c!distance=.5em] + +\def\starthanging + {\noindent\bgroup + \dowithnextbox + {\setbox\nextbox\hbox{\flushnextbox\hskip\@@hadistance}% + \hangindent\nextboxwd + \hangafter\plusone + \flushnextbox\ignorespaces} + \hbox} + +\def\stophanging + {\endgraf + \egroup} + +% experimental + +\def\stophangaround + {\endgraf + \egroup} + +\def\starthangaround + {\noindent\bgroup + \dowithnextbox + {\ifdim\nextboxht>\strutht\setbox\nextbox\tbox{\flushnextbox}\fi + \setbox\nextbox\hbox{\flushnextbox\hskip\@@hadistance}% + \getboxheight\scratchdimen\of\box\nextbox + \getnoflines\scratchdimen + \nextboxht\strutht + \nextboxdp\strutdp + \hangindent\nextboxwd + \hangafter-\noflines + \llap{\flushnextbox}\ignorespaces} + \hbox} + +\def\modevalue#1#2#3% + {\@EA\ifx\csname\@mode@\systemmodeprefix#1\endcsname\endcsname\enabledmode#2\else#2\fi} + +\def\systemmodevalue#1% + {\modevalue{\systemmodeprefix#1}} + +% \getmulticolumnlines -> now in cont-loc, to be tested and really needed + +% \tracefonthandlingtrue + +% new, still to be improved +% +% \dorecurse{10} +% {\input thuan +% \placefigure{}{\framed[height=1.5cm]{test}} +% \placefloatplaceholder} + +\def\placefloatplaceholder + {\ifroomforfloat \else + \scratchdimen\pagegoal + \advance\scratchdimen-\pagetotal + \advance\scratchdimen-3\lineheight + \ifdim\scratchdimen>\zeropoint + \startlinecorrection[blank] + \mhbox{\inframed{\labeltexts{placeholder}{\lastcaptiontag}}}% + \stoplinecorrection + \else + \allowbreak + \fi + \fi} + +\setuplabeltext + [placeholder={, moved}] + +% etex only, of course we could just parse (scan for \% in string) + +\newif\ifpercentdimendone + +\bgroup % usage: \setpercentdimen\somedimen{% or dimen} todo: pct +\catcode124=\@@comment +\catcode 37=\@@active +\gdef\setpercentdimen#1#2| + {\xdef\@@expanded{#2}| + \ifx\@@expanded\empty\else + \bgroup + \global\percentdimendonefalse + \def\%{\dimexpr#1/100\relax\global\percentdimendonetrue\ignorespaces}| scantokens add's a space + \catcode`%=\@@active + \catcode`\\=\@@escape + \let%\%| + \scratchdimen#1| + \xdef\@@expanded{\@@expanded\scratchdimen\!!zeropoint}| trick: when 1.2 => .2\scratchdimen and 0pt typeset + \startnointerference + \global\globalscratchdimen\scantokens\@EA{\@@expanded}| i'm lazy and use etex + \stopnointerference + \egroup + #1\globalscratchdimen + \fi} +\egroup + +% TEX alternative, in principle accurate enough and also a bit faster + +% \bgroup +% +% \catcode`\%=\@@other +% \catcode`\|=\@@comment +% +% \gdef\setpercentdimen#1#2| +% {\beforesplitstring#2\at%\to\ascii +% \doifelse\ascii{#2} +% {#1=#2} +% {\divide#1by100\relax#1=\ascii#1\relax}} | or: {#1=\ascii#1\divide#1by100\relax}} +% +% \egroup +% +% \dimen0=1000pt \setpercentdimen{\dimen0}{10%} \the\dimen0 +% \dimen0= 100pt \setpercentdimen{\dimen0}{10%} \the\dimen0 +% \dimen0= 95pt \setpercentdimen{\dimen0}{10%} \the\dimen0 +% \dimen0= 10pt \setpercentdimen{\dimen0}{10%} \the\dimen0 +% \dimen0= 1pt \setpercentdimen{\dimen0}{10%} \the\dimen0 + +\bgroup + +\obeylines % don't remove %'s ! + +\gdef\collapsedspace#1% + {\ifx#1^^M% + \expandafter\collapsedspace + \else + \space + \expandafter#1% + \fi} + +\gdef\collapsespaces + {\prependtoksonce\relax\to\everyeof% + \ignorelines% + \ignoretabs% + \let\obeyedspace\collapsedspace% + \obeyspaces} + +\egroup + +\def\inlinedbox + {\bgroup + \dowithnextbox + {\scratchdimen\nextboxht + \advance\scratchdimen\nextboxdp + \advance\scratchdimen-\lineheight + \divide\scratchdimen\plustwo + \advance\scratchdimen\strutdepth + \setbox\nextbox\hbox{\lower\scratchdimen\flushnextbox}% + \nextboxht\strutht + \nextboxdp\strutdp + \flushnextbox + \egroup}% + \hbox} + +% \readfile{cont-exp}\donothing\donothing % speed up (5-20%) + +\def\dimenratio#1#2% etex only + {\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\relax}{#2}} + +\def\buttonframed{\dodoubleempty\localframed[\??bt]} % goodie + +\unexpanded\def\asciistr#1{\dontleavehmode{\defconvertedargument\ascii{#1}\verbatimfont\ascii}} + +\def\shapefill{\vskip\zeropoint\!!plus\lineheight\!!minus\lineheight\relax} + +\let\normaltype\type + +\ifx\scantextokens\undefined + \ifx\scantokens\undefined + \unexpanded\def\retype#1{\dontleavehmode{\defconvertedargument\ascii{#1}\@EA\normaltype\@EA{\ascii}}} + \else + \unexpanded\def\retype#1{\dontleavehmode\scantokens{\normaltype{#1}\ignorespaces}\relax} + \fi +\else + \unexpanded\def\retype#1{\dontleavehmode\scantextokens{\normaltype{#1}}} +\fi + +\def\simplifytype{\let\type\retype} + +% \ruledhbox +% {\startignorespaces +% \def\oeps{a} +% \startignorespaces +% \def\oeps{a} +% \stopignorespaces +% \def\oeps{a} +% \stopignorespaces +% \oeps} + +\newsignal\boissignal +\newcount \boislevel + +\long\def\startignorespaces + {\advance\boislevel\plusone + \ifcase\boislevel\or \ifhmode + \hskip\boissignal + \fi \fi + \ignorespaces} + +\long\def\stopignorespaces + {\ifcase\boislevel\or \ifhmode + \doloop + {\ifdim\lastskip=\zeropoint + \exitloop + \else\ifdim\lastskip=\boissignal + \unskip + \exitloop + \else + \unskip + \fi\fi}% + \fi \fi + \advance\boislevel\minusone} + +\def\minimalhbox#1#% + {\dowithnextbox + {\bgroup + \setbox\scratchbox\hbox#1{\hss}% + \ifdim\nextboxwd<\wd\scratchbox\nextboxwd\wd\scratchbox\fi + \flushnextbox + \egroup} + \hbox} + +% \def\dodimchoice#1#2#3% +% {\ifx#3\relax +% #1\@EA\gobbleuntilrelax +% \else\ifdim#1#2% +% #3\@EAEAEA\gobbleuntilrelax +% \else +% \@EAEAEA\dodimchoice +% \fi\fi{#1}} + +% \def\donumchoice#1#2#3% +% {\ifx#3\relax +% #1\@EA\gobbleuntilrelax +% \else\ifnum#1#2% +% #3\@EAEAEA\gobbleuntilrelax +% \else +% \@EAEAEA\dodimchoice +% \fi\fi{#1}} + +% \def\dimchoice#1#2{\dodimchoice{#1}#2\empty\relax} +% \def\numchoice#1#2{\donumchoice{#1}#2\empty\relax} + +\def\gobbleuntilempty#1\empty{} + +\def\dodimchoice#1#2#3% + {\ifdim#1#2% + #3\@EA\gobbleuntilempty + \else + \@EA\dodimchoice + \fi{#1}} + +\def\donumchoice#1#2#3% + {\ifnum#1#2% + #3\@EA\gobbleuntilempty + \else + \@EA\dodimchoice + \fi{#1}} + +\def\dimchoice#1#2{\dodimchoice{#1}#2{=#1}{#1}\empty} +\def\numchoice#1#2{\donumchoice{#1}#2{=#1}{#1}\empty} + +% \the\dimexpr(\dimchoice {7pt}{{<10pt}{8pt}{<12pt}{9pt}{<15pt}{10pt}{=11pt}{12pt}}) +% \the\dimexpr(\dimchoice{11pt}{{<10pt}{8pt}{<12pt}{9pt}{<15pt}{10pt}{=11pt}{12pt}}) +% \the\dimexpr(\dimchoice{14pt}{{<10pt}{8pt}{<12pt}{9pt}{<15pt}{10pt}{=11pt}{12pt}}) + +\def\showsetupsdefinition[#1]{\showvalue{\??su:#1}} % temp hack for debugging + +% will be a MyWay +% +% \setuplayout[grid=yes] \setupcaption[figure][inbetween=] \useMPlibrary[dum] \setupcolors[state=start] +% +% \starttext \showgrid \showstruts +% +% \input ward \placefigure{}{\externalfigure[dummy][width=.5\hsize,lines=1.4,grid=yes]} +% \input ward \placefigure{}{\externalfigure[dummy][width=.5\hsize,lines=1.4,grid=fit]} +% \input ward \placefigure{}{\externalfigure[dummy][width=.5\hsize,lines=1.4,grid=height]} +% \input ward +% \page +% \input ward \placefigure{}{\externalfigure[dummy][width=.5\hsize,lines=1.5,grid=yes]} +% \input ward \placefigure{}{\externalfigure[dummy][width=.5\hsize,lines=1.5,grid=fit]} +% \input ward \placefigure{}{\externalfigure[dummy][width=.5\hsize,lines=1.5,grid=height]} +% \input ward +% \page +% \input ward \placefigure{}{\externalfigure[dummy][width=.5\hsize,lines=1.6,grid=yes]} +% \input ward \placefigure{}{\externalfigure[dummy][width=.5\hsize,lines=1.6,grid=fit]} +% \input ward \placefigure{}{\externalfigure[dummy][width=.5\hsize,lines=1.6,grid=height]} +% \input ward +% \page +% \input ward \placefigure[none]{}{\externalfigure[dummy][width=.5\hsize,lines=1.4,grid=yes]} +% \input ward \placefigure[none]{}{\externalfigure[dummy][width=.5\hsize,lines=1.4,grid=fit]} +% \input ward \placefigure[none]{}{\externalfigure[dummy][width=.5\hsize,lines=1.4,grid=height]} +% \input ward +% \page +% \input ward \placefigure[none]{}{\externalfigure[dummy][width=.5\hsize,lines=1.5,grid=yes]} +% \input ward \placefigure[none]{}{\externalfigure[dummy][width=.5\hsize,lines=1.5,grid=fit]} +% \input ward \placefigure[none]{}{\externalfigure[dummy][width=.5\hsize,lines=1.5,grid=height]} +% \input ward +% \page +% \input ward \placefigure[none]{}{\externalfigure[dummy][width=.5\hsize,lines=1.6,grid=yes]} +% \input ward \placefigure[none]{}{\externalfigure[dummy][width=.5\hsize,lines=1.6,grid=fit]} +% \input ward \placefigure[none]{}{\externalfigure[dummy][width=.5\hsize,lines=1.6,grid=height]} +% \input ward +% +% \stoptext + +% funny, as field action with e.g. dissolve ... only the field dissolves, bug? + +\setglobalsystemreference\rt!exec{Transition}{transition} + +%def\PDFexecutetransition {/Trans /Trans <>} +\def\PDFexecutetransition {/Trans /Trans <<\executeifdefined{PDFpage\argumentA}\PDFpagereplace>>} + +% new, continuous blocks, \som \par \startdoorlopendblok ... + +% \startitemize +% \item bagger +% \item bagger +% \item \startdoorlopendblok bagger \stopdoorlopendblok +% \item \endgraf \startdoorlopendblok bagger \stopdoorlopendblok +% \item \endgraf \startdoorlopendblok \strut bagger \stopdoorlopendblok +% \item \startdoorlopendblok +% \starttabulate +% \NC test \NC test \NC \NR +% \NC test \NC test \NC \NR +% \NC test \NC test \NC \NR +% \stoptabulate +% \stopdoorlopendblok +% \item test +% \stopitemize + +\def\startdoorlopendblok % for special cases, don't change it too much and don't rely on it + {\ifhmode\endgraf\nobreak\fi % don't remove the \nobreak + \dowithnextboxcontent + {\setlocalhsize \hsize\localhsize \forgetall} + {\bgroup + \forgeteverypar + \forgetparskip + \scratchdimen\nextboxht + \advance\scratchdimen\nextboxdp + \getnoflines\scratchdimen + \advance\scratchdimen-\strutheight + \setbox\nextbox\hbox{\lower\scratchdimen\box\nextbox}% + \ht\nextbox\strutheight + \dp\nextbox\strutdepth + \setbox\nextbox\vbox + {\indent\box\nextbox + \endgraf + \nobreak + \advance\noflines\minusone + \dorecurse\noflines{\crlf\nobreak}}% + \verticalstrut + \endgraf + \nobreak + \offinterlineskip + \kern-2\lineheight % 2\lineheight when no vertical struts in main \vbox + \nobreak + \unvbox\nextbox + \prevdepth\strutdepth + % evt (eerst testen) een signal zodat een direct volgend blok goed gaat) + \egroup} + \vbox\bgroup + \vskip-\lineheight \verticalstrut\endgraf + \insidefloattrue + \doinhibitblank} % beware, no \inhibitblank ! ! ! ! ! ! + +\def\stopdoorlopendblok + {\endgraf\verticalstrut\endgraf\kern-2\lineheight + \egroup} + +\def\tabulaterule % to be redone, not correct + {\dotabulaterule + {\hrule\!!height.5\scratchdimen\!!depth.5\scratchdimen\relax + \doifvalue{\??tt\currenttabulate\c!distance}\v!grid + {\kern-\scratchdimen}}} % experimental tm-prikkels + +% experimental: \synchronizegrid bla bla bla + +\newcounter\currentgridsync + +\def\gridsynctag{grs:\currentgridsync} + +\def\synchronizegrid + {\doglobal\increment\currentgridsync + \par\prevdepth\zeropoint + \nointerlineskip + \hpos\gridsynctag{\strut}\par + \vskip-\lineheight + \nointerlineskip + % top of text + \scratchdimen\MPy{\v!text:\MPp\gridsynctag}% + \advance\scratchdimen\MPh{\v!text:\MPp\gridsynctag}% + % move to first baseline + \advance\scratchdimen-\topskip + % subtract wrong baseline + \advance\scratchdimen-\MPy\gridsynctag + % get minimal number of lines + \advance\scratchdimen\lineheight + \getnoflines\scratchdimen + % calculate difference + \advance\scratchdimen-\noflines\lineheight\relax + \scratchdimen-\scratchdimen\relax + \ifdim\scratchdimen>\zeropoint + \nointerlineskip + \advance\scratchdimen-\lineheight + \vskip\scratchdimen \dontleavehmode \quad \strut + \par + %\else + % \message{no grid correction: \the\scratchdimen}\wait + \fi} + +% between alignment lines certain rules apply, and even a +% simple test can mess up a table, which is why we have a +% special test facility +% +% \ruledvbox +% {\starttabulate[|l|p|] +% \NC 1test \NC test \NC \NR +% \tableifelse{\doifelse{a}{a}}{\NC Xtest \NC test \NC \NR}{}% +% \stoptabulate} + +\long\def\tableifelse#1% + {\tablenoalign + {#1% + {\aftergroup \firstoftwoarguments}% + {\aftergroup\secondoftwoarguments}}} + +\long \def\tableiftextelse#1{\tableifelse{\doiftextelse{#1}}} + +% experiment, not yet to be used + +\def\displaybreak + {\ifhmode + \removeunwantedspaces + \ifcase\raggedstatus\hfill\fi + \strut\penalty-9999 % \break fails on case (3) + \fi} + +\def\startdisplay{\displaybreak\ignorespaces\startpacked} +\def\stopdisplay {\stoppacked\displaybreak\ignorespaces} + +\def\tightvbox{\dowithnextbox{\nextboxdp\zeropoint\flushnextbox}\vbox} +\def\tightvtop{\dowithnextbox{\nextboxht\zeropoint\flushnextbox}\vtop} + +% what is this stupid macro meant for: + +\def\hyphenationpoint + {\hskip\zeropoint} + +\def\hyphenated#1% + {\bgroup + \!!counta\zerocount + \def\hyphenated##1{\advance\!!counta\plusone}% + \handletokens#1\with\hyphenated + \!!countb\plusone + \def\hyphenated##1% + {##1% + \advance\!!countb\plusone\relax + \ifnum\!!countb>2 \ifnum\!!countb<\!!counta + \hyphenationpoint + \fi\fi}% + \handletokens#1\with\hyphenated + \egroup} + +\def\obeysupersubletters + {\let\super\normalsuper + \let\suber\normalsuber + \let\normalsuper\letterhat + \let\normalsuber\letterunderscore + \enablesupersub} + +\def\obeysupersubmath + {\let\normalsuper\letterhat + \let\normalsuber\letterunderscore + \enablesupersub} + +%\let\normaltype\type +% +%\def\type#1% +% {\expanded{\normaltype{\detokenize{#1}}}} + +% {x123 \os x123} {\tfa x123 \os x123} {x123 \tx x123 \os x123} +% \definefontsynonym[OldStyle][Serif] +% {x123 \os x123} {\tfa x123 \os x123} {x123 \tx x123 \os x123} + +% testen : +% +% \appendtoks +% \let\registerparoptions\relax +% \to \everyforgetall + +\def\startgridcorrection + {\dosingleempty\dostartgridcorrection} + +\def\dostartgridcorrection[#1]% + {\ifgridsnapping + \iffirstargument\doifsomething{#1}{\moveongrid[#1]}\fi + \snaptogrid\vbox\bgroup + \else + \startbaselinecorrection + \fi} + +\def\stopgridcorrection + {\ifgridsnapping + \egroup + \else + \stopbaselinecorrection + \fi} + +\def\checkgridsnapping + {\lineskip\ifgridsnapping\zeropoint\else\normallineskip\fi} + +\def\startplaatsen + {\dosingleempty\dostartplaatsen} + +\def\dostartplaatsen[#1]% tzt n*links etc + {\endgraf + \noindent\bgroup + \setlocalhsize + \hbox to \localhsize\bgroup + \doifnot{#1}\v!left\hss + \def\stopplaatsen + {\unskip\unskip\unskip + \doifnot{#1}\v!right\hss + \egroup + \egroup + \endgraf}% + \gobblespacetokens} + +% \startplaatsen[links] bla \stopplaatsen + +% we don't register the paragraph characteristics, only the +% width + +\appendtoks + \setinnerparpositions % see "techniek" for application +\to \everytabulate + +\def\fontclassname#1#2% + {\ifcsname\??ff#1#2\endcsname + \fontclassname{#1}{\csname\??ff#1#2\endcsname}% + \else\ifcsname\??ff#2\endcsname + \fontclassname{#1}{\csname\??ff#2\endcsname}% + \else + #2% + \fi\fi} + +\def\defineclassfontsynonym + {\dotripleargument\dodefineclassfontsynonym} + +\def\dodefineclassfontsynonym[#1][#2][#3]% + {\definefontsynonym[#1][\fontclassname{#2}{#3}]} + +%\definefontsynonym [KopFont] [\fontclassname{officina}{SerifBold}] +% +%\defineclassfontsynonym [KopFont] [officina] [SerifBold] + +\def\startcolumnmakeup % don't change + {\bgroup + \getrawnoflines\textheight % teksthoogte kan topskip hebben, dus raw + \scratchdimen\noflines\lineheight + \advance\scratchdimen-\lineheight + \advance\scratchdimen\topskip + \setbox\scratchbox + \ifcase\showgridstate\vbox\else\ruledvbox\fi to \scratchdimen\bgroup + \forgetall} % ! don't change + +\def\stopcolumnmakeup + {\egroup + \dp\scratchbox\zeropoint + \wd\scratchbox\textwidth + \box\scratchbox + \egroup + \synchronizehsize} + +\long\def\startexternalfigure + {\dotripleempty\dostartexternalfigure} + +\long\def\dostartexternalfigure[#1][#2][#3]#4\stopexternalfigure + {\gdef\figuredescription{#4}% + \externalfigure[#1][#2][#3]% + \globallet\figuredescription\empty} + +\let\figuredescription\empty + +%% where does this come from, old code probably +%% +%% +%% \newif\ifpagechanged \let\lastchangedpage\empty +%% +%% \def\checkpagechange#1% +%% {\gettwopassdata\s!paragraph +%% \pagechangedfalse +%% \iftwopassdatafound +%% \ifnum\twopassdata>0\getvalue{\s!paragraph:p:#1}\relax +%% \pagechangedtrue +%% \fi +%% \fi +%% \ifpagechanged +%% \letgvalue{\s!paragraph:p:#1}\twopassdata +%% \globallet\lastchangedpage\twopassdata +%% \else +%% \globallet\lastchangedpage\realfolio +%% \fi +%% \doparagraphreference} +%% +%% \def\changedpage#1% +%% {\getvalue{\s!paragraph:p:#1}} + +\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}} + +% incomplete, will be a special case of float placement + +\def\startfixed{\dosingleempty\dostartfixed} + +\def\dostartfixed[#1]% + {\expanded{\dowithnextbox{\noexpand\dodofixed{\ifhmode0\else1\fi}{#1}}}% + \vbox\bgroup + \setlocalhsize} + +\def\stopfixed + {\egroup} + +\def\dodofixed#1#2% + {\ifcase#1\relax + \processaction + [#2] + [ \v!high=>\bbox {\flushnextbox}, + \v!low=>\tbox {\flushnextbox}, + \v!middle=>\vcenter{\flushnextbox}, + \v!lohi=>\vcenter{\flushnextbox}, + \s!unknown=>\tbox {\flushnextbox}, + \s!default=>\tbox {\flushnextbox}]% + \else + \startbaselinecorrection + \noindent\flushnextbox + \stopbaselinecorrection + \fi} + +% \startitemize +% +% \item \externalfigure[koe][height=2cm] +% \item \externalfigure[koe][height=2cm] +% \item \externalfigure[koe][height=2cm] +% \item \externalfigure[koe][height=2cm] +% +% \page +% +% \item \startfixed \externalfigure[koe][height=2cm]\stopfixed +% \item \startfixed[high]\externalfigure[koe][height=2cm]\stopfixed +% \item \startfixed[low] \externalfigure[koe][height=2cm]\stopfixed +% \item \startfixed[lohi]\externalfigure[koe][height=2cm]\stopfixed +% +% \page +% +% \item test \startfixed \externalfigure[koe][height=2cm]\stopfixed +% \item test \startfixed[high]\externalfigure[koe][height=2cm]\stopfixed +% \item test \startfixed[low] \externalfigure[koe][height=2cm]\stopfixed +% \item test \startfixed[lohi]\externalfigure[koe][height=2cm]\stopfixed +% +% \page +% +% \item test \par \startfixed \externalfigure[koe][height=2cm]\stopfixed +% \item test \par \startfixed[high]\externalfigure[koe][height=2cm]\stopfixed +% \item test \par \startfixed[low] \externalfigure[koe][height=2cm]\stopfixed +% \item test \par \startfixed[lohi]\externalfigure[koe][height=2cm]\stopfixed +% +% \stopitemize + +\def\obeyfollowingtoken{{}} % end \cs scanning + +% \def\comparedimension#1#2% +% {\chardef\compresult +% \ifdim#1<#2% +% \zerocount +% \else\ifdim#1<#2% +% \plusone +% \else +% \plustwo +% \fi\fi} +% \newdimen\roundingeps \roundingeps=10sp +% \def\comparedimensioneps#1#2% +% {\chardef\compresult +% \ifdim\dimexpr(#1-#2)<\roudingeps +% \zerocount +% \else\ifdim\dimexpr(#2-#1)<\roudingeps +% \zerocount +% \else\ifdim#1<#2% +% \plusone +% \else +% \plustwo +% \fi\fi\fi} + +%D Next we load a few local optimizations and new features. They +%D live on on my machine and are not distributed, but they may end +%D up in the distributed files. + +\enablemode[mkii] \enablemode[*mkii] \long\def\startluacode#1\stopluacode{} \long\def\ctxlua #1{} @@ -19,4 +940,4 @@ \def\enabletrackers [#1]{} \def\disabletrackers[#1]{} -\endinput +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/cont-new.mkiv b/Master/texmf-dist/tex/context/base/cont-new.mkiv index 6269e5a6160..3bda269efef 100644 --- a/Master/texmf-dist/tex/context/base/cont-new.mkiv +++ b/Master/texmf-dist/tex/context/base/cont-new.mkiv @@ -1,6 +1,6 @@ %D \module %D [ file=cont-new, -%D version=2006.10.04, +%D version=1995.10.10, %D title=\CONTEXT\ Miscellaneous Macros, %D subtitle=New Macros, %D author=Hans Hagen, @@ -11,29 +11,577 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% potential new defaults: -% -% \setbreakpoints[compound] +\newcontextversion{2011.05.18 18:04} + +%D This file is loaded at runtime, thereby providing an +%D excellent place for hacks, patches, extensions and new +%D features. \unprotect -\ctxlua{logs.report = commands.report} % this will become default +\writestatus\m!system{beware: some patches loaded from cont-new.mkiv} + + +\def\fastscale#1% + {\begingroup + \ifnum#1=1000\relax + \setfalse\scaleboxdone + \else + \settrue\scaleboxdone + \edef\finalscaleboxxscale{\withoutpt\the\dimexpr#1pt/1000\relax}% + \let\finalscaleboxyscale\finalscaleboxxscale + \fi + \dowithnextbox{\doscaleboxindeed\flushnextbox\endgroup}\hbox} + +% \setupcaption [figure] [align=flushleft] +% \setupcaption [figure-1] [align=flushleft,leftmargin=10mm] +% \setupcaption [figure-2] [align=flushleft,leftmargin=10mm,rightmargin=-10mm,width=\textwidth] +% +% \startsetups somefigure +% \ifdim\floatsetupwidth>\textwidth +% \placesetupfloat[figure-2] +% \else +% \placesetupfloat[figure-1] +% \fi +% \stopsetups +% +% \placefloatwithsetups[somefigure]{}{\externalfigure[dummy][width=5cm,height=2cm]} + +\def\placefloatwithsetups + {\dotripleempty\doplacefloatwithsetups} + +\long\def\doplacefloatwithsetups[#1][#2][#3]#4% + {\def\floatsetupcaption {#4}% + \def\floatsetupcontent {\copy\nextbox}% + \def\floatsetupwidth {\wd\nextbox}% + \def\floatsetupheight {\ht\nextbox}% + \def\placesetupfloat[##1]{\placefloat[##1][#2][#3]{#4}{\floatsetupcontent}}% #4 and not \floatsetupcaption (unexpanded) + \dowithnextbox{\setups[#1]}\vbox} + +\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} + +\def\singlewidened #1{\hbox spread 1em{\hss#1\hss}} +\def\complexwidened[#1]#2{\hbox spread #1{\hss#2\hss}} + +\definecomplexorsimple\widened + +% todo +% +% \def\definelocation{\dodoubleargument\dodefinelocation} +% \def\dodefinelocation[#1][#2]{\setvalue{loc:#1}{#2}} +% +% \definelocation[lt] [\v!left\v!top] +% \definelocation[tl] [\v!left\v!top] +% \definelocation[\v!top\v!left][\v!left\v!top] +% +% \def\getlocation#1{\executeifdefined{loc:#1}{#1}} + +% \let\cs\getvalue % no, we want \cs to be czech + +% experimental so this may change + +\def\startdescriptions + {\dosingleempty\dostartdescriptions} + +\def\dostartdescriptions[#1]% + {\begingroup + \def\item{\getvalue{#1}}% + \let\dostoppairdescription \donothing + \let\@@description \dostartpairdescription + \let\@@startsomedescription\dostartsomedescription} + +\def\stopdescriptions + {\dostoppairdescription + \endgroup} + +\def\dostartpairdescription[#1][#2]% + {\dostoppairdescription + \def\dostoppairdescription{\@@stopdescription{#1}}% + \bgroup + \def\currentdescription{#1}% + \doifelse{\descriptionparameter{\s!do\c!state}}\v!start + {\@@makedescription{#1}[#2]{}} + {\@@makedescription{#1}[#2]}} + +\def\dostartsomedescription% #1[#2]#3% + {\bgroup + \@@makedescription} % {#1}[#2]{#3}} + +% \starttext +% +% \definedescription[test] +% +% \startdescriptions +% \test{Foo} Bar bar bar +% \test{Foo} Bar bar bar +% \test{Foo} Bar bar bar +% \stopdescriptions +% +% \startdescriptions[test] +% \item{Foo} Bar bar bar +% \item{Foo} Bar bar bar +% \item{Foo} Bar bar bar +% \stopdescriptions +% +% \startdescriptions +% \starttest{Foo} Bar bar bar \stoptest +% \starttest{Foo} Bar bar bar \stoptest +% \starttest{Foo} Bar bar bar \stoptest +% \stopdescriptions +% +% \startdescriptions[test] +% \item{Foo} Bar bar bar +% \item{Foo} Bar bar bar +% \item{Foo} Bar bar bar +% \stopdescriptions +% +% \stoptext + +% this will be activated when +% +% \newinsert\thispageinsert % <- installinsertion +% +% \def\flushatthispage +% {\bgroup +% \dowithnextbox{\insert\thispageinsert{\box\nextbox}\egroup}% +% \hbox} +% +% \appendtoks +% \ifvoid\thispageinsert\else\hbox{\smashedbox\thispageinsert}\fi +% \to \everyshipout + +% \definemarkedpage[nobackgrounds] +% \markpage[nobackgrounds] +% \doifmarkedpageelse{nobackgrounds} + +% Just a simple and fast hanger, for usage in macros. + +\def\setuphanging + {\dodoubleempty\getparameters[\??ha]} + +\setuphanging + [\c!distance=.5em] + +\def\starthanging + {\noindent\bgroup + \dowithnextbox + {\setbox\nextbox\hbox{\flushnextbox\hskip\@@hadistance}% + \hangindent\nextboxwd + \hangafter\plusone + \flushnextbox\ignorespaces} + \hbox} + +\def\stophanging + {\endgraf + \egroup} + +% experimental + +\def\stophangaround + {\endgraf + \egroup} + +\def\starthangaround + {\noindent\bgroup + \dowithnextbox + {\ifdim\nextboxht>\strutht\setbox\nextbox\tbox{\flushnextbox}\fi + \setbox\nextbox\hbox{\flushnextbox\hskip\@@hadistance}% + \getboxheight\scratchdimen\of\box\nextbox + \getnoflines\scratchdimen + \nextboxht\strutht + \nextboxdp\strutdp + \hangindent\nextboxwd + \hangafter-\noflines + \llap{\flushnextbox}\ignorespaces} + \hbox} + +\def\modevalue#1#2#3% + {\@EA\ifx\csname\@mode@\systemmodeprefix#1\endcsname\endcsname\enabledmode#2\else#2\fi} + +\def\systemmodevalue#1% + {\modevalue{\systemmodeprefix#1}} + +% new, still to be improved +% +% \dorecurse{10} +% {\input thuan +% \placefigure{}{\framed[height=1.5cm]{test}} +% \placefloatplaceholder} + +\def\placefloatplaceholder + {\ifroomforfloat \else + \scratchdimen\pagegoal + \advance\scratchdimen-\pagetotal + \advance\scratchdimen-3\lineheight + \ifdim\scratchdimen>\zeropoint + \startlinecorrection[blank] + \mhbox{\inframed{\labeltexts{placeholder}{\lastcaptiontag}}}% + \stoplinecorrection + \else + \allowbreak + \fi + \fi} + +\setuplabeltext + [placeholder={, moved}] + +\startluacode + function commands.percentageof(str,dim) + local n = str:match("^(.*)%%$") + tex.sprint(tex.ctxcatcodes,(n and (tonumber(n)/100)*dim .. "sp") or str) + end +\stopluacode + +\gdef\setpercentdimen#1#2% + {#1=\ctxcommand{percentageof("#2",\number#1)}\relax} + +% \scratchdimen=100pt \setpercentdimen\scratchdimen{10\letterpercent} \the\scratchdimen +% \scratchdimen=100pt \setpercentdimen\scratchdimen{5pt} \the\scratchdimen + +\bgroup \permitcircumflexescape -\def\immediatemessage#1{\ctxlua{commands.writestatus("message","#1")}} +\obeylines % don't remove %'s ! -% we need to figure this out (to be discussed) +\gdef\collapsedspace#1% + {\ifx#1^^M% + \expandafter\collapsedspace + \else + \space + \expandafter#1% + \fi} -\unexpanded\def\textminus - {\char \iffontchar\font"2012 "2012 % figuredash - \else\iffontchar\font"2013 "2013 % endash - \else\iffontchar\font"2212 "2212 % math minus - "002D % hyphen - \fi\fi\fi} +\gdef\collapsespaces + {\prependtoksonce\relax\to\everyeof% + \ignorelines% + \ignoretabs% + \let\obeyedspace\collapsedspace% + \obeyspaces} -\unexpanded\def\textplus - {\char"002B } % plus +\egroup + +\def\inlinedbox + {\bgroup + \dowithnextbox + {\scratchdimen\nextboxht + \advance\scratchdimen\nextboxdp + \advance\scratchdimen-\lineheight + \divide\scratchdimen\plustwo + \advance\scratchdimen\strutdepth + \setbox\nextbox\hbox{\lower\scratchdimen\flushnextbox}% + \nextboxht\strutht + \nextboxdp\strutdp + \flushnextbox + \egroup}% + \hbox} + +\def\dimenratio#1#2% etex only + {\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\relax}{#2}} + +\def\buttonframed{\dodoubleempty\localframed[\??bt]} % goodie + +\unexpanded\def\asciistr#1{\dontleavehmode{\defconvertedargument\ascii{#1}\verbatimfont\ascii}} + +\def\shapefill{\vskip\zeropoint\!!plus\lineheight\!!minus\lineheight\relax} + +% \ruledhbox +% {\startignorespaces +% \def\oeps{a} +% \startignorespaces +% \def\oeps{a} +% \stopignorespaces +% \def\oeps{a} +% \stopignorespaces +% \oeps} + +\newsignal\boissignal +\newcount \boislevel + +\long\def\startignorespaces + {\advance\boislevel\plusone + \ifcase\boislevel\or \ifhmode + \hskip\boissignal + \fi \fi + \ignorespaces} + +\long\def\stopignorespaces + {\ifcase\boislevel\or \ifhmode + \doloop + {\ifdim\lastskip=\zeropoint + \exitloop + \else\ifdim\lastskip=\boissignal + \unskip + \exitloop + \else + \unskip + \fi\fi}% + \fi \fi + \advance\boislevel\minusone} + +\def\minimalhbox#1#% + {\dowithnextbox + {\bgroup + \setbox\scratchbox\hbox#1{\hss}% + \ifdim\nextboxwd<\wd\scratchbox\nextboxwd\wd\scratchbox\fi + \flushnextbox + \egroup} + \hbox} + +\def\gobbleuntilempty#1\empty{} + +\def\dodimchoice#1#2#3% + {\ifdim#1#2% + #3\@EA\gobbleuntilempty + \else + \@EA\dodimchoice + \fi{#1}} + +\def\donumchoice#1#2#3% + {\ifnum#1#2% + #3\@EA\gobbleuntilempty + \else + \@EA\dodimchoice + \fi{#1}} + +\def\dimchoice#1#2{\dodimchoice{#1}#2{=#1}{#1}\empty} +\def\numchoice#1#2{\donumchoice{#1}#2{=#1}{#1}\empty} + +% \the\dimexpr(\dimchoice {7pt}{{<10pt}{8pt}{<12pt}{9pt}{<15pt}{10pt}{=11pt}{12pt}}) +% \the\dimexpr(\dimchoice{11pt}{{<10pt}{8pt}{<12pt}{9pt}{<15pt}{10pt}{=11pt}{12pt}}) +% \the\dimexpr(\dimchoice{14pt}{{<10pt}{8pt}{<12pt}{9pt}{<15pt}{10pt}{=11pt}{12pt}}) + +\def\showsetupsdefinition[#1]{\showvalue{\??su:#1}} % temp hack for debugging + +\def\tabulaterule % to be redone, not correct + {\dotabulaterule + {\hrule\!!height.5\scratchdimen\!!depth.5\scratchdimen\relax + \doifvalue{\??tt\currenttabulate\c!distance}\v!grid + {\kern-\scratchdimen}}} % experimental tm-prikkels +% so far + +% between alignment lines certain rules apply, and even a +% simple test can mess up a table, which is why we have a +% special test facility +% +% \ruledvbox +% {\starttabulate[|l|p|] +% \NC 1test \NC test \NC \NR +% \tableifelse{\doifelse{a}{a}}{\NC Xtest \NC test \NC \NR}{}% +% \stoptabulate} + +\long\def\tableifelse#1% + {\tablenoalign + {#1% + {\aftergroup \firstoftwoarguments}% + {\aftergroup\secondoftwoarguments}}} + +\long \def\tableiftextelse#1{\tableifelse{\doiftextelse{#1}}} + +\def\tightvbox{\dowithnextbox{\nextboxdp\zeropoint\flushnextbox}\vbox} +\def\tightvtop{\dowithnextbox{\nextboxht\zeropoint\flushnextbox}\vtop} + +% what is this stupid macro meant for: + +\def\hyphenationpoint + {\hskip\zeropoint} + +\def\hyphenated#1% + {\bgroup + \!!counta\zerocount + \def\hyphenated##1{\advance\!!counta\plusone}% + \handletokens#1\with\hyphenated + \!!countb\plusone + \def\hyphenated##1% + {##1% + \advance\!!countb\plusone\relax + \ifnum\!!countb>2 \ifnum\!!countb<\!!counta + \hyphenationpoint + \fi\fi}% + \handletokens#1\with\hyphenated + \egroup} + +\def\obeysupersubletters + {\let\super\normalsuper + \let\suber\normalsuber + \let\normalsuper\letterhat + \let\normalsuber\letterunderscore + \enablesupersub} + +\def\obeysupersubmath + {\let\normalsuper\letterhat + \let\normalsuber\letterunderscore + \enablesupersub} + +\def\startgridcorrection + {\dosingleempty\dostartgridcorrection} + +\def\dostartgridcorrection[#1]% + {\ifgridsnapping + \iffirstargument\doifsomething{#1}{\moveongrid[#1]}\fi + \snaptogrid\vbox\bgroup + \else + \startbaselinecorrection + \fi} + +\def\stopgridcorrection + {\ifgridsnapping + \egroup + \else + \stopbaselinecorrection + \fi} + +\def\checkgridsnapping + {\lineskip\ifgridsnapping\zeropoint\else\normallineskip\fi} + +\def\startplaatsen + {\dosingleempty\dostartplaatsen} + +\def\dostartplaatsen[#1]% tzt n*links etc + {\endgraf + \noindent\bgroup + \setlocalhsize + \hbox to \localhsize\bgroup + \doifnot{#1}\v!left\hss + \def\stopplaatsen + {\unskip\unskip\unskip + \doifnot{#1}\v!right\hss + \egroup + \egroup + \endgraf}% + \gobblespacetokens} + +% \startplaatsen[links] bla \stopplaatsen + +% we don't register the paragraph characteristics, only the +% width + +\appendtoks + \setinnerparpositions % see "techniek" for application +\to \everytabulate + +\def\fontclassname#1#2% + {\ifcsname\??ff#1#2\endcsname + \fontclassname{#1}{\csname\??ff#1#2\endcsname}% + \else\ifcsname\??ff#2\endcsname + \fontclassname{#1}{\csname\??ff#2\endcsname}% + \else + #2% + \fi\fi} + +\def\defineclassfontsynonym + {\dotripleargument\dodefineclassfontsynonym} + +\def\dodefineclassfontsynonym[#1][#2][#3]% + {\definefontsynonym[#1][\fontclassname{#2}{#3}]} + +%\definefontsynonym [KopFont] [\fontclassname{officina}{SerifBold}] +% +%\defineclassfontsynonym [KopFont] [officina] [SerifBold] + +\def\startcolumnmakeup % don't change + {\bgroup + \getrawnoflines\textheight % teksthoogte kan topskip hebben, dus raw + \scratchdimen\noflines\lineheight + \advance\scratchdimen-\lineheight + \advance\scratchdimen\topskip + \setbox\scratchbox + \ifcase\showgridstate\vbox\else\ruledvbox\fi to \scratchdimen\bgroup + \forgetall} % ! don't change + +\def\stopcolumnmakeup + {\egroup + \dp\scratchbox\zeropoint + \wd\scratchbox\textwidth + \box\scratchbox + \egroup + \synchronizehsize} + +\long\def\startexternalfigure + {\dotripleempty\dostartexternalfigure} + +\long\def\dostartexternalfigure[#1][#2][#3]#4\stopexternalfigure + {\gdef\figuredescription{#4}% + \externalfigure[#1][#2][#3]% + \globallet\figuredescription\empty} + +\let\figuredescription\empty + +% incomplete, will be a special case of float placement + +\def\startfixed{\dosingleempty\dostartfixed} + +\def\dostartfixed[#1]% + {\expanded{\dowithnextbox{\noexpand\dodofixed{\ifhmode0\else1\fi}{#1}}}% + \vbox\bgroup + \setlocalhsize} + +\def\stopfixed + {\egroup} + +\def\dodofixed#1#2% + {\ifcase#1\relax + \processaction + [#2] + [ \v!high=>\bbox {\flushnextbox}, + \v!low=>\tbox {\flushnextbox}, + \v!middle=>\vcenter{\flushnextbox}, + \v!lohi=>\vcenter{\flushnextbox}, + \s!unknown=>\tbox {\flushnextbox}, + \s!default=>\tbox {\flushnextbox}]% + \else + \startbaselinecorrection + \noindent\flushnextbox + \stopbaselinecorrection + \fi} + +% \startitemize +% +% \item \externalfigure[koe][height=2cm] +% \item \externalfigure[koe][height=2cm] +% \item \externalfigure[koe][height=2cm] +% \item \externalfigure[koe][height=2cm] +% +% \page +% +% \item \startfixed \externalfigure[koe][height=2cm]\stopfixed +% \item \startfixed[high]\externalfigure[koe][height=2cm]\stopfixed +% \item \startfixed[low] \externalfigure[koe][height=2cm]\stopfixed +% \item \startfixed[lohi]\externalfigure[koe][height=2cm]\stopfixed +% +% \page +% +% \item test \startfixed \externalfigure[koe][height=2cm]\stopfixed +% \item test \startfixed[high]\externalfigure[koe][height=2cm]\stopfixed +% \item test \startfixed[low] \externalfigure[koe][height=2cm]\stopfixed +% \item test \startfixed[lohi]\externalfigure[koe][height=2cm]\stopfixed +% +% \page +% +% \item test \par \startfixed \externalfigure[koe][height=2cm]\stopfixed +% \item test \par \startfixed[high]\externalfigure[koe][height=2cm]\stopfixed +% \item test \par \startfixed[low] \externalfigure[koe][height=2cm]\stopfixed +% \item test \par \startfixed[lohi]\externalfigure[koe][height=2cm]\stopfixed +% +% \stopitemize + +\def\obeyfollowingtoken{{}} % end \cs scanning + +% potential new defaults: +% +% \setbreakpoints[compound] -% till we fixed all styles +% till we fixed all styles: \let\\=\crlf diff --git a/Master/texmf-dist/tex/context/base/cont-new.tex b/Master/texmf-dist/tex/context/base/cont-new.tex deleted file mode 100644 index 9c4fdba18f9..00000000000 --- a/Master/texmf-dist/tex/context/base/cont-new.tex +++ /dev/null @@ -1,992 +0,0 @@ -%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. - -\newcontextversion{2010.05.24 13:05} - -%D This file is loaded at runtime, thereby providing an -%D excellent place for hacks, patches, extensions and new -%D features. - -\unprotect - -% it's about time to clean up this file ... - -\writestatus\m!systems{beware: some patches loaded from cont-new.tex} - -% \ifx\pdfmapfile \undefined \else \pdfmapfile{ } \fi - -% \font\f=dummyfont \rpcode\f0=500 \hbox{..}\char0 -% todo: mp-new -% caption: grid=top|bottom in xml defs - -\def\fastscale#1% - {\begingroup - \ifnum#1=1000\relax - \setfalse\scaleboxdone - \else - \settrue\scaleboxdone - \edef\finalscaleboxxscale{\withoutpt\the\dimexpr#1pt/1000\relax}% - \let\finalscaleboxyscale\finalscaleboxxscale - \fi - \dowithnextbox{\doscaleboxindeed\flushnextbox\endgroup}\hbox} - -% \setupcaption [figure] [align=flushleft] -% \setupcaption [figure-1] [align=flushleft,leftmargin=10mm] -% \setupcaption [figure-2] [align=flushleft,leftmargin=10mm,rightmargin=-10mm,width=\textwidth] -% -% \startsetups somefigure -% \ifdim\floatsetupwidth>\textwidth -% \placesetupfloat[figure-2] -% \else -% \placesetupfloat[figure-1] -% \fi -% \stopsetups -% -% \placefloatwithsetups[somefigure]{}{\externalfigure[dummy][width=5cm,height=2cm]} - -\def\placefloatwithsetups - {\dotripleempty\doplacefloatwithsetups} - -\long\def\doplacefloatwithsetups[#1][#2][#3]#4% - {\def\floatsetupcaption {#4}% - \def\floatsetupcontent {\copy\nextbox}% - \def\floatsetupwidth {\wd\nextbox}% - \def\floatsetupheight {\ht\nextbox}% - \def\placesetupfloat[##1]{\placefloat[##1][#2][#3]{#4}{\floatsetupcontent}}% #4 and not \floatsetupcaption (unexpanded) - \dowithnextbox{\setups[#1]}\vbox} - -\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} - -% \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}} - -\definecomplexorsimple\widened - -% todo -% -% \def\definelocation{\dodoubleargument\dodefinelocation} -% \def\dodefinelocation[#1][#2]{\setvalue{loc:#1}{#2}} -% -% \definelocation[lt] [\v!left\v!top] -% \definelocation[tl] [\v!left\v!top] -% \definelocation[\v!top\v!left][\v!left\v!top] -% -% \def\getlocation#1{\executeifdefined{loc:#1}{#1}} - -% just in case we load something from a file (pdfr-ec for instance) - -\prependtoks \restoreendofline \to \everybeforeshipout - -\let\cs\getvalue - -% experimental so this may change - -\def\startdescriptions - {\dosingleempty\dostartdescriptions} - -\def\dostartdescriptions[#1]% - {\begingroup - \def\item{\getvalue{#1}}% - \let\dostoppairdescription \donothing - \let\@@description \dostartpairdescription - \let\@@startsomedescription\dostartsomedescription} - -\def\stopdescriptions - {\dostoppairdescription - \endgroup} - -\def\dostartpairdescription[#1][#2]% - {\dostoppairdescription - \def\dostoppairdescription{\@@stopdescription{#1}}% - \bgroup - \def\currentdescription{#1}% - \doifelse{\descriptionparameter{\s!do\c!state}}\v!start - {\@@makedescription{#1}[#2]{}} - {\@@makedescription{#1}[#2]}} - -\def\dostartsomedescription% #1[#2]#3% - {\bgroup - \@@makedescription} % {#1}[#2]{#3}} - -% \starttext -% -% \definedescription[test] -% -% \startdescriptions -% \test{Foo} Bar bar bar -% \test{Foo} Bar bar bar -% \test{Foo} Bar bar bar -% \stopdescriptions -% -% \startdescriptions[test] -% \item{Foo} Bar bar bar -% \item{Foo} Bar bar bar -% \item{Foo} Bar bar bar -% \stopdescriptions -% -% \startdescriptions -% \starttest{Foo} Bar bar bar \stoptest -% \starttest{Foo} Bar bar bar \stoptest -% \starttest{Foo} Bar bar bar \stoptest -% \stopdescriptions -% -% \startdescriptions[test] -% \item{Foo} Bar bar bar -% \item{Foo} Bar bar bar -% \item{Foo} Bar bar bar -% \stopdescriptions -% -% \stoptext - -% to do: -% -% \def\defineshapesynonym -% {\dodoubleargument\dodefineshapesynonym} -% -% \def\dodefineshapesynonym[#1][#2]% -% {\setvalue{shsy:#1}{#2}} -% -% \def\shapesynonym#1% -% {\ifcsname shsy:#1\endcsname -% \expandafter\shapesynonym\csname shsy:#1\endcsname\else#1% -% \fi} -% -%\defineshapesynonym[eacute] [e] -%\defineshapesynonym[egrave] [e] -%\defineshapesynonym[eumlaut [e] -%\defineshapesynonym[eogonek][e] -% -% more reduction -% -%\defineshapesynonym[e][o] -%\defineshapesynonym[w][v] -%\defineshapesynonym[m][n] -% -% \shapesynonym{eacute} - -% this will be activated when - -% \newinsert\thispageinsert % <- installinsertion - -% \def\flushatthispage -% {\bgroup -% \dowithnextbox{\insert\thispageinsert{\box\nextbox}\egroup}% -% \hbox} - -% \appendtoks -% \ifvoid\thispageinsert\else\hbox{\smashedbox\thispageinsert}\fi -% \to \everyshipout - -% \definemarkedpage[nobackgrounds] -% \markpage[nobackgrounds] -% \doifmarkedpageelse{nobackgrounds} - -\newcounter\nofmarkedpages - -\def\definemarkedpage[#1]% - {\definetwopasslist{\v!page:#1}} - -\def\markpage[#1]% looks very much like domarginreference - {\iftrialtypesetting\else - \doglobal\increment\nofmarkedpages\relax - \lazysavetwopassdata{\v!page:#1}{\nofmarkedpages}{\noexpand\realfolio}% - \fi} - -\def\doifmarkedpageelse#1% - {\gettwopassdatalist{\v!page:#1}% - \expanded{\doifinsetelse{\realfolio}{\twopassdatalist}}} - -% Just a simple and fast hanger, for usage in macros. - -\def\setuphanging - {\dodoubleempty\getparameters[\??ha]} - -\setuphanging - [\c!distance=.5em] - -\def\starthanging - {\noindent\bgroup - \dowithnextbox - {\setbox\nextbox\hbox{\flushnextbox\hskip\@@hadistance}% - \hangindent\nextboxwd - \hangafter\plusone - \flushnextbox\ignorespaces} - \hbox} - -\def\stophanging - {\endgraf - \egroup} - -% experimental - -\def\stophangaround - {\endgraf - \egroup} - -\def\starthangaround - {\noindent\bgroup - \dowithnextbox - {\ifdim\nextboxht>\strutht\setbox\nextbox\tbox{\flushnextbox}\fi - \setbox\nextbox\hbox{\flushnextbox\hskip\@@hadistance}% - \getboxheight\scratchdimen\of\box\nextbox - \getnoflines\scratchdimen - \nextboxht\strutht - \nextboxdp\strutdp - \hangindent\nextboxwd - \hangafter-\noflines - \llap{\flushnextbox}\ignorespaces} - \hbox} - -\def\modevalue#1#2#3% - {\@EA\ifx\csname\@mode@\systemmodeprefix#1\endcsname\endcsname\enabledmode#2\else#2\fi} - -\def\systemmodevalue#1% - {\modevalue{\systemmodeprefix#1}} - -% \getmulticolumnlines -> now in cont-loc, to be tested and really needed - -% \tracefonthandlingtrue - -% new, still to be improved -% -% \dorecurse{10} -% {\input thuan -% \placefigure{}{\framed[height=1.5cm]{test}} -% \placefloatplaceholder} - -\def\placefloatplaceholder - {\ifroomforfloat \else - \scratchdimen\pagegoal - \advance\scratchdimen-\pagetotal - \advance\scratchdimen-3\lineheight - \ifdim\scratchdimen>\zeropoint - \startlinecorrection[blank] - \mhbox{\inframed{\labeltexts{placeholder}{\lastcaptiontag}}}% - \stoplinecorrection - \else - \allowbreak - \fi - \fi} - -\setuplabeltext - [placeholder={, moved}] - -% etex only, of course we could just parse (scan for \% in string) - -\newif\ifpercentdimendone - -\bgroup % usage: \setpercentdimen\somedimen{% or dimen} todo: pct -\catcode124=\@@comment -\catcode 37=\@@active -\gdef\setpercentdimen#1#2| - {\xdef\@@expanded{#2}| - \ifx\@@expanded\empty\else - \bgroup - \global\percentdimendonefalse - \def\%{\dimexpr#1/100\relax\global\percentdimendonetrue\ignorespaces}| scantokens add's a space - \catcode`%=\@@active - \catcode`\\=\@@escape - \let%\%| - \scratchdimen#1| - \xdef\@@expanded{\@@expanded\scratchdimen\!!zeropoint}| trick: when 1.2 => .2\scratchdimen and 0pt typeset - \startnointerference - \global\globalscratchdimen\scantokens\@EA{\@@expanded}| i'm lazy and use etex - \stopnointerference - \egroup - #1\globalscratchdimen - \fi} -\egroup - -% TEX alternative, in principle accurate enough and also a bit faster - -% \bgroup -% -% \catcode`\%=\@@other -% \catcode`\|=\@@comment -% -% \gdef\setpercentdimen#1#2| -% {\beforesplitstring#2\at%\to\ascii -% \doifelse\ascii{#2} -% {#1=#2} -% {\divide#1by100\relax#1=\ascii#1\relax}} | or: {#1=\ascii#1\divide#1by100\relax}} -% -% \egroup -% -% \dimen0=1000pt \setpercentdimen{\dimen0}{10%} \the\dimen0 -% \dimen0= 100pt \setpercentdimen{\dimen0}{10%} \the\dimen0 -% \dimen0= 95pt \setpercentdimen{\dimen0}{10%} \the\dimen0 -% \dimen0= 10pt \setpercentdimen{\dimen0}{10%} \the\dimen0 -% \dimen0= 1pt \setpercentdimen{\dimen0}{10%} \the\dimen0 - -\bgroup - -\obeylines % don't remove %'s ! - -\gdef\collapsedspace#1% - {\ifx#1^^M% - \expandafter\collapsedspace - \else - \space - \expandafter#1% - \fi} - -\gdef\collapsespaces - {\prependtoksonce\relax\to\everyeof% - \ignorelines% - \ignoretabs% - \let\obeyedspace\collapsedspace% - \obeyspaces} - -\egroup - -\def\inlinedbox - {\bgroup - \dowithnextbox - {\scratchdimen\nextboxht - \advance\scratchdimen\nextboxdp - \advance\scratchdimen-\lineheight - \divide\scratchdimen\plustwo - \advance\scratchdimen\strutdepth - \setbox\nextbox\hbox{\lower\scratchdimen\flushnextbox}% - \nextboxht\strutht - \nextboxdp\strutdp - \flushnextbox - \egroup}% - \hbox} - -% \readfile{cont-exp}\donothing\donothing % speed up (5-20%) - -\def\dimenratio#1#2% etex only - {\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\relax}{#2}} - -\def\buttonframed{\dodoubleempty\localframed[\??bt]} % goodie - -\unexpanded\def\asciistr#1{\dontleavehmode{\defconvertedargument\ascii{#1}\verbatimfont\ascii}} - -\def\shapefill{\vskip\zeropoint\!!plus\lineheight\!!minus\lineheight\relax} - -\let\normaltype\type - -\ifx\scantextokens\undefined - \ifx\scantokens\undefined - \unexpanded\def\retype#1{\dontleavehmode{\defconvertedargument\ascii{#1}\@EA\normaltype\@EA{\ascii}}} - \else - \unexpanded\def\retype#1{\dontleavehmode\scantokens{\normaltype{#1}\ignorespaces}\relax} - \fi -\else - \unexpanded\def\retype#1{\dontleavehmode\scantextokens{\normaltype{#1}}} -\fi - -\def\simplifytype{\let\type\retype} - -% \ruledhbox -% {\startignorespaces -% \def\oeps{a} -% \startignorespaces -% \def\oeps{a} -% \stopignorespaces -% \def\oeps{a} -% \stopignorespaces -% \oeps} - -\newsignal\boissignal -\newcount \boislevel - -\long\def\startignorespaces - {\advance\boislevel\plusone - \ifcase\boislevel\or \ifhmode - \hskip\boissignal - \fi \fi - \ignorespaces} - -\long\def\stopignorespaces - {\ifcase\boislevel\or \ifhmode - \doloop - {\ifdim\lastskip=\zeropoint - \exitloop - \else\ifdim\lastskip=\boissignal - \unskip - \exitloop - \else - \unskip - \fi\fi}% - \fi \fi - \advance\boislevel\minusone} - -\def\minimalhbox#1#% - {\dowithnextbox - {\bgroup - \setbox\scratchbox\hbox#1{\hss}% - \ifdim\nextboxwd<\wd\scratchbox\nextboxwd\wd\scratchbox\fi - \flushnextbox - \egroup} - \hbox} - -% \def\dodimchoice#1#2#3% -% {\ifx#3\relax -% #1\@EA\gobbleuntilrelax -% \else\ifdim#1#2% -% #3\@EAEAEA\gobbleuntilrelax -% \else -% \@EAEAEA\dodimchoice -% \fi\fi{#1}} - -% \def\donumchoice#1#2#3% -% {\ifx#3\relax -% #1\@EA\gobbleuntilrelax -% \else\ifnum#1#2% -% #3\@EAEAEA\gobbleuntilrelax -% \else -% \@EAEAEA\dodimchoice -% \fi\fi{#1}} - -% \def\dimchoice#1#2{\dodimchoice{#1}#2\empty\relax} -% \def\numchoice#1#2{\donumchoice{#1}#2\empty\relax} - -\def\gobbleuntilempty#1\empty{} - -\def\dodimchoice#1#2#3% - {\ifdim#1#2% - #3\@EA\gobbleuntilempty - \else - \@EA\dodimchoice - \fi{#1}} - -\def\donumchoice#1#2#3% - {\ifnum#1#2% - #3\@EA\gobbleuntilempty - \else - \@EA\dodimchoice - \fi{#1}} - -\def\dimchoice#1#2{\dodimchoice{#1}#2{=#1}{#1}\empty} -\def\numchoice#1#2{\donumchoice{#1}#2{=#1}{#1}\empty} - -% \the\dimexpr(\dimchoice {7pt}{{<10pt}{8pt}{<12pt}{9pt}{<15pt}{10pt}{=11pt}{12pt}}) -% \the\dimexpr(\dimchoice{11pt}{{<10pt}{8pt}{<12pt}{9pt}{<15pt}{10pt}{=11pt}{12pt}}) -% \the\dimexpr(\dimchoice{14pt}{{<10pt}{8pt}{<12pt}{9pt}{<15pt}{10pt}{=11pt}{12pt}}) - -\def\showsetupsdefinition[#1]{\showvalue{\??su:#1}} % temp hack for debugging - -% documentation : \setupregister[alternative=a|b|A|B] -\unprotected \def\traceposstring#1#2#3% - {\iftracepositions - \smashedhbox% - {#1{\infofont#2#3}% - \scratchdimen.5\points - \kern-2\scratchdimen - \vrule\!!width4\scratchdimen\!!height\scratchdimen\!!depth\scratchdimen}% - \fi} - -% will be a MyWay -% -% \setuplayout[grid=yes] \setupcaption[figure][inbetween=] \useMPlibrary[dum] \setupcolors[state=start] -% -% \starttext \showgrid \showstruts -% -% \input ward \placefigure{}{\externalfigure[dummy][width=.5\hsize,lines=1.4,grid=yes]} -% \input ward \placefigure{}{\externalfigure[dummy][width=.5\hsize,lines=1.4,grid=fit]} -% \input ward \placefigure{}{\externalfigure[dummy][width=.5\hsize,lines=1.4,grid=height]} -% \input ward -% \page -% \input ward \placefigure{}{\externalfigure[dummy][width=.5\hsize,lines=1.5,grid=yes]} -% \input ward \placefigure{}{\externalfigure[dummy][width=.5\hsize,lines=1.5,grid=fit]} -% \input ward \placefigure{}{\externalfigure[dummy][width=.5\hsize,lines=1.5,grid=height]} -% \input ward -% \page -% \input ward \placefigure{}{\externalfigure[dummy][width=.5\hsize,lines=1.6,grid=yes]} -% \input ward \placefigure{}{\externalfigure[dummy][width=.5\hsize,lines=1.6,grid=fit]} -% \input ward \placefigure{}{\externalfigure[dummy][width=.5\hsize,lines=1.6,grid=height]} -% \input ward -% \page -% \input ward \placefigure[none]{}{\externalfigure[dummy][width=.5\hsize,lines=1.4,grid=yes]} -% \input ward \placefigure[none]{}{\externalfigure[dummy][width=.5\hsize,lines=1.4,grid=fit]} -% \input ward \placefigure[none]{}{\externalfigure[dummy][width=.5\hsize,lines=1.4,grid=height]} -% \input ward -% \page -% \input ward \placefigure[none]{}{\externalfigure[dummy][width=.5\hsize,lines=1.5,grid=yes]} -% \input ward \placefigure[none]{}{\externalfigure[dummy][width=.5\hsize,lines=1.5,grid=fit]} -% \input ward \placefigure[none]{}{\externalfigure[dummy][width=.5\hsize,lines=1.5,grid=height]} -% \input ward -% \page -% \input ward \placefigure[none]{}{\externalfigure[dummy][width=.5\hsize,lines=1.6,grid=yes]} -% \input ward \placefigure[none]{}{\externalfigure[dummy][width=.5\hsize,lines=1.6,grid=fit]} -% \input ward \placefigure[none]{}{\externalfigure[dummy][width=.5\hsize,lines=1.6,grid=height]} -% \input ward -% -% \stoptext - -% funny, as field action with e.g. dissolve ... only the field dissolves, bug? - -\setglobalsystemreference\rt!exec{Transition}{transition} - -%def\PDFexecutetransition {/Trans /Trans <>} -\def\PDFexecutetransition {/Trans /Trans <<\executeifdefined{PDFpage\argumentA}\PDFpagereplace>>} - -% new, continuous blocks, \som \par \startdoorlopendblok ... - -% \startitemize -% \item bagger -% \item bagger -% \item \startdoorlopendblok bagger \stopdoorlopendblok -% \item \endgraf \startdoorlopendblok bagger \stopdoorlopendblok -% \item \endgraf \startdoorlopendblok \strut bagger \stopdoorlopendblok -% \item \startdoorlopendblok -% \starttabulate -% \NC test \NC test \NC \NR -% \NC test \NC test \NC \NR -% \NC test \NC test \NC \NR -% \stoptabulate -% \stopdoorlopendblok -% \item test -% \stopitemize - -\def\startdoorlopendblok % for special cases, don't change it too much and don't rely on it - {\ifhmode\endgraf\nobreak\fi % don't remove the \nobreak - \dowithnextboxcontent - {\setlocalhsize \hsize\localhsize \forgetall} - {\bgroup - \forgeteverypar - \forgetparskip - \scratchdimen\nextboxht - \advance\scratchdimen\nextboxdp - \getnoflines\scratchdimen - \advance\scratchdimen-\strutheight - \setbox\nextbox\hbox{\lower\scratchdimen\box\nextbox}% - \ht\nextbox\strutheight - \dp\nextbox\strutdepth - \setbox\nextbox\vbox - {\indent\box\nextbox - \endgraf - \nobreak - \advance\noflines\minusone - \dorecurse\noflines{\crlf\nobreak}}% - \verticalstrut - \endgraf - \nobreak - \offinterlineskip - \kern-2\lineheight % 2\lineheight when no vertical struts in main \vbox - \nobreak - \unvbox\nextbox - \prevdepth\strutdepth - % evt (eerst testen) een signal zodat een direct volgend blok goed gaat) - \egroup} - \vbox\bgroup - \vskip-\lineheight \verticalstrut\endgraf - \insidefloattrue - \doinhibitblank} % beware, no \inhibitblank ! ! ! ! ! ! - -\def\stopdoorlopendblok - {\endgraf\verticalstrut\endgraf\kern-2\lineheight - \egroup} - -\def\tabulaterule % to be redone, not correct - {\dotabulaterule - {\hrule\!!height.5\scratchdimen\!!depth.5\scratchdimen\relax - \doifvalue{\??tt\currenttabulate\c!distance}\v!grid - {\kern-\scratchdimen}}} % experimental tm-prikkels - -% experimental: \synchronizegrid bla bla bla - -\newcounter\currentgridsync - -\def\gridsynctag{grs:\currentgridsync} - -\def\synchronizegrid - {\doglobal\increment\currentgridsync - \par\prevdepth\zeropoint - \nointerlineskip - \hpos\gridsynctag{\strut}\par - \vskip-\lineheight - \nointerlineskip - % top of text - \scratchdimen\MPy{\v!text:\MPp\gridsynctag}% - \advance\scratchdimen\MPh{\v!text:\MPp\gridsynctag}% - % move to first baseline - \advance\scratchdimen-\topskip - % subtract wrong baseline - \advance\scratchdimen-\MPy\gridsynctag - % get minimal number of lines - \advance\scratchdimen\lineheight - \getnoflines\scratchdimen - % calculate difference - \advance\scratchdimen-\noflines\lineheight\relax - \scratchdimen-\scratchdimen\relax - \ifdim\scratchdimen>\zeropoint - \nointerlineskip - \advance\scratchdimen-\lineheight - \vskip\scratchdimen \dontleavehmode \quad \strut - \par - %\else - % \message{no grid correction: \the\scratchdimen}\wait - \fi} - -% needed for extreme (will go away) - -\definesystemvariable{ie} - -\def\definetest - {\dodoubleempty\dodefinetest} - -\def\dodefinetest[#1][#2]#3% - {\setgvalue{\??ie#1}{#3}% - \ifsecondargument - \processaction - [#2] - [% first test true, rest depends - \v!next=>\setgvalue{\??ie#1}{\setgvalue{\??ie#1}{#3}\firstoftwoarguments}, - % rest true if first true - % \v!first=>\setgvalue{\??ie#1}{#3{\letgvalue{\??ie#1}% - % \firstoftwoarguments\firstoftwoarguments}% - % \secondoftwoarguments}, - % always true - \v!yes=>\letgvalue{\??ie#1}\firstoftwoarguments, - % always false - \v!no=>\letgvalue{\??ie#1}\secondoftwoarguments]% - \fi} - -\def\doperformtest#1% - {\executeifdefined{\??ie#1}\secondoftwoarguments} - -\def\definecolumnsethsize#1#2#3#4% will be improved/speed up - {\bgroup - \def\OTRSETidentifier{#1}% - \ifcase\columnsetlevel\relax - \mofcolumns\plusone - \OTRSETinitializecolumns - \OTRSETassignwidths - \OTRSETsethsize - \fi - \!!counta#2\!!countb#3\docalculatecolumnsetspan - \expandafter\egroup\expandafter\edef\expandafter - #4\expandafter{\the\!!widtha}} - -% so far - -% between alignment lines certain rules apply, and even a -% simple test can mess up a table, which is why we have a -% special test facility -% -% \ruledvbox -% {\starttabulate[|l|p|] -% \NC 1test \NC test \NC \NR -% \tableifelse{\doifelse{a}{a}}{\NC Xtest \NC test \NC \NR}{}% -% \stoptabulate} - -\long\def\tableifelse#1% - {\TABLEnoalign{#1% - {\aftergroup \firstoftwoarguments}% - {\aftergroup\secondoftwoarguments}}} - -\long \def\tableiftextelse#1{\tableifelse{\doiftextelse{#1}}} - -% experiment, not yet to be used - -\def\displaybreak - {\ifhmode - \removeunwantedspaces - \ifcase\raggedstatus\hfill\fi - \strut\penalty-9999 % \break fails on case (3) - \fi} - -\def\startdisplay{\displaybreak\ignorespaces\startpacked} -\def\stopdisplay {\stoppacked\displaybreak\ignorespaces} - -\def\tightvbox{\dowithnextbox{\nextboxdp\zeropoint\flushnextbox}\vbox} -\def\tightvtop{\dowithnextbox{\nextboxht\zeropoint\flushnextbox}\vtop} - -% what is this stupid macro meant for: - -\def\hyphenationpoint - {\hskip\zeropoint} - -\def\hyphenated#1% - {\bgroup - \!!counta\zerocount - \def\hyphenated##1{\advance\!!counta\plusone}% - \handletokens#1\with\hyphenated - \!!countb\plusone - \def\hyphenated##1% - {##1% - \advance\!!countb\plusone\relax - \ifnum\!!countb>2 \ifnum\!!countb<\!!counta - \hyphenationpoint - \fi\fi}% - \handletokens#1\with\hyphenated - \egroup} - -\def\obeysupersubletters - {\let\super\normalsuper - \let\suber\normalsuber - \let\normalsuper\letterhat - \let\normalsuber\letterunderscore - \enablesupersub} - -\def\obeysupersubmath - {\let\normalsuper\letterhat - \let\normalsuber\letterunderscore - \enablesupersub} - -%\let\normaltype\type -% -%\def\type#1% -% {\expanded{\normaltype{\detokenize{#1}}}} - -% {x123 \os x123} {\tfa x123 \os x123} {x123 \tx x123 \os x123} -% \definefontsynonym[OldStyle][Serif] -% {x123 \os x123} {\tfa x123 \os x123} {x123 \tx x123 \os x123} - -% testen : -% -% \appendtoks -% \let\registerparoptions\relax -% \to \everyforgetall - -\def\startgridcorrection - {\dosingleempty\dostartgridcorrection} - -\def\dostartgridcorrection[#1]% - {\ifgridsnapping - \iffirstargument\doifsomething{#1}{\moveongrid[#1]}\fi - \snaptogrid\vbox\bgroup - \else - \startbaselinecorrection - \fi} - -\def\stopgridcorrection - {\ifgridsnapping - \egroup - \else - \stopbaselinecorrection - \fi} - -\def\checkgridsnapping - {\lineskip\ifgridsnapping\zeropoint\else\normallineskip\fi} - -\def\startplaatsen - {\dosingleempty\dostartplaatsen} - -\def\dostartplaatsen[#1]% tzt n*links etc - {\endgraf - \noindent\bgroup - \setlocalhsize - \hbox to \localhsize\bgroup - \doifnot{#1}\v!left\hss - \def\stopplaatsen - {\unskip\unskip\unskip - \doifnot{#1}\v!right\hss - \egroup - \egroup - \endgraf}% - \gobblespacetokens} - -% \startplaatsen[links] bla \stopplaatsen - -% we don't register the paragraph characteristics, only the -% width - -\appendtoks - \setinnerparpositions % see "techniek" for application -\to \everytabulate - -\def\fontclassname#1#2% - {\ifcsname\??ff#1#2\endcsname - \fontclassname{#1}{\csname\??ff#1#2\endcsname}% - \else\ifcsname\??ff#2\endcsname - \fontclassname{#1}{\csname\??ff#2\endcsname}% - \else - #2% - \fi\fi} - -\def\defineclassfontsynonym - {\dotripleargument\dodefineclassfontsynonym} - -\def\dodefineclassfontsynonym[#1][#2][#3]% - {\definefontsynonym[#1][\fontclassname{#2}{#3}]} - -%\definefontsynonym [KopFont] [\fontclassname{officina}{SerifBold}] -% -%\defineclassfontsynonym [KopFont] [officina] [SerifBold] - -\def\startcolumnmakeup % don't change - {\bgroup - \getrawnoflines\textheight % teksthoogte kan topskip hebben, dus raw - \scratchdimen\noflines\lineheight - \advance\scratchdimen-\lineheight - \advance\scratchdimen\topskip - \setbox\scratchbox - \ifcase\showgridstate\vbox\else\ruledvbox\fi to \scratchdimen\bgroup - \forgetall} % ! don't change - -\def\stopcolumnmakeup - {\egroup - \dp\scratchbox\zeropoint - \wd\scratchbox\textwidth - \box\scratchbox - \egroup - \synchronizehsize} - -\long\def\startexternalfigure - {\dotripleempty\dostartexternalfigure} - -\long\def\dostartexternalfigure[#1][#2][#3]#4\stopexternalfigure - {\gdef\figuredescription{#4}% - \externalfigure[#1][#2][#3]% - \globallet\figuredescription\empty} - -\let\figuredescription\empty - -%% where does this come from, old code probably -%% -%% -%% \newif\ifpagechanged \let\lastchangedpage\empty -%% -%% \def\checkpagechange#1% -%% {\gettwopassdata\s!paragraph -%% \pagechangedfalse -%% \iftwopassdatafound -%% \ifnum\twopassdata>0\getvalue{\s!paragraph:p:#1}\relax -%% \pagechangedtrue -%% \fi -%% \fi -%% \ifpagechanged -%% \letgvalue{\s!paragraph:p:#1}\twopassdata -%% \globallet\lastchangedpage\twopassdata -%% \else -%% \globallet\lastchangedpage\realfolio -%% \fi -%% \doparagraphreference} -%% -%% \def\changedpage#1% -%% {\getvalue{\s!paragraph:p:#1}} - -\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}} - -% incomplete, will be a special case of float placement - -\def\startfixed{\dosingleempty\dostartfixed} - -\def\dostartfixed[#1]% - {\expanded{\dowithnextbox{\noexpand\dodofixed{\ifhmode0\else1\fi}{#1}}}% - \vbox\bgroup - \setlocalhsize} - -\def\stopfixed - {\egroup} - -\def\dodofixed#1#2% - {\ifcase#1\relax - \processaction - [#2] - [ \v!high=>\bbox {\flushnextbox}, - \v!low=>\tbox {\flushnextbox}, - \v!middle=>\vcenter{\flushnextbox}, - \v!lohi=>\vcenter{\flushnextbox}, - \s!unknown=>\tbox {\flushnextbox}, - \s!default=>\tbox {\flushnextbox}]% - \else - \startbaselinecorrection - \noindent\flushnextbox - \stopbaselinecorrection - \fi} - -% \startitemize -% -% \item \externalfigure[koe][height=2cm] -% \item \externalfigure[koe][height=2cm] -% \item \externalfigure[koe][height=2cm] -% \item \externalfigure[koe][height=2cm] -% -% \page -% -% \item \startfixed \externalfigure[koe][height=2cm]\stopfixed -% \item \startfixed[high]\externalfigure[koe][height=2cm]\stopfixed -% \item \startfixed[low] \externalfigure[koe][height=2cm]\stopfixed -% \item \startfixed[lohi]\externalfigure[koe][height=2cm]\stopfixed -% -% \page -% -% \item test \startfixed \externalfigure[koe][height=2cm]\stopfixed -% \item test \startfixed[high]\externalfigure[koe][height=2cm]\stopfixed -% \item test \startfixed[low] \externalfigure[koe][height=2cm]\stopfixed -% \item test \startfixed[lohi]\externalfigure[koe][height=2cm]\stopfixed -% -% \page -% -% \item test \par \startfixed \externalfigure[koe][height=2cm]\stopfixed -% \item test \par \startfixed[high]\externalfigure[koe][height=2cm]\stopfixed -% \item test \par \startfixed[low] \externalfigure[koe][height=2cm]\stopfixed -% \item test \par \startfixed[lohi]\externalfigure[koe][height=2cm]\stopfixed -% -% \stopitemize - -\def\obeyfollowingtoken{{}} % end \cs scanning - -% \def\comparedimension#1#2% -% {\chardef\compresult -% \ifdim#1<#2% -% \zerocount -% \else\ifdim#1<#2% -% \plusone -% \else -% \plustwo -% \fi\fi} -% \newdimen\roundingeps \roundingeps=10sp -% \def\comparedimensioneps#1#2% -% {\chardef\compresult -% \ifdim\dimexpr(#1-#2)<\roudingeps -% \zerocount -% \else\ifdim\dimexpr(#2-#1)<\roudingeps -% \zerocount -% \else\ifdim#1<#2% -% \plusone -% \else -% \plustwo -% \fi\fi\fi} - -%D Next we load a few local optimizations and new features. They -%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/Master/texmf-dist/tex/context/base/cont-nl.mkii b/Master/texmf-dist/tex/context/base/cont-nl.mkii new file mode 100644 index 00000000000..925ec899958 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-nl.mkii @@ -0,0 +1,21 @@ +%D \module +%D [ file=cont-nl, +%D version=1997.08.19, +%D title=\CONTEXT, +%D subtitle=\CONTEXT\ Dutch Format Generation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\catcode`\{=1 \catcode`\}=2 + +\def\defaultinterface {dutch} +\def\defaultlanguagetag{nl} + +\input context.mkii + +\endinput diff --git a/Master/texmf-dist/tex/context/base/cont-nl.mkiv b/Master/texmf-dist/tex/context/base/cont-nl.mkiv new file mode 100644 index 00000000000..f6d2671e3fb --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-nl.mkiv @@ -0,0 +1,21 @@ +%D \module +%D [ file=cont-nl, +%D version=1997.08.19, +%D title=\CONTEXT, +%D subtitle=\CONTEXT\ Dutch Format Generation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\catcode`\{=1 \catcode`\}=2 + +\def\defaultinterface {dutch} +\def\defaultlanguagetag{nl} + +\input context.mkiv + +\endinput diff --git a/Master/texmf-dist/tex/context/base/cont-nl.tex b/Master/texmf-dist/tex/context/base/cont-nl.tex deleted file mode 100644 index 32b82b01a68..00000000000 --- a/Master/texmf-dist/tex/context/base/cont-nl.tex +++ /dev/null @@ -1,42 +0,0 @@ -%D \module -%D [ file=cont-nl, -%D version=1997.08.19, -%D title=\CONTEXT, -%D subtitle=\CONTEXT\ Dutch Format Generation, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{dutch} - -\input context.tex - -\unprotect - -\setupcurrentlanguage[\s!nl] - -\loaduserspecifications - -\installlanguage [\s!us] [\c!state=\v!start] -\installlanguage [\s!gb] [\c!state=\v!start] -\installlanguage [\s!de] [\c!state=\v!start] -\installlanguage [\s!fr] [\c!state=\v!start] -\installlanguage [\s!es] [\c!state=\v!start] -\installlanguage [\s!nl] [\c!state=\v!start] -\installlanguage [\s!it] [\c!state=\v!start] - -\ifnum\texengine=\luatexengine - % will be runtime option: typeface - \appendtoks - \usetypescript[modern] - \setuptypeface[modern] - \to \everyjob -\else - \setupencoding[default=ec] \usetypescript[fallback][\defaultencoding] \setupbodyfont[rm,12pt] -\fi - -\protect \errorstopmode \dump \endinput diff --git a/Master/texmf-dist/tex/context/base/cont-old.tex b/Master/texmf-dist/tex/context/base/cont-old.tex deleted file mode 100644 index 360b5f2e6ae..00000000000 --- a/Master/texmf-dist/tex/context/base/cont-old.tex +++ /dev/null @@ -1,48 +0,0 @@ -%D \module -%D [ file=cont-old, -%D version=1995.10.10, -%D title=\CONTEXT\ Miscellaneous Macros, -%D subtitle=Old 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. - -\writestatus{loading}{ConTeXt Old Macros} - -\unprotect - -\def\middleraggedness {6\bodyfontsize} - -\def\dosubstitutecommand#1#2% - {\writestatus\m!systems{\string#1\normalspace -> \string#2}% - \gdef#1{#2}% - #2} - -\def\substitutecommand#1#2% - {\gdef#1{\dosubstitutecommand{#1}{#2}}} - -\substitutecommand \volgendehoofdstuk {\setupheadnumber[hoofdstuk][+1]} -\substitutecommand \volgendeparagraaf {\setupheadnumber[paragraaf][+1]} -\substitutecommand \volgendesubparagraaf {\setupheadnumber[subparagraaf][+1]} -\substitutecommand \volgendesubsubparagraaf {\setupheadnumber[subsubparagraaf][+1]} - -\substitutecommand \volledigeinhoudsopgave \volledigeinhoud -\substitutecommand \plaatsinhoudsopgave \plaatsinhoud -\substitutecommand \stelinhoudsopgavein \stelinhoudin - -\substitutecommand \streep \onderstreep -\substitutecommand \strepen \onderstrepen - -\substitutecommand \pragmakenmerk \referral - -\substitutecommand \definieersynoniem \definesynonyms - -\substitutecommand \setupintermezzos \setupintermezzi - -\let \Everybodyfont \EveryBodyFont - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/cont-pe.mkiv b/Master/texmf-dist/tex/context/base/cont-pe.mkiv new file mode 100644 index 00000000000..e65ad132811 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-pe.mkiv @@ -0,0 +1,22 @@ +%D \module +%D [ file=cont-en, +%D version=1997.08.19, +%D title=\CONTEXT, +%D subtitle=\CONTEXT\ English Format Generation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\catcode`\{=1 \catcode`\}=2 + +\def\defaultinterface {persian} +\def\messageinterface {english} +\def\defaultlanguagetag{pe} + +\input context.mkiv + +\endinput diff --git a/Master/texmf-dist/tex/context/base/cont-pe.tex b/Master/texmf-dist/tex/context/base/cont-pe.tex deleted file mode 100644 index fdf47d680da..00000000000 --- a/Master/texmf-dist/tex/context/base/cont-pe.tex +++ /dev/null @@ -1,45 +0,0 @@ -%D \module -%D [ file=cont-en, -%D version=1997.08.19, -%D title=\CONTEXT, -%D subtitle=\CONTEXT\ English Format Generation, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{persian} \def\messageinterface{english} - -\input context.tex - -\unprotect - -\setupcurrentlanguage[\s!pe] - -\loaduserspecifications - -% Do we need more defaults? or maybe all languages? - -\installlanguage [\s!us] [\c!state=\v!start] -\installlanguage [\s!gb] [\c!state=\v!start] -\installlanguage [\s!de] [\c!state=\v!start] -\installlanguage [\s!fr] [\c!state=\v!start] -\installlanguage [\s!es] [\c!state=\v!start] -\installlanguage [\s!it] [\c!state=\v!start] -\installlanguage [\s!nl] [\c!state=\v!start] -\installlanguage [\s!pe] [\c!state=\v!start] - -\ifnum\texengine=\luatexengine - % will be runtime option: typeface - \appendtoks - \usetypescript[modern] - \setuptypeface[modern] - \to \everyjob -\else - \setupencoding[default=ec] \usetypescript[fallback][\defaultencoding] \setupbodyfont[rm,12pt] -\fi - -\protect \errorstopmode \dump \endinput diff --git a/Master/texmf-dist/tex/context/base/cont-ro.mkii b/Master/texmf-dist/tex/context/base/cont-ro.mkii new file mode 100644 index 00000000000..59561319457 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-ro.mkii @@ -0,0 +1,22 @@ +%D \module +%D [ file=cont-ro, +%D version=2000.01.09, +%D title=\CONTEXT, +%D subtitle=\CONTEXT\ Romanian Format Generation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\catcode`\{=1 \catcode`\}=2 + +\def\defaultinterface {romanian} +\def\defaultlanguagetag{ro} + +\input context.mkii + +\endinput + diff --git a/Master/texmf-dist/tex/context/base/cont-ro.mkiv b/Master/texmf-dist/tex/context/base/cont-ro.mkiv new file mode 100644 index 00000000000..90bbc27dce9 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/cont-ro.mkiv @@ -0,0 +1,21 @@ +%D \module +%D [ file=cont-ro, +%D version=2000.01.09, +%D title=\CONTEXT, +%D subtitle=\CONTEXT\ Romanian Format Generation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\catcode`\{=1 \catcode`\}=2 + +\def\defaultinterface {romanian} +\def\defaultlanguagetag{ro} + +\input context.mkiv + +\endinput diff --git a/Master/texmf-dist/tex/context/base/cont-ro.tex b/Master/texmf-dist/tex/context/base/cont-ro.tex deleted file mode 100644 index 9be9b116252..00000000000 --- a/Master/texmf-dist/tex/context/base/cont-ro.tex +++ /dev/null @@ -1,38 +0,0 @@ -%D \module -%D [ file=cont-ro, -%D version=2000.01.09, -%D title=\CONTEXT, -%D subtitle=\CONTEXT\ Romanian Format Generation, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{romanian} - -\input context.tex - -\unprotect - -\setupcurrentlanguage[\s!ro] - -\loaduserspecifications - -\installlanguage [\s!en] [\c!state=\v!start] -\installlanguage [\s!de] [\c!state=\v!start] -\installlanguage [\s!ro] [\c!state=\v!start] - -\ifnum\texengine=\luatexengine - % will be runtime option: typeface - \appendtoks - \usetypescript[modern] - \setuptypeface[modern] - \to \everyjob -\else - \setupencoding[default=ec] \usetypescript[fallback][\defaultencoding] \setupbodyfont[rm,12pt] -\fi - -\protect \errorstopmode \dump \endinput diff --git a/Master/texmf-dist/tex/context/base/cont-sys.ori b/Master/texmf-dist/tex/context/base/cont-sys.ori index 11c0141e795..fa438a78d4f 100644 --- a/Master/texmf-dist/tex/context/base/cont-sys.ori +++ b/Master/texmf-dist/tex/context/base/cont-sys.ori @@ -11,6 +11,10 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +%D Beware, this is a MkII specific file. In MkIV we only load +%D cont-sys.mkiv but in MkII we load the first found of +%D cont-sys.mkii, cont-sys.tex, cont-sys.rme. + \unprotect % Speed up typescript loading, but at the cost of much memory: diff --git a/Master/texmf-dist/tex/context/base/cont-usr.ori b/Master/texmf-dist/tex/context/base/cont-usr.ori deleted file mode 100644 index 5a3070362f8..00000000000 --- a/Master/texmf-dist/tex/context/base/cont-usr.ori +++ /dev/null @@ -1,109 +0,0 @@ -%D \module -%D [ file=cont-usr, -%D version=1997.10.05, -%D title=\CONTEXT\ User Format Specifications, -%D subtitle=System Specific Setups, -%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 User Settings} - -\unprotect - -%D Additional languages can be defined here. Beware of -%D encoding incompatibilities. Please take a look at the -%D \type {cont-en.tex}, \type {cont-nl.tex}, enz.\ files -%D first. Normally you don't have to change a byte. If you -%D want to play safe, use \typ {texexec --make --alone -%D --all}. - -% \preloadallpatterns % will load them all - -% \installlanguage [\s!af] [\c!state=\v!start] % afrikaans -% \installlanguage [\s!ca] [\c!state=\v!start] % catalan -% \installlanguage [\s!cs] [\c!state=\v!start] % czech -% \installlanguage [\s!da] [\c!state=\v!start] % danish -% \installlanguage [\s!de] [\c!state=\v!start] % german -% \installlanguage [\s!en] [\c!state=\v!start] % english us -% \installlanguage [\s!es] [\c!state=\v!start] % spanish -% \installlanguage [\s!fi] [\c!state=\v!start] % finnish -% \installlanguage [\s!fr] [\c!state=\v!start] % french -% \installlanguage [\s!hr] [\c!state=\v!start] % croatian -% \installlanguage [\s!hu] [\c!state=\v!start] % hungarian -% \installlanguage [\s!it] [\c!state=\v!start] % italian -% \installlanguage [\s!la] [\c!state=\v!start] % latin -% \installlanguage [\s!nl] [\c!state=\v!start] % dutch -% \installlanguage [\s!nb] [\c!state=\v!start] % bokmal -% \installlanguage [\s!nn] [\c!state=\v!start] % nynorsk -% \installlanguage [\s!pl] [\c!state=\v!start] % polish -% \installlanguage [\s!pt] [\c!state=\v!start] % portuguese -% \installlanguage [\s!ro] [\c!state=\v!start] % romanian -% \installlanguage [\s!ru] [\c!state=\v!start] % russian -% \installlanguage [\s!sk] [\c!state=\v!start] % slovak -% \installlanguage [\s!sl] [\c!state=\v!start] % slovenian -% \installlanguage [\s!sv] [\c!state=\v!start] % swedish -% \installlanguage [\s!tr] [\c!state=\v!start] % turkish -% \installlanguage [\s!ua] [\c!state=\v!start] % ukrainian -% \installlanguage [\s!gb] [\c!state=\v!start] % english uk -% \installlanguage [\s!vn] [\c!state=\v!start] % vietnamese - -% \installlanguage [deo] [\c!state=\v!start] % old german - -%D The next lines can be used for setting the language to be -%D used at startup time. - -% \setupcurrentlanguage[\s!af] -% \setupcurrentlanguage[\s!ca] -% \setupcurrentlanguage[\s!cs] -% \setupcurrentlanguage[\s!da] -% \setupcurrentlanguage[\s!de] -% \setupcurrentlanguage[\s!en] -% \setupcurrentlanguage[\s!es] -% \setupcurrentlanguage[\s!fi] -% \setupcurrentlanguage[\s!fr] -% \setupcurrentlanguage[\s!hr] -% \setupcurrentlanguage[\s!hu] -% \setupcurrentlanguage[\s!it] -% \setupcurrentlanguage[\s!la] -% \setupcurrentlanguage[\s!nl] -% \setupcurrentlanguage[\s!nb] -% \setupcurrentlanguage[\s!nn] -% \setupcurrentlanguage[\s!pl] -% \setupcurrentlanguage[\s!pt] -% \setupcurrentlanguage[\s!ro] -% \setupcurrentlanguage[\s!ru] -% \setupcurrentlanguage[\s!sk] -% \setupcurrentlanguage[\s!sl] -% \setupcurrentlanguage[\s!sv] -% \setupcurrentlanguage[\s!tr] -% \setupcurrentlanguage[\s!ua] - -%D Local font settings can go here. Normally suitable -%D defaults are already preloaded, almost certainly the -%D Computer Modern Roman typefaces or some derivate. So, the -%D next line is only meant as sample, take a look at the -%D format related files first. - -% This is obsolete due to latin modern: -% -% \definefilesynonym [font-cmr] [font-csr] % czech & slovak -% \definefilesynonym [font-cmr] [font-plr] % polish - -%D In some languages, compound characters, like \type {"e} -%D are used to get accented and non latin characters. - -% Per 21/9/2006 one needs to explicitly enable this. - -% \useencoding[fde] % german -% \useencoding[ffr] % french -% \useencoding[fro] % romanian -% \useencoding[fpl] % polish - -%D Don't remove the next few lines. - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/context.lus b/Master/texmf-dist/tex/context/base/context.lus new file mode 100644 index 00000000000..960e96adf7c --- /dev/null +++ b/Master/texmf-dist/tex/context/base/context.lus @@ -0,0 +1,71 @@ +if not modules then modules = { } end modules ['context'] = { + version = 1.001, + comment = "companion to context.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +--[[

This table specifies what stub files are needed in order to create +the format. These files are loaded before the format is made so that we +bypass kpse. When the format itself is used, another stub is used (with +suffix lui). The current format builder is to a large part determined by +the way luatex evolved and the process will probaby change.

]]-- + +local method = 3 + +local stubfiles = { + + 'luat-cod.lua', + + -- Here follows a list of trac, luat and data files, but we don't + -- it this way any more so there is no need to keep this updated. + +} + +-- This method will trigger the creation of a stub file with all neccessary +-- libraries merged. This is how we originally did it. + +if method == 1 then + + return stubfiles + +end + +-- This method will use this file as stub file so no merge is needed. + +if method == 2 then + + if resolvers then + -- we're loading this file in mtxrun + else + + local sourcepath = string.gsub(arg and arg[1] or "","/[^/]+$","") + local targetpath = "." + + if sourcepath == "" then sourcepath = targetpath end + + for i=1,#stubfiles do + local filename = sourcepath .. "/" .. stubfiles[i] + texio.write_nl("preloading " .. filename) + dofile(filename) + end + texio.write_nl("\n") + + end + + return "context.lus" + +end + +-- Only a simple stub: + +if method == 3 then + + return "luat-cod.lua" + +end + +-- The last resort. + +return stubfiles diff --git a/Master/texmf-dist/tex/context/base/context.mkii b/Master/texmf-dist/tex/context/base/context.mkii index 4be60cbfcbc..7312bdcf562 100644 --- a/Master/texmf-dist/tex/context/base/context.mkii +++ b/Master/texmf-dist/tex/context/base/context.mkii @@ -11,30 +11,67 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +\catcode`\{=1 \catcode`\}=2 \catcode`\#=6 + +%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 +%D by use modules to identify the feature level. Starting with version +%D 2004.8.30 the low level interface is english. Watch out and adapt +%D your styles an modules. + +\edef\contextformat {\jobname} +\edef\contextversion{2011.05.18 18:04} + +%D For those who want to use this: + +\let\fmtname \contextformat +\let\fmtversion\contextversion + +%D Loading: + +\edef\mksuffix {mkii} +\edef\contextmark{MKII} + +\ifx\normalinput\undefined \let\normalinput\input \fi + +\def\loadcorefile#1{\normalinput#1\relax} +\def\loadmarkfile#1{\normalinput#1.\mksuffix\relax} +\def\loadmkiifile#1{\normalinput#1\relax} +\def\loadmkivfile#1{} + %D First we load the system modules. These implement a lot of %D manipulation macros. The first one loads \PLAIN\ \TEX, as %D minimal as possible. -\loadcorefile{syst-ini} -\loadcorefile{syst-pln} +\loadmarkfile{syst-ini} + +%D Some checking (more primitives are now defined): -\loadcorefile{norm-tex} -\loadcorefile{norm-etx} -\loadcorefile{norm-ptx} -\loadcorefile{norm-xtx} -\loadcorefile{norm-ctx} +\ifdefined\defaultinterface \else \def\defaultinterface {english} \fi +%ifdefined\messageinterface \else \let\messageinterface \defaultinterface \fi +\ifdefined\defaultlanguagetag \else \def\defaultlanguagetag{en} \fi + +%D More core code. + +\loadmarkfile{syst-pln} + +\loadmarkfile{norm-tex} +\loadmarkfile{norm-etx} +\loadmarkfile{norm-ptx} +\loadmarkfile{norm-xtx} +\loadmarkfile{norm-ctx} \loadmarkfile{catc-ini} -\loadcorefile{catc-act} -\loadcorefile{catc-def} -\loadcorefile{catc-ctx} -\loadcorefile{catc-sym} +\loadmarkfile{catc-act} +\loadmarkfile{catc-def} +\loadmarkfile{catc-ctx} +\loadmarkfile{catc-sym} +\loadmarkfile{catc-xml} \loadmarkfile{syst-gen} \loadmarkfile{syst-ext} \loadmarkfile{syst-new} \loadmarkfile{syst-con} -\loadcorefile{syst-ltx} \loadmarkfile{thrd-trg} % based on: David Carlisle \loadmarkfile{syst-fnt} @@ -58,14 +95,19 @@ \loadmarkfile{supp-fil} \loadmarkfile{supp-dir} +%D This is for mkii bibtex users who expect \LATEX\ commands. + +\loadmarkfile{supp-lat} + %D After this we're ready for the multi||lingual interface %D modules. \loadmarkfile{mult-ini} -\loadcorefile{mult-fst} -\loadcorefile{mult-sys} -\loadcorefile{mult-def} +\loadmarkfile{mult-fst} +\loadmarkfile{mult-sys} +\loadmarkfile{mult-def} \loadmarkfile{mult-chk} +\loadmarkfile{mult-aux} %D Now we're ready for some general support modules. These %D modules implement some basic typesetting functionality. @@ -73,18 +115,18 @@ \loadmarkfile{core-var} \loadmarkfile{core-env} -\loadcorefile{supp-box} +\loadmarkfile{supp-box} \loadmarkfile{supp-mrk} -\loadcorefile{supp-vis} -\loadcorefile{supp-fun} +\loadmarkfile{supp-vis} +\loadmarkfile{supp-fun} %loadmarkfile{supp-eps} \loadmarkfile{supp-spe} \loadmarkfile{supp-ran} \loadmarkfile{supp-mps} \loadmarkfile{supp-tpi} \loadmarkfile{supp-mat} -\loadcorefile{supp-ali} -\loadcorefile{supp-num} +\loadmarkfile{supp-ali} +\loadmarkfile{supp-num} %D Verbatim typesetting is implemented in a separate class of %D modules. The pretty typesetting modules are loaded at run @@ -104,16 +146,15 @@ \loadmarkfile{core-fil} \loadmarkfile{core-con} -%D We already need some synonyms (patterns). At runtime this -%D file will be reloaded. +%D We already need some synonyms (patterns). -\loadcorefile{cont-fil} +\loadmarkfile{cont-fil} %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{|}. -\loadcorefile{thrd-tab} % based on: Michael Wichura / will be reimplemented +\loadmarkfile{thrd-tab} % based on: Michael Wichura's TaBlE %D Here comes the last support modules. They take care of %D some language specific things. @@ -124,7 +165,7 @@ %D load additional definition modules when needed. \loadmarkfile{regi-ini} -\loadcorefile{regi-syn} +\loadmarkfile{regi-syn} \loadmarkfile{enco-ini} %loadmarkfile{filt-ini} \loadmarkfile{hand-ini} @@ -154,19 +195,19 @@ \loadmarkfile{lang-mis} \loadmarkfile{lang-url} -\loadcorefile{lang-ger} -\loadcorefile{lang-ita} -\loadcorefile{lang-sla} -\loadcorefile{lang-alt} -\loadcorefile{lang-ana} -\loadcorefile{lang-art} -\loadcorefile{lang-bal} -\loadcorefile{lang-cel} -\loadcorefile{lang-grk} -\loadcorefile{lang-ind} -\loadcorefile{lang-ura} -\loadcorefile{lang-vn} -\loadcorefile{lang-cyr} +\loadmarkfile{lang-ger} +\loadmarkfile{lang-ita} +\loadmarkfile{lang-sla} +\loadmarkfile{lang-alt} +\loadmarkfile{lang-ana} +\loadmarkfile{lang-art} +\loadmarkfile{lang-bal} +\loadmarkfile{lang-cel} +\loadmarkfile{lang-grk} +\loadmarkfile{lang-ind} +\loadmarkfile{lang-ura} +\loadmarkfile{lang-vn} +\loadmarkfile{lang-cyr} \loadmarkfile{typo-ini} @@ -278,6 +319,7 @@ \loadmarkfile{type-ini} \loadmarkfile{type-set} +\loadmarkfile{type-def} %D Properties. Don't ask. @@ -334,7 +376,7 @@ %D Language specific spacing. -\loadcorefile{lang-spa} +\loadmarkfile{lang-spa} %D Bibliographies: @@ -344,21 +386,21 @@ %D These macros are loaded last since they overload and|/|or %D extend previously defined ones. -\loadcorefile{xtag-ini} -\loadcorefile{xtag-ext} -\loadcorefile{xtag-exp} -\loadcorefile{xtag-pre} -\loadcorefile{xtag-xsd} -\loadcorefile{xtag-rng} +\loadmarkfile{xtag-ini} +\loadmarkfile{xtag-ext} +\loadmarkfile{xtag-exp} +\loadmarkfile{xtag-pre} +\loadmarkfile{xtag-xsd} +\loadmarkfile{xtag-rng} %D How about this: -\loadcorefile{meta-xml} +\loadmarkfile{meta-xml} %D \TEX\ related logo's are always typeset in a special way. %D Here they come: -\loadcorefile{cont-log} +\loadmarkfile{cont-log} %D This one overloads af few things: @@ -385,7 +427,12 @@ %D \item \type{cont-fil}: filename and module synonyms %D \stopitemize -% %D Except from english, no hyphenation patterns are loaded -% %D yet. Users can specify their needs in the next module: -% -% \input cont-usr +\setupcurrentlanguage[\defaultlanguagetag] + +\setupencoding[default=ec] + +\usetypescript[fallback][\defaultencoding] + +\setupbodyfont[rm,12pt] + +\errorstopmode \dump \endinput diff --git a/Master/texmf-dist/tex/context/base/context.mkiv b/Master/texmf-dist/tex/context/base/context.mkiv index 33fa3a901ac..8f3586dea98 100644 --- a/Master/texmf-dist/tex/context/base/context.mkiv +++ b/Master/texmf-dist/tex/context/base/context.mkiv @@ -11,36 +11,76 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% syst-cat -> catc-ini + vectors -% spec-* -> special backends for luatex +\catcode`\{=1 \catcode`\}=2 \catcode`\#=6 + +%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 +%D by use modules to identify the feature level. Starting with version +%D 2004.8.30 the low level interface is english. Watch out and adapt +%D your styles an modules. + +\edef\contextformat {\jobname} +\edef\contextversion{2011.05.18 18:04} + +%D For those who want to use this: + +\let\fmtname \contextformat +\let\fmtversion\contextversion + +%D Loading: + +\edef\mksuffix {mkiv} +\edef\contextmark{MKIV} + +\ifx\normalinput\undefined \let\normalinput\input \fi + +\def\loadcorefile#1{\normalinput#1\relax} +\def\loadmarkfile#1{\normalinput#1.\mksuffix\relax} +\def\loadmkiifile#1{} +\def\loadmkivfile#1{\normalinput#1.mkiv\relax} +\def\loadmkvifile#1{\normalinput#1.mkvi\relax} %D First we load the system modules. These implement a lot of -%D manipulation macros. The first one loads \PLAIN\ \TEX, as -%D minimal as possible. +%D manipulation macros. We start with setting up some basic \TEX\ +%D machinery. + +\loadmarkfile{syst-ini} + +%D Some checking (more primitives are now defined): + +\ifdefined\defaultinterface \else \def\defaultinterface {english} \fi +%ifdefined\messageinterface \else \let\messageinterface \defaultinterface \fi +\ifdefined\defaultlanguagetag \else \def\defaultlanguagetag{en} \fi -\loadcorefile{syst-ini} +%D We just quit if new functionality is expected. \ifnum\luatexversion<60 % also change message \writestatus{!!!!}{Your luatex binary is too old, you need at least version 0.60!} \expandafter\end \fi -\newtoks\contextversiontoks \contextversiontoks\expandafter{\contextversion} % at the lua end +%D There is only this way to pass the version info +%D to \LUA\ (currently). -\loadcorefile{norm-ctx} -\loadcorefile{syst-pln} +\newtoks\contextversiontoks \contextversiontoks\expandafter{\contextversion} -\newif\ifCONTEXT \CONTEXTtrue % will disappear +%D Now the more fundamnetal code gets defined. + +\loadmarkfile{norm-ctx} +\loadmarkfile{syst-pln} +\loadmarkfile{syst-mes} \loadmarkfile{luat-cod} \loadmarkfile{luat-bas} \loadmarkfile{luat-lib} \loadmarkfile{catc-ini} -\loadcorefile{catc-act} -\loadcorefile{catc-def} -\loadcorefile{catc-ctx} -\loadcorefile{catc-sym} +\loadmarkfile{catc-act} +\loadmarkfile{catc-def} +\loadmarkfile{catc-ctx} +\loadmarkfile{catc-sym} + +\loadmarkfile{cldf-ini} % From here on we have \unexpanded being \normalprotected, as we % already had \unexpanded long before etex came around. @@ -48,10 +88,8 @@ \loadmarkfile{syst-aux} \loadmarkfile{syst-lua} \loadmarkfile{syst-con} -\loadcorefile{syst-ltx} \loadmarkfile{syst-fnt} -\loadmarkfile{syst-str} \loadmarkfile{syst-rtp} \loadmarkfile{supp-fil} @@ -62,48 +100,52 @@ \loadmarkfile{char-act} \loadmarkfile{mult-ini} -\loadcorefile{mult-fst} -\loadcorefile{mult-sys} -\loadcorefile{mult-def} +%loadmarkfile{mult-fst} % obsolete +\loadmarkfile{mult-sys} +\loadmarkfile{mult-def} \loadmarkfile{mult-chk} -\loadmarkfile{mult-cld} +\loadmarkfile{mult-aux} + +\loadmarkfile{cldf-int} % interface \loadmarkfile{luat-ini} \loadmarkfile{toks-ini} +\loadmarkfile{attr-ini} + +\loadmarkfile{core-var} +\loadmarkfile{core-env} + +\loadmarkfile{layo-ini} + \loadmarkfile{node-ini} \loadmarkfile{node-fin} \loadmarkfile{node-mig} \loadmarkfile{node-par} %loadmarkfile{node-pag} -\loadmarkfile{core-var} - \loadmarkfile{back-ini} -\loadmarkfile{lpdf-ini} % some day back-ini will load this -\loadmarkfile{lpdf-pdx} % might be merged into lpdf-ini -\loadmarkfile{back-pdf} % some day back-ini will load this - -\loadmarkfile{attr-ini} -\loadmarkfile{core-env} +\loadmarkfile{attr-col} +\loadmarkfile{attr-lay} +\loadmarkfile{attr-neg} +\loadmarkfile{attr-eff} \loadmarkfile{trac-tex} -\loadmarkfile{trac-lmx} \loadmarkfile{trac-deb} -\loadmarkfile{blob-ini} % not to be used, we only use a helper +%loadmarkfile{blob-ini} % not to be used, we only use a helper -\loadcorefile{supp-box} +\loadmarkfile{supp-box} -\loadcorefile{supp-vis} -\loadcorefile{supp-fun} +\loadmarkfile{supp-vis} +\loadmarkfile{supp-fun} \loadmarkfile{supp-ran} \loadmarkfile{supp-mat} -\loadcorefile{supp-ali} -\loadcorefile{supp-num} +\loadmarkfile{supp-ali} +\loadmarkfile{supp-num} \loadmarkfile{typo-ini} @@ -111,16 +153,14 @@ \loadmarkfile{core-fil} \loadmarkfile{core-con} -\loadcorefile{cont-fil} +\loadmarkfile{cont-fil} \loadmarkfile{regi-ini} -\loadcorefile{regi-syn} \loadmarkfile{enco-ini} \loadmarkfile{hand-ini} \loadmarkfile{lang-ini} \loadmarkfile{lang-lab} -\loadmarkfile{lang-wrd} \loadmarkfile{unic-ini} @@ -131,51 +171,41 @@ \loadmarkfile{colo-ini} \loadmarkfile{colo-ext} +\loadmarkfile{node-bck} % overloads anch-pgr (experimental and undocumented) + \loadmarkfile{trac-vis} \loadmarkfile{lang-mis} \loadmarkfile{lang-url} - -\loadcorefile{lang-ger} -\loadcorefile{lang-ita} -\loadcorefile{lang-sla} -\loadcorefile{lang-alt} -\loadcorefile{lang-ana} -\loadcorefile{lang-art} -\loadcorefile{lang-bal} -\loadcorefile{lang-cel} -\loadcorefile{lang-grk} -\loadcorefile{lang-ind} -\loadcorefile{lang-ura} -\loadcorefile{lang-vn} -\loadcorefile{lang-cyr} - -\loadmarkfile{lang-ara} -\loadmarkfile{lang-cjk} +\loadmarkfile{lang-def} +\loadmarkfile{lang-wrd} % can be optional \loadmarkfile{symb-ini} \loadmarkfile{sort-ini} +\loadmkvifile{pack-mis} \loadmarkfile{pack-rul} \loadmarkfile{lxml-ini} \loadmarkfile{lxml-sor} \loadmarkfile{strc-ini} +\loadmarkfile{strc-tag} \loadmarkfile{strc-doc} +\loadmarkfile{strc-num} \loadmarkfile{strc-mar} \loadmarkfile{strc-prc} \loadmarkfile{strc-sbe} \loadmarkfile{strc-lst} \loadmarkfile{strc-sec} -\loadmarkfile{strc-num} +\loadmarkfile{strc-pag} % hm, depends on core-num \loadmarkfile{strc-ren} \loadmarkfile{strc-xml} -\loadmarkfile{strc-pag} % hm, depends on core-num \loadmarkfile{strc-def} % might happen later \loadmarkfile{strc-ref} \loadmarkfile{strc-reg} +\loadmarkfile{strc-lev} % experiment \loadmarkfile{spac-hor} \loadmarkfile{spac-ver} @@ -188,7 +218,9 @@ \loadmarkfile{anch-pos} -\loadmarkfile{scrn-nav} +\loadmkvifile{scrn-ini} +\loadmkvifile{scrn-ref} + \loadmarkfile{pack-obj} \loadmarkfile{strc-itm} @@ -212,31 +244,46 @@ \loadmarkfile{page-mul} \loadmarkfile{page-set} \loadmarkfile{pack-lyr} +\loadmarkfile{pack-pos} \loadmarkfile{page-mak} \loadmarkfile{page-lin} \loadmarkfile{page-par} -\loadmarkfile{page-mar} +%loadmarkfile{page-mar} % also commented code in anch-pgr.mkiv +\loadmarkfile{typo-mar} \loadmarkfile{core-job} % why so late? \loadmarkfile{buff-ini} \loadmarkfile{buff-ver} +\loadmarkfile{buff-par} + +\loadmarkfile{buff-imp-tex} % optional as also runtime if not loaded +\loadmarkfile{buff-imp-mp} % optional as also runtime if not loaded +\loadmarkfile{buff-imp-lua} % optional as also runtime if not loaded +\loadmarkfile{buff-imp-xml} % optional as also runtime if not loaded + +\loadmarkfile{buff-imp-parsed-xml} % optional +%loadmarkfile{buff-imp-parsed-lua} % optional \loadmarkfile{strc-blk} \loadmarkfile{page-imp} +\loadmarkfile{page-sel} % optional +\loadmarkfile{page-com} % optional + +\loadmkvifile{scrn-pag} +\loadmkvifile{scrn-wid} +\loadmkvifile{scrn-but} +\loadmkvifile{scrn-bar} -\loadmarkfile{scrn-int} -\loadmarkfile{scrn-men} -\loadmarkfile{scrn-but} -\loadmarkfile{scrn-bar} \loadmarkfile{strc-bkm} % bookmarks \loadmarkfile{tabl-com} \loadmarkfile{tabl-pln} -\loadcorefile{thrd-tab} -\loadmarkfile{tabl-tab} + +\loadmarkfile{tabl-tab} % thrd-tab stripped and merged + \loadmarkfile{tabl-tbl} \loadmarkfile{tabl-ntb} \loadmarkfile{tabl-nte} @@ -245,8 +292,8 @@ \loadmarkfile{java-ini} -\loadmarkfile{scrn-fld} -\loadmarkfile{scrn-hlp} +\loadmkvifile{scrn-fld} +\loadmkvifile{scrn-hlp} \loadmarkfile{char-enc} \loadmarkfile{font-ini} @@ -256,9 +303,12 @@ \loadmarkfile{font-col} \loadmarkfile{font-gds} +\loadmarkfile{blob-ini} % not to be used, we only use a helper + +\loadmarkfile{typo-cln} \loadmarkfile{typo-spa} \loadmarkfile{typo-krn} -\loadmarkfile{typo-mir} +\loadmarkfile{typo-dir} \loadmarkfile{typo-brk} \loadmarkfile{typo-cap} \loadmarkfile{typo-dig} @@ -266,22 +316,18 @@ \loadmarkfile{type-ini} \loadmarkfile{type-set} +\loadmarkfile{type-def} +\loadmarkfile{type-lua} \loadmarkfile{scrp-ini} -\loadmarkfile{prop-ini} -\loadmarkfile{prop-lay} -\loadmarkfile{prop-mis} +\loadmarkfile{prop-ini} % only for downward compatibility \loadmarkfile{mlib-ctx} -\loadmarkfile{mlib-pdf} -\loadmarkfile{mlib-pps} \loadmarkfile{meta-ini} \loadmarkfile{meta-tex} -\loadmarkfile{meta-pdf} \loadmarkfile{meta-fun} - \loadmarkfile{meta-pag} \loadmarkfile{page-flw} @@ -314,6 +360,7 @@ \loadmarkfile{core-fnt} \loadmarkfile{node-rul} +\loadmarkfile{node-spl} \loadmarkfile{strc-not} \loadmarkfile{strc-lnt} @@ -323,27 +370,29 @@ \loadmarkfile{grph-trf} \loadmarkfile{grph-inc} \loadmarkfile{grph-fig} +\loadmarkfile{grph-raw} \loadmarkfile{pack-box} \loadmarkfile{pack-bar} \loadmarkfile{page-app} \loadmarkfile{meta-fig} -\loadmarkfile{node-bck} % overloads anch-pgr (experimental and undocumented) - -\loadcorefile{lang-spa} +\loadmarkfile{lang-spa} % will become obsolete \loadmarkfile{bibl-bib} \loadmarkfile{bibl-tra} -\loadmarkfile{x-xtag} % at some point this will not be preloaded +%loadmarkfile{x-xtag} % no longer preloaded -\loadcorefile{meta-xml} +\loadmarkfile{meta-xml} -\loadcorefile{cont-log} +\loadmarkfile{cont-log} \loadmarkfile{task-ini} +\loadmarkfile{cldf-ver} % verbatim, this can come late +\loadmarkfile{cldf-com} % commands, this can come late + \loadmarkfile{core-ctx} \loadmarkfile{core-ini} @@ -353,28 +402,28 @@ %usemodule[x][res-08] % rlx runtime conversion %usemodule[x][res-12] % rli external indentification -\unprotect +% now we hook in backend code (needs checking) -\setupcurrentlanguage[\s!en] +\loadmarkfile{back-pdf} % actually, this one should load the next three +\loadmarkfile{mlib-pdf} +\loadmarkfile{mlib-pps} +\loadmarkfile{grph-epd} +\loadmarkfile{meta-pdf} + +\loadmarkfile{back-exp} + +\setupcurrentlanguage[\defaultlanguagetag] \prependtoks - \ctxlua{statistics.starttiming(ctx)}% + \ctxlua{statistics.starttiming(statistics)}% \to \everyjob \appendtoks - \ctxlua{statistics.stoptiming(ctx)}% + \ctxlua{statistics.stoptiming(statistics)}% \to \everyjob \appendtoks - \writestatus\m!lua{used config path - \ctxlua{tex.print(caches.configpath())}}% - \writestatus\m!lua{used cache path - \ctxlua{tex.print(caches.path)}}% -\to \everydump - -\appendtoks - \ctxlua { - statistics.report_storage("log") - statistics.save_fmt_status("\jobname","\contextversion","context.tex") - }% + \ctxlua{statistics.savefmtstatus("\jobname","\contextversion","context.mkiv")}% can become automatic \to \everydump -\protect \errorstopmode \dump \endinput +\errorstopmode \dump \endinput diff --git a/Master/texmf-dist/tex/context/base/context.rme b/Master/texmf-dist/tex/context/base/context.rme index 1b1e4890258..1ce6b25c0da 100644 --- a/Master/texmf-dist/tex/context/base/context.rme +++ b/Master/texmf-dist/tex/context/base/context.rme @@ -1,85 +1,79 @@ Some Basic information ---------------------- -There are currently three interfaces available: +The first public versions of ConTeXt date from around 1996. There +are currently two versions of ConTeXt: - cont-en the english version - cont-de the german version - cont-nl the dutch version - cont-cz the czech version - cont-ro the romanian version - cont-it the italian version + MkII: to be used with pdfTeX and XeTeX + MkIV: to be used with LuaTeX -One should compile one of these (or all) into a fmt file. -When one uses the main file, +In 2008 at the second ConTeXt conference the decision was made to +freeze MkII. This means that only bugs are fixed and apart from an +occasional addition no active development takes place. This is no +real problem as the engines don't change much either. - context the undefined version +Early 2011 the code base between MkII and MkIV got split completely +and there is no shared code any longer, apart from some styles and +modules. -TeX ask for an interface language as well as a message -language. Here one has to specify the full name (english, -german, dutch, etc.) or use the default (enter). The \ -savest way to update the TeX and MetaPost format files -is to use TeXExec: +The main files context.mkii and context.mkiv are normally not used +directly but instead we use the interface specific formats: -texexec --make --alone en nl metafun + cont-cs czech + cont-de german + cont-en english us + cont-fr french + cont-gb english uk + cont-it italian + cont-nl dutch + cont-pe persian + cont-ro romanian -In the TeXExec manual you can read how to generate a format -with specific fonts and patterns. +A MkII format is made with: -By default only the english hyphenation patterns are loaded, -unless more are enabled in: + texexec --make en nl metafun - cont-usr the typesetting language specifications +A MkIV format is made with: -Furthermore, users can preset commands etc in the file + context --make en nl - cont-sys a system file loaded at runtime +As MetaPost is part of LuaTeX there is no need for a special MetaFun +format. Also, when you update ConTeXt, a new format will be generated +automatically. -For questions and remarks on ConTeXt, one can subscribe to -the list: +You can preset commands etc in the file: - ntg-context@ntg.nl + cont-sys.mkii a system file loaded at runtime + cont-sys.mkiv a system file loaded at runtime -by sending the message - - subscribe ntg-context +In the case of MkII, there is a fallback on cont-sys.tex (backward +compatibility). If no file is found the file cont-sys.rme is loaded +(only for MkII). For MkIV this file is normally not needed. -to the list server: +For questions and remarks on ConTeXt, one can subscribe to the list: - majordomo@ntg.nl + ntg-context@ntg.nl -One can find more info at: - - www.pragma-ade.com +by sending the message -or at the mirror sites mentioned there. + subscribe ntg-context -Don't hesitate to ask questions. ConTeXt can do a lot, and -the manuals are always a bit behind and incomplete. Also take -a look at the files +to the list server: - mreadme.pdf - minstall.pdf - mtexexec.pdf - mtexutil.pdf + majordomo@ntg.nl -The teTeX, fpTeX, and 4TeX distributions demonstrate how -ConTeXt can be integrated in a TeX directory structure. +A good place to get information is the ConTeXt wiki: -------------------------- + contextgarden.net -functionality removed from mkiv: +One can also find more info at: -page-log : layers can do teh same and are more flexible -core-dat : just use lua for database purposes -core-swd : this was a temporary solution + www.pragma-ade.com -functionality changed in mkii and mkiv: +or at the mirror sites mentioned there. -xtag-map : no longer preloaded -xtag-stk : no longer preloaded -xtag-prs : no longer preloaded +Don't hesitate to ask questions. ConTeXt can do a lot, but the manuals +always lag behind and can be incomplete. ------------------------- - Hans Hagen, pragma@wxs.nl diff --git a/Master/texmf-dist/tex/context/base/context.tex b/Master/texmf-dist/tex/context/base/context.tex deleted file mode 100644 index 47489658ea6..00000000000 --- a/Master/texmf-dist/tex/context/base/context.tex +++ /dev/null @@ -1,225 +0,0 @@ -%D \module -%D [ file=context, -%D version=1995.10.10, -%D title=\CONTEXT, -%D subtitle=\CONTEXT\ Format Generation, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\catcode`\{=1 \catcode`\}=2 \catcode`\#=6 - -%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 -%D by use modules to identify the feature level. Starting with version -%D 2004.8.30 the low level interface is english. Watch out and adapt -%D your styles an modules. - -\edef\contextformat {\jobname} -\edef\contextversion{2010.05.24 13:05} - -%D For those who want to use this: - -\let\fmtname \contextformat -\let\fmtversion\contextversion - -\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 - -%D We have two versions, one for \PDFTEX\ and \XETEX, and one for -%D \LUATEX. - -\chardef\contextmarkmode = \ifx\directlua\undefined 2 \else 4 \fi - -\def\loadcorefile#1{\normalinput#1\relax} -\def\loadmarkfile#1{\normalinput#1.\mksuffix\relax} - -\ifnum\contextmarkmode=4 - \def\loadmarkiifile#1{} \let\loadmarkivfile\loadcorefile \edef\mksuffix {mkiv} \edef\contextmark{MKIV} -\else - \def\loadmarkivfile#1{} \let\loadmarkiifile\loadcorefile \edef\mksuffix {mkii} \edef\contextmark{MKII} -\fi - -\let\loadmkiifile\loadmarkiifile -\let\loadmkivfile\loadmarkivfile -\let\loadmkfile \loadmarkfile - -%D Welcome to the main module. When this module is ran through -%D \type{initex} or \type {tex -i} or \type {whatevertex} using -%D \type{whatever switch}, the \CONTEXT\ format file is -%D generated. During this process the user is asked for an -%D interface language. Supplying \type{dutch} will generate a -%D dutch version of \CONTEXT, supplying \type {english} will of -%D course end op in a english version. -%D -%D Another option is to use \TEXEXEC\ (for \MKII): -%D -%D \starttyping -%D texexec --make [--alone] [--engine] [--all] -%D texexec --make [--alone] [--engine] en nl ... metafun mptopdf -%D \stoptyping -%D -%D More information can be found in the \TEXEXEC\ manual. -%D -%D For \MKIV\ you have to do: -%D -%D \starttyping -%D luatools --generate -%D context --make en nl ... -%D \stoptyping - -%D When you write modules (or extensions) you should avoid -%D conflicts with existing macro names and mechanisms. If you are -%D coming from another macro package, don't assume that macros -%D with the same name are doing the same! \CONTEXT\ was written -%D from scratch and therefore similarities are often a coincidence -%D (to some extent one always ends up with the same names for -%D similar concepts). The underlying models for elementary subsystems -%D that deal with encodings, languages and fonts probably differ. -%D -%D Time has learned that users coming from \LATEX\ should not fall -%D into thinking that macros like \type {\protect} represent the -%D same functionality in both systems; actually, due to the way -%D \CONTEXT\ is set up, some of those macros do complete different -%D things. Macro packages evolve independent of each other, which -%D means that code written for one system will not work in another -%D system, unless it's real generic code. -%D -%D An API will become available soon (keep an eye on the ConTeXt -%D Wiki www.contextgarden.org) and or listen in to the context -%D mailing list (ntg-context@ntg.nl). Much additional information -%D can be found at the PRAGMA website (www.pragma-ade.com). - -%D We now go either the \MKII\ or \MKIV\ route: - -\loadmarkfile{context} - -%D Let's quit this file when doing a \type {cont-..} generation. - -\doifparentfileelse{context}{\donothing}{\endinput} - -%D Unless we're generating a \type {cont-..} format, we also -%D do the following. - -%D Except from english, no hyphenation patterns are loaded -%D yet. Users can specify their needs in the next module: - -\loaduserspecifications - -%D Next we default to the same language as the interface. - -\unprotect - -\installlanguage [\s!us] [\c!state=\v!start] - -\startinterface english - \installlanguage [\s!gb] [\c!state=\v!start] -\stopinterface - -\appendtoks \language [\s!us] \to \everyjob -\appendtoks \mainlanguage [\s!us] \to \everyjob - -\startinterface german - - \installlanguage [\s!de] [\c!state=\v!start] - - \appendtoks \language [\s!de] \to \everyjob - \appendtoks \mainlanguage [\s!de] \to \everyjob - -\stopinterface - -\startinterface dutch - - \installlanguage [\s!nl] [\c!state=\v!start] - - \appendtoks \language [\s!nl] \to \everyjob - \appendtoks \mainlanguage [\s!nl] \to \everyjob - -\stopinterface - -\startinterface czech - - \installlanguage [\s!cs] [\c!state=\v!start] - - \appendtoks \language [\s!cs] \to \everyjob - \appendtoks \mainlanguage [\s!cs] \to \everyjob - -\stopinterface - -\startinterface italian - - \installlanguage [\s!it] [\c!state=\v!start] - - \appendtoks \language [\s!it] \to \everyjob - \appendtoks \mainlanguage [\s!it] \to \everyjob - -\stopinterface - -\startinterface romanian - - \installlanguage [\s!ro] [\c!state=\v!start] - - \appendtoks \language [\s!ro] \to \everyjob - \appendtoks \mainlanguage [\s!ro] \to \everyjob - -\stopinterface - -\startinterface french - - \installlanguage [\s!fr] [\c!state=\v!start] - - \appendtoks \language [\s!fr] \to \everyjob - \appendtoks \mainlanguage [\s!fr] \to \everyjob - -\stopinterface - -\startinterface persian - - \installlanguage [\s!pe] [\c!state=\v!start] - - \appendtoks \language [\s!pe] \to \everyjob - \appendtoks \mainlanguage [\s!pe] \to \everyjob - -\stopinterface - -\protect - -%D Finally we (pre)load some fonts. - -\setupencoding[default=ec] - -\usetypescript[fallback][\defaultencoding] - -\setupbodyfont[rm,12pt] - -%D The next hook can be used to generate a local (extended) -%D format. This file is only searched for at the current -%D path. - -% \readlocfile{cont-def.tex} -% {\writestatus{loading}{adding extensions from cont-def}} -% {} - -%D Now dumping the format is all that's left to be done. - -\errorstopmode \dump - -\endinput diff --git a/Master/texmf-dist/tex/context/base/context.todo b/Master/texmf-dist/tex/context/base/context.todo new file mode 100644 index 00000000000..27d914a7b6e --- /dev/null +++ b/Master/texmf-dist/tex/context/base/context.todo @@ -0,0 +1,6 @@ +% marginrules + +% consistently use label/name/tag +% consistently use type/kind + +% option vs options diff --git a/Master/texmf-dist/tex/context/base/core-con.lua b/Master/texmf-dist/tex/context/base/core-con.lua index dca1c7d10cc..e8ef52d4bf8 100644 --- a/Master/texmf-dist/tex/context/base/core-con.lua +++ b/Master/texmf-dist/tex/context/base/core-con.lua @@ -17,25 +17,34 @@ slower but look nicer this way.

local utf = unicode.utf8 local floor, date, time, concat = math.floor, os.date, os.time, table.concat -local lower, format, rep = string.lower, string.format, string.rep -local texsprint, utfchar = tex.sprint, utf.char +local lower, format, rep, match = string.lower, string.format, string.rep, string.match +local utfchar, utfbyte = utf.char, utf.byte local tonumber, tostring = tonumber, tostring -local ctxcatcodes = tex.ctxcatcodes +local settings_to_array = utilities.parsers.settings_to_array +local allocate = utilities.storage.allocate -converters = converters or { } -languages = languages or { } +local context = context ---~ ['arabic-digits'] = { ---~ 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, ---~ 0x0665, 0x0666, 0x0667, 0x0668, 0x0669 ---~ }, ---~ ['persian-digits'] = { ---~ 0x06F0, 0x06F1, 0x06F2, 0x06F3, 0x06F4, ---~ 0x06F5, 0x06F6, 0x06F7, 0x06F8, 0x06F9 ---~ }, +local variables = interfaces.variables -languages.counters = { +converters = converters or { } +local converters = converters + +languages = languages or { } +local languages = languages + +local function number(n) + return tonumber(n) +end + +converters.number = number + +function commands.number(n) context(n) end + +-- to be reconsidered ... languages namespace here, might become local plus a register command + +local counters = allocate { ['**'] = { 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, @@ -111,132 +120,173 @@ languages.counters = { }, } -local counters = languages.counters +languages.counters = counters -counters['ar'] = counters['arabic'] -counters['gr'] = counters['greek'] -counters['g'] = counters['greek'] -counters['sl'] = counters['slovenian'] -counters['kr'] = counters['korean'] -counters['kr-p'] = counters['korean-parent'] -counters['kr-c'] = counters['korean-circle'] +counters['ar'] = counters['arabic'] +counters['gr'] = counters['greek'] +counters['g'] = counters['greek'] +counters['sl'] = counters['slovenian'] +counters['kr'] = counters['korean'] +counters['kr-p'] = counters['korean-parent'] +counters['kr-c'] = counters['korean-circle'] local fallback = utf.byte('0') local function chr(n,m) - if n > 0 and n < 27 then - texsprint(utfchar(n+m)) - end + return (n > 0 and n < 27 and utfchar(n+m)) or "" end -local function chrs(n,m) + +local function chrs(n,m,t) + if not t then + t = { } + end if n > 26 then - chrs(floor((n-1)/26),m) + chrs(floor((n-1)/26),m,t) n = (n-1)%26 + 1 end - texsprint(utfchar(n+m)) + if n ~= 0 then + t[#t+1] = utfchar(n+m) + end + if n <= 26 then + return concat(t) + end end -local function maxchrs(n,m,cmd) + +local function maxchrs(n,m,cmd,t) + if not t then + t = { } + end if n > m then maxchrs(floor((n-1)/m),m,cmd) n = (n-1)%m + 1 end - texsprint(ctxcatcodes, format("%s{%s}",cmd,n)) + t[#t+1] = format("%s{%s}",cmd,n) + if n <= m then + return concat(t) + end end converters.chr = chr converters.chrs = chrs converters.maxchrs = maxchrs ---~ more efficient but needs testing ---~ ---~ local escapes = utffilters.private.escapes ---~ ---~ local function do_alphabetic(n,mapping,chr) ---~ local max = #mapping ---~ if n > max then ---~ do_alphabetic(floor((n-1)/max),max,chr) ---~ n = (n-1)%max+1 ---~ end ---~ n = chr(n,mapping) ---~ texsprint(ctxcatcodes,escapes[n] or utfchar(n)) ---~ end - ---~ local lccodes, uccodes = characters.lccode, characters.uccode - ---~ local function do_alphabetic(n,mapping,chr) ---~ local max = #mapping ---~ if n > max then ---~ do_alphabetic(floor((n-1)/max),mapping,chr) ---~ n = (n-1)%max+1 ---~ end ---~ characters.flush(chr(n,mapping)) ---~ end ---~ ---~ local function lowercased(n,mapping) return characters.lccode(mapping[n] or fallback) end ---~ local function uppercased(n,mapping) return characters.uccode(mapping[n] or fallback) end ---~ ---~ function converters.alphabetic(n,code) ---~ do_alphabetic(n,counters[code] or counters['**'],lowercased) -- lccode catches wrong tables ---~ end ---~ ---~ function converters.Alphabetic(n,code) ---~ do_alphabetic(n,counters[code] or counters['**'],uppercased) ---~ end +local lowercharacter = characters.lcchars +local uppercharacter = characters.ucchars --- - -local function do_alphabetic(n,mapping,mapper) - local chr = mapper(mapping[n] or fallback) +local function do_alphabetic(n,mapping,mapper,t) + if not t then + t = { } + end + local chr = mapping[n] or fallback + if mapper then + chr = mapper[chr] + end local max = #mapping if n > max then - do_alphabetic(floor((n-1)/max),mapping,mapper) - n = (n-1)%max+1 + do_alphabetic(floor((n-1)/max),mapping,mapper,t) + n = (n-1) % max + 1 + end + t[#t+1] = chr + if n <= max then + return concat(t) end - characters.flush(chr) end -function converters.alphabetic(n,code) - do_alphabetic(n,counters[code] or counters['**'],characters.lccode) +local function alphabetic(n,code) + return do_alphabetic(n,counters[code] or counters['**'],lowercharacter) end -function converters.Alphabetic(n,code) - do_alphabetic(n,counters[code] or counters['**'],characters.uccode) +local function Alphabetic(n,code) + return do_alphabetic(n,counters[code] or counters['**'],uppercharacter) end --- +local function character (n) return chr (n,96) end +local function Character (n) return chr (n,64) end +local function characters(n) return chrs(n,96) end +local function Characters(n) return chrs(n,64) end + +converters.alphabetic = alphabetic +converters.Alphabetic = Alphabetic +converters.character = character +converters.Character = Character +converters.characters = characters +converters.Characters = Characters + +function commands.alphabetic(n,c) context(alphabetic(n,c)) end +function commands.Alphabetic(n,c) context(Alphabetic(n,c)) end +function commands.character (n) context(character (n)) end +function commands.Character (n) context(Character (n)) end +function commands.characters(n) context(characters(n)) end +function commands.Characters(n) context(Characters(n)) end -function converters.character (n) chr (n,96) end -function converters.Character (n) chr (n,64) end -function converters.characters(n) chrs(n,96) end -function converters.Characters(n) chrs(n,64) end +local days = { + [false] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, + [true] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } +} -function converters.weekday(day,month,year) - texsprint(date("%w",time{year=year,month=month,day=day})+1) +local function weekday(day,month,year) + return date("%w",time{year=year,month=month,day=day}) + 1 end -function converters.isleapyear(year) +local function isleapyear(year) return (year % 400 == 0) or ((year % 100 ~= 0) and (year % 4 == 0)) end -function converters.leapyear(year) - if converters.isleapyear(year) then texsprint(1) else texsprint(0) end +local function leapyear(year) + return isleapyear(year) and 1 or 0 end -local days = { - [false] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, - [true] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } -} +local function nofdays(year,month) + return days[isleapyear(year)][month] +end + +local function year () return date("%Y") end +local function month () return date("%m") end +local function hour () return date("%H") end +local function minute() return date("%M") end +local function second() return date("%S") end -function converters.nofdays(year,month) - texsprint(days[converters.isleapyear(year)][month]) +local function textime() + return tonumber(date("%H")) * 60 + tonumber(date("%M")) end -function converters.year () texsprint(date("%Y")) end -function converters.month () texsprint(date("%m")) end -function converters.hour () texsprint(date("%H")) end -function converters.minute () texsprint(date("%M")) end -function converters.second () texsprint(date("%S")) end -function converters.textime() texsprint(tonumber(date("%H"))*60+tonumber(date("%M"))) end +converters.weekday = weekday +converters.isleapyear = isleapyear +converters.leapyear = leapyear +converters.nofdays = nofdays +converters.year = year +converters.month = month +converters.hour = hour +converters.minute = minute +converters.second = second +converters.textime = textime + +function commands.weekday(day,month,year) + context(weekday(day,month,year)) +end + +function commands.isleapyear(year) + context(isleapyear(year)) +end + +function commands.leapyear(year) + context(leapyear(year)) +end + +function commands.nofdays(year,month) + context(nofdays(year,month)) +end + +function commands.year () context(year ()) end +function commands.month () context(month ()) end +function commands.hour () context(hour ()) end +function commands.minute () context(minute ()) end +function commands.second () context(second ()) end +function commands.textime() context(textime()) end + +function commands.doifleapyearelse(year) + commands.testcase(leapyear(year)) +end local roman = { { [0] = '', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX' }, @@ -248,15 +298,20 @@ local function toroman(n) if n >= 4000 then return toroman(floor(n/1000)) .. " " .. toroman(n%1000) else - return rep("M",floor(n/1000)) .. roman[3][floor((n%1000)/100)] .. - roman[2][floor((n%100)/10)] .. roman[1][floor((n% 10)/1)] + return rep("M",floor(n/1000)) .. roman[3][floor((n%1000)/100)] .. roman[2][floor((n%100)/10)] .. roman[1][floor((n% 10)/1)] end end -function converters.romannumerals(n) return texsprint(lower(toroman(n))) end -function converters.Romannumerals(n) return texsprint( toroman(n) ) end +local Romannumerals = toroman + +local function romannumerals(n) return lower(toroman(n)) end + +converters.toroman = toroman +converters.Romannumerals = toroman +converters.romannumerals = romannumerals -converters.toroman = toroman +function commands.romannumerals(n) context(lower(toroman(n))) end +function commands.Romannumerals(n) context( toroman(n)) end --~ local small = { --~ 0x0627, 0x066E, 0x062D, 0x062F, 0x0647, 0x0648, 0x0631 @@ -287,7 +342,7 @@ local large = { { "غ" }, } -function converters.toabjad(n,what) +local function toabjad(n,what) if n <= 0 or n >= 2000 then return tostring(n) elseif what == 2 and n <= 7 then @@ -304,8 +359,16 @@ function converters.toabjad(n,what) end end -function converters.abjadnumerals (n) return texsprint(converters.toabjad(n,false)) end -function converters.abjadnodotnumerals(n) return texsprint(converters.toabjad(n,true)) end +converters.toabjad = toabjad + +local function abjadnumerals (n) return toabjad(n,false) end +local function abjadnodotnumerals(n) return toabjad(n,true ) end + +converters.abjadnumerals = abjadnumerals +converters.abjadnodotnumerals = abjadnodotnumerals + +function commands.abjadnumerals (n) context(toabjad(n,false)) end +function commands.abjadnodotnumerals(n) context(toabjad(n,true )) end local vector = { normal = { @@ -363,128 +426,73 @@ local vector = { } } ---~ function tochinese(n,name) -- normal, caps, all ---~ local result = { } ---~ local vector = vector[name] or vector.normal ---~ while true do ---~ if n == 0 then ---~ break ---~ elseif n >= 100000000 then ---~ local m = floor(n/100000000) ---~ if m > 1 then result[#result+1] = tochinese(m) end ---~ result[#result+1] = vector[100000000] ---~ n = n % 100000000 ---~ elseif n >= 10000000 then ---~ result[#result+1] = tochinese(floor(n/10000)) ---~ result[#result+1] = vector[10000] ---~ n = n % 10000 ---~ elseif n >= 1000000 then ---~ result[#result+1] = tochinese(floor(n/10000)) ---~ result[#result+1] = vector[10000] ---~ n = n % 10000 ---~ elseif n >= 100000 then ---~ result[#result+1] = tochinese(floor(n/10000)) ---~ result[#result+1] = vector[10000] ---~ n = n % 10000 ---~ elseif n >= 10000 then ---~ local m = floor(n/10000) ---~ if m > 1 then result[#result+1] = vector[m] end ---~ result[#result+1] = vector[10000] ---~ n = n % 10000 ---~ elseif n >= 1000 then ---~ local m = floor(n/1000) ---~ if m > 1 then result[#result+1] = vector[m] end ---~ result[#result+1] = vector[1000] ---~ n = n % 1000 ---~ elseif n >= 100 then ---~ local m = floor(n/100) ---~ if m > 1 then result[#result+1] = vector[m] end ---~ result[#result+1] = vector[100] ---~ n = n % 100 ---~ elseif n >= 10 then ---~ local m = floor(n/10) ---~ if vector[m*10] then ---~ result[#result+1] = vector[m*10] ---~ else ---~ result[#result+1] = vector[m] ---~ result[#result+1] = vector[10] ---~ end ---~ n = n % 10 ---~ else ---~ result[#result+1] = vector[n] ---~ break ---~ end ---~ end ---~ return concat(result) ---~ end - -function tochinese(n,name) -- normal, caps, all +local function tochinese(n,name) -- normal, caps, all -- improved version by Li Yanrui - local result = { } + local result, r = { }, 0 local vector = vector[name] or vector.normal while true do if n == 0 then break elseif n >= 100000000 then local m = floor(n/100000000) - result[#result+1] = tochinese(m,name) - result[#result+1] = vector[100000000] + r = r + 1 ; result[r] = tochinese(m,name) + r = r + 1 ; result[r] = vector[100000000] local z = n - m * 100000000 - if z > 0 and z < 10000000 then result[#result+1] = vector[0] end + if z > 0 and z < 10000000 then r = r + 1 ; result[r] = vector[0] end n = n % 100000000 elseif n >= 10000000 then local m = floor(n/10000) - result[#result+1] = tochinese(m,name) - result[#result+1] = vector[10000] + r = r + 1 ; result[r] = tochinese(m,name) + r = r + 1 ; result[r] = vector[10000] local z = n - m * 10000 - if z > 0 and z < 1000 then result[#result+1] = vector[0] end + if z > 0 and z < 1000 then r = r + 1 ; result[r] = vector[0] end n = n % 10000 elseif n >= 1000000 then local m = floor(n/10000) - result[#result+1] = tochinese(m,name) - result[#result+1] = vector[10000] + r = r + 1 ; result[r] = tochinese(m,name) + r = r + 1 ; result[r] = vector[10000] local z = n - m * 10000 - if z > 0 and z < 1000 then result[#result+1] = vector[0] end + if z > 0 and z < 1000 then r = r + 1 ; result[r] = vector[0] end n = n % 10000 elseif n >= 100000 then local m = floor(n/10000) - result[#result+1] = tochinese(m,name) - result[#result+1] = vector[10000] + r = r + 1 ; result[r] = tochinese(m,name) + r = r + 1 ; result[r] = vector[10000] local z = n - m * 10000 - if z > 0 and z < 1000 then result[#result+1] = vector[0] end + if z > 0 and z < 1000 then r = r + 1 ; result[r] = vector[0] end n = n % 10000 elseif n >= 10000 then local m = floor(n/10000) - result[#result+1] = vector[m] - result[#result+1] = vector[10000] + r = r + 1 ; result[r] = vector[m] + r = r + 1 ; result[r] = vector[10000] local z = n - m * 10000 - if z > 0 and z < 1000 then result[#result+1] = vector[0] end + if z > 0 and z < 1000 then r = r + 1 ; result[r] = vector[0] end n = n % 10000 elseif n >= 1000 then local m = floor(n/1000) - result[#result+1] = vector[m] - result[#result+1] = vector[1000] + r = r + 1 ; result[r] = vector[m] + r = r + 1 ; result[r] = vector[1000] local z = n - m * 1000 - if z > 0 and z < 100 then result[#result+1] = vector[0] end + if z > 0 and z < 100 then r = r + 1 ; result[r] = vector[0] end n = n % 1000 elseif n >= 100 then local m = floor(n/100) - result[#result+1] = vector[m] - result[#result+1] = vector[100] + r = r + 1 ; result[r] = vector[m] + r = r + 1 ; result[r] = vector[100] local z = n - m * 100 - if z > 0 and z < 10 then result[#result+1] = vector[0] end + if z > 0 and z < 10 then r = r + 1 ; result[r] = vector[0] end n = n % 100 elseif n >= 10 then local m = floor(n/10) if m > 1 and vector[m*10] then - result[#result+1] = vector[m*10] + r = r + 1 ; result[r] = vector[m*10] else - result[#result+1] = vector[m] - result[#result+1] = vector[10] + r = r + 1 ; result[r] = vector[m] + r = r + 1 ; result[r] = vector[10] end n = n % 10 else - result[#result+1] = vector[n] + r = r + 1 ; result[r] = vector[n] break end end @@ -494,112 +502,368 @@ function tochinese(n,name) -- normal, caps, all return concat(result) end ---~ local t = { 1,10,15,25,35,45,11,100,111,1111,10000,11111,100000,111111,1111111,11111111,111111111,100000000,1111111111,11111111111,111111111111,1111111111111 } ---~ for k=1,#t do ---~ local v = t[k] ---~ print(v,tochinese(v),tochinese(v,"all"),tochinese(v,"cap")) ---~ end - -function converters.chinesenumerals (n) return texsprint(tochinese(n,"normal")) end -function converters.chinesecapnumerals(n) return texsprint(tochinese(n,"cap" )) end -function converters.chineseallnumerals(n) return texsprint(tochinese(n,"all" )) end - ---~ Well, since the one asking for this didn't test it the following code is not ---~ enabled. ---~ ---~ -- This Lua version is based on a Javascript by Behdad Esfahbod which in turn ---~ -- is based on GPL'd code by Roozbeh Pournader of the The FarsiWeb Project ---~ -- Group: http://www.farsiweb.info/jalali/jalali.js. ---~ -- ---~ -- We start tables at one, I kept it zero based in order to stay close to ---~ -- the original. ---~ -- ---~ -- Conversion by Hans Hagen ---~ ---~ local g_days_in_month = { [0]=31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } ---~ local j_days_in_month = { [0]=31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29 } ---~ ---~ local function div(a,b) ---~ return math.floor(a/b) ---~ end ---~ ---~ local function remainder(a,b) ---~ return a - div(a,b)*b ---~ end ---~ ---~ function gregorian_to_jalali(gy,gm,gd) ---~ local jy, jm, jd, g_day_no, j_day_no, j_np, i ---~ gy, gm, gd = gy - 1600, gm - 1, gd - 1 ---~ g_day_no = 365*gy + div((gy+3),4) - div((gy+99),100) + div((gy+399),400) ---~ i = 0 ---~ while i < gm do ---~ g_day_no = g_day_no + g_days_in_month[i] ---~ i = i + 1 ---~ end ---~ if (gm>1 and ((gy%4==0 and gy%100~=0) or (gy%400==0))) then ---~ g_day_no = g_day_no + 1 ---~ end ---~ g_day_no = g_day_no + gd ---~ j_day_no = g_day_no - 79 ---~ j_np = div(j_day_no,12053) ---~ j_day_no = remainder(j_day_no,12053) ---~ jy = 979 + 33*j_np + 4*div(j_day_no,1461) ---~ j_day_no = remainder(j_day_no,1461) ---~ if j_day_no >= 366 then ---~ jy = jy + div((j_day_no-1),365) ---~ j_day_no = remainder((j_day_no-1),365) ---~ end ---~ i = 0 ---~ while i < 11 and j_day_no >= j_days_in_month[i] do ---~ j_day_no = j_day_no - j_days_in_month[i] ---~ i = i + 1 ---~ end ---~ jm = i + 1 ---~ jd = j_day_no + 1 ---~ return jy, jm, jd ---~ end ---~ ---~ function jalali_to_gregorian(jy,jm,jd) ---~ local gy, gm, gd, g_day_no, j_day_no, leap, i ---~ jy, jm, jd = jy - 979, jm - 1, jd - 1 ---~ j_day_no = 365*jy + div(jy,33)*8 + div((remainder(jy,33)+3),4) ---~ i = 0 ---~ while i < jm do ---~ j_day_no = j_day_no + j_days_in_month[i] ---~ i = i + 1 ---~ end ---~ j_day_no = j_day_no + jd ---~ g_day_no = j_day_no + 79 ---~ gy = 1600 + 400*div(g_day_no,146097) ---~ g_day_no = remainder (g_day_no, 146097) ---~ leap = 1 ---~ if g_day_no >= 36525 then ---~ g_day_no = g_day_no - 1 ---~ gy = gy + 100*div(g_day_no,36524) ---~ g_day_no = remainder (g_day_no, 36524) ---~ if g_day_no >= 365 then ---~ g_day_no = g_day_no + 1 ---~ else ---~ leap = 0 ---~ end ---~ end ---~ gy = gy + 4*div(g_day_no,1461) ---~ g_day_no = remainder (g_day_no, 1461) ---~ if g_day_no >= 366 then ---~ leap = 0 ---~ g_day_no = g_day_no - 1 ---~ gy = gy + div(g_day_no, 365) ---~ g_day_no = remainder(g_day_no, 365) ---~ end ---~ i = 0 ---~ while g_day_no >= g_days_in_month[i] + ((i == 1 and leap) or 0) do ---~ g_day_no = g_day_no - g_days_in_month[i] + ((i == 1 and leap) or 0) ---~ i = i + 1 ---~ end ---~ gm = i + 1 ---~ gd = g_day_no + 1 ---~ return gy, gm, gd ---~ end ---~ ---~ print(gregorian_to_jalali(2009,02,24)) ---~ print(jalali_to_gregorian(1387,12,06)) +-- local t = { 1,10,15,25,35,45,11,100,111,1111,10000,11111,100000,111111,1111111,11111111,111111111,100000000,1111111111,11111111111,111111111111,1111111111111 } +-- for k=1,#t do +-- local v = t[k] +-- print(v,tochinese(v),tochinese(v,"all"),tochinese(v,"cap")) +-- end + +converters.tochinese = tochinese + +local function chinesenumerals (n) return tochinese(n,"normal") end +local function chinesecapnumerals(n) return tochinese(n,"cap" ) end +local function chineseallnumerals(n) return tochinese(n,"all" ) end + +converters.chinesenumerals = chinesenumerals +converters.chinesecapnumerals = chinesecapnumerals +converters.chineseallnumerals = chineseallnumerals + +function commands.chinesenumerals (n) context(tochinese(n,"normal")) end +function commands.chinesecapnumerals(n) context(tochinese(n,"cap" )) end +function commands.chineseallnumerals(n) context(tochinese(n,"all" )) end + +converters.sequences = converters.sequences or { } + +storage.register("converters/sequences", converters.sequences, "converters.sequences") + +local sequences = converters.sequences + +function converters.define(name,set) + sequences[name] = settings_to_array(set) +end + +commands.defineconversion = converters.define + +local function convert(method,n) -- todo: language + local converter = converters[method] + if converter then + return converter(n) + else + local lowermethod = lower(method) + local linguistic = counters[lowermethod] + if linguistic then + return do_alphabetic(n,linguistic,lowermethod == method and lowercharacter or uppercharacter) + end + local sequence = sequences[method] + if sequence then + local max = #sequence + if n > max then + return sequence[(n-1) % max + 1] + else + return sequence[n] + end + else + return n + end + end +end + +converters.convert = convert + +function commands.checkedconversion(method,n) + context(convert(method,n)) +end + +-- Well, since the one asking for this didn't test it the following code is not +-- enabled. +-- +-- -- This Lua version is based on a Javascript by Behdad Esfahbod which in turn +-- -- is based on GPL'd code by Roozbeh Pournader of the The FarsiWeb Project +-- -- Group: http://www.farsiweb.info/jalali/jalali.js. +-- -- +-- -- We start tables at one, I kept it zero based in order to stay close to +-- -- the original. +-- -- +-- -- Conversion by Hans Hagen +-- +-- local g_days_in_month = { [0]=31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } +-- local j_days_in_month = { [0]=31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29 } +-- +-- local function div(a,b) +-- return math.floor(a/b) +-- end +-- +-- local function remainder(a,b) +-- return a - div(a,b)*b +-- end +-- +-- function gregorian_to_jalali(gy,gm,gd) +-- local jy, jm, jd, g_day_no, j_day_no, j_np, i +-- gy, gm, gd = gy - 1600, gm - 1, gd - 1 +-- g_day_no = 365*gy + div((gy+3),4) - div((gy+99),100) + div((gy+399),400) +-- i = 0 +-- while i < gm do +-- g_day_no = g_day_no + g_days_in_month[i] +-- i = i + 1 +-- end +-- if (gm>1 and ((gy%4==0 and gy%100~=0) or (gy%400==0))) then +-- g_day_no = g_day_no + 1 +-- end +-- g_day_no = g_day_no + gd +-- j_day_no = g_day_no - 79 +-- j_np = div(j_day_no,12053) +-- j_day_no = remainder(j_day_no,12053) +-- jy = 979 + 33*j_np + 4*div(j_day_no,1461) +-- j_day_no = remainder(j_day_no,1461) +-- if j_day_no >= 366 then +-- jy = jy + div((j_day_no-1),365) +-- j_day_no = remainder((j_day_no-1),365) +-- end +-- i = 0 +-- while i < 11 and j_day_no >= j_days_in_month[i] do +-- j_day_no = j_day_no - j_days_in_month[i] +-- i = i + 1 +-- end +-- jm = i + 1 +-- jd = j_day_no + 1 +-- return jy, jm, jd +-- end +-- +-- function jalali_to_gregorian(jy,jm,jd) +-- local gy, gm, gd, g_day_no, j_day_no, leap, i +-- jy, jm, jd = jy - 979, jm - 1, jd - 1 +-- j_day_no = 365*jy + div(jy,33)*8 + div((remainder(jy,33)+3),4) +-- i = 0 +-- while i < jm do +-- j_day_no = j_day_no + j_days_in_month[i] +-- i = i + 1 +-- end +-- j_day_no = j_day_no + jd +-- g_day_no = j_day_no + 79 +-- gy = 1600 + 400*div(g_day_no,146097) +-- g_day_no = remainder (g_day_no, 146097) +-- leap = 1 +-- if g_day_no >= 36525 then +-- g_day_no = g_day_no - 1 +-- gy = gy + 100*div(g_day_no,36524) +-- g_day_no = remainder (g_day_no, 36524) +-- if g_day_no >= 365 then +-- g_day_no = g_day_no + 1 +-- else +-- leap = 0 +-- end +-- end +-- gy = gy + 4*div(g_day_no,1461) +-- g_day_no = remainder (g_day_no, 1461) +-- if g_day_no >= 366 then +-- leap = 0 +-- g_day_no = g_day_no - 1 +-- gy = gy + div(g_day_no, 365) +-- g_day_no = remainder(g_day_no, 365) +-- end +-- i = 0 +-- while g_day_no >= g_days_in_month[i] + ((i == 1 and leap) or 0) do +-- g_day_no = g_day_no - g_days_in_month[i] + ((i == 1 and leap) or 0) +-- i = i + 1 +-- end +-- gm = i + 1 +-- gd = g_day_no + 1 +-- return gy, gm, gd +-- end +-- +-- print(gregorian_to_jalali(2009,02,24)) +-- print(jalali_to_gregorian(1387,12,06)) + +-- more efficient but needs testing +-- +-- local escapes = utffilters.private.escapes +-- +-- local function do_alphabetic(n,mapping,chr) +-- local max = #mapping +-- if n > max then +-- do_alphabetic(floor((n-1)/max),max,chr) +-- n = (n-1)%max+1 +-- end +-- n = chr(n,mapping) +-- context(escapes[n] or utfchar(n)) +-- end +-- +-- local lccodes, uccodes = characters.lccode, characters.uccode +-- +-- local function do_alphabetic(n,mapping,chr) +-- local max = #mapping +-- if n > max then +-- do_alphabetic(floor((n-1)/max),mapping,chr) +-- n = (n-1)%max+1 +-- end +-- characters.flush(chr(n,mapping)) +-- end +-- +-- local function lowercased(n,mapping) return characters.lccode(mapping[n] or fallback) end +-- local function uppercased(n,mapping) return characters.uccode(mapping[n] or fallback) end +-- +-- function converters.alphabetic(n,code) +-- do_alphabetic(n,counters[code] or counters['**'],lowercased) -- lccode catches wrong tables +-- end +-- +-- function converters.Alphabetic(n,code) +-- do_alphabetic(n,counters[code] or counters['**'],uppercased) +-- end + +-- -- + +local ordinals = { + english = function(n) + local two = n % 100 + if two == 11 or two == 12 or to == 13 then + return "th" + else + local one = n % 10 + if one == 1 then + return "st" + elseif one == 2 then + return "nd" + elseif one == 3 then + return "rd" + else + return "th" + end + end + end, + dutch = function(n) + return "e" + end, + french = function(n) + if n == 1 then + return "er" + end + end, +} + +ordinals.en = ordinals.english +ordinals.nl = ordinals.dutch +ordinals.fr = ordinals.french + +function converters.ordinal(n,language) + local t = language and ordinals[language] + return t and t(n) +end + +function commands.ordinal(n,language) + local t = language and ordinals[language] + local o = t and t(n) + if o then + context.highordinalstr(o) + end +end + +-- -- + +local v_day = variables.day +local v_year = variables.year +local v_month = variables.month +local v_weekday = variables.weekday +local v_referral = variables.referral +local v_space = variables.space + +local convert = converters.convert + +local days = { + variables.sunday, + variables.monday, + variables.tuesday, + variables.wednesday, + variables.thursday, + variables.friday, + variables.saturday, +} + +local months = { + variables.january, + variables.february, + variables.march, + variables.april, + variables.may, + variables.june, + variables.july, + variables.august, + variables.september, + variables.october, + variables.november, + variables.december, +} + +function commands.dayname(n) + context.labeltext(days[n] or "unknown") +end + +function commands.weekdayname(day,month,year) + context.labeltext(days[weekday(day,month,year)] or "unknown") +end + +function commands.monthname(n) + context.labeltext(months[n] or "unknown") +end + +function commands.monthmnem(n) + local m = months[n] + context.labeltext(m and (m ..":mnem") or "unknown") +end + +-- a prelude to a function that we can use at the lua end + +-- historic : day+ month:mnem +-- maybe better: day:ord month:mmem + +function commands.currentdate(str,currentlanguage) -- j and jj obsolete + local list = utilities.parsers.settings_to_array(str) + local year, month, day = tex.year, tex.month, tex.day + local auto = true + for i=1,#list do + local entry = list[i] + local tag, plus = match(entry,"^([^%+:]+)(.*)$") + local ordinal, mnemonic, whatordinal = false, false, nil + if not tag then + tag = entry + elseif plus == "+" or plus == "ord" then + ordinal = true + elseif plus == "mnem" then + mnemonic = true + end + if not auto and (tag == v_year or tag == v_month or tag == v_day or tag == v_weekday) then + context.space() + end + auto = false + if tag == v_year or tag == "y" then + context(year) + elseif tag == "yy" then + context("%02i",year % 100) + elseif tag == "Y" then + context(year) + elseif tag == v_month or tag == "m" then + if mnemonic then + commands.monthmnem(month) + else + commands.monthname(month) + end + elseif tag == "mm" then + context("%02i",month) + elseif tag == "M" then + context(month) + elseif tag == v_day or tag == "d" then + context.convertnumber(v_day,day) + whatordinal = day + elseif tag == "dd" then + context("%02i",day) + whatordinal = day + elseif tag == "D" then + context(day) + whatordinal = day + elseif tag == v_weekday or tag == "w" then + commands.dayname(weekday(day,month,year)) + elseif tag == "W" then + context(weekday(day,month,year)) + elseif tag == v_referral then + context("%04i%02i%02i",year,month,day) + elseif tag == v_space or tag == "\\ " then + context.space() + auto = true + elseif tag ~= "" then + context(tag) + auto = true + end + if ordinal and whatordinal then + commands.ordinal(whatordinal,currentlanguage) + end + end +end diff --git a/Master/texmf-dist/tex/context/base/core-con.mkiv b/Master/texmf-dist/tex/context/base/core-con.mkiv index 2d2e5d5d78e..e43e4ecda55 100644 --- a/Master/texmf-dist/tex/context/base/core-con.mkiv +++ b/Master/texmf-dist/tex/context/base/core-con.mkiv @@ -17,7 +17,7 @@ \unprotect -\ifx\currentlanguage\undefined \let\currentlanguage\empty \fi +\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 @@ -74,41 +74,41 @@ %D \showsetup{romannumerals} %D \showsetup{Romannumerals} -\def\romannumerals#1{\ctxlua{converters.romannumerals(\number#1)}} -\def\Romannumerals#1{\ctxlua{converters.Romannumerals(\number#1)}} +\def\romannumerals#1{\ctxcommand{romannumerals(\number#1)}} +\def\Romannumerals#1{\ctxcommand{Romannumerals(\number#1)}} %D Arabic etc: -\def\abjadnumerals #1{\ctxlua{converters.abjadnumerals (\number#1)}} -\def\abjadnodotnumerals#1{\ctxlua{converters.abjadnodotnumerals(\number#1)}} -\def\abjadnaivenumerals#1{\ctxlua{converters.arabicnumerals (\number#1)}} +\def\abjadnumerals #1{\ctxcommand{abjadnumerals (\number#1)}} +\def\abjadnodotnumerals#1{\ctxcommand{abjadnodotnumerals(\number#1)}} +\def\abjadnaivenumerals#1{\ctxcommand{arabicnumerals (\number#1)}} -\def\languagecharacters#1{\ctxlua{converters.alphabetic(\number#1,"\currentlanguage")}} % new -\def\languageCharacters#1{\ctxlua{converters.Alphabetic(\number#1,"\currentlanguage")}} % new +\def\languagecharacters#1{\ctxcommand{alphabetic(\number#1,"\currentlanguage")}} % new +\def\languageCharacters#1{\ctxcommand{Alphabetic(\number#1,"\currentlanguage")}} % new % we could use an auxiliary macro to save some bytes in the format % -% \def\dolanguagecharacters#1#2{\ctxlua{converters.alphabetic(\number#2,"#1")}} +% \def\dolanguagecharacters#1#2{\ctxcommand{alphabetic(\number#2,"#1")}} -\def\thainumerals #1{\ctxlua{converters.alphabetic(\number#1,"thai")}} -\def\devanagarinumerals#1{\ctxlua{converters.alphabetic(\number#1,"devanagari")}} -\def\gurmurkhinumerals #1{\ctxlua{converters.alphabetic(\number#1,"gurmurkhi")}} -\def\gujaratinumerals #1{\ctxlua{converters.alphabetic(\number#1,"gujarati")}} -\def\tibetannumerals #1{\ctxlua{converters.alphabetic(\number#1,"tibetan")}} -\def\greeknumerals #1{\ctxlua{converters.alphabetic(\number#1,"greek")}} -\def\Greeknumerals #1{\ctxlua{converters.Alphabetic(\number#1,"greek")}} -\def\arabicnumerals #1{\ctxlua{converters.alphabetic(\number#1,"arabic")}} -\def\persiannumerals #1{\ctxlua{converters.alphabetic(\number#1,"persian")}} +\def\thainumerals #1{\ctxcommand{alphabetic(\number#1,"thai")}} +\def\devanagarinumerals#1{\ctxcommand{alphabetic(\number#1,"devanagari")}} +\def\gurmurkhinumerals #1{\ctxcommand{alphabetic(\number#1,"gurmurkhi")}} +\def\gujaratinumerals #1{\ctxcommand{alphabetic(\number#1,"gujarati")}} +\def\tibetannumerals #1{\ctxcommand{alphabetic(\number#1,"tibetan")}} +\def\greeknumerals #1{\ctxcommand{alphabetic(\number#1,"greek")}} +\def\Greeknumerals #1{\ctxcommand{Alphabetic(\number#1,"greek")}} +\def\arabicnumerals #1{\ctxcommand{alphabetic(\number#1,"arabic")}} +\def\persiannumerals #1{\ctxcommand{alphabetic(\number#1,"persian")}} -\let\arabicexnumerals \persiannumerals +\let\arabicexnumerals \persiannumerals -\def\koreannumerals #1{\ctxlua{converters.alphabetic(\number#1,"korean")}} -\def\koreannumeralsp#1{\ctxlua{converters.alphabetic(\number#1,"korean-parent")}} -\def\koreannumeralsc#1{\ctxlua{converters.alphabetic(\number#1,"korean-circle")}} +\def\koreannumerals #1{\ctxcommand{alphabetic(\number#1,"korean")}} +\def\koreannumeralsp #1{\ctxcommand{alphabetic(\number#1,"korean-parent")}} +\def\koreannumeralsc #1{\ctxcommand{alphabetic(\number#1,"korean-circle")}} -\def\chinesenumerals #1{\ctxlua{converters.chinesenumerals (\number#1)}} -\def\chinesecapnumerals#1{\ctxlua{converters.chinesecapnumerals(\number#1,"cap")}} -\def\chineseallnumerals#1{\ctxlua{converters.chineseallnumerals(\number#1,"all")}} +\def\chinesenumerals #1{\ctxcommand{chinesenumerals (\number#1)}} +\def\chinesecapnumerals#1{\ctxcommand{chinesecapnumerals(\number#1,"cap")}} +\def\chineseallnumerals#1{\ctxcommand{chineseallnumerals(\number#1,"all")}} %D \macros %D {character,Character} @@ -128,8 +128,8 @@ \def\unknowncharacter{-} % else in lists \relax -\def\character#1{\ctxlua{converters.character (\number#1)}} -\def\Character#1{\ctxlua{converters.Character (\number#1)}} +\def\character#1{\ctxcommand{character(\number#1)}} +\def\Character#1{\ctxcommand{Character(\number#1)}} %D \macros %D {characters,Characters} @@ -141,16 +141,16 @@ %D \showsetup{characters} %D \showsetup{Characters} -\def\characters#1{\ctxlua{converters.characters(\number#1)}} -\def\Characters#1{\ctxlua{converters.Characters(\number#1)}} +\def\characters#1{\ctxcommand{characters(\number#1)}} +\def\Characters#1{\ctxcommand{Characters(\number#1)}} %D \macros %D {greeknumerals,Greeknumerals} %D %D Why should we only honour the romans, and not the greek? -\let\greeknumerals\gobbleoneargument -\let\Greeknumerals\gobbleoneargument +% \let\greeknumerals\gobbleoneargument +% \let\Greeknumerals\gobbleoneargument %D \macros %D {oldstylenumerals,oldstyleromannumerals} @@ -202,17 +202,8 @@ %D %D Anyhow, the conversion looks like: -\def\domonthtag#1% - {\ifcase#1% - \or \v!january \or \v!february \or \v!march \or \v!april - \or \v!may \or \v!june \or \v!july \or \v!august - \or \v!september \or \v!october \or \v!november \or \v!december - \else - \v!unknown - \fi} - -\def\doconvertmonthlong #1{\labeltext{\domonthtag{#1}}} -\def\doconvertmonthshort#1{\labeltext{\domonthtag{#1}:\s!mnem}} +\def\doconvertmonthlong #1{\ctxcommand{month(#1)}} +\def\doconvertmonthshort#1{\ctxcommand{monthmnem(#1)}} \let\doconvertmonth\doconvertmonthlong @@ -225,9 +216,9 @@ \def\monthshort{\doconvertmonthshort} \def\month {\doconvertmonth} -\def\MONTH #1{{\let\labeltext\LABELTEXT\month {#1}}} -\def\MONTHLONG #1{{\let\labeltext\LABELTEXT\monthlong {#1}}} -\def\MONTHSHORT#1{{\let\labeltext\LABELTEXT\monthshort{#1}}} +\def\MONTH #1{{\WORD{\month {#1}}}} +\def\MONTHLONG #1{{\WORD{\monthlong {#1}}}} +\def\MONTHSHORT#1{{\WORD{\monthshort{#1}}}} %D We never explicitly needed this, but Tobias Burnus pointed %D out that it would be handy to convert to the day of the @@ -245,25 +236,18 @@ %D 2000 into leap years, right? Well, converting to string %D looks familiar: -\def\doconvertday#1% - {\labeltext - {\ifcase#1 - \or \v!sunday \or \v!monday \or \v!tuesday \or \v!wednesday - \or \v!thursday \or \v!friday \or \v!saturday \fi}} +\def\doconvertday#1{\ctxcommand{day(#1)}} %D \macros %D {getdayoftheweek, dayoftheweek} -%D -%D The conversion algoritm is an old one and a translation from -%D a procedure written in MODULA~2 back in the 80's. I finaly -%D found the 4--100-400 rules in some enclopedia. Look at this -%D messy low level routine that takes the day, month and year -%D as arguments: \newcount\normalweekday -\def\getdayoftheweek#1#2#3{\normalweekday\ctxlua{converters.weekday(\number#1,\number#2,\number#3)}} -\def\dayoftheweek #1#2#3{\doconvertday{\ctxlua{converters.weekday(\number#1,\number#2,\number#3)}}} +% \def\getdayoftheweek#1#2#3{\normalweekday\ctxcommand{weekday(\number#1,\number#2,\number#3)}} +% \def\dayoftheweek #1#2#3{\doconvertday{\ctxcommand{weekday(\number#1,\number#2,\number#3)}}} + +\def\getdayoftheweek#1#2#3{\normalweekday\ctxcommand{weekday(\number#1,\number#2,\number#3)}\relax} % number +\def\dayoftheweek #1#2#3{\ctxcommand{weekdayname(\number#1,\number#2,\number#3)}} % name %D Using this macro in %D @@ -304,7 +288,7 @@ {\doconvertday} \def\WEEKDAY#1% - {{\let\labeltext\LABELTEXT\doconvertday{#1}}} + {{\WORD{\doconvertday{#1}}}} %D \macros %D {weekoftheday} @@ -337,24 +321,13 @@ %D {\numberofdays}. \def\doifleapyearelse#1% - {\ifcase\ctxlua{converters.leapyear(\number#1)} - \@EA\secondoftwoarguments - \else - \@EA\firstoftwoarguments - \fi} + {\ctxcommand{doifleapyearelse(\number#1)}} \def\getdayspermonth#1#2% - {\edef\numberofdays{\ctxlua{converters.nofdays(\number#1,\number#2)}}} + {\edef\numberofdays{\ctxcommand{nofdays(\number#1,\number#2)}}} \def\dayspermonth#1#2% - {\ctxlua{converters.nofdays(\number#1,\number#2)}} - -% problem is that we calculate with those numbers -% -% \def\time {\numexpr\ctxlua{converters.textime()}\relax} -% \def\year {\numexpr\ctxlua{converters.year ()}\relax} -% \def\month{\numexpr\ctxlua{converters.month ()}\relax} -% \def\day {\numexpr\ctxlua{converters.day ()}\relax} + {\ctxcommand{nofdays(\number#1,\number#2)}} % \dayoftheweek{2006}{9}{15} % \doifleapyearelse{2000}{OK}{NOT OK} @@ -423,86 +396,131 @@ %D \getbuffer %D \stoplines -\def\kenmerkdatumpatroon{j,mm,dd} % jj,mm,dd changed at januari 1-1-2000 - -\newsignal\datesignal - -\def\dobetweendates - {\ifdim\lastskip=\datesignal\relax\else - \unskip\space - \hskip\datesignal\relax - \fi} +% \newtoks \everycurrentdate +% +% \newsignal\datesignal +% +% \def\dobetweendates +% {\ifdim\lastskip=\datesignal\relax\else +% \unskip\space +% \hskip\datesignal\relax +% \fi} +% +% \def\referraldatepattern{j,mm,dd} % jj,mm,dd changed at januari 1-1-2000 +% +% \def\dodobetweendates +% {\let\betweendates\dobetweendates}% +% +% \def\dodocurrentdate#1% +% {\processallactionsinset[#1] +% [ \v!year=>\betweendates +% \convertnumber\v!year\normalyear, +% yy=>\lasttwodigits\normalyear, +% y=>\convertnumber\v!year\normalyear, +% Y=>\number\normalyear, +% \v!month=>\betweendates +% \month\normalmonth, +% mm=>\twodigits\normalmonth, +% m=>\month\normalmonth, +% M=>\number\normalmonth, +% \v!day=>\betweendates +% \convertnumber\v!day\normalday, +% \v!day+=>\betweendates +% \convertnumber\v!day\normalday +% \ordinal\normalday, +% dd=>\twodigits\normalday, +% dd+=>\convertnumber\v!day{\twodigits\normalday}% +% \ordinal\normalday, +% d=>\convertnumber\v!day\normalday, +% d+=>\convertnumber\v!day\normalday +% \ordinal\normalday, +% d=>\number\normalday, +% \v!weekday=>\betweendates +% \convertnumber\v!day{\dayoftheweek\normalday\normalmonth\normalyear}, +% w=>\convertnumber\v!day{\dayoftheweek\normalday\normalmonth\normalyear}, +% W=>\dayoftheweek\normalday\normalmonth\normalyear, +% \v!referral=>\docomplexcurrentdate\referraldatepattern, +% \v!space=>\unskip\ \hskip\datesignal, +% \ =>\unskip\ \hskip\datesignal, +% \s!default=>, +% \s!unknown=>\unskip\commalistelement +% \hskip\datesignal +% \let\betweendates\dodobetweendates]} +% +% \def\docurrentdate[#1]% +% {\begingroup +% \the\everycurrentdate +% \let\betweendates\dodobetweendates +% \doifsomething{#1}{\edef\currentdatespecification{#1}}% +% \normalexpanded{\dodocurrentdate{\currentdatespecification}}% +% \ifdim\lastskip=\datesignal\relax +% \unskip +% \fi +% \endgroup} + +%D \starttabulate[|l|l|] +%D \HL +%D \NC year \NC (\currentdate[year]) \NC\NR +%D \NC yy \NC (\currentdate[yy]) \NC\NR +%D \NC y \NC (\currentdate[y]) \NC\NR +%D \NC Y \NC (\currentdate[Y]) \NC\NR +%D \HL +%D \NC month \NC (\currentdate[month]) \NC\NR +%D \NC mm \NC (\currentdate[mm]) \NC\NR +%D \NC m \NC (\currentdate[m]) \NC\NR +%D \NC M \NC (\currentdate[M]) \NC\NR +%D \HL +%D \NC day \NC (\currentdate[day]) \NC\NR +%D \NC dd \NC (\currentdate[dd]) \NC\NR +%D \NC d \NC (\currentdate[d]) \NC\NR +%D \NC D \NC (\currentdate[D]) \NC\NR +%D \HL +%D \NC weekday \NC (\currentdate[weekday]) \NC\NR +%D \NC w \NC (\currentdate[w]) \NC\NR +%D \NC W \NC (\currentdate[W]) \NC\NR +%D \HL +%D \NC referral \NC (\currentdate[referral]) \NC\NR +%D \HL +%D \NC day+ \NC (\currentdate[day+]) \NC\NR +%D \NC dd+ \NC (\currentdate[dd+]) \NC\NR +%D \NC d+ \NC (\currentdate[d+]) \NC\NR +%D \NC D+ \NC (\currentdate[D+]) \NC\NR +%D \HL +%D \stoptabulate +%D +%D \startbuffer +%D (\currentdate[D,.,M,.,Y]) +%D (\currentdate[day,month,year]) +%D (\currentdate[day,+,month,+,year]) +%D \stopbuffer +%D +%D \typebuffer \getbuffer \newtoks \everycurrentdate -\def\complexcurrentdate[#1]% - {\bgroup +\unexpanded\def\currentdate + {\dosingleempty\docurrentdate} + +\def\docurrentdate[#1]% + {\begingroup \the\everycurrentdate - \def\betweendates{\let\betweendates\dobetweendates}% - % was \processcommacommandp[#1]\docomplexcurrentdate - \safeedef\ascii{\empty#1}% keep encoded chars - \@EA\processcommalist\@EA[\ascii]\docomplexcurrentdate - \ifdim\lastskip=\datesignal\relax - \unskip - \fi - \egroup} + \doifsomething{#1}{\edef\currentdatespecification{#1}}% + \ctxcommand{currentdate(\!!bs\currentdatespecification\!!es,"\labellanguage")}% + \endgroup} -\def\docomplexcurrentdate#1% - {\lowercase{\edef\!!stringa{#1}}% permits usage in \smallcapped - \expanded{\processaction[\!!stringa]}% [#1] - [ \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 - % #1 and not the lowercased \commalistelement, vietnamese has text - % {} because #1 can have comma, like: {\ ,} - {#1}% - \hskip\datesignal - \def\betweendates{\let\betweendates\dobetweendates}]} - -\def\simplecurrentdate - {\expanded{\complexcurrentdate[\currentdatespecification]}} - -\definecomplexorsimple\currentdate +\unexpanded\def\date + {\dodoubleempty\dodate} \def\dodate[#1][#2]% - {\bgroup + {\begingroup \iffirstargument \getparameters[\??da][d=\normalday,m=\normalmonth,y=\normalyear,#1]% \normalday \@@dad\relax \normalmonth\@@dam\relax \normalyear \@@day\relax - \ifsecondargument - \currentdate[#2]% - \else - \currentdate - \fi - \else - \currentdate \fi - \egroup} - -\def\date - {\dodoubleempty\dodate} + \docurrentdate[#2]% + \endgroup} %D \macros %D {currenttime} @@ -511,10 +529,10 @@ %D a pattern similar to the previous date macro using the %D keys \type {h}, \type {m} and a separator. -\def\calculatecurrenttime - {\edef\currenthour {\ctxlua{converters.hour ()}}% - \edef\currentminute{\ctxlua{converters.minute()}}% - \edef\currentsecond{\ctxlua{converters.second()}}} +\unexpanded\def\calculatecurrenttime + {\edef\currenthour {\ctxcommand{hour ()}}% + \edef\currentminute{\ctxcommand{minute()}}% + \edef\currentsecond{\ctxcommand{second()}}} \let\currenthour \!!plusone \let\currentminute\!!plusone @@ -523,8 +541,7 @@ \def\complexcurrenttime[#1]% {\calculatecurrenttime - \processallactionsinset[#1] - [h=>\currenthour,m=>\currentminute,\s!unknown=>\commalistelement]} + \processallactionsinset[#1][h=>\currenthour,m=>\currentminute,\s!unknown=>\commalistelement]} \def\simplecurrenttime {\expanded{\complexcurrenttime[\currenttimespecification]}} @@ -586,83 +603,40 @@ %D \defineconversion [en] [whatever] [\something] %D \stoptyping -% \def\dodefineconversion[#1][#2]% -% {\ConvertConstantAfter\doifinstringelse{,}{#2} -% {\scratchcounter=0 -% \def\docommand##1% -% {\advance\scratchcounter 1 -% \setvalue{\??cv#1\the\scratchcounter}{##1}}% -% \processcommalist[#2]\docommand -% \setvalue{\??cv#1}##1{\csname\??cv#1##1\endcsname}} -% {\setvalue{\??cv#1}{#2}}} -% -% \unexpanded\def\defineconversion% -% {\dodoubleargument\dodefineconversion} - \unexpanded\def\defineconversion {\dotripleempty\dodefineconversion} -\def\dodefineconversion[#1][#2][#3]% +\def\dodefineconversion[#1][#2][#3]% from now on global (maybe local again some day) {\ifthirdargument - \dododefineconversion[#1][#2][#3]% + \dododefineconversion{#1#2}{#1:#2}{#3}% \else - \dododefineconversion[][#1][#2]% + \dododefineconversion{#1}{#1}{#2}% \fi} -%D \starttyping -%D \def\dododefineconversion[#1][#2][#3]% -%D {\ConvertConstantAfter\doifinstringelse{,}{#3} -%D {\scratchcounter\zerocount -%D \def\docommand##1% -%D {\advance\scratchcounter \plusone -%D \setvalue{\??cv#1#2\the\scratchcounter}{##1}}% -%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 - -%D This approach has the disadvantage that when you run out of -%D symbols you get unknown results. The following implementation -%D permits overloading of the converter: - -\def\dododefineconversion[#1][#2][#3]% - {\ConvertConstantAfter\doifinstringelse{,}{#3} - {\scratchcounter\zerocount - \def\docommand##1% - {\advance\scratchcounter \plusone - \setvalue{\??cv#1#2\the\scratchcounter}{##1}}% - \processcommalist[#3]\docommand - \setevalue{\??cv#1#2}##1% - {\noexpand\docheckedconversion{#1#2}{\the\scratchcounter}{##1}}} - {\setvalue{\??cv#1#2}{#3}}} - -\def\docheckedconversion#1#2#3% class maxnumber number - {\executeifdefined{\??cv#1#3}\unknown} - -%D When Gerben reported problems with footnote numbering per page, -%D Taco came with the following wrap around solution. So, let's -%D overload the checked conversion macro: - -\def\docheckedconversion#1#2#3% class maxnumber number - {\executeifdefined{\??cv#1\modulatednumber{#2}{#3}}\unknown} +\def\dododefineconversion#1#2#3% + {\doifinstringelse{,}{\detokenize{#3}} + {\ctxcommand{defineconversion("#2",\!!bs\detokenize{#3}\!!es)}% + \setgvalue{\??cv#1}{\checkedconversion{#2}}} + {\setgvalue{\??cv#1}{#3}}} -%D Taco's modulo code is implemented in the system module -%D \type {syst-con}. +\def\checkedconversion#1#2% + {\ctxcommand{checkedconversion("#1",#2)}} %D If a conversion is just a font switch then we need to make sure %D that the number is indeed end up as number in the input, so we %D need to handle the second argument. \def\convertnumber#1#2% - {\csname\??cv - \ifcsname\??cv\currentlanguage#1\endcsname - \currentlanguage#1% - \else\ifcsname\??cv#1\endcsname - #1% - \else - \s!default - \fi\fi - \endcsname{\number#2}} + {\csname + \??cv=>% we want a fully expandable (no if interference) + \ifcsname\??cv\currentlanguage#1\endcsname1\else + \ifcsname\??cv #1\endcsname2\else + 3\fi\fi + \endcsname{#1}{\number#2}} + +\setvalue{\??cv=>1}#1{\csname\??cv\currentlanguage#1\endcsname} +\setvalue{\??cv=>2}#1{\csname\??cv #1\endcsname} +\letvalue{\??cv=>3}\checkedconversion \def\doifconversiondefinedelse#1% {\ifcsname\??cv\currentlanguage#1\endcsname @@ -697,14 +671,9 @@ %D difficult to implement. Fortunately dates never exceed the %D number~31. -\ifx\high \undefined \let\high \firstofoneargument \fi -\ifx\notsmallcapped\undefined \let\notsmallcapped\firstofoneargument \fi - -\def\highordinalstr#1{\high{\notsmallcapped{#1}}} -\def\ordinalstr #1{\notsmallcapped{#1}} - -\def\ordinaldaynumber#1% \strippedcsname\ordinaldaynumber - {\expanded{\executeifdefined{\currentlanguage ordinaldaynumber}\noexpand\firstofoneargument{\number#1}}} +\def\highordinalstr #1{\high{\notsmallcapped{#1}}} +\def\ordinalstr #1{\notsmallcapped{#1}} +\def\ordinaldaynumber #1{\ctxcommand{ordinal(#1,"\currentlanguage"}} %D As longs as symbols are linked to levels or numbers, we can %D also use the conversion mechanism, but in for instance the @@ -734,6 +703,7 @@ \defineconversion [AK] [\smallcappedcharacters] \defineconversion [KA] [\smallcappedcharacters] +\defineconversion [\v!number] [\numbers] \defineconversion [\v!numbers] [\numbers] \defineconversion [\v!Numbers] [\Numbers] \defineconversion [\v!mediaeval] [\mediaeval] @@ -762,9 +732,6 @@ \defineconversion [g] [\greeknumerals] \defineconversion [G] [\Greeknumerals] -\defineconversion [arabicnumerals] [\arabicnumerals] -\defineconversion [persiannumerals] [\persiannumerals] - \defineconversion [abjadnumerals] [\abjadnumerals] \defineconversion [abjadnodotnumerals] [\adjadnodotnumerals] \defineconversion [abjadnaivenumerals] [\adjadnaivenumerals] @@ -857,4 +824,17 @@ \mathematics{\ast\ast}, \mathematics{\ast\ast\ast}] +%D Iteration of suggestion by WS on mailinglist 2010.12.22: +%D +%D \starttyping +%D \setupfloatsplitting[conversion=continued] +%D \stoptyping + +\unexpanded\def\continuednumber#1% + {\labeltext{\ifcase#1\or\else\v!continued\fi}} + +\defineconversion + [\v!continued] + [\continuednumber] + \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/core-ctx.lua b/Master/texmf-dist/tex/context/base/core-ctx.lua index 1dad7c2d73a..e6fb7bb5fd8 100644 --- a/Master/texmf-dist/tex/context/base/core-ctx.lua +++ b/Master/texmf-dist/tex/context/base/core-ctx.lua @@ -6,9 +6,12 @@ if not modules then modules = { } end modules ['core-ctx'] = { license = "see context related readme files" } -local trace_prepfiles = false trackers.register("resolvers.prepfiles", function(v) trace_prepfiles = v end) +local trace_prepfiles = false trackers.register("system.prepfiles", function(v) trace_prepfiles = v end) -commands = commands or { } +local report_prepfiles = logs.reporter("system","prepfiles") + +commands = commands or { } +local commands = commands local list, suffix, islocal, found = { }, "prep", false, false @@ -20,9 +23,9 @@ function commands.loadctxpreplist() islocal = xml.found(x,"ctx:preplist[@local=='yes']") --~ if trace_prepfiles then if islocal then - commands.writestatus("systems","loading ctx log file (local)") -- todo: m!systems + report_prepfiles("loading ctx log file (local)") -- todo: m!system else - commands.writestatus("systems","loading ctx log file (specified)") -- todo: m!systems + report_prepfiles("loading ctx log file (specified)") -- todo: m!system end --~ end for e in xml.collected(x,"ctx:prepfile") do @@ -32,7 +35,7 @@ function commands.loadctxpreplist() end local done = e.at['done'] or 'no' if trace_prepfiles then - commands.writestatus("systems","registering %s -> %s",done) + report_prepfiles("registering %s -> %s",done) end found = true list[name] = done -- 'yes' or 'no' @@ -47,7 +50,7 @@ local function found(name) -- used in resolve local prepname = name .. "." .. suffix if list[name] and lfs.isfile(prepname) then if trace_prepfiles then - commands.writestatus("systems", "preprocessing: using %s",prepname) + report_prepfiles("preprocessing: using %s",prepname) end return prepname end @@ -55,7 +58,7 @@ local function found(name) -- used in resolve end local function resolve(name) -- used a few times later on - local filename = file.collapse_path(name) + local filename = file.collapsepath(name) local prepname = islocal and found(file.basename(name)) if prepname then return prepname diff --git a/Master/texmf-dist/tex/context/base/core-ctx.mkiv b/Master/texmf-dist/tex/context/base/core-ctx.mkiv index 9bf4569520b..f6e5a33f1be 100644 --- a/Master/texmf-dist/tex/context/base/core-ctx.mkiv +++ b/Master/texmf-dist/tex/context/base/core-ctx.mkiv @@ -15,14 +15,14 @@ \unprotect -\chardef\preprocessmethod \plustwo % always check in mkiv +\setnewconstant\preprocessmethod\plustwo % always check in mkiv \registerctxluafile{core-ctx}{1.000} -\def\loadctxpreplist{\ctxlua{commands.loadctxpreplist()}\global\let\loadctxpreplist\relax} +\def\loadctxpreplist{\ctxcommand{loadctxpreplist()}\global\let\loadctxpreplist\relax} % \prependtoks\loadctxpreplist\to\everyjob -\appendtoks\loadctxpreplist\to\everystarttext +\appendtoks\loadctxpreplist\to\everystarttext % maybe too late but don't change it now \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/core-def.mkii b/Master/texmf-dist/tex/context/base/core-def.mkii index 840f853a763..ff7283356c1 100644 --- a/Master/texmf-dist/tex/context/base/core-def.mkii +++ b/Master/texmf-dist/tex/context/base/core-def.mkii @@ -91,7 +91,7 @@ \def\synctexwarning {\ifdefined\synctex \ifnum\synctex=\zerocount \else \writeline - \writestatus\m!systems{BEWARE: syntex functionality is enabled!}% + \writestatus\m!systems{BEWARE: synctex functionality is enabled!}% \writeline \globallet\synctexwarning\relax \fi \fi} diff --git a/Master/texmf-dist/tex/context/base/core-def.mkiv b/Master/texmf-dist/tex/context/base/core-def.mkiv index 59451a9141e..59c2c89c1e3 100644 --- a/Master/texmf-dist/tex/context/base/core-def.mkiv +++ b/Master/texmf-dist/tex/context/base/core-def.mkiv @@ -18,7 +18,7 @@ \unprotect -\usesymbols[mis,mvs,nav] +\usesymbols[mis,nav] % no longer mvs preloaded \setupsymbolset[navigation 1] @@ -26,15 +26,19 @@ % initialization order: +\ifdefined\firststagepreloadfonts \else \let\firststagepreloadfonts \relax \fi +\ifdefined\secondstagepreloadfonts \else \let\secondstagepreloadfonts\relax \fi +\ifdefined\thirdstagepreloadfonts \else \let\thirdstagepreloadfonts \relax \fi +\ifdefined\fourthstagepreloadfonts \else \let\fourthstagepreloadfonts\relax \fi + +%prependtoks \preloadtypescript \to \everyjob \appendtoks \showcontextbanner \to \everyjob \appendtoks \initializenewlinechar \to \everyjob \appendtoks \calculatecurrenttime \to \everyjob \appendtoks \loadsystemfiles \to \everyjob \appendtoks \loadoptionfile \to \everyjob % can load files ! -\appendtoks \preloadfonts \to \everyjob +\appendtoks \firststagepreloadfonts \to \everyjob \appendtoks \settopskip \to \everyjob -\appendtoks \preloadlanguages \to \everyjob -\appendtoks \preloadspecials \to \everyjob \appendtoks \initializeMPgraphics \to \everyjob % after loading system files \appendtoks \initializemainlanguage \to \everyjob %appendtoks \MPLIBregister \to \everyjob @@ -58,6 +62,9 @@ \prependtoks \lefttoright \to \everybeforeoutput +\appendtoks \secondstagepreloadfonts \to \everystarttext +\appendtoks \fourthstagepreloadfonts \to \everystoptext + % temporary here: \ifdefined\in \let\normalmathin \in \unexpanded\def\in {\mathortext\normalmathin \dospecialin } \else \let\in \dospecialin \fi @@ -68,6 +75,12 @@ \unexpanded\def\arg{\mathortext\normalmatharg\normaltextarg} +% for the moment here + +\enablemode[*nofonts] + +\nonknuthmode + % brrr \appendtoks @@ -79,16 +92,4 @@ \synchronizelocallinespecs \to \everyswitchtobodyfont -\def\synctexwarning - {\ifdefined\synctex \ifnum\synctex=\zerocount \else - \writeline - \writestatus\m!systems{BEWARE: synctex functionality is enabled!}% - \writeline - \globallet\synctexwarning\relax - \fi \fi} - -\prependtoks \synctexwarning \to \everyjob -\prependtoks \synctexwarning \to \everystarttext -\appendtoks \synctexwarning \to \everystoptext - \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/core-env.lua b/Master/texmf-dist/tex/context/base/core-env.lua new file mode 100644 index 00000000000..694b2f07c42 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/core-env.lua @@ -0,0 +1,101 @@ +if not modules then modules = { } end modules ['core-env'] = { + version = 1.001, + comment = "companion to core-env.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- maybe this will move to the context name space although the +-- plurals are unlikely to clash with future tex primitives +-- +-- if tex.modes['xxxx'] then .... else .... end + +local P, C, S, Cc, lpegmatch, patterns = lpeg.P, lpeg.C, lpeg.S, lpeg.Cc, lpeg.match, lpeg.patterns + +local csname_id = token.csname_id +local texcount = tex.count +local create = token.create + +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex + +local undefined = csname_id("*undefined*crap*") +local iftrue = create("iftrue")[2] -- inefficient hack + +tex.modes = allocate { } +tex.systemmodes = allocate { } +tex.constants = allocate { } +tex.conditionals = allocate { } +tex.ifs = allocate { } + +local modes = { } +local systemmodes = { } + +setmetatableindex(tex.modes, function(t,k) + local m = modes[k] + if m then + return m() + else + local n = "mode" .. k + if csname_id(n) == undefined then + return false + else + modes[k] = function() return texcount[n] >= 1 end + return texcount[n] >= 1 + end + end +end) + +setmetatableindex(tex.systemmodes, function(t,k) + local m = systemmodes[k] + if m then + return m() + else + local n = "mode*" .. k + if csname_id(n) == undefined then + return false + else + systemmodes[k] = function() return texcount[n] >= 1 end + return texcount[n] >= 1 + end + end +end) + +setmetatableindex(tex.constants, function(t,k) + return csname_id(k) ~= undefined and texcount[k] or 0 +end) + +setmetatableindex(tex.conditionals, function(t,k) -- 0 == true + return csname_id(k) ~= undefined and texcount[k] == 0 +end) + +setmetatableindex(tex.ifs, function(t,k) + return csname_id(k) ~= undefined and create(k)[2] == iftrue -- inefficient, this create, we need a helper +end) + +function tex.settrue(name) + texcount[name] = 0 +end + +function tex.setfalse(name) + texcount[name] = 1 +end + +---- arg = P("{") * C(patterns.nested) * P("}") + Cc("") + +local sep = S("), ") +local str = C((1-sep)^1) +local tag = P("(") * C((1-S(")" ))^1) * P(")") +local arg = P("(") * C((1-S("){"))^1) * P("{") * C((1-P("}"))^0) * P("}") * P(")") + +local pattern = ( + P("lua") * tag / context.luasetup + + P("xml") * arg / context.setupwithargument -- or xmlw as xmlsetup has swapped arguments + + (P("tex") * tag + str) / context.texsetup + + sep^1 +)^1 + +function commands.autosetups(str) + lpegmatch(pattern,str) +end diff --git a/Master/texmf-dist/tex/context/base/core-env.mkiv b/Master/texmf-dist/tex/context/base/core-env.mkiv index d927ff3ad50..2451b59501a 100644 --- a/Master/texmf-dist/tex/context/base/core-env.mkiv +++ b/Master/texmf-dist/tex/context/base/core-env.mkiv @@ -13,6 +13,8 @@ \writestatus{loading}{ConTeXt Core Macros / Environments} +\registerctxluafile{core-env}{1.001} + \unprotect %D Modes: @@ -39,68 +41,109 @@ %D considered a permanent disabling on forehand. \def\@mode@{@md@} +\def\@mode@{mode} \def\systemmodeprefix{*} -\def\disabledmode {0} % no chardefs -\def\enabledmode {1} -\def\preventedmode{2} +% todo: check prevent mode, also at the lua end + +\setnewconstant\disabledmode \zerocount +\setnewconstant\enabledmode \plusone +\setnewconstant\preventedmode\plustwo % fast internal ones -\def\setmode #1{\@EA\let\csname\@mode@#1\endcsname\enabledmode } -\def\resetmode#1{\@EA\let\csname\@mode@#1\endcsname\disabledmode} +\def\donewmode#1% + {\@EA\newcount\csname\@mode@#1\endcsname} + +\def\newmode#1% + {\ifcsname\@mode@#1\endcsname\else\donewmode{#1}\fi} + +\def\setmode#1% + {\ifcsname\@mode@#1\endcsname\else\donewmode{#1}\fi + \csname\@mode@#1\endcsname\enabledmode} + +\def\resetmode#1% + {\ifcsname\@mode@#1\endcsname\else\donewmode{#1}\fi + \csname\@mode@#1\endcsname\disabledmode} + +\def\newsystemmode#1% + {\ifcsname\@mode@\systemmodeprefix#1\endcsname\else\donewmode{\systemmodeprefix#1}\fi} + +\def\setsystemmode#1% + {\ifcsname\@mode@\systemmodeprefix#1\endcsname\else\donewmode{\systemmodeprefix#1}\fi + \csname\@mode@\systemmodeprefix#1\endcsname\enabledmode} + +\def\resetsystemmode#1% + {\ifcsname\@mode@\systemmodeprefix#1\endcsname\else\donewmode{\systemmodeprefix#1}\fi + \csname\@mode@\systemmodeprefix#1\endcsname\disabledmode} + +% \def\dosetsystemmode#1% +% {\csname\@mode@\systemmodeprefix#1\endcsname\enabledmode} +% +% \def\doresetsystemmode#1% +% {\csname\@mode@\systemmodeprefix#1\endcsname\disabledmode} + +% demo: trialtypesetting is a systemmode as well as an if + +\newsystemmode{trialtypesetting} + +\expandafter\let\expandafter\@@trialtypesetting\csname\@mode@\systemmodeprefix trialtypesetting\endcsname % private ! -\def\setsystemmode #1{\@EA\let\csname\@mode@\systemmodeprefix#1\endcsname\enabledmode } -\def\resetsystemmode#1{\@EA\let\csname\@mode@\systemmodeprefix#1\endcsname\disabledmode} +\appendtoks + \@@trialtypesetting\enabledmode +\to \everysettrialtypesetting + +\appendtoks + \@@trialtypesetting\disabledmode +\to \everyresettrialtypesetting % user ones -\def\preventmode{\unprotect\dopreventmode} -\def\enablemode {\unprotect\doenablemode } -\def\disablemode{\unprotect\dodisablemode} +\unexpanded\def\preventmode{\unprotect\dopreventmode} +\unexpanded\def\enablemode {\unprotect\doenablemode } +\unexpanded\def\disablemode{\unprotect\dodisablemode} + +\let\definemode\disablemode % nicer \def\dopreventmode[#1]{\protect\rawprocesscommacommand[#1]\dodopreventmode} \def\doenablemode [#1]{\protect\rawprocesscommacommand[#1]\dodoenablemode } \def\dodisablemode[#1]{\protect\rawprocesscommacommand[#1]\dododisablemode} \def\dodopreventmode#1% - {\@EA\let\csname\@mode@#1\endcsname\preventedmode} + {\ifcsname\@mode@#1\endcsname\else\donewmode{#1}\fi + \csname\@mode@#1\endcsname\preventedmode} -\def\dodoenablemode#1% mode can be relax - {\ifcase0\csname\@mode@#1\endcsname\relax - \@EA\let\csname\@mode@#1\endcsname\enabledmode +\def\dodoenablemode#1% we can speed it up by moving the new outside + {\ifcsname\@mode@#1\endcsname\else\donewmode{#1}\fi + \ifnum\csname\@mode@#1\endcsname=\preventedmode \else + \csname\@mode@#1\endcsname\enabledmode \fi} \def\dododisablemode#1% - {\ifcase0\csname\@mode@#1\endcsname\or - \@EA\let\csname\@mode@#1\endcsname\disabledmode + {\ifcsname\@mode@#1\endcsname\else\donewmode{#1}\fi + \ifnum\csname\@mode@#1\endcsname=\preventedmode \else + \csname\@mode@#1\endcsname\disabledmode \fi} % handy for mp -\def\booleanmodevalue#1% can be \relax - {\expandafter\ifx\csname\@mode@#1\endcsname\relax - fals% - \else\ifnum0\csname\@mode@#1\endcsname=0 - fals% - \else - tru% - \fi\fi e} +\def\booleanmodevalue#1% + {\ifcsname\@mode@#1\endcsname\ifcase\csname\@mode@#1\endcsname fals\else tru\fi\else fals\fi e} % check macros \newif\ifcheckedmode \def\dodocheckformode#1% - {\ifcase0\csname\@mode@#1\endcsname\or\checkedmodetrue\fi} + {\ifcsname\@mode@#1\endcsname\ifcase\csname\@mode@#1\endcsname\else\checkedmodetrue\fi\fi} \def\docheckformode#1#2#3% will be sped up with a quit {\protect\checkedmodefalse\rawprocesscommacommand[#3]\dodocheckformode \ifcheckedmode\@EA#1\else\@EA#2\fi} \def\dodocheckforallmodes#1% - {\ifcase0\csname\@mode@#1\endcsname\relax\checkedmodefalse\or\or\checkedmodefalse\fi} + {\ifcsname\@mode@#1\endcsname\ifcase\csname\@mode@#1\endcsname\checkedmodefalse\fi\else\checkedmodefalse\fi} \def\docheckforallmodes#1#2#3% will be sped up with a quit {\protect\checkedmodetrue\rawprocesscommacommand[#3]\dodocheckforallmodes @@ -164,14 +207,14 @@ %D Lets now set a mode: -\enablemode[mkiv] \setsystemmode{mkiv} +\enablemode[mkiv] \newsystemmode{mkiv} \setsystemmode{mkiv} %D Setups: \unexpanded\def\startsetups{} % to please dep checker \unexpanded\def\stopsetups {} % to please dep checker -\expanded +\expanded % will become obsolete {\long\def\@EA\noexpand\csname\e!start\v!setups\endcsname {\begingroup\noexpand\doifnextoptionalelse {\noexpand\dostartsetupsA\@EA\noexpand\csname\e!stop\v!setups\endcsname} @@ -197,6 +240,15 @@ \fi \endcsname\empty} % takes one argument +% We can consider: +% +% \setvalue{\??su->\v!auto}#1{\ctxcommand{autosetup("#1")}} +% +% ":\letterpercent" => "->\v!auto" with "\endcsname{#1}" +% +% but it won't work out well with multiple setups (intercepted at the +% lua end) that then get only one argument. + % the next one is meant for \c!setups situations, hence the check for % a shortcut @@ -206,47 +258,136 @@ \dodoprocesslocalsetups \fi} +% \def\dodoprocesslocalsetups +% {\@EA\processcommalist\@EA[\tobeprocessedsetups]\dosetups} + +% setups=S1 +% setups=lua(S2) +% setups=S3 +% setups={S1,lua(S2),xml(test{123}),S3} + \def\dodoprocesslocalsetups - {\@EA\processcommalist\@EA[\tobeprocessedsetups]\dosetups} + {\ctxcommand{autosetups("\tobeprocessedsetups")}} + +\def\autosetups#1% + {\ctxcommand{autosetups("#1")}} \edef\setupwithargument#1% saves a few expansions {\noexpand\csname\??su:\noexpand\ifcsname\??su:#1\endcsname#1\noexpand\else\letterpercent\noexpand\fi\endcsname} \let\directsetup\dosetups +\let\texsetup \dosetups % nicer than \directsetup and more en par with xmlsetup and luasetup \def\doifsetupselse#1% to be done: grid - {\doifdefinedelse{\??su:#1}} - -\chardef\setupseolmode\plusone - -\unexpanded\def\startsetups {\xxstartsetups\plusone \stopsetups } \let\stopsetups \relax -\unexpanded\def\startlocalsetups{\xxstartsetups\plusone \stoplocalsetups} \let\stoplocalsetups\relax -\unexpanded\def\startrawsetups {\xxstartsetups\zerocount\stoprawsetups } \let\stoprawsetups \relax -\unexpanded\def\startxmlsetups {\xxstartsetups\plustwo \stopxmlsetups } \let\stopxmlsetups \relax - -\def\xxstartsetups#1#2% - {\begingroup\let\setupseolmode#1\doifnextoptionalelse{\dostartsetupsA#2}{\dostartsetupsB#2}} - -\def\dostartsetupsA#1% [ ] delimited - {\ifcase\setupseolmode\or\catcode`\^^M\@@ignore\or\catcode`\^^M\@@ignore\catcode`\|\@@other\fi - \dotripleempty\dostartsetups[#1]} - -\def\dostartsetupsB#1#2 % space delimited - {\ifcase\setupseolmode\or\catcode`\^^M\@@ignore\or\catcode`\^^M\@@ignore\catcode`\|\@@other\fi - \dodostartsetups#1\empty{#2}} - -\def\dostartsetupsC[#1][#2][#3]{\dodostartsetups#1{#2}{#3}} % [..] [..] -\def\dostartsetupsD[#1][#2][#3]{\dodostartsetups#1\empty{#2}} % [..] - -\def\dostartsetups - {\ifthirdargument\@EA\dostartsetupsC\else\@EA\dostartsetupsD\fi} + {\doifdefinedelse{\??su:#1}} % doto: ifcsname -\long\def\dodostartsetups#1#2#3% - {\long\def\dododostartsetups##1#1% - {\endgroup - \dodoglobal % bah - \long\expandafter\def\csname\??su#2:#3\expandafter\endcsname\expandafter####\expandafter1\expandafter{##1}}% - \dododostartsetups\empty} % the empty trick prevents the { } in {arg} from being eaten up +% \startluasetups oeps +% tex.print("DONE") +% a = 1 +% b = 1 +% \stopluasetups +% +% \luasetup{oeps} +% +% \startsetups xxx +% ziezo +% \stopsetups +% +% \directsetup{xxx} +% +% \startxmlsetups zzz +% [[#1]] +% \stopxmlsetups +% +% \xmlsetup{123}{zzz} +% +% \startbuffer[what] +% tex.print("DONE") +% \stopbuffer +% +% \startbuffer +% tex.print("MORE") +% \stopbuffer +% +% \ctxluabuffer[what] +% +% \ctxluabuffer + +\newtoks\everydefinesetups \appendtoks + \catcode\endoflineasciicode \ignorecatcode +\to \everydefinesetups + +\newtoks\everydefinelocalsetups \appendtoks + \catcode\endoflineasciicode \ignorecatcode +\to \everydefinelocalsetups + +\newtoks\everydefinerawsetups \appendtoks + % nothing +\to \everydefinerawsetups + +\newtoks\everydefinexmlsetups \appendtoks + \catcode\endoflineasciicode\ignorecatcode + \catcode\barasciicode \othercatcode +\to \everydefinexmlsetups + +\newtoks\everydefineluasetups \appendtoks + \obeylualines + \obeyluatokens +\to \everydefineluasetups + +\unexpanded\def\startluasetups {\begingroup\doifnextoptionalelse\dostartluasetupsA \dostartluasetupsB } +\unexpanded\def\startxmlsetups {\begingroup\doifnextoptionalelse\dostartxmlsetupsA \dostartxmlsetupsB } +\unexpanded\def\startrawsetups {\begingroup\doifnextoptionalelse\dostartrawsetupsA \dostartrawsetupsB } +\unexpanded\def\startlocalsetups{\begingroup\doifnextoptionalelse\dostartlocalsetupsA\dostartlocalsetupsB} +\unexpanded\def\startsetups {\begingroup\doifnextoptionalelse\dostartsetupsA \dostartsetupsB } + +\let\stopluasetups \relax +\let\stopxmlsetups \relax +\let\stoprawsetups \relax +\let\stoplocalsetups \relax +\let\stopsetups \relax + +\def\dodostartluasetups #1#2#3\stopluasetups {\endgroup\dodoglobal\long\@EA\def\csname\??su#1:#2\@EA\endcsname\@EA##\@EA1\@EA{#3}} +\def\dodostartxmlsetups #1#2#3\stopxmlsetups {\endgroup\dodoglobal\long\@EA\def\csname\??su#1:#2\@EA\endcsname\@EA##\@EA1\@EA{#3}} +\def\dodostartrawsetups #1#2#3\stoprawsetups {\endgroup\dodoglobal\long\@EA\def\csname\??su#1:#2\@EA\endcsname\@EA##\@EA1\@EA{#3}} +\def\dodostartlocalsetups #1#2#3\stoplocalsetups{\endgroup\dodoglobal\long\@EA\def\csname\??su#1:#2\@EA\endcsname\@EA##\@EA1\@EA{#3}} +\def\dodostartsetups #1#2#3\stopsetups {\endgroup\dodoglobal\long\@EA\def\csname\??su#1:#2\@EA\endcsname\@EA##\@EA1\@EA{#3}} + +\def\dostartluasetups {\ifsecondargument\@EA\dostartluasetupsC \else\@EA\dostartluasetupsD \fi} +\def\dostartxmlsetups {\ifsecondargument\@EA\dostartxmlsetupsC \else\@EA\dostartxmlsetupsD \fi} +\def\dostartrawsetups {\ifsecondargument\@EA\dostartrawsetupsC \else\@EA\dostartrawsetupsD \fi} +\def\dostartlocalsetups {\ifsecondargument\@EA\dostartlocalsetupsC\else\@EA\dostartlocalsetupsD\fi} +\def\dostartsetups {\ifsecondargument\@EA\dostartsetupsC \else\@EA\dostartsetupsD \fi} + +\def\dostartluasetupsA {\the\everydefineluasetups \dodoubleempty\dostartluasetups} % [ ] delimited +\def\dostartxmlsetupsA {\the\everydefinexmlsetups \dodoubleempty\dostartxmlsetups} % [ ] delimited +\def\dostartrawsetupsA {\the\everydefinerawsetups \dodoubleempty\dostartrawsetups} % [ ] delimited +\def\dostartlocalsetupsA {\the\everydefinelocalsetups\dodoubleempty\dostartlocalsetups} % [ ] delimited +\def\dostartsetupsA {\the\everydefinesetups \dodoubleempty\dostartsetups} % [ ] delimited + +% empty preserves inner {} (is removed by the \@EA{#3}) + +\def\dostartluasetupsB #1 {\the\everydefineluasetups \dodostartluasetups \empty{#1}\empty} % space delimited +\def\dostartxmlsetupsB #1 {\the\everydefinexmlsetups \dodostartxmlsetups \empty{#1}\empty} % space delimited +\def\dostartrawsetupsB #1 {\the\everydefinerawsetups \dodostartrawsetups \empty{#1}\empty} % space delimited +\def\dostartlocalsetupsB #1 {\the\everydefinelocalsetups\dodostartlocalsetups\empty{#1}\empty} % space delimited +\def\dostartsetupsB #1 {\the\everydefinesetups \dodostartsetups \empty{#1}\empty} % space delimited + +\def\dostartluasetupsC [#1][#2]{\the\everydefineluasetups \dodostartluasetups {#1}{#2}\empty} % [..] [..] +\def\dostartxmlsetupsC [#1][#2]{\the\everydefinexmlsetups \dodostartxmlsetups {#1}{#2}\empty} % [..] [..] +\def\dostartrawsetupsC [#1][#2]{\the\everydefinerawsetups \dodostartrawsetups {#1}{#2}\empty} % [..] [..] +\def\dostartlocalsetupsC[#1][#2]{\the\everydefinelocalsetups\dodostartlocalsetups{#1}{#2}\empty} % [..] [..] +\def\dostartsetupsC [#1][#2]{\the\everydefinesetups \dodostartsetups {#1}{#2}\empty} % [..] [..] + +\def\dostartluasetupsD [#1][#2]{\the\everydefineluasetups \dodostartluasetups \empty{#1}\empty} % [..] +\def\dostartxmlsetupsD [#1][#2]{\the\everydefinexmlsetups \dodostartxmlsetups \empty{#1}\empty} % [..] +\def\dostartrawsetupsD [#1][#2]{\the\everydefinerawsetups \dodostartrawsetups \empty{#1}\empty} % [..] +\def\dostartlocalsetupsD[#1][#2]{\the\everydefinelocalsetups\dodostartlocalsetups\empty{#1}\empty} % [..] +\def\dostartsetupsD [#1][#2]{\the\everydefinesetups \dodostartsetups \empty{#1}\empty} % [..] + +\def\luasetup#1{\ctxlua{\dosetups{#1}}} + +% % % % \def\systemsetupsprefix{*} diff --git a/Master/texmf-dist/tex/context/base/core-fil.mkii b/Master/texmf-dist/tex/context/base/core-fil.mkii index fca253a7b0c..0355920c778 100644 --- a/Master/texmf-dist/tex/context/base/core-fil.mkii +++ b/Master/texmf-dist/tex/context/base/core-fil.mkii @@ -128,6 +128,12 @@ %D More information on the specific modules can be found in %D their dedicated manuals. We use \type {\next} so that we %D can \type {\end} in modules. +%D +%D In \MKIV\ we load the \type {mkiv} file when there is a \type +%D {tex} file on the same path but in \MKII\ we start with the \type +%D {tex} file as in many cases a \type {mkii} will be the same as an +%D (old) \type {tex} one simply because we don't update drastically +%D (or load a mark file indirectly). \newconditional\moduleisloaded @@ -318,7 +324,7 @@ \startreadingfile \startnointerference % \bgroup \cleanupfeatures % better \setnormalcatcodes / test first - \readfile{#2}\donothing\donothing + \readfile{#2.\mksuffix}\donothing\donothing \stopnointerference % \egroup \stopreadingfile \doglobal\setflag{#2}}% diff --git a/Master/texmf-dist/tex/context/base/core-fil.mkiv b/Master/texmf-dist/tex/context/base/core-fil.mkiv index daef176d2b0..263030a9b75 100644 --- a/Master/texmf-dist/tex/context/base/core-fil.mkiv +++ b/Master/texmf-dist/tex/context/base/core-fil.mkiv @@ -75,31 +75,9 @@ %D %D The implementation shows that nesting is supported. -\def\truefilename#1% +\def\truefilename#1% this will move to lua {\ifcsname\??fs#1\endcsname\expandafter\truefilename\csname\??fs#1\endcsname\else#1\fi} -%D \macros -%D {makeshortfilename} -%D -%D To prevent cross platform problems with filenames, we -%D lowercase them as well as only use the first 8~characters. -%D -%D \starttyping -%D \def\domakeshortfilename[#1#2#3#4#5#6#7#8#9]% -%D {\lowercase{\edef\shortfilename{#1#2#3#4#5#6#7#8.}}% -%D \expandafter\beforesplitstring\shortfilename\at.\to\shortfilename} -%D -%D \def\makeshortfilename[#1]% -%D {\edef\fullfilename{#1.........}% -%D \expanded{\domakeshortfilename[\fullfilename]}} -%D \stoptyping -%D -%D In 2005 there is no need for the 8~character limit any more, so: - -\def\makeshortfilename[#1]% no need for further cleanup and shortening - {\lowercase{\edef\shortfilename{#1.}}% - \expandafter\beforesplitstring\shortfilename\at.\to\shortfilename} - %D \macros %D {usemodule} %D @@ -115,7 +93,7 @@ %D can \type {\end} in modules. \def\dodousemodules#1#2% - {\ctxlua{support.usemodules("#1","#2","\truefilename{#2}")}} + {\ctxcommand{usemodules("#1","#2","\truefilename{#2}")}} \def\usemodules {\dotripleempty\dousemodules} @@ -175,8 +153,8 @@ \fi \let\currentmoduleparameters\empty} -\def\moduleparameter #1#2{\executeifdefined{\??md:#1:#2}\s!empty} -\def\currentmoduleparameter#1{\executeifdefined{\??md:\currentmodule:#1}\s!empty} +\def\moduleparameter #1#2{\executeifdefined{\??md:#1:#2}{}} +\def\currentmoduleparameter#1{\executeifdefined{\??md:\currentmodule:#1}{}} \def\useluamodule [#1]{\ctxlua{dofile(resolvers.findctxfile("#1"))}} \def\luaenvironment #1 {\ctxlua{dofile(resolvers.findctxfile("#1"))}} @@ -215,28 +193,7 @@ %D We also support a singular call, which saves us for %D frustrations when we do a typo. -\let\usemodule=\usemodules - -% %D The definition shows that the language specific settings -% %D are activated after loading all the modules specified. - -%D \macros -%D {ifprotectbuffers, bufferprefix, -%D TEXbufferfile, MPgraphicfile} -%D -%D The next switch enables protection of temporary filenames, -%D which is needed when we process more files on one path at -%D the same time. - -\newif\ifprotectbuffers - -\def\bufferprefix{\ifprotectbuffers\jobname-\fi} - -% The following filenames are defined here: - -\def\TEXbufferfile #1{\bufferprefix#1.\f!temporaryextension} -\def\MPgraphicfile {\bufferprefix mp\ifMPrun run\else graph\fi} % not needed in luatex -\def\convertMPcolorfile{\bufferprefix metacmyk.tmp} +\let\usemodule\usemodules %D To save memory, we implement some seldomly used commands %D in a lazy way. Nota bene: such runtime definitions are @@ -255,13 +212,13 @@ \startreadingfile \startnointerference % \bgroup \cleanupfeatures % better \setnormalcatcodes / test first - \readfile{#2}\donothing\donothing + \readfile{#2.\mksuffix}\donothing\donothing \stopnointerference % \egroup \stopreadingfile \doglobal\setflag{#2}}% \ifx#1\undefined - \writestatus\m!systems{command \string#1 not found in file #2}% - \def#1{{\infofont[unknown command \string#1]}}% + \writestatus\m!system{command \string#1 not found in file #2}% + \gdef#1{{\infofont[unknown command \string#1]}}% \fi #1} @@ -281,4 +238,6 @@ %D This module will be perfected / changed / weeded. +\let\protectbufferstrue\relax % will go away ... now in cont-sys.tex + \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/core-fnt.mkiv b/Master/texmf-dist/tex/context/base/core-fnt.mkiv index a7c84a5a093..90dd9349649 100644 --- a/Master/texmf-dist/tex/context/base/core-fnt.mkiv +++ b/Master/texmf-dist/tex/context/base/core-fnt.mkiv @@ -26,16 +26,19 @@ %D so test\compound{}test can be used instead of test||test %D \stoptyping -\bgroup \catcode`\|=\@@active \gdef\compound#1{|#1|} \egroup +\bgroup \catcode\barasciicode\activecatcode \gdef\compound#1{|#1|} \egroup %D Here we hook some code into the clean up mechanism needed %D for verbatim data. \appendtoks - \disablecompoundcharacters - \disablediscretionaries + \disablecompoundcharacters + \disablediscretionaries \to \everycleanupfeatures +%D The following code will me mkiv'd when needed. It's rather easy to +%D extend the kerner with glue. + %D \macros %D {stretched} %D @@ -150,18 +153,6 @@ \fi}% \fi} -%D \macros -%D {shiftedword, shiftedwords} -%D -%D Used as \type {\shiftedwords {10pt} {some text}} this macro will -%D move - -% \def\shiftedword#1% #2% -% {\raise#1\hbox} % {#2}} % officially: {\ifdim#1>\zeropoint\raise\else\lower\fi#1\hbox{#2}} - -% \def\shiftedwords#1#2% -% {\processisolatedwords{#2}{\shiftedword{#1}}} - %D \macros %D {low, high, lohi, hilo} %D diff --git a/Master/texmf-dist/tex/context/base/core-ini.mkiv b/Master/texmf-dist/tex/context/base/core-ini.mkiv index d6a72bb2614..c823c9594d6 100644 --- a/Master/texmf-dist/tex/context/base/core-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/core-ini.mkiv @@ -21,14 +21,15 @@ \everypar \emptytoks \neverypar \emptytoks -\appendtoks \flushnotes \to \everypar +%appendtoks \flushnotes \to \everypar \appendtoks \synchronizesidefloats \to \everypar \appendtoks \checkindentation \to \everypar \appendtoks \showparagraphnumber \to \everypar \appendtoks \restoreinterlinepenalty \to \everypar -\appendtoks \flushmargincontents \to \everypar -\appendtoks \flushcommentanchors \to \everypar +%appendtoks \flushmargincontents \to \everypar +%appendtoks \flushcommentanchors \to \everypar +\appendtoks \flushnotes \to \everypar \appendtoks \synchronizenotes \to \everypar \appendtoks \OTRSETshowstatus \to \everypar \appendtoks \flushpostponedbookmark \to \everypar @@ -56,11 +57,4 @@ %appendtoks \setlastlinewidth \to \everyendofpar % gone, will be done in lua \appendtoks \endgraf \to \everyendofpar -% Todo: verbatim, xml, tex, move code to here - -\ifx\normalcompound\undefined \let\normalcompound=| \fi - -\appendtoks \catcode`|=\@@active \let|\normalcompound \to \everyTEXinputmode -\appendtoks \catcode`|=\@@letter \to \everyXMLinputmode - \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/core-job.lua b/Master/texmf-dist/tex/context/base/core-job.lua index d557818bb35..f56d2ca1f2e 100644 --- a/Master/texmf-dist/tex/context/base/core-job.lua +++ b/Master/texmf-dist/tex/context/base/core-job.lua @@ -11,12 +11,16 @@ local ctxcatcodes, texcatcodes = tex.ctxcatcodes, tex.texcatcodes local lower, format, find, gmatch, gsub, match = string.lower, string.format, string.find, string.gmatch, string.gsub, string.match local concat = table.concat +local commands, resolvers, context = commands, resolvers, context + -- main code resolvers.maxreadlevel = 3 directives.register("resolvers.maxreadlevel", function(v) resolvers.maxreadlevel = tonumber(v) or resolvers.maxreadlevel end) +local report_examodes = logs.reporter("system","examodes") -- maybe another category + local function exists(n) if io.exists(n) then return n @@ -47,7 +51,7 @@ function resolvers.findctxfile(name,maxreadlevel) end end end - return resolvers.find_file(name) or "" + return resolvers.findfile(name) or "" end end @@ -71,12 +75,12 @@ function commands.locatefilepath(name,maxreadlevel) end function commands.usepath(paths,maxreadlevel) - resolvers.register_extra_path(paths) + resolvers.registerextrapath(paths) texsprint(texcatcodes,concat(resolvers.instance.extra_paths or {}, "")) end function commands.usesubpath(subpaths,maxreadlevel) - resolvers.register_extra_path(nil,subpaths) + resolvers.registerextrapath(nil,subpaths) texsprint(texcatcodes,concat(resolvers.instance.extra_paths or {}, "")) end @@ -104,38 +108,44 @@ local function convertexamodes(str) local data = xml.text(e) local mode = match(label,"^mode:(.+)$") if mode then - texsprint(ctxcatcodes,format("\\enablemode[%s:%s]",mode,data)) + context.enablemode { format("%s:%s",mode,data) } end - texsprint(ctxcatcodes,format("\\setvariable{exa:variables}{%s}{%s}",label,gsub(data,"([{}])","\\%1"))) + context.setvariable("exa:variables",label,(gsub(data,"([{}])","\\%1"))) end end end --- we need a system file option: ,. .. etc + paths but no tex lookup so resolvers.find_file is wrong here +-- we need a system file option: ,. .. etc + paths but no tex lookup so resolvers.findfile is wrong here function commands.loadexamodes(filename) if not filename or filename == "" then filename = file.removesuffix(tex.jobname) end - filename = resolvers.find_file(file.addsuffix(filename,'ctm')) or "" + filename = resolvers.findfile(file.addsuffix(filename,'ctm')) or "" if filename ~= "" then - commands.writestatus("examodes","loading %s",filename) -- todo: message system + report_examodes("loading %s",filename) -- todo: message system convertexamodes(io.loaddata(filename)) else - commands.writestatus("examodes","no mode file %s",filename) -- todo: message system + report_examodes("no mode file %s",filename) -- todo: message system end end +local report_options = logs.reporter("system","options") + function commands.logoptionfile(name) -- todo: xml if xml logmode local f = io.open(name) if f then - texio.write_nl("log","%\n%\tbegin of optionfile\n%\n") + logs.pushtarget("logfile") + report_options("begin of optionfile") + report_options() for line in f:lines() do - texio.write("log",format("%%\t%s\n",line)) + report_options(line) end - texio.write("log","%\n%\tend of optionfile\n%\n") + report_options() + report_options("end of optionfile") f:close() + logs.poptarget() end end @@ -148,7 +158,7 @@ end --~ for sa in gmatch(a,"[^ ,]+") do --~ for sb in gmatch(b,"[^ ,]+") do --~ if sa == sb then ---~ texsprint(ctxcatcodes,"\\def\\commalistelement{",sa,"}") +--~ context.setvalue("commalistelement",sa) --~ return true --~ end --~ end @@ -156,24 +166,24 @@ end --~ elseif ba then --~ for sa in gmatch(a,"[^ ,]+") do --~ if sa == b then ---~ texsprint(ctxcatcodes,"\\def\\commalistelement{",b,"}") +--~ context.setvalue("commalistelement",b) --~ return true --~ end --~ end --~ elseif bb then --~ for sb in gmatch(b,"[^ ,]+") do --~ if a == sb then ---~ texsprint(ctxcatcodes,"\\def\\commalistelement{",a,"}") +--~ context.setvalue("commalistelement",sb) --~ return true --~ end --~ end --~ else --~ if a == b then ---~ texsprint(ctxcatcodes,"\\def\\commalistelement{",a,"}") +--~ context.setvalue("commalistelement",a) --~ return true --~ end --~ end ---~ texsprint(ctxcatcodes,"\\let\\commalistelement\\empty") +--~ context.letvalueempty("commalistelement") --~ return false --~ end --~ local function doifinsetelse(a,b) diff --git a/Master/texmf-dist/tex/context/base/core-job.mkii b/Master/texmf-dist/tex/context/base/core-job.mkii index 5c280c15b14..2cd22e409a5 100644 --- a/Master/texmf-dist/tex/context/base/core-job.mkii +++ b/Master/texmf-dist/tex/context/base/core-job.mkii @@ -126,39 +126,43 @@ \ifx\preloadfonts \undefined \let\preloadfonts \relax \fi \ifx\preloadspecials\undefined \let\preloadspecials\relax \fi -\def\loadallsystemfiles#1#2% - {\ifx\@@svdirectory\empty - \readsysfile{#1}{\showmessage\m!systems2{#1}}{#2}% - \else% yet undocumented - \def\doloadsystemfile##1% - {\readsetfile{##1}{#1}{\showmessage\m!systems2{#1}}{#2}}% - \processcommacommand[\@@svdirectory]\doloadsystemfile - \fi} - \ifx\disableXML\undefined \let\disableXML\relax \fi +\def\doloadsystemfile#1% mkii with fallback to tex + {\readsysfile{#1.\mksuffix} + {\showmessage\m!systems2{#1.\mksuffix}} + {\readsysfile{#1.tex}{\showmessage\m!systems2{#1.tex}}\donothing}} + \def\loadsystemfiles {\reportprotectionstate - \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 % brrr better \setcatcodetable\ctxcatcodes % % test - \bgroup\disableXML\loadallsystemfiles\f!errfilename\donothing\egroup - \to\everygoodbye}} + \doloadsystemfile\f!newfilename + \doloadsystemfile\f!locfilename + \doloadsystemfile\f!expfilename + \readsysfile{\f!sysfilename.\mksuffix} + {\showmessage\m!systems2{\f!sysfilename.\mksuffix}} + {\readsysfile{\f!sysfilename.tex} + {\showmessage\m!systems2{\f!sysfilename.tex}} + {\readsysfile{\f!sysfilename.rme} + {\showmessage\m!systems2{\f!sysfilename.rme}% + \doglobal\appendtoks % brrr better \setcatcodetable\ctxcatcodes + \bgroup + \disableXML + \readsysfile{\f!errfilename.\mksuffix}\donothing\donothing + \egroup + \to\everygoodbye}% + \donothing}}} %D Loading of \type {cont-usr.tex} (edited by the user) -%D and \type {cont-fmt.tex} (generated by texexec). - -\def\loaduserspecifications - {% this used to be the file where users can tune their system, especially patterns - \readsysfile\f!usrfilename{\showmessage\m!systems2\f!usrfilename}\donothing - % this one took care of user preferences (fonts, messages) but lm made this obsolete - \readjobfile\f!fmtfilename{\showmessage\m!systems2\f!fmtfilename}\donothing - % from now on we preload all patterns (only in mkii) - \preloadallpatterns} +%D and \type {cont-fmt.tex} (generated by texexec). This is +%S obsolete now that we have enough memory for patterns. + +% \def\loaduserspecifications +% {% this used to be the file where users can tune their system, especially patterns +% \readsysfile\f!usrfilename{\showmessage\m!systems2\f!usrfilename}\donothing +% % this one took care of user preferences (fonts, messages) but lm made this obsolete +% \readjobfile\f!fmtfilename{\showmessage\m!systems2\f!fmtfilename}\donothing +% % from now on we preload all patterns (only in mkii) +% \preloadallpatterns} \let\loaduserspecifications\relax diff --git a/Master/texmf-dist/tex/context/base/core-job.mkiv b/Master/texmf-dist/tex/context/base/core-job.mkiv index de328c92bca..db8d3ed933e 100644 --- a/Master/texmf-dist/tex/context/base/core-job.mkiv +++ b/Master/texmf-dist/tex/context/base/core-job.mkiv @@ -43,7 +43,7 @@ \def\dostarttextfile#1% {\global\advance\fileprocesslevel\plusone \setxvalue{\c!file::\number\fileprocesslevel}{#1}% - \@EA\doglobal\@EA\addtocommalist\@EA{#1}\processedfiles} + \doglobal\addtocommalist{#1}\processedfiles} \def\dostoptextfile {\global\advance\fileprocesslevel\minusone} @@ -51,53 +51,35 @@ \def\processlocalfile#1#2% {#1{#2}\donothing{\readfile{#2}\donothing\donothing}} -\def\processfile #1{\ctxlua{commands.processfile("#1")}} -\def\doifinputfileelse #1{\ctxlua{commands.doifinputfileelse("#1")}} -\def\locatefilepath #1{\edef\locatedfilepath{\ctxlua{commands.locatefilepath("#1")}}} -\def\usepath [#1]{\edef\allinputpaths{\ctxlua{commands.usepath("#1")}}} -\def\usesubpath [#1]{\edef\allinputpaths{\ctxlua{commands.usesubpath("#1")}}} +\def\processfile #1{\ctxcommand{processfile("#1")}} +\def\doifinputfileelse #1{\ctxcommand{doifinputfileelse("#1")}} +\def\locatefilepath #1{\edef\locatedfilepath{\ctxcommand{locatefilepath("#1")}}} +\def\usepath [#1]{\edef\allinputpaths{\ctxcommand{usepath("#1")}}} +\def\usesubpath [#1]{\edef\allinputpaths{\ctxcommand{usesubpath("#1")}}} \def\usezipfile {\dodoubleempty\dousezipfile} -\def\dousezipfile[#1][#2]{\ctxlua{commands.usezipfile("#1","#2")}} % [filename] [optional subtree] - +\def\dousezipfile[#1][#2]{\ctxcommand{usezipfile("#1","#2")}} % [filename] [optional subtree] \def\loadexamodes {\dosingleempty\doloadexamodes} -\def\doloadexamodes [#1]{\ctxlua{commands.loadexamodes("#1")}} +\def\doloadexamodes [#1]{\ctxcommand{loadexamodes("#1")}} \def\registerfileinfo[#1#2]#3% geen \showmessage ? - {\writestatus\m!systems{#1#2 file #3 at line \the\inputlineno}} - -\ifx\preloadfonts \undefined \let\preloadfonts \relax \fi -\ifx\preloadspecials\undefined \let\preloadspecials\relax \fi - -\def\loadallsystemfiles#1#2% - {\ifx\@@svdirectory\empty - \readsysfile{#1}{\showmessage\m!systems2{#1}}{#2}% - \else% yet undocumented - \def\doloadsystemfile##1% - {\readsetfile{##1}{#1}{\showmessage\m!systems2{#1}}{#2}}% - \processcommacommand[\@@svdirectory]\doloadsystemfile - \fi} + {\writestatus\m!system{#1#2 file #3 at line \the\inputlineno}} -\ifx\disableXML\undefined \let\disableXML\relax \fi +\def\doloadsystemfile#1% only mkiv files + {\readsysfile{#1.\mksuffix}{\showmessage\m!system2{#1.\mksuffix}}\donothing} \def\loadsystemfiles - {\reportprotectionstate - \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 % brrr better \setcatcodetable\ctxcatcodes % % test - \bgroup\disableXML\loadallsystemfiles\f!errfilename\donothing\egroup - \to\everygoodbye}} + {\doloadsystemfile\f!newfilename % new code, to be integrated at some point, plus fixes posted on the list + \doloadsystemfile\f!locfilename % new code, somewhat experimental, not distributed (outside the dev group) + \doloadsystemfile\f!expfilename % new code, very experimental, can be engine specific, mostly for me only + \doloadsystemfile\f!sysfilename} % local settings, but probably not that good an idea to use %D We don't want multiple jobfiles to interfere. -\def\loadoptionfile +\def\loadoptionfile % todo : mark document.* tables as storage {\readjobfile{\jobname.\f!optionextension} - {\showmessage\m!systems2{\jobname.\f!optionextension}% - \ctxlua{commands.logoptionfile("\jobname.\f!optionextension")}}% - {\writestatus\m!systems {no \jobname.\f!optionextension}}} + {\writestatus\m!system{\jobname.\f!optionextension\space loaded}% + \ctxcommand{logoptionfile("\jobname.\f!optionextension")}}% + {\writestatus\m!system{no \jobname.\f!optionextension}}} % Most natural ... % @@ -137,7 +119,7 @@ \fi} \def\forcequitjob#1% - {\writestatus\m!systems{forcing quit: #1}% + {\writestatus\m!system{forcing quit: #1}% \batchmode \dorecurse\textlevel{\stoptext} \normalend} @@ -147,7 +129,7 @@ \def\autostarttext {\ifcase\textlevel \starttext - \writestatus\m!systems{auto \string\starttext..\string\stoptext}% + \writestatus\m!system{auto \string\starttext..\string\stoptext}% \let\autostoptext\stoptext \fi} @@ -164,15 +146,15 @@ \let\end\finalend \def\emergencyend - {\writestatus\m!systems{invalid \@EA\string\csname\e!start\v!text\endcsname...\@EA\string\csname\e!stop\v!text\endcsname\space structure}% + {\writestatus\m!system{invalid \@EA\string\csname\e!start\v!text\endcsname...\@EA\string\csname\e!stop\v!text\endcsname\space structure}% \stoptext} \def\currentfile{\inputfilename} \def\doexecutefileonce#1% {\beforesplitstring#1\at.\to\currentfile - \fullexpandtwoargsafter\doifnotinset\currentfile\loadedfiles - {\fullexpandoneargafter\addtocommalist\currentfile\loadedfiles + \doifnotinset\currentfile\loadedfiles + {\addtocommalist\currentfile\loadedfiles \doexecutefile{#1}}} \def\doexecutefile#1% @@ -185,21 +167,34 @@ \def\donotexecutefile#1% {} -\def\useenvironment[#1]% maybe commalist - {\environment #1 \relax} +\unexpanded\def\project {\doifnextoptionalelse\useproject \redoproject} +\unexpanded\def\environment{\doifnextoptionalelse\useenvironment\redoenvironment} +\unexpanded\def\product {\doifnextoptionalelse\useproduct \redoproduct} +\unexpanded\def\component {\doifnextoptionalelse\usecomponent \redocomponent} + +\def\redoproject #1 {\useproject [#1]} +\def\redoenvironment #1 {\useenvironment[#1]} +\def\redoproduct #1 {\useproduct [#1]} +\def\redocomponent #1 {\usecomponent [#1]} -\def\environment #1 % at outermost level only (load only once) - {\pushmacro\startenvironment +\def\useproject[#1]% + {} + +\def\useenvironment[#1]% maybe commalist + {\pushmacro\dostartenvironment % we could use a depth counter \pushmacro\stopenvironment - \unexpanded\def\startenvironment ##1 {}% + \unexpanded\def\dostartenvironment[##1]{}% \let\stopenvironment\relax \startreadingfile \doexecutefileonce{#1} \stopreadingfile \popmacro\stopenvironment - \popmacro\startenvironment} + \popmacro\dostartenvironment} -\def\component #1 % at outermost level only +\def\useproduct[#1]% + {} + +\def\usecomponent[#1]% {\dostarttextfile{#1}% \processfile{#1}% \dostoptextfile} @@ -209,7 +204,7 @@ \let\currentcomponent \v!text \let\currentcomponentpath\f!currentpath -\def\donextlevel#1#2#3#4#5#6#7\\% +\def\donextlevel#1#2#3#4#5#6#7\\% we will move this to lua {\pushmacro\currentcomponent \pushmacro\currentcomponentpath \let\currentcomponent#1% @@ -223,13 +218,13 @@ \beforesplitstring#7\at.\to#2\relax % can become path + base \ifcase\filelevel\relax \starttext - \def\project ##1 {#3{##1}}% - \def\environment ##1 {#4{##1}}% - \def\product ##1 {#5{##1}}% - \def\component ##1 {#6{##1}}% + \unexpanded\def\useproject [##1]{#3{##1}}% + \unexpanded\def\useenvironment[##1]{#4{##1}}% + \unexpanded\def\useproduct [##1]{#5{##1}}% + \unexpanded\def\usecomponent [##1]{#6{##1}}% \fi \advance\filelevel\plusone - \fullexpandoneargafter\addtocommalist{#1}\loadedfiles} + \addtocommalist{#1}\loadedfiles} \def\doprevlevel {\popmacro\currentcomponentpath @@ -242,24 +237,34 @@ \expandafter\endinput \fi} -\unexpanded\def\startproject #1 % +\unexpanded\def\startproject {\doifnextoptionalelse\dostartproject \redostartproject} +\unexpanded\def\startenvironment{\doifnextoptionalelse\dostartenvironment\redostartenvironment} +\unexpanded\def\startproduct {\doifnextoptionalelse\dostartproduct \redostartproduct} +\unexpanded\def\startcomponent {\doifnextoptionalelse\dostartcomponent \redostartcomponent} + +\def\redostartproject #1 {\dostartproject [#1]} +\def\redostartenvironment #1 {\dostartenvironment[#1]} +\def\redostartproduct #1 {\dostartproduct [#1]} +\def\redostartcomponent #1 {\dostartcomponent [#1]} + +\def\dostartproject[#1]% {\donextlevel\v!project\currentproject \donotexecutefile\doexecutefileonce \doexecutefileonce\doexecutefile#1\\} -\unexpanded\def\startproduct #1 % +\def\dostartproduct[#1]% {\doateverystarttext \donextlevel\v!product\currentproduct \doexecutefileonce\doexecutefileonce \donotexecutefile\doexecutefile#1\\} -\unexpanded\def\startcomponent #1 % +\def\dostartcomponent[#1]% {\doateverystarttext \donextlevel\v!component\currentcomponent \doexecutefileonce\doexecutefileonce \donotexecutefile\doexecutefile#1\\} -\unexpanded\def\startenvironment #1 % +\def\dostartenvironment[#1]% {\donextlevel\v!environment\currentenvironment \donotexecutefile\doexecutefileonce \donotexecutefile\donotexecutefile#1\\} @@ -280,26 +285,25 @@ {\let\loadedlocalenvironments\empty \def\docommand##1% {\beforesplitstring##1\at.\to\someevironment - \fullexpandoneargafter\addtocommalist\someevironment\loadedlocalenvironments}% + \addtocommalist\someevironment\loadedlocalenvironments}% \processcommalist[#1]\docommand - \fullexpandtwoargsafter\doifcommonelse % no longer next needed - {\currentproject,\currentproduct,% - \currentcomponent,\currentenvironment} - {\loadedlocalenvironments} + \doifcommonelse{\currentproject,\currentproduct,\currentcomponent,\currentenvironment}\loadedlocalenvironments {\letvalue{\e!stop\v!localenvironment}\relax} - {\grabuntil{\e!stop\v!localenvironment}\gobbleoneargument}} % TH: fixed, was \relax + {\grabuntil{\e!stop\v!localenvironment}\gobbleoneargument}} + +\setvalue{\v!localenvironment}{\doifnextoptionalelse\uselocalenvironment\redolocalenvironment} + +\def\redolocalenvironment#1 {\uselocalenvironment[#1]} -\setvalue{\v!localenvironment}#1 {\doexecutefileonce{#1}} - -% NOT TOEVOEGEN: \the\everytrace +\def\uselocalenvironment[#1]{\doexecutefileonce{#1}} -\neverypar\emptytoks +\neverypar\emptytoks % here ? % \appendtoks \flushnotes \to \everypar % \appendtoks \synchronizesidefloats \to \everypar % \appendtoks \checkindentation \to \everypar % \appendtoks \showparagraphnumber \to \everypar -% \appendtoks \flushmargincontents \to \everypar +% %appendtoks \flushmargincontents \to \everypar % \appendtoks \flushcommentanchors \to \everypar % \appendtoks \synchronizenotes \to \everypar diff --git a/Master/texmf-dist/tex/context/base/core-mis.mkii b/Master/texmf-dist/tex/context/base/core-mis.mkii index 98079830d16..6d77ef18eca 100644 --- a/Master/texmf-dist/tex/context/base/core-mis.mkii +++ b/Master/texmf-dist/tex/context/base/core-mis.mkii @@ -54,6 +54,8 @@ \appendtoks \def\MetaFun{MetaFun}\to\simplifiedcommands %appendtoks \def||{-}\to\simplifiedcommands \appendtoks \def|#1|{\ifx#1\empty\empty-\else#1\fi}\to\simplifiedcommands +\appendtoks \let\crlf\space\to\simplifiedcommands +\appendtoks \let\\\space\to\simplifiedcommands \appendtoks\let\buildtextaccent\secondoftwoarguments\to\simplifiedcommands @@ -1425,12 +1427,12 @@ [\c!bet=\unknown,\c!dat=\unknown,\c!ken=\unknown, \c!from=,\c!to=,\c!ref=,#1]% % moet anders, hoort niet in 01b - \assigntranslation[\s!nl=referentie,\s!en=reference,\s!de=Referenz,\s!sp=referencia]\to\@@@kmref - \assigntranslation[\s!nl=van,\s!en=from,\s!de=Von,\s!sp=de]\to\@@@kmvan - \assigntranslation[\s!nl=aan,\s!en=to,\s!de=An,\s!sp=a]\to\@@@kmaan - \assigntranslation[\s!nl=betreft,\s!en=concerns,\s!de=Betreff,\s!sp=]\to\@@@kmbet - \assigntranslation[\s!nl=datum,\s!en=date,\s!de=Datum,\s!sp=fecha]\to\@@@kmdat - \assigntranslation[\s!nl=kenmerk,\s!en=mark,\s!de=Kennzeichen,\s!sp=]\to\@@@kmken + \assigntranslation[\s!nl=referentie,\s!en=reference,\s!de=Referenz,\s!hr=referenca,\s!sp=referencia]\to\@@@kmref + \assigntranslation[\s!nl=van,\s!en=from,\s!de=Von,\s!hr=od,\s!sp=de]\to\@@@kmvan + \assigntranslation[\s!nl=aan,\s!en=to,\s!de=An,\s!hr=za,\s!sp=a]\to\@@@kmaan + \assigntranslation[\s!nl=betreft,\s!en=concerns,\s!de=Betreff,\s!hr=predmet,\s!sp=]\to\@@@kmbet + \assigntranslation[\s!nl=datum,\s!en=date,\s!de=Datum,\s!hr=datum,\s!sp=fecha]\to\@@@kmdat + \assigntranslation[\s!nl=kenmerk,\s!en=mark,\s!de=Kennzeichen,\s!hr=oznaka,\s!sp=]\to\@@@kmken % \definetabulate[\s!dummy][|l|p|] \startdummy @@ -2697,6 +2699,7 @@ \setuplabeltext [\s!nl] [and-1=\textcomma\ , and-2= en ] \setuplabeltext [\s!en] [and-1=\textcomma\ , and-2=\textcomma\ and ] \setuplabeltext [\s!de] [and-1=\textcomma\ , and-2= und ] +\setuplabeltext [\s!hr] [and-1=\textcomma\ , and-2= i ] %D \macros %D {somekindoftab} diff --git a/Master/texmf-dist/tex/context/base/core-mis.mkiv b/Master/texmf-dist/tex/context/base/core-mis.mkiv index e2bd28bd511..06ee5b6173d 100644 --- a/Master/texmf-dist/tex/context/base/core-mis.mkiv +++ b/Master/texmf-dist/tex/context/base/core-mis.mkiv @@ -21,7 +21,7 @@ % %D % %D Obsolete now: % % -% % \def\documentstyle{\showmessage\m!systems3\empty\stoptekst} +% % \def\documentstyle{\showmessage\m!system3\empty\stoptekst} % % % % \let\documentclass=\documentstyle % %D \macros @@ -196,72 +196,6 @@ \c!inbetween={\blank[\v!medium]}, \c!after=\blank] -% \definieerplaats[naam][instellingen] -% \stelplaatsin[naam][instellingen] -% \plaats[[instellingen]] -% -% - still undocumented and also not in setupb yet -% - kan ook intern/direct (scheelt duplicatie), zie \framedtext - -\def\dodefineplacement[#1][#2]% - {\getparameters - [\??pl#1] - [\c!left=\hss, - \c!right=\hss, - \c!linecorrection=\v!off, - \c!depthcorrection=\v!off, - \c!margin=\v!standard, - \c!grid=\v!middle, - %\c!before=, - %\c!after=, - #2]% - \setvalue{\e!place#1}{\doplacement[\??pl#1]}} - -\unexpanded\def\defineplacement - {\dodoubleempty\dodefineplacement} - -\unexpanded\def\setupplacement - {\dodoubleempty\dosetupplacement} - -\def\dosetupplacement[#1]% - {\dodoubleempty\getparameters[\??pl#1]} - -\def\doplacement - {\dodoubleempty\dodoplacement} - -\def\dodoplacement[#1][#2]% correctie moet mooier - {\bgroup - \dowithnextboxcontent - {\forgetall} - {\setlocalhsize - \getparameters[#1][#2]% - \getvalue{#1\c!before}% - \begingroup - \disableparpositions - \setbox\nextbox\hbox to \localhsize - {\getvalue{#1\c!left}% - \flushnextbox - \getvalue{#1\c!right}}% - \ifinsidefloat \else - \addlocalbackgroundtobox\nextbox - \fi - \ifgridsnapping - \doifundefined{#1\c!grid}{\letvalue{#1\c!grid}\v!middle}% - % unchecked - \doifinset{\getvalue{#1\c!margin}}{\v!standard,\v!yes}\noindent - \snaptogrid[\getvalue{#1\c!grid}]\hbox{\flushnextbox}% - \else - \doifvalue{#1\c!linecorrection}\v!on \startbaselinecorrection - \doifinset{\getvalue{#1\c!margin}}{\v!standard,\v!yes}\noindent - \flushnextbox - \doifvalue{#1\c!depthcorrection}\v!on\baselinecorrection - \doifvalue{#1\c!linecorrection }\v!on\stopbaselinecorrection - \fi - \endgroup - \getvalue{#1\c!after}% - \egroup} - \vbox} - % Te zijner tijd [plaats=boven,onder,midden] implementeren, % in dat geval moet eerst de maximale hoogte worden bepaald. % @@ -292,7 +226,7 @@ \setvalue{\e!start\currentparagraph}% {\bgroup \edef\currentparagraph{#1}% - \letvalue{\s!do\s!next\currentparagraph}\empty + \letvalueempty{\s!do\s!next\currentparagraph}% \setvalue{\e!stop\currentparagraph}{\getvalue\currentparagraph\egroup}% \getvalue\currentparagraph}% \getparameters[\??al\currentparagraph]% @@ -576,8 +510,8 @@ \unexpanded\def\ongeveer {\mathematics\pm} - -\chardef\boundarycharactermode\plusone + +\setnewconstant\boundarycharactermode\plusone \def\midboundarycharacter#1#2% {\ifcase\boundarycharactermode @@ -590,7 +524,7 @@ \or \languageparameter#1% \fi - \chardef\boundarycharactermode\plusone} + \boundarycharactermode\plusone} \def\leftboundarycharacter#1#2% {\ifcase\boundarycharactermode @@ -601,7 +535,7 @@ \or \languageparameter#1% \fi - \chardef\boundarycharactermode\plusone} + \boundarycharactermode\plusone} \def\rightboundarycharacter#1#2% {\ifcase\boundarycharactermode @@ -612,7 +546,7 @@ \or \languageparameter#1% \fi - \chardef\boundarycharactermode\plusone} + \boundarycharactermode\plusone} % actually this is pretty old, but temporary moved here % @@ -706,11 +640,13 @@ \ifnum\subsentencelevel=\plusone \dontleavehmode % was \leaveoutervmode \fi + \dostarttagged\t!subsentence\empty \symbol[\ifodd\subsentencelevel\c!leftsentence\else\c!leftsubsentence\fi]% }% \ignorespaces} \def\endofsubsentence % relax prevents space gobbling {\symbol[\ifodd\subsentencelevel\c!rightsentence\else\c!rightsubsentence\fi]% + \dostoptagged \global\advance\subsentencelevel\minusone \unskip \kern\subsentencesignal\relax @@ -741,23 +677,7 @@ \unexpanded\def\startsubsentence{\beginofsubsentence \prewordbreak\beginofsubsentencespacing} \unexpanded\def\stopsubsentence {\endofsubsentencespacing\prewordbreak\endofsubsentence} - -%D \defineXMLenvironment [subsentence] -%D {|<|} -%D {|>|} -%D \defineXMLenvironment [subsentence] -%D {\directdiscretionary{<}} -%D {\directdiscretionary{>}} -%D \defineXMLenvironment [subsentence] -%D {\startsubsentence} -%D {\stopsubsentence} -%D -%D \startbuffer -%D test test test -%D \stopbuffer -%D -%D \typebuffer -%D \processXMLbuffer +\unexpanded\def\subsentence {\groupedcommand\startsubsentence\stopsubsentence} \enableactivediscretionaries @@ -885,6 +805,7 @@ \unexpanded\def\startdelimitedtext[#1]% {\bgroup \pushdelimitedtext{#1}% + \dostarttagged\t!delimitedblock\currentdelimitedtext \doifelse{\delimitedtextparameter\c!method}\s!font {\def\dostopdelimitedtext {\removeunwantedspaces\ignoredelimitedtext\c!right}% @@ -895,39 +816,6 @@ \doifinsetelse{\delimitedtextparameter\c!location}{\v!paragraph,\v!margin}% {\dosingleempty\dostartdelimitedtextpar}\dostartdelimitedtexttxt}} -% \def\dostartdelimitedtextpar[#1]% -% {\let\dostopdelimitedtext\dostopdelimitedtextpar -% \doifsomething{\delimitedtextparameter\c!spacebefore} -% {\blank[\delimitedtextparameter\c!spacebefore]}% -% \delimitedtextparameter\c!before -% % nicer: -% % \doadaptleftskip {\delimitedtextparameter\c!leftmargin}% -% % \doadaptrightskip{\delimitedtextparameter\c!rightmargin}% -% % backward compatible: -% \doifelsenothing{#1} -% {\endgraf -% \doadaptleftskip {\delimitedtextparameter\c!leftmargin}% -% \doadaptrightskip{\delimitedtextparameter\c!rightmargin}% -% \let\dodostopdelimitedtextpar\endgraf} -% {\startnarrower[#1]\let\dodostopdelimitedtextpar\stopnarrower}% -% % so far -% % \dochecknextindentation{\??ci\currentdelimitedtext}% AM: not here -% \dostartattributes{\??ci\currentdelimitedtext}\c!style\c!color\empty -% \leftdelimitedtextmark -% \ignorespaces} - -% \def\dostopdelimitedtextpar -% {\removeunwantedspaces -% \removelastskip -% \rightdelimitedtextmark -% \dostopattributes -% \dodostopdelimitedtextpar -% \delimitedtextparameter\c!after -% \doifsomething{\delimitedtextparameter\c!spaceafter} -% {\blank[\delimitedtextparameter\c!spaceafter]}% -% \dochecknextindentation{\??ci\currentdelimitedtext}% AM: here -% \dorechecknextindentation}% AM: This was missing! - \def\dostartdelimitedtextpar[#1]% {\let\dostopdelimitedtext\dostopdelimitedtextpar \doifsomething{\delimitedtextparameter\c!spacebefore} @@ -978,6 +866,7 @@ \unexpanded\def\stopdelimitedtext {\dostopdelimitedtext + \dostoptagged \popdelimitedtext \egroup} @@ -1113,35 +1002,56 @@ \def\handlerightdelimitedtext#1% {\dohandlerightdelimitedtext{#1}\relax} +% \unexpanded\def\dodelimitedtextpar +% {\dohandleleftdelimitedtext\c!left\relax +% \groupedcommand +% \donothing +% {\dohandlerightdelimitedtext\c!right\removelastskip +% \popdelimitedtext}} + \unexpanded\def\dodelimitedtextpar - {\dohandleleftdelimitedtext\c!left\relax - \groupedcommand - \donothing + {\groupedcommand + {\dostarttagged\t!delimited\currentdelimitedtext % block? + \dohandleleftdelimitedtext\c!left\relax} {\dohandlerightdelimitedtext\c!right\removelastskip + \dostoptagged \popdelimitedtext}} \unexpanded\def\dodelimitedtexttxt {\doifelse{\delimitedtextparameter\c!style}\v!normal \doquoteddelimited\doattributeddelimited} +% \def\doquoteddelimited +% {\dohandleleftdelimitedtext\c!left\relax +% \groupedcommand +% \donothing +% {\dohandlerightdelimitedtext\c!right +% \removelastskip +% \popdelimitedtext}} + \def\doquoteddelimited - {\dohandleleftdelimitedtext\c!left\relax - \groupedcommand - \donothing + {\groupedcommand + {\dostarttagged\t!delimited\currentdelimitedtext + \dohandleleftdelimitedtext\c!left\relax} {\dohandlerightdelimitedtext\c!right \removelastskip + \dostoptagged \popdelimitedtext}} \def\doattributeddelimited {\groupedcommand - {\dostartattributes{\??ci\currentdelimitedtext}\c!style\c!color} + {\dostarttagged\t!delimited\currentdelimitedtext + \dostartattributes{\??ci\currentdelimitedtext}\c!style\c!color} {\dostopattributes + \dostoptagged \popdelimitedtext}} \def\dofontdrivendelimited {\simplegroupedcommand - {\languageparameter{\c!left\currentdelimitedtext}} + {\dostarttagged\t!delimited\currentdelimitedtext + \languageparameter{\c!left\currentdelimitedtext}} {\languageparameter{\c!right\currentdelimitedtext}% + \dostoptagged \popdelimitedtext}} % testcase for nesting: @@ -1330,12 +1240,12 @@ [\c!bet=\unknown,\c!dat=\unknown,\c!ken=\unknown, \c!from=,\c!to=,\c!ref=,#1]% % moet anders, hoort niet in 01b - \assigntranslation[\s!nl=referentie,\s!en=reference,\s!de=Referenz,\s!sp=referencia]\to\@@@kmref - \assigntranslation[\s!nl=van,\s!en=from,\s!de=Von,\s!sp=de]\to\@@@kmvan - \assigntranslation[\s!nl=aan,\s!en=to,\s!de=An,\s!sp=a]\to\@@@kmaan - \assigntranslation[\s!nl=betreft,\s!en=concerns,\s!de=Betreff,\s!sp=]\to\@@@kmbet - \assigntranslation[\s!nl=datum,\s!en=date,\s!de=Datum,\s!sp=fecha]\to\@@@kmdat - \assigntranslation[\s!nl=kenmerk,\s!en=mark,\s!de=Kennzeichen,\s!sp=]\to\@@@kmken + \assigntranslation[\s!nl=referentie,\s!en=reference,\s!de=Referenz,\s!hr=referenca,\s!sp=referencia]\to\@@@kmref + \assigntranslation[\s!nl=van,\s!en=from,\s!de=Von,\s!hr=od,\s!sp=de]\to\@@@kmvan + \assigntranslation[\s!nl=aan,\s!en=to,\s!de=An,\s!hr=za,\s!sp=a]\to\@@@kmaan + \assigntranslation[\s!nl=betreft,\s!en=concerns,\s!de=Betreff,\s!hr=predmet,\s!sp=]\to\@@@kmbet + \assigntranslation[\s!nl=datum,\s!en=date,\s!de=Datum,\s!hr=datum,\s!sp=fecha]\to\@@@kmdat + \assigntranslation[\s!nl=kenmerk,\s!en=mark,\s!de=Kennzeichen,\s!hr=oznaka,\s!sp=]\to\@@@kmken % \definetabulate[\s!dummy][|l|p|] \startdummy @@ -1647,31 +1557,34 @@ \let\next=} \hbox} +\setnewconstant\pairedlocationa\plusone +\setnewconstant\pairedlocationb\plusfour + \def\beforefirstpairedbox - {\chardef\pairedlocationa1 % left - \chardef\pairedlocationb4 % middle + {\pairedlocationa\plusone % left + \pairedlocationb\plusfour % middle \getfromcommacommand[\@@ldlocation][1]% \processaction [\commalistelement] - [ \v!left=>\chardef\pairedlocationa0, - \v!right=>\chardef\pairedlocationa1, - \v!top=>\chardef\pairedlocationa2, - \v!bottom=>\chardef\pairedlocationa3]% + [ \v!left=>\pairedlocationa\zerocount, + \v!right=>\pairedlocationa\plusone, + \v!top=>\pairedlocationa\plustwo, + \v!bottom=>\pairedlocationa\plusthree]% \getfromcommacommand[\@@ldlocation][2]% \processaction [\commalistelement] - [ \v!left=>\chardef\pairedlocationb0, - \v!right=>\chardef\pairedlocationb1, - \v!high=>\chardef\pairedlocationb2, - \v!top=>\chardef\pairedlocationb2, - \v!low=>\chardef\pairedlocationb3, - \v!bottom=>\chardef\pairedlocationb3, - \v!middle=>\chardef\pairedlocationb4]} + [ \v!left=>\pairedlocationb\zerocount, + \v!right=>\pairedlocationb\plusone, + \v!high=>\pairedlocationb\plustwo, + \v!top=>\pairedlocationb\plustwo, + \v!low=>\pairedlocationb\plusthree, + \v!bottom=>\pairedlocationb\plusthree, + \v!middle=>\pairedlocationb\plusfour]} \def\betweenbothpairedboxes {\switchtobodyfont[\@@ldbodyfont]% split under same regime \setbox\firstpairedbox\flushnextbox - \ifnum\pairedlocationa<2 + \ifnum\pairedlocationa<\plustwo \hsize\wd\firstpairedbox % trick \hsize\@@ldwidth \scratchdimen\wd\firstpairedbox @@ -1700,9 +1613,9 @@ \else \flushnextbox \fi}% - \ifnum\pairedlocationa<2\hbox\else\vbox\fi\bgroup % hide vsize + \ifnum\pairedlocationa<\plustwo\hbox\else\vbox\fi\bgroup % hide vsize \forgetall - \ifnum\pairedlocationa<2 + \ifnum\pairedlocationa<\plustwo \scratchdimen\maxoftwoboxdimens\ht\firstpairedbox\secondpairedbox \vsize\scratchdimen \ifdim\scratchdimen<\@@ldheight\relax % can be \vsize @@ -1727,9 +1640,9 @@ \fi \ifdim\scratchdimen>\ht\secondpairedbox \setbox\secondpairedbox\vbox to \scratchdimen - {\ifnum\pairedlocationa=3 \vss\fi % + {\ifnum\pairedlocationa=\plusthree \vss\fi % \box\secondpairedbox - \ifnum\pairedlocationa=2 \vss\fi}% \kern\zeropoint + \ifnum\pairedlocationa=\plustwo \vss\fi}% \kern\zeropoint \fi \fi \ifcase\pairedlocationa @@ -1833,6 +1746,7 @@ \doifelse{\combinationparameter\c!height}\v!fit \vbox {\vbox to \combinationparameter\c!height}% \bgroup +\let\combination\empty % permits \combination{}{} handy for cld \expanded{\dodostartcombination[\currentcombinationspec]}} \long\def\dodostartcombination[#1*#2*#3]% @@ -2011,7 +1925,7 @@ \def\dostartfloatcombination[#1][#2]% {\vbox\bgroup %\insidecolumnstrue % trick, forces no centering, todo: proper switch/feature - \chardef\postcenterfloatmethod\zerocount + \postcenterfloatmethod\zerocount \forcelocalfloats \unexpanded\def\stopfloatcombination {\scratchtoks\emptytoks @@ -2357,7 +2271,7 @@ %D character and the fractional digits (we use 57 as %D sample). Here we combine all methods in one macros. -\chardef\vulgarfractionmethod=3 +\setnewconstant\vulgarfractionmethod\plusthree \definehspace[vulgarfraction][.25em] % [.15em] \definesymbol[vulgarfraction][/] % [\raise.2ex\hbox{/}] @@ -2390,10 +2304,10 @@ %D \HL %D \NC \bf method \NC \bf visualization \NC\NR %D \HL -%D \NC 0 \NC \chardef\vulgarfractionmethod0\vulgarfraction{1}{2} \NC\NR -%D \NC 1 \NC \chardef\vulgarfractionmethod1\vulgarfraction{1}{2} \NC\NR -%D \NC 2 \NC \chardef\vulgarfractionmethod2\vulgarfraction{1}{2} \NC\NR -%D \NC 3 \NC \chardef\vulgarfractionmethod3\vulgarfraction{1}{2} \NC\NR +%D \NC 0 \NC \vulgarfractionmethod0 \vulgarfraction{1}{2} \NC\NR +%D \NC 1 \NC \vulgarfractionmethod1 \vulgarfraction{1}{2} \NC\NR +%D \NC 2 \NC \vulgarfractionmethod2 \vulgarfraction{1}{2} \NC\NR +%D \NC 3 \NC \vulgarfractionmethod3 \vulgarfraction{1}{2} \NC\NR %D \HL %D \stoptabulate @@ -2460,6 +2374,7 @@ \setuplabeltext [\s!nl] [and-1=\textcomma\ , and-2= en ] \setuplabeltext [\s!en] [and-1=\textcomma\ , and-2=\textcomma\ and ] \setuplabeltext [\s!de] [and-1=\textcomma\ , and-2= und ] +\setuplabeltext [\s!hr] [and-1=\textcomma\ , and-2= i ] %D \macros %D {somekindoftab} diff --git a/Master/texmf-dist/tex/context/base/core-sys.lua b/Master/texmf-dist/tex/context/base/core-sys.lua index c5aa89d98e5..47a5c340df3 100644 --- a/Master/texmf-dist/tex/context/base/core-sys.lua +++ b/Master/texmf-dist/tex/context/base/core-sys.lua @@ -8,6 +8,8 @@ if not modules then modules = { } end modules ['core-sys'] = { local lower, extname, basename, removesuffix = string.lower, file.extname, file.basename, file.removesuffix +local environment = environment + function commands.updatefilenames(inputfilename,outputfilename) environment.inputfilename = inputfilename or "" environment.outputfilename = outputfilename or "" @@ -18,5 +20,6 @@ function commands.updatefilenames(inputfilename,outputfilename) end statistics.register("result saved in file", function() + -- suffix will be fetched from backend return string.format( "%s.%s", environment.outputfilename, (tex.pdfoutput>0 and "pdf") or "dvi") end) diff --git a/Master/texmf-dist/tex/context/base/core-sys.mkiv b/Master/texmf-dist/tex/context/base/core-sys.mkiv index 649e5e65c9b..f61cabec3d2 100644 --- a/Master/texmf-dist/tex/context/base/core-sys.mkiv +++ b/Master/texmf-dist/tex/context/base/core-sys.mkiv @@ -35,20 +35,14 @@ %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} +\edef\operatingsystem {\ctxwrite {os.platform}} -\edef\operatingsystem {\ctxlua{tex.write(os.platform)}} - -\def\jobfilename {\ctxlua{tex.sprint(tex.texcatcodes,environment.jobfilename or "")}} -\def\jobfilesuffix {\ctxlua{tex.sprint(tex.texcatcodes,environment.jobfilesuffix or "")}} -\def\inputfilebarename{\ctxlua{tex.sprint(tex.texcatcodes,environment.inputfilebarename or "")}} -\def\inputfilesuffix {\ctxlua{tex.sprint(tex.texcatcodes,environment.inputfilesuffix or "")}} -\def\inputfilename {\ctxlua{tex.sprint(tex.texcatcodes,environment.inputfilename or "")}} -\def\outputfilename {\ctxlua{tex.sprint(tex.texcatcodes,environment.outputfilename or "")}} - -\def\initializenewlinechar - {\bgroup\newlinechar=10\xdef\outputnewlinechar{^^J}\egroup} +\def \jobfilename {\ctxsprint{environment.jobfilename or ""}} +\def \jobfilesuffix {\ctxsprint{environment.jobfilesuffix or ""}} +\def \inputfilebarename{\ctxsprint{environment.inputfilebarename or ""}} +\def \inputfilesuffix {\ctxsprint{environment.inputfilesuffix or ""}} +\def \inputfilename {\ctxsprint{environment.inputfilename or ""}} +\def \outputfilename {\ctxsprint{environment.outputfilename or ""}} \newtoks \everysetupsystem @@ -106,8 +100,6 @@ {\let\jobfullname\empty} {\doif\jobfilesuffix\c!tex{\edef\jobfullname{\jobfilename.#1}}}} -\let\systemendofline\outputnewlinechar % will become obsolete - \def\systemparameter#1{\executeifdefined{\??sv#1}\empty} %D There are a couple of system states avaiable: @@ -150,7 +142,7 @@ \s!default=>\getnewrandomseed\scratchcounter, \s!unknown=>\scratchcounter#1]% \expanded{\setrandomseed{\the\scratchcounter}}% - % \writestatus\m!systems{randomseed: \the\scratchcounter}% + % \writestatus\m!system{randomseed: \the\scratchcounter}% \egroup}} \setupsystem @@ -194,44 +186,79 @@ \definecomplexorsimple\start \definecomplexorsimple\stop -\def\dododefinestartstop[#1][#2]% todo: use indirect commands - {\getparameters - [\??be#1] - [\c!before=, - \c!after=, - \c!inbetween=, - \c!commands=, - \c!style=, - #2]% - \setuvalue{#1}% - {\groupedcommand - {\getvalue{\??be#1\c!commands}% - \dostartattributes{\??be#1}\c!style\c!color} - {\dostopattributes - \getvalue{\??be#1\c!inbetween}}}% - \setvalue{\e!start#1}% - {\getvalue{\??be#1\c!before}% - \bgroup - \getvalue{\??be#1\c!commands}% - \dostartattributes{\??be#1}\c!style\c!color\empty}% - \setvalue{\e!stop#1}% - {\dostopattributes - \egroup - \getvalue{\??be#1\c!after}}} +% \def\dododefinestartstop[#1][#2]% todo: use indirect commands +% {\getparameters +% [\??be#1] +% [\c!before=, +% \c!after=, +% \c!inbetween=, +% \c!commands=, +% \c!style=, +% #2]% +% \setuvalue{#1}% +% {\groupedcommand +% {\getvalue{\??be#1\c!commands}% +% \dostarttagged\t!construct{#1}% +% \dostartattributes{\??be#1}\c!style\c!color} +% {\dostopattributes +% \dostoptagged +% \getvalue{\??be#1\c!inbetween}}}% +% \setuvalue{\e!start#1}% +% {\getvalue{\??be#1\c!before}% +% \bgroup +% \getvalue{\??be#1\c!commands}% +% \dostarttagged\t!construct{#1}% +% \dostartattributes{\??be#1}\c!style\c!color\empty}% +% \setuvalue{\e!stop#1}% +% {\dostopattributes +% \dostoptagged +% \egroup +% \getvalue{\??be#1\c!after}}} +% +% \def\dodefinestartstop[#1][#2]% +% {\def\docommand##1{\dododefinestartstop[##1][#2]}% +% \processcommalist[#1]\docommand} +% +% \unexpanded\def\definestartstop +% {\dodoubleargument\dodefinestartstop} +% +% \def\dosetupstartstop[#1][#2]% +% {\def\docommand##1{\getparameters[\??be##1][#2]}% +% \processcommalist[#1]\docommand} +% +% \unexpanded\def\setupstartstop +% {\dodoubleargument\dosetupstartstop} -\def\dodefinestartstop[#1][#2]% - {\def\docommand##1{\dododefinestartstop[##1][#2]}% - \processcommalist[#1]\docommand} -\unexpanded\def\definestartstop - {\dodoubleargument\dodefinestartstop} +% \c!before \c!after \c!inbetween \c!commands \c!style \c!color -\def\dosetupstartstop[#1][#2]% - {\def\docommand##1{\getparameters[\??be##1][#2]}% - \processcommalist[#1]\docommand} +\installcommandhandler{\??be}{startstop}{\??be} + +\appendtoks + \normalexpanded{\dodefinestartstop{\currentstartstop}}% +\to \everydefinestartstop -\unexpanded\def\setupstartstop - {\dodoubleargument\dosetupstartstop} +\unexpanded\def\dodefinestartstop#1% + {\setuvalue{#1}% + {\groupedcommand + {\def\currentstartstop{#1}% + \startstopparameter\c!commands + \dostarttagged\t!construct\currentstartstop + \dosetstartstopattributes\c!style\c!color} + {\def\currentstartstop{#1}% + \dostoptagged + \startstopparameter\c!inbetween}}% + \setuvalue{\e!start#1}% + {\namedstartstopparameter{#1}\c!before + \bgroup + \def\currentstartstop{#1}% + \startstopparameter\c!commands + \dostarttagged\t!construct\currentstartstop + \dosetstartstopattributes\c!style\c!color}% + \setuvalue{\e!stop#1}% + {\dostoptagged + \egroup + \namedstartstopparameter{#1}\c!after}} % \docommand kan niet worden gebruikt omdat deze macro % soms lokaal wordt gebruikt @@ -267,7 +294,7 @@ \def\complexdefine[#1]#2#3% {\ifx#2\undefined \else - \showmessage\m!systems4{\string#2}% + \showmessage\m!system4{\string#2}% \fi \ifcase0#1\def#2{#3}% \or\def#2##1{#3}% @@ -350,7 +377,7 @@ % end % \stopluacode % -% \unexpanded\def\define#1#{\ctxlua{commands.define([[\detokenize{#1}]])}} +% \unexpanded\def\define#1#{\ctxcommand{define([[\detokenize{#1}]])}} % % \starttext % \define[2]\whatevera{#1+#2} diff --git a/Master/texmf-dist/tex/context/base/core-two.lua b/Master/texmf-dist/tex/context/base/core-two.lua index 24a3191a775..51f6dd890b8 100644 --- a/Master/texmf-dist/tex/context/base/core-two.lua +++ b/Master/texmf-dist/tex/context/base/core-two.lua @@ -7,25 +7,30 @@ if not modules then modules = { } end modules ['core-two'] = { } local remove, concat = table.remove, table.concat - local texprint = tex.print +local allocate = utilities.storage.allocate --[[ldx--

We save multi-pass information in the main utility table. This is a bit of a mess because we support old and new methods.

--ldx]]-- -jobpasses = jobpasses or { } -jobpasses.collected = jobpasses.collected or { } -jobpasses.tobesaved = jobpasses.tobesaved or { } +local collected = allocate() +local tobesaved = allocate() + +local jobpasses = { + collected = collected, + tobesaved = tobesaved, +} -local collected, tobesaved = jobpasses.collected, jobpasses.tobesaved +job.passes = jobpasses local function initializer() - collected, tobesaved = jobpasses.collected, jobpasses.tobesaved + collected = jobpasses.collected + tobesaved = jobpasses.tobesaved end -job.register('jobpasses.collected', jobpasses.tobesaved, initializer, nil) +job.register('job.passes.collected', tobesaved, initializer, nil) local function allocate(id) local p = tobesaved[id] diff --git a/Master/texmf-dist/tex/context/base/core-two.mkiv b/Master/texmf-dist/tex/context/base/core-two.mkiv index 2cc9412afba..332b2c89bbb 100644 --- a/Master/texmf-dist/tex/context/base/core-two.mkiv +++ b/Master/texmf-dist/tex/context/base/core-two.mkiv @@ -79,11 +79,11 @@ %D I'm not that sure if this behaves exactly like mkii. This needs a cleanup. -\def\immediatesavetwopassdata #1#2#3{\normalexpanded{\noexpand\ctxlua {jobpasses.save('#1',"#3")}}} -\def\savetwopassdata #1#2#3{\normalexpanded{\noexpand\ctxlatelua{jobpasses.save('#1',"#3")}}} -\def\lazysavetwopassdata #1#2#3{\normalexpanded{\noexpand\ctxlatelua{jobpasses.save('#1',"#3")}}} -\def\savetaggedtwopassdata #1#2#3#4{\normalexpanded{\noexpand\ctxlua {jobpasses.savetagged('#1','#3',"#4")}}} -\def\lazysavetaggedtwopassdata#1#2#3#4{\normalexpanded{\noexpand\ctxlatelua{jobpasses.savetagged('#1','#3',"#4")}}} +\def\immediatesavetwopassdata #1#2#3{\normalexpanded{\noexpand\ctxlua {job.passes.save('#1',"#3")}}} +\def\savetwopassdata #1#2#3{\normalexpanded{\noexpand\ctxlatelua{job.passes.save('#1',"#3")}}} +\def\lazysavetwopassdata #1#2#3{\normalexpanded{\noexpand\ctxlatelua{job.passes.save('#1',"#3")}}} +\def\savetaggedtwopassdata #1#2#3#4{\normalexpanded{\noexpand\ctxlua {job.passes.savetagged('#1','#3',"#4")}}} +\def\lazysavetaggedtwopassdata#1#2#3#4{\normalexpanded{\noexpand\ctxlatelua{job.passes.savetagged('#1','#3',"#4")}}} % temp hack: needs a proper \starteverytimeluacode @@ -91,15 +91,15 @@ % todo: move the edef to lua -\unexpanded\def\definetwopasslist #1{\ctxlua{jobpasses.define('#1')}} -\def\gettwopassdata #1{\edef\twopassdata{\ctxlua{jobpasses.get("#1")}}\testtwopassdata} -\def\checktwopassdata #1{\edef\twopassdata{\ctxlua{jobpasses.check("#1")}}\testtwopassdata} -\def\findtwopassdata #1#2{\edef\twopassdata{\ctxlua{jobpasses.find("#1","#2")}}\testtwopassdata} -\def\getfirsttwopassdata #1{\edef\twopassdata{\ctxlua{jobpasses.first("#1")}}\testtwopassdata} -\def\getlasttwopassdata #1{\edef\twopassdata{\ctxlua{jobpasses.last("#1")}}\edef\noftwopassitems{\ctxlua{jobpasses.count("#1")}}\testtwopassdata} -\def\getnamedtwopassdatalist#1#2{\edef#1{\ctxlua{jobpasses.list("#2")}}} -\def\gettwopassdatalist #1{\edef\twopassdatalist{\ctxlua{jobpasses.list("#1")}}} -\def\doifelseintwopassdata #1#2{\ctxlua{jobpasses.doifinlistelse("#1","#2")}} +\unexpanded\def\definetwopasslist #1{\ctxlua{job.passes.define('#1')}} +\def\gettwopassdata #1{\edef\twopassdata{\ctxlua{job.passes.get("#1")}}\testtwopassdata} +\def\checktwopassdata #1{\edef\twopassdata{\ctxlua{job.passes.check("#1")}}\testtwopassdata} +\def\findtwopassdata #1#2{\edef\twopassdata{\ctxlua{job.passes.find("#1","#2")}}\testtwopassdata} +\def\getfirsttwopassdata #1{\edef\twopassdata{\ctxlua{job.passes.first("#1")}}\testtwopassdata} +\def\getlasttwopassdata #1{\edef\twopassdata{\ctxlua{job.passes.last("#1")}}\edef\noftwopassitems{\ctxlua{job.passes.count("#1")}}\testtwopassdata} +\def\getnamedtwopassdatalist#1#2{\edef#1{\ctxlua{job.passes.list("#2")}}} +\def\gettwopassdatalist #1{\edef\twopassdatalist{\ctxlua{job.passes.list("#1")}}} +\def\doifelseintwopassdata #1#2{\ctxlua{job.passes.doifinlistelse("#1","#2")}} \let\getfromtwopassdata\findtwopassdata diff --git a/Master/texmf-dist/tex/context/base/core-uti.lua b/Master/texmf-dist/tex/context/base/core-uti.lua index 01fd8522b10..02411f13d99 100644 --- a/Master/texmf-dist/tex/context/base/core-uti.lua +++ b/Master/texmf-dist/tex/context/base/core-uti.lua @@ -17,14 +17,25 @@ utility file under different setups, we now load a table once. This saves much runtime but at the cost of more memory usage.

--ldx]]-- -local sort, concat, format, match = table.sort, table.concat, string.format, string.match +local format, match = string.format, string.match local next, type, tostring = next, type, tostring -local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes -if not jobs then jobs = { } end -if not job then jobs['main'] = { } end job = jobs['main'] +local definetable = utilities.tables.definetable +local accesstable = utilities.tables.accesstable +local serialize = table.serialize +local packers = utilities.packers +local allocate = utilities.storage.allocate +local mark = utilities.storage.mark -jobs.version = 1.10 +local report_jobcontrol = logs.reporter("jobcontrol") + +job = job or { } +local job = job + +job.version = 1.14 + +-- some day we will implement loading of other jobs and then we need +-- job.jobs --[[ldx--

Variables are saved using in the previously defined table and passed @@ -38,151 +49,63 @@ function job.comment(str) comment[#comment+1] = str end -job.comment(format("version: %1.2f",jobs.version)) +job.comment(format("version: %1.2f",job.version)) function job.initialize(loadname,savename) - job.load(loadname) - main.register_stop_actions(function() + job.load(loadname) -- has to come after structure is defined ! + luatex.registerstopactions(function() if not status.lasterrorstring or status.lasterrorstring == "" then job.save(savename) end end) end -function job.register(...) -- collected, tobesaved, initializer, finalizer - savelist[#savelist+1] = { ... } +function job.register(collected, tobesaved, initializer, finalizer) + savelist[#savelist+1] = { collected, tobesaved, initializer, finalizer } end -- as an example we implement variables -jobvariables = jobvariables or { } -jobvariables.collected = jobvariables.collected or { } -jobvariables.tobesaved = jobvariables.tobesaved or { } -jobvariables.checksums = jobvariables.checksums or { } - -if not jobvariables.checksums.old then jobvariables.checksums.old = md5.HEX("old") end -- used in experiment -if not jobvariables.checksums.new then jobvariables.checksums.new = md5.HEX("new") end -- used in experiment - -job.register('jobvariables.checksums', jobvariables.checksums) - -local function initializer() - local r = jobvariables.collected.randomseed - if not r then - r = math.random() - math.setrandomseedi(r,"initialize") - else - math.setrandomseedi(r,"previous run") - end - jobvariables.tobesaved.randomseed = r - for cs, value in next, jobvariables.collected do - texsprint(ctxcatcodes,format("\\xdef\\%s{%s}",cs,value)) - end -end - -job.register('jobvariables.collected', jobvariables.tobesaved, initializer) +local tobesaved, collected, checksums = allocate(), allocate(), allocate() -function jobvariables.save(cs,value) - jobvariables.tobesaved[cs] = value -end +local jobvariables = { + collected = collected, + tobesaved = tobesaved, + checksums = checksums, +} --- experiment (bugged: some loop in running) +job.variables = jobvariables --- for the moment here, very experimental stuff +if not checksums.old then checksums.old = md5.HEX("old") end -- used in experiment +if not checksums.new then checksums.new = md5.HEX("new") end -- used in experiment -packer = packer or { } -packer.version = 1.00 +job.register('job.variables.checksums', checksums) -local function hashed(t) - local s = { } - for k, v in next, t do - if type(v) == "table" then - s[#s+1] = k.."={"..hashed(v).."}" - else - s[#s+1] = k.."="..tostring(v) - end - end - sort(s) - return concat(s,",") -end +local rmethod, rvalue -local function pack(t,keys,hash,index) - for k,v in next, t do - if type(v) == "table" then - pack(v,keys,hash,index) - end - if keys[k] and type(v) == "table" then - local h = hashed(v) - local i = hash[h] - if not i then - i = #index+1 - index[i] = v - hash[h] = i - end - t[k] = i - end - end -end - -local function unpack(t,keys,index) - for k,v in next, t do - if keys[k] and type(v) == "number" then - local iv = index[v] - if iv then - v = iv - t[k] = v - end - end - if type(v) == "table" then - unpack(v,keys,index) - end +local function initializer() + tobesaved = jobvariables.tobesaved + collected = jobvariables.collected + checksums = jobvariables.checksums + rvalue = collected.randomseed + if not rvalue then + rvalue = math.random() + math.setrandomseedi(rvalue,"initialize") + rmethod = "initialized" + else + math.setrandomseedi(rvalue,"previous run") + rmethod = "resumed" end -end - -function packer.new(keys,version) - return { - version = version or packer.version, - keys = table.tohash(keys), - hash = { }, - index = { }, - } -end - -function packer.pack(t,p,shared) - if shared then - pack(t,p.keys,p.hash,p.index) - elseif not t.packer then - pack(t,p.keys,p.hash,p.index) - if #p.index > 0 then - t.packer = { - version = p.version or packer.version, - keys = p.keys, - index = p.index, - } - end - p.hash, p.index = { }, { } + tobesaved.randomseed = rvalue + for cs, value in next, collected do + context.setxvalue(cs,value) end end -function packer.unpack(t,p,shared) - if shared then - if p then - unpack(t,p.keys,p.index) - end - else - local tp = t.packer - if tp then - if tp.version == (p and p.version or packer.version) then - unpack(t,tp.keys,tp.index) - else - -- fatal error, wrong version - end - t.packer = nil - end - end -end +job.register('job.variables.collected', tobesaved, initializer) -function packer.strip(p) - p.hash = nil +function jobvariables.save(cs,value) + tobesaved[cs] = value end local packlist = { @@ -195,17 +118,17 @@ local packlist = { "directives", "specification", "processors", -- might become key under directives or metadata --- "references", -- we need to rename of them as only one packs (not structure.lists.references) +-- "references", -- we need to rename of them as only one packs (not structures.lists.references) } -local jobpacker = packer.new(packlist,1.01) +local jobpacker = packers.new(packlist,1.01) job.pack = true -job._save_, job._load_ = { }, { } -- registers timing +local _save_, _load_ = { }, { } -- registers timing function job.save(filename) - statistics.starttiming(job._save_) + statistics.starttiming(_save_) local f = io.open(filename,'w') if f then for c=1,#comment do @@ -219,27 +142,27 @@ function job.save(filename) finalizer() end if job.pack then - packer.pack(data,jobpacker,true) + packers.pack(data,jobpacker,true) end - f:write(aux.definetable(target),"\n") - f:write(table.serialize(data,target,true,true),"\n") + f:write(definetable(target),"\n") + f:write(serialize(data,target,true,true),"\n") end if job.pack then - packer.strip(jobpacker) - f:write(table.serialize(jobpacker,"job.packer",true,true),"\n") + packers.strip(jobpacker) + f:write(serialize(jobpacker,"job.packed",true,true),"\n") end f:close() end - statistics.stoptiming(job._save_) + statistics.stoptiming(_save_) end function job.load(filename) - statistics.starttiming(job._load_) + statistics.starttiming(_load_) local data = io.loaddata(filename) if data and data ~= "" then local version = tonumber(match(data,"^-- version: ([%d%.]+)")) - if version ~= jobs.version then - logs.report("job","version mismatch with jobfile: %s <> %s", version or "?", jobs.version) + if version ~= job.version then + report_jobcontrol("version mismatch with jobfile: %s <> %s", version or "?", job.version) else local data = loadstring(data) if data then @@ -248,26 +171,27 @@ function job.load(filename) for l=1,#savelist do local list = savelist[l] local target, initializer = list[1], list[3] - packer.unpack(aux.accesstable(target),job.packer,true) + local result = mark(accesstable(target)) + packers.unpack(result,job.packed,true) if type(initializer) == "function" then - initializer(aux.accesstable(target)) + initializer(result) end end - job.packer = nil + job.packed = nil end end - statistics.stoptiming(job._load_) + statistics.stoptiming(_load_) end -- eventually this will end up in strc-ini statistics.register("startup time", function() - return statistics.elapsedseconds(ctx,"including runtime option file processing") + return statistics.elapsedseconds(statistics,"including runtime option file processing") end) statistics.register("jobdata time",function() - if statistics.elapsedindeed(job._save_) or statistics.elapsedindeed(job._load_) then - return format("%s seconds saving, %s seconds loading", statistics.elapsedtime(job._save_), statistics.elapsedtime(job._load_)) + if statistics.elapsedindeed(_save_) or statistics.elapsedindeed(_load_) then + return format("%s seconds saving, %s seconds loading", statistics.elapsedtime(_save_), statistics.elapsedtime(_load_)) end end) @@ -281,6 +205,12 @@ statistics.register("callbacks", function() end end) +statistics.register("randomizer", function() + if rmethod and rvalue then + return format("%s with value %s",rmethod,rvalue) + end +end) + function statistics.formatruntime(runtime) local shipped = tex.count['nofshipouts'] local pages = tex.count['realpageno'] - 1 diff --git a/Master/texmf-dist/tex/context/base/core-uti.mkiv b/Master/texmf-dist/tex/context/base/core-uti.mkiv index 6b2dae2c9c9..46a1e398af1 100644 --- a/Master/texmf-dist/tex/context/base/core-uti.mkiv +++ b/Master/texmf-dist/tex/context/base/core-uti.mkiv @@ -18,19 +18,7 @@ \registerctxluafile{core-uti}{1.001} \def\savecurrentvalue#1#2% - {\ctxlua{jobvariables.save("\strippedcsname#1","#2")}} - -\appendtoks - \ctxlua{storage.dump()}% will move to lua -\to \everydump - -\appendtoks - \ctxlua{storage.finalize()}% will move to lua -\to \everyfinalizeluacode - -\appendtoks - \ctxlua{nodes.cleanup_reserved()}% will move to lua -\to \everydump + {\ctxlua{job.variables.save("\strippedcsname#1","#2")}} \appendtoks \ctxlua { @@ -38,29 +26,20 @@ job.comment("format: \contextformat") job.comment("stamp: \contextversion") job.comment("escape: \!!bs\space...\space\!!es") - job.initialize("\jobname.tuc","\jobname.tua") }% \to \everystarttext -\def\notuccompression{\ctxlua{job.pack=false}} - -% cleaner, for the moment +\appendtoks + \ctxlua { + job.initialize("\jobname.tuc","\jobname.tua") + }% +\to \everyjob -% \appendtoks -% \ctxlua { -% os.remove("\jobname.tui") -% os.remove("\jobname.tuo") -% }% -% \to \everystarttext +\def\notuccompression{\ctxlua{job.pack=false}} %D Some styles might use these use these commands: -\newif \ifutilitydone -\let \checkutilities \relax -\let \currentutilityfilename \jobname -\def \installprogram {\dosingleempty\doinstallprogram} -\def \doinstallprogram [#1]{\gobbleoneargument} -\def \installedprogram [#1]{} -\let \installplugin \gobblethreearguments +\def\installprogram {\dosingleempty\doinstallprogram} +\def\doinstallprogram[#1]{\gobbleoneargument} \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/core-var.mkiv b/Master/texmf-dist/tex/context/base/core-var.mkiv index 62cc9fc5003..45a593ee750 100644 --- a/Master/texmf-dist/tex/context/base/core-var.mkiv +++ b/Master/texmf-dist/tex/context/base/core-var.mkiv @@ -138,30 +138,13 @@ \unexpanded\def\starttextproperties{\the\everystarttextproperties} \unexpanded\def\stoptextproperties {\the\everystoptextproperties} -%D \macros -%D {defineinputmode,setinputmode} -%D -%D New. Some work needs to be done. - -% not in mkiv - -\unexpanded\def\defineinputmode[#1]{\@EA\newtoks\csname every#1inputmode\endcsname} -\def\setinputmode [#1]{\the\executeifdefined{every#1inputmode}\emptytoks} - -\defineinputmode [TEX] -\defineinputmode [XML] - -\setinputmode [TEX] - %D \macros %D {trialtypesetting} %D %D We disable trial typesetting in the output routine, %D just to be sure. -\newif\iftrialtypesetting - -\prependtoks \trialtypesettingfalse \to \everybeforepagebody +\prependtoks \resettrialtypesetting \to \everybeforepagebody %D \macros %D {ifinpagebody,ifinsidecolumns,ifdoublesided,ifsinglesided} @@ -179,7 +162,7 @@ %D %D We need this one even if no \XML\ is supported. -\newif\ifprocessingXML % old way +% \newif\ifprocessingXML % old way %D \macros %D {ifproductionrun} @@ -258,7 +241,7 @@ %D Concepts: -\chardef\conceptmode\zerocount +\newconstant\conceptmode \def\doifconcepttracing {\ifnum\conceptmode>\plustwo diff --git a/Master/texmf-dist/tex/context/base/data-aux.lua b/Master/texmf-dist/tex/context/base/data-aux.lua index 26e1f551cb0..058033afe09 100644 --- a/Master/texmf-dist/tex/context/base/data-aux.lua +++ b/Master/texmf-dist/tex/context/base/data-aux.lua @@ -7,49 +7,54 @@ if not modules then modules = { } end modules ['data-aux'] = { } local find = string.find +local type, next = type, next local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) -function resolvers.update_script(oldname,newname) -- oldname -> own.name, not per se a suffix +local resolvers = resolvers + +local report_scripts = logs.reporter("resolvers","scripts") + +function resolvers.updatescript(oldname,newname) -- oldname -> own.name, not per se a suffix local scriptpath = "scripts/context/lua" newname = file.addsuffix(newname,"lua") - local oldscript = resolvers.clean_path(oldname) + local oldscript = resolvers.cleanpath(oldname) if trace_locating then - logs.report("fileio","to be replaced old script %s", oldscript) + report_scripts("to be replaced old script %s", oldscript) end - local newscripts = resolvers.find_files(newname) or { } + local newscripts = resolvers.findfiles(newname) or { } if #newscripts == 0 then if trace_locating then - logs.report("fileio","unable to locate new script") + report_scripts("unable to locate new script") end else for i=1,#newscripts do - local newscript = resolvers.clean_path(newscripts[i]) + local newscript = resolvers.cleanpath(newscripts[i]) if trace_locating then - logs.report("fileio","checking new script %s", newscript) + report_scripts("checking new script %s", newscript) end if oldscript == newscript then if trace_locating then - logs.report("fileio","old and new script are the same") + report_scripts("old and new script are the same") end elseif not find(newscript,scriptpath) then if trace_locating then - logs.report("fileio","new script should come from %s",scriptpath) + report_scripts("new script should come from %s",scriptpath) end elseif not (find(oldscript,file.removesuffix(newname).."$") or find(oldscript,newname.."$")) then if trace_locating then - logs.report("fileio","invalid new script name") + report_scripts("invalid new script name") end else local newdata = io.loaddata(newscript) if newdata then if trace_locating then - logs.report("fileio","old script content replaced by new content") + report_scripts("old script content replaced by new content") end io.savedata(oldscript,newdata) break elseif trace_locating then - logs.report("fileio","unable to load new script") + report_scripts("unable to load new script") end end end diff --git a/Master/texmf-dist/tex/context/base/data-bin.lua b/Master/texmf-dist/tex/context/base/data-bin.lua index 5e4397a549f..b18526c77b7 100644 --- a/Master/texmf-dist/tex/context/base/data-bin.lua +++ b/Master/texmf-dist/tex/context/base/data-bin.lua @@ -6,22 +6,22 @@ if not modules then modules = { } end modules ['data-bin'] = { license = "see context related readme files" } -local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders -local unpack = unpack or table.unpack +local resolvers = resolvers +local methodhandler = resolvers.methodhandler -function resolvers.findbinfile(filename, filetype) - return resolvers.methodhandler('finders',filename, filetype) +function resolvers.findbinfile(filename,filetype) + return methodhandler('finders',filename,filetype) end function resolvers.openbinfile(filename) - return resolvers.methodhandler('loaders',filename) + return methodhandler('loaders',filename) end -function resolvers.loadbinfile(filename, filetype) - local fname = resolvers.methodhandler('finders',filename, filetype) +function resolvers.loadbinfile(filename,filetype) + local fname = methodhandler('finders',filename,filetype) if fname and fname ~= "" then return resolvers.openbinfile(fname) else - return unpack(loaders.notfound) + return resolvers.loaders.notfound() end end diff --git a/Master/texmf-dist/tex/context/base/data-con.lua b/Master/texmf-dist/tex/context/base/data-con.lua index fabe0baa1b7..ed4f2dec093 100644 --- a/Master/texmf-dist/tex/context/base/data-con.lua +++ b/Master/texmf-dist/tex/context/base/data-con.lua @@ -1,5 +1,5 @@ if not modules then modules = { } end modules ['data-con'] = { - version = 1.001, + version = 1.100, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", @@ -25,50 +25,63 @@ table structures without bothering about the disk cache.

Examples of usage can be found in the font related code.

--ldx]]-- -containers = containers or { } - +containers = containers or { } +local containers = containers containers.usecache = true +local report_containers = logs.reporter("resolvers","containers") + local function report(container,tag,name) if trace_cache or trace_containers then - logs.report(format("%s cache",container.subcategory),"%s: %s",tag,name or 'invalid') + report_containers("container: %s, tag: %s, name: %s",container.subcategory,tag,name or 'invalid') end end local allocated = { } --- tracing +local mt = { + __index = function(t,k) + if k == "writable" then + local writable = caches.getwritablepath(t.category,t.subcategory) or { "." } + t.writable = writable + return writable + elseif k == "readables" then + local readables = caches.getreadablepaths(t.category,t.subcategory) or { "." } + t.readables = readables + return readables + end + end, + __storage__ = true +} function containers.define(category, subcategory, version, enabled) - return function() - if category and subcategory then - local c = allocated[category] - if not c then - c = { } - allocated[category] = c - end - local s = c[subcategory] - if not s then - s = { - category = category, - subcategory = subcategory, - storage = { }, - enabled = enabled, - version = version or 1.000, - trace = false, - path = caches and caches.setpath and caches.setpath(category,subcategory), - } - c[subcategory] = s - end - return s - else - return nil + if category and subcategory then + local c = allocated[category] + if not c then + c = { } + allocated[category] = c + end + local s = c[subcategory] + if not s then + s = { + category = category, + subcategory = subcategory, + storage = { }, + enabled = enabled, + version = version or math.pi, -- after all, this is TeX + trace = false, + -- writable = caches.getwritablepath and caches.getwritablepath (category,subcategory) or { "." }, + -- readables = caches.getreadablepaths and caches.getreadablepaths(category,subcategory) or { "." }, + } + setmetatable(s,mt) + c[subcategory] = s end + return s end end function containers.is_usable(container, name) - return container.enabled and caches and caches.iswritable(container.path, name) + return container.enabled and caches and caches.is_writable(container.writable, name) end function containers.is_valid(container, name) @@ -81,18 +94,20 @@ function containers.is_valid(container, name) end function containers.read(container,name) - if container.enabled and caches and not container.storage[name] and containers.usecache then - container.storage[name] = caches.loaddata(container.path,name) - if containers.is_valid(container,name) then + local storage = container.storage + local stored = storage[name] + if not stored and container.enabled and caches and containers.usecache then + stored = caches.loaddata(container.readables,name) + if stored and stored.cache_version == container.version then report(container,"loaded",name) else - container.storage[name] = nil + stored = nil end - end - if container.storage[name] then + storage[name] = stored + elseif stored then report(container,"reusing",name) end - return container.storage[name] + return stored end function containers.write(container, name, data) @@ -101,7 +116,7 @@ function containers.write(container, name, data) if container.enabled and caches then local unique, shared = data.unique, data.shared data.unique, data.shared = nil, nil - caches.savedata(container.path, name, data) + caches.savedata(container.writable, name, data) report(container,"saved",name) data.unique, data.shared = unique, shared end diff --git a/Master/texmf-dist/tex/context/base/data-crl.lua b/Master/texmf-dist/tex/context/base/data-crl.lua index 55b1a8fad9d..445bd5b0a70 100644 --- a/Master/texmf-dist/tex/context/base/data-crl.lua +++ b/Master/texmf-dist/tex/context/base/data-crl.lua @@ -6,55 +6,56 @@ if not modules then modules = { } end modules ['data-crl'] = { license = "see context related readme files" } -local gsub = string.gsub +-- this one is replaced by data-sch.lua -- -curl = curl or { } +local gsub = string.gsub -curl.cached = { } -curl.cachepath = caches.definepath("curl") +local resolvers = resolvers local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders -function curl.fetch(protocol, name) - local cachename = curl.cachepath() .. "/" .. gsub(name,"[^%a%d%.]+","-") --- cachename = gsub(cachename,"[\\/]", io.fileseparator) - cachename = gsub(cachename,"[\\]", "/") -- cleanup - if not curl.cached[name] then +resolvers.curl = resolvers.curl or { } +local curl = resolvers.curl + +local cached = { } + +local function runcurl(specification) + local original = specification.original + -- local scheme = specification.scheme + local cleanname = gsub(original,"[^%a%d%.]+","-") + local cachename = caches.setfirstwritablefile(cleanname,"curl") + if not cached[original] then if not io.exists(cachename) then - curl.cached[name] = cachename - local command = "curl --silent --create-dirs --output " .. cachename .. " " .. name -- no protocol .. "://" + cached[original] = cachename + local command = "curl --silent --create-dirs --output " .. cachename .. " " .. original os.spawn(command) end if io.exists(cachename) then - curl.cached[name] = cachename + cached[original] = cachename else - curl.cached[name] = "" + cached[original] = "" end end - return curl.cached[name] + return cached[original] end -function finders.curl(protocol,filename) - local foundname = curl.fetch(protocol, filename) - return finders.generic(protocol,foundname,filetype) -end - -function openers.curl(protocol,filename) - return openers.generic(protocol,filename) -end +-- old code: we could be cleaner using specification (see schemes) -function loaders.curl(protocol,filename) - return loaders.generic(protocol,filename) +local function finder(specification,filetype) + return resolvers.methodhandler("finders",runcurl(specification),filetype) end --- todo: metamethod +local opener = openers.file +local loader = loaders.file -function curl.install(protocol) - finders[protocol] = function (filename,filetype) return finders.curl(protocol,filename) end - openers[protocol] = function (filename) return openers.curl(protocol,filename) end - loaders[protocol] = function (filename) return loaders.curl(protocol,filename) end +local function install(scheme) + finders[scheme] = finder + openers[scheme] = opener + loaders[scheme] = loader end -curl.install('http') -curl.install('https') -curl.install('ftp') +resolvers.curl.install = install + +install('http') +install('https') +install('ftp') diff --git a/Master/texmf-dist/tex/context/base/data-ctx.lua b/Master/texmf-dist/tex/context/base/data-ctx.lua index 89eb2742d68..345e9c7411a 100644 --- a/Master/texmf-dist/tex/context/base/data-ctx.lua +++ b/Master/texmf-dist/tex/context/base/data-ctx.lua @@ -6,26 +6,4 @@ if not modules then modules = { } end modules ['data-ctx'] = { license = "see context related readme files" } -local format = string.format - -function resolvers.save_used_files_in_trees(filename,jobname) - if not filename then filename = 'luatex.jlg' end - local found = instance.foundintrees - local f = io.open(filename,'w') - if f then - f:write("\n") - f:write("\n") - if jobname then - f:write(format("\t%s\n",jobname)) - end - f:write("\t\n") - local sorted = table.sortedkeys(found) - for k=1,#sorted do - local v = sorted[k] - f:write(format("\t\t%s\n",found[v],v)) - end - f:write("\t\n") - f:write("\n") - f:close() - end -end +-- empty diff --git a/Master/texmf-dist/tex/context/base/data-env.lua b/Master/texmf-dist/tex/context/base/data-env.lua new file mode 100644 index 00000000000..108858ccc14 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/data-env.lua @@ -0,0 +1,289 @@ +if not modules then modules = { } end modules ['data-env'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +local lower, gsub = string.lower, string.gsub + +local resolvers = resolvers + +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex +local fileextname = file.extname + +local formats = allocate() +local suffixes = allocate() +local dangerous = allocate() +local suffixmap = allocate() + +resolvers.formats = formats +resolvers.suffixes = suffixes +resolvers.dangerous = dangerous +resolvers.suffixmap = suffixmap + +local relations = allocate { -- todo: handlers also here + core = { + ofm = { -- will become obsolete + names = { "ofm", "omega font metric", "omega font metrics" }, + variable = 'OFMFONTS', + suffixes = { 'ofm', 'tfm' }, + }, + ovf = { -- will become obsolete + names = { "ovf", "omega virtual font", "omega virtual fonts" }, + variable = 'OVFFONTS', + suffixes = { 'ovf', 'vf' }, + }, + tfm = { + names = { "tfm", "tex font metric", "tex font metrics" }, + variable = 'TFMFONTS', + suffixes = { 'tfm' }, + }, + vf = { + names = { "vf", "virtual font", "virtual fonts" }, + variable = 'VFFONTS', + suffixes = { 'vf' }, + }, + otf = { + names = { "otf", "opentype", "opentype font", "opentype fonts"}, + variable = 'OPENTYPEFONTS', + suffixes = { 'otf' }, + }, + ttf = { + names = { "ttf", "truetype", "truetype font", "truetype fonts", "truetype collection", "truetype collections", "truetype dictionary", "truetype dictionaries" }, + variable = 'TTFONTS', + suffixes = { 'ttf', 'ttc', 'dfont' }, + }, + afm = { + names = { "afm", "adobe font metric", "adobe font metrics" }, + variable = "AFMFONTS", + suffixes = { "afm" }, + }, + pfb = { + names = { "pfb", "type1", "type 1", "type1 font", "type 1 font", "type1 fonts", "type 1 fonts" }, + variable = 'T1FONTS', + suffixes = { 'pfb', 'pfa' }, + }, + fea = { + names = { "fea", "font feature", "font features", "font feature file", "font feature files" }, + variable = 'FONTFEATURES', + suffixes = { 'fea' }, + }, + cid = { + names = { "cid", "cid map", "cid maps", "cid file", "cid files" }, + variable = 'FONTCIDMAPS', + suffixes = { 'cid', 'cidmap' }, + }, + fmt = { + names = { "fmt", "format", "tex format" }, + variable = 'TEXFORMATS', + suffixes = { 'fmt' }, + }, + mem = { -- will become obsolete + names = { 'mem', "metapost format" }, + variable = 'MPMEMS', + suffixes = { 'mem' }, + }, + mp = { + names = { "mp" }, + variable = 'MPINPUTS', + suffixes = { 'mp' }, + }, + tex = { + names = { "tex" }, + variable = 'TEXINPUTS', + suffixes = { 'tex', "mkiv", "mkiv", "mkii" }, + }, + icc = { + names = { "icc", "icc profile", "icc profiles" }, + variable = 'ICCPROFILES', + suffixes = { 'icc' }, + }, + texmfscripts = { + names = { "texmfscript", "texmfscripts", "script", "scripts" }, + variable = 'TEXMFSCRIPTS', + suffixes = { 'rb', 'pl', 'py' }, + }, + lua = { + names = { "lua" }, + variable = 'LUAINPUTS', + suffixes = { 'lua', 'luc', 'tma', 'tmc' }, + }, + lib = { + names = { "lib" }, + variable = 'CLUAINPUTS', + suffixes = os.libsuffix and { os.libsuffix } or { 'dll', 'so' }, + }, + bib = { + names = { 'bib' }, + suffixes = { 'bib' }, + }, + bst = { + names = { 'bst' }, + suffixes = { 'bst' }, + }, + fontconfig = { + names = { 'fontconfig', 'fontconfig file', 'fontconfig files' }, + variable = 'FONTCONFIG_PATH', + }, + }, + obsolete = { + enc = { + names = { "enc", "enc files", "enc file", "encoding files", "encoding file" }, + variable = 'ENCFONTS', + suffixes = { 'enc' }, + }, + map = { + names = { "map", "map files", "map file" }, + variable = 'TEXFONTMAPS', + suffixes = { 'map' }, + }, + lig = { + names = { "lig files", "lig file", "ligature file", "ligature files" }, + variable = 'LIGFONTS', + suffixes = { 'lig' }, + }, + opl = { + names = { "opl" }, + variable = 'OPLFONTS', + suffixes = { 'opl' }, + }, + ovp = { + names = { "ovp" }, + variable = 'OVPFONTS', + suffixes = { 'ovp' }, + }, + }, + kpse = { -- subset + base = { + names = { 'base', "metafont format" }, + variable = 'MFBASES', + suffixes = { 'base', 'bas' }, + }, + cmap = { + names = { 'cmap', 'cmap files', 'cmap file' }, + variable = 'CMAPFONTS', + suffixes = { 'cmap' }, + }, + cnf = { + names = { 'cnf' }, + suffixes = { 'cnf' }, + }, + web = { + names = { 'web' }, + suffixes = { 'web', 'ch' } + }, + cweb = { + names = { 'cweb' }, + suffixes = { 'w', 'web', 'ch' }, + }, + gf = { + names = { 'gf' }, + suffixes = { 'gf' }, + }, + mf = { + names = { 'mf' }, + variable = 'MFINPUTS', + suffixes = { 'mf' }, + }, + mft = { + names = { 'mft' }, + suffixes = { 'mft' }, + }, + pk = { + names = { 'pk' }, + suffixes = { 'pk' }, + }, + }, +} + +resolvers.relations = relations + +-- formats: maps a format onto a variable + +function resolvers.updaterelations() + for category, categories in next, relations do + for name, relation in next, categories do + local rn = relation.names + local rv = relation.variable + local rs = relation.suffixes + if rn and rv then + for i=1,#rn do + local rni = lower(gsub(rn[i]," ","")) + formats[rni] = rv + if rs then + suffixes[rni] = rs + for i=1,#rs do + local rsi = rs[i] + suffixmap[rsi] = rni + end + end + end + end + if rs then + end + end + end +end + +resolvers.updaterelations() -- push this in the metatable -> newindex + +local function simplified(t,k) + return rawget(t,lower(gsub(k," ",""))) +end + +setmetatableindex(formats, simplified) +setmetatableindex(suffixes, simplified) +setmetatableindex(suffixmap, simplified) + +-- A few accessors, mostly for command line tool. + +function resolvers.suffixofformat(str) + local s = suffixes[str] + return s and s[1] or "" +end + +function resolvers.suffixofformat(str) + return suffixes[str] or { } +end + +for name, format in next, formats do + dangerous[name] = true -- still needed ? +end + +-- because vf searching is somewhat dangerous, we want to prevent +-- too liberal searching esp because we do a lookup on the current +-- path anyway; only tex (or any) is safe + +dangerous.tex = nil + +--~ print(table.serialize(dangerous)) + +-- more helpers + +function resolvers.formatofvariable(str) + return formats[str] or '' +end + +function resolvers.formatofsuffix(str) -- of file + return suffixmap[fileextname(str)] or 'tex' -- so many map onto tex (like mkiv, cld etc) +end + +function resolvers.variableofformat(str) + return formats[str] or '' +end + +function resolvers.variableofformatorsuffix(str) + local v = formats[str] + if v then + return v + end + v = suffixmap[fileextname(str)] + if v then + return formats[v] + end + return '' +end + diff --git a/Master/texmf-dist/tex/context/base/data-exp.lua b/Master/texmf-dist/tex/context/base/data-exp.lua new file mode 100644 index 00000000000..e8138968252 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/data-exp.lua @@ -0,0 +1,330 @@ +if not modules then modules = { } end modules ['data-exp'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +local format, find, gmatch, lower = string.format, string.find, string.gmatch, string.lower +local concat, sort = table.concat, table.sort +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns +local Ct, Cs, Cc, P, C, S = lpeg.Ct, lpeg.Cs, lpeg.Cc, lpeg.P, lpeg.C, lpeg.S +local type, next = type, next + +local ostype = os.type +local collapsepath = file.collapsepath + +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end) + +local report_expansions = logs.reporter("resolvers","expansions") + +local resolvers = resolvers + +-- As this bit of code is somewhat special it gets its own module. After +-- all, when working on the main resolver code, I don't want to scroll +-- past this every time. See data-obs.lua for the gsub variant. + +-- {a,b,c,d} +-- a,b,c/{p,q,r},d +-- a,b,c/{p,q,r}/d/{x,y,z}// +-- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} +-- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} +-- a{b,c}{d,e}f +-- {a,b,c,d} +-- {a,b,c/{p,q,r},d} +-- {a,b,c/{p,q,r}/d/{x,y,z}//} +-- {a,b,c/{p,q/{x,y,z}},d/{p,q,r}} +-- {a,b,c/{p,q/{x,y,z},w}v,d/{p,q,r}} +-- {$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c} + +local function f_first(a,b) + local t, n = { }, 0 + for s in gmatch(b,"[^,]+") do + n = n + 1 ; t[n] = a .. s + end + return concat(t,",") +end + +local function f_second(a,b) + local t, n = { }, 0 + for s in gmatch(a,"[^,]+") do + n = n + 1 ; t[n] = s .. b + end + return concat(t,",") +end + +local function f_both(a,b) + local t, n = { }, 0 + for sa in gmatch(a,"[^,]+") do + for sb in gmatch(b,"[^,]+") do + n = n + 1 ; t[n] = sa .. sb + end + end + return concat(t,",") +end + +local left = P("{") +local right = P("}") +local var = P((1 - S("{}" ))^0) +local set = P((1 - S("{},"))^0) +local other = P(1) + +local l_first = Cs( ( Cc("{") * (C(set) * left * C(var) * right / f_first) * Cc("}") + other )^0 ) +local l_second = Cs( ( Cc("{") * (left * C(var) * right * C(set) / f_second) * Cc("}") + other )^0 ) +local l_both = Cs( ( Cc("{") * (left * C(var) * right * left * C(var) * right / f_both) * Cc("}") + other )^0 ) +local l_rest = Cs( ( left * var * (left/"") * var * (right/"") * var * right + other )^0 ) + +local stripper_1 = lpeg.stripper ("{}@") +local replacer_1 = lpeg.replacer { { ",}", ",@}" }, { "{,", "{@," }, } + +local function splitpathexpr(str, newlist, validate) -- I couldn't resist lpegging it (nice exercise). + if trace_expansions then + report_expansions("expanding variable '%s'",str) + end + local t, ok, done = newlist or { }, false, false + local n = #t + str = lpegmatch(replacer_1,str) + repeat local old = str + repeat local old = str ; str = lpegmatch(l_first, str) until old == str + repeat local old = str ; str = lpegmatch(l_second,str) until old == str + repeat local old = str ; str = lpegmatch(l_both, str) until old == str + repeat local old = str ; str = lpegmatch(l_rest, str) until old == str + until old == str -- or not find(str,"{") + str = lpegmatch(stripper_1,str) + if validate then + for s in gmatch(str,"[^,]+") do + s = validate(s) + if s then + n = n + 1 ; t[n] = s + end + end + else + for s in gmatch(str,"[^,]+") do + n = n + 1 ; t[n] = s + end + end + if trace_expansions then + for k=1,#t do + report_expansions("% 4i: %s",k,t[k]) + end + end + return t +end + +-- We could make the previous one public. + +local function validate(s) + s = collapsepath(s) -- already keeps the // + return s ~= "" and not find(s,"^!*unset/*$") and s +end + +resolvers.validatedpath = validate -- keeps the trailing // + +function resolvers.expandedpathfromlist(pathlist) + local newlist = { } + for k=1,#pathlist do + splitpathexpr(pathlist[k],newlist,validate) + end + return newlist +end + +local cleanup = lpeg.replacer { + { "!" , "" }, + { "\\" , "/" }, +} + +local homedir + +function resolvers.cleanpath(str) + if not homedir then + homedir = lpegmatch(cleanup,environment.homedir or "") + if homedir == string.char(127) or homedir == "" or not lfs.isdir(homedir) then + if trace_expansions then + report_expansions("no home dir set, ignoring dependent paths") + end + function resolvers.cleanpath(str) + if find(str,"~") then + return "" -- special case + else + return str and lpegmatch(cleanup,str) + end + end + else + cleanup = lpeg.replacer { + { "!" , "" }, + { "\\" , "/" }, + { "~" , homedir }, + } + function resolvers.cleanpath(str) + return str and lpegmatch(cleanup,str) + end + end + end + return resolvers.cleanpath(str) +end + +-- This one strips quotes and funny tokens. + +local expandhome = P("~") / "$HOME" -- environment.homedir + +local dodouble = P('"')/"" * (expandhome + (1 - P('"')))^0 * P('"')/"" +local dosingle = P("'")/"" * (expandhome + (1 - P("'")))^0 * P("'")/"" +local dostring = (expandhome + 1 )^0 + +local stripper = Cs( + lpegpatterns.unspacer * (dosingle + dodouble + dostring) * lpegpatterns.unspacer +) + +function resolvers.checkedvariable(str) -- assumes str is a string + return lpegmatch(stripper,str) or str +end + +-- The path splitter: + +-- A config (optionally) has the paths split in tables. Internally +-- we join them and split them after the expansion has taken place. This +-- is more convenient. + +local cache = { } + +---- splitter = Ct(lpeg.splitat(S(ostype == "windows" and ";" or ":;"))) -- maybe add , +local splitter = Ct(lpeg.splitat(";")) -- as we move towards urls, prefixes and use tables we no longer do : + +local backslashswapper = lpeg.replacer("\\","/") + +local function splitconfigurationpath(str) -- beware, this can be either a path or a { specification } + if str then + local found = cache[str] + if not found then + if str == "" then + found = { } + else + local split = lpegmatch(splitter,lpegmatch(backslashswapper,str)) -- can be combined + found = { } + local noffound = 0 + for i=1,#split do + local s = split[i] + if not find(s,"^{*unset}*") then + noffound = noffound + 1 + found[noffound] = s + end + end + if trace_expansions then + report_expansions("splitting path specification '%s'",str) + for k=1,noffound do + report_expansions("% 4i: %s",k,found[k]) + end + end + cache[str] = found + end + end + return found + end +end + +resolvers.splitconfigurationpath = splitconfigurationpath + +function resolvers.splitpath(str) + if type(str) == 'table' then + return str + else + return splitconfigurationpath(str) + end +end + +function resolvers.joinpath(str) + if type(str) == 'table' then + return file.joinpath(str) + else + return str + end +end + +-- The next function scans directories and returns a hash where the +-- entries are either strings or tables. + +-- starting with . or .. etc or funny char + +--~ local l_forbidden = S("~`!#$%^&*()={}[]:;\"\'||\\/<>,?\n\r\t") +--~ local l_confusing = P(" ") +--~ local l_character = lpegpatterns.utf8 +--~ local l_dangerous = P(".") + +--~ local l_normal = (l_character - l_forbidden - l_confusing - l_dangerous) * (l_character - l_forbidden - l_confusing^2)^0 * P(-1) +--~ ----- l_normal = l_normal * Cc(true) + Cc(false) + +--~ local function test(str) +--~ print(str,lpegmatch(l_normal,str)) +--~ end +--~ test("ヒラギノ明朝 Pro W3") +--~ test("..ヒラギノ明朝 Pro W3") +--~ test(":ヒラギノ明朝 Pro W3;") +--~ test("ヒラギノ明朝 /Pro W3;") +--~ test("ヒラギノ明朝 Pro W3") + +local weird = P(".")^1 + lpeg.anywhere(S("~`!#$%^&*()={}[]:;\"\'||<>,?\n\r\t")) + +local attributes, directory = lfs.attributes, lfs.dir + +local function scan(files,spec,path,n,m,r) + local full = (path == "" and spec) or (spec .. path .. '/') + local dirs, nofdirs = { }, 0 + for name in directory(full) do + if not lpegmatch(weird,name) then + local mode = attributes(full..name,'mode') + if mode == 'file' then + n = n + 1 + local f = files[name] + if f then + if type(f) == 'string' then + files[name] = { f, path } + else + f[#f+1] = path + end + else -- probably unique anyway + files[name] = path + local lower = lower(name) + if name ~= lower then + files["remap:"..lower] = name + r = r + 1 + end + end + elseif mode == 'directory' then + m = m + 1 + nofdirs = nofdirs + 1 + if path ~= "" then + dirs[nofdirs] = path..'/'..name + else + dirs[nofdirs] = name + end + end + end + end + if nofdirs > 0 then + sort(dirs) + for i=1,nofdirs do + files, n, m, r = scan(files,spec,dirs[i],n,m,r) + end + end + return files, n, m, r +end + +function resolvers.scanfiles(path,branch) + if trace_locating then + report_expansions("scanning path '%s', branch '%s'",path, branch or path) + end + local realpath = resolvers.resolve(path) -- no shortcut + local files, n, m, r = scan({ },realpath .. '/',"",0,0,0) + files.__path__ = path -- can be selfautoparent:texmf-whatever + files.__files__ = n + files.__directories__ = m + files.__remappings__ = r + if trace_locating then + report_expansions("%s files found on %s directories with %s uppercase remappings",n,m,r) + end + return files +end + +--~ print(table.serialize(resolvers.scanfiles("t:/sources"))) diff --git a/Master/texmf-dist/tex/context/base/data-fil.lua b/Master/texmf-dist/tex/context/base/data-fil.lua new file mode 100644 index 00000000000..0e82008f35e --- /dev/null +++ b/Master/texmf-dist/tex/context/base/data-fil.lua @@ -0,0 +1,112 @@ +if not modules then modules = { } end modules ['data-fil'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) + +local report_files = logs.reporter("resolvers","files") + +local resolvers = resolvers + +local finders, openers, loaders, savers = resolvers.finders, resolvers.openers, resolvers.loaders, resolvers.savers +local locators, hashers, generators, concatinators = resolvers.locators, resolvers.hashers, resolvers.generators, resolvers.concatinators + +local checkgarbage = utilities.garbagecollector and utilities.garbagecollector.check + +function locators.file(specification) + local name = specification.filename + local realname = resolvers.resolve(name) -- no shortcut + if realname and realname ~= '' and lfs.isdir(realname) then + if trace_locating then + report_files("file locator '%s' found as '%s'",name,realname) + end + resolvers.appendhash('file',name,true) -- cache + elseif trace_locating then + report_files("file locator '%s' not found",name) + end +end + +function hashers.file(specification) + local name = specification.filename + local content = caches.loadcontent(name,'files') + resolvers.registerfilehash(name,content,content==nil) +end + +function generators.file(specification) + local path = specification.filename + local content = resolvers.scanfiles(path) + resolvers.registerfilehash(path,content,true) +end + +concatinators.file = file.join + +function finders.file(specification,filetype) + local filename = specification.filename + local foundname = resolvers.findfile(filename,filetype) + if foundname and foundname ~= "" then + if trace_locating then + report_files("file finder: '%s' found",filename) + end + return foundname + else + if trace_locating then + report_files("file finder: %s' not found",filename) + end + return finders.notfound() + end +end + +-- The default textopener will be overloaded later on. + +function openers.helpers.textopener(tag,filename,f) + return { + reader = function() return f:read () end, + close = function() logs.show_close(filename) return f:close() end, + } +end + +function openers.file(specification,filetype) + local filename = specification.filename + if filename and filename ~= "" then + local f = io.open(filename,"r") + if f then + if trace_locating then + report_files("file opener, '%s' opened",filename) + end + return openers.helpers.textopener("file",filename,f) + end + end + if trace_locating then + report_files("file opener, '%s' not found",filename) + end + return openers.notfound() +end + +function loaders.file(specification,filetype) + local filename = specification.filename + if filename and filename ~= "" then + local f = io.open(filename,"rb") + if f then + logs.show_load(filename) + if trace_locating then + report_files("file loader, '%s' loaded",filename) + end + local s = f:read("*a") + if checkgarbage then + checkgarbage(#s) + end + f:close() + if s then + return true, s, #s + end + end + end + if trace_locating then + report_files("file loader, '%s' not found",filename) + end + return loaders.notfound() +end diff --git a/Master/texmf-dist/tex/context/base/data-ini.lua b/Master/texmf-dist/tex/context/base/data-ini.lua new file mode 100644 index 00000000000..7b114e47b6b --- /dev/null +++ b/Master/texmf-dist/tex/context/base/data-ini.lua @@ -0,0 +1,229 @@ +if not modules then modules = { } end modules ['data-ini'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +local gsub, find, gmatch = string.gsub, string.find, string.gmatch +local concat = table.concat +local next, type = next, type + +local filedirname, filebasename, fileextname, filejoin = file.dirname, file.basename, file.extname, file.join + +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_detail = false trackers.register("resolvers.details", function(v) trace_detail = v end) +local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end) + +local report_initialization = logs.reporter("resolvers","initialization") + +local ostype, osname, ossetenv, osgetenv = os.type, os.name, os.setenv, os.getenv + +-- The code here used to be part of a data-res but for convenience +-- we now split it over multiple files. As this file is now the +-- starting point we introduce resolvers here. + +resolvers = resolvers or { } +local resolvers = resolvers + +-- We don't want the kpse library to kick in. Also, we want to be able to +-- execute programs. Control over execution is implemented later. + +texconfig.kpse_init = false +texconfig.shell_escape = 't' + +kpse = { original = kpse } + +setmetatable(kpse, { + __index = function(kp,name) + report_initialization("fatal error: kpse library is accessed (key: %s)",name) + os.exit() + end +} ) + +-- First we check a couple of environment variables. Some might be +-- set already but we need then later on. We start with the system +-- font path. + +do + + local osfontdir = osgetenv("OSFONTDIR") + + if osfontdir and osfontdir ~= "" then + -- ok + elseif osname == "windows" then + ossetenv("OSFONTDIR","c:/windows/fonts//") + elseif osname == "macosx" then + ossetenv("OSFONTDIR","$HOME/Library/Fonts//;/Library/Fonts//;/System/Library/Fonts//") + end + +end + +-- Next comes the user's home path. We need this as later on we have +-- to replace ~ with its value. + +do + + local homedir = osgetenv(ostype == "windows" and 'USERPROFILE' or 'HOME') or '' + + if not homedir or homedir == "" then + homedir = string.char(127) -- we need a value, later we wil trigger on it + end + + homedir = file.collapsepath(homedir) + + ossetenv("HOME", homedir) -- can be used in unix cnf files + ossetenv("USERPROFILE",homedir) -- can be used in windows cnf files + + environment.homedir = homedir + +end + +-- The following code sets the name of the own binary and its +-- path. This is fallback code as we have os.selfdir now. + +do + + local args = environment.originalarguments or arg -- this needs a cleanup + + local ownbin = environment.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex" + local ownpath = environment.ownpath or os.selfdir + + ownbin = file.collapsepath(ownbin) + ownpath = file.collapsepath(ownpath) + + if not ownpath or ownpath == "" or ownpath == "unset" then + ownpath = args[-1] or arg[-1] + ownpath = ownpath and filedirname(gsub(ownpath,"\\","/")) + if not ownpath or ownpath == "" then + ownpath = args[-0] or arg[-0] + ownpath = ownpath and filedirname(gsub(ownpath,"\\","/")) + end + local binary = ownbin + if not ownpath or ownpath == "" then + ownpath = ownpath and filedirname(binary) + end + if not ownpath or ownpath == "" then + if os.binsuffix ~= "" then + binary = file.replacesuffix(binary,os.binsuffix) + end + local path = osgetenv("PATH") + if path then + for p in gmatch(path,"[^"..io.pathseparator.."]+") do + local b = filejoin(p,binary) + if lfs.isfile(b) then + -- we assume that after changing to the path the currentdir function + -- resolves to the real location and use this side effect here; this + -- trick is needed because on the mac installations use symlinks in the + -- path instead of real locations + local olddir = lfs.currentdir() + if lfs.chdir(p) then + local pp = lfs.currentdir() + if trace_locating and p ~= pp then + report_initialization("following symlink '%s' to '%s'",p,pp) + end + ownpath = pp + lfs.chdir(olddir) + else + if trace_locating then + report_initialization("unable to check path '%s'",p) + end + ownpath = p + end + break + end + end + end + end + if not ownpath or ownpath == "" then + ownpath = "." + report_initialization("forcing fallback ownpath .") + elseif trace_locating then + report_initialization("using ownpath '%s'",ownpath) + end + end + + environment.ownbin = ownbin + environment.ownpath = ownpath + +end + +resolvers.ownpath = environment.ownpath + +function resolvers.getownpath() + return environment.ownpath +end + +-- The self variables permit us to use only a few (or even no) +-- environment variables. + +do + + local ownpath = environment.ownpath or dir.current() + + if ownpath then + ossetenv('SELFAUTOLOC', file.collapsepath(ownpath)) + ossetenv('SELFAUTODIR', file.collapsepath(ownpath .. "/..")) + ossetenv('SELFAUTOPARENT', file.collapsepath(ownpath .. "/../..")) + else + report_initialization("error: unable to locate ownpath") + os.exit() + end + +end + +-- The running os: + +-- todo: check is context sits here os.platform is more trustworthy +-- that the bin check as mtx-update runs from another path + +local texos = environment.texos or osgetenv("TEXOS") +local texmfos = environment.texmfos or osgetenv('SELFAUTODIR') + +if not texos or texos == "" then + texos = file.basename(texmfos) +end + +ossetenv('TEXMFOS', texmfos) -- full bin path +ossetenv('TEXOS', texos) -- partial bin parent +ossetenv('SELFAUTOSYSTEM',os.platform) -- bonus + +environment.texos = texos +environment.texmfos = texmfos + +-- The current root: + +local texroot = environment.texroot or osgetenv("TEXROOT") + +if not texroot or texroot == "" then + texroot = osgetenv('SELFAUTOPARENT') + ossetenv('TEXROOT',texroot) +end + +environment.texroot = file.collapsepath(texroot) + +-- Tracing. Todo ... + +function resolvers.settrace(n) -- no longer number but: 'locating' or 'detail' + if n then + trackers.disable("resolvers.*") + trackers.enable("resolvers."..n) + end +end + +resolvers.settrace(osgetenv("MTX_INPUT_TRACE")) + +-- todo: + +-- if profiler and osgetenv("MTX_PROFILE_RUN") == "YES" then +-- profiler.start("luatex-profile.log") +-- end + +-- a forward definition + +if not resolvers.resolve then + function resolvers.resolve (s) return s end + function resolvers.unresolve(s) return s end + function resolvers.repath (s) return s end +end diff --git a/Master/texmf-dist/tex/context/base/data-inp.lua b/Master/texmf-dist/tex/context/base/data-inp.lua index b7354e1aef3..97fb8904b91 100644 --- a/Master/texmf-dist/tex/context/base/data-inp.lua +++ b/Master/texmf-dist/tex/context/base/data-inp.lua @@ -6,10 +6,20 @@ if not modules then modules = { } end modules ['data-inp'] = { license = "see context related readme files" } -resolvers.finders = resolvers.finders or { } -resolvers.openers = resolvers.openers or { } -resolvers.loaders = resolvers.loaders or { } +local allocate = utilities.storage.allocate +local resolvers = resolvers -resolvers.finders.notfound = { nil } -resolvers.openers.notfound = { nil } -resolvers.loaders.notfound = { false, nil, 0 } +local methodhandler = resolvers.methodhandler +local registermethod = resolvers.registermethod + +local finders = allocate { helpers = { }, notfound = function() end } +local openers = allocate { helpers = { }, notfound = function() end } +local loaders = allocate { helpers = { }, notfound = function() return false, nil, 0 end } + +registermethod("finders", finders, "uri") +registermethod("openers", openers, "uri") +registermethod("loaders", loaders, "uri") + +resolvers.finders = finders +resolvers.openers = openers +resolvers.loaders = loaders diff --git a/Master/texmf-dist/tex/context/base/data-lst.lua b/Master/texmf-dist/tex/context/base/data-lst.lua index 82f6754867f..3f94253404f 100644 --- a/Master/texmf-dist/tex/context/base/data-lst.lua +++ b/Master/texmf-dist/tex/context/base/data-lst.lua @@ -6,12 +6,16 @@ if not modules then modules = { } end modules ['data-lst'] = { license = "see context related readme files" } --- used in mtxrun +-- used in mtxrun, can be loaded later .. todo local find, concat, upper, format = string.find, table.concat, string.upper, string.format resolvers.listers = resolvers.listers or { } +local resolvers = resolvers + +local report_lists = logs.reporter("resolvers","lists") + local function tabstr(str) if type(str) == 'table' then return concat(str," | ") @@ -20,44 +24,42 @@ local function tabstr(str) end end -local function list(list,report) - local instance = resolvers.instance - local pat = upper(pattern or "","") - local report = report or texio.write_nl - local sorted = table.sortedkeys(list) - for i=1,#sorted do - local key = sorted[i] - if instance.pattern == "" or find(upper(key),pat) then - if instance.kpseonly then - if instance.kpsevars[key] then - report(format("%s=%s",key,tabstr(list[key]))) - end - else - report(format('%s %s=%s',(instance.kpsevars[key] and 'K') or 'E',key,tabstr(list[key]))) +function resolvers.listers.variables(pattern) + local instance = resolvers.instance + local environment = instance.environment + local variables = instance.variables + local expansions = instance.expansions + local pattern = upper(pattern or "") + local configured = { } + local order = instance.order + for i=1,#order do + for k, v in next, order[i] do + if v ~= nil and configured[k] == nil then + configured[k] = v end end end + local env = table.fastcopy(environment) + local var = table.fastcopy(variables) + local exp = table.fastcopy(expansions) + for key, value in table.sortedpairs(configured) do + if key ~= "" and (pattern == "" or find(upper(key),pattern)) then + report_lists(key) + report_lists(" env: %s",tabstr(rawget(environment,key)) or "unset") + report_lists(" var: %s",tabstr(configured[key]) or "unset") + report_lists(" exp: %s",tabstr(expansions[key]) or "unset") + report_lists(" res: %s",resolvers.resolve(expansions[key]) or "unset") + end + end + instance.environment = table.fastcopy(env) + instance.variables = table.fastcopy(var) + instance.expansions = table.fastcopy(exp) end -function resolvers.listers.variables () list(resolvers.instance.variables ) end -function resolvers.listers.expansions() list(resolvers.instance.expansions) end - function resolvers.listers.configurations(report) + local configurations = resolvers.instance.specification local report = report or texio.write_nl - local instance = resolvers.instance - local sorted = table.sortedkeys(instance.kpsevars) - for i=1,#sorted do - local key = sorted[i] - if not instance.pattern or (instance.pattern=="") or find(key,instance.pattern) then - report(format("%s\n",key)) - local order = instance.order - for i=1,#order do - local str = order[i][key] - if str then - report(format("\t%s\t%s",i,str)) - end - end - report("") - end + for i=1,#configurations do + report(resolvers.resolve(configurations[i])) end end diff --git a/Master/texmf-dist/tex/context/base/data-lua.lua b/Master/texmf-dist/tex/context/base/data-lua.lua index 988133fbecf..06571440766 100644 --- a/Master/texmf-dist/tex/context/base/data-lua.lua +++ b/Master/texmf-dist/tex/context/base/data-lua.lua @@ -12,9 +12,13 @@ if not modules then modules = { } end modules ['data-lua'] = { local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local report_libraries = logs.reporter("resolvers","libraries") + local gsub, insert = string.gsub, table.insert local unpack = unpack or table.unpack +local resolvers, package = resolvers, package + local libformats = { 'luatexlibs', 'tex', 'texmfscripts', 'othertextfiles' } -- 'luainputs' local clibformats = { 'lib' } @@ -23,7 +27,7 @@ local _path_, libpaths, _cpath_, clibpaths function package.libpaths() if not _path_ or package.path ~= _path_ then _path_ = package.path - libpaths = file.split_path(_path_,";") + libpaths = file.splitpath(_path_,";") end return libpaths end @@ -31,7 +35,7 @@ end function package.clibpaths() if not _cpath_ or package.cpath ~= _cpath_ then _cpath_ = package.cpath - clibpaths = file.split_path(_cpath_,";") + clibpaths = file.splitpath(_cpath_,";") end return clibpaths end @@ -40,18 +44,18 @@ local function thepath(...) local t = { ... } t[#t+1] = "?.lua" local path = file.join(unpack(t)) if trace_locating then - logs.report("fileio","! appending '%s' to 'package.path'",path) + report_libraries("! appending '%s' to 'package.path'",path) end return path end local p_libpaths, a_libpaths = { }, { } -function package.append_libpath(...) +function package.appendtolibpath(...) insert(a_libpath,thepath(...)) end -function package.prepend_libpath(...) +function package.prependtolibpath(...) insert(p_libpaths,1,thepath(...)) end @@ -62,31 +66,30 @@ local function loaded(libpaths,name,simple) local libpath = libpaths[i] local resolved = gsub(libpath,"%?",simple) if trace_locating then -- more detail - logs.report("fileio","! checking for '%s' on 'package.path': '%s' => '%s'",simple,libpath,resolved) + report_libraries("! checking for '%s' on 'package.path': '%s' => '%s'",simple,libpath,resolved) end - if resolvers.isreadable.file(resolved) then + if file.is_readable(resolved) then if trace_locating then - logs.report("fileio","! lib '%s' located via 'package.path': '%s'",name,resolved) + report_libraries("! lib '%s' located via 'package.path': '%s'",name,resolved) end return loadfile(resolved) end end end - package.loaders[2] = function(name) -- was [#package.loaders+1] if trace_locating then -- mode detail - logs.report("fileio","! locating '%s'",name) + report_libraries("! locating '%s'",name) end for i=1,#libformats do local format = libformats[i] - local resolved = resolvers.find_file(name,format) or "" + local resolved = resolvers.findfile(name,format) or "" if trace_locating then -- mode detail - logs.report("fileio","! checking for '%s' using 'libformat path': '%s'",name,format) + report_libraries("! checking for '%s' using 'libformat path': '%s'",name,format) end if resolved ~= "" then if trace_locating then - logs.report("fileio","! lib '%s' located via environment: '%s'",name,resolved) + report_libraries("! lib '%s' located via environment: '%s'",name,resolved) end return loadfile(resolved) end @@ -104,16 +107,16 @@ package.loaders[2] = function(name) -- was [#package.loaders+1] for i=1,#clibformats do -- better have a dedicated loop local format = clibformats[i] - local paths = resolvers.expanded_path_list_from_var(format) + local paths = resolvers.expandedpathlistfromvariable(format) for p=1,#paths do local path = paths[p] local resolved = file.join(path,libname) if trace_locating then -- mode detail - logs.report("fileio","! checking for '%s' using 'clibformat path': '%s'",libname,path) + report_libraries("! checking for '%s' using 'clibformat path': '%s'",libname,path) end - if resolvers.isreadable.file(resolved) then + if file.is_readable(resolved) then if trace_locating then - logs.report("fileio","! lib '%s' located via 'clibformat': '%s'",libname,resolved) + report_libraries("! lib '%s' located via 'clibformat': '%s'",libname,resolved) end return package.loadlib(resolved,name) end @@ -123,30 +126,40 @@ package.loaders[2] = function(name) -- was [#package.loaders+1] local libpath = clibpaths[i] local resolved = gsub(libpath,"?",simple) if trace_locating then -- more detail - logs.report("fileio","! checking for '%s' on 'package.cpath': '%s'",simple,libpath) + report_libraries("! checking for '%s' on 'package.cpath': '%s'",simple,libpath) end - if resolvers.isreadable.file(resolved) then + if file.is_readable(resolved) then if trace_locating then - logs.report("fileio","! lib '%s' located via 'package.cpath': '%s'",name,resolved) + report_libraries("! lib '%s' located via 'package.cpath': '%s'",name,resolved) end return package.loadlib(resolved,name) end end -- just in case the distribution is messed up if trace_loading then -- more detail - logs.report("fileio","! checking for '%s' using 'luatexlibs': '%s'",name) + report_libraries("! checking for '%s' using 'luatexlibs': '%s'",name) end - local resolved = resolvers.find_file(file.basename(name),'luatexlibs') or "" + local resolved = resolvers.findfile(file.basename(name),'luatexlibs') or "" if resolved ~= "" then if trace_locating then - logs.report("fileio","! lib '%s' located by basename via environment: '%s'",name,resolved) + report_libraries("! lib '%s' located by basename via environment: '%s'",name,resolved) end return loadfile(resolved) end if trace_locating then - logs.report("fileio",'? unable to locate lib: %s',name) + report_libraries('? unable to locate lib: %s',name) end -- return "unable to locate " .. name end resolvers.loadlualib = require + +-- -- -- -- + +package.obsolete = package.obsolete or { } + +package.append_libpath = appendtolibpath -- will become obsolete +package.prepend_libpath = prependtolibpath -- will become obsolete + +package.obsolete.append_libpath = appendtolibpath -- will become obsolete +package.obsolete.prepend_libpath = prependtolibpath -- will become obsolete diff --git a/Master/texmf-dist/tex/context/base/data-met.lua b/Master/texmf-dist/tex/context/base/data-met.lua new file mode 100644 index 00000000000..5437d9a294f --- /dev/null +++ b/Master/texmf-dist/tex/context/base/data-met.lua @@ -0,0 +1,128 @@ +if not modules then modules = { } end modules ['data-met'] = { + version = 1.100, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local find, format = string.find, string.format +local sequenced = table.sequenced +local addurlscheme, urlhashed = url.addscheme, url.hashed + +local trace_locating = false + +trackers.register("resolvers.locating", function(v) trace_methods = v end) +trackers.register("resolvers.methods", function(v) trace_methods = v end) + +--~ trace_methods = true + +local report_methods = logs.reporter("resolvers","methods") + +local allocate = utilities.storage.allocate + +local resolvers = resolvers + +local registered = { } + +local function splitmethod(filename) -- todo: filetype in specification + if not filename then + return { scheme = "unknown", original = filename } + end + if type(filename) == "table" then + return filename -- already split + end + filename = file.collapsepath(filename) + if not find(filename,"://") then + return { scheme = "file", path = filename, original = filename, filename = filename } + end + local specification = url.hashed(filename) + if not specification.scheme or specification.scheme == "" then + return { scheme = "file", path = filename, original = filename, filename = filename } + else + return specification + end +end + +resolvers.splitmethod = splitmethod -- bad name but ok + +-- the second argument is always analyzed (saves time later on) and the original +-- gets passed as original but also as argument + +local function methodhandler(what,first,...) -- filename can be nil or false + local method = registered[what] + if method then + local how, namespace = method.how, method.namespace + if how == "uri" or how == "url" then + local specification = splitmethod(first) + local scheme = specification.scheme + local resolver = namespace and namespace[scheme] + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, scheme=%s, argument=%s",what,how,scheme,first) + end + return resolver(specification,...) + else + resolver = namespace.default or namespace.file + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, default, argument=%s",what,how,first) + end + return resolver(specification,...) + elseif trace_methods then + report_methods("resolver: method=%s, how=%s, no handler",what,how) + end + end + elseif how == "tag" then + local resolver = namespace and namespace[first] + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, tag=%s",what,how,first) + end + return resolver(...) + else + resolver = namespace.default or namespace.file + if resolver then + if trace_methods then + report_methods("resolver: method=%s, how=%s, default",what,how) + end + return resolver(...) + elseif trace_methods then + report_methods("resolver: method=%s, how=%s, unknown",what,how) + end + end + end + else + report_methods("resolver: method=%s, unknown",what) + end +end + +resolvers.methodhandler = methodhandler + +function resolvers.registermethod(name,namespace,how) + registered[name] = { how = how or "tag", namespace = namespace } + namespace["byscheme"] = function(scheme,filename,...) + if scheme == "file" then + return methodhandler(name,filename,...) + else + return methodhandler(name,addurlscheme(filename,scheme),...) + end + end +end + +local concatinators = allocate { notfound = file.join } -- concatinate paths +local locators = allocate { notfound = function() end } -- locate databases +local hashers = allocate { notfound = function() end } -- load databases +local generators = allocate { notfound = function() end } -- generate databases + +resolvers.concatinators = concatinators +resolvers.locators = locators +resolvers.hashers = hashers +resolvers.generators = generators + +local registermethod = resolvers.registermethod + +registermethod("concatinators",concatinators,"tag") +registermethod("locators", locators, "uri") +registermethod("hashers", hashers, "uri") +registermethod("generators", generators, "uri") diff --git a/Master/texmf-dist/tex/context/base/data-out.lua b/Master/texmf-dist/tex/context/base/data-out.lua index f73ff9bdcf7..11304c2ced3 100644 --- a/Master/texmf-dist/tex/context/base/data-out.lua +++ b/Master/texmf-dist/tex/context/base/data-out.lua @@ -6,5 +6,13 @@ if not modules then modules = { } end modules ['data-out'] = { license = "see context related readme files" } -outputs = outputs or { } +local allocate = utilities.storage.allocate +local resolvers = resolvers +local registermethod = resolvers.registermethod + +local savers = allocate { helpers = { } } + +resolvers.savers = savers + +registermethod("savers", savers, "uri") diff --git a/Master/texmf-dist/tex/context/base/data-pre.lua b/Master/texmf-dist/tex/context/base/data-pre.lua index 9348f6cd39c..f774ba6eb0d 100644 --- a/Master/texmf-dist/tex/context/base/data-pre.lua +++ b/Master/texmf-dist/tex/context/base/data-pre.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['data-res'] = { +if not modules then modules = { } end modules ['data-pre'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -6,17 +6,29 @@ if not modules then modules = { } end modules ['data-res'] = { license = "see context related readme files" } +-- It could be interesting to hook the resolver in the file +-- opener so that unresolved prefixes travel around and we +-- get more abstraction. + +-- As we use this beforehand we will move this up in the chain +-- of loading. + --~ print(resolvers.resolve("abc env:tmp file:cont-en.tex path:cont-en.tex full:cont-en.tex rel:zapf/one/p-chars.tex")) -local upper, lower, gsub = string.upper, string.lower, string.gsub +local resolvers = resolvers +local prefixes = utilities.storage.allocate() +resolvers.prefixes = prefixes -local prefixes = { } +local gsub = string.gsub +local cleanpath, findgivenfile, expansion = resolvers.cleanpath, resolvers.findgivenfile, resolvers.expansion +local getenv = resolvers.getenv -- we can probably also use resolvers.expansion +local P, Cs, lpegmatch = lpeg.P, lpeg.Cs, lpeg.match prefixes.environment = function(str) - return resolvers.clean_path(os.getenv(str) or os.getenv(upper(str)) or os.getenv(lower(str)) or "") + return cleanpath(expansion(str)) end -prefixes.relative = function(str,n) +prefixes.relative = function(str,n) -- lfs.isfile if io.exists(str) then -- nothing elseif io.exists("./" .. str) then @@ -32,7 +44,7 @@ prefixes.relative = function(str,n) end end end - return resolvers.clean_path(str) + return cleanpath(str) end prefixes.auto = function(str) @@ -44,18 +56,34 @@ prefixes.auto = function(str) end prefixes.locate = function(str) - local fullname = resolvers.find_given_file(str) or "" - return resolvers.clean_path((fullname ~= "" and fullname) or str) + local fullname = findgivenfile(str) or "" + return cleanpath((fullname ~= "" and fullname) or str) end prefixes.filename = function(str) - local fullname = resolvers.find_given_file(str) or "" - return resolvers.clean_path(file.basename((fullname ~= "" and fullname) or str)) + local fullname = findgivenfile(str) or "" + return cleanpath(file.basename((fullname ~= "" and fullname) or str)) end prefixes.pathname = function(str) - local fullname = resolvers.find_given_file(str) or "" - return resolvers.clean_path(file.dirname((fullname ~= "" and fullname) or str)) + local fullname = findgivenfile(str) or "" + return cleanpath(file.dirname((fullname ~= "" and fullname) or str)) +end + +prefixes.selfautoloc = function(str) + return cleanpath(file.join(getenv('SELFAUTOLOC'),str)) +end + +prefixes.selfautoparent = function(str) + return cleanpath(file.join(getenv('SELFAUTOPARENT'),str)) +end + +prefixes.selfautodir = function(str) + return cleanpath(file.join(getenv('SELFAUTODIR'),str)) +end + +prefixes.home = function(str) + return cleanpath(file.join(getenv('HOME'),str)) end prefixes.env = prefixes.environment @@ -84,19 +112,28 @@ local function _resolve_(method,target) end end -local function resolve(str) - if type(str) == "table" then - for k=1,#str do - local v = str[k] - str[k] = resolve(v) or v - end - elseif str and str ~= "" then - str = gsub(str,"([a-z]+):([^ \"\']*)",_resolve_) +local resolved, abstract = { }, { } + +function resolvers.resetresolve(str) + resolved, abstract = { }, { } +end + +local function resolve(str) -- use schemes, this one is then for the commandline only + local res = resolved[str] + if not res then + res = gsub(str,"([a-z][a-z]+):([^ \"\']*)",_resolve_) + resolved[str] = res + abstract[res] = str end - return str + return res +end + +local function unresolve(str) + return abstract[str] or str end -resolvers.resolve = resolve +resolvers.resolve = resolve +resolvers.unresolve = unresolve if os.uname then @@ -107,3 +144,39 @@ if os.uname then end end + +if os.type == "unix" then + + local pattern + + local function makepattern(t,k,v) + local colon = P(":") + local p + for k, v in table.sortedpairs(prefixes) do + if p then + p = P(k) + p + else + p = P(k) + end + end + pattern = Cs((p * colon + colon/";" + P(1))^0) + if t then + t[k] = v + end + end + + makepattern() + + getmetatable(prefixes).__newindex = makepattern + + function resolvers.repath(str) + return lpegmatch(pattern,str) + end + +else -- already the default: + + function resolvers.repath(str) + return str + end + +end diff --git a/Master/texmf-dist/tex/context/base/data-res.lua b/Master/texmf-dist/tex/context/base/data-res.lua index ac5177f4a24..842eed16940 100644 --- a/Master/texmf-dist/tex/context/base/data-res.lua +++ b/Master/texmf-dist/tex/context/base/data-res.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['data-inp'] = { +if not modules then modules = { } end modules ['data-res'] = { version = 1.001, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -6,1331 +6,617 @@ if not modules then modules = { } end modules ['data-inp'] = { license = "see context related readme files", } --- After a few years using the code the large luat-inp.lua file --- has been split up a bit. In the process some functionality was --- dropped: --- --- * support for reading lsr files --- * selective scanning (subtrees) --- * some public auxiliary functions were made private --- --- TODO: os.getenv -> os.env[] --- TODO: instances.[hashes,cnffiles,configurations,522] --- TODO: check escaping in find etc, too much, too slow - --- This lib is multi-purpose and can be loaded again later on so that --- additional functionality becomes available. We will split thislogs.report("fileio", --- module in components once we're done with prototyping. This is the --- first code I wrote for LuaTeX, so it needs some cleanup. Before changing --- something in this module one can best check with Taco or Hans first; there --- is some nasty trickery going on that relates to traditional kpse support. - --- To be considered: hash key lowercase, first entry in table filename --- (any case), rest paths (so no need for optimization). Or maybe a --- separate table that matches lowercase names to mixed case when --- present. In that case the lower() cases can go away. I will do that --- only when we run into problems with names ... well ... Iwona-Regular. - --- Beware, loading and saving is overloaded in luat-tmp! - -local format, gsub, find, lower, upper, match, gmatch = string.format, string.gsub, string.find, string.lower, string.upper, string.match, string.gmatch -local concat, insert, sortedkeys = table.concat, table.insert, table.sortedkeys -local next, type = next, type -local lpegmatch = lpeg.match - -local trace_locating, trace_detail, trace_expansions = false, false, false - -trackers.register("resolvers.locating", function(v) trace_locating = v end) -trackers.register("resolvers.details", function(v) trace_detail = v end) -trackers.register("resolvers.expansions", function(v) trace_expansions = v end) -- todo - -if not resolvers then - resolvers = { - suffixes = { }, - formats = { }, - dangerous = { }, - suffixmap = { }, - alternatives = { }, - locators = { }, -- locate databases - hashers = { }, -- load databases - generators = { }, -- generate databases - } -end - -local resolvers = resolvers - -resolvers.locators .notfound = { nil } -resolvers.hashers .notfound = { nil } -resolvers.generators.notfound = { nil } - -resolvers.cacheversion = '1.0.1' -resolvers.cnfname = 'texmf.cnf' -resolvers.luaname = 'texmfcnf.lua' -resolvers.homedir = os.env[os.type == "windows" and 'USERPROFILE'] or os.env['HOME'] or '~' -resolvers.cnfdefault = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c}' - -local dummy_path_expr = "^!*unset/*$" - -local formats = resolvers.formats -local suffixes = resolvers.suffixes -local dangerous = resolvers.dangerous -local suffixmap = resolvers.suffixmap -local alternatives = resolvers.alternatives - -formats['afm'] = 'AFMFONTS' suffixes['afm'] = { 'afm' } -formats['enc'] = 'ENCFONTS' suffixes['enc'] = { 'enc' } -formats['fmt'] = 'TEXFORMATS' suffixes['fmt'] = { 'fmt' } -formats['map'] = 'TEXFONTMAPS' suffixes['map'] = { 'map' } -formats['mp'] = 'MPINPUTS' suffixes['mp'] = { 'mp' } -formats['ocp'] = 'OCPINPUTS' suffixes['ocp'] = { 'ocp' } -formats['ofm'] = 'OFMFONTS' suffixes['ofm'] = { 'ofm', 'tfm' } -formats['otf'] = 'OPENTYPEFONTS' suffixes['otf'] = { 'otf' } -- 'ttf' -formats['opl'] = 'OPLFONTS' suffixes['opl'] = { 'opl' } -formats['otp'] = 'OTPINPUTS' suffixes['otp'] = { 'otp' } -formats['ovf'] = 'OVFFONTS' suffixes['ovf'] = { 'ovf', 'vf' } -formats['ovp'] = 'OVPFONTS' suffixes['ovp'] = { 'ovp' } -formats['tex'] = 'TEXINPUTS' suffixes['tex'] = { 'tex' } -formats['tfm'] = 'TFMFONTS' suffixes['tfm'] = { 'tfm' } -formats['ttf'] = 'TTFONTS' suffixes['ttf'] = { 'ttf', 'ttc', 'dfont' } -formats['pfb'] = 'T1FONTS' suffixes['pfb'] = { 'pfb', 'pfa' } -formats['vf'] = 'VFFONTS' suffixes['vf'] = { 'vf' } - -formats['fea'] = 'FONTFEATURES' suffixes['fea'] = { 'fea' } -formats['cid'] = 'FONTCIDMAPS' suffixes['cid'] = { 'cid', 'cidmap' } - -formats ['texmfscripts'] = 'TEXMFSCRIPTS' -- new -suffixes['texmfscripts'] = { 'rb', 'pl', 'py' } -- 'lua' - -formats ['lua'] = 'LUAINPUTS' -- new -suffixes['lua'] = { 'lua', 'luc', 'tma', 'tmc' } - --- backward compatible ones - -alternatives['map files'] = 'map' -alternatives['enc files'] = 'enc' -alternatives['cid maps'] = 'cid' -- great, why no cid files -alternatives['font feature files'] = 'fea' -- and fea files here -alternatives['opentype fonts'] = 'otf' -alternatives['truetype fonts'] = 'ttf' -alternatives['truetype collections'] = 'ttc' -alternatives['truetype dictionary'] = 'dfont' -alternatives['type1 fonts'] = 'pfb' - --- obscure ones - -formats ['misc fonts'] = '' -suffixes['misc fonts'] = { } - -formats ['sfd'] = 'SFDFONTS' -suffixes ['sfd'] = { 'sfd' } -alternatives['subfont definition files'] = 'sfd' - --- lib paths - -formats ['lib'] = 'CLUAINPUTS' -- new (needs checking) -suffixes['lib'] = (os.libsuffix and { os.libsuffix }) or { 'dll', 'so' } - -- In practice we will work within one tds tree, but i want to keep -- the option open to build tools that look at multiple trees, which is -- why we keep the tree specific data in a table. We used to pass the --- instance but for practical pusposes we now avoid this and use a --- instance variable. +-- instance but for practical purposes we now avoid this and use a +-- instance variable. We always have one instance active (sort of global). --- here we catch a few new thingies (todo: add these paths to context.tmf) --- --- FONTFEATURES = .;$TEXMF/fonts/fea// --- FONTCIDMAPS = .;$TEXMF/fonts/cid// +-- todo: cache:/// home:/// --- we always have one instance active +local format, gsub, find, lower, upper, match, gmatch = string.format, string.gsub, string.find, string.lower, string.upper, string.match, string.gmatch +local concat, insert, sortedkeys = table.concat, table.insert, table.sortedkeys +local next, type, rawget = next, type, rawget +local os = os -resolvers.instance = resolvers.instance or nil -- the current one (slow access) -local instance = resolvers.instance or nil -- the current one (fast access) +local P, S, R, C, Cc, Cs, Ct, Carg = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Carg +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns -function resolvers.newinstance() +local filedirname = file.dirname +local filebasename = file.basename +local fileextname = file.extname +local filejoin = file.join +local collapsepath = file.collapsepath +local joinpath = file.joinpath +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex - -- store once, freeze and faster (once reset we can best use - -- instance.environment) maybe better have a register suffix - -- function +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_detail = false trackers.register("resolvers.details", function(v) trace_detail = v end) +local trace_expansions = false trackers.register("resolvers.expansions", function(v) trace_expansions = v end) - for k, v in next, suffixes do - for i=1,#v do - local vi = v[i] - if vi then - suffixmap[vi] = k - end - end - end +local report_resolving = logs.reporter("resolvers","resolving") - -- because vf searching is somewhat dangerous, we want to prevent - -- too liberal searching esp because we do a lookup on the current - -- path anyway; only tex (or any) is safe +local resolvers = resolvers - for k, v in next, formats do - dangerous[k] = true - end - dangerous.tex = nil +local expandedpathfromlist = resolvers.expandedpathfromlist +local checkedvariable = resolvers.checkedvariable +local splitconfigurationpath = resolvers.splitconfigurationpath +local methodhandler = resolvers.methodhandler - -- the instance +local initializesetter = utilities.setters.initialize - local newinstance = { - rootpath = '', - treepath = '', - progname = 'context', - engine = 'luatex', - format = '', - environment = { }, - variables = { }, - expansions = { }, - files = { }, - remap = { }, - configuration = { }, - setup = { }, - order = { }, - found = { }, - foundintrees = { }, - kpsevars = { }, - hashes = { }, - cnffiles = { }, - luafiles = { }, - lists = { }, - remember = true, - diskcache = true, - renewcache = false, - scandisk = true, - cachepath = nil, - loaderror = false, - sortdata = false, - savelists = true, - cleanuppaths = true, - allresults = false, - pattern = nil, -- lists - data = { }, -- only for loading - force_suffixes = true, - fakepaths = { }, - } +local ostype, osname, osenv, ossetenv, osgetenv = os.type, os.name, os.env, os.setenv, os.getenv - local ne = newinstance.environment +resolvers.cacheversion = '1.0.1' +resolvers.configbanner = '' +resolvers.homedir = environment.homedir +resolvers.criticalvars = allocate { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF", "TEXMF", "TEXOS" } +resolvers.luacnfname = 'texmfcnf.lua' +resolvers.luacnfstate = "unknown" - for k,v in next, os.env do - ne[k] = resolvers.bare_variable(v) - end +-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path +resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}' - return newinstance +--~ -- not yet, some reporters expect strings -end +--~ resolvers.luacnfspec = { +--~ "selfautoparent:/texmf-local", +--~ "selfautoparent:/texmf-local/web2c", +--~ "selfautoparent:/texmf", +--~ "selfautoparent:/texmf/web2c", +--~ "selfautoparent:", +--~ } -function resolvers.setinstance(someinstance) - instance = someinstance - resolvers.instance = someinstance - return someinstance -end +local unset_variable = "unset" -function resolvers.reset() - return resolvers.setinstance(resolvers.newinstance()) -end +local formats = resolvers.formats +local suffixes = resolvers.suffixes +local dangerous = resolvers.dangerous +local suffixmap = resolvers.suffixmap -local function reset_hashes() - instance.lists = { } - instance.found = { } -end +resolvers.defaultsuffixes = { "tex" } -- "mkiv", "cld" -- too tricky -local function check_configuration() -- not yet ok, no time for debugging now - if os.env["OSFONTDIR"] then - -- ok - elseif os.type == "windows" then - os.setenv("OSFONTDIR","c:/windows/fonts//") - elseif os.type == "macosx" then - os.setenv("OSFONTDIR","$HOME/Library/Fonts//;/Library/Fonts//;/System/Library/Fonts//") - end -end +resolvers.instance = resolvers.instance or nil -- the current one (slow access) +local instance = resolvers.instance or nil -- the current one (fast access) -function resolvers.bare_variable(str) -- assumes str is a string - return (gsub(str,"\s*([\"\']?)(.+)%1\s*", "%2")) -end +-- An instance has an environment (coming from the outside, kept raw), variables +-- (coming from the configuration file), and expansions (variables with nested +-- variables replaced). One can push something into the outer environment and +-- its internal copy, but only the later one will be the raw unprefixed variant. -function resolvers.settrace(n) -- no longer number but: 'locating' or 'detail' - if n then - trackers.disable("resolvers.*") - trackers.enable("resolvers."..n) +function resolvers.setenv(key,value,raw) + if instance then + -- this one will be consulted first when we stay inside + -- the current environment + instance.environment[key] = value + -- we feed back into the environment, and as this is used + -- by other applications (via os.execute) we need to make + -- sure that prefixes are resolve + ossetenv(key,raw and value or resolvers.resolve(value)) end end -resolvers.settrace(os.getenv("MTX_INPUT_TRACE")) +-- Beware we don't want empty here as this one can be called early on +-- and therefore we use rawget. -function resolvers.osenv(key) - local ie = instance.environment - local value = ie[key] - if value == nil then - -- local e = os.getenv(key) - local e = os.env[key] - if e == nil then - -- value = "" -- false - else - value = resolvers.bare_variable(e) - end - ie[key] = value +local function getenv(key) + local value = rawget(instance.environment,key) + if value and value ~= "" then + return value + else + local e = osgetenv(key) + return e ~= nil and e ~= "" and checkedvariable(e) or "" end - return value or "" end -function resolvers.env(key) - return instance.environment[key] or resolvers.osenv(key) -end +resolvers.getenv = getenv +resolvers.env = getenv --- +-- We are going to use some metatable trickery where we backtrack from +-- expansion to variable to environment. -local function expand_vars(lst) -- simple vars - local variables, env = instance.variables, resolvers.env - local function resolve(a) - return variables[a] or env(a) - end - for k=1,#lst do - lst[k] = gsub(lst[k],"%$([%a%d%_%-]+)",resolve) - end +local function resolve(k) + return instance.expansions[k] end -local function expanded_var(var) -- simple vars - local function resolve(a) - return instance.variables[a] or resolvers.env(a) - end - return (gsub(var,"%$([%a%d%_%-]+)",resolve)) -end +local dollarstripper = lpeg.stripper("$") +local inhibitstripper = P("!")^0 * Cs(P(1)^0) +local backslashswapper = lpeg.replacer("\\","/") -local function entry(entries,name) - if name and (name ~= "") then - name = gsub(name,'%$','') - local result = entries[name..'.'..instance.progname] or entries[name] - if result then - return result - else - result = resolvers.env(name) - if result then - instance.variables[name] = result - resolvers.expand_variables() - return instance.expansions[name] or "" - end - end - end - return "" -end +local somevariable = P("$") / "" +local somekey = C(R("az","AZ","09","__","--")^1) +local somethingelse = P(";") * ((1-S("!{}/\\"))^1 * P(";") / "") + + P(";") * (P(";") / "") + + P(1) +local variableexpander = Cs( (somevariable * (somekey/resolve) + somethingelse)^1 ) -local function is_entry(entries,name) - if name and name ~= "" then - name = gsub(name,'%$','') - return (entries[name..'.'..instance.progname] or entries[name]) ~= nil - else - return false - end -end +local cleaner = P("\\") / "/" + P(";") * S("!{}/\\")^0 * P(";")^1 / ";" +local variablecleaner = Cs((cleaner + P(1))^0) --- {a,b,c,d} --- a,b,c/{p,q,r},d --- a,b,c/{p,q,r}/d/{x,y,z}// --- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} --- a,b,c/{p,q/{x,y,z},r},d/{p,q,r} --- a{b,c}{d,e}f --- {a,b,c,d} --- {a,b,c/{p,q,r},d} --- {a,b,c/{p,q,r}/d/{x,y,z}//} --- {a,b,c/{p,q/{x,y,z}},d/{p,q,r}} --- {a,b,c/{p,q/{x,y,z},w}v,d/{p,q,r}} --- {$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,.local,}/web2c} - --- this one is better and faster, but it took me a while to realize --- that this kind of replacement is cleaner than messy parsing and --- fuzzy concatenating we can probably gain a bit with selectively --- applying lpeg, but experiments with lpeg parsing this proved not to --- work that well; the parsing is ok, but dealing with the resulting --- table is a pain because we need to work inside-out recursively - -local function do_first(a,b) - local t = { } - for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end - return "{" .. concat(t,",") .. "}" -end - -local function do_second(a,b) - local t = { } - for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end - return "{" .. concat(t,",") .. "}" -end - -local function do_both(a,b) - local t = { } - for sa in gmatch(a,"[^,]+") do - for sb in gmatch(b,"[^,]+") do - t[#t+1] = sa .. sb - end - end - return "{" .. concat(t,",") .. "}" -end +local somevariable = R("az","AZ","09","__","--")^1 / resolve +local variable = (P("$")/"") * (somevariable + (P("{")/"") * somevariable * (P("}")/"")) +local variableresolver = Cs((variable + P(1))^0) -local function do_three(a,b,c) - return a .. b.. c +local function expandedvariable(var) + return lpegmatch(variableexpander,var) or var end -local function splitpathexpr(str, t, validate) - -- no need for further optimization as it is only called a - -- few times, we can use lpeg for the sub - if trace_expansions then - logs.report("fileio","expanding variable '%s'",str) - end - t = t or { } - str = gsub(str,",}",",@}") - str = gsub(str,"{,","{@,") - -- str = "@" .. str .. "@" - local ok, done - while true do - done = false - while true do - str, ok = gsub(str,"([^{},]+){([^{}]+)}",do_first) - if ok > 0 then done = true else break end - end - while true do - str, ok = gsub(str,"{([^{}]+)}([^{},]+)",do_second) - if ok > 0 then done = true else break end - end - while true do - str, ok = gsub(str,"{([^{}]+)}{([^{}]+)}",do_both) - if ok > 0 then done = true else break end - end - str, ok = gsub(str,"({[^{}]*){([^{}]+)}([^{}]*})",do_three) - if ok > 0 then done = true end - if not done then break end - end - str = gsub(str,"[{}]", "") - str = gsub(str,"@","") - if validate then - for s in gmatch(str,"[^,]+") do - s = validate(s) - if s then t[#t+1] = s end - end - else - for s in gmatch(str,"[^,]+") do - t[#t+1] = s - end - end - if trace_expansions then - for k=1,#t do - logs.report("fileio","% 4i: %s",k,t[k]) - end - end - return t -end +function resolvers.newinstance() -- todo: all vars will become lowercase and alphanum only -local function expanded_path_from_list(pathlist) -- maybe not a list, just a path - -- a previous version fed back into pathlist - local newlist, ok = { }, false - for k=1,#pathlist do - if find(pathlist[k],"[{}]") then - ok = true - break - end - end - if ok then - local function validate(s) - s = file.collapse_path(s) - return s ~= "" and not find(s,dummy_path_expr) and s - end - for k=1,#pathlist do - splitpathexpr(pathlist[k],newlist,validate) - end - else - for k=1,#pathlist do - for p in gmatch(pathlist[k],"([^,]+)") do - p = file.collapse_path(p) - if p ~= "" then newlist[#newlist+1] = p end - end - end - end - return newlist -end - --- we follow a rather traditional approach: --- --- (1) texmf.cnf given in TEXMFCNF --- (2) texmf.cnf searched in default variable --- --- also we now follow the stupid route: if not set then just assume *one* --- cnf file under texmf (i.e. distribution) - -local args = environment and environment.original_arguments or arg -- this needs a cleanup - -resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex" -resolvers.ownbin = gsub(resolvers.ownbin,"\\","/") - -function resolvers.getownpath() - local ownpath = resolvers.ownpath or os.selfdir - if not ownpath or ownpath == "" or ownpath == "unset" then - ownpath = args[-1] or arg[-1] - ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/")) - if not ownpath or ownpath == "" then - ownpath = args[-0] or arg[-0] - ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/")) - end - local binary = resolvers.ownbin - if not ownpath or ownpath == "" then - ownpath = ownpath and file.dirname(binary) - end - if not ownpath or ownpath == "" then - if os.binsuffix ~= "" then - binary = file.replacesuffix(binary,os.binsuffix) - end - for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do - local b = file.join(p,binary) - if lfs.isfile(b) then - -- we assume that after changing to the path the currentdir function - -- resolves to the real location and use this side effect here; this - -- trick is needed because on the mac installations use symlinks in the - -- path instead of real locations - local olddir = lfs.currentdir() - if lfs.chdir(p) then - local pp = lfs.currentdir() - if trace_locating and p ~= pp then - logs.report("fileio","following symlink '%s' to '%s'",p,pp) - end - ownpath = pp - lfs.chdir(olddir) - else - if trace_locating then - logs.report("fileio","unable to check path '%s'",p) - end - ownpath = p - end - break - end - end - end - if not ownpath or ownpath == "" then - ownpath = "." - logs.report("fileio","forcing fallback ownpath .") - elseif trace_locating then - logs.report("fileio","using ownpath '%s'",ownpath) - end - end - resolvers.ownpath = ownpath - function resolvers.getownpath() - return resolvers.ownpath - end - return ownpath -end + if trace_locating then + report_resolving("creating instance") + end -local own_places = { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF" } + local environment, variables, expansions, order = allocate(), allocate(), allocate(), allocate() -local function identify_own() - local ownpath = resolvers.getownpath() or dir.current() - local ie = instance.environment - if ownpath then - if resolvers.env('SELFAUTOLOC') == "" then os.env['SELFAUTOLOC'] = file.collapse_path(ownpath) end - if resolvers.env('SELFAUTODIR') == "" then os.env['SELFAUTODIR'] = file.collapse_path(ownpath .. "/..") end - if resolvers.env('SELFAUTOPARENT') == "" then os.env['SELFAUTOPARENT'] = file.collapse_path(ownpath .. "/../..") end - else - logs.report("fileio","error: unable to locate ownpath") - os.exit() - end - if resolvers.env('TEXMFCNF') == "" then os.env['TEXMFCNF'] = resolvers.cnfdefault end - if resolvers.env('TEXOS') == "" then os.env['TEXOS'] = resolvers.env('SELFAUTODIR') end - if resolvers.env('TEXROOT') == "" then os.env['TEXROOT'] = resolvers.env('SELFAUTOPARENT') end - if trace_locating then - for i=1,#own_places do - local v = own_places[i] - logs.report("fileio","variable '%s' set to '%s'",v,resolvers.env(v) or "unknown") - end - end - identify_own = function() end -end - -function resolvers.identify_cnf() - if #instance.cnffiles == 0 then - -- fallback - identify_own() - -- the real search - resolvers.expand_variables() - local t = resolvers.split_path(resolvers.env('TEXMFCNF')) - t = expanded_path_from_list(t) - expand_vars(t) -- redundant - local function locate(filename,list) - for i=1,#t do - local ti = t[i] - local texmfcnf = file.collapse_path(file.join(ti,filename)) - if lfs.isfile(texmfcnf) then - list[#list+1] = texmfcnf - end - end - end - locate(resolvers.luaname,instance.luafiles) - locate(resolvers.cnfname,instance.cnffiles) - end -end + local newinstance = { + environment = environment, + variables = variables, + expansions = expansions, + order = order, + files = allocate(), + setups = allocate(), + found = allocate(), + foundintrees = allocate(), + hashes = allocate(), + hashed = allocate(), + specification = allocate(), + lists = allocate(), + data = allocate(), -- only for loading + fakepaths = allocate(), + remember = true, + diskcache = true, + renewcache = false, + loaderror = false, + savelists = true, + pattern = nil, -- lists + force_suffixes = true, + } -local function load_cnf_file(fname) - fname = resolvers.clean_path(fname) - local lname = file.replacesuffix(fname,'lua') - if lfs.isfile(lname) then - local dname = file.dirname(fname) -- fname ? - if not instance.configuration[dname] then - resolvers.load_data(dname,'configuration',lname and file.basename(lname)) - instance.order[#instance.order+1] = instance.configuration[dname] - end - else - f = io.open(fname) - if f then - if trace_locating then - logs.report("fileio","loading configuration file %s", fname) - end - local line, data, n, k, v - local dname = file.dirname(fname) - if not instance.configuration[dname] then - instance.configuration[dname] = { } - instance.order[#instance.order+1] = instance.configuration[dname] - end - local data = instance.configuration[dname] - while true do - local line, n = f:read(), 0 - if line then - while true do -- join lines - line, n = gsub(line,"\\%s*$", "") - if n > 0 then - line = line .. f:read() - else - break - end - end - if not find(line,"^[%%#]") then - local l = gsub(line,"%s*%%.*$","") - local k, v = match(l,"%s*(.-)%s*=%s*(.-)%s*$") - if k and v and not data[k] then - v = gsub(v,"[%%#].*",'') - data[k] = gsub(v,"~","$HOME") - instance.kpsevars[k] = true - end - end - else - break - end + setmetatableindex(variables,function(t,k) + local v + for i=1,#order do + v = order[i][k] + if v ~= nil then + t[k] = v + return v end - f:close() - elseif trace_locating then - logs.report("fileio","skipping configuration file '%s'", fname) end - end -end - -local function collapse_cnf_data() -- potential optimization: pass start index (setup and configuration are shared) - local order = instance.order - for i=1,#order do - local c = order[i] - for k,v in next, c do - if not instance.variables[k] then - if instance.environment[k] then - instance.variables[k] = instance.environment[k] - else - instance.kpsevars[k] = true - instance.variables[k] = resolvers.bare_variable(v) - end - end + if v == nil then + v = "" end - end -end + t[k] = v + return v + end) -function resolvers.load_cnf() - local function loadoldconfigdata() - local cnffiles = instance.cnffiles - for i=1,#cnffiles do - load_cnf_file(cnffiles[i]) - end - end - -- instance.cnffiles contain complete names now ! - -- we still use a funny mix of cnf and new but soon - -- we will switch to lua exclusively as we only use - -- the file to collect the tree roots - if #instance.cnffiles == 0 then - if trace_locating then - logs.report("fileio","no cnf files found (TEXMFCNF may not be set/known)") + setmetatableindex(environment, function(t,k) + local v = osgetenv(k) + if v == nil then + v = variables[k] end - else - local cnffiles = instance.cnffiles - instance.rootpath = cnffiles[1] - for k=1,#cnffiles do - instance.cnffiles[k] = file.collapse_path(cnffiles[k]) + if v ~= nil then + v = checkedvariable(v) or "" end - for i=1,3 do - instance.rootpath = file.dirname(instance.rootpath) - end - instance.rootpath = file.collapse_path(instance.rootpath) - if instance.diskcache and not instance.renewcache then - resolvers.loadoldconfig(instance.cnffiles) - if instance.loaderror then - loadoldconfigdata() - resolvers.saveoldconfig() - end - else - loadoldconfigdata() - if instance.renewcache then - resolvers.saveoldconfig() - end - end - collapse_cnf_data() - end - check_configuration() -end + v = resolvers.repath(v) -- for taco who has a : separated osfontdir + t[k] = v + return v + end) -function resolvers.load_lua() - if #instance.luafiles == 0 then - -- yet harmless - else - instance.rootpath = instance.luafiles[1] - local luafiles = instance.luafiles - for k=1,#luafiles do - instance.luafiles[k] = file.collapse_path(luafiles[k]) - end - for i=1,3 do - instance.rootpath = file.dirname(instance.rootpath) + setmetatableindex(expansions, function(t,k) + local v = environment[k] + if type(v) == "string" then + v = lpegmatch(variableresolver,v) + v = lpegmatch(variablecleaner,v) end - instance.rootpath = file.collapse_path(instance.rootpath) - resolvers.loadnewconfig() - collapse_cnf_data() - end - check_configuration() -end + t[k] = v + return v + end) --- database loading + return newinstance -function resolvers.load_hash() - resolvers.locatelists() - if instance.diskcache and not instance.renewcache then - resolvers.loadfiles() - if instance.loaderror then - resolvers.loadlists() - resolvers.savefiles() - end - else - resolvers.loadlists() - if instance.renewcache then - resolvers.savefiles() - end - end end -function resolvers.append_hash(type,tag,name) - if trace_locating then - logs.report("fileio","hash '%s' appended",tag) - end - insert(instance.hashes, { ['type']=type, ['tag']=tag, ['name']=name } ) +function resolvers.setinstance(someinstance) -- only one instance is active + instance = someinstance + resolvers.instance = someinstance + return someinstance end -function resolvers.prepend_hash(type,tag,name) - if trace_locating then - logs.report("fileio","hash '%s' prepended",tag) - end - insert(instance.hashes, 1, { ['type']=type, ['tag']=tag, ['name']=name } ) +function resolvers.reset() + return resolvers.setinstance(resolvers.newinstance()) end -function resolvers.extend_texmf_var(specification) -- crap, we could better prepend the hash --- local t = resolvers.expanded_path_list('TEXMF') -- full expansion - local t = resolvers.split_path(resolvers.env('TEXMF')) - insert(t,1,specification) - local newspec = concat(t,";") - if instance.environment["TEXMF"] then - instance.environment["TEXMF"] = newspec - elseif instance.variables["TEXMF"] then - instance.variables["TEXMF"] = newspec - else - -- weird - end - resolvers.expand_variables() - reset_hashes() +local function reset_hashes() + instance.lists = { } + instance.found = { } end --- locators +local slash = P("/") -function resolvers.locatelists() - local texmfpaths = resolvers.clean_path_list('TEXMF') - for i=1,#texmfpaths do - local path = texmfpaths[i] - if trace_locating then - logs.report("fileio","locating list of '%s'",path) - end - resolvers.locatedatabase(file.collapse_path(path)) - end -end +local pathexpressionpattern = Cs ( + Cc("^") * ( + Cc("%") * S(".-") + + slash^2 * P(-1) / "/.*" + + slash^2 / "/.-/" + + (1-slash) * P(-1) * Cc("/") + + P(1) + )^1 * Cc("$") -- yes or no $ +) -function resolvers.locatedatabase(specification) - return resolvers.methodhandler('locators', specification) -end +local cache = { } -function resolvers.locators.tex(specification) - if specification and specification ~= '' and lfs.isdir(specification) then - if trace_locating then - logs.report("fileio","tex locator '%s' found",specification) +local function makepathexpression(str) + if str == "." then + return "^%./$" + else + local c = cache[str] + if not c then + c = lpegmatch(pathexpressionpattern,str) + cache[str] = c end - resolvers.append_hash('file',specification,filename) - elseif trace_locating then - logs.report("fileio","tex locator '%s' not found",specification) + return c end end --- hashers - -function resolvers.hashdatabase(tag,name) - return resolvers.methodhandler('hashers',tag,name) -end - -function resolvers.loadfiles() - instance.loaderror = false - instance.files = { } - if not instance.renewcache then - local hashes = instance.hashes - for k=1,#hashes do - local hash = hashes[k] - resolvers.hashdatabase(hash.tag,hash.name) - if instance.loaderror then break end +local function reportcriticalvariables() + if trace_locating then + for i=1,#resolvers.criticalvars do + local k = resolvers.criticalvars[i] + local v = resolvers.getenv(k) or "unknown" -- this one will not resolve ! + report_resolving("variable '%s' set to '%s'",k,v) end + report_resolving() end + reportcriticalvariables = function() end end -function resolvers.hashers.tex(tag,name) - resolvers.load_data(tag,'files') -end - --- generators: - -function resolvers.loadlists() - local hashes = instance.hashes - for i=1,#hashes do - resolvers.generatedatabase(hashes[i].tag) - end -end - -function resolvers.generatedatabase(specification) - return resolvers.methodhandler('generators', specification) -end - --- starting with . or .. etc or funny char - -local weird = lpeg.P(".")^1 + lpeg.anywhere(lpeg.S("~`!#$%^&*()={}[]:;\"\'||<>,?\n\r\t")) - ---~ local l_forbidden = lpeg.S("~`!#$%^&*()={}[]:;\"\'||\\/<>,?\n\r\t") ---~ local l_confusing = lpeg.P(" ") ---~ local l_character = lpeg.patterns.utf8 ---~ local l_dangerous = lpeg.P(".") - ---~ local l_normal = (l_character - l_forbidden - l_confusing - l_dangerous) * (l_character - l_forbidden - l_confusing^2)^0 * lpeg.P(-1) ---~ ----- l_normal = l_normal * lpeg.Cc(true) + lpeg.Cc(false) - ---~ local function test(str) ---~ print(str,lpeg.match(l_normal,str)) ---~ end ---~ test("ヒラギノ明朝 Pro W3") ---~ test("..ヒラギノ明朝 Pro W3") ---~ test(":ヒラギノ明朝 Pro W3;") ---~ test("ヒラギノ明朝 /Pro W3;") ---~ test("ヒラギノ明朝 Pro W3") - -function resolvers.generators.tex(specification) - local tag = specification - if trace_locating then - logs.report("fileio","scanning path '%s'",specification) - end - instance.files[tag] = { } - local files = instance.files[tag] - local n, m, r = 0, 0, 0 - local spec = specification .. '/' - local attributes = lfs.attributes - local directory = lfs.dir - local function action(path) - local full - if path then - full = spec .. path .. '/' +local function identify_configuration_files() + local specification = instance.specification + if #specification == 0 then + local cnfspec = getenv('TEXMFCNF') + if cnfspec == "" then + cnfspec = resolvers.luacnfspec + resolvers.luacnfstate = "default" else - full = spec + resolvers.luacnfstate = "environment" + end + reportcriticalvariables() + local cnfpaths = expandedpathfromlist(resolvers.splitpath(cnfspec)) + local luacnfname = resolvers.luacnfname + for i=1,#cnfpaths do + local filename = collapsepath(filejoin(cnfpaths[i],luacnfname)) + local realname = resolvers.resolve(filename) + if lfs.isfile(realname) then + specification[#specification+1] = filename + if trace_locating then + report_resolving("found configuration file '%s'",realname) + end + elseif trace_locating then + report_resolving("unknown configuration file '%s'",realname) + end end - for name in directory(full) do - if not lpegmatch(weird,name) then - -- if lpegmatch(l_normal,name) then - local mode = attributes(full..name,'mode') - if mode == 'file' then - if path then - n = n + 1 - local f = files[name] - if f then - if type(f) == 'string' then - files[name] = { f, path } - else - f[#f+1] = path - end - else -- probably unique anyway - files[name] = path - local lower = lower(name) - if name ~= lower then - files["remap:"..lower] = name - r = r + 1 + if trace_locating then + report_resolving() + end + elseif trace_locating then + report_resolving("configuration files already identified") + end +end + +local function load_configuration_files() + local specification = instance.specification + if #specification > 0 then + local luacnfname = resolvers.luacnfname + for i=1,#specification do + local filename = specification[i] + local pathname = filedirname(filename) + local filename = filejoin(pathname,luacnfname) + local realname = resolvers.resolve(filename) -- no shortcut + local blob = loadfile(realname) + if blob then + local setups = instance.setups + local data = blob() + data = data and data.content + if data then + if trace_locating then + report_resolving("loading configuration file '%s'",filename) + report_resolving() + end + local variables = data.variables or { } + local warning = false + for k, v in next, data do + local variant = type(v) + if variant == "table" then + initializesetter(filename,k,v) + elseif variables[k] == nil then + if trace_locating and not warning then + report_resolving("variables like '%s' in configuration file '%s' should move to the 'variables' subtable", + k,resolvers.resolve(filename)) + warning = true end + variables[k] = v end end - elseif mode == 'directory' then - m = m + 1 - if path then - action(path..'/'..name) - else - action(name) + setups[pathname] = variables + if resolvers.luacnfstate == "default" then + -- the following code is not tested + local cnfspec = variables["TEXMFCNF"] + if cnfspec then + if trace_locating then + report_resolving("reloading configuration due to TEXMF redefinition") + end + -- we push the value into the main environment (osenv) so + -- that it takes precedence over the default one and therefore + -- also over following definitions + resolvers.setenv('TEXMFCNF',cnfspec) -- resolves prefixes + -- we now identify and load the specified configuration files + instance.specification = { } + identify_configuration_files() + load_configuration_files() + -- we prevent further overload of the configuration variable + resolvers.luacnfstate = "configuration" + -- we quit the outer loop + break + end end - end - end - end - end - action() - if trace_locating then - logs.report("fileio","%s files found on %s directories with %s uppercase remappings",n,m,r) - end -end - --- savers, todo - -function resolvers.savefiles() - resolvers.save_data('files') -end - --- A config (optionally) has the paths split in tables. Internally --- we join them and split them after the expansion has taken place. This --- is more convenient. ---~ local checkedsplit = string.checkedsplit - -local cache = { } - -local splitter = lpeg.Ct(lpeg.splitat(lpeg.S(os.type == "windows" and ";" or ":;"))) - -local function split_kpse_path(str) -- beware, this can be either a path or a {specification} - local found = cache[str] - if not found then - if str == "" then - found = { } - else - str = gsub(str,"\\","/") ---~ local split = (find(str,";") and checkedsplit(str,";")) or checkedsplit(str,io.pathseparator) -local split = lpegmatch(splitter,str) - found = { } - for i=1,#split do - local s = split[i] - if not find(s,"^{*unset}*") then - found[#found+1] = s - end - end - if trace_expansions then - logs.report("fileio","splitting path specification '%s'",str) - for k=1,#found do - logs.report("fileio","% 4i: %s",k,found[k]) - end - end - cache[str] = found - end - end - return found -end - -resolvers.split_kpse_path = split_kpse_path - -function resolvers.splitconfig() - for i=1,#instance do - local c = instance[i] - for k,v in next, c do - if type(v) == 'string' then - local t = split_kpse_path(v) - if #t > 1 then - c[k] = t + else + if trace_locating then + report_resolving("skipping configuration file '%s' (no content)",filename) + end + setups[pathname] = { } + instance.loaderror = true end + elseif trace_locating then + report_resolving("skipping configuration file '%s' (no file)",filename) end - end - end -end - -function resolvers.joinconfig() - local order = instance.order - for i=1,#order do - local c = order[i] - for k,v in next, c do -- indexed? - if type(v) == 'table' then - c[k] = file.join_path(v) + instance.order[#instance.order+1] = instance.setups[pathname] + if instance.loaderror then + break end end + elseif trace_locating then + report_resolving("warning: no lua configuration files found") end end -function resolvers.split_path(str) - if type(str) == 'table' then - return str - else - return split_kpse_path(str) - end -end - -function resolvers.join_path(str) - if type(str) == 'table' then - return file.join_path(str) - else - return str - end -end +-- scheme magic ... database loading -function resolvers.splitexpansions() - local ie = instance.expansions - for k,v in next, ie do - local t, h, p = { }, { }, split_kpse_path(v) - for kk=1,#p do - local vv = p[kk] - if vv ~= "" and not h[vv] then - t[#t+1] = vv - h[vv] = true - end - end - if #t > 1 then - ie[k] = t - else - ie[k] = t[1] +local function load_file_databases() + instance.loaderror, instance.files = false, allocate() + if not instance.renewcache then + local hashes = instance.hashes + for k=1,#hashes do + local hash = hashes[k] + resolvers.hashers.byscheme(hash.type,hash.name) + if instance.loaderror then break end end end end --- end of split/join code - -function resolvers.saveoldconfig() - resolvers.splitconfig() - resolvers.save_data('configuration') - resolvers.joinconfig() -end - -resolvers.configbanner = [[ --- This is a Luatex configuration file created by 'luatools.lua' or --- 'luatex.exe' directly. For comment, suggestions and questions you can --- contact the ConTeXt Development Team. This configuration file is --- not copyrighted. [HH & TH] -]] - -function resolvers.serialize(files) - -- This version is somewhat optimized for the kind of - -- tables that we deal with, so it's much faster than - -- the generic serializer. This makes sense because - -- luatools and mtxtools are called frequently. Okay, - -- we pay a small price for properly tabbed tables. - local t = { } - local function dump(k,v,m) -- could be moved inline - if type(v) == 'string' then - return m .. "['" .. k .. "']='" .. v .. "'," - elseif #v == 1 then - return m .. "['" .. k .. "']='" .. v[1] .. "'," - else - return m .. "['" .. k .. "']={'" .. concat(v,"','").. "'}," - end - end - t[#t+1] = "return {" - if instance.sortdata then - local sortedfiles = sortedkeys(files) - for i=1,#sortedfiles do - local k = sortedfiles[i] - local fk = files[k] - if type(fk) == 'table' then - t[#t+1] = "\t['" .. k .. "']={" - local sortedfk = sortedkeys(fk) - for j=1,#sortedfk do - local kk = sortedfk[j] - t[#t+1] = dump(kk,fk[kk],"\t\t") +local function locate_file_databases() + -- todo: cache:// and tree:// (runtime) + local texmfpaths = resolvers.expandedpathlist('TEXMF') + if #texmfpaths > 0 then + for i=1,#texmfpaths do + local path = collapsepath(texmfpaths[i]) + local stripped = lpegmatch(inhibitstripper,path) -- the !! thing + if stripped ~= "" then + local runtime = stripped == path + path = resolvers.cleanpath(path) + local spec = resolvers.splitmethod(stripped) + if spec.scheme == "cache" or spec.scheme == "file" then + stripped = spec.path + elseif runtime and (spec.noscheme or spec.scheme == "file") then + stripped = "tree:///" .. stripped end - t[#t+1] = "\t}," - else - t[#t+1] = dump(k,fk,"\t") - end - end - else - for k, v in next, files do - if type(v) == 'table' then - t[#t+1] = "\t['" .. k .. "']={" - for kk,vv in next, v do - t[#t+1] = dump(kk,vv,"\t\t") + if trace_locating then + if runtime then + report_resolving("locating list of '%s' (runtime)",path) + else + report_resolving("locating list of '%s' (cached)",path) + end end - t[#t+1] = "\t}," - else - t[#t+1] = dump(k,v,"\t") + methodhandler('locators',stripped) end end + if trace_locating then + report_resolving() + end + elseif trace_locating then + report_resolving("no texmf paths are defined (using TEXMF)") end - t[#t+1] = "}" - return concat(t,"\n") end -local data_state = { } - -function resolvers.data_state() - return data_state or { } +local function generate_file_databases() + local hashes = instance.hashes + for k=1,#hashes do + local hash = hashes[k] + methodhandler('generators',hash.name) + end + if trace_locating then + report_resolving() + end end -function resolvers.save_data(dataname, makename) -- untested without cache overload - for cachename, files in next, instance[dataname] do - local name = (makename or file.join)(cachename,dataname) - local luaname, lucname = name .. ".lua", name .. ".luc" - if trace_locating then - logs.report("fileio","preparing '%s' for '%s'",dataname,cachename) - end - for k, v in next, files do - if type(v) == "table" and #v == 1 then - files[k] = v[1] - end - end - local data = { - type = dataname, - root = cachename, - version = resolvers.cacheversion, - date = os.date("%Y-%m-%d"), - time = os.date("%H:%M:%S"), - content = files, - uuid = os.uuid(), - } - local ok = io.savedata(luaname,resolvers.serialize(data)) - if ok then +local function save_file_databases() -- will become cachers + for i=1,#instance.hashes do + local hash = instance.hashes[i] + local cachename = hash.name + if hash.cache then + local content = instance.files[cachename] + caches.collapsecontent(content) if trace_locating then - logs.report("fileio","'%s' saved in '%s'",dataname,luaname) - end - if utils.lua.compile(luaname,lucname,false,true) then -- no cleanup but strip - if trace_locating then - logs.report("fileio","'%s' compiled to '%s'",dataname,lucname) - end - else - if trace_locating then - logs.report("fileio","compiling failed for '%s', deleting file '%s'",dataname,lucname) - end - os.remove(lucname) + report_resolving("saving tree '%s'",cachename) end + caches.savecontent(cachename,"files",content) elseif trace_locating then - logs.report("fileio","unable to save '%s' in '%s' (access error)",dataname,luaname) + report_resolving("not saving runtime tree '%s'",cachename) end end end -function resolvers.load_data(pathname,dataname,filename,makename) -- untested without cache overload - filename = ((not filename or (filename == "")) and dataname) or filename - filename = (makename and makename(dataname,filename)) or file.join(pathname,filename) - local blob = loadfile(filename .. ".luc") or loadfile(filename .. ".lua") - if blob then - local data = blob() - if data and data.content and data.type == dataname and data.version == resolvers.cacheversion then - data_state[#data_state+1] = data.uuid - if trace_locating then - logs.report("fileio","loading '%s' for '%s' from '%s'",dataname,pathname,filename) - end - instance[dataname][pathname] = data.content - else - if trace_locating then - logs.report("fileio","skipping '%s' for '%s' from '%s'",dataname,pathname,filename) - end - instance[dataname][pathname] = { } - instance.loaderror = true +local function load_databases() + locate_file_databases() + if instance.diskcache and not instance.renewcache then + load_file_databases() + if instance.loaderror then + generate_file_databases() + save_file_databases() + end + else + generate_file_databases() + if instance.renewcache then + save_file_databases() end - elseif trace_locating then - logs.report("fileio","skipping '%s' for '%s' from '%s'",dataname,pathname,filename) end end --- some day i'll use the nested approach, but not yet (actually we even drop --- engine/progname support since we have only luatex now) --- --- first texmfcnf.lua files are located, next the cached texmf.cnf files --- --- return { --- TEXMFBOGUS = 'effe checken of dit werkt', --- } - -function resolvers.resetconfig() - identify_own() - instance.configuration, instance.setup, instance.order, instance.loaderror = { }, { }, { }, false -end - -function resolvers.loadnewconfig() - local luafiles = instance.luafiles - for i=1,#luafiles do - local cnf = luafiles[i] - local pathname = file.dirname(cnf) - local filename = file.join(pathname,resolvers.luaname) - local blob = loadfile(filename) - if blob then - local data = blob() - if data then - if trace_locating then - logs.report("fileio","loading configuration file '%s'",filename) - end - if true then - -- flatten to variable.progname - local t = { } - for k, v in next, data do -- v = progname - if type(v) == "string" then - t[k] = v - else - for kk, vv in next, v do -- vv = variable - if type(vv) == "string" then - t[vv.."."..v] = kk - end - end - end - end - instance['setup'][pathname] = t - else - instance['setup'][pathname] = data - end - else - if trace_locating then - logs.report("fileio","skipping configuration file '%s'",filename) - end - instance['setup'][pathname] = { } - instance.loaderror = true - end - elseif trace_locating then - logs.report("fileio","skipping configuration file '%s'",filename) +function resolvers.appendhash(type,name,cache) + -- safeguard ... tricky as it's actually a bug when seen twice + if not instance.hashed[name] then + if trace_locating then + report_resolving("hash '%s' appended",name) end - instance.order[#instance.order+1] = instance.setup[pathname] - if instance.loaderror then break end + insert(instance.hashes, { type = type, name = name, cache = cache } ) + instance.hashed[name] = cache end end -function resolvers.loadoldconfig() - if not instance.renewcache then - local cnffiles = instance.cnffiles - for i=1,#cnffiles do - local cnf = cnffiles[i] - local dname = file.dirname(cnf) - resolvers.load_data(dname,'configuration') - instance.order[#instance.order+1] = instance.configuration[dname] - if instance.loaderror then break end - end - end - resolvers.joinconfig() -end - -function resolvers.expand_variables() - local expansions, environment, variables = { }, instance.environment, instance.variables - local env = resolvers.env - instance.expansions = expansions - local engine, progname = instance.engine, instance.progname - if type(engine) ~= "string" then instance.engine, engine = "", "" end - if type(progname) ~= "string" then instance.progname, progname = "", "" end - if engine ~= "" then environment['engine'] = engine end - if progname ~= "" then environment['progname'] = progname end - for k,v in next, environment do - local a, b = match(k,"^(%a+)%_(.*)%s*$") - if a and b then - expansions[a..'.'..b] = v - else - expansions[k] = v +function resolvers.prependhash(type,name,cache) + -- safeguard ... tricky as it's actually a bug when seen twice + if not instance.hashed[name] then + if trace_locating then + report_resolving("hash '%s' prepended",name) end + insert(instance.hashes, 1, { type = type, name = name, cache = cache } ) + instance.hashed[name] = cache end - for k,v in next, environment do -- move environment to expansions - if not expansions[k] then expansions[k] = v end - end - for k,v in next, variables do -- move variables to expansions - if not expansions[k] then expansions[k] = v end - end - local busy = false - local function resolve(a) - busy = true - return expansions[a] or env(a) +end + +function resolvers.extendtexmfvariable(specification) -- crap, we could better prepend the hash + local t = resolvers.splitpath(getenv('TEXMF')) + insert(t,1,specification) + local newspec = concat(t,";") + if instance.environment["TEXMF"] then + instance.environment["TEXMF"] = newspec + elseif instance.variables["TEXMF"] then + instance.variables["TEXMF"] = newspec + else + -- weird end - while true do - busy = false - for k,v in next, expansions do - local s, n = gsub(v,"%$([%a%d%_%-]+)",resolve) - local s, m = gsub(s,"%$%{([%a%d%_%-]+)%}",resolve) - if n > 0 or m > 0 then - expansions[k]= s + reset_hashes() +end + +function resolvers.splitexpansions() + local ie = instance.expansions + for k,v in next, ie do + local t, tn, h, p = { }, 0, { }, splitconfigurationpath(v) + for kk=1,#p do + local vv = p[kk] + if vv ~= "" and not h[vv] then + tn = tn + 1 + t[tn] = vv + h[vv] = true end end - if not busy then break end - end - for k,v in next, expansions do - expansions[k] = gsub(v,"\\", '/') + if #t > 1 then + ie[k] = t + else + ie[k] = t[1] + end end end -function resolvers.variable(name) - return entry(instance.variables,name) -end +-- end of split/join code -function resolvers.expansion(name) - return entry(instance.expansions,name) +-- we used to have 'files' and 'configurations' so therefore the following +-- shared function + +function resolvers.datastate() + return caches.contentstate() end -function resolvers.is_variable(name) - return is_entry(instance.variables,name) +function resolvers.variable(name) + local name = name and lpegmatch(dollarstripper,name) + local result = name and instance.variables[name] + return result ~= nil and result or "" end -function resolvers.is_expansion(name) - return is_entry(instance.expansions,name) +function resolvers.expansion(name) + local name = name and lpegmatch(dollarstripper,name) + local result = name and instance.expansions[name] + return result ~= nil and result or "" end -function resolvers.unexpanded_path_list(str) +function resolvers.unexpandedpathlist(str) local pth = resolvers.variable(str) - local lst = resolvers.split_path(pth) - return expanded_path_from_list(lst) + local lst = resolvers.splitpath(pth) + return expandedpathfromlist(lst) end -function resolvers.unexpanded_path(str) - return file.join_path(resolvers.unexpanded_path_list(str)) +function resolvers.unexpandedpath(str) + return joinpath(resolvers.unexpandedpathlist(str)) end -do -- no longer needed +local done = { } - local done = { } - - function resolvers.reset_extra_path() - local ep = instance.extra_paths - if not ep then - ep, done = { }, { } - instance.extra_paths = ep - elseif #ep > 0 then - instance.lists, done = { }, { } - end +function resolvers.resetextrapath() + local ep = instance.extra_paths + if not ep then + ep, done = { }, { } + instance.extra_paths = ep + elseif #ep > 0 then + instance.lists, done = { }, { } end +end - function resolvers.register_extra_path(paths,subpaths) - local ep = instance.extra_paths or { } - local n = #ep - if paths and paths ~= "" then - if subpaths and subpaths ~= "" then - for p in gmatch(paths,"[^,]+") do - -- we gmatch each step again, not that fast, but used seldom - for s in gmatch(subpaths,"[^,]+") do - local ps = p .. "/" .. s - if not done[ps] then - ep[#ep+1] = resolvers.clean_path(ps) - done[ps] = true - end - end - end - else - for p in gmatch(paths,"[^,]+") do - if not done[p] then - ep[#ep+1] = resolvers.clean_path(p) - done[p] = true - end - end - end - elseif subpaths and subpaths ~= "" then - for i=1,n do +function resolvers.registerextrapath(paths,subpaths) + local ep = instance.extra_paths or { } + local oldn = #ep + local newn = oldn + if paths and paths ~= "" then + if subpaths and subpaths ~= "" then + for p in gmatch(paths,"[^,]+") do -- we gmatch each step again, not that fast, but used seldom for s in gmatch(subpaths,"[^,]+") do - local ps = ep[i] .. "/" .. s + local ps = p .. "/" .. s if not done[ps] then - ep[#ep+1] = resolvers.clean_path(ps) + newn = newn + 1 + ep[newn] = resolvers.cleanpath(ps) done[ps] = true end end end + else + for p in gmatch(paths,"[^,]+") do + if not done[p] then + newn = newn + 1 + ep[newn] = resolvers.cleanpath(p) + done[p] = true + end + end end - if #ep > 0 then - instance.extra_paths = ep -- register paths - end - if #ep > n then - instance.lists = { } -- erase the cache + elseif subpaths and subpaths ~= "" then + for i=1,oldn do + -- we gmatch each step again, not that fast, but used seldom + for s in gmatch(subpaths,"[^,]+") do + local ps = ep[i] .. "/" .. s + if not done[ps] then + newn = newn + 1 + ep[newn] = resolvers.cleanpath(ps) + done[ps] = true + end + end end end - + if newn > 0 then + instance.extra_paths = ep -- register paths + end + if newn > oldn then + instance.lists = { } -- erase the cache + end end local function made_list(instance,list) @@ -1338,14 +624,15 @@ local function made_list(instance,list) if not ep or #ep == 0 then return list else - local done, new = { }, { } + local done, new, newn = { }, { }, 0 -- honour . .. ../.. but only when at the start for k=1,#list do local v = list[k] if not done[v] then if find(v,"^[%.%/]$") then done[v] = true - new[#new+1] = v + newn = newn + 1 + new[newn] = v else break end @@ -1356,7 +643,8 @@ local function made_list(instance,list) local v = ep[k] if not done[v] then done[v] = true - new[#new+1] = v + newn = newn + 1 + new[newn] = v end end -- next the formal paths @@ -1364,118 +652,95 @@ local function made_list(instance,list) local v = list[k] if not done[v] then done[v] = true - new[#new+1] = v + newn = newn + 1 + new[newn] = v end end return new end end -function resolvers.clean_path_list(str) - local t = resolvers.expanded_path_list(str) +function resolvers.cleanpathlist(str) + local t = resolvers.expandedpathlist(str) if t then for i=1,#t do - t[i] = file.collapse_path(resolvers.clean_path(t[i])) + t[i] = collapsepath(resolvers.cleanpath(t[i])) end end return t end -function resolvers.expand_path(str) - return file.join_path(resolvers.expanded_path_list(str)) +function resolvers.expandpath(str) + return joinpath(resolvers.expandedpathlist(str)) end -function resolvers.expanded_path_list(str) +function resolvers.expandedpathlist(str) if not str then - return ep or { } -- ep ? + return { } elseif instance.savelists then - -- engine+progname hash - str = gsub(str,"%$","") + str = lpegmatch(dollarstripper,str) if not instance.lists[str] then -- cached - local lst = made_list(instance,resolvers.split_path(resolvers.expansion(str))) - instance.lists[str] = expanded_path_from_list(lst) + local lst = made_list(instance,resolvers.splitpath(resolvers.expansion(str))) + instance.lists[str] = expandedpathfromlist(lst) end return instance.lists[str] else - local lst = resolvers.split_path(resolvers.expansion(str)) - return made_list(instance,expanded_path_from_list(lst)) - end -end - -function resolvers.expanded_path_list_from_var(str) -- brrr - local tmp = resolvers.var_of_format_or_suffix(gsub(str,"%$","")) - if tmp ~= "" then - return resolvers.expanded_path_list(tmp) - else - return resolvers.expanded_path_list(str) + local lst = resolvers.splitpath(resolvers.expansion(str)) + return made_list(instance,expandedpathfromlist(lst)) end end -function resolvers.expand_path_from_var(str) - return file.join_path(resolvers.expanded_path_list_from_var(str)) +function resolvers.expandedpathlistfromvariable(str) -- brrr + str = lpegmatch(dollarstripper,str) + local tmp = resolvers.variableofformatorsuffix(str) + return resolvers.expandedpathlist(tmp ~= "" and tmp or str) end -function resolvers.format_of_var(str) - return formats[str] or formats[alternatives[str]] or '' -end -function resolvers.format_of_suffix(str) - return suffixmap[file.extname(str)] or 'tex' +function resolvers.expandpathfromvariable(str) + return joinpath(resolvers.expandedpathlistfromvariable(str)) end -function resolvers.variable_of_format(str) - return formats[str] or formats[alternatives[str]] or '' +function resolvers.expandbraces(str) -- output variable and brace expansion of STRING + local ori = resolvers.variable(str) + local pth = expandedpathfromlist(resolvers.splitpath(ori)) + return joinpath(pth) end -function resolvers.var_of_format_or_suffix(str) - local v = formats[str] - if v then - return v - end - v = formats[alternatives[str]] - if v then - return v - end - v = suffixmap[file.extname(str)] - if v then - return formats[isf] +function resolvers.registerfilehash(name,content,someerror) + if content then + instance.files[name] = content + else + instance.files[name] = { } + if somerror == true then -- can be unset + instance.loaderror = someerror + end end - return '' -end - -function resolvers.expand_braces(str) -- output variable and brace expansion of STRING - local ori = resolvers.variable(str) - local pth = expanded_path_from_list(resolvers.split_path(ori)) - return file.join_path(pth) end -resolvers.isreadable = { } - -function resolvers.isreadable.file(name) - local readable = lfs.isfile(name) -- brrr +local function isreadable(name) + local readable = lfs.isfile(name) -- not file.is_readable(name) asit can be a dir if trace_detail then if readable then - logs.report("fileio","file '%s' is readable",name) + report_resolving("file '%s' is readable",name) else - logs.report("fileio","file '%s' is not readable", name) + report_resolving("file '%s' is not readable", name) end end return readable end -resolvers.isreadable.tex = resolvers.isreadable.file - -- name -- name/name local function collect_files(names) - local filelist = { } + local filelist, noffiles = { }, 0 for k=1,#names do local fname = names[k] if trace_detail then - logs.report("fileio","checking name '%s'",fname) + report_resolving("checking name '%s'",fname) end - local bname = file.basename(fname) - local dname = file.dirname(fname) + local bname = filebasename(fname) + local dname = filedirname(fname) if dname == "" or find(dname,"^%.") then dname = false else @@ -1484,11 +749,11 @@ local function collect_files(names) local hashes = instance.hashes for h=1,#hashes do local hash = hashes[h] - local blobpath = hash.tag + local blobpath = hash.name local files = blobpath and instance.files[blobpath] if files then if trace_detail then - logs.report("fileio","deep checking '%s' (%s)",blobpath,bname) + report_resolving("deep checking '%s' (%s)",blobpath,bname) end local blobfile = files[bname] if not blobfile then @@ -1500,62 +765,51 @@ local function collect_files(names) end end if blobfile then + local blobroot = files.__path__ or blobpath if type(blobfile) == 'string' then if not dname or find(blobfile,dname) then - filelist[#filelist+1] = { - hash.type, - file.join(blobpath,blobfile,bname), -- search - resolvers.concatinators[hash.type](blobpath,blobfile,bname) -- result - } + local variant = hash.type + -- local search = filejoin(blobpath,blobfile,bname) + local search = filejoin(blobroot,blobfile,bname) + local result = methodhandler('concatinators',hash.type,blobroot,blobfile,bname) + if trace_detail then + report_resolving("match: variant '%s', search '%s', result '%s'",variant,search,result) + end + noffiles = noffiles + 1 + filelist[noffiles] = { variant, search, result } end else for kk=1,#blobfile do local vv = blobfile[kk] if not dname or find(vv,dname) then - filelist[#filelist+1] = { - hash.type, - file.join(blobpath,vv,bname), -- search - resolvers.concatinators[hash.type](blobpath,vv,bname) -- result - } + local variant = hash.type + -- local search = filejoin(blobpath,vv,bname) + local search = filejoin(blobroot,vv,bname) + local result = methodhandler('concatinators',hash.type,blobroot,vv,bname) + if trace_detail then + report_resolving("match: variant '%s', search '%s', result '%s'",variant,search,result) + end + noffiles = noffiles + 1 + filelist[noffiles] = { variant, search, result } end end end end elseif trace_locating then - logs.report("fileio","no match in '%s' (%s)",blobpath,bname) + report_resolving("no match in '%s' (%s)",blobpath,bname) end end end - if #filelist > 0 then - return filelist - else - return nil - end + return noffiles > 0 and filelist or nil end -function resolvers.suffix_of_format(str) - if suffixes[str] then - return suffixes[str][1] - else - return "" - end -end - -function resolvers.suffixes_of_format(str) - if suffixes[str] then - return suffixes[str] - else - return {} - end -end - -function resolvers.register_in_trees(name) +function resolvers.registerintrees(name) if not find(name,"^%.") then instance.foundintrees[name] = (instance.foundintrees[name] or 0) + 1 -- maybe only one end end --- split the next one up for readability (bu this module needs a cleanup anyway) +-- split the next one up for readability (but this module needs a cleanup anyway) local function can_be_dir(name) -- can become local local fakepaths = instance.fakepaths @@ -1566,61 +820,62 @@ local function can_be_dir(name) -- can become local fakepaths[name] = 2 -- no directory end end - return (fakepaths[name] == 1) + return fakepaths[name] == 1 end -local function collect_instance_files(filename,collected) -- todo : plugin (scanners, checkers etc) - local result = collected or { } +local preparetreepattern = Cs((P(".")/"%%." + P("-")/"%%-" + P(1))^0 * Cc("$")) + +-- this one is split in smaller functions but it needs testing + +local function collect_instance_files(filename,askedformat,allresults) -- todo : plugin (scanners, checkers etc) + local result = { } local stamp = nil - filename = file.collapse_path(filename) + askedformat = askedformat or "" + filename = collapsepath(filename) -- speed up / beware: format problem - if instance.remember then - stamp = filename .. "--" .. instance.engine .. "--" .. instance.progname .. "--" .. instance.format + if instance.remember and not allresults then + stamp = filename .. "--" .. askedformat if instance.found[stamp] then if trace_locating then - logs.report("fileio","remembering file '%s'",filename) + report_resolving("remembered file '%s'",filename) end + resolvers.registerintrees(filename) -- for tracing used files return instance.found[stamp] end end - if not dangerous[instance.format or "?"] then - if resolvers.isreadable.file(filename) then + if not dangerous[askedformat] then + if isreadable(filename) then if trace_detail then - logs.report("fileio","file '%s' found directly",filename) + report_resolving("file '%s' found directly",filename) + end + if stamp then + instance.found[stamp] = { filename } end - instance.found[stamp] = { filename } return { filename } end end if find(filename,'%*') then if trace_locating then - logs.report("fileio","checking wildcard '%s'", filename) + report_resolving("checking wildcard '%s'", filename) end - result = resolvers.find_wildcard_files(filename) + result = resolvers.findwildcardfiles(filename) -- we can use th elocal elseif file.is_qualified_path(filename) then - if resolvers.isreadable.file(filename) then + if isreadable(filename) then if trace_locating then - logs.report("fileio","qualified name '%s'", filename) + report_resolving("qualified name '%s'", filename) end result = { filename } else - local forcedname, ok, suffix = "", false, file.extname(filename) + local forcedname, ok, suffix = "", false, fileextname(filename) if suffix == "" then -- why - if instance.format == "" then - forcedname = filename .. ".tex" - if resolvers.isreadable.file(forcedname) then - if trace_locating then - logs.report("fileio","no suffix, forcing standard filetype 'tex'") - end - result, ok = { forcedname }, true - end - else - local suffixes = resolvers.suffixes_of_format(instance.format) - for _, s in next, suffixes do + local format_suffixes = askedformat == "" and resolvers.defaultsuffixes or suffixes[askedformat] + if format_suffixes then + for i=1,#format_suffixes do + local s = format_suffixes[i] forcedname = filename .. "." .. s - if resolvers.isreadable.file(forcedname) then + if isreadable(forcedname) then if trace_locating then - logs.report("fileio","no suffix, forcing format filetype '%s'", s) + report_resolving("no suffix, forcing format filetype '%s'", s) end result, ok = { forcedname }, true break @@ -1631,23 +886,24 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan if not ok and suffix ~= "" then -- try to find in tree (no suffix manipulation), here we search for the -- matching last part of the name - local basename = file.basename(filename) - local pattern = gsub(filename .. "$","([%.%-])","%%%1") - local savedformat = instance.format + local basename = filebasename(filename) + local pattern = lpegmatch(preparetreepattern,filename) + -- messy .. to be sorted out + local savedformat = askedformat local format = savedformat or "" if format == "" then - instance.format = resolvers.format_of_suffix(suffix) + askedformat = resolvers.formatofsuffix(suffix) end if not format then - instance.format = "othertextfiles" -- kind of everything, maybe texinput is better + askedformat = "othertextfiles" -- kind of everything, maybe texinput is better end -- if basename ~= filename then - local resolved = collect_instance_files(basename) - if #result == 0 then + local resolved = collect_instance_files(basename,askedformat,allresults) + if #result == 0 then -- shouldn't this be resolved ? local lowered = lower(basename) if filename ~= lowered then - resolved = collect_instance_files(lowered) + resolved = collect_instance_files(lowered,askedformat,allresults) end end resolvers.format = savedformat @@ -1672,57 +928,60 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan -- end end if not ok and trace_locating then - logs.report("fileio","qualified name '%s'", filename) + report_resolving("qualified name '%s'", filename) end end else -- search spec - local filetype, extra, done, wantedfiles, ext = '', nil, false, { }, file.extname(filename) - if ext == "" then - if not instance.force_suffixes then - wantedfiles[#wantedfiles+1] = filename - end - else - wantedfiles[#wantedfiles+1] = filename - end - if instance.format == "" then - if ext == "" then - local forcedname = filename .. '.tex' - wantedfiles[#wantedfiles+1] = forcedname - filetype = resolvers.format_of_suffix(forcedname) - if trace_locating then - logs.report("fileio","forcing filetype '%s'",filetype) + local filetype, done, wantedfiles, ext = '', false, { }, fileextname(filename) + -- -- tricky as filename can be bla.1.2.3 + -- if not suffixmap[ext] then --- probably needs to be done elsewhere too + -- wantedfiles[#wantedfiles+1] = filename + -- end + wantedfiles[#wantedfiles+1] = filename + if askedformat == "" then + if ext == "" or not suffixmap[ext] then + local defaultsuffixes = resolvers.defaultsuffixes + for i=1,#defaultsuffixes do + local forcedname = filename .. '.' .. defaultsuffixes[i] + wantedfiles[#wantedfiles+1] = forcedname + filetype = resolvers.formatofsuffix(forcedname) + if trace_locating then + report_resolving("forcing filetype '%s'",filetype) + end end else - filetype = resolvers.format_of_suffix(filename) + filetype = resolvers.formatofsuffix(filename) if trace_locating then - logs.report("fileio","using suffix based filetype '%s'",filetype) + report_resolving("using suffix based filetype '%s'",filetype) end end else - if ext == "" then - local suffixes = resolvers.suffixes_of_format(instance.format) - for _, s in next, suffixes do - wantedfiles[#wantedfiles+1] = filename .. "." .. s + if ext == "" or not suffixmap[ext] then + local format_suffixes = suffixes[askedformat] + if format_suffixes then + for i=1,#format_suffixes do + wantedfiles[#wantedfiles+1] = filename .. "." .. format_suffixes[i] + end end end - filetype = instance.format + filetype = askedformat if trace_locating then - logs.report("fileio","using given filetype '%s'",filetype) + report_resolving("using given filetype '%s'",filetype) end end - local typespec = resolvers.variable_of_format(filetype) - local pathlist = resolvers.expanded_path_list(typespec) + local typespec = resolvers.variableofformat(filetype) + local pathlist = resolvers.expandedpathlist(typespec) if not pathlist or #pathlist == 0 then -- no pathlist, access check only / todo == wildcard if trace_detail then - logs.report("fileio","checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | ")) + report_resolving("checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | ")) end for k=1,#wantedfiles do local fname = wantedfiles[k] - if fname and resolvers.isreadable.file(fname) then + if fname and isreadable(fname) then filename, done = fname, true - result[#result+1] = file.join('.',fname) + result[#result+1] = filejoin('.',fname) break end end @@ -1730,8 +989,8 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan local filelist = collect_files(wantedfiles) local fl = filelist and filelist[1] if fl then - filename = fl[3] - result[#result+1] = filename + filename = fl[3] -- not local? + result[#result+1] = resolvers.resolve(filename) done = true end else @@ -1740,76 +999,65 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan local dirlist = { } if filelist then for i=1,#filelist do - dirlist[i] = file.dirname(filelist[i][2]) .. "/" + dirlist[i] = filedirname(filelist[i][3]) .. "/" -- was [2] .. gamble end end if trace_detail then - logs.report("fileio","checking filename '%s'",filename) + report_resolving("checking filename '%s'",filename) end - -- a bit messy ... esp the doscan setting here - local doscan for k=1,#pathlist do local path = pathlist[k] - if find(path,"^!!") then doscan = false else doscan = true end - local pathname = gsub(path,"^!+", '') + local pathname = lpegmatch(inhibitstripper,path) + local doscan = path == pathname -- no ^!! done = false -- using file list if filelist then - local expression -- compare list entries with permitted pattern -- /xx /xx// - if not find(pathname,"/$") then - expression = pathname .. "/" - else - expression = pathname - end - expression = gsub(expression,"([%-%.])","%%%1") -- this also influences - expression = gsub(expression,"//+$", '/.*') -- later usage of pathname - expression = gsub(expression,"//", '/.-/') -- not ok for /// but harmless - expression = "^" .. expression .. "$" + local expression = makepathexpression(pathname) if trace_detail then - logs.report("fileio","using pattern '%s' for path '%s'",expression,pathname) + report_resolving("using pattern '%s' for path '%s'",expression,pathname) end for k=1,#filelist do local fl = filelist[k] local f = fl[2] local d = dirlist[k] if find(d,expression) then - --- todo, test for readable - result[#result+1] = fl[3] - resolvers.register_in_trees(f) -- for tracing used files + -- todo, test for readable + result[#result+1] = resolvers.resolve(fl[3]) -- no shortcut done = true - if instance.allresults then + if allresults then if trace_detail then - logs.report("fileio","match in hash for file '%s' on path '%s', continue scanning",f,d) + report_resolving("match to '%s' in hash for file '%s' and path '%s', continue scanning",expression,f,d) end else if trace_detail then - logs.report("fileio","match in hash for file '%s' on path '%s', quit scanning",f,d) + report_resolving("match to '%s' in hash for file '%s' and path '%s', quit scanning",expression,f,d) end break end elseif trace_detail then - logs.report("fileio","no match in hash for file '%s' on path '%s'",f,d) + report_resolving("no match to '%s' in hash for file '%s' and path '%s'",expression,f,d) end end end if not done and doscan then -- check if on disk / unchecked / does not work at all / also zips - if resolvers.splitmethod(pathname).scheme == 'file' then -- ? + local scheme = url.hasscheme(pathname) + if not scheme or scheme == "file" then local pname = gsub(pathname,"%.%*$",'') if not find(pname,"%*") then local ppname = gsub(pname,"/+$","") if can_be_dir(ppname) then for k=1,#wantedfiles do local w = wantedfiles[k] - local fname = file.join(ppname,w) - if resolvers.isreadable.file(fname) then + local fname = filejoin(ppname,w) + if isreadable(fname) then if trace_detail then - logs.report("fileio","found '%s' by scanning",fname) + report_resolving("found '%s' by scanning",fname) end result[#result+1] = fname done = true - if not instance.allresults then break end + if not allresults then break end end end else @@ -1819,56 +1067,357 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan end end if not done and doscan then - -- todo: slow path scanning + -- todo: slow path scanning ... although we now have tree:// supported in $TEXMF end - if done and not instance.allresults then break end + if done and not allresults then break end end end end for k=1,#result do - result[k] = file.collapse_path(result[k]) + local rk = collapsepath(result[k]) + result[k] = rk + resolvers.registerintrees(rk) -- for tracing used files end - if instance.remember then + if stamp then instance.found[stamp] = result end return result end -if not resolvers.concatinators then resolvers.concatinators = { } end +-- -- -- begin of main file search routing -- -- -- -resolvers.concatinators.tex = file.join -resolvers.concatinators.file = resolvers.concatinators.tex +--~ local collect_instance_files -function resolvers.find_files(filename,filetype,mustexist) - if type(mustexist) == boolean then - -- all set - elseif type(filetype) == 'boolean' then - filetype, mustexist = nil, false - elseif type(filetype) ~= 'string' then - filetype, mustexist = nil, false - end - instance.format = filetype or '' - local result = collect_instance_files(filename) +--~ local function find_direct(filename) +--~ if not dangerous[askedformat] and isreadable(filename) then +--~ if trace_detail then +--~ report_resolving("file '%s' found directly",filename) +--~ end +--~ return { filename } +--~ end +--~ end + +--~ local function find_wildcard(filename) +--~ if find(filename,'%*') then +--~ if trace_locating then +--~ report_resolving("checking wildcard '%s'", filename) +--~ end +--~ return resolvers.findwildcardfiles(filename) -- we can use the local +--~ end +--~ end + +--~ local function find_qualified(filename) -- this one will be split too +--~ if not file.is_qualified_path(filename) then +--~ return +--~ end +--~ if trace_locating then +--~ report_resolving("checking qualified name '%s'", filename) +--~ end +--~ if isreadable(filename) then +--~ if trace_detail then +--~ report_resolving("qualified file '%s' found", filename) +--~ end +--~ return { filename } +--~ else +--~ if trace_detail then +--~ report_resolving("locating qualified file '%s'", filename) +--~ end +--~ local forcedname, suffix = "", fileextname(filename) +--~ if suffix == "" then -- why +--~ local format_suffixes = askedformat == "" and resolvers.defaultsuffixes or suffixes[askedformat] +--~ if format_suffixes then +--~ for i=1,#format_suffixes do +--~ local s = format_suffixes[i] +--~ forcedname = filename .. "." .. s +--~ if isreadable(forcedname) then +--~ if trace_locating then +--~ report_resolving("no suffix, forcing format filetype '%s'", s) +--~ end +--~ return { forcedname } +--~ end +--~ end +--~ end +--~ end +--~ if suffix ~= "" then +--~ -- try to find in tree (no suffix manipulation), here we search for the +--~ -- matching last part of the name +--~ local basename = filebasename(filename) +--~ local pattern = lpegmatch(preparetreepattern,filename) +--~ -- messy .. to be sorted out +--~ local savedformat = askedformat +--~ local format = savedformat or "" +--~ if format == "" then +--~ askedformat = resolvers.formatofsuffix(suffix) +--~ end +--~ if not format then +--~ askedformat = "othertextfiles" -- kind of everything, maybe all +--~ end +--~ -- +--~ if basename ~= filename then +--~ local resolved = collect_instance_files(basename,askedformat,allresults) +--~ if #resolved == 0 then +--~ local lowered = lower(basename) +--~ if filename ~= lowered then +--~ resolved = collect_instance_files(lowered,askedformat,allresults) +--~ end +--~ end +--~ resolvers.format = savedformat +--~ -- +--~ if #resolved > 0 then +--~ local result = { } +--~ for r=1,#resolved do +--~ local rr = resolved[r] +--~ if find(rr,pattern) then +--~ result[#result+1] = rr +--~ end +--~ end +--~ if #result > 0 then +--~ return result +--~ end +--~ end +--~ end +--~ -- a real wildcard: +--~ -- +--~ -- local filelist = collect_files({basename}) +--~ -- result = { } +--~ -- for f=1,#filelist do +--~ -- local ff = filelist[f][3] or "" +--~ -- if find(ff,pattern) then +--~ -- result[#result+1], ok = ff, true +--~ -- end +--~ -- end +--~ -- if #result > 0 then +--~ -- return result +--~ -- end +--~ end +--~ end +--~ end + +--~ local function find_analyze(filename,askedformat) +--~ local filetype, wantedfiles, ext = '', { }, fileextname(filename) +--~ -- too tricky as filename can be bla.1.2.3: +--~ -- +--~ -- if not suffixmap[ext] then +--~ -- wantedfiles[#wantedfiles+1] = filename +--~ -- end +--~ wantedfiles[#wantedfiles+1] = filename +--~ if askedformat == "" then +--~ if ext == "" or not suffixmap[ext] then +--~ local defaultsuffixes = resolvers.defaultsuffixes +--~ for i=1,#defaultsuffixes do +--~ local forcedname = filename .. '.' .. defaultsuffixes[i] +--~ wantedfiles[#wantedfiles+1] = forcedname +--~ filetype = resolvers.formatofsuffix(forcedname) +--~ if trace_locating then +--~ report_resolving("forcing filetype '%s'",filetype) +--~ end +--~ end +--~ else +--~ filetype = resolvers.formatofsuffix(filename) +--~ if trace_locating then +--~ report_resolving("using suffix based filetype '%s'",filetype) +--~ end +--~ end +--~ else +--~ if ext == "" or not suffixmap[ext] then +--~ local format_suffixes = suffixes[askedformat] +--~ if format_suffixes then +--~ for i=1,#format_suffixes do +--~ wantedfiles[#wantedfiles+1] = filename .. "." .. format_suffixes[i] +--~ end +--~ end +--~ end +--~ filetype = askedformat +--~ if trace_locating then +--~ report_resolving("using given filetype '%s'",filetype) +--~ end +--~ end +--~ return filetype, wantedfiles +--~ end + +--~ local function find_intree(filename,filetype,wantedfiles) +--~ local typespec = resolvers.variableofformat(filetype) +--~ local pathlist = resolvers.expandedpathlist(typespec) +--~ if pathlist and #pathlist > 0 then +--~ -- list search +--~ local filelist = collect_files(wantedfiles) +--~ local dirlist = { } +--~ if filelist then +--~ for i=1,#filelist do +--~ dirlist[i] = filedirname(filelist[i][3]) .. "/" -- was [2] .. gamble +--~ end +--~ end +--~ if trace_detail then +--~ report_resolving("checking filename '%s'",filename) +--~ end +--~ local result = { } +--~ for k=1,#pathlist do +--~ local path = pathlist[k] +--~ local pathname = lpegmatch(inhibitstripper,path) +--~ local doscan = path == pathname -- no ^!! +--~ local done = false +--~ -- using file list +--~ if filelist then +--~ -- compare list entries with permitted pattern -- /xx /xx// +--~ local expression = makepathexpression(pathname) +--~ if trace_detail then +--~ report_resolving("using pattern '%s' for path '%s'",expression,pathname) +--~ end +--~ for k=1,#filelist do +--~ local fl = filelist[k] +--~ local f = fl[2] +--~ local d = dirlist[k] +--~ if find(d,expression) then +--~ -- todo, test for readable +--~ result[#result+1] = resolvers.resolve(fl[3]) -- no shortcut +--~ done = true +--~ if allresults then +--~ if trace_detail then +--~ report_resolving("match to '%s' in hash for file '%s' and path '%s', continue scanning",expression,f,d) +--~ end +--~ else +--~ if trace_detail then +--~ report_resolving("match to '%s' in hash for file '%s' and path '%s', quit scanning",expression,f,d) +--~ end +--~ break +--~ end +--~ elseif trace_detail then +--~ report_resolving("no match to '%s' in hash for file '%s' and path '%s'",expression,f,d) +--~ end +--~ end +--~ end +--~ if not done and doscan then +--~ -- check if on disk / unchecked / does not work at all / also zips +--~ local scheme = url.hasscheme(pathname) +--~ if not scheme or scheme == "file" then +--~ local pname = gsub(pathname,"%.%*$",'') +--~ if not find(pname,"%*") then +--~ local ppname = gsub(pname,"/+$","") +--~ if can_be_dir(ppname) then +--~ for k=1,#wantedfiles do +--~ local w = wantedfiles[k] +--~ local fname = filejoin(ppname,w) +--~ if isreadable(fname) then +--~ if trace_detail then +--~ report_resolving("found '%s' by scanning",fname) +--~ end +--~ result[#result+1] = fname +--~ done = true +--~ if not allresults then break end +--~ end +--~ end +--~ else +--~ -- no access needed for non existing path, speedup (esp in large tree with lots of fake) +--~ end +--~ end +--~ end +--~ end +--~ if not done and doscan then +--~ -- todo: slow path scanning ... although we now have tree:// supported in $TEXMF +--~ end +--~ if done and not allresults then +--~ return #result > 0 and result +--~ end +--~ end +--~ end +--~ end + +--~ local function find_onpath(filename,filetype,wantedfiles) +--~ local done = nil +--~ if trace_detail then +--~ report_resolving("checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | ")) +--~ end +--~ for k=1,#wantedfiles do +--~ local fname = wantedfiles[k] +--~ if fname and isreadable(fname) then +--~ filename, done = fname, true +--~ result[#result+1] = filejoin('.',fname) +--~ break +--~ end +--~ end +--~ end + +--~ local function find_otherwise(filename,filetype,wantedfiles) -- other text files | any | whatever +--~ local filelist = collect_files(wantedfiles) +--~ local fl = filelist and filelist[1] +--~ if fl then +--~ return { resolvers.resolve(fl[3]) } -- filename +--~ end +--~ end + +--~ collect_instance_files = function(filename,askedformat,allresults) -- uses nested +--~ local result, stamp, filetype, wantedfiles +--~ askedformat = askedformat or "" +--~ filename = collapsepath(filename) +--~ if instance.remember and not allresults then +--~ stamp = format("%s--%s", filename, askedformat) +--~ result = stamp and instance.found[stamp] +--~ if result then +--~ if trace_locating then +--~ report_resolving("remembered file '%s'",filename) +--~ end +--~ return result +--~ end +--~ end +--~ result = find_direct (filename,stamp) or +--~ find_wildcard (filename) or +--~ find_qualified(filename) +--~ if not result then +--~ filetype, wantedfiles = find_analyze(filename,askedformat) +--~ result = find_intree (filename,filetype,wantedfiles) or +--~ find_onpath (filename,filetype,wantedfiles) or +--~ find_otherwise(filename,filetype,wantedfiles) +--~ end +--~ if result then +--~ for k=1,#result do +--~ local rk = collapsepath(result[k]) +--~ result[k] = rk +--~ resolvers.registerintrees(rk) -- for tracing used files +--~ end +--~ else +--~ result = { } -- maybe false +--~ end +--~ if stamp then +--~ if trace_locating then +--~ report_resolving("remembering file '%s'",filename) +--~ end +--~ instance.found[stamp] = result +--~ end +--~ return result +--~ end + +-- -- -- end of main file search routing -- -- -- + +local function findfiles(filename,filetype,allresults) + local result = collect_instance_files(filename,filetype or "",allresults) if #result == 0 then local lowered = lower(filename) if filename ~= lowered then - return collect_instance_files(lowered) + return collect_instance_files(lowered,filetype or "",allresults) end end - instance.format = '' return result end -function resolvers.find_file(filename,filetype,mustexist) - return (resolvers.find_files(filename,filetype,mustexist)[1] or "") +function resolvers.findfiles(filename,filetype) + return findfiles(filename,filetype,true) +end + +function resolvers.findfile(filename,filetype) + return findfiles(filename,filetype,false)[1] or "" +end + +function resolvers.findpath(filename,filetype) + return filedirname(findfiles(filename,filetype,false)[1] or "") end -function resolvers.find_given_files(filename) - local bname, result = file.basename(filename), { } +local function findgivenfiles(filename,allresults) + local bname, result = filebasename(filename), { } local hashes = instance.hashes + local noffound = 0 for k=1,#hashes do local hash = hashes[k] - local files = instance.files[hash.tag] or { } + local files = instance.files[hash.name] or { } local blist = files[bname] if not blist then local rname = "remap:"..bname @@ -1880,13 +1429,21 @@ function resolvers.find_given_files(filename) end if blist then if type(blist) == 'string' then - result[#result+1] = resolvers.concatinators[hash.type](hash.tag,blist,bname) or "" - if not instance.allresults then break end + local found = methodhandler('concatinators',hash.type,hash.name,blist,bname) or "" + if found ~= "" then + noffound = noffound + 1 + result[noffound] = resolvers.resolve(found) + if not allresults then break end + end else for kk=1,#blist do local vv = blist[kk] - result[#result+1] = resolvers.concatinators[hash.type](hash.tag,vv,bname) or "" - if not instance.allresults then break end + local found = methodhandler('concatinators',hash.type,hash.name,vv,bname) or "" + if found ~= "" then + noffound = noffound + 1 + result[noffound] = resolvers.resolve(found) + if not allresults then break end + end end end end @@ -1894,24 +1451,31 @@ function resolvers.find_given_files(filename) return result end -function resolvers.find_given_file(filename) - return (resolvers.find_given_files(filename)[1] or "") +function resolvers.findgivenfiles(filename) + return findgivenfiles(filename,true) end -local function doit(path,blist,bname,tag,kind,result,allresults) +function resolvers.findgivenfile(filename) + return findgivenfiles(filename,false)[1] or "" +end + +local function doit(path,blist,bname,tag,variant,result,allresults) local done = false - if blist and kind then + if blist and variant then + local resolve = resolvers.resolve -- added if type(blist) == 'string' then -- make function and share code if find(lower(blist),path) then - result[#result+1] = resolvers.concatinators[kind](tag,blist,bname) or "" + local full = methodhandler('concatinators',variant,tag,blist,bname) or "" + result[#result+1] = resolve(full) done = true end else for kk=1,#blist do local vv = blist[kk] if find(lower(vv),path) then - result[#result+1] = resolvers.concatinators[kind](tag,vv,bname) or "" + local full = methodhandler('concatinators',variant,tag,vv,bname) or "" + result[#result+1] = resolve(full) done = true if not allresults then break end end @@ -1921,30 +1485,38 @@ local function doit(path,blist,bname,tag,kind,result,allresults) return done end -function resolvers.find_wildcard_files(filename) -- todo: remap: - local result = { } - local bname, dname = file.basename(filename), file.dirname(filename) - local path = gsub(dname,"^*/","") - path = gsub(path,"*",".*") - path = gsub(path,"-","%%-") - if dname == "" then - path = ".*" - end - local name = bname - name = gsub(name,"*",".*") - name = gsub(name,"-","%%-") - path = lower(path) - name = lower(name) - local files, allresults, done = instance.files, instance.allresults, false +--~ local makewildcard = Cs( +--~ (P("^")^0 * P("/") * P(-1) + P(-1)) /".*" +--~ + (P("^")^0 * P("/") / "") * (P("*")/".*" + P("-")/"%%-" + P("?")/"."+ P("\\")/"/" + P(1))^0 +--~ ) + +local makewildcard = Cs( + (P("^")^0 * P("/") * P(-1) + P(-1)) /".*" + + (P("^")^0 * P("/") / "")^0 * (P("*")/".*" + P("-")/"%%-" + P(".")/"%%." + P("?")/"."+ P("\\")/"/" + P(1))^0 +) + +function resolvers.wildcardpattern(pattern) + return lpegmatch(makewildcard,pattern) or pattern +end + +local function findwildcardfiles(filename,allresults,result) -- todo: remap: and lpeg + result = result or { } +--~ local path = lower(lpegmatch(makewildcard,filedirname (filename))) +--~ local name = lower(lpegmatch(makewildcard,filebasename(filename))) + local base = filebasename(filename) + local dirn = filedirname(filename) + local path = lower(lpegmatch(makewildcard,dirn) or dirn) + local name = lower(lpegmatch(makewildcard,base) or base) + local files, done = instance.files, false if find(name,"%*") then local hashes = instance.hashes for k=1,#hashes do local hash = hashes[k] - local tag, kind = hash.tag, hash.type - for kk, hh in next, files[hash.tag] do + local hashname, hashtype = hash.name, hash.type + for kk, hh in next, files[hashname] do if not find(kk,"^remap:") then if find(lower(kk),name) then - if doit(path,hh,kk,tag,kind,result,allresults) then done = true end + if doit(path,hh,kk,hashname,hashtype,result,allresults) then done = true end if done and not allresults then break end end end @@ -1954,8 +1526,8 @@ function resolvers.find_wildcard_files(filename) -- todo: remap: local hashes = instance.hashes for k=1,#hashes do local hash = hashes[k] - local tag, kind = hash.tag, hash.type - if doit(path,files[tag][bname],bname,tag,kind,result,allresults) then done = true end + local hashname, hashtype = hash.name, hash.type + if doit(path,files[hashname][bname],bname,hashname,hashtype,result,allresults) then done = true end if done and not allresults then break end end end @@ -1964,8 +1536,12 @@ function resolvers.find_wildcard_files(filename) -- todo: remap: return result end -function resolvers.find_wildcard_file(filename) - return (resolvers.find_wildcard_files(filename)[1] or "") +function resolvers.findwildcardfiles(filename,result) + return findwildcardfiles(filename,true,result) +end + +function resolvers.findwildcardfile(filename) + return findwildcardfiles(filename,false)[1] or "" end -- main user functions @@ -1976,34 +1552,33 @@ end function resolvers.load(option) statistics.starttiming(instance) - resolvers.resetconfig() - resolvers.identify_cnf() - resolvers.load_lua() -- will become the new method - resolvers.expand_variables() - resolvers.load_cnf() -- will be skipped when we have a lua file - resolvers.expand_variables() + identify_configuration_files() + load_configuration_files() if option ~= "nofiles" then - resolvers.load_hash() + load_databases() resolvers.automount() end statistics.stoptiming(instance) + local files = instance.files + return files and next(files) and true +end + +local function report(str) + if trace_locating then + report_resolving(str) -- has already verbose + else + print(str) + end end -function resolvers.for_files(command, files, filetype, mustexist) +function resolvers.dowithfilesandreport(command, files, ...) -- will move if files and #files > 0 then - local function report(str) - if trace_locating then - logs.report("fileio",str) -- has already verbose - else - print(str) - end - end if trace_locating then report('') -- ? end for f=1,#files do local file = files[f] - local result = command(file,filetype,mustexist) + local result = command(file,...) if type(result) == 'string' then report(result) else @@ -2015,21 +1590,16 @@ function resolvers.for_files(command, files, filetype, mustexist) end end --- strtab +-- obsolete -resolvers.var_value = resolvers.variable -- output the value of variable $STRING. -resolvers.expand_var = resolvers.expansion -- output variable expansion of STRING. +-- resolvers.varvalue = resolvers.variable -- output the value of variable $STRING. +-- resolvers.expandvar = resolvers.expansion -- output variable expansion of STRING. -function resolvers.show_path(str) -- output search path for file type NAME - return file.join_path(resolvers.expanded_path_list(resolvers.format_of_var(str))) +function resolvers.showpath(str) -- output search path for file type NAME + return joinpath(resolvers.expandedpathlist(resolvers.formatofvariable(str))) end --- resolvers.find_file(filename) --- resolvers.find_file(filename, filetype, mustexist) --- resolvers.find_file(filename, mustexist) --- resolvers.find_file(filename, filetype) - -function resolvers.register_file(files, name, path) +function resolvers.registerfile(files, name, path) if files[name] then if type(files[name]) == 'string' then files[name] = { files[name], path } @@ -2041,129 +1611,94 @@ function resolvers.register_file(files, name, path) end end -function resolvers.splitmethod(filename) - if not filename then - return { } -- safeguard - elseif type(filename) == "table" then - return filename -- already split - elseif not find(filename,"://") then - return { scheme="file", path = filename, original=filename } -- quick hack - else - return url.hashed(filename) +function resolvers.dowithpath(name,func) + local pathlist = resolvers.expandedpathlist(name) + for i=1,#pathlist do + func("^"..resolvers.cleanpath(pathlist[i])) end end -function table.sequenced(t,sep) -- temp here - local s = { } - for k, v in next, t do -- indexed? - s[#s+1] = k .. "=" .. tostring(v) - end - return concat(s, sep or " | ") +function resolvers.dowithvariable(name,func) + func(expandedvariable(name)) end -function resolvers.methodhandler(what, filename, filetype) -- ... - filename = file.collapse_path(filename) - local specification = (type(filename) == "string" and resolvers.splitmethod(filename)) or filename -- no or { }, let it bomb - local scheme = specification.scheme - if resolvers[what][scheme] then - if trace_locating then - logs.report("fileio","handler '%s' -> '%s' -> '%s'",specification.original,what,table.sequenced(specification)) +function resolvers.locateformat(name) + local barename = file.removesuffix(name) -- gsub(name,"%.%a+$","") + local fmtname = caches.getfirstreadablefile(barename..".fmt","formats") or "" + if fmtname == "" then + fmtname = resolvers.findfile(barename..".fmt") + fmtname = resolvers.cleanpath(fmtname) + end + if fmtname ~= "" then + local barename = file.removesuffix(fmtname) + local luaname, lucname, luiname = barename .. ".lua", barename .. ".luc", barename .. ".lui" + if lfs.isfile(luiname) then + return barename, luiname + elseif lfs.isfile(lucname) then + return barename, lucname + elseif lfs.isfile(luaname) then + return barename, luaname end - return resolvers[what][scheme](filename,filetype) -- todo: specification - else - return resolvers[what].tex(filename,filetype) -- todo: specification end + return nil, nil end -function resolvers.clean_path(str) - if str then - str = gsub(str,"\\","/") - str = gsub(str,"^!+","") - str = gsub(str,"^~",resolvers.homedir) - return str +function resolvers.booleanvariable(str,default) + local b = resolvers.expansion(str) + if b == "" then + return default else - return nil - end -end - -function resolvers.do_with_path(name,func) - local pathlist = resolvers.expanded_path_list(name) - for i=1,#pathlist do - func("^"..resolvers.clean_path(pathlist[i])) + b = toboolean(b) + return (b == nil and default) or b end end -function resolvers.do_with_var(name,func) - func(expanded_var(name)) -end - -function resolvers.with_files(pattern,handle) +function resolvers.dowithfilesintree(pattern,handle,before,after) -- will move, can be a nice iterator instead + local instance = resolvers.instance local hashes = instance.hashes for i=1,#hashes do local hash = hashes[i] - local blobpath = hash.tag local blobtype = hash.type + local blobpath = hash.name if blobpath then + if before then + before(blobtype,blobpath,pattern) + end local files = instance.files[blobpath] + local total, checked, done = 0, 0, 0 if files then for k,v in next, files do + total = total + 1 if find(k,"^remap:") then k = files[k] - v = files[k] -- chained + v = k -- files[k] -- chained end if find(k,pattern) then if type(v) == "string" then - handle(blobtype,blobpath,v,k) + checked = checked + 1 + if handle(blobtype,blobpath,v,k) then + done = done + 1 + end else - for _,vv in next, v do -- indexed - handle(blobtype,blobpath,vv,k) + checked = checked + #v + for i=1,#v do + if handle(blobtype,blobpath,v[i],k) then + done = done + 1 + end end end end end end + if after then + after(blobtype,blobpath,pattern,total,checked,done) + end end end end -function resolvers.locate_format(name) - local barename, fmtname = gsub(name,"%.%a+$",""), "" - if resolvers.usecache then - local path = file.join(caches.setpath("formats")) -- maybe platform - fmtname = file.join(path,barename..".fmt") or "" - end - if fmtname == "" then - fmtname = resolvers.find_files(barename..".fmt")[1] or "" - end - fmtname = resolvers.clean_path(fmtname) - if fmtname ~= "" then - local barename = file.removesuffix(fmtname) - local luaname, lucname, luiname = barename .. ".lua", barename .. ".luc", barename .. ".lui" - if lfs.isfile(luiname) then - return barename, luiname - elseif lfs.isfile(lucname) then - return barename, lucname - elseif lfs.isfile(luaname) then - return barename, luaname - end - end - return nil, nil -end - -function resolvers.boolean_variable(str,default) - local b = resolvers.expansion(str) - if b == "" then - return default - else - b = toboolean(b) - return (b == nil and default) or b - end -end - -texconfig.kpse_init = false - -kpse = { original = kpse } setmetatable(kpse, { __index = function(k,v) return resolvers[v] end } ) - --- for a while +resolvers.obsolete = resolvers.obsolete or { } +local obsolete = resolvers.obsolete -input = resolvers +resolvers.find_file = resolvers.findfile obsolete.find_file = resolvers.findfile +resolvers.find_files = resolvers.findfiles obsolete.find_files = resolvers.findfiles diff --git a/Master/texmf-dist/tex/context/base/data-sch.lua b/Master/texmf-dist/tex/context/base/data-sch.lua index e68b6cd01b9..6c905942a23 100644 --- a/Master/texmf-dist/tex/context/base/data-sch.lua +++ b/Master/texmf-dist/tex/context/base/data-sch.lua @@ -8,99 +8,127 @@ if not modules then modules = { } end modules ['data-sch'] = { local http = require("socket.http") local ltn12 = require("ltn12") - local gsub, concat, format = string.gsub, table.concat, string.format +local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders local trace_schemes = false trackers.register("resolvers.schemes",function(v) trace_schemes = v end) -schemes = schemes or { } +local report_schemes = logs.reporter("resolvers","schemes") + +local resolvers = resolvers -schemes.cached = { } -schemes.cachepath = caches.definepath("schemes") +resolvers.schemes = resolvers.schemes or { } +local schemes = resolvers.schemes schemes.threshold = 24 * 60 * 60 directives.register("schemes.threshold", function(v) schemes.threshold = tonumber(v) or schemes.threshold end) -local cached, loaded, reused = schemes.cached, { }, { } +local cleaners = { } -local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders +schemes.cleaners = cleaners + +function cleaners.none(specification) + return specification.original +end + +function cleaners.strip(specification) + return (gsub(specification.original,"[^%a%d%.]+","-")) +end + +function cleaners.md5(specification) + return file.addsuffix(md5.hex(specification.original),file.suffix(specification.path)) +end + +local cleaner = cleaners.strip -function schemes.curl(name,cachename) - local command = "curl --silent --create-dirs --output " .. cachename .. " " .. name -- no protocol .. "://" +directives.register("schemes.cleanmethod", function(v) cleaner = cleaners[v] or cleaners.strip end) + +function resolvers.schemes.cleanname(specification) + local hash = cleaner(specification) + if trace_schemes then + report_schemes("hashing %s to %s",specification.original,hash) + end + return hash +end + +local cached, loaded, reused, thresholds, handlers = { }, { }, { }, { }, { } + +local function runcurl(name,cachename) -- will use sockets instead or the curl library + local command = "curl --silent --create-dirs --output " .. cachename .. " " .. name os.spawn(command) end -function schemes.fetch(protocol,name,handler) - local cachename = schemes.cachepath() .. "/" .. gsub(name,"[^%a%d%.]+","-") - cachename = gsub(cachename,"[\\]", "/") -- cleanup - if not cached[name] then +local function fetch(specification) + local original = specification.original + local scheme = specification.scheme + local cleanname = schemes.cleanname(specification) + local cachename = caches.setfirstwritablefile(cleanname,"schemes") + if not cached[original] then statistics.starttiming(schemes) - if not io.exists(cachename) or (os.difftime(os.time(),lfs.attributes(cachename).modification) > schemes.threshold) then - cached[name] = cachename + if not io.exists(cachename) or (os.difftime(os.time(),lfs.attributes(cachename).modification) > + (thresholds[protocol] or schemes.threshold)) then + cached[original] = cachename + local handler = handlers[scheme] if handler then if trace_schemes then - logs.report("schemes","fetching '%s', protocol '%s', method 'built-in'",name,protocol) + report_schemes("fetching '%s', protocol '%s', method 'built-in'",original,scheme) end - io.flush() - handler(protocol,name,cachename) + logs.flush() + handler(specification,cachename) else if trace_schemes then - logs.report("schemes","fetching '%s', protocol '%s', method 'curl'",name,protocol) + report_schemes("fetching '%s', protocol '%s', method 'curl'",original,scheme) end - io.flush() - schemes.curl(name,cachename) + logs.flush() + runcurl(original,cachename) end end if io.exists(cachename) then - cached[name] = cachename + cached[original] = cachename if trace_schemes then - logs.report("schemes","using cached '%s', protocol '%s', cachename '%s'",name,protocol,cachename) + report_schemes("using cached '%s', protocol '%s', cachename '%s'",original,scheme,cachename) end else - cached[name] = "" + cached[original] = "" if trace_schemes then - logs.report("schemes","using missing '%s', protocol '%s'",name,protocol) + report_schemes("using missing '%s', protocol '%s'",original,scheme) end end - loaded[protocol] = loaded[protocol] + 1 + loaded[scheme] = loaded[scheme] + 1 statistics.stoptiming(schemes) else if trace_schemes then - logs.report("schemes","reusing '%s', protocol '%s'",name,protocol) + report_schemes("reusing '%s', protocol '%s'",original,scheme) end - reused[protocol] = reused[protocol] + 1 + reused[scheme] = reused[scheme] + 1 end - return cached[name] + return cached[original] end -function finders.schemes(protocol,filename,handler) - local foundname = schemes.fetch(protocol,filename,handler) - return finders.generic(protocol,foundname,filetype) +local function finder(specification,filetype) + return resolvers.methodhandler("finders",fetch(specification),filetype) end -function openers.schemes(protocol,filename) - return openers.generic(protocol,filename) +local opener = openers.file +local loader = loaders.file + +local function install(scheme,handler,threshold) + handlers [scheme] = handler + loaded [scheme] = 0 + reused [scheme] = 0 + finders [scheme] = finder + openers [scheme] = opener + loaders [scheme] = loader + thresholds[scheme] = threshold or schemes.threshold end -function loaders.schemes(protocol,filename) - return loaders.generic(protocol,filename) -end - --- could be metatable +schemes.install = install -function schemes.install(protocol,handler) - loaded [protocol] = 0 - reused [protocol] = 0 - finders[protocol] = function (filename,filetype) return finders.schemes(protocol,filename,handler) end - openers[protocol] = function (filename) return openers.schemes(protocol,filename) end - loaders[protocol] = function (filename) return loaders.schemes(protocol,filename) end -end - -local function http_handler(protocol,name,cachename) +local function http_handler(specification,cachename) local tempname = cachename .. ".tmp" local f = io.open(tempname,"wb") local status, message = http.request { - url = name, + url = specification.original, sink = ltn12.sink.file(f) } if not status then @@ -109,34 +137,34 @@ local function http_handler(protocol,name,cachename) os.remove(cachename) os.rename(tempname,cachename) end + return cachename end -schemes.install('http',http_handler) -schemes.install('https') -schemes.install('ftp') +install('http',http_handler) +install('https') -- see pod +install('ftp') statistics.register("scheme handling time", function() - local l, r = { }, { } + local l, r, nl, nr = { }, { }, 0, 0 for k, v in table.sortedhash(loaded) do if v > 0 then - l[#l+1] = k .. ":" .. v + nl = nl + 1 + l[nl] = k .. ":" .. v end end for k, v in table.sortedhash(reused) do if v > 0 then - r[#r+1] = k .. ":" .. v + nr = nr + 1 + r[nr] = k .. ":" .. v end end - local n = #l + #r + local n = nl + nr if n > 0 then - l = (#l > 0 and concat(l)) or "none" - r = (#r > 0 and concat(r)) or "none" + l = (nl > 0 and concat(l)) or "none" + r = (nr > 0 and concat(r)) or "none" return format("%s seconds, %s processed, threshold %s seconds, loaded: %s, reused: %s", statistics.elapsedtime(schemes), n, schemes.threshold, l, r) else return nil end end) - ---~ trace_schemes = true ---~ print(schemes.fetch("http","http://www.pragma-ade.com/show-man.pdf",http_handler)) diff --git a/Master/texmf-dist/tex/context/base/data-tex.lua b/Master/texmf-dist/tex/context/base/data-tex.lua index c9fa3625a66..14148b20ea8 100644 --- a/Master/texmf-dist/tex/context/base/data-tex.lua +++ b/Master/texmf-dist/tex/context/base/data-tex.lua @@ -6,221 +6,161 @@ if not modules then modules = { } end modules ['data-tex'] = { license = "see context related readme files" } --- special functions that deal with io - -local format, lower = string.format, string.lower -local unpack = unpack or table.unpack - local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) -local texiowrite_nl = (texio and texio.write_nl) or print -local texiowrite = (texio and texio.write) or print +local report_tex = logs.reporter("resolvers","tex") -local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders +local resolvers = resolvers -function finders.generic(tag,filename,filetype) - local foundname = resolvers.find_file(filename,filetype) - if foundname and foundname ~= "" then - if trace_locating then - logs.report("fileio","%s finder: file '%s' found",tag,filename) - end - return foundname - else - if trace_locating then - logs.report("fileio","%s finder: unknown file '%s'",tag,filename) - end - return unpack(finders.notfound) - end -end +local sequencers = utilities.sequencers +local methodhandler = resolvers.methodhandler +local splitlines = string.splitlines +local utffiletype = unicode.filetype ---~ local lpegmatch = lpeg.match ---~ local getlines = lpeg.Ct(lpeg.patterns.textline) +local fileprocessor = nil +local lineprocessor = nil -local input_translator, utf_translator, user_translator = nil, nil, nil +local textfileactions = sequencers.reset { + arguments = "str,filename", + returnvalues = "str", + results = "str", +} -function resolvers.install_text_filter(name,func) - if name == "input" then input_translator = func - elseif name == "utf" then utf_translator = func - elseif name == "user" then user_translator = func end -end +local textlineactions = sequencers.reset { + arguments = "str,filename,linenumber,noflines", + returnvalues = "str", + results = "str", +} -function openers.text_opener(filename,file_handle,tag) - local u = unicode.utftype(file_handle) - local t = { } - if u > 0 then - if trace_locating then - logs.report("fileio","%s opener, file '%s' opened using method '%s'",tag,filename,unicode.utfname[u]) - end - local l - if u > 2 then - l = unicode.utf32_to_utf8(file_handle:read("*a"),u==4) - else - l = unicode.utf16_to_utf8(file_handle:read("*a"),u==2) - end - file_handle:close() - t = { - utftype = u, -- may go away - lines = l, - current = 0, -- line number, not really needed - handle = nil, - noflines = #l, - close = function() - if trace_locating then - logs.report("fileio","%s closer, file '%s' closed",tag,filename) - end - logs.show_close(filename) - t = nil - end, - reader = function(self) - self = self or t - local current, lines = self.current, self.lines - if current >= #lines then - return nil - else - current = current + 1 - self.current = current - local line = lines[current] - if not line then - return nil - elseif line == "" then - return "" - else - if input_translator then - line = input_translator(line) - end - if utf_translator then - line = utf_translator(line) - end - if user_translator then - line = user_translator(line) - end - return line - end - end - end - } +local helpers = resolvers.openers.helpers +local appendgroup = sequencers.appendgroup + +helpers.textfileactions = textfileactions +helpers.textlineactions = textlineactions + +appendgroup(textfileactions,"before") -- user +appendgroup(textfileactions,"system") -- private +appendgroup(textfileactions,"after" ) -- user + +appendgroup(textlineactions,"before") -- user +appendgroup(textlineactions,"system") -- private +appendgroup(textlineactions,"after" ) -- user + +function helpers.textopener(tag,filename,filehandle) + local lines + local t_filehandle = type(filehandle) + if not filehandle then + lines = io.loaddata(filename) + elseif t_filehandle == "string" then + lines = filehandle + elseif t_filehandle == "table" then + lines = filehandle else + lines = filehandle:read("*a") + filehandle:close() + end + if type(lines) == "string" then + local coding = utffiletype(lines) if trace_locating then - logs.report("fileio","%s opener, file '%s' opened",tag,filename) + report_tex("%s opener, '%s' opened using method '%s'",tag,filename,coding) end - -- todo: file;name -> freeze / eerste regel scannen -> freeze - --~ local data = lpegmatch(getlines,file_handle:read("*a")) - --~ local n = 0 - t = { - reader = function() -- self - local line = file_handle:read() - --~ n = n + 1 - --~ local line = data[n] - --~ print(line) - if not line then - return nil - elseif line == "" then - return "" - else - if input_translator then - line = input_translator(line) - end - if utf_translator then - line = utf_translator(line) - end - if user_translator then - line = user_translator(line) - end - return line - end - end, - close = function() - if trace_locating then - logs.report("fileio","%s closer, file '%s' closed",tag,filename) - end - logs.show_close(filename) - file_handle:close() - t = nil - collectgarbage("step") -- saves some memory - end, - handle = function() - return file_handle - end, - noflines = function() - t.noflines = io.noflines(file_handle) - return t.noflines - end - } - end - return t -end - -function openers.generic(tag,filename) - if filename and filename ~= "" then - local f = io.open(filename,"r") - if f then - logs.show_open(filename) -- todo - if trace_locating then - logs.report("fileio","%s opener, file '%s' opened",tag,filename) + if coding == "utf-16-be" then + lines = unicode.utf16_to_utf8_be(lines) + elseif coding == "utf-16-le" then + lines = unicode.utf16_to_utf8_le(lines) + elseif coding == "utf-32-be" then + lines = unicode.utf32_to_utf8_be(lines) + elseif coding == "utf-32-le" then + lines = unicode.utf32_to_utf8_le(lines) + else -- utf8 or unknown + if textfileactions.dirty then -- maybe use autocompile + fileprocessor = sequencers.compile(textfileactions) end - return openers.text_opener(filename,f,tag) + lines = fileprocessor(lines,filename) or lines + lines = splitlines(lines) end + elseif trace_locating then + report_tex("%s opener, '%s' opened",tag,filename) end - if trace_locating then - logs.report("fileio","%s opener, file '%s' not found",tag,filename) + local noflines = #lines + if lines[noflines] == "" then -- maybe some special check is needed + lines[noflines] = nil end - return unpack(openers.notfound) -end - -function loaders.generic(tag,filename) - if filename and filename ~= "" then - local f = io.open(filename,"rb") - if f then - logs.show_load(filename) + logs.show_open(filename) + return { + filename = filename, + noflines = noflines, + currentline = 0, + close = function() if trace_locating then - logs.report("fileio","%s loader, file '%s' loaded",tag,filename) + report_tex("%s closer, '%s' closed",tag,filename) end - local s = f:read("*a") - if garbagecollector and garbagecollector.check then garbagecollector.check(#s) end - f:close() - if s then - return true, s, #s + logs.show_close(filename) + t = nil + end, + reader = function(self) + self = self or t + local currentline, noflines = self.currentline, self.noflines + if currentline >= noflines then + return nil + else + currentline = currentline + 1 + self.currentline = currentline + local content = lines[currentline] + if not content then + return nil + elseif content == "" then + return "" + else + if textlineactions.dirty then + lineprocessor = sequencers.compile(textlineactions) -- maybe use autocompile + end + return lineprocessor(content,filename,currentline,noflines) or content + end end end - end - if trace_locating then - logs.report("fileio","%s loader, file '%s' not found",tag,filename) - end - return unpack(loaders.notfound) + } end -function finders.tex(filename,filetype) - return finders.generic('tex',filename,filetype) +function resolvers.findtexfile(filename,filetype) + return methodhandler('finders',filename,filetype) end -function openers.tex(filename) - return openers.generic('tex',filename) +function resolvers.opentexfile(filename) + return methodhandler('openers',filename) end -function loaders.tex(filename) - return loaders.generic('tex',filename) +function resolvers.openfile(filename) + local fullname = methodhandler('finders',filename) + return fullname and fullname ~= "" and methodhandler('openers',fullname) or nil end -function resolvers.findtexfile(filename, filetype) - return resolvers.methodhandler('finders',filename, filetype) +function resolvers.loadtexfile(filename,filetype) + -- todo: optionally apply filters + local ok, data, size = resolvers.loadbinfile(filename, filetype) + return data or "" end -function resolvers.opentexfile(filename) - return resolvers.methodhandler('openers',filename) -end +resolvers.texdatablob = resolvers.loadtexfile -function resolvers.openfile(filename) - local fullname = resolvers.findtexfile(filename) - if fullname and (fullname ~= "") then - return resolvers.opentexfile(fullname) +local function installhandler(namespace,what,where,func) + if not func then + where, func = "after", where + end + if where == "before" or where == "after" then + sequencers.appendaction(namespace,where,func) else - return nil + report_tex("installing input %s handlers in %s is not possible",what,tostring(where)) end end -function resolvers.texdatablob(filename, filetype) - local ok, data, size = resolvers.loadbinfile(filename, filetype) - return data or "" -end +function resolvers.installinputlinehandler(...) installhandler(helpers.textlineactions,"line",...) end +function resolvers.installinputfilehandler(...) installhandler(helpers.textfileactions,"file",...) end -resolvers.loadtexfile = resolvers.texdatablob +-- local basename = file.basename +-- resolvers.installinputlinehandler(function(str,filename,linenumber,noflines) +-- report_tex("[lc] file: %s, line: %s of %s, length: %s",basename(filename),linenumber,noflines,#str) +-- end) +-- resolvers.installinputfilehandler(function(str,filename) +-- report_tex("[fc] file: %s, length: %s",basename(filename),#str) +-- end) diff --git a/Master/texmf-dist/tex/context/base/data-tmf.lua b/Master/texmf-dist/tex/context/base/data-tmf.lua index 7421eacfc6e..9391e881ea7 100644 --- a/Master/texmf-dist/tex/context/base/data-tmf.lua +++ b/Master/texmf-dist/tex/context/base/data-tmf.lua @@ -6,70 +6,60 @@ if not modules then modules = { } end modules ['data-tmf'] = { license = "see context related readme files" } -local find, gsub, match = string.find, string.gsub, string.match -local getenv, setenv = os.getenv, os.setenv +local resolvers = resolvers --- loads *.tmf files in minimal tree roots (to be optimized and documented) +local report_tds = logs.reporter("resolvers","tds") -function resolvers.check_environment(tree) - logs.simpleline() - setenv('TMP', getenv('TMP') or getenv('TEMP') or getenv('TMPDIR') or getenv('HOME')) - setenv('TEXOS', getenv('TEXOS') or ("texmf-" .. os.platform)) - setenv('TEXPATH', gsub(tree or "tex","\/+$",'')) - setenv('TEXMFOS', getenv('TEXPATH') .. "/" .. getenv('TEXOS')) - logs.simpleline() - logs.simple("preset : TEXPATH => %s", getenv('TEXPATH')) - logs.simple("preset : TEXOS => %s", getenv('TEXOS')) - logs.simple("preset : TEXMFOS => %s", getenv('TEXMFOS')) - logs.simple("preset : TMP => %s", getenv('TMP')) - logs.simple('') -end +-- = << +-- ? ?? +-- < += +-- > =+ -function resolvers.load_environment(name) -- todo: key=value as well as lua - local f = io.open(name) - if f then - for line in f:lines() do - if find(line,"^[%%%#]") then - -- skip comment - else - local key, how, value = match(line,"^(.-)%s*([<=>%?]+)%s*(.*)%s*$") - if how then - value = gsub(value,"%%(.-)%%", function(v) return getenv(v) or "" end) - if how == "=" or how == "<<" then - setenv(key,value) - elseif how == "?" or how == "??" then - setenv(key,getenv(key) or value) - elseif how == "<" or how == "+=" then - if getenv(key) then - setenv(key,getenv(key) .. io.fileseparator .. value) - else - setenv(key,value) - end - elseif how == ">" or how == "=+" then - if getenv(key) then - setenv(key,value .. io.pathseparator .. getenv(key)) - else - setenv(key,value) - end - end - end - end - end - f:close() - end -end +function resolvers.load_tree(tree,resolve) + if type(tree) == "string" and tree ~= "" then + + local getenv, setenv = resolvers.getenv, resolvers.setenv + + -- later might listen to the raw osenv var as well + local texos = "texmf-" .. os.platform + + local oldroot = environment.texroot + local newroot = file.collapsepath(tree) -function resolvers.load_tree(tree) - if tree and tree ~= "" then - local setuptex = 'setuptex.tmf' - if lfs.attributes(tree, "mode") == "directory" then -- check if not nil - setuptex = tree .. "/" .. setuptex - else - setuptex = tree + local newtree = file.join(newroot,texos) + local newpath = file.join(newtree,"bin") + + if not lfs.isdir(newtree) then + report_tds("no '%s' under tree %s",texos,tree) + os.exit() end - if io.exists(setuptex) then - resolvers.check_environment(tree) - resolvers.load_environment(setuptex) + if not lfs.isdir(newpath) then + report_tds("no '%s/bin' under tree %s",texos,tree) + os.exit() end + + local texmfos = newtree + + environment.texroot = newroot + environment.texos = texos + environment.texmfos = texmfos + + -- Beware, we need to obey the relocatable autoparent so we + -- set TEXMFCNF to its raw value. This is somewhat tricky when + -- we run a mkii job from within. Therefore, in mtxrun, there + -- is a resolve applied when we're in mkii/kpse mode. + + setenv('SELFAUTOPARENT', newroot) + setenv('SELFAUTODIR', newtree) + setenv('SELFAUTOLOC', newpath) + setenv('TEXROOT', newroot) + setenv('TEXOS', texos) + setenv('TEXMFOS', texmfos) + setenv('TEXMFCNF', resolvers.luacnfspec, not resolve) + setenv("PATH", newpath .. io.pathseparator .. getenv("PATH")) + + report_tds("changing from root '%s' to '%s'",oldroot,newroot) + report_tds("prepending '%s' to binary path",newpath) + report_tds() end end diff --git a/Master/texmf-dist/tex/context/base/data-tmp.lua b/Master/texmf-dist/tex/context/base/data-tmp.lua index 7196daac035..ec6f91e24da 100644 --- a/Master/texmf-dist/tex/context/base/data-tmp.lua +++ b/Master/texmf-dist/tex/context/base/data-tmp.lua @@ -1,5 +1,5 @@ if not modules then modules = { } end modules ['data-tmp'] = { - version = 1.001, + version = 1.100, comment = "companion to luat-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", @@ -22,71 +22,176 @@ being written at the same time is small. We also need to extend luatools with a recache feature.

--ldx]]-- -local format, lower, gsub = string.format, string.lower, string.gsub +local format, lower, gsub, concat = string.format, string.lower, string.gsub, table.concat +local mkdirs, isdir = dir.mkdirs, lfs.isdir -local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) -- not used yet +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end) -caches = caches or { } +local report_caches = logs.reporter("resolvers","caches") +local report_resolvers = logs.reporter("resolvers","caching") + +local resolvers = resolvers + +-- intermezzo + +local directive_cleanup = false directives.register("system.compile.cleanup", function(v) directive_cleanup = v end) +local directive_strip = true directives.register("system.compile.strip", function(v) directive_strip = v end) + +local compile = utilities.lua.compile + +function utilities.lua.compile(luafile,lucfile,cleanup,strip) + if cleanup == nil then cleanup = directive_cleanup end + if strip == nil then strip = directive_strip end + return compile(luafile,lucfile,cleanup,strip) +end + +-- end of intermezzo + +caches = caches or { } +local caches = caches -caches.path = caches.path or nil caches.base = caches.base or "luatex-cache" caches.more = caches.more or "context" caches.direct = false -- true is faster but may need huge amounts of memory caches.tree = false -caches.paths = caches.paths or nil -caches.force = true -- changed for TEXLIVE by TH -caches.defaults = { "TEXMFCACHE", "TMPDIR", "TEMPDIR", "TMP", "TEMP", "HOME", "HOMEPATH" } - -function caches.temp() - local cachepath = nil - local function check(list,isenv) - if not cachepath then - for k=1,#list do - local v = list[k] - cachepath = (isenv and (os.env[v] or "")) or v or "" - if cachepath == "" then - -- next - else - cachepath = resolvers.clean_path(cachepath) - if lfs.isdir(cachepath) and file.iswritable(cachepath) then -- lfs.attributes(cachepath,"mode") == "directory" - break - elseif caches.force or io.ask(format("\nShould I create the cache path %s?",cachepath), "no", { "yes", "no" }) == "yes" then - dir.mkdirs(cachepath) - if lfs.isdir(cachepath) and file.iswritable(cachepath) then - break +caches.force = true +caches.ask = false +caches.relocate = false +caches.defaults = { "TMPDIR", "TEMPDIR", "TMP", "TEMP", "HOME", "HOMEPATH" } + +local writable, readables, usedreadables = nil, { }, { } + +-- we could use a metatable for writable and readable but not yet + +local function identify() + -- Combining the loops makes it messy. First we check the format cache path + -- and when the last component is not present we try to create it. + local texmfcaches = resolvers.cleanpathlist("TEXMFCACHE") + if texmfcaches then + for k=1,#texmfcaches do + local cachepath = texmfcaches[k] + if cachepath ~= "" then + cachepath = resolvers.resolve(cachepath) + cachepath = resolvers.cleanpath(cachepath) + cachepath = file.collapsepath(cachepath) + local valid = isdir(cachepath) + if valid then + if file.is_readable(cachepath) then + readables[#readables+1] = cachepath + if not writable and file.is_writable(cachepath) then + writable = cachepath + end + end + elseif not writable and caches.force then + local cacheparent = file.dirname(cachepath) + if file.is_writable(cacheparent) then + if not caches.ask or io.ask(format("\nShould I create the cache path %s?",cachepath), "no", { "yes", "no" }) == "yes" then + mkdirs(cachepath) + if isdir(cachepath) and file.is_writable(cachepath) then + report_caches("created: %s",cachepath) + writable = cachepath + readables[#readables+1] = cachepath + end end end end - cachepath = nil end end end - check(resolvers.clean_path_list("TEXMFCACHE") or { }) - check(caches.defaults,true) - if not cachepath then - print("\nfatal error: there is no valid (writable) cache path defined\n") + -- As a last resort we check some temporary paths but this time we don't + -- create them. + local texmfcaches = caches.defaults + if texmfcaches then + for k=1,#texmfcaches do + local cachepath = texmfcaches[k] + cachepath = resolvers.expansion(cachepath) -- was getenv + if cachepath ~= "" then + cachepath = resolvers.resolve(cachepath) + cachepath = resolvers.cleanpath(cachepath) + local valid = isdir(cachepath) + if valid and file.is_readable(cachepath) then + if not writable and file.is_writable(cachepath) then + readables[#readables+1] = cachepath + writable = cachepath + break + end + end + end + end + end + -- Some extra checking. If we have no writable or readable path then we simply + -- quit. + if not writable then + report_caches("fatal error: there is no valid writable cache path defined") os.exit() - elseif not lfs.isdir(cachepath) then -- lfs.attributes(cachepath,"mode") ~= "directory" - print(format("\nfatal error: cache path %s is not a directory\n",cachepath)) + elseif #readables == 0 then + report_caches("fatal error: there is no valid readable cache path defined") os.exit() end - cachepath = file.collapse_path(cachepath) - function caches.temp() - return cachepath + -- why here + writable = dir.expandname(resolvers.cleanpath(writable)) -- just in case + -- moved here + local base, more, tree = caches.base, caches.more, caches.tree or caches.treehash() -- we have only one writable tree + if tree then + caches.tree = tree + writable = mkdirs(writable,base,more,tree) + for i=1,#readables do + readables[i] = file.join(readables[i],base,more,tree) + end + else + writable = mkdirs(writable,base,more) + for i=1,#readables do + readables[i] = file.join(readables[i],base,more) + end + end + -- end + if trace_cache then + for i=1,#readables do + report_caches("using readable path '%s' (order %s)",readables[i],i) + end + report_caches("using writable path '%s'",writable) + end + identify = function() + return writable, readables end - return cachepath + return writable, readables end -function caches.configpath() - return table.concat(resolvers.instance.cnffiles,";") +function caches.usedpaths() + local writable, readables = identify() + if #readables > 1 then + local result = { } + for i=1,#readables do + local readable = readables[i] + if usedreadables[i] or readable == writable then + result[#result+1] = format("readable: '%s' (order %s)",readable,i) + end + end + result[#result+1] = format("writable: '%s'",writable) + return result + else + return writable + end +end + +function caches.configfiles() + return table.concat(resolvers.instance.specification,";") end function caches.hashed(tree) - return md5.hex(gsub(lower(tree),"[\\\/]+","/")) + tree = gsub(tree,"\\$","/") + tree = gsub(tree,"/+$","") + tree = lower(tree) + local hash = md5.hex(tree) + if trace_cache or trace_locating then + report_caches("hashing tree %s, hash %s",tree,hash) + end + return hash end function caches.treehash() - local tree = caches.configpath() + local tree = caches.configfiles() if not tree or tree == "" then return false else @@ -94,35 +199,68 @@ function caches.treehash() end end -function caches.setpath(...) - if not caches.path then - if not caches.path then - caches.path = caches.temp() - end - caches.path = resolvers.clean_path(caches.path) -- to be sure - caches.tree = caches.tree or caches.treehash() - if caches.tree then - caches.path = dir.mkdirs(caches.path,caches.base,caches.more,caches.tree) +local r_cache, w_cache = { }, { } -- normally w in in r but who cares + +local function getreadablepaths(...) -- we can optimize this as we have at most 2 tags + local tags = { ... } + local hash = concat(tags,"/") + local done = r_cache[hash] + if not done then + local writable, readables = identify() -- exit if not found + if #tags > 0 then + done = { } + for i=1,#readables do + done[i] = file.join(readables[i],...) + end else - caches.path = dir.mkdirs(caches.path,caches.base,caches.more) + done = readables end + r_cache[hash] = done end - if not caches.path then - caches.path = '.' + return done +end + +local function getwritablepath(...) + local tags = { ... } + local hash = concat(tags,"/") + local done = w_cache[hash] + if not done then + local writable, readables = identify() -- exit if not found + if #tags > 0 then + done = mkdirs(writable,...) + else + done = writable + end + w_cache[hash] = done end - caches.path = resolvers.clean_path(caches.path) - local dirs = { ... } - if #dirs > 0 then - local pth = dir.mkdirs(caches.path,...) - return pth + return done +end + +caches.getreadablepaths = getreadablepaths +caches.getwritablepath = getwritablepath + +function caches.getfirstreadablefile(filename,...) + local rd = getreadablepaths(...) + for i=1,#rd do + local path = rd[i] + local fullname = file.join(path,filename) + if file.is_readable(fullname) then + usedreadables[i] = true + return fullname, path + end end - caches.path = dir.expand_name(caches.path) - return caches.path + return caches.setfirstwritablefile(filename,...) end -function caches.definepath(category,subcategory) +function caches.setfirstwritablefile(filename,...) + local wr = getwritablepath(...) + local fullname = file.join(wr,filename) + return fullname, wr +end + +function caches.define(category,subcategory) -- for old times sake return function() - return caches.setpath(category,subcategory) + return getwritablepath(category,subcategory) end end @@ -130,28 +268,30 @@ function caches.setluanames(path,name) return path .. "/" .. name .. ".tma", path .. "/" .. name .. ".tmc" end -function caches.loaddata(path,name) - local tmaname, tmcname = caches.setluanames(path,name) - local loader = loadfile(tmcname) or loadfile(tmaname) - if loader then - loader = loader() - collectgarbage("step") - return loader - else - return false +function caches.loaddata(readables,name) + if type(readables) == "string" then + readables = { readables } + end + for i=1,#readables do + local path = readables[i] + local tmaname, tmcname = caches.setluanames(path,name) + local loader = loadfile(tmcname) or loadfile(tmaname) + if loader then + loader = loader() + collectgarbage("step") + return loader + end end + return false end ---~ function caches.loaddata(path,name) ---~ local tmaname, tmcname = caches.setluanames(path,name) ---~ return dofile(tmcname) or dofile(tmaname) ---~ end - -function caches.iswritable(filepath,filename) +function caches.is_writable(filepath,filename) local tmaname, tmcname = caches.setluanames(filepath,filename) - return file.iswritable(tmaname) + return file.is_writable(tmaname) end +local saveoptions = { compact = true } + function caches.savedata(filepath,filename,data,raw) local tmaname, tmcname = caches.setluanames(filepath,filename) local reduce, simplify = true, true @@ -160,19 +300,92 @@ function caches.savedata(filepath,filename,data,raw) end data.cache_uuid = os.uuid() if caches.direct then - file.savedata(tmaname, table.serialize(data,'return',false,true,false)) -- no hex + file.savedata(tmaname,table.serialize(data,true,saveoptions)) else - table.tofile(tmaname, data,'return',false,true,false) -- maybe not the last true + table.tofile(tmaname,data,true,saveoptions) end - local cleanup = resolvers.boolean_variable("PURGECACHE", false) - local strip = resolvers.boolean_variable("LUACSTRIP", true) - utils.lua.compile(tmaname, tmcname, cleanup, strip) + utilities.lua.compile(tmaname,tmcname) end --- here we use the cache for format loading (texconfig.[formatname|jobname]) +-- moved from data-res: ---~ if tex and texconfig and texconfig.formatname and texconfig.formatname == "" then -if tex and texconfig and (not texconfig.formatname or texconfig.formatname == "") and input and resolvers.instance then - if not texconfig.luaname then texconfig.luaname = "cont-en.lua" end -- or luc - texconfig.formatname = caches.setpath("formats") .. "/" .. gsub(texconfig.luaname,"%.lu.$",".fmt") +local content_state = { } + +function caches.contentstate() + return content_state or { } +end + +function caches.loadcontent(cachename,dataname) + local name = caches.hashed(cachename) + local full, path = caches.getfirstreadablefile(name ..".lua","trees") + local filename = file.join(path,name) + local blob = loadfile(filename .. ".luc") or loadfile(filename .. ".lua") + if blob then + local data = blob() + if data and data.content then + if data.type == dataname then + if data.version == resolvers.cacheversion then + content_state[#content_state+1] = data.uuid + if trace_locating then + report_resolvers("loading '%s' for '%s' from '%s'",dataname,cachename,filename) + end + return data.content + else + report_resolvers("skipping '%s' for '%s' from '%s' (version mismatch)",dataname,cachename,filename) + end + else + report_resolvers("skipping '%s' for '%s' from '%s' (datatype mismatch)",dataname,cachename,filename) + end + elseif trace_locating then + report_resolvers("skipping '%s' for '%s' from '%s' (no content)",dataname,cachename,filename) + end + elseif trace_locating then + report_resolvers("skipping '%s' for '%s' from '%s' (invalid file)",dataname,cachename,filename) + end +end + +function caches.collapsecontent(content) + for k, v in next, content do + if type(v) == "table" and #v == 1 then + content[k] = v[1] + end + end +end + +function caches.savecontent(cachename,dataname,content) + local name = caches.hashed(cachename) + local full, path = caches.setfirstwritablefile(name ..".lua","trees") + local filename = file.join(path,name) -- is full + local luaname, lucname = filename .. ".lua", filename .. ".luc" + if trace_locating then + report_resolvers("preparing '%s' for '%s'",dataname,cachename) + end + local data = { + type = dataname, + root = cachename, + version = resolvers.cacheversion, + date = os.date("%Y-%m-%d"), + time = os.date("%H:%M:%S"), + content = content, + uuid = os.uuid(), + } + local ok = io.savedata(luaname,table.serialize(data,true)) + if ok then + if trace_locating then + report_resolvers("category '%s', cachename '%s' saved in '%s'",dataname,cachename,luaname) + end + if utilities.lua.compile(luaname,lucname) then + if trace_locating then + report_resolvers("'%s' compiled to '%s'",dataname,lucname) + end + return true + else + if trace_locating then + report_resolvers("compiling failed for '%s', deleting file '%s'",dataname,lucname) + end + os.remove(lucname) + end + elseif trace_locating then + report_resolvers("unable to save '%s' in '%s' (access error)",dataname,luaname) + end end diff --git a/Master/texmf-dist/tex/context/base/data-tre.lua b/Master/texmf-dist/tex/context/base/data-tre.lua index d5ca258e47b..88bf4f11275 100644 --- a/Master/texmf-dist/tex/context/base/data-tre.lua +++ b/Master/texmf-dist/tex/context/base/data-tre.lua @@ -8,17 +8,20 @@ if not modules then modules = { } end modules ['data-tre'] = { -- \input tree://oeps1/**/oeps.tex -local find, gsub = string.find, string.gsub -local unpack = unpack or table.unpack +local find, gsub, format = string.find, string.gsub, string.format -local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) -local done, found = { }, { } +local report_trees = logs.reporter("resolvers","trees") -function finders.tree(specification,filetype) - local fnd = found[specification] - if not fnd then - local spec = resolvers.splitmethod(specification).path or "" +local resolvers = resolvers + +local done, found, notfound = { }, { }, resolvers.finders.notfound + +function resolvers.finders.tree(specification) + local spec = specification.filename + local fnd = found[spec] + if fnd == nil then if spec ~= "" then local path, name = file.dirname(spec), file.basename(spec) if path == "" then path = "." end @@ -32,16 +35,38 @@ function finders.tree(specification,filetype) for k=1,#hash do local v = hash[k] if find(v,pattern) then - found[specification] = v + found[spec] = v return v end end end - fnd = unpack(finders.notfound) - found[specification] = fnd + fnd = notfound() -- false + found[spec] = fnd end return fnd end -openers.tree = openers.generic -loaders.tree = loaders.generic +function resolvers.locators.tree(specification) + local name = specification.filename + if name ~= '' and lfs.isdir(name) then + if trace_locating then + report_trees("locator '%s' found",name) + end + resolvers.appendhash('tree',name,false) -- don't cache + elseif trace_locating then + report_trees("locator '%s' not found",name) + end +end + +function resolvers.hashers.tree(specification) + local name = specification.filename + if trace_locating then + report_trees("analysing '%s'",name) + end + resolvers.methodhandler("hashers",name) +end + +resolvers.concatinators.tree = resolvers.concatinators.file +resolvers.generators.tree = resolvers.generators.file +resolvers.openers.tree = resolvers.openers.file +resolvers.loaders.tree = resolvers.loaders.file diff --git a/Master/texmf-dist/tex/context/base/data-use.lua b/Master/texmf-dist/tex/context/base/data-use.lua index 5ecd7805f41..d2a9b757191 100644 --- a/Master/texmf-dist/tex/context/base/data-use.lua +++ b/Master/texmf-dist/tex/context/base/data-use.lua @@ -10,50 +10,18 @@ local format, lower, gsub, find = string.format, string.lower, string.gsub, stri local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) --- since we want to use the cache instead of the tree, we will now --- reimplement the saver. +local report_mounts = logs.reporter("resolvers","mounts") -local save_data = resolvers.save_data -local load_data = resolvers.load_data - -resolvers.cachepath = nil -- public, for tracing -resolvers.usecache = true -- public, for tracing - -function resolvers.save_data(dataname) - save_data(dataname, function(cachename,dataname) - resolvers.usecache = not toboolean(resolvers.expansion("CACHEINTDS") or "false",true) - if resolvers.usecache then - resolvers.cachepath = resolvers.cachepath or caches.definepath("trees") - return file.join(resolvers.cachepath(),caches.hashed(cachename)) - else - return file.join(cachename,dataname) - end - end) -end - -function resolvers.load_data(pathname,dataname,filename) - load_data(pathname,dataname,filename,function(dataname,filename) - resolvers.usecache = not toboolean(resolvers.expansion("CACHEINTDS") or "false",true) - if resolvers.usecache then - resolvers.cachepath = resolvers.cachepath or caches.definepath("trees") - return file.join(resolvers.cachepath(),caches.hashed(pathname)) - else - if not filename or (filename == "") then - filename = dataname - end - return file.join(pathname,filename) - end - end) -end +local resolvers = resolvers -- we will make a better format, maybe something xml or just text or lua resolvers.automounted = resolvers.automounted or { } function resolvers.automount(usecache) - local mountpaths = resolvers.clean_path_list(resolvers.expansion('TEXMFMOUNT')) + local mountpaths = resolvers.cleanpathlist(resolvers.expansion('TEXMFMOUNT')) if (not mountpaths or #mountpaths == 0) and usecache then - mountpaths = { caches.setpath("mount") } + mountpaths = caches.getreadablepaths("mount") end if mountpaths and #mountpaths > 0 then statistics.starttiming(resolvers.instance) @@ -67,7 +35,7 @@ function resolvers.automount(usecache) -- skip elseif find(line,"^zip://") then if trace_locating then - logs.report("fileio","mounting %s",line) + report_mounts("mounting %s",line) end table.insert(resolvers.automounted,line) resolvers.usezipfile(line) @@ -83,40 +51,40 @@ end -- status info -statistics.register("used config path", function() return caches.configpath() end) -statistics.register("used cache path", function() return caches.temp() or "?" end) +statistics.register("used config file", function() return caches.configfiles() end) +statistics.register("used cache path", function() return caches.usedpaths() end) -- experiment (code will move) -function statistics.save_fmt_status(texname,formatbanner,sourcefile) -- texname == formatname +function statistics.savefmtstatus(texname,formatbanner,sourcefile) -- texname == formatname local enginebanner = status.list().banner if formatbanner and enginebanner and sourcefile then local luvname = file.replacesuffix(texname,"luv") local luvdata = { enginebanner = enginebanner, formatbanner = formatbanner, - sourcehash = md5.hex(io.loaddata(resolvers.find_file(sourcefile)) or "unknown"), + sourcehash = md5.hex(io.loaddata(resolvers.findfile(sourcefile)) or "unknown"), sourcefile = sourcefile, } io.savedata(luvname,table.serialize(luvdata,true)) end end -function statistics.check_fmt_status(texname) +function statistics.checkfmtstatus(texname) local enginebanner = status.list().banner if enginebanner and texname then local luvname = file.replacesuffix(texname,"luv") if lfs.isfile(luvname) then local luv = dofile(luvname) if luv and luv.sourcefile then - local sourcehash = md5.hex(io.loaddata(resolvers.find_file(luv.sourcefile)) or "unknown") + local sourcehash = md5.hex(io.loaddata(resolvers.findfile(luv.sourcefile)) or "unknown") local luvbanner = luv.enginebanner or "?" if luvbanner ~= enginebanner then - return string.format("engine mismatch (luv:%s <> bin:%s)",luvbanner,enginebanner) + return format("engine mismatch (luv: %s <> bin: %s)",luvbanner,enginebanner) end local luvhash = luv.sourcehash or "?" if luvhash ~= sourcehash then - return string.format("source mismatch (luv:%s <> bin:%s)",luvhash,sourcehash) + return format("source mismatch (luv: %s <> bin: %s)",luvhash,sourcehash) end else return "invalid status file" diff --git a/Master/texmf-dist/tex/context/base/data-vir.lua b/Master/texmf-dist/tex/context/base/data-vir.lua new file mode 100644 index 00000000000..5a288953faa --- /dev/null +++ b/Master/texmf-dist/tex/context/base/data-vir.lua @@ -0,0 +1,81 @@ +if not modules then modules = { } end modules ['data-vir'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local format = string.format + +local trace_virtual = false +local report_virtual = logs.reporter("resolvers","virtual") + +trackers.register("resolvers.locating", function(v) trace_virtual = v end) +trackers.register("resolvers.virtual", function(v) trace_virtual = v end) + +local resolvers = resolvers + +local finders, openers, loaders, savers = resolvers.finders, resolvers.openers, resolvers.loaders, resolvers.savers + +local data, n, template = { }, 0, "virtual://%s.%s" -- hm, number can be query + +function savers.virtual(specification,content) + n = n + 1 -- one number for all namespaces + local path = specification.path + local filename = format(template,path ~= "" and path or "virtualfile",n) + if trace_virtual then + report_virtual("saver: file '%s' saved",filename) + end + data[filename] = content + return filename +end + +function finders.virtual(specification) + local original = specification.original + local d = data[original] + if d then + if trace_virtual then + report_virtual("finder: file '%s' found",original) + end + return original + else + if trace_virtual then + report_virtual("finder: unknown file '%s'",original) + end + return finders.notfound() + end +end + +function openers.virtual(specification) + local original = specification.original + local d = data[original] + if d then + if trace_virtual then + report_virtual("opener, file '%s' opened",original) + end + data[original] = nil + return openers.helpers.textopener("virtual",original,d) + else + if trace_virtual then + report_virtual("opener, file '%s' not found",original) + end + return openers.notfound() + end +end + +function loaders.virtual(specification) + local original = specification.original + local d = data[original] + if d then + if trace_virtual then + report_virtual("loader, file '%s' loaded",original) + end + data[original] = nil + return true, d, #d + end + if trace_virtual then + report_virtual("loader, file '%s' not loaded",original) + end + return loaders.notfound() +end diff --git a/Master/texmf-dist/tex/context/base/data-zip.lua b/Master/texmf-dist/tex/context/base/data-zip.lua index aa3740a83d1..6a50d2aa942 100644 --- a/Master/texmf-dist/tex/context/base/data-zip.lua +++ b/Master/texmf-dist/tex/context/base/data-zip.lua @@ -6,25 +6,30 @@ if not modules then modules = { } end modules ['data-zip'] = { license = "see context related readme files" } +-- partly redone .. needs testing + local format, find, match = string.format, string.find, string.match -local unpack = unpack or table.unpack local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local report_zip = logs.reporter("resolvers","zip") + -- zip:///oeps.zip?name=bla/bla.tex -- zip:///oeps.zip?tree=tex/texmf-local -- zip:///texmf.zip?tree=/tex/texmf -- zip:///texmf.zip?tree=/tex/texmf-local -- zip:///texmf-mine.zip?tree=/tex/texmf-projects -zip = zip or { } -zip.archives = zip.archives or { } -zip.registeredfiles = zip.registeredfiles or { } +local resolvers = resolvers + +zip = zip or { } +local zip = zip -local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders -local locators, hashers, concatinators = resolvers.locators, resolvers.hashers, resolvers.concatinators +zip.archives = zip.archives or { } +local archives = zip.archives -local archives = zip.archives +zip.registeredfiles = zip.registeredfiles or { } +local registeredfiles = zip.registeredfiles local function validzip(str) -- todo: use url splitter if not find(str,"^zip://") then @@ -40,7 +45,7 @@ function zip.openarchive(name) else local arch = archives[name] if not arch then - local full = resolvers.find_file(name) or "" + local full = resolvers.findfile(name) or "" arch = (full ~= "" and zip.open(full)) or false archives[name] = arch end @@ -55,163 +60,162 @@ function zip.closearchive(name) end end -function locators.zip(specification) -- where is this used? startup zips (untested) - specification = resolvers.splitmethod(specification) - local zipfile = specification.path - local zfile = zip.openarchive(name) -- tricky, could be in to be initialized tree +function resolvers.locators.zip(specification) + local archive = specification.filename + local zipfile = archive and archive ~= "" and zip.openarchive(archive) -- tricky, could be in to be initialized tree if trace_locating then - if zfile then - logs.report("fileio","zip locator, archive '%s' found",specification.original) + if zipfile then + report_zip("locator, archive '%s' found",archive) else - logs.report("fileio","zip locator, archive '%s' not found",specification.original) + report_zip("locator, archive '%s' not found",archive) end end end -function hashers.zip(tag,name) +function resolvers.hashers.zip(specification) + local archive = specification.filename if trace_locating then - logs.report("fileio","loading zip file '%s' as '%s'",name,tag) + report_zip("loading file '%s'",archive) end - resolvers.usezipfile(format("%s?tree=%s",tag,name)) + resolvers.usezipfile(specification.original) end -function concatinators.zip(tag,path,name) +function resolvers.concatinators.zip(zipfile,path,name) -- ok ? if not path or path == "" then - return format('%s?name=%s',tag,name) + return format('%s?name=%s',zipfile,name) else - return format('%s?name=%s/%s',tag,path,name) + return format('%s?name=%s/%s',zipfile,path,name) end end -function resolvers.isreadable.zip(name) - return true -end - -function finders.zip(specification,filetype) - specification = resolvers.splitmethod(specification) - if specification.path then - local q = url.query(specification.query) - if q.name then - local zfile = zip.openarchive(specification.path) +function resolvers.finders.zip(specification) + local original = specification.original + local archive = specification.filename + if archive then + local query = url.query(specification.query) + local queryname = query.name + if queryname then + local zfile = zip.openarchive(archive) if zfile then if trace_locating then - logs.report("fileio","zip finder, archive '%s' found",specification.path) + report_zip("finder, archive '%s' found",archive) end - local dfile = zfile:open(q.name) + local dfile = zfile:open(queryname) if dfile then dfile = zfile:close() if trace_locating then - logs.report("fileio","zip finder, file '%s' found",q.name) + report_zip("finder, file '%s' found",queryname) end return specification.original elseif trace_locating then - logs.report("fileio","zip finder, file '%s' not found",q.name) + report_zip("finder, file '%s' not found",queryname) end elseif trace_locating then - logs.report("fileio","zip finder, unknown archive '%s'",specification.path) + report_zip("finder, unknown archive '%s'",archive) end end end if trace_locating then - logs.report("fileio","zip finder, '%s' not found",filename) + report_zip("finder, '%s' not found",original) end - return unpack(finders.notfound) + return resolvers.finders.notfound() end -function openers.zip(specification) - local zipspecification = resolvers.splitmethod(specification) - if zipspecification.path then - local q = url.query(zipspecification.query) - if q.name then - local zfile = zip.openarchive(zipspecification.path) +function resolvers.openers.zip(specification) + local original = specification.original + local archive = specification.filename + if archive then + local query = url.query(specification.query) + local queryname = query.name + if queryname then + local zfile = zip.openarchive(archive) if zfile then if trace_locating then - logs.report("fileio","zip opener, archive '%s' opened",zipspecification.path) + report_zip("opener, archive '%s' opened",archive) end - local dfile = zfile:open(q.name) + local dfile = zfile:open(queryname) if dfile then - logs.show_open(specification) if trace_locating then - logs.report("fileio","zip opener, file '%s' found",q.name) + report_zip("opener, file '%s' found",queryname) end - return openers.text_opener(specification,dfile,'zip') + return resolvers.openers.helpers.textopener('zip',original,dfile) elseif trace_locating then - logs.report("fileio","zip opener, file '%s' not found",q.name) + report_zip("opener, file '%s' not found",queryname) end elseif trace_locating then - logs.report("fileio","zip opener, unknown archive '%s'",zipspecification.path) + report_zip("opener, unknown archive '%s'",archive) end end end if trace_locating then - logs.report("fileio","zip opener, '%s' not found",filename) + report_zip("opener, '%s' not found",original) end - return unpack(openers.notfound) + return resolvers.openers.notfound() end -function loaders.zip(specification) - specification = resolvers.splitmethod(specification) - if specification.path then - local q = url.query(specification.query) - if q.name then - local zfile = zip.openarchive(specification.path) +function resolvers.loaders.zip(specification) + local original = specification.original + local archive = specification.filename + if archive then + local query = url.query(specification.query) + local queryname = query.name + if queryname then + local zfile = zip.openarchive(archive) if zfile then if trace_locating then - logs.report("fileio","zip loader, archive '%s' opened",specification.path) + report_zip("loader, archive '%s' opened",archive) end - local dfile = zfile:open(q.name) + local dfile = zfile:open(queryname) if dfile then - logs.show_load(filename) + logs.show_load(original) if trace_locating then - logs.report("fileio","zip loader, file '%s' loaded",filename) + report_zip("loader, file '%s' loaded",original) end local s = dfile:read("*all") dfile:close() return true, s, #s elseif trace_locating then - logs.report("fileio","zip loader, file '%s' not found",q.name) + report_zip("loader, file '%s' not found",queryname) end elseif trace_locating then - logs.report("fileio","zip loader, unknown archive '%s'",specification.path) + report_zip("loader, unknown archive '%s'",archive) end end end if trace_locating then - logs.report("fileio","zip loader, '%s' not found",filename) + report_zip("loader, '%s' not found",original) end - return unpack(openers.notfound) + return resolvers.openers.notfound() end -- zip:///somefile.zip -- zip:///somefile.zip?tree=texmf-local -> mount -function resolvers.usezipfile(zipname) - zipname = validzip(zipname) - local specification = resolvers.splitmethod(zipname) - local zipfile = specification.path - if zipfile and not zip.registeredfiles[zipname] then - local tree = url.query(specification.query).tree or "" - local z = zip.openarchive(zipfile) +function resolvers.usezipfile(archive) + local specification = resolvers.splitmethod(archive) -- to be sure + local archive = specification.filename + if archive and not registeredfiles[archive] then + local z = zip.openarchive(archive) if z then - local instance = resolvers.instance + local tree = url.query(specification.query).tree or "" if trace_locating then - logs.report("fileio","zip registering, registering archive '%s'",zipname) + report_zip("registering, registering archive '%s'",archive) end - statistics.starttiming(instance) - resolvers.prepend_hash('zip',zipname,zipfile) - resolvers.extend_texmf_var(zipname) -- resets hashes too - zip.registeredfiles[zipname] = z - instance.files[zipname] = resolvers.register_zip_file(z,tree or "") - statistics.stoptiming(instance) + statistics.starttiming(resolvers.instance) + resolvers.prependhash('zip',archive) + resolvers.extendtexmfvariable(archive) -- resets hashes too + registeredfiles[archive] = z + instance.files[archive] = resolvers.registerzipfile(z,tree) + statistics.stoptiming(resolvers.instance) elseif trace_locating then - logs.report("fileio","zip registering, unknown archive '%s'",zipname) + report_zip("registering, unknown archive '%s'",archive) end elseif trace_locating then - logs.report("fileio","zip registering, '%s' not found",zipname) + report_zip("registering, '%s' not found",archive) end end -function resolvers.register_zip_file(z,tree) +function resolvers.registerzipfile(z,tree) local files, filter = { }, "" if tree == "" then filter = "^(.+)/(.-)$" @@ -219,9 +223,9 @@ function resolvers.register_zip_file(z,tree) filter = format("^%s/(.+)/(.-)$",tree) end if trace_locating then - logs.report("fileio","zip registering, using filter '%s'",filter) + report_zip("registering, using filter '%s'",filter) end - local register, n = resolvers.register_file, 0 + local register, n = resolvers.registerfile, 0 for i in z:files() do local path, name = match(i.filename,filter) if path then @@ -236,6 +240,6 @@ function resolvers.register_zip_file(z,tree) n = n + 1 end end - logs.report("fileio","zip registering, %s files registered",n) + report_zip("registering, %s files registered",n) return files end diff --git a/Master/texmf-dist/tex/context/base/enco-agr.mkii b/Master/texmf-dist/tex/context/base/enco-agr.mkii index cfd86dfd344..1dbb9b577af 100644 --- a/Master/texmf-dist/tex/context/base/enco-agr.mkii +++ b/Master/texmf-dist/tex/context/base/enco-agr.mkii @@ -16,6 +16,8 @@ \definecasemaps 87 to 90 lc +32 uc 0 \definecasemaps 91 to 255 lc 0 uc 0 + \definecaseself 4 % apostrofe + \stopmapping \startencoding[agr] diff --git a/Master/texmf-dist/tex/context/base/enco-ans.mkii b/Master/texmf-dist/tex/context/base/enco-ans.mkii index 7a48b5b5548..88baf0ad0bb 100644 --- a/Master/texmf-dist/tex/context/base/enco-ans.mkii +++ b/Master/texmf-dist/tex/context/base/enco-ans.mkii @@ -40,7 +40,7 @@ % \definecaseself 129 % quotesingle % \definecaseself 130 % quotesinglebase % \definecaseself 145 % quoteleft -% \definecaseself 146 % quoteright +\definecaseself 146 % quoteright \stopmapping diff --git a/Master/texmf-dist/tex/context/base/enco-ec.mkii b/Master/texmf-dist/tex/context/base/enco-ec.mkii index 1ac41cadf24..f0964897fba 100644 --- a/Master/texmf-dist/tex/context/base/enco-ec.mkii +++ b/Master/texmf-dist/tex/context/base/enco-ec.mkii @@ -56,7 +56,7 @@ % \definecaseself 39 % quotesingle % \definecaseself 13 % quotesinglebase % \definecaseself 96 % quoteleft -% \definecaseself 39 % quoteright +\definecaseself 39 % quoteright %D So far for the mapping. diff --git a/Master/texmf-dist/tex/context/base/enco-fde.mkii b/Master/texmf-dist/tex/context/base/enco-fde.mkii index a7c11abfcfa..da104b802b7 100644 --- a/Master/texmf-dist/tex/context/base/enco-fde.mkii +++ b/Master/texmf-dist/tex/context/base/enco-fde.mkii @@ -11,8 +11,6 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\doifmode{mkiv}{\endinput} - \unprotect \installactivecharacter " diff --git a/Master/texmf-dist/tex/context/base/enco-ffr.mkii b/Master/texmf-dist/tex/context/base/enco-ffr.mkii index 093cc6500b8..259b5994959 100644 --- a/Master/texmf-dist/tex/context/base/enco-ffr.mkii +++ b/Master/texmf-dist/tex/context/base/enco-ffr.mkii @@ -11,8 +11,6 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\doifmode{mkiv}{\endinput} - % \definehspace[fr][:][.25em] % \definehspace[fr][;][.25em] % \definehspace[fr][!][.25em] diff --git a/Master/texmf-dist/tex/context/base/enco-ini.mkii b/Master/texmf-dist/tex/context/base/enco-ini.mkii index 33825f94d43..a277e74504f 100644 --- a/Master/texmf-dist/tex/context/base/enco-ini.mkii +++ b/Master/texmf-dist/tex/context/base/enco-ini.mkii @@ -747,11 +747,11 @@ %D can be used to check the correct loading of hyphenation %D patterns. -\fetchruntimecommand \showaccents {\f!encodingprefix\s!run.mkii} -\fetchruntimecommand \showcharacters {\f!encodingprefix\s!run.mkii} -\fetchruntimecommand \showcharacterbounds {\f!encodingprefix\s!run.mkii} -\fetchruntimecommand \showhyphenations {\f!encodingprefix\s!run.mkii} -\fetchruntimecommand \showmapping {\f!encodingprefix\s!run.mkii} +\fetchruntimecommand \showaccents {\f!encodingprefix\s!run} +\fetchruntimecommand \showcharacters {\f!encodingprefix\s!run} +\fetchruntimecommand \showcharacterbounds {\f!encodingprefix\s!run} +\fetchruntimecommand \showhyphenations {\f!encodingprefix\s!run} +\fetchruntimecommand \showmapping {\f!encodingprefix\s!run} %D \macros %D {everyuppercase, EveryUppercase, diff --git a/Master/texmf-dist/tex/context/base/enco-ini.mkiv b/Master/texmf-dist/tex/context/base/enco-ini.mkiv index da1892faf2a..491084b8c16 100644 --- a/Master/texmf-dist/tex/context/base/enco-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/enco-ini.mkiv @@ -36,71 +36,56 @@ \unprotect -%D Quite some commands are now obsolete. We keep only a few commands -%D around, just in case they are used in styles (and in for instance -%D symb and xtag files). - -\unexpanded\def\startencoding [#1]{} % used in symb -\let\stopencoding \relax -\unexpanded\def\setupencoding [#1]{} -\def\enablemapping [#1]{} -\def\enableencoding[#1]{} - -\def\currentencoding{utf} -\def\currentmapping {utf} -\let\defaultencoding\s!default - -% todo: +%D Obsolete (but sometimes used in styles) -% \def\showaccents {\f!encodingprefix\s!run} -% \def\showcharacters {\f!encodingprefix\s!run} -% \def\showcharacterbounds {\f!encodingprefix\s!run} -% \def\showhyphenations {\f!encodingprefix\s!run} -% \def\showmapping {\f!encodingprefix\s!run} +\let\defaultencoding\s!default %D \macros %D {defineaccent, definecharacter, definecommand} +\unexpanded\def\dodefineaccentcommand#1% + {\setevalue{\string#1}{\noexpand\dohandleaccent{\string#1}}} + +\unexpanded\def\dodefineaccent#1#2#3% no spaces, used low level + {\setvalue{\??ac\string#1\string#2\empty}{#3}} + \unexpanded\def\defineaccent#1 #2 #3 % - {\setevalue{\string#1}{\noexpand\dohandleaccent{\string#1}}% - \setvalue{\??ac\string#1\string#2}{#3}} + {\dodefineaccentcommand{#1}% + \dodefineaccent{#1}{#2}{#3}} \def\dohandleaccent#1#2% - {\csname\??ac\string#1\string#2\empty\endcsname} + {\ifcsname\??ac\string#1#2\empty\endcsname + \csname\??ac\string#1#2\empty\endcsname + \else\ifcsname\??ac\string#1\string#2\empty\endcsname + \csname\??ac\string#1\string#2\empty\endcsname + \fi\fi} \unexpanded\def\definecharacter#1 #2 % {\doifnumberelse{\string#2} {\setevalue{\string#1}{\utfchar{#2}}} % or {\expandafter\chardef\csname#1\endcsname#2\relax} - {\setuvalue {\string#1}{#2}}} + {\setuvalue{\string#1}{#2}}} \unexpanded\def\definecommand#1 #2 % {\setuvalue{\string#1}{#2}} %D \macros -%D {everyuppercase, EveryUppercase, -%D everyuppercase, EveryUppercase, -%D everysanitize, EverySanitize} - -\newevery \everyuppercase \EveryUppercase -\newevery \everylowercase \EveryLowercase -\newevery \everysanitize \EverySanitize +%D {everyuppercase, everylowercase, everysanitize} -%D Some saved meanings (not really needed): - -\let\textaccent \accent -\let\normaltextaccent\accent +\newtoks \everyuppercase +\newtoks \everylowercase +\newtoks \everysanitize %D Accent handling (try to avoid this): -\newbox\accenttestbox +\newbox\accenttestbox % no longer global so we could use \scratchbox \def\buildmathaccent#1% {\mathaccent#1 } -\unexpanded\def\buildtextaccent#1#2% - {\begingroup - \global\setbox\accenttestbox\hbox{#1}% - \scratchcounter\ctxlua{characters.charcode(\number\accenttestbox)}% +\unexpanded\def\buildtextaccent#1#2% we could do all at the lua end + {\begingroup % but that's no fun (yet) + \setbox\accenttestbox\hbox{#1}% + \scratchcounter\cldcontext{nodes.firstcharinbox(\number\accenttestbox)}\relax \ifcase\scratchcounter\else\accent\scratchcounter\fi \relax#2% \endgroup} @@ -165,83 +150,48 @@ % from enco-com: -\def\AA{\Aring} -\def\aa{\aring} -\def\AE{\AEligature} -\def\ae{\aeligature} -\def\CC{\Ccedilla} -\def\cc{\ccedilla} -\def \L{\Lstroke} -\def \l{\lstroke} -\def \O{\Ostroke} -\def \o{\ostroke} -\def\OE{\OEligature} -\def\oe{\oeligature} -\def\SZ{\Ssharp} -\def\sz{\ssharp} -\def\SS{\ssharp} -\def\IJ{\IJligature} -\def\ij{\ijligature} -\def \i{\dotlessi} -\def \j{\dotlessj} +\def\AA{Å} \def\aa{å} +\def\AE{Æ} \def\ae{æ} +\def\CC{Ç} \def\cc{ç} +\def \L{Ł} \def \l{ł} +\def \O{Ø} \def \o{ø} +\def\OE{Œ} \def\oe{œ} +\def\SZ{SS} \def\sz{ß} \def\SS{ß} +\def\IJ{IJ} \def\ij{ij} % from enco-def: -\def\dotlessI {I} -\def\dotlessJ {J} - -\def\Ssharp {SS} - -\def\eszett {\ssharp} -\def\Eszett {\Ssharp} - -\def\lslash {\lstroke} -\def\Lslash {\Lstroke} -\def\dslash {\dstroke} -\def\Dslash {\Dstroke} -\def\oslash {\ostroke} -\def\Oslash {\Ostroke} -\def\dcroat {\dstroke} -\def\Dcroat {\Dstroke} - -\def\Kcedilla {\Kcommaaccent} -\def\kcedilla {\kcommaaccent} -\def\Lcedilla {\Lcommaaccent} -\def\lcedilla {\lcommaaccent} -\def\Ncedilla {\Ncommaaccent} -\def\ncedilla {\ncommaaccent} -\def\Rcedilla {\Rcommaaccent} -\def\rcedilla {\rcommaaccent} - -\def\S {\sectionmark} -\def\P {\paragraphmark} - -\def\aumlaut {\adiaeresis} -\def\eumlaut {\ediaeresis} -\def\iumlaut {\idiaeresis} -\def\oumlaut {\odiaeresis} -\def\uumlaut {\udiaeresis} -\def\Aumlaut {\Adiaeresis} -\def\Eumlaut {\Ediaeresis} -\def\Iumlaut {\Idiaeresis} -\def\Oumlaut {\Odiaeresis} -\def\Uumlaut {\Udiaeresis} - -% for latex users - -\def\textS {\sectionmark} -\def\textP {\paragraphmark} - -% for old times sake - -\def\textflorin{\fhook} -\def\florin {\textflorin} -\def\dollar {\textdollar} -\def\pound {\textsterling} -\def\sterling {\textsterling} -\def\promille {\perthousand} -\def\permille {\perthousand} +\def\i{ı} +\def\j{ȷ} + +\def\S{§} \def\textS {§} % obsolete (surfaced in bibliographic files) +\def\P{¶} \def\textP {¶} % obsolete (surfaced in bibliographic files) + +\def\eszett {ß} \def\Eszett {SS} \def\Ssharp{SS} +\def\lslash {ł} \def\Lslash {Ł} +\def\dslash {đ} \def\Dslash {Đ} +\def\oslash {ø} \def\Oslash {Ø} +\def\dcroat {đ} \def\Dcroat {Đ} +\def\kcedilla{ķ} \def\Kcedilla{Ķ} +\def\lcedilla{ļ} \def\Lcedilla{Ļ} +\def\ncedilla{ņ} \def\Ncedilla{Ņ} +\def\rcedilla{ŗ} \def\Rcedilla{Ŗ} +\def\aumlaut {ä} \def\Aumlaut {Ä} +\def\eumlaut {ë} \def\Eumlaut {Ë} +\def\iumlaut {ï} \def\Iumlaut {Ï} +\def\oumlaut {ö} \def\Oumlaut {Ö} +\def\uumlaut {ü} \def\Uumlaut {Ü} + +% for old times sake (obsolete) + +\def\textflorin{ƒ} \def\florin {ƒ} +\def\pound {£} \def\sterling{£} +\def\promille {‰} \def\permille{‰} + +% tex specific (obsolete) + \def\procent {\percent} +\def\dollar {\textdollar} \def\permine {\fakepermine} % some more @@ -272,52 +222,6 @@ \def\leftsubguillemot {\guilsingleleft} \def\rightsubguillemot {\guilsingleright} -% obsolete: - -% \greekleftquot {[obsolete]} -% \greekrightquot {[obsolete]} -% \greekapostrophos {[obsolete]} -% \greekupsilondialytika{[obsolete]} -% \Ycaron {[obsolete]} -% \ycaron {[obsolete]} - -% to be done in char-def: - -% \definecharacter cyrillicGUP {GUP} -% \definecharacter cyrillicGHCRS {GHCRS} -% \definecharacter cyrillicZHDSC {ZHDSC} -% \definecharacter cyrillicKDSC {KDSC} -% \definecharacter cyrillicKBEAK {KBEAK} -% \definecharacter cyrillicKVCRS {KVCRS} -% \definecharacter cyrillicNG {NG} -% \definecharacter cyrillicOTLD {OTLD} -% \definecharacter cyrillicY {Y} -% \definecharacter cyrillicYHCRS {YHCRS} -% \definecharacter cyrillicHDSC {HDSC} -% \definecharacter cyrillicCHVCRS {CHVCRS} -% \definecharacter cyrillicCHRDSC {CHRDSC} -% \definecharacter cyrillicQ {Q} -% \definecharacter cyrillicW {W} -% -% \definecharacter cyrillicgup {gup} -% \definecharacter cyrillicghcrs {ghcrs} -% \definecharacter cyrilliczhdsc {zhdsc} -% \definecharacter cyrillickdsc {kdsc} -% \definecharacter cyrillickbeak {kbeak} -% \definecharacter cyrillickvcrs {kvcrs} -% \definecharacter cyrillicng {ng} -% \definecharacter cyrillicotld {otld} -% \definecharacter cyrillicy {y} -% \definecharacter cyrillicyhcrs {yhcrs} -% \definecharacter cyrillichdsc {hdsc} -% \definecharacter cyrillicchvcrs {chvcrs} -% \definecharacter cyrillicchrdsc {chrdsc} -% \definecharacter cyrillicq {q} -% \definecharacter cyrillicw {w} - -% \definecharacter softhyphen 45 -% \definecharacter compoundwordmark 23 - % left-overs (some day in private unicode space, so that we can roundtrip) \unexpanded\def\textblacksquare {\dontleavehmode\hbox{\vrule\!!width.3\s!em\!!height.4\s!em\!!depth-.1\s!em}} @@ -364,127 +268,32 @@ {\copy\controlspacebox} % a few defaults (\{}), we really need the verbose \empty as it will be -% stringified - -\defineaccent ^ {\empty} {\textcircumflex} -\defineaccent ` {\empty} {\textgrave} -\defineaccent ~ {\empty} {\texttilde} -\defineaccent " {\empty} {\textdiaeresis} -\defineaccent ' {\empty} {\textacute} -\defineaccent . {\empty} {\textdotaccent} -\defineaccent = {\empty} {\textmacron} -\defineaccent c {\empty} {\textcedilla} -\defineaccent H {\empty} {\texthungarumlaut} -\defineaccent k {\empty} {\textogonek} -\defineaccent r {\empty} {\textring} -\defineaccent u {\empty} {\textbreve} -\defineaccent v {\empty} {\textcaron} - -% from enco-acc: +% stringified .. anyhow, we define this at the lua end now but keep it here as a +% reference % -% we should to this at the lua end and share code .. - -\defineaccent ^ A {\Acircumflex} \defineaccent ^ a {\acircumflex} -\defineaccent ^ C {\Ccircumflex} \defineaccent ^ c {\ccircumflex} -\defineaccent ^ E {\Ecircumflex} \defineaccent ^ e {\ecircumflex} -\defineaccent ^ G {\Gcircumflex} \defineaccent ^ g {\gcircumflex} -\defineaccent ^ H {\Hcircumflex} \defineaccent ^ h {\hcircumflex} -\defineaccent ^ I {\Icircumflex} \defineaccent ^ i {\icircumflex} \defineaccent ^ {\i} {\icircumflex} -\defineaccent ^ J {\Jcircumflex} \defineaccent ^ j {\jcircumflex} \defineaccent ^ {\j} {\jcircumflex} -\defineaccent ^ O {\Ocircumflex} \defineaccent ^ o {\ocircumflex} -\defineaccent ^ S {\Scircumflex} \defineaccent ^ s {\scircumflex} -\defineaccent ^ U {\Ucircumflex} \defineaccent ^ u {\ucircumflex} -\defineaccent ^ W {\Wcircumflex} \defineaccent ^ w {\wcircumflex} -\defineaccent ^ Y {\Ycircumflex} \defineaccent ^ y {\ycircumflex} - -\defineaccent ` A {\Agrave} \defineaccent ` a {\agrave} -\defineaccent ` E {\Egrave} \defineaccent ` e {\egrave} -\defineaccent ` I {\Igrave} \defineaccent ` i {\igrave} \defineaccent ` {\i} {\igrave} -\defineaccent ` O {\Ograve} \defineaccent ` o {\ograve} -\defineaccent ` U {\Ugrave} \defineaccent ` u {\ugrave} -\defineaccent ` Y {\Ygrave} \defineaccent ` y {\ygrave} - -\defineaccent ~ A {\Atilde} \defineaccent ~ a {\atilde} -\defineaccent ~ I {\Itilde} \defineaccent ~ i {\itilde} \defineaccent ~ {\i} {\itilde} -\defineaccent ~ O {\Otilde} \defineaccent ~ o {\otilde} -\defineaccent ~ U {\Utilde} \defineaccent ~ u {\utilde} -\defineaccent ~ N {\Ntilde} \defineaccent ~ n {\ntilde} - -\defineaccent " A {\Adiaeresis} \defineaccent " a {\adiaeresis} -\defineaccent " E {\Ediaeresis} \defineaccent " e {\ediaeresis} -\defineaccent " I {\Idiaeresis} \defineaccent " i {\idiaeresis} \defineaccent " {\i} {\idiaeresis} -\defineaccent " O {\Odiaeresis} \defineaccent " o {\odiaeresis} -\defineaccent " U {\Udiaeresis} \defineaccent " u {\udiaeresis} -\defineaccent " Y {\Ydiaeresis} \defineaccent " y {\ydiaeresis} - -\defineaccent ' A {\Aacute} \defineaccent ' a {\aacute} -\defineaccent ' C {\Cacute} \defineaccent ' c {\cacute} -\defineaccent ' E {\Eacute} \defineaccent ' e {\eacute} -\defineaccent ' I {\Iacute} \defineaccent ' i {\iacute} \defineaccent ' {\i} {\iacute} -\defineaccent ' L {\Lacute} \defineaccent ' l {\lacute} -\defineaccent ' N {\Nacute} \defineaccent ' n {\nacute} -\defineaccent ' O {\Oacute} \defineaccent ' o {\oacute} -\defineaccent ' R {\Racute} \defineaccent ' r {\racute} -\defineaccent ' S {\Sacute} \defineaccent ' s {\sacute} -\defineaccent ' U {\Uacute} \defineaccent ' u {\uacute} -\defineaccent ' Y {\Yacute} \defineaccent ' y {\yacute} -\defineaccent ' Z {\Zacute} \defineaccent ' z {\zacute} - -\defineaccent . C {\Cdotaccent} \defineaccent . c {\cdotaccent} -\defineaccent . E {\Edotaccent} \defineaccent . e {\edotaccent} -\defineaccent . G {\Gdotaccent} \defineaccent . g {\gdotaccent} -\defineaccent . I {\Idotaccent} \defineaccent . i {\idotaccent} \defineaccent . {\i} {\idotaccent} -\defineaccent . Z {\Zdotaccent} \defineaccent . z {\zdotaccent} - -\defineaccent = A {\Amacron} \defineaccent = a {\amacron} -\defineaccent = E {\Emacron} \defineaccent = e {\emacron} -\defineaccent = I {\Imacron} \defineaccent = i {\imacron} \defineaccent = {\i} {\imacron} -\defineaccent = O {\Omacron} \defineaccent = o {\omacron} -\defineaccent = U {\Umacron} \defineaccent = u {\umacron} - -\defineaccent c C {\Ccedilla} \defineaccent c c {\ccedilla} -\defineaccent c K {\Kcedilla} \defineaccent c k {\kcedilla} -\defineaccent c L {\Lcedilla} \defineaccent c l {\lcedilla} -\defineaccent c N {\Ncedilla} \defineaccent c n {\ncedilla} -\defineaccent c R {\Rcedilla} \defineaccent c r {\rcedilla} -\defineaccent c S {\Scedilla} \defineaccent c s {\scedilla} -\defineaccent c T {\Tcedilla} \defineaccent c t {\tcedilla} - -\defineaccent H O {\Ohungarumlaut} \defineaccent H o {\ohungarumlaut} -\defineaccent H u {\uhungarumlaut} \defineaccent H U {\Uhungarumlaut} - -\defineaccent k A {\Aogonek} \defineaccent k a {\aogonek} -\defineaccent k E {\Eogonek} \defineaccent k e {\eogonek} -\defineaccent k I {\Iogonek} \defineaccent k i {\iogonek} -\defineaccent k U {\Uogonek} \defineaccent k u {\uogonek} - -\defineaccent r A {\Aring} \defineaccent r a {\aring} -\defineaccent r U {\Uring} \defineaccent r u {\uring} - -\defineaccent u A {\Abreve} \defineaccent u a {\abreve} -\defineaccent u E {\Ebreve} \defineaccent u e {\ebreve} -\defineaccent u G {\Gbreve} \defineaccent u g {\gbreve} -\defineaccent u I {\Ibreve} \defineaccent u i {\ibreve} \defineaccent u {\i} {\ibreve} -\defineaccent u O {\Obreve} \defineaccent u o {\obreve} -\defineaccent u U {\Ubreve} \defineaccent u u {\ubreve} - -\defineaccent v C {\Ccaron} \defineaccent v c {\ccaron} -\defineaccent v D {\Dcaron} \defineaccent v d {\dcaron} -\defineaccent v E {\Ecaron} \defineaccent v e {\ecaron} -\defineaccent v L {\Lcaron} \defineaccent v l {\lcaron} -\defineaccent v N {\Ncaron} \defineaccent v n {\ncaron} -\defineaccent v R {\Rcaron} \defineaccent v r {\rcaron} -\defineaccent v S {\Scaron} \defineaccent v s {\scaron} -\defineaccent v T {\Tcaron} \defineaccent v t {\tcaron} -\defineaccent v Z {\Zcaron} \defineaccent v z {\zcaron} +% \defineaccent ^ {\empty} {\textcircumflex} +% \defineaccent ` {\empty} {\textgrave} +% \defineaccent ~ {\empty} {\texttilde} +% \defineaccent " {\empty} {\textdiaeresis} +% \defineaccent ' {\empty} {\textacute} +% \defineaccent . {\empty} {\textdotaccent} +% \defineaccent = {\empty} {\textmacron} +% \defineaccent c {\empty} {\textcedilla} +% \defineaccent H {\empty} {\texthungarumlaut} +% \defineaccent k {\empty} {\textogonek} +% \defineaccent r {\empty} {\textring} +% \defineaccent u {\empty} {\textbreve} +% \defineaccent v {\empty} {\textcaron} + +\ctxlua{characters.tex.defineaccents()} % from enco-mis: \def\fakepercent - {\mathematics{^{\scriptscriptstyle0}\kern-.25em/\kern-.2em_{\scriptscriptstyle0}}} + {\mathematics{\normalsuperscript{\scriptscriptstyle0}\kern-.25em/\kern-.2em\normalsubscript{\scriptscriptstyle0}}} \def\fakeperthousand - {\mathematics{^{\scriptscriptstyle0}\kern-.25em/\kern-.2em_{\scriptscriptstyle00}}} + {\mathematics{\normalsuperscript{\scriptscriptstyle0}\kern-.25em/\kern-.2em\normalsubscript{\scriptscriptstyle00}}} \def\fakepermine {\dontleavehmode @@ -493,27 +302,12 @@ {\mathematics{+}}% \hbox to \wd\scratchbox {\hss - \mathematics{^{\scriptscriptstyle-}\kern-.4em/\kern-.3em_{\scriptscriptstyle-}}% + \mathematics{\normalsuperscript{\scriptscriptstyle-}\kern-.4em/\kern-.3em\normalsubscript{\scriptscriptstyle-}}% \hss}% \egroup} %D A smaller and bolder variant, more like the math and monospaced ones. -% \def\fakeunderscore -% {\dontleavehmode\hbox % was \leavevmode -% {\setbox\scratchbox\hbox{(}% -% \scratchdimen.2\dp\scratchbox -% \setbox\scratchbox\hbox{\space}% -% \vrule -% \!!depth \scratchdimen -% \!!width \wd\scratchbox -% \!!height\zeropoint}} - -% \startTEXpage -% \ruledhbox{\strut$1\fakeunderscore^{1\fakeunderscore}$} -% \ruledhbox{\strut$1\xfakeunderscore^{1\xfakeunderscore}$} -% \stopTEXpage - \def\fakeunderscore {\relax\ifmmode \vrule\!!depth .12\fontexheight\mathstylefont\normalmathstyle\!!width \fontinterwordspace\mathstylefont\normalmathstyle\!!height\zeropoint\relax @@ -533,4 +327,16 @@ \let\_\normalunderscore +%D To be sorted out: + +\unexpanded\def\textminus + {\char \iffontchar\font"2012 "2012 % figuredash + \else\iffontchar\font"2013 "2013 % endash + \else\iffontchar\font"2212 "2212 % math minus + "002D % hyphen + \fi\fi\fi} + +\unexpanded\def\textplus + {\char"002B } % plus + \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/enco-l7x.mkii b/Master/texmf-dist/tex/context/base/enco-l7x.mkii index 8f355317b56..776c683c165 100644 --- a/Master/texmf-dist/tex/context/base/enco-l7x.mkii +++ b/Master/texmf-dist/tex/context/base/enco-l7x.mkii @@ -17,17 +17,17 @@ \startmapping[l7x] -\definecaseswap 25 `I % dotless i (TODO - probably wrong; maybe use \defineuppercasecom) -\definecaseswap 156 140 % oeligature -\definecaseswap 184 168 % ostroke -\definecaseswap 186 170 % rcommaaccent -\definecaseswap 191 175 % aeligature -\definecaseself 223 % ssharp (this is wrong, but no better way) +\definecaseswap 25 `I % dotless i (TODO - probably wrong; maybe use \defineuppercasecom) +\definecaseswap 156 140 % oeligature +\definecaseswap 184 168 % ostroke +\definecaseswap 186 170 % rcommaaccent +\definecaseswap 191 175 % aeligature +\definecaseself 223 % ssharp (this is wrong, but no better way) \definecasemaps 192 to 222 lc +32 uc 0 \definecasemaps 224 to 254 lc 0 uc -32 -\resetcaserange 215 to 215 % textmultiply -\resetcaserange 247 to 247 % textdiv +\resetcaserange 215 to 215 % textmultiply +\resetcaserange 247 to 247 % textdiv \stopmapping diff --git a/Master/texmf-dist/tex/context/base/enco-qx.mkii b/Master/texmf-dist/tex/context/base/enco-qx.mkii index 407d60bd736..798a182496a 100644 --- a/Master/texmf-dist/tex/context/base/enco-qx.mkii +++ b/Master/texmf-dist/tex/context/base/enco-qx.mkii @@ -75,6 +75,8 @@ \definecasemaps 217 to 222 lc +32 uc 0 \definecasemaps 249 to 254 lc 0 uc -32 +\definecaseself 39 % quoteright + \stopmapping \startencoding[qx] diff --git a/Master/texmf-dist/tex/context/base/enco-t5.mkii b/Master/texmf-dist/tex/context/base/enco-t5.mkii index 251c6876591..a8d80be1477 100644 --- a/Master/texmf-dist/tex/context/base/enco-t5.mkii +++ b/Master/texmf-dist/tex/context/base/enco-t5.mkii @@ -205,6 +205,8 @@ % % \stopencoding % +% \unprotect +% % \def\xfiveencodedaa% % {\accent23a} % @@ -214,7 +216,9 @@ % \dimen@\ht\zerocount % \advance\dimen@ -1ex % \rlap{\raise.67\dimen@\hbox{\char23}}A} - +% +% \protect +% % \quotesinglbase 13 % \guilsinglleft 14 % \guilsinglright 15 diff --git a/Master/texmf-dist/tex/context/base/enco-x5.mkii b/Master/texmf-dist/tex/context/base/enco-x5.mkii index f82ec6c5c41..d3b701c1a0e 100644 --- a/Master/texmf-dist/tex/context/base/enco-x5.mkii +++ b/Master/texmf-dist/tex/context/base/enco-x5.mkii @@ -179,6 +179,8 @@ % % \stopencoding % +% \unprotect +% % \def\xfiveencodedaa% % {\accent23a} % @@ -188,7 +190,9 @@ % \dimen@\ht\zerocount % \advance\dimen@ -1ex % \rlap{\raise.67\dimen@\hbox{\char23}}A} - +% +% \protect +% % \quotesinglbase 13 % \guilsinglleft 14 % \guilsinglright 15 diff --git a/Master/texmf-dist/tex/context/base/font-afm.lua b/Master/texmf-dist/tex/context/base/font-afm.lua index 87dec59c6e6..b719a9b3156 100644 --- a/Master/texmf-dist/tex/context/base/font-afm.lua +++ b/Master/texmf-dist/tex/context/base/font-afm.lua @@ -17,29 +17,56 @@ where we handles font encodings. Eventually font encoding goes away.

--ldx]]-- -local trace_features = false trackers.register("afm.features", function(v) trace_features = v end) -local trace_indexing = false trackers.register("afm.indexing", function(v) trace_indexing = v end) -local trace_loading = false trackers.register("afm.loading", function(v) trace_loading = v end) +local trace_features = false trackers.register("afm.features", function(v) trace_features = v end) +local trace_indexing = false trackers.register("afm.indexing", function(v) trace_indexing = v end) +local trace_loading = false trackers.register("afm.loading", function(v) trace_loading = v end) +local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) -local format, match, gmatch, lower, gsub = string.format, string.match, string.gmatch, string.lower, string.gsub -local lpegmatch = lpeg.match +local report_afm = logs.reporter("fonts","afm loading") + +local next, type, tonumber = next, type, tonumber +local format, match, gmatch, lower, gsub, strip = string.format, string.match, string.gmatch, string.lower, string.gsub, string.strip local abs = math.abs +local P, S, C, R, lpegmatch, patterns = lpeg.P, lpeg.S, lpeg.C, lpeg.R, lpeg.match, lpeg.patterns + +local fonts = fonts +local afm = { } +local pfb = { } +fonts.handlers.afm = afm +fonts.handlers.pfb = pfb + +afm.version = 1.410 -- incrementing this number one up will force a re-cache +afm.cache = containers.define("fonts", "afm", afm.version, true) +afm.autoprefixed = true -- this will become false some day (catches texnansi-blabla.*) -fonts = fonts or { } -fonts.afm = fonts.afm or { } +afm.syncspace = true -- when true, nicer stretch values +afm.addligatures = true -- best leave this set to true +afm.addtexligatures = true -- best leave this set to true +afm.addkerns = true -- best leave this set to true -local afm = fonts.afm -local tfm = fonts.tfm +local definers = fonts.definers +local readers = fonts.readers +local constructors = fonts.constructors -afm.version = 1.402 -- incrementing this number one up will force a re-cache -afm.syncspace = true -- when true, nicer stretch values -afm.enhance_data = true -- best leave this set to true -afm.features = { } -afm.features.aux = { } -afm.features.data = { } -afm.features.list = { } -afm.features.default = { } -afm.cache = containers.define("fonts", "afm", afm.version, true) +local findbinfile = resolvers.findbinfile + +local afmfeatures = constructors.newfeatures("afm") +local registerafmfeature = afmfeatures.register + +local function setmode(tfmdata,value) + if value then + tfmdata.properties.mode = lower(value) + end +end + +registerafmfeature { + name = "mode", + description = "mode", + initializers = { + base = setmode, + node = setmode, + } +} --[[ldx--

We start with the basic reader which we give a name similar to the @@ -62,43 +89,51 @@ built in and reader.

--~ Comment DELIM 2390 1010 --~ Comment AXISHEIGHT 250 -local c = lpeg.P("Comment") -local s = lpeg.S(" \t") -local l = lpeg.S("\n\r") -local w = lpeg.C((1 - l)^1) -local n = lpeg.C((lpeg.R("09") + lpeg.S("."))^1) / tonumber * s^0 - -local fd = { } - -local pattern = ( c * s^1 * ( - ("CODINGSCHEME" * s^1 * w ) / function(a) end + - ("DESIGNSIZE" * s^1 * n * w ) / function(a) fd[ 1] = a end + - ("CHECKSUM" * s^1 * n * w ) / function(a) fd[ 2] = a end + - ("SPACE" * s^1 * n * "plus" * n * "minus" * n) / function(a,b,c) fd[ 3], fd[ 4], fd[ 5] = a, b, c end + - ("QUAD" * s^1 * n ) / function(a) fd[ 6] = a end + - ("EXTRASPACE" * s^1 * n ) / function(a) fd[ 7] = a end + - ("NUM" * s^1 * n * n * n ) / function(a,b,c) fd[ 8], fd[ 9], fd[10] = a, b, c end + - ("DENOM" * s^1 * n * n ) / function(a,b ) fd[11], fd[12] = a, b end + - ("SUP" * s^1 * n * n * n ) / function(a,b,c) fd[13], fd[14], fd[15] = a, b, c end + - ("SUB" * s^1 * n * n ) / function(a,b) fd[16], fd[17] = a, b end + - ("SUPDROP" * s^1 * n ) / function(a) fd[18] = a end + - ("SUBDROP" * s^1 * n ) / function(a) fd[19] = a end + - ("DELIM" * s^1 * n * n ) / function(a,b) fd[20], fd[21] = a, b end + - ("AXISHEIGHT" * s^1 * n ) / function(a) fd[22] = a end + - (1-l)^0 -) + (1-c)^1)^0 +local comment = P("Comment") +local spacing = patterns.spacer -- S(" \t")^1 +local lineend = patterns.newline -- S("\n\r") +local words = C((1 - lineend)^1) +local number = C((R("09") + S("."))^1) / tonumber * spacing^0 +local data = lpeg.Carg(1) + +local pattern = ( -- needs testing ... not used anyway as we no longer need math afm's + comment * spacing * + ( + data * ( + ("CODINGSCHEME" * spacing * words ) / function(fd,a) end + + ("DESIGNSIZE" * spacing * number * words ) / function(fd,a) fd[ 1] = a end + + ("CHECKSUM" * spacing * number * words ) / function(fd,a) fd[ 2] = a end + + ("SPACE" * spacing * number * "plus" * number * "minus" * number) / function(fd,a,b,c) fd[ 3], fd[ 4], fd[ 5] = a, b, c end + + ("QUAD" * spacing * number ) / function(fd,a) fd[ 6] = a end + + ("EXTRASPACE" * spacing * number ) / function(fd,a) fd[ 7] = a end + + ("NUM" * spacing * number * number * number ) / function(fd,a,b,c) fd[ 8], fd[ 9], fd[10] = a, b, c end + + ("DENOM" * spacing * number * number ) / function(fd,a,b ) fd[11], fd[12] = a, b end + + ("SUP" * spacing * number * number * number ) / function(fd,a,b,c) fd[13], fd[14], fd[15] = a, b, c end + + ("SUB" * spacing * number * number ) / function(fd,a,b) fd[16], fd[17] = a, b end + + ("SUPDROP" * spacing * number ) / function(fd,a) fd[18] = a end + + ("SUBDROP" * spacing * number ) / function(fd,a) fd[19] = a end + + ("DELIM" * spacing * number * number ) / function(fd,a,b) fd[20], fd[21] = a, b end + + ("AXISHEIGHT" * spacing * number ) / function(fd,a) fd[22] = a end + ) + + (1-lineend)^0 + ) + + (1-comment)^1 +)^0 local function scan_comment(str) - fd = { } - lpegmatch(pattern,str) + local fd = { } + lpegmatch(pattern,str,1,fd) return fd end --- On a rainy day I will rewrite this in lpeg ... +-- On a rainy day I will rewrite this in lpeg ... or we can use the (slower) fontloader +-- as in now supports afm/pfb loading but it's not too bad to have different methods +-- for testing approaches. local keys = { } -function keys.FontName (data,line) data.metadata.fullname = line:strip() end +function keys.FontName (data,line) data.metadata.fontname = strip (line) -- get rid of spaces + data.metadata.fullname = strip (line) end function keys.ItalicAngle (data,line) data.metadata.italicangle = tonumber (line) end function keys.IsFixedPitch(data,line) data.metadata.isfixedpitch = toboolean(line,true) end function keys.CharWidth (data,line) data.metadata.charwidth = tonumber (line) end @@ -115,35 +150,35 @@ end local function get_charmetrics(data,charmetrics,vector) local characters = data.characters - local chr, str, ind = { }, "", 0 + local chr, ind = { }, 0 for k,v in gmatch(charmetrics,"([%a]+) +(.-) *;") do if k == 'C' then - if str ~= "" then characters[str] = chr end - chr = { } - str = "" v = tonumber(v) if v < 0 then - ind = ind + 1 + ind = ind + 1 -- ? else ind = v end - chr.index = ind + chr = { + index = ind + } elseif k == 'WX' then - chr.width = v + chr.width = tonumber(v) elseif k == 'N' then - str = v + characters[v] = chr elseif k == 'B' then local llx, lly, urx, ury = match(v,"^ *(.-) +(.-) +(.-) +(.-)$") chr.boundingbox = { tonumber(llx), tonumber(lly), tonumber(urx), tonumber(ury) } elseif k == 'L' then local plus, becomes = match(v,"^(.-) +(.-)$") - if not chr.ligatures then chr.ligatures = { } end - chr.ligatures[plus] = becomes + local ligatures = chr.ligatures + if ligatures then + ligatures[plus] = becomes + else + chr.ligatures = { [plus] = becomes } + end end end - if str ~= "" then - characters[str] = chr - end end local function get_kernpairs(data,kernpairs) @@ -151,105 +186,112 @@ local function get_kernpairs(data,kernpairs) for one, two, value in gmatch(kernpairs,"KPX +(.-) +(.-) +(.-)\n") do local chr = characters[one] if chr then - if not chr.kerns then chr.kerns = { } end - chr.kerns[two] = tonumber(value) + local kerns = chr.kerns + if kerns then + kerns[two] = tonumber(value) + else + chr.kerns = { [two] = tonumber(value) } + end end end end local function get_variables(data,fontmetrics) for key, rest in gmatch(fontmetrics,"(%a+) *(.-)[\n\r]") do - if keys[key] then keys[key](data,rest) end + local keyhandler = keys[key] + if keyhandler then + keyhandler(data,rest) + end end end -local function get_indexes(data,filename) - local pfbfile = file.replacesuffix(filename,"pfb") - local pfbname = resolvers.find_file(pfbfile,"pfb") or "" - if pfbname == "" then - pfbname = resolvers.find_file(file.basename(pfbfile),"pfb") or "" - end - if pfbname ~= "" then - data.luatex.filename = pfbname - local pfbblob = fontloader.open(pfbname) - if pfbblob then - local characters = data.characters - local pfbdata = fontloader.to_table(pfbblob) - --~ print(table.serialize(pfbdata)) - if pfbdata then - local glyphs = pfbdata.glyphs - if glyphs then - if trace_loading then - logs.report("load afm","getting index data from %s",pfbname) - end - -- local offset = (glyphs[0] and glyphs[0] != .notdef) or 0 - for index, glyph in next, glyphs do - local name = glyph.name - if name then - local char = characters[name] - if char then - if trace_indexing then - logs.report("load afm","glyph %s has index %s",name,index) - end - char.index = index +local function get_indexes(data,pfbname) + data.resources.filename = resolvers.unresolve(pfbname) -- no shortcut + local pfbblob = fontloader.open(pfbname) + if pfbblob then + local characters = data.characters + local pfbdata = fontloader.to_table(pfbblob) + if pfbdata then + local glyphs = pfbdata.glyphs + if glyphs then + if trace_loading then + report_afm("getting index data from %s",pfbname) + end + for index, glyph in next, glyphs do + local name = glyph.name + if name then + local char = characters[name] + if char then + if trace_indexing then + report_afm("glyph %s has index %s",name,index) end + char.index = index end end - elseif trace_loading then - logs.report("load afm","no glyph data in pfb file %s",pfbname) end elseif trace_loading then - logs.report("load afm","no data in pfb file %s",pfbname) + report_afm("no glyph data in pfb file %s",pfbname) end - fontloader.close(pfbblob) elseif trace_loading then - logs.report("load afm","invalid pfb file %s",pfbname) + report_afm("no data in pfb file %s",pfbname) end + fontloader.close(pfbblob) elseif trace_loading then - logs.report("load afm","no pfb file for %s",filename) + report_afm("invalid pfb file %s",pfbname) end end -function afm.read_afm(filename) +local function readafm(filename) local ok, afmblob, size = resolvers.loadbinfile(filename) -- has logging --- local ok, afmblob = true, file.readdata(filename) if ok and afmblob then local data = { - characters = { }, - metadata = { - version = version or '0', -- hm + resources = { + filename = resolvers.unresolve(filename), + version = afm.version, + creator = "context mkiv", + }, + properties = { + italic_correction = false, + }, + goodies = { + }, + metadata = { filename = file.removesuffix(file.basename(filename)) - } + }, + characters = { + -- a temporary store + }, + descriptions = { + -- the final store + }, } afmblob = gsub(afmblob,"StartCharMetrics(.-)EndCharMetrics", function(charmetrics) if trace_loading then - logs.report("load afm","loading char metrics") + report_afm("loading char metrics") end get_charmetrics(data,charmetrics,vector) return "" end) afmblob = gsub(afmblob,"StartKernPairs(.-)EndKernPairs", function(kernpairs) if trace_loading then - logs.report("load afm","loading kern pairs") + report_afm("loading kern pairs") end get_kernpairs(data,kernpairs) return "" end) afmblob = gsub(afmblob,"StartFontMetrics%s+([%d%.]+)(.-)EndFontMetrics", function(version,fontmetrics) if trace_loading then - logs.report("load afm","loading variables") + report_afm("loading variables") end data.afmversion = version get_variables(data,fontmetrics) data.fontdimens = scan_comment(fontmetrics) -- todo: all lpeg, no time now return "" end) - data.luatex = { } - get_indexes(data,filename) return data else if trace_loading then - logs.report("load afm","no valid afm file %s",filename) + report_afm("no valid afm file %s",filename) end return nil end @@ -261,35 +303,61 @@ by adding ligatures and kern information to the afm derived data. That way we can set them faster when defining a font.

--ldx]]-- +local addkerns, addligatures, addtexligatures, unify, normalize -- we will implement these later + function afm.load(filename) -- hm, for some reasons not resolved yet - filename = resolvers.find_file(filename,'afm') or "" + filename = resolvers.findfile(filename,'afm') or "" if filename ~= "" then local name = file.removesuffix(file.basename(filename)) - local data = containers.read(afm.cache(),name) - local size = lfs.attributes(filename,"size") or 0 - if not data or data.verbose ~= fonts.verbose or data.size ~= size then - logs.report("load afm", "reading %s",filename) - data = afm.read_afm(filename) + local data = containers.read(afm.cache,name) + local attr = lfs.attributes(filename) + local size, time = attr.size or 0, attr.modification or 0 + -- + local pfbfile = file.replacesuffix(name,"pfb") + local pfbname = resolvers.findfile(pfbfile,"pfb") or "" + if pfbname == "" then + pfbname = resolvers.findfile(file.basename(pfbfile),"pfb") or "" + end + local pfbsize, pfbtime = 0, 0 + if pfbname ~= "" then + local attr = lfs.attributes(pfbname) + pfbsize = attr.size or 0 + pfbtime = attr.modification or 0 + end + if not data or data.size ~= size or data.time ~= time or data.pfbsize ~= pfbsize or data.pfbtime ~= pfbtime then + report_afm( "reading %s",filename) + data = readafm(filename) if data then - -- data.luatex = data.luatex or { } - logs.report("load afm", "unifying %s",filename) - afm.unify(data,filename) - if afm.enhance_data then - logs.report("load afm", "add ligatures") - afm.add_ligatures(data,'ligatures') -- easier this way - logs.report("load afm", "add tex-ligatures") - afm.add_ligatures(data,'texligatures') -- easier this way - logs.report("load afm", "add extra kerns") - afm.add_kerns(data) -- faster this way + if pfbname ~= "" then + get_indexes(data,pfbname) + elseif trace_loading then + report_afm("no pfb file for %s",filename) + end + report_afm( "unifying %s",filename) + unify(data,filename) + if afm.addligatures then + report_afm( "add ligatures") + addligatures(data) + end + if afm.addtexligatures then + report_afm( "add tex ligatures") + addtexligatures(data) end - logs.report("load afm", "add tounicode data") - fonts.map.add_to_unicode(data,filename) + if afm.addkerns then + report_afm( "add extra kerns") + addkerns(data) + end + normalize(data) + report_afm( "add tounicode data") + fonts.mappings.addtounicode(data,filename) data.size = size - data.verbose = fonts.verbose - logs.report("load afm","saving: %s in cache",name) - data = containers.write(afm.cache(), name, data) - data = containers.read(afm.cache(),name) + data.time = time + data.pfbsize = pfbsize + data.pfbtime = pfbtime + report_afm("saving: %s in cache",name) + data = containers.write(afm.cache, name, data) + data = containers.read(afm.cache,name) end end return data @@ -298,49 +366,61 @@ function afm.load(filename) end end -function afm.unify(data, filename) - local unicodevector = fonts.enc.load('unicode').hash - local glyphs, indices, unicodes, names = { }, { }, { }, { } - local verbose, private = fonts.verbose, fonts.private +local uparser = fonts.mappings.makenameparser() + +unify = function(data, filename) + local unicodevector = fonts.encodings.agl.unicodes -- loaded runtime in context + local unicodes, names = { }, { } + local private = constructors.privateoffset + local descriptions = data.descriptions for name, blob in next, data.characters do local code = unicodevector[name] -- or characters.name_to_unicode[name] if not code then - local u = match(name,"^uni(%x+)$") - code = u and tonumber(u,16) + code = lpegmatch(uparser,name) if not code then code = private private = private + 1 - logs.report("afm glyph", "assigning private slot U+%04X for unknown glyph name %s", code, name) + report_afm("assigning private slot U+%05X for unknown glyph name %s", code, name) end end local index = blob.index unicodes[name] = code - indices[code] = index - glyphs[index] = blob names[name] = index blob.name = name - if verbose then - local bu = blob.unicode - if not bu then - blob.unicode = code - elseif type(bu) == "table" then - bu[#bu+1] = code - else - blob.unicode = { bu, code } + descriptions[code] = { + boundingbox = blob.boundingbox, + width = blob.width, + kerns = blob.kerns, + index = index, + name = name, + } + end + for unicode, description in next, descriptions do + local kerns = description.kerns + if kerns then + local krn = { } + for name, kern in next, kerns do + local unicode = unicodes[name] + if unicode then + krn[unicode] = kern + else + print(unicode,name) + end end - else - blob.index = nil + description.kerns = krn end end - data.glyphs = glyphs data.characters = nil - local luatex = data.luatex - luatex.filename = luatex.filename or file.removesuffix(file.basename(filename)) - luatex.unicodes = unicodes -- name to unicode - luatex.indices = indices -- unicode to index - luatex.marks = { } -- todo - luatex.names = names -- name to index - luatex.private = private + local resources = data.resources + local filename = resources.filename or file.removesuffix(file.basename(filename)) + resources.filename = resolvers.unresolve(filename) -- no shortcut + resources.unicodes = unicodes -- name to unicode + resources.marks = { } -- todo + resources.names = names -- name to index + resources.private = private +end + +normalize = function(data) end --[[ldx-- @@ -348,22 +428,79 @@ end and extra kerns. This saves quite some lookups later.

--ldx]]-- -function afm.add_ligatures(afmdata,ligatures) - local glyphs, luatex = afmdata.glyphs, afmdata.luatex - local indices, unicodes, names = luatex.indices, luatex.unicodes, luatex.names - for k,v in next, characters[ligatures] do -- main characters table - local one = glyphs[names[k]] +--[[ldx-- +

Only characters with a code smaller than 128 make sense, +anything larger is encoding dependent. An interesting complication +is that a character can be in an encoding twice but is hashed +once.

+--ldx]]-- + +local ligatures = { -- okay, nowadays we could parse the name but type 1 fonts + ['f'] = { -- don't have that many ligatures anyway + { 'f', 'ff' }, + { 'i', 'fi' }, + { 'l', 'fl' }, + }, + ['ff'] = { + { 'i', 'ffi' } + }, + ['fi'] = { + { 'i', 'fii' } + }, + ['fl'] = { + { 'i', 'fli' } + }, + ['s'] = { + { 't', 'st' } + }, + ['i'] = { + { 'j', 'ij' } + }, +} + +local texligatures = { + -- ['space'] = { + -- { 'L', 'Lslash' }, + -- { 'l', 'lslash' } + -- }, + -- ['question'] = { + -- { 'quoteleft', 'questiondown' } + -- }, + -- ['exclam'] = { + -- { 'quoteleft', 'exclamdown' } + -- }, + ['quoteleft'] = { + { 'quoteleft', 'quotedblleft' } + }, + ['quoteright'] = { + { 'quoteright', 'quotedblright' } + }, + ['hyphen'] = { + { 'hyphen', 'endash' } + }, + ['endash'] = { + { 'hyphen', 'emdash' } + } +} + +local addthem = function(rawdata,ligatures) + local descriptions = rawdata.descriptions + local resources = rawdata.resources + local unicodes = resources.unicodes + local names = resources.names + for ligname, ligdata in next, ligatures do + local one = descriptions[unicodes[ligname]] if one then - for _, b in next, v do - two, three = b[1], b[2] - if two and three and names[two] and names[three] then - local ol = one[ligatures] + for _, pair in next, ligdata do + local two, three = unicodes[pair[1]], unicodes[pair[2]] + if two and three then + local ol = one.ligatures if ol then - if not ol[two] then -- was one.ligatures ... bug + if not ol[two] then ol[two] = three end else - one[ligatures] = { [two] = three } + one.ligatures = { [two] = three } end end end @@ -371,50 +508,223 @@ function afm.add_ligatures(afmdata,ligatures) end end +addligatures = function(rawdata) addthem(rawdata,ligatures ) end +addtexligatures = function(rawdata) addthem(rawdata,texligatures) end + --[[ldx--

We keep the extra kerns in separate kerning tables so that we can use them selectively.

--ldx]]-- -function afm.add_kerns(afmdata) - local glyphs = afmdata.glyphs - local names = afmdata.luatex.names - local uncomposed = characters.uncomposed +-- This is rather old code (from the beginning when we had only tfm). If +-- we unify the afm data (now we have names all over the place) then +-- we can use shcodes but there will be many more looping then. But we +-- could get rid of the tables in char-cmp then. Als, in the generic version +-- we don't use the character database. (Ok, we can have a context specific +-- variant). + +-- we can make them numbers + +local left = { + AEligature = "A", aeligature = "a", + OEligature = "O", oeligature = "o", + IJligature = "I", ijligature = "i", + AE = "A", ae = "a", + OE = "O", oe = "o", + IJ = "I", ij = "i", + Ssharp = "S", ssharp = "s", +} + +local right = { + AEligature = "E", aeligature = "e", + OEligature = "E", oeligature = "e", + IJligature = "J", ijligature = "j", + AE = "E", ae = "e", + OE = "E", oe = "e", + IJ = "J", ij = "j", + Ssharp = "S", ssharp = "s", +} + +local both = { + Acircumflex = "A", acircumflex = "a", + Ccircumflex = "C", ccircumflex = "c", + Ecircumflex = "E", ecircumflex = "e", + Gcircumflex = "G", gcircumflex = "g", + Hcircumflex = "H", hcircumflex = "h", + Icircumflex = "I", icircumflex = "i", + Jcircumflex = "J", jcircumflex = "j", + Ocircumflex = "O", ocircumflex = "o", + Scircumflex = "S", scircumflex = "s", + Ucircumflex = "U", ucircumflex = "u", + Wcircumflex = "W", wcircumflex = "w", + Ycircumflex = "Y", ycircumflex = "y", + + Agrave = "A", agrave = "a", + Egrave = "E", egrave = "e", + Igrave = "I", igrave = "i", + Ograve = "O", ograve = "o", + Ugrave = "U", ugrave = "u", + Ygrave = "Y", ygrave = "y", + + Atilde = "A", atilde = "a", + Itilde = "I", itilde = "i", + Otilde = "O", otilde = "o", + Utilde = "U", utilde = "u", + Ntilde = "N", ntilde = "n", + + Adiaeresis = "A", adiaeresis = "a", Adieresis = "A", adieresis = "a", + Ediaeresis = "E", ediaeresis = "e", Edieresis = "E", edieresis = "e", + Idiaeresis = "I", idiaeresis = "i", Idieresis = "I", idieresis = "i", + Odiaeresis = "O", odiaeresis = "o", Odieresis = "O", odieresis = "o", + Udiaeresis = "U", udiaeresis = "u", Udieresis = "U", udieresis = "u", + Ydiaeresis = "Y", ydiaeresis = "y", Ydieresis = "Y", ydieresis = "y", + + Aacute = "A", aacute = "a", + Cacute = "C", cacute = "c", + Eacute = "E", eacute = "e", + Iacute = "I", iacute = "i", + Lacute = "L", lacute = "l", + Nacute = "N", nacute = "n", + Oacute = "O", oacute = "o", + Racute = "R", racute = "r", + Sacute = "S", sacute = "s", + Uacute = "U", uacute = "u", + Yacute = "Y", yacute = "y", + Zacute = "Z", zacute = "z", + + Dstroke = "D", dstroke = "d", + Hstroke = "H", hstroke = "h", + Tstroke = "T", tstroke = "t", + + Cdotaccent = "C", cdotaccent = "c", + Edotaccent = "E", edotaccent = "e", + Gdotaccent = "G", gdotaccent = "g", + Idotaccent = "I", idotaccent = "i", + Zdotaccent = "Z", zdotaccent = "z", + + Amacron = "A", amacron = "a", + Emacron = "E", emacron = "e", + Imacron = "I", imacron = "i", + Omacron = "O", omacron = "o", + Umacron = "U", umacron = "u", + + Ccedilla = "C", ccedilla = "c", + Kcedilla = "K", kcedilla = "k", + Lcedilla = "L", lcedilla = "l", + Ncedilla = "N", ncedilla = "n", + Rcedilla = "R", rcedilla = "r", + Scedilla = "S", scedilla = "s", + Tcedilla = "T", tcedilla = "t", + + Ohungarumlaut = "O", ohungarumlaut = "o", + Uhungarumlaut = "U", uhungarumlaut = "u", + + Aogonek = "A", aogonek = "a", + Eogonek = "E", eogonek = "e", + Iogonek = "I", iogonek = "i", + Uogonek = "U", uogonek = "u", + + Aring = "A", aring = "a", + Uring = "U", uring = "u", + + Abreve = "A", abreve = "a", + Ebreve = "E", ebreve = "e", + Gbreve = "G", gbreve = "g", + Ibreve = "I", ibreve = "i", + Obreve = "O", obreve = "o", + Ubreve = "U", ubreve = "u", + + Ccaron = "C", ccaron = "c", + Dcaron = "D", dcaron = "d", + Ecaron = "E", ecaron = "e", + Lcaron = "L", lcaron = "l", + Ncaron = "N", ncaron = "n", + Rcaron = "R", rcaron = "r", + Scaron = "S", scaron = "s", + Tcaron = "T", tcaron = "t", + Zcaron = "Z", zcaron = "z", + + dotlessI = "I", dotlessi = "i", + dotlessJ = "J", dotlessj = "j", + + AEligature = "AE", aeligature = "ae", AE = "AE", ae = "ae", + OEligature = "OE", oeligature = "oe", OE = "OE", oe = "oe", + IJligature = "IJ", ijligature = "ij", IJ = "IJ", ij = "ij", + + Lstroke = "L", lstroke = "l", Lslash = "L", lslash = "l", + Ostroke = "O", ostroke = "o", Oslash = "O", oslash = "o", + + Ssharp = "SS", ssharp = "ss", + + Aumlaut = "A", aumlaut = "a", + Eumlaut = "E", eumlaut = "e", + Iumlaut = "I", iumlaut = "i", + Oumlaut = "O", oumlaut = "o", + Uumlaut = "U", uumlaut = "u", + +} + +addkerns = function(rawdata) -- using shcodes is not robust here + local descriptions = rawdata.descriptions + local resources = rawdata.resources + local unicodes = resources.unicodes local function do_it_left(what) - for index, glyph in next, glyphs do - local kerns = glyph.kerns + for unicode, description in next, descriptions do + local kerns = description.kerns if kerns then - local extrakerns = glyph.extrakerns or { } - for complex, simple in next, uncomposed[what] do - if names[compex] then + local extrakerns + for complex, simple in next, what do + complex = unicodes[complex] + simple = unicodes[simple] + if complex and simple then local ks = kerns[simple] if ks and not kerns[complex] then - extrakerns[complex] = ks + if extrakerns then + extrakerns[complex] = ks + else + extrakerns = { [complex] = ks } + end end end end - if next(extrakerns) then - glyph.extrakerns = extrakerns + if extrakerns then + description.extrakerns = extrakerns end end end end local function do_it_copy(what) - for complex, simple in next, uncomposed[what] do - local c = glyphs[names[complex]] - if c then -- optional - local s = glyphs[names[simple]] - if s then - if not c.kerns then - c.extrakerns = s.kerns or { } - end - if s.extrakerns then - local extrakerns = c.extrakerns or { } - for k, v in next, s.extrakerns do - extrakerns[k] = v + for complex, simple in next, what do + complex = unicodes[complex] + simple = unicodes[simple] + if complex and simple then + local complexdescription = descriptions[complex] + if complexdescription then -- optional + local simpledescription = descriptions[complex] + if simpledescription then + local extrakerns + local kerns = simpledescription.kerns + if kerns then + for unicode, kern in next, kerns do + if extrakerns then + extrakerns[unicode] = kern + else + extrakerns = { [unicode] = kern } + end + end + end + local extrakerns = simpledescription.extrakerns + if extrakerns then + for unicode, kern in next, extrakerns do + if extrakerns then + extrakerns[unicode] = kern + else + extrakerns = { [unicode] = kern } + end + end end - if next(extrakerns) then - s.extrakerns = extrakerns + if extrakerns then + complexdescription.extrakerns = extrakerns end end end @@ -422,152 +732,157 @@ function afm.add_kerns(afmdata) end end -- add complex with values of simplified when present - do_it_left("left") - do_it_left("both") + do_it_left(left) + do_it_left(both) -- copy kerns from simple char to complex char unless set - do_it_copy("both") - do_it_copy("right") + do_it_copy(both) + do_it_copy(right) end --[[ldx--

The copying routine looks messy (and is indeed a bit messy).

--ldx]]-- --- once we have otf sorted out (new format) we can try to make the afm --- cache similar to it (similar tables) - -function afm.add_dimensions(data) -- we need to normalize afm to otf i.e. indexed table instead of name +local function adddimensions(data) -- we need to normalize afm to otf i.e. indexed table instead of name if data then - for index, glyph in next, data.glyphs do - local bb = glyph.boundingbox + for unicode, description in next, data.descriptions do + local bb = description.boundingbox if bb then local ht, dp = bb[4], -bb[2] if ht == 0 or ht < 0 then -- no need to set it and no negative heights, nil == 0 else - glyph.height = ht + description.height = ht end if dp == 0 or dp < 0 then -- no negative depths and no negative depths, nil == 0 else - glyph.depth = dp + description.depth = dp end end end end end -fonts.formats.afm = "type1" -fonts.formats.pfb = "type1" - -function afm.copy_to_tfm(data) - if data then - local glyphs = data.glyphs - if glyphs then - local metadata, luatex = data.metadata, data.luatex - local unicodes, indices = luatex.unicodes, luatex.indices - local characters, parameters, descriptions = { }, { }, { } - -- todo : merge into tfm - for u, i in next, indices do - local d = glyphs[i] - characters[u] = { } - descriptions[u] = d +local function copytotfm(data) + if data and data.descriptions then + local metadata = data.metadata + local resources = data.resources + local properties = table.derive(data.properties) + local descriptions = table.derive(data.descriptions) + local goodies = table.derive(data.goodies) + local characters = { } + local parameters = { } + local unicodes = resources.unicodes + -- + for unicode, description in next, data.descriptions do -- use parent table + characters[unicode] = { } + end + -- + local filename = constructors.checkedfilename(resources) + local fontname = metadata.fontname or metadata.fullname + local fullname = metadata.fullname or metadata.fontname + local endash = unicodes['space'] + local emdash = unicodes['emdash'] + local spacer = "space" + local spaceunits = 500 + -- + local monospaced = metadata.isfixedpitch + local charwidth = metadata.charwidth + local italicangle = metadata.italicangle + local charxheight = metadata.xheight and metadata.xheight > 0 and metadata.xheight + properties.monospaced = monospaced + parameters.italicangle = italicangle + parameters.charwidth = charwidth + parameters.charxheight = charxheight + -- same as otf + if properties.monospaced then + if descriptions[endash] then + spaceunits, spacer = descriptions[endash].width, "space" end - local filename = fonts.tfm.checked_filename(luatex) -- was metadata.filename - local fontname = metadata.fontname or metadata.fullname - local fullname = metadata.fullname or metadata.fontname - local endash, emdash, space, spaceunits = unicodes['space'], unicodes['emdash'], "space", 500 - -- same as otf - if metadata.isfixedpitch then - if descriptions[endash] then - spaceunits, spacer = descriptions[endash].width, "space" - end - if not spaceunits and descriptions[emdash] then - spaceunits, spacer = descriptions[emdash].width, "emdash" - end - if not spaceunits and metadata.charwidth then - spaceunits, spacer = metadata.charwidth, "charwidth" - end - else - if descriptions[endash] then - spaceunits, spacer = descriptions[endash].width, "space" - end - if not spaceunits and metadata.charwidth then - spaceunits, spacer = metadata.charwidth, "charwidth" - end + if not spaceunits and descriptions[emdash] then + spaceunits, spacer = descriptions[emdash].width, "emdash" end - spaceunits = tonumber(spaceunits) - if spaceunits < 200 then - -- todo: warning + if not spaceunits and charwidth then + spaceunits, spacer = charwidth, "charwidth" end - -- - parameters.slant = 0 - parameters.space = spaceunits - parameters.space_stretch = 500 - parameters.space_shrink = 333 - parameters.x_height = 400 - parameters.quad = 1000 - local italicangle = data.metadata.italicangle - if italicangle then - parameters.slant = parameters.slant - math.round(math.tan(italicangle*math.pi/180)) + else + if descriptions[endash] then + spaceunits, spacer = descriptions[endash].width, "space" end - if metadata.isfixedpitch then - parameters.space_stretch = 0 - parameters.space_shrink = 0 - elseif afm.syncspace then - parameters.space_stretch = spaceunits/2 - parameters.space_shrink = spaceunits/3 + if not spaceunits and charwidth then + spaceunits, spacer = charwidth, "charwidth" end - parameters.extra_space = parameters.space_shrink - if metadata.xheight and metadata.xheight > 0 then - parameters.x_height = metadata.xheight - else - -- same as otf - local x = unicodes['x'] + end + spaceunits = tonumber(spaceunits) + if spaceunits < 200 then + -- todo: warning + end + -- + parameters.slant = 0 + parameters.space = spaceunits + parameters.space_stretch = 500 + parameters.space_shrink = 333 + parameters.x_height = 400 + parameters.quad = 1000 + -- + if italicangle then + parameters.italicangle = italicangle + parameters.italicfactor = math.cos(math.rad(90+italicangle)) + parameters.slant = - math.round(math.tan(italicangle*math.pi/180)) + end + if monospaced then + parameters.space_stretch = 0 + parameters.space_shrink = 0 + elseif afm.syncspace then + parameters.space_stretch = spaceunits/2 + parameters.space_shrink = spaceunits/3 + end + parameters.extra_space = parameters.space_shrink + if charxheight then + parameters.x_height = charxheight + else + -- same as otf + local x = unicodes['x'] + if x then + local x = descriptions[x] if x then - local x = descriptions[x] - if x then - parameters.x_height = x.height - end - end - -- - end - local fd = data.fontdimens - if fd and fd[8] and fd[9] and fd[10] then -- math - for k,v in next, fd do - parameters[k] = v + parameters.x_height = x.height end end -- - if next(characters) then - return { - characters = characters, - parameters = parameters, - descriptions = descriptions, - indices = indices, - unicodes = unicodes, - luatex = luatex, - encodingbytes = 2, - filename = filename, - fontname = fontname, - fullname = fullname, - psname = fullname, -- in otf: tfm.fontname or tfm.fullname - name = filename or fullname or fontname, - format = fonts.fontformat(filename,"type1"), - type = 'real', - units = 1000, - direction = 0, - boundarychar_label = 0, - boundarychar = 65536, - --~ false_boundarychar = 65536, -- produces invalid tfm in luatex - designsize = (metadata.designsize or 10)*65536, - spacer = spacer, - ascender = abs(metadata.ascender or 0), - descender = abs(metadata.descender or 0), - italicangle = italicangle, - } + end + local fd = data.fontdimens + if fd and fd[8] and fd[9] and fd[10] then -- math + for k,v in next, fd do + parameters[k] = v end end + -- + parameters.designsize = (metadata.designsize or 10)*65536 + parameters.ascender = abs(metadata.ascender or 0) + parameters.descender = abs(metadata.descender or 0) + parameters.units = 1000 + -- + properties.spacer = spacer + properties.encodingbytes = 2 + properties.format = fonts.formats[filename] or "type1" + properties.filename = filename + properties.fontname = fontname + properties.fullname = fullname + properties.psname = fullname + properties.name = filename or fullname or fontname + -- + if next(characters) then + return { + characters = characters, + descriptions = descriptions, + parameters = parameters, + resources = resources, + properties = properties, + goodies = goodies, + } + end end return nil end @@ -579,118 +894,61 @@ to treat this fontformat like any other and handle features in a more configurable way.

--ldx]]-- -function afm.features.register(name,default) - afm.features.list[#afm.features.list+1] = name - afm.features.default[name] = default -end - -function afm.set_features(tfmdata) - local shared = tfmdata.shared - local afmdata = shared.afmdata - local features = shared.features - if features and next(features) then - local mode = tfmdata.mode or fonts.mode - local initializers = fonts.initializers - local fi = initializers[mode] - local fiafm = fi and fi.afm - if fiafm then - local lists = { - fonts.triggers, - afm.features.list, - fonts.manipulators, - } - for l=1,3 do - local list = lists[l] - if list then - for i=1,#list do - local f = list[i] - local value = features[f] - if value and fiafm[f] then -- brr - if trace_features then - logs.report("define afm","initializing feature %s to %s for mode %s for font %s",f,tostring(value),mode or 'unknown',tfmdata.name or 'unknown') - end - fiafm[f](tfmdata,value) - mode = tfmdata.mode or fonts.mode - fiafm = initializers[mode].afm - end - end - end - end - end - local fm = fonts.methods[mode] - local fmafm = fm and fm.afm - if fmfm then - local lists = { - afm.features.list, - } - local sp = shared.processors - for l=1,1 do - local list = lists[l] - if list then - for i=1,#list do - local f = list[i] - if features[f] and fmafm[f] then -- brr - if not sp then - sp = { fmafm[f] } - shared.processors = sp - else - sp[#sp+1] = fmafm[f] - end - end - end - end - end - end +function afm.setfeatures(tfmdata,features) + local okay = constructors.initializefeatures("afm",tfmdata,features,trace_features,report_afm) + if okay then + return constructors.collectprocessors("afm",tfmdata,features,trace_features,report_afm) + else + return { } -- will become false end end -function afm.check_features(specification) - local features, done = fonts.define.check(specification.features.normal,afm.features.default) - if done then - specification.features.normal = features - tfm.hash_instance(specification,true) - end +local function checkfeatures(specification) end -function afm.afm_to_tfm(specification) +local function afmtotfm(specification) local afmname = specification.filename or specification.name if specification.forced == "afm" or specification.format == "afm" then -- move this one up if trace_loading then - logs.report("load afm","forcing afm format for %s",afmname) + report_afm("forcing afm format for %s",afmname) end else - local tfmname = resolvers.findbinfile(afmname,"ofm") or "" + local tfmname = findbinfile(afmname,"ofm") or "" if tfmname ~= "" then if trace_loading then - logs.report("load afm","fallback from afm to tfm for %s",afmname) + report_afm("fallback from afm to tfm for %s",afmname) end - afmname = "" + return -- just that end end - if afmname == "" then - return nil - else - afm.check_features(specification) - specification = fonts.define.resolve(specification) -- new, was forgotten - local features = specification.features.normal + if afmname ~= "" then + -- weird, isn't this already done then? + local features = constructors.checkedfeatures("afm",specification.features.normal) + specification.features.normal = features + constructors.hashinstance(specification,true) -- also weird here + -- + specification = definers.resolve(specification) -- new, was forgotten local cache_id = specification.hash - local tfmdata = containers.read(tfm.cache(), cache_id) -- cache with features applied + local tfmdata = containers.read(constructors.cache, cache_id) -- cache with features applied if not tfmdata then - local afmdata = afm.load(afmname) - if afmdata and next(afmdata) then - afm.add_dimensions(afmdata) - tfmdata = afm.copy_to_tfm(afmdata) + local rawdata = afm.load(afmname) + if rawdata and next(rawdata) then + adddimensions(rawdata) + tfmdata = copytotfm(rawdata) if tfmdata and next(tfmdata) then - tfmdata.shared = tfmdata.shared or { } - tfmdata.unique = tfmdata.unique or { } - tfmdata.shared.afmdata = afmdata - tfmdata.shared.features = features - afm.set_features(tfmdata) + local shared = tfmdata.shared + if not shared then + shared = { } + tfmdata.shared = shared + end + shared.rawdata = rawdata + shared.features = features + shared.processes = afm.setfeatures(tfmdata,features) end elseif trace_loading then - logs.report("load afm","no (valid) afm file found with name %s",afmname) + report_afm("no (valid) afm file found with name %s",afmname) end - tfmdata = containers.write(tfm.cache(),cache_id,tfmdata) + tfmdata = containers.write(constructors.cache,cache_id,tfmdata) end return tfmdata end @@ -704,37 +962,15 @@ those cases, but now that we can handle directly we no longer need this features.

--ldx]]-- -tfm.default_encoding = 'unicode' - -function tfm.set_normal_feature(specification,name,value) - if specification and name then - specification.features = specification.features or { } - specification.features.normal = specification.features.normal or { } - specification.features.normal[name] = value +local function read_from_afm(specification) + local tfmdata = afmtotfm(specification) + if tfmdata then + tfmdata.properties.name = specification.name + tfmdata = constructors.scale(tfmdata, specification) + constructors.applymanipulators("afm",tfmdata,specification.features.normal,trace_features,report_afm) + fonts.loggers.register(tfmdata,'afm',specification) end -end - -function tfm.read_from_afm(specification) - local tfmtable = afm.afm_to_tfm(specification) - if tfmtable then - tfmtable.name = specification.name - tfmtable = tfm.scale(tfmtable, specification.size, specification.relativeid) - local afmdata = tfmtable.shared.afmdata ---~ local filename = afmdata and afmdata.luatex and afmdata.luatex.filename ---~ if filename then ---~ tfmtable.encodingbytes = 2 ---~ tfmtable.filename = resolvers.findbinfile(filename,"") or filename ---~ tfmtable.fontname = afmdata.metadata.fontname or afmdata.metadata.fullname ---~ tfmtable.fullname = afmdata.metadata.fullname or afmdata.metadata.fontname ---~ tfmtable.format = 'type1' ---~ tfmtable.name = afmdata.luatex.filename or tfmtable.fullname ---~ end - if fonts.dontembed[filename] then - tfmtable.file = nil -- or filename ? - end - fonts.logger.save(tfmtable,'afm',specification) - end - return tfmtable + return tfmdata end --[[ldx-- @@ -742,40 +978,34 @@ end those that make sense for this format.

--ldx]]-- -function afm.features.prepare_ligatures(tfmdata,ligatures,value) +local function prepareligatures(tfmdata,ligatures,value) if value then - local afmdata = tfmdata.shared.afmdata - local luatex = afmdata.luatex - local unicodes = luatex.unicodes local descriptions = tfmdata.descriptions - for u, chr in next, tfmdata.characters do - local d = descriptions[u] - local l = d[ligatures] - if l then - local ligatures = chr.ligatures - if not ligatures then - ligatures = { } - chr.ligatures = ligatures + for unicode, character in next, tfmdata.characters do + local description = descriptions[unicode] + local dligatures = description.ligatures + if dligatures then + local cligatures = character.ligatures + if not cligatures then + cligatures = { } + character.ligatures = cligatures end - for k, v in next, l do - local uk, uv = unicodes[k], unicodes[v] - if uk and uv then - ligatures[uk] = { - char = uv, - type = 0 - } - end + for unicode, ligature in next, dligatures do + cligatures[unicode] = { + char = ligature, + type = 0 + } end end end end end -function afm.features.prepare_kerns(tfmdata,kerns,value) +local function preparekerns(tfmdata,kerns,value) if value then - local afmdata = tfmdata.shared.afmdata - local luatex = afmdata.luatex - local unicodes = luatex.unicodes + local rawdata = tfmdata.shared.rawdata + local resources = rawdata.resources + local unicodes = resources.unicodes local descriptions = tfmdata.descriptions for u, chr in next, tfmdata.characters do local d = descriptions[u] @@ -797,59 +1027,133 @@ function afm.features.prepare_kerns(tfmdata,kerns,value) end end --- hm, register? - -function fonts.initializers.base.afm.ligatures (tfmdata,value) afm.features.prepare_ligatures(tfmdata,'ligatures', value) end -function fonts.initializers.base.afm.texligatures(tfmdata,value) afm.features.prepare_ligatures(tfmdata,'texligatures',value) end -function fonts.initializers.base.afm.kerns (tfmdata,value) afm.features.prepare_kerns (tfmdata,'kerns', value) end -function fonts.initializers.base.afm.extrakerns (tfmdata,value) afm.features.prepare_kerns (tfmdata,'extrakerns', value) end - -afm.features.register('liga',true) -afm.features.register('kerns',true) -afm.features.register('extrakerns') -- needed? - -fonts.initializers.node.afm.ligatures = fonts.initializers.base.afm.ligatures -fonts.initializers.node.afm.texligatures = fonts.initializers.base.afm.texligatures -fonts.initializers.node.afm.kerns = fonts.initializers.base.afm.kerns -fonts.initializers.node.afm.extrakerns = fonts.initializers.base.afm.extrakerns - -fonts.initializers.base.afm.liga = fonts.initializers.base.afm.ligatures -fonts.initializers.node.afm.liga = fonts.initializers.base.afm.ligatures -fonts.initializers.base.afm.tlig = fonts.initializers.base.afm.texligatures -fonts.initializers.node.afm.tlig = fonts.initializers.base.afm.texligatures +local list = { + -- [0x0022] = 0x201D, + [0x0027] = 0x2019, + -- [0x0060] = 0x2018, +} -fonts.initializers.base.afm.trep = tfm.replacements -fonts.initializers.node.afm.trep = tfm.replacements +local function texreplacements(tfmdata,value) + local descriptions = tfmdata.descriptions + local characters = tfmdata.characters + for k, v in next, list do + characters [k] = characters [v] -- we forget about kerns + descriptions[k] = descriptions[v] -- we forget about kerns + end +end -afm.features.register('tlig',true) -- todo: also proper features for afm -afm.features.register('trep',true) -- todo: also proper features for afm +local function ligatures (tfmdata,value) prepareligatures(tfmdata,'ligatures', value) end +local function texligatures(tfmdata,value) prepareligatures(tfmdata,'texligatures',value) end +local function kerns (tfmdata,value) preparekerns (tfmdata,'kerns', value) end +local function extrakerns (tfmdata,value) preparekerns (tfmdata,'extrakerns', value) end --- tfm features +registerafmfeature { + name = "liga", + description = "traditional ligatures", + initializers = { + base = ligatures, + node = ligatures, + } +} -fonts.initializers.base.afm.equaldigits = fonts.initializers.common.equaldigits -fonts.initializers.node.afm.equaldigits = fonts.initializers.common.equaldigits -fonts.initializers.base.afm.lineheight = fonts.initializers.common.lineheight -fonts.initializers.node.afm.lineheight = fonts.initializers.common.lineheight +registerafmfeature { + name = "kern", + description = "intercharacter kerning", + initializers = { + base = kerns, + node = kerns, + } +} --- vf features +registerafmfeature { + name = "extrakerns", + description = "additional intercharacter kerning", + initializers = { + base = extrakerns, + node = extrakerns, + } +} -fonts.initializers.base.afm.compose = fonts.initializers.common.compose -fonts.initializers.node.afm.compose = fonts.initializers.common.compose +registerafmfeature { + name = 'tlig', + description = 'tex ligatures', + initializers = { + base = texligatures, + node = texligatures, + } +} --- afm specific, encodings ...kind of obsolete +registerafmfeature { + name = 'trep', + description = 'tex replacements', + initializers = { + base = texreplacements, + node = texreplacements, + } +} -afm.features.register('encoding') +-- readers -fonts.initializers.base.afm.encoding = fonts.initializers.common.encoding -fonts.initializers.node.afm.encoding = fonts.initializers.common.encoding +local check_tfm = readers.check_tfm --- todo: oldstyle smallcaps as features for afm files (use with care) +fonts.formats.afm = "type1" +fonts.formats.pfb = "type1" -fonts.initializers.base.afm.onum = fonts.initializers.common.oldstyle -fonts.initializers.base.afm.smcp = fonts.initializers.common.smallcaps -fonts.initializers.base.afm.fkcp = fonts.initializers.common.fakecaps +local function check_afm(specification,fullname) + local foundname = findbinfile(fullname, 'afm') or "" -- just to be sure + if foundname == "" then + foundname = fonts.names.getfilename(fullname,"afm") + end + if foundname == "" and afm.autoprefixed then + local encoding, shortname = match(fullname,"^(.-)%-(.*)$") -- context: encoding-name.* + if encoding and shortname and fonts.encodings.known[encoding] then + shortname = findbinfile(shortname,'afm') or "" -- just to be sure + if shortname ~= "" then + foundname = shortname + if trace_defining then + report_afm("stripping encoding prefix from filename %s",afmname) + end + end + end + end + if foundname ~= "" then + specification.filename = foundname + specification.format = "afm" + return read_from_afm(specification) + end +end -afm.features.register('onum',false) -afm.features.register('smcp',false) -afm.features.register('fkcp',false) +function readers.afm(specification,method) + local fullname, tfmdata = specification.filename or "", nil + if fullname == "" then + local forced = specification.forced or "" + if forced ~= "" then + tfmdata = check_afm(specification,specification.name .. "." .. forced) + end + if not tfmdata then + method = method or definers.method or "afm or tfm" + if method == "tfm" then + tfmdata = check_tfm(specification,specification.name) + elseif method == "afm" then + tfmdata = check_afm(specification,specification.name) + elseif method == "tfm or afm" then + tfmdata = check_tfm(specification,specification.name) or check_afm(specification,specification.name) + else -- method == "afm or tfm" or method == "" then + tfmdata = check_afm(specification,specification.name) or check_tfm(specification,specification.name) + end + end + else + tfmdata = check_afm(specification,fullname) + end + return tfmdata +end +function readers.pfb(specification,method) -- only called when forced + local original = specification.specification + if trace_defining then + report_afm("using afm reader for '%s'",original) + end + specification.specification = gsub(original,"%.pfb",".afm") + specification.forced = "afm" + return readers.afm(specification,method) +end diff --git a/Master/texmf-dist/tex/context/base/font-age.lua b/Master/texmf-dist/tex/context/base/font-age.lua new file mode 100644 index 00000000000..741bb475ab2 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/font-age.lua @@ -0,0 +1,3744 @@ +if not modules then modules = { } end modules ['font-age'] = { + version = 1.001, + comment = "companion to font-gee.lua", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "derived from http://www.adobe.com/devnet/opentype/archives/glyphlist.txt", + original = "Adobe Glyph List, version 2.0, September 20, 2002", +} + +if context then + texio.write_nl("fatal error: this module is not for context") + os.exit() +end + +return { -- generated + ["A"]=65, + ["AE"]=198, + ["AEacute"]=508, + ["AEmacron"]=482, + ["Aacute"]=193, + ["Abreve"]=258, + ["Abreveacute"]=7854, + ["Abrevecyrillic"]=1232, + ["Abrevedotbelow"]=7862, + ["Abrevegrave"]=7856, + ["Abrevehookabove"]=7858, + ["Abrevetilde"]=7860, + ["Acaron"]=461, + ["Acircle"]=9398, + ["Acircumflex"]=194, + ["Acircumflexacute"]=7844, + ["Acircumflexdotbelow"]=7852, + ["Acircumflexgrave"]=7846, + ["Acircumflexhookabove"]=7848, + ["Acircumflextilde"]=7850, + ["Adblgrave"]=512, + ["Adieresis"]=196, + ["Adieresiscyrillic"]=1234, + ["Adieresismacron"]=478, + ["Adotbelow"]=7840, + ["Adotmacron"]=480, + ["Agrave"]=192, + ["Ahookabove"]=7842, + ["Aiecyrillic"]=1236, + ["Ainvertedbreve"]=514, + ["Alpha"]=913, + ["Alphatonos"]=902, + ["Amacron"]=256, + ["Amonospace"]=65313, + ["Aogonek"]=260, + ["Aring"]=197, + ["Aringacute"]=506, + ["Aringbelow"]=7680, + ["Atilde"]=195, + ["Aybarmenian"]=1329, + ["B"]=66, + ["Bcircle"]=9399, + ["Bdotaccent"]=7682, + ["Bdotbelow"]=7684, + ["Benarmenian"]=1330, + ["Beta"]=914, + ["Bhook"]=385, + ["Blinebelow"]=7686, + ["Bmonospace"]=65314, + ["Btopbar"]=386, + ["C"]=67, + ["Caarmenian"]=1342, + ["Cacute"]=262, + ["Ccaron"]=268, + ["Ccedilla"]=199, + ["Ccedillaacute"]=7688, + ["Ccircle"]=9400, + ["Ccircumflex"]=264, + ["Cdotaccent"]=266, + ["Chaarmenian"]=1353, + ["Cheabkhasiancyrillic"]=1212, + ["Chedescenderabkhasiancyrillic"]=1214, + ["Chedescendercyrillic"]=1206, + ["Chedieresiscyrillic"]=1268, + ["Cheharmenian"]=1347, + ["Chekhakassiancyrillic"]=1227, + ["Cheverticalstrokecyrillic"]=1208, + ["Chi"]=935, + ["Chook"]=391, + ["Cmonospace"]=65315, + ["Coarmenian"]=1361, + ["D"]=68, + ["DZ"]=497, + ["DZcaron"]=452, + ["Daarmenian"]=1332, + ["Dafrican"]=393, + ["Dcaron"]=270, + ["Dcedilla"]=7696, + ["Dcircle"]=9401, + ["Dcircumflexbelow"]=7698, + ["Ddotaccent"]=7690, + ["Ddotbelow"]=7692, + ["Deicoptic"]=1006, + ["Deltagreek"]=916, + ["Dhook"]=394, + ["Digammagreek"]=988, + ["Dlinebelow"]=7694, + ["Dmonospace"]=65316, + ["Dslash"]=272, + ["Dtopbar"]=395, + ["Dz"]=498, + ["Dzcaron"]=453, + ["Dzeabkhasiancyrillic"]=1248, + ["E"]=69, + ["Eacute"]=201, + ["Ebreve"]=276, + ["Ecaron"]=282, + ["Ecedillabreve"]=7708, + ["Echarmenian"]=1333, + ["Ecircle"]=9402, + ["Ecircumflex"]=202, + ["Ecircumflexacute"]=7870, + ["Ecircumflexbelow"]=7704, + ["Ecircumflexdotbelow"]=7878, + ["Ecircumflexgrave"]=7872, + ["Ecircumflexhookabove"]=7874, + ["Ecircumflextilde"]=7876, + ["Edblgrave"]=516, + ["Edieresis"]=203, + ["Edotaccent"]=278, + ["Edotbelow"]=7864, + ["Egrave"]=200, + ["Eharmenian"]=1335, + ["Ehookabove"]=7866, + ["Eightroman"]=8551, + ["Einvertedbreve"]=518, + ["Eiotifiedcyrillic"]=1124, + ["Elevenroman"]=8554, + ["Emacron"]=274, + ["Emacronacute"]=7702, + ["Emacrongrave"]=7700, + ["Emonospace"]=65317, + ["Endescendercyrillic"]=1186, + ["Eng"]=330, + ["Enghecyrillic"]=1188, + ["Enhookcyrillic"]=1223, + ["Eogonek"]=280, + ["Eopen"]=400, + ["Epsilon"]=917, + ["Epsilontonos"]=904, + ["Ereversed"]=398, + ["Esdescendercyrillic"]=1194, + ["Esh"]=425, + ["Eta"]=919, + ["Etarmenian"]=1336, + ["Etatonos"]=905, + ["Eth"]=208, + ["Etilde"]=7868, + ["Etildebelow"]=7706, + ["Ezh"]=439, + ["Ezhcaron"]=494, + ["Ezhreversed"]=440, + ["F"]=70, + ["Fcircle"]=9403, + ["Fdotaccent"]=7710, + ["Feharmenian"]=1366, + ["Feicoptic"]=996, + ["Fhook"]=401, + ["Fiveroman"]=8548, + ["Fmonospace"]=65318, + ["Fourroman"]=8547, + ["G"]=71, + ["GBsquare"]=13191, + ["Gacute"]=500, + ["Gamma"]=915, + ["Gammaafrican"]=404, + ["Gangiacoptic"]=1002, + ["Gbreve"]=286, + ["Gcaron"]=486, + ["Gcircle"]=9404, + ["Gcircumflex"]=284, + ["Gcommaaccent"]=290, + ["Gdotaccent"]=288, + ["Ghadarmenian"]=1346, + ["Ghemiddlehookcyrillic"]=1172, + ["Ghestrokecyrillic"]=1170, + ["Ghook"]=403, + ["Gimarmenian"]=1331, + ["Gmacron"]=7712, + ["Gmonospace"]=65319, + ["Gsmallhook"]=667, + ["Gstroke"]=484, + ["H"]=72, + ["HPsquare"]=13259, + ["Haabkhasiancyrillic"]=1192, + ["Hadescendercyrillic"]=1202, + ["Hbar"]=294, + ["Hbrevebelow"]=7722, + ["Hcedilla"]=7720, + ["Hcircle"]=9405, + ["Hcircumflex"]=292, + ["Hdieresis"]=7718, + ["Hdotaccent"]=7714, + ["Hdotbelow"]=7716, + ["Hmonospace"]=65320, + ["Hoarmenian"]=1344, + ["Horicoptic"]=1000, + ["Hzsquare"]=13200, + ["I"]=73, + ["IJ"]=306, + ["Iacute"]=205, + ["Ibreve"]=300, + ["Icaron"]=463, + ["Icircle"]=9406, + ["Icircumflex"]=206, + ["Idblgrave"]=520, + ["Idieresis"]=207, + ["Idieresisacute"]=7726, + ["Idieresiscyrillic"]=1252, + ["Idotaccent"]=304, + ["Idotbelow"]=7882, + ["Iebrevecyrillic"]=1238, + ["Ifraktur"]=8465, + ["Igrave"]=204, + ["Ihookabove"]=7880, + ["Iinvertedbreve"]=522, + ["Imacron"]=298, + ["Imacroncyrillic"]=1250, + ["Imonospace"]=65321, + ["Iniarmenian"]=1339, + ["Iogonek"]=302, + ["Iota"]=921, + ["Iotaafrican"]=406, + ["Iotadieresis"]=938, + ["Iotatonos"]=906, + ["Istroke"]=407, + ["Itilde"]=296, + ["Itildebelow"]=7724, + ["Izhitsadblgravecyrillic"]=1142, + ["J"]=74, + ["Jaarmenian"]=1345, + ["Jcircle"]=9407, + ["Jcircumflex"]=308, + ["Jheharmenian"]=1355, + ["Jmonospace"]=65322, + ["K"]=75, + ["KBsquare"]=13189, + ["KKsquare"]=13261, + ["Kabashkircyrillic"]=1184, + ["Kacute"]=7728, + ["Kadescendercyrillic"]=1178, + ["Kahookcyrillic"]=1219, + ["Kappa"]=922, + ["Kastrokecyrillic"]=1182, + ["Kaverticalstrokecyrillic"]=1180, + ["Kcaron"]=488, + ["Kcircle"]=9408, + ["Kcommaaccent"]=310, + ["Kdotbelow"]=7730, + ["Keharmenian"]=1364, + ["Kenarmenian"]=1343, + ["Kheicoptic"]=998, + ["Khook"]=408, + ["Klinebelow"]=7732, + ["Kmonospace"]=65323, + ["Koppacyrillic"]=1152, + ["Koppagreek"]=990, + ["Ksicyrillic"]=1134, + ["L"]=76, + ["LJ"]=455, + ["Lacute"]=313, + ["Lambda"]=923, + ["Lcaron"]=317, + ["Lcircle"]=9409, + ["Lcircumflexbelow"]=7740, + ["Lcommaaccent"]=315, + ["Ldotaccent"]=319, + ["Ldotbelow"]=7734, + ["Ldotbelowmacron"]=7736, + ["Liwnarmenian"]=1340, + ["Lj"]=456, + ["Llinebelow"]=7738, + ["Lmonospace"]=65324, + ["Lslash"]=321, + ["M"]=77, + ["MBsquare"]=13190, + ["Macute"]=7742, + ["Mcircle"]=9410, + ["Mdotaccent"]=7744, + ["Mdotbelow"]=7746, + ["Menarmenian"]=1348, + ["Mmonospace"]=65325, + ["Mturned"]=412, + ["Mu"]=924, + ["N"]=78, + ["NJ"]=458, + ["Nacute"]=323, + ["Ncaron"]=327, + ["Ncircle"]=9411, + ["Ncircumflexbelow"]=7754, + ["Ncommaaccent"]=325, + ["Ndotaccent"]=7748, + ["Ndotbelow"]=7750, + ["Nhookleft"]=413, + ["Nineroman"]=8552, + ["Nj"]=459, + ["Nlinebelow"]=7752, + ["Nmonospace"]=65326, + ["Nowarmenian"]=1350, + ["Ntilde"]=209, + ["Nu"]=925, + ["O"]=79, + ["OE"]=338, + ["Oacute"]=211, + ["Obarredcyrillic"]=1256, + ["Obarreddieresiscyrillic"]=1258, + ["Obreve"]=334, + ["Ocaron"]=465, + ["Ocenteredtilde"]=415, + ["Ocircle"]=9412, + ["Ocircumflex"]=212, + ["Ocircumflexacute"]=7888, + ["Ocircumflexdotbelow"]=7896, + ["Ocircumflexgrave"]=7890, + ["Ocircumflexhookabove"]=7892, + ["Ocircumflextilde"]=7894, + ["Odblgrave"]=524, + ["Odieresis"]=214, + ["Odieresiscyrillic"]=1254, + ["Odotbelow"]=7884, + ["Ograve"]=210, + ["Oharmenian"]=1365, + ["Ohookabove"]=7886, + ["Ohorn"]=416, + ["Ohornacute"]=7898, + ["Ohorndotbelow"]=7906, + ["Ohorngrave"]=7900, + ["Ohornhookabove"]=7902, + ["Ohorntilde"]=7904, + ["Ohungarumlaut"]=336, + ["Oi"]=418, + ["Oinvertedbreve"]=526, + ["Omacron"]=332, + ["Omacronacute"]=7762, + ["Omacrongrave"]=7760, + ["Omega"]=8486, + ["Omegacyrillic"]=1120, + ["Omegagreek"]=937, + ["Omegaroundcyrillic"]=1146, + ["Omegatitlocyrillic"]=1148, + ["Omegatonos"]=911, + ["Omicron"]=927, + ["Omicrontonos"]=908, + ["Omonospace"]=65327, + ["Oneroman"]=8544, + ["Oogonek"]=490, + ["Oogonekmacron"]=492, + ["Oopen"]=390, + ["Oslash"]=216, + ["Ostrokeacute"]=510, + ["Otcyrillic"]=1150, + ["Otilde"]=213, + ["Otildeacute"]=7756, + ["Otildedieresis"]=7758, + ["P"]=80, + ["Pacute"]=7764, + ["Pcircle"]=9413, + ["Pdotaccent"]=7766, + ["Peharmenian"]=1354, + ["Pemiddlehookcyrillic"]=1190, + ["Phi"]=934, + ["Phook"]=420, + ["Pi"]=928, + ["Piwrarmenian"]=1363, + ["Pmonospace"]=65328, + ["Psi"]=936, + ["Psicyrillic"]=1136, + ["Q"]=81, + ["Qcircle"]=9414, + ["Qmonospace"]=65329, + ["R"]=82, + ["Raarmenian"]=1356, + ["Racute"]=340, + ["Rcaron"]=344, + ["Rcircle"]=9415, + ["Rcommaaccent"]=342, + ["Rdblgrave"]=528, + ["Rdotaccent"]=7768, + ["Rdotbelow"]=7770, + ["Rdotbelowmacron"]=7772, + ["Reharmenian"]=1360, + ["Rfraktur"]=8476, + ["Rho"]=929, + ["Rinvertedbreve"]=530, + ["Rlinebelow"]=7774, + ["Rmonospace"]=65330, + ["Rsmallinverted"]=641, + ["Rsmallinvertedsuperior"]=694, + ["S"]=83, + ["SF010000"]=9484, + ["SF020000"]=9492, + ["SF030000"]=9488, + ["SF040000"]=9496, + ["SF050000"]=9532, + ["SF060000"]=9516, + ["SF070000"]=9524, + ["SF080000"]=9500, + ["SF090000"]=9508, + ["SF100000"]=9472, + ["SF110000"]=9474, + ["SF190000"]=9569, + ["SF200000"]=9570, + ["SF210000"]=9558, + ["SF220000"]=9557, + ["SF230000"]=9571, + ["SF240000"]=9553, + ["SF250000"]=9559, + ["SF260000"]=9565, + ["SF270000"]=9564, + ["SF280000"]=9563, + ["SF360000"]=9566, + ["SF370000"]=9567, + ["SF380000"]=9562, + ["SF390000"]=9556, + ["SF400000"]=9577, + ["SF410000"]=9574, + ["SF420000"]=9568, + ["SF430000"]=9552, + ["SF440000"]=9580, + ["SF450000"]=9575, + ["SF460000"]=9576, + ["SF470000"]=9572, + ["SF480000"]=9573, + ["SF490000"]=9561, + ["SF500000"]=9560, + ["SF510000"]=9554, + ["SF520000"]=9555, + ["SF530000"]=9579, + ["SF540000"]=9578, + ["Sacute"]=346, + ["Sacutedotaccent"]=7780, + ["Sampigreek"]=992, + ["Scaron"]=352, + ["Scarondotaccent"]=7782, + ["Scedilla"]=350, + ["Schwa"]=399, + ["Schwacyrillic"]=1240, + ["Schwadieresiscyrillic"]=1242, + ["Scircle"]=9416, + ["Scircumflex"]=348, + ["Scommaaccent"]=536, + ["Sdotaccent"]=7776, + ["Sdotbelow"]=7778, + ["Sdotbelowdotaccent"]=7784, + ["Seharmenian"]=1357, + ["Sevenroman"]=8550, + ["Shaarmenian"]=1351, + ["Sheicoptic"]=994, + ["Shhacyrillic"]=1210, + ["Shimacoptic"]=1004, + ["Sigma"]=931, + ["Sixroman"]=8549, + ["Smonospace"]=65331, + ["Stigmagreek"]=986, + ["T"]=84, + ["Tau"]=932, + ["Tbar"]=358, + ["Tcaron"]=356, + ["Tcircle"]=9417, + ["Tcircumflexbelow"]=7792, + ["Tcommaaccent"]=354, + ["Tdotaccent"]=7786, + ["Tdotbelow"]=7788, + ["Tedescendercyrillic"]=1196, + ["Tenroman"]=8553, + ["Tetsecyrillic"]=1204, + ["Theta"]=920, + ["Thook"]=428, + ["Thorn"]=222, + ["Threeroman"]=8546, + ["Tiwnarmenian"]=1359, + ["Tlinebelow"]=7790, + ["Tmonospace"]=65332, + ["Toarmenian"]=1337, + ["Tonefive"]=444, + ["Tonesix"]=388, + ["Tonetwo"]=423, + ["Tretroflexhook"]=430, + ["Twelveroman"]=8555, + ["Tworoman"]=8545, + ["U"]=85, + ["Uacute"]=218, + ["Ubreve"]=364, + ["Ucaron"]=467, + ["Ucircle"]=9418, + ["Ucircumflex"]=219, + ["Ucircumflexbelow"]=7798, + ["Udblgrave"]=532, + ["Udieresis"]=220, + ["Udieresisacute"]=471, + ["Udieresisbelow"]=7794, + ["Udieresiscaron"]=473, + ["Udieresiscyrillic"]=1264, + ["Udieresisgrave"]=475, + ["Udieresismacron"]=469, + ["Udotbelow"]=7908, + ["Ugrave"]=217, + ["Uhookabove"]=7910, + ["Uhorn"]=431, + ["Uhornacute"]=7912, + ["Uhorndotbelow"]=7920, + ["Uhorngrave"]=7914, + ["Uhornhookabove"]=7916, + ["Uhorntilde"]=7918, + ["Uhungarumlaut"]=368, + ["Uhungarumlautcyrillic"]=1266, + ["Uinvertedbreve"]=534, + ["Ukcyrillic"]=1144, + ["Umacron"]=362, + ["Umacroncyrillic"]=1262, + ["Umacrondieresis"]=7802, + ["Umonospace"]=65333, + ["Uogonek"]=370, + ["Upsilon"]=933, + ["Upsilonacutehooksymbolgreek"]=979, + ["Upsilonafrican"]=433, + ["Upsilondieresis"]=939, + ["Upsilondieresishooksymbolgreek"]=980, + ["Upsilonhooksymbol"]=978, + ["Upsilontonos"]=910, + ["Uring"]=366, + ["Ustraightcyrillic"]=1198, + ["Ustraightstrokecyrillic"]=1200, + ["Utilde"]=360, + ["Utildeacute"]=7800, + ["Utildebelow"]=7796, + ["V"]=86, + ["Vcircle"]=9419, + ["Vdotbelow"]=7806, + ["Vewarmenian"]=1358, + ["Vhook"]=434, + ["Vmonospace"]=65334, + ["Voarmenian"]=1352, + ["Vtilde"]=7804, + ["W"]=87, + ["Wacute"]=7810, + ["Wcircle"]=9420, + ["Wcircumflex"]=372, + ["Wdieresis"]=7812, + ["Wdotaccent"]=7814, + ["Wdotbelow"]=7816, + ["Wgrave"]=7808, + ["Wmonospace"]=65335, + ["X"]=88, + ["Xcircle"]=9421, + ["Xdieresis"]=7820, + ["Xdotaccent"]=7818, + ["Xeharmenian"]=1341, + ["Xi"]=926, + ["Xmonospace"]=65336, + ["Y"]=89, + ["Yacute"]=221, + ["Ycircle"]=9422, + ["Ycircumflex"]=374, + ["Ydieresis"]=376, + ["Ydotaccent"]=7822, + ["Ydotbelow"]=7924, + ["Yerudieresiscyrillic"]=1272, + ["Ygrave"]=7922, + ["Yhook"]=435, + ["Yhookabove"]=7926, + ["Yiarmenian"]=1349, + ["Yiwnarmenian"]=1362, + ["Ymonospace"]=65337, + ["Ytilde"]=7928, + ["Yusbigcyrillic"]=1130, + ["Yusbigiotifiedcyrillic"]=1132, + ["Yuslittlecyrillic"]=1126, + ["Yuslittleiotifiedcyrillic"]=1128, + ["Z"]=90, + ["Zaarmenian"]=1334, + ["Zacute"]=377, + ["Zcaron"]=381, + ["Zcircle"]=9423, + ["Zcircumflex"]=7824, + ["Zdotaccent"]=379, + ["Zdotbelow"]=7826, + ["Zedescendercyrillic"]=1176, + ["Zedieresiscyrillic"]=1246, + ["Zeta"]=918, + ["Zhearmenian"]=1338, + ["Zhebrevecyrillic"]=1217, + ["Zhedescendercyrillic"]=1174, + ["Zhedieresiscyrillic"]=1244, + ["Zlinebelow"]=7828, + ["Zmonospace"]=65338, + ["Zstroke"]=437, + ["a"]=97, + ["aabengali"]=2438, + ["aacute"]=225, + ["aadeva"]=2310, + ["aagujarati"]=2694, + ["aagurmukhi"]=2566, + ["aamatragurmukhi"]=2622, + ["aarusquare"]=13059, + ["aavowelsignbengali"]=2494, + ["aavowelsigndeva"]=2366, + ["aavowelsigngujarati"]=2750, + ["abbreviationmarkarmenian"]=1375, + ["abbreviationsigndeva"]=2416, + ["abengali"]=2437, + ["abopomofo"]=12570, + ["abreve"]=259, + ["abreveacute"]=7855, + ["abrevecyrillic"]=1233, + ["abrevedotbelow"]=7863, + ["abrevegrave"]=7857, + ["abrevehookabove"]=7859, + ["abrevetilde"]=7861, + ["acaron"]=462, + ["acircle"]=9424, + ["acircumflex"]=226, + ["acircumflexacute"]=7845, + ["acircumflexdotbelow"]=7853, + ["acircumflexgrave"]=7847, + ["acircumflexhookabove"]=7849, + ["acircumflextilde"]=7851, + ["acute"]=180, + ["acutebelowcmb"]=791, + ["acutecomb"]=769, + ["acutedeva"]=2388, + ["acutelowmod"]=719, + ["acutetonecmb"]=833, + ["adblgrave"]=513, + ["addakgurmukhi"]=2673, + ["adeva"]=2309, + ["adieresis"]=228, + ["adieresiscyrillic"]=1235, + ["adieresismacron"]=479, + ["adotbelow"]=7841, + ["adotmacron"]=481, + ["ae"]=230, + ["aeacute"]=509, + ["aekorean"]=12624, + ["aemacron"]=483, + ["afii10017"]=1040, + ["afii10018"]=1041, + ["afii10019"]=1042, + ["afii10020"]=1043, + ["afii10021"]=1044, + ["afii10022"]=1045, + ["afii10023"]=1025, + ["afii10024"]=1046, + ["afii10025"]=1047, + ["afii10026"]=1048, + ["afii10027"]=1049, + ["afii10028"]=1050, + ["afii10029"]=1051, + ["afii10030"]=1052, + ["afii10031"]=1053, + ["afii10032"]=1054, + ["afii10033"]=1055, + ["afii10034"]=1056, + ["afii10035"]=1057, + ["afii10036"]=1058, + ["afii10037"]=1059, + ["afii10038"]=1060, + ["afii10039"]=1061, + ["afii10040"]=1062, + ["afii10041"]=1063, + ["afii10042"]=1064, + ["afii10043"]=1065, + ["afii10044"]=1066, + ["afii10045"]=1067, + ["afii10046"]=1068, + ["afii10047"]=1069, + ["afii10048"]=1070, + ["afii10049"]=1071, + ["afii10050"]=1168, + ["afii10051"]=1026, + ["afii10052"]=1027, + ["afii10053"]=1028, + ["afii10054"]=1029, + ["afii10055"]=1030, + ["afii10056"]=1031, + ["afii10057"]=1032, + ["afii10058"]=1033, + ["afii10059"]=1034, + ["afii10060"]=1035, + ["afii10061"]=1036, + ["afii10062"]=1038, + ["afii10065"]=1072, + ["afii10145"]=1039, + ["afii10146"]=1122, + ["afii10147"]=1138, + ["afii10148"]=1140, + ["afii299"]=8206, + ["afii300"]=8207, + ["afii301"]=8205, + ["afii57534"]=1749, + ["afii61573"]=8236, + ["afii61574"]=8237, + ["afii61575"]=8238, + ["agrave"]=224, + ["agujarati"]=2693, + ["agurmukhi"]=2565, + ["ahiragana"]=12354, + ["ahookabove"]=7843, + ["aibengali"]=2448, + ["aibopomofo"]=12574, + ["aideva"]=2320, + ["aiecyrillic"]=1237, + ["aigujarati"]=2704, + ["aigurmukhi"]=2576, + ["aimatragurmukhi"]=2632, + ["ainarabic"]=1593, + ["ainfinalarabic"]=65226, + ["aininitialarabic"]=65227, + ["ainmedialarabic"]=65228, + ["ainvertedbreve"]=515, + ["aivowelsignbengali"]=2504, + ["aivowelsigndeva"]=2376, + ["aivowelsigngujarati"]=2760, + ["akatakana"]=12450, + ["akatakanahalfwidth"]=65393, + ["akorean"]=12623, + ["alefarabic"]=1575, + ["alefdageshhebrew"]=64304, + ["aleffinalarabic"]=65166, + ["alefhamzaabovearabic"]=1571, + ["alefhamzaabovefinalarabic"]=65156, + ["alefhamzabelowarabic"]=1573, + ["alefhamzabelowfinalarabic"]=65160, + ["alefhebrew"]=1488, + ["aleflamedhebrew"]=64335, + ["alefmaddaabovearabic"]=1570, + ["alefmaddaabovefinalarabic"]=65154, + ["alefmaksuraarabic"]=1609, + ["alefmaksurafinalarabic"]=65264, + ["alefpatahhebrew"]=64302, + ["alefqamatshebrew"]=64303, + ["aleph"]=8501, + ["allequal"]=8780, + ["alpha"]=945, + ["alphatonos"]=940, + ["amacron"]=257, + ["amonospace"]=65345, + ["ampersand"]=38, + ["ampersandmonospace"]=65286, + ["amsquare"]=13250, + ["anbopomofo"]=12578, + ["angbopomofo"]=12580, + ["angkhankhuthai"]=3674, + ["angle"]=8736, + ["anglebracketleft"]=12296, + ["anglebracketleftvertical"]=65087, + ["anglebracketright"]=12297, + ["anglebracketrightvertical"]=65088, + ["angleleft"]=9001, + ["angleright"]=9002, + ["angstrom"]=8491, + ["anoteleia"]=903, + ["anudattadeva"]=2386, + ["anusvarabengali"]=2434, + ["anusvaradeva"]=2306, + ["anusvaragujarati"]=2690, + ["aogonek"]=261, + ["apaatosquare"]=13056, + ["aparen"]=9372, + ["apostrophearmenian"]=1370, + ["apostrophemod"]=700, + ["apple"]=63743, + ["approaches"]=8784, + ["approxequal"]=8776, + ["approxequalorimage"]=8786, + ["araeaekorean"]=12686, + ["araeakorean"]=12685, + ["arc"]=8978, + ["arighthalfring"]=7834, + ["aring"]=229, + ["aringacute"]=507, + ["aringbelow"]=7681, + ["arrowboth"]=8596, + ["arrowdashdown"]=8675, + ["arrowdashleft"]=8672, + ["arrowdashright"]=8674, + ["arrowdashup"]=8673, + ["arrowdbldown"]=8659, + ["arrowdblup"]=8657, + ["arrowdown"]=8595, + ["arrowdownleft"]=8601, + ["arrowdownright"]=8600, + ["arrowdownwhite"]=8681, + ["arrowheaddownmod"]=709, + ["arrowheadleftmod"]=706, + ["arrowheadrightmod"]=707, + ["arrowheadupmod"]=708, + ["arrowleft"]=8592, + ["arrowleftdbl"]=8656, + ["arrowleftdblstroke"]=8653, + ["arrowleftoverright"]=8646, + ["arrowleftwhite"]=8678, + ["arrowright"]=8594, + ["arrowrightdblstroke"]=8655, + ["arrowrightheavy"]=10142, + ["arrowrightoverleft"]=8644, + ["arrowrightwhite"]=8680, + ["arrowtableft"]=8676, + ["arrowtabright"]=8677, + ["arrowup"]=8593, + ["arrowupdn"]=8597, + ["arrowupdownbase"]=8616, + ["arrowupleft"]=8598, + ["arrowupleftofdown"]=8645, + ["arrowupright"]=8599, + ["arrowupwhite"]=8679, + ["asciicircum"]=94, + ["asciicircummonospace"]=65342, + ["asciitilde"]=126, + ["asciitildemonospace"]=65374, + ["ascript"]=593, + ["ascriptturned"]=594, + ["asmallhiragana"]=12353, + ["asmallkatakana"]=12449, + ["asmallkatakanahalfwidth"]=65383, + ["asterisk"]=42, + ["asteriskarabic"]=1645, + ["asteriskmath"]=8727, + ["asteriskmonospace"]=65290, + ["asterisksmall"]=65121, + ["asterism"]=8258, + ["asymptoticallyequal"]=8771, + ["at"]=64, + ["atilde"]=227, + ["atmonospace"]=65312, + ["atsmall"]=65131, + ["aturned"]=592, + ["aubengali"]=2452, + ["aubopomofo"]=12576, + ["audeva"]=2324, + ["augujarati"]=2708, + ["augurmukhi"]=2580, + ["aulengthmarkbengali"]=2519, + ["aumatragurmukhi"]=2636, + ["auvowelsignbengali"]=2508, + ["auvowelsigndeva"]=2380, + ["auvowelsigngujarati"]=2764, + ["avagrahadeva"]=2365, + ["aybarmenian"]=1377, + ["ayinaltonehebrew"]=64288, + ["ayinhebrew"]=1506, + ["b"]=98, + ["babengali"]=2476, + ["backslash"]=92, + ["backslashmonospace"]=65340, + ["badeva"]=2348, + ["bagujarati"]=2732, + ["bagurmukhi"]=2604, + ["bahiragana"]=12400, + ["bahtthai"]=3647, + ["bakatakana"]=12496, + ["barmonospace"]=65372, + ["bbopomofo"]=12549, + ["bcircle"]=9425, + ["bdotaccent"]=7683, + ["bdotbelow"]=7685, + ["beamedsixteenthnotes"]=9836, + ["because"]=8757, + ["becyrillic"]=1073, + ["beharabic"]=1576, + ["behfinalarabic"]=65168, + ["behinitialarabic"]=65169, + ["behiragana"]=12409, + ["behmedialarabic"]=65170, + ["behmeeminitialarabic"]=64671, + ["behmeemisolatedarabic"]=64520, + ["behnoonfinalarabic"]=64621, + ["bekatakana"]=12505, + ["benarmenian"]=1378, + ["beta"]=946, + ["betasymbolgreek"]=976, + ["betdageshhebrew"]=64305, + ["bethebrew"]=1489, + ["betrafehebrew"]=64332, + ["bhabengali"]=2477, + ["bhadeva"]=2349, + ["bhagujarati"]=2733, + ["bhagurmukhi"]=2605, + ["bhook"]=595, + ["bihiragana"]=12403, + ["bikatakana"]=12499, + ["bilabialclick"]=664, + ["bindigurmukhi"]=2562, + ["birusquare"]=13105, + ["blackcircle"]=9679, + ["blackdiamond"]=9670, + ["blackleftpointingtriangle"]=9664, + ["blacklenticularbracketleft"]=12304, + ["blacklenticularbracketleftvertical"]=65083, + ["blacklenticularbracketright"]=12305, + ["blacklenticularbracketrightvertical"]=65084, + ["blacklowerlefttriangle"]=9699, + ["blacklowerrighttriangle"]=9698, + ["blackrightpointingtriangle"]=9654, + ["blacksmallsquare"]=9642, + ["blackstar"]=9733, + ["blackupperlefttriangle"]=9700, + ["blackupperrighttriangle"]=9701, + ["blackuppointingsmalltriangle"]=9652, + ["blank"]=9251, + ["blinebelow"]=7687, + ["block"]=9608, + ["bmonospace"]=65346, + ["bobaimaithai"]=3610, + ["bohiragana"]=12412, + ["bokatakana"]=12508, + ["bparen"]=9373, + ["bqsquare"]=13251, + ["braceleft"]=123, + ["braceleftmonospace"]=65371, + ["braceleftsmall"]=65115, + ["braceleftvertical"]=65079, + ["braceright"]=125, + ["bracerightmonospace"]=65373, + ["bracerightsmall"]=65116, + ["bracerightvertical"]=65080, + ["bracketleft"]=91, + ["bracketleftmonospace"]=65339, + ["bracketright"]=93, + ["bracketrightmonospace"]=65341, + ["breve"]=728, + ["brevebelowcmb"]=814, + ["brevecmb"]=774, + ["breveinvertedbelowcmb"]=815, + ["breveinvertedcmb"]=785, + ["breveinverteddoublecmb"]=865, + ["bridgebelowcmb"]=810, + ["bridgeinvertedbelowcmb"]=826, + ["brokenbar"]=166, + ["bstroke"]=384, + ["btopbar"]=387, + ["buhiragana"]=12406, + ["bukatakana"]=12502, + ["bullet"]=8226, + ["bulletoperator"]=8729, + ["bullseye"]=9678, + ["c"]=99, + ["caarmenian"]=1390, + ["cabengali"]=2458, + ["cacute"]=263, + ["cadeva"]=2330, + ["cagujarati"]=2714, + ["cagurmukhi"]=2586, + ["calsquare"]=13192, + ["candrabindubengali"]=2433, + ["candrabinducmb"]=784, + ["candrabindudeva"]=2305, + ["candrabindugujarati"]=2689, + ["capslock"]=8682, + ["careof"]=8453, + ["caron"]=711, + ["caronbelowcmb"]=812, + ["caroncmb"]=780, + ["carriagereturn"]=8629, + ["cbopomofo"]=12568, + ["ccaron"]=269, + ["ccedilla"]=231, + ["ccedillaacute"]=7689, + ["ccircle"]=9426, + ["ccircumflex"]=265, + ["ccurl"]=597, + ["cdotaccent"]=267, + ["cdsquare"]=13253, + ["cedilla"]=184, + ["cedillacmb"]=807, + ["cent"]=162, + ["centigrade"]=8451, + ["centmonospace"]=65504, + ["chaarmenian"]=1401, + ["chabengali"]=2459, + ["chadeva"]=2331, + ["chagujarati"]=2715, + ["chagurmukhi"]=2587, + ["chbopomofo"]=12564, + ["cheabkhasiancyrillic"]=1213, + ["checkmark"]=10003, + ["checyrillic"]=1095, + ["chedescenderabkhasiancyrillic"]=1215, + ["chedescendercyrillic"]=1207, + ["chedieresiscyrillic"]=1269, + ["cheharmenian"]=1395, + ["chekhakassiancyrillic"]=1228, + ["cheverticalstrokecyrillic"]=1209, + ["chi"]=967, + ["chieuchacirclekorean"]=12919, + ["chieuchaparenkorean"]=12823, + ["chieuchcirclekorean"]=12905, + ["chieuchkorean"]=12618, + ["chieuchparenkorean"]=12809, + ["chochangthai"]=3594, + ["chochanthai"]=3592, + ["chochingthai"]=3593, + ["chochoethai"]=3596, + ["chook"]=392, + ["cieucacirclekorean"]=12918, + ["cieucaparenkorean"]=12822, + ["cieuccirclekorean"]=12904, + ["cieuckorean"]=12616, + ["cieucparenkorean"]=12808, + ["cieucuparenkorean"]=12828, + ["circleot"]=8857, + ["circlepostalmark"]=12342, + ["circlewithlefthalfblack"]=9680, + ["circlewithrighthalfblack"]=9681, + ["circumflex"]=710, + ["circumflexbelowcmb"]=813, + ["circumflexcmb"]=770, + ["clear"]=8999, + ["clickalveolar"]=450, + ["clickdental"]=448, + ["clicklateral"]=449, + ["clickretroflex"]=451, + ["clubsuitblack"]=9827, + ["clubsuitwhite"]=9831, + ["cmcubedsquare"]=13220, + ["cmonospace"]=65347, + ["cmsquaredsquare"]=13216, + ["coarmenian"]=1409, + ["colon"]=58, + ["colonmonospace"]=65306, + ["colonsign"]=8353, + ["colonsmall"]=65109, + ["colontriangularhalfmod"]=721, + ["colontriangularmod"]=720, + ["comma"]=44, + ["commaabovecmb"]=787, + ["commaaboverightcmb"]=789, + ["commaarabic"]=1548, + ["commaarmenian"]=1373, + ["commamonospace"]=65292, + ["commareversedabovecmb"]=788, + ["commareversedmod"]=701, + ["commasmall"]=65104, + ["commaturnedabovecmb"]=786, + ["commaturnedmod"]=699, + ["congruent"]=8773, + ["contourintegral"]=8750, + ["control"]=8963, + ["controlACK"]=6, + ["controlBEL"]=7, + ["controlBS"]=8, + ["controlCAN"]=24, + ["controlCR"]=13, + ["controlDC1"]=17, + ["controlDC2"]=18, + ["controlDC3"]=19, + ["controlDC4"]=20, + ["controlDEL"]=127, + ["controlDLE"]=16, + ["controlEM"]=25, + ["controlENQ"]=5, + ["controlEOT"]=4, + ["controlESC"]=27, + ["controlETB"]=23, + ["controlETX"]=3, + ["controlFF"]=12, + ["controlFS"]=28, + ["controlGS"]=29, + ["controlHT"]=9, + ["controlLF"]=10, + ["controlNAK"]=21, + ["controlRS"]=30, + ["controlSI"]=15, + ["controlSO"]=14, + ["controlSOT"]=2, + ["controlSTX"]=1, + ["controlSUB"]=26, + ["controlSYN"]=22, + ["controlUS"]=31, + ["controlVT"]=11, + ["copyright"]=169, + ["cornerbracketleft"]=12300, + ["cornerbracketlefthalfwidth"]=65378, + ["cornerbracketleftvertical"]=65089, + ["cornerbracketright"]=12301, + ["cornerbracketrighthalfwidth"]=65379, + ["cornerbracketrightvertical"]=65090, + ["corporationsquare"]=13183, + ["cosquare"]=13255, + ["coverkgsquare"]=13254, + ["cparen"]=9374, + ["cruzeiro"]=8354, + ["cstretched"]=663, + ["curlyand"]=8911, + ["curlyor"]=8910, + ["currency"]=164, + ["d"]=100, + ["daarmenian"]=1380, + ["dabengali"]=2470, + ["dadarabic"]=1590, + ["dadeva"]=2342, + ["dadfinalarabic"]=65214, + ["dadinitialarabic"]=65215, + ["dadmedialarabic"]=65216, + ["dageshhebrew"]=1468, + ["dagger"]=8224, + ["daggerdbl"]=8225, + ["dagujarati"]=2726, + ["dagurmukhi"]=2598, + ["dahiragana"]=12384, + ["dakatakana"]=12480, + ["dalarabic"]=1583, + ["daletdageshhebrew"]=64307, + ["dalettserehebrew"]=1491, + ["dalfinalarabic"]=65194, + ["dammalowarabic"]=1615, + ["dammatanarabic"]=1612, + ["danda"]=2404, + ["dargalefthebrew"]=1447, + ["dasiapneumatacyrilliccmb"]=1157, + ["dblanglebracketleft"]=12298, + ["dblanglebracketleftvertical"]=65085, + ["dblanglebracketright"]=12299, + ["dblanglebracketrightvertical"]=65086, + ["dblarchinvertedbelowcmb"]=811, + ["dblarrowleft"]=8660, + ["dblarrowright"]=8658, + ["dbldanda"]=2405, + ["dblgravecmb"]=783, + ["dblintegral"]=8748, + ["dbllowlinecmb"]=819, + ["dbloverlinecmb"]=831, + ["dblprimemod"]=698, + ["dblverticalbar"]=8214, + ["dblverticallineabovecmb"]=782, + ["dbopomofo"]=12553, + ["dbsquare"]=13256, + ["dcaron"]=271, + ["dcedilla"]=7697, + ["dcircle"]=9427, + ["dcircumflexbelow"]=7699, + ["ddabengali"]=2465, + ["ddadeva"]=2337, + ["ddagujarati"]=2721, + ["ddagurmukhi"]=2593, + ["ddalarabic"]=1672, + ["ddalfinalarabic"]=64393, + ["dddhadeva"]=2396, + ["ddhabengali"]=2466, + ["ddhadeva"]=2338, + ["ddhagujarati"]=2722, + ["ddhagurmukhi"]=2594, + ["ddotaccent"]=7691, + ["ddotbelow"]=7693, + ["decimalseparatorpersian"]=1643, + ["decyrillic"]=1076, + ["degree"]=176, + ["dehihebrew"]=1453, + ["dehiragana"]=12391, + ["deicoptic"]=1007, + ["dekatakana"]=12487, + ["deleteleft"]=9003, + ["deleteright"]=8998, + ["delta"]=948, + ["deltaturned"]=397, + ["denominatorminusonenumeratorbengali"]=2552, + ["dezh"]=676, + ["dhabengali"]=2471, + ["dhadeva"]=2343, + ["dhagujarati"]=2727, + ["dhagurmukhi"]=2599, + ["dhook"]=599, + ["dialytikatonoscmb"]=836, + ["diamond"]=9830, + ["diamondsuitwhite"]=9826, + ["dieresis"]=168, + ["dieresisbelowcmb"]=804, + ["dieresiscmb"]=776, + ["dieresistonos"]=901, + ["dihiragana"]=12386, + ["dikatakana"]=12482, + ["dittomark"]=12291, + ["divide"]=247, + ["divides"]=8739, + ["divisionslash"]=8725, + ["djecyrillic"]=1106, + ["dlinebelow"]=7695, + ["dlsquare"]=13207, + ["dmacron"]=273, + ["dmonospace"]=65348, + ["dnblock"]=9604, + ["dochadathai"]=3598, + ["dodekthai"]=3604, + ["dohiragana"]=12393, + ["dokatakana"]=12489, + ["dollar"]=36, + ["dollarmonospace"]=65284, + ["dollarsmall"]=65129, + ["dong"]=8363, + ["dorusquare"]=13094, + ["dotaccent"]=729, + ["dotaccentcmb"]=775, + ["dotbelowcomb"]=803, + ["dotkatakana"]=12539, + ["dotlessi"]=305, + ["dotlessjstrokehook"]=644, + ["dotmath"]=8901, + ["dottedcircle"]=9676, + ["downtackbelowcmb"]=798, + ["downtackmod"]=725, + ["dparen"]=9375, + ["dtail"]=598, + ["dtopbar"]=396, + ["duhiragana"]=12389, + ["dukatakana"]=12485, + ["dz"]=499, + ["dzaltone"]=675, + ["dzcaron"]=454, + ["dzcurl"]=677, + ["dzeabkhasiancyrillic"]=1249, + ["dzecyrillic"]=1109, + ["dzhecyrillic"]=1119, + ["e"]=101, + ["eacute"]=233, + ["earth"]=9793, + ["ebengali"]=2447, + ["ebopomofo"]=12572, + ["ebreve"]=277, + ["ecandradeva"]=2317, + ["ecandragujarati"]=2701, + ["ecandravowelsigndeva"]=2373, + ["ecandravowelsigngujarati"]=2757, + ["ecaron"]=283, + ["ecedillabreve"]=7709, + ["echarmenian"]=1381, + ["echyiwnarmenian"]=1415, + ["ecircle"]=9428, + ["ecircumflex"]=234, + ["ecircumflexacute"]=7871, + ["ecircumflexbelow"]=7705, + ["ecircumflexdotbelow"]=7879, + ["ecircumflexgrave"]=7873, + ["ecircumflexhookabove"]=7875, + ["ecircumflextilde"]=7877, + ["ecyrillic"]=1108, + ["edblgrave"]=517, + ["edeva"]=2319, + ["edieresis"]=235, + ["edotaccent"]=279, + ["edotbelow"]=7865, + ["eegurmukhi"]=2575, + ["eematragurmukhi"]=2631, + ["efcyrillic"]=1092, + ["egrave"]=232, + ["egujarati"]=2703, + ["eharmenian"]=1383, + ["ehbopomofo"]=12573, + ["ehiragana"]=12360, + ["ehookabove"]=7867, + ["eibopomofo"]=12575, + ["eight"]=56, + ["eightbengali"]=2542, + ["eightcircle"]=9319, + ["eightcircleinversesansserif"]=10129, + ["eightdeva"]=2414, + ["eighteencircle"]=9329, + ["eighteenparen"]=9349, + ["eighteenperiod"]=9369, + ["eightgujarati"]=2798, + ["eightgurmukhi"]=2670, + ["eighthackarabic"]=1640, + ["eighthangzhou"]=12328, + ["eightideographicparen"]=12839, + ["eightinferior"]=8328, + ["eightmonospace"]=65304, + ["eightparen"]=9339, + ["eightperiod"]=9359, + ["eightpersian"]=1784, + ["eightroman"]=8567, + ["eightsuperior"]=8312, + ["eightthai"]=3672, + ["einvertedbreve"]=519, + ["eiotifiedcyrillic"]=1125, + ["ekatakana"]=12456, + ["ekatakanahalfwidth"]=65396, + ["ekonkargurmukhi"]=2676, + ["ekorean"]=12628, + ["elcyrillic"]=1083, + ["element"]=8712, + ["elevencircle"]=9322, + ["elevenparen"]=9342, + ["elevenperiod"]=9362, + ["elevenroman"]=8570, + ["ellipsis"]=8230, + ["ellipsisvertical"]=8942, + ["emacron"]=275, + ["emacronacute"]=7703, + ["emacrongrave"]=7701, + ["emcyrillic"]=1084, + ["emdash"]=8212, + ["emdashvertical"]=65073, + ["emonospace"]=65349, + ["emphasismarkarmenian"]=1371, + ["emptyset"]=8709, + ["enbopomofo"]=12579, + ["encyrillic"]=1085, + ["endash"]=8211, + ["endashvertical"]=65074, + ["endescendercyrillic"]=1187, + ["eng"]=331, + ["engbopomofo"]=12581, + ["enghecyrillic"]=1189, + ["enhookcyrillic"]=1224, + ["enspace"]=8194, + ["eogonek"]=281, + ["eokorean"]=12627, + ["eopen"]=603, + ["eopenclosed"]=666, + ["eopenreversed"]=604, + ["eopenreversedclosed"]=606, + ["eopenreversedhook"]=605, + ["eparen"]=9376, + ["epsilon"]=949, + ["epsilontonos"]=941, + ["equal"]=61, + ["equalmonospace"]=65309, + ["equalsmall"]=65126, + ["equalsuperior"]=8316, + ["equivalence"]=8801, + ["erbopomofo"]=12582, + ["ercyrillic"]=1088, + ["ereversed"]=600, + ["ereversedcyrillic"]=1101, + ["escyrillic"]=1089, + ["esdescendercyrillic"]=1195, + ["esh"]=643, + ["eshcurl"]=646, + ["eshortdeva"]=2318, + ["eshortvowelsigndeva"]=2374, + ["eshreversedloop"]=426, + ["eshsquatreversed"]=645, + ["esmallhiragana"]=12359, + ["esmallkatakana"]=12455, + ["esmallkatakanahalfwidth"]=65386, + ["estimated"]=8494, + ["eta"]=951, + ["etarmenian"]=1384, + ["etatonos"]=942, + ["eth"]=240, + ["etilde"]=7869, + ["etildebelow"]=7707, + ["etnahtalefthebrew"]=1425, + ["eturned"]=477, + ["eukorean"]=12641, + ["euro"]=8364, + ["evowelsignbengali"]=2503, + ["evowelsigndeva"]=2375, + ["evowelsigngujarati"]=2759, + ["exclam"]=33, + ["exclamarmenian"]=1372, + ["exclamdbl"]=8252, + ["exclamdown"]=161, + ["exclammonospace"]=65281, + ["ezh"]=658, + ["ezhcaron"]=495, + ["ezhcurl"]=659, + ["ezhreversed"]=441, + ["ezhtail"]=442, + ["f"]=102, + ["fadeva"]=2398, + ["fagurmukhi"]=2654, + ["fahrenheit"]=8457, + ["fathalowarabic"]=1614, + ["fathatanarabic"]=1611, + ["fbopomofo"]=12552, + ["fcircle"]=9429, + ["fdotaccent"]=7711, + ["feharabic"]=1601, + ["feharmenian"]=1414, + ["fehfinalarabic"]=65234, + ["fehinitialarabic"]=65235, + ["fehmedialarabic"]=65236, + ["feicoptic"]=997, + ["ff"]=64256, + ["ffi"]=64259, + ["ffl"]=64260, + ["fi"]=64257, + ["fifteencircle"]=9326, + ["fifteenparen"]=9346, + ["fifteenperiod"]=9366, + ["figuredash"]=8210, + ["filledbox"]=9632, + ["filledrect"]=9644, + ["finalkafdageshhebrew"]=64314, + ["finalkafshevahebrew"]=1498, + ["finalmemhebrew"]=1501, + ["finalnunhebrew"]=1503, + ["finalpehebrew"]=1507, + ["finaltsadihebrew"]=1509, + ["firsttonechinese"]=713, + ["fisheye"]=9673, + ["fitacyrillic"]=1139, + ["five"]=53, + ["fivebengali"]=2539, + ["fivecircle"]=9316, + ["fivecircleinversesansserif"]=10126, + ["fivedeva"]=2411, + ["fiveeighths"]=8541, + ["fivegujarati"]=2795, + ["fivegurmukhi"]=2667, + ["fivehackarabic"]=1637, + ["fivehangzhou"]=12325, + ["fiveideographicparen"]=12836, + ["fiveinferior"]=8325, + ["fivemonospace"]=65301, + ["fiveparen"]=9336, + ["fiveperiod"]=9356, + ["fivepersian"]=1781, + ["fiveroman"]=8564, + ["fivesuperior"]=8309, + ["fivethai"]=3669, + ["fl"]=64258, + ["florin"]=402, + ["fmonospace"]=65350, + ["fmsquare"]=13209, + ["fofanthai"]=3615, + ["fofathai"]=3613, + ["fongmanthai"]=3663, + ["four"]=52, + ["fourbengali"]=2538, + ["fourcircle"]=9315, + ["fourcircleinversesansserif"]=10125, + ["fourdeva"]=2410, + ["fourgujarati"]=2794, + ["fourgurmukhi"]=2666, + ["fourhackarabic"]=1636, + ["fourhangzhou"]=12324, + ["fourideographicparen"]=12835, + ["fourinferior"]=8324, + ["fourmonospace"]=65300, + ["fournumeratorbengali"]=2551, + ["fourparen"]=9335, + ["fourperiod"]=9355, + ["fourpersian"]=1780, + ["fourroman"]=8563, + ["foursuperior"]=8308, + ["fourteencircle"]=9325, + ["fourteenparen"]=9345, + ["fourteenperiod"]=9365, + ["fourthai"]=3668, + ["fourthtonechinese"]=715, + ["fparen"]=9377, + ["fraction"]=8260, + ["franc"]=8355, + ["g"]=103, + ["gabengali"]=2455, + ["gacute"]=501, + ["gadeva"]=2327, + ["gafarabic"]=1711, + ["gaffinalarabic"]=64403, + ["gafinitialarabic"]=64404, + ["gafmedialarabic"]=64405, + ["gagujarati"]=2711, + ["gagurmukhi"]=2583, + ["gahiragana"]=12364, + ["gakatakana"]=12460, + ["gamma"]=947, + ["gammalatinsmall"]=611, + ["gammasuperior"]=736, + ["gangiacoptic"]=1003, + ["gbopomofo"]=12557, + ["gbreve"]=287, + ["gcaron"]=487, + ["gcircle"]=9430, + ["gcircumflex"]=285, + ["gcommaaccent"]=291, + ["gdotaccent"]=289, + ["gecyrillic"]=1075, + ["gehiragana"]=12370, + ["gekatakana"]=12466, + ["geometricallyequal"]=8785, + ["gereshaccenthebrew"]=1436, + ["gereshhebrew"]=1523, + ["gereshmuqdamhebrew"]=1437, + ["germandbls"]=223, + ["gershayimaccenthebrew"]=1438, + ["gershayimhebrew"]=1524, + ["getamark"]=12307, + ["ghabengali"]=2456, + ["ghadarmenian"]=1394, + ["ghadeva"]=2328, + ["ghagujarati"]=2712, + ["ghagurmukhi"]=2584, + ["ghainarabic"]=1594, + ["ghainfinalarabic"]=65230, + ["ghaininitialarabic"]=65231, + ["ghainmedialarabic"]=65232, + ["ghemiddlehookcyrillic"]=1173, + ["ghestrokecyrillic"]=1171, + ["gheupturncyrillic"]=1169, + ["ghhadeva"]=2394, + ["ghhagurmukhi"]=2650, + ["ghook"]=608, + ["ghzsquare"]=13203, + ["gihiragana"]=12366, + ["gikatakana"]=12462, + ["gimarmenian"]=1379, + ["gimeldageshhebrew"]=64306, + ["gimelhebrew"]=1490, + ["gjecyrillic"]=1107, + ["glottalinvertedstroke"]=446, + ["glottalstop"]=660, + ["glottalstopinverted"]=662, + ["glottalstopmod"]=704, + ["glottalstopreversed"]=661, + ["glottalstopreversedmod"]=705, + ["glottalstopreversedsuperior"]=740, + ["glottalstopstroke"]=673, + ["glottalstopstrokereversed"]=674, + ["gmacron"]=7713, + ["gmonospace"]=65351, + ["gohiragana"]=12372, + ["gokatakana"]=12468, + ["gparen"]=9378, + ["gpasquare"]=13228, + ["grave"]=96, + ["gravebelowcmb"]=790, + ["gravecomb"]=768, + ["gravedeva"]=2387, + ["gravelowmod"]=718, + ["gravemonospace"]=65344, + ["gravetonecmb"]=832, + ["greater"]=62, + ["greaterequal"]=8805, + ["greaterequalorless"]=8923, + ["greatermonospace"]=65310, + ["greaterorequivalent"]=8819, + ["greaterorless"]=8823, + ["greateroverequal"]=8807, + ["greatersmall"]=65125, + ["gscript"]=609, + ["gstroke"]=485, + ["guhiragana"]=12368, + ["guillemotleft"]=171, + ["guillemotright"]=187, + ["guilsinglleft"]=8249, + ["guilsinglright"]=8250, + ["gukatakana"]=12464, + ["guramusquare"]=13080, + ["gysquare"]=13257, + ["h"]=104, + ["haabkhasiancyrillic"]=1193, + ["habengali"]=2489, + ["hadescendercyrillic"]=1203, + ["hadeva"]=2361, + ["hagujarati"]=2745, + ["hagurmukhi"]=2617, + ["haharabic"]=1581, + ["hahfinalarabic"]=65186, + ["hahinitialarabic"]=65187, + ["hahiragana"]=12399, + ["hahmedialarabic"]=65188, + ["haitusquare"]=13098, + ["hakatakana"]=12495, + ["hakatakanahalfwidth"]=65418, + ["halantgurmukhi"]=2637, + ["hamzasukunarabic"]=1569, + ["hangulfiller"]=12644, + ["hardsigncyrillic"]=1098, + ["harpoonleftbarbup"]=8636, + ["harpoonrightbarbup"]=8640, + ["hasquare"]=13258, + ["hatafpatahwidehebrew"]=1458, + ["hatafqamatswidehebrew"]=1459, + ["hatafsegolwidehebrew"]=1457, + ["hbar"]=295, + ["hbopomofo"]=12559, + ["hbrevebelow"]=7723, + ["hcedilla"]=7721, + ["hcircle"]=9431, + ["hcircumflex"]=293, + ["hdieresis"]=7719, + ["hdotaccent"]=7715, + ["hdotbelow"]=7717, + ["heartsuitblack"]=9829, + ["heartsuitwhite"]=9825, + ["hedageshhebrew"]=64308, + ["hehaltonearabic"]=1729, + ["heharabic"]=1607, + ["hehebrew"]=1492, + ["hehfinalaltonearabic"]=64423, + ["hehfinalarabic"]=65258, + ["hehhamzaabovefinalarabic"]=64421, + ["hehhamzaaboveisolatedarabic"]=64420, + ["hehinitialaltonearabic"]=64424, + ["hehinitialarabic"]=65259, + ["hehiragana"]=12408, + ["hehmedialaltonearabic"]=64425, + ["hehmedialarabic"]=65260, + ["heiseierasquare"]=13179, + ["hekatakana"]=12504, + ["hekatakanahalfwidth"]=65421, + ["hekutaarusquare"]=13110, + ["henghook"]=615, + ["herutusquare"]=13113, + ["hethebrew"]=1495, + ["hhook"]=614, + ["hhooksuperior"]=689, + ["hieuhacirclekorean"]=12923, + ["hieuhaparenkorean"]=12827, + ["hieuhcirclekorean"]=12909, + ["hieuhkorean"]=12622, + ["hieuhparenkorean"]=12813, + ["hihiragana"]=12402, + ["hikatakana"]=12498, + ["hikatakanahalfwidth"]=65419, + ["hiriqwidehebrew"]=1460, + ["hlinebelow"]=7830, + ["hmonospace"]=65352, + ["hoarmenian"]=1392, + ["hohipthai"]=3627, + ["hohiragana"]=12411, + ["hokatakana"]=12507, + ["hokatakanahalfwidth"]=65422, + ["holamwidehebrew"]=1465, + ["honokhukthai"]=3630, + ["hookcmb"]=777, + ["hookpalatalizedbelowcmb"]=801, + ["hookretroflexbelowcmb"]=802, + ["hoonsquare"]=13122, + ["horicoptic"]=1001, + ["horizontalbar"]=8213, + ["horncmb"]=795, + ["hotsprings"]=9832, + ["house"]=8962, + ["hparen"]=9379, + ["hsuperior"]=688, + ["hturned"]=613, + ["huhiragana"]=12405, + ["huiitosquare"]=13107, + ["hukatakana"]=12501, + ["hukatakanahalfwidth"]=65420, + ["hungarumlaut"]=733, + ["hungarumlautcmb"]=779, + ["hv"]=405, + ["hyphen"]=45, + ["hyphenmonospace"]=65293, + ["hyphensmall"]=65123, + ["hyphentwo"]=8208, + ["i"]=105, + ["iacute"]=237, + ["iacyrillic"]=1103, + ["ibengali"]=2439, + ["ibopomofo"]=12583, + ["ibreve"]=301, + ["icaron"]=464, + ["icircle"]=9432, + ["icircumflex"]=238, + ["icyrillic"]=1110, + ["idblgrave"]=521, + ["ideographearthcircle"]=12943, + ["ideographfirecircle"]=12939, + ["ideographicallianceparen"]=12863, + ["ideographiccallparen"]=12858, + ["ideographiccentrecircle"]=12965, + ["ideographicclose"]=12294, + ["ideographiccomma"]=12289, + ["ideographiccommaleft"]=65380, + ["ideographiccongratulationparen"]=12855, + ["ideographiccorrectcircle"]=12963, + ["ideographicearthparen"]=12847, + ["ideographicenterpriseparen"]=12861, + ["ideographicexcellentcircle"]=12957, + ["ideographicfestivalparen"]=12864, + ["ideographicfinancialcircle"]=12950, + ["ideographicfinancialparen"]=12854, + ["ideographicfireparen"]=12843, + ["ideographichaveparen"]=12850, + ["ideographichighcircle"]=12964, + ["ideographiciterationmark"]=12293, + ["ideographiclaborcircle"]=12952, + ["ideographiclaborparen"]=12856, + ["ideographicleftcircle"]=12967, + ["ideographiclowcircle"]=12966, + ["ideographicmedicinecircle"]=12969, + ["ideographicmetalparen"]=12846, + ["ideographicmoonparen"]=12842, + ["ideographicnameparen"]=12852, + ["ideographicperiod"]=12290, + ["ideographicprintcircle"]=12958, + ["ideographicreachparen"]=12867, + ["ideographicrepresentparen"]=12857, + ["ideographicresourceparen"]=12862, + ["ideographicrightcircle"]=12968, + ["ideographicsecretcircle"]=12953, + ["ideographicselfparen"]=12866, + ["ideographicsocietyparen"]=12851, + ["ideographicspace"]=12288, + ["ideographicspecialparen"]=12853, + ["ideographicstockparen"]=12849, + ["ideographicstudyparen"]=12859, + ["ideographicsunparen"]=12848, + ["ideographicsuperviseparen"]=12860, + ["ideographicwaterparen"]=12844, + ["ideographicwoodparen"]=12845, + ["ideographiczero"]=12295, + ["ideographmetalcircle"]=12942, + ["ideographmooncircle"]=12938, + ["ideographnamecircle"]=12948, + ["ideographsuncircle"]=12944, + ["ideographwatercircle"]=12940, + ["ideographwoodcircle"]=12941, + ["ideva"]=2311, + ["idieresis"]=239, + ["idieresisacute"]=7727, + ["idieresiscyrillic"]=1253, + ["idotbelow"]=7883, + ["iebrevecyrillic"]=1239, + ["iecyrillic"]=1077, + ["ieungacirclekorean"]=12917, + ["ieungaparenkorean"]=12821, + ["ieungcirclekorean"]=12903, + ["ieungkorean"]=12615, + ["ieungparenkorean"]=12807, + ["igrave"]=236, + ["igujarati"]=2695, + ["igurmukhi"]=2567, + ["ihiragana"]=12356, + ["ihookabove"]=7881, + ["iibengali"]=2440, + ["iicyrillic"]=1080, + ["iideva"]=2312, + ["iigujarati"]=2696, + ["iigurmukhi"]=2568, + ["iimatragurmukhi"]=2624, + ["iinvertedbreve"]=523, + ["iishortcyrillic"]=1081, + ["iivowelsignbengali"]=2496, + ["iivowelsigndeva"]=2368, + ["iivowelsigngujarati"]=2752, + ["ij"]=307, + ["ikatakana"]=12452, + ["ikatakanahalfwidth"]=65394, + ["ikorean"]=12643, + ["iluyhebrew"]=1452, + ["imacron"]=299, + ["imacroncyrillic"]=1251, + ["imageorapproximatelyequal"]=8787, + ["imatragurmukhi"]=2623, + ["imonospace"]=65353, + ["increment"]=8710, + ["infinity"]=8734, + ["iniarmenian"]=1387, + ["integral"]=8747, + ["integralbt"]=8993, + ["integraltp"]=8992, + ["intersection"]=8745, + ["intisquare"]=13061, + ["invbullet"]=9688, + ["invsmileface"]=9787, + ["iocyrillic"]=1105, + ["iogonek"]=303, + ["iota"]=953, + ["iotadieresis"]=970, + ["iotadieresistonos"]=912, + ["iotalatin"]=617, + ["iotatonos"]=943, + ["iparen"]=9380, + ["irigurmukhi"]=2674, + ["ismallhiragana"]=12355, + ["ismallkatakana"]=12451, + ["ismallkatakanahalfwidth"]=65384, + ["issharbengali"]=2554, + ["istroke"]=616, + ["iterationhiragana"]=12445, + ["iterationkatakana"]=12541, + ["itilde"]=297, + ["itildebelow"]=7725, + ["iubopomofo"]=12585, + ["iucyrillic"]=1102, + ["ivowelsignbengali"]=2495, + ["ivowelsigndeva"]=2367, + ["ivowelsigngujarati"]=2751, + ["izhitsacyrillic"]=1141, + ["izhitsadblgravecyrillic"]=1143, + ["j"]=106, + ["jaarmenian"]=1393, + ["jabengali"]=2460, + ["jadeva"]=2332, + ["jagujarati"]=2716, + ["jagurmukhi"]=2588, + ["jbopomofo"]=12560, + ["jcaron"]=496, + ["jcircle"]=9433, + ["jcircumflex"]=309, + ["jcrossedtail"]=669, + ["jdotlessstroke"]=607, + ["jecyrillic"]=1112, + ["jeemarabic"]=1580, + ["jeemfinalarabic"]=65182, + ["jeeminitialarabic"]=65183, + ["jeemmedialarabic"]=65184, + ["jeharabic"]=1688, + ["jehfinalarabic"]=64395, + ["jhabengali"]=2461, + ["jhadeva"]=2333, + ["jhagujarati"]=2717, + ["jhagurmukhi"]=2589, + ["jheharmenian"]=1403, + ["jis"]=12292, + ["jmonospace"]=65354, + ["jparen"]=9381, + ["jsuperior"]=690, + ["k"]=107, + ["kabashkircyrillic"]=1185, + ["kabengali"]=2453, + ["kacute"]=7729, + ["kacyrillic"]=1082, + ["kadescendercyrillic"]=1179, + ["kadeva"]=2325, + ["kafarabic"]=1603, + ["kafdageshhebrew"]=64315, + ["kaffinalarabic"]=65242, + ["kafhebrew"]=1499, + ["kafinitialarabic"]=65243, + ["kafmedialarabic"]=65244, + ["kafrafehebrew"]=64333, + ["kagujarati"]=2709, + ["kagurmukhi"]=2581, + ["kahiragana"]=12363, + ["kahookcyrillic"]=1220, + ["kakatakana"]=12459, + ["kakatakanahalfwidth"]=65398, + ["kappa"]=954, + ["kappasymbolgreek"]=1008, + ["kapyeounmieumkorean"]=12657, + ["kapyeounphieuphkorean"]=12676, + ["kapyeounpieupkorean"]=12664, + ["kapyeounssangpieupkorean"]=12665, + ["karoriisquare"]=13069, + ["kasmallkatakana"]=12533, + ["kasquare"]=13188, + ["kasraarabic"]=1616, + ["kasratanarabic"]=1613, + ["kastrokecyrillic"]=1183, + ["katahiraprolongmarkhalfwidth"]=65392, + ["kaverticalstrokecyrillic"]=1181, + ["kbopomofo"]=12558, + ["kcalsquare"]=13193, + ["kcaron"]=489, + ["kcircle"]=9434, + ["kcommaaccent"]=311, + ["kdotbelow"]=7731, + ["keharmenian"]=1412, + ["kehiragana"]=12369, + ["kekatakana"]=12465, + ["kekatakanahalfwidth"]=65401, + ["kenarmenian"]=1391, + ["kesmallkatakana"]=12534, + ["kgreenlandic"]=312, + ["khabengali"]=2454, + ["khacyrillic"]=1093, + ["khadeva"]=2326, + ["khagujarati"]=2710, + ["khagurmukhi"]=2582, + ["khaharabic"]=1582, + ["khahfinalarabic"]=65190, + ["khahinitialarabic"]=65191, + ["khahmedialarabic"]=65192, + ["kheicoptic"]=999, + ["khhadeva"]=2393, + ["khhagurmukhi"]=2649, + ["khieukhacirclekorean"]=12920, + ["khieukhaparenkorean"]=12824, + ["khieukhcirclekorean"]=12906, + ["khieukhkorean"]=12619, + ["khieukhparenkorean"]=12810, + ["khokhaithai"]=3586, + ["khokhonthai"]=3589, + ["khokhuatthai"]=3587, + ["khokhwaithai"]=3588, + ["khomutthai"]=3675, + ["khook"]=409, + ["khorakhangthai"]=3590, + ["khzsquare"]=13201, + ["kihiragana"]=12365, + ["kikatakana"]=12461, + ["kikatakanahalfwidth"]=65399, + ["kiroguramusquare"]=13077, + ["kiromeetorusquare"]=13078, + ["kirosquare"]=13076, + ["kiyeokacirclekorean"]=12910, + ["kiyeokaparenkorean"]=12814, + ["kiyeokcirclekorean"]=12896, + ["kiyeokkorean"]=12593, + ["kiyeokparenkorean"]=12800, + ["kiyeoksioskorean"]=12595, + ["kjecyrillic"]=1116, + ["klinebelow"]=7733, + ["klsquare"]=13208, + ["kmcubedsquare"]=13222, + ["kmonospace"]=65355, + ["kmsquaredsquare"]=13218, + ["kohiragana"]=12371, + ["kohmsquare"]=13248, + ["kokaithai"]=3585, + ["kokatakana"]=12467, + ["kokatakanahalfwidth"]=65402, + ["kooposquare"]=13086, + ["koppacyrillic"]=1153, + ["koreanstandardsymbol"]=12927, + ["koroniscmb"]=835, + ["kparen"]=9382, + ["kpasquare"]=13226, + ["ksicyrillic"]=1135, + ["ktsquare"]=13263, + ["kturned"]=670, + ["kuhiragana"]=12367, + ["kukatakana"]=12463, + ["kukatakanahalfwidth"]=65400, + ["kvsquare"]=13240, + ["kwsquare"]=13246, + ["l"]=108, + ["labengali"]=2482, + ["lacute"]=314, + ["ladeva"]=2354, + ["lagujarati"]=2738, + ["lagurmukhi"]=2610, + ["lakkhangyaothai"]=3653, + ["lamaleffinalarabic"]=65276, + ["lamalefhamzaabovefinalarabic"]=65272, + ["lamalefhamzaaboveisolatedarabic"]=65271, + ["lamalefhamzabelowfinalarabic"]=65274, + ["lamalefhamzabelowisolatedarabic"]=65273, + ["lamalefisolatedarabic"]=65275, + ["lamalefmaddaabovefinalarabic"]=65270, + ["lamalefmaddaaboveisolatedarabic"]=65269, + ["lamarabic"]=1604, + ["lambda"]=955, + ["lambdastroke"]=411, + ["lameddageshhebrew"]=64316, + ["lamedholamhebrew"]=1500, + ["lamfinalarabic"]=65246, + ["lamhahinitialarabic"]=64714, + ["lamjeeminitialarabic"]=64713, + ["lamkhahinitialarabic"]=64715, + ["lamlamhehisolatedarabic"]=65010, + ["lammedialarabic"]=65248, + ["lammeemhahinitialarabic"]=64904, + ["lammeeminitialarabic"]=64716, + ["lammeemkhahinitialarabic"]=65247, + ["largecircle"]=9711, + ["lbar"]=410, + ["lbelt"]=620, + ["lbopomofo"]=12556, + ["lcaron"]=318, + ["lcircle"]=9435, + ["lcircumflexbelow"]=7741, + ["lcommaaccent"]=316, + ["ldotaccent"]=320, + ["ldotbelow"]=7735, + ["ldotbelowmacron"]=7737, + ["leftangleabovecmb"]=794, + ["lefttackbelowcmb"]=792, + ["less"]=60, + ["lessequal"]=8804, + ["lessequalorgreater"]=8922, + ["lessmonospace"]=65308, + ["lessorequivalent"]=8818, + ["lessorgreater"]=8822, + ["lessoverequal"]=8806, + ["lesssmall"]=65124, + ["lezh"]=622, + ["lfblock"]=9612, + ["lhookretroflex"]=621, + ["lira"]=8356, + ["liwnarmenian"]=1388, + ["lj"]=457, + ["ljecyrillic"]=1113, + ["lladeva"]=2355, + ["llagujarati"]=2739, + ["llinebelow"]=7739, + ["llladeva"]=2356, + ["llvocalicbengali"]=2529, + ["llvocalicdeva"]=2401, + ["llvocalicvowelsignbengali"]=2531, + ["llvocalicvowelsigndeva"]=2403, + ["lmiddletilde"]=619, + ["lmonospace"]=65356, + ["lmsquare"]=13264, + ["lochulathai"]=3628, + ["logicaland"]=8743, + ["logicalnot"]=172, + ["logicalor"]=8744, + ["lolingthai"]=3621, + ["lowlinecenterline"]=65102, + ["lowlinecmb"]=818, + ["lowlinedashed"]=65101, + ["lozenge"]=9674, + ["lparen"]=9383, + ["lslash"]=322, + ["lsquare"]=8467, + ["luthai"]=3622, + ["lvocalicbengali"]=2444, + ["lvocalicdeva"]=2316, + ["lvocalicvowelsignbengali"]=2530, + ["lvocalicvowelsigndeva"]=2402, + ["lxsquare"]=13267, + ["m"]=109, + ["mabengali"]=2478, + ["macron"]=175, + ["macronbelowcmb"]=817, + ["macroncmb"]=772, + ["macronlowmod"]=717, + ["macronmonospace"]=65507, + ["macute"]=7743, + ["madeva"]=2350, + ["magujarati"]=2734, + ["magurmukhi"]=2606, + ["mahapakhlefthebrew"]=1444, + ["mahiragana"]=12414, + ["maichattawathai"]=3659, + ["maiekthai"]=3656, + ["maihanakatthai"]=3633, + ["maitaikhuthai"]=3655, + ["maithothai"]=3657, + ["maitrithai"]=3658, + ["maiyamokthai"]=3654, + ["makatakana"]=12510, + ["makatakanahalfwidth"]=65423, + ["mansyonsquare"]=13127, + ["maqafhebrew"]=1470, + ["mars"]=9794, + ["masoracirclehebrew"]=1455, + ["masquare"]=13187, + ["mbopomofo"]=12551, + ["mbsquare"]=13268, + ["mcircle"]=9436, + ["mcubedsquare"]=13221, + ["mdotaccent"]=7745, + ["mdotbelow"]=7747, + ["meemarabic"]=1605, + ["meemfinalarabic"]=65250, + ["meeminitialarabic"]=65251, + ["meemmedialarabic"]=65252, + ["meemmeeminitialarabic"]=64721, + ["meemmeemisolatedarabic"]=64584, + ["meetorusquare"]=13133, + ["mehiragana"]=12417, + ["meizierasquare"]=13182, + ["mekatakana"]=12513, + ["mekatakanahalfwidth"]=65426, + ["memdageshhebrew"]=64318, + ["memhebrew"]=1502, + ["menarmenian"]=1396, + ["merkhakefulalefthebrew"]=1446, + ["merkhalefthebrew"]=1445, + ["mhook"]=625, + ["mhzsquare"]=13202, + ["middledotkatakanahalfwidth"]=65381, + ["mieumacirclekorean"]=12914, + ["mieumaparenkorean"]=12818, + ["mieumcirclekorean"]=12900, + ["mieumkorean"]=12609, + ["mieumpansioskorean"]=12656, + ["mieumparenkorean"]=12804, + ["mieumpieupkorean"]=12654, + ["mieumsioskorean"]=12655, + ["mihiragana"]=12415, + ["mikatakana"]=12511, + ["mikatakanahalfwidth"]=65424, + ["minus"]=8722, + ["minusbelowcmb"]=800, + ["minuscircle"]=8854, + ["minusmod"]=727, + ["minusplus"]=8723, + ["minute"]=8242, + ["miribaarusquare"]=13130, + ["mirisquare"]=13129, + ["mlonglegturned"]=624, + ["mlsquare"]=13206, + ["mmcubedsquare"]=13219, + ["mmonospace"]=65357, + ["mmsquaredsquare"]=13215, + ["mohiragana"]=12418, + ["mohmsquare"]=13249, + ["mokatakana"]=12514, + ["mokatakanahalfwidth"]=65427, + ["molsquare"]=13270, + ["momathai"]=3617, + ["moverssquare"]=13223, + ["moverssquaredsquare"]=13224, + ["mparen"]=9384, + ["mpasquare"]=13227, + ["mssquare"]=13235, + ["mturned"]=623, + ["mu1"]=181, + ["muasquare"]=13186, + ["muchgreater"]=8811, + ["muchless"]=8810, + ["mufsquare"]=13196, + ["mugreek"]=956, + ["mugsquare"]=13197, + ["muhiragana"]=12416, + ["mukatakana"]=12512, + ["mukatakanahalfwidth"]=65425, + ["mulsquare"]=13205, + ["multiply"]=215, + ["mumsquare"]=13211, + ["munahlefthebrew"]=1443, + ["musicalnote"]=9834, + ["musicalnotedbl"]=9835, + ["musicflatsign"]=9837, + ["musicsharpsign"]=9839, + ["mussquare"]=13234, + ["muvsquare"]=13238, + ["muwsquare"]=13244, + ["mvmegasquare"]=13241, + ["mvsquare"]=13239, + ["mwmegasquare"]=13247, + ["mwsquare"]=13245, + ["n"]=110, + ["nabengali"]=2472, + ["nabla"]=8711, + ["nacute"]=324, + ["nadeva"]=2344, + ["nagujarati"]=2728, + ["nagurmukhi"]=2600, + ["nahiragana"]=12394, + ["nakatakana"]=12490, + ["nakatakanahalfwidth"]=65413, + ["nasquare"]=13185, + ["nbopomofo"]=12555, + ["ncaron"]=328, + ["ncircle"]=9437, + ["ncircumflexbelow"]=7755, + ["ncommaaccent"]=326, + ["ndotaccent"]=7749, + ["ndotbelow"]=7751, + ["nehiragana"]=12397, + ["nekatakana"]=12493, + ["nekatakanahalfwidth"]=65416, + ["nfsquare"]=13195, + ["ngabengali"]=2457, + ["ngadeva"]=2329, + ["ngagujarati"]=2713, + ["ngagurmukhi"]=2585, + ["ngonguthai"]=3591, + ["nhiragana"]=12435, + ["nhookleft"]=626, + ["nhookretroflex"]=627, + ["nieunacirclekorean"]=12911, + ["nieunaparenkorean"]=12815, + ["nieuncieuckorean"]=12597, + ["nieuncirclekorean"]=12897, + ["nieunhieuhkorean"]=12598, + ["nieunkorean"]=12596, + ["nieunpansioskorean"]=12648, + ["nieunparenkorean"]=12801, + ["nieunsioskorean"]=12647, + ["nieuntikeutkorean"]=12646, + ["nihiragana"]=12395, + ["nikatakana"]=12491, + ["nikatakanahalfwidth"]=65414, + ["nikhahitthai"]=3661, + ["nine"]=57, + ["ninebengali"]=2543, + ["ninecircle"]=9320, + ["ninecircleinversesansserif"]=10130, + ["ninedeva"]=2415, + ["ninegujarati"]=2799, + ["ninegurmukhi"]=2671, + ["ninehackarabic"]=1641, + ["ninehangzhou"]=12329, + ["nineideographicparen"]=12840, + ["nineinferior"]=8329, + ["ninemonospace"]=65305, + ["nineparen"]=9340, + ["nineperiod"]=9360, + ["ninepersian"]=1785, + ["nineroman"]=8568, + ["ninesuperior"]=8313, + ["nineteencircle"]=9330, + ["nineteenparen"]=9350, + ["nineteenperiod"]=9370, + ["ninethai"]=3673, + ["nj"]=460, + ["njecyrillic"]=1114, + ["nkatakana"]=12531, + ["nkatakanahalfwidth"]=65437, + ["nlegrightlong"]=414, + ["nlinebelow"]=7753, + ["nmonospace"]=65358, + ["nmsquare"]=13210, + ["nnabengali"]=2467, + ["nnadeva"]=2339, + ["nnagujarati"]=2723, + ["nnagurmukhi"]=2595, + ["nnnadeva"]=2345, + ["nohiragana"]=12398, + ["nokatakana"]=12494, + ["nokatakanahalfwidth"]=65417, + ["nonbreakingspace"]=160, + ["nonenthai"]=3603, + ["nonuthai"]=3609, + ["noonarabic"]=1606, + ["noonfinalarabic"]=65254, + ["noonghunnaarabic"]=1722, + ["noonghunnafinalarabic"]=64415, + ["nooninitialarabic"]=65255, + ["noonjeeminitialarabic"]=64722, + ["noonjeemisolatedarabic"]=64587, + ["noonmedialarabic"]=65256, + ["noonmeeminitialarabic"]=64725, + ["noonmeemisolatedarabic"]=64590, + ["noonnoonfinalarabic"]=64653, + ["notcontains"]=8716, + ["notelementof"]=8713, + ["notequal"]=8800, + ["notgreater"]=8815, + ["notgreaternorequal"]=8817, + ["notgreaternorless"]=8825, + ["notidentical"]=8802, + ["notless"]=8814, + ["notlessnorequal"]=8816, + ["notparallel"]=8742, + ["notprecedes"]=8832, + ["notsubset"]=8836, + ["notsucceeds"]=8833, + ["notsuperset"]=8837, + ["nowarmenian"]=1398, + ["nparen"]=9385, + ["nssquare"]=13233, + ["nsuperior"]=8319, + ["ntilde"]=241, + ["nu"]=957, + ["nuhiragana"]=12396, + ["nukatakana"]=12492, + ["nukatakanahalfwidth"]=65415, + ["nuktabengali"]=2492, + ["nuktadeva"]=2364, + ["nuktagujarati"]=2748, + ["nuktagurmukhi"]=2620, + ["numbersign"]=35, + ["numbersignmonospace"]=65283, + ["numbersignsmall"]=65119, + ["numeralsigngreek"]=884, + ["numeralsignlowergreek"]=885, + ["numero"]=8470, + ["nundageshhebrew"]=64320, + ["nunhebrew"]=1504, + ["nvsquare"]=13237, + ["nwsquare"]=13243, + ["nyabengali"]=2462, + ["nyadeva"]=2334, + ["nyagujarati"]=2718, + ["nyagurmukhi"]=2590, + ["o"]=111, + ["oacute"]=243, + ["oangthai"]=3629, + ["obarred"]=629, + ["obarredcyrillic"]=1257, + ["obarreddieresiscyrillic"]=1259, + ["obengali"]=2451, + ["obopomofo"]=12571, + ["obreve"]=335, + ["ocandradeva"]=2321, + ["ocandragujarati"]=2705, + ["ocandravowelsigndeva"]=2377, + ["ocandravowelsigngujarati"]=2761, + ["ocaron"]=466, + ["ocircle"]=9438, + ["ocircumflex"]=244, + ["ocircumflexacute"]=7889, + ["ocircumflexdotbelow"]=7897, + ["ocircumflexgrave"]=7891, + ["ocircumflexhookabove"]=7893, + ["ocircumflextilde"]=7895, + ["ocyrillic"]=1086, + ["odblgrave"]=525, + ["odeva"]=2323, + ["odieresis"]=246, + ["odieresiscyrillic"]=1255, + ["odotbelow"]=7885, + ["oe"]=339, + ["oekorean"]=12634, + ["ogonek"]=731, + ["ogonekcmb"]=808, + ["ograve"]=242, + ["ogujarati"]=2707, + ["oharmenian"]=1413, + ["ohiragana"]=12362, + ["ohookabove"]=7887, + ["ohorn"]=417, + ["ohornacute"]=7899, + ["ohorndotbelow"]=7907, + ["ohorngrave"]=7901, + ["ohornhookabove"]=7903, + ["ohorntilde"]=7905, + ["ohungarumlaut"]=337, + ["oi"]=419, + ["oinvertedbreve"]=527, + ["okatakana"]=12458, + ["okatakanahalfwidth"]=65397, + ["okorean"]=12631, + ["olehebrew"]=1451, + ["omacron"]=333, + ["omacronacute"]=7763, + ["omacrongrave"]=7761, + ["omdeva"]=2384, + ["omega"]=969, + ["omegacyrillic"]=1121, + ["omegalatinclosed"]=631, + ["omegaroundcyrillic"]=1147, + ["omegatitlocyrillic"]=1149, + ["omegatonos"]=974, + ["omgujarati"]=2768, + ["omicron"]=959, + ["omicrontonos"]=972, + ["omonospace"]=65359, + ["one"]=49, + ["onebengali"]=2535, + ["onecircle"]=9312, + ["onecircleinversesansserif"]=10122, + ["onedeva"]=2407, + ["onedotenleader"]=8228, + ["oneeighth"]=8539, + ["onegujarati"]=2791, + ["onegurmukhi"]=2663, + ["onehackarabic"]=1633, + ["onehalf"]=189, + ["onehangzhou"]=12321, + ["oneideographicparen"]=12832, + ["oneinferior"]=8321, + ["onemonospace"]=65297, + ["onenumeratorbengali"]=2548, + ["oneparen"]=9332, + ["oneperiod"]=9352, + ["onepersian"]=1777, + ["onequarter"]=188, + ["oneroman"]=8560, + ["onesuperior"]=185, + ["onethai"]=3665, + ["onethird"]=8531, + ["oogonek"]=491, + ["oogonekmacron"]=493, + ["oogurmukhi"]=2579, + ["oomatragurmukhi"]=2635, + ["oopen"]=596, + ["oparen"]=9386, + ["option"]=8997, + ["ordfeminine"]=170, + ["ordmasculine"]=186, + ["oshortdeva"]=2322, + ["oshortvowelsigndeva"]=2378, + ["oslash"]=248, + ["osmallhiragana"]=12361, + ["osmallkatakana"]=12457, + ["osmallkatakanahalfwidth"]=65387, + ["ostrokeacute"]=511, + ["otcyrillic"]=1151, + ["otilde"]=245, + ["otildeacute"]=7757, + ["otildedieresis"]=7759, + ["oubopomofo"]=12577, + ["overline"]=8254, + ["overlinecenterline"]=65098, + ["overlinecmb"]=773, + ["overlinedashed"]=65097, + ["overlinedblwavy"]=65100, + ["overlinewavy"]=65099, + ["ovowelsignbengali"]=2507, + ["ovowelsigndeva"]=2379, + ["ovowelsigngujarati"]=2763, + ["p"]=112, + ["paampssquare"]=13184, + ["paasentosquare"]=13099, + ["pabengali"]=2474, + ["pacute"]=7765, + ["padeva"]=2346, + ["pagedown"]=8671, + ["pageup"]=8670, + ["pagujarati"]=2730, + ["pagurmukhi"]=2602, + ["pahiragana"]=12401, + ["paiyannoithai"]=3631, + ["pakatakana"]=12497, + ["palatalizationcyrilliccmb"]=1156, + ["palochkacyrillic"]=1216, + ["pansioskorean"]=12671, + ["paragraph"]=182, + ["parallel"]=8741, + ["parenleft"]=40, + ["parenleftaltonearabic"]=64830, + ["parenleftinferior"]=8333, + ["parenleftmonospace"]=65288, + ["parenleftsmall"]=65113, + ["parenleftsuperior"]=8317, + ["parenleftvertical"]=65077, + ["parenright"]=41, + ["parenrightaltonearabic"]=64831, + ["parenrightinferior"]=8334, + ["parenrightmonospace"]=65289, + ["parenrightsmall"]=65114, + ["parenrightsuperior"]=8318, + ["parenrightvertical"]=65078, + ["partialdiff"]=8706, + ["paseqhebrew"]=1472, + ["pashtahebrew"]=1433, + ["pasquare"]=13225, + ["patahwidehebrew"]=1463, + ["pazerhebrew"]=1441, + ["pbopomofo"]=12550, + ["pcircle"]=9439, + ["pdotaccent"]=7767, + ["pecyrillic"]=1087, + ["pedageshhebrew"]=64324, + ["peezisquare"]=13115, + ["pefinaldageshhebrew"]=64323, + ["peharabic"]=1662, + ["peharmenian"]=1402, + ["pehebrew"]=1508, + ["pehfinalarabic"]=64343, + ["pehinitialarabic"]=64344, + ["pehiragana"]=12410, + ["pehmedialarabic"]=64345, + ["pekatakana"]=12506, + ["pemiddlehookcyrillic"]=1191, + ["perafehebrew"]=64334, + ["percent"]=37, + ["percentarabic"]=1642, + ["percentmonospace"]=65285, + ["percentsmall"]=65130, + ["period"]=46, + ["periodarmenian"]=1417, + ["periodcentered"]=183, + ["periodhalfwidth"]=65377, + ["periodmonospace"]=65294, + ["periodsmall"]=65106, + ["perispomenigreekcmb"]=834, + ["perpendicular"]=8869, + ["perthousand"]=8240, + ["peseta"]=8359, + ["pfsquare"]=13194, + ["phabengali"]=2475, + ["phadeva"]=2347, + ["phagujarati"]=2731, + ["phagurmukhi"]=2603, + ["phi"]=966, + ["phieuphacirclekorean"]=12922, + ["phieuphaparenkorean"]=12826, + ["phieuphcirclekorean"]=12908, + ["phieuphkorean"]=12621, + ["phieuphparenkorean"]=12812, + ["philatin"]=632, + ["phinthuthai"]=3642, + ["phisymbolgreek"]=981, + ["phook"]=421, + ["phophanthai"]=3614, + ["phophungthai"]=3612, + ["phosamphaothai"]=3616, + ["pi"]=960, + ["pieupacirclekorean"]=12915, + ["pieupaparenkorean"]=12819, + ["pieupcieuckorean"]=12662, + ["pieupcirclekorean"]=12901, + ["pieupkiyeokkorean"]=12658, + ["pieupkorean"]=12610, + ["pieupparenkorean"]=12805, + ["pieupsioskiyeokkorean"]=12660, + ["pieupsioskorean"]=12612, + ["pieupsiostikeutkorean"]=12661, + ["pieupthieuthkorean"]=12663, + ["pieuptikeutkorean"]=12659, + ["pihiragana"]=12404, + ["pikatakana"]=12500, + ["pisymbolgreek"]=982, + ["piwrarmenian"]=1411, + ["plus"]=43, + ["plusbelowcmb"]=799, + ["pluscircle"]=8853, + ["plusminus"]=177, + ["plusmod"]=726, + ["plusmonospace"]=65291, + ["plussmall"]=65122, + ["plussuperior"]=8314, + ["pmonospace"]=65360, + ["pmsquare"]=13272, + ["pohiragana"]=12413, + ["pointingindexdownwhite"]=9759, + ["pointingindexleftwhite"]=9756, + ["pointingindexrightwhite"]=9758, + ["pointingindexupwhite"]=9757, + ["pokatakana"]=12509, + ["poplathai"]=3611, + ["postalmark"]=12306, + ["postalmarkface"]=12320, + ["pparen"]=9387, + ["precedes"]=8826, + ["prescription"]=8478, + ["primemod"]=697, + ["primereversed"]=8245, + ["product"]=8719, + ["projective"]=8965, + ["prolongedkana"]=12540, + ["propellor"]=8984, + ["proportion"]=8759, + ["proportional"]=8733, + ["psi"]=968, + ["psicyrillic"]=1137, + ["psilipneumatacyrilliccmb"]=1158, + ["pssquare"]=13232, + ["puhiragana"]=12407, + ["pukatakana"]=12503, + ["pvsquare"]=13236, + ["pwsquare"]=13242, + ["q"]=113, + ["qadeva"]=2392, + ["qadmahebrew"]=1448, + ["qafarabic"]=1602, + ["qaffinalarabic"]=65238, + ["qafinitialarabic"]=65239, + ["qafmedialarabic"]=65240, + ["qamatswidehebrew"]=1464, + ["qarneyparahebrew"]=1439, + ["qbopomofo"]=12561, + ["qcircle"]=9440, + ["qhook"]=672, + ["qmonospace"]=65361, + ["qofdageshhebrew"]=64327, + ["qoftserehebrew"]=1511, + ["qparen"]=9388, + ["quarternote"]=9833, + ["qubutswidehebrew"]=1467, + ["question"]=63, + ["questionarabic"]=1567, + ["questionarmenian"]=1374, + ["questiondown"]=191, + ["questiongreek"]=894, + ["questionmonospace"]=65311, + ["quotedbl"]=34, + ["quotedblbase"]=8222, + ["quotedblleft"]=8220, + ["quotedblmonospace"]=65282, + ["quotedblprime"]=12318, + ["quotedblprimereversed"]=12317, + ["quotedblright"]=8221, + ["quoteleft"]=8216, + ["quotereversed"]=8219, + ["quoteright"]=8217, + ["quoterightn"]=329, + ["quotesinglbase"]=8218, + ["quotesingle"]=39, + ["quotesinglemonospace"]=65287, + ["r"]=114, + ["raarmenian"]=1404, + ["rabengali"]=2480, + ["racute"]=341, + ["radeva"]=2352, + ["radical"]=8730, + ["radoverssquare"]=13230, + ["radoverssquaredsquare"]=13231, + ["radsquare"]=13229, + ["rafehebrew"]=1471, + ["ragujarati"]=2736, + ["ragurmukhi"]=2608, + ["rahiragana"]=12425, + ["rakatakana"]=12521, + ["rakatakanahalfwidth"]=65431, + ["ralowerdiagonalbengali"]=2545, + ["ramiddlediagonalbengali"]=2544, + ["ramshorn"]=612, + ["ratio"]=8758, + ["rbopomofo"]=12566, + ["rcaron"]=345, + ["rcircle"]=9441, + ["rcommaaccent"]=343, + ["rdblgrave"]=529, + ["rdotaccent"]=7769, + ["rdotbelow"]=7771, + ["rdotbelowmacron"]=7773, + ["referencemark"]=8251, + ["registered"]=174, + ["reharmenian"]=1408, + ["rehfinalarabic"]=65198, + ["rehiragana"]=12428, + ["rehyehaleflamarabic"]=1585, + ["rekatakana"]=12524, + ["rekatakanahalfwidth"]=65434, + ["reshdageshhebrew"]=64328, + ["reshtserehebrew"]=1512, + ["reversedtilde"]=8765, + ["reviamugrashhebrew"]=1431, + ["revlogicalnot"]=8976, + ["rfishhook"]=638, + ["rfishhookreversed"]=639, + ["rhabengali"]=2525, + ["rhadeva"]=2397, + ["rho"]=961, + ["rhook"]=637, + ["rhookturned"]=635, + ["rhookturnedsuperior"]=693, + ["rhosymbolgreek"]=1009, + ["rhotichookmod"]=734, + ["rieulacirclekorean"]=12913, + ["rieulaparenkorean"]=12817, + ["rieulcirclekorean"]=12899, + ["rieulhieuhkorean"]=12608, + ["rieulkiyeokkorean"]=12602, + ["rieulkiyeoksioskorean"]=12649, + ["rieulkorean"]=12601, + ["rieulmieumkorean"]=12603, + ["rieulpansioskorean"]=12652, + ["rieulparenkorean"]=12803, + ["rieulphieuphkorean"]=12607, + ["rieulpieupkorean"]=12604, + ["rieulpieupsioskorean"]=12651, + ["rieulsioskorean"]=12605, + ["rieulthieuthkorean"]=12606, + ["rieultikeutkorean"]=12650, + ["rieulyeorinhieuhkorean"]=12653, + ["rightangle"]=8735, + ["righttackbelowcmb"]=793, + ["righttriangle"]=8895, + ["rihiragana"]=12426, + ["rikatakana"]=12522, + ["rikatakanahalfwidth"]=65432, + ["ring"]=730, + ["ringbelowcmb"]=805, + ["ringcmb"]=778, + ["ringhalfleft"]=703, + ["ringhalfleftarmenian"]=1369, + ["ringhalfleftbelowcmb"]=796, + ["ringhalfleftcentered"]=723, + ["ringhalfright"]=702, + ["ringhalfrightbelowcmb"]=825, + ["ringhalfrightcentered"]=722, + ["rinvertedbreve"]=531, + ["rittorusquare"]=13137, + ["rlinebelow"]=7775, + ["rlongleg"]=636, + ["rlonglegturned"]=634, + ["rmonospace"]=65362, + ["rohiragana"]=12429, + ["rokatakana"]=12525, + ["rokatakanahalfwidth"]=65435, + ["roruathai"]=3619, + ["rparen"]=9389, + ["rrabengali"]=2524, + ["rradeva"]=2353, + ["rragurmukhi"]=2652, + ["rreharabic"]=1681, + ["rrehfinalarabic"]=64397, + ["rrvocalicbengali"]=2528, + ["rrvocalicdeva"]=2400, + ["rrvocalicgujarati"]=2784, + ["rrvocalicvowelsignbengali"]=2500, + ["rrvocalicvowelsigndeva"]=2372, + ["rrvocalicvowelsigngujarati"]=2756, + ["rtblock"]=9616, + ["rturned"]=633, + ["rturnedsuperior"]=692, + ["ruhiragana"]=12427, + ["rukatakana"]=12523, + ["rukatakanahalfwidth"]=65433, + ["rupeemarkbengali"]=2546, + ["rupeesignbengali"]=2547, + ["ruthai"]=3620, + ["rvocalicbengali"]=2443, + ["rvocalicdeva"]=2315, + ["rvocalicgujarati"]=2699, + ["rvocalicvowelsignbengali"]=2499, + ["rvocalicvowelsigndeva"]=2371, + ["rvocalicvowelsigngujarati"]=2755, + ["s"]=115, + ["sabengali"]=2488, + ["sacute"]=347, + ["sacutedotaccent"]=7781, + ["sadarabic"]=1589, + ["sadeva"]=2360, + ["sadfinalarabic"]=65210, + ["sadinitialarabic"]=65211, + ["sadmedialarabic"]=65212, + ["sagujarati"]=2744, + ["sagurmukhi"]=2616, + ["sahiragana"]=12373, + ["sakatakana"]=12469, + ["sakatakanahalfwidth"]=65403, + ["sallallahoualayhewasallamarabic"]=65018, + ["samekhdageshhebrew"]=64321, + ["samekhhebrew"]=1505, + ["saraaathai"]=3634, + ["saraaethai"]=3649, + ["saraaimaimalaithai"]=3652, + ["saraaimaimuanthai"]=3651, + ["saraamthai"]=3635, + ["saraathai"]=3632, + ["saraethai"]=3648, + ["saraiithai"]=3637, + ["saraithai"]=3636, + ["saraothai"]=3650, + ["saraueethai"]=3639, + ["sarauethai"]=3638, + ["sarauthai"]=3640, + ["sarauuthai"]=3641, + ["sbopomofo"]=12569, + ["scaron"]=353, + ["scarondotaccent"]=7783, + ["scedilla"]=351, + ["schwa"]=601, + ["schwacyrillic"]=1241, + ["schwadieresiscyrillic"]=1243, + ["schwahook"]=602, + ["scircle"]=9442, + ["scircumflex"]=349, + ["scommaaccent"]=537, + ["sdotaccent"]=7777, + ["sdotbelow"]=7779, + ["sdotbelowdotaccent"]=7785, + ["seagullbelowcmb"]=828, + ["second"]=8243, + ["secondtonechinese"]=714, + ["section"]=167, + ["seenarabic"]=1587, + ["seenfinalarabic"]=65202, + ["seeninitialarabic"]=65203, + ["seenmedialarabic"]=65204, + ["segoltahebrew"]=1426, + ["segolwidehebrew"]=1462, + ["seharmenian"]=1405, + ["sehiragana"]=12379, + ["sekatakana"]=12475, + ["sekatakanahalfwidth"]=65406, + ["semicolon"]=59, + ["semicolonarabic"]=1563, + ["semicolonmonospace"]=65307, + ["semicolonsmall"]=65108, + ["semivoicedmarkkana"]=12444, + ["semivoicedmarkkanahalfwidth"]=65439, + ["sentisquare"]=13090, + ["sentosquare"]=13091, + ["seven"]=55, + ["sevenbengali"]=2541, + ["sevencircle"]=9318, + ["sevencircleinversesansserif"]=10128, + ["sevendeva"]=2413, + ["seveneighths"]=8542, + ["sevengujarati"]=2797, + ["sevengurmukhi"]=2669, + ["sevenhackarabic"]=1639, + ["sevenhangzhou"]=12327, + ["sevenideographicparen"]=12838, + ["seveninferior"]=8327, + ["sevenmonospace"]=65303, + ["sevenparen"]=9338, + ["sevenperiod"]=9358, + ["sevenpersian"]=1783, + ["sevenroman"]=8566, + ["sevensuperior"]=8311, + ["seventeencircle"]=9328, + ["seventeenparen"]=9348, + ["seventeenperiod"]=9368, + ["seventhai"]=3671, + ["shaarmenian"]=1399, + ["shabengali"]=2486, + ["shacyrillic"]=1096, + ["shaddadammaarabic"]=64609, + ["shaddadammatanarabic"]=64606, + ["shaddafathaarabic"]=64608, + ["shaddafathatanarabic"]=1617, + ["shaddakasraarabic"]=64610, + ["shaddakasratanarabic"]=64607, + ["shadedark"]=9619, + ["shadelight"]=9617, + ["shademedium"]=9618, + ["shadeva"]=2358, + ["shagujarati"]=2742, + ["shagurmukhi"]=2614, + ["shalshelethebrew"]=1427, + ["shbopomofo"]=12565, + ["shchacyrillic"]=1097, + ["sheenarabic"]=1588, + ["sheenfinalarabic"]=65206, + ["sheeninitialarabic"]=65207, + ["sheenmedialarabic"]=65208, + ["sheicoptic"]=995, + ["sheqelhebrew"]=8362, + ["shevawidehebrew"]=1456, + ["shhacyrillic"]=1211, + ["shimacoptic"]=1005, + ["shindageshhebrew"]=64329, + ["shindageshshindothebrew"]=64300, + ["shindageshsindothebrew"]=64301, + ["shindothebrew"]=1473, + ["shinhebrew"]=1513, + ["shinshindothebrew"]=64298, + ["shinsindothebrew"]=64299, + ["shook"]=642, + ["sigma"]=963, + ["sigmafinal"]=962, + ["sigmalunatesymbolgreek"]=1010, + ["sihiragana"]=12375, + ["sikatakana"]=12471, + ["sikatakanahalfwidth"]=65404, + ["siluqlefthebrew"]=1469, + ["sindothebrew"]=1474, + ["siosacirclekorean"]=12916, + ["siosaparenkorean"]=12820, + ["sioscieuckorean"]=12670, + ["sioscirclekorean"]=12902, + ["sioskiyeokkorean"]=12666, + ["sioskorean"]=12613, + ["siosnieunkorean"]=12667, + ["siosparenkorean"]=12806, + ["siospieupkorean"]=12669, + ["siostikeutkorean"]=12668, + ["six"]=54, + ["sixbengali"]=2540, + ["sixcircle"]=9317, + ["sixcircleinversesansserif"]=10127, + ["sixdeva"]=2412, + ["sixgujarati"]=2796, + ["sixgurmukhi"]=2668, + ["sixhackarabic"]=1638, + ["sixhangzhou"]=12326, + ["sixideographicparen"]=12837, + ["sixinferior"]=8326, + ["sixmonospace"]=65302, + ["sixparen"]=9337, + ["sixperiod"]=9357, + ["sixpersian"]=1782, + ["sixroman"]=8565, + ["sixsuperior"]=8310, + ["sixteencircle"]=9327, + ["sixteencurrencydenominatorbengali"]=2553, + ["sixteenparen"]=9347, + ["sixteenperiod"]=9367, + ["sixthai"]=3670, + ["slash"]=47, + ["slashmonospace"]=65295, + ["slong"]=383, + ["slongdotaccent"]=7835, + ["smonospace"]=65363, + ["sofpasuqhebrew"]=1475, + ["softhyphen"]=173, + ["softsigncyrillic"]=1100, + ["sohiragana"]=12381, + ["sokatakana"]=12477, + ["sokatakanahalfwidth"]=65407, + ["soliduslongoverlaycmb"]=824, + ["solidusshortoverlaycmb"]=823, + ["sorusithai"]=3625, + ["sosalathai"]=3624, + ["sosothai"]=3595, + ["sosuathai"]=3626, + ["space"]=32, + ["spadesuitblack"]=9824, + ["spadesuitwhite"]=9828, + ["sparen"]=9390, + ["squarebelowcmb"]=827, + ["squarecc"]=13252, + ["squarecm"]=13213, + ["squarediagonalcrosshatchfill"]=9641, + ["squarehorizontalfill"]=9636, + ["squarekg"]=13199, + ["squarekm"]=13214, + ["squarekmcapital"]=13262, + ["squareln"]=13265, + ["squarelog"]=13266, + ["squaremg"]=13198, + ["squaremil"]=13269, + ["squaremm"]=13212, + ["squaremsquared"]=13217, + ["squareorthogonalcrosshatchfill"]=9638, + ["squareupperlefttolowerrightfill"]=9639, + ["squareupperrighttolowerleftfill"]=9640, + ["squareverticalfill"]=9637, + ["squarewhitewithsmallblack"]=9635, + ["srsquare"]=13275, + ["ssabengali"]=2487, + ["ssadeva"]=2359, + ["ssagujarati"]=2743, + ["ssangcieuckorean"]=12617, + ["ssanghieuhkorean"]=12677, + ["ssangieungkorean"]=12672, + ["ssangkiyeokkorean"]=12594, + ["ssangnieunkorean"]=12645, + ["ssangpieupkorean"]=12611, + ["ssangsioskorean"]=12614, + ["ssangtikeutkorean"]=12600, + ["sterling"]=163, + ["sterlingmonospace"]=65505, + ["strokelongoverlaycmb"]=822, + ["strokeshortoverlaycmb"]=821, + ["subset"]=8834, + ["subsetnotequal"]=8842, + ["subsetorequal"]=8838, + ["succeeds"]=8827, + ["suchthat"]=8715, + ["suhiragana"]=12377, + ["sukatakana"]=12473, + ["sukatakanahalfwidth"]=65405, + ["sukunarabic"]=1618, + ["summation"]=8721, + ["sun"]=9788, + ["superset"]=8835, + ["supersetnotequal"]=8843, + ["supersetorequal"]=8839, + ["svsquare"]=13276, + ["syouwaerasquare"]=13180, + ["t"]=116, + ["tabengali"]=2468, + ["tackdown"]=8868, + ["tackleft"]=8867, + ["tadeva"]=2340, + ["tagujarati"]=2724, + ["tagurmukhi"]=2596, + ["taharabic"]=1591, + ["tahfinalarabic"]=65218, + ["tahinitialarabic"]=65219, + ["tahiragana"]=12383, + ["tahmedialarabic"]=65220, + ["taisyouerasquare"]=13181, + ["takatakana"]=12479, + ["takatakanahalfwidth"]=65408, + ["tatweelarabic"]=1600, + ["tau"]=964, + ["tavdageshhebrew"]=64330, + ["tavhebrew"]=1514, + ["tbar"]=359, + ["tbopomofo"]=12554, + ["tcaron"]=357, + ["tccurl"]=680, + ["tcheharabic"]=1670, + ["tchehfinalarabic"]=64379, + ["tchehmedialarabic"]=64381, + ["tchehmeeminitialarabic"]=64380, + ["tcircle"]=9443, + ["tcircumflexbelow"]=7793, + ["tcommaaccent"]=355, + ["tdieresis"]=7831, + ["tdotaccent"]=7787, + ["tdotbelow"]=7789, + ["tecyrillic"]=1090, + ["tedescendercyrillic"]=1197, + ["teharabic"]=1578, + ["tehfinalarabic"]=65174, + ["tehhahinitialarabic"]=64674, + ["tehhahisolatedarabic"]=64524, + ["tehinitialarabic"]=65175, + ["tehiragana"]=12390, + ["tehjeeminitialarabic"]=64673, + ["tehjeemisolatedarabic"]=64523, + ["tehmarbutaarabic"]=1577, + ["tehmarbutafinalarabic"]=65172, + ["tehmedialarabic"]=65176, + ["tehmeeminitialarabic"]=64676, + ["tehmeemisolatedarabic"]=64526, + ["tehnoonfinalarabic"]=64627, + ["tekatakana"]=12486, + ["tekatakanahalfwidth"]=65411, + ["telephone"]=8481, + ["telephoneblack"]=9742, + ["telishagedolahebrew"]=1440, + ["telishaqetanahebrew"]=1449, + ["tencircle"]=9321, + ["tenideographicparen"]=12841, + ["tenparen"]=9341, + ["tenperiod"]=9361, + ["tenroman"]=8569, + ["tesh"]=679, + ["tetdageshhebrew"]=64312, + ["tethebrew"]=1496, + ["tetsecyrillic"]=1205, + ["tevirlefthebrew"]=1435, + ["thabengali"]=2469, + ["thadeva"]=2341, + ["thagujarati"]=2725, + ["thagurmukhi"]=2597, + ["thalarabic"]=1584, + ["thalfinalarabic"]=65196, + ["thanthakhatthai"]=3660, + ["theharabic"]=1579, + ["thehfinalarabic"]=65178, + ["thehinitialarabic"]=65179, + ["thehmedialarabic"]=65180, + ["thereexists"]=8707, + ["therefore"]=8756, + ["theta"]=952, + ["thetasymbolgreek"]=977, + ["thieuthacirclekorean"]=12921, + ["thieuthaparenkorean"]=12825, + ["thieuthcirclekorean"]=12907, + ["thieuthkorean"]=12620, + ["thieuthparenkorean"]=12811, + ["thirteencircle"]=9324, + ["thirteenparen"]=9344, + ["thirteenperiod"]=9364, + ["thonangmonthothai"]=3601, + ["thook"]=429, + ["thophuthaothai"]=3602, + ["thorn"]=254, + ["thothahanthai"]=3607, + ["thothanthai"]=3600, + ["thothongthai"]=3608, + ["thothungthai"]=3606, + ["thousandcyrillic"]=1154, + ["thousandsseparatorpersian"]=1644, + ["three"]=51, + ["threebengali"]=2537, + ["threecircle"]=9314, + ["threecircleinversesansserif"]=10124, + ["threedeva"]=2409, + ["threeeighths"]=8540, + ["threegujarati"]=2793, + ["threegurmukhi"]=2665, + ["threehackarabic"]=1635, + ["threehangzhou"]=12323, + ["threeideographicparen"]=12834, + ["threeinferior"]=8323, + ["threemonospace"]=65299, + ["threenumeratorbengali"]=2550, + ["threeparen"]=9334, + ["threeperiod"]=9354, + ["threepersian"]=1779, + ["threequarters"]=190, + ["threeroman"]=8562, + ["threesuperior"]=179, + ["threethai"]=3667, + ["thzsquare"]=13204, + ["tihiragana"]=12385, + ["tikatakana"]=12481, + ["tikatakanahalfwidth"]=65409, + ["tikeutacirclekorean"]=12912, + ["tikeutaparenkorean"]=12816, + ["tikeutcirclekorean"]=12898, + ["tikeutkorean"]=12599, + ["tikeutparenkorean"]=12802, + ["tilde"]=732, + ["tildebelowcmb"]=816, + ["tildecomb"]=771, + ["tildedoublecmb"]=864, + ["tildeoperator"]=8764, + ["tildeoverlaycmb"]=820, + ["tildeverticalcmb"]=830, + ["timescircle"]=8855, + ["tipehalefthebrew"]=1430, + ["tippigurmukhi"]=2672, + ["titlocyrilliccmb"]=1155, + ["tiwnarmenian"]=1407, + ["tlinebelow"]=7791, + ["tmonospace"]=65364, + ["toarmenian"]=1385, + ["tohiragana"]=12392, + ["tokatakana"]=12488, + ["tokatakanahalfwidth"]=65412, + ["tonebarextrahighmod"]=741, + ["tonebarextralowmod"]=745, + ["tonebarhighmod"]=742, + ["tonebarlowmod"]=744, + ["tonebarmidmod"]=743, + ["tonefive"]=445, + ["tonesix"]=389, + ["tonetwo"]=424, + ["tonos"]=900, + ["tonsquare"]=13095, + ["topatakthai"]=3599, + ["tortoiseshellbracketleft"]=12308, + ["tortoiseshellbracketleftsmall"]=65117, + ["tortoiseshellbracketleftvertical"]=65081, + ["tortoiseshellbracketright"]=12309, + ["tortoiseshellbracketrightsmall"]=65118, + ["tortoiseshellbracketrightvertical"]=65082, + ["totaothai"]=3605, + ["tpalatalhook"]=427, + ["tparen"]=9391, + ["trademark"]=8482, + ["tretroflexhook"]=648, + ["triagdn"]=9660, + ["triaglf"]=9668, + ["triagrt"]=9658, + ["triagup"]=9650, + ["ts"]=678, + ["tsadidageshhebrew"]=64326, + ["tsadihebrew"]=1510, + ["tsecyrillic"]=1094, + ["tserewidehebrew"]=1461, + ["tshecyrillic"]=1115, + ["ttabengali"]=2463, + ["ttadeva"]=2335, + ["ttagujarati"]=2719, + ["ttagurmukhi"]=2591, + ["tteharabic"]=1657, + ["ttehfinalarabic"]=64359, + ["ttehinitialarabic"]=64360, + ["ttehmedialarabic"]=64361, + ["tthabengali"]=2464, + ["tthadeva"]=2336, + ["tthagujarati"]=2720, + ["tthagurmukhi"]=2592, + ["tturned"]=647, + ["tuhiragana"]=12388, + ["tukatakana"]=12484, + ["tukatakanahalfwidth"]=65410, + ["tusmallhiragana"]=12387, + ["tusmallkatakana"]=12483, + ["tusmallkatakanahalfwidth"]=65391, + ["twelvecircle"]=9323, + ["twelveparen"]=9343, + ["twelveperiod"]=9363, + ["twelveroman"]=8571, + ["twentycircle"]=9331, + ["twentyparen"]=9351, + ["twentyperiod"]=9371, + ["two"]=50, + ["twobengali"]=2536, + ["twocircle"]=9313, + ["twocircleinversesansserif"]=10123, + ["twodeva"]=2408, + ["twodotleader"]=8229, + ["twodotleadervertical"]=65072, + ["twogujarati"]=2792, + ["twogurmukhi"]=2664, + ["twohackarabic"]=1634, + ["twohangzhou"]=12322, + ["twoideographicparen"]=12833, + ["twoinferior"]=8322, + ["twomonospace"]=65298, + ["twonumeratorbengali"]=2549, + ["twoparen"]=9333, + ["twoperiod"]=9353, + ["twopersian"]=1778, + ["tworoman"]=8561, + ["twostroke"]=443, + ["twosuperior"]=178, + ["twothai"]=3666, + ["twothirds"]=8532, + ["u"]=117, + ["uacute"]=250, + ["ubar"]=649, + ["ubengali"]=2441, + ["ubopomofo"]=12584, + ["ubreve"]=365, + ["ucaron"]=468, + ["ucircle"]=9444, + ["ucircumflex"]=251, + ["ucircumflexbelow"]=7799, + ["ucyrillic"]=1091, + ["udattadeva"]=2385, + ["udblgrave"]=533, + ["udeva"]=2313, + ["udieresis"]=252, + ["udieresisacute"]=472, + ["udieresisbelow"]=7795, + ["udieresiscaron"]=474, + ["udieresiscyrillic"]=1265, + ["udieresisgrave"]=476, + ["udieresismacron"]=470, + ["udotbelow"]=7909, + ["ugrave"]=249, + ["ugujarati"]=2697, + ["ugurmukhi"]=2569, + ["uhiragana"]=12358, + ["uhookabove"]=7911, + ["uhorn"]=432, + ["uhornacute"]=7913, + ["uhorndotbelow"]=7921, + ["uhorngrave"]=7915, + ["uhornhookabove"]=7917, + ["uhorntilde"]=7919, + ["uhungarumlaut"]=369, + ["uhungarumlautcyrillic"]=1267, + ["uinvertedbreve"]=535, + ["ukatakana"]=12454, + ["ukatakanahalfwidth"]=65395, + ["ukcyrillic"]=1145, + ["ukorean"]=12636, + ["umacron"]=363, + ["umacroncyrillic"]=1263, + ["umacrondieresis"]=7803, + ["umatragurmukhi"]=2625, + ["umonospace"]=65365, + ["underscore"]=95, + ["underscoredbl"]=8215, + ["underscoremonospace"]=65343, + ["underscorevertical"]=65075, + ["underscorewavy"]=65103, + ["union"]=8746, + ["universal"]=8704, + ["uogonek"]=371, + ["uparen"]=9392, + ["upblock"]=9600, + ["upperdothebrew"]=1476, + ["upsilon"]=965, + ["upsilondieresis"]=971, + ["upsilondieresistonos"]=944, + ["upsilonlatin"]=650, + ["upsilontonos"]=973, + ["uptackbelowcmb"]=797, + ["uptackmod"]=724, + ["uragurmukhi"]=2675, + ["uring"]=367, + ["ushortcyrillic"]=1118, + ["usmallhiragana"]=12357, + ["usmallkatakana"]=12453, + ["usmallkatakanahalfwidth"]=65385, + ["ustraightcyrillic"]=1199, + ["ustraightstrokecyrillic"]=1201, + ["utilde"]=361, + ["utildeacute"]=7801, + ["utildebelow"]=7797, + ["uubengali"]=2442, + ["uudeva"]=2314, + ["uugujarati"]=2698, + ["uugurmukhi"]=2570, + ["uumatragurmukhi"]=2626, + ["uuvowelsignbengali"]=2498, + ["uuvowelsigndeva"]=2370, + ["uuvowelsigngujarati"]=2754, + ["uvowelsignbengali"]=2497, + ["uvowelsigndeva"]=2369, + ["uvowelsigngujarati"]=2753, + ["v"]=118, + ["vadeva"]=2357, + ["vagujarati"]=2741, + ["vagurmukhi"]=2613, + ["vakatakana"]=12535, + ["vavdageshhebrew"]=64309, + ["vavhebrew"]=1493, + ["vavholamhebrew"]=64331, + ["vavvavhebrew"]=1520, + ["vavyodhebrew"]=1521, + ["vcircle"]=9445, + ["vdotbelow"]=7807, + ["vecyrillic"]=1074, + ["veharabic"]=1700, + ["vehfinalarabic"]=64363, + ["vehinitialarabic"]=64364, + ["vehmedialarabic"]=64365, + ["vekatakana"]=12537, + ["venus"]=9792, + ["verticalbar"]=124, + ["verticallineabovecmb"]=781, + ["verticallinebelowcmb"]=809, + ["verticallinelowmod"]=716, + ["verticallinemod"]=712, + ["vewarmenian"]=1406, + ["vhook"]=651, + ["vikatakana"]=12536, + ["viramabengali"]=2509, + ["viramadeva"]=2381, + ["viramagujarati"]=2765, + ["visargabengali"]=2435, + ["visargadeva"]=2307, + ["visargagujarati"]=2691, + ["vmonospace"]=65366, + ["voarmenian"]=1400, + ["voicediterationhiragana"]=12446, + ["voicediterationkatakana"]=12542, + ["voicedmarkkana"]=12443, + ["voicedmarkkanahalfwidth"]=65438, + ["vokatakana"]=12538, + ["vparen"]=9393, + ["vtilde"]=7805, + ["vturned"]=652, + ["vuhiragana"]=12436, + ["vukatakana"]=12532, + ["w"]=119, + ["wacute"]=7811, + ["waekorean"]=12633, + ["wahiragana"]=12431, + ["wakatakana"]=12527, + ["wakatakanahalfwidth"]=65436, + ["wakorean"]=12632, + ["wasmallhiragana"]=12430, + ["wasmallkatakana"]=12526, + ["wattosquare"]=13143, + ["wavedash"]=12316, + ["wavyunderscorevertical"]=65076, + ["wawarabic"]=1608, + ["wawfinalarabic"]=65262, + ["wawhamzaabovearabic"]=1572, + ["wawhamzaabovefinalarabic"]=65158, + ["wbsquare"]=13277, + ["wcircle"]=9446, + ["wcircumflex"]=373, + ["wdieresis"]=7813, + ["wdotaccent"]=7815, + ["wdotbelow"]=7817, + ["wehiragana"]=12433, + ["weierstrass"]=8472, + ["wekatakana"]=12529, + ["wekorean"]=12638, + ["weokorean"]=12637, + ["wgrave"]=7809, + ["whitebullet"]=9702, + ["whitecircle"]=9675, + ["whitecircleinverse"]=9689, + ["whitecornerbracketleft"]=12302, + ["whitecornerbracketleftvertical"]=65091, + ["whitecornerbracketright"]=12303, + ["whitecornerbracketrightvertical"]=65092, + ["whitediamond"]=9671, + ["whitediamondcontainingblacksmalldiamond"]=9672, + ["whitedownpointingsmalltriangle"]=9663, + ["whitedownpointingtriangle"]=9661, + ["whiteleftpointingsmalltriangle"]=9667, + ["whiteleftpointingtriangle"]=9665, + ["whitelenticularbracketleft"]=12310, + ["whitelenticularbracketright"]=12311, + ["whiterightpointingsmalltriangle"]=9657, + ["whiterightpointingtriangle"]=9655, + ["whitesmallsquare"]=9643, + ["whitesmilingface"]=9786, + ["whitesquare"]=9633, + ["whitestar"]=9734, + ["whitetelephone"]=9743, + ["whitetortoiseshellbracketleft"]=12312, + ["whitetortoiseshellbracketright"]=12313, + ["whiteuppointingsmalltriangle"]=9653, + ["whiteuppointingtriangle"]=9651, + ["wihiragana"]=12432, + ["wikatakana"]=12528, + ["wikorean"]=12639, + ["wmonospace"]=65367, + ["wohiragana"]=12434, + ["wokatakana"]=12530, + ["wokatakanahalfwidth"]=65382, + ["won"]=8361, + ["wonmonospace"]=65510, + ["wowaenthai"]=3623, + ["wparen"]=9394, + ["wring"]=7832, + ["wsuperior"]=695, + ["wturned"]=653, + ["wynn"]=447, + ["x"]=120, + ["xabovecmb"]=829, + ["xbopomofo"]=12562, + ["xcircle"]=9447, + ["xdieresis"]=7821, + ["xdotaccent"]=7819, + ["xeharmenian"]=1389, + ["xi"]=958, + ["xmonospace"]=65368, + ["xparen"]=9395, + ["xsuperior"]=739, + ["y"]=121, + ["yaadosquare"]=13134, + ["yabengali"]=2479, + ["yacute"]=253, + ["yadeva"]=2351, + ["yaekorean"]=12626, + ["yagujarati"]=2735, + ["yagurmukhi"]=2607, + ["yahiragana"]=12420, + ["yakatakana"]=12516, + ["yakatakanahalfwidth"]=65428, + ["yakorean"]=12625, + ["yamakkanthai"]=3662, + ["yasmallhiragana"]=12419, + ["yasmallkatakana"]=12515, + ["yasmallkatakanahalfwidth"]=65388, + ["yatcyrillic"]=1123, + ["ycircle"]=9448, + ["ycircumflex"]=375, + ["ydieresis"]=255, + ["ydotaccent"]=7823, + ["ydotbelow"]=7925, + ["yeharabic"]=1610, + ["yehbarreearabic"]=1746, + ["yehbarreefinalarabic"]=64431, + ["yehfinalarabic"]=65266, + ["yehhamzaabovearabic"]=1574, + ["yehhamzaabovefinalarabic"]=65162, + ["yehhamzaaboveinitialarabic"]=65163, + ["yehhamzaabovemedialarabic"]=65164, + ["yehinitialarabic"]=65267, + ["yehmedialarabic"]=65268, + ["yehmeeminitialarabic"]=64733, + ["yehmeemisolatedarabic"]=64600, + ["yehnoonfinalarabic"]=64660, + ["yehthreedotsbelowarabic"]=1745, + ["yekorean"]=12630, + ["yen"]=165, + ["yenmonospace"]=65509, + ["yeokorean"]=12629, + ["yeorinhieuhkorean"]=12678, + ["yerahbenyomolefthebrew"]=1450, + ["yericyrillic"]=1099, + ["yerudieresiscyrillic"]=1273, + ["yesieungkorean"]=12673, + ["yesieungpansioskorean"]=12675, + ["yesieungsioskorean"]=12674, + ["yetivhebrew"]=1434, + ["ygrave"]=7923, + ["yhook"]=436, + ["yhookabove"]=7927, + ["yiarmenian"]=1397, + ["yicyrillic"]=1111, + ["yikorean"]=12642, + ["yinyang"]=9775, + ["yiwnarmenian"]=1410, + ["ymonospace"]=65369, + ["yoddageshhebrew"]=64313, + ["yodhebrew"]=1497, + ["yodyodhebrew"]=1522, + ["yodyodpatahhebrew"]=64287, + ["yohiragana"]=12424, + ["yoikorean"]=12681, + ["yokatakana"]=12520, + ["yokatakanahalfwidth"]=65430, + ["yokorean"]=12635, + ["yosmallhiragana"]=12423, + ["yosmallkatakana"]=12519, + ["yosmallkatakanahalfwidth"]=65390, + ["yotgreek"]=1011, + ["yoyaekorean"]=12680, + ["yoyakorean"]=12679, + ["yoyakthai"]=3618, + ["yoyingthai"]=3597, + ["yparen"]=9396, + ["ypogegrammeni"]=890, + ["ypogegrammenigreekcmb"]=837, + ["yr"]=422, + ["yring"]=7833, + ["ysuperior"]=696, + ["ytilde"]=7929, + ["yturned"]=654, + ["yuhiragana"]=12422, + ["yuikorean"]=12684, + ["yukatakana"]=12518, + ["yukatakanahalfwidth"]=65429, + ["yukorean"]=12640, + ["yusbigcyrillic"]=1131, + ["yusbigiotifiedcyrillic"]=1133, + ["yuslittlecyrillic"]=1127, + ["yuslittleiotifiedcyrillic"]=1129, + ["yusmallhiragana"]=12421, + ["yusmallkatakana"]=12517, + ["yusmallkatakanahalfwidth"]=65389, + ["yuyekorean"]=12683, + ["yuyeokorean"]=12682, + ["yyabengali"]=2527, + ["yyadeva"]=2399, + ["z"]=122, + ["zaarmenian"]=1382, + ["zacute"]=378, + ["zadeva"]=2395, + ["zagurmukhi"]=2651, + ["zaharabic"]=1592, + ["zahfinalarabic"]=65222, + ["zahinitialarabic"]=65223, + ["zahiragana"]=12374, + ["zahmedialarabic"]=65224, + ["zainarabic"]=1586, + ["zainfinalarabic"]=65200, + ["zakatakana"]=12470, + ["zaqefgadolhebrew"]=1429, + ["zaqefqatanhebrew"]=1428, + ["zarqahebrew"]=1432, + ["zayindageshhebrew"]=64310, + ["zayinhebrew"]=1494, + ["zbopomofo"]=12567, + ["zcaron"]=382, + ["zcircle"]=9449, + ["zcircumflex"]=7825, + ["zcurl"]=657, + ["zdotaccent"]=380, + ["zdotbelow"]=7827, + ["zecyrillic"]=1079, + ["zedescendercyrillic"]=1177, + ["zedieresiscyrillic"]=1247, + ["zehiragana"]=12380, + ["zekatakana"]=12476, + ["zero"]=48, + ["zerobengali"]=2534, + ["zerodeva"]=2406, + ["zerogujarati"]=2790, + ["zerogurmukhi"]=2662, + ["zerohackarabic"]=1632, + ["zeroinferior"]=8320, + ["zeromonospace"]=65296, + ["zeropersian"]=1776, + ["zerosuperior"]=8304, + ["zerothai"]=3664, + ["zerowidthjoiner"]=65279, + ["zerowidthnonjoiner"]=8204, + ["zerowidthspace"]=8203, + ["zeta"]=950, + ["zhbopomofo"]=12563, + ["zhearmenian"]=1386, + ["zhebrevecyrillic"]=1218, + ["zhecyrillic"]=1078, + ["zhedescendercyrillic"]=1175, + ["zhedieresiscyrillic"]=1245, + ["zihiragana"]=12376, + ["zikatakana"]=12472, + ["zinorhebrew"]=1454, + ["zlinebelow"]=7829, + ["zmonospace"]=65370, + ["zohiragana"]=12382, + ["zokatakana"]=12478, + ["zparen"]=9397, + ["zretroflexhook"]=656, + ["zstroke"]=438, + ["zuhiragana"]=12378, + ["zukatakana"]=12474, + + -- extras + + ["Dcroat"]=272, + ["Delta"]=8710, + ["Euro"]=8364, + ["H18533"]=9679, + ["H18543"]=9642, + ["H18551"]=9643, + ["H22073"]=9633, + ["Ldot"]=319, + ["Oslashacute"]=510, + ["SF10000"]=9484, + ["SF20000"]=9492, + ["SF30000"]=9488, + ["SF40000"]=9496, + ["SF50000"]=9532, + ["SF60000"]=9516, + ["SF70000"]=9524, + ["SF80000"]=9500, + ["SF90000"]=9508, + ["Upsilon1"]=978, + ["afii10066"]=1073, + ["afii10067"]=1074, + ["afii10068"]=1075, + ["afii10069"]=1076, + ["afii10070"]=1077, + ["afii10071"]=1105, + ["afii10072"]=1078, + ["afii10073"]=1079, + ["afii10074"]=1080, + ["afii10075"]=1081, + ["afii10076"]=1082, + ["afii10077"]=1083, + ["afii10078"]=1084, + ["afii10079"]=1085, + ["afii10080"]=1086, + ["afii10081"]=1087, + ["afii10082"]=1088, + ["afii10083"]=1089, + ["afii10084"]=1090, + ["afii10085"]=1091, + ["afii10086"]=1092, + ["afii10087"]=1093, + ["afii10088"]=1094, + ["afii10089"]=1095, + ["afii10090"]=1096, + ["afii10091"]=1097, + ["afii10092"]=1098, + ["afii10093"]=1099, + ["afii10094"]=1100, + ["afii10095"]=1101, + ["afii10096"]=1102, + ["afii10097"]=1103, + ["afii10098"]=1169, + ["afii10099"]=1106, + ["afii10100"]=1107, + ["afii10101"]=1108, + ["afii10102"]=1109, + ["afii10103"]=1110, + ["afii10104"]=1111, + ["afii10105"]=1112, + ["afii10106"]=1113, + ["afii10107"]=1114, + ["afii10108"]=1115, + ["afii10109"]=1116, + ["afii10110"]=1118, + ["afii10193"]=1119, + ["afii10194"]=1123, + ["afii10195"]=1139, + ["afii10196"]=1141, + ["afii10846"]=1241, + ["afii208"]=8213, + ["afii57381"]=1642, + ["afii57388"]=1548, + ["afii57392"]=1632, + ["afii57393"]=1633, + ["afii57394"]=1634, + ["afii57395"]=1635, + ["afii57396"]=1636, + ["afii57397"]=1637, + ["afii57398"]=1638, + ["afii57399"]=1639, + ["afii57400"]=1640, + ["afii57401"]=1641, + ["afii57403"]=1563, + ["afii57407"]=1567, + ["afii57409"]=1569, + ["afii57410"]=1570, + ["afii57411"]=1571, + ["afii57412"]=1572, + ["afii57413"]=1573, + ["afii57414"]=1574, + ["afii57415"]=1575, + ["afii57416"]=1576, + ["afii57417"]=1577, + ["afii57418"]=1578, + ["afii57419"]=1579, + ["afii57420"]=1580, + ["afii57421"]=1581, + ["afii57422"]=1582, + ["afii57423"]=1583, + ["afii57424"]=1584, + ["afii57425"]=1585, + ["afii57426"]=1586, + ["afii57427"]=1587, + ["afii57428"]=1588, + ["afii57429"]=1589, + ["afii57430"]=1590, + ["afii57431"]=1591, + ["afii57432"]=1592, + ["afii57433"]=1593, + ["afii57434"]=1594, + ["afii57440"]=1600, + ["afii57441"]=1601, + ["afii57442"]=1602, + ["afii57443"]=1603, + ["afii57444"]=1604, + ["afii57445"]=1605, + ["afii57446"]=1606, + ["afii57448"]=1608, + ["afii57449"]=1609, + ["afii57450"]=1610, + ["afii57451"]=1611, + ["afii57452"]=1612, + ["afii57453"]=1613, + ["afii57454"]=1614, + ["afii57455"]=1615, + ["afii57456"]=1616, + ["afii57457"]=1617, + ["afii57458"]=1618, + ["afii57470"]=1607, + ["afii57505"]=1700, + ["afii57506"]=1662, + ["afii57507"]=1670, + ["afii57508"]=1688, + ["afii57509"]=1711, + ["afii57511"]=1657, + ["afii57512"]=1672, + ["afii57513"]=1681, + ["afii57514"]=1722, + ["afii57519"]=1746, + ["afii57636"]=8362, + ["afii57645"]=1470, + ["afii57658"]=1475, + ["afii57664"]=1488, + ["afii57665"]=1489, + ["afii57666"]=1490, + ["afii57667"]=1491, + ["afii57668"]=1492, + ["afii57669"]=1493, + ["afii57670"]=1494, + ["afii57671"]=1495, + ["afii57672"]=1496, + ["afii57673"]=1497, + ["afii57674"]=1498, + ["afii57675"]=1499, + ["afii57676"]=1500, + ["afii57677"]=1501, + ["afii57678"]=1502, + ["afii57679"]=1503, + ["afii57680"]=1504, + ["afii57681"]=1505, + ["afii57682"]=1506, + ["afii57683"]=1507, + ["afii57684"]=1508, + ["afii57685"]=1509, + ["afii57686"]=1510, + ["afii57687"]=1511, + ["afii57688"]=1512, + ["afii57689"]=1513, + ["afii57690"]=1514, + ["afii57716"]=1520, + ["afii57717"]=1521, + ["afii57718"]=1522, + ["afii57793"]=1460, + ["afii57794"]=1461, + ["afii57795"]=1462, + ["afii57796"]=1467, + ["afii57797"]=1464, + ["afii57798"]=1463, + ["afii57799"]=1456, + ["afii57800"]=1458, + ["afii57801"]=1457, + ["afii57802"]=1459, + ["afii57803"]=1474, + ["afii57804"]=1473, + ["afii57806"]=1465, + ["afii57807"]=1468, + ["afii57839"]=1469, + ["afii57841"]=1471, + ["afii57842"]=1472, + ["afii57929"]=700, + ["afii61248"]=8453, + ["afii61289"]=8467, + ["afii61352"]=8470, + ["afii61664"]=8204, + ["afii63167"]=1645, + ["afii64937"]=701, + ["arrowdblboth"]=8660, + ["arrowdblleft"]=8656, + ["arrowdblright"]=8658, + ["arrowupdnbse"]=8616, + ["bar"]=124, + ["circle"]=9675, + ["circlemultiply"]=8855, + ["circleplus"]=8853, + ["club"]=9827, + ["colonmonetary"]=8353, + ["dcroat"]=273, + ["dkshade"]=9619, + ["existential"]=8707, + ["female"]=9792, + ["gradient"]=8711, + ["heart"]=9829, + ["hookabovecomb"]=777, + ["invcircle"]=9689, + ["ldot"]=320, + ["longs"]=383, + ["ltshade"]=9617, + ["male"]=9794, + ["mu"]=181, + ["napostrophe"]=329, + ["notelement"]=8713, + ["omega1"]=982, + ["openbullet"]=9702, + ["orthogonal"]=8735, + ["oslashacute"]=511, + ["phi1"]=981, + ["propersubset"]=8834, + ["propersuperset"]=8835, + ["reflexsubset"]=8838, + ["reflexsuperset"]=8839, + ["shade"]=9618, + ["sigma1"]=962, + ["similar"]=8764, + ["smileface"]=9786, + ["spacehackarabic"]=32, + ["spade"]=9824, + ["theta1"]=977, + ["twodotenleader"]=8229, +} diff --git a/Master/texmf-dist/tex/context/base/font-agl.lua b/Master/texmf-dist/tex/context/base/font-agl.lua index 8a087b12381..a81d3503c42 100644 --- a/Master/texmf-dist/tex/context/base/font-agl.lua +++ b/Master/texmf-dist/tex/context/base/font-agl.lua @@ -3,3693 +3,281 @@ if not modules then modules = { } end modules ['font-map'] = { comment = "companion to font-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "derived from http://www.adobe.com/devnet/opentype/archives/glyphlist.txt", - comment = "Adobe Glyph List, version 2.0, September 20, 2002", + original = "Adobe Glyph List, version 2.0, September 20, 2002", } -fonts = fonts or { } -fonts.map = fonts.map or { } +local allocate = utilities.storage.allocate -fonts.map.unicode_to_agl = { - "controlSTX", - "controlSOT", - "controlETX", - "controlEOT", - "controlENQ", - "controlACK", - "controlBEL", - "controlBS", - "controlHT", - "controlLF", - "controlVT", - "controlFF", - "controlCR", - "controlSO", - "controlSI", - "controlDLE", - "controlDC1", - "controlDC2", - "controlDC3", - "controlDC4", - "controlNAK", - "controlSYN", - "controlETB", - "controlCAN", - "controlEM", - "controlSUB", - "controlESC", - "controlFS", - "controlGS", - "controlRS", - "controlUS", - "spacehackarabic", - "exclam", - "quotedbl", - "numbersign", - "dollar", - "percent", - "ampersand", - "quotesingle", - "parenleft", - "parenright", - "asterisk", - "plus", - "comma", - "hyphen", - "period", - "slash", - "zero", - "one", - "two", - "three", - "four", - "five", - "six", - "seven", - "eight", - "nine", - "colon", - "semicolon", - "less", - "equal", - "greater", - "question", - "at", - "A", - "B", - "C", - "D", - "E", - "F", - "G", - "H", - "I", - "J", - "K", - "L", - "M", - "N", - "O", - "P", - "Q", - "R", - "S", - "T", - "U", - "V", - "W", - "X", - "Y", - "Z", - "bracketleft", - "backslash", - "bracketright", - "asciicircum", - "underscore", - "grave", - "a", - "b", - "c", - "d", - "e", - "f", - "g", - "h", - "i", - "j", - "k", - "l", - "m", - "n", - "o", - "p", - "q", - "r", - "s", - "t", - "u", - "v", - "w", - "x", - "y", - "z", - "braceleft", - "verticalbar", - "braceright", - "asciitilde", - "controlDEL", - [0x00A0] = "nonbreakingspace", - [0x00A1] = "exclamdown", - [0x00A2] = "cent", - [0x00A3] = "sterling", - [0x00A4] = "currency", - [0x00A5] = "yen", - [0x00A6] = "brokenbar", - [0x00A7] = "section", - [0x00A8] = "dieresis", - [0x00A9] = "copyright", - [0x00AA] = "ordfeminine", - [0x00AB] = "guillemotleft", - [0x00AC] = "logicalnot", - [0x00AD] = "softhyphen", - [0x00AE] = "registered", - [0x00AF] = "overscore", - [0x00B0] = "degree", - [0x00B1] = "plusminus", - [0x00B2] = "twosuperior", - [0x00B3] = "threesuperior", - [0x00B4] = "acute", - [0x00B5] = "mu1", - [0x00B6] = "paragraph", - [0x00B7] = "periodcentered", - [0x00B8] = "cedilla", - [0x00B9] = "onesuperior", - [0x00BA] = "ordmasculine", - [0x00BB] = "guillemotright", - [0x00BC] = "onequarter", - [0x00BD] = "onehalf", - [0x00BE] = "threequarters", - [0x00BF] = "questiondown", - [0x00C0] = "Agrave", - [0x00C1] = "Aacute", - [0x00C2] = "Acircumflex", - [0x00C3] = "Atilde", - [0x00C4] = "Adieresis", - [0x00C5] = "Aring", - [0x00C6] = "AE", - [0x00C7] = "Ccedilla", - [0x00C8] = "Egrave", - [0x00C9] = "Eacute", - [0x00CA] = "Ecircumflex", - [0x00CB] = "Edieresis", - [0x00CC] = "Igrave", - [0x00CD] = "Iacute", - [0x00CE] = "Icircumflex", - [0x00CF] = "Idieresis", - [0x00D0] = "Eth", - [0x00D1] = "Ntilde", - [0x00D2] = "Ograve", - [0x00D3] = "Oacute", - [0x00D4] = "Ocircumflex", - [0x00D5] = "Otilde", - [0x00D6] = "Odieresis", - [0x00D7] = "multiply", - [0x00D8] = "Oslash", - [0x00D9] = "Ugrave", - [0x00DA] = "Uacute", - [0x00DB] = "Ucircumflex", - [0x00DC] = "Udieresis", - [0x00DD] = "Yacute", - [0x00DE] = "Thorn", - [0x00DF] = "germandbls", - [0x00E0] = "agrave", - [0x00E1] = "aacute", - [0x00E2] = "acircumflex", - [0x00E3] = "atilde", - [0x00E4] = "adieresis", - [0x00E5] = "aring", - [0x00E6] = "ae", - [0x00E7] = "ccedilla", - [0x00E8] = "egrave", - [0x00E9] = "eacute", - [0x00EA] = "ecircumflex", - [0x00EB] = "edieresis", - [0x00EC] = "igrave", - [0x00ED] = "iacute", - [0x00EE] = "icircumflex", - [0x00EF] = "idieresis", - [0x00F0] = "eth", - [0x00F1] = "ntilde", - [0x00F2] = "ograve", - [0x00F3] = "oacute", - [0x00F4] = "ocircumflex", - [0x00F5] = "otilde", - [0x00F6] = "odieresis", - [0x00F7] = "divide", - [0x00F8] = "oslash", - [0x00F9] = "ugrave", - [0x00FA] = "uacute", - [0x00FB] = "ucircumflex", - [0x00FC] = "udieresis", - [0x00FD] = "yacute", - [0x00FE] = "thorn", - [0x00FF] = "ydieresis", - [0x0100] = "Amacron", - [0x0101] = "amacron", - [0x0102] = "Abreve", - [0x0103] = "abreve", - [0x0104] = "Aogonek", - [0x0105] = "aogonek", - [0x0106] = "Cacute", - [0x0107] = "cacute", - [0x0108] = "Ccircumflex", - [0x0109] = "ccircumflex", - [0x010A] = "Cdotaccent", - [0x010B] = "cdotaccent", - [0x010C] = "Ccaron", - [0x010D] = "ccaron", - [0x010E] = "Dcaron", - [0x010F] = "dcaron", - [0x0110] = "Dslash", - [0x0111] = "dmacron", - [0x0112] = "Emacron", - [0x0113] = "emacron", - [0x0114] = "Ebreve", - [0x0115] = "ebreve", - [0x0116] = "Edotaccent", - [0x0117] = "edotaccent", - [0x0118] = "Eogonek", - [0x0119] = "eogonek", - [0x011A] = "Ecaron", - [0x011B] = "ecaron", - [0x011C] = "Gcircumflex", - [0x011D] = "gcircumflex", - [0x011E] = "Gbreve", - [0x011F] = "gbreve", - [0x0120] = "Gdotaccent", - [0x0121] = "gdotaccent", - [0x0122] = "Gcommaaccent", - [0x0123] = "gcommaaccent", - [0x0124] = "Hcircumflex", - [0x0125] = "hcircumflex", - [0x0126] = "Hbar", - [0x0127] = "hbar", - [0x0128] = "Itilde", - [0x0129] = "itilde", - [0x012A] = "Imacron", - [0x012B] = "imacron", - [0x012C] = "Ibreve", - [0x012D] = "ibreve", - [0x012E] = "Iogonek", - [0x012F] = "iogonek", - [0x0130] = "Idotaccent", - [0x0131] = "dotlessi", - [0x0132] = "IJ", - [0x0133] = "ij", - [0x0134] = "Jcircumflex", - [0x0135] = "jcircumflex", - [0x0136] = "Kcommaaccent", - [0x0137] = "kcommaaccent", - [0x0138] = "kgreenlandic", - [0x0139] = "Lacute", - [0x013A] = "lacute", - [0x013B] = "Lcommaaccent", - [0x013C] = "lcommaaccent", - [0x013D] = "Lcaron", - [0x013E] = "lcaron", - [0x013F] = "Ldotaccent", - [0x0140] = "ldotaccent", - [0x0141] = "Lslash", - [0x0142] = "lslash", - [0x0143] = "Nacute", - [0x0144] = "nacute", - [0x0145] = "Ncommaaccent", - [0x0146] = "ncommaaccent", - [0x0147] = "Ncaron", - [0x0148] = "ncaron", - [0x0149] = "quoterightn", - [0x014A] = "Eng", - [0x014B] = "eng", - [0x014C] = "Omacron", - [0x014D] = "omacron", - [0x014E] = "Obreve", - [0x014F] = "obreve", - [0x0150] = "Ohungarumlaut", - [0x0151] = "ohungarumlaut", - [0x0152] = "OE", - [0x0153] = "oe", - [0x0154] = "Racute", - [0x0155] = "racute", - [0x0156] = "Rcommaaccent", - [0x0157] = "rcommaaccent", - [0x0158] = "Rcaron", - [0x0159] = "rcaron", - [0x015A] = "Sacute", - [0x015B] = "sacute", - [0x015C] = "Scircumflex", - [0x015D] = "scircumflex", - [0x015E] = "Scedilla", - [0x015F] = "scedilla", - [0x0160] = "Scaron", - [0x0161] = "scaron", - [0x0162] = "Tcommaaccent", - [0x0163] = "tcommaaccent", - [0x0164] = "Tcaron", - [0x0165] = "tcaron", - [0x0166] = "Tbar", - [0x0167] = "tbar", - [0x0168] = "Utilde", - [0x0169] = "utilde", - [0x016A] = "Umacron", - [0x016B] = "umacron", - [0x016C] = "Ubreve", - [0x016D] = "ubreve", - [0x016E] = "Uring", - [0x016F] = "uring", - [0x0170] = "Uhungarumlaut", - [0x0171] = "uhungarumlaut", - [0x0172] = "Uogonek", - [0x0173] = "uogonek", - [0x0174] = "Wcircumflex", - [0x0175] = "wcircumflex", - [0x0176] = "Ycircumflex", - [0x0177] = "ycircumflex", - [0x0178] = "Ydieresis", - [0x0179] = "Zacute", - [0x017A] = "zacute", - [0x017B] = "Zdotaccent", - [0x017C] = "zdotaccent", - [0x017D] = "Zcaron", - [0x017E] = "zcaron", - [0x017F] = "slong", - [0x0180] = "bstroke", - [0x0181] = "Bhook", - [0x0182] = "Btopbar", - [0x0183] = "btopbar", - [0x0184] = "Tonesix", - [0x0185] = "tonesix", - [0x0186] = "Oopen", - [0x0187] = "Chook", - [0x0188] = "chook", - [0x0189] = "Dafrican", - [0x018A] = "Dhook", - [0x018B] = "Dtopbar", - [0x018C] = "dtopbar", - [0x018D] = "deltaturned", - [0x018E] = "Ereversed", - [0x018F] = "Schwa", - [0x0190] = "Eopen", - [0x0191] = "Fhook", - [0x0192] = "florin", - [0x0193] = "Ghook", - [0x0194] = "Gammaafrican", - [0x0195] = "hv", - [0x0196] = "Iotaafrican", - [0x0197] = "Istroke", - [0x0198] = "Khook", - [0x0199] = "khook", - [0x019A] = "lbar", - [0x019B] = "lambdastroke", - [0x019C] = "Mturned", - [0x019D] = "Nhookleft", - [0x019E] = "nlegrightlong", - [0x019F] = "Ocenteredtilde", - [0x01A0] = "Ohorn", - [0x01A1] = "ohorn", - [0x01A2] = "Oi", - [0x01A3] = "oi", - [0x01A4] = "Phook", - [0x01A5] = "phook", - [0x01A6] = "yr", - [0x01A7] = "Tonetwo", - [0x01A8] = "tonetwo", - [0x01A9] = "Esh", - [0x01AA] = "eshreversedloop", - [0x01AB] = "tpalatalhook", - [0x01AC] = "Thook", - [0x01AD] = "thook", - [0x01AE] = "Tretroflexhook", - [0x01AF] = "Uhorn", - [0x01B0] = "uhorn", - [0x01B1] = "Upsilonafrican", - [0x01B2] = "Vhook", - [0x01B3] = "Yhook", - [0x01B4] = "yhook", - [0x01B5] = "Zstroke", - [0x01B6] = "zstroke", - [0x01B7] = "Ezh", - [0x01B8] = "Ezhreversed", - [0x01B9] = "ezhreversed", - [0x01BA] = "ezhtail", - [0x01BB] = "twostroke", - [0x01BC] = "Tonefive", - [0x01BD] = "tonefive", - [0x01BE] = "glottalinvertedstroke", - [0x01BF] = "wynn", - [0x01C0] = "clickdental", - [0x01C1] = "clicklateral", - [0x01C2] = "clickalveolar", - [0x01C3] = "clickretroflex", - [0x01C4] = "DZcaron", - [0x01C5] = "Dzcaron", - [0x01C6] = "dzcaron", - [0x01C7] = "LJ", - [0x01C8] = "Lj", - [0x01C9] = "lj", - [0x01CA] = "NJ", - [0x01CB] = "Nj", - [0x01CC] = "nj", - [0x01CD] = "Acaron", - [0x01CE] = "acaron", - [0x01CF] = "Icaron", - [0x01D0] = "icaron", - [0x01D1] = "Ocaron", - [0x01D2] = "ocaron", - [0x01D3] = "Ucaron", - [0x01D4] = "ucaron", - [0x01D5] = "Udieresismacron", - [0x01D6] = "udieresismacron", - [0x01D7] = "Udieresisacute", - [0x01D8] = "udieresisacute", - [0x01D9] = "Udieresiscaron", - [0x01DA] = "udieresiscaron", - [0x01DB] = "Udieresisgrave", - [0x01DC] = "udieresisgrave", - [0x01DD] = "eturned", - [0x01DE] = "Adieresismacron", - [0x01DF] = "adieresismacron", - [0x01E0] = "Adotmacron", - [0x01E1] = "adotmacron", - [0x01E2] = "AEmacron", - [0x01E3] = "aemacron", - [0x01E4] = "Gstroke", - [0x01E5] = "gstroke", - [0x01E6] = "Gcaron", - [0x01E7] = "gcaron", - [0x01E8] = "Kcaron", - [0x01E9] = "kcaron", - [0x01EA] = "Oogonek", - [0x01EB] = "oogonek", - [0x01EC] = "Oogonekmacron", - [0x01ED] = "oogonekmacron", - [0x01EE] = "Ezhcaron", - [0x01EF] = "ezhcaron", - [0x01F0] = "jcaron", - [0x01F1] = "DZ", - [0x01F2] = "Dz", - [0x01F3] = "dz", - [0x01F4] = "Gacute", - [0x01F5] = "gacute", - [0x01FA] = "Aringacute", - [0x01FB] = "aringacute", - [0x01FC] = "AEacute", - [0x01FD] = "aeacute", - [0x01FE] = "Ostrokeacute", - [0x01FF] = "ostrokeacute", - [0x0200] = "Adblgrave", - [0x0201] = "adblgrave", - [0x0202] = "Ainvertedbreve", - [0x0203] = "ainvertedbreve", - [0x0204] = "Edblgrave", - [0x0205] = "edblgrave", - [0x0206] = "Einvertedbreve", - [0x0207] = "einvertedbreve", - [0x0208] = "Idblgrave", - [0x0209] = "idblgrave", - [0x020A] = "Iinvertedbreve", - [0x020B] = "iinvertedbreve", - [0x020C] = "Odblgrave", - [0x020D] = "odblgrave", - [0x020E] = "Oinvertedbreve", - [0x020F] = "oinvertedbreve", - [0x0210] = "Rdblgrave", - [0x0211] = "rdblgrave", - [0x0212] = "Rinvertedbreve", - [0x0213] = "rinvertedbreve", - [0x0214] = "Udblgrave", - [0x0215] = "udblgrave", - [0x0216] = "Uinvertedbreve", - [0x0217] = "uinvertedbreve", - [0x0218] = "Scommaaccent", - [0x0219] = "scommaaccent", - [0x0250] = "aturned", - [0x0251] = "ascript", - [0x0252] = "ascriptturned", - [0x0253] = "bhook", - [0x0254] = "oopen", - [0x0255] = "ccurl", - [0x0256] = "dtail", - [0x0257] = "dhook", - [0x0258] = "ereversed", - [0x0259] = "schwa", - [0x025A] = "schwahook", - [0x025B] = "eopen", - [0x025C] = "eopenreversed", - [0x025D] = "eopenreversedhook", - [0x025E] = "eopenreversedclosed", - [0x025F] = "jdotlessstroke", - [0x0260] = "ghook", - [0x0261] = "gscript", - [0x0263] = "gammalatinsmall", - [0x0264] = "ramshorn", - [0x0265] = "hturned", - [0x0266] = "hhook", - [0x0267] = "henghook", - [0x0268] = "istroke", - [0x0269] = "iotalatin", - [0x026B] = "lmiddletilde", - [0x026C] = "lbelt", - [0x026D] = "lhookretroflex", - [0x026E] = "lezh", - [0x026F] = "mturned", - [0x0270] = "mlonglegturned", - [0x0271] = "mhook", - [0x0272] = "nhookleft", - [0x0273] = "nhookretroflex", - [0x0275] = "obarred", - [0x0277] = "omegalatinclosed", - [0x0278] = "philatin", - [0x0279] = "rturned", - [0x027A] = "rlonglegturned", - [0x027B] = "rhookturned", - [0x027C] = "rlongleg", - [0x027D] = "rhook", - [0x027E] = "rfishhook", - [0x027F] = "rfishhookreversed", - [0x0281] = "Rsmallinverted", - [0x0282] = "shook", - [0x0283] = "esh", - [0x0284] = "dotlessjstrokehook", - [0x0285] = "eshsquatreversed", - [0x0286] = "eshcurl", - [0x0287] = "tturned", - [0x0288] = "tretroflexhook", - [0x0289] = "ubar", - [0x028A] = "upsilonlatin", - [0x028B] = "vhook", - [0x028C] = "vturned", - [0x028D] = "wturned", - [0x028E] = "yturned", - [0x0290] = "zretroflexhook", - [0x0291] = "zcurl", - [0x0292] = "ezh", - [0x0293] = "ezhcurl", - [0x0294] = "glottalstop", - [0x0295] = "glottalstopreversed", - [0x0296] = "glottalstopinverted", - [0x0297] = "cstretched", - [0x0298] = "bilabialclick", - [0x029A] = "eopenclosed", - [0x029B] = "Gsmallhook", - [0x029D] = "jcrossedtail", - [0x029E] = "kturned", - [0x02A0] = "qhook", - [0x02A1] = "glottalstopstroke", - [0x02A2] = "glottalstopstrokereversed", - [0x02A3] = "dzaltone", - [0x02A4] = "dezh", - [0x02A5] = "dzcurl", - [0x02A6] = "ts", - [0x02A7] = "tesh", - [0x02A8] = "tccurl", - [0x02B0] = "hsuperior", - [0x02B1] = "hhooksuperior", - [0x02B2] = "jsuperior", - [0x02B4] = "rturnedsuperior", - [0x02B5] = "rhookturnedsuperior", - [0x02B6] = "Rsmallinvertedsuperior", - [0x02B7] = "wsuperior", - [0x02B8] = "ysuperior", - [0x02B9] = "primemod", - [0x02BA] = "dblprimemod", - [0x02BB] = "commaturnedmod", - [0x02BC] = "apostrophemod", - [0x02BD] = "commareversedmod", - [0x02BE] = "ringhalfright", - [0x02BF] = "ringhalfleft", - [0x02C0] = "glottalstopmod", - [0x02C1] = "glottalstopreversedmod", - [0x02C2] = "arrowheadleftmod", - [0x02C3] = "arrowheadrightmod", - [0x02C4] = "arrowheadupmod", - [0x02C5] = "arrowheaddownmod", - [0x02C6] = "circumflex", - [0x02C7] = "caron", - [0x02C8] = "verticallinemod", - [0x02C9] = "firsttonechinese", - [0x02CA] = "secondtonechinese", - [0x02CB] = "fourthtonechinese", - [0x02CC] = "verticallinelowmod", - [0x02CD] = "macronlowmod", - [0x02CE] = "gravelowmod", - [0x02CF] = "acutelowmod", - [0x02D0] = "colontriangularmod", - [0x02D1] = "colontriangularhalfmod", - [0x02D2] = "ringhalfrightcentered", - [0x02D3] = "ringhalfleftcentered", - [0x02D4] = "uptackmod", - [0x02D5] = "downtackmod", - [0x02D6] = "plusmod", - [0x02D7] = "minusmod", - [0x02D8] = "breve", - [0x02D9] = "dotaccent", - [0x02DA] = "ring", - [0x02DB] = "ogonek", - [0x02DC] = "tilde", - [0x02DD] = "hungarumlaut", - [0x02DE] = "rhotichookmod", - [0x02E0] = "gammasuperior", - [0x02E3] = "xsuperior", - [0x02E4] = "glottalstopreversedsuperior", - [0x02E5] = "tonebarextrahighmod", - [0x02E6] = "tonebarhighmod", - [0x02E7] = "tonebarmidmod", - [0x02E8] = "tonebarlowmod", - [0x02E9] = "tonebarextralowmod", - [0x0300] = "gravecomb", - [0x0301] = "acutecomb", - [0x0302] = "circumflexcmb", - [0x0303] = "tildecomb", - [0x0304] = "macroncmb", - [0x0305] = "overlinecmb", - [0x0306] = "brevecmb", - [0x0307] = "dotaccentcmb", - [0x0308] = "dieresiscmb", - [0x0309] = "hookcmb", - [0x030A] = "ringcmb", - [0x030B] = "hungarumlautcmb", - [0x030C] = "caroncmb", - [0x030D] = "verticallineabovecmb", - [0x030E] = "dblverticallineabovecmb", - [0x030F] = "dblgravecmb", - [0x0310] = "candrabinducmb", - [0x0311] = "breveinvertedcmb", - [0x0312] = "commaturnedabovecmb", - [0x0313] = "commaabovecmb", - [0x0314] = "commareversedabovecmb", - [0x0315] = "commaaboverightcmb", - [0x0316] = "gravebelowcmb", - [0x0317] = "acutebelowcmb", - [0x0318] = "lefttackbelowcmb", - [0x0319] = "righttackbelowcmb", - [0x031A] = "leftangleabovecmb", - [0x031B] = "horncmb", - [0x031C] = "ringhalfleftbelowcmb", - [0x031D] = "uptackbelowcmb", - [0x031E] = "downtackbelowcmb", - [0x031F] = "plusbelowcmb", - [0x0320] = "minusbelowcmb", - [0x0321] = "hookpalatalizedbelowcmb", - [0x0322] = "hookretroflexbelowcmb", - [0x0323] = "dotbelowcomb", - [0x0324] = "dieresisbelowcmb", - [0x0325] = "ringbelowcmb", - [0x0327] = "cedillacmb", - [0x0328] = "ogonekcmb", - [0x0329] = "verticallinebelowcmb", - [0x032A] = "bridgebelowcmb", - [0x032B] = "dblarchinvertedbelowcmb", - [0x032C] = "caronbelowcmb", - [0x032D] = "circumflexbelowcmb", - [0x032E] = "brevebelowcmb", - [0x032F] = "breveinvertedbelowcmb", - [0x0330] = "tildebelowcmb", - [0x0331] = "macronbelowcmb", - [0x0332] = "lowlinecmb", - [0x0333] = "dbllowlinecmb", - [0x0334] = "tildeoverlaycmb", - [0x0335] = "strokeshortoverlaycmb", - [0x0336] = "strokelongoverlaycmb", - [0x0337] = "solidusshortoverlaycmb", - [0x0338] = "soliduslongoverlaycmb", - [0x0339] = "ringhalfrightbelowcmb", - [0x033A] = "bridgeinvertedbelowcmb", - [0x033B] = "squarebelowcmb", - [0x033C] = "seagullbelowcmb", - [0x033D] = "xabovecmb", - [0x033E] = "tildeverticalcmb", - [0x033F] = "dbloverlinecmb", - [0x0340] = "gravetonecmb", - [0x0341] = "acutetonecmb", - [0x0342] = "perispomenigreekcmb", - [0x0343] = "koroniscmb", - [0x0344] = "dialytikatonoscmb", - [0x0345] = "ypogegrammenigreekcmb", - [0x0360] = "tildedoublecmb", - [0x0361] = "breveinverteddoublecmb", - [0x0374] = "numeralsigngreek", - [0x0375] = "numeralsignlowergreek", - [0x037A] = "ypogegrammeni", - [0x037E] = "questiongreek", - [0x0384] = "tonos", - [0x0385] = "dieresistonos", - [0x0386] = "Alphatonos", - [0x0387] = "anoteleia", - [0x0388] = "Epsilontonos", - [0x0389] = "Etatonos", - [0x038A] = "Iotatonos", - [0x038C] = "Omicrontonos", - [0x038E] = "Upsilontonos", - [0x038F] = "Omegatonos", - [0x0390] = "iotadieresistonos", - [0x0391] = "Alpha", - [0x0392] = "Beta", - [0x0393] = "Gamma", - [0x0394] = "Deltagreek", - [0x0395] = "Epsilon", - [0x0396] = "Zeta", - [0x0397] = "Eta", - [0x0398] = "Theta", - [0x0399] = "Iota", - [0x039A] = "Kappa", - [0x039B] = "Lambda", - [0x039C] = "Mu", - [0x039D] = "Nu", - [0x039E] = "Xi", - [0x039F] = "Omicron", - [0x03A0] = "Pi", - [0x03A1] = "Rho", - [0x03A3] = "Sigma", - [0x03A4] = "Tau", - [0x03A5] = "Upsilon", - [0x03A6] = "Phi", - [0x03A7] = "Chi", - [0x03A8] = "Psi", - [0x03A9] = "Omegagreek", - [0x03AA] = "Iotadieresis", - [0x03AB] = "Upsilondieresis", - [0x03AC] = "alphatonos", - [0x03AD] = "epsilontonos", - [0x03AE] = "etatonos", - [0x03AF] = "iotatonos", - [0x03B0] = "upsilondieresistonos", - [0x03B1] = "alpha", - [0x03B2] = "beta", - [0x03B3] = "gamma", - [0x03B4] = "delta", - [0x03B5] = "epsilon", - [0x03B6] = "zeta", - [0x03B7] = "eta", - [0x03B8] = "theta", - [0x03B9] = "iota", - [0x03BA] = "kappa", - [0x03BB] = "lambda", - [0x03BC] = "mugreek", - [0x03BD] = "nu", - [0x03BE] = "xi", - [0x03BF] = "omicron", - [0x03C0] = "pi", - [0x03C1] = "rho", - [0x03C2] = "sigmafinal", - [0x03C3] = "sigma", - [0x03C4] = "tau", - [0x03C5] = "upsilon", - [0x03C6] = "phi", - [0x03C7] = "chi", - [0x03C8] = "psi", - [0x03C9] = "omega", - [0x03CA] = "iotadieresis", - [0x03CB] = "upsilondieresis", - [0x03CC] = "omicrontonos", - [0x03CD] = "upsilontonos", - [0x03CE] = "omegatonos", - [0x03D0] = "betasymbolgreek", - [0x03D1] = "thetasymbolgreek", - [0x03D2] = "Upsilonhooksymbol", - [0x03D3] = "Upsilonacutehooksymbolgreek", - [0x03D4] = "Upsilondieresishooksymbolgreek", - [0x03D5] = "phisymbolgreek", - [0x03D6] = "pisymbolgreek", - [0x03DA] = "Stigmagreek", - [0x03DC] = "Digammagreek", - [0x03DE] = "Koppagreek", - [0x03E0] = "Sampigreek", - [0x03E2] = "Sheicoptic", - [0x03E3] = "sheicoptic", - [0x03E4] = "Feicoptic", - [0x03E5] = "feicoptic", - [0x03E6] = "Kheicoptic", - [0x03E7] = "kheicoptic", - [0x03E8] = "Horicoptic", - [0x03E9] = "horicoptic", - [0x03EA] = "Gangiacoptic", - [0x03EB] = "gangiacoptic", - [0x03EC] = "Shimacoptic", - [0x03ED] = "shimacoptic", - [0x03EE] = "Deicoptic", - [0x03EF] = "deicoptic", - [0x03F0] = "kappasymbolgreek", - [0x03F1] = "rhosymbolgreek", - [0x03F2] = "sigmalunatesymbolgreek", - [0x03F3] = "yotgreek", - [0x0401] = "afii10023", - [0x0402] = "afii10051", - [0x0403] = "afii10052", - [0x0404] = "afii10053", - [0x0405] = "afii10054", - [0x0406] = "afii10055", - [0x0407] = "afii10056", - [0x0408] = "afii10057", - [0x0409] = "afii10058", - [0x040A] = "afii10059", - [0x040B] = "afii10060", - [0x040C] = "afii10061", - [0x040E] = "afii10062", - [0x040F] = "afii10145", - [0x0410] = "afii10017", - [0x0411] = "afii10018", - [0x0412] = "afii10019", - [0x0413] = "afii10020", - [0x0414] = "afii10021", - [0x0415] = "afii10022", - [0x0416] = "afii10024", - [0x0417] = "afii10025", - [0x0418] = "afii10026", - [0x0419] = "afii10027", - [0x041A] = "afii10028", - [0x041B] = "afii10029", - [0x041C] = "afii10030", - [0x041D] = "afii10031", - [0x041E] = "afii10032", - [0x041F] = "afii10033", - [0x0420] = "afii10034", - [0x0421] = "afii10035", - [0x0422] = "afii10036", - [0x0423] = "afii10037", - [0x0424] = "afii10038", - [0x0425] = "afii10039", - [0x0426] = "afii10040", - [0x0427] = "afii10041", - [0x0428] = "afii10042", - [0x0429] = "afii10043", - [0x042A] = "afii10044", - [0x042B] = "afii10045", - [0x042C] = "afii10046", - [0x042D] = "afii10047", - [0x042E] = "afii10048", - [0x042F] = "afii10049", - [0x0430] = "afii10065", - [0x0431] = "becyrillic", - [0x0432] = "vecyrillic", - [0x0433] = "gecyrillic", - [0x0434] = "decyrillic", - [0x0435] = "iecyrillic", - [0x0436] = "zhecyrillic", - [0x0437] = "zecyrillic", - [0x0438] = "iicyrillic", - [0x0439] = "iishortcyrillic", - [0x043A] = "kacyrillic", - [0x043B] = "elcyrillic", - [0x043C] = "emcyrillic", - [0x043D] = "encyrillic", - [0x043E] = "ocyrillic", - [0x043F] = "pecyrillic", - [0x0440] = "ercyrillic", - [0x0441] = "escyrillic", - [0x0442] = "tecyrillic", - [0x0443] = "ucyrillic", - [0x0444] = "efcyrillic", - [0x0445] = "khacyrillic", - [0x0446] = "tsecyrillic", - [0x0447] = "checyrillic", - [0x0448] = "shacyrillic", - [0x0449] = "shchacyrillic", - [0x044A] = "hardsigncyrillic", - [0x044B] = "yericyrillic", - [0x044C] = "softsigncyrillic", - [0x044D] = "ereversedcyrillic", - [0x044E] = "iucyrillic", - [0x044F] = "iacyrillic", - [0x0451] = "iocyrillic", - [0x0452] = "djecyrillic", - [0x0453] = "gjecyrillic", - [0x0454] = "ecyrillic", - [0x0455] = "dzecyrillic", - [0x0456] = "icyrillic", - [0x0457] = "yicyrillic", - [0x0458] = "jecyrillic", - [0x0459] = "ljecyrillic", - [0x045A] = "njecyrillic", - [0x045B] = "tshecyrillic", - [0x045C] = "kjecyrillic", - [0x045E] = "ushortcyrillic", - [0x045F] = "dzhecyrillic", - [0x0460] = "Omegacyrillic", - [0x0461] = "omegacyrillic", - [0x0462] = "afii10146", - [0x0463] = "yatcyrillic", - [0x0464] = "Eiotifiedcyrillic", - [0x0465] = "eiotifiedcyrillic", - [0x0466] = "Yuslittlecyrillic", - [0x0467] = "yuslittlecyrillic", - [0x0468] = "Yuslittleiotifiedcyrillic", - [0x0469] = "yuslittleiotifiedcyrillic", - [0x046A] = "Yusbigcyrillic", - [0x046B] = "yusbigcyrillic", - [0x046C] = "Yusbigiotifiedcyrillic", - [0x046D] = "yusbigiotifiedcyrillic", - [0x046E] = "Ksicyrillic", - [0x046F] = "ksicyrillic", - [0x0470] = "Psicyrillic", - [0x0471] = "psicyrillic", - [0x0472] = "afii10147", - [0x0473] = "fitacyrillic", - [0x0474] = "afii10148", - [0x0475] = "izhitsacyrillic", - [0x0476] = "Izhitsadblgravecyrillic", - [0x0477] = "izhitsadblgravecyrillic", - [0x0478] = "Ukcyrillic", - [0x0479] = "ukcyrillic", - [0x047A] = "Omegaroundcyrillic", - [0x047B] = "omegaroundcyrillic", - [0x047C] = "Omegatitlocyrillic", - [0x047D] = "omegatitlocyrillic", - [0x047E] = "Otcyrillic", - [0x047F] = "otcyrillic", - [0x0480] = "Koppacyrillic", - [0x0481] = "koppacyrillic", - [0x0482] = "thousandcyrillic", - [0x0483] = "titlocyrilliccmb", - [0x0484] = "palatalizationcyrilliccmb", - [0x0485] = "dasiapneumatacyrilliccmb", - [0x0486] = "psilipneumatacyrilliccmb", - [0x0490] = "afii10050", - [0x0491] = "gheupturncyrillic", - [0x0492] = "Ghestrokecyrillic", - [0x0493] = "ghestrokecyrillic", - [0x0494] = "Ghemiddlehookcyrillic", - [0x0495] = "ghemiddlehookcyrillic", - [0x0496] = "Zhedescendercyrillic", - [0x0497] = "zhedescendercyrillic", - [0x0498] = "Zedescendercyrillic", - [0x0499] = "zedescendercyrillic", - [0x049A] = "Kadescendercyrillic", - [0x049B] = "kadescendercyrillic", - [0x049C] = "Kaverticalstrokecyrillic", - [0x049D] = "kaverticalstrokecyrillic", - [0x049E] = "Kastrokecyrillic", - [0x049F] = "kastrokecyrillic", - [0x04A0] = "Kabashkircyrillic", - [0x04A1] = "kabashkircyrillic", - [0x04A2] = "Endescendercyrillic", - [0x04A3] = "endescendercyrillic", - [0x04A4] = "Enghecyrillic", - [0x04A5] = "enghecyrillic", - [0x04A6] = "Pemiddlehookcyrillic", - [0x04A7] = "pemiddlehookcyrillic", - [0x04A8] = "Haabkhasiancyrillic", - [0x04A9] = "haabkhasiancyrillic", - [0x04AA] = "Esdescendercyrillic", - [0x04AB] = "esdescendercyrillic", - [0x04AC] = "Tedescendercyrillic", - [0x04AD] = "tedescendercyrillic", - [0x04AE] = "Ustraightcyrillic", - [0x04AF] = "ustraightcyrillic", - [0x04B0] = "Ustraightstrokecyrillic", - [0x04B1] = "ustraightstrokecyrillic", - [0x04B2] = "Hadescendercyrillic", - [0x04B3] = "hadescendercyrillic", - [0x04B4] = "Tetsecyrillic", - [0x04B5] = "tetsecyrillic", - [0x04B6] = "Chedescendercyrillic", - [0x04B7] = "chedescendercyrillic", - [0x04B8] = "Cheverticalstrokecyrillic", - [0x04B9] = "cheverticalstrokecyrillic", - [0x04BA] = "Shhacyrillic", - [0x04BB] = "shhacyrillic", - [0x04BC] = "Cheabkhasiancyrillic", - [0x04BD] = "cheabkhasiancyrillic", - [0x04BE] = "Chedescenderabkhasiancyrillic", - [0x04BF] = "chedescenderabkhasiancyrillic", - [0x04C0] = "palochkacyrillic", - [0x04C1] = "Zhebrevecyrillic", - [0x04C2] = "zhebrevecyrillic", - [0x04C3] = "Kahookcyrillic", - [0x04C4] = "kahookcyrillic", - [0x04C7] = "Enhookcyrillic", - [0x04C8] = "enhookcyrillic", - [0x04CB] = "Chekhakassiancyrillic", - [0x04CC] = "chekhakassiancyrillic", - [0x04D0] = "Abrevecyrillic", - [0x04D1] = "abrevecyrillic", - [0x04D2] = "Adieresiscyrillic", - [0x04D3] = "adieresiscyrillic", - [0x04D4] = "Aiecyrillic", - [0x04D5] = "aiecyrillic", - [0x04D6] = "Iebrevecyrillic", - [0x04D7] = "iebrevecyrillic", - [0x04D8] = "Schwacyrillic", - [0x04D9] = "schwacyrillic", - [0x04DA] = "Schwadieresiscyrillic", - [0x04DB] = "schwadieresiscyrillic", - [0x04DC] = "Zhedieresiscyrillic", - [0x04DD] = "zhedieresiscyrillic", - [0x04DE] = "Zedieresiscyrillic", - [0x04DF] = "zedieresiscyrillic", - [0x04E0] = "Dzeabkhasiancyrillic", - [0x04E1] = "dzeabkhasiancyrillic", - [0x04E2] = "Imacroncyrillic", - [0x04E3] = "imacroncyrillic", - [0x04E4] = "Idieresiscyrillic", - [0x04E5] = "idieresiscyrillic", - [0x04E6] = "Odieresiscyrillic", - [0x04E7] = "odieresiscyrillic", - [0x04E8] = "Obarredcyrillic", - [0x04E9] = "obarredcyrillic", - [0x04EA] = "Obarreddieresiscyrillic", - [0x04EB] = "obarreddieresiscyrillic", - [0x04EE] = "Umacroncyrillic", - [0x04EF] = "umacroncyrillic", - [0x04F0] = "Udieresiscyrillic", - [0x04F1] = "udieresiscyrillic", - [0x04F2] = "Uhungarumlautcyrillic", - [0x04F3] = "uhungarumlautcyrillic", - [0x04F4] = "Chedieresiscyrillic", - [0x04F5] = "chedieresiscyrillic", - [0x04F8] = "Yerudieresiscyrillic", - [0x04F9] = "yerudieresiscyrillic", - [0x0531] = "Aybarmenian", - [0x0532] = "Benarmenian", - [0x0533] = "Gimarmenian", - [0x0534] = "Daarmenian", - [0x0535] = "Echarmenian", - [0x0536] = "Zaarmenian", - [0x0537] = "Eharmenian", - [0x0538] = "Etarmenian", - [0x0539] = "Toarmenian", - [0x053A] = "Zhearmenian", - [0x053B] = "Iniarmenian", - [0x053C] = "Liwnarmenian", - [0x053D] = "Xeharmenian", - [0x053E] = "Caarmenian", - [0x053F] = "Kenarmenian", - [0x0540] = "Hoarmenian", - [0x0541] = "Jaarmenian", - [0x0542] = "Ghadarmenian", - [0x0543] = "Cheharmenian", - [0x0544] = "Menarmenian", - [0x0545] = "Yiarmenian", - [0x0546] = "Nowarmenian", - [0x0547] = "Shaarmenian", - [0x0548] = "Voarmenian", - [0x0549] = "Chaarmenian", - [0x054A] = "Peharmenian", - [0x054B] = "Jheharmenian", - [0x054C] = "Raarmenian", - [0x054D] = "Seharmenian", - [0x054E] = "Vewarmenian", - [0x054F] = "Tiwnarmenian", - [0x0550] = "Reharmenian", - [0x0551] = "Coarmenian", - [0x0552] = "Yiwnarmenian", - [0x0553] = "Piwrarmenian", - [0x0554] = "Keharmenian", - [0x0555] = "Oharmenian", - [0x0556] = "Feharmenian", - [0x0559] = "ringhalfleftarmenian", - [0x055A] = "apostrophearmenian", - [0x055B] = "emphasismarkarmenian", - [0x055C] = "exclamarmenian", - [0x055D] = "commaarmenian", - [0x055E] = "questionarmenian", - [0x055F] = "abbreviationmarkarmenian", - [0x0561] = "aybarmenian", - [0x0562] = "benarmenian", - [0x0563] = "gimarmenian", - [0x0564] = "daarmenian", - [0x0565] = "echarmenian", - [0x0566] = "zaarmenian", - [0x0567] = "eharmenian", - [0x0568] = "etarmenian", - [0x0569] = "toarmenian", - [0x056A] = "zhearmenian", - [0x056B] = "iniarmenian", - [0x056C] = "liwnarmenian", - [0x056D] = "xeharmenian", - [0x056E] = "caarmenian", - [0x056F] = "kenarmenian", - [0x0570] = "hoarmenian", - [0x0571] = "jaarmenian", - [0x0572] = "ghadarmenian", - [0x0573] = "cheharmenian", - [0x0574] = "menarmenian", - [0x0575] = "yiarmenian", - [0x0576] = "nowarmenian", - [0x0577] = "shaarmenian", - [0x0578] = "voarmenian", - [0x0579] = "chaarmenian", - [0x057A] = "peharmenian", - [0x057B] = "jheharmenian", - [0x057C] = "raarmenian", - [0x057D] = "seharmenian", - [0x057E] = "vewarmenian", - [0x057F] = "tiwnarmenian", - [0x0580] = "reharmenian", - [0x0581] = "coarmenian", - [0x0582] = "yiwnarmenian", - [0x0583] = "piwrarmenian", - [0x0584] = "keharmenian", - [0x0585] = "oharmenian", - [0x0586] = "feharmenian", - [0x0587] = "echyiwnarmenian", - [0x0589] = "periodarmenian", - [0x0591] = "etnahtalefthebrew", - [0x0592] = "segoltahebrew", - [0x0593] = "shalshelethebrew", - [0x0594] = "zaqefqatanhebrew", - [0x0595] = "zaqefgadolhebrew", - [0x0596] = "tipehalefthebrew", - [0x0597] = "reviamugrashhebrew", - [0x0598] = "zarqahebrew", - [0x0599] = "pashtahebrew", - [0x059A] = "yetivhebrew", - [0x059B] = "tevirlefthebrew", - [0x059C] = "gereshaccenthebrew", - [0x059D] = "gereshmuqdamhebrew", - [0x059E] = "gershayimaccenthebrew", - [0x059F] = "qarneyparahebrew", - [0x05A0] = "telishagedolahebrew", - [0x05A1] = "pazerhebrew", - [0x05A3] = "munahlefthebrew", - [0x05A4] = "mahapakhlefthebrew", - [0x05A5] = "merkhalefthebrew", - [0x05A6] = "merkhakefulalefthebrew", - [0x05A7] = "dargalefthebrew", - [0x05A8] = "qadmahebrew", - [0x05A9] = "telishaqetanahebrew", - [0x05AA] = "yerahbenyomolefthebrew", - [0x05AB] = "olehebrew", - [0x05AC] = "iluyhebrew", - [0x05AD] = "dehihebrew", - [0x05AE] = "zinorhebrew", - [0x05AF] = "masoracirclehebrew", - [0x05B0] = "shevawidehebrew", - [0x05B1] = "hatafsegolwidehebrew", - [0x05B2] = "hatafpatahwidehebrew", - [0x05B3] = "hatafqamatswidehebrew", - [0x05B4] = "hiriqwidehebrew", - [0x05B5] = "tserewidehebrew", - [0x05B6] = "segolwidehebrew", - [0x05B7] = "patahwidehebrew", - [0x05B8] = "qamatswidehebrew", - [0x05B9] = "holamwidehebrew", - [0x05BB] = "qubutswidehebrew", - [0x05BC] = "dageshhebrew", - [0x05BD] = "siluqlefthebrew", - [0x05BE] = "maqafhebrew", - [0x05BF] = "rafehebrew", - [0x05C0] = "paseqhebrew", - [0x05C1] = "shindothebrew", - [0x05C2] = "sindothebrew", - [0x05C3] = "sofpasuqhebrew", - [0x05C4] = "upperdothebrew", - [0x05D0] = "alefhebrew", - [0x05D1] = "bethebrew", - [0x05D2] = "gimelhebrew", - [0x05D3] = "dalettserehebrew", - [0x05D4] = "hehebrew", - [0x05D5] = "vavhebrew", - [0x05D6] = "zayinhebrew", - [0x05D7] = "hethebrew", - [0x05D8] = "tethebrew", - [0x05D9] = "yodhebrew", - [0x05DA] = "finalkafshevahebrew", - [0x05DB] = "kafhebrew", - [0x05DC] = "lamedholamhebrew", - [0x05DD] = "finalmemhebrew", - [0x05DE] = "memhebrew", - [0x05DF] = "finalnunhebrew", - [0x05E0] = "nunhebrew", - [0x05E1] = "samekhhebrew", - [0x05E2] = "ayinhebrew", - [0x05E3] = "finalpehebrew", - [0x05E4] = "pehebrew", - [0x05E5] = "finaltsadihebrew", - [0x05E6] = "tsadihebrew", - [0x05E7] = "qoftserehebrew", - [0x05E8] = "reshtserehebrew", - [0x05E9] = "shinhebrew", - [0x05EA] = "tavhebrew", - [0x05F0] = "vavvavhebrew", - [0x05F1] = "vavyodhebrew", - [0x05F2] = "yodyodhebrew", - [0x05F3] = "gereshhebrew", - [0x05F4] = "gershayimhebrew", - [0x060C] = "commaarabic", - [0x061B] = "semicolonarabic", - [0x061F] = "questionarabic", - [0x0621] = "hamzasukunarabic", - [0x0622] = "alefmaddaabovearabic", - [0x0623] = "alefhamzaabovearabic", - [0x0624] = "wawhamzaabovearabic", - [0x0625] = "alefhamzabelowarabic", - [0x0626] = "yehhamzaabovearabic", - [0x0627] = "alefarabic", - [0x0628] = "beharabic", - [0x0629] = "tehmarbutaarabic", - [0x062A] = "teharabic", - [0x062B] = "theharabic", - [0x062C] = "jeemarabic", - [0x062D] = "haharabic", - [0x062E] = "khaharabic", - [0x062F] = "dalarabic", - [0x0630] = "thalarabic", - [0x0631] = "rehyehaleflamarabic", - [0x0632] = "zainarabic", - [0x0633] = "seenarabic", - [0x0634] = "sheenarabic", - [0x0635] = "sadarabic", - [0x0636] = "dadarabic", - [0x0637] = "taharabic", - [0x0638] = "zaharabic", - [0x0639] = "ainarabic", - [0x063A] = "ghainarabic", - [0x0640] = "tatweelarabic", - [0x0641] = "feharabic", - [0x0642] = "qafarabic", - [0x0643] = "kafarabic", - [0x0644] = "lamarabic", - [0x0645] = "meemarabic", - [0x0646] = "noonarabic", - [0x0647] = "heharabic", - [0x0648] = "wawarabic", - [0x0649] = "alefmaksuraarabic", - [0x064A] = "yeharabic", - [0x064B] = "fathatanarabic", - [0x064C] = "dammatanarabic", - [0x064D] = "kasratanarabic", - [0x064E] = "fathalowarabic", - [0x064F] = "dammalowarabic", - [0x0650] = "kasraarabic", - [0x0651] = "shaddafathatanarabic", - [0x0652] = "sukunarabic", - [0x0660] = "zerohackarabic", - [0x0661] = "onehackarabic", - [0x0662] = "twohackarabic", - [0x0663] = "threehackarabic", - [0x0664] = "fourhackarabic", - [0x0665] = "fivehackarabic", - [0x0666] = "sixhackarabic", - [0x0667] = "sevenhackarabic", - [0x0668] = "eighthackarabic", - [0x0669] = "ninehackarabic", - [0x066A] = "percentarabic", - [0x066B] = "decimalseparatorpersian", - [0x066C] = "thousandsseparatorpersian", - [0x066D] = "asteriskarabic", - [0x0679] = "tteharabic", - [0x067E] = "peharabic", - [0x0686] = "tcheharabic", - [0x0688] = "ddalarabic", - [0x0691] = "rreharabic", - [0x0698] = "jeharabic", - [0x06A4] = "veharabic", - [0x06AF] = "gafarabic", - [0x06BA] = "noonghunnaarabic", - [0x06C1] = "hehaltonearabic", - [0x06D1] = "yehthreedotsbelowarabic", - [0x06D2] = "yehbarreearabic", - [0x06D5] = "afii57534", - [0x06F0] = "zeropersian", - [0x06F1] = "onepersian", - [0x06F2] = "twopersian", - [0x06F3] = "threepersian", - [0x06F4] = "fourpersian", - [0x06F5] = "fivepersian", - [0x06F6] = "sixpersian", - [0x06F7] = "sevenpersian", - [0x06F8] = "eightpersian", - [0x06F9] = "ninepersian", - [0x0901] = "candrabindudeva", - [0x0902] = "anusvaradeva", - [0x0903] = "visargadeva", - [0x0905] = "adeva", - [0x0906] = "aadeva", - [0x0907] = "ideva", - [0x0908] = "iideva", - [0x0909] = "udeva", - [0x090A] = "uudeva", - [0x090B] = "rvocalicdeva", - [0x090C] = "lvocalicdeva", - [0x090D] = "ecandradeva", - [0x090E] = "eshortdeva", - [0x090F] = "edeva", - [0x0910] = "aideva", - [0x0911] = "ocandradeva", - [0x0912] = "oshortdeva", - [0x0913] = "odeva", - [0x0914] = "audeva", - [0x0915] = "kadeva", - [0x0916] = "khadeva", - [0x0917] = "gadeva", - [0x0918] = "ghadeva", - [0x0919] = "ngadeva", - [0x091A] = "cadeva", - [0x091B] = "chadeva", - [0x091C] = "jadeva", - [0x091D] = "jhadeva", - [0x091E] = "nyadeva", - [0x091F] = "ttadeva", - [0x0920] = "tthadeva", - [0x0921] = "ddadeva", - [0x0922] = "ddhadeva", - [0x0923] = "nnadeva", - [0x0924] = "tadeva", - [0x0925] = "thadeva", - [0x0926] = "dadeva", - [0x0927] = "dhadeva", - [0x0928] = "nadeva", - [0x0929] = "nnnadeva", - [0x092A] = "padeva", - [0x092B] = "phadeva", - [0x092C] = "badeva", - [0x092D] = "bhadeva", - [0x092E] = "madeva", - [0x092F] = "yadeva", - [0x0930] = "radeva", - [0x0931] = "rradeva", - [0x0932] = "ladeva", - [0x0933] = "lladeva", - [0x0934] = "llladeva", - [0x0935] = "vadeva", - [0x0936] = "shadeva", - [0x0937] = "ssadeva", - [0x0938] = "sadeva", - [0x0939] = "hadeva", - [0x093C] = "nuktadeva", - [0x093D] = "avagrahadeva", - [0x093E] = "aavowelsigndeva", - [0x093F] = "ivowelsigndeva", - [0x0940] = "iivowelsigndeva", - [0x0941] = "uvowelsigndeva", - [0x0942] = "uuvowelsigndeva", - [0x0943] = "rvocalicvowelsigndeva", - [0x0944] = "rrvocalicvowelsigndeva", - [0x0945] = "ecandravowelsigndeva", - [0x0946] = "eshortvowelsigndeva", - [0x0947] = "evowelsigndeva", - [0x0948] = "aivowelsigndeva", - [0x0949] = "ocandravowelsigndeva", - [0x094A] = "oshortvowelsigndeva", - [0x094B] = "ovowelsigndeva", - [0x094C] = "auvowelsigndeva", - [0x094D] = "viramadeva", - [0x0950] = "omdeva", - [0x0951] = "udattadeva", - [0x0952] = "anudattadeva", - [0x0953] = "gravedeva", - [0x0954] = "acutedeva", - [0x0958] = "qadeva", - [0x0959] = "khhadeva", - [0x095A] = "ghhadeva", - [0x095B] = "zadeva", - [0x095C] = "dddhadeva", - [0x095D] = "rhadeva", - [0x095E] = "fadeva", - [0x095F] = "yyadeva", - [0x0960] = "rrvocalicdeva", - [0x0961] = "llvocalicdeva", - [0x0962] = "lvocalicvowelsigndeva", - [0x0963] = "llvocalicvowelsigndeva", - [0x0964] = "danda", - [0x0965] = "dbldanda", - [0x0966] = "zerodeva", - [0x0967] = "onedeva", - [0x0968] = "twodeva", - [0x0969] = "threedeva", - [0x096A] = "fourdeva", - [0x096B] = "fivedeva", - [0x096C] = "sixdeva", - [0x096D] = "sevendeva", - [0x096E] = "eightdeva", - [0x096F] = "ninedeva", - [0x0970] = "abbreviationsigndeva", - [0x0981] = "candrabindubengali", - [0x0982] = "anusvarabengali", - [0x0983] = "visargabengali", - [0x0985] = "abengali", - [0x0986] = "aabengali", - [0x0987] = "ibengali", - [0x0988] = "iibengali", - [0x0989] = "ubengali", - [0x098A] = "uubengali", - [0x098B] = "rvocalicbengali", - [0x098C] = "lvocalicbengali", - [0x098F] = "ebengali", - [0x0990] = "aibengali", - [0x0993] = "obengali", - [0x0994] = "aubengali", - [0x0995] = "kabengali", - [0x0996] = "khabengali", - [0x0997] = "gabengali", - [0x0998] = "ghabengali", - [0x0999] = "ngabengali", - [0x099A] = "cabengali", - [0x099B] = "chabengali", - [0x099C] = "jabengali", - [0x099D] = "jhabengali", - [0x099E] = "nyabengali", - [0x099F] = "ttabengali", - [0x09A0] = "tthabengali", - [0x09A1] = "ddabengali", - [0x09A2] = "ddhabengali", - [0x09A3] = "nnabengali", - [0x09A4] = "tabengali", - [0x09A5] = "thabengali", - [0x09A6] = "dabengali", - [0x09A7] = "dhabengali", - [0x09A8] = "nabengali", - [0x09AA] = "pabengali", - [0x09AB] = "phabengali", - [0x09AC] = "babengali", - [0x09AD] = "bhabengali", - [0x09AE] = "mabengali", - [0x09AF] = "yabengali", - [0x09B0] = "rabengali", - [0x09B2] = "labengali", - [0x09B6] = "shabengali", - [0x09B7] = "ssabengali", - [0x09B8] = "sabengali", - [0x09B9] = "habengali", - [0x09BC] = "nuktabengali", - [0x09BE] = "aavowelsignbengali", - [0x09BF] = "ivowelsignbengali", - [0x09C0] = "iivowelsignbengali", - [0x09C1] = "uvowelsignbengali", - [0x09C2] = "uuvowelsignbengali", - [0x09C3] = "rvocalicvowelsignbengali", - [0x09C4] = "rrvocalicvowelsignbengali", - [0x09C7] = "evowelsignbengali", - [0x09C8] = "aivowelsignbengali", - [0x09CB] = "ovowelsignbengali", - [0x09CC] = "auvowelsignbengali", - [0x09CD] = "viramabengali", - [0x09D7] = "aulengthmarkbengali", - [0x09DC] = "rrabengali", - [0x09DD] = "rhabengali", - [0x09DF] = "yyabengali", - [0x09E0] = "rrvocalicbengali", - [0x09E1] = "llvocalicbengali", - [0x09E2] = "lvocalicvowelsignbengali", - [0x09E3] = "llvocalicvowelsignbengali", - [0x09E6] = "zerobengali", - [0x09E7] = "onebengali", - [0x09E8] = "twobengali", - [0x09E9] = "threebengali", - [0x09EA] = "fourbengali", - [0x09EB] = "fivebengali", - [0x09EC] = "sixbengali", - [0x09ED] = "sevenbengali", - [0x09EE] = "eightbengali", - [0x09EF] = "ninebengali", - [0x09F0] = "ramiddlediagonalbengali", - [0x09F1] = "ralowerdiagonalbengali", - [0x09F2] = "rupeemarkbengali", - [0x09F3] = "rupeesignbengali", - [0x09F4] = "onenumeratorbengali", - [0x09F5] = "twonumeratorbengali", - [0x09F6] = "threenumeratorbengali", - [0x09F7] = "fournumeratorbengali", - [0x09F8] = "denominatorminusonenumeratorbengali", - [0x09F9] = "sixteencurrencydenominatorbengali", - [0x09FA] = "issharbengali", - [0x0A02] = "bindigurmukhi", - [0x0A05] = "agurmukhi", - [0x0A06] = "aagurmukhi", - [0x0A07] = "igurmukhi", - [0x0A08] = "iigurmukhi", - [0x0A09] = "ugurmukhi", - [0x0A0A] = "uugurmukhi", - [0x0A0F] = "eegurmukhi", - [0x0A10] = "aigurmukhi", - [0x0A13] = "oogurmukhi", - [0x0A14] = "augurmukhi", - [0x0A15] = "kagurmukhi", - [0x0A16] = "khagurmukhi", - [0x0A17] = "gagurmukhi", - [0x0A18] = "ghagurmukhi", - [0x0A19] = "ngagurmukhi", - [0x0A1A] = "cagurmukhi", - [0x0A1B] = "chagurmukhi", - [0x0A1C] = "jagurmukhi", - [0x0A1D] = "jhagurmukhi", - [0x0A1E] = "nyagurmukhi", - [0x0A1F] = "ttagurmukhi", - [0x0A20] = "tthagurmukhi", - [0x0A21] = "ddagurmukhi", - [0x0A22] = "ddhagurmukhi", - [0x0A23] = "nnagurmukhi", - [0x0A24] = "tagurmukhi", - [0x0A25] = "thagurmukhi", - [0x0A26] = "dagurmukhi", - [0x0A27] = "dhagurmukhi", - [0x0A28] = "nagurmukhi", - [0x0A2A] = "pagurmukhi", - [0x0A2B] = "phagurmukhi", - [0x0A2C] = "bagurmukhi", - [0x0A2D] = "bhagurmukhi", - [0x0A2E] = "magurmukhi", - [0x0A2F] = "yagurmukhi", - [0x0A30] = "ragurmukhi", - [0x0A32] = "lagurmukhi", - [0x0A35] = "vagurmukhi", - [0x0A36] = "shagurmukhi", - [0x0A38] = "sagurmukhi", - [0x0A39] = "hagurmukhi", - [0x0A3C] = "nuktagurmukhi", - [0x0A3E] = "aamatragurmukhi", - [0x0A3F] = "imatragurmukhi", - [0x0A40] = "iimatragurmukhi", - [0x0A41] = "umatragurmukhi", - [0x0A42] = "uumatragurmukhi", - [0x0A47] = "eematragurmukhi", - [0x0A48] = "aimatragurmukhi", - [0x0A4B] = "oomatragurmukhi", - [0x0A4C] = "aumatragurmukhi", - [0x0A4D] = "halantgurmukhi", - [0x0A59] = "khhagurmukhi", - [0x0A5A] = "ghhagurmukhi", - [0x0A5B] = "zagurmukhi", - [0x0A5C] = "rragurmukhi", - [0x0A5E] = "fagurmukhi", - [0x0A66] = "zerogurmukhi", - [0x0A67] = "onegurmukhi", - [0x0A68] = "twogurmukhi", - [0x0A69] = "threegurmukhi", - [0x0A6A] = "fourgurmukhi", - [0x0A6B] = "fivegurmukhi", - [0x0A6C] = "sixgurmukhi", - [0x0A6D] = "sevengurmukhi", - [0x0A6E] = "eightgurmukhi", - [0x0A6F] = "ninegurmukhi", - [0x0A70] = "tippigurmukhi", - [0x0A71] = "addakgurmukhi", - [0x0A72] = "irigurmukhi", - [0x0A73] = "uragurmukhi", - [0x0A74] = "ekonkargurmukhi", - [0x0A81] = "candrabindugujarati", - [0x0A82] = "anusvaragujarati", - [0x0A83] = "visargagujarati", - [0x0A85] = "agujarati", - [0x0A86] = "aagujarati", - [0x0A87] = "igujarati", - [0x0A88] = "iigujarati", - [0x0A89] = "ugujarati", - [0x0A8A] = "uugujarati", - [0x0A8B] = "rvocalicgujarati", - [0x0A8D] = "ecandragujarati", - [0x0A8F] = "egujarati", - [0x0A90] = "aigujarati", - [0x0A91] = "ocandragujarati", - [0x0A93] = "ogujarati", - [0x0A94] = "augujarati", - [0x0A95] = "kagujarati", - [0x0A96] = "khagujarati", - [0x0A97] = "gagujarati", - [0x0A98] = "ghagujarati", - [0x0A99] = "ngagujarati", - [0x0A9A] = "cagujarati", - [0x0A9B] = "chagujarati", - [0x0A9C] = "jagujarati", - [0x0A9D] = "jhagujarati", - [0x0A9E] = "nyagujarati", - [0x0A9F] = "ttagujarati", - [0x0AA0] = "tthagujarati", - [0x0AA1] = "ddagujarati", - [0x0AA2] = "ddhagujarati", - [0x0AA3] = "nnagujarati", - [0x0AA4] = "tagujarati", - [0x0AA5] = "thagujarati", - [0x0AA6] = "dagujarati", - [0x0AA7] = "dhagujarati", - [0x0AA8] = "nagujarati", - [0x0AAA] = "pagujarati", - [0x0AAB] = "phagujarati", - [0x0AAC] = "bagujarati", - [0x0AAD] = "bhagujarati", - [0x0AAE] = "magujarati", - [0x0AAF] = "yagujarati", - [0x0AB0] = "ragujarati", - [0x0AB2] = "lagujarati", - [0x0AB3] = "llagujarati", - [0x0AB5] = "vagujarati", - [0x0AB6] = "shagujarati", - [0x0AB7] = "ssagujarati", - [0x0AB8] = "sagujarati", - [0x0AB9] = "hagujarati", - [0x0ABC] = "nuktagujarati", - [0x0ABE] = "aavowelsigngujarati", - [0x0ABF] = "ivowelsigngujarati", - [0x0AC0] = "iivowelsigngujarati", - [0x0AC1] = "uvowelsigngujarati", - [0x0AC2] = "uuvowelsigngujarati", - [0x0AC3] = "rvocalicvowelsigngujarati", - [0x0AC4] = "rrvocalicvowelsigngujarati", - [0x0AC5] = "ecandravowelsigngujarati", - [0x0AC7] = "evowelsigngujarati", - [0x0AC8] = "aivowelsigngujarati", - [0x0AC9] = "ocandravowelsigngujarati", - [0x0ACB] = "ovowelsigngujarati", - [0x0ACC] = "auvowelsigngujarati", - [0x0ACD] = "viramagujarati", - [0x0AD0] = "omgujarati", - [0x0AE0] = "rrvocalicgujarati", - [0x0AE6] = "zerogujarati", - [0x0AE7] = "onegujarati", - [0x0AE8] = "twogujarati", - [0x0AE9] = "threegujarati", - [0x0AEA] = "fourgujarati", - [0x0AEB] = "fivegujarati", - [0x0AEC] = "sixgujarati", - [0x0AED] = "sevengujarati", - [0x0AEE] = "eightgujarati", - [0x0AEF] = "ninegujarati", - [0x0E01] = "kokaithai", - [0x0E02] = "khokhaithai", - [0x0E03] = "khokhuatthai", - [0x0E04] = "khokhwaithai", - [0x0E05] = "khokhonthai", - [0x0E06] = "khorakhangthai", - [0x0E07] = "ngonguthai", - [0x0E08] = "chochanthai", - [0x0E09] = "chochingthai", - [0x0E0A] = "chochangthai", - [0x0E0B] = "sosothai", - [0x0E0C] = "chochoethai", - [0x0E0D] = "yoyingthai", - [0x0E0E] = "dochadathai", - [0x0E0F] = "topatakthai", - [0x0E10] = "thothanthai", - [0x0E11] = "thonangmonthothai", - [0x0E12] = "thophuthaothai", - [0x0E13] = "nonenthai", - [0x0E14] = "dodekthai", - [0x0E15] = "totaothai", - [0x0E16] = "thothungthai", - [0x0E17] = "thothahanthai", - [0x0E18] = "thothongthai", - [0x0E19] = "nonuthai", - [0x0E1A] = "bobaimaithai", - [0x0E1B] = "poplathai", - [0x0E1C] = "phophungthai", - [0x0E1D] = "fofathai", - [0x0E1E] = "phophanthai", - [0x0E1F] = "fofanthai", - [0x0E20] = "phosamphaothai", - [0x0E21] = "momathai", - [0x0E22] = "yoyakthai", - [0x0E23] = "roruathai", - [0x0E24] = "ruthai", - [0x0E25] = "lolingthai", - [0x0E26] = "luthai", - [0x0E27] = "wowaenthai", - [0x0E28] = "sosalathai", - [0x0E29] = "sorusithai", - [0x0E2A] = "sosuathai", - [0x0E2B] = "hohipthai", - [0x0E2C] = "lochulathai", - [0x0E2D] = "oangthai", - [0x0E2E] = "honokhukthai", - [0x0E2F] = "paiyannoithai", - [0x0E30] = "saraathai", - [0x0E31] = "maihanakatthai", - [0x0E32] = "saraaathai", - [0x0E33] = "saraamthai", - [0x0E34] = "saraithai", - [0x0E35] = "saraiithai", - [0x0E36] = "sarauethai", - [0x0E37] = "saraueethai", - [0x0E38] = "sarauthai", - [0x0E39] = "sarauuthai", - [0x0E3A] = "phinthuthai", - [0x0E3F] = "bahtthai", - [0x0E40] = "saraethai", - [0x0E41] = "saraaethai", - [0x0E42] = "saraothai", - [0x0E43] = "saraaimaimuanthai", - [0x0E44] = "saraaimaimalaithai", - [0x0E45] = "lakkhangyaothai", - [0x0E46] = "maiyamokthai", - [0x0E47] = "maitaikhuthai", - [0x0E48] = "maiekthai", - [0x0E49] = "maithothai", - [0x0E4A] = "maitrithai", - [0x0E4B] = "maichattawathai", - [0x0E4C] = "thanthakhatthai", - [0x0E4D] = "nikhahitthai", - [0x0E4E] = "yamakkanthai", - [0x0E4F] = "fongmanthai", - [0x0E50] = "zerothai", - [0x0E51] = "onethai", - [0x0E52] = "twothai", - [0x0E53] = "threethai", - [0x0E54] = "fourthai", - [0x0E55] = "fivethai", - [0x0E56] = "sixthai", - [0x0E57] = "seventhai", - [0x0E58] = "eightthai", - [0x0E59] = "ninethai", - [0x0E5A] = "angkhankhuthai", - [0x0E5B] = "khomutthai", - [0x1E00] = "Aringbelow", - [0x1E01] = "aringbelow", - [0x1E02] = "Bdotaccent", - [0x1E03] = "bdotaccent", - [0x1E04] = "Bdotbelow", - [0x1E05] = "bdotbelow", - [0x1E06] = "Blinebelow", - [0x1E07] = "blinebelow", - [0x1E08] = "Ccedillaacute", - [0x1E09] = "ccedillaacute", - [0x1E0A] = "Ddotaccent", - [0x1E0B] = "ddotaccent", - [0x1E0C] = "Ddotbelow", - [0x1E0D] = "ddotbelow", - [0x1E0E] = "Dlinebelow", - [0x1E0F] = "dlinebelow", - [0x1E10] = "Dcedilla", - [0x1E11] = "dcedilla", - [0x1E12] = "Dcircumflexbelow", - [0x1E13] = "dcircumflexbelow", - [0x1E14] = "Emacrongrave", - [0x1E15] = "emacrongrave", - [0x1E16] = "Emacronacute", - [0x1E17] = "emacronacute", - [0x1E18] = "Ecircumflexbelow", - [0x1E19] = "ecircumflexbelow", - [0x1E1A] = "Etildebelow", - [0x1E1B] = "etildebelow", - [0x1E1C] = "Ecedillabreve", - [0x1E1D] = "ecedillabreve", - [0x1E1E] = "Fdotaccent", - [0x1E1F] = "fdotaccent", - [0x1E20] = "Gmacron", - [0x1E21] = "gmacron", - [0x1E22] = "Hdotaccent", - [0x1E23] = "hdotaccent", - [0x1E24] = "Hdotbelow", - [0x1E25] = "hdotbelow", - [0x1E26] = "Hdieresis", - [0x1E27] = "hdieresis", - [0x1E28] = "Hcedilla", - [0x1E29] = "hcedilla", - [0x1E2A] = "Hbrevebelow", - [0x1E2B] = "hbrevebelow", - [0x1E2C] = "Itildebelow", - [0x1E2D] = "itildebelow", - [0x1E2E] = "Idieresisacute", - [0x1E2F] = "idieresisacute", - [0x1E30] = "Kacute", - [0x1E31] = "kacute", - [0x1E32] = "Kdotbelow", - [0x1E33] = "kdotbelow", - [0x1E34] = "Klinebelow", - [0x1E35] = "klinebelow", - [0x1E36] = "Ldotbelow", - [0x1E37] = "ldotbelow", - [0x1E38] = "Ldotbelowmacron", - [0x1E39] = "ldotbelowmacron", - [0x1E3A] = "Llinebelow", - [0x1E3B] = "llinebelow", - [0x1E3C] = "Lcircumflexbelow", - [0x1E3D] = "lcircumflexbelow", - [0x1E3E] = "Macute", - [0x1E3F] = "macute", - [0x1E40] = "Mdotaccent", - [0x1E41] = "mdotaccent", - [0x1E42] = "Mdotbelow", - [0x1E43] = "mdotbelow", - [0x1E44] = "Ndotaccent", - [0x1E45] = "ndotaccent", - [0x1E46] = "Ndotbelow", - [0x1E47] = "ndotbelow", - [0x1E48] = "Nlinebelow", - [0x1E49] = "nlinebelow", - [0x1E4A] = "Ncircumflexbelow", - [0x1E4B] = "ncircumflexbelow", - [0x1E4C] = "Otildeacute", - [0x1E4D] = "otildeacute", - [0x1E4E] = "Otildedieresis", - [0x1E4F] = "otildedieresis", - [0x1E50] = "Omacrongrave", - [0x1E51] = "omacrongrave", - [0x1E52] = "Omacronacute", - [0x1E53] = "omacronacute", - [0x1E54] = "Pacute", - [0x1E55] = "pacute", - [0x1E56] = "Pdotaccent", - [0x1E57] = "pdotaccent", - [0x1E58] = "Rdotaccent", - [0x1E59] = "rdotaccent", - [0x1E5A] = "Rdotbelow", - [0x1E5B] = "rdotbelow", - [0x1E5C] = "Rdotbelowmacron", - [0x1E5D] = "rdotbelowmacron", - [0x1E5E] = "Rlinebelow", - [0x1E5F] = "rlinebelow", - [0x1E60] = "Sdotaccent", - [0x1E61] = "sdotaccent", - [0x1E62] = "Sdotbelow", - [0x1E63] = "sdotbelow", - [0x1E64] = "Sacutedotaccent", - [0x1E65] = "sacutedotaccent", - [0x1E66] = "Scarondotaccent", - [0x1E67] = "scarondotaccent", - [0x1E68] = "Sdotbelowdotaccent", - [0x1E69] = "sdotbelowdotaccent", - [0x1E6A] = "Tdotaccent", - [0x1E6B] = "tdotaccent", - [0x1E6C] = "Tdotbelow", - [0x1E6D] = "tdotbelow", - [0x1E6E] = "Tlinebelow", - [0x1E6F] = "tlinebelow", - [0x1E70] = "Tcircumflexbelow", - [0x1E71] = "tcircumflexbelow", - [0x1E72] = "Udieresisbelow", - [0x1E73] = "udieresisbelow", - [0x1E74] = "Utildebelow", - [0x1E75] = "utildebelow", - [0x1E76] = "Ucircumflexbelow", - [0x1E77] = "ucircumflexbelow", - [0x1E78] = "Utildeacute", - [0x1E79] = "utildeacute", - [0x1E7A] = "Umacrondieresis", - [0x1E7B] = "umacrondieresis", - [0x1E7C] = "Vtilde", - [0x1E7D] = "vtilde", - [0x1E7E] = "Vdotbelow", - [0x1E7F] = "vdotbelow", - [0x1E80] = "Wgrave", - [0x1E81] = "wgrave", - [0x1E82] = "Wacute", - [0x1E83] = "wacute", - [0x1E84] = "Wdieresis", - [0x1E85] = "wdieresis", - [0x1E86] = "Wdotaccent", - [0x1E87] = "wdotaccent", - [0x1E88] = "Wdotbelow", - [0x1E89] = "wdotbelow", - [0x1E8A] = "Xdotaccent", - [0x1E8B] = "xdotaccent", - [0x1E8C] = "Xdieresis", - [0x1E8D] = "xdieresis", - [0x1E8E] = "Ydotaccent", - [0x1E8F] = "ydotaccent", - [0x1E90] = "Zcircumflex", - [0x1E91] = "zcircumflex", - [0x1E92] = "Zdotbelow", - [0x1E93] = "zdotbelow", - [0x1E94] = "Zlinebelow", - [0x1E95] = "zlinebelow", - [0x1E96] = "hlinebelow", - [0x1E97] = "tdieresis", - [0x1E98] = "wring", - [0x1E99] = "yring", - [0x1E9A] = "arighthalfring", - [0x1E9B] = "slongdotaccent", - [0x1EA0] = "Adotbelow", - [0x1EA1] = "adotbelow", - [0x1EA2] = "Ahookabove", - [0x1EA3] = "ahookabove", - [0x1EA4] = "Acircumflexacute", - [0x1EA5] = "acircumflexacute", - [0x1EA6] = "Acircumflexgrave", - [0x1EA7] = "acircumflexgrave", - [0x1EA8] = "Acircumflexhookabove", - [0x1EA9] = "acircumflexhookabove", - [0x1EAA] = "Acircumflextilde", - [0x1EAB] = "acircumflextilde", - [0x1EAC] = "Acircumflexdotbelow", - [0x1EAD] = "acircumflexdotbelow", - [0x1EAE] = "Abreveacute", - [0x1EAF] = "abreveacute", - [0x1EB0] = "Abrevegrave", - [0x1EB1] = "abrevegrave", - [0x1EB2] = "Abrevehookabove", - [0x1EB3] = "abrevehookabove", - [0x1EB4] = "Abrevetilde", - [0x1EB5] = "abrevetilde", - [0x1EB6] = "Abrevedotbelow", - [0x1EB7] = "abrevedotbelow", - [0x1EB8] = "Edotbelow", - [0x1EB9] = "edotbelow", - [0x1EBA] = "Ehookabove", - [0x1EBB] = "ehookabove", - [0x1EBC] = "Etilde", - [0x1EBD] = "etilde", - [0x1EBE] = "Ecircumflexacute", - [0x1EBF] = "ecircumflexacute", - [0x1EC0] = "Ecircumflexgrave", - [0x1EC1] = "ecircumflexgrave", - [0x1EC2] = "Ecircumflexhookabove", - [0x1EC3] = "ecircumflexhookabove", - [0x1EC4] = "Ecircumflextilde", - [0x1EC5] = "ecircumflextilde", - [0x1EC6] = "Ecircumflexdotbelow", - [0x1EC7] = "ecircumflexdotbelow", - [0x1EC8] = "Ihookabove", - [0x1EC9] = "ihookabove", - [0x1ECA] = "Idotbelow", - [0x1ECB] = "idotbelow", - [0x1ECC] = "Odotbelow", - [0x1ECD] = "odotbelow", - [0x1ECE] = "Ohookabove", - [0x1ECF] = "ohookabove", - [0x1ED0] = "Ocircumflexacute", - [0x1ED1] = "ocircumflexacute", - [0x1ED2] = "Ocircumflexgrave", - [0x1ED3] = "ocircumflexgrave", - [0x1ED4] = "Ocircumflexhookabove", - [0x1ED5] = "ocircumflexhookabove", - [0x1ED6] = "Ocircumflextilde", - [0x1ED7] = "ocircumflextilde", - [0x1ED8] = "Ocircumflexdotbelow", - [0x1ED9] = "ocircumflexdotbelow", - [0x1EDA] = "Ohornacute", - [0x1EDB] = "ohornacute", - [0x1EDC] = "Ohorngrave", - [0x1EDD] = "ohorngrave", - [0x1EDE] = "Ohornhookabove", - [0x1EDF] = "ohornhookabove", - [0x1EE0] = "Ohorntilde", - [0x1EE1] = "ohorntilde", - [0x1EE2] = "Ohorndotbelow", - [0x1EE3] = "ohorndotbelow", - [0x1EE4] = "Udotbelow", - [0x1EE5] = "udotbelow", - [0x1EE6] = "Uhookabove", - [0x1EE7] = "uhookabove", - [0x1EE8] = "Uhornacute", - [0x1EE9] = "uhornacute", - [0x1EEA] = "Uhorngrave", - [0x1EEB] = "uhorngrave", - [0x1EEC] = "Uhornhookabove", - [0x1EED] = "uhornhookabove", - [0x1EEE] = "Uhorntilde", - [0x1EEF] = "uhorntilde", - [0x1EF0] = "Uhorndotbelow", - [0x1EF1] = "uhorndotbelow", - [0x1EF2] = "Ygrave", - [0x1EF3] = "ygrave", - [0x1EF4] = "Ydotbelow", - [0x1EF5] = "ydotbelow", - [0x1EF6] = "Yhookabove", - [0x1EF7] = "yhookabove", - [0x1EF8] = "Ytilde", - [0x1EF9] = "ytilde", - [0x2002] = "enspace", - [0x200B] = "zerowidthspace", - [0x200C] = "zerowidthnonjoiner", - [0x200D] = "afii301", - [0x200E] = "afii299", - [0x200F] = "afii300", - [0x2010] = "hyphentwo", - [0x2012] = "figuredash", - [0x2013] = "endash", - [0x2014] = "emdash", - [0x2015] = "horizontalbar", - [0x2016] = "dblverticalbar", - [0x2017] = "underscoredbl", - [0x2018] = "quoteleft", - [0x2019] = "quoteright", - [0x201A] = "quotesinglbase", - [0x201B] = "quotereversed", - [0x201C] = "quotedblleft", - [0x201D] = "quotedblright", - [0x201E] = "quotedblbase", - [0x2020] = "dagger", - [0x2021] = "daggerdbl", - [0x2022] = "bullet", - [0x2024] = "onedotenleader", - [0x2025] = "twodotleader", - [0x2026] = "ellipsis", - [0x202C] = "afii61573", - [0x202D] = "afii61574", - [0x202E] = "afii61575", - [0x2030] = "perthousand", - [0x2032] = "minute", - [0x2033] = "second", - [0x2035] = "primereversed", - [0x2039] = "guilsinglleft", - [0x203A] = "guilsinglright", - [0x203B] = "referencemark", - [0x203C] = "exclamdbl", - [0x203E] = "overline", - [0x2042] = "asterism", - [0x2044] = "fraction", - [0x2070] = "zerosuperior", - [0x2074] = "foursuperior", - [0x2075] = "fivesuperior", - [0x2076] = "sixsuperior", - [0x2077] = "sevensuperior", - [0x2078] = "eightsuperior", - [0x2079] = "ninesuperior", - [0x207A] = "plussuperior", - [0x207C] = "equalsuperior", - [0x207D] = "parenleftsuperior", - [0x207E] = "parenrightsuperior", - [0x207F] = "nsuperior", - [0x2080] = "zeroinferior", - [0x2081] = "oneinferior", - [0x2082] = "twoinferior", - [0x2083] = "threeinferior", - [0x2084] = "fourinferior", - [0x2085] = "fiveinferior", - [0x2086] = "sixinferior", - [0x2087] = "seveninferior", - [0x2088] = "eightinferior", - [0x2089] = "nineinferior", - [0x208D] = "parenleftinferior", - [0x208E] = "parenrightinferior", - [0x20A1] = "colonsign", - [0x20A2] = "cruzeiro", - [0x20A3] = "franc", - [0x20A4] = "lira", - [0x20A7] = "peseta", - [0x20A9] = "won", - [0x20AA] = "sheqelhebrew", - [0x20AB] = "dong", - [0x20AC] = "euro", - [0x2103] = "centigrade", - [0x2105] = "careof", - [0x2109] = "fahrenheit", - [0x2111] = "Ifraktur", - [0x2113] = "lsquare", - [0x2116] = "numero", - [0x2118] = "weierstrass", - [0x211C] = "Rfraktur", - [0x211E] = "prescription", - [0x2121] = "telephone", - [0x2122] = "trademark", - [0x2126] = "Omega", - [0x212B] = "angstrom", - [0x212E] = "estimated", - [0x2135] = "aleph", - [0x2153] = "onethird", - [0x2154] = "twothirds", - [0x215B] = "oneeighth", - [0x215C] = "threeeighths", - [0x215D] = "fiveeighths", - [0x215E] = "seveneighths", - [0x2160] = "Oneroman", - [0x2161] = "Tworoman", - [0x2162] = "Threeroman", - [0x2163] = "Fourroman", - [0x2164] = "Fiveroman", - [0x2165] = "Sixroman", - [0x2166] = "Sevenroman", - [0x2167] = "Eightroman", - [0x2168] = "Nineroman", - [0x2169] = "Tenroman", - [0x216A] = "Elevenroman", - [0x216B] = "Twelveroman", - [0x2170] = "oneroman", - [0x2171] = "tworoman", - [0x2172] = "threeroman", - [0x2173] = "fourroman", - [0x2174] = "fiveroman", - [0x2175] = "sixroman", - [0x2176] = "sevenroman", - [0x2177] = "eightroman", - [0x2178] = "nineroman", - [0x2179] = "tenroman", - [0x217A] = "elevenroman", - [0x217B] = "twelveroman", - [0x2190] = "arrowleft", - [0x2191] = "arrowup", - [0x2192] = "arrowright", - [0x2193] = "arrowdown", - [0x2194] = "arrowboth", - [0x2195] = "arrowupdn", - [0x2196] = "arrowupleft", - [0x2197] = "arrowupright", - [0x2198] = "arrowdownright", - [0x2199] = "arrowdownleft", - [0x21A8] = "arrowupdownbase", - [0x21B5] = "carriagereturn", - [0x21BC] = "harpoonleftbarbup", - [0x21C0] = "harpoonrightbarbup", - [0x21C4] = "arrowrightoverleft", - [0x21C5] = "arrowupleftofdown", - [0x21C6] = "arrowleftoverright", - [0x21CD] = "arrowleftdblstroke", - [0x21CF] = "arrowrightdblstroke", - [0x21D0] = "arrowleftdbl", - [0x21D1] = "arrowdblup", - [0x21D2] = "dblarrowright", - [0x21D3] = "arrowdbldown", - [0x21D4] = "dblarrowleft", - [0x21DE] = "pageup", - [0x21DF] = "pagedown", - [0x21E0] = "arrowdashleft", - [0x21E1] = "arrowdashup", - [0x21E2] = "arrowdashright", - [0x21E3] = "arrowdashdown", - [0x21E4] = "arrowtableft", - [0x21E5] = "arrowtabright", - [0x21E6] = "arrowleftwhite", - [0x21E7] = "arrowupwhite", - [0x21E8] = "arrowrightwhite", - [0x21E9] = "arrowdownwhite", - [0x21EA] = "capslock", - [0x2200] = "universal", - [0x2202] = "partialdiff", - [0x2203] = "thereexists", - [0x2205] = "emptyset", - [0x2206] = "increment", - [0x2207] = "nabla", - [0x2208] = "element", - [0x2209] = "notelementof", - [0x220B] = "suchthat", - [0x220C] = "notcontains", - [0x220F] = "product", - [0x2211] = "summation", - [0x2212] = "minus", - [0x2213] = "minusplus", - [0x2215] = "divisionslash", - [0x2217] = "asteriskmath", - [0x2219] = "bulletoperator", - [0x221A] = "radical", - [0x221D] = "proportional", - [0x221E] = "infinity", - [0x221F] = "rightangle", - [0x2220] = "angle", - [0x2223] = "divides", - [0x2225] = "parallel", - [0x2226] = "notparallel", - [0x2227] = "logicaland", - [0x2228] = "logicalor", - [0x2229] = "intersection", - [0x222A] = "union", - [0x222B] = "integral", - [0x222C] = "dblintegral", - [0x222E] = "contourintegral", - [0x2234] = "therefore", - [0x2235] = "because", - [0x2236] = "ratio", - [0x2237] = "proportion", - [0x223C] = "tildeoperator", - [0x223D] = "reversedtilde", - [0x2243] = "asymptoticallyequal", - [0x2245] = "congruent", - [0x2248] = "approxequal", - [0x224C] = "allequal", - [0x2250] = "approaches", - [0x2251] = "geometricallyequal", - [0x2252] = "approxequalorimage", - [0x2253] = "imageorapproximatelyequal", - [0x2260] = "notequal", - [0x2261] = "equivalence", - [0x2262] = "notidentical", - [0x2264] = "lessequal", - [0x2265] = "greaterequal", - [0x2266] = "lessoverequal", - [0x2267] = "greateroverequal", - [0x226A] = "muchless", - [0x226B] = "muchgreater", - [0x226E] = "notless", - [0x226F] = "notgreater", - [0x2270] = "notlessnorequal", - [0x2271] = "notgreaternorequal", - [0x2272] = "lessorequivalent", - [0x2273] = "greaterorequivalent", - [0x2276] = "lessorgreater", - [0x2277] = "greaterorless", - [0x2279] = "notgreaternorless", - [0x227A] = "precedes", - [0x227B] = "succeeds", - [0x2280] = "notprecedes", - [0x2281] = "notsucceeds", - [0x2282] = "subset", - [0x2283] = "superset", - [0x2284] = "notsubset", - [0x2285] = "notsuperset", - [0x2286] = "subsetorequal", - [0x2287] = "supersetorequal", - [0x228A] = "subsetnotequal", - [0x228B] = "supersetnotequal", - [0x2295] = "pluscircle", - [0x2296] = "minuscircle", - [0x2297] = "timescircle", - [0x2299] = "circleot", - [0x22A3] = "tackleft", - [0x22A4] = "tackdown", - [0x22A5] = "perpendicular", - [0x22BF] = "righttriangle", - [0x22C5] = "dotmath", - [0x22CE] = "curlyor", - [0x22CF] = "curlyand", - [0x22DA] = "lessequalorgreater", - [0x22DB] = "greaterequalorless", - [0x22EE] = "ellipsisvertical", - [0x2302] = "house", - [0x2303] = "control", - [0x2305] = "projective", - [0x2310] = "revlogicalnot", - [0x2312] = "arc", - [0x2318] = "propellor", - [0x2320] = "integraltp", - [0x2321] = "integralbt", - [0x2325] = "option", - [0x2326] = "deleteright", - [0x2327] = "clear", - [0x2329] = "angleleft", - [0x232A] = "angleright", - [0x232B] = "deleteleft", - [0x2423] = "blank", - [0x2460] = "onecircle", - [0x2461] = "twocircle", - [0x2462] = "threecircle", - [0x2463] = "fourcircle", - [0x2464] = "fivecircle", - [0x2465] = "sixcircle", - [0x2466] = "sevencircle", - [0x2467] = "eightcircle", - [0x2468] = "ninecircle", - [0x2469] = "tencircle", - [0x246A] = "elevencircle", - [0x246B] = "twelvecircle", - [0x246C] = "thirteencircle", - [0x246D] = "fourteencircle", - [0x246E] = "fifteencircle", - [0x246F] = "sixteencircle", - [0x2470] = "seventeencircle", - [0x2471] = "eighteencircle", - [0x2472] = "nineteencircle", - [0x2473] = "twentycircle", - [0x2474] = "oneparen", - [0x2475] = "twoparen", - [0x2476] = "threeparen", - [0x2477] = "fourparen", - [0x2478] = "fiveparen", - [0x2479] = "sixparen", - [0x247A] = "sevenparen", - [0x247B] = "eightparen", - [0x247C] = "nineparen", - [0x247D] = "tenparen", - [0x247E] = "elevenparen", - [0x247F] = "twelveparen", - [0x2480] = "thirteenparen", - [0x2481] = "fourteenparen", - [0x2482] = "fifteenparen", - [0x2483] = "sixteenparen", - [0x2484] = "seventeenparen", - [0x2485] = "eighteenparen", - [0x2486] = "nineteenparen", - [0x2487] = "twentyparen", - [0x2488] = "oneperiod", - [0x2489] = "twoperiod", - [0x248A] = "threeperiod", - [0x248B] = "fourperiod", - [0x248C] = "fiveperiod", - [0x248D] = "sixperiod", - [0x248E] = "sevenperiod", - [0x248F] = "eightperiod", - [0x2490] = "nineperiod", - [0x2491] = "tenperiod", - [0x2492] = "elevenperiod", - [0x2493] = "twelveperiod", - [0x2494] = "thirteenperiod", - [0x2495] = "fourteenperiod", - [0x2496] = "fifteenperiod", - [0x2497] = "sixteenperiod", - [0x2498] = "seventeenperiod", - [0x2499] = "eighteenperiod", - [0x249A] = "nineteenperiod", - [0x249B] = "twentyperiod", - [0x249C] = "aparen", - [0x249D] = "bparen", - [0x249E] = "cparen", - [0x249F] = "dparen", - [0x24A0] = "eparen", - [0x24A1] = "fparen", - [0x24A2] = "gparen", - [0x24A3] = "hparen", - [0x24A4] = "iparen", - [0x24A5] = "jparen", - [0x24A6] = "kparen", - [0x24A7] = "lparen", - [0x24A8] = "mparen", - [0x24A9] = "nparen", - [0x24AA] = "oparen", - [0x24AB] = "pparen", - [0x24AC] = "qparen", - [0x24AD] = "rparen", - [0x24AE] = "sparen", - [0x24AF] = "tparen", - [0x24B0] = "uparen", - [0x24B1] = "vparen", - [0x24B2] = "wparen", - [0x24B3] = "xparen", - [0x24B4] = "yparen", - [0x24B5] = "zparen", - [0x24B6] = "Acircle", - [0x24B7] = "Bcircle", - [0x24B8] = "Ccircle", - [0x24B9] = "Dcircle", - [0x24BA] = "Ecircle", - [0x24BB] = "Fcircle", - [0x24BC] = "Gcircle", - [0x24BD] = "Hcircle", - [0x24BE] = "Icircle", - [0x24BF] = "Jcircle", - [0x24C0] = "Kcircle", - [0x24C1] = "Lcircle", - [0x24C2] = "Mcircle", - [0x24C3] = "Ncircle", - [0x24C4] = "Ocircle", - [0x24C5] = "Pcircle", - [0x24C6] = "Qcircle", - [0x24C7] = "Rcircle", - [0x24C8] = "Scircle", - [0x24C9] = "Tcircle", - [0x24CA] = "Ucircle", - [0x24CB] = "Vcircle", - [0x24CC] = "Wcircle", - [0x24CD] = "Xcircle", - [0x24CE] = "Ycircle", - [0x24CF] = "Zcircle", - [0x24D0] = "acircle", - [0x24D1] = "bcircle", - [0x24D2] = "ccircle", - [0x24D3] = "dcircle", - [0x24D4] = "ecircle", - [0x24D5] = "fcircle", - [0x24D6] = "gcircle", - [0x24D7] = "hcircle", - [0x24D8] = "icircle", - [0x24D9] = "jcircle", - [0x24DA] = "kcircle", - [0x24DB] = "lcircle", - [0x24DC] = "mcircle", - [0x24DD] = "ncircle", - [0x24DE] = "ocircle", - [0x24DF] = "pcircle", - [0x24E0] = "qcircle", - [0x24E1] = "rcircle", - [0x24E2] = "scircle", - [0x24E3] = "tcircle", - [0x24E4] = "ucircle", - [0x24E5] = "vcircle", - [0x24E6] = "wcircle", - [0x24E7] = "xcircle", - [0x24E8] = "ycircle", - [0x24E9] = "zcircle", - [0x2500] = "SF100000", - [0x2502] = "SF110000", - [0x250C] = "SF010000", - [0x2510] = "SF030000", - [0x2514] = "SF020000", - [0x2518] = "SF040000", - [0x251C] = "SF080000", - [0x2524] = "SF090000", - [0x252C] = "SF060000", - [0x2534] = "SF070000", - [0x253C] = "SF050000", - [0x2550] = "SF430000", - [0x2551] = "SF240000", - [0x2552] = "SF510000", - [0x2553] = "SF520000", - [0x2554] = "SF390000", - [0x2555] = "SF220000", - [0x2556] = "SF210000", - [0x2557] = "SF250000", - [0x2558] = "SF500000", - [0x2559] = "SF490000", - [0x255A] = "SF380000", - [0x255B] = "SF280000", - [0x255C] = "SF270000", - [0x255D] = "SF260000", - [0x255E] = "SF360000", - [0x255F] = "SF370000", - [0x2560] = "SF420000", - [0x2561] = "SF190000", - [0x2562] = "SF200000", - [0x2563] = "SF230000", - [0x2564] = "SF470000", - [0x2565] = "SF480000", - [0x2566] = "SF410000", - [0x2567] = "SF450000", - [0x2568] = "SF460000", - [0x2569] = "SF400000", - [0x256A] = "SF540000", - [0x256B] = "SF530000", - [0x256C] = "SF440000", - [0x2580] = "upblock", - [0x2584] = "dnblock", - [0x2588] = "block", - [0x258C] = "lfblock", - [0x2590] = "rtblock", - [0x2591] = "shadelight", - [0x2592] = "shademedium", - [0x2593] = "shadedark", - [0x25A0] = "filledbox", - [0x25A1] = "whitesquare", - [0x25A3] = "squarewhitewithsmallblack", - [0x25A4] = "squarehorizontalfill", - [0x25A5] = "squareverticalfill", - [0x25A6] = "squareorthogonalcrosshatchfill", - [0x25A7] = "squareupperlefttolowerrightfill", - [0x25A8] = "squareupperrighttolowerleftfill", - [0x25A9] = "squarediagonalcrosshatchfill", - [0x25AA] = "blacksmallsquare", - [0x25AB] = "whitesmallsquare", - [0x25AC] = "filledrect", - [0x25B2] = "triagup", - [0x25B3] = "whiteuppointingtriangle", - [0x25B4] = "blackuppointingsmalltriangle", - [0x25B5] = "whiteuppointingsmalltriangle", - [0x25B6] = "blackrightpointingtriangle", - [0x25B7] = "whiterightpointingtriangle", - [0x25B9] = "whiterightpointingsmalltriangle", - [0x25BA] = "triagrt", - [0x25BC] = "triagdn", - [0x25BD] = "whitedownpointingtriangle", - [0x25BF] = "whitedownpointingsmalltriangle", - [0x25C0] = "blackleftpointingtriangle", - [0x25C1] = "whiteleftpointingtriangle", - [0x25C3] = "whiteleftpointingsmalltriangle", - [0x25C4] = "triaglf", - [0x25C6] = "blackdiamond", - [0x25C7] = "whitediamond", - [0x25C8] = "whitediamondcontainingblacksmalldiamond", - [0x25C9] = "fisheye", - [0x25CA] = "lozenge", - [0x25CB] = "whitecircle", - [0x25CC] = "dottedcircle", - [0x25CE] = "bullseye", - [0x25CF] = "blackcircle", - [0x25D0] = "circlewithlefthalfblack", - [0x25D1] = "circlewithrighthalfblack", - [0x25D8] = "invbullet", - [0x25D9] = "whitecircleinverse", - [0x25E2] = "blacklowerrighttriangle", - [0x25E3] = "blacklowerlefttriangle", - [0x25E4] = "blackupperlefttriangle", - [0x25E5] = "blackupperrighttriangle", - [0x25E6] = "whitebullet", - [0x25EF] = "largecircle", - [0x2605] = "blackstar", - [0x2606] = "whitestar", - [0x260E] = "telephoneblack", - [0x260F] = "whitetelephone", - [0x261C] = "pointingindexleftwhite", - [0x261D] = "pointingindexupwhite", - [0x261E] = "pointingindexrightwhite", - [0x261F] = "pointingindexdownwhite", - [0x262F] = "yinyang", - [0x263A] = "whitesmilingface", - [0x263B] = "invsmileface", - [0x263C] = "sun", - [0x2640] = "venus", - [0x2641] = "earth", - [0x2642] = "mars", - [0x2660] = "spadesuitblack", - [0x2661] = "heartsuitwhite", - [0x2662] = "diamondsuitwhite", - [0x2663] = "clubsuitblack", - [0x2664] = "spadesuitwhite", - [0x2665] = "heartsuitblack", - [0x2666] = "diamond", - [0x2667] = "clubsuitwhite", - [0x2668] = "hotsprings", - [0x2669] = "quarternote", - [0x266A] = "musicalnote", - [0x266B] = "musicalnotedbl", - [0x266C] = "beamedsixteenthnotes", - [0x266D] = "musicflatsign", - [0x266F] = "musicsharpsign", - [0x2713] = "checkmark", - [0x278A] = "onecircleinversesansserif", - [0x278B] = "twocircleinversesansserif", - [0x278C] = "threecircleinversesansserif", - [0x278D] = "fourcircleinversesansserif", - [0x278E] = "fivecircleinversesansserif", - [0x278F] = "sixcircleinversesansserif", - [0x2790] = "sevencircleinversesansserif", - [0x2791] = "eightcircleinversesansserif", - [0x2792] = "ninecircleinversesansserif", - [0x279E] = "arrowrightheavy", - [0x3000] = "ideographicspace", - [0x3001] = "ideographiccomma", - [0x3002] = "ideographicperiod", - [0x3003] = "dittomark", - [0x3004] = "jis", - [0x3005] = "ideographiciterationmark", - [0x3006] = "ideographicclose", - [0x3007] = "ideographiczero", - [0x3008] = "anglebracketleft", - [0x3009] = "anglebracketright", - [0x300A] = "dblanglebracketleft", - [0x300B] = "dblanglebracketright", - [0x300C] = "cornerbracketleft", - [0x300D] = "cornerbracketright", - [0x300E] = "whitecornerbracketleft", - [0x300F] = "whitecornerbracketright", - [0x3010] = "blacklenticularbracketleft", - [0x3011] = "blacklenticularbracketright", - [0x3012] = "postalmark", - [0x3013] = "getamark", - [0x3014] = "tortoiseshellbracketleft", - [0x3015] = "tortoiseshellbracketright", - [0x3016] = "whitelenticularbracketleft", - [0x3017] = "whitelenticularbracketright", - [0x3018] = "whitetortoiseshellbracketleft", - [0x3019] = "whitetortoiseshellbracketright", - [0x301C] = "wavedash", - [0x301D] = "quotedblprimereversed", - [0x301E] = "quotedblprime", - [0x3020] = "postalmarkface", - [0x3021] = "onehangzhou", - [0x3022] = "twohangzhou", - [0x3023] = "threehangzhou", - [0x3024] = "fourhangzhou", - [0x3025] = "fivehangzhou", - [0x3026] = "sixhangzhou", - [0x3027] = "sevenhangzhou", - [0x3028] = "eighthangzhou", - [0x3029] = "ninehangzhou", - [0x3036] = "circlepostalmark", - [0x3041] = "asmallhiragana", - [0x3042] = "ahiragana", - [0x3043] = "ismallhiragana", - [0x3044] = "ihiragana", - [0x3045] = "usmallhiragana", - [0x3046] = "uhiragana", - [0x3047] = "esmallhiragana", - [0x3048] = "ehiragana", - [0x3049] = "osmallhiragana", - [0x304A] = "ohiragana", - [0x304B] = "kahiragana", - [0x304C] = "gahiragana", - [0x304D] = "kihiragana", - [0x304E] = "gihiragana", - [0x304F] = "kuhiragana", - [0x3050] = "guhiragana", - [0x3051] = "kehiragana", - [0x3052] = "gehiragana", - [0x3053] = "kohiragana", - [0x3054] = "gohiragana", - [0x3055] = "sahiragana", - [0x3056] = "zahiragana", - [0x3057] = "sihiragana", - [0x3058] = "zihiragana", - [0x3059] = "suhiragana", - [0x305A] = "zuhiragana", - [0x305B] = "sehiragana", - [0x305C] = "zehiragana", - [0x305D] = "sohiragana", - [0x305E] = "zohiragana", - [0x305F] = "tahiragana", - [0x3060] = "dahiragana", - [0x3061] = "tihiragana", - [0x3062] = "dihiragana", - [0x3063] = "tusmallhiragana", - [0x3064] = "tuhiragana", - [0x3065] = "duhiragana", - [0x3066] = "tehiragana", - [0x3067] = "dehiragana", - [0x3068] = "tohiragana", - [0x3069] = "dohiragana", - [0x306A] = "nahiragana", - [0x306B] = "nihiragana", - [0x306C] = "nuhiragana", - [0x306D] = "nehiragana", - [0x306E] = "nohiragana", - [0x306F] = "hahiragana", - [0x3070] = "bahiragana", - [0x3071] = "pahiragana", - [0x3072] = "hihiragana", - [0x3073] = "bihiragana", - [0x3074] = "pihiragana", - [0x3075] = "huhiragana", - [0x3076] = "buhiragana", - [0x3077] = "puhiragana", - [0x3078] = "hehiragana", - [0x3079] = "behiragana", - [0x307A] = "pehiragana", - [0x307B] = "hohiragana", - [0x307C] = "bohiragana", - [0x307D] = "pohiragana", - [0x307E] = "mahiragana", - [0x307F] = "mihiragana", - [0x3080] = "muhiragana", - [0x3081] = "mehiragana", - [0x3082] = "mohiragana", - [0x3083] = "yasmallhiragana", - [0x3084] = "yahiragana", - [0x3085] = "yusmallhiragana", - [0x3086] = "yuhiragana", - [0x3087] = "yosmallhiragana", - [0x3088] = "yohiragana", - [0x3089] = "rahiragana", - [0x308A] = "rihiragana", - [0x308B] = "ruhiragana", - [0x308C] = "rehiragana", - [0x308D] = "rohiragana", - [0x308E] = "wasmallhiragana", - [0x308F] = "wahiragana", - [0x3090] = "wihiragana", - [0x3091] = "wehiragana", - [0x3092] = "wohiragana", - [0x3093] = "nhiragana", - [0x3094] = "vuhiragana", - [0x309B] = "voicedmarkkana", - [0x309C] = "semivoicedmarkkana", - [0x309D] = "iterationhiragana", - [0x309E] = "voicediterationhiragana", - [0x30A1] = "asmallkatakana", - [0x30A2] = "akatakana", - [0x30A3] = "ismallkatakana", - [0x30A4] = "ikatakana", - [0x30A5] = "usmallkatakana", - [0x30A6] = "ukatakana", - [0x30A7] = "esmallkatakana", - [0x30A8] = "ekatakana", - [0x30A9] = "osmallkatakana", - [0x30AA] = "okatakana", - [0x30AB] = "kakatakana", - [0x30AC] = "gakatakana", - [0x30AD] = "kikatakana", - [0x30AE] = "gikatakana", - [0x30AF] = "kukatakana", - [0x30B0] = "gukatakana", - [0x30B1] = "kekatakana", - [0x30B2] = "gekatakana", - [0x30B3] = "kokatakana", - [0x30B4] = "gokatakana", - [0x30B5] = "sakatakana", - [0x30B6] = "zakatakana", - [0x30B7] = "sikatakana", - [0x30B8] = "zikatakana", - [0x30B9] = "sukatakana", - [0x30BA] = "zukatakana", - [0x30BB] = "sekatakana", - [0x30BC] = "zekatakana", - [0x30BD] = "sokatakana", - [0x30BE] = "zokatakana", - [0x30BF] = "takatakana", - [0x30C0] = "dakatakana", - [0x30C1] = "tikatakana", - [0x30C2] = "dikatakana", - [0x30C3] = "tusmallkatakana", - [0x30C4] = "tukatakana", - [0x30C5] = "dukatakana", - [0x30C6] = "tekatakana", - [0x30C7] = "dekatakana", - [0x30C8] = "tokatakana", - [0x30C9] = "dokatakana", - [0x30CA] = "nakatakana", - [0x30CB] = "nikatakana", - [0x30CC] = "nukatakana", - [0x30CD] = "nekatakana", - [0x30CE] = "nokatakana", - [0x30CF] = "hakatakana", - [0x30D0] = "bakatakana", - [0x30D1] = "pakatakana", - [0x30D2] = "hikatakana", - [0x30D3] = "bikatakana", - [0x30D4] = "pikatakana", - [0x30D5] = "hukatakana", - [0x30D6] = "bukatakana", - [0x30D7] = "pukatakana", - [0x30D8] = "hekatakana", - [0x30D9] = "bekatakana", - [0x30DA] = "pekatakana", - [0x30DB] = "hokatakana", - [0x30DC] = "bokatakana", - [0x30DD] = "pokatakana", - [0x30DE] = "makatakana", - [0x30DF] = "mikatakana", - [0x30E0] = "mukatakana", - [0x30E1] = "mekatakana", - [0x30E2] = "mokatakana", - [0x30E3] = "yasmallkatakana", - [0x30E4] = "yakatakana", - [0x30E5] = "yusmallkatakana", - [0x30E6] = "yukatakana", - [0x30E7] = "yosmallkatakana", - [0x30E8] = "yokatakana", - [0x30E9] = "rakatakana", - [0x30EA] = "rikatakana", - [0x30EB] = "rukatakana", - [0x30EC] = "rekatakana", - [0x30ED] = "rokatakana", - [0x30EE] = "wasmallkatakana", - [0x30EF] = "wakatakana", - [0x30F0] = "wikatakana", - [0x30F1] = "wekatakana", - [0x30F2] = "wokatakana", - [0x30F3] = "nkatakana", - [0x30F4] = "vukatakana", - [0x30F5] = "kasmallkatakana", - [0x30F6] = "kesmallkatakana", - [0x30F7] = "vakatakana", - [0x30F8] = "vikatakana", - [0x30F9] = "vekatakana", - [0x30FA] = "vokatakana", - [0x30FB] = "dotkatakana", - [0x30FC] = "prolongedkana", - [0x30FD] = "iterationkatakana", - [0x30FE] = "voicediterationkatakana", - [0x3105] = "bbopomofo", - [0x3106] = "pbopomofo", - [0x3107] = "mbopomofo", - [0x3108] = "fbopomofo", - [0x3109] = "dbopomofo", - [0x310A] = "tbopomofo", - [0x310B] = "nbopomofo", - [0x310C] = "lbopomofo", - [0x310D] = "gbopomofo", - [0x310E] = "kbopomofo", - [0x310F] = "hbopomofo", - [0x3110] = "jbopomofo", - [0x3111] = "qbopomofo", - [0x3112] = "xbopomofo", - [0x3113] = "zhbopomofo", - [0x3114] = "chbopomofo", - [0x3115] = "shbopomofo", - [0x3116] = "rbopomofo", - [0x3117] = "zbopomofo", - [0x3118] = "cbopomofo", - [0x3119] = "sbopomofo", - [0x311A] = "abopomofo", - [0x311B] = "obopomofo", - [0x311C] = "ebopomofo", - [0x311D] = "ehbopomofo", - [0x311E] = "aibopomofo", - [0x311F] = "eibopomofo", - [0x3120] = "aubopomofo", - [0x3121] = "oubopomofo", - [0x3122] = "anbopomofo", - [0x3123] = "enbopomofo", - [0x3124] = "angbopomofo", - [0x3125] = "engbopomofo", - [0x3126] = "erbopomofo", - [0x3127] = "ibopomofo", - [0x3128] = "ubopomofo", - [0x3129] = "iubopomofo", - [0x3131] = "kiyeokkorean", - [0x3132] = "ssangkiyeokkorean", - [0x3133] = "kiyeoksioskorean", - [0x3134] = "nieunkorean", - [0x3135] = "nieuncieuckorean", - [0x3136] = "nieunhieuhkorean", - [0x3137] = "tikeutkorean", - [0x3138] = "ssangtikeutkorean", - [0x3139] = "rieulkorean", - [0x313A] = "rieulkiyeokkorean", - [0x313B] = "rieulmieumkorean", - [0x313C] = "rieulpieupkorean", - [0x313D] = "rieulsioskorean", - [0x313E] = "rieulthieuthkorean", - [0x313F] = "rieulphieuphkorean", - [0x3140] = "rieulhieuhkorean", - [0x3141] = "mieumkorean", - [0x3142] = "pieupkorean", - [0x3143] = "ssangpieupkorean", - [0x3144] = "pieupsioskorean", - [0x3145] = "sioskorean", - [0x3146] = "ssangsioskorean", - [0x3147] = "ieungkorean", - [0x3148] = "cieuckorean", - [0x3149] = "ssangcieuckorean", - [0x314A] = "chieuchkorean", - [0x314B] = "khieukhkorean", - [0x314C] = "thieuthkorean", - [0x314D] = "phieuphkorean", - [0x314E] = "hieuhkorean", - [0x314F] = "akorean", - [0x3150] = "aekorean", - [0x3151] = "yakorean", - [0x3152] = "yaekorean", - [0x3153] = "eokorean", - [0x3154] = "ekorean", - [0x3155] = "yeokorean", - [0x3156] = "yekorean", - [0x3157] = "okorean", - [0x3158] = "wakorean", - [0x3159] = "waekorean", - [0x315A] = "oekorean", - [0x315B] = "yokorean", - [0x315C] = "ukorean", - [0x315D] = "weokorean", - [0x315E] = "wekorean", - [0x315F] = "wikorean", - [0x3160] = "yukorean", - [0x3161] = "eukorean", - [0x3162] = "yikorean", - [0x3163] = "ikorean", - [0x3164] = "hangulfiller", - [0x3165] = "ssangnieunkorean", - [0x3166] = "nieuntikeutkorean", - [0x3167] = "nieunsioskorean", - [0x3168] = "nieunpansioskorean", - [0x3169] = "rieulkiyeoksioskorean", - [0x316A] = "rieultikeutkorean", - [0x316B] = "rieulpieupsioskorean", - [0x316C] = "rieulpansioskorean", - [0x316D] = "rieulyeorinhieuhkorean", - [0x316E] = "mieumpieupkorean", - [0x316F] = "mieumsioskorean", - [0x3170] = "mieumpansioskorean", - [0x3171] = "kapyeounmieumkorean", - [0x3172] = "pieupkiyeokkorean", - [0x3173] = "pieuptikeutkorean", - [0x3174] = "pieupsioskiyeokkorean", - [0x3175] = "pieupsiostikeutkorean", - [0x3176] = "pieupcieuckorean", - [0x3177] = "pieupthieuthkorean", - [0x3178] = "kapyeounpieupkorean", - [0x3179] = "kapyeounssangpieupkorean", - [0x317A] = "sioskiyeokkorean", - [0x317B] = "siosnieunkorean", - [0x317C] = "siostikeutkorean", - [0x317D] = "siospieupkorean", - [0x317E] = "sioscieuckorean", - [0x317F] = "pansioskorean", - [0x3180] = "ssangieungkorean", - [0x3181] = "yesieungkorean", - [0x3182] = "yesieungsioskorean", - [0x3183] = "yesieungpansioskorean", - [0x3184] = "kapyeounphieuphkorean", - [0x3185] = "ssanghieuhkorean", - [0x3186] = "yeorinhieuhkorean", - [0x3187] = "yoyakorean", - [0x3188] = "yoyaekorean", - [0x3189] = "yoikorean", - [0x318A] = "yuyeokorean", - [0x318B] = "yuyekorean", - [0x318C] = "yuikorean", - [0x318D] = "araeakorean", - [0x318E] = "araeaekorean", - [0x3200] = "kiyeokparenkorean", - [0x3201] = "nieunparenkorean", - [0x3202] = "tikeutparenkorean", - [0x3203] = "rieulparenkorean", - [0x3204] = "mieumparenkorean", - [0x3205] = "pieupparenkorean", - [0x3206] = "siosparenkorean", - [0x3207] = "ieungparenkorean", - [0x3208] = "cieucparenkorean", - [0x3209] = "chieuchparenkorean", - [0x320A] = "khieukhparenkorean", - [0x320B] = "thieuthparenkorean", - [0x320C] = "phieuphparenkorean", - [0x320D] = "hieuhparenkorean", - [0x320E] = "kiyeokaparenkorean", - [0x320F] = "nieunaparenkorean", - [0x3210] = "tikeutaparenkorean", - [0x3211] = "rieulaparenkorean", - [0x3212] = "mieumaparenkorean", - [0x3213] = "pieupaparenkorean", - [0x3214] = "siosaparenkorean", - [0x3215] = "ieungaparenkorean", - [0x3216] = "cieucaparenkorean", - [0x3217] = "chieuchaparenkorean", - [0x3218] = "khieukhaparenkorean", - [0x3219] = "thieuthaparenkorean", - [0x321A] = "phieuphaparenkorean", - [0x321B] = "hieuhaparenkorean", - [0x321C] = "cieucuparenkorean", - [0x3220] = "oneideographicparen", - [0x3221] = "twoideographicparen", - [0x3222] = "threeideographicparen", - [0x3223] = "fourideographicparen", - [0x3224] = "fiveideographicparen", - [0x3225] = "sixideographicparen", - [0x3226] = "sevenideographicparen", - [0x3227] = "eightideographicparen", - [0x3228] = "nineideographicparen", - [0x3229] = "tenideographicparen", - [0x322A] = "ideographicmoonparen", - [0x322B] = "ideographicfireparen", - [0x322C] = "ideographicwaterparen", - [0x322D] = "ideographicwoodparen", - [0x322E] = "ideographicmetalparen", - [0x322F] = "ideographicearthparen", - [0x3230] = "ideographicsunparen", - [0x3231] = "ideographicstockparen", - [0x3232] = "ideographichaveparen", - [0x3233] = "ideographicsocietyparen", - [0x3234] = "ideographicnameparen", - [0x3235] = "ideographicspecialparen", - [0x3236] = "ideographicfinancialparen", - [0x3237] = "ideographiccongratulationparen", - [0x3238] = "ideographiclaborparen", - [0x3239] = "ideographicrepresentparen", - [0x323A] = "ideographiccallparen", - [0x323B] = "ideographicstudyparen", - [0x323C] = "ideographicsuperviseparen", - [0x323D] = "ideographicenterpriseparen", - [0x323E] = "ideographicresourceparen", - [0x323F] = "ideographicallianceparen", - [0x3240] = "ideographicfestivalparen", - [0x3242] = "ideographicselfparen", - [0x3243] = "ideographicreachparen", - [0x3260] = "kiyeokcirclekorean", - [0x3261] = "nieuncirclekorean", - [0x3262] = "tikeutcirclekorean", - [0x3263] = "rieulcirclekorean", - [0x3264] = "mieumcirclekorean", - [0x3265] = "pieupcirclekorean", - [0x3266] = "sioscirclekorean", - [0x3267] = "ieungcirclekorean", - [0x3268] = "cieuccirclekorean", - [0x3269] = "chieuchcirclekorean", - [0x326A] = "khieukhcirclekorean", - [0x326B] = "thieuthcirclekorean", - [0x326C] = "phieuphcirclekorean", - [0x326D] = "hieuhcirclekorean", - [0x326E] = "kiyeokacirclekorean", - [0x326F] = "nieunacirclekorean", - [0x3270] = "tikeutacirclekorean", - [0x3271] = "rieulacirclekorean", - [0x3272] = "mieumacirclekorean", - [0x3273] = "pieupacirclekorean", - [0x3274] = "siosacirclekorean", - [0x3275] = "ieungacirclekorean", - [0x3276] = "cieucacirclekorean", - [0x3277] = "chieuchacirclekorean", - [0x3278] = "khieukhacirclekorean", - [0x3279] = "thieuthacirclekorean", - [0x327A] = "phieuphacirclekorean", - [0x327B] = "hieuhacirclekorean", - [0x327F] = "koreanstandardsymbol", - [0x328A] = "ideographmooncircle", - [0x328B] = "ideographfirecircle", - [0x328C] = "ideographwatercircle", - [0x328D] = "ideographwoodcircle", - [0x328E] = "ideographmetalcircle", - [0x328F] = "ideographearthcircle", - [0x3290] = "ideographsuncircle", - [0x3294] = "ideographnamecircle", - [0x3296] = "ideographicfinancialcircle", - [0x3298] = "ideographiclaborcircle", - [0x3299] = "ideographicsecretcircle", - [0x329D] = "ideographicexcellentcircle", - [0x329E] = "ideographicprintcircle", - [0x32A3] = "ideographiccorrectcircle", - [0x32A4] = "ideographichighcircle", - [0x32A5] = "ideographiccentrecircle", - [0x32A6] = "ideographiclowcircle", - [0x32A7] = "ideographicleftcircle", - [0x32A8] = "ideographicrightcircle", - [0x32A9] = "ideographicmedicinecircle", - [0x3300] = "apaatosquare", - [0x3303] = "aarusquare", - [0x3305] = "intisquare", - [0x330D] = "karoriisquare", - [0x3314] = "kirosquare", - [0x3315] = "kiroguramusquare", - [0x3316] = "kiromeetorusquare", - [0x3318] = "guramusquare", - [0x331E] = "kooposquare", - [0x3322] = "sentisquare", - [0x3323] = "sentosquare", - [0x3326] = "dorusquare", - [0x3327] = "tonsquare", - [0x332A] = "haitusquare", - [0x332B] = "paasentosquare", - [0x3331] = "birusquare", - [0x3333] = "huiitosquare", - [0x3336] = "hekutaarusquare", - [0x3339] = "herutusquare", - [0x333B] = "peezisquare", - [0x3342] = "hoonsquare", - [0x3347] = "mansyonsquare", - [0x3349] = "mirisquare", - [0x334A] = "miribaarusquare", - [0x334D] = "meetorusquare", - [0x334E] = "yaadosquare", - [0x3351] = "rittorusquare", - [0x3357] = "wattosquare", - [0x337B] = "heiseierasquare", - [0x337C] = "syouwaerasquare", - [0x337D] = "taisyouerasquare", - [0x337E] = "meizierasquare", - [0x337F] = "corporationsquare", - [0x3380] = "paampssquare", - [0x3381] = "nasquare", - [0x3382] = "muasquare", - [0x3383] = "masquare", - [0x3384] = "kasquare", - [0x3385] = "KBsquare", - [0x3386] = "MBsquare", - [0x3387] = "GBsquare", - [0x3388] = "calsquare", - [0x3389] = "kcalsquare", - [0x338A] = "pfsquare", - [0x338B] = "nfsquare", - [0x338C] = "mufsquare", - [0x338D] = "mugsquare", - [0x338E] = "squaremg", - [0x338F] = "squarekg", - [0x3390] = "Hzsquare", - [0x3391] = "khzsquare", - [0x3392] = "mhzsquare", - [0x3393] = "ghzsquare", - [0x3394] = "thzsquare", - [0x3395] = "mulsquare", - [0x3396] = "mlsquare", - [0x3397] = "dlsquare", - [0x3398] = "klsquare", - [0x3399] = "fmsquare", - [0x339A] = "nmsquare", - [0x339B] = "mumsquare", - [0x339C] = "squaremm", - [0x339D] = "squarecm", - [0x339E] = "squarekm", - [0x339F] = "mmsquaredsquare", - [0x33A0] = "cmsquaredsquare", - [0x33A1] = "squaremsquared", - [0x33A2] = "kmsquaredsquare", - [0x33A3] = "mmcubedsquare", - [0x33A4] = "cmcubedsquare", - [0x33A5] = "mcubedsquare", - [0x33A6] = "kmcubedsquare", - [0x33A7] = "moverssquare", - [0x33A8] = "moverssquaredsquare", - [0x33A9] = "pasquare", - [0x33AA] = "kpasquare", - [0x33AB] = "mpasquare", - [0x33AC] = "gpasquare", - [0x33AD] = "radsquare", - [0x33AE] = "radoverssquare", - [0x33AF] = "radoverssquaredsquare", - [0x33B0] = "pssquare", - [0x33B1] = "nssquare", - [0x33B2] = "mussquare", - [0x33B3] = "mssquare", - [0x33B4] = "pvsquare", - [0x33B5] = "nvsquare", - [0x33B6] = "muvsquare", - [0x33B7] = "mvsquare", - [0x33B8] = "kvsquare", - [0x33B9] = "mvmegasquare", - [0x33BA] = "pwsquare", - [0x33BB] = "nwsquare", - [0x33BC] = "muwsquare", - [0x33BD] = "mwsquare", - [0x33BE] = "kwsquare", - [0x33BF] = "mwmegasquare", - [0x33C0] = "kohmsquare", - [0x33C1] = "mohmsquare", - [0x33C2] = "amsquare", - [0x33C3] = "bqsquare", - [0x33C4] = "squarecc", - [0x33C5] = "cdsquare", - [0x33C6] = "coverkgsquare", - [0x33C7] = "cosquare", - [0x33C8] = "dbsquare", - [0x33C9] = "gysquare", - [0x33CA] = "hasquare", - [0x33CB] = "HPsquare", - [0x33CD] = "KKsquare", - [0x33CE] = "squarekmcapital", - [0x33CF] = "ktsquare", - [0x33D0] = "lmsquare", - [0x33D1] = "squareln", - [0x33D2] = "squarelog", - [0x33D3] = "lxsquare", - [0x33D4] = "mbsquare", - [0x33D5] = "squaremil", - [0x33D6] = "molsquare", - [0x33D8] = "pmsquare", - [0x33DB] = "srsquare", - [0x33DC] = "svsquare", - [0x33DD] = "wbsquare", - [0x5344] = "twentyhangzhou", - [0xF6BE] = "dotlessj", - [0xF6BF] = "LL", - [0xF6C0] = "ll", - [0xF6C3] = "commaaccent", - [0xF6C4] = "afii10063", - [0xF6C5] = "afii10064", - [0xF6C6] = "afii10192", - [0xF6C7] = "afii10831", - [0xF6C8] = "afii10832", - [0xF6C9] = "Acute", - [0xF6CA] = "Caron", - [0xF6CB] = "Dieresis", - [0xF6CC] = "DieresisAcute", - [0xF6CD] = "DieresisGrave", - [0xF6CE] = "Grave", - [0xF6CF] = "Hungarumlaut", - [0xF6D0] = "Macron", - [0xF6D1] = "cyrBreve", - [0xF6D2] = "cyrFlex", - [0xF6D3] = "dblGrave", - [0xF6D4] = "cyrbreve", - [0xF6D5] = "cyrflex", - [0xF6D6] = "dblgrave", - [0xF6D7] = "dieresisacute", - [0xF6D8] = "dieresisgrave", - [0xF6D9] = "copyrightserif", - [0xF6DA] = "registerserif", - [0xF6DB] = "trademarkserif", - [0xF6DC] = "onefitted", - [0xF6DD] = "rupiah", - [0xF6DE] = "threequartersemdash", - [0xF6DF] = "centinferior", - [0xF6E0] = "centsuperior", - [0xF6E1] = "commainferior", - [0xF6E2] = "commasuperior", - [0xF6E3] = "dollarinferior", - [0xF6E4] = "dollarsuperior", - [0xF6E5] = "hypheninferior", - [0xF6E6] = "hyphensuperior", - [0xF6E7] = "periodinferior", - [0xF6E8] = "periodsuperior", - [0xF6E9] = "asuperior", - [0xF6EA] = "bsuperior", - [0xF6EB] = "dsuperior", - [0xF6EC] = "esuperior", - [0xF6ED] = "isuperior", - [0xF6EE] = "lsuperior", - [0xF6EF] = "msuperior", - [0xF6F0] = "osuperior", - [0xF6F1] = "rsuperior", - [0xF6F2] = "ssuperior", - [0xF6F3] = "tsuperior", - [0xF6F4] = "Brevesmall", - [0xF6F5] = "Caronsmall", - [0xF6F6] = "Circumflexsmall", - [0xF6F7] = "Dotaccentsmall", - [0xF6F8] = "Hungarumlautsmall", - [0xF6F9] = "Lslashsmall", - [0xF6FA] = "OEsmall", - [0xF6FB] = "Ogoneksmall", - [0xF6FC] = "Ringsmall", - [0xF6FD] = "Scaronsmall", - [0xF6FE] = "Tildesmall", - [0xF6FF] = "Zcaronsmall", - [0xF721] = "exclamsmall", - [0xF724] = "dollaroldstyle", - [0xF726] = "ampersandsmall", - [0xF730] = "zerooldstyle", - [0xF731] = "oneoldstyle", - [0xF732] = "twooldstyle", - [0xF733] = "threeoldstyle", - [0xF734] = "fouroldstyle", - [0xF735] = "fiveoldstyle", - [0xF736] = "sixoldstyle", - [0xF737] = "sevenoldstyle", - [0xF738] = "eightoldstyle", - [0xF739] = "nineoldstyle", - [0xF73F] = "questionsmall", - [0xF760] = "Gravesmall", - [0xF761] = "Asmall", - [0xF762] = "Bsmall", - [0xF763] = "Csmall", - [0xF764] = "Dsmall", - [0xF765] = "Esmall", - [0xF766] = "Fsmall", - [0xF767] = "Gsmall", - [0xF768] = "Hsmall", - [0xF769] = "Ismall", - [0xF76A] = "Jsmall", - [0xF76B] = "Ksmall", - [0xF76C] = "Lsmall", - [0xF76D] = "Msmall", - [0xF76E] = "Nsmall", - [0xF76F] = "Osmall", - [0xF770] = "Psmall", - [0xF771] = "Qsmall", - [0xF772] = "Rsmall", - [0xF773] = "Ssmall", - [0xF774] = "Tsmall", - [0xF775] = "Usmall", - [0xF776] = "Vsmall", - [0xF777] = "Wsmall", - [0xF778] = "Xsmall", - [0xF779] = "Ysmall", - [0xF77A] = "Zsmall", - [0xF7A1] = "exclamdownsmall", - [0xF7A2] = "centoldstyle", - [0xF7A8] = "Dieresissmall", - [0xF7AF] = "Macronsmall", - [0xF7B4] = "Acutesmall", - [0xF7B8] = "Cedillasmall", - [0xF7BF] = "questiondownsmall", - [0xF7E0] = "Agravesmall", - [0xF7E1] = "Aacutesmall", - [0xF7E2] = "Acircumflexsmall", - [0xF7E3] = "Atildesmall", - [0xF7E4] = "Adieresissmall", - [0xF7E5] = "Aringsmall", - [0xF7E6] = "AEsmall", - [0xF7E7] = "Ccedillasmall", - [0xF7E8] = "Egravesmall", - [0xF7E9] = "Eacutesmall", - [0xF7EA] = "Ecircumflexsmall", - [0xF7EB] = "Edieresissmall", - [0xF7EC] = "Igravesmall", - [0xF7ED] = "Iacutesmall", - [0xF7EE] = "Icircumflexsmall", - [0xF7EF] = "Idieresissmall", - [0xF7F0] = "Ethsmall", - [0xF7F1] = "Ntildesmall", - [0xF7F2] = "Ogravesmall", - [0xF7F3] = "Oacutesmall", - [0xF7F4] = "Ocircumflexsmall", - [0xF7F5] = "Otildesmall", - [0xF7F6] = "Odieresissmall", - [0xF7F8] = "Oslashsmall", - [0xF7F9] = "Ugravesmall", - [0xF7FA] = "Uacutesmall", - [0xF7FB] = "Ucircumflexsmall", - [0xF7FC] = "Udieresissmall", - [0xF7FD] = "Yacutesmall", - [0xF7FE] = "Thornsmall", - [0xF7FF] = "Ydieresissmall", - [0xF884] = "maihanakatleftthai", - [0xF885] = "saraileftthai", - [0xF886] = "saraiileftthai", - [0xF887] = "saraueleftthai", - [0xF888] = "saraueeleftthai", - [0xF889] = "maitaikhuleftthai", - [0xF88A] = "maiekupperleftthai", - [0xF88B] = "maieklowrightthai", - [0xF88C] = "maieklowleftthai", - [0xF88D] = "maithoupperleftthai", - [0xF88E] = "maitholowrightthai", - [0xF88F] = "maitholowleftthai", - [0xF890] = "maitriupperleftthai", - [0xF891] = "maitrilowrightthai", - [0xF892] = "maitrilowleftthai", - [0xF893] = "maichattawaupperleftthai", - [0xF894] = "maichattawalowrightthai", - [0xF895] = "maichattawalowleftthai", - [0xF896] = "thanthakhatupperleftthai", - [0xF897] = "thanthakhatlowrightthai", - [0xF898] = "thanthakhatlowleftthai", - [0xF899] = "nikhahitleftthai", - [0xF8E5] = "radicalex", - [0xF8E6] = "arrowvertex", - [0xF8E7] = "arrowhorizex", - [0xF8E8] = "registersans", - [0xF8E9] = "copyrightsans", - [0xF8EA] = "trademarksans", - [0xF8EB] = "parenlefttp", - [0xF8EC] = "parenleftex", - [0xF8ED] = "parenleftbt", - [0xF8EE] = "bracketlefttp", - [0xF8EF] = "bracketleftex", - [0xF8F0] = "bracketleftbt", - [0xF8F1] = "bracelefttp", - [0xF8F2] = "braceleftmid", - [0xF8F3] = "braceleftbt", - [0xF8F4] = "braceex", - [0xF8F5] = "integralex", - [0xF8F6] = "parenrighttp", - [0xF8F7] = "parenrightex", - [0xF8F8] = "parenrightbt", - [0xF8F9] = "bracketrighttp", - [0xF8FA] = "bracketrightex", - [0xF8FB] = "bracketrightbt", - [0xF8FC] = "bracerighttp", - [0xF8FD] = "bracerightmid", - [0xF8FE] = "bracerightbt", - [0xF8FF] = "apple", - [0xFB00] = "ff", - [0xFB01] = "fi", - [0xFB02] = "fl", - [0xFB03] = "ffi", - [0xFB04] = "ffl", - [0xFB1F] = "yodyodpatahhebrew", - [0xFB20] = "ayinaltonehebrew", - [0xFB2A] = "shinshindothebrew", - [0xFB2B] = "shinsindothebrew", - [0xFB2C] = "shindageshshindothebrew", - [0xFB2D] = "shindageshsindothebrew", - [0xFB2E] = "alefpatahhebrew", - [0xFB2F] = "alefqamatshebrew", - [0xFB30] = "alefdageshhebrew", - [0xFB31] = "betdageshhebrew", - [0xFB32] = "gimeldageshhebrew", - [0xFB33] = "daletdageshhebrew", - [0xFB34] = "hedageshhebrew", - [0xFB35] = "vavdageshhebrew", - [0xFB36] = "zayindageshhebrew", - [0xFB38] = "tetdageshhebrew", - [0xFB39] = "yoddageshhebrew", - [0xFB3A] = "finalkafdageshhebrew", - [0xFB3B] = "kafdageshhebrew", - [0xFB3C] = "lameddageshhebrew", - [0xFB3E] = "memdageshhebrew", - [0xFB40] = "nundageshhebrew", - [0xFB41] = "samekhdageshhebrew", - [0xFB43] = "pefinaldageshhebrew", - [0xFB44] = "pedageshhebrew", - [0xFB46] = "tsadidageshhebrew", - [0xFB47] = "qofdageshhebrew", - [0xFB48] = "reshdageshhebrew", - [0xFB49] = "shindageshhebrew", - [0xFB4A] = "tavdageshhebrew", - [0xFB4B] = "vavholamhebrew", - [0xFB4C] = "betrafehebrew", - [0xFB4D] = "kafrafehebrew", - [0xFB4E] = "perafehebrew", - [0xFB4F] = "aleflamedhebrew", - [0xFB57] = "pehfinalarabic", - [0xFB58] = "pehinitialarabic", - [0xFB59] = "pehmedialarabic", - [0xFB67] = "ttehfinalarabic", - [0xFB68] = "ttehinitialarabic", - [0xFB69] = "ttehmedialarabic", - [0xFB6B] = "vehfinalarabic", - [0xFB6C] = "vehinitialarabic", - [0xFB6D] = "vehmedialarabic", - [0xFB7B] = "tchehfinalarabic", - [0xFB7C] = "tchehmeeminitialarabic", - [0xFB7D] = "tchehmedialarabic", - [0xFB89] = "ddalfinalarabic", - [0xFB8B] = "jehfinalarabic", - [0xFB8D] = "rrehfinalarabic", - [0xFB93] = "gaffinalarabic", - [0xFB94] = "gafinitialarabic", - [0xFB95] = "gafmedialarabic", - [0xFB9F] = "noonghunnafinalarabic", - [0xFBA4] = "hehhamzaaboveisolatedarabic", - [0xFBA5] = "hehhamzaabovefinalarabic", - [0xFBA7] = "hehfinalaltonearabic", - [0xFBA8] = "hehinitialaltonearabic", - [0xFBA9] = "hehmedialaltonearabic", - [0xFBAF] = "yehbarreefinalarabic", - [0xFC08] = "behmeemisolatedarabic", - [0xFC0B] = "tehjeemisolatedarabic", - [0xFC0C] = "tehhahisolatedarabic", - [0xFC0E] = "tehmeemisolatedarabic", - [0xFC48] = "meemmeemisolatedarabic", - [0xFC4B] = "noonjeemisolatedarabic", - [0xFC4E] = "noonmeemisolatedarabic", - [0xFC58] = "yehmeemisolatedarabic", - [0xFC5E] = "shaddadammatanarabic", - [0xFC5F] = "shaddakasratanarabic", - [0xFC60] = "shaddafathaarabic", - [0xFC61] = "shaddadammaarabic", - [0xFC62] = "shaddakasraarabic", - [0xFC6D] = "behnoonfinalarabic", - [0xFC73] = "tehnoonfinalarabic", - [0xFC8D] = "noonnoonfinalarabic", - [0xFC94] = "yehnoonfinalarabic", - [0xFC9F] = "behmeeminitialarabic", - [0xFCA1] = "tehjeeminitialarabic", - [0xFCA2] = "tehhahinitialarabic", - [0xFCA4] = "tehmeeminitialarabic", - [0xFCC9] = "lamjeeminitialarabic", - [0xFCCA] = "lamhahinitialarabic", - [0xFCCB] = "lamkhahinitialarabic", - [0xFCCC] = "lammeeminitialarabic", - [0xFCD1] = "meemmeeminitialarabic", - [0xFCD2] = "noonjeeminitialarabic", - [0xFCD5] = "noonmeeminitialarabic", - [0xFCDD] = "yehmeeminitialarabic", - [0xFD3E] = "parenleftaltonearabic", - [0xFD3F] = "parenrightaltonearabic", - [0xFD88] = "lammeemhahinitialarabic", - [0xFDF2] = "lamlamhehisolatedarabic", - [0xFDFA] = "sallallahoualayhewasallamarabic", - [0xFE30] = "twodotleadervertical", - [0xFE31] = "emdashvertical", - [0xFE32] = "endashvertical", - [0xFE33] = "underscorevertical", - [0xFE34] = "wavyunderscorevertical", - [0xFE35] = "parenleftvertical", - [0xFE36] = "parenrightvertical", - [0xFE37] = "braceleftvertical", - [0xFE38] = "bracerightvertical", - [0xFE39] = "tortoiseshellbracketleftvertical", - [0xFE3A] = "tortoiseshellbracketrightvertical", - [0xFE3B] = "blacklenticularbracketleftvertical", - [0xFE3C] = "blacklenticularbracketrightvertical", - [0xFE3D] = "dblanglebracketleftvertical", - [0xFE3E] = "dblanglebracketrightvertical", - [0xFE3F] = "anglebracketleftvertical", - [0xFE40] = "anglebracketrightvertical", - [0xFE41] = "cornerbracketleftvertical", - [0xFE42] = "cornerbracketrightvertical", - [0xFE43] = "whitecornerbracketleftvertical", - [0xFE44] = "whitecornerbracketrightvertical", - [0xFE49] = "overlinedashed", - [0xFE4A] = "overlinecenterline", - [0xFE4B] = "overlinewavy", - [0xFE4C] = "overlinedblwavy", - [0xFE4D] = "lowlinedashed", - [0xFE4E] = "lowlinecenterline", - [0xFE4F] = "underscorewavy", - [0xFE50] = "commasmall", - [0xFE52] = "periodsmall", - [0xFE54] = "semicolonsmall", - [0xFE55] = "colonsmall", - [0xFE59] = "parenleftsmall", - [0xFE5A] = "parenrightsmall", - [0xFE5B] = "braceleftsmall", - [0xFE5C] = "bracerightsmall", - [0xFE5D] = "tortoiseshellbracketleftsmall", - [0xFE5E] = "tortoiseshellbracketrightsmall", - [0xFE5F] = "numbersignsmall", - [0xFE61] = "asterisksmall", - [0xFE62] = "plussmall", - [0xFE63] = "hyphensmall", - [0xFE64] = "lesssmall", - [0xFE65] = "greatersmall", - [0xFE66] = "equalsmall", - [0xFE69] = "dollarsmall", - [0xFE6A] = "percentsmall", - [0xFE6B] = "atsmall", - [0xFE82] = "alefmaddaabovefinalarabic", - [0xFE84] = "alefhamzaabovefinalarabic", - [0xFE86] = "wawhamzaabovefinalarabic", - [0xFE88] = "alefhamzabelowfinalarabic", - [0xFE8A] = "yehhamzaabovefinalarabic", - [0xFE8B] = "yehhamzaaboveinitialarabic", - [0xFE8C] = "yehhamzaabovemedialarabic", - [0xFE8E] = "aleffinalarabic", - [0xFE90] = "behfinalarabic", - [0xFE91] = "behinitialarabic", - [0xFE92] = "behmedialarabic", - [0xFE94] = "tehmarbutafinalarabic", - [0xFE96] = "tehfinalarabic", - [0xFE97] = "tehinitialarabic", - [0xFE98] = "tehmedialarabic", - [0xFE9A] = "thehfinalarabic", - [0xFE9B] = "thehinitialarabic", - [0xFE9C] = "thehmedialarabic", - [0xFE9E] = "jeemfinalarabic", - [0xFE9F] = "jeeminitialarabic", - [0xFEA0] = "jeemmedialarabic", - [0xFEA2] = "hahfinalarabic", - [0xFEA3] = "hahinitialarabic", - [0xFEA4] = "hahmedialarabic", - [0xFEA6] = "khahfinalarabic", - [0xFEA7] = "khahinitialarabic", - [0xFEA8] = "khahmedialarabic", - [0xFEAA] = "dalfinalarabic", - [0xFEAC] = "thalfinalarabic", - [0xFEAE] = "rehfinalarabic", - [0xFEB0] = "zainfinalarabic", - [0xFEB2] = "seenfinalarabic", - [0xFEB3] = "seeninitialarabic", - [0xFEB4] = "seenmedialarabic", - [0xFEB6] = "sheenfinalarabic", - [0xFEB7] = "sheeninitialarabic", - [0xFEB8] = "sheenmedialarabic", - [0xFEBA] = "sadfinalarabic", - [0xFEBB] = "sadinitialarabic", - [0xFEBC] = "sadmedialarabic", - [0xFEBE] = "dadfinalarabic", - [0xFEBF] = "dadinitialarabic", - [0xFEC0] = "dadmedialarabic", - [0xFEC2] = "tahfinalarabic", - [0xFEC3] = "tahinitialarabic", - [0xFEC4] = "tahmedialarabic", - [0xFEC6] = "zahfinalarabic", - [0xFEC7] = "zahinitialarabic", - [0xFEC8] = "zahmedialarabic", - [0xFECA] = "ainfinalarabic", - [0xFECB] = "aininitialarabic", - [0xFECC] = "ainmedialarabic", - [0xFECE] = "ghainfinalarabic", - [0xFECF] = "ghaininitialarabic", - [0xFED0] = "ghainmedialarabic", - [0xFED2] = "fehfinalarabic", - [0xFED3] = "fehinitialarabic", - [0xFED4] = "fehmedialarabic", - [0xFED6] = "qaffinalarabic", - [0xFED7] = "qafinitialarabic", - [0xFED8] = "qafmedialarabic", - [0xFEDA] = "kaffinalarabic", - [0xFEDB] = "kafinitialarabic", - [0xFEDC] = "kafmedialarabic", - [0xFEDE] = "lamfinalarabic", - [0xFEDF] = "lammeemkhahinitialarabic", - [0xFEE0] = "lammedialarabic", - [0xFEE2] = "meemfinalarabic", - [0xFEE3] = "meeminitialarabic", - [0xFEE4] = "meemmedialarabic", - [0xFEE6] = "noonfinalarabic", - [0xFEE7] = "nooninitialarabic", - [0xFEE8] = "noonmedialarabic", - [0xFEEA] = "hehfinalarabic", - [0xFEEB] = "hehinitialarabic", - [0xFEEC] = "hehmedialarabic", - [0xFEEE] = "wawfinalarabic", - [0xFEF0] = "alefmaksurafinalarabic", - [0xFEF2] = "yehfinalarabic", - [0xFEF3] = "yehinitialarabic", - [0xFEF4] = "yehmedialarabic", - [0xFEF5] = "lamalefmaddaaboveisolatedarabic", - [0xFEF6] = "lamalefmaddaabovefinalarabic", - [0xFEF7] = "lamalefhamzaaboveisolatedarabic", - [0xFEF8] = "lamalefhamzaabovefinalarabic", - [0xFEF9] = "lamalefhamzabelowisolatedarabic", - [0xFEFA] = "lamalefhamzabelowfinalarabic", - [0xFEFB] = "lamalefisolatedarabic", - [0xFEFC] = "lamaleffinalarabic", - [0xFEFF] = "zerowidthjoiner", - [0xFF01] = "exclammonospace", - [0xFF02] = "quotedblmonospace", - [0xFF03] = "numbersignmonospace", - [0xFF04] = "dollarmonospace", - [0xFF05] = "percentmonospace", - [0xFF06] = "ampersandmonospace", - [0xFF07] = "quotesinglemonospace", - [0xFF08] = "parenleftmonospace", - [0xFF09] = "parenrightmonospace", - [0xFF0A] = "asteriskmonospace", - [0xFF0B] = "plusmonospace", - [0xFF0C] = "commamonospace", - [0xFF0D] = "hyphenmonospace", - [0xFF0E] = "periodmonospace", - [0xFF0F] = "slashmonospace", - [0xFF10] = "zeromonospace", - [0xFF11] = "onemonospace", - [0xFF12] = "twomonospace", - [0xFF13] = "threemonospace", - [0xFF14] = "fourmonospace", - [0xFF15] = "fivemonospace", - [0xFF16] = "sixmonospace", - [0xFF17] = "sevenmonospace", - [0xFF18] = "eightmonospace", - [0xFF19] = "ninemonospace", - [0xFF1A] = "colonmonospace", - [0xFF1B] = "semicolonmonospace", - [0xFF1C] = "lessmonospace", - [0xFF1D] = "equalmonospace", - [0xFF1E] = "greatermonospace", - [0xFF1F] = "questionmonospace", - [0xFF20] = "atmonospace", - [0xFF21] = "Amonospace", - [0xFF22] = "Bmonospace", - [0xFF23] = "Cmonospace", - [0xFF24] = "Dmonospace", - [0xFF25] = "Emonospace", - [0xFF26] = "Fmonospace", - [0xFF27] = "Gmonospace", - [0xFF28] = "Hmonospace", - [0xFF29] = "Imonospace", - [0xFF2A] = "Jmonospace", - [0xFF2B] = "Kmonospace", - [0xFF2C] = "Lmonospace", - [0xFF2D] = "Mmonospace", - [0xFF2E] = "Nmonospace", - [0xFF2F] = "Omonospace", - [0xFF30] = "Pmonospace", - [0xFF31] = "Qmonospace", - [0xFF32] = "Rmonospace", - [0xFF33] = "Smonospace", - [0xFF34] = "Tmonospace", - [0xFF35] = "Umonospace", - [0xFF36] = "Vmonospace", - [0xFF37] = "Wmonospace", - [0xFF38] = "Xmonospace", - [0xFF39] = "Ymonospace", - [0xFF3A] = "Zmonospace", - [0xFF3B] = "bracketleftmonospace", - [0xFF3C] = "backslashmonospace", - [0xFF3D] = "bracketrightmonospace", - [0xFF3E] = "asciicircummonospace", - [0xFF3F] = "underscoremonospace", - [0xFF40] = "gravemonospace", - [0xFF41] = "amonospace", - [0xFF42] = "bmonospace", - [0xFF43] = "cmonospace", - [0xFF44] = "dmonospace", - [0xFF45] = "emonospace", - [0xFF46] = "fmonospace", - [0xFF47] = "gmonospace", - [0xFF48] = "hmonospace", - [0xFF49] = "imonospace", - [0xFF4A] = "jmonospace", - [0xFF4B] = "kmonospace", - [0xFF4C] = "lmonospace", - [0xFF4D] = "mmonospace", - [0xFF4E] = "nmonospace", - [0xFF4F] = "omonospace", - [0xFF50] = "pmonospace", - [0xFF51] = "qmonospace", - [0xFF52] = "rmonospace", - [0xFF53] = "smonospace", - [0xFF54] = "tmonospace", - [0xFF55] = "umonospace", - [0xFF56] = "vmonospace", - [0xFF57] = "wmonospace", - [0xFF58] = "xmonospace", - [0xFF59] = "ymonospace", - [0xFF5A] = "zmonospace", - [0xFF5B] = "braceleftmonospace", - [0xFF5C] = "barmonospace", - [0xFF5D] = "bracerightmonospace", - [0xFF5E] = "asciitildemonospace", - [0xFF61] = "periodhalfwidth", - [0xFF62] = "cornerbracketlefthalfwidth", - [0xFF63] = "cornerbracketrighthalfwidth", - [0xFF64] = "ideographiccommaleft", - [0xFF65] = "middledotkatakanahalfwidth", - [0xFF66] = "wokatakanahalfwidth", - [0xFF67] = "asmallkatakanahalfwidth", - [0xFF68] = "ismallkatakanahalfwidth", - [0xFF69] = "usmallkatakanahalfwidth", - [0xFF6A] = "esmallkatakanahalfwidth", - [0xFF6B] = "osmallkatakanahalfwidth", - [0xFF6C] = "yasmallkatakanahalfwidth", - [0xFF6D] = "yusmallkatakanahalfwidth", - [0xFF6E] = "yosmallkatakanahalfwidth", - [0xFF6F] = "tusmallkatakanahalfwidth", - [0xFF70] = "katahiraprolongmarkhalfwidth", - [0xFF71] = "akatakanahalfwidth", - [0xFF72] = "ikatakanahalfwidth", - [0xFF73] = "ukatakanahalfwidth", - [0xFF74] = "ekatakanahalfwidth", - [0xFF75] = "okatakanahalfwidth", - [0xFF76] = "kakatakanahalfwidth", - [0xFF77] = "kikatakanahalfwidth", - [0xFF78] = "kukatakanahalfwidth", - [0xFF79] = "kekatakanahalfwidth", - [0xFF7A] = "kokatakanahalfwidth", - [0xFF7B] = "sakatakanahalfwidth", - [0xFF7C] = "sikatakanahalfwidth", - [0xFF7D] = "sukatakanahalfwidth", - [0xFF7E] = "sekatakanahalfwidth", - [0xFF7F] = "sokatakanahalfwidth", - [0xFF80] = "takatakanahalfwidth", - [0xFF81] = "tikatakanahalfwidth", - [0xFF82] = "tukatakanahalfwidth", - [0xFF83] = "tekatakanahalfwidth", - [0xFF84] = "tokatakanahalfwidth", - [0xFF85] = "nakatakanahalfwidth", - [0xFF86] = "nikatakanahalfwidth", - [0xFF87] = "nukatakanahalfwidth", - [0xFF88] = "nekatakanahalfwidth", - [0xFF89] = "nokatakanahalfwidth", - [0xFF8A] = "hakatakanahalfwidth", - [0xFF8B] = "hikatakanahalfwidth", - [0xFF8C] = "hukatakanahalfwidth", - [0xFF8D] = "hekatakanahalfwidth", - [0xFF8E] = "hokatakanahalfwidth", - [0xFF8F] = "makatakanahalfwidth", - [0xFF90] = "mikatakanahalfwidth", - [0xFF91] = "mukatakanahalfwidth", - [0xFF92] = "mekatakanahalfwidth", - [0xFF93] = "mokatakanahalfwidth", - [0xFF94] = "yakatakanahalfwidth", - [0xFF95] = "yukatakanahalfwidth", - [0xFF96] = "yokatakanahalfwidth", - [0xFF97] = "rakatakanahalfwidth", - [0xFF98] = "rikatakanahalfwidth", - [0xFF99] = "rukatakanahalfwidth", - [0xFF9A] = "rekatakanahalfwidth", - [0xFF9B] = "rokatakanahalfwidth", - [0xFF9C] = "wakatakanahalfwidth", - [0xFF9D] = "nkatakanahalfwidth", - [0xFF9E] = "voicedmarkkanahalfwidth", - [0xFF9F] = "semivoicedmarkkanahalfwidth", - [0xFFE0] = "centmonospace", - [0xFFE1] = "sterlingmonospace", - [0xFFE3] = "macronmonospace", - [0xFFE5] = "yenmonospace", - [0xFFE6] = "wonmonospace", +local names = allocate { + -- filled from char-def.lua } +local unicodes = allocate { + -- filled from char-def.lua +} + +local extras = allocate { -- private extensions + Dcroat = 0x0110, + Delta = 0x2206, + Euro = 0x20AC, + H18533 = 0x25CF, + H18543 = 0x25AA, + H18551 = 0x25AB, + H22073 = 0x25A1, + Ldot = 0x013F, + Oslashacute = 0x01FE, + SF10000 = 0x250C, + SF20000 = 0x2514, + SF30000 = 0x2510, + SF40000 = 0x2518, + SF50000 = 0x253C, + SF60000 = 0x252C, + SF70000 = 0x2534, + SF80000 = 0x251C, + SF90000 = 0x2524, + Upsilon1 = 0x03D2, + afii10066 = 0x0431, + afii10067 = 0x0432, + afii10068 = 0x0433, + afii10069 = 0x0434, + afii10070 = 0x0435, + afii10071 = 0x0451, + afii10072 = 0x0436, + afii10073 = 0x0437, + afii10074 = 0x0438, + afii10075 = 0x0439, + afii10076 = 0x043A, + afii10077 = 0x043B, + afii10078 = 0x043C, + afii10079 = 0x043D, + afii10080 = 0x043E, + afii10081 = 0x043F, + afii10082 = 0x0440, + afii10083 = 0x0441, + afii10084 = 0x0442, + afii10085 = 0x0443, + afii10086 = 0x0444, + afii10087 = 0x0445, + afii10088 = 0x0446, + afii10089 = 0x0447, + afii10090 = 0x0448, + afii10091 = 0x0449, + afii10092 = 0x044A, + afii10093 = 0x044B, + afii10094 = 0x044C, + afii10095 = 0x044D, + afii10096 = 0x044E, + afii10097 = 0x044F, + afii10098 = 0x0491, + afii10099 = 0x0452, + afii10100 = 0x0453, + afii10101 = 0x0454, + afii10102 = 0x0455, + afii10103 = 0x0456, + afii10104 = 0x0457, + afii10105 = 0x0458, + afii10106 = 0x0459, + afii10107 = 0x045A, + afii10108 = 0x045B, + afii10109 = 0x045C, + afii10110 = 0x045E, + afii10193 = 0x045F, + afii10194 = 0x0463, + afii10195 = 0x0473, + afii10196 = 0x0475, + afii10846 = 0x04D9, + afii208 = 0x2015, + afii57381 = 0x066A, + afii57388 = 0x060C, + afii57392 = 0x0660, + afii57393 = 0x0661, + afii57394 = 0x0662, + afii57395 = 0x0663, + afii57396 = 0x0664, + afii57397 = 0x0665, + afii57398 = 0x0666, + afii57399 = 0x0667, + afii57400 = 0x0668, + afii57401 = 0x0669, + afii57403 = 0x061B, + afii57407 = 0x061F, + afii57409 = 0x0621, + afii57410 = 0x0622, + afii57411 = 0x0623, + afii57412 = 0x0624, + afii57413 = 0x0625, + afii57414 = 0x0626, + afii57415 = 0x0627, + afii57416 = 0x0628, + afii57417 = 0x0629, + afii57418 = 0x062A, + afii57419 = 0x062B, + afii57420 = 0x062C, + afii57421 = 0x062D, + afii57422 = 0x062E, + afii57423 = 0x062F, + afii57424 = 0x0630, + afii57425 = 0x0631, + afii57426 = 0x0632, + afii57427 = 0x0633, + afii57428 = 0x0634, + afii57429 = 0x0635, + afii57430 = 0x0636, + afii57431 = 0x0637, + afii57432 = 0x0638, + afii57433 = 0x0639, + afii57434 = 0x063A, + afii57440 = 0x0640, + afii57441 = 0x0641, + afii57442 = 0x0642, + afii57443 = 0x0643, + afii57444 = 0x0644, + afii57445 = 0x0645, + afii57446 = 0x0646, + afii57448 = 0x0648, + afii57449 = 0x0649, + afii57450 = 0x064A, + afii57451 = 0x064B, + afii57452 = 0x064C, + afii57453 = 0x064D, + afii57454 = 0x064E, + afii57455 = 0x064F, + afii57456 = 0x0650, + afii57457 = 0x0651, + afii57458 = 0x0652, + afii57470 = 0x0647, + afii57505 = 0x06A4, + afii57506 = 0x067E, + afii57507 = 0x0686, + afii57508 = 0x0698, + afii57509 = 0x06AF, + afii57511 = 0x0679, + afii57512 = 0x0688, + afii57513 = 0x0691, + afii57514 = 0x06BA, + afii57519 = 0x06D2, + afii57636 = 0x20AA, + afii57645 = 0x05BE, + afii57658 = 0x05C3, + afii57664 = 0x05D0, + afii57665 = 0x05D1, + afii57666 = 0x05D2, + afii57667 = 0x05D3, + afii57668 = 0x05D4, + afii57669 = 0x05D5, + afii57670 = 0x05D6, + afii57671 = 0x05D7, + afii57672 = 0x05D8, + afii57673 = 0x05D9, + afii57674 = 0x05DA, + afii57675 = 0x05DB, + afii57676 = 0x05DC, + afii57677 = 0x05DD, + afii57678 = 0x05DE, + afii57679 = 0x05DF, + afii57680 = 0x05E0, + afii57681 = 0x05E1, + afii57682 = 0x05E2, + afii57683 = 0x05E3, + afii57684 = 0x05E4, + afii57685 = 0x05E5, + afii57686 = 0x05E6, + afii57687 = 0x05E7, + afii57688 = 0x05E8, + afii57689 = 0x05E9, + afii57690 = 0x05EA, + afii57716 = 0x05F0, + afii57717 = 0x05F1, + afii57718 = 0x05F2, + afii57793 = 0x05B4, + afii57794 = 0x05B5, + afii57795 = 0x05B6, + afii57796 = 0x05BB, + afii57797 = 0x05B8, + afii57798 = 0x05B7, + afii57799 = 0x05B0, + afii57800 = 0x05B2, + afii57801 = 0x05B1, + afii57802 = 0x05B3, + afii57803 = 0x05C2, + afii57804 = 0x05C1, + afii57806 = 0x05B9, + afii57807 = 0x05BC, + afii57839 = 0x05BD, + afii57841 = 0x05BF, + afii57842 = 0x05C0, + afii57929 = 0x02BC, + afii61248 = 0x2105, + afii61289 = 0x2113, + afii61352 = 0x2116, + afii61664 = 0x200C, + afii63167 = 0x066D, + afii64937 = 0x02BD, + arrowdblboth = 0x21D4, + arrowdblleft = 0x21D0, + arrowdblright = 0x21D2, + arrowupdnbse = 0x21A8, + bar = 0x007C, + circle = 0x25CB, + circlemultiply = 0x2297, + circleplus = 0x2295, + club = 0x2663, + colonmonetary = 0x20A1, + dcroat = 0x0111, + dkshade = 0x2593, + existential = 0x2203, + female = 0x2640, + gradient = 0x2207, + heart = 0x2665, + hookabovecomb = 0x0309, + invcircle = 0x25D9, + ldot = 0x0140, + longs = 0x017F, + ltshade = 0x2591, + male = 0x2642, + mu = 0x00B5, + napostrophe = 0x0149, + notelement = 0x2209, + omega1 = 0x03D6, + openbullet = 0x25E6, + orthogonal = 0x221F, + oslashacute = 0x01FF, + phi1 = 0x03D5, + propersubset = 0x2282, + propersuperset = 0x2283, + reflexsubset = 0x2286, + reflexsuperset = 0x2287, + shade = 0x2592, + sigma1 = 0x03C2, + similar = 0x223C, + smileface = 0x263A, + spacehackarabic = 0x0020, + spade = 0x2660, + theta1 = 0x03D1, + twodotenleader = 0x2025, +} + +for u, c in next, characters.data do + local a = c.adobename + if a then + unicodes[a] = u + names [u] = a + end +end -fonts.map.agl_to_unicode = table.swapped(fonts.map.unicode_to_agl) +for a, u in next, extras do + unicodes[a] = u + if not names[u] then + names[u] = a + end +end + +-- We load this table only when needed. We coul duse a loading mechanism +-- return the table but there are no more vectors like this so why bother. + +fonts.encodings = fonts.encodings or { } + +fonts.encodings.agl = { + names = names, -- unicode -> name + unicodes = unicodes, -- name -> unicode + extras = extras, -- merged into the other two +} diff --git a/Master/texmf-dist/tex/context/base/font-aux.lua b/Master/texmf-dist/tex/context/base/font-aux.lua new file mode 100644 index 00000000000..0396554adec --- /dev/null +++ b/Master/texmf-dist/tex/context/base/font-aux.lua @@ -0,0 +1,104 @@ +if not modules then modules = { } end modules ['font-aux'] = { + version = 1.001, + comment = "companion to font-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local number = tonumber +local wrap, yield = coroutine.wrap, coroutine.yield + +local fonts, font = fonts, font + +local iterators = { } +fonts.iterators = iterators + +local currentfont = font.current +local identifiers = fonts.hashes.identifiers +local sortedkeys = table.sortedkeys + +-- for unicode, character in fonts.iterators.characters () do print(k,v) end +-- for unicode, description in fonts.iterators.descriptions() do print(k,v) end +-- for index, glyph in fonts.iterators.glyphs () do print(k,v) end + +local function checkeddata(data) -- beware, nullfont is the fallback in identifiers + local t = type(data) + if t == "table" then + return data + elseif t ~= "number" then + data = currentfont() + end + return identifiers[data] -- has nullfont as fallback +end + +function iterators.characters(data) + data = checkeddata(data) + local characters = data.characters + if characters then + local collected = sortedkeys(characters) + return wrap(function() + for c=1,#collected do + local cc = collected[c] + local dc = characters[cc] + if dc then + yield(cc,dc) + end + end + end) + else + return wrap(function() end) + end +end + +function iterators.descriptions(data) + data = checkeddata(data) + local characters = data.characters + local descriptions = data.descriptions + if characters and descriptions then + local collected = sortedkeys(characters) + return wrap(function() + for c=1,#collected do + local cc = collected[c] + local dc = descriptions[cc] + if dc then + yield(cc,dc) + end + end + end) + else + return wrap(function() end) + end +end + +local function getindices(data) + data = checkeddata(data) + local indices = { } + local characters = data.characters + if characters then + for unicode, character in next, characters do + indices[character.index or unicode] = unicode + end + end + return indices +end + +function iterators.glyphs(data) + data = checkeddata(data) + local descriptions = data.descriptions + if descriptions then + local indices = getindices(data) + local collected = sortedkeys(indices) + return wrap(function() + for c=1,#collected do + local cc = collected[c] + local dc = descriptions[indices[cc]] + if dc then + yield(cc,dc) + end + end + end) + else + return wrap(function() end) + end +end diff --git a/Master/texmf-dist/tex/context/base/font-chk.lua b/Master/texmf-dist/tex/context/base/font-chk.lua index 32fdf88940a..e3679f06dba 100644 --- a/Master/texmf-dist/tex/context/base/font-chk.lua +++ b/Master/texmf-dist/tex/context/base/font-chk.lua @@ -7,14 +7,19 @@ if not modules then modules = { } end modules ['font-chk'] = { } -- possible optimization: delayed initialization of vectors +-- move to the nodes namespace -fonts = fonts or { } -fonts.checkers = fonts.checkers or { } +local report_fonts = logs.reporter("fonts","checking") + +local fonts = fonts +fonts.checkers = fonts.checkers or { } local checkers = fonts.checkers -local fontdata = fonts.ids + +local fontdata = fonts.hashes.identifiers local is_character = characters.is_character local chardata = characters.data +local tasks = nodes.tasks local glyph = node.id('glyph') local traverse_id = node.traverse_id @@ -26,7 +31,9 @@ local remove_node = nodes.remove checkers.enabled = false checkers.delete = false -function fonts.register_message(font,char,message) +-- to tfmdata.properties ? + +local function onetimemessage(font,char,message) local tfmdata = fontdata[font] local shared = tfmdata.shared local messages = shared.messages @@ -40,11 +47,13 @@ function fonts.register_message(font,char,message) messages[message] = category end if not category[char] then - logs.report("fonts","char U+%04X in font '%s' with id %s: %s",char,tfmdata.fullname,font,message) + report_fonts("char U+%05X in font '%s' with id %s: %s",char,tfmdata.properties.fullname,font,message) category[char] = true end end +fonts.loggers.onetimemessage = onetimemessage + function checkers.missing(head) if checkers.enabled then local lastfont, characters, found = nil, nil, nil @@ -55,9 +64,9 @@ function checkers.missing(head) end if not characters[char] and is_character[chardata[char].category] then if checkers.delete then - fonts.register_message(font,char,"missing (will be deleted)") + onetimemessage(font,char,"missing (will be deleted)") else - fonts.register_message(font,char,"missing") + onetimemessage(font,char,"missing") end if not found then found = { n } diff --git a/Master/texmf-dist/tex/context/base/font-cid.lua b/Master/texmf-dist/tex/context/base/font-cid.lua index d1c727af2d9..4a4c4d20916 100644 --- a/Master/texmf-dist/tex/context/base/font-cid.lua +++ b/Master/texmf-dist/tex/context/base/font-cid.lua @@ -8,15 +8,19 @@ if not modules then modules = { } end modules ['font-cid'] = { local format, match, lower = string.format, string.match, string.lower local tonumber = tonumber -local lpegmatch = lpeg.match +local P, S, R, C, V, lpegmatch = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.match -local trace_loading = false trackers.register("otf.loading", function(v) trace_loading = v end) +local trace_loading = false trackers.register("otf.loading", function(v) trace_loading = v end) -fonts = fonts or { } -fonts.cid = fonts.cid or { } -fonts.cid.map = fonts.cid.map or { } -fonts.cid.max = fonts.cid.max or 10 +local report_otf = logs.reporter("fonts","otf loading") +local fonts = fonts + +local cid = { } +fonts.cid = cid + +local cidmap = { } +local cidmax = 10 -- original string parser: 0.109, lpeg parser: 0.036 seconds for Adobe-CNS1-4.cidmap -- @@ -25,14 +29,14 @@ fonts.cid.max = fonts.cid.max or 10 -- 1..95 0020 -- 99 3000 -local number = lpeg.C(lpeg.R("09","af","AF")^1) -local space = lpeg.S(" \n\r\t") +local number = C(R("09","af","AF")^1) +local space = S(" \n\r\t") local spaces = space^0 -local period = lpeg.P(".") +local period = P(".") local periods = period * period -local name = lpeg.P("/") * lpeg.C((1-space)^1) +local name = P("/") * C((1-space)^1) -local unicodes, names = { }, { } +local unicodes, names = { }, { } -- we could use Carg now local function do_one(a,b) unicodes[tonumber(a)] = tonumber(b,16) @@ -50,15 +54,15 @@ local function do_name(a,b) names[tonumber(a)] = b end -local grammar = lpeg.P { "start", - start = number * spaces * number * lpeg.V("series"), - series = (spaces * (lpeg.V("one") + lpeg.V("range") + lpeg.V("named")) )^1, +local grammar = P { "start", + start = number * spaces * number * V("series"), + series = (spaces * (V("one") + V("range") + V("named")))^1, one = (number * spaces * number) / do_one, range = (number * periods * number * spaces * number) / do_range, named = (number * spaces * name) / do_name } -function fonts.cid.load(filename) +local function loadcidfile(filename) local data = io.loaddata(filename) if data then unicodes, names = { }, { } @@ -72,76 +76,90 @@ function fonts.cid.load(filename) unicodes = unicodes, names = names } - else - return nil end end -local template = "%s-%s-%s.cidmap" +cid.loadfile = loadcidfile -- we use the frozen variant +local template = "%s-%s-%s.cidmap" local function locate(registry,ordering,supplement) local filename = format(template,registry,ordering,supplement) local hashname = lower(filename) - local cidmap = fonts.cid.map[hashname] - if not cidmap then + local found = cidmap[hashname] + if not found then if trace_loading then - logs.report("load otf","checking cidmap, registry: %s, ordering: %s, supplement: %s, filename: %s",registry,ordering,supplement,filename) + report_otf("checking cidmap, registry: %s, ordering: %s, supplement: %s, filename: %s",registry,ordering,supplement,filename) end - local fullname = resolvers.find_file(filename,'cid') or "" + local fullname = resolvers.findfile(filename,'cid') or "" if fullname ~= "" then - cidmap = fonts.cid.load(fullname) - if cidmap then + found = loadcidfile(fullname) + if found then if trace_loading then - logs.report("load otf","using cidmap file %s",filename) + report_otf("using cidmap file %s",filename) end - fonts.cid.map[hashname] = cidmap - cidmap.usedname = file.basename(filename) - return cidmap + cidmap[hashname] = found + found.usedname = file.basename(filename) end end end - return cidmap + return found end -function fonts.cid.getmap(registry,ordering,supplement) - -- cf Arthur R. we can safely scan upwards since cids are downward compatible - local supplement = tonumber(supplement) +-- cf Arthur R. we can safely scan upwards since cids are downward compatible + +function cid.getmap(specification) + if not specification then + report_otf("invalid cidinfo specification (table expected)") + return + end + local registry = specification.registry + local ordering = specification.ordering + local supplement = specification.supplement + -- check for already loaded file + local filename = format(registry,ordering,supplement) + local found = cidmap[lower(filename)] + if found then + return found + end if trace_loading then - logs.report("load otf","needed cidmap, registry: %s, ordering: %s, supplement: %s",registry,ordering,supplement) + report_otf("needed cidmap, registry: %s, ordering: %s, supplement: %s",registry,ordering,supplement) end - local cidmap = locate(registry,ordering,supplement) - if not cidmap then + found = locate(registry,ordering,supplement) + if not found then + local supnum = tonumber(supplement) local cidnum = nil -- next highest (alternatively we could start high) - if supplement < fonts.cid.max then - for supplement=supplement+1,fonts.cid.max do - local c = locate(registry,ordering,supplement) + if supnum < cidmax then + for s=supnum+1,cidmax do + local c = locate(registry,ordering,s) if c then - cidmap, cidnum = c, supplement + found, cidnum = c, s break end end end -- next lowest (least worse fit) - if not cidmap and supplement > 0 then - for supplement=supplement-1,0,-1 do - local c = locate(registry,ordering,supplement) + if not found and supnum > 0 then + for s=supnum-1,0,-1 do + local c = locate(registry,ordering,s) if c then - cidmap, cidnum = c, supplement + found, cidnum = c, s break end end end - -- prevent further lookups - if cidmap and cidnum > 0 then + -- prevent further lookups -- somewhat tricky + registry = lower(registry) + ordering = lower(ordering) + if found and cidnum > 0 then for s=0,cidnum-1 do - filename = format(template,registry,ordering,s) - if not fonts.cid.map[filename] then - fonts.cid.map[filename] = cidmap -- copy of ref + local filename = format(template,registry,ordering,s) + if not cidmap[filename] then + cidmap[filename] = found end end end end - return cidmap + return found end diff --git a/Master/texmf-dist/tex/context/base/font-col.lua b/Master/texmf-dist/tex/context/base/font-col.lua index d313357a2e0..e0d2fed112d 100644 --- a/Master/texmf-dist/tex/context/base/font-col.lua +++ b/Master/texmf-dist/tex/context/base/font-col.lua @@ -8,27 +8,29 @@ if not modules then modules = { } end modules ['font-col'] = { -- possible optimization: delayed initialization of vectors -local format, gmatch, texsprint, type = string.format, string.gmatch, tex.sprint, type -local traverse_id, first_character = node.traverse_id, node.first_character +local gmatch, type = string.gmatch, type +local traverse_id = node.traverse_id local lpegmatch = lpeg.match - -local ctxcatcodes = tex.ctxcatcodes +local settings_to_hash = utilities.parsers.settings_to_hash local trace_collecting = false trackers.register("fonts.collecting", function(v) trace_collecting = v end) -local fontdata = fonts.ids +local report_fonts = logs.reporter("fonts","collections") -local glyph = node.id('glyph') +local fonts, context = fonts, context -fonts.normalizers = fonts.normalizers or { } +fonts.collections = fonts.collections or { } +local collections = fonts.collections -fonts.collections = fonts.collections or { } -fonts.collections.definitions = fonts.collections.definitions or { } -fonts.collections.vectors = fonts.collections.vectors or { } +collections.definitions = collections.definitions or { } +local definitions = collections.definitions -local collections = fonts.collections -local definitions = fonts.collections.definitions -local vectors = fonts.collections.vectors +collections.vectors = collections.vectors or { } +local vectors = collections.vectors + +local fontdata = fonts.hashes.identifiers + +local glyph = node.id('glyph') local list, current, active = { }, 0, false @@ -54,28 +56,28 @@ function collections.define(name,font,ranges,details) local d = definitions[name] if d then if name and trace_collecting then - logs.report("fonts","def: extending set %s using %s",name, font) + report_fonts("def: extending set %s using %s",name, font) end else if name and trace_collecting then - logs.report("fonts","def: defining set %s using %s",name, font) + report_fonts("def: defining set %s using %s",name, font) end d = { } definitions[name] = d end - details = aux.settings_to_hash(details) + details = settings_to_hash(details) -- todo, combine per font start/stop as arrays - for s in gmatch(ranges,"([^, ]+)") do + for s in gmatch(ranges,"[^, ]+") do local start, stop, description = characters.getrange(s) if start and stop then if trace_collecting then if description then - logs.report("fonts","def: using range %s (U+%04x-U+%04X, %s)",s,start,stop,description) + report_fonts("def: using range %s (U+%05x-U+%05X, %s)",s,start,stop,description) end for i=1,#d do local di = d[i] if (start >= di.start and start <= di.stop) or (stop >= di.start and stop <= di.stop) then - logs.report("fonts","def: overlapping ranges U+%04x-U+%04X and U+%04x-U+%04X",start,stop,di.start,di.stop) + report_fonts("def: overlapping ranges U+%05x-U+%05X and U+%05x-U+%05X",start,stop,di.start,di.stop) end end end @@ -85,27 +87,27 @@ function collections.define(name,font,ranges,details) end end -function collections.stage_1(name) +function collections.stage_one(name) local last = font.current() if trace_collecting then - logs.report("fonts","def: registering font %s with name %s",last,name) + report_fonts("def: registering font %s with name %s",last,name) end list[#list+1] = last end -function collections.stage_2(name) +function collections.stage_two(name) statistics.starttiming(fonts) local d = definitions[name] local t = { } if trace_collecting then - logs.report("fonts","def: process collection %s",name) + report_fonts("def: process collection %s",name) end for i=1,#d do local f = d[i] local id = list[i] local start, stop = f.start, f.stop if trace_collecting then - logs.report("fonts","def: remapping font %s to %s for range U+%04X - U+%04X",current,id,start,stop) + report_fonts("def: remapping font %s to %s for range U+%05X - U+%05X",current,id,start,stop) end local check = toboolean(f.check or "false",true) local force = toboolean(f.force or "true",true) @@ -138,12 +140,14 @@ function collections.stage_2(name) end vectors[current] = t if trace_collecting then - logs.report("fonts","def: activating collection %s for font %s",name,current) + report_fonts("def: activating collection %s for font %s",name,current) end active = true statistics.stoptiming(fonts) end +-- we already have this parser + local P, Cc = lpeg.P, lpeg.Cc local spec = (P("sa") + P("at") + P("scaled") + P("at") + P("mo")) * P(" ")^1 * (1-P(" "))^1 * P(" ")^0 * -1 local okay = ((1-spec)^1 * spec * Cc(true)) + Cc(false) @@ -158,37 +162,37 @@ function collections.prepare(name) local d = definitions[name] if d then if trace_collecting then - local filename = file.basename(fontdata[current].filename or "?") - logs.report("fonts","def: applying collection %s to %s (file: %s)",name,current,filename) + local filename = file.basename(fontdata[current].properties.filename or "?") + report_fonts("def: applying collection %s to %s (file: %s)",name,current,filename) end list = { } - texsprint(ctxcatcodes,"\\dostartcloningfonts") -- move this to tex \dostart... + context.dostartcloningfonts() -- move this to tex \dostart... for i=1,#d do local f = d[i] local name = f.font local scale = f.rscale or 1 if lpegmatch(okay,name) then - texsprint(ctxcatcodes,format("\\doclonefonta{%s}{%s}",name,scale)) -- define with unique specs + context.doclonefonta(name,scale) -- define with unique specs else - texsprint(ctxcatcodes,format("\\doclonefontb{%s}{%s}",name,scale)) -- define with inherited specs + context.doclonefontb(name,scale) -- define with inherited specs end - texsprint(ctxcatcodes,format("\\ctxlua{fonts.collections.stage_1('%s')}",name)) -- registering main font + context.doclonefontstageone(name) -- registering main font end - texsprint(ctxcatcodes,format("\\ctxlua{fonts.collections.stage_2('%s')}",name)) -- preparing clone vectors - texsprint(ctxcatcodes,"\\dostopcloningfonts") + context.doclonefontstagetwo(name) -- preparing clone vectors + context.dostopcloningfonts() elseif trace_collecting then - local filename = file.basename(fontdata[current].filename or "?") - logs.report("fonts","def: error in applying collection %s to %s (file: %s)",name,current,filename) + local filename = file.basename(fontdata[current].properties.filename or "?") + report_fonts("def: error in applying collection %s to %s (file: %s)",name,current,filename) end end function collections.message(message) if trace_collecting then - logs.report("fonts","tex: %s",message) + report_fonts("tex: %s",message) end end -function collections.process(head) +function collections.process(head) -- this way we keep feature processing if active then local done = false for n in traverse_id(glyph,head) do @@ -199,18 +203,20 @@ function collections.process(head) if type(id) == "table" then local newid, newchar = id[1], id[2] if trace_collecting then - logs.report("fonts","lst: remapping character %s in font %s to character %s in font %s",n.char,n.font,newchar,newid) + report_fonts("lst: remapping character %s in font %s to character %s in font %s",n.char,n.font,newchar,newid) end n.font, n.char = newid, newchar else if trace_collecting then - logs.report("fonts","lst: remapping font %s to %s for character %s",n.font,id,n.char) + report_fonts("lst: remapping font %s to %s for character %s",n.font,id,n.char) end n.font = id end end end end + return head, done + else + return head, false end - return head, done end diff --git a/Master/texmf-dist/tex/context/base/font-col.mkiv b/Master/texmf-dist/tex/context/base/font-col.mkiv index 181b985f68e..f4f9a9dc723 100644 --- a/Master/texmf-dist/tex/context/base/font-col.mkiv +++ b/Master/texmf-dist/tex/context/base/font-col.mkiv @@ -79,7 +79,7 @@ {\egroup} \def\doclonefonta#1#2% kind of dododefinefont - {\ctxlua{fonts.collections.message("defining #1 (relative scale: #2)")}% + {\ctxlua{fonts.collections.message("defining #1 (relative scale: #2)")}% brrr \autofontsizefalse \let\lastfontidentifier\s!dummy \def\localrelativefontsize{#2}% @@ -93,6 +93,12 @@ \def\doclonefontb#1% #2 {\doclonefonta{#1 \savedfontspec}} +\def\doclonefontstageone#1% + {\ctxlua{fonts.collections.stage_one("#1")}} + +\def\doclonefontstagetwo#1% + {\ctxlua{fonts.collections.stage_two("#1")}} + % check : only replace when present in replacement font (default: no) % force : force replacent even when basefont has glyph (default: yes) @@ -104,16 +110,7 @@ % % \definefontsynonym[SerifPlus][Serif][fallbacks=whatever] % -% \definefont[MySerif][SerifPlus at 10pt] -% -% \startcolumns[n=6] -% \MySerif -% \dostepwiserecurse {0} {65000} {1} { -% \iffontchar\font\recurselevel -% {\tttf\uchexnumbers\recurselevel:} \char\recurselevel\par -% \fi -% } -% \stopcolumns +% \showfont[SerifPlus][all] % \definefontfeature[zh][mode=node,script=hang,lang=zhs] % \definefontfallback[serifwhatever] [lmroman10-regular] [0x0000-0x0400][force=yes] diff --git a/Master/texmf-dist/tex/context/base/font-con.lua b/Master/texmf-dist/tex/context/base/font-con.lua new file mode 100644 index 00000000000..5d30842ef7f --- /dev/null +++ b/Master/texmf-dist/tex/context/base/font-con.lua @@ -0,0 +1,1135 @@ +if not modules then modules = { } end modules ['font-con'] = { + version = 1.001, + comment = "companion to font-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + + +local utf = unicode.utf8 + +local next, tostring, rawget = next, tostring, rawget +local format, match, lower, gsub = string.format, string.match, string.lower, string.gsub +local utfbyte = utf.byte +local sort, insert, concat, sortedkeys, serialize, fastcopy = table.sort, table.insert, table.concat, table.sortedkeys, table.serialize, table.fastcopy + +local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) +local trace_scaling = false trackers.register("fonts.scaling" , function(v) trace_scaling = v end) + +local report_defining = logs.reporter("fonts","defining") + +-- watch out: no negative depths and negative eights permitted in regular fonts + +--[[ldx-- +

Here we only implement a few helper functions.

+--ldx]]-- + +local fonts = fonts +local constructors = { } +fonts.constructors = constructors +local handlers = { } +fonts.handlers = handlers + +local specifiers = fonts.specifiers +local contextsetups = specifiers.contextsetups +local contextnumbers = specifiers.contextnumbers + +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex + +-- will be directives + +constructors.dontembed = allocate() +constructors.mathactions = { } +constructors.autocleanup = true +constructors.namemode = "fullpath" -- will be a function + +constructors.version = 1.01 +constructors.cache = containers.define("fonts", "constructors", constructors.version, false) + +constructors.privateoffset = 0xF0000 -- 0x10FFFF + +-- This might become an interface; + +local designsizes = allocate() +constructors.designsizes = designsizes +local loadedfonts = allocate() +constructors.loadedfonts = loadedfonts + +--[[ldx-- +

We need to normalize the scale factor (in scaled points). This has to +do with the fact that uses a negative multiple of 1000 as +a signal for a font scaled based on the design size.

+--ldx]]-- + +local factors = { + pt = 65536.0, + bp = 65781.8, +} + +function constructors.setfactor(f) + constructors.factor = factors[f or 'pt'] or factors.pt +end + +constructors.setfactor() + +function constructors.scaled(scaledpoints, designsize) -- handles designsize in sp as well + if scaledpoints < 0 then + if designsize then + local factor = constructors.factor + if designsize > factor then -- or just 1000 / when? mp? + return (- scaledpoints/1000) * designsize -- sp's + else + return (- scaledpoints/1000) * designsize * factor + end + else + return (- scaledpoints/1000) * 10 * factor + end + else + return scaledpoints + end +end + +--[[ldx-- +

Beware, the boundingbox is passed as reference so we may not overwrite it +in the process; numbers are of course copies. Here 65536 equals 1pt. (Due to +excessive memory usage in CJK fonts, we no longer pass the boundingbox.)

+--ldx]]-- + +-- The scaler is only used for otf and afm and virtual fonts. If +-- a virtual font has italic correction make sure to set the +-- italic_correction flag. Some more flags will be added in +-- the future. + +--[[ldx-- +

The reason why the scaler was originally split, is that for a while we experimented +with a helper function. However, in practice the calls are too slow to +make this profitable and the based variant was just faster. A days +wasted day but an experience richer.

+--ldx]]-- + +-- we can get rid of the tfm instance when we have fast access to the +-- scaled character dimensions at the tex end, e.g. a fontobject.width +-- actually we already have soem of that now as virtual keys in glyphs +-- +-- flushing the kern and ligature tables from memory saves a lot (only +-- base mode) but it complicates vf building where the new characters +-- demand this data .. solution: functions that access them + +function constructors.cleanuptable(tfmdata) + if constructors.autocleanup and tfmdata.properties.virtualized then + for k, v in next, tfmdata.characters do + if v.commands then v.commands = nil end + -- if v.kerns then v.kerns = nil end + end + end +end + +-- experimental, sharing kerns (unscaled and scaled) saves memory +-- local sharedkerns, basekerns = constructors.check_base_kerns(tfmdata) +-- loop over descriptions (afm and otf have descriptions, tfm not) +-- there is no need (yet) to assign a value to chr.tonunicode + +-- constructors.prepare_base_kerns(tfmdata) -- optimalization + +-- we have target.name=metricfile and target.fullname=RealName and target.filename=diskfilename +-- when collapsing fonts, luatex looks as both target.name and target.fullname as ttc files +-- can have multiple subfonts + +function constructors.calculatescale(tfmdata,scaledpoints) + local parameters = tfmdata.parameters + if scaledpoints < 0 then + scaledpoints = (- scaledpoints/1000) * (tfmdata.designsize or parameters.designsize) -- already in sp + end + return scaledpoints, scaledpoints / (parameters.units or 1000) -- delta +end + +function constructors.assignmathparameters(target,tfmdata) + -- when a tfm file is loaded, it has already been scaled + -- and it never enters the scaled so this is otf only + local mathparameters = original.mathparameters + if mathparameters and next(mathparameters) then + local targetparameters = target.parameters + local targetmathparameters = { } + local factor = targetparameters.factor + for name, value in next, mathparameters do + if name == "RadicalDegreeBottomRaisePercent" then + targetmathparameters[name] = value + else + targetmathparameters[name] = value * factor + end + end + if not targetmathparameters.AccentBaseHeight then + targetmathparameters.AccentBaseHeight = nil -- safeguard, still needed? + end + if not targetmathparameters.FractionDelimiterSize then + targetmathparameters.FractionDelimiterSize = 0 + end + if not mathparameters.FractionDelimiterDisplayStyleSize then + targetmathparameters.FractionDelimiterDisplayStyleSize = 0 + end + target.mathparameters = targetmathparameters + end +end + +function constructors.scale(tfmdata,specification) + local target = { } -- the new table + -- + if tonumber(specification) then + specification = { size = specification } + end + -- + local scaledpoints = specification.size + local relativeid = specification.relativeid + -- + local properties = tfmdata.properties or { } + local goodies = tfmdata.goodies or { } + local resources = tfmdata.resources or { } + local descriptions = tfmdata.descriptions or { } -- bad news if empty + local characters = tfmdata.characters or { } -- bad news if empty + local changed = tfmdata.changed or { } -- for base mode + local shared = tfmdata.shared or { } + local parameters = tfmdata.parameters or { } + local mathparameters = tfmdata.mathparameters or { } + -- + local targetcharacters = { } + local targetdescriptions = table.derive(descriptions) + local targetparameters = table.derive(parameters) + -- local targetmathparameters = table.fastcopy(mathparameters) -- happens elsewhere + local targetproperties = table.derive(properties) + local targetgoodies = goodies -- we need to loop so no metatable + target.characters = targetcharacters + target.descriptions = targetdescriptions + target.parameters = targetparameters + -- target.mathparameters = targetmathparameters -- happens elsewhere + target.properties = targetproperties + target.goodies = targetgoodies + target.shared = shared + target.resources = resources + target.unscaled = tfmdata -- the original unscaled one + -- + -- specification.mathsize : 1=text 2=script 3=scriptscript + -- specification.textsize : natural (text)size + -- parameters.mathsize : 1=text 2=script 3=scriptscript >1000 enforced size (feature value other than yes) + -- + local mathsize = tonumber(specification.mathsize) or 0 + local textsize = tonumber(specification.textsize) or scaledpoints + local forcedsize = tonumber(parameters.mathsize ) or 0 + if (mathsize == 2 or forcedsize == 2) and parameters.scriptpercentage then + scaledpoints = parameters.scriptpercentage * textsize / 100 + elseif (mathsize == 3 or forcedsize == 3) and parameters.scriptscriptpercentage then + scaledpoints = parameters.scriptscriptpercentage * textsize / 100 + elseif forcedsize > 1000 then -- safeguard + scaledpoints = forcedsize + end + -- + local tounicode = resources.tounicode + local defaultwidth = resources.defaultwidth or 0 + local defaultheight = resources.defaultheight or 0 + local defaultdepth = resources.defaultdepth or 0 + local units = parameters.units or 1000 + -- + if target.fonts then + target.fonts = fastcopy(target.fonts) -- maybe we virtualize more afterwards + end + -- + -- boundary keys are no longer needed as we now have a string 'right_boundary' + -- that can be used in relevant tables (kerns and ligatures) ... not that I ever + -- used them + -- + -- boundarychar_label = 0, -- not needed + -- boundarychar = 65536, -- there is now a string 'right_boundary' + -- false_boundarychar = 65536, -- produces invalid tfm in luatex + -- + targetproperties.language = properties.language or "dflt" -- inherited + targetproperties.script = properties.script or "dflt" -- inherited + targetproperties.mode = properties.mode or "base" -- inherited + -- + local askedscaledpoints = scaledpoints + local scaledpoints, delta = constructors.calculatescale(tfmdata,scaledpoints) -- no shortcut, dan be redefined + -- + local hdelta = delta + local vdelta = delta + -- + target.designsize = parameters.designsize -- not really needed so it muight become obsolete + target.units_per_em = units -- just a trigger for the backend (does luatex use this? if not it will go) + -- + local direction = properties.direction or tfmdata.direction or 0 -- pointless, as we don't use omf fonts at all + target.direction = direction + properties.direction = direction + -- + target.size = scaledpoints + -- + target.encodingbytes = properties.encodingbytes or 1 + target.embedding = properties.embedding or "subset" + target.tounicode = 1 + target.cidinfo = properties.cidinfo + target.format = properties.format + -- + local fontname = properties.fontname or tfmdata.fontname -- for the moment we fall back on + local fullname = properties.fullname or tfmdata.fullname -- names in the tfmdata although + local filename = properties.filename or tfmdata.filename -- that is not the right place to + local psname = properties.psname or tfmdata.psname -- pass them + local name = properties.name or tfmdata.name + -- + if not psname or psname == "" then + -- name used in pdf file as well as for selecting subfont in ttc/dfont + psname = fontname or (fullname and fonts.names.cleanname(fullname)) + end + target.fontname = fontname + target.fullname = fullname + target.filename = filename + target.psname = psname + target.name = name + -- + properties.fontname = fontname + properties.fullname = fullname + properties.filename = filename + properties.psname = psname + properties.name = name + -- expansion (hz) + local expansion = parameters.expansion + if expansion then + target.stretch = expansion.stretch + target.shrink = expansion.shrink + target.step = expansion.step + target.auto_expand = expansion.auto + end + -- protrusion + local protrusion = parameters.protrusion + if protrusion then + target.auto_protrude = protrusion.auto + end + -- widening + local extend_factor = parameters.extend_factor or 0 + if extend_factor ~= 0 and extend_factor ~= 1 then + hdelta = hdelta * extend_factor + target.extend = extend_factor * 1000 -- extent ? + else + target.extend = 1000 -- extent ? + end + -- slanting + local slant_factor = parameters.slant_factor or 0 + if slant_factor ~= 0 then + target.slant = slant_factor * 1000 + else + target.slant = 0 + end + -- + targetparameters.factor = delta + targetparameters.hfactor = hdelta + targetparameters.vfactor = vdelta + targetparameters.size = scaledpoints + targetparameters.units = units + targetparameters.scaledpoints = askedscaledpoints + -- + local isvirtual = properties.virtualized or tfmdata.type == "virtual" + local hasquality = target.auto_expand or target.auto_protrude + local hasitalic = properties.italic_correction + local stackmath = not properties.no_stackmath + local nonames = properties.noglyphnames + local nodemode = properties.mode == "node" + -- + if changed and not next(changed) then + changed = false + end + -- + target.type = isvirtual and "virtual" or "real" + -- this will move to some subtable so that it is copied at once + target.postprocessors = tfmdata.postprocessors + -- + local targetslant = (parameters.slant or parameters[1] or 0) + local targetspace = (parameters.space or parameters[2] or 0)*hdelta + local targetspace_stretch = (parameters.space_stretch or parameters[3] or 0)*hdelta + local targetspace_shrink = (parameters.space_shrink or parameters[4] or 0)*hdelta + local targetx_height = (parameters.x_height or parameters[5] or 0)*vdelta + local targetquad = (parameters.quad or parameters[6] or 0)*hdelta + local targetextra_space = (parameters.extra_space or parameters[7] or 0)*hdelta + -- + targetparameters.slant = targetslant + targetparameters.space = targetspace + targetparameters.space_stretch = targetspace_stretch + targetparameters.space_shrink = targetspace_shrink + targetparameters.x_height = targetx_height + targetparameters.quad = targetquad + targetparameters.extra_space = targetextra_space + -- + local ascender = parameters.ascender + if ascender then + targetparameters.ascender = delta * ascender + end + local descender = parameters.descender + if descender then + targetparameters.descender = delta * descender + end + -- copies, might disappear + targetparameters.xheight = targetparameters.xheight or parameters.x_height + targetparameters.extraspace = targetparameters.extraspace or parameters.extra_space + targetparameters.spacestretch = targetparameters.spacestretch or parameters.space_stretch + targetparameters.spaceshrink = targetparameters.spaceshrink or parameters.space_shrink + -- + local protrusionfactor = (targetquad ~= 0 and 1000/targetquad) or 0 + local scaledwidth = defaultwidth * hdelta + local scaledheight = defaultheight * vdelta + local scaleddepth = defaultdepth * vdelta + -- + local hasmath = (properties.has_math or next(mathparameters)) and true + if hasmath then + if trace_defining then + report_defining("math enabled for: name '%s', fullname: '%s', filename: '%s'", + name or "noname",fullname or "nofullname",filename or "nofilename") + end + constructors.assignmathparameters(target,tfmdata) -- does scaling and whatever is needed + properties.has_math = true + target.nomath = false + target.MathConstants = target.mathparameters + else + if trace_defining then + report_defining("math disabled for: name '%s', fullname: '%s', filename: '%s'", + name or "noname",fullname or "nofullname",filename or "nofilename") + end + properties.has_math = false + target.nomath = true + target.mathparameters = nil -- nop + end + -- + local sharedkerns = { } + -- + for unicode, character in next, characters do + local chr, description, index + if changed then + -- basemode hack + local c = changed[unicode] + if c then + description = descriptions[c] or character + character = characters[c] or character + index = description.index or c + else + description = descriptions[unicode] or character + index = description.index or unicode + end + else + description = descriptions[unicode] or character + index = description.index or unicode + end + local width = description.width + local height = description.height + local depth = description.depth + if width then width = hdelta*width else width = scaledwidth end + if height then height = vdelta*height else height = scaledheight end + -- if depth then depth = vdelta*depth else depth = scaleddepth end + if depth and depth ~= 0 then + depth = delta*depth + if nonames then + chr = { + index = index, + height = height, + depth = depth, + width = width, + } + else + chr = { + name = description.name, + index = index, + height = height, + depth = depth, + width = width, + } + end + else + -- this saves a little bit of memory time and memory, esp for big cjk fonts + if nonames then + chr = { + index = index, + height = height, + width = width, + } + else + chr = { + name = description.name, + index = index, + height = height, + width = width, + } + end + end + -- if trace_scaling then + -- report_defining("t=%s, u=%s, i=%s, n=%s c=%s",k,chr.tounicode or "",index or 0,description.name or '-',description.class or '-') + -- end + if tounicode then + local tu = tounicode[index] -- nb: index! + if tu then + chr.tounicode = tu + end + end + if hasquality then + -- we could move these calculations elsewhere (saves calculations) + local ve = character.expansion_factor + if ve then + chr.expansion_factor = ve*1000 -- expansionfactor, hm, can happen elsewhere + end + local vl = character.left_protruding + if vl then + chr.left_protruding = protrusionfactor*width*vl + end + local vr = character.right_protruding + if vr then + chr.right_protruding = protrusionfactor*width*vr + end + end + -- todo: hasitalic + if hasitalic then + local vi = description.italic or character.italic + if vi and vi ~= 0 then + chr.italic = vi*hdelta + end + end + -- to be tested + if hasmath then + -- todo, just operate on descriptions.math + local vn = character.next + if vn then + chr.next = vn + -- if character.vert_variants or character.horiz_variants then + -- report_defining("glyph U+%05X has combination of next, vert_variants and horiz_variants",index) + -- end + else + local vv = character.vert_variants + if vv then + local t = { } + for i=1,#vv do + local vvi = vv[i] + t[i] = { + ["start"] = (vvi["start"] or 0)*vdelta, + ["end"] = (vvi["end"] or 0)*vdelta, + ["advance"] = (vvi["advance"] or 0)*vdelta, + ["extender"] = vvi["extender"], + ["glyph"] = vvi["glyph"], + } + end + chr.vert_variants = t + else + local hv = character.horiz_variants + if hv then + local t = { } + for i=1,#hv do + local hvi = hv[i] + t[i] = { + ["start"] = (hvi["start"] or 0)*hdelta, + ["end"] = (hvi["end"] or 0)*hdelta, + ["advance"] = (hvi["advance"] or 0)*hdelta, + ["extender"] = hvi["extender"], + ["glyph"] = hvi["glyph"], + } + end + chr.horiz_variants = t + end + end + end + local va = character.top_accent + if va then + chr.top_accent = vdelta*va + end + if stackmath then + local mk = character.mathkerns -- not in math ? + if mk then + local kerns = { } + local v = mk.top_right if v then local k = { } for i=1,#v do local vi = v[i] + k[i] = { height = vdelta*vi.height, kern = vdelta*vi.kern } + end kerns.top_right = k end + local v = mk.top_left if v then local k = { } for i=1,#v do local vi = v[i] + k[i] = { height = vdelta*vi.height, kern = vdelta*vi.kern } + end kerns.top_left = k end + local v = mk.bottom_left if v then local k = { } for i=1,#v do local vi = v[i] + k[i] = { height = vdelta*vi.height, kern = vdelta*vi.kern } + end kerns.bottom_left = k end + local v = mk.bottom_right if v then local k = { } for i=1,#v do local vi = v[i] + k[i] = { height = vdelta*vi.height, kern = vdelta*vi.kern } + end kerns.bottom_right = k end + chr.mathkern = kerns -- singular -> should be patched in luatex ! + end + end + end + if not nodemode then + local vk = character.kerns + if vk then + local s = sharedkerns[vk] + if not s then + s = { } + for k,v in next, vk do s[k] = v*hdelta end + sharedkerns[vk] = s + end + chr.kerns = s + end + local vl = character.ligatures + if vl then + if true then + chr.ligatures = vl -- shared + else + local tt = { } + for i,l in next, vl do + tt[i] = l + end + chr.ligatures = tt + end + end + end + if isvirtual then + local vc = character.commands + if vc then + -- we assume non scaled commands here + -- tricky .. we need to scale pseudo math glyphs too + -- which is why we deal with rules too + local ok = false + for i=1,#vc do + local key = vc[i][1] + if key == "right" or key == "down" then + ok = true + break + end + end + if ok then + local tt = { } + for i=1,#vc do + local ivc = vc[i] + local key = ivc[1] + if key == "right" then + tt[i] = { key, ivc[2]*hdelta } + elseif key == "down" then + tt[i] = { key, ivc[2]*vdelta } + elseif key == "rule" then + tt[i] = { key, ivc[2]*vdelta, ivc[3]*hdelta } + else -- not comment + tt[i] = ivc -- shared since in cache and untouched + end + end + chr.commands = tt + else + chr.commands = vc + end + chr.index = nil + end + end + targetcharacters[unicode] = chr + end + return target +end + +function constructors.finalize(tfmdata) + if tfmdata.properties and tfmdata.properties.finalized then + return + end + -- + if not tfmdata.characters then + return nil + end + -- + if not tfmdata.goodies then + tfmdata.goodies = { } -- context specific + end + -- + local parameters = tfmdata.parameters + if not parameters then + return nil + end + -- + if not parameters.expansion then + parameters.expansion = { + stretch = tfmdata.stretch or 0, + shrink = tfmdata.shrink or 0, + step = tfmdata.step or 0, + auto = tfmdata.auto_expand or false, + } + end + -- + if not parameters.protrusion then + parameters.protrusion = { + auto = auto_protrude + } + end + -- + if not parameters.size then + parameters.size = tfmdata.size + end + -- + if not parameters.extend_factor then + parameters.extend_factor = tfmdata.extend or 0 + end + -- + if not parameters.slant_factor then + parameters.slant_factor = tfmdata.slant or 0 + end + -- + if not parameters.designsize then + parameters.designsize = tfmdata.designsize or 655360 + end + -- + if not parameters.units then + parameters.units = tfmdata.units_per_em or 1000 + end + -- + if not tfmdata.descriptions then + local descriptions = { } -- yes or no + setmetatableindex(descriptions, function(t,k) local v = { } t[k] = v return v end) + tfmdata.descriptions = descriptions + end + -- + local properties = tfmdata.properties + if not properties then + properties = { } + tfmdata.properties = properties + end + -- + if not properties.virtualized then + properties.virtualized = tfmdata.type == "virtual" + end + -- + if not tfmdata.properties then + tfmdata.properties = { + fontname = tfmdata.fontname, + filename = tfmdata.filename, + fullname = tfmdata.fullname, + name = tfmdata.name, + psname = tfmdata.psname, + -- + encodingbytes = tfmdata.encodingbytes or 1, + embedding = tfmdata.embedding or "subset", + tounicode = tfmdata.tounicode or 1, + cidinfo = tfmdata.cidinfo or nil, + format = tfmdata.format or "type1", + direction = tfmdata.direction or 0, + } + end + if not tfmdata.resources then + tfmdata.resources = { } + end + if not tfmdata.shared then + tfmdata.shared = { } + end + -- + -- tfmdata.fonts + -- tfmdata.unscaled + -- + if not properties.has_math then + properties.has_math = not tfmdata.nomath + end + -- + tfmdata.MathConstants = nil + tfmdata.postprocessors = nil + -- + tfmdata.fontname = nil + tfmdata.filename = nil + tfmdata.fullname = nil + tfmdata.name = nil -- most tricky part + tfmdata.psname = nil + -- + tfmdata.encodingbytes = nil + tfmdata.embedding = nil + tfmdata.tounicode = nil + tfmdata.cidinfo = nil + tfmdata.format = nil + tfmdata.direction = nil + tfmdata.type = nil + tfmdata.nomath = nil + tfmdata.designsize = nil + -- + tfmdata.size = nil + tfmdata.stretch = nil + tfmdata.shrink = nil + tfmdata.step = nil + tfmdata.auto_expand = nil + tfmdata.auto_protrude = nil + tfmdata.extend = nil + tfmdata.slant = nil + tfmdata.units_per_em = nil + -- + properties.finalized = true + -- + return tfmdata +end + +--[[ldx-- +

A unique hash value is generated by:

+--ldx]]-- + +local hashmethods = { } +constructors.hashmethods = hashmethods + +function constructors.hashfeatures(specification) -- will be overloaded + local features = specification.features + if features then + local t, tn = { }, 0 + for category, list in next, features do + if next(list) then + local hasher = hashmethods[category] + if hasher then + local hash = hasher(list) + if hash then + tn = tn + 1 + t[tn] = category .. ":" .. hash + end + end + end + end + if tn > 0 then + return concat(t," & ") + end + end + return "unknown" +end + +hashmethods.normal = function(list) + local s = { } + local n = 0 + for k, v in next, list do + if k ~= "number" and k ~= "features" then -- I need to figure this out, features + n = n + 1 + s[n] = k + end + end + if n > 0 then + sort(s) + for i=1,n do + local k = s[i] + s[i] = k .. '=' .. tostring(list[k]) + end + return concat(s,"+") + end +end + +--[[ldx-- +

In principle we can share tfm tables when we are in node for a font, but then +we need to define a font switch as an id/attr switch which is no fun, so in that +case users can best use dynamic features ... so, we will not use that speedup. Okay, +when we get rid of base mode we can optimize even further by sharing, but then we +loose our testcases for .

+--ldx]]-- + +function constructors.hashinstance(specification,force) + local hash, size, fallbacks = specification.hash, specification.size, specification.fallbacks + if force or not hash then + hash = constructors.hashfeatures(specification) + specification.hash = hash + end + if size < 1000 and designsizes[hash] then + size = math.round(constructors.scaled(size,designsizes[hash])) + specification.size = size + end + -- local mathsize = specification.mathsize or 0 + -- if mathsize > 0 then + -- local textsize = specification.textsize + -- if fallbacks then + -- return hash .. ' @ ' .. tostring(size) .. ' [ ' .. tostring(mathsize) .. ' : ' .. tostring(textsize) .. ' ] @ ' .. fallbacks + -- else + -- return hash .. ' @ ' .. tostring(size) .. ' [ ' .. tostring(mathsize) .. ' : ' .. tostring(textsize) .. ' ]' + -- end + -- else + if fallbacks then + return hash .. ' @ ' .. tostring(size) .. ' @ ' .. fallbacks + else + return hash .. ' @ ' .. tostring(size) + end + -- end +end + +function constructors.setname(tfmdata,specification) -- todo: get specification from tfmdata + if constructors.namemode == "specification" then + -- not to be used in context ! + local specname = specification.specification + if specname then + tfmdata.properties.name = specname + if trace_defining then + report_otf("overloaded fontname: '%s'",specname) + end + end + end +end + +function constructors.checkedfilename(data) + local foundfilename = data.foundfilename + if not foundfilename then + local askedfilename = data.filename or "" + if askedfilename ~= "" then + askedfilename = resolvers.resolve(askedfilename) -- no shortcut + foundfilename = resolvers.findbinfile(askedfilename,"") or "" + if foundfilename == "" then + report_defining("source file '%s' is not found",askedfilename) + foundfilename = resolvers.findbinfile(file.basename(askedfilename),"") or "" + if foundfilename ~= "" then + report_defining("using source file '%s' (cache mismatch)",foundfilename) + end + end + end + data.foundfilename = foundfilename + end + return foundfilename +end + +local formats = allocate() +fonts.formats = formats + +setmetatableindex(formats, function(t,k) + local l = lower(k) + if rawget(t,k) then + t[k] = l + return l + end + return rawget(t,file.extname(l)) +end) + +local locations = { } + +local function setindeed(mode,target,group,name,action,position) + local t = target[mode] + if not t then + report_defining("fatal error in setting feature '%s', group '%s', mode '%s'",name or "?",group or "?",mode) + os.exit() + elseif position then + -- todo: remove existing + insert(t, position, { name = name, action = action }) + else + for i=1,#t do + local ti = t[i] + if ti.name == name then + ti.action = action + return + end + end + insert(t, { name = name, action = action }) + end +end + +local function set(group,name,target,source) + target = target[group] + if not target then + report_defining("fatal target error in setting feature '%s', group '%s'",name or "?",group or "?") + os.exit() + end + local source = source[group] + if not source then + report_defining("fatal source error in setting feature '%s', group '%s'",name or "?",group or "?") + os.exit() + end + local node = source.node + local base = source.base + local position = source.position + if node then + setindeed("node",target,group,name,node,position) + end + if base then + setindeed("base",target,group,name,base,position) + end +end + +local function register(where,specification) + local name = specification.name + if name and name ~= "" then + local default = specification.default + local description = specification.description + local initializers = specification.initializers + local processors = specification.processors + local manipulators = specification.manipulators + local modechecker = specification.modechecker + if default then + where.defaults[name] = default + end + if description and description ~= "" then + where.descriptions[name] = description + end + if initializers then + set('initializers',name,where,specification) + end + if processors then + set('processors', name,where,specification) + end + if manipulators then + set('manipulators',name,where,specification) + end + if modechecker then + where.modechecker = modechecker + end + end +end + +constructors.registerfeature = register + +function constructors.getfeatureaction(what,where,mode,name) + what = handlers[what].features + if what then + where = what[where] + if where then + mode = where[mode] + if mode then + for i=1,#mode do + local m = mode[i] + if m.name == name then + return m.action + end + end + end + end + end +end + +function constructors.newfeatures(what) + local features = handlers[what].features + if not features then + local tables = handlers[what].tables -- can be preloaded + features = allocate { + defaults = { }, + descriptions = tables and tables.features or { }, + initializers = { base = { }, node = { } }, + processors = { base = { }, node = { } }, + manipulators = { base = { }, node = { } }, + } + features.register = function(specification) return register(features,specification) end + handlers[what].features = features -- will also become hidden + end + return features +end + +--[[ldx-- +

We need to check for default features. For this we provide +a helper function.

+--ldx]]-- + +function constructors.checkedfeatures(what,features) + local defaults = handlers[what].features.defaults + if features and next(features) then + features = fastcopy(features) -- can be inherited + for key, value in next, defaults do + if features[key] == nil then + features[key] = value + end + end + return features + else + return fastcopy(defaults) -- we can change features in place + end +end + +-- before scaling + +function constructors.initializefeatures(what,tfmdata,features,trace,report) + if features and next(features) then + local properties = tfmdata.properties or { } -- brrr + local whathandler = handlers[what] + local whatfeatures = whathandler.features + local whatinitializers = whatfeatures.initializers + local whatmodechecker = whatfeatures.modechecker + -- properties.mode can be enforces (for instance in font-otd) + local mode = properties.mode or (whatmodechecker and whatmodechecker(tfmdata,features,features.mode)) or features.mode or "base" + properties.mode = mode -- also status + features.mode = mode -- both properties.mode or features.mode can be changed + -- + local done = { } + while true do + local redo = false + local initializers = whatfeatures.initializers[mode] + if initializers then + for i=1,#initializers do + local step = initializers[i] + local feature = step.name +-- we could intercept mode here .. needs a rewrite of this whole loop then btu it's cleaner that way + local value = features[feature] + if not value then + -- disabled + elseif done[feature] then + -- already done + else + local action = step.action + if trace then + report("initializing feature %s to %s for mode %s for font %s",feature, + tostring(value),mode or 'unknown', tfmdata.properties.fullname or 'unknown') + end + action(tfmdata,value,features) -- can set mode (e.g. goodies) so it can trigger a restart + if mode ~= properties.mode or mode ~= features.mode then + if whatmodechecker then + properties.mode = whatmodechecker(tfmdata,features,properties.mode) -- force checking + features.mode = properties.mode + end + if mode ~= properties.mode then + mode = properties.mode + redo = true + end + end + done[feature] = true + end + if redo then + break + end + end + if not redo then + break + end + else + break + end + end + properties.mode = mode -- to be sure + return true + else + return false + end +end + +-- while typesetting + +function constructors.collectprocessors(what,tfmdata,features,trace,report) + local processes, nofprocesses = { }, 0 + if features and next(features) then + local properties = tfmdata.properties + local whathandler = handlers[what] + local whatfeatures = whathandler.features + local whatprocessors = whatfeatures.processors + local processors = whatprocessors[properties.mode] + if processors then + for i=1,#processors do + local step = processors[i] + local feature = step.name + if features[feature] then + local action = step.action + if trace then + report("installing feature processor %s for mode %s for font %s",feature, + mode or 'unknown', tfmdata.properties.fullname or 'unknown') + end + if action then + nofprocesses = nofprocesses + 1 + processes[nofprocesses] = action + end + end + end + end + end + return processes +end + +-- after scaling + +function constructors.applymanipulators(what,tfmdata,features,trace,report) + if features and next(features) then + local properties = tfmdata.properties + local whathandler = handlers[what] + local whatfeatures = whathandler.features + local whatmanipulators = whatfeatures.manipulators + local manipulators = whatmanipulators[properties.mode] + if manipulators then + for i=1,#manipulators do + local step = manipulators[i] + local feature = step.name + local value = features[feature] + if value then + local action = step.action + if trace then + report("applying feature manipulator %s for mode %s for font %s",feature, + mode or 'unknown', tfmdata.properties.fullname or 'unknown') + end + if action then + action(tfmdata,feature,value) + end + end + end + end + end +end diff --git a/Master/texmf-dist/tex/context/base/font-ctx.lua b/Master/texmf-dist/tex/context/base/font-ctx.lua index 76e9f095a48..887aa99841e 100644 --- a/Master/texmf-dist/tex/context/base/font-ctx.lua +++ b/Master/texmf-dist/tex/context/base/font-ctx.lua @@ -6,34 +6,221 @@ if not modules then modules = { } end modules ['font-ctx'] = { license = "see context related readme files" } --- needs a cleanup: merge of replace, lang/script etc +-- At some point I will clean up the code here so that at the tex end +-- the table interface is used. -local texsprint, count, texsetcount = tex.sprint, tex.count, tex.setcount -local format, concat, gmatch, match, find, lower, gsub, byte = string.format, table.concat, string.gmatch, string.match, string.find, string.lower, string.gsub, string.byte +local texcount, texsetcount = tex.count, tex.setcount +local format, gmatch, match, find, lower, gsub, byte = string.format, string.gmatch, string.match, string.find, string.lower, string.gsub, string.byte +local concat, serialize, sort = table.concat, table.serialize, table.sort +local settings_to_hash, hash_to_string = utilities.parsers.settings_to_hash, utilities.parsers.hash_to_string +local formatcolumns = utilities.formatters.formatcolumns local tostring, next, type = tostring, next, type -local lpegmatch = lpeg.match +local utfchar, utfbyte = utf.char, utf.byte local round = math.round -local ctxcatcodes = tex.ctxcatcodes +local P, S, C, Cc, Cf, Cg, Ct, lpegmatch = lpeg.P, lpeg.S, lpeg.C, lpeg.Cc, lpeg.Cf, lpeg.Cg, lpeg.Ct, lpeg.match + +local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) +local trace_usage = false trackers.register("fonts.usage", function(v) trace_usage = v end) +local trace_mapfiles = false trackers.register("fonts.mapfiles", function(v) trace_mapfiles = v end) +local trace_automode = false trackers.register("fonts.automode", function(v) trace_automode = v end) + +local report_defining = logs.reporter("fonts","defining") +local report_status = logs.reporter("fonts","status") +local report_mapfiles = logs.reporter("fonts","mapfiles") + +local setmetatableindex = table.setmetatableindex + +local fonts = fonts +local handlers = fonts.handlers +local otf = handlers.otf -- brrr +local names = fonts.names +local definers = fonts.definers +local specifiers = fonts.specifiers +local constructors = fonts.constructors +local loggers = fonts.loggers +local helpers = fonts.helpers +local hashes = fonts.hashes +local fontdata = hashes.identifiers +local currentfont = font.current +local texattribute = tex.attribute + +local otffeatures = fonts.constructors.newfeatures("otf") +local registerotffeature = otffeatures.register +local baseprocessors = otffeatures.processors.base +local baseinitializers = otffeatures.initializers.base + +specifiers.contextsetups = specifiers.contextsetups or { } +specifiers.contextnumbers = specifiers.contextnumbers or { } +specifiers.contextmerged = specifiers.contextmerged or { } +specifiers.synonyms = specifiers.synonyms or { } + +local setups = specifiers.contextsetups +local numbers = specifiers.contextnumbers +local merged = specifiers.contextmerged +local synonyms = specifiers.synonyms + +storage.register("fonts/setups" , setups , "fonts.specifiers.contextsetups" ) +storage.register("fonts/numbers", numbers, "fonts.specifiers.contextnumbers") +storage.register("fonts/merged", merged, "fonts.specifiers.contextmerged") +storage.register("fonts/synonyms", synonyms, "fonts.specifiers.synonyms") + +constructors.resolvevirtualtoo = true -- context specific (due to resolver) + +local allocate, mark = utilities.storage.allocate, utilities.storage.mark + +local nulldata = { + name = "nullfont", + characters = { }, + descriptions = { }, + properties = { }, + parameters = { -- lmromanregular @ 12pt + slant = 0, -- 1 + space = 256377, -- 2 + spacestretch = 128188, -- 3 + spaceshrink = 85459, -- 4 + xheight = 338952, -- 5 + quad = 786432, -- 6 + extraspace = 85459, -- 7 + }, +} + +function definers.resetnullfont() + -- resetting is needed because tikz misuses nullfont + local parameters = nulldata.parameters + parameters.slant = 0 -- 1 + parameters.space = 0 -- 2 + parameters.spacestretch = 0 -- 3 + parameters.spaceshrink = 0 -- 4 + parameters.xheight = 0 -- 5 + parameters.quad = 0 -- 6 + parameters.extraspace = 0 -- 7 + definers.resetnullfont = function() end +end + +setmetatableindex(fontdata, function(t,k) return nulldata end) + +local chardata = allocate() -- chardata +local parameters = allocate() +local csnames = allocate() -- namedata +local quaddata = allocate() -- quaddata +local xheightdata = allocate() -- xheightdata + +hashes.characters = chardata +hashes.parameters = parameters +hashes.quads = quaddata +hashes.xheights = xheightdata + +setmetatableindex(chardata, function(t,k) + local characters = fontdata[k].characters + t[k] = characters + return characters +end) -local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) +setmetatableindex(parameters, function(t,k) + local parameters = fontdata[k].parameters + t[k] = parameters + return parameters +end) -local tfm = fonts.tfm -local define = fonts.define -local fontdata = fonts.identifiers -local specify = define.specify +setmetatableindex(quaddata, function(t,k) + local parameters = parameters[k] + local quad = parameters and parameters.quad or 0 + t[k] = quad + return quad +end) -specify.context_setups = specify.context_setups or { } -specify.context_numbers = specify.context_numbers or { } -specify.context_merged = specify.context_merged or { } -specify.synonyms = specify.synonyms or { } +setmetatableindex(xheightdata, function(t,k) + local parameters = parameters[k] + local xheight = parameters and parameters.xheight or 0 + t[k] = xheight + return quad +end) -local setups = specify.context_setups -local numbers = specify.context_numbers -local merged = specify.context_merged -local synonyms = specify.synonyms -local triggers = fonts.triggers +-- this cannot be a feature initializer as there is no auto namespace +-- so we never enter the loop then; we can store the defaults in the tma +-- file (features.gpos.mkmk = 1 etc) + +local needsnodemode = { + gpos_mark2mark = true, + gpos_mark2base = true, + gpos_mark2ligature = true, +} + +local function modechecker(tfmdata,features,mode) -- we cannot adapt features as they are shared! + if mode == "auto" then + local rawdata = tfmdata.shared.rawdata + local resources = rawdata and rawdata.resources + local sequences = resources.sequences + if sequences and #sequences > 0 then + local script = features.script or "dflt" + local language = features.language or "dflt" + for feature, value in next, features do + if value then + local found = false + for i=1,#sequences do + local sequence = sequences[i] + local features = sequence.features + if features then + local scripts = features[feature] + if scripts then + local languages = scripts[script] + if languages and languages[language] then + if found then + -- more than one lookup + if trace_automode then + report_defining("forcing node mode in font %s for feature %s, script %s, language %s (multiple lookups)",file.basename(tfmdata.properties.name),feature,script,language) + end + features.mode = "node" + return "node" + elseif needsnodemode[sequence.type] then + if trace_automode then + report_defining("forcing node mode in font %s for feature %s, script %s, language %s (no base support)",file.basename(tfmdata.properties.name),feature,script,language) + end + features.mode = "node" + return "node" + else + -- at least one lookup + found = true + end + end + end + end + end + end + end + end + return "base" + else + return mode + end +end + +registerotffeature { + -- we only set the checker and leave other settings of the mode + -- feature as they are + name = "mode", + modechecker = modechecker, +} + +-- -- default = true anyway +-- +-- local normalinitializer = constructors.getfeatureaction("otf","initializers","node","analyze") +-- +-- local function analyzeinitializer(tfmdata,value,features) -- attr +-- if value == "auto" and features then +-- value = features.init or features.medi or features.fina or features.isol or false +-- end +-- return normalinitializer(tfmdata,value,features) +-- end +-- +-- registerotffeature { +-- name = "analyze", +-- initializers = { +-- node = analyzeinitializer, +-- }, +-- } --[[ldx--

So far we haven't really dealt with features (or whatever we want @@ -48,29 +235,45 @@ name*context specification --ldx]]-- -function specify.predefined(specification) - local detail = specification.detail - if detail ~= "" then - -- detail = gsub(detail,"["..define.splitsymbols.."].*$","") -- get rid of *whatever specs and such - if define.methods[detail] then -- since these may be appended at the - specification.features.vtf = { preset = detail } -- tex end by default +-- currently fonts are scaled while constructing the font, so we +-- have to do scaling of commands in the vf at that point using e.g. +-- "local scale = g.parameters.factor or 1" after all, we need to +-- work with copies anyway and scaling needs to be done at some point; +-- however, when virtual tricks are used as feature (makes more +-- sense) we scale the commands in fonts.constructors.scale (and set the +-- factor there) + +local loadfont = definers.loadfont + +function definers.loadfont(specification,size,id) -- overloads the one in font-def + local variants = definers.methods.variants + local virtualfeatures = specification.features.virtual + if virtualfeatures and virtualfeatures.preset then + local variant = variants[virtualfeatures.preset] + if variant then + return variant(specification,size,id) end + else + local tfmdata = loadfont(specification,size,id) + -- constructors.checkvirtualid(tfmdata,id) + return tfmdata end - return specification end -define.register_split("@", specify.predefined) +local function predefined(specification) + local variants = definers.methods.variants + local detail = specification.detail + if detail ~= "" and variants[detail] then + specification.features.virtual = { preset = detail } + end + return specification +end -storage.register("fonts/setups" , define.specify.context_setups , "fonts.define.specify.context_setups" ) -storage.register("fonts/numbers", define.specify.context_numbers, "fonts.define.specify.context_numbers") -storage.register("fonts/merged", define.specify.context_merged, "fonts.define.specify.context_merged") -storage.register("fonts/synonyms", define.specify.synonyms, "fonts.define.specify.synonyms") +definers.registersplit("@", predefined,"virtual") -local normalize_meanings = fonts.otf.meanings.normalize -local settings_to_hash = aux.settings_to_hash -local default_features = fonts.otf.features.default +local normalize_features = otffeatures.normalize -- should be general -local function preset_context(name,parent,features) -- currently otf only +local function presetcontext(name,parent,features) -- will go to con and shared if features == "" and find(parent,"=") then features = parent parent = "" @@ -78,9 +281,9 @@ local function preset_context(name,parent,features) -- currently otf only if features == "" then features = { } elseif type(features) == "string" then - features = normalize_meanings(settings_to_hash(features)) + features = normalize_features(settings_to_hash(features)) else - features = normalize_meanings(features) + features = normalize_features(features) end -- todo: synonyms, and not otf bound if parent ~= "" then @@ -98,10 +301,18 @@ local function preset_context(name,parent,features) -- currently otf only -- these are auto set so in order to prevent redundant definitions -- we need to preset them (we hash the features and adding a default -- setting during initialization may result in a different hash) - for k,v in next, triggers do - if features[v] == nil then -- not false ! - local vv = default_features[v] - if vv then features[v] = vv end +--~ for k,v in next, triggers do +--~ if features[v] == nil then -- not false ! +--~ local vv = default_features[v] +--~ if vv then features[v] = vv end +--~ end +--~ end + for feature,value in next, features do + if value == nil then -- not false ! + local default = default_features[feature] + if default ~= nil then + features[feature] = default + end end end -- sparse 'm so that we get a better hash and less test (experimental @@ -111,7 +322,8 @@ local function preset_context(name,parent,features) -- currently otf only if v then t[k] = v end end -- needed for dynamic features - local number = (setups[name] and setups[name].number) or 0 + -- maybe number should always be renewed as we can redefine features + local number = (setups[name] and setups[name].number) or 0 -- hm, numbers[name] if number == 0 then number = #numbers + 1 numbers[number] = name @@ -121,7 +333,7 @@ local function preset_context(name,parent,features) -- currently otf only return number, t end -local function context_number(name) -- will be replaced +local function contextnumber(name) -- will be replaced local t = setups[name] if not t then return 0 @@ -152,7 +364,7 @@ local function context_number(name) -- will be replaced end end -local function merge_context(currentnumber,extraname,option) +local function mergecontext(currentnumber,extraname,option) local current = setups[numbers[currentnumber]] local extra = setups[extraname] if extra then @@ -182,13 +394,13 @@ local function merge_context(currentnumber,extraname,option) numbers[number] = mergedname merged[number] = option setups[mergedname] = mergedfeatures - return number -- context_number(mergedname) + return number -- contextnumber(mergedname) else return currentnumber end end -local function register_context(fontnumber,extraname,option) +local function registercontext(fontnumber,extraname,option) local extra = setups[extraname] if extra then local mergedfeatures, mergedname = { }, nil @@ -205,74 +417,152 @@ local function register_context(fontnumber,extraname,option) numbers[number] = mergedname merged[number] = option setups[mergedname] = mergedfeatures - return number -- context_number(mergedname) + return number -- contextnumber(mergedname) else return 0 end end -specify.preset_context = preset_context -specify.context_number = context_number -specify.merge_context = merge_context -specify.register_context = register_context +specifiers.presetcontext = presetcontext +specifiers.contextnumber = contextnumber +specifiers.mergecontext = mergecontext +specifiers.registercontext = registercontext -local current_font = font.current -local tex_attribute = tex.attribute +-- we extend the hasher: + +constructors.hashmethods.virtual = function(list) + local s = { } + local n = 0 + for k, v in next, list do + n = n + 1 + s[n] = k + end + if n > 0 then + sort(s) + for i=1,n do + local k = s[i] + s[i] = k .. '=' .. tostring(list[k]) + end + return concat(s,"+") + end +end + +-- end of redefine local cache = { } -- concat might be less efficient than nested tables -function fonts.withset(name,what) - local zero = tex_attribute[0] +local function withset(name,what) + local zero = texattribute[0] local hash = zero .. "+" .. name .. "*" .. what local done = cache[hash] if not done then - done = merge_context(zero,name,what) + done = mergecontext(zero,name,what) cache[hash] = done end - tex_attribute[0] = done + texattribute[0] = done end -function fonts.withfnt(name,what) - local font = current_font() + +local function withfnt(name,what) + local font = currentfont() local hash = font .. "*" .. name .. "*" .. what local done = cache[hash] if not done then - done = register_context(font,name,what) + done = registercontext(font,name,what) cache[hash] = done end - tex_attribute[0] = done + texattribute[0] = done end -function specify.show_context(name) +function specifiers.showcontext(name) return setups[name] or setups[numbers[name]] or setups[numbers[tonumber(name)]] or { } end -local function split_context(features) - return setups[features] or (preset_context(features,"","") and setups[features]) +-- todo: support a,b,c + +local function splitcontext(features) -- presetcontext creates dummy here + return setups[features] or (presetcontext(features,"","") and setups[features]) end -specify.split_context = split_context +--~ local splitter = lpeg.splitat("=") + +--~ local function splitcontext(features) +--~ local setup = setups[features] +--~ if setup then +--~ return setup +--~ elseif find(features,",") then +--~ -- This is not that efficient but handy anyway for quick and dirty tests +--~ -- beware, due to the way of caching setups you can get the wrong results +--~ -- when components change. A safeguard is to nil the cache. +--~ local merge = nil +--~ for feature in gmatch(features,"[^, ]+") do +--~ if find(feature,"=") then +--~ local k, v = lpegmatch(splitter,feature) +--~ if k and v then +--~ if not merge then +--~ merge = { k = v } +--~ else +--~ merge[k] = v +--~ end +--~ end +--~ else +--~ local s = setups[feature] +--~ if not s then +--~ -- skip +--~ elseif not merge then +--~ merge = s +--~ else +--~ for k, v in next, s do +--~ merge[k] = v +--~ end +--~ end +--~ end +--~ end +--~ setup = merge and presetcontext(features,"",merge) and setups[features] +--~ -- actually we have to nil setups[features] in order to permit redefinitions +--~ setups[features] = nil +--~ end +--~ return setup or (presetcontext(features,"","") and setups[features]) -- creates dummy +--~ end -function specify.context_tostring(name,kind,separator,yes,no,strict,omit) -- not used - return aux.hash_to_string(table.merged(fonts[kind].features.default or {},setups[name] or {}),separator,yes,no,strict,omit) -end +specifiers.splitcontext = splitcontext -local splitter = lpeg.splitat(",") +function specifiers.contexttostring(name,kind,separator,yes,no,strict,omit) -- not used + return hash_to_string(table.merged(handlers[kind].features.defaults or {},setups[name] or {}),separator,yes,no,strict,omit) +end -function specify.starred(features) -- no longer fallbacks here +local function starred(features) -- no longer fallbacks here local detail = features.detail if detail and detail ~= "" then - features.features.normal = split_context(detail) + features.features.normal = splitcontext(detail) else features.features.normal = { } end return features end -define.register_split('*',specify.starred) +definers.registersplit('*',starred,"featureset") --- define (two steps) +-- sort of xetex mode, but without [] and / as we have file: and name: etc -local P, C, Cc = lpeg.P, lpeg.C, lpeg.Cc +local space = P(" ") +local separator = S(";,") +local equal = P("=") +local spaces = space^0 +local sometext = C((1-equal-space-separator)^1) +local truevalue = P("+") * spaces * sometext * Cc(true) -- "yes" +local falsevalue = P("-") * spaces * sometext * Cc(false) -- "no" +local keyvalue = sometext * spaces * equal * spaces * sometext +local somevalue = sometext * spaces * Cc(true) -- "yes" +local pattern = Cf(Ct("") * (space + separator + Cg(keyvalue + falsevalue + truevalue + somevalue))^0, rawset) + +local function colonized(specification) + specification.features.normal = normalize_features(lpegmatch(pattern,specification.detail)) + return specification +end + +definers.registersplit(":",colonized,"direct") + +-- define (two steps) local space = P(" ") local spaces = space^0 @@ -290,56 +580,63 @@ local scale_scaled = P("scaled") * Cc(4) * spaces * dimension -- value local sizepattern = spaces * (scale_at + scale_sa + scale_mo + scale_scaled + scale_none) local splitpattern = spaces * value * spaces * rest -local specification -- +local specification -- still needed as local ? -local get_specification = define.get_specification +local getspecification = definers.getspecification -- we can make helper macros which saves parsing (but normaly not -- that many calls, e.g. in mk a couple of 100 and in metafun 3500) -function define.command_1(str) +local setdefaultfontname = context.fntsetdefname +local setsomefontname = context.fntsetsomename +local setemptyfontsize = context.fntsetnopsize +local setsomefontsize = context.fntsetsomesize + +function definers.stage_one(str) statistics.starttiming(fonts) local fullname, size = lpegmatch(splitpattern,str) - local lookup, name, sub, method, detail = get_specification(fullname) + local lookup, name, sub, method, detail = getspecification(fullname) if not name then - logs.report("define font","strange definition '%s'",str) - texsprint(ctxcatcodes,"\\fcglet\\somefontname\\defaultfontfile") + report_defining("strange definition '%s'",str) + setdefaultfontname() elseif name == "unknown" then - texsprint(ctxcatcodes,"\\fcglet\\somefontname\\defaultfontfile") + setdefaultfontname() else - texsprint(ctxcatcodes,"\\fcxdef\\somefontname{",name,"}") + setsomefontname(name) end -- we can also use a count for the size if size and size ~= "" then local mode, size = lpegmatch(sizepattern,size) if size and mode then - count.scaledfontmode = mode - texsprint(ctxcatcodes,"\\def\\somefontsize{",size,"}") + texcount.scaledfontmode = mode + setsomefontsize(size) else - count.scaledfontmode = 0 - texsprint(ctxcatcodes,"\\let\\somefontsize\\empty") + texcount.scaledfontmode = 0 + setemptyfontsize() end elseif true then -- so we don't need to check in tex - count.scaledfontmode = 2 - texsprint(ctxcatcodes,"\\let\\somefontsize\\empty") + texcount.scaledfontmode = 2 + setemptyfontsize() else - count.scaledfontmode = 0 - texsprint(ctxcatcodes,"\\let\\somefontsize\\empty") + texcount.scaledfontmode = 0 + setemptyfontsize() end - specification = define.makespecification(str,lookup,name,sub,method,detail,size) + specification = definers.makespecification(str,lookup,name,sub,method,detail,size) end local n = 0 -- we can also move rscale to here (more consistent) +-- the argument list will become a table -function define.command_2(global,cs,str,size,classfeatures,fontfeatures,classfallbacks,fontfallbacks,mathsize,textsize,relativeid) +function definers.stage_two(global,cs,str,size,inheritancemode,classfeatures,fontfeatures,classfallbacks,fontfallbacks, + mathsize,textsize,relativeid,classgoodies,goodies) if trace_defining then - logs.report("define font","memory usage before: %s",statistics.memused()) + report_defining("memory usage before: %s",statistics.memused()) end -- name is now resolved and size is scaled cf sa/mo - local lookup, name, sub, method, detail = get_specification(str or "") + local lookup, name, sub, method, detail = getspecification(str or "") -- asome settings can be overloaded if lookup and lookup ~= "" then specification.lookup = lookup @@ -348,148 +645,201 @@ function define.command_2(global,cs,str,size,classfeatures,fontfeatures,classfal local id = tonumber(relativeid) or 0 specification.relativeid = id > 0 and id end - specification.name = name - specification.size = size - specification.sub = (sub and sub ~= "" and sub) or specification.sub + specification.name = name + specification.size = size + specification.sub = (sub and sub ~= "" and sub) or specification.sub specification.mathsize = mathsize specification.textsize = textsize + specification.goodies = goodies + specification.cs = cs + specification.global = global if detail and detail ~= "" then - specification.method, specification.detail = method or "*", detail + specification.method = method or "*" + specification.detail = detail elseif specification.detail and specification.detail ~= "" then -- already set - elseif fontfeatures and fontfeatures ~= "" then - specification.method, specification.detail = "*", fontfeatures - elseif classfeatures and classfeatures ~= "" then - specification.method, specification.detail = "*", classfeatures + elseif inheritancemode == 0 then + -- nothing + elseif inheritancemode == 1 then + -- fontonly + if fontfeatures and fontfeatures ~= "" then + specification.method = "*" + specification.detail = fontfeatures + end + if fontfallbacks and fontfallbacks ~= "" then + specification.fallbacks = fontfallbacks + end + elseif inheritancemode == 2 then + -- classonly + if classfeatures and classfeatures ~= "" then + specification.method = "*" + specification.detail = classfeatures + end + if classfallbacks and classfallbacks ~= "" then + specification.fallbacks = classfallbacks + end + elseif inheritancemode == 3 then + -- fontfirst + if fontfeatures and fontfeatures ~= "" then + specification.method = "*" + specification.detail = fontfeatures + elseif classfeatures and classfeatures ~= "" then + specification.method = "*" + specification.detail = classfeatures + end + if fontfallbacks and fontfallbacks ~= "" then + specification.fallbacks = fontfallbacks + elseif classfallbacks and classfallbacks ~= "" then + specification.fallbacks = classfallbacks + end + elseif inheritancemode == 4 then + -- classfirst + if classfeatures and classfeatures ~= "" then + specification.method = "*" + specification.detail = classfeatures + elseif fontfeatures and fontfeatures ~= "" then + specification.method = "*" + specification.detail = fontfeatures + end + if classfallbacks and classfallbacks ~= "" then + specification.fallbacks = classfallbacks + elseif fontfallbacks and fontfallbacks ~= "" then + specification.fallbacks = fontfallbacks + end end - if fontfallbacks and fontfallbacks ~= "" then - specification.fallbacks = fontfallbacks - elseif classfallbacks and classfallbacks ~= "" then - specification.fallbacks = classfallbacks + local tfmdata = definers.read(specification,size) -- id not yet known + local cs = specification.cs + if cs then + csnames[cs] = tfmdata -- new (beware: locals can be forgotten) end - local tfmdata = define.read(specification,size) -- id not yet known if not tfmdata then - logs.report("define font","unable to define %s as \\%s",name,cs) + report_defining("unable to define %s as \\%s",name,cs) texsetcount("global","lastfontid",-1) + context.letvaluerelax(cs) -- otherwise the current definition takes the previous one elseif type(tfmdata) == "number" then if trace_defining then - logs.report("define font","reusing %s with id %s as \\%s (features: %s/%s, fallbacks: %s/%s)",name,tfmdata,cs,classfeatures,fontfeatures,classfallbacks,fontfallbacks) + report_defining("reusing %s with id %s as \\%s (features: %s/%s, fallbacks: %s/%s, goodies: %s/%s)", + name,tfmdata,cs,classfeatures,fontfeatures,classfallbacks,fontfallbacks,classgoodies,goodies) end tex.definefont(global,cs,tfmdata) -- resolved (when designsize is used): - texsprint(ctxcatcodes,format("\\def\\somefontsize{%isp}",fontdata[tfmdata].size)) + setsomefontsize(fontdata[tfmdata].parameters.size .. "sp") texsetcount("global","lastfontid",tfmdata) else +tfmdata.characters[0] = nil -- we use char0 as signal -- local t = os.clock(t) local id = font.define(tfmdata) -- print(name,os.clock()-t) - tfmdata.id = id - define.register(tfmdata,id) + tfmdata.properties.id = id + definers.register(tfmdata,id) -- to be sure, normally already done tex.definefont(global,cs,id) - tfm.cleanup_table(tfmdata) + constructors.cleanuptable(tfmdata) + constructors.finalize(tfmdata) if trace_defining then - logs.report("define font","defining %s with id %s as \\%s (features: %s/%s, fallbacks: %s/%s)",name,id,cs,classfeatures,fontfeatures,classfallbacks,fontfallbacks) + report_defining("defining %s with id %s as \\%s (features: %s/%s, fallbacks: %s/%s)",name,id,cs,classfeatures,fontfeatures,classfallbacks,fontfallbacks) end -- resolved (when designsize is used): - texsprint(ctxcatcodes,format("\\def\\somefontsize{%isp}",tfmdata.size)) + setsomefontsize((tfmdata.parameters.size or 655360) .. "sp") --~ if specification.fallbacks then --~ fonts.collections.prepare(specification.fallbacks) --~ end texsetcount("global","lastfontid",id) end if trace_defining then - logs.report("define font","memory usage after: %s",statistics.memused()) + report_defining("memory usage after: %s",statistics.memused()) end statistics.stoptiming(fonts) end +function definers.define(specification) + -- + local name = specification.name + if not name or name == "" then + return -1 + else + statistics.starttiming(fonts) + -- + -- following calls expect a few properties to be set: + -- + local lookup, name, sub, method, detail = getspecification(name or "") + -- + specification.name = (name ~= "" and name) or specification.name + -- + specification.lookup = specification.lookup or (lookup ~= "" and lookup) or "file" + specification.size = specification.size or 655260 + specification.sub = specification.sub or (sub ~= "" and sub) or "" + specification.method = specification.method or (method ~= "" and method) or "*" + specification.detail = specification.detail or (detail ~= "" and detail) or "" + -- + specification.specification = "" -- not used + specification.resolved = "" + specification.forced = "" + specification.features = { } -- via detail, maybe some day + -- + -- we don't care about mathsize textsize goodies fallbacks + -- + if specification.cs == "" then + specification.cs = nil + specification.global = false + elseif specification.global == nil then + specification.global = false + end + -- + local tfmdata = definers.read(specification,specification.size) + if not tfmdata then + return -1, nil + elseif type(tfmdata) == "number" then + if specification.cs then + tex.definefont(specification.global,specification.cs,tfmdata) + end + return tfmdata, fontdata[tfmdata] + else + local id = font.define(tfmdata) + tfmdata.properties.id = id + definers.register(tfmdata,id) + if specification.cs then + tex.definefont(specification.global,specification.cs,id) + end + constructors.cleanuptable(tfmdata) + constructors.finalize(tfmdata) + return id, tfmdata + end + statistics.stoptiming(fonts) + end +end + local enable_auto_r_scale = false experiments.register("fonts.autorscale", function(v) enable_auto_r_scale = v end) -local calculate_scale = fonts.tfm.calculate_scale - -function fonts.tfm.calculate_scale(tfmtable, scaledpoints, relativeid) - local scaledpoints, delta, units = calculate_scale(tfmtable, scaledpoints, relativeid) - if enable_auto_r_scale and relativeid then -- for the moment this is rather context specific - local relativedata = fontdata[relativeid] - local id_x_height = relativedata and relativedata.parameters and relativedata.parameters.x_height - local tf_x_height = id_x_height and tfmtable.parameters and tfmtable.parameters.x_height * delta - if tf_x_height then - scaledpoints = (id_x_height/tf_x_height) * scaledpoints - delta = scaledpoints/units - end - end - return scaledpoints, delta, units -end - ---~ table.insert(readers.sequence,1,'vtf') - ---~ function readers.vtf(specification) ---~ if specification.features.vtf and specification.features.vtf.preset then ---~ return tfm.make(specification) ---~ else ---~ return nil +-- Not ok, we can best use a database for this. The problem is that we +-- have delayed definitions and so we never know what style is taken +-- as start. + +local calculatescale = constructors.calculatescale + +function constructors.calculatescale(tfmdata,scaledpoints,relativeid) + local scaledpoints, delta = calculatescale(tfmdata,scaledpoints) +--~ if enable_auto_r_scale and relativeid then -- for the moment this is rather context specific +--~ local relativedata = fontdata[relativeid] +--~ local rfmdata = relativedata and relativedata.unscaled and relativedata.unscaled +--~ local id_x_height = rfmdata and rfmdata.parameters and rfmdata.parameters.x_height +--~ local tf_x_height = tfmdata and tfmdata.parameters and tfmdata.parameters.x_height +--~ if id_x_height and tf_x_height then +--~ local rscale = id_x_height/tf_x_height +--~ delta = rscale * delta +--~ scaledpoints = rscale * scaledpoints +--~ end --~ end ---~ end - --- we need a place for this .. outside the generic scope - -local dimenfactors = number.dimenfactors - -function fonts.dimenfactor(unit,tfmdata) - if unit == "ex" then - return (tfmdata and tfmdata.parameters.x_height) or 655360 - elseif unit == "em" then - return (tfmdata and tfmdata.parameters.em_height) or 655360 - else - return dimenfactors[unit] or unit - end -end - -function fonts.cleanname(name) - texsprint(ctxcatcodes,fonts.names.cleanname(name)) -end - -local p, f = 1, "%0.1fpt" -- normally this value is changed only once - -local stripper = lpeg.patterns.strip_zeros - -function fonts.nbfs(amount,precision) - if precision ~= p then - p = precision - f = "%0." .. p .. "fpt" - end - texsprint(ctxcatcodes,lpegmatch(stripper,format(f,amount/65536))) -end - --- for the moment here, this will become a chain of extras that is --- hooked into the ctx registration (or scaler or ...) - -function fonts.set_digit_width(font) - local tfmtable = fontdata[font] - local parameters = tfmtable.parameters - local width = parameters.digitwidth - if not width then - width = round(parameters.quad/2) -- maybe tex.scale - local characters = tfmtable.characters - for i=48,57 do - local wd = round(characters[i].width) - if wd > width then - width = wd - end - end - parameters.digitwidth = width - end - return width + return scaledpoints, delta end -fonts.get_digit_width = fonts.set_digit_width - -- soon to be obsolete: +local mappings = fonts.mappings + local loaded = { -- prevent loading (happens in cont-sys files) ["original-base.map" ] = true, ["original-ams-base.map" ] = true, @@ -497,9 +847,12 @@ local loaded = { -- prevent loading (happens in cont-sys files) ["original-public-lm.map"] = true, } -function fonts.map.loadfile(name) +function mappings.loadfile(name) name = file.addsuffix(name,"map") if not loaded[name] then + if trace_mapfiles then + report_mapfiles("loading map file '%s'",name) + end pdf.mapfile(name) loaded[name] = true end @@ -508,117 +861,421 @@ end local loaded = { -- prevent double loading } -function fonts.map.loadline(how,line) +function mappings.loadline(how,line) if line then how = how .. " " .. line elseif how == "" then how = "= " .. line end if not loaded[how] then + if trace_mapfiles then + report_mapfiles("processing map line '%s'",line) + end pdf.mapline(how) loaded[how] = true end end -function fonts.map.reset() +function mappings.reset() pdf.mapfile("") end -fonts.map.reset() -- resets the default file +mappings.reset() -- resets the default file -- we need an 'do after the banner hook' --- pdf.mapfile("mkiv-base.map") -- loads the default file +-- => commands + +local function nametoslot(name) + local t = type(name) + if t == "string" then + local tfmdata = fonts.hashes.identifiers[currentfont()] + local shared = tfmdata and tfmdata.shared + local fntdata = shared and shared.rawdata + return fntdata and fntdata.resources.unicodes[name] + elseif t == "number" then + return n + end +end + +helpers.nametoslot = nametoslot -local nounicode = byte("?") +-- this will change ... -local function name_to_slot(name) -- maybe some day rawdata - local tfmdata = fonts.ids[font.current()] - local shared = tfmdata and tfmdata.shared - local fntdata = shared and shared.otfdata or shared.afmdata - if fntdata then - local unicode = fntdata.luatex.unicodes[name] - if not unicode then - return nounicode - elseif type(unicode) == "number" then - return unicode - else -- multiple unicodes - return unicode[1] +function loggers.reportdefinedfonts() + if trace_usage then + local t, tn = { }, 0 + for id, data in table.sortedhash(fontdata) do + local properties = data.properties or { } + local parameters = data.parameters or { } + tn = tn + 1 + t[tn] = { + format("%03i",id or 0), + format("%09i",parameters.size or 0), + properties.type or "real", + properties.format or "unknown", + properties.name or "", + properties.psname or "", + properties.fullname or "", + } +report_status("%s: %s",properties.name,concat(table.sortedkeys(data)," ")) + end + formatcolumns(t," ") + report_status() + report_status("defined fonts:") + report_status() + for k=1,tn do + report_status(t[k]) end end - return nounicode end -fonts.name_to_slot = name_to_slot - -function fonts.char(n) -- todo: afm en tfm - if type(n) == "string" then - n = name_to_slot(n) +luatex.registerstopactions(loggers.reportdefinedfonts) + +function loggers.reportusedfeatures() + -- numbers, setups, merged + if trace_usage then + local t, n = { }, #numbers + for i=1,n do + local name = numbers[i] + local setup = setups[name] + local n = setup.number + setup.number = nil -- we have no reason to show this + t[i] = { i, name, table.sequenced(setup,false,true) } -- simple mode + setup.number = n -- restore it (normally not needed as we're done anyway) + end + formatcolumns(t," ") + report_status() + report_status("defined featuresets:") + report_status() + for k=1,n do + report_status(t[k]) + end end - if type(n) == "number" then - texsprint(ctxcatcodes,format("\\char%s ",n)) +end + +luatex.registerstopactions(loggers.reportusedfeatures) + +statistics.register("fonts load time", function() + return statistics.elapsedseconds(fonts) +end) + +-- experimental mechanism for Mojca: +-- +-- fonts.definetypeface { +-- name = "mainbodyfont-light", +-- preset = "antykwapoltawskiego-light", +-- } +-- +-- fonts.definetypeface { +-- name = "mojcasfavourite", +-- preset = "antykwapoltawskiego", +-- normalweight = "light", +-- boldweight = "bold", +-- width = "condensed", +-- } + +local Shapes = { + serif = "Serif", + sans = "Sans", + mono = "Mono", +} + +function fonts.definetypeface(name,t) + if type(name) == "table" then + -- {name=abc,k=v,...} + t = name + elseif t then + if type(t) == "string" then + -- "abc", "k=v,..." + t = settings_to_hash(name) + else + -- "abc", {k=v,...} + end + t.name = t.name or name + else + -- "name=abc,k=v,..." + t = settings_to_hash(name) end + local p = t.preset and fonts.typefaces[t.preset] or { } + local name = t.name or "unknowntypeface" + local shortcut = t.shortcut or p.shortcut or "rm" + local size = t.size or p.size or "default" + local shape = t.shape or p.shape or "serif" + local fontname = t.fontname or p.fontname or "unknown" + local normalweight = t.normalweight or t.weight or p.normalweight or p.weight or "normal" + local boldweight = t.boldweight or t.weight or p.boldweight or p.weight or "normal" + local normalwidth = t.normalwidth or t.width or p.normalwidth or p.width or "normal" + local boldwidth = t.boldwidth or t.width or p.boldwidth or p.width or "normal" + Shape = Shapes[shape] or "Serif" + context.startfontclass { name } + context.definefontsynonym( { format("%s", Shape) }, { format("spec:%s-%s-regular-%s", fontname, normalweight, normalwidth) } ) + context.definefontsynonym( { format("%sBold", Shape) }, { format("spec:%s-%s-regular-%s", fontname, boldweight, boldwidth ) } ) + context.definefontsynonym( { format("%sBoldItalic", Shape) }, { format("spec:%s-%s-italic-%s", fontname, boldweight, boldwidth ) } ) + context.definefontsynonym( { format("%sItalic", Shape) }, { format("spec:%s-%s-italic-%s", fontname, normalweight, normalwidth) } ) + context.stopfontclass() + local settings = table.sequenced({ features= t.features },",") + context.dofastdefinetypeface(name, shortcut, shape, size, settings) end --- moved from ini: +function fonts.current() -- todo: also handle name + return fontdata[currentfont()] or fontdata[0] +end -fonts.color = { } -- dummy in ini +function fonts.currentid() + return currentfont() or 0 +end -local attribute = attributes.private('color') -local mapping = (attributes and attributes.list[attribute]) or { } +-- interfaces -local set_attribute = node.set_attribute -local unset_attribute = node.unset_attribute +function commands.fontchar(n) + n = nametoslot(n) + if n then + context.char(n) + end +end -function fonts.color.set(n,c) - local mc = mapping[c] - if not mc then - unset_attribute(n,attribute) - else - set_attribute(n,attribute,mc) +function commands.doifelsecurrentfonthasfeature(name) -- can be made faster with a supportedfeatures hash + local f = fontdata[currentfont()] + f = f and f.shared + f = f and f.rawdata + f = f and f.resources + f = f and f.features + commands.doifelse(f and (f.gpos[name] or f.gsub[name])) +end + +local p, f = 1, "%0.1fpt" -- normally this value is changed only once + +local stripper = lpeg.patterns.stripzeros + +function commands.nbfs(amount,precision) + if precision ~= p then + p = precision + f = "%0." .. p .. "fpt" end + context(lpegmatch(stripper,format(f,amount/65536))) end -function fonts.color.reset(n) - unset_attribute(n,attribute) +function commands.featureattribute(tag) + tex.write(contextnumber(tag)) end --- this will become obsolete: +function commands.setfontfeature(tag) + texattribute[0] = contextnumber(tag) +end -fonts.otf.name_to_slot = name_to_slot -fonts.afm.name_to_slot = name_to_slot +function commands.resetfontfeature() + texattribute[0] = 0 +end -fonts.otf.char = fonts.char -fonts.afm.char = fonts.char +function commands.addfs(tag) withset(tag, 1) end +function commands.subfs(tag) withset(tag,-1) end +function commands.addff(tag) withfnt(tag, 2) end +function commands.subff(tag) withfnt(tag,-2) end --- this will change ... +-- function commands.addfontfeaturetoset (tag) withset(tag, 1) end +-- function commands.subtractfontfeaturefromset (tag) withset(tag,-1) end +-- function commands.addfontfeaturetofont (tag) withfnt(tag, 2) end +-- function commands.subtractfontfeaturefromfont(tag) withfnt(tag,-2) end -function fonts.show_char_data(n) - local tfmdata = fonts.ids[font.current()] +function commands.cleanfontname (name) context(names.cleanname(name)) end + +function commands.fontlookupinitialize (name) names.lookup(name) end +function commands.fontlookupnoffound () context(names.noflookups()) end +function commands.fontlookupgetkeyofindex(key,index) context(names.getlookupkey(key,index)) end +function commands.fontlookupgetkey (key) context(names.getlookupkey(key)) end + +-- this might move to a runtime module: + +function commands.showchardata(n) + local tfmdata = fontdata[currentfont()] if tfmdata then if type(n) == "string" then - n = utf.byte(n) + n = utfbyte(n) end local chr = tfmdata.characters[n] if chr then - write_nl(format("%s @ %s => U%04X => %s => ",tfmdata.fullname,tfmdata.size,n,utf.char(n)) .. serialize(chr,false)) + report_status("%s @ %s => U%05X => %s => %s",tfmdata.properties.fullname,tfmdata.parameters.size,n,utfchar(n),serialize(chr,false)) end end end -function fonts.show_font_parameters() - local tfmdata = fonts.ids[font.current()] +function commands.showfontparameters(tfmdata) + -- this will become more clever + local tfmdata = tfmdata or fontdata[currentfont()] if tfmdata then - local parameters, mathconstants = tfmdata.parameters, tfmdata.MathConstants - local hasparameters, hasmathconstants = parameters and next(parameters), mathconstants and next(mathconstants) + local parameters = tfmdata.parameters + local mathparameters = tfmdata.mathparameters + local properties = tfmdata.properties + local hasparameters = parameters and next(parameters) + local hasmathparameters = mathparameters and next(mathparameters) if hasparameters then - write_nl(format("%s @ %s => parameters => ",tfmdata.fullname,tfmdata.size) .. serialize(parameters,false)) + report_status("%s @ %s => text parameters => %s",properties.fullname,parameters.size,serialize(parameters,false)) + end + if hasmathparameters then + report_status("%s @ %s => math parameters => %s",properties.fullname,parameters.size,serialize(mathparameters,false)) + end + if not hasparameters and not hasmathparameters then + report_status("%s @ %s => no text parameters and/or math parameters",properties.fullname,parameters.size) + end + end +end + +-- for the moment here, this will become a chain of extras that is +-- hooked into the ctx registration (or scaler or ...) + +local dimenfactors = number.dimenfactors + +function helpers.dimenfactor(unit,tfmdata) -- could be a method of a font instance + if unit == "ex" then + return (tfmdata and tfmdata.parameters.x_height) or 655360 + elseif unit == "em" then + return (tfmdata and tfmdata.parameters.em_width) or 655360 + else + return dimenfactors[unit] or unit + end +end + +local function digitwidth(font) -- max(quad/2,wd(0..9)) + local tfmdata = fontdata[font] + local parameters = tfmdata.parameters + local width = parameters.digitwidth + if not width then + width = round(parameters.quad/2) -- maybe tex.scale + local characters = tfmdata.characters + for i=48,57 do + local wd = round(characters[i].width) + if wd > width then + width = wd + end end - if hasmathconstants then - write_nl(format("%s @ %s => math constants => ",tfmdata.fullname,tfmdata.size) .. serialize(mathconstants,false)) + parameters.digitwidth = width + end + return width +end + +helpers.getdigitwidth = digitwidth +helpers.setdigitwidth = digitwidth + +-- + +function helpers.getparameters(tfmdata) + local p = { } + local m = p + local parameters = tfmdata.parameters + while true do + for k, v in next, parameters do + m[k] = v end - if not hasparameters and not hasmathconstants then - write_nl(format("%s @ %s => no parameters and/or mathconstants",tfmdata.fullname,tfmdata.size)) + parameters = getmetatable(parameters) + parameters = parameters and parameters.__index + if type(parameters) == "table" then + m = { } + p.metatable = m + else + break end end + return p +end + +if environment.initex then + + local function names(t) + local nt = #t + if nt > 0 then + local n = { } + for i=1,nt do + n[i] = t[i].name + end + return concat(n," ") + else + return "-" + end + end + + statistics.register("font processing", function() + local l = { } + for what, handler in table.sortedpairs(handlers) do + local features = handler.features + if features then + local t = { } + t[#t+1] = "[" + t[#t+1] = what + t[#t+1] = format("(base initializers: %s)",names(features.initializers.base)) + t[#t+1] = format("(base processors: %s)", names(features.processors .base)) + t[#t+1] = format("(base manipulators: %s)",names(features.manipulators.base)) + t[#t+1] = format("(node initializers: %s)",names(features.initializers.node)) + t[#t+1] = format("(node processors: %s)", names(features.processors .node)) + t[#t+1] = format("(node manipulators: %s)",names(features.manipulators.node)) + t[#t+1] = "]" + l[#l+1] = concat(t, " ") + end + end + return concat(l, " | ") + end) + end + +-- redefinition + +local quads = hashes.quads +local xheights = hashes.xheights +local currentfont = font.current +local texdimen = tex.dimen + +setmetatableindex(number.dimenfactors, function(t,k) + if k == "ex" then + return xheigths[currentfont()] + elseif k == "em" then + return quads[currentfont()] + elseif k == "%" then + return dimen.hsize/100 + else + -- error("wrong dimension: " .. (s or "?")) -- better a message + return false + end +end) + +--[[ldx-- +

Before a font is passed to we scale it. Here we also need +to scale virtual characters.

+--ldx]]-- + +-- function constructors.getvirtualid(tfmdata) +-- -- since we don't know the id yet, we use 0 as signal +-- local tf = tfmdata.fonts +-- if not tf then +-- local properties = tfmdata.properties +-- if properties then +-- properties.virtualized = true +-- else +-- tfmdata.properties = { virtualized = true } +-- end +-- tf = { } +-- tfmdata.fonts = tf +-- end +-- local ntf = #tf + 1 +-- tf[ntf] = { id = 0 } +-- return ntf +-- end +-- +-- function constructors.checkvirtualid(tfmdata, id) -- will go +-- local properties = tfmdata.properties +-- if tfmdata and tfmdata.type == "virtual" or (properties and properties.virtualized) then +-- local vfonts = tfmdata.fonts +-- if not vffonts or #vfonts == 0 then +-- if properties then +-- properties.virtualized = false +-- end +-- tfmdata.fonts = nil +-- else +-- for f=1,#vfonts do +-- local fnt = vfonts[f] +-- if fnt.id and fnt.id == 0 then +-- fnt.id = id +-- end +-- end +-- end +-- end +-- end diff --git a/Master/texmf-dist/tex/context/base/font-def.lua b/Master/texmf-dist/tex/context/base/font-def.lua index c3b10162ce6..182e543b006 100644 --- a/Master/texmf-dist/tex/context/base/font-def.lua +++ b/Master/texmf-dist/tex/context/base/font-def.lua @@ -6,58 +6,53 @@ if not modules then modules = { } end modules ['font-def'] = { license = "see context related readme files" } -local format, concat, gmatch, match, find, lower = string.format, table.concat, string.gmatch, string.match, string.find, string.lower +local concat = table.concat +local format, gmatch, match, find, lower, gsub = string.format, string.gmatch, string.match, string.find, string.lower, string.gsub local tostring, next = tostring, next local lpegmatch = lpeg.match +local allocate = utilities.storage.allocate + local trace_defining = false trackers .register("fonts.defining", function(v) trace_defining = v end) local directive_embedall = false directives.register("fonts.embedall", function(v) directive_embedall = v end) trackers.register("fonts.loading", "fonts.defining", "otf.loading", "afm.loading", "tfm.loading") trackers.register("fonts.all", "fonts.*", "otf.*", "afm.*", "tfm.*") +local report_defining = logs.reporter("fonts","defining") + --[[ldx--

Here we deal with defining fonts. We do so by intercepting the default loader that only handles .

--ldx]]-- -fonts = fonts or { } -fonts.define = fonts.define or { } -fonts.tfm = fonts.tfm or { } -fonts.ids = fonts.ids or { } -fonts.vf = fonts.vf or { } -fonts.used = fonts.used or { } +local fonts = fonts +local fontdata = fonts.hashes.identifiers +local readers = fonts.readers +local definers = fonts.definers +local specifiers = fonts.specifiers +local constructors = fonts.constructors -local tfm = fonts.tfm -local vf = fonts.vf -local define = fonts.define +readers.sequence = allocate { 'otf', 'ttf', 'afm', 'tfm', 'lua' } -- dfont ttc -tfm.version = 1.01 -tfm.cache = containers.define("fonts", "tfm", tfm.version, false) -- better in font-tfm +local variants = allocate() +specifiers.variants = variants -define.method = "afm or tfm" -- afm, tfm, afm or tfm, tfm or afm -define.specify = fonts.define.specify or { } -define.methods = fonts.define.methods or { } +definers.methods = definers.methods or { } -tfm.fonts = tfm.fonts or { } -tfm.readers = tfm.readers or { } -tfm.internalized = tfm.internalized or { } -- internal tex numbers +local internalized = allocate() -- internal tex numbers (private) -tfm.readers.sequence = { 'otf', 'ttf', 'afm', 'tfm' } -tfm.auto_afm = true - -local readers = tfm.readers -local sequence = readers.sequence +local loadedfonts = constructors.loadedfonts +local designsizes = constructors.designsizes --[[ldx--

We hardly gain anything when we cache the final (pre scaled) - table. But it can be handy for debugging.

+ table. But it can be handy for debugging, so we no +longer carry this code along. Also, we now have quite some reference +to other tables so we would end up with lots of catches.

--ldx]]-- -fonts.version = 1.05 -fonts.cache = containers.define("fonts", "def", fonts.version, false) - --[[ldx--

We can prefix a font specification by name: or file:. The first case will result in a lookup in the @@ -77,7 +72,7 @@ and prepares a table that will move along as we proceed.

-- name name(sub) name(sub)*spec name*spec -- name@spec*oeps -local splitter, specifiers = nil, "" +local splitter, splitspecifiers = nil, "" local P, C, S, Cc = lpeg.P, lpeg.C, lpeg.S, lpeg.Cc @@ -86,13 +81,13 @@ local right = P(")") local colon = P(":") local space = P(" ") -define.defaultlookup = "file" +definers.defaultlookup = "file" local prefixpattern = P(false) -function define.add_specifier(symbol) - specifiers = specifiers .. symbol - local method = S(specifiers) +local function addspecifier(symbol) + splitspecifiers = splitspecifiers .. symbol + local method = S(splitspecifiers) local lookup = C(prefixpattern) * colon local sub = left * C(P(1-left-right-method)^1) * right local specification = C(method) * C(P(1)^1) @@ -100,36 +95,39 @@ function define.add_specifier(symbol) splitter = P((lookup + Cc("")) * name * (sub + Cc("")) * (specification + Cc(""))) end -function define.add_lookup(str,default) +local function addlookup(str,default) prefixpattern = prefixpattern + P(str) end -define.add_lookup("file") -define.add_lookup("name") -define.add_lookup("spec") +definers.addlookup = addlookup -function define.get_specification(str) +addlookup("file") +addlookup("name") +addlookup("spec") + +local function getspecification(str) return lpegmatch(splitter,str) end -function define.register_split(symbol,action) - define.add_specifier(symbol) - define.specify[symbol] = action +definers.getspecification = getspecification + +function definers.registersplit(symbol,action,verbosename) + addspecifier(symbol) + variants[symbol] = action + if verbosename then + variants[verbosename] = action + end end -function define.makespecification(specification, lookup, name, sub, method, detail, size) +function definers.makespecification(specification, lookup, name, sub, method, detail, size) size = size or 655360 if trace_defining then - logs.report("define font","%s -> lookup: %s, name: %s, sub: %s, method: %s, detail: %s", + report_defining("%s -> lookup: %s, name: %s, sub: %s, method: %s, detail: %s", specification, (lookup ~= "" and lookup) or "[file]", (name ~= "" and name) or "-", (sub ~= "" and sub) or "-", (method ~= "" and method) or "-", (detail ~= "" and detail) or "-") end ---~ if specification.lookup then ---~ lookup = specification.lookup -- can come from xetex [] syntax ---~ specification.lookup = nil ---~ end if not lookup or lookup == "" then - lookup = define.defaultlookup + lookup = definers.defaultlookup end local t = { lookup = lookup, -- forced type @@ -146,112 +144,49 @@ function define.makespecification(specification, lookup, name, sub, method, deta return t end -function define.analyze(specification, size) +function definers.analyze(specification, size) -- can be optimized with locals - local lookup, name, sub, method, detail = define.get_specification(specification or "") - return define.makespecification(specification, lookup, name, sub, method, detail, size) + local lookup, name, sub, method, detail = getspecification(specification or "") + return definers.makespecification(specification, lookup, name, sub, method, detail, size) end --[[ldx-- -

A unique hash value is generated by:

+

We can resolve the filename using the next function:

--ldx]]-- -local sortedhashkeys = table.sortedhashkeys - -function tfm.hash_features(specification) - local features = specification.features - if features then - local t = { } - local normal = features.normal - if normal and next(normal) then - local f = sortedhashkeys(normal) - for i=1,#f do - local v = f[i] - if v ~= "number" and v ~= "features" then -- i need to figure this out, features - t[#t+1] = v .. '=' .. tostring(normal[v]) - end - end - end - local vtf = features.vtf - if vtf and next(vtf) then - local f = sortedhashkeys(vtf) - for i=1,#f do - local v = f[i] - t[#t+1] = v .. '=' .. tostring(vtf[v]) - end - end ---~ if specification.mathsize then ---~ t[#t+1] = "mathsize=" .. specification.mathsize ---~ end - if #t > 0 then - return concat(t,"+") - end - end - return "unknown" -end +definers.resolvers = definers.resolvers or { } +local resolvers = definers.resolvers -fonts.designsizes = { } +-- todo: reporter ---[[ldx-- -

In principle we can share tfm tables when we are in node for a font, but then -we need to define a font switch as an id/attr switch which is no fun, so in that -case users can best use dynamic features ... so, we will not use that speedup. Okay, -when we get rid of base mode we can optimize even further by sharing, but then we -loose our testcases for .

---ldx]]-- - -function tfm.hash_instance(specification,force) - local hash, size, fallbacks = specification.hash, specification.size, specification.fallbacks - if force or not hash then - hash = tfm.hash_features(specification) - specification.hash = hash - end - if size < 1000 and fonts.designsizes[hash] then - size = math.round(tfm.scaled(size, fonts.designsizes[hash])) - specification.size = size +function resolvers.file(specification) + local suffix = file.suffix(specification.name) + if fonts.formats[suffix] then + specification.forced = suffix + specification.name = file.removesuffix(specification.name) end ---~ local mathsize = specification.mathsize or 0 ---~ if mathsize > 0 then ---~ local textsize = specification.textsize ---~ if fallbacks then ---~ return hash .. ' @ ' .. tostring(size) .. ' [ ' .. tostring(mathsize) .. ' : ' .. tostring(textsize) .. ' ] @ ' .. fallbacks ---~ else ---~ return hash .. ' @ ' .. tostring(size) .. ' [ ' .. tostring(mathsize) .. ' : ' .. tostring(textsize) .. ' ]' ---~ end ---~ else - if fallbacks then - return hash .. ' @ ' .. tostring(size) .. ' @ ' .. fallbacks - else - return hash .. ' @ ' .. tostring(size) - end ---~ end end ---[[ldx-- -

We can resolve the filename using the next function:

---ldx]]-- - -define.resolvers = resolvers - -function define.resolvers.file(specification) - specification.forced = file.extname(specification.name) - specification.name = file.removesuffix(specification.name) -end - -function define.resolvers.name(specification) +function resolvers.name(specification) local resolve = fonts.names.resolve if resolve then - specification.resolved, specification.sub = fonts.names.resolve(specification.name,specification.sub) - if specification.resolved then - specification.forced = file.extname(specification.resolved) - specification.name = file.removesuffix(specification.resolved) + local resolved, sub = fonts.names.resolve(specification.name,specification.sub) + specification.resolved, specification.sub = resolved, sub + if resolved then + local suffix = file.suffix(resolved) + if fonts.formats[suffix] then + specification.forced = suffix + specification.name = file.removesuffix(resolved) + else + specification.name = resolved + end end else - define.resolvers.file(specification) + resolvers.file(specification) end end -function define.resolvers.spec(specification) +function resolvers.spec(specification) local resolvespec = fonts.names.resolvespec if resolvespec then specification.resolved, specification.sub = fonts.names.resolvespec(specification.name,specification.sub) @@ -260,13 +195,13 @@ function define.resolvers.spec(specification) specification.name = file.removesuffix(specification.resolved) end else - define.resolvers.name(specification) + resolvers.name(specification) end end -function define.resolve(specification) +function definers.resolve(specification) if not specification.resolved or specification.resolved == "" then -- resolved itself not per se in mapping hash - local r = define.resolvers[specification.lookup] + local r = resolvers[specification.lookup] if r then r(specification) end @@ -276,7 +211,18 @@ function define.resolve(specification) else specification.forced = specification.forced end - specification.hash = lower(specification.name .. ' @ ' .. tfm.hash_features(specification)) + -- for the moment here (goodies set outside features) + local goodies = specification.goodies + if goodies and goodies ~= "" then + local normal = specification.features.normal + if not normal then + specification.features.normal = { goodies = goodies } + elseif not normal.goodies then + normal.goodies = goodies + end + end + -- + specification.hash = lower(specification.name .. ' @ ' .. constructors.hashfeatures(specification)) if specification.sub and specification.sub ~= "" then specification.hash = specification.sub .. ' @ ' .. specification.hash end @@ -299,25 +245,48 @@ features (esp in virtual fonts) so let's not do that now.

specification yet.

--ldx]]-- -function tfm.read(specification) - local hash = tfm.hash_instance(specification) - local tfmtable = tfm.fonts[hash] -- hashes by size ! - if not tfmtable then +-- not in context, at least not now: +-- +-- function definers.applypostprocessors(tfmdata) +-- local postprocessors = tfmdata.postprocessors +-- if postprocessors then +-- for i=1,#postprocessors do +-- local extrahash = postprocessors[i](tfmdata) -- after scaling etc +-- if type(extrahash) == "string" and extrahash ~= "" then +-- -- e.g. a reencoding needs this +-- extrahash = gsub(lower(extrahash),"[^a-z]","-") +-- tfmdata.properties.fullname = format("%s-%s",tfmdata.properties.fullname,extrahash) +-- end +-- end +-- end +-- return tfmdata +-- end + +function definers.applypostprocessors(tfmdata) + return tfmdata +end + +function definers.loadfont(specification) + local hash = constructors.hashinstance(specification) + local tfmdata = loadedfonts[hash] -- hashes by size ! + if not tfmdata then local forced = specification.forced or "" if forced ~= "" then - tfmtable = readers[lower(forced)](specification) - if not tfmtable then - logs.report("define font","forced type %s of %s not found",forced,specification.name) + local reader = readers[lower(forced)] + tfmdata = reader and reader(specification) + if not tfmdata then + report_defining("forced type %s of %s not found",forced,specification.name) end else - for s=1,#sequence do -- reader sequence + local sequence = readers.sequence -- can be overloaded so only a shortcut here + for s=1,#sequence do local reader = sequence[s] - if readers[reader] then -- not really needed + if readers[reader] then -- we skip not loaded readers if trace_defining then - logs.report("define font","trying (reader sequence driven) type %s for %s with file %s",reader,specification.name,specification.filename or "unknown") + report_defining("trying (reader sequence driven) type %s for %s with file %s",reader,specification.name,specification.filename or "unknown") end - tfmtable = readers[reader](specification) - if tfmtable then + tfmdata = readers[reader](specification) + if tfmdata then break else specification.filename = nil @@ -325,196 +294,60 @@ function tfm.read(specification) end end end - if tfmtable then + if tfmdata then + local properties = tfmdata.properties + local embedding if directive_embedall then - tfmtable.embedding = "full" - elseif tfmtable.filename and fonts.dontembed[tfmtable.filename] then - tfmtable.embedding = "no" + embedding = "full" + elseif properties.filename and constructors.dontembed[properties.filename] then + embedding = "no" else - tfmtable.embedding = "subset" + embedding = "subset" end - tfm.fonts[hash] = tfmtable - fonts.designsizes[specification.hash] = tfmtable.designsize -- we only know this for sure after loading once - --~ tfmtable.mode = specification.features.normal.mode or "base" + if properties then + properties.embedding = embedding + else + tfmdata.properties = { embedding = embedding } + end + tfmdata = definers.applypostprocessors(tfmdata) + loadedfonts[hash] = tfmdata + designsizes[specification.hash] = tfmdata.parameters.designsize end end - if not tfmtable then - logs.report("define font","font with name %s is not found",specification.name) + if not tfmdata then + report_defining("font with asked name '%s' is not found using lookup '%s'",specification.name,specification.lookup) end - return tfmtable + return tfmdata end --[[ldx--

For virtual fonts we need a slightly different approach:

--ldx]]-- -function tfm.read_and_define(name,size) -- no id - local specification = define.analyze(name,size) +function constructors.readanddefine(name,size) -- no id -- maybe a dummy first + local specification = definers.analyze(name,size) local method = specification.method - if method and define.specify[method] then - specification = define.specify[method](specification) + if method and variants[method] then + specification = variants[method](specification) end - specification = define.resolve(specification) - local hash = tfm.hash_instance(specification) - local id = define.registered(hash) + specification = definers.resolve(specification) + local hash = constructors.hashinstance(specification) + local id = definers.registered(hash) if not id then - local fontdata = tfm.read(specification) - if fontdata then - fontdata.hash = hash - id = font.define(fontdata) - define.register(fontdata,id) - tfm.cleanup_table(fontdata) + local tfmdata = definers.loadfont(specification) + if tfmdata then + tfmdata.properties.hash = hash + id = font.define(tfmdata) + definers.register(tfmdata,id) else id = 0 -- signal end end - return fonts.ids[id], id + return fontdata[id], id end --[[ldx-- -

Next follow the readers. This code was written while -evolved. Each one has its own way of dealing with its format.

---ldx]]-- - -local function check_tfm(specification,fullname) - -- ofm directive blocks local path search unless set; btw, in context we - -- don't support ofm files anyway as this format is obsolete - local foundname = resolvers.findbinfile(fullname, 'tfm') or "" -- just to be sure - if foundname == "" then - foundname = resolvers.findbinfile(fullname, 'ofm') or "" -- bonus for usage outside context - end - if foundname ~= "" then - specification.filename, specification.format = foundname, "ofm" - return tfm.read_from_tfm(specification) - end -end - -local function check_afm(specification,fullname) - local foundname = resolvers.findbinfile(fullname, 'afm') or "" -- just to be sure - if foundname == "" and tfm.auto_afm then - local encoding, shortname = match(fullname,"^(.-)%-(.*)$") -- context: encoding-name.* - if encoding and shortname and fonts.enc.known[encoding] then - shortname = resolvers.findbinfile(shortname,'afm') or "" -- just to be sure - if shortname ~= "" then - foundname = shortname - -- tfm.set_normal_feature(specification,'encoding',encoding) -- will go away - if trace_loading then - logs.report("load afm","stripping encoding prefix from filename %s",afmname) - end - end - end - end - if foundname ~= "" then - specification.filename, specification.format = foundname, "afm" - return tfm.read_from_afm(specification) - end -end - -function readers.tfm(specification) - local fullname, tfmtable = specification.filename or "", nil - if fullname == "" then - local forced = specification.forced or "" - if forced ~= "" then - tfmtable = check_tfm(specification,specification.name .. "." .. forced) - end - if not tfmtable then - tfmtable = check_tfm(specification,specification.name) - end - else - tfmtable = check_tfm(specification,fullname) - end - return tfmtable -end - -function readers.afm(specification,method) - local fullname, tfmtable = specification.filename or "", nil - if fullname == "" then - local forced = specification.forced or "" - if forced ~= "" then - tfmtable = check_afm(specification,specification.name .. "." .. forced) - end - if not tfmtable then - method = method or define.method or "afm or tfm" - if method == "tfm" then - tfmtable = check_tfm(specification,specification.name) - elseif method == "afm" then - tfmtable = check_afm(specification,specification.name) - elseif method == "tfm or afm" then - tfmtable = check_tfm(specification,specification.name) or check_afm(specification,specification.name) - else -- method == "afm or tfm" or method == "" then - tfmtable = check_afm(specification,specification.name) or check_tfm(specification,specification.name) - end - end - else - tfmtable = check_afm(specification,fullname) - end - return tfmtable -end - --- maybe some day a set of names - -local function check_otf(forced,specification,suffix,what) - local name = specification.name - if forced then - name = file.addsuffix(name,suffix) - end - local fullname, tfmtable = resolvers.findbinfile(name,suffix) or "", nil -- one shot - if fullname == "" then - local fb = fonts.names.old_to_new[name] - if fb then - fullname = resolvers.findbinfile(fb,suffix) or "" - end - end - if fullname == "" then - local fb = fonts.names.new_to_old[name] - if fb then - fullname = resolvers.findbinfile(fb,suffix) or "" - end - end - if fullname ~= "" then - specification.filename, specification.format = fullname, what -- hm, so we do set the filename, then - tfmtable = tfm.read_from_open_type(specification) -- we need to do it for all matches / todo - end - return tfmtable -end - -function readers.opentype(specification,suffix,what) - local forced = specification.forced or "" - if forced == "otf" then - return check_otf(true,specification,forced,"opentype") - elseif forced == "ttf" or forced == "ttc" or forced == "dfont" then - return check_otf(true,specification,forced,"truetype") - else - return check_otf(false,specification,suffix,what) - end -end - -function readers.otf (specification) return readers.opentype(specification,"otf","opentype") end -function readers.ttf (specification) return readers.opentype(specification,"ttf","truetype") end -function readers.ttc (specification) return readers.opentype(specification,"ttf","truetype") end -- !! -function readers.dfont(specification) return readers.opentype(specification,"ttf","truetype") end -- !! - ---[[ldx-- -

We need to check for default features. For this we provide -a helper function.

---ldx]]-- - -function define.check(features,defaults) -- nb adapts features ! - local done = false - if features and next(features) then - for k,v in next, defaults do - if features[k] == nil then - features[k], done = v, true - end - end - else - features, done = table.fastcopy(defaults), true - end - return features, done -- done signals a change -end - ---[[ldx-- -

So far the specifyers. Now comes the real definer. Here we cache +

So far the specifiers. Now comes the real definer. Here we cache based on id's. Here we also intercept the virtual font handler. Since it evolved stepwise I may rewrite this bit (combine code).

@@ -525,127 +358,75 @@ not gain much. By the way, passing id's back to in the callback was introduced later in the development.

--ldx]]-- -define.last = nil +local lastdefined = nil -- we don't want this one to end up in s-tra-02 +local internalized = { } -function define.register(fontdata,id) - if fontdata and id then - local hash = fontdata.hash - if not tfm.internalized[hash] then - if trace_defining then - logs.report("define font","loading at 2 id %s, hash: %s",id or "?",hash or "?") - end - fonts.identifiers[id] = fontdata - fonts.characters [id] = fontdata.characters - fonts.quads [id] = fontdata.parameters.quad - -- todo: extra functions, e.g. setdigitwidth etc in list - tfm.internalized[hash] = id - end - end +function definers.current() -- or maybe current + return lastdefined end -function define.registered(hash) - local id = tfm.internalized[hash] - return id, id and fonts.ids[id] +function definers.registered(hash) + local id = internalized[hash] + return id, id and fontdata[id] end -local cache_them = false - -function tfm.make(specification) - -- currently fonts are scaled while constructing the font, so we - -- have to do scaling of commands in the vf at that point using - -- e.g. "local scale = g.factor or 1" after all, we need to work - -- with copies anyway and scaling needs to be done at some point; - -- however, when virtual tricks are used as feature (makes more - -- sense) we scale the commands in fonts.tfm.scale (and set the - -- factor there) - local fvm = define.methods[specification.features.vtf.preset] - if fvm then - return fvm(specification) - else - return nil +function definers.register(tfmdata,id) + if tfmdata and id then + local hash = tfmdata.properties.hash + if not internalized[hash] then + internalized[hash] = id + if trace_defining then + report_defining("registering font, id: %s, hash: %s",id or "?",hash or "?") + end + fontdata[id] = tfmdata + end end end -function define.read(specification,size,id) -- id can be optional, name can already be table +function definers.read(specification,size,id) -- id can be optional, name can already be table statistics.starttiming(fonts) if type(specification) == "string" then - specification = define.analyze(specification,size) + specification = definers.analyze(specification,size) end local method = specification.method - if method and define.specify[method] then - specification = define.specify[method](specification) - end - specification = define.resolve(specification) - local hash = tfm.hash_instance(specification) - if cache_them then - local fontdata = containers.read(fonts.cache(),hash) -- for tracing purposes - end - local fontdata = define.registered(hash) -- id - if not fontdata then - if specification.features.vtf and specification.features.vtf.preset then - fontdata = tfm.make(specification) - else - fontdata = tfm.read(specification) - if fontdata then - tfm.check_virtual_id(fontdata) - end - end - if cache_them then - fontdata = containers.write(fonts.cache(),hash,fontdata) -- for tracing purposes - end - if fontdata then - fontdata.hash = hash - fontdata.cache = "no" + if method and variants[method] then + specification = variants[method](specification) + end + specification = definers.resolve(specification) + local hash = constructors.hashinstance(specification) + local tfmdata = definers.registered(hash) -- id + if not tfmdata then + tfmdata = definers.loadfont(specification) -- can be overloaded + if tfmdata then +--~ constructors.checkvirtualid(tfmdata) -- interferes + tfmdata.properties.hash = hash if id then - define.register(fontdata,id) + definers.register(tfmdata,id) end end end - define.last = fontdata or id -- todo ! ! ! ! ! - if not fontdata then - logs.report("define font", "unknown font %s, loading aborted",specification.name) - elseif trace_defining and type(fontdata) == "table" then - logs.report("define font","using %s font with id %s, name:%s size:%s bytes:%s encoding:%s fullname:%s filename:%s", - fontdata.type or "unknown", - id or "?", - fontdata.name or "?", - fontdata.size or "default", - fontdata.encodingbytes or "?", - fontdata.encodingname or "unicode", - fontdata.fullname or "?", - file.basename(fontdata.filename or "?")) - + lastdefined = tfmdata or id -- todo ! ! ! ! ! + if not tfmdata then -- or id? + report_defining( "unknown font %s, loading aborted",specification.name) + elseif trace_defining and type(tfmdata) == "table" then + local properties = tfmdata.properties or { } + local parameters = tfmdata.parameters or { } + report_defining("using %s font with id %s, name:%s size:%s bytes:%s encoding:%s fullname:%s filename:%s", + properties.type or "unknown", + id or "?", + properties.name or "?", + parameters.size or "default", + properties.encodingbytes or "?", + properties.encodingname or "unicode", + properties.fullname or "?", + file.basename(properties.filename or "?")) end statistics.stoptiming(fonts) - return fontdata -end - -function vf.find(name) - name = file.removesuffix(file.basename(name)) - if tfm.resolve_vf then - local format = fonts.logger.format(name) - if format == 'tfm' or format == 'ofm' then - if trace_defining then - logs.report("define font","locating vf for %s",name) - end - return resolvers.findbinfile(name,"ovf") - else - if trace_defining then - logs.report("define font","vf for %s is already taken care of",name) - end - return nil -- "" - end - else - if trace_defining then - logs.report("define font","locating vf for %s",name) - end - return resolvers.findbinfile(name,"ovf") - end + return tfmdata end --[[ldx-- -

We overload both the and readers.

+

We overload the reader.

--ldx]]-- -callbacks.register('define_font' , define.read, "definition of fonts (tfmtable preparation)") -callbacks.register('find_vf_file', vf.find , "locating virtual fonts, insofar needed") -- not that relevant any more +callbacks.register('define_font', definers.read, "definition of fonts (tfmdata preparation)") diff --git a/Master/texmf-dist/tex/context/base/font-dum.lua b/Master/texmf-dist/tex/context/base/font-dum.lua deleted file mode 100644 index 0a9bcd301d5..00000000000 --- a/Master/texmf-dist/tex/context/base/font-dum.lua +++ /dev/null @@ -1,301 +0,0 @@ -if not modules then modules = { } end modules ['font-dum'] = { - version = 1.001, - comment = "companion to luatex-*.tex", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -fonts = fonts or { } - --- general - -fonts.otf.pack = false -- only makes sense in context -fonts.tfm.resolve_vf = false -- no sure about this -fonts.tfm.fontname_mode = "specification" -- somehow latex needs this - --- readers - -fonts.tfm.readers = fonts.tfm.readers or { } -fonts.tfm.readers.sequence = { 'otf', 'ttf', 'tfm' } -fonts.tfm.readers.afm = nil - --- define - -fonts.define = fonts.define or { } - ---~ fonts.define.method = "tfm" - -fonts.define.specify.colonized_default_lookup = "name" - -function fonts.define.get_specification(str) - return "", str, "", ":", str -end - --- logger - -fonts.logger = fonts.logger or { } - -function fonts.logger.save() -end - --- names --- --- Watch out, the version number is the same as the one used in --- the mtx-fonts.lua function scripts.fonts.names as we use a --- simplified font database in the plain solution and by using --- a different number we're less dependent on context. - -fonts.names = fonts.names or { } - -fonts.names.version = 1.001 -- not the same as in context -fonts.names.basename = "luatex-fonts-names.lua" -fonts.names.new_to_old = { } -fonts.names.old_to_new = { } - -local data, loaded = nil, false - -local fileformats = { "lua", "tex", "other text files" } - -function fonts.names.resolve(name,sub) - if not loaded then - local basename = fonts.names.basename - if basename and basename ~= "" then - for i=1,#fileformats do - local format = fileformats[i] - local foundname = resolvers.find_file(basename,format) or "" - if foundname ~= "" then - data = dofile(foundname) - break - end - end - end - loaded = true - end - if type(data) == "table" and data.version == fonts.names.version then - local condensed = string.gsub(string.lower(name),"[^%a%d]","") - local found = data.mappings and data.mappings[condensed] - if found then - local fontname, filename, subfont = found[1], found[2], found[3] - if subfont then - return filename, fontname - else - return filename, false - end - else - return name, false -- fallback to filename - end - end -end - -fonts.names.resolvespec = fonts.names.resolve -- only supported in mkiv - --- For the moment we put this (adapted) pseudo feature here. - -table.insert(fonts.triggers,"itlc") - -local function itlc(tfmdata,value) - if value then - -- the magic 40 and it formula come from Dohyun Kim - local metadata = tfmdata.shared.otfdata.metadata - if metadata then - local italicangle = metadata.italicangle - if italicangle and italicangle ~= 0 then - local uwidth = (metadata.uwidth or 40)/2 - for unicode, d in next, tfmdata.descriptions do - local it = d.boundingbox[3] - d.width + uwidth - if it ~= 0 then - d.italic = it - end - end - tfmdata.has_italic = true - end - end - end -end - -fonts.initializers.base.otf.itlc = itlc -fonts.initializers.node.otf.itlc = itlc - --- slant and extend - -function fonts.initializers.common.slant(tfmdata,value) - value = tonumber(value) - if not value then - value = 0 - elseif value > 1 then - value = 1 - elseif value < -1 then - value = -1 - end - tfmdata.slant_factor = value -end - -function fonts.initializers.common.extend(tfmdata,value) - value = tonumber(value) - if not value then - value = 0 - elseif value > 10 then - value = 10 - elseif value < -10 then - value = -10 - end - tfmdata.extend_factor = value -end - -table.insert(fonts.triggers,"slant") -table.insert(fonts.triggers,"extend") - -fonts.initializers.base.otf.slant = fonts.initializers.common.slant -fonts.initializers.node.otf.slant = fonts.initializers.common.slant -fonts.initializers.base.otf.extend = fonts.initializers.common.extend -fonts.initializers.node.otf.extend = fonts.initializers.common.extend - --- expansion and protrusion - -fonts.protrusions = fonts.protrusions or { } -fonts.protrusions.setups = fonts.protrusions.setups or { } - -local setups = fonts.protrusions.setups - -function fonts.initializers.common.protrusion(tfmdata,value) - if value then - local setup = setups[value] - if setup then - local factor, left, right = setup.factor or 1, setup.left or 1, setup.right or 1 - local emwidth = tfmdata.parameters.quad - tfmdata.auto_protrude = true - for i, chr in next, tfmdata.characters do - local v, pl, pr = setup[i], nil, nil - if v then - pl, pr = v[1], v[2] - end - if pl and pl ~= 0 then chr.left_protruding = left *pl*factor end - if pr and pr ~= 0 then chr.right_protruding = right*pr*factor end - end - end - end -end - -fonts.expansions = fonts.expansions or { } -fonts.expansions.setups = fonts.expansions.setups or { } - -local setups = fonts.expansions.setups - -function fonts.initializers.common.expansion(tfmdata,value) - if value then - local setup = setups[value] - if setup then - local stretch, shrink, step, factor = setup.stretch or 0, setup.shrink or 0, setup.step or 0, setup.factor or 1 - tfmdata.stretch, tfmdata.shrink, tfmdata.step, tfmdata.auto_expand = stretch * 10, shrink * 10, step * 10, true - for i, chr in next, tfmdata.characters do - local v = setup[i] - if v and v ~= 0 then - chr.expansion_factor = v*factor - else -- can be option - chr.expansion_factor = factor - end - end - end - end -end - -table.insert(fonts.manipulators,"protrusion") -table.insert(fonts.manipulators,"expansion") - -fonts.initializers.base.otf.protrusion = fonts.initializers.common.protrusion -fonts.initializers.node.otf.protrusion = fonts.initializers.common.protrusion -fonts.initializers.base.otf.expansion = fonts.initializers.common.expansion -fonts.initializers.node.otf.expansion = fonts.initializers.common.expansion - --- left over - -function fonts.register_message() -end - --- example vectors - -local byte = string.byte - -fonts.expansions.setups['default'] = { - - stretch = 2, shrink = 2, step = .5, factor = 1, - - [byte('A')] = 0.5, [byte('B')] = 0.7, [byte('C')] = 0.7, [byte('D')] = 0.5, [byte('E')] = 0.7, - [byte('F')] = 0.7, [byte('G')] = 0.5, [byte('H')] = 0.7, [byte('K')] = 0.7, [byte('M')] = 0.7, - [byte('N')] = 0.7, [byte('O')] = 0.5, [byte('P')] = 0.7, [byte('Q')] = 0.5, [byte('R')] = 0.7, - [byte('S')] = 0.7, [byte('U')] = 0.7, [byte('W')] = 0.7, [byte('Z')] = 0.7, - [byte('a')] = 0.7, [byte('b')] = 0.7, [byte('c')] = 0.7, [byte('d')] = 0.7, [byte('e')] = 0.7, - [byte('g')] = 0.7, [byte('h')] = 0.7, [byte('k')] = 0.7, [byte('m')] = 0.7, [byte('n')] = 0.7, - [byte('o')] = 0.7, [byte('p')] = 0.7, [byte('q')] = 0.7, [byte('s')] = 0.7, [byte('u')] = 0.7, - [byte('w')] = 0.7, [byte('z')] = 0.7, - [byte('2')] = 0.7, [byte('3')] = 0.7, [byte('6')] = 0.7, [byte('8')] = 0.7, [byte('9')] = 0.7, -} - -fonts.protrusions.setups['default'] = { - - factor = 1, left = 1, right = 1, - - [0x002C] = { 0, 1 }, -- comma - [0x002E] = { 0, 1 }, -- period - [0x003A] = { 0, 1 }, -- colon - [0x003B] = { 0, 1 }, -- semicolon - [0x002D] = { 0, 1 }, -- hyphen - [0x2013] = { 0, 0.50 }, -- endash - [0x2014] = { 0, 0.33 }, -- emdash - [0x3001] = { 0, 1 }, -- ideographic comma 、 - [0x3002] = { 0, 1 }, -- ideographic full stop 。 - [0x060C] = { 0, 1 }, -- arabic comma ، - [0x061B] = { 0, 1 }, -- arabic semicolon ؛ - [0x06D4] = { 0, 1 }, -- arabic full stop ۔ - -} - --- normalizer - -fonts.otf.meanings = fonts.otf.meanings or { } - -fonts.otf.meanings.normalize = fonts.otf.meanings.normalize or function(t) - if t.rand then - t.rand = "random" - end -end - --- bonus - -function fonts.otf.name_to_slot(name) - local tfmdata = fonts.ids[font.current()] - if tfmdata and tfmdata.shared then - local otfdata = tfmdata.shared.otfdata - local unicode = otfdata.luatex.unicodes[name] - return unicode and (type(unicode) == "number" and unicode or unicode[1]) - end -end - -function fonts.otf.char(n) - if type(n) == "string" then - n = fonts.otf.name_to_slot(n) - end - if type(n) == "number" then - tex.sprint("\\char" .. n) - end -end - --- another one: - -fonts.strippables = table.tohash { - 0x000AD, 0x017B4, 0x017B5, 0x0200B, 0x0200C, 0x0200D, 0x0200E, 0x0200F, 0x0202A, 0x0202B, - 0x0202C, 0x0202D, 0x0202E, 0x02060, 0x02061, 0x02062, 0x02063, 0x0206A, 0x0206B, 0x0206C, - 0x0206D, 0x0206E, 0x0206F, 0x0FEFF, 0x1D173, 0x1D174, 0x1D175, 0x1D176, 0x1D177, 0x1D178, - 0x1D179, 0x1D17A, 0xE0001, 0xE0020, 0xE0021, 0xE0022, 0xE0023, 0xE0024, 0xE0025, 0xE0026, - 0xE0027, 0xE0028, 0xE0029, 0xE002A, 0xE002B, 0xE002C, 0xE002D, 0xE002E, 0xE002F, 0xE0030, - 0xE0031, 0xE0032, 0xE0033, 0xE0034, 0xE0035, 0xE0036, 0xE0037, 0xE0038, 0xE0039, 0xE003A, - 0xE003B, 0xE003C, 0xE003D, 0xE003E, 0xE003F, 0xE0040, 0xE0041, 0xE0042, 0xE0043, 0xE0044, - 0xE0045, 0xE0046, 0xE0047, 0xE0048, 0xE0049, 0xE004A, 0xE004B, 0xE004C, 0xE004D, 0xE004E, - 0xE004F, 0xE0050, 0xE0051, 0xE0052, 0xE0053, 0xE0054, 0xE0055, 0xE0056, 0xE0057, 0xE0058, - 0xE0059, 0xE005A, 0xE005B, 0xE005C, 0xE005D, 0xE005E, 0xE005F, 0xE0060, 0xE0061, 0xE0062, - 0xE0063, 0xE0064, 0xE0065, 0xE0066, 0xE0067, 0xE0068, 0xE0069, 0xE006A, 0xE006B, 0xE006C, - 0xE006D, 0xE006E, 0xE006F, 0xE0070, 0xE0071, 0xE0072, 0xE0073, 0xE0074, 0xE0075, 0xE0076, - 0xE0077, 0xE0078, 0xE0079, 0xE007A, 0xE007B, 0xE007C, 0xE007D, 0xE007E, 0xE007F, -} - diff --git a/Master/texmf-dist/tex/context/base/font-enc.lua b/Master/texmf-dist/tex/context/base/font-enc.lua index 874f7c3f4ed..a6f9250e758 100644 --- a/Master/texmf-dist/tex/context/base/font-enc.lua +++ b/Master/texmf-dist/tex/context/base/font-enc.lua @@ -6,18 +6,25 @@ if not modules then modules = { } end modules ['font-enc'] = { license = "see context related readme files" } +-- this module is obsolete + local match, gmatch, gsub = string.match, string.gmatch, string.gsub +local setmetatableindex = table.setmetatableindex + --[[ldx--

Because encodings are going to disappear, we don't bother defining them in tables. But we may do so some day, for consistency.

--ldx]]-- -fonts.enc = fonts.enc or { } -fonts.enc.version = 1.03 -fonts.enc.cache = containers.define("fonts", "enc", fonts.enc.version, true) +local report_encoding = logs.reporter("fonts","encoding") + +local encodings = { } +fonts.encodings = encodings -fonts.enc.known = { -- sort of obsolete +encodings.version = 1.03 +encodings.cache = containers.define("fonts", "enc", fonts.encodings.version, true) +encodings.known = utilities.storage.allocate { -- sort of obsolete texnansi = true, ec = true, qx = true, @@ -25,11 +32,11 @@ fonts.enc.known = { -- sort of obsolete t2a = true, t2b = true, t2c = true, - unicode = true + unicode = true, } -function fonts.enc.is_known(encoding) - return containers.is_valid(fonts.enc.cache(),encoding) +function encodings.is_known(encoding) + return containers.is_valid(encodings.cache,encoding) end --[[ldx-- @@ -51,24 +58,25 @@ Latin Modern or Gyre) come in OpenType variants too, so these will be used.

--ldx]]-- -function fonts.enc.load(filename) +local enccodes = characters.enccodes or { } + +function encodings.load(filename) local name = file.removesuffix(filename) - local data = containers.read(fonts.enc.cache(),name) + local data = containers.read(encodings.cache,name) if data then return data end if name == "unicode" then - data = fonts.enc.make_unicode_vector() -- special case, no tex file for this + data = encodings.make_unicode_vector() -- special case, no tex file for this end if data then return data end local vector, tag, hash, unicodes = { }, "", { }, { } - local foundname = resolvers.find_file(filename,'enc') + local foundname = resolvers.findfile(filename,'enc') if foundname and foundname ~= "" then local ok, encoding, size = resolvers.loadbinfile(foundname) if ok and encoding then - local enccodes = characters.enccodes encoding = gsub(encoding,"%%(.-)\n","") local tag, vec = match(encoding,"/(%w+)%s*%[(.*)%]%s*def") local i = 0 @@ -89,13 +97,13 @@ function fonts.enc.load(filename) end end local data = { - name=name, - tag=tag, - vector=vector, - hash=hash, - unicodes=unicodes + name = name, + tag = tag, + vector = vector, + hash = hash, + unicodes = unicodes } - return containers.write(fonts.enc.cache(), name, data) + return containers.write(encodings.cache, name, data) end --[[ldx-- @@ -105,12 +113,13 @@ one.

-- maybe make this a function: -function fonts.enc.make_unicode_vector() +function encodings.make_unicode_vector() local vector, hash = { }, { } for code, v in next, characters.data do local name = v.adobename if name then - vector[code], hash[name] = name, code + vector[code] = name + hash[name] = code else vector[code] = '.notdef' end @@ -118,5 +127,21 @@ function fonts.enc.make_unicode_vector() for name, code in next, characters.synonyms do vector[code], hash[name] = name, code end - return containers.write(fonts.enc.cache(), 'unicode', { name='unicode', tag='unicode', vector=vector, hash=hash }) + return containers.write(encodings.cache, 'unicode', { name='unicode', tag='unicode', vector=vector, hash=hash }) +end + +if not encodings.agl then + + -- We delay delay loading this rather big vector that is only needed when a + -- font is loaded for caching. Once we're further along the route we can also + -- delay it in the generic version (which doesn't use this file). + + encodings.agl = { } + + setmetatableindex(encodings.agl, function(t,k) + report_encoding("loading (extended) adobe glyph list") + dofile(resolvers.findfile("font-agl.lua")) + return rawget(encodings.agl,k) + end) + end diff --git a/Master/texmf-dist/tex/context/base/font-enh.lua b/Master/texmf-dist/tex/context/base/font-enh.lua index fc70c04c566..ca9893e3d84 100644 --- a/Master/texmf-dist/tex/context/base/font-enh.lua +++ b/Master/texmf-dist/tex/context/base/font-enh.lua @@ -6,196 +6,172 @@ if not modules then modules = { } end modules ['font-enh'] = { license = "see context related readme files" } -local next, match = next, string.match +local next = next -local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) +local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) +local report_defining = logs.reporter("fonts","defining") --- tfmdata has also fast access to indices and unicodes --- to be checked: otf -> tfm -> tfmscaled --- --- watch out: no negative depths and negative eights permitted in regular fonts - ---[[ldx-- -

Here we only implement a few helper functions.

---ldx]]-- - -local tfm = fonts.tfm - ---[[ldx-- -

The next function encapsulates the standard loader as -supplied by .

---ldx]]-- - --- auto complete font with missing composed characters +local fonts = fonts +local constructors = fonts.constructors -table.insert(fonts.manipulators,"compose") +local tfmfeatures = constructors.newfeatures("tfm") +local registertfmfeature = tfmfeatures.register -function fonts.initializers.common.compose(tfmdata,value) - if value then - fonts.vf.aux.compose_characters(tfmdata) - end -end - --- tfm features, experimental +local afmfeatures = fonts.constructors.newfeatures("afm") +local registerafmfeature = afmfeatures.register -tfm.features = tfm.features or { } -tfm.features.list = tfm.features.list or { } -tfm.features.default = tfm.features.default or { } +local otffeatures = fonts.constructors.newfeatures("otf") +local registerotffeature = otffeatures.register -function tfm.enhance(tfmdata,specification) - -- we don't really share tfm data because we always reload - -- but this is more in sycn with afm and such - local features = (specification.features and specification.features.normal ) or { } - tfmdata.shared = tfmdata.shared or { } - tfmdata.shared.features = features - -- tfmdata.shared.tfmdata = tfmdata -- circular - tfmdata.filename = specification.name - if not features.encoding then - local name, size = specification.name, specification.size - local encoding, filename = match(name,"^(.-)%-(.*)$") -- context: encoding-name.* - if filename and encoding and fonts.enc.known[encoding] then - features.encoding = encoding +-- -- these will become goodies (when needed at all) +-- +-- local fontencodings = fonts.encodings +-- fontencodings.remappings = fontencodings.remappings or { } +-- +-- local function reencode(tfmdata,encoding) +-- if encoding and fontencodings.known[encoding] then +-- local data = fontencodings.load(encoding) +-- if data then +-- tfmdata.properties.encoding = encoding +-- local characters = tfmdata.characters +-- local original = { } +-- local vector = data.vector +-- for unicode, character in next, characters do +-- character.name = vector[unicode] +-- character.index = unicode, character +-- original[unicode] = character +-- end +-- for newcode, oldcode in next, data.unicodes do +-- if newcode ~= oldcode then +-- if trace_defining then +-- report_defining("reencoding U+%05X to U+%05X",oldcode,newcode) +-- end +-- characters[newcode] = original[oldcode] +-- end +-- end +-- end +-- end +-- end +-- +-- registertfmfeature { +-- name = "reencode", +-- description = "reencode", +-- manipulators = { +-- base = reencode, +-- node = reencode, +-- } +-- } +-- +-- local function remap(tfmdata,remapping) +-- local vector = remapping and fontencodings.remappings[remapping] +-- if vector then +-- local characters, original = tfmdata.characters, { } +-- for k, v in next, characters do +-- original[k], characters[k] = v, nil +-- end +-- for k,v in next, vector do +-- if k ~= v then +-- if trace_defining then +-- report_defining("remapping U+%05X to U+%05X",k,v) +-- end +-- local c = original[k] +-- characters[v] = c +-- c.index = k +-- end +-- end +-- local properties = tfmdata.properties +-- if not properties then +-- properties = { } +-- tfmdata.properties = properties +-- else +-- properties.encodingbytes = 2 +-- properties.format = properties.format or 'type1' +-- end +-- end +-- end +-- +-- registertfmfeature { +-- name = "remap", +-- description = "remap", +-- manipulators = { +-- base = remap, +-- node = remap, +-- } +-- } + +-- \definefontfeature[dingbats][goodies=dingbats,unicoding=yes] + +-- we only add and don't replace +-- we could also add kerns but we asssume symbols +-- todo: complain if not basemode + +-- remapping = { +-- tounicode = true, +-- unicodes = { +-- a1 = 0x2701, + +local tosixteen = fonts.mappings.tounicode16 + +local function initializeunicoding(tfmdata) + local goodies = tfmdata.goodies + local newcoding = nil + local tounicode = false + for i=1,#goodies do + local remapping = goodies[i].remapping + if remapping and remapping.unicodes then + newcoding = remapping.unicodes -- names to unicodes + tounicode = remapping.tounicode end end - tfm.set_features(tfmdata) -end - -function tfm.set_features(tfmdata) - -- todo: no local functions - local shared = tfmdata.shared --- local tfmdata = shared.tfmdata - local features = shared.features - if features and next(features) then - local mode = tfmdata.mode or fonts.mode - local fi = fonts.initializers[mode] - if fi and fi.tfm then - local function initialize(list) -- using tex lig and kerning - if list then - for i=1,#list do - local f = list[i] - local value = features[f] - if value and fi.tfm[f] then -- brr - if tfm.trace_features then - logs.report("define font","initializing feature %s to %s for mode %s for font %s",f,tostring(value),mode or 'unknown',tfmdata.name or 'unknown') - end - fi.tfm[f](tfmdata,value) - mode = tfmdata.mode or fonts.mode - fi = fonts.initializers[mode] - end - end - end + if newcoding then + local characters = tfmdata.characters + local descriptions = tfmdata.descriptions + local oldcoding = tfmdata.resources.unicodes + local tounicodes = tfmdata.resources.tounicode -- index to unicode + local originals = { } + for name, newcode in next, newcoding do + local oldcode = oldcoding[name] + if characters[newcode] and not originals[newcode] then + originals[newcode] = { + character = characters [newcode], + description = descriptions[newcode], + } end - initialize(fonts.triggers) - initialize(tfm.features.list) - initialize(fonts.manipulators) - end - local fm = fonts.methods[mode] - if fm and fm.tfm then - local function register(list) -- node manipulations - if list then - for i=1,#list do - local f = list[i] - if features[f] and fm.tfm[f] then -- brr - if not shared.processors then -- maybe also predefine - shared.processors = { fm.tfm[f] } - else - shared.processors[#shared.processors+1] = fm.tfm[f] - end - end - end - end + local original = originals[oldcode] + if original then + characters [newcode] = original.character + descriptions[newcode] = original.description + else + characters [newcode] = characters [oldcode] + descriptions[newcode] = descriptions[oldcode] end - register(tfm.features.list) - end - end -end - -function tfm.features.register(name,default) - tfm.features.list[#tfm.features.list+1] = name - tfm.features.default[name] = default -end - -function tfm.reencode(tfmdata,encoding) - if encoding and fonts.enc.known[encoding] then - local data = fonts.enc.load(encoding) - if data then - local characters, original, vector = tfmdata.characters, { }, data.vector - tfmdata.encoding = encoding -- not needed - for k, v in next, characters do - v.name, v.index, original[k] = vector[k], k, v - end - for k,v in next, data.unicodes do - if k ~= v then - if trace_defining then - logs.report("define font","reencoding U+%04X to U+%04X",k,v) - end - characters[k] = original[v] + if tounicode then + local index = descriptions[newcode].index + if not tounicodes[index] then + tounicodes[index] = tosixteen(newcode) -- shared (we could have a metatable) end end - end - end -end - -tfm.features.register('reencode') - -fonts.initializers.base.tfm.reencode = tfm.reencode -fonts.initializers.node.tfm.reencode = tfm.reencode - -fonts.enc = fonts.enc or { } -fonts.enc.remappings = fonts.enc.remappings or { } - -function tfm.remap(tfmdata,remapping) - local vector = remapping and fonts.enc.remappings[remapping] - if vector then - local characters, original = tfmdata.characters, { } - for k, v in next, characters do - original[k], characters[k] = v, nil - end - for k,v in next, vector do - if k ~= v then - if trace_defining then - logs.report("define font","remapping U+%04X to U+%04X",k,v) - end - local c = original[k] - characters[v] = c - c.index = k + if trace_defining then + report_defining("aliasing glyph '%s' from U+%05X to U+%05X",name,oldcode,newcode) end end - tfmdata.encodingbytes = 2 - tfmdata.format = 'type1' end end -tfm.features.register('remap') - -fonts.initializers.base.tfm.remap = tfm.remap -fonts.initializers.node.tfm.remap = tfm.remap +registerafmfeature { + name = "unicoding", + description = "adapt unicode table", + initializers = { + base = initializeunicoding, + node = initializeunicoding, + } +} ---~ obsolete ---~ ---~ function tfm.enhance(tfmdata,specification) ---~ local name, size = specification.name, specification.size ---~ local encoding, filename = match(name,"^(.-)%-(.*)$") -- context: encoding-name.* ---~ if filename and encoding and fonts.enc.known[encoding] then ---~ local data = fonts.enc.load(encoding) ---~ if data then ---~ local characters = tfmdata.characters ---~ tfmdata.encoding = encoding ---~ local vector = data.vector ---~ local original = { } ---~ for k, v in next, characters do ---~ v.name = vector[k] ---~ v.index = k ---~ original[k] = v ---~ end ---~ for k,v in next, data.unicodes do ---~ if k ~= v then ---~ if trace_defining then ---~ logs.report("define font","mapping %s onto %s",k,v) ---~ end ---~ characters[k] = original[v] ---~ end ---~ end ---~ end ---~ end ---~ end +registerotffeature { + name = "unicoding", + description = "adapt unicode table", + initializers = { + base = initializeunicoding, + node = initializeunicoding, + } +} diff --git a/Master/texmf-dist/tex/context/base/font-ext.lua b/Master/texmf-dist/tex/context/base/font-ext.lua index 05bdaf2fc3a..4ea9cf3caa0 100644 --- a/Master/texmf-dist/tex/context/base/font-ext.lua +++ b/Master/texmf-dist/tex/context/base/font-ext.lua @@ -10,11 +10,15 @@ local utf = unicode.utf8 local next, type, byte = next, type, string.byte local gmatch, concat = string.gmatch, table.concat local utfchar = utf.char +local getparameters = utilities.parsers.getparameters + +local allocate = utilities.storage.allocate local trace_protrusion = false trackers.register("fonts.protrusion", function(v) trace_protrusion = v end) local trace_expansion = false trackers.register("fonts.expansion", function(v) trace_expansion = v end) -commands = commands or { } +local report_expansions = logs.reporter("fonts","expansions") +local report_protrusions = logs.reporter("fonts","protrusions") --[[ldx--

When we implement functions that deal with features, most of them @@ -22,74 +26,13 @@ will depend of the font format. Here we define the few that are kind of neutral.

--ldx]]-- -fonts.triggers = fonts.triggers or { } -fonts.initializers = fonts.initializers or { } -fonts.methods = fonts.methods or { } -fonts.initializers.common = fonts.initializers.common or { } - -local initializers = fonts.initializers -local methods = fonts.methods - ---[[ldx-- -

This feature will remove inter-digit kerns.

---ldx]]-- - -table.insert(fonts.triggers,"equaldigits") - -function initializers.common.equaldigits(tfmdata,value) - if value then - local chr = tfmdata.characters - for i = utfbyte('0'), utfbyte('9') do - local c = chr[i] - if c then - c.kerns = nil - end - end - end -end +local fonts = fonts ---[[ldx-- -

This feature will give all glyphs an equal height and/or depth. Valid -values are none, height, depth and -both.

---ldx]]-- +local otffeatures = fonts.constructors.newfeatures("otf") +local registerotffeature = otffeatures.register -table.insert(fonts.triggers,"lineheight") - -function initializers.common.lineheight(tfmdata,value) - if value and type(value) == "string" then - if value == "none" then - for _,v in next, tfmdata.characters do - v.height, v.depth = 0, 0 - end - else - local ascender, descender = tfmdata.ascender, tfmdata.descender - if ascender and descender then - local ht, dp = ascender or 0, descender or 0 - if value == "height" then - dp = 0 - elseif value == "depth" then - ht = 0 - end - if ht > 0 then - if dp > 0 then - for _,v in next, tfmdata.characters do - v.height, v.depth = ht, dp - end - else - for _,v in next, tfmdata.characters do - v.height = ht - end - end - elseif dp > 0 then - for _,v in next, tfmdata.characters do - v.depth = dp - end - end - end - end - end -end +local afmfeatures = fonts.constructors.newfeatures("afm") +local registerafmfeature = afmfeatures.register -- -- -- -- -- -- -- shared @@ -99,11 +42,13 @@ local function get_class_and_vector(tfmdata,value,where) -- "expansions" local g_where = tfmdata.goodies and tfmdata.goodies[where] local f_where = fonts[where] local g_classes = g_where and g_where.classes - local class = g_where and g_where[value] or f_where.classes[value] + local f_classes = f_where and f_where.classes + local class = (g_classes and g_classes[value]) or (f_classes and f_classes[value]) if class then local class_vector = class.vector local g_vectors = g_where and g_where.vectors - local vector = g_vectors and g_vectors[class_vector] or f_where.vectors[class_vector] + local f_vectors = f_where and f_where.vectors + local vector = (g_vectors and g_vectors[class_vector]) or (f_vectors and f_vectors[class_vector]) return class, vector end end @@ -112,20 +57,21 @@ end -- expansion (hz) -- -- -- -- -- -- -fonts.expansions = fonts.expansions or { } -fonts.expansions.classes = fonts.expansions.classes or { } -fonts.expansions.vectors = fonts.expansions.vectors or { } +fonts.expansions = allocate() +local expansions = fonts.expansions -local expansions = fonts.expansions -local classes = fonts.expansions.classes -local vectors = fonts.expansions.vectors +expansions.classes = allocate() +local classes = expansions.classes + +expansions.vectors = allocate() +local vectors = expansions.vectors -- beware, pdftex itself uses percentages * 10 classes.preset = { stretch = 2, shrink = 2, step = .5, factor = 1 } function commands.setupfontexpansion(class,settings) - aux.getparameters(classes,class,'preset',settings) + getparameters(classes,class,'preset',settings) end classes['quality'] = { @@ -146,31 +92,26 @@ vectors['default'] = { vectors['quality'] = vectors['default'] -- metatable ? ---~ function table.locator(...) ---~ local k = { ... } ---~ return function(t) ---~ for i=1,#k do ---~ t = t[k[i]] ---~ if not k then ---~ return false ---~ end ---~ end ---~ return t ---~ end ---~ end - ---~ local locate = table.locator { "goodies", "expansions" } - -function initializers.common.expansion(tfmdata,value) +local function initializeexpansion(tfmdata,value) if value then local class, vector = get_class_and_vector(tfmdata,value,"expansions") if class then if vector then - local stretch, shrink, step, factor = class.stretch or 0, class.shrink or 0, class.step or 0, class.factor or 1 + local stretch = class.stretch or 0 + local shrink = class.shrink or 0 + local step = class.step or 0 + local factor = class.factor or 1 if trace_expansion then - logs.report("fonts","set expansion class %s, vector: %s, factor: %s, stretch: %s, shrink: %s, step: %s",value,class_vector,factor,stretch,shrink,step) + report_expansions("setting class %s, vector: %s, factor: %s, stretch: %s, shrink: %s, step: %s", + value,class.vector,factor,stretch,shrink,step) end - tfmdata.stretch, tfmdata.shrink, tfmdata.step, tfmdata.auto_expand = stretch * 10, shrink * 10, step * 10, true + tfmdata.parameters.expansion = { + stretch = 10 * stretch, + shrink = 10 * shrink, + step = 10 * step, + factor = factor, + auto = true, + } local data = characters and characters.data for i, chr in next, tfmdata.characters do local v = vector[i] @@ -194,42 +135,55 @@ function initializers.common.expansion(tfmdata,value) end end elseif trace_expansion then - logs.report("fonts","unknown expansion vector '%s' in class '%s",class_vector,value) + report_expansions("unknown vector '%s' in class '%s",class.vector,value) end elseif trace_expansion then - logs.report("fonts","unknown expansion class '%s'",value) + report_expansions("unknown class '%s'",value) end end end -table.insert(fonts.manipulators,"expansion") - -initializers.base.otf.expansion = initializers.common.expansion -initializers.node.otf.expansion = initializers.common.expansion +registerotffeature { + name = "expansion", + description = "apply hz optimization", + initializers = { + base = initializeexpansion, + node = initializeexpansion, + } +} -initializers.base.afm.expansion = initializers.common.expansion -initializers.node.afm.expansion = initializers.common.expansion +registerafmfeature { + name = "expansion", + description = "apply hz optimization", + initializers = { + base = initializeexpansion, + node = initializeexpansion, + } +} fonts.goodies.register("expansions", function(...) return fonts.goodies.report("expansions", trace_expansion, ...) end) +local report_opbd = logs.reporter("fonts","otf opbd") + -- -- -- -- -- -- -- protrusion -- -- -- -- -- -- -fonts.protrusions = fonts.protrusions or { } -fonts.protrusions.classes = fonts.protrusions.classes or { } -fonts.protrusions.vectors = fonts.protrusions.vectors or { } +fonts.protrusions = allocate() +local protrusions = fonts.protrusions + +protrusions.classes = allocate() +protrusions.vectors = allocate() -local protrusions = fonts.protrusions -local classes = fonts.protrusions.classes -local vectors = fonts.protrusions.vectors +local classes = protrusions.classes +local vectors = protrusions.vectors -- the values need to be revisioned classes.preset = { factor = 1, left = 1, right = 1 } function commands.setupfontprotrusion(class,settings) - aux.getparameters(classes,class,'preset',settings) + getparameters(classes,class,'preset',settings) end classes['pure'] = { @@ -252,6 +206,7 @@ vectors['pure'] = { [0x003A] = { 0, 1 }, -- colon [0x003B] = { 0, 1 }, -- semicolon [0x002D] = { 0, 1 }, -- hyphen + [0x00AD] = { 0, 1 }, -- also hyphen [0x2013] = { 0, 0.50 }, -- endash [0x2014] = { 0, 0.33 }, -- emdash [0x3001] = { 0, 1 }, -- ideographic comma 、 @@ -277,6 +232,7 @@ vectors['punctuation'] = { [0x003A] = { 0, 0.50 }, -- colon [0x003B] = { 0, 0.50 }, -- semicolon [0x002D] = { 0, 0.70 }, -- hyphen + [0x00AD] = { 0, 0.70 }, -- also hyphen [0x2013] = { 0, 0.30 }, -- endash [0x2014] = { 0, 0.20 }, -- emdash [0x060C] = { 0, 0.70 }, -- arabic comma @@ -325,7 +281,7 @@ vectors['alpha'] = { } -vectors['quality'] = table.merge( {}, +vectors['quality'] = table.merged( vectors['punctuation'], vectors['alpha'] ) @@ -360,10 +316,13 @@ classes['double'] = { -- for testing opbd } local function map_opbd_onto_protrusion(tfmdata,value,opbd) - local characters, descriptions = tfmdata.characters, tfmdata.descriptions - local otfdata = tfmdata.shared.otfdata - local singles = otfdata.shared.featuredata.gpos_single - local script, language = tfmdata.script, tfmdata.language + local characters = tfmdata.characters + local descriptions = tfmdata.descriptions + local properties = tfmdata.properties + local rawdata = tfmdata.shared.rawdata + local lookuphash = rawdata.lookuphash + local script = properties.script + local language = properties.language local done, factor, left, right = false, 1, 1, 1 local class = classes[value] if class then @@ -374,21 +333,21 @@ local function map_opbd_onto_protrusion(tfmdata,value,opbd) factor = tonumber(value) or 1 end if opbd ~= "right" then - local validlookups, lookuplist = fonts.otf.collect_lookups(otfdata,"lfbd",script,language) + local validlookups, lookuplist = otf.collectlookups(rawdata,"lfbd",script,language) if validlookups then for i=1,#lookuplist do local lookup = lookuplist[i] - local data = singles[lookup] + local data = lookuphash[lookup] if data then if trace_protrusion then - logs.report("fonts","set left protrusion using lfbd lookup '%s'",lookup) + report_protrusions("setting left using lfbd lookup '%s'",lookup) end for k, v in next, data do -- local p = - v[3] / descriptions[k].width-- or 1 ~= 0 too but the same local p = - (v[1] / 1000) * factor * left characters[k].left_protruding = p if trace_protrusion then - logs.report("opbd","lfbd -> %s -> 0x%05X (%s) -> %0.03f (%s)",lookup,k,utfchar(k),p,concat(v," ")) + report_protrusions("lfbd -> %s -> U+%05X (%s) -> %0.03f (%s)",lookup,k,utfchar(k),p,concat(v," ")) end end done = true @@ -397,21 +356,21 @@ local function map_opbd_onto_protrusion(tfmdata,value,opbd) end end if opbd ~= "left" then - local validlookups, lookuplist = fonts.otf.collect_lookups(otfdata,"rtbd",script,language) + local validlookups, lookuplist = otf.collectlookups(rawdata,"rtbd",script,language) if validlookups then for i=1,#lookuplist do local lookup = lookuplist[i] - local data = singles[lookup] + local data = lookuphash[lookup] if data then if trace_protrusion then - logs.report("fonts","set right protrusion using rtbd lookup '%s'",lookup) + report_protrusions("setting right using rtbd lookup '%s'",lookup) end for k, v in next, data do -- local p = v[3] / descriptions[k].width -- or 3 local p = (v[1] / 1000) * factor * right characters[k].right_protruding = p if trace_protrusion then - logs.report("opbd","rtbd -> %s -> 0x%05X (%s) -> %0.03f (%s)",lookup,k,utfchar(k),p,concat(v," ")) + report_protrusions("rtbd -> %s -> U+%05X (%s) -> %0.03f (%s)",lookup,k,utfchar(k),p,concat(v," ")) end end end @@ -419,7 +378,9 @@ local function map_opbd_onto_protrusion(tfmdata,value,opbd) end end end - tfmdata.auto_protrude = done + tfmdata.parameters.protrusion { + auto = true + } end -- The opbd test is just there because it was discussed on the @@ -427,7 +388,7 @@ end -- only has some kerns for digits. So, consider this feature not -- supported till we have a proper test font. -function initializers.common.protrusion(tfmdata,value) +local function initializeprotrusion(tfmdata,value) if value then local opbd = tfmdata.shared.features.opbd if opbd then @@ -441,11 +402,17 @@ function initializers.common.protrusion(tfmdata,value) local left = class.left or 1 local right = class.right or 1 if trace_protrusion then - logs.report("fonts","set protrusion class %s, vector: %s, factor: %s, left: %s, right: %s",value,class_vector,factor,left,right) + report_protrusions("setting class %s, vector: %s, factor: %s, left: %s, right: %s", + value,class.vector,factor,left,right) end local data = characters.data local emwidth = tfmdata.parameters.quad - tfmdata.auto_protrude = true + tfmdata.parameters.protrusion = { + factor = factor, + left = left, + right = right, + auto = true, + } for i, chr in next, tfmdata.characters do local v, pl, pr = vector[i], nil, nil if v then @@ -476,70 +443,89 @@ function initializers.common.protrusion(tfmdata,value) end end elseif trace_protrusion then - logs.report("fonts","unknown protrusion vector '%s' in class '%s",class_vector,value) + report_protrusions("unknown vector '%s' in class '%s",class.vector,value) end elseif trace_protrusion then - logs.report("fonts","unknown protrusion class '%s'",value) + report_protrusions("unknown class '%s'",value) end end end end -table.insert(fonts.manipulators,"protrusion") - -initializers.base.otf.protrusion = initializers.common.protrusion -initializers.node.otf.protrusion = initializers.common.protrusion +registerotffeature { + name = "protrusion", + description = "shift characters into the left and or right margin", + initializers = { + base = initializeprotrusion, + node = initializeprotrusion, + } +} -initializers.base.afm.protrusion = initializers.common.protrusion -initializers.node.afm.protrusion = initializers.common.protrusion +registerafmfeature { + name = "protrusion", + description = "shift characters into the left and or right margin", + initializers = { + base = initializeprotrusion, + node = initializeprotrusion, + } +} fonts.goodies.register("protrusions", function(...) return fonts.goodies.report("protrusions", trace_protrusion, ...) end) -- -- -- -function initializers.common.nostackmath(tfmdata,value) - tfmdata.ignore_stack_math = value +local function initializenostackmath(tfmdata,value) + tfmdata.properties.no_stackmath = value and true end -table.insert(fonts.manipulators,"nostackmath") - -initializers.base.otf.nostackmath = initializers.common.nostackmath -initializers.node.otf.nostackmath = initializers.common.nostackmath - -table.insert(fonts.triggers,"itlc") +registerotffeature { + name = "nostackmath", + description = "disable math stacking mechanism", + initializers = { + base = initializenostackmath, + node = initializenostackmath, + } +} -function initializers.common.itlc(tfmdata,value) +local function initializeitlc(tfmdata,value) if value then -- the magic 40 and it formula come from Dohyun Kim - local fontdata = tfmdata.shared.otfdata or tfmdata.shared.afmdata - local metadata = fontdata and fontdata.metadata - if metadata then - local italicangle = metadata.italicangle - if italicangle and italicangle ~= 0 then - local uwidth = (metadata.uwidth or 40)/2 - for unicode, d in next, tfmdata.descriptions do - local it = d.boundingbox[3] - d.width + uwidth - if it ~= 0 then - d.italic = it - end + local parameters = tfmdata.parameters + local italicangle = parameters.italicangle + if italicangle and italicangle ~= 0 then + local uwidth = (parameters.uwidth or 40)/2 + for unicode, d in next, tfmdata.descriptions do + local it = d.boundingbox[3] - d.width + uwidth + if it ~= 0 then + d.italic = it end - tfmdata.has_italic = true end + tfmdata.properties.italic_correction = true end end end -initializers.base.otf.itlc = initializers.common.itlc -initializers.node.otf.itlc = initializers.common.itlc +registerotffeature { + name = "itlc", + description = "italic correction", + initializers = { + base = initializeitlc, + node = initializeitlc, + } +} -initializers.base.afm.itlc = initializers.common.itlc -initializers.node.afm.itlc = initializers.common.itlc +registerafmfeature { + name = "itlc", + description = "italic correction", + initializers = { + base = initializeitlc, + node = initializeitlc, + } +} -- slanting -table.insert(fonts.triggers,"slant") - -function initializers.common.slant(tfmdata,value) +local function initializeslant(tfmdata,value) value = tonumber(value) if not value then value = 0 @@ -548,18 +534,28 @@ function initializers.common.slant(tfmdata,value) elseif value < -1 then value = -1 end - tfmdata.slant_factor = value + tfmdata.parameters.slant_factor = value end -initializers.base.otf.slant = initializers.common.slant -initializers.node.otf.slant = initializers.common.slant - -initializers.base.afm.slant = initializers.common.slant -initializers.node.afm.slant = initializers.common.slant +registerotffeature { + name = "slant", + description = "slant glyphs", + initializers = { + base = initializeslant, + node = initializeslant, + } +} -table.insert(fonts.triggers,"extend") +registerafmfeature { + name = "slant", + description = "slant glyphs", + initializers = { + base = initializeslant, + node = initializeslant, + } +} -function initializers.common.extend(tfmdata,value) +local function initializeextend(tfmdata,value) value = tonumber(value) if not value then value = 0 @@ -568,56 +564,90 @@ function initializers.common.extend(tfmdata,value) elseif value < -10 then value = -10 end - tfmdata.extend_factor = value + tfmdata.parameters.extend_factor = value end -initializers.base.otf.extend = initializers.common.extend -initializers.node.otf.extend = initializers.common.extend - -initializers.base.afm.extend = initializers.common.extend -initializers.node.afm.extend = initializers.common.extend - --- historic stuff, move from font-ota - -local delete_node = nodes.delete -local glyph = node.id("glyph") -local fontdata = fonts.ids - -fonts.strippables = fonts.strippables or { -- just a placeholder - [0x200C] = true, -- zwnj - [0x200D] = true, -- zwj +registerotffeature { + name = "extend", + description = "scale glyphs horizontally", + initializers = { + base = initializeextend, + node = initializeextend, + } } -local strippables = fonts.strippables - -local function processformatters(head,font) - local how = fontdata[font].shared.features.formatters - if how == nil or how == "strip" then -- nil when forced - local current, done = head, false - while current do - if current.id == glyph and current.subtype<256 and current.font == font then - local char = current.char - if strippables[char] then - head, current = delete_node(head,current) - done = true - else - current = current.next - end - else - current = current.next - end - end - return head, done - else - return head, false - end -end - -methods.node.otf.formatters = processformatters -methods.base.otf.formatters = processformatters - -fonts.otf.tables.features['formatters'] = 'Hide Formatting Characters' - -fonts.otf.features.register("formatters") +registerafmfeature { + name = "extend", + description = "scale glyphs horizontally", + initializers = { + base = initializeextend, + node = initializeextend, + } +} -table.insert(fonts.manipulators,"formatters") -- at end +-- -- historic stuff, move from font-ota (handled differently, typo-rep) +-- +-- local delete_node = nodes.delete +-- local fontdata = fonts.hashes.identifiers +-- +-- local nodecodes = nodes.nodecodes +-- local glyph_code = nodecodes.glyph +-- +-- local strippables = allocate() +-- fonts.strippables = strippables +-- +-- strippables.joiners = table.tohash { +-- 0x200C, -- zwnj +-- 0x200D, -- zwj +-- } +-- +-- strippables.all = table.tohash { +-- 0x000AD, 0x017B4, 0x017B5, 0x0200B, 0x0200C, 0x0200D, 0x0200E, 0x0200F, 0x0202A, 0x0202B, +-- 0x0202C, 0x0202D, 0x0202E, 0x02060, 0x02061, 0x02062, 0x02063, 0x0206A, 0x0206B, 0x0206C, +-- 0x0206D, 0x0206E, 0x0206F, 0x0FEFF, 0x1D173, 0x1D174, 0x1D175, 0x1D176, 0x1D177, 0x1D178, +-- 0x1D179, 0x1D17A, 0xE0001, 0xE0020, 0xE0021, 0xE0022, 0xE0023, 0xE0024, 0xE0025, 0xE0026, +-- 0xE0027, 0xE0028, 0xE0029, 0xE002A, 0xE002B, 0xE002C, 0xE002D, 0xE002E, 0xE002F, 0xE0030, +-- 0xE0031, 0xE0032, 0xE0033, 0xE0034, 0xE0035, 0xE0036, 0xE0037, 0xE0038, 0xE0039, 0xE003A, +-- 0xE003B, 0xE003C, 0xE003D, 0xE003E, 0xE003F, 0xE0040, 0xE0041, 0xE0042, 0xE0043, 0xE0044, +-- 0xE0045, 0xE0046, 0xE0047, 0xE0048, 0xE0049, 0xE004A, 0xE004B, 0xE004C, 0xE004D, 0xE004E, +-- 0xE004F, 0xE0050, 0xE0051, 0xE0052, 0xE0053, 0xE0054, 0xE0055, 0xE0056, 0xE0057, 0xE0058, +-- 0xE0059, 0xE005A, 0xE005B, 0xE005C, 0xE005D, 0xE005E, 0xE005F, 0xE0060, 0xE0061, 0xE0062, +-- 0xE0063, 0xE0064, 0xE0065, 0xE0066, 0xE0067, 0xE0068, 0xE0069, 0xE006A, 0xE006B, 0xE006C, +-- 0xE006D, 0xE006E, 0xE006F, 0xE0070, 0xE0071, 0xE0072, 0xE0073, 0xE0074, 0xE0075, 0xE0076, +-- 0xE0077, 0xE0078, 0xE0079, 0xE007A, 0xE007B, 0xE007C, 0xE007D, 0xE007E, 0xE007F, +-- } +-- +-- strippables[true] = strippables.joiners +-- +-- local function processformatters(head,font) +-- local subset = fontdata[font].shared.features.formatters +-- local vector = subset and strippables[subset] +-- if vector then +-- local current, done = head, false +-- while current do +-- if current.id == glyph_code and current.subtype<256 and current.font == font then +-- local char = current.char +-- if vector[char] then +-- head, current = delete_node(head,current) +-- done = true +-- else +-- current = current.next +-- end +-- else +-- current = current.next +-- end +-- end +-- return head, done +-- else +-- return head, false +-- end +-- end +-- +-- registerotffeature { +-- name = "formatters", +-- description = "hide formatting characters", +-- methods = { +-- base = processformatters, +-- node = processformatters, +-- } +-- } diff --git a/Master/texmf-dist/tex/context/base/font-fbk.lua b/Master/texmf-dist/tex/context/base/font-fbk.lua index 1ad1cc781a8..6712fbe888e 100644 --- a/Master/texmf-dist/tex/context/base/font-fbk.lua +++ b/Master/texmf-dist/tex/context/base/font-fbk.lua @@ -7,146 +7,79 @@ if not modules then modules = { } end modules ['font-fbk'] = { } local cos, tan, rad, format = math.cos, math.tan, math.rad, string.format +local utfbyte, utfchar = utf.byte, utf.char -local trace_combining = false trackers.register("fonts.combining", function(v) trace_combining = v end) +local trace_combining = false trackers.register("fonts.combining", function(v) trace_combining = v end) +local trace_combining_all = false trackers.register("fonts.combining.all", function(v) trace_combining_all = v end) ---[[ldx-- -

This is very experimental code!

---ldx]]-- - -fonts.fallbacks = fonts.fallbacks or { } - -local vf = fonts.vf -local tfm = fonts.tfm - -vf.aux.combine.commands["enable-tracing"] = function(g,v) - trace_combining = true -end - -vf.aux.combine.commands["disable-tracing"] = function(g,v) - trace_combining = false -end - -vf.aux.combine.commands["set-tracing"] = function(g,v) - if v[2] == nil then - trace_combining = true - else - trace_combining = v[2] - end -end +local force_combining = false -- just for demo purposes (see mk) -function vf.aux.combine.initialize_trace() - if trace_combining then - return "special", "pdf: .8 0 0 rg .8 0 0 RG", "pdf: 0 .8 0 rg 0 .8 0 RG", "pdf: 0 0 .8 rg 0 0 .8 RG", "pdf: 0 g 0 G" - else - return "comment", "", "", "", "" - end -end +trackers.register("fonts.composing", "fonts.combining") -vf.aux.combine.force_fallback = false +local report_combining = logs.reporter("fonts","combining") -vf.aux.combine.commands["fake-character"] = function(g,v) -- g, nr, fallback_id - local index, fallback = v[2], v[3] - if vf.aux.combine.force_fallback or not g.characters[index] then - if fonts.fallbacks[fallback] then - g.characters[index], g.descriptions[index] = fonts.fallbacks[fallback](g) - end - end -end +local allocate = utilities.storage.allocate -fonts.fallbacks['textcent'] = function (g) - local c = ("c"):byte() - local t = table.fastcopy(g.characters[c]) - local a = - tan(rad(g.italicangle or 0)) - local special, red, green, blue, black = vf.aux.combine.initialize_trace() - local quad = g.parameters.quad - if a == 0 then - t.commands = { - {"push"}, {"slot", 1, c}, {"pop"}, - {"right", .5*t.width}, - {"down", .2*t.height}, - {special, green}, - {"rule", 1.4*t.height, .02*quad}, - {special, black}, - } - else - t.commands = { - {"push"}, - {"right", .5*t.width-.025*quad}, - {"down", .2*t.height}, - {"special",format("pdf: q 1 0 %s 1 0 0 cm",a)}, - {special, green}, - {"rule", 1.4*t.height, .025*quad}, - {special, black}, - {"special","pdf: Q"}, - {"pop"}, - {"slot", 1, c} -- last else problems with cm - } - end - -- somehow the width is messed up now - -- todo: set height - t.height = 1.2*t.height - t.depth = 0.2*t.height - g.virtualized = true - local d = g.descriptions - return t, d and d[c] -end +--[[ldx-- +

This is very experimental code!

+--ldx]]-- -fonts.fallbacks['texteuro'] = function (g) - local c = ("C"):byte() - local t = table.fastcopy(g.characters[c]) - local d = cos(rad(90+(g.italicangle))) - local special, red, green, blue, black = vf.aux.combine.initialize_trace() - local quad = g.parameters.quad - t.width = 1.05*t.width - t.commands = { - {"right", .05*t.width}, - {"push"}, {"slot", 1, c}, {"pop"}, - {"right", .5*t.width*d}, - {"down", -.5*t.height}, - {special, green}, - {"rule", .05*quad, .4*quad}, - {special, black}, - } - g.virtualized = true - return t, g.descriptions[c] -end +local fonts = fonts +local handlers = fonts.handlers +local constructors = fonts.constructors +local vf = handlers.vf +local commands = vf.combiner.commands --- maybe store llx etc instead of bbox in tfm blob / more efficient +local otffeatures = constructors.newfeatures("otf") +local registerotffeature = otffeatures.register -vf.aux.combine.force_composed = false +local afmfeatures = constructors.newfeatures("afm") +local registerafmfeature = afmfeatures.register -local push, pop = { "push" }, { "pop" } +local unicodecharacters = characters.data +local unicodefallbacks = characters.fallbacks -local cache = { } -- we could make these weak +local push = vf.predefined.push +local pop = vf.predefined.pop +local force_composed = false +local cache = { } -- we could make these weak +local fraction = 0.15 -- 30 units for lucida -function vf.aux.compose_characters(g) -- todo: scaling depends on call location +local function composecharacters(tfmdata) -- this assumes that slot 1 is self, there will be a proper self some day - local chars, descs = g.characters, g.descriptions - local X = ("X"):byte() - local xchar = chars[X] - local xdesc = descs[X] - if xchar and xdesc then - local scale = g.factor or 1 - local cap_lly = scale*xdesc.boundingbox[4] - local ita_cor = cos(rad(90+(g.italicangle or 0))) - local force = vf.aux.combine.force_composed - local fallbacks = characters.fallbacks - local special, red, green, blue, black + local characters = tfmdata.characters + local descriptions = tfmdata.descriptions + local parameters = tfmdata.parameters + local properties = tfmdata.properties + local Xdesc = descriptions[utfbyte("X")] + local xdesc = descriptions[utfbyte("x")] + if Xdesc and xdesc then + local scale = parameters.factor or 1 + local deltaxheight = scale * (Xdesc.boundingbox[4] - xdesc.boundingbox[4]) + local extraxheight = fraction * deltaxheight -- maybe use compose value + local italicfactor = parameters.italicfactor or 0 + local vfspecials = backends.tables.vfspecials --brr + local red, green, blue, black if trace_combining then - special, red, green, blue, black = vf.aux.combine.initialize_trace() - red, green, blue, black = { special, red }, { special, green }, { special, blue }, { special, black } + red = vfspecials.red + green = vfspecials.green + blue = vfspecials.blue + black = vfspecials.black + end + local compose = fonts.goodies.getcompositions(tfmdata) + if compose and trace_combining then + report_combining("using compose information from goodies file") end local done = false - for i,c in next, characters.data do - if force or not chars[i] then + for i,c in next, unicodecharacters do -- loop over all characters ... not that efficient but a specials hash takes memory + if force_combining or not characters[i] then local s = c.specials if s and s[1] == 'char' then local chr = s[2] - local charschr = chars[chr] + local charschr = characters[chr] if charschr then local cc = c.category - if cc == 'll' or cc == 'lu' or cc == 'lt' then + if cc == 'll' or cc == 'lu' or cc == 'lt' then -- characters.is_letter[cc] local acc = s[3] local t = { } for k, v in next, charschr do @@ -154,163 +87,172 @@ function vf.aux.compose_characters(g) -- todo: scaling depends on call location t[k] = v end end - local charsacc = chars[acc] ---~ local ca = charsacc.category ---~ if ca == "mn" then ---~ -- mark nonspacing ---~ elseif ca == "ms" then ---~ -- mark spacing combining ---~ elseif ca == "me" then ---~ -- mark enclosing ---~ else - if not charsacc then - acc = fallbacks[acc] - charsacc = acc and chars[acc] + local charsacc = characters[acc] + --~ local ca = charsacc.category + --~ if ca == "mn" then + --~ -- mark nonspacing + --~ elseif ca == "ms" then + --~ -- mark spacing combining + --~ elseif ca == "me" then + --~ -- mark enclosing + --~ else + if not charsacc then -- fallback accents + acc = unicodefallbacks[acc] + charsacc = acc and characters[acc] + end + local chr_t = cache[chr] + if not chr_t then + chr_t = {"slot", 1, chr} + cache[chr] = chr_t end if charsacc then - local chr_t = cache[chr] - if not cht_t then - chr_t = {"slot", 1, chr} - cache[chr] = chr_t + if trace_combining_all then + report_combining("%s (U+%05X) = %s (U+%05X) + %s (U+%05X)",utfchar(i),i,utfchar(chr),chr,utfchar(acc),acc) end local acc_t = cache[acc] if not acc_t then acc_t = {"slot", 1, acc} cache[acc] = acc_t end - local cb = descs[chr].boundingbox - local ab = descs[acc].boundingbox + local cb = descriptions[chr].boundingbox + local ab = descriptions[acc].boundingbox + -- todo: adapt height if cb and ab then -- can be sped up for scale == 1 local c_llx, c_lly, c_urx, c_ury = scale*cb[1], scale*cb[2], scale*cb[3], scale*cb[4] local a_llx, a_lly, a_urx, a_ury = scale*ab[1], scale*ab[2], scale*ab[3], scale*ab[4] local dx = (c_urx - a_urx - a_llx + c_llx)/2 - local dd = (c_urx - c_llx)*ita_cor + local dd = (c_urx - c_llx)*italicfactor if a_ury < 0 then if trace_combining then - t.commands = { - push, - {"right", dx-dd}, - red, - acc_t, - black, - pop, - chr_t, - } + t.commands = { push, {"right", dx-dd}, red, acc_t, black, pop, chr_t } + else + t.commands = { push, {"right", dx-dd}, acc_t, pop, chr_t } + end + elseif c_ury > a_lly then -- messy test + local dy + if compose then + -- experimental: we could use sx but all that testing + -- takes time and code + dy = compose[i] + if dy then + dy = dy.DY + end + if not dy then + dy = compose[acc] + if dy then + dy = dy and dy.DY + end + end + if not dy then + dy = compose.DY + end + if not dy then + dy = - deltaxheight + extraxheight + elseif dy > -1.5 and dy < 1.5 then + -- we assume a fraction of (percentage) + dy = - dy * deltaxheight + else + -- we assume fontunits (value smaller than 2 make no sense) + dy = - dy * scale + end else - t.commands = { - push, - {"right", dx-dd}, - acc_t, - pop, - chr_t, - } + dy = - deltaxheight + extraxheight end - elseif c_ury > a_lly then - local dy = cap_lly-a_lly if trace_combining then - t.commands = { - push, - {"right", dx+dd}, - {"down", -dy}, - green, - acc_t, - black, - pop, - chr_t, - } + t.commands = { push, {"right", dx+dd}, {"down", dy}, green, acc_t, black, pop, chr_t } else - t.commands = { - push, - {"right", dx+dd}, - {"down", -dy}, - acc_t, - pop, - chr_t, - } + t.commands = { push, {"right", dx+dd}, {"down", dy}, acc_t, pop, chr_t } end else if trace_combining then - t.commands = { - {"push"}, - {"right", dx+dd}, - blue, - acc_t, - black, - {"pop"}, - chr_t, - } + t.commands = { push, {"right", dx+dd}, blue, acc_t, black, pop, chr_t } else - t.commands = { - {"push"}, - {"right", dx+dd}, - acc_t, - {"pop"}, - chr_t, - } + t.commands = { push, {"right", dx+dd}, acc_t, pop, chr_t } end end - done = true + else + t.commands = { chr_t } -- else index mess + end + else + if trace_combining_all then + report_combining("%s (U+%05X) = %s (U+%05X) (simplified)",utfchar(i),i,utfchar(chr),chr) end + t.commands = { chr_t } -- else index mess end - chars[i] = t + done = true + characters[i] = t local d = { } - for k, v in next, descs[chr] do + for k, v in next, descriptions[chr] do d[k] = v end - d.name = c.adobename or "unknown" - -- d.unicode = i - descs[i] = d + descriptions[i] = d end end end end end if done then - g.virtualized = true + properties.virtualized = true end end end -vf.aux.combine.commands["complete-composed-characters"] = function(g,v) - vf.aux.compose_characters(g) +registerotffeature { + name = "compose", + description = "additional composed characters", + manipulators = { + base = composecharacters, + node = composecharacters, + } +} + +registerafmfeature { + name = "compose", + description = "additional composed characters", + manipulators = { + base = composecharacters, + node = composecharacters, + } +} + +vf.helpers.composecharacters = composecharacters + +-- This installs the builder into the regular virtual font builder, +-- which only makes sense as demo. + +commands["compose.trace.enable"] = function() + trace_combining = true end ---~ {'special', 'pdf: q ' .. s .. ' 0 0 '.. s .. ' 0 0 cm'}, ---~ {'special', 'pdf: q 1 0 0 1 ' .. -w .. ' ' .. -h .. ' cm'}, ---~ -- {'special', 'pdf: /Fm\XX\space Do'}, ---~ {'special', 'pdf: Q'}, ---~ {'special', 'pdf: Q'}, +commands["compose.trace.disable"] = function() + trace_combining = false +end --- for documentation purposes we provide: +commands["compose.force.enable"] = function() + force_combining = true +end -fonts.define.methods.install("fallback", { -- todo: auto-fallback with loop over data.characters - { "fake-character", 0x00A2, 'textcent' }, - { "fake-character", 0x20AC, 'texteuro' } -}) +commands["compose.force.disable"] = function() + force_combining = false +end -vf.aux.combine.commands["enable-force"] = function(g,v) - vf.aux.combine.force_composed = true - vf.aux.combine.force_fallback = true +commands["compose.trace.set"] = function(g,v) + if v[2] == nil then + trace_combining = true + else + trace_combining = v[2] + end end -vf.aux.combine.commands["disable-force"] = function(g,v) - vf.aux.combine.force_composed = false - vf.aux.combine.force_fallback = false + +commands["compose.apply"] = function(g,v) + composecharacters(g) end -fonts.define.methods.install("demo-2", { - { "enable-tracing" }, - { "enable-force" }, - { "initialize" }, - { "include-method", "fallback" }, - { "complete-composed-characters" }, - { "disable-tracing" }, - { "disable-force" }, -}) +-- vf builder -fonts.define.methods.install("demo-3", { - { "enable-tracing" }, - { "initialize" }, - { "complete-composed-characters" }, - { "disable-tracing" }, -}) +-- {'special', 'pdf: q ' .. s .. ' 0 0 '.. s .. ' 0 0 cm'}, +-- {'special', 'pdf: q 1 0 0 1 ' .. -w .. ' ' .. -h .. ' cm'}, +-- {'special', 'pdf: /Fm\XX\space Do'}, +-- {'special', 'pdf: Q'}, +-- {'special', 'pdf: Q'}, diff --git a/Master/texmf-dist/tex/context/base/font-gds.lua b/Master/texmf-dist/tex/context/base/font-gds.lua index e3db8c816f8..a5c60d252ab 100644 --- a/Master/texmf-dist/tex/context/base/font-gds.lua +++ b/Master/texmf-dist/tex/context/base/font-gds.lua @@ -6,29 +6,47 @@ if not modules then modules = { } end modules ['font-gds'] = { license = "see context related readme files" } +-- depends on ctx + local type, next = type, next -local gmatch = string.gmatch +local gmatch, format = string.gmatch, string.format -local trace_goodies = false trackers.register("fonts.goodies", function(v) trace_goodies = v end) +local fonts, nodes, attributes, node = fonts, nodes, attributes, node --- goodies=name,colorscheme=,featureset= --- --- goodies=auto +local trace_goodies = false trackers.register("fonts.goodies", function(v) trace_goodies = v end) +local report_fonts = logs.reporter("fonts","goodies") + +local allocate = utilities.storage.allocate + +local otf = fonts.handlers.otf +local addotffeature = otf.enhancers.addfeature + +local otffeatures = fonts.constructors.newfeatures("otf") +local registerotffeature = otffeatures.register --- goodies +local afmfeatures = fonts.constructors.newfeatures("afm") +local registerafmfeature = afmfeatures.register -fonts.goodies = fonts.goodies or { } -fonts.goodies.data = fonts.goodies.data or { } -fonts.goodies.list = fonts.goodies.list or { } +local tfmfeatures = fonts.constructors.newfeatures("tfm") +local registertfmfeature = tfmfeatures.register -local data = fonts.goodies.data -local list = fonts.goodies.list +local fontgoodies = { } +fonts.goodies = fontgoodies -function fonts.goodies.report(what,trace,goodies) +local typefaces = allocate() +fonts.typefaces = typefaces + +local data = allocate() +fontgoodies.data = fontgoodies.data + +local list = { } +fontgoodies.list = list -- no allocate as we want to see what is there + +function fontgoodies.report(what,trace,goodies) if trace_goodies or trace then local whatever = goodies[what] if whatever then - logs.report("fonts", "goodie '%s' found in '%s'",what,goodies.name) + report_fonts("goodie '%s' found in '%s'",what,goodies.name) end end end @@ -38,20 +56,20 @@ local function getgoodies(filename) -- maybe a merge is better if goodies ~= nil then -- found or tagged unfound elseif type(filename) == "string" then - local fullname = resolvers.find_file(file.addsuffix(filename,"lfg")) or "" -- prefered suffix + local fullname = resolvers.findfile(file.addsuffix(filename,"lfg")) or "" -- prefered suffix if fullname == "" then - fullname = resolvers.find_file(file.addsuffix(filename,"lua")) or "" -- fallback suffix + fullname = resolvers.findfile(file.addsuffix(filename,"lua")) or "" -- fallback suffix end if fullname == "" then - logs.report("fonts", "goodie file '%s.lfg' is not found",filename) + report_fonts("goodie file '%s.lfg' is not found",filename) data[filename] = false -- signal for not found else goodies = dofile(fullname) or false if not goodies then - logs.report("fonts", "goodie file '%s' is invalid",fullname) + report_fonts("goodie file '%s' is invalid",fullname) return nil elseif trace_goodies then - logs.report("fonts", "goodie file '%s' is loaded",fullname) + report_fonts("goodie file '%s' is loaded",fullname) end goodies.name = goodies.name or "no name" for name, fnc in next, list do @@ -64,18 +82,20 @@ local function getgoodies(filename) -- maybe a merge is better return goodies end -function fonts.goodies.register(name,fnc) +function fontgoodies.register(name,fnc) -- will be a proper sequencer list[name] = fnc end -fonts.goodies.get = getgoodies +fontgoodies.get = getgoodies -- register goodies file -local preset_context = fonts.define.specify.preset_context - -function fonts.initializers.common.goodies(tfmdata,value) - local goodies = tfmdata.goodies or { } -- future versions might store goodies in the cached instance +local function setgoodies(tfmdata,value) + local goodies = tfmdata.goodies + if not goodies then -- actually an error + goodies = { } + tfmdata.goodies = goodies + end for filename in gmatch(value,"[^, ]+") do -- we need to check for duplicates local ok = getgoodies(filename) @@ -83,26 +103,27 @@ function fonts.initializers.common.goodies(tfmdata,value) goodies[#goodies+1] = ok end end - tfmdata.goodies = goodies -- shared ? end +-- this will be split into good-* files and this file might become good-ini.lua + -- featuresets -local function flattened(t,tt) +local function flattenedfeatures(t,tt) -- first set value dominates local tt = tt or { } for i=1,#t do local ti = t[i] if type(ti) == "table" then - flattened(ti,tt) + flattenedfeatures(ti,tt) elseif tt[ti] == nil then tt[ti] = true end end for k, v in next, t do - if type(k) ~= "number" then + if type(k) ~= "number" then -- not tonumber(k) if type(v) == "table" then - flattened(v,tt) + flattenedfeatures(v,tt) elseif tt[k] == nil then tt[k] = v end @@ -111,16 +132,16 @@ local function flattened(t,tt) return tt end -fonts.flattened_features = flattened +-- fonts.features.flattened = flattenedfeatures -function fonts.goodies.prepare_features(goodies,name,set) +function fontgoodies.prepare_features(goodies,name,set) if set then - local ff = fonts.flattened_features(set) + local ff = flattenedfeatures(set) local fullname = goodies.name .. "::" .. name - local n, s = preset_context(fullname,"",ff) + local n, s = fonts.specifiers.presetcontext(fullname,"",ff) goodies.featuresets[name] = s -- set if trace_goodies then - logs.report("fonts", "feature set '%s' gets number %s and name '%s'",name,n,fullname) + report_fonts("feature set '%s' gets number %s and name '%s'",name,n,fullname) end return n end @@ -131,20 +152,21 @@ local function initialize(goodies,tfmdata) local goodiesname = goodies.name if featuresets then if trace_goodies then - logs.report("fonts", "checking featuresets in '%s'",goodies.name) + report_fonts("checking featuresets in '%s'",goodies.name) end for name, set in next, featuresets do - fonts.goodies.prepare_features(goodies,name,set) + fontgoodies.prepare_features(goodies,name,set) end end end -fonts.goodies.register("featureset",initialize) +fontgoodies.register("featureset",initialize) -function fonts.initializers.common.featureset(tfmdata,set) +local function setfeatureset(tfmdata,set) local goodies = tfmdata.goodies -- shared ? if goodies then local features = tfmdata.shared.features + local properties = tfmdata.properties local what for i=1,#goodies do -- last one counts @@ -157,19 +179,69 @@ function fonts.initializers.common.featureset(tfmdata,set) features[feature] = value end end - tfmdata.mode = features.mode or tfmdata.mode + properties.mode = features.mode or properties.mode end end end --- colorschemes +-- postprocessors (we could hash processor and share code) + +local function setpostprocessor(tfmdata,processor) + local goodies = tfmdata.goodies + if goodies and type(processor) == "string" then + local found = { } + local asked = utilities.parsers.settings_to_array(processor) + for i=1,#goodies do + local g = goodies[i] + local p = g.postprocessors + if p then + for i=1,#asked do + local a = asked[i] + local f = p[a] + if type(f) == "function" then + found[a] = f + end + end + end + end + local postprocessors = { } + for i=1,#asked do + local a = asked[i] + local f = found[a] + if f then + postprocessors[#postprocessors+1] = f + end + end + if #postprocessors > 0 then + tfmdata.postprocessors = postprocessors + end + end +end + +-- fontgoodies.postprocessors = fontgoodies.postprocessors or { } +-- local postprocessors = fontgoodies.postprocessors +-- +-- function postprocessors.apply(tfmdata) +-- local postprocessors = tfmdata.postprocessors +-- if postprocessors then +-- for i=1,#postprocessors do +-- postprocessors[i](tfmdata) +-- end +-- end +-- end +-- +-- function definers.applypostprocessors(tfmdata) +-- fonts.goodies.postprocessors.apply(tfmdata) -- only here +-- return tfmdata +-- end -fonts.goodies.colorschemes = fonts.goodies.colorschemes or { } -fonts.goodies.colorschemes.data = fonts.goodies.colorschemes.data or { } +-- colorschemes -local colorschemes = fonts.goodies.colorschemes +local colorschemes = { } +fontgoodies.colorschemes = colorschemes +colorschemes.data = { } -function fonts.initializers.common.colorscheme(tfmdata,scheme) +local function setcolorscheme(tfmdata,scheme) if type(scheme) == "string" then local goodies = tfmdata.goodies -- todo : check for already defined in shared @@ -183,7 +255,7 @@ function fonts.initializers.common.colorscheme(tfmdata,scheme) if what then -- this is font bound but we can share them if needed -- just as we could hash the conversions (per font) - local hash, reverse = tfmdata.luatex.unicodes, { } + local hash, reverse = tfmdata.resources.unicodes, { } for i=1,#what do local w = what[i] for j=1,#w do @@ -194,94 +266,237 @@ function fonts.initializers.common.colorscheme(tfmdata,scheme) end end end - tfmdata.colorscheme = reverse + tfmdata.properties.colorscheme = reverse return end end end - tfmdata.colorscheme = false + tfmdata.properties.colorscheme = false end -local fontdata = fonts.ids -local fcs = fonts.color.set +local fontdata = fonts.hashes.identifiers +local setnodecolor = nodes.tracers.colors.set local has_attribute = node.has_attribute local traverse_id = node.traverse_id local a_colorscheme = attributes.private('colorscheme') local glyph = node.id("glyph") -function fonts.goodies.colorschemes.coloring(head) +function colorschemes.coloring(head) local lastfont, lastscheme + local done = false for n in traverse_id(glyph,head) do local a = has_attribute(n,a_colorscheme) if a then local f = n.font if f ~= lastfont then - lastscheme, lastfont = fontdata[f].colorscheme, f + lastscheme, lastfont = fontdata[f].properties.colorscheme, f end if lastscheme then local sc = lastscheme[n.char] if sc then - fcs(n,"colorscheme:"..a..":"..sc) -- slow + done = true + setnodecolor(n,"colorscheme:"..a..":"..sc) -- slow end end end end + return head, done +end + +function colorschemes.enable() + nodes.tasks.appendaction("processors","fonts","fonts.goodies.colorschemes.coloring") + function colorschemes.enable() end end -function fonts.goodies.colorschemes.enable() - tasks.appendaction("processors","fonts","fonts.goodies.colorschemes.coloring") - function fonts.goodies.colorschemes.enable() end +local function setextrafeatures(tfmdata) + local goodies = tfmdata.goodies + if goodies then + for i=1,#goodies do + local g = goodies[i] + local f = g.features + if f then + for feature, specification in next, f do + addotffeature(tfmdata.shared.rawdata,feature,specification) + registerotffeature { + name = feature, + description = format("extra: %s",feature) + } + end + end + end + end end --- installation (collected to keep the overview) +-- installation (collected to keep the overview) -- also for type 1 -fonts.otf.tables.features['goodies'] = 'Goodies on top of built in features' -fonts.otf.tables.features['featurset'] = 'Goodie Feature Set' -fonts.otf.tables.features['colorscheme'] = 'Goodie Color Scheme' +registerotffeature { + name = "goodies", + description = "goodies on top of built in features", + initializers = { + position = 1, + base = setgoodies, + node = setgoodies, + } +} -fonts.otf.features.register('goodies') -fonts.otf.features.register('featureset') -fonts.otf.features.register('colorscheme') +registerotffeature { + name = "extrafeatures", + description = "extra features", + default = true, + initializers = { + position = 2, + base = setextrafeatures, + node = setextrafeatures, + } +} + +registerotffeature { + name = "featureset", + description = "goodie feature set", + initializers = { + position = 3, + base = setfeatureset, + node = setfeatureset, + } +} + +registerotffeature { + name = "colorscheme", + description = "goodie color scheme", + initializers = { + base = setcolorscheme, + node = setcolorscheme, + } +} + +registerotffeature { + name = "postprocessor", + description = "goodie postprocessor", + initializers = { + base = setpostprocessor, + node = setpostprocessor, + } +} -table.insert(fonts.triggers, 1, "goodies") -table.insert(fonts.triggers, 2, "featureset") -- insert after -table.insert(fonts.triggers, "colorscheme") +-- afm -fonts.initializers.base.otf.goodies = fonts.initializers.common.goodies -fonts.initializers.node.otf.goodies = fonts.initializers.common.goodies +registerafmfeature { + name = "goodies", + description = "goodies on top of built in features", + initializers = { + position = 1, + base = setgoodies, + node = setgoodies, + } +} -fonts.initializers.base.otf.featureset = fonts.initializers.common.featureset -fonts.initializers.node.otf.featureset = fonts.initializers.common.featureset +-- tfm -fonts.initializers.base.otf.colorscheme = fonts.initializers.common.colorscheme -fonts.initializers.node.otf.colorscheme = fonts.initializers.common.colorscheme +registertfmfeature { + name = "goodies", + description = "goodies on top of built in features", + initializers = { + position = 1, + base = setgoodies, + node = setgoodies, + } +} -- experiment, we have to load the definitions immediately as they precede -- the definition so they need to be initialized in the typescript local function initialize(goodies) local mathgoodies = goodies.mathematics - local virtuals = mathgoodies and mathgoodies.virtuals - local mapfiles = mathgoodies and mathgoodies.mapfiles - local maplines = mathgoodies and mathgoodies.maplines - if virtuals then - for name, specification in next, virtuals do - mathematics.make_font(name,specification) + if mathgoodies then + local virtuals = mathgoodies.virtuals + local mapfiles = mathgoodies.mapfiles + local maplines = mathgoodies.maplines + if virtuals then + for name, specification in next, virtuals do + -- beware, they are all constructed + mathematics.makefont(name,specification,goodies) + end + end + if mapfiles then + for i=1,#mapfiles do + fonts.mappings.loadfile(mapfiles[i]) -- todo: backend function + end end + if maplines then + for i=1,#maplines do + fonts.mappings.loadline(maplines[i]) -- todo: backend function + end + end + end +end + +fontgoodies.register("mathematics", initialize) + +-- the following takes care of explicit file specifications +-- +-- files = { +-- name = "antykwapoltawskiego", +-- list = { +-- ["AntPoltLtCond-Regular.otf"] = { +-- -- name = "antykwapoltawskiego", +-- style = "regular", +-- weight = "light", +-- width = "condensed", +-- }, +-- }, +-- } + +local function initialize(goodies) + local files = goodies.files + if files then + fonts.names.register(files) end - if mapfiles then - for i=1,#mapfiles do - fonts.map.loadfile(mapfiles[i]) -- todo: backend function +end + +fontgoodies.register("files", initialize) + +-- some day we will have a define command and then we can also do some +-- proper tracing +-- +-- fonts.typefaces["antykwapoltawskiego-condensed"] = { +-- shortcut = "rm", +-- shape = "serif", +-- fontname = "antykwapoltawskiego", +-- normalweight = "light", +-- boldweight = "medium", +-- width = "condensed", +-- size = "default", +-- features = "default", +-- } + +local function initialize(goodies) + local typefaces = goodies.typefaces + if typefaces then + local ft = fonts.typefaces + for k, v in next, typefaces do + ft[k] = v end end - if maplines then - for i=1,#maplines do - fonts.map.loadline(maplines[i]) -- todo: backend function +end + +fontgoodies.register("typefaces", initialize) + +local compositions = { } + +function fontgoodies.getcompositions(tfmdata) + return compositions[file.nameonly(tfmdata.properties.filename or "")] +end + +local function initialize(goodies) + local gc = goodies.compositions + if gc then + for k, v in next, gc do + compositions[k] = v end end end -fonts.goodies.register("mathematics", initialize) +fontgoodies.register("compositions", initialize) -- The following file (husayni.lfg) is the experimental setup that we used -- for Idris font. For the moment we don't store this in the cache and quite diff --git a/Master/texmf-dist/tex/context/base/font-gds.mkiv b/Master/texmf-dist/tex/context/base/font-gds.mkiv index e36116283e0..083cd9128ad 100644 --- a/Master/texmf-dist/tex/context/base/font-gds.mkiv +++ b/Master/texmf-dist/tex/context/base/font-gds.mkiv @@ -13,14 +13,13 @@ \writestatus{loading}{ConTeXt Font Support / Colorschemes} -% \registerctxluafile{font-gds}{1.001} +%registerctxluafile{font-gds}{1.001} \unprotect \def\loadfontgoodies[#1]% {\ctxlua{fonts.goodies.get("#1")}} - % this will become colorgroups and move to font-col or so \definecolor[colorscheme:1:1][s=.75] @@ -39,7 +38,7 @@ \definecolor[colorscheme:2:2][m=.75] \definecolor[colorscheme:2:1][y=.75] -\definesystemattribute[colorscheme] \chardef\colorschemeattribute \dogetattributeid{colorscheme} +\definesystemattribute[colorscheme][public] \def\setfontcolorscheme {\ctxlua{fonts.goodies.colorschemes.enable()}% diff --git a/Master/texmf-dist/tex/context/base/font-ini.lua b/Master/texmf-dist/tex/context/base/font-ini.lua index a8a311e1875..8eeba0ce7f6 100644 --- a/Master/texmf-dist/tex/context/base/font-ini.lua +++ b/Master/texmf-dist/tex/context/base/font-ini.lua @@ -6,90 +6,33 @@ if not modules then modules = { } end modules ['font-ini'] = { license = "see context related readme files" } +-- basemethods -> can also be in list +-- presetcontext -> defaults +-- hashfeatures -> ctx version + --[[ldx--

Not much is happening here.

--ldx]]-- -local utf = unicode.utf8 -local format, serialize = string.format, table.serialize -local write_nl = texio.write_nl +local lower = string.lower +local allocate, mark = utilities.storage.allocate, utilities.storage.mark -if not fontloader then fontloader = fontforge end +local report_defining = logs.reporter("fonts","defining") fontloader.totable = fontloader.to_table --- vtf comes first --- fix comes last - -fonts = fonts or { } - -fonts.ids = fonts.ids or { } fonts.identifiers = fonts.ids -- aka fontdata -fonts.chr = fonts.chr or { } fonts.characters = fonts.chr -- aka chardata -fonts.qua = fonts.qua or { } fonts.quads = fonts.qua -- aka quaddata - -fonts.tfm = fonts.tfm or { } - -fonts.mode = 'base' -fonts.private = 0xF0000 -- 0x10FFFF -fonts.verbose = false -- more verbose cache tables - -fonts.ids[0] = { -- nullfont - characters = { }, - descriptions = { }, - name = "nullfont", -} - -fonts.chr[0] = { } - -fonts.methods = fonts.methods or { - base = { tfm = { }, afm = { }, otf = { }, vtf = { }, fix = { } }, - node = { tfm = { }, afm = { }, otf = { }, vtf = { }, fix = { } }, -} - -fonts.initializers = fonts.initializers or { - base = { tfm = { }, afm = { }, otf = { }, vtf = { }, fix = { } }, - node = { tfm = { }, afm = { }, otf = { }, vtf = { }, fix = { } } -} - -fonts.triggers = fonts.triggers or { - 'mode', - 'language', - 'script', - 'strategy', -} - -fonts.processors = fonts.processors or { -} - -fonts.manipulators = fonts.manipulators or { -} - -fonts.define = fonts.define or { } -fonts.define.specify = fonts.define.specify or { } -fonts.define.specify.synonyms = fonts.define.specify.synonyms or { } - --- tracing - -if not fonts.color then - - fonts.color = { - set = function() end, - reset = function() end, - } - -end +fonts = fonts or { } -- already defined in context +local fonts = fonts --- format identification +-- some of these might move to where they are used first: -fonts.formats = { } +fonts.hashes = { identifiers = allocate() } +fonts.analyzers = { } -- not needed here +fonts.readers = { } +fonts.tables = { } +fonts.definers = { methods = { } } +fonts.specifiers = fonts.specifiers or { } -- in format ! +fonts.loggers = { register = function() end } +fonts.helpers = { } -function fonts.fontformat(filename,default) - local extname = string.lower(file.extname(filename)) - local format = fonts.formats[extname] - if format then - return format - else - logs.report("fonts define","unable to determine font format for '%s'",filename) - return default - end -end +fonts.tracers = { } -- for the moment till we have move to moduledata diff --git a/Master/texmf-dist/tex/context/base/font-ini.mkii b/Master/texmf-dist/tex/context/base/font-ini.mkii index 89fbb5d0720..7b84125fa5a 100644 --- a/Master/texmf-dist/tex/context/base/font-ini.mkii +++ b/Master/texmf-dist/tex/context/base/font-ini.mkii @@ -639,7 +639,7 @@ % \def\normalmbox % {\dowithnextboxcontent\mf\flushnextbox\normalhbox} -\def\mbox +\def\mbox % we cannot add \dontleavehmode ... else no \setbox0\mbox possible {\ifmmode\normalmbox\else\normalhbox\fi} \def\enablembox @@ -1157,8 +1157,6 @@ \let\fontfile\s!unknown -\ifx\checkfontfilename\undefined \let\checkfontfilename\relax \fi - % \definefontsynonym % [blabla] % [name:Latin Modern Something] @@ -1194,88 +1192,6 @@ \edef\checkedfontfile{\!!stringb}% \fi\fi\fi} -% \definefontfeature[default] [liga=yes,texligatures=yes,texquotes=yes] -% \definefontfeature[default-caps][liga=yes,texligatures=yes,texquotes=yes,smcp=yes,script=latn] -% -% \starttypescript [serif] [palatino-nova-regular] [name] -% \definefontsynonym[Serif] [palatinonova-regular][features=default] -% \definefontsynonym[SerifCaps][palatinonova-regular][features=default-caps] % also sets Serif -% \stoptypescript -% -% \starttypescript [serif] [palatino-nova-regular] [name] -% \definefontsynonym[Serif] [palatinonova-regular*default] -% \definefontsynonym[SerifCaps] [palatinonova-regular*default-caps] -% \stoptypescript - -% \definetypeface[mainface][rm][serif][palatino-nova-regular][default] \setupbodyfont[mainface] -% -% \starttext -% ``Test'' -- --- ff fi fl \sc ``Test'' -- --- ff fi fl -% \stoptext - -% \starttext -% \definefont -% [blabla] -% [name:Latin Modern Something] -% \definefont -% [blabla] -% [file:texnansi-lmr10] -% \blabla test -% \definefont -% [blabla] -% [texnansi-lmtt10] -% \blabla test -% \stoptext - -% \starttext -% -% \setupcolors[state=start] -% -% \definefontfeature -% [default-base] -% [script=latn,language=dflt,liga=yes,kern=yes,tlig=yes,trep=yes] -% \definefontfeature -% [default-node] -% [script=latn,language=dflt,liga=yes,kern=yes,tlig=yes,trep=yes,mode=node] -% \definefontfeature -% [default-none] -% [script=latn,language=dflt,liga=yes,kern=no, tlig=yes,trep=yes] -% -% \startoverlay -% {\vtop{\color[red] {\font\test=name:lmroman12regular*default-node \test \input ward \input zapf \input linden }}} -% {\vtop{\color[green]{\font\test=name:lmroman12regular*default-base \test \input ward \input zapf \input linden }}} -% {\vtop{\color[blue] {\font\test=name:lmroman12regular*default-none \test \input ward \input zapf \input linden }}} -% \stopoverlay -% -% \blank -% -% \startoverlay -% {\vtop{\color[red] {\font\test=name:texgyrepagella*default-node \test \input ward \input zapf \input linden }}} -% {\vtop{\color[green]{\font\test=name:texgyrepagella*default-base \test \input ward \input zapf \input linden }}} -% {\vtop{\color[blue] {\font\test=name:texgyrepagella*default-none \test \input ward \input zapf \input linden }}} -% \stopoverlay -% -% \blank -% -% \startoverlay -% {\vtop{\color[red] {\font\test=name:palatinonovaregular*default-node \test \input ward \input zapf \input linden }}} -% {\vtop{\color[green]{\font\test=name:palatinonovaregular*default-base \test \input ward \input zapf \input linden }}} -% {\vtop{\color[blue] {\font\test=name:palatinonovaregular*default-none \test \input ward \input zapf \input linden }}} -% \stopoverlay -% -% \startoverlay -% {\vtop{\color[red] {\font\test=name:OfficinaSerifBookITC*default-node \test \input ward \input zapf \input linden }}} -% {\vtop{\color[green]{\font\test=name:OfficinaSerifBookITC*default-base \test \input ward \input zapf \input linden }}} -% {\vtop{\color[blue] {\font\test=name:OfficinaSerifBookITC*default-none \test \input ward \input zapf \input linden }}} -% \stopoverlay -% -% \definefontfeature[superdefault][default][compose=yes] -% -% {\font\oeps=name:lmroman10regular*default at 30pt \oeps test \char7683} -% {\font\oeps=name:lmroman10regular*superdefault at 30pt \oeps test \char7683} -% -% \stoptext - \let\doshowcheckedfontfeatures\relax \def\showcheckedfontfeatures @@ -1546,18 +1462,11 @@ %D \def\currentfontfileencoding{texnansi} %D \stoptyping -% \def\@@currentfontfile{currentfontfile} -% -% \def\getfontfileparameters#1% -% {\edef\fontdata{\truefontdata{\truefontname{#1}}}% -% \expanded{\getparameters[\@@currentfontfile][\fontdata]}} - -\def\getfontfileparameters#1% can be simpler for mkii +\def\getfontfileparameters#1% can be simpler for mkii (no features) {\edef\@@truefontname{\truefontname{#1}}% \edef\currentfontfileencoding{\truefontdata\@@truefontname\s!encoding}% \edef\currentfontfilemapping {\truefontdata\@@truefontname\s!mapping }% - \edef\currentfontfilehandling{\truefontdata\@@truefontname\s!handling}% - \edef\currentfontfilefeatures{\truefontdata\@@truefontname\s!features}} + \edef\currentfontfilehandling{\truefontdata\@@truefontname\s!handling}} %D \macros %D {definefont} @@ -3129,7 +3038,6 @@ {\edef\@@fontencoding{\truefontdata\fontfile \s!encoding}% \edef\@@fontmapping {\truefontdata\fontfile \s!mapping }% \edef\@@fonthandling{\truefontdata\somefontname\s!handling}% - \edef\@@fontfeatures{\truefontdata\fontfile \s!features}% \edef\@@fontskewchar{\truefontdata\fontfile \s!skewchar}} \def\setfontcharacteristics @@ -3158,43 +3066,14 @@ \def\synchronizepatternswithfont{\synchronizepatterns} \fi -%D Experimental: +%D Experimental: (should move to font-xtx) -\def\definefontfeature - {\dotripleargument\dodefinefontfeature} +\ifdefined \definefontfeature \else -\def\dododefinefontfeature#1% - {\edef\!!stringa{\ifx\!!stringa\empty\else\!!stringa,\fi\executeifdefined{\??fa#1}\empty}} + \def\definefontfeature {\dotripleargument\dodefinefontfeature} + \def\dodefinefontfeature[#1][#2][#3]{} -\def\dodefinefontfeature[#1][#2][#3]% - {\doifassignmentelse{#2} - {\setevalue{\??fa#1}{#2}} - {\let\!!stringa\empty - \processcommalist[#2]\dododefinefontfeature - \setevalue{\??fa#1}{\ifx\!!stringa\empty\else\!!stringa,\fi#3}}} - -\definefontfeature - [default] - [liga=yes,kern=yes,tlig=yes,trep=yes] % texligatures=yes,texquotes=yes - -\definefontfeature - [smallcaps] - [liga=yes,kern=yes,tlig=yes,trep=yes,smcp=yes] % texligatures=yes,texquotes=yes - -\definefontfeature - [oldstyle] - [liga=yes,kern=yes,tlig=yes,trep=yes,onum=yes] % texligatures=yes,texquotes=yes - -\definefontfeature % no calt - [arabic] - [language=dflt,script=arab, - init=yes,medi=yes,fina=yes,isol=yes, - liga=yes,dlig=yes,rlig=yes,clig=yes, - mark=yes,mkmk=yes,kern=yes,curs=yes] - -\definefontfeature - [none] - [features=no] +\fi %D The next auxilliary macro is an alternative to \type %D {\fontname}. @@ -3784,7 +3663,7 @@ %D The implementation is rather straightforward in using %D \type{\halign}. -\fetchruntimecommand \showbodyfont {\f!fontprefix\s!run.mkii} +\fetchruntimecommand \showbodyfont {\f!fontprefix\s!run} %D \macros %D {showfontstrip, testminimalbaseline, showminimalbaseline} @@ -3795,9 +3674,9 @@ %D %D \showfontstrip \blank \showminimalbaseline -\fetchruntimecommand \showfontstrip {\f!fontprefix\s!run.mkii} -\fetchruntimecommand \testminimalbaseline {\f!fontprefix\s!run.mkii} -\fetchruntimecommand \showminimalbaseline {\f!fontprefix\s!run.mkii} +\fetchruntimecommand \showfontstrip {\f!fontprefix\s!run} +\fetchruntimecommand \testminimalbaseline {\f!fontprefix\s!run} +\fetchruntimecommand \showminimalbaseline {\f!fontprefix\s!run} %D \macros %D {showkerning} @@ -3806,7 +3685,7 @@ %D %D \showkerning{Can you guess what kerning is?} -\fetchruntimecommand \showkerning {\f!fontprefix\s!run.mkii} +\fetchruntimecommand \showkerning {\f!fontprefix\s!run} %D \macros %D {showbodyfontenvironment} @@ -3819,7 +3698,7 @@ %D %D \showsetup{showbodyfontenvironment} -\fetchruntimecommand \showbodyfontenvironment {\f!fontprefix\s!run.mkii} +\fetchruntimecommand \showbodyfontenvironment {\f!fontprefix\s!run} %D \macros %D {showfont,showfontstyle,showligatures} @@ -3840,11 +3719,11 @@ % to be internationalized -\fetchruntimecommand \showfont {\f!fontprefix\s!run.mkii} -\fetchruntimecommand \showfontstyle {\f!fontprefix\s!run.mkii} -\fetchruntimecommand \showligature {\f!fontprefix\s!run.mkii} -\fetchruntimecommand \showligatures {\f!fontprefix\s!run.mkii} -\fetchruntimecommand \showcharratio {\f!fontprefix\s!run.mkii} +\fetchruntimecommand \showfont {\f!fontprefix\s!run} +\fetchruntimecommand \showfontstyle {\f!fontprefix\s!run} +\fetchruntimecommand \showligature {\f!fontprefix\s!run} +\fetchruntimecommand \showligatures {\f!fontprefix\s!run} +\fetchruntimecommand \showcharratio {\f!fontprefix\s!run} %D \macros %D {getglyph, symbolicfont} diff --git a/Master/texmf-dist/tex/context/base/font-ini.mkiv b/Master/texmf-dist/tex/context/base/font-ini.mkiv index c7d515cca36..1c9cdcd321a 100644 --- a/Master/texmf-dist/tex/context/base/font-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/font-ini.mkiv @@ -14,9 +14,12 @@ % runtime commands will move to modules +% todo: (so that we can delay font loading to \starttext + % simplification ... we no longer deal with specific mmtfa specifications -% todo: always fontclass, then less testing +% todo: always fontclass, then less testing +% todo: bodyfontvariable: parent % \definefontfeature[smallcaps][smcp=yes,script=latn] % \definefontfeature[smallcaps][SmallCapitals=yes,script=latn] @@ -55,34 +58,49 @@ \writestatus{loading}{ConTeXt Font Macros / Initialization} \registerctxluafile{font-ini}{1.001} -\registerctxluafile{node-fnt}{1.001} % here +\registerctxluafile{font-log}{1.001} +\registerctxluafile{font-con}{1.001} \registerctxluafile{font-enc}{1.001} +%registerctxluafile{font-agl}{1.001} % loaded when needed, saves 100K in format +\registerctxluafile{font-cid}{1.001} % cid maps \registerctxluafile{font-map}{1.001} \registerctxluafile{font-syn}{1.001} -\registerctxluafile{font-log}{1.001} + \registerctxluafile{font-tfm}{1.001} -\registerctxluafile{font-enh}{1.001} + \registerctxluafile{font-afm}{1.001} -\registerctxluafile{font-cid}{1.001} % cid maps -\registerctxluafile{font-ott}{1.001} % otf tables -\registerctxluafile{font-otf}{1.001} % otf main -\registerctxluafile{font-otd}{1.001} % otf dynamics + \registerctxluafile{font-oti}{1.001} % otf initialization +\registerctxluafile{font-ott}{1.001} % otf tables (first) +\registerctxluafile{font-otf}{1.001} % otf main \registerctxluafile{font-otb}{1.001} % otf main base +\registerctxluafile{node-inj}{1.001} % we might split it off \registerctxluafile{font-otn}{1.001} % otf main node -\registerctxluafile{font-ota}{1.001} % otf analyzers +\registerctxluafile{font-otd}{1.001} % otf dynamics (does an overload) +\registerctxluafile{font-ota}{1.001} % otf analyzers (needs dynamics) \registerctxluafile{font-otp}{1.001} % otf pack \registerctxluafile{font-otc}{1.001} % otf context +\registerctxluafile{font-oth}{1.001} % otf helpers + +\registerctxluafile{font-pat}{1.001} % patchers + +\registerctxluafile{node-fnt}{1.001} % here + +\registerctxluafile{font-lua}{1.001} + \registerctxluafile{font-vf} {1.001} +\registerctxluafile{font-enh}{1.001} + +\registerctxluafile{font-gds}{1.001} % currently only otf + \registerctxluafile{font-def}{1.001} -\registerctxluafile{font-ctx}{1.001} -\registerctxluafile{font-xtx}{1.001} -\registerctxluafile{font-fbk}{1.001} -\registerctxluafile{font-gds}{1.001} +\registerctxluafile{font-ctx}{1.001} % after def as it overloads + \registerctxluafile{font-ext}{1.001} -\registerctxluafile{font-pat}{1.001} +\registerctxluafile{font-fbk}{1.001} \registerctxluafile{font-chk}{1.001} -\registerctxluafile{font-agl}{1.001} + +\registerctxluafile{font-aux}{1.001} \unprotect @@ -160,9 +178,12 @@ % \newtoks \everydefinedfont % not ot be confused with \everydefinefont +\let\thedefinedfont\relax + \def\dodefinedfont[#1]% - {\iffirstargument\definefont[thedefinedfont][#1]\fi % we can speed this one up - \csname thedefinedfont\endcsname + {\featureinheritancemode\featureinheritancefontonly + \iffirstargument\definefont[thedefinedfont][#1]\fi % we can speed this one up + \thedefinedfont \the\everydefinedfont} \unexpanded\def\definedfont @@ -471,11 +492,11 @@ %D check for fontclass being default or empty and save a few %D tests but it does not help us when no math is defined. -\chardef\mrfam\zerocount % math regular -\chardef\mbfam\plusone % math bold +\let\mrfam\zerocount % math regular +\let\mbfam\plusone % math bold -\unexpanded\def\mr{\ifmmode\fam\zerocount\else\setcurrentfontalternative\c!mr\fi} % \fam\csname\c!mr fam\endcsname -\unexpanded\def\mb{\ifmmode\fam\plusone \else\setcurrentfontalternative\c!mb\fi} % \fam\csname\c!mb fam\endcsname +\unexpanded\def\mr{\ifmmode\fam\mrfam\else\setcurrentfontalternative\c!mr\fi} +\unexpanded\def\mb{\ifmmode\fam\mbfam\else\setcurrentfontalternative\c!mb\fi} \def\mathtextsuffix {-text} \def\mathscriptsuffix {-script} @@ -515,6 +536,11 @@ \def\dosetmathfamily#1#2% {\let\savedfontbody\fontbody % op hoger plan \let\fontfamily#2% + % new per 20100817 + \checkbodyfontenvironment[\scriptscriptface]% + \checkbodyfontenvironment[\scriptface]% + \checkbodyfontenvironment[\textface]% + % \let\currentmathsize\!!plusthree\let\fontbody\scriptscriptface\dodosetmathfamily\scriptscriptfont#1% \let\currentmathsize\!!plustwo \let\fontbody\scriptface \dodosetmathfamily\scriptfont #1% \let\currentmathsize\!!plusone \let\fontbody\textface \dodosetmathfamily\textfont #1% @@ -528,29 +554,14 @@ % not official ! -\chardef\boldmathmode\zerocount % might change ... maybe \mathfontsupport 1 (normal) 2 (bold too) +\newconditional\boldmathmode % might change ... maybe \mathfontsupport 1 (normal) 2 (bold too) -\def\enableboldmath {\chardef\boldmathmode\plusone } % todo: \setupbodyfont[boldmath,...] -\def\disableboldmath{\chardef\boldmathmode\zerocount} +\def\enableboldmath {\settrue \boldmathmode} % todo: \setupbodyfont[boldmath,...] +\def\disableboldmath{\setfalse\boldmathmode} \appendtoks - \ifcase\boldmathmode\or\dosetmathfamily\mbfam\c!mb\fi + \ifconditional\boldmathmode\dosetmathfamily\mbfam\c!mb\fi \to \mathstrategies - -% \chardef\msfam\plustwo % math symbol -% -% \def\c!ms{ms} -% -% \unexpanded\def\ms{\ifmmode\fam\plustwo\else\setcurrentfontalternative\c!ms\fi} -% -% \chardef\symbolmathmode\zerocount -% -% \def\enablesymbolmath {\chardef\symbolmathmode\plusone } -% \def\disablesymbolmath{\chardef\symbolmathmode\zerocount} -% -% \appendtoks -% \ifcase\symbolmathmode\or\dosetmathfamily\msfam\c!ms\fi -% \to \mathstrategies %D All used styles, like rm, ss and tt, are saved in a comma %D separated list. Appart from practical limitations one can @@ -614,6 +625,10 @@ \let\relativefontid\empty \fi} +\def\checkrelativefontid % not yet supported as we then need to trigger \rm\tf or so first + {\let\relativefontsize\minusone + \let\relativefontsize\defaultrelativefontsize} + \def\checkrelativefontsize#1% {\edef\relativefontsize {\ifcsname\fontclass#1\s!rscale\endcsname @@ -685,9 +700,24 @@ \let\relativefontid\empty -\def\lowleveldefinefont#1#2% #2 = cs - {% - \ctxlua{fonts.define.command_1("\luaescapestring{#1}")}% the escapestring catches at \somedimen +% 0 = none +% 1 = fontonly +% 2 = classonly +% 3 = fontfirst +% 4 = classfirst + +\setnewconstant\featureinheritancefontnone \zerocount +\setnewconstant\featureinheritancefontonly \plusone +\setnewconstant\featureinheritanceclassonly \plustwo +\setnewconstant\featureinheritancefontfirst \plusthree +\setnewconstant\featureinheritanceclassfirst\plusfour + +\setnewconstant\featureinheritancedefault \featureinheritancefontfirst +\setnewconstant\featureinheritancemode \featureinheritancedefault + +\unexpanded\def\lowleveldefinefont#1#2% #2 = cs + {% we can now set more at the lua end + \ctxlua{fonts.definers.stage_one("\luaescapestring{#1}")}% the escapestring catches at \somedimen % sets \scaledfontmode and \somefontname and \somefontsize \ifcase\scaledfontmode\relax % none, avoid the designsize if possible @@ -707,6 +737,7 @@ % scaled, don't use this one as it's unpredictable \scaledfontsize-\somefontsize\scaledpoint \fi + \relax \scaledfontsize\localrelativefontsize\scaledfontsize \ifautofontsize \scaledfontsize\currentfontbodyscale\scaledfontsize @@ -718,26 +749,32 @@ \fi \updatefontparameters \updatefontclassparameters - \ctxlua{fonts.define.command_2( + \ctxlua{fonts.definers.stage_two( \ifx\fontclass\empty false\else true\fi, "#2", % cs, trailing % is gone "\somefontfile", \number\scaledfontsize, + \number\featureinheritancemode, "\@@fontclassfeatures", "\@@fontfeatures", "\@@fontclassfallbacks", "\@@fontfallbacks", 0\currentmathsize, \number\dimexpr\textface\relax, - "\relativefontid" % experiment + "\relativefontid", % experiment + "\@@fontclassgoodies", % experiment (not yet used) + "\@@fontgoodies" % experiment )}% - \edef\somefontspec{at \somefontsize}% we need the resolved designsize (for fallbacks) +% \edef\somefontspec{at \somefontsize}% we need the resolved designsize (for fallbacks) + \edef\somefontspec{at \number\scaledfontsize sp}% we need the resolved designsize (for fallbacks) \expandafter\let\expandafter\lastrawfontcall\csname#2\endcsname - \the\everydefinefont} + \the\everydefinefont + \featureinheritancemode\featureinheritancedefault} \def\updatefontclassparameters {\edef\@@fontclassfeatures {\ifcsname\fontclass\fontstyle\s!features \endcsname\csname\fontclass\fontstyle\s!features \endcsname\fi}% - \edef\@@fontclassfallbacks{\ifcsname\fontclass\fontstyle\s!fallbacks\endcsname\csname\fontclass\fontstyle\s!fallbacks\endcsname\fi}} + \edef\@@fontclassfallbacks{\ifcsname\fontclass\fontstyle\s!fallbacks\endcsname\csname\fontclass\fontstyle\s!fallbacks\endcsname\fi}% + \edef\@@fontclassgoodies {\ifcsname\fontclass\fontstyle\s!goodies \endcsname\csname\fontclass\fontstyle\s!goodies \endcsname\fi}} % resolve @@ -755,6 +792,13 @@ \ifcsname\??ff #1\endcsname\@EA \@@thefallbacksyes\csname\??ff #1\endcsname\else \let \@@fontfallbacks \empty \fi\fi\fi\fi} +\def\@@thegoodiesyes#1% + {\ifcsname\??ff\fontclass#1\s!goodies \endcsname\@EA\let\@EA\@@fontgoodies \csname\??ff\fontclass#1\s!goodies \endcsname\else + \ifcsname\??ff #1\s!goodies \endcsname\@EA\let\@EA\@@fontgoodies \csname\??ff #1\s!goodies \endcsname\else + \ifcsname\??ff\fontclass #1\endcsname\@EA \@@thegoodiesyes \csname\??ff\fontclass #1\endcsname\else + \ifcsname\??ff #1\endcsname\@EA \@@thegoodiesyes \csname\??ff #1\endcsname\else + \let \@@fontgoodies \empty \fi\fi\fi\fi} + \def\@@thefeaturesnop#1% {\ifcsname\??ff#1\s!features \endcsname\@EA\let\@EA\@@fontfeatures \csname\??ff#1\s!features \endcsname\else \ifcsname\??ff #1\endcsname\@EA \@@thefeaturesnop \csname\??ff #1\endcsname\else @@ -765,13 +809,20 @@ \ifcsname\??ff #1\endcsname\@EA \@@thefallbacksnop\csname\??ff #1\endcsname\else \let \@@fontfallbacks \empty \fi\fi} +\def\@@thegoodiesnop#1% + {\ifcsname\??ff#1\s!goodies \endcsname\@EA\let\@EA\@@fontgoodies \csname\??ff#1\s!goodies \endcsname\else + \ifcsname\??ff #1\endcsname\@EA \@@thegoodiesnop \csname\??ff #1\endcsname\else + \let \@@fontgoodies \empty \fi\fi} + \def\updatefontparametersyes {\@@thefeaturesyes \somefontname - \@@thefallbacksyes\somefontname} + \@@thefallbacksyes\somefontname + \@@thegoodiesyes \somefontname} \def\updatefontparametersnop {\@@thefeaturesnop \somefontname - \@@thefallbacksnop\somefontname} + \@@thefallbacksnop\somefontname + \@@thegoodiesnop \somefontname} \def\updatefontparameters {\ifx\fontclass\empty\updatefontparametersnop\else\updatefontparametersyes\fi} @@ -781,6 +832,8 @@ \let\@@fontfallbacks\empty \let\@@fontfeatures \empty +\let\@@fontgoodies \empty + \let\@@hyphenchar \empty % todo, will go to encoding %D This brings down maps processing from 466 to 309 seconds @@ -915,6 +968,8 @@ % We could use an indirect method ... store in 'array' and refer to % slot. +% +% or nicer .. use parent chain \unexpanded\def\definefontsynonym[#1]#2[#3]% {\edef\@@fontname{#1}% @@ -936,11 +991,13 @@ \def\dododefinefontsynonymnop[#1]% {\let\@@ff@@features \undefined \let\@@ff@@fallbacks\undefined + \let\@@ff@@goodies \undefined \expandafter\dogetfontparameternop#1,]=,} \def\dododefinefontsynonymyes[#1]% {\let\@@ff@@features \undefined \let\@@ff@@fallbacks\undefined + \let\@@ff@@goodies \undefined \expandafter\dogetfontparameteryes#1,]=,} \def\dogetfontparameternop#1=#2,% @@ -959,27 +1016,34 @@ \expandafter\dogetfontparameteryes \fi} -% hm, was wrong, class/global reversed +% helpers, some day these will be toks and counts + +\def\fntsetdefname {\global\let\somefontname\defaultfontfile} +\def\fntsetsomename{\gdef\somefontname} % {#1} +\def\fntsetnopsize {\let\somefontsize\empty} +\def\fntsetsomesize{\def\somefontsize} % {#1} -\let\fcglobal\global -\let\fcxdef \xdef -\let\fcglet \glet +% end of helpers \def\nonodefinefontsynonymnop {\@EA\let\csname\??ff\@@fontname\s!features \endcsname\undefined - \@EA\let\csname\??ff\@@fontname\s!fallbacks\endcsname\undefined} + \@EA\let\csname\??ff\@@fontname\s!fallbacks\endcsname\undefined + \@EA\let\csname\??ff\@@fontname\s!goodies \endcsname\undefined} \def\nonodefinefontsynonymyes - {\fcglobal\@EA\let\csname\??ff\fontclass\@@fontname\s!features \endcsname\undefined - \fcglobal\@EA\let\csname\??ff\fontclass\@@fontname\s!fallbacks\endcsname\undefined} + {\global\@EA\let\csname\??ff\fontclass\@@fontname\s!features \endcsname\undefined + \global\@EA\let\csname\??ff\fontclass\@@fontname\s!fallbacks\endcsname\undefined + \global\@EA\let\csname\??ff\fontclass\@@fontname\s!goodies \endcsname\undefined} \def\dodododefinefontsynonymnop {\@EA\let\csname\??ff\@@fontname\s!features \endcsname\@@ff@@features - \@EA\let\csname\??ff\@@fontname\s!fallbacks\endcsname\@@ff@@fallbacks} + \@EA\let\csname\??ff\@@fontname\s!fallbacks\endcsname\@@ff@@fallbacks + \@EA\let\csname\??ff\@@fontname\s!goodies \endcsname\@@ff@@goodies} \def\dodododefinefontsynonymyes - {\fcglobal\@EA\let\csname\??ff\fontclass\@@fontname\s!features \endcsname\@@ff@@features - \fcglobal\@EA\let\csname\??ff\fontclass\@@fontname\s!fallbacks\endcsname\@@ff@@fallbacks} + {\global\@EA\let\csname\??ff\fontclass\@@fontname\s!features \endcsname\@@ff@@features + \global\@EA\let\csname\??ff\fontclass\@@fontname\s!fallbacks\endcsname\@@ff@@fallbacks + \global\@EA\let\csname\??ff\fontclass\@@fontname\s!goodies \endcsname\@@ff@@goodies} \let\definefontfile\definefontsynonym % dedicated to Taco Hoekwater @@ -1135,7 +1199,8 @@ \def\newfontidentifier{*\fontclass\lastfontidentifier\fontstyle\fontsize*} \def\dododefinefont#1#2% - {\edef\lastfontidentifier{#1}% + {\featureinheritancemode\featureinheritancefontonly + \edef\lastfontidentifier{#1}% \let\localrelativefontsize\defaultrelativefontsize \let\localabsolutefontsize\fontbody \lowleveldefinefont{#2}\rawfontidentifier @@ -1260,6 +1325,12 @@ %D expands to the current size in terms of \type {a} \unknown %D \type {d}, nothing, or \type {x} \unknown \type {xx}. +%D In the following macros we use \type{\currentxfontsize} to +%D hold the current x||size of the font. This enables us to +%D support for instance \type{\sl} inside a \type{\tx} switch. + +\newconstant\currentxfontsize + \def\xfontsize{\ifcase\currentxfontsize\fontsize\or\c!x\else\c!xx\fi} %D A typical use of this command is in commands that switch @@ -1334,24 +1405,81 @@ \newcount\@@fontdefhack % check if this is still needed +% \def\@@beginfontdef +% {\ifcase\@@fontdefhack +% \let\k!savedtext \k!text \let\k!text \s!text +% \let\k!saveddefault \k!default \let\k!default \s!default +% \fi +% \advance\@@fontdefhack \plusone } + +% \def\@@endfontdef +% {\advance\@@fontdefhack \minusone +% \ifcase\@@fontdefhack +% \let\k!default \k!saveddefault +% \let\k!text \k!savedtext +% \fi} + +%%%%%%%%%%%%%%%%%%%%%%%% + +% The problem is that the key in a getparameters is resolved +% to the underlying interface language (english). But values +% are kept as they are. However, some of the keys in a font +% definition are used as values later on. +% +% The only place where this happens (for historical reason mostly) +% is in the bodyfont definitions and setup, so we can use a limited +% case. +% +% \let \c!big \v!big : expansion time (user) +% \let \c!small \v!small : expansion time (user) +% \let \c!text \s!text : definition time +% % \c!script \s!script : definition time +% % \c!scriptscript \s!scriptscript : definition time +% % \c!em : definition time +% % \c!interlineskip : definition time +% \let \c!default \s!default : definition time +% \let \k!default \s!default : definition time +% +% Doing the k! definitions local will save us 500 has entries. + +\letvalue{\k!prefix!\v!big }\c!big +\letvalue{\k!prefix!\v!small }\c!small +\letvalue{\k!prefix!\v!text }\s!text +\letvalue{\k!prefix!\v!default}\s!default + +\let\normalc!big \c!big +\let\normalc!small \c!small +\let\normalc!text \c!text % should not happen as we expect text +\let\normalc!default \c!default +\let\normalk!default \k!default + +\newtoks\everybeginfontdef +\newtoks\everyendfontdef + +\appendtoks + \let\c!text \s!text + \let\c!default\s!default +\to \everybeginfontdef + +\appendtoks + \let\c!text \normalc!text + \let\c!default\normalc!default +\to \everyendfontdef + \def\@@beginfontdef {\ifcase\@@fontdefhack - \let\k!savedtext \k!text \let\k!text \s!text - \let\k!k!savedtext \k!k!text \let\k!k!text \!!plusone - \let\k!saveddefault \k!default \let\k!default \s!default - \let\k!k!saveddefault\k!k!default \let\k!k!default \!!plusone + \the\everybeginfontdef \fi - \advance\@@fontdefhack \plusone } + \advance\@@fontdefhack\plusone} \def\@@endfontdef {\advance\@@fontdefhack \minusone \ifcase\@@fontdefhack - \let\k!k!default\k!k!saveddefault - \let\k!default \k!saveddefault - \let\k!k!text \k!k!savedtext - \let\k!text \k!savedtext + \the\everyendfontdef \fi} +%%%%%%%%%%%%%%%%%%%%%%%% + \unexpanded\def\definebodyfontenvironment {\dotripleempty\dodefinebodyfontenvironment} @@ -1360,7 +1488,7 @@ \@@beginfontdef \doifelse{#2}\s!default {\getparameters[\??ft\s!default][#3]} - {\normalizebodyfontsize#2\to\tempbodyfontsize + {\edef\tempbodyfontsize{\thenormalizedbodyfontsize{#2}}% \addtocommalist\tempbodyfontsize\bodyfontenvironmentlist \@EA\dododefinebodyfontenvironment\@EA[\tempbodyfontsize][#1][#3]}% \@@endfontdef @@ -1375,13 +1503,15 @@ \fi} \def\dododefinebodyfontenvironment[#1][#2][#3]% size class settings - {\@@beginfontdef % \s!text goes wrong in testing because the 12pt alternative will called when typesetting the test (or so) + {%\@@beginfontdef % \s!text goes wrong in testing because the 12pt alternative will called when typesetting the test (or so) \ifcsname\??ft#2#1\c!em\endcsname % we test for em as we assume it to be set \else + % speeding this up saves 0.01 sec on a run (tested 20100817) + % but some day we will clean this up anyway \def\docommand##1% {\scratchdimen\csname\??ft\s!default##1\endcsname\dimexpr#1\relax - \normalizebodyfontsize\scratchdimen\to\tempbodyfontsize + \edef\tempbodyfontsize{\thenormalizedbodyfontsize\scratchdimen}% \letvalue{\??ft#2#1##1}\tempbodyfontsize}% \processcommacommand[\fontrelativesizelist]\docommand \copyparameters @@ -1389,20 +1519,20 @@ [\c!interlinespace,\c!em]% \fi \getparameters[\??ft#2#1][#3]% - \@@endfontdef + %\@@endfontdef % new code, see remark - \ifloadingfonts - % only runtime - \else\ifcsname\@size@#1\endcsname - % only once - \else - % prevent loop (hence \empty) - \letvalue{\@size@#1}\empty - \pushmacro\fontclass % new per 26102009 - \edef\fontclass{#2}% % new per 26102009 - \defineunknownfont{#1}% - \popmacro\fontclass % new per 26102009 - \fi\fi + \ifproductionrun + \ifcsname\@size@#1\endcsname + % only once + \else + % prevent loop (hence \empty) + \letvalueempty{\@size@#1}% + \pushmacro\fontclass % new per 26102009 + \edef\fontclass{#2}% % new per 26102009 + \defineunknownfont{#1}% + \popmacro\fontclass % new per 26102009 + \fi + \fi % so far \setvalue{\@size@#1}{\docompletefontswitch[#1]}} @@ -1426,15 +1556,44 @@ %D So, apart from an occasional switch, one should define an %D environment at the outer level. -\def\checkbodyfontenvironment[#1]% - {\definebodyfontenvironment[\fontclass][#1][]} +% \def\checkbodyfontenvironment[#1]% +% {\definebodyfontenvironment[\fontclass][#1][]} +% +% \def\checkbodyfontenvironment[#1]% +% {\ifcsname\??ft\fontclass#1\c!em\endcsname +% % we test for em as we assume it to be set +% \else +% \definebodyfontenvironment[\fontclass][#1][]% +% \fi} +% +% will be adapted with parent chain: \def\checkbodyfontenvironment[#1]% - {\ifcsname\??ft\fontclass#1\c!em\endcsname - % we test for em as we assume it to be set - \else - \definebodyfontenvironment[\fontclass][#1][]% - \fi} + {\ifcsname\??ft #1\c!em\endcsname\else\docheckbodyfontenvironment\empty {#1}\fi + \ifcsname\??ft\fontclass#1\c!em\endcsname\else\docheckbodyfontenvironment\fontclass{#1}\fi} + +\def\docheckbodyfontenvironment#1#2% class size (simplified version of definebodyfontenvironment) + {\@@beginfontdef + \edef\tempbodyfontsize{\thenormalizedbodyfontsize{#2}}% + \addtocommalist\tempbodyfontsize\bodyfontenvironmentlist + \def\docommand##1% text script scriptscript x xx big small + {\setevalue{\??ft#1\tempbodyfontsize##1}% + {\thenormalizedbodyfontsize{\csname\??ft\s!default##1\endcsname\dimexpr\tempbodyfontsize\relax}}}% + \processcommacommand[\fontrelativesizelist]\docommand + \copyparameters % can inherit + [\??ft#1\tempbodyfontsize][\??ft\s!default] + [\c!interlinespace,\c!em]% +% \ifproductionrun + \ifcsname\@size@\tempbodyfontsize\endcsname \else + \letvalueempty{\@size@\tempbodyfontsize}% prevent loop + \pushmacro\fontclass + \edef\fontclass{#1}% + \normalexpanded{\defineunknownfont{\tempbodyfontsize}}% we can also inherit here + \popmacro\fontclass + \fi +% \fi + \setevalue{\@size@#1}{\noexpand\docompletefontswitch[#1]}% + \@@endfontdef} % this one already catches both define/setup @@ -1442,6 +1601,16 @@ %D Just a couple of interface macros: +% todo: +% +% \letvalueempty{\??ft\s!empty} +% +% \def\currentbodyfontvariable#1% +% {\csname\??ft +% \ifcsname\??ft\fontclass#1\endcsname\fontclass#1\else +% \ifcsname\??ft #1\endcsname #1\else \s!empty \fi +% \fi} + \def\bodyfontvariable#1% {\??ft\ifcsname\??ft\fontclass#1\endcsname\fontclass\fi#1} @@ -1580,7 +1749,7 @@ \let\relativefontsize\defaultrelativefontsize} \def\dododefinebodyfont#1#2#3% style defs body - {\checkbodyfontenvironment[#3]% just to be sure. + {\checkbodyfontenvironment[#3]% just to be sure; can probably be omited now \processcommalist[#2]{\dodododefinebodyfont{#1}{#3}}} \def\dodododefinebodyfont#1#2#3% style body def @@ -1616,8 +1785,8 @@ \def\dodefinebodyfontyesxx#1#2[#3#4#5=#6]% style body def {\ifcsname#1#3#4#5\endcsname\else\checkbodyfont{#1}{#3#4}{#5}\fi% not \definefontsize[#5] - \fcglobal\@EA\let\csname*\fontclass#2#1#3#4#5*\endcsname\undefined - \unexpanded\@EA\fcxdef\csname\fontclass#2#1#3#4#5\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#5}{\normalunexpanded{#6}}}} + \global\@EA\let\csname*\fontclass#2#1#3#4#5*\endcsname\undefined + \unexpanded\@EA\xdef\csname\fontclass#2#1#3#4#5\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#5}{\normalunexpanded{#6}}}} \def\dodefinebodyfontnopmm#1#2[#3#4#5=#6]% style body def {\ifcsname#1#3#4#5\endcsname\else\checkbodyfont{#1}{#3#4}{#5}\fi% not \definefontsize[#5] @@ -1630,12 +1799,12 @@ \def\dodefinebodyfontyesmm#1#2[#3#4#5=#6]% style body def {\ifcsname#1#3#4#5\endcsname\else\checkbodyfont{#1}{#3#4}{#5}\fi% not \definefontsize[#5] - \fcglobal\@EA\let\csname*\fontclass#2#1#3#4#51*\endcsname\undefined - \fcglobal\@EA\let\csname*\fontclass#2#1#3#4#52*\endcsname\undefined - \fcglobal\@EA\let\csname*\fontclass#2#1#3#4#53*\endcsname\undefined - \unexpanded\@EA\fcxdef\csname\fontclass#2#1#3#4#51\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#51}{\normalunexpanded{#6}}}% - \unexpanded\@EA\fcxdef\csname\fontclass#2#1#3#4#52\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#52}{\normalunexpanded{#6}}}% - \unexpanded\@EA\fcxdef\csname\fontclass#2#1#3#4#53\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#53}{\normalunexpanded{#6}}}} + \global\@EA\let\csname*\fontclass#2#1#3#4#51*\endcsname\undefined + \global\@EA\let\csname*\fontclass#2#1#3#4#52*\endcsname\undefined + \global\@EA\let\csname*\fontclass#2#1#3#4#53*\endcsname\undefined + \unexpanded\@EA\xdef\csname\fontclass#2#1#3#4#51\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#51}{\normalunexpanded{#6}}}% + \unexpanded\@EA\xdef\csname\fontclass#2#1#3#4#52\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#52}{\normalunexpanded{#6}}}% + \unexpanded\@EA\xdef\csname\fontclass#2#1#3#4#53\endcsname{\noexpand\xxdododefinefont{\number\relativefontsize}{#2}{#2#1#3#4#53}{\normalunexpanded{#6}}}} \def\checkbodyfont#1% tests for ttsl mmbf {\edef\c!!mm{#1}% @@ -1647,24 +1816,49 @@ % some day we can do an auto-fam if needed -\def\checkmathbodyfont#1#2#3% style alt size / gdef % #3 can be empty - {%\message{!m #1 #2 #3!}% - % #1 #2 #3 = signal - %setugvalue {#2}{\setcurrentfontalternative {#2}}% \mr \mb - \setugvalue {#1}{\setcurrentfontstyle {#1}}}% \mm - -\def\checktextbodyfont#1#2#3% style alt size / gdef % #3 can be empty - {%\message{!t #1 #2 #3!}% - \setugvalue {#1#3}{\setcurrentfontstylesize {#1}{#3}}% \rma - \setugvalue {#2#3}{\setcurrentfontalternativesize {#2}{#3}}% \sla - \setugvalue {#1#2#3}{\setcurrentfontstylealternativesize{#1}{#2}{#3}}% \rmsla - \setugvalue {#1}{\setcurrentfontstyle {#1}}% \rm - \setugvalue {#2}{\setcurrentfontalternative {#2}}% \sl - \setugvalue {#1\c!x}{\setcurrentfontxstylealternative {#1}}% \rmx - \setugvalue{#1\c!xx}{\setcurrentfontxxstylealternative {#1}}% \rmxx - \setugvalue {#2\c!x}{\setcurrentfontxalternative {#2}}% \slx - \setugvalue{#2\c!xx}{\setcurrentfontxxalternative {#2}}% \slxx - \setugvalue {#1#2}{\setcurrentfontstylealternative {#1}{#2}}}% \rmsl +% \def\checkmathbodyfont#1#2#3% style alt size / gdef % #3 can be empty (checking needed as \bf is already defined) +% {%\message{!m #1 #2 #3!}% #1 #2 #3 = signal +% %ifcsname #2\endcsname\else\setugvalue {#2}{\setcurrentfontalternative {#2}}\fi % \mr \mb +% \ifcsname #1\endcsname\else\setugvalue {#1}{\setcurrentfontstyle {#1}}\fi} % \mm + +% \def\checktextbodyfont#1#2#3% style alt size / gdef % #3 can be empty (checking needed as \bf is already defined) +% {%\message{!t #1 #2 #3!}% +% \ifcsname #1#3\endcsname\else\setugvalue {#1#3}{\setcurrentfontstylesize {#1}{#3}}\fi % \rma +% \ifcsname #2#3\endcsname\else\setugvalue {#2#3}{\setcurrentfontalternativesize {#2}{#3}}\fi % \sla +% \ifcsname #1#2#3\endcsname\else\setugvalue {#1#2#3}{\setcurrentfontstylealternativesize{#1}{#2}{#3}}\fi % \rmsla +% \ifcsname #1\endcsname\else\setugvalue {#1}{\setcurrentfontstyle {#1}}\fi % \rm +% \ifcsname #2\endcsname\else\setugvalue {#2}{\setcurrentfontalternative {#2}}\fi % \sl +% \ifcsname #1\c!x\endcsname\else\setugvalue {#1\c!x}{\setcurrentfontxstylealternative {#1}}\fi % \rmx +% \ifcsname#1\c!xx\endcsname\else\setugvalue{#1\c!xx}{\setcurrentfontxxstylealternative {#1}}\fi % \rmxx +% \ifcsname #2\c!x\endcsname\else\setugvalue {#2\c!x}{\setcurrentfontxalternative {#2}}\fi % \slx +% \ifcsname#2\c!xx\endcsname\else\setugvalue{#2\c!xx}{\setcurrentfontxxalternative {#2}}\fi % \slxx +% \ifcsname #1#2\endcsname\else\setugvalue {#1#2}{\setcurrentfontstylealternative {#1}{#2}}\fi} % \rmsl + +\def\checkmathbodyfont#1#2#3% style alt size / gdef % #3 can be empty (checking needed as \bf is already defined) + {%\message{!m #1 #2 #3!}% #1 #2 #3 = signal + %setugvalue {#2}{\setcurrentfontalternative {#2}}% % \mr \mb + \setugvalue {#1}{\setcurrentfontstyle {#1}}} % \mm + +\def\checktextbodyfont#1#2#3% style alt size / gdef % #3 can be empty (checking needed as \bf is already defined) + {%\message{!t #1 #2 #3!}% % beware, some can be defined already + \setugvalue {#1#3}{\setcurrentfontstylesize {#1}{#3}}% % \rma + \setugvalue {#2#3}{\setcurrentfontalternativesize {#2}{#3}}% % \sla + \setugvalue {#1#2#3}{\setcurrentfontstylealternativesize{#1}{#2}{#3}}% % \rmsla + \ifcsname\s!normal#1\endcsname % text/math check + \expandafter\let\csname#1\expandafter\endcsname\csname\s!normal#1\endcsname + \else + \setugvalue {#1}{\setcurrentfontstyle {#1}}% % \rm + \fi + \ifcsname\s!normal#2\endcsname % text/math check + \expandafter\let\csname#2\expandafter\endcsname\csname\s!normal#2\endcsname + \else + \setugvalue {#2}{\setcurrentfontalternative {#2}}% % \sl + \fi + \setugvalue {#1\c!x}{\setcurrentfontxstylealternative {#1}}% % \rmx + \setugvalue{#1\c!xx}{\setcurrentfontxxstylealternative {#1}}% % \rmxx + \setugvalue {#2\c!x}{\setcurrentfontxalternative {#2}}% % \slx + \setugvalue{#2\c!xx}{\setcurrentfontxxalternative {#2}}% % \slxx + \setugvalue {#1#2}{\setcurrentfontstylealternative {#1}{#2}}} % \rmsl \def\dodefinedefaultbodyfont[#1][#2][#3]% sizes styles identifier {\def\dododefinedefaultbodyfont##1% @@ -1688,7 +1882,7 @@ \def\dodefineunknownfont#1#2% {\ifcsname\??ft\s!default#2\endcsname \donetrue - \normalizebodyfontsize\csname\??ft\s!default#2\endcsname\dimexpr#1\relax\to\tempbodyfontsize + \edef\tempbodyfontsize{\thenormalizedbodyfontsize{\csname\??ft\s!default#2\endcsname\dimexpr#1\relax}}% \letvalue{\??ft#1#2}\tempbodyfontsize \fi} @@ -1705,9 +1899,10 @@ \defineunknownfont{\csname\??ft#1#2\endcsname}% \fi} +\let\c!savedtext\c!text + \unexpanded\def\defineunknownfont#1% - {\let\c!savedtext\c!text - \let\c!text\s!text + {\let\c!text\s!text \donefalse \processcommacommand[\fontrelativesizelist]{\dodefineunknownfont{#1}}% \let\c!text\c!savedtext @@ -1791,7 +1986,7 @@ %D often not the way users specify the bodyfont size. Therefore %D we also store the normalized value. -\chardef\fontdigits=2 % was 1 +\setnewconstant\fontdigits\plustwo % was 1 % \def\normalizebodyfontsize#1\to#2% % {\@EA\@EA\@EA\donormalizedbodyfontsize\@EA\WITHOUTPT\the\dimexpr#1+\ifcase\fontdigits.5\or.05\or.005\fi\points\relax000\to#2} @@ -1807,14 +2002,14 @@ % \s!pt}} \def\normalizebodyfontsize#1\to#2% - {\edef#2{\ctxlua{fonts.nbfs(\number\dimexpr#1\relax,\number\fontdigits)}}} + {\edef#2{\ctxcommand{nbfs(\number\dimexpr#1\relax,\number\fontdigits)}}} \def\thenormalizedbodyfontsize#1% - {\ctxlua{fonts.nbfs(\number\dimexpr#1\relax,\number\fontdigits)}} + {\ctxcommand{nbfs(\number\dimexpr#1\relax,\number\fontdigits)}} -\normalizebodyfontsize\bodyfontsize\to\normalizedglobalbodyfontsize -\normalizebodyfontsize\bodyfontsize\to\normalizedlocalbodyfontsize -\normalizebodyfontsize\bodyfontsize\to\normalizedbodyfontsize +\edef\normalizedglobalbodyfontsize{\thenormalizedbodyfontsize\bodyfontsize} +\edef\normalizedlocalbodyfontsize {\thenormalizedbodyfontsize\bodyfontsize} +\edef\normalizedbodyfontsize {\thenormalizedbodyfontsize\bodyfontsize} %D \macros %D {fontstyle,fontalternative,fontsize} @@ -1850,7 +2045,7 @@ \def\doswitchpoints[#1]% {\normalexpanded{\dodoswitchpoints{#1}}} -\unexpanded \def\dodoswitchpoints#1% +\unexpanded\def\dodoswitchpoints#1% {\ifcsname\@size@#1\endcsname \else \defineunknownfont{#1}% \fi% @@ -1858,14 +2053,14 @@ \ifcsname\@size@#1\endcsname \csname\@size@#1\endcsname \localbodyfontsize#1\relax - \normalizebodyfontsize\localbodyfontsize\to\normalizedbodyfontsize % \edef\fontbody{\fontbody}% to be tested but we can clean up mkiv further + \edef\normalizedbodyfontsize{\thenormalizedbodyfontsize\localbodyfontsize}% \checkbodyfontenvironment[\normalizedbodyfontsize]% \else \showmessage\m!fonts4{#1}% \fi} -\unexpanded \def\doswitchstyle[#1]% +\unexpanded\def\doswitchstyle[#1]% {\ifcsname\@style@#1\endcsname \csname\@style@#1\endcsname \edef\fontstyle{#1}% @@ -1914,11 +2109,8 @@ %D we start typesetting. %D %D Therefore we have to signal the font switching macros that -%D we are preloading fonts. As long as the next boolean is, -%D true, no loading is done. - -\newif\ifloadingfonts \loadingfontstrue - +%D we are preloading fonts. +%D %D \macros %D {preloadfonts} %D @@ -1926,29 +2118,115 @@ %D sequence of a session. After the loading job is done, the %D macro relaxes itself and reset the signal. -% \appendtoks -% \to \everysetupdocument +% \fontdimen1\nullfont 0\scaledpoint +% \fontdimen2\nullfont 256377\scaledpoint +% \fontdimen3\nullfont 128188\scaledpoint +% \fontdimen4\nullfont 85459\scaledpoint +% \fontdimen5\nullfont 338952\scaledpoint +% \fontdimen6\nullfont 786432\scaledpoint +% \fontdimen7\nullfont 85459\scaledpoint + +\fontslantperpoint \nullfont 0\scaledpoint +\fontinterwordspace \nullfont 256377\scaledpoint +\fontinterwordstretch\nullfont 128188\scaledpoint +\fontinterwordshrink \nullfont 85459\scaledpoint +\fontexheight \nullfont 338952\scaledpoint +\fontemwidth \nullfont 786432\scaledpoint +\fontextraspace \nullfont 85459\scaledpoint + +\fetchruntimecommand \showfontparameters {\f!fontprefix\s!run} + +\def\resetnullfont % this is needed because some macro packages (tikz) misuse \nullfont + {\dorecurse7{\fontdimen\recurselevel\nullfont\zeropoint}% + \ctxlua{fonts.definers.resetnullfont()}% in luatex 0.70 this will also do the previous + \globallet\resetnullfont\relax} + +\def\preloaddefaultfonts + {\resetpreloadfonts + \setupbodyfont[modern,\fontstyle,\fontbody]% + \showmessage\m!fonts6{fallback modern \fontstyle\normalspace\normalizedbodyfontsize}} + +\def\preloaddefaultfontsmm + {\writestatus\m!fonts{preloading latin modern fonts (math)}% + \definetypeface[\fontclass][\c!mm][\s!math][modern][\s!default]% + \showmessage\m!fonts6{fallback modern mm \normalizedbodyfontsize}} + +\def\preloaddefaultfontstt + {\writestatus\m!fonts{preloading latin modern fonts (mono)}% + \definetypeface[\fontclass][\c!tt][\s!mono][modern][\s!default]% + \showmessage\m!fonts6{fallback modern tt \normalizedbodyfontsize}} + +\def\resetpreloadfonts + {\glet\preloaddefaultfonts \relax + %\glet\preloaddefaultfontstt \relax + %\glet\preloaddefaultfontsmm \relax + \glet\zerostagepreloadfonts \relax + \glet\firststagepreloadfonts \relax + \glet\secondstagepreloadfonts\relax + %\glet\thirdstagepreloadfonts \relax + \glet\fourthstagepreloadfonts\relax + \global\everyhbox\emptytoks + \global\everyvbox\emptytoks + \resetnullfont} + +\def\resetcheckedfonts + {\glet\preloaddefaultfontstt \relax + \glet\preloaddefaultfontsmm \relax + \glet\thirdstagepreloadfonts \relax} + +\def\dozerostagepreloadfonts + {\definedfont[\s!file:lmmono10-regular sa 1]} + +\def\zerostagepreloadfonts + {\writestatus\m!fonts{beware: no fonts are loaded yet, using 'lm mono' in box}% + \glet\zerostagepreloadfonts\dozerostagepreloadfonts + \zerostagepreloadfonts} -\newconditional\fontsareloaded +\appendtoks + \everyhbox{\zerostagepreloadfonts} + \everyvbox{\zerostagepreloadfonts} +\to \everydump -\def\preloadfonts % never called, needs a clean up - {\global\loadingfontsfalse - \ifconditional\fontsareloaded \else - \doifmodeelse {*nofonts} - {\writestatus\m!fonts{latin modern fonts are not preloaded}} - {\writestatus\m!fonts{preloading latin modern fonts}% - \usetypescript[modern]% - \setuptypeface[modern]% - \showmessage\m!fonts6{\normalizedbodyfontsize\normalspace\fontstyle}}% - \fi - \global\let\preloadfonts\relax} +\def\firststagepreloadfonts % see core-def.mkiv + {\doifmodeelse{*nofonts} + {\writestatus\m!fonts{latin modern fonts are not preloaded}} + {\preloaddefaultfonts + \writestatus\m!fonts{preloading latin modern fonts (first stage)}}} -% maybe add this to \everystarttext -% -% \ifconditional\fontsareloaded\else -% \usetypescript[modern]% -% \setuptypeface[modern]% -% \fi +\def\secondstagepreloadfonts % see core-def.mkiv + {\writestatus\m!fonts{preloading latin modern fonts (second stage)}% + \preloaddefaultfonts} + +\def\thirdstagepreloadfonts % always + {\ifx\fontclass\empty + \writestatus\m!fonts{preloading latin modern fonts (third stage)}% + \preloaddefaultfonts + \else + \resetpreloadfonts + \pushmacro\fontstyle + \ifcsname\fontclass\c!mm\s!features\endcsname \else + \preloaddefaultfontsmm + \fi + \ifcsname\fontclass\c!tt\s!features\endcsname \else + \preloaddefaultfontstt + \fi + \popmacro\fontstyle + \resetcheckedfonts % reset third, mm and tt + \setupbodyfont[\fontstyle]% + \fi} + +\def\fourthstagepreloadfonts + {\begingroup + %ifzeropt\fontcharwd\font\number`!\relax + \setbox\scratchbox\hbox{context}% + \ifzeropt\wd\scratchbox + \writeline + \writestatus\m!fonts{!! No bodyfont has been defined and no defaults have been}% + \writestatus\m!fonts{!! loaded (maybe due to a missing \string\starttext).}% + \writeline + \fi + \resetpreloadfonts + \endgroup} %D Here comes the main font switching macros. These macros %D handle changes in size as well as returning to the global @@ -1957,25 +2235,24 @@ \def\dosetfont#1#2% #1 = set/switch state {\doifelse{#2}\v!global {\restoreglobalbodyfont} - {\processcommacommand[#2]{\dodosetfont{#1}}% ##1 get also passed - \ifloadingfonts\else - \global\settrue\fontsareloaded + {\processcommacommand[#2]{\dodocheckfontsize}% + \processcommacommand[#2]{\dodosetfont{#1}}% + \ifproductionrun + \thirdstagepreloadfonts \doswitchpoints[\normalizedbodyfontsize]% \doswitchstyle[\fontstyle]% \ifx\defaultfontclass\empty \let\defaultfontclass\fontclass \fi \fi}% - \chardef\currentxfontsize\zerocount} + \currentxfontsize\zerocount} + +\def\dodocheckfontsize#1% + {\doifnumberelse{#1}{\checkbodyfontenvironment[#1]}\donothing} \def\dodosetfont#1#2% #1 = set/switch state | check fo rempty, else space {\doifsomething{#2}{\dododosetfont{#1}{#2}{\showmessage\m!fonts4{#2}}}} -% % % this can be retrofitted in mkii code % % % - -% \def\normalizebodyfontsize#1\to#2% -% {\@EA\@EA\@EA\donormalizedbodyfontsize\@EA\WITHOUTPT\the\dimexpr#1+\ifcase\fontdigits.5\or.05\or.005\fi\points\relax000\to#2} - \def\dododosetfont#1#2#3% #1 = set/switch state ! ! ! !could also be used for mkii {\doifnumberelse{#2}\dodododosetfont\redododosetfont{#1}{#2}{#3}} @@ -2009,7 +2286,7 @@ \fi\fi} \def\dodododosetfont#1#2#3% #1 = set/switch state - {\normalizebodyfontsize#2\to\normalizedsetfont + {\edef\normalizedsetfont{\thenormalizedbodyfontsize{#2}}% \ifcsname\@size@\normalizedsetfont\endcsname \else \defineunknownfont{#2}% \fi @@ -2020,14 +2297,6 @@ #3\dosetsubstitutefont{#1}{#2}% \fi} -% % % - -%D In the previous macros we use \type{\currentxfontsize} to -%D hold the current x||size of the font. This enables us to -%D support for instance \type{\sl} inside a \type{\tx} switch. - -\chardef\currentxfontsize=0 - %D When users specify for instance a 13 point bodyfont while no %D such bodyfont is defined, the system automatically tries to %D find a best fit, that is the nearest smaller defined @@ -2076,25 +2345,14 @@ \trycurrentfontclass{#1}% \fi\fi\fi} -\def\savefontclassparameters#1#2#3#4% #1=rm|ss|.. rscale features fallbacks +\def\savefontclassparameters#1#2#3#4#5% #1=rm|ss|.. rscale features fallbacks goodies {\setxvalue{\fontclass#1\s!rscale }{#2}% \setxvalue{\fontclass#1\s!features }{#3}% - \setxvalue{\fontclass#1\s!fallbacks}{#4}} + \setxvalue{\fontclass#1\s!fallbacks}{#4}% + \setxvalue{\fontclass#1\s!goodies }{#5}} \settrue\autotypescripts -% \def\trycurrentfontclass#1% -% {\ifconditional\autotypescripts -% \usetypescript[#1]% -% \ifcsname\@fontclass@#1\endcsname -% \edef\fontclass{#1}% -% \else -% \letvalue{\@no@fontclass@#1}\empty -% \fi -% \else -% \letvalue{\@no@fontclass@#1}\empty -% \fi} - \def\trycurrentfontclass#1% {\ifconditional\autotypescripts % try to load typescript #1 @@ -2110,12 +2368,12 @@ \edef\fontclass{#1}% \else % todo: message - \letvalue{\@no@fontclass@#1}\empty + \letvalueempty{\@no@fontclass@#1}% \fi \fi \else % todo: message - \letvalue{\@no@fontclass@#1}\empty + \letvalueempty{\@no@fontclass@#1}% \fi} \let\defaultfontstyle \c!rm @@ -2131,7 +2389,7 @@ % 0=never 1=everymath 2=always -\chardef\synchronizebigmathflag=1 +\setnewconstant\synchronizebigmathflag\plusone \appendtoks \ifcase\synchronizebigmathflag @@ -2143,9 +2401,9 @@ \fi \to \everymathematics -\def\nobigmath {\chardef\synchronizebigmathflag\zerocount} -\def\autobigmath{\chardef\synchronizebigmathflag\plusone\synchronizebigmath} -\def\bigmath {\chardef\synchronizebigmathflag\plustwo\synchronizebigmath} +\def\nobigmath {\synchronizebigmathflag\zerocount} +\def\autobigmath{\synchronizebigmathflag\plusone\synchronizebigmath} +\def\bigmath {\synchronizebigmathflag\plustwo\synchronizebigmath} \let\bigmathfontsize\empty @@ -2386,7 +2644,7 @@ %D used. Here we also set \type{\currentxfontsize}. \def\dosetcurrentfontxxxalternative#1#2#3#4% - {\chardef\currentxfontsize#2\relax + {\currentxfontsize#2\relax \ifmmode #4% \else\ifcsname\bodyfontvariable{\normalizedbodyfontsize#3}\endcsname @@ -2404,7 +2662,7 @@ \def\checknestedxfontsize % option {\ifcase\currentxfontsize\else\ifx\fontsize\empty\else - \chardef\currentxfontsize\zeropoint + \currentxfontsize\zerocount \let\fontsize\empty \let\tx\normaltx \let\txx\normaltxx @@ -2506,7 +2764,7 @@ {\bodyfontsize#1\relax \dimensiontocount\bodyfontsize\bodyfontpoints % rounded, still used in m-chart \edef\bodyfontfactor{\withoutpt\the\bodyfontsize}% - \normalizebodyfontsize\bodyfontsize\to\normalizedbodyfontsize + \edef\normalizedbodyfontsize{\thenormalizedbodyfontsize\bodyfontsize}% \dosetbodyfontface \textface \s!text \dosetbodyfontface \scriptface \s!script \dosetbodyfontface \scriptscriptface \s!scriptscript} @@ -2545,8 +2803,6 @@ % \newtoks \everysetupbodyfont % \newtoks \everyswitchtobodyfont -\chardef\bodyfontsetstate=0 - \definecomplexorsimple\setupbodyfont \def\simplesetupbodyfont @@ -2557,9 +2813,9 @@ {\doifsomething{#1} {\dosetfont1{#1}% \globalbodyfontsize\localbodyfontsize - \normalizebodyfontsize\globalbodyfontsize\to\normalizedglobalbodyfontsize + \edef\normalizedglobalbodyfontsize{\thenormalizedbodyfontsize\globalbodyfontsize}% \let\globalfontstyle\fontstyle - \ifloadingfonts\else + \ifproductionrun \the\everybodyfont \the\everyglobalbodyfont \saveinterlinespace @@ -2602,10 +2858,6 @@ % \installfontfeature[otf][tlig] % \installfontfeature[otf][trep] -%D tricky but ok: - -\appendtoks\ctxlua{fonts.tfm.cleanup()}\to\everyshipout - %D Todo: % \def\os{\groupedcommand{\setfontfeature{oldstyle}}{}} @@ -2617,52 +2869,94 @@ \def\dodefinefontfeature[#1][#2][#3]% {\global\expandafter\chardef\csname\??fq=#1\endcsname % beware () needed as we get two values returned - \ctxlua{tex.write((fonts.define.specify.preset_context("#1","#2","#3")))}\relax} + \ctxsprint{((fonts.specifiers.presetcontext("#1","#2","#3")))}\relax} + +\definefontfeature % experiment, this might move to the lua code + [always] + [mode=auto, + kern=yes, + mark=yes, + mkmk=yes, + curs=yes] \definefontfeature [default] - [%mode=node, - liga=yes,kern=yes,tlig=yes,trep=yes] % texligatures=yes,texquotes=yes + [always] + [liga=yes, + tlig=yes, + trep=yes] % texligatures=yes,texquotes=yes \definefontfeature [smallcaps] - [%mode=node,liga=yes, - smcp=yes,kern=yes,tlig=yes,trep=yes] % texligatures=yes,texquotes=yes + [always] + [smcp=yes, + tlig=yes, + trep=yes] % texligatures=yes,texquotes=yes \definefontfeature [oldstyle] - [%mode=node, - onum=yes,liga=yes,kern=yes,tlig=yes,trep=yes] % texligatures=yes,texquotes=yes + [always] + [onum=yes, + liga=yes, + tlig=yes, + trep=yes] % texligatures=yes,texquotes=yes \definefontfeature % == default unless redefined [ligatures] - [%mode=node, - liga=yes,kern=yes,tlig=yes,trep=yes] + [always] + [liga=yes, + tlig=yes, + trep=yes] \definefontfeature % can be used for type1 fonts [complete] - [liga=yes,kern=yes,compose=yes,tlig=yes,trep=yes] + [always] + [compose=yes, + liga=yes, + tlig=yes, + trep=yes] \definefontfeature + [none] + [mode=none, + features=no] + +\definefontfeature % might move [arabic] [mode=node,language=dflt,script=arab,ccmp=yes, init=yes,medi=yes,fina=yes,isol=yes, liga=yes,dlig=yes,rlig=yes,clig=yes,calt=yes, mark=yes,mkmk=yes,kern=yes,curs=yes] -\definefontfeature - [none] - [mode=none,features=no] +\definefontfeature % might move + [simplearabic] + [mode=node,language=dflt,script=arab, + init=yes,medi=yes,fina=yes,calt=yes, + rlig=yes,curs=yes,mark=yes,mkmk=yes] + +% symbols: \definefontfeature - [virtualmath] - [mode=base,liga=yes,kern=yes,tlig=yes,trep=yes] + [dingbats] + [mode=base, + goodies=dingbats, + unicoding=yes] -% for the moment here, this will change but we need it for mk.tex +% math: -\definefontfeature[math-text] [virtualmath][ssty=no] -\definefontfeature[math-script] [virtualmath][ssty=1,mathsize=yes] -\definefontfeature[math-scriptscript][virtualmath][ssty=2,mathsize=yes] +\definefontfeature + [virtualmath] + [mode=base, + liga=yes, + kern=yes, + tlig=yes, + trep=yes, + language=dflt, + script=math] + +\definefontfeature[math-text] [virtualmath][mathalternates=yes,ssty=no] +\definefontfeature[math-script] [virtualmath][mathalternates=yes,ssty=1,mathsize=yes] +\definefontfeature[math-scriptscript][virtualmath][mathalternates=yes,ssty=2,mathsize=yes] \definefontfeature [math-nostack-text] [math-text] [nostackmath=yes] \definefontfeature [math-nostack-script] [math-script] [nostackmath=yes] @@ -2674,13 +2968,21 @@ %D Also new, handy for manuals: -\unexpanded\def\fontchar#1{\ctxlua{fonts.char("#1")}} - -\let\otfchar\fontchar % will disappear, for compatibility only -\let\afmchar\fontchar % will disappear, for compatibility only +\unexpanded\def\fontchar#1{\ctxcommand{fontchar("#1")}} %D: We cannot yet inherit because no colors are predefined. +\definecolor[trace:0][s=.6] +\definecolor[trace:1][r=.6] +\definecolor[trace:2][g=.6] +\definecolor[trace:3][b=.6] +\definecolor[trace:4][r=.6,g=.6] +\definecolor[trace:5][r=.6,b=.6] +\definecolor[trace:6][g=.6,b=.6] +\definecolor[trace:7][r=.8,g=.4] +\definecolor[trace:8][r=.8,b=.4] +\definecolor[trace:9][g=.4,b=.8] + \definecolor[font:init][r=.75] \definecolor[font:medi][g=.75] \definecolor[font:fina][b=.75] @@ -2702,7 +3004,7 @@ {\dodoubleargument\dofontfeatureslist} \def\dofontfeatureslist[#1][#2]% todo: arg voor type - {\ctxlua{tex.sprint(tex.ctxcatcodes,fonts.define.specify.context_tostring("#1","otf","\luaescapestring{#2}","yes","no",true,{"number"}))}} + {\ctxsprint{fonts.specifiers.contexttostring("#1","otf","\luaescapestring{#2}","yes","no",true,{"number"})}} \attribute\zerocount\zerocount % first in list, so fast match @@ -2723,14 +3025,24 @@ % % \typebuffer \getbuffer -\def\featureattribute#1{\ctxlua{tex.sprint(fonts.define.specify.context_number("#1"))}} -\def\setfontfeature #1{\edef\currentfeature{#1}\attribute\zerocount\featureattribute{#1}\relax} -\def\resetfontfeature#1{\let\currentfeature\empty\attribute\zerocount\zerocount} % initial value +% \unexpanded\def\featureattribute#1{\ctxsprint{fonts.specifiers.contextnumber("#1"))}} +% \unexpanded\def\setfontfeature #1{\edef\currentfeature{#1}\attribute\zerocount\featureattribute{#1}\relax} +% \unexpanded\def\resetfontfeature#1{\let\currentfeature\empty\attribute\zerocount\zerocount} % initial value -\def\addfontfeaturetoset #1{\ctxlua{fonts.withset("#1", 1)}} % merge -\def\subtractfontfeaturefromset #1{\ctxlua{fonts.withset("#1",-1)}} % merge -\def\addfontfeaturetofont #1{\ctxlua{fonts.withfnt("#1", 2)}} % overload -\def\subtractfontfeaturefromfont#1{\ctxlua{fonts.withfnt("#1",-2)}} % overload +% \def\addfontfeaturetoset #1{\ctxlua{fonts.withset("#1", 1)}} % merge +% \def\subtractfontfeaturefromset #1{\ctxlua{fonts.withset("#1",-1)}} % merge +% \def\addfontfeaturetofont #1{\ctxlua{fonts.withfnt("#1", 2)}} % overload +% \def\subtractfontfeaturefromfont#1{\ctxlua{fonts.withfnt("#1",-2)}} % overload + +\unexpanded\def\featureattribute#1{\ctxcommand{featureattribute("#1")}} +\unexpanded\def\setfontfeature #1{\ctxcommand{setfontfeature("#1")}\edef\currentfeature{#1}} +\unexpanded\def\resetfontfeature#1{\ctxcommand{resetfontfeature()}\let\currentfeature\empty} % initial value +\unexpanded\def\resetfontfeature#1{\attribute\zerocount\zerocount\let\currentfeature\empty} % initial value + +\unexpanded\def\addfontfeaturetoset #1{\ctxcommand{addfs("#1")}} % merge +\unexpanded\def\subtractfontfeaturefromset #1{\ctxcommand{subfs("#1")}} % merge +\unexpanded\def\addfontfeaturetofont #1{\ctxcommand{addff("#1")}} % overload +\unexpanded\def\subtractfontfeaturefromfont#1{\ctxcommand{subff("#1")}} % overload \let\setff\setfontfeature \let\addfs\addfontfeaturetoset @@ -2842,7 +3154,7 @@ \def\fullrestoreglobalbodyfont {\let\fontsize\defaultfontsize \let\fontbody\defaultfontbody - \chardef\currentxfontsize\zerocount + \currentxfontsize\zerocount \let\fontclass\globalfontclass \doswitchpoints[\normalizedglobalbodyfontsize]% \doswitchstyle[\globalfontstyle]% @@ -2855,7 +3167,7 @@ \def\partialrestoreglobalbodyfont {\let\fontsize\defaultfontsize \let\fontbody\defaultfontbody - \chardef\currentxfontsize\zerocount + \currentxfontsize\zerocount \redoconvertfont \tf \the\everybodyfont % indeed needed @@ -2939,17 +3251,44 @@ %D text and headings, which is accomplished by assigning both %D arguments. +% \def\dodefinealternativestyle[#1][#2][#3]% +% {\def\docommand##1% +% {\ifcsname##1\endcsname\else\setuvalue{##1}{\groupedcommand{#2}{}}\fi +% \setvalue{\@letter@ ##1}{#2}% +% \setvalue{\@noletter@##1}{#3}}% +% \processcommalist[#1]\docommand} + +\setnewconstant \currentalternativestyleindex \plusone + +\def\dododefinealternativestyle#1#2#3% + {\ifcsname#3\endcsname + % no redefinition + \else + \setuvalue{#3}{\groupedcommand{#1}{}}% + \fi + \setvalue{\??ft:as:#3}{\doapplyalternativestyle{#1}{#2}}}% + \def\dodefinealternativestyle[#1][#2][#3]% - {\def\docommand##1% - {\ifcsname##1\endcsname\else\setuvalue{##1}{\groupedcommand{#2}{}}\fi - \setvalue{\@letter@ ##1}{#2}% - \setvalue{\@noletter@##1}{#3}}% - \processcommalist[#1]\docommand} + {\processcommalist[#1]{\dododefinealternativestyle{#2}{#3}}} % also gets {##1} + +\def\applyalternativestyle#1% + {\ifcsname\??ft:as:#1\endcsname\csname\??ft:as:#1\expandafter\endcsname\fi} + +\def\doapplyalternativestyle + {\ifcase\currentalternativestyleindex + \expandafter\gobbletwoarguments + \or + \expandafter\firstoftwoarguments + \or + \expandafter\secondoftwoarguments + \else + \expandafter\firstoftwoarguments + \fi} \unexpanded\def\definealternativestyle {\dotripleempty\dodefinealternativestyle} -\unexpanded\def\definestyle{\definealternativestyle} +\unexpanded\def\definestyle{\definealternativestyle} % later redefined %D Maybe too geneneric, but probably ok is the following. (Maybe one %D day we will use a dedicated grouped command for styles.) @@ -3005,51 +3344,74 @@ %D conversion by saying \type{\redoconvertfont}. % subtle ... \expandafter is needed else problems with lookahead caps - -\def\@@dodoconvertfont{\csname\@letter@ \p!defined\expandafter\endcsname\gobbleoneargument} -\def\@@donoconvertfont{\csname\@noletter@\p!defined\endcsname} -\def\@@redoconvertfont{\csname \p!defined\expandafter\endcsname\gobbleoneargument} - +% +% this will be cleaned up +% % beware: p!defined can contain crap like \edef crap {...} and such -% so we need to pass #1 as well - -\unexpanded\def\dodoconvertfont#1% #2% we need the protection - {\edef\p!defined{#1}% - \ifx\p!defined\empty\else - \@EA\dododoconvertfont - \fi{#1}} - -\def\dododoconvertfont % #1 - {\ifcsname\@letter@\detokenize\@EA{\p!defined}\endcsname - \@EA\@@dodoconvertfont - \else\ifcsname\detokenize\@EA{\p!defined}\endcsname - \@EAEAEA\@@redoconvertfont - \else - \@EAEAEA\firstofoneargument - \fi\fi} % {#1} +% so we need to pass #1 as well .. no longer needed in luatex -\let\doconvertfont\dodoconvertfont +% \def\@@dodoconvertfont{\csname\@letter@ \p!defined\expandafter\endcsname\gobbleoneargument} +% \def\@@donoconvertfont{\csname\@noletter@\p!defined\endcsname} +% \def\@@redoconvertfont{\csname \p!defined\expandafter\endcsname\gobbleoneargument} +% +% \unexpanded\def\dodoconvertfont#1% #2% we need the protection +% {\edef\p!defined{#1}% +% \ifx\p!defined\empty\else +% \@EA\dododoconvertfont +% \fi{#1}} +% +% \def\dododoconvertfont % #1 (detokenize no longer needed in luatex) +% {\ifcsname\@letter@\detokenize\@EA{\p!defined}\endcsname +% \@EA\@@dodoconvertfont +% \else\ifcsname\detokenize\@EA{\p!defined}\endcsname +% \@EAEAEA\@@redoconvertfont +% \else +% \@EAEAEA\firstofoneargument +% \fi\fi} % {#1} +% +% \let\doconvertfont\dodoconvertfont +% +% \unexpanded\def\noconvertfont#1% #2% +% {\edef\p!defined{#1}% +% \ifx\p!defined\empty +% \else +% \@EA\nononoconvertfont +% \fi} +% +% \def\nononoconvertfont +% {\ifcsname\@noletter@\detokenize\@EA{\p!defined}\endcsname +% \@EA\@@donoconvertfont +% \fi} +% +% %D Extras: +% +% \unexpanded\def\dontconvertfont{\let\doconvertfont\noconvertfont} +% \unexpanded\def\redoconvertfont{\let\doconvertfont\dodoconvertfont} -\unexpanded\def\noconvertfont#1% #2% - {\edef\p!defined{#1}% - \ifx\p!defined\empty - \else - \@EA\nononoconvertfont - \fi} +%D These commands are not grouped! Grouping is most probably +%D done by the calling macro's and would lead to unnecessary +%D overhead. -\def\nononoconvertfont - {\ifcsname\@noletter@\detokenize\@EA{\p!defined}\endcsname - \@EA\@@donoconvertfont +\unexpanded\def\doconvertfont#1% #2% we need the protection + {\edef\currentconvertfont{#1}% + \ifx\currentconvertfont\empty \else + \@EA\dodoconvertfont \fi} -%D Extras: +\def\dodoconvertfont + {\edef\dtcurrentconvertfont{\detokenize\@EA{\currentconvertfont}}% + \ifcsname\??ft:as:\dtcurrentconvertfont\endcsname + \csname\??ft:as:\dtcurrentconvertfont\expandafter\endcsname + \else\ifcsname\dtcurrentconvertfont\endcsname + \csname\dtcurrentconvertfont\expandafter\endcsname + \else + \@EAEAEA\currentconvertfont + \fi\fi} -\unexpanded\def\dontconvertfont{\let\doconvertfont\noconvertfont} -\unexpanded\def\redoconvertfont{\let\doconvertfont\dodoconvertfont} +%D Low level switches (downward compatible): -%D These commands are not grouped! Grouping is most probably -%D done by the calling macro's and would lead to unnecessary -%D overhead. +\unexpanded\def\dontconvertfont{\currentalternativestyleindex\plustwo} +\unexpanded\def\redoconvertfont{\currentalternativestyleindex\plusone} %D \macros %D {em,emphasistypeface,emphasisboldface} @@ -3093,12 +3455,38 @@ \getvalue\emphasizedtypeface \fi\fi\fi} -\def\emphasistypeface{\doemphasistypeface\sl\it} -\def\emphasisboldface{\doemphasistypeface\bs\bi} +\unexpanded\def\emphasistypeface{\doemphasistypeface\sl\it} +\unexpanded\def\emphasisboldface{\doemphasistypeface\bs\bi} + +\unexpanded\def\normalboldface + {\relax\ifx\fontalternative\c!it \bi + \else \ifx\fontalternative\c!sl \bs + \else \bf \fi\fi} + +\unexpanded\def\normaltypeface + {\relax + \ifx\fontalternative\c!bi \it \else + \ifx\fontalternative\c!bs \sl \else + \tf \fi\fi} + +\unexpanded\def\swaptypeface + {\relax + \ifx\fontalternative\c!it \tf \else + \ifx\fontalternative\c!sl \tf \else + \ifx\fontalternative\c!bf \emphasisboldface \else + \ifx\fontalternative\c!bs \bf \else + \ifx\fontalternative\c!bi \bf \else + \emphasistypeface \fi\fi\fi\fi\fi} + +\let\typeface\normaltypeface +\let\boldface\normalboldface +\let\swapface\swaptypeface %D To be set with the default body font environment: \type %D {em} being \type {slanted} or \type {italic}. +% maybe a \csname...\fontalternative\endcsname + \newconditional\emneeded \newtoks\everyemphasized @@ -3125,8 +3513,7 @@ \emphasistypeface \fi\fi\fi\fi\fi \the\everyemphasized - \ifconditional\emneeded\relax - \else + \ifconditional\emneeded\else \expandafter\aftergroup \fi \emphasiscorrection} @@ -3137,7 +3524,7 @@ % \setupbodyfontenvironment [default] [em={\italic\color[red]}] %D The next feature was not present in previous versions. It -%D takes care of \type {\em \bf ...} sitiations. +%D takes care of \type {\em \bf ...} situations. \def\setemphasisboldface {\let\savedemphasisboldface\bf @@ -3161,10 +3548,10 @@ \let\italiccorrection=\/ % tex primitive -\def\emphasiscorrection - {\ifhmode - \expandafter\emphasislook - \fi} +\def\emphasiscorrection % not in raw alignment groups, else omit problem + {\ifhmode\ifnum\currentgrouptype=\@@aligngroup\else + \expandafter\expandafter\expandafter\emphasislook + \fi\fi} \def\emphasislook {\begingroup @@ -3284,7 +3671,7 @@ %D The implementation is rather straightforward in using %D \type{\halign}. -\fetchruntimecommand \showbodyfont {\f!fontprefix\s!run.mkiv} +\fetchruntimecommand \showbodyfont {\f!fontprefix\s!run} %D \macros %D {showfontstrip, testminimalbaseline, showminimalbaseline} @@ -3295,9 +3682,9 @@ %D %D \showfontstrip \blank \showminimalbaseline -\fetchruntimecommand \showfontstrip {\f!fontprefix\s!run.mkiv} -\fetchruntimecommand \testminimalbaseline {\f!fontprefix\s!run.mkiv} -\fetchruntimecommand \showminimalbaseline {\f!fontprefix\s!run.mkiv} +\fetchruntimecommand \showfontstrip {\f!fontprefix\s!run} +\fetchruntimecommand \testminimalbaseline {\f!fontprefix\s!run} +\fetchruntimecommand \showminimalbaseline {\f!fontprefix\s!run} %D \macros %D {showkerning} @@ -3306,7 +3693,7 @@ %D %D \showkerning{Can you guess what kerning is?} -\fetchruntimecommand \showkerning {\f!fontprefix\s!run.mkiv} +\fetchruntimecommand \showkerning {\f!fontprefix\s!run} %D \macros %D {showbodyfontenvironment} @@ -3319,7 +3706,7 @@ %D %D \showsetup{showbodyfontenvironment} -\fetchruntimecommand \showbodyfontenvironment {\f!fontprefix\s!run.mkiv} +\fetchruntimecommand \showbodyfontenvironment {\f!fontprefix\s!run} %D \macros %D {showfont,showfontstyle,showligatures} @@ -3335,11 +3722,11 @@ % to be internationalized -\fetchruntimecommand \showfont {\f!fontprefix\s!run.mkiv} -\fetchruntimecommand \showfontstyle {\f!fontprefix\s!run.mkiv} -\fetchruntimecommand \showligature {\f!fontprefix\s!run.mkiv} -\fetchruntimecommand \showligatures {\f!fontprefix\s!run.mkiv} -\fetchruntimecommand \showcharratio {\f!fontprefix\s!run.mkiv} +\fetchruntimecommand \showfont {\f!fontprefix\s!run} +\fetchruntimecommand \showfontstyle {\f!fontprefix\s!run} +\fetchruntimecommand \showligature {\f!fontprefix\s!run} +\fetchruntimecommand \showligatures {\f!fontprefix\s!run} +\fetchruntimecommand \showcharratio {\f!fontprefix\s!run} %D \macros %D {getglyph, symbolicfont} @@ -3437,36 +3824,90 @@ \let\thedefinedfont\relax -\def\symbolicsizedfont#1#2#3% - {\scaledfontsize#1% - \scaledfontsize#2\scaledfontsize - \font\thedefinedfont=\truefontname{\glyphfontfile{#3}} at \currentfontbodyscale\scaledfontsize\relax - \thedefinedfont} +% \def\symbolicsizedfont#1#2#3% +% {\scaledfontsize#1% +% \scaledfontsize#2\scaledfontsize +% \font\thedefinedfont=\truefontname{\glyphfontfile{#3}} at \currentfontbodyscale\scaledfontsize\relax +% \thedefinedfont} +% +% \def\symbolicscaledfont +% {\symbolicsizedfont\fontbody} +% +% \unexpanded\def\symbolicfont +% {\symbolicsizedfont\fontbody\plusone} +% +% \unexpanded\def\getglyph#1#2% slow, faster, much faster +% %{{\definefont[\s!dummy][\glyphfontfile{#1} sa \currentfontscale]\dummy#2}} +% %{{\definefont[\s!dummy][\glyphfontfile{#1} sa *]\dummy#2}} +% %{{\symbolicfont{#1}#2}} +% {{\symbolicfont{#1}\doifnumberelse{#2}\char\donothing#2}} +% +% \unexpanded\def\getscaledglyph#1#2#3% +% {{\symbolicscaledfont{#1}{#2}\doifnumberelse{#3}\char\donothing#3}} +% +% \unexpanded\def\getrawglyph#1#2% for simple symbols +% {{\scaledfontsize\fontbody +% \font\thedefinedfont=#1 at \currentfontbodyscale\scaledfontsize\relax +% \thedefinedfont\doifnumberelse{#2}\char\donothing#2}} +% +% \unexpanded\def\getfontchar#1#2% +% {{\symbolicfont{#1}\fontchar{#2}}} + +\def\setscaledstyledsymbolicfont#1#2#3% quite a slowdown, glyphfontfile + {\edef\askedsymbolfont{\truefontname{\glyphfontfile{#3}} at \the\dimexpr#2\dimexpr\currentfontbodyscale\dimexpr#1}% + \ifcsname\??ss->\askedsymbolfont\endcsname + \csname\??ss->\askedsymbolfont\endcsname + \else + \dodefinesymbolicfont + \fi} + +\def\setscaleddirectsymbolicfont#1#2#3% quite a slowdown, glyphfontfile + {\edef\askedsymbolfont{\truefontname{#3} at \the\dimexpr#2\dimexpr\currentfontbodyscale\dimexpr#1}% + \ifcsname\??ss->\askedsymbolfont\endcsname + \csname\??ss->\askedsymbolfont\endcsname + \else + \dodefinesymbolicfont + \fi} + +\def\setstyledsymbolicfont#1% quite a slowdown, glyphfontfile + {\edef\askedsymbolfont{\truefontname{\glyphfontfile{#1}} at \the\dimexpr\currentfontbodyscale\dimexpr\fontbody}% + \ifcsname\??ss->\askedsymbolfont\endcsname + \csname\??ss->\askedsymbolfont\endcsname + \else + \dodefinesymbolicfont + \fi} -\def\symbolicscaledfont - {\symbolicsizedfont\fontbody} +\def\setdirectsymbolicfont#1% + {\edef\askedsymbolfont{\truefontname{#1} at \the\dimexpr\currentfontbodyscale\dimexpr\fontbody}% + \ifcsname\??ss->\askedsymbolfont\endcsname + \csname\??ss->\askedsymbolfont\endcsname + \else + \dodefinesymbolicfont + \fi} -\unexpanded\def\symbolicfont - {\symbolicsizedfont\fontbody\plusone} +\def\dodefinesymbolicfont + {\definefont[currentsymbolfont][\askedsymbolfont]% + \currentsymbolfont + \global\expandafter\let\csname\??ss->\askedsymbolfont\endcsname\lastrawfontcall} -\unexpanded\def\getglyph#1#2% slow, faster, much faster - %{{\definefont[\s!dummy][\glyphfontfile{#1} sa \currentfontscale]\dummy#2}} - %{{\definefont[\s!dummy][\glyphfontfile{#1} sa *]\dummy#2}} - %{{\symbolicfont{#1}#2}} - {{\symbolicfont{#1}\doifnumberelse{#2}\char\donothing#2}} +\unexpanded\def\getnamedglyphstyled#1#2{{\setstyledsymbolicfont{#1}\ctxcommand{fontchar("#2")}}} +\unexpanded\def\getnamedglyphdirect#1#2{{\setdirectsymbolicfont{#1}\ctxcommand{fontchar("#2")}}} +\unexpanded\def\getglyphstyled #1#2{{\setstyledsymbolicfont{#1}\doifnumberelse{#2}\char\donothing#2}} +\unexpanded\def\getglyphdirect #1#2{{\setdirectsymbolicfont{#1}\doifnumberelse{#2}\char\donothing#2}} +\unexpanded\def\getscaledglyph #1#2#3{{\setscaledstyledsymbolicfont{#1}{#2}\doifnumberelse{#3}\char\donothing#3}} -\unexpanded\def\getscaledglyph#1#2#3% - {{\symbolicscaledfont{#1}{#2}\doifnumberelse{#3}\char\donothing#3}} +\let\getglyph \getglyphstyled % old +\let\getrawglyph \getglyphdirect % old +\let\symbolicsizedfont\setscaledstyledsymbolicfont % old +\let\symbolicfont \setstyledsymbolicfont % old -\unexpanded\def\getrawglyph#1#2% for simple symbols - {{\scaledfontsize\fontbody - \font\thedefinedfont=#1 at \currentfontbodyscale\scaledfontsize\relax - \thedefinedfont\doifnumberelse{#2}\char\donothing#2}} +\unexpanded\def\symbolicscaledfont{\setsscaledstyledsymbolicfont\fontbody} +\unexpanded\def\symbolicscaledfont{\setscaledstyledsymbolicfont\fontbody} %D The last implementation of \type {\getglyph} permits %D definitions like: %D -%D \starttyping +%D \starttypings %D \definefontsynonym [EuroSans] [eurose] %D \definefontsynonym [EuroSansBold] [euroseb] %D \definefontsynonym [EuroSansItalic] [eurosei] @@ -3693,24 +4134,43 @@ \definefontsize[\c!a] \definefontsize[\c!b] \definefontsize[\c!c] \definefontsize[\c!d] -\definealternativestyle [\v!mediaeval] [\os] [] -\definealternativestyle [\v!normal] [\tf] [] -\definealternativestyle [\v!bold] [\bf] [] -\definealternativestyle [\v!type] [\tt] [] -\definealternativestyle [\v!mono] [\tt] [] -\definealternativestyle [\v!slanted] [\sl] [] -\definealternativestyle [\v!italic] [\it] [] -\definealternativestyle [\v!boldslanted,\v!slantedbold] [\bs] [] -\definealternativestyle [\v!bolditalic,\v!italicbold] [\bi] [] -\definealternativestyle [\v!small,\v!smallnormal] [\tfx] [] -\definealternativestyle [\v!smallbold] [\bfx] [] -\definealternativestyle [\v!smalltype] [\ttx] [] -\definealternativestyle [\v!smallslanted] [\slx] [] -\definealternativestyle [\v!smallboldslanted,\v!smallslantedbold] [\bsx] [] -\definealternativestyle [\v!smallbolditalic,\v!smallitalicbold] [\bix] [] - -\definealternativestyle [\v!sans,\v!sansserif] [\ss] [] -\definealternativestyle [\v!sansbold] [\ss\bf] [] +\definealternativestyle [\v!mediaeval] [\os] [] +\definealternativestyle [\v!normal] [\tf] [] +\definealternativestyle [\v!bold] [\bf] [] +\definealternativestyle [\v!type] [\tt] [] +\definealternativestyle [\v!mono] [\tt] [] +\definealternativestyle [\v!slanted] [\sl] [] +\definealternativestyle [\v!italic] [\it] [] +\definealternativestyle [\v!boldslanted,\v!slantedbold] [\bs] [] +\definealternativestyle [\v!bolditalic,\v!italicbold] [\bi] [] + +% \definealternativestyle [\v!small,\v!smallnormal] [\tfx] [] +% \definealternativestyle [\v!smallbold] [\bfx] [] +% \definealternativestyle [\v!smalltype] [\ttx] [] +% \definealternativestyle [\v!smallslanted] [\slx] [] +% \definealternativestyle [\v!smallboldslanted,\v!smallslantedbold] [\bsx] [] +% \definealternativestyle [\v!smallbolditalic,\v!smallitalicbold] [\bix] [] + +\definealternativestyle [\v!small,\v!smallnormal] [\setsmallbodyfont\tf] [] +\definealternativestyle [\v!smallbold] [\setsmallbodyfont\bf] [] +\definealternativestyle [\v!smalltype] [\setsmallbodyfont\tt] [] +\definealternativestyle [\v!smallslanted] [\setsmallbodyfont\sl] [] +\definealternativestyle [\v!smallboldslanted,\v!smallslantedbold] [\setsmallbodyfont\bs] [] +\definealternativestyle [\v!smallbolditalic,\v!smallitalicbold] [\setsmallbodyfont\bi] [] + +\definealternativestyle [\v!bigger] [\setbigbodyfont \tf] [] +\definealternativestyle [\v!smaller] [\setsmallbodyfont\tf] [] + +\definealternativestyle [\v!sans,\v!sansserif] [\ss] [] +\definealternativestyle [\v!sansbold] [\ss\bf] [] + +%D We can go on and on and on: +%D +%D \starttyping +%D \setupbodyfontenvironment[default][p=0.8,q=0.6] +%D \definefontsize[p] +%D \definefontsize[q] +%D \stoptyping %D Slow but handy: @@ -3774,15 +4234,83 @@ %D New commands (not yet interfaced): -\def\style[#1]% for inline usage, like \color - {\groupedcommand{\ifcsname#1\endcsname\csname#1\endcsname\else\definedfont[#1]\fi}{}} +% \def\style[#1]% for inline usage, like \color +% {\groupedcommand{\ifcsname#1\endcsname\csname#1\endcsname\else\definedfont[#1]\fi}{}} +% +% \unexpanded\def\startstyle[#1]% +% {\begingroup +% \ifcsname#1\endcsname\csname#1\endcsname\else\definedfont[#1]\fi} +% +% \unexpanded\def\stopstyle +% {\endgroup} + +% definitions + +\def\definestyle + {\dotripleargument\dodefinestyle} + +\def\dodefinestyle[#1][#2][#3]% + {\doifassignmentelse{#2}\dododefinestyle\definealternativestyle[#1][#2][#3]} + +\def\dododefinestyle[#1][#2][#3]% no commalist and for the moment #3 is ignored + {\getparameters[\??cf:#1][\c!style=,\c!color=,#2]% + \setuvalue{\e!start#1}{\begingroup\dostartattributes{\??cf:#1}\c!style\c!color}% + \setuvalue{\e!stop #1}{\dostopattributes\endgroup}% + \setuvalue {#1}{\groupedcommand{\dostartattributes{\??cf:#1}\c!style\c!color}\dostopattributes}} + +\def\setupstyle + {\dotripleargument\dosetupstyle} + +\def\dosetupstyle[#1][#2][#3]% no commalist and for the moment #3 is ignored + {\ifcsname\??cf:#1\c!style\endcsname + \getparameters[\??cf:#1][#2]% + \else + \getparameters[\??cf:#1][\c!style=,\c!color=,#2]% so we define but without commands (todo for all define related things) + \fi} + +% commands + +\unexpanded\def\style[#1]% + {\csname\ifcsname#1\endcsname n\else\ifcsname\??cf:#1\c!style\endcsname c\else d\fi\fi ostyle\endcsname{#1}} + +\def\nostyle#1{\csname#1\endcsname} +\def\costyle#1{\groupedcommand{\dostartattributes{\??cf:#1}\c!style\c!color}\dostopattributes} +\def\dostyle#1{\doifassignmentelse{#1}\dostyleassignment\dostyledirect{#1}} + +\def\dostyleassignment#1% + {\groupedcommand + {\getparameters[\??cf][\c!style=,\c!color=,#1]% + \dostartattributes\??cf\c!style\c!color} + {\dostopattributes}} + +\def\dostyledirect#1% + {\groupedcommand + {\definedfont[#1]} + {}} + +% environments \unexpanded\def\startstyle[#1]% {\begingroup - \ifcsname#1\endcsname\csname#1\endcsname\else\definedfont[#1]\fi} + \csname\ifcsname#1\endcsname n\else\ifcsname\??cf:#1\c!style\endcsname c\else d\fi\fi ostyless\endcsname{#1}} \unexpanded\def\stopstyle - {\endgroup} + {\dostopstyle + \endgroup + \autoinsertnextspace} % will be configurable, maybe also in \definestartstop + +\def\nostyless#1{\let\dostopstyle\donothing\csname#1\endcsname} +\def\costyless#1{\let\dostopstyle\dostopattributes\dostartattributes{\??cf:#1}\c!style\c!color} +\def\dostyless#1{\doifassignmentelse{#1}\dostylessassignment\dostylessdirect{#1}} + +\def\dostylessassignment#1% + {\let\dostopstyle\dostopattributes + \getparameters[\??cf][\c!style,\c!color=,#1]% + \dostartattributes\??cf\c!style\c!color} + +\def\dostylessdirect#1% + {\let\dostopstyle\donothing + \definedfont[#1]\relax} %D Still experimental (might even go away). @@ -3820,7 +4348,7 @@ \else\ifthirdargument \setvalue{\??sx#1::#2}{#3}% \else\ifsecondargument - \letvalue{\??sx#1::#2}\empty + \letvalueempty{\??sx#1::#2}% \fi\fi\fi} \unexpanded\def\styleinstance[#1]% will be made faster @@ -3847,8 +4375,8 @@ %D goodies: -\def\showchardata#1{\ctxlua{fonts.show_char_data("#1")}} -\def\showfontdata {\ctxlua{fonts.show_font_parameters()}} +\unexpanded\def\showchardata#1{\ctxcommand{showchardata("#1")}} +\unexpanded\def\showfontdata {\ctxcommand{showfontparameters()}} %D some low level helpers %D @@ -3869,28 +4397,18 @@ % we can also move the lookups to the fonts.namespace (of commands) -\def\dolookupfontbyspec #1{\ctxlua{fonts.names.lookup("#1")}} -\def\dolookupnoffound {\ctxlua{tex.write(fonts.names.noflookups())}} -\def\dolookupgetkeyofindex#1#2{\ctxlua{tex.write(fonts.names.getlookupkey("#1",#2))}} -\def\dolookupgetkey #1{\ctxlua{tex.write(fonts.names.getlookupkey("#1"))}} -\def\cleanfontname #1{\ctxlua{fonts.cleanname("#1")}} - -\protect \endinput - -% \startluacode -% function commands.doifelsecurrentfonthasfeature(name) -% local f = fonts.ids[font.current()] -% f = f and f.shared -% f = f and f.otfdata -% f = f and f.luatex -% f = f and f.features -% commands.doifelse(f and (f.gpos[name] or f.gsub[name])) -% end -% \stopluacode - -% \def\doifelsecurrentfonthasfeature#1% -% {\ctxlua{commands.doifelsecurrentfonthasfeature("#1")}} +\def\dolookupfontbyspec #1{\ctxcommand{fontlookupinitialize("#1")}} +\def\dolookupnoffound {\ctxcommand{fontlookupnoffound()}} +\def\dolookupgetkeyofindex#1#2{\ctxcommand{fontlookupgetkeyofindex("#1",#2)}} +\def\dolookupgetkey #1{\ctxcommand{fontlookupgetkey("#1")}} +\def\cleanfontname #1{\ctxcommand{cleanfontname("#1")}} % \doifelsecurrentfonthasfeature{smcp}{YES}{NO} % \doifelsecurrentfonthasfeature{crap}{YES}{NO} % \doifelsecurrentfonthasfeature{kern}{YES}{NO} + +\def\doifelsecurrentfonthasfeature#1% + {\ctxcommand{doifelsecurrentfonthasfeature("#1")}} + +\protect \endinput + diff --git a/Master/texmf-dist/tex/context/base/font-ldr.lua b/Master/texmf-dist/tex/context/base/font-ldr.lua new file mode 100644 index 00000000000..ca4e3f98a3d --- /dev/null +++ b/Master/texmf-dist/tex/context/base/font-ldr.lua @@ -0,0 +1,70 @@ +if not modules then modules = { } end modules ['font-ldr'] = { + version = 1.001, + comment = "companion to font-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- This module provides a replacement for fontloader.to_table +-- and will be loaded in due time. + +local fields = fontloader.fields + +if fields then + + local glyphfields + + local function get_glyphs(r) + local t = { } + local g = r.glyphs + for i=1,r.glyphmax-1 do + local gi = g[i] + if gi then + if not glyphfields then + glyphfields = fields(gi) + end + local h = { } + for i=1,#glyphfields do + local s = glyphfields[i] + h[s] = gi[s] + end + t[i] = h + end + end + return t + end + + local function to_table(r) + local f = fields(r) + if f then + local t = { } + for i=1,#f do + local fi = f[i] + local ri = r[fi] + if not ri then + -- skip + elseif fi == "glyphs" then + t.glyphs = get_glyphs(r) + elseif fi == "subfonts" then + t[fi] = ri + ri.glyphs = get_glyphs(ri) + else + t[fi] = r[fi] + end + end + return t + end + end + + -- currently glyphs, subfont-glyphs and the main table are userdata + + function fonts.to_table(raw) + return to_table(raw) + end + +else + + fonts.to_table = fontloader.to_table + +end diff --git a/Master/texmf-dist/tex/context/base/font-log.lua b/Master/texmf-dist/tex/context/base/font-log.lua index 97cb4ff7c1a..8bc12a2159a 100644 --- a/Master/texmf-dist/tex/context/base/font-log.lua +++ b/Master/texmf-dist/tex/context/base/font-log.lua @@ -8,9 +8,16 @@ if not modules then modules = { } end modules ['font-log'] = { local next, format, lower, concat = next, string.format, string.lower, table.concat -local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) +local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) +local report_defining = logs.reporter("fonts","defining") -fonts.logger = fonts.logger or { } +local basename = file.basename + +local fonts = fonts +local loggers = { } +fonts.loggers = loggers +local usedfonts = utilities.storage.allocate() +----- loadedfonts = utilities.storage.allocate() --[[ldx--

The following functions are used for reporting about the fonts @@ -19,40 +26,55 @@ we now have several readers it may be handy to know what reader is used for which font.

--ldx]]-- -function fonts.logger.save(tfmtable,source,specification) -- save file name in spec here ! ! ! ! ! ! - if tfmtable and specification and specification.specification then - local name = lower(specification.name) - if trace_defining and not fonts.used[name] then - logs.report("define font","registering %s as %s (used: %s)",file.basename(specification.name),source,file.basename(specification.filename)) +function loggers.onetimemessage(font,char,message,reporter) + local tfmdata = fonts.hashes.identifiers[font] + local shared = tfmdata.shared + local messages = shared.messages + if not messages then + messages = { } + shared.messages = messages + end + local category = messages[message] + if not category then + category = { } + messages[message] = category + end + if not category[char] then + if not reporter then + reporter = report_defining end - specification.source = source - fonts.loaded[lower(specification.specification)] = specification - -- fonts.used[name] = source - fonts.used[lower(specification.filename or specification.name)] = source + reporter("char U+%05X in font '%s' with id %s: %s",char,tfmdata.properties.fullname,font,message) + category[char] = true end end -function fonts.logger.report(complete) - local t = { } - for name, used in table.sortedhash(fonts.used) do - if complete then - t[#t+1] = used .. "->" .. file.basename(name) - else - t[#t+1] = file.basename(name) +function loggers.register(tfmdata,source,specification) -- save file name in spec here ! ! ! ! ! ! + if tfmdata and specification and specification.specification then + local name = lower(specification.name) + if trace_defining and not usedfonts[name] then + report_defining("registering %s as %s (used: %s)",file.basename(specification.name),source,file.basename(specification.filename)) end + specification.source = source + -- loadedfonts[lower(specification.specification)] = specification + usedfonts[lower(specification.filename or specification.name)] = source end - return t end -function fonts.logger.format(name) - return fonts.used[name] or "unknown" +function loggers.format(name) -- should be avoided + return usedfonts[name] or "unknown" end statistics.register("loaded fonts", function() - if next(fonts.used) then - local t = fonts.logger.report() - return (#t > 0 and format("%s files: %s",#t,concat(t,separator or " "))) or "none" - else - return nil + if next(usedfonts) then + local t, n = { }, 0 + for name, used in table.sortedhash(usedfonts) do + n = n + 1 + if complete then + t[n] = used .. "->" .. basename(name) + else + t[n] = basename(name) + end + end + return (n > 0 and format("%s files: %s",n,concat(t," "))) or "none" end end) diff --git a/Master/texmf-dist/tex/context/base/font-lua.lua b/Master/texmf-dist/tex/context/base/font-lua.lua new file mode 100644 index 00000000000..48ce3c2f53c --- /dev/null +++ b/Master/texmf-dist/tex/context/base/font-lua.lua @@ -0,0 +1,46 @@ +if not modules then modules = { } end modules ['font-lua'] = { + version = 1.001, + comment = "companion to font-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) + +local report_lua = logs.reporter("fonts","lua loading") + +local fonts = fonts +local readers = fonts.readers +fonts.formats.lua = "lua" + +-- we could add support for features here + +local function check_lua(specification,fullname) + -- standard tex file lookup + local fullname = resolvers.findfile(fullname) or "" + if fullname ~= "" then + local loader = loadfile(fullname) + loader = loader and loader() + return loader and loader(specification) + end +end + +readers.check_lua = check_lua + +function readers.lua(specification) + local original = specification.specification + if trace_defining then + report_lua("using lua reader for '%s'",original) + end + local fullname = specification.filename or "" + if fullname == "" then + local forced = specification.forced or "" + if forced ~= "" then + fullname = specification.name .. "." .. forced + else + fullname = specification.name + end + end + return check_lua(specification,fullname) +end diff --git a/Master/texmf-dist/tex/context/base/font-map.lua b/Master/texmf-dist/tex/context/base/font-map.lua index 299508764a1..76733adeac6 100644 --- a/Master/texmf-dist/tex/context/base/font-map.lua +++ b/Master/texmf-dist/tex/context/base/font-map.lua @@ -6,15 +6,18 @@ if not modules then modules = { } end modules ['font-map'] = { license = "see context related readme files" } -local utf = unicode.utf8 local match, format, find, concat, gsub, lower = string.match, string.format, string.find, table.concat, string.gsub, string.lower -local lpegmatch = lpeg.match +local P, R, S, C, Ct, Cc, lpegmatch = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Ct, lpeg.Cc, lpeg.match local utfbyte = utf.byte -local trace_loading = false trackers.register("otf.loading", function(v) trace_loading = v end) -local trace_unimapping = false trackers.register("otf.unimapping", function(v) trace_unimapping = v end) +local trace_loading = false trackers.register("fonts.loading", function(v) trace_loading = v end) +local trace_mapping = false trackers.register("fonts.mapping", function(v) trace_unimapping = v end) -local ctxcatcodes = tex and tex.ctxcatcodes +local report_fonts = logs.reporter("fonts","loading") -- not otf only + +local fonts = fonts +local mappings = { } +fonts.mappings = mappings --[[ldx--

Eventually this code will disappear because map files are kind @@ -22,50 +25,46 @@ of obsolete. Some code may move to runtime or auxiliary modules.

The name to unciode related code will stay of course.

--ldx]]-- -fonts = fonts or { } -fonts.map = fonts.map or { } - -local function load_lum_table(filename) -- will move to font goodies +local function loadlumtable(filename) -- will move to font goodies local lumname = file.replacesuffix(file.basename(filename),"lum") - local lumfile = resolvers.find_file(lumname,"map") or "" + local lumfile = resolvers.findfile(lumname,"map") or "" if lumfile ~= "" and lfs.isfile(lumfile) then - if trace_loading or trace_unimapping then - logs.report("load otf","enhance: loading %s ",lumfile) + if trace_loading or trace_mapping then + report_fonts("enhance: loading %s ",lumfile) end lumunic = dofile(lumfile) return lumunic, lumfile end end -local hex = lpeg.R("AF","09") +local hex = R("AF","09") local hexfour = (hex*hex*hex*hex) / function(s) return tonumber(s,16) end local hexsix = (hex^1) / function(s) return tonumber(s,16) end -local dec = (lpeg.R("09")^1) / tonumber -local period = lpeg.P(".") - -local unicode = lpeg.P("uni") * (hexfour * (period + lpeg.P(-1)) * lpeg.Cc(false) + lpeg.Ct(hexfour^1) * lpeg.Cc(true)) -local ucode = lpeg.P("u") * (hexsix * (period + lpeg.P(-1)) * lpeg.Cc(false) + lpeg.Ct(hexsix ^1) * lpeg.Cc(true)) -local index = lpeg.P("index") * dec * lpeg.Cc(false) +local dec = (R("09")^1) / tonumber +local period = P(".") +local unicode = P("uni") * (hexfour * (period + P(-1)) * Cc(false) + Ct(hexfour^1) * Cc(true)) +local ucode = P("u") * (hexsix * (period + P(-1)) * Cc(false) + Ct(hexsix ^1) * Cc(true)) +local index = P("index") * dec * Cc(false) local parser = unicode + ucode + index local parsers = { } -local function make_name_parser(str) +local function makenameparser(str) if not str or str == "" then return parser else local p = parsers[str] if not p then - p = lpeg.P(str) * period * dec * lpeg.Cc(false) + p = P(str) * period * dec * Cc(false) parsers[str] = p end return p end end ---~ local parser = fonts.map.make_name_parser("Japan1") ---~ local parser = fonts.map.make_name_parser() +--~ local parser = mappings.makenameparser("Japan1") +--~ local parser = mappings.makenameparser() --~ local function test(str) --~ local b, a = lpegmatch(parser,str) --~ print((a and table.serialize(b)) or b) @@ -106,7 +105,7 @@ end --~ --~ local cache = { } --~ ---~ function fonts.map.tounicode16(unicode) +--~ function mappings.tounicode16(unicode) --~ local s = cache[unicode] --~ if not s then --~ if unicode < 0x10000 then @@ -119,14 +118,14 @@ end --~ return s --~ end -fonts.map.load_lum_table = load_lum_table -fonts.map.make_name_parser = make_name_parser -fonts.map.tounicode16 = tounicode16 -fonts.map.tounicode16sequence = tounicode16sequence +mappings.loadlumtable = loadlumtable +mappings.makenameparser = makenameparser +mappings.tounicode16 = tounicode16 +mappings.tounicode16sequence = tounicode16sequence -local separator = lpeg.S("_.") -local other = lpeg.C((1 - separator)^1) -local ligsplitter = lpeg.Ct(other * (separator * other)^0) +local separator = S("_.") +local other = C((1 - separator)^1) +local ligsplitter = Ct(other * (separator * other)^0) --~ print(table.serialize(lpegmatch(ligsplitter,"this"))) --~ print(table.serialize(lpegmatch(ligsplitter,"this.that"))) @@ -134,8 +133,11 @@ local ligsplitter = lpeg.Ct(other * (separator * other)^0) --~ print(table.serialize(lpegmatch(ligsplitter,"such_so_more"))) --~ print(table.serialize(lpegmatch(ligsplitter,"such_so_more.that"))) -fonts.map.add_to_unicode = function(data,filename) - local unicodes = data.luatex and data.luatex.unicodes +function mappings.addtounicode(data,filename) + local resources = data.resources + local properties = data.properties + local descriptions = data.descriptions + local unicodes = resources.unicodes if not unicodes then return end @@ -145,28 +147,35 @@ fonts.map.add_to_unicode = function(data,filename) unicodes['zwj'] = unicodes['zwj'] or 0x200D unicodes['zwnj'] = unicodes['zwnj'] or 0x200C -- the tounicode mapping is sparse and only needed for alternatives - local tounicode, originals, ns, nl, private, unknown = { }, { }, 0, 0, fonts.private, format("%04X",utfbyte("?")) - data.luatex.tounicode, data.luatex.originals = tounicode, originals + local private = fonts.constructors.privateoffset + local unknown = format("%04X",utfbyte("?")) + local unicodevector = fonts.encodings.agl.unicodes -- loaded runtime in context + local tounicode = { } + local originals = { } + resources.tounicode = tounicode + resources.originals = originals local lumunic, uparser, oparser + local cidinfo, cidnames, cidcodes, usedmap if false then -- will become an option - lumunic = load_lum_table(filename) + lumunic = loadlumtable(filename) lumunic = lumunic and lumunic.tounicode end - local cidinfo, cidnames, cidcodes = data.cidinfo - local usedmap = cidinfo and cidinfo.usedname - usedmap = usedmap and lower(usedmap) - usedmap = usedmap and fonts.cid.map[usedmap] + -- + cidinfo = properties.cidinfo + usedmap = cidinfo and fonts.cid.getmap(cidinfo) + -- if usedmap then - oparser = usedmap and make_name_parser(cidinfo.ordering) + oparser = usedmap and makenameparser(cidinfo.ordering) cidnames = usedmap.names cidcodes = usedmap.unicodes end - uparser = make_name_parser() - local aglmap = fonts.map and fonts.map.agl_to_unicode - for index, glyph in next, data.glyphs do - local name, unic = glyph.name, glyph.unicode or -1 -- play safe + uparser = makenameparser() + local ns, nl = 0, 0 + for unic, glyph in next, descriptions do + local index = glyph.index + local name = glyph.name if unic == -1 or unic >= private or (unic >= 0xE000 and unic <= 0xF8FF) or unic == 0xFFFE or unic == 0xFFFF then - local unicode = (lumunic and lumunic[name]) or (aglmap and aglmap[name]) + local unicode = lumunic and lumunic[name] or unicodevector[name] if unicode then originals[index], tounicode[index], ns = unicode, tounicode16(unicode), ns + 1 end @@ -210,7 +219,7 @@ fonts.map.add_to_unicode = function(data,filename) -- skip elseif nplit == 1 then local base = split[1] - unicode = unicodes[base] or (aglmap and aglmap[base]) + unicode = unicodes[base] or unicodevector[base] if unicode then if type(unicode) == "table" then unicode = unicode[1] @@ -218,19 +227,25 @@ fonts.map.add_to_unicode = function(data,filename) originals[index], tounicode[index], ns = unicode, tounicode16(unicode), ns + 1 end else - local t = { } + local t, n = { }, 0 for l=1,nplit do local base = split[l] - local u = unicodes[base] or (aglmap and aglmap[base]) + local u = unicodes[base] or unicodevector[base] if not u then break elseif type(u) == "table" then - t[#t+1] = u[1] + n = n + 1 + t[n] = u[1] else - t[#t+1] = u + n = n + 1 + t[n] = u end end - if #t > 0 then -- done then + if n == 0 then -- done then + -- nothing + elseif n == 1 then + originals[index], tounicode[index], nl, unicode = t[1], tounicode16(t[1]), nl + 1, true + else originals[index], tounicode[index], nl, unicode = t, tounicode16sequence(t), nl + 1, true end end @@ -251,120 +266,19 @@ fonts.map.add_to_unicode = function(data,filename) end end end - if trace_unimapping then - for index, glyph in table.sortedhash(data.glyphs) do - local toun, name, unic = tounicode[index], glyph.name, glyph.unicode or -1 -- play safe + if trace_mapping then + for unic, glyph in table.sortedhash(descriptions) do + local name = glyph.name + local index = glyph.index + local toun = tounicode[index] if toun then - logs.report("load otf","internal: 0x%05X, name: %s, unicode: 0x%05X, tounicode: %s",index,name,unic,toun) + report_fonts("internal: 0x%05X, name: %s, unicode: U+%05X, tounicode: %s",index,name,unic,toun) else - logs.report("load otf","internal: 0x%05X, name: %s, unicode: 0x%05X",index,name,unic) + report_fonts("internal: 0x%05X, name: %s, unicode: U+%05X",index,name,unic) end end end if trace_loading and (ns > 0 or nl > 0) then - logs.report("load otf","enhance: %s tounicode entries added (%s ligatures)",nl+ns, ns) + report_fonts("enhance: %s tounicode entries added (%s ligatures)",nl+ns, ns) end end - --- the following is sort of obsolete --- --- fonts.map.data = fonts.map.data or { } --- fonts.map.encodings = fonts.map.encodings or { } --- fonts.map.loaded = fonts.map.loaded or { } --- fonts.map.line = fonts.map.line or { } --- --- function fonts.map.line.pdftex(e) --- if e.name and e.fontfile then --- local fullname = e.fullname or "" --- if e.slant and e.slant ~= 0 then --- if e.encoding then --- pdf.mapline(format('= %s %s "%g SlantFont" <%s <%s',e.name,fullname,e.slant,e.encoding,e.fontfile))) --- else --- pdf.mapline(format('= %s %s "%g SlantFont" <%s',e.name,fullname,e.slant,e.fontfile))) --- end --- elseif e.extend and e.extend ~= 1 and e.extend ~= 0 then --- if e.encoding then --- pdf.mapline(format('= %s %s "%g ExtendFont" <%s <%s',e.name,fullname,e.extend,e.encoding,e.fontfile))) --- else --- pdf.mapline(format('= %s %s "%g ExtendFont" <%s',e.name,fullname,e.extend,e.fontfile))) --- end --- else --- if e.encoding then --- pdf.mapline(format('= %s %s <%s <%s',e.name,fullname,e.encoding,e.fontfile))) --- else --- pdf.mapline(format('= %s %s <%s',e.name,fullname,e.fontfile))) --- end --- end --- else --- return nil --- end --- end --- --- function fonts.map.flush(backend) -- will also erase the accumulated data --- local flushline = fonts.map.line[backend or "pdftex"] or fonts.map.line.pdftex --- for _, e in next, fonts.map.data do --- flushline(e) --- end --- fonts.map.data = { } --- end --- --- fonts.map.line.dvips = fonts.map.line.pdftex --- fonts.map.line.dvipdfmx = function() end --- --- function fonts.map.convert_entries(filename) --- if not fonts.map.loaded[filename] then --- fonts.map.data, fonts.map.encodings = fonts.map.load_file(filename,fonts.map.data, fonts.map.encodings) --- fonts.map.loaded[filename] = true --- end --- end --- --- function fonts.map.load_file(filename, entries, encodings) --- entries = entries or { } --- encodings = encodings or { } --- local f = io.open(filename) --- if f then --- local data = f:read("*a") --- if data then --- for line in gmatch(data,"(.-)[\n\t]") do --- if find(line,"^[%#%%%s]") then --- -- print(line) --- else --- local extend, slant, name, fullname, fontfile, encoding --- line = gsub(line,'"(.+)"', function(s) --- extend = find(s,'"([^"]+) ExtendFont"') --- slant = find(s,'"([^"]+) SlantFont"') --- return "" --- end) --- if not name then --- -- name fullname encoding fontfile --- name, fullname, encoding, fontfile = match(line,"^(%S+)%s+(%S*)[%s<]+(%S*)[%s<]+(%S*)%s*$") --- end --- if not name then --- -- name fullname (flag) fontfile encoding --- name, fullname, fontfile, encoding = match(line,"^(%S+)%s+(%S*)[%d%s<]+(%S*)[%s<]+(%S*)%s*$") --- end --- if not name then --- -- name fontfile --- name, fontfile = match(line,"^(%S+)%s+[%d%s<]+(%S*)%s*$") --- end --- if name then --- if encoding == "" then encoding = nil end --- entries[name] = { --- name = name, -- handy --- fullname = fullname, --- encoding = encoding, --- fontfile = fontfile, --- slant = tonumber(slant), --- extend = tonumber(extend) --- } --- encodings[name] = encoding --- elseif line ~= "" then --- -- print(line) --- end --- end --- end --- end --- f:close() --- end --- return entries, encodings --- end diff --git a/Master/texmf-dist/tex/context/base/font-mis.lua b/Master/texmf-dist/tex/context/base/font-mis.lua index 80a56332aca..198293ba132 100644 --- a/Master/texmf-dist/tex/context/base/font-mis.lua +++ b/Master/texmf-dist/tex/context/base/font-mis.lua @@ -1,6 +1,6 @@ if not modules then modules = { } end modules ['font-mis'] = { version = 1.001, - comment = "companion to luatex-fonts.tex", + comment = "companion to mtx-fonts", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" @@ -9,13 +9,23 @@ if not modules then modules = { } end modules ['font-mis'] = { local next = next local lower, strip = string.lower, string.strip -fonts.otf = fonts.otf or { } +-- also used in other scripts so we need to check some tables: -fonts.otf.version = fonts.otf.version or 2.650 -fonts.otf.pack = true -fonts.otf.cache = containers.define("fonts", "otf", fonts.otf.version, true) +fonts = fonts or { } -function fonts.otf.loadcached(filename,format,sub) +fonts.helpers = fonts.helpers or { } +local helpers = fonts.helpers + +fonts.handlers = fonts.handlers or { } +local handlers = fonts.handlers + +handlers.otf = handlers.otf or { } +local otf = handlers.otf + +otf.version = otf.version or 2.730 +otf.cache = otf.cache or containers.define("fonts", "otf", otf.version, true) + +function otf.loadcached(filename,format,sub) -- no recache when version mismatch local name = file.basename(file.removesuffix(filename)) if sub == "" then sub = false end @@ -24,9 +34,9 @@ function fonts.otf.loadcached(filename,format,sub) hash = hash .. "-" .. sub end hash = containers.cleanname(hash) - local data = containers.read(fonts.otf.cache(), hash) + local data = containers.read(otf.cache, hash) if data and not data.verbose then - fonts.otf.enhancers.unpack(data) + otf.enhancers.unpack(data) return data else return nil @@ -35,14 +45,14 @@ end local featuregroups = { "gsub", "gpos" } -function fonts.get_features(name,t,script,language) +function fonts.helpers.getfeatures(name,t,script,language) -- maybe per font type local t = lower(t or (name and file.extname(name)) or "") if t == "otf" or t == "ttf" or t == "ttc" or t == "dfont" then - local filename = resolvers.find_file(name,t) or "" + local filename = resolvers.findfile(name,t) or "" if filename ~= "" then - local data = fonts.otf.loadcached(filename) - if data and data.luatex and data.luatex.features then - return data.luatex.features + local data = otf.loadcached(filename) + if data and data.resources and data.resources.features then + return data.resources.features else local ff = fontloader.open(filename) if ff then diff --git a/Master/texmf-dist/tex/context/base/font-ota.lua b/Master/texmf-dist/tex/context/base/font-ota.lua index 0b61e17d1e0..1bf73653198 100644 --- a/Master/texmf-dist/tex/context/base/font-ota.lua +++ b/Master/texmf-dist/tex/context/base/font-ota.lua @@ -13,49 +13,109 @@ local type, tostring, match, format, concat = type, tostring, string.match, stri if not trackers then trackers = { register = function() end } end local trace_analyzing = false trackers.register("otf.analyzing", function(v) trace_analyzing = v end) -local trace_cjk = false trackers.register("cjk.injections", function(v) trace_cjk = v end) -trackers.register("cjk.analyzing","otf.analyzing") +local fonts, nodes, node = fonts, nodes, node -fonts = fonts or { } -fonts.analyzers = fonts.analyzers or { } -fonts.analyzers.initializers = fonts.analyzers.initializers or { node = { otf = { } } } -fonts.analyzers.methods = fonts.analyzers.methods or { node = { otf = { } } } +local allocate = utilities.storage.allocate -local otf = fonts.otf -local tfm = fonts.tfm +local otf = fonts.handlers.otf -local initializers = fonts.analyzers.initializers -local methods = fonts.analyzers.methods +local analyzers = fonts.analyzers +local initializers = allocate() +local methods = allocate() -local glyph = node.id('glyph') -local glue = node.id('glue') -local penalty = node.id('penalty') +analyzers.initializers = initializers +analyzers.methods = methods +analyzers.useunicodemarks = false -local set_attribute = node.set_attribute -local has_attribute = node.has_attribute -local traverse_id = node.traverse_id -local traverse_node_list = node.traverse +local nodecodes = nodes.nodecodes +local glyph_code = nodecodes.glyph -local fontdata = fonts.ids -local state = attributes.private('state') +local set_attribute = node.set_attribute +local has_attribute = node.has_attribute +local traverse_id = node.traverse_id +local traverse_node_list = node.traverse -local fcs = (fonts.color and fonts.color.set) or function() end -local fcr = (fonts.color and fonts.color.reset) or function() end +local fontdata = fonts.hashes.identifiers +local state = attributes.private('state') +local categories = characters and characters.categories or { } -- sorry, only in context -local a_to_script = otf.a_to_script -local a_to_language = otf.a_to_language +local tracers = nodes.tracers +local colortracers = tracers and tracers.colors +local setnodecolor = colortracers and colortracers.set or function() end +local resetnodecolor = colortracers and colortracers.reset or function() end + +local otffeatures = fonts.constructors.newfeatures("otf") +local registerotffeature = otffeatures.register + +--[[ldx-- +

Analyzers run per script and/or language and are needed in order to +process features right.

+--ldx]]-- + +-- todo: analyzers per script/lang, cross font, so we need an font id hash -> script +-- e.g. latin -> hyphenate, arab -> 1/2/3 analyze -- its own namespace + +local state = attributes.private('state') + +function analyzers.setstate(head,font) + local useunicodemarks = analyzers.useunicodemarks + local tfmdata = fontdata[font] + local characters = tfmdata.characters + local descriptions = tfmdata.descriptions + local first, last, current, n, done = nil, nil, head, 0, false -- maybe make n boolean + while current do + local id = current.id + if id == glyph_code and current.font == font then + local char = current.char + local d = descriptions[char] + if d then + if d.class == "mark" or (useunicodemarks and categories[char] == "mn") then + done = true + set_attribute(current,state,5) -- mark + elseif n == 0 then + first, last, n = current, current, 1 + set_attribute(current,state,1) -- init + else + last, n = current, n+1 + set_attribute(current,state,2) -- medi + end + else -- finish + if first and first == last then + set_attribute(last,state,4) -- isol + elseif last then + set_attribute(last,state,3) -- fina + end + first, last, n = nil, nil, 0 + end + elseif id == disc_code then + -- always in the middle + set_attribute(current,state,2) -- midi + last = current + else -- finish + if first and first == last then + set_attribute(last,state,4) -- isol + elseif last then + set_attribute(last,state,3) -- fina + end + first, last, n = nil, nil, 0 + end + current = current.next + end + if first and first == last then + set_attribute(last,state,4) -- isol + elseif last then + set_attribute(last,state,3) -- fina + end + return head, done +end -- in the future we will use language/script attributes instead of the -- font related value, but then we also need dynamic features which is -- somewhat slower; and .. we need a chain of them -function fonts.initializers.node.otf.analyze(tfmdata,value,attr) - if attr and attr > 0 then - script, language = a_to_script[attr], a_to_language[attr] - else - script, language = tfmdata.script, tfmdata.language - end +local function analyzeinitializer(tfmdata,value) -- attr + local script, language = otf.scriptandlanguage(tfmdata) -- attr local action = initializers[script] if action then if type(action) == "function" then @@ -67,17 +127,11 @@ function fonts.initializers.node.otf.analyze(tfmdata,value,attr) end end end - return nil end -function fonts.methods.node.otf.analyze(head,font,attr) +local function analyzeprocessor(head,font,attr) local tfmdata = fontdata[font] - local script, language - if attr and attr > 0 then - script, language = a_to_script[attr], a_to_language[attr] - else - script, language = tfmdata.script, tfmdata.language - end + local script, language = otf.scriptandlanguage(tfmdata,attr) local action = methods[script] if action then if type(action) == "function" then @@ -92,14 +146,25 @@ function fonts.methods.node.otf.analyze(head,font,attr) return head, false end -otf.features.register("analyze",true) -- we always analyze -table.insert(fonts.triggers,"analyze") -- we need a proper function for doing this +registerotffeature { + name = "analyze", + description = "analysis of (for instance) character classes", + default = true, + initializers = { + node = analyzeinitializer, + }, + processors = { + position = 1, + node = analyzeprocessor, + } +} -- latin -fonts.analyzers.methods.latn = fonts.analyzers.aux.setstate +methods.latn = analyzers.setstate --- this info eventually will go into char-def +-- this info eventually will go into char-def adn we will have a state +-- table for generic then local zwnj = 0x200C local zwj = 0x200D @@ -174,15 +239,15 @@ local arab_warned = { } local function warning(current,what) local char = current.char if not arab_warned[char] then - log.report("analyze","arab: character %s (U+%04X) has no %s class", char, char, what) + log.report("analyze","arab: character %s (U+%05X) has no %s class", char, char, what) arab_warned[char] = true end end -function fonts.analyzers.methods.nocolor(head,font,attr) - for n in traverse_node_list(head,glyph) do +function methods.nocolor(head,font,attr) + for n in traverse_id(glyph_code,head) do if not font or n.font == font then - fcr(n) + resetnodecolor(n) end end return head, true @@ -194,22 +259,22 @@ local function finish(first,last) local fc = first.char if isol_fina_medi_init[fc] or isol_fina[fc] then set_attribute(first,state,4) -- isol - if trace_analyzing then fcs(first,"font:isol") end + if trace_analyzing then setnodecolor(first,"font:isol") end else warning(first,"isol") set_attribute(first,state,0) -- error - if trace_analyzing then fcr(first) end + if trace_analyzing then resetnodecolor(first) end end else local lc = last.char if isol_fina_medi_init[lc] or isol_fina[lc] then -- why isol here ? -- if laststate == 1 or laststate == 2 or laststate == 4 then set_attribute(last,state,3) -- fina - if trace_analyzing then fcs(last,"font:fina") end + if trace_analyzing then setnodecolor(last,"font:fina") end else warning(last,"fina") set_attribute(last,state,0) -- error - if trace_analyzing then fcr(last) end + if trace_analyzing then resetnodecolor(last) end end end first, last = nil, nil @@ -218,41 +283,42 @@ local function finish(first,last) local fc = first.char if isol_fina_medi_init[fc] or isol_fina[fc] then set_attribute(first,state,4) -- isol - if trace_analyzing then fcs(first,"font:isol") end + if trace_analyzing then setnodecolor(first,"font:isol") end else warning(first,"isol") set_attribute(first,state,0) -- error - if trace_analyzing then fcr(first) end + if trace_analyzing then resetnodecolor(first) end end first = nil end return first, last end -function fonts.analyzers.methods.arab(head,font,attr) -- maybe make a special version with no trace +function methods.arab(head,font,attr) -- maybe make a special version with no trace + local useunicodemarks = analyzers.useunicodemarks local tfmdata = fontdata[font] - local marks = tfmdata.marks + local marks = tfmdata.resources.marks local first, last, current, done = nil, nil, head, false while current do - if current.id == glyph and current.subtype<256 and current.font == font and not has_attribute(current,state) then + if current.id == glyph_code and current.subtype<256 and current.font == font and not has_attribute(current,state) then done = true local char = current.char - if marks[char] then + if marks[char] or (useunicodemarks and categories[char] == "mn") then set_attribute(current,state,5) -- mark - if trace_analyzing then fcs(current,"font:mark") end + if trace_analyzing then setnodecolor(current,"font:mark") end elseif isol[char] then -- can be zwj or zwnj too first, last = finish(first,last) set_attribute(current,state,4) -- isol - if trace_analyzing then fcs(current,"font:isol") end + if trace_analyzing then setnodecolor(current,"font:isol") end first, last = nil, nil elseif not first then if isol_fina_medi_init[char] then set_attribute(current,state,1) -- init - if trace_analyzing then fcs(current,"font:init") end + if trace_analyzing then setnodecolor(current,"font:init") end first, last = first or current, current elseif isol_fina[char] then set_attribute(current,state,4) -- isol - if trace_analyzing then fcs(current,"font:isol") end + if trace_analyzing then setnodecolor(current,"font:isol") end first, last = nil, nil else -- no arab first, last = finish(first,last) @@ -260,18 +326,18 @@ function fonts.analyzers.methods.arab(head,font,attr) -- maybe make a special ve elseif isol_fina_medi_init[char] then first, last = first or current, current set_attribute(current,state,2) -- medi - if trace_analyzing then fcs(current,"font:medi") end + if trace_analyzing then setnodecolor(current,"font:medi") end elseif isol_fina[char] then if not has_attribute(last,state,1) then -- tricky, we need to check what last may be ! set_attribute(last,state,2) -- medi - if trace_analyzing then fcs(last,"font:medi") end + if trace_analyzing then setnodecolor(last,"font:medi") end end set_attribute(current,state,3) -- fina - if trace_analyzing then fcs(current,"font:fina") end + if trace_analyzing then setnodecolor(current,"font:fina") end first, last = nil, nil elseif char >= 0x0600 and char <= 0x06FF then - if trace_analyzing then fcs(current,"font:rest") end + if trace_analyzing then setnodecolor(current,"font:rest") end first, last = finish(first,last) else --no first, last = finish(first,last) @@ -284,3 +350,7 @@ function fonts.analyzers.methods.arab(head,font,attr) -- maybe make a special ve first, last = finish(first,last) return head, done end + +directives.register("otf.analyze.useunicodemarks",function(v) + analyzers.useunicodemarks = v +end) diff --git a/Master/texmf-dist/tex/context/base/font-otb.lua b/Master/texmf-dist/tex/context/base/font-otb.lua index a3d347737c8..1a812c328cb 100644 --- a/Master/texmf-dist/tex/context/base/font-otb.lua +++ b/Master/texmf-dist/tex/context/base/font-otb.lua @@ -5,43 +5,44 @@ if not modules then modules = { } end modules ['font-otb'] = { copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } - local concat = table.concat local format, gmatch, gsub, find, match, lower, strip = string.format, string.gmatch, string.gsub, string.find, string.match, string.lower, string.strip local type, next, tonumber, tostring = type, next, tonumber, tostring local lpegmatch = lpeg.match +local utfchar = utf.char -local otf = fonts.otf -local tfm = fonts.tfm +local trace_baseinit = false trackers.register("otf.baseinit", function(v) trace_baseinit = v end) +local trace_singles = false trackers.register("otf.singles", function(v) trace_singles = v end) +local trace_multiples = false trackers.register("otf.multiples", function(v) trace_multiples = v end) +local trace_alternatives = false trackers.register("otf.alternatives", function(v) trace_alternatives = v end) +local trace_ligatures = false trackers.register("otf.ligatures", function(v) trace_ligatures = v end) +local trace_kerns = false trackers.register("otf.kerns", function(v) trace_kerns = v end) +local trace_preparing = false trackers.register("otf.preparing", function(v) trace_preparing = v end) -local trace_baseinit = false trackers.register("otf.baseinit", function(v) trace_baseinit = v end) -local trace_singles = false trackers.register("otf.singles", function(v) trace_singles = v end) -local trace_multiples = false trackers.register("otf.multiples", function(v) trace_multiples = v end) -local trace_alternatives = false trackers.register("otf.alternatives", function(v) trace_alternatives = v end) -local trace_ligatures = false trackers.register("otf.ligatures", function(v) trace_ligatures = v end) -local trace_kerns = false trackers.register("otf.kerns", function(v) trace_kerns = v end) -local trace_preparing = false trackers.register("otf.preparing", function(v) trace_preparing = v end) +local report_prepare = logs.reporter("fonts","otf prepare") -local wildcard = "*" -local default = "dflt" +local fonts = fonts +local otf = fonts.handlers.otf -local split_at_space = lpeg.Ct(lpeg.splitat(" ")) -- no trailing or multiple spaces anyway +local otffeatures = fonts.constructors.newfeatures("otf") +local registerotffeature = otffeatures.register -local pcache, fcache = { }, { } -- could be weak +local wildcard = "*" +local default = "dflt" local function gref(descriptions,n) if type(n) == "number" then local name = descriptions[n].name if name then - return format("U+%04X (%s)",n,name) + return format("U+%05X (%s)",n,name) else - return format("U+%04X") + return format("U+%05X") end elseif n then local num, nam = { }, { } - for i=1,#n do + for i=2,#n do -- first is likely a key local ni = n[i] - num[i] = format("U+%04X",ni) + num[i] = format("U+%05X",ni) nam[i] = descriptions[ni].name or "?" end return format("%s (%s)",concat(num," "), concat(nam," ")) @@ -50,324 +51,531 @@ local function gref(descriptions,n) end end -local function cref(kind,lookupname) +local function cref(feature,lookupname) if lookupname then - return format("feature %s, lookup %s",kind,lookupname) + return format("feature %s, lookup %s",feature,lookupname) else - return format("feature %s",kind) + return format("feature %s",feature) end end -local function resolve_ligatures(tfmdata,ligatures,kind) - kind = kind or "unknown" - local unicodes = tfmdata.unicodes - local characters = tfmdata.characters - local descriptions = tfmdata.descriptions - local changed = tfmdata.changed - local done = { } - while true do - local ok = false - for k,v in next, ligatures do - local lig = v[1] - if not done[lig] then - local ligs = lpegmatch(split_at_space,lig) - if #ligs == 2 then - local uc = v[2] - local c, f, s = characters[uc], ligs[1], ligs[2] - local uft, ust = unicodes[f] or 0, unicodes[s] or 0 - if not uft or not ust then - logs.report("define otf","%s: unicode problem with base ligature %s = %s + %s",cref(kind),gref(descriptions,uc),gref(descriptions,uft),gref(descriptions,ust)) - -- some kind of error - else - if type(uft) == "number" then uft = { uft } end - if type(ust) == "number" then ust = { ust } end - for ufi=1,#uft do - local uf = uft[ufi] - for usi=1,#ust do - local us = ust[usi] - if changed[uf] or changed[us] then - if trace_baseinit and trace_ligatures then - logs.report("define otf","%s: base ligature %s + %s ignored",cref(kind),gref(descriptions,uf),gref(descriptions,us)) - end - else - local first, second = characters[uf], us - if first and second then - local t = first.ligatures - if not t then - t = { } - first.ligatures = t - end - if type(uc) == "number" then - t[second] = { type = 0, char = uc } - else - t[second] = { type = 0, char = uc[1] } -- can this still happen? - end - if trace_baseinit and trace_ligatures then - logs.report("define otf","%s: base ligature %s + %s => %s",cref(kind),gref(descriptions,uf),gref(descriptions,us),gref(descriptions,uc)) - end - end +local basemethods = { } +local basemethod = "" + +local function applybasemethod(what,...) + local m = basemethods[basemethod][what] + if m then + return m(...) + end +end + +-- We need to make sure that luatex sees the difference between +-- base fonts that have different glyphs in the same slots in fonts +-- that have the same fullname (or filename). LuaTeX will merge fonts +-- eventually (and subset later on). If needed we can use a more +-- verbose name as long as we don't use <()<>[]{}/%> and the length +-- is < 128. + +local basehash, basehashes, applied = { }, 1, { } + +local function registerbasehash(tfmdata) + local properties = tfmdata.properties + local hash = concat(applied," ") + local base = basehash[hash] + if not base then + basehashes = basehashes + 1 + base = basehashes + basehash[hash] = base + end + properties.basehash = base + properties.fullname = properties.fullname .. "-" .. base + -- report_prepare("fullname base hash: '%s', featureset '%s'",tfmdata.properties.fullname,hash) + applied = { } +end + +local function registerbasefeature(feature,value) + applied[#applied+1] = feature .. "=" .. tostring(value) +end + +-- The original basemode ligature builder used the names of components +-- and did some expression juggling to get the chain right. The current +-- variant starts with unicodes but still uses names to make the chain. +-- This is needed because we have to create intermediates when needed +-- but use predefined snippets when available. To some extend the +-- current builder is more stupid but I don't worry that much about it +-- as ligatures are rather predicatable. +-- +-- Personally I think that an ff + i == ffi rule as used in for instance +-- latin modern is pretty weird as no sane person will key that in and +-- expect a glyph for that ligature plus the following character. Anyhow, +-- as we need to deal with this, we do, but no guarantes are given. +-- +-- latin modern dejavu +-- +-- f+f 102 102 102 102 +-- f+i 102 105 102 105 +-- f+l 102 108 102 108 +-- f+f+i 102 102 105 +-- f+f+l 102 102 108 102 102 108 +-- ff+i 64256 105 64256 105 +-- ff+l 64256 108 +-- +-- As you can see here, latin modern is less complete than dejavu but +-- in practice one will not notice it. +-- +-- The while loop is needed because we need to resolve for instance +-- pseudo names like hyphen_hyphen to endash so in practice we end +-- up with a bit too many definitions but the overhead is neglectable. +-- +-- Todo: if changed[first] or changed[second] then ... end + +local trace = false + +local function finalize_ligatures(tfmdata,ligatures) + local nofligatures = #ligatures + if nofligatures > 0 then + local characters = tfmdata.characters + local descriptions = tfmdata.descriptions + local resources = tfmdata.resources + local unicodes = resources.unicodes + local private = resources.private + local alldone = false + while not alldone do + local done = 0 + for i=1,nofligatures do + local ligature = ligatures[i] + if ligature then + local unicode, lookupdata = ligature[1], ligature[2] + if trace then + print("BUILDING",concat(lookupdata," "),unicode) + end + local size = #lookupdata + local firstcode = lookupdata[1] -- [2] + local firstdata = characters[firstcode] + local okay = false + if firstdata then + local firstname = "ctx_" .. firstcode + for i=1,size-1 do -- for i=2,size-1 do + local firstdata = characters[firstcode] + if not firstdata then + firstcode = private + if trace then + print(" DEFINING",firstname,firstcode) + end + unicodes[firstname] = firstcode + firstdata = { intermediate = true, ligatures = { } } + characters[firstcode] = firstdata + descriptions[firstcode] = { name = firstname } + private = private + 1 + end + local target + local secondcode = lookupdata[i+1] + local secondname = firstname .. "_" .. secondcode + if i == size - 1 then + target = unicode + if not unicodes[secondname] then + unicodes[secondname] = unicode -- map final ligature onto intermediates + end + okay = true + else + target = unicodes[secondname] + if not target then + break end end + if trace then + print("CODES",firstname,firstcode,secondname,secondcode,target) + end + local firstligs = firstdata.ligatures + if firstligs then + firstligs[secondcode] = { char = target } + else + firstdata.ligatures = { [secondcode] = { char = target } } + end + firstcode = target + firstname = secondname end end - ok, done[lig] = true, descriptions[uc].name + if okay then + ligatures[i] = false + done = done + 1 + end end end + alldone = done == 0 end - if ok then - -- done has "a b c" = "a_b_c" and ligatures the already set ligatures: "a b" = 123 - -- and here we add extras (f i i = fi + i and alike) - -- - -- we could use a hash for fnc and pattern - -- - -- this might be interfering ! - for d,n in next, done do - local pattern = pcache[d] if not pattern then pattern = "^(" .. d .. ") " pcache[d] = pattern end - local fnc = fcache[n] if not fnc then fnc = function() return n .. " " end fcache[n] = fnc end - for k,v in next, ligatures do - v[1] = gsub(v[1],pattern,fnc) - end + if trace then + for k, v in next, characters do + if v.ligatures then table.print(v,k) end end - else - break end + tfmdata.resources.private = private end end -local splitter = lpeg.splitat(" ") - -function prepare_base_substitutions(tfmdata,kind,value) -- we can share some code with the node features - if value then - local otfdata = tfmdata.shared.otfdata - local validlookups, lookuplist = otf.collect_lookups(otfdata,kind,tfmdata.script,tfmdata.language) - if validlookups then - local ligatures = { } - local unicodes = tfmdata.unicodes -- names to unicodes - local indices = tfmdata.indices - local characters = tfmdata.characters - local descriptions = tfmdata.descriptions - local changed = tfmdata.changed - -- - local actions = { - substitution = function(p,lookup,k,glyph,unicode) - local pv = p[2] -- p.variant - if pv then - local upv = unicodes[pv] - if upv then - if type(upv) == "table" then - upv = upv[1] - end - if characters[upv] then - if trace_baseinit and trace_singles then - logs.report("define otf","%s: base substitution %s => %s",cref(kind,lookup),gref(descriptions,k),gref(descriptions,upv)) - end - changed[k] = upv - end - end - end - end, - alternate = function(p,lookup,k,glyph,unicode) - local pc = p[2] -- p.components - if pc then - -- a bit optimized ugliness - if value == 1 then - pc = lpegmatch(splitter,pc) - elseif value == 2 then - local a, b = lpegmatch(splitter,pc) - pc = b or a - else - pc = { lpegmatch(splitter,pc) } - pc = pc[value] or pc[#pc] - end - if pc then - local upc = unicodes[pc] - if upc then - if type(upc) == "table" then - upc = upc[1] - end - if characters[upc] then - if trace_baseinit and trace_alternatives then - logs.report("define otf","%s: base alternate %s %s => %s",cref(kind,lookup),tostring(value),gref(descriptions,k),gref(descriptions,upc)) - end - changed[k] = upc - end - end - end - end - end, - ligature = function(p,lookup,k,glyph,unicode) - local pc = p[2] - if pc then - if trace_baseinit and trace_ligatures then - local upc = { lpegmatch(splitter,pc) } - for i=1,#upc do upc[i] = unicodes[upc[i]] end - -- we assume that it's no table - logs.report("define otf","%s: base ligature %s => %s",cref(kind,lookup),gref(descriptions,upc),gref(descriptions,k)) - end - ligatures[#ligatures+1] = { pc, k } - end - end, - } - -- - for k,c in next, characters do - local glyph = descriptions[k] - local lookups = glyph.slookups - if lookups then - for l=1,#lookuplist do - local lookup = lookuplist[l] - local p = lookups[lookup] - if p then - local a = actions[p[1]] - if a then - a(p,lookup,k,glyph,unicode) - end - end +local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplist) + local characters = tfmdata.characters + local descriptions = tfmdata.descriptions + local resources = tfmdata.resources + local changed = tfmdata.changed + local unicodes = resources.unicodes + local lookuphash = resources.lookuphash + local lookuptypes = resources.lookuptypes + + local ligatures = { } + + local actions = { + substitution = function(lookupdata,lookupname,description,unicode) + if trace_baseinit and trace_singles then + report_prepare("%s: base substitution %s => %s",cref(feature,lookupname), + gref(descriptions,unicode),gref(descriptions,replacement)) + end + changed[unicode] = lookupdata + end, + alternate = function(lookupdata,lookupname,description,unicode) + local replacement = lookupdata[value] or lookupdata[#lookupdata] + if trace_baseinit and trace_alternatives then + report_prepare("%s: base alternate %s %s => %s",cref(feature,lookupname), + tostring(value),gref(descriptions,unicode),gref(descriptions,replacement)) + end + changed[unicode] = replacement + end, + ligature = function(lookupdata,lookupname,description,unicode) + if trace_baseinit and trace_alternatives then + report_prepare("%s: base ligature %s %s => %s",cref(feature,lookupname), + tostring(value),gref(descriptions,lookupdata),gref(descriptions,unicode)) + end + ligatures[#ligatures+1] = { unicode, lookupdata } + end, + } + + for unicode, character in next, characters do + local description = descriptions[unicode] + local lookups = description.slookups + if lookups then + for l=1,#lookuplist do + local lookupname = lookuplist[l] + local lookupdata = lookups[lookupname] + if lookupdata then + local lookuptype = lookuptypes[lookupname] + local action = actions[lookuptype] + if action then + action(lookupdata,lookupname,description,unicode) end end - local lookups = glyph.mlookups - if lookups then - for l=1,#lookuplist do - local lookup = lookuplist[l] - local ps = lookups[lookup] - if ps then - for i=1,#ps do - local p = ps[i] - local a = actions[p[1]] - if a then - a(p,lookup,k,glyph,unicode) - end - end + end + end + local lookups = description.mlookups + if lookups then + for l=1,#lookuplist do + local lookupname = lookuplist[l] + local lookuplist = lookups[lookupname] + if lookuplist then + local lookuptype = lookuptypes[lookupname] + local action = actions[lookuptype] + if action then + for i=1,#lookuplist do + action(lookuplist[i],lookupname,description,unicode) end end end end - resolve_ligatures(tfmdata,ligatures,kind) end - else - tfmdata.ligatures = tfmdata.ligatures or { } -- left over from what ? end + + finalize_ligatures(tfmdata,ligatures) end -local function prepare_base_kerns(tfmdata,kind,value) -- todo what kind of kerns, currently all - if value then - local otfdata = tfmdata.shared.otfdata - local validlookups, lookuplist = otf.collect_lookups(otfdata,kind,tfmdata.script,tfmdata.language) - if validlookups then - local unicodes = tfmdata.unicodes -- names to unicodes - local indices = tfmdata.indices - local characters = tfmdata.characters - local descriptions = tfmdata.descriptions - local sharedkerns = { } - for u, chr in next, characters do - local d = descriptions[u] - if d then - local dk = d.mykerns -- shared - if dk then - local s = sharedkerns[dk] - if s == false then - -- skip - elseif s then - chr.kerns = s - else - local t, done = chr.kerns or { }, false - for l=1,#lookuplist do - local lookup = lookuplist[l] - local kerns = dk[lookup] - if kerns then - for k, v in next, kerns do - if v ~= 0 and not t[k] then -- maybe no 0 test here - t[k], done = v, true - if trace_baseinit and trace_kerns then - logs.report("define otf","%s: base kern %s + %s => %s",cref(kind,lookup),gref(descriptions,u),gref(descriptions,k),v) - end - end - end +local function preparepositionings(tfmdata,feature,value,validlookups,lookuplist) -- todo what kind of kerns, currently all + local characters = tfmdata.characters + local descriptions = tfmdata.descriptions + local resources = tfmdata.resources + local unicodes = resources.unicodes + local sharedkerns = { } + local traceindeed = trace_baseinit and trace_kerns + for unicode, character in next, characters do + local description = descriptions[unicode] + local rawkerns = description.kerns -- shared + if rawkerns then + local s = sharedkerns[rawkerns] + if s == false then + -- skip + elseif s then + character.kerns = s + else + local newkerns = character.kerns + local done = false + for l=1,#lookuplist do + local lookup = lookuplist[l] + local kerns = rawkerns[lookup] + if kerns then + for otherunicode, value in next, kerns do + if value == 0 then + -- maybe no 0 test here + elseif not newkerns then + newkerns = { [otherunicode] = value } + done = true + if traceindeed then + report_prepare("%s: base kern %s + %s => %s",cref(feature,lookup), + gref(descriptions,unicode),gref(descriptions,otherunicode),value) + end + elseif not newkerns[otherunicode] then -- first wins + newkerns[otherunicode] = value + done = true + if traceindeed then + report_prepare("%s: base kern %s + %s => %s",cref(feature,lookup), + gref(descriptions,unicode),gref(descriptions,otherunicode),value) end - end - if done then - sharedkerns[dk] = t - chr.kerns = t -- no empty assignments - else - sharedkerns[dk] = false end end end end + if done then + sharedkerns[rawkerns] = newkerns + character.kerns = newkerns -- no empty assignments + else + sharedkerns[rawkerns] = false + end end end end end --- In principle we could register each feature individually which was --- what we did in earlier versions. However, after the rewrite it --- made more sense to collect them in an overall features initializer --- just as with the node variant. There it was needed because we need --- to do complete mixed runs and not run featurewise (as we did before). - -local supported_gsub = { - 'liga', 'dlig', 'rlig', 'hlig', - 'pnum', 'onum', 'tnum', 'lnum', - 'zero', - 'smcp', 'cpsp', 'c2sc', 'ornm', 'aalt', - 'hwid', 'fwid', - 'ssty', 'rtlm', -- math --- 'tlig', 'trep', +basemethods.independent = { + preparesubstitutions = preparesubstitutions, + preparepositionings = preparepositionings, } -local supported_gpos = { - 'kern' -} +local function makefake(tfmdata,name,present) + local resources = tfmdata.resources + local private = resources.private + local character = { intermediate = true, ligatures = { } } + resources.unicodes[name] = private + tfmdata.characters[private] = character + tfmdata.descriptions[private] = { name = name } + resources.private = private + 1 + present[name] = private + return character +end + +local function make_1(present,tree,name) + for k, v in next, tree do + if k == "ligature" then + present[name] = v + else + make_1(present,v,name .. "_" .. k) + end + end +end + +local function make_2(present,tfmdata,characters,tree,name,preceding,unicode,done,lookupname) + for k, v in next, tree do + if k == "ligature" then + local character = characters[preceding] + if not character then + if trace_baseinit then + report_prepare("weird ligature in lookup %s: U+%05X (%s), preceding U+%05X (%s)",lookupname,v,utfchar(v),preceding,utfchar(preceding)) + end + character = makefake(tfmdata,name,present) + end + local ligatures = character.ligatures + if ligatures then + ligatures[unicode] = { char = v } + else + character.ligatures = { [unicode] = { char = v } } + end + if done then + local d = done[lookupname] + if not d then + done[lookupname] = { "dummy", v } + else + d[#d+1] = v + end + end + else + local code = present[name] or unicode + local name = name .. "_" .. k + make_2(present,tfmdata,characters,v,name,code,k,done,lookupname) + end + end +end + +local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplist) + local characters = tfmdata.characters + local descriptions = tfmdata.descriptions + local resources = tfmdata.resources + local changed = tfmdata.changed + local lookuphash = resources.lookuphash + local lookuptypes = resources.lookuptypes + + local ligatures = { } + + for l=1,#lookuplist do + local lookupname = lookuplist[l] + local lookupdata = lookuphash[lookupname] + local lookuptype = lookuptypes[lookupname] + for unicode, data in next, lookupdata do + if lookuptype == "substitution" then + if trace_baseinit and trace_singles then + report_prepare("%s: base substitution %s => %s",cref(feature,lookupname), + gref(descriptions,unicode),gref(descriptions,data)) + end + changed[unicode] = data + elseif lookuptype == "alternate" then + local replacement = data[value] or data[#data] + if trace_baseinit and trace_alternatives then + report_prepare("%s: base alternate %s %s => %s",cref(feature,lookupname), + tostring(value),gref(descriptions,unicode),gref(descriptions,replacement)) + end + changed[unicode] = replacement + elseif lookuptype == "ligature" then + ligatures[#ligatures+1] = { unicode, data, lookupname } + end + end + end + + local nofligatures = #ligatures + + if nofligatures > 0 then + + local characters = tfmdata.characters + local present = { } + local done = trace_baseinit and trace_ligatures and { } + + for i=1,nofligatures do + local ligature = ligatures[i] + local unicode, tree = ligature[1], ligature[2] + make_1(present,tree,"ctx_"..unicode) + end + + for i=1,nofligatures do + local ligature = ligatures[i] + local unicode, tree, lookupname = ligature[1], ligature[2], ligature[3] + make_2(present,tfmdata,characters,tree,"ctx_"..unicode,unicode,unicode,done,lookupname) + end + + if done then + for lookupname, list in next, done do + report_prepare("%s: base ligatures %s => %s",cref(feature,lookupname), + tostring(value),gref(descriptions,done)) + end + end + + end + +end + +local function preparepositionings(tfmdata,feature,value,validlookups,lookuplist) + local characters = tfmdata.characters + local descriptions = tfmdata.descriptions + local resources = tfmdata.resources + local lookuphash = resources.lookuphash + local traceindeed = trace_baseinit and trace_kerns + + -- check out this sharedkerns trickery + + for l=1,#lookuplist do + local lookupname = lookuplist[l] + local lookupdata = lookuphash[lookupname] + for unicode, data in next, lookupdata do + local character = characters[unicode] + local kerns = character.kerns + if not kerns then + kerns = { } + character.kerns = kerns + end + if traceindeed then + for otherunicode, kern in next, data do + if not kerns[otherunicode] and kern ~= 0 then + kerns[otherunicode] = kern + report_prepare("%s: base kern %s + %s => %s",cref(feature,lookup), + gref(descriptions,unicode),gref(descriptions,otherunicode),kern) + end + end + else + for otherunicode, kern in next, data do + if not kerns[otherunicode] and kern ~= 0 then + kerns[otherunicode] = kern + end + end + end + end + end -function otf.features.register_base_substitution(tag) - supported_gsub[#supported_gsub+1] = tag end -function otf.features.register_base_kern(tag) - supported_gsub[#supported_gpos+1] = tag + +local function initializehashes(tfmdata) + nodeinitializers.features(tfmdata) end -local basehash, basehashes = { }, 1 +basemethods.shared = { + initializehashes = initializehashes, + preparesubstitutions = preparesubstitutions, + preparepositionings = preparepositionings, +} + +basemethod = "independent" -function fonts.initializers.base.otf.features(tfmdata,value) +local function featuresinitializer(tfmdata,value) if true then -- value then - -- not shared local t = trace_preparing and os.clock() local features = tfmdata.shared.features if features then - local h = { } - for f=1,#supported_gsub do - local feature = supported_gsub[f] - local value = features[feature] - prepare_base_substitutions(tfmdata,feature,value) - if value then - h[#h+1] = feature .. "=" .. tostring(value) + applybasemethod("initializehashes",tfmdata) + local collectlookups = otf.collectlookups + local rawdata = tfmdata.shared.rawdata + local properties = tfmdata.properties + local script = properties.script + local language = properties.language + local basesubstitutions = rawdata.resources.features.gsub + local basepositionings = rawdata.resources.features.gpos + if basesubstitutions then + for feature, data in next, basesubstitutions do + local value = features[feature] + if value then + local validlookups, lookuplist = collectlookups(rawdata,feature,script,language) + if validlookups then + applybasemethod("preparesubstitutions",tfmdata,feature,value,validlookups,lookuplist) + registerbasefeature(feature,value) + end + end end end - for f=1,#supported_gpos do - local feature = supported_gpos[f] - local value = features[feature] - prepare_base_kerns(tfmdata,feature,features[feature]) - if value then - h[#h+1] = feature .. "=" .. tostring(value) + if basepositions then + for feature, data in next, basepositions do + local value = features[feature] + if value then + local validlookups, lookuplist = collectlookups(rawdata,feature,script,language) + if validlookups then + applybasemethod("preparepositionings",tfmdata,feature,features[feature],validlookups,lookuplist) + registerbasefeature(feature,value) + end + end end end - local hash = concat(h," ") - local base = basehash[hash] - if not base then - basehashes = basehashes + 1 - base = basehashes - basehash[hash] = base - end - -- We need to make sure that luatex sees the difference between - -- base fonts that have different glyphs in the same slots in fonts - -- that have the same fullname (or filename). LuaTeX will merge fonts - -- eventually (and subset later on). If needed we can use a more - -- verbose name as long as we don't use <()<>[]{}/%> and the length - -- is < 128. - tfmdata.fullname = tfmdata.fullname .. "-" .. base -- tfmdata.psname is the original - --~ logs.report("otf define","fullname base hash: '%s', featureset '%s'",tfmdata.fullname,hash) + registerbasehash(tfmdata) end if trace_preparing then - logs.report("otf define","preparation time is %0.3f seconds for %s",os.clock()-t,tfmdata.fullname or "?") + report_prepare("preparation time is %0.3f seconds for %s",os.clock()-t,tfmdata.properties.fullname or "?") end end end + +registerotffeature { + name = "features", + description = "features", + default = true, + initializers = { +--~ position = 1, -- after setscript (temp hack ... we need to force script / language to 1 + base = featuresinitializer, + } +} + +-- independent : collect lookups independently (takes more runtime ... neglectable) +-- shared : shares lookups with node mode (takes more memory ... noticeable) + +directives.register("fonts.otf.loader.basemethod", function(v) + if basemethods[v] then + basemethod = v + end +end) diff --git a/Master/texmf-dist/tex/context/base/font-otc.lua b/Master/texmf-dist/tex/context/base/font-otc.lua index 357d347b18c..1b4983ce01a 100644 --- a/Master/texmf-dist/tex/context/base/font-otc.lua +++ b/Master/texmf-dist/tex/context/base/font-otc.lua @@ -8,206 +8,257 @@ if not modules then modules = { } end modules ['font-otc'] = { local format, insert = string.format, table.insert local type, next = type, next +local lpegmatch = lpeg.match -- we assume that the other otf stuff is loaded already -local trace_loading = false trackers.register("otf.loading", function(v) trace_loading = v end) - -local otf = fonts.otf -local tfm = fonts.tfm - --- instead of "script = "DFLT", langs = { 'dflt' }" we now use wildcards (we used to --- have always); some day we can write a "force always when true" trick for other --- features as well --- --- we could have a tnum variant as well - -local extra_lists = { - tlig = { - { - endash = "hyphen hyphen", - emdash = "hyphen hyphen hyphen", - -- quotedblleft = "quoteleft quoteleft", - -- quotedblright = "quoteright quoteright", - -- quotedblleft = "grave grave", - -- quotedblright = "quotesingle quotesingle", - -- quotedblbase = "comma comma", - }, - }, - trep = { - { - -- [0x0022] = 0x201D, - [0x0027] = 0x2019, - -- [0x0060] = 0x2018, - }, - }, - anum = { - { -- arabic - [0x0030] = 0x0660, - [0x0031] = 0x0661, - [0x0032] = 0x0662, - [0x0033] = 0x0663, - [0x0034] = 0x0664, - [0x0035] = 0x0665, - [0x0036] = 0x0666, - [0x0037] = 0x0667, - [0x0038] = 0x0668, - [0x0039] = 0x0669, - }, - { -- persian - [0x0030] = 0x06F0, - [0x0031] = 0x06F1, - [0x0032] = 0x06F2, - [0x0033] = 0x06F3, - [0x0034] = 0x06F4, - [0x0035] = 0x06F5, - [0x0036] = 0x06F6, - [0x0037] = 0x06F7, - [0x0038] = 0x06F8, - [0x0039] = 0x06F9, - }, - }, -} +local trace_loading = false trackers.register("otf.loading", function(v) trace_loading = v end) +local report_otf = logs.reporter("fonts","otf loading") -local extra_features = { -- maybe just 1..n so that we prescribe order - tlig = { - { - features = { { scripts = { { script = "*", langs = { "*" }, } }, tag = "tlig", comment = "added bij mkiv" }, }, - name = "ctx_tlig_1", - subtables = { { name = "ctx_tlig_1_s" } }, - type = "gsub_ligature", - flags = { }, - }, - }, - trep = { - { - features = { { scripts = { { script = "*", langs = { "*" }, } }, tag = "trep", comment = "added bij mkiv" }, }, - name = "ctx_trep_1", - subtables = { { name = "ctx_trep_1_s" } }, - type = "gsub_single", - flags = { }, - }, - }, - anum = { - { - features = { { scripts = { { script = "arab", langs = { "dflt", "FAR" }, } }, tag = "anum", comment = "added bij mkiv" }, }, - name = "ctx_anum_1", - subtables = { { name = "ctx_anum_1_s" } }, - type = "gsub_single", - flags = { }, - }, - { - features = { { scripts = { { script = "arab", langs = { "URD" }, } }, tag = "anum", comment = "added bij mkiv" }, }, - name = "ctx_anum_2", - subtables = { { name = "ctx_anum_2_s" } }, - type = "gsub_single", - flags = { }, - }, - }, +local fonts = fonts +local otf = fonts.handlers.otf +local otffeatures = fonts.constructors.newfeatures("otf") +local registerotffeature = otffeatures.register +local setmetatableindex = table.setmetatableindex + +-- In the userdata interface we can not longer tweak the loaded font as +-- conveniently as before. For instance, instead of pushing extra data in +-- in the table using the original structure, we now have to operate on +-- the mkiv representation. And as the fontloader interface is modelled +-- after fontforge we cannot change that one too much either. + +local types = { + substitution = "gsub_single", + ligature = "gsub_ligature", + alternate = "gsub_alternate", } -fonts.otf.enhancers["add some missing characters"] = function(data,filename) - -- todo -end +setmetatableindex(types, function(t,k) t[k] = k return k end) -- "key" -fonts.otf.enhancers["enrich with features"] = function(data,filename) - -- could be done elsewhere (true can be #) - local used = { } - for i=1,#otf.glists do - local g = data[otf.glists[i]] - if g then - for i=1,#g do - local f = g[i].features - if f then - for i=1,#f do - local t = f[i].tag - if t then used[t] = true end - end - end - end +local everywhere = { ["*"] = { ["*"] = true } } -- or: { ["*"] = { "*" } } +local noflags = { } + +local function addfeature(data,feature,specifications) + local descriptions = data.descriptions + local resources = data.resources + local lookups = resources.lookups + local gsubfeatures = resources.features.gsub + if gsubfeatures and gsubfeatures[feature] then + -- already present + else + local sequences = resources.sequences + local fontfeatures = resources.features + local unicodes = resources.unicodes + local lookuptypes = resources.lookuptypes + local splitter = lpeg.splitter(" ",unicodes) + local done = 0 + if not specifications[1] then + -- so we accept a one entry specification + specifications = { specifications } end - end - -- - local glyphs = data.glyphs - local indices = data.map.map - data.gsub = data.gsub or { } - for kind, specifications in next, extra_features do - if not used[kind] then - local done = 0 - for s=1,#specifications do - local added = false - local specification = specifications[s] - local list = extra_lists[kind][s] - local name = specification.name .. "_s" - if specification.type == "gsub_ligature" then - for unicode, index in next, indices do - local glyph = glyphs[index] - local ligature = list[glyph.name] - if ligature then - local o = glyph.lookups or { } - -- o[name] = { "ligature", ligature, glyph.name } - o[name] = { - { - ["type"] = "ligature", - ["specification"] = { - char = glyph.name, - components = ligature, - } - } - } - glyph.lookups, done, added = o, done+1, true + -- subtables are tables themselves but we also accept flattened singular subtables + for s=1,#specifications do + local specification = specifications[s] + local askedfeatures = specification.features or everywhere + local subtables = specification.subtables or { specification.data } or { } + local featuretype = types[specification.type or "substitution"] + local featureflags = specification.flags or noflags + local added = false + local featurename = format("ctx_%s_%s",feature,s) + local st = { } + for t=1,#subtables do + local list = subtables[t] + local full = format("%s_%s",featurename,t) + st[t] = full + if featuretype == "gsub_ligature" then + lookuptypes[full] = "ligature" + for code, ligature in next, list do + local unicode = tonumber(code) or unicodes[code] + local description = descriptions[unicode] + if description then + local slookups = description.slookups + if type(ligature) == "string" then + ligature = { lpegmatch(splitter,ligature) } + end + if slookups then + slookups[full] = ligature + else + description.slookups = { [full] = ligature } + end + done, added = done + 1, true end end - elseif specification.type == "gsub_single" then - for unicode, index in next, indices do - local glyph = glyphs[index] - local r = list[unicode] - if r then - local replacement = indices[r] - if replacement and glyphs[replacement] then - local o = glyph.lookups or { } - -- o[name] = { { "substitution", glyphs[replacement].name } } - o[name] = { - { - ["type"] = "substitution", - ["specification"] = { - variant = glyphs[replacement].name, - } - } - } - glyph.lookups, done, added = o, done+1, true + elseif featuretype == "gsub_single" then + lookuptypes[full] = "substitution" + for code, replacement in next, list do + local unicode = tonumber(code) or unicodes[code] + local description = descriptions[unicode] + if description then + local slookups = description.slookups + replacement = tonumber(replacement) or unicodes[replacement] + if slookups then + slookups[full] = replacement + else + description.slookups = { [full] = replacement } end + done, added = done + 1, true end end end - if added then - insert(data.gsub,s,table.fastcopy(specification)) -- right order - end end - if done > 0 then - if trace_loading then - logs.report("load otf","enhance: registering %s feature (%s glyphs affected)",kind,done) + if added then + -- script = { lang1, lang2, lang3 } or script = { lang1 = true, ... } + for k, v in next, askedfeatures do + if v[1] then + askedfeatures[k] = table.tohash(v) + end + end + sequences[#sequences+1] = { + chain = 0, + features = { [feature] = askedfeatures }, + flags = featureflags, + name = featurename, + subtables = st, + type = featuretype, + } + -- register in metadata (merge as there can be a few) + if not gsubfeatures then + gsubfeatures = { } + fontfeatures.gsub = gsubfeatures + end + local k = gsubfeatures[feature] + if not k then + k = { } + gsubfeatures[feature] = k + end + for script, languages in next, askedfeatures do + local kk = k[script] + if not kk then + kk = { } + k[script] = kk + end + for language, value in next, languages do + kk[language] = value + end end end end + if done > 0 and trace_loading then + report_otf("enhance: registering %s feature (%s glyphs affected)",feature,done) + end end end -otf.tables.features['tlig'] = 'TeX Ligatures' -otf.tables.features['trep'] = 'TeX Replacements' -otf.tables.features['anum'] = 'Arabic Digits' +otf.enhancers.addfeature = addfeature -otf.features.register_base_substitution('tlig') -otf.features.register_base_substitution('trep') -otf.features.register_base_substitution('anum') +local extrafeatures = { } --- the functionality is defined elsewhere +function otf.addfeature(name,specification) + extrafeatures[name] = specification +end -fonts.initializers.base.otf.equaldigits = fonts.initializers.common.equaldigits -fonts.initializers.node.otf.equaldigits = fonts.initializers.common.equaldigits +local function enhance(data,filename,raw) + for feature, specification in next, extrafeatures do + addfeature(data,feature,specification) + end +end -fonts.initializers.base.otf.lineheight = fonts.initializers.common.lineheight -fonts.initializers.node.otf.lineheight = fonts.initializers.common.lineheight +otf.enhancers.register("check extra features",enhance) -fonts.initializers.base.otf.compose = fonts.initializers.common.compose -fonts.initializers.node.otf.compose = fonts.initializers.common.compose +-- tlig -- + +local tlig = { + endash = "hyphen hyphen", + emdash = "hyphen hyphen hyphen", + -- quotedblleft = "quoteleft quoteleft", + -- quotedblright = "quoteright quoteright", + -- quotedblleft = "grave grave", + -- quotedblright = "quotesingle quotesingle", + -- quotedblbase = "comma comma", +} + +local tlig_specification = { + type = "ligature", + features = everywhere, -- { ["*"] = { ["*"] = true } }, + data = tlig, + flags = noflags, -- { }, +} + +otf.addfeature("tlig",tlig_specification) + +registerotffeature { + name = 'tlig', + description = 'tex ligatures', +} + +-- trep + +local trep = { + -- [0x0022] = 0x201D, + [0x0027] = 0x2019, + -- [0x0060] = 0x2018, +} + +local trep_specification = { + type = "substitution", + features = everywhere, -- { ["*"] = { ["*"] = true } }, + data = trep, + flags = noflags, -- { }, +} + +otf.addfeature("trep",trep_specification) + +registerotffeature { + name = 'trep', + description = 'tex replacements', +} + +-- anum + +local anum_arabic = { + [0x0030] = 0x0660, + [0x0031] = 0x0661, + [0x0032] = 0x0662, + [0x0033] = 0x0663, + [0x0034] = 0x0664, + [0x0035] = 0x0665, + [0x0036] = 0x0666, + [0x0037] = 0x0667, + [0x0038] = 0x0668, + [0x0039] = 0x0669, +} + +local anum_persian = { + [0x0030] = 0x06F0, + [0x0031] = 0x06F1, + [0x0032] = 0x06F2, + [0x0033] = 0x06F3, + [0x0034] = 0x06F4, + [0x0035] = 0x06F5, + [0x0036] = 0x06F6, + [0x0037] = 0x06F7, + [0x0038] = 0x06F8, + [0x0039] = 0x06F9, +} + +local anum_specification = { + { + type = "substitution", + features = { arab = { URD = true, dflt = true } }, + data = anum_arabic, + flags = noflags, -- { }, + }, + { + type = "substitution", + features = { arab = { URD = true } }, + data = anum_persian, + flags = noflags, -- { }, + }, +} + +otf.addfeature("anum",anum_specification) + +registerotffeature { + name = 'anum', + description = 'arabic digits', +} diff --git a/Master/texmf-dist/tex/context/base/font-otd.lua b/Master/texmf-dist/tex/context/base/font-otd.lua index 41e8853316c..b22889217cb 100644 --- a/Master/texmf-dist/tex/context/base/font-otd.lua +++ b/Master/texmf-dist/tex/context/base/font-otd.lua @@ -6,29 +6,49 @@ if not modules then modules = { } end modules ['font-otd'] = { license = "see context related readme files" } -local trace_dynamics = false trackers.register("otf.dynamics", function(v) trace_dynamics = v end) +local match = string.match -fonts = fonts or { } -fonts.otf = fonts.otf or { } +local trace_dynamics = false trackers.register("otf.dynamics", function(v) trace_dynamics = v end) +local trace_applied = false trackers.register("otf.applied", function(v) trace_applied = v end) -local otf = fonts.otf -local fontdata = fonts.ids +local report_otf = logs.reporter("fonts","otf loading") +local report_process = logs.reporter("fonts","otf process") -otf.features = otf.features or { } -otf.features.default = otf.features.default or { } +local fonts = fonts +local otf = fonts.handlers.otf +local fontdata = fonts.hashes.identifiers +local definers = fonts.definers +local constructors = fonts.constructors +local specifiers = fonts.specifiers -local context_setups = fonts.define.specify.context_setups -local context_numbers = fonts.define.specify.context_numbers +local contextsetups = specifiers.contextsetups +local contextnumbers = specifiers.contextnumbers +local contextmerged = specifiers.contextmerged -local a_to_script = { } otf.a_to_script = a_to_script -local a_to_language = { } otf.a_to_language = a_to_language +local setmetatableindex = table.setmetatableindex -function otf.set_dynamics(font,dynamics,attribute) - features = context_setups[context_numbers[attribute]] -- can be moved to caller +local otffeatures = fonts.constructors.newfeatures("otf") +local registerotffeature = otffeatures.register + +local fontdynamics = { } +fonts.hashes.dynamics = fontdynamics + +local a_to_script = { } +local a_to_language = { } + +setmetatableindex(fontdynamics, function(t,font) + local d = fontdata[font].shared.dynamics or false + t[font] = d + return d +end) + +function otf.setdynamics(font,attribute) + local features = contextsetups[contextnumbers[attribute]] -- can be moved to caller if features then + local dynamics = fontdynamics[font] local script = features.script or 'dflt' local language = features.language or 'dflt' - local ds = dynamics[script] + local ds = dynamics[script] -- can be metatable magic (less testing) if not ds then ds = { } dynamics[script] = ds @@ -39,40 +59,161 @@ function otf.set_dynamics(font,dynamics,attribute) ds[language] = dsl end local dsla = dsl[attribute] - if dsla then - -- if trace_dynamics then - -- logs.report("otf define","using dynamics %s: attribute %s, script %s, language %s",context_numbers[attribute],attribute,script,language) - -- end - return dsla - else + if not dsla then local tfmdata = fontdata[font] a_to_script [attribute] = script a_to_language[attribute] = language -- we need to save some values - local saved = { - script = tfmdata.script, - language = tfmdata.language, - mode = tfmdata.mode, - features = tfmdata.shared.features - } - tfmdata.mode = "node" - tfmdata.language = language - tfmdata.script = script - tfmdata.shared.features = { } + local properties = tfmdata.properties + local shared = tfmdata.shared + local s_script = properties.script + local s_language = properties.language + local s_mode = properties.mode + local s_features = shared.features + properties.mode = "node" + properties.language = language + properties.script = script + properties.dynamics = true -- handy for tracing + shared.features = { } -- end of save - dsla = otf.set_features(tfmdata,fonts.define.check(features,otf.features.default)) + local set = constructors.checkedfeatures("otf",features) +set.mode = "node" -- really needed + dsla = otf.setfeatures(tfmdata,set) if trace_dynamics then - logs.report("otf define","setting dynamics %s: attribute %s, script %s, language %s",context_numbers[attribute],attribute,script,language) + report_otf("setting dynamics %s: attribute %s, script %s, language %s, set: %s",contextnumbers[attribute],attribute,script,language,table.sequenced(set)) end -- we need to restore some values - tfmdata.script = saved.script - tfmdata.language = saved.language - tfmdata.mode = saved.mode - tfmdata.shared.features = saved.features + properties.script = s_script + properties.language = s_language + properties.mode = s_mode + shared.features = s_features -- end of restore dynamics[script][language][attribute] = dsla -- cache - return dsla + elseif trace_dynamics then + -- report_otf("using dynamics %s: attribute %s, script %s, language %s",contextnumbers[attribute],attribute,script,language) end + return dsla end - return nil -- { } +end + +function otf.scriptandlanguage(tfmdata,attr) + local properties = tfmdata.properties + if attr and attr > 0 then + return a_to_script[attr] or properties.script or "dflt", a_to_language[attr] or properties.language or "dflt" + else + return properties.script or "dflt", properties.language or "dflt" + end +end + +-- we reimplement the dataset resolver + +local special_attributes = { + init = 1, + medi = 2, + fina = 3, + isol = 4 +} + +local resolved = { } -- we only resolve a font,script,language,attribute pair once +local wildcard = "*" +local default = "dflt" + +local function initialize(sequence,script,language,s_enabled,a_enabled,font,attr,dynamic) + local features = sequence.features + if features then + for kind, scripts in next, features do + local s_e = s_enabled and s_enabled[kind] + local a_e = a_enabled and a_enabled[kind] + local e_e = s_e or a_e + if e_e then + local languages = scripts[script] or scripts[wildcard] + if languages then + local valid, what = false + -- not languages[language] or languages[default] or languages[wildcard] because we want tracing + -- only first attribute match check, so we assume simple fina's + -- default can become a font feature itself + if languages[language] then + valid = true + what = language + -- elseif languages[default] then + -- valid = true + -- what = default + elseif languages[wildcard] then + valid = true + what = wildcard + end + if valid then + local attribute = special_attributes[kind] or false + if a_e and dynamic < 0 then + valid = false + end + if trace_applied then + local typ, action = match(sequence.type,"(.*)_(.*)") -- brrr + report_process( + "%s font: %03i, dynamic: %03i, kind: %s, script: %-4s, language: %-4s (%-4s), type: %s, action: %s, name: %s", + (valid and "+") or "-",font,attr or 0,kind,script,language,what,typ,action,sequence.name) + end + return { valid, attribute, sequence.chain or 0, kind } + end + end + end + end + return false -- { valid, attribute, chain, "generic" } -- false anyway, could be flag instead of table + else + return false -- { false, false, chain } -- indirect lookup, part of chain (todo: make this a separate table) + end +end + +function otf.dataset(tfmdata,sequences,font,attr) + + local shared = tfmdata.shared + local properties = tfmdata.properties + + local script, language, s_enabled, a_enabled, dynamic + + if attr and attr ~= 0 then + local features = contextsetups[contextnumbers[attr]] -- could be a direct list + language = features.language or "dflt" + script = features.script or "dflt" + a_enabled = features + dynamic = contextmerged[attr] or 0 + if dynamic == 2 or dynamic == -2 then + -- font based + s_enabled = shared.features + end + else + language = properties.language or "dflt" + script = properties.script or "dflt" + s_enabled = shared.features -- can be made local to the resolver + dynamic = 0 + end + + local res = resolved[font] + if not res then + res = { } + resolved[font] = res + end + local rs = res[script] + if not rs then + rs = { } + res[script] = rs + end + local rl = rs[language] + if not rl then + rl = { } + rs[language] = rl + end + local ra = rl[attr] + if ra == nil then -- attr can be false + ra = { } + rl[attr] = ra + setmetatableindex(ra, function(t,k) + local v = initialize(sequences[k],script,language,s_enabled,a_enabled,font,attr,dynamic) + t[k] = v + return v + end) + end + + return ra + end diff --git a/Master/texmf-dist/tex/context/base/font-otf.lua b/Master/texmf-dist/tex/context/base/font-otf.lua index 9cecf21f055..36d18a2365f 100644 --- a/Master/texmf-dist/tex/context/base/font-otf.lua +++ b/Master/texmf-dist/tex/context/base/font-otf.lua @@ -6,120 +6,146 @@ if not modules then modules = { } end modules ['font-otf'] = { license = "see context related readme files" } +-- langs -> languages enz +-- anchor_classes vs kernclasses +-- modification/creationtime in subfont is runtime dus zinloos +-- to_table -> totable +-- ascent descent + local utf = unicode.utf8 -local concat, getn, utfbyte = table.concat, table.getn, utf.byte +local utfbyte = utf.byte local format, gmatch, gsub, find, match, lower, strip = string.format, string.gmatch, string.gsub, string.find, string.match, string.lower, string.strip local type, next, tonumber, tostring = type, next, tonumber, tostring local abs = math.abs +local getn = table.getn local lpegmatch = lpeg.match +local reversed, concat, remove = table.reversed, table.concat, table.remove +local ioflush = io.flush +local fastcopy, tohash = table.fastcopy, table.tohash + +local allocate = utilities.storage.allocate +local registertracker = trackers.register +local registerdirective = directives.register +local starttiming = statistics.starttiming +local stoptiming = statistics.stoptiming +local elapsedtime = statistics.elapsedtime +local findbinfile = resolvers.findbinfile + +local trace_private = false registertracker("otf.private", function(v) trace_private = v end) +local trace_loading = false registertracker("otf.loading", function(v) trace_loading = v end) +local trace_features = false registertracker("otf.features", function(v) trace_features = v end) +local trace_dynamics = false registertracker("otf.dynamics", function(v) trace_dynamics = v end) +local trace_sequences = false registertracker("otf.sequences", function(v) trace_sequences = v end) +local trace_markwidth = false registertracker("otf.markwidth", function(v) trace_markwidth = v end) +local trace_defining = false registertracker("fonts.defining", function(v) trace_defining = v end) + +local report_otf = logs.reporter("fonts","otf loading") + +local fonts = fonts +local otf = fonts.handlers.otf + +otf.glists = { "gsub", "gpos" } + +otf.version = 2.730 -- beware: also sync font-mis.lua +otf.cache = containers.define("fonts", "otf", otf.version, true) + +local fontdata = fonts.hashes.identifiers +local chardata = characters and characters.data -- not used + +local otffeatures = fonts.constructors.newfeatures("otf") +local registerotffeature = otffeatures.register + +local enhancers = allocate() +otf.enhancers = enhancers +local patches = { } +enhancers.patches = patches + +local definers = fonts.definers +local readers = fonts.readers +local constructors = fonts.constructors + +local forceload = false +local cleanup = 0 -- mk: 0=885M 1=765M 2=735M (regular run 730M) +local usemetatables = false -- .4 slower on mk but 30 M less mem so we might change the default -- will be directive +local packdata = true +local syncspace = true +local forcenotdef = false + +local wildcard = "*" +local default = "dflt" + +local fontloaderfields = fontloader.fields +local mainfields = nil +local glyphfields = nil -- not used yet + +registerdirective("fonts.otf.loader.cleanup", function(v) cleanup = tonumber(v) or (v and 1) or 0 end) +registerdirective("fonts.otf.loader.force", function(v) forceload = v end) +registerdirective("fonts.otf.loader.usemetatables", function(v) usemetatables = v end) +registerdirective("fonts.otf.loader.pack", function(v) packdata = v end) +registerdirective("fonts.otf.loader.syncspace", function(v) syncspace = v end) +registerdirective("fonts.otf.loader.forcenotdef", function(v) forcenotdef = v end) + +local function load_featurefile(raw,featurefile) + if featurefile and featurefile ~= "" then + if trace_loading then + report_otf("featurefile: %s", featurefile) + end + fontloader.apply_featurefile(raw, featurefile) + end +end -local trace_private = false trackers.register("otf.private", function(v) trace_private = v end) -local trace_loading = false trackers.register("otf.loading", function(v) trace_loading = v end) -local trace_features = false trackers.register("otf.features", function(v) trace_features = v end) -local trace_dynamics = false trackers.register("otf.dynamics", function(v) trace_dynamics = v end) -local trace_sequences = false trackers.register("otf.sequences", function(v) trace_sequences = v end) -local trace_math = false trackers.register("otf.math", function(v) trace_math = v end) -local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) - ---~ trackers.enable("otf.loading") - ---[[ldx-- -

The fontforge table has organized lookups in a certain way. A first implementation -of this code was organized featurewise: information related to features was -collected and processing boiled down to a run over the features. The current -implementation honors the order in the main feature table. Since we can reorder this -table as we want, we can eventually support several models of processing. We kept -the static as well as dynamic feature processing, because it had proved to be -rather useful. The formerly three loop variants have beem discarded but will -reapear at some time.

- - -we loop over all lookups -for each lookup we do a run over the list of glyphs -but we only process them for features that are enabled -if we're dealing with a contextual lookup, we loop over all contexts -in that loop we quit at a match and then process the list of sublookups -we always continue after the match - - -

In we do this for each font that is used in a list, so in -practice we have quite some nested loops.

- -

We process the whole list and then consult the glyph nodes. An alternative approach -is to collect strings of characters using the same font including spaces (because some -lookups involve spaces). However, we then need to reconstruct the list which is no fun. -Also, we need to carry quite some information, like attributes, so eventually we don't -gain much (if we gain something at all).

- -

Another consideration has been to operate on sublists (subhead, subtail) but again -this would complicate matters as we then neext to keep track of a changing subhead -and subtail. On the other hand, this might save some runtime. The number of changes -involved is not that large. This only makes sense when we have many fonts in a list -and don't change to frequently.

---ldx]]-- - -fonts = fonts or { } -fonts.otf = fonts.otf or { } -fonts.tfm = fonts.tfm or { } - -local otf = fonts.otf -local tfm = fonts.tfm - -local fontdata = fonts.ids - -otf.tables = otf.tables or { } -- defined in font-ott.lua -otf.meanings = otf.meanings or { } -- defined in font-ott.lua -otf.tables.features = otf.tables.features or { } -- defined in font-ott.lua -otf.tables.languages = otf.tables.languages or { } -- defined in font-ott.lua -otf.tables.scripts = otf.tables.scripts or { } -- defined in font-ott.lua - -otf.features = otf.features or { } -otf.features.list = otf.features.list or { } -otf.features.default = otf.features.default or { } - -otf.enhancers = otf.enhancers or { } -otf.glists = { "gsub", "gpos" } - -otf.version = 2.650 -- beware: also sync font-mis.lua -otf.pack = true -- beware: also sync font-mis.lua -otf.syncspace = true -otf.notdef = false -otf.cache = containers.define("fonts", "otf", otf.version, true) -otf.cleanup_aat = false -- only context - -local wildcard = "*" -local default = "dflt" +local function showfeatureorder(rawdata,filename) + local sequences = rawdata.resources.sequences + if sequences and #sequences > 0 then + if trace_loading then + report_otf("font %s has %s sequences",filename,#sequences) + report_otf(" ") + end + for nos=1,#sequences do + local sequence = sequences[nos] + local typ = sequence.type or "no-type" + local name = sequence.name or "no-name" + local subtables = sequence.subtables or { "no-subtables" } + local features = sequence.features + if trace_loading then + report_otf("%3i %-15s %-20s [%s]",nos,name,typ,concat(subtables,",")) + end + if features then + for feature, scripts in next, features do + local tt = { } + for script, languages in next, scripts do + local ttt = { } + for language, _ in next, languages do + ttt[#ttt+1] = language + end + tt[#tt+1] = format("[%s: %s]",script,concat(ttt," ")) + end + if trace_loading then + report_otf(" %s: %s",feature,concat(tt," ")) + end + end + end + end + if trace_loading then + report_otf("\n") + end + elseif trace_loading then + report_otf("font %s has no sequences",filename) + end +end --[[ldx--

We start with a lot of tables and related functions.

--ldx]]-- -otf.tables.global_fields = table.tohash { - "lookups", - "glyphs", - "subfonts", - "luatex", - "pfminfo", - "cidinfo", - "tables", - "names", - "unicodes", - "names", ---~ "math", - "anchor_classes", - "kern_classes", - "gpos", - "gsub" -} - -otf.tables.valid_fields = { - "anchor_classes", +local valid_fields = table.tohash { + -- "anchor_classes", "ascent", - "cache_version", + -- "cache_version", "cidinfo", "copyright", - "creationtime", + -- "creationtime", "descent", "design_range_bottom", "design_range_top", @@ -128,32 +154,32 @@ otf.tables.valid_fields = { "extrema_bound", "familyname", "fontname", + "fontname", "fontstyle_id", "fontstyle_name", "fullname", - "glyphs", + -- "glyphs", "hasvmetrics", - "head_optimized_for_cleartype", + -- "head_optimized_for_cleartype", "horiz_base", "issans", "isserif", "italicangle", - "kerns", - "lookups", - -- "luatex", + -- "kerns", + -- "lookups", "macstyle", - "modificationtime", + -- "modificationtime", "onlybitmaps", "origname", "os2_version", "pfminfo", - "private", + -- "private", "serifcheck", "sfd_version", -- "size", "strokedfont", "strokewidth", - "subfonts", + -- "subfonts", "table_version", -- "tables", -- "ttf_tab_saved", @@ -164,282 +190,704 @@ otf.tables.valid_fields = { "upos", "use_typo_metrics", "uwidth", - "validation_state", - "verbose", + -- "validation_state", "version", "vert_base", "weight", "weight_width_slope_only", - "xuid", + -- "xuid", +} + +local ordered_enhancers = { + "prepare tables", + "prepare glyphs", + "prepare lookups", + + "analyze glyphs", + "analyze math", + + "prepare tounicode", -- maybe merge with prepare + + "reorganize lookups", + "reorganize mark classes", + "reorganize anchor classes", + + "reorganize glyph kerns", + "reorganize glyph lookups", + "reorganize glyph anchors", + + "merge kern classes", + + "reorganize features", + "reorganize subtables", + + "check glyphs", + "check metadata", + "check extra features", -- after metadata + + "add duplicates", + "check encoding", + + "cleanup tables", } --[[ldx--

Here we go.

--ldx]]-- -local function load_featurefile(ff,featurefile) - if featurefile then - featurefile = resolvers.find_file(file.addsuffix(featurefile,'fea'),'fea') - if featurefile and featurefile ~= "" then - if trace_loading then - logs.report("load otf", "featurefile: %s", featurefile) - end - fontloader.apply_featurefile(ff, featurefile) +local actions = allocate() +local before = allocate() +local after = allocate() + +patches.before = before +patches.after = after + +local function enhance(name,data,filename,raw) + local enhancer = actions[name] + if enhancer then + if trace_loading then + report_otf("enhance: %s (%s)",name,filename) + ioflush() end + enhancer(data,filename,raw) + elseif trace_loading then + -- report_otf("enhance: %s is undefined",name) end end -function otf.enhance(name,data,filename,verbose) - local enhancer = otf.enhancers[name] - if enhancer then - if (verbose ~= nil and verbose) or trace_loading then - logs.report("load otf","enhance: %s (%s)",name,filename) +function enhancers.apply(data,filename,raw) + local basename = file.basename(lower(filename)) + if trace_loading then + report_otf("start enhancing: %s",filename) + end + ioflush() -- we want instant messages + for e=1,#ordered_enhancers do + local enhancer = ordered_enhancers[e] + local b = before[enhancer] + if b then + for pattern, action in next, b do + if find(basename,pattern) then + action(data,filename,raw) + end + end + end + enhance(enhancer,data,filename,raw) + local a = after[enhancer] + if a then + for pattern, action in next, a do + if find(basename,pattern) then + action(data,filename,raw) + end + end end - enhancer(data,filename) + ioflush() -- we want instant messages end + if trace_loading then + report_otf("stop enhancing") + end + ioflush() -- we want instant messages end -local enhancers = { - -- pack and unpack are handled separately; they might even be moved - -- away from the enhancers namespace - "patch bugs", - "merge cid fonts", "prepare unicode", "cleanup ttf tables", "compact glyphs", "reverse coverage", - "cleanup aat", "enrich with features", "add some missing characters", - "reorganize mark classes", - "reorganize kerns", -- moved here - "flatten glyph lookups", "flatten anchor tables", "flatten feature tables", - "simplify glyph lookups", -- some saving - "prepare luatex tables", - "analyse features", "rehash features", - "analyse anchors", "analyse marks", "analyse unicodes", "analyse subtables", - "check italic correction","check math", - "share widths", - "strip not needed data", - "migrate metadata", - "check math parameters", -} +-- patches.register("before","migrate metadata","cambria",function() end) + +function patches.register(what,where,pattern,action) + local ww = what[where] + if ww then + ww[pattern] = action + else + ww = { [pattern] = action} + end +end + +function patches.report(fmt,...) + if trace_loading then + report_otf("patching: " ..fmt,...) + end +end + +function enhancers.register(what,action) -- only already registered can be overloaded + actions[what] = action +end function otf.load(filename,format,sub,featurefile) local name = file.basename(file.removesuffix(filename)) + local attr = lfs.attributes(filename) + local size = attr and attr.size or 0 + local time = attr and attr.modification or 0 if featurefile then name = name .. "@" .. file.removesuffix(file.basename(featurefile)) end - if sub == "" then sub = false end + if sub == "" then + sub = false + end local hash = name if sub then hash = hash .. "-" .. sub end hash = containers.cleanname(hash) - local data = containers.read(otf.cache(), hash) - local size = lfs.attributes(filename,"size") or 0 - if not data or data.verbose ~= fonts.verbose or data.size ~= size then - logs.report("load otf","loading: %s (hash: %s)",filename,hash) - local ff, messages + local featurefiles + if featurefile then + featurefiles = { } + for s in gmatch(featurefile,"[^,]+") do + local name = resolvers.findfile(file.addsuffix(s,'fea'),'fea') or "" + if name == "" then + report_otf("loading: no featurefile '%s'",s) + else + local attr = lfs.attributes(name) + featurefiles[#featurefiles+1] = { + name = name, + size = size, + time = time, + } + end + end + if #featurefiles == 0 then + featurefiles = nil + end + end + local data = containers.read(otf.cache,hash) + local reload = not data or data.size ~= size or data.time ~= time + if forceload then + report_otf("loading: forced reload due to hard coded flag") + reload = true + end + if not reload then + local featuredata = data.featuredata + if featurefiles then + if not featuredata or #featuredata ~= #featurefiles then + reload = true + else + for i=1,#featurefiles do + local fi, fd = featurefiles[i], featuredata[i] + if fi.name ~= fd.name or fi.size ~= fd.size or fi.time ~= fd.time then + reload = true + break + end + end + end + elseif featuredata then + reload = true + end + if reload then + report_otf("loading: forced reload due to changed featurefile specification: %s",featurefile or "--") + end + end + if reload then + report_otf("loading: %s (hash: %s)",filename,hash) + local fontdata, messages if sub then - ff, messages = fontloader.open(filename,sub) + fontdata, messages = fontloader.open(filename,sub) else - ff, messages = fontloader.open(filename) + fontdata, messages = fontloader.open(filename) + end + if fontdata then + mainfields = mainfields or (fontloaderfields and fontloaderfields(fontdata)) end if trace_loading and messages and #messages > 0 then if type(messages) == "string" then - logs.report("load otf","warning: %s",messages) + report_otf("warning: %s",messages) else for m=1,#messages do - logs.report("load otf","warning: %s",tostring(messages[m])) + report_otf("warning: %s",tostring(messages[m])) end end else - logs.report("load otf","font loaded okay") + report_otf("font loaded okay") end - if ff then - load_featurefile(ff,featurefile) - data = fontloader.to_table(ff) - fontloader.close(ff) - if data then - logs.report("load otf","file size: %s", size) - logs.report("load otf","enhancing ...") - for e=1,#enhancers do - otf.enhance(enhancers[e],data,filename) - io.flush() -- we want instant messages + if fontdata then + if featurefiles then + for i=1,#featurefiles do + load_featurefile(fontdata,featurefiles[i].name) end - if otf.pack and not fonts.verbose then - otf.enhance("pack",data,filename) + end + local unicodes = { + -- names to unicodes + } + local splitter = lpeg.splitter(" ",unicodes) + data = { + size = size, + time = time, + format = format, + featuredata = featurefiles, + resources = { + filename = resolvers.unresolve(filename), -- no shortcut + version = otf.version, + creator = "context mkiv", + unicodes = unicodes, + indices = { + -- index to unicodes + }, + duplicates = { + -- alternative unicodes + }, + lookuptypes = { + }, + }, + metadata = { + -- raw metadata, not to be used + }, + properties = { + -- normalized metadata + }, + descriptions = { + }, + goodies = { + }, + helpers = { + tounicodelist = splitter, + tounicodetable = lpeg.Ct(splitter), + }, + } + starttiming(data) + report_otf("file size: %s", size) + enhancers.apply(data,filename,fontdata) + if packdata then + if cleanup > 0 then + collectgarbage("collect") end - data.size = size - data.verbose = fonts.verbose - logs.report("load otf","saving in cache: %s",filename) - data = containers.write(otf.cache(), hash, data) + enhance("pack",data,filename,nil) + end + report_otf("saving in cache: %s",filename) + data = containers.write(otf.cache, hash, data) + if cleanup > 1 then collectgarbage("collect") - data = containers.read(otf.cache(), hash) -- this frees the old table and load the sparse one + end + stoptiming(data) + if elapsedtime then -- not in generic + report_otf("preprocessing and caching took %s seconds",elapsedtime(data)) + end + fontloader.close(fontdata) -- free memory + if cleanup > 3 then + collectgarbage("collect") + end + data = containers.read(otf.cache, hash) -- this frees the old table and load the sparse one + if cleanup > 2 then collectgarbage("collect") - else - logs.report("load otf","loading failed (table conversion error)") end else - logs.report("load otf","loading failed (file read error)") + data = nil + report_otf("loading failed (file read error)") end end if data then if trace_defining then - logs.report("define font","loading from cache: %s",hash) + report_otf("loading from cache: %s",hash) end - otf.enhance("unpack",data,filename,false) -- no message here - otf.add_dimensions(data) + enhance("unpack",data,filename,nil,false) + enhance("add dimensions",data,filename,nil,false) if trace_sequences then - otf.show_feature_order(data,filename) + showfeatureorder(data,filename) end end return data end -function otf.add_dimensions(data) +local mt = { + __index = function(t,k) -- maybe set it + if k == "height" then + local ht = t.boundingbox[4] + return ht < 0 and 0 or ht + elseif k == "depth" then + local dp = -t.boundingbox[2] + return dp < 0 and 0 or dp + elseif k == "width" then + return 0 + elseif k == "name" then -- or maybe uni* + return forcenotdef and ".notdef" + end + end +} + +actions["prepare tables"] = function(data,filename,raw) + data.properties.italic_correction = false +end + +actions["add dimensions"] = function(data,filename) -- todo: forget about the width if it's the defaultwidth (saves mem) -- we could also build the marks hash here (instead of storing it) if data then - local force = otf.notdef - local luatex = data.luatex - local defaultwidth = luatex.defaultwidth or 0 - local defaultheight = luatex.defaultheight or 0 - local defaultdepth = luatex.defaultdepth or 0 - for _, d in next, data.glyphs do - local bb, wd = d.boundingbox, d.width - if not wd then - d.width = defaultwidth - elseif wd ~= 0 and d.class == "mark" then - d.width = -wd + local descriptions = data.descriptions + local resources = data.resources + local defaultwidth = resources.defaultwidth or 0 + local defaultheight = resources.defaultheight or 0 + local defaultdepth = resources.defaultdepth or 0 + if usemetatables then + for _, d in next, descriptions do + local wd = d.width + if not wd then + d.width = defaultwidth + elseif trace_markwidth and wd ~= 0 and d.class == "mark" then + report_otf("mark with width %s (%s) in %s",wd,d.name or "",file.basename(filename)) + -- d.width = -wd + end + setmetatable(d,mt) end - if force and not d.name then - d.name = ".notdef" + else + for _, d in next, descriptions do + local bb, wd = d.boundingbox, d.width + if not wd then + d.width = defaultwidth + elseif trace_markwidth and wd ~= 0 and d.class == "mark" then + report_otf("mark with width %s (%s) in %s",wd,d.name or "",file.basename(filename)) + -- d.width = -wd + end + -- if forcenotdef and not d.name then + -- d.name = ".notdef" + -- end + if bb then + local ht, dp = bb[4], -bb[2] + if ht == 0 or ht < 0 then + -- not set + else + d.height = ht + end + if dp == 0 or dp < 0 then + -- not set + else + d.depth = dp + end + end end - if bb then - local ht, dp = bb[4], -bb[2] - if ht == 0 or ht < 0 then - -- no need to set it and no negative heights, nil == 0 + end + end +end + +local function somecopy(old) -- fast one + if old then + local new = { } + if type(old) == "table" then + for k, v in next, old do + if k == "glyphs" then + -- skip + elseif type(v) == "table" then + new[k] = somecopy(v) else - d.height = ht + new[k] = v end - if dp == 0 or dp < 0 then - -- no negative depths and no negative depths, nil == 0 + end + else + for i=1,#mainfields do + local k = mainfields[i] + local v = old[k] + if k == "glyphs" then + -- skip + elseif type(v) == "table" then + new[k] = somecopy(v) else - d.depth = dp + new[k] = v end end end + return new + else + return { } end end -function otf.show_feature_order(otfdata,filename) - local sequences = otfdata.luatex.sequences - if sequences and #sequences > 0 then - if trace_loading then - logs.report("otf check","font %s has %s sequences",filename,#sequences) - logs.report("otf check"," ") - end - for nos=1,#sequences do - local sequence = sequences[nos] - local typ = sequence.type or "no-type" - local name = sequence.name or "no-name" - local subtables = sequence.subtables or { "no-subtables" } - local features = sequence.features - if trace_loading then - logs.report("otf check","%3i %-15s %-20s [%s]",nos,name,typ,concat(subtables,",")) - end - if features then - for feature, scripts in next, features do - local tt = { } - for script, languages in next, scripts do - local ttt = { } - for language, _ in next, languages do - ttt[#ttt+1] = language +-- not setting italic_correction and class (when nil) during +-- table cronstruction can save some mem + +actions["prepare glyphs"] = function(data,filename,raw) + local rawglyphs = raw.glyphs + local rawsubfonts = raw.subfonts + local rawcidinfo = raw.cidinfo + local criterium = constructors.privateoffset + local private = criterium + local resources = data.resources + local metadata = data.metadata + local properties = data.properties + local descriptions = data.descriptions + local unicodes = resources.unicodes -- name to unicode + local indices = resources.indices -- index to unicode + local duplicates = resources.duplicates + + if rawsubfonts then + + metadata.subfonts = { } + properties.cidinfo = rawcidinfo + + if rawcidinfo.registry then + local cidmap = fonts.cid.getmap(rawcidinfo) + if cidmap then + rawcidinfo.usedname = cidmap.usedname + local nofnames, nofunicodes = 0, 0 + local cidunicodes, cidnames = cidmap.unicodes, cidmap.names + for cidindex=1,#rawsubfonts do + local subfont = rawsubfonts[cidindex] + local cidglyphs = subfont.glyphs + metadata.subfonts[cidindex] = somecopy(subfont) + for index=0,subfont.glyphcnt-1 do -- we could take the previous glyphcnt instead of 0 + local glyph = cidglyphs[index] + if glyph then + local unicode = glyph.unicode + local name = glyph.name or cidnames[index] + if not unicode or unicode == -1 or unicode >= criterium then + unicode = cidunicodes[index] + end + if not unicode or unicode == -1 or unicode >= criterium then + if not name then + name = format("u%06X",private) + end + unicode = private + unicodes[name] = private + if trace_private then + report_otf("enhance: glyph %s at index 0x%04X is moved to private unicode slot U+%05X",name,index,private) + end + private = private + 1 + nofnames = nofnames + 1 + else + if not name then + name = format("u%06X",unicode) + end + unicodes[name] = unicode + nofunicodes = nofunicodes + 1 + end + indices[index] = unicode -- each index is unique (at least now) + + local description = { + -- width = glyph.width, + boundingbox = glyph.boundingbox, + name = glyph.name or name or "unknown", -- uniXXXX + cidindex = cidindex, + index = index, + glyph = glyph, + } + + descriptions[unicode] = description + else + -- report_otf("potential problem: glyph 0x%04X is used but empty",index) end - tt[#tt+1] = format("[%s: %s]",script,concat(ttt," ")) - end - if trace_loading then - logs.report("otf check"," %s: %s",feature,concat(tt," ")) end end + if trace_loading then + report_otf("cid font remapped, %s unicode points, %s symbolic names, %s glyphs",nofunicodes, nofnames, nofunicodes+nofnames) + end + elseif trace_loading then + report_otf("unable to remap cid font, missing cid file for %s",filename) end + elseif trace_loading then + report_otf("font %s has no glyphs",filename) end - if trace_loading then - logs.report("otf check","\n") - end - elseif trace_loading then - logs.report("otf check","font %s has no sequences",filename) - end -end --- todo: normalize, design_size => designsize + else -otf.enhancers["reorganize mark classes"] = function(data,filename) - if data.mark_classes then - local unicodes = data.luatex.unicodes - local reverse = { } - for name, class in next, data.mark_classes do - local t = { } - for s in gmatch(class,"[^ ]+") do - local us = unicodes[s] - if type(us) == "table" then - for u=1,#us do - t[us[u]] = true + for index=0,raw.glyphcnt-1 do -- not raw.glyphmax-1 (as that will crash) + local glyph = rawglyphs[index] + if glyph then + local unicode = glyph.unicode + local name = glyph.name + if not unicode or unicode == -1 or unicode >= criterium then + unicode = private + unicodes[name] = private + if trace_private then + report_otf("enhance: glyph %s at index 0x%04X is moved to private unicode slot U+%05X",name,index,private) end + private = private + 1 else - t[us] = true + unicodes[name] = unicode end + indices[index] = unicode + if not name then + name = format("u%06X",unicode) + end + descriptions[unicode] = { + -- width = glyph.width, + boundingbox = glyph.boundingbox, + name = name, + index = index, + glyph = glyph, + } + local altuni = glyph.altuni + if altuni then + local d = { } + for i=1,#altuni do + d[#d+1] = altuni[i].unicode + end + duplicates[unicode] = d + end + else + report_otf("potential problem: glyph 0x%04X is used but empty",index) end - reverse[name] = t end - data.luatex.markclasses = reverse - data.mark_classes = nil + end -end -otf.enhancers["prepare luatex tables"] = function(data,filename) - data.luatex = data.luatex or { } - local luatex = data.luatex - luatex.filename = filename - luatex.version = otf.version - luatex.creator = "context mkiv" + resources.private = private + end -otf.enhancers["cleanup aat"] = function(data,filename) - if otf.cleanup_aat then +-- the next one is still messy but will get better when we have +-- flattened map/enc tables in the font loader + +actions["check encoding"] = function(data,filename,raw) + local descriptions = data.descriptions + local resources = data.resources + local properties = data.properties + local unicodes = resources.unicodes -- name to unicode + local indices = resources.indices -- index to unicodes + local duplicates = resources.duplicates + + -- begin of messy (not needed whwn cidmap) + + local mapdata = raw.map or { } + local unicodetoindex = mapdata and mapdata.map or { } + -- local encname = lower(data.enc_name or raw.enc_name or mapdata.enc_name or "") + local encname = lower(data.enc_name or mapdata.enc_name or "") + local criterium = 0xFFFF -- for instance cambria has a lot of mess up there + + -- end of messy + + if find(encname,"unicode") then -- unicodebmp, unicodefull, ... + if trace_loading then + report_otf("checking embedded unicode map '%s'",encname) + end + for unicode, index in next, unicodetoindex do -- altuni already covers this + if unicode <= criterium and not descriptions[unicode] then + local parent = indices[index] -- why nil? + if parent then + report_otf("weird, unicode U+%05X points to U+%05X with index 0x%04X",unicode,parent,index) + else + report_otf("weird, unicode U+%05X points to nowhere with index 0x%04X",unicode,index) + end + end + end + elseif properties.cidinfo then + report_otf("warning: no unicode map, used cidmap '%s'",properties.cidinfo.usedname or "?") + else + report_otf("warning: non unicode map '%s', only using glyph unicode data",encname or "whatever") + end + + if mapdata then + mapdata.map = { } -- clear some memory end end -local function analyze_features(g, features) - if g then - local t, done = { }, { } - for k=1,#g do - local f = features or g[k].features - if f then - for k=1,#f do - -- scripts and tag - local tag = f[k].tag - if not done[tag] then - t[#t+1] = tag - done[tag] = true +-- for the moment we assume that a fotn with lookups will not use +-- altuni so we stick to kerns only + +actions["add duplicates"] = function(data,filename,raw) + local descriptions = data.descriptions + local resources = data.resources + local properties = data.properties + local unicodes = resources.unicodes -- name to unicode + local indices = resources.indices -- index to unicodes + local duplicates = resources.duplicates + + for unicode, d in next, duplicates do + for i=1,#d do + local u = d[i] + if not descriptions[u] then + local description = descriptions[unicode] + local duplicate = table.copy(description) -- else packing problem + duplicate.comment = format("copy of U+%05X", unicode) + descriptions[u] = duplicate + local n = 0 + for _, description in next, descriptions do + if kerns then + local kerns = description.kerns + for _, k in next, kerns do + local ku = k[unicode] + if ku then + k[u] = ku + n = n + 1 + end + end end + -- todo: lookups etc end + if trace_loading then + report_otf("duplicating U+%05X to U+%05X with index 0x%04X (%s kerns)",unicode,u,description.index,n) + end + end + end + end + +end + +-- class : nil base mark ligature component (maybe we don't need it in description) +-- boundingbox: split into ht/dp takes more memory (larger tables and less sharing) + +actions["analyze glyphs"] = function(data,filename,raw) -- maybe integrate this in the previous + local descriptions = data.descriptions + local resources = data.resources + local metadata = data.metadata + local properties = data.properties + local italic_correction = false + local widths = { } + local marks = { } + for unicode, description in next, descriptions do + local glyph = description.glyph + local italic = glyph.italic_correction + if not italic then + -- skip + elseif italic == 0 then + -- skip + else + description.italic = italic + italic_correction = true + end + local width = glyph.width + widths[width] = (widths[width] or 0) + 1 + local class = glyph.class + if class then + if class == "mark" then + marks[unicode] = true + end + description.class = class + end + end + -- flag italic + properties.italic_correction = italic_correction + -- flag marks + resources.marks = marks + -- share most common width for cjk fonts + local wd, most = 0, 1 + for k,v in next, widths do + if v > most then + wd, most = k, v + end + end + if most > 1000 then -- maybe 500 + if trace_loading then + report_otf("most common width: %s (%s times), sharing (cjk font)",wd,most) + end + for unicode, description in next, descriptions do + if description.width == wd then + -- description.width = nil + else + description.width = description.glyph.width end end - if #t > 0 then - return t + resources.defaultwidth = wd + else + for unicode, description in next, descriptions do + description.width = description.glyph.width end end - return nil end -otf.enhancers["analyse features"] = function(data,filename) - -- local luatex = data.luatex - -- luatex.gposfeatures = analyze_features(data.gpos) - -- luatex.gsubfeatures = analyze_features(data.gsub) +actions["reorganize mark classes"] = function(data,filename,raw) + local mark_classes = raw.mark_classes + if mark_classes then + local resources = data.resources + local unicodes = resources.unicodes + local markclasses = { } + resources.markclasses = markclasses -- reversed + for name, class in next, mark_classes do + local t = { } + for s in gmatch(class,"[^ ]+") do + t[unicodes[s]] = true + end + markclasses[name] = t + end + end end -otf.enhancers["rehash features"] = function(data,filename) +actions["reorganize features"] = function(data,filename,raw) -- combine with other local features = { } - data.luatex.features = features + data.resources.features = features for k, what in next, otf.glists do - local dw = data[what] + local dw = raw[what] if dw then local f = { } features[what] = f @@ -450,10 +898,16 @@ otf.enhancers["rehash features"] = function(data,filename) for i=1,#dfeatures do local df = dfeatures[i] local tag = strip(lower(df.tag)) - local ft = f[tag] if not ft then ft = {} f[tag] = ft end + local ft = f[tag] + if not ft then + ft = { } + f[tag] = ft + end local dscripts = df.scripts - for script, languages in next, dscripts do - script = strip(lower(script)) + for i=1,#dscripts do + local d = dscripts[i] + local languages = d.langs + local script = strip(lower(d.script)) local fts = ft[script] if not fts then fts = {} ft[script] = fts end for i=1,#languages do fts[strip(lower(languages[i]))] = true @@ -466,665 +920,572 @@ otf.enhancers["rehash features"] = function(data,filename) end end -otf.enhancers["analyse anchors"] = function(data,filename) - local classes = data.anchor_classes - local luatex = data.luatex - local anchor_to_lookup, lookup_to_anchor = { }, { } - luatex.anchor_to_lookup, luatex.lookup_to_anchor = anchor_to_lookup, lookup_to_anchor +actions["reorganize anchor classes"] = function(data,filename,raw) + local resources = data.resources + local anchor_to_lookup = { } + local lookup_to_anchor = { } + resources.anchor_to_lookup = anchor_to_lookup + resources.lookup_to_anchor = lookup_to_anchor + local classes = raw.anchor_classes -- anchor classes not in final table if classes then for c=1,#classes do - local class = classes[c] - local anchor = class.name + local class = classes[c] + local anchor = class.name local lookups = class.lookup if type(lookups) ~= "table" then lookups = { lookups } end local a = anchor_to_lookup[anchor] - if not a then a = { } anchor_to_lookup[anchor] = a end + if not a then + a = { } + anchor_to_lookup[anchor] = a + end for l=1,#lookups do local lookup = lookups[l] local l = lookup_to_anchor[lookup] - if not l then l = { } lookup_to_anchor[lookup] = l end - l[anchor] = true + if l then + l[anchor] = true + else + l = { [anchor] = true } + lookup_to_anchor[lookup] = l + end a[lookup] = true end end end end -otf.enhancers["analyse marks"] = function(data,filename) - local glyphs = data.glyphs - local marks = { } - data.luatex.marks = marks - for unicode, index in next, data.luatex.indices do - local glyph = glyphs[index] - if glyph.class == "mark" then - marks[unicode] = true - end - end +actions["prepare tounicode"] = function(data,filename,raw) + fonts.mappings.addtounicode(data,filename) end -otf.enhancers["analyse unicodes"] = fonts.map.add_to_unicode - -otf.enhancers["analyse subtables"] = function(data,filename) - data.luatex = data.luatex or { } - local luatex = data.luatex - local sequences = { } - local lookups = { } - luatex.sequences = sequences - luatex.lookups = lookups - for _, g in next, { data.gsub, data.gpos } do - for k=1,#g do - local gk = g[k] - local typ = gk.type - if typ == "gsub_contextchain" or typ == "gpos_contextchain" then - gk.chain = 1 - elseif typ == "gsub_reversecontextchain" or typ == "gpos_reversecontextchain" then - gk.chain = -1 - else - gk.chain = 0 - end - local features = gk.features - if features then - sequences[#sequences+1] = gk - -- scripts, tag, ismac - local t = { } - for f=1,#features do - local feature = features[f] - local hash = { } - -- only script and langs matter - for s, languages in next, feature.scripts do - s = lower(s) - local h = hash[s] - if not h then h = { } hash[s] = h end - for l=1,#languages do - h[strip(lower(languages[l]))] = true - end +actions["reorganize subtables"] = function(data,filename,raw) + local resources = data.resources + local sequences = { } + local lookups = { } + local chainedfeatures = { } + resources.sequences = sequences + resources.lookups = lookups + for _, what in next, otf.glists do + local dw = raw[what] + if dw then + for k=1,#dw do + local gk = dw[k] + local typ = gk.type + local chain = + (typ == "gsub_contextchain" or typ == "gpos_contextchain") and 1 or + (typ == "gsub_reversecontextchain" or typ == "gpos_reversecontextchain") and -1 or 0 + -- + local subtables = gk.subtables + if subtables then + local t = { } + for s=1,#subtables do + t[s] = subtables[s].name end - t[feature.tag] = hash + subtables = t end - gk.features = t - else - lookups[gk.name] = gk - gk.name = nil - end - local subtables = gk.subtables - if subtables then - local t = { } - for s=1,#subtables do - local subtable = subtables[s] - local name = subtable.name - t[#t+1] = name - end - gk.subtables = t - end - local flags = gk.flags - if flags then - gk.flags = { -- forcing false packs nicer - (flags.ignorecombiningmarks and "mark") or false, - (flags.ignoreligatures and "ligature") or false, - (flags.ignorebaseglyphs and "base") or false, - flags.r2l or false, - } - if flags.mark_class then - gk.markclass = luatex.markclasses[flags.mark_class] + local flags, markclass = gk.flags, nil + if flags then + local t = { -- forcing false packs nicer + (flags.ignorecombiningmarks and "mark") or false, + (flags.ignoreligatures and "ligature") or false, + (flags.ignorebaseglyphs and "base") or false, + flags.r2l or false, + } + markclass = flags.mark_class + if markclass then + markclass = resources.markclasses[markclass] + end + flags = t end - end - end - end -end - -otf.enhancers["merge cid fonts"] = function(data,filename) - -- we can also move the names to data.luatex.names which might - -- save us some more memory (at the cost of harder tracing) - if data.subfonts then - if data.glyphs and next(data.glyphs) then - logs.report("load otf","replacing existing glyph table due to subfonts") - end - local cidinfo = data.cidinfo - local verbose = fonts.verbose - if cidinfo.registry then - local cidmap, cidname = fonts.cid.getmap(cidinfo.registry,cidinfo.ordering,cidinfo.supplement) - if cidmap then - cidinfo.usedname = cidmap.usedname - local glyphs, uni_to_int, int_to_uni, nofnames, nofunicodes = { }, { }, { }, 0, 0 - local unicodes, names = cidmap.unicodes, cidmap.names - for n, subfont in next, data.subfonts do - for index, g in next, subfont.glyphs do - if not next(g) then - -- dummy entry - else - local unicode, name = unicodes[index], names[index] - g.cidindex = n - g.boundingbox = g.boundingbox -- or zerobox - g.name = g.name or name or "unknown" - if unicode then - uni_to_int[unicode] = index - int_to_uni[index] = unicode - nofunicodes = nofunicodes + 1 - g.unicode = unicode - elseif name then - nofnames = nofnames + 1 - g.unicode = -1 + -- + local name = gk.name + -- + local features = gk.features + if features then + -- scripts, tag, ismac + local f = { } + for i=1,#features do + local df = features[i] + local tag = strip(lower(df.tag)) + local ft = f[tag] if not ft then ft = {} f[tag] = ft end + local dscripts = df.scripts + for i=1,#dscripts do + local d = dscripts[i] + local languages = d.langs + local script = strip(lower(d.script)) + local fts = ft[script] if not fts then fts = {} ft[script] = fts end + for i=1,#languages do + fts[strip(lower(languages[i]))] = true end - glyphs[index] = g end end - subfont.glyphs = nil - end - if trace_loading then - logs.report("load otf","cid font remapped, %s unicode points, %s symbolic names, %s glyphs",nofunicodes, nofnames, nofunicodes+nofnames) - end - data.glyphs = glyphs - data.map = data.map or { } - data.map.map = uni_to_int - data.map.backmap = int_to_uni - elseif trace_loading then - logs.report("load otf","unable to remap cid font, missing cid file for %s",filename) - end - elseif trace_loading then - logs.report("load otf","font %s has no glyphs",filename) - end - end -end - -otf.enhancers["prepare unicode"] = function(data,filename) - local luatex = data.luatex - if not luatex then luatex = { } data.luatex = luatex end - local indices, unicodes, multiples, internals = { }, { }, { }, { } - local glyphs = data.glyphs - local mapmap = data.map - if not mapmap then - logs.report("load otf","no map in %s",filename) - mapmap = { } - data.map = { map = mapmap } - elseif not mapmap.map then - logs.report("load otf","no unicode map in %s",filename) - mapmap = { } - data.map.map = mapmap - else - mapmap = mapmap.map - end - local criterium = fonts.private - local private = fonts.private - for index, glyph in next, glyphs do - if index > 0 then - local name = glyph.name - if name then - local unicode = glyph.unicode - if unicode == -1 or unicode >= criterium then - glyph.unicode = private - indices[private] = index - unicodes[name] = private - internals[index] = true - if trace_private then - logs.report("load otf","enhance: glyph %s at index U+%04X is moved to private unicode slot U+%04X",name,index,private) - end - private = private + 1 + sequences[#sequences+1] = { + type = typ, + chain = chain, + flags = flags, + name = name, + subtables = subtables, + markclass = markclass, + features = f, + } else - indices[unicode] = index - unicodes[name] = unicode + lookups[name] = { + type = typ, + chain = chain, + flags = flags, + subtables = subtables, + markclass = markclass, + } end end end end - -- beware: the indices table is used to initialize the tfm table - for unicode, index in next, mapmap do - if not internals[index] then - local name = glyphs[index].name - if name then - local un = unicodes[name] - if not un then - unicodes[name] = unicode -- or 0 - elseif type(un) == "number" then - if un ~= unicode then - multiples[#multiples+1] = name - unicodes[name] = { un, unicode } - indices[unicode] = index - end - else - local ok = false - for u=1,#un do - if un[u] == unicode then - ok = true - break - end - end - if not ok then - multiples[#multiples+1] = name - un[#un+1] = unicode - indices[unicode] = index - end - end - end - end - end - if trace_loading then - if #multiples > 0 then - logs.report("load otf","%s glyph are reused: %s",#multiples, concat(multiples," ")) - else - logs.report("load otf","no glyph are reused") - end +end + +-- test this: +-- +-- for _, what in next, otf.glists do +-- raw[what] = nil +-- end + +actions["prepare lookups"] = function(data,filename,raw) + local lookups = raw.lookups + if lookups then + data.lookups = lookups end - luatex.indices = indices - luatex.unicodes = unicodes - luatex.private = private end -otf.enhancers["cleanup ttf tables"] = function(data,filename) - local ttf_tables = data.ttf_tables - if ttf_tables then - for k=1,#ttf_tables do - if ttf_tables[k].data then ttf_tables[k].data = "deleted" end +-- The reverse handler does a bit redundant splitting but it's seldom +-- seen so we don' tbother too much. We could store the replacement +-- in the current list (value instead of true) but it makes other code +-- uglier. Maybe some day. + +local function t_uncover(splitter,cache,covers) + local result = { } + for n=1,#covers do + local cover = covers[n] + local uncovered = cache[cover] + if not uncovered then + uncovered = lpegmatch(splitter,cover) + cache[cover] = uncovered end + result[n] = uncovered end - data.ttf_tab_saved = nil + return result end -otf.enhancers["compact glyphs"] = function(data,filename) - table.compact(data.glyphs) -- needed? - if data.subfonts then - for _, subfont in next, data.subfonts do - table.compact(subfont.glyphs) -- needed? +local function t_hashed(t,cache) + if t then + local h = { } + for i=1,#t do + local ti = t[i] + local h = cache[ti] + if not h then + h = { } + for i=1,#ti do + h[ti] = true + end + end + cache[ti] = h end + return h + else + return nil end end -otf.enhancers["reverse coverage"] = function(data,filename) - -- we prefer the before lookups in a normal order - if data.lookups then - for _, v in next, data.lookups do - if v.rules then - for _, vv in next, v.rules do - local c = vv.coverage - if c and c.before then - c.before = table.reverse(c.before) - end - end +local function s_uncover(splitter,cache,cover) + if cover == "" then + return nil + else + local uncovered = cache[cover] + if not uncovered then + uncovered = lpegmatch(splitter,cover) + for i=1,#uncovered do + uncovered[i] = { [uncovered[i]] = true } end + cache[cover] = uncovered end + return uncovered end end -otf.enhancers["check italic correction"] = function(data,filename) - local glyphs = data.glyphs - local ok = false - for index, glyph in next, glyphs do - local ic = glyph.italic_correction - if ic then - if ic ~= 0 then - glyph.italic = ic +local s_hashed = t_hashed + +local function r_uncover(splitter,cache,cover,replacements) + if cover == "" then + return nil + else + -- we always have current as { } even in the case of one + local uncovered = cover[1] + local replaced = cache[replacements] + if not replaced then + replaced = lpegmatch(splitter,replacements) + cache[replacements] = replaced + end + local nu, nr = #uncovered, #replaced + local r = { } + if nu == nr then + for i=1,nu do + r[uncovered[i]] = replaced[i] end - glyph.italic_correction = nil - ok = true end + return r end - -- we can use this to avoid calculations - otf.tables.valid_fields[#otf.tables.valid_fields+1] = "has_italic" - data.has_italic = true end -otf.enhancers["check math"] = function(data,filename) - if data.math then - -- we move the math stuff into a math subtable because we then can - -- test faster in the tfm copy - local glyphs = data.glyphs - local unicodes = data.luatex.unicodes - for index, glyph in next, glyphs do - local mk = glyph.mathkern - local hv = glyph.horiz_variants - local vv = glyph.vert_variants - if mk or hv or vv then - local math = { } - glyph.math = math - if mk then - for k, v in next, mk do - if not next(v) then - mk[k] = nil - end +actions["reorganize lookups"] = function(data,filename,raw) + -- we prefer the before lookups in a normal order + if data.lookups then + local splitter = data.helpers.tounicodetable + local cache, h_cache = { }, { } + for _, lookup in next, data.lookups do + local rules = lookup.rules + if rules then + local format = lookup.format + if format == "class" then + local before_class = lookup.before_class + if before_class then + before_class = t_uncover(splitter,cache,reversed(before_class)) end - math.kerns = mk - glyph.mathkern = nil - end - if hv then - math.horiz_variants = hv.variants - local p = hv.parts - if p then - if #p>0 then - for i=1,#p do - local pi = p[i] - pi.glyph = unicodes[pi.component] or 0 + local current_class = lookup.current_class + if current_class then + current_class = t_uncover(splitter,cache,current_class) + end + local after_class = lookup.after_class + if after_class then + after_class = t_uncover(splitter,cache,after_class) + end + for i=1,#rules do + local rule = rules[i] + local class = rule.class + local before = class.before + if before then + for i=1,#before do + before[i] = before_class[before[i]] or { } end - math.horiz_parts = p + rule.before = t_hashed(before,h_cache) end + local current = class.current + local lookups = rule.lookups + if current then + for i=1,#current do + current[i] = current_class[current[i]] or { } + if lookups and not lookups[i] then + lookups[i] = false + end + end + rule.current = t_hashed(current,h_cache) + end + local after = class.after + if after then + for i=1,#after do + after[i] = after_class[after[i]] or { } + end + rule.after = t_hashed(after,h_cache) + end + rule.class = nil end - local ic = hv.italic_correction - if ic and ic ~= 0 then - math.horiz_italic_correction = ic - end - glyph.horiz_variants = nil - end - if vv then - local uc = unicodes[index] - math.vert_variants = vv.variants - local p = vv.parts - if p then - if #p>0 then - for i=1,#p do - local pi = p[i] - pi.glyph = unicodes[pi.component] or 0 + lookup.before_class = nil + lookup.current_class = nil + lookup.after_class = nil + lookup.format = "coverage" + elseif format == "coverage" then + for i=1,#rules do + local rule = rules[i] + local coverage = rule.coverage + if coverage then + local before = coverage.before + if before then + before = t_uncover(splitter,cache,reversed(before)) + rule.before = t_hashed(before,h_cache) + end + local current = coverage.current + if current then + current = t_uncover(splitter,cache,current) + rule.current = t_hashed(current,h_cache) end - math.vert_parts = p + local after = coverage.after + if after then + after = t_uncover(splitter,cache,after) + rule.after = t_hashed(after,h_cache) + end + rule.coverage = nil end end - local ic = vv.italic_correction - if ic and ic ~= 0 then - math.vert_italic_correction = ic + elseif format == "reversecoverage" then -- special case, single substitution only + for i=1,#rules do + local rule = rules[i] + local reversecoverage = rule.reversecoverage + if reversecoverage then + local before = reversecoverage.before + if before then + before = t_uncover(splitter,cache,reversed(before)) + rule.before = t_hashed(before,h_cache) + end + local current = reversecoverage.current + if current then + current = t_uncover(splitter,cache,current) + rule.current = t_hashed(current,h_cache) + end + local after = reversecoverage.after + if after then + after = t_uncover(splitter,cache,after) + rule.after = t_hashed(after,h_cache) + end + local replacements = reversecoverage.replacements + if replacements then + rule.replacements = r_uncover(splitter,cache,current,replacements) + end + rule.reversecoverage = nil + end end - glyph.vert_variants = nil - end - local ic = glyph.italic_correction - if ic then - if ic ~= 0 then - math.italic_correction = ic + elseif format == "glyphs" then + for i=1,#rules do + local rule = rules[i] + local glyphs = rule.glyphs + if glyphs then + local fore = glyphs.fore + if fore then + fore = s_uncover(splitter,cache,fore) + rule.before = s_hashed(fore,h_cache) + end + local back = glyphs.back + if back then + back = s_uncover(splitter,cache,back) + rule.after = s_hashed(back,h_cache) + end + local names = glyphs.names + if names then + names = s_uncover(splitter,cache,names) + rule.current = s_hashed(names,h_cache) + end + rule.glyphs = nil + end end - glyph.italic_correction = nil end end end end end -otf.enhancers["share widths"] = function(data,filename) - local glyphs = data.glyphs - local widths = { } - for index, glyph in next, glyphs do - local width = glyph.width - widths[width] = (widths[width] or 0) + 1 - end - -- share width for cjk fonts - local wd, most = 0, 1 - for k,v in next, widths do - if v > most then - wd, most = k, v +-- to be checked italic_correction + +local function check_variants(unicode,the_variants,splitter,unicodes) + local variants = the_variants.variants + if variants then -- use splitter + local glyphs = lpegmatch(splitter,variants) + local done = { [unicode] = true } + local n = 0 + for i=1,#glyphs do + local g = glyphs[i] + if done[g] then + report_otf("skipping cyclic reference U+%05X in math variant U+%05X",g,unicode) + elseif n == 0 then + n = 1 + variants = { g } + else + n = n + 1 + variants[n] = g + end end - end - if most > 1000 then - if trace_loading then - logs.report("load otf", "most common width: %s (%s times), sharing (cjk font)",wd,most) + if n == 0 then + variants = nil end - for k, v in next, glyphs do - if v.width == wd then - v.width = nil + end + local parts = the_variants.parts + if parts then + local p = #parts + if p > 0 then + for i=1,p do + local pi = parts[i] + pi.glyph = unicodes[pi.component] or 0 + pi.component = nil end + else + parts = nil end - data.luatex.defaultwidth = wd end + local italic_correction = the_variants.italic_correction + if italic_correction and italic_correction == 0 then + italic_correction = nil + end + return variants, parts, italic_correction end --- kern: ttf has a table with kerns - ---~ otf.enhancers["reorganize kerns"] = function(data,filename) ---~ local glyphs, mapmap, unicodes = data.glyphs, data.luatex.indices, data.luatex.unicodes ---~ local mkdone = false ---~ for index, glyph in next, data.glyphs do ---~ if glyph.kerns then ---~ local mykerns = { } ---~ for k,v in next, glyph.kerns do ---~ local vc, vo, vl = v.char, v.off, v.lookup ---~ if vc and vo and vl then -- brrr, wrong! we miss the non unicode ones ---~ local uvc = unicodes[vc] ---~ if not uvc then ---~ if trace_loading then ---~ logs.report("load otf","problems with unicode %s of kern %s at glyph %s",vc,k,index) ---~ end ---~ else ---~ if type(vl) ~= "table" then ---~ vl = { vl } ---~ end ---~ for l=1,#vl do ---~ local vll = vl[l] ---~ local mkl = mykerns[vll] ---~ if not mkl then ---~ mkl = { } ---~ mykerns[vll] = mkl ---~ end ---~ if type(uvc) == "table" then ---~ for u=1,#uvc do ---~ mkl[uvc[u]] = vo ---~ end ---~ else ---~ mkl[uvc] = vo ---~ end ---~ end ---~ end ---~ end ---~ end ---~ glyph.mykerns = mykerns ---~ glyph.kerns = nil -- saves space and time ---~ mkdone = true ---~ end ---~ end ---~ if trace_loading and mkdone then ---~ logs.report("load otf", "replacing 'kerns' tables by 'mykerns' tables") ---~ end ---~ if data.kerns then ---~ if trace_loading then ---~ logs.report("load otf", "removing global 'kern' table") ---~ end ---~ data.kerns = nil ---~ end ---~ local dgpos = data.gpos ---~ if dgpos then ---~ for gp=1,#dgpos do ---~ local gpos = dgpos[gp] ---~ local subtables = gpos.subtables ---~ if subtables then ---~ for s=1,#subtables do ---~ local subtable = subtables[s] ---~ local kernclass = subtable.kernclass -- name is inconsistent with anchor_classes ---~ if kernclass then -- the next one is quite slow ---~ for k=1,#kernclass do ---~ local kcl = kernclass[k] ---~ local firsts, seconds, offsets, lookups = kcl.firsts, kcl.seconds, kcl.offsets, kcl.lookup -- singular ---~ if type(lookups) ~= "table" then ---~ lookups = { lookups } ---~ end ---~ for l=1,#lookups do ---~ local lookup = lookups[l] ---~ -- weird, as maxfirst and maxseconds can have holes ---~ local maxfirsts, maxseconds = getn(firsts), getn(seconds) ---~ if trace_loading then ---~ logs.report("load otf", "adding kernclass %s with %s times %s pairs",lookup, maxfirsts, maxseconds) ---~ end ---~ for fk, fv in next, firsts do ---~ for first in gmatch(fv,"[^ ]+") do ---~ local first_unicode = unicodes[first] ---~ if type(first_unicode) == "number" then ---~ first_unicode = { first_unicode } ---~ end ---~ for f=1,#first_unicode do ---~ local glyph = glyphs[mapmap[first_unicode[f]]] ---~ if glyph then ---~ local mykerns = glyph.mykerns ---~ if not mykerns then ---~ mykerns = { } -- unicode indexed ! ---~ glyph.mykerns = mykerns ---~ end ---~ local lookupkerns = mykerns[lookup] ---~ if not lookupkerns then ---~ lookupkerns = { } ---~ mykerns[lookup] = lookupkerns ---~ end ---~ for sk, sv in next, seconds do ---~ local offset = offsets[(fk-1) * maxseconds + sk] ---~ --~ local offset = offsets[sk] -- (fk-1) * maxseconds + sk] ---~ for second in gmatch(sv,"[^ ]+") do ---~ local second_unicode = unicodes[second] ---~ if type(second_unicode) == "number" then ---~ lookupkerns[second_unicode] = offset ---~ else ---~ for s=1,#second_unicode do ---~ lookupkerns[second_unicode[s]] = offset ---~ end ---~ end ---~ end ---~ end ---~ elseif trace_loading then ---~ logs.report("load otf", "no glyph data for U+%04X", first_unicode[f]) ---~ end ---~ end ---~ end ---~ end ---~ end ---~ end ---~ subtable.comment = "The kernclass table is merged into mykerns in the indexed glyph tables." ---~ subtable.kernclass = { } ---~ end ---~ end ---~ end ---~ end ---~ end ---~ end - -otf.enhancers["reorganize kerns"] = function(data,filename) - local glyphs, mapmap, unicodes = data.glyphs, data.luatex.indices, data.luatex.unicodes - local mkdone = false - for index, glyph in next, data.glyphs do - if glyph.kerns then - local mykerns = { } - for k,v in next, glyph.kerns do - local vc, vo, vl = v.char, v.off, v.lookup - if vc and vo and vl then -- brrr, wrong! we miss the non unicode ones - local uvc = unicodes[vc] - if not uvc then - if trace_loading then - logs.report("load otf","problems with unicode %s of kern %s at glyph %s",vc,k,index) - end - else - if type(vl) ~= "table" then - vl = { vl } - end - for l=1,#vl do - local vll = vl[l] - local mkl = mykerns[vll] - if not mkl then - mkl = { } - mykerns[vll] = mkl - end - if type(uvc) == "table" then - for u=1,#uvc do - mkl[uvc[u]] = vo +actions["analyze math"] = function(data,filename,raw) + if raw.math then + data.metadata.math = raw.math + local unicodes = data.resources.unicodes + local splitter = data.helpers.tounicodetable + for unicode, description in next, data.descriptions do + local glyph = description.glyph + local mathkerns = glyph.mathkern -- singular + local horiz_variants = glyph.horiz_variants + local vert_variants = glyph.vert_variants + local top_accent = glyph.top_accent + if mathkerns or horiz_variants or vert_variants or top_accent then + local math = { } + if top_accent then + math.top_accent = top_accent + end + if mathkerns then + for k, v in next, mathkerns do + if not next(v) then + mathkerns[k] = nil + else + for k, v in next, v do + if v == 0 then + k[v] = nil -- height / kern can be zero end - else - mkl[uvc] = vo end end end + math.kerns = mathkerns end + if horiz_variants then + math.horiz_variants, math.horiz_parts, math.horiz_italic_correction = check_variants(unicode,horiz_variants,splitter,unicodes) + end + if vert_variants then + math.vert_variants, math.vert_parts, math.vert_italic_correction = check_variants(unicode,vert_variants,splitter,unicodes) + end + local italic_correction = description.italic + if italic_correction and italic_correction ~= 0 then + math.italic_correction = italic_correction + end + description.math = math end - glyph.mykerns = mykerns - glyph.kerns = nil -- saves space and time - mkdone = true end end - if trace_loading and mkdone then - logs.report("load otf", "replacing 'kerns' tables by 'mykerns' tables") - end - if data.kerns then - if trace_loading then - logs.report("load otf", "removing global 'kern' table") +end + +actions["reorganize glyph kerns"] = function(data,filename,raw) + local descriptions = data.descriptions + local resources = data.resources + local unicodes = resources.unicodes + for unicode, description in next, descriptions do + local kerns = description.glyph.kerns + if kerns then + local newkerns = { } + for k, kern in next, kerns do + local name = kern.char + local offset = kern.off + local lookup = kern.lookup + if name and offset and lookup then + local unicode = unicodes[name] + if unicode then + if type(lookup) == "table" then + for l=1,#lookup do + local lookup = lookup[l] + local lookupkerns = newkerns[lookup] + if lookupkerns then + lookupkerns[unicode] = offset + else + newkerns[lookup] = { [unicode] = offset } + end + end + else + local lookupkerns = newkerns[lookup] + if lookupkerns then + lookupkerns[unicode] = offset + else + newkerns[lookup] = { [unicode] = offset } + end + end + elseif trace_loading then + report_otf("problems with unicode %s of kern %s of glyph U+%05X",name,k,unicode) + end + end + end + description.kerns = newkerns end - data.kerns = nil end - local dgpos = data.gpos - if dgpos then - local separator = lpeg.P(" ") - local other = ((1 - separator)^0) / unicodes - local splitter = lpeg.Ct(other * (separator * other)^0) - for gp=1,#dgpos do - local gpos = dgpos[gp] +end + +actions["merge kern classes"] = function(data,filename,raw) + local gposlist = raw.gpos + if gposlist then + local descriptions = data.descriptions + local resources = data.resources + local unicodes = resources.unicodes + local splitter = data.helpers.tounicodetable + for gp=1,#gposlist do + local gpos = gposlist[gp] local subtables = gpos.subtables if subtables then for s=1,#subtables do local subtable = subtables[s] local kernclass = subtable.kernclass -- name is inconsistent with anchor_classes if kernclass then -- the next one is quite slow + local split = { } -- saves time for k=1,#kernclass do local kcl = kernclass[k] - local firsts, seconds, offsets, lookups = kcl.firsts, kcl.seconds, kcl.offsets, kcl.lookup -- singular + local firsts = kcl.firsts + local seconds = kcl.seconds + local offsets = kcl.offsets + local lookups = kcl.lookup -- singular if type(lookups) ~= "table" then lookups = { lookups } end - local split = { } + -- we can check the max in the loop + -- local maxseconds = getn(seconds) + for n, s in next, firsts do + split[s] = split[s] or lpegmatch(splitter,s) + end + local maxseconds = 0 + for n, s in next, seconds do + if n > maxseconds then + maxseconds = n + end + split[s] = split[s] or lpegmatch(splitter,s) + end for l=1,#lookups do local lookup = lookups[l] - -- weird, as maxfirst and maxseconds can have holes, first seems to be indexed, seconds starts at 2 - local maxfirsts, maxseconds = getn(firsts), getn(seconds) - for _, s in next, firsts do - split[s] = split[s] or lpegmatch(splitter,s) - end - for _, s in next, seconds do - split[s] = split[s] or lpegmatch(splitter,s) - end - if trace_loading then - logs.report("load otf", "adding kernclass %s with %s times %s pairs",lookup, maxfirsts, maxseconds) - end - local function do_it(fk,first_unicode) - local glyph = glyphs[mapmap[first_unicode]] - if glyph then - local mykerns = glyph.mykerns - if not mykerns then - mykerns = { } -- unicode indexed ! - glyph.mykerns = mykerns - end - local lookupkerns = mykerns[lookup] - if not lookupkerns then - lookupkerns = { } - mykerns[lookup] = lookupkerns - end + for fk=1,#firsts do -- maxfirsts ? + local fv = firsts[fk] + local splt = split[fv] + if splt then + local extrakerns = { } local baseoffset = (fk-1) * maxseconds - for sk=2,maxseconds do - local sv = seconds[sk] - local offset = offsets[baseoffset + sk] - --~ local offset = offsets[sk] -- (fk-1) * maxseconds + sk] + -- for sk=2,maxseconds do + -- local sv = seconds[sk] + for sk, sv in next, seconds do local splt = split[sv] - if splt then - for i=1,#splt do - local second_unicode = splt[i] - if tonumber(second_unicode) then - lookupkerns[second_unicode] = offset - else - for s=1,#second_unicode do - lookupkerns[second_unicode[s]] = offset - end + if splt then -- redundant test + local offset = offsets[baseoffset + sk] + if offset then + for i=1,#splt do + extrakerns[splt[i]] = offset end end end end - elseif trace_loading then - logs.report("load otf", "no glyph data for U+%04X", first_unicode) - end - end - for fk=1,#firsts do - local fv = firsts[fk] - local splt = split[fv] - if splt then for i=1,#splt do local first_unicode = splt[i] - if tonumber(first_unicode) then - do_it(fk,first_unicode) - else - for f=1,#first_unicode do - do_it(fk,first_unicode[f]) + local description = descriptions[first_unicode] + if description then + local kerns = description.kerns + if not kerns then + kerns = { } -- unicode indexed ! + description.kerns = kerns + end + local lookupkerns = kerns[lookup] + if not lookupkerns then + lookupkerns = { } + kerns[lookup] = lookupkerns end + for second_unicode, kern in next, extrakerns do + lookupkerns[second_unicode] = kern + end + elseif trace_loading then + report_otf("no glyph data for U+%05X", first_unicode) end end end end end end - subtable.comment = "The kernclass table is merged into mykerns in the indexed glyph tables." subtable.kernclass = { } end end @@ -1133,470 +1494,311 @@ otf.enhancers["reorganize kerns"] = function(data,filename) end end -otf.enhancers["strip not needed data"] = function(data,filename) - local verbose = fonts.verbose - local int_to_uni = data.luatex.unicodes - for k, v in next, data.glyphs do - local d = v.dependents - if d then v.dependents = nil end - local a = v.altuni - if a then v.altuni = nil end - if verbose then - local code = int_to_uni[k] - -- looks like this is done twice ... bug? - if code then - local vu = v.unicode - if not vu then - v.unicode = code - elseif type(vu) == "table" then - if vu[#vu] == code then - -- weird - else - vu[#vu+1] = code - end - elseif vu ~= code then - v.unicode = { vu, code } - end +actions["check glyphs"] = function(data,filename,raw) + for unicode, description in next, data.descriptions do + description.glyph = nil + end +end + +-- future versions will remove _ + +actions["check metadata"] = function(data,filename,raw) + local metadata = data.metadata + for _, k in next, mainfields do + if valid_fields[k] then + local v = raw[k] + if not metadata[k] then + metadata[k] = v end - else - v.unicode = nil - v.index = nil end end - data.luatex.comment = "Glyph tables have their original index. When present, mykern tables are indexed by unicode." - data.map = nil - data.names = nil -- funny names for editors - data.glyphcnt = nil - data.glyphmax = nil - if true then - data.gpos = nil - data.gsub = nil - data.anchor_classes = nil + -- metadata.pfminfo = raw.pfminfo -- not already done? + local ttftables = metadata.ttf_tables + if ttftables then + for i=1,#ttftables do + ttftables[i].data = "deleted" + end end end -otf.enhancers["migrate metadata"] = function(data,filename) - local global_fields = otf.tables.global_fields - local metadata = { } - for k,v in next, data do - if not global_fields[k] then - metadata[k] = v - data[k] = nil - end - end - data.metadata = metadata - -- goodies - local pfminfo = data.pfminfo - metadata.isfixedpitch = metadata.isfixedpitch or (pfminfo.panose and pfminfo.panose["proportion"] == "Monospaced") - metadata.charwidth = pfminfo and pfminfo.avgwidth +actions["cleanup tables"] = function(data,filename,raw) + data.resources.indices = nil -- not needed + data.helpers = nil end -local private_math_parameters = { - "FractionDelimiterSize", - "FractionDelimiterDisplayStyleSize", -} +-- kern: ttf has a table with kerns +-- +-- Weird, as maxfirst and maxseconds can have holes, first seems to be indexed, but +-- seconds can start at 2 .. this need to be fixed as getn as well as # are sort of +-- unpredictable alternatively we could force an [1] if not set (maybe I will do that +-- anyway). -otf.enhancers["check math parameters"] = function(data,filename) - local mathdata = data.metadata.math - if mathdata then - for m=1,#private_math_parameters do - local pmp = private_math_parameters[m] - if not mathdata[pmp] then - if trace_loading then - logs.report("load otf", "setting math parameter '%s' to 0", pmp) - end - mathdata[pmp] = 0 - end - end - end -end +-- we can share { } as it is never set -otf.enhancers["flatten glyph lookups"] = function(data,filename) - for k, v in next, data.glyphs do - local lookups = v.lookups +--- ligatures have an extra specification.char entry that we don't use + +actions["reorganize glyph lookups"] = function(data,filename,raw) + local resources = data.resources + local unicodes = resources.unicodes + local descriptions = data.descriptions + local splitter = data.helpers.tounicodelist + + local lookuptypes = resources.lookuptypes + + for unicode, description in next, descriptions do + local lookups = description.glyph.lookups if lookups then - for kk, vv in next, lookups do - for kkk=1,#vv do - local vvv = vv[kkk] - local s = vvv.specification - if s then - local t = vvv.type - if t == "ligature" then - vv[kkk] = { "ligature", s.components, s.char } - elseif t == "alternate" then - vv[kkk] = { "alternate", s.components } - elseif t == "substitution" then - vv[kkk] = { "substitution", s.variant } - elseif t == "multiple" then - vv[kkk] = { "multiple", s.components } - elseif t == "position" then - vv[kkk] = { "position", { s.x or 0, s.y or 0, s.h or 0, s.v or 0 } } - elseif t == "pair" then - local one, two, paired = s.offsets[1], s.offsets[2], s.paired or "" - if one then - if two then - vv[kkk] = { "pair", paired, { one.x or 0, one.y or 0, one.h or 0, one.v or 0 }, { two.x or 0, two.y or 0, two.h or 0, two.v or 0 } } - else - vv[kkk] = { "pair", paired, { one.x or 0, one.y or 0, one.h or 0, one.v or 0 } } - end + for tag, lookuplist in next, lookups do + for l=1,#lookuplist do + local lookup = lookuplist[l] + local specification = lookup.specification + local lookuptype = lookup.type + local lt = lookuptypes[tag] + if not lt then + lookuptypes[tag] = lookuptype + elseif lt ~= lookuptype then + report_otf("conflicting lookuptypes: %s => %s and %s",tag,lt,lookuptype) + end + if lookuptype == "ligature" then + lookuplist[l] = { lpegmatch(splitter,specification.components) } + elseif lookuptype == "alternate" then + lookuplist[l] = { lpegmatch(splitter,specification.components) } + elseif lookuptype == "substitution" then + lookuplist[l] = unicodes[specification.variant] + elseif lookuptype == "multiple" then + lookuplist[l] = { lpegmatch(splitter,specification.components) } + elseif lookuptype == "position" then + lookuplist[l] = { + specification.x or 0, + specification.y or 0, + specification.h or 0, + specification.v or 0 + } + elseif lookuptype == "pair" then + local one = specification.offsets[1] + local two = specification.offsets[2] + local paired = unicodes[specification.paired] + if one then + if two then + lookuplist[l] = { paired, { one.x or 0, one.y or 0, one.h or 0, one.v or 0 }, { two.x or 0, two.y or 0, two.h or 0, two.v or 0 } } else - if two then - vv[kkk] = { "pair", paired, { }, { two.x or 0, two.y or 0, two.h or 0, two.v or 0} } -- maybe nil instead of { } - else - vv[kkk] = { "pair", paired } - end + lookuplist[l] = { paired, { one.x or 0, one.y or 0, one.h or 0, one.v or 0 } } end else - if trace_loading then - logs.report("load otf", "flattening needed, report to context list") - end - for a, b in next, s do - if trace_loading and vvv[a] then - logs.report("load otf", "flattening conflict, report to context list") - end - vvv[a] = b + if two then + lookuplist[l] = { paired, { }, { two.x or 0, two.y or 0, two.h or 0, two.v or 0} } -- maybe nil instead of { } + else + lookuplist[l] = { paired } end - vvv.specification = nil end end end end - end - end -end - -otf.enhancers["simplify glyph lookups"] = function(data,filename) - for k, v in next, data.glyphs do - local lookups = v.lookups - if lookups then local slookups, mlookups - for kk, vv in next, lookups do - if #vv == 1 then - if not slookups then - slookups = { } - v.slookups = slookups + for tag, lookuplist in next, lookups do + if #lookuplist == 1 then + if slookups then + slookups[tag] = lookuplist[1] + else + slookups = { [tag] = lookuplist[1] } end - slookups[kk] = vv[1] else - if not mlookups then - mlookups = { } - v.mlookups = mlookups - end - mlookups[kk] = vv - end - end - v.lookups = nil - end - end -end - -otf.enhancers["flatten anchor tables"] = function(data,filename) - for k, v in next, data.glyphs do - if v.anchors then - for kk, vv in next, v.anchors do - for kkk, vvv in next, vv do - if vvv.x or vvv.y then - vv[kkk] = { vvv.x or 0, vvv.y or 0 } + if mlookups then + mlookups[tag] = lookuplist else - for kkkk=1,#vvv do - local vvvv = vvv[kkkk] - vvv[kkkk] = { vvvv.x or 0, vvvv.y or 0 } - end + mlookups = { [tag] = lookuplist } end end end - end - end -end - -otf.enhancers["flatten feature tables"] = function(data,filename) - -- is this needed? do we still use them at all? - for _, tag in next, otf.glists do - if data[tag] then - if trace_loading then - logs.report("load otf", "flattening %s table", tag) + if slookups then + description.slookups = slookups end - for k, v in next, data[tag] do - local features = v.features - if features then - for kk=1,#features do - local vv = features[kk] - local t = { } - local scripts = vv.scripts - for kkk=1,#scripts do - local vvv = scripts[kkk] - t[vvv.script] = vvv.langs - end - vv.scripts = t - end - end + if mlookups then + description.mlookups = mlookups end end end -end - -otf.enhancers.patches = otf.enhancers.patches or { } - -otf.enhancers["patch bugs"] = function(data,filename) - local basename = file.basename(lower(filename)) - for pattern, action in next, otf.enhancers.patches do - if find(basename,pattern) then - action(data,filename) - end - end -end - --- tex features - -fonts.otf.enhancers["enrich with features"] = function(data,filename) - -- later, ctx only -end -function otf.features.register(name,default) - otf.features.list[#otf.features.list+1] = name - otf.features.default[name] = default end --- for context this will become a task handler - -function otf.set_features(tfmdata,features) - local processes = { } - if features and next(features) then - local lists = { -- why local - fonts.triggers, - fonts.processors, - fonts.manipulators, - } - local mode = tfmdata.mode or fonts.mode -- or features.mode - local initializers = fonts.initializers - local fi = initializers[mode] - if fi then - local fiotf = fi.otf - if fiotf then - local done = { } - for l=1,4 do - local list = lists[l] - if list then - for i=1,#list do - local f = list[i] - local value = features[f] - if value and fiotf[f] then -- brr - if not done[f] then -- so, we can move some to triggers - if trace_features then - logs.report("define otf","initializing feature %s to %s for mode %s for font %s",f,tostring(value),mode or 'unknown', tfmdata.fullname or 'unknown') - end - fiotf[f](tfmdata,value) -- can set mode (no need to pass otf) - mode = tfmdata.mode or fonts.mode -- keep this, mode can be set local ! - local im = initializers[mode] - if im then - fiotf = initializers[mode].otf - end - done[f] = true - end - end +actions["reorganize glyph anchors"] = function(data,filename,raw) -- when we replace inplace we safe entries + local descriptions = data.descriptions + for unicode, description in next, descriptions do + local anchors = description.glyph.anchors + if anchors then + for class, data in next, anchors do + if class == "baselig" then + for tag, specification in next, data do + for i=1,#specification do + local si = specification[i] + specification[i] = { si.x or 0, si.y or 0 } end end - end - end - end - local fm = fonts.methods[mode] -- todo: zonder node/mode otf/... - if fm then - local fmotf = fm.otf - if fmotf then - for l=1,4 do - local list = lists[l] - if list then - for i=1,#list do - local f = list[i] - if fmotf[f] then -- brr - if trace_features then - logs.report("define otf","installing feature handler %s for mode %s for font %s",f,mode or 'unknown', tfmdata.fullname or 'unknown') - end - processes[#processes+1] = fmotf[f] - end - end + else + for tag, specification in next, data do + data[tag] = { specification.x or 0, specification.y or 0 } end end end - else - -- message + description.anchors = anchors end end - return processes, features end -function otf.otf_to_tfm(specification) - local name = specification.name - local sub = specification.sub - local filename = specification.filename - local format = specification.format - local features = specification.features.normal - local cache_id = specification.hash - local tfmdata = containers.read(tfm.cache(),cache_id) ---~ print(cache_id) - if not tfmdata then - local otfdata = otf.load(filename,format,sub,features and features.featurefile) - if otfdata and next(otfdata) then - otfdata.shared = otfdata.shared or { - featuredata = { }, - anchorhash = { }, - initialized = false, - } - tfmdata = otf.copy_to_tfm(otfdata,cache_id) - if tfmdata and next(tfmdata) then - tfmdata.unique = tfmdata.unique or { } - tfmdata.shared = tfmdata.shared or { } -- combine - local shared = tfmdata.shared - shared.otfdata = otfdata - shared.features = features -- default - shared.dynamics = { } - shared.processes = { } - shared.set_dynamics = otf.set_dynamics -- fast access and makes other modules independent - -- this will be done later anyway, but it's convenient to have - -- them already for fast access - tfmdata.luatex = otfdata.luatex - tfmdata.indices = otfdata.luatex.indices - tfmdata.unicodes = otfdata.luatex.unicodes - tfmdata.marks = otfdata.luatex.marks - tfmdata.originals = otfdata.luatex.originals - tfmdata.changed = { } - tfmdata.has_italic = otfdata.metadata.has_italic - if not tfmdata.language then tfmdata.language = 'dflt' end - if not tfmdata.script then tfmdata.script = 'dflt' end - shared.processes, shared.features = otf.set_features(tfmdata,fonts.define.check(features,otf.features.default)) - end - end - containers.write(tfm.cache(),cache_id,tfmdata) +-- modes: node, base, none + +function otf.setfeatures(tfmdata,features) + local okay = constructors.initializefeatures("otf",tfmdata,features,trace_features,report_otf) + if okay then + return constructors.collectprocessors("otf",tfmdata,features,trace_features,report_otf) + else + return { } -- will become false end - return tfmdata end ---~ { ---~ ['boundingbox']={ 95, -458, 733, 1449 }, ---~ ['class']="base", ---~ ['name']="braceleft", ---~ ['unicode']=123, ---~ ['vert_variants']={ ---~ ['italic_correction']=0, ---~ ['parts']={ ---~ { ['component']="uni23A9", ['endConnectorLength']=1000, ['fullAdvance']=2546, ['is_extender']=0, ['startConnectorLength']=0, }, -- bot ---~ { ['component']="uni23AA", ['endConnectorLength']=2500, ['fullAdvance']=2501, ['is_extender']=1, ['startConnectorLength']=2500, }, -- rep ---~ { ['component']="uni23A8", ['endConnectorLength']=1000, ['fullAdvance']=4688, ['is_extender']=0, ['startConnectorLength']=1000, }, -- mid ---~ { ['component']="uni23AA", ['endConnectorLength']=2500, ['fullAdvance']=2501, ['is_extender']=1, ['startConnectorLength']=2500, }, -- rep ---~ { ['component']="uni23A7", ['endConnectorLength']=0, ['fullAdvance']=2546, ['is_extender']=0, ['startConnectorLength']=1000, }, -- top ---~ }, ---~ ['variants']="braceleft braceleft.vsize1 braceleft.vsize2 braceleft.vsize3 braceleft.vsize4 braceleft.vsize5 braceleft.vsize6 braceleft.vsize7", ---~ }, ---~ ['width']=793, ---~ }, - --- the first version made a top/mid/not extensible table, now we just pass on the variants data --- and deal with it in the tfm scaler (there is no longer an extensible table anyway) - --- we cannot share descriptions as virtual fonts might extend them (ok, we could --- use a cache with a hash - -fonts.formats.dfont = "truetype" -fonts.formats.ttc = "truetype" -fonts.formats.ttf = "truetype" -fonts.formats.otf = "opentype" - -function otf.copy_to_tfm(data,cache_id) -- we can save a copy when we reorder the tma to unicode (nasty due to one->many) +-- the first version made a top/mid/not extensible table, now we just +-- pass on the variants data and deal with it in the tfm scaler (there +-- is no longer an extensible table anyway) +-- +-- we cannot share descriptions as virtual fonts might extend them (ok, +-- we could use a cache with a hash +-- +-- we already assing an empty tabel to characters as we can add for +-- instance protruding info and loop over characters; one is not supposed +-- to change descriptions and if one does so one should make a copy! + +local function copytotfm(data,cache_id) if data then - local glyphs, pfminfo, metadata = data.glyphs or { }, data.pfminfo or { }, data.metadata or { } - local luatex = data.luatex - local unicodes = luatex.unicodes -- names to unicodes - local indices = luatex.indices - local characters, parameters, math_parameters, descriptions = { }, { }, { }, { } - local designsize = metadata.designsize or metadata.design_size or 100 + local metadata = data.metadata + local resources = data.resources + local properties = table.derive(data.properties) + local descriptions = table.derive(data.descriptions) + local goodies = table.derive(data.goodies) + local characters = { } + local parameters = { } + local mathparameters = { } + -- + local pfminfo = metadata.pfminfo or { } + local resources = data.resources + local unicodes = resources.unicodes + -- local mode = data.mode or "base" + local spaceunits = 500 + local spacer = "space" + local designsize = metadata.designsize or metadata.design_size or 100 + local mathspecs = metadata.math + -- if designsize == 0 then designsize = 100 end - local spaceunits = 500 - -- indices maps from unicodes to indices - for u, i in next, indices do - characters[u] = { } -- we need this because for instance we add protruding info and loop over characters - descriptions[u] = glyphs[i] - end - -- math - if metadata.math then - -- parameters - for name, value in next, metadata.math do - math_parameters[name] = value + if mathspecs then + for name, value in next, mathspecs do + mathparameters[name] = value end - -- we could use a subset - for u, char in next, characters do - local d = descriptions[u] + end + for unicode, _ in next, data.descriptions do -- use parent table + characters[unicode] = { } + end + if mathspecs then + -- we could move this to the scaler but not that much is saved + -- and this is cleaner + for unicode, character in next, characters do + local d = descriptions[unicode] local m = d.math - -- we have them shared because that packs nicer - -- we could prepare the variants and keep 'm in descriptions if m then + -- watch out: luatex uses horiz_variants for the parts local variants = m.horiz_variants + local parts = m.horiz_parts + -- local done = { [unicode] = true } if variants then - local c = char - for n in gmatch(variants,"[^ ]+") do - local un = unicodes[n] - if un and u ~= un then + local c = character + for i=1,#variants do + local un = variants[i] + -- if done[un] then + -- -- report_otf("skipping cyclic reference U+%05X in math variant U+%05X",un,unicode) + -- else c.next = un c = characters[un] - end - end - c.horiz_variants = m.horiz_parts - else - local variants = m.vert_variants - if variants then - local c = char - for n in gmatch(variants,"[^ ]+") do - local un = unicodes[n] - if un and u ~= un then - c.next = un - c = characters[un] - end - end - c.vert_variants = m.vert_parts - c.vert_italic_correction = m.vert_italic_correction - end + -- done[un] = true + -- end + end -- c is now last in chain + c.horiz_variants = parts + elseif parts then + character.horiz_variants = parts + end + local variants = m.vert_variants + local parts = m.vert_parts + -- local done = { [unicode] = true } + if variants then + local c = character + for i=1,#variants do + local un = variants[i] + -- if done[un] then + -- -- report_otf("skipping cyclic reference U+%05X in math variant U+%05X",un,unicode) + -- else + c.next = un + c = characters[un] + -- done[un] = true + -- end + end -- c is now last in chain + c.vert_variants = parts + elseif parts then + character.vert_variants = parts + end + local italic_correction = m.vert_italic_correction + if italic_correction then + character.vert_italic_correction = italic_correction -- was c. + end + local top_accent = m.top_accent + if top_accent then + character.top_accent = top_accent end local kerns = m.kerns if kerns then - char.mathkerns = kerns + character.mathkerns = kerns end end end end -- end math - local endash, emdash, space = 0x20, 0x2014, "space" -- unicodes['space'], unicodes['emdash'] - if metadata.isfixedpitch then - if descriptions[endash] then - spaceunits, spacer = descriptions[endash].width, "space" + local monospaced = metadata.isfixedpitch or (pfminfo.panose and pfminfo.panose.proportion == "Monospaced") + local charwidth = pfminfo.avgwidth -- or unset + local italicangle = metadata.italicangle + local charxheight = pfminfo.os2_xheight and pfminfo.os2_xheight > 0 and pfminfo.os2_xheight + properties.monospaced = monospaced + parameters.italicangle = italicangle + parameters.charwidth = charwidth + parameters.charxheight = charxheight + -- + local space = 0x0020 -- unicodes['space'], unicodes['emdash'] + local emdash = 0x2014 -- unicodes['space'], unicodes['emdash'] + if monospaced then + if descriptions[space] then + spaceunits, spacer = descriptions[space].width, "space" end if not spaceunits and descriptions[emdash] then spaceunits, spacer = descriptions[emdash].width, "emdash" end - if not spaceunits and metadata.charwidth then - spaceunits, spacer = metadata.charwidth, "charwidth" + if not spaceunits and charwidth then + spaceunits, spacer = charwidth, "charwidth" end else - if descriptions[endash] then - spaceunits, spacer = descriptions[endash].width, "space" + if descriptions[space] then + spaceunits, spacer = descriptions[space].width, "space" end if not spaceunits and descriptions[emdash] then spaceunits, spacer = descriptions[emdash].width/2, "emdash/2" end - if not spaceunits and metadata.charwidth then - spaceunits, spacer = metadata.charwidth, "charwidth" + if not spaceunits and charwidth then + spaceunits, spacer = charwidth, "charwidth" end end - spaceunits = tonumber(spaceunits) or tfm.units/2 -- 500 -- brrr + spaceunits = tonumber(spaceunits) or 500 -- brrr -- we need a runtime lookup because of running from cdrom or zip, brrr (shouldn't we use the basename then?) - local filename = fonts.tfm.checked_filename(luatex) + local filename = constructors.checkedfilename(resources) local fontname = metadata.fontname local fullname = metadata.fullname or fontname - local cidinfo = data.cidinfo local units = metadata.units_per_em or 1000 -- - cidinfo.registry = cidinfo and cidinfo.registry or "" -- weird here, fix upstream - -- parameters.slant = 0 parameters.space = spaceunits -- 3.333 (cmr10) parameters.space_stretch = units/2 -- 500 -- 1.666 (cmr10) @@ -1606,20 +1808,21 @@ function otf.copy_to_tfm(data,cache_id) -- we can save a copy when we reorder th if spaceunits < 2*units/5 then -- todo: warning end - local italicangle = metadata.italicangle - if italicangle then -- maybe also in afm _ - parameters.slant = parameters.slant - math.round(math.tan(italicangle*math.pi/180)) + if italicangle then + parameters.italicangle = italicangle + parameters.italicfactor = math.cos(math.rad(90+italicangle)) + parameters.slant = - math.round(math.tan(italicangle*math.pi/180)) end - if metadata.isfixedpitch then + if monospaced then parameters.space_stretch = 0 parameters.space_shrink = 0 - elseif otf.syncspace then -- + elseif syncspace then -- parameters.space_stretch = spaceunits/2 parameters.space_shrink = spaceunits/3 end parameters.extra_space = parameters.space_shrink -- 1.111 (cmr10) - if pfminfo.os2_xheight and pfminfo.os2_xheight > 0 then - parameters.x_height = pfminfo.os2_xheight + if charxheight then + parameters.x_height = charxheight else local x = 0x78 -- unicodes['x'] if x then @@ -1630,99 +1833,109 @@ function otf.copy_to_tfm(data,cache_id) -- we can save a copy when we reorder th end end -- + parameters.designsize = (designsize/10)*65536 + parameters.ascender = abs(metadata.ascent or 0) + parameters.descender = abs(metadata.descent or 0) + parameters.units = units + -- + properties.space = spacer + properties.encodingbytes = 2 + properties.format = data.format or fonts.formats[filename] or "opentype" + properties.noglyphnames = true + properties.filename = filename + properties.fontname = fontname + properties.fullname = fullname + properties.psname = fontname or fullname + properties.name = filename or fullname + -- + -- properties.name = specification.name + -- properties.sub = specification.sub return { - characters = characters, - parameters = parameters, - math_parameters = math_parameters, - descriptions = descriptions, - indices = indices, - unicodes = unicodes, - type = "real", - direction = 0, - boundarychar_label = 0, - boundarychar = 65536, - designsize = (designsize/10)*65536, - spacer = "500 units", - encodingbytes = 2, - filename = filename, - fontname = fontname, - fullname = fullname, - psname = fontname or fullname, - name = filename or fullname, - units = units, - format = fonts.fontformat(filename,"opentype"), - cidinfo = cidinfo, - ascender = abs(metadata.ascent or 0), - descender = abs(metadata.descent or 0), - spacer = spacer, - italicangle = italicangle, + characters = characters, + descriptions = descriptions, + parameters = parameters, + mathparameters = mathparameters, + resources = resources, + properties = properties, + goodies = goodies, } - else - return nil end end -otf.features.register('mathsize') - -function tfm.read_from_open_type(specification) - local tfmtable = otf.otf_to_tfm(specification) - if tfmtable then - local otfdata = tfmtable.shared.otfdata - tfmtable.name = specification.name - tfmtable.sub = specification.sub - local s = specification.size - local m = otfdata.metadata.math - if m then - -- this will move to a function - local f = specification.features - if f then - local f = f.normal - if f and f.mathsize then - local mathsize = specification.mathsize or 0 - if mathsize == 2 then - local p = m.ScriptPercentScaleDown - if p then - local ps = p * specification.textsize / 100 - if trace_math then - logs.report("define font","asked script size: %s, used: %s (%2.2f %%)",s,ps,(ps/s)*100) - end - s = ps - end - elseif mathsize == 3 then - local p = m.ScriptScriptPercentScaleDown - if p then - local ps = p * specification.textsize / 100 - if trace_math then - logs.report("define font","asked scriptscript size: %s, used: %s (%2.2f %%)",s,ps,(ps/s)*100) - end - s = ps - end - end - end - end - end - tfmtable = tfm.scale(tfmtable,s,specification.relativeid) - if tfm.fontname_mode == "specification" then - -- not to be used in context ! - local specname = specification.specification - if specname then - tfmtable.name = specname - if trace_defining then - logs.report("define font","overloaded fontname: '%s'",specname) +local function otftotfm(specification) + local cache_id = specification.hash + local tfmdata = containers.read(constructors.cache,cache_id) + if not tfmdata then + local name = specification.name + local sub = specification.sub + local filename = specification.filename + local format = specification.format + local features = specification.features.normal + local rawdata = otf.load(filename,format,sub,features and features.featurefile) + if rawdata and next(rawdata) then + rawdata.lookuphash = { } + tfmdata = copytotfm(rawdata,cache_id) + if tfmdata and next(tfmdata) then + -- at this moment no characters are assigned yet, only empty slots + local features = constructors.checkedfeatures("otf",features) + local shared = tfmdata.shared + if not shared then + shared = { } + tfmdata.shared = shared end + shared.rawdata = rawdata + shared.features = features -- default + shared.dynamics = { } + shared.processes = { } + tfmdata.changed = { } + shared.features = features + shared.processes = otf.setfeatures(tfmdata,features) end end - fonts.logger.save(tfmtable,file.extname(specification.filename),specification) + containers.write(constructors.cache,cache_id,tfmdata) + end + return tfmdata +end + +local function read_from_otf(specification) + local tfmdata = otftotfm(specification) + if tfmdata then + -- this late ? .. needs checking + tfmdata.properties.name = specification.name + tfmdata.properties.sub = specification.sub + -- + tfmdata = constructors.scale(tfmdata,specification) + constructors.applymanipulators("otf",tfmdata,specification.features.normal,trace_features,report_otf) + constructors.setname(tfmdata,specification) -- only otf? + fonts.loggers.register(tfmdata,file.extname(specification.filename),specification) + end + return tfmdata +end + +local function checkmathsize(tfmdata,mathsize) + local mathdata = tfmdata.shared.rawdata.metadata.math + local mathsize = tonumber(mathsize) + if mathdata then -- we cannot use mathparameters as luatex will complain + local parameters = tfmdata.parameters + parameters.scriptpercentage = mathdata.ScriptPercentScaleDown + parameters.scriptscriptpercentage = mathdata.ScriptScriptPercentScaleDown + parameters.mathsize = mathsize end ---~ print(tfmtable.fullname) - return tfmtable end +registerotffeature { + name = "mathsize", + description = "apply mathsize as specified in the font", + initializers = { + base = checkmathsize, + node = checkmathsize, + } +} + -- helpers -function otf.collect_lookups(otfdata,kind,script,language) - -- maybe store this in the font - local sequences = otfdata.luatex.sequences +function otf.collectlookups(rawdata,kind,script,language) + local sequences = rawdata.resources.sequences if sequences then local featuremap, featurelist = { }, { } for s=1,#sequences do @@ -1750,3 +1963,53 @@ function otf.collect_lookups(otfdata,kind,script,language) end return nil, nil end + +-- readers + +local function check_otf(forced,specification,suffix,what) + local name = specification.name + if forced then + name = file.addsuffix(name,suffix,true) + end + local fullname, tfmdata = findbinfile(name,suffix) or "", nil -- one shot + if fullname == "" then + fullname = fonts.names.getfilename(name,suffix) + end + if fullname ~= "" then + specification.filename, specification.format = fullname, what -- hm, so we do set the filename, then + tfmdata = read_from_otf(specification) -- we need to do it for all matches / todo + end + return tfmdata +end + +local function opentypereader(specification,suffix,what) + local forced = specification.forced or "" + if forced == "otf" then + return check_otf(true,specification,forced,"opentype") + elseif forced == "ttf" or forced == "ttc" or forced == "dfont" then + return check_otf(true,specification,forced,"truetype") + else + return check_otf(false,specification,suffix,what) + end +end + +readers.opentype = opentypereader + +local formats = fonts.formats + +formats.otf = "opentype" +formats.ttf = "truetype" +formats.ttc = "truetype" +formats.dfont = "truetype" + +function readers.otf (specification) return opentypereader(specification,"otf",formats.otf ) end +function readers.ttf (specification) return opentypereader(specification,"ttf",formats.ttf ) end +function readers.ttc (specification) return opentypereader(specification,"ttf",formats.ttc ) end +function readers.dfont(specification) return opentypereader(specification,"ttf",formats.dfont) end + +-- this will be overloaded + +function otf.scriptandlanguage(tfmdata,attr) + local properties = tfmdata.properties + return properties.script or "dflt", properties.language or "dflt" +end diff --git a/Master/texmf-dist/tex/context/base/font-oth.lua b/Master/texmf-dist/tex/context/base/font-oth.lua new file mode 100644 index 00000000000..59dca31d918 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/font-oth.lua @@ -0,0 +1,51 @@ +if not modules then modules = { } end modules ['font-oth'] = { + version = 1.001, + comment = "companion to font-oth.lua (helpers)", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local fonts = fonts +local otf = fonts.handlers.otf + +-- todo: use nodemode data is available + +function otf.getalternate(tfmdata,k,kind,value) -- just initialize nodemode and use that (larger mem print) + if value then + local description = tfmdata.descriptions[k] + if description then + local slookups = description.slookups -- we assume only slookups (we can always extend) + if slookups then + local shared = tfmdata.shared + local rawdata = shared and shared.rawdata + if rawdata then + local lookuptypes = rawdata.resources.lookuptypes + if lookuptypes then + local properties = tfmdata.properties + -- we could cache these + local validlookups, lookuplist = otf.collectlookups(rawdata,kind,properties.script,properties.language) + if validlookups then + local choice = tonumber(value) or 1 -- no random here (yet) + for l=1,#lookuplist do + local lookup = lookuplist[l] + local found = slookups[lookup] + if found then + local lookuptype = lookuptypes[lookup] + if lookuptype == "substitution" then + return found + elseif lookuptype == "alternate" then + return found[choice] or found[#found] + else + -- ignore + end + end + end + end + end + end + end + end + end + return k +end diff --git a/Master/texmf-dist/tex/context/base/font-oti.lua b/Master/texmf-dist/tex/context/base/font-oti.lua index 4cb27062623..d6853db31f3 100644 --- a/Master/texmf-dist/tex/context/base/font-oti.lua +++ b/Master/texmf-dist/tex/context/base/font-oti.lua @@ -6,52 +6,87 @@ if not modules then modules = { } end modules ['font-oti'] = { license = "see context related readme files" } --- i need to check features=yes|no also in relation to hashing - local lower = string.lower -local otf = fonts.otf +local allocate = utilities.storage.allocate + +local fonts = fonts +local otf = { } +fonts.handlers.otf = otf + +local otffeatures = fonts.constructors.newfeatures("otf") +local registerotffeature = otffeatures.register + +registerotffeature { + name = "features", + description = "initialization of feature handler", + default = true, +} -otf.default_language = 'latn' -otf.default_script = 'dflt' +-- these are later hooked into node and base initializaters -local languages = otf.tables.languages -local scripts = otf.tables.scripts +local otftables = otf.tables -- not always defined -function otf.features.language(tfmdata,value) +local function setmode(tfmdata,value) if value then - value = lower(value) - if languages[value] then - tfmdata.language = value - end + tfmdata.properties.mode = lower(value) end end -function otf.features.script(tfmdata,value) +local function setlanguage(tfmdata,value) if value then - value = lower(value) - if scripts[value] then - tfmdata.script = value + local cleanvalue = lower(value) + local languages = otftables and otftables.languages + local properties = tfmdata.properties + if not languages then + properties.language = cleanvalue + elseif languages[value] then + properties.language = cleanvalue + else + properties.language = "dflt" end end end -function otf.features.mode(tfmdata,value) +local function setscript(tfmdata,value) if value then - tfmdata.mode = lower(value) + local cleanvalue = lower(value) + local scripts = otftables and otftables.scripts + local properties = tfmdata.properties + if not scripts then + properties.script = cleanvalue + elseif scripts[value] then + properties.script = cleanvalue + else + properties.script = "dflt" + end end end -fonts.initializers.base.otf.language = otf.features.language -fonts.initializers.base.otf.script = otf.features.script -fonts.initializers.base.otf.mode = otf.features.mode -fonts.initializers.base.otf.method = otf.features.mode +registerotffeature { + name = "mode", + description = "mode", + initializers = { + base = setmode, + node = setmode, + } +} -fonts.initializers.node.otf.language = otf.features.language -fonts.initializers.node.otf.script = otf.features.script -fonts.initializers.node.otf.mode = otf.features.mode -fonts.initializers.node.otf.method = otf.features.mode +registerotffeature { + name = "language", + description = "language", + initializers = { + base = setlanguage, + node = setlanguage, + } +} -otf.features.register("features",true) -- we always do features -table.insert(fonts.processors,"features") -- we need a proper function for doing this +registerotffeature { + name = "script", + description = "script", + initializers = { + base = setscript, + node = setscript, + } +} diff --git a/Master/texmf-dist/tex/context/base/font-otn.lua b/Master/texmf-dist/tex/context/base/font-otn.lua index d4f89adc6ec..81b3fd267cc 100644 --- a/Master/texmf-dist/tex/context/base/font-otn.lua +++ b/Master/texmf-dist/tex/context/base/font-otn.lua @@ -10,14 +10,6 @@ if not modules then modules = { } end modules ['font-otn'] = { -- much functionality could only be implemented thanks to the husayni font -- of Idris Samawi Hamid to who we dedicate this module. --- I'm in the process of cleaning up the code (which happens in another --- file) so don't rely on things staying the same. - --- some day when we can jit this, we can use more functions - --- we can use more lpegs when lpeg is extended with function args and so --- resolving to unicode does not gain much - -- in retrospect it always looks easy but believe it or not, it took a lot -- of work to get proper open type support done: buggy fonts, fuzzy specs, -- special made testfonts, many skype sessions between taco, idris and me, @@ -32,10 +24,7 @@ if not modules then modules = { } end modules ['font-otn'] = { -- alternative loop quitters -- check cursive and r2l -- find out where ignore-mark-classes went --- remove unused tables --- slide tail (always glue at the end so only needed once -- default features (per language, script) --- cleanup kern(class) code, remove double info -- handle positions (we need example fonts) -- handle gpos_single (we might want an extra width field in glyph nodes because adding kerns might interfere) @@ -111,6 +100,8 @@ results in different tables.

-- gpos_context ok -- -- gpos_contextchain ok -- -- +-- todo: contextpos and contextsub and class stuff +-- -- actions: -- -- handler : actions triggered by lookup @@ -120,13 +111,20 @@ results in different tables.

-- remark: the 'not implemented yet' variants will be done when we have fonts that use them -- remark: we need to check what to do with discretionaries +-- We used to have independent hashes for lookups but as the tags are unique +-- we now use only one hash. If needed we can have multiple again but in that +-- case I will probably prefix (i.e. rename) the lookups in the cached font file. + local concat, insert, remove = table.concat, table.insert, table.remove local format, gmatch, gsub, find, match, lower, strip = string.format, string.gmatch, string.gsub, string.find, string.match, string.lower, string.strip local type, next, tonumber, tostring = type, next, tonumber, tostring local lpegmatch = lpeg.match +local random = math.random + +local logs, trackers, nodes, attributes = logs, trackers, nodes, attributes -local otf = fonts.otf -local tfm = fonts.tfm +local fonts = fonts +local otf = fonts.handlers.otf local trace_lookups = false trackers.register("otf.lookups", function(v) trace_lookups = v end) local trace_singles = false trackers.register("otf.singles", function(v) trace_singles = v end) @@ -145,6 +143,12 @@ local trace_steps = false trackers.register("otf.steps", function local trace_skips = false trackers.register("otf.skips", function(v) trace_skips = v end) local trace_directions = false trackers.register("otf.directions", function(v) trace_directions = v end) +local report_direct = logs.reporter("fonts","otf direct") +local report_subchain = logs.reporter("fonts","otf subchain") +local report_chain = logs.reporter("fonts","otf chain") +local report_process = logs.reporter("fonts","otf process") +local report_prepare = logs.reporter("fonts","otf prepare") + trackers.register("otf.verbose_chain", function(v) otf.setcontextchain(v and "verbose") end) trackers.register("otf.normal_chain", function(v) otf.setcontextchain(v and "normal") end) @@ -155,83 +159,84 @@ trackers.register("otf.injections","nodes.injections") trackers.register("*otf.sample","otf.steps,otf.actions,otf.analyzing") -local insert_node_after = node.insert_after -local delete_node = nodes.delete -local copy_node = node.copy -local find_node_tail = node.tail or node.slide -local set_attribute = node.set_attribute -local has_attribute = node.has_attribute +local insert_node_after = node.insert_after +local delete_node = nodes.delete +local copy_node = node.copy +local find_node_tail = node.tail or node.slide +local set_attribute = node.set_attribute +local has_attribute = node.has_attribute + +local setmetatableindex = table.setmetatableindex + +local zwnj = 0x200C +local zwj = 0x200D +local wildcard = "*" +local default = "dflt" + +local nodecodes = nodes.nodecodes +local whatcodes = nodes.whatcodes +local glyphcodes = nodes.glyphcodes + +local glyph_code = nodecodes.glyph +local glue_code = nodecodes.glue +local disc_code = nodecodes.disc +local whatsit_code = nodecodes.whatsit -local zwnj = 0x200C -local zwj = 0x200D -local wildcard = "*" -local default = "dflt" +local dir_code = whatcodes.dir +local localpar_code = whatcodes.localpar -local split_at_space = lpeg.splitters[" "] or lpeg.Ct(lpeg.splitat(" ")) -- no trailing or multiple spaces anyway +local ligature_code = glyphcodes.ligature -local glyph = node.id('glyph') -local glue = node.id('glue') -local kern = node.id('kern') -local disc = node.id('disc') -local whatsit = node.id('whatsit') +local privateattribute = attributes.private -local state = attributes.private('state') -local markbase = attributes.private('markbase') -local markmark = attributes.private('markmark') -local markdone = attributes.private('markdone') -local cursbase = attributes.private('cursbase') -local curscurs = attributes.private('curscurs') -local cursdone = attributes.private('cursdone') -local kernpair = attributes.private('kernpair') +local state = privateattribute('state') +local markbase = privateattribute('markbase') +local markmark = privateattribute('markmark') +local markdone = privateattribute('markdone') +local cursbase = privateattribute('cursbase') +local curscurs = privateattribute('curscurs') +local cursdone = privateattribute('cursdone') +local kernpair = privateattribute('kernpair') -local set_mark = nodes.set_mark -local set_cursive = nodes.set_cursive -local set_kern = nodes.set_kern -local set_pair = nodes.set_pair +local injections = nodes.injections +local setmark = injections.setmark +local setcursive = injections.setcursive +local setkern = injections.setkern +local setpair = injections.setpair -local markonce = true -local cursonce = true -local kernonce = true +local markonce = true +local cursonce = true +local kernonce = true -local fontdata = fonts.ids +local fonthashes = fonts.hashes +local fontdata = fonthashes.identifiers -otf.features.process = { } +local otffeatures = fonts.constructors.newfeatures("otf") +local registerotffeature = otffeatures.register + +local onetimemessage = fonts.loggers.onetimemessage -- we share some vars here, after all, we have no nested lookups and -- less code -local tfmdata = false -local otfdata = false -local characters = false -local descriptions = false -local marks = false -local indices = false -local unicodes = false -local currentfont = false -local lookuptable = false -local anchorlookups = false -local handlers = { } -local rlmode = 0 -local featurevalue = false - --- we cheat a bit and assume that a font,attr combination are kind of ranged - -local context_setups = fonts.define.specify.context_setups -local context_numbers = fonts.define.specify.context_numbers -local context_merged = fonts.define.specify.context_merged - --- we cannot optimize with "start = first_character(head)" because then we don't +local tfmdata = false +local characters = false +local descriptions = false +local resources = false +local marks = false +local currentfont = false +local lookuptable = false +local anchorlookups = false +local lookuptypes = false +local handlers = { } +local rlmode = 0 +local featurevalue = false + +-- we cannot optimize with "start = first_glyph(head)" because then we don't -- know which rlmode we're in which messes up cursive handling later on -- -- head is always a whatsit so we can safely assume that head is not changed -local special_attributes = { - init = 1, - medi = 2, - fina = 3, - isol = 4 -} - -- we use this for special testing and documentation local checkstep = (nodes and nodes.tracers and nodes.tracers.steppers.check) or function() end @@ -242,10 +247,11 @@ local function logprocess(...) if trace_steps then registermessage(...) end - logs.report("otf direct",...) + report_direct(...) end + local function logwarning(...) - logs.report("otf direct",...) + report_direct(...) end local function gref(n) @@ -253,9 +259,9 @@ local function gref(n) local description = descriptions[n] local name = description and description.name if name then - return format("U+%04X (%s)",n,name) + return format("U+%05X (%s)",n,name) else - return format("U+%04X",n) + return format("U+%05X",n) end elseif not n then return "" @@ -263,9 +269,11 @@ local function gref(n) local num, nam = { }, { } for i=1,#n do local ni = n[i] - num[#num+1] = format("U+%04X",ni) - local dni = descriptions[ni] - nam[#num] = (dni and dni.name) or "?" + if tonumber(ni) then -- later we will start at 2 + local di = descriptions[ni] + num[i] = format("U+%05X",ni) + nam[i] = di and di.name or "?" + end end return format("%s (%s)",concat(num," "), concat(nam," ")) end @@ -303,89 +311,77 @@ local function markstoligature(kind,lookupname,start,stop,char) snext.prev = current end start.prev, stop.next = nil, nil - current.char, current.subtype, current.components = char, 2, start + current.char, current.subtype, current.components = char, ligature_code, start return keep end local function toligature(kind,lookupname,start,stop,char,markflag,discfound) -- brr head - if start ~= stop then ---~ if discfound then ---~ local lignode = copy_node(start) ---~ lignode.font = start.font ---~ lignode.char = char ---~ lignode.subtype = 2 ---~ start = node.do_ligature_n(start, stop, lignode) ---~ if start.id == disc then ---~ local prev = start.prev ---~ start = start.next ---~ end - if discfound then - -- print("start->stop",nodes.tosequence(start,stop)) - local lignode = copy_node(start) - lignode.font, lignode.char, lignode.subtype = start.font, char, 2 - local next, prev = stop.next, start.prev - stop.next = nil - lignode = node.do_ligature_n(start, stop, lignode) - prev.next = lignode - if next then - next.prev = lignode - end - lignode.next, lignode.prev = next, prev - start = lignode - -- print("start->end",nodes.tosequence(start)) - else -- start is the ligature - local deletemarks = markflag ~= "mark" - local n = copy_node(start) - local current - current, start = insert_node_after(start,start,n) - local snext = stop.next - current.next = snext - if snext then - snext.prev = current - end - start.prev, stop.next = nil, nil - current.char, current.subtype, current.components = char, 2, start - local head = current - if deletemarks then - if trace_marks then - while start do - if marks[start.char] then - logwarning("%s: remove mark %s",pref(kind,lookupname),gref(start.char)) - end - start = start.next - end - end - else - local i = 0 + if start == stop then + start.char = char + elseif discfound then + -- print("start->stop",nodes.tosequence(start,stop)) + local lignode = copy_node(start) + lignode.font, lignode.char, lignode.subtype = start.font, char, ligature_code + local next, prev = stop.next, start.prev + stop.next = nil + lignode = node.do_ligature_n(start, stop, lignode) + prev.next = lignode + if next then + next.prev = lignode + end + lignode.next, lignode.prev = next, prev + start = lignode + -- print("start->end",nodes.tosequence(start)) + else -- start is the ligature + local deletemarks = markflag ~= "mark" + local n = copy_node(start) + local current + current, start = insert_node_after(start,start,n) + local snext = stop.next + current.next = snext + if snext then + snext.prev = current + end + start.prev, stop.next = nil, nil + current.char, current.subtype, current.components = char, ligature_code, start + local head = current + if deletemarks then + if trace_marks then while start do if marks[start.char] then - set_attribute(start,markdone,i) - if trace_marks then - logwarning("%s: keep mark %s, gets index %s",pref(kind,lookupname),gref(start.char),i) - end - head, current = insert_node_after(head,current,copy_node(start)) - else - i = i + 1 + logwarning("%s: remove mark %s",pref(kind,lookupname),gref(start.char)) end start = start.next end - start = current.next - while start and start.id == glyph do - if marks[start.char] then - set_attribute(start,markdone,i) - if trace_marks then - logwarning("%s: keep mark %s, gets index %s",pref(kind,lookupname),gref(start.char),i) - end - else - break + end + else + local i = 0 + while start do + if marks[start.char] then + set_attribute(start,markdone,i) + if trace_marks then + logwarning("%s: keep mark %s, gets index %s",pref(kind,lookupname),gref(start.char),i) end - start = start.next + head, current = insert_node_after(head,current,copy_node(start)) + else + i = i + 1 end + start = start.next + end + start = current.next + while start and start.id == glyph_code do + if marks[start.char] then + set_attribute(start,markdone,i) + if trace_marks then + logwarning("%s: keep mark %s, gets index %s",pref(kind,lookupname),gref(start.char),i) + end + else + break + end + start = start.next end - return head end - else - start.char = char + return head end return start end @@ -401,7 +397,7 @@ end local function alternative_glyph(start,alternatives,kind,chainname,chainlookupname,lookupname) -- chainname and chainlookupname optional local value, choice, n = featurevalue or tfmdata.shared.features[kind], nil, #alternatives -- global value, brrr if value == "random" then - local r = math.random(1,n) + local r = random(1,n) value, choice = format("random, choice %s",r), alternatives[r] elseif value == "first" then value, choice = format("first, choice %s",1), alternatives[1] @@ -428,6 +424,33 @@ local function alternative_glyph(start,alternatives,kind,chainname,chainlookupna return choice, value end +local function multiple_glyphs(start,multiple) + local nofmultiples = #multiple + if nofmultiples > 0 then + start.char = multiple[1] + if nofmultiples > 1 then + local sn = start.next + for k=2,nofmultiples do -- todo: use insert_node + local n = copy_node(start) + n.char = multiple[k] + n.next = sn + n.prev = start + if sn then + sn.prev = n + end + start.next = n + start = n + end + end + return start, true + else + if trace_multiples then + logprocess("no multiple for %s",gref(start.char)) + end + return start, false + end +end + function handlers.gsub_alternate(start,kind,lookupname,alternative,sequence) local choice, index = alternative_glyph(start,alternative,kind,lookupname) if trace_alternatives then @@ -441,41 +464,21 @@ function handlers.gsub_multiple(start,kind,lookupname,multiple) if trace_multiples then logprocess("%s: replacing %s by multiple %s",pref(kind,lookupname),gref(start.char),gref(multiple)) end - start.char = multiple[1] - if #multiple > 1 then - for k=2,#multiple do - local n = copy_node(start) - n.char = multiple[k] - local sn = start.next - n.next = sn - n.prev = start - if sn then - sn.prev = n - end - start.next = n - start = n - end - end - return start, true + return multiple_glyphs(start,multiple) end -function handlers.gsub_ligature(start,kind,lookupname,ligature,sequence) --or maybe pass lookup ref +function handlers.gsub_ligature(start,kind,lookupname,ligature,sequence) local s, stop, discfound = start.next, nil, false local startchar = start.char if marks[startchar] then while s do local id = s.id - if id == glyph and s.subtype<256 then - if s.font == currentfont then - local char = s.char - local lg = ligature[1][char] - if not lg then - break - else - stop = s - ligature = lg - s = s.next - end + if id == glyph_code and s.subtype<256 and s.font == currentfont then + local lg = ligature[s.char] + if lg then + stop = s + ligature = lg + s = s.next else break end @@ -483,54 +486,64 @@ function handlers.gsub_ligature(start,kind,lookupname,ligature,sequence) --or ma break end end - if stop and ligature[2] then - if trace_ligatures then - local stopchar = stop.char - start = markstoligature(kind,lookupname,start,stop,ligature[2]) - logprocess("%s: replacing %s upto %s by ligature %s",pref(kind,lookupname),gref(startchar),gref(stopchar),gref(start.char)) + if stop then + local lig = ligature.ligature + if lig then + if trace_ligatures then + local stopchar = stop.char + start = markstoligature(kind,lookupname,start,stop,lig) + logprocess("%s: replacing %s upto %s by ligature %s",pref(kind,lookupname),gref(startchar),gref(stopchar),gref(start.char)) + else + start = markstoligature(kind,lookupname,start,stop,lig) + end + return start, true else - start = markstoligature(kind,lookupname,start,stop,ligature[2]) + -- ok, goto next lookup end - return start, true end else local skipmark = sequence.flags[1] while s do local id = s.id - if id == glyph and s.subtype<256 then + if id == glyph_code and s.subtype<256 then if s.font == currentfont then local char = s.char if skipmark and marks[char] then s = s.next else - local lg = ligature[1][char] - if not lg then - break - else + local lg = ligature[char] + if lg then stop = s ligature = lg s = s.next + else + break end end else break end - elseif id == disc then + elseif id == disc_code then discfound = true s = s.next else break end end - if stop and ligature[2] then - if trace_ligatures then - local stopchar = stop.char - start = toligature(kind,lookupname,start,stop,ligature[2],skipmark,discfound) - logprocess("%s: replacing %s upto %s by ligature %s",pref(kind,lookupname),gref(startchar),gref(stopchar),gref(start.char)) + if stop then + local lig = ligature.ligature + if lig then + if trace_ligatures then + local stopchar = stop.char + start = toligature(kind,lookupname,start,stop,lig,skipmark,discfound) + logprocess("%s: replacing %s upto %s by ligature %s",pref(kind,lookupname),gref(startchar),gref(stopchar),gref(start.char)) + else + start = toligature(kind,lookupname,start,stop,lig,skipmark,discfound) + end + return start, true else - start = toligature(kind,lookupname,start,stop,ligature[2],skipmark,discfound) + -- ok, goto next lookup end - return start, true end end return start, false @@ -545,12 +558,12 @@ function handlers.gpos_mark2base(start,kind,lookupname,markanchors,sequence) local markchar = start.char if marks[markchar] then local base = start.prev -- [glyph] [start=mark] - if base and base.id == glyph and base.subtype<256 and base.font == currentfont then + if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then local basechar = base.char if marks[basechar] then while true do base = base.prev - if base and base.id == glyph and base.subtype<256 and base.font == currentfont then + if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then basechar = base.char if not marks[basechar] then break @@ -575,7 +588,7 @@ function handlers.gpos_mark2base(start,kind,lookupname,markanchors,sequence) if al[anchor] then local ma = markanchors[anchor] if ma then - local dx, dy, bound = set_mark(start,base,tfmdata.factor,rlmode,ba,ma) + local dx, dy, bound = setmark(start,base,tfmdata.parameters.factor,rlmode,ba,ma) if trace_marks then logprocess("%s, anchor %s, bound %s: anchoring mark %s to basechar %s => (%s,%s)", pref(kind,lookupname),anchor,bound,gref(markchar),gref(basechar),dx,dy) @@ -590,7 +603,7 @@ function handlers.gpos_mark2base(start,kind,lookupname,markanchors,sequence) end else -- if trace_bugs then -- logwarning("%s: char %s is missing in font",pref(kind,lookupname),gref(basechar)) - fonts.register_message(currentfont,basechar,"no base anchors") + onetimemessage(currentfont,basechar,"no base anchors",report_fonts) end elseif trace_bugs then logwarning("%s: prev node is no char",pref(kind,lookupname)) @@ -607,13 +620,13 @@ function handlers.gpos_mark2ligature(start,kind,lookupname,markanchors,sequence) if marks[markchar] then local base = start.prev -- [glyph] [optional marks] [start=mark] local index = 1 - if base and base.id == glyph and base.subtype<256 and base.font == currentfont then + if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then local basechar = base.char if marks[basechar] then index = index + 1 while true do base = base.prev - if base and base.id == glyph and base.subtype<256 and base.font == currentfont then + if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then basechar = base.char if marks[basechar] then index = index + 1 @@ -643,7 +656,7 @@ function handlers.gpos_mark2ligature(start,kind,lookupname,markanchors,sequence) if ma then ba = ba[index] if ba then - local dx, dy, bound = set_mark(start,base,tfmdata.factor,rlmode,ba,ma,index) + local dx, dy, bound = setmark(start,base,tfmdata.parameters.factor,rlmode,ba,ma,index) if trace_marks then logprocess("%s, anchor %s, index %s, bound %s: anchoring mark %s to baselig %s at index %s => (%s,%s)", pref(kind,lookupname),anchor,index,bound,gref(markchar),gref(basechar),index,dx,dy) @@ -660,7 +673,7 @@ function handlers.gpos_mark2ligature(start,kind,lookupname,markanchors,sequence) end else -- if trace_bugs then -- logwarning("%s: char %s is missing in font",pref(kind,lookupname),gref(basechar)) - fonts.register_message(currentfont,basechar,"no base anchors") + onetimemessage(currentfont,basechar,"no base anchors",report_fonts) end elseif trace_bugs then logwarning("%s: prev node is no char",pref(kind,lookupname)) @@ -677,7 +690,7 @@ function handlers.gpos_mark2mark(start,kind,lookupname,markanchors,sequence) --~ local alreadydone = markonce and has_attribute(start,markmark) --~ if not alreadydone then local base = start.prev -- [glyph] [basemark] [start=mark] - if base and base.id == glyph and base.subtype<256 and base.font == currentfont then -- subtype test can go + if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then -- subtype test can go local basechar = base.char local baseanchors = descriptions[basechar] if baseanchors then @@ -690,7 +703,7 @@ function handlers.gpos_mark2mark(start,kind,lookupname,markanchors,sequence) if al[anchor] then local ma = markanchors[anchor] if ma then - local dx, dy, bound = set_mark(start,base,tfmdata.factor,rlmode,ba,ma) + local dx, dy, bound = setmark(start,base,tfmdata.parameters.factor,rlmode,ba,ma) if trace_marks then logprocess("%s, anchor %s, bound %s: anchoring mark %s to basemark %s => (%s,%s)", pref(kind,lookupname),anchor,bound,gref(markchar),gref(basechar),dx,dy) @@ -706,7 +719,7 @@ function handlers.gpos_mark2mark(start,kind,lookupname,markanchors,sequence) end else -- if trace_bugs then -- logwarning("%s: char %s is missing in font",pref(kind,lookupname),gref(basechar)) - fonts.register_message(currentfont,basechar,"no base anchors") + onetimemessage(currentfont,basechar,"no base anchors",report_fonts) end elseif trace_bugs then logwarning("%s: prev node is no mark",pref(kind,lookupname)) @@ -731,7 +744,7 @@ function handlers.gpos_cursive(start,kind,lookupname,exitanchors,sequence) -- to end else local nxt = start.next - while not done and nxt and nxt.id == glyph and nxt.subtype<256 and nxt.font == currentfont do + while not done and nxt and nxt.id == glyph_code and nxt.subtype<256 and nxt.font == currentfont do local nextchar = nxt.char if marks[nextchar] then -- should not happen (maybe warning) @@ -748,7 +761,7 @@ function handlers.gpos_cursive(start,kind,lookupname,exitanchors,sequence) -- to if al[anchor] then local exit = exitanchors[anchor] if exit then - local dx, dy, bound = set_cursive(start,nxt,tfmdata.factor,rlmode,exit,entry,characters[startchar],characters[nextchar]) + local dx, dy, bound = setcursive(start,nxt,tfmdata.parameters.factor,rlmode,exit,entry,characters[startchar],characters[nextchar]) if trace_cursive then logprocess("%s: moving %s to %s cursive (%s,%s) using anchor %s and bound %s in rlmode %s",pref(kind,lookupname),gref(startchar),gref(nextchar),dx,dy,anchor,bound,rlmode) end @@ -761,7 +774,7 @@ function handlers.gpos_cursive(start,kind,lookupname,exitanchors,sequence) -- to end else -- if trace_bugs then -- logwarning("%s: char %s is missing in font",pref(kind,lookupname),gref(startchar)) - fonts.register_message(currentfont,startchar,"no entry anchors") + onetimemessage(currentfont,startchar,"no entry anchors",report_fonts) end break end @@ -778,7 +791,7 @@ end function handlers.gpos_single(start,kind,lookupname,kerns,sequence) local startchar = start.char - local dx, dy, w, h = set_pair(start,tfmdata.factor,rlmode,sequence.flags[4],kerns,characters[startchar]) + local dx, dy, w, h = setpair(start,tfmdata.parameters.factor,rlmode,sequence.flags[4],kerns,characters[startchar]) if trace_kerns then logprocess("%s: shifting single %s by (%s,%s) and correction (%s,%s)",pref(kind,lookupname),gref(startchar),dx,dy,w,h) end @@ -793,10 +806,11 @@ function handlers.gpos_pair(start,kind,lookupname,kerns,sequence) return start, false else local prev, done = start, false - local factor = tfmdata.factor - while snext and snext.id == glyph and snext.subtype<256 and snext.font == currentfont do + local factor = tfmdata.parameters.factor + local lookuptype = lookuptypes[lookupname] + while snext and snext.id == glyph_code and snext.subtype<256 and snext.font == currentfont do local nextchar = snext.char -local krn = kerns[nextchar] + local krn = kerns[nextchar] if not krn and marks[nextchar] then prev = snext snext = snext.next @@ -805,38 +819,38 @@ local krn = kerns[nextchar] if not krn then -- skip elseif type(krn) == "table" then - if krn[1] == "pair" then - local a, b = krn[3], krn[4] + if lookuptype == "pair" then -- probably not needed + local a, b = krn[2], krn[3] if a and #a > 0 then local startchar = start.char - local x, y, w, h = set_pair(start,factor,rlmode,sequence.flags[4],a,characters[startchar]) + local x, y, w, h = setpair(start,factor,rlmode,sequence.flags[4],a,characters[startchar]) if trace_kerns then logprocess("%s: shifting first of pair %s and %s by (%s,%s) and correction (%s,%s)",pref(kind,lookupname),gref(startchar),gref(nextchar),x,y,w,h) end end if b and #b > 0 then local startchar = start.char - local x, y, w, h = set_pair(snext,factor,rlmode,sequence.flags[4],b,characters[nextchar]) + local x, y, w, h = setpair(snext,factor,rlmode,sequence.flags[4],b,characters[nextchar]) if trace_kerns then logprocess("%s: shifting second of pair %s and %s by (%s,%s) and correction (%s,%s)",pref(kind,lookupname),gref(startchar),gref(nextchar),x,y,w,h) end end - else - logs.report("%s: check this out (old kern stuff)",pref(kind,lookupname)) - local a, b = krn[3], krn[7] - if a and a ~= 0 then - local k = set_kern(snext,factor,rlmode,a) - if trace_kerns then - logprocess("%s: inserting first kern %s between %s and %s",pref(kind,lookupname),k,gref(prev.char),gref(nextchar)) - end - end - if b and b ~= 0 then - logwarning("%s: ignoring second kern xoff %s",pref(kind,lookupname),b*factor) - end + else -- wrong ... position has different entries + report_process("%s: check this out (old kern stuff)",pref(kind,lookupname)) + -- local a, b = krn[2], krn[6] + -- if a and a ~= 0 then + -- local k = setkern(snext,factor,rlmode,a) + -- if trace_kerns then + -- logprocess("%s: inserting first kern %s between %s and %s",pref(kind,lookupname),k,gref(prev.char),gref(nextchar)) + -- end + -- end + -- if b and b ~= 0 then + -- logwarning("%s: ignoring second kern xoff %s",pref(kind,lookupname),b*factor) + -- end end done = true elseif krn ~= 0 then - local k = set_kern(snext,factor,rlmode,krn) + local k = setkern(snext,factor,rlmode,krn) if trace_kerns then logprocess("%s: inserting kern %s between %s and %s",pref(kind,lookupname),k,gref(prev.char),gref(nextchar)) end @@ -861,59 +875,51 @@ local function logprocess(...) if trace_steps then registermessage(...) end - logs.report("otf subchain",...) -end -local function logwarning(...) - logs.report("otf subchain",...) + report_subchain(...) end --- ['coverage']={ --- ['after']={ "r" }, --- ['before']={ "q" }, --- ['current']={ "a", "b", "c" }, --- }, --- ['lookups']={ "ls_l_1", "ls_l_1", "ls_l_1" }, +local logwarning = report_subchain -function chainmores.chainsub(start,stop,kind,chainname,currentcontext,cache,lookuplist,chainlookupname,n) +function chainmores.chainsub(start,stop,kind,chainname,currentcontext,lookuphash,lookuplist,chainlookupname,n) logprocess("%s: a direct call to chainsub cannot happen",cref(kind,chainname,chainlookupname)) return start, false end -- handled later: -- --- function chainmores.gsub_single(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname,n) --- return chainprocs.gsub_single(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname,n) +-- function chainmores.gsub_single(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,n) +-- return chainprocs.gsub_single(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,n) -- end -function chainmores.gsub_multiple(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname,n) +function chainmores.gsub_multiple(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,n) logprocess("%s: gsub_multiple not yet supported",cref(kind,chainname,chainlookupname)) return start, false end -function chainmores.gsub_alternate(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname,n) + +function chainmores.gsub_alternate(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,n) logprocess("%s: gsub_alternate not yet supported",cref(kind,chainname,chainlookupname)) return start, false end -- handled later: -- --- function chainmores.gsub_ligature(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname,n) --- return chainprocs.gsub_ligature(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname,n) +-- function chainmores.gsub_ligature(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,n) +-- return chainprocs.gsub_ligature(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,n) -- end local function logprocess(...) if trace_steps then registermessage(...) end - logs.report("otf chain",...) -end -local function logwarning(...) - logs.report("otf chain",...) + report_chain(...) end +local logwarning = report_chain + -- We could share functions but that would lead to extra function calls with many -- arguments, redundant tests and confusing messages. -function chainprocs.chainsub(start,stop,kind,chainname,currentcontext,cache,lookuplist,chainlookupname) +function chainprocs.chainsub(start,stop,kind,chainname,currentcontext,lookuphash,lookuplist,chainlookupname) logwarning("%s: a direct call to chainsub cannot happen",cref(kind,chainname,chainlookupname)) return start, false end @@ -922,7 +928,7 @@ end -- in a bit weird way. There is no lookup and the replacement comes from the lookup -- itself. It is meant mostly for dealing with Urdu. -function chainprocs.reversesub(start,stop,kind,chainname,currentcontext,cache,replacements) +function chainprocs.reversesub(start,stop,kind,chainname,currentcontext,lookuphash,replacements) local char = start.char local replacement = replacements[char] if replacement then @@ -955,11 +961,10 @@ as less as needed but that would also mke the code even more messy.

local function delete_till_stop(start,stop,ignoremarks) if start ~= stop then -- todo keep marks - local done = false - while not done do - done = start == stop - delete_node(start,start.next) - end + repeat + local next = start.next + delete_node(start,next) + until next == stop end end @@ -968,18 +973,22 @@ end match.

--ldx]]-- -function chainprocs.gsub_single(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname,chainindex) +function chainprocs.gsub_single(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,chainindex) -- todo: marks ? - if not chainindex then - delete_till_stop(start,stop) -- ,currentlookup.flags[1]) - end +--~ if not chainindex then +--~ delete_till_stop(start,stop) -- ,currentlookup.flags[1] +--~ stop = start +--~ end local current = start local subtables = currentlookup.subtables + if #subtables > 1 then + logwarning("todo: check if we need to loop over the replacements: %s",concat(subtables," ")) + end while current do - if current.id == glyph then + if current.id == glyph_code then local currentchar = current.char - local lookupname = subtables[1] - local replacement = cache.gsub_single[lookupname] + local lookupname = subtables[1] -- only 1 + local replacement = lookuphash[lookupname] if not replacement then if trace_bugs then logwarning("%s: no single hits",cref(kind,chainname,chainlookupname,lookupname,chainindex)) @@ -1014,12 +1023,12 @@ chainmores.gsub_single = chainprocs.gsub_single the match.

--ldx]]-- -function chainprocs.gsub_multiple(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname) +function chainprocs.gsub_multiple(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname) delete_till_stop(start,stop) local startchar = start.char local subtables = currentlookup.subtables local lookupname = subtables[1] - local replacements = cache.gsub_multiple[lookupname] + local replacements = lookuphash[lookupname] if not replacements then if trace_bugs then logwarning("%s: no multiple hits",cref(kind,chainname,chainlookupname,lookupname)) @@ -1034,21 +1043,7 @@ function chainprocs.gsub_multiple(start,stop,kind,chainname,currentcontext,cache if trace_multiples then logprocess("%s: replacing %s by multiple characters %s",cref(kind,chainname,chainlookupname,lookupname),gref(startchar),gref(replacements)) end - local sn = start.next - for k=1,#replacements do - if k == 1 then - start.char = replacements[k] - else - local n = copy_node(start) -- maybe delete the components and such - n.char = replacements[k] - n.next, n.prev = sn, start - if sn then - sn.prev = n - end - start.next, start = n, n - end - end - return start, true + return multiple_glyphs(start,replacements) end end return start, false @@ -1058,16 +1053,16 @@ end

Here we replace start by new glyph. First we delete the rest of the match.

--ldx]]-- -function chainprocs.gsub_alternate(start,stop,kind,lookupname,currentcontext,cache,currentlookup) +function chainprocs.gsub_alternate(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname) -- todo: marks ? delete_till_stop(start,stop) local current = start local subtables = currentlookup.subtables while current do - if current.id == glyph then + if current.id == glyph_code then local currentchar = current.char local lookupname = subtables[1] - local alternatives = cache.gsub_alternate[lookupname] + local alternatives = lookuphash[lookupname] if not alternatives then if trace_bugs then logwarning("%s: no alternative hits",cref(kind,chainname,chainlookupname,lookupname)) @@ -1102,11 +1097,11 @@ this function (move code inline and handle the marks by a separate function). We assume rather stupid ligatures (no complex disc nodes).

--ldx]]-- -function chainprocs.gsub_ligature(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname,chainindex) +function chainprocs.gsub_ligature(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,chainindex) local startchar = start.char local subtables = currentlookup.subtables local lookupname = subtables[1] - local ligatures = cache.gsub_ligature[lookupname] + local ligatures = lookuphash[lookupname] if not ligatures then if trace_bugs then logwarning("%s: no ligature hits",cref(kind,chainname,chainlookupname,lookupname,chainindex)) @@ -1121,7 +1116,7 @@ function chainprocs.gsub_ligature(start,stop,kind,chainname,currentcontext,cache local s, discfound, last, nofreplacements = start.next, false, stop, 0 while s do local id = s.id - if id == disc then + if id == disc_code then s = s.next discfound = true else @@ -1129,21 +1124,21 @@ function chainprocs.gsub_ligature(start,stop,kind,chainname,currentcontext,cache if marks[schar] then -- marks s = s.next else - local lg = ligatures[1][schar] - if not lg then - break - else + local lg = ligatures[schar] + if lg then ligatures, last, nofreplacements = lg, s, nofreplacements + 1 if s == stop then break else s = s.next end + else + break end end end end - local l2 = ligatures[2] + local l2 = ligatures.ligature if l2 then if chainindex then stop = last @@ -1155,7 +1150,7 @@ function chainprocs.gsub_ligature(start,stop,kind,chainname,currentcontext,cache logprocess("%s: replacing character %s upto %s by ligature %s",cref(kind,chainname,chainlookupname,lookupname,chainindex),gref(startchar),gref(stop.char),gref(l2)) end end - start = toligature(kind,lookup,start,stop,l2,currentlookup.flags[1],discfound) + start = toligature(kind,lookupname,start,stop,l2,currentlookup.flags[1],discfound) return start, true, nofreplacements elseif trace_bugs then if start == stop then @@ -1171,23 +1166,23 @@ end chainmores.gsub_ligature = chainprocs.gsub_ligature -function chainprocs.gpos_mark2base(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname) +function chainprocs.gpos_mark2base(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname) local markchar = start.char if marks[markchar] then local subtables = currentlookup.subtables local lookupname = subtables[1] - local markanchors = cache.gpos_mark2base[lookupname] + local markanchors = lookuphash[lookupname] if markanchors then markanchors = markanchors[markchar] end if markanchors then local base = start.prev -- [glyph] [start=mark] - if base and base.id == glyph and base.subtype<256 and base.font == currentfont then + if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then local basechar = base.char if marks[basechar] then while true do base = base.prev - if base and base.id == glyph and base.subtype<256 and base.font == currentfont then + if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then basechar = base.char if not marks[basechar] then break @@ -1209,7 +1204,7 @@ function chainprocs.gpos_mark2base(start,stop,kind,chainname,currentcontext,cach if al[anchor] then local ma = markanchors[anchor] if ma then - local dx, dy, bound = set_mark(start,base,tfmdata.factor,rlmode,ba,ma) + local dx, dy, bound = setmark(start,base,tfmdata.parameters.factor,rlmode,ba,ma) if trace_marks then logprocess("%s, anchor %s, bound %s: anchoring mark %s to basechar %s => (%s,%s)", cref(kind,chainname,chainlookupname,lookupname),anchor,bound,gref(markchar),gref(basechar),dx,dy) @@ -1235,25 +1230,25 @@ function chainprocs.gpos_mark2base(start,stop,kind,chainname,currentcontext,cach return start, false end -function chainprocs.gpos_mark2ligature(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname) +function chainprocs.gpos_mark2ligature(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname) local markchar = start.char if marks[markchar] then local subtables = currentlookup.subtables local lookupname = subtables[1] - local markanchors = cache.gpos_mark2ligature[lookupname] + local markanchors = lookuphash[lookupname] if markanchors then markanchors = markanchors[markchar] end if markanchors then local base = start.prev -- [glyph] [optional marks] [start=mark] local index = 1 - if base and base.id == glyph and base.subtype<256 and base.font == currentfont then + if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then local basechar = base.char if marks[basechar] then index = index + 1 while true do base = base.prev - if base and base.id == glyph and base.subtype<256 and base.font == currentfont then + if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then basechar = base.char if marks[basechar] then index = index + 1 @@ -1282,7 +1277,7 @@ function chainprocs.gpos_mark2ligature(start,stop,kind,chainname,currentcontext, if ma then ba = ba[index] if ba then - local dx, dy, bound = set_mark(start,base,tfmdata.factor,rlmode,ba,ma,index) + local dx, dy, bound = setmark(start,base,tfmdata.parameters.factor,rlmode,ba,ma,index) if trace_marks then logprocess("%s, anchor %s, bound %s: anchoring mark %s to baselig %s at index %s => (%s,%s)", cref(kind,chainname,chainlookupname,lookupname),anchor,a or bound,gref(markchar),gref(basechar),index,dx,dy) @@ -1309,7 +1304,7 @@ function chainprocs.gpos_mark2ligature(start,stop,kind,chainname,currentcontext, return start, false end -function chainprocs.gpos_mark2mark(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname) +function chainprocs.gpos_mark2mark(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname) local markchar = start.char if marks[markchar] then --~ local alreadydone = markonce and has_attribute(start,markmark) @@ -1317,13 +1312,13 @@ function chainprocs.gpos_mark2mark(start,stop,kind,chainname,currentcontext,cach -- local markanchors = descriptions[markchar].anchors markanchors = markanchors and markanchors.mark local subtables = currentlookup.subtables local lookupname = subtables[1] - local markanchors = cache.gpos_mark2mark[lookupname] + local markanchors = lookuphash[lookupname] if markanchors then markanchors = markanchors[markchar] end if markanchors then local base = start.prev -- [glyph] [basemark] [start=mark] - if base and base.id == glyph and base.subtype<256 and base.font == currentfont then -- subtype test can go + if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then -- subtype test can go local basechar = base.char local baseanchors = descriptions[basechar].anchors if baseanchors then @@ -1334,7 +1329,7 @@ function chainprocs.gpos_mark2mark(start,stop,kind,chainname,currentcontext,cach if al[anchor] then local ma = markanchors[anchor] if ma then - local dx, dy, bound = set_mark(start,base,tfmdata.factor,rlmode,ba,ma) + local dx, dy, bound = setmark(start,base,tfmdata.parameters.factor,rlmode,ba,ma) if trace_marks then logprocess("%s, anchor %s, bound %s: anchoring mark %s to basemark %s => (%s,%s)", cref(kind,chainname,chainlookupname,lookupname),anchor,bound,gref(markchar),gref(basechar),dx,dy) @@ -1365,13 +1360,13 @@ end -- ! ! ! untested ! ! ! -function chainprocs.gpos_cursive(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname) +function chainprocs.gpos_cursive(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname) local alreadydone = cursonce and has_attribute(start,cursbase) if not alreadydone then local startchar = start.char local subtables = currentlookup.subtables local lookupname = subtables[1] - local exitanchors = cache.gpos_cursive[lookupname] + local exitanchors = lookuphash[lookupname] if exitanchors then exitanchors = exitanchors[startchar] end @@ -1383,7 +1378,7 @@ function chainprocs.gpos_cursive(start,stop,kind,chainname,currentcontext,cache, end else local nxt = start.next - while not done and nxt and nxt.id == glyph and nxt.subtype<256 and nxt.font == currentfont do + while not done and nxt and nxt.id == glyph_code and nxt.subtype<256 and nxt.font == currentfont do local nextchar = nxt.char if marks[nextchar] then -- should not happen (maybe warning) @@ -1400,7 +1395,7 @@ function chainprocs.gpos_cursive(start,stop,kind,chainname,currentcontext,cache, if al[anchor] then local exit = exitanchors[anchor] if exit then - local dx, dy, bound = set_cursive(start,nxt,tfmdata.factor,rlmode,exit,entry,characters[startchar],characters[nextchar]) + local dx, dy, bound = setcursive(start,nxt,tfmdata.parameters.factor,rlmode,exit,entry,characters[startchar],characters[nextchar]) if trace_cursive then logprocess("%s: moving %s to %s cursive (%s,%s) using anchor %s and bound %s in rlmode %s",pref(kind,lookupname),gref(startchar),gref(nextchar),dx,dy,anchor,bound,rlmode) end @@ -1413,7 +1408,7 @@ function chainprocs.gpos_cursive(start,stop,kind,chainname,currentcontext,cache, end else -- if trace_bugs then -- logwarning("%s: char %s is missing in font",pref(kind,lookupname),gref(startchar)) - fonts.register_message(currentfont,startchar,"no entry anchors") + onetimemessage(currentfont,startchar,"no entry anchors",report_fonts) end break end @@ -1430,16 +1425,16 @@ function chainprocs.gpos_cursive(start,stop,kind,chainname,currentcontext,cache, return start, false end -function chainprocs.gpos_single(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname,chainindex,sequence) - -- untested +function chainprocs.gpos_single(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,chainindex,sequence) + -- untested .. needs checking for the new model local startchar = start.char local subtables = currentlookup.subtables local lookupname = subtables[1] - local kerns = cache.gpos_single[lookupname] + local kerns = lookuphash[lookupname] if kerns then - kerns = kerns[startchar] + kerns = kerns[startchar] -- needed ? if kerns then - local dx, dy, w, h = set_pair(start,tfmdata.factor,rlmode,sequence.flags[4],kerns,characters[startchar]) + local dx, dy, w, h = setpair(start,tfmdata.parameters.factor,rlmode,sequence.flags[4],kerns,characters[startchar]) if trace_kerns then logprocess("%s: shifting single %s by (%s,%s) and correction (%s,%s)",cref(kind,chainname,chainlookupname),gref(startchar),dx,dy,w,h) end @@ -1450,20 +1445,21 @@ end -- when machines become faster i will make a shared function -function chainprocs.gpos_pair(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname,chainindex,sequence) +function chainprocs.gpos_pair(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,chainindex,sequence) -- logwarning("%s: gpos_pair not yet supported",cref(kind,chainname,chainlookupname)) local snext = start.next if snext then local startchar = start.char local subtables = currentlookup.subtables local lookupname = subtables[1] - local kerns = cache.gpos_pair[lookupname] + local kerns = lookuphash[lookupname] if kerns then kerns = kerns[startchar] if kerns then + local lookuptype = lookuptypes[lookupname] local prev, done = start, false - local factor = tfmdata.factor - while snext and snext.id == glyph and snext.subtype<256 and snext.font == currentfont do + local factor = tfmdata.parameters.factor + while snext and snext.id == glyph_code and snext.subtype<256 and snext.font == currentfont do local nextchar = snext.char local krn = kerns[nextchar] if not krn and marks[nextchar] then @@ -1473,27 +1469,27 @@ function chainprocs.gpos_pair(start,stop,kind,chainname,currentcontext,cache,cur if not krn then -- skip elseif type(krn) == "table" then - if krn[1] == "pair" then - local a, b = krn[3], krn[4] + if lookuptype == "pair" then + local a, b = krn[2], krn[3] if a and #a > 0 then local startchar = start.char - local x, y, w, h = set_pair(start,factor,rlmode,sequence.flags[4],a,characters[startchar]) + local x, y, w, h = setpair(start,factor,rlmode,sequence.flags[4],a,characters[startchar]) if trace_kerns then logprocess("%s: shifting first of pair %s and %s by (%s,%s) and correction (%s,%s)",cref(kind,chainname,chainlookupname),gref(startchar),gref(nextchar),x,y,w,h) end end if b and #b > 0 then local startchar = start.char - local x, y, w, h = set_pair(snext,factor,rlmode,sequence.flags[4],b,characters[nextchar]) + local x, y, w, h = setpair(snext,factor,rlmode,sequence.flags[4],b,characters[nextchar]) if trace_kerns then logprocess("%s: shifting second of pair %s and %s by (%s,%s) and correction (%s,%s)",cref(kind,chainname,chainlookupname),gref(startchar),gref(nextchar),x,y,w,h) end end else - logs.report("%s: check this out (old kern stuff)",cref(kind,chainname,chainlookupname)) - local a, b = krn[3], krn[7] + report_process("%s: check this out (old kern stuff)",cref(kind,chainname,chainlookupname)) + local a, b = krn[2], krn[6] if a and a ~= 0 then - local k = set_kern(snext,factor,rlmode,a) + local k = setkern(snext,factor,rlmode,a) if trace_kerns then logprocess("%s: inserting first kern %s between %s and %s",cref(kind,chainname,chainlookupname),k,gref(prev.char),gref(nextchar)) end @@ -1504,7 +1500,7 @@ function chainprocs.gpos_pair(start,stop,kind,chainname,currentcontext,cache,cur end done = true elseif krn ~= 0 then - local k = set_kern(snext,factor,rlmode,krn) + local k = setkern(snext,factor,rlmode,krn) if trace_kerns then logprocess("%s: inserting kern %s between %s and %s",cref(kind,chainname,chainlookupname),k,gref(prev.char),gref(nextchar)) end @@ -1536,7 +1532,7 @@ local function show_skip(kind,chainname,char,ck,class) end end -local function normal_handle_contextchain(start,kind,chainname,contexts,sequence,cache) +local function normal_handle_contextchain(start,kind,chainname,contexts,sequence,lookuphash) -- local rule, lookuptype, sequence, f, l, lookups = ck[1], ck[2] ,ck[3], ck[4], ck[5], ck[6] local flags, done = sequence.flags, false local skipmark, skipligature, skipbase = flags[1], flags[2], flags[3] @@ -1551,11 +1547,12 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence -- f..l = mid string if s == 1 then -- never happens - match = current.id == glyph and current.subtype<256 and current.font == currentfont and seq[1][current.char] + match = current.id == glyph_code and current.subtype<256 and current.font == currentfont and seq[1][current.char] else -- todo: better space check (maybe check for glue) local f, l = ck[4], ck[5] - if f == l then + -- current match + if f == 1 and f == l then -- already a hit match = true else @@ -1565,12 +1562,12 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence -- we cannot optimize for n=2 because there can be disc nodes -- if not someskip and n == l then -- -- n=2 and no skips then faster loop - -- match = last and last.id == glyph and last.subtype<256 and last.font == currentfont and seq[n][last.char] + -- match = last and last.id == glyph_code and last.subtype<256 and last.font == currentfont and seq[n][last.char] -- else while n <= l do if last then local id = last.id - if id == glyph then + if id == glyph_code then if last.subtype<256 and last.font == currentfont then local char = last.char local ccd = descriptions[char] @@ -1596,7 +1593,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence else match = false break end - elseif id == disc then -- what to do with kerns? + elseif id == disc_code then -- what to do with kerns? last = last.next else match = false break @@ -1607,15 +1604,15 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence end -- end end + -- before if match and f > 1 then - -- before local prev = start.prev if prev then local n = f-1 while n >= 1 do if prev then local id = prev.id - if id == glyph then + if id == glyph_code then if prev.subtype<256 and prev.font == currentfont then -- normal char local char = prev.char local ccd = descriptions[char] @@ -1637,7 +1634,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence else match = false break end - elseif id == disc then + elseif id == disc_code then -- skip 'm elseif seq[n][32] then n = n -1 @@ -1645,7 +1642,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence match = false break end prev = prev.prev - elseif seq[n][32] then + elseif seq[n][32] then -- somehat special, as zapfino can have many preceding spaces n = n -1 else match = false break @@ -1661,16 +1658,16 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence end end end + -- after if match and s > l then - -- after - local current = last.next + local current = last and last.next if current then -- removed optimization for s-l == 1, we have to deal with marks anyway local n = l + 1 while n <= s do if current then local id = current.id - if id == glyph then + if id == glyph_code then if current.subtype<256 and current.font == currentfont then -- normal char local char = current.char local ccd = descriptions[char] @@ -1692,7 +1689,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence else match = false break end - elseif id == disc then + elseif id == disc_code then -- skip 'm elseif seq[n][32] then -- brrr n = n + 1 @@ -1723,9 +1720,11 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence local rule, lookuptype, f, l = ck[1], ck[2], ck[4], ck[5] local char = start.char if ck[9] then - logwarning("%s: rule %s matches at char %s for (%s,%s,%s) chars, lookuptype %s (%s=>%s)",cref(kind,chainname),rule,gref(char),f-1,l-f+1,s-l,lookuptype,ck[9],ck[10]) + logwarning("%s: rule %s matches at char %s for (%s,%s,%s) chars, lookuptype %s (%s=>%s)", + cref(kind,chainname),rule,gref(char),f-1,l-f+1,s-l,lookuptype,ck[9],ck[10]) else - logwarning("%s: rule %s matches at char %s for (%s,%s,%s) chars, lookuptype %s",cref(kind,chainname),rule,gref(char),f-1,l-f+1,s-l,lookuptype) + logwarning("%s: rule %s matches at char %s for (%s,%s,%s) chars, lookuptype %s", + cref(kind,chainname),rule,gref(char),f-1,l-f+1,s-l,lookuptype) end end local chainlookups = ck[6] @@ -1737,59 +1736,35 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence local chainlookup = lookuptable[chainlookupname] local cp = chainprocs[chainlookup.type] if cp then - start, done = cp(start,last,kind,chainname,ck,cache,chainlookup,chainlookupname,nil,sequence) + start, done = cp(start,last,kind,chainname,ck,lookuphash,chainlookup,chainlookupname,nil,sequence) else logprocess("%s: %s is not yet supported",cref(kind,chainname,chainlookupname),chainlookup.type) end else - -- actually this needs a more complex treatment for which we will use chainmores ---~ local i = 1 ---~ repeat ---~ local chainlookupname = chainlookups[i] ---~ local chainlookup = lookuptable[chainlookupname] ---~ local cp = chainmores[chainlookup.type] ---~ if cp then ---~ local ok, n ---~ start, ok, n = cp(start,last,kind,chainname,ck,cache,chainlookup,chainlookupname,i,sequence) ---~ -- messy since last can be changed ! ---~ if ok then ---~ done = true ---~ start = start.next ---~ if n then ---~ -- skip next one(s) if ligature ---~ i = i + n - 1 ---~ end ---~ end ---~ else ---~ logprocess("%s: multiple subchains for %s are not yet supported",cref(kind,chainname,chainlookupname),chainlookup.type) ---~ end ---~ i = i + 1 ---~ until i > nofchainlookups - local i = 1 repeat -if skipped then - while true do - local char = start.char - local ccd = descriptions[char] - if ccd then - local class = ccd.class - if class == skipmark or class == skipligature or class == skipbase or (markclass and class == "mark" and not markclass[char]) then - start = start.next - else - break - end - else - break - end - end -end + if skipped then + while true do + local char = start.char + local ccd = descriptions[char] + if ccd then + local class = ccd.class + if class == skipmark or class == skipligature or class == skipbase or (markclass and class == "mark" and not markclass[char]) then + start = start.next + else + break + end + else + break + end + end + end local chainlookupname = chainlookups[i] local chainlookup = lookuptable[chainlookupname] local cp = chainmores[chainlookup.type] if cp then local ok, n - start, ok, n = cp(start,last,kind,chainname,ck,cache,chainlookup,chainlookupname,i,sequence) + start, ok, n = cp(start,last,kind,chainname,ck,lookuphash,chainlookup,chainlookupname,i,sequence) -- messy since last can be changed ! if ok then done = true @@ -1804,12 +1779,11 @@ end end start = start.next until i > nofchainlookups - end else local replacements = ck[7] if replacements then - start, done = chainprocs.reversesub(start,last,kind,chainname,ck,cache,replacements) -- sequence + start, done = chainprocs.reversesub(start,last,kind,chainname,ck,lookuphash,replacements) -- sequence else done = true -- can be meant to be skipped if trace_contexts then @@ -1864,18 +1838,17 @@ local function logprocess(...) if trace_steps then registermessage(...) end - logs.report("otf process",...) -end -local function logwarning(...) - logs.report("otf process",...) + report_process(...) end +local logwarning = report_process + local function report_missing_cache(typ,lookup) local f = missing[currentfont] if not f then f = { } missing[currentfont] = f end local t = f[typ] if not t then t = { } f[typ] = t end if not t[lookup] then t[lookup] = true - logwarning("missing cache for lookup %s of type %s in font %s (%s)",lookup,typ,currentfont,tfmdata.fullname) + logwarning("missing cache for lookup %s of type %s in font %s (%s)",lookup,typ,currentfont,tfmdata.properties.fullname) end end @@ -1883,135 +1856,144 @@ local resolved = { } -- we only resolve a font,script,language pair once -- todo: pass all these 'locals' in a table -function fonts.methods.node.otf.features(head,font,attr) - if trace_steps then - checkstep(head) +local lookuphashes = { } + +setmetatableindex(lookuphashes, function(t,font) + local lookuphash = fontdata[font].resources.lookuphash + if not lookuphash or not next(lookuphash) then + lookuphash = false end - tfmdata = fontdata[font] - local shared = tfmdata.shared - otfdata = shared.otfdata - local luatex = otfdata.luatex - descriptions = tfmdata.descriptions - characters = tfmdata.characters - indices = tfmdata.indices - unicodes = tfmdata.unicodes - marks = tfmdata.marks - anchorlookups = luatex.lookup_to_anchor - currentfont = font - rlmode = 0 - local featuredata = otfdata.shared.featuredata -- can be made local to closure - local sequences = luatex.sequences - lookuptable = luatex.lookups - local done = false - local script, language, s_enabled, a_enabled, dyn - local attribute_driven = attr and attr ~= 0 - if attribute_driven then - local features = context_setups[context_numbers[attr]] -- could be a direct list - dyn = context_merged[attr] or 0 - language, script = features.language or "dflt", features.script or "dflt" - a_enabled = features -- shared.features -- can be made local to the resolver - if dyn == 2 or dyn == -2 then - -- font based - s_enabled = shared.features + t[font] = lookuphash + return lookuphash +end) + +-- fonts.hashes.lookups = lookuphashes + +local special_attributes = { + init = 1, + medi = 2, + fina = 3, + isol = 4 +} + +local function initialize(sequence,script,language,enabled) + local features = sequence.features + if features then + for kind, scripts in next, features do + local valid = enabled[kind] + if valid then + local languages = scripts[script] or scripts[wildcard] + if languages and (languages[language] or languages[wildcard]) then + return { valid, special_attributes[kind] or false, sequence.chain or 0, kind } + end + end end - else - language, script = tfmdata.language or "dflt", tfmdata.script or "dflt" - s_enabled = shared.features -- can be made local to the resolver - dyn = 0 end - -- we can save some runtime by caching feature tests - local res = resolved[font] if not res then res = { } resolved[font] = res end - local rs = res [script] if not rs then rs = { } res [script] = rs end - local rl = rs [language] if not rl then rl = { } rs [language] = rl end - local ra = rl [attr] if ra == nil then ra = { } rl [attr] = ra end -- attr can be false - -- sequences always > 1 so no need for optimization + return false +end + +function otf.dataset(ftfmdata,sequences,font) -- generic variant, overloaded in context + local shared = tfmdata.shared + local properties = tfmdata.properties + local language = properties.language or "dflt" + local script = properties.script or "dflt" + local enabled = shared.features + local res = resolved[font] + if not res then + res = { } + resolved[font] = res + end + local rs = res[script] + if not rs then + rs = { } + res[script] = rs + end + local rl = rs[language] + if not rl then + rl = { } + rs[language] = rl + setmetatableindex(rl, function(t,k) + local v = enabled and initialize(sequences[k],script,language,enabled) + t[k] = v + return v + end) + end + return rl +end + +local function featuresprocessor(head,font,attr) + + local lookuphash = lookuphashes[font] -- we can also check sequences here + + if not lookuphash then + return head, false + end + + if trace_steps then + checkstep(head) + end + + tfmdata = fontdata[font] + descriptions = tfmdata.descriptions + characters = tfmdata.characters + resources = tfmdata.resources + + marks = resources.marks + anchorlookups = resources.lookup_to_anchor + lookuptable = resources.lookups + lookuptypes = resources.lookuptypes + + currentfont = font + rlmode = 0 + + local sequences = resources.sequences + local done = false + local datasets = otf.dataset(tfmdata,sequences,font,attr) + for s=1,#sequences do - local pardir, txtdir = 0, { } - local success = false + local pardir, txtdir, success = 0, { }, false -- we could reuse txtdir and use a top pointer local sequence = sequences[s] - local r = ra[s] -- cache - if r == nil then - -- - -- this bit will move to font-ctx and become a function - --- - local chain = sequence.chain or 0 - local features = sequence.features - if not features then - -- indirect lookup, part of chain (todo: make this a separate table) - r = false -- { false, false, chain } - else - local valid, attribute, kind, what = false, false - for k,v in next, features do - -- we can quit earlier but for the moment we want the tracing - local s_e = s_enabled and s_enabled[k] - local a_e = a_enabled and a_enabled[k] - if s_e or a_e then - local l = v[script] or v[wildcard] - if l then - -- not l[language] or l[default] or l[wildcard] because we want tracing - -- only first attribute match check, so we assume simple fina's - -- default can become a font feature itself - if l[language] then - valid, what = s_e or a_e, language - -- elseif l[default] then - -- valid, what = true, default - elseif l[wildcard] then - valid, what = s_e or a_e, wildcard - end - if valid then - kind, attribute = k, special_attributes[k] or false - if a_e and dyn < 0 then - valid = false - end - if trace_applied then - local typ, action = match(sequence.type,"(.*)_(.*)") - logs.report("otf node mode", - "%s font: %03i, dynamic: %03i, kind: %s, lookup: %3i, script: %-4s, language: %-4s (%-4s), type: %s, action: %s, name: %s", - (valid and "+") or "-",font,attr or 0,kind,s,script,language,what,typ,action,sequence.name) - end - break - end - end - end - end - if valid then - r = { valid, attribute, chain, kind } - else - r = false -- { valid, attribute, chain, "generic" } -- false anyway, could be flag instead of table - end - end - ra[s] = r - end - featurevalue = r and r[1] -- todo: pass to function instead of using a global + local dataset = datasets[s] -- cache + featurevalue = dataset and dataset[1] -- todo: pass to function instead of using a global if featurevalue then - local attribute, chain, typ, subtables = r[2], r[3], sequence.type, sequence.subtables + local attribute, chain, typ, subtables = dataset[2], dataset[3], sequence.type, sequence.subtables +--~ print(typ) +--~ table.print(table.keys(sequence)) if chain < 0 then -- this is a limited case, no special treatments like 'init' etc local handler = handlers[typ] - local thecache = featuredata[typ] or { } -- we need to get rid of this slide ! local start = find_node_tail(head) -- slow (we can store tail because there's always a skip at the end): todo while start do local id = start.id - if id == glyph then - if start.subtype<256 and start.font == font and (not attr or has_attribute(start,0,attr)) then ---~ if start.subtype<256 and start.font == font and has_attribute(start,0,attr) then - for i=1,#subtables do - local lookupname = subtables[i] - local lookupcache = thecache[lookupname] - if lookupcache then - local lookupmatch = lookupcache[start.char] - if lookupmatch then - start, success = handler(start,r[4],lookupname,lookupmatch,sequence,featuredata,i) - if success then - break + if id == glyph_code then + if start.subtype<256 and start.font == font then + local a = has_attribute(start,0) + if a then + a = a == attr + else + a = true + end + if a then + for i=1,#subtables do + local lookupname = subtables[i] + local lookupcache = lookuphash[lookupname] + if lookupcache then + local lookupmatch = lookupcache[start.char] + if lookupmatch then + start, success = handler(start,dataset[4],lookupname,lookupmatch,sequence,lookuphash,i) + if success then + break + end end + else + report_missing_cache(typ,lookupname) end - else - report_missing_cache(typ,lookupname) end + if start then start = start.prev end + else + start = start.prev end - if start then start = start.prev end else start = start.prev end @@ -2022,34 +2004,42 @@ function fonts.methods.node.otf.features(head,font,attr) else local handler = handlers[typ] local ns = #subtables - local thecache = featuredata[typ] or { } local start = head -- local ? rlmode = 0 -- to be checked ? if ns == 1 then local lookupname = subtables[1] - local lookupcache = thecache[lookupname] + local lookupcache = lookuphash[lookupname] if not lookupcache then report_missing_cache(typ,lookupname) else while start do local id = start.id - if id == glyph then ---~ if start.font == font and start.subtype<256 and has_attribute(start,0,attr) and (not attribute or has_attribute(start,state,attribute)) then - if start.font == font and start.subtype<256 and (not attr or has_attribute(start,0,attr)) and (not attribute or has_attribute(start,state,attribute)) then - local lookupmatch = lookupcache[start.char] - if lookupmatch then - -- sequence kan weg - local ok - start, ok = handler(start,r[4],lookupname,lookupmatch,sequence,featuredata,1) - if ok then - success = true + if id == glyph_code then + if start.subtype<256 and start.font == font then + local a = has_attribute(start,0) + if a then + a = (a == attr) and (not attribute or has_attribute(start,state,attribute)) + else + a = not attribute or has_attribute(start,state,attribute) + end + if a then + local lookupmatch = lookupcache[start.char] + if lookupmatch then + -- sequence kan weg + local ok + start, ok = handler(start,dataset[4],lookupname,lookupmatch,sequence,lookuphash,1) + if ok then + success = true + end end + if start then start = start.next end + else + start = start.next end - if start then start = start.next end else start = start.next end - -- elseif id == glue then + -- elseif id == glue_code then -- if p[5] then -- chain -- local pc = pp[32] -- if pc then @@ -2064,9 +2054,9 @@ function fonts.methods.node.otf.features(head,font,attr) -- else -- start = start.next -- end - elseif id == whatsit then + elseif id == whatsit_code then local subtype = start.subtype - if subtype == 7 then + if subtype == dir_code then local dir = start.dir if dir == "+TRT" or dir == "+TLT" then insert(txtdir,dir) @@ -2082,9 +2072,9 @@ function fonts.methods.node.otf.features(head,font,attr) rlmode = pardir end if trace_directions then - logs.report("fonts","directions after textdir %s: pardir=%s, txtdir=%s:%s, rlmode=%s",dir,pardir,#txtdir,txtdir[#txtdir] or "unset",rlmode) + report_process("directions after textdir %s: pardir=%s, txtdir=%s:%s, rlmode=%s",dir,pardir,#txtdir,txtdir[#txtdir] or "unset",rlmode) end - elseif subtype == 6 then + elseif subtype == localpar_code then local dir = start.dir if dir == "TRT" then pardir = -1 @@ -2096,7 +2086,7 @@ function fonts.methods.node.otf.features(head,font,attr) rlmode = pardir --~ txtdir = { } if trace_directions then - logs.report("fonts","directions after pardir %s: pardir=%s, txtdir=%s:%s, rlmode=%s",dir,pardir,#txtdir,txtdir[#txtdir] or "unset",rlmode) + report_process("directions after pardir %s: pardir=%s, txtdir=%s:%s, rlmode=%s",dir,pardir,#txtdir,txtdir[#txtdir] or "unset",rlmode) end end start = start.next @@ -2108,32 +2098,41 @@ function fonts.methods.node.otf.features(head,font,attr) else while start do local id = start.id - if id == glyph then - if start.subtype<256 and start.font == font and (not attr or has_attribute(start,0,attr)) and (not attribute or has_attribute(start,state,attribute)) then ---~ if start.subtype<256 and start.font == font and has_attribute(start,0,attr) and (not attribute or has_attribute(start,state,attribute)) then - for i=1,ns do - local lookupname = subtables[i] - local lookupcache = thecache[lookupname] - if lookupcache then - local lookupmatch = lookupcache[start.char] - if lookupmatch then - -- we could move all code inline but that makes things even more unreadable - local ok - start, ok = handler(start,r[4],lookupname,lookupmatch,sequence,featuredata,i) - if ok then - success = true - break + if id == glyph_code then + if start.subtype<256 and start.font == font then + local a = has_attribute(start,0) + if a then + a = (a == attr) and (not attribute or has_attribute(start,state,attribute)) + else + a = not attribute or has_attribute(start,state,attribute) + end + if a then + for i=1,ns do + local lookupname = subtables[i] + local lookupcache = lookuphash[lookupname] + if lookupcache then + local lookupmatch = lookupcache[start.char] + if lookupmatch then + -- we could move all code inline but that makes things even more unreadable + local ok + start, ok = handler(start,dataset[4],lookupname,lookupmatch,sequence,lookuphash,i) + if ok then + success = true + break + end end + else + report_missing_cache(typ,lookupname) end - else - report_missing_cache(typ,lookupname) end + if start then start = start.next end + else + start = start.next end - if start then start = start.next end else start = start.next end - -- elseif id == glue then + -- elseif id == glue_code then -- if p[5] then -- chain -- local pc = pp[32] -- if pc then @@ -2148,10 +2147,9 @@ function fonts.methods.node.otf.features(head,font,attr) -- else -- start = start.next -- end - elseif id == whatsit then + elseif id == whatsit_code then local subtype = start.subtype - local subtype = start.subtype - if subtype == 7 then + if subtype == dir_code then local dir = start.dir if dir == "+TRT" or dir == "+TLT" then insert(txtdir,dir) @@ -2167,9 +2165,9 @@ function fonts.methods.node.otf.features(head,font,attr) rlmode = pardir end if trace_directions then - logs.report("fonts","directions after textdir %s: pardir=%s, txtdir=%s:%s, rlmode=%s",dir,pardir,#txtdir,txtdir[#txtdir] or "unset",rlmode) + report_process("directions after textdir %s: pardir=%s, txtdir=%s:%s, rlmode=%s",dir,pardir,#txtdir,txtdir[#txtdir] or "unset",rlmode) end - elseif subtype == 6 then + elseif subtype == localpar_code then local dir = start.dir if dir == "TRT" then pardir = -1 @@ -2181,7 +2179,7 @@ function fonts.methods.node.otf.features(head,font,attr) rlmode = pardir --~ txtdir = { } if trace_directions then - logs.report("fonts","directions after pardir %s: pardir=%s, txtdir=%s:%s, rlmode=%s",dir,pardir,#txtdir,txtdir[#txtdir] or "unset",rlmode) + report_process("directions after pardir %s: pardir=%s, txtdir=%s:%s, rlmode=%s",dir,pardir,#txtdir,txtdir[#txtdir] or "unset",rlmode) end end start = start.next @@ -2202,459 +2200,422 @@ function fonts.methods.node.otf.features(head,font,attr) return head, done end -otf.features.prepare = { } - --- we used to share code in the following functions but that costs a lot of --- memory due to extensive calls to functions (easily hundreds of thousands per --- document) - -local function split(replacement,original,cache,unicodes) - -- we can cache this too, but not the same (although unicode is a unique enough hash) - local o, t, n = { }, { }, 0 - for s in gmatch(original,"[^ ]+") do - local us = unicodes[s] - if type(us) == "number" then -- tonumber(us) - o[#o+1] = us - else - o[#o+1] = us[1] - end - end - for s in gmatch(replacement,"[^ ]+") do - n = n + 1 - local us = unicodes[s] - if type(us) == "number" then -- tonumber(us) - t[o[n]] = us - else - t[o[n]] = us[1] - end +local function generic(lookupdata,lookupname,unicode,lookuphash) + local target = lookuphash[lookupname] + if target then + target[unicode] = lookupdata + else + lookuphash[lookupname] = { [unicode] = lookupdata } end - return t end -local function uncover(covers,result,cache,unicodes) - -- lpeg hardly faster (.005 sec on mk) - for n=1,#covers do - local c = covers[n] - local cc = cache[c] - if not cc then - local t = { } - for s in gmatch(c,"[^ ]+") do - local us = unicodes[s] - if type(us) == "number" then - t[us] = true - else - for i=1,#us do - t[us[i]] = true - end - end +local action = { + + substitution = generic, + multiple = generic, + alternate = generic, + position = generic, + + ligature = function(lookupdata,lookupname,unicode,lookuphash) + local target = lookuphash[lookupname] + if not target then + target = { } + lookuphash[lookupname] = target + end + for i=1,#lookupdata do + local li = lookupdata[i] + local tu = target[li] + if not tu then + tu = { } + target[li] = tu end - cache[c] = t - result[#result+1] = t + target = tu + end + target.ligature = unicode + end, + + pair = function(lookupdata,lookupname,unicode,lookuphash) + local target = lookuphash[lookupname] + if not target then + target = { } + lookuphash[lookupname] = target + end + local others = target[unicode] + local paired = lookupdata[1] + if others then + others[paired] = lookupdata else - result[#result+1] = cc + others = { [paired] = lookupdata } + target[unicode] = others end - end -end + end, + +} local function prepare_lookups(tfmdata) - local otfdata = tfmdata.shared.otfdata - local featuredata = otfdata.shared.featuredata - local anchor_to_lookup = otfdata.luatex.anchor_to_lookup - local lookup_to_anchor = otfdata.luatex.lookup_to_anchor - -- - local multiple = featuredata.gsub_multiple - local alternate = featuredata.gsub_alternate - local single = featuredata.gsub_single - local ligature = featuredata.gsub_ligature - local pair = featuredata.gpos_pair - local position = featuredata.gpos_single - local kerns = featuredata.gpos_pair - local mark = featuredata.gpos_mark2mark - local cursive = featuredata.gpos_cursive - -- - local unicodes = tfmdata.unicodes -- names to unicodes - local indices = tfmdata.indices - local descriptions = tfmdata.descriptions - -- - -- we can change the otf table after loading but then we need to adapt base mode - -- as well (no big deal) - -- - local action = { - substitution = function(p,lookup,k,glyph,unicode) - local old, new = unicode, unicodes[p[2]] - if type(new) == "table" then - new = new[1] - end - local s = single[lookup] - if not s then s = { } single[lookup] = s end - s[old] = new - --~ if trace_lookups then - --~ logs.report("define otf","lookup %s: substitution %s => %s",lookup,old,new) - --~ end - end, - multiple = function (p,lookup,k,glyph,unicode) - local old, new = unicode, { } - local m = multiple[lookup] - if not m then m = { } multiple[lookup] = m end - m[old] = new - for pc in gmatch(p[2],"[^ ]+") do - local upc = unicodes[pc] - if type(upc) == "number" then - new[#new+1] = upc - else - new[#new+1] = upc[1] - end - end - --~ if trace_lookups then - --~ logs.report("define otf","lookup %s: multiple %s => %s",lookup,old,concat(new," ")) - --~ end - end, - alternate = function(p,lookup,k,glyph,unicode) - local old, new = unicode, { } - local a = alternate[lookup] - if not a then a = { } alternate[lookup] = a end - a[old] = new - for pc in gmatch(p[2],"[^ ]+") do - local upc = unicodes[pc] - if type(upc) == "number" then - new[#new+1] = upc - else - new[#new+1] = upc[1] - end - end - --~ if trace_lookups then - --~ logs.report("define otf","lookup %s: alternate %s => %s",lookup,old,concat(new,"|")) - --~ end - end, - ligature = function (p,lookup,k,glyph,unicode) - --~ if trace_lookups then - --~ logs.report("define otf","lookup %s: ligature %s => %s",lookup,p[2],glyph.name) - --~ end - local first = true - local t = ligature[lookup] - if not t then t = { } ligature[lookup] = t end - for s in gmatch(p[2],"[^ ]+") do - if first then - local u = unicodes[s] - if not u then - logs.report("define otf","lookup %s: ligature %s => %s ignored due to invalid unicode",lookup,p[2],glyph.name) - break - elseif type(u) == "number" then - if not t[u] then - t[u] = { { } } - end - t = t[u] - else - local tt = t - local tu - for i=1,#u do - local u = u[i] - if i==1 then - if not t[u] then - t[u] = { { } } - end - tu = t[u] - t = tu - else - if not t[u] then - tt[u] = tu - end - end - end - end - first = false - else - s = unicodes[s] - local t1 = t[1] - if not t1[s] then - t1[s] = { { } } - end - t = t1[s] - end - end - t[2] = unicode - end, - position = function(p,lookup,k,glyph,unicode) - -- not used - local s = position[lookup] - if not s then s = { } position[lookup] = s end - s[unicode] = p[2] -- direct pointer to kern spec - end, - pair = function(p,lookup,k,glyph,unicode) - local s = pair[lookup] - if not s then s = { } pair[lookup] = s end - local others = s[unicode] - if not others then others = { } s[unicode] = others end - -- todo: fast check for space - local two = p[2] - local upc = unicodes[two] - if not upc then - for pc in gmatch(two,"[^ ]+") do - local upc = unicodes[pc] - if type(upc) == "number" then - others[upc] = p -- direct pointer to main table - else - for i=1,#upc do - others[upc[i]] = p -- direct pointer to main table - end - end - end - elseif type(upc) == "number" then - others[upc] = p -- direct pointer to main table - else - for i=1,#upc do - others[upc[i]] = p -- direct pointer to main table - end - end - --~ if trace_lookups then - --~ logs.report("define otf","lookup %s: pair for U+%04X",lookup,unicode) - --~ end - end, - } - -- - for unicode, glyph in next, descriptions do - local lookups = glyph.slookups + + local rawdata = tfmdata.shared.rawdata + local resources = rawdata.resources + local lookuphash = resources.lookuphash + local anchor_to_lookup = resources.anchor_to_lookup + local lookup_to_anchor = resources.lookup_to_anchor + local lookuptypes = resources.lookuptypes + local characters = tfmdata.characters + local descriptions = tfmdata.descriptions + + -- we cannot free the entries in the descriptions as sometimes we access + -- then directly (for instance anchors) ... selectively freeing does save + -- much memory as it's only a reference to a table and the slot in the + -- description hash is not freed anyway + + for unicode, character in next, characters do -- we cannot loop over descriptions ! + + local description = descriptions[unicode] + + local lookups = description.slookups if lookups then - for lookup, p in next, lookups do - action[p[1]](p,lookup,k,glyph,unicode) + for lookupname, lookupdata in next, lookups do + action[lookuptypes[lookupname]](lookupdata,lookupname,unicode,lookuphash) end end - local lookups = glyph.mlookups + + local lookups = description.mlookups if lookups then - for lookup, whatever in next, lookups do - for i=1,#whatever do -- normaly one - local p = whatever[i] - action[p[1]](p,lookup,k,glyph,unicode) + for lookupname, lookuplist in next, lookups do + local lookuptype = lookuptypes[lookupname] + for l=1,#lookuplist do + local lookupdata = lookuplist[l] + action[lookuptype](lookupdata,lookupname,unicode,lookuphash) end end end - local list = glyph.mykerns + + local list = description.kerns if list then - for lookup, krn in next, list do - local k = kerns[lookup] - if not k then k = { } kerns[lookup] = k end - k[unicode] = krn -- ref to glyph, saves lookup - --~ if trace_lookups then - --~ logs.report("define otf","lookup %s: kern for U+%04X",lookup,unicode) - --~ end + for lookup, krn in next, list do -- ref to glyph, saves lookup + local target = lookuphash[lookup] + if target then + target[unicode] = krn + else + lookuphash[lookup] = { [unicode] = krn } + end end end - local oanchor = glyph.anchors - if oanchor then - for typ, anchors in next, oanchor do -- types - if typ == "mark" then - for name, anchor in next, anchors do - local lookups = anchor_to_lookup[name] - if lookups then - for lookup, _ in next, lookups do - local f = mark[lookup] - if not f then f = { } mark[lookup] = f end - f[unicode] = anchors -- ref to glyph, saves lookup - --~ if trace_lookups then - --~ logs.report("define otf","lookup %s: mark anchor %s for U+%04X",lookup,name,unicode) - --~ end - end - end - end - elseif typ == "cexit" then -- or entry? + + local list = description.anchors + if list then + for typ, anchors in next, list do -- types + if typ == "mark" or typ == "cexit" then -- or entry? for name, anchor in next, anchors do local lookups = anchor_to_lookup[name] if lookups then for lookup, _ in next, lookups do - local f = cursive[lookup] - if not f then f = { } cursive[lookup] = f end - f[unicode] = anchors -- ref to glyph, saves lookup - --~ if trace_lookups then - --~ logs.report("define otf","lookup %s: exit anchor %s for U+%04X",lookup,name,unicode) - --~ end + local target = lookuphash[lookup] + if target then + target[unicode] = anchors + else + lookuphash[lookup] = { [unicode] = anchors } + end end end end end end end + + end + +end + +local function split(replacement,original) + local result = { } + for i=1,#replacement do + result[original[i]] = replacement[i] end + return result end --- local cache = { } -luatex = luatex or {} -- this has to change ... we need a better one +-- not shared as we hook into lookups now + +--~ local function uncover_1(covers,result) -- multiple covers +--~ local nofresults = #result +--~ for n=1,#covers do +--~ nofresults = nofresults + 1 +--~ local u = { } +--~ local c = covers[n] +--~ for i=1,#c do +--~ u[c[i]] = true +--~ end +--~ result[nofresults] = u +--~ end +--~ end + +--~ local function uncover_2(covers,result) -- single covers (turned into multiple with n=1) +--~ local nofresults = #result +--~ for n=1,#covers do +--~ nofresults = nofresults + 1 +--~ result[nofresults] = { [covers[n]] = true } +--~ end +--~ end + +--~ local function uncover_1(covers,result) -- multiple covers +--~ local nofresults = #result +--~ for n=1,#covers do +--~ nofresults = nofresults + 1 +--~ result[nofresults] = covers[n] +--~ end +--~ end + +--~ local function prepare_contextchains(tfmdata) +--~ local rawdata = tfmdata.shared.rawdata +--~ local resources = rawdata.resources +--~ local lookuphash = resources.lookuphash +--~ local lookups = rawdata.lookups +--~ if lookups then +--~ for lookupname, lookupdata in next, rawdata.lookups do +--~ local lookuptype = lookupdata.type +--~ if not lookuptype then +--~ report_prepare("missing lookuptype for %s",lookupname) +--~ else -- => lookuphash[lookupname][unicode] +--~ local rules = lookupdata.rules +--~ if rules then +--~ local fmt = lookupdata.format +--~ -- if fmt == "coverage" then +--~ if fmt == "coverage" or fmt == "glyphs" then +--~ if lookuptype ~= "chainsub" and lookuptype ~= "chainpos" then +--~ -- todo: dejavu-serif has one (but i need to see what use it has) +--~ report_prepare("unsupported coverage %s for %s",lookuptype,lookupname) +--~ else +--~ local contexts = lookuphash[lookupname] +--~ if not contexts then +--~ contexts = { } +--~ lookuphash[lookupname] = contexts +--~ end +--~ local t, nt = { }, 0 +--~ for nofrules=1,#rules do -- does #rules>1 happen often? +--~ local rule = rules[nofrules] +--~ local current = rule.current +--~ local before = rule.before +--~ local after = rule.after +--~ local sequence = { } +--~ if before then +--~ uncover_1(before,sequence) +--~ end +--~ local start = #sequence + 1 +--~ uncover_1(current,sequence) +--~ local stop = #sequence +--~ if after then +--~ uncover_1(after,sequence) +--~ end +--~ if sequence[1] then +--~ nt = nt + 1 +--~ t[nt] = { nofrules, lookuptype, sequence, start, stop, rule.lookups } +--~ for unic, _ in next, sequence[start] do +--~ local cu = contexts[unic] +--~ if not cu then +--~ contexts[unic] = t +--~ end +--~ end +--~ end +--~ end +--~ end +--~ elseif fmt == "reversecoverage" then -- we could combine both branches (only dufference is replacements) +--~ if lookuptype ~= "reversesub" then +--~ report_prepare("unsupported reverse coverage %s for %s",lookuptype,lookupname) +--~ else +--~ local contexts = lookuphash[lookupname] +--~ if not contexts then +--~ contexts = { } +--~ lookuphash[lookupname] = contexts +--~ end +--~ local t, nt = { }, 0 +--~ for nofrules=1,#rules do +--~ local rule = rules[nofrules] +--~ local current = rule.current +--~ local before = rule.before +--~ local after = rule.after +--~ local replacements = rule.replacements +--~ local sequence = { } +--~ if before then +--~ uncover_1(before,sequence) +--~ end +--~ local start = #sequence + 1 +--~ uncover_1(current,sequence) +--~ local stop = #sequence +--~ if after then +--~ uncover_1(after,sequence) +--~ end +--~ if sequence[1] then +--~ nt = nt + 1 +--~ t[nt] = { nofrules, lookuptype, sequence, start, stop, rule.lookups, replacements } +--~ for unic, _ in next, sequence[start] do +--~ local cu = contexts[unic] +--~ if not cu then +--~ contexts[unic] = t +--~ end +--~ end +--~ end +--~ end +--~ end +--~ -- elseif fmt == "glyphs" then --maybe just make then before = { fore } and share with coverage +--~ -- if lookuptype ~= "chainsub" and lookuptype ~= "chainpos" then +--~ -- report_prepare("unsupported coverage %s for %s",lookuptype,lookupname) +--~ -- else +--~ -- local contexts = lookuphash[lookupname] +--~ -- if not contexts then +--~ -- contexts = { } +--~ -- lookuphash[lookupname] = contexts +--~ -- end +--~ -- local t, nt = { }, 0 +--~ -- for nofrules=1,#rules do -- we can make glyphs a special case (less tables) +--~ -- local rule = rules[nofrules] +--~ -- local current = rule.names +--~ -- local before = rule.fore +--~ -- local after = rule.back +--~ -- local sequence = { } +--~ -- if before then +--~ -- uncover_1(before,sequence) +--~ -- end +--~ -- local start = #sequence + 1 +--~ -- uncover_1(current,sequence) +--~ -- local stop = #sequence +--~ -- if after then +--~ -- uncover_1(after,sequence) +--~ -- end +--~ -- if sequence then +--~ -- nt = nt + 1 +--~ -- t[nt] = { nofrules, lookuptype, sequence, start, stop, rule.lookups } +--~ -- for unic, _ in next, sequence[start] do +--~ -- local cu = contexts[unic] +--~ -- if not cu then +--~ -- contexts[unic] = t +--~ -- end +--~ -- end +--~ -- end +--~ -- end +--~ -- end +--~ end +--~ end +--~ end +--~ end +--~ end +--~ end + +local valid = { + coverage = { chainsub = true, chainpos = true }, + reversecoverage = { reversesub = true }, + glyphs = { chainsub = true, chainpos = true }, +} -function prepare_contextchains(tfmdata) - local otfdata = tfmdata.shared.otfdata - local lookups = otfdata.lookups +local function prepare_contextchains(tfmdata) + local rawdata = tfmdata.shared.rawdata + local resources = rawdata.resources + local lookuphash = resources.lookuphash + local lookups = rawdata.lookups if lookups then - local featuredata = otfdata.shared.featuredata - local contextchain = featuredata.gsub_contextchain -- shared with gpos - local reversecontextchain = featuredata.gsub_reversecontextchain -- shared with gpos - local characters = tfmdata.characters - local unicodes = tfmdata.unicodes - local indices = tfmdata.indices - local cache = luatex.covers - if not cache then - cache = { } - luatex.covers = cache - end - -- - for lookupname, lookupdata in next, otfdata.lookups do + for lookupname, lookupdata in next, rawdata.lookups do local lookuptype = lookupdata.type - if not lookuptype then - logs.report("otf process","missing lookuptype for %s",lookupname) - else + if lookuptype then local rules = lookupdata.rules if rules then - local fmt = lookupdata.format - -- contextchain[lookupname][unicode] - if fmt == "coverage" then - if lookuptype ~= "chainsub" and lookuptype ~= "chainpos" then - logs.report("otf process","unsupported coverage %s for %s",lookuptype,lookupname) - else - local contexts = contextchain[lookupname] - if not contexts then - contexts = { } - contextchain[lookupname] = contexts - end - local t = { } - for nofrules=1,#rules do -- does #rules>1 happen often? - local rule = rules[nofrules] - local coverage = rule.coverage - if coverage and coverage.current then - local current, before, after, sequence = coverage.current, coverage.before, coverage.after, { } - if before then - uncover(before,sequence,cache,unicodes) - end - local start = #sequence + 1 - uncover(current,sequence,cache,unicodes) - local stop = #sequence - if after then - uncover(after,sequence,cache,unicodes) - end - if sequence[1] then - t[#t+1] = { nofrules, lookuptype, sequence, start, stop, rule.lookups } - for unic, _ in next, sequence[start] do - local cu = contexts[unic] - if not cu then - contexts[unic] = t - end - end - end + local format = lookupdata.format + local validformat = valid[format] + if not validformat then + report_prepare("unsupported format %s",format) + elseif not validformat[lookuptype] then + -- todo: dejavu-serif has one (but i need to see what use it has) + report_prepare("unsupported %s %s for %s",format,lookuptype,lookupname) + else + local contexts = lookuphash[lookupname] + if not contexts then + contexts = { } + lookuphash[lookupname] = contexts + end + local t, nt = { }, 0 + for nofrules=1,#rules do + local rule = rules[nofrules] + local current = rule.current + local before = rule.before + local after = rule.after + local replacements = rule.replacements + local sequence = { } + local nofsequences = 0 + -- Wventually we can store start, stop and sequence in the cached file + -- but then less sharing takes place so best not do that without a lot + -- of profiling so let's forget about it. + if before then + for n=1,#before do + nofsequences = nofsequences + 1 + sequence[nofsequences] = before[n] end end - end - elseif fmt == "reversecoverage" then - if lookuptype ~= "reversesub" then - logs.report("otf process","unsupported reverse coverage %s for %s",lookuptype,lookupname) - else - local contexts = reversecontextchain[lookupname] - if not contexts then - contexts = { } - reversecontextchain[lookupname] = contexts + local start = nofsequences + 1 + for n=1,#current do + nofsequences = nofsequences + 1 + sequence[nofsequences] = current[n] end - local t = { } - for nofrules=1,#rules do - local rule = rules[nofrules] - local reversecoverage = rule.reversecoverage - if reversecoverage and reversecoverage.current then - local current, before, after, replacements, sequence = reversecoverage.current, reversecoverage.before, reversecoverage.after, reversecoverage.replacements, { } - if before then - uncover(before,sequence,cache,unicodes) - end - local start = #sequence + 1 - uncover(current,sequence,cache,unicodes) - local stop = #sequence - if after then - uncover(after,sequence,cache,unicodes) - end - if replacements then - replacements = split(replacements,current[1],cache,unicodes) - end - if sequence[1] then - -- this is different from normal coverage, we assume only replacements - t[#t+1] = { nofrules, lookuptype, sequence, start, stop, rule.lookups, replacements } - for unic, _ in next, sequence[start] do - local cu = contexts[unic] - if not cu then - contexts[unic] = t - end - end - end + local stop = nofsequences + if after then + for n=1,#after do + nofsequences = nofsequences + 1 + sequence[nofsequences] = after[n] end end - end - elseif fmt == "glyphs" then - if lookuptype ~= "chainsub" and lookuptype ~= "chainpos" then - logs.report("otf process","unsupported coverage %s for %s",lookuptype,lookupname) - else - local contexts = contextchain[lookupname] - if not contexts then - contexts = { } - contextchain[lookupname] = contexts - end - local t = { } - for nofrules=1,#rules do - -- nearly the same as coverage so we could as well rename it - local rule = rules[nofrules] - local glyphs = rule.glyphs - if glyphs and glyphs.names then - local fore, back, names, sequence = glyphs.fore, glyphs.back, glyphs.names, { } - if fore and fore ~= "" then - fore = lpegmatch(split_at_space,fore) - uncover(fore,sequence,cache,unicodes) - end - local start = #sequence + 1 - names = lpegmatch(split_at_space,names) - uncover(names,sequence,cache,unicodes) - local stop = #sequence - if back and back ~= "" then - back = lpegmatch(split_at_space,back) - uncover(back,sequence,cache,unicodes) - end - if sequence[1] then - t[#t+1] = { nofrules, lookuptype, sequence, start, stop, rule.lookups } - for unic, _ in next, sequence[start] do - local cu = contexts[unic] - if not cu then - contexts[unic] = t - end - end + if sequence[1] then + -- Replacements only happen with reverse lookups as they are single only. We + -- could pack them into current (replacement value instead of true) and then + -- use sequence[start] instead but it's somewhat ugly. + nt = nt + 1 + t[nt] = { nofrules, lookuptype, sequence, start, stop, rule.lookups, replacements } + for unic, _ in next, sequence[start] do + local cu = contexts[unic] + if not cu then + contexts[unic] = t end end end end end + else + -- no rules end + else + report_prepare("missing lookuptype for %s",lookupname) end end end end -function fonts.initializers.node.otf.features(tfmdata,value) +-- we can consider lookuphash == false (initialized but empty) vs lookuphash == table + +local function featuresinitializer(tfmdata,value) if true then -- value then - if not tfmdata.shared.otfdata.shared.initialized then - local t = trace_preparing and os.clock() - local otfdata = tfmdata.shared.otfdata - local featuredata = otfdata.shared.featuredata - -- caches - featuredata.gsub_multiple = { } - featuredata.gsub_alternate = { } - featuredata.gsub_single = { } - featuredata.gsub_ligature = { } - featuredata.gsub_contextchain = { } - featuredata.gsub_reversecontextchain = { } - featuredata.gpos_pair = { } - featuredata.gpos_single = { } - featuredata.gpos_mark2base = { } - featuredata.gpos_mark2ligature = featuredata.gpos_mark2base - featuredata.gpos_mark2mark = featuredata.gpos_mark2base - featuredata.gpos_cursive = { } - featuredata.gpos_contextchain = featuredata.gsub_contextchain - featuredata.gpos_reversecontextchain = featuredata.gsub_reversecontextchain - -- + -- beware we need to use the topmost properties table + local rawdata = tfmdata.shared.rawdata + local properties = rawdata.properties + if not properties.initialized then + local starttime = trace_preparing and os.clock() + local resources = rawdata.resources + resources.lookuphash = resources.lookuphash or { } prepare_contextchains(tfmdata) prepare_lookups(tfmdata) - otfdata.shared.initialized = true + properties.initialized = true if trace_preparing then - logs.report("otf process","preparation time is %0.3f seconds for %s",os.clock()-t,tfmdata.fullname or "?") + report_prepare("preparation time is %0.3f seconds for %s",os.clock()-starttime,tfmdata.properties.fullname or "?") end end end end + +registerotffeature { + name = "features", + description = "features", + default = true, + initializers = { + position = 1, + node = featuresinitializer, + }, + processors = { + node = featuresprocessor, + } +} diff --git a/Master/texmf-dist/tex/context/base/font-otp.lua b/Master/texmf-dist/tex/context/base/font-otp.lua index a80c515ad6e..f019ade7f48 100644 --- a/Master/texmf-dist/tex/context/base/font-otp.lua +++ b/Master/texmf-dist/tex/context/base/font-otp.lua @@ -8,41 +8,57 @@ if not modules then modules = { } end modules ['font-otp'] = { -- todo: pack math (but not that much to share) -local next, type, tostring = next, type, tostring +local next, type = next, type local sort, concat = table.sort, table.concat local trace_loading = false trackers.register("otf.loading", function(v) trace_loading = v end) +local report_otf = logs.reporter("fonts","otf loading") -fonts = fonts or { } -fonts.otf = fonts.otf or { } -fonts.otf.enhancers = fonts.otf.enhancers or { } -fonts.otf.glists = fonts.otf.glists or { "gsub", "gpos" } +-- also used in other scripts so we need to check some tables: -local criterium, threshold, tabstr = 1, 0, table.serialize +fonts = fonts or { } +fonts.handlers = fonts.handlers or { } +local handlers = fonts.handlers +handlers.otf = handlers.otf or { } +local otf = handlers.otf +otf.enhancers = otf.enhancers or { } +local enhancers = otf.enhancers +otf.glists = otf.glists or { "gsub", "gpos" } +local glists = otf.glists -local function tabstr(t) -- hashed from core-uti / experiment - local s = { } +local criterium = 1 +local threshold = 0 + +local function tabstr(t) + local s, n = { }, 0 for k, v in next, t do + n = n + 1 if type(v) == "table" then - s[#s+1] = k.."={"..tabstr(v).."}" + s[n] = k .. "={" .. tabstr(v) .. "}" + elseif v == true then + s[n] = k .. "=true" + elseif v then + s[n] = k .. "=" .. v else - s[#s+1] = k.."="..tostring(v) + s[n] = k .. "=false" end end sort(s) return concat(s,",") end -function fonts.otf.enhancers.pack(data) +local function packdata(data) if data then local h, t, c = { }, { }, { } local hh, tt, cc = { }, { }, { } - local function pack_1(v) + local nt, ntt = 0, 0 + local function pack_1(v,indexed) -- v == table - local tag = tabstr(v) + local tag = indexed and concat(v," ") or tabstr(v) local ht = h[tag] if not ht then - ht = #t+1 + nt = nt + 1 + ht = nt t[ht] = v h[tag] = ht c[ht] = 1 @@ -51,7 +67,7 @@ function fonts.otf.enhancers.pack(data) end return ht end - local function pack_2(v) + local function pack_2(v,indexed) -- v == number if c[v] <= criterium then return t[v] @@ -59,7 +75,8 @@ function fonts.otf.enhancers.pack(data) -- compact hash local hv = hh[v] if not hv then - hv = #tt+1 + ntt = ntt + 1 + hv = ntt tt[hv] = t[v] hh[v] = hv cc[hv] = c[v] @@ -68,12 +85,12 @@ function fonts.otf.enhancers.pack(data) end end local function success(stage,pass) - if #t == 0 then + if nt == 0 then if trace_loading then - logs.report("load otf","pack quality: nothing to pack") + report_otf("pack quality: nothing to pack") end return false - elseif #t >= threshold then + elseif nt >= threshold then local one, two, rest = 0, 0, 0 if pass == 1 then for k,v in next, c do @@ -87,9 +104,9 @@ function fonts.otf.enhancers.pack(data) end else for k,v in next, cc do - if v >20 then + if v > 20 then rest = rest + 1 - elseif v >10 then + elseif v > 10 then two = two + 1 else one = one + 1 @@ -98,157 +115,164 @@ function fonts.otf.enhancers.pack(data) data.tables = tt end if trace_loading then - logs.report("load otf","pack quality: stage %s, pass %s, %s packed, 1-10:%s, 11-20:%s, rest:%s (criterium: %s)", stage, pass, one+two+rest, one, two, rest, criterium) + report_otf("pack quality: stage %s, pass %s, %s packed, 1-10:%s, 11-20:%s, rest:%s (criterium: %s)", stage, pass, one+two+rest, one, two, rest, criterium) end return true else if trace_loading then - logs.report("load otf","pack quality: stage %s, pass %s, %s packed, aborting pack (threshold: %s)", stage, pass, #t, threshold) + report_otf("pack quality: stage %s, pass %s, %s packed, aborting pack (threshold: %s)", stage, pass, nt, threshold) end return false end end + local resources = data.resources + local lookuptypes = resources.lookuptypes for pass=1,2 do local pack = (pass == 1 and pack_1) or pack_2 - for k, v in next, data.glyphs do - v.boundingbox = pack(v.boundingbox) - local l = v.slookups - if l then - for k,v in next, l do - l[k] = pack(v) - end - end - local l = v.mlookups - if l then - for k,v in next, l do - for kk=1,#v do - local vkk = v[kk] - local what = vkk[1] - if what == "pair" then - local t = vkk[3] if t then vkk[3] = pack(t) end - local t = vkk[4] if t then vkk[4] = pack(t) end - elseif what == "position" then - local t = vkk[2] if t then vkk[2] = pack(t) end + for unicode, description in next, data.descriptions do + local boundingbox = description.boundingbox + if boundingbox then + description.boundingbox = pack(boundingbox,true) + end + local slookups = description.slookups + if slookups then + for tag, slookup in next, slookups do + local what = lookuptypes[tag] + if what == "pair" then + local t = slookup[2] if t then slookup[2] = pack(t,true) end + local t = slookup[3] if t then slookup[3] = pack(t,true) end + elseif what ~= "substitution" then + slookups[tag] = pack(slookup) + end + end + end + local mlookups = description.mlookups + if mlookups then + for tag, mlookup in next, mlookups do + local what = lookuptypes[tag] + if what == "pair" then + for i=1,#mlookup do + local lookup = mlookup[i] + local t = lookup[2] if t then lookup[2] = pack(t,true) end + local t = lookup[3] if t then lookup[3] = pack(t,true) end + end + elseif what ~= "substitution" then + for i=1,#mlookup do + mlookup[i] = pack(mlookup[i]) -- true end - -- v[kk] = pack(vkk) end end end - local m = v.mykerns - if m then - for k,v in next, m do - m[k] = pack(v) + local kerns = description.kerns + if kerns then + for tag, kern in next, kerns do + kerns[tag] = pack(kern) end end - local m = v.math - if m then - local mk = m.kerns - if mk then - for k,v in next, mk do - mk[k] = pack(v) + local math = description.math + if math then + local kerns = math.kerns + if kerns then + for tag, kern in next, kerns do + kerns[tag] = pack(kern) end end end - local a = v.anchors - if a then - for k,v in next, a do - if k == "baselig" then - for kk, vv in next, v do - for kkk=1,#vv do - vv[kkk] = pack(vv[kkk]) + local anchors = description.anchors + if anchors then + for what, anchor in next, anchors do + if what == "baselig" then + for _, a in next, anchor do + for k=1,#a do + a[k] = pack(a[k]) end end else - for kk, vv in next, v do - v[kk] = pack(vv) + for k, v in next, anchor do + anchor[k] = pack(v) end end end end end - if data.lookups then - for k, v in next, data.lookups do - if v.rules then - for kk, vv in next, v.rules do - local l = vv.lookups - if l then - vv.lookups = pack(l) - end - local c = vv.coverage - if c then - local cc = c.before if cc then c.before = pack(cc) end - local cc = c.after if cc then c.after = pack(cc) end - local cc = c.current if cc then c.current = pack(cc) end - end - local c = vv.reversecoverage - if c then - local cc = c.before if cc then c.before = pack(cc) end - local cc = c.after if cc then c.after = pack(cc) end - local cc = c.current if cc then c.current = pack(cc) end - end - -- no need to pack vv.glyphs - local c = vv.glyphs - if c then - if c.fore == "" then c.fore = nil end - if c.back == "" then c.back = nil end - end + local lookups = data.lookups + if lookups then + for _, lookup in next, lookups do + local rules = lookup.rules + if rules then + for i=1,#rules do -- was next loop + local rule = rules[i] +--~ local r = rule.before if r then for i=1,#r do r[i] = pack(r[i],true) end end +--~ local r = rule.after if r then for i=1,#r do r[i] = pack(r[i],true) end end +--~ local r = rule.current if r then for i=1,#r do r[i] = pack(r[i],true) end end +--~ local r = rule.replacements if r then rule.replacements = pack(r, true) end +--~ local r = rule.fore if r then rule.fore = pack(r, true) end +--~ local r = rule.back if r then rule.back = pack(r, true) end +--~ local r = rule.names if r then rule.names = pack(r, true) end +--~ local r = rule.lookups if r then rule.lookups = pack(r) end + local r = rule.before if r then for i=1,#r do r[i] = pack(r[i]) end end + local r = rule.after if r then for i=1,#r do r[i] = pack(r[i]) end end + local r = rule.current if r then for i=1,#r do r[i] = pack(r[i]) end end + local r = rule.replacements if r then rule.replacements = pack(r) end + -- local r = rule.fore if r then rule.fore = pack(r) end + -- local r = rule.back if r then rule.back = pack(r) end + -- local r = rule.names if r then rule.names = pack(r) end + local r = rule.lookups if r then rule.lookups = pack(r) end end end end end - if data.luatex then - local la = data.luatex.anchor_to_lookup - if la then - for lookup, ldata in next, la do - la[lookup] = pack(ldata) - end + local anchor_to_lookup = resources.anchor_to_lookup + if anchor_to_lookup then + for anchor, lookup in next, anchor_to_lookup do + anchor_to_lookup[anchor] = pack(lookup) end - local la = data.luatex.lookup_to_anchor - if la then - for lookup, ldata in next, la do - la[lookup] = pack(ldata) - end + end + local lookup_to_anchor = resources.lookup_to_anchor + if lookup_to_anchor then + for lookup, anchor in next, lookup_to_anchor do + lookup_to_anchor[lookup] = pack(anchor) end - local ls = data.luatex.sequences - if ls then - for feature, fdata in next, ls do - local flags = fdata.flags - if flags then - fdata.flags = pack(flags) - end - local subtables = fdata.subtables - if subtables then - fdata.subtables = pack(subtables) - end - local features = fdata.features - if features then - for script, sdata in next, features do - features[script] = pack(sdata) - end + end + local sequences = resources.sequences + if sequences then + for feature, sequence in next, sequences do + local flags = sequence.flags + if flags then + sequence.flags = pack(flags) + end + local subtables = sequence.subtables + if subtables then + sequence.subtables = pack(subtables) + end + local features = sequence.features + if features then + for script, feature in next, features do + features[script] = pack(feature) end end end - local ls = data.luatex.lookups - if ls then - for lookup, fdata in next, ls do - local flags = fdata.flags - if flags then - fdata.flags = pack(flags) - end - local subtables = fdata.subtables - if subtables then - fdata.subtables = pack(subtables) - end + end + local lookups = resources.lookups + if lookups then + for name, lookup in next, lookups do + local flags = lookup.flags + if flags then + lookup.flags = pack(flags) + end + local subtables = lookup.subtables + if subtables then + lookup.subtables = pack(subtables) end end - local lf = data.luatex.features - if lf then - for _, g in next, fonts.otf.glists do - local gl = lf[g] - if gl then - for feature, spec in next, gl do - gl[feature] = pack(spec) - end + end + local features = resources.features + if features then + for _, what in next, glists do + local list = features[what] + if list then + for feature, spec in next, list do + list[feature] = pack(spec) end end end @@ -257,242 +281,404 @@ function fonts.otf.enhancers.pack(data) return end end - if #t > 0 then + if nt > 0 then for pass=1,2 do local pack = (pass == 1 and pack_1) or pack_2 - for k, v in next, data.glyphs do - local m = v.mykerns - if m then - v.mykerns = pack(m) - end - local m = v.math - if m then - local mk = m.kerns - if mk then - m.kerns = pack(mk) + for unicode, description in next, data.descriptions do + local kerns = description.kerns + if kerns then + description.kerns = pack(kerns) + end + local math = description.math + if math then + local kerns = math.kerns + if kerns then + math.kerns = pack(kerns) end end - local a = v.anchors - if a then - v.anchors = pack(a) + local anchors = description.anchors + if anchors then + description.anchors = pack(anchors) + end + local mlookups = description.mlookups + if mlookups then + for tag, mlookup in next, mlookups do + mlookups[tag] = pack(mlookup) + end end - local l = v.mlookups - if l then - for k,v in next, l do - for kk=1,#v do - v[kk] = pack(v[kk]) + end + local lookups = data.lookups + if lookups then + for _, lookup in next, lookups do + local rules = lookup.rules + if rules then + for i=1,#rules do -- was next loop + local rule = rules[i] + local r = rule.before if r then rule.before = pack(r) end + local r = rule.after if r then rule.after = pack(r) end + local r = rule.current if r then rule.current = pack(r) end end end end end - local ls = data.luatex.sequences - if ls then - for feature, fdata in next, ls do - fdata.features = pack(fdata.features) + local sequences = resources.sequences + if sequences then + for feature, sequence in next, sequences do + sequence.features = pack(sequence.features) end end if not success(2,pass) then ---~ return + -- return + end + end + + for pass=1,2 do + local pack = (pass == 1 and pack_1) or pack_2 + for unicode, description in next, data.descriptions do + local slookups = description.slookups + if slookups then + description.slookups = pack(slookups) + end + local mlookups = description.mlookups + if mlookups then + description.mlookups = pack(mlookups) + end end end + end end end -function fonts.otf.enhancers.unpack(data) +local unpacked_mt = { + __index = + function(t,k) + t[k] = false + return k -- next time true + end +} + +local function unpackdata(data) if data then - local t = data.tables - if t then + local tables = data.tables + if tables then + local resources = data.resources + local lookuptypes = resources.lookuptypes local unpacked = { } - for k, v in next, data.glyphs do - local tv = t[v.boundingbox] if tv then v.boundingbox = tv end - local l = v.slookups - if l then - for k,v in next, l do - local tv = t[v] if tv then l[k] = tv end - end - end - local l = v.mlookups - if l then - for k,v in next, l do - for i=1,#v do - local vi = v[i] - local tv = t[vi] - if tv then - v[i] = tv - if unpacked[tv] then - vi = false - else - unpacked[tv], vi = true, tv + setmetatable(unpacked,unpacked_mt) + for unicode, description in next, data.descriptions do + local tv = tables[description.boundingbox] + if tv then + description.boundingbox = tv + end + local slookups = description.slookups + if slookups then + local tv = tables[slookups] + if tv then + description.slookups = tv + slookups = unpacked[tv] + end + if slookups then + for tag, lookup in next, slookups do + local what = lookuptypes[tag] + if what == "pair" then + local tv = tables[lookup[2]] + if tv then + lookup[2] = tv + end + local tv = tables[lookup[3]] + if tv then + lookup[3] = tv + end + elseif what ~= "substitution" then + local tv = tables[lookup] + if tv then + slookups[tag] = tv end end - if vi then - local what = vi[1] + end + end + end + local mlookups = description.mlookups + if mlookups then + local tv = tables[mlookups] + if tv then + description.mlookups = tv + mlookups = unpacked[tv] + end + if mlookups then + for tag, list in next, mlookups do + local tv = tables[list] + if tv then + mlookups[tag] = tv + list = unpacked[tv] + end + if list then + local what = lookuptypes[tag] if what == "pair" then - local tv = t[vi[3]] if tv then vi[3] = tv end - local tv = t[vi[4]] if tv then vi[4] = tv end - elseif what == "position" then - local tv = t[vi[2]] if tv then vi[2] = tv end + for i=1,#list do + local lookup = list[i] + local tv = tables[lookup[2]] + if tv then + lookup[2] = tv + end + local tv = tables[lookup[3]] + if tv then + lookup[3] = tv + end + end + elseif what ~= "substitution" then + for i=1,#list do + local tv = tables[list[i]] + if tv then + list[i] = tv + end + end end end end end end - local m = v.mykerns - if m then - local tm = t[m] + local kerns = description.kerns + if kerns then + local tm = tables[kerns] if tm then - v.mykerns = tm - if unpacked[tm] then - m = false - else - unpacked[tm], m = true, tm - end + description.kerns = tm + kerns = unpacked[tm] end - if m then - for k,v in next, m do - local tv = t[v] if tv then m[k] = tv end + if kerns then + for k, kern in next, kerns do + local tv = tables[kern] + if tv then + kerns[k] = tv + end end end end - local m = v.math - if m then - local mk = m.kerns - if mk then - local tm = t[mk] + local math = description.math + if math then + local kerns = math.kerns + if kerns then + local tm = tables[kerns] if tm then - m.kerns = tm - if unpacked[tm] then - mk = false - else - unpacked[tm], mk = true, tm - end + math.kerns = tm + kerns = unpacked[tm] end - if mk then - for k,v in next, mk do - local tv = t[v] if tv then mk[k] = tv end + if kerns then + for k, kern in next, kerns do + local tv = tables[kern] + if tv then + kerns[k] = tv + end end end end end - local a = v.anchors - if a then - local ta = t[a] + local anchors = description.anchors + if anchors then + local ta = tables[anchors] if ta then - v.anchors = ta - if not unpacked[ta] then - unpacked[ta], a = true, ta - else - a = false - end + description.anchors = ta + anchors = unpacked[ta] end - if a then - for k,v in next, a do - if k == "baselig" then - for kk, vv in next, v do - for kkk=1,#vv do - local tv = t[vv[kkk]] if tv then vv[kkk] = tv end + if anchors then + for tag, anchor in next, anchors do + if tag == "baselig" then + for _, list in next, anchor do + for i=1,#list do + local tv = tables[list[i]] + if tv then + list[i] = tv + end end end else - for kk, vv in next, v do - local tv = t[vv] if tv then v[kk] = tv end + for a, data in next, anchor do + local tv = tables[data] + if tv then + anchor[a] = tv + end end end end end end end - if data.lookups then - for k, v in next, data.lookups do - local r = v.rules - if r then - for kk, vv in next, r do - local l = vv.lookups - if l then - local tv = t[l] if tv then vv.lookups = tv end + local lookups = data.lookups + if lookups then + for _, lookup in next, lookups do + local rules = lookup.rules + if rules then + for i=1,#rules do -- was next loop + local rule = rules[i] + local before = rule.before + if before then + local tv = tables[before] + if tv then + rule.before = tv + before = unpacked[tv] + end + if before then + for i=1,#before do + local tv = tables[before[i]] + if tv then + before[i] = tv + end + end + end end - local c = vv.coverage - if c then - local cc = c.before if cc then local tv = t[cc] if tv then c.before = tv end end - cc = c.after if cc then local tv = t[cc] if tv then c.after = tv end end - cc = c.current if cc then local tv = t[cc] if tv then c.current = tv end end + local after = rule.after + if after then + local tv = tables[after] + if tv then + rule.after = tv + after = unpacked[tv] + end + if after then + for i=1,#after do + local tv = tables[after[i]] + if tv then + after[i] = tv + end + end + end end - local c = vv.reversecoverage - if c then - local cc = c.before if cc then local tv = t[cc] if tv then c.before = tv end end - cc = c.after if cc then local tv = t[cc] if tv then c.after = tv end end - cc = c.current if cc then local tv = t[cc] if tv then c.current = tv end end + local current = rule.current + if current then + local tv = tables[current] + if tv then + rule.current = tv + current = unpacked[tv] + end + if current then + for i=1,#current do + local tv = tables[current[i]] + if tv then + current[i] = tv + end + end + end + end + local replacements = rule.replacements + if replacements then + local tv = tables[replacements] + if tv then + rule.replacements = tv + end + end + local fore = rule.fore + if fore then + local tv = tables[fore] + if tv then + rule.fore = tv + end + end + local back = rule.back + if back then + local tv = tables[back] + if tv then + rule.back = tv + end + end + local names = rule.names + if names then + local tv = tables[names] + if tv then + rule.names = tv + end + end + local lookups = rule.lookups + if lookups then + local tv = tables[lookups] + if tv then + rule.lookups = tv + end end - -- no need to unpack vv.glyphs end end end end - local luatex = data.luatex - if luatex then - local la = luatex.anchor_to_lookup - if la then - for lookup, ldata in next, la do - local tv = t[ldata] if tv then la[lookup] = tv end - end - end - local la = luatex.lookup_to_anchor - if la then - for lookup, ldata in next, la do - local tv = t[ldata] if tv then la[lookup] = tv end - end - end - local ls = luatex.sequences - if ls then - for feature, fdata in next, ls do - local flags = fdata.flags - if flags then - local tv = t[flags] if tv then fdata.flags = tv end + local anchor_to_lookup = resources.anchor_to_lookup + if anchor_to_lookup then + for anchor, lookup in next, anchor_to_lookup do + local tv = tables[lookup] + if tv then + anchor_to_lookup[anchor] = tv + end + end + end + local lookup_to_anchor = resources.lookup_to_anchor + if lookup_to_anchor then + for lookup, anchor in next, lookup_to_anchor do + local tv = tables[anchor] + if tv then + lookup_to_anchor[lookup] = tv + end + end + end + local ls = resources.sequences + if ls then + for _, feature in next, ls do + local flags = feature.flags + if flags then + local tv = tables[flags] + if tv then + feature.flags = tv end - local subtables = fdata.subtables - if subtables then - local tv = t[subtables] if tv then fdata.subtables = tv end + end + local subtables = feature.subtables + if subtables then + local tv = tables[subtables] + if tv then + feature.subtables = tv + end + end + local features = feature.features + if features then + local tv = tables[features] + if tv then + feature.features = tv + features = unpacked[tv] end - local features = fdata.features if features then - local tv = t[features] - if tv then - fdata.features = tv - if not unpacked[tv] then - unpacked[tv], features = true, tv - else - features = false - end - end - if features then - for script, sdata in next, features do - local tv = t[sdata] if tv then features[script] = tv end + for script, data in next, features do + local tv = tables[data] + if tv then + features[script] = tv end end end end end - local ls = luatex.lookups - if ls then - for lookups, fdata in next, ls do - local flags = fdata.flags - if flags then - local tv = t[flags] if tv then fdata.flags = tv end + end + local lookups = resources.lookups + if lookups then + for _, lookup in next, lookups do + local flags = lookup.flags + if flags then + local tv = tables[flags] + if tv then + lookup.flags = tv end - local subtables = fdata.subtables - if subtables then - local tv = t[subtables] if tv then fdata.subtables = tv end + end + local subtables = lookup.subtables + if subtables then + local tv = tables[subtables] + if tv then + lookup.subtables = tv end end end - local lf = luatex.features - if lf then - for _, g in next, fonts.otf.glists do - local gl = lf[g] - if gl then - for feature, spec in next, gl do - local tv = t[spec] if tv then gl[feature] = tv end + end + local features = resources.features + if features then + for _, what in next, glists do + local feature = features[what] + if feature then + for tag, spec in next, feature do + local tv = tables[spec] + if tv then + feature[tag] = tv end end end @@ -502,3 +688,14 @@ function fonts.otf.enhancers.unpack(data) end end end + +if otf.enhancers.register then + + otf.enhancers.register( "pack", packdata) + otf.enhancers.register("unpack",unpackdata) + +-- todo: directive + +end + +otf.enhancers.unpack = unpackdata -- used elsewhere diff --git a/Master/texmf-dist/tex/context/base/font-ott.lua b/Master/texmf-dist/tex/context/base/font-ott.lua index 2be1bf06c00..800fd3c65e8 100644 --- a/Master/texmf-dist/tex/context/base/font-ott.lua +++ b/Master/texmf-dist/tex/context/base/font-ott.lua @@ -6,729 +6,782 @@ if not modules then modules = { } end modules ['font-otf'] = { license = "see context related readme files" } -local type, next, tonumber, tostring = type, next, tonumber, tostring -local gsub, lower = string.gsub, string.lower +local type, next, tonumber, tostring, rawget = type, next, tonumber, tostring, rawget +local gsub, lower, format, match = string.gsub, string.lower, string.format, string.match +local is_boolean = string.is_boolean -fonts = fonts or { } -fonts.otf = fonts.otf or { } +local setmetatableindex = table.setmetatableindex +local setmetatablenewindex = table.setmetatablenewindex +local allocate = utilities.storage.allocate -local otf = fonts.otf +local fonts = fonts +local otf = fonts.handlers.otf +local tables = { } +otf.tables = tables -otf.tables = otf.tables or { } -otf.meanings = otf.meanings or { } +local otffeatures = fonts.constructors.newfeatures("otf") +local registerotffeature = otffeatures.register -otf.tables.scripts = { - ['dflt'] = 'Default', - - ['arab'] = 'Arabic', - ['armn'] = 'Armenian', - ['bali'] = 'Balinese', - ['beng'] = 'Bengali', - ['bopo'] = 'Bopomofo', - ['brai'] = 'Braille', - ['bugi'] = 'Buginese', - ['buhd'] = 'Buhid', - ['byzm'] = 'Byzantine Music', - ['cans'] = 'Canadian Syllabics', - ['cher'] = 'Cherokee', - ['copt'] = 'Coptic', - ['cprt'] = 'Cypriot Syllabary', - ['cyrl'] = 'Cyrillic', - ['deva'] = 'Devanagari', - ['dsrt'] = 'Deseret', - ['ethi'] = 'Ethiopic', - ['geor'] = 'Georgian', - ['glag'] = 'Glagolitic', - ['goth'] = 'Gothic', - ['grek'] = 'Greek', - ['gujr'] = 'Gujarati', - ['guru'] = 'Gurmukhi', - ['hang'] = 'Hangul', - ['hani'] = 'CJK Ideographic', - ['hano'] = 'Hanunoo', - ['hebr'] = 'Hebrew', - ['ital'] = 'Old Italic', - ['jamo'] = 'Hangul Jamo', - ['java'] = 'Javanese', - ['kana'] = 'Hiragana and Katakana', - ['khar'] = 'Kharosthi', - ['khmr'] = 'Khmer', - ['knda'] = 'Kannada', - ['lao' ] = 'Lao', - ['latn'] = 'Latin', - ['limb'] = 'Limbu', - ['linb'] = 'Linear B', - ['math'] = 'Mathematical Alphanumeric Symbols', - ['mlym'] = 'Malayalam', - ['mong'] = 'Mongolian', - ['musc'] = 'Musical Symbols', - ['mymr'] = 'Myanmar', - ['nko' ] = "N'ko", - ['ogam'] = 'Ogham', - ['orya'] = 'Oriya', - ['osma'] = 'Osmanya', - ['phag'] = 'Phags-pa', - ['phnx'] = 'Phoenician', - ['runr'] = 'Runic', - ['shaw'] = 'Shavian', - ['sinh'] = 'Sinhala', - ['sylo'] = 'Syloti Nagri', - ['syrc'] = 'Syriac', - ['tagb'] = 'Tagbanwa', - ['tale'] = 'Tai Le', - ['talu'] = 'Tai Lu', - ['taml'] = 'Tamil', - ['telu'] = 'Telugu', - ['tfng'] = 'Tifinagh', - ['tglg'] = 'Tagalog', - ['thaa'] = 'Thaana', - ['thai'] = 'Thai', - ['tibt'] = 'Tibetan', - ['ugar'] = 'Ugaritic Cuneiform', - ['xpeo'] = 'Old Persian Cuneiform', - ['xsux'] = 'Sumero-Akkadian Cuneiform', - ['yi' ] = 'Yi', +local scripts = allocate { + ['arab'] = 'arabic', + ['armn'] = 'armenian', + ['bali'] = 'balinese', + ['beng'] = 'bengali', + ['bopo'] = 'bopomofo', + ['brai'] = 'braille', + ['bugi'] = 'buginese', + ['buhd'] = 'buhid', + ['byzm'] = 'byzantine music', + ['cans'] = 'canadian syllabics', + ['cher'] = 'cherokee', + ['copt'] = 'coptic', + ['cprt'] = 'cypriot syllabary', + ['cyrl'] = 'cyrillic', + ['deva'] = 'devanagari', + ['dsrt'] = 'deseret', + ['ethi'] = 'ethiopic', + ['geor'] = 'georgian', + ['glag'] = 'glagolitic', + ['goth'] = 'gothic', + ['grek'] = 'greek', + ['gujr'] = 'gujarati', + ['guru'] = 'gurmukhi', + ['hang'] = 'hangul', + ['hani'] = 'cjk ideographic', + ['hano'] = 'hanunoo', + ['hebr'] = 'hebrew', + ['ital'] = 'old italic', + ['jamo'] = 'hangul jamo', + ['java'] = 'javanese', + ['kana'] = 'hiragana and katakana', + ['khar'] = 'kharosthi', + ['khmr'] = 'khmer', + ['knda'] = 'kannada', + ['lao' ] = 'lao', + ['latn'] = 'latin', + ['limb'] = 'limbu', + ['linb'] = 'linear b', + ['math'] = 'mathematical alphanumeric symbols', + ['mlym'] = 'malayalam', + ['mong'] = 'mongolian', + ['musc'] = 'musical symbols', + ['mymr'] = 'myanmar', + ['nko' ] = "n'ko", + ['ogam'] = 'ogham', + ['orya'] = 'oriya', + ['osma'] = 'osmanya', + ['phag'] = 'phags-pa', + ['phnx'] = 'phoenician', + ['runr'] = 'runic', + ['shaw'] = 'shavian', + ['sinh'] = 'sinhala', + ['sylo'] = 'syloti nagri', + ['syrc'] = 'syriac', + ['tagb'] = 'tagbanwa', + ['tale'] = 'tai le', + ['talu'] = 'tai lu', + ['taml'] = 'tamil', + ['telu'] = 'telugu', + ['tfng'] = 'tifinagh', + ['tglg'] = 'tagalog', + ['thaa'] = 'thaana', + ['thai'] = 'thai', + ['tibt'] = 'tibetan', + ['ugar'] = 'ugaritic cuneiform', + ['xpeo'] = 'old persian cuneiform', + ['xsux'] = 'sumero-akkadian cuneiform', + ['yi' ] = 'yi', } -otf.tables.languages = { - ['dflt'] = 'Default', - - ['aba'] = 'Abaza', - ['abk'] = 'Abkhazian', - ['ady'] = 'Adyghe', - ['afk'] = 'Afrikaans', - ['afr'] = 'Afar', - ['agw'] = 'Agaw', - ['als'] = 'Alsatian', - ['alt'] = 'Altai', - ['amh'] = 'Amharic', - ['ara'] = 'Arabic', - ['ari'] = 'Aari', - ['ark'] = 'Arakanese', - ['asm'] = 'Assamese', - ['ath'] = 'Athapaskan', - ['avr'] = 'Avar', - ['awa'] = 'Awadhi', - ['aym'] = 'Aymara', - ['aze'] = 'Azeri', - ['bad'] = 'Badaga', - ['bag'] = 'Baghelkhandi', - ['bal'] = 'Balkar', - ['bau'] = 'Baule', - ['bbr'] = 'Berber', - ['bch'] = 'Bench', - ['bcr'] = 'Bible Cree', - ['bel'] = 'Belarussian', - ['bem'] = 'Bemba', - ['ben'] = 'Bengali', - ['bgr'] = 'Bulgarian', - ['bhi'] = 'Bhili', - ['bho'] = 'Bhojpuri', - ['bik'] = 'Bikol', - ['bil'] = 'Bilen', - ['bkf'] = 'Blackfoot', - ['bli'] = 'Balochi', - ['bln'] = 'Balante', - ['blt'] = 'Balti', - ['bmb'] = 'Bambara', - ['bml'] = 'Bamileke', - ['bos'] = 'Bosnian', - ['bre'] = 'Breton', - ['brh'] = 'Brahui', - ['bri'] = 'Braj Bhasha', - ['brm'] = 'Burmese', - ['bsh'] = 'Bashkir', - ['bti'] = 'Beti', - ['cat'] = 'Catalan', - ['ceb'] = 'Cebuano', - ['che'] = 'Chechen', - ['chg'] = 'Chaha Gurage', - ['chh'] = 'Chattisgarhi', - ['chi'] = 'Chichewa', - ['chk'] = 'Chukchi', - ['chp'] = 'Chipewyan', - ['chr'] = 'Cherokee', - ['chu'] = 'Chuvash', - ['cmr'] = 'Comorian', - ['cop'] = 'Coptic', - ['cos'] = 'Corsican', - ['cre'] = 'Cree', - ['crr'] = 'Carrier', - ['crt'] = 'Crimean Tatar', - ['csl'] = 'Church Slavonic', - ['csy'] = 'Czech', - ['dan'] = 'Danish', - ['dar'] = 'Dargwa', - ['dcr'] = 'Woods Cree', - ['deu'] = 'German', - ['dgr'] = 'Dogri', - ['div'] = 'Divehi', - ['djr'] = 'Djerma', - ['dng'] = 'Dangme', - ['dnk'] = 'Dinka', - ['dri'] = 'Dari', - ['dun'] = 'Dungan', - ['dzn'] = 'Dzongkha', - ['ebi'] = 'Ebira', - ['ecr'] = 'Eastern Cree', - ['edo'] = 'Edo', - ['efi'] = 'Efik', - ['ell'] = 'Greek', - ['eng'] = 'English', - ['erz'] = 'Erzya', - ['esp'] = 'Spanish', - ['eti'] = 'Estonian', - ['euq'] = 'Basque', - ['evk'] = 'Evenki', - ['evn'] = 'Even', - ['ewe'] = 'Ewe', - ['fan'] = 'French Antillean', - ['far'] = 'Farsi', - ['fin'] = 'Finnish', - ['fji'] = 'Fijian', - ['fle'] = 'Flemish', - ['fne'] = 'Forest Nenets', - ['fon'] = 'Fon', - ['fos'] = 'Faroese', - ['fra'] = 'French', - ['fri'] = 'Frisian', - ['frl'] = 'Friulian', - ['fta'] = 'Futa', - ['ful'] = 'Fulani', - ['gad'] = 'Ga', - ['gae'] = 'Gaelic', - ['gag'] = 'Gagauz', - ['gal'] = 'Galician', - ['gar'] = 'Garshuni', - ['gaw'] = 'Garhwali', - ['gez'] = "Ge'ez", - ['gil'] = 'Gilyak', - ['gmz'] = 'Gumuz', - ['gon'] = 'Gondi', - ['grn'] = 'Greenlandic', - ['gro'] = 'Garo', - ['gua'] = 'Guarani', - ['guj'] = 'Gujarati', - ['hai'] = 'Haitian', - ['hal'] = 'Halam', - ['har'] = 'Harauti', - ['hau'] = 'Hausa', - ['haw'] = 'Hawaiin', - ['hbn'] = 'Hammer-Banna', - ['hil'] = 'Hiligaynon', - ['hin'] = 'Hindi', - ['hma'] = 'High Mari', - ['hnd'] = 'Hindko', - ['ho'] = 'Ho', - ['hri'] = 'Harari', - ['hrv'] = 'Croatian', - ['hun'] = 'Hungarian', - ['hye'] = 'Armenian', - ['ibo'] = 'Igbo', - ['ijo'] = 'Ijo', - ['ilo'] = 'Ilokano', - ['ind'] = 'Indonesian', - ['ing'] = 'Ingush', - ['inu'] = 'Inuktitut', - ['iri'] = 'Irish', - ['irt'] = 'Irish Traditional', - ['isl'] = 'Icelandic', - ['ism'] = 'Inari Sami', - ['ita'] = 'Italian', - ['iwr'] = 'Hebrew', - ['jan'] = 'Japanese', - ['jav'] = 'Javanese', - ['jii'] = 'Yiddish', - ['jud'] = 'Judezmo', - ['jul'] = 'Jula', - ['kab'] = 'Kabardian', - ['kac'] = 'Kachchi', - ['kal'] = 'Kalenjin', - ['kan'] = 'Kannada', - ['kar'] = 'Karachay', - ['kat'] = 'Georgian', - ['kaz'] = 'Kazakh', - ['keb'] = 'Kebena', - ['kge'] = 'Khutsuri Georgian', - ['kha'] = 'Khakass', - ['khk'] = 'Khanty-Kazim', - ['khm'] = 'Khmer', - ['khs'] = 'Khanty-Shurishkar', - ['khv'] = 'Khanty-Vakhi', - ['khw'] = 'Khowar', - ['kik'] = 'Kikuyu', - ['kir'] = 'Kirghiz', - ['kis'] = 'Kisii', - ['kkn'] = 'Kokni', - ['klm'] = 'Kalmyk', - ['kmb'] = 'Kamba', - ['kmn'] = 'Kumaoni', - ['kmo'] = 'Komo', - ['kms'] = 'Komso', - ['knr'] = 'Kanuri', - ['kod'] = 'Kodagu', - ['koh'] = 'Korean Old Hangul', - ['kok'] = 'Konkani', - ['kon'] = 'Kikongo', - ['kop'] = 'Komi-Permyak', - ['kor'] = 'Korean', - ['koz'] = 'Komi-Zyrian', - ['kpl'] = 'Kpelle', - ['kri'] = 'Krio', - ['krk'] = 'Karakalpak', - ['krl'] = 'Karelian', - ['krm'] = 'Karaim', - ['krn'] = 'Karen', - ['krt'] = 'Koorete', - ['ksh'] = 'Kashmiri', - ['ksi'] = 'Khasi', - ['ksm'] = 'Kildin Sami', - ['kui'] = 'Kui', - ['kul'] = 'Kulvi', - ['kum'] = 'Kumyk', - ['kur'] = 'Kurdish', - ['kuu'] = 'Kurukh', - ['kuy'] = 'Kuy', - ['kyk'] = 'Koryak', - ['lad'] = 'Ladin', - ['lah'] = 'Lahuli', - ['lak'] = 'Lak', - ['lam'] = 'Lambani', - ['lao'] = 'Lao', - ['lat'] = 'Latin', - ['laz'] = 'Laz', - ['lcr'] = 'L-Cree', - ['ldk'] = 'Ladakhi', - ['lez'] = 'Lezgi', - ['lin'] = 'Lingala', - ['lma'] = 'Low Mari', - ['lmb'] = 'Limbu', - ['lmw'] = 'Lomwe', - ['lsb'] = 'Lower Sorbian', - ['lsm'] = 'Lule Sami', - ['lth'] = 'Lithuanian', - ['ltz'] = 'Luxembourgish', - ['lub'] = 'Luba', - ['lug'] = 'Luganda', - ['luh'] = 'Luhya', - ['luo'] = 'Luo', - ['lvi'] = 'Latvian', - ['maj'] = 'Majang', - ['mak'] = 'Makua', - ['mal'] = 'Malayalam Traditional', - ['man'] = 'Mansi', - ['map'] = 'Mapudungun', - ['mar'] = 'Marathi', - ['maw'] = 'Marwari', - ['mbn'] = 'Mbundu', - ['mch'] = 'Manchu', - ['mcr'] = 'Moose Cree', - ['mde'] = 'Mende', - ['men'] = "Me'en", - ['miz'] = 'Mizo', - ['mkd'] = 'Macedonian', - ['mle'] = 'Male', - ['mlg'] = 'Malagasy', - ['mln'] = 'Malinke', - ['mlr'] = 'Malayalam Reformed', - ['mly'] = 'Malay', - ['mnd'] = 'Mandinka', - ['mng'] = 'Mongolian', - ['mni'] = 'Manipuri', - ['mnk'] = 'Maninka', - ['mnx'] = 'Manx Gaelic', - ['moh'] = 'Mohawk', - ['mok'] = 'Moksha', - ['mol'] = 'Moldavian', - ['mon'] = 'Mon', - ['mor'] = 'Moroccan', - ['mri'] = 'Maori', - ['mth'] = 'Maithili', - ['mts'] = 'Maltese', - ['mun'] = 'Mundari', - ['nag'] = 'Naga-Assamese', - ['nan'] = 'Nanai', - ['nas'] = 'Naskapi', - ['ncr'] = 'N-Cree', - ['ndb'] = 'Ndebele', - ['ndg'] = 'Ndonga', - ['nep'] = 'Nepali', - ['new'] = 'Newari', - ['ngr'] = 'Nagari', - ['nhc'] = 'Norway House Cree', - ['nis'] = 'Nisi', - ['niu'] = 'Niuean', - ['nkl'] = 'Nkole', - ['nko'] = "N'ko", - ['nld'] = 'Dutch', - ['nog'] = 'Nogai', - ['nor'] = 'Norwegian', - ['nsm'] = 'Northern Sami', - ['nta'] = 'Northern Tai', - ['nto'] = 'Esperanto', - ['nyn'] = 'Nynorsk', - ['oci'] = 'Occitan', - ['ocr'] = 'Oji-Cree', - ['ojb'] = 'Ojibway', - ['ori'] = 'Oriya', - ['oro'] = 'Oromo', - ['oss'] = 'Ossetian', - ['paa'] = 'Palestinian Aramaic', - ['pal'] = 'Pali', - ['pan'] = 'Punjabi', - ['pap'] = 'Palpa', - ['pas'] = 'Pashto', - ['pgr'] = 'Polytonic Greek', - ['pil'] = 'Pilipino', - ['plg'] = 'Palaung', - ['plk'] = 'Polish', - ['pro'] = 'Provencal', - ['ptg'] = 'Portuguese', - ['qin'] = 'Chin', - ['raj'] = 'Rajasthani', - ['rbu'] = 'Russian Buriat', - ['rcr'] = 'R-Cree', - ['ria'] = 'Riang', - ['rms'] = 'Rhaeto-Romanic', - ['rom'] = 'Romanian', - ['roy'] = 'Romany', - ['rsy'] = 'Rusyn', - ['rua'] = 'Ruanda', - ['rus'] = 'Russian', - ['sad'] = 'Sadri', - ['san'] = 'Sanskrit', - ['sat'] = 'Santali', - ['say'] = 'Sayisi', - ['sek'] = 'Sekota', - ['sel'] = 'Selkup', - ['sgo'] = 'Sango', - ['shn'] = 'Shan', - ['sib'] = 'Sibe', - ['sid'] = 'Sidamo', - ['sig'] = 'Silte Gurage', - ['sks'] = 'Skolt Sami', - ['sky'] = 'Slovak', - ['sla'] = 'Slavey', - ['slv'] = 'Slovenian', - ['sml'] = 'Somali', - ['smo'] = 'Samoan', - ['sna'] = 'Sena', - ['snd'] = 'Sindhi', - ['snh'] = 'Sinhalese', - ['snk'] = 'Soninke', - ['sog'] = 'Sodo Gurage', - ['sot'] = 'Sotho', - ['sqi'] = 'Albanian', - ['srb'] = 'Serbian', - ['srk'] = 'Saraiki', - ['srr'] = 'Serer', - ['ssl'] = 'South Slavey', - ['ssm'] = 'Southern Sami', - ['sur'] = 'Suri', - ['sva'] = 'Svan', - ['sve'] = 'Swedish', - ['swa'] = 'Swadaya Aramaic', - ['swk'] = 'Swahili', - ['swz'] = 'Swazi', - ['sxt'] = 'Sutu', - ['syr'] = 'Syriac', - ['tab'] = 'Tabasaran', - ['taj'] = 'Tajiki', - ['tam'] = 'Tamil', - ['tat'] = 'Tatar', - ['tcr'] = 'TH-Cree', - ['tel'] = 'Telugu', - ['tgn'] = 'Tongan', - ['tgr'] = 'Tigre', - ['tgy'] = 'Tigrinya', - ['tha'] = 'Thai', - ['tht'] = 'Tahitian', - ['tib'] = 'Tibetan', - ['tkm'] = 'Turkmen', - ['tmn'] = 'Temne', - ['tna'] = 'Tswana', - ['tne'] = 'Tundra Nenets', - ['tng'] = 'Tonga', - ['tod'] = 'Todo', - ['trk'] = 'Turkish', - ['tsg'] = 'Tsonga', - ['tua'] = 'Turoyo Aramaic', - ['tul'] = 'Tulu', - ['tuv'] = 'Tuvin', - ['twi'] = 'Twi', - ['udm'] = 'Udmurt', - ['ukr'] = 'Ukrainian', - ['urd'] = 'Urdu', - ['usb'] = 'Upper Sorbian', - ['uyg'] = 'Uyghur', - ['uzb'] = 'Uzbek', - ['ven'] = 'Venda', - ['vit'] = 'Vietnamese', - ['wa' ] = 'Wa', - ['wag'] = 'Wagdi', - ['wcr'] = 'West-Cree', - ['wel'] = 'Welsh', - ['wlf'] = 'Wolof', - ['xbd'] = 'Tai Lue', - ['xhs'] = 'Xhosa', - ['yak'] = 'Yakut', - ['yba'] = 'Yoruba', - ['ycr'] = 'Y-Cree', - ['yic'] = 'Yi Classic', - ['yim'] = 'Yi Modern', - ['zhh'] = 'Chinese Hong Kong', - ['zhp'] = 'Chinese Phonetic', - ['zhs'] = 'Chinese Simplified', - ['zht'] = 'Chinese Traditional', - ['znd'] = 'Zande', - ['zul'] = 'Zulu' +local languages = allocate { + ['aba'] = 'abaza', + ['abk'] = 'abkhazian', + ['ady'] = 'adyghe', + ['afk'] = 'afrikaans', + ['afr'] = 'afar', + ['agw'] = 'agaw', + ['als'] = 'alsatian', + ['alt'] = 'altai', + ['amh'] = 'amharic', + ['ara'] = 'arabic', + ['ari'] = 'aari', + ['ark'] = 'arakanese', + ['asm'] = 'assamese', + ['ath'] = 'athapaskan', + ['avr'] = 'avar', + ['awa'] = 'awadhi', + ['aym'] = 'aymara', + ['aze'] = 'azeri', + ['bad'] = 'badaga', + ['bag'] = 'baghelkhandi', + ['bal'] = 'balkar', + ['bau'] = 'baule', + ['bbr'] = 'berber', + ['bch'] = 'bench', + ['bcr'] = 'bible cree', + ['bel'] = 'belarussian', + ['bem'] = 'bemba', + ['ben'] = 'bengali', + ['bgr'] = 'bulgarian', + ['bhi'] = 'bhili', + ['bho'] = 'bhojpuri', + ['bik'] = 'bikol', + ['bil'] = 'bilen', + ['bkf'] = 'blackfoot', + ['bli'] = 'balochi', + ['bln'] = 'balante', + ['blt'] = 'balti', + ['bmb'] = 'bambara', + ['bml'] = 'bamileke', + ['bos'] = 'bosnian', + ['bre'] = 'breton', + ['brh'] = 'brahui', + ['bri'] = 'braj bhasha', + ['brm'] = 'burmese', + ['bsh'] = 'bashkir', + ['bti'] = 'beti', + ['cat'] = 'catalan', + ['ceb'] = 'cebuano', + ['che'] = 'chechen', + ['chg'] = 'chaha gurage', + ['chh'] = 'chattisgarhi', + ['chi'] = 'chichewa', + ['chk'] = 'chukchi', + ['chp'] = 'chipewyan', + ['chr'] = 'cherokee', + ['chu'] = 'chuvash', + ['cmr'] = 'comorian', + ['cop'] = 'coptic', + ['cos'] = 'corsican', + ['cre'] = 'cree', + ['crr'] = 'carrier', + ['crt'] = 'crimean tatar', + ['csl'] = 'church slavonic', + ['csy'] = 'czech', + ['dan'] = 'danish', + ['dar'] = 'dargwa', + ['dcr'] = 'woods cree', + ['deu'] = 'german', + ['dgr'] = 'dogri', + ['div'] = 'divehi', + ['djr'] = 'djerma', + ['dng'] = 'dangme', + ['dnk'] = 'dinka', + ['dri'] = 'dari', + ['dun'] = 'dungan', + ['dzn'] = 'dzongkha', + ['ebi'] = 'ebira', + ['ecr'] = 'eastern cree', + ['edo'] = 'edo', + ['efi'] = 'efik', + ['ell'] = 'greek', + ['eng'] = 'english', + ['erz'] = 'erzya', + ['esp'] = 'spanish', + ['eti'] = 'estonian', + ['euq'] = 'basque', + ['evk'] = 'evenki', + ['evn'] = 'even', + ['ewe'] = 'ewe', + ['fan'] = 'french antillean', + ['far'] = 'farsi', + ['fin'] = 'finnish', + ['fji'] = 'fijian', + ['fle'] = 'flemish', + ['fne'] = 'forest nenets', + ['fon'] = 'fon', + ['fos'] = 'faroese', + ['fra'] = 'french', + ['fri'] = 'frisian', + ['frl'] = 'friulian', + ['fta'] = 'futa', + ['ful'] = 'fulani', + ['gad'] = 'ga', + ['gae'] = 'gaelic', + ['gag'] = 'gagauz', + ['gal'] = 'galician', + ['gar'] = 'garshuni', + ['gaw'] = 'garhwali', + ['gez'] = "ge'ez", + ['gil'] = 'gilyak', + ['gmz'] = 'gumuz', + ['gon'] = 'gondi', + ['grn'] = 'greenlandic', + ['gro'] = 'garo', + ['gua'] = 'guarani', + ['guj'] = 'gujarati', + ['hai'] = 'haitian', + ['hal'] = 'halam', + ['har'] = 'harauti', + ['hau'] = 'hausa', + ['haw'] = 'hawaiin', + ['hbn'] = 'hammer-banna', + ['hil'] = 'hiligaynon', + ['hin'] = 'hindi', + ['hma'] = 'high mari', + ['hnd'] = 'hindko', + ['ho'] = 'ho', + ['hri'] = 'harari', + ['hrv'] = 'croatian', + ['hun'] = 'hungarian', + ['hye'] = 'armenian', + ['ibo'] = 'igbo', + ['ijo'] = 'ijo', + ['ilo'] = 'ilokano', + ['ind'] = 'indonesian', + ['ing'] = 'ingush', + ['inu'] = 'inuktitut', + ['iri'] = 'irish', + ['irt'] = 'irish traditional', + ['isl'] = 'icelandic', + ['ism'] = 'inari sami', + ['ita'] = 'italian', + ['iwr'] = 'hebrew', + ['jan'] = 'japanese', + ['jav'] = 'javanese', + ['jii'] = 'yiddish', + ['jud'] = 'judezmo', + ['jul'] = 'jula', + ['kab'] = 'kabardian', + ['kac'] = 'kachchi', + ['kal'] = 'kalenjin', + ['kan'] = 'kannada', + ['kar'] = 'karachay', + ['kat'] = 'georgian', + ['kaz'] = 'kazakh', + ['keb'] = 'kebena', + ['kge'] = 'khutsuri georgian', + ['kha'] = 'khakass', + ['khk'] = 'khanty-kazim', + ['khm'] = 'khmer', + ['khs'] = 'khanty-shurishkar', + ['khv'] = 'khanty-vakhi', + ['khw'] = 'khowar', + ['kik'] = 'kikuyu', + ['kir'] = 'kirghiz', + ['kis'] = 'kisii', + ['kkn'] = 'kokni', + ['klm'] = 'kalmyk', + ['kmb'] = 'kamba', + ['kmn'] = 'kumaoni', + ['kmo'] = 'komo', + ['kms'] = 'komso', + ['knr'] = 'kanuri', + ['kod'] = 'kodagu', + ['koh'] = 'korean old hangul', + ['kok'] = 'konkani', + ['kon'] = 'kikongo', + ['kop'] = 'komi-permyak', + ['kor'] = 'korean', + ['koz'] = 'komi-zyrian', + ['kpl'] = 'kpelle', + ['kri'] = 'krio', + ['krk'] = 'karakalpak', + ['krl'] = 'karelian', + ['krm'] = 'karaim', + ['krn'] = 'karen', + ['krt'] = 'koorete', + ['ksh'] = 'kashmiri', + ['ksi'] = 'khasi', + ['ksm'] = 'kildin sami', + ['kui'] = 'kui', + ['kul'] = 'kulvi', + ['kum'] = 'kumyk', + ['kur'] = 'kurdish', + ['kuu'] = 'kurukh', + ['kuy'] = 'kuy', + ['kyk'] = 'koryak', + ['lad'] = 'ladin', + ['lah'] = 'lahuli', + ['lak'] = 'lak', + ['lam'] = 'lambani', + ['lao'] = 'lao', + ['lat'] = 'latin', + ['laz'] = 'laz', + ['lcr'] = 'l-cree', + ['ldk'] = 'ladakhi', + ['lez'] = 'lezgi', + ['lin'] = 'lingala', + ['lma'] = 'low mari', + ['lmb'] = 'limbu', + ['lmw'] = 'lomwe', + ['lsb'] = 'lower sorbian', + ['lsm'] = 'lule sami', + ['lth'] = 'lithuanian', + ['ltz'] = 'luxembourgish', + ['lub'] = 'luba', + ['lug'] = 'luganda', + ['luh'] = 'luhya', + ['luo'] = 'luo', + ['lvi'] = 'latvian', + ['maj'] = 'majang', + ['mak'] = 'makua', + ['mal'] = 'malayalam traditional', + ['man'] = 'mansi', + ['map'] = 'mapudungun', + ['mar'] = 'marathi', + ['maw'] = 'marwari', + ['mbn'] = 'mbundu', + ['mch'] = 'manchu', + ['mcr'] = 'moose cree', + ['mde'] = 'mende', + ['men'] = "me'en", + ['miz'] = 'mizo', + ['mkd'] = 'macedonian', + ['mle'] = 'male', + ['mlg'] = 'malagasy', + ['mln'] = 'malinke', + ['mlr'] = 'malayalam reformed', + ['mly'] = 'malay', + ['mnd'] = 'mandinka', + ['mng'] = 'mongolian', + ['mni'] = 'manipuri', + ['mnk'] = 'maninka', + ['mnx'] = 'manx gaelic', + ['moh'] = 'mohawk', + ['mok'] = 'moksha', + ['mol'] = 'moldavian', + ['mon'] = 'mon', + ['mor'] = 'moroccan', + ['mri'] = 'maori', + ['mth'] = 'maithili', + ['mts'] = 'maltese', + ['mun'] = 'mundari', + ['nag'] = 'naga-assamese', + ['nan'] = 'nanai', + ['nas'] = 'naskapi', + ['ncr'] = 'n-cree', + ['ndb'] = 'ndebele', + ['ndg'] = 'ndonga', + ['nep'] = 'nepali', + ['new'] = 'newari', + ['ngr'] = 'nagari', + ['nhc'] = 'norway house cree', + ['nis'] = 'nisi', + ['niu'] = 'niuean', + ['nkl'] = 'nkole', + ['nko'] = "n'ko", + ['nld'] = 'dutch', + ['nog'] = 'nogai', + ['nor'] = 'norwegian', + ['nsm'] = 'northern sami', + ['nta'] = 'northern tai', + ['nto'] = 'esperanto', + ['nyn'] = 'nynorsk', + ['oci'] = 'occitan', + ['ocr'] = 'oji-cree', + ['ojb'] = 'ojibway', + ['ori'] = 'oriya', + ['oro'] = 'oromo', + ['oss'] = 'ossetian', + ['paa'] = 'palestinian aramaic', + ['pal'] = 'pali', + ['pan'] = 'punjabi', + ['pap'] = 'palpa', + ['pas'] = 'pashto', + ['pgr'] = 'polytonic greek', + ['pil'] = 'pilipino', + ['plg'] = 'palaung', + ['plk'] = 'polish', + ['pro'] = 'provencal', + ['ptg'] = 'portuguese', + ['qin'] = 'chin', + ['raj'] = 'rajasthani', + ['rbu'] = 'russian buriat', + ['rcr'] = 'r-cree', + ['ria'] = 'riang', + ['rms'] = 'rhaeto-romanic', + ['rom'] = 'romanian', + ['roy'] = 'romany', + ['rsy'] = 'rusyn', + ['rua'] = 'ruanda', + ['rus'] = 'russian', + ['sad'] = 'sadri', + ['san'] = 'sanskrit', + ['sat'] = 'santali', + ['say'] = 'sayisi', + ['sek'] = 'sekota', + ['sel'] = 'selkup', + ['sgo'] = 'sango', + ['shn'] = 'shan', + ['sib'] = 'sibe', + ['sid'] = 'sidamo', + ['sig'] = 'silte gurage', + ['sks'] = 'skolt sami', + ['sky'] = 'slovak', + ['sla'] = 'slavey', + ['slv'] = 'slovenian', + ['sml'] = 'somali', + ['smo'] = 'samoan', + ['sna'] = 'sena', + ['snd'] = 'sindhi', + ['snh'] = 'sinhalese', + ['snk'] = 'soninke', + ['sog'] = 'sodo gurage', + ['sot'] = 'sotho', + ['sqi'] = 'albanian', + ['srb'] = 'serbian', + ['srk'] = 'saraiki', + ['srr'] = 'serer', + ['ssl'] = 'south slavey', + ['ssm'] = 'southern sami', + ['sur'] = 'suri', + ['sva'] = 'svan', + ['sve'] = 'swedish', + ['swa'] = 'swadaya aramaic', + ['swk'] = 'swahili', + ['swz'] = 'swazi', + ['sxt'] = 'sutu', + ['syr'] = 'syriac', + ['tab'] = 'tabasaran', + ['taj'] = 'tajiki', + ['tam'] = 'tamil', + ['tat'] = 'tatar', + ['tcr'] = 'th-cree', + ['tel'] = 'telugu', + ['tgn'] = 'tongan', + ['tgr'] = 'tigre', + ['tgy'] = 'tigrinya', + ['tha'] = 'thai', + ['tht'] = 'tahitian', + ['tib'] = 'tibetan', + ['tkm'] = 'turkmen', + ['tmn'] = 'temne', + ['tna'] = 'tswana', + ['tne'] = 'tundra nenets', + ['tng'] = 'tonga', + ['tod'] = 'todo', + ['trk'] = 'turkish', + ['tsg'] = 'tsonga', + ['tua'] = 'turoyo aramaic', + ['tul'] = 'tulu', + ['tuv'] = 'tuvin', + ['twi'] = 'twi', + ['udm'] = 'udmurt', + ['ukr'] = 'ukrainian', + ['urd'] = 'urdu', + ['usb'] = 'upper sorbian', + ['uyg'] = 'uyghur', + ['uzb'] = 'uzbek', + ['ven'] = 'venda', + ['vit'] = 'vietnamese', + ['wa' ] = 'wa', + ['wag'] = 'wagdi', + ['wcr'] = 'west-cree', + ['wel'] = 'welsh', + ['wlf'] = 'wolof', + ['xbd'] = 'tai lue', + ['xhs'] = 'xhosa', + ['yak'] = 'yakut', + ['yba'] = 'yoruba', + ['ycr'] = 'y-cree', + ['yic'] = 'yi classic', + ['yim'] = 'yi modern', + ['zhh'] = 'chinese hong kong', + ['zhp'] = 'chinese phonetic', + ['zhs'] = 'chinese simplified', + ['zht'] = 'chinese traditional', + ['znd'] = 'zande', + ['zul'] = 'zulu' } -otf.tables.features = { - ['aalt'] = 'Access All Alternates', - ['abvf'] = 'Above-Base Forms', - ['abvm'] = 'Above-Base Mark Positioning', - ['abvs'] = 'Above-Base Substitutions', - ['afrc'] = 'Alternative Fractions', - ['akhn'] = 'Akhands', - ['blwf'] = 'Below-Base Forms', - ['blwm'] = 'Below-Base Mark Positioning', - ['blws'] = 'Below-Base Substitutions', - ['c2pc'] = 'Petite Capitals From Capitals', - ['c2sc'] = 'Small Capitals From Capitals', - ['calt'] = 'Contextual Alternates', - ['case'] = 'Case-Sensitive Forms', - ['ccmp'] = 'Glyph Composition/Decomposition', - ['cjct'] = 'Conjunct Forms', - ['clig'] = 'Contextual Ligatures', - ['cpsp'] = 'Capital Spacing', - ['cswh'] = 'Contextual Swash', - ['curs'] = 'Cursive Positioning', - ['dflt'] = 'Default Processing', - ['dist'] = 'Distances', - ['dlig'] = 'Discretionary Ligatures', - ['dnom'] = 'Denominators', - ['dtls'] = 'Dotless Forms', -- math - ['expt'] = 'Expert Forms', - ['falt'] = 'Final glyph Alternates', - ['fin2'] = 'Terminal Forms #2', - ['fin3'] = 'Terminal Forms #3', - ['fina'] = 'Terminal Forms', - ['flac'] = 'Flattened Accents Over Capitals', -- math - ['frac'] = 'Fractions', - ['fwid'] = 'Full Width', - ['half'] = 'Half Forms', - ['haln'] = 'Halant Forms', - ['halt'] = 'Alternate Half Width', - ['hist'] = 'Historical Forms', - ['hkna'] = 'Horizontal Kana Alternates', - ['hlig'] = 'Historical Ligatures', - ['hngl'] = 'Hangul', - ['hojo'] = 'Hojo Kanji Forms', - ['hwid'] = 'Half Width', - ['init'] = 'Initial Forms', - ['isol'] = 'Isolated Forms', - ['ital'] = 'Italics', - ['jalt'] = 'Justification Alternatives', - ['jp04'] = 'JIS2004 Forms', - ['jp78'] = 'JIS78 Forms', - ['jp83'] = 'JIS83 Forms', - ['jp90'] = 'JIS90 Forms', - ['kern'] = 'Kerning', - ['lfbd'] = 'Left Bounds', - ['liga'] = 'Standard Ligatures', - ['ljmo'] = 'Leading Jamo Forms', - ['lnum'] = 'Lining Figures', - ['locl'] = 'Localized Forms', - ['mark'] = 'Mark Positioning', - ['med2'] = 'Medial Forms #2', - ['medi'] = 'Medial Forms', - ['mgrk'] = 'Mathematical Greek', - ['mkmk'] = 'Mark to Mark Positioning', - ['mset'] = 'Mark Positioning via Substitution', - ['nalt'] = 'Alternate Annotation Forms', - ['nlck'] = 'NLC Kanji Forms', - ['nukt'] = 'Nukta Forms', - ['numr'] = 'Numerators', - ['onum'] = 'Old Style Figures', - ['opbd'] = 'Optical Bounds', - ['ordn'] = 'Ordinals', - ['ornm'] = 'Ornaments', - ['palt'] = 'Proportional Alternate Width', - ['pcap'] = 'Petite Capitals', - ['pnum'] = 'Proportional Figures', - ['pref'] = 'Pre-base Forms', - ['pres'] = 'Pre-base Substitutions', - ['pstf'] = 'Post-base Forms', - ['psts'] = 'Post-base Substitutions', - ['pwid'] = 'Proportional Widths', - ['qwid'] = 'Quarter Widths', - ['rand'] = 'Randomize', - ['rkrf'] = 'Rakar Forms', - ['rlig'] = 'Required Ligatures', - ['rphf'] = 'Reph Form', - ['rtbd'] = 'Right Bounds', - ['rtla'] = 'Right-To-Left Alternates', - ['rtlm'] = 'Right To Left Math', -- math - ['ruby'] = 'Ruby Notation Forms', - ['salt'] = 'Stylistic Alternates', - ['sinf'] = 'Scientific Inferiors', - ['size'] = 'Optical Size', - ['smcp'] = 'Small Capitals', - ['smpl'] = 'Simplified Forms', - ['ss01'] = 'Stylistic Set 1', - ['ss02'] = 'Stylistic Set 2', - ['ss03'] = 'Stylistic Set 3', - ['ss04'] = 'Stylistic Set 4', - ['ss05'] = 'Stylistic Set 5', - ['ss06'] = 'Stylistic Set 6', - ['ss07'] = 'Stylistic Set 7', - ['ss08'] = 'Stylistic Set 8', - ['ss09'] = 'Stylistic Set 9', - ['ss10'] = 'Stylistic Set 10', - ['ss11'] = 'Stylistic Set 11', - ['ss12'] = 'Stylistic Set 12', - ['ss13'] = 'Stylistic Set 13', - ['ss14'] = 'Stylistic Set 14', - ['ss15'] = 'Stylistic Set 15', - ['ss16'] = 'Stylistic Set 16', - ['ss17'] = 'Stylistic Set 17', - ['ss18'] = 'Stylistic Set 18', - ['ss19'] = 'Stylistic Set 19', - ['ss20'] = 'Stylistic Set 20', - ['ssty'] = 'Script Style', -- math - ['subs'] = 'Subscript', - ['sups'] = 'Superscript', - ['swsh'] = 'Swash', - ['titl'] = 'Titling', - ['tjmo'] = 'Trailing Jamo Forms', - ['tnam'] = 'Traditional Name Forms', - ['tnum'] = 'Tabular Figures', - ['trad'] = 'Traditional Forms', - ['twid'] = 'Third Widths', - ['unic'] = 'Unicase', - ['valt'] = 'Alternate Vertical Metrics', - ['vatu'] = 'Vattu Variants', - ['vert'] = 'Vertical Writing', - ['vhal'] = 'Alternate Vertical Half Metrics', - ['vjmo'] = 'Vowel Jamo Forms', - ['vkna'] = 'Vertical Kana Alternates', - ['vkrn'] = 'Vertical Kerning', - ['vpal'] = 'Proportional Alternate Vertical Metrics', - ['vrt2'] = 'Vertical Rotation', - ['zero'] = 'Slashed Zero', +local features = allocate { + ['aalt'] = 'access all alternates', + ['abvf'] = 'above-base forms', + ['abvm'] = 'above-base mark positioning', + ['abvs'] = 'above-base substitutions', + ['afrc'] = 'alternative fractions', + ['akhn'] = 'akhands', + ['blwf'] = 'below-base forms', + ['blwm'] = 'below-base mark positioning', + ['blws'] = 'below-base substitutions', + ['c2pc'] = 'petite capitals from capitals', + ['c2sc'] = 'small capitals from capitals', + ['calt'] = 'contextual alternates', + ['case'] = 'case-sensitive forms', + ['ccmp'] = 'glyph composition/decomposition', + ['cjct'] = 'conjunct forms', + ['clig'] = 'contextual ligatures', + ['cpsp'] = 'capital spacing', + ['cswh'] = 'contextual swash', + ['curs'] = 'cursive positioning', + ['dflt'] = 'default processing', + ['dist'] = 'distances', + ['dlig'] = 'discretionary ligatures', + ['dnom'] = 'denominators', + ['dtls'] = 'dotless forms', -- math + ['expt'] = 'expert forms', + ['falt'] = 'final glyph alternates', + ['fin2'] = 'terminal forms #2', + ['fin3'] = 'terminal forms #3', + ['fina'] = 'terminal forms', + ['flac'] = 'flattened accents over capitals', -- math + ['frac'] = 'fractions', + ['fwid'] = 'full width', + ['half'] = 'half forms', + ['haln'] = 'halant forms', + ['halt'] = 'alternate half width', + ['hist'] = 'historical forms', + ['hkna'] = 'horizontal kana alternates', + ['hlig'] = 'historical ligatures', + ['hngl'] = 'hangul', + ['hojo'] = 'hojo kanji forms', + ['hwid'] = 'half width', + ['init'] = 'initial forms', + ['isol'] = 'isolated forms', + ['ital'] = 'italics', + ['jalt'] = 'justification alternatives', + ['jp04'] = 'jis2004 forms', + ['jp78'] = 'jis78 forms', + ['jp83'] = 'jis83 forms', + ['jp90'] = 'jis90 forms', + ['kern'] = 'kerning', + ['lfbd'] = 'left bounds', + ['liga'] = 'standard ligatures', + ['ljmo'] = 'leading jamo forms', + ['lnum'] = 'lining figures', + ['locl'] = 'localized forms', + ['mark'] = 'mark positioning', + ['med2'] = 'medial forms #2', + ['medi'] = 'medial forms', + ['mgrk'] = 'mathematical greek', + ['mkmk'] = 'mark to mark positioning', + ['mset'] = 'mark positioning via substitution', + ['nalt'] = 'alternate annotation forms', + ['nlck'] = 'nlc kanji forms', + ['nukt'] = 'nukta forms', + ['numr'] = 'numerators', + ['onum'] = 'old style figures', + ['opbd'] = 'optical bounds', + ['ordn'] = 'ordinals', + ['ornm'] = 'ornaments', + ['palt'] = 'proportional alternate width', + ['pcap'] = 'petite capitals', + ['pnum'] = 'proportional figures', + ['pref'] = 'pre-base forms', + ['pres'] = 'pre-base substitutions', + ['pstf'] = 'post-base forms', + ['psts'] = 'post-base substitutions', + ['pwid'] = 'proportional widths', + ['qwid'] = 'quarter widths', + ['rand'] = 'randomize', + ['rkrf'] = 'rakar forms', + ['rlig'] = 'required ligatures', + ['rphf'] = 'reph form', + ['rtbd'] = 'right bounds', + ['rtla'] = 'right-to-left alternates', + ['rtlm'] = 'right to left math', -- math + ['ruby'] = 'ruby notation forms', + ['salt'] = 'stylistic alternates', + ['sinf'] = 'scientific inferiors', + ['size'] = 'optical size', + ['smcp'] = 'small capitals', + ['smpl'] = 'simplified forms', + ['ss01'] = 'stylistic set 1', + ['ss02'] = 'stylistic set 2', + ['ss03'] = 'stylistic set 3', + ['ss04'] = 'stylistic set 4', + ['ss05'] = 'stylistic set 5', + ['ss06'] = 'stylistic set 6', + ['ss07'] = 'stylistic set 7', + ['ss08'] = 'stylistic set 8', + ['ss09'] = 'stylistic set 9', + ['ss10'] = 'stylistic set 10', + ['ss11'] = 'stylistic set 11', + ['ss12'] = 'stylistic set 12', + ['ss13'] = 'stylistic set 13', + ['ss14'] = 'stylistic set 14', + ['ss15'] = 'stylistic set 15', + ['ss16'] = 'stylistic set 16', + ['ss17'] = 'stylistic set 17', + ['ss18'] = 'stylistic set 18', + ['ss19'] = 'stylistic set 19', + ['ss20'] = 'stylistic set 20', + ['ssty'] = 'script style', -- math + ['subs'] = 'subscript', + ['sups'] = 'superscript', + ['swsh'] = 'swash', + ['titl'] = 'titling', + ['tjmo'] = 'trailing jamo forms', + ['tnam'] = 'traditional name forms', + ['tnum'] = 'tabular figures', + ['trad'] = 'traditional forms', + ['twid'] = 'third widths', + ['unic'] = 'unicase', + ['valt'] = 'alternate vertical metrics', + ['vatu'] = 'vattu variants', + ['vert'] = 'vertical writing', + ['vhal'] = 'alternate vertical half metrics', + ['vjmo'] = 'vowel jamo forms', + ['vkna'] = 'vertical kana alternates', + ['vkrn'] = 'vertical kerning', + ['vpal'] = 'proportional alternate vertical metrics', + ['vrt2'] = 'vertical rotation', + ['zero'] = 'slashed zero', + + ['trep'] = 'traditional tex replacements', + ['tlig'] = 'traditional tex ligatures', - ['trep'] = 'Traditional TeX Replacements', - ['tlig'] = 'Traditional TeX Ligatures', + ['ss'] = 'stylistic set %s', } -otf.tables.baselines = { - ['hang'] = 'Hanging baseline', - ['icfb'] = 'Ideographic character face bottom edge baseline', - ['icft'] = 'Ideographic character face tope edige baseline', - ['ideo'] = 'Ideographic em-box bottom edge baseline', - ['idtp'] = 'Ideographic em-box top edge baseline', - ['math'] = 'Mathmatical centered baseline', - ['romn'] = 'Roman baseline' +local baselines = allocate { + ['hang'] = 'hanging baseline', + ['icfb'] = 'ideographic character face bottom edge baseline', + ['icft'] = 'ideographic character face tope edige baseline', + ['ideo'] = 'ideographic em-box bottom edge baseline', + ['idtp'] = 'ideographic em-box top edge baseline', + ['math'] = 'mathmatical centered baseline', + ['romn'] = 'roman baseline' } --- can be sped up by local tables +tables.scripts = scripts +tables.languages = languages +tables.features = features +tables.baselines = baselines -function otf.tables.to_tag(id) - return stringformat("%4s",lower(id)) +if otffeatures.features then + for k, v in next, otffeatures.features do + features[k] = v + end + otffeatures.features = features end -local function resolve(tab,id) - if tab and id then - id = lower(id) - return tab[id] or tab[gsub(id," ","")] or tab['dflt'] or '' - else - return "unknown" +local function swapped(h) + local r = { } + for k, v in next, h do + r[gsub(v,"[^a-z0-9]","")] = k -- is already lower end + return r end -function otf.meanings.script(id) - return resolve(otf.tables.scripts,id) -end -function otf.meanings.language(id) - return resolve(otf.tables.languages,id) -end -function otf.meanings.feature(id) - return resolve(otf.tables.features,id) -end -function otf.meanings.baseline(id) - return resolve(otf.tables.baselines,id) +local verbosescripts = allocate(swapped(scripts )) +local verboselanguages = allocate(swapped(languages)) +local verbosefeatures = allocate(swapped(features )) +local verbosebaselines = allocate(swapped(baselines)) + +-- lets forget about trailing spaces + +local function resolve(t,k) + if k then + k = gsub(lower(k),"[^a-z0-9]","") + local v = rawget(t,k) + if v then + return v + end + end + return "dflt" end -otf.tables.to_scripts = table.reverse_hash(otf.tables.scripts ) -otf.tables.to_languages = table.reverse_hash(otf.tables.languages) -otf.tables.to_features = table.reverse_hash(otf.tables.features ) +setmetatableindex(verbosescripts, resolve) +setmetatableindex(verboselanguages, resolve) +setmetatableindex(verbosefeatures, resolve) +setmetatableindex(verbosebaselines, resolve) -local scripts = otf.tables.scripts -local languages = otf.tables.languages -local features = otf.tables.features +local function resolve(t,k) + if k then + k = lower(k) + local v = rawget(t,k) or rawget(t,gsub(k," ","")) + if v then + return v + end + end + return "dflt" +end -local to_scripts = otf.tables.to_scripts -local to_languages = otf.tables.to_languages -local to_features = otf.tables.to_features +setmetatableindex(scripts, resolve) +setmetatableindex(scripts, resolve) +setmetatableindex(languages, resolve) -for k, v in next, to_features do - local stripped = gsub(k,"%-"," ") - to_features[stripped] = v - local stripped = gsub(k,"[^a-zA-Z0-9]","") - to_features[stripped] = v +setmetatablenewindex(languages, "ignore") +setmetatablenewindex(baselines, "ignore") +setmetatablenewindex(baselines, "ignore") + +local function resolve(t,k) + if k then + k = lower(k) + local v = rawget(t,k) + if v then + return v + end + k = gsub(k," ","") + local v = rawget(t,k) + if v then + return v + end + local tag, dd = match(k,"(..)(%d+)") + if tag and dd then + local v = rawget(t,tag) + if v then + return format(v,tonumber(dd)) + end + end + end + return "dflt" end -for k, v in next, to_features do - to_features[lower(k)] = v + +setmetatableindex(features, resolve) + +local function assign(t,k,v) + if k then + v = lower(v) + rawset(t,k,v) + rawset(features,gsub(v,"[^a-z0-9]",""),k) + end end -otf.meanings.checkers = { +setmetatablenewindex(features, assign) + +local checkers = { rand = function(v) return v and "random" end } -local checkers = otf.meanings.checkers - -function otf.meanings.normalize(features) - local h = { } - for k,v in next, features do - k = lower(k) - if k == "language" or k == "lang" then - v = gsub(lower(v),"[^a-z0-9%-]","") - k = language - if not languages[v] then - h.language = to_languages[v] or "dflt" - else - h.language = v - end - elseif k == "script" then - v = gsub(lower(v),"[^a-z0-9%-]","") - if not scripts[v] then - h.script = to_scripts[v] or "dflt" - else - h.script = v - end - else - if type(v) == "string" then - local b = v:is_boolean() - if type(b) == "nil" then - v = tonumber(v) or lower(v) +function otf.features.normalize(features) -- no longer 'lang' + if features then + local h = { } + for k,v in next, features do + k = lower(k) + if k == "language" then + v = gsub(lower(v),"[^a-z0-9]","") + if rawget(languages,v) then + h.language = v + else + h.language = rawget(verboselanguages,v) or "dflt" + end + elseif k == "script" then + v = gsub(lower(v),"[^a-z0-9]","") + if rawget(scripts,v) then + h.script = v else - v = b + h.script = rawget(verbosescripts,v) or "dflt" end + else + if type(v) == "string" then + local b = is_boolean(v) + if type(b) == "nil" then + v = tonumber(v) or lower(v) + else + v = b + end + end + if not rawget(features,k) then + k = rawget(verbosefeatures,k) or k + end + local c = checkers[k] + h[k] = c and c(v) or v end - k = to_features[k] or k - local c = checkers[k] - h[k] = c and c(v) or v end + return h end - return h end +--~ table.print(otf.features.normalize({ language = "dutch", liga = "yes", ss99 = true, aalt = 3, abcd = "yes" } )) + -- When I feel the need ... ---~ otf.tables.aat = { +--~ tables.aat = { --~ [ 0] = { --~ name = "allTypographicFeaturesType", --~ [ 0] = "allTypeFeaturesOnSelector", diff --git a/Master/texmf-dist/tex/context/base/font-pat.lua b/Master/texmf-dist/tex/context/base/font-pat.lua index 6aba4d47e3d..b91502c74e5 100644 --- a/Master/texmf-dist/tex/context/base/font-pat.lua +++ b/Master/texmf-dist/tex/context/base/font-pat.lua @@ -6,63 +6,31 @@ if not modules then modules = { } end modules ['font-pat'] = { license = "see context related readme files" } -local match, lower, find = string.match, string.lower, string.find +local match, lower = string.match, string.lower -local trace_loading = false trackers.register("otf.loading", function(v) trace_loading = v end) - --- this will become a per font patch file --- -- older versions of latin modern didn't have the designsize set -- so for them we get it from the name +-- reporter moved to elsewhere -local patches = fonts.otf.enhancers.patches +local fonts = fonts +local otf = fonts.handlers.otf +local patches = otf.enhancers.patches +local register = patches.register +local report = patches.report local function patch(data,filename) if data.design_size == 0 then local ds = match(file.basename(lower(filename)),"(%d+)") if ds then - if trace_loading then - logs.report("load otf","patching design size (%s)",ds) - end + report("design size (%s)",ds) data.design_size = tonumber(ds) * 10 end end - local uni_to_ind = data.map.map - if not uni_to_ind[0x391] then - -- beware, this is a hack, features for latin often don't apply to greek - -- but lm has not much features anyway (and only greek for math) - if trace_loading then - logs.report("load otf","adding 13 greek capitals") - end - uni_to_ind[0x391] = uni_to_ind[0x41] - uni_to_ind[0x392] = uni_to_ind[0x42] - uni_to_ind[0x395] = uni_to_ind[0x45] - uni_to_ind[0x397] = uni_to_ind[0x48] - uni_to_ind[0x399] = uni_to_ind[0x49] - uni_to_ind[0x39A] = uni_to_ind[0x4B] - uni_to_ind[0x39C] = uni_to_ind[0x4D] - uni_to_ind[0x39D] = uni_to_ind[0x4E] - uni_to_ind[0x39F] = uni_to_ind[0x4F] - uni_to_ind[0x3A1] = uni_to_ind[0x52] - uni_to_ind[0x3A4] = uni_to_ind[0x54] - uni_to_ind[0x3A7] = uni_to_ind[0x58] - uni_to_ind[0x396] = uni_to_ind[0x5A] - end - -- better make this into a feature - -- - -- local glyphs = data.glyphs - -- for i=0x300,0x36F do - -- local c = glyphs[uni_to_ind[i]] - -- if c and c.width == 0 then - -- local boundingbox = c.boundingbox - -- c.width = boundingbox[3] - boundingbox[1] - -- end - -- end end -patches["^lmroman"] = patch -patches["^lmsans"] = patch -patches["^lmtypewriter"] = patch +register("after","migrate metadata","^lmroman", patch) +register("after","migrate metadata","^lmsans", patch) +register("after","migrate metadata","^lmtypewriter",patch) -- for some reason (either it's a bug in the font, or it's -- a problem in the library) the palatino arabic fonts don't @@ -74,18 +42,18 @@ local function patch(data,filename) for k=1,#gpos do local v = gpos[k] if not v.features and v.type == "gpos_mark2mark" then - if trace_loading then - logs.report("load otf","patching mkmk feature (name: %s)", v.name or "?") - end + report("mkmk feature (name: %s)", v.name or "?") v.features = { { scripts = { - { - langs = { "ARA ", "FAR ", "URD ", "dflt" }, - script = "arab", - }, + arab = { + ["ARA "] = true, + ["FAR "] = true, + ["URD "] = true, + ["dflt"] = true, + } }, - tag = "mkmk" + tag = "mkmk", } } end @@ -93,34 +61,49 @@ local function patch(data,filename) end end -patches["palatino.*arabic"] = patch +register("after","rehash features","palatino.*arabic",patch) -local function patch_domh(data,filename,threshold) - local m = data.math - if m then - local d = m.DisplayOperatorMinHeight or 0 - if d < threshold then - if trace_loading then - logs.report("load otf","patching DisplayOperatorMinHeight(%s -> %s)",d,threshold) - end - m.DisplayOperatorMinHeight = threshold - end - end - if tex.luatexversion < 48 then - for _, g in next, data.glyphs do - local name = g.name - if find(name,"^integral$") or find(name,"^integral%.vsize") then - local width, italic = g.width or 0, g.italic_correction or 0 - local newwidth = width - italic - if trace_loading then - logs.report("load otf","patching width of %s: %s (width) - %s (italic) = %s",name,width,italic,newwidth) - end - g.width = newwidth - end - end - end -end - -patches["cambria"] = function(data,filename) patch_domh(data,filename,2800) end -patches["cambmath"] = function(data,filename) patch_domh(data,filename,2800) end -patches["asana"] = function(data,filename) patch_domh(data,filename,1350) end +-- -- this code is now in lm-math.lfg +-- +-- local function patch(data,filename) +-- local uni_to_ind = data.map.map +-- if not uni_to_ind[0x391] then +-- -- beware, this is a hack, features for latin often don't apply to greek +-- -- but lm has not much features anyway (and only greek for math) +-- report("adding 13 greek capitals") +-- uni_to_ind[0x391] = uni_to_ind[0x41] +-- uni_to_ind[0x392] = uni_to_ind[0x42] +-- uni_to_ind[0x395] = uni_to_ind[0x45] +-- uni_to_ind[0x397] = uni_to_ind[0x48] +-- uni_to_ind[0x399] = uni_to_ind[0x49] +-- uni_to_ind[0x39A] = uni_to_ind[0x4B] +-- uni_to_ind[0x39C] = uni_to_ind[0x4D] +-- uni_to_ind[0x39D] = uni_to_ind[0x4E] +-- uni_to_ind[0x39F] = uni_to_ind[0x4F] +-- uni_to_ind[0x3A1] = uni_to_ind[0x52] +-- uni_to_ind[0x3A4] = uni_to_ind[0x54] +-- uni_to_ind[0x3A7] = uni_to_ind[0x58] +-- uni_to_ind[0x396] = uni_to_ind[0x5A] +-- end +-- end +-- +-- register("after","prepare glyphs","^lmroman", patch) +-- register("after","prepare glyphs","^lmsans", patch) +-- register("after","prepare glyphs","^lmtypewriter",patch) +-- +-- -- this code is now in cambria-math.lfg and asana-math.lfg +-- +-- local function patch_domh(data,filename,threshold) +-- local m = data.metadata.math +-- if m then +-- local d = m.DisplayOperatorMinHeight or 0 +-- if d < threshold then +-- report("DisplayOperatorMinHeight(%s -> %s)",d,threshold) +-- m.DisplayOperatorMinHeight = threshold +-- end +-- end +-- end +-- +-- register("after","check math parameters","cambria", function(data,filename) patch_domh(data,filename,2800) end) +-- register("after","check math parameters","cambmath",function(data,filename) patch_domh(data,filename,2800) end) +-- register("after","check math parameters","asana", function(data,filename) patch_domh(data,filename,1350) end) diff --git a/Master/texmf-dist/tex/context/base/font-run.mkiv b/Master/texmf-dist/tex/context/base/font-run.mkiv index aad6bebe88e..7a6764ac8a0 100644 --- a/Master/texmf-dist/tex/context/base/font-run.mkiv +++ b/Master/texmf-dist/tex/context/base/font-run.mkiv @@ -140,7 +140,7 @@ \ifinsidefloat\else\startbaselinecorrection\fi \vbox\bgroup \forgetall - \startoverlay + \startoverlay % easier in cld {\vbox {\tf \setstrut \dummy \offinterlineskip @@ -203,33 +203,57 @@ \ifinsidefloat\else\stopbaselinecorrection\fi \egroup} -\gdef\showfontstyle - {\dotripleempty\doshowfontstyle} +% \showfontstyle[modern][rm][tf][all] % #2, #3 and #4 can be 'all' -\gdef\doshowfontstyle[#1][#2][#3]% - {\ifthirdargument - \bgroup - \raggedright - \switchtobodyfont[#1] - \def\dodocommand##1##2% - {\starttextrule{\tttf #1 ##1 ##2} - \nobreak \getvalue{##2}% - \dorecurse{255} - {\iffontchar\font\recurselevel\relax - \char\recurselevel\relax\space - \fi} - \par \nobreak - \stoptextrule} - \def\docommand##1% - {\getvalue{##1}\processcommacommand[#3]{\dodocommand{##1}}} - \processcommalist[#2]\docommand - \egroup - \else\ifsecondargument - \showfontstyle[#1][#2][\fontalternativelist]% math is gone - \else - \showfontstyle[#1][\c!rm]\showfontstyle[#1][\c!ss] - \showfontstyle[#1][\c!tt]\showfontstyle[#1][\c!mm] - \fi\fi} +\gdef\showfontstyle {\dodoubleempty \dodoshowfontstyle} +\gdef\redoshowfontstyle {\dotripleempty \dododoshowfontstyle} +\gdef\redodoshowfontstyle{\doquadrupleempty\dodododoshowfontstyle} + +\gdef\dodoshowfontstyle[#1][#2]% + {\doifelse{#2}\v!all + {\dodoshowfontstyle[#1][\c!rm,\c!ss,\c!tt,\c!mm]} + {\doifelsenothing{#2} + {\redoshowfontstyle[#1][\c!rm,\c!ss,\c!tt,\c!mm]} + {\redoshowfontstyle[#1][#2]}}} + +\gdef\dododoshowfontstyle[#1][#2][#3]% + {\doifelse{#3}\v!all + {\redodoshowfontstyle[#1][#2][\fontalternativelist]} + {\doifelsenothing{#3} + {\redodoshowfontstyle[#1][#2][\fontalternativelist]} + {\redodoshowfontstyle[#1][#2][#3]}}} + +\gdef\dodododoshowfontstyle[#1][#2][#3][#4]% + {\doifelsenothing{#4} + {\doshowfontstyleindeed[#1][#2][#3][\v!all]} + {\doshowfontstyleindeed[#1][#2][#3][#4]}} + +\gdef\doshowfontstyleindeed[#1][#2][#3][#4]% + {\bgroup + \raggedright + \switchtobodyfont[#1] + \def\dododocommand##1% + {\dostepwiserecurse{0}{255}{1} + {\scratchcounter\numexpr##1*256+\recurselevel\relax + \iffontchar\font\scratchcounter\relax + \char\scratchcounter + \space + \fi}}% + \def\dodocommand##1##2% + {\starttextrule{\tttf #1 ##1 ##2} + \nobreak\getvalue{##2}% + \doifelsenothing{#4} + {\dododocommand{0}} + {\doifelse{#4}\v!all + {\dostepwiserecurse{0}{255}{1}{\expanded{\dododocommand{\recurselevel}}}} + {\processcommalist[#4]{\dododocommand}}}% + \par \nobreak + \stoptextrule} + \def\docommand##1% + {\getvalue{##1}% + \processcommacommand[#3]{\dodocommand{##1}}} + \processcommalist[#2]\docommand + \egroup} \gdef\showligature#1% {\hbox{\type{#1}\enspace\red\ruledhbox{\black#1}}} @@ -316,7 +340,7 @@ \starttabulate[||T|T|T|T|T|T|T|T|T|] \testminimalbaseline{\hbox to 1em{\hss\showstruts\strut\hss}}% \testminimalbaseline{(/)}% - \testminimalbaseline{$\frac{1}{2}x^2_3$} + \testminimalbaseline{$\frac{1}{2}x\normalsuperscript2\normalsubscript3$} \stoptabulate \fi} @@ -330,8 +354,18 @@ \gdef\showcharratio {\dowithnextboxcontent {\switchtobodyfont[10pt]}% - {(\expanded{\withoutpt\the\nextboxht},% - \expanded{\withoutpt\the\nextboxdp})}% + {(\withoutpt\the\nextboxht,\withoutpt\the\nextboxdp)}% \hbox} +\gdef\showfontparameters + {\starttabulate[|tl|l|] + \NC slantperpoint \NC \the\fontslantperpoint \font \NC\NR + \NC interwordspace \NC \the\fontinterwordspace \font \NC\NR + \NC interwordstretch\NC \the\fontinterwordstretch\font \NC\NR + \NC interwordshrink \NC \the\fontinterwordshrink \font \NC\NR + \NC exheight \NC \the\fontexheight \font \NC\NR + \NC emwidth \NC \the\fontemwidth \font \NC\NR + \NC extraspace \NC \the\fontextraspace \font \NC\NR + \stoptabulate} + \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/font-syn.lua b/Master/texmf-dist/tex/context/base/font-syn.lua index 5ad92e0022d..1d444cdc705 100644 --- a/Master/texmf-dist/tex/context/base/font-syn.lua +++ b/Master/texmf-dist/tex/context/base/font-syn.lua @@ -17,8 +17,14 @@ local lpegmatch = lpeg.match local utfgsub, utflower = utf.gsub, utf.lower local unpack = unpack or table.unpack -local trace_names = false trackers.register("fonts.names", function(v) trace_names = v end) -local trace_warnings = false trackers.register("fonts.warnings", function(v) trace_warnings = v end) +local allocate = utilities.storage.allocate +local sparse = utilities.storage.sparse + +local trace_names = false trackers.register("fonts.names", function(v) trace_names = v end) +local trace_warnings = false trackers.register("fonts.warnings", function(v) trace_warnings = v end) +local trace_specifications = false trackers.register("fonts.specifications", function(v) trace_specifications = v end) + +local report_names = logs.reporter("fonts","names") --[[ldx--

This module implements a name to filename resolver. Names are resolved @@ -27,31 +33,33 @@ using a table that has keys filtered from the font related files.

local texsprint = (tex and tex.sprint) or print -fonts = fonts or { } -input = input or { } -texmf = texmf or { } +fonts = fonts or { } -- also used elsewhere + +local names = { } +fonts.names = names -fonts.names = fonts.names or { } -fonts.names.filters = fonts.names.filters or { } -fonts.names.data = fonts.names.data or { } +names.filters = names.filters or { } +local filters = names.filters -local names = fonts.names -local filters = fonts.names.filters +names.data = names.data or { } -names.version = 1.103 +names.version = 1.110 names.basename = "names" names.saved = false names.loaded = false names.be_clever = true names.enabled = true -names.autoreload = toboolean(os.env['MTX.FONTS.AUTOLOAD'] or os.env['MTX_FONTS_AUTOLOAD'] or "no") names.cache = containers.define("fonts","data",names.version,true) +local autoreload = true + +directives.register("fonts.autoreload", function(v) autoreload = toboolean(v) end) + --[[ldx--

A few helpers.

--ldx]]-- -local P, C, Cc, Cs, Carg = lpeg.P, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Carg +local P, C, Cc, Cs = lpeg.P, lpeg.C, lpeg.Cc, lpeg.Cs -- what to do with 'thin' @@ -74,6 +82,10 @@ local weights = Cs ( -- not extra + P("regular") / "normal" ) +local normalized_weights = sparse { + regular = "normal", +} + local styles = Cs ( P("reverseoblique") / "reverseitalic" + P("regular") / "normal" @@ -85,6 +97,12 @@ local styles = Cs ( + P("ita") / "italic" ) +local normalized_styles = sparse { + reverseoblique = "reverseitalic", + regular = "normal", + oblique = "italic", +} + local widths = Cs( P("condensed") + P("thin") @@ -94,22 +112,26 @@ local widths = Cs( + P("book") / "normal" ) +local normalized_widths = sparse() + local variants = Cs( -- fax casual P("smallcaps") + P("oldstyle") + P("caps") / "smallcaps" ) +local normalized_variants = sparse() + local any = P(1) -local analysed_table +local analyzed_table -local analyser = Cs ( +local analyzer = Cs ( ( - weights / function(s) analysed_table[1] = s return "" end - + styles / function(s) analysed_table[2] = s return "" end - + widths / function(s) analysed_table[3] = s return "" end - + variants / function(s) analysed_table[4] = s return "" end + weights / function(s) analyzed_table[1] = s return "" end + + styles / function(s) analyzed_table[2] = s return "" end + + widths / function(s) analyzed_table[3] = s return "" end + + variants / function(s) analyzed_table[4] = s return "" end + any )^0 ) @@ -123,24 +145,24 @@ function names.splitspec(askedname) width = width and lpegmatch(widths, width) or width variant = variant and lpegmatch(variants,variant) or variant if trace_names then - logs.report("fonts","requested name '%s' split in name '%s', weight '%s', style '%s', width '%s' and variant '%s'", + report_names("requested name '%s' split in name '%s', weight '%s', style '%s', width '%s' and variant '%s'", askedname,name or '',weight or '',style or '',width or '',variant or '') end if not weight or not weight or not width or not variant then weight, style, width, variant = weight or "normal", style or "normal", width or "normal", variant or "normal" if trace_names then - logs.report("fonts","request '%s' normalized to '%s-%s-%s-%s-%s'", + report_names("request '%s' normalized to '%s-%s-%s-%s-%s'", askedname,name,weight,style,width,variant) end end return name or askedname, weight, style, width, variant end -local function analysespec(somename) +local function analyzespec(somename) if somename then - analysed_table = { } - local name = lpegmatch(analyser,somename) - return name, analysed_table[1], analysed_table[2], analysed_table[3], analysed_table[4] + analyzed_table = { } + local name = lpegmatch(analyzer,somename) + return name, analyzed_table[1], analyzed_table[2], analyzed_table[3], analyzed_table[4] end end @@ -171,9 +193,9 @@ filters.otf = fontloader.fullinfo function filters.afm(name) -- we could parse the afm file as well, and then report an error but -- it's not worth the trouble - local pfbname = resolvers.find_file(file.removesuffix(name)..".pfb","pfb") or "" + local pfbname = resolvers.findfile(file.removesuffix(name)..".pfb","pfb") or "" if pfbname == "" then - pfbname = resolvers.find_file(file.removesuffix(file.basename(name))..".pfb","pfb") or "" + pfbname = resolvers.findfile(file.removesuffix(file.basename(name))..".pfb","pfb") or "" end if pfbname ~= "" then local f = io.open(name) @@ -210,33 +232,39 @@ filters.list = { --~ "ttc", "otf", "ttf", "dfont", "afm", } -names.xml_configuration_file = "fonts.conf" -- a bit weird format, bonus feature -names.environment_path_variable = "OSFONTDIR" -- the official way, in minimals etc +names.fontconfigfile = "fonts.conf" -- a bit weird format, bonus feature +names.osfontdirvariable = "OSFONTDIR" -- the official way, in minimals etc filters.paths = { } filters.names = { } function names.getpaths(trace) - local hash, result = { }, { } - local function collect(t) + local hash, result, r = { }, { }, 0 + local function collect(t,where) for i=1, #t do - local v = resolvers.clean_path(t[i]) - v = gsub(v,"/+$","") + local v = resolvers.cleanpath(t[i]) + v = gsub(v,"/+$","") -- not needed any more local key = lower(v) + report_names("adding path from %s: %s",where,v) if not hash[key] then - hash[key], result[#result+1] = true, v + r = r + 1 + result[r] = v + hash[key] = true end end end - local path = names.environment_path_variable or "" + local path = names.osfontdirvariable or "" if path ~= "" then - collect(resolvers.expanded_path_list(path)) + collect(resolvers.expandedpathlist(path),path) end if xml then - local confname = names.xml_configuration_file or "" + local confname = resolvers.expansion("FONTCONFIG_FILE") or "" + if confname == "" then + confname = names.fontconfigfile or "" + end if confname ~= "" then -- first look in the tex tree - local name = resolvers.find_file(confname,"other") + local name = resolvers.findfile(confname,"fontconfig files") or "" if name == "" then -- after all, fontconfig is a unix thing name = file.join("/etc",confname) @@ -246,7 +274,7 @@ function names.getpaths(trace) end if name ~= "" and lfs.isfile(name) then if trace_names then - logs.report("fontnames","loading fontconfig file: %s",name) + report_names("loading fontconfig file: %s",name) end local xmldata = xml.load(name) -- begin of untested mess @@ -259,19 +287,19 @@ function names.getpaths(trace) end if lfs.isfile(incname) then if trace_names then - logs.report("fontnames","merging included fontconfig file: %s",incname) + report_names("merging included fontconfig file: %s",incname) end return io.loaddata(incname) elseif trace_names then - logs.report("fontnames","ignoring included fontconfig file: %s",incname) + report_names("ignoring included fontconfig file: %s",incname) end end) -- end of untested mess local fontdirs = xml.collect_texts(xmldata,"dir",true) if trace_names then - logs.report("fontnames","%s dirs found in fontconfig",#fontdirs) + report_names("%s dirs found in fontconfig",#fontdirs) end - collect(fontdirs) + collect(fontdirs,"fontconfig file") end end end @@ -287,7 +315,20 @@ local function cleanname(name) -- return (utfgsub(utfgsub(lower(str),"[^%a%A%d]",""),"%s","")) end -names.cleanname = cleanname +local function cleanfilename(fullname,defaultsuffix) + local _, _, name, suffix = file.splitname(fullname) + name = gsub(lower(name),"[^%a%d]","") + if suffix and suffix ~= "" then + return name .. ".".. suffix + elseif defaultsuffix and defaultsuffix ~= "" then + return name .. ".".. defaultsuffix + else + return name + end +end + +names.cleanname = cleanname +names.cleanfilename = cleanfilename local function check_names(result) local names = result.names @@ -305,10 +346,10 @@ local function walk_tree(pathlist,suffix,identify) if pathlist then for i=1,#pathlist do local path = pathlist[i] - path = resolvers.clean_path(path .. "/") + path = resolvers.cleanpath(path .. "/") path = gsub(path,"/+","/") local pattern = path .. "**." .. suffix -- ** forces recurse - logs.report("fontnames", "globbing path %s",pattern) + report_names( "globbing path %s",pattern) local t = dir.glob(pattern) sort(t,sorter) for j=1,#t do @@ -343,8 +384,8 @@ local function check_name(data,result,filename,suffix,subfont) modifiers = modifiers and cleanname(modifiers) weight = weight and cleanname(weight) italicangle = (italicangle == 0) and nil - -- analyse - local a_name, a_weight, a_style, a_width, a_variant = analysespec(fullname or fontname or familyname) + -- analyze + local a_name, a_weight, a_style, a_width, a_variant = analyzespec(fullname or fontname or familyname) -- check local width = a_width local variant = a_variant @@ -368,7 +409,7 @@ local function check_name(data,result,filename,suffix,subfont) fullname = fullname or fontname familyname = familyname or fontname specifications[#specifications + 1] = { - filename = filename, + filename = filename, -- unresolved format = lower(suffix), subfont = subfont, rawname = rawname, @@ -395,11 +436,11 @@ local function cleanupkeywords() for i=1,#specifications do local s = specifications[i] -- fix (sofar styles are taken from the name, and widths from the specification) - local _, b_weight, b_style, b_width, b_variant = analysespec(s.weight) - local _, c_weight, c_style, c_width, c_variant = analysespec(s.style) - local _, d_weight, d_style, d_width, d_variant = analysespec(s.width) - local _, e_weight, e_style, e_width, e_variant = analysespec(s.variant) - local _, f_weight, f_style, f_width, f_variant = analysespec(s.fullname or "") + local _, b_weight, b_style, b_width, b_variant = analyzespec(s.weight) + local _, c_weight, c_style, c_width, c_variant = analyzespec(s.style) + local _, d_weight, d_style, d_width, d_variant = analyzespec(s.width) + local _, e_weight, e_style, e_width, e_variant = analyzespec(s.variant) + local _, f_weight, f_style, f_width, f_variant = analyzespec(s.fullname or "") local weight = b_weight or c_weight or d_weight or e_weight or f_weight or "normal" local style = b_style or c_style or d_style or e_style or f_style or "normal" local width = b_width or c_width or d_width or e_width or f_width or "normal" @@ -529,12 +570,12 @@ local function checkduplicate(where) -- fails on "Romantik" but that's a border local nv = #v if nv > 1 then if trace_warnings then - logs.report("fontnames", "double lookup: %s => %s",k,concat(v," | ")) + report_names( "double lookup: %s => %s",k,concat(v," | ")) end n = n + nv end end - logs.report("fontnames", "%s double lookups in %s",n,where) + report_names( "%s double lookups in %s",n,where) end local function checkduplicates() @@ -588,28 +629,42 @@ local function unpackreferences() end end -local function analysefiles() +local function analyzefiles() local data = names.data - local done, totalnofread, totalnofskipped = { }, 0, 0 + local done, totalnofread, totalnofskipped, totalnofduplicates, nofread, nofskipped, nofduplicates = { }, 0, 0, 0, 0, 0, 0 local skip_paths, skip_names = filters.paths, filters.names +--~ local trace_warnings = true local function identify(completename,name,suffix,storedname) local basename = file.basename(completename) local basepath = file.dirname(completename) + nofread = nofread + 1 if done[name] then -- already done (avoid otf afm clash) + if trace_names then + report_names("%s font %s already done",suffix,completename) + end + nofduplicates = nofduplicates + 1 + nofskipped = nofskipped + 1 elseif not io.exists(completename) then -- weird error - elseif not file.is_qualified_path(completename) and resolvers.find_file(completename,suffix) == "" then + if trace_names then + report_names("%s font %s does not really exist",suffix,completename) + end + nofskipped = nofskipped + 1 + elseif not file.is_qualified_path(completename) and resolvers.findfile(completename,suffix) == "" then -- not locateble by backend anyway + if trace_names then + report_names("%s font %s cannot be found by backend",suffix,completename) + end + nofskipped = nofskipped + 1 else - nofread = nofread + 1 if #skip_paths > 0 then for i=1,#skip_paths do if find(basepath,skip_paths[i]) then if trace_names then - logs.report("fontnames","rejecting path of %s font %s",suffix,completename) - logs.push() + report_names("rejecting path of %s font %s",suffix,completename) end + nofskipped = nofskipped + 1 return end end @@ -619,77 +674,84 @@ local function analysefiles() if find(basename,skip_names[i]) then done[name] = true if trace_names then - logs.report("fontnames","rejecting name of %s font %s",suffix,completename) - logs.push() + report_names("rejecting name of %s font %s",suffix,completename) end + nofskipped = nofskipped + 1 return end end end if trace_names then - logs.report("fontnames","identifying %s font %s",suffix,completename) - logs.push() + report_names("identifying %s font %s",suffix,completename) end local result, message = filters[lower(suffix)](completename) - if trace_names then - logs.pop() - end if result then - if not result[1] then - local ok = check_name(data,result,storedname,suffix) - if not ok then - nofskipped = nofskipped + 1 - end - else + if result[1] then for r=1,#result do local ok = check_name(data,result[r],storedname,suffix,r-1) -- subfonts start at zero - if not ok then - nofskipped = nofskipped + 1 - end + -- if not ok then + -- nofskipped = nofskipped + 1 + -- end end + else + local ok = check_name(data,result,storedname,suffix) + -- if not ok then + -- nofskipped = nofskipped + 1 + -- end end if trace_warnings and message and message ~= "" then - logs.report("fontnames","warning when identifying %s font %s: %s",suffix,completename,message) + report_names("warning when identifying %s font %s: %s",suffix,completename,message) end elseif trace_warnings then - logs.report("fontnames","error when identifying %s font %s: %s",suffix,completename,message or "unknown") + nofskipped = nofskipped + 1 + report_names("error when identifying %s font %s: %s",suffix,completename,message or "unknown") end done[name] = true end + logs.flush() -- a bit overkill for each font, maybe not needed here end local function traverse(what, method) local list = filters.list for n=1,#list do local suffix = list[n] local t = os.gettimeofday() -- use elapser - nofread, nofskipped = 0, 0 + nofread, nofskipped, nofduplicates = 0, 0, 0 suffix = lower(suffix) - logs.report("fontnames", "identifying %s font files with suffix %s",what,suffix) + report_names( "identifying %s font files with suffix %s",what,suffix) method(suffix) suffix = upper(suffix) - logs.report("fontnames", "identifying %s font files with suffix %s",what,suffix) + report_names( "identifying %s font files with suffix %s",what,suffix) method(suffix) - totalnofread, totalnofskipped = totalnofread + nofread, totalnofskipped + nofskipped + totalnofread, totalnofskipped, totalnofduplicates = totalnofread + nofread, totalnofskipped + nofskipped, totalnofduplicates + nofduplicates local elapsed = os.gettimeofday() - t - logs.report("fontnames", "%s %s files identified, %s hash entries added, runtime %0.3f seconds",nofread,what,nofread-nofskipped,elapsed) + report_names( "%s %s files identified, %s skipped, %s duplicates, %s hash entries added, runtime %0.3f seconds",nofread,what,nofskipped,nofduplicates,nofread-nofskipped,elapsed) end + logs.flush() end if not trace_warnings then - logs.report("fontnames", "warnings are disabled (tracker 'fonts.warnings')") + report_names( "warnings are disabled (tracker 'fonts.warnings')") end traverse("tree", function(suffix) -- TEXTREE only - resolvers.with_files(".*%." .. suffix .. "$", function(method,root,path,name) - if method == "file" then + resolvers.dowithfilesintree(".*%." .. suffix .. "$", function(method,root,path,name) + if method == "file" or method == "tree" then local completename = root .."/" .. path .. "/" .. name - identify(completename,name,suffix,name,name) + completename = resolvers.resolve(completename) -- no shortcut + identify(completename,name,suffix,name) + return true end + end, function(blobtype,blobpath,pattern) + blobpath = resolvers.resolve(blobpath) -- no shortcut + report_names( "scanning %s for %s files",blobpath,suffix) + end, function(blobtype,blobpath,pattern,total,checked,done) + blobpath = resolvers.resolve(blobpath) -- no shortcut + report_names( "%s entries found, %s %s files checked, %s okay",total,checked,suffix,done) end) end) if texconfig.kpse_init then -- we do this only for a stupid names run, not used for context itself, -- using the vars is to clumsy so we just stick to a full scan instead traverse("lsr", function(suffix) -- all trees - local pathlist = resolvers.split_path(resolvers.show_path("ls-R") or "") + local pathlist = resolvers.splitpath(resolvers.showpath("ls-R") or "") walk_tree(pathlist,suffix,identify) end) else @@ -697,11 +759,22 @@ local function analysefiles() walk_tree(names.getpaths(trace),suffix,identify) end) end - data.statistics.readfiles, data.statistics.skippedfiles = totalnofread, totalnofskipped + data.statistics.readfiles, data.statistics.skippedfiles, data.statistics.duplicatefiles = totalnofread, totalnofskipped, totalnofduplicates +end + +local function addfilenames() + local data = names.data + local specifications = data.specifications + local files = { } + for i=1,#specifications do + local fullname = specifications[i].filename + files[cleanfilename(fullname)] = fullname + end + data.files = files end local function rejectclashes() -- just to be sure, so no explicit afm will be found then - local specifications, used, okay = names.data.specifications, { }, { } + local specifications, used, okay, o = names.data.specifications, { }, { }, 0 for i=1,#specifications do local s = specifications[i] local f = s.fontname @@ -709,18 +782,21 @@ local function rejectclashes() -- just to be sure, so no explicit afm will be fo local fnd, fnm = used[f], s.filename if fnd then if trace_warnings then - logs.report("fontnames", "fontname '%s' clashes, rejecting '%s' in favor of '%s'",f,fnm,fnd) + report_names( "fontname '%s' clashes, rejecting '%s' in favor of '%s'",f,fnm,fnd) end else - used[f], okay[#okay+1] = fnm, s + used[f] = fnm + o = o + 1 + okay[o] = s end else - okay[#okay+1] = s + o = o + 1 + okay[o] = s end end local d = #specifications - #okay if d > 0 then - logs.report("fontnames", "%s files rejected due to clashes",d) + report_names( "%s files rejected due to clashes",d) end names.data.specifications = okay end @@ -737,30 +813,31 @@ local function resetdata() specifications = { }, families = { }, statistics = { }, - data_state = resolvers.data_state(), + datastate = resolvers.datastate(), } end function names.identify() resetdata() - analysefiles() + analyzefiles() rejectclashes() collectfamilies() collectstatistics() cleanupkeywords() collecthashes() checkduplicates() + addfilenames() -- sorthashes() -- will be resorted when saved end function names.is_permitted(name) - return containers.is_usable(names.cache(), name) + return containers.is_usable(names.cache, name) end -function names.write_data(name,data) - containers.write(names.cache(),name,data) +function names.writedata(name,data) + containers.write(names.cache,name,data) end -function names.read_data(name) - return containers.read(names.cache(),name) +function names.readdata(name) + return containers.read(names.cache,name) end function names.load(reload,verbose) @@ -768,13 +845,13 @@ function names.load(reload,verbose) if reload then if names.is_permitted(names.basename) then names.identify(verbose) - names.write_data(names.basename,names.data) + names.writedata(names.basename,names.data) else - logs.report("font table", "unable to access database cache") + report_names("unable to access database cache") end names.saved = true end - local data = names.read_data(names.basename) + local data = names.readdata(names.basename) names.data = data if not names.saved then if not data or not next(data) or not data.specifications or not next(data.specifications) then @@ -783,7 +860,7 @@ function names.load(reload,verbose) names.saved = true end if not data then - logs.report("font table", "accessing the data table failed") + report_names("accessing the data table failed") else unpackreferences() sorthashes() @@ -809,7 +886,7 @@ local function list_them(mapping,sorted,pattern,t,all) end function names.list(pattern,reload,all) -- here? - names.load(reload) + names.load() -- todo reload if names.loaded then local t = { } local data = names.data @@ -838,19 +915,21 @@ local reloaded = false local function is_reloaded() if not reloaded then local data = names.data - if names.autoreload then - local c_status = table.serialize(resolvers.data_state()) - local f_status = table.serialize(data.data_state) + if autoreload then + local c_status = table.serialize(resolvers.datastate()) + local f_status = table.serialize(data.datastate) if c_status == f_status then - -- logs.report("fonts","font database matches configuration and file hashes") + report_names("font database has matching configuration and file hashes") return else - logs.report("fonts","font database does not match configuration and file hashes") + report_names("font database has mismatching configuration and file hashes") end + else + report_names("font database is regenerated (controlled by directive 'fonts.autoreload')") end names.loaded = false reloaded = true - io.flush() + logs.flush() names.load(true) end end @@ -886,7 +965,7 @@ local function foundname(name,sub) -- sub is not used currently local found = mappings[l][name] if found then if trace_names then - logs.report("fonts","resolved via direct name match: '%s'",name) + report_names("resolved via direct name match: '%s'",name) end return found end @@ -896,7 +975,7 @@ local function foundname(name,sub) -- sub is not used currently local found, fname = fuzzy(mappings[l],sorted_mappings[l],name,sub) if found then if trace_names then - logs.report("fonts","resolved via fuzzy name match: '%s' => '%s'",name,fname) + report_names("resolved via fuzzy name match: '%s' => '%s'",name,fname) end return found end @@ -906,7 +985,7 @@ local function foundname(name,sub) -- sub is not used currently local found = fallbacks[l][name] if found then if trace_names then - logs.report("fonts","resolved via direct fallback match: '%s'",name) + report_names("resolved via direct fallback match: '%s'",name) end return found end @@ -916,11 +995,14 @@ local function foundname(name,sub) -- sub is not used currently local found, fname = fuzzy(sorted_mappings[l],sorted_fallbacks[l],name,sub) if found then if trace_names then - logs.report("fonts","resolved via fuzzy fallback match: '%s' => '%s'",name,fname) + report_names("resolved via fuzzy fallback match: '%s' => '%s'",name,fname) end return found end end + if trace_names then + report_names("font with name '%s' cannot be found",name) + end end function names.resolvedspecification(askedname,sub) @@ -942,6 +1024,17 @@ function names.resolve(askedname,sub) end end +function names.getfilename(askedname,suffix) -- last resort, strip funny chars + names.load() + local files = names.data.files + askedname = files and files[cleanfilename(askedname,suffix)] or "" + if askedname == "" then + return "" + else + return resolvers.findbinfile(askedname,suffix) or "" + end +end + -- specified search local function s_collect_weight_style_width_variant(found,done,all,weight,style,width,variant,family) @@ -1144,7 +1237,7 @@ local function collect(stage,found,done,name,weight,style,width,variant,all) strictname = "^".. name -- to be checked local family = families[name] if trace_names then - logs.report("fonts","resolving name '%s', weight '%s', style '%s', width '%s', variant '%s'", + report_names("resolving name '%s', weight '%s', style '%s', width '%s', variant '%s'", name or "?",tostring(weight),tostring(style),tostring(width),tostring(variant)) end --~ print(name,table.serialize(family)) @@ -1153,27 +1246,27 @@ local function collect(stage,found,done,name,weight,style,width,variant,all) if width and width ~= "" then if variant and variant ~= "" then if trace_names then - logs.report("fonts","resolving stage %s, name '%s', weight '%s', style '%s', width '%s', variant '%s'",stage,name,weight,style,width,variant) + report_names("resolving stage %s, name '%s', weight '%s', style '%s', width '%s', variant '%s'",stage,name,weight,style,width,variant) end s_collect_weight_style_width_variant(found,done,all,weight,style,width,variant,family) m_collect_weight_style_width_variant(found,done,all,weight,style,width,variant,families,sorted,strictname) else if trace_names then - logs.report("fonts","resolving stage %s, name '%s', weight '%s', style '%s', width '%s'",stage,name,weight,style,width) + report_names("resolving stage %s, name '%s', weight '%s', style '%s', width '%s'",stage,name,weight,style,width) end s_collect_weight_style_width(found,done,all,weight,style,width,family) m_collect_weight_style_width(found,done,all,weight,style,width,families,sorted,strictname) end else if trace_names then - logs.report("fonts","resolving stage %s, name '%s', weight '%s', style '%s'",stage,name,weight,style) + report_names("resolving stage %s, name '%s', weight '%s', style '%s'",stage,name,weight,style) end s_collect_weight_style(found,done,all,weight,style,family) m_collect_weight_style(found,done,all,weight,style,families,sorted,strictname) end else if trace_names then - logs.report("fonts","resolving stage %s, name '%s', weight '%s'",stage,name,weight) + report_names("resolving stage %s, name '%s', weight '%s'",stage,name,weight) end s_collect_weight(found,done,all,weight,family) m_collect_weight(found,done,all,weight,families,sorted,strictname) @@ -1181,33 +1274,33 @@ local function collect(stage,found,done,name,weight,style,width,variant,all) elseif style and style ~= "" then if width and width ~= "" then if trace_names then - logs.report("fonts","resolving stage %s, name '%s', style '%s', width '%s'",stage,name,style,width) + report_names("resolving stage %s, name '%s', style '%s', width '%s'",stage,name,style,width) end s_collect_style_width(found,done,all,style,width,family) m_collect_style_width(found,done,all,style,width,families,sorted,strictname) else if trace_names then - logs.report("fonts","resolving stage %s, name '%s', style '%s'",stage,name,style) + report_names("resolving stage %s, name '%s', style '%s'",stage,name,style) end s_collect_style(found,done,all,style,family) m_collect_style(found,done,all,style,families,sorted,strictname) end elseif width and width ~= "" then if trace_names then - logs.report("fonts","resolving stage %s, name '%s', width '%s'",stage,name,width) + report_names("resolving stage %s, name '%s', width '%s'",stage,name,width) end s_collect_width(found,done,all,width,family) m_collect_width(found,done,all,width,families,sorted,strictname) else if trace_names then - logs.report("fonts","resolving stage %s, name '%s'",stage,name) + report_names("resolving stage %s, name '%s'",stage,name) end s_collect(found,done,all,family) m_collect(found,done,all,families,sorted,strictname) end end -function heuristic(name,weight,style,width,variant,all) -- todo: fallbacks +local function heuristic(name,weight,style,width,variant,all) -- todo: fallbacks local found, done = { }, { } --~ print(name,weight,style,width,variant) weight, style, width, variant = weight or "normal", style or "normal", width or "normal", variant or "normal" @@ -1236,11 +1329,11 @@ function heuristic(name,weight,style,width,variant,all) -- todo: fallbacks if nf then local t = { } for i=1,nf do - t[#t+1] = format("'%s'",found[i].fontname) + t[i] = format("'%s'",found[i].fontname) end - logs.report("fonts","name '%s' resolved to %s instances: %s",name,nf,concat(t," ")) + report_names("name '%s' resolved to %s instances: %s",name,nf,concat(t," ")) else - logs.report("fonts","name '%s' unresolved",name) + report_names("name '%s' unresolved",name) end end if all then @@ -1252,7 +1345,7 @@ end function names.specification(askedname,weight,style,width,variant,reload,all) if askedname and askedname ~= "" and names.enabled then - askedname = lower(askedname) -- or cleanname + askedname = cleanname(askedname) -- or cleanname names.load(reload) local found = heuristic(askedname,weight,style,width,variant,all) if not found and is_reloaded() then @@ -1267,7 +1360,7 @@ end function names.collect(askedname,weight,style,width,variant,reload,all) if askedname and askedname ~= "" and names.enabled then - askedname = lower(askedname) -- or cleanname + askedname = cleanname(askedname) -- or cleanname names.load(reload) local list = heuristic(askedname,weight,style,width,variant,true) if not list or #list == 0 and is_reloaded() then @@ -1282,7 +1375,7 @@ function names.collectspec(askedname,reload,all) return names.collect(name,weight,style,width,variant,reload,all) end -function names.resolvespec(askedname,sub) +function names.resolvespec(askedname,sub) -- redefined later local found = names.specification(names.splitspec(askedname)) if found then return found.filename, found.subfont and found.rawname @@ -1291,14 +1384,14 @@ end function names.collectfiles(askedname,reload) -- no all if askedname and askedname ~= "" and names.enabled then - askedname = lower(askedname) -- or cleanname + askedname = cleanname(askedname) -- or cleanname names.load(reload) local list = { } local basename = file.basename local specifications = names.data.specifications for i=1,#specifications do local s = specifications[i] - if find(lower(basename(s.filename)),askedname) then + if find(cleanname(basename(s.filename)),askedname) then list[#list+1] = s end end @@ -1306,65 +1399,71 @@ function names.collectfiles(askedname,reload) -- no all end end ---[[ldx-- -

Fallbacks, not permanent but a transition thing.

---ldx]]-- - -names.new_to_old = { - ["lmroman10-capsregular"] = "lmromancaps10-oblique", - ["lmroman10-capsoblique"] = "lmromancaps10-regular", - ["lmroman10-demi"] = "lmromandemi10-oblique", - ["lmroman10-demioblique"] = "lmromandemi10-regular", - ["lmroman8-oblique"] = "lmromanslant8-regular", - ["lmroman9-oblique"] = "lmromanslant9-regular", - ["lmroman10-oblique"] = "lmromanslant10-regular", - ["lmroman12-oblique"] = "lmromanslant12-regular", - ["lmroman17-oblique"] = "lmromanslant17-regular", - ["lmroman10-boldoblique"] = "lmromanslant10-bold", - ["lmroman10-dunhill"] = "lmromandunh10-oblique", - ["lmroman10-dunhilloblique"] = "lmromandunh10-regular", - ["lmroman10-unslanted"] = "lmromanunsl10-regular", - ["lmsans10-demicondensed"] = "lmsansdemicond10-regular", - ["lmsans10-demicondensedoblique"] = "lmsansdemicond10-oblique", - ["lmsansquotation8-bold"] = "lmsansquot8-bold", - ["lmsansquotation8-boldoblique"] = "lmsansquot8-boldoblique", - ["lmsansquotation8-oblique"] = "lmsansquot8-oblique", - ["lmsansquotation8-regular"] = "lmsansquot8-regular", - ["lmtypewriter8-regular"] = "lmmono8-regular", - ["lmtypewriter9-regular"] = "lmmono9-regular", - ["lmtypewriter10-regular"] = "lmmono10-regular", - ["lmtypewriter12-regular"] = "lmmono12-regular", - ["lmtypewriter10-italic"] = "lmmono10-italic", - ["lmtypewriter10-oblique"] = "lmmonoslant10-regular", - ["lmtypewriter10-capsoblique"] = "lmmonocaps10-oblique", - ["lmtypewriter10-capsregular"] = "lmmonocaps10-regular", - ["lmtypewriter10-light"] = "lmmonolt10-regular", - ["lmtypewriter10-lightoblique"] = "lmmonolt10-oblique", - ["lmtypewriter10-lightcondensed"] = "lmmonoltcond10-regular", - ["lmtypewriter10-lightcondensedoblique"] = "lmmonoltcond10-oblique", - ["lmtypewriter10-dark"] = "lmmonolt10-bold", - ["lmtypewriter10-darkoblique"] = "lmmonolt10-boldoblique", - ["lmtypewritervarwd10-regular"] = "lmmonoproplt10-regular", - ["lmtypewritervarwd10-oblique"] = "lmmonoproplt10-oblique", - ["lmtypewritervarwd10-light"] = "lmmonoprop10-regular", - ["lmtypewritervarwd10-lightoblique"] = "lmmonoprop10-oblique", - ["lmtypewritervarwd10-dark"] = "lmmonoproplt10-bold", - ["lmtypewritervarwd10-darkoblique"] = "lmmonoproplt10-boldoblique", -} - -names.old_to_new = table.swapped(names.new_to_old) +--~ --[[ldx-- +--~

Fallbacks, not permanent but a transition thing.

+--~ --ldx]]-- +--~ +--~ names.new_to_old = allocate { +--~ ["lmroman10-capsregular"] = "lmromancaps10-oblique", +--~ ["lmroman10-capsoblique"] = "lmromancaps10-regular", +--~ ["lmroman10-demi"] = "lmromandemi10-oblique", +--~ ["lmroman10-demioblique"] = "lmromandemi10-regular", +--~ ["lmroman8-oblique"] = "lmromanslant8-regular", +--~ ["lmroman9-oblique"] = "lmromanslant9-regular", +--~ ["lmroman10-oblique"] = "lmromanslant10-regular", +--~ ["lmroman12-oblique"] = "lmromanslant12-regular", +--~ ["lmroman17-oblique"] = "lmromanslant17-regular", +--~ ["lmroman10-boldoblique"] = "lmromanslant10-bold", +--~ ["lmroman10-dunhill"] = "lmromandunh10-oblique", +--~ ["lmroman10-dunhilloblique"] = "lmromandunh10-regular", +--~ ["lmroman10-unslanted"] = "lmromanunsl10-regular", +--~ ["lmsans10-demicondensed"] = "lmsansdemicond10-regular", +--~ ["lmsans10-demicondensedoblique"] = "lmsansdemicond10-oblique", +--~ ["lmsansquotation8-bold"] = "lmsansquot8-bold", +--~ ["lmsansquotation8-boldoblique"] = "lmsansquot8-boldoblique", +--~ ["lmsansquotation8-oblique"] = "lmsansquot8-oblique", +--~ ["lmsansquotation8-regular"] = "lmsansquot8-regular", +--~ ["lmtypewriter8-regular"] = "lmmono8-regular", +--~ ["lmtypewriter9-regular"] = "lmmono9-regular", +--~ ["lmtypewriter10-regular"] = "lmmono10-regular", +--~ ["lmtypewriter12-regular"] = "lmmono12-regular", +--~ ["lmtypewriter10-italic"] = "lmmono10-italic", +--~ ["lmtypewriter10-oblique"] = "lmmonoslant10-regular", +--~ ["lmtypewriter10-capsoblique"] = "lmmonocaps10-oblique", +--~ ["lmtypewriter10-capsregular"] = "lmmonocaps10-regular", +--~ ["lmtypewriter10-light"] = "lmmonolt10-regular", +--~ ["lmtypewriter10-lightoblique"] = "lmmonolt10-oblique", +--~ ["lmtypewriter10-lightcondensed"] = "lmmonoltcond10-regular", +--~ ["lmtypewriter10-lightcondensedoblique"] = "lmmonoltcond10-oblique", +--~ ["lmtypewriter10-dark"] = "lmmonolt10-bold", +--~ ["lmtypewriter10-darkoblique"] = "lmmonolt10-boldoblique", +--~ ["lmtypewritervarwd10-regular"] = "lmmonoproplt10-regular", +--~ ["lmtypewritervarwd10-oblique"] = "lmmonoproplt10-oblique", +--~ ["lmtypewritervarwd10-light"] = "lmmonoprop10-regular", +--~ ["lmtypewritervarwd10-lightoblique"] = "lmmonoprop10-oblique", +--~ ["lmtypewritervarwd10-dark"] = "lmmonoproplt10-bold", +--~ ["lmtypewritervarwd10-darkoblique"] = "lmmonoproplt10-boldoblique", +--~ } +--~ +--~ names.old_to_new = allocate(table.swapped(names.new_to_old)) + +--~ todo: +--~ +--~ blacklisted = { +--~ ["cmr10.ttf"] = "completely messed up", +--~ } function names.exists(name) local found = false local list = filters.list for k=1,#list do local v = list[k] - found = (resolvers.find_file(name,v) or "") ~= "" + found = (resolvers.findfile(name,v) or "") ~= "" if found then return found end end - return ((resolvers.find_file(name,"tfm") or "") ~= "") or ((names.resolve(name) or "") ~= "") + return ((resolvers.findfile(name,"tfm") or "") ~= "") or ((names.resolve(name) or "") ~= "") end -- for i=1,fonts.names.lookup(pattern) do @@ -1385,19 +1484,31 @@ function names.lookup(pattern,name,reload) -- todo: find lookups = families[pattern] end if trace_names then - logs.report("fonts","starting with %s lookups for '%s'",#lookups,pattern) + report_names("starting with %s lookups for '%s'",#lookups,pattern) end if lookups then for key, value in gmatch(pattern,"([^=,]+)=([^=,]+)") do - local t = { } - for i=1,#lookups do - local s = lookups[i] - if s[key] == value then - t[#t+1] = lookups[i] + local t, n = { }, 0 + if find(value,"*") then + value = string.topattern(value) + for i=1,#lookups do + local s = lookups[i] + if find(s[key],value) then + n = n + 1 + t[n] = lookups[i] + end + end + else + for i=1,#lookups do + local s = lookups[i] + if s[key] == value then + n = n + 1 + t[n] = lookups[i] + end end end if trace_names then - logs.report("fonts","%s matches for key '%s' with value '%s'",#t,key,value) + report_names("%s matches for key '%s' with value '%s'",#t,key,value) end lookups = t end @@ -1424,31 +1535,91 @@ function names.getlookups(pattern,name,reload) return lastlookups end -function table.formatcolumns(result) - if result and #result > 0 then - local widths = { } - local first = result[1] - local n = #first - for i=1,n do - widths[i] = 0 - end - for i=1,#result do - local r = result[i] - for j=1,n do - local w = #r[j] - if w > widths[j] then - widths[j] = w +-- The following is new ... watch the overload! + +local specifications = allocate() +names.specifications = specifications + +-- files = { +-- name = "antykwapoltawskiego", +-- list = { +-- ["AntPoltLtCond-Regular.otf"] = { +-- -- name = "antykwapoltawskiego", +-- style = "regular", +-- weight = "light", +-- width = "condensed", +-- }, +-- }, +-- } + +function names.register(files) + if files then + local list, commonname = files.list, files.name + if list then + local n, m = 0, 0 + for filename, filespec in next, list do + local name = lower(filespec.name or commonname) + if name and name ~= "" then + local style = normalized_styles [lower(filespec.style or "normal")] + local width = normalized_widths [lower(filespec.width or "normal")] + local weight = normalized_weights [lower(filespec.weight or "normal")] + local variant = normalized_variants[lower(filespec.variant or "normal")] + local weights = specifications[name ] if not weights then weights = { } specifications[name ] = weights end + local styles = weights [weight] if not styles then styles = { } weights [weight] = styles end + local widths = styles [style ] if not widths then widths = { } styles [style ] = widths end + local variants = widths [width ] if not variants then variants = { } widths [width ] = variants end + variants[variant] = filename + n = n + 1 + else + m = m + 1 end end + if trace_specifications then + report_names("%s filenames registered, %s filenames rejected",n,m) + end end - for i=1,n do - widths[i] = "%-" .. widths[i] .. "s" + end +end + +function names.registered(name,weight,style,width,variant) + local ok = specifications[name] + ok = ok and (ok[(weight and weight ~= "" and weight ) or "normal"] or ok.normal) + ok = ok and (ok[(style and style ~= "" and style ) or "normal"] or ok.normal) + ok = ok and (ok[(width and width ~= "" and width ) or "normal"] or ok.normal) + ok = ok and (ok[(variant and variant ~= "" and variant) or "normal"] or ok.normal) + -- + -- todo: same fallbacks as with database + -- + if ok then + return { + filename = ok, + subname = "", + -- rawname = nil, + } + end +end + +function names.resolvespec(askedname,sub) -- overloads previous definition + local name, weight, style, width, variant = names.splitspec(askedname) + if trace_specifications then + report_names("resolving specification: %s -> name=%s, weight=%s, style=%s, width=%s, variant=%s",askedname,name,weight,style,width,variant) + end + local found = names.registered(name,weight,style,width,variant) + if found and found.filename then + if trace_specifications then + report_names("resolved by registered names: %s -> %s",askedname,found.filename) end - local template = concat(widths," ") - for i=1,#result do - local str = format(template,unpack(result[i])) - result[i] = string.strip(str) + return found.filename, found.subname, found.rawname + else + found = names.specification(name,weight,style,width,variant) + if found and found.filename then + if trace_specifications then + report_names("resolved by font database: %s -> %s",askedname,found.filename) + end + return found.filename, found.subfont and found.rawname end end - return result + if trace_specifications then + report_names("unresolved: %s",askedname) + end end diff --git a/Master/texmf-dist/tex/context/base/font-tfm.lua b/Master/texmf-dist/tex/context/base/font-tfm.lua index 31ae2cae1c2..8f0a99d5aee 100644 --- a/Master/texmf-dist/tex/context/base/font-tfm.lua +++ b/Master/texmf-dist/tex/context/base/font-tfm.lua @@ -6,731 +6,137 @@ if not modules then modules = { } end modules ['font-tfm'] = { license = "see context related readme files" } -local utf = unicode.utf8 +local next = next +local match = string.match -local next, format, match, lower, gsub = next, string.format, string.match, string.lower, string.gsub -local concat, sortedkeys, utfbyte, serialize = table.concat, table.sortedkeys, utf.byte, table.serialize +local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) +local trace_features = false trackers.register("tfm.features", function(v) trace_features = v end) -local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) -local trace_scaling = false trackers.register("fonts.scaling" , function(v) trace_scaling = v end) +local report_defining = logs.reporter("fonts","defining") +local report_tfm = logs.reporter("fonts","tfm loading") --- tfmdata has also fast access to indices and unicodes --- to be checked: otf -> tfm -> tfmscaled --- --- watch out: no negative depths and negative eights permitted in regular fonts +local fonts = fonts +local handlers = fonts.handlers +local readers = fonts.readers +local constructors = fonts.constructors +local encodings = fonts.encodings ---[[ldx-- -

Here we only implement a few helper functions.

---ldx]]-- +local tfm = { } +handlers.tfm = tfm -fonts = fonts or { } -fonts.tfm = fonts.tfm or { } -fonts.ids = fonts.ids or { } +constructors.resolvevirtualtoo = false -- wil be set in font-ctx.lua -local tfm = fonts.tfm +local findbinfile = resolvers.findbinfile -fonts.loaded = fonts.loaded or { } -fonts.dontembed = fonts.dontembed or { } -fonts.triggers = fonts.triggers or { } -- brrr -fonts.initializers = fonts.initializers or { } -fonts.initializers.common = fonts.initializers.common or { } +local tfmfeatures = fonts.constructors.newfeatures("tfm") +local registertfmfeature = tfmfeatures.register -local fontdata = fonts.ids -local disc = node.id('disc') -local glyph = node.id('glyph') -local set_attribute = node.set_attribute +fonts.formats.tfm = "type1" -- we need to have at least a value here --[[ldx--

The next function encapsulates the standard loader as supplied by .

--ldx]]-- -tfm.resolve_vf = true -- false -tfm.share_base_kerns = false -- true (.5 sec slower on mk but brings down mem from 410M to 310M, beware: then script/lang share too) -tfm.mathactions = { } -tfm.fontname_mode = "fullpath" +-- this might change: not scaling and then apply features and do scaling in the +-- usual way with dummy descriptions but on the other hand .. we no longer use +-- tfm so why bother -tfm.enhance = tfm.enhance or function() end +-- ofm directive blocks local path search unless set; btw, in context we +-- don't support ofm files anyway as this format is obsolete -function tfm.read_from_tfm(specification) - local fname, tfmdata = specification.filename or "", nil - if fname ~= "" then - if trace_defining then - logs.report("define font","loading tfm file %s at size %s",fname,specification.size) - end - tfmdata = font.read_tfm(fname,specification.size) -- not cached, fast enough - if tfmdata then - tfmdata.descriptions = tfmdata.descriptions or { } - if tfm.resolve_vf then - fonts.logger.save(tfmdata,file.extname(fname),specification) -- strange, why here - fname = resolvers.findbinfile(specification.name, 'ovf') - if fname and fname ~= "" then - local vfdata = font.read_vf(fname,specification.size) -- not cached, fast enough - if vfdata then - local chars = tfmdata.characters - for k,v in next, vfdata.characters do - chars[k].commands = v.commands - end - tfmdata.type = 'virtual' - tfmdata.fonts = vfdata.fonts - end - end - end - tfm.enhance(tfmdata,specification) - end - elseif trace_defining then - logs.report("define font","loading tfm with name %s fails",specification.name) - end - return tfmdata -end - ---[[ldx-- -

We need to normalize the scale factor (in scaled points). This has to -do with the fact that uses a negative multiple of 1000 as -a signal for a font scaled based on the design size.

---ldx]]-- - -local factors = { - pt = 65536.0, - bp = 65781.8, -} - -function tfm.setfactor(f) - tfm.factor = factors[f or 'pt'] or factors.pt -end - -tfm.setfactor() - -function tfm.scaled(scaledpoints, designsize) -- handles designsize in sp as well - if scaledpoints < 0 then - if designsize then - if designsize > tfm.factor then -- or just 1000 / when? mp? - return (- scaledpoints/1000) * designsize -- sp's - else - return (- scaledpoints/1000) * designsize * tfm.factor - end - else - return (- scaledpoints/1000) * 10 * tfm.factor - end - else - return scaledpoints - end -end - ---[[ldx-- -

Before a font is passed to we scale it. Here we also need -to scale virtual characters.

---ldx]]-- - -function tfm.get_virtual_id(tfmdata) - -- since we don't know the id yet, we use 0 as signal - if not tfmdata.fonts then - tfmdata.type = "virtual" - tfmdata.fonts = { { id = 0 } } - return 1 +function tfm.setfeatures(tfmdata,features) + local okay = constructors.initializefeatures("tfm",tfmdata,features,trace_features,report_tfm) + if okay then + return constructors.collectprocessors("tfm",tfmdata,features,trace_features,report_tfm) else - tfmdata.fonts[#tfmdata.fonts+1] = { id = 0 } - return #tfmdata.fonts - end -end - -function tfm.check_virtual_id(tfmdata, id) - if tfmdata and tfmdata.type == "virtual" then - if not tfmdata.fonts or #tfmdata.fonts == 0 then - tfmdata.type, tfmdata.fonts = "real", nil - else - local vfonts = tfmdata.fonts - for f=1,#vfonts do - local fnt = vfonts[f] - if fnt.id and fnt.id == 0 then - fnt.id = id - end - end - end + return { } -- will become false end end ---[[ldx-- -

Beware, the boundingbox is passed as reference so we may not overwrite it -in the process; numbers are of course copies. Here 65536 equals 1pt. (Due to -excessive memory usage in CJK fonts, we no longer pass the boundingbox.)

---ldx]]-- - -fonts.trace_scaling = false - --- the following hack costs a bit of runtime but safes memory --- --- basekerns are scaled and will be hashed by table id --- sharedkerns are unscaled and are be hashed by concatenated indexes - ---~ function tfm.check_base_kerns(tfmdata) ---~ if tfm.share_base_kerns then ---~ local sharedkerns = tfmdata.sharedkerns ---~ if sharedkerns then ---~ local basekerns = { } ---~ tfmdata.basekerns = basekerns ---~ return sharedkerns, basekerns ---~ end ---~ end ---~ return nil, nil ---~ end - ---~ function tfm.prepare_base_kerns(tfmdata) ---~ if tfm.share_base_kerns and not tfmdata.sharedkerns then ---~ local sharedkerns = { } ---~ tfmdata.sharedkerns = sharedkerns ---~ for u, chr in next, tfmdata.characters do ---~ local kerns = chr.kerns ---~ if kerns then ---~ local hash = concat(sortedkeys(kerns), " ") ---~ local base = sharedkerns[hash] ---~ if not base then ---~ sharedkerns[hash] = kerns ---~ else ---~ chr.kerns = base ---~ end ---~ end ---~ end ---~ end ---~ end - --- we can have cache scaled characters when we are in node mode and don't have --- protruding and expansion: hash == fullname @ size @ protruding @ expansion --- but in practice (except from mk) the otf hash will be enough already so it --- makes no sense to mess up the code now - -local charactercache = { } - --- The scaler is only used for otf and afm and virtual fonts. If --- a virtual font has italic correction make sure to set the --- has_italic flag. Some more flags will be added in the future. - -function tfm.calculate_scale(tfmtable, scaledpoints, relativeid) - if scaledpoints < 0 then - scaledpoints = (- scaledpoints/1000) * tfmtable.designsize -- already in sp - end - local units = tfmtable.units or 1000 - local delta = scaledpoints/units -- brr, some open type fonts have 2048 - return scaledpoints, delta, units -end - -function tfm.do_scale(tfmtable, scaledpoints, relativeid) - -- tfm.prepare_base_kerns(tfmtable) -- optimalization - local t = { } -- the new table - local scaledpoints, delta, units = tfm.calculate_scale(tfmtable, scaledpoints, relativeid) - t.units_per_em = units or 1000 - local hdelta, vdelta = delta, delta - -- unicoded unique descriptions shared cidinfo characters changed parameters indices - for k,v in next, tfmtable do - if type(v) == "table" then - -- print(k) - else - t[k] = v - end - end - local extend_factor = tfmtable.extend_factor or 0 - if extend_factor ~= 0 and extend_factor ~= 1 then - hdelta = hdelta * extend_factor - t.extend = extend_factor * 1000 - else - t.extend = 1000 - end - local slant_factor = tfmtable.slant_factor or 0 - if slant_factor ~= 0 then - t.slant = slant_factor * 1000 - else - t.slant = 0 - end - -- status - local isvirtual = tfmtable.type == "virtual" or tfmtable.virtualized - local hasmath = (tfmtable.math_parameters ~= nil and next(tfmtable.math_parameters) ~= nil) or (tfmtable.MathConstants ~= nil and next(tfmtable.MathConstants) ~= nil) - local nodemode = tfmtable.mode == "node" - local hasquality = tfmtable.auto_expand or tfmtable.auto_protrude - local hasitalic = tfmtable.has_italic - -- - t.parameters = { } - t.characters = { } - t.MathConstants = { } - -- fast access - local descriptions = tfmtable.descriptions or { } - t.unicodes = tfmtable.unicodes - t.indices = tfmtable.indices - t.marks = tfmtable.marks -t.goodies = tfmtable.goodies -t.colorscheme = tfmtable.colorscheme ---~ t.embedding = tfmtable.embedding - t.descriptions = descriptions - if tfmtable.fonts then - t.fonts = table.fastcopy(tfmtable.fonts) -- hm also at the end - end - local tp = t.parameters - local mp = t.math_parameters - local tfmp = tfmtable.parameters -- let's check for indexes - -- - tp.slant = (tfmp.slant or tfmp[1] or 0) - tp.space = (tfmp.space or tfmp[2] or 0)*hdelta - tp.space_stretch = (tfmp.space_stretch or tfmp[3] or 0)*hdelta - tp.space_shrink = (tfmp.space_shrink or tfmp[4] or 0)*hdelta - tp.x_height = (tfmp.x_height or tfmp[5] or 0)*vdelta - tp.quad = (tfmp.quad or tfmp[6] or 0)*hdelta - tp.extra_space = (tfmp.extra_space or tfmp[7] or 0)*hdelta - local protrusionfactor = (tp.quad ~= 0 and 1000/tp.quad) or 0 - local tc = t.characters - local characters = tfmtable.characters - local nameneeded = not tfmtable.shared.otfdata --hack - local changed = tfmtable.changed or { } -- for base mode - local ischanged = changed and next(changed) - local indices = tfmtable.indices - local luatex = tfmtable.luatex - local tounicode = luatex and luatex.tounicode - local defaultwidth = luatex and luatex.defaultwidth or 0 - local defaultheight = luatex and luatex.defaultheight or 0 - local defaultdepth = luatex and luatex.defaultdepth or 0 - -- experimental, sharing kerns (unscaled and scaled) saves memory - -- local sharedkerns, basekerns = tfm.check_base_kerns(tfmtable) - -- loop over descriptions (afm and otf have descriptions, tfm not) - -- there is no need (yet) to assign a value to chr.tonunicode - local scaledwidth = defaultwidth * hdelta - local scaledheight = defaultheight * vdelta - local scaleddepth = defaultdepth * vdelta - local stackmath = tfmtable.ignore_stack_math ~= true - local private = fonts.private - local sharedkerns = { } - for k,v in next, characters do - local chr, description, index - if ischanged then - -- basemode hack - local c = changed[k] - if c then - description = descriptions[c] or v - v = characters[c] or v - index = (indices and indices[c]) or c - else - description = descriptions[k] or v - index = (indices and indices[k]) or k - end - else - description = descriptions[k] or v - index = (indices and indices[k]) or k - end - local width = description.width - local height = description.height - local depth = description.depth - if width then width = hdelta*width else width = scaledwidth end - if height then height = vdelta*height else height = scaledheight end - -- if depth then depth = vdelta*depth else depth = scaleddepth end - if depth and depth ~= 0 then - depth = delta*depth - if nameneeded then - chr = { - name = description.name, - index = index, - height = height, - depth = depth, - width = width, - } - else - chr = { - index = index, - height = height, - depth = depth, - width = width, - } - end - else - -- this saves a little bit of memory time and memory, esp for big cjk fonts - if nameneeded then - chr = { - name = description.name, - index = index, - height = height, - width = width, - } - else - chr = { - index = index, - height = height, - width = width, - } - end - end - -- if trace_scaling then - -- logs.report("define font","t=%s, u=%s, i=%s, n=%s c=%s",k,chr.tounicode or k,description.index,description.name or '-',description.class or '-') - -- end - if tounicode then - local tu = tounicode[index] -- nb: index! - if tu then - chr.tounicode = tu - end - end - if hasquality then - -- we could move these calculations elsewhere (saves calculations) - local ve = v.expansion_factor - if ve then - chr.expansion_factor = ve*1000 -- expansionfactor, hm, can happen elsewhere - end - local vl = v.left_protruding - if vl then - chr.left_protruding = protrusionfactor*width*vl - end - local vr = v.right_protruding - if vr then - chr.right_protruding = protrusionfactor*width*vr - end - end - -- todo: hasitalic - if hasitalic then - local vi = description.italic or v.italic - if vi and vi ~= 0 then - chr.italic = vi*hdelta - end - end - -- to be tested - if hasmath then - -- todo, just operate on descriptions.math - local vn = v.next - if vn then - chr.next = vn - else - local vv = v.vert_variants - if vv then - local t = { } - for i=1,#vv do - local vvi = vv[i] - t[i] = { - ["start"] = (vvi["start"] or 0)*vdelta, - ["end"] = (vvi["end"] or 0)*vdelta, - ["advance"] = (vvi["advance"] or 0)*vdelta, - ["extender"] = vvi["extender"], - ["glyph"] = vvi["glyph"], - } - end - chr.vert_variants = t - --~ local ic = v.vert_italic_correction - --~ if ic then - --~ chr.italic = ic * hdelta - --~ print(format("0x%05X -> %s",k,chr.italic)) - --~ end - else - local hv = v.horiz_variants - if hv then - local t = { } - for i=1,#hv do - local hvi = hv[i] - t[i] = { - ["start"] = (hvi["start"] or 0)*hdelta, - ["end"] = (hvi["end"] or 0)*hdelta, - ["advance"] = (hvi["advance"] or 0)*hdelta, - ["extender"] = hvi["extender"], - ["glyph"] = hvi["glyph"], - } - end - chr.horiz_variants = t +local function read_from_tfm(specification) + local filename = specification.filename + local size = specification.size + if trace_defining then + report_defining("loading tfm file %s at size %s",filename,size) + end + local tfmdata = font.read_tfm(filename,size) -- not cached, fast enough + if tfmdata then + local features = specification.features and specification.features.normal or { } + local properties = tfmdata.properties or { } + local parameters = tfmdata.parameters or { } + local shared = tfmdata.shared or { } + properties.name = tfmdata.name + properties.fontname = tfmdata.fontname + properties.psname = tfmdata.psname + properties.filename = specification.filename + parameters.size = size + shared.rawdata = { } + shared.features = features + shared.processes = next(features) and tfm.setfeatures(tfmdata,features) or nil + -- + tfmdata.properties = properties + tfmdata.parameters = parameters + tfmdata.shared = shared + -- + if constructors.resolvevirtualtoo then + fonts.loggers.register(tfmdata,file.extname(filename),specification) -- strange, why here + local vfname = findbinfile(specification.name, 'ovf') + if vfname and vfname ~= "" then + local vfdata = font.read_vf(vfname,size) -- not cached, fast enough + if vfdata then + local chars = tfmdata.characters + for k,v in next, vfdata.characters do + chars[k].commands = v.commands end - end - end - local vt = description.top_accent - if vt then - chr.top_accent = vdelta*vt - end - if stackmath then - local mk = v.mathkerns - if mk then - local kerns = { } - local v = mk.top_right if v then local k = { } for i=1,#v do local vi = v[i] - k[i] = { height = vdelta*vi.height, kern = vdelta*vi.kern } - end kerns.top_right = k end - local v = mk.top_left if v then local k = { } for i=1,#v do local vi = v[i] - k[i] = { height = vdelta*vi.height, kern = vdelta*vi.kern } - end kerns.top_left = k end - local v = mk.bottom_left if v then local k = { } for i=1,#v do local vi = v[i] - k[i] = { height = vdelta*vi.height, kern = vdelta*vi.kern } - end kerns.bottom_left = k end - local v = mk.bottom_right if v then local k = { } for i=1,#v do local vi = v[i] - k[i] = { height = vdelta*vi.height, kern = vdelta*vi.kern } - end kerns.bottom_right = k end - chr.mathkern = kerns -- singular + properties.virtualized = true + tfmdata.fonts = vfdata.fonts end end end - if not nodemode then - local vk = v.kerns - if vk then - --~ if sharedkerns then - --~ local base = basekerns[vk] -- hashed by table id, not content - --~ if not base then - --~ base = {} - --~ for k,v in next, vk do base[k] = v*hdelta end - --~ basekerns[vk] = base - --~ end - --~ chr.kerns = base - --~ else - --~ local tt = {} - --~ for k,v in next, vk do tt[k] = v*hdelta end - --~ chr.kerns = tt - --~ end - local s = sharedkerns[vk] - if not s then - s = { } - for k,v in next, vk do s[k] = v*hdelta end - sharedkerns[vk] = s - end - chr.kerns = s - end - local vl = v.ligatures - if vl then - if true then - chr.ligatures = vl -- shared - else - local tt = { } - for i,l in next, vl do - tt[i] = l - end - chr.ligatures = tt - end - end + -- + if next(features) then + constructors.applymanipulators("tfm",tfmdata,specification.features.normal,trace_features,report_tfm) end - if isvirtual then - local vc = v.commands - if vc then - -- we assume non scaled commands here - -- tricky .. we need to scale pseudo math glyphs too - -- which is why we deal with rules too - local ok = false - for i=1,#vc do - local key = vc[i][1] - if key == "right" or key == "down" then - ok = true - break - end - end - if ok then - local tt = { } - for i=1,#vc do - local ivc = vc[i] - local key = ivc[1] - if key == "right" then - tt[#tt+1] = { key, ivc[2]*hdelta } - elseif key == "down" then - tt[#tt+1] = { key, ivc[2]*vdelta } - elseif key == "rule" then - tt[#tt+1] = { key, ivc[2]*vdelta, ivc[3]*hdelta } - else -- not comment - tt[#tt+1] = ivc -- shared since in cache and untouched - end - end - chr.commands = tt - else - chr.commands = vc - end + if not features.encoding then + local encoding, filename = match(properties.filename,"^(.-)%-(.*)$") -- context: encoding-name.* + if filename and encoding and encodings.known[encoding] then + features.encoding = encoding end end - tc[k] = chr - end - -- t.encodingbytes, t.filename, t.fullname, t.name: elsewhere - t.size = scaledpoints - t.factor = delta - t.hfactor = hdelta - t.vfactor = vdelta - if t.fonts then - t.fonts = table.fastcopy(t.fonts) -- maybe we virtualize more afterwards - end - if hasmath then - -- mathematics.extras.copy(t) -- can be done elsewhere if needed - local ma = tfm.mathactions - for i=1,#ma do - ma[i](t,tfmtable,delta,hdelta,vdelta) -- what delta? - end - end - -- needed for \high cum suis - local tpx = tp.x_height - if hasmath then - if not tp[13] then tp[13] = .86*tpx end -- mathsupdisplay - if not tp[14] then tp[14] = .86*tpx end -- mathsupnormal - if not tp[15] then tp[15] = .86*tpx end -- mathsupcramped - if not tp[16] then tp[16] = .48*tpx end -- mathsubnormal - if not tp[17] then tp[17] = .48*tpx end -- mathsubcombined - if not tp[22] then tp[22] = 0 end -- mathaxisheight - if t.MathConstants then t.MathConstants.AccentBaseHeight = nil end -- safeguard - end - t.tounicode = 1 - t.cidinfo = tfmtable.cidinfo - -- we have t.name=metricfile and t.fullname=RealName and t.filename=diskfilename - -- when collapsing fonts, luatex looks as both t.name and t.fullname as ttc files - -- can have multiple subfonts - if hasmath then - if trace_defining then - logs.report("define font","math enabled for: name '%s', fullname: '%s', filename: '%s'",t.name or "noname",t.fullname or "nofullname",t.filename or "nofilename") - end - else - if trace_defining then - logs.report("define font","math disabled for: name '%s', fullname: '%s', filename: '%s'",t.name or "noname",t.fullname or "nofullname",t.filename or "nofilename") - end - t.nomath, t.MathConstants = true, nil - end - if not t.psname then - -- name used in pdf file as well as for selecting subfont in ttc/dfont - t.psname = t.fontname or (t.fullname and fonts.names.cleanname(t.fullname)) + -- + return tfmdata end - if trace_defining then - logs.report("define font","used for accesing subfont: '%s'",t.psname or "nopsname") - logs.report("define font","used for subsetting: '%s'",t.fontname or "nofontname") - end ---~ print(t.fontname,table.serialize(t.MathConstants)) - return t, delta end ---[[ldx-- -

The reason why the scaler is split, is that for a while we experimented -with a helper function. However, in practice the calls are too slow to -make this profitable and the based variant was just faster. A days -wasted day but an experience richer.

---ldx]]-- - -tfm.auto_cleanup = true - -local lastfont = nil - --- we can get rid of the tfm instance when we have fast access to the --- scaled character dimensions at the tex end, e.g. a fontobject.width --- --- flushing the kern and ligature tables from memory saves a lot (only --- base mode) but it complicates vf building where the new characters --- demand this data .. solution: functions that access them - -function tfm.cleanup_table(tfmdata) -- we need a cleanup callback, now we miss the last one - if tfm.auto_cleanup then -- ok, we can hook this into everyshipout or so ... todo - if tfmdata.type == 'virtual' or tfmdata.virtualized then - for k, v in next, tfmdata.characters do - if v.commands then v.commands = nil end - -- if v.kerns then v.kerns = nil end - end - else - -- for k, v in next, tfmdata.characters do - -- if v.kerns then v.kerns = nil end - -- end - end +local function check_tfm(specification,fullname) -- we could split up like afm/otf + local foundname = findbinfile(fullname, 'tfm') or "" + if foundname == "" then + foundname = findbinfile(fullname, 'ofm') or "" -- not needed in context end -end - -function tfm.cleanup(tfmdata) -- we need a cleanup callback, now we miss the last one -end - -function tfm.scale(tfmtable, scaledpoints, relativeid) - local t, factor = tfm.do_scale(tfmtable, scaledpoints, relativeid) - t.factor = factor - t.ascender = factor*(tfmtable.ascender or 0) - t.descender = factor*(tfmtable.descender or 0) - t.shared = tfmtable.shared or { } - t.unique = table.fastcopy(tfmtable.unique or {}) ---~ print("scaling", t.name, t.factor) -- , tfm.hash_features(tfmtable.specification)) - tfm.cleanup(t) - return t -end - ---[[ldx-- -

Analyzers run per script and/or language and are needed in order to -process features right.

---ldx]]-- - -fonts.analyzers = fonts.analyzers or { } -fonts.analyzers.aux = fonts.analyzers.aux or { } -fonts.analyzers.methods = fonts.analyzers.methods or { } -fonts.analyzers.initializers = fonts.analyzers.initializers or { } - --- todo: analyzers per script/lang, cross font, so we need an font id hash -> script --- e.g. latin -> hyphenate, arab -> 1/2/3 analyze - --- an example analyzer (should move to font-ota.lua) - -local state = attributes.private('state') - -function fonts.analyzers.aux.setstate(head,font) - local tfmdata = fontdata[font] - local characters = tfmdata.characters - local descriptions = tfmdata.descriptions - local first, last, current, n, done = nil, nil, head, 0, false -- maybe make n boolean - while current do - local id = current.id - if id == glyph and current.font == font then - local d = descriptions[current.char] - if d then - if d.class == "mark" then - done = true - set_attribute(current,state,5) -- mark - elseif n == 0 then - first, last, n = current, current, 1 - set_attribute(current,state,1) -- init - else - last, n = current, n+1 - set_attribute(current,state,2) -- medi - end - else -- finish - if first and first == last then - set_attribute(last,state,4) -- isol - elseif last then - set_attribute(last,state,3) -- fina - end - first, last, n = nil, nil, 0 - end - elseif id == disc then - -- always in the middle - set_attribute(current,state,2) -- midi - last = current - else -- finish - if first and first == last then - set_attribute(last,state,4) -- isol - elseif last then - set_attribute(last,state,3) -- fina - end - first, last, n = nil, nil, 0 - end - current = current.next + if foundname == "" then + foundname = fonts.names.getfilename(fullname,"tfm") end - if first and first == last then - set_attribute(last,state,4) -- isol - elseif last then - set_attribute(last,state,3) -- fina + if foundname ~= "" then + specification.filename = foundname + specification.format = "ofm" + return read_from_tfm(specification) + elseif trace_defining then + report_defining("loading tfm with name %s fails",specification.name) end - return head, done -end - -function tfm.replacements(tfm,value) - -- tfm.characters[0x0022] = table.fastcopy(tfm.characters[0x201D]) - -- tfm.characters[0x0027] = table.fastcopy(tfm.characters[0x2019]) - -- tfm.characters[0x0060] = table.fastcopy(tfm.characters[0x2018]) - -- tfm.characters[0x0022] = tfm.characters[0x201D] - tfm.characters[0x0027] = tfm.characters[0x2019] - -- tfm.characters[0x0060] = tfm.characters[0x2018] end --- checking +readers.check_tfm = check_tfm -function tfm.checked_filename(metadata,whatever) - local foundfilename = metadata.foundfilename - if not foundfilename then - local askedfilename = metadata.filename or "" - if askedfilename ~= "" then - foundfilename = resolvers.findbinfile(askedfilename,"") or "" - if foundfilename == "" then - logs.report("fonts","source file '%s' is not found",askedfilename) - foundfilename = resolvers.findbinfile(file.basename(askedfilename),"") or "" - if foundfilename ~= "" then - logs.report("fonts","using source file '%s' (cache mismatch)",foundfilename) - end - end - elseif whatever then - logs.report("fonts","no source file for '%s'",whatever) - foundfilename = "" +function readers.tfm(specification) + local fullname = specification.filename or "" + if fullname == "" then + local forced = specification.forced or "" + if forced ~= "" then + fullname = specification.name .. "." .. forced + else + fullname = specification.name end - metadata.foundfilename = foundfilename - -- logs.report("fonts","using source file '%s'",foundfilename) end - return foundfilename + return check_tfm(specification,fullname) end - --- status info - -statistics.register("fonts load time", function() - return statistics.elapsedseconds(fonts) -end) diff --git a/Master/texmf-dist/tex/context/base/font-tra.mkiv b/Master/texmf-dist/tex/context/base/font-tra.mkiv index e47c8c49d48..37ea4541a0f 100644 --- a/Master/texmf-dist/tex/context/base/font-tra.mkiv +++ b/Master/texmf-dist/tex/context/base/font-tra.mkiv @@ -21,7 +21,7 @@ %D \doiffontpresentelse{adam-lindsay-modern-serif}{YES}{NO} %D \stoptyping -\def\doiffontpresentelse#1{\ctxlua{commands.doifelse(fonts.names.exists("#1"))}} +\def\doiffontpresentelse#1{\ctxcommand{doifelse(fonts.names.exists("#1"))}} % experimental, maybe this becomes a module @@ -40,10 +40,10 @@ {\ctxlua{nodes.tracers.steppers.glyphs(\number\otfcollector,#1)}% \unhbox\otfcollector} -\def\otfstepcharcommand#1#2% font char +\def\otfstepcharcommand#1#2#3% font char class {\removeunwantedspaces \hskip.5em plus .125em\relax - U+\hexnumber{#2}:\ruledhbox{\ctxlua{nodes.tracers.fontchar(#1,#2)}}% + \doif{#3}{mark}{\underbar}{U+\hexnumber{#2}}:\ruledhbox{\ctxlua{nodes.tracers.fontchar(#1,#2)}}% \hskip.5em plus .125em\relax} \def\otfstepmessagecommand#1#2% @@ -58,10 +58,10 @@ \blank} \def\showotfstepchars#1% - {\ctxlua{nodes.tracers.steppers.codes(#1,\!!bs\detokenize{\otfstepcharcommand}\!!es)}} + {\ctxlua{nodes.tracers.steppers.codes(#1,"otfstepcharcommand")}} \def\showotfstepmessages#1% - {\ctxlua{nodes.tracers.steppers.messages(#1,\!!bs\detokenize{\otfstepmessagecommand}\!!es,true)}} + {\ctxlua{nodes.tracers.steppers.messages(#1,"otfstepmessagecommand",true)}} \def\showotfstepfeatures {\ctxlua{nodes.tracers.steppers.features()}} diff --git a/Master/texmf-dist/tex/context/base/font-uni.mkiv b/Master/texmf-dist/tex/context/base/font-uni.mkiv index 40ab75ed6c2..8fb5d099691 100644 --- a/Master/texmf-dist/tex/context/base/font-uni.mkiv +++ b/Master/texmf-dist/tex/context/base/font-uni.mkiv @@ -19,7 +19,8 @@ \unprotect -\def\uchar#1#2{\ctxlua{commands.uchar(\number#1,\number#2)}} +%def\uchar#1#2{\ctxcommand{uchar(,)}} +\def\uchar#1#2{\cldcontext{utf.char(\number\numexpr#1*256+#2\relax)}} \let\uc\uchar diff --git a/Master/texmf-dist/tex/context/base/font-vf.lua b/Master/texmf-dist/tex/context/base/font-vf.lua index 4f99c47b94b..287d073d6bd 100644 --- a/Master/texmf-dist/tex/context/base/font-vf.lua +++ b/Master/texmf-dist/tex/context/base/font-vf.lua @@ -11,30 +11,97 @@ if not modules then modules = { } end modules ['font-vf'] = { changes. This will change.

--ldx]]-- --- define.methods elsewhere ! +local next = next + +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex +local fastcopy = table.fastcopy + +local fonts = fonts +local constructors = fonts.constructors +local vf = { } +fonts.handlers.vf = vf + +-- general code + +function vf.find(name) + name = file.removesuffix(file.basename(name)) + if constructors.resolvevirtualtoo then + local format = fonts.loggers.format(name) + if format == 'tfm' or format == 'ofm' then + if trace_defining then + report_defining("locating vf for %s",name) + end + return findbinfile(name,"ovf") + else + if trace_defining then + report_defining("vf for %s is already taken care of",name) + end + return nil -- "" + end + else + if trace_defining then + report_defining("locating vf for %s",name) + end + return findbinfile(name,"ovf") + end +end + +--[[ldx-- +

We overload the reader.

+--ldx]]-- + +callbacks.register('find_vf_file', vf.find, "locating virtual fonts, insofar needed") -- not that relevant any more -fonts = fonts or { } -fonts.vf = fonts.vf or { } +-- specific code (will move to other module) -local vf = fonts.vf -local tfm = fonts.tfm +local definers = fonts.definers +local methods = definers.methods -fonts.define = fonts.define or { } -fonts.define.methods = fonts.define.methods or { } +local variants = allocate() +local combinations = { } +local combiner = { } +local whatever = allocate() +local helpers = allocate() +local predefined = allocate { + dummy = { "comment" }, + push = { "push" }, + pop = { "pop" }, +} + +methods.variants = variants -- todo .. wrong namespace +vf.combinations = combinations +vf.combiner = combiner +vf.whatever = whatever +vf.helpers = helpers +vf.predefined = predefined + +setmetatableindex(whatever, function(t,k) local v = { } t[k] = v return v end) -vf.combinations = vf.combinations or { } -vf.aux = vf.aux or { } -vf.aux.combine = vf.aux.combine or { } +local function checkparameters(g,f) + if f and g and not g.parameters and #g.fonts > 0 then + local p = { } + for k,v in next, f.parameters do + p[k] = v + end + g.parameters = p + setmetatable(p, getmetatable(f.parameters)) + end +end -function fonts.define.methods.install(tag, rules) +function methods.install(tag, rules) vf.combinations[tag] = rules - fonts.define.methods[tag] = function(specification) + variants[tag] = function(specification) return vf.combine(specification,tag) end end -function vf.aux.combine.assign(g, name, from, to, start, force) - local f, id = vf.aux.combine.load(g,name) +local function combine_load(g,name) + return constructors.readanddefine(name or g.specification.name,g.specification.size) +end + +local function combine_assign(g, name, from, to, start, force) + local f, id = combine_load(g,name) if f and id then -- optimize for whole range, then just g = f if not from then from, to = 0, 0xFF00 end @@ -46,36 +113,26 @@ function vf.aux.combine.assign(g, name, from, to, start, force) g.fonts[hn] = { id = id } -- no need to be sparse for i=from,to do if fc[i] and (force or not gc[i]) then - gc[i] = table.fastcopy(fc[i]) -- can be optimized + gc[i] = fastcopy(fc[i],true) -- can be optimized gc[i].commands = { { 'slot', hn, start } } gd[i] = fd[i] end start = start + 1 end - if not g.parameters and #g.fonts > 0 then -- share this code ! - g.parameters = table.fastcopy(f.parameters) - g.italicangle = f.italicangle - g.ascender = f.ascender - g.descender = f.descender - g.factor = f.factor -- brrr - end + checkparameters(g,f) end end -function vf.aux.combine.process(g,list) +local function combine_process(g,list) if list then for _,v in next, list do - (vf.aux.combine.commands[v[1]] or nop)(g,v) + (combiner.commands[v[1]] or nop)(g,v) end end end -function vf.aux.combine.load(g,name) - return tfm.read_and_define(name or g.specification.name,g.specification.size) -end - -function vf.aux.combine.names(g,name,force) - local f, id = tfm.read_and_define(name,g.specification.size) +local function combine_names(g,name,force) + local f, id = constructors.readanddefine(name,g.specification.size) if f and id then local fc, gc = f.characters, g.characters local fd, gd = f.descriptions, g.descriptions @@ -83,131 +140,64 @@ function vf.aux.combine.names(g,name,force) local hn = #g.fonts for k, v in next, fc do if force or not gc[k] then - gc[k] = table.fastcopy(v) + gc[k] = fastcopy(v,true) gc[k].commands = { { 'slot', hn, k } } gd[i] = fd[i] end end - if not g.parameters and #g.fonts > 0 then -- share this code ! - g.parameters = table.fastcopy(f.parameters) - g.italicangle = f.italicangle - g.ascender = f.ascender - g.descender = f.descender - g.factor = f.factor -- brrr - end + checkparameters(g,f) end end -vf.aux.combine.commands = { - ["initialize"] = function(g,v) vf.aux.combine.assign (g,g.name) end, - ["include-method"] = function(g,v) vf.aux.combine.process (g,vf.combinations[v[2]]) end, -- name - ["copy-parameters"] = function(g,v) vf.aux.combine.parameters(g,v[2]) end, -- name - ["copy-range"] = function(g,v) vf.aux.combine.assign (g,v[2],v[3],v[4],v[5],true) end, -- name, from-start, from-end, to-start - ["copy-char"] = function(g,v) vf.aux.combine.assign (g,v[2],v[3],v[3],v[4],true) end, -- name, from, to - ["fallback-range"] = function(g,v) vf.aux.combine.assign (g,v[2],v[3],v[4],v[5],false) end, -- name, from-start, from-end, to-start - ["fallback-char"] = function(g,v) vf.aux.combine.assign (g,v[2],v[3],v[3],v[4],false) end, -- name, from, to - ["copy_names"] = function(g,v) vf.aux.combine.names (g,v[2],true) end, - ["fallback_names"] = function(g,v) vf.aux.combine.names (g,v[2],false) end, -} - -function vf.combine(specification,tag) - local g = { - name = specification.name, - -- type = 'virtual', - virtualized = true, - fonts = { }, - characters = { }, - descriptions = { }, - specification = table.fastcopy(specification) - } - vf.aux.combine.process(g,vf.combinations[tag]) - return g -end - -vf.aux.combine.commands["feature"] = function(g,v) +local combine_feature = function(g,v) local key, value = v[2], v[3] if key then if value == nil then value = true end - if g.specification and g.specification.features.normal then - g.specification.features.normal[key] = value -- otf? + local specification = g.specification + if specification then + local normalfeatures = specification.features.normal + if normalfeatures then + normalfeatures[key] = value -- otf? + end end end end --- simple example with features +--~ combiner.load = combine_load +--~ combiner.assign = combine_assign +--~ combiner.process = combine_process +--~ combiner.names = combine_names +--~ combiner.feature = combine_feature + +combiner.commands = allocate { + ["initialize"] = function(g,v) combine_assign (g,g.properties.name) end, + ["include-method"] = function(g,v) combine_process (g,combinations[v[2]]) end, -- name + -- ["copy-parameters"] = function(g,v) combine_parameters(g,v[2]) end, -- name + ["copy-range"] = function(g,v) combine_assign (g,v[2],v[3],v[4],v[5],true) end, -- name, from-start, from-end, to-start + ["copy-char"] = function(g,v) combine_assign (g,v[2],v[3],v[3],v[4],true) end, -- name, from, to + ["fallback-range"] = function(g,v) combine_assign (g,v[2],v[3],v[4],v[5],false) end, -- name, from-start, from-end, to-start + ["fallback-char"] = function(g,v) combine_assign (g,v[2],v[3],v[3],v[4],false) end, -- name, from, to + ["copy-names"] = function(g,v) combine_names (g,v[2],true) end, + ["fallback-names"] = function(g,v) combine_names (g,v[2],false) end, + ["feature"] = combine_feature, +} -fonts.define.methods.install( - "ligatures", { - { "feature", "liga" } , - { "feature", "dlig" } , - { "initialize" } , +function vf.combine(specification,tag) + local g = { + name = specification.name, + properties = { + virtualized = true, + }, + fonts = { + }, + characters = { + }, + descriptions = { + }, + specification = fastcopy(specification), } -) - ---~ fonts.define.methods.install ( ---~ "ligatures-x", { ---~ { "feature", "liga" } , ---~ { "feature", "dlig" } , ---~ { "initialize" } , ---~ { "lineheight" } ---~ } ---~ ) - ---~ fonts.define.methods.install( ---~ "lmsymbol10", { ---~ { "fallback_names", "lmsy10.afm" } , ---~ { "fallback_names", "msam10.afm" } , ---~ { "fallback_names", "msbm10.afm" } ---~ } ---~ ) ---~ \font\TestFont=dummy@lmsymbol10 at 24pt - --- docu case - ---~ fonts.define.methods.install( ---~ "weird", { ---~ { "copy-range", "lmroman10-regular" } , ---~ { "copy-char", "lmroman10-regular", 65, 66 } , ---~ { "copy-range", "lmsans10-regular", 0x0100, 0x01FF } , ---~ { "copy-range", "lmtypewriter10-regular", 0x0200, 0xFF00 } , ---~ { "fallback-range", "lmtypewriter10-regular", 0x0000, 0x0200 } ---~ } ---~ ) - --- demo case -> move to module - -fonts.define.methods["demo-1"] = function(specification) - local name = specification.name -- symbolic name - local size = specification.size -- given size - local f, id = tfm.read_and_define('lmroman10-regular',size) - if f and id then - local capscale, digscale = 0.85, 0.75 - -- f.name, f.type = name, 'virtual' - f.name, f.virtualized = name, true - f.fonts = { - { id = id }, - { name = 'lmsans10-regular' , size = size*capscale }, -- forced extra name - { name = 'lmtypewriter10-regular', size = size*digscale } -- forced extra name - } - local i_is_of_category = characters.i_is_of_category - local characters, descriptions = f.characters, f.descriptions - local red = {'special','pdf: 1 0 0 rg'} - local green = {'special','pdf: 0 1 0 rg'} - local blue = {'special','pdf: 0 0 1 rg'} - local black = {'special','pdf: 0 g'} - for u,v in next, characters do - if u and i_is_of_category(u,'lu') then - v.width = capscale*v.width - v.commands = { red, {'slot',2,u}, black } - elseif u and i_is_of_category(u,'nd') then - v.width = digscale*v.width - v.commands = { blue, {'slot',3,u}, black } - else - v.commands = { green, {'slot',1,u}, black } - end - end - end - return f + combine_process(g,combinations[tag]) + return g end diff --git a/Master/texmf-dist/tex/context/base/font-xtx.lua b/Master/texmf-dist/tex/context/base/font-xtx.lua deleted file mode 100644 index eac75dd2901..00000000000 --- a/Master/texmf-dist/tex/context/base/font-xtx.lua +++ /dev/null @@ -1,122 +0,0 @@ -if not modules then modules = { } end modules ['font-xtx'] = { - version = 1.001, - comment = "companion to font-ini.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local texsprint, count = tex.sprint, tex.count -local format, concat, gmatch, match, find, lower = string.format, table.concat, string.gmatch, string.match, string.find, string.lower -local tostring, next = tostring, next -local lpegmatch = lpeg.match - -local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) - ---[[ldx-- -

Choosing a font by name and specififying its size is only part of the -game. In order to prevent complex commands, introduced -a method to pass feature information as part of the font name. At the -risk of introducing nasty parsing and compatinility problems, this -syntax was expanded over time.

- -

For the sake of users who have defined fonts using that syntax, we -will support it, but we will provide additional methods as well. -Normally users will not use this direct way, but use a more abstract -interface.

- -

The next one is the official one. However, in the plain -variant we need to support the crappy [] specification as -well and that does not work too well with the general design -of the specifier.

---ldx]]-- - ---~ function fonts.define.specify.colonized(specification) -- xetex mode ---~ local list = { } ---~ if specification.detail and specification.detail ~= "" then ---~ for v in gmatch(specification.detail,"%s*([^;]+)%s*") do ---~ local a, b = match(v,"^(%S*)%s*=%s*(%S*)$") ---~ if a and b then ---~ list[a] = b:is_boolean() ---~ if type(list[a]) == "nil" then ---~ list[a] = b ---~ end ---~ else ---~ local a, b = match(v,"^([%+%-]?)%s*(%S+)$") ---~ if a and b then ---~ list[b] = a ~= "-" ---~ end ---~ end ---~ end ---~ end ---~ specification.features.normal = list ---~ return specification ---~ end - ---~ check("oeps/BI:+a;-b;c=d") ---~ check("[oeps]/BI:+a;-b;c=d") ---~ check("file:oeps/BI:+a;-b;c=d") ---~ check("name:oeps/BI:+a;-b;c=d") - -local list = { } - -fonts.define.specify.colonized_default_lookup = "file" - -local function issome () list.lookup = fonts.define.specify.colonized_default_lookup end -local function isfile () list.lookup = 'file' end -local function isname () list.lookup = 'name' end -local function thename(s) list.name = s end -local function issub (v) list.sub = v end -local function iscrap (s) list.crap = string.lower(s) end -local function istrue (s) list[s] = 'yes' end -local function isfalse(s) list[s] = 'no' end -local function iskey (k,v) list[k] = v end - -local function istrue (s) list[s] = true end -local function isfalse(s) list[s] = false end - -local spaces = lpeg.P(" ")^0 -local namespec = (1-lpeg.S("/:("))^0 -- was: (1-lpeg.S("/: ("))^0 -local crapspec = spaces * lpeg.P("/") * (((1-lpeg.P(":"))^0)/iscrap) * spaces -local filename = (lpeg.P("file:")/isfile * (namespec/thename)) + (lpeg.P("[") * lpeg.P(true)/isname * (((1-lpeg.P("]"))^0)/thename) * lpeg.P("]")) -local fontname = (lpeg.P("name:")/isname * (namespec/thename)) + lpeg.P(true)/issome * (namespec/thename) -local sometext = (lpeg.R("az","AZ","09") + lpeg.S("+-."))^1 -local truevalue = lpeg.P("+") * spaces * (sometext/istrue) -local falsevalue = lpeg.P("-") * spaces * (sometext/isfalse) -local keyvalue = (lpeg.C(sometext) * spaces * lpeg.P("=") * spaces * lpeg.C(sometext))/iskey -local somevalue = sometext/istrue -local subvalue = lpeg.P("(") * (lpeg.C(lpeg.P(1-lpeg.S("()"))^1)/issub) * lpeg.P(")") -- for Kim -local option = spaces * (keyvalue + falsevalue + truevalue + somevalue) * spaces -local options = lpeg.P(":") * spaces * (lpeg.P(";")^0 * option)^0 -local pattern = (filename + fontname) * subvalue^0 * crapspec^0 * options^0 - -local normalize_meanings = fonts.otf.meanings.normalize - -function fonts.define.specify.colonized(specification) -- xetex mode - list = { } - lpegmatch(pattern,specification.specification) ---~ for k, v in next, list do ---~ list[k] = v:is_boolean() ---~ if type(list[a]) == "nil" then ---~ list[k] = v ---~ end ---~ end - list.crap = nil -- style not supported, maybe some day - if list.name then - specification.name = list.name - list.name = nil - end - if list.lookup then - specification.lookup = list.lookup - list.lookup = nil - end - if list.sub then - specification.sub = list.sub - list.sub = nil - end --- specification.features.normal = list - specification.features.normal = normalize_meanings(list) - return specification -end - -fonts.define.register_split(":", fonts.define.specify.colonized) diff --git a/Master/texmf-dist/tex/context/base/font-xtx.mkii b/Master/texmf-dist/tex/context/base/font-xtx.mkii index d6086b44e64..9930124be20 100644 --- a/Master/texmf-dist/tex/context/base/font-xtx.mkii +++ b/Master/texmf-dist/tex/context/base/font-xtx.mkii @@ -19,8 +19,95 @@ \unprotect -%D Loading: +%D Features: + +% \definefontfeature[default] [liga=yes,texligatures=yes,texquotes=yes] +% \definefontfeature[default-caps][liga=yes,texligatures=yes,texquotes=yes,smcp=yes,script=latn] +% +% \starttypescript [serif] [palatino-nova-regular] [name] +% \definefontsynonym[Serif] [palatinonova-regular][features=default] +% \definefontsynonym[SerifCaps][palatinonova-regular][features=default-caps] % also sets Serif +% \stoptypescript +% +% \starttypescript [serif] [palatino-nova-regular] [name] +% \definefontsynonym[Serif] [palatinonova-regular*default] +% \definefontsynonym[SerifCaps] [palatinonova-regular*default-caps] +% \stoptypescript + +% \definetypeface[mainface][rm][serif][palatino-nova-regular][default] \setupbodyfont[mainface] +% +% \starttext +% ``Test'' -- --- ff fi fl \sc ``Test'' -- --- ff fi fl +% \stoptext + +% \starttext +% \definefont +% [blabla] +% [name:Latin Modern Something] +% \definefont +% [blabla] +% [file:texnansi-lmr10] +% \blabla test +% \definefont +% [blabla] +% [texnansi-lmtt10] +% \blabla test +% \stoptext + +\def\definefontfeature + {\dotripleargument\dodefinefontfeature} + +\def\dododefinefontfeature#1% + {\edef\!!stringa{\ifx\!!stringa\empty\else\!!stringa,\fi\executeifdefined{\??fa#1}\empty}} + +\def\dodefinefontfeature[#1][#2][#3]% + {\doifassignmentelse{#2} + {\setevalue{\??fa#1}{#2}} + {\let\!!stringa\empty + \processcommalist[#2]\dododefinefontfeature + \setevalue{\??fa#1}{\ifx\!!stringa\empty\else\!!stringa,\fi#3}}} + +\definefontfeature + [default] + [liga=yes,kern=yes,tlig=yes,trep=yes] % texligatures=yes,texquotes=yes + +\definefontfeature + [smallcaps] + [liga=yes,kern=yes,tlig=yes,trep=yes,smcp=yes] % texligatures=yes,texquotes=yes + +\definefontfeature + [oldstyle] + [liga=yes,kern=yes,tlig=yes,trep=yes,onum=yes] % texligatures=yes,texquotes=yes + +\definefontfeature % no calt + [arabic] + [language=dflt,script=arab, + init=yes,medi=yes,fina=yes,isol=yes, + liga=yes,dlig=yes,rlig=yes,clig=yes, + mark=yes,mkmk=yes,kern=yes,curs=yes] + +\definefontfeature + [none] + [features=no] + +%D Overloaded: + +\def\getfontfileparameters#1% can be simpler for mkii (no features) + {\edef\@@truefontname{\truefontname{#1}}% + \edef\currentfontfileencoding{\truefontdata\@@truefontname\s!encoding}% + \edef\currentfontfilemapping {\truefontdata\@@truefontname\s!mapping }% + \edef\currentfontfilehandling{\truefontdata\@@truefontname\s!handling}% + \edef\currentfontfilefeatures{\truefontdata\@@truefontname\s!features}} + +\def\updatefontparameters + {\edef\@@fontencoding{\truefontdata\fontfile \s!encoding}% + \edef\@@fontmapping {\truefontdata\fontfile \s!mapping }% + \edef\@@fonthandling{\truefontdata\somefontname\s!handling}% + \edef\@@fontfeatures{\truefontdata\fontfile \s!features}% + \edef\@@fontskewchar{\truefontdata\fontfile \s!skewchar}} +%D Loading: +%D %D for some reason xetex does not support [filename] for tfm files and %D quotes also behave kind of strange " vs ' vs [ vs ... %D @@ -219,7 +306,9 @@ \doifnextoptionalelse\dodefinefontsynonym\nodefinefontsynonym} \def\nodefinefontsynonym - {\@EA\let\csname\??ff\fontclass\@@fontname\endcsname\@@fontfile} + {\@EA\let\csname\??ff\fontclass\@@fontname\endcsname\@@fontfile +% \@EA\let\csname\??ff\@@fontfile\s!features\endcsname\undefined +} \def\dodefinefontsynonym[#1]% {\edef\@@fontdata{#1}% diff --git a/Master/texmf-dist/tex/context/base/grph-epd.lua b/Master/texmf-dist/tex/context/base/grph-epd.lua new file mode 100644 index 00000000000..130907d4e6a --- /dev/null +++ b/Master/texmf-dist/tex/context/base/grph-epd.lua @@ -0,0 +1,26 @@ +if not modules then modules = { } end modules ['grph-epd'] = { + version = 1.001, + comment = "companion to grph-epd.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local variables = interfaces.variables +local settings_to_hash = utilities.parsers.settings_to_hash + +-- todo: page, name, file, url + +local codeinjections = backends.codeinjections + +function figures.mergegoodies(optionlist) + local options = settings_to_hash(optionlist) + local all = options[variables.all] or options[variables.yes] + if all or options[variables.reference] then + codeinjections.mergereferences() + end + if all or options[variables.layer] then + codeinjections.mergeviewerlayers() + end + +end diff --git a/Master/texmf-dist/tex/context/base/grph-epd.mkiv b/Master/texmf-dist/tex/context/base/grph-epd.mkiv new file mode 100644 index 00000000000..b066e1adcbd --- /dev/null +++ b/Master/texmf-dist/tex/context/base/grph-epd.mkiv @@ -0,0 +1,56 @@ +%D \module +%D [ file=grph-epd, +%D version=2010.07.29, +%D title=\CONTEXT\ Graphic Macros, +%D subtitle=Merging Goodies, +%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 Graphic Macros / Merging Coodies} + +\unprotect + +\registerctxluafile{grph-epd}{1.001} + +\def\figurereference {\ctxlua{figures.tprint("status","reference")}} + +\defineoverlay[epdf-overlay][\directsetup{epdf-overlay}] + +\startsetups epdf-overlay + \ctxlua{figures.mergegoodies("\@@efinteraction")}% + \reference[\figurereference]{}% todo: dest area +\stopsetups + +\def\doaddpdffiguregoodies + {\global\setbox\foundexternalfigure\vbox\bgroup + \framed[\c!offset=\v!overlay,\c!background={\v!foreground,epdf-overlay}]{\box\foundexternalfigure}% + \egroup} + +\appendtoks + \iflocation\doif\figurefiletype{pdf}{\doifnot\@@efinteraction\v!none\doaddpdffiguregoodies}\fi +\to \externalfigurepostprocessors + +\protect \endinput + +% /Properties << /xxxx 22 0 R >> +% 21 0 obj << /Type /OCG /Name (xxxx) >> endobj +% 22 0 obj << /OCGs [ 21 0 R ] /Type /OCMD >> endobj + +% \def\setepdflayer#1#2#3#4#5#6% x y w h (in bp) 0/1 destination +% {\setlayer +% [epdflinks] +% [\c!x=#1bp,\c!y=#1\s!bp,\c!preset=\v!leftbottom] +% {\button +% [\c!width=#3\s!bp,\c!height=#4\s!bp,\c!offset=\v!overlay,\c!frame=\ifnum#5=1 on\else\v!off]% +% {}[#6]}} + +% \def\setepdflayer#1#2#3#4#5#6% x y w h (in bp) 0/1 destination +% {\setlayer +% [epdflinks] +% [\c!x=#1bp,\c!y=#1\s!bp,\c!preset=\v!leftbottom] +% {\gotowdhtbox{#3\s!bp}{#4\s!bp}[#6]}} diff --git a/Master/texmf-dist/tex/context/base/grph-fig.mkiv b/Master/texmf-dist/tex/context/base/grph-fig.mkiv index e10dc0a32c6..fad1c864a6f 100644 --- a/Master/texmf-dist/tex/context/base/grph-fig.mkiv +++ b/Master/texmf-dist/tex/context/base/grph-fig.mkiv @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% ex => ef with proper parent + \writestatus{loading}{ConTeXt Graphic Macros / Figure Handling} \unprotect @@ -41,23 +43,23 @@ \def\dodoplaceexternalfigure[#1][#2][#3][#4][#5]% {\bgroup - \pushmacro\textunderscore - \edef\textunderscore{\string_}% brrr, temp hack, still needed? + \dostarttagged\t!image\empty + \let\textunderscore\letterunderscore % {\string _} % space needed as _ is now letter in unprotected mode \calculateexternalfigure[][#1][#2][#3][#4][#5]% [] is dummy dwcomp - \popmacro\textunderscore - \box\foundexternalfigure + \naturalvbox attr \imageattribute 2 {\box\foundexternalfigure}% + \dostoptagged \egroup} \def\externalfigurereplacement#1#2#3% {\setupcolors [\c!state=\v!local]% - \expanded{\localframed + \normalexpanded{\localframed [\??ef] [\c!width=\figurewidth, \c!height=\figureheight, \c!background=\v!color, \c!backgroundcolor=missingfigurecolor, - \c!frame=\@@efframe]}% + \c!frame=\@@efframe]}% we need to expand this in order to prevent a loop {\tt\tfxx \nohyphens name: \expanded{\verbatimstring{#1}}\\% file: \expanded{\verbatimstring{#2}}\\% @@ -160,7 +162,7 @@ \def\dodouseexternalfigure#1#2#3#4% {\setvalue{\??ef\??ef#1}{\doplaceexternalfigure[#1][#2][#3][#4]}% - \doanalyseexternalfigurecollection[#2][#4]} + \doanalyzeexternalfigurecollection[#2][#4]} \newconditional\inexternalfigurecollection \newdimen\xexternalfigurecollectionminwidth @@ -168,7 +170,7 @@ \newdimen\xexternalfigurecollectionminheight \newdimen\xexternalfigurecollectionmaxheight -\def\doanalyseexternalfigurecollection[#1][#2]% +\def\doanalyzeexternalfigurecollection[#1][#2]% {\ifconditional\inexternalfigurecollection \setfalse\inexternalfigurecollection \getfiguredimensions[#1][#2]% @@ -259,7 +261,7 @@ \let\currentresourcecomment\empty \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} + {%\writestatus\m!system{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% @@ -513,21 +515,11 @@ \dodotypesetbuffer[\jobname][] \fi\fi} -% \def\dodotypesetbuffer[#1][#2]% -% {\bgroup -% \global\advance\noftypesetbuffers\plusone -% \edef\bufferfilename{\jobname-buffer-\the\noftypesetbuffers}% -% \doifmode{*\v!first} -% {\ctxlua{buffers.save("\bufferfilename.tmp","#1",true)}% -% \executesystemcommand{context \bufferfilename.tmp}}% -% \externalfigure[\bufferfilename.pdf][#2]% -% \egroup} - \def\dodotypesetbuffer[#1][#2]% {\bgroup \global\advance\noftypesetbuffers\plusone \edef\bufferfilename{\jobname-buffer-\the\noftypesetbuffers}% - \ctxlua{buffers.run("\bufferfilename.tmp","#1",true)}% + \ctxcommand{runbuffer("\bufferfilename.tmp","#1",true)}% \externalfigure[\bufferfilename.pdf][#2]% \egroup} @@ -551,10 +543,7 @@ \definesystemvariable{tz} \unexpanded\def\definetypesetting{\dotripleempty\dodefinetypesetting} -\def\typesetfile {\dotripleempty\dotypesetfile} - -\unexpanded\def\definetypesetting{\dotripleempty\dodefinetypesetting} -\def\typesetfile {\dotripleempty\dotypesetfile} +\unexpanded\def\typesetfile {\dotripleempty\dotypesetfile} \def\dodefinetypesetting[#1][#2][#3]% options settings-a {\doifsomething{#1}{\setvalue{\??tz#1}{\dodotypesetfile{#2}{#3}}}} @@ -569,13 +558,14 @@ \fi\fi\fi} \def\dodotypesetfile#1#2#3#4% options settings-a filename settings-b - {\edef\typesetfilename{\ctxlua{tex.write(jobfiles.run("#3","#1"))}}% + {\edef\typesetfilename{\ctxlua{tex.write(job.files.context("#3","#1"))}}% \expanded{\externalfigure[\typesetfilename]}[#2,#4]} \setupexternalfigures [\c!option=, \c!object=\v!yes, % we only check for no \c!reset=\v!no, + \c!interaction=\v!none, \c!maxwidth=\@@efwidth, \c!maxheight=\@@efheight, \c!bodyfont=\bodyfontsize, @@ -587,6 +577,7 @@ \c!background=, % new \c!splitcolor=\s!white, \c!conversion=, + \c!resolution=, \c!prefix=, \c!cache=, % \c!grid=, diff --git a/Master/texmf-dist/tex/context/base/grph-fil.lua b/Master/texmf-dist/tex/context/base/grph-fil.lua index 2e32c7a6066..0856f5b0854 100644 --- a/Master/texmf-dist/tex/context/base/grph-fil.lua +++ b/Master/texmf-dist/tex/context/base/grph-fil.lua @@ -8,35 +8,58 @@ if not modules then modules = { } end modules ['grph-fil'] = { local format, concat = string.format, table.concat -local trace_run = false trackers.register("files.run",function(v) trace_run = v end) +local trace_run = false trackers.register("graphic.runfile",function(v) trace_run = v end) -local command = "context %s" +local report_run = logs.reporter("graphics","run") -jobfiles = jobfiles or { } -jobfiles.collected = jobfiles.collected or { } -jobfiles.tobesaved = jobfiles.tobesaved or { } +local allocate = utilities.storage.allocate -local tobesaved, collected = jobfiles.tobesaved, jobfiles.collected +local collected = allocate() +local tobesaved = allocate() + +local jobfiles = { + collected = collected, + tobesaved = tobesaved, +} + +job.files = jobfiles local function initializer() - tobesaved, collected = jobfiles.tobesaved, jobfiles.collected + tobesaved = jobfiles.tobesaved + collected = jobfiles.collected end -job.register('jobfiles.collected', jobfiles.tobesaved, initializer) +job.register('job.files.collected', tobesaved, initializer) jobfiles.forcerun = false -function jobfiles.run(name,...) +function jobfiles.run(name,command) local oldchecksum = collected[name] local newchecksum = file.checksum(name) if jobfiles.forcerun or not oldchecksum or oldchecksum ~= newchecksum then if trace_run then - commands.writestatus("buffers","changes in '%s', processing forced",name) + report_run("processing file, changes in '%s', processing forced",name) + end + if command and command ~= "" then + os.execute(command) + else + report_run("processing file, no command given for processing '%s'",name) end - os.execute(format(command,concat({ name, ... }," "))) elseif trace_run then - commands.writestatus("buffers","no changes in '%s', not processed",name) + report_run("processing file, no changes in '%s', not processed",name) end tobesaved[name] = newchecksum - return file.replacesuffix(name,"pdf") +end + +function jobfiles.context(name,options) + if type(name) == "table" then + local result = { } + for i=1,#name do + result[#result+1] = jobfiles.context(name[i],options) + end + return result + else + jobfiles.run(name,"context ".. (options or "") .. " " .. name) + return file.replacesuffix(name,"pdf") + end end diff --git a/Master/texmf-dist/tex/context/base/grph-inc.lua b/Master/texmf-dist/tex/context/base/grph-inc.lua index 508240a3bc4..7dee63eaf5f 100644 --- a/Master/texmf-dist/tex/context/base/grph-inc.lua +++ b/Master/texmf-dist/tex/context/base/grph-inc.lua @@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['grph-inc'] = { license = "see context related readme files" } +-- figures -> managers.figures + -- lowercase types -- mps tex tmp svg -- partly qualified @@ -14,6 +16,8 @@ if not modules then modules = { } end modules ['grph-inc'] = { -- figures.boxnumber can go as we now can use names +-- avoid push + --[[ The ConTeXt figure inclusion mechanisms are among the oldest code in ConTeXt and evolve dinto a complex whole. One reason is that we @@ -36,19 +40,29 @@ run TeX code from within Lua. Some more functionality will move to Lua. ]]-- local format, lower, find, match, gsub, gmatch = string.format, string.lower, string.find, string.match, string.gsub, string.gmatch -local texsprint, texbox = tex.sprint, tex.box +local texbox = tex.box local contains = table.contains -local concat = table.concat +local concat, insert, remove = table.concat, table.insert, table.remove local todimen = string.todimen -local ctxcatcodes = tex.ctxcatcodes -local variables = interfaces.variables +local settings_to_array = utilities.parsers.settings_to_array +local settings_to_hash = utilities.parsers.settings_to_hash +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex + +local variables = interfaces.variables +local codeinjections = backends.codeinjections +local nodeinjections = backends.nodeinjections + +local trace_figures = false trackers.register("graphics.locating", function(v) trace_figures = v end) +local trace_bases = false trackers.register("graphics.bases", function(v) trace_bases = v end) +local trace_programs = false trackers.register("graphics.programs", function(v) trace_programs = v end) +local trace_conversion = false trackers.register("graphics.conversion", function(v) trace_conversion = v end) +local trace_inclusion = false trackers.register("graphics.inclusion", function(v) trace_inclusion = v end) -local trace_figures = false trackers.register("figures.locating", function(v) trace_figures = v end) -local trace_bases = false trackers.register("figures.bases", function(v) trace_bases = v end) -local trace_programs = false trackers.register("figures.programs", function(v) trace_programs = v end) -local trace_conversion = false trackers.register("figures.conversion", function(v) trace_conversion = v end) -local trace_inclusion = false trackers.register("figures.inclusion", function(v) trace_inclusion = v end) +local report_inclusion = logs.reporter("graphics","inclusion") + +local context, img = context, img --- some extra img functions --- @@ -63,8 +77,12 @@ function img.totable(imgtable) return result end -function img.serialize(i) - return table.serialize(img.totable(i)) +function img.serialize(i,...) + return table.serialize(img.totable(i),...) +end + +function img.print(i,...) + return table.print(img.totable(i),...) end function img.clone(i,data) @@ -77,7 +95,7 @@ end local validsizes = table.tohash(img.boxes()) local validtypes = table.tohash(img.types()) -function img.check_size(size) +function img.checksize(size) if size then size = gsub(size,"box","") return (validsizes[size] and size) or "crop" @@ -86,56 +104,74 @@ function img.check_size(size) end end ---- +local indexed = { } + +function img.ofindex(n) + return indexed[n] +end + +--- we can consider an grph-ini file + +figures = figures or { } +local figures = figures + +figures.loaded = allocate() +figures.used = allocate() +figures.found = allocate() +figures.suffixes = allocate() +figures.patterns = allocate() -figures = figures or { } -figures.loaded = figures.loaded or { } -figures.used = figures.used or { } -figures.found = figures.found or { } -figures.suffixes = figures.suffixes or { } -figures.patterns = figures.patterns or { } figures.boxnumber = figures.boxnumber or 0 figures.defaultsearch = true figures.defaultwidth = 0 figures.defaultheight = 0 figures.defaultdepth = 0 -figures.n = 0 -figures.prefer_quality = true -- quality over location +figures.nofprocessed = 0 +figures.preferquality = true -- quality over location -figures.localpaths = { +figures.existers = allocate() local existers = figures.existers +figures.checkers = allocate() local checkers = figures.checkers +figures.includers = allocate() local includers = figures.includers +figures.converters = allocate() local converters = figures.converters +figures.identifiers = allocate() local identifiers = figures.identifiers +figures.programs = allocate() local programs = figures.programs + +figures.localpaths = allocate { ".", "..", "../.." } -figures.cachepaths = { +figures.cachepaths = allocate { prefix = "", path = ".", subpath = ".", } -figures.paths = table.copy(figures.localpaths) +figures.paths = allocate(table.copy(figures.localpaths)) -figures.order = { - "pdf", "mps", "jpg", "png", "jbig", "svg", "eps", "gif", "mov", "buffer", "tex", +figures.order = allocate{ + "pdf", "mps", "jpg", "png", "jp2", "jbig", "svg", "eps", "gif", "mov", "buffer", "tex", "cld", } -figures.formats = { +figures.formats = allocate{ ["pdf"] = { list = { "pdf" } }, ["mps"] = { patterns = { "mps", "%d+" } }, ["jpg"] = { list = { "jpg", "jpeg" } }, + ["jp2"] = { list = { "jp2" } }, ["png"] = { list = { "png" } }, ["jbig"] = { list = { "jbig", "jbig2", "jb2" } }, ["svg"] = { list = { "svg", "svgz" } }, ["eps"] = { list = { "eps", "ai" } }, ["gif"] = { list = { "gif" } }, - ["mov"] = { list = { "mov", "avi" } }, + ["mov"] = { list = { "mov", "flv", "mp4" } }, -- "avi" is not supported ["buffer"] = { list = { "tmp", "buffer", "buf" } }, ["tex"] = { list = { "tex" } }, + ["cld"] = { list = { "cld" } }, } function figures.setlookups() - figures.suffixes, figures.patterns = { }, { } + local fs, fp = allocate(), allocate() + figures.suffixes, figures.patterns = fs, fp for _, format in next, figures.order do local data = figures.formats[format] - local fs, fp = figures.suffixes, figures.patterns local list = data.list if list then for i=1,#list do @@ -183,7 +219,7 @@ function figures.setpaths(locationset,pathlist) -- this function can be called each graphic so we provide this optimization return end - local iv, t, h = interfaces.variables, figures.paths, locationset:tohash() + local iv, t, h = interfaces.variables, figures.paths, settings_to_hash(locationset) if last_locationset ~= locationset then -- change == reset (actually, a 'reset' would indeed reset if h[iv["local"]] then @@ -195,8 +231,7 @@ function figures.setpaths(locationset,pathlist) last_locationset = locationset end if h[iv["global"]] then - -- for s in gmatch(pathlist,",* *([^,]+)") do - local list = aux.settings_to_array(pathlist) + local list = settings_to_array(pathlist) for i=1,#list do local s = list[i] if not contains(t,s) then @@ -206,8 +241,8 @@ function figures.setpaths(locationset,pathlist) end figures.paths, last_pathlist = t, pathlist if trace_figures then - commands.writestatus("figures","locations: %s",last_locationset) - commands.writestatus("figures","path list: %s",concat(figures.paths, " ")) + report_inclusion("locations: %s",last_locationset) + report_inclusion("path list: %s",concat(figures.paths, " ")) end end @@ -220,195 +255,245 @@ end -- interfacing to tex -do - - local figuredata = { } - local callstack = { } - - function figures.new() - figuredata = { - request = { - name = false, - label = false, - format = false, - page = false, - width = false, - height = false, - preview = false, - ["repeat"] = false, - controls = false, - display = false, - conversion = false, - cache = false, - prefix = false, - size = false, - }, - used = { - fullname = false, - format = false, - name = false, - path = false, - suffix = false, - width = false, - height = false, - }, - status = { - status = 0, - converted = false, - cached = false, - fullname = false, - format = false, - }, - } - return figuredata - end +local function new() -- we could use metatables status -> used -> request but it needs testing + local request = { + name = false, + label = false, + format = false, + page = false, + width = false, + height = false, + preview = false, + ["repeat"] = false, + controls = false, + display = false, + mask = false, + conversion = false, + resolution = false, + cache = false, + prefix = false, + size = false, + } + local used = { + fullname = false, + format = false, + name = false, + path = false, + suffix = false, + width = false, + height = false, + } + local status = { + status = 0, + converted = false, + cached = false, + fullname = false, + format = false, + } + -- this needs checking because we might check for nil, the test case + -- is getfiguredimensions which then should return ~= 0 + -- setmetatableindex(status, used) + -- setmetatableindex(used, request) + return { + request = request, + used = used, + status = status, + } +end - function figures.push(request) - local ncs = #callstack + 1 - if ncs == 1 then - statistics.starttiming(figures) - end - local figuredata = figures.new() - if request then - local iv = interfaces.variables - -- request.width/height are strings and are only used when no natural dimensions - -- can be determined; at some point the handlers might set them to numbers instead - -- local w, h = tonumber(request.width), tonumber(request.height) - request.page = math.max(tonumber(request.page) or 1,1) - request.size = img.check_size(request.size) - request.object = iv[request.object] == variables.yes - request["repeat"] = iv[request["repeat"]] == variables.yes - request.preview = iv[request.preview] == variables.yes - request.cache = request.cache ~= "" and request.cache - request.prefix = request.prefix ~= "" and request.prefix - request.format = request.format ~= "" and request.format - -- request.width = (w and w > 0) or false - -- request.height = (h and h > 0) or false - table.merge(figuredata.request,request) - end - callstack[ncs] = figuredata - return figuredata - end - function figures.pop() - local ncs = #callstack - figuredata = callstack[ncs] - callstack[ncs] = nil - if ncs == 1 then - statistics.stoptiming(figures) - end - end - -- maybe move texsprint to tex - function figures.get(category,tag,default) - local value = figuredata[category] - value = value and value[tag] - if not value or value == "" or value == true then - return default or "" - else - return value - end - end - function figures.tprint(category,tag,default) - texsprint(ctxcatcodes,figures.get(category,tag,default)) + -- use table.insert|remove + +local lastfiguredata = nil -- will be topofstack or last so no { } (else problems with getfiguredimensions) +local callstack = { } + +function figures.initialize(request) + local figuredata = new() + if request then + -- request.width/height are strings and are only used when no natural dimensions + -- can be determined; at some point the handlers might set them to numbers instead + -- local w, h = tonumber(request.width), tonumber(request.height) + request.page = math.max(tonumber(request.page) or 1,1) + request.size = img.checksize(request.size) + request.object = request.object == variables.yes + request["repeat"] = request["repeat"] == variables.yes + request.preview = request.preview == variables.yes + request.cache = request.cache ~= "" and request.cache + request.prefix = request.prefix ~= "" and request.prefix + request.format = request.format ~= "" and request.format + -- request.width = (w and w > 0) or false + -- request.height = (h and h > 0) or false + table.merge(figuredata.request,request) end - function figures.current() - return callstack[#callstack] + return figuredata +end + +function figures.push(request) + statistics.starttiming(figures) + local figuredata = figures.initialize(request) + insert(callstack,figuredata) + lastfiguredata = figuredata + return figuredata +end + +function figures.pop() + lastfiguredata = remove(callstack) or lastfiguredata + statistics.stoptiming(figures) +end + +function figures.current() + return callstack[#callstack] or lastfiguredata +end + +function figures.get(category,tag,default) + local value = lastfiguredata and lastfiguredata[category] + value = value and value[tag] + if not value or value == "" or value == true then + return default or "" + else + return value end +end +-- + +function figures.tprint(category,tag,default) + context(figures.get(category,tag,default)) end local defaultformat = "pdf" -local defaultprefix = "m_k_v_i_" +local defaultprefix = "m_k_i_v_" + +-- todo: local path or cache path + +local function forbiddenname(filename) + if not filename or filename == "" then + return false + end + local expandedfullname = file.collapsepath(filename,true) + local expandedinputname = file.collapsepath(file.addsuffix(environment.jobfilename,environment.jobfilesuffix),true) + if expandedfullname == expandedinputname then + report_inclusion("skipping graphic with same name as input filename (%s), enforce suffix",expandedinputname) + return true + end + local expandedoutputname = file.collapsepath(codeinjections.getoutputfilename(),true) + if expandedfullname == expandedoutputname then + report_inclusion("skipping graphic with same name as output filename (%s), enforce suffix",expandedoutputname) + return true + end +end local function register(askedname,specification) if specification then - local format = specification.format - if format then - local conversion = specification.conversion - if conversion == "" then - conversion = nil - end - local newformat = conversion - if not newformat or newformat == "" then - newformat = defaultformat - end - local converter = (newformat ~= format) and figures.converters[format] - if trace_conversion then - logs.report("figures","checking conversion of '%s': old format '%s', new format '%s', conversion '%s'", - askedname,format,newformat,conversion or "default") - end - if converter then - if converter[newformat] then - converter = converter[newformat] - else + if forbiddenname(specification.fullname) then + specification = { } + else + local format = specification.format + if format then + local conversion = specification.conversion + local resolution = specification.resolution + if conversion == "" then + conversion = nil + end + if resolution == "" then + resolution = nil + end + local newformat = conversion + if not newformat or newformat == "" then newformat = defaultformat + end + if trace_conversion then + report_inclusion("checking conversion of '%s': old format '%s', new format '%s', conversion '%s', resolution '%s'", + askedname,format,newformat,conversion or "default",resolution or "default") + end + local converter = (newformat ~= format) and converters[format] + if converter then if converter[newformat] then converter = converter[newformat] else newformat = defaultformat + if converter[newformat] then + converter = converter[newformat] + else + converter = nil + newformat = defaultformat + end end + elseif trace_conversion then + report_inclusion("no converter for '%s' -> '%s'",format,newformat) end - end - if converter then - local oldname = specification.fullname - local newpath = file.dirname(oldname) - local oldbase = file.basename(oldname) - local newbase = file.replacesuffix(oldbase,newformat) - local fc = specification.cache or figures.cachepaths.path - if fc and fc ~= "" and fc ~= "." then - newpath = fc - else - newbase = defaultprefix .. newbase - end - local subpath = specification.subpath or figures.cachepaths.subpath - if subpath and subpath ~= "" and subpath ~= "." then - newpath = newpath .. "/" .. subpath - end - local prefix = specification.prefix or figures.cachepaths.prefix - if prefix and prefix ~= "" then - newbase = prefix .. newbase - end - local newname = file.join(newpath,newbase) - dir.makedirs(newpath) - oldname = file.collapse_path(oldname) - newname = file.collapse_path(newname) - local oldtime = lfs.attributes(oldname,'modification') or 0 - local newtime = lfs.attributes(newname,'modification') or 0 - if oldtime > newtime then - if trace_conversion then - logs.report("figures","converting '%s' from '%s' to '%s'",askedname,format,newformat) + if converter then + -- local oldname = specification.fullname + local oldname = specification.foundname + local newpath = file.dirname(oldname) + local oldbase = file.basename(oldname) + local newbase = file.removesuffix(oldbase) + local fc = specification.cache or figures.cachepaths.path + if fc and fc ~= "" and fc ~= "." then + newpath = fc + else + newbase = defaultprefix .. newbase end - converter(oldname,newname) - else - if trace_conversion then - logs.report("figures","no need to convert '%s' from '%s' to '%s'",askedname,format,newformat) + if not file.is_writable(newpath) then + if trace_conversion then + report_inclusion("[ath '%s'is not writable, forcing conversion path '.' ",newpath) + end + newpath = "." + end + local subpath = specification.subpath or figures.cachepaths.subpath + if subpath and subpath ~= "" and subpath ~= "." then + newpath = newpath .. "/" .. subpath + end + local prefix = specification.prefix or figures.cachepaths.prefix + if prefix and prefix ~= "" then + newbase = prefix .. newbase + end + if resolution and resolution ~= "" then -- the order might change + newbase = newbase .. "_" .. resolution + end + local newbase = file.addsuffix(newbase,newformat) + local newname = file.join(newpath,newbase) + dir.makedirs(newpath) + oldname = file.collapsepath(oldname) + newname = file.collapsepath(newname) + local oldtime = lfs.attributes(oldname,'modification') or 0 + local newtime = lfs.attributes(newname,'modification') or 0 + if newtime == 0 or oldtime > newtime then + if trace_conversion then + report_inclusion("converting '%s' from '%s' to '%s'",askedname,format,newformat) + end + converter(oldname,newname,resolution or "") + else + if trace_conversion then + report_inclusion("no need to convert '%s' from '%s' to '%s'",askedname,format,newformat) + end + end + if io.exists(newname) then + specification.foundname = oldname + specification.fullname = newname + specification.prefix = prefix + specification.subpath = subpath + specification.converted = true + format = newformat + elseif io.exists(oldname) then + specification.fullname = newname + specification.converted = false end end - if io.exists(newname) then - specification.foundname = oldname - specification.fullname = newname - specification.prefix = prefix - specification.subpath = subpath - specification.converted = true - format = newformat - elseif io.exists(oldname) then - specification.fullname = newname - specification.converted = false - end - end - end - local found = figures.suffixes[format] -- validtypes[format] - if not found then - specification.found = false - if trace_figures then - commands.writestatus("figures","format not supported: %s",format) end - else - specification.found = true - if trace_figures then - if validtypes[format] then - commands.writestatus("figures","format natively supported by backend: %s",format) - else - commands.writestatus("figures","format supported by output file format: %s",format) + local found = figures.suffixes[format] -- validtypes[format] + if not found then + specification.found = false + if trace_figures then + report_inclusion("format not supported: %s",format) + end + else + specification.found = true + if trace_figures then + if validtypes[format] then + report_inclusion("format natively supported by backend: %s",format) + else + report_inclusion("format supported by output file format: %s",format) + end end end end @@ -416,24 +501,31 @@ local function register(askedname,specification) specification = { } end specification.foundname = specification.foundname or specification.fullname - figures.found[askedname .. "->" .. (specification.conversion or "default")] = specification + figures.found[askedname .. "->" .. (specification.conversion or "default") .. "->" .. (specification.resolution or "default")] = specification return specification end local resolve_too = true -- urls local function locate(request) -- name, format, cache - local askedname = resolvers.clean_path(request.name) - local foundname = figures.found[askedname .. "->" .. (request.conversion or "default")] + local askedname = resolvers.cleanpath(request.name) + local foundname = figures.found[askedname .. "->" .. (request.conversion or "default") .. "->" .. (request.resolution or "default")] if foundname then return foundname end -- protocol check local hashed = url.hashed(askedname) - if hashed and hashed.scheme ~= "file" then - local foundname = resolvers.findbinfile(askedname) - if foundname then - askedname = foundname + if hashed then + if hashed.scheme == "file" then + local path = hashed.path + if path and path ~= "" then + askedname = path + end + else + local foundname = resolvers.findbinfile(askedname) + if foundname then + askedname = foundname + end end end -- we could use the hashed data instead @@ -442,11 +534,12 @@ local function locate(request) -- name, format, cache local askedformat = (request.format ~= "" and request.format ~= "unknown" and request.format) or file.extname(askedname) or "" local askedcache = request.cache local askedconversion = request.conversion + local askedresolution = request.resolution if askedformat ~= "" then + askedformat = lower(askedformat) if trace_figures then - commands.writestatus("figures","strategy: forced format") + report_inclusion("strategy: forced format %s",askedformat) end - askedformat = lower(askedformat) local format = figures.suffixes[askedformat] if not format then local figurepatterns = figures.patterns @@ -459,27 +552,33 @@ local function locate(request) -- name, format, cache end end if format then - local foundname = figures.exists(askedname,format,resolve_too) -- not askedformat + local foundname, quitscanning = figures.exists(askedname,format,resolve_too) -- not askedformat if foundname then return register(askedname, { - askedname = askedname, - fullname = askedname, - format = format, - cache = askedcache, - foundname = foundname, + askedname = askedname, + fullname = askedname, + format = format, + cache = askedcache, + foundname = foundname, conversion = askedconversion, + resolution = askedresolution, }) + elseif quitscanning then + return register(askedname) end + elseif trace_figures then + report_inclusion("strategy: unknown format %s",askedformat) end if askedpath then -- path and type given, todo: strip pieces of path if figures.exists(askedname,askedformat,resolve_too) then return register(askedname, { - askedname = askedname, - fullname = askedname, - format = askedformat, - cache = askedcache, + askedname = askedname, + fullname = askedname, + format = askedformat, + cache = askedcache, conversion = askedconversion, + resolution = askedresolution, }) end else @@ -492,30 +591,32 @@ local function locate(request) -- name, format, cache -- is given we don't waste much time if figures.exists(check,askedformat,resolve_too) then return register(check, { - askedname = askedname, - fullname = check, - format = askedformat, - cache = askedcache, + askedname = askedname, + fullname = check, + format = askedformat, + cache = askedcache, conversion = askedconversion, + resolution = askedresolution, }) end end if figures.defaultsearch then - local check = resolvers.find_file(askedname) + local check = resolvers.findfile(askedname) if check and check ~= "" then return register(askedname, { - askedname = askedname, - fullname = check, - format = askedformat, - cache = askedcache, + askedname = askedname, + fullname = check, + format = askedformat, + cache = askedcache, conversion = askedconversion, + resolution = askedresolution, }) end end end elseif askedpath then if trace_figures then - commands.writestatus("figures","strategy: rootbased path") + report_inclusion("strategy: rootbased path") end local figureorder = figures.order for i=1,#figureorder do @@ -526,19 +627,20 @@ local function locate(request) -- name, format, cache local check = file.addsuffix(askedname,suffix) if figures.exists(check,format,resolve_too) then return register(askedname, { - askedname = askedname, - fullname = check, - format = format, - cache = askedcache, + askedname = askedname, + fullname = check, + format = format, + cache = askedcache, conversion = askedconversion, + resolution = askedresolution, }) end end end else - if figures.prefer_quality then + if figures.preferquality then if trace_figures then - commands.writestatus("figures","strategy: unknown format, prefer quality") + report_inclusion("strategy: unknown format, prefer quality") end local figurepaths = figures.paths local figureorder = figures.order @@ -555,15 +657,16 @@ local function locate(request) -- name, format, cache local isfile = url.hashed(check).scheme == "file" if not isfile then if trace_figures then - commands.writestatus("figures","warning: skipping path %s",path) + report_inclusion("warning: skipping path %s",path) end elseif figures.exists(check,format,true) then return register(askedname, { - askedname = askedname, - fullname = check, - format = format, - cache = askedcache, + askedname = askedname, + fullname = check, + format = format, + cache = askedcache, conversion = askedconversion, + resolution = askedresolution, }) end end @@ -571,7 +674,7 @@ local function locate(request) -- name, format, cache end else -- 'location' if trace_figures then - commands.writestatus("figures","strategy: unknown format, prefer path") + report_inclusion("strategy: unknown format, prefer path") end local figurepaths = figures.paths local figureorder = figures.order @@ -585,11 +688,12 @@ local function locate(request) -- name, format, cache local check = path .. "/" .. file.replacesuffix(askedbase,suffix) if figures.exists(check,format,resolve_too) then return register(askedname, { - askedname = askedname, - fullname = check, - format = format, - cache = askedcache, + askedname = askedname, + fullname = check, + format = format, + cache = askedcache, conversion = askedconversion, + resolution = askedresolution, }) end end @@ -598,7 +702,7 @@ local function locate(request) -- name, format, cache end if figures.defaultsearch then if trace_figures then - commands.writestatus("figures","strategy: default tex path") + report_inclusion("strategy: default tex path") end local figureorder = figures.order for j=1,#figureorder do @@ -606,14 +710,15 @@ local function locate(request) -- name, format, cache local list = figures.formats[format].list or { format } for k=1,#list do local suffix = list[k] - local check = resolvers.find_file(file.replacesuffix(askedname,suffix)) + local check = resolvers.findfile(file.replacesuffix(askedname,suffix)) if check and check ~= "" then return register(askedname, { - askedname = askedname, - fullname = check, - format = format, - cache = askedcache, + askedname = askedname, + fullname = check, + format = format, + cache = askedcache, conversion = askedconversion, + resolution = askedresolution, }) end end @@ -625,35 +730,24 @@ end -- -- -- plugins -- -- -- -figures.existers = figures.existers or { } -figures.checkers = figures.checkers or { } -figures.includers = figures.includers or { } -figures.converters = figures.converters or { } -figures.identifiers = figures.identifiers or { } -figures.programs = figures.programs or { } - -figures.identifiers.list = { - figures.identifiers.default -} - -function figures.identifiers.default(data) +function identifiers.default(data) local dr, du, ds = data.request, data.used, data.status local l = locate(dr) local foundname = l.foundname - local fullname = l.fullname or foundname + local fullname = l.fullname or foundname if fullname then - du.format = l.format or false + du.format = l.format or false du.fullname = fullname -- can be cached ds.fullname = foundname -- original - ds.format = l.format - ds.status = (l.found and 10) or 0 + ds.format = l.format + ds.status = (l.found and 10) or 0 end return data end function figures.identify(data) data = data or figures.current() - local list = figures.identifiers.list + local list = identifiers.list -- defined at the end for i=1,#list do local identifier = list[i] data = identifier(data) @@ -663,25 +757,28 @@ function figures.identify(data) end return data end + function figures.exists(askedname,format,resolve) - return (figures.existers[format] or figures.existers.generic)(askedname,resolve) + return (existers[format] or existers.generic)(askedname,resolve) end + function figures.check(data) data = data or figures.current() - local dr, du, ds = data.request, data.used, data.status - return (figures.checkers[ds.format] or figures.checkers.generic)(data) + return (checkers[data.status.format] or checkers.generic)(data) end + function figures.include(data) data = data or figures.current() - local dr, du, ds = data.request, data.used, data.status - return (figures.includers[ds.format] or figures.includers.generic)(data) + return (includers[data.status.format] or includers.generic)(data) end + function figures.scale(data) -- will become lua code - texsprint(ctxcatcodes,"\\doscalefigure") + context.doscalefigure() return data end + function figures.done(data) - figures.n = figures.n + 1 + figures.nofprocessed = figures.nofprocessed + 1 data = data or figures.current() --~ print(table.serialize(figures.current())) local dr, du, ds, nr = data.request, data.used, data.status, figures.boxnumber @@ -690,13 +787,14 @@ function figures.done(data) ds.height = box.height ds.xscale = ds.width /(du.width or 1) ds.yscale = ds.height/(du.height or 1) + ds.page = ds.page or du.page or dr.page -- sort of redundant but can be limited --~ print(table.serialize(figures.current())) return data end function figures.dummy(data) data = data or figures.current() - local dr, du, ds, nr = data.request, data.used, data.status, figures.boxnumber + local dr, du, nr = data.request, data.used, figures.boxnumber local box = node.hpack(node.new("hlist")) -- we need to set the dir (luatex 0.60 buglet) du.width = du.width or figures.defaultwidth du.height = du.height or figures.defaultheight @@ -710,7 +808,7 @@ end -- -- -- generic -- -- -- -function figures.existers.generic(askedname,resolve) +function existers.generic(askedname,resolve) -- not findbinfile local result if lfs.isfile(askedname) then @@ -721,47 +819,66 @@ function figures.existers.generic(askedname,resolve) end if trace_figures then if result then - commands.writestatus("figures","found: %s -> %s",askedname,result) + report_inclusion("found: %s -> %s",askedname,result) else - commands.writestatus("figures","not found: %s",askedname) + report_inclusion("not found: %s",askedname) end end return result end -function figures.checkers.generic(data) + +function checkers.generic(data) local dr, du, ds = data.request, data.used, data.status local name, page, size, color = du.fullname or "unknown generic", du.page or dr.page, dr.size or "crop", dr.color or "natural" + local mask = dr.mask or "none" local conversion = dr.conversion + local resolution = dr.resolution if not conversion or conversion == "" then conversion = "unknown" end - local hash = name .. "->" .. page .. "->" .. size .. "->" .. color .. "->" .. conversion + if not resolution or resolution == "" then + resolution = "unknown" + end + local hash = name .. "->" .. page .. "->" .. size .. "->" .. color .. "->" .. conversion .. "->" .. resolution + .. "->" .. mask local figure = figures.loaded[hash] if figure == nil then - figure = img.new { filename = name, page = page, pagebox = dr.size } - backends.codeinjections.setfigurecolorspace(data,figure) + figure = img.new { + filename = name, + page = page, + pagebox = dr.size, + } + codeinjections.setfigurecolorspace(data,figure) + codeinjections.setfiguremask(data,figure) figure = (figure and img.scan(figure)) or false - local f, d = backends.codeinjections.setfigurealternative(data,figure) + local f, d = codeinjections.setfigurealternative(data,figure) figure, data = f or figure, d or data figures.loaded[hash] = figure if trace_conversion then - logs.report("figures","new graphic, hash: %s",hash) + report_inclusion("new graphic, hash: %s",hash) end else if trace_conversion then - logs.report("figures","existing graphic, hash: %s",hash) + report_inclusion("existing graphic, hash: %s",hash) end end if figure then du.width = figure.width du.height = figure.height du.pages = figure.pages + du.depth = figure.depth or 0 + du.colordepth = figure.colordepth or 0 + du.xresolution = figure.xres or 0 + du.yresolution = figure.yres or 0 + du.xsize = figure.xsize or 0 + du.ysize = figure.ysize or 0 ds.private = figure ds.hash = hash end return data end -function figures.includers.generic(data) + +function includers.generic(data) local dr, du, ds = data.request, data.used, data.status -- here we set the 'natural dimensions' dr.width = du.width @@ -780,39 +897,43 @@ function figures.includers.generic(data) local nr = figures.boxnumber -- it looks like we have a leak in attributes here .. todo local box = node.hpack(img.node(figure)) -- img.node(figure) not longer valid + indexed[figure.index] = figure box.width, box.height, box.depth = figure.width, figure.height, 0 -- new, hm, tricky, we need to do that in tex (yet) texbox[nr] = box ds.objectnumber = figure.objnum - texsprint(ctxcatcodes,"\\relocateexternalfigure") + context.relocateexternalfigure() end return data end -- -- -- nongeneric -- -- -- -function figures.checkers.nongeneric(data,command) +function checkers.nongeneric(data,command) -- todo: macros and context.* local dr, du, ds = data.request, data.used, data.status local name = du.fullname or "unknown nongeneric" local hash = name if dr.object then - -- hm, bugged - if not jobobjects.get("FIG::"..hash) then - texsprint(ctxcatcodes,command) - texsprint(ctxcatcodes,format("\\setobject{FIG}{%s}\\vbox{\\box\\foundexternalfigure}",hash)) + -- hm, bugged ... waiting for an xform interface + if not job.objects.get("FIG::"..hash) then + if type(command) == "function" then + command() + end + context.dosetfigureobject(hash) end - texsprint(ctxcatcodes,format("\\global\\setbox\\foundexternalfigure\\vbox{\\getobject{FIG}{%s}}",hash)) - else - texsprint(ctxcatcodes,command) + context.doboxfigureobject(hash) + elseif type(command) == "function" then + command() end return data end -function figures.includers.nongeneric(data) + +function includers.nongeneric(data) return data end -- -- -- mov -- -- -- -function figures.checkers.mov(data) +function checkers.mov(data) local dr, du, ds = data.request, data.used, data.status local width = todimen(dr.width or figures.defaultwidth) local height = todimen(dr.height or figures.defaultheight) @@ -820,12 +941,12 @@ function figures.checkers.mov(data) dr.width, dr.height = width, height du.width, du.height, du.foundname = width, height, foundname if trace_inclusion then - logs.report("figures","including movie '%s': width %s, height %s",foundname,width,height) + report_inclusion("including movie '%s': width %s, height %s",foundname,width,height) end -- we need to push the node.write in between ... we could make a shared helper for this context.startfoundexternalfigure(width .. "sp",height .. "sp") context(function() - backends.codeinjections.insertmovie { + nodeinjections.insertmovie { width = width, height = height, factor = number.dimenfactors.bp, @@ -840,7 +961,7 @@ function figures.checkers.mov(data) return data end -figures.includers.mov = figures.includers.nongeneric +includers.mov = includers.nongeneric -- -- -- mps -- -- -- @@ -853,49 +974,66 @@ local function internal(askedname) end end -function figures.existers.mps(askedname) +function existers.mps(askedname) local mprun, mpnum = internal(askedname) if mpnum then return askedname else - return figures.existers.generic(askedname) + return existers.generic(askedname) end end -function figures.checkers.mps(data) + +function checkers.mps(data) local mprun, mpnum = internal(data.used.fullname) if mpnum then - return figures.checkers.nongeneric(data,format("\\docheckfiguremprun{%s}{%s}",mprun,mpnum)) + return checkers.nongeneric(data,function() context.docheckfiguremprun(mprun,mpnum) end) else - return figures.checkers.nongeneric(data,format("\\docheckfiguremps{%s}",data.used.fullname)) + return checkers.nongeneric(data,function() context.docheckfiguremps(data.used.fullname) end) end end -figures.includers.mps = figures.includers.nongeneric --- -- -- buffer -- -- -- +includers.mps = includers.nongeneric -function figures.existers.buffer(askedname) - askedname = file.nameonly(askedname) - return buffers.exists(askedname) and askedname +-- -- -- tex -- -- -- + +function existers.tex(askedname) + askedname = resolvers.findfile(askedname) + return (askedname ~= "" and askedname) or false end -function figures.checkers.buffer(data) - return figures.checkers.nongeneric(data,format("\\docheckfigurebuffer{%s}", file.nameonly(data.used.fullname))) + +function checkers.tex(data) + return checkers.nongeneric(data,function() context.docheckfiguretex(data.used.fullname) end) end -figures.includers.buffers = figures.includers.nongeneric --- -- -- tex -- -- -- +includers.tex = includers.nongeneric -function figures.existers.tex(askedname) - askedname = resolvers.find_file(askedname) - return (askedname ~= "" and askedname) or false +-- -- -- buffer -- -- -- + +function existers.buffer(askedname) + local name = file.nameonly(askedname) + local okay = buffers.exists(name) + return okay and name, true -- always quit scanning end -function figures.checkers.tex(data) - return figures.checkers.nongeneric(data,format("\\docheckfiguretex{%s}", data.used.fullname)) + +function checkers.buffer(data) + return checkers.nongeneric(data,function() context.docheckfigurebuffer(file.nameonly(data.used.fullname)) end) +end + +includers.buffers = includers.nongeneric + +-- -- -- cld -- -- -- + +existers.cld = existers.tex + +function checkers.cld(data) + return checkers.nongeneric(data,function() context.docheckfigurecld(data.used.fullname) end) end -figures.includers.tex = figures.includers.nongeneric + +includers.cld = includers.nongeneric -- -- -- converters -- -- -- -local function makeoptions(program) +local function makeoptions(options) local to = type(options) return (to == "table" and concat(options," ")) or (to == "string" and options) or "" end @@ -903,7 +1041,7 @@ end local function runprogram(...) local command = format(...) if trace_conversion or trace_programs then - logs.report("figures","running %s",command) + report_inclusion("running %s",command) end os.spawn(command) end @@ -911,22 +1049,30 @@ end -- -- -- eps -- -- -- local epsconverter = { } -figures.converters.eps = epsconverter +converters.eps = epsconverter -figures.programs.gs = { +programs.gs = { + resolutions = { + [variables.low] = "screen", + [variables.medium] = "ebook", + [variables.high] = "prepress", + }, options = { "-dAutoRotatePages=/None", - "-dPDFSETTINGS=/prepress", + "-dPDFSETTINGS=/%s", "-dEPSCrop", }, - command = (os.type == "windows" and "gswin32") or "gs" + command = (os.type == "windows" and "gswin32c") or "gs" } -function epsconverter.pdf(oldname,newname) - local gs = figures.programs.gs +function epsconverter.pdf(oldname,newname,resolution) -- the resolution interface might change + local gs = programs.gs runprogram ( '%s -q -sDEVICE=pdfwrite -dNOPAUSE -dNOCACHE -dBATCH %s -sOutputFile="%s" "%s" -c quit', - gs.command, makeoptions(gs.options), newname, oldname + gs.command, + format(makeoptions(gs.options),gs.resolutions[resolution or ""] or "prepress"), + newname, + oldname ) end @@ -935,12 +1081,12 @@ epsconverter.default = epsconverter.pdf -- -- -- svg -- -- -- local svgconverter = { } -figures.converters.svg = svgconverter -figures.converters.svgz = svgconverter +converters.svg = svgconverter +converters.svgz = svgconverter -- inkscape on windows only works with complete paths -figures.programs.inkscape = { +programs.inkscape = { options = { "--export-dpi=600" }, @@ -948,15 +1094,17 @@ figures.programs.inkscape = { } function svgconverter.pdf(oldname,newname) - local inkscape = figures.programs.inkscape + local inkscape = programs.inkscape + local oldname = dir.expandname(oldname) + local newname = dir.expandname(newname) runprogram ( - '%s "%s" --export-pdf="%s" %s', - inkscape.command, oldname, newname, makeoptions(inkscape.options) + '%s "%s" %s -A "%s"', + inkscape.command, oldname, makeoptions(inkscape.options), newname ) end function svgconverter.png(oldname,newname) - local inkscape = figures.programs.inkscape + local inkscape = programs.inkscape runprogram ( '%s "%s" --export-png="%s" %s', inkscape.command, oldname, newname, makeoptions(inkscape.options) @@ -968,16 +1116,17 @@ svgconverter.default = svgconverter.pdf -- -- -- gif -- -- -- local gifconverter = { } -figures.converters.gif = gifconverter +converters.gif = gifconverter -figures.programs.convert = { - command = "convert" -- imagemagick +programs.convert = { + command = "convert" -- imagemagick + -- command = "gm convert" -- graphicmagick } function gifconverter.pdf(oldname,newname) - local convert = figures.programs.convert + local convert = programs.convert runprogram ( - "convert %s %s", + "%s %s %s %s", convert.command, makeoptions(convert.options), oldname, newname ) end @@ -1010,7 +1159,7 @@ function bases.use(basename) xml.registerns("rlx","http://www.pragma-ade.com/schemas/rlx") -- we should be able to do this per xml file end if trace_bases then - commands.writestatus("figures","registering base '%s'",basename) + report_inclusion("registering base '%s'",basename) end end end @@ -1018,7 +1167,7 @@ end function bases.find(basename,askedlabel) if trace_bases then - commands.writestatus("figures","checking for '%s' in base '%s'",askedlabel,basename) + report_inclusion("checking for '%s' in base '%s'",askedlabel,basename) end basename = file.addsuffix(basename,"xml") local t = bases.found[askedlabel] @@ -1035,7 +1184,7 @@ function bases.find(basename,askedlabel) base[2] = xmlfile base[3] = xml.load(xmlfile) if trace_bases then - commands.writestatus("figures","base '%s' loaded",xmlfile) + report_inclusion("base '%s' loaded",xmlfile) end break end @@ -1054,13 +1203,13 @@ function bases.find(basename,askedlabel) } bases.found[askedlabel] = t if trace_bases then - commands.writestatus("figures","figure '%s' found in base '%s'",askedlabel,base[2]) + report_inclusion("figure '%s' found in base '%s'",askedlabel,base[2]) end return t end end if trace_bases and not t then - commands.writestatus("figures","figure '%s' not found in base '%s'",askedlabel,base[2]) + report_inclusion("figure '%s' not found in base '%s'",askedlabel,base[2]) end end end @@ -1081,7 +1230,7 @@ function bases.locate(askedlabel) return false end -function figures.identifiers.base(data) +function identifiers.base(data) if bases.enabled then local dr, du, ds = data.request, data.used, data.status local fbl = bases.locate(dr.name or dr.label) @@ -1098,18 +1247,46 @@ function figures.identifiers.base(data) return data end -figures.identifiers.list = { - figures.identifiers.base, - figures.identifiers.default +identifiers.list = { + identifiers.base, + identifiers.default } -- tracing statistics.register("graphics processing time", function() - local n = figures.n - if n > 0 then - return format("%s seconds including tex, n=%s", statistics.elapsedtime(figures),n) + local nofprocessed = figures.nofprocessed + if nofprocessed > 0 then + return format("%s seconds including tex, %s processed images", statistics.elapsedtime(figures),nofprocessed) else return nil end end) + +-- helper + +function figures.applyratio(width,height,w,h) -- width and height are strings and w and h are numbers + if not width or width == "" then + if not height or height == "" then + return figures.defaultwidth, figures.defaultheight + else + height = string.todimen(height) + if w and h then + return height * w/h, height + else + return figures.defaultwidth, height + end + end + else + width = string.todimen(width) + if not height or height == "" then + if w and h then + return width, width * h/w + else + return width, figures.defaultheight + end + else + return width, string.todimen(height) + end + end +end diff --git a/Master/texmf-dist/tex/context/base/grph-inc.mkiv b/Master/texmf-dist/tex/context/base/grph-inc.mkiv index 16ee1097a2f..aa2157b9fa8 100644 --- a/Master/texmf-dist/tex/context/base/grph-inc.mkiv +++ b/Master/texmf-dist/tex/context/base/grph-inc.mkiv @@ -77,6 +77,7 @@ \def\figurexscale {\ctxlua{figures.tprint("status","xscale",1)}} \def\figureyscale {\ctxlua{figures.tprint("status","yscale",1)}} +\def\figuresize {\ctxlua{figures.tprint("request","size")}} \def\figurelabel {\ctxlua{figures.tprint("request","label")}} \def\figurefileoriginal {\ctxlua{figures.tprint("request","name")}} \def\figurefilepage {\ctxlua{figures.tprint("request","page",1)}} @@ -87,13 +88,20 @@ \def\figurenaturalwidth {\ctxlua{figures.tprint("used","width", \number\dimexpr\defaultfigurewidth \relax)}sp} \def\figurenaturalheight {\ctxlua{figures.tprint("used","height",\number\dimexpr\defaultfigureheight\relax)}sp} +\def\figurexresolution {\ctxlua{figures.tprint("used","xresolution",0)}} +\def\figureyresolution {\ctxlua{figures.tprint("used","yresolution",0)}} +\def\figurexsize {\ctxlua{figures.tprint("used","xsize",0)}} +\def\figureysize {\ctxlua{figures.tprint("used","ysize",0)}} +\def\figurecolordepth {\ctxlua{figures.tprint("used","colordepth",0)}} +\def\figuredepth {\ctxlua{figures.tprint("used","depth",0)}} -\def\figurefilepath {\ctxlua{tex.sprint(tex.ctxcatcodes,file.dirname (figures.get("used","fullname")))}} -\def\figurefilename {\ctxlua{tex.sprint(tex.ctxcatcodes,file.nameonly(figures.get("used","fullname")))}} -\def\figurefiletype {\ctxlua{tex.sprint(tex.ctxcatcodes,file.extname (figures.get("used","fullname")))}} \def\figurefullname {\ctxlua{figures.tprint("used","fullname")}} \def\noffigurepages {\ctxlua{figures.tprint("used","pages",0)}} +\def\figurefilepath {\ctxsprint{file.dirname (figures.get("used","fullname"))}} +\def\figurefilename {\ctxsprint{file.nameonly(figures.get("used","fullname"))}} +\def\figurefiletype {\ctxsprint{file.extname (figures.get("used","fullname"))}} + \let\naturalfigurewidth \figurenaturalwidth \let\naturalfigureheight \figurenaturalheight @@ -122,7 +130,8 @@ \let\@@efforegroundcolor\empty \let\@@efcolor \empty \let\@@efconversion \empty - \let\@@efbackground \empty} + \let\@@efbackground \empty + \let\@@efresolution \empty} \appendtoks \resetexternalfigures \to \everyoverlay \appendtoks \resetexternalfigures \to \everybeforepagebody % not really needed @@ -133,11 +142,13 @@ \let\@@eflabel \empty \let\@@efsize \empty \let\@@efconversion\@@exconversion + \let\@@efresolution\@@exresolution \let\@@efprefix \@@exprefix \let\@@efcache \@@excache \let\@@efpage \!!zerocount \let\@@efobject \@@exobject \let\@@efdisplay \empty + \let\@@efmask \empty % \let\@@efpreset \v!yes \let\@@efsplit \empty @@ -146,11 +157,14 @@ \let\@@efsymbol \v!no % \let\@@efcontrols \v!no + \let\@@efresources \empty \let\@@efpreview \v!no \let\@@efrepeat \v!no % \let\@@efforegroundcolor\empty % + \let\@@efinteraction\@@exinteraction + % \let\@@efhfactor \empty \let\@@efwfactor \empty \let\@@effactor \empty @@ -202,8 +216,12 @@ \def\doprocessmpslikefigure#1% retrofit into mkii {\global\setbox\foundexternalfigure\vbox{\convertMPtoPDF{#1}11}} +\def\doprocesscldlikefigure#1% + {\global\setbox\foundexternalfigure\vbox{\cldprocessfile{#1}}} + \def\docheckfigurebuffer #1{\doprocesstexlikefigure{\getbuffer[#1]}} -\def\docheckfiguretex #1{\doprocesstexlikefigure{\input#1\relax}} +\def\docheckfiguretex #1{\doprocesstexlikefigure{\input{#1}}} +\def\docheckfigurecld #1{\doprocesscldlikefigure{#1}} % we can always add cldrun \def\docheckfiguremps #1{\doprocessmpslikefigure{#1}} \def\docheckfiguremprun #1#2{\doprocesstexlikefigure{\useMPrun{#1}{#2}}} @@ -227,23 +245,26 @@ % \color[\@@efcolor]{\xdef\globcolorattr{\internalspotcolorname}} % \endgroup \ctxlua{figures.push { - name="#3", - label="#2", % todo: \@eflabel - page="\@@efpage", - size="\@@efsize", - object="\@@efobject", - prefix="\@@efprefix", - cache="\@@efcache", - format="\@@efmethod", - preset="\@@efprefix", - controls="\@@efcontrols", - preview="\@@efpreview", - display="\@@efdisplay", - conversion="\@@efconversion", - color="\internalspotcolorparent\@@efcolor", % hack is needed - ["repeat"]="\@@efrepeat", - width="\@@efwidth", % can be crap - height="\@@efheight", % can be crap + name = "#3", + label = "#2", % todo: \@eflabel + page = "\@@efpage", + size = "\@@efsize", + object = "\@@efobject", + prefix = "\@@efprefix", + cache = "\@@efcache", + format = "\@@efmethod", + preset = "\@@efprefix", + controls = "\@@efcontrols", + resources = "\@@efresources", + preview = "\@@efpreview", + display = "\@@efdisplay", + mask = "\@@efmask", + conversion = "\@@efconversion", + resolution = "\@@efresolution", + color = "\internalspotcolorparent\@@efcolor", % hack is needed + ["repeat"] = "\@@efrepeat", + width = "\@@efwidth", % can be crap + height = "\@@efheight", % can be crap } }% \ctxlua{figures.identify()}% \ifconditional\testexternalfigureonly @@ -355,7 +376,7 @@ \def\dogetfiguredimensions[#1][#2]% {\startnointerference \settrue\testexternalfigureonly - \externalfigure[#1][#2,\c!display=,\c!object=\v!no]% + \externalfigure[#1][#2,\c!display=,\c!mask=,\c!object=\v!no]% \stopnointerference} \let\getfiguredimensionsonly\getfiguredimensions @@ -376,9 +397,17 @@ \testexternalfigureonly \setfalse\externalfigureflush % == test ? \externalfigure[#1][#2][#3]% or \doexternalfigure - \externalfigure[#1][#2,\c!display=,\c!object=\v!no]% + \externalfigure[#1][#2,\c!display=,\c!mask=,\c!object=\v!no]% \stopnointerference} +% helpers (will be replaced when xforms are accessible at the lua end) + +\def\dosetfigureobject#1% + {\setobject{FIG}{#1}\vbox{\box\foundexternalfigure}} + +\def\doboxfigureobject#1% + {\global\setbox\foundexternalfigure\vbox{\getobject{FIG}{#1}}} % probably one vbox too many + % figurebases \def\usefigurebase[#1]% diff --git a/Master/texmf-dist/tex/context/base/grph-raw.lua b/Master/texmf-dist/tex/context/base/grph-raw.lua new file mode 100644 index 00000000000..361f6944d78 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/grph-raw.lua @@ -0,0 +1,39 @@ +if not modules then modules = { } end modules ['grph-raw'] = { + version = 1.001, + comment = "companion to grph-raw.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- This module is for Mojca, who wanted something like this for +-- her gnuplot project. It's somewhat premliminary code but it +-- works ok for that purpose. + +local report_bitmap = logs.reporter("graphics","bitmaps") + +local texsp = tex.sp + +function figures.bitmapimage(t) + local data = t.data + local xresolution = tonumber(t.xresolution) + local yresolution = tonumber(t.yresolution) + if data and xresolution and yresolution then + local width, height = t.width or "", t.height or "" + local n = backends.nodeinjections.injectbitmap { + xresolution = xresolution, + yresolution = yresolution, + width = width ~= "" and texsp(width) or nil, + height = height ~= "" and texsp(height) or nil, + data = data, + colorspace = t.colorspace, + } + if n then + context.hbox(n) + else + report_bitmap("format no supported by backend") + end + else + report_bitmap("invalid specification") + end +end diff --git a/Master/texmf-dist/tex/context/base/grph-raw.mkiv b/Master/texmf-dist/tex/context/base/grph-raw.mkiv new file mode 100644 index 00000000000..426262b4f8e --- /dev/null +++ b/Master/texmf-dist/tex/context/base/grph-raw.mkiv @@ -0,0 +1,64 @@ +%D \module +%D [ file=grph-raw, +%D version=2006.08.26, % overhaul of 1997.03.31 +%D title=\CONTEXT\ Graphic Macros, +%D subtitle=Raw Bitmaps, +%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 Graphic Macros / Raw Bitmaps} + +%D \startluacode +%D function document.TestBitmap(nx,ny) +%D local random = math.random +%D local maxbit = 2^24 +%D for i=1,nx do +%D for i=1,ny do +%D context("%06x",random(0,maxbit)) +%D end +%D end +%D end +%D \stopluacode +%D +%D \def\TestBitmap#1#2{\ctxlua{document.TestBitmap(#1,#2)}} +%D +%D \blank +%D +%D \startMPcode +%D draw textext("\bitmapimage[x=100,y=100]{\TestBitmap{100}{100}}") xsized 10cm ; +%D \stopMPcode +%D +%D \blank +%D +%D \startMPcode +%D draw textext("\bitmapimage[x=200,y=50]{\TestBitmap{50}{200}}") xsized 10cm ; +%D \stopMPcode + +\registerctxluafile{grph-raw}{1.001} + +\unprotect + +\unexpanded\def\bitmapimage[#1]#2% + {\hbox\bgroup + \getparameters[@@im][\c!color=rgb,\c!width=,\c!height=,\c!x=,\c!y=,#1]% + \ctxlua{figures.bitmapimage { + data = \!!bs#2\!!es, + xresolution = "\@@imx", + yresolution = "\@@imy", + colorspace = "\@@imcolor", + width = "\@@imwidth", + height = "\@@imheight" + }}% + \egroup} + +\unexpanded\def\startbitmapimage[#1]#2\stopbitmapimage + {\bitmapimage[#1]{#2}} + +\let\stopbitmapimage\relax + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/grph-swf.lua b/Master/texmf-dist/tex/context/base/grph-swf.lua index e55454b52b5..88eed021a22 100644 --- a/Master/texmf-dist/tex/context/base/grph-swf.lua +++ b/Master/texmf-dist/tex/context/base/grph-swf.lua @@ -6,35 +6,85 @@ if not modules then modules = { } end modules ['grph-swf'] = { license = "see context related readme files" } -local format = string.format +local sub, format, match, byte = string.sub, string.format, string.match, string.byte +local readstring, readnumber = io.readstring, io.readnumber +local concat = table.concat +local floor = math.floor +local tonumber = tonumber +local tobitstring = number.tobitstring -local texsprint = tex.sprint -local ctxcatcodes = tex.ctxcatcodes -local pdfannotation = nodes.pdfannotation +local todimen = number.todimen + +local nodeinjections = backends.nodeinjections + +local figures = figures +local context = context + +local function getheader(name) + local f = io.open(name,"rb") + if not f then + return + end + local signature = readstring(f,3) -- F=uncompressed, C=compressed (zlib) + local version = readnumber(f,1) + local filelength = readnumber(f,-4) + local compressed = sub(signature,1,1) == "C" + local buffer + if compressed then + buffer = zlib.decompress(f:read('*a')) + else + buffer = f:read(20) -- ('*a') + end + f:close() + buffer = { match(buffer,"(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)") } + for i=1,9 do + buffer[i] = tobitstring(byte(buffer[i])) + end + local framebits = concat(buffer,"",1,9) + local n = tonumber(sub(framebits,1,5),2) + local frame = { } -- xmin xmax ymin ymax + local xmin = tonumber(sub(framebits,6, 5 + n),2) + local xmax = tonumber(sub(framebits,6 + 1*n,5 + 2*n),2) + local ymin = tonumber(sub(framebits,6 + 2*n,5 + 3*n),2) + local ymax = tonumber(sub(framebits,6 + 3*n,5 + 4*n),2) + return { + filename = name, + version = version, + filelength = filelength, + framerate = tonumber(byte(buffer[10]) * 256 + byte(buffer[11])), + framecount = tonumber(byte(buffer[12]) * 256 + byte(buffer[13])), + -- framebits = framebits, + compressed = compressed, + width = floor((xmax - xmin) / 20), + height = floor((ymax - ymin) / 20), + rectangle = { + xmin = xmin, + xmax = xmax, + ymin = ymin, + ymax = ymax, + } + } +end function figures.checkers.swf(data) local dr, du, ds = data.request, data.used, data.status - local width = (dr.width or figures.defaultwidth):todimen() - local height = (dr.height or figures.defaultheight):todimen() local foundname = du.fullname + local header = getheader(foundname) + local width, height = figures.applyratio(dr.width,dr.height,header.width,header.height) dr.width, dr.height = width, height du.width, du.height, du.foundname = width, height, foundname - texsprint(ctxcatcodes,format("\\startfoundexternalfigure{%ssp}{%ssp}",width,height)) - local annot, preview, ref = backends.pdf.helpers.insertswf { + context.startfoundexternalfigure(todimen(width),todimen(height)) + nodeinjections.insertswf { foundname = foundname, width = width, height = height, -- factor = number.dimenfactors.bp, - -- display = dr.display, - -- controls = dr.controls, + display = dr.display, + controls = dr.controls, -- label = dr.label, + resources = dr.resources, } - -- node.write(pdfannotation(width,-height,0,annot())) - texsprint(ctxcatcodes,format("\\pdfannot width %ssp height %ssp {%s}",width,height,annot())) -- brrrr ---~ if ref then -- wrong ! a direct ref should work ---~ texsprint(ctxcatcodes,format("\\smash{\\pdfrefximage%s\\relax}",ref)) -- brrrr ---~ end - texsprint(ctxcatcodes,"\\stopfoundexternalfigure") + context.stopfoundexternalfigure() return data end diff --git a/Master/texmf-dist/tex/context/base/grph-u3d.lua b/Master/texmf-dist/tex/context/base/grph-u3d.lua index f3bf1763115..f2baac2f316 100644 --- a/Master/texmf-dist/tex/context/base/grph-u3d.lua +++ b/Master/texmf-dist/tex/context/base/grph-u3d.lua @@ -10,7 +10,11 @@ if not modules then modules = { } end modules ['grph-u3d'] = { local trace_inclusion = false trackers.register("figures.inclusion", function(v) trace_inclusion = v end) -local pdfannotation = nodes.pdfannotation +local report_u3d = logs.reporter("graphics","u3d") + +local figures = figures + +local nodeinjections = backends.nodeinjections local todimen = string.todimen -- maybe todo: backends.codeinjections.insertu3d @@ -23,21 +27,19 @@ function figures.checkers.u3d(data) dr.width, dr.height = width, height du.width, du.height, du.foundname = width, height, foundname if trace_inclusion then - logs.report("figures","including u3d '%s': width %s, height %s",foundname,width,height) + report_u3d("including u3d '%s': width %s, height %s",foundname,width,height) end context.startfoundexternalfigure(width .. "sp",height .. "sp") context(function() - local annotation, preview, ref = backends.pdf.helpers.insert3d { - foundname = foundname, - width = width, - height = height, - factor = number.dimenfactors.bp, - display = dr.display, - controls = dr.controls, - label = dr.label, + nodeinjections.insertu3d { + foundname = foundname, + width = width, + height = height, + factor = number.dimenfactors.bp, + display = dr.display, + controls = dr.controls, + label = dr.label, } ---~ print(annotation, preview, ref) - node.write(pdfannotation(width,height,0,annotation())) end) context.stopfoundexternalfigure() return data diff --git a/Master/texmf-dist/tex/context/base/grph-wnd.lua b/Master/texmf-dist/tex/context/base/grph-wnd.lua new file mode 100644 index 00000000000..0ea3f8c43d9 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/grph-wnd.lua @@ -0,0 +1,47 @@ +if not modules then modules = { } end modules ['grph-wnd'] = { + version = 1.001, + comment = "companion to grph-inc.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- Thanks to Luigi Scarso for making graphic magic work in luatex. +-- +-- \externalfigure[hacker.jpeg][width=4cm,conversion=gray.jpg] + +local converters, suffixes = figures.converters, figures.suffixes + +local trace_conversion = false trackers.register("figures.conversion", function(v) trace_conversion = v end) + +local report_wand = logs.reporter("graphics","wand") + +local function togray(oldname,newname) + if lfs.isfile(oldname) then + require("gmwand") + if trace_conversion then + report_wand("converting '%s' to '%s' using gmwand",oldname,newname) + end + gmwand.InitializeMagick("./") -- What does this path do? + local wand = gmwand.NewMagickWand() + gmwand.MagickReadImage(wand,oldname) + gmwand.MagickSetImageColorspace(wand,gmwand.GRAYColorspace) + gmwand.MagickWriteImages(wand,newname,1) + gmwand.DestroyMagickWand(wand) + else + report_wand("unable to convert '%s' to '%s' using gmwand",oldname,newname) + end +end + +local formats = { "png", "jpg", "gif" } + +for i=1,#formats do + local oldformat = formats[i] + local newformat = "gray." .. oldformat + if trace_conversion then + report_wand("installing converter: %s -> %s",oldformat,newformat) + end + converters[oldformat] = converters[oldformat] or { } + converters[oldformat][newformat] = togray + suffixes [newformat] = oldformat +end diff --git a/Master/texmf-dist/tex/context/base/hand-ini.mkiv b/Master/texmf-dist/tex/context/base/hand-ini.mkiv index 0285b10cbb1..7b973205992 100644 --- a/Master/texmf-dist/tex/context/base/hand-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/hand-ini.mkiv @@ -42,8 +42,8 @@ \unexpanded\def\setupfontexpansion {\dodoubleargument\dosetupfontexpansion } \unexpanded\def\setupfontprotrusion{\dodoubleargument\dosetupfontprotrusion} -\def\dosetupfontexpansion [#1][#2]{\ctxlua{commands.setupfontexpansion ("#1","#2")}} -\def\dosetupfontprotrusion[#1][#2]{\ctxlua{commands.setupfontprotrusion("#1","#2")}} +\def\dosetupfontexpansion [#1][#2]{\ctxcommand{setupfontexpansion ("#1","#2")}} +\def\dosetupfontprotrusion[#1][#2]{\ctxcommand{setupfontprotrusion("#1","#2")}} % \setupfontprotrusion[quality-upright][vector=quality] % \setupfontprotrusion[quality-slanted][vector=quality,right=1.5] diff --git a/Master/texmf-dist/tex/context/base/java-ans.mkii b/Master/texmf-dist/tex/context/base/java-ans.mkii new file mode 100644 index 00000000000..636c894f931 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/java-ans.mkii @@ -0,0 +1,28 @@ +%D \module +%D [ file=java-ans, +%D version=1998.06.01, +%D title=\CONTEXT\ JavaScript Macros, +%D subtitle=Answer Analization, +%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. + +\startJSpreamble{Do_Check_Answer} used later + + function Do_Check_Answer (field, value) + { if (event.value.toLowerCase()==value.toLowerCase()) + { event.target.hidden = true } + % { event.target.display = display.hidden } + return("\040") } // funny, "" does not work + +\stopJSpreamble + +\startJScode{Check_Answer} uses {Do_Check_Answer} + event.value = Do_Check_Answer(JS_S_1, JS_S_2) ; +\stopJScode + +\endinput diff --git a/Master/texmf-dist/tex/context/base/java-ans.tex b/Master/texmf-dist/tex/context/base/java-ans.tex deleted file mode 100644 index 636c894f931..00000000000 --- a/Master/texmf-dist/tex/context/base/java-ans.tex +++ /dev/null @@ -1,28 +0,0 @@ -%D \module -%D [ file=java-ans, -%D version=1998.06.01, -%D title=\CONTEXT\ JavaScript Macros, -%D subtitle=Answer Analization, -%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. - -\startJSpreamble{Do_Check_Answer} used later - - function Do_Check_Answer (field, value) - { if (event.value.toLowerCase()==value.toLowerCase()) - { event.target.hidden = true } - % { event.target.display = display.hidden } - return("\040") } // funny, "" does not work - -\stopJSpreamble - -\startJScode{Check_Answer} uses {Do_Check_Answer} - event.value = Do_Check_Answer(JS_S_1, JS_S_2) ; -\stopJScode - -\endinput diff --git a/Master/texmf-dist/tex/context/base/java-exa.mkii b/Master/texmf-dist/tex/context/base/java-exa.mkii new file mode 100644 index 00000000000..f40f70f84df --- /dev/null +++ b/Master/texmf-dist/tex/context/base/java-exa.mkii @@ -0,0 +1,395 @@ +%D \module +%D [ file=java-exa, +%D version=2002.??.??, +%D title=\CONTEXT\ JavaScript Macros, +%D subtitle=Example 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. + +% XFDF versus HTML +% localhost versus remote versus set + +% filename | filename-nr => name +% fakename | fakename-nr => file upload, unless localhost +% +% we erase the list because otherwise we end up in browser remembering +% problems; also, it is not possible to set upload fields 'manually' + +\startJSpreamble request_1 used now + + var example_method = "HTML" ; + var example_host = "" ; + var example_port = "" ; + var example_url = "" ; + var example_file = "" ; + + var example_log = true ; % false + + function stripped_exa_value( name ) { + f = this.getField(name) ; + if (f) { + str = f.value ; + if (str.indexOf(name+'-')==0) { + str = str.substr(name.length+1) ; + } + return str ; + } else { + return "" ; + } + } + + function identify_example_url ( ) { + if (example_log) { + console.clear ; + console.println("base url: "+this.baseURL) ; + console.println("this url: "+this.URL) ; + } + if (this.baseURL != "") { + example_url = this.baseURL ; + } else { + if (this.URL != "") { + example_url = this.URL + } + } + if (example_url.indexOf("file://")>=0) { + example_url = "" ; + } + str = stripped_exa_value("examplehost") ; + if (str != "auto") { + example_host = str ; + if (str == "localhost") { + example_port = "8061" + } + } + str = stripped_exa_value("exampleport") ; + if (str != "auto") { + example_port = str ; + } + if (example_log) { + console.println("example_url: "+example_url) ; + console.println("example_host: "+example_host) ; + console.println("example_port: "+example_port) ; + } + } + + function check_example_url ( url ) { + if (url.indexOf("file://")>=0) { + url = "http://localhost:8061" ; + console.println("file url replaced by: "+url) ; + } else { + if (url.indexOf("://")<0) { + url = "http://" + url ; + } + if (example_log) { + console.println("url before check: "+url) ; + } +% url = url.replace(/(http:\\\/\\\/.+)(\\\/.*$)/, "$1") ; + url = url.replace(/(https*:\\\/\\\/.+?)(\\\/.*$)/, "$1/exarequest") ; + if (example_log) { + console.println("url after check: "+url) ; + } + } + return url ; + } + + function set_example_xfdf ( method ) { + example_method = method ; + } + + function set_example_file ( file ) { + example_method = file ; + } + + function set_example_host ( host ) { + example_host = host ; + } + + function set_example_port ( port ) { + example_host = host ; + } + + function do_erase_example_file(tag) { + f = this.getField(tag) ; + if (f) { + f.value = "" ; + } + } + + function do_erase_example_list(tag) { + for (i=1;i<=100;i++) { + f = this.getField(tag+"-"+i) ; + if (f) { + f.value = "" ; + } else { + return + } + } + } + + function do_submit_example_url ( url ) { + if ((example_method == "XFDF" ) || (url.indexOf("localhost")>=0)) { + do_erase_example_file("fakename") ; + do_erase_example_list("fakename") ; + } + url = check_example_url(url) ; + if (example_log) { + console.println("submitting form to "+url+" using method "+example_method) ; + } + if (example_file != "") { + url = url + "/" + example_file ; + } + % we need the bFDF for acrobat 5 + this.submitForm({cURL : url, bFDF : false, cSubmitAs : example_method}) ; + } + + function submit_example_form ( ) { + identify_example_url() ; + if (example_host != "") { + if (example_port != "") { + do_submit_example_url(example_host+":"+example_port) ; + } else { + do_submit_example_url(example_host) ; + } + } else { + if (example_url != "") { + do_submit_example_url(example_url) ; + } else { + if (example_port != "") { + do_submit_example_url("localhost"+":"+example_port) ; + } else { + do_submit_example_url("localhost:8061") ; % local exampler + } + } + } + resetfilename () ; + } + + function submit_form ( host, port) { + set_example_host(host) ; + set_example_post(post) ; + submit_example_form ; + } + +\stopJSpreamble + +\startJSpreamble request_2 used now + + var exa_command = "" ; + var exa_option = "" ; + var exa_filename = "" ; + var exa_filelist = "" ; + var exa_registered = "" ; + + function set_request (command,option) { + exa_command = command ; + if (exa_command == "") { + exa_option = option ; + } else { if (option == "") { + exa_option = "" ; + } else { if (option.indexOf("--")<0) { + exa_option = "--action=" + option ; + } else { + exa_option = option ; + } } } + } + + function assemble_request ( ) { + v = this.getField('filename') ; + if (v) { + exa_filename = v.value ; + } + v = this.getField('filelist') ; + if (v) { + exa_filelist = v.value ; + } +% exa_filename = exa_filename.replace(/\\\\/g,'/') ; +% exa_filelist = exa_filelist.replace(/\\\\/g,'/') ; + str = "\\n" ; + str = str+"" ; + if (exa_filelist == "") { + exa_filelist = exa_registered ; + } else { if (exa_registered != "") { + exa_filelist = exa_filelist + "\\n" + exa_registered ; + } } + if (exa_command != "") { + str = str+""+exa_command+"" ; + } + if (exa_option != "") { + str = str+""+exa_option+"" ; + } + if (exa_filename != "") { + str = str+""+exa_filename+"" ; + } + var fls = "" ; + if (exa_filelist != "") { + % old method, soon obsolete + lst = exa_filelist.split(/\\s/) ; + for (i=0;i"+lst[i]+"" ; + } + } else { if (exa_multiple) { + for (i=1;i<=100;i++) { + % console.println("file field "+i) ; + f = this.getField("filename-"+ i) ; +% if (f) { if (f.value != "") { +% if (g) { if (g.value == "") { +% fls = fls+""+f.value+"" ; +% } else { +% fls = fls+""+f.value+"" ; +% } } else { +% fls = fls+""+f.value+"" ; +% } +% } } + if (f) { if (f.value != "") { + fls = fls + "" ; + } else { + % console.println("b") ; + fls = fls + " label='" + g.value + "'>" ; + } } else { + % console.println("c") ; + fls = fls + ">" ; + } + fls = fls + f.value + "" ; + } } + } + } } + if (fls != "") { + str = str + "" + fls + "" ; + } + str = str + "" ; + v = this.getField('exa:request') ; + if (v) { + v.value = str ; + } + } + +\stopJSpreamble + +\startJSpreamble request_3 used now + + var exa_multiple = false ; + + function setfilename ( suffixes ) { + if (event.targetName) { + var name = event.targetName ; + var fake = name.replace(/filename/,"fakename") ; + } else { + var name = 'filename' ; + var fake = 'fakename' ; + } + f = this.getField(fake) ; + if (f) { + f.browseForFileToSubmit() ; + if ((suffixes != "") && (f.value != "")) { + % + s = suffixes.replace(/,/g,"|") ; + r = new RegExp() ; + s = "\\\\.(" + s + ")$" ; + r.compile(s, "i") ; + if (f.value.search(r)<=0) { + f.value = "" ; + app.alert('This filetype is not permitted.') ; + % + % lst = suffixes.split(/,/) ; + % ok = false ; + % for (i=0;i=0) { +% f.value = "" ; +% } +% } + } + this.dirty = false ; + } + + function addfilename () { + if (exa_multiple) { + h = this.getField("filelist") ; + g = this.getField("filename") ; + if ((g) && (h)) { + str = g.value ; + if (h.value == "") { + h.value = str ; + } else { + h.value = h.value + "\\n" + str ; + } + g.value = "" ; + this.value = "" ; + } + } + this.dirty = false ; + } + + % this only works with client that assembles request + + function registerfilename (str) { + if (str!="") { + h = this.getField("filelist") ; + if (h) { + if (h.value != "") { + h.value = h.value + "\\n" ; + } + h.value = h.value + str ; + } else { + if (exa_registered != "") { + exa_registered = exa_registered + "\\n" ; + } + exa_registered = exa_registered + str ; + } + } + console.show ; + console.println('registered files') ; + console.println("file: "+str) ; + console.println("list: "+exa_registered) ; + this.dirty = false ; + } + + function checkfilename () { + } + + function getfilename ( suffixes ) { + setfilename(suffixes) ; + checkfilename() ; + addfilename() ; + } + + function resetfilename () { + do_erase_example_file("fakename") ; + do_erase_example_file("filename") ; + do_erase_example_file("filelist") ; + do_erase_example_list("filename") ; + do_erase_example_list("fakename") ; + } + +\stopJSpreamble + +\endinput diff --git a/Master/texmf-dist/tex/context/base/java-exa.tex b/Master/texmf-dist/tex/context/base/java-exa.tex deleted file mode 100644 index f40f70f84df..00000000000 --- a/Master/texmf-dist/tex/context/base/java-exa.tex +++ /dev/null @@ -1,395 +0,0 @@ -%D \module -%D [ file=java-exa, -%D version=2002.??.??, -%D title=\CONTEXT\ JavaScript Macros, -%D subtitle=Example 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. - -% XFDF versus HTML -% localhost versus remote versus set - -% filename | filename-nr => name -% fakename | fakename-nr => file upload, unless localhost -% -% we erase the list because otherwise we end up in browser remembering -% problems; also, it is not possible to set upload fields 'manually' - -\startJSpreamble request_1 used now - - var example_method = "HTML" ; - var example_host = "" ; - var example_port = "" ; - var example_url = "" ; - var example_file = "" ; - - var example_log = true ; % false - - function stripped_exa_value( name ) { - f = this.getField(name) ; - if (f) { - str = f.value ; - if (str.indexOf(name+'-')==0) { - str = str.substr(name.length+1) ; - } - return str ; - } else { - return "" ; - } - } - - function identify_example_url ( ) { - if (example_log) { - console.clear ; - console.println("base url: "+this.baseURL) ; - console.println("this url: "+this.URL) ; - } - if (this.baseURL != "") { - example_url = this.baseURL ; - } else { - if (this.URL != "") { - example_url = this.URL - } - } - if (example_url.indexOf("file://")>=0) { - example_url = "" ; - } - str = stripped_exa_value("examplehost") ; - if (str != "auto") { - example_host = str ; - if (str == "localhost") { - example_port = "8061" - } - } - str = stripped_exa_value("exampleport") ; - if (str != "auto") { - example_port = str ; - } - if (example_log) { - console.println("example_url: "+example_url) ; - console.println("example_host: "+example_host) ; - console.println("example_port: "+example_port) ; - } - } - - function check_example_url ( url ) { - if (url.indexOf("file://")>=0) { - url = "http://localhost:8061" ; - console.println("file url replaced by: "+url) ; - } else { - if (url.indexOf("://")<0) { - url = "http://" + url ; - } - if (example_log) { - console.println("url before check: "+url) ; - } -% url = url.replace(/(http:\\\/\\\/.+)(\\\/.*$)/, "$1") ; - url = url.replace(/(https*:\\\/\\\/.+?)(\\\/.*$)/, "$1/exarequest") ; - if (example_log) { - console.println("url after check: "+url) ; - } - } - return url ; - } - - function set_example_xfdf ( method ) { - example_method = method ; - } - - function set_example_file ( file ) { - example_method = file ; - } - - function set_example_host ( host ) { - example_host = host ; - } - - function set_example_port ( port ) { - example_host = host ; - } - - function do_erase_example_file(tag) { - f = this.getField(tag) ; - if (f) { - f.value = "" ; - } - } - - function do_erase_example_list(tag) { - for (i=1;i<=100;i++) { - f = this.getField(tag+"-"+i) ; - if (f) { - f.value = "" ; - } else { - return - } - } - } - - function do_submit_example_url ( url ) { - if ((example_method == "XFDF" ) || (url.indexOf("localhost")>=0)) { - do_erase_example_file("fakename") ; - do_erase_example_list("fakename") ; - } - url = check_example_url(url) ; - if (example_log) { - console.println("submitting form to "+url+" using method "+example_method) ; - } - if (example_file != "") { - url = url + "/" + example_file ; - } - % we need the bFDF for acrobat 5 - this.submitForm({cURL : url, bFDF : false, cSubmitAs : example_method}) ; - } - - function submit_example_form ( ) { - identify_example_url() ; - if (example_host != "") { - if (example_port != "") { - do_submit_example_url(example_host+":"+example_port) ; - } else { - do_submit_example_url(example_host) ; - } - } else { - if (example_url != "") { - do_submit_example_url(example_url) ; - } else { - if (example_port != "") { - do_submit_example_url("localhost"+":"+example_port) ; - } else { - do_submit_example_url("localhost:8061") ; % local exampler - } - } - } - resetfilename () ; - } - - function submit_form ( host, port) { - set_example_host(host) ; - set_example_post(post) ; - submit_example_form ; - } - -\stopJSpreamble - -\startJSpreamble request_2 used now - - var exa_command = "" ; - var exa_option = "" ; - var exa_filename = "" ; - var exa_filelist = "" ; - var exa_registered = "" ; - - function set_request (command,option) { - exa_command = command ; - if (exa_command == "") { - exa_option = option ; - } else { if (option == "") { - exa_option = "" ; - } else { if (option.indexOf("--")<0) { - exa_option = "--action=" + option ; - } else { - exa_option = option ; - } } } - } - - function assemble_request ( ) { - v = this.getField('filename') ; - if (v) { - exa_filename = v.value ; - } - v = this.getField('filelist') ; - if (v) { - exa_filelist = v.value ; - } -% exa_filename = exa_filename.replace(/\\\\/g,'/') ; -% exa_filelist = exa_filelist.replace(/\\\\/g,'/') ; - str = "\\n" ; - str = str+"" ; - if (exa_filelist == "") { - exa_filelist = exa_registered ; - } else { if (exa_registered != "") { - exa_filelist = exa_filelist + "\\n" + exa_registered ; - } } - if (exa_command != "") { - str = str+""+exa_command+"" ; - } - if (exa_option != "") { - str = str+""+exa_option+"" ; - } - if (exa_filename != "") { - str = str+""+exa_filename+"" ; - } - var fls = "" ; - if (exa_filelist != "") { - % old method, soon obsolete - lst = exa_filelist.split(/\\s/) ; - for (i=0;i"+lst[i]+"" ; - } - } else { if (exa_multiple) { - for (i=1;i<=100;i++) { - % console.println("file field "+i) ; - f = this.getField("filename-"+ i) ; -% if (f) { if (f.value != "") { -% if (g) { if (g.value == "") { -% fls = fls+""+f.value+"" ; -% } else { -% fls = fls+""+f.value+"" ; -% } } else { -% fls = fls+""+f.value+"" ; -% } -% } } - if (f) { if (f.value != "") { - fls = fls + "" ; - } else { - % console.println("b") ; - fls = fls + " label='" + g.value + "'>" ; - } } else { - % console.println("c") ; - fls = fls + ">" ; - } - fls = fls + f.value + "" ; - } } - } - } } - if (fls != "") { - str = str + "" + fls + "" ; - } - str = str + "" ; - v = this.getField('exa:request') ; - if (v) { - v.value = str ; - } - } - -\stopJSpreamble - -\startJSpreamble request_3 used now - - var exa_multiple = false ; - - function setfilename ( suffixes ) { - if (event.targetName) { - var name = event.targetName ; - var fake = name.replace(/filename/,"fakename") ; - } else { - var name = 'filename' ; - var fake = 'fakename' ; - } - f = this.getField(fake) ; - if (f) { - f.browseForFileToSubmit() ; - if ((suffixes != "") && (f.value != "")) { - % - s = suffixes.replace(/,/g,"|") ; - r = new RegExp() ; - s = "\\\\.(" + s + ")$" ; - r.compile(s, "i") ; - if (f.value.search(r)<=0) { - f.value = "" ; - app.alert('This filetype is not permitted.') ; - % - % lst = suffixes.split(/,/) ; - % ok = false ; - % for (i=0;i=0) { -% f.value = "" ; -% } -% } - } - this.dirty = false ; - } - - function addfilename () { - if (exa_multiple) { - h = this.getField("filelist") ; - g = this.getField("filename") ; - if ((g) && (h)) { - str = g.value ; - if (h.value == "") { - h.value = str ; - } else { - h.value = h.value + "\\n" + str ; - } - g.value = "" ; - this.value = "" ; - } - } - this.dirty = false ; - } - - % this only works with client that assembles request - - function registerfilename (str) { - if (str!="") { - h = this.getField("filelist") ; - if (h) { - if (h.value != "") { - h.value = h.value + "\\n" ; - } - h.value = h.value + str ; - } else { - if (exa_registered != "") { - exa_registered = exa_registered + "\\n" ; - } - exa_registered = exa_registered + str ; - } - } - console.show ; - console.println('registered files') ; - console.println("file: "+str) ; - console.println("list: "+exa_registered) ; - this.dirty = false ; - } - - function checkfilename () { - } - - function getfilename ( suffixes ) { - setfilename(suffixes) ; - checkfilename() ; - addfilename() ; - } - - function resetfilename () { - do_erase_example_file("fakename") ; - do_erase_example_file("filename") ; - do_erase_example_file("filelist") ; - do_erase_example_list("filename") ; - do_erase_example_list("fakename") ; - } - -\stopJSpreamble - -\endinput diff --git a/Master/texmf-dist/tex/context/base/java-fil.mkii b/Master/texmf-dist/tex/context/base/java-fil.mkii new file mode 100644 index 00000000000..4d79a2ace9e --- /dev/null +++ b/Master/texmf-dist/tex/context/base/java-fil.mkii @@ -0,0 +1,48 @@ +%D \module +%D [ file=java-fil, +%D version=1998.06.01, +%D title=\CONTEXT\ JavaScript Macros, +%D subtitle=Filing and Printing, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\startJSpreamble Auxiliary used now + + function DocumentFileName () + { var Paths = this.path.split("/") ; + Paths = Paths[Paths.length-1].split(".") ; + return(Paths[0]) } + + function Print_Page_Range(From, To) % gaat mis, nog geen args mogelijk + { if ((Number(From)>0)&&(Number(To)>=Number(From))) + { var myFrom = Number(From)-1 ; + var myTo = Number(To)-1 ; + this.print(false,myFrom,myTo,true) } } + + function Print_This_Page () + { this.print(false,this.pageNum,this.pageNum,true) } + +\stopJSpreamble + +\definereference + [PrintSubPaginas] + [JS(Print_Page_Range{\firstsubpage,\lastsubpage})] + +\definereference + [PrintSubPages] + [JS(Print_Page_Range{\firstsubpage,\lastsubpage})] + +\definereference + [PrintDezePagina] + [JS(Print_This_Page)] + +\definereference + [PrintThisPage] + [JS(Print_This_Page)] + +\endinput diff --git a/Master/texmf-dist/tex/context/base/java-fil.tex b/Master/texmf-dist/tex/context/base/java-fil.tex deleted file mode 100644 index 4d79a2ace9e..00000000000 --- a/Master/texmf-dist/tex/context/base/java-fil.tex +++ /dev/null @@ -1,48 +0,0 @@ -%D \module -%D [ file=java-fil, -%D version=1998.06.01, -%D title=\CONTEXT\ JavaScript Macros, -%D subtitle=Filing and Printing, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\startJSpreamble Auxiliary used now - - function DocumentFileName () - { var Paths = this.path.split("/") ; - Paths = Paths[Paths.length-1].split(".") ; - return(Paths[0]) } - - function Print_Page_Range(From, To) % gaat mis, nog geen args mogelijk - { if ((Number(From)>0)&&(Number(To)>=Number(From))) - { var myFrom = Number(From)-1 ; - var myTo = Number(To)-1 ; - this.print(false,myFrom,myTo,true) } } - - function Print_This_Page () - { this.print(false,this.pageNum,this.pageNum,true) } - -\stopJSpreamble - -\definereference - [PrintSubPaginas] - [JS(Print_Page_Range{\firstsubpage,\lastsubpage})] - -\definereference - [PrintSubPages] - [JS(Print_Page_Range{\firstsubpage,\lastsubpage})] - -\definereference - [PrintDezePagina] - [JS(Print_This_Page)] - -\definereference - [PrintThisPage] - [JS(Print_This_Page)] - -\endinput diff --git a/Master/texmf-dist/tex/context/base/java-fld.mkii b/Master/texmf-dist/tex/context/base/java-fld.mkii new file mode 100644 index 00000000000..93a90dc0afc --- /dev/null +++ b/Master/texmf-dist/tex/context/base/java-fld.mkii @@ -0,0 +1,475 @@ +%D \module +%D [ file=java-fld, +%D version=1998.05.20, +%D title=\CONTEXT\ JavaScript Macros, +%D subtitle=Field 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. + +% will be simplified, since we now parse functions + +% nu nog alles geladen, moet dus anders + +\startJSpreamble {Sanitize_TeX_Input} used later + + function Sanitized_TeX_String (value) + { var v = value ; + v = v.replace( /\\\\oe/g,"\\234") ; + v = v.replace( /\\\\<>/g,"\\273") ; + v = v.replace( /\\\\`A/g,"\\300") ; + v = v.replace( /\\\\'A/g,"\\301") ; + v = v.replace( /\\\\^A/g,"\\302") ; + v = v.replace( /\\\\~A/g,"\\303") ; + v = v.replace( /\\\\"A/g,"\\304") ; + v = v.replace( /\\\\oA/g,"\\305") ; + v = v.replace( /\\\\AE/g,"\\306") ; + v = v.replace( /\\\\,C/g,"\\307") ; + v = v.replace( /\\\\`E/g,"\\310") ; + v = v.replace( /\\\\'E/g,"\\311") ; + v = v.replace( /\\\\^E/g,"\\312") ; + v = v.replace( /\\\\"E/g,"\\313") ; + v = v.replace( /\\\\`I/g,"\\314") ; + v = v.replace( /\\\\'I/g,"\\315") ; + v = v.replace( /\\\\^I/g,"\\316") ; + v = v.replace( /\\\\"I/g,"\\317") ; + v = v.replace( /\\\\~N/g,"\\321") ; + v = v.replace( /\\\\`O/g,"\\322") ; + v = v.replace( /\\\\'O/g,"\\323") ; + v = v.replace( /\\\\^O/g,"\\324") ; + v = v.replace( /\\\\~O/g,"\\325") ; + v = v.replace( /\\\\"O/g,"\\326") ; + v = v.replace( /\\\\`U/g,"\\331") ; + v = v.replace( /\\\\'U/g,"\\332") ; + v = v.replace( /\\\\^U/g,"\\333") ; + v = v.replace( /\\\\"U/g,"\\334") ; + v = v.replace( /\\\\'Y/g,"\\335") ; + v = v.replace( /\\\\ss/g,"\\337") ; + v = v.replace( /\\\\`a/g,"\\340") ; + v = v.replace( /\\\\'a/g,"\\341") ; + v = v.replace( /\\\\^a/g,"\\342") ; + v = v.replace( /\\\\~a/g,"\\343") ; + v = v.replace( /\\\\"a/g,"\\344") ; + v = v.replace( /\\\\oa/g,"\\345") ; + v = v.replace( /\\\\ae/g,"\\346") ; + v = v.replace( /\\\\,c/g,"\\347") ; + v = v.replace( /\\\\`e/g,"\\350") ; + v = v.replace( /\\\\'e/g,"\\351") ; + v = v.replace( /\\\\^e/g,"\\352") ; + v = v.replace( /\\\\"e/g,"\\353") ; + v = v.replace( /\\\\`i/g,"\\354") ; + v = v.replace( /\\\\'i/g,"\\355") ; + v = v.replace( /\\\\^i/g,"\\356") ; + v = v.replace( /\\\\"i/g,"\\357") ; + v = v.replace( /\\\\~n/g,"\\361") ; + v = v.replace( /\\\\`o/g,"\\362") ; + v = v.replace( /\\\\'o/g,"\\363") ; + v = v.replace( /\\\\^o/g,"\\364") ; + v = v.replace( /\\\\~o/g,"\\365") ; + v = v.replace( /\\\\"o/g,"\\366") ; + v = v.replace( /\\\\`u/g,"\\371") ; + v = v.replace( /\\\\'u/g,"\\372") ; + v = v.replace( /\\\\^u/g,"\\373") ; + v = v.replace( /\\\\"u/g,"\\374") ; + v = v.replace( /\\\\'y/g,"\\375") ; + v = v.replace( /\\\\"y/g,"\\377") ; + return(v) } + + var TeX_Key_Mode = 0 ; + + function Initialize_TeX_Keystroke () + { TeX_Key_Char = "" ; + TeX_Key_Mode = 0 } + + function Sanitized_TeX_Keystroke (change) + { if (change=="\\\\") + { TeX_Key_Mode = 1 ; + return("") } + else if (TeX_Key_Mode==1) + { TeX_Key_Mode = 2 ; + TeX_Key_Char = change ; + return("") } + else if (TeX_Key_Mode==2) + { TeX_Key_Mode = 0 ; + TeX_Key_Char = "\\\\"+TeX_Key_Char+change ; + return(Sanitized_TeX_String(TeX_Key_Char)) } + else + { TeX_Key_Mode = 0 ; + return(change) } } + +\stopJSpreamble + +\startJScode {Initialize_TeX_Key} uses {Sanitize_TeX_Input} + Initialize_TeX_Keystroke() ; +\stopJScode + +\startJScode {Convert_TeX_Key} uses {Sanitize_TeX_Input} + if (!event.willCommit) + { event.change = Sanitized_TeX_Keystroke(event.change) } +\stopJScode + +\startJScode{Convert_TeX_String} uses {Sanitize_TeX_Input} + event.value = Sanitized_TeX_String(event.value) ; +\stopJScode + +\startJSpreamble fields_1 used now + +var visible_field = new Array() ; +var visible_fields = 0 ; + +function PresetFields ( ) + { this.syncAnnotScan() } + +function Preset_Fields ( ) + { this.syncAnnotScan() } + +function Hide_When_Down ( ) + { event.target.hidden = true } + +function Hide_Field ( Name ) + { var v = this.getField(Name) ; + if (v) + { v.hidden = true ; + v.readonly = true ; + this.dirty = false } } + +function Do_Vide_Field ( Name, Closable ) + { var v = this.getField(Name) ; + if (v) + { ++visible_fields ; + visible_field[visible_fields] = Name ; + v.hidden = false ; + if (Closable) + { v.readonly = false ; + v.value = "On" } + this.dirty = false } } + +function Vide_Field ( Name ) + { Do_Vide_Field(Name,false) } + +function Vide_Hide_Field ( Name ) + { Do_Vide_Field(Name,true) } + +function Hide_Fields () + { while (visible_fields>0) + { Hide_Field(visible_field[visible_fields]) ; + --visible_fields } } + +function Vide_Fields ( Name ) + { Hide_Fields () ; + Vide_Field ( Name) } + +function Vide_Hide_Fields ( Name ) + { Hide_Fields () ; + Vide_Hide_Field ( Name) } + +function Toggle_Hide ( Name ) + { var v = this.getField(Name) ; + if (v) + { v.hidden = !v.hidden ; + this.dirty = false } } + +function Field_On ( Name ) + { v = this.getField(Name) ; + if (v) { v.value = "On" ; this.dirty = false } } + +function Field_Off ( Name ) + { var v = this.getField(Name) ; + if (v) { v.value = "Off" ; this.dirty = false } } + +function Toggle_Value ( Name ) + { var v = this.getField(Name) ; + if (v) + { if (v.value=="On") + { v.value = "Off" } + else + { v.value = "On" } } + this.dirty = false } + +function Toggle_Read ( Name ) + { var v = this.getField(Name); + if (v) { v.readonly = !v.readonly } } + +function Flip_Fields ( Name ) + { var Names = Name.split(",") ; + for (var i=0;i0) { + var v = this.getField(FieldSet + ":" + fieldset.number) ; + if (v) { + if (v.value == "On") { + v.value = "Off" ; + } + } + fieldset.number-- ; + v = this.getField(FieldSet + ":" + fieldset.number) ; + if (v) { + v.value = "On" ; + } + } + } +} + +function Next_Walk_Field ( FieldSet ) { + var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; + if (fieldset) { + Do_Stop_Auto_Walk_Field(FieldSet) ; + fieldset.running = false ; + fieldset.paused = false ; + var f = fieldset.number + 1 ; + var v = this.getField(FieldSet + ":" + f) ; + if (v) { + var v = this.getField(FieldSet + ":" + fieldset.number) ; + if (v) { + if (v.value == "On") { + v.value = "Off" ; + } + } + fieldset.number++ ; + v = this.getField(FieldSet + ":" + fieldset.number) ; + if (v) { + v.value = "On" ; + } + } + } +} + +function Set_Walk_Field_Delay ( FieldSet, Delay ) { + var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; + if (fieldset) { + if (Delay) { + fieldset.delay = Delay ; + if (fieldset.running) { + Do_Stop_Auto_Walk_Field(FieldSet) ; + Do_Start_Auto_Walk_Field(FieldSet) ; + } + } + } +} + +\stopJSpreamble + +\definereference[Walk] [JS(Walk_Field)] +\definereference[StartWalk] [JS(Start_Walk_Field)] +\definereference[StopWalk] [JS(Stop_Walk_Field)] +\definereference[PauseWalk] [JS(Pause_Walk_Field)] +\definereference[ResetWalk] [JS(Reset_Walk_Field)] +\definereference[PreviousWalk][JS(Previous_Walk_Field)] +\definereference[NextWalk] [JS(Next_Walk_Field)] +\definereference[SetWalkDelay][JS(Set_Walk_Field_Delay)] + +\endinput diff --git a/Master/texmf-dist/tex/context/base/java-fld.tex b/Master/texmf-dist/tex/context/base/java-fld.tex deleted file mode 100644 index 3c24b7e02db..00000000000 --- a/Master/texmf-dist/tex/context/base/java-fld.tex +++ /dev/null @@ -1,282 +0,0 @@ -%D \module -%D [ file=java-fld, -%D version=1998.05.20, -%D title=\CONTEXT\ JavaScript Macros, -%D subtitle=Field 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. - -% will be simplified, since we now parse functions - -% nu nog alles geladen, moet dus anders - -\startJSpreamble {Sanitize_TeX_Input} used later - - function Sanitized_TeX_String (value) - { var v = value ; - v = v.replace( /\\\\oe/g,"\\234") ; - v = v.replace( /\\\\<>/g,"\\273") ; - v = v.replace( /\\\\`A/g,"\\300") ; - v = v.replace( /\\\\'A/g,"\\301") ; - v = v.replace( /\\\\^A/g,"\\302") ; - v = v.replace( /\\\\~A/g,"\\303") ; - v = v.replace( /\\\\"A/g,"\\304") ; - v = v.replace( /\\\\oA/g,"\\305") ; - v = v.replace( /\\\\AE/g,"\\306") ; - v = v.replace( /\\\\,C/g,"\\307") ; - v = v.replace( /\\\\`E/g,"\\310") ; - v = v.replace( /\\\\'E/g,"\\311") ; - v = v.replace( /\\\\^E/g,"\\312") ; - v = v.replace( /\\\\"E/g,"\\313") ; - v = v.replace( /\\\\`I/g,"\\314") ; - v = v.replace( /\\\\'I/g,"\\315") ; - v = v.replace( /\\\\^I/g,"\\316") ; - v = v.replace( /\\\\"I/g,"\\317") ; - v = v.replace( /\\\\~N/g,"\\321") ; - v = v.replace( /\\\\`O/g,"\\322") ; - v = v.replace( /\\\\'O/g,"\\323") ; - v = v.replace( /\\\\^O/g,"\\324") ; - v = v.replace( /\\\\~O/g,"\\325") ; - v = v.replace( /\\\\"O/g,"\\326") ; - v = v.replace( /\\\\`U/g,"\\331") ; - v = v.replace( /\\\\'U/g,"\\332") ; - v = v.replace( /\\\\^U/g,"\\333") ; - v = v.replace( /\\\\"U/g,"\\334") ; - v = v.replace( /\\\\'Y/g,"\\335") ; - v = v.replace( /\\\\ss/g,"\\337") ; - v = v.replace( /\\\\`a/g,"\\340") ; - v = v.replace( /\\\\'a/g,"\\341") ; - v = v.replace( /\\\\^a/g,"\\342") ; - v = v.replace( /\\\\~a/g,"\\343") ; - v = v.replace( /\\\\"a/g,"\\344") ; - v = v.replace( /\\\\oa/g,"\\345") ; - v = v.replace( /\\\\ae/g,"\\346") ; - v = v.replace( /\\\\,c/g,"\\347") ; - v = v.replace( /\\\\`e/g,"\\350") ; - v = v.replace( /\\\\'e/g,"\\351") ; - v = v.replace( /\\\\^e/g,"\\352") ; - v = v.replace( /\\\\"e/g,"\\353") ; - v = v.replace( /\\\\`i/g,"\\354") ; - v = v.replace( /\\\\'i/g,"\\355") ; - v = v.replace( /\\\\^i/g,"\\356") ; - v = v.replace( /\\\\"i/g,"\\357") ; - v = v.replace( /\\\\~n/g,"\\361") ; - v = v.replace( /\\\\`o/g,"\\362") ; - v = v.replace( /\\\\'o/g,"\\363") ; - v = v.replace( /\\\\^o/g,"\\364") ; - v = v.replace( /\\\\~o/g,"\\365") ; - v = v.replace( /\\\\"o/g,"\\366") ; - v = v.replace( /\\\\`u/g,"\\371") ; - v = v.replace( /\\\\'u/g,"\\372") ; - v = v.replace( /\\\\^u/g,"\\373") ; - v = v.replace( /\\\\"u/g,"\\374") ; - v = v.replace( /\\\\'y/g,"\\375") ; - v = v.replace( /\\\\"y/g,"\\377") ; - return(v) } - - var TeX_Key_Mode = 0 ; - - function Initialize_TeX_Keystroke () - { TeX_Key_Char = "" ; - TeX_Key_Mode = 0 } - - function Sanitized_TeX_Keystroke (change) - { if (change=="\\\\") - { TeX_Key_Mode = 1 ; - return("") } - else if (TeX_Key_Mode==1) - { TeX_Key_Mode = 2 ; - TeX_Key_Char = change ; - return("") } - else if (TeX_Key_Mode==2) - { TeX_Key_Mode = 0 ; - TeX_Key_Char = "\\\\"+TeX_Key_Char+change ; - return(Sanitized_TeX_String(TeX_Key_Char)) } - else - { TeX_Key_Mode = 0 ; - return(change) } } - -\stopJSpreamble - -\startJScode {Initialize_TeX_Key} uses {Sanitize_TeX_Input} - Initialize_TeX_Keystroke() ; -\stopJScode - -\startJScode {Convert_TeX_Key} uses {Sanitize_TeX_Input} - if (!event.willCommit) - { event.change = Sanitized_TeX_Keystroke(event.change) } -\stopJScode - -\startJScode{Convert_TeX_String} uses {Sanitize_TeX_Input} - event.value = Sanitized_TeX_String(event.value) ; -\stopJScode - -\startJSpreamble fields_1 used now - -var visible_field = new Array() ; -var visible_fields = 0 ; - -function PresetFields ( ) - { this.syncAnnotScan() } - -function Preset_Fields ( ) - { this.syncAnnotScan() } - -function Hide_When_Down ( ) - { event.target.hidden = true } - -function Hide_Field ( Name ) - { var v = this.getField(Name) ; - if (v) - { v.hidden = true ; - v.readonly = true ; - this.dirty = false } } - -function Do_Vide_Field ( Name, Closable ) - { var v = this.getField(Name) ; - if (v) - { ++visible_fields ; - visible_field[visible_fields] = Name ; - v.hidden = false ; - if (Closable) - { v.readonly = false ; - v.value = "On" } - this.dirty = false } } - -function Vide_Field ( Name ) - { Do_Vide_Field(Name,false) } - -function Vide_Hide_Field ( Name ) - { Do_Vide_Field(Name,true) } - -function Hide_Fields () - { while (visible_fields>0) - { Hide_Field(visible_field[visible_fields]) ; - --visible_fields } } - -function Vide_Fields ( Name ) - { Hide_Fields () ; - Vide_Field ( Name) } - -function Vide_Hide_Fields ( Name ) - { Hide_Fields () ; - Vide_Hide_Field ( Name) } - -function Toggle_Hide ( Name ) - { var v = this.getField(Name) ; - if (v) - { v.hidden = !v.hidden ; - this.dirty = false } } - -function Field_On ( Name ) - { v = this.getField(Name) ; - if (v) { v.value = "On" ; this.dirty = false } } - -function Field_Off ( Name ) - { var v = this.getField(Name) ; - if (v) { v.value = "Off" ; this.dirty = false } } - -function Toggle_Value ( Name ) - { var v = this.getField(Name) ; - if (v) - { if (v.value=="On") - { v.value = "Off" } - else - { v.value = "On" } } - this.dirty = false } - -function Toggle_Read ( Name ) - { var v = this.getField(Name); - if (v) { v.readonly = !v.readonly } } - -function Flip_Fields ( Name ) - { var Names = Name.split(",") ; - for (var i=0;i name +% fakename | fakename-nr => file upload, unless localhost +% +% we erase the list because otherwise we end up in browser remembering +% problems; also, it is not possible to set upload fields 'manually' + +\startJSpreamble request_1 used now + + var example_method = "HTML" ; + var example_host = "" ; + var example_port = "" ; + var example_url = "" ; + var example_file = "" ; + + var example_log = true ; % false + + function stripped_exa_value( name ) { + f = this.getField(name) ; + if (f) { + str = f.value ; + if (str.indexOf(name+'-')==0) { + str = str.substr(name.length+1) ; + } + return str ; + } else { + return "" ; + } + } + + function identify_example_url ( ) { + if (example_log) { + console.clear ; + console.println("base url: "+this.baseURL) ; + console.println("this url: "+this.URL) ; + } + if (this.baseURL != "") { + example_url = this.baseURL ; + } else { + if (this.URL != "") { + example_url = this.URL + } + } + if (example_url.indexOf("file://")>=0) { + example_url = "" ; + } + str = stripped_exa_value("examplehost") ; + if (str != "auto") { + example_host = str ; + if (str == "localhost") { + example_port = "8061" + } + } + str = stripped_exa_value("exampleport") ; + if (str != "auto") { + example_port = str ; + } + if (example_log) { + console.println("example_url: "+example_url) ; + console.println("example_host: "+example_host) ; + console.println("example_port: "+example_port) ; + } + } + + function check_example_url ( url ) { + if (url.indexOf("file://")>=0) { + url = "http://localhost:8061" ; + console.println("file url replaced by: "+url) ; + } else { + if (url.indexOf("://")<0) { + url = "http://" + url ; + } + if (example_log) { + console.println("url before check: "+url) ; + } +% url = url.replace(/(http:\\\/\\\/.+)(\\\/.*$)/, "$1") ; + url = url.replace(/(https*:\\\/\\\/.+?)(\\\/.*$)/, "$1/exarequest") ; + if (example_log) { + console.println("url after check: "+url) ; + } + } + return url ; + } + + function set_example_xfdf ( method ) { + example_method = method ; + } + + function set_example_file ( file ) { + example_method = file ; + } + + function set_example_host ( host ) { + example_host = host ; + } + + function set_example_port ( port ) { + example_host = host ; + } + + function do_erase_example_file(tag) { + f = this.getField(tag) ; + if (f) { + f.value = "" ; + } + } + + function do_erase_example_list(tag) { + for (i=1;i<=100;i++) { + f = this.getField(tag+"-"+i) ; + if (f) { + f.value = "" ; + } else { + return + } + } + } + + function do_submit_example_url ( url ) { + if ((example_method == "XFDF" ) || (url.indexOf("localhost")>=0)) { + do_erase_example_file("fakename") ; + do_erase_example_list("fakename") ; + } + url = check_example_url(url) ; + if (example_log) { + console.println("submitting form to "+url+" using method "+example_method) ; + } + if (example_file != "") { + url = url + "/" + example_file ; + } + % we need the bFDF for acrobat 5 + this.submitForm({cURL : url, bFDF : false, cSubmitAs : example_method}) ; + } + + function submit_example_form ( ) { + identify_example_url() ; + if (example_host != "") { + if (example_port != "") { + do_submit_example_url(example_host+":"+example_port) ; + } else { + do_submit_example_url(example_host) ; + } + } else { + if (example_url != "") { + do_submit_example_url(example_url) ; + } else { + if (example_port != "") { + do_submit_example_url("localhost"+":"+example_port) ; + } else { + do_submit_example_url("localhost:8061") ; % local exampler + } + } + } + resetfilename () ; + } + + function submit_form ( host, port) { + set_example_host(host) ; + set_example_post(post) ; + submit_example_form ; + } + +\stopJSpreamble + +\startJSpreamble request_2 used now + + var exa_command = "" ; + var exa_option = "" ; + var exa_filename = "" ; + var exa_filelist = "" ; + var exa_registered = "" ; + + function set_request (command,option) { + exa_command = command ; + if (exa_command == "") { + exa_option = option ; + } else { if (option == "") { + exa_option = "" ; + } else { if (option.indexOf("--")<0) { + exa_option = "--action=" + option ; + } else { + exa_option = option ; + } } } + } + + function assemble_request ( ) { + v = this.getField('filename') ; + if (v) { + exa_filename = v.value ; + } + v = this.getField('filelist') ; + if (v) { + exa_filelist = v.value ; + } +% exa_filename = exa_filename.replace(/\\\\/g,'/') ; +% exa_filelist = exa_filelist.replace(/\\\\/g,'/') ; + str = "\\n" ; + str = str+"" ; + if (exa_filelist == "") { + exa_filelist = exa_registered ; + } else { if (exa_registered != "") { + exa_filelist = exa_filelist + "\\n" + exa_registered ; + } } + if (exa_command != "") { + str = str+""+exa_command+"" ; + } + if (exa_option != "") { + str = str+""+exa_option+"" ; + } + if (exa_filename != "") { + str = str+""+exa_filename+"" ; + } + var fls = "" ; + if (exa_filelist != "") { + % old method, soon obsolete + lst = exa_filelist.split(/\\s/) ; + for (i=0;i"+lst[i]+"" ; + } + } else { if (exa_multiple) { + for (i=1;i<=100;i++) { + % console.println("file field "+i) ; + f = this.getField("filename-"+ i) ; +% if (f) { if (f.value != "") { +% if (g) { if (g.value == "") { +% fls = fls+""+f.value+"" ; +% } else { +% fls = fls+""+f.value+"" ; +% } } else { +% fls = fls+""+f.value+"" ; +% } +% } } + if (f) { if (f.value != "") { + fls = fls + "" ; + } else { + % console.println("b") ; + fls = fls + " label='" + g.value + "'>" ; + } } else { + % console.println("c") ; + fls = fls + ">" ; + } + fls = fls + f.value + "" ; + } } + } + } } + if (fls != "") { + str = str + "" + fls + "" ; + } + str = str + "" ; + v = this.getField('exa:request') ; + if (v) { + v.value = str ; + } + } + +\stopJSpreamble + +\startJSpreamble request_3 used now + + var exa_multiple = false ; + + function setfilename ( suffixes ) { + if (event.targetName) { + var name = event.targetName ; + var fake = name.replace(/filename/,"fakename") ; + } else { + var name = 'filename' ; + var fake = 'fakename' ; + } + f = this.getField(fake) ; + if (f) { + f.browseForFileToSubmit() ; + if ((suffixes != "") && (f.value != "")) { + % + s = suffixes.replace(/,/g,"|") ; + r = new RegExp() ; + s = "\\\\.(" + s + ")$" ; + r.compile(s, "i") ; + if (f.value.search(r)<=0) { + f.value = "" ; + app.alert('This filetype is not permitted.') ; + % + % lst = suffixes.split(/,/) ; + % ok = false ; + % for (i=0;i=0) { +% f.value = "" ; +% } +% } + } + this.dirty = false ; + } + + function addfilename () { + if (exa_multiple) { + h = this.getField("filelist") ; + g = this.getField("filename") ; + if ((g) && (h)) { + str = g.value ; + if (h.value == "") { + h.value = str ; + } else { + h.value = h.value + "\\n" + str ; + } + g.value = "" ; + this.value = "" ; + } + } + this.dirty = false ; + } + + % this only works with client that assembles request + + function registerfilename (str) { + if (str!="") { + h = this.getField("filelist") ; + if (h) { + if (h.value != "") { + h.value = h.value + "\\n" ; + } + h.value = h.value + str ; + } else { + if (exa_registered != "") { + exa_registered = exa_registered + "\\n" ; + } + exa_registered = exa_registered + str ; + } + } + console.show ; + console.println('registered files') ; + console.println("file: "+str) ; + console.println("list: "+exa_registered) ; + this.dirty = false ; + } + + function checkfilename () { + } + + function getfilename ( suffixes ) { + setfilename(suffixes) ; + checkfilename() ; + addfilename() ; + } + + function resetfilename () { + do_erase_example_file("fakename") ; + do_erase_example_file("filename") ; + do_erase_example_file("filelist") ; + do_erase_example_list("filename") ; + do_erase_example_list("fakename") ; + } + +\stopJSpreamble + +\endinput diff --git a/Master/texmf-dist/tex/context/base/java-imp-fil.mkiv b/Master/texmf-dist/tex/context/base/java-imp-fil.mkiv new file mode 100644 index 00000000000..592e9460d45 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/java-imp-fil.mkiv @@ -0,0 +1,52 @@ +%D \module +%D [ file=java-fil, +%D version=1998.06.01, +%D title=\CONTEXT\ JavaScript Macros, +%D subtitle=Filing and Printing, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\startJSpreamble Auxiliary used now + + function DocumentFileName() { + var Paths = this.path.split("/") ; + Paths = Paths[Paths.length-1].split(".") ; + return(Paths[0]) + } + + function Print_Page_Range(From,To) { + if ((Number(From)>0) && (Number(To) >= Number(From))) { + var myFrom = Number(From)-1 ; + var myTo = Number(To)-1 ; + this.print(false,myFrom,myTo,true) ; + } + } + + function Print_This_Page() { + this.print(false,this.pageNum,this.pageNum,true) ; + } + +\stopJSpreamble + +\definereference + [PrintSubPaginas] + [JS(Print_Page_Range{\firstsubpage,\lastsubpage})] + +\definereference + [PrintSubPages] + [JS(Print_Page_Range{\firstsubpage,\lastsubpage})] + +\definereference + [PrintDezePagina] + [JS(Print_This_Page)] + +\definereference + [PrintThisPage] + [JS(Print_This_Page)] + +\endinput diff --git a/Master/texmf-dist/tex/context/base/java-imp-fld.mkiv b/Master/texmf-dist/tex/context/base/java-imp-fld.mkiv new file mode 100644 index 00000000000..a0909f59496 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/java-imp-fld.mkiv @@ -0,0 +1,536 @@ +%D \module +%D [ file=java-fld, +%D version=1998.05.20, +%D title=\CONTEXT\ JavaScript Macros, +%D subtitle=Field 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. + +%D In \LUATEX\ the following does not work out well: +%D +%D \starttyping +%D v = v.replace(/\\\\"e/g,"\\353") ; +%D \stoptyping +%D +%D But this does: +%D +%D \starttyping +%D v = String(v).replace(/\\\\"e/g,"\\353") ; +%D \stoptyping +%D +%D Probably a \UNICODE\ issue. Beware, in \MKIV\ we have a +%D different escaping of \type {\\}. +%D +%D Watch out: cf. the latest pdf specification we've changed +%D On into Yes. Also, we've changed the test for the on value +%D into !Off as we dón't know what value it gets in the reader. + +\startluasetups javascript:pdfencoding + local verbatim = context.verbatim + verbatim("{\n") + for accent, group in table.sortedhash(characters.tex.accentmapping) do + for character, mapping in table.sortedhash(group) do + if character == "" then + character = " " + end + if accent == '"' then + verbatim(" '\\\\%s%s' : '\\u%04X',\n",accent,character,utf.byte(mapping)) + else + verbatim(' "\\\\%s%s" : "\\u%04X",\n',accent,character,utf.byte(mapping)) + end + end + end + verbatim(" '\\\\OE' : '\\u0152',\n") + verbatim(" '\\\\oe' : '\\u0153',\n") + verbatim(" '\\\\AE' : '\\u00C6',\n") + verbatim(" '\\\\ae' : '\\u00E6',\n") + verbatim(" '\\\\<<' : '\\u00AB',\n") + verbatim(" '\\\\>>' : '\\u00BB',\n") + verbatim(" '\\\\ss' : '\\u00DF' \n") + verbatim("}\n") +\stopluasetups + +% maybe make { } tex braces in javascript code so that we can call lua + +\def\JavaScriptTeXAccentMapping{\luasetup{javascript:pdfencoding}} + +\startJSpreamble SanitizeTeXInput used later + +var TeXAccentMapping = \JavaScriptTeXAccentMapping + +function TeX_Replacer(original,str) { + return (TeXAccentMapping[str] || str) ; +} + +function Sanitized_TeX_String(value) { + return (value.replace(/(\\..)/g, TeX_Replacer)) ; +} + +var TeX_Key_Mode = 0 ; +var TeX_Key_Char = "" ; + +function Initialize_TeX_Keystroke() { + TeX_Key_Char = "" ; + TeX_Key_Mode = 0 ; +} + +function Sanitized_TeX_Keystroke(change) { + if (!event.willCommit) { + if (change=="\\") { + TeX_Key_Mode = 1 ; + return ("") + } else if (TeX_Key_Mode == 1) { + TeX_Key_Mode = 2 ; + TeX_Key_Char = change ; + return ("") + } else if (TeX_Key_Mode == 2) { + TeX_Key_Mode = 0 ; + TeX_Key_Char = "\\"+TeX_Key_Char+change ; + return (Sanitized_TeX_String(TeX_Key_Char)) + } else { + TeX_Key_Mode = 0 ; + return (change) + } + } +} + +function Initialize_TeX_Key() { + Initialize_TeX_Keystroke() ; +} + +function Convert_TeX_Key() { + if (!event.willCommit) { + event.change = Sanitized_TeX_Keystroke(event.change) ; + } +} + +function Convert_TeX_String() { + event.value = Sanitized_TeX_String(event.value) ; +} + +\stopJSpreamble + +% \startJScode {Initialize_TeX_Key} uses {SanitizeTeXInput} +% Initialize_TeX_Keystroke() ; +% \stopJScode +% +% \startJScode {Convert_TeX_Key} uses {SanitizeTeXInput} +% if (!event.willCommit) { +% event.change = Sanitized_TeX_Keystroke(event.change) ; +% } +% \stopJScode +% +% \startJScode{Convert_TeX_String} uses {SanitizeTeXInput} +% event.value = Sanitized_TeX_String(event.value) ; +% \stopJScode + +% was used now but we autocheck anyway so lets test this for a while + +\startJSpreamble FieldsStates used later + +var visible_field = new Array() ; +var visible_fields = 0 ; + +function PresetFields() { + this.syncAnnotScan() ; +} + +function Preset_Fields() { + this.syncAnnotScan() ; +} + +function Hide_When_Down() { + event.target.hidden = true ; +} + +function Hide_Field(Name) { + var v = this.getField(Name) ; + if (v) { + v.hidden = true ; + v.readonly = true ; + this.dirty = false ; + } +} + +function Do_Vide_Field(Name, Closable) { + var v = this.getField(Name) ; + if (v) { + ++visible_fields ; + visible_field[visible_fields] = Name ; + v.hidden = false ; + if (Closable) { + v.readonly = false ; + v.value = "Yes" ; + } + this.dirty = false ; + } +} + +function Vide_Field(Name) { + Do_Vide_Field(Name,false) ; +} + +function Vide_Hide_Field(Name) { + Do_Vide_Field(Name,true) ; +} + +function Hide_Fields() { + while (visible_fields>0) { + Hide_Field(visible_field[visible_fields]) ; + --visible_fields ; + } +} + +function Vide_Fields(Name) { + Hide_Fields() ; + Vide_Field(Name) ; +} + +function Vide_Hide_Fields(Name) { + Hide_Fields() ; + Vide_Hide_Field(Name) ; +} + +function Toggle_Hide(Name) { + var v = this.getField(Name) ; + if (v) { + v.hidden = !v.hidden ; + this.dirty = false ; + } +} + +function Field_On(Name) { + v = this.getField(Name) ; + if (v) { + v.value = "Yes" ; + this.dirty = false ; + } +} + +function Field_Off(Name) { + var v = this.getField(Name) ; + if (v) { + v.value = "Off" ; + this.dirty = false ; + } +} + +function Toggle_Value(Name) { + var v = this.getField(Name) ; + if (v) { + if (v.value != "Off") { + v.value = "Off" ; + } else { + v.value = "Yes" ; + } + } + this.dirty = false ; +} + +function Toggle_Read(Name) { + var v = this.getField(Name); + if (v) { + v.readonly = !v.readonly ; + } +} + +function Flip_Fields(Name) { + var Names = Name.split(",") ; + for (var i=0; i < Names.length; i++) { + v = this.getField(Names[i]) ; + if (v) { + v.hidden = !v.hidden ; + v.value = "Yes" ; + } + } +} + +function Forget_Changes() { + this.dirty = false ; +} + +function ForgetChanges() { + this.dirty = false ; +} +\stopJSpreamble + +\definereference[ForgetChanges][JS(Forget_Changes)] + +% This can be done more efficient, by keeping track of the +% current top of the stack. + +\startJSpreamble FieldStack used later + +function Reset_Fields(FieldSet) { + var i = 1 ; + while (true) { + v = this.getField(FieldSet+":"+i) ; + if (!v) { + break ; + } else { + v.value = "Off" ; + } + i++ ; + } +} + +function Set_Fields(FieldSet) { + var i = 1 ; + while (true) { + v = this.getField(FieldSet+":"+i) ; + if (!v) { + break ; + } else { + v.value = "Yes" ; + } + i++ ; + } +} + +function Set_Field(FieldSet, FieldName) { + Reset_Fields(FieldSet) ; + v = this.getField(FieldSet+":"+FieldName) ; + if (v) { + v.value = "Yes" ; + } +} + +function Reset_Field(FieldSet, FieldName) { + Set_Fields(FieldSet) ; + v = this.getField(FieldSet+":"+FieldName) ; + if (v) { + v.value = "Off" ; + } +} + +function Walk_Field(FieldSet) { + var i = 1 ; + while (true) { + v = this.getField(FieldSet + ":" + i) ; + if (v) { + if (v.value != "Off") { + v.value = "Off" ; + var ii = i ; + ii++ ; + v = this.getField(FieldSet + ":" + ii) ; + if (! v) { + v = this.getField(FieldSet + ":" + 1) ; + } + if (v) { + v.value = "Yes" ; + } + break ; + } + i++ ; + } else { + break ; + } + } +} + +var FieldSets = new Array() ; + +function Do_Get_Check_Walk_Field(FieldSet) { + var f = FieldSets[FieldSet] + if (! f) { + f = new Array() ; + f.number = 0 ; + f.delay = 500 ; + f.paused = false ; + f.running = false ; + f.name = FieldSet ; + f.timeout = null ; + FieldSets[FieldSet] = f ; + } + return f +} + +function Do_Next_Auto_Walk_Field(FieldSet) { + var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; + if (fieldset) { + var v = this.getField(FieldSet + ":" + fieldset.number) ; + if (v) { + if (v.value != "Off") { + v.value = "Off" ; + } + } + fieldset.number++ ; + v = this.getField(FieldSet + ":" + fieldset.number) ; + if (! v) { + fieldset.number = 1 ; + v = this.getField(FieldSet + ":" + fieldset.number) ; + } + if (v) { + v.value = "Yes" ; + } + } +} + +function Do_Stop_Auto_Walk_Field(FieldSet) { + var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; + if (fieldset) { + try { + app.clearInterval(fieldset.timeout) ; + app.clearTimeOut(fieldset.timeout) ; + } catch (e) { + } + } +} + +function Do_Start_Auto_Walk_Field(FieldSet) { + var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; + if (fieldset) { + Do_Stop_Auto_Walk_Field(FieldSet) ; + fieldset.timeout = app.setInterval("Do_Next_Auto_Walk_Field('"+FieldSet+"')", fieldset.delay) ; + } +} + +function Start_Walk_Field(FieldSet, Delay) { + var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; + if (fieldset) { + fieldset.number = 0 ; + if (Delay) { + fieldset.delay = Delay ; + } + Reset_Fields(FieldSet) ; + Do_Start_Auto_Walk_Field(FieldSet) ; + fieldset.running = true ; + fieldset.paused = false ; + } +} + +function Pause_Walk_Field(FieldSet) { + var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; + if (fieldset) { + if (fieldset.running) { + if (fieldset.paused) { + Do_Start_Auto_Walk_Field(FieldSet) ; + fieldset.paused = false ; + } else { + Do_Stop_Auto_Walk_Field(FieldSet) ; + fieldset.paused = true ; + } + } + } +} + +function Start_Pause_Walk_Field(FieldSet, Delay) { + var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; + if (fieldset) { + if (fieldset.running) { + if (fieldset.paused) { + Do_Start_Auto_Walk_Field(FieldSet) ; + fieldset.paused = false ; + } else { + Do_Stop_Auto_Walk_Field(FieldSet) ; + fieldset.paused = true ; + } + } else { + fieldset.number = 0 ; + if (Delay) { + fieldset.delay = Delay ; + } + Reset_Fields(FieldSet) ; + Do_Start_Auto_Walk_Field(FieldSet) ; + fieldset.running = true ; + fieldset.paused = false ; + } + } +} + +function Stop_Walk_Field(FieldSet) { + var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; + if (fieldset) { + Do_Stop_Auto_Walk_Field(FieldSet) ; + fieldset.running = false ; + fieldset.paused = false ; + } +} + +function Reset_Walk_Field(FieldSet) { + var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; + if (fieldset) { + Do_Stop_Auto_Walk_Field(FieldSet) ; + fieldset.number = 0 ; + fieldset.running = false ; + fieldset.paused = false ; + Reset_Fields(FieldSet) ; + } +} + +function Previous_Walk_Field(FieldSet) { + var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; + if (fieldset) { + Do_Stop_Auto_Walk_Field(FieldSet) ; + fieldset.running = false ; + fieldset.paused = false ; + if (fieldset.number>0) { + var v = this.getField(FieldSet + ":" + fieldset.number) ; + if (v) { + if (v.value != "Off") { + v.value = "Off" ; + } + } + fieldset.number-- ; + v = this.getField(FieldSet + ":" + fieldset.number) ; + if (v) { + v.value = "Yes" ; + } + } + } +} + +function Next_Walk_Field(FieldSet) { + var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; + if (fieldset) { + Do_Stop_Auto_Walk_Field(FieldSet) ; + fieldset.running = false ; + fieldset.paused = false ; + var f = fieldset.number + 1 ; + var v = this.getField(FieldSet + ":" + f) ; + if (v) { + var v = this.getField(FieldSet + ":" + fieldset.number) ; + if (v) { + if (v.value != "Off") { + v.value = "Off" ; + } + } + fieldset.number++ ; + v = this.getField(FieldSet + ":" + fieldset.number) ; + if (v) { + v.value = "Yes" ; + } + } + } +} + +function Set_Walk_Field_Delay(FieldSet, Delay) { + var fieldset = Do_Get_Check_Walk_Field(FieldSet) ; + if (fieldset) { + if (Delay) { + fieldset.delay = Delay ; + if (fieldset.running) { + Do_Stop_Auto_Walk_Field(FieldSet) ; + Do_Start_Auto_Walk_Field(FieldSet) ; + } + } + } +} + +\stopJSpreamble + +\definereference[Walk] [JS(Walk_Field)] +\definereference[StartWalk] [JS(Start_Walk_Field)] +\definereference[StopWalk] [JS(Stop_Walk_Field)] +\definereference[PauseWalk] [JS(Pause_Walk_Field)] +\definereference[ResetWalk] [JS(Reset_Walk_Field)] +\definereference[PreviousWalk][JS(Previous_Walk_Field)] +\definereference[NextWalk] [JS(Next_Walk_Field)] +\definereference[SetWalkDelay][JS(Set_Walk_Field_Delay)] + +\endinput diff --git a/Master/texmf-dist/tex/context/base/java-imp-stp.mkiv b/Master/texmf-dist/tex/context/base/java-imp-stp.mkiv new file mode 100644 index 00000000000..ebddd8cc6f6 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/java-imp-stp.mkiv @@ -0,0 +1,123 @@ +%D \module +%D [ file=java-stp, +%D version=2004.03.15, +%D title=\CONTEXT\ JavaScript Macros, +%D subtitle=Stepping, +%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. + +% we define ocglist global, otherwise we quickly run into a memory hog (even +% out of memory in a 512 Meg machine) + +% we cannot use doc_visited[this.pageNum] instead of doc_currentstep because +% of some funny side effect (i.e. dup or so) + +% todo: test with later as we do autoinsert now + +\startJSpreamble Steps used now + +var doc_ocglist = this.getOCGs() ; +var doc_stepname = "step" ; +var doc_currentstep = 0 ; +var doc_maxstep = 50 ; +var doc_visited = new Array() ; +var doc_busy = new Array() ; + +function SetupStepper(layername,laststep) { + doc_stepname = layername ; + doc_maxstep = laststep ; + for (var i=0; i<=this.numPages; i++) { + doc_visited[i] = 0 ; + doc_busy[i] = 0 ; + } +} + +for (var i=0; i<=this.numPages; i++) { + doc_visited[i] = 0 ; + doc_busy[i] = 0 ; +} + +function GetOCG(name) { + for (var i=0; i < doc_ocglist.length; i++) { + if (doc_ocglist[i].name == name) { + return doc_ocglist[i] ; + } + } + return null ; +} + +function CheckBusy() { + var ocg = GetOCG("step:busy") ; + if (ocg != null) { + if (doc_visited[this.pageNum]==0) { + ocg.state = true ; + } else { + if (doc_visited[this.pageNum]Internally work with scaled point, which are -represented by integers. However, in practice, at east at the - end we work with more generic units like points (pt). Going -from scaled points (numbers) to one of those units can be -done by using the conversion factors collected in the following -table.

---ldx]]-- - -local format, match, gsub, type, setmetatable = string.format, string.match, string.gsub, type, setmetatable -local P, S, R, Cc, lpegmatch = lpeg.P, lpeg.S, lpeg.R, lpeg.Cc, lpeg.match - -number = number or { } - -number.tonumberf = function(n) return match(format("%.20f",n),"(.-0?)0*$") end -- one zero too much but alas -number.tonumberg = function(n) return format("%.20g",n) end - -local dimenfactors = { - ["pt"] = 1/65536, - ["in"] = ( 100/ 7227)/65536, - ["cm"] = ( 254/ 7227)/65536, - ["mm"] = ( 2540/ 7227)/65536, - ["sp"] = 1, -- 65536 sp in 1pt - ["bp"] = ( 7200/ 7227)/65536, - ["pc"] = ( 1/ 12)/65536, - ["dd"] = ( 1157/ 1238)/65536, - ["cc"] = ( 1157/14856)/65536, - ["nd"] = (20320/21681)/65536, - ["nc"] = ( 5080/65043)/65536 -} - ---~ print(table.serialize(dimenfactors)) ---~ ---~ %.99g: ---~ ---~ t={ ---~ ["bp"]=1.5201782378580324e-005, ---~ ["cc"]=1.1883696112892098e-006, ---~ ["cm"]=5.3628510057769479e-007, ---~ ["dd"]=1.4260435335470516e-005, ---~ ["em"]=0.000152587890625, ---~ ["ex"]=6.103515625e-005, ---~ ["in"]=2.1113586636917117e-007, ---~ ["mm"]=5.3628510057769473e-008, ---~ ["nc"]=1.1917446679504327e-006, ---~ ["nd"]=1.4300936015405194e-005, ---~ ["pc"]=1.2715657552083333e-006, ---~ ["pt"]=1.52587890625e-005, ---~ ["sp"]=1, ---~ } ---~ ---~ patched %s and tonumber ---~ ---~ t={ ---~ ["bp"]=0.00001520178238, ---~ ["cc"]=0.00000118836961, ---~ ["cm"]=0.0000005362851, ---~ ["dd"]=0.00001426043534, ---~ ["em"]=0.00015258789063, ---~ ["ex"]=0.00006103515625, ---~ ["in"]=0.00000021113587, ---~ ["mm"]=0.00000005362851, ---~ ["nc"]=0.00000119174467, ---~ ["nd"]=0.00001430093602, ---~ ["pc"]=0.00000127156576, ---~ ["pt"]=0.00001525878906, ---~ ["sp"]=1, ---~ } - ---[[ldx-- -

A conversion function that takes a number, unit (string) and optional -format (string) is implemented using this table.

---ldx]]-- - --- was: - -local function todimen(n,unit,fmt) - if type(n) == 'string' then - return n - else - unit = unit or 'pt' - return format(fmt or "%s%s",n*dimenfactors[unit],unit) - -- if fmt then - -- return format(fmt,n*dimenfactors[unit],unit) - -- else - -- return match(format("%.20f",n*dimenfactors[unit]),"(.-0?)0*$") .. unit - -- end - end -end - ---[[ldx-- -

We collect a bunch of converters in the number namespace.

---ldx]]-- - -number.maxdimen = 1073741823 -number.todimen = todimen -number.dimenfactors = dimenfactors - -function number.topoints (n) return todimen(n,"pt") end -function number.toinches (n) return todimen(n,"in") end -function number.tocentimeters (n) return todimen(n,"cm") end -function number.tomillimeters (n) return todimen(n,"mm") end -function number.toscaledpoints(n) return todimen(n,"sp") end -function number.toscaledpoints(n) return n .. "sp" end -function number.tobasepoints (n) return todimen(n,"bp") end -function number.topicas (n) return todimen(n "pc") end -function number.todidots (n) return todimen(n,"dd") end -function number.tociceros (n) return todimen(n,"cc") end -function number.tonewdidots (n) return todimen(n,"nd") end -function number.tonewciceros (n) return todimen(n,"nc") end - ---[[ldx-- -

More interesting it to implement a (sort of) dimen datatype, one -that permits calculations too. First we define a function that -converts a string to scaledpoints. We use . We capture -a number and optionally a unit. When no unit is given a constant -capture takes place.

---ldx]]-- - -local amount = (S("+-")^0 * R("09")^0 * P(".")^0 * R("09")^0) + Cc("0") -local unit = R("az")^1 - -local dimenpair = amount/tonumber * (unit^1/dimenfactors + Cc(1)) -- tonumber is new - -lpeg.patterns.dimenpair = dimenpair - ---[[ldx-- -

We use a metatable to intercept errors. When no key is found in -the table with factors, the metatable will be consulted for an -alternative index function.

---ldx]]-- - -local mt = { } setmetatable(dimenfactors,mt) - -mt.__index = function(t,s) - -- error("wrong dimension: " .. (s or "?")) -- better a message - return false -end - -function string:todimen() - if type(self) == "number" then - return self - else - local value, unit = lpegmatch(dimenpair,self) - return value/unit - end -end - -local amount = S("+-")^0 * R("09")^0 * S(".,")^0 * R("09")^0 -local unit = P("pt") + P("cm") + P("mm") + P("sp") + P("bp") + P("in") + - P("pc") + P("dd") + P("cc") + P("nd") + P("nc") - -local validdimen = amount * unit - -lpeg.patterns.validdimen = pattern - ---[[ldx-- -

This converter accepts calls like:

- - -string.todimen("10") -string.todimen(".10") -string.todimen("10.0") -string.todimen("10.0pt") -string.todimen("10pt") -string.todimen("10.0pt") - - -

And of course the often more efficient:

- - -somestring:todimen("12.3cm") - - -

With this in place, we can now implement a proper datatype for dimensions, one -that permits us to do this:

- - -s = dimen "10pt" + dimen "20pt" + dimen "200pt" - - dimen "100sp" / 10 + "20pt" + "0pt" - - -

We create a local metatable for this new type:

---ldx]]-- - -local dimensions = { } - ---[[ldx-- -

The main (and globally) visible representation of a dimen is defined next: it is -a one-element table. The unit that is returned from the match is normally a number -(one of the previously defined factors) but we also accept functions. Later we will -see why.

---ldx]]-- - -function dimen(a) - if a then - local ta= type(a) - if ta == "string" then - local value, unit = lpegmatch(pattern,a) - if type(unit) == "function" then - k = value/unit() - else - k = value/unit - end - a = k - elseif ta == "table" then - a = a[1] - end - return setmetatable({ a }, dimensions) - else - return setmetatable({ 0 }, dimensions) - end -end - ---[[ldx-- -

This function return a small hash with a metatable attached. It is -through this metatable that we can do the calculations. We could have -shared some of the code but for reasons of speed we don't.

---ldx]]-- - -function dimensions.__add(a, b) - local ta, tb = type(a), type(b) - if ta == "string" then a = a:todimen() elseif ta == "table" then a = a[1] end - if tb == "string" then b = b:todimen() elseif tb == "table" then b = b[1] end - return setmetatable({ a + b }, dimensions) -end - -function dimensions.__sub(a, b) - local ta, tb = type(a), type(b) - if ta == "string" then a = a:todimen() elseif ta == "table" then a = a[1] end - if tb == "string" then b = b:todimen() elseif tb == "table" then b = b[1] end - return setmetatable({ a - b }, dimensions) -end - -function dimensions.__mul(a, b) - local ta, tb = type(a), type(b) - if ta == "string" then a = a:todimen() elseif ta == "table" then a = a[1] end - if tb == "string" then b = b:todimen() elseif tb == "table" then b = b[1] end - return setmetatable({ a * b }, dimensions) -end - -function dimensions.__div(a, b) - local ta, tb = type(a), type(b) - if ta == "string" then a = a:todimen() elseif ta == "table" then a = a[1] end - if tb == "string" then b = b:todimen() elseif tb == "table" then b = b[1] end - return setmetatable({ a / b }, dimensions) -end - -function dimensions.__unm(a) - local ta = type(a) - if ta == "string" then a = a:todimen() elseif ta == "table" then a = a[1] end - return setmetatable({ - a }, dimensions) -end - ---[[ldx-- -

It makes no sense to implement the power and modulo function but -the next two do make sense because they permits is code like:

- - -local a, b = dimen "10pt", dimen "11pt" -... -if a > b then - ... -end - ---ldx]]-- - --- makes no sense: dimensions.__pow and dimensions.__mod - -function dimensions.__lt(a, b) - return a[1] < b[1] -end - -function dimensions.__eq(a, b) - return a[1] == b[1] -end - ---[[ldx-- -

We also need to provide a function for conversion to string (so that -we can print dimensions). We print them as points, just like .

---ldx]]-- - -function dimensions.__tostring(a) - return a[1]/65536 .. "pt" -- instead of todimen(a[1]) -end - ---[[ldx-- -

Since it does not take much code, we also provide a way to access -a few accessors

- - -print(dimen().pt) -print(dimen().sp) - ---ldx]]-- - -function dimensions.__index(tab,key) - local d = dimenfactors[key] - if not d then - error("illegal property of dimen: " .. key) - d = 1 - end - return 1/d -end - ---[[ldx-- -

In the converter from string to dimension we support functions as -factors. This is because in we have a few more units: -ex and em. These are not constant factors but -depend on the current font. They are not defined by default, but need -an explicit function call. This is because at the moment that this code -is loaded, the relevant tables that hold the functions needed may not -yet be available.

---ldx]]-- - -function dimensions.texify() -- todo: % - local fti, fc = fonts and fonts.ids and fonts.ids, font and font.current - if fti and fc then - dimenfactors["ex"] = function() return fti[fc()].ex_height end - dimenfactors["em"] = function() return fti[fc()].quad end - else - dimenfactors["ex"] = 1/65536* 4 -- 4pt - dimenfactors["em"] = 1/65536*10 -- 10pt - end -end - ---[[ldx-- -

In order to set the defaults we call this function now. At some point -the macro package needs to make sure the function is called again.

---ldx]]-- - -dimensions.texify() - ---[[ldx-- -

The previous code is rather efficient (also thanks to ) but we -can speed it up by caching converted dimensions. On my machine (2008) the following -loop takes about 25.5 seconds.

- - -for i=1,1000000 do - local s = dimen "10pt" + dimen "20pt" + dimen "200pt" - - dimen "100sp" / 10 + "20pt" + "0pt" -end - - -

When we cache converted strings this becomes 16.3 seconds. In order not -to waste too much memory on it, we tag the values of the cache as being -week which mean that the garbage collector will collect them in a next -sweep. This means that in most cases the speed up is mostly affecting the -current couple of calculations and as such the speed penalty is small.

- -

We redefine two previous defined functions that can benefit from -this:

---ldx]]-- - -local known = { } setmetatable(known, { __mode = "v" }) - -function dimen(a) - if a then - local ta= type(a) - if ta == "string" then - local k = known[a] - if k then - a = k - else - local value, unit = lpegmatch(dimenpair,a) - if type(unit) == "function" then - k = value/unit() - else - k = value/unit - end - known[a] = k - a = k - end - elseif ta == "table" then - a = a[1] - end - return setmetatable({ a }, dimensions) - else - return setmetatable({ 0 }, dimensions) - end -end - -function string:todimen() - if type(self) == "number" then - return self - else - local k = known[self] - if not k then - local value, unit = lpegmatch(dimenpair,self) - if value and unit then - k = value/unit - else - k = 0 - end - -- print(self,value,unit) - known[self] = k - end - return k - end -end - -function number.toscaled(d) - return format("0.5f",d/2^16) -end - ---[[ldx-- -

In a similar fashion we can define a glue datatype. In that case we -probably use a hash instead of a one-element table.

---ldx]]-- - ---[[ldx-- -

Goodie:s

---ldx]]-- - -function number.percent(n) -- will be cleaned up once luatex 0.30 is out - local hsize = tex.hsize - if type(hsize) == "string" then - hsize = hsize:todimen() - end - return (n/100) * hsize -end - -number["%"] = number.percent diff --git a/Master/texmf-dist/tex/context/base/l-dir.lua b/Master/texmf-dist/tex/context/base/l-dir.lua index 2643f538b94..1d59b9220d9 100644 --- a/Master/texmf-dist/tex/context/base/l-dir.lua +++ b/Master/texmf-dist/tex/context/base/l-dir.lua @@ -6,35 +6,75 @@ if not modules then modules = { } end modules ['l-dir'] = { license = "see context related readme files" } --- dir.expand_name will be merged with cleanpath and collapsepath +-- dir.expandname will be merged with cleanpath and collapsepath local type = type local find, gmatch, match, gsub = string.find, string.gmatch, string.match, string.gsub +local concat, insert, remove = table.concat, table.insert, table.remove local lpegmatch = lpeg.match +local P, S, R, C, Cc, Cs, Ct, Cv, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cv, lpeg.V + dir = dir or { } +local dir = dir +local lfs = lfs + +local attributes = lfs.attributes +local walkdir = lfs.dir +local isdir = lfs.isdir +local isfile = lfs.isfile +local mkdir = lfs.mkdir +local chdir = lfs.chdir +local currentdir = lfs.currentdir -- handy function dir.current() - return (gsub(lfs.currentdir(),"\\","/")) + return (gsub(currentdir(),"\\","/")) end --- optimizing for no string.find (*) does not save time +-- optimizing for no find (*) does not save time + +--~ local function globpattern(path,patt,recurse,action) -- fails in recent luatex due to some change in lfs +--~ local ok, scanner +--~ if path == "/" then +--~ ok, scanner = xpcall(function() return walkdir(path..".") end, function() end) -- kepler safe +--~ else +--~ ok, scanner = xpcall(function() return walkdir(path) end, function() end) -- kepler safe +--~ end +--~ if ok and type(scanner) == "function" then +--~ if not find(path,"/$") then path = path .. '/' end +--~ for name in scanner do +--~ local full = path .. name +--~ local mode = attributes(full,'mode') +--~ if mode == 'file' then +--~ if find(full,patt) then +--~ action(full) +--~ end +--~ elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then +--~ globpattern(full,patt,recurse,action) +--~ end +--~ end +--~ end +--~ end + +local lfsisdir = isdir + +local function isdir(path) + path = gsub(path,"[/\\]+$","") + return lfsisdir(path) +end -local attributes = lfs.attributes -local walkdir = lfs.dir +lfs.isdir = isdir -local function glob_pattern(path,patt,recurse,action) - local ok, scanner +local function globpattern(path,patt,recurse,action) if path == "/" then - ok, scanner = xpcall(function() return walkdir(path..".") end, function() end) -- kepler safe - else - ok, scanner = xpcall(function() return walkdir(path) end, function() end) -- kepler safe + path = path .. "." + elseif not find(path,"/$") then + path = path .. '/' end - if ok and type(scanner) == "function" then - if not find(path,"/$") then path = path .. '/' end - for name in scanner do + if isdir(path) then -- lfs.isdir does not like trailing / + for name in walkdir(path) do -- lfs.dir accepts trailing / local full = path .. name local mode = attributes(full,'mode') if mode == 'file' then @@ -42,15 +82,15 @@ local function glob_pattern(path,patt,recurse,action) action(full) end elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then - glob_pattern(full,patt,recurse,action) + globpattern(full,patt,recurse,action) end end end end -dir.glob_pattern = glob_pattern +dir.globpattern = globpattern -local function collect_pattern(path,patt,recurse,result) +local function collectpattern(path,patt,recurse,result) local ok, scanner result = result or { } if path == "/" then @@ -69,7 +109,7 @@ local function collect_pattern(path,patt,recurse,result) result[name] = attr end elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then - attr.list = collect_pattern(full,patt,recurse) + attr.list = collectpattern(full,patt,recurse) result[name] = attr end end @@ -77,9 +117,7 @@ local function collect_pattern(path,patt,recurse,result) return result end -dir.collect_pattern = collect_pattern - -local P, S, R, C, Cc, Cs, Ct, Cv, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cv, lpeg.V +dir.collectpattern = collectpattern local pattern = Ct { [1] = (C(P(".") + P("/")^1) + C(R("az","AZ") * P(":") * P("/")^0) + Cc("./")) * V(2) * V(3), @@ -103,16 +141,16 @@ local function glob(str,t) for s=1,#str do glob(str[s],t) end - elseif lfs.isfile(str) then + elseif isfile(str) then t(str) else - local split = lpegmatch(pattern,str) + local split = lpegmatch(pattern,str) -- we could use the file splitter if split then local root, path, base = split[1], split[2], split[3] local recurse = find(base,"%*%*") local start = root .. path local result = lpegmatch(filter,start .. base) - glob_pattern(start,result,recurse,t) + globpattern(start,result,recurse,t) end end else @@ -122,12 +160,15 @@ local function glob(str,t) glob(str[s],t) end return t - elseif lfs.isfile(str) then - local t = t or { } - t[#t+1] = str - return t + elseif isfile(str) then + if t then + t[#t+1] = str + return t + else + return { str } + end else - local split = lpegmatch(pattern,str) + local split = lpegmatch(pattern,str) -- we could use the file splitter if split then local t = t or { } local action = action or function(name) t[#t+1] = name end @@ -135,7 +176,7 @@ local function glob(str,t) local recurse = find(base,"%*%*") local start = root .. path local result = lpegmatch(filter,start .. base) - glob_pattern(start,result,recurse,action) + globpattern(start,result,recurse,action) return t else return { } @@ -154,10 +195,11 @@ dir.glob = glob local function globfiles(path,recurse,func,files) -- func == pattern or function if type(func) == "string" then - local s = func -- alas, we need this indirect way + local s = func func = function(name) return find(name,s) end end files = files or { } + local noffiles = #files for name in walkdir(path) do if find(name,"^%.") then --- skip @@ -168,12 +210,9 @@ local function globfiles(path,recurse,func,files) -- func == pattern or function globfiles(path .. "/" .. name,recurse,func,files) end elseif mode == "file" then - if func then - if func(name) then - files[#files+1] = path .. "/" .. name - end - else - files[#files+1] = path .. "/" .. name + if not func or func(name) then + noffiles = noffiles + 1 + files[noffiles] = path .. "/" .. name end end end @@ -191,7 +230,7 @@ dir.globfiles = globfiles -- print(dir.ls("*.tex")) function dir.ls(pattern) - return table.concat(glob(pattern),"\n") + return concat(glob(pattern),"\n") end --~ mkdirs("temp") @@ -201,7 +240,9 @@ end local make_indeed = true -- false -if string.find(os.getenv("PATH"),";") then -- os.type == "windows" +local onwindows = os.type == "windows" or find(os.getenv("PATH"),";") + +if onwindows then function dir.mkdirs(...) local str, pth, t = "", "", { ... } @@ -250,56 +291,24 @@ if string.find(os.getenv("PATH"),";") then -- os.type == "windows" else pth = pth .. "/" .. s end - if make_indeed and not lfs.isdir(pth) then - lfs.mkdir(pth) + if make_indeed and not isdir(pth) then + mkdir(pth) end end - return pth, (lfs.isdir(pth) == true) + return pth, (isdir(pth) == true) end ---~ print(dir.mkdirs("","","a","c")) ---~ print(dir.mkdirs("a")) ---~ print(dir.mkdirs("a:")) ---~ print(dir.mkdirs("a:/b/c")) ---~ print(dir.mkdirs("a:b/c")) ---~ print(dir.mkdirs("a:/bbb/c")) ---~ print(dir.mkdirs("/a/b/c")) ---~ print(dir.mkdirs("/aaa/b/c")) ---~ print(dir.mkdirs("//a/b/c")) ---~ print(dir.mkdirs("///a/b/c")) ---~ print(dir.mkdirs("a/bbb//ccc/")) - - function dir.expand_name(str) -- will be merged with cleanpath and collapsepath - local first, nothing, last = match(str,"^(//)(//*)(.*)$") - if first then - first = dir.current() .. "/" - end - if not first then - first, last = match(str,"^(//)/*(.*)$") - end - if not first then - first, last = match(str,"^([a-zA-Z]:)(.*)$") - if first and not find(last,"^/") then - local d = lfs.currentdir() - if lfs.chdir(first) then - first = dir.current() - end - lfs.chdir(d) - end - end - if not first then - first, last = dir.current(), str - end - last = gsub(last,"//","/") - last = gsub(last,"/%./","/") - last = gsub(last,"^/*","") - first = gsub(first,"/*$","") - if last == "" then - return first - else - return first .. "/" .. last - end - end + --~ print(dir.mkdirs("","","a","c")) + --~ print(dir.mkdirs("a")) + --~ print(dir.mkdirs("a:")) + --~ print(dir.mkdirs("a:/b/c")) + --~ print(dir.mkdirs("a:b/c")) + --~ print(dir.mkdirs("a:/bbb/c")) + --~ print(dir.mkdirs("/a/b/c")) + --~ print(dir.mkdirs("/aaa/b/c")) + --~ print(dir.mkdirs("//a/b/c")) + --~ print(dir.mkdirs("///a/b/c")) + --~ print(dir.mkdirs("a/bbb//ccc/")) else @@ -307,7 +316,7 @@ else local str, pth, t = "", "", { ... } for i=1,#t do local s = t[i] - if s ~= "" then + if s and s ~= "" then -- we catch nil and false if str ~= "" then str = str .. "/" .. s else @@ -325,39 +334,96 @@ else else pth = pth .. "/" .. s end - if make_indeed and not first and not lfs.isdir(pth) then - lfs.mkdir(pth) + if make_indeed and not first and not isdir(pth) then + mkdir(pth) end end else pth = "." for s in gmatch(str,"[^/]+") do pth = pth .. "/" .. s - if make_indeed and not lfs.isdir(pth) then - lfs.mkdir(pth) + if make_indeed and not isdir(pth) then + mkdir(pth) end end end - return pth, (lfs.isdir(pth) == true) + return pth, (isdir(pth) == true) end ---~ print(dir.mkdirs("","","a","c")) ---~ print(dir.mkdirs("a")) ---~ print(dir.mkdirs("/a/b/c")) ---~ print(dir.mkdirs("/aaa/b/c")) ---~ print(dir.mkdirs("//a/b/c")) ---~ print(dir.mkdirs("///a/b/c")) ---~ print(dir.mkdirs("a/bbb//ccc/")) + --~ print(dir.mkdirs("","","a","c")) + --~ print(dir.mkdirs("a")) + --~ print(dir.mkdirs("/a/b/c")) + --~ print(dir.mkdirs("/aaa/b/c")) + --~ print(dir.mkdirs("//a/b/c")) + --~ print(dir.mkdirs("///a/b/c")) + --~ print(dir.mkdirs("a/bbb//ccc/")) + +end + +dir.makedirs = dir.mkdirs - function dir.expand_name(str) -- will be merged with cleanpath and collapsepath +-- we can only define it here as it uses dir.current + +if onwindows then + + function dir.expandname(str) -- will be merged with cleanpath and collapsepath + local first, nothing, last = match(str,"^(//)(//*)(.*)$") + if first then + first = dir.current() .. "/" + end + if not first then + first, last = match(str,"^(//)/*(.*)$") + end + if not first then + first, last = match(str,"^([a-zA-Z]:)(.*)$") + if first and not find(last,"^/") then + local d = currentdir() + if chdir(first) then + first = dir.current() + end + chdir(d) + end + end + if not first then + first, last = dir.current(), str + end + last = gsub(last,"//","/") + last = gsub(last,"/%./","/") + last = gsub(last,"^/*","") + first = gsub(first,"/*$","") + if last == "" or last == "." then + return first + else + return first .. "/" .. last + end + end + +else + + function dir.expandname(str) -- will be merged with cleanpath and collapsepath if not find(str,"^/") then - str = lfs.currentdir() .. "/" .. str + str = currentdir() .. "/" .. str end str = gsub(str,"//","/") str = gsub(str,"/%./","/") + str = gsub(str,"(.)/%.$","%1") return str end end -dir.makedirs = dir.mkdirs +file.expandname = dir.expandname -- for convenience + +local stack = { } + +function dir.push(newdir) + insert(stack,lfs.currentdir()) +end + +function dir.pop() + local d = remove(stack) + if d then + lfs.chdir(d) + end + return d +end diff --git a/Master/texmf-dist/tex/context/base/l-file.lua b/Master/texmf-dist/tex/context/base/l-file.lua index 212318fb751..c3199f0229e 100644 --- a/Master/texmf-dist/tex/context/base/l-file.lua +++ b/Master/texmf-dist/tex/context/base/l-file.lua @@ -8,47 +8,93 @@ if not modules then modules = { } end modules ['l-file'] = { -- needs a cleanup -file = file or { } +file = file or { } +local file = file -local concat = table.concat -local find, gmatch, match, gsub, sub, char = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char +local insert, concat = table.insert, table.concat +local find, gmatch, match, gsub, sub, char, lower = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char, string.lower local lpegmatch = lpeg.match +local getcurrentdir, attributes = lfs.currentdir, lfs.attributes -function file.removesuffix(filename) - return (gsub(filename,"%.[%a%d]+$","")) +local P, R, S, C, Cs, Cp, Cc = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc + +local function dirname(name,default) + return match(name,"^(.+)[/\\].-$") or (default or "") end -function file.addsuffix(filename, suffix) - if not suffix or suffix == "" then - return filename - elseif not find(filename,"%.[%a%d]+$") then - return filename .. "." .. suffix - else - return filename - end +local function basename(name) + return match(name,"^.+[/\\](.-)$") or name end -function file.replacesuffix(filename, suffix) - return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix +local function nameonly(name) + return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) end -function file.dirname(name,default) - return match(name,"^(.+)[/\\].-$") or (default or "") +local function extname(name,default) + return match(name,"^.+%.([^/\\]-)$") or default or "" end -function file.basename(name) - return match(name,"^.+[/\\](.-)$") or name +local function splitname(name) + local n, s = match(name,"^(.+)%.([^/\\]-)$") + return n or name, s or "" end -function file.nameonly(name) - return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) +file.basename = basename +file.dirname = dirname +file.nameonly = nameonly +file.extname = extname +file.suffix = extname + +function file.removesuffix(filename) + return (gsub(filename,"%.[%a%d]+$","")) end -function file.extname(name,default) - return match(name,"^.+%.([^/\\]-)$") or default or "" +function file.addsuffix(filename, suffix, criterium) + if not suffix or suffix == "" then + return filename + elseif criterium == true then + return filename .. "." .. suffix + elseif not criterium then + local n, s = splitname(filename) + if not s or s == "" then + return filename .. "." .. suffix + else + return filename + end + else + local n, s = splitname(filename) + if s and s ~= "" then + local t = type(criterium) + if t == "table" then + -- keep if in criterium + for i=1,#criterium do + if s == criterium[i] then + return filename + end + end + elseif t == "string" then + -- keep if criterium + if s == criterium then + return filename + end + end + end + return n .. "." .. suffix + end end -file.suffix = file.extname +--~ print("1 " .. file.addsuffix("name","new") .. " -> name.new") +--~ print("2 " .. file.addsuffix("name.old","new") .. " -> name.old") +--~ print("3 " .. file.addsuffix("name.old","new",true) .. " -> name.old.new") +--~ print("4 " .. file.addsuffix("name.old","new","new") .. " -> name.new") +--~ print("5 " .. file.addsuffix("name.old","new","old") .. " -> name.old") +--~ print("6 " .. file.addsuffix("name.old","new","foo") .. " -> name.new") +--~ print("7 " .. file.addsuffix("name.old","new",{"foo","bar"}) .. " -> name.new") +--~ print("8 " .. file.addsuffix("name.old","new",{"old","bar"}) .. " -> name.old") + +function file.replacesuffix(filename, suffix) + return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix +end --~ function file.join(...) --~ local pth = concat({...},"/") @@ -100,50 +146,59 @@ end --~ print(file.join("http:///a","/y")) --~ print(file.join("//nas-1","/y")) -function file.iswritable(name) - local a = lfs.attributes(name) or lfs.attributes(file.dirname(name,".")) +function file.is_writable(name) + local a = attributes(name) or attributes(dirname(name,".")) return a and sub(a.permissions,2,2) == "w" end -function file.isreadable(name) - local a = lfs.attributes(name) +function file.is_readable(name) + local a = attributes(name) return a and sub(a.permissions,1,1) == "r" end -file.is_readable = file.isreadable -file.is_writable = file.iswritable +file.isreadable = file.is_readable -- depricated +file.iswritable = file.is_writable -- depricated --- todo: lpeg - ---~ function file.split_path(str) ---~ local t = { } ---~ str = gsub(str,"\\", "/") ---~ str = gsub(str,"(%a):([;/])", "%1\001%2") ---~ for name in gmatch(str,"([^;:]+)") do ---~ if name ~= "" then ---~ t[#t+1] = gsub(name,"\001",":") ---~ end ---~ end ---~ return t ---~ end +-- todo: lpeg \\ / .. does not save much local checkedsplit = string.checkedsplit -function file.split_path(str,separator) +function file.splitpath(str,separator) -- string str = gsub(str,"\\","/") return checkedsplit(str,separator or io.pathseparator) end -function file.join_path(tab) - return concat(tab,io.pathseparator) -- can have trailing // +function file.joinpath(tab,separator) -- table + return concat(tab,separator or io.pathseparator) -- can have trailing // end -- we can hash them weakly +--~ function file.collapsepath(str) -- fails on b.c/.. +--~ str = gsub(str,"\\","/") +--~ if find(str,"/") then +--~ str = gsub(str,"^%./",(gsub(getcurrentdir(),"\\","/")) .. "/") -- ./xx in qualified +--~ str = gsub(str,"/%./","/") +--~ local n, m = 1, 1 +--~ while n > 0 or m > 0 do +--~ str, n = gsub(str,"[^/%.]+/%.%.$","") +--~ str, m = gsub(str,"[^/%.]+/%.%./","") +--~ end +--~ str = gsub(str,"([^/])/$","%1") +--~ -- str = gsub(str,"^%./","") -- ./xx in qualified +--~ str = gsub(str,"/%.$","") +--~ end +--~ if str == "" then str = "." end +--~ return str +--~ end +--~ +--~ The previous one fails on "a.b/c" so Taco came up with a split based +--~ variant. After some skyping we got it sort of compatible with the old +--~ one. After that the anchoring to currentdir was added in a better way. +--~ Of course there are some optimizations too. Finally we had to deal with +--~ windows drive prefixes and thinsg like sys://. -local insert = table.insert - -function file.collapse_path(str,anchor) +function file.collapsepath(str,anchor) if anchor and not find(str,"^/") and not find(str,"^%a:") then str = getcurrentdir() .. "/" .. str end @@ -197,64 +252,26 @@ function file.collapse_path(str,anchor) return concat(newelements, '/') end end -function file.xcollapse_path(str) - print('collapse', str) - if str == "" or str =="." then - return "." - elseif find(str,"^%.%.") then - return str - elseif not find(str,"%.") then - return str - end - str = gsub(str,"^%./",lfs.currentdir() .. "/") -- ./xx in qualified - str = gsub(str,"\\","/") - local oldelements = checkedsplit(str,"/") - local newelements = { } - local i = #oldelements - while i > 0 do - local element = oldelements[i] - if element == '.' then - -- do nothing - elseif element == '..' then - local n = i -1 - while n > 0 do - local element = oldelements[n] - if element ~= '..' and element ~= '.' then - oldelements[n] = '.' - break - else - n = n - 1 - end - end - if n<1 then - insert(newelements,1,'..') - end - elseif element ~= "" then - insert(newelements,1,element) - end - i = i - 1 - end - if #newelements == 0 then - return "." - elseif find(str,"^/") then - return "/" .. concat(newelements,'/') + +--~ local function test(str) +--~ print(string.format("%-20s %-15s %-15s",str,file.collapsepath(str),file.collapsepath(str,true))) +--~ end +--~ test("a/b.c/d") test("b.c/d") test("b.c/..") +--~ test("/") test("c:/..") test("sys://..") +--~ test("") test("./") test(".") test("..") test("./..") test("../..") +--~ test("a") test("./a") test("/a") test("a/../..") +--~ test("a/./b/..") test("a/aa/../b/bb") test("a/.././././b/..") test("a/./././b/..") +--~ test("a/b/c/../..") test("./a/b/c/../..") test("a/b/c/../..") + +function file.robustname(str,strict) + str = gsub(str,"[^%a%d%/%-%.\\]+","-") + if strict then + return lower(gsub(str,"^%-*(.-)%-*$","%1")) else - return concat(newelements, '/') + return str end end ---~ print(file.collapse_path("/a")) ---~ print(file.collapse_path("a/./b/..")) ---~ print(file.collapse_path("a/aa/../b/bb")) ---~ print(file.collapse_path("a/../..")) ---~ print(file.collapse_path("a/.././././b/..")) ---~ print(file.collapse_path("a/./././b/..")) ---~ print(file.collapse_path("a/b/c/../..")) - -function file.robustname(str) - return (gsub(str,"[^%a%d%/%-%.\\]+","-")) -end - file.readdata = io.loaddata file.savedata = io.savedata @@ -264,31 +281,31 @@ end -- lpeg variants, slightly faster, not always ---~ local period = lpeg.P(".") ---~ local slashes = lpeg.S("\\/") +--~ local period = P(".") +--~ local slashes = S("\\/") --~ local noperiod = 1-period --~ local noslashes = 1-slashes --~ local name = noperiod^1 ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.C(noperiod^1) * -1 +--~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * C(noperiod^1) * -1 --~ function file.extname(name) --~ return lpegmatch(pattern,name) or "" --~ end ---~ local pattern = lpeg.Cs(((period * noperiod^1 * -1)/"" + 1)^1) +--~ local pattern = Cs(((period * noperiod^1 * -1)/"" + 1)^1) --~ function file.removesuffix(name) --~ return lpegmatch(pattern,name) --~ end ---~ local pattern = (noslashes^0 * slashes)^1 * lpeg.C(noslashes^1) * -1 +--~ local pattern = (noslashes^0 * slashes)^1 * C(noslashes^1) * -1 --~ function file.basename(name) --~ return lpegmatch(pattern,name) or name --~ end ---~ local pattern = (noslashes^0 * slashes)^1 * lpeg.Cp() * noslashes^1 * -1 +--~ local pattern = (noslashes^0 * slashes)^1 * Cp() * noslashes^1 * -1 --~ function file.dirname(name) --~ local p = lpegmatch(pattern,name) @@ -299,7 +316,7 @@ end --~ end --~ end ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.Cp() * noperiod^1 * -1 +--~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * Cp() * noperiod^1 * -1 --~ function file.addsuffix(name, suffix) --~ local p = lpegmatch(pattern,name) @@ -310,7 +327,7 @@ end --~ end --~ end ---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * lpeg.Cp() * noperiod^1 * -1 +--~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * Cp() * noperiod^1 * -1 --~ function file.replacesuffix(name,suffix) --~ local p = lpegmatch(pattern,name) @@ -321,7 +338,7 @@ end --~ end --~ end ---~ local pattern = (noslashes^0 * slashes)^0 * lpeg.Cp() * ((noperiod^1 * period)^1 * lpeg.Cp() + lpeg.P(true)) * noperiod^1 * -1 +--~ local pattern = (noslashes^0 * slashes)^0 * Cp() * ((noperiod^1 * period)^1 * Cp() + P(true)) * noperiod^1 * -1 --~ function file.nameonly(name) --~ local a, b = lpegmatch(pattern,name) @@ -353,11 +370,14 @@ end -- also rewrite previous -local letter = lpeg.R("az","AZ") + lpeg.S("_-+") -local separator = lpeg.P("://") +local letter = R("az","AZ") + S("_-+") +local separator = P("://") -local qualified = lpeg.P(".")^0 * lpeg.P("/") + letter*lpeg.P(":") + letter^1*separator + letter^1 * lpeg.P("/") -local rootbased = lpeg.P("/") + letter*lpeg.P(":") +local qualified = P(".")^0 * P("/") + letter*P(":") + letter^1*separator + letter^1 * P("/") +local rootbased = P("/") + letter*P(":") + +lpeg.patterns.qualified = qualified +lpeg.patterns.rootbased = rootbased -- ./name ../name /name c: :// name/name @@ -369,14 +389,16 @@ function file.is_rootbased_path(filename) return lpegmatch(rootbased,filename) ~= nil end -local slash = lpeg.S("\\/") -local period = lpeg.P(".") -local drive = lpeg.C(lpeg.R("az","AZ")) * lpeg.P(":") -local path = lpeg.C(((1-slash)^0 * slash)^0) -local suffix = period * lpeg.C(lpeg.P(1-period)^0 * lpeg.P(-1)) -local base = lpeg.C((1-suffix)^0) +-- actually these are schemes + +local slash = S("\\/") +local period = P(".") +local drive = C(R("az","AZ")) * P(":") +local path = C(((1-slash)^0 * slash)^0) +local suffix = period * C(P(1-period)^0 * P(-1)) +local base = C((1-suffix)^0) -local pattern = (drive + lpeg.Cc("")) * (path + lpeg.Cc("")) * (base + lpeg.Cc("")) * (suffix + lpeg.Cc("")) +local pattern = (drive + Cc("")) * (path + Cc("")) * (base + Cc("")) * (suffix + Cc("")) function file.splitname(str) -- returns drive, path, base, suffix return lpegmatch(pattern,str) @@ -392,8 +414,15 @@ end --~ -- todo: --~ --~ if os.type == "windows" then ---~ local currentdir = lfs.currentdir ---~ function lfs.currentdir() +--~ local currentdir = getcurrentdir +--~ function getcurrentdir() --~ return (gsub(currentdir(),"\\","/")) --~ end --~ end + +-- for myself: + +function file.strip(name,dir) + local b, a = match(name,"^(.-)" .. dir .. "(.*)$") + return a ~= "" and a or name +end diff --git a/Master/texmf-dist/tex/context/base/l-io.lua b/Master/texmf-dist/tex/context/base/l-io.lua index 66e279309fb..a740996c68c 100644 --- a/Master/texmf-dist/tex/context/base/l-io.lua +++ b/Master/texmf-dist/tex/context/base/l-io.lua @@ -6,7 +6,10 @@ if not modules then modules = { } end modules ['l-io'] = { license = "see context related readme files" } -local byte, find, gsub = string.byte, string.find, string.gsub +local io = io +local byte, find, gsub, format = string.byte, string.find, string.gsub, string.format +local concat = table.concat +local type = type if string.find(os.getenv("PATH"),";") then io.fileseparator, io.pathseparator = "\\", ";" @@ -17,9 +20,7 @@ end function io.loaddata(filename,textmode) local f = io.open(filename,(textmode and 'r') or 'rb') if f then - -- collectgarbage("step") -- sometimes makes a big difference in mem consumption local data = f:read('*all') - -- garbagecollector.check(data) f:close() return data else @@ -31,13 +32,14 @@ function io.savedata(filename,data,joiner) local f = io.open(filename,"wb") if f then if type(data) == "table" then - f:write(table.join(data,joiner or "")) + f:write(concat(data,joiner or "")) elseif type(data) == "function" then data(f) else f:write(data or "") end f:close() + io.flush() return true else return false @@ -66,12 +68,19 @@ function io.size(filename) end function io.noflines(f) - local n = 0 - for _ in f:lines() do - n = n + 1 + if type(f) == "string" then + local f = io.open(filename) + local n = f and io.noflines(f) or 0 + assert(f:close()) + return n + else + local n = 0 + for _ in f:lines() do + n = n + 1 + end + f:seek('set',0) + return n end - f:seek('set',0) - return n end local nextchar = { @@ -97,8 +106,6 @@ local nextchar = { function io.characters(f,n) if f then return nextchar[n or 1], f - else - return nil, nil end end @@ -107,40 +114,42 @@ local nextbyte = { local a, b, c, d = f:read(1,1,1,1) if d then return byte(a), byte(b), byte(c), byte(d) - else - return nil, nil, nil, nil + end + end, + [3] = function(f) + local a, b, c = f:read(1,1,1) + if b then + return byte(a), byte(b), byte(c) end end, [2] = function(f) local a, b = f:read(1,1) if b then return byte(a), byte(b) - else - return nil, nil end end, [1] = function (f) local a = f:read(1) if a then return byte(a) - else - return nil end end, [-2] = function (f) local a, b = f:read(1,1) if b then return byte(b), byte(a) - else - return nil, nil + end + end, + [-3] = function(f) + local a, b, c = f:read(1,1,1) + if b then + return byte(c), byte(b), byte(a) end end, [-4] = function(f) local a, b, c, d = f:read(1,1,1,1) if d then return byte(d), byte(c), byte(b), byte(a) - else - return nil, nil, nil, nil end end } @@ -157,12 +166,13 @@ function io.ask(question,default,options) while true do io.write(question) if options then - io.write(string.format(" [%s]",table.concat(options,"|"))) + io.write(format(" [%s]",concat(options,"|"))) end if default then - io.write(string.format(" [%s]",default)) + io.write(format(" [%s]",default)) end - io.write(string.format(" ")) + io.write(format(" ")) + io.flush() local answer = io.read() answer = gsub(answer,"^%s*(.*)%s*$","%1") if answer == "" and default then @@ -185,3 +195,60 @@ function io.ask(question,default,options) end end end + +local function readnumber(f,n,m) + if m then + f:seek("set",n) + n = m + end + if n == 1 then + return byte(f:read(1)) + elseif n == 2 then + local a, b = byte(f:read(2),1,2) + return 256 * a + b + elseif n == 3 then + local a, b, c = byte(f:read(3),1,3) + return 256*256 * a + 256 * b + c + elseif n == 4 then + local a, b, c, d = byte(f:read(4),1,4) + return 256*256*256 * a + 256*256 * b + 256 * c + d + elseif n == 8 then + local a, b = readnumber(f,4), readnumber(f,4) + return 256 * a + b + elseif n == 12 then + local a, b, c = readnumber(f,4), readnumber(f,4), readnumber(f,4) + return 256*256 * a + 256 * b + c + elseif n == -2 then + local b, a = byte(f:read(2),1,2) + return 256*a + b + elseif n == -3 then + local c, b, a = byte(f:read(3),1,3) + return 256*256 * a + 256 * b + c + elseif n == -4 then + local d, c, b, a = byte(f:read(4),1,4) + return 256*256*256 * a + 256*256 * b + 256*c + d + elseif n == -8 then + local h, g, f, e, d, c, b, a = byte(f:read(8),1,8) + return 256*256*256*256*256*256*256 * a + + 256*256*256*256*256*256 * b + + 256*256*256*256*256 * c + + 256*256*256*256 * d + + 256*256*256 * e + + 256*256 * f + + 256 * g + + h + else + return 0 + end +end + +io.readnumber = readnumber + +function io.readstring(f,n,m) + if m then + f:seek("set",n) + n = m + end + local str = gsub(f:read(n),"%z","") + return str +end diff --git a/Master/texmf-dist/tex/context/base/l-lpeg.lua b/Master/texmf-dist/tex/context/base/l-lpeg.lua index b107a8e6432..ce0cc67efe7 100644 --- a/Master/texmf-dist/tex/context/base/l-lpeg.lua +++ b/Master/texmf-dist/tex/context/base/l-lpeg.lua @@ -8,28 +8,75 @@ if not modules then modules = { } end modules ['l-lpeg'] = { local lpeg = require("lpeg") +local type = type + +-- Beware, we predefine a bunch of patterns here and one reason for doing so +-- is that we get consistent behaviour in some of the visualizers. + lpeg.patterns = lpeg.patterns or { } -- so that we can share local patterns = lpeg.patterns -local P, R, S, Ct, C, Cs, Cc, V = lpeg.P, lpeg.R, lpeg.S, lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.V -local match = lpeg.match +local P, R, S, V, match = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.match +local Ct, C, Cs, Cc = lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc +local lpegtype = lpeg.type + +local utfcharacters = string.utfcharacters +local utfgmatch = unicode and unicode.utf8.gmatch + +local anything = P(1) +local endofstring = P(-1) +local alwaysmatched = P(true) + +patterns.anything = anything +patterns.endofstring = endofstring +patterns.beginofstring = alwaysmatched +patterns.alwaysmatched = alwaysmatched local digit, sign = R('09'), S('+-') local cr, lf, crlf = P("\r"), P("\n"), P("\r\n") -local utf8byte = R("\128\191") +local newline = crlf + cr + lf +local escaped = P("\\") * anything +local squote = P("'") +local dquote = P('"') +local space = P(" ") + +local utfbom_32_be = P('\000\000\254\255') +local utfbom_32_le = P('\255\254\000\000') +local utfbom_16_be = P('\255\254') +local utfbom_16_le = P('\254\255') +local utfbom_8 = P('\239\187\191') +local utfbom = utfbom_32_be + utfbom_32_le + + utfbom_16_be + utfbom_16_le + + utfbom_8 +local utftype = utfbom_32_be / "utf-32-be" + utfbom_32_le / "utf-32-le" + + utfbom_16_be / "utf-16-be" + utfbom_16_le / "utf-16-le" + + utfbom_8 / "utf-8" + alwaysmatched / "unknown" + +local utf8next = R("\128\191") -patterns.utf8byte = utf8byte patterns.utf8one = R("\000\127") -patterns.utf8two = R("\194\223") * utf8byte -patterns.utf8three = R("\224\239") * utf8byte * utf8byte -patterns.utf8four = R("\240\244") * utf8byte * utf8byte * utf8byte +patterns.utf8two = R("\194\223") * utf8next +patterns.utf8three = R("\224\239") * utf8next * utf8next +patterns.utf8four = R("\240\244") * utf8next * utf8next * utf8next +patterns.utfbom = utfbom +patterns.utftype = utftype + +local utf8char = patterns.utf8one + patterns.utf8two + patterns.utf8three + patterns.utf8four +local validutf8char = utf8char^0 * endofstring * Cc(true) + Cc(false) + +patterns.utf8 = utf8char +patterns.utf8char = utf8char +patterns.validutf8 = validutf8char +patterns.validutf8char = validutf8char patterns.digit = digit patterns.sign = sign patterns.cardinal = sign^0 * digit^1 patterns.integer = sign^0 * digit^1 patterns.float = sign^0 * digit^0 * P('.') * digit^1 +patterns.cfloat = sign^0 * digit^0 * P(',') * digit^1 patterns.number = patterns.float + patterns.integer +patterns.cnumber = patterns.cfloat + patterns.integer patterns.oct = P("0") * R("07")^1 patterns.octal = patterns.oct patterns.HEX = P("0x") * R("09","AF")^1 @@ -38,16 +85,46 @@ patterns.hexadecimal = P("0x") * R("09","AF","af")^1 patterns.lowercase = R("az") patterns.uppercase = R("AZ") patterns.letter = patterns.lowercase + patterns.uppercase -patterns.space = S(" ") +patterns.space = space +patterns.tab = P("\t") +patterns.spaceortab = patterns.space + patterns.tab patterns.eol = S("\n\r") patterns.spacer = S(" \t\f\v") -- + string.char(0xc2, 0xa0) if we want utf (cf mail roberto) -patterns.newline = crlf + cr + lf -patterns.nonspace = 1 - patterns.space +patterns.newline = newline +patterns.emptyline = newline^1 patterns.nonspacer = 1 - patterns.spacer patterns.whitespace = patterns.eol + patterns.spacer patterns.nonwhitespace = 1 - patterns.whitespace -patterns.utf8 = patterns.utf8one + patterns.utf8two + patterns.utf8three + patterns.utf8four -patterns.utfbom = P('\000\000\254\255') + P('\255\254\000\000') + P('\255\254') + P('\254\255') + P('\239\187\191') +patterns.equal = P("=") +patterns.comma = P(",") +patterns.commaspacer = P(",") * patterns.spacer^0 +patterns.period = P(".") +patterns.colon = P(":") +patterns.semicolon = P(";") +patterns.underscore = P("_") +patterns.escaped = escaped +patterns.squote = squote +patterns.dquote = dquote +patterns.nosquote = (escaped + (1-squote))^0 +patterns.nodquote = (escaped + (1-dquote))^0 +patterns.unsingle = (squote/"") * patterns.nosquote * (squote/"") +patterns.undouble = (dquote/"") * patterns.nodquote * (dquote/"") +patterns.unquoted = patterns.undouble + patterns.unsingle -- more often undouble +patterns.unspacer = ((patterns.spacer^1)/"")^0 + +patterns.somecontent = (anything - newline - space)^1 -- (utf8char - newline - space)^1 +patterns.beginline = #(1-newline) + +local unquoted = Cs(patterns.unquoted * endofstring) -- not C + +function string.unquoted(str) + return match(unquoted,str) or str +end + +--~ print(string.unquoted("test")) +--~ print(string.unquoted([["t\"est"]])) +--~ print(string.unquoted([["t\"est"x]])) +--~ print(string.unquoted("\'test\'")) function lpeg.anywhere(pattern) --slightly adapted from website return P { P(pattern) + 1 * V(1) } -- why so complex? @@ -57,36 +134,18 @@ function lpeg.splitter(pattern, action) return (((1-P(pattern))^1)/action+1)^0 end -local spacing = patterns.spacer^0 * patterns.newline -- sort of strip -local empty = spacing * Cc("") -local nonempty = Cs((1-spacing)^1) * spacing^-1 -local content = (empty + nonempty)^1 - -local capture = Ct(content^0) - -function string:splitlines() - return match(capture,self) -end - -patterns.textline = content - ---~ local p = lpeg.splitat("->",false) print(match(p,"oeps->what->more")) -- oeps what more ---~ local p = lpeg.splitat("->",true) print(match(p,"oeps->what->more")) -- oeps what->more ---~ local p = lpeg.splitat("->",false) print(match(p,"oeps")) -- oeps ---~ local p = lpeg.splitat("->",true) print(match(p,"oeps")) -- oeps - local splitters_s, splitters_m = { }, { } local function splitat(separator,single) local splitter = (single and splitters_s[separator]) or splitters_m[separator] if not splitter then separator = P(separator) + local other = C((1 - separator)^0) if single then - local other, any = C((1 - separator)^0), P(1) + local any = anything splitter = other * (separator * C(any^0) + "") -- ? splitters_s[separator] = splitter else - local other = C((1 - separator)^0) splitter = other * (separator * other)^0 splitters_m[separator] = splitter end @@ -96,6 +155,11 @@ end lpeg.splitat = splitat +--~ local p = splitat("->",false) print(match(p,"oeps->what->more")) -- oeps what more +--~ local p = splitat("->",true) print(match(p,"oeps->what->more")) -- oeps what->more +--~ local p = splitat("->",false) print(match(p,"oeps")) -- oeps +--~ local p = splitat("->",true) print(match(p,"oeps")) -- oeps + local cache = { } function lpeg.split(separator,str) @@ -107,16 +171,45 @@ function lpeg.split(separator,str) return match(c,str) end -function string:split(separator) +function string.split(str,separator) local c = cache[separator] if not c then c = Ct(splitat(separator)) cache[separator] = c end - return match(c,self) + return match(c,str) +end + +local spacing = patterns.spacer^0 * newline -- sort of strip +local empty = spacing * Cc("") +local nonempty = Cs((1-spacing)^1) * spacing^-1 +local content = (empty + nonempty)^1 + +patterns.textline = content + +--~ local linesplitter = Ct(content^0) +--~ +--~ function string.splitlines(str) +--~ return match(linesplitter,str) +--~ end + +local linesplitter = Ct(splitat(newline)) + +patterns.linesplitter = linesplitter + +function string.splitlines(str) + return match(linesplitter,str) +end + +local utflinesplitter = utfbom^-1 * Ct(splitat(newline)) + +patterns.utflinesplitter = utflinesplitter + +function string.utfsplitlines(str) + return match(utflinesplitter,str) end -lpeg.splitters = cache +--~ lpeg.splitters = cache -- no longer public local cache = { } @@ -124,36 +217,24 @@ function lpeg.checkedsplit(separator,str) local c = cache[separator] if not c then separator = P(separator) - local other = C((1 - separator)^0) + local other = C((1 - separator)^1) c = Ct(separator^0 * other * (separator^1 * other)^0) cache[separator] = c end return match(c,str) end -function string:checkedsplit(separator) +function string.checkedsplit(str,separator) local c = cache[separator] if not c then separator = P(separator) - local other = C((1 - separator)^0) + local other = C((1 - separator)^1) c = Ct(separator^0 * other * (separator^1 * other)^0) cache[separator] = c end - return match(c,self) + return match(c,str) end ---~ function lpeg.append(list,pp) ---~ local p = pp ---~ for l=1,#list do ---~ if p then ---~ p = p + P(list[l]) ---~ else ---~ p = P(list[l]) ---~ end ---~ end ---~ return p ---~ end - --~ from roberto's site: local f1 = string.byte @@ -162,4 +243,299 @@ local function f2(s) local c1, c2 = f1(s,1,2) return c1 * 64 + c2 local function f3(s) local c1, c2, c3 = f1(s,1,3) return (c1 * 64 + c2) * 64 + c3 - 925824 end local function f4(s) local c1, c2, c3, c4 = f1(s,1,4) return ((c1 * 64 + c2) * 64 + c3) * 64 + c4 - 63447168 end -patterns.utf8byte = patterns.utf8one/f1 + patterns.utf8two/f2 + patterns.utf8three/f3 + patterns.utf8four/f4 +local utf8byte = patterns.utf8one/f1 + patterns.utf8two/f2 + patterns.utf8three/f3 + patterns.utf8four/f4 + +patterns.utf8byte = utf8byte + +--~ local str = " a b c d " + +--~ local s = lpeg.stripper(lpeg.R("az")) print("["..lpeg.match(s,str).."]") +--~ local s = lpeg.keeper(lpeg.R("az")) print("["..lpeg.match(s,str).."]") +--~ local s = lpeg.stripper("ab") print("["..lpeg.match(s,str).."]") +--~ local s = lpeg.keeper("ab") print("["..lpeg.match(s,str).."]") + +local cache = { } + +function lpeg.stripper(str) + if type(str) == "string" then + local s = cache[str] + if not s then + s = Cs(((S(str)^1)/"" + 1)^0) + cache[str] = s + end + return s + else + return Cs(((str^1)/"" + 1)^0) + end +end + +local cache = { } + +function lpeg.keeper(str) + if type(str) == "string" then + local s = cache[str] + if not s then + s = Cs((((1-S(str))^1)/"" + 1)^0) + cache[str] = s + end + return s + else + return Cs((((1-str)^1)/"" + 1)^0) + end +end + +function lpeg.frontstripper(str) -- or pattern (yet undocumented) + return (P(str) + P(true)) * Cs(P(1)^0) +end + +function lpeg.endstripper(str) -- or pattern (yet undocumented) + return Cs((1 - P(str) * P(-1))^0) +end + +-- Just for fun I looked at the used bytecode and +-- p = (p and p + pp) or pp gets one more (testset). + +function lpeg.replacer(one,two) + if type(one) == "table" then + local no = #one + if no > 0 then + local p + for i=1,no do + local o = one[i] + local pp = P(o[1]) / o[2] + if p then + p = p + pp + else + p = pp + end + end + return Cs((p + 1)^0) + end + else + two = two or "" + return Cs((P(one)/two + 1)^0) + end +end + +local splitters_f, splitters_s = { }, { } + +function lpeg.firstofsplit(separator) -- always return value + local splitter = splitters_f[separator] + if not splitter then + separator = P(separator) + splitter = C((1 - separator)^0) + splitters_f[separator] = splitter + end + return splitter +end + +function lpeg.secondofsplit(separator) -- nil if not split + local splitter = splitters_s[separator] + if not splitter then + separator = P(separator) + splitter = (1 - separator)^0 * separator * C(anything^0) + splitters_s[separator] = splitter + end + return splitter +end + +function lpeg.balancer(left,right) + left, right = P(left), P(right) + return P { left * ((1 - left - right) + V(1))^0 * right } +end + +--~ print(1,match(lpeg.firstofsplit(":"),"bc:de")) +--~ print(2,match(lpeg.firstofsplit(":"),":de")) -- empty +--~ print(3,match(lpeg.firstofsplit(":"),"bc")) +--~ print(4,match(lpeg.secondofsplit(":"),"bc:de")) +--~ print(5,match(lpeg.secondofsplit(":"),"bc:")) -- empty +--~ print(6,match(lpeg.secondofsplit(":",""),"bc")) +--~ print(7,match(lpeg.secondofsplit(":"),"bc")) +--~ print(9,match(lpeg.secondofsplit(":","123"),"bc")) + +--~ -- slower: +--~ +--~ function lpeg.counter(pattern) +--~ local n, pattern = 0, (lpeg.P(pattern)/function() n = n + 1 end + lpeg.anything)^0 +--~ return function(str) n = 0 ; lpegmatch(pattern,str) ; return n end +--~ end + +local nany = utf8char/"" + +function lpeg.counter(pattern) + pattern = Cs((P(pattern)/" " + nany)^0) + return function(str) + return #match(pattern,str) + end +end + +if utfgmatch then + + function lpeg.count(str,what) -- replaces string.count + if type(what) == "string" then + local n = 0 + for _ in utfgmatch(str,what) do + n = n + 1 + end + return n + else -- 4 times slower but still faster than / function + return #match(Cs((P(what)/" " + nany)^0),str) + end + end + +else + + local cache = { } + + function lpeg.count(str,what) -- replaces string.count + if type(what) == "string" then + local p = cache[what] + if not p then + p = Cs((P(what)/" " + nany)^0) + cache[p] = p + end + return #match(p,str) + else -- 4 times slower but still faster than / function + return #match(Cs((P(what)/" " + nany)^0),str) + end + end + +end + +local patterns_escapes = { -- also defines in l-string + ["%"] = "%%", + ["."] = "%.", + ["+"] = "%+", ["-"] = "%-", ["*"] = "%*", + ["["] = "%[", ["]"] = "%]", + ["("] = "%)", [")"] = "%)", + -- ["{"] = "%{", ["}"] = "%}" + -- ["^"] = "%^", ["$"] = "%$", +} + +local simple_escapes = { -- also defines in l-string + ["-"] = "%-", + ["."] = "%.", + ["?"] = ".", + ["*"] = ".*", +} + +local p = Cs((S("-.+*%()[]") / patterns_escapes + anything)^0) +local s = Cs((S("-.+*%()[]") / simple_escapes + anything)^0) + +function string.escapedpattern(str,simple) + return match(simple and s or p,str) +end + +-- utf extensies + +lpeg.UP = lpeg.P + +if utfcharacters then + + function lpeg.US(str) + local p + for uc in utfcharacters(str) do + if p then + p = p + P(uc) + else + p = P(uc) + end + end + return p + end + + +elseif utfgmatch then + + function lpeg.US(str) + local p + for uc in utfgmatch(str,".") do + if p then + p = p + P(uc) + else + p = P(uc) + end + end + return p + end + +else + + function lpeg.US(str) + local p + local f = function(uc) + if p then + p = p + P(uc) + else + p = P(uc) + end + end + match((utf8char/f)^0,str) + return p + end + +end + +local range = Cs(utf8byte) * (Cs(utf8byte) + Cc(false)) + +local utfchar = unicode and unicode.utf8 and unicode.utf8.char + +function lpeg.UR(str,more) + local first, last + if type(str) == "number" then + first = str + last = more or first + else + first, last = match(range,str) + if not last then + return P(str) + end + end + if first == last then + return P(str) + elseif utfchar and last - first < 8 then -- a somewhat arbitrary criterium + local p + for i=first,last do + if p then + p = p + P(utfchar(i)) + else + p = P(utfchar(i)) + end + end + return p -- nil when invalid range + else + local f = function(b) + return b >= first and b <= last + end + return utf8byte / f -- nil when invalid range + end +end + +--~ lpeg.print(lpeg.R("ab","cd","gh")) +--~ lpeg.print(lpeg.P("a","b","c")) +--~ lpeg.print(lpeg.S("a","b","c")) + +--~ print(lpeg.count("äáàa",lpeg.P("á") + lpeg.P("à"))) +--~ print(lpeg.count("äáàa",lpeg.UP("áà"))) +--~ print(lpeg.count("äáàa",lpeg.US("àá"))) +--~ print(lpeg.count("äáàa",lpeg.UR("aá"))) +--~ print(lpeg.count("äáàa",lpeg.UR("àá"))) +--~ print(lpeg.count("äáàa",lpeg.UR(0x0000,0xFFFF))) + +function lpeg.oneof(list,...) -- lpeg.oneof("elseif","else","if","then") + if type(list) ~= "table" then + list = { list, ... } + end + -- sort(list) -- longest match first + local p = P(list[1]) + for l=2,#list do + p = p + P(list[l]) + end + return p +end + +function lpeg.is_lpeg(p) + return p and lpegtype(p) == "pattern" +end + +--~ Cf(Ct("") * (Cg(C(...) * "=" * Cs(...)))^0, rawset) diff --git a/Master/texmf-dist/tex/context/base/l-math.lua b/Master/texmf-dist/tex/context/base/l-math.lua index fc8db472142..48089957f71 100644 --- a/Master/texmf-dist/tex/context/base/l-math.lua +++ b/Master/texmf-dist/tex/context/base/l-math.lua @@ -9,33 +9,26 @@ if not modules then modules = { } end modules ['l-math'] = { local floor, sin, cos, tan = math.floor, math.sin, math.cos, math.tan if not math.round then - function math.round(x) - return floor(x + 0.5) - end + function math.round(x) return floor(x + 0.5) end end if not math.div then - function math.div(n,m) - return floor(n/m) - end + function math.div(n,m) return floor(n/m) end end if not math.mod then - function math.mod(n,m) - return n % m - end + function math.mod(n,m) return n % m end end local pipi = 2*math.pi/360 -function math.sind(d) - return sin(d*pipi) +if not math.sind then + function math.sind(d) return sin(d*pipi) end + function math.cosd(d) return cos(d*pipi) end + function math.tand(d) return tan(d*pipi) end end -function math.cosd(d) - return cos(d*pipi) -end - -function math.tand(d) - return tan(d*pipi) +if not math.odd then + function math.odd (n) return n % 2 == 0 end + function math.even(n) return n % 2 ~= 0 end end diff --git a/Master/texmf-dist/tex/context/base/l-md5.lua b/Master/texmf-dist/tex/context/base/l-md5.lua index 27955ef9b9e..1d471c966ca 100644 --- a/Master/texmf-dist/tex/context/base/l-md5.lua +++ b/Master/texmf-dist/tex/context/base/l-md5.lua @@ -7,6 +7,7 @@ if not modules then modules = { } end modules ['l-md5'] = { -- This also provides file checksums and checkers. +local md5, file = md5, file local gsub, format, byte = string.gsub, string.format, string.byte local function convert(str,fmt) @@ -30,14 +31,12 @@ if not md5.dec then function md5.dec(str) return convert(str,"%03i") end end --~ function md5.dec(str) return (gsub(md5.sum(str),".",remap)) end --~ end -file.needs_updating_threshold = 1 - -function file.needs_updating(oldname,newname) -- size modification access change +function file.needs_updating(oldname,newname,threshold) -- size modification access change local oldtime = lfs.attributes(oldname, modification) local newtime = lfs.attributes(newname, modification) if newtime >= oldtime then return false - elseif oldtime - newtime < file.needs_updating_threshold then + elseif oldtime - newtime < (threshold or 1) then return false else return true diff --git a/Master/texmf-dist/tex/context/base/l-number.lua b/Master/texmf-dist/tex/context/base/l-number.lua index a1249f0556a..b1ffb9ca990 100644 --- a/Master/texmf-dist/tex/context/base/l-number.lua +++ b/Master/texmf-dist/tex/context/base/l-number.lua @@ -6,11 +6,15 @@ if not modules then modules = { } end modules ['l-number'] = { license = "see context related readme files" } +-- this module will be replaced when we have the bit library + local tostring = tostring -local format, floor, insert, match = string.format, math.floor, table.insert, string.match +local format, floor, match, rep = string.format, math.floor, string.match, string.rep +local concat, insert = table.concat, table.insert local lpegmatch = lpeg.match -number = number or { } +number = number or { } +local number = number -- a,b,c,d,e,f = number.toset(100101) @@ -56,3 +60,71 @@ function number.bits(n,zero) end return t end + +--~ http://ricilake.blogspot.com/2007/10/iterating-bits-in-lua.html + +function number.bit(p) + return 2 ^ (p - 1) -- 1-based indexing +end + +function number.hasbit(x, p) -- typical call: if hasbit(x, bit(3)) then ... + return x % (p + p) >= p +end + +function number.setbit(x, p) + return hasbit(x, p) and x or x + p +end + +function number.clearbit(x, p) + return hasbit(x, p) and x - p or x +end + +--~ function number.tobitstring(n) +--~ if n == 0 then +--~ return "0" +--~ else +--~ local t = { } +--~ while n > 0 do +--~ insert(t,1,n % 2 > 0 and 1 or 0) +--~ n = floor(n/2) +--~ end +--~ return concat(t) +--~ end +--~ end + +function number.tobitstring(n,m) + if n == 0 then + if m then + rep("00000000",m) + else + return "00000000" + end + else + local t = { } + while n > 0 do + insert(t,1,n % 2 > 0 and 1 or 0) + n = floor(n/2) + end + local nn = 8 - #t % 8 + if nn > 0 and nn < 8 then + for i=1,nn do + insert(t,1,0) + end + end + if m then + m = m * 8 - #t + if m > 0 then + insert(t,1,rep("0",m)) + end + end + return concat(t) + end +end + +--~ print(number.tobitstring(8)) +--~ print(number.tobitstring(14)) +--~ print(number.tobitstring(66)) +--~ print(number.tobitstring(0x00)) +--~ print(number.tobitstring(0xFF)) +--~ print(number.tobitstring(46260767936,8)) +--~ print(#number.tobitstring(46260767936,6)) diff --git a/Master/texmf-dist/tex/context/base/l-os.lua b/Master/texmf-dist/tex/context/base/l-os.lua index fba2cd31770..91150623945 100644 --- a/Master/texmf-dist/tex/context/base/l-os.lua +++ b/Master/texmf-dist/tex/context/base/l-os.lua @@ -6,32 +6,119 @@ if not modules then modules = { } end modules ['l-os'] = { license = "see context related readme files" } +-- This file deals with some operating system issues. Please don't bother me +-- with the pros and cons of operating systems as they all have their flaws +-- and benefits. Bashing one of them won't help solving problems and fixing +-- bugs faster and is a waste of time and energy. +-- +-- path separators: / or \ ... we can use / everywhere +-- suffixes : dll so exe ... no big deal +-- quotes : we can use "" in most cases +-- expansion : unless "" are used * might give side effects +-- piping/threads : somewhat different for each os +-- locations : specific user file locations and settings can change over time +-- +-- os.type : windows | unix (new, we already guessed os.platform) +-- os.name : windows | msdos | linux | macosx | solaris | .. | generic (new) +-- os.platform : extended os.name with architecture + -- maybe build io.flush in os.execute -local find, format, gsub = string.find, string.format, string.gsub +local os = os +local find, format, gsub, upper = string.find, string.format, string.gsub, string.upper +local concat = table.concat local random, ceil = math.random, math.ceil +local rawget, rawset, type, getmetatable, setmetatable, tonumber = rawget, rawset, type, getmetatable, setmetatable, tonumber + +-- The following code permits traversing the environment table, at least +-- in luatex. Internally all environment names are uppercase. + +if not os.__getenv__ then + + os.__getenv__ = os.getenv + os.__setenv__ = os.setenv -local execute, spawn, exec, ioflush = os.execute, os.spawn or os.execute, os.exec or os.execute, io.flush + if os.env then + + local osgetenv = os.getenv + local ossetenv = os.setenv + local osenv = os.env local _ = osenv.PATH -- initialize the table + + function os.setenv(k,v) + if v == nil then + v = "" + end + local K = upper(k) + osenv[K] = v + if type(v) == "table" then + v = concat(v,";") -- path + end + ossetenv(K,v) + end + + function os.getenv(k) + local K = upper(k) + local v = osenv[K] or osenv[k] or osgetenv(K) or osgetenv(k) + if v == "" then + return nil + else + return v + end + end + + else + + local ossetenv = os.setenv + local osgetenv = os.getenv + local osenv = { } + + function os.setenv(k,v) + if v == nil then + v = "" + end + local K = upper(k) + osenv[K] = v + end + + function os.getenv(k) + local K = upper(k) + local v = osenv[K] or osgetenv(K) or osgetenv(k) + if v == "" then + return nil + else + return v + end + end + + local function __index(t,k) + return os.getenv(k) + end + local function __newindex(t,k,v) + os.setenv(k,v) + end + + os.env = { } + + setmetatable(os.env, { __index = __index, __newindex = __newindex } ) + + end + +end + +-- end of environment hack + +local execute, spawn, exec, iopopen, ioflush = os.execute, os.spawn or os.execute, os.exec or os.execute, io.popen, io.flush function os.execute(...) ioflush() return execute(...) end function os.spawn (...) ioflush() return spawn (...) end function os.exec (...) ioflush() return exec (...) end +function io.popen (...) ioflush() return iopopen(...) end function os.resultof(command) - ioflush() -- else messed up logging local handle = io.popen(command,"r") - if not handle then - -- print("unknown command '".. command .. "' in os.resultof") - return "" - else - return handle:read("*all") or "" - end + return handle and handle:read("*all") or "" end ---~ os.type : windows | unix (new, we already guessed os.platform) ---~ os.name : windows | msdos | linux | macosx | solaris | .. | generic (new) ---~ os.platform : extended os.name with architecture - if not io.fileseparator then if find(os.getenv("PATH"),";") then io.fileseparator, io.pathseparator, os.type = "\\", ";", os.type or "mswin" @@ -89,7 +176,7 @@ end -- no need for function anymore as we have more clever code and helpers now -- this metatable trickery might as well disappear -os.resolvers = os.resolvers or { } +os.resolvers = os.resolvers or { } -- will become private local resolvers = os.resolvers @@ -102,24 +189,6 @@ end setmetatable(os,osmt) -if not os.setenv then - - -- we still store them but they won't be seen in - -- child processes although we might pass them some day - -- using command concatination - - local env, getenv = { }, os.getenv - - function os.setenv(k,v) - env[k] = v - end - - function os.getenv(k) - return env[k] or getenv(k) - end - -end - -- we can use HOSTTYPE on some platforms local name, platform = os.name or "linux", os.getenv("MTX_PLATFORM") or "" @@ -159,7 +228,7 @@ elseif os.type == "windows" then elseif name == "linux" then function os.resolvers.platform(t,k) - -- we sometims have HOSTTYPE set so let's check that first + -- we sometimes have HOSTTYPE set so let's check that first local platform, architecture = "", os.getenv("HOSTTYPE") or os.resultof("uname -m") or "" if find(architecture,"x86_64") then platform = "linux-64" @@ -237,10 +306,10 @@ elseif name == "freebsd" then elseif name == "kfreebsd" then function os.resolvers.platform(t,k) - -- we sometims have HOSTTYPE set so let's check that first + -- we sometimes have HOSTTYPE set so let's check that first local platform, architecture = "", os.getenv("HOSTTYPE") or os.resultof("uname -m") or "" if find(architecture,"x86_64") then - platform = "kfreebsd-64" + platform = "kfreebsd-amd64" else platform = "kfreebsd-i386" end diff --git a/Master/texmf-dist/tex/context/base/l-pdfview.lua b/Master/texmf-dist/tex/context/base/l-pdfview.lua index 627477ee823..6fd3ac24686 100644 --- a/Master/texmf-dist/tex/context/base/l-pdfview.lua +++ b/Master/texmf-dist/tex/context/base/l-pdfview.lua @@ -6,41 +6,54 @@ if not modules then modules = { } end modules ['l-pdfview'] = { license = "see context related readme files" } -local format, getenv = string.format, os.getenv +-- Todo: figure out pdfopen/pdfclose on linux. Calling e.g. okular directly +-- doesn't work in linux when issued from scite as it blocks the editor (no +-- & possible or so). + +local format, concat = string.format, table.concat pdfview = pdfview or { } local opencalls = { - ['default'] = "pdfopen --file", -- "pdfopen --back --file" + ['default'] = "pdfopen --ax --file", -- "pdfopen --back --file" ['xpdf'] = "xpdfopen", } local closecalls= { - ['default'] = "pdfclose --file", + ['default'] = "pdfclose --ax --file", ['xpdf'] = nil, } local allcalls = { - ['default'] = "pdfclose --all", + ['default'] = "pdfclose --ax --all", ['xpdf'] = nil, } if os.type == "windows" then - opencalls['okular'] = 'start "test" "c:/program files/kde/bin/okular.exe" --unique' -- todo: get focus + -- opencalls['okular'] = 'start "test" "c:/program files/kde/bin/okular.exe" --unique' -- todo: get focus + opencalls['okular'] = 'start "test" "c:/data/system/kde/bin/okular.exe" --unique' -- todo: get focus else - opencalls['okular'] = 'okular --unique' + opencalls['okular'] = 'okular --unique' end -pdfview.METHOD = "MTX_PDFVIEW_METHOD" -pdfview.method = getenv(pdfview.METHOD) or 'default' -pdfview.method = (opencalls[pdfview.method] and pdfview.method) or 'default' +pdfview.method = "default" + +directives.register("pdfview.method", function(v) + pdfview.method = (opencalls[v] and v) or 'default' +end) + +function pdfview.setmethod(method) + if method and opencalls[method] then + pdfview.method = method + end +end function pdfview.methods() - return table.concat(table.sortedkeys(opencalls), " ") + return concat(table.sortedkeys(opencalls), " ") end function pdfview.status() - return format("pdfview methods: %s, current method: %s, MTX_PDFVIEW_METHOD=%s",pdfview.methods(),pdfview.method,getenv(pdfview.METHOD) or "") + return format("pdfview methods: %s, current method: %s (directives_pdfview_method)",pdfview.methods(),tostring(pdfview.method)) end local openedfiles = { } diff --git a/Master/texmf-dist/tex/context/base/l-set.lua b/Master/texmf-dist/tex/context/base/l-set.lua index f844d0b4004..2370f0139ff 100644 --- a/Master/texmf-dist/tex/context/base/l-set.lua +++ b/Master/texmf-dist/tex/context/base/l-set.lua @@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['l-set'] = { license = "see context related readme files" } +-- This will become obsolete when we have the bitset library embedded. + set = set or { } local nums = { } @@ -49,10 +51,11 @@ function set.tolist(n) if n == 0 or not tabs[n] then return "" else - local t = { } + local t, n = { }, 0 for k, v in next, tabs[n] do if v then - t[#t+1] = k + n = n + 1 + t[n] = k end end return concat(t," ") diff --git a/Master/texmf-dist/tex/context/base/l-string.lua b/Master/texmf-dist/tex/context/base/l-string.lua index 9856d521249..989e57f753b 100644 --- a/Master/texmf-dist/tex/context/base/l-string.lua +++ b/Master/texmf-dist/tex/context/base/l-string.lua @@ -6,8 +6,9 @@ if not modules then modules = { } end modules ['l-string'] = { license = "see context related readme files" } +local string = string local sub, gsub, find, match, gmatch, format, char, byte, rep, lower = string.sub, string.gsub, string.find, string.match, string.gmatch, string.format, string.char, string.byte, string.rep, string.lower -local lpegmatch = lpeg.match +local lpegmatch, S, C, Ct = lpeg.match, lpeg.S, lpeg.C, lpeg.Ct -- some functions may disappear as they are not used anywhere @@ -15,196 +16,75 @@ if not string.split then -- this will be overloaded by a faster lpeg variant - function string:split(pattern) - if #self > 0 then - local t = { } - for s in gmatch(self..pattern,"(.-)"..pattern) do - t[#t+1] = s + function string.split(str,pattern) + local t = { } + if #str > 0 then + local n = 1 + for s in gmatch(str..pattern,"(.-)"..pattern) do + t[n] = s + n = n + 1 end - return t - else - return { } end + return t end end -local chr_to_esc = { - ["%"] = "%%", - ["."] = "%.", - ["+"] = "%+", ["-"] = "%-", ["*"] = "%*", - ["^"] = "%^", ["$"] = "%$", - ["["] = "%[", ["]"] = "%]", - ["("] = "%(", [")"] = "%)", - ["{"] = "%{", ["}"] = "%}" -} - -string.chr_to_esc = chr_to_esc - -function string:esc() -- variant 2 - return (gsub(self,"(.)",chr_to_esc)) -end - -function string:unquote() - return (gsub(self,"^([\"\'])(.*)%1$","%2")) +function string.unquoted(str) + return (gsub(str,"^([\"\'])(.*)%1$","%2")) end ---~ function string:unquote() ---~ if find(self,"^[\'\"]") then ---~ return sub(self,2,-2) +--~ function stringunquoted(str) +--~ if find(str,"^[\'\"]") then +--~ return sub(str,2,-2) --~ else ---~ return self +--~ return str --~ end --~ end -function string:quote() -- we could use format("%q") - return format("%q",self) +function string.quoted(str) + return format("%q",str) -- always " end -function string:count(pattern) -- variant 3 +function string.count(str,pattern) -- variant 3 local n = 0 - for _ in gmatch(self,pattern) do + for _ in gmatch(str,pattern) do -- not for utf n = n + 1 end return n end -function string:limit(n,sentinel) - if #self > n then - sentinel = sentinel or " ..." - return sub(self,1,(n-#sentinel)) .. sentinel - else - return self - end -end - ---~ function string:strip() -- the .- is quite efficient ---~ -- return match(self,"^%s*(.-)%s*$") or "" ---~ -- return match(self,'^%s*(.*%S)') or '' -- posted on lua list ---~ return find(s,'^%s*$') and '' or match(s,'^%s*(.*%S)') ---~ end - -do -- roberto's variant: - local space = lpeg.S(" \t\v\n") - local nospace = 1 - space - local stripper = space^0 * lpeg.C((space^0 * nospace^1)^0) - function string.strip(str) - return lpegmatch(stripper,str) or "" - end -end - -function string:is_empty() - return not find(self,"%S") -end - -function string:enhance(pattern,action) - local ok, n = true, 0 - while ok do - ok = false - self = gsub(self,pattern, function(...) - ok, n = true, n + 1 - return action(...) - end) - end - return self, n -end - -local chr_to_hex, hex_to_chr = { }, { } - -for i=0,255 do - local c, h = char(i), format("%02X",i) - chr_to_hex[c], hex_to_chr[h] = h, c -end - -function string:to_hex() - return (gsub(self or "","(.)",chr_to_hex)) -end - -function string:from_hex() - return (gsub(self or "","(..)",hex_to_chr)) -end - -if not string.characters then - - local function nextchar(str, index) - index = index + 1 - return (index <= #str) and index or nil, sub(str,index,index) - end - function string:characters() - return nextchar, self, 0 - end - local function nextbyte(str, index) - index = index + 1 - return (index <= #str) and index or nil, byte(sub(str,index,index)) - end - function string:bytes() - return nextbyte, self, 0 - end - -end - --- we can use format for this (neg n) - -function string:rpadd(n,chr) - local m = n-#self - if m > 0 then - return self .. rep(chr or " ",m) - else - return self - end -end - -function string:lpadd(n,chr) - local m = n-#self - if m > 0 then - return rep(chr or " ",m) .. self +function string.limit(str,n,sentinel) -- not utf proof + if #str > n then + sentinel = sentinel or "..." + return sub(str,1,(n-#sentinel)) .. sentinel else - return self + return str end end -string.padd = string.rpadd +local space = S(" \t\v\n") +local nospace = 1 - space +local stripper = space^0 * C((space^0 * nospace^1)^0) -- roberto's code -function is_number(str) -- tonumber - return find(str,"^[%-%+]?[%d]-%.?[%d+]$") == 1 +function string.strip(str) + return lpegmatch(stripper,str) or "" end ---~ print(is_number("1")) ---~ print(is_number("1.1")) ---~ print(is_number(".1")) ---~ print(is_number("-0.1")) ---~ print(is_number("+0.1")) ---~ print(is_number("-.1")) ---~ print(is_number("+.1")) - -function string:split_settings() -- no {} handling, see l-aux for lpeg variant - if find(self,"=") then - local t = { } - for k,v in gmatch(self,"(%a+)=([^%,]*)") do - t[k] = v - end - return t - else - return nil - end +function string.is_empty(str) + return not find(str,"%S") end local patterns_escapes = { - ["-"] = "%-", - ["."] = "%.", - ["+"] = "%+", - ["*"] = "%*", ["%"] = "%%", - ["("] = "%)", - [")"] = "%)", - ["["] = "%[", - ["]"] = "%]", + ["."] = "%.", + ["+"] = "%+", ["-"] = "%-", ["*"] = "%*", + ["["] = "%[", ["]"] = "%]", + ["("] = "%(", [")"] = "%)", + -- ["{"] = "%{", ["}"] = "%}" + -- ["^"] = "%^", ["$"] = "%$", } -function string:pattesc() - return (gsub(self,".",patterns_escapes)) -end - local simple_escapes = { ["-"] = "%-", ["."] = "%.", @@ -212,77 +92,27 @@ local simple_escapes = { ["*"] = ".*", } -function string:simpleesc() - return (gsub(self,".",simple_escapes)) -end - -function string:tohash() - local t = { } - for s in gmatch(self,"([^, ]+)") do -- lpeg - t[s] = true - end - return t -end - -local pattern = lpeg.Ct(lpeg.C(1)^0) - -function string:totable() - return lpegmatch(pattern,self) +function string.escapedpattern(str,simple) + return (gsub(str,".",simple and simple_escapes or patterns_escapes)) end ---~ local t = { ---~ "1234567123456712345671234567", ---~ "a\tb\tc", ---~ "aa\tbb\tcc", ---~ "aaa\tbbb\tccc", ---~ "aaaa\tbbbb\tcccc", ---~ "aaaaa\tbbbbb\tccccc", ---~ "aaaaaa\tbbbbbb\tcccccc", ---~ } ---~ for k,v do ---~ print(string.tabtospace(t[k])) ---~ end - -function string.tabtospace(str,tab) - -- we don't handle embedded newlines - while true do - local s = find(str,"\t") - if s then - if not tab then tab = 7 end -- only when found - local d = tab-(s-1) % tab - if d > 0 then - str = gsub(str,"\t",rep(" ",d),1) - else - str = gsub(str,"\t","",1) - end +function string.topattern(str,lowercase,strict) + if str == "" then + return ".*" + else + str = gsub(str,".",simple_escapes) + if lowercase then + str = lower(str) + end + if strict then + return "^" .. str .. "$" else - break + return str end end - return str end -function string:compactlong() -- strips newlines and leading spaces - self = gsub(self,"[\n\r]+ *","") - self = gsub(self,"^ *","") - return self -end +-- obsolete names: -function string:striplong() -- strips newlines and leading spaces - self = gsub(self,"^%s*","") - self = gsub(self,"[\n\r]+ *","\n") - return self -end - -function string:topattern(lowercase,strict) - if lowercase then - self = lower(self) - end - self = gsub(self,".",simple_escapes) - if self == "" then - self = ".*" - elseif strict then - self = "^" .. self .. "$" - end - return self -end +string.quote = string.quoted +string.unquote = string.unquoted diff --git a/Master/texmf-dist/tex/context/base/l-table.lua b/Master/texmf-dist/tex/context/base/l-table.lua index ee395d0f140..8fdb36a7f71 100644 --- a/Master/texmf-dist/tex/context/base/l-table.lua +++ b/Master/texmf-dist/tex/context/base/l-table.lua @@ -6,12 +6,10 @@ if not modules then modules = { } end modules ['l-table'] = { license = "see context related readme files" } -table.join = table.concat - +local type, next, tostring, tonumber, ipairs, table, string = type, next, tostring, tonumber, ipairs, table, string local concat, sort, insert, remove = table.concat, table.sort, table.insert, table.remove local format, find, gsub, lower, dump, match = string.format, string.find, string.gsub, string.lower, string.dump, string.match local getmetatable, setmetatable = getmetatable, setmetatable -local type, next, tostring, tonumber, ipairs = type, next, tostring, tonumber, ipairs -- Starting with version 5.2 Lua no longer provide ipairs, which makes -- sense. As we already used the for loop and # in most places the @@ -63,50 +61,56 @@ end -- extra functions, some might go (when not used) function table.strip(tab) - local lst = { } + local lst, l = { }, 0 for i=1,#tab do local s = gsub(tab[i],"^%s*(.-)%s*$","%1") if s == "" then -- skip this one else - lst[#lst+1] = s + l = l + 1 + lst[l] = s end end return lst end function table.keys(t) - local k = { } + local keys, k = { }, 0 for key, _ in next, t do - k[#k+1] = key + k = k + 1 + keys[k] = key end - return k + return keys end local function compare(a,b) - return (tostring(a) < tostring(b)) + local ta, tb = type(a), type(b) -- needed, else 11 < 2 + if ta == tb then + return a < b + else + return tostring(a) < tostring(b) + end end local function sortedkeys(tab) - local srt, kind = { }, 0 -- 0=unknown 1=string, 2=number 3=mixed + local srt, category, s = { }, 0, 0 -- 0=unknown 1=string, 2=number 3=mixed for key,_ in next, tab do - srt[#srt+1] = key - if kind == 3 then + s = s + 1 + srt[s] = key + if category == 3 then -- no further check else local tkey = type(key) if tkey == "string" then - -- if kind == 2 then kind = 3 else kind = 1 end - kind = (kind == 2 and 3) or 1 + category = (category == 2 and 3) or 1 elseif tkey == "number" then - -- if kind == 1 then kind = 3 else kind = 2 end - kind = (kind == 1 and 3) or 2 + category = (category == 1 and 3) or 2 else - kind = 3 + category = 3 end end end - if kind == 0 or kind == 3 then + if category == 0 or category == 3 then sort(srt,compare) else sort(srt) @@ -115,9 +119,12 @@ local function sortedkeys(tab) end local function sortedhashkeys(tab) -- fast one - local srt = { } + local srt, s = { }, 0 for key,_ in next, tab do - srt[#srt+1] = key + if key then + s= s + 1 + srt[s] = key + end end sort(srt) return srt @@ -126,34 +133,50 @@ end table.sortedkeys = sortedkeys table.sortedhashkeys = sortedhashkeys -function table.sortedhash(t) - local s = sortedhashkeys(t) -- maybe just sortedkeys - local n = 0 - local function kv(s) - n = n + 1 - local k = s[n] - return k, t[k] +local function nothing() end + +local function sortedhash(t) + if t then + local n, s = 0, sortedkeys(t) -- the robust one + local function kv(s) + n = n + 1 + local k = s[n] + return k, t[k] + end + return kv, s + else + return nothing end - return kv, s end -table.sortedpairs = table.sortedhash +table.sortedhash = sortedhash +table.sortedpairs = sortedhash function table.append(t, list) - for _,v in next, list do - insert(t,v) + local n = #t + for i=1,#list do + n = n + 1 + t[n] = list[i] end + return t end function table.prepend(t, list) - for k,v in next, list do - insert(t,k,v) + local nl = #list + local nt = nl + #t + for i=#t,1,-1 do + t[nt] = t[i] + nt = nt - 1 end + for i=1,#list do + t[i] = list[i] + end + return t end function table.merge(t, ...) -- first one is target - t = t or {} - local lst = {...} + t = t or { } + local lst = { ... } for i=1,#lst do for k, v in next, lst[i] do t[k] = v @@ -163,7 +186,7 @@ function table.merge(t, ...) -- first one is target end function table.merged(...) - local tmp, lst = { }, {...} + local tmp, lst = { }, { ... } for i=1,#lst do for k, v in next, lst[i] do tmp[k] = v @@ -173,41 +196,45 @@ function table.merged(...) end function table.imerge(t, ...) - local lst = {...} + local lst, nt = { ... }, #t for i=1,#lst do local nst = lst[i] for j=1,#nst do - t[#t+1] = nst[j] + nt = nt + 1 + t[nt] = nst[j] end end return t end function table.imerged(...) - local tmp, lst = { }, {...} + local tmp, ntmp, lst = { }, 0, {...} for i=1,#lst do local nst = lst[i] for j=1,#nst do - tmp[#tmp+1] = nst[j] + ntmp = ntmp + 1 + tmp[ntmp] = nst[j] end end return tmp end -local function fastcopy(old) -- fast one +local function fastcopy(old,metatabletoo) -- fast one if old then local new = { } for k,v in next, old do if type(v) == "table" then - new[k] = fastcopy(v) -- was just table.copy + new[k] = fastcopy(v,metatabletoo) -- was just table.copy else new[k] = v end end - -- optional second arg - local mt = getmetatable(old) - if mt then - setmetatable(new,mt) + if metatabletoo then + -- optional second arg + local mt = getmetatable(old) + if mt then + setmetatable(new,mt) + end end return new else @@ -215,6 +242,8 @@ local function fastcopy(old) -- fast one end end +-- todo : copy without metatable + local function copy(t, tables) -- taken from lua wiki, slightly adapted tables = tables or { } local tcopy = {} @@ -247,33 +276,14 @@ end table.fastcopy = fastcopy table.copy = copy --- roughly: copy-loop : unpack : sub == 0.9 : 0.4 : 0.45 (so in critical apps, use unpack) - -function table.sub(t,i,j) - return { unpack(t,i,j) } -end - -function table.replace(a,b) - for k,v in next, b do - a[k] = v +function table.derive(parent) + local child = { } + if parent then + setmetatable(child,{ __index = parent }) end + return child end --- slower than #t on indexed tables (#t only returns the size of the numerically indexed slice) - -function table.is_empty(t) -- obolete, use inline code instead - return not t or not next(t) -end - -function table.one_entry(t) -- obolete, use inline code instead - local n = next(t) - return n and not next(t,n) -end - ---~ function table.starts_at(t) -- obsolete, not nice anyway ---~ return ipairs(t,1)(t,0) ---~ end - function table.tohash(t,value) local h = { } if t then @@ -286,27 +296,19 @@ function table.tohash(t,value) end function table.fromhash(t) - local h = { } + local hsh, h = { }, 0 for k, v in next, t do -- no ipairs here - if v then h[#h+1] = k end + if v then + h = h + 1 + hsh[h] = k + end end - return h + return hsh end ---~ print(table.serialize(t), "\n") ---~ print(table.serialize(t,"name"), "\n") ---~ print(table.serialize(t,false), "\n") ---~ print(table.serialize(t,true), "\n") ---~ print(table.serialize(t,"name",true), "\n") ---~ print(table.serialize(t,"name",true,true), "\n") - -table.serialize_functions = true -table.serialize_compact = true -table.serialize_inline = true - local noquotes, hexify, handle, reduce, compact, inline, functions -local reserved = table.tohash { -- intercept a language flaw, no reserved words as key +local reserved = table.tohash { -- intercept a language inconvenience: no reserved words as key 'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat', 'return', 'then', 'true', 'until', 'while', } @@ -318,20 +320,23 @@ local function simple_table(t) n = n + 1 end if n == #t then - local tt = { } + local tt, nt = { }, 0 for i=1,#t do local v = t[i] local tv = type(v) if tv == "number" then + nt = nt + 1 if hexify then - tt[#tt+1] = format("0x%04X",v) + tt[nt] = format("0x%04X",v) else - tt[#tt+1] = tostring(v) -- tostring not needed + tt[nt] = tostring(v) -- tostring not needed end elseif tv == "boolean" then - tt[#tt+1] = tostring(v) + nt = nt + 1 + tt[nt] = tostring(v) elseif tv == "string" then - tt[#tt+1] = format("%q",v) + nt = nt + 1 + tt[nt] = format("%q",v) else tt = nil break @@ -357,21 +362,25 @@ local function do_serialize(root,name,depth,level,indexed) depth = depth .. " " if indexed then handle(format("%s{",depth)) - elseif name then - --~ handle(format("%s%s={",depth,key(name))) - if type(name) == "number" then -- or find(k,"^%d+$") then + else + local tn = type(name) + if tn == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s[0x%04X]={",depth,name)) else handle(format("%s[%s]={",depth,name)) end - elseif noquotes and not reserved[name] and find(name,"^%a[%w%_]*$") then - handle(format("%s%s={",depth,name)) + elseif tn == "string" then + if noquotes and not reserved[name] and find(name,"^%a[%w%_]*$") then + handle(format("%s%s={",depth,name)) + else + handle(format("%s[%q]={",depth,name)) + end + elseif tn == "boolean" then + handle(format("%s[%s]={",depth,tostring(name))) else - handle(format("%s[%q]={",depth,name)) + handle(format("%s{",depth)) end - else - handle(format("%s{",depth)) end end -- we could check for k (index) being number (cardinal) @@ -391,8 +400,8 @@ local function do_serialize(root,name,depth,level,indexed) --~ if v == root then -- circular --~ else - local t = type(v) - if compact and first and type(k) == "number" and k >= first and k <= last then + local t, tk = type(v), type(k) + if compact and first and tk == "number" and k >= first and k <= last then if t == "number" then if hexify then handle(format("%s 0x%04X,",depth,v)) @@ -434,17 +443,18 @@ local function do_serialize(root,name,depth,level,indexed) handle(format("%s __p__=nil,",depth)) end elseif t == "number" then - --~ if hexify then - --~ handle(format("%s %s=0x%04X,",depth,key(k),v)) - --~ else - --~ handle(format("%s %s=%s,",depth,key(k),v)) -- %.99g - --~ end - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=0x%04X,",depth,k,v)) else handle(format("%s [%s]=%s,",depth,k,v)) -- %.99g end + elseif tk == "boolean" then + if hexify then + handle(format("%s [%s]=0x%04X,",depth,tostring(k),v)) + else + handle(format("%s [%s]=%s,",depth,tostring(k),v)) -- %.99g + end elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then if hexify then handle(format("%s %s=0x%04X,",depth,k,v)) @@ -460,26 +470,28 @@ local function do_serialize(root,name,depth,level,indexed) end elseif t == "string" then if reduce and tonumber(v) then - --~ handle(format("%s %s=%s,",depth,key(k),v)) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%s,",depth,k,v)) else handle(format("%s [%s]=%s,",depth,k,v)) end + elseif tk == "boolean" then + handle(format("%s [%s]=%s,",depth,tostring(k),v)) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%s,",depth,k,v)) else handle(format("%s [%q]=%s,",depth,k,v)) end else - --~ handle(format("%s %s=%q,",depth,key(k),v)) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%q,",depth,k,v)) else handle(format("%s [%s]=%q,",depth,k,v)) end + elseif tk == "boolean" then + handle(format("%s [%s]=%q,",depth,tostring(k),v)) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%q,",depth,k,v)) else @@ -488,13 +500,14 @@ local function do_serialize(root,name,depth,level,indexed) end elseif t == "table" then if not next(v) then - --~ handle(format("%s %s={},",depth,key(k))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]={},",depth,k)) else handle(format("%s [%s]={},",depth,k)) end + elseif tk == "boolean" then + handle(format("%s [%s]={},",depth,tostring(k))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s={},",depth,k)) else @@ -503,13 +516,14 @@ local function do_serialize(root,name,depth,level,indexed) elseif inline then local st = simple_table(v) if st then - --~ handle(format("%s %s={ %s },",depth,key(k),concat(st,", "))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]={ %s },",depth,k,concat(st,", "))) else handle(format("%s [%s]={ %s },",depth,k,concat(st,", "))) end + elseif tk == "boolean" then -- or find(k,"^%d+$") then + handle(format("%s [%s]={ %s },",depth,tostring(k),concat(st,", "))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s={ %s },",depth,k,concat(st,", "))) else @@ -522,13 +536,14 @@ local function do_serialize(root,name,depth,level,indexed) do_serialize(v,k,depth,level+1) end elseif t == "boolean" then - --~ handle(format("%s %s=%s,",depth,key(k),tostring(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%s,",depth,k,tostring(v))) else handle(format("%s [%s]=%s,",depth,k,tostring(v))) end + elseif tk == "boolean" then -- or find(k,"^%d+$") then + handle(format("%s [%s]=%s,",depth,tostring(k),tostring(v))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%s,",depth,k,tostring(v))) else @@ -536,27 +551,30 @@ local function do_serialize(root,name,depth,level,indexed) end elseif t == "function" then if functions then - --~ handle(format('%s %s=loadstring(%q),',depth,key(k),dump(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=loadstring(%q),",depth,k,dump(v))) else handle(format("%s [%s]=loadstring(%q),",depth,k,dump(v))) end + elseif tk == "boolean" then + handle(format("%s [%s]=loadstring(%q),",depth,tostring(k),dump(v))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=loadstring(%q),",depth,k,dump(v))) else - handle(format("%s [%q]=loadstring(%q),",depth,k,dump(v))) + -- handle(format("%s [%q]=loadstring(%q),",depth,k,dump(v))) + handle(format("%s [%q]=loadstring(%q),",depth,k,debug.getinfo(v).what == "C" and "C code" or dump(v))) end end else - --~ handle(format("%s %s=%q,",depth,key(k),tostring(v))) - if type(k) == "number" then -- or find(k,"^%d+$") then + if tk == "number" then -- or find(k,"^%d+$") then if hexify then handle(format("%s [0x%04X]=%q,",depth,k,tostring(v))) else handle(format("%s [%s]=%q,",depth,k,tostring(v))) end + elseif tk == "boolean" then -- or find(k,"^%d+$") then + handle(format("%s [%s]=%q,",depth,tostring(k),tostring(v))) elseif noquotes and not reserved[k] and find(k,"^%a[%w%_]*$") then handle(format("%s %s=%q,",depth,k,tostring(v))) else @@ -574,15 +592,34 @@ end -- replacing handle by a direct t[#t+1] = ... (plus test) is not much -- faster (0.03 on 1.00 for zapfino.tma) -local function serialize(root,name,_handle,_reduce,_noquotes,_hexify) - noquotes = _noquotes - hexify = _hexify - handle = _handle or print - reduce = _reduce or false - compact = table.serialize_compact - inline = compact and table.serialize_inline - functions = table.serialize_functions +local function serialize(_handle,root,name,specification) -- handle wins local tname = type(name) + if type(specification) == "table" then + noquotes = specification.noquotes + hexify = specification.hexify + handle = _handle or specification.handle or print + reduce = specification.reduce or false + functions = specification.functions + compact = specification.compact + inline = specification.inline and compact + if functions == nil then + functions = true + end + if compact == nil then + compact = true + end + if inline == nil then + inline = compact + end + else + noquotes = false + hexify = false + handle = _handle or print + reduce = false + compact = true + inline = true + functions = true + end if tname == "string" then if name == "return" then handle("return {") @@ -604,8 +641,17 @@ local function serialize(root,name,_handle,_reduce,_noquotes,_hexify) else handle("t={") end - if root and next(root) then - do_serialize(root,name,"",0,indexed) + if root then + -- The dummy access will initialize a table that has a delayed initialization + -- using a metatable. (maybe explicitly test for metatable) + if getmetatable(root) then -- todo: make this an option, maybe even per subtable + local dummy = root._w_h_a_t_e_v_e_r_ + root._w_h_a_t_e_v_e_r_ = nil + end + -- Let's forget about empty tables. + if next(root) then + do_serialize(root,name,"",0) + end end handle("}") end @@ -619,18 +665,17 @@ end --~ 'return' : return { } --~ number : [number] = { } -function table.serialize(root,name,reduce,noquotes,hexify) - local t = { } +function table.serialize(root,name,specification) + local t, n = { }, 0 local function flush(s) - t[#t+1] = s + n = n + 1 + t[n] = s end - serialize(root,name,flush,reduce,noquotes,hexify) + serialize(flush,root,name,specification) return concat(t,"\n") end -function table.tohandle(handle,root,name,reduce,noquotes,hexify) - serialize(root,name,handle,reduce,noquotes,hexify) -end +table.tohandle = serialize -- sometimes tables are real use (zapfino extra pro is some 85M) in which -- case a stepwise serialization is nice; actually, we could consider: @@ -641,73 +686,63 @@ end -- -- so this is on the todo list -table.tofile_maxtab = 2*1024 +local maxtab = 2*1024 -function table.tofile(filename,root,name,reduce,noquotes,hexify) +function table.tofile(filename,root,name,specification) local f = io.open(filename,'w') if f then - local maxtab = table.tofile_maxtab if maxtab > 1 then - local t = { } + local t, n = { }, 0 local function flush(s) - t[#t+1] = s - if #t > maxtab then + n = n + 1 + t[n] = s + if n > maxtab then f:write(concat(t,"\n"),"\n") -- hm, write(sometable) should be nice - t = { } + t, n = { }, 0 -- we could recycle t if needed end end - serialize(root,name,flush,reduce,noquotes,hexify) + serialize(flush,root,name,specification) f:write(concat(t,"\n"),"\n") else local function flush(s) f:write(s,"\n") end - serialize(root,name,flush,reduce,noquotes,hexify) + serialize(flush,root,name,specification) end f:close() + io.flush() end end -local function flatten(t,f,complete) -- is this used? meybe a variant with next, ... - for i=1,#t do - local v = t[i] - if type(v) == "table" then - if complete or type(v[1]) == "table" then - flatten(v,f,complete) +local function flattened(t,f,depth) + if f == nil then + f = { } + depth = 0xFFFF + elseif tonumber(f) then + -- assume then only two arguments are given + depth = f + f = { } + elseif not depth then + depth = 0xFFFF + end + for k, v in next, t do + if type(k) ~= "number" then + if depth > 0 and type(v) == "table" then + flattened(v,f,depth-1) else - f[#f+1] = v + f[k] = v end - else - f[#f+1] = v end end -end - -function table.flatten(t) - local f = { } - flatten(t,f,true) - return f -end - -function table.unnest(t) -- bad name - local f = { } - flatten(t,f,false) - return f -end - -table.flatten_one_level = table.unnest - --- a better one: - -local function flattened(t,f) - if not f then - f = { } - end - for k, v in next, t do - if type(v) == "table" then - flattened(v,f) + local n = #f + for k=1,#t do + local v = t[k] + if depth > 0 and type(v) == "table" then + flattened(v,f,depth-1) + n = #f else - f[k] = v + n = n + 1 + f[n] = v end end return f @@ -715,49 +750,27 @@ end table.flattened = flattened --- the next three may disappear - -function table.remove_value(t,value) -- todo: n - if value then - for i=1,#t do - if t[i] == value then - remove(t,i) - -- remove all, so no: return - end - end +local function unnest(t,f) -- only used in mk, for old times sake + if not f then -- and only relevant for token lists + f = { } end -end - -function table.insert_before_value(t,value,str) - if str then - if value then - for i=1,#t do - if t[i] == value then - insert(t,i,str) - return - end + for i=1,#t do + local v = t[i] + if type(v) == "table" then + if type(v[1]) == "table" then + unnest(v,f) + else + f[#f+1] = v end + else + f[#f+1] = v end - insert(t,1,str) - elseif value then - insert(t,1,value) end + return f end -function table.insert_after_value(t,value,str) - if str then - if value then - for i=1,#t do - if t[i] == value then - insert(t,i+1,str) - return - end - end - end - t[#t+1] = str - elseif value then - t[#t+1] = value - end +function table.unnest(t) -- bad name + return unnest(t) end local function are_equal(a,b,n,m) -- indexed @@ -784,7 +797,7 @@ end local function identical(a,b) -- assumes same structure for ka, va in next, a do - local vb = b[k] + local vb = b[ka] if va == vb then -- same elseif type(va) == "table" and type(vb) == "table" then @@ -798,8 +811,8 @@ local function identical(a,b) -- assumes same structure return true end -table.are_equal = are_equal table.identical = identical +table.are_equal = are_equal -- maybe also make a combined one @@ -825,86 +838,90 @@ function table.contains(t, v) end function table.count(t) - local n, e = 0, next(t) - while e do - n, e = n + 1, next(t,e) + local n = 0 + for k, v in next, t do + n = n + 1 end return n end -function table.swapped(t) - local s = { } +function table.swapped(t,s) -- hash + local n = { } + if s then +--~ for i=1,#s do +--~ n[i] = s[i] +--~ end + for k, v in next, s do + n[k] = v + end + end +--~ for i=1,#t do +--~ local ti = t[i] -- don't ask but t[i] can be nil +--~ if ti then +--~ n[ti] = i +--~ end +--~ end for k, v in next, t do - s[v] = k + n[v] = k end - return s + return n end ---~ function table.are_equal(a,b) ---~ return table.serialize(a) == table.serialize(b) ---~ end - -function table.clone(t,p) -- t is optional or nil or table - if not p then - t, p = { }, t or { } - elseif not t then - t = { } +function table.reversed(t) + if t then + local tt, tn = { }, #t + if tn > 0 then + local ttn = 0 + for i=tn,1,-1 do + ttn = ttn + 1 + tt[ttn] = t[i] + end + end + return tt end - setmetatable(t, { __index = function(_,key) return p[key] end }) -- why not __index = p ? - return t -end - -function table.hexed(t,seperator) - local tt = { } - for i=1,#t do tt[i] = format("0x%04X",t[i]) end - return concat(tt,seperator or " ") end -function table.reverse_hash(h) - local r = { } - for k,v in next, h do - r[v] = lower(gsub(k," ","")) +function table.sequenced(t,sep,simple) -- hash only + local s, n = { }, 0 + for k, v in sortedhash(t) do + if simple then + if v == true then + n = n + 1 + s[n] = k + elseif v and v~= "" then + n = n + 1 + s[n] = k .. "=" .. tostring(v) + end + else + n = n + 1 + s[n] = k .. "=" .. tostring(v) + end end - return r + return concat(s, sep or " | ") end -function table.reverse(t) - local tt = { } - if #t > 0 then - for i=#t,1,-1 do - tt[#tt+1] = t[i] - end +function table.print(t,...) + if type(t) ~= "table" then + print(tostring(t)) + else + table.tohandle(print,t,...) end - return tt end -function table.insert_before_value(t,value,extra) - for i=1,#t do - if t[i] == extra then - remove(t,i) - end - end - for i=1,#t do - if t[i] == value then - insert(t,i,extra) - return - end - end - insert(t,1,extra) +-- -- -- obsolete but we keep them for a while and might comment them later -- -- -- + +-- roughly: copy-loop : unpack : sub == 0.9 : 0.4 : 0.45 (so in critical apps, use unpack) + +function table.sub(t,i,j) + return { unpack(t,i,j) } end -function table.insert_after_value(t,value,extra) - for i=1,#t do - if t[i] == extra then - remove(t,i) - end - end - for i=1,#t do - if t[i] == value then - insert(t,i+1,extra) - return - end - end - insert(t,#t+1,extra) +-- slower than #t on indexed tables (#t only returns the size of the numerically indexed slice) + +function table.is_empty(t) + return not t or not next(t) end +function table.has_one_entry(t) + return t and not next(t,next(t)) +end diff --git a/Master/texmf-dist/tex/context/base/l-unicode.lua b/Master/texmf-dist/tex/context/base/l-unicode.lua index 0c5a60142ae..2fa50282fe0 100644 --- a/Master/texmf-dist/tex/context/base/l-unicode.lua +++ b/Master/texmf-dist/tex/context/base/l-unicode.lua @@ -16,23 +16,47 @@ if not unicode then if n < 0x80 then return char(n) elseif n < 0x800 then - return char(0xC0 + floor(n/0x40)) .. char(0x80 + (n % 0x40)) + return char( + 0xC0 + floor(n/0x40), + 0x80 + (n % 0x40) + ) elseif n < 0x10000 then - return char(0xE0 + floor(n/0x1000)) .. char(0x80 + (floor(n/0x40) % 0x40)) .. char(0x80 + (n % 0x40)) + return char( + 0xE0 + floor(n/0x1000), + 0x80 + (floor(n/0x40) % 0x40), + 0x80 + (n % 0x40) + ) elseif n < 0x40000 then - return char(0xF0 + floor(n/0x40000)) .. char(0x80 + floor(n/0x1000)) .. char(0x80 + (floor(n/0x40) % 0x40)) .. char(0x80 + (n % 0x40)) - else -- wrong: - -- return char(0xF1 + floor(n/0x1000000)) .. char(0x80 + floor(n/0x40000)) .. char(0x80 + floor(n/0x1000)) .. char(0x80 + (floor(n/0x40) % 0x40)) .. char(0x80 + (n % 0x40)) + return char( + 0xF0 + floor(n/0x40000), + 0x80 + floor(n/0x1000), + 0x80 + (floor(n/0x40) % 0x40), + 0x80 + (n % 0x40) + ) + else + -- return char( + -- 0xF1 + floor(n/0x1000000), + -- 0x80 + floor(n/0x40000), + -- 0x80 + floor(n/0x1000), + -- 0x80 + (floor(n/0x40) % 0x40), + -- 0x80 + (n % 0x40) + -- ) return "?" end end end +local unicode = unicode + utf = utf or unicode.utf8 -local concat, utfchar, utfgsub = table.concat, utf.char, utf.gsub -local char, byte, find, bytepairs = string.char, string.byte, string.find, string.bytepairs +local concat = table.concat +local utfchar, utfbyte, utfgsub = utf.char, utf.byte, utf.gsub +local char, byte, find, bytepairs, utfvalues, format = string.char, string.byte, string.find, string.bytepairs, string.utfvalues, string.format +local type = type + +local utfsplitlines = string.utfsplitlines -- 0 EF BB BF UTF-8 -- 1 FF FE UTF-16-little-endian @@ -78,98 +102,236 @@ function unicode.utftype(f) end end -function unicode.utf16_to_utf8(str, endian) -- maybe a gsub is faster or an lpeg - local result, tmp, n, m, p = { }, { }, 0, 0, 0 - -- lf | cr | crlf / (cr:13, lf:10) - local function doit() - if n == 10 then - if p ~= 13 then - result[#result+1] = concat(tmp) - tmp = { } - p = 0 +--~ function unicode.utf16_to_utf8(str, endian) -- maybe a gsub is faster or an lpeg +--~ local result, tmp, n, m, p, r, t = { }, { }, 0, 0, 0, 0, 0 -- we reuse tmp +--~ -- lf | cr | crlf / (cr:13, lf:10) +--~ local function doit() -- inline this +--~ if n == 10 then +--~ if p ~= 13 then +--~ if t > 0 then +--~ r = r + 1 +--~ result[r] = concat(tmp,"",1,t) +--~ t = 0 +--~ end +--~ p = 0 +--~ end +--~ elseif n == 13 then +--~ if t > 0 then +--~ r = r + 1 +--~ result[r] = concat(tmp,"",1,t) +--~ t = 0 +--~ end +--~ p = n +--~ else +--~ t = t + 1 +--~ tmp[t] = utfchar(n) +--~ p = 0 +--~ end +--~ end +--~ for l,r in bytepairs(str) do +--~ if r then +--~ if endian then -- maybe make two loops +--~ n = 256*l + r +--~ else +--~ n = 256*r + l +--~ end +--~ if m > 0 then +--~ n = (m-0xD800)*0x400 + (n-0xDC00) + 0x10000 +--~ m = 0 +--~ doit() +--~ elseif n >= 0xD800 and n <= 0xDBFF then +--~ m = n +--~ else +--~ doit() +--~ end +--~ end +--~ end +--~ if t > 0 then +--~ r = r + 1 +--~ result[r] = concat(tmp,"",1,t) -- we reused tmp, hence t +--~ end +--~ return result +--~ end + +--~ function unicode.utf32_to_utf8(str, endian) +--~ local result, tmp, n, m, p, r, t = { }, { }, 0, -1, 0, 0, 0 +--~ -- lf | cr | crlf / (cr:13, lf:10) +--~ local function doit() -- inline this +--~ if n == 10 then +--~ if p ~= 13 then +--~ if t > 0 then +--~ r = r + 1 +--~ result[r] = concat(tmp,"",1,t) +--~ t = 0 +--~ end +--~ p = 0 +--~ end +--~ elseif n == 13 then +--~ if t > 0 then +--~ r = r + 1 +--~ result[r] = concat(tmp,"",1,t) +--~ t = 0 +--~ end +--~ p = n +--~ else +--~ t = t + 1 +--~ tmp[t] = utfchar(n) +--~ p = 0 +--~ end +--~ end +--~ for a,b in bytepairs(str) do +--~ if a and b then +--~ if m < 0 then +--~ if endian then -- maybe make two loops +--~ m = 256*256*256*a + 256*256*b +--~ else +--~ m = 256*b + a +--~ end +--~ else +--~ if endian then -- maybe make two loops +--~ n = m + 256*a + b +--~ else +--~ n = m + 256*256*256*b + 256*256*a +--~ end +--~ m = -1 +--~ doit() +--~ end +--~ else +--~ break +--~ end +--~ end +--~ if #tmp > 0 then +--~ r = r + 1 +--~ result[r] = concat(tmp,"",1,t) -- we reused tmp, hence t +--~ end +--~ return result +--~ end + +local function utf16_to_utf8_be(t) + if type(t) == "string" then + t = utfsplitlines(str) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, 0 + for left, right in bytepairs(t[i]) do + if right then + local now = 256*left + right + if more > 0 then + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 + more = 0 + r = r + 1 + result[r] = utfchar(now) + elseif now >= 0xD800 and now <= 0xDBFF then + more = now + else + r = r + 1 + result[r] = utfchar(now) + end end - elseif n == 13 then - result[#result+1] = concat(tmp) - tmp = { } - p = n - else - tmp[#tmp+1] = utfchar(n) - p = 0 end + t[i] = concat(result,"",1,r) -- we reused tmp, hence t end - for l,r in bytepairs(str) do - if r then - if endian then - n = l*256 + r - else - n = r*256 + l + return t +end + +local function utf16_to_utf8_le(t) + if type(t) == "string" then + t = utfsplitlines(str) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, 0 + for left, right in bytepairs(t[i]) do + if right then + local now = 256*right + left + if more > 0 then + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 + more = 0 + r = r + 1 + result[r] = utfchar(now) + elseif now >= 0xD800 and now <= 0xDBFF then + more = now + else + r = r + 1 + result[r] = utfchar(now) + end end - if m > 0 then - n = (m-0xD800)*0x400 + (n-0xDC00) + 0x10000 - m = 0 - doit() - elseif n >= 0xD800 and n <= 0xDBFF then - m = n + end + t[i] = concat(result,"",1,r) -- we reused tmp, hence t + end + return t +end + +local function utf32_to_utf8_be(str) + if type(t) == "string" then + t = utfsplitlines(str) + end + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, -1 + for a,b in bytepairs(str) do + if a and b then + if more < 0 then + more = 256*256*256*a + 256*256*b + else + r = r + 1 + result[t] = utfchar(more + 256*a + b) + more = -1 + end else - doit() + break end end - end - if #tmp > 0 then - result[#result+1] = concat(tmp) + t[i] = concat(result,"",1,r) end return result end -function unicode.utf32_to_utf8(str, endian) - local result = { } - local tmp, n, m, p = { }, 0, -1, 0 - -- lf | cr | crlf / (cr:13, lf:10) - local function doit() - if n == 10 then - if p ~= 13 then - result[#result+1] = concat(tmp) - tmp = { } - p = 0 - end - elseif n == 13 then - result[#result+1] = concat(tmp) - tmp = { } - p = n - else - tmp[#tmp+1] = utfchar(n) - p = 0 - end +local function utf32_to_utf8_le(str) + if type(t) == "string" then + t = utfsplitlines(str) end - for a,b in bytepairs(str) do - if a and b then - if m < 0 then - if endian then - m = a*256*256*256 + b*256*256 + local result = { } -- we reuse result + for i=1,#t do + local r, more = 0, -1 + for a,b in bytepairs(str) do + if a and b then + if more < 0 then + more = 256*b + a else - m = b*256 + a + r = r + 1 + result[t] = utfchar(more + 256*256*256*b + 256*256*a) + more = -1 end else - if endian then - n = m + a*256 + b - else - n = m + b*256*256*256 + a*256*256 - end - m = -1 - doit() + break end - else - break end - end - if #tmp > 0 then - result[#result+1] = concat(tmp) + t[i] = concat(result,"",1,r) end return result end +unicode.utf32_to_utf8_be = utf32_to_utf8_be +unicode.utf32_to_utf8_le = utf32_to_utf8_le +unicode.utf16_to_utf8_be = utf16_to_utf8_be +unicode.utf16_to_utf8_le = utf16_to_utf8_le + +function unicode.utf8_to_utf8(t) + return type(t) == "string" and utfsplitlines(t) or t +end + +function unicode.utf16_to_utf8(t,endian) + return endian and utf16_to_utf8_be(t) or utf16_to_utf8_le(t) or t +end + +function unicode.utf32_to_utf8(t,endian) + return endian and utf32_to_utf8_be(t) or utf32_to_utf8_le(t) or t +end + local function little(c) - local b = byte(c) -- b = c:byte() + local b = byte(c) if b < 0x10000 then return char(b%256,b/256) else @@ -197,3 +359,52 @@ function unicode.utf8_to_utf16(str,littleendian) return char(254,255) .. utfgsub(str,".",big) end end + +function unicode.utfcodes(str) + local t, n = { }, 0 + for u in utfvalues(str) do + n = n + 1 + t[n] = format("0x%04X",u) + end + return concat(t,separator or " ") +end + +function unicode.ustring(s) + return format("U+%05X",type(s) == "number" and s or utfbyte(s)) +end + +function unicode.xstring(s) + return format("0x%05X",type(s) == "number" and s or utfbyte(s)) +end + +--~ print(unicode.utfcodes(str)) + +local lpegmatch = lpeg.match +local utftype = lpeg.patterns.utftype + +function unicode.filetype(data) + return data and lpegmatch(utftype,data) or "unknown" +end + +--~ local utfchr = { } -- 60K -> 2.638 M extra mem but currently not called that often (on latin) +--~ +--~ setmetatable(utfchr, { __index = function(t,k) local v = utfchar(k) t[k] = v return v end } ) +--~ +--~ collectgarbage("collect") +--~ local u = collectgarbage("count")*1024 +--~ local t = os.clock() +--~ for i=1,1000 do +--~ for i=1,600 do +--~ local a = utfchr[i] +--~ end +--~ end +--~ print(os.clock()-t,collectgarbage("count")*1024-u) + +--~ collectgarbage("collect") +--~ local t = os.clock() +--~ for i=1,1000 do +--~ for i=1,600 do +--~ local a = utfchar(i) +--~ end +--~ end +--~ print(os.clock()-t,collectgarbage("count")*1024-u) diff --git a/Master/texmf-dist/tex/context/base/l-url.lua b/Master/texmf-dist/tex/context/base/l-url.lua index e3e6f81302c..d75135a2abe 100644 --- a/Master/texmf-dist/tex/context/base/l-url.lua +++ b/Master/texmf-dist/tex/context/base/l-url.lua @@ -6,86 +6,179 @@ if not modules then modules = { } end modules ['l-url'] = { license = "see context related readme files" } -local char, gmatch, gsub = string.char, string.gmatch, string.gsub +local char, gmatch, gsub, format, byte, find = string.char, string.gmatch, string.gsub, string.format, string.byte, string.find +local concat = table.concat local tonumber, type = tonumber, type -local lpegmatch = lpeg.match +local P, C, R, S, Cs, Cc, Ct = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cs, lpeg.Cc, lpeg.Ct +local lpegmatch, lpegpatterns, replacer = lpeg.match, lpeg.patterns, lpeg.replacer --- from the spec (on the web): +-- from wikipedia: -- --- foo://example.com:8042/over/there?name=ferret#nose --- \_/ \______________/\_________/ \_________/ \__/ --- | | | | | --- scheme authority path query fragment --- | _____________________|__ --- / \ / \ --- urn:example:animal:ferret:nose - -url = url or { } - -local function tochar(s) - return char(tonumber(s,16)) -end +-- foo://username:password@example.com:8042/over/there/index.dtb?type=animal;name=narwhal#nose +-- \_/ \_______________/ \_________/ \__/ \___/ \_/ \______________________/ \__/ +-- | | | | | | | | +-- | userinfo hostname port | | query fragment +-- | \________________________________/\_____________|____|/ +-- scheme | | | | +-- | authority path | | +-- | | | +-- | path interpretable as filename +-- | ___________|____________ | +-- / \ / \ | +-- urn:example:animal:ferret:nose interpretable as extension + +url = url or { } +local url = url + +local tochar = function(s) return char(tonumber(s,16)) end + +local colon = P(":") +local qmark = P("?") +local hash = P("#") +local slash = P("/") +local percent = P("%") +local endofstring = P(-1) + +local hexdigit = R("09","AF","af") +local plus = P("+") +local nothing = Cc("") +local escaped = (plus / " ") + (percent * C(hexdigit * hexdigit) / tochar) + +-- we assume schemes with more than 1 character (in order to avoid problems with windows disks) -local colon, qmark, hash, slash, percent, endofstring = lpeg.P(":"), lpeg.P("?"), lpeg.P("#"), lpeg.P("/"), lpeg.P("%"), lpeg.P(-1) +local scheme = Cs((escaped+(1-colon-slash-qmark-hash))^2) * colon + nothing +local authority = slash * slash * Cs((escaped+(1- slash-qmark-hash))^0) + nothing +local path = slash * Cs((escaped+(1- qmark-hash))^0) + nothing +local query = qmark * Cs((escaped+(1- hash))^0) + nothing +local fragment = hash * Cs((escaped+(1- endofstring))^0) + nothing -local hexdigit = lpeg.R("09","AF","af") -local plus = lpeg.P("+") -local escaped = (plus / " ") + (percent * lpeg.C(hexdigit * hexdigit) / tochar) +local validurl = scheme * authority * path * query * fragment +local parser = Ct(validurl) --- we assume schemes with more than 1 character (in order to avoid problems with windows disks) +lpegpatterns.url = validurl +lpegpatterns.urlsplitter = parser -local scheme = lpeg.Cs((escaped+(1-colon-slash-qmark-hash))^2) * colon + lpeg.Cc("") -local authority = slash * slash * lpeg.Cs((escaped+(1- slash-qmark-hash))^0) + lpeg.Cc("") -local path = slash * lpeg.Cs((escaped+(1- qmark-hash))^0) + lpeg.Cc("") -local query = qmark * lpeg.Cs((escaped+(1- hash))^0) + lpeg.Cc("") -local fragment = hash * lpeg.Cs((escaped+(1- endofstring))^0) + lpeg.Cc("") +local escapes = { } ; for i=0,255 do escapes[i] = format("%%%02X",i) end -local parser = lpeg.Ct(scheme * authority * path * query * fragment) +local escaper = Cs((R("09","AZ","az") + S("-./_") + P(1) / escapes)^0) + +lpegpatterns.urlescaper = escaper -- todo: reconsider Ct as we can as well have five return values (saves a table) -- so we can have two parsers, one with and one without -function url.split(str) +local function split(str) return (type(str) == "string" and lpegmatch(parser,str)) or str end +local function hasscheme(str) + local scheme = lpegmatch(scheme,str) -- at least one character + return scheme and scheme ~= "" +end + -- todo: cache them -function url.hashed(str) - local s = url.split(str) +local rootletter = R("az","AZ") + + S("_-+") +local separator = P("://") +local qualified = P(".")^0 * P("/") + + rootletter * P(":") + + rootletter^1 * separator + + rootletter^1 * P("/") +local rootbased = P("/") + + rootletter * P(":") + +local barswapper = replacer("|",":") +local backslashswapper = replacer("\\","/") + +local function hashed(str) -- not yet ok (/test?test) + local s = split(str) local somescheme = s[1] ~= "" - return { - scheme = (somescheme and s[1]) or "file", - authority = s[2], - path = s[3], - query = s[4], - fragment = s[5], - original = str, - noscheme = not somescheme, - } + local somequery = s[4] ~= "" + if not somescheme and not somequery then + s = { + scheme = "file", + authority = "", + path = str, + query = "", + fragment = "", + original = str, + noscheme = true, + filename = str, + } + else -- not always a filename but handy anyway + local authority, path, filename = s[2], s[3] + if authority == "" then + filename = path + else + filename = authority .. "/" .. path + end + s = { + scheme = s[1], + authority = authority, + path = path, + query = s[4], + fragment = s[5], + original = str, + noscheme = false, + filename = filename, + } + end + return s end -function url.hasscheme(str) - return url.split(str)[1] ~= "" -end +-- Here we assume: +-- +-- files: /// = relative +-- files: //// = absolute (!) + +--~ table.print(hashed("file://c:/opt/tex/texmf-local")) -- c:/opt/tex/texmf-local +--~ table.print(hashed("file://opt/tex/texmf-local" )) -- opt/tex/texmf-local +--~ table.print(hashed("file:///opt/tex/texmf-local" )) -- opt/tex/texmf-local +--~ table.print(hashed("file:////opt/tex/texmf-local" )) -- /opt/tex/texmf-local +--~ table.print(hashed("file:///./opt/tex/texmf-local" )) -- ./opt/tex/texmf-local + +--~ table.print(hashed("c:/opt/tex/texmf-local" )) -- c:/opt/tex/texmf-local +--~ table.print(hashed("opt/tex/texmf-local" )) -- opt/tex/texmf-local +--~ table.print(hashed("/opt/tex/texmf-local" )) -- /opt/tex/texmf-local + +url.split = split +url.hasscheme = hasscheme +url.hashed = hashed -function url.addscheme(str,scheme) - return (url.hasscheme(str) and str) or ((scheme or "file:///") .. str) +function url.addscheme(str,scheme) -- no authority + if hasscheme(str) then + return str + elseif not scheme then + return "file:///" .. str + else + return scheme .. ":///" .. str + end end -function url.construct(hash) - local fullurl = hash.sheme .. "://".. hash.authority .. hash.path - if hash.query then - fullurl = fullurl .. "?".. hash.query +function url.construct(hash) -- dodo: we need to escape ! + local fullurl, f = { }, 0 + local scheme, authority, path, query, fragment = hash.scheme, hash.authority, hash.path, hash.query, hash.fragment + if scheme and scheme ~= "" then + f = f + 1 ; fullurl[f] = scheme .. "://" + end + if authority and authority ~= "" then + f = f + 1 ; fullurl[f] = authority end - if hash.fragment then - fullurl = fullurl .. "?".. hash.fragment + if path and path ~= "" then + f = f + 1 ; fullurl[f] = "/" .. path end - return fullurl + if query and query ~= "" then + f = f + 1 ; fullurl[f] = "?".. query + end + if fragment and fragment ~= "" then + f = f + 1 ; fullurl[f] = "#".. fragment + end + return lpegmatch(escaper,concat(fullurl)) end function url.filename(filename) - local t = url.hashed(filename) + local t = hashed(filename) return (t.scheme == "file" and (gsub(t.path,"^/([a-zA-Z])([:|])/)","%1:"))) or filename end @@ -108,12 +201,27 @@ end --~ print(url.filename("/oeps.txt")) --~ from the spec on the web (sort of): ---~ ---~ function test(str) ---~ print(table.serialize(url.hashed(str))) + +--~ local function test(str) +--~ local t = url.hashed(str) +--~ t.constructed = url.construct(t) +--~ print(table.serialize(t)) --~ end ---~ ---~ test("%56pass%20words") + +--~ test("sys:///./colo-rgb") + +--~ test("/data/site/output/q2p-develop/resources/ecaboperception4_res/topicresources/58313733/figuur-cow.jpg") +--~ test("file:///M:/q2p/develop/output/q2p-develop/resources/ecaboperception4_res/topicresources/58313733") +--~ test("M:/q2p/develop/output/q2p-develop/resources/ecaboperception4_res/topicresources/58313733") +--~ test("file:///q2p/develop/output/q2p-develop/resources/ecaboperception4_res/topicresources/58313733") +--~ test("/q2p/develop/output/q2p-develop/resources/ecaboperception4_res/topicresources/58313733") + +--~ test("file:///cow%20with%20spaces") +--~ test("file:///cow%20with%20spaces.pdf") +--~ test("cow%20with%20spaces.pdf") +--~ test("some%20file") +--~ test("/etc/passwords") +--~ test("http://www.myself.com/some%20words.html") --~ test("file:///c:/oeps.txt") --~ test("file:///c|/oeps.txt") --~ test("file:///etc/oeps.txt") @@ -127,8 +235,9 @@ end --~ test("tel:+1-816-555-1212") --~ test("telnet://192.0.2.16:80/") --~ test("urn:oasis:names:specification:docbook:dtd:xml:4.1.2") ---~ test("/etc/passwords") --~ test("http://www.pragma-ade.com/spaced%20name") --~ test("zip:///oeps/oeps.zip#bla/bla.tex") --~ test("zip:///oeps/oeps.zip?bla/bla.tex") + +--~ table.print(url.hashed("/test?test")) diff --git a/Master/texmf-dist/tex/context/base/l-utils.lua b/Master/texmf-dist/tex/context/base/l-utils.lua index ebc27b8cfcd..30df04694c5 100644 --- a/Master/texmf-dist/tex/context/base/l-utils.lua +++ b/Master/texmf-dist/tex/context/base/l-utils.lua @@ -1,176 +1,12 @@ if not modules then modules = { } end modules ['l-utils'] = { version = 1.001, - comment = "companion to luat-lib.mkiv", + comment = "this module is replaced by the util-* ones", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } --- hm, quite unreadable - -local gsub = string.gsub -local concat = table.concat -local type, next = type, next - -if not utils then utils = { } end -if not utils.merger then utils.merger = { } end -if not utils.lua then utils.lua = { } end - -utils.merger.m_begin = "begin library merge" -utils.merger.m_end = "end library merge" -utils.merger.pattern = - "%c+" .. - "%-%-%s+" .. utils.merger.m_begin .. - "%c+(.-)%c+" .. - "%-%-%s+" .. utils.merger.m_end .. - "%c+" - -function utils.merger._self_fake_() - return - "-- " .. "created merged file" .. "\n\n" .. - "-- " .. utils.merger.m_begin .. "\n\n" .. - "-- " .. utils.merger.m_end .. "\n\n" -end - -function utils.report(...) - print(...) -end - -utils.merger.strip_comment = true - -function utils.merger._self_load_(name) - local f, data = io.open(name), "" - if f then - utils.report("reading merge from %s",name) - data = f:read("*all") - f:close() - else - utils.report("unknown file to merge %s",name) - end - if data and utils.merger.strip_comment then - -- saves some 20K - data = gsub(data,"%-%-~[^\n\r]*[\r\n]", "") - end - return data or "" -end - -function utils.merger._self_save_(name, data) - if data ~= "" then - local f = io.open(name,'w') - if f then - utils.report("saving merge from %s",name) - f:write(data) - f:close() - end - end -end - -function utils.merger._self_swap_(data,code) - if data ~= "" then - return (gsub(data,utils.merger.pattern, function(s) - return "\n\n" .. "-- "..utils.merger.m_begin .. "\n" .. code .. "\n" .. "-- "..utils.merger.m_end .. "\n\n" - end, 1)) - else - return "" - end -end - ---~ stripper: ---~ ---~ data = gsub(data,"%-%-~[^\n]*\n","") ---~ data = gsub(data,"\n\n+","\n") - -function utils.merger._self_libs_(libs,list) - local result, f, frozen = { }, nil, false - result[#result+1] = "\n" - if type(libs) == 'string' then libs = { libs } end - if type(list) == 'string' then list = { list } end - local foundpath = nil - for i=1,#libs do - local lib = libs[i] - for j=1,#list do - local pth = gsub(list[j],"\\","/") -- file.clean_path - utils.report("checking library path %s",pth) - local name = pth .. "/" .. lib - if lfs.isfile(name) then - foundpath = pth - end - end - if foundpath then break end - end - if foundpath then - utils.report("using library path %s",foundpath) - local right, wrong = { }, { } - for i=1,#libs do - local lib = libs[i] - local fullname = foundpath .. "/" .. lib - if lfs.isfile(fullname) then - -- right[#right+1] = lib - utils.report("merging library %s",fullname) - result[#result+1] = "do -- create closure to overcome 200 locals limit" - result[#result+1] = io.loaddata(fullname,true) - result[#result+1] = "end -- of closure" - else - -- wrong[#wrong+1] = lib - utils.report("no library %s",fullname) - end - end - if #right > 0 then - utils.report("merged libraries: %s",concat(right," ")) - end - if #wrong > 0 then - utils.report("skipped libraries: %s",concat(wrong," ")) - end - else - utils.report("no valid library path found") - end - return concat(result, "\n\n") -end - -function utils.merger.selfcreate(libs,list,target) - if target then - utils.merger._self_save_( - target, - utils.merger._self_swap_( - utils.merger._self_fake_(), - utils.merger._self_libs_(libs,list) - ) - ) - end -end - -function utils.merger.selfmerge(name,libs,list,target) - utils.merger._self_save_( - target or name, - utils.merger._self_swap_( - utils.merger._self_load_(name), - utils.merger._self_libs_(libs,list) - ) - ) -end - -function utils.merger.selfclean(name) - utils.merger._self_save_( - name, - utils.merger._self_swap_( - utils.merger._self_load_(name), - "" - ) - ) -end - -function utils.lua.compile(luafile, lucfile, cleanup, strip) -- defaults: cleanup=false strip=true - -- utils.report("compiling",luafile,"into",lucfile) - os.remove(lucfile) - local command = "-o " .. string.quote(lucfile) .. " " .. string.quote(luafile) - if strip ~= false then - command = "-s " .. command - end - local done = (os.spawn("texluac " .. command) == 0) or (os.spawn("luac " .. command) == 0) - if done and cleanup == true and lfs.isfile(lucfile) and lfs.isfile(luafile) then - -- utils.report("removing",luafile) - os.remove(luafile) - end - return done -end +utils = utils or { } +require("util-mrg") for k, v in next, utilities.merger do utils[k] = v end +require("util-lua") for k, v in next, utilities.lua do utils[k] = v end diff --git a/Master/texmf-dist/tex/context/base/lang-alt.mkii b/Master/texmf-dist/tex/context/base/lang-alt.mkii new file mode 100644 index 00000000000..f65acbda3ba --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lang-alt.mkii @@ -0,0 +1,152 @@ +%D \module +%D [ file=lang-alt, +%D version=1997.09.03, +%D title=\CONTEXT\ Language Macros, +%D subtitle=Altaic 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. + +\writestatus{loading}{ConTeXt Language Macros / Altaic Languages} + +%D The framework of this module is set up by Hans Hagen while +%D many of the first translations were done by Tobias. Later +%D on, corrections were made by users. If you have suggestions, +%D or feel that your name missing here, don't hesitate to send +%D us an email. + +% Uigur, Uzbek +% Azeri/Azerbaijani, Chuvash, Turkish, Turkmen +% Kazakh, Kazar, Kireghiz, Noghay, Talar +% Buryat, Kalmuck, Khalkha +% +% Turkmen translation by Nazar Annagurban 18. March 2010 + +\unprotect + +\installlanguage + [\s!tr] + [\c!spacing=\v!packed, + \c!leftsentence=---, + \c!rightsentence=---, + \c!leftsubsentence=---, + \c!rightsubsentence=---, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!year,\ ,\v!month,\ ,\v!day}] + +\installlanguage + [\s!tk] + [\c!spacing=\v!broad, + \c!leftsentence=---, + \c!rightsentence=---, + \c!leftsubsentence=---, + \c!rightsubsentence=---, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!year,\ ,\v!month,\ ,\v!day} + \s!patterns=\s!tk, + \s!lefthyphenmin=1, + \s!righthyphenmin=2] + +\installlanguage [turkish] [\s!tr] +\installlanguage [turkmen] [\s!tk] + +\setupheadtext [\s!tr] [\v!content=Fihrist] +\setupheadtext [\s!tk] [\v!content=Mazmuny] +\setupheadtext [\s!tr] [\v!tables=Tablolar] +\setupheadtext [\s!tk] [\v!tables=Tablisalar] +\setupheadtext [\s!tr] [\v!figures=\Scedilla ekiller] +\setupheadtext [\s!tk] [\v!figures=Suratlar] +\setupheadtext [\s!tr] [\v!graphics=Grafikler] +\setupheadtext [\s!tk] [\v!graphics=Grafikler] +\setupheadtext [\s!tr] [\v!intermezzi=...] +\setupheadtext [\s!tk] [\v!intermezzi=Arakesmeler] +\setupheadtext [\s!tr] [\v!index=\Idotaccent ndex] +\setupheadtext [\s!tk] [\v!index=Indeks] +\setupheadtext [\s!tr] [\v!abbreviations=K\dotlessi saltmalar] +\setupheadtext [\s!tk] [\v!abbreviations=Gysgaltmalar] +\setupheadtext [\s!tr] [\v!logos=Logolar] +\setupheadtext [\s!tk] [\v!logos=Logolar] +\setupheadtext [\s!tr] [\v!units=Birimler] +\setupheadtext [\s!tk] [\v!units=Birlikler] + +\setuplabeltext [\s!tr] [\v!table=Tablo ] +\setuplabeltext [\s!tk] [\v!table=Tablisa] +\setuplabeltext [\s!tr] [\v!figure=\Scedilla ekil ] +\setuplabeltext [\s!tk] [\v!figure=Surat] +\setuplabeltext [\s!tr] [\v!intermezzo=... ] +\setuplabeltext [\s!tk] [\v!intermezzo=Arakesme] +\setuplabeltext [\s!tr] [\v!graphic=Grafik] +\setuplabeltext [\s!tk] [\v!graphic=Grafik] +\setuplabeltext [\s!tr] [\v!chapter=] +\setuplabeltext [\s!tk] [\v!chapter=Bap] +\setuplabeltext [\s!tr] [\v!section=] +\setuplabeltext [\s!tk] [\v!section=] +\setuplabeltext [\s!tr] [\v!subsection=] +\setuplabeltext [\s!tk] [\v!subsection=] +\setuplabeltext [\s!tr] [\v!subsubsection=] +\setuplabeltext [\s!tr] [\v!subsubsubsection=] +\setuplabeltext [\s!tk] [\v!subsubsubsection=] +\setuplabeltext [\s!tr] [\v!appendix=] +\setuplabeltext [\s!tk] [\v!appendix=Go\scedilla ma\ccedilla a] +\setuplabeltext [\s!tr] [\v!part=Cilt ] +\setuplabeltext [\s!tk] [\v!part=B\odiaeresis l\udiaeresis m] +\setuplabeltext [\s!tr] [\v!line=sat\dotlessi r ] +\setuplabeltext [\s!tk] [\v!line=setir] +\setuplabeltext [\s!tr] [\v!lines=sat\dotlessi rlar ] +\setuplabeltext [\s!tk] [\v!lines=setirler] + +\setuplabeltext [\s!tk] [\v!january=\yacute anwar] +\setuplabeltext [\s!tk] [\v!february=fewral] +\setuplabeltext [\s!tk] [\v!march=mart] +\setuplabeltext [\s!tk] [\v!april=aprel] +\setuplabeltext [\s!tk] [\v!may=ma\yacute] +\setuplabeltext [\s!tk] [\v!june=i\yacute un] +\setuplabeltext [\s!tk] [\v!july=i\yacute ul] +\setuplabeltext [\s!tk] [\v!august=awgust] +\setuplabeltext [\s!tk] [\v!september=sent\yacute abr] +\setuplabeltext [\s!tk] [\v!october=okt\yacute abr] +\setuplabeltext [\s!tk] [\v!november=no\yacute abr] +\setuplabeltext [\s!tk] [\v!december=dekabr] + +\setuplabeltext [\s!tr] [\v!january=ocak] +\setuplabeltext [\s!tr] [\v!february=\Scedilla ubat] +\setuplabeltext [\s!tr] [\v!march=mart] +\setuplabeltext [\s!tr] [\v!april=nisan] +\setuplabeltext [\s!tr] [\v!may=may\dotlessi s] +\setuplabeltext [\s!tr] [\v!june=haziran] +\setuplabeltext [\s!tr] [\v!july=temmuz] +\setuplabeltext [\s!tr] [\v!august=a\gbreve ustos] +\setuplabeltext [\s!tr] [\v!september=eyl\udiaeresis l] +\setuplabeltext [\s!tr] [\v!october=ekim] +\setuplabeltext [\s!tr] [\v!november=kas\dotlessi m] +\setuplabeltext [\s!tr] [\v!december=aral\dotlessi k] + +\setuplabeltext [\s!tr] [\v!sunday=pazar] +\setuplabeltext [\s!tr] [\v!monday=pazartesi] +\setuplabeltext [\s!tr] [\v!tuesday=sal\dotlessi] +\setuplabeltext [\s!tr] [\v!wednesday=\ccedilla ar\scedilla amba] +\setuplabeltext [\s!tr] [\v!thursday=per\scedilla embe] +\setuplabeltext [\s!tr] [\v!friday=cuma] +\setuplabeltext [\s!tr] [\v!saturday=cumartesi] + +\setuplabeltext [\s!tk] [\v!sunday=dyn\ccedilla\ g\udiaeresis n] +\setuplabeltext [\s!tk] [\v!monday=birinji g\udiaeresis n] +\setuplabeltext [\s!tk] [\v!tuesday=ikinji g\udiaeresis n] +\setuplabeltext [\s!tk] [\v!wednesday=\udiaeresis\ccedilla\udiaeresis nji] +\setuplabeltext [\s!tk] [\v!thursday=d\odiaeresis rd\udiaeresis nji g\udiaeresis n] +\setuplabeltext [\s!tk] [\v!friday=b\adiaeresis\scedilla inji g\udiaeresis n] +\setuplabeltext [\s!tk] [\v!saturday=altynjy g\udiaeresis n] + +%D \ShowAllLanguageValues [\s!tr] [turkish] {Turkish} {delight} % turks fruit + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-alt.tex b/Master/texmf-dist/tex/context/base/lang-alt.tex deleted file mode 100644 index f65acbda3ba..00000000000 --- a/Master/texmf-dist/tex/context/base/lang-alt.tex +++ /dev/null @@ -1,152 +0,0 @@ -%D \module -%D [ file=lang-alt, -%D version=1997.09.03, -%D title=\CONTEXT\ Language Macros, -%D subtitle=Altaic 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. - -\writestatus{loading}{ConTeXt Language Macros / Altaic Languages} - -%D The framework of this module is set up by Hans Hagen while -%D many of the first translations were done by Tobias. Later -%D on, corrections were made by users. If you have suggestions, -%D or feel that your name missing here, don't hesitate to send -%D us an email. - -% Uigur, Uzbek -% Azeri/Azerbaijani, Chuvash, Turkish, Turkmen -% Kazakh, Kazar, Kireghiz, Noghay, Talar -% Buryat, Kalmuck, Khalkha -% -% Turkmen translation by Nazar Annagurban 18. March 2010 - -\unprotect - -\installlanguage - [\s!tr] - [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, - \c!leftquote=\upperleftsinglesixquote, - \c!rightquote=\upperrightsingleninequote, - \c!leftquotation=\upperleftdoublesixquote, - \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!year,\ ,\v!month,\ ,\v!day}] - -\installlanguage - [\s!tk] - [\c!spacing=\v!broad, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, - \c!leftquote=\upperleftsinglesixquote, - \c!rightquote=\upperrightsingleninequote, - \c!leftquotation=\upperleftdoublesixquote, - \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!year,\ ,\v!month,\ ,\v!day} - \s!patterns=\s!tk, - \s!lefthyphenmin=1, - \s!righthyphenmin=2] - -\installlanguage [turkish] [\s!tr] -\installlanguage [turkmen] [\s!tk] - -\setupheadtext [\s!tr] [\v!content=Fihrist] -\setupheadtext [\s!tk] [\v!content=Mazmuny] -\setupheadtext [\s!tr] [\v!tables=Tablolar] -\setupheadtext [\s!tk] [\v!tables=Tablisalar] -\setupheadtext [\s!tr] [\v!figures=\Scedilla ekiller] -\setupheadtext [\s!tk] [\v!figures=Suratlar] -\setupheadtext [\s!tr] [\v!graphics=Grafikler] -\setupheadtext [\s!tk] [\v!graphics=Grafikler] -\setupheadtext [\s!tr] [\v!intermezzi=...] -\setupheadtext [\s!tk] [\v!intermezzi=Arakesmeler] -\setupheadtext [\s!tr] [\v!index=\Idotaccent ndex] -\setupheadtext [\s!tk] [\v!index=Indeks] -\setupheadtext [\s!tr] [\v!abbreviations=K\dotlessi saltmalar] -\setupheadtext [\s!tk] [\v!abbreviations=Gysgaltmalar] -\setupheadtext [\s!tr] [\v!logos=Logolar] -\setupheadtext [\s!tk] [\v!logos=Logolar] -\setupheadtext [\s!tr] [\v!units=Birimler] -\setupheadtext [\s!tk] [\v!units=Birlikler] - -\setuplabeltext [\s!tr] [\v!table=Tablo ] -\setuplabeltext [\s!tk] [\v!table=Tablisa] -\setuplabeltext [\s!tr] [\v!figure=\Scedilla ekil ] -\setuplabeltext [\s!tk] [\v!figure=Surat] -\setuplabeltext [\s!tr] [\v!intermezzo=... ] -\setuplabeltext [\s!tk] [\v!intermezzo=Arakesme] -\setuplabeltext [\s!tr] [\v!graphic=Grafik] -\setuplabeltext [\s!tk] [\v!graphic=Grafik] -\setuplabeltext [\s!tr] [\v!chapter=] -\setuplabeltext [\s!tk] [\v!chapter=Bap] -\setuplabeltext [\s!tr] [\v!section=] -\setuplabeltext [\s!tk] [\v!section=] -\setuplabeltext [\s!tr] [\v!subsection=] -\setuplabeltext [\s!tk] [\v!subsection=] -\setuplabeltext [\s!tr] [\v!subsubsection=] -\setuplabeltext [\s!tr] [\v!subsubsubsection=] -\setuplabeltext [\s!tk] [\v!subsubsubsection=] -\setuplabeltext [\s!tr] [\v!appendix=] -\setuplabeltext [\s!tk] [\v!appendix=Go\scedilla ma\ccedilla a] -\setuplabeltext [\s!tr] [\v!part=Cilt ] -\setuplabeltext [\s!tk] [\v!part=B\odiaeresis l\udiaeresis m] -\setuplabeltext [\s!tr] [\v!line=sat\dotlessi r ] -\setuplabeltext [\s!tk] [\v!line=setir] -\setuplabeltext [\s!tr] [\v!lines=sat\dotlessi rlar ] -\setuplabeltext [\s!tk] [\v!lines=setirler] - -\setuplabeltext [\s!tk] [\v!january=\yacute anwar] -\setuplabeltext [\s!tk] [\v!february=fewral] -\setuplabeltext [\s!tk] [\v!march=mart] -\setuplabeltext [\s!tk] [\v!april=aprel] -\setuplabeltext [\s!tk] [\v!may=ma\yacute] -\setuplabeltext [\s!tk] [\v!june=i\yacute un] -\setuplabeltext [\s!tk] [\v!july=i\yacute ul] -\setuplabeltext [\s!tk] [\v!august=awgust] -\setuplabeltext [\s!tk] [\v!september=sent\yacute abr] -\setuplabeltext [\s!tk] [\v!october=okt\yacute abr] -\setuplabeltext [\s!tk] [\v!november=no\yacute abr] -\setuplabeltext [\s!tk] [\v!december=dekabr] - -\setuplabeltext [\s!tr] [\v!january=ocak] -\setuplabeltext [\s!tr] [\v!february=\Scedilla ubat] -\setuplabeltext [\s!tr] [\v!march=mart] -\setuplabeltext [\s!tr] [\v!april=nisan] -\setuplabeltext [\s!tr] [\v!may=may\dotlessi s] -\setuplabeltext [\s!tr] [\v!june=haziran] -\setuplabeltext [\s!tr] [\v!july=temmuz] -\setuplabeltext [\s!tr] [\v!august=a\gbreve ustos] -\setuplabeltext [\s!tr] [\v!september=eyl\udiaeresis l] -\setuplabeltext [\s!tr] [\v!october=ekim] -\setuplabeltext [\s!tr] [\v!november=kas\dotlessi m] -\setuplabeltext [\s!tr] [\v!december=aral\dotlessi k] - -\setuplabeltext [\s!tr] [\v!sunday=pazar] -\setuplabeltext [\s!tr] [\v!monday=pazartesi] -\setuplabeltext [\s!tr] [\v!tuesday=sal\dotlessi] -\setuplabeltext [\s!tr] [\v!wednesday=\ccedilla ar\scedilla amba] -\setuplabeltext [\s!tr] [\v!thursday=per\scedilla embe] -\setuplabeltext [\s!tr] [\v!friday=cuma] -\setuplabeltext [\s!tr] [\v!saturday=cumartesi] - -\setuplabeltext [\s!tk] [\v!sunday=dyn\ccedilla\ g\udiaeresis n] -\setuplabeltext [\s!tk] [\v!monday=birinji g\udiaeresis n] -\setuplabeltext [\s!tk] [\v!tuesday=ikinji g\udiaeresis n] -\setuplabeltext [\s!tk] [\v!wednesday=\udiaeresis\ccedilla\udiaeresis nji] -\setuplabeltext [\s!tk] [\v!thursday=d\odiaeresis rd\udiaeresis nji g\udiaeresis n] -\setuplabeltext [\s!tk] [\v!friday=b\adiaeresis\scedilla inji g\udiaeresis n] -\setuplabeltext [\s!tk] [\v!saturday=altynjy g\udiaeresis n] - -%D \ShowAllLanguageValues [\s!tr] [turkish] {Turkish} {delight} % turks fruit - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-ana.mkii b/Master/texmf-dist/tex/context/base/lang-ana.mkii new file mode 100644 index 00000000000..c108655c474 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lang-ana.mkii @@ -0,0 +1,24 @@ +%D \module +%D [ file=lang-ana, +%D version=1997.09.03, +%D title=\CONTEXT\ Language Macros, +%D subtitle=Anatolian 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. + +\writestatus{loading}{ConTeXt Language Macros / Anatolian Languages} + +%D The framework of this module is set up by Hans Hagen while +%D many of the first translations were done by Tobias. Later +%D on, corrections were made by users. If you have suggestions, +%D or feel that your name missing here, don't hesitate to send +%D us an email. + +\unprotect + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-ana.tex b/Master/texmf-dist/tex/context/base/lang-ana.tex deleted file mode 100644 index c108655c474..00000000000 --- a/Master/texmf-dist/tex/context/base/lang-ana.tex +++ /dev/null @@ -1,24 +0,0 @@ -%D \module -%D [ file=lang-ana, -%D version=1997.09.03, -%D title=\CONTEXT\ Language Macros, -%D subtitle=Anatolian 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. - -\writestatus{loading}{ConTeXt Language Macros / Anatolian Languages} - -%D The framework of this module is set up by Hans Hagen while -%D many of the first translations were done by Tobias. Later -%D on, corrections were made by users. If you have suggestions, -%D or feel that your name missing here, don't hesitate to send -%D us an email. - -\unprotect - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-ara.mkiv b/Master/texmf-dist/tex/context/base/lang-ara.mkiv deleted file mode 100644 index 3c4d3c52284..00000000000 --- a/Master/texmf-dist/tex/context/base/lang-ara.mkiv +++ /dev/null @@ -1,150 +0,0 @@ -%D \module -%D [ file=lang-ara, -%D version=2008.06.20, -%D title=\CONTEXT\ Language Macros, -%D subtitle=Arabic Languages, -%D author=Khaled Hosny, -%D date=\currentdate, -%D copyright=PRAGMA-ADE] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\writestatus{loading}{ConTeXt Language Macros / Arabic Languages} - -\unprotect - -\definesystemconstant {arabic} -\definesystemvariable {ar} - -\installlanguage - [\s!ar] - [\c!spacing=\v!broad, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, - \c!leftquote=\upperleftsinglesixquote, - \c!rightquote=\upperrightsingleninequote, - \c!leftquotation=\upperleftdoublesixquote, - \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!day,\ ,\v!month,{،\ },\v!year}] - -\installlanguage [\s!arabic] [\s!ar] - -% Just aliases to "ar" for now - -\installlanguage[\s!ar-ae][\c!default=\s!ar] % U.A.E. -\installlanguage[\s!ar-bh][\c!default=\s!ar] % Bahrain -\installlanguage[\s!ar-eg][\c!default=\s!ar] % Egypt -\installlanguage[\s!ar-in][\c!default=\s!ar] % India? -\installlanguage[\s!ar-kw][\c!default=\s!ar] % Kuwait -\installlanguage[\s!ar-ly][\c!default=\s!ar] % Libya -\installlanguage[\s!ar-om][\c!default=\s!ar] % Oman -\installlanguage[\s!ar-qa][\c!default=\s!ar] % Qatar -\installlanguage[\s!ar-sa][\c!default=\s!ar] % Saudi Arabia -\installlanguage[\s!ar-sd][\c!default=\s!ar] % Sudan -\installlanguage[\s!ar-tn][\c!default=\s!ar] % Tunisia -\installlanguage[\s!ar-ye][\c!default=\s!ar] % Yemen - -% Syriac months - -\installlanguage[\s!ar-sy][\c!default=\s!ar] % Syria -\installlanguage[\s!ar-iq][\c!default=\s!ar-sy] % Iraq -\installlanguage[\s!ar-jo][\c!default=\s!ar-sy] % Jordan -\installlanguage[\s!ar-lb][\c!default=\s!ar-sy] % Lebanon - -% Maghribi months - -\installlanguage[\s!ar-dz][\c!default=\s!ar] % Algeria -\installlanguage[\s!ar-ma][\c!default=\s!ar] % Morocco - -\setupheadtext [\s!ar] [\v!content=المحتويات] -\setupheadtext [\s!ar] [\v!tables=الجداول] -\setupheadtext [\s!ar] [\v!figures=الأشكال] -\setupheadtext [\s!ar] [\v!graphics=الرسوم] -\setupheadtext [\s!ar] [\v!intermezzi=فسح] -\setupheadtext [\s!ar] [\v!index=الفهرس] -\setupheadtext [\s!ar] [\v!abbreviations=الاختصارات] -\setupheadtext [\s!ar] [\v!logos=الشعارات] -\setupheadtext [\s!ar] [\v!units=الوحدات] -\setuplabeltext [\s!ar] [\v!table=جدول ] -\setuplabeltext [\s!ar] [\v!figure=شكل ] -\setuplabeltext [\s!ar] [\v!intermezzo=فسحة ] -\setuplabeltext [\s!ar] [\v!graphic=رسم ] - -%D We don't set these here. One can do that in a style. - -\setuplabeltext [\s!ar] [\v!chapter=] % باب -\setuplabeltext [\s!ar] [\v!section=] % فصل or قسم -\setuplabeltext [\s!ar] [\v!subsection=] % فصل أدنى -\setuplabeltext [\s!ar] [\v!subsubsection=] % فصل أ دنى أدنى -\setuplabeltext [\s!ar] [\v!subsubsubsection=] % فصل أدنى أدنى أدنى -\setuplabeltext [\s!ar] [\v!appendix=] % ملحق -\setuplabeltext [\s!ar] [\v!part=جزء ] -\setuplabeltext [\s!ar] [\v!line=سطر ] -\setuplabeltext [\s!ar] [\v!lines=السطور ] - -\setuplabeltext [\s!ar] [\v!january=يناير] -\setuplabeltext [\s!ar] [\v!february=فبراير] -\setuplabeltext [\s!ar] [\v!march=مارس] -\setuplabeltext [\s!ar] [\v!april=أبريل] -\setuplabeltext [\s!ar] [\v!may=مايو] -\setuplabeltext [\s!ar] [\v!june=يونيو] -\setuplabeltext [\s!ar] [\v!july=يوليو] -\setuplabeltext [\s!ar] [\v!august=أغسطس] -\setuplabeltext [\s!ar] [\v!september=سبتمبر] -\setuplabeltext [\s!ar] [\v!october=أكتوبر] -\setuplabeltext [\s!ar] [\v!november=نوفمبر] -\setuplabeltext [\s!ar] [\v!december=ديسمبر] - -\setuplabeltext [\s!ar-sy] [\v!january=كانون الثاني] -\setuplabeltext [\s!ar-sy] [\v!february=شباط] -\setuplabeltext [\s!ar-sy] [\v!march=آذار] -\setuplabeltext [\s!ar-sy] [\v!april=نيسان] -\setuplabeltext [\s!ar-sy] [\v!may=أيار] -\setuplabeltext [\s!ar-sy] [\v!june=حزيران] -\setuplabeltext [\s!ar-sy] [\v!july=تموز] -\setuplabeltext [\s!ar-sy] [\v!august=آب] -\setuplabeltext [\s!ar-sy] [\v!september=أيلول] -\setuplabeltext [\s!ar-sy] [\v!october=تشرين الأول] -\setuplabeltext [\s!ar-sy] [\v!november=تشرين الثاني] -\setuplabeltext [\s!ar-sy] [\v!december=كانون الأول] - -\setuplabeltext [\s!ar-ma] [\v!may=ماي] -\setuplabeltext [\s!ar-ma] [\v!july=يوليوز] -\setuplabeltext [\s!ar-ma] [\v!august=غشت] -\setuplabeltext [\s!ar-ma] [\v!september=شتنبر] -\setuplabeltext [\s!ar-ma] [\v!november=نونبر] -\setuplabeltext [\s!ar-ma] [\v!december=دجنبر] - -\setuplabeltext [\s!ar-dz] [\v!january=جانفي] -\setuplabeltext [\s!ar-dz] [\v!february=فيفري] -\setuplabeltext [\s!ar-dz] [\v!april=أفريل] -\setuplabeltext [\s!ar-dz] [\v!may=ماي] -\setuplabeltext [\s!ar-dz] [\v!june=جوان] -\setuplabeltext [\s!ar-dz] [\v!july=جويلة] -\setuplabeltext [\s!ar-dz] [\v!august=أوت] - -\setuplabeltext [\s!ar] [\v!sunday=الأحد] -\setuplabeltext [\s!ar] [\v!monday=الاثنين] -\setuplabeltext [\s!ar] [\v!tuesday=الثلاثاء] -\setuplabeltext [\s!ar] [\v!wednesday=الأربعاء] -\setuplabeltext [\s!ar] [\v!thursday=الخميس] -\setuplabeltext [\s!ar] [\v!friday=الجمعة] -\setuplabeltext [\s!ar] [\v!saturday=السبت] - -%D Rather new ... - -\setuplabeltext [\s!ar] [\v!page=صفحة ] -\setuplabeltext [\s!ar] [\v!atpage=في صفحة ] -\setuplabeltext [\s!ar] [\v!hencefore=كما وضحنا سابقا] -\setuplabeltext [\s!ar] [\v!hereafter=كما نوضح لاحقا] -\setuplabeltext [\s!ar] [\v!see=انظر ] - -%D ... and to be completed! - -%D \ShowAllLanguageValues [\s!ar] [arabic] {Arabic} {horn} % engelse humor - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-art.mkii b/Master/texmf-dist/tex/context/base/lang-art.mkii new file mode 100644 index 00000000000..e8be91630a6 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lang-art.mkii @@ -0,0 +1,26 @@ +%D \module +%D [ file=lang--art, +%D version=1997.09.03, +%D title=\CONTEXT\ Language Macros, +%D subtitle=Artificial 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. + +\writestatus{loading}{ConTeXt Language Macros / Artificial Languages} + +%D The framework of this module is set up by Hans Hagen while +%D many of the first translations were done by Tobias. Later +%D on, corrections were made by users. If you have suggestions, +%D or feel that your name missing here, don't hesitate to send +%D us an email. + +% Esperanto + +\unprotect + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-art.tex b/Master/texmf-dist/tex/context/base/lang-art.tex deleted file mode 100644 index e8be91630a6..00000000000 --- a/Master/texmf-dist/tex/context/base/lang-art.tex +++ /dev/null @@ -1,26 +0,0 @@ -%D \module -%D [ file=lang--art, -%D version=1997.09.03, -%D title=\CONTEXT\ Language Macros, -%D subtitle=Artificial 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. - -\writestatus{loading}{ConTeXt Language Macros / Artificial Languages} - -%D The framework of this module is set up by Hans Hagen while -%D many of the first translations were done by Tobias. Later -%D on, corrections were made by users. If you have suggestions, -%D or feel that your name missing here, don't hesitate to send -%D us an email. - -% Esperanto - -\unprotect - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-bal.mkii b/Master/texmf-dist/tex/context/base/lang-bal.mkii new file mode 100644 index 00000000000..394e9d93c1f --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lang-bal.mkii @@ -0,0 +1,118 @@ +%D \module +%D [ file=lang-bal, +%D version=2010.01.21, +%D title=\CONTEXT\ Language Macros, +%D subtitle=Baltic Languages, +%D author=Marius Aleknevičius, +%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 / Baltic Languages} + +%D The framework of this module is set up by Hans Hagen while +%D all the translations were done by Marius Aleknevičius. If +%D you have suggestions, don't hesitate to send us an email. + +%D This file is in \UTF\ encoding and is meant for \MKIV. + +% Lettish/Latvian, Lietuvių/Lithuanian + +\unprotect + +\installlanguage + [\s!lt] + [\c!spacing=\v!packed, + \c!leftsentence=---, + \c!rightsentence=---, + \c!leftsubsentence=---, + \c!rightsubsentence=---, + \c!leftquote=\lowerleftdoubleninequote, + \c!rightquote=\upperrightdoublesixquote, + \c!leftquotation=\lowerleftdoubleninequote, + \c!rightquotation=\upperrightdoublesixquote, + \c!date={\v!year,~m.,\ ,\v!month,\ ,\v!day,~d.}, + \s!patterns=\s!lt, + \s!encoding=l7x, + \s!mapping=l7x, + \s!lefthyphenmin=2, + \s!righthyphenmin=2] + +\installlanguage [lithuanian] [\s!lt] + +\setupheadtext [\s!lt] [\v!content=Turinys] +\setupheadtext [\s!lt] [\v!tables=Lentelės] +\setupheadtext [\s!lt] [\v!figures=Iliustracijos] +\setupheadtext [\s!lt] [\v!graphics=Graphics] % TODO what is the difference between the "graphics" and the "figures"? +\setupheadtext [\s!lt] [\v!intermezzi=Intermezzos] % TODO what is the "intermezzi"? +\setupheadtext [\s!lt] [\v!index=Rodyklė] +\setupheadtext [\s!lt] [\v!abbreviations=Santrumpos] +\setupheadtext [\s!lt] [\v!logos=Logos] % TODO where it is used? +\setupheadtext [\s!lt] [\v!units=Units] % TODO where it is used? +\setupheadtext [\s!lt] [pubs=Literatūra] + +\setuplabeltext [\s!lt] [\v!table={, lentelė.}] +\setuplabeltext [\s!lt] [\v!figure={, pav.}] +\setuplabeltext [\s!lt] [\v!intermezzo=Intermezzo ] % TODO +\setuplabeltext [\s!lt] [\v!graphic=Graphic ] % TODO + +%\startlanguagespecifics[\s!lt] +% \setupheads[\c!sectionstopper=.] %TODO how do I set dots after section numbers? +%\stoplanguagespecifics + +\setuplabeltext [\s!lt] [\v!chapter=] % Chapter +\setuplabeltext [\s!lt] [\v!section=] +\setuplabeltext [\s!lt] [\v!subsection=] +\setuplabeltext [\s!lt] [\v!subsubsection=] +\setuplabeltext [\s!lt] [\v!subsubsubsection=] +\setuplabeltext [\s!lt] [\v!appendix=] % Appendix +\setuplabeltext [\s!lt] [\v!part={, dalis}] +\setuplabeltext [\s!lt] [\v!line=line ] % TODO where it is used? +\setuplabeltext [\s!lt] [\v!lines=lines ] % TODO where it is used? + +\setuplabeltext [\s!lt] [\v!january=sausio] +\setuplabeltext [\s!lt] [\v!february=vasario] +\setuplabeltext [\s!lt] [\v!march=kovo] +\setuplabeltext [\s!lt] [\v!april=balandžio] +\setuplabeltext [\s!lt] [\v!may=gegužės] +\setuplabeltext [\s!lt] [\v!june=birželio] +\setuplabeltext [\s!lt] [\v!july=liepos] +\setuplabeltext [\s!lt] [\v!august=rugpjūčio] +\setuplabeltext [\s!lt] [\v!september=rugsėjo] +\setuplabeltext [\s!lt] [\v!october=spalio] +\setuplabeltext [\s!lt] [\v!november=lapkričio] +\setuplabeltext [\s!lt] [\v!december=gruodžio] + +\setuplabeltext [\s!lt] [\v!sunday=sekmadienis] +\setuplabeltext [\s!lt] [\v!monday=pirmadienis] +\setuplabeltext [\s!lt] [\v!tuesday=antradienis] +\setuplabeltext [\s!lt] [\v!wednesday=trečiadienis] +\setuplabeltext [\s!lt] [\v!thursday=ketvirtadienis] +\setuplabeltext [\s!lt] [\v!friday=penktadienis] +\setuplabeltext [\s!lt] [\v!saturday=šeštadienis] + +\setuplabeltext [\s!lt] [\v!page=puslapis ] % TODO how to test? +\setuplabeltext [\s!lt] [\v!atpage=puslapyje ] % TODO how to test? +\setuplabeltext [\s!lt] [\v!hencefore=kaip parodyta aukščiau] % TODO how to test? +\setuplabeltext [\s!lt] [\v!hereafter=kaip parodyta žemiau] % TODO how to test? +\setuplabeltext [\s!lt] [\v!see=žiūrėti ] % TODO how to test? + +\setuplabeltext [\s!lt] [\v!january :\s!mnem=jan] % I think, there is no abbreviated versions of months in lithuanian +\setuplabeltext [\s!lt] [\v!february :\s!mnem=feb] +\setuplabeltext [\s!lt] [\v!march :\s!mnem=mar] +\setuplabeltext [\s!lt] [\v!april :\s!mnem=apr] +\setuplabeltext [\s!lt] [\v!may :\s!mnem=may] +\setuplabeltext [\s!lt] [\v!june :\s!mnem=jun] +\setuplabeltext [\s!lt] [\v!july :\s!mnem=jul] +\setuplabeltext [\s!lt] [\v!august :\s!mnem=aug] +\setuplabeltext [\s!lt] [\v!september:\s!mnem=sep] +\setuplabeltext [\s!lt] [\v!october :\s!mnem=oct] +\setuplabeltext [\s!lt] [\v!november :\s!mnem=nov] +\setuplabeltext [\s!lt] [\v!december :\s!mnem=dec] + +%D \ShowAllLanguageValues [\s!lt] [lithuanian] {Lithuanian} {doll} % What does this mean? Do I need it? + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-bal.tex b/Master/texmf-dist/tex/context/base/lang-bal.tex deleted file mode 100644 index 394e9d93c1f..00000000000 --- a/Master/texmf-dist/tex/context/base/lang-bal.tex +++ /dev/null @@ -1,118 +0,0 @@ -%D \module -%D [ file=lang-bal, -%D version=2010.01.21, -%D title=\CONTEXT\ Language Macros, -%D subtitle=Baltic Languages, -%D author=Marius Aleknevičius, -%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 / Baltic Languages} - -%D The framework of this module is set up by Hans Hagen while -%D all the translations were done by Marius Aleknevičius. If -%D you have suggestions, don't hesitate to send us an email. - -%D This file is in \UTF\ encoding and is meant for \MKIV. - -% Lettish/Latvian, Lietuvių/Lithuanian - -\unprotect - -\installlanguage - [\s!lt] - [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, - \c!leftquote=\lowerleftdoubleninequote, - \c!rightquote=\upperrightdoublesixquote, - \c!leftquotation=\lowerleftdoubleninequote, - \c!rightquotation=\upperrightdoublesixquote, - \c!date={\v!year,~m.,\ ,\v!month,\ ,\v!day,~d.}, - \s!patterns=\s!lt, - \s!encoding=l7x, - \s!mapping=l7x, - \s!lefthyphenmin=2, - \s!righthyphenmin=2] - -\installlanguage [lithuanian] [\s!lt] - -\setupheadtext [\s!lt] [\v!content=Turinys] -\setupheadtext [\s!lt] [\v!tables=Lentelės] -\setupheadtext [\s!lt] [\v!figures=Iliustracijos] -\setupheadtext [\s!lt] [\v!graphics=Graphics] % TODO what is the difference between the "graphics" and the "figures"? -\setupheadtext [\s!lt] [\v!intermezzi=Intermezzos] % TODO what is the "intermezzi"? -\setupheadtext [\s!lt] [\v!index=Rodyklė] -\setupheadtext [\s!lt] [\v!abbreviations=Santrumpos] -\setupheadtext [\s!lt] [\v!logos=Logos] % TODO where it is used? -\setupheadtext [\s!lt] [\v!units=Units] % TODO where it is used? -\setupheadtext [\s!lt] [pubs=Literatūra] - -\setuplabeltext [\s!lt] [\v!table={, lentelė.}] -\setuplabeltext [\s!lt] [\v!figure={, pav.}] -\setuplabeltext [\s!lt] [\v!intermezzo=Intermezzo ] % TODO -\setuplabeltext [\s!lt] [\v!graphic=Graphic ] % TODO - -%\startlanguagespecifics[\s!lt] -% \setupheads[\c!sectionstopper=.] %TODO how do I set dots after section numbers? -%\stoplanguagespecifics - -\setuplabeltext [\s!lt] [\v!chapter=] % Chapter -\setuplabeltext [\s!lt] [\v!section=] -\setuplabeltext [\s!lt] [\v!subsection=] -\setuplabeltext [\s!lt] [\v!subsubsection=] -\setuplabeltext [\s!lt] [\v!subsubsubsection=] -\setuplabeltext [\s!lt] [\v!appendix=] % Appendix -\setuplabeltext [\s!lt] [\v!part={, dalis}] -\setuplabeltext [\s!lt] [\v!line=line ] % TODO where it is used? -\setuplabeltext [\s!lt] [\v!lines=lines ] % TODO where it is used? - -\setuplabeltext [\s!lt] [\v!january=sausio] -\setuplabeltext [\s!lt] [\v!february=vasario] -\setuplabeltext [\s!lt] [\v!march=kovo] -\setuplabeltext [\s!lt] [\v!april=balandžio] -\setuplabeltext [\s!lt] [\v!may=gegužės] -\setuplabeltext [\s!lt] [\v!june=birželio] -\setuplabeltext [\s!lt] [\v!july=liepos] -\setuplabeltext [\s!lt] [\v!august=rugpjūčio] -\setuplabeltext [\s!lt] [\v!september=rugsėjo] -\setuplabeltext [\s!lt] [\v!october=spalio] -\setuplabeltext [\s!lt] [\v!november=lapkričio] -\setuplabeltext [\s!lt] [\v!december=gruodžio] - -\setuplabeltext [\s!lt] [\v!sunday=sekmadienis] -\setuplabeltext [\s!lt] [\v!monday=pirmadienis] -\setuplabeltext [\s!lt] [\v!tuesday=antradienis] -\setuplabeltext [\s!lt] [\v!wednesday=trečiadienis] -\setuplabeltext [\s!lt] [\v!thursday=ketvirtadienis] -\setuplabeltext [\s!lt] [\v!friday=penktadienis] -\setuplabeltext [\s!lt] [\v!saturday=šeštadienis] - -\setuplabeltext [\s!lt] [\v!page=puslapis ] % TODO how to test? -\setuplabeltext [\s!lt] [\v!atpage=puslapyje ] % TODO how to test? -\setuplabeltext [\s!lt] [\v!hencefore=kaip parodyta aukščiau] % TODO how to test? -\setuplabeltext [\s!lt] [\v!hereafter=kaip parodyta žemiau] % TODO how to test? -\setuplabeltext [\s!lt] [\v!see=žiūrėti ] % TODO how to test? - -\setuplabeltext [\s!lt] [\v!january :\s!mnem=jan] % I think, there is no abbreviated versions of months in lithuanian -\setuplabeltext [\s!lt] [\v!february :\s!mnem=feb] -\setuplabeltext [\s!lt] [\v!march :\s!mnem=mar] -\setuplabeltext [\s!lt] [\v!april :\s!mnem=apr] -\setuplabeltext [\s!lt] [\v!may :\s!mnem=may] -\setuplabeltext [\s!lt] [\v!june :\s!mnem=jun] -\setuplabeltext [\s!lt] [\v!july :\s!mnem=jul] -\setuplabeltext [\s!lt] [\v!august :\s!mnem=aug] -\setuplabeltext [\s!lt] [\v!september:\s!mnem=sep] -\setuplabeltext [\s!lt] [\v!october :\s!mnem=oct] -\setuplabeltext [\s!lt] [\v!november :\s!mnem=nov] -\setuplabeltext [\s!lt] [\v!december :\s!mnem=dec] - -%D \ShowAllLanguageValues [\s!lt] [lithuanian] {Lithuanian} {doll} % What does this mean? Do I need it? - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-cel.mkii b/Master/texmf-dist/tex/context/base/lang-cel.mkii new file mode 100644 index 00000000000..4d93957f102 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lang-cel.mkii @@ -0,0 +1,26 @@ +%D \module +%D [ file=lang-cel, +%D version=1997.09.03, +%D title=\CONTEXT\ Language Macros, +%D subtitle=Celtic 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. + +\writestatus{loading}{ConTeXt Language Macros / Celtic Languages} + +%D The framework of this module is set up by Hans Hagen while +%D many of the first translations were done by Tobias. Later +%D on, corrections were made by users. If you have suggestions, +%D or feel that your name missing here, don't hesitate to send +%D us an email. + +% Breton, Welsh, Irish, Manx, Scottish Gaelic + +\unprotect + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-cel.tex b/Master/texmf-dist/tex/context/base/lang-cel.tex deleted file mode 100644 index 4d93957f102..00000000000 --- a/Master/texmf-dist/tex/context/base/lang-cel.tex +++ /dev/null @@ -1,26 +0,0 @@ -%D \module -%D [ file=lang-cel, -%D version=1997.09.03, -%D title=\CONTEXT\ Language Macros, -%D subtitle=Celtic 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. - -\writestatus{loading}{ConTeXt Language Macros / Celtic Languages} - -%D The framework of this module is set up by Hans Hagen while -%D many of the first translations were done by Tobias. Later -%D on, corrections were made by users. If you have suggestions, -%D or feel that your name missing here, don't hesitate to send -%D us an email. - -% Breton, Welsh, Irish, Manx, Scottish Gaelic - -\unprotect - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-cjk.mkiv b/Master/texmf-dist/tex/context/base/lang-cjk.mkiv deleted file mode 100644 index 5f736d4a165..00000000000 --- a/Master/texmf-dist/tex/context/base/lang-cjk.mkiv +++ /dev/null @@ -1,328 +0,0 @@ -%D \module -%D [ file=lang-chi, -%D version=2009.03.02, -%D title=\CONTEXT\ Language Macros, -%D subtitle=Chinese, -%D author={Hans Hagen \& Wang Lei}, -%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 Derived from \MKII\ files. - -\writestatus{loading}{ConTeXt Language Macros / CJK} - -\definesystemconstant {chinese} \definesystemconstant {cn} -\definesystemconstant {japanese} \definesystemconstant {ja} -\definesystemconstant {korean} \definesystemconstant {kr} - -\unprotect - -% Chinese - -\installlanguage - [\s!cn] - [\c!leftsentence=——, - \c!rightsentence=——, - \c!leftsubsentence=——, - \c!rightsubsentence=——, - \c!leftquote=‘, - \c!rightquote=’, - \c!leftquotation=“, - \c!rightquotation=”, - \c!date={\v!year,年,\ ,\v!month,\v!day,日}] - -\setupheadtext [\s!cn] [\v!content=目录] -\setupheadtext [\s!cn] [\v!tables=表格] -\setupheadtext [\s!cn] [\v!figures=图形] -\setupheadtext [\s!cn] [\v!graphics=图] -\setupheadtext [\s!cn] [\v!intermezzi=퉣] -\setupheadtext [\s!cn] [\v!index=索引] -\setupheadtext [\s!cn] [\v!abbreviations=缩略语] -\setupheadtext [\s!cn] [\v!logos=徽贬] -\setupheadtext [\s!cn] [\v!units=计量单位] - -\setuplabeltext [\s!cn] [\v!table=表] -\setuplabeltext [\s!cn] [\v!figure=图] -\setuplabeltext [\s!cn] [\v!intermezzo=퉣] -\setuplabeltext [\s!cn] [\v!graphic=插图] -\setuplabeltext [\s!cn] [\v!appendix=附录] -\setuplabeltext [\s!cn] [\v!part={第,部分}] -\setuplabeltext [\s!cn] [\v!chapter={第,章}] -\setuplabeltext [\s!cn] [\v!section={第,节}] -\setuplabeltext [\s!cn] [\v!line=行] -\setuplabeltext [\s!cn] [\v!lines=行] - -\setuplabeltext [\s!cn] [\v!subsection=] -\setuplabeltext [\s!cn] [\v!subsubsection=] -\setuplabeltext [\s!cn] [\v!subsubsubsection=] - -\setuplabeltext [\s!cn] [\v!january=一月] -\setuplabeltext [\s!cn] [\v!february=二月] -\setuplabeltext [\s!cn] [\v!march=三月] -\setuplabeltext [\s!cn] [\v!april=四月] -\setuplabeltext [\s!cn] [\v!may=五月] -\setuplabeltext [\s!cn] [\v!june=六月] -\setuplabeltext [\s!cn] [\v!july=七月] -\setuplabeltext [\s!cn] [\v!august=八月] -\setuplabeltext [\s!cn] [\v!september=九月] -\setuplabeltext [\s!cn] [\v!october=十月] -\setuplabeltext [\s!cn] [\v!november=十一月] -\setuplabeltext [\s!cn] [\v!december=十二月] - -\setuplabeltext [\s!cn] [\v!sunday=星期日] -\setuplabeltext [\s!cn] [\v!monday=星期一] -\setuplabeltext [\s!cn] [\v!tuesday=星期二] -\setuplabeltext [\s!cn] [\v!wednesday=星期三] -\setuplabeltext [\s!cn] [\v!thursday=星期四] -\setuplabeltext [\s!cn] [\v!friday=星期五] -\setuplabeltext [\s!cn] [\v!saturday=星期六] - -%D Japanese - -\installlanguage - [\s!ja] - [\c!leftsentence=——, - \c!rightsentence=——, - \c!leftsubsentence=——, - \c!rightsubsentence=——, - \c!leftquote=‘, - \c!rightquote=’, - \c!leftquotation=「, - \c!rightquotation=」, - \c!date={西暦,\v!year,年,\v!month,月,\v!day,日}] - -\setupheadtext [\s!ja] [\v!content=目次] -\setupheadtext [\s!ja] [\v!tables=机] -\setupheadtext [\s!ja] [\v!figures=図] -\setupheadtext [\s!ja] [\v!graphics=グラフ] -\setupheadtext [\s!ja] [\v!intermezzi=間奏曲] -\setupheadtext [\s!ja] [\v!index=目次] -\setupheadtext [\s!ja] [\v!abbreviations=略語] -\setupheadtext [\s!ja] [\v!logos=理性] -\setupheadtext [\s!ja] [\v!units=ユニッツ] - -\setuplabeltext [\s!ja] [\v!table=表] -\setuplabeltext [\s!ja] [\v!figure=図] -\setuplabeltext [\s!ja] [\v!intermezzo=間奏曲] -\setuplabeltext [\s!ja] [\v!graphic=イラスト] -\setuplabeltext [\s!ja] [\v!appendix=付録] -\setuplabeltext [\s!ja] [\v!part={第,パート}] -\setuplabeltext [\s!ja] [\v!chapter={第,章}] -\setuplabeltext [\s!ja] [\v!section={第,項}] -\setuplabeltext [\s!ja] [\v!line=線] -\setuplabeltext [\s!ja] [\v!lines=線] - -\setuplabeltext [\s!ja] [\v!subsection=] -\setuplabeltext [\s!ja] [\v!subsubsection=] -\setuplabeltext [\s!ja] [\v!subsubsubsection=] - -\setuplabeltext [\s!ja] [\v!january=1] -\setuplabeltext [\s!ja] [\v!february=2] -\setuplabeltext [\s!ja] [\v!march=3] -\setuplabeltext [\s!ja] [\v!april=4] -\setuplabeltext [\s!ja] [\v!may=5] -\setuplabeltext [\s!ja] [\v!june=6] -\setuplabeltext [\s!ja] [\v!july=7] -\setuplabeltext [\s!ja] [\v!august=8] -\setuplabeltext [\s!ja] [\v!september=9] -\setuplabeltext [\s!ja] [\v!october=10] -\setuplabeltext [\s!ja] [\v!november=11] -\setuplabeltext [\s!ja] [\v!december=12] - -\setuplabeltext [\s!ja] [\v!monday=月曜日] -\setuplabeltext [\s!ja] [\v!tuesday=火曜日] -\setuplabeltext [\s!ja] [\v!wednesday=水曜日] -\setuplabeltext [\s!ja] [\v!thursday=木曜日] -\setuplabeltext [\s!ja] [\v!friday=金曜日] -\setuplabeltext [\s!ja] [\v!saturday=土曜日] -\setuplabeltext [\s!ja] [\v!sunday=日曜日] - -%D Korean - -% todo - -\protect \endinput - -cn={ - ["abbreviations"]="缩略语", - ["appendix"]="附录", - ["april"]="四月", - ["august"]="八月", - ["chapter"]="章", - ["contents"]="目录", - ["day"]="日", - ["december"]="十二月", - ["febrary"]="二月", - ["figure"]="图", - ["figures"]="图形", - ["friday"]="星期五", - ["graphics"]="图", - ["illustration"]="插图", - ["index"]="索引", - ["intermezzo"]="퉣", - ["intro"]="第", - ["january"]="一月", - ["july"]="七月", - ["june"]="六月", - ["leftsentence"]="——", - ["leftsubsentence"]="——", - ["line"]="行", - ["logos"]="徽贬", - ["march"]="三月", - ["may"]="五月", - ["monday"]="星期一", - ["month"]="月", - ["november"]="十一月", - ["october"]="十月", - ["part"]="部分", - ["rightsentence"]="——", - ["rightsubsentence"]="——", - ["saturday"]="星期六", - ["section"]="节", - ["september"]="九月", - ["sunday"]="星期日", - ["table"]="表", - ["tables"]="表格", - ["thursday"]="星期四", - ["tuesday"]="星期二", - ["units"]="计量单位", - ["upperleftdoublequote"]="“", - ["upperleftdoublequote-v"]="『", - ["upperleftsinglequote"]="‘", - ["upperleftsinglequote-v"]="「", - ["upperrightdoublequote"]="”", - ["upperrightdoublequote-v"]="』", - ["upperrightsinglequote"]="’", - ["upperrightsinglequote-v"]="」", - ["wednesday"]="星期三", - ["year"]="年", -} - -ja={ - ["abbreviations"]="略語", - ["abstract"]="概要", - ["and"]="、", - ["answer"]="答:", - ["appendix"]="付録", - ["april"]="四月", - ["article"]="項目", - ["august"]="八月", - ["bibliography"]="参考文献", - ["book"]="ブック", - ["bridgehead"]="項", - ["bullet"]="●", - ["by"]=":", - ["caution"]="注意", - ["chapter"]="章", - ["christiandate"]="西暦", - ["colophon"]="奥付", - ["copyright"]="製作著作", - ["day"]="日", - ["december"]="十二月", - ["dedication"]="謝辞", - ["edited"]="編者", - ["editedby"]="編者:", - ["edition"]="編集", - ["endquote"]="」", - ["equation"]="式", - ["example"]="例", - ["february"]="二月", - ["figure"]="図", - ["figures"]="図", - ["friday"]="土曜日", - ["glossary"]="用語集", - ["glosssee"]="参照", - ["glossseealso"]="参照", - ["graphics"]="グラフ", - ["illustration"]="イラスト", - ["important"]="重要項目", - ["index"]="目次", - ["indexsymbols"]="シンボル", - ["intermezzo"]="間奏曲", - ["intermezzos"]="間奏曲", - ["intro"]="第", - ["january"]="一月", - ["july"]="七月", - ["june"]="六月", - ["leftsentence"]="——", - ["leftsubsentence"]="——", - ["line"]="線", - ["lines"]="線", - ["listofequations"]="式目次", - ["listofexamples"]="例目次", - ["listoffigures"]="図目次", - ["listoftables"]="表目次", - ["listofunknown"]="不明目次", - ["logos"]="理性", - ["march"]="三月", - ["may"]="五月", - ["monday"]="火曜日", - ["month"]="月", - ["msgaud"]="対象者", - ["msglevel"]="レベル", - ["msgorig"]="発信元", - ["navhome"]="ホーム", - ["navnext"]="次のページ", - ["navnextsibling"]="早送り", - ["navprev"]="前のページ", - ["navprevsibling"]="巻戻し", - ["navup"]="上に戻る", - ["nestedendquote"]="』", - ["nestedstartquote"]="『", - ["nonexistantelement"]="要素が存在しません", - ["note"]="注意", - ["notes"]="注意", - ["november"]="十一月", - ["october"]="十月", - ["pages"]="偧献", - ["part"]="パート", - ["preface"]="序文", - ["procedure"]="手順", - ["procedureformal"]="手順", - ["productionset"]="プロダクション", - ["productionsetformal"]="プロダクション", - ["published"]="発行", - ["qandadiv"]="問:、答:", - ["qandaentry"]="問:", - ["question"]="問:", - ["reference"]="参照", - ["refname"]="名前", - ["refsection"]="項", - ["refsynopsisdiv"]="概要", - ["revhistory"]="改訂履歴", - ["revision"]="改訂", - ["rightsentence"]="——", - ["rightsubsentence"]="——", - ["saturday"]="日曜日", - ["section"]="項", - ["see"]="参照", - ["seealso"]="参照", - ["separator"]="、", - ["september"]="九月", - ["set"]="設定", - ["setindex"]="目次設定", - ["sidebar"]="サイドバー", - ["simplesect"]="項", - ["singleendquote"]="’", - ["singlestartquote"]="‘", - ["startquote"]="「", - ["step"]="ステップ", - ["sunday"]="月曜日", - ["table"]="表", - ["tablenotes"]="注意", - ["tableofcontents"]="目次", - ["tables"]="机", - ["thursday"]="金曜日", - ["tip"]="ティップ", - ["tuesday"]="水曜日", - ["unexpectedelementname"]="不明な要素名", - ["units"]="ユニッツ", - ["unsupported"]="サポートしません", - ["warning"]="警告", - ["wednesday"]="木曜日", - ["year"]="年", -} diff --git a/Master/texmf-dist/tex/context/base/lang-cyr.mkii b/Master/texmf-dist/tex/context/base/lang-cyr.mkii new file mode 100644 index 00000000000..470402bb10e --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lang-cyr.mkii @@ -0,0 +1,371 @@ +%D \module +%D [ file=lang-cyr, +%D version=2003.01.24, +%D title=\CONTEXT\ Language Macros, +%D subtitle=Cyrillic Languages, +%D author=see below, +%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 / Cyrillic Languages} + +%D The cyrillic languages always use a dedicated input regime. +%D Therefore we define the labels using symbolic names. +%D Support for cyrillic is initiated by Olga Briginets who +%D also layed the base for the language, encoding and font +%D definition. Later Alexander Bokovoy and Victor Figurnov +%D improved things. I (Hans Hagen) mainly cleaned things up +%D a bit. + +\unprotect + +\installlanguage + [\s!ru] + [\s!lefthyphenmin=2, + \s!righthyphenmin=2, + \c!spacing=\v!packed, + \c!leftsentence=\leftguillemot, + \c!rightsentence=\rightguillemot, + \c!leftsubsentence=\lowerleftdoubleninequote, + \c!rightsubsentence=\upperrightdoubleninequote, + \c!leftquote=\lowerleftdoubleninequote, + \c!rightquote=\upperrightdoubleninequote, + \c!leftquotation=\leftguillemot, + \c!rightquotation=\rightguillemot, + \c!date={\v!day,\ ,\v!month,\ ,\v!year}, + \s!mapping=t2a, + \s!encoding=t2a] + +\installlanguage + [\s!ua] + [\s!lefthyphenmin=2, + \s!righthyphenmin=2, + \c!spacing=\v!packed, + \c!leftsentence=\leftguillemot, + \c!rightsentence=\rightguillemot, + \c!leftsubsentence=\lowerleftdoubleninequote, + \c!rightsubsentence=\upperrightdoubleninequote, + \c!leftquote=\lowerleftdoubleninequote, + \c!rightquote=\upperrightdoubleninequote, + \c!leftquotation=\leftguillemot, + \c!rightquotation=\rightguillemot, + \c!date={\v!day,\ ,\v!month,\ ,\v!year}, + \s!patterns=\s!uk, + \s!mapping=t2a, + \s!encoding=t2a] + +\installlanguage [russian] [\s!ru] +\installlanguage [ukrainian] [\s!ua] + +%D Labels and header texts. + +\setupheadtext [\s!ru] [ \v!content=\cyrillicS \cyrillico \cyrillicd + \cyrillice \cyrillicr \cyrilliczh + \cyrillica \cyrillicn \cyrillici + \cyrillice] +\setupheadtext [\s!ua] [\v!content=\cyrillicZ \cyrillicm \cyrillicii + \cyrillics \cyrillict] + +\setupheadtext [\s!ru] [\v!tables=\cyrillicS \cyrillicp \cyrillici + \cyrillics \cyrillico \cyrillick + \space \cyrillict \cyrillica + \cyrillicb \cyrillicl \cyrillici + \cyrillicc] +\setupheadtext [\s!ua] [\v!tables=\cyrillicP \cyrillice \cyrillicr + \cyrillice \cyrillicl \cyrillicii + \cyrillick \space \cyrillict + \cyrillica \cyrillicb \cyrillicl + \cyrillici \cyrillicc \cyrillicsftsn] + +\setupheadtext [\s!ru] [\v!figures=\cyrillicS \cyrillicp \cyrillici + \cyrillics \cyrillico \cyrillick + \space \cyrillici \cyrillicl + \cyrillicl \cyrillicyu\cyrillics + \cyrillict \cyrillicr \cyrillica + \cyrillicc \cyrillici \cyrillicishrt] +\setupheadtext [\s!ua] [\v!figures=\cyrillicP \cyrillice \cyrillicr + \cyrillice \cyrillicl \cyrillicii + \cyrillick \space \cyrillicii + \cyrillicl \cyrillicyu\cyrillics + \cyrillict \cyrillicr \cyrillica + \cyrillicc \cyrillicii\cyrillicishrt] + +\setupheadtext [\s!ru] [\v!graphics=\cyrillicS \cyrillicp \cyrillici + \cyrillics \cyrillico \cyrillick + \space \cyrillicg \cyrillicr + \cyrillica \cyrillicf \cyrillici + \cyrillick \cyrillico \cyrillicv] +\setupheadtext [\s!ua] [\v!graphics=\cyrillicP \cyrillice \cyrillicr + \cyrillice \cyrillicl \cyrillicii + \cyrillick \space \cyrillicg + \cyrillicr \cyrillica \cyrillicf + \cyrillicii\cyrillick \cyrillico + \cyrillicv] + +\setupheadtext [\s!ru] [\v!intermezzi=\cyrillicS \cyrillicp \cyrillici + \cyrillics \cyrillico \cyrillick + \space \cyrillicv \cyrillics + \cyrillict \cyrillica \cyrillicv + \cyrillico \cyrillick] +\setupheadtext [\s!ua] [\v!intermezzi=\cyrillicP \cyrillice \cyrillicr + \cyrillice \cyrillicl \cyrillicii + \cyrillick \space \cyrillicv + \cyrillics \cyrillict \cyrillica + \cyrillicv \cyrillico \cyrillick] + +\setupheadtext [\s!ru] [\v!index=\cyrillicA \cyrillicl \cyrillicf + \cyrillica \cyrillicv \cyrillici + \cyrillict \cyrillicn \cyrillicery + \cyrillicishrt \space \cyrillicu + \cyrillick \cyrillica \cyrillicz + \cyrillica \cyrillict \cyrillice + \cyrillicl \cyrillicsftsn] +\setupheadtext [\s!ua] [\v!index=\cyrillicP \cyrillico \cyrillick + \cyrillica \cyrilliczh\cyrillicch + \cyrillici \cyrillick] + +\setupheadtext [\s!ru] [\v!abbreviations=\cyrillicS \cyrillicp \cyrillici + \cyrillics \cyrillico \cyrillick + \space \cyrillics \cyrillico + \cyrillick \cyrillicr \cyrillica + \cyrillicshch \cyrillice + \cyrillicn + \cyrillici \cyrillicishrt] +\setupheadtext [\s!ua] [\v!abbreviations=\cyrillicP \cyrillice \cyrillicr + \cyrillice \cyrillicl \cyrillicii + \cyrillick \space \cyrillics + \cyrillick \cyrillico \cyrillicr + \cyrillico \cyrillicch\cyrillice + \cyrillicn \cyrillicsftsn] + +\setupheadtext [\s!ru] [\v!logos=\cyrillicL \cyrillico \cyrillicg + \cyrillico \cyrillict \cyrillici + \cyrillicp \cyrillicery] +\setupheadtext [\s!ua] [\v!logos=\cyrillicL \cyrillico \cyrillicg + \cyrillico \cyrillict \cyrillici + \cyrillicp \cyrillici] + +\setupheadtext [\s!ru] [\v!units=\cyrillicE \cyrillicd \cyrillici + \cyrillicn \cyrillici \cyrillicc + \cyrillicery \space \cyrillici + \cyrillicz \cyrillicm \cyrillice + \cyrillicr \cyrillice \cyrillicn + \cyrillici \cyrillicya] +\setupheadtext [\s!ua] [\v!units=\cyrillicO \cyrillicd \cyrillici + \cyrillicn \cyrillici \cyrillicc + \cyrillicii\space \cyrillicv + \cyrillici \cyrillicm \cyrillicii + \cyrillicr \cyrillicu] + +\setuplabeltext [\s!ru] [\v!table=\cyrillicT \cyrillica \cyrillicb + \cyrillicl \cyrillici \cyrillicc + \cyrillica \space] +\setuplabeltext [\s!ua] [\v!table=\cyrillicT \cyrillica \cyrillicb + \cyrillicl \cyrillici \cyrillicc + \cyrillicya\space] + +\setuplabeltext [\s!ru] [\v!figure=\cyrillicR \cyrillici \cyrillics + \cyrillicu \cyrillicn \cyrillico + \cyrillick \space] +\setuplabeltext [\s!ua] [\v!figure=\cyrillicM \cyrillica \cyrillicl + \cyrillicyu\cyrillicn \cyrillico + \cyrillick \space] + +\setuplabeltext [\s!ru] [\v!intermezzo=\cyrillicV \cyrillics \cyrillict + \cyrillica \cyrillicv \cyrillick + \cyrillica \space] +\setuplabeltext [\s!ua] [\v!intermezzo=\cyrillicV \cyrillics \cyrillict + \cyrillica \cyrillicv \cyrillick + \cyrillica \space] + +\setuplabeltext [\s!ru] [\v!graphic=\cyrillicG \cyrillicr \cyrillica + \cyrillicf \cyrillici \cyrillick + \space] +\setuplabeltext [\s!ua] [\v!graphic=\cyrillicG \cyrillicr \cyrillica + \cyrillicf \cyrillici \cyrillick + \space] + +\setuplabeltext [\s!ru] [\v!chapter=] +\setuplabeltext [\s!ua] [\v!chapter=] + +\setuplabeltext [\s!ru] [\v!section=] +\setuplabeltext [\s!ua] [\v!section=] + +\setuplabeltext [\s!ru] [\v!subsection=] +\setuplabeltext [\s!ua] [\v!subsection=] + +\setuplabeltext [\s!ru] [\v!subsubsection=] +\setuplabeltext [\s!ua] [\v!subsubsection=] + +\setuplabeltext [\s!ru] [\v!subsubsubsection=] +\setuplabeltext [\s!ua] [\v!subsubsubsection=] + +\setuplabeltext [\s!ru] [\v!appendix=] +\setuplabeltext [\s!ua] [\v!appendix=] + +\setuplabeltext [\s!ru] [\v!part=\cyrillicCH\cyrillica \cyrillics + \cyrillict \cyrillicsftsn + \space] +\setuplabeltext [\s!ua] [\v!part=\cyrillicCH\cyrillica \cyrillics + \cyrillict \cyrillici \cyrillicn + \cyrillica \space] + +\setuplabeltext [\s!ru] [\v!line=\cyrillics \cyrillict \cyrillicr + \cyrillico \cyrillick \cyrillica + \space] +\setuplabeltext [\s!ua] [\v!line=\cyrillicr \cyrillicya\cyrillicd + \cyrillico \cyrillick \space] + +\setuplabeltext [\s!ru] [\v!lines=\cyrillics \cyrillict \cyrillicr + \cyrillico \cyrillick \cyrillici + \space] +\setuplabeltext [\s!ua] [\v!lines=\cyrillicr \cyrillicya\cyrillicd + \cyrillick \cyrillici \space] + +\setuplabeltext [\s!ru] [\v!page=\cyrillics \cyrillict \cyrillicr + \cyrillica \cyrillicn \cyrillici + \cyrillicc \cyrillica \space] +\setuplabeltext [\s!ua] [\v!page=\cyrillics \cyrillict \cyrillico + \cyrillicr \cyrillicii\cyrillicn + \cyrillick \cyrillica \space ] + +\setuplabeltext [\s!ru] [\v!atpage=\cyrillicn \cyrillica \space + \cyrillics \cyrillict \cyrillicr + \cyrillica \cyrillicn \cyrillici + \cyrillicc \cyrillice \space] +\setuplabeltext [\s!ua] [\v!atpage=\cyrillicn \cyrillica \space + \cyrillics \cyrillict \cyrillico + \cyrillicr \cyrillicii\cyrillicn + \cyrillicc \cyrillicii\space ] + +\setuplabeltext [\s!ru] [\v!hencefore=\cyrillics \cyrillicm.\space + \cyrillicv \cyrillicery \cyrillicsh + \cyrillice] +\setuplabeltext [\s!ua] [\v!hencefore=\cyrillicya\cyrillick \space + \cyrillicp \cyrillico \cyrillick + \cyrillica \cyrillicz \cyrillica + \cyrillicn \cyrillico \space + \cyrillicv \cyrillici \cyrillicshch + \cyrillice] + +\setuplabeltext [\s!ru] [\v!hereafter=\cyrillics \cyrillicm.\space + \cyrillicn \cyrillici \cyrilliczh + \cyrillice] +\setuplabeltext [\s!ua] [\v!hereafter=\cyrillicya\cyrillick \space + \cyrillicp \cyrillico \cyrillick + \cyrillica \cyrillicz \cyrillica + \cyrillicn \cyrillico \space + \cyrillicn \cyrillici \cyrilliczh + \cyrillicch\cyrillice] + +\setuplabeltext [\s!ru] [\v!see=\cyrillics \cyrillicm.\space] +\setuplabeltext [\s!ua] [\v!see=\cyrillicd \cyrillici + \cyrillicv.\space ] + +\setuplabeltext [\s!ru] [\v!january=\cyrillicya\cyrillicn \cyrillicv + \cyrillica \cyrillicr \cyrillicya] +\setuplabeltext [\s!ru] [\v!february=\cyrillicf \cyrillice \cyrillicv + \cyrillicr \cyrillica \cyrillicl + \cyrillicya] +\setuplabeltext [\s!ru] [\v!march=\cyrillicm \cyrillica \cyrillicr + \cyrillict \cyrillica] +\setuplabeltext [\s!ru] [\v!april=\cyrillica \cyrillicp \cyrillicr + \cyrillice \cyrillicl \cyrillicya] +\setuplabeltext [\s!ru] [\v!may=\cyrillicm \cyrillica \cyrillicya] +\setuplabeltext [\s!ru] [\v!june=\cyrillici \cyrillicyu\cyrillicn + \cyrillicya] +\setuplabeltext [\s!ru] [\v!july=\cyrillici \cyrillicyu\cyrillicl + \cyrillicya] +\setuplabeltext [\s!ru] [\v!august=\cyrillica \cyrillicv \cyrillicg + \cyrillicu \cyrillics \cyrillict + \cyrillica] +\setuplabeltext [\s!ru] [\v!september=\cyrillics \cyrillice \cyrillicn + \cyrillict \cyrillicya\cyrillicb + \cyrillicr \cyrillicya] +\setuplabeltext [\s!ru] [\v!october=\cyrillico \cyrillick \cyrillict + \cyrillicya\cyrillicb \cyrillicr + \cyrillicya] +\setuplabeltext [\s!ru] [\v!november=\cyrillicn \cyrillico \cyrillicya + \cyrillicb \cyrillicr \cyrillicya] +\setuplabeltext [\s!ru] [\v!december=\cyrillicd \cyrillice \cyrillick + \cyrillica \cyrillicb \cyrillicr + \cyrillicya] + +\setuplabeltext [\s!ua] [\v!january=\cyrillics \cyrillicii\cyrillicch + \cyrillicn \cyrillicya] +\setuplabeltext [\s!ua] [\v!february=\cyrillicl \cyrillicyu\cyrillict + \cyrillico \cyrillicg \cyrillico] +\setuplabeltext [\s!ua] [\v!march=\cyrillicb \cyrillice \cyrillicr + \cyrillice \cyrillicz \cyrillicn + \cyrillicya] +\setuplabeltext [\s!ua] [\v!april=\cyrillick \cyrillicv \cyrillicii + \cyrillict \cyrillicn \cyrillicya] +\setuplabeltext [\s!ua] [\v!may=\cyrillict \cyrillicr \cyrillica + \cyrillicv \cyrillicn \cyrillicya] +\setuplabeltext [\s!ua] [\v!june=\cyrillicch\cyrillice \cyrillicr + \cyrillicv \cyrillicn \cyrillicya] +\setuplabeltext [\s!ua] [\v!july=\cyrillicl \cyrillici \cyrillicp + \cyrillicn \cyrillicya] +\setuplabeltext [\s!ua] [\v!august=\cyrillics \cyrillice \cyrillicr + \cyrillicp \cyrillicn \cyrillicya] +\setuplabeltext [\s!ua] [\v!september=\cyrillicv \cyrillice \cyrillicr + \cyrillice \cyrillics \cyrillicn + \cyrillicya] +\setuplabeltext [\s!ua] [\v!october=\cyrilliczh\cyrillico \cyrillicv + \cyrillict \cyrillicn \cyrillicya] +\setuplabeltext [\s!ua] [\v!november=\cyrillicl \cyrillici \cyrillics + \cyrillict \cyrillico \cyrillicp + \cyrillica \cyrillicd \cyrillica] +\setuplabeltext [\s!ua] [\v!december=\cyrillicg \cyrillicr \cyrillicu + \cyrillicd \cyrillicn \cyrillicya] + +\setuplabeltext [\s!ru] [\v!sunday=\cyrillicv \cyrillico \cyrillics + \cyrillick \cyrillicr \cyrillice + \cyrillics \cyrillice \cyrillicn + \cyrillicsftsn \cyrillice] +\setuplabeltext [\s!ru] [\v!monday=\cyrillicp \cyrillico \cyrillicn + \cyrillice \cyrillicd \cyrillice + \cyrillicl \cyrillicsftsn + \cyrillicn \cyrillici \cyrillick] +\setuplabeltext [\s!ru] [\v!tuesday=\cyrillicv \cyrillict \cyrillico + \cyrillicr \cyrillicn \cyrillici + \cyrillick] +\setuplabeltext [\s!ru] [\v!wednesday=\cyrillics \cyrillicr \cyrillice + \cyrillicd \cyrillica] +\setuplabeltext [\s!ru] [\v!thursday=\cyrillicch\cyrillice \cyrillict + \cyrillicv \cyrillice \cyrillicr + \cyrillicg] +\setuplabeltext [\s!ru] [\v!friday=\cyrillicp \cyrillicya\cyrillict + \cyrillicn \cyrillici \cyrillicc + \cyrillica] +\setuplabeltext [\s!ru] [\v!saturday=\cyrillics \cyrillicu \cyrillicb + \cyrillicb \cyrillico \cyrillict + \cyrillica] + +\setuplabeltext [\s!ua] [\v!sunday=\cyrillicn \cyrillice \cyrillicd + \cyrillicii\cyrillicl \cyrillicya] +\setuplabeltext [\s!ua] [\v!monday=\cyrillicp \cyrillico \cyrillicn + \cyrillice \cyrillicd \cyrillicii + \cyrillicl \cyrillico \cyrillick] +\setuplabeltext [\s!ua] [\v!tuesday=\cyrillicv \cyrillicii\cyrillicv + \cyrillict \cyrillico \cyrillicr + \cyrillico \cyrillick] +\setuplabeltext [\s!ua] [\v!wednesday=\cyrillics \cyrillice \cyrillicr + \cyrillice \cyrillicd \cyrillica] +\setuplabeltext [\s!ua] [\v!thursday=\cyrillicch\cyrillice \cyrillict + \cyrillicv \cyrillice \cyrillicr] +\setuplabeltext [\s!ua] [\v!friday=\cyrillicp'\cyrillicya\cyrillict + \cyrillicn \cyrillici \cyrillicc + \cyrillicya] +\setuplabeltext [\s!ua] [\v!saturday=\cyrillics \cyrillicu \cyrillicb + \cyrillico \cyrillict \cyrillica] + + +%D \ShowAllLanguageValues [\s!ru] [russian] {Russian} {doll} +%D \ShowAllLanguageValues [\s!ua] [ukranian] {Ukranian} {dance} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-cyr.tex b/Master/texmf-dist/tex/context/base/lang-cyr.tex deleted file mode 100644 index 470402bb10e..00000000000 --- a/Master/texmf-dist/tex/context/base/lang-cyr.tex +++ /dev/null @@ -1,371 +0,0 @@ -%D \module -%D [ file=lang-cyr, -%D version=2003.01.24, -%D title=\CONTEXT\ Language Macros, -%D subtitle=Cyrillic Languages, -%D author=see below, -%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 / Cyrillic Languages} - -%D The cyrillic languages always use a dedicated input regime. -%D Therefore we define the labels using symbolic names. -%D Support for cyrillic is initiated by Olga Briginets who -%D also layed the base for the language, encoding and font -%D definition. Later Alexander Bokovoy and Victor Figurnov -%D improved things. I (Hans Hagen) mainly cleaned things up -%D a bit. - -\unprotect - -\installlanguage - [\s!ru] - [\s!lefthyphenmin=2, - \s!righthyphenmin=2, - \c!spacing=\v!packed, - \c!leftsentence=\leftguillemot, - \c!rightsentence=\rightguillemot, - \c!leftsubsentence=\lowerleftdoubleninequote, - \c!rightsubsentence=\upperrightdoubleninequote, - \c!leftquote=\lowerleftdoubleninequote, - \c!rightquote=\upperrightdoubleninequote, - \c!leftquotation=\leftguillemot, - \c!rightquotation=\rightguillemot, - \c!date={\v!day,\ ,\v!month,\ ,\v!year}, - \s!mapping=t2a, - \s!encoding=t2a] - -\installlanguage - [\s!ua] - [\s!lefthyphenmin=2, - \s!righthyphenmin=2, - \c!spacing=\v!packed, - \c!leftsentence=\leftguillemot, - \c!rightsentence=\rightguillemot, - \c!leftsubsentence=\lowerleftdoubleninequote, - \c!rightsubsentence=\upperrightdoubleninequote, - \c!leftquote=\lowerleftdoubleninequote, - \c!rightquote=\upperrightdoubleninequote, - \c!leftquotation=\leftguillemot, - \c!rightquotation=\rightguillemot, - \c!date={\v!day,\ ,\v!month,\ ,\v!year}, - \s!patterns=\s!uk, - \s!mapping=t2a, - \s!encoding=t2a] - -\installlanguage [russian] [\s!ru] -\installlanguage [ukrainian] [\s!ua] - -%D Labels and header texts. - -\setupheadtext [\s!ru] [ \v!content=\cyrillicS \cyrillico \cyrillicd - \cyrillice \cyrillicr \cyrilliczh - \cyrillica \cyrillicn \cyrillici - \cyrillice] -\setupheadtext [\s!ua] [\v!content=\cyrillicZ \cyrillicm \cyrillicii - \cyrillics \cyrillict] - -\setupheadtext [\s!ru] [\v!tables=\cyrillicS \cyrillicp \cyrillici - \cyrillics \cyrillico \cyrillick - \space \cyrillict \cyrillica - \cyrillicb \cyrillicl \cyrillici - \cyrillicc] -\setupheadtext [\s!ua] [\v!tables=\cyrillicP \cyrillice \cyrillicr - \cyrillice \cyrillicl \cyrillicii - \cyrillick \space \cyrillict - \cyrillica \cyrillicb \cyrillicl - \cyrillici \cyrillicc \cyrillicsftsn] - -\setupheadtext [\s!ru] [\v!figures=\cyrillicS \cyrillicp \cyrillici - \cyrillics \cyrillico \cyrillick - \space \cyrillici \cyrillicl - \cyrillicl \cyrillicyu\cyrillics - \cyrillict \cyrillicr \cyrillica - \cyrillicc \cyrillici \cyrillicishrt] -\setupheadtext [\s!ua] [\v!figures=\cyrillicP \cyrillice \cyrillicr - \cyrillice \cyrillicl \cyrillicii - \cyrillick \space \cyrillicii - \cyrillicl \cyrillicyu\cyrillics - \cyrillict \cyrillicr \cyrillica - \cyrillicc \cyrillicii\cyrillicishrt] - -\setupheadtext [\s!ru] [\v!graphics=\cyrillicS \cyrillicp \cyrillici - \cyrillics \cyrillico \cyrillick - \space \cyrillicg \cyrillicr - \cyrillica \cyrillicf \cyrillici - \cyrillick \cyrillico \cyrillicv] -\setupheadtext [\s!ua] [\v!graphics=\cyrillicP \cyrillice \cyrillicr - \cyrillice \cyrillicl \cyrillicii - \cyrillick \space \cyrillicg - \cyrillicr \cyrillica \cyrillicf - \cyrillicii\cyrillick \cyrillico - \cyrillicv] - -\setupheadtext [\s!ru] [\v!intermezzi=\cyrillicS \cyrillicp \cyrillici - \cyrillics \cyrillico \cyrillick - \space \cyrillicv \cyrillics - \cyrillict \cyrillica \cyrillicv - \cyrillico \cyrillick] -\setupheadtext [\s!ua] [\v!intermezzi=\cyrillicP \cyrillice \cyrillicr - \cyrillice \cyrillicl \cyrillicii - \cyrillick \space \cyrillicv - \cyrillics \cyrillict \cyrillica - \cyrillicv \cyrillico \cyrillick] - -\setupheadtext [\s!ru] [\v!index=\cyrillicA \cyrillicl \cyrillicf - \cyrillica \cyrillicv \cyrillici - \cyrillict \cyrillicn \cyrillicery - \cyrillicishrt \space \cyrillicu - \cyrillick \cyrillica \cyrillicz - \cyrillica \cyrillict \cyrillice - \cyrillicl \cyrillicsftsn] -\setupheadtext [\s!ua] [\v!index=\cyrillicP \cyrillico \cyrillick - \cyrillica \cyrilliczh\cyrillicch - \cyrillici \cyrillick] - -\setupheadtext [\s!ru] [\v!abbreviations=\cyrillicS \cyrillicp \cyrillici - \cyrillics \cyrillico \cyrillick - \space \cyrillics \cyrillico - \cyrillick \cyrillicr \cyrillica - \cyrillicshch \cyrillice - \cyrillicn - \cyrillici \cyrillicishrt] -\setupheadtext [\s!ua] [\v!abbreviations=\cyrillicP \cyrillice \cyrillicr - \cyrillice \cyrillicl \cyrillicii - \cyrillick \space \cyrillics - \cyrillick \cyrillico \cyrillicr - \cyrillico \cyrillicch\cyrillice - \cyrillicn \cyrillicsftsn] - -\setupheadtext [\s!ru] [\v!logos=\cyrillicL \cyrillico \cyrillicg - \cyrillico \cyrillict \cyrillici - \cyrillicp \cyrillicery] -\setupheadtext [\s!ua] [\v!logos=\cyrillicL \cyrillico \cyrillicg - \cyrillico \cyrillict \cyrillici - \cyrillicp \cyrillici] - -\setupheadtext [\s!ru] [\v!units=\cyrillicE \cyrillicd \cyrillici - \cyrillicn \cyrillici \cyrillicc - \cyrillicery \space \cyrillici - \cyrillicz \cyrillicm \cyrillice - \cyrillicr \cyrillice \cyrillicn - \cyrillici \cyrillicya] -\setupheadtext [\s!ua] [\v!units=\cyrillicO \cyrillicd \cyrillici - \cyrillicn \cyrillici \cyrillicc - \cyrillicii\space \cyrillicv - \cyrillici \cyrillicm \cyrillicii - \cyrillicr \cyrillicu] - -\setuplabeltext [\s!ru] [\v!table=\cyrillicT \cyrillica \cyrillicb - \cyrillicl \cyrillici \cyrillicc - \cyrillica \space] -\setuplabeltext [\s!ua] [\v!table=\cyrillicT \cyrillica \cyrillicb - \cyrillicl \cyrillici \cyrillicc - \cyrillicya\space] - -\setuplabeltext [\s!ru] [\v!figure=\cyrillicR \cyrillici \cyrillics - \cyrillicu \cyrillicn \cyrillico - \cyrillick \space] -\setuplabeltext [\s!ua] [\v!figure=\cyrillicM \cyrillica \cyrillicl - \cyrillicyu\cyrillicn \cyrillico - \cyrillick \space] - -\setuplabeltext [\s!ru] [\v!intermezzo=\cyrillicV \cyrillics \cyrillict - \cyrillica \cyrillicv \cyrillick - \cyrillica \space] -\setuplabeltext [\s!ua] [\v!intermezzo=\cyrillicV \cyrillics \cyrillict - \cyrillica \cyrillicv \cyrillick - \cyrillica \space] - -\setuplabeltext [\s!ru] [\v!graphic=\cyrillicG \cyrillicr \cyrillica - \cyrillicf \cyrillici \cyrillick - \space] -\setuplabeltext [\s!ua] [\v!graphic=\cyrillicG \cyrillicr \cyrillica - \cyrillicf \cyrillici \cyrillick - \space] - -\setuplabeltext [\s!ru] [\v!chapter=] -\setuplabeltext [\s!ua] [\v!chapter=] - -\setuplabeltext [\s!ru] [\v!section=] -\setuplabeltext [\s!ua] [\v!section=] - -\setuplabeltext [\s!ru] [\v!subsection=] -\setuplabeltext [\s!ua] [\v!subsection=] - -\setuplabeltext [\s!ru] [\v!subsubsection=] -\setuplabeltext [\s!ua] [\v!subsubsection=] - -\setuplabeltext [\s!ru] [\v!subsubsubsection=] -\setuplabeltext [\s!ua] [\v!subsubsubsection=] - -\setuplabeltext [\s!ru] [\v!appendix=] -\setuplabeltext [\s!ua] [\v!appendix=] - -\setuplabeltext [\s!ru] [\v!part=\cyrillicCH\cyrillica \cyrillics - \cyrillict \cyrillicsftsn - \space] -\setuplabeltext [\s!ua] [\v!part=\cyrillicCH\cyrillica \cyrillics - \cyrillict \cyrillici \cyrillicn - \cyrillica \space] - -\setuplabeltext [\s!ru] [\v!line=\cyrillics \cyrillict \cyrillicr - \cyrillico \cyrillick \cyrillica - \space] -\setuplabeltext [\s!ua] [\v!line=\cyrillicr \cyrillicya\cyrillicd - \cyrillico \cyrillick \space] - -\setuplabeltext [\s!ru] [\v!lines=\cyrillics \cyrillict \cyrillicr - \cyrillico \cyrillick \cyrillici - \space] -\setuplabeltext [\s!ua] [\v!lines=\cyrillicr \cyrillicya\cyrillicd - \cyrillick \cyrillici \space] - -\setuplabeltext [\s!ru] [\v!page=\cyrillics \cyrillict \cyrillicr - \cyrillica \cyrillicn \cyrillici - \cyrillicc \cyrillica \space] -\setuplabeltext [\s!ua] [\v!page=\cyrillics \cyrillict \cyrillico - \cyrillicr \cyrillicii\cyrillicn - \cyrillick \cyrillica \space ] - -\setuplabeltext [\s!ru] [\v!atpage=\cyrillicn \cyrillica \space - \cyrillics \cyrillict \cyrillicr - \cyrillica \cyrillicn \cyrillici - \cyrillicc \cyrillice \space] -\setuplabeltext [\s!ua] [\v!atpage=\cyrillicn \cyrillica \space - \cyrillics \cyrillict \cyrillico - \cyrillicr \cyrillicii\cyrillicn - \cyrillicc \cyrillicii\space ] - -\setuplabeltext [\s!ru] [\v!hencefore=\cyrillics \cyrillicm.\space - \cyrillicv \cyrillicery \cyrillicsh - \cyrillice] -\setuplabeltext [\s!ua] [\v!hencefore=\cyrillicya\cyrillick \space - \cyrillicp \cyrillico \cyrillick - \cyrillica \cyrillicz \cyrillica - \cyrillicn \cyrillico \space - \cyrillicv \cyrillici \cyrillicshch - \cyrillice] - -\setuplabeltext [\s!ru] [\v!hereafter=\cyrillics \cyrillicm.\space - \cyrillicn \cyrillici \cyrilliczh - \cyrillice] -\setuplabeltext [\s!ua] [\v!hereafter=\cyrillicya\cyrillick \space - \cyrillicp \cyrillico \cyrillick - \cyrillica \cyrillicz \cyrillica - \cyrillicn \cyrillico \space - \cyrillicn \cyrillici \cyrilliczh - \cyrillicch\cyrillice] - -\setuplabeltext [\s!ru] [\v!see=\cyrillics \cyrillicm.\space] -\setuplabeltext [\s!ua] [\v!see=\cyrillicd \cyrillici - \cyrillicv.\space ] - -\setuplabeltext [\s!ru] [\v!january=\cyrillicya\cyrillicn \cyrillicv - \cyrillica \cyrillicr \cyrillicya] -\setuplabeltext [\s!ru] [\v!february=\cyrillicf \cyrillice \cyrillicv - \cyrillicr \cyrillica \cyrillicl - \cyrillicya] -\setuplabeltext [\s!ru] [\v!march=\cyrillicm \cyrillica \cyrillicr - \cyrillict \cyrillica] -\setuplabeltext [\s!ru] [\v!april=\cyrillica \cyrillicp \cyrillicr - \cyrillice \cyrillicl \cyrillicya] -\setuplabeltext [\s!ru] [\v!may=\cyrillicm \cyrillica \cyrillicya] -\setuplabeltext [\s!ru] [\v!june=\cyrillici \cyrillicyu\cyrillicn - \cyrillicya] -\setuplabeltext [\s!ru] [\v!july=\cyrillici \cyrillicyu\cyrillicl - \cyrillicya] -\setuplabeltext [\s!ru] [\v!august=\cyrillica \cyrillicv \cyrillicg - \cyrillicu \cyrillics \cyrillict - \cyrillica] -\setuplabeltext [\s!ru] [\v!september=\cyrillics \cyrillice \cyrillicn - \cyrillict \cyrillicya\cyrillicb - \cyrillicr \cyrillicya] -\setuplabeltext [\s!ru] [\v!october=\cyrillico \cyrillick \cyrillict - \cyrillicya\cyrillicb \cyrillicr - \cyrillicya] -\setuplabeltext [\s!ru] [\v!november=\cyrillicn \cyrillico \cyrillicya - \cyrillicb \cyrillicr \cyrillicya] -\setuplabeltext [\s!ru] [\v!december=\cyrillicd \cyrillice \cyrillick - \cyrillica \cyrillicb \cyrillicr - \cyrillicya] - -\setuplabeltext [\s!ua] [\v!january=\cyrillics \cyrillicii\cyrillicch - \cyrillicn \cyrillicya] -\setuplabeltext [\s!ua] [\v!february=\cyrillicl \cyrillicyu\cyrillict - \cyrillico \cyrillicg \cyrillico] -\setuplabeltext [\s!ua] [\v!march=\cyrillicb \cyrillice \cyrillicr - \cyrillice \cyrillicz \cyrillicn - \cyrillicya] -\setuplabeltext [\s!ua] [\v!april=\cyrillick \cyrillicv \cyrillicii - \cyrillict \cyrillicn \cyrillicya] -\setuplabeltext [\s!ua] [\v!may=\cyrillict \cyrillicr \cyrillica - \cyrillicv \cyrillicn \cyrillicya] -\setuplabeltext [\s!ua] [\v!june=\cyrillicch\cyrillice \cyrillicr - \cyrillicv \cyrillicn \cyrillicya] -\setuplabeltext [\s!ua] [\v!july=\cyrillicl \cyrillici \cyrillicp - \cyrillicn \cyrillicya] -\setuplabeltext [\s!ua] [\v!august=\cyrillics \cyrillice \cyrillicr - \cyrillicp \cyrillicn \cyrillicya] -\setuplabeltext [\s!ua] [\v!september=\cyrillicv \cyrillice \cyrillicr - \cyrillice \cyrillics \cyrillicn - \cyrillicya] -\setuplabeltext [\s!ua] [\v!october=\cyrilliczh\cyrillico \cyrillicv - \cyrillict \cyrillicn \cyrillicya] -\setuplabeltext [\s!ua] [\v!november=\cyrillicl \cyrillici \cyrillics - \cyrillict \cyrillico \cyrillicp - \cyrillica \cyrillicd \cyrillica] -\setuplabeltext [\s!ua] [\v!december=\cyrillicg \cyrillicr \cyrillicu - \cyrillicd \cyrillicn \cyrillicya] - -\setuplabeltext [\s!ru] [\v!sunday=\cyrillicv \cyrillico \cyrillics - \cyrillick \cyrillicr \cyrillice - \cyrillics \cyrillice \cyrillicn - \cyrillicsftsn \cyrillice] -\setuplabeltext [\s!ru] [\v!monday=\cyrillicp \cyrillico \cyrillicn - \cyrillice \cyrillicd \cyrillice - \cyrillicl \cyrillicsftsn - \cyrillicn \cyrillici \cyrillick] -\setuplabeltext [\s!ru] [\v!tuesday=\cyrillicv \cyrillict \cyrillico - \cyrillicr \cyrillicn \cyrillici - \cyrillick] -\setuplabeltext [\s!ru] [\v!wednesday=\cyrillics \cyrillicr \cyrillice - \cyrillicd \cyrillica] -\setuplabeltext [\s!ru] [\v!thursday=\cyrillicch\cyrillice \cyrillict - \cyrillicv \cyrillice \cyrillicr - \cyrillicg] -\setuplabeltext [\s!ru] [\v!friday=\cyrillicp \cyrillicya\cyrillict - \cyrillicn \cyrillici \cyrillicc - \cyrillica] -\setuplabeltext [\s!ru] [\v!saturday=\cyrillics \cyrillicu \cyrillicb - \cyrillicb \cyrillico \cyrillict - \cyrillica] - -\setuplabeltext [\s!ua] [\v!sunday=\cyrillicn \cyrillice \cyrillicd - \cyrillicii\cyrillicl \cyrillicya] -\setuplabeltext [\s!ua] [\v!monday=\cyrillicp \cyrillico \cyrillicn - \cyrillice \cyrillicd \cyrillicii - \cyrillicl \cyrillico \cyrillick] -\setuplabeltext [\s!ua] [\v!tuesday=\cyrillicv \cyrillicii\cyrillicv - \cyrillict \cyrillico \cyrillicr - \cyrillico \cyrillick] -\setuplabeltext [\s!ua] [\v!wednesday=\cyrillics \cyrillice \cyrillicr - \cyrillice \cyrillicd \cyrillica] -\setuplabeltext [\s!ua] [\v!thursday=\cyrillicch\cyrillice \cyrillict - \cyrillicv \cyrillice \cyrillicr] -\setuplabeltext [\s!ua] [\v!friday=\cyrillicp'\cyrillicya\cyrillict - \cyrillicn \cyrillici \cyrillicc - \cyrillicya] -\setuplabeltext [\s!ua] [\v!saturday=\cyrillics \cyrillicu \cyrillicb - \cyrillico \cyrillict \cyrillica] - - -%D \ShowAllLanguageValues [\s!ru] [russian] {Russian} {doll} -%D \ShowAllLanguageValues [\s!ua] [ukranian] {Ukranian} {dance} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-def.lua b/Master/texmf-dist/tex/context/base/lang-def.lua new file mode 100644 index 00000000000..78c8eecbdd9 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lang-def.lua @@ -0,0 +1,416 @@ +if not modules then modules = { } end modules ['lang-ini'] = { + version = 1.001, + comment = "companion to lang-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local lower = string.lower + +languages = languages or { } +local languages = languages +local data = languages.data + +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex + +-- The specifications are based on an analysis done by Arthur. The +-- names of tags were changed by Hans. The data is not yet used but +-- will be some day. +-- +-- description +-- +-- The description is only meant as an indication; for example 'no' is +-- "Norwegian, undetermined" because that's really what it is. +-- +-- script +-- +-- This is the 4-letter script tag according to ISO 15924, the +-- official standard. +-- +-- bibliographical and terminological +-- +-- Then we have *two* ISO-639 3-letter tags: one is supposed to be used +-- for "bibliographical" purposes, the other for "terminological". The +-- first one is quite special (and mostly used in American libraries), +-- and the more interesting one is the other (apparently it's that one +-- we find everywhere). +-- +-- context +-- +-- These are the ones used in ConteXt. Kind of numberplate ones. +-- +-- opentype +-- +-- This is the 3-letter OpenType language tag, obviously. +-- +-- variant +-- +-- This is actually the rfc4646: an extension of ISO-639 that also defines +-- codes for variants like de-1901 for "German, 1901 orthography" or zh-Hans for +-- "Chinese, simplified characters" ('Hans' is the ISO-15924 tag for +-- "HAN ideographs, Simplified" :-) As I said yesterday, I think this +-- should be the reference since it's exactly what we want: it's really +-- standard (it's a RFC) and it's more than simply languages. To my +-- knowledge this is the only system that addresses this issue. +-- +-- Warning: it's not unique! Because we have two "German" languages +-- (and could, potentially, have two Chinese, etc.) +-- +-- Beware: the abbreviations are lowercased, which makes it more +-- convenient to use them. +-- +-- todo: add default features + +local specifications = allocate { + { + ["description"] = "Basque", + ["script"] = "latn", + ["bibliographical"] = "baq", + ["terminological"] = "eus", + ["context"] = "ba", + ["opentype"] = "euq", + ["variant"] = "eu", + }, + { + ["description"] = "Welsh", + ["script"] = "latn", + ["bibliographical"] = "wel", + ["terminological"] = "cym", + ["context"] = "cy", + ["opentype"] = "wel", + ["variant"] = "cy", + }, + { + ["description"] = "Icelandic", + ["script"] = "latn", + ["bibliographical"] = "ice", + ["terminological"] = "isl", + ["context"] = "is", + ["opentype"] = "isl", + ["variant"] = "is", + }, + { + ["description"] = "Norwegian, undetermined", + ["script"] = "latn", + ["bibliographical"] = "nor", + ["terminological"] = "nor", + ["context"] = "no", + ["variant"] = "no", + }, + { + ["description"] = "Norwegian bokmal", + ["script"] = "latn", + ["bibliographical"] = "nob", + ["terminological"] = "nob", + ["opentype"] = "nor", -- not sure! + ["variant"] = "nb", + }, + { + ["description"] = "Norwegian nynorsk", + ["script"] = "latn", + ["bibliographical"] = "nno", + ["terminological"] = "nno", + ["opentype"] = "nny", + ["variant"] = "nn", + }, + { + ["description"] = "Ancient Greek", + ["script"] = "grek", + ["bibliographical"] = "grc", + ["terminological"] = "grc", + ["context"] = "agr", + ["variant"] = "grc", + }, + { + ["description"] = "German, 1901 orthography", + ["script"] = "latn", + ["terminological"] = "deu", + ["context"] = "deo", + ["opentype"] = "deu", + ["variant"] = "de-1901", + }, + { + ["description"] = "German, 1996 orthography", + ["script"] = "latn", + ["bibliographical"] = "ger", + ["terminological"] = "deu", + ["context"] = "de", + ["opentype"] = "deu", + ["variant"] = "de-1996", + }, + { + ["description"] = "Afrikaans", + ["script"] = "latn", + ["bibliographical"] = "afr", + ["terminological"] = "afr", + ["context"] = "af", + ["opentype"] = "afk", + ["variant"] = "af", + }, + { + ["description"] = "Catalan", + ["script"] = "latn", + ["bibliographical"] = "cat", + ["terminological"] = "cat", + ["context"] = "ca", + ["opentype"] = "cat", + ["variant"] = "ca", + }, + { + ["description"] = "Czech", + ["script"] = "latn", + ["bibliographical"] = "cze", + ["terminological"] = "ces", + ["context"] = "cz", + ["opentype"] = "csy", + ["variant"] = "cs", + }, + { + ["description"] = "Greek", + ["script"] = "grek", + ["bibliographical"] = "gre", + ["terminological"] = "ell", + ["context"] = "gr", + ["opentype"] = "ell", + ["variant"] = "el", + }, + { + ["description"] = "American English", + ["script"] = "latn", + ["bibliographical"] = "eng", + ["terminological"] = "eng", + ["context"] = "us", + ["opentype"] = "eng", + ["variant"] = "en-US", + }, + { + ["description"] = "British English", + ["script"] = "latn", + ["bibliographical"] = "eng", + ["terminological"] = "eng", + ["context"] = "uk", + ["opentype"] = "eng", + ["variant"] = "en-UK", -- Could be en-GB as well ... + }, + { + ["description"] = "Spanish", + ["script"] = "latn", + ["bibliographical"] = "spa", + ["terminological"] = "spa", + ["context"] = "es", + ["opentype"] = "esp", + ["variant"] = "es", + }, + { + ["description"] = "Finnish", + ["script"] = "latn", + ["bibliographical"] = "fin", + ["terminological"] = "fin", + ["context"] = "fi", + ["opentype"] = "fin", + ["variant"] = "fi", + }, + { + ["description"] = "French", + ["script"] = "latn", + ["bibliographical"] = "fre", + ["terminological"] = "fra", + ["context"] = "fr", + ["opentype"] = "fra", + ["variant"] = "fr", + }, + { + ["description"] = "Croatian", + ["script"] = "latn", + ["bibliographical"] = "scr", + ["terminological"] = "hrv", + ["context"] = "hr", + ["opentype"] = "hrv", + ["variant"] = "hr", + }, + { + ["description"] = "Hungarian", + ["script"] = "latn", + ["bibliographical"] = "hun", + ["terminological"] = "hun", + ["context"] = "hu", + ["opentype"] = "hun", + ["variant"] = "hu", + }, + { + ["description"] = "Italian", + ["script"] = "latn", + ["bibliographical"] = "ita", + ["terminological"] = "ita", + ["context"] = "it", + ["opentype"] = "ita", + ["variant"] = "it", + }, + { + ["description"] = "Japanese", + ["script"] = "jpan", + ["bibliographical"] = "jpn", + ["terminological"] = "jpn", + ["context"] = "ja", + ["opentype"] = "jan", + ["variant"] = "ja", + }, + { + ["description"] = "Latin", + ["script"] = "latn", + ["bibliographical"] = "lat", + ["terminological"] = "lat", + ["context"] = "la", + ["opentype"] = "lat", + ["variant"] = "la", + }, + { + ["description"] = "Portuguese", + ["script"] = "latn", + ["bibliographical"] = "por", + ["terminological"] = "por", + ["context"] = "pt", + ["opentype"] = "ptg", + ["variant"] = "pt", + }, + { + ["description"] = "Polish", + ["script"] = "latn", + ["bibliographical"] = "pol", + ["terminological"] = "pol", + ["context"] = "pl", + ["opentype"] = "plk", + ["variant"] = "pl", + }, + { + ["description"] = "Romanian", + ["script"] = "latn", + ["bibliographical"] = "rum", + ["terminological"] = "ron", + ["context"] = "ro", + ["opentype"] = "rom", + ["variant"] = "ro", + }, + { + ["description"] = "Russian", + ["script"] = "cyrl", + ["bibliographical"] = "rus", + ["terminological"] = "rus", + ["context"] = "ru", + ["opentype"] = "rus", + ["variant"] = "ru", + }, + { + ["description"] = "Slovak", + ["script"] = "latn", + ["bibliographical"] = "slo", + ["terminological"] = "slk", + ["context"] = "sk", + ["opentype"] = "sky", + ["variant"] = "sk", + }, + { + ["description"] = "Slovenian", + ["script"] = "latn", + ["bibliographical"] = "slv", + ["terminological"] = "slv", + ["context"] = "sl", + ["opentype"] = "slv", + ["variant"] = "sl", + }, + { + ["description"] = "Swedish", + ["script"] = "latn", + ["bibliographical"] = "swe", + ["terminological"] = "swe", + ["context"] = "sv", + ["opentype"] = "sve", + ["variant"] = "sv", + }, + { + ["description"] = "Turkish", + ["script"] = "latn", + ["bibliographical"] = "tur", + ["terminological"] = "tur", + ["context"] = "tr", + ["opentype"] = "trk", + ["variant"] = "tr", + }, + { + ["description"] = "Vietnamese", + ["script"] = "latn", + ["bibliographical"] = "vie", + ["terminological"] = "vie", + ["context"] = "vn", + ["opentype"] = "vit", + ["variant"] = "vi", + }, + { + ["description"] = "Chinese, simplified", + ["script"] = "hans", + ["opentype-script"] = "hani", + ["bibliographical"] = "chi", + ["terminological"] = "zho", + ["context"] = "cn", + ["opentype"] = "zhs", + ["variant"] = "zh-hans", + }, +} + +data.specifications = specifications + +local variants = { } data.variants = variants +local opentypes = { } data.opentypes = opentypes +local contexts = { } data.contexts = contexts +local records = { } data.records = records + +for k=1,#specifications do + local v = specifications[k] + if v.variant then + variants[v.variant] = v + end + if v.opentype then + opentypes[v.opentype] = v + end + local vc = v.context + if vc then + if type(vc) == "table" then + for k=1,#vc do + contexts[v] = vc[k] + end + else + contexts[vc] = v + end + end +end + +setmetatableindex(variants, function(t,k) + str = lower(str) + local v = (l_variant[str] or l_opentype[str] or l_context[str] or l_variant.en).language + t[k] = v + return v +end) + +setmetatableindex(opentypes, function(t,k) + str = lower(str) + local v = (l_variant[str] or l_opentype[str] or l_context[str] or l_variant.en).opentype + t[k] = v + return v +end) + +setmetatableindex(contexts, function(t,k) + str = lower(str) + local v = (l_variant[str] or l_opentype[str] or l_context[str] or l_variant[languages.default]).context + v = (type(v) == "table" and v[1]) or v + t[k] = v + return v +end) + +setmetatableindex(records, function(t,k) -- how useful is this one? + str = lower(str) + local v = variants[str] or opentypes[str] or contexts[str] or variants.en + t[k] = v + return v +end) diff --git a/Master/texmf-dist/tex/context/base/lang-def.mkiv b/Master/texmf-dist/tex/context/base/lang-def.mkiv new file mode 100644 index 00000000000..359006fefb4 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lang-def.mkiv @@ -0,0 +1,689 @@ +%D \module +%D [ file=lang-def, +%D version=2011.01.24, % merge of language files +%D title=\CONTEXT\ Language Macros, +%D subtitle=Languages Definitions, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{ConTeXt Language Macros / Definitions} + +%D See \type {lang-*.tex} for some historic notes. + +\unprotect + +% Germanic Languages: Danish, Faeroese, Icelandic, Norwegian, +% Swedish, German, Yiddish, Afrikaans, Dutch, English, Flemush, +% Frisian, Plattdeutsch + +\installlanguage + [\s!nl] + [\c!spacing=\v!packed, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\lowerleftsingleninequote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\lowerleftdoubleninequote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!day,\space,\v!month,\space,\v!year}] + +\installlanguage + [\s!en] + [\c!spacing=\v!broad, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!month,\space,\v!day,{,\space},\v!year}, + \s!patterns=\s!us, + \s!lefthyphenmin=2, + \s!righthyphenmin=3] + +\installlanguage + [\s!de] + [\c!spacing=\v!packed, + \s!lefthyphenmin=3, + \s!righthyphenmin=3, + \c!leftsentence=\hbox{\endash\space}, + \c!rightsentence=\hbox{\space\endash}, + \c!leftsubsentence=\endash, + \c!rightsubsentence=\endash, + \c!leftquote=\lowerleftsingleninequote, + \c!rightquote=\upperrightsinglesixquote, + \c!leftquotation=\lowerleftdoubleninequote, + \c!rightquotation=\upperrightdoublesixquote, + \c!date={\v!day,{.\space},\v!month,\space,\v!year}] + +\installlanguage + [\s!da] + [\c!spacing=\v!packed, + \c!leftsentence={\hbox{\endash\enskip}}, + \c!rightsentence={\hbox{\enskip\endash}}, + \c!leftsubsentence=\endash, + \c!rightsubsentence=\endash, + \c!leftquote=\lowerleftsingleninequote, + \c!rightquote=\upperrightsinglesixquote, + \c!leftquotation=\lowerleftdoubleninequote, + \c!rightquotation=\upperrightdoublesixquote, + \c!date={\v!day,{.\space},\v!month,\space,\v!year}] + +\installlanguage + [\s!sv] + [\c!spacing=\v!packed, + \c!leftsentence=\hbox{\endash\space}, + \c!rightsentence=\hbox{\space\endash}, + \c!leftsubsentence=\endash, + \c!rightsubsentence=\endash, + \c!leftquote=\upperrightsingleninequote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperrightdoubleninequote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!day,\space,\v!month,\space,\v!year}] + +\installlanguage + [\s!af] + [\c!spacing=\v!packed, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!year,\space,\v!month,\space,\v!day}] + +\installlanguage + [\s!nb] + [spacing=packed, + lefthyphenmin=2, + righthyphenmin=2, + leftsentence=\emdash, + rightsentence=\emdash, + leftsubsentence=\emdash, + rightsubsentence=\emdash, + leftquote=\upperleftsinglesixquote, + rightquote=\upperrightsingleninequote, + leftquotation=\leftguillemot, + rightquotation=\rightguillemot, + date={day,{.},\space,month,\space,year}] + +\installlanguage + [\s!nn] + [spacing=packed, + lefthyphenmin=2, + righthyphenmin=2, + leftsentence=\emdash, + rightsentence=\emdash, + leftsubsentence=\emdash, + rightsubsentence=\emdash, + leftquote=\upperleftsinglesixquote, + rightquote=\upperrightsingleninequote, + leftquotation=\leftguillemot, + rightquotation=\rightguillemot, + date={day,{.},\space,month,\space,year}] + + +\installlanguage [\s!no] [\s!nb] +\installlanguage [\s!norwegian] [\s!nb] +\installlanguage [\s!bokmal] [\s!nb] +\installlanguage [\s!nynorsk] [\s!nn] + +\installlanguage % old german + [deo] + [\c!spacing=\v!packed, + \c!default=\s!de] + +\installlanguage + [de-de] + [\c!spacing=\v!packed, + \c!default=\s!de] + +\installlanguage + [de-at] + [\c!spacing=\v!packed, + \c!default=\s!de, + \c!leftquote=\leftguillemot, + \c!rightquote=\rightguillemot, + \c!leftquotation=\leftguillemot, + \c!rightquotation=\rightguillemot] + +\installlanguage + [de-ch] + [\c!spacing=\v!packed, + \c!default=\s!de] + +%D And some alternative (but very real) english patterns: + +\installlanguage + [en-gb] + [\c!default=\s!en, + \s!patterns=\s!gb, + \s!lefthyphenmin=3, + \s!righthyphenmin=3] + +\installlanguage + [en-us] + [\c!default=\s!en, + \s!patterns=\s!us] + +\installlanguage [\s!uk] [\s!en-\s!gb] +\installlanguage [\s!us] [\s!en-\s!us] + +\installlanguage [usenglish] [\s!en-\s!us] +\installlanguage [ukenglish] [\s!en-\s!gb] +\installlanguage [english] [\s!en] +\installlanguage [dutch] [\s!nl] +\installlanguage [german] [\s!de] +\installlanguage [danish] [\s!da] +\installlanguage [swedish] [\s!sv] +\installlanguage [afrikaans] [\s!af] + +% Slavic Languages: Belarussian, Russian, Ukrainian, Bulgarian, +% Macedonian, Serbian, Croatian, Slovenian, Czech, Kushubian, +% Lusatian/Sorbian/Wendish, Polish, Slovak, Albanian, Illyrian, +% Armenian + +\installlanguage + [\s!pl] + [\c!spacing=\v!packed, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\lowerleftsingleninequote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\lowerleftdoubleninequote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!day,{.\space},\v!month,\space,\v!year}] + +\installlanguage + [\s!cs] + [\c!spacing=\v!packed, + \c!leftsentence={\thickglue\endash\thickglue\penalty-20\relax}, + \c!rightsentence={\thickglue\endash\thickglue\penalty-20\relax}, + \c!leftsubsentence={\nobreakspace\emdash\nobreakspace\penalty-20\relax}, + \c!rightsubsentence={\nobreakspace\emdash\nobreakspace\penalty-20\relax}, + \c!leftquote=\lowerleftsingleninequote, + \c!rightquote=\upperrightsinglesixquote, + \c!leftquotation=\lowerleftdoubleninequote, + \c!rightquotation=\upperrightdoublesixquote, + \c!date={\v!day,{.\thinspace},\v!month,\space,\v!year}] + +\installlanguage + [\s!sk] + [\c!spacing=\v!packed, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!day,{.\thinspace},\v!month,\space,\v!year}] + +\installlanguage + [\s!hr] + [\c!spacing=\v!packed, + \c!leftsentence=\hbox{\endash\space}, + \c!rightsentence=\hbox{\space\endash}, + \c!leftsubsentence=\endash, + \c!rightsubsentence=\endash, + \c!leftquote=\lowerleftsingleninequote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\lowerleftdoubleninequote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!day,{.},\space,\v!month,\space,\v!year}] + +\installlanguage + [\s!sl] + [\c!spacing=\v!packed, + \c!leftsentence=\hbox{\endash\space}, + \c!rightsentence=\hbox{\space\endash}, + \c!leftsubsentence=\endash, + \c!rightsubsentence=\endash, + \c!leftquote=\guilsingleright, + \c!rightquote=\guilsingleleft, + \c!leftquotation=\rightguillemot, + \c!rightquotation=\leftguillemot, + \c!date={\v!day,{.},\space,\v!month,\space,\v!year}] + +\installlanguage [polish] [\s!pl] +\installlanguage [czech] [\s!cs] +\installlanguage [slovak] [\s!sk] +\installlanguage [croatian] [\s!hr] +\installlanguage [slovenian] [\s!sl] +\installlanguage [slovene] [\s!sl] % both possible (mojca: still needed?) + +\installlanguage [cz] [\s!cs] + +\def\doconvertsloveniancharacters{\dodoconvertcharacters{25}} + +\def\sloveniancharacters{\doconvertsloveniancharacters\sloveniancharacter} +\def\slovenianCharacters{\doconvertsloveniancharacters\slovenianCharacter} + +%D Define general-purpose macros for Slovenian character enumerations: + +\defineconversion [sloveniancharacter] [\sloveniancharacter] +\defineconversion [slovenianCharacter] [\slovenianCharacter] + +\defineconversion [sloveniancharacters] [\sloveniancharacters] +\defineconversion [slovenianCharacters] [\slovenianCharacters] + +%D Define these as the general character enumeration when +%D language is Slovenian. If you feel uncomfortable with this, +%D mail Mojca, since she promised to to take the heat. + +\defineconversion [sl] [character] [\sloveniancharacter] +\defineconversion [sl] [Character] [\slovenianCharacter] + +\defineconversion [sl] [characters] [\sloveniancharacters] +\defineconversion [sl] [Characters] [\slovenianCharacters] + +\defineconversion [sl] [a] [\sloveniancharacters] +\defineconversion [sl] [A] [\slovenianCharacters] +\defineconversion [sl] [AK] [\smallcapped\sloveniancharacters] +\defineconversion [sl] [KA] [\smallcapped\sloveniancharacters] + +\def\sloveniancharacters#1{\ctxcommand{alphabetic(\number#1,"sl")}} +\def\slovenianCharacters#1{\ctxcommand{Alphabetic(\number#1,"sl")}} + +% Cyrillic Languages + +\installlanguage + [\s!ru] + [\s!lefthyphenmin=2, + \s!righthyphenmin=2, + \c!spacing=\v!packed, + \c!leftsentence=\leftguillemot, + \c!rightsentence=\rightguillemot, + \c!leftsubsentence=\lowerleftdoubleninequote, + \c!rightsubsentence=\upperrightdoubleninequote, + \c!leftquote=\lowerleftdoubleninequote, + \c!rightquote=\upperrightdoubleninequote, + \c!leftquotation=\leftguillemot, + \c!rightquotation=\rightguillemot, + \c!date={\v!day,\space,\v!month,\space,\v!year}] + +\installlanguage + [\s!ua] + [\s!lefthyphenmin=2, + \s!righthyphenmin=2, + \c!spacing=\v!packed, + \c!leftsentence=\leftguillemot, + \c!rightsentence=\rightguillemot, + \c!leftsubsentence=\lowerleftdoubleninequote, + \c!rightsubsentence=\upperrightdoubleninequote, + \c!leftquote=\lowerleftdoubleninequote, + \c!rightquote=\upperrightdoubleninequote, + \c!leftquotation=\leftguillemot, + \c!rightquotation=\rightguillemot, + \c!date={\v!day,\space,\v!month,\space,\v!year}, + \s!patterns=\s!uk] + +\installlanguage [russian] [\s!ru] +\installlanguage [ukrainian] [\s!ua] + +% Uralic Languages: Cheremiss, Estonian, Finnish, Karelian, Laap, +% Mordvinian, Permian tongues, Hungarian, Ostyak, Vogul, Samoyed + +\installlanguage + [\s!fi] + [\c!spacing=\v!packed, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!year,\space,\v!month,\space,\v!day}] + +\installlanguage + [\s!hu] + [\c!spacing=\v!packed, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\lowerleftsingleninequote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\lowerleftdoubleninequote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!year,.,\space,\v!month,\space,\v!day,.}] + +\installlanguage [finish] [\s!fi] +\installlanguage [hungarian] [\s!hu] + +% Altaic Languages: Uigur, Uzbek, Azeri/Azerbaijani, Chuvash, +% Turkish, Turkmen, Kazakh, Kazar, Kireghiz, Noghay, Talar, +% Buryat, Kalmuck, Khalkha + +\installlanguage + [\s!tr] + [\c!spacing=\v!packed, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!year,\space,\v!month,\space,\v!day}] + +\installlanguage + [\s!tk] + [\c!spacing=\v!broad, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!year,\space,\v!month,\space,\v!day} + \s!patterns=\s!tk, + \s!lefthyphenmin=1, + \s!righthyphenmin=2] + +\installlanguage [turkish] [\s!tr] +\installlanguage [turkmen] [\s!tk] + +% Anatolian Languages + +% Arabic Languages + +\definesystemconstant {arabic} +\definesystemvariable {ar} + +\installlanguage + [\s!ar] + [\c!spacing=\v!broad, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!day,\space,\v!month,{،\space},\v!year}] + +\installlanguage [\s!arabic] [\s!ar] + +% Just aliases to "ar" for now + +\installlanguage[\s!ar-ae][\c!default=\s!ar] % U.A.E. +\installlanguage[\s!ar-bh][\c!default=\s!ar] % Bahrain +\installlanguage[\s!ar-eg][\c!default=\s!ar] % Egypt +\installlanguage[\s!ar-in][\c!default=\s!ar] % India? +\installlanguage[\s!ar-kw][\c!default=\s!ar] % Kuwait +\installlanguage[\s!ar-ly][\c!default=\s!ar] % Libya +\installlanguage[\s!ar-om][\c!default=\s!ar] % Oman +\installlanguage[\s!ar-qa][\c!default=\s!ar] % Qatar +\installlanguage[\s!ar-sa][\c!default=\s!ar] % Saudi Arabia +\installlanguage[\s!ar-sd][\c!default=\s!ar] % Sudan +\installlanguage[\s!ar-tn][\c!default=\s!ar] % Tunisia +\installlanguage[\s!ar-ye][\c!default=\s!ar] % Yemen + +% Syriac months + +\installlanguage[\s!ar-sy][\c!default=\s!ar] % Syria +\installlanguage[\s!ar-iq][\c!default=\s!ar-sy] % Iraq +\installlanguage[\s!ar-jo][\c!default=\s!ar-sy] % Jordan +\installlanguage[\s!ar-lb][\c!default=\s!ar-sy] % Lebanon + +% Maghribi months + +\installlanguage[\s!ar-dz][\c!default=\s!ar] % Algeria +\installlanguage[\s!ar-ma][\c!default=\s!ar] % Morocco + +% Artificial Languages: Esperanto + +% Baltic Languages: Lettish/Latvian, Lietuvių/Lithuanian + +\installlanguage + [\s!lt] + [\c!spacing=\v!packed, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\lowerleftdoubleninequote, + \c!rightquote=\upperrightdoublesixquote, + \c!leftquotation=\lowerleftdoubleninequote, + \c!rightquotation=\upperrightdoublesixquote, + \c!date={\v!year,~m.,\space,\v!month,\space,\v!day,~d.}, + \s!patterns=\s!lt, + \s!lefthyphenmin=2, + \s!righthyphenmin=2] + +\installlanguage [lithuanian] [\s!lt] + +% Celtic: Breton, Welsh, Irish, Manx, Scottish Gaelic + +% CJK + +\definesystemconstant {chinese} \definesystemconstant {cn} +\definesystemconstant {japanese} \definesystemconstant {ja} +\definesystemconstant {korean} \definesystemconstant {kr} + +\installlanguage + [\s!cn] + [\c!leftsentence=——, + \c!rightsentence=——, + \c!leftsubsentence=——, + \c!rightsubsentence=——, + \c!leftquote=‘, + \c!rightquote=’, + \c!leftquotation=“, + \c!rightquotation=”, + \c!date={\v!year,年,\space,\v!month,\v!day,日}] + +\installlanguage + [\s!ja] + [\c!leftsentence=——, + \c!rightsentence=——, + \c!leftsubsentence=——, + \c!rightsubsentence=——, + \c!leftquote=‘, + \c!rightquote=’, + \c!leftquotation=「, + \c!rightquotation=」, + \c!date={西暦,\v!year,年,\v!month,月,\v!day,日}] + +\installlanguage + [\s!kr] + [\c!leftsentence=——, + \c!rightsentence=——, + \c!leftsubsentence=——, + \c!rightsubsentence=——, + \c!leftquote=‘, + \c!rightquote=’, + \c!leftquotation=“, + \c!rightquotation=”, + \c!date={서기,\v!year,년,\v!month,월,\v!day,일}] + +% Greek + +\installlanguage + [\s!gr] + [\c!spacing=\v!packed, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\greekleftquot, + \c!rightquote=\greekrightquot, + \c!leftquotation=\greekleftquot, + \c!rightquotation=\greekrightquot, + \c!date={\v!day\space\v!month\space\v!year}, + \s!patterns=\s!agr] % ok? + +\installlanguage [greek] [\s!gr] + +\installlanguage + [\s!agr] + [\s!default=\s!gr, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote] + +\installlanguage [ancientgreek] [\s!agr] +\installlanguage [grk] [\s!agr] + +% Indo-Iranian Languages: 34. + +% Italic Languages: Latin, Italian, Rhaeto-Romanic, Rumanian, +% Sardian, Catalan, French, Ladino, Portuguese, Proven\c{c}al, +% Spanish + +\ifx\guillemotspace\undefined \let\guillemotspace\empty \fi +\ifx\sentencespace \undefined \let\sentencespace \empty \fi + +\installlanguage + [\s!fr] + [\c!spacing=\v!packed, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\leftguillemot, + \c!rightquote=\rightguillemot, + \c!leftquotation=\leftguillemot, + \c!rightquotation=\rightguillemot, + \c!date={\v!day+,\v!space,\v!month,\v!space,\v!year}] + +\installlanguage + [\s!es] + [\c!spacing=\v!packed, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!day,\space,\v!month,\space,\v!year}] + +\installlanguage [sp] [\s!es] % old times context + +\installlanguage + [\s!ca] + [\c!spacing=\v!packed, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!day,\space,\v!month,\space,\v!year}] + +% Note GB left|/|right (sub)sentences are for \quote {incisi}. + +\installlanguage + [\s!it] + [\c!spacing=\v!packed, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\endash, + \c!rightsubsentence=\endash, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!leftspeech=\leftguillemot, + \c!middlespeech=\leftguillemot, + \c!rightspeech=\rightguillemot, + \c!date={\v!day,\space,\v!month,\space,\v!year}] + +\installlanguage % the same as italian + [\s!la] + [\c!spacing=\v!packed, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!day,\space,\v!month,\space,\v!year}] + +\installlanguage + [\s!pt] + [\c!spacing=\v!packed, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!year,\space,\v!month,\space,\v!day}] + +\installlanguage + [\s!ro] + [\c!spacing=\v!packed, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\leftguillemot, + \c!rightquote=\rightguillemot, + \c!leftquotation=\lowerrightdoubleninequote, + \c!rightquotation=\upperleftdoublesixquote, + \c!date={\v!day,\space,\v!month,\space,\v!year}] + +%D For compatibility reasons we also define: + +\installlanguage [fa] [\s!fr] % for dutchies only + +\installlanguage [french] [\s!fr] +\installlanguage [spanish] [\s!es] +\installlanguage [catalan] [\s!ca] +\installlanguage [italian] [\s!it] +\installlanguage [latin] [\s!la] +\installlanguage [portuguese] [\s!pt] +\installlanguage [romanian] [\s!ro] + +\defineconversion [\s!fr] [\v!day+] [\frordinaldaynumber] + +% Vietnamese Language + +\installlanguage + [\s!vi] + [\c!spacing=\v!packed, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\quoteleft, + \c!rightquote=\quoteright, + \c!leftquotation=\quotedblleft, + \c!rightquotation=\quotedblright, + \c!date={{ },dd,{/},mm,{/},yy}] + +\installlanguage [vietnamese] [\s!vi] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-frd.mkii b/Master/texmf-dist/tex/context/base/lang-frd.mkii new file mode 100644 index 00000000000..6cc27080b78 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lang-frd.mkii @@ -0,0 +1,140 @@ +%D \module +%D [ file=lang-frd, +%D version=2004.01.15, +%D title=\CONTEXT\ Language Macros, +%D subtitle=Language Frequency Table 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. + +%D This is expewrimental work! + +% http://www.onzetaal.nl/advies/letterfreq.html + +\startcharactertable[nl] + \charfreq a 7.47 + \charfreq b 1.58 + \charfreq c 1.24 + \charfreq d 5.93 + \charfreq e 18.91 + \charfreq f .81 + \charfreq g 3.4 + \charfreq h 2.38 + \charfreq i 6.5 + \charfreq j 1.46 + \charfreq k 2.25 + \charfreq l 3.57 + \charfreq m 2.21 + \charfreq n 10.03 + \charfreq o 6.06 + \charfreq p 1.57 + \charfreq q .009 + \charfreq r 6.41 + \charfreq s 3.73 + \charfreq t 6.79 + \charfreq u 1.99 + \charfreq v 2.85 + \charfreq w 1.52 + \charfreq x .04 + \charfreq y .035 + \charfreq z 1.39 +\stopcharactertable + +% http://caislab.icu.ac.kr/course/2001/spring/ice605/down/010306.pdf + +% \startcharactertable[en] +% \charfreq a 8.2 +% \charfreq b 1.5 +% \charfreq c 2.8 +% \charfreq d 4.3 +% \charfreq e 12.7 +% \charfreq f 2.2 +% \charfreq g 2 +% \charfreq h 6.1 +% \charfreq i 7 +% \charfreq j .2 +% \charfreq k .8 +% \charfreq l 4 +% \charfreq m 2.4 +% \charfreq n 6.7 +% \charfreq o 7.5 +% \charfreq p 1.9 +% \charfreq q .1 +% \charfreq r 6 +% \charfreq s 6.3 +% \charfreq t 9.1 +% \charfreq u 2.8 +% \charfreq v 1 +% \charfreq w 2.3 +% \charfreq x .1 +% \charfreq y 2 +% \charfreq z .1 +% \stopcharactertable + +% http://www.blankenburg.de/gat/pages/fach/info/analyse2.htm + +\startcharactertable[en] + \charfreq a 8.04 + \charfreq b 1.54 + \charfreq c 3.06 + \charfreq d 3.99 + \charfreq e 12.51 + \charfreq f 2.3 + \charfreq g 1.96 + \charfreq h 5.49 + \charfreq i 7.26 + \charfreq j .16 + \charfreq k .67 + \charfreq l 4.14 + \charfreq m 2.53 + \charfreq n 7.09 + \charfreq o 7.6 + \charfreq p 2 + \charfreq q .11 + \charfreq r 6.12 + \charfreq s 6.54 + \charfreq t 9.25 + \charfreq u 2.71 + \charfreq v .99 + \charfreq w 1.92 + \charfreq x .19 + \charfreq y 1.73 + \charfreq z .09 +\stopcharactertable + +% http://www.blankenburg.de/gat/pages/fach/info/analyse2.htm + +\startcharactertable[de] + \charfreq a 6.47 + \charfreq b 1.93 + \charfreq c 2.68 + \charfreq d 4.83 + \charfreq e 17.48 + \charfreq f 1.65 + \charfreq g 3.06 + \charfreq h 4.23 + \charfreq i 7.73 + \charfreq j .27 + \charfreq k 1.46 + \charfreq l 3.49 + \charfreq m 2.58 + \charfreq n 9.84 + \charfreq o 2.98 + \charfreq p .96 + \charfreq q .02 + \charfreq r 7.54 + \charfreq s 6.83 + \charfreq t 6.13 + \charfreq u 4.17 + \charfreq v .94 + \charfreq w 1.48 + \charfreq x .04 + \charfreq y .08 + \charfreq z 1.14 +\stopcharactertable + +\endinput diff --git a/Master/texmf-dist/tex/context/base/lang-frd.tex b/Master/texmf-dist/tex/context/base/lang-frd.tex deleted file mode 100644 index 6cc27080b78..00000000000 --- a/Master/texmf-dist/tex/context/base/lang-frd.tex +++ /dev/null @@ -1,140 +0,0 @@ -%D \module -%D [ file=lang-frd, -%D version=2004.01.15, -%D title=\CONTEXT\ Language Macros, -%D subtitle=Language Frequency Table 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. - -%D This is expewrimental work! - -% http://www.onzetaal.nl/advies/letterfreq.html - -\startcharactertable[nl] - \charfreq a 7.47 - \charfreq b 1.58 - \charfreq c 1.24 - \charfreq d 5.93 - \charfreq e 18.91 - \charfreq f .81 - \charfreq g 3.4 - \charfreq h 2.38 - \charfreq i 6.5 - \charfreq j 1.46 - \charfreq k 2.25 - \charfreq l 3.57 - \charfreq m 2.21 - \charfreq n 10.03 - \charfreq o 6.06 - \charfreq p 1.57 - \charfreq q .009 - \charfreq r 6.41 - \charfreq s 3.73 - \charfreq t 6.79 - \charfreq u 1.99 - \charfreq v 2.85 - \charfreq w 1.52 - \charfreq x .04 - \charfreq y .035 - \charfreq z 1.39 -\stopcharactertable - -% http://caislab.icu.ac.kr/course/2001/spring/ice605/down/010306.pdf - -% \startcharactertable[en] -% \charfreq a 8.2 -% \charfreq b 1.5 -% \charfreq c 2.8 -% \charfreq d 4.3 -% \charfreq e 12.7 -% \charfreq f 2.2 -% \charfreq g 2 -% \charfreq h 6.1 -% \charfreq i 7 -% \charfreq j .2 -% \charfreq k .8 -% \charfreq l 4 -% \charfreq m 2.4 -% \charfreq n 6.7 -% \charfreq o 7.5 -% \charfreq p 1.9 -% \charfreq q .1 -% \charfreq r 6 -% \charfreq s 6.3 -% \charfreq t 9.1 -% \charfreq u 2.8 -% \charfreq v 1 -% \charfreq w 2.3 -% \charfreq x .1 -% \charfreq y 2 -% \charfreq z .1 -% \stopcharactertable - -% http://www.blankenburg.de/gat/pages/fach/info/analyse2.htm - -\startcharactertable[en] - \charfreq a 8.04 - \charfreq b 1.54 - \charfreq c 3.06 - \charfreq d 3.99 - \charfreq e 12.51 - \charfreq f 2.3 - \charfreq g 1.96 - \charfreq h 5.49 - \charfreq i 7.26 - \charfreq j .16 - \charfreq k .67 - \charfreq l 4.14 - \charfreq m 2.53 - \charfreq n 7.09 - \charfreq o 7.6 - \charfreq p 2 - \charfreq q .11 - \charfreq r 6.12 - \charfreq s 6.54 - \charfreq t 9.25 - \charfreq u 2.71 - \charfreq v .99 - \charfreq w 1.92 - \charfreq x .19 - \charfreq y 1.73 - \charfreq z .09 -\stopcharactertable - -% http://www.blankenburg.de/gat/pages/fach/info/analyse2.htm - -\startcharactertable[de] - \charfreq a 6.47 - \charfreq b 1.93 - \charfreq c 2.68 - \charfreq d 4.83 - \charfreq e 17.48 - \charfreq f 1.65 - \charfreq g 3.06 - \charfreq h 4.23 - \charfreq i 7.73 - \charfreq j .27 - \charfreq k 1.46 - \charfreq l 3.49 - \charfreq m 2.58 - \charfreq n 9.84 - \charfreq o 2.98 - \charfreq p .96 - \charfreq q .02 - \charfreq r 7.54 - \charfreq s 6.83 - \charfreq t 6.13 - \charfreq u 4.17 - \charfreq v .94 - \charfreq w 1.48 - \charfreq x .04 - \charfreq y .08 - \charfreq z 1.14 -\stopcharactertable - -\endinput diff --git a/Master/texmf-dist/tex/context/base/lang-frq.mkii b/Master/texmf-dist/tex/context/base/lang-frq.mkii new file mode 100644 index 00000000000..773230e6c86 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lang-frq.mkii @@ -0,0 +1,207 @@ +%D \module +%D [ file=lang-frq, +%D version=2004.01.15, +%D title=\CONTEXT\ Language Macros, +%D subtitle=Frequency Tables, +%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 / Frequency Tables} + +\unprotect + +\ifx\s!en\undefined \def\v!en{en} \fi +\ifx\??lg\undefined \def\??lg{@@lg} \fi + +%M \usemodule[layout] + +%D \macros +%D {charwidthmethod} +%D +%D This module implements a method for determining the width of an +%D average character in a language. It uses the dimensions of the +%D current fonts. +%D +%D \def\ShwChrWd#1#2#3% +%D {\chardef\charwidthmethod#1\relax +%D \mainlanguage[#2#3]\the\dimexpr(\averagecharwidth)} +%D +%D \starttabulate[|c|c|c|c|c|c|] +%D \HL +%D \NC \NC\bf0=amount\NC\bf1=.5em\NC2=ex\NC\bf3=frequency\NC\bf4=list\NC\NR +%D \HL +%D \NC\bf en\NC\ShwChrWd0en\NC\ShwChrWd1en\NC\ShwChrWd2en\NC\ShwChrWd3en\NC\ShwChrWd4en\NC\NR +%D \NC\bf nl\NC\ShwChrWd0nl\NC\ShwChrWd1nl\NC\ShwChrWd2nl\NC\ShwChrWd3nl\NC\ShwChrWd4nl\NC\NR +%D \NC\bf de\NC\ShwChrWd0de\NC\ShwChrWd1de\NC\ShwChrWd2de\NC\ShwChrWd3de\NC\ShwChrWd4de\NC\NR +%D \HL +%D \stoptabulate +%D +%D Method~1 ignores the widths and assumes that each character has a +%D width of .5em, which is true for most monospaced fonts. Method~2 +%D takes the x as starting point, and assumes that it's height kind of +%D matches its width. Method~3 is the best one, and determines the +%D average width based on the language specific character table. +%D Method~4 is a mixture between the first two methods: character +%D specific widths applied to an equal distribution. Method~0 reports +%D the total count, which normally is~100. + +\chardef\charwidthmethod=3 % 0=amount 1=em 2=ex 3=frequency 4=flattened >4=ex + +%D \macros +%D {charwidthlanguage} +%D +%D The language used for the calculations is defined as: + +\def\charwidthlanguage{\currentmainlanguage} + +%D \macros +%D {charfreq} +%D +%D This method comes into action in the following macro: + +\def\charfreq#1 #2 % character fraction + {+(\ifcase\charwidthmethod + #2\dimexpr100\onepoint\relax + \or + #2\dimexpr.5em\relax % \emwidth/2 + \or + #2\dimexpr\exheight\relax + \or + #2\fontcharwd\font`#1% + \or + \dimexpr100\fontcharwd\font`#1/\charactertsize\charwidthlanguage\relax % ugly hack + \else + #2\dimexpr\exheight\relax + \fi)} + +%D \macros +%D {startcharactertable} +%D +%D A frequency table is defined with the following macro. The \type +%D {charfreq} macro is used in this table. + +\def\startcharactertable[#1]#2\stopcharactertable % \dimexpr has fuzzy lookahead + {\startnointerference + \long\setgvalue{\??lg:w:#1}{#2}% the width vector + \scratchcounter\zerocount \def\charfreq##1 ##2 {\advance\scratchcounter\plusone} #2% + \long\setxvalue{\??lg:c:#1}{\the\scratchcounter}% the character count + \stopnointerference} + +%D \macros +%D {charactertable,charactertsize} +%D +%D The table content as well as the number of entries can be fetched with +%D the following two macros. The architecture of the table and calling +%D macro permits a fully expandable application. + +\def\charactertable#1% + {\csname\??lg:w:\ifcsname\??lg:w:#1\endcsname#1\else\s!en\fi\endcsname} + +\def\charactertsize#1% + {\csname\??lg:c:\ifcsname\??lg:c:#1\endcsname#1\else\s!en\fi\endcsname} + +%D Although it is of hardly any use, you can inherit a character table: +%D +%D \starttyping +%D \startcharactertable[cz] \charactertable{en} \stopcharactertable +%D \stoptyping +%D +%D We define a default vector with 100\% x's. + +\startcharactertable[en] 100 x \stopcharactertable % kind of default + +%D \macros +%D {averagecharwidth} +%D +%D This macro reports the average width for the current main +%D language (\the \dimexpr (\averagecharwidth)). + +\def\averagecharwidth{\dimexpr((\zeropoint\charactertable\charwidthlanguage)/100)} + +\def\showcharfreq + {\hbox\bgroup + \charwidthlanguage:% + \dostepwiserecurse041% + {\chardef\charwidthmethod\recurselevel\relax + \enspace\recurselevel/\the\dimexpr(\averagecharwidth)}% + \egroup} + +%D Just for fun, we show a few frequency tables as graphic (\in {figure} +%D [fig:charfreq]). +%D +%D \startbuffer +%D \definepalet [charfreq] [en=darkred, nl=darkgreen, de=darkblue] +%D +%D \def\charfreq#1 #2 % +%D {\startMPdrawing +%D interim linejoin := butt ; +%D a := ASCII "#1" ; +%D if (a >= (ASCII "a")) and (a <= (ASCII "z")) : +%D draw ((0,#2*.25cm)--origin--(0,#2*.5cm)) +%D shifted (a*4mm+o,0) +%D withpen pencircle scaled .5mm +%D withcolor c; +%D fi ; +%D \stopMPdrawing} +%D +%D \resetMPdrawing +%D \startMPdrawing +%D numeric a, o ; a := o := 0 ; +%D color c ; c := .5white ; +%D string s ; s := "" ; +%D \stopMPdrawing +%D +%D \startMPdrawing o := 0mm ; c := \MPcolor{charfreq:en} ; \stopMPdrawing +%D \charactertable{en} +%D +%D \startMPdrawing o := 1mm ; c := \MPcolor{charfreq:nl} ; \stopMPdrawing +%D \charactertable{nl} +%D +%D \startMPdrawing o := 2mm ; c := \MPcolor{charfreq:de} ; \stopMPdrawing +%D \charactertable{de} +%D +%D \startMPdrawing +%D for a := ASCII "a" upto ASCII "z" : +%D draw textext.bot("\strut\tttf " & char a) shifted (a*4mm+1mm,-1mm) ; +%D endfor ; +%D \stopMPdrawing +%D +%D \MPdrawingdonetrue \getMPdrawing \resetMPdrawing +%D \stopbuffer +%D +%D \placefigure +%D [here] +%D [fig:charfreq] +%D {The character distributions for English, Dutch and German.} +%D {\getbuffer} +%D +%D A few samples of usage of this mechanism are shown below: +%D +%D \startbuffer +%D {\mainlanguage[en]\hsize65\averagecharwidth\mainlanguage[en]\input ward \blank} +%D {\mainlanguage[nl]\hsize65\averagecharwidth\mainlanguage[en]\input ward \blank} +%D {\mainlanguage[de]\hsize65\averagecharwidth\mainlanguage[en]\input ward \blank} +%D \stopbuffer +%D +%D \typebuffer \getbuffer +%D +%D Although the widthts differ, the consequenes for breaking the paragraph +%D into lines are minimal. + +%D \macros +%D {freezeaveragecharacterwidth} +%D +%D This macro can be used to make sure that the width does not change during a +%D page break when another font is used. + +\let\normalaveragecharacterwidth\averagecharacterwidth + +\def\freezeaveragecharacterwidth % global + {\xdef\averagecharacterwidth{\dimexpr(\the\normalaveragecharacterwidth)}} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-frq.tex b/Master/texmf-dist/tex/context/base/lang-frq.tex deleted file mode 100644 index 773230e6c86..00000000000 --- a/Master/texmf-dist/tex/context/base/lang-frq.tex +++ /dev/null @@ -1,207 +0,0 @@ -%D \module -%D [ file=lang-frq, -%D version=2004.01.15, -%D title=\CONTEXT\ Language Macros, -%D subtitle=Frequency Tables, -%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 / Frequency Tables} - -\unprotect - -\ifx\s!en\undefined \def\v!en{en} \fi -\ifx\??lg\undefined \def\??lg{@@lg} \fi - -%M \usemodule[layout] - -%D \macros -%D {charwidthmethod} -%D -%D This module implements a method for determining the width of an -%D average character in a language. It uses the dimensions of the -%D current fonts. -%D -%D \def\ShwChrWd#1#2#3% -%D {\chardef\charwidthmethod#1\relax -%D \mainlanguage[#2#3]\the\dimexpr(\averagecharwidth)} -%D -%D \starttabulate[|c|c|c|c|c|c|] -%D \HL -%D \NC \NC\bf0=amount\NC\bf1=.5em\NC2=ex\NC\bf3=frequency\NC\bf4=list\NC\NR -%D \HL -%D \NC\bf en\NC\ShwChrWd0en\NC\ShwChrWd1en\NC\ShwChrWd2en\NC\ShwChrWd3en\NC\ShwChrWd4en\NC\NR -%D \NC\bf nl\NC\ShwChrWd0nl\NC\ShwChrWd1nl\NC\ShwChrWd2nl\NC\ShwChrWd3nl\NC\ShwChrWd4nl\NC\NR -%D \NC\bf de\NC\ShwChrWd0de\NC\ShwChrWd1de\NC\ShwChrWd2de\NC\ShwChrWd3de\NC\ShwChrWd4de\NC\NR -%D \HL -%D \stoptabulate -%D -%D Method~1 ignores the widths and assumes that each character has a -%D width of .5em, which is true for most monospaced fonts. Method~2 -%D takes the x as starting point, and assumes that it's height kind of -%D matches its width. Method~3 is the best one, and determines the -%D average width based on the language specific character table. -%D Method~4 is a mixture between the first two methods: character -%D specific widths applied to an equal distribution. Method~0 reports -%D the total count, which normally is~100. - -\chardef\charwidthmethod=3 % 0=amount 1=em 2=ex 3=frequency 4=flattened >4=ex - -%D \macros -%D {charwidthlanguage} -%D -%D The language used for the calculations is defined as: - -\def\charwidthlanguage{\currentmainlanguage} - -%D \macros -%D {charfreq} -%D -%D This method comes into action in the following macro: - -\def\charfreq#1 #2 % character fraction - {+(\ifcase\charwidthmethod - #2\dimexpr100\onepoint\relax - \or - #2\dimexpr.5em\relax % \emwidth/2 - \or - #2\dimexpr\exheight\relax - \or - #2\fontcharwd\font`#1% - \or - \dimexpr100\fontcharwd\font`#1/\charactertsize\charwidthlanguage\relax % ugly hack - \else - #2\dimexpr\exheight\relax - \fi)} - -%D \macros -%D {startcharactertable} -%D -%D A frequency table is defined with the following macro. The \type -%D {charfreq} macro is used in this table. - -\def\startcharactertable[#1]#2\stopcharactertable % \dimexpr has fuzzy lookahead - {\startnointerference - \long\setgvalue{\??lg:w:#1}{#2}% the width vector - \scratchcounter\zerocount \def\charfreq##1 ##2 {\advance\scratchcounter\plusone} #2% - \long\setxvalue{\??lg:c:#1}{\the\scratchcounter}% the character count - \stopnointerference} - -%D \macros -%D {charactertable,charactertsize} -%D -%D The table content as well as the number of entries can be fetched with -%D the following two macros. The architecture of the table and calling -%D macro permits a fully expandable application. - -\def\charactertable#1% - {\csname\??lg:w:\ifcsname\??lg:w:#1\endcsname#1\else\s!en\fi\endcsname} - -\def\charactertsize#1% - {\csname\??lg:c:\ifcsname\??lg:c:#1\endcsname#1\else\s!en\fi\endcsname} - -%D Although it is of hardly any use, you can inherit a character table: -%D -%D \starttyping -%D \startcharactertable[cz] \charactertable{en} \stopcharactertable -%D \stoptyping -%D -%D We define a default vector with 100\% x's. - -\startcharactertable[en] 100 x \stopcharactertable % kind of default - -%D \macros -%D {averagecharwidth} -%D -%D This macro reports the average width for the current main -%D language (\the \dimexpr (\averagecharwidth)). - -\def\averagecharwidth{\dimexpr((\zeropoint\charactertable\charwidthlanguage)/100)} - -\def\showcharfreq - {\hbox\bgroup - \charwidthlanguage:% - \dostepwiserecurse041% - {\chardef\charwidthmethod\recurselevel\relax - \enspace\recurselevel/\the\dimexpr(\averagecharwidth)}% - \egroup} - -%D Just for fun, we show a few frequency tables as graphic (\in {figure} -%D [fig:charfreq]). -%D -%D \startbuffer -%D \definepalet [charfreq] [en=darkred, nl=darkgreen, de=darkblue] -%D -%D \def\charfreq#1 #2 % -%D {\startMPdrawing -%D interim linejoin := butt ; -%D a := ASCII "#1" ; -%D if (a >= (ASCII "a")) and (a <= (ASCII "z")) : -%D draw ((0,#2*.25cm)--origin--(0,#2*.5cm)) -%D shifted (a*4mm+o,0) -%D withpen pencircle scaled .5mm -%D withcolor c; -%D fi ; -%D \stopMPdrawing} -%D -%D \resetMPdrawing -%D \startMPdrawing -%D numeric a, o ; a := o := 0 ; -%D color c ; c := .5white ; -%D string s ; s := "" ; -%D \stopMPdrawing -%D -%D \startMPdrawing o := 0mm ; c := \MPcolor{charfreq:en} ; \stopMPdrawing -%D \charactertable{en} -%D -%D \startMPdrawing o := 1mm ; c := \MPcolor{charfreq:nl} ; \stopMPdrawing -%D \charactertable{nl} -%D -%D \startMPdrawing o := 2mm ; c := \MPcolor{charfreq:de} ; \stopMPdrawing -%D \charactertable{de} -%D -%D \startMPdrawing -%D for a := ASCII "a" upto ASCII "z" : -%D draw textext.bot("\strut\tttf " & char a) shifted (a*4mm+1mm,-1mm) ; -%D endfor ; -%D \stopMPdrawing -%D -%D \MPdrawingdonetrue \getMPdrawing \resetMPdrawing -%D \stopbuffer -%D -%D \placefigure -%D [here] -%D [fig:charfreq] -%D {The character distributions for English, Dutch and German.} -%D {\getbuffer} -%D -%D A few samples of usage of this mechanism are shown below: -%D -%D \startbuffer -%D {\mainlanguage[en]\hsize65\averagecharwidth\mainlanguage[en]\input ward \blank} -%D {\mainlanguage[nl]\hsize65\averagecharwidth\mainlanguage[en]\input ward \blank} -%D {\mainlanguage[de]\hsize65\averagecharwidth\mainlanguage[en]\input ward \blank} -%D \stopbuffer -%D -%D \typebuffer \getbuffer -%D -%D Although the widthts differ, the consequenes for breaking the paragraph -%D into lines are minimal. - -%D \macros -%D {freezeaveragecharacterwidth} -%D -%D This macro can be used to make sure that the width does not change during a -%D page break when another font is used. - -\let\normalaveragecharacterwidth\averagecharacterwidth - -\def\freezeaveragecharacterwidth % global - {\xdef\averagecharacterwidth{\dimexpr(\the\normalaveragecharacterwidth)}} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-ger.mkii b/Master/texmf-dist/tex/context/base/lang-ger.mkii new file mode 100644 index 00000000000..04551a891df --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lang-ger.mkii @@ -0,0 +1,744 @@ +%D \module +%D [ file=lang-ger, +%D version=1997.09.03, +%D title=\CONTEXT\ Language Macros, +%D subtitle=Germanic 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. + +\writestatus{loading}{ConTeXt Language Macros / Germanic Languages} + +%D The framework of this module is set up by Hans Hagen while +%D many of the first translations were done by Tobias. Later +%D on, corrections were made by users. If you have suggestions, +%D or feel that your name missing here, don't hesitate to send +%D us an email. +%D +%D \starttabulate[|lB|l|] +%D \NC Norwegian \NC Hans Fredrik Nordhaug \NC \NR +%D \NC Danish \NC Arne Jorgensen \NC \NR % check the o +%D \NC Afrikaans \NC \NC \NR +%D \stoptabulate + +% Danish, Faeroese, Icelandic, Norwegian, Swedish, German, Yiddish +% Afrikaans, Dutch, English, Flemush, Frisian, Plattdeutsch + +\unprotect + +\installlanguage + [\s!nl] + [\c!spacing=\v!packed, + \c!leftsentence=---, + \c!rightsentence=---, + \c!leftsubsentence=---, + \c!rightsubsentence=---, + \c!leftquote=\lowerleftsingleninequote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\lowerleftdoubleninequote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!day,\ ,\v!month,\ ,\v!year}, + \s!mapping={texnansi,ec}, + \s!encoding={texnansi,ec}] + +\installlanguage + [\s!en] + [\c!spacing=\v!broad, + \c!leftsentence=---, + \c!rightsentence=---, + \c!leftsubsentence=---, + \c!rightsubsentence=---, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!month,\ ,\v!day,{,\ },\v!year}, + \s!patterns=\s!us, + \s!lefthyphenmin=2, + \s!righthyphenmin=3] + +\installlanguage + [\s!de] + [\c!spacing=\v!packed, + \s!lefthyphenmin=3, + \s!righthyphenmin=3, + \c!leftsentence={\hbox{--~}}, + \c!rightsentence={\hbox{~--}}, + \c!leftsubsentence={--}, + \c!rightsubsentence={--}, + \c!leftquote=\lowerleftsingleninequote, + \c!rightquote=\upperrightsinglesixquote, + \c!leftquotation=\lowerleftdoubleninequote, + \c!rightquotation=\upperrightdoublesixquote, + \c!date={\v!day,{.},\ ,\v!month,\ ,\v!year}, + \s!mapping={texnansi,ec}, + \s!encoding={texnansi,ec}] + +\installlanguage + [\s!da] + [\c!spacing=\v!packed, + \c!leftsentence={\hbox{--\hskip.5em}}, + \c!rightsentence={\hbox{\hskip.5em--}}, + \c!leftsubsentence={--}, + \c!rightsubsentence={--}, + \c!leftquote=\lowerleftsingleninequote, + \c!rightquote=\upperrightsinglesixquote, + \c!leftquotation=\lowerleftdoubleninequote, + \c!rightquotation=\upperrightdoublesixquote, + \c!date={\v!day,{.},\ ,\v!month,\ ,\v!year}] + +\installlanguage + [\s!sv] + [\c!spacing=\v!packed, + \c!leftsentence={\hbox{--~}}, + \c!rightsentence={\hbox{~--}}, + \c!leftsubsentence={--}, + \c!rightsubsentence={--}, + \c!leftquote=\upperrightsingleninequote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperrightdoubleninequote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!day,\ ,\v!month,\ ,\v!year}] + +\installlanguage + [\s!af] + [\c!spacing=\v!packed, + \c!leftsentence=---, + \c!rightsentence=---, + \c!leftsubsentence=---, + \c!rightsubsentence=---, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!year,\ ,\v!month,\ ,\v!day}, + \s!patterns=\s!af] % was nl + +\installlanguage + [\s!nb] + [spacing=packed, + lefthyphenmin=2, + righthyphenmin=2, + leftsentence=---, + rightsentence=---, + leftsubsentence=---, + rightsubsentence=---, + leftquote=\upperleftsinglesixquote, + rightquote=\upperrightsingleninequote, + leftquotation=\leftguillemot, + rightquotation=\rightguillemot, + date={day,{.},\ ,month,\ ,year}, + state=stop] + +\installlanguage + [\s!nn] + [spacing=packed, + lefthyphenmin=2, + righthyphenmin=2, + leftsentence=---, + rightsentence=---, + leftsubsentence=---, + rightsubsentence=---, + leftquote=\upperleftsinglesixquote, + rightquote=\upperrightsingleninequote, + leftquotation=\leftguillemot, + rightquotation=\rightguillemot, + date={day,{.},\ ,month,\ ,year}, + state=stop] + +\installlanguage [\s!no] [\s!nb] +\installlanguage [\s!norwegian] [\s!nb] +\installlanguage [\s!bokmal] [\s!nb] +\installlanguage [\s!nynorsk] [\s!nn] + +%D Extra: + +% \mainlanguage[en] +% \mainlanguage[de] +% \mainlanguage[deo] +% \mainlanguage[de-de] +% \mainlanguage[de-at] +% \mainlanguage[de-ch] +% +% \starttext +% Die Herren Meier\index{Meier}, Müller\index{Müller}, Huber\index{Huber} +% und Schmidt\index{Schmidt} arbeiten in der gleichen Firma. +% +% \index{Mass}\index{Mas}\index{Maß}\index{Maße}\index{Masse} +% \index{Muller}\index{Mûller} +% \index{Hutte}\index{Hütte}\index{Huttf} +% \index{paar}\index{Paar} +% \index{a}\index{aa}\index{ä}\index{az}\index{aza} +% \index{o}\index{oo}\index{ö}\index{oz}\index{oza} +% \index{u}\index{uu}\index{ü}\index{uz}\index{uza}\index{üa} +% \index{call}\index{chip} +% +% \subject{Index} \placeindex +% \stoptext + +\installlanguage % old german + [deo] + [\c!spacing=\v!packed, + \c!default=\s!de] + +\installlanguage + [de-de] + [\c!spacing=\v!packed, + \c!default=\s!de] + +\installlanguage + [de-at] + [\c!spacing=\v!packed, + \c!default=\s!de, + \c!leftquote=\leftguillemot, + \c!rightquote=\rightguillemot, + \c!leftquotation=\leftguillemot, + \c!rightquotation=\rightguillemot] + +\installlanguage + [de-ch] + [\c!spacing=\v!packed, + \c!default=\s!de] + +%D And some alternative (but very real) english patterns: + +\installlanguage + [en-gb] + [\c!default=\s!en, + \s!patterns=\s!gb, + \s!lefthyphenmin=3, + \s!righthyphenmin=3] + +\installlanguage + [en-us] + [\c!default=\s!en, + \s!patterns=\s!us] + +\installlanguage [\s!uk] [\s!en-\s!gb] +\installlanguage [\s!us] [\s!en-\s!us] + +%D For compatibility reasons we also define: + +%installlanguage [du] [\s!de] % old times context +%installlanguage [sp] [\s!es] % old times context /lang-ita + +\installlanguage [usenglish] [\s!en-\s!us] +\installlanguage [ukenglish] [\s!en-\s!gb] +\installlanguage [english] [\s!en] +\installlanguage [dutch] [\s!nl] +\installlanguage [german] [\s!de] +\installlanguage [danish] [\s!da] +\installlanguage [swedish] [\s!sv] +\installlanguage [afrikaans] [\s!af] + +\setupheadtext [\s!en] [\v!content=Contents] +\setupheadtext [\s!nl] [\v!content=Inhoud] +\setupheadtext [\s!de] [\v!content=Inhalt] +\setupheadtext [\s!da] [\v!content=Indhold] +\setupheadtext [\s!sv] [\v!content=Inneh\aring ll] +\setupheadtext [\s!af] [\v!content=Inhoud] +\setupheadtext [\s!nb] [\v!content=Innhold] +\setupheadtext [\s!nn] [\v!content=Innhald] + +\setupheadtext [\s!en] [\v!tables=Tables] +\setupheadtext [\s!nl] [\v!tables=Tabellen] +\setupheadtext [\s!de] [\v!tables=Tabellen] +\setupheadtext [\s!da] [\v!tables=Tabeller] +\setupheadtext [\s!sv] [\v!tables=Tabeller] +\setupheadtext [\s!af] [\v!tables=Tabelle] +\setupheadtext [\s!nb] [\v!tables=Tabeller] +\setupheadtext [\s!nn] [\v!tables=Tabellar] + +\setupheadtext [\s!en] [\v!figures=Figures] +\setupheadtext [\s!nl] [\v!figures=Figuren] +\setupheadtext [\s!de] [\v!figures=Abbildungen] +\setupheadtext [\s!da] [\v!figures=Figurer] +\setupheadtext [\s!sv] [\v!figures=Figurer] +\setupheadtext [\s!af] [\v!figures=Figure] +\setupheadtext [\s!nb] [\v!figures=Figurer] +\setupheadtext [\s!nn] [\v!figures=Figurar] + +\setupheadtext [\s!en] [\v!graphics=Graphics] +\setupheadtext [\s!nl] [\v!graphics=Grafieken] +\setupheadtext [\s!de] [\v!graphics=Graphiken] +\setupheadtext [\s!da] [\v!graphics=Grafik] +\setupheadtext [\s!sv] [\v!graphics=Grafik] +\setupheadtext [\s!af] [\v!graphics=Grafieke] +\setupheadtext [\s!nb] [\v!graphics=Bilde] +\setupheadtext [\s!nn] [\v!graphics=Bilete] + +\setupheadtext [\s!en] [\v!intermezzi=Intermezzos] +\setupheadtext [\s!nl] [\v!intermezzi=Intermezzo's] +\setupheadtext [\s!de] [\v!intermezzi=Intermezzi] +\setupheadtext [\s!da] [\v!intermezzi=Intermezzoer] +\setupheadtext [\s!sv] [\v!intermezzi=Intermezzon] +\setupheadtext [\s!af] [\v!intermezzi=Intermezzos] +\setupheadtext [\s!nb] [\v!intermezzi=Intermesso] +\setupheadtext [\s!nn] [\v!intermezzi=Intermesso] + +\setupheadtext [\s!en] [\v!index=Index] +\setupheadtext [\s!nl] [\v!index=Index] +\setupheadtext [\s!de] [\v!index=Index] +\setupheadtext [\s!da] [\v!index=Indeks] +\setupheadtext [\s!sv] [\v!index=Sakregister] +\setupheadtext [\s!af] [\v!index=Indeks] +\setupheadtext [\s!nb] [\v!index=Register] +\setupheadtext [\s!nn] [\v!index=Register] + +\setupheadtext [\s!en] [\v!abbreviations=Abbreviations] +\setupheadtext [\s!nl] [\v!abbreviations=Afkortingen] +\setupheadtext [\s!de] [\v!abbreviations=Abk\uumlaut rzungen] +\setupheadtext [\s!da] [\v!abbreviations=Forkortelser] +\setupheadtext [\s!sv] [\v!abbreviations=F\oumlaut rkortningar] +\setupheadtext [\s!af] [\v!abbreviations=Afkortings] +\setupheadtext [\s!nb] [\v!abbreviations=Forkortelser] +\setupheadtext [\s!nn] [\v!abbreviations=Forkortingar] + +\setupheadtext [\s!en] [\v!logos=Logos] +\setupheadtext [\s!nl] [\v!logos=Logo's] +\setupheadtext [\s!de] [\v!logos=Logos] +\setupheadtext [\s!da] [\v!logos=Logoer] +\setupheadtext [\s!sv] [\v!logos=Loggor] +\setupheadtext [\s!af] [\v!logos=Logos] +\setupheadtext [\s!nb] [\v!logos=Logoer] +\setupheadtext [\s!nn] [\v!logos=Logoar] + +\setupheadtext [\s!en] [\v!units=Units] +\setupheadtext [\s!nl] [\v!units=Eenheden] +\setupheadtext [\s!de] [\v!units=Einheiten] +\setupheadtext [\s!da] [\v!units=Enheder] +\setupheadtext [\s!sv] [\v!units=Enheter] +\setupheadtext [\s!af] [\v!units=Eenhede] +\setupheadtext [\s!nb] [\v!units=Enheter] +\setupheadtext [\s!nn] [\v!units=Einingar] + +\setupheadtext [\s!en] [pubs=References] +\setupheadtext [\s!nl] [pubs=Literatuur] +\setupheadtext [\s!de] [pubs=Literatur] +%setupheadtext [\s!da] [pubs=?] +%setupheadtext [\s!sv] [pubs=?] +%setupheadtext [\s!af] [pubs=?] +%setupheadtext [\s!nb] [pubs=?] +%setupheadtext [\s!nn] [pubs=?] + +\setuplabeltext [\s!en] [\v!table=Table ] +\setuplabeltext [\s!nl] [\v!table=Tabel ] +\setuplabeltext [\s!de] [\v!table=Tabelle ] +\setuplabeltext [\s!da] [\v!table=Tabel ] +\setuplabeltext [\s!sv] [\v!table=Tabell ] +\setuplabeltext [\s!af] [\v!table=Tabel] +\setuplabeltext [\s!nb] [\v!table=Tabell ] +\setuplabeltext [\s!nn] [\v!table=Tabell ] + +\setuplabeltext [\s!en] [\v!figure=Figure ] +\setuplabeltext [\s!nl] [\v!figure=Figuur ] +\setuplabeltext [\s!de] [\v!figure=Abbildung ] +\setuplabeltext [\s!da] [\v!figure=Figur ] +\setuplabeltext [\s!sv] [\v!figure=Figur ] +\setuplabeltext [\s!af] [\v!figure=Figuur ] +\setuplabeltext [\s!nb] [\v!figure=Figur ] +\setuplabeltext [\s!nn] [\v!figure=Figur ] + +\setuplabeltext [\s!en] [\v!intermezzo=Intermezzo ] +\setuplabeltext [\s!nl] [\v!intermezzo=Intermezzo ] +\setuplabeltext [\s!de] [\v!intermezzo=Intermezzo ] +\setuplabeltext [\s!da] [\v!intermezzo=Intermezzo ] +\setuplabeltext [\s!sv] [\v!intermezzo=Intermezzo ] +\setuplabeltext [\s!af] [\v!intermezzo=Intermezzo ] +\setuplabeltext [\s!nb] [\v!intermezzo=Intermesso ] +\setuplabeltext [\s!nn] [\v!intermezzo=Intermesso ] + +\setuplabeltext [\s!en] [\v!graphic=Graphic ] +\setuplabeltext [\s!nl] [\v!graphic=Grafiek ] +\setuplabeltext [\s!de] [\v!graphic=Graphik ] +\setuplabeltext [\s!da] [\v!graphic=Grafik ] +\setuplabeltext [\s!sv] [\v!graphic=Grafik ] +\setuplabeltext [\s!af] [\v!graphic=Grafiek ] +\setuplabeltext [\s!nb] [\v!graphic=Bilde ] +\setuplabeltext [\s!nn] [\v!graphic=Bilete ] + +%D We don't set these here. One can do that in a style. + +\setuplabeltext [\s!en] [\v!chapter=] % Chapter +\setuplabeltext [\s!nl] [\v!chapter=] +\setuplabeltext [\s!de] [\v!chapter=] % Kapitel +\setuplabeltext [\s!da] [\v!chapter=] +\setuplabeltext [\s!sv] [\v!chapter=] +\setuplabeltext [\s!af] [\v!chapter=] % Hoofstuk +\setuplabeltext [\s!nb] [\v!chapter=] +\setuplabeltext [\s!nn] [\v!chapter=] + +\setuplabeltext [\s!en] [\v!section=] +\setuplabeltext [\s!nl] [\v!section=] +\setuplabeltext [\s!de] [\v!section=] +\setuplabeltext [\s!da] [\v!section=] +\setuplabeltext [\s!sv] [\v!section=] +\setuplabeltext [\s!af] [\v!section=] % Paragraaf +\setuplabeltext [\s!nb] [\v!section=] +\setuplabeltext [\s!nn] [\v!section=] + +\setuplabeltext [\s!en] [\v!subsection=] +\setuplabeltext [\s!nl] [\v!subsection=] +\setuplabeltext [\s!de] [\v!subsection=] +\setuplabeltext [\s!da] [\v!subsection=] +\setuplabeltext [\s!sv] [\v!subsection=] +\setuplabeltext [\s!af] [\v!subsection=] +\setuplabeltext [\s!nb] [\v!subsection=] +\setuplabeltext [\s!nn] [\v!subsection=] + +\setuplabeltext [\s!en] [\v!subsubsection=] +\setuplabeltext [\s!nl] [\v!subsubsection=] +\setuplabeltext [\s!de] [\v!subsubsection=] +\setuplabeltext [\s!da] [\v!subsubsection=] +\setuplabeltext [\s!sv] [\v!subsubsection=] +\setuplabeltext [\s!af] [\v!subsubsection=] +\setuplabeltext [\s!nb] [\v!subsubsection=] +\setuplabeltext [\s!nn] [\v!subsubsection=] + +\setuplabeltext [\s!en] [\v!subsubsubsection=] +\setuplabeltext [\s!nl] [\v!subsubsubsection=] +\setuplabeltext [\s!de] [\v!subsubsubsection=] +\setuplabeltext [\s!da] [\v!subsubsubsection=] +\setuplabeltext [\s!sv] [\v!subsubsubsection=] +\setuplabeltext [\s!af] [\v!subsubsubsection=] +\setuplabeltext [\s!nb] [\v!subsubsubsection=] +\setuplabeltext [\s!nn] [\v!subsubsubsection=] + +\setuplabeltext [\s!en] [\v!appendix=] % Appendix +\setuplabeltext [\s!nl] [\v!appendix=] +\setuplabeltext [\s!de] [\v!appendix=] % Anhang +\setuplabeltext [\s!da] [\v!appendix=] % Bilag +\setuplabeltext [\s!sv] [\v!appendix=] +\setuplabeltext [\s!af] [\v!appendix=] % Bylae +\setuplabeltext [\s!nb] [\v!appendix=] % Tillegg +\setuplabeltext [\s!nn] [\v!appendix=] % Tillegg + +\setuplabeltext [\s!en] [\v!part=Part ] +\setuplabeltext [\s!nl] [\v!part=Deel ] +\setuplabeltext [\s!de] [\v!part=Teil ] +\setuplabeltext [\s!da] [\v!part=Del ] +\setuplabeltext [\s!sv] [\v!part=Del ] +\setuplabeltext [\s!af] [\v!part=Deel ] +\setuplabeltext [\s!nb] [\v!part=Del] +\setuplabeltext [\s!nn] [\v!part=Del] + +\setuplabeltext [\s!en] [\v!line=line ] +\setuplabeltext [\s!nl] [\v!line=regel ] +\setuplabeltext [\s!de] [\v!line=Zeile ] +\setuplabeltext [\s!da] [\v!line=linie ] % or linje +\setuplabeltext [\s!sv] [\v!line=rad ] +\setuplabeltext [\s!af] [\v!line=re\ediaeresis l ] +\setuplabeltext [\s!nb] [\v!line=linje ] +\setuplabeltext [\s!nn] [\v!line=linje ] + +\setuplabeltext [\s!en] [\v!lines=lines ] +\setuplabeltext [\s!nl] [\v!lines=regels ] +\setuplabeltext [\s!de] [\v!lines=Zeilen ] +\setuplabeltext [\s!da] [\v!lines=linier ] % or linjer +\setuplabeltext [\s!sv] [\v!lines=rader ] +\setuplabeltext [\s!af] [\v!lines=re\ediaeresis ls ] +\setuplabeltext [\s!nb] [\v!lines=linjer ] +\setuplabeltext [\s!nn] [\v!lines=linjer ] + +\setuplabeltext [\s!en] [\v!january=January] +\setuplabeltext [\s!en] [\v!february=February] +\setuplabeltext [\s!en] [\v!march=March] +\setuplabeltext [\s!en] [\v!april=April] +\setuplabeltext [\s!en] [\v!may=May] +\setuplabeltext [\s!en] [\v!june=June] +\setuplabeltext [\s!en] [\v!july=July] +\setuplabeltext [\s!en] [\v!august=August] +\setuplabeltext [\s!en] [\v!september=September] +\setuplabeltext [\s!en] [\v!october=October] +\setuplabeltext [\s!en] [\v!november=November] +\setuplabeltext [\s!en] [\v!december=December] + +\setuplabeltext [\s!nl] [\v!january=januari] +\setuplabeltext [\s!nl] [\v!february=februari] +\setuplabeltext [\s!nl] [\v!march=maart] +\setuplabeltext [\s!nl] [\v!april=april] +\setuplabeltext [\s!nl] [\v!may=mei] +\setuplabeltext [\s!nl] [\v!june=juni] +\setuplabeltext [\s!nl] [\v!july=juli] +\setuplabeltext [\s!nl] [\v!august=augustus] +\setuplabeltext [\s!nl] [\v!september=september] +\setuplabeltext [\s!nl] [\v!october=oktober] +\setuplabeltext [\s!nl] [\v!november=november] +\setuplabeltext [\s!nl] [\v!december=december] + +\setuplabeltext [\s!de] [\v!january=Januar] +\setuplabeltext [\s!de] [\v!february=Februar] +\setuplabeltext [\s!de] [\v!march=M\aumlaut rz] +\setuplabeltext [\s!de] [\v!april=April] +\setuplabeltext [\s!de] [\v!may=Mai] +\setuplabeltext [\s!de] [\v!june=Juni] +\setuplabeltext [\s!de] [\v!july=Juli] +\setuplabeltext [\s!de] [\v!august=August] +\setuplabeltext [\s!de] [\v!september=September] +\setuplabeltext [\s!de] [\v!october=Oktober] +\setuplabeltext [\s!de] [\v!november=November] +\setuplabeltext [\s!de] [\v!december=Dezember] + +\setuplabeltext [\s!da] [\v!january=januar] +\setuplabeltext [\s!da] [\v!february=februar] +\setuplabeltext [\s!da] [\v!march=marts] +\setuplabeltext [\s!da] [\v!april=april] +\setuplabeltext [\s!da] [\v!may=maj] +\setuplabeltext [\s!da] [\v!june=juni] +\setuplabeltext [\s!da] [\v!july=juli] +\setuplabeltext [\s!da] [\v!august=august] +\setuplabeltext [\s!da] [\v!september=september] +\setuplabeltext [\s!da] [\v!october=oktober] +\setuplabeltext [\s!da] [\v!november=november] +\setuplabeltext [\s!da] [\v!december=december] + +\setuplabeltext [\s!sv] [\v!january=januari] +\setuplabeltext [\s!sv] [\v!february=februari] +\setuplabeltext [\s!sv] [\v!march=mars] +\setuplabeltext [\s!sv] [\v!april=april] +\setuplabeltext [\s!sv] [\v!may=maj] +\setuplabeltext [\s!sv] [\v!june=juni] +\setuplabeltext [\s!sv] [\v!july=juli] +\setuplabeltext [\s!sv] [\v!august=augusti] +\setuplabeltext [\s!sv] [\v!september=september] +\setuplabeltext [\s!sv] [\v!october=oktober] +\setuplabeltext [\s!sv] [\v!november=november] +\setuplabeltext [\s!sv] [\v!december=december] + +\setuplabeltext [\s!af] [\v!january=januarie] +\setuplabeltext [\s!af] [\v!february=februarie] +\setuplabeltext [\s!af] [\v!march=maart] +\setuplabeltext [\s!af] [\v!april=april] +\setuplabeltext [\s!af] [\v!may=mei] +\setuplabeltext [\s!af] [\v!june=junie] +\setuplabeltext [\s!af] [\v!july=julie] +\setuplabeltext [\s!af] [\v!august=augustus] +\setuplabeltext [\s!af] [\v!september=september] +\setuplabeltext [\s!af] [\v!october=oktober] +\setuplabeltext [\s!af] [\v!november=november] +\setuplabeltext [\s!af] [\v!december=desember] + +\setuplabeltext [\s!nb] [\v!january=januar] +\setuplabeltext [\s!nb] [\v!february=februar] +\setuplabeltext [\s!nb] [\v!march=mars] +\setuplabeltext [\s!nb] [\v!april=april] +\setuplabeltext [\s!nb] [\v!may=mai] +\setuplabeltext [\s!nb] [\v!june=juni] +\setuplabeltext [\s!nb] [\v!july=juli] +\setuplabeltext [\s!nb] [\v!august=august] +\setuplabeltext [\s!nb] [\v!september=september] +\setuplabeltext [\s!nb] [\v!october=oktober] +\setuplabeltext [\s!nb] [\v!november=november] +\setuplabeltext [\s!nb] [\v!december=desember] + +\setuplabeltext [\s!nn] [\v!january=januar] +\setuplabeltext [\s!nn] [\v!february=februar] +\setuplabeltext [\s!nn] [\v!march=mars] +\setuplabeltext [\s!nn] [\v!april=april] +\setuplabeltext [\s!nn] [\v!may=mai] +\setuplabeltext [\s!nn] [\v!june=juni] +\setuplabeltext [\s!nn] [\v!july=juli] +\setuplabeltext [\s!nn] [\v!august=august] +\setuplabeltext [\s!nn] [\v!september=september] +\setuplabeltext [\s!nn] [\v!october=oktober] +\setuplabeltext [\s!nn] [\v!november=november] +\setuplabeltext [\s!nn] [\v!december=desember] + +\setuplabeltext [\s!en] [\v!sunday=Sunday] +\setuplabeltext [\s!en] [\v!monday=Monday] +\setuplabeltext [\s!en] [\v!tuesday=Tuesday] +\setuplabeltext [\s!en] [\v!wednesday=Wednesday] +\setuplabeltext [\s!en] [\v!thursday=Thursday] +\setuplabeltext [\s!en] [\v!friday=Friday] +\setuplabeltext [\s!en] [\v!saturday=Saturday] + +\setuplabeltext [\s!nl] [\v!sunday=zondag] +\setuplabeltext [\s!nl] [\v!monday=maandag] +\setuplabeltext [\s!nl] [\v!tuesday=dinsdag] +\setuplabeltext [\s!nl] [\v!wednesday=woensdag] +\setuplabeltext [\s!nl] [\v!thursday=donderdag] +\setuplabeltext [\s!nl] [\v!friday=vrijdag] +\setuplabeltext [\s!nl] [\v!saturday=zaterdag] + +\setuplabeltext [\s!de] [\v!sunday=Sonntag] +\setuplabeltext [\s!de] [\v!monday=Montag] +\setuplabeltext [\s!de] [\v!tuesday=Dienstag] +\setuplabeltext [\s!de] [\v!wednesday=Mittwoch] +\setuplabeltext [\s!de] [\v!thursday=Donnerstag] +\setuplabeltext [\s!de] [\v!friday=Freitag] +\setuplabeltext [\s!de] [\v!saturday=Samstag] + +\setuplabeltext [\s!da] [\v!sunday=s\ostroke ndag] +\setuplabeltext [\s!da] [\v!monday=mandag] +\setuplabeltext [\s!da] [\v!tuesday=tirsdag] +\setuplabeltext [\s!da] [\v!wednesday=onsdag] +\setuplabeltext [\s!da] [\v!thursday=torsdag] +\setuplabeltext [\s!da] [\v!friday=fredag] +\setuplabeltext [\s!da] [\v!saturday=l\ostroke rdag] + +\setuplabeltext [\s!sv] [\v!sunday=s\oumlaut ndag] +\setuplabeltext [\s!sv] [\v!monday=m\aring ndag] +\setuplabeltext [\s!sv] [\v!tuesday=tisdag] +\setuplabeltext [\s!sv] [\v!wednesday=onsdag] +\setuplabeltext [\s!sv] [\v!thursday=torsdag] +\setuplabeltext [\s!sv] [\v!friday=fredag] +\setuplabeltext [\s!sv] [\v!saturday=l\oumlaut rdag] + +\setuplabeltext [\s!af] [\v!sunday=sondag] +\setuplabeltext [\s!af] [\v!monday=maandag] +\setuplabeltext [\s!af] [\v!tuesday=dinsdag] +\setuplabeltext [\s!af] [\v!wednesday=woensdag] +\setuplabeltext [\s!af] [\v!thursday=donderdag] +\setuplabeltext [\s!af] [\v!friday=vrydag] +\setuplabeltext [\s!af] [\v!saturday=saterdag] + +\setuplabeltext [\s!nb] [\v!sunday=s\ostroke ndag] +\setuplabeltext [\s!nb] [\v!monday=mandag] +\setuplabeltext [\s!nb] [\v!tuesday=tirsdag] +\setuplabeltext [\s!nb] [\v!wednesday=onsdag] +\setuplabeltext [\s!nb] [\v!thursday=torsdag] +\setuplabeltext [\s!nb] [\v!friday=fredag] +\setuplabeltext [\s!nb] [\v!saturday=l\ostroke rdag] + +\setuplabeltext [\s!nn] [\v!sunday=sundag] +\setuplabeltext [\s!nn] [\v!monday=m\aring ndag] +\setuplabeltext [\s!nn] [\v!tuesday=tysdag] +\setuplabeltext [\s!nn] [\v!wednesday=onsdag] +\setuplabeltext [\s!nn] [\v!thursday=torsdag] +\setuplabeltext [\s!nn] [\v!friday=fredag] +\setuplabeltext [\s!nn] [\v!saturday=laurdag] + +%D Rather new ... + +\setuplabeltext [\s!nl] [\v!page=pagina ] +\setuplabeltext [\s!nl] [\v!atpage=op pagina ] +\setuplabeltext [\s!nl] [\v!hencefore=hierboven] +\setuplabeltext [\s!nl] [\v!hereafter=hieronder] +\setuplabeltext [\s!nl] [\v!see=zie ] +\setuplabeltext [\s!nl] [\v!and= en ] +\setuplabeltext [\s!nl] [\v!continued={ (vervolged)}] + +\setuplabeltext [\s!en] [\v!page=page ] +\setuplabeltext [\s!en] [\v!atpage=at page ] +\setuplabeltext [\s!en] [\v!hencefore=as we show above] +\setuplabeltext [\s!en] [\v!hereafter=as we show below] +\setuplabeltext [\s!en] [\v!see=see ] +\setuplabeltext [\s!en] [\v!and= and ] +\setuplabeltext [\s!en] [\v!continued={ (continued)}] + +\setuplabeltext [\s!de] [\v!page=Seite ] +\setuplabeltext [\s!de] [\v!atpage=auf Seite ] +\setuplabeltext [\s!de] [\v!hencefore=siehe oben] +\setuplabeltext [\s!de] [\v!hereafter=siehe unten] +\setuplabeltext [\s!de] [\v!see=siehe ] +\setuplabeltext [\s!de] [\v!and= und ] + +\setuplabeltext [\s!da] [\v!page=Side ] +\setuplabeltext [\s!da] [\v!atpage=p\aring\ side ] +\setuplabeltext [\s!da] [\v!hencefore=se foroven] +\setuplabeltext [\s!da] [\v!hereafter=se forneden] +\setuplabeltext [\s!da] [\v!see=se ] + +\setuplabeltext [\s!sv] [\v!page=Sida ] +\setuplabeltext [\s!sv] [\v!atpage=p\aring\ sida ] +\setuplabeltext [\s!sv] [\v!hencefore=se ovan] +\setuplabeltext [\s!sv] [\v!hereafter=se nedan] +\setuplabeltext [\s!sv] [\v!see=se ] + +\setuplabeltext [\s!nb] [\v!page=side ] +\setuplabeltext [\s!nb] [\v!atpage=p\aring\ side ] +\setuplabeltext [\s!nb] [\v!hencefore=som vist over] +\setuplabeltext [\s!nb] [\v!hereafter=som vist under] +\setuplabeltext [\s!nb] [\v!see=se ] + +\setuplabeltext [\s!nn] [\v!page=side ] +\setuplabeltext [\s!nn] [\v!atpage=p\aring\ side ] +\setuplabeltext [\s!nn] [\v!hencefore=som vist over] +\setuplabeltext [\s!nn] [\v!hereafter=som vist under] +\setuplabeltext [\s!nn] [\v!see=sj\aring\ ] + +%D ... and to be completed! + +%D Next we implement couple of ordinal mumber converters: + +\def\enordinaldaynumber#1% + {#1\ifnum\lasttwodigits{#1}=11 + \highordinalstr{th}% + \else\ifnum\lasttwodigits{#1}=12 + \highordinalstr{th}% + \else\ifnum\lasttwodigits{#1}=13 + \highordinalstr{th}% + \else\ifcase\lastdigit{#1}% + \highordinalstr{th}% + \or % 1 + \highordinalstr{st}% + \or % 2 + \highordinalstr{nd}% + \or % 3 + \highordinalstr{rd}% + \else + \highordinalstr{th}% + \fi\fi\fi\fi} + +% \def\enordinaldaynumber#1% +% {#1\ordinalstr{\ifnum\lasttwodigits{#1}=11 th\else\ifcase\lastdigit{#1} +% th\or st\or nd\or rd\else th\fi\fi}} + +\def\nlordinaldaynumber#1% + {#1\highordinalstr{e}} + +%D \ShowAllLanguageValues [\s!en] [english] {English} {horn} % engelse humor +%D \ShowAllLanguageValues [\s!nl] [dutch] {Dutch} {treat} % nederlandse zuinigheid +%D \ShowAllLanguageValues [\s!de] [german] {German} {beer} % duitse degelijkheid +%D \ShowAllLanguageValues [\s!da] [danish] {Danish} {pastry} +%D \ShowAllLanguageValues [\s!sv] [swedish] {Swedish} {design} +%D \ShowAllLanguageValues [\s!af] [afrikaans] {Afrikaaner} {boer} % afrikaanse gasvryheid +%D \ShowAllLanguageValues [\s!nb] [bokmal] {Norwegian} {wood} +%D \ShowAllLanguageValues [\s!nn] [nynorsk] {Norwegian} {fish} + +%D Extra month names: + +\setuplabeltext [\s!en] [\v!january :\s!mnem=jan] +\setuplabeltext [\s!en] [\v!february :\s!mnem=feb] +\setuplabeltext [\s!en] [\v!march :\s!mnem=mar] +\setuplabeltext [\s!en] [\v!april :\s!mnem=apr] +\setuplabeltext [\s!en] [\v!may :\s!mnem=may] +\setuplabeltext [\s!en] [\v!june :\s!mnem=jun] +\setuplabeltext [\s!en] [\v!july :\s!mnem=jul] +\setuplabeltext [\s!en] [\v!august :\s!mnem=aug] +\setuplabeltext [\s!en] [\v!september:\s!mnem=sep] +\setuplabeltext [\s!en] [\v!october :\s!mnem=oct] +\setuplabeltext [\s!en] [\v!november :\s!mnem=nov] +\setuplabeltext [\s!en] [\v!december :\s!mnem=dec] + +\setuplabeltext [\s!nb] [\v!january :\s!mnem=jan.] +\setuplabeltext [\s!nb] [\v!february :\s!mnem=feb.] +\setuplabeltext [\s!nb] [\v!march :\s!mnem=mars] +\setuplabeltext [\s!nb] [\v!april :\s!mnem=april] +\setuplabeltext [\s!nb] [\v!may :\s!mnem=mai] +\setuplabeltext [\s!nb] [\v!june :\s!mnem=juni] +\setuplabeltext [\s!nb] [\v!july :\s!mnem=juli] +\setuplabeltext [\s!nb] [\v!august :\s!mnem=aug.] +\setuplabeltext [\s!nb] [\v!september:\s!mnem=sep.] +\setuplabeltext [\s!nb] [\v!october :\s!mnem=okt.] +\setuplabeltext [\s!nb] [\v!november :\s!mnem=nov.] +\setuplabeltext [\s!nb] [\v!december :\s!mnem=des.] + +\setuplabeltext [\s!nn] [\v!january :\s!mnem=jan.] +\setuplabeltext [\s!nn] [\v!february :\s!mnem=feb.] +\setuplabeltext [\s!nn] [\v!march :\s!mnem=mars] +\setuplabeltext [\s!nn] [\v!april :\s!mnem=april] +\setuplabeltext [\s!nn] [\v!may :\s!mnem=mai] +\setuplabeltext [\s!nn] [\v!june :\s!mnem=juni] +\setuplabeltext [\s!nn] [\v!july :\s!mnem=juli] +\setuplabeltext [\s!nn] [\v!august :\s!mnem=aug.] +\setuplabeltext [\s!nn] [\v!september:\s!mnem=sep.] +\setuplabeltext [\s!nn] [\v!october :\s!mnem=okt.] +\setuplabeltext [\s!nn] [\v!november :\s!mnem=nov.] +\setuplabeltext [\s!nn] [\v!december :\s!mnem=des.] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-ger.tex b/Master/texmf-dist/tex/context/base/lang-ger.tex deleted file mode 100644 index 1ffbb33e68c..00000000000 --- a/Master/texmf-dist/tex/context/base/lang-ger.tex +++ /dev/null @@ -1,738 +0,0 @@ -%D \module -%D [ file=lang-ger, -%D version=1997.09.03, -%D title=\CONTEXT\ Language Macros, -%D subtitle=Germanic 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. - -\writestatus{loading}{ConTeXt Language Macros / Germanic Languages} - -%D The framework of this module is set up by Hans Hagen while -%D many of the first translations were done by Tobias. Later -%D on, corrections were made by users. If you have suggestions, -%D or feel that your name missing here, don't hesitate to send -%D us an email. -%D -%D \starttabulate[|lB|l|] -%D \NC Norwegian \NC Hans Fredrik Nordhaug \NC \NR -%D \NC Danish \NC Arne Jorgensen \NC \NR % check the o -%D \NC Afrikaans \NC \NC \NR -%D \stoptabulate - -% Danish, Faeroese, Icelandic, Norwegian, Swedish, German, Yiddish -% Afrikaans, Dutch, English, Flemush, Frisian, Plattdeutsch - -\unprotect - -\installlanguage - [\s!nl] - [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, - \c!leftquote=\lowerleftsingleninequote, - \c!rightquote=\upperrightsingleninequote, - \c!leftquotation=\lowerleftdoubleninequote, - \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!day,\ ,\v!month,\ ,\v!year}, - \s!mapping={texnansi,ec}, - \s!encoding={texnansi,ec}] - -\installlanguage - [\s!en] - [\c!spacing=\v!broad, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, - \c!leftquote=\upperleftsinglesixquote, - \c!rightquote=\upperrightsingleninequote, - \c!leftquotation=\upperleftdoublesixquote, - \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!month,\ ,\v!day,{,\ },\v!year}, - \s!patterns=\s!us, - \s!lefthyphenmin=2, - \s!righthyphenmin=3] - -\installlanguage - [\s!de] - [\c!spacing=\v!packed, - \s!lefthyphenmin=3, - \s!righthyphenmin=3, - \c!leftsentence={\hbox{--~}}, - \c!rightsentence={\hbox{~--}}, - \c!leftsubsentence={--}, - \c!rightsubsentence={--}, - \c!leftquote=\lowerleftsingleninequote, - \c!rightquote=\upperrightsinglesixquote, - \c!leftquotation=\lowerleftdoubleninequote, - \c!rightquotation=\upperrightdoublesixquote, - \c!date={\v!day,{.},\ ,\v!month,\ ,\v!year}, - \s!mapping={texnansi,ec}, - \s!encoding={texnansi,ec}] - -\installlanguage - [\s!da] - [\c!spacing=\v!packed, - \c!leftsentence={\hbox{--\hskip.5em}}, - \c!rightsentence={\hbox{\hskip.5em--}}, - \c!leftsubsentence={--}, - \c!rightsubsentence={--}, - \c!leftquote=\lowerleftsingleninequote, - \c!rightquote=\upperrightsinglesixquote, - \c!leftquotation=\lowerleftdoubleninequote, - \c!rightquotation=\upperrightdoublesixquote, - \c!date={\v!day,{.},\ ,\v!month,\ ,\v!year}] - -\installlanguage - [\s!sv] - [\c!spacing=\v!packed, - \c!leftsentence={\hbox{--~}}, - \c!rightsentence={\hbox{~--}}, - \c!leftsubsentence={--}, - \c!rightsubsentence={--}, - \c!leftquote=\upperrightsingleninequote, - \c!rightquote=\upperrightsingleninequote, - \c!leftquotation=\upperrightdoubleninequote, - \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!day,\ ,\v!month,\ ,\v!year}] - -\installlanguage - [\s!af] - [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, - \c!leftquote=\upperleftsinglesixquote, - \c!rightquote=\upperrightsingleninequote, - \c!leftquotation=\upperleftdoublesixquote, - \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!year,\ ,\v!month,\ ,\v!day}, - \s!patterns=\s!nl] - -\installlanguage - [\s!nb] - [spacing=packed, - lefthyphenmin=2, - righthyphenmin=2, - leftsentence=---, - rightsentence=---, - leftsubsentence=---, - rightsubsentence=---, - leftquote=\upperleftsinglesixquote, - rightquote=\upperrightsingleninequote, - leftquotation=\leftguillemot, - rightquotation=\rightguillemot, - date={day,{.},\ ,month,\ ,year}, - state=stop] - -\installlanguage - [\s!nn] - [spacing=packed, - lefthyphenmin=2, - righthyphenmin=2, - leftsentence=---, - rightsentence=---, - leftsubsentence=---, - rightsubsentence=---, - leftquote=\upperleftsinglesixquote, - rightquote=\upperrightsingleninequote, - leftquotation=\leftguillemot, - rightquotation=\rightguillemot, - date={day,{.},\ ,month,\ ,year}, - state=stop] - -\installlanguage [\s!no] [\s!nb] -\installlanguage [\s!norwegian] [\s!nb] -\installlanguage [\s!bokmal] [\s!nb] -\installlanguage [\s!nynorsk] [\s!nn] - -%D Extra: - -% \mainlanguage[en] -% \mainlanguage[de] -% \mainlanguage[deo] -% \mainlanguage[de-de] -% \mainlanguage[de-at] -% \mainlanguage[de-ch] -% -% \starttext -% Die Herren Meier\index{Meier}, Müller\index{Müller}, Huber\index{Huber} -% und Schmidt\index{Schmidt} arbeiten in der gleichen Firma. -% -% \index{Mass}\index{Mas}\index{Maß}\index{Maße}\index{Masse} -% \index{Muller}\index{Mûller} -% \index{Hutte}\index{Hütte}\index{Huttf} -% \index{paar}\index{Paar} -% \index{a}\index{aa}\index{ä}\index{az}\index{aza} -% \index{o}\index{oo}\index{ö}\index{oz}\index{oza} -% \index{u}\index{uu}\index{ü}\index{uz}\index{uza}\index{üa} -% \index{call}\index{chip} -% -% \subject{Index} \placeindex -% \stoptext - -\installlanguage % old german - [deo] - [\c!spacing=\v!packed, - \c!default=\s!de] - -\installlanguage - [de-de] - [\c!spacing=\v!packed, - \c!default=\s!de] - -\installlanguage - [de-at] - [\c!spacing=\v!packed, - \c!default=\s!de, - \c!leftquote=\leftguillemot, - \c!rightquote=\rightguillemot, - \c!leftquotation=\leftguillemot, - \c!rightquotation=\rightguillemot] - -\installlanguage - [de-ch] - [\c!spacing=\v!packed, - \c!default=\s!de] - -%D And some alternative (but very real) english patterns: - -\installlanguage - [en-gb] - [\c!default=\s!en, - \s!patterns=\s!gb, - \s!lefthyphenmin=3, - \s!righthyphenmin=3] - -\installlanguage - [en-us] - [\c!default=\s!en] - -\installlanguage [\s!uk] [en-gb] -\installlanguage [\s!us] [en-us] - -%D For compatibility reasons we also define: - -%installlanguage [du] [\s!de] % old times context -%installlanguage [sp] [\s!es] % old times context /lang-ita - -\installlanguage [usenglish] [en-us] -\installlanguage [ukenglish] [en-gb] -\installlanguage [english] [en-us] -\installlanguage [dutch] [\s!nl] -\installlanguage [german] [\s!de] -\installlanguage [danish] [\s!da] -\installlanguage [swedish] [\s!sv] -\installlanguage [afrikaans] [\s!af] - -\setupheadtext [\s!en] [\v!content=Contents] -\setupheadtext [\s!nl] [\v!content=Inhoud] -\setupheadtext [\s!de] [\v!content=Inhalt] -\setupheadtext [\s!da] [\v!content=Indhold] -\setupheadtext [\s!sv] [\v!content=Inneh\aring ll] -\setupheadtext [\s!af] [\v!content=Inhoud] -\setupheadtext [\s!nb] [\v!content=Innhold] -\setupheadtext [\s!nn] [\v!content=Innhald] - -\setupheadtext [\s!en] [\v!tables=Tables] -\setupheadtext [\s!nl] [\v!tables=Tabellen] -\setupheadtext [\s!de] [\v!tables=Tabellen] -\setupheadtext [\s!da] [\v!tables=Tabeller] -\setupheadtext [\s!sv] [\v!tables=Tabeller] -\setupheadtext [\s!af] [\v!tables=Tabelle] -\setupheadtext [\s!nb] [\v!tables=Tabeller] -\setupheadtext [\s!nn] [\v!tables=Tabellar] - -\setupheadtext [\s!en] [\v!figures=Figures] -\setupheadtext [\s!nl] [\v!figures=Figuren] -\setupheadtext [\s!de] [\v!figures=Abbildungen] -\setupheadtext [\s!da] [\v!figures=Figurer] -\setupheadtext [\s!sv] [\v!figures=Figurer] -\setupheadtext [\s!af] [\v!figures=Figure] -\setupheadtext [\s!nb] [\v!figures=Figurer] -\setupheadtext [\s!nn] [\v!figures=Figurar] - -\setupheadtext [\s!en] [\v!graphics=Graphics] -\setupheadtext [\s!nl] [\v!graphics=Grafieken] -\setupheadtext [\s!de] [\v!graphics=Graphiken] -\setupheadtext [\s!da] [\v!graphics=Grafik] -\setupheadtext [\s!sv] [\v!graphics=Grafik] -\setupheadtext [\s!af] [\v!graphics=Grafieke] -\setupheadtext [\s!nb] [\v!graphics=Bilde] -\setupheadtext [\s!nn] [\v!graphics=Bilete] - -\setupheadtext [\s!en] [\v!intermezzi=Intermezzos] -\setupheadtext [\s!nl] [\v!intermezzi=Intermezzo's] -\setupheadtext [\s!de] [\v!intermezzi=Intermezzi] -\setupheadtext [\s!da] [\v!intermezzi=Intermezzoer] -\setupheadtext [\s!sv] [\v!intermezzi=Intermezzon] -\setupheadtext [\s!af] [\v!intermezzi=Intermezzos] -\setupheadtext [\s!nb] [\v!intermezzi=Intermesso] -\setupheadtext [\s!nn] [\v!intermezzi=Intermesso] - -\setupheadtext [\s!en] [\v!index=Index] -\setupheadtext [\s!nl] [\v!index=Index] -\setupheadtext [\s!de] [\v!index=Index] -\setupheadtext [\s!da] [\v!index=Indeks] -\setupheadtext [\s!sv] [\v!index=Sakregister] -\setupheadtext [\s!af] [\v!index=Indeks] -\setupheadtext [\s!nb] [\v!index=Register] -\setupheadtext [\s!nn] [\v!index=Register] - -\setupheadtext [\s!en] [\v!abbreviations=Abbreviations] -\setupheadtext [\s!nl] [\v!abbreviations=Afkortingen] -\setupheadtext [\s!de] [\v!abbreviations=Abk\uumlaut rzungen] -\setupheadtext [\s!da] [\v!abbreviations=Forkortelser] -\setupheadtext [\s!sv] [\v!abbreviations=F\oumlaut rkortningar] -\setupheadtext [\s!af] [\v!abbreviations=Afkortings] -\setupheadtext [\s!nb] [\v!abbreviations=Forkortelser] -\setupheadtext [\s!nn] [\v!abbreviations=Forkortingar] - -\setupheadtext [\s!en] [\v!logos=Logos] -\setupheadtext [\s!nl] [\v!logos=Logo's] -\setupheadtext [\s!de] [\v!logos=Logos] -\setupheadtext [\s!da] [\v!logos=Logoer] -\setupheadtext [\s!sv] [\v!logos=Loggor] -\setupheadtext [\s!af] [\v!logos=Logos] -\setupheadtext [\s!nb] [\v!logos=Logoer] -\setupheadtext [\s!nn] [\v!logos=Logoar] - -\setupheadtext [\s!en] [\v!units=Units] -\setupheadtext [\s!nl] [\v!units=Eenheden] -\setupheadtext [\s!de] [\v!units=Einheiten] -\setupheadtext [\s!da] [\v!units=Enheder] -\setupheadtext [\s!sv] [\v!units=Enheter] -\setupheadtext [\s!af] [\v!units=Eenhede] -\setupheadtext [\s!nb] [\v!units=Enheter] -\setupheadtext [\s!nn] [\v!units=Einingar] - -\setupheadtext [\s!en] [pubs=References] -\setupheadtext [\s!nl] [pubs=Literatuur] -\setupheadtext [\s!de] [pubs=Literatur] -%setupheadtext [\s!da] [pubs=?] -%setupheadtext [\s!sv] [pubs=?] -%setupheadtext [\s!af] [pubs=?] -%setupheadtext [\s!nb] [pubs=?] -%setupheadtext [\s!nn] [pubs=?] - -\setuplabeltext [\s!en] [\v!table=Table ] -\setuplabeltext [\s!nl] [\v!table=Tabel ] -\setuplabeltext [\s!de] [\v!table=Tabelle ] -\setuplabeltext [\s!da] [\v!table=Tabel ] -\setuplabeltext [\s!sv] [\v!table=Tabell ] -\setuplabeltext [\s!af] [\v!table=Tabel] -\setuplabeltext [\s!nb] [\v!table=Tabell ] -\setuplabeltext [\s!nn] [\v!table=Tabell ] - -\setuplabeltext [\s!en] [\v!figure=Figure ] -\setuplabeltext [\s!nl] [\v!figure=Figuur ] -\setuplabeltext [\s!de] [\v!figure=Abbildung ] -\setuplabeltext [\s!da] [\v!figure=Figur ] -\setuplabeltext [\s!sv] [\v!figure=Figur ] -\setuplabeltext [\s!af] [\v!figure=Figuur ] -\setuplabeltext [\s!nb] [\v!figure=Figur ] -\setuplabeltext [\s!nn] [\v!figure=Figur ] - -\setuplabeltext [\s!en] [\v!intermezzo=Intermezzo ] -\setuplabeltext [\s!nl] [\v!intermezzo=Intermezzo ] -\setuplabeltext [\s!de] [\v!intermezzo=Intermezzo ] -\setuplabeltext [\s!da] [\v!intermezzo=Intermezzo ] -\setuplabeltext [\s!sv] [\v!intermezzo=Intermezzo ] -\setuplabeltext [\s!af] [\v!intermezzo=Intermezzo ] -\setuplabeltext [\s!nb] [\v!intermezzo=Intermesso ] -\setuplabeltext [\s!nn] [\v!intermezzo=Intermesso ] - -\setuplabeltext [\s!en] [\v!graphic=Graphic ] -\setuplabeltext [\s!nl] [\v!graphic=Grafiek ] -\setuplabeltext [\s!de] [\v!graphic=Graphik ] -\setuplabeltext [\s!da] [\v!graphic=Grafik ] -\setuplabeltext [\s!sv] [\v!graphic=Grafik ] -\setuplabeltext [\s!af] [\v!graphic=Grafiek ] -\setuplabeltext [\s!nb] [\v!graphic=Bilde ] -\setuplabeltext [\s!nn] [\v!graphic=Bilete ] - -%D We don't set these here. One can do that in a style. - -\setuplabeltext [\s!en] [\v!chapter=] % Chapter -\setuplabeltext [\s!nl] [\v!chapter=] -\setuplabeltext [\s!de] [\v!chapter=] % Kapitel -\setuplabeltext [\s!da] [\v!chapter=] -\setuplabeltext [\s!sv] [\v!chapter=] -\setuplabeltext [\s!af] [\v!chapter=] % Hoofstuk -\setuplabeltext [\s!nb] [\v!chapter=] -\setuplabeltext [\s!nn] [\v!chapter=] - -\setuplabeltext [\s!en] [\v!section=] -\setuplabeltext [\s!nl] [\v!section=] -\setuplabeltext [\s!de] [\v!section=] -\setuplabeltext [\s!da] [\v!section=] -\setuplabeltext [\s!sv] [\v!section=] -\setuplabeltext [\s!af] [\v!section=] % Paragraaf -\setuplabeltext [\s!nb] [\v!section=] -\setuplabeltext [\s!nn] [\v!section=] - -\setuplabeltext [\s!en] [\v!subsection=] -\setuplabeltext [\s!nl] [\v!subsection=] -\setuplabeltext [\s!de] [\v!subsection=] -\setuplabeltext [\s!da] [\v!subsection=] -\setuplabeltext [\s!sv] [\v!subsection=] -\setuplabeltext [\s!af] [\v!subsection=] -\setuplabeltext [\s!nb] [\v!subsection=] -\setuplabeltext [\s!nn] [\v!subsection=] - -\setuplabeltext [\s!en] [\v!subsubsection=] -\setuplabeltext [\s!nl] [\v!subsubsection=] -\setuplabeltext [\s!de] [\v!subsubsection=] -\setuplabeltext [\s!da] [\v!subsubsection=] -\setuplabeltext [\s!sv] [\v!subsubsection=] -\setuplabeltext [\s!af] [\v!subsubsection=] -\setuplabeltext [\s!nb] [\v!subsubsection=] -\setuplabeltext [\s!nn] [\v!subsubsection=] - -\setuplabeltext [\s!en] [\v!subsubsubsection=] -\setuplabeltext [\s!nl] [\v!subsubsubsection=] -\setuplabeltext [\s!de] [\v!subsubsubsection=] -\setuplabeltext [\s!da] [\v!subsubsubsection=] -\setuplabeltext [\s!sv] [\v!subsubsubsection=] -\setuplabeltext [\s!af] [\v!subsubsubsection=] -\setuplabeltext [\s!nb] [\v!subsubsubsection=] -\setuplabeltext [\s!nn] [\v!subsubsubsection=] - -\setuplabeltext [\s!en] [\v!appendix=] % Appendix -\setuplabeltext [\s!nl] [\v!appendix=] -\setuplabeltext [\s!de] [\v!appendix=] % Anhang -\setuplabeltext [\s!da] [\v!appendix=] % Bilag -\setuplabeltext [\s!sv] [\v!appendix=] -\setuplabeltext [\s!af] [\v!appendix=] % Bylae -\setuplabeltext [\s!nb] [\v!appendix=] % Tillegg -\setuplabeltext [\s!nn] [\v!appendix=] % Tillegg - -\setuplabeltext [\s!en] [\v!part=Part ] -\setuplabeltext [\s!nl] [\v!part=Deel ] -\setuplabeltext [\s!de] [\v!part=Teil ] -\setuplabeltext [\s!da] [\v!part=Del ] -\setuplabeltext [\s!sv] [\v!part=Del ] -\setuplabeltext [\s!af] [\v!part=Deel ] -\setuplabeltext [\s!nb] [\v!part=Del] -\setuplabeltext [\s!nn] [\v!part=Del] - -\setuplabeltext [\s!en] [\v!line=line ] -\setuplabeltext [\s!nl] [\v!line=regel ] -\setuplabeltext [\s!de] [\v!line=Zeile ] -\setuplabeltext [\s!da] [\v!line=linie ] % or linje -\setuplabeltext [\s!sv] [\v!line=rad ] -\setuplabeltext [\s!af] [\v!line=re\ediaeresis l ] -\setuplabeltext [\s!nb] [\v!line=linje ] -\setuplabeltext [\s!nn] [\v!line=linje ] - -\setuplabeltext [\s!en] [\v!lines=lines ] -\setuplabeltext [\s!nl] [\v!lines=regels ] -\setuplabeltext [\s!de] [\v!lines=Zeilen ] -\setuplabeltext [\s!da] [\v!lines=linier ] % or linjer -\setuplabeltext [\s!sv] [\v!lines=rader ] -\setuplabeltext [\s!af] [\v!lines=re\ediaeresis ls ] -\setuplabeltext [\s!nb] [\v!lines=linjer ] -\setuplabeltext [\s!nn] [\v!lines=linjer ] - -\setuplabeltext [\s!en] [\v!january=January] -\setuplabeltext [\s!en] [\v!february=February] -\setuplabeltext [\s!en] [\v!march=March] -\setuplabeltext [\s!en] [\v!april=April] -\setuplabeltext [\s!en] [\v!may=May] -\setuplabeltext [\s!en] [\v!june=June] -\setuplabeltext [\s!en] [\v!july=July] -\setuplabeltext [\s!en] [\v!august=August] -\setuplabeltext [\s!en] [\v!september=September] -\setuplabeltext [\s!en] [\v!october=October] -\setuplabeltext [\s!en] [\v!november=November] -\setuplabeltext [\s!en] [\v!december=December] - -\setuplabeltext [\s!nl] [\v!january=januari] -\setuplabeltext [\s!nl] [\v!february=februari] -\setuplabeltext [\s!nl] [\v!march=maart] -\setuplabeltext [\s!nl] [\v!april=april] -\setuplabeltext [\s!nl] [\v!may=mei] -\setuplabeltext [\s!nl] [\v!june=juni] -\setuplabeltext [\s!nl] [\v!july=juli] -\setuplabeltext [\s!nl] [\v!august=augustus] -\setuplabeltext [\s!nl] [\v!september=september] -\setuplabeltext [\s!nl] [\v!october=oktober] -\setuplabeltext [\s!nl] [\v!november=november] -\setuplabeltext [\s!nl] [\v!december=december] - -\setuplabeltext [\s!de] [\v!january=Januar] -\setuplabeltext [\s!de] [\v!february=Februar] -\setuplabeltext [\s!de] [\v!march=M\aumlaut rz] -\setuplabeltext [\s!de] [\v!april=April] -\setuplabeltext [\s!de] [\v!may=Mai] -\setuplabeltext [\s!de] [\v!june=Juni] -\setuplabeltext [\s!de] [\v!july=Juli] -\setuplabeltext [\s!de] [\v!august=August] -\setuplabeltext [\s!de] [\v!september=September] -\setuplabeltext [\s!de] [\v!october=Oktober] -\setuplabeltext [\s!de] [\v!november=November] -\setuplabeltext [\s!de] [\v!december=Dezember] - -\setuplabeltext [\s!da] [\v!january=januar] -\setuplabeltext [\s!da] [\v!february=februar] -\setuplabeltext [\s!da] [\v!march=marts] -\setuplabeltext [\s!da] [\v!april=april] -\setuplabeltext [\s!da] [\v!may=maj] -\setuplabeltext [\s!da] [\v!june=juni] -\setuplabeltext [\s!da] [\v!july=juli] -\setuplabeltext [\s!da] [\v!august=august] -\setuplabeltext [\s!da] [\v!september=september] -\setuplabeltext [\s!da] [\v!october=oktober] -\setuplabeltext [\s!da] [\v!november=november] -\setuplabeltext [\s!da] [\v!december=december] - -\setuplabeltext [\s!sv] [\v!january=januari] -\setuplabeltext [\s!sv] [\v!february=februari] -\setuplabeltext [\s!sv] [\v!march=mars] -\setuplabeltext [\s!sv] [\v!april=april] -\setuplabeltext [\s!sv] [\v!may=maj] -\setuplabeltext [\s!sv] [\v!june=juni] -\setuplabeltext [\s!sv] [\v!july=juli] -\setuplabeltext [\s!sv] [\v!august=augusti] -\setuplabeltext [\s!sv] [\v!september=september] -\setuplabeltext [\s!sv] [\v!october=oktober] -\setuplabeltext [\s!sv] [\v!november=november] -\setuplabeltext [\s!sv] [\v!december=december] - -\setuplabeltext [\s!af] [\v!january=januarie] -\setuplabeltext [\s!af] [\v!february=februarie] -\setuplabeltext [\s!af] [\v!march=maart] -\setuplabeltext [\s!af] [\v!april=april] -\setuplabeltext [\s!af] [\v!may=mei] -\setuplabeltext [\s!af] [\v!june=junie] -\setuplabeltext [\s!af] [\v!july=julie] -\setuplabeltext [\s!af] [\v!august=augustus] -\setuplabeltext [\s!af] [\v!september=september] -\setuplabeltext [\s!af] [\v!october=oktober] -\setuplabeltext [\s!af] [\v!november=november] -\setuplabeltext [\s!af] [\v!december=desember] - -\setuplabeltext [\s!nb] [\v!january=januar] -\setuplabeltext [\s!nb] [\v!february=februar] -\setuplabeltext [\s!nb] [\v!march=mars] -\setuplabeltext [\s!nb] [\v!april=april] -\setuplabeltext [\s!nb] [\v!may=mai] -\setuplabeltext [\s!nb] [\v!june=juni] -\setuplabeltext [\s!nb] [\v!july=juli] -\setuplabeltext [\s!nb] [\v!august=august] -\setuplabeltext [\s!nb] [\v!september=september] -\setuplabeltext [\s!nb] [\v!october=oktober] -\setuplabeltext [\s!nb] [\v!november=november] -\setuplabeltext [\s!nb] [\v!december=desember] - -\setuplabeltext [\s!nn] [\v!january=januar] -\setuplabeltext [\s!nn] [\v!february=februar] -\setuplabeltext [\s!nn] [\v!march=mars] -\setuplabeltext [\s!nn] [\v!april=april] -\setuplabeltext [\s!nn] [\v!may=mai] -\setuplabeltext [\s!nn] [\v!june=juni] -\setuplabeltext [\s!nn] [\v!july=juli] -\setuplabeltext [\s!nn] [\v!august=august] -\setuplabeltext [\s!nn] [\v!september=september] -\setuplabeltext [\s!nn] [\v!october=oktober] -\setuplabeltext [\s!nn] [\v!november=november] -\setuplabeltext [\s!nn] [\v!december=desember] - -\setuplabeltext [\s!en] [\v!sunday=Sunday] -\setuplabeltext [\s!en] [\v!monday=Monday] -\setuplabeltext [\s!en] [\v!tuesday=Tuesday] -\setuplabeltext [\s!en] [\v!wednesday=Wednesday] -\setuplabeltext [\s!en] [\v!thursday=Thursday] -\setuplabeltext [\s!en] [\v!friday=Friday] -\setuplabeltext [\s!en] [\v!saturday=Saturday] - -\setuplabeltext [\s!nl] [\v!sunday=zondag] -\setuplabeltext [\s!nl] [\v!monday=maandag] -\setuplabeltext [\s!nl] [\v!tuesday=dinsdag] -\setuplabeltext [\s!nl] [\v!wednesday=woensdag] -\setuplabeltext [\s!nl] [\v!thursday=donderdag] -\setuplabeltext [\s!nl] [\v!friday=vrijdag] -\setuplabeltext [\s!nl] [\v!saturday=zaterdag] - -\setuplabeltext [\s!de] [\v!sunday=Sonntag] -\setuplabeltext [\s!de] [\v!monday=Montag] -\setuplabeltext [\s!de] [\v!tuesday=Dienstag] -\setuplabeltext [\s!de] [\v!wednesday=Mittwoch] -\setuplabeltext [\s!de] [\v!thursday=Donnerstag] -\setuplabeltext [\s!de] [\v!friday=Freitag] -\setuplabeltext [\s!de] [\v!saturday=Samstag] - -\setuplabeltext [\s!da] [\v!sunday=s\ostroke ndag] -\setuplabeltext [\s!da] [\v!monday=mandag] -\setuplabeltext [\s!da] [\v!tuesday=tirsdag] -\setuplabeltext [\s!da] [\v!wednesday=onsdag] -\setuplabeltext [\s!da] [\v!thursday=torsdag] -\setuplabeltext [\s!da] [\v!friday=fredag] -\setuplabeltext [\s!da] [\v!saturday=l\ostroke rdag] - -\setuplabeltext [\s!sv] [\v!sunday=s\oumlaut ndag] -\setuplabeltext [\s!sv] [\v!monday=m\aring ndag] -\setuplabeltext [\s!sv] [\v!tuesday=tisdag] -\setuplabeltext [\s!sv] [\v!wednesday=onsdag] -\setuplabeltext [\s!sv] [\v!thursday=torsdag] -\setuplabeltext [\s!sv] [\v!friday=fredag] -\setuplabeltext [\s!sv] [\v!saturday=l\oumlaut rdag] - -\setuplabeltext [\s!af] [\v!sunday=sondag] -\setuplabeltext [\s!af] [\v!monday=maandag] -\setuplabeltext [\s!af] [\v!tuesday=dinsdag] -\setuplabeltext [\s!af] [\v!wednesday=woensdag] -\setuplabeltext [\s!af] [\v!thursday=donderdag] -\setuplabeltext [\s!af] [\v!friday=vrydag] -\setuplabeltext [\s!af] [\v!saturday=saterdag] - -\setuplabeltext [\s!nb] [\v!sunday=s\ostroke ndag] -\setuplabeltext [\s!nb] [\v!monday=mandag] -\setuplabeltext [\s!nb] [\v!tuesday=tirsdag] -\setuplabeltext [\s!nb] [\v!wednesday=onsdag] -\setuplabeltext [\s!nb] [\v!thursday=torsdag] -\setuplabeltext [\s!nb] [\v!friday=fredag] -\setuplabeltext [\s!nb] [\v!saturday=l\ostroke rdag] - -\setuplabeltext [\s!nn] [\v!sunday=sundag] -\setuplabeltext [\s!nn] [\v!monday=m\aring ndag] -\setuplabeltext [\s!nn] [\v!tuesday=tysdag] -\setuplabeltext [\s!nn] [\v!wednesday=onsdag] -\setuplabeltext [\s!nn] [\v!thursday=torsdag] -\setuplabeltext [\s!nn] [\v!friday=fredag] -\setuplabeltext [\s!nn] [\v!saturday=laurdag] - -%D Rather new ... - -\setuplabeltext [\s!nl] [\v!page=pagina ] -\setuplabeltext [\s!nl] [\v!atpage=op pagina ] -\setuplabeltext [\s!nl] [\v!hencefore=hierboven] -\setuplabeltext [\s!nl] [\v!hereafter=hieronder] -\setuplabeltext [\s!nl] [\v!see=zie ] - -\setuplabeltext [\s!en] [\v!page=page ] -\setuplabeltext [\s!en] [\v!atpage=at page ] -\setuplabeltext [\s!en] [\v!hencefore=as we show above] -\setuplabeltext [\s!en] [\v!hereafter=as we show below] -\setuplabeltext [\s!en] [\v!see=see ] - -\setuplabeltext [\s!de] [\v!page=Seite ] -\setuplabeltext [\s!de] [\v!atpage=auf Seite ] -\setuplabeltext [\s!de] [\v!hencefore=siehe oben] -\setuplabeltext [\s!de] [\v!hereafter=siehe unten] -\setuplabeltext [\s!de] [\v!see=siehe ] - -\setuplabeltext [\s!da] [\v!page=Side ] -\setuplabeltext [\s!da] [\v!atpage=p\aring\ side ] -\setuplabeltext [\s!da] [\v!hencefore=se foroven] -\setuplabeltext [\s!da] [\v!hereafter=se forneden] -\setuplabeltext [\s!da] [\v!see=se ] - -\setuplabeltext [\s!sv] [\v!page=Sida ] -\setuplabeltext [\s!sv] [\v!atpage=p\aring\ sida ] -\setuplabeltext [\s!sv] [\v!hencefore=se ovan] -\setuplabeltext [\s!sv] [\v!hereafter=se nedan] -\setuplabeltext [\s!sv] [\v!see=se ] - -\setuplabeltext [\s!nb] [\v!page=side ] -\setuplabeltext [\s!nb] [\v!atpage=p\aring\ side ] -\setuplabeltext [\s!nb] [\v!hencefore=som vist over] -\setuplabeltext [\s!nb] [\v!hereafter=som vist under] -\setuplabeltext [\s!nb] [\v!see=se ] - -\setuplabeltext [\s!nn] [\v!page=side ] -\setuplabeltext [\s!nn] [\v!atpage=p\aring\ side ] -\setuplabeltext [\s!nn] [\v!hencefore=som vist over] -\setuplabeltext [\s!nn] [\v!hereafter=som vist under] -\setuplabeltext [\s!nn] [\v!see=sj\aring\ ] - -%D ... and to be completed! - -%D Next we implement couple of ordinal mumber converters: - -\def\enordinaldaynumber#1% - {#1\ifnum\lasttwodigits{#1}=11 - \highordinalstr{th}% - \else\ifnum\lasttwodigits{#1}=12 - \highordinalstr{th}% - \else\ifnum\lasttwodigits{#1}=13 - \highordinalstr{th}% - \else\ifcase\lastdigit{#1}% - \highordinalstr{th}% - \or % 1 - \highordinalstr{st}% - \or % 2 - \highordinalstr{nd}% - \or % 3 - \highordinalstr{rd}% - \else - \highordinalstr{th}% - \fi\fi\fi\fi} - -% \def\enordinaldaynumber#1% -% {#1\ordinalstr{\ifnum\lasttwodigits{#1}=11 th\else\ifcase\lastdigit{#1} -% th\or st\or nd\or rd\else th\fi\fi}} - -\def\nlordinaldaynumber#1% - {#1\highordinalstr{e}} - -%D \ShowAllLanguageValues [\s!en] [english] {English} {horn} % engelse humor -%D \ShowAllLanguageValues [\s!nl] [dutch] {Dutch} {treat} % nederlandse zuinigheid -%D \ShowAllLanguageValues [\s!de] [german] {German} {beer} % duitse degelijkheid -%D \ShowAllLanguageValues [\s!da] [danish] {Danish} {pastry} -%D \ShowAllLanguageValues [\s!sv] [swedish] {Swedish} {design} -%D \ShowAllLanguageValues [\s!af] [afrikaans] {Afrikaaner} {boer} % afrikaanse gasvryheid -%D \ShowAllLanguageValues [\s!nb] [bokmal] {Norwegian} {wood} -%D \ShowAllLanguageValues [\s!nn] [nynorsk] {Norwegian} {fish} - -%D Extra month names: - -\setuplabeltext [\s!en] [\v!january :\s!mnem=jan] -\setuplabeltext [\s!en] [\v!february :\s!mnem=feb] -\setuplabeltext [\s!en] [\v!march :\s!mnem=mar] -\setuplabeltext [\s!en] [\v!april :\s!mnem=apr] -\setuplabeltext [\s!en] [\v!may :\s!mnem=may] -\setuplabeltext [\s!en] [\v!june :\s!mnem=jun] -\setuplabeltext [\s!en] [\v!july :\s!mnem=jul] -\setuplabeltext [\s!en] [\v!august :\s!mnem=aug] -\setuplabeltext [\s!en] [\v!september:\s!mnem=sep] -\setuplabeltext [\s!en] [\v!october :\s!mnem=oct] -\setuplabeltext [\s!en] [\v!november :\s!mnem=nov] -\setuplabeltext [\s!en] [\v!december :\s!mnem=dec] - -\setuplabeltext [\s!nb] [\v!january :\s!mnem=jan.] -\setuplabeltext [\s!nb] [\v!february :\s!mnem=feb.] -\setuplabeltext [\s!nb] [\v!march :\s!mnem=mars] -\setuplabeltext [\s!nb] [\v!april :\s!mnem=april] -\setuplabeltext [\s!nb] [\v!may :\s!mnem=mai] -\setuplabeltext [\s!nb] [\v!june :\s!mnem=juni] -\setuplabeltext [\s!nb] [\v!july :\s!mnem=juli] -\setuplabeltext [\s!nb] [\v!august :\s!mnem=aug.] -\setuplabeltext [\s!nb] [\v!september:\s!mnem=sep.] -\setuplabeltext [\s!nb] [\v!october :\s!mnem=okt.] -\setuplabeltext [\s!nb] [\v!november :\s!mnem=nov.] -\setuplabeltext [\s!nb] [\v!december :\s!mnem=des.] - -\setuplabeltext [\s!nn] [\v!january :\s!mnem=jan.] -\setuplabeltext [\s!nn] [\v!february :\s!mnem=feb.] -\setuplabeltext [\s!nn] [\v!march :\s!mnem=mars] -\setuplabeltext [\s!nn] [\v!april :\s!mnem=april] -\setuplabeltext [\s!nn] [\v!may :\s!mnem=mai] -\setuplabeltext [\s!nn] [\v!june :\s!mnem=juni] -\setuplabeltext [\s!nn] [\v!july :\s!mnem=juli] -\setuplabeltext [\s!nn] [\v!august :\s!mnem=aug.] -\setuplabeltext [\s!nn] [\v!september:\s!mnem=sep.] -\setuplabeltext [\s!nn] [\v!october :\s!mnem=okt.] -\setuplabeltext [\s!nn] [\v!november :\s!mnem=nov.] -\setuplabeltext [\s!nn] [\v!december :\s!mnem=des.] - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-grk.mkii b/Master/texmf-dist/tex/context/base/lang-grk.mkii new file mode 100644 index 00000000000..862f3c5f41e --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lang-grk.mkii @@ -0,0 +1,99 @@ +%D \module +%D [ file=lang-grk, +%D version=2003.04.01, +%D title=\CONTEXT\ Language Macros, +%D subtitle=Uralic Languages, +%D author=Apostolos Syropoulos +%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 / Greek} + +%D The framework of this module is set up by Hans Hagen while +%D all the translations have been done by Apostolos Syropoulos + +\unprotect + +\installlanguage + [\s!gr] + [\c!spacing=\v!packed, + \c!leftsentence=---, + \c!rightsentence=---, + \c!leftsubsentence=---, + \c!rightsubsentence=---, + \c!leftquote=\greekleftquot, + \c!rightquote=\greekrightquot, + \c!leftquotation=\greekleftquot, + \c!rightquotation=\greekrightquot, + \c!date={\v!day\ \v!month\ \v!year}] + +\installlanguage [greek] [\s!gr] + +\setupheadtext [\s!gr] [\v!content=\greekPi\greekepsilon\greekrho\greekiota\greekepsilon\greekchi\greekomicrontonos\greekmu\greekepsilon\greeknu\greekalpha] +\setupheadtext [\s!gr] [\v!tables=\greekPi\greekiotatonos\greeknu\greekalpha\greekkappa\greekepsilon\greekfinalsigma] +\setupheadtext [\s!gr] [\v!figures=\greekSigma\greekchi\greeketatonos\greekmu\greekalpha\greektau\greekalpha] +\setupheadtext [\s!gr] [\v!graphics=\greekGamma\greekrho\greekalpha\greekphi\greekiota\greekkappa\greekalphatonos] +\setupheadtext [\s!gr] [\v!intermezzi=\greekPi\greekalpha\greekupsilontonos\greeksigma\greekepsilon\greekiota\greekfinalsigma] +\setupheadtext [\s!gr] [\v!index=\greekEpsilon\greekupsilon\greekrho\greekepsilon\greektau\greeketatonos\greekrho\greekiota\greekomicron] +\setupheadtext [\s!gr] [\v!abbreviations=\greekSigma\greekupsilon\greeknu\greektau\greekomicron\greekmu\greekomicron\greekgamma\greekrho\greekalpha\greekphi\greekiotatonos\greekepsilon\greekfinalsigma] +\setupheadtext [\s!gr] [\v!logos=\greekLambda\greekomicron\greekgamma\greekomicrontonos\greektau\greekupsilon\greekpi\greekalpha] +\setupheadtext [\s!gr] [\v!units=\greekMu\greekomicron\greeknu\greekalphatonos\greekdelta\greekepsilon\greekfinalsigma] + +\setuplabeltext [\s!gr] [\v!table=\greekPi\greekiotatonos\greeknu\greekalpha\greekkappa\greekalpha\greekfinalsigma] +\setuplabeltext [\s!gr] [\v!figure=\greekSigma\greekchi\greeketatonos\greekmu\greekalpha] +\setuplabeltext [\s!gr] [\v!intermezzo=\greekPi\greekalpha\greekupsilontonos\greeksigma\greeketa] +\setuplabeltext [\s!gr] [\v!graphic=\greekGamma\greekrho\greekalpha\greekphi\greekiota\greekkappa\greekomicrontonos] + +\setuplabeltext [\s!gr] [\v!chapter=\greekKappa\greekepsilon\greekphi\greekalphatonos\greeklambda\greekalpha\greekiota\greekomicron] +\setuplabeltext [\s!gr] [\v!section=\greekEpsilon\greeknu\greekomicrontonos\greektau\greeketa\greektau\greekalpha] +\setuplabeltext [\s!gr] [\v!subsection=\greekUpsilon\greekpi\greekomicrontonos\greekepsilon\greeknu\greekomicrontonos\greektau\greeketa\greektau\greekalpha] +\setuplabeltext [\s!gr] [\v!subsubsection=] +\setuplabeltext [\s!gr] [\v!subsubsubsection=] + +\setuplabeltext [\s!gr] [\v!appendix=\greekPi\greekalpha\greekrho\greekalphatonos\greekrho\greektau\greeketa\greekmu\greekalpha] +\setuplabeltext [\s!gr] [\v!part=\greekMu\greekepsilontonos\greekrho\greekomicron\greekfinalsigma] +\setuplabeltext [\s!gr] [\v!line=\greekGamma\greekrho\greekalpha\greekmu\greekmu\greeketatonos] +\setuplabeltext [\s!gr] [\v!lines=\greekGamma\greekrho\greekalpha\greekmu\greekmu\greekepsilontonos\greekfinalsigma] + +\setuplabeltext [\s!gr] [\v!january=\greekIota\greekalpha\greeknu\greekomicron\greekupsilon\greekalphatonos\greekrho\greekiota\greekomicron\greekfinalsigma] +\setuplabeltext [\s!gr] [\v!february=\greekPhi\greekepsilon\greekbeta\greekrho\greekomicron\greekupsilon\greekalphatonos\greekrho\greekiota\greekomicron\greekfinalsigma] +\setuplabeltext [\s!gr] [\v!march=\greekMu\greekalphatonos\greekrho\greektau\greekiota\greekomicron\greekfinalsigma] +\setuplabeltext [\s!gr] [\v!april=\greekAlpha\greekpi\greekrho\greekiotatonos\greeklambda\greekiota\greekomicron\greekfinalsigma] +\setuplabeltext [\s!gr] [\v!may=\greekMu\greekalphatonos\greekiota\greekomicron\greekfinalsigma] +\setuplabeltext [\s!gr] [\v!june=\greekIota\greekomicron\greekupsilontonos\greeknu\greekiota\greekomicron\greekfinalsigma] +\setuplabeltext [\s!gr] [\v!july=\greekIota\greekomicron\greekupsilontonos\greeklambda\greekiota\greekomicron\greekfinalsigma] +\setuplabeltext [\s!gr] [\v!august=\greekAlpha\greekupsilontonos\greekgamma\greekomicron\greekupsilon\greeksigma\greektau\greekomicron\greekfinalsigma] +\setuplabeltext [\s!gr] [\v!september=\greekSigma\greekepsilon\greekpi\greektau\greekepsilontonos\greekmu\greekbeta\greekrho\greekiota\greekomicron\greekfinalsigma] +\setuplabeltext [\s!gr] [\v!october=\greekOmicron\greekkappa\greektau\greekomegatonos\greekbeta\greekrho\greekiota\greekomicron\greekfinalsigma] +\setuplabeltext [\s!gr] [\v!november=\greekNu\greekomicron\greekepsilontonos\greekmu\greekbeta\greekrho\greekiota\greekomicron\greekfinalsigma] +\setuplabeltext [\s!gr] [\v!december=\greekDelta\greekepsilon\greekkappa\greekepsilontonos\greekmu\greekbeta\greekrho\greekiota\greekomicron\greekfinalsigma] + +\setuplabeltext [\s!gr] [\v!sunday=\greekKappa\greekupsilon\greekrho\greekiota\greekalpha\greekkappa\greeketatonos] +\setuplabeltext [\s!gr] [\v!monday=\greekDelta\greekepsilon\greekupsilon\greektau\greekepsilontonos\greekrho\greekalpha] +\setuplabeltext [\s!gr] [\v!tuesday=\greekTau\greekrho\greekiotatonos\greektau\greeketa] +\setuplabeltext [\s!gr] [\v!wednesday=\greekTau\greekepsilon\greektau\greekalphatonos\greekrho\greektau\greeketa] +\setuplabeltext [\s!gr] [\v!thursday=\greekPi\greekepsilontonos\greekmu\greekpi\greektau\greeketa] +\setuplabeltext [\s!gr] [\v!friday=\greekPi\greekalpha\greekrho\greekalpha\greeksigma\greekkappa\greekepsilon\greekupsilon\greeketatonos] +\setuplabeltext [\s!gr] [\v!saturday=\greekSigma\greekalphatonos\greekbeta\greekbeta\greekalpha\greektau\greekomicron] + +%D % \ShowAllLanguageValues [\s!gr] [\greekEpsilon\greeklambda\greeklambda\greeketa\greeknu\greekiota\greekkappa\greekalphatonos] {Greek} {love} + +\installlanguage + [\s!agr] + [\s!default=\s!gr, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \s!patterns=\s!agr, + \s!mapping=\s!agr, % not needed for mkiv + \s!encoding=\s!agr] % not needed for mkiv + +\installlanguage [ancientgreek] [\s!agr] +\installlanguage [grk] [\s!agr] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-grk.tex b/Master/texmf-dist/tex/context/base/lang-grk.tex deleted file mode 100644 index e4ba781ebd8..00000000000 --- a/Master/texmf-dist/tex/context/base/lang-grk.tex +++ /dev/null @@ -1,94 +0,0 @@ -%D \module -%D [ file=lang-grk, -%D version=2003.04.01, -%D title=\CONTEXT\ Language Macros, -%D subtitle=Uralic Languages, -%D author=Apostolos Syropoulos -%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 / Greek} - -%D The framework of this module is set up by Hans Hagen while -%D all the translations have been done by Apostolos Syropoulos - -\unprotect - -\installlanguage - [\s!gr] - [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, - \c!leftquote=\greekleftquot, - \c!rightquote=\greekrightquot, - \c!leftquotation=\greekleftquot, - \c!rightquotation=\greekrightquot, - \c!date={\v!day\ \v!month\ \v!year}] - -\installlanguage [greek] [\s!gr] - -\setupheadtext [\s!gr] [\v!content=\greekPi\greekepsilon\greekrho\greekiota\greekepsilon\greekchi\greekomicrontonos\greekmu\greekepsilon\greeknu\greekalpha] -\setupheadtext [\s!gr] [\v!tables=\greekPi\greekiotatonos\greeknu\greekalpha\greekkappa\greekepsilon\greekfinalsigma] -\setupheadtext [\s!gr] [\v!figures=\greekSigma\greekchi\greeketatonos\greekmu\greekalpha\greektau\greekalpha] -\setupheadtext [\s!gr] [\v!graphics=\greekGamma\greekrho\greekalpha\greekphi\greekiota\greekkappa\greekalphatonos] -\setupheadtext [\s!gr] [\v!intermezzi=\greekPi\greekalpha\greekupsilontonos\greeksigma\greekepsilon\greekiota\greekfinalsigma] -\setupheadtext [\s!gr] [\v!index=\greekEpsilon\greekupsilon\greekrho\greekepsilon\greektau\greeketatonos\greekrho\greekiota\greekomicron] -\setupheadtext [\s!gr] [\v!abbreviations=\greekSigma\greekupsilon\greeknu\greektau\greekomicron\greekmu\greekomicron\greekgamma\greekrho\greekalpha\greekphi\greekiotatonos\greekepsilon\greekfinalsigma] -\setupheadtext [\s!gr] [\v!logos=\greekLambda\greekomicron\greekgamma\greekomicrontonos\greektau\greekupsilon\greekpi\greekalpha] -\setupheadtext [\s!gr] [\v!units=\greekMu\greekomicron\greeknu\greekalphatonos\greekdelta\greekepsilon\greekfinalsigma] - -\setuplabeltext [\s!gr] [\v!table=\greekPi\greekiotatonos\greeknu\greekalpha\greekkappa\greekalpha\greekfinalsigma] -\setuplabeltext [\s!gr] [\v!figure=\greekSigma\greekchi\greeketatonos\greekmu\greekalpha] -\setuplabeltext [\s!gr] [\v!intermezzo=\greekPi\greekalpha\greekupsilontonos\greeksigma\greeketa] -\setuplabeltext [\s!gr] [\v!graphic=\greekGamma\greekrho\greekalpha\greekphi\greekiota\greekkappa\greekomicrontonos] - -\setuplabeltext [\s!gr] [\v!chapter=\greekKappa\greekepsilon\greekphi\greekalphatonos\greeklambda\greekalpha\greekiota\greekomicron] -\setuplabeltext [\s!gr] [\v!section=\greekEpsilon\greeknu\greekomicrontonos\greektau\greeketa\greektau\greekalpha] -\setuplabeltext [\s!gr] [\v!subsection=\greekUpsilon\greekpi\greekomicrontonos\greekepsilon\greeknu\greekomicrontonos\greektau\greeketa\greektau\greekalpha] -\setuplabeltext [\s!gr] [\v!subsubsection=] -\setuplabeltext [\s!gr] [\v!subsubsubsection=] - -\setuplabeltext [\s!gr] [\v!appendix=\greekPi\greekalpha\greekrho\greekalphatonos\greekrho\greektau\greeketa\greekmu\greekalpha] -\setuplabeltext [\s!gr] [\v!part=\greekMu\greekepsilontonos\greekrho\greekomicron\greekfinalsigma] -\setuplabeltext [\s!gr] [\v!line=\greekGamma\greekrho\greekalpha\greekmu\greekmu\greeketatonos] -\setuplabeltext [\s!gr] [\v!lines=\greekGamma\greekrho\greekalpha\greekmu\greekmu\greekepsilontonos\greekfinalsigma] - -\setuplabeltext [\s!gr] [\v!january=\greekIota\greekalpha\greeknu\greekomicron\greekupsilon\greekalphatonos\greekrho\greekiota\greekomicron\greekfinalsigma] -\setuplabeltext [\s!gr] [\v!february=\greekPhi\greekepsilon\greekbeta\greekrho\greekomicron\greekupsilon\greekalphatonos\greekrho\greekiota\greekomicron\greekfinalsigma] -\setuplabeltext [\s!gr] [\v!march=\greekMu\greekalphatonos\greekrho\greektau\greekiota\greekomicron\greekfinalsigma] -\setuplabeltext [\s!gr] [\v!april=\greekAlpha\greekpi\greekrho\greekiotatonos\greeklambda\greekiota\greekomicron\greekfinalsigma] -\setuplabeltext [\s!gr] [\v!may=\greekMu\greekalphatonos\greekiota\greekomicron\greekfinalsigma] -\setuplabeltext [\s!gr] [\v!june=\greekIota\greekomicron\greekupsilontonos\greeknu\greekiota\greekomicron\greekfinalsigma] -\setuplabeltext [\s!gr] [\v!july=\greekIota\greekomicron\greekupsilontonos\greeklambda\greekiota\greekomicron\greekfinalsigma] -\setuplabeltext [\s!gr] [\v!august=\greekAlpha\greekupsilontonos\greekgamma\greekomicron\greekupsilon\greeksigma\greektau\greekomicron\greekfinalsigma] -\setuplabeltext [\s!gr] [\v!september=\greekSigma\greekepsilon\greekpi\greektau\greekepsilontonos\greekmu\greekbeta\greekrho\greekiota\greekomicron\greekfinalsigma] -\setuplabeltext [\s!gr] [\v!october=\greekOmicron\greekkappa\greektau\greekomegatonos\greekbeta\greekrho\greekiota\greekomicron\greekfinalsigma] -\setuplabeltext [\s!gr] [\v!november=\greekNu\greekomicron\greekepsilontonos\greekmu\greekbeta\greekrho\greekiota\greekomicron\greekfinalsigma] -\setuplabeltext [\s!gr] [\v!december=\greekDelta\greekepsilon\greekkappa\greekepsilontonos\greekmu\greekbeta\greekrho\greekiota\greekomicron\greekfinalsigma] - -\setuplabeltext [\s!gr] [\v!sunday=\greekKappa\greekupsilon\greekrho\greekiota\greekalpha\greekkappa\greeketatonos] -\setuplabeltext [\s!gr] [\v!monday=\greekDelta\greekepsilon\greekupsilon\greektau\greekepsilontonos\greekrho\greekalpha] -\setuplabeltext [\s!gr] [\v!tuesday=\greekTau\greekrho\greekiotatonos\greektau\greeketa] -\setuplabeltext [\s!gr] [\v!wednesday=\greekTau\greekepsilon\greektau\greekalphatonos\greekrho\greektau\greeketa] -\setuplabeltext [\s!gr] [\v!thursday=\greekPi\greekepsilontonos\greekmu\greekpi\greektau\greeketa] -\setuplabeltext [\s!gr] [\v!friday=\greekPi\greekalpha\greekrho\greekalpha\greeksigma\greekkappa\greekepsilon\greekupsilon\greeketatonos] -\setuplabeltext [\s!gr] [\v!saturday=\greekSigma\greekalphatonos\greekbeta\greekbeta\greekalpha\greektau\greekomicron] - -%D % \ShowAllLanguageValues [\s!gr] [\greekEpsilon\greeklambda\greeklambda\greeketa\greeknu\greekiota\greekkappa\greekalphatonos] {Greek} {love} - -\installlanguage - [\s!agr] - [\s!default=\s!gr, - \s!patterns=\s!agr, - \s!mapping=\s!agr, - \s!encoding=\s!agr] - -\installlanguage [ancientgreek] [\s!agr] - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-ind.mkii b/Master/texmf-dist/tex/context/base/lang-ind.mkii new file mode 100644 index 00000000000..9b6e5ff1dbe --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lang-ind.mkii @@ -0,0 +1,26 @@ +%D \module +%D [ file=lang--ind, +%D version=1997.09.03, +%D title=\CONTEXT\ Language Macros, +%D subtitle=Indo Iranian 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. + +\writestatus{loading}{ConTeXt Language Macros / Indo-Iranian Languages} + +%D The framework of this module is set up by Hans Hagen while +%D many of the first translations were done by Tobias. Later +%D on, corrections were made by users. If you have suggestions, +%D or feel that your name missing here, don't hesitate to send +%D us an email. + +% 34 languages + +\unprotect + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-ind.tex b/Master/texmf-dist/tex/context/base/lang-ind.tex deleted file mode 100644 index 9b6e5ff1dbe..00000000000 --- a/Master/texmf-dist/tex/context/base/lang-ind.tex +++ /dev/null @@ -1,26 +0,0 @@ -%D \module -%D [ file=lang--ind, -%D version=1997.09.03, -%D title=\CONTEXT\ Language Macros, -%D subtitle=Indo Iranian 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. - -\writestatus{loading}{ConTeXt Language Macros / Indo-Iranian Languages} - -%D The framework of this module is set up by Hans Hagen while -%D many of the first translations were done by Tobias. Later -%D on, corrections were made by users. If you have suggestions, -%D or feel that your name missing here, don't hesitate to send -%D us an email. - -% 34 languages - -\unprotect - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-ini.lua b/Master/texmf-dist/tex/context/base/lang-ini.lua index 239e5390c55..525e0f17a12 100644 --- a/Master/texmf-dist/tex/context/base/lang-ini.lua +++ b/Master/texmf-dist/tex/context/base/lang-ini.lua @@ -7,209 +7,181 @@ if not modules then modules = { } end modules ['lang-ini'] = { } -- needs a cleanup (share locals) +-- discard language when redefined +-- 002D : hyphen-minus (ascii) +-- 2010 : hyphen +-- 2011 : nonbreakable hyphen +-- 2013 : endash (compound hyphen) + +--~ lang:hyphenation(string) string = lang:hyphenation() lang:clear_hyphenation() + +local type, tonumber = type, tonumber local utf = unicode.utf8 local utfbyte = utf.byte -local format = string.format +local format, gsub = string.format, string.gsub local concat = table.concat local lpegmatch = lpeg.match +local texwrite = tex.write -local trace_patterns = false trackers.register("languages.patterns", function(v) trace_patterns = v end) +local settings_to_array = utilities.parsers.settings_to_array -languages = languages or {} -languages.version = 1.009 -languages.hyphenation = languages.hyphenation or { } -languages.hyphenation.data = languages.hyphenation.data or { } +local trace_patterns = false trackers.register("languages.patterns", function(v) trace_patterns = v end) -local langdata = languages.hyphenation.data +local report_initialization = logs.reporter("languages","initialization") --- 002D : hyphen-minus (ascii) --- 2010 : hyphen --- 2011 : nonbreakable hyphen --- 2013 : endash (compound hyphen) +local prehyphenchar = lang.prehyphenchar -- global per language +local posthyphenchar = lang.posthyphenchar -- global per language +local lefthyphenmin = lang.lefthyphenmin +local righthyphenmin = lang.righthyphenmin + +lang.exceptions = lang.hyphenation ---~ lang:hyphenation(string) ---~ string =lang:hyphenation() ---~ lang:clear_hyphenation() +languages = languages or {} +local languages = languages --- we can consider hiding data (faster access too) +languages.version = 1.010 --- loading the 26 languages that we normally load in mkiv, the string based variant --- takes .84 seconds (probably due to the sub's) while the lpeg variant takes .78 --- seconds --- --- the following lpeg can probably be improved (it was one of the first I made) +languages.registered = languages.registered or { } +local registered = languages.registered -local leftbrace = lpeg.P("{") -local rightbrace = lpeg.P("}") -local spaces = lpeg.S(" \r\n\t\f") -local spacing = spaces^0 -local validchar = 1-(spaces+rightbrace+leftbrace) -local validword = validchar^1 -local content = spacing * leftbrace * spacing * lpeg.C((spacing * validword)^0) * spacing * rightbrace * lpeg.P(true) +languages.associated = languages.associated or { } +local associated = languages.associated -local command = lpeg.P("\\patterns") -local parser = (1-command)^0 * command * content +languages.numbers = languages.numbers or { } +local numbers = languages.numbers -local function filterpatterns(filename) - if file.extname(filename) == "rpl" then - return io.loaddata(resolvers.find_file(filename)) or "" - else - return lpegmatch(parser,io.loaddata(resolvers.find_file(filename)) or "") - end -end +languages.data = languages.data or { } +local data = languages.data -local command = lpeg.P("\\hyphenation") -local parser = (1-command)^0 * command * content +storage.register("languages/numbers", numbers, "languages.numbers") +storage.register("languages/registered",registered,"languages.registered") +storage.register("languages/associated",associated,"languages.associated") +storage.register("languages/data", data, "languages.data") -local function filterexceptions(filename) - if file.extname(filename) == "rhl" then - return io.loaddata(resolvers.find_file(filename)) or "" - else - return lpegmatch(parser,io.loaddata(resolvers.find_file(filename)) or {}) -- "" ? - end -end +local nofloaded = 0 -local function record(tag) - local data = langdata[tag] - if not data then - data = lang.new() - langdata[tag] = data or 0 +local function resolve(tag) + local data, instance = registered[tag], nil + if data then + instance = data.instance + if not instance then + instance = lang.new(data.number) + data.instance = instance + end end - return data + return data, instance end -languages.hyphenation.record = record - -function languages.hyphenation.define(tag) - local data = record(tag) - return data:id() +local function tolang(what) -- returns lang object + local tag = numbers[what] + local data = tag and registered[tag] or registered[what] + if data then + local instance = data.lang + if not instance then + instance = lang.new(data.number) + data.instance = instance + end + return instance + end end -function languages.hyphenation.number(tag) - local d = langdata[tag] - return (d and d:id()) or 0 -end +-- languages.tolang = tolang -lang.exceptions = lang.hyphenation +-- todo: en+de => merge -local function loadthem(tag, filename, filter, target) +local function loaddefinitions(tag,specification) statistics.starttiming(languages) - local data = record(tag) - local fullname = (filename and filename ~= "" and resolvers.find_file(filename)) or "" - local ok = fullname ~= "" - if ok then + local data, instance = resolve(tag) + local definitions = settings_to_array(specification.patterns or "") + if #definitions > 0 then if trace_patterns then - logs.report("languages","filtering %s for language '%s' from '%s'",target,tag,fullname) + report_initialization("pattern specification for language '%s': %s",tag,specification.patterns) end - lang[target](data,filterpatterns(fullname)) - else - if trace_patterns then - logs.report("languages","no %s for language '%s' in '%s'",target,tag,filename or "?") + local dataused, ok = data.used, false + for i=1,#definitions do + local definition = definitions[i] + if definition ~= "" then + if definition == "reset" then -- interfaces.variables.reset + if trace_patterns then + report_initialization("clearing patterns for language '%s'",tag) + end + instance:clear_patterns() + elseif not dataused[definition] then + dataused[definition] = definition + local filename = "lang-" .. definition .. ".lua" + local fullname = resolvers.findfile(filename) or "" + if fullname ~= "" then + if trace_patterns then + report_initialization("loading definition '%s' for language '%s' from '%s'",definition,tag,fullname) + end + local defs = dofile(fullname) -- use regular loader instead + if defs then -- todo: version test + ok, nofloaded = true, nofloaded + 1 + instance:patterns (defs.patterns and defs.patterns.data or "") + instance:hyphenation(defs.exceptions and defs.exceptions.data or "") + else + report_initialization("invalid definition '%s' for language '%s' in '%s'",definition,tag,filename) + end + elseif trace_patterns then + report_initialization("invalid definition '%s' for language '%s' in '%s'",definition,tag,filename) + end + elseif trace_patterns then + report_initialization("definition '%s' for language '%s' already loaded",definition,tag) + end + end end - lang[target](data,"") + return ok + elseif trace_patterns then + report_initialization("no definitions for language '%s'",tag) end - langdata[tag] = data statistics.stoptiming(languages) - return ok -end - -function languages.hyphenation.loadpatterns(tag, patterns) - return loadthem(tag, patterns, filterpatterns, "patterns") -end - -function languages.hyphenation.loadexceptions(tag, exceptions) - return loadthem(tag, patterns, filterexceptions, "exceptions") end -function languages.hyphenation.exceptions(tag, ...) - local data = record(tag) - data:hyphenation(...) -end - -function languages.hyphenation.hyphenate(tag, str) - return lang.hyphenate(record(tag), str) -end - -function languages.hyphenation.lefthyphenmin(tag, value) - local data = record(tag) - if value then data:lefthyphenmin(value) end - return data:lefthyphenmin() -end -function languages.hyphenation.righthyphenmin(tag, value) - local data = record(tag) - if value then data:righthyphenmin(value) end - return data:righthyphenmin() -end - -function languages.hyphenation.n() - return table.count(langdata) -end - -languages.registered = languages.registered or { } -languages.associated = languages.associated or { } -languages.numbers = languages.numbers or { } - -storage.register("languages/registered",languages.registered,"languages.registered") -storage.register("languages/associated",languages.associated,"languages.associated") +storage.shared.noflanguages = storage.shared.noflanguages or 0 -local numbers = languages.numbers -local registered = languages.registered -local associated = languages.associated +local noflanguages = storage.shared.noflanguages --- we can speed this one up with locals if needed - -local function tolang(what) - local kind = type(what) - if kind == "number" then - local w = what >= 0 and what <= 0x7FFF and numbers[what] - return (w and langdata[w]) or 0 - elseif kind == "string" then - return langdata[what] - else - return what +function languages.define(tag,parent) + noflanguages = noflanguages + 1 + if trace_patterns then + report_initialization("assigning number %s to %s",noflanguages,tag) end + numbers[noflanguages] = tag + registered[tag] = { + tag = tag, + parent = parent or "", + patterns = "", + loaded = false, + used = { }, + dirty = true, + number = noflanguages, + instance = nil, -- luatex data structure + synonyms = { }, + } + storage.shared.noflanguages = noflanguages end -function languages.setup(what,settings) - what = languages.tolang(what or tex.language) - local lefthyphen = settings.lefthyphen - local righthyphen = settings.righthyphen - lefthyphen = lefthyphen ~= "" and lefthyphen or nil - righthyphen = righthyphen ~= "" and righthyphen or nil - lefthyphen = lefthyphen and utfbyte(lefthyphen) or 0 - righthyphen = righthyphen and utfbyte(righthyphen) or 0 - lang.posthyphenchar(what,lefthyphen) - lang.prehyphenchar (what,righthyphen) - lang.postexhyphenchar(what,lefthyphen) - lang.preexhyphenchar (what,righthyphen) +function languages.synonym(synonym,tag) -- convenience function + local l = registered[tag] + if l then + l.synonyms[synonym] = true -- maybe some day more info + end end -function languages.prehyphenchar(what) - return lang.prehyphenchar(tolang(what)) +function languages.installed(separator) + context(concat(table.sortedkeys(registered),separator or ",")) end -function languages.posthyphenchar(what) - return lang.posthyphenchar(tolang(what)) -end - -languages.tolang = tolang -function languages.register(tag,parent,patterns,exceptions) - parent = parent or tag - registered[tag] = { - parent = parent, - patterns = patterns or format("lang-%s.pat",parent), - exceptions = exceptions or format("lang-%s.hyp",parent), - loaded = false, - number = 0, - } +function languages.current(n) + return numbers[n and tonumber(n) or tex.language] end -function languages.associate(tag,script,language) +function languages.associate(tag,script,language) -- not yet used associated[tag] = { script, language } end -function languages.association(tag) +function languages.association(tag) -- not yet used if type(tag) == "number" then tag = numbers[tag] end @@ -221,84 +193,143 @@ function languages.association(tag) end end -function languages.loadable(tag) - local l = registered[tag] - if l and l.patterns and resolvers.find_file(patterns) then +function languages.loadable(tag,defaultlanguage) -- hack + local l = registered[tag] -- no synonyms + if l and resolvers.findfile("lang-"..l.patterns..".lua") then return true else return false end end -languages.share = false -- we don't share language numbers +-- a bit messy, we will do all language setting in lua as we can now assign +-- and 'patterns' will go away here. -function languages.enable(tags) - -- beware: we cannot set tex.language, but need tex.normallanguage - for i=1,#tags do - local tag = tags[i] +function languages.setdirty(tag) + local l = registered[tag] + if l then + l.dirty = true + end +end + +if environment.initex then + + function languages.getnumber() + return 0 + end + + function commands.languagenumber() + texwrite(0) + end + +else + + local function getnumber(tag,default,patterns) local l = registered[tag] - if l and l ~= "" then - if not l.loaded then - local tag = l.parent - local number = languages.hyphenation.number(tag) - if languages.share and number > 0 then - l.number = number - else - -- we assume the same filenames - l.number = languages.hyphenation.define(tag) - languages.hyphenation.loadpatterns(tag,l.patterns) - languages.hyphenation.loadexceptions(tag,l.exceptions) - numbers[l.number] = tag - end - l.loaded = true + if l then + if l.dirty then if trace_patterns then - logs.report("languages","assigning number %s",l.number) + report_initialization("checking patterns for %s (%s)",tag,default) end + -- patterns is already resolved to parent patterns if applicable + if patterns and patterns ~= "" then + if l.patterns ~= patterns then + l.patterns = patterns + if trace_patterns then + report_initialization("loading patterns for '%s' using specification '%s'",tag,patterns) + end + loaddefinitions(tag,l) + else + -- unchanged + end + elseif l.patterns == "" then + l.patterns = tag + if trace_patterns then + report_initialization("loading patterns for '%s' using tag",tag) + end + local ok = loaddefinitions(tag,l) + if not ok and tag ~= default then + l.patterns = default + if trace_patterns then + report_initialization("loading patterns for '%s' using default",tag) + end + loaddefinitions(tag,l) + end + end + l.loaded = true + l.dirty = false end - if l.number > 0 then - return l.number - end + return l.number + else + return 0 end end - return 0 + + languages.getnumber = getnumber + + function commands.languagenumber(tag,default,patterns) + texwrite(getnumber(tag,default,patterns)) + end + end +-- not that usefull, global values + +function languages.prehyphenchar (what) return prehyphenchar (tolang(what)) end +function languages.posthyphenchar(what) return posthyphenchar(tolang(what)) end +function languages.lefthyphenmin (what) return lefthyphenmin (tolang(what)) end +function languages.righthyphenmin(what) return righthyphenmin(tolang(what)) end + -- e['implementer']= 'imple{m}{-}{-}menter' -- e['manual'] = 'man{}{}{}' -- e['as'] = 'a-s' -- e['user-friendly'] = 'user=friend-ly' -- e['exceptionally-friendly'] = 'excep-tionally=friend-ly' -function languages.hyphenation.loadwords(tag, filename) - local id = languages.hyphenation.number(tag) - if id > 0 then - local l = lang.new(id) or 0 +function languages.loadwords(tag,filename) + local data, instance = resolve(tag) + if data then statistics.starttiming(languages) - local data = io.loaddata(filename) or "" - l:hyphenation(data) + instance:hyphenation(io.loaddata(filename) or "") statistics.stoptiming(languages) end end -languages.hyphenation.define ("zerolanguage") -languages.hyphenation.loadpatterns ("zerolanguage") -- else bug -languages.hyphenation.loadexceptions("zerolanguage") -- else bug +function languages.exceptions(tag,str) + local data, instance = resolve(tag) + if data then + instance:hyphenation(string.strip(str)) -- we need to strip leading spaces + end +end + +function languages.hyphenate(tag,str) + -- todo: does this still work? + local data, instance = resolve(tag) + if data then + return instance:hyphenate(str) + else + return str + end +end + +--~ hyphenation.define ("zerolanguage") +--~ hyphenation.loadpatterns ("zerolanguage") -- else bug +--~ hyphenation.loadexceptions("zerolanguage") -- else bug languages.logger = languages.logger or { } function languages.logger.report() - local result = { } + local result, r = { }, 0 local sorted = table.sortedkeys(registered) for i=1,#sorted do local tag = sorted[i] local l = registered[tag] if l.loaded then - local p = (l.patterns and "pat") or '-' - local e = (l.exceptions and "exc") or '-' - result[#result+1] = format("%s:%s:%s:%s:%s", tag, l.parent, p, e, l.number) + r = r + 1 + result[r] = format("%s:%s:%s", tag, l.parent, l.number) end end - return (#result > 0 and concat(result," ")) or "none" + return (r > 0 and concat(result," ")) or "none" end -- must happen at the tex end @@ -317,5 +348,63 @@ statistics.register("loaded patterns", function() end) statistics.register("language load time", function() - return statistics.elapsedseconds(languages, format(", n=%s",languages.hyphenation.n())) + return statistics.elapsedseconds(languages, format(", nofpatterns: %s",nofloaded)) end) + +--~ -- obsolete +--~ -- +--~ -- loading the 26 languages that we normally load in mkiv, the string based variant +--~ -- takes .84 seconds (probably due to the sub's) while the lpeg variant takes .78 +--~ -- seconds +--~ -- +--~ -- the following lpeg can probably be improved (it was one of the first I made) + +--~ local leftbrace = lpeg.P("{") +--~ local rightbrace = lpeg.P("}") +--~ local spaces = lpeg.S(" \r\n\t\f") +--~ local spacing = spaces^0 +--~ local validchar = 1-(spaces+rightbrace+leftbrace) +--~ local validword = validchar^1 +--~ local content = spacing * leftbrace * spacing * lpeg.C((spacing * validword)^0) * spacing * rightbrace * lpeg.P(true) +--~ +--~ local command = lpeg.P("\\patterns") +--~ local parser = (1-command)^0 * command * content +--~ +--~ local function filterpatterns(filename) +--~ return lpegmatch(parser,io.loaddata(resolvers.findfile(filename)) or "") +--~ end +--~ +--~ local command = lpeg.P("\\hyphenation") +--~ local parser = (1-command)^0 * command * content +--~ +--~ local function filterexceptions(filename) +--~ return lpegmatch(parser,io.loaddata(resolvers.findfile(filename)) or "") -- "" ? +--~ end +--~ +--~ local function loadthem(tag, filename, filter, target) +--~ statistics.starttiming(languages) +--~ local data, instance = resolve(tag) +--~ local fullname = (filename and filename ~= "" and resolvers.findfile(filename)) or "" +--~ local ok = fullname ~= "" +--~ if ok then +--~ if trace_patterns then +--~ report_initialization("filtering %s for language '%s' from '%s'",target,tag,fullname) +--~ end +--~ lang[target](data,filter(fullname) or "") +--~ else +--~ if trace_patterns then +--~ report_initialization("no %s for language '%s' in '%s'",target,tag,filename or "?") +--~ end +--~ lang[target](instance,"") +--~ end +--~ statistics.stoptiming(languages) +--~ return ok +--~ end +--~ +--~ function hyphenation.loadpatterns(tag, patterns) +--~ return loadthem(tag, patterns, filterpatterns, "patterns") +--~ end +--~ +--~ function hyphenation.loadexceptions(tag, exceptions) +--~ return loadthem(tag, exceptions, filterexceptions, "exceptions") +--~ end diff --git a/Master/texmf-dist/tex/context/base/lang-ini.mkii b/Master/texmf-dist/tex/context/base/lang-ini.mkii index 91ac5984767..50a3689cfb3 100644 --- a/Master/texmf-dist/tex/context/base/lang-ini.mkii +++ b/Master/texmf-dist/tex/context/base/lang-ini.mkii @@ -265,7 +265,7 @@ \fi \egroup} -\fetchruntimecommand \showpatterns {\f!languageprefix\s!run.mkii} +\fetchruntimecommand \showpatterns {\f!languageprefix\s!run} %D Since we can only load patterns in ini\TeX, we nil the %D loading before dumping (which saves a bit of memory, but diff --git a/Master/texmf-dist/tex/context/base/lang-ini.mkiv b/Master/texmf-dist/tex/context/base/lang-ini.mkiv index 45bb71b85d9..5dccab4dc82 100644 --- a/Master/texmf-dist/tex/context/base/lang-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/lang-ini.mkiv @@ -13,6 +13,8 @@ %D This module needs a further cleanup (real split between ii/iv). +% \ctxlua{tex.sprint(languages.numbers[tex.count.mainlanguagenumber])} + %D This module implements the (for the moment still simple) %D multi||language support of \CONTEXT, which should not be %D confused with the multi||lingual interface. This support @@ -21,6 +23,7 @@ \writestatus{loading}{ConTeXt Language Macros / Initialization} \registerctxluafile{lang-ini}{1.001} +\registerctxluafile{lang-def}{1.001} \unprotect @@ -73,6 +76,34 @@ \let\currentlanguage \empty \let\currentmainlanguage\empty +%D \macros +%D {defaultlanguage,languageparameter,specificlanguageparameter} + +\def\defaultlanguage#1% + {\ifcsname\??la#1\s!default\endcsname + \expandafter\defaultlanguage\csname\??la#1\s!default\endcsname + \else + #1% + \fi} + +\def\languageparameter#1% + {\ifcsname\??la\currentlanguage#1\endcsname + \csname\??la\currentlanguage#1\endcsname + \else\ifcsname\??la\currentlanguage\s!default\endcsname + \expandafter\specificlanguageparameter\csname\??la\currentlanguage\s!default\endcsname{#1}% + \else\ifcsname\??la\s!default#1\endcsname + \csname\??la\s!default#1\endcsname + \fi\fi\fi} + +\def\specificlanguageparameter#1#2% + {\ifcsname\??la#1#2\endcsname + \csname\??la#1#2\endcsname + \else\ifcsname\??la#1\s!default\endcsname + \expandafter\specificlanguageparameter\csname\??la#1\s!default\endcsname{#2}% + \else\ifcsname\??la\s!default#2\endcsname + \csname\??la\s!default#2\endcsname + \fi\fi\fi} + \unexpanded\def\setupcurrentlanguage[#1]{\setcurrentlanguage\currentmainlanguage{#1}} \def\setcurrentlanguage#1#2% sets modes: **id (currentmain) *id (current) @@ -123,10 +154,10 @@ %D implementations support run time addition of patterns to a %D preloaded format). -\def\dodoinstalllanguage#1#2% #2 added - {\expanded{\noexpand\uppercase{\noexpand\edef\noexpand\ascii{#1}}}% - \ifcsname #1\endcsname\else\setvalue {#1}{\complexlanguage[#2]}\fi - \ifcsname\ascii\endcsname\else\setvalue\ascii{\complexlanguage[#2]}\fi} +% move to lua end + +\def\dodoinstalllanguage#1#2% + {\ifcsname#1\endcsname\else\setuvalue{#1}{\complexlanguage[#2]}\fi} %D \macros %D {preloadlanguages} @@ -137,47 +168,31 @@ %D reports which patterns are loaded and what hyphenmin %D values are set. -\let\installedlanguages\empty +\newtoks \everysetuplanguage -\def\doiflanguageelse#1{\doifdefinedelse{\??la#1\c!state}} +\def\installedlanguages{\ctxlua{languages.installed()}} -\def\doloadpatterns#1#2% - {\ctxlua{languages.register( - "#1", - "#2", - "\truefilename{\f!languageprefix#2.\f!patternsextension}", - "\truefilename{\f!languageprefix#2.\f!hyphensextension }") - }} - -\def\doloadlanguagefiles#1% - {\edef\languagesuffix{\specificlanguageparameter{#1}\s!patterns}% - \ifx\languagesuffix\empty - \edef\languagesuffix{\defaultlanguage{#1}}% - \else\ifx\languagesuffix\relax - \edef\languagesuffix{\defaultlanguage{#1}}% - \fi\fi - \ifx\languagesuffix\empty - \edef\languagesuffix{#1}% - \fi - \doloadpatterns{#1}\languagesuffix} +\def\doiflanguageelse#1{\doifdefinedelse{\??la#1\c!state}} \def\doinstalllanguage[#1][#2]% {\doifassignmentelse{#2} {\doiflanguageelse{#1} {\getparameters[\??la#1][#2]} {\setvalue{\l!prefix!#1}{#1}% - \addtocommalist{#1}\installedlanguages \dodoinstalllanguage{#1}{#1}% \getparameters[\??la#1][\c!state=\v!start,#2]}% - \doloadlanguagefiles{#1}} + \edef\currentsetuplanguage{#1}% + \ctxlua{languages.define("#1","\specificlanguageparameter{#1}\s!default")}% + \the\everysetuplanguage} {\setvalue{\l!prefix!#1}{#2}% - \getparameters[\??la#1][\s!default=#2]% + \ctxlua{languages.synonym("#1","#2")}% + %\getparameters[\??la#1][\s!default=#2]% \dodoinstalllanguage{#1}{#2}}} \def\reallanguagetag#1% {\ifcsname\l!prefix!#1\endcsname\csname\l!prefix!#1\endcsname\else#1\fi} -% ^^ \language[#1] gave unwanted side effect of loading language specifics +% \language[#1] gave unwanted side effect of loading language specifics \def\installlanguage {\dodoubleargument\doinstalllanguage} @@ -188,7 +203,13 @@ %D conform a standard. \def\doifpatternselse#1% - {\ctxlua{cs.testcase(languages.loadable("#1"))}} + {\bgroup % will change + \language[#1]% + \ifnum\normallanguage>\zerocount + \bgroup\expandafter\firstoftwoarguments + \else + \bgroup\expandafter\secondoftwoarguments + \fi} %D \macros %D {setuplanguage} @@ -202,24 +223,40 @@ \unexpanded\def\setuplanguage {\dodoubleempty\dosetuplanguage} -\def\dosetuplanguage[#1][#2]% handy patch for testing +\ifdefined\docomplexlanguage \else \let\docomplexlanguage\relax \fi + +\def\dosetuplanguage[#1][#2]% {\ifsecondargument - \getparameters[\??la#1][#2]% - \doif{#1}\currentlanguage\docomplexlanguage + \pushmacro\currentlanguage % can be default + \edef\currentsetuplanguage{\reallanguagetag{#1}}% + \getparameters[\??la\currentsetuplanguage][#2]% + \the\everysetuplanguage + \popmacro\currentlanguage + %\doif\currentsetuplanguage\currentlanguage we can have influenced inheritance (default) + \docomplexlanguage \else - \getparameters[\??la\currentlanguage][#1]% + \let\currentsetuplanguage\currentlanguage + \getparameters[\??la\currentsetuplanguage][#1]% + \the\everysetuplanguage \docomplexlanguage \fi} +\appendtoks + \ctxlua{languages.setdirty("\currentsetuplanguage")}% +\to \everysetuplanguage + \setuplanguage [\s!default] - [\s!lefthyphenmin=2, + [\s!patterns=, + \s!lefthyphenmin=2, \s!righthyphenmin=2, - \s!patterns=, - \c!spacing=\v!packed, + \s!lefthyphenchar=-1, + \s!righthyphenchar=45, + % used in compound i.e. interfaced with c! and can be anything so no numbers \c!lefthyphen=, \c!righthyphen=-, \c!hyphen=-, + \c!spacing=\v!packed, \c!midsentence=---, \c!leftsentence=---, \c!rightsentence=---, @@ -244,6 +281,12 @@ \c!rightcompoundhyphen=\compoundhyphen, \c!leftcompoundhyphen=] +% to be tested: +% +% \setuplanguage +% [\s!default] +% [\c!righthyphenchar="AD] + %D The values \type {leftsentence} and \type %D {rightsentence} can be (and are) used to implement %D automatic subsentence boundary glyphs, like in {\fr @@ -301,38 +344,30 @@ %D We take care of local as well as standardized language %D switching (fr and fa, de and du, but nl and nl). -\def\dosetnormallanguage#1#2% current default - {\edef\askedlanguagepatterns{\specificlanguageparameter{#1}\s!patterns}% - \normallanguage=\ctxlua{tex.sprint(languages.enable({"\askedlanguagepatterns","#1","#2"}))}% - \ifproductionrun - \setxvalue{\??la\??la#1#2}{\number\normallanguage}% - \fi} - -\def\setnormallanguage#1#2% current default / we can freeze the number here - {\ifcsname\??la\??la#1#2\endcsname - \normallanguage\csname\??la\??la#1#2\endcsname % todo: we can set language at the lua end now - \else - \dosetnormallanguage{#1}{#2}% - \fi} - \newtoks \everylanguage -\def\sethyphenationvariables % as we can have cloning we need to set it each time, unless we move all to lua - {\ctxlua{languages.setup(tex.language, { - lefthyphen = "\languageparameter\c!lefthyphen", - righthyphen = "\languageparameter\c!righthyphen", - } )}% - \lefthyphenmin \numexpr0\languageparameter\s!lefthyphenmin +\hyphenminoffset\relax - \righthyphenmin\numexpr0\languageparameter\s!righthyphenmin+\hyphenminoffset\relax} - -\def\docomplexlanguage% assumes that \currentlanguage is set - {\edef\currentdefaultlanguage{\defaultlanguage\currentlanguage}% - \setnormallanguage\currentlanguage\currentdefaultlanguage - \the\everylanguage - \sethyphenationvariables - \relax - % will be definable and move to core-spa ! - \doifelse{\languageparameter\c!spacing}\v!broad\nonfrenchspacing\frenchspacing} +\def\docomplexlanguage% assumes that \currentlanguage is set % % % use different name as complex + {\normallanguage\ctxlua{commands.languagenumber(% + "\currentlanguage",% + "\defaultlanguage\currentlanguage",% + "\languageparameter\s!patterns"% + )}\relax + \the\everylanguage\relax} + +\appendtoks + % these values are stored along with glyph nodes + \lefthyphenmin \numexpr0\languageparameter\s!lefthyphenmin +\hyphenminoffset\relax + \righthyphenmin\numexpr0\languageparameter\s!righthyphenmin+\hyphenminoffset\relax + % these values are stored with the language (global!) + \prehyphenchar \languageparameter\s!righthyphenchar\relax + \posthyphenchar\languageparameter\s!lefthyphenchar \relax +\to \everylanguage + +% this will move to core-spa ! + +\appendtoks + \doifelse{\languageparameter\c!spacing}\v!broad\nonfrenchspacing\frenchspacing +\to \everylanguage % \mainlanguage[nl] \setuplanguage[nl][lefthyphen=,righthyphen=?] % @@ -352,7 +387,7 @@ \docomplexlanguage \fi \else - \showmessage\m!linguals6{#1}% + \showmessage\m!languages6{#1}% \fi \fi} @@ -360,6 +395,8 @@ \definecomplexorsimple\language +\newcount\mainlanguagenumber + \def\mainlanguage[#1]% {\edef\askedlanguage{#1}% \ifx\askedlanguage\empty \else @@ -376,35 +413,8 @@ \docomplexlanguage \fi \fi - \fi} - -%D \macros -%D {defaultlanguage,languageparameter,specificlanguageparameter} - -\def\defaultlanguage#1% - {\ifcsname\??la#1\s!default\endcsname - \expandafter\defaultlanguage\csname\??la#1\s!default\endcsname - \else - #1% - \fi} - -\def\languageparameter#1% - {\ifcsname\??la\currentlanguage#1\endcsname - \csname\??la\currentlanguage#1\endcsname - \else\ifcsname\??la\currentlanguage\s!default\endcsname - \expandafter\specificlanguageparameter\csname\??la\currentlanguage\s!default\endcsname{#1}% - \else\ifcsname\??la\s!default#1\endcsname - \csname\??la\s!default#1\endcsname - \fi\fi\fi} - -\def\specificlanguageparameter#1#2% - {\ifcsname\??la#1#2\endcsname - \csname\??la#1#2\endcsname - \else\ifcsname\??la#1\s!default\endcsname - \expandafter\specificlanguageparameter\csname\??la#1\s!default\endcsname{#2}% - \else\ifcsname\??la\s!default#2\endcsname - \csname\??la\s!default#2\endcsname - \fi\fi\fi} + \fi + \mainlanguagenumber\normallanguage} %D New (see nomarking and nolist): @@ -422,19 +432,11 @@ %D {\blank %D \startlinecorrection %D \vbox\bgroup -%D \language[#1]% -%D \setbox0=\hbox to \hsize{\hss\bf#2 subsentence symbol and quotes\hss} -%D \dp0=0pt -%D \box0 -%D \vskip.5em -%D \hrule -%D \vskip.5em -%D \let\normalbar=| -%D \hbox to \hsize +%D \language[#1] +%D \midaligned{\bf#2 subsentence symbol and quotes} +%D \framed[width=\hsize,frame=off,topframe=on,bottomframe=on,offset=.5ex] %D {\hfil\quotation{#3 #4}\hfil\quote{#2}\hfil -%D \let|=\normalbar\strut|<||<|#3|>|#4|>|\hfil} -%D \vskip.5em -%D \hrule +%D \startsubsentence\startsubsentence#3\stopsubsentence#4\stopsubsentence\hfil} %D \egroup %D \stoplinecorrection %D \blank} @@ -531,9 +533,6 @@ %D \stoptable %D \protect -% \bgroup \normallanguage255 \patterns{} \egroup -% \def\nopatterns{\normallanguage255 } - \def\nopatterns{\normallanguage\minusone} %D We default to the language belonging to the interface. This @@ -546,15 +545,27 @@ \def\initializemainlanguage {\mainlanguage[\currentlanguage]% - \showmessage\m!linguals9\currentlanguage} + \showmessage\m!languages9\currentlanguage} + +%D New: -%D Might be in use: +\let\stopexceptions\relax -\let\preloadallpatterns\relax % just for old times sake -\let\preloadlanguages \relax % just for old times sake +\unexpanded\def\startexceptions + {\dosingleempty\dostartexceptions} + +\long\def\dostartexceptions[#1]#2\stopexceptions % multilingual or not? + {\begingroup + \edef\askedlanguage{\reallanguagetag{#1}}% + \ifx\askedlanguage\empty + \let\askedlanguage\currentlanguage + \fi + \ctxlua{languages.exceptions("\askedlanguage",\!!bs#2\!!es)}% + \endgroup} -\uchyph=1 +%D For the moment here: +\uchyph = 1 % also treat uppercase \exhyphenchar=45 % to permit breaking at explicit hyphens \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-ita.mkii b/Master/texmf-dist/tex/context/base/lang-ita.mkii new file mode 100644 index 00000000000..03efb0614fe --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lang-ita.mkii @@ -0,0 +1,518 @@ +%D \module +%D [ file=lang-ita, +%D version=1997.09.03, +%D title=\CONTEXT\ Language Macros, +%D subtitle=Italic 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. + +% Todo: replace \'.. by \namedglyph + +\writestatus{loading}{ConTeXt Language Macros / Italic Languages} + +%D The framework of this module is set up by Hans Hagen while +%D many of the first translations were done by Tobias. Later +%D on, corrections were made by users. If you have suggestions, +%D or feel that your name missing here, don't hesitate to send +%D us an email. +%D +%D \starttabulate[|lB|l|] +%D \NC Italian \NC Giuseppe Bilotta \NC \NR +%D \NC Romanian \NC Dan Seracu \NC \NR +%D \NC Portuguese \NC Pedro F. M. Mendon\c a \NC \NR +%D \stoptabulate + +% Latin, Italian, Rhaeto-Romanic, Rumanian, Sardian +% Catalan, French, Ladino, Portuguese, Proven\c{c}al, Spanish + +\unprotect + +\ifx\guillemotspace\undefined \let\guillemotspace\empty \fi +\ifx\sentencespace \undefined \let\sentencespace \empty \fi + +\installlanguage + [\s!fr] + [\c!spacing=\v!packed, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\leftguillemot, + \c!rightquote=\rightguillemot, + \c!leftquotation=\leftguillemot, + \c!rightquotation=\rightguillemot, + \c!date={\v!day+,\v!space,\v!month,\v!space,\v!year}, + \s!mapping={texnansi,ec}, + \s!encoding={texnansi,ec}] + +\installlanguage + [\s!es] + [\c!spacing=\v!packed, + \c!leftsentence=---, + \c!rightsentence=---, + \c!leftsubsentence=---, + \c!rightsubsentence=---, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!day,\ ,\v!month,\ ,\v!year}] + +\installlanguage [sp] [\s!es] % old times context + +\installlanguage + [\s!ca] + [\c!spacing=\v!packed, + \c!leftsentence=---, + \c!rightsentence=---, + \c!leftsubsentence=---, + \c!rightsubsentence=---, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!day,\ ,\v!month,\ ,\v!year}] + +% Note GB left|/|right (sub)sentences are for \quote {incisi}. + +\installlanguage + [\s!it] + [\c!spacing=\v!packed, + \c!leftsentence=---, + \c!rightsentence=---, + \c!leftsubsentence=--, + \c!rightsubsentence=--, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!leftspeech=\leftguillemot, + \c!middlespeech=\leftguillemot, + \c!rightspeech=\rightguillemot, + \c!date={\v!day,\ ,\v!month,\ ,\v!year}, + \s!mapping={texnansi,ec}, + \s!encoding={texnansi,ec}] + +\installlanguage % the same as italian + [\s!la] + [\c!spacing=\v!packed, + \c!leftsentence=---, + \c!rightsentence=---, + \c!leftsubsentence=---, + \c!rightsubsentence=---, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\lowerrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\lowerrightdoubleninequote, + \c!date={\v!day,\ ,\v!month,\ ,\v!year}] + +\installlanguage + [\s!pt] + [\c!spacing=\v!packed, + \c!leftsentence=---, + \c!rightsentence=---, + \c!leftsubsentence=---, + \c!rightsubsentence=---, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!year,\ ,\v!month,\ ,\v!day}, + \s!mapping={texnansi,ec}, + \s!encoding={texnansi,ec}] + +\installlanguage + [\s!ro] + [\c!spacing=\v!packed, + \c!leftsentence=---, + \c!rightsentence=---, + \c!leftsubsentence=---, + \c!rightsubsentence=---, + \c!leftquote=\leftguillemot, + \c!rightquote=\rightguillemot, + \c!leftquotation=\lowerrightdoubleninequote, + \c!rightquotation=\upperleftdoublesixquote, + \c!date={\v!day,\ ,\v!month,\ ,\v!year}] + +%D For compatibility reasons we also define: + +\installlanguage [fa] [\s!fr] % for dutchies only + +\installlanguage [french] [\s!fr] +\installlanguage [spanish] [\s!es] +\installlanguage [catalan] [\s!ca] +\installlanguage [italian] [\s!it] +\installlanguage [latin] [\s!la] +\installlanguage [portuguese] [\s!pt] +\installlanguage [romanian] [\s!ro] + +%D Labels and header texts. + +\setupheadtext [\s!fr] [\v!content=Table des mati\`eres] +\setupheadtext [\s!es] [\v!content=\'Indice] +\setupheadtext [\s!ca] [\v!content=\'Index de continguts] +\setupheadtext [\s!it] [\v!content=Indice] +\setupheadtext [\s!la] [\v!content=Quod in libro continetur] %Argumentum +\setupheadtext [\s!pt] [\v!content=Conte\'udo] +\setupheadtext [\s!ro] [\v!content=Cuprins] + +\setupheadtext [\s!fr] [\v!tables=Tableaux] +\setupheadtext [\s!es] [\v!tables=Tablas] +\setupheadtext [\s!ca] [\v!tables=Taules] +\setupheadtext [\s!it] [\v!tables=Tabelle] +\setupheadtext [\s!la] [\v!tables=Tabulae] +\setupheadtext [\s!pt] [\v!tables=Tabelas] +\setupheadtext [\s!ro] [\v!tables=Tabele] + +\setupheadtext [\s!fr] [\v!figures=Figures] +\setupheadtext [\s!es] [\v!figures=Ilustraciones] +\setupheadtext [\s!ca] [\v!figures=Figures] +\setupheadtext [\s!it] [\v!figures=Figure] +\setupheadtext [\s!la] [\v!figures=Imagines] +\setupheadtext [\s!pt] [\v!figures=Figuras] +\setupheadtext [\s!ro] [\v!figures=Figuri] + +\setupheadtext [\s!fr] [\v!graphics=Graphiques] +\setupheadtext [\s!es] [\v!graphics=Gr\'aficos] +\setupheadtext [\s!it] [\v!graphics=Grafici] +\setupheadtext [\s!ca] [\v!graphics=Gr\`afiques] +\setupheadtext [\s!la] [\v!graphics=Typi] +\setupheadtext [\s!pt] [\v!graphics=Gr\'aficos] +\setupheadtext [\s!ro] [\v!graphics=Grafice] + +\setupheadtext [\s!fr] [\v!intermezzi=Interm\`edes] +\setupheadtext [\s!es] [\v!intermezzi=Intermedios] +\setupheadtext [\s!ca] [\v!intermezzi=Intermedis] +\setupheadtext [\s!it] [\v!intermezzi=Intermezzi] +\setupheadtext [\s!la] [\v!intermezzi=Intermissa] +\setupheadtext [\s!pt] [\v!intermezzi=Interm\'edios] +\setupheadtext [\s!ro] [\v!intermezzi=Intermzzo] + +\setupheadtext [\s!fr] [\v!index=Index] +\setupheadtext [\s!es] [\v!index=\'Indice alfab\'etico] +\setupheadtext [\s!ca] [\v!index=\'Index alfab\`etic] +\setupheadtext [\s!it] [\v!index=Indice] +\setupheadtext [\s!la] [\v!index=Indices] +\setupheadtext [\s!pt] [\v!index=\'Indice] +\setupheadtext [\s!ro] [\v!index=Index] + +\setupheadtext [\s!fr] [\v!abbreviations=Abr\'eviations] +\setupheadtext [\s!es] [\v!abbreviations=Abreviaturas] +\setupheadtext [\s!ca] [\v!abbreviations=Abreviacions] +\setupheadtext [\s!it] [\v!abbreviations=Abbreviazioni] +\setupheadtext [\s!la] [\v!abbreviations=Notae] +\setupheadtext [\s!pt] [\v!abbreviations=Abreviaturas] +\setupheadtext [\s!ro] [\v!abbreviations=Abrevieri] + +\setupheadtext [\s!fr] [\v!logos=Logos] +\setupheadtext [\s!es] [\v!logos=Logotipos] +\setupheadtext [\s!ca] [\v!logos=Logotips] +\setupheadtext [\s!it] [\v!logos=Logotipi] +\setupheadtext [\s!la] [\v!logos=Typi negotiales] +\setupheadtext [\s!pt] [\v!logos=Logotipos] +\setupheadtext [\s!ro] [\v!logos=Logo-uri] + +\setupheadtext [\s!fr] [\v!units=Unit\'es] +\setupheadtext [\s!es] [\v!units=Unidades] +\setupheadtext [\s!ca] [\v!units=Unitats] +\setupheadtext [\s!it] [\v!units=Unit\`a] +\setupheadtext [\s!la] [\v!units=Modi] +\setupheadtext [\s!pt] [\v!units=Unidades] +\setupheadtext [\s!ro] [\v!units=Unit\u{a}\c{t}i] + +\setupheadtext [\s!fr] [pubs=Bibliographie] +\setupheadtext [\s!es] [pubs=Bibliograf\'\ia] +\setupheadtext [\s!ca] [pubs=Referències] +\setupheadtext [\s!it] [pubs=Bibliografia] +%setupheadtext [\s!la] [pubs=?] +%setupheadtext [\s!pt] [pubs=?] +%setupheadtext [\s!ro] [pubs=?] + +\setuplabeltext [\s!fr] [\v!table=Tableau ] +\setuplabeltext [\s!es] [\v!table=Tabla ] +\setuplabeltext [\s!ca] [\v!table=Taula ] +\setuplabeltext [\s!it] [\v!table=Tabella ] +\setuplabeltext [\s!la] [\v!table=Tabula ] +\setuplabeltext [\s!pt] [\v!table=Tabela ] +\setuplabeltext [\s!ro] [\v!table=Tabelul ] + +\setuplabeltext [\s!fr] [\v!figure=Figure ] +\setuplabeltext [\s!es] [\v!figure=Ilustraci\'on ] +\setuplabeltext [\s!ca] [\v!figure=Figura ] +\setuplabeltext [\s!it] [\v!figure=Fig. ] +\setuplabeltext [\s!la] [\v!figure=Imago ] +\setuplabeltext [\s!pt] [\v!figure=Figura ] +\setuplabeltext [\s!ro] [\v!figure=Figura ] + +\setuplabeltext [\s!fr] [\v!intermezzo=Interm\`ede ] +\setuplabeltext [\s!es] [\v!intermezzo=Intermedio ] +\setuplabeltext [\s!ca] [\v!intermezzo=Intermedi ] +\setuplabeltext [\s!it] [\v!intermezzo=Intermezzo ] +\setuplabeltext [\s!la] [\v!intermezzo=Intermissum ] +\setuplabeltext [\s!pt] [\v!intermezzo=Interm\'edio ] +\setuplabeltext [\s!ro] [\v!intermezzo=Intermezzo ] + +\setuplabeltext [\s!fr] [\v!graphic=Illustration ] +\setuplabeltext [\s!es] [\v!graphic=Gr\'afico ] +\setuplabeltext [\s!ca] [\v!graphic=Gr\`afica ] +\setuplabeltext [\s!it] [\v!graphic=Grafico ] +\setuplabeltext [\s!la] [\v!graphic=Typus ] +\setuplabeltext [\s!pt] [\v!graphic=Gr\'afico ] +\setuplabeltext [\s!ro] [\v!graphic=Graficul ] + +\setuplabeltext [\s!fr] [\v!chapter=] % Chapitre +\setuplabeltext [\s!es] [\v!chapter=] % Cap\'\i tulo +\setuplabeltext [\s!ca] [\v!chapter=] % Cap\'\i tol +\setuplabeltext [\s!it] [\v!chapter=] +\setuplabeltext [\s!la] [\v!chapter=] +\setuplabeltext [\s!pt] [\v!chapter=] +\setuplabeltext [\s!ro] [\v!chapter=] + +\setuplabeltext [\s!fr] [\v!section=] % Section +\setuplabeltext [\s!es] [\v!section=] % Secci\'on +\setuplabeltext [\s!ca] [\v!section=] % Secci\'o +\setuplabeltext [\s!it] [\v!section=] +\setuplabeltext [\s!la] [\v!section=] +\setuplabeltext [\s!pt] [\v!section=] +\setuplabeltext [\s!ro] [\v!section=] + +\setuplabeltext [\s!fr] [\v!subsection=] % Soussection +\setuplabeltext [\s!es] [\v!subsection=] % Subsecci\'on +\setuplabeltext [\s!ca] [\v!subsection=] % Subsecci\'o +\setuplabeltext [\s!it] [\v!subsection=] +\setuplabeltext [\s!la] [\v!subsection=] +\setuplabeltext [\s!pt] [\v!subsection=] +\setuplabeltext [\s!ro] [\v!subsection=] + +\setuplabeltext [\s!fr] [\v!subsubsection=] % Soussoussection +\setuplabeltext [\s!es] [\v!subsubsection=] % Subsubsecci\'on +\setuplabeltext [\s!ca] [\v!subsubsection=] % Subsubsecci\'o +\setuplabeltext [\s!it] [\v!subsubsection=] +\setuplabeltext [\s!la] [\v!subsubsection=] +\setuplabeltext [\s!pt] [\v!subsubsection=] +\setuplabeltext [\s!ro] [\v!subsubsection=] + +\setuplabeltext [\s!fr] [\v!subsubsubsection=] % Soussoussoussection +\setuplabeltext [\s!es] [\v!subsubsubsection=] % Subsubsubsecci\'on +\setuplabeltext [\s!ca] [\v!subsubsubsection=] % Subsubsubsecci\'o +\setuplabeltext [\s!it] [\v!subsubsubsection=] +\setuplabeltext [\s!la] [\v!subsubsubsection=] +\setuplabeltext [\s!pt] [\v!subsubsubsection=] +\setuplabeltext [\s!ro] [\v!subsubsubsection=] + +\setuplabeltext [\s!fr] [\v!appendix=] % Annexe +\setuplabeltext [\s!es] [\v!appendix=] % Ap\'endice +\setuplabeltext [\s!ca] [\v!appendix=] % Ap\`endix +\setuplabeltext [\s!it] [\v!appendix=] +\setuplabeltext [\s!la] [\v!appendix=] +\setuplabeltext [\s!pt] [\v!appendix=] +\setuplabeltext [\s!ro] [\v!appendix=] + +\setuplabeltext [\s!fr] [\v!part=Partie ] +\setuplabeltext [\s!es] [\v!part=Parte ] +\setuplabeltext [\s!ca] [\v!part=Part ] +\setuplabeltext [\s!it] [\v!part=Parte ] +\setuplabeltext [\s!la] [\v!part=Pars ] +\setuplabeltext [\s!pt] [\v!part=Parte ] +\setuplabeltext [\s!ro] [\v!part=Partea ] + +\setuplabeltext [\s!fr] [\v!line=ligne ] +\setuplabeltext [\s!es] [\v!line=l\'\i nea ] +\setuplabeltext [\s!ca] [\v!line=l\'\i nia ] +\setuplabeltext [\s!it] [\v!line=riga ] +\setuplabeltext [\s!la] [\v!line=versus ] +\setuplabeltext [\s!pt] [\v!line=linha ] +\setuplabeltext [\s!ro] [\v!line=linia ] + +\setuplabeltext [\s!fr] [\v!lines=lignes ] +\setuplabeltext [\s!es] [\v!lines=l\'\i neas ] +\setuplabeltext [\s!ca] [\v!lines=l\'\i nies ] +\setuplabeltext [\s!it] [\v!lines=righe ] +\setuplabeltext [\s!la] [\v!lines=versus ] +\setuplabeltext [\s!pt] [\v!lines=linhas ] +\setuplabeltext [\s!ro] [\v!lines=liniile ] + +\setuplabeltext [\s!fr] [\v!january=janvier] +\setuplabeltext [\s!fr] [\v!february=f\'evrier] +\setuplabeltext [\s!fr] [\v!march=mars] +\setuplabeltext [\s!fr] [\v!april=avril] +\setuplabeltext [\s!fr] [\v!may=mai] +\setuplabeltext [\s!fr] [\v!june=juin] +\setuplabeltext [\s!fr] [\v!july=juillet] +\setuplabeltext [\s!fr] [\v!august=ao\^ut] +\setuplabeltext [\s!fr] [\v!september=septembre] +\setuplabeltext [\s!fr] [\v!october=octobre] +\setuplabeltext [\s!fr] [\v!november=novembre] +\setuplabeltext [\s!fr] [\v!december=d\'ecembre] + +\setuplabeltext [\s!es] [\v!january=enero] +\setuplabeltext [\s!es] [\v!february=febrero] +\setuplabeltext [\s!es] [\v!march=marzo] +\setuplabeltext [\s!es] [\v!april=abril] +\setuplabeltext [\s!es] [\v!may=mayo] +\setuplabeltext [\s!es] [\v!june=junio] +\setuplabeltext [\s!es] [\v!july=julio] +\setuplabeltext [\s!es] [\v!august=agosto] +\setuplabeltext [\s!es] [\v!september=septiembre] +\setuplabeltext [\s!es] [\v!october=octubre] +\setuplabeltext [\s!es] [\v!november=noviembre] +\setuplabeltext [\s!es] [\v!december=diciembre] + +\setuplabeltext [\s!ca] [\v!january=gener] +\setuplabeltext [\s!ca] [\v!february=febrer] +\setuplabeltext [\s!ca] [\v!march=mar\c{c}] +\setuplabeltext [\s!ca] [\v!april=abril] +\setuplabeltext [\s!ca] [\v!may=maig] +\setuplabeltext [\s!ca] [\v!june=juny] +\setuplabeltext [\s!ca] [\v!july=juliol] +\setuplabeltext [\s!ca] [\v!august=agost] +\setuplabeltext [\s!ca] [\v!september=setembre] +\setuplabeltext [\s!ca] [\v!october=octubre] +\setuplabeltext [\s!ca] [\v!november=novembre] +\setuplabeltext [\s!ca] [\v!december=desembre] + +\setuplabeltext [\s!it] [\v!january=gennaio] +\setuplabeltext [\s!it] [\v!february=febbraio] +\setuplabeltext [\s!it] [\v!march=marzo] +\setuplabeltext [\s!it] [\v!april=aprile] +\setuplabeltext [\s!it] [\v!may=maggio] +\setuplabeltext [\s!it] [\v!june=giugno] +\setuplabeltext [\s!it] [\v!july=luglio] +\setuplabeltext [\s!it] [\v!august=agosto] +\setuplabeltext [\s!it] [\v!september=settembre] +\setuplabeltext [\s!it] [\v!october=ottobre] +\setuplabeltext [\s!it] [\v!november=novembre] +\setuplabeltext [\s!it] [\v!december=dicembre] + +\setuplabeltext [\s!la] [\v!january=Ianuarius] +\setuplabeltext [\s!la] [\v!february=Februarius] +\setuplabeltext [\s!la] [\v!march=Martius] +\setuplabeltext [\s!la] [\v!april=Aprilis] +\setuplabeltext [\s!la] [\v!may=Maius] +\setuplabeltext [\s!la] [\v!june=Iunius] +\setuplabeltext [\s!la] [\v!july=Iulius] % formerly Quintilis +\setuplabeltext [\s!la] [\v!august=Augustus] % formerly Sextilis +\setuplabeltext [\s!la] [\v!september=September] +\setuplabeltext [\s!la] [\v!october=October] +\setuplabeltext [\s!la] [\v!november=November] +\setuplabeltext [\s!la] [\v!december=December] + +\setuplabeltext [\s!pt] [\v!january=janeiro] +\setuplabeltext [\s!pt] [\v!february=fevereiro] +\setuplabeltext [\s!pt] [\v!march=mar\c{c}o] +\setuplabeltext [\s!pt] [\v!april=abril] +\setuplabeltext [\s!pt] [\v!may=maio] +\setuplabeltext [\s!pt] [\v!june=junho] +\setuplabeltext [\s!pt] [\v!july=julho] +\setuplabeltext [\s!pt] [\v!august=agosto] +\setuplabeltext [\s!pt] [\v!september=setembro] +\setuplabeltext [\s!pt] [\v!october=outubro] +\setuplabeltext [\s!pt] [\v!november=novembro] +\setuplabeltext [\s!pt] [\v!december=dezembro] + +\setuplabeltext [\s!ro] [\v!january=ianuarie] +\setuplabeltext [\s!ro] [\v!february=februarie] +\setuplabeltext [\s!ro] [\v!march=martie] +\setuplabeltext [\s!ro] [\v!april=aprilie] +\setuplabeltext [\s!ro] [\v!may=mai] +\setuplabeltext [\s!ro] [\v!june=iunie] +\setuplabeltext [\s!ro] [\v!july=iulie] +\setuplabeltext [\s!ro] [\v!august=august] +\setuplabeltext [\s!ro] [\v!september=septembrie] +\setuplabeltext [\s!ro] [\v!october=octombrie] +\setuplabeltext [\s!ro] [\v!november=noiembrie] +\setuplabeltext [\s!ro] [\v!december=decembrie] + +\setuplabeltext [\s!fr] [\v!sunday=dimanche] +\setuplabeltext [\s!fr] [\v!monday=lundi] +\setuplabeltext [\s!fr] [\v!tuesday=mardi] +\setuplabeltext [\s!fr] [\v!wednesday=mercredi] +\setuplabeltext [\s!fr] [\v!thursday=jeudi] +\setuplabeltext [\s!fr] [\v!friday=vendredi] +\setuplabeltext [\s!fr] [\v!saturday=samedi] + +\setuplabeltext [\s!es] [\v!sunday=domingo] +\setuplabeltext [\s!es] [\v!monday=lunes] +\setuplabeltext [\s!es] [\v!tuesday=martes] +\setuplabeltext [\s!es] [\v!wednesday=mi\'ercoles] +\setuplabeltext [\s!es] [\v!thursday=jueves] +\setuplabeltext [\s!es] [\v!friday=viernes] +\setuplabeltext [\s!es] [\v!saturday=s\'abado] + +\setuplabeltext [\s!ca] [\v!sunday=diumenge] +\setuplabeltext [\s!ca] [\v!monday=dilluns] +\setuplabeltext [\s!ca] [\v!tuesday=dimarts] +\setuplabeltext [\s!ca] [\v!wednesday=dimecres] +\setuplabeltext [\s!ca] [\v!thursday=dijous] +\setuplabeltext [\s!ca] [\v!friday=divendres] +\setuplabeltext [\s!ca] [\v!saturday=dissabte] + +\setuplabeltext [\s!it] [\v!sunday=domenica] +\setuplabeltext [\s!it] [\v!monday=luned\`\i] +\setuplabeltext [\s!it] [\v!tuesday=marted\`\i] +\setuplabeltext [\s!it] [\v!wednesday=mercoled\`\i] +\setuplabeltext [\s!it] [\v!thursday=gioved\`\i] +\setuplabeltext [\s!it] [\v!friday=venerd\`\i] +\setuplabeltext [\s!it] [\v!saturday=sabato] + +\setuplabeltext [\s!la] [\v!sunday=Dies Solis] +\setuplabeltext [\s!la] [\v!monday=Dies Lunae] +\setuplabeltext [\s!la] [\v!tuesday=Dies Martis] +\setuplabeltext [\s!la] [\v!wednesday=Dies Mercuri] +\setuplabeltext [\s!la] [\v!thursday=Dies Iovis] +\setuplabeltext [\s!la] [\v!friday=Dies Veneris] +\setuplabeltext [\s!la] [\v!saturday=Dies Saturni] + +\setuplabeltext [\s!pt] [\v!sunday=domingo] +\setuplabeltext [\s!pt] [\v!monday=segunda-feira] +\setuplabeltext [\s!pt] [\v!tuesday=ter\c{c}a-feira] +\setuplabeltext [\s!pt] [\v!wednesday=quarta-feira] +\setuplabeltext [\s!pt] [\v!thursday=quinta-feira] +\setuplabeltext [\s!pt] [\v!friday=sexta-feira] +\setuplabeltext [\s!pt] [\v!saturday=s\'abado] + +\setuplabeltext [\s!ro] [\v!sunday=duminic\u{a}] +\setuplabeltext [\s!ro] [\v!monday=luni] +\setuplabeltext [\s!ro] [\v!tuesday=mar\c{t}i] +\setuplabeltext [\s!ro] [\v!wednesday=miercuri] +\setuplabeltext [\s!ro] [\v!thursday=joi] +\setuplabeltext [\s!ro] [\v!friday=vineri] +\setuplabeltext [\s!ro] [\v!saturday=s\^{a}mb\u{a}t\u{a}] + +%D Rather new \unknown + +\setuplabeltext [\s!it] [\v!page=pagina ] +\setuplabeltext [\s!it] [\v!atpage=a pagina ] +\setuplabeltext [\s!it] [\v!hencefore=come mostrato sopra] +\setuplabeltext [\s!it] [\v!hereafter=come mostrato sotto] +\setuplabeltext [\s!it] [\v!see=cf. ] + +\setuplabeltext [\s!fr] [\v!page=page ] +\setuplabeltext [\s!fr] [\v!atpage=à la page ] +\setuplabeltext [\s!fr] [\v!hencefore=ci-dessus] +\setuplabeltext [\s!fr] [\v!hereafter=ci-dessous] +\setuplabeltext [\s!fr] [\v!see=cf. ] + +%D Ordinal converters: + +\def\frordinaldaynumber#1% date is masculine + {\number#1\ifcase#1\or + \highordinalstr{er}% + \fi} + +\defineconversion [\s!fr] [\v!day+] [\frordinaldaynumber] + +%D \ShowAllLanguageValues [\s!fr] [french] {French} {kiss} % franse slag +%D \ShowAllLanguageValues [\s!es] [spanish] {Spanish} {guitar} % spaans benauwd +%D \ShowAllLanguageValues [\s!ca] [catalan] {Catalan} {cream} +%D \ShowAllLanguageValues [\s!it] [italian] {Italian} {aria} +%D \ShowAllLanguageValues [\s!la] [latin] {Latin} {lover} % latijnse missen +%D \ShowAllLanguageValues [\s!pt] [portuguese] {Portuguese} {fisherman} +%D \ShowAllLanguageValues [\s!ro] [romanian] {Romanian} {traveller} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-ita.tex b/Master/texmf-dist/tex/context/base/lang-ita.tex deleted file mode 100644 index 03efb0614fe..00000000000 --- a/Master/texmf-dist/tex/context/base/lang-ita.tex +++ /dev/null @@ -1,518 +0,0 @@ -%D \module -%D [ file=lang-ita, -%D version=1997.09.03, -%D title=\CONTEXT\ Language Macros, -%D subtitle=Italic 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. - -% Todo: replace \'.. by \namedglyph - -\writestatus{loading}{ConTeXt Language Macros / Italic Languages} - -%D The framework of this module is set up by Hans Hagen while -%D many of the first translations were done by Tobias. Later -%D on, corrections were made by users. If you have suggestions, -%D or feel that your name missing here, don't hesitate to send -%D us an email. -%D -%D \starttabulate[|lB|l|] -%D \NC Italian \NC Giuseppe Bilotta \NC \NR -%D \NC Romanian \NC Dan Seracu \NC \NR -%D \NC Portuguese \NC Pedro F. M. Mendon\c a \NC \NR -%D \stoptabulate - -% Latin, Italian, Rhaeto-Romanic, Rumanian, Sardian -% Catalan, French, Ladino, Portuguese, Proven\c{c}al, Spanish - -\unprotect - -\ifx\guillemotspace\undefined \let\guillemotspace\empty \fi -\ifx\sentencespace \undefined \let\sentencespace \empty \fi - -\installlanguage - [\s!fr] - [\c!spacing=\v!packed, - \c!leftsentence=\emdash, - \c!rightsentence=\emdash, - \c!leftsubsentence=\emdash, - \c!rightsubsentence=\emdash, - \c!leftquote=\leftguillemot, - \c!rightquote=\rightguillemot, - \c!leftquotation=\leftguillemot, - \c!rightquotation=\rightguillemot, - \c!date={\v!day+,\v!space,\v!month,\v!space,\v!year}, - \s!mapping={texnansi,ec}, - \s!encoding={texnansi,ec}] - -\installlanguage - [\s!es] - [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, - \c!leftquote=\upperleftsinglesixquote, - \c!rightquote=\upperrightsingleninequote, - \c!leftquotation=\upperleftdoublesixquote, - \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!day,\ ,\v!month,\ ,\v!year}] - -\installlanguage [sp] [\s!es] % old times context - -\installlanguage - [\s!ca] - [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, - \c!leftquote=\upperleftsinglesixquote, - \c!rightquote=\upperrightsingleninequote, - \c!leftquotation=\upperleftdoublesixquote, - \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!day,\ ,\v!month,\ ,\v!year}] - -% Note GB left|/|right (sub)sentences are for \quote {incisi}. - -\installlanguage - [\s!it] - [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=--, - \c!rightsubsentence=--, - \c!leftquote=\upperleftsinglesixquote, - \c!rightquote=\upperrightsingleninequote, - \c!leftquotation=\upperleftdoublesixquote, - \c!rightquotation=\upperrightdoubleninequote, - \c!leftspeech=\leftguillemot, - \c!middlespeech=\leftguillemot, - \c!rightspeech=\rightguillemot, - \c!date={\v!day,\ ,\v!month,\ ,\v!year}, - \s!mapping={texnansi,ec}, - \s!encoding={texnansi,ec}] - -\installlanguage % the same as italian - [\s!la] - [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, - \c!leftquote=\upperleftsinglesixquote, - \c!rightquote=\lowerrightsingleninequote, - \c!leftquotation=\upperleftdoublesixquote, - \c!rightquotation=\lowerrightdoubleninequote, - \c!date={\v!day,\ ,\v!month,\ ,\v!year}] - -\installlanguage - [\s!pt] - [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, - \c!leftquote=\upperleftsinglesixquote, - \c!rightquote=\upperrightsingleninequote, - \c!leftquotation=\upperleftdoublesixquote, - \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!year,\ ,\v!month,\ ,\v!day}, - \s!mapping={texnansi,ec}, - \s!encoding={texnansi,ec}] - -\installlanguage - [\s!ro] - [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, - \c!leftquote=\leftguillemot, - \c!rightquote=\rightguillemot, - \c!leftquotation=\lowerrightdoubleninequote, - \c!rightquotation=\upperleftdoublesixquote, - \c!date={\v!day,\ ,\v!month,\ ,\v!year}] - -%D For compatibility reasons we also define: - -\installlanguage [fa] [\s!fr] % for dutchies only - -\installlanguage [french] [\s!fr] -\installlanguage [spanish] [\s!es] -\installlanguage [catalan] [\s!ca] -\installlanguage [italian] [\s!it] -\installlanguage [latin] [\s!la] -\installlanguage [portuguese] [\s!pt] -\installlanguage [romanian] [\s!ro] - -%D Labels and header texts. - -\setupheadtext [\s!fr] [\v!content=Table des mati\`eres] -\setupheadtext [\s!es] [\v!content=\'Indice] -\setupheadtext [\s!ca] [\v!content=\'Index de continguts] -\setupheadtext [\s!it] [\v!content=Indice] -\setupheadtext [\s!la] [\v!content=Quod in libro continetur] %Argumentum -\setupheadtext [\s!pt] [\v!content=Conte\'udo] -\setupheadtext [\s!ro] [\v!content=Cuprins] - -\setupheadtext [\s!fr] [\v!tables=Tableaux] -\setupheadtext [\s!es] [\v!tables=Tablas] -\setupheadtext [\s!ca] [\v!tables=Taules] -\setupheadtext [\s!it] [\v!tables=Tabelle] -\setupheadtext [\s!la] [\v!tables=Tabulae] -\setupheadtext [\s!pt] [\v!tables=Tabelas] -\setupheadtext [\s!ro] [\v!tables=Tabele] - -\setupheadtext [\s!fr] [\v!figures=Figures] -\setupheadtext [\s!es] [\v!figures=Ilustraciones] -\setupheadtext [\s!ca] [\v!figures=Figures] -\setupheadtext [\s!it] [\v!figures=Figure] -\setupheadtext [\s!la] [\v!figures=Imagines] -\setupheadtext [\s!pt] [\v!figures=Figuras] -\setupheadtext [\s!ro] [\v!figures=Figuri] - -\setupheadtext [\s!fr] [\v!graphics=Graphiques] -\setupheadtext [\s!es] [\v!graphics=Gr\'aficos] -\setupheadtext [\s!it] [\v!graphics=Grafici] -\setupheadtext [\s!ca] [\v!graphics=Gr\`afiques] -\setupheadtext [\s!la] [\v!graphics=Typi] -\setupheadtext [\s!pt] [\v!graphics=Gr\'aficos] -\setupheadtext [\s!ro] [\v!graphics=Grafice] - -\setupheadtext [\s!fr] [\v!intermezzi=Interm\`edes] -\setupheadtext [\s!es] [\v!intermezzi=Intermedios] -\setupheadtext [\s!ca] [\v!intermezzi=Intermedis] -\setupheadtext [\s!it] [\v!intermezzi=Intermezzi] -\setupheadtext [\s!la] [\v!intermezzi=Intermissa] -\setupheadtext [\s!pt] [\v!intermezzi=Interm\'edios] -\setupheadtext [\s!ro] [\v!intermezzi=Intermzzo] - -\setupheadtext [\s!fr] [\v!index=Index] -\setupheadtext [\s!es] [\v!index=\'Indice alfab\'etico] -\setupheadtext [\s!ca] [\v!index=\'Index alfab\`etic] -\setupheadtext [\s!it] [\v!index=Indice] -\setupheadtext [\s!la] [\v!index=Indices] -\setupheadtext [\s!pt] [\v!index=\'Indice] -\setupheadtext [\s!ro] [\v!index=Index] - -\setupheadtext [\s!fr] [\v!abbreviations=Abr\'eviations] -\setupheadtext [\s!es] [\v!abbreviations=Abreviaturas] -\setupheadtext [\s!ca] [\v!abbreviations=Abreviacions] -\setupheadtext [\s!it] [\v!abbreviations=Abbreviazioni] -\setupheadtext [\s!la] [\v!abbreviations=Notae] -\setupheadtext [\s!pt] [\v!abbreviations=Abreviaturas] -\setupheadtext [\s!ro] [\v!abbreviations=Abrevieri] - -\setupheadtext [\s!fr] [\v!logos=Logos] -\setupheadtext [\s!es] [\v!logos=Logotipos] -\setupheadtext [\s!ca] [\v!logos=Logotips] -\setupheadtext [\s!it] [\v!logos=Logotipi] -\setupheadtext [\s!la] [\v!logos=Typi negotiales] -\setupheadtext [\s!pt] [\v!logos=Logotipos] -\setupheadtext [\s!ro] [\v!logos=Logo-uri] - -\setupheadtext [\s!fr] [\v!units=Unit\'es] -\setupheadtext [\s!es] [\v!units=Unidades] -\setupheadtext [\s!ca] [\v!units=Unitats] -\setupheadtext [\s!it] [\v!units=Unit\`a] -\setupheadtext [\s!la] [\v!units=Modi] -\setupheadtext [\s!pt] [\v!units=Unidades] -\setupheadtext [\s!ro] [\v!units=Unit\u{a}\c{t}i] - -\setupheadtext [\s!fr] [pubs=Bibliographie] -\setupheadtext [\s!es] [pubs=Bibliograf\'\ia] -\setupheadtext [\s!ca] [pubs=Referències] -\setupheadtext [\s!it] [pubs=Bibliografia] -%setupheadtext [\s!la] [pubs=?] -%setupheadtext [\s!pt] [pubs=?] -%setupheadtext [\s!ro] [pubs=?] - -\setuplabeltext [\s!fr] [\v!table=Tableau ] -\setuplabeltext [\s!es] [\v!table=Tabla ] -\setuplabeltext [\s!ca] [\v!table=Taula ] -\setuplabeltext [\s!it] [\v!table=Tabella ] -\setuplabeltext [\s!la] [\v!table=Tabula ] -\setuplabeltext [\s!pt] [\v!table=Tabela ] -\setuplabeltext [\s!ro] [\v!table=Tabelul ] - -\setuplabeltext [\s!fr] [\v!figure=Figure ] -\setuplabeltext [\s!es] [\v!figure=Ilustraci\'on ] -\setuplabeltext [\s!ca] [\v!figure=Figura ] -\setuplabeltext [\s!it] [\v!figure=Fig. ] -\setuplabeltext [\s!la] [\v!figure=Imago ] -\setuplabeltext [\s!pt] [\v!figure=Figura ] -\setuplabeltext [\s!ro] [\v!figure=Figura ] - -\setuplabeltext [\s!fr] [\v!intermezzo=Interm\`ede ] -\setuplabeltext [\s!es] [\v!intermezzo=Intermedio ] -\setuplabeltext [\s!ca] [\v!intermezzo=Intermedi ] -\setuplabeltext [\s!it] [\v!intermezzo=Intermezzo ] -\setuplabeltext [\s!la] [\v!intermezzo=Intermissum ] -\setuplabeltext [\s!pt] [\v!intermezzo=Interm\'edio ] -\setuplabeltext [\s!ro] [\v!intermezzo=Intermezzo ] - -\setuplabeltext [\s!fr] [\v!graphic=Illustration ] -\setuplabeltext [\s!es] [\v!graphic=Gr\'afico ] -\setuplabeltext [\s!ca] [\v!graphic=Gr\`afica ] -\setuplabeltext [\s!it] [\v!graphic=Grafico ] -\setuplabeltext [\s!la] [\v!graphic=Typus ] -\setuplabeltext [\s!pt] [\v!graphic=Gr\'afico ] -\setuplabeltext [\s!ro] [\v!graphic=Graficul ] - -\setuplabeltext [\s!fr] [\v!chapter=] % Chapitre -\setuplabeltext [\s!es] [\v!chapter=] % Cap\'\i tulo -\setuplabeltext [\s!ca] [\v!chapter=] % Cap\'\i tol -\setuplabeltext [\s!it] [\v!chapter=] -\setuplabeltext [\s!la] [\v!chapter=] -\setuplabeltext [\s!pt] [\v!chapter=] -\setuplabeltext [\s!ro] [\v!chapter=] - -\setuplabeltext [\s!fr] [\v!section=] % Section -\setuplabeltext [\s!es] [\v!section=] % Secci\'on -\setuplabeltext [\s!ca] [\v!section=] % Secci\'o -\setuplabeltext [\s!it] [\v!section=] -\setuplabeltext [\s!la] [\v!section=] -\setuplabeltext [\s!pt] [\v!section=] -\setuplabeltext [\s!ro] [\v!section=] - -\setuplabeltext [\s!fr] [\v!subsection=] % Soussection -\setuplabeltext [\s!es] [\v!subsection=] % Subsecci\'on -\setuplabeltext [\s!ca] [\v!subsection=] % Subsecci\'o -\setuplabeltext [\s!it] [\v!subsection=] -\setuplabeltext [\s!la] [\v!subsection=] -\setuplabeltext [\s!pt] [\v!subsection=] -\setuplabeltext [\s!ro] [\v!subsection=] - -\setuplabeltext [\s!fr] [\v!subsubsection=] % Soussoussection -\setuplabeltext [\s!es] [\v!subsubsection=] % Subsubsecci\'on -\setuplabeltext [\s!ca] [\v!subsubsection=] % Subsubsecci\'o -\setuplabeltext [\s!it] [\v!subsubsection=] -\setuplabeltext [\s!la] [\v!subsubsection=] -\setuplabeltext [\s!pt] [\v!subsubsection=] -\setuplabeltext [\s!ro] [\v!subsubsection=] - -\setuplabeltext [\s!fr] [\v!subsubsubsection=] % Soussoussoussection -\setuplabeltext [\s!es] [\v!subsubsubsection=] % Subsubsubsecci\'on -\setuplabeltext [\s!ca] [\v!subsubsubsection=] % Subsubsubsecci\'o -\setuplabeltext [\s!it] [\v!subsubsubsection=] -\setuplabeltext [\s!la] [\v!subsubsubsection=] -\setuplabeltext [\s!pt] [\v!subsubsubsection=] -\setuplabeltext [\s!ro] [\v!subsubsubsection=] - -\setuplabeltext [\s!fr] [\v!appendix=] % Annexe -\setuplabeltext [\s!es] [\v!appendix=] % Ap\'endice -\setuplabeltext [\s!ca] [\v!appendix=] % Ap\`endix -\setuplabeltext [\s!it] [\v!appendix=] -\setuplabeltext [\s!la] [\v!appendix=] -\setuplabeltext [\s!pt] [\v!appendix=] -\setuplabeltext [\s!ro] [\v!appendix=] - -\setuplabeltext [\s!fr] [\v!part=Partie ] -\setuplabeltext [\s!es] [\v!part=Parte ] -\setuplabeltext [\s!ca] [\v!part=Part ] -\setuplabeltext [\s!it] [\v!part=Parte ] -\setuplabeltext [\s!la] [\v!part=Pars ] -\setuplabeltext [\s!pt] [\v!part=Parte ] -\setuplabeltext [\s!ro] [\v!part=Partea ] - -\setuplabeltext [\s!fr] [\v!line=ligne ] -\setuplabeltext [\s!es] [\v!line=l\'\i nea ] -\setuplabeltext [\s!ca] [\v!line=l\'\i nia ] -\setuplabeltext [\s!it] [\v!line=riga ] -\setuplabeltext [\s!la] [\v!line=versus ] -\setuplabeltext [\s!pt] [\v!line=linha ] -\setuplabeltext [\s!ro] [\v!line=linia ] - -\setuplabeltext [\s!fr] [\v!lines=lignes ] -\setuplabeltext [\s!es] [\v!lines=l\'\i neas ] -\setuplabeltext [\s!ca] [\v!lines=l\'\i nies ] -\setuplabeltext [\s!it] [\v!lines=righe ] -\setuplabeltext [\s!la] [\v!lines=versus ] -\setuplabeltext [\s!pt] [\v!lines=linhas ] -\setuplabeltext [\s!ro] [\v!lines=liniile ] - -\setuplabeltext [\s!fr] [\v!january=janvier] -\setuplabeltext [\s!fr] [\v!february=f\'evrier] -\setuplabeltext [\s!fr] [\v!march=mars] -\setuplabeltext [\s!fr] [\v!april=avril] -\setuplabeltext [\s!fr] [\v!may=mai] -\setuplabeltext [\s!fr] [\v!june=juin] -\setuplabeltext [\s!fr] [\v!july=juillet] -\setuplabeltext [\s!fr] [\v!august=ao\^ut] -\setuplabeltext [\s!fr] [\v!september=septembre] -\setuplabeltext [\s!fr] [\v!october=octobre] -\setuplabeltext [\s!fr] [\v!november=novembre] -\setuplabeltext [\s!fr] [\v!december=d\'ecembre] - -\setuplabeltext [\s!es] [\v!january=enero] -\setuplabeltext [\s!es] [\v!february=febrero] -\setuplabeltext [\s!es] [\v!march=marzo] -\setuplabeltext [\s!es] [\v!april=abril] -\setuplabeltext [\s!es] [\v!may=mayo] -\setuplabeltext [\s!es] [\v!june=junio] -\setuplabeltext [\s!es] [\v!july=julio] -\setuplabeltext [\s!es] [\v!august=agosto] -\setuplabeltext [\s!es] [\v!september=septiembre] -\setuplabeltext [\s!es] [\v!october=octubre] -\setuplabeltext [\s!es] [\v!november=noviembre] -\setuplabeltext [\s!es] [\v!december=diciembre] - -\setuplabeltext [\s!ca] [\v!january=gener] -\setuplabeltext [\s!ca] [\v!february=febrer] -\setuplabeltext [\s!ca] [\v!march=mar\c{c}] -\setuplabeltext [\s!ca] [\v!april=abril] -\setuplabeltext [\s!ca] [\v!may=maig] -\setuplabeltext [\s!ca] [\v!june=juny] -\setuplabeltext [\s!ca] [\v!july=juliol] -\setuplabeltext [\s!ca] [\v!august=agost] -\setuplabeltext [\s!ca] [\v!september=setembre] -\setuplabeltext [\s!ca] [\v!october=octubre] -\setuplabeltext [\s!ca] [\v!november=novembre] -\setuplabeltext [\s!ca] [\v!december=desembre] - -\setuplabeltext [\s!it] [\v!january=gennaio] -\setuplabeltext [\s!it] [\v!february=febbraio] -\setuplabeltext [\s!it] [\v!march=marzo] -\setuplabeltext [\s!it] [\v!april=aprile] -\setuplabeltext [\s!it] [\v!may=maggio] -\setuplabeltext [\s!it] [\v!june=giugno] -\setuplabeltext [\s!it] [\v!july=luglio] -\setuplabeltext [\s!it] [\v!august=agosto] -\setuplabeltext [\s!it] [\v!september=settembre] -\setuplabeltext [\s!it] [\v!october=ottobre] -\setuplabeltext [\s!it] [\v!november=novembre] -\setuplabeltext [\s!it] [\v!december=dicembre] - -\setuplabeltext [\s!la] [\v!january=Ianuarius] -\setuplabeltext [\s!la] [\v!february=Februarius] -\setuplabeltext [\s!la] [\v!march=Martius] -\setuplabeltext [\s!la] [\v!april=Aprilis] -\setuplabeltext [\s!la] [\v!may=Maius] -\setuplabeltext [\s!la] [\v!june=Iunius] -\setuplabeltext [\s!la] [\v!july=Iulius] % formerly Quintilis -\setuplabeltext [\s!la] [\v!august=Augustus] % formerly Sextilis -\setuplabeltext [\s!la] [\v!september=September] -\setuplabeltext [\s!la] [\v!october=October] -\setuplabeltext [\s!la] [\v!november=November] -\setuplabeltext [\s!la] [\v!december=December] - -\setuplabeltext [\s!pt] [\v!january=janeiro] -\setuplabeltext [\s!pt] [\v!february=fevereiro] -\setuplabeltext [\s!pt] [\v!march=mar\c{c}o] -\setuplabeltext [\s!pt] [\v!april=abril] -\setuplabeltext [\s!pt] [\v!may=maio] -\setuplabeltext [\s!pt] [\v!june=junho] -\setuplabeltext [\s!pt] [\v!july=julho] -\setuplabeltext [\s!pt] [\v!august=agosto] -\setuplabeltext [\s!pt] [\v!september=setembro] -\setuplabeltext [\s!pt] [\v!october=outubro] -\setuplabeltext [\s!pt] [\v!november=novembro] -\setuplabeltext [\s!pt] [\v!december=dezembro] - -\setuplabeltext [\s!ro] [\v!january=ianuarie] -\setuplabeltext [\s!ro] [\v!february=februarie] -\setuplabeltext [\s!ro] [\v!march=martie] -\setuplabeltext [\s!ro] [\v!april=aprilie] -\setuplabeltext [\s!ro] [\v!may=mai] -\setuplabeltext [\s!ro] [\v!june=iunie] -\setuplabeltext [\s!ro] [\v!july=iulie] -\setuplabeltext [\s!ro] [\v!august=august] -\setuplabeltext [\s!ro] [\v!september=septembrie] -\setuplabeltext [\s!ro] [\v!october=octombrie] -\setuplabeltext [\s!ro] [\v!november=noiembrie] -\setuplabeltext [\s!ro] [\v!december=decembrie] - -\setuplabeltext [\s!fr] [\v!sunday=dimanche] -\setuplabeltext [\s!fr] [\v!monday=lundi] -\setuplabeltext [\s!fr] [\v!tuesday=mardi] -\setuplabeltext [\s!fr] [\v!wednesday=mercredi] -\setuplabeltext [\s!fr] [\v!thursday=jeudi] -\setuplabeltext [\s!fr] [\v!friday=vendredi] -\setuplabeltext [\s!fr] [\v!saturday=samedi] - -\setuplabeltext [\s!es] [\v!sunday=domingo] -\setuplabeltext [\s!es] [\v!monday=lunes] -\setuplabeltext [\s!es] [\v!tuesday=martes] -\setuplabeltext [\s!es] [\v!wednesday=mi\'ercoles] -\setuplabeltext [\s!es] [\v!thursday=jueves] -\setuplabeltext [\s!es] [\v!friday=viernes] -\setuplabeltext [\s!es] [\v!saturday=s\'abado] - -\setuplabeltext [\s!ca] [\v!sunday=diumenge] -\setuplabeltext [\s!ca] [\v!monday=dilluns] -\setuplabeltext [\s!ca] [\v!tuesday=dimarts] -\setuplabeltext [\s!ca] [\v!wednesday=dimecres] -\setuplabeltext [\s!ca] [\v!thursday=dijous] -\setuplabeltext [\s!ca] [\v!friday=divendres] -\setuplabeltext [\s!ca] [\v!saturday=dissabte] - -\setuplabeltext [\s!it] [\v!sunday=domenica] -\setuplabeltext [\s!it] [\v!monday=luned\`\i] -\setuplabeltext [\s!it] [\v!tuesday=marted\`\i] -\setuplabeltext [\s!it] [\v!wednesday=mercoled\`\i] -\setuplabeltext [\s!it] [\v!thursday=gioved\`\i] -\setuplabeltext [\s!it] [\v!friday=venerd\`\i] -\setuplabeltext [\s!it] [\v!saturday=sabato] - -\setuplabeltext [\s!la] [\v!sunday=Dies Solis] -\setuplabeltext [\s!la] [\v!monday=Dies Lunae] -\setuplabeltext [\s!la] [\v!tuesday=Dies Martis] -\setuplabeltext [\s!la] [\v!wednesday=Dies Mercuri] -\setuplabeltext [\s!la] [\v!thursday=Dies Iovis] -\setuplabeltext [\s!la] [\v!friday=Dies Veneris] -\setuplabeltext [\s!la] [\v!saturday=Dies Saturni] - -\setuplabeltext [\s!pt] [\v!sunday=domingo] -\setuplabeltext [\s!pt] [\v!monday=segunda-feira] -\setuplabeltext [\s!pt] [\v!tuesday=ter\c{c}a-feira] -\setuplabeltext [\s!pt] [\v!wednesday=quarta-feira] -\setuplabeltext [\s!pt] [\v!thursday=quinta-feira] -\setuplabeltext [\s!pt] [\v!friday=sexta-feira] -\setuplabeltext [\s!pt] [\v!saturday=s\'abado] - -\setuplabeltext [\s!ro] [\v!sunday=duminic\u{a}] -\setuplabeltext [\s!ro] [\v!monday=luni] -\setuplabeltext [\s!ro] [\v!tuesday=mar\c{t}i] -\setuplabeltext [\s!ro] [\v!wednesday=miercuri] -\setuplabeltext [\s!ro] [\v!thursday=joi] -\setuplabeltext [\s!ro] [\v!friday=vineri] -\setuplabeltext [\s!ro] [\v!saturday=s\^{a}mb\u{a}t\u{a}] - -%D Rather new \unknown - -\setuplabeltext [\s!it] [\v!page=pagina ] -\setuplabeltext [\s!it] [\v!atpage=a pagina ] -\setuplabeltext [\s!it] [\v!hencefore=come mostrato sopra] -\setuplabeltext [\s!it] [\v!hereafter=come mostrato sotto] -\setuplabeltext [\s!it] [\v!see=cf. ] - -\setuplabeltext [\s!fr] [\v!page=page ] -\setuplabeltext [\s!fr] [\v!atpage=à la page ] -\setuplabeltext [\s!fr] [\v!hencefore=ci-dessus] -\setuplabeltext [\s!fr] [\v!hereafter=ci-dessous] -\setuplabeltext [\s!fr] [\v!see=cf. ] - -%D Ordinal converters: - -\def\frordinaldaynumber#1% date is masculine - {\number#1\ifcase#1\or - \highordinalstr{er}% - \fi} - -\defineconversion [\s!fr] [\v!day+] [\frordinaldaynumber] - -%D \ShowAllLanguageValues [\s!fr] [french] {French} {kiss} % franse slag -%D \ShowAllLanguageValues [\s!es] [spanish] {Spanish} {guitar} % spaans benauwd -%D \ShowAllLanguageValues [\s!ca] [catalan] {Catalan} {cream} -%D \ShowAllLanguageValues [\s!it] [italian] {Italian} {aria} -%D \ShowAllLanguageValues [\s!la] [latin] {Latin} {lover} % latijnse missen -%D \ShowAllLanguageValues [\s!pt] [portuguese] {Portuguese} {fisherman} -%D \ShowAllLanguageValues [\s!ro] [romanian] {Romanian} {traveller} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-lab.lua b/Master/texmf-dist/tex/context/base/lang-lab.lua new file mode 100644 index 00000000000..1947616a99c --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lang-lab.lua @@ -0,0 +1,130 @@ +if not modules then modules = { } end modules ['lang-lab'] = { + version = 1.001, + comment = "companion to lang-lab.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +--~ local function complete() +--~ local function process(what) +--~ for tag, data in next, what do +--~ for k, v in next, data.labels do +--~ languages[k] = true +--~ end +--~ end +--~ end +--~ process(languages.labels.data.titles) +--~ process(languages.labels.data.texts) +--~ process(languages.labels.data.functions) +--~ process(languages.labels.data.tags) +--~ local function process(what) +--~ for tag, data in next, what do +--~ local labels = data.labels +--~ for k, v in next, languages do +--~ if not labels[k] then +--~ labels[k] = "" +--~ end +--~ end +--~ end +--~ end +--~ process(languages.data.labels.titles) +--~ process(languages.data.labels.texts) +--~ process(languages.data.labels.functions) +--~ process(languages.data.labels.tags) +--~ end +--~ +--~ local function strip(default) +--~ local function process(what) +--~ for tag, data in next, what do +--~ local labels = data.labels +--~ for k, v in next, labels do +--~ if v == "" then +--~ labels[k] = default +--~ end +--~ end +--~ end +--~ end +--~ process(languages.data.labels.titles) +--~ process(languages.data.labels.texts) +--~ process(languages.data.labels.functions) +--~ process(languages.data.labels.tags) +--~ end +--~ +--~ complete() +--~ strip(false) +--~ strip() + +--~ table.print(languages.data.labels,"languages.data.labels",false,true,true) + +-- this will move + +local format, find = string.format, string.find +local next, rawget, type = next, rawget, type +local texsprint = tex.sprint +local prtcatcodes = tex.prtcatcodes + +languages.labels = languages.labels or { } + +local trace_labels = false trackers.register("languages.labels", function(v) trace_labels = v end) + +local report_labels = logs.reporter("languages","labels") + +function languages.labels.define() + local variables = interfaces.variables + local data = languages.data.labels + local function define(command,list,prefixed) + if list then + for tag, data in next, list do + if data.hidden then + -- skip + else + for language, text in next, data.labels do + if text == "" then + -- skip + elseif prefixed and rawget(variables,tag) then + if type(text) == "table" then + texsprint(prtcatcodes,format("\\%s[%s][\\v!%s={{%s},{%s}}]",command,language,tag,text[1],text[2])) + else + texsprint(prtcatcodes,format("\\%s[%s][\\v!%s={{%s},}]",command,language,tag,text)) + end + else + if type(text) == "table" then + texsprint(prtcatcodes,format("\\%s[%s][%s={{%s},{%s}}]",command,language,tag,text[1],text[2])) + else + texsprint(prtcatcodes,format("\\%s[%s][%s={{%s},}]",command,language,tag,text)) + end + end + if trace_labels then + if type(text) == "table" then + report_labels("language '%s', defining label '%s' as '%s' and '%s'",language,tag,text[1],text[2]) + else + report_labels("language '%s', defining label '%s' as '%s'",language,tag,text) + end + end + end + end + end + end + end + define("setupheadtext", data.titles, true) + define("setuplabeltext", data.texts, true) + define("setupmathlabeltext", data.functions) + define("setuptaglabeltext", data.tags) +end + +--~ function languages.labels.check() +--~ for category, list in next, languages.data.labels do +--~ for tag, specification in next, list do +--~ for language, text in next, specification.labels do +--~ if type(text) == "string" and find(text,",") then +--~ report_labels("label with comma: category '%s', language '%s', tag '%s', text '%s'", +--~ category, language, tag, text) +--~ end +--~ end +--~ end +--~ end +--~ end +--~ +--~ languages.labels.check() + diff --git a/Master/texmf-dist/tex/context/base/lang-lab.mkiv b/Master/texmf-dist/tex/context/base/lang-lab.mkiv index 42f2db8ff45..025958ade6a 100644 --- a/Master/texmf-dist/tex/context/base/lang-lab.mkiv +++ b/Master/texmf-dist/tex/context/base/lang-lab.mkiv @@ -11,8 +11,16 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +\writestatus{loading}{ConTeXt Language Macros / Labels} + +\registerctxluafile{lang-lab}{1.001} +\registerctxluafile{lang-txt}{1.001} + \unprotect +%C The UPPERCASE variants are obsolete as we can now use \WORD +%C in an non-interfering way. + %D In this module we deal with language dependant labels and %D prefixes, like in {\em Figure~12} and {\em Chapter 1}. In %D this file we set the default values. Users can easily @@ -28,6 +36,9 @@ %D in front as well as after a part number. This is why the %D current implementation of labels supports two labels too. +\ifdefined\simplifiedcommands \else \newtoks\simplifiedcommands \fi +\ifdefined\Word \else \let\Word\relax \fi + %D \macros %D {setupheadtext, setuplabeltext} %D @@ -38,18 +49,138 @@ %D \showsetup{setuplabeltext} %D %D A regular \CONTEXT\ stores some 1500 labels at most. +%D +%D These commands accept all kind of inputs: +%D +%D \starttyping +%D \setuplabeltext [language] [labellabel=text] +%D \setuplabeltext [language] [labellabel=text,labellabel=text,...] +%D \setuplabeltext [labellabel=text] +%D \setuplabeltext [labellabel=text,labellabel=text,...] +%D \stoptyping +%D +%D The last two cases concern the current language. + +\def\definelabelclass + {\dodoubleempty\dodefinelabelclass} + +\def\dodefinelabelclass[#1][#2]% + {\normalexpanded + {\noexpand\dododefinelabelclass + {#1}% + {\ifsecondargument#2\else\zerocount\fi}% + \expandafter\noexpand\csname dogetupsome#1text\endcsname + \expandafter\noexpand\csname #1language\endcsname + \expandafter\noexpand\csname dodogetupsome#1text\endcsname + \expandafter\noexpand\csname left#1text\endcsname + \expandafter\noexpand\csname right#1text\endcsname + \expandafter\noexpand\csname #1texts\endcsname + \expandafter\noexpand\csname #1text\endcsname}} + +\let\currentlabelcategory\empty + +\def\dododefinelabelclass#1#2#3#4#5#6#7#8#9% + {\setuvalue{setup#1text}{\protecttextprefixes#2\def\currenttextprefixclass{#1}\dodoubleempty\dosetupsometextprefix}% + \setuvalue{preset#1text}{\protecttextprefixes1\def\currenttextprefixclass{#1}\dodoubleempty\dosetupsometextprefix}% + \def#4{\reallanguagetag{\defaultlanguage\currentmainlanguage}}% + \ifnum#2=\plustwo + \def#3{#5#4}% +% \def#5##1##2% ##1=language +% {\ifcsname\??ml:#1:##1:##2\endcsname +% \csname\??ml:#1:##1:##2\endcsname +% \else\ifcsname\??la#4\s!default\endcsname +% \expandafter#5\csname\??la#4\s!default\endcsname{##2}% +% \else\ifcsname\??ml:#1:##2\endcsname +% \csname\??ml:#1:##2\endcsname +% \else\ifcsname\??ml:#1:\s!en:##2\endcsname +% \csname\??ml:#1:\s!en:##2\endcsname +% \else +% ##2% +% \fi\fi\fi\fi}% + \def#5##1##2% ##1=language + {\ifcsname\??ml:\currentlabelcategory#1:##1:##2\endcsname + \csname\??ml:\currentlabelcategory#1:##1:##2\endcsname + \else\ifcsname\??ml:#1:##1:##2\endcsname + \csname\??ml:#1:##1:##2\endcsname + \else\ifcsname\??la#4\s!default\endcsname + \expandafter#5\csname\??la#4\s!default\endcsname{##2}% + \else\ifcsname\??ml:\currentlabelcategory#1:##2\endcsname + \csname\??ml:\currentlabelcategory#1:##2\endcsname + \else\ifcsname\??ml:#1:##2\endcsname + \csname\??ml:#1:##2\endcsname + \else\ifcsname\??ml:\currentlabelcategory#1:\s!en:##2\endcsname + \csname\??ml:\currentlabelcategory#1:\s!en:##2\endcsname + \else\ifcsname\??ml:#1:\s!en:##2\endcsname + \csname\??ml:#1:\s!en:##2\endcsname + \else + ##2% + \fi\fi\fi\fi\fi\fi\fi}% + \let#6\gobbleoneargument + \let#7\gobbleoneargument + \let#8\gobbletwoarguments + \let#9#3% + \else + \unexpanded\def#3{#5#4}% + \unexpanded\def#5##1##2% + {\ifcsname\??ml:#1:##1:##2\endcsname + \expandafter\let\expandafter\thetextprefix\csname\??ml:#1:##1:##2\endcsname + \else\ifcsname\??la#4\s!default\endcsname + \expandafter#5\csname\??la#4\s!default\endcsname{##2}% + \else\ifcsname\??ml:#1:##2\endcsname + \expandafter\let\expandafter\thetextprefix\csname\??ml:#1:##2\endcsname + \else\ifcsname\??ml:#1:\s!en:##2\endcsname + \expandafter\let\expandafter\thetextprefix\csname\??ml:#1:\s!en:##2\endcsname + \else + \let\thetextprefix\dummytextprefix + \fi\fi\fi\fi}% + \unexpanded\def#6##1{#3{##1}\expandafter\flushleftlabelclass \thetextprefix}% + \unexpanded\def#7##1{#3{##1}\expandafter\flushrightlabelclass\thetextprefix}% + \unexpanded\def#8##1{#3{##1}\expandafter\flushbothlabelclass \thetextprefix}% #2 + \unexpanded\def#9##1{#3{##1}\expandafter\flushleftlabelclass \thetextprefix}% + \fi + \appendtoks + \let#6\firstofoneargument % to be checked + \let#7\firstofoneargument % to be checked + \let#8\firstofoneargument % to be checked + \let#9\firstofoneargument % to be checked + \to \simplifiedcommands + } + +\let\flushleftlabelclass \firstoftwoarguments +\let\flushrightlabelclass\secondoftwoarguments +\def\flushbothlabelclass #1#2#3{#1#3#2} +\def\dummytextprefix {\empty\empty} + +%D \macros +%D {headtext, +%D labeltext, leftlabeltext, rightlabeltext, labeltexts, +%D LABELTEXT, LEFTLABELTEXT, RIGHTLABELTEXT, LABELTEXTS} +%D +%D Once defined, head and label texts can be called upon using: +%D +%D \showsetup{headtext} +%D \showsetup{labeltext} +%D +%D The latter one has an upcased alternative \type{\LABELTEXT}. +%D +%D \macros +%D {presetheadtext,presetlabeltext} +%D +%D These macros enable us to automatically define head and label +%D texts without replacing predefined ones. They are internal macros. -\let\handletextprefix\relax +\definelabelclass [head] [0] % titles +\definelabelclass [label] [0] % texts +\definelabelclass [mathlabel] [0] % functions +\definelabelclass [taglabel] [2] % tags + +\appendtoks \let\labellanguage\currentlanguage \to \everycurrentdate -\newconditional\protecttextprefixes +\newconstant\protecttextprefixes \let\currenttextprefixtag \s!unknown \let\currenttextprefixclass\s!unknown -\unexpanded\def\setupheadtext {\setfalse\protecttextprefixes\let\currenttextprefixclass\??mh\dodoubleempty\dosetupsometextprefix} -\unexpanded\def\setuplabeltext {\setfalse\protecttextprefixes\let\currenttextprefixclass\??ml\dodoubleempty\dosetupsometextprefix} -\unexpanded\def\setupmathlabeltext{\setfalse\protecttextprefixes\let\currenttextprefixclass\??mm\dodoubleempty\dosetupsometextprefix} - \def\dosetupsometextprefix[#1][#2]% {\ifsecondargument \edef\currenttextprefixtag{\reallanguagetag{#1}}% @@ -66,172 +197,44 @@ {\doassignsometextprefix{#1}[#2,,]} \def\doassignsometextprefix#1% - {\ifconditional\protecttextprefixes - \ifcsname\currenttextprefixclass\currenttextprefixtag#1\endcsname + {\ifcase\protecttextprefixes + % no checking + \expandafter\doassignsometextprefixyes + \or + % checking + \ifcsname\??ml:\currenttextprefixclass:\currenttextprefixtag:#1\endcsname \expandafter\expandafter\expandafter\doassignsometextprefixnop \else \expandafter\expandafter\expandafter\doassignsometextprefixyes \fi - \else - \expandafter\doassignsometextprefixyes + \or + % simple assignment (a bit overkill but it fits in the whole) + \expandafter\doassignsometextprefixdumb \fi{#1}} -\ifdefined\Word\else \let\Word\relax \fi - -% Checking saves some 8K in the compressed format and getting rid of the embedded -% \handletextprefix was good for another 6K. In the end the new solution is not -% even that inefficient. And the checking is done at format generation time anyway. - \def\doassignsometextprefixyes#1[#2,#3,#4]% {\edef\!!stringa{#2}% \edef\!!stringb{#3}% \ifx\!!stringb\empty \ifx\!!stringa\empty - \expandafter\def\csname\currenttextprefixclass\currenttextprefixtag#1\endcsname{\empty\empty}% + \expandafter\def\csname\??ml:\currenttextprefixclass:\currenttextprefixtag:#1\endcsname{\empty\empty}% \else - \expandafter\def\csname\currenttextprefixclass\currenttextprefixtag#1\endcsname{{#2}\empty}% + \expandafter\def\csname\??ml:\currenttextprefixclass:\currenttextprefixtag:#1\endcsname{{#2}\empty}% \fi \else - \expandafter\def\csname\currenttextprefixclass\currenttextprefixtag#1\endcsname{{#2}{#3}}% + \expandafter\def\csname\??ml:\currenttextprefixclass:\currenttextprefixtag:#1\endcsname{{#2}{#3}}% \fi} \def\doassignsometextprefixnop#1[#2]% {} -%D By changing the meaning of \type {\handletextprefix} we -%D can filter the left and right labeltext as well as convert -%D labels to uppercase. -%D -%D These commands accept all kind of inputs: -%D -%D \starttyping -%D \setuplabeltext [language] [labellabel=text] -%D \setuplabeltext [language] [labellabel=text,labellabel=text,...] -%D \setuplabeltext [labellabel=text] -%D \setuplabeltext [labellabel=text,labellabel=text,...] -%D \stoptyping -%D -%D The last two cases concern the current language. - -%D \macros -%D {headtext, -%D labeltext, leftlabeltext, rightlabeltext, labeltexts, -%D LABELTEXT, LEFTLABELTEXT, RIGHTLABELTEXT, LABELTEXTS} -%D -%D Once defined, head and label texts can be called upon using: -%D -%D \showsetup{headtext} -%D \showsetup{labeltext} -%D -%D The latter one has an upcased alternative \type{\LABELTEXT}. - -\def\labellanguage {\reallanguagetag{\defaultlanguage\currentmainlanguage}} -\def\headlanguage {\reallanguagetag{\defaultlanguage\currentmainlanguage}} -\def\mathlabellanguage{\reallanguagetag{\defaultlanguage\currentmainlanguage}} - -\appendtoks \let\labellanguage\currentlanguage \to \everycurrentdate - -\def\dummytextprefix{\empty\empty} - -\def\dogetupsomelabeltext {\dodogetupsomelabeltext \labellanguage } % second argument is textlabel -\def\dogetupsomeheadtext {\dodogetupsomeheadtext \headlanguage } % second argument is headlabel -\def\dogetupsomemathlabeltext{\dodogetupsomemathlabeltext\mathlabellanguage } % second argument is headlabel - -\def\dodogetupsomelabeltext#1#2% - {\ifcsname\??ml#1#2\endcsname - \expandafter\let\expandafter\thetextprefix\csname\??ml#1#2\endcsname - \else\ifcsname\??la\labellanguage\s!default\endcsname - \expandafter\dodogetupsomelabeltext\csname\??la\labellanguage\s!default\endcsname{#2}% - \else\ifcsname\??ml#2\endcsname - \expandafter\let\expandafter\thetextprefix\csname\??ml#2\endcsname - \else\ifcsname\??ml\s!en#2\endcsname - \expandafter\let\expandafter\thetextprefix\csname\??ml\s!en#2\endcsname - \else - \let\thetextprefix\dummytextprefix - \fi\fi\fi\fi} - -\def\dodogetupsomeheadtext#1#2% - {\ifcsname\??mh#1#2\endcsname - \expandafter\let\expandafter\thetextprefix\csname\??mh#1#2\endcsname - \else\ifcsname\??la\headlanguage\s!default\endcsname - \expandafter\dodogetupsomeheadtext\csname\??la\headlanguage\s!default\endcsname{#2}% - \else\ifcsname\??mh#2\endcsname - \expandafter\let\expandafter\thetextprefix\csname\??mh#2\endcsname - \else\ifcsname\??mh\s!en#2\endcsname - \expandafter\let\expandafter\thetextprefix\csname\??mh\s!en#2\endcsname - \else - \let\thetextprefix\dummytextprefix - \fi\fi\fi\fi} - -\def\dodogetupsomemathlabeltext#1#2% - {\ifcsname\??mm#1#2\endcsname - \expandafter\let\expandafter\thetextprefix\csname\??mm#1#2\endcsname - \else\ifcsname\??la\mathlabellanguage\s!default\endcsname - \expandafter\dodogetupsomemathlabeltext\csname\??la\mathlabellanguage\s!default\endcsname{#2}% - \else\ifcsname\??mm#2\endcsname - \expandafter\let\expandafter\thetextprefix\csname\??mm#2\endcsname - \else\ifcsname\??mm\s!en#2\endcsname - \expandafter\let\expandafter\thetextprefix\csname\??mm\s!en#2\endcsname - \else - \let\thetextprefix\dummytextprefix - \fi\fi\fi\fi} - -% The WORD variants are a bit inefficient when #1/#2 are empty but they are -% seldom used (one can better set the style). - -\let\flushleftlabeltext \firstoftwoarguments -\let\flushrightlabeltext \secondoftwoarguments -\let\flushleftmathlabeltext \firstoftwoarguments -\let\flushrightmathlabeltext\secondoftwoarguments - -\def\flushleftlabelWORD #1#2{\WORD{#1}} -\def\flushrightlabelWORD #1#2{\WORD{#2}} -\def\flushbothlabeltexts #1#2#3{#1#3#2} -\def\flushbothlabelTEXTS #1#2#3{\WORD{#1}#3\WORD{#2}} - -\unexpanded\def\headtext #1{\dogetupsomeheadtext {#1}\expandafter\flushleftlabeltext \thetextprefix} -\unexpanded\def\leftlabeltext #1{\dogetupsomelabeltext {#1}\expandafter\flushleftlabeltext \thetextprefix} -\unexpanded\def\rightlabeltext #1{\dogetupsomelabeltext {#1}\expandafter\flushrightmathlabeltext\thetextprefix} -\unexpanded\def\LEFTLABELTEXT #1{\dogetupsomelabeltext {#1}\expandafter\flushleftlabelWORD \thetextprefix} -\unexpanded\def\RIGHTLABELTEXT #1{\dogetupsomelabeltext {#1}\expandafter\flushrightlabelWORD \thetextprefix} -\unexpanded\def\labeltexts #1{\dogetupsomelabeltext {#1}\expandafter\flushbothlabeltexts \thetextprefix} % #2 -\unexpanded\def\LABELTEXTS #1{\dogetupsomelabeltext {#1}\expandafter\flushbothlabelTEXTS \thetextprefix} % #2 -\unexpanded\def\leftmathlabeltext #1{\dogetupsomemathlabeltext{#1}\expandafter\flushleftmathlabeltext \thetextprefix} -\unexpanded\def\rightmathlabeltext#1{\dogetupsomemathlabeltext{#1}\expandafter\flushrightlabeltext \thetextprefix} - -\let\labeltext \leftlabeltext -\let\LABELTEXT \LEFTLABELTEXT -\let\mathlabeltext\leftmathlabeltext - -\ifx\simplifiedcommands\undefined \newtoks\simplifiedcommands \fi - -\appendtoks - \let \headtext \firstofoneargument - \let \labeltext \firstofoneargument - \let \leftlabeltext \firstofoneargument - \let \rightlabeltext \firstofoneargument - \let \HEADTEXT \firstofoneargument - \let \LABELTEXT \firstofoneargument - \let \LEFTLABELTEXT \firstofoneargument - \let \RIGHTLABELTEXT \firstofoneargument - \let \mathlabeltext \firstofoneargument -\to \simplifiedcommands - -%D \macros -%D {presetheadtext,presetlabeltext} -%D -%D The next two macros enable us to automatically define -%D head and label texts without replacing predefined ones. -%D These are internal macros. - -\def\presetheadtext {\settrue\protecttextprefixes\let\currenttextprefixclass\??mh\dodoubleempty\dosetupsometextprefix} -\def\presetlabeltext {\settrue\protecttextprefixes\let\currenttextprefixclass\??ml\dodoubleempty\dosetupsometextprefix} -\def\presetmathlabeltext{\settrue\protecttextprefixes\let\currenttextprefixclass\??mm\dodoubleempty\dosetupsometextprefix} +\def\doassignsometextprefixdumb#1[#2,#3]% + {\expandafter\def\csname\??ml:\currenttextprefixclass:\currenttextprefixtag:#1\endcsname{#2}} %D \macros %D {translate} %D -%D Sometismes macros contain language specific words that are to +%D Sometimes macros contain language specific words that are to %D be typeset. Such macros can be made (more) language %D independant by using: %D @@ -280,4 +283,12 @@ {\getparameters[\??lg][#1]% \edef#2{\csname\??lg\currentlanguage\endcsname}} +%D Now we load the labels: + +\ifdefined\sixperemspace \else \def\sixperemspace{ } \fi % we could embed 0x2006 but it does not show up in a editor + +%D Now we can load the labels: + +\ctxlua{languages.labels.define()} + \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-mis.mkiv b/Master/texmf-dist/tex/context/base/lang-mis.mkiv index 0df45877b0d..231697c7ee7 100644 --- a/Master/texmf-dist/tex/context/base/lang-mis.mkiv +++ b/Master/texmf-dist/tex/context/base/lang-mis.mkiv @@ -221,12 +221,12 @@ \def\handlemathmodediscretionary#1{\executeifdefined{\@tmd@math@\detokenize{#1}}\donothing} \def\handletextmodediscretionary#1{\executeifdefined{\@tmd@text@\detokenize{#1}}\donothing} -\def\installdiscretionaries#1#2{\writestatus\m!systems{use \string \installdiscretionary}} % obsolete +\def\installdiscretionaries#1#2{\writestatus\m!system{use \string \installdiscretionary}} % obsolete -\chardef\discretionarymode\plusone +\setnewconstant\discretionarymode\plusone \def\ignorediscretionaries - {\chardef\discretionarymode\zerocount} + {\discretionarymode\zerocount} \def\discretionarycommand {% if direct if, we need \relax for lookahead in math mode @@ -277,7 +277,7 @@ \let\domathmodediscretionary\handlemathmodediscretionary -\def\dotextmodediscretionary#1% +\def\dotextmodediscretionary#1% grouped ! {\bgroup \let\nextnextnext\egroup \def\next##1#1% @@ -542,7 +542,7 @@ %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 +\setnewconstant\compoundcharactermode\plusone \def\installcompoundcharacter #1#2#3 #4% {#4} no grouping {\ifcase\compoundcharactermode @@ -553,8 +553,6 @@ \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} @@ -574,7 +572,7 @@ %D this macro is supposed to be used grouped! \def\ignorecompoundcharacter - {\chardef\compoundcharactermode\zerocount} + {\compoundcharactermode\zerocount} \let\restorecompoundcharacter \gobbleoneargument % obsolete \let\enableactivediscretionaries\relax % obsolete diff --git a/Master/texmf-dist/tex/context/base/lang-sla.mkii b/Master/texmf-dist/tex/context/base/lang-sla.mkii index 62483aeb689..2834b652f6a 100644 --- a/Master/texmf-dist/tex/context/base/lang-sla.mkii +++ b/Master/texmf-dist/tex/context/base/lang-sla.mkii @@ -11,6 +11,461 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% Todo: replace \'.. by \namedglyph + +%D The framework of this module is set up by Hans Hagen while +%D many of the first translations were done by Tobias. Later +%D on, corrections were made by users. If you have suggestions, +%D or feel that your name missing here, don't hesitate to send +%D us an email. +%D +%D \starttabulate[|lB|l|] +%D \NC Czech \NC Tom Hudec, Petr Sojka \NC \NR +%D \NC Polish \NC Grzegorz Sapijaszko \NC \NR +%D \NC Croatian \NC \Zcaron eljko Vrba \NC \NR +%D \NC Slovenian \NC Mojca Miklavec \NC \NR +%D \NC Cz and Sk \NC Richard Gabriel \NC \NR +%D \stoptabulate + +% Belarussian, Russian, Ukrainian, Bulgarian, Macedonian, +% Serbian, Croatian, Slovenian, Czech, Kushubian, +% Lusatian/Sorbian/Wendish, Polish, Slovak, Albanian, +% Illyrian, Armenian + +\writestatus{loading}{ConTeXt Language Macros / Slavic Languages} + +\unprotect + +\installlanguage + [\s!pl] + [\c!spacing=\v!packed, + \c!leftsentence=---, + \c!rightsentence=---, + \c!leftsubsentence=---, + \c!rightsubsentence=---, + \c!leftquote=\lowerleftsingleninequote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\lowerleftdoubleninequote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!day,{.},\ ,\v!month,\ ,\v!year}, + \s!mapping={pl0,ec,qx}, + \s!encoding={pl0,ec,qx}] + +\installlanguage + [\s!cs] + [\c!spacing=\v!packed, + \c!leftsentence=\thickglue--\thickglue\penalty-20\relax, % hh, \relax added + \c!rightsentence=\thickglue--\thickglue\penalty-20\relax, + \c!leftsubsentence=~---~\penalty-20\relax, + \c!rightsubsentence=~---~\penalty-20\relax, + \c!leftquote=\lowerleftsingleninequote, + \c!rightquote=\upperrightsinglesixquote, + \c!leftquotation=\lowerleftdoubleninequote, + \c!rightquotation=\upperrightdoublesixquote, + \c!date={\v!day,{.\,},\v!month,\ ,\v!year}, + \s!mapping={il2,ec}, + \s!encoding={il2,ec}] + +\installlanguage + [\s!sk] + [\c!spacing=\v!packed, + \c!leftsentence=---, + \c!rightsentence=---, + \c!leftsubsentence=---, + \c!rightsubsentence=---, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!day,{.\,},\v!month,\ ,\v!year}, + \s!mapping={il2,ec}, + \s!encoding={il2,ec}] + +\installlanguage + [\s!hr] + [\c!spacing=\v!packed, + \c!leftsentence=---, + \c!rightsentence=---, + \c!leftsubsentence=---, + \c!rightsubsentence=---, + \c!leftquote=\lowerleftsingleninequote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\lowerleftdoubleninequote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!day,{.},\ ,\v!month,\ ,\v!year}, + \s!mapping=ec, + \s!encoding=ec] + +%D The default quotation marks for Slovenian were chosen as +%D \lowerleftdoubleninequote these ones\upperrightdoublesixquote\ +%D which was probably due to the strong influence computers +%D had on typesetting, but \rightguillemot these ones\leftguillemot\ +%D are \quotation{more correct}. +%D +%D If you still want the other quotation marks, use this: +%D +%D \starttyping +%D \installlanguage +%D [sl] +%D [leftquote=\lowerleftsingleninequote, +%D rightquote=\upperrightsinglesixquote, +%D leftquotation=\lowerleftdoubleninequote, +%D rightquotation=\upperrightdoublesixquote] +%D \stoptyping +%D +%D If you disagree with the change, please send an email to Mojca, but +%D best use some pretty strong arguments because she loves S{\sl love}nia +%D too much to compromise on this. +%D +%D German faces approximately the same problem. I (MM) would prefer to +%D have something like: +%D +%D \starttyping +%D \mainlanguage[sl][quotationstyle=guillemot|doublequote] % better name needed +%D \stoptyping +%D +%D but users are expected to respect the rules of nice and correct +%D typography anyway. + +\installlanguage + [\s!sl] + [\c!spacing=\v!packed, + \c!leftsentence={\hbox{--~}}, + \c!rightsentence={\hbox{~--}}, + \c!leftsubsentence={--}, + \c!rightsubsentence={--}, + %\c!leftquote=\lowerleftsingleninequote, + %\c!rightquote=\upperrightsinglesixquote, + %\c!leftquotation=\lowerleftdoubleninequote, + %\c!rightquotation=\upperrightdoublesixquote, + \c!leftquote=\guilsingleright, + \c!rightquote=\guilsingleleft, + \c!leftquotation=\rightguillemot, + \c!rightquotation=\leftguillemot, + \c!date={\v!day,{.},\ ,\v!month,\ ,\v!year}, + \s!mapping=ec, + \s!encoding=ec] + +\installlanguage [polish] [\s!pl] +\installlanguage [czech] [\s!cs] +\installlanguage [slovak] [\s!sk] +\installlanguage [croatian] [\s!hr] +\installlanguage [slovenian] [\s!sl] +\installlanguage [slovene] [\s!sl] % both possible (mojca: still needed?) + +\installlanguage [cz] [\s!cs] + +% labels + +\setupheadtext [\s!pl] [\v!content=Spis tre\sacute ci] +\setupheadtext [\s!cs] [\v!content=Obsah] +\setupheadtext [\s!sk] [\v!content=Obsah] +\setupheadtext [\s!hr] [\v!content=Sadr\zcaron aj] +\setupheadtext [\s!sl] [\v!content=Kazalo] + +\setupheadtext [\s!pl] [\v!tables=Tabele] +\setupheadtext [\s!cs] [\v!tables=Tabulky] +\setupheadtext [\s!sk] [\v!tables=Tabuliek] +\setupheadtext [\s!hr] [\v!tables=Tablice] +\setupheadtext [\s!sl] [\v!tables=Tabele] + +\setupheadtext [\s!pl] [\v!figures=Ilustracje] +\setupheadtext [\s!cs] [\v!figures=Obr\aacute zky] +\setupheadtext [\s!sk] [\v!figures=Obr\aacute zkov] +\setupheadtext [\s!hr] [\v!figures=Slike] +\setupheadtext [\s!sl] [\v!figures=Slike] + +\setupheadtext [\s!pl] [\v!graphics=Grafika] +\setupheadtext [\s!cs] [\v!graphics=Grafy] +\setupheadtext [\s!sk] [\v!graphics=Graf] +\setupheadtext [\s!hr] [\v!graphics=Slike] +\setupheadtext [\s!sl] [\v!graphics=Slike] + +\setupheadtext [\s!pl] [\v!intermezzi=Intermezza] +\setupheadtext [\s!cs] [\v!intermezzi=Intermezza] +\setupheadtext [\s!sk] [\v!intermezzi=Intermezz\aacute] +\setupheadtext [\s!hr] [\v!intermezzi=Intermeci] +\setupheadtext [\s!sl] [\v!intermezzi=Intermezzi] + +\setupheadtext [\s!pl] [\v!index=Indeks] +\setupheadtext [\s!cs] [\v!index=Rejst\rcaron\iacute k] +\setupheadtext [\s!sk] [\v!index=Zoznam] +\setupheadtext [\s!hr] [\v!index=Indeks] +\setupheadtext [\s!sl] [\v!index=Stvarno kazalo] + +\setupheadtext [\s!pl] [\v!abbreviations=Skr\oacute cenie] +\setupheadtext [\s!cs] [\v!abbreviations=Zkratky] +\setupheadtext [\s!sk] [\v!abbreviations=Skratky] +\setupheadtext [\s!hr] [\v!abbreviations=Kratice] +\setupheadtext [\s!sl] [\v!abbreviations=Kratice] + +\setupheadtext [\s!pl] [\v!logos=Znaki] +\setupheadtext [\s!cs] [\v!logos=Loga] +\setupheadtext [\s!sk] [\v!logos=Log\aacute] +\setupheadtext [\s!hr] [\v!logos=Znakovi] +\setupheadtext [\s!sl] [\v!logos=Logotipi] + +\setupheadtext [\s!pl] [\v!units=Jednostki] +\setupheadtext [\s!cs] [\v!units=Jednotky] +\setupheadtext [\s!sk] [\v!units=Jednotky] +\setupheadtext [\s!hr] [\v!units=Jedinice] +\setupheadtext [\s!sl] [\v!units=Enote] + +%setupheadtext [\s!pl] [pubs=?] +\setupheadtext [\s!cs] [pubs=Literatura] +%setupheadtext [\s!sk] [pubs=?] +\setupheadtext [\s!hr] [pubs=Literatura] +\setupheadtext [\s!sl] [pubs=Literatura] + +\setuplabeltext [\s!pl] [\v!table=Tabela ] +\setuplabeltext [\s!cs] [\v!table=Tabulka ] +\setuplabeltext [\s!sk] [\v!table=Tabu\lcaron ka ] +\setuplabeltext [\s!hr] [\v!table=Tablica ] +\setuplabeltext [\s!sl] [\v!table=Tabela ] + +\setuplabeltext [\s!pl] [\v!figure=Ilustracja ] +\setuplabeltext [\s!cs] [\v!figure=Obr\aacute zek ] +\setuplabeltext [\s!sk] [\v!figure=Obr\aacute zok ] +\setuplabeltext [\s!hr] [\v!figure=Slika ] +\setuplabeltext [\s!sl] [\v!figure=Slika ] + +\setuplabeltext [\s!pl] [\v!intermezzo=Intermezzo ] +\setuplabeltext [\s!cs] [\v!intermezzo=Intermezzo ] +\setuplabeltext [\s!sk] [\v!intermezzo=Intermezzo ] +\setuplabeltext [\s!hr] [\v!intermezzo=Intermeco ] +\setuplabeltext [\s!sl] [\v!intermezzo=Intermezzo ] + +\setuplabeltext [\s!pl] [\v!graphic=Grafika ] +\setuplabeltext [\s!cs] [\v!graphic=Graf ] +\setuplabeltext [\s!sk] [\v!graphic=Graf ] +\setuplabeltext [\s!hr] [\v!graphic=Slika ] +\setuplabeltext [\s!sl] [\v!graphic=Slika ] + +\setuplabeltext [\s!pl] [\v!chapter=] % Rozdzia\l +\setuplabeltext [\s!cs] [\v!chapter=] % Kapitola +\setuplabeltext [\s!sk] [\v!chapter=] % Kapitola +\setuplabeltext [\s!hr] [\v!chapter=] % Poglavlje +\setuplabeltext [\s!sl] [\v!chapter=] % Poglavje + +\setuplabeltext [\s!pl] [\v!section=] % Podrozdzia\l +\setuplabeltext [\s!cs] [\v!section=] % Sekce +\setuplabeltext [\s!sk] [\v!section=] % Sekcia +\setuplabeltext [\s!hr] [\v!section=] % Odjeljak +\setuplabeltext [\s!sl] [\v!section=] + +\setuplabeltext [\s!pl] [\v!subsection=] +\setuplabeltext [\s!cs] [\v!subsection=] % Podsekce +\setuplabeltext [\s!sk] [\v!subsection=] % Podsekcia +\setuplabeltext [\s!hr] [\v!subsection=] % Pododjeljak +\setuplabeltext [\s!sl] [\v!subsection=] + +\setuplabeltext [\s!pl] [\v!subsubsection=] +\setuplabeltext [\s!cs] [\v!subsubsection=] % Podpodsekce +\setuplabeltext [\s!sk] [\v!subsubsection=] % Podpodsekcia +\setuplabeltext [\s!hr] [\v!subsubsection=] % Podpododjeljak +\setuplabeltext [\s!sl] [\v!subsubsection=] + +\setuplabeltext [\s!pl] [\v!subsubsubsection=] +\setuplabeltext [\s!cs] [\v!subsubsubsection=] % Podpodpodsekce +\setuplabeltext [\s!sk] [\v!subsubsubsection=] % Podpodpodsekcia +\setuplabeltext [\s!hr] [\v!subsubsubsection=] % Podpodpododjeljak +\setuplabeltext [\s!sl] [\v!subsubsubsection=] + +\setuplabeltext [\s!pl] [\v!appendix=] % Dodatek +\setuplabeltext [\s!cs] [\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!cs] [\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!cs] [\v!line=\rcaron\aacute dek ] +\setuplabeltext [\s!sk] [\v!line=riadok ] +\setuplabeltext [\s!hr] [\v!line=redak ] +\setuplabeltext [\s!sl] [\v!line=vrstica ] + +\setuplabeltext [\s!pl] [\v!lines=wiersze ] +\setuplabeltext [\s!cs] [\v!lines=\rcaron\aacute dky ] +\setuplabeltext [\s!sk] [\v!lines=riadky ] +\setuplabeltext [\s!hr] [\v!lines=retci ] +\setuplabeltext [\s!sl] [\v!lines=vrstice ] + +\setuplabeltext [\s!pl] [\v!january=stycznia] +\setuplabeltext [\s!pl] [\v!february=lutego] +\setuplabeltext [\s!pl] [\v!march=marca] +\setuplabeltext [\s!pl] [\v!april=kwietnia] +\setuplabeltext [\s!pl] [\v!may=maja] +\setuplabeltext [\s!pl] [\v!june=czerwca] +\setuplabeltext [\s!pl] [\v!july=lipca] +\setuplabeltext [\s!pl] [\v!august=sierpnia] +\setuplabeltext [\s!pl] [\v!september=wrze\sacute nia] +\setuplabeltext [\s!pl] [\v!october=pa\zacute dziernika] +\setuplabeltext [\s!pl] [\v!november=listopada] +\setuplabeltext [\s!pl] [\v!december=grudnia] + +\setuplabeltext [\s!cs] [\v!january=ledna] +\setuplabeltext [\s!cs] [\v!february=\uacute nora] +\setuplabeltext [\s!cs] [\v!march=b\rcaron ezna] +\setuplabeltext [\s!cs] [\v!april=dubna] +\setuplabeltext [\s!cs] [\v!may=kv\ecaron tna] +\setuplabeltext [\s!cs] [\v!june=\ccaron ervna] +\setuplabeltext [\s!cs] [\v!july=\ccaron ervence] +\setuplabeltext [\s!cs] [\v!august=srpna] +\setuplabeltext [\s!cs] [\v!september=z\aacute\rcaron\iacute{}] +\setuplabeltext [\s!cs] [\v!october=\rcaron\iacute jna] +\setuplabeltext [\s!cs] [\v!november=listopadu] +\setuplabeltext [\s!cs] [\v!december=prosince] + +\setuplabeltext [\s!sk] [\v!january=janu\aacute ra] +\setuplabeltext [\s!sk] [\v!february=febru\aacute ra] +\setuplabeltext [\s!sk] [\v!march=marca] +\setuplabeltext [\s!sk] [\v!april=apr\iacute la] +\setuplabeltext [\s!sk] [\v!may=m\aacute ja] +\setuplabeltext [\s!sk] [\v!june=j\uacute na] +\setuplabeltext [\s!sk] [\v!july=j\uacute la] +\setuplabeltext [\s!sk] [\v!august=augusta] +\setuplabeltext [\s!sk] [\v!september=septembra] +\setuplabeltext [\s!sk] [\v!october=okt\oacute bra] +\setuplabeltext [\s!sk] [\v!november=novembra] +\setuplabeltext [\s!sk] [\v!december=decembra] + +\setuplabeltext [\s!hr] [\v!january=sije\ccaron anj] +\setuplabeltext [\s!hr] [\v!february=velja\ccaron a] +\setuplabeltext [\s!hr] [\v!march=o\zcaron ujak] +\setuplabeltext [\s!hr] [\v!april=travanj] +\setuplabeltext [\s!hr] [\v!may=svibanj] +\setuplabeltext [\s!hr] [\v!june=lipanj] +\setuplabeltext [\s!hr] [\v!july=srpanj] +\setuplabeltext [\s!hr] [\v!august=kolovoz] +\setuplabeltext [\s!hr] [\v!september=rujan] +\setuplabeltext [\s!hr] [\v!october=listopad] +\setuplabeltext [\s!hr] [\v!november=studeni] +\setuplabeltext [\s!hr] [\v!december=prosinac] + +\setuplabeltext [\s!sl] [\v!january=januar] +\setuplabeltext [\s!sl] [\v!february=februar] +\setuplabeltext [\s!sl] [\v!march=marec] +\setuplabeltext [\s!sl] [\v!april=april] +\setuplabeltext [\s!sl] [\v!may=maj] +\setuplabeltext [\s!sl] [\v!june=junij] +\setuplabeltext [\s!sl] [\v!july=julij] +\setuplabeltext [\s!sl] [\v!august=avgust] +\setuplabeltext [\s!sl] [\v!september=september] +\setuplabeltext [\s!sl] [\v!october=oktober] +\setuplabeltext [\s!sl] [\v!november=november] +\setuplabeltext [\s!sl] [\v!december=december] + +\setuplabeltext [\s!pl] [\v!sunday=niedziela] +\setuplabeltext [\s!pl] [\v!monday=poniedzia\lstroke ek] +\setuplabeltext [\s!pl] [\v!tuesday=wtorek] +\setuplabeltext [\s!pl] [\v!wednesday=\sacute roda] +\setuplabeltext [\s!pl] [\v!thursday=czwartek] +\setuplabeltext [\s!pl] [\v!friday=pi\aogonek tek] +\setuplabeltext [\s!pl] [\v!saturday=sobota] + +\setuplabeltext [\s!cs] [\v!sunday=ned\ecaron le] +\setuplabeltext [\s!cs] [\v!monday=pond\ecaron l\iacute] +\setuplabeltext [\s!cs] [\v!tuesday=\uacute ter\yacute] +\setuplabeltext [\s!cs] [\v!wednesday=st\rcaron eda] +\setuplabeltext [\s!cs] [\v!thursday=\ccaron tvrtek] +\setuplabeltext [\s!cs] [\v!friday=p\aacute tek] +\setuplabeltext [\s!cs] [\v!saturday=sobota] + +% Slovakian missing + +\setuplabeltext [\s!hr] [\v!sunday=nedjelja] +\setuplabeltext [\s!hr] [\v!monday=ponedjeljak] +\setuplabeltext [\s!hr] [\v!tuesday=utorak] +\setuplabeltext [\s!hr] [\v!wednesday=srijeda] +\setuplabeltext [\s!hr] [\v!thursday=\ccaron etvrtak] +\setuplabeltext [\s!hr] [\v!friday=petak] +\setuplabeltext [\s!hr] [\v!saturday=subota] + +\setuplabeltext [\s!sl] [\v!sunday=nedelja] +\setuplabeltext [\s!sl] [\v!monday=ponedeljek] +\setuplabeltext [\s!sl] [\v!tuesday=torek] +\setuplabeltext [\s!sl] [\v!wednesday=sreda] +\setuplabeltext [\s!sl] [\v!thursday=\ccaron etrtek] +\setuplabeltext [\s!sl] [\v!friday=petek] +\setuplabeltext [\s!sl] [\v!saturday=sobota] + +%D Rather new ... +%\installlanguage +% [\s!cs] +% [\c!spacing=\v!packed, +% \c!leftsentence=---, +% \c!rightsentence=---, +% \c!leftsubsentence=---, +% \c!rightsubsentence=---, +% \c!leftquote=\lowerleftsingleninequote, +% \c!rightquote=\upperrightsinglesixquote, +% \c!leftquotation=\lowerleftdoubleninequote, +% \c!rightquotation=\upperrightdoublesixquote, +% \c!date={\v!day,\ ,\v!month,\ ,\v!year}] + +% Polish missing + +\setuplabeltext [\s!cs] [\v!page=strana ] +\setuplabeltext [\s!cs] [\v!atpage=na stran\ecaron\ ] +\setuplabeltext [\s!cs] [\v!hencefore=viz v\yacute\scaron e ] +\setuplabeltext [\s!cs] [\v!hereafter=viz n\iacute\zcaron e ] +\setuplabeltext [\s!cs] [\v!see=viz ] + +% Slovakian missing + +\setuplabeltext [\s!hr] [\v!page=stranica ] +\setuplabeltext [\s!hr] [\v!atpage=na stranici ] +\setuplabeltext [\s!hr] [\v!hencefore=vidi gore ] +\setuplabeltext [\s!hr] [\v!hereafter=vidi ispod ] +\setuplabeltext [\s!hr] [\v!see=vidi ] + +\setuplabeltext [\s!sl] [\v!page=stran ] +\setuplabeltext [\s!sl] [\v!atpage=na strani ] +\setuplabeltext [\s!sl] [\v!hencefore=glej zgoraj ] +\setuplabeltext [\s!sl] [\v!hereafter=glej spodaj ] +\setuplabeltext [\s!sl] [\v!see=glej ] + +%D \ShowAllLanguageValues [\s!pl] [polish] {Polish} {furniture} +%D \ShowAllLanguageValues [\s!cs] [czech] {Czech} {mate} +%D \ShowAllLanguageValues [\s!sk] [slovak] {Slovakian} {face} +%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: + +\def\doconvertsloveniancharacters{\dodoconvertcharacters{25}} + +\def\sloveniancharacters{\doconvertsloveniancharacters\sloveniancharacter} +\def\slovenianCharacters{\doconvertsloveniancharacters\slovenianCharacter} + +%D Define general-purpose macros for Slovenian character enumerations: + +\defineconversion [sloveniancharacter] [\sloveniancharacter] +\defineconversion [slovenianCharacter] [\slovenianCharacter] + +\defineconversion [sloveniancharacters] [\sloveniancharacters] +\defineconversion [slovenianCharacters] [\slovenianCharacters] + +%D Define these as the general character enumeration when +%D language is Slovenian. If you feel uncomfortable with this, +%D mail Mojca, since she promised to to take the heat. + +\defineconversion [sl] [character] [\sloveniancharacter] +\defineconversion [sl] [Character] [\slovenianCharacter] + +\defineconversion [sl] [characters] [\sloveniancharacters] +\defineconversion [sl] [Characters] [\slovenianCharacters] + +\defineconversion [sl] [a] [\sloveniancharacters] +\defineconversion [sl] [A] [\slovenianCharacters] +\defineconversion [sl] [AK] [\smallcapped\sloveniancharacters] +\defineconversion [sl] [KA] [\smallcapped\sloveniancharacters] + \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% @@ -27,4 +482,4 @@ \unknowncharacter \fi} -\endinput +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-sla.mkiv b/Master/texmf-dist/tex/context/base/lang-sla.mkiv deleted file mode 100644 index 47901261570..00000000000 --- a/Master/texmf-dist/tex/context/base/lang-sla.mkiv +++ /dev/null @@ -1,17 +0,0 @@ -%D \module -%D [ file=lang-sla, -%D version=2006.09.16, -%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\sloveniancharacters#1{\ctxlua{converters.alphabetic(\number#1,"sl")}} -\def\slovenianCharacters#1{\ctxlua{converters.Alphabetic(\number#1,"sl")}} - -\endinput diff --git a/Master/texmf-dist/tex/context/base/lang-sla.tex b/Master/texmf-dist/tex/context/base/lang-sla.tex deleted file mode 100644 index 2c645af5a6f..00000000000 --- a/Master/texmf-dist/tex/context/base/lang-sla.tex +++ /dev/null @@ -1,497 +0,0 @@ -%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. - -% Todo: replace \'.. by \namedglyph - -%D The framework of this module is set up by Hans Hagen while -%D many of the first translations were done by Tobias. Later -%D on, corrections were made by users. If you have suggestions, -%D or feel that your name missing here, don't hesitate to send -%D us an email. -%D -%D \starttabulate[|lB|l|] -%D \NC Czech \NC Tom Hudec, Petr Sojka \NC \NR -%D \NC Polish \NC Grzegorz Sapijaszko \NC \NR -%D \NC Croatian \NC \Zcaron eljko Vrba \NC \NR -%D \NC Slovenian \NC Mojca Miklavec \NC \NR -%D \NC Cz and Sk \NC Richard Gabriel \NC \NR -%D \stoptabulate - -% Belarussian, Russian, Ukrainian, Bulgarian, Macedonian, -% Serbo-Croatian, Slovenian, Czech, Kushubian, -% Lusatian/Sorbian/Wendish, Polish, Slovak, Albanian, -% Illyrian, Armenian - -\writestatus{loading}{ConTeXt Language Macros / Slavic Languages} - -\unprotect - -% \unexpanded\def\textormathglue#1#2#3% submitted original -% {\begingroup -% \scratchdimen=#1\hspaceamount\empty{#3}% -% \scratchskip=\zeropoint\!!plus.5\scratchdimen\!!minus.3\scratchdimen\relax -% \ifmmode -% \mskip#1#2% -% \else -% \kern#1\hspaceamount\empty{#3}% -% \hskip\scratchskip -% \fi -% \endgroup} - -% actually we could use the new pdftex features - -\unexpanded\def\textormathglue#1#2#3% cleaned up one - {\begingroup - \ifmmode - \mskip#1#2% - \else - \scratchdimen#1\hspaceamount\empty{#3}% - \scratchskip\scratchdimen\!!plus.5\scratchdimen\!!minus.3\scratchdimen - \hskip\scratchskip - \fi - \endgroup} - -\def\thinglue {\textormathglue+\thinmuskip 1} -\def\medglue {\textormathglue+\medmuskip 2} -\def\thickglue{\textormathglue+\thickmuskip3} - -\installlanguage - [\s!pl] - [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, - \c!leftquote=\lowerleftsingleninequote, - \c!rightquote=\upperrightsingleninequote, - \c!leftquotation=\lowerleftdoubleninequote, - \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!day,{.},\ ,\v!month,\ ,\v!year}, - \s!mapping={pl0,ec,qx}, - \s!encoding={pl0,ec,qx}] - -\installlanguage - [\s!cs] - [\c!spacing=\v!packed, - \c!leftsentence=\thickglue--\thickglue\penalty-20\relax, % hh, \relax added - \c!rightsentence=\thickglue--\thickglue\penalty-20\relax, - \c!leftsubsentence=~---~\penalty-20\relax, - \c!rightsubsentence=~---~\penalty-20\relax, - \c!leftquote=\lowerleftsingleninequote, - \c!rightquote=\upperrightsinglesixquote, - \c!leftquotation=\lowerleftdoubleninequote, - \c!rightquotation=\upperrightdoublesixquote, - \c!date={\v!day,{.\,},\v!month,\ ,\v!year}, - \s!mapping={il2,ec}, - \s!encoding={il2,ec}] - -\installlanguage - [\s!sk] - [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, - \c!leftquote=\upperleftsinglesixquote, - \c!rightquote=\upperrightsingleninequote, - \c!leftquotation=\upperleftdoublesixquote, - \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!day,{.\,},\v!month,\ ,\v!year}, - \s!mapping={il2,ec}, - \s!encoding={il2,ec}] - -\installlanguage - [\s!hr] - [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, - \c!leftquote=\upperleftsinglesixquote, - \c!rightquote=\upperrightsingleninequote, - \c!leftquotation=\upperleftdoublesixquote, - \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!day,\ ,\v!month,\ ,\v!year}, - \s!mapping=ec, - \s!encoding=ec] - -%D The default quotation marks for Slovenian were chosen as -%D \lowerleftdoubleninequote these ones\upperrightdoublesixquote\ -%D which was probably due to the strong influence computers -%D had on typesetting, but \rightguillemot these ones\leftguillemot\ -%D are \quotation{more correct}. -%D -%D If you still want the other quotation marks, use this: -%D -%D \starttyping -%D \installlanguage -%D [sl] -%D [leftquote=\lowerleftsingleninequote, -%D rightquote=\upperrightsinglesixquote, -%D leftquotation=\lowerleftdoubleninequote, -%D rightquotation=\upperrightdoublesixquote] -%D \stoptyping -%D -%D If you disagree with the change, please send an email to Mojca, but -%D best use some pretty strong arguments because she loves S{\sl love}nia -%D to much to comprimise on this. -%D -%D German faces approximately the same problem. I (MM) would prefer to -%D have something like: -%D -%D \starttyping -%D \mainlanguage[sl][quotationstyle=guillemot|doublequote] % better name needed -%D \stoptyping -%D -%D but users are expected to respect the rules of nice and correct -%D typography anyway. - -\installlanguage - [\s!sl] - [\c!spacing=\v!packed, - \c!leftsentence={\hbox{--~}}, - \c!rightsentence={\hbox{~--}}, - \c!leftsubsentence={--}, - \c!rightsubsentence={--}, - %\c!leftquote=\lowerleftsingleninequote, - %\c!rightquote=\upperrightsinglesixquote, - %\c!leftquotation=\lowerleftdoubleninequote, - %\c!rightquotation=\upperrightdoublesixquote, - \c!leftquote=\guilsingleright, - \c!rightquote=\guilsingleleft, - \c!leftquotation=\rightguillemot, - \c!rightquotation=\leftguillemot, - \c!date={\v!day,{.},\ ,\v!month,\ ,\v!year}, - \s!mapping=ec, - \s!encoding=ec] - -\installlanguage [polish] [\s!pl] -\installlanguage [czech] [\s!cs] -\installlanguage [slovak] [\s!sk] -\installlanguage [croatian] [\s!hr] -\installlanguage [slovenian] [\s!sl] -\installlanguage [slovene] [\s!sl] % both possible (mojca: still needed?) - -\installlanguage [cz] [\s!cs] - -% labels - -\setupheadtext [\s!pl] [\v!content=Spis tre\sacute ci] -\setupheadtext [\s!cs] [\v!content=Obsah] -\setupheadtext [\s!sk] [\v!content=Obsah] -\setupheadtext [\s!hr] [\v!content=Sadr\zcaron aj] -\setupheadtext [\s!sl] [\v!content=Kazalo] - -\setupheadtext [\s!pl] [\v!tables=Tabele] -\setupheadtext [\s!cs] [\v!tables=Tabulky] -\setupheadtext [\s!sk] [\v!tables=Tabuliek] -\setupheadtext [\s!hr] [\v!tables=Tablice] -\setupheadtext [\s!sl] [\v!tables=Tabele] - -\setupheadtext [\s!pl] [\v!figures=Ilustracje] -\setupheadtext [\s!cs] [\v!figures=Obr\aacute zky] -\setupheadtext [\s!sk] [\v!figures=Obr\aacute zkov] -\setupheadtext [\s!hr] [\v!figures=Slike] -\setupheadtext [\s!sl] [\v!figures=Slike] - -\setupheadtext [\s!pl] [\v!graphics=Grafika] -\setupheadtext [\s!cs] [\v!graphics=Grafy] -\setupheadtext [\s!sk] [\v!graphics=Graf] -\setupheadtext [\s!hr] [\v!graphics=Slike] -\setupheadtext [\s!sl] [\v!graphics=Slike] - -\setupheadtext [\s!pl] [\v!intermezzi=Intermezza] -\setupheadtext [\s!cs] [\v!intermezzi=Intermezza] -\setupheadtext [\s!sk] [\v!intermezzi=Intermezz\aacute] -\setupheadtext [\s!hr] [\v!intermezzi=Intermezza] -\setupheadtext [\s!sl] [\v!intermezzi=Intermezzi] - -\setupheadtext [\s!pl] [\v!index=Indeks] -\setupheadtext [\s!cs] [\v!index=Rejst\rcaron\iacute k] -\setupheadtext [\s!sk] [\v!index=Zoznam] -\setupheadtext [\s!hr] [\v!index=Indeks] -\setupheadtext [\s!sl] [\v!index=Stvarno kazalo] - -\setupheadtext [\s!pl] [\v!abbreviations=Skr\oacute cenie] -\setupheadtext [\s!cs] [\v!abbreviations=Zkratky] -\setupheadtext [\s!sk] [\v!abbreviations=Skratky] -\setupheadtext [\s!hr] [\v!abbreviations=Kratice] -\setupheadtext [\s!sl] [\v!abbreviations=Kratice] - -\setupheadtext [\s!pl] [\v!logos=Znaki] -\setupheadtext [\s!cs] [\v!logos=Loga] -\setupheadtext [\s!sk] [\v!logos=Log\aacute] -\setupheadtext [\s!hr] [\v!logos=Znakovi] -\setupheadtext [\s!sl] [\v!logos=Logotipi] - -\setupheadtext [\s!pl] [\v!units=Jednostki] -\setupheadtext [\s!cs] [\v!units=Jednotky] -\setupheadtext [\s!sk] [\v!units=Jednotky] -\setupheadtext [\s!hr] [\v!units=Jednostki] -\setupheadtext [\s!sl] [\v!units=Enote] - -%setupheadtext [\s!pl] [pubs=?] -\setupheadtext [\s!cs] [pubs=Literatura] -%setupheadtext [\s!sk] [pubs=?] -%setupheadtext [\s!hr] [pubs=?] -\setupheadtext [\s!sl] [pubs=Literatura] - -\setuplabeltext [\s!pl] [\v!table=Tabela ] -\setuplabeltext [\s!cs] [\v!table=Tabulka ] -\setuplabeltext [\s!sk] [\v!table=Tabu\lcaron ka ] -\setuplabeltext [\s!hr] [\v!table=T\aacute bl\aacute zat ] % [\v!table=Tablica ] -\setuplabeltext [\s!sl] [\v!table=Tabela ] - -\setuplabeltext [\s!pl] [\v!figure=Ilustracja ] -\setuplabeltext [\s!cs] [\v!figure=Obr\aacute zek ] -\setuplabeltext [\s!sk] [\v!figure=Obr\aacute zok ] -\setuplabeltext [\s!hr] [\v!figure=Slika ] -\setuplabeltext [\s!sl] [\v!figure=Slika ] - -\setuplabeltext [\s!pl] [\v!intermezzo=Intermezzo ] -\setuplabeltext [\s!cs] [\v!intermezzo=Intermezzo ] -\setuplabeltext [\s!sk] [\v!intermezzo=Intermezzo ] -\setuplabeltext [\s!hr] [\v!intermezzo=Intermezzo ] -\setuplabeltext [\s!sl] [\v!intermezzo=Intermezzo ] - -\setuplabeltext [\s!pl] [\v!graphic=Grafika ] -\setuplabeltext [\s!cs] [\v!graphic=Graf ] -\setuplabeltext [\s!sk] [\v!graphic=Graf ] -\setuplabeltext [\s!hr] [\v!graphic=Slika ] -\setuplabeltext [\s!sl] [\v!graphic=Slika ] - -\setuplabeltext [\s!pl] [\v!chapter=] % Rozdzia\l -\setuplabeltext [\s!cs] [\v!chapter=] % Kapitola -\setuplabeltext [\s!sk] [\v!chapter=] % Kapitola -\setuplabeltext [\s!hr] [\v!chapter=] % Rozdzia\l -\setuplabeltext [\s!sl] [\v!chapter=] % Poglavje - -\setuplabeltext [\s!pl] [\v!section=] % Podrozdzia\l -\setuplabeltext [\s!cs] [\v!section=] % Sekce -\setuplabeltext [\s!sk] [\v!section=] % Sekcia -\setuplabeltext [\s!hr] [\v!section=] % Podrozdzia\l -\setuplabeltext [\s!sl] [\v!section=] - -\setuplabeltext [\s!pl] [\v!subsection=] -\setuplabeltext [\s!cs] [\v!subsection=] % Podsekce -\setuplabeltext [\s!sk] [\v!subsection=] % Podsekcia -\setuplabeltext [\s!hr] [\v!subsection=] -\setuplabeltext [\s!sl] [\v!subsection=] - -\setuplabeltext [\s!pl] [\v!subsubsection=] -\setuplabeltext [\s!cs] [\v!subsubsection=] % Podpodsekce -\setuplabeltext [\s!sk] [\v!subsubsection=] % Podpodsekcia -\setuplabeltext [\s!hr] [\v!subsubsection=] -\setuplabeltext [\s!sl] [\v!subsubsection=] - -\setuplabeltext [\s!pl] [\v!subsubsubsection=] -\setuplabeltext [\s!cs] [\v!subsubsubsection=] % Podpodpodsekce -\setuplabeltext [\s!sk] [\v!subsubsubsection=] % Podpodpodsekcia -\setuplabeltext [\s!hr] [\v!subsubsubsection=] -\setuplabeltext [\s!sl] [\v!subsubsubsection=] - -\setuplabeltext [\s!pl] [\v!appendix=] % Dodatek -\setuplabeltext [\s!cs] [\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!cs] [\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!cs] [\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!cs] [\v!lines=\rcaron\aacute dky ] -\setuplabeltext [\s!sk] [\v!lines=riadky ] -\setuplabeltext [\s!hr] [\v!lines=redovi ] -\setuplabeltext [\s!sl] [\v!lines=vrstice ] - -\setuplabeltext [\s!pl] [\v!january=stycznia] -\setuplabeltext [\s!pl] [\v!february=lutego] -\setuplabeltext [\s!pl] [\v!march=marca] -\setuplabeltext [\s!pl] [\v!april=kwietnia] -\setuplabeltext [\s!pl] [\v!may=maja] -\setuplabeltext [\s!pl] [\v!june=czerwca] -\setuplabeltext [\s!pl] [\v!july=lipca] -\setuplabeltext [\s!pl] [\v!august=sierpnia] -\setuplabeltext [\s!pl] [\v!september=wrze\sacute nia] -\setuplabeltext [\s!pl] [\v!october=pa\zacute dziernika] -\setuplabeltext [\s!pl] [\v!november=listopada] -\setuplabeltext [\s!pl] [\v!december=grudnia] - -\setuplabeltext [\s!cs] [\v!january=ledna] -\setuplabeltext [\s!cs] [\v!february=\uacute nora] -\setuplabeltext [\s!cs] [\v!march=b\rcaron ezna] -\setuplabeltext [\s!cs] [\v!april=dubna] -\setuplabeltext [\s!cs] [\v!may=kv\ecaron tna] -\setuplabeltext [\s!cs] [\v!june=\ccaron ervna] -\setuplabeltext [\s!cs] [\v!july=\ccaron ervence] -\setuplabeltext [\s!cs] [\v!august=srpna] -\setuplabeltext [\s!cs] [\v!september=z\aacute\rcaron\iacute{}] -\setuplabeltext [\s!cs] [\v!october=\rcaron\iacute jna] -\setuplabeltext [\s!cs] [\v!november=listopadu] -\setuplabeltext [\s!cs] [\v!december=prosince] - -\setuplabeltext [\s!sk] [\v!january=janu\aacute ra] -\setuplabeltext [\s!sk] [\v!february=febru\aacute ra] -\setuplabeltext [\s!sk] [\v!march=marca] -\setuplabeltext [\s!sk] [\v!april=apr\iacute la] -\setuplabeltext [\s!sk] [\v!may=m\aacute ja] -\setuplabeltext [\s!sk] [\v!june=j\uacute na] -\setuplabeltext [\s!sk] [\v!july=j\uacute la] -\setuplabeltext [\s!sk] [\v!august=augusta] -\setuplabeltext [\s!sk] [\v!september=septembra] -\setuplabeltext [\s!sk] [\v!october=okt\oacute bra] -\setuplabeltext [\s!sk] [\v!november=novembra] -\setuplabeltext [\s!sk] [\v!december=decembra] - -\setuplabeltext [\s!hr] [\v!january=sije\ccaron anj] -\setuplabeltext [\s!hr] [\v!february=velja\ccaron a] -\setuplabeltext [\s!hr] [\v!march=o\zcaron ujak] -\setuplabeltext [\s!hr] [\v!april=travanj] -\setuplabeltext [\s!hr] [\v!may=svibanj] -\setuplabeltext [\s!hr] [\v!june=lipanj] -\setuplabeltext [\s!hr] [\v!july=srpanj] -\setuplabeltext [\s!hr] [\v!august=kolovoz] -\setuplabeltext [\s!hr] [\v!september=rujan] -\setuplabeltext [\s!hr] [\v!october=listopad] -\setuplabeltext [\s!hr] [\v!november=studeni] -\setuplabeltext [\s!hr] [\v!december=prosinac] - -\setuplabeltext [\s!sl] [\v!january=januar] -\setuplabeltext [\s!sl] [\v!february=februar] -\setuplabeltext [\s!sl] [\v!march=marec] -\setuplabeltext [\s!sl] [\v!april=april] -\setuplabeltext [\s!sl] [\v!may=maj] -\setuplabeltext [\s!sl] [\v!june=junij] -\setuplabeltext [\s!sl] [\v!july=julij] -\setuplabeltext [\s!sl] [\v!august=avgust] -\setuplabeltext [\s!sl] [\v!september=september] -\setuplabeltext [\s!sl] [\v!october=oktober] -\setuplabeltext [\s!sl] [\v!november=november] -\setuplabeltext [\s!sl] [\v!december=december] - -\setuplabeltext [\s!pl] [\v!sunday=niedziela] -\setuplabeltext [\s!pl] [\v!monday=poniedzia\lstroke ek] -\setuplabeltext [\s!pl] [\v!tuesday=wtorek] -\setuplabeltext [\s!pl] [\v!wednesday=\sacute roda] -\setuplabeltext [\s!pl] [\v!thursday=czwartek] -\setuplabeltext [\s!pl] [\v!friday=pi\aogonek tek] -\setuplabeltext [\s!pl] [\v!saturday=sobota] - -% new -\setuplabeltext [\s!cs] [\v!sunday=ned\ecaron le] -\setuplabeltext [\s!cs] [\v!monday=pond\ecaron l\iacute] -\setuplabeltext [\s!cs] [\v!tuesday=\uacute ter\yacute] -\setuplabeltext [\s!cs] [\v!wednesday=st\rcaron eda] -\setuplabeltext [\s!cs] [\v!thursday=\ccaron tvrtek] -\setuplabeltext [\s!cs] [\v!friday=p\aacute tek] -\setuplabeltext [\s!cs] [\v!saturday=sobota] - -\setuplabeltext [\s!hr] [\v!sunday=nedjelja] -\setuplabeltext [\s!hr] [\v!monday=ponedjeljak] -\setuplabeltext [\s!hr] [\v!tuesday=utorak] -\setuplabeltext [\s!hr] [\v!wednesday=srijeda] -\setuplabeltext [\s!hr] [\v!thursday=\ccaron etvrtak] -\setuplabeltext [\s!hr] [\v!friday=petak] -\setuplabeltext [\s!hr] [\v!saturday=subota] - -\setuplabeltext [\s!sl] [\v!sunday=nedelja] -\setuplabeltext [\s!sl] [\v!monday=ponedeljek] -\setuplabeltext [\s!sl] [\v!tuesday=torek] -\setuplabeltext [\s!sl] [\v!wednesday=sreda] -\setuplabeltext [\s!sl] [\v!thursday=\ccaron etrtek] -\setuplabeltext [\s!sl] [\v!friday=petek] -\setuplabeltext [\s!sl] [\v!saturday=sobota] - -%D Rather new ... -%\installlanguage -% [\s!cs] -% [\c!spacing=\v!packed, -% \c!leftsentence=---, -% \c!rightsentence=---, -% \c!leftsubsentence=---, -% \c!rightsubsentence=---, -% \c!leftquote=\lowerleftsingleninequote, -% \c!rightquote=\upperrightsinglesixquote, -% \c!leftquotation=\lowerleftdoubleninequote, -% \c!rightquotation=\upperrightdoublesixquote, -% \c!date={\v!day,\ ,\v!month,\ ,\v!year}] - -\setuplabeltext [\s!sl] [\v!page=stran ] -\setuplabeltext [\s!sl] [\v!atpage=na strani ] -\setuplabeltext [\s!sl] [\v!hencefore=glej zgoraj] -\setuplabeltext [\s!sl] [\v!hereafter=glej spodaj] -\setuplabeltext [\s!sl] [\v!see=glej ] - -% new -\setuplabeltext [\s!cs] [\v!page=strana ] -\setuplabeltext [\s!cs] [\v!atpage=na stran\ecaron\ ] -\setuplabeltext [\s!cs] [\v!hencefore=viz v\yacute\scaron e ] -\setuplabeltext [\s!cs] [\v!hereafter=viz n\iacute\zcaron e ] -\setuplabeltext [\s!cs] [\v!see=viz ] - -%D \ShowAllLanguageValues [\s!pl] [polish] {Polish} {furniture} -%D \ShowAllLanguageValues [\s!cs] [czech] {Czech} {mate} -%D \ShowAllLanguageValues [\s!sk] [slovak] {Slovakian} {face} -%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: - -\def\doconvertsloveniancharacters{\dodoconvertcharacters{25}} - -\def\sloveniancharacters{\doconvertsloveniancharacters\sloveniancharacter} -\def\slovenianCharacters{\doconvertsloveniancharacters\slovenianCharacter} - -%D Define general-purpose macros for Slovenian character enumerations: - -\defineconversion [sloveniancharacter] [\sloveniancharacter] -\defineconversion [slovenianCharacter] [\slovenianCharacter] - -\defineconversion [sloveniancharacters] [\sloveniancharacters] -\defineconversion [slovenianCharacters] [\slovenianCharacters] - -%D Define these as the general character enumeration when -%D language is Slovenian. If you feel uncomfortable with this, -%D mail Mojca, since she promised to to take the heat. - -\defineconversion [sl] [character] [\sloveniancharacter] -\defineconversion [sl] [Character] [\slovenianCharacter] - -\defineconversion [sl] [characters] [\sloveniancharacters] -\defineconversion [sl] [Characters] [\slovenianCharacters] - -\defineconversion [sl] [a] [\sloveniancharacters] -\defineconversion [sl] [A] [\slovenianCharacters] -\defineconversion [sl] [AK] [\smallcapped\sloveniancharacters] -\defineconversion [sl] [KA] [\smallcapped\sloveniancharacters] - -% this will become more generic : \languagecharacters{sl}{..} - -\let\sloveniancharacter\gobbleoneargument -\let\slovenianCharacter\gobbleoneargument - -%D Plugins: - -\loadmarkfile{lang-sla} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-spa.mkii b/Master/texmf-dist/tex/context/base/lang-spa.mkii new file mode 100644 index 00000000000..f6e22aa5190 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lang-spa.mkii @@ -0,0 +1,74 @@ +%D \module +%D [ file=lang-spa, +%D version=2002.04.17, +%D title=\CONTEXT\ Language Macros, +%D subtitle=Spacing, +%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 / Spacing} + +%D This module was created in the process of enhancing +%D support for French (with the help of Daniel Flipo). + +\unprotect + +\definehspace [\s!fr] [quotation] [\flexiblespaceamount{.8}{.3}{.8}] +\definehspace [\s!fr] [sentence] [\fixedspaceamount{1}] + +%definehspace [\s!fr] [quote] [\flexiblespaceamount{.8}{.3}{.8}] +%definehspace [\s!fr] [speech] [\flexiblespaceamount{.8}{.3}{.8}] + +\definehspace [\s!fr] [interquotation] [\zeropoint] +\definehspace [\s!fr] [intersentence] [\zeropoint] + +\definehspace [\string :] [\zeropoint] +\definehspace [\string ;] [\zeropoint] +\definehspace [\string !] [\zeropoint] +\definehspace [\string ?] [\zeropoint] + +\definehspace [\s!fr] [\string :] [\spaceamount] +\definehspace [\s!fr] [\string ;] [.16667em] +\definehspace [\s!fr] [\string !] [.16667em] +\definehspace [\s!fr] [\string ?] [.16667em] + +%D Alternative discretionary handlers: + +\definetextmodediscretionary : + {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{:}:} + +\definetextmodediscretionary ; + {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{;};} + +\definetextmodediscretionary ? + {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{?}?} + +\definetextmodediscretionary ! + {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{!}!} + +%D \startbuffer +%D \mainlanguage[en] \quotation{test \quotation{test} test}\par +%D \mainlanguage[nl] \quotation{test \quotation{test} test}\par +%D \mainlanguage[fr] \quotation{test \quotation{test} test}\par +%D +%D \mainlanguage[en] \quotation{\quotation{test} test}\par +%D \mainlanguage[nl] \quotation{\quotation{test} test}\par +%D \mainlanguage[fr] \quotation{\quotation{test} test}\par +%D +%D \mainlanguage[en] |<|test |<|test|>| test|>| \par +%D \mainlanguage[nl] |<|test |<|test|>| test|>| \par +%D \mainlanguage[fr] |<|test |<|test|>| test|>| \par +%D +%D \mainlanguage[en] |<||<|test|>| test|>| \par +%D \mainlanguage[nl] |<||<|test|>| test|>| \par +%D \mainlanguage[fr] |<||<|test|>| test|>| \par +%D \stopbuffer +%D +%D \typebuffer {\getbuffer} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-spa.mkiv b/Master/texmf-dist/tex/context/base/lang-spa.mkiv new file mode 100644 index 00000000000..2cc88b84fcf --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lang-spa.mkiv @@ -0,0 +1,76 @@ +%D \module +%D [ file=lang-spa, +%D version=2002.04.17, +%D title=\CONTEXT\ Language Macros, +%D subtitle=Spacing, +%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 / Spacing} + +%D This module was created in the process of enhancing +%D support for French (with the help of Daniel Flipo). +%D +%D This will (or already has) become obsolete! + +\unprotect + +\definehspace [\s!fr] [quotation] [\flexiblespaceamount{.8}{.3}{.8}] +\definehspace [\s!fr] [sentence] [\fixedspaceamount{1}] + +%definehspace [\s!fr] [quote] [\flexiblespaceamount{.8}{.3}{.8}] +%definehspace [\s!fr] [speech] [\flexiblespaceamount{.8}{.3}{.8}] + +\definehspace [\s!fr] [interquotation] [\zeropoint] +\definehspace [\s!fr] [intersentence] [\zeropoint] + +\definehspace [\string :] [\zeropoint] +\definehspace [\string ;] [\zeropoint] +\definehspace [\string !] [\zeropoint] +\definehspace [\string ?] [\zeropoint] + +\definehspace [\s!fr] [\string :] [\spaceamount] +\definehspace [\s!fr] [\string ;] [.16667em] +\definehspace [\s!fr] [\string !] [.16667em] +\definehspace [\s!fr] [\string ?] [.16667em] + +%D Alternative discretionary handlers: + +\definetextmodediscretionary : + {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{:}:} + +\definetextmodediscretionary ; + {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{;};} + +\definetextmodediscretionary ? + {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{?}?} + +\definetextmodediscretionary ! + {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{!}!} + +%D \startbuffer +%D \mainlanguage[en] \quotation{test \quotation{test} test}\par +%D \mainlanguage[nl] \quotation{test \quotation{test} test}\par +%D \mainlanguage[fr] \quotation{test \quotation{test} test}\par +%D +%D \mainlanguage[en] \quotation{\quotation{test} test}\par +%D \mainlanguage[nl] \quotation{\quotation{test} test}\par +%D \mainlanguage[fr] \quotation{\quotation{test} test}\par +%D +%D \mainlanguage[en] |<|test |<|test|>| test|>| \par +%D \mainlanguage[nl] |<|test |<|test|>| test|>| \par +%D \mainlanguage[fr] |<|test |<|test|>| test|>| \par +%D +%D \mainlanguage[en] |<||<|test|>| test|>| \par +%D \mainlanguage[nl] |<||<|test|>| test|>| \par +%D \mainlanguage[fr] |<||<|test|>| test|>| \par +%D \stopbuffer +%D +%D \typebuffer {\getbuffer} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-spa.tex b/Master/texmf-dist/tex/context/base/lang-spa.tex deleted file mode 100644 index f6e22aa5190..00000000000 --- a/Master/texmf-dist/tex/context/base/lang-spa.tex +++ /dev/null @@ -1,74 +0,0 @@ -%D \module -%D [ file=lang-spa, -%D version=2002.04.17, -%D title=\CONTEXT\ Language Macros, -%D subtitle=Spacing, -%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 / Spacing} - -%D This module was created in the process of enhancing -%D support for French (with the help of Daniel Flipo). - -\unprotect - -\definehspace [\s!fr] [quotation] [\flexiblespaceamount{.8}{.3}{.8}] -\definehspace [\s!fr] [sentence] [\fixedspaceamount{1}] - -%definehspace [\s!fr] [quote] [\flexiblespaceamount{.8}{.3}{.8}] -%definehspace [\s!fr] [speech] [\flexiblespaceamount{.8}{.3}{.8}] - -\definehspace [\s!fr] [interquotation] [\zeropoint] -\definehspace [\s!fr] [intersentence] [\zeropoint] - -\definehspace [\string :] [\zeropoint] -\definehspace [\string ;] [\zeropoint] -\definehspace [\string !] [\zeropoint] -\definehspace [\string ?] [\zeropoint] - -\definehspace [\s!fr] [\string :] [\spaceamount] -\definehspace [\s!fr] [\string ;] [.16667em] -\definehspace [\s!fr] [\string !] [.16667em] -\definehspace [\s!fr] [\string ?] [.16667em] - -%D Alternative discretionary handlers: - -\definetextmodediscretionary : - {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{:}:} - -\definetextmodediscretionary ; - {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{;};} - -\definetextmodediscretionary ? - {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{?}?} - -\definetextmodediscretionary ! - {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{!}!} - -%D \startbuffer -%D \mainlanguage[en] \quotation{test \quotation{test} test}\par -%D \mainlanguage[nl] \quotation{test \quotation{test} test}\par -%D \mainlanguage[fr] \quotation{test \quotation{test} test}\par -%D -%D \mainlanguage[en] \quotation{\quotation{test} test}\par -%D \mainlanguage[nl] \quotation{\quotation{test} test}\par -%D \mainlanguage[fr] \quotation{\quotation{test} test}\par -%D -%D \mainlanguage[en] |<|test |<|test|>| test|>| \par -%D \mainlanguage[nl] |<|test |<|test|>| test|>| \par -%D \mainlanguage[fr] |<|test |<|test|>| test|>| \par -%D -%D \mainlanguage[en] |<||<|test|>| test|>| \par -%D \mainlanguage[nl] |<||<|test|>| test|>| \par -%D \mainlanguage[fr] |<||<|test|>| test|>| \par -%D \stopbuffer -%D -%D \typebuffer {\getbuffer} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-txt.lua b/Master/texmf-dist/tex/context/base/lang-txt.lua new file mode 100644 index 00000000000..fc3a55170fd --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lang-txt.lua @@ -0,0 +1,2510 @@ +if not modules then modules = { } end modules ['lang-txt'] = { + version = 1.001, + comment = "companion to lang-lab.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- The content of this file is derived from the mkii lang-* files and +-- early 2011 the mkii labels are generated from this file. The +-- translations have been collected over years by users, using named +-- glyphs. This file uses utf exclusively. +-- +-- Many of the initial translations were done by Tobias Burnus but +-- completed by numerous users. The following list is incomplete so feel +-- free to send me corrections. +-- +-- af Afrikaans ... +-- ar Arabic Idris Samawi Hamid, Khaled Hosny +-- ca Catalan ... +-- cn Chinese Wang Lei, ... +-- cs Czech Tom Hudec, Petr Sojka, Richard Gabriel +-- da Danish Arne Jorgensen +-- de German Tobias Burnus, ... +-- en English Hans Hagen, ... +-- es Spanish ... +-- fi Finish ... +-- fr French Daniel Flipo, Arthur Reutenauer +-- gr Greek Apostolos Syropoulos, Thomas Schmitz +-- hr Croatian Željko Vrba, Richard Gabriel, Vedran Miletić +-- hu Hungarian Adam Reviczky +-- it Italian Giuseppe Bilotta, Luigi Scarso +-- ja Japanese Richard Gabriel +-- kr Korean Jeong Dalyoung +-- la Latin ... +-- lt Lithuanian Marius Aleknevičius +-- nb Norwegian Hans Fredrik Nordhaug, ... +-- nn Norwegian Hans Fredrik Nordhaug, ... +-- nl Dutch Hans Hagen +-- pl Polish Grzegorz Sapijaszko +-- pt Portuguese Pedro F. M. Mendonça +-- ro Romanian Dan Seracu, ... +-- ru Russian Olga Briginets, Alexander Bokovoy, Victor Figurnov, ... +-- sk Slovak ... +-- sl Slovenian Mojca Miklavec +-- sv Swedish ... +-- tk Turkish Tobias Burnus +-- tr Turkmen Nazar Annagurban +-- ua Ukrainian Olga Briginets, Alexander Bokovoy, Victor Figurnov, ... +-- vi Vietnamese Han The Thanh + +-- For the moment we keep this table in memory. In the future we can then +-- enable labels. + +-- thinspace == sixperemspace = 0x2006 +-- print("!"..utf.char(0x2006).."!") + +languages = languages or { } +local languages = languages + +languages.data = languages.data or utilities.storage.allocate { } +local data = languages.data + +data.labels={ + functions={ + Pr={ + labels={ + en="Pr", + }, + }, + arccos={ + labels={ + en="arccos", + hr="arc\\sixperemspace cos", + pl="arc\\sixperemspace cos", + }, + }, + arcctg={ + labels={ + en="arccot", + hr="arc\\sixperemspace ctg", + pl="arc\\sixperemspace ctg", + }, + }, + arcsin={ + labels={ + en="arcsin", + hr="arc\\sixperemspace sin", + pl="arc\\sixperemspace sin", + }, + }, + arctan={ + labels={ + en="arctan", + hr="arc\\sixperemspace tg", + pl="arc\\sixperemspace tg", + }, + }, + arctg={ + labels={ + en="arctan", + hr="arc\\sixperemspace tg", + pl="arc\\sixperemspace tg", + }, + }, + arg={ + labels={ + en="arg", + }, + }, + cos={ + labels={ + en="cos", + }, + }, + cosh={ + labels={ + en="cosh", + }, + }, + cot={ + labels={ + en="cot", + hr="ctg", + pl="ctg", + }, + }, + coth={ + labels={ + en="coth", + }, + }, + csc={ + labels={ + en="csc", + }, + }, + ctg={ + labels={ + en="cot", + hr="ctg", + pl="ctg", + }, + }, + deg={ + labels={ + en="deg", + }, + }, + det={ + labels={ + en="det", + }, + }, + dim={ + labels={ + en="dim", + }, + }, + exp={ + labels={ + en="exp", + }, + }, + gcd={ + labels={ + en="gcd", + hr="nzd", + nl="ggd", + }, + }, + hom={ + labels={ + en="hom", + }, + }, + inf={ + labels={ + en="inf", + }, + }, + injlim={ + labels={ + en="inj\\sixperemspace lim", + }, + }, + ker={ + labels={ + en="ker", + }, + }, + lcm={ + labels={ + en="lcm", + hr="nzv", + nl="kgv", + }, + }, + lg={ + labels={ + en="lg", + }, + }, + lim={ + labels={ + en="lim", + }, + }, + liminf={ + labels={ + en="lim\\sixperemspace inf", + }, + }, + limsup={ + labels={ + en="lim\\sixperemspace sup", + }, + }, + ln={ + labels={ + en="ln", + }, + }, + log={ + labels={ + en="log", + }, + }, + max={ + labels={ + en="max", + }, + }, + median={ + labels={ + en="median", + }, + }, + min={ + labels={ + en="min", + }, + }, + mod={ + labels={ + en="mod", + }, + }, + projlim={ + labels={ + en="proj\\sixperemspace lim", + }, + }, + sec={ + labels={ + en="sec", + }, + }, + sin={ + labels={ + en="sin", + }, + }, + sinh={ + labels={ + en="sinh", + }, + }, + sup={ + labels={ + en="sup", + }, + }, + tan={ + labels={ + en="tan", + hr="tg", + pl="tg", + }, + }, + tanh={ + labels={ + en="tanh", + }, + }, + tg={ + labels={ + en="tan", + hr="tg", + pl="tg", + }, + }, + }, + texts={ + ["and"]={ + labels={ + af="", + ca="", + cs="", + da="", + de="und", + en="and", + es="", + fi="", + fr="", + gr="", + hr="i", + hu="és", + it="", + la="", + lt="", + nb="", + nl="en", + nn="", + pl="", + pt="", + ro="", + ru="", + sk="", + sl="", + sv="", + tk="", + tr="", + ua="", + vi="", + }, + }, + appendix={ + hidden=true, + labels={ + af="Bylae ", + ar="ملحق ", + ca="Apèndix ", + cn="附录", + cs="Příloha ", + da="Bilag ", + de="Anhang ", + en="Appendix ", + es="Apéndice ", + fi="", + fr="Annexe ", + gr="Παράρτημα", + hr="Dodatak ", + hu="Melléklet ", + it="", + ja="付録", + kr="부록", + la="", + lt="", + nb="Tillegg ", + nl="", + nn="Tillegg ", + pl="Dodatek ", + pt="", + ro="", + ru="", + sk="Príloha ", + sl="Dodatek ", + sv="", + tk="Goşmaça", + tr="", + ua="", + vi="", + }, + }, + april={ + labels={ + af="april", + ar="أبريل", + ["ar-dz"]="أفريل", + ["ar-sy"]="نيسان", + ca="abril", + cn="四月", + cs="dubna", + da="april", + de="April", + en="April", + es="abril", + fi="huhtikuu", + fr="avril", + gr="Απρίλιος", + hr="travnja", + hu="április", + it="aprile", + ja="4", + kr="4월", + la="Aprilis", + lt="balandžio", + nb="april", + nl="april", + nn="april", + pl="kwietnia", + pt="abril", + ro="aprilie", + ru="апреля", + sk="apríla", + sl="april", + sv="april", + tk="aprel", + tr="nisan", + ua="квітня", + vi="tháng tư", + }, + }, + ["april:mnem"]={ + labels={ + af="", + ca="", + cs="", + da="", + de="", + en="apr", + es="", + fi="", + fr="", + gr="", + hr="tra", + hu="ápr.", + it="", + la="", + lt="apr", + nb="april", + nl="", + nn="april", + pl="", + pt="", + ro="", + ru="", + sk="", + sl="", + sv="", + tk="", + tr="", + ua="", + vi="", + }, + }, + atpage={ + labels={ + af="", + ar="في صفحة ", + ca="", + cs="na straně ", + da="på side ", + de="auf Seite ", + en="at page ", + es="", + fi="", + fr="à la page ", + gr="", + hr="na stranici ", + hu="oldal ", + it="a pagina ", + la="", + lt="puslapyje ", + nb="på side ", + nl="op pagina ", + nn="på side ", + pl="", + pt="", + ro="", + ru="на странице ", + sk="", + sl="na strani ", + sv="på sida ", + tk="", + tr="", + ua="на сторінці ", + vi="", + }, + }, + august={ + labels={ + af="augustus", + ar="أغسطس", + ["ar-dz"]="أوت", + ["ar-ma"]="غشت", + ["ar-sy"]="آب", + ca="agost", + cn="八月", + cs="srpna", + da="august", + de="August", + en="August", + es="agosto", + fi="elokuu", + fr="août", + gr="Αύγουστος", + hr="kolovoza", + hu="augusztus", + it="agosto", + ja="8", + kr="8월", + la="Augustus", + lt="rugpjūčio", + nb="august", + nl="augustus", + nn="august", + pl="sierpnia", + pt="agosto", + ro="august", + ru="августа", + sk="augusta", + sl="avgust", + sv="augusti", + tk="awgust", + tr="ağustos", + ua="серпня", + vi="tháng tám", + }, + }, + ["august:mnem"]={ + labels={ + af="", + ca="", + cs="", + da="", + de="", + en="aug", + es="", + fi="", + fr="", + gr="", + hr="kol", + hu="aug.", + it="", + la="", + lt="aug", + nb="aug.", + nl="", + nn="aug.", + pl="", + pt="", + ro="", + ru="", + sk="", + sl="", + sv="", + tk="", + tr="", + ua="", + vi="", + }, + }, + chapter={ + hidden=true, + labels={ + af="Hoofstuk ", + ar="باب ", + ca="Capítol ", + cn={"第","章"}, + cs="Kapitola ", + da="", + de="Kapitel ", + en="Chapter ", + es="Capítulo ", + fi="", + fr="Chapitre ", + gr="Κεφάλαιο", + hr="Poglavlje ", + hu=",. fejezet:", + it="", + ja={"第","章"}, + kr={"제","장"}, + la="", + lt="", + nb="", + nl="", + nn="", + pl="Rozdział ", + pt="", + ro="", + ru="", + sk="Kapitola ", + sl="Poglavje ", + sv="", + tk="Bap", + tr="", + ua="", + vi="Chương ", + }, + }, + continued={ + labels={ + af="", + ca="", + cs="", + da="", + de="", + en=" (continued)", + es="", + fi="", + fr="", + gr="", + hr=" (nastavak)", + hu=" (folytatás)", + it="", + la="", + lt="", + nb="", + nl=" (vervolgd)", + nn="", + pl="", + pt="", + ro="", + ru="", + sk="", + sl="", + sv="", + tk="", + tr="", + ua="", + vi="", + }, + }, + december={ + labels={ + af="desember", + ar="ديسمبر", + ["ar-ma"]="دجنبر", + ["ar-sy"]="كانون الأول", + ca="desembre", + cn="十二月", + cs="prosince", + da="december", + de="Dezember", + en="December", + es="diciembre", + fi="joulukuu", + fr="décembre", + gr="Δεκέμβριος", + hr="prosinca", + hu="december", + it="dicembre", + ja="12", + kr="12월", + la="December", + lt="gruodžio", + nb="desember", + nl="december", + nn="desember", + pl="grudnia", + pt="dezembro", + ro="decembrie", + ru="декабря", + sk="decembra", + sl="december", + sv="december", + tk="dekabr", + tr="aralık", + ua="грудня", + vi="tháng mười hai", + }, + }, + ["december:mnem"]={ + labels={ + af="", + ca="", + cs="", + da="", + de="", + en="dec", + es="", + fi="", + fr="", + gr="", + hr="pro", + hu="dec.", + it="", + la="", + lt="dec", + nb="des.", + nl="", + nn="des.", + pl="", + pt="", + ro="", + ru="", + sk="", + sl="", + sv="", + tk="", + tr="", + ua="", + vi="", + }, + }, + february={ + labels={ + af="februarie", + ar="فبراير", + ["ar-dz"]="فيفري", + ["ar-sy"]="شباط", + ca="febrer", + cn="二月", + cs="února", + da="februar", + de="Februar", + en="February", + es="febrero", + fi="helmikuu", + fr="février", + gr="Φεβρουάριος", + hr="veljače", + hu="február", + it="febbraio", + ja="2", + kr="2월", + la="Februarius", + lt="vasario", + nb="februar", + nl="februari", + nn="februar", + pl="lutego", + pt="fevereiro", + ro="februarie", + ru="февраля", + sk="februára", + sl="februar", + sv="februari", + tk="fewral", + tr="Şubat", + ua="лютого", + vi="tháng hai", + }, + }, + ["february:mnem"]={ + labels={ + af="", + ca="", + cs="", + da="", + de="", + en="feb", + es="", + fi="", + fr="", + gr="", + hr="velj", + hu="feb.", + it="", + la="", + lt="feb", + nb="feb.", + nl="", + nn="feb.", + pl="", + pt="", + ro="", + ru="", + sk="", + sl="", + sv="", + tk="", + tr="", + ua="", + vi="", + }, + }, + figure={ + labels={ + af="Figuur ", + ar="شكل ", + ca="Figura ", + cn="图", + cs="Obrázek ", + da="Figur ", + de="Abbildung ", + en="Figure ", + es="Ilustración ", + fi="Kuva ", + fr="Figure ", + gr="Σχήμα", + hr="Slika ", + hu=",. ábra:", + it="Fig. ", + ja="図", + kr="그림", + la="Imago ", + lt=", pav.", + nb="Figur ", + nl="Figuur ", + nn="Figur ", + pl="Ilustracja ", + pt="Figura ", + ro="Figura ", + ru="Рисунок ", + sk="Obrázok ", + sl="Slika ", + sv="Figur ", + tk="Surat", + tr="Şekil ", + ua="Малюнок ", + vi="Hình ", + }, + }, + friday={ + labels={ + af="vrydag", + ar="الجمعة", + ca="divendres", + cn="星期五", + cs="pátek", + da="fredag", + de="Freitag", + en="Friday", + es="viernes", + fi="perjantai", + fr="vendredi", + gr="Παρασκευή", + hr="petak", + hu="péntek", + it="venerdì", + ja="金曜日", + kr="금요일", + la="Dies Veneris", + lt="penktadienis", + nb="fredag", + nl="vrijdag", + nn="fredag", + pl="piątek", + pt="sexta-feira", + ro="vineri", + ru="пятница", + sk="", + sl="petek", + sv="fredag", + tk="bäşinji gün", + tr="cuma", + ua="п'ятниця", + vi="thứ sáu", + }, + }, + graphic={ + labels={ + af="Grafiek ", + ar="رسم ", + ca="Gràfica ", + cn="插图", + cs="Graf ", + da="Grafik ", + de="Graphik ", + en="Graphic ", + es="Gráfico ", + fi="Grafiikka ", + fr="Illustration ", + gr="Γραφικό", + hr="Slika ", + hu=",. kép:", + it="Grafico ", + ja="イラスト", + la="Typus ", + lt="Graphic ", + nb="Bilde ", + nl="Grafiek ", + nn="Bilete ", + pl="Grafika ", + pt="Gráfico ", + ro="Graficul ", + ru="График ", + sk="Graf ", + sl="Slika ", + sv="Grafik ", + tk="Grafik", + tr="Grafik", + ua="График ", + vi="Đồ thị", + }, + }, + hencefore={ + labels={ + af="", + ar="كما وضحنا سابقا", + ca="", + cs="viz výše", + da="se foroven", + de="siehe oben", + en="as we show above", + es="", + fi="", + fr="ci-dessus", + gr="", + hr="vidi gore", + hu="lásd feljebb", + kr="그러므로", + it="come mostrato sopra", + la="", + lt="kaip parodyta aukščiau", + nb="som vist over", + nl="hierboven", + nn="som vist over", + pl="", + pt="", + ro="", + ru="см. выше", + sk="", + sl="glej zgoraj", + sv="se ovan", + tk="", + tr="", + ua="як показано вище", + vi="", + }, + }, + hereafter={ + labels={ + af="", + ar="كما نوضح لاحقا", + ca="", + cs="viz níže", + da="se forneden", + de="siehe unten", + en="as we show below", + es="", + fi="", + fr="ci-dessous", + gr="", + hr="vidi ispod", + hu="lásd lejjebb", + it="come mostrato sotto", + la="", + lt="kaip parodyta žemiau", + nb="som vist under", + nl="hieronder", + nn="som vist under", + pl="", + pt="", + ro="", + ru="см. ниже", + sk="", + sl="glej spodaj", + sv="se nedan", + tk="", + tr="", + ua="як показано нижче", + vi="", + }, + }, + intermezzo={ + labels={ + af="Intermezzo ", + ar="فسحة ", + ca="Intermedi ", + cn="퉣", + cs="Intermezzo ", + da="Intermezzo ", + de="Intermezzo ", + en="Intermezzo ", + es="Intermedio ", + fi="Intermezzo ", + fr="Intermède ", + gr="Παύση", + hr="Intermeco ", + hu=",. intermezzo:", + it="Intermezzo ", + ja="間奏曲", + kr="간주곡", + la="Intermissum ", + lt="Intermezzo ", + nb="Intermesso ", + nl="Intermezzo ", + nn="Intermesso ", + pl="Intermezzo ", + pt="Intermédio ", + ro="Intermezzo ", + ru="Вставка ", + sk="Intermezzo ", + sl="Intermezzo ", + sv="Intermezzo ", + tk="Arakesme", + tr="", + ua="Вставка ", + vi="intermezzo", + }, + }, + january={ + labels={ + af="januarie", + ar="يناير", + ["ar-dz"]="جانفي", + ["ar-sy"]="كانون الثاني", + ca="gener", + cn="一月", + cs="ledna", + da="januar", + de="Januar", + en="January", + es="enero", + fi="tammikuu", + fr="janvier", + gr="Ιανουάριος", + hr="siječnja", + hu="január", + it="gennaio", + ja="1", + kr="1월", + la="Ianuarius", + lt="sausio", + nb="januar", + nl="januari", + nn="januar", + pl="stycznia", + pt="janeiro", + ro="ianuarie", + ru="января", + sk="januára", + sl="januar", + sv="januari", + tk="ýanwar", + tr="ocak", + ua="січня", + vi="tháng giêng", + }, + }, + ["january:mnem"]={ + labels={ + af="", + ca="", + cs="", + da="", + de="", + en="jan", + es="", + fi="", + fr="", + gr="", + hr="sij", + hu="jan.", + it="", + la="", + lt="jan", + nb="jan.", + nl="", + nn="jan.", + pl="", + pt="", + ro="", + ru="", + sk="", + sl="", + sv="", + tk="", + tr="", + ua="", + vi="", + }, + }, + july={ + labels={ + af="julie", + ar="يوليو", + ["ar-dz"]="جويلة", + ["ar-ma"]="يوليوز", + ["ar-sy"]="تموز", + ca="juliol", + cn="七月", + cs="července", + da="juli", + de="Juli", + en="July", + es="julio", + fi="heinäkuu", + fr="juillet", + gr="Ιούλιος", + hr="srpnja", + hu="július", + it="luglio", + ja="7", + kr="7월", + la="Iulius", + lt="liepos", + nb="juli", + nl="juli", + nn="juli", + pl="lipca", + pt="julho", + ro="iulie", + ru="июля", + sk="júla", + sl="julij", + sv="juli", + tk="iýul", + tr="temmuz", + ua="липня", + vi="tháng bảy", + }, + }, + ["july:mnem"]={ + labels={ + af="", + ca="", + cs="", + da="", + de="", + en="jul", + es="", + fi="", + fr="", + gr="", + hr="srp", + hu="júl.", + it="", + la="", + lt="jul", + nb="juli", + nl="", + nn="juli", + pl="", + pt="", + ro="", + ru="", + sk="", + sl="", + sv="", + tk="", + tr="", + ua="", + vi="", + }, + }, + june={ + labels={ + af="junie", + ar="يونيو", + ["ar-dz"]="جوان", + ["ar-sy"]="حزيران", + ca="juny", + cn="六月", + cs="června", + da="juni", + de="Juni", + en="June", + es="junio", + fi="kesäkuu", + fr="juin", + gr="Ιούνιος", + hr="lipnja", + hu="június", + it="giugno", + ja="6", + kr="6월", + la="Iunius", + lt="birželio", + nb="juni", + nl="juni", + nn="juni", + pl="czerwca", + pt="junho", + ro="iunie", + ru="июня", + sk="júna", + sl="junij", + sv="juni", + tk="iýun", + tr="haziran", + ua="червня", + vi="tháng sáu", + }, + }, + ["june:mnem"]={ + labels={ + af="", + ca="", + cs="", + da="", + de="", + en="jun", + es="", + fi="", + fr="", + gr="", + hr="lip", + hu="jún.", + it="", + la="", + lt="jun", + nb="juni", + nl="", + nn="juni", + pl="", + pt="", + ro="", + ru="", + sk="", + sl="", + sv="", + tk="", + tr="", + ua="", + vi="", + }, + }, + line={ + labels={ + af="reël ", + ar="سطر ", + ca="línia ", + cn="行", + cs="řádek ", + da="linie ", + de="Zeile ", + en="line ", + es="línea ", + fi="rivi ", + fr="ligne ", + gr="Γραμμή", + hr="redak ", + hu=",. sor:", + it="riga ", + ja="線", + kr="행", + la="versus ", + lt="line ", + nb="linje ", + nl="regel ", + nn="linje ", + pl="wiersz ", + pt="linha ", + ro="linia ", + ru="строка ", + sk="riadok ", + sl="vrstica ", + sv="rad ", + tk="setir", + tr="satır ", + ua="рядок ", + vi="dòng ", + }, + }, + lines={ + labels={ + af="reëls ", + ar="السطور ", + ca="línies ", + cn="行", + cs="řádky ", + da="linier ", + de="Zeilen ", + en="lines ", + es="líneas ", + fi="rivie ", + fr="lignes ", + gr="Γραμμές", + hr="retci ", + hu="sorok ", + it="righe ", + ja="線", + kr="행", + la="versus ", + lt="lines ", + nb="linjer ", + nl="regels ", + nn="linjer ", + pl="wiersze ", + pt="linhas ", + ro="liniile ", + ru="строки ", + sk="riadky ", + sl="vrstice ", + sv="rader ", + tk="setirler", + tr="satırlar ", + ua="рядки ", + vi="dòng ", + }, + }, + march={ + labels={ + af="maart", + ar="مارس", + ["ar-sy"]="آذار", + ca="març", + cn="三月", + cs="března", + da="marts", + de="März", + en="March", + es="marzo", + fi="maaliskuu", + fr="mars", + gr="Μάρτιος", + hr="ožujka", + hu="március", + it="marzo", + ja="3", + kr="3월", + la="Martius", + lt="kovo", + nb="mars", + nl="maart", + nn="mars", + pl="marca", + pt="março", + ro="martie", + ru="марта", + sk="marca", + sl="marec", + sv="mars", + tk="mart", + tr="mart", + ua="березня", + vi="tháng ba", + }, + }, + ["march:mnem"]={ + labels={ + af="", + ca="", + cs="", + da="", + de="", + en="mar", + es="", + fi="", + fr="", + gr="", + hr="ožu", + hu="már.", + it="", + la="", + lt="mar", + nb="mars", + nl="", + nn="mars", + pl="", + pt="", + ro="", + ru="", + sk="", + sl="", + sv="", + tk="", + tr="", + ua="", + vi="", + }, + }, + may={ + labels={ + af="mei", + ar="مايو", + ["ar-dz"]="ماي", + ["ar-ma"]="ماي", + ["ar-sy"]="أيار", + ca="maig", + cn="五月", + cs="května", + da="maj", + de="Mai", + en="May", + es="mayo", + fi="toukokuu", + fr="mai", + gr="Μάιος", + hr="svibnja", + hu="május", + it="maggio", + ja="5", + kr="5월", + la="Maius", + lt="gegužės", + nb="mai", + nl="mei", + nn="mai", + pl="maja", + pt="maio", + ro="mai", + ru="мая", + sk="mája", + sl="maj", + sv="maj", + tk="maý", + tr="mayıs", + ua="травня", + vi="tháng năm", + }, + }, + ["may:mnem"]={ + labels={ + af="", + ca="", + cs="", + da="", + de="", + en="may", + es="", + fi="", + fr="", + gr="", + hr="svi", + hu="máj.", + it="", + la="", + lt="may", + nb="mai", + nl="", + nn="mai", + pl="", + pt="", + ro="", + ru="", + sk="", + sl="", + sv="", + tk="", + tr="", + ua="", + vi="", + }, + }, + monday={ + labels={ + af="maandag", + ar="الاثنين", + ca="dilluns", + cn="星期一", + cs="pondělí", + da="mandag", + de="Montag", + en="Monday", + es="lunes", + fi="maanantai", + fr="lundi", + gr="Δευτέρα", + hr="ponedjeljak", + hu="hétfő", + it="lunedì", + ja="月曜日", + kr="월요일", + la="Dies Lunae", + lt="pirmadienis", + nb="mandag", + nl="maandag", + nn="måndag", + pl="poniedziałek", + pt="segunda-feira", + ro="luni", + ru="понедельник", + sk="", + sl="ponedeljek", + sv="måndag", + tk="birinji gün", + tr="pazartesi", + ua="понеділок", + vi="thứ hai", + }, + }, + november={ + labels={ + af="november", + ar="نوفمبر", + ["ar-ma"]="نونبر", + ["ar-sy"]="تشرين الثاني", + ca="novembre", + cn="十一月", + cs="listopadu", + da="november", + de="November", + en="November", + es="noviembre", + fi="marraskuu", + fr="novembre", + gr="Νοέμβριος", + hr="studenog", + hu="november", + it="novembre", + ja="11", + kr="11월", + la="November", + lt="lapkričio", + nb="november", + nl="november", + nn="november", + pl="listopada", + pt="novembro", + ro="noiembrie", + ru="ноября", + sk="novembra", + sl="november", + sv="november", + tk="noýabr", + tr="kasım", + ua="листопада", + vi="tháng mười một", + }, + }, + ["november:mnem"]={ + labels={ + af="", + ca="", + cs="", + da="", + de="", + en="nov", + es="", + fi="", + fr="", + gr="", + hr="stu", + hu="nov.", + it="", + la="", + lt="nov", + nb="nov.", + nl="", + nn="nov.", + pl="", + pt="", + ro="", + ru="", + sk="", + sl="", + sv="", + tk="", + tr="", + ua="", + vi="", + }, + }, + october={ + labels={ + af="oktober", + ar="أكتوبر", + ["ar-sy"]="تشرين الأول", + ca="octubre", + cn="十月", + cs="října", + da="oktober", + de="Oktober", + en="October", + es="octubre", + fi="lokakuu", + fr="octobre", + gr="Οκτώβριος", + hr="listopada", + hu="október", + it="ottobre", + ja="10", + kr="10월", + la="October", + lt="spalio", + nb="oktober", + nl="oktober", + nn="oktober", + pl="października", + pt="outubro", + ro="octombrie", + ru="октября", + sk="októbra", + sl="oktober", + sv="oktober", + tk="oktýabr", + tr="ekim", + ua="жовтня", + vi="tháng mười", + }, + }, + ["october:mnem"]={ + labels={ + af="", + ca="", + cs="", + da="", + de="", + en="oct", + es="", + fi="", + fr="", + gr="", + hr="lis", + hu="okt.", + it="", + la="", + lt="oct", + nb="okt.", + nl="", + nn="okt.", + pl="", + pt="", + ro="", + ru="", + sk="", + sl="", + sv="", + tk="", + tr="", + ua="", + vi="", + }, + }, + page={ + labels={ + af="", + ar="صفحة ", + ca="", + cs="strana ", + da="Side ", + de="Seite ", + en="page ", + es="", + fi="", + fr="page ", + gr="", + hr="stranica ", + hu="oldal ", + it="pagina ", + kr="쪽", + la="", + lt="puslapis ", + nb="side ", + nl="pagina ", + nn="side ", + pl="", + pt="", + ro="", + ru="страница ", + sk="", + sl="stran ", + sv="Sida ", + tk="", + tr="", + ua="сторінка ", + vi="", + }, + }, + part={ + labels={ + af="Deel ", + ar="جزء ", + ca="Part ", + cn={"第","部分"}, + cs="Část ", + da="Del ", + de="Teil ", + en="Part ", + es="Parte ", + fi="Osa ", + fr="Partie ", + gr="Μέρος", + hr="Dio ", + hu=",. rész:", + it="Parte ", + ja={"第","パート"}, + kr={"제","부"}, + la="Pars ", + lt=", dalis", + nb="Del", + nl="Deel ", + nn="Del", + pl="Ustęp ", + pt="Parte ", + ro="Partea ", + ru="Часть ", + sk="Časť ", + sl="Del ", + sv="Del ", + tk="Bölüm", + tr="Cilt ", + ua="Частина ", + vi="Phần ", + }, + }, + saturday={ + labels={ + af="saterdag", + ar="السبت", + ca="dissabte", + cn="星期六", + cs="sobota", + da="lørdag", + de="Samstag", + en="Saturday", + es="sábado", + fi="lauantai", + fr="samedi", + gr="Σάββατο", + hr="subota", + hu="szombat", + it="sabato", + ja="土曜日", + kr="토요일", + la="Dies Saturni", + lt="šeštadienis", + nb="lørdag", + nl="zaterdag", + nn="laurdag", + pl="sobota", + pt="sábado", + ro="sâmbătă", + ru="суббота", + sk="", + sl="sobota", + sv="lördag", + tk="altynjy gün", + tr="cumartesi", + ua="субота", + vi="thứ bảy", + }, + }, + section={ + hidden=true, + labels={ + af="Paragraaf ", + ar="فصل ", + ca="Secció ", + cn={"第","节"}, + cs="Sekce ", + da="", + de="", + en="", + es="Sección ", + fi="", + fr="Section ", + gr="Ενότητα", + hr="Odjeljak ", + hu="Fejezet ", + it="", + ja={"第","項"}, + kr={"제","절"}, + la="", + lt="", + nb="", + nl="", + nn="", + pl="Podrozdział ", + pt="", + ro="", + ru="", + sk="Sekcia ", + sl="", + sv="", + tk="", + tr="", + ua="", + vi="", + }, + }, + see={ + labels={ + af="", + ar="انظر ", + ca="", + cs="viz ", + da="se ", + de="siehe ", + en="see ", + es="", + fi="", + fr="cf. ", + gr="", + hr="vidi ", + hu="lásd ", + it="cf. ", + kr="", + la="", + lt="žiūrėti ", + nb="se ", + nl="zie ", + nn="sjå ", + pl="", + pt="", + ro="", + ru="см. ", + sk="", + sl="glej ", + sv="se ", + tk="", + tr="", + ua="див. ", + vi="", + }, + }, + september={ + labels={ + af="september", + ar="سبتمبر", + ["ar-ma"]="شتنبر", + ["ar-sy"]="أيلول", + ca="setembre", + cn="九月", + cs="září", + da="september", + de="September", + en="September", + es="septiembre", + fi="syyskuu", + fr="septembre", + gr="Σεπτέμβριος", + hr="rujna", + hu="szeptember", + it="settembre", + ja="9", + kr="9월", + la="September", + lt="rugsėjo", + nb="september", + nl="september", + nn="september", + pl="września", + pt="setembro", + ro="septembrie", + ru="сентября", + sk="septembra", + sl="september", + sv="september", + tk="sentýabr", + tr="eylül", + ua="вересня", + vi="tháng chín", + }, + }, + ["september:mnem"]={ + labels={ + af="", + ca="", + cs="", + da="", + de="", + en="sep", + es="", + fi="", + fr="", + gr="", + hr="ruj", + hu="szep.", + it="", + la="", + lt="sep", + nb="sep.", + nl="", + nn="sep.", + pl="", + pt="", + ro="", + ru="", + sk="", + sl="", + sv="", + tk="", + tr="", + ua="", + vi="", + }, + }, + subsection={ + hidden=true, + labels={ + af="", + ar="فصل أدنى ", + ca="Subsecció ", + cn="", + cs="Podsekce ", + da="", + de="", + en="", + es="Subsección ", + fi="", + fr="Soussection ", + gr="Υπόενότητα", + hr="Pododjeljak ", + hu="Alfejezet ", + it="", + ja="", + la="", + lt="", + nb="", + nl="", + nn="", + pl="", + pt="", + ro="", + ru="", + sk="Podsekcia ", + sl="", + sv="", + tk="", + tr="", + ua="", + vi="", + }, + }, + subsubsection={ + hidden=true, + labels={ + af="", + ar="فصل أ دنى أدنى ", + ca="Subsubsecció ", + cn="", + cs="Podpodsekce ", + da="", + de="", + en="", + es="Subsubsección ", + fi="", + fr="Soussoussection ", + gr="", + hr="Podpododjeljak ", + hu="Al-alfejezet ", + it="", + ja="", + la="", + lt="", + nb="", + nl="", + nn="", + pl="", + pt="", + ro="", + ru="", + sk="Podpodsekcia ", + sl="", + sv="", + tk="", + tr="", + ua="", + vi="", + }, + }, + subsubsubsection={ + hidden=true, + labels={ + af="", + ar="فصل أدنى أدنى أدنى ", + ca="Subsubsubsecció ", + cn="", + cs="Podpodpodsekce ", + da="", + de="", + en="", + es="Subsubsubsección ", + fi="", + fr="Soussoussoussection ", + gr="", + hr="Podpodpododjeljak ", + hu="Al-al-alfejezet ", + it="", + ja="", + la="", + lt="", + nb="", + nl="", + nn="", + pl="", + pt="", + ro="", + ru="", + sk="Podpodpodsekcia ", + sl="", + sv="", + tk="", + tr="", + ua="", + vi="", + }, + }, + sunday={ + labels={ + af="sondag", + ar="الأحد", + ca="diumenge", + cn="星期日", + cs="neděle", + da="søndag", + de="Sonntag", + en="Sunday", + es="domingo", + fi="sunnuntai", + fr="dimanche", + gr="Κυριακή", + hr="nedjelja", + hu="vasárnap", + it="domenica", + ja="日曜日", + kr="일요일", + la="Dies Solis", + lt="sekmadienis", + nb="søndag", + nl="zondag", + nn="sundag", + pl="niedziela", + pt="domingo", + ro="duminică", + ru="воскресенье", + sk="", + sl="nedelja", + sv="söndag", + tk="dynç gün", + tr="pazar", + ua="неділя", + vi="chủ nhật", + }, + }, + table={ + labels={ + af="Tabel", + ar="جدول ", + ca="Taula ", + cn="表", + cs="Tabulka ", + da="Tabel ", + de="Tabelle ", + en="Table ", + es="Tabla ", + fi="Taulukko ", + fr="Tableau ", + gr="Πίνακας", + hr="Tablica ", + hu=",. táblázat:", + it="Tabella ", + ja="表", + kr="표", + la="Tabula ", + lt=", lentelė.", + nb="Tabell ", + nl="Tabel ", + nn="Tabell ", + pl="Tabela ", + pt="Tabela ", + ro="Tabelul ", + ru="Таблица ", + sk="Tabuľka ", + sl="Tabela ", + sv="Tabell ", + tk="Tablisa", + tr="Tablo ", + ua="Таблиця ", + vi="Bảng ", + }, + }, + thursday={ + labels={ + af="donderdag", + ar="الخميس", + ca="dijous", + cn="星期四", + cs="čtvrtek", + da="torsdag", + de="Donnerstag", + en="Thursday", + es="jueves", + fi="torstai", + fr="jeudi", + gr="Πέμπτη", + hr="četvrtak", + hu="csütörtök", + it="giovedì", + ja="木曜日", + kr="목요일", + la="Dies Iovis", + lt="ketvirtadienis", + nb="torsdag", + nl="donderdag", + nn="torsdag", + pl="czwartek", + pt="quinta-feira", + ro="joi", + ru="четверг", + sk="", + sl="četrtek", + sv="torsdag", + tk="dördünji gün", + tr="perşembe", + ua="четвер", + vi="thứ năm", + }, + }, + tuesday={ + labels={ + af="dinsdag", + ar="الثلاثاء", + ca="dimarts", + cn="星期二", + cs="úterý", + da="tirsdag", + de="Dienstag", + en="Tuesday", + es="martes", + fi="tiistai", + fr="mardi", + gr="Τρίτη", + hr="utorak", + hu="kedd", + it="martedì", + ja="火曜日", + kr="화요일", + la="Dies Martis", + lt="antradienis", + nb="tirsdag", + nl="dinsdag", + nn="tysdag", + pl="wtorek", + pt="terça-feira", + ro="marți", + ru="вторник", + sk="", + sl="torek", + sv="tisdag", + tk="ikinji gün", + tr="salı", + ua="вівторок", + vi="thứ ba", + }, + }, + wednesday={ + labels={ + af="woensdag", + ar="الأربعاء", + ca="dimecres", + cn="星期三", + cs="středa", + da="onsdag", + de="Mittwoch", + en="Wednesday", + es="miércoles", + fi="keskiviikko", + fr="mercredi", + gr="Τετάρτη", + hr="srijeda", + hu="szerda", + it="mercoledì", + ja="水曜日", + kr="수요일", + la="Dies Mercuri", + lt="trečiadienis", + nb="onsdag", + nl="woensdag", + nn="onsdag", + pl="środa", + pt="quarta-feira", + ro="miercuri", + ru="среда", + sk="", + sl="sreda", + sv="onsdag", + tk="üçünji", + tr="çarşamba", + ua="середа", + vi="thứ tư", + }, + }, + }, + titles={ + abbreviations={ + labels={ + af="Afkortings", + ar="الاختصارات", + ca="Abreviacions", + cn="缩略语", + cs="Zkratky", + da="Forkortelser", + de="Abkürzungen", + en="Abbreviations", + es="Abreviaturas", + fi="Lyhennyksi", + fr="Abréviations", + gr="Συντομογραφίες", + hr="Kratice", + hu="Rövidítések", + it="Abbreviazioni", + ja="略語", + kr="약어", + la="Notae", + lt="Santrumpos", + nb="Forkortelser", + nl="Afkortingen", + nn="Forkortingar", + pl="Skrócenie", + pt="Abreviaturas", + ro="Abrevieri", + ru="Список сокращений", + sk="Skratky", + sl="Kratice", + sv="Förkortningar", + tk="Gysgaltmalar", + tr="Kısaltmalar", + ua="Перелік скорочень", + vi="Chữ viết tắt", + }, + }, + content={ + labels={ + af="Inhoud", + ar="المحتويات", + ca="Índex de continguts", + cn="目录", + cs="Obsah", + da="Indhold", + de="Inhalt", + en="Contents", + es="Índice", + fi="Sisällys", + fr="Table des matières", + gr="Περιεχόμενα", + hr="Sadržaj", + hu="Tartalom", + it="Indice", + ja="目次", + kr="목차", + la="Quod in libro continetur", + lt="Turinys", + nb="Innhold", + nl="Inhoud", + nn="Innhald", + pl="Spis treści", + pt="Conteúdo", + ro="Cuprins", + ru="Содержание", + sk="Obsah", + sl="Kazalo", + sv="Innehåll", + tk="Mazmuny", + tr="Fihrist", + ua="Зміст", + vi="Mục lục", + }, + }, + figures={ + labels={ + af="Figure", + ar="الأشكال", + ca="Figures", + cn="图形", + cs="Obrázky", + da="Figurer", + de="Abbildungen", + en="Figures", + es="Ilustraciones", + fi="Kuvi", + fr="Figures", + gr="Σχήματα", + hr="Slike", + hu="Ábrák", + it="Figure", + ja="図", + kr="그림", + la="Imagines", + lt="Iliustracijos", + nb="Figurer", + nl="Figuren", + nn="Figurar", + pl="Ilustracje", + pt="Figuras", + ro="Figuri", + ru="Список иллюстраций", + sk="Obrázkov", + sl="Slike", + sv="Figurer", + tk="Suratlar", + tr="Şekiller", + ua="Перелік ілюстрацій", + vi="Danh sách hình vẽ", + }, + }, + graphics={ + labels={ + af="Grafieke", + ar="الرسوم", + ca="Gràfiques", + cn="图", + cs="Grafy", + da="Grafik", + de="Graphiken", + en="Graphics", + es="Gráficos", + fi="Grafiikkaoi", + fr="Graphiques", + gr="Γραφικά", + hr="Slike", + hu="Grafikák", + it="Grafici", + ja="グラフ", + kr="그래픽", + la="Typi", + lt="Graphics", + nb="Bilde", + nl="Grafieken", + nn="Bilete", + pl="Grafika", + pt="Gráficos", + ro="Grafice", + ru="Список графиков", + sk="Graf", + sl="Slike", + sv="Grafik", + tk="Grafikler", + tr="Grafikler", + ua="Перелік графіков", + vi="Đồ thị", + }, + }, + index={ + labels={ + af="Indeks", + ar="الفهرس", + ca="Índex alfabètic", + cn="索引", + cs="Rejstřík", + da="Indeks", + de="Index", + en="Index", + es="Índice alfabético", + fi="Indeksiluku", + fr="Index", + gr="Ευρετήριο", + hr="Indeks", + hu="Index", + it="Indice", + ja="目次", + kr="색인", + la="Indices", + lt="Rodyklė", + nb="Register", + nl="Index", + nn="Register", + pl="Indeks", + pt="Índice", + ro="Index", + ru="Алфавитный указатель", + sk="Zoznam", + sl="Stvarno kazalo", + sv="Sakregister", + tk="Indeks", + tr="İndex", + ua="Покажчик", + vi="Chỉ số", + }, + }, + intermezzi={ + labels={ + af="Intermezzos", + ar="فسح", + ca="Intermedis", + cn="퉣", + cs="Intermezza", + da="Intermezzoer", + de="Intermezzi", + en="Intermezzos", + es="Intermedios", + fi="Intermezzos", + fr="Intermèdes", + gr="Παύσεις", + hr="Intermeci", + hu="Intermezzok", + it="Intermezzi", + ja="間奏曲", + kr="간주곡", + la="Intermissa", + lt="Intermezzos", + nb="Intermesso", + nl="Intermezzo's", + nn="Intermesso", + pl="Intermezza", + pt="Intermédios", + ro="Intermzzo", + ru="Список вставок", + sk="Intermezzá", + sl="Intermezzi", + sv="Intermezzon", + tk="Arakesmeler", + tr="", + ua="Перелік вставок", + vi="Intermezzos", + }, + }, + logos={ + labels={ + af="Logos", + ar="الشعارات", + ca="Logotips", + cn="徽贬", + cs="Loga", + da="Logoer", + de="Logos", + en="Logos", + es="Logotipos", + fi="Vertauskuva", + fr="Logos", + gr="Λογότυπα", + hr="Logotipi", + hu="Fejlécek", + it="Logotipi", + ja="理性", + kr="이성", + la="Typi negotiales", + lt="Logos", + nb="Logoer", + nl="Logo's", + nn="Logoar", + pl="Znaki", + pt="Logotipos", + ro="Logo-uri", + ru="Логотипы", + sk="Logá", + sl="Logotipi", + sv="Loggor", + tk="Logolar", + tr="Logolar", + ua="Логотипи", + vi="Biểu tượng", + }, + }, + pubs={ + labels={ + af="", + ca="Referències", + cs="Literatura", + da="", + de="Literatur", + en="References", + es="Bibliografía", + fi="", + fr="Bibliographie", + gr="", + hr="Literatura", + hu="Bibliográfia", + it="Bibliografia", + la="", + lt="Literatūra", + nb="", + nl="Literatuur", + nn="", + pl="", + pt="", + ro="", + ru="", + sk="", + sl="Literatura", + sv="", + tk="", + tr="", + ua="", + vi="", + }, + }, + tables={ + labels={ + af="Tabelle", + ar="الجداول", + ca="Taules", + cn="表格", + cs="Tabulky", + da="Tabeller", + de="Tabellen", + en="Tables", + es="Tablas", + fi="Taulukkoj", + fr="Tableaux", + gr="Πίνακες", + hr="Tablice", + hu="Táblázatok", + it="Tabelle", + ja="机", + kr="표", + la="Tabulae", + lt="Lentelės", + nb="Tabeller", + nl="Tabellen", + nn="Tabellar", + pl="Tabele", + pt="Tabelas", + ro="Tabele", + ru="Список таблиц", + sk="Tabuliek", + sl="Tabele", + sv="Tabeller", + tk="Tablisalar", + tr="Tablolar", + ua="Перелік таблиць", + vi="Danh sách bảng", + }, + }, + units={ + labels={ + af="Eenhede", + ar="الوحدات", + ca="Unitats", + cn="计量单位", + cs="Jednotky", + da="Enheder", + de="Einheiten", + en="Units", + es="Unidades", + fi="Yksiköt", + fr="Unités", + gr="Μονάδες", + hr="Jedinice", + hu="Mértékegységek", + it="Unità", + ja="ユニッツ", + kr="측정단위", + la="Modi", + lt="Units", + nb="Enheter", + nl="Eenheden", + nn="Einingar", + pl="Jednostki", + pt="Unidades", + ro="Unități", + ru="Единицы измерения", + sk="Jednotky", + sl="Enote", + sv="Enheter", + tk="Birlikler", + tr="Birimler", + ua="Одиниці виміру", + vi="Đơn vị", + }, + }, + }, +} diff --git a/Master/texmf-dist/tex/context/base/lang-ura.mkii b/Master/texmf-dist/tex/context/base/lang-ura.mkii new file mode 100644 index 00000000000..a2bcd3d2bf2 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lang-ura.mkii @@ -0,0 +1,158 @@ +%D \module +%D [ file=lang-sla, +%D version=1997.09.03, +%D title=\CONTEXT\ Language Macros, +%D subtitle=Uralic 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. + +% Todo: replace \'.. by \namedglyph + +\writestatus{loading}{ConTeXt Language Macros / Uralic Languages} + +%D The framework of this module is set up by Hans Hagen while +%D many of the first translations were done by Tobias. Later +%D on, corrections were made by users. If you have suggestions, +%D or feel that your name missing here, don't hesitate to send +%D us an email. +%D +%D \starttabulate[|lB|l|] +%D \NC Finnish \NC \NC \NR +%D \NC Hungarian \NC Balazs Nagy \NC \NR +%D \stoptabulate + +% Cheremiss, Estonian, Finnish, Karelian, Laap, Mordvinian, +% Permian tongues, Hungarian, Ostyak, Vogul, Samoyed + +\unprotect + +\installlanguage + [\s!fi] + [\c!spacing=\v!packed, + \c!leftsentence=---, + \c!rightsentence=---, + \c!leftsubsentence=---, + \c!rightsubsentence=---, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\upperleftdoublesixquote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!year,\ ,\v!month,\ ,\v!day}] + +\installlanguage + [\s!hu] + [\c!spacing=\v!packed, + \c!leftsentence=---, + \c!rightsentence=---, + \c!leftsubsentence=---, + \c!rightsubsentence=---, + \c!leftquote=\lowerleftsingleninequote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\lowerleftdoubleninequote, + \c!rightquotation=\upperrightdoubleninequote, + \c!date={\v!year,.,\ ,\v!month,\ ,\v!day,.}, + \s!mapping=ec, + \s!encoding=ec] + +\installlanguage [finish] [\s!fi] +\installlanguage [hungarian] [\s!hu] + +\setupheadtext [\s!fi] [\v!content=Sis\"allys] +\setupheadtext [\s!fi] [\v!tables=Taulukkoj] +\setupheadtext [\s!fi] [\v!figures=Kuvi] +\setupheadtext [\s!fi] [\v!graphics=Grafiikkaoi] +\setupheadtext [\s!fi] [\v!intermezzi=Intermezzos] +\setupheadtext [\s!fi] [\v!index=Indeksiluku] +\setupheadtext [\s!fi] [\v!abbreviations=Lyhennyksi] +\setupheadtext [\s!fi] [\v!logos=Vertauskuva] +\setupheadtext [\s!fi] [\v!units=Yksik\"ot] + +\setupheadtext [\s!hu] [\v!content=Tartalom] +\setupheadtext [\s!hu] [\v!tables=T\'abl\'azatok] +\setupheadtext [\s!hu] [\v!figures=\'Abr\'ak] +\setupheadtext [\s!hu] [\v!graphics=Grafik\'ak] +\setupheadtext [\s!hu] [\v!intermezzi=Intermezzok] +\setupheadtext [\s!hu] [\v!index=Index] +\setupheadtext [\s!hu] [\v!abbreviations=R\"ovid\'it\'esek] +\setupheadtext [\s!hu] [\v!logos=Fejl\'ecek] +\setupheadtext [\s!hu] [\v!units=M\'ert\'ekegys\'egek] + +\setuplabeltext [\s!fi] [\v!table=Taulukko ] +\setuplabeltext [\s!fi] [\v!figure=Kuva ] +\setuplabeltext [\s!fi] [\v!intermezzo=Intermezzo ] +\setuplabeltext [\s!fi] [\v!graphic=Grafiikka ] +\setuplabeltext [\s!fi] [\v!chapter=] +\setuplabeltext [\s!fi] [\v!section=] +\setuplabeltext [\s!fi] [\v!subsection=] +\setuplabeltext [\s!fi] [\v!subsubsection=] +\setuplabeltext [\s!fi] [\v!subsubsubsection=] +\setuplabeltext [\s!fi] [\v!appendix=] +\setuplabeltext [\s!fi] [\v!part=Osa ] +\setuplabeltext [\s!fi] [\v!line=rivi ] +\setuplabeltext [\s!fi] [\v!lines=rivie ] + +\setuplabeltext [\s!hu] [\v!table={,.~t\'abl\'azat:}] +\setuplabeltext [\s!hu] [\v!figure={,.~\'abra:}] +\setuplabeltext [\s!hu] [\v!intermezzo={,.~intermezzo:}] +\setuplabeltext [\s!hu] [\v!graphic={,.~k\'ep:}] +\setuplabeltext [\s!hu] [\v!chapter={,.~fejezet:}] +\setuplabeltext [\s!hu] [\v!section={,.}] +\setuplabeltext [\s!hu] [\v!subsection={,.}] +\setuplabeltext [\s!hu] [\v!subsubsection={,.}] +\setuplabeltext [\s!hu] [\v!subsubsubsection={,.}] +\setuplabeltext [\s!hu] [\v!appendix=] +\setuplabeltext [\s!hu] [\v!part={,.~r\'esz:}] +\setuplabeltext [\s!hu] [\v!line={,.~sor:}] +\setuplabeltext [\s!hu] [\v!lines=sorok] + +\setuplabeltext [\s!fi] [\v!january=tammikuu] +\setuplabeltext [\s!fi] [\v!february=helmikuu] +\setuplabeltext [\s!fi] [\v!march=maaliskuu] +\setuplabeltext [\s!fi] [\v!april=huhtikuu] +\setuplabeltext [\s!fi] [\v!may=toukokuu] +\setuplabeltext [\s!fi] [\v!june=kes\"akuu] +\setuplabeltext [\s!fi] [\v!july=hein\"akuu] +\setuplabeltext [\s!fi] [\v!august=elokuu] +\setuplabeltext [\s!fi] [\v!september=syyskuu] +\setuplabeltext [\s!fi] [\v!october=lokakuu] +\setuplabeltext [\s!fi] [\v!november=marraskuu] +\setuplabeltext [\s!fi] [\v!december=joulukuu] + +\setuplabeltext [\s!hu] [\v!january=janu\'ar] +\setuplabeltext [\s!hu] [\v!february=febru\'ar] +\setuplabeltext [\s!hu] [\v!march=m\'arcius] +\setuplabeltext [\s!hu] [\v!april=\'aprilis] +\setuplabeltext [\s!hu] [\v!may=m\'ajus] +\setuplabeltext [\s!hu] [\v!june=j\'unius] +\setuplabeltext [\s!hu] [\v!july=j\'ulius] +\setuplabeltext [\s!hu] [\v!august=augusztus] +\setuplabeltext [\s!hu] [\v!september=szeptember] +\setuplabeltext [\s!hu] [\v!october=okt\'ober] +\setuplabeltext [\s!hu] [\v!november=november] +\setuplabeltext [\s!hu] [\v!december=december] + +\setuplabeltext [\s!fi] [\v!sunday=sunnuntai] +\setuplabeltext [\s!fi] [\v!monday=maanantai] +\setuplabeltext [\s!fi] [\v!tuesday=tiistai] +\setuplabeltext [\s!fi] [\v!wednesday=keskiviikko] +\setuplabeltext [\s!fi] [\v!thursday=torstai] +\setuplabeltext [\s!fi] [\v!friday=perjantai] +\setuplabeltext [\s!fi] [\v!saturday=lauantai] + +\setuplabeltext [\s!hu] [\v!sunday=vas\'arnap] +\setuplabeltext [\s!hu] [\v!monday=h\'etf\H{o}] +\setuplabeltext [\s!hu] [\v!tuesday=kedd] +\setuplabeltext [\s!hu] [\v!wednesday=szerda] +\setuplabeltext [\s!hu] [\v!thursday=cs\"ut\"ort\"ok] +\setuplabeltext [\s!hu] [\v!friday=p\'entek] +\setuplabeltext [\s!hu] [\v!saturday=szombat] + +%D \ShowAllLanguageValues [\s!fi] [finnish] {Finnish} {phone} +%D \ShowAllLanguageValues [\s!hu] [hungarian] {Hungarian} {rhapsody} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-ura.tex b/Master/texmf-dist/tex/context/base/lang-ura.tex deleted file mode 100644 index a2bcd3d2bf2..00000000000 --- a/Master/texmf-dist/tex/context/base/lang-ura.tex +++ /dev/null @@ -1,158 +0,0 @@ -%D \module -%D [ file=lang-sla, -%D version=1997.09.03, -%D title=\CONTEXT\ Language Macros, -%D subtitle=Uralic 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. - -% Todo: replace \'.. by \namedglyph - -\writestatus{loading}{ConTeXt Language Macros / Uralic Languages} - -%D The framework of this module is set up by Hans Hagen while -%D many of the first translations were done by Tobias. Later -%D on, corrections were made by users. If you have suggestions, -%D or feel that your name missing here, don't hesitate to send -%D us an email. -%D -%D \starttabulate[|lB|l|] -%D \NC Finnish \NC \NC \NR -%D \NC Hungarian \NC Balazs Nagy \NC \NR -%D \stoptabulate - -% Cheremiss, Estonian, Finnish, Karelian, Laap, Mordvinian, -% Permian tongues, Hungarian, Ostyak, Vogul, Samoyed - -\unprotect - -\installlanguage - [\s!fi] - [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, - \c!leftquote=\upperleftsinglesixquote, - \c!rightquote=\upperrightsingleninequote, - \c!leftquotation=\upperleftdoublesixquote, - \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!year,\ ,\v!month,\ ,\v!day}] - -\installlanguage - [\s!hu] - [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, - \c!leftquote=\lowerleftsingleninequote, - \c!rightquote=\upperrightsingleninequote, - \c!leftquotation=\lowerleftdoubleninequote, - \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!year,.,\ ,\v!month,\ ,\v!day,.}, - \s!mapping=ec, - \s!encoding=ec] - -\installlanguage [finish] [\s!fi] -\installlanguage [hungarian] [\s!hu] - -\setupheadtext [\s!fi] [\v!content=Sis\"allys] -\setupheadtext [\s!fi] [\v!tables=Taulukkoj] -\setupheadtext [\s!fi] [\v!figures=Kuvi] -\setupheadtext [\s!fi] [\v!graphics=Grafiikkaoi] -\setupheadtext [\s!fi] [\v!intermezzi=Intermezzos] -\setupheadtext [\s!fi] [\v!index=Indeksiluku] -\setupheadtext [\s!fi] [\v!abbreviations=Lyhennyksi] -\setupheadtext [\s!fi] [\v!logos=Vertauskuva] -\setupheadtext [\s!fi] [\v!units=Yksik\"ot] - -\setupheadtext [\s!hu] [\v!content=Tartalom] -\setupheadtext [\s!hu] [\v!tables=T\'abl\'azatok] -\setupheadtext [\s!hu] [\v!figures=\'Abr\'ak] -\setupheadtext [\s!hu] [\v!graphics=Grafik\'ak] -\setupheadtext [\s!hu] [\v!intermezzi=Intermezzok] -\setupheadtext [\s!hu] [\v!index=Index] -\setupheadtext [\s!hu] [\v!abbreviations=R\"ovid\'it\'esek] -\setupheadtext [\s!hu] [\v!logos=Fejl\'ecek] -\setupheadtext [\s!hu] [\v!units=M\'ert\'ekegys\'egek] - -\setuplabeltext [\s!fi] [\v!table=Taulukko ] -\setuplabeltext [\s!fi] [\v!figure=Kuva ] -\setuplabeltext [\s!fi] [\v!intermezzo=Intermezzo ] -\setuplabeltext [\s!fi] [\v!graphic=Grafiikka ] -\setuplabeltext [\s!fi] [\v!chapter=] -\setuplabeltext [\s!fi] [\v!section=] -\setuplabeltext [\s!fi] [\v!subsection=] -\setuplabeltext [\s!fi] [\v!subsubsection=] -\setuplabeltext [\s!fi] [\v!subsubsubsection=] -\setuplabeltext [\s!fi] [\v!appendix=] -\setuplabeltext [\s!fi] [\v!part=Osa ] -\setuplabeltext [\s!fi] [\v!line=rivi ] -\setuplabeltext [\s!fi] [\v!lines=rivie ] - -\setuplabeltext [\s!hu] [\v!table={,.~t\'abl\'azat:}] -\setuplabeltext [\s!hu] [\v!figure={,.~\'abra:}] -\setuplabeltext [\s!hu] [\v!intermezzo={,.~intermezzo:}] -\setuplabeltext [\s!hu] [\v!graphic={,.~k\'ep:}] -\setuplabeltext [\s!hu] [\v!chapter={,.~fejezet:}] -\setuplabeltext [\s!hu] [\v!section={,.}] -\setuplabeltext [\s!hu] [\v!subsection={,.}] -\setuplabeltext [\s!hu] [\v!subsubsection={,.}] -\setuplabeltext [\s!hu] [\v!subsubsubsection={,.}] -\setuplabeltext [\s!hu] [\v!appendix=] -\setuplabeltext [\s!hu] [\v!part={,.~r\'esz:}] -\setuplabeltext [\s!hu] [\v!line={,.~sor:}] -\setuplabeltext [\s!hu] [\v!lines=sorok] - -\setuplabeltext [\s!fi] [\v!january=tammikuu] -\setuplabeltext [\s!fi] [\v!february=helmikuu] -\setuplabeltext [\s!fi] [\v!march=maaliskuu] -\setuplabeltext [\s!fi] [\v!april=huhtikuu] -\setuplabeltext [\s!fi] [\v!may=toukokuu] -\setuplabeltext [\s!fi] [\v!june=kes\"akuu] -\setuplabeltext [\s!fi] [\v!july=hein\"akuu] -\setuplabeltext [\s!fi] [\v!august=elokuu] -\setuplabeltext [\s!fi] [\v!september=syyskuu] -\setuplabeltext [\s!fi] [\v!october=lokakuu] -\setuplabeltext [\s!fi] [\v!november=marraskuu] -\setuplabeltext [\s!fi] [\v!december=joulukuu] - -\setuplabeltext [\s!hu] [\v!january=janu\'ar] -\setuplabeltext [\s!hu] [\v!february=febru\'ar] -\setuplabeltext [\s!hu] [\v!march=m\'arcius] -\setuplabeltext [\s!hu] [\v!april=\'aprilis] -\setuplabeltext [\s!hu] [\v!may=m\'ajus] -\setuplabeltext [\s!hu] [\v!june=j\'unius] -\setuplabeltext [\s!hu] [\v!july=j\'ulius] -\setuplabeltext [\s!hu] [\v!august=augusztus] -\setuplabeltext [\s!hu] [\v!september=szeptember] -\setuplabeltext [\s!hu] [\v!october=okt\'ober] -\setuplabeltext [\s!hu] [\v!november=november] -\setuplabeltext [\s!hu] [\v!december=december] - -\setuplabeltext [\s!fi] [\v!sunday=sunnuntai] -\setuplabeltext [\s!fi] [\v!monday=maanantai] -\setuplabeltext [\s!fi] [\v!tuesday=tiistai] -\setuplabeltext [\s!fi] [\v!wednesday=keskiviikko] -\setuplabeltext [\s!fi] [\v!thursday=torstai] -\setuplabeltext [\s!fi] [\v!friday=perjantai] -\setuplabeltext [\s!fi] [\v!saturday=lauantai] - -\setuplabeltext [\s!hu] [\v!sunday=vas\'arnap] -\setuplabeltext [\s!hu] [\v!monday=h\'etf\H{o}] -\setuplabeltext [\s!hu] [\v!tuesday=kedd] -\setuplabeltext [\s!hu] [\v!wednesday=szerda] -\setuplabeltext [\s!hu] [\v!thursday=cs\"ut\"ort\"ok] -\setuplabeltext [\s!hu] [\v!friday=p\'entek] -\setuplabeltext [\s!hu] [\v!saturday=szombat] - -%D \ShowAllLanguageValues [\s!fi] [finnish] {Finnish} {phone} -%D \ShowAllLanguageValues [\s!hu] [hungarian] {Hungarian} {rhapsody} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-url.lua b/Master/texmf-dist/tex/context/base/lang-url.lua index b0a71ec679e..e401e41484d 100644 --- a/Master/texmf-dist/tex/context/base/lang-url.lua +++ b/Master/texmf-dist/tex/context/base/lang-url.lua @@ -11,9 +11,10 @@ local utf = unicode.utf8 local utfcharacters, utfvalues = string.utfcharacters, string.utfvalues local utfbyte, utfgsub = utf.byte, utf.gsub -local ctxcatcodes, texsprint = tex.ctxcatcodes, tex.sprint +context = context -commands = commands or { } +commands = commands or { } +local commands = commands --[[

Hyphenating 's is somewhat tricky and a matter of taste. I did @@ -23,10 +24,9 @@ dealing with characters.

]]-- commands.hyphenatedurl = commands.hyphenatedurl or { } +local hyphenatedurl = commands.hyphenatedurl -local hyphenatedurl = commands.hyphenatedurl - -hyphenatedurl.characters = { +hyphenatedurl.characters = utilities.storage.allocate { ["!"] = 1, ["\""] = 1, ["#"] = 1, @@ -68,7 +68,7 @@ hyphenatedurl.discretionary = nil local chars = hyphenatedurl.characters -function hyphenatedurl.action(str, left, right, disc) +local function action(hyphenatedurl, str, left, right, disc) local n = 0 local b = math.max( left or hyphenatedurl.lefthyphenmin, 2) local e = math.min(#str-(right or hyphenatedurl.righthyphenmin)+2,#str) @@ -76,20 +76,24 @@ function hyphenatedurl.action(str, left, right, disc) for s in utfcharacters(str) do n = n + 1 if s == d then - texsprint(ctxcatcodes,"\\d{",utfbyte(s),"}") + context.d(utfbyte(s)) else local c = chars[s] if not c or n<=b or n>=e then - texsprint(ctxcatcodes,"\\n{",utfbyte(s),"}") + context.n(utfbyte(s)) elseif c == 1 then - texsprint(ctxcatcodes,"\\b{",utfbyte(s),"}") + context.b(utfbyte(s)) elseif c == 2 then - texsprint(ctxcatcodes,"\\a{",utfbyte(s),"}") + context.a(utfbyte(s)) end end end end +-- hyphenatedurl.action = function(_,...) action(...) end -- sort of obsolete + +table.setmetatablecall(hyphenatedurl,action) + -- todo, no interface in mkiv yet function hyphenatedurl.setcharacters(str,value) -- 1, 2 == before, after diff --git a/Master/texmf-dist/tex/context/base/lang-url.mkiv b/Master/texmf-dist/tex/context/base/lang-url.mkiv index 0f6b23d0552..cba013324c7 100644 --- a/Master/texmf-dist/tex/context/base/lang-url.mkiv +++ b/Master/texmf-dist/tex/context/base/lang-url.mkiv @@ -38,8 +38,6 @@ %D %D \typebuffer -\ifx\urlsplitmode\undefined \chardef\urlsplitmode\zerocount \fi % not supported in mkiv - \newtoks\everyhyphenatedurl \appendtoks @@ -64,16 +62,16 @@ \def\dohyphenatedurlnormal#1{\char#1\relax}% \def\dohyphenatedurldisc #1{\discretionary{}{}{}} -\def\sethyphenatedurlnormal #1{\ctxlua{commands.hyphenatedurl.setcharacters(\!!bs#1\!!es,0)}} -\def\sethyphenatedurlbefore #1{\ctxlua{commands.hyphenatedurl.setcharacters(\!!bs#1\!!es,1)}} -\def\sethyphenatedurlafter #1{\ctxlua{commands.hyphenatedurl.setcharacters(\!!bs#1\!!es,2)}} +\def\sethyphenatedurlnormal #1{\ctxcommand{hyphenatedurl.setcharacters(\!!bs#1\!!es,0)}} +\def\sethyphenatedurlbefore #1{\ctxcommand{hyphenatedurl.setcharacters(\!!bs#1\!!es,1)}} +\def\sethyphenatedurlafter #1{\ctxcommand{hyphenatedurl.setcharacters(\!!bs#1\!!es,2)}} \def\hyphenatedurldiscretionary{} % \sethyphenatedurlafter{ABCDEF} -\chardef\hyphenatedurllefthyphenmin = 3 -\chardef\hyphenatedurlrighthyphenmin = 3 +\setnewconstant\hyphenatedurllefthyphenmin \plusthree +\setnewconstant\hyphenatedurlrighthyphenmin\plusthree \unexpanded \def\hyphenatedurl#1% {\dontleavehmode @@ -83,7 +81,7 @@ \let\b\dohyphenatedurlbefore \let\a\dohyphenatedurlafter \let\d\dohyphenatedurldisc - \normalexpanded{\noexpand\ctxlua{commands.hyphenatedurl.action( + \normalexpanded{\noexpand\ctxcommand{hyphenatedurl( \!!bs\noexpand\detokenize{#1}\!!es, \number\hyphenatedurllefthyphenmin, \number\hyphenatedurlrighthyphenmin, diff --git a/Master/texmf-dist/tex/context/base/lang-vn.mkii b/Master/texmf-dist/tex/context/base/lang-vn.mkii new file mode 100644 index 00000000000..27d2a48a16f --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lang-vn.mkii @@ -0,0 +1,92 @@ +%D \module +%D [ file=lang-vn, +%D version=2004.11.22, % 1999.12.12, +%D title=\CONTEXT\ Language Macros, +%D subtitle=Vietnamese, +%D author={Han The Thanh \& Adam Lindsay \& Hans Hagen}, +%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. + +\writestatus{loading}{ConTeXt Language Macros / Vietnamese Language} + +%D The framework of this module is set up by Hans Hagen while +%D many of the first translations were done by Tobias. Later +%D on, corrections were made by users. If you have suggestions, +%D or feel that your name missing here, don't hesitate to send +%D us an email. +%D +%D \starttabulate[|lB|l|] +%D \NC Vietnamese \NC \THANH\ \NC \NR +%D \stoptabulate + +\unprotect + +\installlanguage + [\s!vi] + [\c!spacing=\v!packed, + \c!leftsentence=---, + \c!rightsentence=---, + \c!leftsubsentence=---, + \c!rightsubsentence=---, + \c!leftquote=\quoteleft, + \c!rightquote=\quoteright, + \c!leftquotation=\quotedblleft, + \c!rightquotation=\quotedblright, + \c!date={{ },dd,{/},mm,{/},yy}, + \s!mapping=t5, + \s!encoding=t5] + +\installlanguage [vietnamese] [\s!vi] + +\setupheadtext [\s!vi] [\v!content=M\udotbelow c l\udotbelow c] +\setupheadtext [\s!vi] [\v!tables=Danh s\aacute ch b\ahook ng] +\setupheadtext [\s!vi] [\v!figures=Danh s\aacute ch h\igrave nh v\etilde] +\setupheadtext [\s!vi] [\v!graphics=\Dstroke\ocircumflexgrave\ th\idotbelow] +\setupheadtext [\s!vi] [\v!intermezzi=Intermezzos] +\setupheadtext [\s!vi] [\v!index=Ch\ihook\ s\ocircumflexacute] +\setupheadtext [\s!vi] [\v!abbreviations=Ch\uhorntilde\ vi\ecircumflexacute t t\abreveacute t] +\setupheadtext [\s!vi] [\v!logos=Bi\ecircumflexhook u t\uhorn \ohorndotbelow ng] +\setupheadtext [\s!vi] [\v!units=\Dstroke\ohorn n v\idotbelow] + +\setuplabeltext [\s!vi] [\v!table=B\ahook ng ] +\setuplabeltext [\s!vi] [\v!figure=H\igrave nh ] +\setuplabeltext [\s!vi] [\v!intermezzo=intermezzo] +\setuplabeltext [\s!vi] [\v!graphic=\Dstroke\ocircumflexgrave\ th\idotbelow] +\setuplabeltext [\s!vi] [\v!chapter=Ch\uhorn \ohorn ng ] +\setuplabeltext [\s!vi] [\v!section=] % not set +\setuplabeltext [\s!vi] [\v!subsection=] % not set +\setuplabeltext [\s!vi] [\v!subsubsection=] % not set +\setuplabeltext [\s!vi] [\v!subsubsubsection=] % not set +\setuplabeltext [\s!vi] [\v!appendix=] % not set +\setuplabeltext [\s!vi] [\v!part=Ph\acircumflexgrave n ] +\setuplabeltext [\s!vi] [\v!line=d\ograve ng ] +\setuplabeltext [\s!vi] [\v!lines=d\ograve ng ] + +\setuplabeltext [\s!vi] [\v!sunday=ch\uhook\ nh\acircumflexdotbelow t] +\setuplabeltext [\s!vi] [\v!monday=th\uhornacute\ hai] +\setuplabeltext [\s!vi] [\v!tuesday=th\uhornacute\ ba] +\setuplabeltext [\s!vi] [\v!wednesday=th\uhornacute\ t\uhorn] +\setuplabeltext [\s!vi] [\v!thursday=th\uhornacute\ n\abreve m] +\setuplabeltext [\s!vi] [\v!friday=th\uhornacute\ s\aacute u] +\setuplabeltext [\s!vi] [\v!saturday=th\uhornacute\ b\ahook y] + +\setuplabeltext [\s!vi] [\v!january=th\aacute ng gi\ecircumflex ng] +\setuplabeltext [\s!vi] [\v!february=th\aacute ng hai] +\setuplabeltext [\s!vi] [\v!march=th\aacute ng ba] +\setuplabeltext [\s!vi] [\v!april=th\aacute ng t\uhorn] +\setuplabeltext [\s!vi] [\v!may=th\aacute ng n\abreve m] +\setuplabeltext [\s!vi] [\v!june=th\aacute ng s\aacute u] +\setuplabeltext [\s!vi] [\v!july=th\aacute ng b\ahook y] +\setuplabeltext [\s!vi] [\v!august=th\aacute ng t\aacute m] +\setuplabeltext [\s!vi] [\v!september=th\aacute ng ch\iacute n] +\setuplabeltext [\s!vi] [\v!october=th\aacute ng m\uhorn\ohorngrave i] +\setuplabeltext [\s!vi] [\v!november=th\aacute ng m\uhorn\ohorngrave i m\ocircumflexdotbelow t] +\setuplabeltext [\s!vi] [\v!december=th\aacute ng m\uhorn\ohorngrave i hai] + +%D \ShowAllLanguageValues [\s!vi] [vietnamese] {Vietnamese} {water||puppets} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-vn.tex b/Master/texmf-dist/tex/context/base/lang-vn.tex deleted file mode 100644 index 27d2a48a16f..00000000000 --- a/Master/texmf-dist/tex/context/base/lang-vn.tex +++ /dev/null @@ -1,92 +0,0 @@ -%D \module -%D [ file=lang-vn, -%D version=2004.11.22, % 1999.12.12, -%D title=\CONTEXT\ Language Macros, -%D subtitle=Vietnamese, -%D author={Han The Thanh \& Adam Lindsay \& Hans Hagen}, -%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. - -\writestatus{loading}{ConTeXt Language Macros / Vietnamese Language} - -%D The framework of this module is set up by Hans Hagen while -%D many of the first translations were done by Tobias. Later -%D on, corrections were made by users. If you have suggestions, -%D or feel that your name missing here, don't hesitate to send -%D us an email. -%D -%D \starttabulate[|lB|l|] -%D \NC Vietnamese \NC \THANH\ \NC \NR -%D \stoptabulate - -\unprotect - -\installlanguage - [\s!vi] - [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, - \c!leftquote=\quoteleft, - \c!rightquote=\quoteright, - \c!leftquotation=\quotedblleft, - \c!rightquotation=\quotedblright, - \c!date={{ },dd,{/},mm,{/},yy}, - \s!mapping=t5, - \s!encoding=t5] - -\installlanguage [vietnamese] [\s!vi] - -\setupheadtext [\s!vi] [\v!content=M\udotbelow c l\udotbelow c] -\setupheadtext [\s!vi] [\v!tables=Danh s\aacute ch b\ahook ng] -\setupheadtext [\s!vi] [\v!figures=Danh s\aacute ch h\igrave nh v\etilde] -\setupheadtext [\s!vi] [\v!graphics=\Dstroke\ocircumflexgrave\ th\idotbelow] -\setupheadtext [\s!vi] [\v!intermezzi=Intermezzos] -\setupheadtext [\s!vi] [\v!index=Ch\ihook\ s\ocircumflexacute] -\setupheadtext [\s!vi] [\v!abbreviations=Ch\uhorntilde\ vi\ecircumflexacute t t\abreveacute t] -\setupheadtext [\s!vi] [\v!logos=Bi\ecircumflexhook u t\uhorn \ohorndotbelow ng] -\setupheadtext [\s!vi] [\v!units=\Dstroke\ohorn n v\idotbelow] - -\setuplabeltext [\s!vi] [\v!table=B\ahook ng ] -\setuplabeltext [\s!vi] [\v!figure=H\igrave nh ] -\setuplabeltext [\s!vi] [\v!intermezzo=intermezzo] -\setuplabeltext [\s!vi] [\v!graphic=\Dstroke\ocircumflexgrave\ th\idotbelow] -\setuplabeltext [\s!vi] [\v!chapter=Ch\uhorn \ohorn ng ] -\setuplabeltext [\s!vi] [\v!section=] % not set -\setuplabeltext [\s!vi] [\v!subsection=] % not set -\setuplabeltext [\s!vi] [\v!subsubsection=] % not set -\setuplabeltext [\s!vi] [\v!subsubsubsection=] % not set -\setuplabeltext [\s!vi] [\v!appendix=] % not set -\setuplabeltext [\s!vi] [\v!part=Ph\acircumflexgrave n ] -\setuplabeltext [\s!vi] [\v!line=d\ograve ng ] -\setuplabeltext [\s!vi] [\v!lines=d\ograve ng ] - -\setuplabeltext [\s!vi] [\v!sunday=ch\uhook\ nh\acircumflexdotbelow t] -\setuplabeltext [\s!vi] [\v!monday=th\uhornacute\ hai] -\setuplabeltext [\s!vi] [\v!tuesday=th\uhornacute\ ba] -\setuplabeltext [\s!vi] [\v!wednesday=th\uhornacute\ t\uhorn] -\setuplabeltext [\s!vi] [\v!thursday=th\uhornacute\ n\abreve m] -\setuplabeltext [\s!vi] [\v!friday=th\uhornacute\ s\aacute u] -\setuplabeltext [\s!vi] [\v!saturday=th\uhornacute\ b\ahook y] - -\setuplabeltext [\s!vi] [\v!january=th\aacute ng gi\ecircumflex ng] -\setuplabeltext [\s!vi] [\v!february=th\aacute ng hai] -\setuplabeltext [\s!vi] [\v!march=th\aacute ng ba] -\setuplabeltext [\s!vi] [\v!april=th\aacute ng t\uhorn] -\setuplabeltext [\s!vi] [\v!may=th\aacute ng n\abreve m] -\setuplabeltext [\s!vi] [\v!june=th\aacute ng s\aacute u] -\setuplabeltext [\s!vi] [\v!july=th\aacute ng b\ahook y] -\setuplabeltext [\s!vi] [\v!august=th\aacute ng t\aacute m] -\setuplabeltext [\s!vi] [\v!september=th\aacute ng ch\iacute n] -\setuplabeltext [\s!vi] [\v!october=th\aacute ng m\uhorn\ohorngrave i] -\setuplabeltext [\s!vi] [\v!november=th\aacute ng m\uhorn\ohorngrave i m\ocircumflexdotbelow t] -\setuplabeltext [\s!vi] [\v!december=th\aacute ng m\uhorn\ohorngrave i hai] - -%D \ShowAllLanguageValues [\s!vi] [vietnamese] {Vietnamese} {water||puppets} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lang-wrd.lua b/Master/texmf-dist/tex/context/base/lang-wrd.lua index 095e44443d9..558d5744faf 100644 --- a/Master/texmf-dist/tex/context/base/lang-wrd.lua +++ b/Master/texmf-dist/tex/context/base/lang-wrd.lua @@ -8,44 +8,59 @@ if not modules then modules = { } end modules ['lang-ini'] = { local utf = unicode.utf8 local lower, utfchar = string.lower, utf.char +local concat = table.concat local lpegmatch = lpeg.match +local P, S, Cs = lpeg.P, lpeg.S, lpeg.Cs -languages.words = languages.words or { } +local report_words = logs.reporter("languages","words") -local words = languages.words +local nodes, node, languages = nodes, node, languages -words.data = words.data or { } -words.enables = false -words.threshold = 4 +languages.words = languages.words or { } +local words = languages.words + +words.data = words.data or { } +words.enables = false +words.threshold = 4 + +local numbers = languages.numbers +local registered = languages.registered local set_attribute = node.set_attribute local unset_attribute = node.unset_attribute local traverse_nodes = node.traverse -local node_id = node.id local wordsdata = words.data local chardata = characters.data +local tasks = nodes.tasks -local glyph_node = node_id('glyph') -local disc_node = node_id('disc') -local kern_node = node_id('kern') +local nodecodes = nodes.nodecodes +local kerncodes = nodes.kerncodes -words.colors = { - ["known"] = "green", - ["unknown"] = "red", -} +local glyph_code = nodecodes.glyph +local disc_code = nodecodes.disc +local kern_code = nodecodes.kern + +local kerning_code = kerncodes.kerning +local lowerchar = characters.lower -local spacing = lpeg.S(" \n\r\t") -local markup = lpeg.S("-=") -local lbrace = lpeg.P("{") -local rbrace = lpeg.P("}") +local a_color = attributes.private('color') +local colist = attributes.list[a_color] + +local is_letter = characters.is_letter -- maybe is_character as variant + +local spacing = S(" \n\r\t") +local markup = S("-=") +local lbrace = P("{") +local rbrace = P("}") local disc = (lbrace * (1-rbrace)^0 * rbrace)^1 -- or just 3 times, time this -local word = lpeg.Cs((markup/"" + disc/"" + (1-spacing))^1) +local word = Cs((markup/"" + disc/"" + (1-spacing))^1) local loaded = { } -- we share lists function words.load(tag,filename) - local fullname = resolvers.find_file(filename,'other text file') or "" + local fullname = resolvers.findfile(filename,'other text file') or "" if fullname ~= "" then + report_words("loading word file '%s'",fullname) statistics.starttiming(languages) local list = loaded[fullname] if not list then @@ -57,7 +72,7 @@ function words.load(tag,filename) wordsdata[tag] = list statistics.stoptiming(languages) else - logs.report("languages","missing words file '%s'",filename) + report_words("missing word file '%s'",filename) end end @@ -65,149 +80,323 @@ function words.found(id, str) local tag = languages.numbers[id] if tag then local data = wordsdata[tag] - return data and (data[str] or data[lower(str)]) - else - return false + if data then + if data[str] then + return 1 + elseif data[lower(str)] then + return 2 + end + end end end -- The following code is an adaption of experimental code for -- hyphenating and spell checking. -local function mark_words(head,whenfound) -- can be optimized - local current, start, str, language, n = head, nil, "", nil, 0 +-- there is an n=1 problem somewhere in nested boxes + +--~ local function mark_words(head,whenfound) -- can be optimized and shared +--~ local current, start, str, language, n, done = head, nil, "", nil, 0, false +--~ local function action() +--~ if #str > 0 then +--~ local f = whenfound(language,str) +--~ if f then +--~ done = true +--~ for i=1,n do +--~ f(start) +--~ start = start.next +--~ end +--~ end +--~ end +--~ str, start, n = "", nil, 0 +--~ end +--~ while current do +--~ local id = current.id +--~ if id == glyph_code then +--~ local a = current.lang +--~ if a then +--~ if a ~= language then +--~ if start then +--~ action() +--~ end +--~ language = a +--~ end +--~ elseif start then +--~ action() +--~ language = a +--~ end +--~ local components = current.components +--~ if components then +--~ start = start or current +--~ n = n + 1 +--~ for g in traverse_nodes(components) do +--~ str = str .. utfchar(g.char) +--~ end +--~ else +--~ local code = current.char +--~ local data = chardata[code] +--~ if is_letter[data.category] then +--~ start = start or current +--~ n = n + 1 +--~ str = str .. utfchar(code) -- slow, maybe str should be a table (and given max) +--~ elseif start then +--~ action() +--~ end +--~ end +--~ elseif id == disc_code then +--~ if n > 0 then +--~ n = n + 1 +--~ end +--~ elseif id == kern_code and current.subtype == kerning_code and start then +--~ -- ok +--~ elseif start then +--~ action() +--~ end +--~ current = current.next +--~ end +--~ if start then +--~ action() +--~ end +--~ return head, done +--~ end + +local function mark_words(head,whenfound) -- can be optimized and shared + local current, language, done = head, nil, nil, 0, false + local str, s, nds, n = { }, 0, { }, 0 -- n could also be a table, saves calls local function action() - if #str > 0 then - local f = whenfound(language,str) - if f then + if s > 0 then + local word = concat(str,"",1,s) + local mark = whenfound(language,word) + if mark then + done = true for i=1,n do - f(start) - start = start.next + mark(nds[i]) end end end - str, start, n = "", nil, 0 + n, s = 0, 0 end while current do local id = current.id - if id == glyph_node then + if id == glyph_code then local a = current.lang if a then if a ~= language then - if start then + if s > 0 then action() end language = a end - elseif start then + elseif s > 0 then action() language = a end local components = current.components if components then - start = start or current n = n + 1 + nds[n] = current for g in traverse_nodes(components) do - str = str .. utfchar(g.char) + s = s + 1 + str[s] = utfchar(g.char) end else local code = current.char - if chardata[code].uccode or chardata[code].lccode then - start = start or current + local data = chardata[code] + if is_letter[data.category] then n = n + 1 - str = str .. utfchar(code) - elseif start then + nds[n] = current + s = s + 1 + str[s] = utfchar(code) + elseif s > 0 then action() end end - elseif id == disc_node then + elseif id == disc_code then -- take the replace if n > 0 then n = n + 1 + nds[n] = current end - elseif id == kern_node and current.subtype == 0 and start then + elseif id == kern_code and current.subtype == kerning_code and s > 0 then -- ok - elseif start then + elseif s > 0 then action() end current = current.next end - if start then + if s > 0 then action() end - return head + return head, done end -words.methods = { } -words.method = 1 +local methods = { } +words.methods = methods -local methods = words.methods +local enablers = { } +words.enablers = enablers -methods[1] = function(head, attribute, yes, nop) - local right, wrong = false, false - if yes then right = function(n) set_attribute(n,attribute,yes) end end - if nop then wrong = function(n) set_attribute(n,attribute,nop) end end - for n in traverse_nodes(head) do - unset_attribute(n,attribute) -- hm, not that selective (reset color) +local wordmethod = 1 +local enabled = false + +function words.check(head) + if enabled then + return methods[wordmethod](head) + else + return head, false end - local found, done = words.found, false - mark_words(head, function(language,str) - if #str < words.threshold then - return false - elseif found(language,str) then - done = true - return right - else - done = true - return wrong - end - end) - return head, done end -local list, dump = { }, false -- todo: per language +function words.enable(settings) + local method = settings.method + wordmethod = method and tonumber(method) or wordmethod or 1 + local e = enablers[wordmethod] + if e then e(settings) end + tasks.enableaction("processors","languages.words.check") + enabled = true +end -local lower = characters.lower +function words.disable() + enabled = false +end + +-- colors + +local cache = { } -- can also be done with method 1 -- frozen colors once used -methods[2] = function(head, attribute) - dump = true - mark_words(head, function(language,str) - if #str >= words.threshold then - str = lower(str) - list[str] = (list[str] or 0) + 1 +setmetatable(cache, { + __index = function(t,k) -- k == language, numbers[k] == tag + local c + if type(k) == "string" then + c = colist[k] + elseif k < 0 then + c = colist["word:unset"] + else + c = colist["word:" .. (numbers[k] or "unset")] or colist["word:unknown"] end - end) - return head, true + local v = c and function(n) set_attribute(n,a_color,c) end or false + t[k] = v + return v + end +} ) + +-- method 1 + +local function sweep(language,str) + if #str < words.threshold then + return false + elseif words.found(language,str) then -- can become a local wordsfound + return cache["word:yes"] -- maybe variables.yes + else + return cache["word:no"] + end +end + +methods[1] = function(head) + for n in traverse_nodes(head) do + unset_attribute(n,a_color) -- hm, not that selective (reset color) + end + return mark_words(head,sweep) end -words.used = list +-- method 2 + +local dumpname = nil +local dumpthem = false +local listname = "document" + +local category = { } +local categories = { } + +setmetatable(categories, { + __index = function(t,k) + local languages = { } + setmetatable(languages, { + __index = function(t,k) + local r = registered[k] + local v = { + number = language, + parent = r and r.parent or nil, + patterns = r and r.patterns or nil, + tag = r and r.tag or nil, + list = { }, + total = 0, + unique = 0, + } + t[k] = v + return v + end + } ) + local v = { + languages = languages, + total = 0, + } + t[k] = v + return v + end +} ) + +local collected = { + total = 0, + version = 1.000, + categories = categories, +} + +enablers[2] = function(settings) + local name = settings.list + listname = name and name ~= "" and name or "document" + category = collected.categories[listname] +end -function words.dump_used_words(name) - if dump then - logs.report("languages","saving list of used words in '%s'",name) - io.savedata(name,table.serialize(list)) +local function sweep(language,str) + if #str >= words.threshold then + str = lowerchar(str) + local words = category.languages[numbers[language] or "unset"] + local list = words.list + local ls = list[str] + if ls then + list[str] = ls + 1 + else + list[str] = 1 + words.unique = words.unique + 1 + end + collected.total = collected.total + 1 + category.total = category.total + 1 + words.total = words.total + 1 end end -local color = attributes.private('color') +methods[2] = function(head) + dumpthem = true + return mark_words(head,sweep) +end -function words.check(head) - if words.enabled and head.next then - local colors = words.colors - local alc = attributes.list[color] - return methods[words.method](head, color, alc[colors.known], alc[colors.unknown]) - else - return head, false +local function dumpusedwords() + if dumpthem then + collected.threshold = words.threshold + dumpname = dumpname or file.addsuffix(tex.jobname,"words") + report_words("saving list of used words in '%s'",dumpname) + io.savedata(dumpname,table.serialize(collected,true)) + -- table.tofile(dumpname,list,true) end end -function words.enable(method) - tasks.enableaction("processors","languages.words.check") - words.method = method or words.method or 1 - words.enabled = true +directives.register("languages.words.dump", function(v) + dumpname = type(v) == "string" and v ~= "" and v +end) + +luatex.registerstopactions(dumpusedwords) + +-- method 3 + +local function sweep(language,str) + return cache[language] end -function words.disable() - words.enabled = false +methods[3] = function(head) + for n in traverse_nodes(head) do + unset_attribute(n,a_color) + end + return mark_words(head,sweep) end -- for the moment we hook it into the attribute handler diff --git a/Master/texmf-dist/tex/context/base/lang-wrd.mkiv b/Master/texmf-dist/tex/context/base/lang-wrd.mkiv index b6fc6a9d30f..22c234d0c6d 100644 --- a/Master/texmf-dist/tex/context/base/lang-wrd.mkiv +++ b/Master/texmf-dist/tex/context/base/lang-wrd.mkiv @@ -37,18 +37,36 @@ \unexpanded\def\setupspellchecking {\dosingleargument\dosetupspellchecking} +\newtoks\everysetupspellchecking + \unexpanded\def\setupspellchecking[#1]% todo colors {\getparameters[\??wl][#1]% + \the\everysetupspellchecking} + +\appendtoks \doifelse\@@wlstate\v!start - {\ctxlua{languages.words.enable(\@@wlmethod)}} - {\ctxlua{languages.words.disable()}}} + {\ctxlua{languages.words.enable { method = "\@@wlmethod", list = "\@@wllist" }}} + {\ctxlua{languages.words.disable()}}% +\to \everysetupspellchecking + +% beware, maybe some day we will honour grouping + +% 1: spell checking +% 2: word counting +% 3: language coloring \setupspellchecking [\c!state=\v!stop, - \c!method=1] + \c!method=1, + \c!list=] -\appendtoks - \ctxlua{languages.words.dump_used_words("\jobname.words")}% -\to \everybye +\definecolor[word:yes] [g=.75] +\definecolor[word:no] [r=.75] + +%definecolor[word:unset] [s=.75] +\definecolor[word:en] [b=.75] +\definecolor[word:de] [r=.75] +\definecolor[word:nl] [g=.75] +\definecolor[word:unknown][r=.75,g=.75] \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/layo-ini.lua b/Master/texmf-dist/tex/context/base/layo-ini.lua new file mode 100644 index 00000000000..56ced2c0bc8 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/layo-ini.lua @@ -0,0 +1,61 @@ +if not modules then modules = { } end modules ['layo-ini'] = { + version = 1.001, + comment = "companion to layo-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- We need to share information between the TeX and Lua end +-- about the typographical model. This happens here. +-- +-- Code might move. + +-- conditionals.layoutisdoublesided +-- conditionals.layoutissinglesided +-- texcount.pagenoshift +-- texcount.realpageno + +local texcount = tex.count +local conditionals = tex.conditionals + +layouts = { + status = { }, +} + +local status = layouts.status + +function status.leftorrightpagection(left,right) + if left == nil then + left, right = false, true + end + if not conditionals.layoutisdoublesided then + return left, right + elseif conditionals.layoutissinglesided then + return left, right + elseif texcount.pagenoshift % 2 == 0 then + if texcount.realpageno % 2 == 0 then + return right, left + else + return left, right + end + else + if texcount.realpageno % 2 == 0 then + return left, right + else + return right, left + end + end +end + +function status.isleftpage() + if not conditionals.layoutisdoublesided then + return false + elseif conditionals.layoutissinglesided then + return false + elseif texcount.pagenoshift % 2 == 0 then + return texcount.realpageno % 2 == 0 + else + return not texcount.realpageno % 2 == 0 + end +end diff --git a/Master/texmf-dist/tex/context/base/layo-ini.mkiv b/Master/texmf-dist/tex/context/base/layo-ini.mkiv new file mode 100644 index 00000000000..46361297851 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/layo-ini.mkiv @@ -0,0 +1,31 @@ +%D \module +%D [ file=layo-ini, +%D version=2011.02.18, +%D title=\CONTEXT\ Layout Macros, +%D subtitle=Initialization, +%D author=Hans Hagen, +%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. + +\writestatus{loading}{ConTeXt Layout Macros / Initialization} + +%D This module deals with the basic variables etc. for layout +%D and code from other modules will move here. This will make +%D the dependencies somewhat cleaner. + +\unprotect + +%D We need to check this in case a smaller format is loaded. + +\ifdefined\layoutisdoublesided \else \newconditional\layoutisdoublesided \fi +\ifdefined\layoutissinglesided \else \newconditional\layoutissinglesided \fi +\ifdefined\pagenoshift \else \newcount \pagenoshift \fi +\ifdefined\realpageno \else \newcount \realpageno \fi + +\registerctxluafile{layo-ini}{1.001} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lpdf-ano.lua b/Master/texmf-dist/tex/context/base/lpdf-ano.lua index e9e67e16319..9f452c34d12 100644 --- a/Master/texmf-dist/tex/context/base/lpdf-ano.lua +++ b/Master/texmf-dist/tex/context/base/lpdf-ano.lua @@ -6,43 +6,59 @@ if not modules then modules = { } end modules ['lpdf-ano'] = { license = "see context related readme files" } -local tostring, format, rep = tostring, string.rep, string.format +local next, tostring = next, tostring +local rep, format = string.rep, string.format local texcount = tex.count +local backends, lpdf = backends, lpdf + local trace_references = false trackers.register("references.references", function(v) trace_references = v end) local trace_destinations = false trackers.register("references.destinations", function(v) trace_destinations = v end) local trace_bookmarks = false trackers.register("references.bookmarks", function(v) trace_bookmarks = v end) +local report_reference = logs.reporter("backend","references") +local report_destination = logs.reporter("backend","destinations") +local report_bookmark = logs.reporter("backend","bookmarks") + local variables = interfaces.variables local constants = interfaces.constants -local nodeinjections = backends.pdf.nodeinjections -local codeinjections = backends.pdf.codeinjections -local registrations = backends.pdf.registrations - -jobreferences = jobreferences or { } -jobreferences.runners = jobreferences.runners or { } -jobreferences.specials = jobreferences.specials or { } -jobreferences.handlers = jobreferences.handlers or { } -jobreferences.executers = jobreferences.executers or { } - -local runners = jobreferences.runners -local specials = jobreferences.specials -local handlers = jobreferences.handlers -local executers = jobreferences.executers - -local pdfdictionary = lpdf.dictionary -local pdfarray = lpdf.array -local pdfreference = lpdf.reference -local pdfunicode = lpdf.unicode -local pdfconstant = lpdf.constant -local pdfflushobject = lpdf.flushobject -local pdfreserveobject = lpdf.reserveobject -local pdfannotation = nodes.pdfannotation -local pdfdestination = nodes.pdfdestination - -local pdfpagereference = tex.pdfpageref +local settings_to_array = utilities.parsers.settings_to_array + +local nodeinjections = backends.pdf.nodeinjections +local codeinjections = backends.pdf.codeinjections +local registrations = backends.pdf.registrations + +local javascriptcode = interactions.javascripts.code + +local references = structures.references +local bookmarks = structures.bookmarks + +local runners = references.runners +local specials = references.specials +local handlers = references.handlers +local executers = references.executers +local nodepool = nodes.pool + +local pdfannotation_node = nodepool.pdfannotation +local pdfdestination_node = nodepool.pdfdestination +local latelua_node = nodepool.latelua + +local pdfdictionary = lpdf.dictionary +local pdfarray = lpdf.array +local pdfreference = lpdf.reference +local pdfunicode = lpdf.unicode +local pdfconstant = lpdf.constant +local pdfflushobject = lpdf.flushobject +local pdfshareobjectreference = lpdf.shareobjectreference +local pdfimmediateobject = lpdf.immediateobject +local pdfreserveobject = lpdf.reserveobject +local pdfpagereference = lpdf.pagereference +local pdfdelayedobject = lpdf.delayedobject +local pdfregisterannotation = lpdf.registerannotation + +local pdf_annot = pdfconstant("Annot") local pdf_uri = pdfconstant("URI") local pdf_gotor = pdfconstant("GoToR") local pdf_goto = pdfconstant("GoTo") @@ -51,26 +67,35 @@ local pdf_javascript = pdfconstant("JavaScript") local pdf_link = pdfconstant("Link") local pdf_n = pdfconstant("N") local pdf_t = pdfconstant("T") +local pdf_fit = pdfconstant("Fit") +local pdf_named = pdfconstant("Named") + +-- todo: 3dview + local pdf_border = pdfarray { 0, 0, 0 } +local getinnermethod = references.getinnermethod + local cache = { } -local function pagedest(n) - local pd = cache[n] - if not pd then - local a = pdfarray { - pdfreference(pdfpagereference(n)), - pdfconstant("Fit") - } - pd = pdfreference(pdfflushobject(a)) - cache[n] = pd +local function pagedestination(n) -- only cache fit + if n > 0 then + local pd = cache[n] + if not pd then + local a = pdfarray { + pdfreference(pdfpagereference(n)), + pdf_fit, + } + pd = pdfshareobjectreference(a) + cache[n] = pd + end + return pd end - return pd end -lpdf.pagedest = pagedest +lpdf.pagedestination = pagedestination -local defaultdestination = pdfarray { 0, pdfconstant("Fit") } +local defaultdestination = pdfarray { 0, pdf_fit } local function link(url,filename,destination,page,actions) if filename and filename ~= "" then @@ -93,43 +118,36 @@ local function link(url,filename,destination,page,actions) URI = url, } elseif filename and filename ~= "" then + -- no page ? + if destination == "" then + destination = nil + end + if not destination and page then + destination = pdfarray { page - 1, pdf_fit } + end return pdfdictionary { S = pdf_gotor, -- can also be pdf_launch F = filename, - D = (destination and destination ~= "" and destination), -- or defaultdestination, + D = destination or defaultdestination, -- D is mandate NewWindow = (actions.newwindow and true) or nil, } elseif destination and destination ~= "" then - local realpage, p = texcount.realpageno, tonumber(page) - if not p then - -- sorry - elseif p > realpage then - texcount.referencepagestate = 3 - elseif p < realpage then - texcount.referencepagestate = 2 - else - texcount.referencepagestate = 1 - end - return pdfdictionary { + return pdfdictionary { -- can be cached S = pdf_goto, D = destination, } - elseif page and page ~= "" then - local realpage, p = texcount.realpageno, tonumber(page) - if p then - if p > realpage then - texcount.referencepagestate = 3 - elseif p < realpage then - texcount.referencepagestate = 2 - else - texcount.referencepagestate = 1 - end - return pdfdictionary { + else + local p = tonumber(page) + if p and p > 0 then + return pdfdictionary { -- can be cached S = pdf_goto, - D = pagedest(p), + D = pdfarray { + pdfreference(pdfpagereference(p)), + pdf_fit, + } } else - commands.writestatus("references","invalid page reference: %s",page or "?") + report_reference("invalid page reference: %s",tostring(page)) end end return false @@ -152,7 +170,7 @@ function lpdf.launch(program,parameters) end function lpdf.javascript(name,arguments) - local script = javascripts.code(name,arguments) -- make into object (hash) + local script = javascriptcode(name,arguments) -- make into object (hash) if script then return pdfdictionary { S = pdf_javascript, @@ -179,105 +197,158 @@ local function pdfaction(actions) what = what(a,actions) end if what then - action.next = what + action.Next = what action = what else -- error return nil end end - return first + return first, actions.n end end end -lpdf.pdfaction = pdfaction +lpdf.action = pdfaction -function codeinjections.prerollreference(actions) - local main = actions and pdfaction(actions) - if main then - main = pdfdictionary { - Subtype = pdf_link, - Border = pdf_border, - H = (not actions.highlight and pdf_n) or nil, - A = main, - -- does not work at all in spite of specification - -- OC = (actions.layer and lpdf.layerreferences[actions.layer]) or nil, - -- OC = backends.pdf.layerreference(actions.layer), - } - return main("A") -- todo: cache this, maybe weak +function codeinjections.prerollreference(actions) -- share can become option + if actions then + local main, n = pdfaction(actions) + if main then + main = pdfdictionary { + Subtype = pdf_link, + Border = pdf_border, + H = (not actions.highlight and pdf_n) or nil, + A = pdfshareobjectreference(main), + F = 4, -- print (mandate in pdf/a) + } + return main("A"), n + end + end +end + +local function use_normal_annotations() + + local function reference(width,height,depth,prerolled) -- keep this one + if prerolled then + if trace_references then + report_reference("w=%s, h=%s, d=%s, a=%s",width,height,depth,prerolled) + end + return pdfannotation_node(width,height,depth,prerolled) + end + end + + local function finishreference() end + + return reference, finishreference + end --- local cache = { } -- no real gain in thsi --- --- function codeinjections.prerollreference(actions) --- local main = actions and pdfaction(actions) --- if main then --- main = pdfdictionary { --- Subtype = pdf_link, --- Border = pdf_border, --- H = (not actions.highlight and pdf_n) or nil, --- A = main, --- } --- local cm = cache[main] --- if not cm then --- cm = "/A ".. tostring(pdfreference(pdfflushobject(main)) --- cache[main] = cm --- end --- return cm --- end --- end - -function nodeinjections.reference(width,height,depth,prerolled) - if prerolled then - if swapdir then - width = - width +-- evenrually we can do this for special refs only + +local hashed, nofunique, nofused = { }, 0, 0 + +local function use_shared_annotations() + + local factor = number.dimenfactors.bp + + local function finishreference(width,height,depth,prerolled) -- %0.2f looks okay enough (no scaling anyway) + local h, v = pdf.h, pdf.v + local llx, lly = h*factor, (v - depth)*factor + local urx, ury = (h + width)*factor, (v + height)*factor + local annot = format("<< /Type /Annot %s /Rect [%0.2f %0.2f %0.2f %0.2f] >>",prerolled,llx,lly,urx,ury) + local n = hashed[annot] + if not n then + n = pdfdelayedobject(annot) + hashed[annot] = n + nofunique = nofunique + 1 end - if trace_references then - logs.report("references","w=%s, h=%s, d=%s, a=%s",width,height,depth,prerolled) + nofused = nofused + 1 + pdfregisterannotation(n) + end + + _bpnf_ = finishreference + + local function reference(width,height,depth,prerolled) + if prerolled then + if trace_references then + report_reference("w=%s, h=%s, d=%s, a=%s",width,height,depth,prerolled) + end + local luacode = format("_bpnf_(%s,%s,%s,'%s')",width,height,depth,prerolled) + return latelua_node(luacode) end - return pdfannotation(width,height,depth,prerolled) end + + statistics.register("pdf annotations", function() + if nofused > 0 then + -- table.print(hashed,"hashed_annotations") + return string.format("%s embedded, %s unique",nofused,nofunique) + else + return nil + end + end) + + + return reference, finishreference + end +local lln = latelua_node() if node.has_field(lln,'string') then + + directives.register("refences.sharelinks", function(v) + if v then + nodeinjections.reference, codeinjections.finishreference = use_shared_annotations() + else + nodeinjections.reference, codeinjections.finishreference = use_normal_annotations() + end + end) + + nodeinjections.reference, codeinjections.finishreference = use_shared_annotations() + +else + + nodeinjections.reference, codeinjections.finishreference = use_normal_annotations() + +end node.free(lln) + +-- -- -- -- +-- -- -- -- + function nodeinjections.destination(width,height,depth,name,view) - if swapdir then - width = - width - end if trace_destinations then - logs.report("destinations","w=%s, h=%s, d=%s, n=%s, v=%s",width,height,depth,name,view or "no view") + report_destination("w=%s, h=%s, d=%s, n=%s, v=%s",width,height,depth,name,view or "no view") end - return pdfdestination(width,height,depth,name,view) + return pdfdestination_node(width,height,depth,name,view) end -- runners and specials -local method = "internal" - runners["inner"] = function(var,actions) - if method == "internal" then + if getinnermethod() == "names" then local vir = var.i.references local internal = vir and vir.internal if internal then - var.inner = "aut:"..internal + var.inner = "aut:" .. internal end + else + var.inner = nil end return link(nil,nil,var.inner,var.r,actions) end runners["inner with arguments"] = function(var,actions) - logs.report("references","todo: inner with arguments") + report_reference("todo: inner with arguments") return false end runners["outer"] = function(var,actions) - local file, url = jobreferences.checkedfileorurl(var.outer,var.outer) + local file, url = references.checkedfileorurl(var.outer,var.outer) return link(url,file,var.arguments,nil,actions) end runners["outer with inner"] = function(var,actions) - local file = jobreferences.checkedfile(var.f) + local file = references.checkedfile(var.f) return link(nil,file,var.inner,var.r,actions) end @@ -287,7 +358,7 @@ runners["special outer with operation"] = function(var,actions) end runners["special outer"] = function(var,actions) - logs.report("references","todo: special outer") + report_reference("todo: special outer") return false end @@ -297,22 +368,22 @@ runners["special"] = function(var,actions) end runners["outer with inner with arguments"] = function(var,actions) - logs.report("references","todo: outer with inner with arguments") + report_reference("todo: outer with inner with arguments") return false end runners["outer with special and operation and arguments"] = function(var,actions) - logs.report("references","todo: outer with special and operation and arguments") + report_reference("todo: outer with special and operation and arguments") return false end runners["outer with special"] = function(var,actions) - logs.report("references","todo: outer with special") + report_reference("todo: outer with special") return false end runners["outer with special and operation"] = function(var,actions) - logs.report("references","todo: outer with special and operation") + report_reference("todo: outer with special and operation") return false end @@ -321,10 +392,11 @@ runners["special operation with arguments"] = runners["special"] function specials.internal(var,actions) -- better resolve in strc-ref local i = tonumber(var.operation) - local v = jobreferences.internals[i] + local v = references.internals[i] if not v then -- error - elseif method == "internal" then + report_reference("no internal reference '%s'",var.operation) + elseif getinnermethod() == "names" then -- named return link(nil,nil,"aut:"..i,v.references.realpage,actions) else @@ -333,27 +405,60 @@ function specials.internal(var,actions) -- better resolve in strc-ref end end +-- realpage already resolved + specials.i = specials.internal -function specials.page(var,actions) -- better resolve in strc-ref +local pages = references.pages + +function specials.page(var,actions) local file = var.f if file then - file = jobreferences.checkedfile(file) - return link(nil,file,nil,p or var.operation,actions) + file = references.checkedfile(file) + return link(nil,file,nil,var.operation,actions) else - local p = jobreferences.pages[var.operation] - if type(p) == "function" then - p = p() + local p = var.r + if not p then -- todo: call special from reference code + p = pages[var.operation] + if type(p) == "function" then -- double + p = p() + else + p = tonumber(references.realpageofpage(tonumber(o))) + end end return link(nil,nil,nil,p or var.operation,actions) end end +function specials.realpage(var,actions) + local file = var.f + if file then + file = references.checkedfile(file) + return link(nil,file,nil,var.operation,actions) + else + return link(nil,nil,nil,var.operation,actions) + end +end + +function specials.userpage(var,actions) + local file = var.f + if file then + file = references.checkedfile(file) + return link(nil,file,nil,var.operation,actions) + else + local p = var.r + if not p then -- todo: call special from reference code + p = tonumber(references.realpageofpage(var.operation)) + end + return link(nil,nil,nil,p,actions) + end +end + -- todo, do this in references namespace ordered instead (this is an experiment) local splitter = lpeg.splitat(":") -function specials.order(var,actions) -- jobreferences.specials ! +function specials.order(var,actions) -- references.specials ! local operation = var.operation if operation then local kind, name, n = lpegmatch(splitter,operation) @@ -369,22 +474,22 @@ function specials.order(var,actions) -- jobreferences.specials ! end function specials.url(var,actions) - local url = jobreferences.checkedurl(var.operation) + local url = references.checkedurl(var.operation) return link(url,nil,var.arguments,nil,actions) end function specials.file(var,actions) - local file = jobreferences.checkedfile(var.operation) + local file = references.checkedfile(var.operation) return link(nil,file,var.arguments,nil,actions) end function specials.fileorurl(var,actions) - local file, url = jobreferences.checkedfileorurl(var.operation,var.operation) + local file, url = references.checkedfileorurl(var.operation,var.operation) return link(url,file,var.arguments,nil,actions) end function specials.program(var,content) - local program = jobreferences.checkedprogram(var.operation) + local program = references.checkedprogram(var.operation) return lpdf.launch(program,var.arguments) end @@ -394,8 +499,6 @@ end specials.JS = specials.javascript -local pdf_named = pdfconstant("Named") - executers.importform = pdfdictionary { S = pdf_named, N = pdfconstant("AcroForm:ImportFDF") } executers.exportform = pdfdictionary { S = pdf_named, N = pdfconstant("AcroForm:ExportFDF") } executers.first = pdfdictionary { S = pdf_named, N = pdfconstant("FirstPage") } @@ -426,7 +529,7 @@ local function fieldset(arguments) end function executers.resetform(arguments) - arguments = (type(arguments) == "table" and arguments) or aux.settings_to_array(arguments) + arguments = (type(arguments) == "table" and arguments) or settings_to_array(arguments) return pdfdictionary { S = pdfconstant("ResetForm"), Field = fieldset(arguments[1]) @@ -448,7 +551,7 @@ local flags = { } function executers.submitform(arguments) - arguments = (type(arguments) == "table" and arguments) or aux.settings_to_array(arguments) + arguments = (type(arguments) == "table" and arguments) or settings_to_array(arguments) local flag = flags[formmethod] or flags.post flag = (flag and (flag[formformat] or flag.xml)) or 32 -- default: post, xml return pdfdictionary { @@ -483,7 +586,7 @@ local pdf_resume = pdfconstant("Resume") local pdf_pause = pdfconstant("Pause") local function movie_or_sound(operation,arguments) - arguments = (type(arguments) == "table" and arguments) or aux.settings_to_array(arguments) + arguments = (type(arguments) == "table" and arguments) or settings_to_array(arguments) return pdfdictionary { S = pdf_movie, T = format("movie %s",arguments[1] or "noname"), @@ -522,13 +625,15 @@ local function build(levels,start,parent,method) local startlevel = levels[start][1] local i, n = start, 0 local child, entry, m, prev, first, last, f, l --- to be tested: i can be nil while i and i <= #levels do local li = levels[i] local level, title, reference, open = li[1], li[2], li[3], li[4] - if level == startlevel then + if level < startlevel then + pdfflushobject(child,entry) + return i, n, first, last + elseif level == startlevel then if trace_bookmarks then - logs.report("bookmark","%3i %s%s %s",reference.realpage,rep(" ",level-1),(open and "+") or "-",title) + report_bookmark("%3i %s%s %s",reference.realpage,rep(" ",level-1),(open and "+") or "-",title) end local prev = child child = pdfreserveobject() @@ -544,16 +649,13 @@ local function build(levels,start,parent,method) if method == "internal" then entry.Dest = "aut:" .. reference.internal else -- if method == "page" then - entry.Dest = pagedest(reference.realpage) + entry.Dest = pagedestination(reference.realpage) end if not first then first, last = child, child end prev = child last = prev n = n + 1 i = i + 1 - elseif level < startlevel then - pdfflushobject(child,entry) - return i, n, first, last elseif i < #levels and level > startlevel then i, m, f, l = build(levels,i,pdfreference(child),method) entry.Count = (open and m) or -m @@ -576,14 +678,21 @@ local function build(levels,start,parent,method) end function codeinjections.addbookmarks(levels,method) - local parent = pdfreserveobject() - local _, m, first, last = build(levels,1,pdfreference(parent),method or "internal") - local dict = pdfdictionary { - Type = pdfconstant("Outlines"), - First = pdfreference(first), - Last = pdfreference(last), - Count = m, - } - pdfflushobject(parent,dict) - lpdf.addtocatalog("Outlines",lpdf.reference(parent)) + if #levels > 0 then + structures.bookmarks.flatten(levels) -- dirty trick for lack of structure + local parent = pdfreserveobject() + local _, m, first, last = build(levels,1,pdfreference(parent),method or "internal") + local dict = pdfdictionary { + Type = pdfconstant("Outlines"), + First = pdfreference(first), + Last = pdfreference(last), + Count = m, + } + pdfflushobject(parent,dict) + lpdf.addtocatalog("Outlines",lpdf.reference(parent)) + end end + +-- this could also be hooked into the frontend finalizer + +lpdf.registerdocumentfinalizer(function() bookmarks.place() end,1,"bookmarks") diff --git a/Master/texmf-dist/tex/context/base/lpdf-col.lua b/Master/texmf-dist/tex/context/base/lpdf-col.lua index 18aa848ffea..dc40e555c2f 100644 --- a/Master/texmf-dist/tex/context/base/lpdf-col.lua +++ b/Master/texmf-dist/tex/context/base/lpdf-col.lua @@ -9,56 +9,73 @@ if not modules then modules = { } end modules ['lpdf-mis'] = { local type = type local format, gsub = string.format, string.gsub --- colors = colors or { } --- transparencies = transparencies or { } +local backends, lpdf = backends, lpdf -local registercolor = colors.register +local colors = attributes.colors +local transparencies = attributes.transparencies local registertransparancy = transparencies.register +local registercolor = colors.register local colorsvalue = colors.value local transparenciesvalue = transparencies.value +local forcedmodel = colors.forcedmodel -- Literals needed to inject code in the mp stream, we cannot use attributes there -- since literals may have qQ's, much may go away once we have mplib code in place. -- -- This module assumes that some functions are defined in the colors namespace --- which mostlikely will be loaded later. +-- which most likely will be loaded later. -function lpdf.color(model,ca,default) -- todo: use gray when no color - local cv = colorsvalue(ca) - if cv then - if model == 1 then - model = cv[1] - end - if model == 2 then - local s = cv[2] - return format("%s g %s G",s,s) - elseif model == 3 then - local r, g, b = cv[3], cv[4], cv[5] - return format("%s %s %s rg %s %s %s RG",r,g,b,r,g,b) - elseif model == 4 then - local c, m, y, k = cv[6],cv[7],cv[8],cv[9] - return format("%s %s %s %s k %s %s %s %s K",c,m,y,k,c,m,y,k) - else - local n,f,d,p = cv[10],cv[11],cv[12],cv[13] - if type(p) == "string" then - p = gsub(p,","," ") -- brr misuse of spot +local function lpdfcolor(model,ca,default) -- todo: use gray when no color + if colors.supported then + local cv = colorsvalue(ca) + if cv then + if model == 1 then + model = cv[1] + end + model = forcedmodel(model) + if model == 2 then + local s = cv[2] + return format("%s g %s G",s,s) + elseif model == 3 then + local r, g, b = cv[3], cv[4], cv[5] + return format("%s %s %s rg %s %s %s RG",r,g,b,r,g,b) + elseif model == 4 then + local c, m, y, k = cv[6],cv[7],cv[8],cv[9] + return format("%s %s %s %s k %s %s %s %s K",c,m,y,k,c,m,y,k) + else + local n,f,d,p = cv[10],cv[11],cv[12],cv[13] + if type(p) == "string" then + p = gsub(p,","," ") -- brr misuse of spot + end + return format("/%s cs /%s CS %s SCN %s scn",n,n,p,p) end - return format("/%s cs /%s CS %s SCN %s scn",n,n,p,p) + else + return format("%s g %s G",default or 0,default or 0) end else - return format("%s g %s G",default or 0,default or 0) + return "" end end +lpdf.color = lpdfcolor + +function lpdf.pdfcolor(attribute) -- bonus, for pgf and friends + context(lpdfcolor(1,attribute)) +end + function lpdf.transparency(ct,default) -- kind of overlaps with transparencycode -- beware, we need this hack because normally transparencies are not -- yet registered and therefore the number is not not known ... we -- might use the attribute number itself in the future - local ct = transparenciesvalue(ct) - if ct then - return format("/Tr%s gs",registertransparancy(nil,ct[1],ct[2],true)) + if transparencies.supported then + local ct = transparenciesvalue(ct) + if ct then + return format("/Tr%s gs",registertransparancy(nil,ct[1],ct[2],true)) + else + return "/Tr0 gs" + end else - return "/Tr0 gs" + return "" end end @@ -68,6 +85,7 @@ function lpdf.colorvalue(model,ca,default) if model == 1 then model = cv[1] end + model = forcedmodel(model) if model == 2 then return format("%s",cv[2]) elseif model == 3 then @@ -82,23 +100,54 @@ function lpdf.colorvalue(model,ca,default) end end -function lpdf.fdfcolor(model,ca,default) +--~ function lpdf.fdfcolor(model,ca,default) +--~ local cv = colorsvalue(ca) +--~ if cv then +--~ if model == 1 then +--~ model = cv[1] +--~ end +--~ model = forcedmodel(model) +--~ if model == 2 then +--~ return format("[%s]",cv[2]) +--~ elseif model == 3 then +--~ return format("[%s %s %s]",cv[3],cv[4],cv[5]) +--~ elseif model == 4 then +--~ return format("[%s %s %s %s]",cv[6],cv[7],cv[8],cv[9]) +--~ elseif model == 4 then +--~ return format("[%s]",cv[13]) +--~ end +--~ else +--~ return format("[%s]",default or 0) +--~ end +--~ end + +function lpdf.colorvalues(model,ca,default) local cv = colorsvalue(ca) if cv then if model == 1 then model = cv[1] end + model = forcedmodel(model) if model == 2 then - return format("[%s]",cv[2]) + return cv[2] elseif model == 3 then - return format("[%s %s %s]",cv[3],cv[4],cv[5]) + return cv[3], cv[4], cv[5] elseif model == 4 then - return format("[%s %s %s %s]",cv[6],cv[7],cv[8],cv[9]) + return cv[6], cv[7], cv[8], cv[9] elseif model == 4 then - return format("[%s]",cv[13]) + return cv[13] end else - return format("[%s]",default or 0) + return default or 0 + end +end + +function lpdf.transparencyvalue(ta,default) + local tv = transparenciesvalue(ta) + if tv then + return tv[2] + else + return default or 1 end end @@ -108,6 +157,7 @@ function lpdf.colorspace(model,ca) if model == 1 then model = cv[1] end + model = forcedmodel(model) if model == 2 then return "DeviceGray" elseif model == 3 then @@ -125,26 +175,64 @@ local intransparency = false local pdfcolor = lpdf.color function lpdf.rgbcode(model,r,g,b) - return pdfcolor(model,registercolor(nil,'rgb',r,g,b)) + if colors.supported then + return pdfcolor(model,registercolor(nil,'rgb',r,g,b)) + else + return "" + end end + function lpdf.cmykcode(model,c,m,y,k) - return pdfcolor(model,registercolor(nil,'cmyk',c,m,y,k)) + if colors.supported then + return pdfcolor(model,registercolor(nil,'cmyk',c,m,y,k)) + else + return "" + end end + function lpdf.graycode(model,s) - return pdfcolor(model,registercolor(nil,'gray',s)) + if colors.supported then + return pdfcolor(model,registercolor(nil,'gray',s)) + else + return "" + end end + function lpdf.spotcode(model,n,f,d,p) - return pdfcolor(model,registercolor(nil,'spot',n,f,d,p)) -- incorrect + if colors.supported then + return pdfcolor(model,registercolor(nil,'spot',n,f,d,p)) -- incorrect + else + return "" + end end + function lpdf.transparencycode(a,t) - intransparency = true - return format("/Tr%s gs",registertransparancy(nil,a,t,true)) -- true forces resource + if transparencies.supported then + intransparency = true + return format("/Tr%s gs",registertransparancy(nil,a,t,true)) -- true forces resource + else + return "" + end end function lpdf.finishtransparencycode() - if intransparency then + if transparencies.supported and intransparency then intransparency = false return "/Tr0 gs" -- we happen to know this -) else return "" end end + +-- this will move to lpdf-spe.lua + +backends.pdf.tables.vfspecials = { -- todo: distinguish between glyph and rule color + + red = { "special", 'pdf: 1 0 0 rg 1 0 0 RG' }, + green = { "special", 'pdf: 0 1 0 rg 0 1 0 RG' }, + blue = { "special", 'pdf: 0 0 1 rg 0 0 1 RG' }, + black = { "special", 'pdf: 0 g 0 G' }, + + startslant = function(a) return { "special", format("pdf: q 1 0 %s 1 0 0 cm",a) } end, + stopslant = { "special", "pdf: Q" }, + +} diff --git a/Master/texmf-dist/tex/context/base/lpdf-enc.lua b/Master/texmf-dist/tex/context/base/lpdf-enc.lua new file mode 100644 index 00000000000..090fb15cd5d --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lpdf-enc.lua @@ -0,0 +1,157 @@ +if not modules then modules = { } end modules ['lpdf-enc'] = { + version = 1.001, + comment = "companion to lpdf-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- delayed loading + +local pdfconstant = lpdf.constant + +return lpdf.dictionary { + Type = pdfconstant("Encoding"), + Differences = lpdf.array { + 24, + pdfconstant("breve"), + pdfconstant("caron"), + pdfconstant("circumflex"), + pdfconstant("dotaccent"), + pdfconstant("hungarumlaut"), + pdfconstant("ogonek"), + pdfconstant("ring"), + pdfconstant("tilde"), + 39, + pdfconstant("quotesingle"), + 96, + pdfconstant("grave"), + 128, + pdfconstant("bullet"), + pdfconstant("dagger"), + pdfconstant("daggerdbl"), + pdfconstant("ellipsis"), + pdfconstant("emdash"), + pdfconstant("endash"), + pdfconstant("florin"), + pdfconstant("fraction"), + pdfconstant("guilsinglleft"), + pdfconstant("guilsinglright"), + pdfconstant("minus"), + pdfconstant("perthousand"), + pdfconstant("quotedblbase"), + pdfconstant("quotedblleft"), + pdfconstant("quotedblright"), + pdfconstant("quoteleft"), + pdfconstant("quoteright"), + pdfconstant("quotesinglbase"), + pdfconstant("trademark"), + pdfconstant("fi"), + pdfconstant("fl"), + pdfconstant("Lslash"), + pdfconstant("OE"), + pdfconstant("Scaron"), + pdfconstant("Ydieresis"), + pdfconstant("Zcaron"), + pdfconstant("dotlessi"), + pdfconstant("lslash"), + pdfconstant("oe"), + pdfconstant("scaron"), + pdfconstant("zcaron"), + 160, + pdfconstant("Euro"), + 164, + pdfconstant("currency"), + 166, + pdfconstant("brokenbar"), + 168, + pdfconstant("dieresis"), + pdfconstant("copyright"), + pdfconstant("ordfeminine"), + 172, + pdfconstant("logicalnot"), + pdfconstant(".notdef"), + pdfconstant("registered"), + pdfconstant("macron"), + pdfconstant("degree"), + pdfconstant("plusminus"), + pdfconstant("twosuperior"), + pdfconstant("threesuperior"), + pdfconstant("acute"), + pdfconstant("mu"), + 183, + pdfconstant("periodcentered"), + pdfconstant("cedilla"), + pdfconstant("onesuperior"), + pdfconstant("ordmasculine"), + 188, + pdfconstant("onequarter"), + pdfconstant("onehalf"), + pdfconstant("threequarters"), + 192, + pdfconstant("Agrave"), + pdfconstant("Aacute"), + pdfconstant("Acircumflex"), + pdfconstant("Atilde"), + pdfconstant("Adieresis"), + pdfconstant("Aring"), + pdfconstant("AE"), + pdfconstant("Ccedilla"), + pdfconstant("Egrave"), + pdfconstant("Eacute"), + pdfconstant("Ecircumflex"), + pdfconstant("Edieresis"), + pdfconstant("Igrave"), + pdfconstant("Iacute"), + pdfconstant("Icircumflex"), + pdfconstant("Idieresis"), + pdfconstant("Eth"), + pdfconstant("Ntilde"), + pdfconstant("Ograve"), + pdfconstant("Oacute"), + pdfconstant("Ocircumflex"), + pdfconstant("Otilde"), + pdfconstant("Odieresis"), + pdfconstant("multiply"), + pdfconstant("Oslash"), + pdfconstant("Ugrave"), + pdfconstant("Uacute"), + pdfconstant("Ucircumflex"), + pdfconstant("Udieresis"), + pdfconstant("Yacute"), + pdfconstant("Thorn"), + pdfconstant("germandbls"), + pdfconstant("agrave"), + pdfconstant("aacute"), + pdfconstant("acircumflex"), + pdfconstant("atilde"), + pdfconstant("adieresis"), + pdfconstant("aring"), + pdfconstant("ae"), + pdfconstant("ccedilla"), + pdfconstant("egrave"), + pdfconstant("eacute"), + pdfconstant("ecircumflex"), + pdfconstant("edieresis"), + pdfconstant("igrave"), + pdfconstant("iacute"), + pdfconstant("icircumflex"), + pdfconstant("idieresis"), + pdfconstant("eth"), + pdfconstant("ntilde"), + pdfconstant("ograve"), + pdfconstant("oacute"), + pdfconstant("ocircumflex"), + pdfconstant("otilde"), + pdfconstant("odieresis"), + pdfconstant("divide"), + pdfconstant("oslash"), + pdfconstant("ugrave"), + pdfconstant("uacute"), + pdfconstant("ucircumflex"), + pdfconstant("udieresis"), + pdfconstant("yacute"), + pdfconstant("thorn"), + pdfconstant("ydieresis"), + }, +} diff --git a/Master/texmf-dist/tex/context/base/lpdf-epa.lua b/Master/texmf-dist/tex/context/base/lpdf-epa.lua new file mode 100644 index 00000000000..17c55eb0c90 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lpdf-epa.lua @@ -0,0 +1,193 @@ +if not modules then modules = { } end modules ['lpdf-epa'] = { + version = 1.001, + comment = "companion to lpdf-epa.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- This is a rather experimental feature and the code will probably +-- change. + +local type, tonumber = type, tonumber +local format = string.format + +local trace_links = false trackers.register("figures.links", function(v) trace_links = v end) + +local report_link = logs.reporter("backend","merging") + +local backends, lpdf = backends, lpdf + +local variables = interfaces.variables +local codeinjections = backends.pdf.codeinjections + +local layerspec = { -- predefining saves time + "epdflinks" +} + +local function makenamespace(filename) + return format("lpdf-epa-%s-",file.removesuffix(file.basename(filename))) +end + +local function add_link(x,y,w,h,destination,what) + if trace_links then + report_link("dx: % 4i, dy: % 4i, wd: % 4i, ht: % 4i, destination: %s, type: %s",x,y,w,h,destination,what) + end + local locationspec = { -- predefining saves time + x = x .. "bp", + y = y .. "bp", + preset = "leftbottom", + } + local buttonspec = { + width = w .. "bp", + height = h .. "bp", + offset = variables.overlay, + frame = trace_links and variables.on or variables.off, + } + context.setlayer ( + layerspec, + locationspec, + function() context.button ( buttonspec, "", { destination } ) end + -- context.nested.button(buttonspec, "", { destination }) -- time this + ) +end + +local function link_goto(x,y,w,h,document,annotation,pagedata,namespace) + local destination = annotation.A.D -- [ 18 0 R /Fit ] + local what = "page" + if type(destination) == "string" then + local destinations = document.destinations + local wanted = destinations[destination] + destination = wanted and wanted.D + if destination then what = "named" end + end + local pagedata = destination and destination[1] + if pagedata then + local destinationpage = pagedata.number + if destinationpage then + add_link(x,y,w,h,namespace .. destinationpage,what) + end + end +end + +local function link_uri(x,y,w,h,document,annotation) + local url = annotation.A.URI + if url then + add_link(x,y,w,h,format("url(%s)",url),"url") + end +end + +local function link_file(x,y,w,h,document,annotation) + local filename = annotation.A.F + if filename then + local destination = annotation.A.D + if not destination then + add_link(x,y,w,h,format("file(%s)",filename),"file") + elseif type(destination) == "string" then + add_link(x,y,w,h,format("%s::%s",filename,destination),"file (named)") + else + destination = destination[1] -- array + if tonumber(destination) then + add_link(x,y,w,h,format("%s::page(%s)",filename,destination),"file (page)") + else + add_link(x,y,w,h,format("file(%s)",filename),"file") + end + end + end +end + +function codeinjections.mergereferences(specification) + if figures and not specification then + specification = figures and figures.current() + specification = specification and specification.status + end + if specification then + local fullname = specification.fullname + local document = lpdf.epdf.load(fullname) + if document then + local pagenumber = specification.page or 1 + local xscale = specification.yscale or 1 + local yscale = specification.yscale or 1 + local size = specification.size or "crop" -- todo + local pagedata = document.pages[pagenumber] + local annotations = pagedata.Annots + local namespace = format("lpdf-epa-%s-",file.removesuffix(file.basename(fullname))) + local reference = namespace .. pagenumber + if annotations.n > 0 then + local mediabox = pagedata.MediaBox + local llx, lly, urx, ury = mediabox[1], mediabox[2], mediabox[3], mediabox[4] + local width, height = xscale * (urx - llx), yscale * (ury - lly) -- \\overlaywidth, \\overlayheight + context.definelayer( { "epdflinks" }, { height = height.."bp" , width = width.."bp" }) + for i=1,annotations.n do + local annotation = annotations[i] + local subtype = annotation.Subtype + local rectangle = annotation.Rect + local a_llx, a_lly, a_urx, a_ury = rectangle[1], rectangle[2], rectangle[3], rectangle[4] + local x, y = xscale * (a_llx - llx), yscale * (a_lly - lly) + local w, h = xscale * (a_urx - a_llx), yscale * (a_ury - a_lly) + if subtype == "Link" then + local linktype = annotation.A.S + if linktype == "GoTo" then + link_goto(x,y,w,h,document,annotation,pagedata,namespace) + elseif linktype == "GoToR" then + link_file(x,y,w,h,document,annotation) + elseif linktype == "URI" then + link_uri(x,y,w,h,document,annotation) + elseif trace_links then + report_link("unsupported link annotation '%s'",linktype) + end + elseif trace_links then + report_link("unsupported annotation '%s'",subtype) + end + end + context.flushlayer { "epdflinks" } + -- context("\\gdef\\figurereference{%s}",reference) -- global + context.setgvalue("figurereference",reference) -- global + if trace_links then + report_link("setting figure reference to '%s'",reference) + end + specification.reference = reference + return namespace + end + end + end + return ""-- no namespace, empty, not nil +end + +function codeinjections.mergeviewerlayers(specification) + -- todo: parse included page for layers + if true then + return + end + if not specification then + specification = figures and figures.current() + specification = specification and specification.status + end + if specification then + local fullname = specification.fullname + local document = lpdf.epdf.load(fullname) + if document then + local namespace = format("lpdf:epa:%s:",file.removesuffix(file.basename(fullname))) + local layers = document.layers + if layers then + for i=1,layers.n do + local tag = layers[i] +tag = namespace .. string.gsub(tag," ",":") +local title = tag +if trace_links then + report_link("using layer '%s'",tag) +end + attributes.viewerlayers.define { -- also does some cleaning + tag = tag, -- todo: #3A or so + title = title, + visible = variables.start, + editable = variables.yes, + printable = variables.yes, + } + codeinjections.useviewerlayer(tag) + end + end + end + end +end + diff --git a/Master/texmf-dist/tex/context/base/lpdf-epd.lua b/Master/texmf-dist/tex/context/base/lpdf-epd.lua new file mode 100644 index 00000000000..19c1f9bd8d9 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lpdf-epd.lua @@ -0,0 +1,308 @@ +if not modules then modules = { } end modules ['lpdf-epd'] = { + version = 1.001, + comment = "companion to lpdf-epa.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- This is an experimental layer around the epdf library. The reason for +-- this layer is that I want to be independent of the library (which +-- implements a selection of what a file provides) and also because I +-- want an interface closer to Lua's table model while the API stays +-- close to the original xpdf library. Of course, after prototyping a +-- solution, we can optimize it using the low level epdf accessors. + +-- It will be handy when we have a __length and __next that can trigger +-- the resolve till then we will provide .n as #. + +-- As there can be references to the parent we cannot expand a tree. I +-- played with some expansion variants but it does to pay off. + +-- Maybe we need a close(). +-- We cannot access all destinations in one run. + +local setmetatable, rawset, rawget, tostring, tonumber = setmetatable, rawset, rawget, tostring, tonumber +local lower, match, char = string.lower, string.match, string.char +local concat = table.concat + +function epdf.type(o) + local t = lower(match(tostring(o),"[^ :]+")) + return t or "?" +end + +lpdf = lpdf or { } +local lpdf = lpdf + +lpdf.epdf = { } + +local checked_access + +local function prepare(document,d,t,n,k) + for i=1,n do + local v = d:getVal(i) + local r = d:getValNF(i) + if r:getTypeName() ~= "ref" then + t[d:getKey(i)] = checked_access[v:getTypeName()](v,document) + else + r = r:getRef().num + local c = document.cache[r] + if c then + -- + else + c = checked_access[v:getTypeName()](v,document,r) + document.cache[r] = c + document.xrefs[c] = r + end + t[d:getKey(i)] = c + end + end + getmetatable(t).__index = nil + return t[k] +end + +local function some_dictionary(d,document,r) + local n = d and d:getLength() or 0 + if n > 0 then + local t = { } + setmetatable(t, { __index = function(t,k) return prepare(document,d,t,n,k) end } ) + return t + end +end + +local done = { } + +local function prepare(document,a,t,n,k) + for i=1,n do + local v = a:get(i) + local r = a:getNF(i) + if r:getTypeName() ~= "ref" then + t[i] = checked_access[v:getTypeName()](v,document) + else + r = r:getRef().num + local c = document.cache[r] + if c then + -- + else + c = checked_access[v:getTypeName()](v,document,r) + document.cache[r] = c + document.xrefs[c] = r + end + t[i] = c + end + end + getmetatable(t).__index = nil + return t[k] +end + +local function some_array(a,document,r) + local n = a and a:getLength() or 0 + if n > 0 then + local t = { n = n } + setmetatable(t, { __index = function(t,k) return prepare(document,a,t,n,k) end } ) + return t + end +end + +local function streamaccess(s,_,what) + if not what or what == "all" or what == "*all" then + local t, n = { }, 0 + s:streamReset() + while true do + local c = s:streamGetChar() + if c < 0 then + break + else + n = n + 1 + t[n] = char(c) + end + end + return concat(t) + end +end + +local function some_stream(d,document,r) + if d then + d:streamReset() + local s = some_dictionary(d:streamGetDict(),document,r) + getmetatable(s).__call = function(...) return streamaccess(d,...) end + return s + end +end + +-- we need epdf.getBool + +checked_access = { + dictionary = function(d,document,r) + return some_dictionary(d:getDict(),document,r) + end, + array = function(a,document,r) + return some_array(a:getArray(),document,r) + end, + stream = function(v,document,r) + return some_stream(v,document,r) + end, + real = function(v) + return v:getReal() + end, + integer = function(v) + return v:getNum() + end, + string = function(v) + return v:getString() + end, + boolean = function(v) + return v:getBool() + end, + name = function(v) + return v:getName() + end, + ref = function(v) + return v:getRef() + end, +} + +--~ checked_access.real = epdf.real +--~ checked_access.integer = epdf.integer +--~ checked_access.string = epdf.string +--~ checked_access.boolean = epdf.boolean +--~ checked_access.name = epdf.name +--~ checked_access.ref = epdf.ref + +local function getnames(document,n,target) -- direct + if n then + local Names = n.Names + if Names then + if not target then + target = { } + end + for i=1,Names.n,2 do + target[Names[i]] = Names[i+1] + end + else + local Kids = n.Kids + if Kids then + for i=1,Kids.n do + target = getnames(document,Kids[i],target) + end + end + end + return target + end +end + +local function getkids(document,n,target) -- direct + if n then + local Kids = n.Kids + if Kids then + for i=1,Kids.n do + target = getkids(document,Kids[i],target) + end + elseif target then + target[#target+1] = n + else + target = { n } + end + return target + end +end + +-- /OCProperties << +-- /OCGs [ 15 0 R 17 0 R 19 0 R 21 0 R 23 0 R 25 0 R 27 0 R ] +-- /D << +-- /Order [ 15 0 R 17 0 R 19 0 R 21 0 R 23 0 R 25 0 R 27 0 R ] +-- /ON [ 15 0 R 17 0 R 19 0 R 21 0 R 23 0 R 25 0 R 27 0 R ] +-- /OFF [ ] +-- >> +-- >> + +local function getlayers(document) + local properties = document.Catalog.OCProperties + if properties then + local layers = properties.OCGs + if layers then + local t = { } + local n = layers.n + for i=1,n do + local layer = layers[i] +--~ print(document.xrefs[layer]) + t[i] = layer.Name + end + t.n = n + return t + end + end +end + +local function getpages(document) + local data = document.data + local xrefs = document.xrefs + local cache = document.cache + local cata = data:getCatalog() + local xref = data:getXRef() + local pages = { } + for pagenumber=1,cata:getNumPages() do + local pagereference = cata:getPageRef(pagenumber).num + local pagedata = some_dictionary(xref:fetch(pagereference,0):getDict(),document,pagereference) + pagedata.number = pagenumber + pages[pagenumber] = pagedata + xrefs[pagedata] = pagereference + cache[pagereference] = pagedata + end + return pages +end + +-- loader + +local function delayed(document,tag,f) + local t = { } + setmetatable(t, { __index = function(t,k) + local result = f() + if result then + document[tag] = result + return result[k] + end + end } ) + return t +end + +local loaded = { } + +function lpdf.epdf.load(filename) + local document = loaded[filename] + if not document then + statistics.starttiming(lpdf.epdf) + local data = epdf.open(filename) -- maybe resolvers.find_file + if data then + document = { + filename = filename, + cache = { }, + xrefs = { }, + data = data, + } + local Catalog = some_dictionary(data:getXRef():getCatalog():getDict(),document) + document.Catalog = Catalog + -- document.catalog = Catalog + -- a few handy helper tables + document.pages = delayed(document,"pages", function() return getpages(document) end) + document.destinations = delayed(document,"destinations", function() return getnames(document,Catalog.Names.Dests) end) + document.javascripts = delayed(document,"javascripts", function() return getnames(document,Catalog.Names.JS) end) + document.widgets = delayed(document,"widgets", function() return getnames(document,Catalog.Names.AcroForm) end) + document.embeddedfiles = delayed(document,"embeddedfiles",function() return getnames(document,Catalog.Names.EmbeddedFiles) end) + document.layers = delayed(document,"layers", function() return getlayers(document) end) + else + document = false + end + loaded[filename] = document + statistics.stoptiming(lpdf.epdf) + -- print(statistics.elapsedtime(lpdf.epdf)) + end + return document +end + +-- helpers + +-- function lpdf.epdf.getdestinationpage(document,name) +-- local destination = document.data:findDest(name) +-- return destination and destination.number +-- end diff --git a/Master/texmf-dist/tex/context/base/lpdf-fld.lua b/Master/texmf-dist/tex/context/base/lpdf-fld.lua index c034aec6c91..590aee1abe5 100644 --- a/Master/texmf-dist/tex/context/base/lpdf-fld.lua +++ b/Master/texmf-dist/tex/context/base/lpdf-fld.lua @@ -6,38 +6,78 @@ if not modules then modules = { } end modules ['lpdf-fld'] = { license = "see context related readme files" } --- cleaned up, e.g. no longer older viewers --- always kids so no longer explicit main / clone / copy --- some optimizations removed (will come bakc if needed) +-- The problem with widgets is that so far each version of acrobat +-- has some rendering problem. I tried to keep up with this but +-- it makes no sense to do so as one cannot rely on the viewer +-- not changing. Especially Btn fields are tricky as their appearences +-- need to be synchronized in the case of children but e.g. acrobat +-- 10 does not retain the state and forces a check symbol. If you +-- make a file in acrobat then it has MK entries that seem to overload +-- the already present appearance streams (they're probably only meant for +-- printing) as it looks like the viewer has some fallback on (auto +-- generated) MK behaviour built in. So ... hard to test. Unfortunately +-- not even the default appearance is generated. This will probably be +-- solved at some point. local gmatch, lower, format = string.gmatch, string.lower, string.format local lpegmatch = lpeg.match +local utfchar = utf.char +local bpfactor, todimen = number.dimenfactors.bp, string.todimen -local trace_fields = false trackers.register("widgets.fields", function(v) trace_fields = v end) +local trace_fields = false trackers.register("backends.fields", function(v) trace_fields = v end) -local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes +local report_fields = logs.reporter("backend","fields") -local variables = interfaces.variables +local backends, lpdf = backends, lpdf -local nodeinjections = backends.pdf.nodeinjections -local codeinjections = backends.pdf.codeinjections -local registrations = backends.pdf.registrations +local variables = interfaces.variables +local context = context -local registeredsymbol = codeinjections.registeredsymbol +local references = structures.references +local settings_to_array = utilities.parsers.settings_to_array -local pdfstream = lpdf.stream -local pdfdictionary = lpdf.dictionary -local pdfarray = lpdf.array -local pdfreference = lpdf.reference -local pdfunicode = lpdf.unicode -local pdfstring = lpdf.string -local pdfconstant = lpdf.constant -local pdftoeight = lpdf.toeight -local pdfflushobject = lpdf.flushobject -local pdfreserveobject = lpdf.reserveobject -local pdfannotation = nodes.pdfannotation +local pdfbackend = backends.pdf -local submitoutputformat = 0 -- 0=unknown 1=HTML 2=FDF 3=XML => not yet used, needs to be checked +local nodeinjections = pdfbackend.nodeinjections +local codeinjections = pdfbackend.codeinjections +local registrations = pdfbackend.registrations + +local registeredsymbol = codeinjections.registeredsymbol + +local pdfstream = lpdf.stream +local pdfdictionary = lpdf.dictionary +local pdfarray = lpdf.array +local pdfreference = lpdf.reference +local pdfunicode = lpdf.unicode +local pdfstring = lpdf.string +local pdfconstant = lpdf.constant +local pdftoeight = lpdf.toeight +local pdfflushobject = lpdf.flushobject +local pdfimmediateobject = lpdf.immediateobject +local pdfshareobjectreference = lpdf.shareobjectreference +local pdfshareobject = lpdf.shareobject +local pdfreserveobject = lpdf.reserveobject +local pdfreserveannotation = lpdf.reserveannotation +local pdfaction = lpdf.action + +local hpack_node = node.hpack + +local nodepool = nodes.pool + +local pdfannotation_node = nodepool.pdfannotation + +local submitoutputformat = 0 -- 0=unknown 1=HTML 2=FDF 3=XML => not yet used, needs to be checked + +local pdf_widget = pdfconstant("Widget") +local pdf_tx = pdfconstant("Tx") +local pdf_ch = pdfconstant("Ch") +local pdf_btn = pdfconstant("Btn") +local pdf_yes = pdfconstant("Yes") +local pdf_off = pdfconstant("Off") +local pdf_p = pdfconstant("P") -- None Invert Outline Push +local pdf_n = pdfconstant("N") -- None Invert Outline Push +-- +local pdf_no_rect = pdfarray { 0, 0, 0, 0 } local splitter = lpeg.splitat("=>") @@ -46,7 +86,7 @@ local formats = { } function codeinjections.setformsmethod(name) - submitoutputformat = formats[lower(name)] or 3 + submitoutputformat = formats[lower(name)] or formats.xml end local flag = { @@ -94,7 +134,7 @@ plus.auto = plus.AutoView -- some day .. lpeg with function or table local function fieldflag(specification) - local o, n = specification.options, 0 + local o, n = specification.option, 0 if o and o ~= "" then for f in gmatch(o,"[^, ]+") do n = n + (flag[f] or 0) @@ -104,7 +144,7 @@ local function fieldflag(specification) end local function fieldplus(specification) - local o, n = specification.options, 0 + local o, n = specification.option, 0 if o and o ~= "" then for p in gmatch(o,"[^, ]+") do n = n + (plus[p] or 0) @@ -113,29 +153,30 @@ local function fieldplus(specification) return n end - local function checked(what) - if what and what ~= "" then - local set, bug = jobreferences.identify("",what) - return not bug and #set > 0 and lpdf.pdfaction(set) + local set, bug = references.identify("",what) + if not bug and #set > 0 then + local r, n = pdfaction(set) + return pdfshareobjectreference(r) end end local function fieldactions(specification) -- share actions ---~ print(table.serialize(specification)) local d, a = { }, nil - a = specification.mousedown if a and a ~= "" then d.D = checked(a) end - a = specification.mouseup if a and a ~= "" then d.U = checked(a) end + a = specification.mousedown + or specification.clickin if a and a ~= "" then d.D = checked(a) end + a = specification.mouseup + or specification.clickout if a and a ~= "" then d.U = checked(a) end a = specification.regionin if a and a ~= "" then d.E = checked(a) end -- Enter a = specification.regionout if a and a ~= "" then d.X = checked(a) end -- eXit - a = specification.afterkeystroke if a and a ~= "" then d.K = checked(a) end - a = specification.formatresult if a and a ~= "" then d.F = checked(a) end - a = specification.validateresult if a and a ~= "" then d.V = checked(a) end - a = specification.calculatewhatever if a and a ~= "" then d.C = checked(a) end + a = specification.afterkey if a and a ~= "" then d.K = checked(a) end + a = specification.format if a and a ~= "" then d.F = checked(a) end + a = specification.validate if a and a ~= "" then d.V = checked(a) end + a = specification.calculate if a and a ~= "" then d.C = checked(a) end a = specification.focusin if a and a ~= "" then d.Fo = checked(a) end a = specification.focusout if a and a ~= "" then d.Bl = checked(a) end - -- a = specification.openpage if a and a ~= "" then d.PO = checked(a) end - -- a = specification.closepage if a and a ~= "" then d.PC = checked(a) end + a = specification.openpage if a and a ~= "" then d.PO = checked(a) end + a = specification.closepage if a and a ~= "" then d.PC = checked(a) end -- a = specification.visiblepage if a and a ~= "" then d.PV = checked(a) end -- a = specification.invisiblepage if a and a ~= "" then d.PI = checked(a) end return next(d) and pdfdictionary(d) @@ -143,6 +184,26 @@ end -- fonts and color +local pdfdocencodingvector, pdfdocencodingcapsule + +-- The pdf doc encoding vector is needed in order to +-- trigger propper unicode. Interesting is that when +-- a glyph is not in the vector, it is still visible +-- as it is taken from some other font. Messy. + +-- To be checked: only when text/line fields. + +local function checkpdfdocencoding() + report_fields("adding pdfdoc encoding vector") + local encoding = dofile(resolvers.findfile("lpdf-enc.lua")) -- no checking, fatal if not present + pdfdocencodingvector = pdfreference(pdfflushobject(encoding)) + local capsule = pdfdictionary { + PDFDocEncoding = pdfdocencodingvector + } + pdfdocencodingcapsule = pdfreference(pdfflushobject(capsule)) + checkpdfdocencoding = function() end +end + local fontnames = { rm = { tf = "Times-Roman", @@ -167,44 +228,59 @@ local fontnames = { sl = "Courier-Oblique", bi = "Courier-BoldOblique", bs = "Courier-BoldOblique", + }, + symbol = { + dingbats = "ZapfDingbats", } } local usedfonts = { } local function fieldsurrounding(specification) - local size = specification.fontsize or "12pt" - local style = specification.fontstyle or "rm" - local alternative = specification.fontalternative or "tf" - local s = fontnames[style] + local fontsize = specification.fontsize or "12pt" + local fontstyle = specification.fontstyle or "rm" + local fontalternative = specification.fontalternative or "tf" + local colorvalue = specification.colorvalue + local s = fontnames[fontstyle] if not s then - style, s = "rm", fontnames.rm + fontstyle, s = "rm", fontnames.rm end - local a = s[alternative] + local a = s[fontalternative] if not a then alternative, a = "tf", s.tf end - local tag = style .. alternative - size = string.todimen(size) + local tag = fontstyle .. fontalternative + fontsize = todimen(fontsize) + fontsize = fontsize and (bpfactor * fontsize) or 12 + fontraise = 0.1 * fontsize -- todo: figure out what the natural one is and compensate for strutdp + local fontcode = format("%0.4f Tf %0.4f Ts",fontsize,fontraise) + -- we could test for colorvalue being 1 (black) and omit it then + local colorcode = lpdf.color(3,colorvalue) -- we force an rgb color space + if trace_fields then + report_fields("fontcode : %s %s @ %s => %s => %s",fontstyle,fontalternative,fontsize,tag,fontcode) + report_fields("colorcode: %s => %s",colorvalue,colorcode) + end local stream = pdfstream { pdfconstant(tag), - format("%0.4f Tf",(size and (number.dimenfactors.bp * size)) or 12), + format("%s %s",fontcode,colorcode) } usedfonts[tag] = a -- the name - -- add color to stream: 0 g -- move up with "x.y Ts" return tostring(stream) end local function registerfonts() if next(usedfonts) then + checkpdfdocencoding() -- already done local d = pdfdictionary() + local pdffonttype, pdffontsubtype = pdfconstant("Font"), pdfconstant("Type1") for tag, name in next, usedfonts do local f = pdfdictionary { - Type = pdfconstant("Font"), - Subtype = pdfconstant("Type1"), -- todo + Type = pdffonttype, + Subtype = pdffontsubtype, Name = pdfconstant(tag), BaseFont = pdfconstant(name), + Encoding = pdfdocencodingvector, } d[tag] = pdfreference(pdfflushobject(f)) end @@ -212,16 +288,6 @@ local function registerfonts() end end --- cache - -local function fieldattributes(specification) ---~ return pdfarray { ---~ -- BG = -- backgroundcolor ---~ -- BC = -- framecolor ---~ } - return nil -end - -- symbols local function fieldappearances(specification) @@ -232,7 +298,7 @@ local function fieldappearances(specification) -- error return end - local v = aux.settings_to_array(values) + local v = settings_to_array(values) local n, r, d if #v == 1 then n, r, d = v[1], v[1], v[1] @@ -241,21 +307,23 @@ local function fieldappearances(specification) else n, r, d = v[1], v[2], v[3] end - local appearance = pdfdictionary { -- cache this one + local appearance = pdfdictionary { N = registeredsymbol(n), R = registeredsymbol(r), D = registeredsymbol(d), } - return lpdf.sharedobj(tostring(appearance)) + return pdfshareobjectreference(appearance) end +local YesorOn = "Yes" -- somehow On is not always working out well any longer (why o why this change) + local function fieldstates(specification,forceyes,values,default) -- we don't use Opt here (too messy for radio buttons) local values, default = values or specification.values, default or specification.default - if not values then + if not values or values == "" then -- error return end - local v = aux.settings_to_array(values) - local yes, off + local v = settings_to_array(values) + local yes, off, yesn, yesr, yesd, offn, offr, offd if #v == 1 then yes, off = v[1], v[1] else @@ -265,12 +333,12 @@ local function fieldstates(specification,forceyes,values,default) if not (yesshown and yesvalue) then yesshown = yes, yes end - yes = aux.settings_to_array(yesshown) + yes = settings_to_array(yesshown) local offshown, offvalue = lpegmatch(splitter,off) if not (offshown and offvalue) then offshown = off, off end - off = aux.settings_to_array(offshown) + off = settings_to_array(offshown) if #yes == 1 then yesn, yesr, yesd = yes[1], yes[1], yes[1] elseif #yes == 2 then @@ -292,29 +360,42 @@ local function fieldstates(specification,forceyes,values,default) offvalue = offn end if forceyes == true then - forceyes = forceyes and "On" -- spec likes Yes more but we've used On for ages now + forceyes = forceyes and YesorOn -- spec likes Yes more but we've used On for ages now else -- false or string end if default == yesn then default = pdfconstant(forceyes or yesn) else - default = pdfconstant("Off") + default = pdf_off end local appearance = pdfdictionary { -- maybe also cache components N = pdfdictionary { [forceyes or yesn] = registeredsymbol(yesn), Off = registeredsymbol(offn) }, R = pdfdictionary { [forceyes or yesr] = registeredsymbol(yesr), Off = registeredsymbol(offr) }, D = pdfdictionary { [forceyes or yesd] = registeredsymbol(yesd), Off = registeredsymbol(offd) } } - local appearanceref = lpdf.sharedobj(tostring(appearance)) - return appearanceref, default + local appearanceref = pdfshareobjectreference(appearance) + return appearanceref, default, yesvalue +end + +local function fielddefault(field) + local default = field.default + if not default or default == "" then + local values = settings_to_array(field.values) + default = values[1] + end + if not default or default == "" then + return pdf_off + else + return pdfconstant(default) + end end local function fieldoptions(specification) local values = specification.values local default = specification.default if values then - local v = aux.settings_to_array(values) + local v = settings_to_array(values) for i=1,#v do local vi = v[i] local shown, value = lpegmatch(splitter,vi) @@ -328,21 +409,32 @@ local function fieldoptions(specification) end end -local function radiodefault(parent,field,forceyes) - local default, values = parent.default, parent.values - if not default or default == "" then - values = aux.settings_to_array(values) - default = values[1] +local mapping = { + -- acrobat compliant (messy, probably some pdfdoc encoding interference here) + check = "4", -- 0x34 + circle = "l", -- 0x6C + cross = "8", -- 0x38 + diamond = "u", -- 0x75 + square = "n", -- 0x6E + star = "H", -- 0x48 +} + +local function todingbat(n) + if n and n ~= "" then + return mapping[n] or "" end - local name = field.name - local fieldvalues = aux.settings_to_array(field.values) - local yes, off = fieldvalues[1], fieldvalues[2] or fieldvalues[1] - if not default then - return pdfconstant((forceyes and "On") or yes) - elseif default == name then - return pdfconstant((forceyes and "On") or default) - else - return pdfconstant("Off") +end + +local function fieldrendering(specification) + local bvalue = tonumber(specification.backgroundcolorvalue) + local fvalue = tonumber(specification.framecolorvalue) + local svalue = specification.fontsymbol + if bvalue or fvalue or (svalue and svalue ~= "") then + return pdfdictionary { + BG = bvalue and pdfarray { lpdf.colorvalues(3,bvalue) } or nil, + BC = fvalue and pdfarray { lpdf.colorvalues(3,fvalue) } or nil, + CA = svalue and pdfstring (svalue) or nil, + } end end @@ -350,7 +442,7 @@ end local function fieldlayer(specification) -- we can move this in line local layer = specification.layer - return (layer and lpdf.layerreferences[layer]) or nil + return (layer and lpdf.layerreference(layer)) or nil end -- defining @@ -388,7 +480,7 @@ end local function predefinesymbols(specification) local values = specification.values if values then - local symbols = aux.settings_to_array(values) + local symbols = settings_to_array(values) for i=1,#symbols do local symbol = symbols[i] local a, b = lpegmatch(splitter,symbol) @@ -403,16 +495,14 @@ function codeinjections.getdefaultfieldvalue(name) local values = f.values local default = f.default if not default or default == "" then - local symbols = aux.settings_to_array(values) + local symbols = settings_to_array(values) local symbol = symbols[1] if symbol then local a, b = lpegmatch(splitter,symbol) -- splits at => default = a or symbol end end - if default then - tex.sprint(ctxcatcodes,default) - end + return default end end @@ -420,26 +510,26 @@ function codeinjections.definefield(specification) local n = specification.name local f = fields[n] if not f then - local kind = specification.kind - if not kind then + local fieldtype = specification.type + if not fieldtype then if trace_fields then - logs.report("fields","invalid definition of '%s': unknown type",n) + report_fields("invalid definition of '%s': unknown type",n) end - elseif kind == "radio" then + elseif fieldtype == "radio" then local values = specification.values if values and values ~= "" then - values = aux.settings_to_array(values) + values = settings_to_array(values) for v=1,#values do radios[values[v]] = { parent = n } end fields[n] = specification if trace_fields then - logs.report("fields","defining '%s' as radio",n or "?") + report_fields("defining '%s' as radio",n or "?") end elseif trace_fields then - logs.report("fields","invalid definition of radio '%s': missing values",n) + report_fields("invalid definition of radio '%s': missing values",n) end - elseif kind == "sub" then + elseif fieldtype == "sub" then -- not in main field list ! local radio = radios[n] if radio then @@ -449,16 +539,16 @@ function codeinjections.definefield(specification) end if trace_fields then local p = radios[n] and radios[n].parent - logs.report("fields","defining '%s' as sub of radio '%s'",n or "?",p or "?") + report_fields("defining '%s' as sub of radio '%s'",n or "?",p or "?") end elseif trace_fields then - logs.report("fields","invalid definition of radio sub '%s': no parent",n) + report_fields("invalid definition of radio sub '%s': no parent",n) end predefinesymbols(specification) - elseif kind == "text" or kind == "line" then + elseif fieldtype == "text" or fieldtype == "line" then fields[n] = specification if trace_fields then - logs.report("fields","defining '%s' as %s",n,kind) + report_fields("defining '%s' as %s",n,fieldtype) end if specification.values ~= "" and specification.default == "" then specification.default, specification.values = specification.values, nil @@ -466,69 +556,76 @@ function codeinjections.definefield(specification) else fields[n] = specification if trace_fields then - logs.report("fields","defining '%s' as %s",n,kind) + report_fields("defining '%s' as %s",n,fieldtype) end predefinesymbols(specification) end elseif trace_fields then - logs.report("fields","invalid definition of '%s': already defined",n) + report_fields("invalid definition of '%s': already defined",n) end end -function codeinjections.clonefield(specification) - local p, c, v = specification.parent, specification.children, specification.variant +function codeinjections.clonefield(specification) -- obsolete + local p, c, v = specification.parent, specification.children, specification.alternative if not p or not c then if trace_fields then - logs.report("fields","invalid clone: children: '%s', parent '%s', variant: '%s'",p or "?",c or "?", v or "?") + report_fields("invalid clone: children: '%s', parent '%s', alternative: '%s'",p or "?",c or "?", v or "?") end - else - for n in gmatch(c,"[^, ]+") do - local f, r, c, x = fields[n], radios[n], clones[n], fields[p] - if f or r or c then - if trace_fields then - logs.report("fields","already cloned: child: '%s', parent '%s', variant: '%s'",p or "?",n or "?", v or "?") - end - elseif x then - if trace_fields then - logs.report("fields","invalid clone: child: '%s', variant: '%s', no parent",n or "?", v or "?") - end - else - if trace_fields then - logs.report("fields","cloning: child: '%s', parent '%s', variant: '%s'",p or "?",n or "?", v or "?") - end - clones[n] = specification - predefinesymbols(specification) + return + end + local x = fields[p] + if not x then + if trace_fields then + report_fields("cloning: unknown parent '%s'",p) + end + return + end + for n in gmatch(c,"[^, ]+") do + local f, r, c = fields[n], radios[n], clones[n] + if f or r or c then + if trace_fields then + report_fields("already cloned: child: '%s', parent '%s', alternative: '%s'",p,n, v or "?") end + else + if trace_fields then + report_fields("cloning: child: '%s', parent '%s', alternative: '%s'",p,n, v or "?") + end + clones[n] = specification + predefinesymbols(specification) end end end -function codeinjections.getfieldgroup(name) +function codeinjections.getfieldcategory(name) local f = fields[name] or radios[name] or clones[name] - local g = f and f.group - if not g or g == "" then - local v, p, k = f.variant, f.parent, f.kind - if v == "clone" or v == "copy" then - f = fields[p] or radios[p] - g = f and f.group - elseif k == "sub" then - f = fields[p] - g = f and f.group + if f then + local g = f.category + if not g or g == "" then + local v, p, t = f.alternative, f.parent, f.type + if v == "clone" or v == "copy" then + f = fields[p] or radios[p] + g = f and f.category + elseif t == "sub" then + f = fields[p] + g = f and f.category + end end - end - if g then - texsprint(ctxcatcodes,g) + return g end end -- -function codeinjections.doiffieldset(tag) - commands.testcase(fieldsets[tag]) +function codeinjections.validfieldcategory(name) + return fields[name] or radios[name] or clones[name] +end + +function codeinjections.validfieldset(name) + return fieldsets[tag] end -function codeinjections.doiffieldelse(name) - commands.testcase(fields[name]) +function codeinjections.validfield(name) + return fields[name] end -- @@ -544,342 +641,428 @@ local function fieldalignment(specification) end local function enhance(specification,option) - local so = specification.options + local so = specification.option if so and so ~= "" then - specification.options = so .. "," .. option + specification.option = so .. "," .. option else - specification.options = option + specification.option = option end return specification end -- finish -local collected = pdfarray() +local collected = pdfarray() +local forceencoding = false local function finishfields() + local sometext = forceencoding for name, field in next, fields do local kids = field.kids if kids then - pdfflushobject(field.kobj,kids) + pdfflushobject(field.kidsnum,kids) + end + local opt = field.opt + if opt then + pdfflushobject(field.optnum,opt) + end + local type = field.type + if not sometext and (type == "text" or type == "line") then + sometext = true end - local pobj = field.pobj end for name, field in next, radios do local kids = field.kids if kids then - pdfflushobject(field.kobj,kids) + pdfflushobject(field.kidsnum,kids) + end + local opt = field.opt + if opt then + pdfflushobject(field.optnum,opt) end end if #collected > 0 then - usedfonts.tttf = fontnames.tt.tf local acroform = pdfdictionary { NeedAppearances = true, - Fields = pdfreference(pdfflushobject(collected)), - DR = pdfdictionary { Font = registerfonts() }, - CO = fieldsetlist(calculationset), - DA = "/tttf 12 Tf 0 g", + Fields = pdfreference(pdfflushobject(collected)), + CO = fieldsetlist(calculationset), } + if sometext then + checkpdfdocencoding() + usedfonts.tttf = fontnames.tt.tf + acroform.DA = "/tttf 12 Tf 0 g" + acroform.DR = pdfdictionary { + Font = registerfonts(), + Encoding = pdfdocencodingcapsule, + } + end lpdf.addtocatalog("AcroForm",pdfreference(pdfflushobject(acroform))) end end -lpdf.registerdocumentfinalizer(finishfields) - -local pdf_widget = pdfconstant("Widget") -local pdf_tx = pdfconstant("Tx") -local pdf_ch = pdfconstant("Ch") -local pdf_btn = pdfconstant("Btn") -local pdf_yes = pdfconstant("Yes") -local pdf_p = pdfconstant("P") -- None Invert Outline Push -local pdf_n = pdfconstant("N") -- None Invert Outline Push --- -local pdf_no_rect = pdfarray { 0, 0, 0, 0 } +lpdf.registerdocumentfinalizer(finishfields,"form fields") local methods = { } -function codeinjections.typesetfield(name,specification) +function nodeinjections.typesetfield(name,specification) local field = fields[name] or radios[name] or clones[name] if not field then - logs.report("fields", "unknown child '%s'",name) + report_fields( "unknown child '%s'",name) -- unknown field return end - local variant, parent = field.variant, field.parent - if variant == "copy" or variant == "clone" then -- only in clones + local alternative, parent = field.alternative, field.parent + if alternative == "copy" or alternative == "clone" then -- only in clones field = fields[parent] or radios[parent] end - local method = methods[field.kind] + local method = methods[field.type] if method then - method(name,specification,variant) + return method(name,specification,alternative) else - logs.report("fields", "unknown method '%s' for child '%s'",field.kind,name) + report_fields( "unknown method '%s' for child '%s'",field.type,name) end end --- can be optional multipass optimization (share objects) - -local function save_parent(field,specification,d) - local kn = pdfreserveobject() - d.Kids = pdfreference(kn) - field.kobj = kn +local function save_parent(field,specification,d,hasopt) + local kidsnum = pdfreserveobject() + d.Kids = pdfreference(kidsnum) + field.kidsnum = kidsnum field.kids = pdfarray() - local pn = pdfflushobject(d) - field.pobj = pn - collected[#collected+1] = pdfreference(pn) + if hasopt then + local optnum = pdfreserveobject() + d.Opt = pdfreference(optnum) + field.optnum = optnum + field.opt = pdfarray() + end + local pnum = pdfflushobject(d) + field.pobj = pnum + collected[#collected+1] = pdfreference(pnum) end -local function save_kid(field,specification,d) - local kn = pdfreserveobject() +local function save_kid(field,specification,d,optname) + local kn = pdfreserveannotation() field.kids[#field.kids+1] = pdfreference(kn) - node.write(pdfannotation(specification.width,specification.height,0,d(),kn)) + if optname then + field.opt[#field.opt+1] = optname + end + local width, height, depth = specification.width or 0, specification.height or 0, specification.depth + local box = hpack_node(pdfannotation_node(width,height,depth,d(),kn)) + box.width, box.height, box.depth = width, height, depth -- redundant + return box end -function methods.line(name,specification,variant,extras) - local field = fields[name] - if variant == "copy" or variant == "clone" then - logs.report("fields","todo: clones of text fields") - end - local kind = field.kind - if not field.pobj then - if trace_fields then - logs.report("fields","using parent text '%s'",name) +local function makelineparent(field,specification) + local text = pdfunicode(field.default) + local length = tonumber(specification.length or 0) or 0 + local d = pdfdictionary { + Subtype = pdf_widget, + T = pdfunicode(specification.title), + F = fieldplus(specification), + Ff = fieldflag(specification), + OC = fieldlayer(specification), + DA = fieldsurrounding(specification), + AA = fieldactions(specification), + FT = pdf_tx, + Q = fieldalignment(specification), + MaxLen = length == 0 and 1000 or length, + DV = text, + V = text, + } + save_parent(field,specification,d) +end + +local function makelinechild(name,specification) + local field, parent = clones[name], nil + if field then + parent = fields[field.parent] + if not parent.pobj then + if trace_fields then + report_fields("forcing parent text '%s'",parent.name) + end + makelineparent(parent,specification) end - if extras then - enhance(specification,extras) + else + parent = fields[name] + field = parent + if not parent.pobj then + if trace_fields then + report_fields("using parent text '%s'",name) + end + makelineparent(parent,specification) end - local text = pdfunicode(field.default) - local d = pdfdictionary { - Subtype = pdf_widget, - T = pdfunicode(specification.title), - F = fieldplus(specification), - Ff = fieldflag(specification), - OC = fieldlayer(specification), - MK = fieldsurrounding(specification), -- needed ? - DA = fieldsurrounding(specification), - AA = fieldactions(specification), - FT = pdf_tx, - Q = fieldalignment(specification), - MaxLen = (specification.length == 0 and 1000) or specification.length, - DV = text, - V = text, - } - save_parent(field,specification,d) - field.specification = specification end - specification = field.specification or { } -- todo: radio spec if trace_fields then - logs.report("fields","using child text '%s'",name) + report_fields("using child text '%s'",name) end local d = pdfdictionary { Subtype = pdf_widget, - Parent = pdfreference(field.pobj), + Parent = pdfreference(parent.pobj), F = fieldplus(specification), - DA = fieldattributes(specification), OC = fieldlayer(specification), - MK = fieldsurrounding(specification), DA = fieldsurrounding(specification), AA = fieldactions(specification), + MK = fieldrendering(specification), Q = fieldalignment(specification), } - save_kid(field,specification,d) + return save_kid(parent,specification,d) end -function methods.text(name,specification,variant) - methods.line(name,specification,variant,"MultiLine") +function methods.line(name,specification) + return makelinechild(name,specification) end -function methods.choice(name,specification,variant,extras) - local field = fields[name] - if variant == "copy" or variant == "clone" then - logs.report("fields","todo: clones of choice fields") - end - local kind = field.kind - local d - if not field.pobj then - if trace_fields then - logs.report("fields","using parent choice '%s'",name) +function methods.text(name,specification) + return makelinechine(name,enhance(specification,"MultiLine")) +end + +local function makechoiceparent(field,specification) + local d = pdfdictionary { + Subtype = pdf_widget, + T = pdfunicode(specification.title), + F = fieldplus(specification), + Ff = fieldflag(specification), + OC = fieldlayer(specification), + AA = fieldactions(specification), + FT = pdf_ch, + Opt = fieldoptions(field), -- todo + } + save_parent(field,specification,d) +end + +local function makechoicechild(name,specification) + local field, parent = clones[name], nil + if field then + parent = fields[field.parent] + if not parent.pobj then + if trace_fields then + report_fields("forcing parent choice '%s'",parent.name) + end + makechoiceparent(parent,specification,extras) end - if extras then - enhance(specification,extras) + else + parent = fields[name] + field = parent + if not parent.pobj then + if trace_fields then + report_fields("using parent choice '%s'",name) + end + makechoiceparent(parent,specification,extras) end - local d = pdfdictionary { - Subtype = pdf_widget, - T = pdfunicode(specification.title), - F = fieldplus(specification), - Ff = fieldflag(specification), - OC = fieldlayer(specification), - AA = fieldactions(specification), - FT = pdf_ch, - Opt = fieldoptions(field), - } - save_parent(field,specification,d) - field.specification = specification end - specification = field.specification or { } if trace_fields then - logs.report("fields","using child choice '%s'",name) + report_fields("using child choice '%s'",name) end local d = pdfdictionary { Subtype = pdf_widget, - Parent = pdfreference(field.pobj), + Parent = pdfreference(parent.pobj), F = fieldplus(specification), - DA = fieldattributes(specification), OC = fieldlayer(specification), AA = fieldactions(specification), } - save_kid(field,specification,d) + return save_kid(parent,specification,d) -- do opt here +end + +function methods.choice(name,specification) + return makechoicechild(name,specification) end -function methods.popup(name,specification,variant) - methods.choice(name,specification,variant,"PopUp") +function methods.popup(name,specification) + return makechoicechild(name,enhance(specification,"PopUp")) end -function methods.combo(name,specification,variant) - methods.choice(name,specification,variant,"PopUp,Edit") + +function methods.combo(name,specification) + return makechoicechild(name,enhance(specification,"PopUp,Edit")) end --- Probably no default appearance needed for first kid and no javascripts for the --- parent ... I will look into it when I have to make a complex document. +local function makecheckparent(field,specification) + local d = pdfdictionary { + T = pdfunicode(specification.title), + F = fieldplus(specification), + Ff = fieldflag(specification), + OC = fieldlayer(specification), + AA = fieldactions(specification), + FT = pdf_btn, + V = fielddefault(field), + } + save_parent(field,specification,d,true) +end -function methods.check(name,specification,variant) - -- no /Opt because (1) it's messy - see pdf spec, (2) it discouples kids and - -- contrary to radio there is no way to associate then - local field = fields[name] - if variant == "copy" or variant == "clone" then - logs.report("fields","todo: clones of check fields") - end - local kind = field.kind - local appearance, default = fieldstates(field,true) - if not field.pobj then - if trace_fields then - logs.report("fields","using parent check '%s'",name) +local function makecheckchild(name,specification) + local field, parent = clones[name], nil + if field then + parent = fields[field.parent] + if not parent.pobj then + if trace_fields then + report_fields("forcing parent check '%s'",parent.name) + end + makecheckparent(parent,specification,extras) + end + else + parent = fields[name] + field = parent + if not parent.pobj then + if trace_fields then + report_fields("using parent check '%s'",name) + end + makecheckparent(parent,specification,extras) end - local d = pdfdictionary { - Subtype = pdf_widget, - T = pdfunicode(specification.title), - F = fieldplus(specification), - Ff = fieldflag(specification), - OC = fieldlayer(specification), - AA = fieldactions(specification), - FT = pdf_btn, - DV = default, - V = default, - AS = default, - AP = appearance, - H = pdf_n, - } - save_parent(field,specification,d) - field.specification = specification end - specification = field.specification or { } -- todo: radio spec if trace_fields then - logs.report("fields","using child check '%s'",name) + report_fields("using child check '%s'",name) end local d = pdfdictionary { Subtype = pdf_widget, - Parent = pdfreference(field.pobj), + Parent = pdfreference(parent.pobj), F = fieldplus(specification), - DA = fieldattributes(specification), OC = fieldlayer(specification), AA = fieldactions(specification), - DV = default, - V = default, - AS = default, - AP = appearance, H = pdf_n, } - save_kid(field,specification,d) + local fontsymbol = specification.fontsymbol + if fontsymbol and fontsymbol ~= "" then + specification.fontsymbol = todingbat(fontsymbol) + specification.fontstyle = "symbol" + specification.fontalternative = "dingbats" + d.DA = fieldsurrounding(specification) + d.MK = fieldrendering(specification) + return save_kid(parent,specification,d) + else + local appearance, default, value = fieldstates(field,true) + d.AS = default + d.AP = appearance + return save_kid(parent,specification,d,value) + end end -function methods.push(name,specification,variant) - local field = fields[name] - if variant == "copy" or variant == "clone" then - logs.report("fields","todo: clones of push fields") - end - local kind = field.kind - if not field.pobj then - if trace_fields then - logs.report("fields","using parent push '%s'",name) +function methods.check(name,specification) + return makecheckchild(name,specification) +end + +local function makepushparent(field,specification) -- check if we can share with the previous + local d = pdfdictionary { + Subtype = pdf_widget, + T = pdfunicode(specification.title), + F = fieldplus(specification), + Ff = fieldflag(specification), + OC = fieldlayer(specification), + AA = fieldactions(specification), + FT = pdf_btn, + AP = fieldappearances(field), + H = pdf_p, + } + save_parent(field,specification,d) +end + +local function makepushchild(name,specification) + local field, parent = clones[name], nil + if field then + parent = fields[field.parent] + if not parent.pobj then + if trace_fields then + report_fields("forcing parent push '%s'",parent.name) + end + makepushparent(parent,specification) + end + else + parent = fields[name] + field = parent + if not parent.pobj then + if trace_fields then + report_fields("using parent push '%s'",name) + end + makepushparent(parent,specification) end - enhance(specification,"PushButton") - local d = pdfdictionary { - Subtype = pdf_widget, - T = pdfunicode(specification.title), - F = fieldplus(specification), - Ff = fieldflag(specification), - OC = fieldlayer(specification), - AA = fieldactions(specification), - FT = pdf_btn, - AP = fieldappearances(field), - H = pdf_p, - } - save_parent(field,specification,d) - field.specification = specification end - specification = field.specification or { } -- todo: radio spec if trace_fields then - logs.report("fields","using child push '%s'",name) + report_fields("using child push '%s'",name) end + local fontsymbol = specification.fontsymbol local d = pdfdictionary { Subtype = pdf_widget, Parent = pdfreference(field.pobj), F = fieldplus(specification), - DA = fieldattributes(specification), OC = fieldlayer(specification), AA = fieldactions(specification), - AP = fieldappearances(field), H = pdf_p, } - save_kid(field,specification,d) + if fontsymbol and fontsymbol ~= "" then + specification.fontsymbol = todingbat(fontsymbol) + specification.fontstyle = "symbol" + specification.fontalternative = "dingbats" + d.DA = fieldsurrounding(specification) + d.MK = fieldrendering(specification) + else + d.AP = fieldappearances(field) + end + return save_kid(parent,specification,d) +end + +function methods.push(name,specification) + return makepushchild(name,enhance(specification,"PushButton")) +end + +local function makeradioparent(field,specification) + specification = enhance(specification,"Radio,RadiosInUnison") + local d = pdfdictionary { + T = field.name, + FT = pdf_btn, + F = fieldplus(specification), + Ff = fieldflag(specification), + H = pdf_n, + V = fielddefault(field), + } + save_parent(field,specification,d,true) end -function methods.sub(name,specification,variant) - local field = radios[name] or fields[name] or clones[name] -- fields in case of a clone, maybe use dedicated clones - local values - if variant == "copy" or variant == "clone" then - name = field.parent - values = field.values -- clone only, copy has nil so same as parent +local function makeradiochild(name,specification) + local field, parent = clones[name], nil + if field then + field = radios[field.parent] + parent = fields[field.parent] + if not parent.pobj then + if trace_fields then + report_fields("forcing parent radio '%s'",parent.name) + end + makeradioparent(parent,parent) + end field = radios[name] else - values = field.values - end - local parent = fields[field.parent] - if not parent then - return - end - local appearance = fieldstates(field,name,values) -- we need to force the 'On' name - local default = radiodefault(parent,field) - if not parent.pobj then - if trace_fields then - logs.report("fields","using parent '%s' of radio '%s' with values '%s' and default '%s'",parent.name,name,parent.values or "?",parent.default or "?") + field = radios[name] + parent = fields[field.parent] + if not parent.pobj then + if trace_fields then + report_fields("using parent radio '%s'",name) + end + makeradioparent(parent,parent) end - local specification = parent.specification or { } - -- enhance(specification,"Radio,RadiosInUnison") - enhance(specification,"RadiosInUnison") -- maybe also PushButton as acrobat does - local d = pdfdictionary { - T = parent.name, - FT = pdf_btn, - Rect = pdf_no_rect, - F = fieldplus(specification), - Ff = fieldflag(specification), - H = pdf_n, - V = default, - } - save_parent(parent,specification,d) end if trace_fields then - logs.report("fields","using child radio '%s' with values '%s'",name,values or "?") + report_fields("using child radio '%s' with values '%s' and default '%s'",name,field.values or "?",field.default or "?") end + local fontsymbol = specification.fontsymbol local d = pdfdictionary { Subtype = pdf_widget, Parent = pdfreference(parent.pobj), F = fieldplus(specification), - DA = fieldattributes(specification), OC = fieldlayer(specification), AA = fieldactions(specification), - AS = default, - AP = appearance, H = pdf_n, } - save_kid(parent,specification,d) + if fontsymbol and fontsymbol ~= "" then + specification.fontsymbol = todingbat(fontsymbol) + specification.fontstyle = "symbol" + specification.fontalternative = "dingbats" + d.DA = fieldsurrounding(specification) + d.MK = fieldrendering(specification) + return save_kid(parent,specification,d) + else + local appearance, default, value = fieldstates(field,true) -- false is also ok + d.AS = default -- needed ? + d.AP = appearance + return save_kid(parent,specification,d,value) + end +end + +function methods.sub(name,specification) + return makeradiochild(name,enhance(specification,"Radio,RadiosInUnison")) end diff --git a/Master/texmf-dist/tex/context/base/lpdf-fmt.lua b/Master/texmf-dist/tex/context/base/lpdf-fmt.lua new file mode 100644 index 00000000000..017e28ebb23 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lpdf-fmt.lua @@ -0,0 +1,758 @@ +if not modules then modules = { } end modules ['lpdf-fmt'] = { + version = 1.001, + comment = "companion to lpdf-ini.mkiv", + author = "Peter Rolf and Hans Hagen", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +-- Thanks to Luigi and Steffen for testing. + +-- context --directives="backend.format=PDF/X-1a:2001" --trackers=backend.format yourfile + +local trace_format = false trackers.register("backend.format", function(v) trace_format = v end) +local trace_variables = false trackers.register("backend.variables", function(v) trace_variables = v end) + +local report_backend = logs.reporter("backend","profiles") + +local backends, lpdf = backends, lpdf + +local codeinjections = backends.pdf.codeinjections + +local variables = interfaces.variables +local viewerlayers = attributes.viewerlayers +local colors = attributes.colors +local transparencies = attributes.transparencies + +local pdfdictionary = lpdf.dictionary +local pdfarray = lpdf.array +local pdfconstant = lpdf.constant +local pdfreference = lpdf.reference +local pdfflushobject = lpdf.flushobject +local pdfstring = lpdf.string +local pdfverbose = lpdf.verbose +local pdfobject = lpdf.object + +local addtoinfo, injectxmpinfo, insertxmpinfo = lpdf.addtoinfo, lpdf.injectxmpinfo, lpdf.insertxmpinfo + +local lower, gmatch, format, find = string.lower, string.gmatch, string.format, string.find +local concat, serialize = table.concat, table.serialize +local settings_to_array, settings_to_hash = utilities.parsers.settings_to_array, utilities.parsers.settings_to_hash + +--[[ + Comments by Peter: + + output intent : only one profile per color space (and device class) + default color space : (theoretically) several profiles per color space possible + + The default color space profiles define the current gamuts (part of/all the + colors we have in the document), while the output intent profile declares the + gamut of the output devices (the colors that we get normally a printer or + monitor). + + Example: + + I have two RGB pictures (both 'painted' in /DeviceRGB) and I declare sRGB as + default color space for one picture and AdobeRGB for the other. As output + intent I use ISO_coated_v2_eci.icc. + + If I had more than one output intent profile for the combination CMYK/printer I + can't decide which one to use. But it is no problem to use several default color + space profiles for the same color space as it's just a different color + transformation. The relation between picture and profile is clear. +]]-- + +local channels = { + gray = 1, + grey = 1, + rgb = 3, + cmyk = 4, +} + +local prefixes = { + gray = "DefaultGray", + grey = "DefaultGray", + rgb = "DefaultRGB", + cmyk = "DefaultCMYK", +} + +local formatspecification, formatname = nil, nil + +-- * correspondent document wide flags (write once) needed for permission tests + +local formats = utilities.storage.allocate { + ["version"] = { + external_icc_profiles = 1.4, -- 'p' in name; URL reference of output intent + jbig2_compression = 1.4, + jpeg2000_compression = 1.5, -- not supported yet + nchannel_colorspace = 1.6, -- 'n' in name; n-channel colorspace support + open_prepress_interface = 1.3, -- 'g' in name; reference to external graphics + optional_content = 1.5, + transparency = 1.4, + object_compression = 1.5, + }, + ["default"] = { + pdf_version = 1.7, -- todo: block tex primitive + format_name = "default", + xmp_file = "lpdf-pdx.xml", + gray_scale = true, + cmyk_colors = true, + rgb_colors = true, + spot_colors = true, + calibrated_rgb_colors = true, -- unknown + cielab_colors = true, -- unknown + nchannel_colorspace = true, -- unknown + internal_icc_profiles = true, -- controls profile inclusion + external_icc_profiles = true, -- controls profile inclusion + include_intents = true, + open_prepress_interface = true, -- unknown + optional_content = true, -- todo: block at lua level + transparency = true, -- todo: block at lua level + jbig2_compression = true, -- todo: block at lua level + jpeg2000_compression = true, -- todo: block at lua level + inject_metadata = function() + -- nothing + end + }, + ["pdf/x-1a:2001"] = { + pdf_version = 1.3, + format_name = "PDF/X-1a:2001", + xmp_file = "lpdf-pdx.xml", + gts_flag = "GTS_PDFX", + gray_scale = true, + cmyk_colors = true, + spot_colors = true, + internal_icc_profiles = true, + inject_metadata = function() + addtoinfo("GTS_PDFXVersion","PDF/X-1a:2001") + injectxmpinfo("xml://rdf:RDF","PDF/X-1a:2001",false) + end + }, + ["pdf/x-1a:2003"] = { + pdf_version = 1.4, + format_name = "PDF/X-1a:2003", + xmp_file = "lpdf-pdx.xml", + gts_flag = "GTS_PDFX", + gray_scale = true, + cmyk_colors = true, + spot_colors = true, + internal_icc_profiles = true, + inject_metadata = function() + addtoinfo("GTS_PDFXVersion","PDF/X-1a:2003") + injectxmpinfo("xml://rdf:RDF","PDF/X-1a:2003",false) + end + }, + ["pdf/x-3:2002"] = { + pdf_version = 1.3, + format_name = "PDF/X-3:2002", + xmp_file = "lpdf-pdx.xml", + gts_flag = "GTS_PDFX", + gray_scale = true, + cmyk_colors = true, + rgb_colors = true, + calibrated_rgb_colors = true, + spot_colors = true, + cielab_colors = true, + internal_icc_profiles = true, + include_intents = true, + inject_metadata = function() + addtoinfo("GTS_PDFXVersion","PDF/X-3:2002") + end + }, + ["pdf/x-3:2003"] = { + pdf_version = 1.4, + format_name = "PDF/X-3:2003", + xmp_file = "lpdf-pdx.xml", + gts_flag = "GTS_PDFX", + gray_scale = true, + cmyk_colors = true, + rgb_colors = true, + calibrated_rgb_colors = true, + spot_colors = true, + cielab_colors = true, + internal_icc_profiles = true, + include_intents = true, + jbig2_compression = true, + inject_metadata = function() + addtoinfo("GTS_PDFXVersion","PDF/X-3:2003") + end + }, + ["pdf/x-4"] = { + pdf_version = 1.6, + format_name = "PDF/X-4", + xmp_file = "lpdf-pdx.xml", + gts_flag = "GTS_PDFX", + gray_scale = true, + cmyk_colors = true, + rgb_colors = true, + calibrated_rgb_colors = true, + spot_colors = true, + cielab_colors = true, + internal_icc_profiles = true, + include_intents = true, + optional_content = true, + transparency = true, + jbig2_compression = true, + jpeg2000_compression = true, + object_compression = true, + inject_metadata = function() + injectxmpinfo("xml://rdf:RDF","PDF/X-4",false) + insertxmpinfo("xml://rdf:Description/xmpMM:InstanceID","1",false) + insertxmpinfo("xml://rdf:Description/xmpMM:InstanceID","default",false) + end + }, + ["pdf/x-4p"] = { + pdf_version = 1.6, + format_name = "PDF/X-4p", + xmp_file = "lpdf-pdx.xml", + gts_flag = "GTS_PDFX", + gray_scale = true, + cmyk_colors = true, + rgb_colors = true, + calibrated_rgb_colors = true, + spot_colors = true, + cielab_colors = true, + internal_icc_profiles = true, + external_icc_profiles = true, + include_intents = true, + optional_content = true, + transparency = true, + jbig2_compression = true, + jpeg2000_compression = true, + object_compression = true, + inject_metadata = function() + injectxmpinfo("xml://rdf:RDF","PDF/X-4p",false) + insertxmpinfo("xml://rdf:Description/xmpMM:InstanceID","1",false) + insertxmpinfo("xml://rdf:Description/xmpMM:InstanceID","default",false) + end + }, + ["pdf/x-5g"] = { + pdf_version = 1.6, + format_name = "PDF/X-5g", + xmp_file = "lpdf-pdx.xml", + gts_flag = "GTS_PDFX", + gray_scale = true, + cmyk_colors = true, + rgb_colors = true, + calibrated_rgb_colors = true, + spot_colors = true, + cielab_colors = true, + internal_icc_profiles = true, + include_intents = true, + open_prepress_interface = true, + optional_content = true, + transparency = true, + jbig2_compression = true, + jpeg2000_compression = true, + object_compression = true, + inject_metadata = function() + -- todo + end + }, + ["pdf/x-5pg"] = { + pdf_version = 1.6, + format_name = "PDF/X-5pg", + xmp_file = "lpdf-pdx.xml", + gts_flag = "GTS_PDFX", + gray_scale = true, + cmyk_colors = true, + rgb_colors = true, + calibrated_rgb_colors = true, + spot_colors = true, + cielab_colors = true, + internal_icc_profiles = true, + external_icc_profiles = true, + include_intents = true, + open_prepress_interface = true, + optional_content = true, + transparency = true, + jbig2_compression = true, + jpeg2000_compression = true, + object_compression = true, + inject_metadata = function() + -- todo + end + }, + ["pdf/x-5n"] = { + pdf_version = 1.6, + format_name = "PDF/X-5n", + xmp_file = "lpdf-pdx.xml", + gts_flag = "GTS_PDFX", + gray_scale = true, + cmyk_colors = true, + rgb_colors = true, + calibrated_rgb_colors = true, + spot_colors = true, + cielab_colors = true, + internal_icc_profiles = true, + include_intents = true, + optional_content = true, + transparency = true, + jbig2_compression = true, + jpeg2000_compression = true, + nchannel_colorspace = true, + object_compression = true, + inject_metadata = function() + -- todo + end + }, + ["pdf/a-1a:2005"] = { + pdf_version = 1.4, + format_name = "pdf/a-1a:2005", + xmp_file = "lpdf-pda.xml", + gts_flag = "GTS_PDFA1", + gray_scale = true, + cmyk_colors = true, + rgb_colors = true, + spot_colors = true, + calibrated_rgb_colors = true, -- unknown + cielab_colors = true, -- unknown + include_intents = true, + forms = true, -- NEW; forms are allowed (with limitations); no JS, other restrictions are unknown (TODO) + tagging = true, -- NEW; the only difference to PDF/A-1b + internal_icc_profiles = true, + inject_metadata = function() + injectxmpinfo("xml://rdf:RDF","1A",false) + end + }, + ["pdf/a-1b:2005"] = { + pdf_version = 1.4, + format_name = "pdf/a-1b:2005", + xmp_file = "lpdf-pda.xml", + gts_flag = "GTS_PDFA1", + gray_scale = true, + cmyk_colors = true, + rgb_colors = true, + spot_colors = true, + calibrated_rgb_colors = true, -- unknown + cielab_colors = true, -- unknown + include_intents = true, + forms = true, + internal_icc_profiles = true, + inject_metadata = function() + injectxmpinfo("xml://rdf:RDF","1B",false) + end + }, +} + +lpdf.formats = formats -- it does not hurt to have this one visible + +local filenames = { + "colorprofiles.xml", + "colorprofiles.lua", +} + +local function locatefile(filename) + local fullname = resolvers.findfile(filename,"icc") + if not fullname or fullname == "" then + fullname = resolvers.finders.byscheme("loc",filename) -- could be specific to the project + end + return fullname or "" +end + +local function loadprofile(name,filename) + local profile = false + local databases = filename and filename ~= "" and settings_to_array(filename) or filenames + for i=1,#databases do + local filename = locatefile(databases[i]) + if filename and filename ~= "" then + local suffix = file.extname(filename) + local lname = lower(name) + if suffix == "xml" then + local xmldata = xml.load(filename) -- no need for caching it + if xmldata then + profile = xml.filter(xmldata,format('xml://profiles/profile/(info|filename)[lower(text())=="%s"]/../table()',lname)) + end + elseif suffix == "lua" then + local luadata = loadfile(filename) + luadata = ludata and luadata() + if luadata then + profile = luadata[name] or luadata[lname] -- hashed + if not profile then + for i=1,#luadata do + local li = luadata[i] + if lower(li.info) == lname then -- indexed + profile = li + break + end + end + end + end + end + if profile then + if next(profile) then + report_backend("profile specification '%s' loaded from '%s'",name,filename) + return profile + elseif trace_format then + report_backend("profile specification '%s' loaded from '%s' but empty",name,filename) + end + return false + end + end + end + report_backend("profile specification '%s' not found in '%s'",name,concat(filenames, ", ")) +end + +local function urls(url) + if not url or url == "" then + return nil + else + local u = pdfarray() + for url in gmatch(url,"([^, ]+)") do + if find(url,"^http") then + u[#u+1] = pdfdictionary { + FS = pdfconstant("URL"), + F = pdfstring(url), + } + end + end + return u + end +end + +local function profilename(filename) + return lower(file.basename(filename)) +end + +local internalprofiles = { } + +local function handleinternalprofile(s,include) + local filename, colorspace = s.filename or "", s.colorspace or "" + if filename == "" or colorspace == "" then + report_backend("error in internal profile specification: %s",serialize(s,false)) + else + local tag = profilename(filename) + local profile = internalprofiles[tag] + if not profile then + local colorspace = lower(colorspace) + if include then + -- local fullname = resolvers.findctxfile(filename) or "" + local fullname = locatefile(filename) + local channel = channels[colorspace] or nil + if fullname == "" then + report_backend("error, couldn't locate profile '%s'",filename) + elseif not channel then + report_backend("error, couldn't resolve channel entry for colorspace '%s'",colorspace) + else + local a = pdfdictionary { N = channel } + profile = pdfobject { -- does a flush too + compresslevel = 0, + immediate = true, -- ! + type = "stream", + file = fullname, + attr = a(), + } + internalprofiles[tag] = profile + if trace_format then + report_backend("including '%s' color profile from '%s'",colorspace,fullname) + end + end + else + internalprofiles[tag] = true + if trace_format then + report_backend("not including '%s' color profile '%s'",colorspace,filename) + end + end + end + return profile + end +end + +local externalprofiles = { } + +local function handleexternalprofile(s,include) -- specification (include ignored here) + local name, url, filename, checksum, version, colorspace = + s.info or s.filename or "", s.url or "", s.filename or "", s.checksum or "", s.version or "", s.colorspace or "" + if false then -- somehow leads to invalid pdf + local iccprofile = colors.iccprofile(filename) + if iccprofile then + name = name ~= "" and name or iccprofile.tags.desc.cleaned or "" + url = url ~= "" and url or iccprofile.tags.dmnd.cleaned or "" + checksum = checksum ~= "" and checksum or file.checksum(iccprofile.fullname) or "" + version = version ~= "" and version or iccprofile.header.version or "" + colorspace = colorspace ~= "" and colorspace or iccprofile.header.colorspace or "" + end + -- table.print(iccprofile) + end + if name == "" or url == "" or checksum == "" or version == "" or colorspace == "" or filename == "" then + local profile = handleinternalprofile(s) + if profile then + report_backend("incomplete external profile specification, falling back to internal") + else + report_backend("error in external profile specification: %s",serialize(s,false)) + end + else + local tag = profilename(filename) + local profile = externalprofiles[tag] + if not profile then + local d = pdfdictionary { + ProfileName = name, -- not file name! + ProfileCS = colorspace, + URLs = urls(url), -- array containing at least one URL + CheckSum = pdfverbose { "<", lower(checksum), ">" }, -- 16byte MD5 hash + ICCVersion = pdfverbose { "<", version, ">" }, -- bytes 8..11 from the header of the ICC profile, as a hex string + } + profile = pdfflushobject(d) + externalprofiles[tag] = profile + end + return profile + end +end + +local loadeddefaults = { } + +local function handledefaultprofile(s,spec) -- specification + local filename, colorspace = s.filename or "", lower(s.colorspace or "") + if filename == "" or colorspace == "" then + report_backend("error in default profile specification: %s",serialize(s,false)) + elseif not loadeddefaults[colorspace] then + local tag = profilename(filename) + local n = internalprofiles[tag] -- or externalprofiles[tag] + if n == true then -- not internalized + report_backend("no default profile '%s' for colorspace '%s'",filename,colorspace) + elseif n then + local a = pdfarray { + pdfconstant("ICCBased"), + pdfreference(n), + } + -- used in page /Resources, so this must be inserted at runtime + lpdf.adddocumentcolorspace(prefixes[colorspace],pdfreference(pdfflushobject(a))) + loadeddefaults[colorspace] = true + report_backend("setting '%s' as default '%s' color space",filename,colorspace) + else + report_backend("no default profile '%s' for colorspace '%s'",filename,colorspace) + end + elseif trace_format then + report_backend("a default '%s' colorspace is already in use",colorspace) + end +end + +local loadedintents, intents = { }, pdfarray() + +local function handleoutputintent(s,spec) + local name, url, filename, id, outputcondition, info = s.info or s.filename or "", s.url or "", s.filename or "", s.id or "", s.outputcondition or "", s.info or "" + if name == "" or id == "" then + report_backend("error in output intent specification: %s",serialize(s,false)) + elseif not loadedintents[name] then + local tag = profilename(filename) + local internal, external = internalprofiles[tag], externalprofiles[tag] + if internal or external then + local d = { + Type = pdfconstant("OutputIntent"), + S = pdfconstant(spec.gts_flag or "GTS_PDFX"), + OutputConditionIdentifier = id, + RegistryName = url, + OutputCondition = outputcondition, + Info = info, + } + if internal and internal ~= true then + d.DestOutputProfile = pdfreference(internal) + elseif external and external ~= true then + d.DestOutputProfileRef = pdfreference(external) + else + report_backend("omitting reference to profile for intent '%s'",name) + end + intents[#intents+1] = pdfreference(pdfflushobject(pdfdictionary(d))) + if trace_format then + report_backend("setting output intent to '%s' with id '%s' (entry %s)",name,id,#intents) + end + else + report_backend("invalid output intent '%s'",name) + end + loadedintents[name] = true + elseif trace_format then + report_backend("an output intent with name '%s' is already in use",name) + end +end + +local function handleiccprofile(message,spec,name,filename,how,options,alwaysinclude,gts_flag) + if name and name ~= "" then + local list = settings_to_array(name) + for i=1,#list do + local name = list[i] + local profile = loadprofile(name,filename) + if trace_format then + report_backend("handling %s '%s'",message,name) + end + if profile then + if formatspecification.cmyk_colors then + profile.colorspace = profile.colorspace or "CMYK" + else + profile.colorspace = profile.colorspace or "RGB" + end + local external = formatspecification.external_icc_profiles + local internal = formatspecification.internal_icc_profiles + local include = formatspecification.include_intents + local always, never = options[variables.always], options[variables.never] + if always or alwaysinclude then + if trace_format then + report_backend("forcing internal profiles") -- can make preflight unhappy + end + -- internal, external = true, false + internal, external = not never, false + elseif never then + if trace_format then + report_backend("forcing external profiles") -- can make preflight unhappy + end + internal, external = false, true + end + if external then + if trace_format then + report_backend("handling external profiles cf. '%s'",name) + end + handleexternalprofile(profile,false) + else + if trace_format then + report_backend("handling internal profiles cf. '%s'",name) + end + if internal then + handleinternalprofile(profile,always or include) + else + report_backend("no profile inclusion for '%s'",formatname) + end + end + how(profile,spec) + elseif trace_format then + report_backend("unknown profile '%s'",name) + end + end + end +end + +local function flushoutputintents() + if #intents > 0 then + lpdf.addtocatalog("OutputIntents",pdfreference(pdfflushobject(intents))) + end +end + +lpdf.registerdocumentfinalizer(flushoutputintents,2,"output intents") + +function codeinjections.setformat(s) + local format, level, profile, intent, option, filename = + s.format or "", s.level or "", s.profile or "", s.intent or "", s.option or "", s.file or "" + if format == "" then + -- we ignore this as we hook it in \everysetupbackend + else + local spec = formats[lower(format)] + if spec then + formatspecification, formatname = spec, spec.format_name + level = level and tonumber(level) + report_backend("setting format to '%s'",formatname) + local xmp_file = formatspecification.xmp_file or "" + if xmp_file == "" then + -- weird error + else + codeinjections.setxmpfile(xmp_file) + end + local pdf_version, inject_metadata = spec.pdf_version * 10, spec.inject_metadata + local majorversion, minorversion = math.div(pdf_version,10), math.mod(pdf_version,10) + local objectcompression = spec.object_compression and pdf_version >= 15 + local compresslevel = level or tex.pdfcompresslevel -- keep default + local objectcompresslevel = (objectcompression and (level or tex.pdfobjcompresslevel)) or 0 + tex.pdfcompresslevel, tex.pdfobjcompresslevel = compresslevel, objectcompresslevel + tex.pdfmajorversion, tex.pdfminorversion = majorversion, minorversion + if objectcompression then + report_backend("forcing pdf version %s.%s, compression level %s, object compression level %s", + majorversion,minorversion,compresslevel,objectcompresslevel) + elseif compresslevel > 0 then + report_backend("forcing pdf version %s.%s, compression level %s, object compression disabled", + majorversion,minorversion,compresslevel) + else + report_backend("forcing pdf version %s.%s, compression disabled", + majorversion,minorversion) + end + -- + -- context.setupcolors { -- not this way + -- cmyk = spec.cmyk_colors and variables.yes or variables.no, + -- rgb = spec.rgb_colors and variables.yes or variables.no, + -- } + -- + colors.forcesupport( + spec.gray_scale or false, + spec.rgb_colors or false, + spec.cmyk_colors or false, + spec.spot_colors or false, + spec.nchannel_colorspace or false + ) + transparencies.forcesupport( + spec.transparency or false + ) + viewerlayers.forcesupport( + spec.optional_content or false + ) + viewerlayers.setfeatures( + spec.has_order or false -- new + ) + -- + -- spec.jbig2_compression : todo, block in image inclusion + -- spec.jpeg2000_compression : todo, block in image inclusion + -- + if type(inject_metadata) == "function" then + inject_metadata() + end + local options = settings_to_hash(option) + handleiccprofile("color profile",spec,profile,filename,handledefaultprofile,options,true) + handleiccprofile("output intent",spec,intent,filename,handleoutputintent,options,false) + if trace_variables then + for k, v in table.sortedhash(formats.default) do + local v = formatspecification[k] + if type(v) ~= "function" then + report_backend("%s = %s",k,tostring(v or false)) + end + end + end + function codeinjections.setformat(noname) + report_backend("error, format is already set to '%s', ignoring '%s'",formatname,noname.format) + end + else + report_backend("error, format '%s' is not supported",format) + end + end +end + +directives.register("backend.format", function(v) -- table ! + local tv = type(v) + if tv == "table" then + codeinjections.setformat(v) + elseif tv == "string" then + codeinjections.setformat { format = v } + end +end) + +function commands.setformat(s) + codeinjections.setformat(s) +end + +function codeinjections.getformatoption(key) + return formatspecification and formatspecification[key] +end + +function codeinjections.supportedformats() + local t = { } + for k, v in table.sortedhash(formats) do + if find(k,"pdf") then + t[#t+1] = k + end + end + return t +end + +--~ The following is somewhat cleaner but then we need to flag that there are +--~ color spaces set so that the page flusher does not optimize the (at that +--~ moment) still empty array away. So, next(d_colorspaces) should then become +--~ a different test, i.e. also on flag. I'll add that when we need more forward +--~ referencing. +--~ +--~ local function embedprofile = handledefaultprofile +--~ +--~ local function flushembeddedprofiles() +--~ for colorspace, filename in next, defaults do +--~ embedprofile(colorspace,filename) +--~ end +--~ end +--~ +--~ local function handledefaultprofile(s) +--~ defaults[lower(s.colorspace)] = s.filename +--~ end +--~ +--~ lpdf.registerdocumentfinalizer(flushembeddedprofiles,1,"embedded color profiles") diff --git a/Master/texmf-dist/tex/context/base/lpdf-grp.lua b/Master/texmf-dist/tex/context/base/lpdf-grp.lua index ad01e4d4f5a..2f7684a4da8 100644 --- a/Master/texmf-dist/tex/context/base/lpdf-grp.lua +++ b/Master/texmf-dist/tex/context/base/lpdf-grp.lua @@ -8,6 +8,14 @@ if not modules then modules = { } end modules ['lpdf-grp'] = { local format = string.format +local backends, lpdf = backends, lpdf + +local nodeinjections = backends.pdf.nodeinjections + +local colors = attributes.colors +local basepoints = number.dimenfactors["bp"] +local inches = number.dimenfactors["in"] + local nodeinjections = backends.pdf.nodeinjections local codeinjections = backends.pdf.codeinjections local registrations = backends.pdf.registrations @@ -15,10 +23,17 @@ local registrations = backends.pdf.registrations local pdfdictionary = lpdf.dictionary local pdfarray = lpdf.array local pdfconstant = lpdf.constant +local pdfboolean = lpdf.boolean local pdfreference = lpdf.reference local pdfflushobject = lpdf.flushobject -local function shade(stype,name,domain,color_a,color_b,n,colorspace,coordinates) +-- can also be done indirectly: +-- +-- 12 : << /AntiAlias false /ColorSpace 8 0 R /Coords [ 0.0 0.0 1.0 0.0 ] /Domain [ 0.0 1.0 ] /Extend [ true true ] /Function 22 0 R /ShadingType 2 >> +-- 22 : << /Bounds [ ] /Domain [ 0.0 1.0 ] /Encode [ 0.0 1.0 ] /FunctionType 3 /Functions [ 31 0 R ] >> +-- 31 : << /C0 [ 1.0 0.0 ] /C1 [ 0.0 1.0 ] /Domain [ 0.0 1.0 ] /FunctionType 2 /N 1.0 >> + +local function shade(stype,name,domain,color_a,color_b,n,colorspace,coordinates,separation) local f = pdfdictionary { FunctionType = 2, Domain = pdfarray(domain), -- domain is actually a string @@ -26,22 +41,24 @@ local function shade(stype,name,domain,color_a,color_b,n,colorspace,coordinates) C1 = pdfarray(color_b), N = tonumber(n), } + separation = separation and registrations.getspotcolorreference(separation) local s = pdfdictionary { ShadingType = stype, - ColorSpace = pdfconstant(colorspace), + ColorSpace = separation and pdfreference(separation) or pdfconstant(colorspace), Function = pdfreference(pdfflushobject(f)), Coords = pdfarray(coordinates), Extend = pdfarray { true, true }, + AntiAlias = pdfboolean(true), } lpdf.adddocumentshade(name,pdfreference(pdfflushobject(s))) end -function lpdf.circularshade(name,domain,color_a,color_b,n,colorspace,coordinates) - shade(3,name,domain,color_a,color_b,n,colorspace,coordinates) +function lpdf.circularshade(name,domain,color_a,color_b,n,colorspace,coordinates,separation) + shade(3,name,domain,color_a,color_b,n,colorspace,coordinates,separation) end -function lpdf.linearshade(name,domain,color_a,color_b,n,colorspace,coordinates) - shade(2,name,domain,color_a,color_b,n,colorspace,coordinates) +function lpdf.linearshade(name,domain,color_a,color_b,n,colorspace,coordinates,separation) + shade(2,name,domain,color_a,color_b,n,colorspace,coordinates,separation) end function lpdf.colorspec(model,ca,default) @@ -66,3 +83,68 @@ function lpdf.colorspec(model,ca,default) return default end end + +-- inline bitmaps but xform'd +-- +-- we could derive the colorspace if we strip the data +-- and divide by x*y + +local template = "q BI %s ID %s > EI Q" +local factor = 72/300 + +function nodeinjections.injectbitmap(t) + -- encoding is ascii hex, no checking here + local xresolution, yresolution = t.xresolution or 0, t.yresolution or 0 + if xresolution == 0 or yresolution == 0 then + return -- fatal error + end + local colorspace = t.colorspace + if colorspace ~= "rgb" and colorspace ~= "cmyk" and colorspace ~= "gray" then + -- not that efficient but ok + local d = string.gsub(t.data,"[^0-9a-f]","") + local b = math.round(#d / (xresolution * yresolution)) + if b == 2 then + colorspace = "gray" + elseif b == 6 then + colorspace = "rgb" + elseif b == 8 then + colorspace = "cmyk" + end + end + if colorspace == "gray" then + colorspace = pdfconstant("DeviceGray") + elseif colorspace == "rgb" then + colorspace = pdfconstant("DeviceRGB") + elseif colorspace == "cmyk" then + colorspace = pdfconstant("DeviceCMYK") + else + return -- fatal error + end + local d = pdfdictionary { + W = xresolution, + H = yresolution, + CS = colorspace, + BPC = 8, + F = pdfconstant("AHx"), + } + -- for some reasons it only works well if we take a 1bp boundingbox + local urx, ury = 1/basepoints, 1/basepoints + -- urx = (xresolution/300)/basepoints + -- ury = (yresolution/300)/basepoints + local width, height = t.width or 0, t.height or 0 + if width == 0 and height == 0 then + width = factor * xresolution / basepoints + height = factor * yresolution / basepoints + elseif width == 0 then + width = height * xresolution / yresolution + elseif height == 0 then + height = width * yresolution / xresolution + end + local image = img.new { + stream = format(template,d(),t.data), + width = width, + height = height, + bbox = { 0, 0, urx, ury }, + } + return img.node(image) +end diff --git a/Master/texmf-dist/tex/context/base/lpdf-ini.lua b/Master/texmf-dist/tex/context/base/lpdf-ini.lua index e0ffd40521b..74ecb36de74 100644 --- a/Master/texmf-dist/tex/context/base/lpdf-ini.lua +++ b/Master/texmf-dist/tex/context/base/lpdf-ini.lua @@ -9,33 +9,54 @@ if not modules then modules = { } end modules ['lpdf-ini'] = { local setmetatable, getmetatable, type, next, tostring, tonumber, rawset = setmetatable, getmetatable, type, next, tostring, tonumber, rawset local char, byte, format, gsub, concat, match, sub, gmatch = string.char, string.byte, string.format, string.gsub, table.concat, string.match, string.sub, string.gmatch local utfvalues = string.utfvalues -local texwrite, texset, texsprint, ctxcatcodes = tex.write, tex.set, tex.sprint, tex.ctxcatcodes +local texset = tex.set local sind, cosd = math.sind, math.cosd local lpegmatch = lpeg.match -local pdfreserveobj = pdf and pdf.reserveobj or function() return 1 end -- for testing -local pdfimmediateobj = pdf and pdf.immediateobj or function() return 2 end -- for testing +--~ local pdfreserveobject = pdf and pdf.reserveobj or function() return 1 end -- for testing +--~ local pdfimmediateobject = pdf and pdf.immediateobj or function() return 2 end -- for testing + +local pdfreserveobject = pdf.reserveobj +local pdfimmediateobject = pdf.immediateobj +local pdfdeferredobject = pdf.obj +local pdfreferenceobject = pdf.refobj local trace_finalizers = false trackers.register("backend.finalizers", function(v) trace_finalizers = v end) local trace_resources = false trackers.register("backend.resources", function(v) trace_resources = v end) local trace_objects = false trackers.register("backend.objects", function(v) trace_objects = v end) local trace_detail = false trackers.register("backend.detail", function(v) trace_detail = v end) -lpdf = lpdf or { } +local report_objects = logs.reporter("backend","objects") +local report_finalizing = logs.reporter("backend","finalizing") + +local backends, context = backends, context + +backends.pdf = backends.pdf or { + comment = "backend for directly generating pdf output", + nodeinjections = { }, + codeinjections = { }, + registrations = { }, + tables = { }, +} + +lpdf = lpdf or { } +local lpdf = lpdf local function tosixteen(str) if not str or str == "" then - return "()" + return "" -- not () as we want an indication that it's unicode else - local r = { ">" end else - local r = { } + local r, rn = { }, 0 for k, v in next, t do + rn = rn + 1 local tv = type(v) if tv == "string" then - r[#r+1] = format("/%s %s",k,toeight(v)) + r[rn] = format("/%s %s",k,toeight(v)) elseif tv == "unicode" then - r[#r+1] = format("/%s %s",k,tosixteen(v)) + r[rn] = format("/%s %s",k,tosixteen(v)) elseif tv == "table" then local mv = getmetatable(v) if mv and mv.__lpdftype then - r[#r+1] = format("/%s %s",k,tostring(v)) + r[rn] = format("/%s %s",k,tostring(v)) elseif v[1] then - r[#r+1] = format("/%s %s",k,tostring_a(v)) + r[rn] = format("/%s %s",k,tostring_a(v)) else - r[#r+1] = format("/%s %s",k,tostring_d(v)) + r[rn] = format("/%s %s",k,tostring_d(v)) end else - r[#r+1] = format("/%s %s",k,tostring(v)) + r[rn] = format("/%s %s",k,tostring(v)) end end if contentonly then @@ -128,7 +150,8 @@ tostring_d = function(t,contentonly,key) end tostring_a = function(t,contentonly,key) - if #t == 0 then + local tn = #t + if tn == 0 then if contentonly then return "" else @@ -136,24 +159,25 @@ tostring_a = function(t,contentonly,key) end else local r = { } - for k, v in next, t do + for k=1,tn do + local v = t[k] local tv = type(v) if tv == "string" then - r[#r+1] = toeight(v) + r[k] = toeight(v) elseif tv == "unicode" then - r[#r+1] = tosixteen(v) + r[k] = tosixteen(v) elseif tv == "table" then local mv = getmetatable(v) local mt = mv and mv.__lpdftype if mt then - r[#r+1] = tostring(v) + r[k] = tostring(v) elseif v[1] then - r[#r+1] = tostring_a(v) + r[k] = tostring_a(v) else - r[#r+1] = tostring_d(v) + r[k] = tostring_d(v) end else - r[#r+1] = tostring(v) + r[k] = tostring(v) end end if contentonly then @@ -174,7 +198,7 @@ local tostring_c = function(t) return t[1] end -- already prefixed (h local tostring_z = function() return "null" end local tostring_t = function() return "true" end local tostring_f = function() return "false" end -local tostring_r = function(t) return t[1] .. " 0 R" end +local tostring_r = function(t) local n = t[1] return n and n > 0 and (n .. " 0 R") or "NULL" end local tostring_v = function(t) local s = t[1] @@ -185,18 +209,18 @@ local tostring_v = function(t) end end -local function value_x(t) return t end -- the call is experimental -local function value_s(t,key) return t[1] end -- the call is experimental -local function value_u(t,key) return t[1] end -- the call is experimental -local function value_n(t,key) return t[1] end -- the call is experimental -local function value_c(t) return sub(t[1],2) end -- the call is experimental -local function value_d(t) return tostring_d(t,true,key) end -- the call is experimental -local function value_a(t) return tostring_a(t,true,key) end -- the call is experimental -local function value_z() return nil end -- the call is experimental -local function value_t(t) return t.value or true end -- the call is experimental -local function value_f(t) return t.value or false end -- the call is experimental -local function value_r() return t[1] end -- the call is experimental -local function value_v() return t[1] end -- the call is experimental +local function value_x(t) return t end -- the call is experimental +local function value_s(t,key) return t[1] end -- the call is experimental +local function value_u(t,key) return t[1] end -- the call is experimental +local function value_n(t,key) return t[1] end -- the call is experimental +local function value_c(t) return sub(t[1],2) end -- the call is experimental +local function value_d(t) return tostring_d(t,true) end -- the call is experimental +local function value_a(t) return tostring_a(t,true) end -- the call is experimental +local function value_z() return nil end -- the call is experimental +local function value_t(t) return t.value or true end -- the call is experimental +local function value_f(t) return t.value or false end -- the call is experimental +local function value_r() return t[1] or 0 end -- the call is experimental -- NULL +local function value_v() return t[1] end -- the call is experimental local function add_x(t,k,v) rawset(t,k,tostring(v)) end @@ -305,7 +329,7 @@ local function pdfverbose(t) -- maybe check for type return setmetatable({ t or "" },mt_v) end -lpdf.stream = pdfstream +lpdf.stream = pdfstream -- THIS WILL PROBABLY CHANGE lpdf.dictionary = pdfdictionary lpdf.array = pdfarray lpdf.string = pdfstring @@ -329,55 +353,91 @@ lpdf.verbose = pdfverbose local names, cache = { }, { } function lpdf.reserveobject(name) - local r = pdfreserveobj() - if name then - names[name] = r - if trace_objects then - logs.report("backends", "reserving object number %s under name '%s'",r,name) + if name == "annot" then + -- catch misuse + return pdfreserveobject("annot") + else + local r = pdfreserveobject() + if name then + names[name] = r + if trace_objects then + report_objects("reserving number %s under name '%s'",r,name) + end + elseif trace_objects then + report_objects("reserving number %s",r) end - elseif trace_objects then - logs.report("backends", "reserving object number %s",r) + return r end - return r end ---~ local pdfreserveobject = lpdf.reserveobject +function lpdf.reserveannotation() + return pdfreserveobject("annot") +end + +lpdf.immediateobject = pdfimmediateobject +lpdf.object = pdfdeferredobject -- the table interface, todo: auto attr() and so +lpdf.deferredobject = pdfdeferredobject +lpdf.referenceobject = pdfreferenceobject +lpdf.pagereference = pdf.pageref or tex.pdfpageref +lpdf.registerannotation = pdf.registerannot + +function lpdf.delayedobject(data) + local n = pdfdeferredobject(data) + pdfreferenceobject(n) + return n +end function lpdf.flushobject(name,data) if data then - name = names[name] or name - if name then - if trace_objects then - if trace_detail then - logs.report("backends", "flushing object data to reserved object with name '%s' -> %s",name,tostring(data)) - else - logs.report("backends", "flushing object data to reserved object with name '%s'",name) - end + local named = names[name] + if named then + if not trace_objects then + elseif trace_detail then + report_objects("flushing data to reserved object with name '%s' -> %s",name,tostring(data)) + else + report_objects("flushing data to reserved object with name '%s'",name) end - return pdfimmediateobj(name,tostring(data)) + return pdfimmediateobject(named,tostring(data)) else - if trace_objects then - if trace_detail then - logs.report("backends", "flushing object data to reserved object with number %s -> %s",name,tostring(data)) - else - logs.report("backends", "flushing object data to reserved object with number %s",name) - end + if not trace_objects then + elseif trace_detail then + report_objects("flushing data to reserved object with number %s -> %s",name,tostring(data)) + else + report_objects("flushing data to reserved object with number %s",name) end - return pdfimmediateobj(tostring(data)) + return pdfimmediateobject(name,tostring(data)) end else if trace_objects and trace_detail then - logs.report("backends", "flushing object data -> %s",tostring(name)) + report_objects("flushing data -> %s",tostring(name)) end - return pdfimmediateobj(tostring(name)) + return pdfimmediateobject(tostring(name)) + end +end + +local shareobjectcache, shareobjectreferencecache = { }, { } + +function lpdf.shareobject(content) + content = tostring(content) + local o = shareobjectcache[content] + if not o then + o = pdfimmediateobject(content) + shareobjectcache[content] = o end + return o end -function lpdf.sharedobj(content) - local r = cache[content] +function lpdf.shareobjectreference(content) + content = tostring(content) + local r = shareobjectreferencecache[content] if not r then - r = pdfreference(pdfimmediateobj(content)) - cache[content] = r + local o = shareobjectcache[content] + if not o then + o = pdfimmediateobject(content) + shareobjectcache[content] = o + end + r = pdfreference(o) + shareobjectreferencecache[content] = r end return r end @@ -445,53 +505,71 @@ local function resetpageproperties() pagesattributes = pdfdictionary() end +resetpageproperties() + local function setpageproperties() ---~ texset("global", "pdfpageresources", pageresources ()) ---~ texset("global", "pdfpageattr", pageattributes ()) ---~ texset("global", "pdfpagesattr", pagesattributes()) pdf.pageresources = pageresources () pdf.pageattributes = pageattributes () pdf.pagesattributes = pagesattributes() end -function lpdf.addtopageresources (k,v) pageresources [k] = v end -function lpdf.addtopageattributes (k,v) pageattributes [k] = v end -function lpdf.addtopagesattributes(k,v) pagesattributes[k] = v end +local function addtopageresources (k,v) pageresources [k] = v end +local function addtopageattributes (k,v) pageattributes [k] = v end +local function addtopagesattributes(k,v) pagesattributes[k] = v end -local function set(where,f,when,what) - when = when or 2 +lpdf.addtopageresources = addtopageresources +lpdf.addtopageattributes = addtopageattributes +lpdf.addtopagesattributes = addtopagesattributes + +local function set(where,what,f,when,comment) + if type(when) == "string" then + when, comment = 2, when + elseif not when then + when = 2 + end local w = where[when] - w[#w+1] = f + w[#w+1] = { f, comment } if trace_finalizers then - logs.report("backend","%s set: [%s,%s]",what,when,#w) + report_finalizing("%s set: [%s,%s]",what,when,#w) end end local function run(where,what) + if trace_finalizers then + report_finalizing("start backend: category=%s, n=%s",what,#where) + end for i=1,#where do local w = where[i] for j=1,#w do + local wj = w[j] if trace_finalizers then - logs.report("backend","%s finalizer: [%s,%s]",what,i,j) + report_finalizing("%s finalizer: [%s,%s] %s",what,i,j,wj[2] or "") end - w[j]() + wj[1]() end end + if trace_finalizers then + report_finalizing("stop finalizing") + end end -function lpdf.registerpagefinalizer(f,when) - set(pagefinalizers,f,when,"page") +local function registerpagefinalizer(f,when,comment) + set(pagefinalizers,"page",f,when,comment) end -function lpdf.registerdocumentfinalizer(f,when) - set(documentfinalizers,f,when,"document") +local function registerdocumentfinalizer(f,when,comment) + set(documentfinalizers,"document",f,when,comment) end +lpdf.registerpagefinalizer = registerpagefinalizer +lpdf.registerdocumentfinalizer = registerdocumentfinalizer + function lpdf.finalizepage() if not environment.initex then - resetpageproperties() + -- resetpageproperties() -- maybe better before run(pagefinalizers,"page") setpageproperties() + resetpageproperties() -- maybe better before end end @@ -499,63 +577,89 @@ function lpdf.finalizedocument() if not environment.initex then run(documentfinalizers,"document") function lpdf.finalizedocument() - logs.report("backend","serious error: the document is finalized multiple times") + report_finalizing("serious error: the document is finalized multiple times") function lpdf.finalizedocument() end end end end +backends.pdf.codeinjections.finalizepage = lpdf.finalizepage -- will go when we have hook + +--~ callbacks.register("finish_pdfpage", lpdf.finalizepage) +callbacks.register("finish_pdffile", lpdf.finalizedocument) + -- some minimal tracing, handy for checking the order local function trace_set(what,key) if trace_resources then - logs.report("backend", "setting key '%s' in '%s'",key,what) + report_finalizing("setting key '%s' in '%s'",key,what) end end local function trace_flush(what) if trace_resources then - logs.report("backend", "flushing '%s'",what) + report_finalizing("flushing '%s'",what) end end lpdf.protectresources = true -local catalog, info, names = pdfdictionary(), pdfdictionary(), pdfdictionary() +local catalog = pdfdictionary { Type = pdfconstant("Catalog") } -- nicer, but when we assign we nil the Type +local info = pdfdictionary { Type = pdfconstant("Info") } -- nicer, but when we assign we nil the Type +local names = pdfdictionary { Type = pdfconstant("Names") } -- nicer, but when we assign we nil the Type -local function flushcatalog() if not environment.initex then trace_flush("catalog") pdf.catalog = catalog() end end -local function flushinfo () if not environment.initex then trace_flush("info") pdf.info = info () end end -local function flushnames () if not environment.initex then trace_flush("names") pdf.names = names () end end +local function flushcatalog() if not environment.initex then trace_flush("catalog") catalog.Type = nil pdf.catalog = catalog() end end +local function flushinfo () if not environment.initex then trace_flush("info") info .Type = nil pdf.info = info () end end +local function flushnames () if not environment.initex then trace_flush("names") names .Type = nil pdf.names = names () end end function lpdf.addtocatalog(k,v) if not (lpdf.protectresources and catalog[k]) then trace_set("catalog",k) catalog[k] = v end end function lpdf.addtoinfo (k,v) if not (lpdf.protectresources and info [k]) then trace_set("info", k) info [k] = v end end function lpdf.addtonames (k,v) if not (lpdf.protectresources and names [k]) then trace_set("names", k) names [k] = v end end -local dummy = pdfreserveobj() -- else bug in hvmd due so some internal luatex conflict +local dummy = pdfreserveobject() -- else bug in hvmd due so some internal luatex conflict + +-- Some day I will implement a proper minimalized resource management. -local r_extgstates, d_extgstates = pdfreserveobj(), pdfdictionary() local p_extgstates = pdfreference(r_extgstates) -local r_colorspaces, d_colorspaces = pdfreserveobj(), pdfdictionary() local p_colorspaces = pdfreference(r_colorspaces) -local r_patterns, d_patterns = pdfreserveobj(), pdfdictionary() local p_patterns = pdfreference(r_patterns) -local r_shades, d_shades = pdfreserveobj(), pdfdictionary() local p_shades = pdfreference(r_shades) +local r_extgstates, d_extgstates = pdfreserveobject(), pdfdictionary() local p_extgstates = pdfreference(r_extgstates) +local r_colorspaces, d_colorspaces = pdfreserveobject(), pdfdictionary() local p_colorspaces = pdfreference(r_colorspaces) +local r_patterns, d_patterns = pdfreserveobject(), pdfdictionary() local p_patterns = pdfreference(r_patterns) +local r_shades, d_shades = pdfreserveobject(), pdfdictionary() local p_shades = pdfreference(r_shades) -local function checkextgstates () if next(d_extgstates ) then lpdf.addtopageresources("ExtGState", p_extgstates ) end end -local function checkcolorspaces() if next(d_colorspaces) then lpdf.addtopageresources("ColorSpace",p_colorspaces) end end -local function checkpatterns () if next(d_patterns ) then lpdf.addtopageresources("Pattern", p_patterns ) end end -local function checkshades () if next(d_shades ) then lpdf.addtopageresources("Shading", p_shades ) end end +local function checkextgstates () if next(d_extgstates ) then addtopageresources("ExtGState", p_extgstates ) end end +local function checkcolorspaces() if next(d_colorspaces) then addtopageresources("ColorSpace",p_colorspaces) end end +local function checkpatterns () if next(d_patterns ) then addtopageresources("Pattern", p_patterns ) end end +local function checkshades () if next(d_shades ) then addtopageresources("Shading", p_shades ) end end -local function flushextgstates () if next(d_extgstates ) then trace_flush("extgstates") pdfimmediateobj(r_extgstates, tostring(d_extgstates )) end end -local function flushcolorspaces() if next(d_colorspaces) then trace_flush("colorspaces") pdfimmediateobj(r_colorspaces,tostring(d_colorspaces)) end end -local function flushpatterns () if next(d_patterns ) then trace_flush("patterns") pdfimmediateobj(r_patterns, tostring(d_patterns )) end end -local function flushshades () if next(d_shades ) then trace_flush("shades") pdfimmediateobj(r_shades, tostring(d_shades )) end end +local function flushextgstates () if next(d_extgstates ) then trace_flush("extgstates") pdfimmediateobject(r_extgstates, tostring(d_extgstates )) end end +local function flushcolorspaces() if next(d_colorspaces) then trace_flush("colorspaces") pdfimmediateobject(r_colorspaces,tostring(d_colorspaces)) end end +local function flushpatterns () if next(d_patterns ) then trace_flush("patterns") pdfimmediateobject(r_patterns, tostring(d_patterns )) end end +local function flushshades () if next(d_shades ) then trace_flush("shades") pdfimmediateobject(r_shades, tostring(d_shades )) end end -local collected = pdfdictionary { - ExtGState = p_extgstates, - ColorSpace = p_colorspaces, - Pattern = p_patterns, - Shading = p_shades, -} ; collected = collected() +--~ local collected = pdfdictionary { +--~ ExtGState = p_extgstates, +--~ ColorSpace = p_colorspaces, +--~ Pattern = p_patterns, +--~ Shading = p_shades, +--~ } ; collected = collected() + +--~ function lpdf.collectedresources() +--~ context(collected) +--~ end function lpdf.collectedresources() - tex.sprint(tex.ctxcatcodes,collected) + local ExtGState = next(d_extgstates ) and p_extgstates + local ColorSpace = next(d_colorspaces) and p_colorspaces + local Pattern = next(d_patterns ) and p_patterns + local Shading = next(d_shades ) and p_shades + if ExtGState or ColorSpace or Pattern or Shading then + local collected = pdfdictionary { + ExtGState = ExtGState, + ColorSpace = ColorSpace, + Pattern = Pattern, + Shading = Shading, + -- ProcSet = pdfarray { pdfconstant("PDF") }, + } + context(collected()) + end end function lpdf.adddocumentextgstate (k,v) d_extgstates [k] = v end @@ -563,25 +667,25 @@ function lpdf.adddocumentcolorspace(k,v) d_colorspaces[k] = v end function lpdf.adddocumentpattern (k,v) d_patterns [k] = v end function lpdf.adddocumentshade (k,v) d_shades [k] = v end -lpdf.registerdocumentfinalizer(flushextgstates,3) -lpdf.registerdocumentfinalizer(flushcolorspaces,3) -lpdf.registerdocumentfinalizer(flushpatterns,3) -lpdf.registerdocumentfinalizer(flushshades,3) +registerdocumentfinalizer(flushextgstates,3,"extended graphic states") +registerdocumentfinalizer(flushcolorspaces,3,"color spaces") +registerdocumentfinalizer(flushpatterns,3,"patterns") +registerdocumentfinalizer(flushshades,3,"shades") -lpdf.registerdocumentfinalizer(flushcatalog,3) -lpdf.registerdocumentfinalizer(flushinfo,3) -lpdf.registerdocumentfinalizer(flushnames,3) +registerdocumentfinalizer(flushcatalog,3,"catalog") +registerdocumentfinalizer(flushinfo,3,"info") +registerdocumentfinalizer(flushnames,3,"names") -- before catalog -lpdf.registerpagefinalizer(checkextgstates,3) -lpdf.registerpagefinalizer(checkcolorspaces,3) -lpdf.registerpagefinalizer(checkpatterns,3) -lpdf.registerpagefinalizer(checkshades,3) +registerpagefinalizer(checkextgstates,3,"extended graphic states") +registerpagefinalizer(checkcolorspaces,3,"color spaces") +registerpagefinalizer(checkpatterns,3,"patterns") +registerpagefinalizer(checkshades,3,"shades") --- in strc-bkm: lpdf.registerdocumentfinalizer(function() structure.bookmarks.place() end,1) +-- in strc-bkm: lpdf.registerdocumentfinalizer(function() structures.bookmarks.place() end,1) function lpdf.rotationcm(a) local s, c = sind(a), cosd(a) - texwrite(format("%s %s %s %s 0 0 cm",c,s,-s,c)) + context("%s %s %s %s 0 0 cm",c,s,-s,c) end -- ! -> universaltime @@ -601,36 +705,36 @@ function lpdf.id() return format("%s.%s",tex.jobname,timestamp) end -function lpdf.checkedkey(t,key,kind) +function lpdf.checkedkey(t,key,variant) local pn = t[key] if pn then local tn = type(pn) - if tn == kind then - if kind == "string" then - return pn ~= "" and pn - elseif kind == "table" then - return next(pn) and pn + if tn == variant then + if variant == "string" then + return pn ~= "" and pn or nil + elseif variant == "table" then + return next(pn) and pn or nil else return pn end - elseif tn == "string" and kind == "number" then + elseif tn == "string" and variant == "number" then return tonumber(pn) end end end -function lpdf.checkedvalue(value,kind) -- code not shared +function lpdf.checkedvalue(value,variant) -- code not shared if value then local tv = type(value) - if tv == kind then - if kind == "string" then + if tv == variant then + if variant == "string" then return value ~= "" and value - elseif kind == "table" then + elseif variant == "table" then return next(value) and value else return value end - elseif tv == "string" and kind == "number" then + elseif tv == "string" and variant == "number" then return tonumber(value) end end @@ -658,13 +762,29 @@ end -- lpdf.addtoinfo("ConTeXt.Jobname", tex.jobname) -- lpdf.addtoinfo("ConTeXt.Url", "www.pragma-ade.com") --- saves definitions later on +if not pdfreferenceobject then -backends = backends or { } -backends.pdf = backends.pdf or { - comment = "backend for directly generating pdf output", - nodeinjections = { }, - codeinjections = { }, - registrations = { }, - helpers = { }, -} + local delayed = { } + + local function flush() + local n = 0 + for k,v in next, delayed do + pdfimmediateobject(k,v) + n = n + 1 + end + if trace_objects then + report_objects("%s objects flushed",n) + end + delayed = { } + end + + lpdf.registerdocumentfinalizer(flush,3,"objects") -- so we need a final flush too + lpdf.registerpagefinalizer (flush,3,"objects") -- somehow this lags behind .. I need to look into that some day + + function lpdf.delayedobject(data) + local n = pdfreserveobject() + delayed[n] = data + return n + end + +end diff --git a/Master/texmf-dist/tex/context/base/lpdf-ini.mkiv b/Master/texmf-dist/tex/context/base/lpdf-ini.mkiv deleted file mode 100644 index 7c7dce3efb3..00000000000 --- a/Master/texmf-dist/tex/context/base/lpdf-ini.mkiv +++ /dev/null @@ -1,271 +0,0 @@ -%D \module -%D [ file=lpdf-ini, -%D version=2009.04.15, -%D title=\CONTEXT\ Backend Macros, -%D subtitle=PDF, -%D author=Hans Hagen, -%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. - -\writestatus{loading}{ConTeXt Backend Macros / PDF} - -\registerctxluafile{lpdf-ini}{1.001} -\registerctxluafile{lpdf-xmp}{1.001} -\registerctxluafile{lpdf-nod}{1.001} -%registerctxluafile{lpdf-col}{1.001} % will be loaded later -\registerctxluafile{lpdf-mis}{1.001} -\registerctxluafile{lpdf-ano}{1.001} -\registerctxluafile{lpdf-ren}{1.001} -\registerctxluafile{lpdf-grp}{1.001} -\registerctxluafile{lpdf-wid}{1.001} -\registerctxluafile{lpdf-fld}{1.001} -\registerctxluafile{lpdf-u3d}{1.001} -\registerctxluafile{lpdf-swf}{1.001} - -\unprotect - -% for the moment here - -%D \macros -%D {doovalbox} -%D -%D Drawing frames with round corners is inherited from the -%D main module. -%D -%D For drawing ovals we use quite raw \PDF\ code. The next -%D implementation does not differ that much from the one -%D implemented in the \POSTSCRIPT\ driver. This code is -%D somewhat obsolete as we now have metapost embedded. - -\def\doPDFovalcalc#1#2#3% - {\PointsToBigPoints{\dimexpr#1+#2\relax}#3} - -\def\doovalbox#1#2#3#4#5#6#7#8% todo: \scratchdimen/\scatchbox - {\forcecolorhack - \bgroup - \dimen0=#4\divide\dimen0 \plustwo - \doPDFovalcalc{0pt}{+\dimen0}\xmin - \doPDFovalcalc{#1}{-\dimen0}\xmax - \doPDFovalcalc{#2}{-\dimen0}\ymax - \doPDFovalcalc{-#3}{+\dimen0}\ymin - \advance\dimen0 by #5% - \doPDFovalcalc{0pt}{+\dimen0}\xxmin - \doPDFovalcalc{#1}{-\dimen0}\xxmax - \doPDFovalcalc{#2}{-\dimen0}\yymax - \doPDFovalcalc{-#3}{+\dimen0}\yymin - \doPDFovalcalc{#4}{\zeropoint}\stroke - \doPDFovalcalc{#5}{\zeropoint}\radius - \edef\dostroke{#6}% - \edef\dofill{#7}% - \edef\mode{\number#8 \space}% - % no \ifcase, else \relax in pdfcode - \setbox\scratchbox\hbox - {\ifnum\dostroke\dofill>\zerocount - \pdfliteral - {q - \stroke\space w - \ifcase\mode - \xxmin\space \ymin \space m - \xxmax\space \ymin \space l - \xmax \space \ymin \space \xmax \space \yymin\space y - \xmax \space \yymax\space l - \xmax \space \ymax \space \xxmax\space \ymax \space y - \xxmin\space \ymax \space l - \xmin \space \ymax \space \xmin \space \yymax\space y - \xmin \space \yymin\space l - \xmin \space \ymin \space \xxmin\space \ymin \space y - h - \or % 1 - \xxmin\space \ymin \space m - \xxmax\space \ymin \space l - \xmax \space \ymin \space \xmax \space \yymin\space y - \xmax \space \ymax \space l - \xmin \space \ymax \space l - \xmin \space \yymin\space l - \xmin \space \ymin \space \xxmin\space \ymin \space y - h - \or % 2 - \xxmin\space \ymin \space m - \xmax \space \ymin \space l - \xmax \space \ymax \space l - \xxmin\space \ymax \space l - \xmin \space \ymax \space \xmin \space \yymax\space y - \xmin \space \yymin\space l - \xmin \space \ymin \space \xxmin\space \ymin \space y - h - \or % 3 - \xmin \space \ymin \space m - \xmax \space \ymin \space l - \xmax \space \yymax\space l - \xmax \space \ymax \space \xxmax\space \ymax \space y - \xxmin\space \ymax \space l - \xmin \space \ymax \space \xmin \space \yymax\space y - \xmin \space \ymin \space l - h - \or % 4 - \xmin \space \ymin \space m - \xxmax\space \ymin \space l - \xmax \space \ymin \space \xmax \space \yymin\space y - \xmax \space \yymax\space l - \xmax \space \ymax \space \xxmax\space \ymax \space y - \xmin \space \ymax \space l - \xmin \space \ymin\space l - h - \or % 5 - \xmin \space \ymin \space m - \xmax \space \ymin \space l - \xmax \space \yymax\space l - \xmax \space \ymax \space \xxmax\space \ymax \space y - \xmin \space \ymax \space l - \xmin \space \ymin \space l - h - \or % 6 - \xmin \space \ymin \space m - \xxmax\space \ymin \space l - \xmax \space \ymin \space \xmax \space \yymin\space y - \xmax \space \ymax \space l - \xmin \space \ymax \space l - \xmin \space \ymin \space l - h - \or - \xxmin\space \ymin \space m - \xmax \space \ymin \space l - \xmax \space \ymax \space l - \xmin \space \ymax \space l - \xmin \space \yymin\space l - \xmin \space \ymin \space \xxmin\space \ymin \space y - h - \or - \xmin \space \ymin \space m - \xmax \space \ymin \space l - \xmax \space \ymax \space l - \xxmin\space \ymax \space l - \xmin \space \ymax \space \xmin \space \yymax\space y - \xmin \space \ymin \space l - h - \or % 9 top open - \xmin \space \ymax \space m - \xmin \space \yymin\space l - \xmin \space \ymin \space \xxmin\space \ymin \space y - \xxmax\space \ymin \space l - \xmax \space \ymin \space \xmax \space \yymin\space y - \xmax \space \ymax \space l - \or % 10 right open - \xmax \space \ymax \space m - \xxmin\space \ymax \space l - \xmin \space \ymax \space \xmin \space \yymax\space y - \xmin \space \yymin\space l - \xmin \space \ymin \space \xxmin\space \ymin \space y - \xmax\space \ymin \space l - \or % 11 bottom open - \xmax \space \ymin \space m - \xmax \space \yymax\space l - \xmax \space \ymax \space \xxmax \space \ymax\space y - \xxmin\space \ymax \space l - \xmin \space \ymax \space \xmin \space \yymax\space y - \xmin \space \ymin \space l - \or % 12 left open - \xmin \space \ymax \space m - \xxmax\space \ymax \space l - \xmax \space \ymax \space \xmax \space \yymax\space y - \xmax \space \yymin\space l - \xmax \space \ymin \space \xxmax\space \ymin \space y - \xmin \space \ymin \space l - \or % 13 - \xmin \space \ymax \space m - \xxmax\space \ymax \space l - \xmax \space \ymax \space \xmax \space \yymax\space y - \xmax\space \ymin \space l - \or % 14 - \xmax \space \ymax \space m - \xmax \space \yymin\space l - \xmax \space \ymin \space \xxmax\space \ymin \space y - \xmin \space \ymin \space l - \or % 15 - \xmax \space \ymin \space m - \xxmin\space \ymin \space l - \xmin \space \ymin \space \xmin \space \yymin\space y - \xmin \space \ymax \space l - \or % 16 - \xmin \space \ymin \space m - \xmin \space \yymax\space l - \xmin \space \ymax \space \xxmin\space \ymax \space y - \xmax \space \ymax \space l - \or % 17 - \xxmax\space \ymax \space m - \xmax \space \ymax \space \xmax \space \yymax\space y - \or % 18 - \xmax \space \yymin\space m - \xmax \space \ymin \space \xxmax\space \ymin \space y - \or % 19 - \xxmin\space \ymin \space m - \xmin \space \ymin \space \xmin \space \yymin\space y - \or % 20 - \xmin \space \yymax\space m - \xmin \space \ymax \space \xxmin\space \ymax \space y - \or % 21 - \xxmax\space \ymax \space m - \xmax \space \ymax \space \xmax \space \yymax\space y - \xmin \space \yymax\space m - \xmin \space \ymax \space \xxmin\space \ymax \space y - \or % 22 - \xxmax\space \ymax \space m - \xmax \space \ymax \space \xmax \space \yymax\space y - \xmax \space \yymin\space m - \xmax \space \ymin \space \xxmax\space \ymin \space y - \or % 23 - \xmax \space \yymin\space m - \xmax \space \ymin \space \xxmax\space \ymin \space y - \xxmin\space \ymin \space m - \xmin \space \ymin \space \xmin \space \yymin\space y - \or % 24 - \xxmin\space \ymin \space m - \xmin \space \ymin \space \xmin \space \yymin\space y - \xmin \space \yymax\space m - \xmin \space \ymax \space \xxmin\space \ymax \space y - \or % 25 - \xxmax\space \ymax \space m - \xmax \space \ymax \space \xmax \space \yymax\space y - \xmax \space \yymin\space m - \xmax \space \ymin \space \xxmax\space \ymin \space y - \xxmin\space \ymin \space m - \xmin \space \ymin \space \xmin \space \yymin\space y - \xmin \space \yymax\space m - \xmin \space \ymax \space \xxmin\space \ymax \space y - \or % 26 - \xmax \space \yymin\space m - \xmax \space \ymin \space \xxmax\space \ymin \space y - \xmin \space \yymax\space m - \xmin \space \ymax \space \xxmin\space \ymax \space y - \or % 27 - \xxmax\space \ymax \space m - \xmax \space \ymax \space \xmax \space \yymax\space y - \xxmin\space \ymin \space m - \xmin \space \ymin \space \xmin \space \yymin\space y - \or % 28 - \fi - \ifnum\mode>8 - S - \else - \ifnum\dostroke=\plusone S \fi - \ifnum\dofill =\plusone f \fi - \fi - Q}% - \fi}% - \wd\scratchbox#1\ht\scratchbox#2\dp\scratchbox#3\box\scratchbox - \egroup} - -\unexpanded\def\pdfactualtext#1#2% - {\pdfliteral direct{/Span <> BDC}% - #1% - \pdfliteral direct{EMC}} - -% \starttext -% text \pdfactualtext{Meier}{Müller} text -% \stoptext - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lpdf-mis.lua b/Master/texmf-dist/tex/context/base/lpdf-mis.lua index a68c7b4873d..426c00286a9 100644 --- a/Master/texmf-dist/tex/context/base/lpdf-mis.lua +++ b/Master/texmf-dist/tex/context/base/lpdf-mis.lua @@ -17,8 +17,9 @@ if not modules then modules = { } end modules ['lpdf-mis'] = { local next, tostring = next, tostring local format = string.format -local texsprint, texset = tex.sprint, tex.set -local ctxcatcodes = tex.ctxcatcodes +local texset = tex.set + +local backends, lpdf, nodes = backends, lpdf, nodes local nodeinjections = backends.pdf.nodeinjections local codeinjections = backends.pdf.codeinjections @@ -26,22 +27,22 @@ local registrations = backends.pdf.registrations local copy_node = node.copy -local pdfliteral, register = nodes.pdfliteral, nodes.register +local nodepool = nodes.pool -local pdfdictionary = lpdf.dictionary -local pdfarray = lpdf.array -local pdfboolean = lpdf.boolean -local pdfconstant = lpdf.constant -local pdfreference = lpdf.reference -local pdfunicode = lpdf.unicode -local pdfverbose = lpdf.verbose -local pdfstring = lpdf.string -local pdfflushobject = lpdf.flushobject +local pdfliteral, register = nodepool.pdfliteral, nodepool.register -local pdfimmediateobj = pdf.immediateobj +local pdfdictionary = lpdf.dictionary +local pdfarray = lpdf.array +local pdfboolean = lpdf.boolean +local pdfconstant = lpdf.constant +local pdfreference = lpdf.reference +local pdfunicode = lpdf.unicode +local pdfverbose = lpdf.verbose +local pdfstring = lpdf.string +local pdfflushobject = lpdf.flushobject +local pdfimmediateobject = lpdf.immediateobject -local tobasepoints = number.tobasepoints -local variables = interfaces.variables +local variables = interfaces.variables -- @@ -58,7 +59,7 @@ local function initializenegative() Range = a, Domain = a, } - local negative = pdfdictionary { Type = g, TR = pdfreference(pdf.immediateobj("stream","1 exch sub",d())) } + local negative = pdfdictionary { Type = g, TR = pdfreference(pdfimmediateobject("stream","1 exch sub",d())) } local positive = pdfdictionary { Type = g, TR = pdfconstant("Identity") } lpdf.adddocumentextgstate("GSnegative", pdfreference(pdfflushobject(negative))) lpdf.adddocumentextgstate("GSPositive", pdfreference(pdfflushobject(positive))) @@ -108,20 +109,28 @@ end local openpage, closepage, opendocument, closedocument -function codeinjections.flushdocumentactions(open,close) - opendocument, closedocument = open, close +function codeinjections.registerdocumentopenaction(open) + opendocument = open +end + +function codeinjections.registerdocumentcloseaction(close) + closedocument = close end -function codeinjections.flushpageactions(open,close) - openpage, closepage = open, close +function codeinjections.registerpageopenaction(open) + openpage = open +end + +function codeinjections.registerpagecloseaction(close) + closepage = close end local function flushdocumentactions() if opendocument then - lpdf.addtocatalog("OpenAction",lpdf.pdfaction(opendocument)) + lpdf.addtocatalog("OpenAction",lpdf.action(opendocument)) end if closedocument then - lpdf.addtocatalog("CloseAction",lpdf.pdfaction(closedocument)) + lpdf.addtocatalog("CloseAction",lpdf.action(closedocument)) end end @@ -129,39 +138,50 @@ local function flushpageactions() if openpage or closepage then local d = pdfdictionary() if openpage then - d.O = lpdf.pdfaction(openpage) + d.O = lpdf.action(openpage) end if closepage then - d.C = lpdf.pdfaction(closepage) + d.C = lpdf.action(closepage) end lpdf.addtopageattributes("AA",d) end end -lpdf.registerpagefinalizer(flushpageactions) -lpdf.registerdocumentfinalizer(flushdocumentactions) +lpdf.registerpagefinalizer (flushpageactions, "page actions") +lpdf.registerdocumentfinalizer(flushdocumentactions,"document actions") + +--- info : this can change and move elsewhere ---- info +local identity = { } function codeinjections.setupidentity(specification) - local title = specification.title or "" - if title ~= "" then - lpdf.addtoinfo("Title", pdfunicode(title), title) + for k, v in next, specification do + if v ~= "" then + identity[k] = v + end end - local subject = specification.subject or "" - if subject ~= "" then - lpdf.addtoinfo("Subject", pdfunicode(subject), subject) +end + +local function setupidentity() + local title = identity.title + if not title or title == "" then + title = tex.jobname end - local author = specification.author or "" + lpdf.addtoinfo("Title", pdfunicode(title), title) + local subtitle = identity.subtitle or "" + if subtitle ~= "" then + lpdf.addtoinfo("Subject", pdfunicode(subtitle), subtitle) + end + local author = identity.author or "" if author ~= "" then lpdf.addtoinfo("Author", pdfunicode(author), author) -- '/Author' in /Info, 'Creator' in XMP end - local creator = specification.creator or "" + local creator = identity.creator or "" if creator ~= "" then lpdf.addtoinfo("Creator", pdfunicode(creator), creator) -- '/Creator' in /Info, 'CreatorTool' in XMP end lpdf.addtoinfo("CreationDate", pdfstring(lpdf.pdftimestamp(lpdf.timestamp()))) - local date = specification.date or "" + local date = identity.date or "" local pdfdate = lpdf.pdftimestamp(date) if pdfdate then lpdf.addtoinfo("ModDate", pdfstring(pdfdate), date) @@ -171,17 +191,20 @@ function codeinjections.setupidentity(specification) date = lpdf.timestamp() lpdf.addtoinfo("ModDate", pdfstring(lpdf.pdftimestamp(date)), date) end - local keywords = specification.keywords or "" + local keywords = identity.keywords or "" if keywords ~= "" then keywords = string.gsub(keywords, "[%s,]+", " ") lpdf.addtoinfo("Keywords",pdfunicode(keywords), keywords) end local id = lpdf.id() lpdf.addtoinfo("ID", pdfstring(id), id) -- needed for pdf/x + setupidentity = function() end end +lpdf.registerpagefinalizer(setupidentity,"identity") + local function flushjavascripts() - local t = javascripts.flushpreambles() + local t = interactions.javascripts.flushpreambles() if #t > 0 then local a = pdfarray() local pdf_javascript = pdfconstant("JavaScript") @@ -189,7 +212,7 @@ local function flushjavascripts() local name, script = t[i][1], t[i][2] local j = pdfdictionary { S = pdf_javascript, - JS = pdfreference(pdfimmediateobj("stream",script)), + JS = pdfreference(pdfimmediateobject("stream",script)), } a[#a+1] = pdfstring(name) a[#a+1] = pdfreference(pdfflushobject(j)) @@ -198,7 +221,7 @@ local function flushjavascripts() end end -lpdf.registerdocumentfinalizer(flushjavascripts) +lpdf.registerdocumentfinalizer(flushjavascripts,"javascripts") -- -- -- @@ -278,7 +301,7 @@ local function pagespecification() local pageheight = tex.pdfpageheight local box = pdfarray { -- can be cached boxvalue(leftoffset), - boxvalue(pageheight-topoffset-height), + boxvalue(pageheight+topoffset-height), boxvalue(width-leftoffset), boxvalue(pageheight-topoffset), } @@ -288,5 +311,52 @@ local function pagespecification() -- lpdf.addtopageattributes("ArtBox",box) end -lpdf.registerpagefinalizer(pagespecification) -lpdf.registerdocumentfinalizer(documentspecification) +lpdf.registerpagefinalizer(pagespecification,"page specification") +lpdf.registerdocumentfinalizer(documentspecification,"document specification") + +-- Page Label support ... +-- +-- In principle we can also support /P (prefix) as we can just use the verbose form +-- and we can then forget about the /St (start) as we don't care about those few +-- extra bytes due to lack of collapsing. Anyhow, for that we need a stupid prefix +-- variant and that's not on the agenda now. + +local map = { + numbers = "D", + Romannumerals = "R", + romannumerals = "r", + Characters = "A", + characters = "a", +} + +local function featurecreep() + local pages, lastconversion, list = structures.pages.tobesaved, nil, pdfarray() + local getstructureset = structures.sets.get + for i=1,#pages do + local p = pages[i] + if not p then + return -- fatal error + else + local numberdata = p.numberdata + if numberdata then + local conversionset = numberdata.conversionset + if conversionset then + local conversion = getstructureset("structure:conversions",p.block,conversionset,1,"numbers") + if conversion ~= lastconversion then + lastconversion = conversion + list[#list+1] = i - 1 -- pdf starts numbering at 0 + list[#list+1] = pdfdictionary { S = pdfconstant(map[conversion] or map.numbers) } + end + end + end + if not lastconversion then + lastconversion = "numbers" + list[#list+1] = i - 1 -- pdf starts numbering at 0 + list[#list+1] = pdfdictionary { S = pdfconstant(map.numbers) } + end + end + end + lpdf.addtocatalog("PageLabels", pdfdictionary { Nums = list }) +end + +lpdf.registerdocumentfinalizer(featurecreep,"featurecreep") diff --git a/Master/texmf-dist/tex/context/base/lpdf-nod.lua b/Master/texmf-dist/tex/context/base/lpdf-nod.lua index 0ae9001232a..39bba2d6364 100644 --- a/Master/texmf-dist/tex/context/base/lpdf-nod.lua +++ b/Master/texmf-dist/tex/context/base/lpdf-nod.lua @@ -8,9 +8,13 @@ if not modules then modules = { } end modules ['lpdf-nod'] = { local copy_node, new_node = node.copy, node.new -local pdfliteral = nodes.register(new_node("whatsit", 8)) pdfliteral.mode = 1 -local pdfdest = nodes.register(new_node("whatsit",19)) pdfdest.named_id = 1 -- xyz_zoom untouched -local pdfannot = nodes.register(new_node("whatsit",15)) +local nodepool = nodes.pool + +local register = nodepool.register + +local pdfliteral = register(new_node("whatsit", 8)) pdfliteral.mode = 1 +local pdfdest = register(new_node("whatsit",19)) pdfdest.named_id = 1 -- xyz_zoom untouched +local pdfannot = register(new_node("whatsit",15)) local variables = interfaces.variables @@ -25,13 +29,20 @@ local views = { -- beware, we do support the pdf keys but this is *not* official fitr = 7, } -function nodes.pdfliteral(str) +function nodepool.pdfliteral(str) + local t = copy_node(pdfliteral) + t.data = str + return t +end + +function nodepool.pdfdirect(str) local t = copy_node(pdfliteral) t.data = str + t.mode = 1 return t end -function nodes.pdfannotation(w,h,d,data,n) +function nodepool.pdfannotation(w,h,d,data,n) local t = copy_node(pdfannot) if w and w ~= 0 then t.width = w end if h and h ~= 0 then t.height = h end @@ -41,7 +52,7 @@ function nodes.pdfannotation(w,h,d,data,n) return t end -function nodes.pdfdestination(w,h,d,name,view,n) +function nodepool.pdfdestination(w,h,d,name,view,n) local t = copy_node(pdfdest) if w and w ~= 0 then t.width = w end if h and h ~= 0 then t.height = h end diff --git a/Master/texmf-dist/tex/context/base/lpdf-pda.xml b/Master/texmf-dist/tex/context/base/lpdf-pda.xml new file mode 100644 index 00000000000..2d8e7b6f59f --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lpdf-pda.xml @@ -0,0 +1,171 @@ + + + + + + + + application/pdf + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + + + + + + + + + + http://ns.adobe.com/pdf/1.3/ + pdf + Adobe PDF Schema + + + + internal + A name object indicating whether the document has been modified to include trapping information + Trapped + Text + + + + + + http://purl.org/dc/elements/1.1/ + pdf + Dubline Core Schema + + + + internal + Subject in Document Properties + description + Text + + + + + + http://ns.adobe.com/pdfx/1.3/ + pdfx + PDF/X ID Schema + + + + external + Name of the ConTeXt job + ConTeXt.Jobname + Text + + + external + Time stamp of ConTeXt version + ConTeXt.Time + Text + + + external + ConTeXt website + ConTeXt.Url + Text + + + external + ConTeXt version + ConTeXt.Version + Text + + + external + Banner of pdftex or one of its successors + PTEX.Fullbanner + Text + + + external + Document identifier + ID + Text + + + + + + http://ns.adobe.com/xap/1.0/mm/ + xmpMM + XMP Media Management Schema + + + + internal + UUID based identifier for specific incarnation of a document + InstanceID + URI + + + + + + http://www.aiim.org/pdfa/ns/id/ + pdfaid + PDF/A ID Schema + + + + internal + Part of PDF/A standard + part + Integer + + + internal + Amendment of PDF/A standard + amd + Text + + + internal + Conformance level of PDF/A standard + conformance + Text + + + + + + + + + diff --git a/Master/texmf-dist/tex/context/base/lpdf-pdx.lua b/Master/texmf-dist/tex/context/base/lpdf-pdx.lua deleted file mode 100644 index 0a440c1e665..00000000000 --- a/Master/texmf-dist/tex/context/base/lpdf-pdx.lua +++ /dev/null @@ -1,139 +0,0 @@ -if not modules then modules = { } end modules ['lpdf-pdx'] = { - version = 1.001, - comment = "companion to lpdf-ini.mkiv", - author = "Peter Rold and Hans Hagen", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files", -} - -local codeinjections = backends.codeinjections -- normally it is registered -local variables = interfaces.variables - -local pdfdictionary = lpdf.dictionary -local pdfarray = lpdf.array -local pdfconstant = lpdf.constant -local pdfreference = lpdf.reference -local pdfflushobject = lpdf.flushobject -local pdfstring = lpdf.string -local pdfverbose = lpdf.verbose - -local lower, gmatch = string.lower, string.gmatch - -local channels = { - gray = 1, - grey = 1, - rgb = 3, - cmyk = 4, -} - -local prefixes = { - gray = "DefaultGray", - grey = "DefaultGray", - rgb = "DefaultRGB", - cmyk = "DefaultCMYK", -} - -local profiles = { } -local defaults = { } -local intents = pdfarray() -local lastprofile = nil - -function codeinjections.useinternalICCprofile(colorspace,filename) - local name = lower(file.basename(filename)) - local profile = profiles[name] - if not profile then - local colorspace = lower(colorspace) - local filename = resolvers.findctxfile(filename) or "" - local channel = channels[colorspace] - if channel and filename ~= "" then - local a = pdfdictionary { N = channel } - profile = pdf.obj { - compresslevel = 0, - immediate = true, - type = "stream", - file = filename, - attr = a(), - } - profiles[name] = profile - end - end - lastprofile = profile - return profile -end - -function codeinjections.useexternalICCprofile(colorspace,name,urls,checksum,version) - local profile = profiles[name] - if not profile then - local u = pdfarray() - for url in gmatch(urls,"([^, ]+)") do - u[#u+1] = pdfdictionary { - FS = pdfconstant("URL"), - F = pdfstring(url), - } - end - local d = pdfdictionary { - ProfileName = name, -- not file name! - ProfileCS = colorspace, - URLs = u, -- array containing at least one URL - CheckSum = pdfverbose { "<", checksum, ">" }, -- 16byte MD5 hash - ICCVersion = pdfverbose { "<", version, ">" }, -- bytes 8..11 from the header of the ICC profile, as a hex string - } - local n = pdfflushobject(d) - profiles[name] = n - lastprofile = n - return n - end -end - -local function embedprofile(colorspace,filename) - local colorspace = lower(colorspace) - local n = codeinjections.useinternaliccprofile(colorspace,filename) - if n then - local a = pdfarray { - pdfconstant("ICCBased"), - pdfreference(n), - } - lpdf.adddocumentcolorspace(prefixes[colorspace],pdfreference(pdfflushobject(a))) -- part of page /Resources - defaults[lower(colorspace)] = filename - end -end - - -function codeinjections.useICCdefaultprofile(colorspace,filename) - defaults[lower(colorspace)] = filename -end - -local function flushembeddedprofiles() - for colorspace, filename in next, defaults do - embedprofile(colorspace,filename) - end -end - -function codeinjections.usePDFXoutputintent(id,name,reference,outputcondition,info) - local d = { - Type = pdfconstant("OutputIntent"), - S = pdfconstant("GTS_PDFX"), - OutputConditionIdentifier = id, - RegistryName = name, - OutputCondition = outputcondition, - Info = info, - } - local icc = lastprofile - if reference == variables.yes then - d["DestOutputProfileRef"] = pdfreference(icc) - else - d["DestOutputProfile"] = pdfreference(icc) - end - -- intents[#intents+1] = pdfdictionary(d) - intents[#intents+1] = pdfreference(pdfflushobject(pdfdictionary(d))) -- nicer as separate object -end - -local function flushoutputintents() - if #intents > 0 then - lpdf.addtocatalog("OutputIntents",pdfreference(pdfflushobject(intents))) - end -end - - -lpdf.registerdocumentfinalizer(flushoutputintents,1) -lpdf.registerdocumentfinalizer(flushembeddedprofiles,1) diff --git a/Master/texmf-dist/tex/context/base/lpdf-pdx.mkiv b/Master/texmf-dist/tex/context/base/lpdf-pdx.mkiv deleted file mode 100644 index ffb7f526976..00000000000 --- a/Master/texmf-dist/tex/context/base/lpdf-pdx.mkiv +++ /dev/null @@ -1,71 +0,0 @@ -%D \module -%D [ file=lpdf-pdx, -%D version=2010.02.11, -%D title=\CONTEXT\ Backend Macros, -%D subtitle=PDF-X, -%D author=Peter Rolf \& Hans Hagen, -%D date=\currentdate, -%D copyright=\PRAGMA] % and peter -%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 Backend Macros / PDF-X} - -\unprotect - -% declare default color space -% all device based entries of the same CS are mapped to the defined ICCprofile then; -% i.e. /DeviceRGB --> /ICCBased RGB profile -% TODO: allow multiple default profiles (one per CS) -% -% external ICC profile dictionary (PDF/X-4p and PDF/X-5p) -% -% - ProfileName (not file name!) -% - URLs (array containing at least one URL); the keyword FSA is wrong! -% - CheckSum (16byte MD5 hash) -% - ProfileCS (GRAY,RGB,CMYK) -% - ICCVersion (bytes 8..11 from the header of the ICC profile, as a hex string) - -\registerctxluafile{lpdf-pdx} {} - -% \def\embedICCprofile#1#2% colorspace, name -% {\ctxlua{backends.codeinjections.addiccprofile("#1","#2")}} - -\def\douseinternalICCprofile[#1]% - {\getparameters[\??ic][colorspace=,filename=,#1]% - \ctxlua{backends.codeinjections.useinternalICCprofile( - "\@@iccolorspace","\@@icfilename")}} - -% create a dictionary for an external ICC profile (PDF/X-4p and PDF/X-5pg only) -% the referenced ICC profile is not embedded - -\def\douseexternalICCprofile[#1]% - {\getparameters[\??ic][colorspace=,name=,url=,checksum=,version=,#1]% - \ctxlua{backends.codeinjections.useexternalICCprofile( - "\@@iccolorspace","\@@icname","\@@icurl","\@@icchecksum","\@@icversion")}} - -% use an ICC profile as default colorspace for all device dependend colors; -% all device based entries of the same CS are mapped to the defined ICCprofile then; -% i.e. /DeviceRGB --> /ICCBased RGB profile always embed the profile! - -\def\douseICCdefaultprofile[#1]% - {\getparameters[\??ic][colorspace=,filename=,#1]% - \ctxlua{backends.codeinjections.useICCdefaultprofile( - "\@@iccolorspace","\@@icfilename")}} - -% embedding rules for output intent profile differ for the PDF/X versions - -\def\dousePDFXoutputintent[#1]% - {\getparameters[\??ic][reference=\v!yes,outputcondition=,info=,id=,name=,#1]% - \ctxlua{backends.codeinjections.usePDFXoutputintent( - "\@@icid","\@@icname","\@@icreference","\@@icoutputcondition","\@@icinfo")}} - -\def\useinternalICCprofile{\dosingleempty\douseinternalICCprofile} -\def\useexternalICCprofile{\dosingleempty\douseexternalICCprofile} -\def\useICCdefaultprofile {\dosingleempty\douseICCdefaultprofile } -\def\usePDFXoutputintent {\dosingleempty\dousePDFXoutputintent } - -\protect \endinput - diff --git a/Master/texmf-dist/tex/context/base/lpdf-pdx.xml b/Master/texmf-dist/tex/context/base/lpdf-pdx.xml new file mode 100644 index 00000000000..42e11650e71 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lpdf-pdx.xml @@ -0,0 +1,45 @@ + + + + + + + + application/pdf + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + + + + + + + diff --git a/Master/texmf-dist/tex/context/base/lpdf-ren.lua b/Master/texmf-dist/tex/context/base/lpdf-ren.lua index e6bbd67fe2e..54c78845ed4 100644 --- a/Master/texmf-dist/tex/context/base/lpdf-ren.lua +++ b/Master/texmf-dist/tex/context/base/lpdf-ren.lua @@ -10,70 +10,97 @@ if not modules then modules = { } end modules ['lpdf-ren'] = { local tostring, tonumber, next = tostring, tonumber, next local format = string.format -local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes +local settings_to_array = utilities.parsers.settings_to_array -local nodeinjections = backends.pdf.nodeinjections -local codeinjections = backends.pdf.codeinjections -local registrations = backends.pdf.registrations +local backends, lpdf = backends, lpdf -jobreferences = jobreferences or { } ---~ jobreferences.runners = jobreferences.runners or { } ---~ jobreferences.specials = jobreferences.specials or { } ---~ jobreferences.handlers = jobreferences.handlers or { } -jobreferences.executers = jobreferences.executers or { } +local nodeinjections = backends.pdf.nodeinjections +local codeinjections = backends.pdf.codeinjections +local registrations = backends.pdf.registrations +local viewerlayers = attributes.viewerlayers ---~ local runners = jobreferences.runners ---~ local specials = jobreferences.specials ---~ local handlers = jobreferences.handlers -local executers = jobreferences.executers +local references = structures.references -local variables = interfaces.variables +references.executers = references.executers or { } +local executers = references.executers -local pdfconstant = lpdf.constant -local pdfdictionary = lpdf.dictionary -local pdfarray = lpdf.array -local pdfreference = lpdf.reference -local pdfflushobject = lpdf.flushobject +local variables = interfaces.variables -local pdf_ocg = pdfconstant("OCG") -local pdf_ocmd = pdfconstant("OCMD") -local pdf_off = pdfconstant("OFF") -local pdf_on = pdfconstant("ON") -local pdf_toggle = pdfconstant("Toggle") -local pdf_setocgstate = pdfconstant("SetOCGState") +local v_no = variables.no +local v_yes = variables.yes +local v_start = variables.start +local v_stop = variables.stop +local v_reset = variables.reset +local v_auto = variables.auto +local v_random = variables.random -local lpdf_usage = pdfdictionary { Print = pdfdictionary { PrintState = pdfconstant("OFF") } } +local pdfconstant = lpdf.constant +local pdfdictionary = lpdf.dictionary +local pdfarray = lpdf.array +local pdfreference = lpdf.reference +local pdfflushobject = lpdf.flushobject +local pdfreserveobject = lpdf.reserveobject + +local pdf_ocg = pdfconstant("OCG") +local pdf_ocmd = pdfconstant("OCMD") +local pdf_off = pdfconstant("OFF") +local pdf_on = pdfconstant("ON") +local pdf_toggle = pdfconstant("Toggle") +local pdf_setocgstate = pdfconstant("SetOCGState") + +local lpdf_usage = pdfdictionary { Print = pdfdictionary { PrintState = pdf_off } } + +-- We can have references to layers before they are places, for instance from +-- hide and vide actions. This is why we need to be able to force usage of layers +-- at several moments. local pdfln, pdfld = { }, { } local textlayers, hidelayers, videlayers = pdfarray(), pdfarray(), pdfarray() -local pagelayers = pdfdictionary() +local pagelayers, pagelayersreference, cache = nil, nil, { } -lpdf.layerreferences = pdfln +local specifications = { } +local initialized = { } -function backends.pdf.layerreference(name) - return pdfln[name] +function codeinjections.defineviewerlayer(specification) + if viewerlayers.supported and textlayers then + local tag = specification.tag + if not specifications[tag] then + specifications[tag] = specification + end + end end -function codeinjections.defineviewerlayer(specification) - if textlayers then +local function useviewerlayer(name) + local specification = specifications[name] + if not environment.initex and specification and not initialized[name] then + specifications[name] = nil -- or not + initialized [name] = true + if not pagelayers then + pagelayers = pdfdictionary() + pagelayersreference = pdfreserveobject() + end local tag = specification.tag -- todo: reserve - local n = pdfdictionary { + local nn = pdfreserveobject() + local nr = pdfreference(nn) + local nd = pdfdictionary { Type = pdf_ocg, Name = specification.title or "unknown", - Intent = ((specification.kind > 0) and pdf_design) or nil, -- disable layer hiding by user - Usage = ((specification.printable == variables.no) and lpdf_usage) or nil , -- printable or not + Intent = ((specification.editable ~= v_no) and pdf_design) or nil, -- disable layer hiding by user + Usage = ((specification.printable == v_no) and lpdf_usage) or nil, -- printable or not } - local nr = pdfreference(pdfflushobject(n)) + cache[#cache+1] = { nn, nd } pdfln[tag] = nr -- was n - local d = pdfdictionary { + local dn = pdfreserveobject() + local dr = pdfreference(dn) + local dd = pdfdictionary { Type = pdf_ocmd, OCGs = pdfarray { nr }, } - local dr = pdfreference(pdfflushobject(d)) + cache[#cache+1] = { dn, dd } pdfld[tag] = dr textlayers[#textlayers+1] = nr - if specification.visible == variables.start then + if specification.visible == v_start then videlayers[#videlayers+1] = nr else hidelayers[#hidelayers+1] = nr @@ -82,36 +109,61 @@ function codeinjections.defineviewerlayer(specification) end end +codeinjections.useviewerlayer = useviewerlayer + +local function layerreference(name) + local r = pdfln[name] + if r then + return r + else + useviewerlayer(name) + return pdfln[name] + end +end + +lpdf.layerreference = layerreference -- also triggered when a hide or vide happens + local function flushtextlayers() - if textlayers and #textlayers > 0 then - local d = pdfdictionary { - OCGs = textlayers, - D = pdfdictionary { - Order = textlayers, - ON = videlayers, - OFF = hidelayers, - }, - } - lpdf.addtocatalog("OCProperties",d) - textlayers = nil + if viewerlayers.supported then + if pagelayers then + pdfflushobject(pagelayersreference,pagelayers) + end + for i=1,#cache do + local ci = cache[i] + pdfflushobject(ci[1],ci[2]) + end + if textlayers and #textlayers > 0 then -- we can group them if needed, like: layout + local d = pdfdictionary { + OCGs = textlayers, + D = pdfdictionary { + Name = "Document", + Order = (viewerlayers.hasorder and textlayers) or nil, + ON = videlayers, + OFF = hidelayers, + BaseState = pdf_on, + }, + } + lpdf.addtocatalog("OCProperties",d) + textlayers = nil + end end end -local function flushpagelayers() - if next(pagelayers) then - lpdf.addtopageresources("Properties",pagelayers) +local function flushpagelayers() -- we can share these + if pagelayers then + lpdf.addtopageresources("Properties",pdfreference(pagelayersreference)) -- we could cache this end end -lpdf.registerpagefinalizer (flushpagelayers) -lpdf.registerdocumentfinalizer(flushtextlayers) +lpdf.registerpagefinalizer (flushpagelayers,"layers") +lpdf.registerdocumentfinalizer(flushtextlayers,"layers") local function setlayer(what,arguments) -- maybe just a gmatch of even better, earlier in lpeg - arguments = (type(arguments) == "table" and arguments) or aux.settings_to_array(arguments) + arguments = (type(arguments) == "table" and arguments) or settings_to_array(arguments) local state = pdfarray { what } for i=1,#arguments do - local p = pdfln[arguments[i]] + local p = layerreference(arguments[i]) if p then state[#state+1] = p end @@ -122,9 +174,9 @@ local function setlayer(what,arguments) } end -function executers.hidelayer (arguments) setlayer(pdf_off, arguments) end -function executers.videlayer (arguments) setlayer(pdf_on, arguments) end -function executers.togglelayer(arguments) setlayer(pdf_toggle,arguments) end +function executers.hidelayer (arguments) return setlayer(pdf_off, arguments) end +function executers.videlayer (arguments) return setlayer(pdf_on, arguments) end +function executers.togglelayer(arguments) return setlayer(pdf_toggle,arguments) end -- transitions @@ -173,24 +225,26 @@ local last = 0 function codeinjections.setpagetransition(specification) local n, delay = specification.n, specification.delay - if n == variables.auto then + if not n or n == "" then + return -- let's forget about it + elseif n == v_auto then if last >= #pagetransitions then last = 0 end n = last + 1 - elseif n == variables.stop then + elseif n == v_stop then return - elseif n == variables.reset then + elseif n == v_reset then last = 0 return - elseif n == variables.random then + elseif n == v_random then n = math.random(1,#pagetransitions) else n = tonumber(n) end local t = n and pagetransitions[n] or pagetransitions[1] if not t then - t = aux.settings_to_array(n) + t = settings_to_array(n) end if t and #t > 0 then local d = pdfdictionary() diff --git a/Master/texmf-dist/tex/context/base/lpdf-swf.lua b/Master/texmf-dist/tex/context/base/lpdf-swf.lua index 9fe0cd09fc8..04825446c3e 100644 --- a/Master/texmf-dist/tex/context/base/lpdf-swf.lua +++ b/Master/texmf-dist/tex/context/base/lpdf-swf.lua @@ -9,101 +9,195 @@ if not modules then modules = { } end modules ['lpdf-swf'] = { -- The following code is based on tests by Luigi Scarso. His prototype -- was using tex code. This is the official implementation. -local format = string.format +local format, gsub = string.format, string.gsub -local pdfconstant = lpdf.constant -local pdfboolean = lpdf.boolean -local pdfstring = lpdf.string -local pdfunicode = lpdf.unicode -local pdfdictionary = lpdf.dictionary -local pdfarray = lpdf.array -local pdfnull = lpdf.null -local pdfreference = lpdf.reference +local backends, lpdf = backends, lpdf -function backends.pdf.helpers.insertswf(spec) +local pdfconstant = lpdf.constant +local pdfboolean = lpdf.boolean +local pdfstring = lpdf.string +local pdfunicode = lpdf.unicode +local pdfdictionary = lpdf.dictionary +local pdfarray = lpdf.array +local pdfnull = lpdf.null +local pdfreference = lpdf.reference +local pdfimmediateobject = lpdf.immediateobject - local width, height, filename = spec.width, spec.height, spec.foundname +local checkedkey = lpdf.checkedkey - local eref = backends.codeinjections.embedfile(filename) +local codeinjections = backends.pdf.codeinjections +local nodeinjections = backends.pdf.nodeinjections + +local pdfannotation_node = nodes.pool.pdfannotation + +local activations = { + click = "XA", + page = "PO", + focus = "PV", +} + +local deactivations = { + click = "XD", + page = "PI", + focus = "PC", +} + +table.setmetatableindex(activations, function() return activations .click end) +table.setmetatableindex(deactivations,function() return deactivations.focus end) + +local function insertswf(spec) + + local width = spec.width + local height = spec.height + local filename = spec.foundname + local resources = spec.resources + local display = spec.display + local controls = spec.controls + + local resources = resources and parametersets[resources] + local display = display and parametersets[display] + local controls = controls and parametersets[controls] -- not yet used + + local preview = checkedkey(display,"preview","string") + local toolbar = checkedkey(display,"toolbar","boolean") + + local embeddedreference = codeinjections.embedfile { file = filename } local flash = pdfdictionary { Subtype = pdfconstant("Flash"), Instances = pdfarray { pdfdictionary { - Asset = eref, + Asset = embeddedreference, Params = pdfdictionary { - Binding = pdfconstant("Foreground") + Binding = pdfconstant("Background") -- Foreground makes swf behave erratic } }, }, } - local fref = pdfreference(pdf.immediateobj(tostring(flash))) + local flashreference = pdfreference(pdfimmediateobject(tostring(flash))) local configuration = pdfdictionary { - Configurations = pdfarray { fref }, + Configurations = pdfarray { flashreference }, Assets = pdfdictionary { Names = pdfarray { pdfstring(filename), - eref, + embeddedreference, } }, } - local cref = pdfreference(pdf.immediateobj(tostring(configuration))) + if resources then + local names = configuration.Assets.Names + local function add(filename) + local filename = gsub(filename,"%./","") + local embeddedreference = codeinjections.embedfile { file = filename, keepdir = true } + names[#names+1] = pdfstring(filename) + names[#names+1] = embeddedreference + end + local paths = resources.paths + if paths then + for i=1,#paths do + local files = dir.glob(paths[i] .. "/**") + for i=1,#files do + add(files[i]) + end + end + end + local files = resources.files + if files then + for i=1,#files do + add(files[i]) + end + end + end + + local configurationreference = pdfreference(pdfimmediateobject(tostring(configuration))) local activation = pdfdictionary { - Activation = pdfdictionary { - Type = pdfconstant("RichMediaActivation"), - Condition = pdfconstant("PO"), - Configuration = fref, - Animation = pdfdictionary { - Subtype = pdfconstant("Linear"), - Speed = 1, - Playcount = 1, - }, - Deactivation = pdfdictionary { - Type = pdfconstant("RichMediaDeactivation"), - Condition = pdfconstant("XD"), - }, - Presentation = pdfdictionary { - PassContextClick = false, - Style = pdfconstant("Embedded"), - Toolbar = false, - NavigationPane = false, - Transparent = true, - Window = pdfdictionary { - Type = pdfconstant("RichMediaWindow"), - Width = pdfdictionary { - Default = 100, - Min = 100, - Max = 100, - }, - Height = pdfdictionary { - Default = 100, - Min = 100, - Max = 100, - }, - Position = pdfdictionary { - Type = pdfconstant("RichMediaPosition"), - HAlign = pdfconstant("Near"), - VAlign = pdfconstant("Near"), - HOffset = 0, - VOffset = 0, - } + Type = pdfconstant("RichMediaActivation"), + Condition = pdfconstant(activations[display.open]), + Configuration = flashreference, + Animation = pdfdictionary { + Subtype = pdfconstant("Linear"), + Speed = 1, + Playcount = 1, + }, + Presentation = pdfdictionary { + PassContextClick = false, + Style = pdfconstant("Embedded"), + Toolbar = toolbar, + NavigationPane = false, + Transparent = true, + Window = pdfdictionary { + Type = pdfconstant("RichMediaWindow"), + Width = pdfdictionary { + Default = 100, + Min = 100, + Max = 100, + }, + Height = pdfdictionary { + Default = 100, + Min = 100, + Max = 100, + }, + Position = pdfdictionary { + Type = pdfconstant("RichMediaPosition"), + HAlign = pdfconstant("Near"), + VAlign = pdfconstant("Near"), + HOffset = 0, + VOffset = 0, } } - } + }, + -- View + -- Scripts + } + + local deactivation = pdfdictionary { + Type = pdfconstant("RichMediaDeactivation"), + Condition = pdfconstant(deactivations[display.close]), + } + + local richmediasettings = pdfdictionary { + Type = pdfconstant("RichMediaSettings"), + Activation = activation, + Deactivation = deactivation, } - local aref = pdfreference(pdf.immediateobj(tostring(activation))) + local settingsreference = pdfreference(pdfimmediateobject(tostring(richmediasettings))) + + local appearance + + if preview then + local figure = codeinjections.getpreviewfigure { name = preview, width = width, height = height } + if figure then + local image = img.package(figure.status.private) + appearance = pdfdictionary { N = pdfreference(image.objnum) } + end + end local annotation = pdfdictionary { - Subtype = pdfconstant("RichMedia"), - RichMediaContent = cref, - RichMediaSettings = aref, + Subtype = pdfconstant("RichMedia"), + RichMediaContent = configurationreference, + RichMediaSettings = settingsreference, + AP = appearance, } return annotation, nil, nil end + +function backends.pdf.nodeinjections.insertswf(spec) + local annotation, preview, ref = insertswf { + foundname = spec.foundname, + width = spec.width, + height = spec.height, + display = spec.display, + controls = spec.controls, + resources = spec.resources, + -- factor = spec.factor, + -- label = spec.label, + } + node.write(pdfannotation_node(spec.width,spec.height,0,annotation())) +end diff --git a/Master/texmf-dist/tex/context/base/lpdf-tag.lua b/Master/texmf-dist/tex/context/base/lpdf-tag.lua new file mode 100644 index 00000000000..06f3377bceb --- /dev/null +++ b/Master/texmf-dist/tex/context/base/lpdf-tag.lua @@ -0,0 +1,308 @@ +if not modules then modules = { } end modules ['lpdf-tag'] = { + version = 1.001, + comment = "companion to lpdf-tag.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local format, match, concat = string.format, string.match, table.concat +local lpegmatch = lpeg.match +local utfchar = utf.char + +local trace_tags = false trackers.register("structures.tags", function(v) trace_tags = v end) + +local report_tags = logs.reporter("backend","tags") + +local backends, lpdf, nodes = backends, lpdf, nodes + +local nodeinjections = backends.pdf.nodeinjections +local codeinjections = backends.pdf.codeinjections + +local tasks = nodes.tasks + +local pdfdictionary = lpdf.dictionary +local pdfarray = lpdf.array +local pdfboolean = lpdf.boolean +local pdfconstant = lpdf.constant +local pdfreference = lpdf.reference +local pdfunicode = lpdf.unicode +local pdfstring = lpdf.string +local pdfflushobject = lpdf.flushobject +local pdfreserveobject = lpdf.reserveobject +local pdfpagereference = lpdf.pagereference + +local nodepool = nodes.pool + +local pdfliteral = nodepool.pdfliteral + +local nodecodes = nodes.nodecodes + +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist +local glyph_code = nodecodes.glyph + +local a_tagged = attributes.private('tagged') +local a_image = attributes.private('image') + +local has_attribute, set_attribute, traverse_nodes, traverse_id = node.has_attribute, node.set_attribute, node.traverse, node.traverse_id +local tosequence = nodes.tosequence +local copy_node, slide_nodelist = node.copy, node.slide + +local structure_stack = { } +local structure_kids = pdfarray() +local structure_ref = pdfreserveobject() +local parent_ref = pdfreserveobject() +local root = { pref = pdfreference(structure_ref), kids = structure_kids } +local tree = { } +local elements = { } +local names = pdfarray() +local taglist = structures.tags.taglist +local usedlabels = structures.tags.labels +local properties = structures.tags.properties +local usedmapping = { } + +local colonsplitter = lpeg.splitat(":") +local dashsplitter = lpeg.splitat("-") + +local add_ids = false -- true + + +--~ function codeinjections.maptag(original,target,kind) +--~ mapping[original] = { target, kind or "inline" } +--~ end + +local function finishstructure() + if #structure_kids > 0 then + local nums, n = pdfarray(), 0 + for i=1,#tree do + n = n + 1 ; nums[n] = i-1 + n = n + 1 ; nums[n] = pdfreference(pdfflushobject(tree[i])) + end + local parenttree = pdfdictionary { + Nums = nums + } + -- we need to split names into smaller parts (e.g. alphabetic or so) + if add_ids then + local kids = pdfdictionary { + Limits = pdfarray { names[1], names[#names-1] }, + Names = names, + } + local idtree = pdfdictionary { + Kids = pdfarray { pdfreference(pdfflushobject(kids)) }, + } + end + -- + local rolemap = pdfdictionary() + for k, v in next, usedmapping do + k = usedlabels[k] or k + local p = properties[k] + rolemap[k] = pdfconstant(p and p.pdf or "Span") -- or "Div" + end + local structuretree = pdfdictionary { + Type = pdfconstant("StructTreeRoot"), + K = pdfreference(pdfflushobject(structure_kids)), + ParentTree = pdfreference(pdfflushobject(parent_ref,parenttree)), + IDTree = (add_ids and pdfreference(pdfflushobject(idtree))) or nil, + RoleMap = rolemap, + } + pdfflushobject(structure_ref,structuretree) + lpdf.addtocatalog("StructTreeRoot",pdfreference(structure_ref)) + -- + local markinfo = pdfdictionary { + Marked = pdfboolean(true), + -- UserProperties = pdfboolean(true), + -- Suspects = pdfboolean(true), + } + lpdf.addtocatalog("MarkInfo",pdfreference(pdfflushobject(markinfo))) + -- + for fulltag, element in next, elements do + pdfflushobject(element.knum,element.kids) + end + end +end + +lpdf.registerdocumentfinalizer(finishstructure,"document structure") + +local index, pageref, pagenum, list = 0, nil, 0, nil + +local pdf_mcr = pdfconstant("MCR") +local pdf_struct_element = pdfconstant("StructElem") + +local function initializepage() + index = 0 + pagenum = tex.count.realpageno + pageref = pdfreference(pdfpagereference(pagenum)) + list = pdfarray() + tree[pagenum] = list -- we can flush after done, todo +end + +local function finishpage() + -- flush what can be flushed + lpdf.addtopageattributes("StructParents",pagenum-1) +end + +-- here we can flush and free elements that are finished + +local function makeelement(fulltag,parent) + local tag, n = lpegmatch(dashsplitter,fulltag) + local tg, detail = lpegmatch(colonsplitter,tag) + local k, r = pdfarray(), pdfreserveobject() + usedmapping[tg] = true + tg = usedlabels[tg] or tg + local d = pdfdictionary { + Type = pdf_struct_element, + S = pdfconstant(tg), + ID = (add_ids and fulltag) or nil, + T = detail and detail or nil, + P = parent.pref, + Pg = pageref, + K = pdfreference(r), + -- Alt = " Who cares ", + -- ActualText = " Hi Hans ", + } + local s = pdfreference(pdfflushobject(d)) + if add_ids then + names[#names+1] = fulltag + names[#names+1] = s + end + local kids = parent.kids + kids[#kids+1] = s + elements[fulltag] = { tag = tag, pref = s, kids = k, knum = r, pnum = pagenum } +end + +local function makecontent(parent,start,stop,slist,id) + local tag, kids = parent.tag, parent.kids + local last = index + if id == "image" then + local d = pdfdictionary { + Type = pdf_mcr, + Pg = pageref, + MCID = last, + Alt = "image", + } + kids[#kids+1] = d + elseif pagenum == parent.pnum then + kids[#kids+1] = last + else + local d = pdfdictionary { + Type = pdf_mcr, + Pg = pageref, + MCID = last, + } + -- kids[#kids+1] = pdfreference(pdfflushobject(d)) + kids[#kids+1] = d + end + -- + local bliteral = pdfliteral(format("/%s <>BDC",tag,last)) + local prev = start.prev + if prev then + prev.next, bliteral.prev = bliteral, prev + end + start.prev, bliteral.next = bliteral, start + if slist and slist.list == start then + slist.list = bliteral + elseif not prev then + report_tags("this can't happen: injection in front of nothing") + end + -- + local eliteral = pdfliteral("EMC") + local next = stop.next + if next then + next.prev, eliteral.next = eliteral, next + end + stop.next, eliteral.prev = eliteral, stop + -- + index = index + 1 + list[index] = parent.pref + return bliteral, eliteral +end + +-- -- -- + +local level, last, ranges, range = 0, nil, { }, nil + +local function collectranges(head,list) + for n in traverse_nodes(head) do + local id = n.id -- 14: image, 8: literal (mp) + if id == glyph_code then + local at = has_attribute(n,a_tagged) + if not at then + range = nil + elseif last ~= at then + range = { at, "glyph", n, n, list } -- attr id start stop list + ranges[#ranges+1] = range + last = at + elseif range then + range[4] = n -- stop + end + elseif id == hlist_code or id == vlist_code then + local at = has_attribute(n,a_image) + if at then + local at = has_attribute(n,a_tagged) + if not at then + range = nil + else + ranges[#ranges+1] = { at, "image", n, n, list } -- attr id start stop list + end + last = nil + else + local nl = n.list + slide_nodelist(nl) -- temporary hack till math gets slided (tracker item) + collectranges(nl,n) + end + end + end +end + +function nodeinjections.addtags(head) + -- no need to adapt head, as we always operate on lists + level, last, ranges, range = 0, nil, { }, nil + initializepage() + collectranges(head) + if trace_tags then + for i=1,#ranges do + local range = ranges[i] + local attr, id, start, stop = range[1], range[2], range[3], range[4] + local tags = taglist[attr] + if tags then -- not ok ... only first lines + report_tags("%s => %s : %05i %s",tosequence(start,start),tosequence(stop,stop),attr,concat(tags," ")) + end + end + end + for i=1,#ranges do + local range = ranges[i] + local attr, id, start, stop, list = range[1], range[2], range[3], range[4], range[5] + local tags = taglist[attr] + local prev = root + local noftags, tag = #tags, nil + for j=1,noftags do + local tag = tags[j] + if not elements[tag] then + makeelement(tag,prev) + end + prev = elements[tag] + end + local b, e = makecontent(prev,start,stop,list,id) + if start == head then + report_tags("this can't happen: parent list gets tagged") + head = b + end + end + finishpage() + -- can be separate feature + -- + -- injectspans(head) -- does to work yet + -- + return head, true +end + +function codeinjections.enabletags(tg,lb) + structures.tags.handler = nodeinjections.addtags + tasks.enableaction("shipouts","structures.tags.handler") + tasks.enableaction("shipouts","nodes.handlers.accessibility") + tasks.enableaction("math","noads.handlers.tags") + if trace_tags then + report_tags("enabling structure tags") + end +end diff --git a/Master/texmf-dist/tex/context/base/lpdf-u3d.lua b/Master/texmf-dist/tex/context/base/lpdf-u3d.lua index f7a62c6c904..f5a2bc2fa9a 100644 --- a/Master/texmf-dist/tex/context/base/lpdf-u3d.lua +++ b/Master/texmf-dist/tex/context/base/lpdf-u3d.lua @@ -13,22 +13,31 @@ if not modules then modules = { } end modules ['lpdf-u3d'] = { -- an overhaul. There are some messy leftovers that will be -- removed in future versions. +-- For some reason no one really tested this code so at some +-- point we will end up with a reimplementation. For instance +-- it makes sense to add the same activation code as with swf. + local format, find = string.format, string.find local cos, sin, sqrt, pi, atan2, abs = math.cos, math.sin, math.sqrt, math.pi, math.atan2, math.abs -local pdfconstant = lpdf.constant -local pdfboolean = lpdf.boolean -local pdfnumber = lpdf.number -local pdfunicode = lpdf.unicode -local pdfdictionary = lpdf.dictionary -local pdfarray = lpdf.array -local pdfnull = lpdf.null -local pdfreference = lpdf.reference +local backends, lpdf = backends, lpdf + +local nodeinjections = backends.pdf.nodeinjections + +local pdfconstant = lpdf.constant +local pdfboolean = lpdf.boolean +local pdfnumber = lpdf.number +local pdfunicode = lpdf.unicode +local pdfdictionary = lpdf.dictionary +local pdfarray = lpdf.array +local pdfnull = lpdf.null +local pdfreference = lpdf.reference +local pdfimmediateobject = lpdf.immediateobject -local pdfimmediateobj = pdf.immediateobj +local checkedkey = lpdf.checkedkey +local limited = lpdf.limited -local checkedkey = lpdf.checkedkey -local limited = lpdf.limited +local pdfannotation_node = nodes.pool.pdfannotation local schemes = table.tohash { "Artwork", "None", "White", "Day", "Night", "Hard", @@ -338,7 +347,7 @@ end local stored_js, stored_3d, stored_pr, streams = { }, { }, { }, { } -function backends.pdf.helpers.insert3d(spec) -- width, height, factor, display, controls, label, foundname +local function insert3d(spec) -- width, height, factor, display, controls, label, foundname local width, height, factor = spec.width, spec.height, spec.factor or number.dimenfactors.bp local display, controls, label, foundname = spec.display, spec.controls, spec.label, spec.foundname @@ -388,12 +397,12 @@ function backends.pdf.helpers.insert3d(spec) -- width, height, factor, display, if js then local jsref = stored_js[js] if not jsref then - jsref = pdfimmediateobj("streamfile",js) + jsref = pdfimmediateobject("streamfile",js) stored_js[js] = jsref end attr.OnInstantiate = pdfreference(jsref) end - stored_3d[label] = pdfimmediateobj("streamfile",foundname,attr()) + stored_3d[label] = pdfimmediateobject("streamfile",foundname,attr()) stream = 1 else stream = stream + 1 @@ -456,7 +465,7 @@ function backends.pdf.helpers.insert3d(spec) -- width, height, factor, display, }, ProcSet = pdfarray { pdfconstant("PDF"), pdfconstant("ImageC") }, } - local pwd = pdfimmediateobj( + local pwd = pdfimmediateobject( "stream", format("q /GS gs %s 0 0 %s 0 0 cm /IM Do Q", factor*width,factor*height), @@ -472,3 +481,16 @@ function backends.pdf.helpers.insert3d(spec) -- width, height, factor, display, return annot, nil, nil end end + +function nodeinjections.insertu3d(spec) + local annotation, preview, ref = insert3d { -- just spec + foundname = spec.foundname, + width = spec.width, + height = spec.height, + factor = spec.factor, + display = spec.display, + controls = spec.controls, + label = spec.label, + } + node.write(pdfannotation_node(spec.width,spec.height,0,annotation())) +end diff --git a/Master/texmf-dist/tex/context/base/lpdf-wid.lua b/Master/texmf-dist/tex/context/base/lpdf-wid.lua index 40a81e7d4d9..d0247f49a73 100644 --- a/Master/texmf-dist/tex/context/base/lpdf-wid.lua +++ b/Master/texmf-dist/tex/context/base/lpdf-wid.lua @@ -6,102 +6,154 @@ if not modules then modules = { } end modules ['lpdf-wid'] = { license = "see context related readme files" } -local format, gmatch, gsub, find = string.format, string.gmatch, string.gsub, string.find -local texsprint, ctxcatcodes, texbox, texcount = tex.sprint, tex.ctxcatcodes, tex.box, tex.count - -local nodeinjections = backends.pdf.nodeinjections -local codeinjections = backends.pdf.codeinjections -local registrations = backends.pdf.registrations - -local executers = jobreferences.executers -local variables = interfaces.variables - -local pdfconstant = lpdf.constant -local pdfdictionary = lpdf.dictionary -local pdfarray = lpdf.array -local pdfreference = lpdf.reference -local pdfunicode = lpdf.unicode -local pdfstring = lpdf.string -local pdfcolorspec = lpdf.colorspec -local pdfflushobject = lpdf.flushobject -local pdfreserveobject = lpdf.reserveobject - -local pdfreserveobj = pdf.reserveobj -local pdfimmediateobj = pdf.immediateobj - -local pdfannotation = nodes.pdfannotation - -local hpack_node, write_node = node.hpack, node.write +local gmatch, gsub, find, lower, format = string.gmatch, string.gsub, string.find, string.lower, string.format +local texbox, texcount = tex.box, tex.count +local settings_to_array = utilities.parsers.settings_to_array +local settings_to_hash = utilities.parsers.settings_to_hash + +local report_media = logs.reporter("backend","media") +local report_attachment = logs.reporter("backend","attachment") + +local backends, lpdf, nodes = backends, lpdf, nodes + +local nodeinjections = backends.pdf.nodeinjections +local codeinjections = backends.pdf.codeinjections +local registrations = backends.pdf.registrations + +local executers = structures.references.executers +local variables = interfaces.variables + +local v_hidden = variables.hidden +local v_normal = variables.normal +local v_auto = variables.auto +local v_embed = variables.embed +local v_unknown = variables.unknown +local v_max = variables.max + +local pdfconstant = lpdf.constant +local pdfdictionary = lpdf.dictionary +local pdfarray = lpdf.array +local pdfreference = lpdf.reference +local pdfunicode = lpdf.unicode +local pdfstring = lpdf.string +local pdfboolean = lpdf.boolean +local pdfcolorspec = lpdf.colorspec +local pdfflushobject = lpdf.flushobject +local pdfreserveannotation = lpdf.reserveannotation +local pdfreserveobject = lpdf.reserveobject +local pdfimmediateobject = lpdf.immediateobject +local pdfpagereference = lpdf.pagereference +local pdfshareobjectreference = lpdf.shareobjectreference + +local nodepool = nodes.pool + +local pdfannotation_node = nodepool.pdfannotation + +local hpack_node = node.hpack +local write_node = node.write + +local pdf_border = pdfarray { 0, 0, 0 } -- can be shared -- symbols local presets = { } -- xforms -function codeinjections.registersymbol(name,n) +local function registersymbol(name,n) presets[name] = pdfreference(n) end -function codeinjections.registeredsymbol(name) +local function registeredsymbol(name) return presets[name] end -function codeinjections.presetsymbol(symbol) +local function presetsymbol(symbol) if not presets[symbol] then - texsprint(ctxcatcodes,format("\\predefinesymbol[%s]",symbol)) + context.predefinesymbol { symbol } end end -function codeinjections.presetsymbollist(list) +local function presetsymbollist(list) if list then for symbol in gmatch(list,"[^, ]+") do - codeinjections.presetsymbol(symbol) + presetsymbol(symbol) end end end +codeinjections.registersymbol = registersymbol +codeinjections.registeredsymbol = registeredsymbol +codeinjections.presetsymbol = presetsymbol +codeinjections.presetsymbollist = presetsymbollist + -- comments -local symbols = { - New = pdfconstant("Insert"), - Insert = pdfconstant("Insert"), - Balloon = pdfconstant("Comment"), +-- local symbols = { +-- Addition = pdfconstant("NewParagraph"), +-- Attachment = pdfconstant("Attachment"), +-- Balloon = pdfconstant("Comment"), +-- Check = pdfconstant("Check Mark"), +-- CheckMark = pdfconstant("Check Mark"), +-- Circle = pdfconstant("Circle"), +-- Cross = pdfconstant("Cross"), +-- CrossHairs = pdfconstant("Cross Hairs"), +-- Graph = pdfconstant("Graph"), +-- InsertText = pdfconstant("Insert Text"), +-- New = pdfconstant("Insert"), +-- Paperclip = pdfconstant("Paperclip"), +-- RightArrow = pdfconstant("Right Arrow"), +-- RightPointer = pdfconstant("Right Pointer"), +-- Star = pdfconstant("Star"), +-- Tag = pdfconstant("Tag"), +-- Text = pdfconstant("Note"), +-- TextNote = pdfconstant("Text Note"), +-- UpArrow = pdfconstant("Up Arrow"), +-- UpLeftArrow = pdfconstant("Up-Left Arrow"), +-- } + +local attachment_symbols = { + Graph = pdfconstant("GraphPushPin"), + Paperclip = pdfconstant("PaperclipTag"), + Pushpin = pdfconstant("PushPin"), +} + +attachment_symbols.PushPin = attachment_symbols.Pushpin +attachment_symbols.Default = attachment_symbols.Pushpin + +local comment_symbols = { Comment = pdfconstant("Comment"), - Text = pdfconstant("Note"), - Addition = pdfconstant("NewParagraph"), - NewParagraph = pdfconstant("NewParagraph"), Help = pdfconstant("Help"), - Paragraph = pdfconstant("Paragraph"), + Insert = pdfconstant("Insert"), Key = pdfconstant("Key"), - Graph = pdfconstant("Graph"), - Paperclip = pdfconstant("Paperclip"), - Attachment = pdfconstant("Attachment"), - Tag = pdfconstant("Tag"), + Newparagraph = pdfconstant("NewParagraph"), + Note = pdfconstant("Note"), + Paragraph = pdfconstant("Paragraph"), } -symbols[variables.normal] = pdfconstant("Note") +comment_symbols.NewParagraph = Newparagraph +comment_symbols.Default = Note -local nofcomments, usepopupcomments, stripleading = 0, true, true - -local function analyzesymbol(symbol) +local function analyzesymbol(symbol,collection) if not symbol or symbol == "" then - return symbols.normal, nil - elseif symbols[symbol] then - return symbols[symbol], nil + return collection.Default, nil + elseif collection[symbol] then + return collection[symbol], nil else - local set = aux.settings_to_array(symbol) - local normal, down = set[1], set[2] - if normal then - normal = codeinjections.registeredsymbol(down or normal) - end - if down then - down = codeinjections.registeredsymbol(normal) - end - if down or normal then - return nil, pdfdictionary { - N = normal, - D = down, - } + local setn, setr, setd + local set = settings_to_array(symbol) + if #set == 1 then + setn, setr, setd = set[1], set[1], set[1] + elseif #set == 2 then + setn, setr, setd = set[1], set[1], set[2] + else + setn, setr, setd = set[1], set[2], set[3] end + local appearance = pdfdictionary { + N = setn and registeredsymbol(setn), + R = setr and registeredsymbol(setr), + D = setd and registeredsymbol(setd), + } + local appearanceref = pdfshareobjectreference(appearance) + return nil, appearanceref end end @@ -109,113 +161,279 @@ local function analyzelayer(layer) -- todo: (specification.layer ~= "" and pdfreference(specification.layer)) or nil, -- todo: ref to layer end -function codeinjections.registercomment(specification) +local function analyzecolor(colorvalue,colormodel) + local cvalue = colorvalue and tonumber(colorvalue) + local cmodel = colormodel and tonumber(colormodel) or 3 + return cvalue and pdfarray { lpdf.colorvalues(cmodel,cvalue) } or nil +end + +local function analyzetransparency(transparencyvalue) + local tvalue = transparencyvalue and tonumber(transparencyvalue) + return tvalue and lpdf.transparencyvalue(tvalue) or nil +end + +-- Attachments + +local nofattachments, attachments, filestreams, referenced = 0, { }, { }, { } + +local ignorereferenced = true -- fuzzy pdf spec .. twice in attachment list, can become an option + +local function flushembeddedfiles() + if next(filestreams) then + local e = pdfarray() + for tag, reference in next, filestreams do + if not reference then + report_attachment("unreferenced file: tag '%s'",tag) + elseif referenced[tag] == "hidden" then + e[#e+1] = pdfstring(tag) + e[#e+1] = reference -- already a reference + else + -- messy spec ... when annot not in named else twice in menu list acrobat + end + end + lpdf.addtonames("EmbeddedFiles",pdfreference(pdfflushobject(pdfdictionary{ Names = e }))) + end +end + +lpdf.registerdocumentfinalizer(flushembeddedfiles,"embeddedfiles") + +function codeinjections.embedfile(specification) + local data = specification.data + local filename = specification.file + local name = specification.name or "" + local title = specification.title or "" + local hash = specification.hash or filename + local keepdir = specification.keepdir -- can change + if filename == "" then + filename = nil + end + if data then + local r = filestreams[hash] + if r == false then + return nil + elseif r then + return r + elseif not filename then + filename = specification.tag + if not filename or filename == "" then + filename = specification.registered + end + if not filename or filename == "" then + filename = hash + end + end + else + if not filename then + return nil + end + local r = filestreams[hash] + if r == false then + return nil + elseif r then + return r + else + local foundname = resolvers.findbinfile(filename) or "" + if foundname == "" or not lfs.isfile(foundname) then + filestreams[filename] = false + return nil + else + specification.foundname = foundname + end + end + end + local basename = keepdir == true and filename or file.basename(filename) +local basename = string.gsub(basename,"%./","") + local savename = file.addsuffix(name ~= "" and name or basename,"txt") -- else no valid file + local a = pdfdictionary { Type = pdfconstant("EmbeddedFile") } + local f + if data then + f = pdfimmediateobject("stream",data,a()) + specification.data = true -- signal that still data but already flushed + else + local foundname = specification.foundname or filename + f = pdfimmediateobject("streamfile",foundname,a()) + end + local d = pdfdictionary { + Type = pdfconstant("Filespec"), + F = pdfstring(savename), + UF = pdfstring(savename), + EF = pdfdictionary { F = pdfreference(f) }, + Desc = title ~= "" and pdfunicode(title) or nil, + } + local r = pdfreference(pdfflushobject(d)) + filestreams[hash] = r + return r +end + +function nodeinjections.attachfile(specification) + local registered = specification.registered or "" + local data = specification.data + local hash + if data then + hash = md5.HEX(data) + else + local filename = specification.file + if not filename or filename == "" then + report_attachment("missing file specification: registered '%s', using registered instead",registered) + filename = registered + specification.file = registered + end + local foundname = resolvers.findbinfile(filename) or "" + if foundname == "" or not lfs.isfile(foundname) then + report_attachment("invalid file specification: registered '%s', filename '%s'",registered,filename) + return nil + else + specification.foundname = foundname + end + hash = filename + end + specification.hash = hash + nofattachments = nofattachments + 1 + local registered = specification.registered or "" + local title = specification.title or "" + local subtitle = specification.subtitle or "" + local author = specification.author or "" + if registered == "" then + registered = filename + end + if author == "" then + author = title + title = "" + end + if author == "" then + author = v_unknown + end + if title == "" then + title = registered + end + local aref = attachments[registered] + if not aref then + aref = codeinjections.embedfile(specification) + attachments[registered] = aref + end + if not aref then + report_attachment("skipping: registered '%s'",registered) + -- already reported + elseif specification.method == v_hidden then + referenced[hash] = "hidden" + else + referenced[hash] = "annotation" + local name, appearance = analyzesymbol(specification.symbol,attachment_symbols) + local d = pdfdictionary { + Subtype = pdfconstant("FileAttachment"), + FS = aref, + Contents = pdfunicode(title), + Name = name, + NM = pdfstring(format("attachment:%s",nofattachments)), + T = author ~= "" and pdfunicode(author) or nil, + Subj = subtitle ~= "" and pdfunicode(subtitle) or nil, + C = analyzecolor(specification.colorvalue,specification.colormodel), + CA = analyzetransparency(specification.transparencyvalue), + AP = appearance, + OC = analyzelayer(specification.layer), + } + local width, height, depth = specification.width or 0, specification.height or 0, specification.depth + local box = hpack_node(pdfannotation_node(width,height,depth,d())) + box.width, box.height, box.depth = width, height, depth + return box + end +end + +function codeinjections.attachmentid(filename) -- not used in context + return filestreams[filename] +end + +local nofcomments, usepopupcomments, stripleading = 0, false, true + +local defaultattributes = { + ["xmlns"] = "http://www.w3.org/1999/xhtml", + ["xmlns:xfa"] = "http://www.xfa.org/schema/xfa-data/1.0/", + ["xfa:contentType"] = "text/html", + ["xfa:APIVersion"] = "Acrobat:8.0.0", + ["xfa:spec"] = "2.4", +} + +local function checkcontent(text,option) + if option and option.xml then + local root = xml.convert(text) + if root and not root.er then + xml.checkbom(root) + local body = xml.first(root,"/body") + if body then + local at = body.at + for k, v in next, defaultattributes do + if not at[k] then + at[k] = v + end + end + -- local content = xml.textonly(root) + local richcontent = xml.tostring(root) + return nil, pdfunicode(richcontent) + end + end + end + return pdfunicode(text) +end + +function nodeinjections.comment(specification) -- brrr: seems to be done twice nofcomments = nofcomments + 1 - local text = buffers.collect(specification.buffer) + local text = string.strip(specification.data or "") if stripleading then text = gsub(text,"[\n\r] *","\n") end - local name, appearance = analyzesymbol(specification.symbol) + local name, appearance = analyzesymbol(specification.symbol,comment_symbols) + local tag = specification.tag or "" -- this is somewhat messy as recent + local title = specification.title or "" -- versions of acrobat see the title + local subtitle = specification.subtitle or "" -- as author + local author = specification.author or "" + local option = settings_to_hash(specification.option or "") + if author == "" then + if title == "" then + title = tag + end + else + if subtitle == "" then + subtitle = title + elseif title ~= "" then + subtitle = subtitle .. ", " .. title + end + title = author + end + local content, richcontent = checkcontent(text,option) local d = pdfdictionary { Subtype = pdfconstant("Text"), - Open = specification.open, - Contents = pdfunicode(text), - T = (specification.title ~= "" and pdfunicode(specification.title)) or nil, - C = pdfcolorspec(specification.colormodel,specification.colorvalue), + Open = option[v_max] and pdfboolean(true) or nil, + Contents = content, + RC = richcontent, + T = title ~= "" and pdfunicode(title) or nil, + Subj = subtitle ~= "" and pdfunicode(subtitle) or nil, + C = analyzecolor(specification.colorvalue,specification.colormodel), + CA = analyzetransparency(specification.transparencyvalue), OC = analyzelayer(specification.layer), Name = name, + NM = pdfstring(format("comment:%s",nofcomments)), AP = appearance, } - -- watch the nice feed back to tex hack + local width, height, depth = specification.width or 0, specification.height or 0, specification.depth + local box if usepopupcomments then - local nd = pdfreserveobject() - local nc = pdfreserveobject() + -- rather useless as we can hide/vide + local nd = pdfreserveannotation() + local nc = pdfreserveannotation() local c = pdfdictionary { Subtype = pdfconstant("Popup"), Parent = pdfreference(nd), } d.Popup = pdfreference(nc) - texbox["commentboxone"] = hpack_node(pdfannotation(0,0,0,d(),nd)) -- current dir - texbox["commentboxtwo"] = hpack_node(pdfannotation(specification.width,specification.height,0,c(),nc)) -- current dir + box = hpack_node( + pdfannotation_node(0,0,0,d(),nd), + pdfannotation_node(width,height,depth,c(),nc) + ) else - texbox["commentboxone"] = hpack_node(pdfannotation(0,0,0,d())) -- current dir - texbox["commentboxtwo"] = nil + box = hpack_node(pdfannotation_node(width,height,depth,d())) end -end - --- - -local nofattachments, attachments, filestreams = 0, { }, { } - -function codeinjections.embedfile(filename) - local r = filestreams[filename] - if r == false then - return nil - elseif r then - return r - elseif not lfs.isfile(filename) then - interfaces.showmessage("interactions",5,filename) - filestreams[filename] = false - return nil - else - local basename = file.basename(filename) - local a = pdfdictionary { Type = pdfconstant("EmbeddedFile") } - local f = pdfimmediateobj("streamfile",filename,a()) - local d = pdfdictionary { - Type = pdfconstant("Filespec"), - F = pdfstring(newname or basename), - UF = pdfstring(newname or basename), - EF = pdfdictionary { F = pdfreference(f) }, - } - local r = pdfreference(pdfflushobject(d)) - filestreams[filename] = r - return r - end -end - -function codeinjections.attachfile(specification) - local attachment = interactions.attachment(specification.label) - if not attachment then - -- todo: message - return - end - local filename = attachment.filename - if not filename or filename == "" then - -- todo: message - return - end - nofattachments = nofattachments + 1 - local label = attachment.label or "" - local title = attachment.title or "" - local newname = attachment.newname or "" - if label == "" then label = filename end - if title == "" then title = label end - if newname == "" then newname = filename end - local aref = attachments[label] - if not aref then - aref = codeinjections.embedfile(filename,newname) - attachments[label] = aref - end - local name, appearance = analyzesymbol(specification.symbol) - local d = pdfdictionary { - Subtype = pdfconstant("FileAttachment"), - FS = aref, - Contents = pdfunicode(title), - Name = name, - AP = appearance, - OC = analyzelayer(specification.layer), - C = pdfcolorspec(specification.colormodel,specification.colorvalue), - } - -- as soon as we can ask for the dimensions of an xform we can - -- use them here - local width = specification.width or 0 - local height = specification.height or 0 - local depth = specification.depth or 0 - write_node(pdfannotation(width,height,depth,d())) -end - -function codeinjections.attachmentid(filename) - return filestreams[filename] + box.width, box.height, box.depth = width, height, depth -- redundant + return box end -- rendering stuff @@ -239,12 +457,34 @@ end -- smil application/smil -- swf application/x-shockwave-flash +-- P media play parameters (evt /BE for controls etc +-- A boolean (audio) +-- C boolean (captions) +-- O boolean (overdubs) +-- S boolean (subtitles) +-- PL pdfconstant("ADBE_MCI"), + +-- F = flags, +-- T = title, +-- Contents = rubish, +-- AP = irrelevant, + +-- sound is different, no window (or zero) so we need to collect them and +-- force them if not set + local ms, mu, mf = { }, { }, { } -local delayed = { } +local function delayed(label) + local a = pdfreserveannotation() + mu[label] = a + return pdfreference(a) +end -local function insertrenderingwindow(label,width,height,specification) - if options == variables.auto then +local function insertrenderingwindow(specification) + local label = specification.label +--~ local openpage = specification.openpage +--~ local closepage = specification.closepage + if specification.option == v_auto then if openpageaction then -- \handlereferenceactions{\v!StartRendering{#2}} end @@ -255,97 +495,137 @@ local function insertrenderingwindow(label,width,height,specification) local actions = nil if openpage or closepage then actions = pdfdictionary { - PO = (openpage and lpdf.pdfaction(openpage )) or nil, - PC = (closepage and lpdf.pdfaction(closepage)) or nil, + PO = (openpage and lpdf.action(openpage )) or nil, + PC = (closepage and lpdf.action(closepage)) or nil, } end - local page = tonumber(specification.page) or texcount.realpageno + local page = tonumber(specification.page) or texcount.realpageno -- todo + local r = mu[label] or pdfreserveannotation() -- why the reserve here? + local a = pdfdictionary { + S = pdfconstant("Rendition"), + R = mf[label], + OP = 0, + AN = pdfreference(r), + } local d = pdfdictionary { Subtype = pdfconstant("Screen"), - P = pdfreference(tex.pdfpageref(page)), - A = mf[label], - Border = pdfarray { 0, 0, 0 } , + P = pdfreference(pdfpagereference(page)), + A = a, -- needed in order to make the annotation clickable (i.e. don't bark) + Border = pdf_border, AA = actions, } - local r = pdfreserveobj("annot") - write_node(pdfannotation(width,height,0,d(),r)) -- save ref + write_node(pdfannotation_node(specification.width or 0,specification.height or 0,0,d(),r)) -- save ref return pdfreference(r) end +-- some dictionaries can have a MH (must honor) or BE (best effort) capsule + local function insertrendering(specification) local label = specification.label + local option = settings_to_hash(specification.option) if not mf[label] then local filename = specification.filename local isurl = find(filename,"://") - local d = pdfdictionary { + --~ local start = pdfdictionary { + --~ Type = pdfconstant("MediaOffset"), + --~ S = pdfconstant("T"), -- time + --~ T = pdfdictionary { -- time + --~ Type = pdfconstant("Timespan"), + --~ S = pdfconstant("S"), + --~ V = 3, -- time in seconds + --~ }, + --~ } + --~ local start = pdfdictionary { + --~ Type = pdfconstant("MediaOffset"), + --~ S = pdfconstant("F"), -- frame + --~ F = 100 -- framenumber + --~ } + --~ local start = pdfdictionary { + --~ Type = pdfconstant("MediaOffset"), + --~ S = pdfconstant("M"), -- mark + --~ M = "somemark", + --~ } + --~ local parameters = pdfdictionary { + --~ BE = pdfdictionary { + --~ B = start, + --~ } + --~ } + --~ local parameters = pdfdictionary { + --~ Type = pdfconstant(MediaPermissions), + --~ TF = pdfstring("TEMPALWAYS") }, -- TEMPNEVER TEMPEXTRACT TEMPACCESS TEMPALWAYS + --~ } + local descriptor = pdfdictionary { + Type = pdfconstant("Filespec"), + F = filename, + } + if isurl then + descriptor.FS = pdfconstant("URL") + elseif option[v_embed] then + descriptor.EF = codeinjections.embedfile { file = filename } + end + local clip = pdfdictionary { + Type = pdfconstant("MediaClip"), + S = pdfconstant("MCD"), + N = label, + CT = specification.mime, + Alt = pdfarray { "", "file not found" }, -- language id + message + D = pdfreference(pdfflushobject(descriptor)), + -- P = pdfreference(pdfflushobject(parameters)), + } + local rendition = pdfdictionary { Type = pdfconstant("Rendition"), S = pdfconstant("MR"), - C = pdfdictionary { - Type = pdfconstant("MediaClip"), - S = pdfconstant("MCD"), - N = label, - CT = specification.mime, - Alt = pdfarray { - "", "file not found", -- language id + message - }, - D = pdfdictionary { - Type = pdfconstant("Filespec"), - F = filename, - FS = (isurl and pdfconstant("URL")) or nil, - } - } + N = label, + C = pdfreference(pdfflushobject(clip)), } - mf[label] = pdfreference(pdfflushobject(d)) - if not ms[label] then - mu[label] = insertrenderingwindow(label,0,0,specification.options) - end + mf[label] = pdfreference(pdfflushobject(rendition)) end end -local function insertrenderingobject(specification) +local function insertrenderingobject(specification) -- todo local label = specification.label if not mf[label] then - local d = pdfdictionary { + report_media("todo: unknown medium '%s'",label or "?") + local clip = pdfdictionary { -- does not work that well one level up + Type = pdfconstant("MediaClip"), + S = pdfconstant("MCD"), + N = label, + D = pdfreference(unknown), -- not label but objectname, hm .. todo? + } + local rendition = pdfdictionary { Type = pdfconstant("Rendition"), S = pdfconstant("MR"), - C = pdfdictionary { - Type = pdfconstant("MediaClip"), - S = pdfconstant("MCD"), - N = label, - D = pdfreference(unknown), -- not label but objectname, hm - } + N = label, + C = pdfreference(pdfflushobject(clip)), } - mf[label] = pdfreference(pdfflushobject(d)) - if ms[label] then - insertrenderingwindow(label,0,0,specification) - end + mf[label] = pdfreference(pdfflushobject(rendition)) end end -function codeinjections.insertrenderingwindow(specification) - local label = specification.label - codeinjections.processrendering(label) -- was check at tex end - ms[label] = insertrenderingwindow(label,specification.width,specification.height,specification) -end - function codeinjections.processrendering(label) - local specification = interactions.rendering(label) - if specification then - if specification.kind == "external" then - insertrendering(specification) - else - insertrenderingobject(specification) - end + local specification = interactions.renderings.rendering(label) + if not specification then + -- error + elseif specification.type == "external" then + insertrendering(specification) + else + insertrenderingobject(specification) end end +function codeinjections.insertrenderingwindow(specification) + local label = specification.label + codeinjections.processrendering(label) + ms[label] = insertrenderingwindow(specification) +end + local function set(operation,arguments) - codeinjections.processrendering(arguments) -- was check at the tex end + codeinjections.processrendering(arguments) return pdfdictionary { S = pdfconstant("Rendition"), OP = operation, R = mf[arguments], - AN = ms[arguments] or mu[arguments], + AN = ms[arguments] or delayed(arguments), } end diff --git a/Master/texmf-dist/tex/context/base/lpdf-xmp.lua b/Master/texmf-dist/tex/context/base/lpdf-xmp.lua index c8e7b2b5733..c9bead8a5b3 100644 --- a/Master/texmf-dist/tex/context/base/lpdf-xmp.lua +++ b/Master/texmf-dist/tex/context/base/lpdf-xmp.lua @@ -12,8 +12,16 @@ local xmlfillin = xml.fillin local trace_xmp = false trackers.register("backend.xmp", function(v) trace_xmp = v end) +local report_xmp = logs.reporter("backend","xmp") + +local backends, lpdf = backends, lpdf + +local codeinjections = backends.pdf.codeinjections -- normally it is registered + local pdfdictionary = lpdf.dictionary local pdfconstant = lpdf.constant +local pdfreference = lpdf.reference +local pdfobject = lpdf.object -- i wonder why this begin end is empty / w (no time now to look into it) @@ -69,18 +77,31 @@ local mapping = { -- maybe some day we will load the xmp file at runtime -local xmp, xmpfile, xmpname = nil, nil, "lpdf-xmp.xml" +local xmp, xmpfile, xmpname = nil, nil, "lpdf-pdx.xml" -function lpdf.setxmpfile(name) - xmpfile = resolvers.findctxfile(name) or "" - if xmpfile == "" then - xmpfile = nil +local function setxmpfile(name) + if xmp then + report_xmp("discarding loaded file '%s'",xmpfile) + xmp = nil end + xmpfile = name ~= "" and name end +codeinjections.setxmpfile = setxmpfile +commands.setxmpfile = setxmpfile + local function valid_xmp() if not xmp then - local xmpfile = xmpfile or resolvers.find_file(xmpname) or "" + -- local xmpfile = xmpfile or resolvers.findfile(xmpname) or "" + if xmpfile and xmpfile ~= "" then + xmpfile = resolvers.findfile(xmpfile) or "" + end + if not xmpfile or xmpfile == "" then + xmpfile = resolvers.findfile(xmpname) or "" + end + if xmpfile ~= "" then + report_xmp("using file '%s'",xmpfile) + end local xmpdata = (xmpfile ~= "" and io.loaddata(xmpfile)) or "" xmp = xml.convert(xmpdata) end @@ -119,47 +140,64 @@ end local t = { } for i=1,24 do t[i] = random() end local function flushxmpinfo() - commands.freezerandomseed(os.clock()) -- hack local t = { } for i=1,24 do t[i] = char(96 + random(26)) end local packetid = concat(t) - local time = lpdf.timestamp() - addxmpinfo("Producer",format("LuaTeX-%0.2f.%s",tex.luatexversion/100,tex.luatexrevision)) - addxmpinfo("DocumentID",format("uuid:%s",os.uuid())) - addxmpinfo("InstanceID",format("uuid:%s",os.uuid())) - addxmpinfo("CreatorTool","LuaTeX + ConTeXt MkIV") - addxmpinfo("CreateDate",time) - addxmpinfo("ModifyDate",time) - addxmpinfo("MetadataDate",time) - addxmpinfo("PTEX.Fullbanner", tex.pdftexbanner) + + local documentid = format("uuid:%s",os.uuid()) + local instanceid = format("uuid:%s",os.uuid()) + local producer = format("LuaTeX-%0.2f.%s",tex.luatexversion/100,tex.luatexrevision) + local creator = "LuaTeX + ConTeXt MkIV" + local time = lpdf.timestamp() + local fullbanner = tex.pdftexbanner + -- local fullbanner = gsub(tex.pdftexbanner,"kpse.*","") + + addxmpinfo("DocumentID", documentid) + addxmpinfo("InstanceID", instanceid) + addxmpinfo("Producer", producer) + addxmpinfo("CreatorTool", creator) + addxmpinfo("CreateDate", time) + addxmpinfo("ModifyDate", time) + addxmpinfo("MetadataDate", time) + addxmpinfo("PTEX.Fullbanner", fullbanner) + + addtoinfo("Producer", producer) + addtoinfo("Creator", creator) + addtoinfo("CreationDate", time) + addtoinfo("ModDate", time) +-- addtoinfo("PTEX.Fullbanner", fullbanner) -- no checking done on existence + local blob = xml.tostring(xml.first(xmp or valid_xmp(),"/x:xmpmeta")) local md = pdfdictionary { Subtype = pdfconstant("XML"), Type = pdfconstant("Metadata"), } if trace_xmp then - commands.writestatus("system","xmp data flushed (see log file)") + report_xmp("data flushed (see log file)") texio.write_nl("log","") texio.write("log","\n% ",(gsub(blob,"[\r\n]","\n%% ")),"\n") end blob = format(xpacket,packetid,blob) - if tex.pdfcompresslevel > 0 then + if not verbose and tex.pdfcompresslevel > 0 then blob = gsub(blob,">%s+<","><") end - local r = pdf.obj { + local r = pdfobject { immediate = true, compresslevel = 0, type = "stream", string = blob, attr = md(), } - lpdf.addtocatalog("Metadata",lpdf.reference(r)) + lpdf.addtocatalog("Metadata",pdfreference(r)) commands.defrostrandomseed() -- hack - end -- his will be enabled when we can inhibit compression for a stream at the lua end -lpdf.registerdocumentfinalizer(flushxmpinfo,1) +lpdf.registerdocumentfinalizer(flushxmpinfo,1,"metadata") + +directives.register("backend.verbosexmp", function(v) + verbose = v +end) diff --git a/Master/texmf-dist/tex/context/base/lpdf-xmp.xml b/Master/texmf-dist/tex/context/base/lpdf-xmp.xml deleted file mode 100644 index 2947211bd8e..00000000000 --- a/Master/texmf-dist/tex/context/base/lpdf-xmp.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - application/pdf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - False - - - - - - - diff --git a/Master/texmf-dist/tex/context/base/luat-bas.mkiv b/Master/texmf-dist/tex/context/base/luat-bas.mkiv index 581a5d95a09..d5075b4cbd9 100644 --- a/Master/texmf-dist/tex/context/base/luat-bas.mkiv +++ b/Master/texmf-dist/tex/context/base/luat-bas.mkiv @@ -11,28 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% \writestatus{loading}{ConTeXt Lua Macros / Basic Lua Libraries} - -%D This will move cq. become configurable. The XML like output is just -%D an example. - -% todo \let\normaleverytoks\everytoks \newtoks\everytoke \normaleverytoks{\the\everytoks} - -\chardef\statuswidth=15 -\chardef\statuswrite=16 - -\newtoks\everywritestring - -\def\writedirect {\immediate\write\statuswrite} -\def\writeline {\writedirect{}} -\def\writestring#1{\begingroup\the\everywritestring\writedirect{#1}\endgroup} - -\ifx\normalwritestatus\undefined \def\normalwritestatus#1#2{\writedirect{#1 : #2}} \fi - -% Because all libs are also on bytecodes we can start without stub. However, -% some initializations need to take place before the \TEX\ engine itself -% kicks in, especially memory settings and so. In due time we might make the -% stub smaller and just create a configuration startup file. +\writestatus{loading}{ConTeXt Lua Macros / Basic Lua Libraries} \registerctxluafile{l-string} {1.001} \registerctxluafile{l-lpeg} {1.001} @@ -40,18 +19,16 @@ \registerctxluafile{l-number} {1.001} \registerctxluafile{l-math} {1.001} \registerctxluafile{l-table} {1.001} -\registerctxluafile{l-aux} {1.001} +%registerctxluafile{l-aux} {1.001} \registerctxluafile{l-io} {1.001} \registerctxluafile{l-os} {1.001} \registerctxluafile{l-file} {1.001} \registerctxluafile{l-md5} {1.001} \registerctxluafile{l-dir} {1.001} \registerctxluafile{l-unicode}{1.001} -\registerctxluafile{l-utils} {1.001} -\registerctxluafile{l-dimen} {1.001} +%registerctxluafile{l-utils} {1.001} \registerctxluafile{l-url} {1.001} \registerctxluafile{l-set} {1.001} -\registerctxluafile{l-dimen} {1.001} % \registerctxluafile{socket.lua}{} % \registerctxluafile{ltn12.lua} {} diff --git a/Master/texmf-dist/tex/context/base/luat-bwc.lua b/Master/texmf-dist/tex/context/base/luat-bwc.lua new file mode 100644 index 00000000000..f893c7c5b5d --- /dev/null +++ b/Master/texmf-dist/tex/context/base/luat-bwc.lua @@ -0,0 +1,32 @@ +if not modules then modules = { } end modules ['luat-bwc'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- backward compatibility + +if not tex.wd then + + local box = tex.box + + local wd = { } setmetatable(wd, { + __index = function(t,k) local bk = box[k] return bk and bk.width or 0 end, + __newindex = function(t,k,v) local bk = box[k] if bk then bk.width = v end end, + } ) + + local ht = { } setmetatable(ht, { + __index = function(t,k) local bk = box[k] return bk and bk.height or 0 end, + __newindex = function(t,k,v) local bk = box[k] if bk then bk.height = v end end, + } ) + + local dp = { } setmetatable(dp, { + __index = function(t,k) local bk = box[k] return bk and bk.depth or 0 end, + __newindex = function(t,k,v) local bk = box[k] if bk then bk.depth = v end end, + } ) + +--~ tex.wd, tex.ht, tex.dp = wd, ht, dp + +end diff --git a/Master/texmf-dist/tex/context/base/luat-cbk.lua b/Master/texmf-dist/tex/context/base/luat-cbk.lua index 3cb63ad6ec5..031a24e0d85 100644 --- a/Master/texmf-dist/tex/context/base/luat-cbk.lua +++ b/Master/texmf-dist/tex/context/base/luat-cbk.lua @@ -6,19 +6,23 @@ if not modules then modules = { } end modules ['luat-cbk'] = { license = "see context related readme files" } -local insert, remove, find = table.insert, table.remove, string.find +local insert, remove, find, format = table.insert, table.remove, string.find, string.format local collectgarbage, type, next = collectgarbage, type, next local round = math.round local trace_checking = false trackers.register("memory.checking", function(v) trace_checking = v end) +local report_callbacks = logs.reporter("system","callbacks") +local report_memory = logs.reporter("system","memory") + --[[ldx--

Callbacks are the real asset of . They permit you to hook your own code into the engine. Here we implement a few handy auxiliary functions.

--ldx]]-- -callbacks = callbacks or { } +callbacks = callbacks or { } +local callbacks = callbacks --[[ldx--

When you (temporarily) want to install a callback function, and after a @@ -27,14 +31,55 @@ functions.

--ldx]]-- local trace_callbacks = false trackers.register("system.callbacks", function(v) trace_callbacks = v end) +local trace_calls = false -- only used when analyzing performance and initializations + +local register_callback, find_callback, list_callbacks = callback.register, callback.find, callback.list +local frozen, stack, list = { }, { }, callbacks.list + +if not callbacks.list then -- otherwise counters get reset + + list = utilities.storage.allocate(list_callbacks()) + + for k, _ in next, list do + list[k] = 0 + end + + callbacks.list = list + +end + +local delayed = table.tohash { + "buildpage_filter", +} + + +if trace_calls then + + local functions = { } + local original = register_callback -local register_callback, find_callback = callback.register, callback.find -local frozen, stack = { }, { } + register_callback = function(name,func) + if type(func) == "function" then + if functions[name] then + functions[name] = func + return find_callback(name) + else + functions[name] = func + local cnuf = function(...) + list[name] = list[name] + 1 + return functions[name](...) + end + return original(name,cnuf) + end + else + return original(name,func) + end + end -callback.original_register_callback = register_callback +end local function frozen_message(what,name) - logs.report("callbacks","not %s frozen '%s' (%s)",what,name,frozen[name]) + report_callbacks("not %s frozen '%s' (%s)",what,name,frozen[name]) end local function frozen_callback(name) @@ -52,14 +97,17 @@ local function state(name) end end +function callbacks.known(name) + return list[name] +end + function callbacks.report() - local list = callback.list() - for name, func in table.sortedhash(list) do + for name, _ in table.sortedhash(list) do local str = frozen[name] if str then - logs.report("callbacks","%s: %s -> %s",state(name),name,str) + report_callbacks("%s: %s -> %s",state(name),name,str) else - logs.report("callbacks","%s: %s",state(name),name) + report_callbacks("%s: %s",state(name),name) end end end @@ -67,7 +115,7 @@ end function callbacks.table() local NC, NR, verbatim = context.NC, context.NR, context.type context.starttabulate { "|l|l|p|" } - for name, func in table.sortedhash(callback.list()) do + for name, _ in table.sortedhash(list) do NC() verbatim(name) NC() verbatim(state(name)) NC() context(frozen[name] or "") NC() NR() end context.stoptabulate() @@ -75,11 +123,9 @@ end function callbacks.freeze(name,freeze) freeze = type(freeze) == "string" and freeze ---~ print(name) if find(name,"%*") then - local pattern = name -- string.simpleesc(name) - local list = callback.list() - for name, func in next, list do + local pattern = name + for name, _ in next, list do if find(name,pattern) then frozen[name] = freeze or frozen[name] or "frozen" end @@ -98,6 +144,9 @@ function callbacks.register(name,func,freeze) elseif freeze then frozen[name] = (type(freeze) == "string" and freeze) or "registered" end + if delayed[name] and environment.initex then + return nil + end return register_callback(name,func) end @@ -138,6 +187,18 @@ function callbacks.pop(name) end end +if trace_calls then + statistics.register("callback details", function() + local t = { } -- todo: pass function to register and quit at nil + for name, n in table.sortedhash(list) do + if n > 0 then + t[#t+1] = format("%s -> %s",name,n) + end + end + return t + end) +end + --~ -- somehow crashes later on --~ --~ callbacks.freeze("find_.*_file","finding file") @@ -203,9 +264,13 @@ restart the collector. Okay, experimental code has been removed, because messing aroudn with the gc is too unpredictable.

--ldx]]-- -garbagecollector = garbagecollector or { } +-- For the moment we keep this here and not in util-gbc.lua or so. + +utilities = utilities or { } +utilities.garbagecollector = utilities.garbagecollector or { } +local garbagecollector = utilities.garbagecollector -garbagecollector.enabled = false +garbagecollector.enabled = false -- could become a directive garbagecollector.criterium = 4*1024*1024 -- Lua allocates up to 12 times the amount of memory needed for @@ -238,7 +303,7 @@ function garbagecollector.check(size,criterium) local b = collectgarbage("count") collectgarbage("collect") local a = collectgarbage("count") - logs.report("memory","forced sweep, collected: %s MB, used: %s MB",round((b-a)/1000),round(a/1000)) + report_memory("forced sweep, collected: %s MB, used: %s MB",round((b-a)/1000),round(a/1000)) else collectgarbage("collect") end diff --git a/Master/texmf-dist/tex/context/base/luat-cnf.lua b/Master/texmf-dist/tex/context/base/luat-cnf.lua index e45aceb79f4..609dc412bcf 100644 --- a/Master/texmf-dist/tex/context/base/luat-cnf.lua +++ b/Master/texmf-dist/tex/context/base/luat-cnf.lua @@ -6,41 +6,49 @@ if not modules then modules = { } end modules ['luat-cnf'] = { license = "see context related readme files" } +local type, next, tostring, tonumber = type, next, tostring, tonumber local format, concat, find = string.format, table.concat, string.find -luatex = luatex or { } - -luatex.variablenames = { - 'main_memory', 'extra_mem_bot', 'extra_mem_top', - 'buf_size','expand_depth', - 'font_max', 'font_mem_size', - 'hash_extra', 'max_strings', 'pool_free', 'pool_size', 'string_vacancies', - 'obj_tab_size', 'pdf_mem_size', 'dest_names_size', - 'nest_size', 'param_size', 'save_size', 'stack_size','expand_depth', - 'trie_size', 'hyph_size', 'max_in_open', - 'ocp_stack_size', 'ocp_list_size', 'ocp_buf_size', - 'max_print_line', -} +local allocate = utilities.storage.allocate -function luatex.variables() - local t, x = { }, nil - for _,v in next, luatex.variablenames do - x = resolvers.var_value(v) - if x and find(x,"^%d+$") then - t[v] = tonumber(x) - end - end - return t -end +texconfig.kpse_init = false +texconfig.shell_escape = 't' -if not luatex.variables_set then - for k, v in next, luatex.variables() do - texconfig[k] = v - end - luatex.variables_set = true -end +luatex = luatex or { } +local luatex = luatex + +texconfig.error_line = 79 -- 79 -- obsolete +texconfig.half_error_line = 50 -- 50 -- obsolete + +texconfig.expand_depth = 10000 -- 10000 +texconfig.hash_extra = 100000 -- 0 +texconfig.nest_size = 1000 -- 50 +texconfig.max_in_open = 500 -- 15 +texconfig.max_print_line = 10000 -- 79 +texconfig.max_strings = 500000 -- 15000 +texconfig.param_size = 25000 -- 60 +texconfig.save_size = 50000 -- 4000 +texconfig.stack_size = 10000 -- 300 + +--~ local function initialize() +--~ local t, variable = allocate(), resolvers.variable +--~ for name, default in next, variablenames do +--~ local name = variablenames[i] +--~ local value = variable(name) +--~ value = tonumber(value) +--~ if not value or value == "" or value == 0 then +--~ value = default +--~ end +--~ texconfig[name], t[name] = value, value +--~ end +--~ initialize = nil +--~ return t +--~ end + +--~ luatex.variables = initialize() local stub = [[ + -- checking storage = storage or { } @@ -48,7 +56,7 @@ luatex = luatex or { } -- we provide our own file handling -texconfig.kpse_init = false +texconfig.kpse_init = false texconfig.shell_escape = 't' -- as soon as possible @@ -59,14 +67,66 @@ luatex.starttime = os.gettimeofday() function texconfig.init() - -- shortcut and helper + -- development + + local builtin, globals = { }, { } + + libraries = { -- we set it her as we want libraries also 'indexed' + basiclua = { + "string", "table", "coroutine", "debug", "file", "io", "lpeg", "math", "os", "package", + }, + basictex = { -- noad + "callback", "font", "img", "lang", "lua", "node", "pdf", "status", "tex", "texconfig", "texio", "token", + }, + extralua = { + "gzip", "zip", "zlib", "lfs", "ltn12", "mime", "socket", "md5", "profiler", "unicode", "utf", + }, + extratex = { + "epdf", "fontloader", "kpse", "mplib", + }, + obsolete = { + "fontforge", -- can be filled by luat-log + "kpse", + }, + builtin = builtin, -- to be filled + globals = globals, -- to be filled + } + + for k, v in next, _G do + globals[k] = tostring(v) + end - local b = lua.bytecode + local function collect(t) + local lib = { } + for k, v in next, t do + local keys = { } + local gv = _G[v] + if type(gv) == "table" then + for k, v in next, gv do + keys[k] = tostring(v) -- true -- by tostring we cannot call overloades functions (security) + end + end + lib[v] = keys + builtin[v] = keys + end + return lib + end + + libraries.basiclua = collect(libraries.basiclua) + libraries.basictex = collect(libraries.basictex) + libraries.extralua = collect(libraries.extralua) + libraries.extratex = collect(libraries.extratex) + libraries.obsolete = collect(libraries.obsolete) + + -- shortcut and helper local function init(start) + local b = lua.bytecode local i = start while b[i] do - b[i]() ; b[i] = nil ; i = i + 1 + b[i]() ; + b[i] = nil ; + i = i + 1 -- collectgarbage('step') end return i - start @@ -89,27 +149,28 @@ end) -- done, from now on input and callbacks are internal ]] -function luatex.dumpstate(name,firsttable) - if tex and tex.luatexversion < 38 then - os.remove(name) - elseif true then - local t = { - "-- this file is generated, don't change it\n", - "-- configuration (can be overloaded later)\n" - } - for _,v in next, luatex.variablenames do - local tv = texconfig[v] - if tv then - t[#t+1] = format("texconfig.%s=%s",v,tv) - end + +local variablenames = { + "error_line", "half_error_line", + "expand_depth", "hash_extra", "nest_size", + "max_in_open", "max_print_line", "max_strings", + "param_size", "save_size", "stack_size", +} + +local function makestub() + name = name or (environment.jobname .. ".lui") + firsttable = firsttable or lua.firstbytecode + local t = { + "-- this file is generated, don't change it\n", + "-- configuration (can be overloaded later)\n" + } + for _,v in next, variablenames do + local tv = texconfig[v] + if tv and tv ~= "" then + t[#t+1] = format("texconfig.%s=%s",v,tv) end - io.savedata(name,format("%s\n\n%s",concat(t,"\n"),format(stub,firsttable or 501))) - else - io.savedata(name,format(stub,firsttable or 501)) end + io.savedata(name,format("%s\n\n%s",concat(t,"\n"),format(stub,firsttable))) end -texconfig.kpse_init = false -texconfig.max_print_line = 100000 -texconfig.max_in_open = 127 -texconfig.shell_escape = 't' +lua.registerfinalizer(makestub,"create stub file") diff --git a/Master/texmf-dist/tex/context/base/luat-cod.lua b/Master/texmf-dist/tex/context/base/luat-cod.lua new file mode 100644 index 00000000000..a9cd4551b3b --- /dev/null +++ b/Master/texmf-dist/tex/context/base/luat-cod.lua @@ -0,0 +1,167 @@ +if not modules then modules = { } end modules ['luat-cod'] = { + version = 1.001, + comment = "companion to luat-cod.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local match, gsub, find = string.match, string.gsub, string.find + +local texconfig, lua = texconfig, lua + +-- some basic housekeeping + +texconfig.kpse_init = false +texconfig.shell_escape = 't' +texconfig.max_print_line = 100000 +texconfig.max_in_open = 127 + +-- registering bytecode chunks + +lua.bytecode = lua.bytecode or { } -- built in anyway +lua.bytedata = lua.bytedata or { } +lua.bytedone = lua.bytedone or { } + +local bytecode, bytedata, bytedone = lua.bytecode, lua.bytedata, lua.bytedone + +lua.firstbytecode = 501 +lua.lastbytecode = lua.lastbytecode or (lua.firstbytecode - 1) -- as we load ourselves again ... maybe return earlier + +function lua.registeredcodes() + return lua.lastbytecode - lua.firstbytecode + 1 +end + +function lua.registercode(filename,version) + local barename = gsub(filename,"%.[%a%d]+$","") + if barename == filename then filename = filename .. ".lua" end + local basename = match(barename,"^.+[/\\](.-)$") or barename + if not bytedone[barename] then + local code = environment.luafilechunk(filename) + if code then + assert(code)() + bytedone[barename] = true + if environment.initex then + local n = lua.lastbytecode + 1 + bytedata[n] = { barename, version } + bytecode[n] = code + lua.lastbytecode = n + end + end + end +end + +local finalizers = { } + +function lua.registerfinalizer(f,comment) + if type(f) == "function" then + finalizers[#finalizers+1] = { action = f, comment = comment } + else + print(string.format("fatal error: invalid finalizer, action: %s",finalizer.comment or "unknown")) + os.exit() + end +end + +function lua.finalize(logger) + for i=1,#finalizers do + local finalizer = finalizers[i] + finalizer.action() + if logger then + logger("finalizing lua", "action: %s",finalizer.comment) + end + end +end + +-- A first start with environments. This will be overloaded later. + +environment = environment or { } +local environment = environment + +local sourcefile = arg and arg[1] or "" +local sourcepath = find(sourcefile,"/") and gsub(sourcefile,"/[^/]+$","") or "" +local targetpath = "." + +-- delayed (via metatable): +-- +-- environment.jobname = tex.jobname +-- environment.version = tostring(tex.toks.contextversiontoks) + +environment.initex = tex.formatname == "" + +if not environment.luafilechunk then + + function environment.luafilechunk(filename) + if sourcepath ~= "" then + filename = sourcepath .. "/" .. filename + end + local data = loadfile(filename) + texio.write("<",data and "+ " or "- ",filename,">") + return data + end + +end + +if not environment.engineflags then + local engineflags = { } + for i=-10,#arg do + local a = arg[i] + if a then + local flag, content = match(a,"^%-%-([^=]+)=?(.-)$") + if flag then + engineflags[flag] = content or "" + end + end + end + environment.engineflags = engineflags +end + +-- We need a few premature callbacks in the format generator. We +-- also do this when the format is loaded as otherwise we get +-- a kpse error when disabled. This is an engine issue that will +-- be sorted out in due time. + +local isfile = lfs.isfile + +local function source_file(name) + local fullname = sourcepath .. "/" .. name + if isfile(fullname) then + return fullname + end + fullname = fullname .. ".tex" + if isfile(fullname) then + return fullname + end + if isfile(name) then + return name + end + name = name .. ".tex" + if isfile(name) then + return name + end + return nil +end + +local function target_file(name) + return targetpath .. "/" .. name +end + +local function find_read_file (id,name) + return source_file(name) +end + +local function find_write_file(id,name) + return target_file(name) +end + +local function open_read_file(name) + local f = io.open(name,'rb') + return { + reader = function() + return f:read("*line") + end + } +end + +callback.register('find_read_file' , find_read_file ) +callback.register('open_read_file' , open_read_file ) +callback.register('find_write_file', find_write_file) diff --git a/Master/texmf-dist/tex/context/base/luat-cod.mkiv b/Master/texmf-dist/tex/context/base/luat-cod.mkiv index d3b37d0e145..47a89844082 100644 --- a/Master/texmf-dist/tex/context/base/luat-cod.mkiv +++ b/Master/texmf-dist/tex/context/base/luat-cod.mkiv @@ -13,13 +13,20 @@ % \writestatus{loading}{ConTeXt Lua Macros / Code} +\unprotect + +\long\def\expanded#1{\long\xdef\lastexpanded{\noexpand#1}\lastexpanded} +%long\def\expanded#1{\normalexpanded{\noexpand#1}} % compatible ## mess + +\newif\ifproductionrun + %D Originally we compiled the lua files externally and loaded %D then at runtime, but when the amount grew, we realized that %D we needed away to store them in the format, which is what %D bytecode arrays do. And so the following is obsolete: %D %D \starttyping -%D \chardef\ctxluaembeddingmode \plusone +%D \setnewconstant\ctxluaembeddingmode \plusone %D %D 0 = external compilation and loading %D 1 = runtime compilation and embedding @@ -31,9 +38,17 @@ %D scripts need to share data anyway. So eventually \LUATEX\ got only %D one instance. Because each call is reentrant there is not much %D danger for crashes. +%D +%D Most code here has changed after version 0.60 as part of adaption to +%D new functionality. We no longer support the hooks for initializing +%D code as this can be done at the \LUA\ end. \def\ctxdirectlua{\directlua\zerocount} \def\ctxlatelua {\latelua \zerocount} +\def\ctxsprint #1{\directlua\zerocount{tex.sprint(tex.ctxcatcodes,#1)}} % saves tokens +\def\ctxwrite #1{\directlua\zerocount{tex.write(#1)}} % saves tokens +\def\ctxcommand#1{\directlua\zerocount{commands.#1}} % saves tokens +\def\ctxreport #1{\directlua\zerocount{logs.writer[[#1]]}} %D Take your choice \unknown @@ -46,116 +61,11 @@ \edef\luaversion{\ctxlua{tex.print(_VERSION)}} -%D We want to define \LUA\ related things in the format but -%D need to reload code because \LUA\ instances themselves are -%D not dumped into the format. - -\newtoks\everyloadluacode -\newtoks\everyfinalizeluacode - -\normaleveryjob{\the\everyloadluacode\the\everyfinalizeluacode\the\everyjob} - -\newif\ifproductionrun - -%D Here we operate in the \TEX\ catcode regime as we haven't yet defined -%D catcode regimes. A chicken or egg problem. - -\normalprotected\long\def\startruntimeluacode#1\stopruntimeluacode % only simple code (load +init) - {\ifproductionrun - \global\let\startruntimeluacode\relax - \global\let\stopruntimeluacode \relax - \else - \global\everyloadluacode\expandafter{\the\everyloadluacode#1}% - \fi - #1} % maybe no interference - -\normalprotected\long\def\startruntimectxluacode#1\stopruntimectxluacode - {\startruntimeluacode\ctxlua{#1}\stopruntimeluacode} - -%D Next we load the initialization code. - -\startruntimectxluacode - environment = environment or { } - environment.jobname = "\jobname" % tex.jobname - environment.initex = \ifproductionrun false \else true \fi % tex.formatname == "" - environment.version = "\fmtversion" -\stopruntimectxluacode - -% we start at 500, below this, we store predefined data (dumps) - -\newcount\luabytecodecounter \luabytecodecounter=500 - -\startruntimectxluacode - lua.bytedata = lua.bytedata or { } -\stopruntimectxluacode - -%D Handy when we expand: - -\let\stopruntimeluacode \relax -\let\stopruntimectxluacode\relax - -\long\def\lastexpanded{} % todo: elsewhere we use \@@expanded - -\long\def\expanded#1{\long\xdef\lastexpanded{\noexpand#1}\lastexpanded} - -%D More code: - -% \def\ctxluabytecode#1% executes an already loaded chunk -% {\ctxlua { -% local str = '' -% if lua.bytedata[#1] then -% str = " from file " .. lua.bytedata[#1][1] .. " version " .. lua.bytedata[#1][2] -% end -% if lua.bytecode[#1] then -% if environment.initex then -% texio.write_nl("bytecode: executing blob " .. "#1" .. str) -% assert(lua.bytecode[#1])() -% else -% texio.write_nl("bytecode: initializing blob " .. "#1" .. str) -% assert(lua.bytecode[#1])() -% lua.bytecode[#1] = nil -% end -% else -% texio.write_nl("bytecode: invalid blob " .. "#1" .. str) -% end -% }} - -\def\ctxluabytecode#1% executes an already loaded chunk - {\ctxlua { - local lbc = lua.bytecode - if lbc[#1] then - assert(lbc[#1])() - if not environment.initex then - lbc[#1] = nil - end - end - }} - -\def\ctxluabyteload#1#2% registers and compiles chunk - {\global\advance\luabytecodecounter \plusone - \normalexpanded{\startruntimectxluacode - lua.bytedata[\the\luabytecodecounter] = { "#1", "#2" } - \stopruntimectxluacode}% - \ctxlua { - lua.bytedata[\the\luabytecodecounter] = { "#1", "#2" } - lua.bytecode[\the\luabytecodecounter] = environment.luafilechunk("#1") - }} - -\def\ctxloadluafile#1#2% load a (either not compiled) chunk at runtime - {\doifelsenothing{#2} - {\ctxlua{environment.loadluafile("#1")}} - {\ctxlua{environment.loadluafile("#1",#2)}}} +\def\registerctxluafile#1#2{\ctxlua{lua.registercode("#1","#2")}} +\def\ctxloadluafile #1{\ctxlua{lua.registercode("#1")}} -\def\registerctxluafile#1#2% name version (modules and core code) - {\ifproductionrun - \ctxloadluafile{#1}{#2}% - \else - \ctxluabyteload{#1}{#2}% can go away - \fi - \global\everyloadluacode\expandafter\expandafter\expandafter{\expandafter\the\expandafter\everyloadluacode - \expandafter\ctxluabytecode\expandafter{\the\luabytecodecounter}}% - \ctxluabytecode{\the\luabytecodecounter}} +\registerctxluafile{luat-cod}{1.001} -\everydump\expandafter{\the\everydump\ctxlua{luatex.dumpstate(environment.jobname..".lui",501)}} +% \everydump\expandafter{\the\everydump\ctxlua{lua.finalize()}} -\endinput +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/luat-dum.lua b/Master/texmf-dist/tex/context/base/luat-dum.lua deleted file mode 100644 index 4530c2ef34e..00000000000 --- a/Master/texmf-dist/tex/context/base/luat-dum.lua +++ /dev/null @@ -1,126 +0,0 @@ -if not modules then modules = { } end modules ['luat-dum'] = { - version = 1.001, - comment = "companion to luatex-*.tex", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local dummyfunction = function() end - -statistics = { - register = dummyfunction, - starttiming = dummyfunction, - stoptiming = dummyfunction, -} -directives = { - register = dummyfunction, - enable = dummyfunction, - disable = dummyfunction, -} -trackers = { - register = dummyfunction, - enable = dummyfunction, - disable = dummyfunction, -} -experiments = { - register = dummyfunction, - enable = dummyfunction, - disable = dummyfunction, -} -storage = { - register = dummyfunction, - shared = { }, -} -logs = { - report = dummyfunction, - simple = dummyfunction, -} -tasks = { - new = dummyfunction, - actions = dummyfunction, - appendaction = dummyfunction, - prependaction = dummyfunction, -} -callbacks = { - register = function(n,f) return callback.register(n,f) end, -} - --- we need to cheat a bit here - -texconfig.kpse_init = true - -resolvers = resolvers or { } -- no fancy file helpers used - -local remapper = { - otf = "opentype fonts", - ttf = "truetype fonts", - ttc = "truetype fonts", - dfont = "truetype dictionary", - cid = "cid maps", - fea = "font feature files", -} - -function resolvers.find_file(name,kind) - name = string.gsub(name,"\\","\/") - kind = string.lower(kind) - return kpse.find_file(name,(kind and kind ~= "" and (remapper[kind] or kind)) or file.extname(name,"tex")) -end - -function resolvers.findbinfile(name,kind) - if not kind or kind == "" then - kind = file.extname(name) -- string.match(name,"%.([^%.]-)$") - end - return resolvers.find_file(name,(kind and remapper[kind]) or kind) -end - --- Caches ... I will make a real stupid version some day when I'm in the --- mood. After all, the generic code does not need the more advanced --- ConTeXt features. Cached data is not shared between ConTeXt and other --- usage as I don't want any dependency at all. Also, ConTeXt might have --- different needs and tricks added. - -caches = { } - ---~ containers.usecache = true - -function caches.setpath(category,subcategory) - local root = kpse.var_value("TEXMFCACHE") or "" - if root == "" then - root = kpse.var_value("VARTEXMF") or "" - end - if root ~= "" then - root = file.join(root,category) - lfs.mkdir(root) - root = file.join(root,subcategory) - lfs.mkdir(root) - return lfs.isdir(root) and root - end -end - -local function makefullname(path,name) - if path and path ~= "" then - name = "temp-" and name -- clash prevention - return file.addsuffix(file.join(path,name),"lua") - end -end - -function caches.iswritable(path,name) - local fullname = makefullname(path,name) - return fullname and file.iswritable(fullname) -end - -function caches.loaddata(path,name) - local fullname = makefullname(path,name) - if fullname then - local data = loadfile(fullname) - return data and data() - end -end - -function caches.savedata(path,name,data) - local fullname = makefullname(path,name) - if fullname then - table.tofile(fullname,data,'return',false,true,false) - end -end diff --git a/Master/texmf-dist/tex/context/base/luat-env.lua b/Master/texmf-dist/tex/context/base/luat-env.lua index 0e21fca31e9..4f1b661c218 100644 --- a/Master/texmf-dist/tex/context/base/luat-env.lua +++ b/Master/texmf-dist/tex/context/base/luat-env.lua @@ -14,8 +14,13 @@ if not modules then modules = { } end modules ['luat-env'] = { local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) +local report_lua = logs.reporter("resolvers","lua") + +local allocate, mark = utilities.storage.allocate, utilities.storage.mark + local format, sub, match, gsub, find = string.format, string.sub, string.match, string.gsub, string.find -local unquote, quote = string.unquote, string.quote +local unquoted, quoted = string.unquoted, string.quoted +local concat = table.concat -- precautions @@ -28,25 +33,53 @@ end -- dirty tricks if arg and (arg[0] == 'luatex' or arg[0] == 'luatex.exe') and arg[1] == "--luaonly" then - arg[-1]=arg[0] arg[0]=arg[2] for k=3,#arg do arg[k-2]=arg[k] end arg[#arg]=nil arg[#arg]=nil -end - -if profiler and os.env["MTX_PROFILE_RUN"] == "YES" then - profiler.start("luatex-profile.log") + arg[-1] = arg[0] + arg[ 0] = arg[2] + for k=3,#arg do + arg[k-2] = arg[k] + end + arg[#arg] = nil -- last + arg[#arg] = nil -- pre-last end -- environment environment = environment or { } -environment.arguments = { } -environment.files = { } +local environment = environment + +environment.arguments = allocate() +environment.files = allocate() environment.sortedflags = nil -if not environment.jobname or environment.jobname == "" then if tex then environment.jobname = tex.jobname end end -if not environment.version or environment.version == "" then environment.version = "unknown" end -if not environment.jobname then environment.jobname = "unknown" end +local mt = { + __index = function(_,k) + if k == "version" then + local version = tex.toks and tex.toks.contextversiontoks + if version and version ~= "" then + rawset(environment,"version",version) + return version + else + return "unknown" + end + elseif k == "jobname" or k == "formatname" then + local name = tex and tex[k] + if name or name== "" then + rawset(environment,k,name) + return name + else + return "unknown" + end + elseif k == "outputfilename" then + local name = environment.jobname + rawset(environment,k,name) + return name + end + end +} + +setmetatable(environment,mt) -function environment.initialize_arguments(arg) +function environment.initializearguments(arg) local arguments, files = { }, { } environment.arguments, environment.files, environment.sortedflags = arguments, files, nil for index=1,#arg do @@ -54,7 +87,7 @@ function environment.initialize_arguments(arg) if index > 0 then local flag, value = match(argument,"^%-+(.-)=(.-)$") if flag then - arguments[flag] = unquote(value or "") + arguments[flag] = unquoted(value or "") else flag = match(argument,"^%-+(.+)") if flag then @@ -83,7 +116,7 @@ function environment.argument(name,partial) return arguments[name] elseif partial then if not sortedflags then - sortedflags = table.sortedkeys(arguments) + sortedflags = allocate(table.sortedkeys(arguments)) for k=1,#sortedflags do sortedflags[k] = "^" .. sortedflags[k] end @@ -100,13 +133,11 @@ function environment.argument(name,partial) return nil end -environment.argument("x",true) - -function environment.split_arguments(separator) -- rather special, cut-off before separator +function environment.splitarguments(separator) -- rather special, cut-off before separator local done, before, after = false, { }, { } - local original_arguments = environment.original_arguments - for k=1,#original_arguments do - local v = original_arguments[k] + local originalarguments = environment.originalarguments + for k=1,#originalarguments do + local v = originalarguments[k] if not done and v == separator then done = true elseif done then @@ -118,32 +149,51 @@ function environment.split_arguments(separator) -- rather special, cut-off befor return before, after end -function environment.reconstruct_commandline(arg,noquote) - arg = arg or environment.original_arguments +function environment.reconstructcommandline(arg,noquote) + arg = arg or environment.originalarguments if noquote and #arg == 1 then + -- we could just do: return unquoted(resolvers.resolve(arg[i])) local a = arg[1] a = resolvers.resolve(a) - a = unquote(a) + a = unquoted(a) return a elseif #arg > 0 then local result = { } for i=1,#arg do + -- we could just do: result[#result+1] = format("%q",unquoted(resolvers.resolve(arg[i]))) local a = arg[i] a = resolvers.resolve(a) - a = unquote(a) + a = unquoted(a) a = gsub(a,'"','\\"') -- tricky if find(a," ") then - result[#result+1] = quote(a) + result[#result+1] = quoted(a) else result[#result+1] = a end end - return table.join(result," ") + return concat(result," ") else return "" end end +--~ -- to be tested: +--~ +--~ function environment.reconstructcommandline(arg,noquote) +--~ arg = arg or environment.originalarguments +--~ if noquote and #arg == 1 then +--~ return unquoted(resolvers.resolve(arg[1])) +--~ elseif #arg > 0 then +--~ local result = { } +--~ for i=1,#arg do +--~ result[#result+1] = format("%q",unquoted(resolvers.resolve(arg[i]))) -- always quote +--~ end +--~ return concat(result," ") +--~ else +--~ return "" +--~ end +--~ end + if arg then -- new, reconstruct quoted snippets (maybe better just remove the " then and add them later) @@ -169,9 +219,10 @@ if arg then newarg[i] = arg[i] end - environment.initialize_arguments(newarg) - environment.original_arguments = newarg - environment.raw_arguments = arg + environment.initializearguments(newarg) + + environment.originalarguments = mark(newarg) + environment.rawarguments = mark(arg) arg = { } -- prevent duplicate handling @@ -180,45 +231,37 @@ end -- weird place ... depends on a not yet loaded module function environment.texfile(filename) - return resolvers.find_file(filename,'tex') + return resolvers.findfile(filename,'tex') end function environment.luafile(filename) - local resolved = resolvers.find_file(filename,'tex') or "" + local resolved = resolvers.findfile(filename,'tex') or "" if resolved ~= "" then return resolved end - resolved = resolvers.find_file(filename,'texmfscripts') or "" + resolved = resolvers.findfile(filename,'texmfscripts') or "" if resolved ~= "" then return resolved end - return resolvers.find_file(filename,'luatexlibs') or "" + return resolvers.findfile(filename,'luatexlibs') or "" end environment.loadedluacode = loadfile -- can be overloaded ---~ function environment.loadedluacode(name) ---~ if os.spawn("texluac -s -o texluac.luc " .. name) == 0 then ---~ local chunk = loadstring(io.loaddata("texluac.luc")) ---~ os.remove("texluac.luc") ---~ return chunk ---~ else ---~ environment.loadedluacode = loadfile -- can be overloaded ---~ return loadfile(name) ---~ end ---~ end - -function environment.luafilechunk(filename) -- used for loading lua bytecode in the format +function environment.luafilechunk(filename,silent) -- used for loading lua bytecode in the format filename = file.replacesuffix(filename, "lua") local fullname = environment.luafile(filename) if fullname and fullname ~= "" then + local data = environment.loadedluacode(fullname) if trace_locating then - logs.report("fileio","loading file %s", fullname) + report_lua("loading file %s%s", fullname, not data and " failed" or "") + elseif not silent then + texio.write("<",data and "+ " or "- ",fullname,">") end - return environment.loadedluacode(fullname) + return data else if trace_locating then - logs.report("fileio","unknown file %s", filename) + report_lua("unknown file %s", filename) end return nil end @@ -238,7 +281,7 @@ function environment.loadluafile(filename, version) local fullname = (lucname and environment.luafile(lucname)) or "" if fullname ~= "" then if trace_locating then - logs.report("fileio","loading %s", fullname) + report_lua("loading %s", fullname) end chunk = loadfile(fullname) -- this way we don't need a file exists check end @@ -256,7 +299,7 @@ function environment.loadluafile(filename, version) return true else if trace_locating then - logs.report("fileio","version mismatch for %s: lua=%s, luc=%s", filename, v, version) + report_lua("version mismatch for %s: lua=%s, luc=%s", filename, v, version) end environment.loadluafile(filename) end @@ -267,12 +310,12 @@ function environment.loadluafile(filename, version) fullname = (luaname and environment.luafile(luaname)) or "" if fullname ~= "" then if trace_locating then - logs.report("fileio","loading %s", fullname) + report_lua("loading %s", fullname) end chunk = loadfile(fullname) -- this way we don't need a file exists check if not chunk then if trace_locating then - logs.report("fileio","unknown file %s", filename) + report_lua("unknown file %s", filename) end else assert(chunk)() diff --git a/Master/texmf-dist/tex/context/base/luat-exe.lua b/Master/texmf-dist/tex/context/base/luat-exe.lua index ca3b751623b..42c17ded58d 100644 --- a/Master/texmf-dist/tex/context/base/luat-exe.lua +++ b/Master/texmf-dist/tex/context/base/luat-exe.lua @@ -6,66 +6,93 @@ if not modules then modules = { } end modules ['luat-exe'] = { license = "see context related readme files" } -local match, find = string.match, string.find +-- this module needs checking (very old and never really used, not even enabled) + +local match, find, gmatch = string.match, string.find, string.gmatch local concat = table.concat -if not executer then executer = { } end +local report_executers = logs.reporter("system","executers") + +resolvers.executers = resolvers.executers or { } +local executers = resolvers.executers -executer.permitted = { } -executer.execute = os.execute +local permitted = { } +local osexecute = os.execute +local execute = osexecute -function executer.register(...) - local ep = executer.permitted +local function register(...) local t = { ... } for k=1,#t do local v = t[k] - ep[#ep+1] = (v == "*" and ".*") or v + permitted[#permitted+1] = (v == "*" and ".*") or v end end -function executer.finalize() -- todo: os.exec, todo: report ipv print - local execute = os.execute - function executer.execute(...) - local t, name, arguments = {...}, "", "" +local function finalize() -- todo: os.exec, todo: report ipv print + execute = function(...) + -- todo: make more clever first split + local t, name, arguments = { ... }, "", "" + local one = t[1] if #t == 1 then - if type(t[1]) == 'table' then - name, arguments = t[1], concat(t," ",2,#t) + if type(one) == 'table' then + name, arguments = one, concat(t," ",2,#t) else - name, arguments = match(t[1],"^(.-)%s+(.+)$") + name, arguments = match(one,"^(.-)%s+(.+)$") if not (name and arguments) then - name, arguments = t[1], "" + name, arguments = one, "" end end else - name, arguments = t[1], concat(t," ",2,#t) + name, arguments = one, concat(t," ",2,#t) end - local permitted = executer.permitted for k=1,#permitted do local v = permitted[k] if find(name,v) then - execute(name .. " " .. arguments) + osexecute(name .. " " .. arguments) -- print("executed: " .. name .. " " .. arguments) else - print("not permitted: " .. name .. " " .. arguments) + report_executers("not permitted: %s %s",name,arguments) end end end - function executer.finalize() - print("executer is already finalized") + finalize = function() + report_executers("already finalized") end - function executer.register(name) - print("executer is already finalized") + register = function() + report_executers("already finalized, no registration permitted") end - os.execute = executer.execute + os.execute = execute end ---~ executer.register('.*') ---~ executer.register('*') ---~ executer.register('dir','ls') ---~ executer.register('dir') +executers.finalize = function(...) finalize(...) end +executers.register = function(...) register(...) end +executers.execute = function(...) execute (...) end + +local execution_mode directives.register("system.executionmode", function(v) execution_mode = v end) +local execution_list directives.register("system.executionlist", function(v) execution_list = v end) ---~ executer.finalize() ---~ executer.execute('dir',"*.tex") ---~ executer.execute("dir *.tex") ---~ executer.execute("ls *.tex") +function executers.check() + if execution_mode == "none" then + finalize() + elseif execution_mode == "list" and execution_list ~= "" then + for s in gmatch("[^%s,]",execution_list) do + register(s) + end + finalize() + else + -- all + end +end + +--~ resolvers.executers.register('.*') +--~ resolvers.executers.register('*') +--~ resolvers.executers.register('dir','ls') +--~ resolvers.executers.register('dir') + +--~ resolvers.executers.finalize() +--~ resolvers.executers.execute('dir',"*.tex") +--~ resolvers.executers.execute("dir *.tex") +--~ resolvers.executers.execute("ls *.tex") --~ os.execute('ls') + +--~ resolvers.executers.check() diff --git a/Master/texmf-dist/tex/context/base/luat-fio.lua b/Master/texmf-dist/tex/context/base/luat-fio.lua index 0d1bd18087b..5deb704f607 100644 --- a/Master/texmf-dist/tex/context/base/luat-fio.lua +++ b/Master/texmf-dist/tex/context/base/luat-fio.lua @@ -11,68 +11,71 @@ local texiowrite = (texio and texio.write) or print local format = string.format -texconfig.kpse_init = false -texconfig.trace_file_names = true -- also influences pdf fonts reporting .. todo -texconfig.max_print_line = 100000 - -kpse = { } setmetatable(kpse, { __index = function(k,v) return input[v] end } ) - --- if still present, we overload kpse (put it off-line so to say) +texconfig.kpse_init = false +texconfig.shell_escape = 't' +texconfig.max_in_open = 127 +texconfig.max_print_line = 100000 if not resolvers.instance then resolvers.reset() - resolvers.instance.progname = 'context' - resolvers.instance.engine = 'luatex' resolvers.instance.validfile = resolvers.validctxfile + -- we now load the file database as we might need files other than + -- tex and lua file on the given path + + -- trackers.enable("resolvers.*") resolvers.load() + -- trackers.disable("resolvers.*") + + local findbinfile, loadbinfile = resolvers.findbinfile, resolvers.loadbinfile + local findtexfile, opentexfile = resolvers.findtexfile, resolvers.opentexfile if callback then - callback.register('find_read_file' , function(id,name) return resolvers.findtexfile(name) end) - callback.register('open_read_file' , function( name) return resolvers.opentexfile(name) end) - - callback.register('find_data_file' , function(name) return resolvers.findbinfile(name,"tex") end) - callback.register('find_enc_file' , function(name) return resolvers.findbinfile(name,"enc") end) - callback.register('find_font_file' , function(name) return resolvers.findbinfile(name,"tfm") end) - callback.register('find_format_file' , function(name) return resolvers.findbinfile(name,"fmt") end) - callback.register('find_image_file' , function(name) return resolvers.findbinfile(name,"tex") end) - callback.register('find_map_file' , function(name) return resolvers.findbinfile(name,"map") end) - callback.register('find_ocp_file' , function(name) return resolvers.findbinfile(name,"ocp") end) - callback.register('find_opentype_file' , function(name) return resolvers.findbinfile(name,"otf") end) - callback.register('find_output_file' , function(name) return name end) - callback.register('find_pk_file' , function(name) return resolvers.findbinfile(name,"pk") end) - callback.register('find_sfd_file' , function(name) return resolvers.findbinfile(name,"sfd") end) - callback.register('find_truetype_file' , function(name) return resolvers.findbinfile(name,"ttf") end) - callback.register('find_type1_file' , function(name) return resolvers.findbinfile(name,"pfb") end) - callback.register('find_vf_file' , function(name) return resolvers.findbinfile(name,"vf") end) - - callback.register('read_data_file' , function(file) return resolvers.loadbinfile(file,"tex") end) - callback.register('read_enc_file' , function(file) return resolvers.loadbinfile(file,"enc") end) - callback.register('read_font_file' , function(file) return resolvers.loadbinfile(file,"tfm") end) + local register = callbacks.register + + register('find_read_file' , function(id,name) return findtexfile(name) end, true) + register('open_read_file' , function( name) return opentexfile(name) end, true) + + register('find_data_file' , function(name) return findbinfile(name,"tex") end, true) + register('find_enc_file' , function(name) return findbinfile(name,"enc") end, true) + register('find_font_file' , function(name) return findbinfile(name,"tfm") end, true) + register('find_format_file' , function(name) return findbinfile(name,"fmt") end, true) + register('find_image_file' , function(name) return findbinfile(name,"tex") end, true) + register('find_map_file' , function(name) return findbinfile(name,"map") end, true) + register('find_opentype_file' , function(name) return findbinfile(name,"otf") end, true) + register('find_output_file' , function(name) return name end, true) + register('find_pk_file' , function(name) return findbinfile(name,"pk") end, true) + register('find_sfd_file' , function(name) return findbinfile(name,"sfd") end, true) + register('find_truetype_file' , function(name) return findbinfile(name,"ttf") end, true) + register('find_type1_file' , function(name) return findbinfile(name,"pfb") end, true) + register('find_vf_file' , function(name) return findbinfile(name,"vf") end, true) + + register('read_data_file' , function(file) return loadbinfile(file,"tex") end, true) + register('read_enc_file' , function(file) return loadbinfile(file,"enc") end, true) + register('read_font_file' , function(file) return loadbinfile(file,"tfm") end, true) -- format -- image - callback.register('read_map_file' , function(file) return resolvers.loadbinfile(file,"map") end) - callback.register('read_ocp_file' , function(file) return resolvers.loadbinfile(file,"ocp") end) + register('read_map_file' , function(file) return loadbinfile(file,"map") end, true) -- output - callback.register('read_pk_file' , function(file) return resolvers.loadbinfile(file,"pk") end) -- 600dpi/manfnt.720pk - callback.register('read_sfd_file' , function(file) return resolvers.loadbinfile(file,"sfd") end) - callback.register('read_vf_file' , function(file) return resolvers.loadbinfile(file,"vf" ) end) + register('read_pk_file' , function(file) return loadbinfile(file,"pk") end, true) -- 600dpi/manfnt.720pk + register('read_sfd_file' , function(file) return loadbinfile(file,"sfd") end, true) + register('read_vf_file' , function(file) return loadbinfile(file,"vf" ) end, true) - callback.register('find_font_file' , function(name) return resolvers.findbinfile(name,"ofm") end) - callback.register('find_vf_file' , function(name) return resolvers.findbinfile(name,"ovf") end) + register('find_font_file' , function(name) return findbinfile(name,"ofm") end, true) + register('find_vf_file' , function(name) return findbinfile(name,"ovf") end, true) - callback.register('read_font_file' , function(file) return resolvers.loadbinfile(file,"ofm") end) - callback.register('read_vf_file' , function(file) return resolvers.loadbinfile(file,"ovf") end) + register('read_font_file' , function(file) return loadbinfile(file,"ofm") end, true) + register('read_vf_file' , function(file) return loadbinfile(file,"ovf") end, true) - -- callback.register('read_opentype_file' , function(file) return resolvers.loadbinfile(file,"otf") end) - -- callback.register('read_truetype_file' , function(file) return resolvers.loadbinfile(file,"ttf") end) - -- callback.register('read_type1_file' , function(file) return resolvers.loadbinfile(file,"pfb") end) + -- register('read_opentype_file' , function(file) return loadbinfile(file,"otf") end, true) + -- register('read_truetype_file' , function(file) return loadbinfile(file,"ttf") end, true) + -- register('read_type1_file' , function(file) return loadbinfile(file,"pfb") end, true) - callback.register('find_write_file' , function(id,name) return name end) - callback.register('find_format_file' , function(name) return name end) + register('find_write_file' , function(id,name) return name end, true) + register('find_format_file' , function(name) return name end, true) end diff --git a/Master/texmf-dist/tex/context/base/luat-fmt.lua b/Master/texmf-dist/tex/context/base/luat-fmt.lua new file mode 100644 index 00000000000..cfb9a0bb776 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/luat-fmt.lua @@ -0,0 +1,139 @@ +if not modules then modules = { } end modules ['luat-fmt'] = { + version = 1.001, + comment = "companion to mtxrun", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + + +local format = string.format + +local report_format = logs.reporter("resolvers","formats") + +-- helper for mtxrun + +local quoted = string.quoted + +local function primaryflags() -- not yet ok + local trackers = environment.argument("trackers") + local directives = environment.argument("directives") + local flags = "" + if trackers and trackers ~= "" then + flags = flags .. "--trackers=" .. quoted(trackers) + end + if directives and directives ~= "" then + flags = flags .. "--directives=" .. quoted(directives) + end + return flags +end + +function environment.make_format(name) + -- change to format path (early as we need expanded paths) + local olddir = lfs.currentdir() + local path = caches.getwritablepath("formats") or "" -- maybe platform + if path ~= "" then + lfs.chdir(path) + end + report_format("format path: %s",lfs.currentdir()) + -- check source file + local texsourcename = file.addsuffix(name,"mkiv") + local fulltexsourcename = resolvers.findfile(texsourcename,"tex") or "" + if fulltexsourcename == "" then + texsourcename = file.addsuffix(name,"tex") + fulltexsourcename = resolvers.findfile(texsourcename,"tex") or "" + end + if fulltexsourcename == "" then + report_format("no tex source file with name: %s (mkiv or tex)",name) + lfs.chdir(olddir) + return + else + report_format("using tex source file: %s",fulltexsourcename) + end + local texsourcepath = dir.expandname(file.dirname(fulltexsourcename)) -- really needed + -- check specification + local specificationname = file.replacesuffix(fulltexsourcename,"lus") + local fullspecificationname = resolvers.findfile(specificationname,"tex") or "" + if fullspecificationname == "" then + specificationname = file.join(texsourcepath,"context.lus") + fullspecificationname = resolvers.findfile(specificationname,"tex") or "" + end + if fullspecificationname == "" then + report_format("unknown stub specification: %s",specificationname) + lfs.chdir(olddir) + return + end + local specificationpath = file.dirname(fullspecificationname) + -- load specification + local usedluastub = nil + local usedlualibs = dofile(fullspecificationname) + if type(usedlualibs) == "string" then + usedluastub = file.join(file.dirname(fullspecificationname),usedlualibs) + elseif type(usedlualibs) == "table" then + report_format("using stub specification: %s",fullspecificationname) + local texbasename = file.basename(name) + local luastubname = file.addsuffix(texbasename,"lua") + local lucstubname = file.addsuffix(texbasename,"luc") + -- pack libraries in stub + report_format("creating initialization file: %s",luastubname) + utilities.merger.selfcreate(usedlualibs,specificationpath,luastubname) + -- compile stub file (does not save that much as we don't use this stub at startup any more) + local strip = resolvers.booleanvariable("LUACSTRIP", true) + if utilities.lua.compile(luastubname,lucstubname) and lfs.isfile(lucstubname) then + report_format("using compiled initialization file: %s",lucstubname) + usedluastub = lucstubname + else + report_format("using uncompiled initialization file: %s",luastubname) + usedluastub = luastubname + end + else + report_format("invalid stub specification: %s",fullspecificationname) + lfs.chdir(olddir) + return + end + -- generate format + local command = format("luatex --ini %s --lua=%s %s %sdump",primaryflags(),quoted(usedluastub),quoted(fulltexsourcename),os.platform == "unix" and "\\\\" or "\\") + report_format("running command: %s\n",command) + os.spawn(command) + -- remove related mem files + local pattern = file.removesuffix(file.basename(usedluastub)).."-*.mem" + -- report_format("removing related mplib format with pattern '%s'", pattern) + local mp = dir.glob(pattern) + if mp then + for i=1,#mp do + local name = mp[i] + report_format("removing related mplib format %s", file.basename(name)) + os.remove(name) + end + end + lfs.chdir(olddir) +end + +function environment.run_format(name,data,more) + -- hm, rather old code here; we can now use the file.whatever functions + if name and name ~= "" then + local barename = file.removesuffix(name) + local fmtname = caches.getfirstreadablefile(file.addsuffix(barename,"fmt"),"formats") + if fmtname == "" then + fmtname = resolvers.findfile(file.addsuffix(barename,"fmt")) or "" + end + fmtname = resolvers.cleanpath(fmtname) + if fmtname == "" then + report_format("no format with name: %s",name) + else + local barename = file.removesuffix(name) -- expanded name + local luaname = file.addsuffix(barename,"luc") + if not lfs.isfile(luaname) then + luaname = file.addsuffix(barename,"lua") + end + if not lfs.isfile(luaname) then + report_format("using format name: %s",fmtname) + report_format("no luc/lua with name: %s",barename) + else + local command = format("luatex %s --fmt=%s --lua=%s %s %s",primaryflags(),quoted(barename),quoted(luaname),quoted(data),more ~= "" and quoted(more) or "") + report_format("running command: %s",command) + os.spawn(command) + end + end + end +end diff --git a/Master/texmf-dist/tex/context/base/luat-ini.lua b/Master/texmf-dist/tex/context/base/luat-ini.lua index e6a715c07fa..9a8651a9cbd 100644 --- a/Master/texmf-dist/tex/context/base/luat-ini.lua +++ b/Master/texmf-dist/tex/context/base/luat-ini.lua @@ -6,26 +6,37 @@ if not modules then modules = { } end modules ['luat-ini'] = { license = "see context related readme files" } +-- rather experimental down here ... will change with lua 5.2 -- + --~ local ctxcatcodes = tex.ctxcatcodes +local debug = require "debug" +local string, table, lpeg, math, io, system = string, table, lpeg, math, io, system +local next, setfenv = next, setfenv or debug.setfenv +local format = string.format + +local mark = utilities.storage.mark + --[[ldx--

We cannot load anything yet. However what we will do us reserve a fewtables. These can be used for runtime user data or third party modules and will not be cluttered by macro package code.

--ldx]]-- -userdata = userdata or { } -- might be used -thirddata = thirddata or { } -- might be used -moduledata = moduledata or { } -- might be used -document = document or { } -parametersets = parametersets or { } -- experimental +userdata = userdata or { } -- for users (e.g. functions etc) +thirddata = thirddata or { } -- only for third party modules +moduledata = moduledata or { } -- only for development team +documentdata = documentdata or { } -- for users (e.g. raw data) +parametersets = parametersets or { } -- experimental for team + +document = document or { } -- only for context itself --[[ldx--

These can be used/set by the caller program; mtx-context.lua does it.

--ldx]]-- -document.arguments = document.arguments or { } -document.files = document.files or { } +document.arguments = mark(document.arguments or { }) +document.files = mark(document.files or { }) --[[ldx--

Please create a namespace within these tables before using them!

@@ -44,66 +55,81 @@ just a lightweight suggestive system, not a watertight one.

--ldx]]-- -local debug = require "debug" - -local string, table, lpeg, math, io, system = string, table, lpeg, math, io, system -local next, setfenv = next, setfenv or debug.setfenv -local format = string.format +-- this will change when we move on to lua 5.2+ local global = _G global.global = global +--~ rawset(global,"global",global) local dummy = function() end +-- another approach is to freeze tables by using a metatable, this will be +-- implemented stepwise + local protected = { -- global table - global = global, + global = global, -- user tables - userdata = userdata, - moduledata = moduledata, - thirddata = thirddata, - document = document, + -- moduledata = moduledata, + userdata = userdata, + thirddata = thirddata, + documentdata = documentdata, -- reserved - protect = dummy, - unprotect = dummy, + protect = dummy, + unprotect = dummy, -- luatex - tex = tex, + tex = tex, -- lua - string = string, - table = table, - lpeg = lpeg, - math = math, - io = io, - system = system, + string = string, + table = table, + lpeg = lpeg, + math = math, + io = io, + -- + -- maybe other l-*, xml etc } -userdata, thirddata, moduledata = nil, nil, nil +-- moduledata : no need for protection (only for developers) +-- isolatedata : full protection +-- userdata : protected +-- thirddata : protected + +userdata, thirddata = nil, nil + +-- we could have a metatable that automaticaly creates a top level namespace if not setfenv then texio.write_nl("warning: we need to fix setfenv by using 'load in' or '_ENV'") end -function protect(name) - if name == "isolateddata" then - local t = { } +local function protect_full(name) + local t = { } + for k, v in next, protected do + t[k] = v + end + return t +end + +local function protect_part(name) +--~ local t = global[name] + local t = rawget(global,name) + if not t then + t = { } for k, v in next, protected do t[k] = v end - setfenv(2,t) +--~ global[name] = t + rawset(global,name,t) + end + return t +end + +function protect(name) + if name == "isolateddata" then + setfenv(2,protect_full(name)) else - if not name then - name = "shareddata" - end - local t = global[name] - if not t then - t = { } - for k, v in next, protected do - t[k] = v - end - global[name] = t - end - setfenv(2,t) + setfenv(2,protect_part(name or "shareddata")) end end @@ -119,6 +145,10 @@ function lua.registername(name,message) end lua.name[lnn] = message tex.write(lnn) + -- initialize once + if name ~= "isolateddata" then + protect_full(name or "shareddata") + end end --~ function lua.checknames() diff --git a/Master/texmf-dist/tex/context/base/luat-ini.mkiv b/Master/texmf-dist/tex/context/base/luat-ini.mkiv index c9d88bf4fcf..a79ef6a02ac 100644 --- a/Master/texmf-dist/tex/context/base/luat-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/luat-ini.mkiv @@ -53,30 +53,6 @@ \ifx\obeyedline \undefined \let\obeyedline \relax \fi \ifx\obeyspaces \undefined \let\obeyspaces \relax \fi \ifx\obeyedspace \undefined \let\obeyedspace \relax \fi -\ifx\outputnewlinechar\undefined \let\outputnewlinechar\relax \fi - -%D A previous version used a bit less code and no catcode table, -%D simply becaus ethey were not around at the time of writing. -% -% we keep it around for archival purposes -% -% \def\obeylualines -% {\obeylines \let\obeyedline \outputnewlinechar -% \obeyspaces \let\obeyedspace\space} -% -% \def\obeyluatokens % todo: make this a proper catcode table, use let's -% {\catcode`\%=12 \catcode`\#=12 -% \catcode`\_=12 \catcode`\^=12 -% \catcode`\&=12 \catcode`\|=12 -% \catcode`\{=12 \catcode`\}=12 -% \catcode`\~=12 \catcode`\$=12 -% \def\\{\string\\}\def\|{\string\|}\def\-{\string\-}% -% \def\({\string\(}\def\){\string\)}\def\{{\string\{}\def\}{\string\}}% -% \def\'{\string\'}\def\"{\string\"}% -% \def\n{\string\n}\def\r{\string\r}\def\f{\string\f}\def\t{\string\t}% -% \def\a{\string\a}\def\b{\string\b}\def\v{\string\v}\def\s{\string\s}% -% \def\1{\string\1}\def\2{\string\2}\def\3{\string\3}\def\4{\string\4}\def\5{\string\5}% -% \def\6{\string\6}\def\7{\string\7}\def\8{\string\8}\def\9{\string\9}\def\0{\string\0}} \let\obeylualines\relax @@ -135,17 +111,20 @@ \csname dodostartnamed#1\v!code\endcsname} \unexpanded\def\definenamedlua[#1]#2[#3]% no optional arg handling here yet - {\scratchcounter\ctxlua{lua.registername("#1","#3")}% - \normalexpanded{\long\edef\csname dodostartnamed#1\v!code\endcsname##1\csname\e!stop#1\v!code\endcsname}% - {\endgroup\noexpand\directlua\the\scratchcounter{protect("#1\s!data")##1}}% - \long\expandafter\def \csname\e!start#1\v!code\endcsname {\dostartnamedluacode{#1}}% - \long\expandafter\edef\csname #1\v!code\endcsname##1{\noexpand\directlua\the\scratchcounter{protect("#1\s!data")##1}}} + {\ifcsname dodostartnamed#1\v!code\endcsname\else + \scratchcounter\ctxlua{lua.registername("#1","#3")}% + \normalexpanded{\long\edef\csname dodostartnamed#1\v!code\endcsname##1\csname\e!stop#1\v!code\endcsname}% + {\endgroup\noexpand\directlua\the\scratchcounter{protect("#1\s!data")##1}}% + \long\expandafter\def \csname\e!start#1\v!code\endcsname {\dostartnamedluacode{#1}}% + \long\expandafter\edef\csname #1\v!code\endcsname##1{\noexpand\directlua\the\scratchcounter{protect("#1\s!data")##1}}% + \fi} %D We predefine a few. +% \definenamedlua[module][module instance] % not needed + \definenamedlua[user] [private user instance] \definenamedlua[third] [third party module instance] -\definenamedlua[module] [module instance] \definenamedlua[isolated][isolated instance] %D In practice this works out as follows: @@ -230,14 +209,33 @@ % tree=true % \stopluaparameterset % -% options=u3d:myset:display:1 +% option=u3d:myset:display:1 % % or: % -% options=\luaparameterset{u3d:myset:display:1}{toolbar=false,tree=true} +% option=\luaparameterset{u3d:myset:display:1}{toolbar=false,tree=true} %D A Handy helper: \def\luaconditional#1{\ifcase#1tru\else fals\fi e} +%D Goodie: +%D +%D \starttyping +%D \ctxluacode{context("%0.5f",1/3)} +%D \stoptyping + +\long\def\ctxluacode + {\begingroup + \obeylualines + \obeyluatokens + \catcode\leftbraceasciicode \plusone + \catcode\rightbraceasciicode\plustwo + \afterassignment\doctxluacode + \scratchtoks=} + +\def\doctxluacode + {\normalexpanded{\endgroup\noexpand\directlua\zerocount\expandafter{\the\scratchtoks}}} + + \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/luat-iop.lua b/Master/texmf-dist/tex/context/base/luat-iop.lua index e5722d2bd7f..091639de231 100644 --- a/Master/texmf-dist/tex/context/base/luat-iop.lua +++ b/Master/texmf-dist/tex/context/base/luat-iop.lua @@ -13,10 +13,12 @@ if not modules then modules = { } end modules ['luat-iop'] = { local lower, find, sub = string.lower, string.find, string.sub +local allocate = utilities.storage.allocate + local ioinp = io.inp if not ioinp then ioinp = { } io.inp = ioinp end local ioout = io.out if not ioout then ioout = { } io.out = ioout end -ioinp.modes, ioout.modes = { }, { } -- functions +ioinp.modes, ioout.modes = allocate(), allocate() local inp_blocked, inp_permitted = { }, { } local out_blocked, out_permitted = { }, { } @@ -29,10 +31,10 @@ local function o_permit (name) out_permitted[#out_permitted+1] = name end ioinp.inhibit, ioinp.permit = i_inhibit, o_permit ioout.inhibit, ioout.permit = o_inhibit, o_permit -local blocked_openers = { } -- *.open(name,method) +local blockedopeners = { } -- *.open(name,method) -function io.register_opener(func) - blocked_openers[#blocked_openers+1] = func +function io.registeropener(func) + blockedopeners[#blockedopeners+1] = func end local function checked(name,blocked,permitted) @@ -50,7 +52,7 @@ local function checked(name,blocked,permitted) return true end -function io.finalize_openers(func) +function io.finalizeopeners(func) if #out_blocked > 0 or #inp_blocked > 0 then local open = func -- why not directly? return function(name,method) @@ -78,7 +80,7 @@ end --~ io.inp.inhibit('/winnt/') --~ io.inp.permit('c:/windows/wmsetup.log') ---~ io.open = io.finalize_openers(io.open) +--~ io.open = io.finalizeopeners(io.open) --~ f = io.open('.tex') print(f) --~ f = io.open('tufte.tex') print(f) @@ -87,18 +89,6 @@ end --~ f = io.open('c:/windows/crap.log') print(f) --~ f = io.open('c:/windows/wmsetup.log') print(f) -local inpout = { 'inp', 'out' } - -function io.set_opener_modes(i,o) - local first = sub(i,1,1) - for k=1,#inpout do - local iov = io[inpout[k]] - local f = iov[i] or iov[first] - if f then f() end - end - io.open = io.finalize_openers(io.open) -end - -- restricted function ioinp.modes.restricted() @@ -116,12 +106,12 @@ function ioinp.modes.paranoid() i_inhibit('%.%.') i_permit('^%./') i_permit('[^/]') - resolvers.do_with_path('TEXMF',i_permit) + resolvers.dowithpath('TEXMF',i_permit) end function ioout.modes.paranoid() o_inhibit('.*') - resolvers.do_with_path('TEXMFOUTPUT',o_permit) + resolvers.dowithpath('TEXMFOUTPUT',o_permit) end -- handy @@ -143,6 +133,16 @@ function ioout.modes.handy() o_permit('[^/]') end ---~ io.set_opener_modes('p','p') ---~ io.set_opener_modes('r','r') ---~ io.set_opener_modes('h','h') +local input_mode directives.register("system.inputmode", function(v) input_mode = v end) +local output_mode directives.register("system.outputmode", function(v) output_mode = v end) + +function io.checkopeners() + local inp = input_mode or resolvers.variable("input_mode") -- or ... will become obsolete + local out = output_mode or resolvers.variable("output_mode") -- or ... will become obsolete + inp = inp and ioinp.modes[inp] + out = out and ioinp.modes[out] + if inp then inp() end + if out then out() end +end + +--~ io.checkopeners() diff --git a/Master/texmf-dist/tex/context/base/luat-lib.mkiv b/Master/texmf-dist/tex/context/base/luat-lib.mkiv index 91ddec0aa62..83b96639b79 100644 --- a/Master/texmf-dist/tex/context/base/luat-lib.mkiv +++ b/Master/texmf-dist/tex/context/base/luat-lib.mkiv @@ -11,60 +11,66 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% \writestatus{loading}{ConTeXt Lua Macros / Libraries} +\writestatus{loading}{ConTeXt Lua Macros / Libraries} -\registerctxluafile{trac-inf} {1.001} -\registerctxluafile{trac-tra} {1.001} -\registerctxluafile{trac-log} {1.001} +\registerctxluafile{util-str}{1.001} +\registerctxluafile{util-tab}{1.001} +\registerctxluafile{util-pck}{1.001} +\registerctxluafile{util-sto}{1.001} % could also be done in trac-deb.mkiv +\registerctxluafile{util-seq}{1.001} +%registerctxluafile{util-mrg}{1.001} % not needed in context itself, only mtxrun +\registerctxluafile{util-lua}{1.001} +\registerctxluafile{util-prs}{1.001} +\registerctxluafile{util-fmt}{1.001} +\registerctxluafile{util-deb}{1.001} % could also be done in trac-deb.mkiv +\registerctxluafile{util-dim}{1.001} -\registerctxluafile{luat-cbk} {1.001} +\registerctxluafile{trac-inf}{1.001} +\registerctxluafile{trac-set}{1.001} +\registerctxluafile{trac-log}{1.001} +%registerctxluafile{trac-pro}{1.001} -\registerctxluafile{data-res} {1.001} -\registerctxluafile{data-tmp} {1.001} -\registerctxluafile{data-pre} {1.001} -\registerctxluafile{data-inp} {1.001} -\registerctxluafile{data-out} {1.001} -\registerctxluafile{data-tex} {1.001} -\registerctxluafile{data-bin} {1.001} -\registerctxluafile{data-zip} {1.001} -%registerctxluafile{data-crl} {1.001} -\registerctxluafile{data-sch} {1.001} -\registerctxluafile{data-tre} {1.001} -\registerctxluafile{data-lua} {1.001} -\registerctxluafile{data-ctx} {1.001} -\registerctxluafile{data-con} {1.001} -\registerctxluafile{data-use} {1.001} +\registerctxluafile{data-ini}{1.001} +\registerctxluafile{data-exp}{1.001} +\registerctxluafile{data-env}{1.001} +\registerctxluafile{data-tmp}{1.001} +\registerctxluafile{data-met}{1.001} +\registerctxluafile{data-res}{1.001} +\registerctxluafile{data-inp}{1.001} +\registerctxluafile{data-out}{1.001} +\registerctxluafile{data-fil}{1.001} -\registerctxluafile{luat-run} {1.001} -\registerctxluafile{luat-fio} {1.001} % not needed, part of startup file -\registerctxluafile{luat-cnf} {1.001} % not needed, part of startup file -\registerctxluafile{luat-lua} {1.001} -\registerctxluafile{luat-sto} {1.001} -\registerctxluafile{luat-ini} {1.001} -\registerctxluafile{luat-env} {1.001} +\registerctxluafile{data-pre}{1.001} +\registerctxluafile{data-tex}{1.001} +\registerctxluafile{data-vir}{1.001} +\registerctxluafile{data-bin}{1.001} +\registerctxluafile{data-zip}{1.001} +%registerctxluafile{data-crl}{1.001} +\registerctxluafile{data-sch}{1.001} +\registerctxluafile{data-tre}{1.001} +\registerctxluafile{data-lua}{1.001} +\registerctxluafile{data-ctx}{1.001} +\registerctxluafile{data-con}{1.001} +\registerctxluafile{data-use}{1.001} +\registerctxluafile{data-aux}{1.001} -\registerctxluafile{lxml-tab} {1.001} -\registerctxluafile{lxml-lpt} {1.001} -\registerctxluafile{lxml-xml} {1.001} -\registerctxluafile{lxml-aux} {1.001} -\registerctxluafile{lxml-mis} {1.001} - -\startruntimeluacode - \edef\asciia{\ctxlua{tex.sprint(logs.mode)}} - \edef\asciib{xml} - \ifx\asciia\asciib % brrr - \long\def\writebanner #1{\writestring {#1}} - \long\def\writestatus#1#2{\writestring {#2}} - \long\def\message #1{\normalmessage{#1}} - \else - \let\writebanner\writestring - %\let\writestatus\normalwritestatus - \let\message \normalmessage - \fi -\stopruntimeluacode - -%registerctxluafile{luat-tmp}{1.001} +\registerctxluafile{luat-cbk}{1.001} +\registerctxluafile{luat-run}{1.001} +\registerctxluafile{luat-fio}{1.001} +\registerctxluafile{luat-cnf}{1.001} +\registerctxluafile{luat-lua}{1.001} +\registerctxluafile{luat-sto}{1.001} +\registerctxluafile{luat-ini}{1.001} +\registerctxluafile{luat-env}{1.001} \registerctxluafile{luat-exe}{1.001} \registerctxluafile{luat-iop}{1.001} +\registerctxluafile{luat-bwc}{1.001} +\registerctxluafile{luat-mac}{1.001} + +\registerctxluafile{lxml-tab}{1.001} +\registerctxluafile{lxml-lpt}{1.001} +\registerctxluafile{lxml-xml}{1.001} +\registerctxluafile{lxml-aux}{1.001} +\registerctxluafile{lxml-mis}{1.001} \endinput diff --git a/Master/texmf-dist/tex/context/base/luat-lua.lua b/Master/texmf-dist/tex/context/base/luat-lua.lua index b964bf8e80d..50492540d25 100644 --- a/Master/texmf-dist/tex/context/base/luat-lua.lua +++ b/Master/texmf-dist/tex/context/base/luat-lua.lua @@ -10,11 +10,7 @@ if lua then do local delayed = { } - function lua.delay(f) - delayed[#delayed+1] = f - end - - function lua.flush_delayed(...) + local function flushdelayed(...) local t = delayed delayed = { } for i=1, #t do @@ -22,8 +18,12 @@ if lua then do end end + function lua.delay(f) + delayed[#delayed+1] = f + end + function lua.flush(...) - tex.sprint("\\directlua0{lua.flush_delayed(",table.concat({...},','),")}") + tex.sprint("\\directlua{flushdelayed(",table.concat({...},','),")}") end end end diff --git a/Master/texmf-dist/tex/context/base/luat-mac.lua b/Master/texmf-dist/tex/context/base/luat-mac.lua new file mode 100644 index 00000000000..0dc6593c659 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/luat-mac.lua @@ -0,0 +1,271 @@ +if not modules then modules = { } end modules ['luat-mac'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local P, V, S, R, C, Cs, Cmt, Carg = lpeg.P, lpeg.V, lpeg.S, lpeg.R, lpeg.C, lpeg.Cs, lpeg.Cmt, lpeg.Carg +local lpegmatch, patterns = lpeg.match, lpeg.patterns + +local insert, remove = table.insert, table.remove +local rep, sub = string.rep, string.sub +local setmetatable = setmetatable + +local pushtarget, poptarget = logs.pushtarget, logs.poptarget + +local report_macros = logs.reporter("interface","macros") + +local stack, top, n, hashes = { }, nil, 0, { } + +local function set(s) + if top then + n = n + 1 + if n > 9 then + report_macros("number of arguments > 9, ignoring %s",s) + else + local ns = #stack + local h = hashes[ns] + if not h then + h = rep("#",ns) + hashes[ns] = h + end + m = h .. n + top[s] = m + return m + end + end +end + +local function get(s) + if not top then + report_macros("keeping #%s, no stack",s) + return "#" .. s -- can be lua + end + local m = top[s] + if m then + return m + else + report_macros("keeping #%s, not on stack",s) + return "#" .. s -- quite likely an error + end +end + +local function push() + top = { } + n = 0 + local s = stack[#stack] + if s then + setmetatable(top,{ __index = s }) + end + insert(stack,top) +end + +local function pop() + top = remove(stack) +end + +local leftbrace = P("{") -- will be in patterns +local rightbrace = P("}") +local escape = P("\\") + +local space = patterns.space +local spaces = space^1 +local newline = patterns.newline +local nobrace = 1 - leftbrace - rightbrace + +local longleft = leftbrace -- P("(") +local longright = rightbrace -- P(")") +local nolong = 1 - longleft - longright + +local name = R("AZ","az")^1 +local csname = (R("AZ","az") + S("@?!_"))^1 +local longname = (longleft/"") * (nolong^1) * (longright/"") +local variable = P("#") * Cs(name + longname) +local escapedname = escape * csname +local definer = escape * (P("def") + P("egx") * P("def")) -- tex +local setter = escape * P("set") * (P("u")^-1 * P("egx")^-1) * P("value") -- context specific +--- + escape * P("install") * (1-P("handler"))^1 * P("handler") -- context specific +local startcode = P("\\starttexdefinition") -- context specific +local stopcode = P("\\stoptexdefinition") -- context specific +local anything = patterns.anything +local always = patterns.alwaysmatched + +-- The comment nilling can become an option but it nicely compensates the Lua +-- parsing here with less parsing at the TeX end. We keep lines so the errors +-- get reported all right, but comments are never seen there anyway. We keep +-- comment that starts inline as it can be something special with a % (at some +-- point we can do that as well, esp if we never use \% or `% somewhere +-- unpredictable). We need to skip comments anyway. Hm, too tricky, this +-- stripping as we can have Lua code etc. + +local commenttoken = P("%") +local crorlf = S("\n\r") +local commentline = commenttoken * ((Carg(1) * C((1-crorlf)^0))/function(strip,s) return strip and "" or s end) +local commentline = commenttoken * ((1-crorlf)^0) +local leadingcomment = (commentline * crorlf^1)^1 +local furthercomment = (crorlf^1 * commentline)^1 + +local pushlocal = always / push +local poplocal = always / pop +local declaration = variable / set +local identifier = variable / get + +local argument = leftbrace * ((identifier + (1-rightbrace))^0) * rightbrace + +local function matcherror(str,pos) + report_macros("runaway definition at: %s",sub(str,pos-30,pos)) +end + +local grammar = { "converter", + texcode = pushlocal + * startcode + * spaces + * name + * spaces + * (declaration + furthercomment + (1 - newline - space))^0 + * V("texbody") + * stopcode + * poplocal, + texbody = ( V("definition") + + identifier + + V("braced") + + (1 - stopcode) + )^0, + definition = pushlocal + * definer + * escapedname + * (declaration + furthercomment + commentline + (1-leftbrace))^0 + * V("braced") + * poplocal, + setcode = pushlocal + * setter + * argument + * (declaration + furthercomment + commentline + (1-leftbrace))^0 + * V("braced") + * poplocal, + braced = leftbrace + * ( V("definition") + + identifier + + V("setcode") + + V("texcode") + + V("braced") + + furthercomment + + nobrace + )^0 + -- * rightbrace^-1, -- the -1 catches errors + * (rightbrace + Cmt(always,matcherror)), + + pattern = leadingcomment + + V("definition") + + V("setcode") + + V("texcode") + + furthercomment + + anything, + + converter = V("pattern")^1, +} + +local parser = Cs(grammar) + +local checker = P("%") * (1 - newline - P("macros"))^0 + * P("macros") * space^0 * P("=") * space^0 * C(patterns.letter^1) + +-- maybe namespace + +local macros = { } resolvers.macros = macros + +function macros.preprocessed(str,strip) + return lpegmatch(parser,str,1,strip) +end + +function macros.convertfile(oldname,newname) -- beware, no testing on oldname == newname + local data = resolvers.loadtexfile(oldname) + data = interfaces.preprocessed(data) or "" + io.savedata(newname,data) +end + +function macros.version(data) + return lpegmatch(checker,data) +end + +function macros.processmkvi(str,filename) + if (filename and file.suffix(filename) == "mkvi") or lpegmatch(checker,str) == "mkvi" then + local result = lpegmatch(parser,str,1,true) or str + pushtarget("log") + report_macros("processed file '%s', delta %s",filename,#str-#result) + poptarget("log") + return result + else + return str + end +end + +if resolvers.schemes then + + local function handler(protocol,name,cachename) + local hashed = url.hashed(name) + local path = hashed.path + if path and path ~= "" then + local str = resolvers.loadtexfile(path) + if file.suffix(path) == "mkvi" or lpegmatch(checker,str) == "mkvi" then + -- already done automatically + io.savedata(cachename,str) + else + local result = lpegmatch(parser,str,1,true) or str + pushtarget("log") + report_macros("processed scheme '%s', delta %s",filename,#str-#result) + poptarget("log") + io.savedata(cachename,result) + end + end + return cachename + end + + resolvers.schemes.install('mkvi',handler,1) -- this will cache ! + + utilities.sequencers.appendaction(resolvers.openers.helpers.textfileactions,"system","resolvers.macros.processmkvi") + -- utilities.sequencers.disableaction(resolvers.openers.helpers.textfileactions,"resolvers.macros.processmkvi") + +end + +--~ print(macros.preprocessed([[\def\bla#bla{bla#{bla}}]])) +--~ print(macros.preprocessed([[\def\bla#bla{#{bla}bla}]])) +--~ print(macros.preprocessed([[\def\blä#{blá}{blà:#{blá}}]])) +--~ print(macros.preprocessed([[\def\blä#bla{blà:#bla}]])) +--~ print(macros.preprocessed([[\setvalue{xx}#bla{blà:#bla}]])) +--~ print(macros.preprocessed([[\def\foo#bar{\setvalue{xx#bar}{#bar}}]])) +--~ print(macros.preprocessed([[\def\bla#bla{bla:#{bla}}]])) +--~ print(macros.preprocessed([[\def\bla_bla#bla{bla:#bla}]])) +--~ print(macros.preprocessed([[\def\test#oeps{test:#oeps}]])) +--~ print(macros.preprocessed([[\def\test_oeps#oeps{test:#oeps}]])) +--~ print(macros.preprocessed([[\def\test#oeps{test:#{oeps}}]])) +--~ print(macros.preprocessed([[\def\test#{oeps:1}{test:#{oeps:1}}]])) +--~ print(macros.preprocessed([[\def\test#{oeps}{test:#oeps}]])) +--~ print(macros.preprocessed([[\def\test#{oeps}{test:#oeps \halign{##\cr #oeps\cr}]])) +--~ print(macros.preprocessed([[\def\test#{oeps}{test:#oeps \halign{##\cr #oeps\cr}}]])) +--~ print(macros.preprocessed([[% test +--~ \def\test#oeps{#oeps} % {test} +--~ % test +--~ +--~ % test +--~ two +--~ %test]])) +--~ print(macros.preprocessed([[ +--~ \def\scrn_button_make_normal#namespace#current#currentparameter#text% +--~ {\ctxlua{structures.references.injectcurrentset(nil,nil)}% +--~ % \hbox attr \referenceattribute \lastreferenceattribute {\localframed[#namespace:#current]{#text}}} +--~ \hbox attr \referenceattribute \lastreferenceattribute {\directlocalframed[#namespace:#current]{#text}}} +--~ ]])) +--~ +--~ print(macros.preprocessed([[ +--~ \def\definefoo[#name]% +--~ {\setvalue{start#name}{\dostartfoo{#name}}} +--~ \def\dostartfoo#name% +--~ {\def\noexpand\next#content\expandafter\noexpand\csname stop#name\endcsname{#name : #content}% +--~ \next} +--~ \def\dostartfoo#name% +--~ {\normalexpanded{\def\noexpand\next#content\expandafter\noexpand\csname stop#name\endcsname}{#name : #content}% +--~ \next} +--~ ]])) diff --git a/Master/texmf-dist/tex/context/base/luat-run.lua b/Master/texmf-dist/tex/context/base/luat-run.lua index b64a99fc6b8..51856640d2d 100644 --- a/Master/texmf-dist/tex/context/base/luat-run.lua +++ b/Master/texmf-dist/tex/context/base/luat-run.lua @@ -6,36 +6,44 @@ if not modules then modules = { } end modules ['luat-run'] = { license = "see context related readme files" } -local format, rpadd = string.format, string.rpadd +local format = string.format +local insert = table.insert -main = main or { } +local trace_lua_dump = false trackers.register("system.dump", function(v) trace_lua_dump = v end) +local trace_temp_files = false trackers.register("system.tempfiles", function(v) trace_temp_files = v end) -local start_actions = { } -local stop_actions = { } +local report_lua = logs.reporter("system","lua") +local report_tempfiles = logs.reporter("resolvers","tempfiles") -function main.register_start_actions(...) table.insert(start_actions, ...) end -function main.register_stop_actions (...) table.insert(stop_actions, ...) end +luatex = luatex or { } +local luatex = luatex -main.show_tex_stat = main.show_tex_stat or function() end -main.show_job_stat = main.show_job_stat or statistics.show_job_stat +local startactions = { } +local stopactions = { } -function main.start() +function luatex.registerstartactions(...) insert(startactions, ...) end +function luatex.registerstopactions (...) insert(stopactions, ...) end + +luatex.showtexstat = luatex.showtexstat or function() end +luatex.showjobstat = luatex.showjobstat or statistics.showjobstat + +local function start_run() if logs.start_run then logs.start_run() end - for _, action in next, start_actions do - action() + for i=1,#startactions do + startactions[i]() end end -function main.stop() - for _, action in next, stop_actions do - action() +local function stop_run() + for i=1,#stopactions do + stopactions[i]() end - if main.show_job_stat then + if luatex.showjobstat then statistics.show(logs.report_job_stat) end - if main.show_tex_stat then + if luatex.showtexstat then for k,v in next, status.list() do logs.report_tex_stat(k,v) end @@ -45,30 +53,103 @@ function main.stop() end end -function main.start_shipout_page() +local function start_shipout_page() logs.start_page_number() end -function main.stop_shipout_page() +local function stop_shipout_page() logs.stop_page_number() end -function main.report_output_pages() +local function report_output_pages() end -function main.report_output_log() +local function report_output_log() +end + +--~ local function show_open() +--~ end + +--~ local function show_close() +--~ end + +local function pre_dump_actions() + lua.finalize(trace_lua_dump and report_lua or nil) + statistics.reportstorage("log") + -- statistics.savefmtstatus("\jobname","\contextversion","context.tex") end -- this can be done later -callbacks.register('start_run', main.start, "actions performed at the beginning of a run") -callbacks.register('stop_run', main.stop, "actions performed at the end of a run") +callbacks.register('start_run', start_run, "actions performed at the beginning of a run") +callbacks.register('stop_run', stop_run, "actions performed at the end of a run") + +--~ callbacks.register('show_open', show_open, "actions performed when opening a file") +--~ callbacks.register('show_close', show_close, "actions performed when closing a file") -callbacks.register('report_output_pages', main.report_output_pages, "actions performed when reporting pages") -callbacks.register('report_output_log', main.report_output_log, "actions performed when reporting log file") +callbacks.register('report_output_pages', report_output_pages, "actions performed when reporting pages") +callbacks.register('report_output_log', report_output_log, "actions performed when reporting log file") -callbacks.register('start_page_number', main.start_shipout_page, "actions performed at the beginning of a shipout") -callbacks.register('stop_page_number', main.stop_shipout_page, "actions performed at the end of a shipout") +callbacks.register('start_page_number', start_shipout_page, "actions performed at the beginning of a shipout") +callbacks.register('stop_page_number', stop_shipout_page, "actions performed at the end of a shipout") -callbacks.register('process_input_buffer', false, "actions performed when reading data") -callbacks.register('process_output_buffer', false, "actions performed when writing data") +callbacks.register('process_input_buffer', false, "actions performed when reading data") +callbacks.register('process_output_buffer', false, "actions performed when writing data") + +callbacks.register("pre_dump", pre_dump_actions, "lua related finalizers called before we dump the format") -- comes after \everydump + +-- an example: + +local tempfiles = { } + +function luatex.registertempfile(name,extrasuffix) + if extrasuffix then + name = name .. ".mkiv-tmp" -- maybe just .tmp + end + if trace_temp_files and not tempfiles[name] then + report_tempfiles("registering temporary file: %s",name) + end + tempfiles[name] = true + return name +end + +function luatex.cleanuptempfiles() + for name, _ in next, tempfiles do + if trace_temp_files then + report_tempfiles("removing temporary file: %s",name) + end + os.remove(name) + end + tempfiles = { } +end + +luatex.registerstopactions(luatex.cleanuptempfiles) + +-- for the moment here + +local synctex = false + +local report_system = logs.reporter("system") + +directives.register("system.synctex", function(v) + synctex = v + if v then + report_system("synctex functionality is enabled!") + else + report_system("synctex functionality is disabled!") + end + -- current this is bugged: + tex.synctex = synctex and 1 or 0 + -- so for the moment we need: + if synctex then + tex.print("\\normalsynctex\\plusone") + else + tex.print("\\normalsynctex\\zerocount") + end +end) + +statistics.register("synctex tracing",function() + if synctex or tex.synctex > 0 then + return "synctex has been enabled (extra log file generated)" + end +end) diff --git a/Master/texmf-dist/tex/context/base/luat-sta.lua b/Master/texmf-dist/tex/context/base/luat-sta.lua index a81b0c206fc..8b58774d357 100644 --- a/Master/texmf-dist/tex/context/base/luat-sta.lua +++ b/Master/texmf-dist/tex/context/base/luat-sta.lua @@ -10,9 +10,15 @@ if not modules then modules = { } end modules ['luat-sta'] = { local gmatch, match = string.gmatch, string.match local type = type -states = states or { } -states.data = states.data or { } -states.hash = states.hash or { } +states = states or { } +local states = states + +states.data = states.data or { } +local data = states.data + +states.hash = states.hash or { } +local hash = states.hash + states.tag = states.tag or "" states.filename = states.filename or "" @@ -22,7 +28,7 @@ function states.save(filename,tag) io.savedata(filename, "-- generator : luat-sta.lua\n" .. "-- state tag : " .. tag .. "\n\n" .. - table.serialize(states.data[tag or states.tag] or {},true) + table.serialize(data[tag or states.tag] or {},true) ) end @@ -30,11 +36,11 @@ function states.load(filename,tag) states.filename = filename states.tag = tag or "whatever" states.filename = file.addsuffix(states.filename,'lus') - states.data[states.tag], states.hash[states.tag] = (io.exists(filename) and dofile(filename)) or { }, { } + data[states.tag], hash[states.tag] = (io.exists(filename) and dofile(filename)) or { }, { } end -function states.set_by_tag(tag,key,value,default,persistent) - local d, h = states.data[tag], states.hash[tag] +local function set_by_tag(tag,key,value,default,persistent) + local d, h = data[tag], hash[tag] if d then if type(d) == "table" then local dkey, hkey = key, key @@ -54,8 +60,10 @@ function states.set_by_tag(tag,key,value,default,persistent) end dkey, hkey = post, key end - if type(value) == nil then - value = value or default + if value == nil then + value = default + elseif value == false then + -- special case elseif persistent then value = value or d[dkey] or default else @@ -64,40 +72,47 @@ function states.set_by_tag(tag,key,value,default,persistent) d[dkey], h[hkey] = value, value elseif type(d) == "string" then -- weird - states.data[tag], states.hash[tag] = value, value + data[tag], hash[tag] = value, value end end end -function states.get_by_tag(tag,key,default) - local h = states.hash[tag] +local function get_by_tag(tag,key,default) + local h = hash[tag] if h and h[key] then return h[key] else - local d = states.data[tag] + local d = data[tag] if d then for k in gmatch(key,"[^%.]+") do local dk = d[k] - if dk then + if dk ~= nil then d = dk else return default end end - return d or default + if d == false then + return false + else + return d or default + end end end end +states.set_by_tag = set_by_tag +states.get_by_tag = get_by_tag + function states.set(key,value,default,persistent) - states.set_by_tag(states.tag,key,value,default,persistent) + set_by_tag(states.tag,key,value,default,persistent) end function states.get(key,default) - return states.get_by_tag(states.tag,key,default) + return get_by_tag(states.tag,key,default) end ---~ states.data.update = { +--~ data.update = { --~ ["version"] = { --~ ["major"] = 0, --~ ["minor"] = 1, diff --git a/Master/texmf-dist/tex/context/base/luat-sto.lua b/Master/texmf-dist/tex/context/base/luat-sto.lua index 08da735db31..946ce375607 100644 --- a/Master/texmf-dist/tex/context/base/luat-sto.lua +++ b/Master/texmf-dist/tex/context/base/luat-sto.lua @@ -6,96 +6,86 @@ if not modules then modules = { } end modules ['luat-sto'] = { license = "see context related readme files" } -local type, next = type, next +local type, next, setmetatable, getmetatable = type, next, setmetatable, getmetatable local gmatch, format, write_nl = string.gmatch, string.format, texio.write_nl +local serialize, concat = table.serialize, table.concat +local bytecode = lua.bytecode + +local report_storage = logs.reporter("system","storage") storage = storage or { } +local storage = storage + +local data = { } +storage.data = data + +local evaluators = { } +storage.evaluators = evaluators + storage.min = 0 -- 500 storage.max = storage.min - 1 storage.noftables = storage.noftables or 0 storage.nofmodules = storage.nofmodules or 0 -storage.data = { } -storage.evaluators = { } -local evaluators = storage.evaluators -- (evaluate,message,names) -local data = storage.data +storage.mark = utilities.storage.mark +storage.allocate = utilities.storage.allocate +storage.marked = utilities.storage.marked function storage.register(...) - data[#data+1] = { ... } -end - --- evaluators .. messy .. to be redone - -function storage.evaluate(name) - evaluators[#evaluators+1] = name -end - -function storage.finalize() -- we can prepend the string with "evaluate:" - for i=1,#evaluators do - local t = evaluators[i] - for i, v in next, t do - local tv = type(v) - if tv == "string" then - t[i] = loadstring(v)() - elseif tv == "table" then - for _, vv in next, v do - if type(vv) == "string" then - t[i] = loadstring(vv)() - end - end - elseif tv == "function" then - t[i] = v() - end - end + local t = { ... } + local d = t[2] + if d then + storage.mark(d) + else + report_storage("fatal error: invalid storage '%s'",t[1]) + os.exit() end + data[#data+1] = t + return t end -function storage.dump() +local function dump() + local max = storage.max for i=1,#data do local d = data[i] - local message, original, target, evaluate = d[1], d[2] ,d[3] ,d[4] - local name, initialize, finalize, code = nil, "", "", "" + local message, original, target = d[1], d[2] ,d[3] + local c, code, name = 0, { }, nil for str in gmatch(target,"([^%.]+)") do if name then name = name .. "." .. str else name = str end - initialize = format("%s %s = %s or {} ", initialize, name, name) - end - if evaluate then - finalize = "storage.evaluate(" .. name .. ")" + c = c + 1 ; code[c] = format("%s = %s or { }",name,name) end - storage.max = storage.max + 1 + max = max + 1 if trace_storage then - logs.report('storage','saving %s in slot %s',message,storage.max) - code = - initialize .. - format("logs.report('storage','restoring %s from slot %s') ",message,storage.max) .. - table.serialize(original,name) .. - finalize - else - code = initialize .. table.serialize(original,name) .. finalize + report_storage('saving %s in slot %s',message,max) + c = c + 1 ; code[c] = format("report_storage('restoring %s from slot %s')",message,max) end - lua.bytecode[storage.max] = loadstring(code) + c = c + 1 ; code[c] = serialize(original,name) + bytecode[max] = loadstring(concat(code,"\n")) collectgarbage("step") end + storage.max = max end +lua.registerfinalizer(dump,"dump storage") + -- we also need to count at generation time (nicer for message) -if lua.bytecode then -- from 0 upwards - local i, b = storage.min, lua.bytecode - while b[i] do - storage.noftables = i - b[i]() - b[i] = nil - i = i + 1 - end -end +--~ if lua.bytecode then -- from 0 upwards +--~ local i, b = storage.min, lua.bytecode +--~ while b[i] do +--~ storage.noftables = i +--~ b[i]() +--~ b[i] = nil +--~ i = i + 1 +--~ end +--~ end statistics.register("stored bytecode data", function() - local modules = (storage.nofmodules > 0 and storage.nofmodules) or (status.luabytecodes - 500) + local modules = (storage.nofmodules > 0 and storage.nofmodules) or (status.luabytecodes - lua.firstbytecode - 1) local dumps = (storage.noftables > 0 and storage.noftables) or storage.max-storage.min + 1 return format("%s modules, %s tables, %s chunks",modules,dumps,modules+dumps) end) @@ -104,9 +94,7 @@ if lua.bytedata then storage.register("lua/bytedata",lua.bytedata,"lua.bytedata") end --- wrong place, kind of forward reference - -function statistics.report_storage(whereto) +function statistics.reportstorage(whereto) whereto = whereto or "term and log" write_nl(whereto," ","stored tables:"," ") for k,v in table.sortedhash(storage.data) do @@ -133,3 +121,11 @@ storage.shared = storage.shared or { } -- (non table) values. storage.register("storage/shared", storage.shared, "storage.shared") + +local mark = storage.mark + +if string.patterns then mark(string.patterns) end +if lpeg.patterns then mark(lpeg.patterns) end +if os.env then mark(os.env) end +if number.dimenfactors then mark(number.dimenfactors) end +if libraries then for k,v in next, libraries do mark(v) end end diff --git a/Master/texmf-dist/tex/context/base/lxml-aux.lua b/Master/texmf-dist/tex/context/base/lxml-aux.lua index 00f7919098f..4798fe06a7a 100644 --- a/Master/texmf-dist/tex/context/base/lxml-aux.lua +++ b/Master/texmf-dist/tex/context/base/lxml-aux.lua @@ -11,15 +11,20 @@ if not modules then modules = { } end modules ['lxml-aux'] = { local trace_manipulations = false trackers.register("lxml.manipulations", function(v) trace_manipulations = v end) -local xmlparseapply, xmlconvert, xmlcopy, xmlname = xml.parse_apply, xml.convert, xml.copy, xml.name +local report_xml = logs.reporter("xml") + +local xml = xml + +local xmlconvert, xmlcopy, xmlname = xml.convert, xml.copy, xml.name local xmlinheritedconvert = xml.inheritedconvert +local xmlapplylpath = xml.applylpath -local type = type -local insert, remove = table.insert, table.remove +local type, setmetatable, getmetatable = type, setmetatable, getmetatable +local insert, remove, fastcopy = table.insert, table.remove, table.fastcopy local gmatch, gsub = string.gmatch, string.gsub local function report(what,pattern,c,e) - logs.report("xml","%s element '%s' (root: '%s', position: %s, index: %s, pattern: %s)",what,xmlname(e),xmlname(e.__p__),c,e.ni,pattern) + report_xml("%s element '%s' (root: '%s', position: %s, index: %s, pattern: %s)",what,xmlname(e),xmlname(e.__p__),c,e.ni,pattern) end local function withelements(e,handle,depth) @@ -73,10 +78,8 @@ function xml.withelement(e,n,handle) -- slow end end -xml.elements_only = xml.collected - -function xml.each_element(root,pattern,handle,reverse) - local collected = xmlparseapply({ root },pattern) +function xml.each(root,pattern,handle,reverse) + local collected = xmlapplylpath(root,pattern) if collected then if reverse then for c=#collected,1,-1 do @@ -91,10 +94,8 @@ function xml.each_element(root,pattern,handle,reverse) end end -xml.process_elements = xml.each_element - -function xml.process_attributes(root,pattern,handle) - local collected = xmlparseapply({ root },pattern) +function xml.processattributes(root,pattern,handle) + local collected = xmlapplylpath(root,pattern) if collected and handle then for c=1,#collected do handle(collected[c].at) @@ -109,12 +110,12 @@ end -- are these still needed -> lxml-cmp.lua -function xml.collect_elements(root, pattern) - return xmlparseapply({ root },pattern) +function xml.collect(root, pattern) + return xmlapplylpath(root,pattern) end -function xml.collect_texts(root, pattern, flatten) -- todo: variant with handle - local collected = xmlparseapply({ root },pattern) +function xml.collecttexts(root, pattern, flatten) -- todo: variant with handle + local collected = xmlapplylpath(root,pattern) if collected and flatten then local xmltostring = xml.tostring for c=1,#collected do @@ -125,18 +126,19 @@ function xml.collect_texts(root, pattern, flatten) -- todo: variant with handle end function xml.collect_tags(root, pattern, nonamespace) - local collected = xmlparseapply({ root },pattern) + local collected = xmlapplylpath(root,pattern) if collected then - local t = { } + local t, n = { }, 0 for c=1,#collected do local e = collected[c] local ns, tg = e.ns, e.tg + n = n + 1 if nonamespace then - t[#t+1] = tg + t[n] = tg elseif ns == "" then - t[#t+1] = tg + t[n] = tg else - t[#t+1] = ns .. ":" .. tg + t[n] = ns .. ":" .. tg end end return t @@ -149,7 +151,7 @@ end local no_root = { no_root = true } -function xml.redo_ni(d) +local function redo_ni(d) for k=1,#d do local dk = d[k] if type(dk) == "table" then @@ -195,8 +197,8 @@ local function copiedelement(element,newparent) end end -function xml.delete_element(root,pattern) - local collected = xmlparseapply({ root },pattern) +function xml.delete(root,pattern) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -207,15 +209,15 @@ function xml.delete_element(root,pattern) end local d = p.dt remove(d,e.ni) - xml.redo_ni(d) -- can be made faster and inlined + redo_ni(d) -- can be made faster and inlined end end end end -function xml.replace_element(root,pattern,whatever) +function xml.replace(root,pattern,whatever) local element = root and xmltoelement(whatever,root) - local collected = element and xmlparseapply({ root },pattern) + local collected = element and xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -226,15 +228,50 @@ function xml.replace_element(root,pattern,whatever) end local d = p.dt d[e.ni] = copiedelement(element,p) - xml.redo_ni(d) -- probably not needed + redo_ni(d) -- probably not needed end end end end +local function wrap(e,wrapper) + local t = { + rn = e.rn, + tg = e.tg, + ns = e.ns, + at = e.at, + dt = e.dt, + __p__ = e, + } + setmetatable(t,getmetatable(e)) + e.rn = wrapper.rn or e.rn or "" + e.tg = wrapper.tg or e.tg or "" + e.ns = wrapper.ns or e.ns or "" + e.at = fastcopy(wrapper.at) + e.dt = { t } +end + +function xml.wrap(root,pattern,whatever) + if whatever then + local wrapper = xmltoelement(whatever,root) + local collected = xmlapplylpath(root,pattern) + if collected then + for c=1,#collected do + local e = collected[c] + if trace_manipulations then + report('wrapping',pattern,c,e) + end + wrap(e,wrapper) + end + end + else + wrap(root,xmltoelement(pattern)) + end +end + local function inject_element(root,pattern,whatever,prepend) local element = root and xmltoelement(whatever,root) - local collected = element and xmlparseapply({ root },pattern) + local collected = element and xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -249,15 +286,17 @@ local function inject_element(root,pattern,whatever,prepend) else be, af = edt, cp end + local bn = #be for i=1,#af do - be[#be+1] = af[i] + bn = bn + 1 + be[bn] = af[i] end if rri then r.dt[rri].dt = be else d[k].dt = be end - xml.redo_ni(d) + redo_ni(d) end end end @@ -265,7 +304,7 @@ end local function insert_element(root,pattern,whatever,before) -- todo: element als functie local element = root and xmltoelement(whatever,root) - local collected = element and xmlparseapply({ root },pattern) + local collected = element and xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -275,24 +314,23 @@ local function insert_element(root,pattern,whatever,before) -- todo: element als k = k + 1 end insert(d,k,copiedelement(element,r)) - xml.redo_ni(d) + redo_ni(d) end end end -xml.insert_element = insert_element -xml.insert_element_after = insert_element -xml.insert_element_before = function(r,p,e) insert_element(r,p,e,true) end -xml.inject_element = inject_element -xml.inject_element_after = inject_element -xml.inject_element_before = function(r,p,e) inject_element(r,p,e,true) end +xml.insert_element = insert_element +xml.insertafter = insert_element +xml.insertbefore = function(r,p,e) insert_element(r,p,e,true) end +xml.injectafter = inject_element +xml.injectbefore = function(r,p,e) inject_element(r,p,e,true) end local function include(xmldata,pattern,attribute,recursive,loaddata) -- parse="text" (default: xml), encoding="" (todo) -- attribute = attribute or 'href' pattern = pattern or 'include' loaddata = loaddata or io.loaddata - local collected = xmlparseapply({ xmldata },pattern) + local collected = xmlapplylpath(xmldata,pattern) if collected then for c=1,#collected do local ek = collected[c] @@ -301,7 +339,7 @@ local function include(xmldata,pattern,attribute,recursive,loaddata) local ekat = ek.at local epdt = ek.__p__.dt if not attribute or attribute == "" then - name = (type(ekdt) == "table" and ekdt[1]) or ekdt -- ckeck, probably always tab or str + name = (type(ekdt) == "table" and ekdt[1]) or ekdt -- check, probably always tab or str end if not name then for a in gmatch(attribute or "href","([^|]+)") do @@ -335,136 +373,88 @@ end xml.include = include ---~ local function manipulate(xmldata,pattern,manipulator) -- untested and might go away ---~ local collected = xmlparseapply({ xmldata },pattern) ---~ if collected then ---~ local xmltostring = xml.tostring ---~ for c=1,#collected do ---~ local e = collected[c] ---~ local data = manipulator(xmltostring(e)) ---~ if data == "" then ---~ epdt[e.ni] = "" ---~ else ---~ local xi = xmlinheritedconvert(data,xmldata) ---~ if not xi then ---~ epdt[e.ni] = "" ---~ else ---~ epdt[e.ni] = xml.body(xi) -- xml.assign(d,k,xi) ---~ end ---~ end ---~ end ---~ end ---~ end - ---~ xml.manipulate = manipulate - -function xml.strip_whitespace(root, pattern, nolines) -- strips all leading and trailing space ! - local collected = xmlparseapply({ root },pattern) - if collected then - for i=1,#collected do - local e = collected[i] - local edt = e.dt - if edt then - local t = { } - for i=1,#edt do - local str = edt[i] - if type(str) == "string" then - if str == "" then - -- stripped - else - if nolines then - str = gsub(str,"[ \n\r\t]+"," ") - end - if str == "" then - -- stripped - else - t[#t+1] = str - end - end +local function stripelement(e,nolines,anywhere) + local edt = e.dt + if edt then + if anywhere then + local t, n = { }, 0 + for e=1,#edt do + local str = edt[e] + if type(str) ~= "string" then + n = n + 1 + t[n] = str + elseif str ~= "" then + -- todo: lpeg for each case + if nolines then + str = gsub(str,"%s+"," ") + end + str = gsub(str,"^%s*(.-)%s*$","%1") + if str ~= "" then + n = n + 1 + t[n] = str + end + end + end + e.dt = t + else + -- we can assume a regular sparse xml table with no successive strings + -- otherwise we should use a while loop + if #edt > 0 then + -- strip front + local str = edt[1] + if type(str) ~= "string" then + -- nothing + elseif str == "" then + remove(edt,1) + else + if nolines then + str = gsub(str,"%s+"," ") + end + str = gsub(str,"^%s+","") + if str == "" then + remove(edt,1) + else + edt[1] = str + end + end + end + local nedt = #edt + if nedt > 0 then + -- strip end + local str = edt[nedt] + if type(str) ~= "string" then + -- nothing + elseif str == "" then + remove(edt) + else + if nolines then + str = gsub(str,"%s+"," ") + end + str = gsub(str,"%s+$","") + if str == "" then + remove(edt) else - --~ str.ni = i - t[#t+1] = str + edt[nedt] = str end end - e.dt = t end end end + return e -- convenient end -function xml.strip_whitespace(root, pattern, nolines, anywhere) -- strips all leading and trailing spacing - local collected = xmlparseapply({ root },pattern) -- beware, indices no longer are valid now +xml.stripelement = stripelement + +function xml.strip(root,pattern,nolines,anywhere) -- strips all leading and trailing spacing + local collected = xmlapplylpath(root,pattern) -- beware, indices no longer are valid now if collected then for i=1,#collected do - local e = collected[i] - local edt = e.dt - if edt then - if anywhere then - local t = { } - for e=1,#edt do - local str = edt[e] - if type(str) ~= "string" then - t[#t+1] = str - elseif str ~= "" then - -- todo: lpeg for each case - if nolines then - str = gsub(str,"%s+"," ") - end - str = gsub(str,"^%s*(.-)%s*$","%1") - if str ~= "" then - t[#t+1] = str - end - end - end - e.dt = t - else - -- we can assume a regular sparse xml table with no successive strings - -- otherwise we should use a while loop - if #edt > 0 then - -- strip front - local str = edt[1] - if type(str) ~= "string" then - -- nothing - elseif str == "" then - remove(edt,1) - else - if nolines then - str = gsub(str,"%s+"," ") - end - str = gsub(str,"^%s+","") - if str == "" then - remove(edt,1) - else - edt[1] = str - end - end - end - if #edt > 1 then - -- strip end - local str = edt[#edt] - if type(str) ~= "string" then - -- nothing - elseif str == "" then - remove(edt) - else - if nolines then - str = gsub(str,"%s+"," ") - end - str = gsub(str,"%s+$","") - if str == "" then - remove(edt) - else - edt[#edt] = str - end - end - end - end - end + stripelement(collected[i],nolines,anywhere) end end end -local function rename_space(root, oldspace, newspace) -- fast variant +local function renamespace(root, oldspace, newspace) -- fast variant local ndt = #root.dt for i=1,ndt or 0 do local e = root[i] @@ -477,16 +467,16 @@ local function rename_space(root, oldspace, newspace) -- fast variant end local edt = e.dt if edt then - rename_space(edt, oldspace, newspace) + renamespace(edt, oldspace, newspace) end end end end -xml.rename_space = rename_space +xml.renamespace = renamespace -function xml.remap_tag(root, pattern, newtg) - local collected = xmlparseapply({ root },pattern) +function xml.remaptag(root, pattern, newtg) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do collected[c].tg = newtg @@ -494,8 +484,8 @@ function xml.remap_tag(root, pattern, newtg) end end -function xml.remap_namespace(root, pattern, newns) - local collected = xmlparseapply({ root },pattern) +function xml.remapnamespace(root, pattern, newns) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do collected[c].ns = newns @@ -503,8 +493,8 @@ function xml.remap_namespace(root, pattern, newns) end end -function xml.check_namespace(root, pattern, newns) - local collected = xmlparseapply({ root },pattern) +function xml.checknamespace(root, pattern, newns) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -515,8 +505,8 @@ function xml.check_namespace(root, pattern, newns) end end -function xml.remap_name(root, pattern, newtg, newns, newrn) - local collected = xmlparseapply({ root },pattern) +function xml.remapname(root, pattern, newtg, newns, newrn) + local collected = xmlapplylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -529,15 +519,31 @@ end

Here are a few synonyms.

--ldx]]-- -xml.each = xml.each_element -xml.process = xml.process_element -xml.strip = xml.strip_whitespace -xml.collect = xml.collect_elements -xml.all = xml.collect_elements - -xml.insert = xml.insert_element_after -xml.inject = xml.inject_element_after -xml.after = xml.insert_element_after -xml.before = xml.insert_element_before -xml.delete = xml.delete_element -xml.replace = xml.replace_element +xml.all = xml.each +xml.insert = xml.insertafter +xml.inject = xml.injectafter +xml.after = xml.insertafter +xml.before = xml.insertbefore +xml.process = xml.each + +-- obsolete + +xml.obsolete = xml.obsolete or { } +local obsolete = xml.obsolete + +xml.strip_whitespace = xml.strip obsolete.strip_whitespace = xml.strip +xml.collect_elements = xml.collect obsolete.collect_elements = xml.collect +xml.delete_element = xml.delete obsolete.delete_element = xml.delete +xml.replace_element = xml.replace obsolete.replace_element = xml.replacet +xml.each_element = xml.each obsolete.each_element = xml.each +xml.process_elements = xml.process obsolete.process_elements = xml.process +xml.insert_element_after = xml.insertafter obsolete.insert_element_after = xml.insertafter +xml.insert_element_before = xml.insertbefore obsolete.insert_element_before = xml.insertbefore +xml.inject_element_after = xml.injectafter obsolete.inject_element_after = xml.injectafter +xml.inject_element_before = xml.injectbefore obsolete.inject_element_before = xml.injectbefore +xml.process_attributes = xml.processattributes obsolete.process_attributes = xml.processattributes +xml.collect_texts = xml.collecttexts obsolete.collect_texts = xml.collecttexts +xml.inject_element = xml.inject obsolete.inject_element = xml.inject +xml.remap_tag = xml.remaptag obsolete.remap_tag = xml.remaptag +xml.remap_name = xml.remapname obsolete.remap_name = xml.remapname +xml.remap_namespace = xml.remapnamespace obsolete.remap_namespace = xml.remapnamespace diff --git a/Master/texmf-dist/tex/context/base/lxml-ctx.lua b/Master/texmf-dist/tex/context/base/lxml-ctx.lua index 765754953e9..1f6f6ffd3b8 100644 --- a/Master/texmf-dist/tex/context/base/lxml-ctx.lua +++ b/Master/texmf-dist/tex/context/base/lxml-ctx.lua @@ -8,6 +8,8 @@ if not modules then modules = { } end modules ['lxml-ctx'] = { -- is this still used? +local xml = xml + xml.ctx = { } xml.ctx.enhancers = { } @@ -39,8 +41,8 @@ function xml.ctx.tshow(specification) if not string.find(xmlpattern,"^[%a]+://") then xmlpattern = "xml://" .. pattern end - parsed = xml.parse_pattern(xmlpattern) - titlecommand = specification.title or "type" + local parsed = xml.lpath(xmlpattern) + local titlecommand = specification.title or "type" if parsed.state then context[titlecommand]("pattern: " .. pattern .. " (".. parsed.state .. ")") else @@ -86,9 +88,9 @@ function xml.ctx.tshow(specification) context.stoptabulate() if xmlroot and xmlroot ~= "" then if not loaded[xmlroot] then - loaded[xmlroot] = { xml.convert(buffers.content(xmlroot) or "") } + loaded[xmlroot] = xml.convert(buffers.getcontent(xmlroot)) end - local collected = xml.parse_apply(loaded[xmlroot],xmlpattern) + local collected = xml.filter(loaded[xmlroot],xmlpattern) if collected then local tc = type(collected) if not tc then diff --git a/Master/texmf-dist/tex/context/base/lxml-dir.lua b/Master/texmf-dist/tex/context/base/lxml-dir.lua index 617ce3e20e2..0924931c1b5 100644 --- a/Master/texmf-dist/tex/context/base/lxml-dir.lua +++ b/Master/texmf-dist/tex/context/base/lxml-dir.lua @@ -7,9 +7,8 @@ if not modules then modules = { } end modules ['lxml-dir'] = { } local format, gsub = string.format, string.gsub -local get_id = lxml.id +local getid = lxml.getid local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes -local xmlparseapply = xml.parse_apply --~ --~ @@ -26,12 +25,13 @@ local xmlparseapply = xml.parse_apply --~ --~ +local lxml = lxml - -lxml.directives = lxml.directives or { } - +lxml.directives = lxml.directives or { } local directives = lxml.directives +local report_lxml = logs.reporter("xml","tex") + local data = { setup = { }, before = { }, @@ -43,7 +43,7 @@ local function load_setup(filename) if fullname ~= "" then filename = fullname end - local collection = xmlparseapply({ get_id(xml.load(filename)) },"directive") + local collection = xml.applylpath({ getid(xml.load(filename)) },"directive") -- is { } needed ? if collection then local valid = 0 for i=1,#collection do @@ -60,14 +60,14 @@ local function load_setup(filename) valid = valid + 1 end end - commands.writestatus("lxml","%s directives found in '%s', %s valid",#collection,filename,valid) + report_lxml("%s directives found in '%s', %s valid",#collection,filename,valid) else - commands.writestatus("lxml","no directives found in '%s'",filename) + report_lxml("no directives found in '%s'",filename) end end local function handle_setup(category,root,attribute,element) - root = get_id(root) + root = getid(root) if attribute then local value = root.at[attribute] if value then diff --git a/Master/texmf-dist/tex/context/base/lxml-ent.lua b/Master/texmf-dist/tex/context/base/lxml-ent.lua index 19361193745..5b24d9d6846 100644 --- a/Master/texmf-dist/tex/context/base/lxml-ent.lua +++ b/Master/texmf-dist/tex/context/base/lxml-ent.lua @@ -24,24 +24,28 @@ original entity is returned.

local trace_entities = false trackers.register("xml.entities", function(v) trace_entities = v end) +local report_xml = logs.reporter("xml") + +local xml = xml + xml.entities = xml.entities or { } -- xml.entity_handler == function storage.register("xml/entities",xml.entities,"xml.entities") -- this will move to lxml local entities = xml.entities -- this is a shared hash -xml.unknown_any_entity_format = nil -- has to be per xml +xml.placeholders.unknown_any_entity = nil -- has to be per xml local parsedentity = xml.parsedentitylpeg -function xml.register_entity(key,value) +function xml.registerentity(key,value) entities[key] = value if trace_entities then - logs.report("xml","registering entity '%s' as: %s",key,value) + report_xml("registering entity '%s' as: %s",key,value) end end -function xml.resolved_entity(str) +function xml.resolvedentity(str) local e = entities[str] if e then local te = type(e) diff --git a/Master/texmf-dist/tex/context/base/lxml-inf.lua b/Master/texmf-dist/tex/context/base/lxml-inf.lua index 629c869eca9..834d152fde9 100644 --- a/Master/texmf-dist/tex/context/base/lxml-inf.lua +++ b/Master/texmf-dist/tex/context/base/lxml-inf.lua @@ -8,6 +8,9 @@ if not modules then modules = { } end modules ['lxml-inf'] = { -- This file will be loaded runtime by x-pending.tex. +local xmlwithelements = xml.withelements +local getid = lxml.getid + local status, stack local function get(e,d) @@ -39,7 +42,7 @@ end local function get_command_status(id) status, stack = {}, {} if id then - xmlwithelements(get_id(id),get) + xmlwithelements(getid(id),get) return status else local t = { } diff --git a/Master/texmf-dist/tex/context/base/lxml-ini.mkiv b/Master/texmf-dist/tex/context/base/lxml-ini.mkiv index 0f04d048808..a1d6b50a878 100644 --- a/Master/texmf-dist/tex/context/base/lxml-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/lxml-ini.mkiv @@ -28,88 +28,91 @@ \def\c!entities{entities} % to be internationalized -\def\xmlmain #1{\ctxlua{lxml.main("#1")}} -\def\xmlmatch #1{\ctxlua{lxml.match("#1")}} -\def\xmlall #1#2{\ctxlua{lxml.all("#1","#2")}} -\def\xmlatt #1#2{\ctxlua{lxml.att("#1","#2")}} -\def\xmlattdef #1#2#3{\ctxlua{lxml.att("#1","#2","#3")}} -\def\xmlchainatt #1#2{\ctxlua{lxml.chainattribute("#1","/","#2")}} -\def\xmlchainattdef #1#2#3{\ctxlua{lxml.chainattribute("#1","/","#2","#3")}} -\def\xmlattribute #1#2#3{\ctxlua{lxml.attribute("#1","#2","#3")}} -\def\xmlattributedef #1#2#3#4{\ctxlua{lxml.attribute("#1","#2","#3","#4")}} -\def\xmlcommand #1#2#3{\ctxlua{lxml.command("#1","#2","#3")}} -\def\xmlconcat #1#2#3{\ctxlua{lxml.concat("#1","#2",[[\detokenize{#3}]])}} -\def\xmlconcatrange#1#2#3#4#5{\ctxlua{lxml.concatrange("#1","#2","#3","#4",[[\detokenize{#5}]])}} -\def\xmlcount #1#2{\ctxlua{lxml.count("#1","#2")}} -\def\xmldelete #1#2{\ctxlua{lxml.delete("#1","#2")}} -\def\xmldirectives #1{\ctxlua{lxml.directives.setup("#1")}} -\def\xmldirectivesbefore #1{\ctxlua{lxml.directives.before("#1")}} -\def\xmldirectivesafter #1{\ctxlua{lxml.directives.after("#1")}} -\def\xmlfilter #1#2{\ctxlua{lxml.filter("#1",\!!bs#2\!!es)}} -\def\xmlfilterlist #1#2{\ctxlua{lxml.filterlist("#1",\!!bs#2\!!es)}} -\def\xmlfunction #1#2{\ctxlua{lxml["function"]("#1",\!!bs#2\!!es)}} -\def\xmlfirst #1#2{\ctxlua{lxml.first("#1","#2")}} -\def\xmlflush #1{\ctxlua{lxml.flush("#1")}} -%def\xmlcontent #1{\ctxlua{lxml.content("#1")}} -%def\xmlflushstripped #1{\ctxlua{lxml.strip("#1",true)}} -\def\xmldirect #1{\ctxlua{lxml.direct("#1")}} % in loops, not dt but root -\def\xmlidx #1#2#3{\ctxlua{lxml.idx("#1","#2",\number#3)}} -\def\xmlinclude #1#2#3{\ctxlua{lxml.include("#1","#2","#3",true)}} -\def\xmlindex #1#2#3{\ctxlua{lxml.index("#1","#2",\number#3)}} -\def\xmlinfo #1{\hbox{\ttxx[\ctxlua{lxml.info("#1")}]}} +\def\ctxlxml #1{\directlua\zerocount{lxml.#1}} + +\def\xmlmain #1{\ctxlxml{main("#1")}} +\def\xmlmatch #1{\ctxlxml{match("#1")}} +\def\xmlall #1#2{\ctxlxml{all("#1","#2")}} +\def\xmlatt #1#2{\ctxlxml{att("#1","#2")}} +\def\xmlattdef #1#2#3{\ctxlxml{att("#1","#2","#3")}} +\def\xmlchainatt #1#2{\ctxlxml{chainattribute("#1","/","#2")}} +\def\xmlchainattdef #1#2#3{\ctxlxml{chainattribute("#1","/","#2","#3")}} +\def\xmlattribute #1#2#3{\ctxlxml{attribute("#1","#2","#3")}} +\def\xmlattributedef #1#2#3#4{\ctxlxml{attribute("#1","#2","#3","#4")}} +\def\xmlcommand #1#2#3{\ctxlxml{command("#1","#2","#3")}} +\def\xmlconcat #1#2#3{\ctxlxml{concat("#1","#2",[[\detokenize{#3}]])}} +\def\xmlconcatrange#1#2#3#4#5{\ctxlxml{concatrange("#1","#2","#3","#4",[[\detokenize{#5}]])}} +\def\xmlcount #1#2{\ctxlxml{count("#1","#2")}} +\def\xmldelete #1#2{\ctxlxml{delete("#1","#2")}} +\def\xmldirectives #1{\ctxlxml{directives.setup("#1")}} +\def\xmldirectivesbefore #1{\ctxlxml{directives.before("#1")}} +\def\xmldirectivesafter #1{\ctxlxml{directives.after("#1")}} +\def\xmlfilter #1#2{\ctxlxml{filter("#1",\!!bs#2\!!es)}} +\def\xmlfilterlist #1#2{\ctxlxml{filterlist("#1",\!!bs#2\!!es)}} +\def\xmlfunction #1#2{\ctxlxml{applyfunction("#1",\!!bs#2\!!es)}} +\def\xmlfirst #1#2{\ctxlxml{first("#1","#2")}} +\def\xmlflush #1{\ctxlxml{flush("#1")}} +%def\xmlcontent #1{\ctxlxml{content("#1")}} +%def\xmlflushstripped #1{\ctxlxml{strip("#1",true)}} +\def\xmldirect #1{\ctxlxml{direct("#1")}} % in loops, not dt but root +\def\xmlidx #1#2#3{\ctxlxml{idx("#1","#2",\number#3)}} +\def\xmlinclude #1#2#3{\ctxlxml{include("#1","#2","#3",true)}} +\def\xmlindex #1#2#3{\ctxlxml{index("#1","#2",\number#3)}} +\def\xmlinfo #1{\hbox{\ttxx[\ctxlxml{info("#1")}]}} \def\xmlshow #1{\startpacked\ttx\xmlverbatim{#1}\stoppacked} -\def\xmllast #1#2{\ctxlua{lxml.last("#1","#2")}} -\def\xmlname #1{\ctxlua{lxml.name("#1")}} -\def\xmlnamespace #1{\ctxlua{lxml.namespace("#1")}} -\def\xmlnonspace #1#2{\ctxlua{lxml.nonspace("#1","#2")}} -\def\xmlraw #1#2{\ctxlua{lxml.raw("#1","#2")}} -\def\xmlcontext #1#2{\ctxlua{lxml.context("#1","#2")}} -\def\xmlflushcontext #1{\ctxlua{lxml.context("#1")}} -\def\xmlsnippet #1#2{\ctxlua{lxml.snippet("#1",#2)}} -\def\xmlelement #1#2{\ctxlua{lxml.element("#1",#2)}} +\def\xmllast #1#2{\ctxlxml{last("#1","#2")}} +\def\xmlname #1{\ctxlxml{name("#1")}} +\def\xmlnamespace #1{\ctxlxml{namespace("#1")}} +\def\xmlnonspace #1#2{\ctxlxml{nonspace("#1","#2")}} +\def\xmlraw #1#2{\ctxlxml{raw("#1","#2")}} +\def\xmlcontext #1#2{\ctxlxml{context("#1","#2")}} +\def\xmlflushcontext #1{\ctxlxml{context("#1")}} +\def\xmlsnippet #1#2{\ctxlxml{snippet("#1",#2)}} +\def\xmlelement #1#2{\ctxlxml{element("#1",#2)}} \def\xmlregisterns #1#2{\ctxlua{xml.registerns("#1","#2")}} % document \def\xmlremapname #1#2#3#4{\ctxlua{xml.remapname(lxml.id("#1"),"#2","#3","#4")}} % element -\def\xmlremapnamespace #1#2#3{\ctxlua{xml.rename_space(lxml.id("#1"),"#2","#3")}} % document -\def\xmlchecknamespace #1#2#3{\ctxlua{xml.check_namespace(lxml.id("#1"),"#2","#3")}} % element -\def\xmlsetfunction #1#2#3{\ctxlua{lxml.setaction("#1","#2",#3)}} -\def\xmlsetsetup #1#2#3{\ctxlua{lxml.setsetup("#1","#2","#3")}} -\def\xmlstrip #1#2{\ctxlua{lxml.strip("#1","#2")}} -\def\xmlstripnolines #1#2{\ctxlua{lxml.strip("#1","#2",true)}} -\def\xmlstripanywhere #1#2{\ctxlua{lxml.strip("#1","#2",true,true)}} -\def\xmlstripped #1#2{\ctxlua{lxml.stripped("#1","#2")}} -\def\xmlstrippednolines #1#2{\ctxlua{lxml.stripped("#1","#2",true)}} -\def\xmltag #1{\ctxlua{lxml.tag("#1")}} -\def\xmltext #1#2{\ctxlua{lxml.text("#1","#2")}} -\def\xmlverbatim #1{\ctxlua{lxml.verbatim("#1")}} -\def\xmldisplayverbatim #1{\ctxlua{lxml.displayverbatim("#1")}} -\def\xmlinlineverbatim #1{\ctxlua{lxml.inlineverbatim("#1")}} - -\def\xmlload #1#2{\ctxlua{lxml.load("#1","#2","\@@xmentities","\@@xmcompress")}} -\def\xmlloadbuffer #1#2{\ctxlua{lxml.loadbuffer("#1","#2","\@@xmentities","\@@xmcompress")}} -\def\xmlloaddata #1#2{\ctxlua{lxml.loaddata("#1",\!!bs#2\!!es,"\@@xmentities","\@@xmcompress")}} -\def\xmlloadregistered #1#2{\ctxlua{lxml.loadregistered("#1","\@@xmentities","\@@xmcompress")}} -\def\xmlloaddirectives #1{\ctxlua{lxml.directives.load("any:///#1")}} -\def\xmlpos #1{\ctxlua{lxml.pos("#1")}} - -%def\xmldoifelse #1#2{\ctxlua{cs.testcase(xml.found(lxml.id("#1"),"#2",false))}} -%def\xmldoifelsetext #1#2{\ctxlua{cs.testcase(xml.found(lxml.id("#1"),"#2",true ))}} +\def\xmlremapnamespace #1#2#3{\ctxlua{xml.renamespace(lxml.id("#1"),"#2","#3")}} % document +\def\xmlchecknamespace #1#2#3{\ctxlua{xml.checknamespace(lxml.id("#1"),"#2","#3")}} % element +\def\xmlsetfunction #1#2#3{\ctxlxml{setaction("#1","#2",#3)}} +\def\xmlsetsetup #1#2#3{\ctxlxml{setsetup("#1","#2","#3")}} +\def\xmlstrip #1#2{\ctxlxml{strip("#1","#2")}} +\def\xmlstripnolines #1#2{\ctxlxml{strip("#1","#2",true)}} +\def\xmlstripanywhere #1#2{\ctxlxml{strip("#1","#2",true,true)}} +\def\xmlstripped #1#2{\ctxlxml{stripped("#1","#2")}} +\def\xmlstrippednolines #1#2{\ctxlxml{stripped("#1","#2",true)}} +\def\xmltag #1{\ctxlxml{tag("#1")}} +\def\xmltext #1#2{\ctxlxml{text("#1","#2")}} +\def\xmlverbatim #1{\ctxlxml{verbatim("#1")}} +\def\xmldisplayverbatim #1{\ctxlxml{displayverbatim("#1")}} +\def\xmlinlineverbatim #1{\ctxlxml{inlineverbatim("#1")}} + +\def\xmlload #1#2{\ctxlxml{load("#1","#2","\@@xmentities","\@@xmcompress")}} +\def\xmlloadbuffer #1#2{\ctxlxml{loadbuffer("#1","#2","\@@xmentities","\@@xmcompress")}} +\def\xmlloaddata #1#2{\ctxlxml{loaddata("#1",\!!bs#2\!!es,"\@@xmentities","\@@xmcompress")}} +\def\xmlloadregistered #1#2{\ctxlxml{loadregistered("#1","\@@xmentities","\@@xmcompress")}} +\def\xmlloaddirectives #1{\ctxlxml{directives.load("any:///#1")}} +\def\xmlpos #1{\ctxlxml{pos("#1")}} + +\def\xmltoparameters #1{\ctxlxml{toparameters("#1")}} + +\def\xmltofile #1#2#3{\ctxlxml{tofile("#1","#2","#3")}} % id pattern filename % kind of special: -\def\xmlstartraw{\ctxlua{lxml.startraw()}} -\def\xmlstopraw {\ctxlua{lxml.stopraw()}} +\def\xmlstartraw{\ctxlxml{startraw()}} +\def\xmlstopraw {\ctxlxml{stopraw()}} % todo: \xmldoifelseattribute -\def\xmldoif #1#2{\ctxlua{lxml.doif (\!!bs#1\!!es,\!!bs#2\!!es)}} -\def\xmldoifnot #1#2{\ctxlua{lxml.doifnot (\!!bs#1\!!es,\!!bs#2\!!es)}} -\def\xmldoifelse #1#2{\ctxlua{lxml.doifelse (\!!bs#1\!!es,\!!bs#2\!!es)}} -\def\xmldoiftext #1#2{\ctxlua{lxml.doiftext (\!!bs#1\!!es,\!!bs#2\!!es)}} -\def\xmldoifnottext #1#2{\ctxlua{lxml.doifnottext (\!!bs#1\!!es,\!!bs#2\!!es)}} -\def\xmldoifelsetext #1#2{\ctxlua{lxml.doifelsetext(\!!bs#1\!!es,\!!bs#2\!!es)}} +\def\xmldoif #1#2{\ctxlxml{doif (\!!bs#1\!!es,\!!bs#2\!!es)}} +\def\xmldoifnot #1#2{\ctxlxml{doifnot (\!!bs#1\!!es,\!!bs#2\!!es)}} +\def\xmldoifelse #1#2{\ctxlxml{doifelse (\!!bs#1\!!es,\!!bs#2\!!es)}} +\def\xmldoiftext #1#2{\ctxlxml{doiftext (\!!bs#1\!!es,\!!bs#2\!!es)}} +\def\xmldoifnottext #1#2{\ctxlxml{doifnottext (\!!bs#1\!!es,\!!bs#2\!!es)}} +\def\xmldoifelsetext #1#2{\ctxlxml{doifelsetext(\!!bs#1\!!es,\!!bs#2\!!es)}} -%def\xmldoifelseempty #1#2{\ctxlua{lxml.doifelseempty("#1","#2")}} % #2, "*" or "" == self not yet implemented -%def\xmldoifelseselfempty #1{\ctxlua{lxml.doifelseempty("#1")}} +%def\xmldoifelseempty #1#2{\ctxlxml{doifelseempty("#1","#2")}} % #2, "*" or "" == self not yet implemented +%def\xmldoifelseselfempty #1{\ctxlxml{doifelseempty("#1")}} % \startxmlsetups xml:include % \xmlinclude{main}{include}{filename|href} @@ -129,21 +132,21 @@ % todo: 1:xml:whatever always before 3:xml:something -\def\xmlprependsetup #1{\ctxlua{lxml.installsetup(1,"*","#1")}} -\def\xmlappendsetup #1{\ctxlua{lxml.installsetup(2,"*","#1")}} -\def\xmlbeforesetup #1#2{\ctxlua{lxml.installsetup(3,"*","#1","#2"))}} -\def\xmlaftersetup #1#2{\ctxlua{lxml.installsetup(4,"*","#1","#2"))}} +\def\xmlprependsetup #1{\ctxlxml{installsetup(1,"*","#1")}} +\def\xmlappendsetup #1{\ctxlxml{installsetup(2,"*","#1")}} +\def\xmlbeforesetup #1#2{\ctxlxml{installsetup(3,"*","#1","#2"))}} +\def\xmlaftersetup #1#2{\ctxlxml{installsetup(4,"*","#1","#2"))}} -\def\xmlprependdocumentsetup #1#2{\ctxlua{lxml.installsetup(1,"#1","#2")}} -\def\xmlappenddocumentsetup #1#2{\ctxlua{lxml.installsetup(2,"#1","#2")}} -\def\xmlbeforedocumentsetup#1#2#3{\ctxlua{lxml.installsetup(3,"#1","#2","#3"))}} -\def\xmlafterdocumentsetup #1#2#3{\ctxlua{lxml.installsetup(4,"#1","#2","#3"))}} +\def\xmlprependdocumentsetup #1#2{\ctxlxml{installsetup(1,"#1","#2")}} +\def\xmlappenddocumentsetup #1#2{\ctxlxml{installsetup(2,"#1","#2")}} +\def\xmlbeforedocumentsetup#1#2#3{\ctxlxml{installsetup(3,"#1","#2","#3"))}} +\def\xmlafterdocumentsetup #1#2#3{\ctxlxml{installsetup(4,"#1","#2","#3"))}} -\def\xmlremovesetup #1{\ctxlua{lxml.removesetup("*","#1")}} -\def\xmlremovedocumentsetup #1#2{\ctxlua{lxml.removesetup("#1","#2")}} +\def\xmlremovesetup #1{\ctxlxml{removesetup("*","#1")}} +\def\xmlremovedocumentsetup #1#2{\ctxlxml{removesetup("#1","#2")}} -\def\xmlflushdocumentsetups #1#2{\ctxlua{lxml.flushsetups("#1","*","#2")}} % #1 == id where to apply * and #2 -\def\xmlresetdocumentsetups #1{\ctxlua{lxml.resetsetups("#1")}} +\def\xmlflushdocumentsetups #1#2{\ctxlxml{flushsetups("#1","*","#2")}} % #1 == id where to apply * and #2 +\def\xmlresetdocumentsetups #1{\ctxlxml{resetsetups("#1")}} \let\xmlregistersetup \xmlappendsetup \let\xmlregisterdocumentsetup\xmlappenddocumentsetup @@ -266,9 +269,9 @@ \def\inlinemessage #1{\dontleavehmode{\tttf#1}} \def\displaymessage#1{\blank\inlinemessage{#1}\blank} -\def\xmltraceentities - {\ctxlua{xml.set_text_cleanup(lxml.trace_text_entities)}% - \appendtoks\ctxlua{lxml.show_text_entities()}\to\everygoodbye} +% \def\xmltraceentities % settextcleanup is not defined +% {\ctxlua{xml.settextcleanup(lxml.trace_text_entities)}% +% \appendtoks\ctxlxml{showtextentities()}\to\everygoodbye} % processing instructions @@ -283,13 +286,12 @@ % \def\xmlctxdirective#1#2#3{\doif{#1}{clue}{\doif{#2}{page}}{\page[#3]}} -\chardef\xmlprocessingmode=0 % 0=unset, 1=text, 2=hidden +\newconstant\xmlprocessingmode % 0=unset, 1=text, 2=hidden \newtoks\everysetupxml \unexpanded\def\setupxml[#1]{\getparameters[\??xm][#1]\the\everysetupxml} - \letvalue{\??xm:\s!default:\v!normal}\zerocount \letvalue{\??xm:\s!default:\v!none }\zerocount \letvalue{\??xm:\s!default:\v!text }\plusone @@ -299,15 +301,15 @@ {\ifcase\xmlprocessingmode % unset \or - \ctxlua{lxml.set_command_to_text("#1")}% 1 + \ctxlxml{setcommandtotext("#1")}% 1 \or - \ctxlua{lxml.set_command_to_none("#1")}% 2 + \ctxlxml{setcommandtonone("#1")}% 2 \else % unset \fi} \appendtoks - \chardef\xmlprocessingmode\executeifdefined{\??xm:\s!default:\@@xmdefault}\plusone + \xmlprocessingmode\executeifdefined{\??xm:\s!default:\@@xmdefault}\plusone \to \everysetupxml \def\xmlinitialize{\the\everysetupxml} @@ -317,24 +319,6 @@ \c!compress=\v!no, % strip comment \c!entities=\v!yes] % replace entities -% \defineXMLenvironment[y]{(}{)} -% -% \startxmlsetups x -% /\xmlflush{#1}/ -% \stopxmlsetups -% -% \startxmlsetups xx -% \xmlsetsetup{main}{x}{*} -% \stopxmlsetups -% -% \xmlregistersetup{xx} -% -% \startbuffer -% a <&>{b} c -% \stopbuffer -% -% mkii: [\processXMLbuffer]\quad mkiv: [\xmlprocessbuffer{main}{}{}] - \def\xmlmapvalue #1#2#3{\setvalue{\??xm:v:#1:#2}{#3}} % keep #3 to grab spaces \def\xmlvalue #1#2#3{\executeifdefined{\??xm:v:#1:#2}{#3}} %def\xmlvalue #1#2{\ifcsname\??xm:v:#1:#2\endcsname\csname\??xm:v:#1:#2\expandafter\expandafter\gobbleoneargument\expandafter\endcsname\else\expandafter\firstofoneargument\fi} @@ -345,19 +329,19 @@ %D Experimental: -\def\xmlgetindex #1{\ctxlua{lxml.getindex("\xmldocument","#1")}} -\def\xmlrawindex #1{\ctxlua{lxml.rawindex("#1")}} -\def\xmlwithindex #1#2{\ctxlua{lxml.withindex("\xmldocument","#1","#2")}} +\def\xmlgetindex #1{\ctxlxml{getindex("\xmldocument","#1")}} +\def\xmlrawindex #1{\ctxlxml{rawindex("#1")}} +\def\xmlwithindex #1#2{\ctxlxml{withindex("\xmldocument","#1","#2")}} \def\xmlreference #1#2{\string\xmlwithindex{#1}{#2}} %D Entities: -\chardef\xmlautoentities=1 % 0=off, 1=upper, 2=upper,lower +\setnewconstant\xmlautoentities\plusone % 0=off, 1=upper, 2=upper,lower \let\isolatedentity\firstofoneargument -\def\xmlsetentity#1#2{\ctxlua{xml.register_entity('#1',\!!bs\detokenize{#2}\!!es)}} -\def\xmltexentity#1#2{\ctxlua{xml.register_entity('#1',\!!bs\detokenize{\isolatedentity{#2}}\!!es)}} +\def\xmlsetentity#1#2{\ctxlua{xml.registerentity('#1',\!!bs\detokenize{#2}\!!es)}} +\def\xmltexentity#1#2{\ctxlua{xml.registerentity('#1',\!!bs\detokenize{\isolatedentity{#2}}\!!es)}} % \xmlsetentity{tex}{\TEX{}} % {} needed @@ -408,7 +392,7 @@ % \stopextendcatcodetable % % \ctxlua { % entities are remembered in the format -% characters.remapentity("<",characters.active_offset + utf.byte("<")) -% characters.remapentity("&",characters.active_offset + utf.byte("&")) -% characters.remapentity(">",characters.active_offset + utf.byte(">")) +% characters.remapentity("<",characters.activeoffset + utf.byte("<")) +% characters.remapentity("&",characters.activeoffset + utf.byte("&")) +% characters.remapentity(">",characters.activeoffset + utf.byte(">")) % } diff --git a/Master/texmf-dist/tex/context/base/lxml-lpt.lua b/Master/texmf-dist/tex/context/base/lxml-lpt.lua index bddbe48685c..aa0b0a22ecc 100644 --- a/Master/texmf-dist/tex/context/base/lxml-lpt.lua +++ b/Master/texmf-dist/tex/context/base/lxml-lpt.lua @@ -7,11 +7,14 @@ if not modules then modules = { } end modules ['lxml-pth'] = { } -- e.ni is only valid after a filter run +-- todo: B/C/[get first match] local concat, remove, insert = table.concat, table.remove, table.insert local type, next, tonumber, tostring, setmetatable, loadstring = type, next, tonumber, tostring, setmetatable, loadstring local format, upper, lower, gmatch, gsub, find, rep = string.format, string.upper, string.lower, string.gmatch, string.gsub, string.find, string.rep -local lpegmatch = lpeg.match +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns + +local setmetatableindex = table.setmetatableindex -- beware, this is not xpath ... e.g. position is different (currently) and -- we have reverse-sibling as reversed preceding sibling @@ -43,23 +46,33 @@ local trace_lpath = false if trackers then trackers.register("xml.path", local trace_lparse = false if trackers then trackers.register("xml.parse", function(v) trace_lparse = v end) end local trace_lprofile = false if trackers then trackers.register("xml.profile", function(v) trace_lpath = v trace_lparse = v trace_lprofile = v end) end +local report_lpath = logs.reporter("xml","lpath") + --[[ldx--

We've now arrived at an interesting part: accessing the tree using a subset of and since we're not compatible we call it . We will explain more about its usage in other documents.

--ldx]]-- +local xml = xml + local lpathcalls = 0 function xml.lpathcalls () return lpathcalls end local lpathcached = 0 function xml.lpathcached() return lpathcached end -xml.functions = xml.functions or { } -- internal -xml.expressions = xml.expressions or { } -- in expressions -xml.finalizers = xml.finalizers or { } -- fast do-with ... (with return value other than collection) -xml.specialhandler = xml.specialhandler or { } +xml.functions = xml.functions or { } -- internal +local functions = xml.functions + +xml.expressions = xml.expressions or { } -- in expressions +local expressions = xml.expressions -local functions = xml.functions -local expressions = xml.expressions -local finalizers = xml.finalizers +xml.finalizers = xml.finalizers or { } -- fast do-with ... (with return value other than collection) +local finalizers = xml.finalizers + +xml.specialhandler = xml.specialhandler or { } +local specialhandler = xml.specialhandler + +lpegpatterns.xml = lpegpatterns.xml or { } +local xmlpatterns = lpegpatterns.xml finalizers.xml = finalizers.xml or { } finalizers.tex = finalizers.tex or { } @@ -69,14 +82,14 @@ local function fallback (t, name) if fn then t[name] = fn else - logs.report("xml","unknown sub finalizer '%s'",tostring(name)) + report_lpath("unknown sub finalizer '%s'",tostring(name)) fn = function() end end return fn end -setmetatable(finalizers.xml, { __index = fallback }) -setmetatable(finalizers.tex, { __index = fallback }) +setmetatableindex(finalizers.xml, fallback) +setmetatableindex(finalizers.tex, fallback) xml.defaultprotocol = "xml" @@ -124,7 +137,7 @@ apply_axis['root'] = function(list) rt = ll end end - collected[#collected+1] = rt + collected[l] = rt end return collected end @@ -132,94 +145,103 @@ end apply_axis['self'] = function(list) --~ local collected = { } --~ for l=1,#list do ---~ collected[#collected+1] = list[l] +--~ collected[l] = list[l] --~ end --~ return collected return list end apply_axis['child'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local dt = ll.dt - local en = 0 - for k=1,#dt do - local dk = dt[k] - if dk.tg then - collected[#collected+1] = dk - dk.ni = k -- refresh - en = en + 1 - dk.ei = en + if dt then -- weird that this is needed + local en = 0 + for k=1,#dt do + local dk = dt[k] + if dk.tg then + c = c + 1 + collected[c] = dk + dk.ni = k -- refresh + en = en + 1 + dk.ei = en + end end + ll.en = en end - ll.en = en end return collected end -local function collect(list,collected) +local function collect(list,collected,c) local dt = list.dt if dt then local en = 0 for k=1,#dt do local dk = dt[k] if dk.tg then - collected[#collected+1] = dk + c = c + 1 + collected[c] = dk dk.ni = k -- refresh en = en + 1 dk.ei = en - collect(dk,collected) + c = collect(dk,collected,c) end end list.en = en end + return c end apply_axis['descendant'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do - collect(list[l],collected) + c = collect(list[l],collected,c) end return collected end -local function collect(list,collected) +local function collect(list,collected,c) local dt = list.dt if dt then local en = 0 for k=1,#dt do local dk = dt[k] if dk.tg then - collected[#collected+1] = dk + c = c + 1 + collected[c] = dk dk.ni = k -- refresh en = en + 1 dk.ei = en - collect(dk,collected) + c = collect(dk,collected,c) end end list.en = en end + return c end apply_axis['descendant-or-self'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] if ll.special ~= true then -- catch double root - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end - collect(ll,collected) + c = collect(ll,collected,c) end return collected end apply_axis['ancestor'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] while ll do ll = ll.__p__ if ll then - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end end end @@ -227,14 +249,16 @@ apply_axis['ancestor'] = function(list) end apply_axis['ancestor-or-self'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll while ll do ll = ll.__p__ if ll then - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end end end @@ -242,11 +266,12 @@ apply_axis['ancestor-or-self'] = function(list) end apply_axis['parent'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local pl = list[l].__p__ if pl then - collected[#collected+1] = pl + c = c + 1 + collected[c] = pl end end return collected @@ -261,7 +286,7 @@ apply_axis['namespace'] = function(list) end apply_axis['following'] = function(list) -- incomplete ---~ local collected = { } +--~ local collected, c = { }, 0 --~ for l=1,#list do --~ local ll = list[l] --~ local p = ll.__p__ @@ -269,7 +294,8 @@ apply_axis['following'] = function(list) -- incomplete --~ for i=ll.ni+1,#d do --~ local di = d[i] --~ if type(di) == "table" then ---~ collected[#collected+1] = di +--~ c = c + 1 +--~ collected[c] = di --~ break --~ end --~ end @@ -279,7 +305,7 @@ apply_axis['following'] = function(list) -- incomplete end apply_axis['preceding'] = function(list) -- incomplete ---~ local collected = { } +--~ local collected, c = { }, 0 --~ for l=1,#list do --~ local ll = list[l] --~ local p = ll.__p__ @@ -287,7 +313,8 @@ apply_axis['preceding'] = function(list) -- incomplete --~ for i=ll.ni-1,1,-1 do --~ local di = d[i] --~ if type(di) == "table" then ---~ collected[#collected+1] = di +--~ c = c + 1 +--~ collected[c] = di --~ break --~ end --~ end @@ -297,7 +324,7 @@ apply_axis['preceding'] = function(list) -- incomplete end apply_axis['following-sibling'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local p = ll.__p__ @@ -305,7 +332,8 @@ apply_axis['following-sibling'] = function(list) for i=ll.ni+1,#d do local di = d[i] if type(di) == "table" then - collected[#collected+1] = di + c = c + 1 + collected[c] = di end end end @@ -313,7 +341,7 @@ apply_axis['following-sibling'] = function(list) end apply_axis['preceding-sibling'] = function(list) - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local p = ll.__p__ @@ -321,7 +349,8 @@ apply_axis['preceding-sibling'] = function(list) for i=1,ll.ni-1 do local di = d[i] if type(di) == "table" then - collected[#collected+1] = di + c = c + 1 + collected[c] = di end end end @@ -329,7 +358,7 @@ apply_axis['preceding-sibling'] = function(list) end apply_axis['reverse-sibling'] = function(list) -- reverse preceding - local collected = { } + local collected, c = { }, 0 for l=1,#list do local ll = list[l] local p = ll.__p__ @@ -337,7 +366,8 @@ apply_axis['reverse-sibling'] = function(list) -- reverse preceding for i=ll.ni-1,1,-1 do local di = d[i] if type(di) == "table" then - collected[#collected+1] = di + c = c + 1 + collected[c] = di end end end @@ -363,7 +393,7 @@ local function apply_nodes(list,directive,nodes) return { } end else - local collected, m, p = { }, 0, nil + local collected, c, m, p = { }, 0, 0, nil if not nns then -- only check tag for l=1,#list do local ll = list[l] @@ -372,11 +402,13 @@ local function apply_nodes(list,directive,nodes) if directive then if ntg == ltg then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif ntg ~= ltg then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -388,11 +420,13 @@ local function apply_nodes(list,directive,nodes) if directive then if lns == nns then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif lns ~= nns then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -406,11 +440,13 @@ local function apply_nodes(list,directive,nodes) if directive then if ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif not ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -418,7 +454,7 @@ local function apply_nodes(list,directive,nodes) return collected end else - local collected, m, p = { }, 0, nil + local collected, c, m, p = { }, 0, 0, nil for l=1,#list do local ll = list[l] local ltg = ll.tg @@ -435,11 +471,13 @@ local function apply_nodes(list,directive,nodes) if directive then if ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end elseif not ok then local llp = ll.__p__ ; if llp ~= p then p, m = llp, 1 else m = m + 1 end - collected[#collected+1], ll.mi = ll, m + c = c + 1 + collected[c], ll.mi = ll, m end end end @@ -450,12 +488,13 @@ end local quit_expression = false local function apply_expression(list,expression,order) - local collected = { } + local collected, c = { }, 0 quit_expression = false for l=1,#list do local ll = list[l] if expression(list,ll,l,order) then -- nasty, order alleen valid als n=1 - collected[#collected+1] = ll + c = c + 1 + collected[c] = ll end if quit_expression then break @@ -494,7 +533,9 @@ local lp_builtin = P ( P("ns") / "ll.ns" ) * ((spaces * P("(") * spaces * P(")"))/"") -local lp_attribute = (P("@") + P("attribute::")) / "" * Cc("(ll.at and ll.at['") * R("az","AZ","--","__")^1 * Cc("'])") +-- for the moment we keep namespaces with attributes + +local lp_attribute = (P("@") + P("attribute::")) / "" * Cc("(ll.at and ll.at['") * ((R("az","AZ") + S("-_:"))^1) * Cc("'])") local lp_fastpos_p = ((P("+")^0 * R("09")^1 * P(-1)) / function(s) return "l==" .. s end) local lp_fastpos_n = ((P("-") * R("09")^1 * P(-1)) / function(s) return "(" .. s .. "<0 and (#list+".. s .. "==l))" end) local lp_fastpos = lp_fastpos_n + lp_fastpos_p @@ -613,13 +654,13 @@ local skip = { } local function errorrunner_e(str,cnv) if not skip[str] then - logs.report("lpath","error in expression: %s => %s",str,cnv) + report_lpath("error in expression: %s => %s",str,cnv) skip[str] = cnv or str end return false end local function errorrunner_f(str,arg) - logs.report("lpath","error in finalizer: %s(%s)",str,arg or "") + report_lpath("error in finalizer: %s(%s)",str,arg or "") return false end @@ -670,7 +711,7 @@ local special_1 = P("*") * Cc(register_auto_descendant) * Cc(register_all_nodes local special_2 = P("/") * Cc(register_auto_self) local special_3 = P("") * Cc(register_auto_self) -local parser = Ct { "patterns", -- can be made a bit faster by moving pattern outside +local pathparser = Ct { "patterns", -- can be made a bit faster by moving pattern outside patterns = spaces * V("protocol") * spaces * ( ( V("special") * spaces * P(-1) ) + @@ -742,6 +783,8 @@ local parser = Ct { "patterns", -- can be made a bit faster by moving pattern ou } +xmlpatterns.pathparser = pathparser + local cache = { } local function nodesettostring(set,nodetest) @@ -751,7 +794,7 @@ local function nodesettostring(set,nodetest) if not ns or ns == "" then ns = "*" end if not tg or tg == "" then tg = "*" end tg = (tg == "@rt@" and "[root]") or format("%s:%s",ns,tg) - t[#t+1] = (directive and tg) or format("not(%s)",tg) + t[i] = (directive and tg) or format("not(%s)",tg) end if nodetest == false then return format("not(%s)",concat(t,"|")) @@ -770,7 +813,7 @@ local function tagstostring(list) local ns, tg = li.ns, li.tg if not ns or ns == "" then ns = "*" end if not tg or tg == "" then tg = "*" end - t[#t+1] = (tg == "@rt@" and "[root]") or format("%s:%s",ns,tg) + t[i] = (tg == "@rt@" and "[root]") or format("%s:%s",ns,tg) end return concat(t," ") end @@ -778,16 +821,16 @@ end xml.nodesettostring = nodesettostring -local parse_pattern -- we have a harmless kind of circular reference +local lpath -- we have a harmless kind of circular reference + +local lshowoptions = { functions = false } local function lshow(parsed) if type(parsed) == "string" then - parsed = parse_pattern(parsed) + parsed = lpath(parsed) end - local s = table.serialize_functions -- ugly - table.serialize_functions = false -- ugly - logs.report("lpath","%s://%s => %s",parsed.protocol or xml.defaultprotocol,parsed.pattern,table.serialize(parsed,false)) - table.serialize_functions = s -- ugly + report_lpath("%s://%s => %s",parsed.protocol or xml.defaultprotocol,parsed.pattern, + table.serialize(parsed,false,lshowoptions)) end xml.lshow = lshow @@ -801,7 +844,7 @@ local function add_comment(p,str) end end -parse_pattern = function (pattern) -- the gain of caching is rather minimal +lpath = function (pattern) -- the gain of caching is rather minimal lpathcalls = lpathcalls + 1 if type(pattern) == "table" then return pattern @@ -810,13 +853,13 @@ parse_pattern = function (pattern) -- the gain of caching is rather minimal if parsed then lpathcached = lpathcached + 1 else - parsed = lpegmatch(parser,pattern) + parsed = lpegmatch(pathparser,pattern) if parsed then parsed.pattern = pattern local np = #parsed if np == 0 then parsed = { pattern = pattern, register_self, state = "parsing error" } - logs.report("lpath","parsing error in '%s'",pattern) + report_lpath("parsing error in '%s'",pattern) lshow(parsed) else -- we could have done this with a more complex parser but this @@ -858,6 +901,8 @@ parse_pattern = function (pattern) -- the gain of caching is rather minimal end end +xml.lpath = lpath + -- we can move all calls inline and then merge the trace back -- technically we can combine axis and the next nodes which is -- what we did before but this a bit cleaner (but slower too) @@ -920,32 +965,32 @@ local function traced_apply(list,parsed,nofparsed,order) if trace_lparse then lshow(parsed) end - logs.report("lpath", "collecting : %s",parsed.pattern) - logs.report("lpath", " root tags : %s",tagstostring(list)) - logs.report("lpath", " order : %s",order or "unset") + report_lpath("collecting: %s",parsed.pattern) + report_lpath("root tags : %s",tagstostring(list)) + report_lpath("order : %s",order or "unset") local collected = list for i=1,nofparsed do local pi = parsed[i] local kind = pi.kind if kind == "axis" then collected = apply_axis[pi.axis](collected) - logs.report("lpath", "% 10i : ax : %s",(collected and #collected) or 0,pi.axis) + report_lpath("% 10i : ax : %s",(collected and #collected) or 0,pi.axis) elseif kind == "nodes" then collected = apply_nodes(collected,pi.nodetest,pi.nodes) - logs.report("lpath", "% 10i : ns : %s",(collected and #collected) or 0,nodesettostring(pi.nodes,pi.nodetest)) + report_lpath("% 10i : ns : %s",(collected and #collected) or 0,nodesettostring(pi.nodes,pi.nodetest)) elseif kind == "expression" then collected = apply_expression(collected,pi.evaluator,order) - logs.report("lpath", "% 10i : ex : %s -> %s",(collected and #collected) or 0,pi.expression,pi.converted) + report_lpath("% 10i : ex : %s -> %s",(collected and #collected) or 0,pi.expression,pi.converted) elseif kind == "finalizer" then collected = pi.finalizer(collected) - logs.report("lpath", "% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pi.name,pi.arguments or "") + report_lpath("% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pi.name,pi.arguments or "") return collected end if not collected or #collected == 0 then local pn = i < nofparsed and parsed[nofparsed] if pn and pn.kind == "finalizer" then collected = pn.finalizer(collected) - logs.report("lpath", "% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pn.name,pn.arguments or "") + report_lpath("% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pn.name,pn.arguments or "") return collected end return nil @@ -982,8 +1027,41 @@ local function normal_apply(list,parsed,nofparsed,order) return collected end -local function parse_apply(list,pattern) - -- we avoid an extra call +--~ local function applylpath(list,pattern) +--~ -- we avoid an extra call +--~ local parsed = cache[pattern] +--~ if parsed then +--~ lpathcalls = lpathcalls + 1 +--~ lpathcached = lpathcached + 1 +--~ elseif type(pattern) == "table" then +--~ lpathcalls = lpathcalls + 1 +--~ parsed = pattern +--~ else +--~ parsed = lpath(pattern) or pattern +--~ end +--~ if not parsed then +--~ return +--~ end +--~ local nofparsed = #parsed +--~ if nofparsed == 0 then +--~ return -- something is wrong +--~ end +--~ local one = list[1] -- we could have a third argument: isroot and list or list[1] or whatever we like ... todo +--~ if not one then +--~ return -- something is wrong +--~ elseif not trace_lpath then +--~ return normal_apply(list,parsed,nofparsed,one.mi) +--~ elseif trace_lprofile then +--~ return profiled_apply(list,parsed,nofparsed,one.mi) +--~ else +--~ return traced_apply(list,parsed,nofparsed,one.mi) +--~ end +--~ end + +local function applylpath(list,pattern) + if not list then + return + end local parsed = cache[pattern] if parsed then lpathcalls = lpathcalls + 1 @@ -992,7 +1070,7 @@ local function parse_apply(list,pattern) lpathcalls = lpathcalls + 1 parsed = pattern else - parsed = parse_pattern(pattern) or pattern + parsed = lpath(pattern) or pattern end if not parsed then return @@ -1001,25 +1079,32 @@ local function parse_apply(list,pattern) if nofparsed == 0 then return -- something is wrong end - local one = list[1] - if not one then - return -- something is wrong - elseif not trace_lpath then - return normal_apply(list,parsed,nofparsed,one.mi) + if not trace_lpath then + return normal_apply ({ list },parsed,nofparsed,list.mi) elseif trace_lprofile then - return profiled_apply(list,parsed,nofparsed,one.mi) + return profiled_apply({ list },parsed,nofparsed,list.mi) else - return traced_apply(list,parsed,nofparsed,one.mi) + return traced_apply ({ list },parsed,nofparsed,list.mi) end end +xml.applylpath = applylpath -- takes a table as first argment, which is what xml.filter will do + +--[[ldx-- +

This is the main filter function. It returns whatever is asked for.

+--ldx]]-- + +function xml.filter(root,pattern) -- no longer funny attribute handling here + return applylpath(root,pattern) +end + -- internal (parsed) expressions.child = function(e,pattern) - return parse_apply({ e },pattern) -- todo: cache + return applylpath(e,pattern) -- todo: cache end expressions.count = function(e,pattern) - local collected = parse_apply({ e },pattern) -- todo: cache + local collected = applylpath(e,pattern) -- todo: cache return (collected and #collected) or 0 end @@ -1029,7 +1114,7 @@ expressions.oneof = function(s,...) -- slow local t = {...} for i=1,#t do if s == t[i] then return true end end return false end expressions.error = function(str) - xml.error_handler("unknown function in lpath expression",tostring(str or "?")) + xml.errorhandler("unknown function in lpath expression",tostring(str or "?")) return false end expressions.undefined = function(s) @@ -1058,8 +1143,8 @@ expressions.boolean = toboolean -- user interface local function traverse(root,pattern,handle) - logs.report("xml","use 'xml.selection' instead for '%s'",pattern) - local collected = parse_apply({ root },pattern) + report_lpath("use 'xml.selection' instead for '%s'",pattern) + local collected = applylpath(root,pattern) if collected then for c=1,#collected do local e = collected[c] @@ -1070,7 +1155,7 @@ local function traverse(root,pattern,handle) end local function selection(root,pattern,handle) - local collected = parse_apply({ root },pattern) + local collected = applylpath(root,pattern) if collected then if handle then for c=1,#collected do @@ -1082,19 +1167,12 @@ local function selection(root,pattern,handle) end end -xml.parse_parser = parser -xml.parse_pattern = parse_pattern -xml.parse_apply = parse_apply xml.traverse = traverse -- old method, r, d, k xml.selection = selection -- new method, simple handle -local lpath = parse_pattern - -xml.lpath = lpath - -function xml.cached_patterns() - return cache -end +--~ function xml.cachedpatterns() +--~ return cache +--~ end -- generic function finalizer (independant namespace) @@ -1106,13 +1184,13 @@ local function dofunction(collected,fnc) f(collected[c]) end else - logs.report("xml","unknown function '%s'",fnc) + report_lpath("unknown function '%s'",fnc) end end end -xml.finalizers.xml["function"] = dofunction -xml.finalizers.tex["function"] = dofunction +finalizers.xml["function"] = dofunction +finalizers.tex["function"] = dofunction -- functions @@ -1204,14 +1282,6 @@ expressions.tag = function(e,n) -- only tg end end ---[[ldx-- -

This is the main filter function. It returns whatever is asked for.

---ldx]]-- - -function xml.filter(root,pattern) -- no longer funny attribute handling here - return parse_apply({ root },pattern) -end - --[[ldx--

Often using an iterators looks nicer in the code than passing handler functions. The book describes how to use coroutines for that @@ -1231,7 +1301,7 @@ end local wrap, yield = coroutine.wrap, coroutine.yield function xml.elements(root,pattern,reverse) -- r, d, k - local collected = parse_apply({ root },pattern) + local collected = applylpath(root,pattern) if collected then if reverse then return wrap(function() for c=#collected,1,-1 do @@ -1247,7 +1317,7 @@ function xml.elements(root,pattern,reverse) -- r, d, k end function xml.collected(root,pattern,reverse) -- e - local collected = parse_apply({ root },pattern) + local collected = applylpath(root,pattern) if collected then if reverse then return wrap(function() for c=#collected,1,-1 do yield(collected[c]) end end) @@ -1257,3 +1327,12 @@ function xml.collected(root,pattern,reverse) -- e end return wrap(function() end) end + +-- handy + +function xml.inspect(collection,pattern) + pattern = pattern or "." + for e in xml.collected(collection,pattern or ".") do + report_lpath("pattern %q\n\n%s\n",pattern,xml.tostring(e)) + end +end diff --git a/Master/texmf-dist/tex/context/base/lxml-mis.lua b/Master/texmf-dist/tex/context/base/lxml-mis.lua index 9fd4270af4a..94a26b97414 100644 --- a/Master/texmf-dist/tex/context/base/lxml-mis.lua +++ b/Master/texmf-dist/tex/context/base/lxml-mis.lua @@ -6,10 +6,16 @@ if not modules then modules = { } end modules ['lxml-mis'] = { license = "see context related readme files" } +local xml, lpeg, string = xml, lpeg, string + local concat = table.concat local type, next, tonumber, tostring, setmetatable, loadstring = type, next, tonumber, tostring, setmetatable, loadstring local format, gsub, match = string.format, string.gsub, string.match -local lpegmatch = lpeg.match +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns +local P, S, R, C, V, Cc, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.Cc, lpeg.Cs + +lpegpatterns.xml = lpegpatterns.xml or { } +local xmlpatterns = lpegpatterns.xml --[[ldx--

The following helper functions best belong to the lxml-ini @@ -35,7 +41,7 @@ end --~ xml.gsub = xmlgsub -function xml.strip_leading_spaces(dk,d,k) -- cosmetic, for manual +function xml.stripleadingspaces(dk,d,k) -- cosmetic, for manual if d and k then local dkm = d[k-1] if dkm and type(dkm) == "string" then @@ -52,8 +58,6 @@ end --~ function xml.unescaped(str) return (gsub(str,"(&.-;)", xml.unescapes)) end --~ function xml.cleansed (str) return (gsub(str,"<.->" , '' )) end -- "%b<>" -local P, S, R, C, V, Cc, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.Cc, lpeg.Cs - -- 100 * 2500 * "oeps< oeps> oeps&" : gsub:lpeg|lpeg|lpeg -- -- 1021:0335:0287:0247 @@ -78,9 +82,9 @@ local unescaped = Cs(normal * (special * normal)^0) local cleansed = Cs(((P("<") * (1-P(">"))^0 * P(">"))/"" + 1)^0) -xml.escaped_pattern = escaped -xml.unescaped_pattern = unescaped -xml.cleansed_pattern = cleansed +xmlpatterns.escaped = escaped +xmlpatterns.unescaped = unescaped +xmlpatterns.cleansed = cleansed function xml.escaped (str) return lpegmatch(escaped,str) end function xml.unescaped(str) return lpegmatch(unescaped,str) end diff --git a/Master/texmf-dist/tex/context/base/lxml-sor.lua b/Master/texmf-dist/tex/context/base/lxml-sor.lua index e220bfad616..a159fd4e00f 100644 --- a/Master/texmf-dist/tex/context/base/lxml-sor.lua +++ b/Master/texmf-dist/tex/context/base/lxml-sor.lua @@ -10,6 +10,8 @@ local format, concat = string.format, table.concat local lpegmatch = lpeg.match local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes +local xml, lxml = xml, lxml + lxml.sorters = lxml.sorters or { } if not lxml.splitid then diff --git a/Master/texmf-dist/tex/context/base/lxml-sor.mkiv b/Master/texmf-dist/tex/context/base/lxml-sor.mkiv index 14425967bd9..a3fc83dd128 100644 --- a/Master/texmf-dist/tex/context/base/lxml-sor.mkiv +++ b/Master/texmf-dist/tex/context/base/lxml-sor.mkiv @@ -19,11 +19,11 @@ \unprotect -\def\xmlresetsorter #1{\ctxlua{lxml.sorters.reset("#1")}} -\def\xmladdsortentry#1#2#3{\ctxlua{lxml.sorters.add("#1","#2",\!!bs#3\!!es)}} -\def\xmlshowsorter #1{\ctxlua{lxml.sorters.show("#1")}} -\def\xmlflushsorter #1#2{\ctxlua{lxml.sorters.flush("#1","#2")}} -\def\xmlsortentries #1{\ctxlua{lxml.sorters.sort("#1")}} +\def\xmlresetsorter #1{\ctxlxml{sorters.reset("#1")}} +\def\xmladdsortentry#1#2#3{\ctxlxml{sorters.add("#1","#2",\!!bs#3\!!es)}} +\def\xmlshowsorter #1{\ctxlxml{sorters.show("#1")}} +\def\xmlflushsorter #1#2{\ctxlxml{sorters.flush("#1","#2")}} +\def\xmlsortentries #1{\ctxlxml{sorters.sort("#1")}} \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/lxml-tab.lua b/Master/texmf-dist/tex/context/base/lxml-tab.lua index 23cd1cf0471..7d38a8d5abc 100644 --- a/Master/texmf-dist/tex/context/base/lxml-tab.lua +++ b/Master/texmf-dist/tex/context/base/lxml-tab.lua @@ -12,6 +12,8 @@ if not modules then modules = { } end modules ['lxml-tab'] = { local trace_entities = false trackers.register("xml.entities", function(v) trace_entities = v end) +local report_xml = logs and logs.reporter("xml","core") or function(...) print(format(...)) end + --[[ldx--

The parser used here is inspired by the variant discussed in the lua book, but handles comment and processing instructions, has a different structure, provides @@ -22,9 +24,14 @@ The find based parser can be found in l-xml-edu.lua along with other older code.

Beware, the interface may change. For instance at, ns, tg, dt may get more verbose names. Once the code is stable we will also remove some tracing and optimize the code.

+ +

I might even decide to reimplement the parser using the latest trickery +as the current variant was written when showed up and it's easier now to +build tables in one go.

--ldx]]-- xml = xml or { } +local xml = xml --~ local xml = xml @@ -150,7 +157,7 @@ local dcache, hcache, acache = { }, { }, { } local mt = { } -function initialize_mt(root) +local function initialize_mt(root) mt = { __index = root } -- will be redefined later end @@ -158,8 +165,8 @@ function xml.setproperty(root,k,v) getmetatable(root).__index[k] = v end -function xml.check_error(top,toclose) - return "" +function xml.checkerror(top,toclose) + return "" -- can be set end local function add_attribute(namespace,tag,value) @@ -215,9 +222,9 @@ local function add_end(spacing, namespace, tag) local toclose = remove(stack) top = stack[#stack] if #stack < 1 then - errorstr = format("nothing to close with %s %s", tag, xml.check_error(top,toclose) or "") + errorstr = format("nothing to close with %s %s", tag, xml.checkerror(top,toclose) or "") elseif toclose.tg ~= tag then -- no namespace check - errorstr = format("unable to close %s with %s %s", toclose.tg, tag, xml.check_error(top,toclose) or "") + errorstr = format("unable to close %s with %s %s", toclose.tg, tag, xml.checkerror(top,toclose) or "") end dt = top.dt dt[#dt+1] = toclose @@ -254,24 +261,29 @@ local reported_attribute_errors = { } local function attribute_value_error(str) if not reported_attribute_errors[str] then - logs.report("xml","invalid attribute value: %q",str) + report_xml("invalid attribute value: %q",str) reported_attribute_errors[str] = true at._error_ = str end return str end + local function attribute_specification_error(str) if not reported_attribute_errors[str] then - logs.report("xml","invalid attribute specification: %q",str) + report_xml("invalid attribute specification: %q",str) reported_attribute_errors[str] = true at._error_ = str end return str end -function xml.unknown_dec_entity_format(str) return (str == "" and "&error;") or format("&%s;",str) end -function xml.unknown_hex_entity_format(str) return format("&#x%s;",str) end -function xml.unknown_any_entity_format(str) return format("&#x%s;",str) end +xml.placeholders = { + unknown_dec_entity = function(str) return (str == "" and "&error;") or format("&%s;",str) end, + unknown_hex_entity = function(str) return format("&#x%s;",str) end, + unknown_any_entity = function(str) return format("&#x%s;",str) end, +} + +local placeholders = xml.placeholders local function fromhex(s) local n = tonumber(s,16) @@ -325,18 +337,18 @@ local function handle_hex_entity(str) h = unify_predefined and predefined_unified[n] if h then if trace_entities then - logs.report("xml","utfize, converting hex entity &#x%s; into %s",str,h) + report_xml("utfize, converting hex entity &#x%s; into %s",str,h) end elseif utfize then - h = (n and utfchar(n)) or xml.unknown_hex_entity_format(str) or "" + h = (n and utfchar(n)) or xml.unknown_hex_entity(str) or "" if not n then - logs.report("xml","utfize, ignoring hex entity &#x%s;",str) + report_xml("utfize, ignoring hex entity &#x%s;",str) elseif trace_entities then - logs.report("xml","utfize, converting hex entity &#x%s; into %s",str,h) + report_xml("utfize, converting hex entity &#x%s; into %s",str,h) end else if trace_entities then - logs.report("xml","found entity &#x%s;",str) + report_xml("found entity &#x%s;",str) end h = "&#x" .. str .. ";" end @@ -352,18 +364,18 @@ local function handle_dec_entity(str) d = unify_predefined and predefined_unified[n] if d then if trace_entities then - logs.report("xml","utfize, converting dec entity &#%s; into %s",str,d) + report_xml("utfize, converting dec entity &#%s; into %s",str,d) end elseif utfize then - d = (n and utfchar(n)) or xml.unknown_dec_entity_format(str) or "" + d = (n and utfchar(n)) or placeholders.unknown_dec_entity(str) or "" if not n then - logs.report("xml","utfize, ignoring dec entity &#%s;",str) + report_xml("utfize, ignoring dec entity &#%s;",str) elseif trace_entities then - logs.report("xml","utfize, converting dec entity &#%s; into %s",str,h) + report_xml("utfize, converting dec entity &#%s; into %s",str,h) end else if trace_entities then - logs.report("xml","found entity &#%s;",str) + report_xml("found entity &#%s;",str) end d = "&#" .. str .. ";" end @@ -388,20 +400,21 @@ local function handle_any_entity(str) end if a then if trace_entities then - logs.report("xml","resolved entity &%s; -> %s (internal)",str,a) + report_xml("resolved entity &%s; -> %s (internal)",str,a) end a = lpegmatch(parsedentity,a) or a else - if xml.unknown_any_entity_format then - a = xml.unknown_any_entity_format(str) or "" + local unknown_any_entity = placeholders.unknown_any_entity + if unknown_any_entity then + a = unknown_any_entity(str) or "" end if a then if trace_entities then - logs.report("xml","resolved entity &%s; -> %s (external)",str,a) + report_xml("resolved entity &%s; -> %s (external)",str,a) end else if trace_entities then - logs.report("xml","keeping entity &%s;",str) + report_xml("keeping entity &%s;",str) end if str == "" then a = "&error;" @@ -413,7 +426,7 @@ local function handle_any_entity(str) acache[str] = a elseif trace_entities then if not acache[str] then - logs.report("xml","converting entity &%s; into %s",str,a) + report_xml("converting entity &%s; into %s",str,a) acache[str] = a end end @@ -422,7 +435,7 @@ local function handle_any_entity(str) local a = acache[str] if not a then if trace_entities then - logs.report("xml","found entity &%s;",str) + report_xml("found entity &%s;",str) end a = resolve_predefined and predefined_simplified[str] if a then @@ -441,7 +454,7 @@ local function handle_any_entity(str) end local function handle_end_entity(chr) - logs.report("xml","error in entity, %q found instead of ';'",chr) + report_xml("error in entity, %q found instead of ';'",chr) end local space = S(' \r\n\t') @@ -576,7 +589,7 @@ local function xmlconvert(data, settings) resolve_predefined = settings.resolve_predefined_entities -- in case we have escaped entities unify_predefined = settings.unify_predefined_entities -- & -> & cleanup = settings.text_cleanup - stack, top, at, xmlns, errorstr, result, entities = { }, { }, { }, { }, nil, nil, settings.entities or { } + stack, top, at, xmlns, errorstr, entities = { }, { }, { }, { }, nil, settings.entities or { } acache, hcache, dcache = { }, { }, { } -- not stored reported_attribute_errors = { } if settings.parent_root then @@ -604,16 +617,17 @@ local function xmlconvert(data, settings) else errorstr = "invalid xml file - no text at all" end + local result if errorstr and errorstr ~= "" then result = { dt = { { ns = "", tg = "error", dt = { errorstr }, at={ }, er = true } } } setmetatable(stack, mt) - local error_handler = settings.error_handler - if error_handler == false then + local errorhandler = settings.error_handler + if errorhandler == false then -- no error message else - error_handler = error_handler or xml.error_handler - if error_handler then - xml.error_handler("load",errorstr) + errorhandler = errorhandler or xml.errorhandler + if errorhandler then + xml.errorhandler("load",errorstr) end end else @@ -673,7 +687,7 @@ function xml.is_valid(root) return root and not root.error end -xml.error_handler = (logs and logs.report) or (input and logs.report) or print +xml.errorhandler = report --[[ldx--

We cannot load an from a filehandle so we need to load @@ -784,7 +798,7 @@ local function verbose_element(e,handlers) ats[#ats+1] = format('%s=%q',k,v) end end - if ern and trace_remap and ern ~= ens then + if ern and trace_entities and ern ~= ens then ens = ern end if ens ~= "" then @@ -889,7 +903,7 @@ local function serialize(e,handlers,...) -- elseif type(e) == "string" then -- functions["@tx@"](e,handlers) else - functions["@dc@"](e,handlers) + functions["@dc@"](e,handlers) -- dc ? end if finalize then return finalize() @@ -915,7 +929,7 @@ local function newhandlers(settings) if settings then for k,v in next, settings do if type(v) == "table" then - tk = t[k] if not tk then tk = { } t[k] = tk end + local tk = t[k] if not tk then tk = { } t[k] = tk end for kk,vv in next, v do tk[kk] = vv end @@ -927,6 +941,7 @@ local function newhandlers(settings) handlers[settings.name] = t end end + utilities.storage.mark(t) return t end @@ -1026,7 +1041,7 @@ local function xmltext(root) -- inline return (root and xmltostring(root)) or "" end -function initialize_mt(root) +initialize_mt = function(root) -- redefinition mt = { __tostring = xmltext, __index = root } end @@ -1171,4 +1186,5 @@ function xml.makestandalone(root) end end end + return root end diff --git a/Master/texmf-dist/tex/context/base/lxml-tex.lua b/Master/texmf-dist/tex/context/base/lxml-tex.lua index aaa90217fec..26a8b29962e 100644 --- a/Master/texmf-dist/tex/context/base/lxml-tex.lua +++ b/Master/texmf-dist/tex/context/base/lxml-tex.lua @@ -9,33 +9,30 @@ if not modules then modules = { } end modules ['lxml-tst'] = { local utf = unicode.utf8 local utfchar = utf.char -local concat, insert, remove, gsub, find = table.concat, table.insert, table.remove +local concat, insert, remove = table.concat, table.insert, table.remove local format, sub, gsub, find, gmatch, match = string.format, string.sub, string.gsub, string.find, string.gmatch, string.match local type, next, tonumber, tostring = type, next, tonumber, tostring local lpegmatch = lpeg.match local P, S, C, Cc = lpeg.P, lpeg.S, lpeg.C, lpeg.Cc -if not tex and not tex.sprint then - tex = { - sprint = function(catcodes,...) texio.write(table.concat{...}) end, - print = function(catcodes,...) texio.write(table.concat{...}) end, - write = function( ...) texio.write(table.concat{...}) end, - } - commands = { - writestatus = logs.report - } - resolvers.loadbinfile = function(filename) return true, io.loaddata(filename) end -end +local tex, xml = tex, xml +local lowerchars, upperchars, lettered = characters.lower, characters.upper, characters.lettered + +lxml = lxml or { } +local lxml = lxml local texsprint, texprint, texwrite = tex.sprint, tex.print, tex.write local texcatcodes, ctxcatcodes, vrbcatcodes, notcatcodes = tex.texcatcodes, tex.ctxcatcodes, tex.vrbcatcodes, tex.notcatcodes local xmlelements, xmlcollected, xmlsetproperty = xml.elements, xml.collected, xml.setproperty -local xmlparseapply, xmlwithelements = xml.parse_apply, xml.withelements +local xmlwithelements = xml.withelements local xmlserialize, xmlcollect, xmltext, xmltostring = xml.serialize, xml.collect, xml.text, xml.tostring +local xmlapplylpath = xml.applylpath local variables = (interfaces and interfaces.variables) or { } +local insertbeforevalue, insertaftervalue = utilities.tables.insertbeforevalue, utilities.tables.insertaftervalue + local starttiming, stoptiming = statistics.starttiming, statistics.stoptiming local trace_setups = false trackers.register("lxml.setups", function(v) trace_setups = v end) @@ -43,9 +40,9 @@ local trace_loading = false trackers.register("lxml.loading", function(v) tra local trace_access = false trackers.register("lxml.access", function(v) trace_access = v end) local trace_comments = false trackers.register("lxml.comments", function(v) trace_comments = v end) -lxml = lxml or { } -lxml.loaded = lxml.loaded or { } +local report_lxml = logs.reporter("xml","tex") +lxml.loaded = lxml.loaded or { } local loaded = lxml.loaded -- print(contextdirective("context-mathml-directive function reduction yes ")) @@ -75,14 +72,14 @@ local xmltextcapture = ( space^0 * newline^2 * Cc("") / texprint + -- better ^-2 ? space^0 * newline * space^0 * Cc(" ") / texsprint + content / function(str) return texsprint(notcatcodes,str) end + -- was just texsprint, current catcodes regime is notcatcodes - entity / xml.resolved_entity + entity / xml.resolvedentity )^0 local ctxtextcapture = ( space^0 * newline^2 * Cc("") / texprint + -- better ^-2 ? space^0 * newline * space^0 * Cc(" ") / texsprint + content / function(str) return texsprint(ctxcatcodes,str) end + -- was just texsprint, current catcodes regime is notcatcodes - entity / xml.resolved_entity + entity / xml.resolvedentity )^0 local forceraw, rawroot = false, nil @@ -137,23 +134,23 @@ local function toverbatim(str) if aftercommand then texsprint(texcatcodes,aftercommand,"{}") end end -function lxml.set_verbatim(before,after,obeyedline,obeyedspace) +function lxml.setverbatim(before,after,obeyedline,obeyedspace) beforecommand, aftercommand, linecommand, spacecommand = before, after, obeyedline, obeyedspace end local obeycdata = true -function lxml.set_cdata() +function lxml.setcdata() obeycdata = true end -function lxml.reset_cdata() +function lxml.resetcdata() obeycdata = false end -- cdata and verbatim -lxml.set_verbatim("\\xmlcdatabefore", "\\xmlcdataafter", "\\xmlcdataobeyedline", "\\xmlcdataobeyedspace") +lxml.setverbatim("\\xmlcdatabefore", "\\xmlcdataafter", "\\xmlcdataobeyedline", "\\xmlcdataobeyedspace") -- local capture = (space^0*newline)^0 * capture * (space+newline)^0 * -1 @@ -189,7 +186,7 @@ function lxml.splitid(id) end end -local function get_id(id, qualified) +local function getid(id, qualified) if id then local lid = loaded[id] if lid then @@ -211,25 +208,25 @@ local function get_id(id, qualified) return root end elseif trace_access then - logs.report("lxml","'%s' has no index entry '%s'",d,i) + report_lxml("'%s' has no index entry '%s'",d,i) end elseif trace_access then - logs.report("lxml","'%s' has no index",d) + report_lxml("'%s' has no index",d) end elseif trace_access then - logs.report("lxml","'%s' is not loaded",d) + report_lxml("'%s' is not loaded",d) end elseif trace_access then - logs.report("lxml","'%s' is not loaded",i) + report_lxml("'%s' is not loaded",i) end end elseif trace_access then - logs.report("lxml","invalid id (nil)") + report_lxml("invalid id (nil)") end end -lxml.id = get_id -lxml.get_id = get_id +lxml.id = getid -- we provide two names as locals can already use such +lxml.getid = getid -- names and we don't want clashes function lxml.root(id) return loaded[id] @@ -240,7 +237,7 @@ end local nofindices = 0 local function addindex(name,check_sum,force) - local root = get_id(name) + local root = getid(name) if root and (not root.index or force) then -- weird, only called once local n, index, maxindex, check = 0, root.index or { }, root.maxindex or 0, root.check or { } local function nest(root) @@ -270,7 +267,7 @@ local function addindex(name,check_sum,force) root.index = index root.maxindex = maxindex if trace_access then - logs.report("lxml","%s indexed, %s nodes",tostring(name),maxindex) + report_lxml("%s indexed, %s nodes",tostring(name),maxindex) end end end @@ -279,27 +276,27 @@ lxml.addindex = addindex -- another cache -local function lxmlparseapply(id,pattern) -- better inline, saves call - return xmlparseapply({ get_id(id) }, pattern) +local function lxmlapplylpath(id,pattern) -- better inline, saves call + return xmlapplylpath(getid(id),pattern) end -lxml.filter = lxmlparseapply +lxml.filter = lxmlapplylpath function lxml.filterlist(list,pattern) for s in gmatch(list,"[^, ]+") do -- we could cache a table - lxmlparseapply(s,pattern) + xmlapplylpath(getid(s),pattern) end end -lxml["function"] = function(id,name) +function lxml.applyfunction(id,name) local f = xml.functions[name] - return f and f(get_id(id)) + return f and f(getid(id)) end -- rather new, indexed storage (backward refs), maybe i will merge this function lxml.checkindex(name) - local root = get_id(name) + local root = getid(name) return (root and root.index) or 0 end @@ -359,12 +356,14 @@ end function lxml.load(id,filename,compress,entities) filename = commands.preparedfile(filename) if trace_loading then - commands.writestatus("lxml","loading file '%s' as '%s'",filename,id) + report_lxml("loading file '%s' as '%s'",filename,id) end noffiles, nofconverted = noffiles + 1, nofconverted + 1 -- local xmltable = xml.load(filename) + starttiming(xml) local ok, data = resolvers.loadbinfile(filename) local xmltable = lxml.convert(id,(ok and data) or "",compress,entities) + stoptiming(xml) lxml.store(id,xmltable,filename) return xmltable, filename end @@ -376,7 +375,7 @@ end function lxml.include(id,pattern,attribute,recurse) starttiming(xml) - local root = get_id(id) + local root = getid(id) xml.include(root,pattern,attribute,recurse,function(filename) if filename then filename = commands.preparedfile(filename) @@ -387,7 +386,7 @@ function lxml.include(id,pattern,attribute,recurse) end end if trace_loading then - commands.writestatus("lxml","including file: %s",filename) + report_lxml("including file: %s",filename) end noffiles, nofconverted = noffiles + 1, nofconverted + 1 return resolvers.loadtexfile(filename) or "" @@ -403,7 +402,8 @@ function xml.getbuffer(name,compress,entities) -- we need to make sure that comm name = tex.jobname end nofconverted = nofconverted + 1 - xmltostring(lxml.convert(name,concat(buffers.data[name] or {},""),compress,entities)) + local data = buffers.getcontent(name) + xmltostring(lxml.convert(name,data,compress,entities)) -- one buffer end function lxml.loadbuffer(id,name,compress,entities) @@ -412,7 +412,8 @@ function lxml.loadbuffer(id,name,compress,entities) end starttiming(xml) nofconverted = nofconverted + 1 - local xmltable = lxml.convert(id,buffers.collect(name or id,"\n"),compress,entities) + local data = buffers.getcontent(name or id) + local xmltable = lxml.convert(id,data,compress,entities) lxml.store(id,xmltable) stoptiming(xml) return xmltable, name or id @@ -444,7 +445,7 @@ end local function tex_comment(e,handlers) if trace_comments then - logs.report("lxml","comment: %s",e.dt[1]) + report_lxml("comment: %s",e.dt[1]) end end @@ -470,7 +471,7 @@ local function tex_element(e,handlers) end texsprint(ctxcatcodes,"\\xmlw{",command,"}{",rootname,"::",ix,"}") else - logs.report("lxml", "fatal error: no index for '%s'",command) + report_lxml( "fatal error: no index for '%s'",command) texsprint(ctxcatcodes,"\\xmlw{",command,"}{",ix or 0,"}") end elseif tc == "function" then @@ -481,17 +482,16 @@ end local pihandlers = { } xml.pihandlers = pihandlers -local kind = P("context-") * C((1-P("-"))^1) * P("-directive") -local space = S(" \n\r") -local spaces = space^0 -local class = C((1-space)^0) -local key = class -local value = C(P(1-(space * -1))^0) +local category = P("context-") * C((1-P("-"))^1) * P("-directive") +local space = S(" \n\r") +local spaces = space^0 +local class = C((1-space)^0) +local key = class +local value = C(P(1-(space * -1))^0) -local parser = kind * spaces * class * spaces * key * spaces * value +local parser = category * spaces * class * spaces * key * spaces * value pihandlers[#pihandlers+1] = function(str) --- local kind, class, key, value = lpegmatch(parser,str) if str then local a, b, c, d = lpegmatch(parser,str) if d then @@ -522,7 +522,7 @@ local function ctx_text(e) end local function tex_handle(...) --- logs.report("lxml", "error while flushing: %s", concat { ... }) +-- report_lxml( "error while flushing: %s", concat { ... }) texsprint(...) -- notcatcodes is active anyway end @@ -548,7 +548,7 @@ function lxml.serialize(root) end function lxml.setaction(id,pattern,action) - local collected = lxmlparseapply(id,pattern) + local collected = xmlapplylpath(getid(id),pattern) if collected then for c=1,#collected do collected[c].command = action @@ -614,7 +614,7 @@ xml.cprint = cprint local xmlcprint = cprint -- now we can flush function lxml.main(id) - xmlserialize(get_id(id),xmltexhandler) -- the real root (@rt@) + xmlserialize(getid(id),xmltexhandler) -- the real root (@rt@) end --~ -- lines (untested) @@ -670,12 +670,12 @@ end local setups = { } -function lxml.set_command_to_text(id) - xmlwithelements(get_id(id),to_text) +function lxml.setcommandtotext(id) + xmlwithelements(getid(id),to_text) end -function lxml.set_command_to_none(id) - xmlwithelements(get_id(id),to_none) +function lxml.setcommandtonone(id) + xmlwithelements(getid(id),to_none) end function lxml.installsetup(what,document,setup,where) @@ -687,24 +687,24 @@ function lxml.installsetup(what,document,setup,where) end if what == 1 then if trace_loading then - commands.writestatus("lxml","prepending setup %s for %s",setup,document) + report_lxml("prepending setup %s for %s",setup,document) end insert(sd,1,setup) elseif what == 2 then if trace_loading then - commands.writestatus("lxml","appending setup %s for %s",setup,document) + report_lxml("appending setup %s for %s",setup,document) end insert(sd,setup) elseif what == 3 then if trace_loading then - commands.writestatus("lxml","inserting setup %s for %s before %s",setup,document,where) + report_lxml("inserting setup %s for %s before %s",setup,document,where) end - table.insert_before_value(sd,setup,where) + insertbeforevalue(sd,setup,where) elseif what == 4 then if trace_loading then - commands.writestatus("lxml","inserting setup %s for %s after %s",setup,document,where) + report_lxml("inserting setup %s for %s after %s",setup,document,where) end - table.insert_after_value(sd,setup,where) + insertaftervalue(sd,setup,where) end end @@ -718,21 +718,21 @@ function lxml.flushsetups(id,...) local v= sd[k] if not done[v] then if trace_loading then - commands.writestatus("lxml","applying setup %02i = %s to %s",k,v,document) + report_lxml("applying setup %02i = %s to %s",k,v,document) end texsprint(ctxcatcodes,"\\xmlsetup{",id,"}{",v,"}") done[v] = true end end elseif trace_loading then - commands.writestatus("lxml","no setups for %s",document) + report_lxml("no setups for %s",document) end end end function lxml.resetsetups(document) if trace_loading then - commands.writestatus("lxml","resetting all setups for %s",document) + report_lxml("resetting all setups for %s",document) end setups[document] = { } end @@ -743,7 +743,7 @@ function lxml.removesetup(document,setup) for i=1,#s do if s[i] == setup then if trace_loading then - commands.writestatus("lxml","removing setup %s for %s",setup,document) + report_lxml("removing setup %s for %s",setup,document) end remove(t,i) break @@ -754,7 +754,7 @@ end function lxml.setsetup(id,pattern,setup) if not setup or setup == "" or setup == "*" or setup == "-" or setup == "+" then - local collected = lxmlparseapply(id,pattern) + local collected = xmlapplylpath(getid(id),pattern) if collected then if trace_setups then for c=1, #collected do @@ -762,19 +762,19 @@ function lxml.setsetup(id,pattern,setup) local ix = e.ix or 0 if setup == "-" then e.command = false - logs.report("lxml","lpath matched (a) %5i: %s = %s -> skipped",c,ix,setup) + report_lxml("lpath matched (a) %5i: %s = %s -> skipped",c,ix,setup) elseif setup == "+" then e.command = true - logs.report("lxml","lpath matched (b) %5i: %s = %s -> text",c,ix,setup) + report_lxml("lpath matched (b) %5i: %s = %s -> text",c,ix,setup) else local tg = e.tg if tg then -- to be sure e.command = tg local ns = e.rn or e.ns if ns == "" then - logs.report("lxml","lpath matched (c) %5i: %s = %s -> %s",c,ix,tg,tg) + report_lxml("lpath matched (c) %5i: %s = %s -> %s",c,ix,tg,tg) else - logs.report("lxml","lpath matched (d) %5i: %s = %s:%s -> %s",c,ix,ns,tg,tg) + report_lxml("lpath matched (d) %5i: %s = %s:%s -> %s",c,ix,ns,tg,tg) end end end @@ -792,12 +792,12 @@ function lxml.setsetup(id,pattern,setup) end end elseif trace_setups then - logs.report("lxml","no lpath matches for %s",pattern) + report_lxml("no lpath matches for %s",pattern) end else local a, b = match(setup,"^(.+:)([%*%-])$") if a and b then - local collected = lxmlparseapply(id,pattern) + local collected = xmlapplylpath(getid(id),pattern) if collected then if trace_setups then for c=1, #collected do @@ -806,23 +806,23 @@ function lxml.setsetup(id,pattern,setup) if b == "-" then e.command = false if ns == "" then - logs.report("lxml","lpath matched (e) %5i: %s = %s -> skipped",c,ix,tg) + report_lxml("lpath matched (e) %5i: %s = %s -> skipped",c,ix,tg) else - logs.report("lxml","lpath matched (f) %5i: %s = %s:%s -> skipped",c,ix,ns,tg) + report_lxml("lpath matched (f) %5i: %s = %s:%s -> skipped",c,ix,ns,tg) end elseif b == "+" then e.command = true if ns == "" then - logs.report("lxml","lpath matched (g) %5i: %s = %s -> text",c,ix,tg) + report_lxml("lpath matched (g) %5i: %s = %s -> text",c,ix,tg) else - logs.report("lxml","lpath matched (h) %5i: %s = %s:%s -> text",c,ix,ns,tg) + report_lxml("lpath matched (h) %5i: %s = %s:%s -> text",c,ix,ns,tg) end else e.command = a .. tg if ns == "" then - logs.report("lxml","lpath matched (i) %5i: %s = %s -> %s",c,ix,tg,e.command) + report_lxml("lpath matched (i) %5i: %s = %s -> %s",c,ix,tg,e.command) else - logs.report("lxml","lpath matched (j) %5i: %s = %s:%s -> %s",c,ix,ns,tg,e.command) + report_lxml("lpath matched (j) %5i: %s = %s:%s -> %s",c,ix,ns,tg,e.command) end end end @@ -839,10 +839,10 @@ function lxml.setsetup(id,pattern,setup) end end elseif trace_setups then - logs.report("lxml","no lpath matches for %s",pattern) + report_lxml("no lpath matches for %s",pattern) end else - local collected = lxmlparseapply(id,pattern) + local collected = xmlapplylpath(getid(id),pattern) if collected then if trace_setups then for c=1, #collected do @@ -850,9 +850,9 @@ function lxml.setsetup(id,pattern,setup) e.command = setup local ns, tg, ix = e.rn or e.ns, e.tg, e.ix or 0 if ns == "" then - logs.report("lxml","lpath matched (k) %5i: %s = %s -> %s",c,ix,tg,setup) + report_lxml("lpath matched (k) %5i: %s = %s -> %s",c,ix,tg,setup) else - logs.report("lxml","lpath matched (l) %5i: %s = %s:%s -> %s",c,ix,ns,tg,setup) + report_lxml("lpath matched (l) %5i: %s = %s:%s -> %s",c,ix,ns,tg,setup) end end else @@ -861,7 +861,7 @@ function lxml.setsetup(id,pattern,setup) end end elseif trace_setups then - logs.report("lxml","no lpath matches for %s",pattern) + report_lxml("no lpath matches for %s",pattern) end end end @@ -917,7 +917,8 @@ local function position(collected,n) end local function match(collected) -- is match in preceding collected, never change, see bibxml - texwrite((collected and collected[1].mi) or 0) + local m = collected and collected[1] + texwrite(m and m.mi or 0) end local function index(collected,n) @@ -932,9 +933,10 @@ local function index(collected,n) end end -local function command(collected,cmd) - if collected then - for c=1,#collected do +local function command(collected,cmd,otherwise) + local n = collected and #collected + if n and n > 0 then + for c=1,n do local e = collected[c] local ix = e.ix if not ix then @@ -943,6 +945,8 @@ local function command(collected,cmd) end texsprint(ctxcatcodes,"\\xmlw{",cmd,"}{",e.name,"::",ix,"}") end + elseif otherwise then + texsprint(ctxcatcodes,"\\xmlw{",otherwise,"}{#1}") end end @@ -995,7 +999,19 @@ local function ctxtext(collected) end end -local lowerchars, upperchars = characters.lower, characters.upper +--~ local str = xmltext(getid(id),pattern) or "" +--~ str = gsub(str,"^%s*(.-)%s*$","%1") +--~ if nolines then +--~ str = gsub(str,"%s+"," ") +--~ end + +local function stripped(collected) -- tricky as we strip in place + if collected then + for c=1,#collected do + cprint(xml.stripelement(collected[c])) + end + end +end local function lower(collected) if collected then @@ -1059,6 +1075,7 @@ finalizers.count = count finalizers.command = command finalizers.attribute = attribute finalizers.text = text +finalizers.stripped = stripped finalizers.lower = lower finalizers.upper = upper finalizers.ctxtext = ctxtext @@ -1126,7 +1143,7 @@ end -- local function verbatim(id,before,after) - local root = get_id(id) + local root = getid(id) if root then if before then texsprint(ctxcatcodes,before,"[",root.tg or "?","]") end lxml.toverbatim(xmltostring(root.dt)) @@ -1145,21 +1162,21 @@ lxml.verbatim = verbatim -- helpers function lxml.first(id,pattern) - local collected = lxmlparseapply(id,pattern) + local collected = xmlapplylpath(getid(id),pattern) if collected then first(collected) end end function lxml.last(id,pattern) - local collected = lxmlparseapply(id,pattern) + local collected = xmlapplylpath(getid(id),pattern) if collected then last(collected) end end function lxml.all(id,pattern) - local collected = lxmlparseapply(id,pattern) + local collected = xmlapplylpath(getid(id),pattern) if collected then all(collected) end @@ -1167,18 +1184,18 @@ end function lxml.count(id,pattern) -- always needs to produce a result so no test here - count(lxmlparseapply(id,pattern)) + count(xmlapplylpath(getid(id),pattern)) end function lxml.attribute(id,pattern,a,default) - local collected = lxmlparseapply(id,pattern) + local collected = xmlapplylpath(getid(id),pattern) if collected then attribute(collected,a,default) end end function lxml.raw(id,pattern) -- the content, untouched by commands - local collected = (pattern and lxmlparseapply(id,pattern)) or get_id(id) + local collected = (pattern and xmlapplylpath(getid(id),pattern)) or getid(id) if collected then texsprint(xmltostring(collected[1].dt)) end @@ -1186,11 +1203,11 @@ end function lxml.context(id,pattern) -- the content, untouched by commands if not pattern then - local collected = get_id(id) + local collected = getid(id) -- texsprint(ctxcatcodes,collected.dt[1]) ctx_text(collected.dt[1]) else - local collected = lxmlparseapply(id,pattern) or get_id(id) + local collected = xmlapplylpath(getid(id),pattern) or getid(id) if collected and #collected > 0 then texsprint(ctxcatcodes,collected[1].dt) end @@ -1198,7 +1215,7 @@ function lxml.context(id,pattern) -- the content, untouched by commands end function lxml.text(id,pattern) - local collected = (pattern and lxmlparseapply(id,pattern)) or get_id(id) + local collected = (pattern and xmlapplylpath(getid(id),pattern)) or getid(id) if collected then text(collected) end @@ -1207,40 +1224,40 @@ end lxml.content = text function lxml.position(id,pattern,n) - local collected = lxmlparseapply(id,pattern) + local collected = xmlapplylpath(getid(id),pattern) if collected then position(collected,n) end end function lxml.chainattribute(id,pattern,a,default) - local collected = lxmlparseapply(id,pattern) + local collected = xmlapplylpath(getid(id),pattern) if collected then chainattribute(collected,a,default) end end function lxml.concatrange(id,pattern,start,stop,separator,lastseparator,textonly) -- test this on mml - concatrange(lxmlparseapply(id,pattern),start,stop,separator,lastseparator,textonly) + concatrange(xmlapplylpath(getid(id),pattern),start,stop,separator,lastseparator,textonly) end function lxml.concat(id,pattern,separator,lastseparator,textonly) - concatrange(lxmlparseapply(id,pattern),false,false,separator,lastseparator,textonly) + concatrange(xmlapplylpath(getid(id),pattern),false,false,separator,lastseparator,textonly) end function lxml.element(id,n) - position(lxmlparseapply(id,"/*"),n) + position(xmlapplylpath(getid(id),"/*"),n) end lxml.index = lxml.position function lxml.pos(id) - local root = get_id(id) + local root = getid(id) texwrite((root and root.ni) or 0) end function lxml.att(id,a,default) - local root = get_id(id) + local root = getid(id) if root then local at = root.at local str = (at and at[a]) or default @@ -1253,7 +1270,7 @@ function lxml.att(id,a,default) end function lxml.name(id) -- or remapped name? -> lxml.info, combine - local r = get_id(id) + local r = getid(id) local ns = r.rn or r.ns or "" if ns ~= "" then texsprint(ns,":",r.tg) @@ -1263,20 +1280,20 @@ function lxml.name(id) -- or remapped name? -> lxml.info, combine end function lxml.match(id) -- or remapped name? -> lxml.info, combine - texsprint(get_id(id).mi or 0) + texsprint(getid(id).mi or 0) end function lxml.tag(id) -- tag vs name -> also in l-xml tag->name - texsprint(get_id(id).tg or "") + texsprint(getid(id).tg or "") end function lxml.namespace(id) -- or remapped name? - local root = get_id(id) + local root = getid(id) texsprint(root.rn or root.ns or "") end function lxml.flush(id) - id = get_id(id) + id = getid(id) local dt = id and id.dt if dt then xmlsprint(dt) @@ -1284,7 +1301,7 @@ function lxml.flush(id) end function lxml.snippet(id,i) - local e = get_id(id) + local e = getid(id) if e then local edt = e.dt if edt then @@ -1294,12 +1311,12 @@ function lxml.snippet(id,i) end function lxml.direct(id) - xmlsprint(get_id(id)) + xmlsprint(getid(id)) end function lxml.command(id,pattern,cmd) - local i, p = get_id(id,true) - local collected = lxmlparseapply(i,pattern) + local i, p = getid(id,true) + local collected = xmlapplylpath(getid(i),pattern) if collected then local rootname = p or i.name for c=1,#collected do @@ -1317,11 +1334,11 @@ end -- loops function lxml.collected(id,pattern,reverse) - return xmlcollected(get_id(id),pattern,reverse) + return xmlcollected(getid(id),pattern,reverse) end function lxml.elements(id,pattern,reverse) - return xmlelements(get_id(id),pattern,reverse) + return xmlelements(getid(id),pattern,reverse) end -- obscure ones @@ -1334,16 +1351,16 @@ local found, empty = xml.found, xml.empty local doif, doifnot, doifelse = commands.doif, commands.doifnot, commands.doifelse -function lxml.doif (id,pattern) doif (found(get_id(id),pattern)) end -function lxml.doifnot (id,pattern) doifnot (found(get_id(id),pattern)) end -function lxml.doifelse (id,pattern) doifelse(found(get_id(id),pattern)) end -function lxml.doiftext (id,pattern) doif (not empty(get_id(id),pattern)) end -function lxml.doifnottext (id,pattern) doifnot (not empty(get_id(id),pattern)) end -function lxml.doifelsetext (id,pattern) doifelse(not empty(get_id(id),pattern)) end +function lxml.doif (id,pattern) doif (found(getid(id),pattern)) end +function lxml.doifnot (id,pattern) doifnot (found(getid(id),pattern)) end +function lxml.doifelse (id,pattern) doifelse(found(getid(id),pattern)) end +function lxml.doiftext (id,pattern) doif (not empty(getid(id),pattern)) end +function lxml.doifnottext (id,pattern) doifnot (not empty(getid(id),pattern)) end +function lxml.doifelsetext (id,pattern) doifelse(not empty(getid(id),pattern)) end -- special case: "*" and "" -> self else lpath lookup ---~ function lxml.doifelseempty(id,pattern) doifelse(isempty(get_id(id),pattern ~= "" and pattern ~= nil)) end -- not yet done, pattern +--~ function lxml.doifelseempty(id,pattern) doifelse(isempty(getid(id),pattern ~= "" and pattern ~= nil)) end -- not yet done, pattern -- status info @@ -1389,15 +1406,15 @@ end) -- misc function lxml.nonspace(id,pattern) -- slow, todo loop - xmltprint(xmlcollect(get_id(id),pattern,true)) + xmltprint(xmlcollect(getid(id),pattern,true)) end function lxml.strip(id,pattern,nolines,anywhere) - xml.strip(get_id(id),pattern,nolines,anywhere) + xml.strip(getid(id),pattern,nolines,anywhere) end function lxml.stripped(id,pattern,nolines) - local str = xmltext(get_id(id),pattern) or "" + local str = xmltext(getid(id),pattern) or "" str = gsub(str,"^%s*(.-)%s*$","%1") if nolines then str = gsub(str,"%s+"," ") @@ -1406,5 +1423,55 @@ function lxml.stripped(id,pattern,nolines) end function lxml.delete(id,pattern) - xml.delete(get_id(id),pattern) + xml.delete(getid(id),pattern) +end + +lxml.obsolete = { } + +lxml.get_id = getid lxml.obsolete.get_id = getid + +-- goodies: + +function xml.finalizers.tex.lettered(collected) + if collected then + for c=1,#collected do + texsprint(ctxcatcodes,lettered(collected[1].dt[1])) + end + end +end + +--~ function xml.finalizers.tex.apply(collected,what) -- to be tested +--~ if collected then +--~ for c=1,#collected do +--~ texsprint(ctxcatcodes,what(collected[1].dt[1])) +--~ end +--~ end +--~ end + +function lxml.toparameters(id) + local e = getid(id) + if e then + local a = e.at + if a and next(a) then + local setups, s = { }, 0 + for k, v in next, a do + s = s + 1 + setups[s] = k .. "=" .. v + end + setups = concat(setups,",") + -- tracing + context(setups) + end + end +end + +local template = '\n\n\n\n%s' + +function lxml.tofile(id,pattern,filename,comment) + local collected = xmlapplylpath(getid(id),pattern) + if collected then + io.savedata(filename,format(template,comment or "exported fragment",tostring(collected[1]))) + else + os.remove(filename) -- get rid of old content + end end diff --git a/Master/texmf-dist/tex/context/base/lxml-xml.lua b/Master/texmf-dist/tex/context/base/lxml-xml.lua index f791ec0f83f..89fcba871bd 100644 --- a/Master/texmf-dist/tex/context/base/lxml-xml.lua +++ b/Master/texmf-dist/tex/context/base/lxml-xml.lua @@ -6,10 +6,15 @@ if not modules then modules = { } end modules ['lxml-xml'] = { license = "see context related readme files" } +local concat = string.concat + +local xml = xml + local finalizers = xml.finalizers.xml local xmlfilter = xml.filter -- we could inline this one for speed local xmltostring = xml.tostring local xmlserialize = xml.serialize +local xmlcollected = xml.collected local function first(collected) -- wrong ? return collected and collected[1] @@ -23,15 +28,18 @@ local function all(collected) return collected end -local function reverse(collected) - if collected then - local reversed = { } - for c=#collected,1,-1 do - reversed[#reversed+1] = collected[c] - end - return reversed - end -end +--~ local function reverse(collected) +--~ if collected then +--~ local reversed, r = { }, 0 +--~ for c=#collected,1,-1 do +--~ r = r + 1 +--~ reversed[r] = collected[c] +--~ end +--~ return reversed +--~ end +--~ end + +local reverse = table.reversed local function attribute(collected,name) if collected and #collected > 0 then @@ -122,11 +130,12 @@ end local function texts(collected) if collected then - local t = { } + local t, n = { }, 0 for c=1,#collected do - local e = collection[c] + local e = collected[c] if e and e.dt then - t[#t+1] = e.dt + n = n + 1 + t[n] = e.dt end end return t @@ -169,14 +178,15 @@ end local function tags(collected,nonamespace) if collected then - local t = { } + local t, n = { }, 0 for c=1,#collected do local e = collected[c] local ns, tg = e.ns, e.tg + n = n + 1 if nonamespace or ns == "" then - t[#t+1] = tg + t[n] = tg else - t[#t+1] = ns .. ":" .. tg + t[n] = ns .. ":" .. tg end end return t @@ -286,3 +296,37 @@ end xml.all = xml.filter xml.index = xml.position xml.found = xml.filter + +-- a nice one: + +local function totable(x) + local t = { } + for e in xmlcollected(x[1] or x,"/*") do + t[e.tg] = xmltostring(e.dt) or "" + end + return next(t) and t or nil +end + +xml.table = totable +finalizers.table = totable + +local function textonly(e,t) + if e then + local edt = e.dt + if edt then + for i=1,#edt do + local e = edt[i] + if type(e) == "table" then + textonly(e,t) + else + t[#t+1] = e + end + end + end + end + return t +end + +function xml.textonly(e) -- no pattern + return concat(textonly(e,{})) +end diff --git a/Master/texmf-dist/tex/context/base/m-arabtex.mkii b/Master/texmf-dist/tex/context/base/m-arabtex.mkii new file mode 100644 index 00000000000..61e56e93aca --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-arabtex.mkii @@ -0,0 +1,450 @@ +%D \module +%D [ file=m-arabtex, % was font-arb, +%D version=2003.02.22, % 1999.11.06, +%D title=\CONTEXT\ Modules, +%D subtitle=Arabic, +%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. + +% I still need to hook in some features into the setup +% macro. I also have to (re)define farsi etc. in ways +% similar to arab, so that we have dedicated environments. +% +% keywords needed: vocalize transscribe +% +% \startarabic[option=vocalize] % or vocalize=yes +% ...... +% \stoparabic + +\writestatus{loading}{ConTeXt Font Macros / ArabTeX support} + +%D At the \NTG\ 10\high{th} anniversary meeting Klaus Lagally +%D introduced the audience to arabic typesetting, and after +%D that I knew that some day I really had to look into his +%D generic package. And then, sort of simultaniously Maarten +%D Wisse and Imran Ahsan Nyazee asked me if \CONTEXT\ could +%D support \ARABTEX, a package that provides right to left +%D typesetting of (several variants of) arab and hebrew. +%D Having implemented support for chinese a few weeks before, +%D I could not resist to build in support for arab and hebrew +%D too. Writing support for languages that don't give me any +%D cue on how to pronounce their script, is kind of special. + +%D This is a beta version, since I still have to take care of some +%D macros that conflict with existing stuff. + +\unprotect + +\definesystemvariable{ARABTEX} + +\def\setupARABTEX + {\getparameters[\??ARABTEX]} + +\setupARABTEX + [\s!rscale=1.2, + \c!before=, + \c!after=, + \c!inner=\setarab, + \c!style=\setarabicfont\fontstylesuffix] + +%D A few (maybe too) simple hooks into the font mechanism. The +%D hook into the language module is not yet done. + +% \unexpanded\def\setarabicfont#1% rscale +% {\scratchdimen\@@ARABTEXrscale\bodyfontsize +% \font\arbfont\truefontname{Arabic#1} at \currentfontscale\scratchdimen +% \setx@skels +% \newfonttrue +% \arbfont} +% +% more modern +% +% \unexpanded\def\setarabicfont#1% rscale +% {\definefont[arbfont][Arabic#1 sa \@@ARABTEXrscale]% +% \setx@skels +% \newfonttrue +% \arbfont} +% +% more efficient + +\unexpanded\def\setarabicfont#1% + {\setx@skels + \newfonttrue + \definedfont[Arabic#1 sa \ARABTEXparameter\s!rscale]} + +%D Just to be compatible with Arab\TEX\ we define: + +\unexpanded\def\nash {\setarabicfont\s!Regular} +\unexpanded\def\nashbf {\setarabicfont\s!Bold } +\unexpanded\def\pnash {\setarabicfont\s!Regular} +\unexpanded\def\pnashbf{\setarabicfont\s!Bold } +\unexpanded\def\xnash {\setarabicfont\s!Regular} +\unexpanded\def\xnashbf{\setarabicfont\s!Bold } + +%D The display arabic environment (will be an installable +%D object) uses a few conditionals. Let's do it the +%D \CONTEXT\ way and define an anvironment that we later can +%D adapt. + +\newif\if@ignore +\newif\if@endpe + +\def\setupARABTEXalternative[#1]% + {\dodoubleempty\getparameters[\??ARABTEX#1]} + +\def\defineARABTEXalternative + {\dodoubleempty\dodefineARABTEXalternative} + +\def\dodefineARABTEXalternative[#1][#2]% + {\iffirstargument % \startarab is defined but used already + \getparameters + [\??ARABTEX#1] + [\c!before=\@@ARABTEXbefore, + \c!after=\@@ARABTEXafter, + \c!inner=\@@ARABTEXinner, + \c!style=\@@ARABTEXstyle, + \s!rscale=\@@ARABTEXrscale, + #2]% + \setvalue {\e!start#1}{\displayARABTEXalternative{#1}}% + \unexpanded\setvalue{#1}{\inlineARABTEXalternative {#1}}% + \unexpanded\def\RL{\getvalue{#1}}% + \unexpanded\def\LR{\a@LR}% + \let\R=\RL + \let\L=\LR + \expandafter\all@wcmd\csname\e!stop#1\endcsname + \else + \defineARABTEXalternative[arabic]% + \fi} + +\def\initializeARABTEXinternals + {\ARABTEXparameter\c!inner + \the\everyARABTEXpreset} + +\newtoks \everyARABTEXpreset + +\let\currentARABTEXalternative\empty + +\def\ARABTEXparameter#1% + {\csname\??ARABTEX\currentARABTEXalternative#1\endcsname} + +\def\inlineARABTEXalternative#1#2% + {\bgroup + \edef\currentARABTEXalternative{#1}% + \initializeARABTEXinternals + \a@RL{#2}% + \egroup} + +\def\displayARABTEXalternative#1% + {\dodoubleempty\dostartARABTEXalternative[#1]} + +\def\dostartARABTEXalternative[#1][#2]% + {\begingroup + \edef\currentARABTEXalternative{#1}% + \getparameters[\??ARABTEX\currentARABTEXalternative][#2]% + \ifnum1<0\ARABTEXparameter\c!n\relax + \startcolumns + \else + \ARABTEXparameter\c!before + \fi + \initializeARABTEXinternals + \initializeARABTEXend + \arabtext + \initializeARABTEXalternative} + +\def\initializeARABTEXalternative + {\ARABTEXparameter\c!style} + +\def\initializeARABTEXend% \CONTEXT\ does use \end quite differently + {\long\def\end##1% + {\endarabtext + \ifnum1<0\ARABTEXparameter\c!n\relax + \stopcolumns + \else + \ARABTEXparameter\c!after + \fi + \endgroup}% + \let\a@l@end\end + \letvalue{\e!stop\currentARABTEXalternative}=\end + \long\def\end##1% + {\endarabtext + \endgroup + \if@ignore\global\@ignorefalse\expandafter\ignorespaces\fi}} + +%D Arabic verbatim. + +\def\typearab{\a@@verb} + +%D Some \LATEX\ macros. + +\def \makeatletter{\unprotect} +\def \makeatother {\protect} +\def \typeout {\writestatus{arabtex}} + +%D We have to save some macros. + +\let\ARABTEXversion=\empty + +\def\startloadingARABTEX% ugly hacks + {\catcode`!=12 + \catcode`?=12 + \pushmacro\output \let \output \scratchtoks + \pushmacro\LaTeX \let \LaTeX \undefined + \pushmacro\CJK \let \CJK \undefined +% \pushmacro\peek@token \let \peek@token \undefined +% \pushmacro\edmacloaded \let \edmacloaded \undefined + \pushmacro\year \let \year \normalyear + \pushmacro\month \let \month \normalmonth + \pushmacro\day \let \day \normalday + \pushmacro\input \def \input ##1 {\normalinput ##1 } + \pushmacro\linewidth + \pushmacro\datum \def\datum {\toks0} + \pushmacro\version \def\version {\toks2} + \pushmacro\theversion \let\theversion \ARABTEXversion + \pushmacro\emphasize + \pushmacro\cap} + +\def\stoploadingARABTEX + {\catcode`!=11 + \catcode`?=11 + \popmacro\cap + \popmacro\emphasize + \popmacro\theversion + \popmacro\version + \popmacro\datum + \popmacro\linewidth + \popmacro\input + \popmacro\day + \popmacro\month + \popmacro\year +% \popmacro\edmacloaded +% \popmacro\peek@token + \popmacro\CJK + \popmacro\LaTeX + \popmacro\output} + +%D We save some macros: + +\startloadingARABTEX + +%D When loading \ARABTEX\ we have to set back the~! and~?. + +\input arabtex.sty + +%D Since \ARABTEX\ has its own \type {\cap}, we save the +%D new meaning. We also redefine some \PLAIN\ macros, which +%D happen to have a different meaning in \LATEX. + +\let\ARABTEXversion\theversion +\let\ARABTEXcap \cap + +\appendtoks + \let\cap\ARABTEXcap +\to \everyARABTEXpreset + +\def\ARABTEXsh@ft#1% + {\dimen@.00#1ex + \multiply\dimen@\slantperpoint + \kern-.0156\dimen@} + +\appendtoks + \let\sh@ft\ARABTEXsh@ft +\to \everyARABTEXpreset + +\def\ARABTEXd#1% + {{\o@lign{\relax#1\crcr\hidewidth\sh@ft{10}% + .\hidewidth}}} + +\def\ARABTEXb#1% + {{\o@lign{\relax#1\crcr\hidewidth\sh@ft{29}% + \vbox to.2ex{\hbox{\char22}\vss}\hidewidth}}} + +\appendtoks + \let\b\ARABTEXb + \let\d\ARABTEXd +\to \everyARABTEXpreset + +\def \ARABTEXbreakA {\hfill\break} +\def \ARABTEXbreakB {\break} +\edef\ARABTEXbar {\string|} +\def \ARABTEXcomma {\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi} + +\appendtoks + \let\\=\ARABTEXbreakA + \let\|=\ARABTEXbreakB + \let |=\ARABTEXbar + \let\,=\ARABTEXcomma +\to \everyARABTEXpreset + +\let\ARABTEXprotect\relax + +\appendtoks + \let\protect\ARABTEXprotect +\to \everyARABTEXpreset + +%D Now we can pop the saved macros. + +\stoploadingARABTEX + +%D Ah, we have to get rid of some \type {\protect} stuff but +%D to permit testing we add it in the \CONTEXT\ way. + +% \bgroup +% \catcode`\<=\@other +% \unexpanded\gdef\a@ins +% {\ifmmode +% \expandafter<% +% \else +% \dontleavehmode \bgroup +% \arab@codes \set@arabfont \@waslafalse \@wasfalse +% \expandafter\arab@insert +% \fi} +% \unexpanded\gdef\<{\a@ins} +% \catcode`\<=\active +% \global\let<=\a@ins +% \egroup +% +% cleaner: + +\defineactivecharacter < {\a@ins} \unexpanded\gdef\<{\a@ins}% + +\def\normal@a@ins + {\dontleavehmode % context prefers this instead of \leavevmode + \bgroup + \arab@codes + \set@arabfont + \@waslafalse + \@wasfalse + \arab@insert} + +\unexpanded\gdef\a@ins + {\mathortext<\normal@a@ins} + +%D We also need to register a few macros: + +\all@wcmd\initializeARABTEXalternative % no argument, internal command +\all@wcmd\tx % no argument, small font +\all@wcmd\txx % no argument, smaller font + +%D We also hook it into the presetter. + +\appendtoks + \let\normaltx \tx \def\tx {\normaltx \setarabicfont\fontstylesuffix}% + \let\normaltxx\txx\def\txx{\normaltxx\setarabicfont\fontstylesuffix}% +\to \everyARABTEXpreset + +%D The main definitions are: + +\definefontsynonym [ArabicRegular] [xnsh14] +\definefontsynonym [ArabicBold] [xnsh14bf] + +\defineARABTEXalternative + [arabic] + [\c!inner=\setarab, + \c!style=\setarabicfont\fontstylesuffix] + +\defineARABTEXalternative + [farsi] + [\c!inner=\setfarsi, + \c!style=\setarabicfont\fontstylesuffix] + +\defineARABTEXalternative + [urdu] + [\c!inner=\seturdu, + \c!style=\setarabicfont\fontstylesuffix] + +\defineARABTEXalternative + [maghribi] + [\c!inner=\setmaghribi, + \c!style=\setarabicfont\fontstylesuffix] + +%D Apart from such definitions, one can adapt the settings +%D using \type {\setupARABTEXalternative}. +%D +%D A few years ago at the Holland Festivities, I attended {\em +%D The Cave}, one of the most impressive combinations of music +%D and video I know. This composition of Steve Reich (music) +%D and .. (video) concentrates on the common grounds of arabs +%D and jews: their ancestor Abram. Listening to the \CDROM's +%D of {\em The Cave}, provided me the right ambiance for +%D filling in the details of this module. In {\em The Cave}, +%D interviews, music, and |<|believe it or not|>| rhythmic +%D typography are the cornerstones. Remembering those big +%D screens, it strikes me that like music, \TEX\ too is a +%D perfect instrument to cross cultural and linguistic +%D borders. So, let's load Hebrew support as well: + +\unexpanded\def\sethebrewfont#1% + {\setx@skels + \newfonttrue + \definedfont[Hebrew#1 sa \ARABTEXparameter\s!rscale]} + +% \let \setheb \sethebrew + +\unexpanded\def\pheb {\sethebrewfont\s!Regular} +\unexpanded\def\phebbf{\sethebrewfont\s!Bold} + +% \startloadingARABTEX + +% \ReadFile{hebtex.sty} +% \ReadFile{apatch.sty} +% \ReadFile{hepatch.sty} + +% \stoploadingARABTEX + +\definefontsynonym [HebrewRegular] [hclassic] +\definefontsynonym [HebrewBold] [hcaption] + +\defineARABTEXalternative + [hebrew] + [\c!inner=\sethebrew, + \c!style=\sethebrewfont\fontstylesuffix] + +%D Now we're done: + +\protect \endinput + +% everyoutput : \charsubdefmax \arab@charsubdefmax + +% \defineconversion [abjad] [\abj@d] +% +% voetnoten verbatim lijsten indexen tabellen uitlijnen +% +% \v!hoofdstuk=al-fa.slu +% \v!inhoud=al-mu.htawayAtu +% \v!figuren=qA'imaTu al-.suwaru +% \v!tabellen=qA'imaTu al-^gadAwilu +% \v!grafieken=qA'imaTu al-rusUmu +% \v!index=al-fihrisu +% \v!bijlage=al-mul.haqu + +% \usemodule[arabtex] +% +% \usetypescript[postscript] \switchtotypeface[postscript] +% +% \setarab \novocalize +% +% \starttext +% +% \placecontent +% +% \section{\} % short arabic use \< .. > +% \section{\} % short arabic use \< .. > +% +% \startarabic +% mu.hammad 'i_d q"aAm zay"d" + i_d yaqUm zyd + A_d zyd q"aAm +% +% mu.hammad 'i_d q"aAm zay"d" + i_d yaqUm zyd + A_d zyd q"aAm +% \stoparabic +% +% \section{\} +% +% \startarabic +% mu.hammad 'i_d q"aAm zay"d" + i_d yaqUm zyd + A_d zyd q"aAm +% \stoparabic +% +% \stoptext diff --git a/Master/texmf-dist/tex/context/base/m-arabtex.tex b/Master/texmf-dist/tex/context/base/m-arabtex.tex deleted file mode 100644 index 61e56e93aca..00000000000 --- a/Master/texmf-dist/tex/context/base/m-arabtex.tex +++ /dev/null @@ -1,450 +0,0 @@ -%D \module -%D [ file=m-arabtex, % was font-arb, -%D version=2003.02.22, % 1999.11.06, -%D title=\CONTEXT\ Modules, -%D subtitle=Arabic, -%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. - -% I still need to hook in some features into the setup -% macro. I also have to (re)define farsi etc. in ways -% similar to arab, so that we have dedicated environments. -% -% keywords needed: vocalize transscribe -% -% \startarabic[option=vocalize] % or vocalize=yes -% ...... -% \stoparabic - -\writestatus{loading}{ConTeXt Font Macros / ArabTeX support} - -%D At the \NTG\ 10\high{th} anniversary meeting Klaus Lagally -%D introduced the audience to arabic typesetting, and after -%D that I knew that some day I really had to look into his -%D generic package. And then, sort of simultaniously Maarten -%D Wisse and Imran Ahsan Nyazee asked me if \CONTEXT\ could -%D support \ARABTEX, a package that provides right to left -%D typesetting of (several variants of) arab and hebrew. -%D Having implemented support for chinese a few weeks before, -%D I could not resist to build in support for arab and hebrew -%D too. Writing support for languages that don't give me any -%D cue on how to pronounce their script, is kind of special. - -%D This is a beta version, since I still have to take care of some -%D macros that conflict with existing stuff. - -\unprotect - -\definesystemvariable{ARABTEX} - -\def\setupARABTEX - {\getparameters[\??ARABTEX]} - -\setupARABTEX - [\s!rscale=1.2, - \c!before=, - \c!after=, - \c!inner=\setarab, - \c!style=\setarabicfont\fontstylesuffix] - -%D A few (maybe too) simple hooks into the font mechanism. The -%D hook into the language module is not yet done. - -% \unexpanded\def\setarabicfont#1% rscale -% {\scratchdimen\@@ARABTEXrscale\bodyfontsize -% \font\arbfont\truefontname{Arabic#1} at \currentfontscale\scratchdimen -% \setx@skels -% \newfonttrue -% \arbfont} -% -% more modern -% -% \unexpanded\def\setarabicfont#1% rscale -% {\definefont[arbfont][Arabic#1 sa \@@ARABTEXrscale]% -% \setx@skels -% \newfonttrue -% \arbfont} -% -% more efficient - -\unexpanded\def\setarabicfont#1% - {\setx@skels - \newfonttrue - \definedfont[Arabic#1 sa \ARABTEXparameter\s!rscale]} - -%D Just to be compatible with Arab\TEX\ we define: - -\unexpanded\def\nash {\setarabicfont\s!Regular} -\unexpanded\def\nashbf {\setarabicfont\s!Bold } -\unexpanded\def\pnash {\setarabicfont\s!Regular} -\unexpanded\def\pnashbf{\setarabicfont\s!Bold } -\unexpanded\def\xnash {\setarabicfont\s!Regular} -\unexpanded\def\xnashbf{\setarabicfont\s!Bold } - -%D The display arabic environment (will be an installable -%D object) uses a few conditionals. Let's do it the -%D \CONTEXT\ way and define an anvironment that we later can -%D adapt. - -\newif\if@ignore -\newif\if@endpe - -\def\setupARABTEXalternative[#1]% - {\dodoubleempty\getparameters[\??ARABTEX#1]} - -\def\defineARABTEXalternative - {\dodoubleempty\dodefineARABTEXalternative} - -\def\dodefineARABTEXalternative[#1][#2]% - {\iffirstargument % \startarab is defined but used already - \getparameters - [\??ARABTEX#1] - [\c!before=\@@ARABTEXbefore, - \c!after=\@@ARABTEXafter, - \c!inner=\@@ARABTEXinner, - \c!style=\@@ARABTEXstyle, - \s!rscale=\@@ARABTEXrscale, - #2]% - \setvalue {\e!start#1}{\displayARABTEXalternative{#1}}% - \unexpanded\setvalue{#1}{\inlineARABTEXalternative {#1}}% - \unexpanded\def\RL{\getvalue{#1}}% - \unexpanded\def\LR{\a@LR}% - \let\R=\RL - \let\L=\LR - \expandafter\all@wcmd\csname\e!stop#1\endcsname - \else - \defineARABTEXalternative[arabic]% - \fi} - -\def\initializeARABTEXinternals - {\ARABTEXparameter\c!inner - \the\everyARABTEXpreset} - -\newtoks \everyARABTEXpreset - -\let\currentARABTEXalternative\empty - -\def\ARABTEXparameter#1% - {\csname\??ARABTEX\currentARABTEXalternative#1\endcsname} - -\def\inlineARABTEXalternative#1#2% - {\bgroup - \edef\currentARABTEXalternative{#1}% - \initializeARABTEXinternals - \a@RL{#2}% - \egroup} - -\def\displayARABTEXalternative#1% - {\dodoubleempty\dostartARABTEXalternative[#1]} - -\def\dostartARABTEXalternative[#1][#2]% - {\begingroup - \edef\currentARABTEXalternative{#1}% - \getparameters[\??ARABTEX\currentARABTEXalternative][#2]% - \ifnum1<0\ARABTEXparameter\c!n\relax - \startcolumns - \else - \ARABTEXparameter\c!before - \fi - \initializeARABTEXinternals - \initializeARABTEXend - \arabtext - \initializeARABTEXalternative} - -\def\initializeARABTEXalternative - {\ARABTEXparameter\c!style} - -\def\initializeARABTEXend% \CONTEXT\ does use \end quite differently - {\long\def\end##1% - {\endarabtext - \ifnum1<0\ARABTEXparameter\c!n\relax - \stopcolumns - \else - \ARABTEXparameter\c!after - \fi - \endgroup}% - \let\a@l@end\end - \letvalue{\e!stop\currentARABTEXalternative}=\end - \long\def\end##1% - {\endarabtext - \endgroup - \if@ignore\global\@ignorefalse\expandafter\ignorespaces\fi}} - -%D Arabic verbatim. - -\def\typearab{\a@@verb} - -%D Some \LATEX\ macros. - -\def \makeatletter{\unprotect} -\def \makeatother {\protect} -\def \typeout {\writestatus{arabtex}} - -%D We have to save some macros. - -\let\ARABTEXversion=\empty - -\def\startloadingARABTEX% ugly hacks - {\catcode`!=12 - \catcode`?=12 - \pushmacro\output \let \output \scratchtoks - \pushmacro\LaTeX \let \LaTeX \undefined - \pushmacro\CJK \let \CJK \undefined -% \pushmacro\peek@token \let \peek@token \undefined -% \pushmacro\edmacloaded \let \edmacloaded \undefined - \pushmacro\year \let \year \normalyear - \pushmacro\month \let \month \normalmonth - \pushmacro\day \let \day \normalday - \pushmacro\input \def \input ##1 {\normalinput ##1 } - \pushmacro\linewidth - \pushmacro\datum \def\datum {\toks0} - \pushmacro\version \def\version {\toks2} - \pushmacro\theversion \let\theversion \ARABTEXversion - \pushmacro\emphasize - \pushmacro\cap} - -\def\stoploadingARABTEX - {\catcode`!=11 - \catcode`?=11 - \popmacro\cap - \popmacro\emphasize - \popmacro\theversion - \popmacro\version - \popmacro\datum - \popmacro\linewidth - \popmacro\input - \popmacro\day - \popmacro\month - \popmacro\year -% \popmacro\edmacloaded -% \popmacro\peek@token - \popmacro\CJK - \popmacro\LaTeX - \popmacro\output} - -%D We save some macros: - -\startloadingARABTEX - -%D When loading \ARABTEX\ we have to set back the~! and~?. - -\input arabtex.sty - -%D Since \ARABTEX\ has its own \type {\cap}, we save the -%D new meaning. We also redefine some \PLAIN\ macros, which -%D happen to have a different meaning in \LATEX. - -\let\ARABTEXversion\theversion -\let\ARABTEXcap \cap - -\appendtoks - \let\cap\ARABTEXcap -\to \everyARABTEXpreset - -\def\ARABTEXsh@ft#1% - {\dimen@.00#1ex - \multiply\dimen@\slantperpoint - \kern-.0156\dimen@} - -\appendtoks - \let\sh@ft\ARABTEXsh@ft -\to \everyARABTEXpreset - -\def\ARABTEXd#1% - {{\o@lign{\relax#1\crcr\hidewidth\sh@ft{10}% - .\hidewidth}}} - -\def\ARABTEXb#1% - {{\o@lign{\relax#1\crcr\hidewidth\sh@ft{29}% - \vbox to.2ex{\hbox{\char22}\vss}\hidewidth}}} - -\appendtoks - \let\b\ARABTEXb - \let\d\ARABTEXd -\to \everyARABTEXpreset - -\def \ARABTEXbreakA {\hfill\break} -\def \ARABTEXbreakB {\break} -\edef\ARABTEXbar {\string|} -\def \ARABTEXcomma {\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi} - -\appendtoks - \let\\=\ARABTEXbreakA - \let\|=\ARABTEXbreakB - \let |=\ARABTEXbar - \let\,=\ARABTEXcomma -\to \everyARABTEXpreset - -\let\ARABTEXprotect\relax - -\appendtoks - \let\protect\ARABTEXprotect -\to \everyARABTEXpreset - -%D Now we can pop the saved macros. - -\stoploadingARABTEX - -%D Ah, we have to get rid of some \type {\protect} stuff but -%D to permit testing we add it in the \CONTEXT\ way. - -% \bgroup -% \catcode`\<=\@other -% \unexpanded\gdef\a@ins -% {\ifmmode -% \expandafter<% -% \else -% \dontleavehmode \bgroup -% \arab@codes \set@arabfont \@waslafalse \@wasfalse -% \expandafter\arab@insert -% \fi} -% \unexpanded\gdef\<{\a@ins} -% \catcode`\<=\active -% \global\let<=\a@ins -% \egroup -% -% cleaner: - -\defineactivecharacter < {\a@ins} \unexpanded\gdef\<{\a@ins}% - -\def\normal@a@ins - {\dontleavehmode % context prefers this instead of \leavevmode - \bgroup - \arab@codes - \set@arabfont - \@waslafalse - \@wasfalse - \arab@insert} - -\unexpanded\gdef\a@ins - {\mathortext<\normal@a@ins} - -%D We also need to register a few macros: - -\all@wcmd\initializeARABTEXalternative % no argument, internal command -\all@wcmd\tx % no argument, small font -\all@wcmd\txx % no argument, smaller font - -%D We also hook it into the presetter. - -\appendtoks - \let\normaltx \tx \def\tx {\normaltx \setarabicfont\fontstylesuffix}% - \let\normaltxx\txx\def\txx{\normaltxx\setarabicfont\fontstylesuffix}% -\to \everyARABTEXpreset - -%D The main definitions are: - -\definefontsynonym [ArabicRegular] [xnsh14] -\definefontsynonym [ArabicBold] [xnsh14bf] - -\defineARABTEXalternative - [arabic] - [\c!inner=\setarab, - \c!style=\setarabicfont\fontstylesuffix] - -\defineARABTEXalternative - [farsi] - [\c!inner=\setfarsi, - \c!style=\setarabicfont\fontstylesuffix] - -\defineARABTEXalternative - [urdu] - [\c!inner=\seturdu, - \c!style=\setarabicfont\fontstylesuffix] - -\defineARABTEXalternative - [maghribi] - [\c!inner=\setmaghribi, - \c!style=\setarabicfont\fontstylesuffix] - -%D Apart from such definitions, one can adapt the settings -%D using \type {\setupARABTEXalternative}. -%D -%D A few years ago at the Holland Festivities, I attended {\em -%D The Cave}, one of the most impressive combinations of music -%D and video I know. This composition of Steve Reich (music) -%D and .. (video) concentrates on the common grounds of arabs -%D and jews: their ancestor Abram. Listening to the \CDROM's -%D of {\em The Cave}, provided me the right ambiance for -%D filling in the details of this module. In {\em The Cave}, -%D interviews, music, and |<|believe it or not|>| rhythmic -%D typography are the cornerstones. Remembering those big -%D screens, it strikes me that like music, \TEX\ too is a -%D perfect instrument to cross cultural and linguistic -%D borders. So, let's load Hebrew support as well: - -\unexpanded\def\sethebrewfont#1% - {\setx@skels - \newfonttrue - \definedfont[Hebrew#1 sa \ARABTEXparameter\s!rscale]} - -% \let \setheb \sethebrew - -\unexpanded\def\pheb {\sethebrewfont\s!Regular} -\unexpanded\def\phebbf{\sethebrewfont\s!Bold} - -% \startloadingARABTEX - -% \ReadFile{hebtex.sty} -% \ReadFile{apatch.sty} -% \ReadFile{hepatch.sty} - -% \stoploadingARABTEX - -\definefontsynonym [HebrewRegular] [hclassic] -\definefontsynonym [HebrewBold] [hcaption] - -\defineARABTEXalternative - [hebrew] - [\c!inner=\sethebrew, - \c!style=\sethebrewfont\fontstylesuffix] - -%D Now we're done: - -\protect \endinput - -% everyoutput : \charsubdefmax \arab@charsubdefmax - -% \defineconversion [abjad] [\abj@d] -% -% voetnoten verbatim lijsten indexen tabellen uitlijnen -% -% \v!hoofdstuk=al-fa.slu -% \v!inhoud=al-mu.htawayAtu -% \v!figuren=qA'imaTu al-.suwaru -% \v!tabellen=qA'imaTu al-^gadAwilu -% \v!grafieken=qA'imaTu al-rusUmu -% \v!index=al-fihrisu -% \v!bijlage=al-mul.haqu - -% \usemodule[arabtex] -% -% \usetypescript[postscript] \switchtotypeface[postscript] -% -% \setarab \novocalize -% -% \starttext -% -% \placecontent -% -% \section{\} % short arabic use \< .. > -% \section{\} % short arabic use \< .. > -% -% \startarabic -% mu.hammad 'i_d q"aAm zay"d" + i_d yaqUm zyd + A_d zyd q"aAm -% -% mu.hammad 'i_d q"aAm zay"d" + i_d yaqUm zyd + A_d zyd q"aAm -% \stoparabic -% -% \section{\} -% -% \startarabic -% mu.hammad 'i_d q"aAm zay"d" + i_d yaqUm zyd + A_d zyd q"aAm -% \stoparabic -% -% \stoptext diff --git a/Master/texmf-dist/tex/context/base/m-barcodes.mkiv b/Master/texmf-dist/tex/context/base/m-barcodes.mkiv index b0eae148558..b6a54089f4f 100644 --- a/Master/texmf-dist/tex/context/base/m-barcodes.mkiv +++ b/Master/texmf-dist/tex/context/base/m-barcodes.mkiv @@ -1,5 +1,5 @@ %D \module -%D [ file=m-pstricks, +%D [ file=m-barcodes, %D version=2010.03.14, %D title=\CONTEXT\ Extra Modules, %D subtitle=Barcodes, @@ -35,7 +35,7 @@ % \definefont[barcodefont][file:texgyreheros-regular] \startluacode -plugins.barcodes = { } +moduledata.barcodes = { } local function split(code) local t = { string.byte(code,1,#code) } @@ -53,7 +53,7 @@ local function split(code) end end -function plugins.barcodes.isbn_1(original) +function moduledata.barcodes.isbn_1(original) local code = string.gsub(original,"%-","") local t, s, m, c = split(code) if t then @@ -68,7 +68,7 @@ function plugins.barcodes.isbn_1(original) tex.sprint(code) end -function plugins.barcodes.isbn_2(original) +function moduledata.barcodes.isbn_2(original) local code = string.gsub(original,"%-","") local t, s, m, c = split(code) if t and #t == 12 then @@ -85,13 +85,13 @@ end \vbox { \hbox { \hskip3.7mm - \scale[width=34mm]{\barcodefont ISBN \ctxlua{plugins.barcodes.isbn_2("\getvariable{barcode}{code}")}} + \scale[width=34mm]{\barcodefont ISBN \ctxlua{moduledata.barcodes.isbn_2("\getvariable{barcode}{code}")}} } \par \normalexpanded { \noexpand \setPSTRICKS { \noexpand \pspicture(-4mm,-1mm)(38mm,26mm) \noexpand \psbarcode { - \ctxlua{plugins.barcodes.isbn_1("\getvariable{barcode}{code}")} + \ctxlua{moduledata.barcodes.isbn_1("\getvariable{barcode}{code}")} } { includetext guardwhitespace } { @@ -111,12 +111,12 @@ end \egroup} % \usemodule[barcodes] -% -% \starttext -% \startTEXpage -% \barcode[type=isbn,code=978-94-90688-01-1] -% \stopTEXpage -% \stoptext -\endinput +\doifnotmode{demo}{\endinput} + +\starttext + \startTEXpage + \barcode[type=isbn,code=978-94-90688-01-1] + \stopTEXpage +\stoptext diff --git a/Master/texmf-dist/tex/context/base/m-chart.mkii b/Master/texmf-dist/tex/context/base/m-chart.mkii index 2554fa2d4b7..bddd435efb5 100644 --- a/Master/texmf-dist/tex/context/base/m-chart.mkii +++ b/Master/texmf-dist/tex/context/base/m-chart.mkii @@ -11,10 +11,1277 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -%D The \XML\ interface: +% todo: \localpushmacro/\localpopmacro (dohandleflowchart etc) +% todo: make mkiv variant +% todo: use dimexpr/numspr + +% will be redone with layers and dimexpr or even better, by just using +% textext .. a nice example of old code + +%D This is an experimental module. Pieces of code will be moved +%D to other modules. More features are possible but will be +%D interfaces later. +%D +%D When finished this module will be documented. The main macro +%D is still a rather big one and there is some redundant and +%D slow code that needs a clean up. + +% arrow, dash +% crossing +% \goto -> \normalgoto +% class -> class:name (ref prefix) +% c, automatisch geen overlap zoeken +% eind eerder chart connecties +% relateren aan korps +% check op bestaan naam, bestaan shape +% auto als extern figuur +% subchart +% pijlen +% focus +% ook nog \MPmessage +% areapath -> krappe vlak +% clippath -> gehele vlak +% +% offset : clip offset +% breedte : breedte cel +% hoogte : hoogte cel +% dx : halve afstand in breedte (grid breedte = breedte + 2dx) +% dy : halve afstand in hoogte (grid hoogte = hoogte + 2dy) +% x : x offset (clipping) +% y : y offset (clipping) +% nx : minimaal aantal cellen horizontaal +% ny : minimaal aantal cellen vertikaal +% +% shape none en geen equivalent maken +% +% kaderkleur achtergrondkleur +% lijnkleur lijndikte +% focus focuskaderkleur focusachtergrondkleur +% richting +% +% focus koppelen aan kleur \unprotect +\definesorting [flowchart] [flowcharts] [\v!none] % no access +\setupsorting [flowchart] [\c!state=\v!stop] % off by default + +\def\@FLOW@{@FLOW@} +\def\@FLOC@{@FLOC@} +\def\@FLOX@{@FLOX@} + +\def\@@FLOW{@@FLOW} +\def\@@FLOL{@@FLOL} +\def\@@FLOS{@@FLOS} +\def\@@FLOF{@@FLOF} +\def\@@FLOT{@@FLOT} +\def\@@FLOX{@@FLOX} + +\def\@@MPx {@@MPx} +\def\@@MPy {@@MPy} + +\def\FLOWbufferprefix{flw-} + +\def\processFLOWbuffer#1{\getbuffer[\FLOWbufferprefix#1]} +\def\typeFLOWbuffer #1{\typebuffer[\FLOWbufferprefix#1]} + +\def\setFLOWname#1#2% funny hack that makes sure that we get + {\bgroup % names that are acceptable for METAPOST + \lccode`0=`a\lccode`1=`b\lccode`2=`c\lccode`3=`d\lccode`4=`e% + \lccode`5=`f\lccode`6=`g\lccode`7=`h\lccode`8=`i\lccode`9=`j% + \lccode` =`\_\lccode`-=`\_\lccode`_=`\_% + \lowercase{\gdef#1{#2}}% + \egroup} + +% een gobble als default is sneller, en dan alleen setten als +% nodig + +\def\resetFLOWcell + {% variables + \global\let\FLOWname \empty + \global\let\FLOWalign \empty + \global\let\FLOWshape \empty + \global\let\FLOWlocation \empty + \global\let\FLOWtext \empty + \global\let\FLOWhelp \empty + \global\let\FLOWdestination\empty + \global\let\FLOWoverlay \empty + \global\let\FLOWfocus \empty + \global\let\tFLOWlabel \empty + \global\let\bFLOWlabel \empty + \global\let\lFLOWlabel \empty + \global\let\rFLOWlabel \empty + \global\let\bcFLOWlabel \empty + \global\let\tcFLOWlabel \empty + \global\let\lcFLOWlabel \empty + \global\let\rcFLOWlabel \empty + \global\let\tFLOWexit \empty + \global\let\bFLOWexit \empty + \global\let\lFLOWexit \empty + \global\let\rFLOWexit \empty + % commands + \let\name \doFLOWname + \let\shape \doFLOWshape + \let\destination\doFLOWdestination + \let\location \doFLOWlocation + \let\focus \doFLOWfocus + \let\overlay \doFLOWoverlay + \let\figure \doFLOWfigure + \let\text \doFLOWtext + \let\comment \doFLOWcomment + \let\label \doFLOWlabel + \let\help \doFLOWhelp + \let\connection \doFLOWconnection + \let\exit \doFLOWexit + % convenience commands + \let\locate \doFLOWlocate + \let\connect \doFLOWconnect} + +\let\FLOWcell \s!unknown +\let\FLOWshape \s!unknown +\let\FLOWdestination\s!unknown +\let\FLOWfocus \s!unknown +\let\FLOWoverlay \empty +\let\FLOWtext \empty + +\def\doFLOWname#1% + {\def\FLOWcell{#1}\setFLOWname\FLOWname{name_#1}\ignorespaces} + +\def\doFLOWshape#1% + {\gdef\FLOWshape{#1}\ignorespaces} + +\def\doFLOWdestination#1% + {\gdef\FLOWdestination{#1}\ignorespaces} + +\def\doFLOWlocation#1% + {\setFLOWlocation#1\end\ignorespaces} + +\def\doFLOWfocus#1% + {\gdef\FLOWfocus{#1}\ignorespaces} + +\def\doFLOWoverlay#1% + {\gdef\FLOWoverlay{#1}\ignorespaces} + +\def\doFLOWfigure#1% + {\defineoverlay[\s!dummy][\overlayfigure{#1}]% + \overlay\s!dummy} + +\def\doFLOWtext + {\dosingleempty\dodoFLOWtext} + +\def\dodoFLOWtext[#1]% % #2% + {\gdef\FLOWalign{#1}\gdef\FLOWtext}% {#2}} + +\def\doFLOWcomment[#1]#2% + {\ignorespaces\dogobblesingleempty} + +\def\doFLOWlabel[#1]#2% wordt dit gebruikt ? + {\setgvalue{#1FLOWlabel}{#2}\ignorespaces} + +\def\doFLOWhelp#1% + {\gdef\FLOWhelp{#1}\ignorespaces} + +\def\doFLOWconnection + {\dodoubleempty\dodoFLOWconnection} + +\def\dodoFLOWconnection[#1][#2]#3% + {\ignorespaces} + +\def\doFLOWconnect + {\connection} + +\def\doFLOWlocate + {\location} + +\def\doFLOWexit[#1]#2% + {\setgvalue{#1FLOWexit}{#2}\ignorespaces} + +\def\startFLOWchart + {\bgroup + \let\stopFLOWchart\egroup + \obeylines % lelijk, buffers nog eens fatsoeneren + \dodoubleempty\dostartFLOWchart} + +\def\dostartFLOWchart[#1][#2]% + {\preparenextFLOWchart{#1}{#2}% + \dostartbuffer[\FLOWbufferprefix\nofFLOWcharts][startFLOWchart][stopFLOWchart]} + +\def\defineFLOWchart% + {\dodoubleempty\dodefineFLOWchart} + +\long\def\dodefineFLOWchart[#1][#2]#3% + {\preparenextFLOWchart{#1}{#2}% + \setbuffer[\FLOWbufferprefix\nofFLOWcharts]#3\endbuffer} + +\def\preparenextFLOWchart#1#2% + {\doglobal\increment\nofFLOWcharts + \flowchart{#1}% + \setxvalue{\@FLOW@-#1}{\noexpand\dohandleflowchart[\nofFLOWcharts][#2]}} + +\def\setupFLOWcharts{\dodoubleargument\getparameters[\@@FLOW]} +\def\setupFLOWlines {\dodoubleargument\getparameters[\@@FLOL]} +\def\setupFLOWshapes{\dodoubleargument\getparameters[\@@FLOS]} +\def\setupFLOWfocus {\dodoubleargument\getparameters[\@@FLOF]} +\def\setupFLOWsets {\dodoubleargument\getparameters[\@@FLOX]} + +\setupFLOWcharts + [\c!option=, + \c!bodyfont=, + \c!dot=, % private option + \c!width=12\bodyfontsize, + \c!height=7\bodyfontsize, + \c!maxwidth=, + \c!maxheight=, + \c!offset=\v!standard, % == auto offset + \c!dx=2\bodyfontsize, + \c!dy=2\bodyfontsize, + \c!nx=0, % 1, + \c!ny=0, % 1, + \c!x=1, + \c!y=1, + \c!autofocus=, + \c!focus=, + \c!background=, % \v!color, + \c!backgroundcolor=\s!white, + \c!rulethickness=\linewidth, + \c!frame=\v!off, + \c!framecolor=] + +\setupFLOWlines + [\c!corner=\v!round, + \c!arrow=\v!yes, + \c!dash=\v!no, + \c!radius=.375\bodyfontsize, % 2.5\c!rulethickness + \c!color=FLOWlinecolor, + \c!rulethickness=.15\bodyfontsize, % 2pt, + \c!offset=\v!none] + +\setupFLOWshapes + [\c!default=action, + \c!framecolor=FLOWframecolor, + \c!background=\v!color, + \c!backgroundcolor=FLOWbackgroundcolor, + \c!backgroundscreen=\@@rsscreen, + \c!rulethickness=.15\bodyfontsize, % 2pt, + \c!offset=.5\bodyfontsize] + +\setupFLOWfocus + [\c!framecolor=FLOWfocuscolor, + \c!background=\@@FLOSbackground, + \c!backgroundcolor=\@@FLOSbackgroundcolor, + \c!backgroundscreen=\@@FLOSbackgroundscreen, + \c!rulethickness=\@@FLOSrulethickness, + \c!offset=\@@FLOSoffset] + +\definecolor [FLOWfocuscolor] [s=.2] +\definecolor [FLOWlinecolor] [s=.5] +\definecolor [FLOWframecolor] [s=.7] +\definecolor [FLOWbackgroundcolor] [s=.9] + +\newcounter\includeFLOWx +\newcounter\includeFLOWy + +\def\includeFLOWchart + {\dodoubleempty\doincludeFLOWchart} + +\def\doincludeFLOWchart[#1][#2]% + {\pushmacro\includeFLOWx + \pushmacro\includeFLOWy + \getparameters[FLOWi][x=1,y=1,#2]% + \increment(\includeFLOWx,0\FLOWix)\decrement\includeFLOWx + \increment(\includeFLOWy,0\FLOWiy)\decrement\includeFLOWy + \def\dodoincludeFLOWchart##1% + {\doifdefined{\@FLOW@-##1} + {\globalpushmacro\dohandleflowchart % was local + \gdef\dohandleflowchart[####1][####2]% + {\globalpopmacro\dohandleflowchart % was local + \resetFLOWlocation + \processFLOWbuffer{####1}}% + \getvalue{\@FLOW@-##1}}}% + \processcommalist[#1]\dodoincludeFLOWchart + \popmacro\includeFLOWx + \popmacro\includeFLOWy} + +\def\resetFLOWlocation + {\globallet\lastFLOWx\!!zerocount + \globallet\lastFLOWy\!!zerocount} + +\def\dosetFLOWlocation[#1#2]#3#4% + {\processaction + [#1#2] + [ +=>\scratchcounter\numexpr#4+ 1+#3\relax, + -=>\scratchcounter\numexpr#4- 1+#3\relax, + +#2=>\scratchcounter\numexpr#4+#2+#3\relax, + -#2=>\scratchcounter\numexpr#4-#2+#3\relax, + \s!default=>\scratchcounter\numexpr#4 +#3\relax, + \s!unknown=>\scratchcounter\numexpr0#1#2+#3\relax]% + \xdef#4{\the\scratchcounter}} + +\def\setFLOWlocation#1,#2\end + {\dosetFLOWlocation[#1\empty]\includeFLOWx\lastFLOWx + \dosetFLOWlocation[#2\empty]\includeFLOWy\lastFLOWy + \xdef\FLOWlocation{\lastFLOWx,\lastFLOWy}} + +\def\FLOWshapes + {node, action, procedure, product, decision, archive, + loop, wait, subprocedure, singledocument, multidocument, + sub procedure, single document, multi document, up, down, + left, right} + +\def\FLOWlines + {up, down, left, right} + +\def\FLOWsetconnect#1% + {\donefalse + \let\cFLOWfrom\empty + \let\cFLOWto\empty + \let\zFLOWfrom\!!zerocount + \let\zFLOWto\!!zerocount + \handletokens#1\with\doFLOWsetconnect + \ifx\cFLOWto\empty\let\cFLOWfrom\empty\fi} + +\def\doFLOWsetconnect#1% + {\ifx #1p% + \ifdone\def\zFLOWto{+1}\else\def\zFLOWfrom{+1}\fi + \else\ifx#1+% + \ifdone\def\zFLOWto{+1}\else\def\zFLOWfrom{+1}\fi + \else\ifx#1n% + \ifdone\def\zFLOWto{-1}\else\def\zFLOWfrom{-1}\fi + \else\ifx#1-% + \ifdone\def\zFLOWto{-1}\else\def\zFLOWfrom{-1}\fi + \else\ifdone + \edef\cFLOWto{\FLOWconnector#1}% + \else + \edef\cFLOWfrom{\FLOWconnector#1}% + \donetrue + \fi\fi\fi\fi\fi} + +\def\FLOWconnector#1% + {\if#1bbottom\else\if#1ttop\else\if#1lleft\else\if#1rright\fi\fi\fi\fi} + +\newif\ifFLOWscaling \FLOWscalingtrue + +\def\@@FLOW@@offset{\@@FLOWoffset} + +\def\getFLOWchart + {\dodoubleempty\dogetFLOWchart} + +\def\dogetFLOWchart[#1][#2]% + {\doifundefinedelse{\@FLOW@-#1} + {\writestatus{FLOW}{unknown chart #1}% + \framed + [\c!width=12\bodyfontsize,\c!height=8\bodyfontsize] + {\tttf [chart #1]}} + {\dodogetFLOWchart[#1][#2]}} + +\def\dodogetFLOWchart[#1][#2]% to be split a bit more + {\vbox\bgroup + \insidefloattrue + \forgetall + \dontcomplain + % \offinterlineskip % we now explicitly use \nointerlineskip later on + \def\dohandleflowchart[##1][##2]% + {\def\currentFLOWnumber{##1}% + \getparameters[\@@FLOW][##2]}% + \getvalue{\@FLOW@-#1}% + \getparameters[\@@FLOW][#2]% dubbelop ? + \doifsomething{\@@FLOWautofocus} + {\checkFLOWautofocus}% + %\message{AUTOSHAPE 3: (\@@FLOWx,\@@FLOWy)->(\@@FLOWnx,\@@FLOWny)}\wait + \global\let\FLOWwidth \@@FLOWnx + \global\let\FLOWheight\@@FLOWny + \let\startFLOWcell\startFLOWcellA + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber + \ifcase\@@FLOWnx\relax \let\@@FLOWnx\FLOWwidth \fi + \ifcase\@@FLOWny\relax \let\@@FLOWny\FLOWheight \fi + \doifnothing{\@@FLOWmaxwidth\@@FLOWmaxheight}{\FLOWscalingfalse}% + \ifFLOWscaling + \doifnothing{\@@FLOWmaxwidth }{\let\@@FLOWmaxwidth \maxdimen}% + \doifnothing{\@@FLOWmaxheight}{\let\@@FLOWmaxheight\maxdimen}% + \scratchcounter\bodyfontpoints + \doloop % NOG FONTSWITCH OM EX EN EM TE LATEN WERKEN + {\ifnum\scratchcounter>1 % NU DIMENSIONS IN TERMS OF BODYFONTSIZE + \bodyfontsize=\the\scratchcounter pt + \dimen0=\@@FLOWmaxwidth + \dimen2=\@@FLOWwidth + \dimen4=\@@FLOWdx + \advance\dimen2 2\dimen4 + \dimen2=\@@FLOWnx\dimen2 + \advance\dimen2 2\dimen4 + \ifdim\dimen2>\dimen0 + \advance\scratchcounter \minusone + \else + \dimen0=\@@FLOWmaxheight + \dimen2=\@@FLOWheight + \dimen4=\@@FLOWdy + \advance\dimen2 2\dimen4 + \dimen2=\@@FLOWny\dimen2 + \advance\dimen2 2\dimen4 + \ifdim\dimen2>\dimen0 + \advance\scratchcounter \minusone + \else + \exitloop + \fi + \fi + \else + \exitloop + \fi}% + \expanded{\switchtobodyfont[\the\scratchcounter pt]}% + \forgetall + % \offinterlineskip % needed ? + \else\ifx\@@FLOWbodyfont\empty\else + \expanded{\switchtobodyfont[\@@FLOWbodyfont]}% \expanded ? + \fi\fi + \global\let\FLOWcells\empty + \dimen0=\@@FLOWwidth + \edef\FLOWshapewidth{\the\dimen0}% + \dimen2=\@@FLOWdx + \advance\dimen0 2\dimen2 + \edef\FLOWgridwidth{\the\dimen0}% + \dimen0=\@@FLOWheight + \edef\FLOWshapeheight{\the\dimen0}% + \dimen2=\@@FLOWdy + \advance\dimen0 2\dimen2 + \edef\FLOWgridheight{\the\dimen0}% + \scratchdimen=\@@FLOSrulethickness + \edef\@@FLOSrulethickness{\the\scratchdimen}% + \scratchdimen=\@@FLOFrulethickness + \edef\@@FLOFrulethickness{\the\scratchdimen}% + \scratchdimen=\@@FLOLrulethickness + \edef\@@FLOLrulethickness{\the\scratchdimen}% + \ifdim\@@FLOLradius<2.5\scratchdimen + \scratchdimen=2.5\scratchdimen + \edef\@@FLOLradius{\the\scratchdimen}% + \ifdim\@@FLOLradius>\@@FLOWdx + \scratchdimen=\@@FLOWdx + \edef\@@FLOLradius{\the\scratchdimen}% + \fi + \ifdim\@@FLOLradius>\@@FLOWdy + \scratchdimen=\@@FLOWdy + \edef\@@FLOLradius{\the\scratchdimen}% + \fi + \else + \scratchdimen=\@@FLOLradius + \edef\@@FLOLradius{\the\scratchdimen}% + \fi + \processaction % magic 2.5 + [\@@FLOWoffset] + [ \v!none=>\scratchdimen=-2.5\scratchdimen, + \v!overlay=>\scratchdimen=-2.5\scratchdimen, + \v!standard=>\scratchdimen=\scratchdimen, + \s!unknown=>\scratchdimen=\@@FLOWoffset, + \s!default=>\scratchdimen=-2.5\scratchdimen]% + \edef\@@FLOW@@offset{\the\scratchdimen}% + \forgetall + \offinterlineskip + \resetMPdrawing + \doglobal\newcounter\FLOWcomment + \startMPdrawing + if unknown context_char : input mp-char.mp ; fi ; + grid_width := \FLOWgridwidth ; + grid_height := \FLOWgridheight ; + shape_width := \FLOWshapewidth ; + shape_height := \FLOWshapeheight ; + connection_line_width := \@@FLOLrulethickness ; + connection_smooth_size := \@@FLOLradius ; + connection_arrow_size := \@@FLOLradius ; + connection_dash_size := \@@FLOLradius ; + currentpicture := nullpicture ; + begin_chart(0,\FLOWwidth,\FLOWheight); + reverse_y := true ; + chart_offset := \@@FLOW@@offset ; + \stopMPdrawing + \doifelsenothing\@@FLOWbackgroundcolor + {\startMPdrawing + chart_background_color := white ; + \stopMPdrawing} + {\startMPdrawing + chart_background_color := \MPcolor{\@@FLOWbackgroundcolor} ; + \stopMPdrawing}% + \doif\@@FLOWoption\v!test + {\startMPdrawing + show_con_points := true ; + show_mid_points := true ; + show_all_points := true ; + \stopMPdrawing}% + \processaction % private + [\@@FLOWdot] + [ \v!yes=>\startMPdrawing + show_con_points := true ; + show_mid_points := true ; + show_all_points := true ; + \stopMPdrawing, + \s!unknown=>\startMPdrawing + show_\@@FLOWdot_points := true ; + \stopMPdrawing]% +\doglobal\newcounter\FLOWcomment + \let\startFLOWcell\startFLOWcellB + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber +\doglobal\newcounter\FLOWcomment + \let\startFLOWcell\startFLOWcellC + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber + \startMPdrawing + clip_chart(\@@FLOWx,\@@FLOWy,\@@FLOWnx,\@@FLOWny) ; + end_chart ; + \stopMPdrawing + \MPdrawingdonetrue + \setbox0\hbox + {\MPstaticgraphictrue + \MPshiftdrawingfalse + \getMPdrawing}% + \def\MPmessage##1% + {\writestatus{MP charts}{##1}}% + \def\MPposition##1##2##3% + {\setvalue{\@@MPx##1}{##2}\setvalue{\@@MPy##1}{##3}}% + \def\MPclippath##1##2##3##4% + {\def\clipMPllx{##1bp}\def\clipMPlly{##2bp}% + \def\clipMPurx{##3bp}\def\clipMPury{##4bp}}% + \def\MPareapath##1##2##3##4% + {\def\areaMPllx{##1bp}\def\areaMPlly{##2bp}% + \def\areaMPurx{##3bp}\def\areaMPury{##4bp}}% + \getMPdata + \doglobal\newcounter\FLOWcomment + \let\startFLOWcell\startFLOWcellD + \setbox2\vbox to \ht0 + {\forgetall % \offinterlineskip + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber\vss}% + \setbox2\hbox + {\hskip\@@FLOW@@offset\lower\@@FLOW@@offset\box2}% + \wd2\wd0\ht2\ht0\dp2\dp0 + \let\startFLOWcell\startFLOWcellE + \setbox4\vbox to \ht0 + {\forgetall % \offinterlineskip + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber\vss}% + \setbox4\hbox + {\hskip\@@FLOW@@offset\lower\@@FLOW@@offset\box4}% + \wd4\wd0\ht4\ht0\dp4\dp0 + \doifelse\@@FLOWoption\v!test + {\setbox6\vbox + {\forgetall + \vskip\@@FLOW@@offset + \hskip\@@FLOW@@offset + \basegrid + [\c!x=\@@FLOWx,\c!nx=\@@FLOWnx,\c!dx=\withoutpt\FLOWgridwidth, + \c!y=\@@FLOWy,\c!ny=\@@FLOWny,\c!dy=\withoutpt\FLOWgridheight, + \c!xstep=1,\c!ystep=1, + \c!unit=pt,\c!location=\v!middle]}% + \wd6\wd0\ht6\ht0\dp6\dp0 + \setbox8\vbox + {\forgetall + \offinterlineskip + \vskip\@@FLOW@@offset + \dostepwiserecurse\@@FLOWy\@@FLOWny\plusone + {\vbox to \FLOWgridheight + {\vfill + \hskip\@@FLOW@@offset + \hbox + {\dostepwiserecurse\@@FLOWx\@@FLOWnx\plusone + {\hbox to \FLOWgridwidth + {\hfill + \framed + [\c!framecolor=red, + \c!width=\FLOWshapewidth, + \c!height=\FLOWshapeheight] + {}% + \hfill}}} + \vfill}}}% + \wd8\wd0\ht8\ht0\dp8\dp0 + \framed + [\c!offset=\v!overlay,\c!framecolor=green] + {\hbox{\box4\hskip-\wd0\box0\hskip-\wd2\box2\hskip-\wd6\box6\hskip-\wd8\box8}}} + {\framed + [\c!offset=\v!overlay, + \c!frame=\@@FLOWframe, + \c!rulethickness=\@@FLOWrulethickness, + \c!framecolor=\@@FLOWframecolor, + \c!background=\@@FLOWbackground, + \c!backgroundcolor=\@@FLOWbackgroundcolor] + {\hbox{\box4\hskip-\wd0\box0\hskip-\wd2\box2}}}% + %\message{[\FLOWcells]}\wait + \egroup} + +% Pass A + +\long\def\startFLOWcellA#1\stopFLOWcell% + {\resetFLOWcell + \ignorespaces#1\unskip + \expandafter\getFLOWlocationA\FLOWlocation\end + \ignorespaces} + +\def\getFLOWlocationA#1,#2\end + {\ifnum0#1>\FLOWwidth \xdef\FLOWwidth {#1}\fi + \ifnum0#2>\FLOWheight\xdef\FLOWheight{#2}\fi} + +% Pass B +% +% beware: the - after \@FLOC@ is needed since name can be +% empty and we don't want to redefine \@FLOC@ itself by +% mistake + +\long\def\startFLOWcellB#1\stopFLOWcell + {\resetFLOWcell\ignorespaces#1\unskip + \setxvalue{\@FLOC@-\FLOWname}{\FLOWlocation}% kost veel cs's + \ifx\FLOWshape\empty + \global\let\FLOWshape\@@FLOSdefault + \fi + \doifnot\FLOWshape{none} % {\v!none} + {\ExpandBothAfter\doifinsetelse{\FLOWshape}{\FLOWshapes} + {\edef\FLOWshapetag{shape_\FLOWshape}% beter \expanded + \@EA\setFLOWname\@EA\FLOWshapetag\@EA{\FLOWshapetag}} + {\doifnumberelse\FLOWshape + {\let\FLOWshapetag\FLOWshape} + {\let\FLOWshapetag\empty}}% + \ifx\FLOWshapetag\empty \else + \ExpandBothAfter\doifinsetelse{\FLOWshape}{\FLOWlines} + {\chardef\FLOWstate0 } + {\ExpandBothAfter\doifcommonelse{\FLOWcell,\FLOWfocus}{\@@FLOWfocus} + {\chardef\FLOWstate1 } + {\chardef\FLOWstate2 }}% + \startMPdrawing + begin_sub_chart ; + \ifcase\FLOWstate + shape_line_color := \MPcolor{\@@FLOLcolor} ; + shape_fill_color := \MPcolor{\@@FLOLcolor} ; + shape_line_width := \@@FLOLrulethickness ; + \or + shape_line_color := \MPcolor{\@@FLOFframecolor} ; + shape_fill_color := \MPcolor{\@@FLOFbackgroundcolor} ; + shape_line_width := \@@FLOFrulethickness ; + \or + shape_line_color := \MPcolor{\@@FLOSframecolor} ; + shape_fill_color := \MPcolor{\@@FLOSbackgroundcolor} ; + shape_line_width := \@@FLOSrulethickness ; + \fi + %\ifx\FLOWoverlay\empty + % peepshape := false ; + %\else + % peepshape := true ; + %\fi + peepshape := \ifx\FLOWoverlay\empty false \else true \fi ; + new_shape(\FLOWlocation,\FLOWshapetag) ; + end_sub_chart ; + \stopMPdrawing + \fi}% + \ignorespaces} + +% Pass C + +\long\def\startFLOWcellC#1\stopFLOWcell% + {\resetFLOWcell +\pushmacro\lastFLOWx +\pushmacro\lastFLOWy + \ignorespaces#1\unskip % makes sure that vars are set +\popmacro\lastFLOWy +\popmacro\lastFLOWx + \let\connection\doFLOWconnectionC + \ignorespaces#1\unskip} + +\def\FLOWorigin{0,0} + +\def\doFLOWdisplace[#1,#2,#3]% experiment + {dsp_x := #1 ; dsp_y := #2 ;} + +\def\doFLOWconnectionC + {\dodoubleempty\dodoFLOWconnectionC} + +\def\dodoFLOWconnectionC[#1][#2]#3% + {\doglobal\increment\FLOWcomment + \setFLOWname\otherFLOWname{name_#3}% + \doifdefinedelse{\@FLOC@-\FLOWname} + {\edef\FLOWfrom{\getvalue{\@FLOC@-\FLOWname}}} + {\let \FLOWfrom \FLOWorigin}% + \ifx\FLOWfrom\FLOWorigin \else + \doifdefinedelse{\@FLOC@-\otherFLOWname} + {\edef\FLOWto {\getvalue{\@FLOC@-\otherFLOWname}}} + {\let \FLOWto \FLOWorigin}% + \ifx\FLOWto\FLOWorigin \else + \FLOWsetconnect{#1}% + \ifx\cFLOWfrom\empty \else + \doifelse\@@FLOLcorner\v!round + {\startMPdrawing smooth := true ; \stopMPdrawing} + {\startMPdrawing smooth := false ; \stopMPdrawing}% + \doifelse\@@FLOLdash\v!yes + {\startMPdrawing dashline := true ; \stopMPdrawing} + {\startMPdrawing dashline := false ; \stopMPdrawing}% + \doifelse\@@FLOLarrow\v!yes + {\startMPdrawing arrowtip := true ; \stopMPdrawing} + {\startMPdrawing arrowtip := false ; \stopMPdrawing}% + \doifelse\@@FLOLoffset\v!none + {\startMPdrawing touchshape := true ; \stopMPdrawing} + {\startMPdrawing touchshape := false ; \stopMPdrawing}% +%\doifsomething{#2} +% {\startMPdrawing +% \doFLOWdisplace[0#2,0,0]% +% \stopMPdrawing}% + \startMPdrawing +\doFLOWdisplace[0#2,0,0]% + connection_line_color := \MPcolor{\@@FLOLcolor} ; + connection_line_width := \@@FLOLrulethickness ; + connect_\cFLOWfrom_\cFLOWto (\FLOWfrom,\zFLOWfrom) (\FLOWto,\zFLOWto) ; +\doFLOWdisplace[0,0,0]% + \stopMPdrawing + \fi + \fi + \fi + \ignorespaces} + +% Pass D + +\long\def\startFLOWcellD#1\stopFLOWcell + {\resetFLOWcell +\pushmacro\lastFLOWx +\pushmacro\lastFLOWy + \ignorespaces#1\unskip % presets vars +\popmacro\lastFLOWy +\popmacro\lastFLOWx + \let\doprocessFLOWcell\doprocessFLOWcellD + \expandafter\doprocessFLOWcellD\FLOWlocation\end + \let\connection\doFLOWconnectionD + \let\comment\doFLOWcommentD + \ignorespaces#1\unskip\ignorespaces} + +\def\doFLOWconnectionD + {\dodoubleempty\dodoFLOWconnectionD} + +\def\dodoFLOWconnectionD[#1][#2]#3% + {\doglobal\increment\FLOWcomment + \ignorespaces} + +\def\doFLOWcommentD[#1]#2% + {\bgroup + \let\FLOW \middlebox + \let\FLOWb \bottombox + \let\FLOWbl\bottomleftbox + \let\FLOWbr\bottomrightbox + \let\FLOWt \topbox + \let\FLOWtl\topleftbox + \let\FLOWtr\toprightbox + \let\FLOWl \leftbox + \let\FLOWlt\lefttopbox + \let\FLOWlb\leftbottombox + \let\FLOWr \rightbox + \let\FLOWrt\righttopbox + \let\FLOWrb\rightbottombox + \let\FLOWc \middlebox +%\ifdefined{FLOW#1}% + \ifcase0\getvalue{\@@MPx\FLOWcomment}\getvalue{\@@MPy\FLOWcomment}\relax + \else + \ifdim\getvalue{\@@MPx\FLOWcomment}\s!bp<\areaMPllx\relax\else + \ifdim\getvalue{\@@MPx\FLOWcomment}\s!bp>\areaMPurx\relax\else + \ifdim\getvalue{\@@MPy\FLOWcomment}\s!bp<\areaMPlly\relax\else + \ifdim\getvalue{\@@MPy\FLOWcomment}\s!bp>\areaMPury\relax\else + \dimen0=\getvalue{\@@MPx\FLOWcomment}\s!bp + \advance\dimen0 -\@@FLOW@@offset + \advance\dimen0 -\clipMPllx + \dimen2=\clipMPury + \advance\dimen2 -\@@FLOW@@offset + \advance\dimen2 -\getvalue{\@@MPy\FLOWcomment}\s!bp + \setbox\scratchbox\hbox{\strut#2}% + \boxoffset.5\bodyfontsize + \setbox\scratchbox\hbox{\hskip\dimen0\lower\dimen2\getvalue{FLOW#1}{\box\scratchbox}}% + \smashbox\scratchbox + \box\scratchbox + \boxoffset\zeropoint + \nointerlineskip % really needed + \fi + \fi + \fi + \fi + \fi +%\fi + \egroup + \ignorespaces} + +% pass D + +\def\dophaseoneFLOWcellX#1#2% + {\!!counta#1\relax + \!!countb#2\relax + \!!countc\@@FLOWx + \!!countd\@@FLOWy + \advance\!!countc \@@FLOWnx + \advance\!!countd \@@FLOWny + \advance\!!countc \minusone + \advance\!!countd \minusone + \ifnum\!!counta<\@@FLOWx\relax \donefalse + \else\ifnum\!!counta>\!!countc \donefalse + \else\ifnum\!!countb<\@@FLOWy\relax \donefalse + \else\ifnum\!!countb>\!!countd \donefalse + \else \donetrue + \fi\fi\fi\fi} + +\def\dophasetwoFLOWcellX + {\advance\!!counta -\@@FLOWx + \advance\!!counta \plusone + \advance\!!countb -\@@FLOWy + \advance\!!countb \plusone + \dimen0=\FLOWgridwidth + \dimen0=\!!counta\dimen0 + \advance\dimen0 -\FLOWgridwidth + \dimen4=\FLOWgridwidth + \advance\dimen4 -\FLOWshapewidth + \advance\dimen0 .5\dimen4 + \dimen2=\FLOWgridheight + \dimen2=\!!countb\dimen2 + \dimen4=\FLOWgridheight + \advance\dimen4 -\FLOWshapeheight + \advance\dimen2 -.5\dimen4 + \edef\FLOWdx{\the\dimen0}% + \edef\FLOWdy{\the\dimen2}} + +\def\positionFLOWzero% assumes \FLOWdx and \FLOWdy are set + {\setbox0\hbox{\hskip\FLOWdx\lower\FLOWdy\box0}% + \smashbox0\box0 + \nointerlineskip} % new, needed since we somehow reset that + +\def\doFLOWtlabel#1#2#3% + {\scratchdimen\ifcase#2 \zeropoint\else\@@FLOWdy\fi + \setbox0\hbox{\hskip\dimen2\raise\scratchdimen + \hbox{\raise\dimen4\hbox{#1{\strut#3}}}}% + \positionFLOWzero}% + +\def\doFLOWblabel#1#2#3% + {\scratchdimen\ifcase#2 \zeropoint\else\@@FLOWdy\fi + \setbox0\hbox{\hskip\dimen2\raise-\scratchdimen + \hbox{#1{\strut#3}}}% + \positionFLOWzero}% + +\def\doFLOWllabel#1#2#3% + {\scratchdimen\ifcase#2 \zeropoint\else\@@FLOWdx\fi + \setbox0\hbox{\hskip-\scratchdimen\raise\dimen6 + \hbox{#1{\strut#3}}}% + \positionFLOWzero}% + +\def\doFLOWrlabel#1#2#3% + {\scratchdimen\ifcase#2 \zeropoint\else\@@FLOWdx\fi + \setbox0\hbox{\hskip\dimen0\hskip\scratchdimen + \hbox{\raise\dimen6\hbox{#1{\strut#3}}}}% + \positionFLOWzero} + +\def\doprocessFLOWcellD#1,#2\end + {\dophaseoneFLOWcellX{#1}{#2}% + \ifdone + \dophasetwoFLOWcellX + \doglobal\addtocommalist\FLOWcell\FLOWcells + \def\FLOWx{#1}% + \def\FLOWy{#2}% + \directsetup{flowcell}% + \setbox0\hbox + {\ifx\FLOWalign\empty\else + \setupframed + [\c!align=\v!normal,\c!bottom=\vfill,\c!top=\vfill]% + \@EA\processallactionsinset\@EA + [\FLOWalign] + [t=>{\setupframed[\c!bottom=\vfill,\c!top=]}, + b=>{\setupframed[\c!bottom=,\c!top=\vfill]}, + l=>{\setupframed[\c!align=\v!right]}, + r=>{\setupframed[\c!align=\v!left]}, + m=>{\setupframed[\c!align=\v!middle]}, + c=>{\setupframed[\c!align=\v!middle]}]% + \fi + \doifelse\FLOWshape{none} % {\v!none} + {\setupframed[\c!offset=\v!overlay]} + {\setupframed[\c!offset=\@@FLOSoffset]}% + \framed + [\c!frame=\v!off,\c!background=flowcell, + \c!width=\FLOWshapewidth,\c!height=\FLOWshapeheight] + {\FLOWtext}}% + \showFLOWhelp0 + \ifx\FLOWdestination\empty\else + \setbox0\hbox + {\setupinteraction[\c!color=,\c!contrastcolor=]% + \gotobox{\box0}[\FLOWdestination]}% + \fi + \positionFLOWzero + \dimen0=\FLOWshapewidth \dimen2=.5\dimen0 + \dimen4=\FLOWshapeheight\dimen6=.5\dimen4 + \boxoffset.5\bodyfontsize + \doFLOWtlabel \righttopbox0\tFLOWlabel + \doFLOWblabel\rightbottombox0\bFLOWlabel + \doFLOWllabel \lefttopbox0\lFLOWlabel + \doFLOWrlabel \righttopbox0\rFLOWlabel + \doFLOWtlabel \topbox0\tcFLOWlabel % for me only + \doFLOWblabel \bottombox0\bcFLOWlabel % for me only + \doFLOWllabel \leftbox0\lcFLOWlabel % for me only + \doFLOWrlabel \rightbox0\rcFLOWlabel % for me only + \ifnum#1=\@@FLOWx\relax \doFLOWllabel \leftbox1\lFLOWexit \fi + \ifnum#1=\!!countc \doFLOWrlabel \rightbox1\rFLOWexit \fi + \ifnum#2=\@@FLOWy\relax \doFLOWtlabel \topbox1\tFLOWexit \fi + \ifnum#2=\!!countd \doFLOWblabel \bottombox1\bFLOWexit \fi + \boxoffset\zeropoint + \fi} + +% For Willy Egger: +% +% \startsetups flowcell +% \definelayer +% [flowcell] +% [width=\FLOWshapewidth, +% height=\FLOWshapeheight] +% \setlayerframed +% [flowcell] +% [preset=rightbottom,offset=1ex] +% [frame=off] +% {\tx(\FLOWx,\FLOWy)} +% \stopsetups + +% Pass E + +\long\def\startFLOWcellE#1\stopFLOWcell + {\resetFLOWcell + \ignorespaces#1\unskip + \let\doprocessFLOWcell\doprocessFLOWcellE + \expandafter\doprocessFLOWcell\FLOWlocation\end} + +\def\doprocessFLOWcellE#1,#2\end % redundant + {\ifx\FLOWoverlay\empty \else + \dophaseoneFLOWcellX{#1}{#2}% + \ifdone + \dophasetwoFLOWcellX + \edef\FLOWdx{\the\dimen0}% + \edef\FLOWdy{\the\dimen2}% + \setbox0\hbox + {\framed + [%\c!frame=\v!off, + \c!background={\@@FLOWbackground,\FLOWoverlay}, + \c!backgroundcolor=\@@FLOSbackgroundcolor, + \c!width=\FLOWshapewidth,\c!height=\FLOWshapeheight] + {}}% + \positionFLOWzero + \fi + \fi} + +% Pass F + +\def\checkFLOWautofocus + {\def\@@FLOWminx{100}\let\@@FLOWminy\@@FLOWminx + \def\@@FLOWmaxx {0}\let\@@FLOWmaxy\@@FLOWmaxx + \def\@@FLOWabsx {0}\let\@@FLOWabsy\@@FLOWabsx + \let\startFLOWcell\startFLOWcellF + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber + %\message{AUTOSHAPE 1: (\@@FLOWminx,\@@FLOWminy)->(\@@FLOWmaxx,\@@FLOWmaxy)}% + \ifnum\@@FLOWabsx<\@@FLOWmaxx\let\@@FLOWmaxx\@@FLOWabsx\fi + \ifnum\@@FLOWabsy<\@@FLOWmaxy\let\@@FLOWmaxy\@@FLOWabsy\fi + %\message{AUTOSHAPE 2: (\@@FLOWminx,\@@FLOWminy)->(\@@FLOWmaxx,\@@FLOWmaxy)}% + \donetrue + \ifnum\@@FLOWminx=100 \donefalse\fi + \ifnum\@@FLOWminy=100 \donefalse\fi + \ifnum\@@FLOWmaxx=0 \donefalse\fi + \ifnum\@@FLOWmaxy=0 \donefalse\fi + \doFLOWcheckF\@@FLOWx\@@FLOWminx\@@FLOWmaxx\@@FLOWnx + \doFLOWcheckF\@@FLOWy\@@FLOWminy\@@FLOWmaxy\@@FLOWny} + +\def\startFLOWcellF#1\stopFLOWcell% + {\resetFLOWcell + \ignorespaces#1\unskip + \expandafter\doFLOWlocationF\FLOWlocation\end}% + +\def\doFLOWlocationF#1,#2\end% + {\ifnum#1>\@@FLOWabsx\def\@@FLOWabsx{#1}\fi + \ifnum#2>\@@FLOWabsy\def\@@FLOWabsy{#2}\fi + \ExpandBothAfter\doifinset{\FLOWcell}{\@@FLOWautofocus} + {\dodoFLOWlocationF{#1}<-\@@FLOWminx + \dodoFLOWlocationF{#1}>+\@@FLOWmaxx + \dodoFLOWlocationF{#2}<-\@@FLOWminy + \dodoFLOWlocationF{#2}>+\@@FLOWmaxy}} + +\def\dodoFLOWlocationF#1#2#3#4% + {\ifnum#1#2#4\relax + \!!counta=#1\advance\!!counta #31\relax + \edef#4{\ifnum\!!counta<1 1\else\the\!!counta\fi}% + \fi} + +\def\doFLOWcheckF#1#2#3#4% + {\ifdone + \let#1=#2% + \!!counta=#3% + \advance\!!counta \plusone\advance\!!counta -#2\relax + \ifnum\!!counta<1 \!!counta=1 \fi + \edef#4{\the\!!counta}% + \else + \let#1\!!plusone + \let#4\!!zerocount % no {1} + \fi} + +% \useFLOWchart[name][parent][setting,setting][additional settings] +% \useFLOWchart[name][parent][additional settings] + +\let\currentFLOWchart\empty + +\def\useFLOWchart + {\doquadrupleempty\douseFLOWchart} + +\def\douseFLOWchart[#1][#2][#3][#4]% name parent sets mainsettings + {\iffourthargument + \setvalue{\@FLOW@--#1}[##1]{\setgetFLOWchart[#2][#3][#4,##1]}% + \else + \checkparameters[#3]% + \ifparameters + \setvalue{\@FLOW@--#1}[##1]{\setgetFLOWchart[#2][][#3,##1]}% + \else + \setvalue{\@FLOW@--#1}[##1]{\setgetFLOWchart[#2][#3][##1]}% + \fi + \fi} + +\def\setgetFLOWchart[#1][#2][#3]% + {\def\docommand##1{}% cell line focus ? + \processcommalist[#2]\docommand + \getFLOWchart[#1][#3]} + +\def\doFLOWchart[#1][#2]% + {\hbox\bgroup\vbox\bgroup % vmode suppresses spaces +\def\currentFLOWchart{#1}% + \doifundefinedelse{\@FLOW@--#1} + {\getFLOWchart[#1][#2]} + {\getvalue{\@FLOW@--#1}[#2]}% + \egroup\egroup} + +\def\FLOWchart% + {\dodoubleempty\doFLOWchart} + +%D A hook into the help system. + +\def\showFLOWhelp#1% + {\doifhelpinfo\FLOWhelp + {\setbox#1=\hbox + {\setbox\scratchbox=\hbox{\lower\@@FLOWdy\hbox + {\helpbutton + [\c!width=\wd0,\c!color=,\c!height=\@@FLOWdy,\c!frame=\v!no]% + [\FLOWhelp]}}% + \smashbox\scratchbox + \setbox#1=\vbox + {\forgetall\offinterlineskip\box#1\box\scratchbox}% + \box#1}}} + +%D The next section is dedicated to splitting up charts. + +\def\getFLOWsize[#1]% + {\bgroup\let\dodogetFLOWchart\dogetFLOWsize\FLOWchart[#1]\egroup} + +\def\dogetFLOWsize[#1][#2]% + {\setbox\scratchbox=\vbox + {\globallet\FLOWmaxwidth \!!zerocount + \globallet\FLOWmaxheight\!!zerocount + \def\getFLOWlocation##1,##2\end + {\ifnum0##1>\FLOWmaxwidth \xdef\FLOWmaxwidth {##1}\fi + \ifnum0##2>\FLOWmaxheight\xdef\FLOWmaxheight{##2}\fi}% + \resetFLOWcell + \long\def\startFLOWcell##1\stopFLOWcell + {{##1\expandafter\getFLOWlocation\FLOWlocation\end}}% + \def\dohandleflowchart[##1][##2]% + {\resetFLOWlocation + \processFLOWbuffer{##1}}% + \getvalue{\@FLOW@-#1}}} + +\def\setupFLOWsplit% + {\dodoubleargument\getparameters[\@@FLOT]} + +\setupFLOWsplit% + [\c!nx=3,\c!ny=3, + \c!dx=1,\c!dy=1, + \c!command=, + \c!marking=\v!on, + \c!before=,\c!after=] + +\def\FLOWsplitx {1} +\def\FLOWsplity {1} +\def\FLOWsplitnx{1} +\def\FLOWsplitny{1} + +\def\FLOWcharts% + {\dodoubleempty\doFLOWcharts} + +%D While splitting, the following variables are available: +%D +%D \starttyping +%D \FLOWsplitnx \FLOWsplitny \FLOWsplitx \FLOWsplity +%D \stoptyping + +\def\doFLOWcharts[#1][#2]% + {\bgroup + \getFLOWsize[#1]% + \dodoFLOWcharts\relax + \global\let\FLOWsplitnx\FLOWsplitx + \global\let\FLOWsplitny\FLOWsplity + \dodoFLOWcharts{\dododoFLOWcharts[#1][#2]}% + \egroup} + +\def\dodoFLOWcharts#1% + {\def\@@FLOTx{1}% + \global\let\FLOWsplitx\@@FLOTx + \doloop + {\def\@@FLOTy{1}% + \global\let\FLOWsplity\@@FLOTy + \doloop + {\bgroup + \scratchcounter\FLOWmaxwidth + \advance\scratchcounter -\@@FLOTx + \advance\scratchcounter \plusone + \ifnum\scratchcounter<\@@FLOTnx\edef\@@FLOTnx{\the\scratchcounter}\fi + \scratchcounter\FLOWmaxheight + \advance\scratchcounter -\@@FLOTy + \advance\scratchcounter \plusone + \ifnum\scratchcounter<\@@FLOTny\edef\@@FLOTny{\the\scratchcounter}\fi + #1% does something with the float, or not + \egroup + \increment(\@@FLOTy,\@@FLOTny)% + \ifnum\@@FLOTy>\FLOWmaxheight + \exitloop + \else + \doglobal\increment\FLOWsplity + \decrement(\@@FLOTy,\@@FLOTdy)% + \fi}% + \increment(\@@FLOTx,\@@FLOTnx)% + \ifnum\@@FLOTx>\FLOWmaxwidth + \exitloop + \else + \doglobal\increment\FLOWsplitx + \decrement(\@@FLOTx,\@@FLOTdx)% + \fi}} + +\def\dododoFLOWcharts[#1][#2]% + {\bgroup + \@@FLOTbefore + \doifnot\@@FLOTmarking\v!on{\let\cuthbox\hbox}% + \cuthbox + {\@@FLOTcommand + {\FLOWchart[#1][#2, + \c!x=\@@FLOTx,\c!nx=\@@FLOTnx, + \c!y=\@@FLOTy,\c!ny=\@@FLOTny]}}% + \@@FLOTafter + \egroup} + +%D An example of splitting is given below: +%D +%D \starttyping +%D \setupFLOWsplit +%D [nx=5,ny=10, +%D dx=0,dy=0, +%D before=, +%D after=\page] +%D +%D \FLOWcharts[mybigflow] +%D \stoptyping +%D +%D Or, one can say: +%D +%D \starttyping +%D \splitfloat +%D {\placefigure{What a big flowchart this is!}} +%D {\FLOWcharts[mybigflow]} +%D \stoptyping + +%D \macros +%D {typeFLOWchart} +%D +%D For documentation purposes the following macro is +%D provided. Watch the use of the first and last line hooks, +%D which is needed because the start and stop commands are +%D not part of the buffer. + +\def\typeFLOWchart[#1]% + {\bgroup + \def\dohandleflowchart[##1][##2]{\typeFLOWbuffer{##1}}% + \defconvertedargument\firstverbatimfileline{\startFLOWchart[#1]}% + \defconvertedargument\lastverbatimfileline {\stopFLOWchart}% + \getvalue{\@FLOW@-#1} + \egroup} + +%D New: +%D +%D \starttyping +%D \setupFLOWcharts[command=\Whow] +%D +%D \startFLOWset[convert-en] % [tag][convert-en] +%D \subFLOWchart[a][x=1,y=1,nx=3,ny=3] +%D \subFLOWchart[b][x=1,y=2,nx=3,ny=3] +%D \subFLOWchart[c][x=2,y=1,nx=3,ny=3] +%D \stopFLOWset +%D +%D \def\Whow#1% +%D {\ifnum\currentFLOWset=1 \framed{Some Chart}\fi} +%D +%D \FLOWset[convert-en] % [tag] +%D +%D \def\Whow#1% +%D {\setuphead[state=high] +%D \startstandardmakeup +%D \centerbox{#1} +%D \stopstandardmakeup} +%D +%D \FLOWset[convert-en] % [tag] +%D \stoptyping + +\def\startFLOWset + {\dodoubleempty\dostartFLOWset} + +\def\dostartFLOWset[#1][#2]#3\stopFLOWset % tag name data + {\ifsecondargument + \long\setvalue{\@FLOX@#1}{\dohandleFLOWset{#1}{#2}{#3}}% + \else + \long\setvalue{\@FLOX@#1}{\dohandleFLOWset{#1}{#1}{#3}}% + \fi} + +\long\def\dohandleFLOWset#1#2#3% tag name data + {\bgroup + \def\subFLOWchart + {\dodoubleempty\dosubFLOWchart}% + \def\dosubFLOWchart[##1][##2]% subtag settings + {\ifsecondargument + \dodohandleFLOWset{#1}{##1}{#2}{##2}% + \else + \subFLOWchart[][##1]% + \fi}% + #3% + \egroup} + +\def\dodohandleFLOWset#1#2#3#4% tag subtag name settings + {\increment\currentFLOWset + \bgroup + \@@FLOXcommand + {\ifnum\currentFLOWset=1 \pagereference[#1]\fi + \doifsomething{#2} + {\setupreferencing[\c!prefix=]% + \pagereference[#1:#2]% -:#1:#2 + \setupreferencing[\c!prefix=#1:#2]}% + \FLOWchart[#3][#4]}% + \egroup} + +\def\FLOWset[#1]% + {\newcounter\currentFLOWset + \doifdefinedelse{\@FLOX@#1} + {\getvalue{\@FLOX@#1}} + {\dodohandleFLOWset{#1}{}{#1}{}}} + +\newcounter\currentFLOWset + +\setupFLOWsets + [\c!command=] + +%D This will be an option: + +% \def\startFLOWchart% +% {\dodoubleempty\dostartFLOWchart} +% +% \long\def\dostartFLOWchart[#1][#2]#3\stopFLOWchart +% {\preparenextFLOWchart{#1}{#2}% +% \long\setgvalue{\FLOWbufferprefix\nofFLOWcharts}{#3}} +% +% \long\def\dodefineFLOWchart[#1][#2]#3% +% {\preparenextFLOWchart{#1}{#2}% +% \long\setgvalue{\FLOWbufferprefix\nofFLOWcharts}{#3}} +% +% \def\processFLOWbuffer#1{\getvalue{\FLOWbufferprefix#1}} +% \def\typeFLOWbuffer #1{[Sorry, no verbatim chart #1 available.]} + +%D The \XML\ interface: + \startXMLdefinitions flowchart \defineXMLargument [flowchartdefinition] diff --git a/Master/texmf-dist/tex/context/base/m-chart.mkiv b/Master/texmf-dist/tex/context/base/m-chart.mkiv index 4c008a5eef3..114e7d5530c 100644 --- a/Master/texmf-dist/tex/context/base/m-chart.mkiv +++ b/Master/texmf-dist/tex/context/base/m-chart.mkiv @@ -11,10 +11,2536 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -%D The \XML\ interface: +%D This module will be reimplemented as it can be done much more +%D simple now in mkiv,. + + +% todo: \localpushmacro/\localpopmacro (dohandleflowchart etc) +% todo: make mkiv variant +% todo: use dimexpr/numspr + +% will be redone with layers and dimexpr or even better, by just using +% textext .. a nice example of old code + +%D This is an experimental module. Pieces of code will be moved +%D to other modules. More features are possible but will be +%D interfaces later. +%D +%D When finished this module will be documented. The main macro +%D is still a rather big one and there is some redundant and +%D slow code that needs a clean up. + +% arrow, dash +% crossing +% \goto -> \normalgoto +% class -> class:name (ref prefix) +% c, automatisch geen overlap zoeken +% eind eerder chart connecties +% relateren aan korps +% check op bestaan naam, bestaan shape +% auto als extern figuur +% subchart +% pijlen +% focus +% ook nog \MPmessage +% areapath -> krappe vlak +% clippath -> gehele vlak +% +% offset : clip offset +% breedte : breedte cel +% hoogte : hoogte cel +% dx : halve afstand in breedte (grid breedte = breedte + 2dx) +% dy : halve afstand in hoogte (grid hoogte = hoogte + 2dy) +% x : x offset (clipping) +% y : y offset (clipping) +% nx : minimaal aantal cellen horizontaal +% ny : minimaal aantal cellen vertikaal +% +% shape none en geen equivalent maken +% +% kaderkleur achtergrondkleur +% lijnkleur lijndikte +% focus focuskaderkleur focusachtergrondkleur +% richting +% +% focus koppelen aan kleur \unprotect -\writestatus\m!systems{The chart mkiv xml interface is not yet defined!} +\definesorting [flowchart] [flowcharts] [\v!none] % no access +\setupsorting [flowchart] [\c!state=\v!stop] % off by default + +\def\@FLOW@{@FLOW@} +\def\@FLOC@{@FLOC@} +\def\@FLOX@{@FLOX@} + +\def\@@FLOW{@@FLOW} +\def\@@FLOL{@@FLOL} +\def\@@FLOS{@@FLOS} +\def\@@FLOF{@@FLOF} +\def\@@FLOT{@@FLOT} +\def\@@FLOX{@@FLOX} + +\def\@@MPx {@@MPx} +\def\@@MPy {@@MPy} + +\def\FLOWbufferprefix{flw-} + +\def\processFLOWbuffer#1{\getbuffer[\FLOWbufferprefix#1]} +\def\typeFLOWbuffer #1{\typebuffer[\FLOWbufferprefix#1]} + +\def\setFLOWname#1#2% funny hack that makes sure that we get + {\bgroup % names that are acceptable for METAPOST + \lccode`0=`a\lccode`1=`b\lccode`2=`c\lccode`3=`d\lccode`4=`e% + \lccode`5=`f\lccode`6=`g\lccode`7=`h\lccode`8=`i\lccode`9=`j% + \lccode` =`\_\lccode`-=`\_\lccode`_=`\_% + \lowercase{\gdef#1{#2}}% todo: make a ctxlua call of this + \egroup} + +% een gobble als default is sneller, en dan alleen setten als +% nodig + +\def\resetFLOWcell + {% variables + \global\let\FLOWname \empty + \global\let\FLOWalign \empty + \global\let\FLOWshape \empty + \global\let\FLOWlocation \empty + \global\let\FLOWtext \empty + \global\let\FLOWhelp \empty + \global\let\FLOWdestination\empty + \global\let\FLOWoverlay \empty + \global\let\FLOWfocus \empty + \global\let\tFLOWlabel \empty + \global\let\bFLOWlabel \empty + \global\let\lFLOWlabel \empty + \global\let\rFLOWlabel \empty + \global\let\bcFLOWlabel \empty + \global\let\tcFLOWlabel \empty + \global\let\lcFLOWlabel \empty + \global\let\rcFLOWlabel \empty + \global\let\tFLOWexit \empty + \global\let\bFLOWexit \empty + \global\let\lFLOWexit \empty + \global\let\rFLOWexit \empty + % commands + \let\name \doFLOWname + \let\shape \doFLOWshape + \let\destination\doFLOWdestination + \let\location \doFLOWlocation + \let\focus \doFLOWfocus + \let\overlay \doFLOWoverlay + \let\figure \doFLOWfigure + \let\text \doFLOWtext + \let\comment \doFLOWcomment + \let\label \doFLOWlabel + \let\help \doFLOWhelp + \let\connection \doFLOWconnection + \let\exit \doFLOWexit + % convenience commands + \let\locate \doFLOWlocate + \let\connect \doFLOWconnect} + +\let\FLOWcell \s!unknown +\let\FLOWshape \s!unknown +\let\FLOWdestination\s!unknown +\let\FLOWfocus \s!unknown +\let\FLOWoverlay \empty +\let\FLOWtext \empty + +\def\doFLOWname#1% + {\def\FLOWcell{#1}\setFLOWname\FLOWname{name_#1}\ignorespaces} + +\def\doFLOWshape#1% + {\gdef\FLOWshape{#1}\ignorespaces} + +\def\doFLOWdestination#1% + {\gdef\FLOWdestination{#1}\ignorespaces} + +\def\doFLOWlocation#1% + {\setFLOWlocation#1\end\ignorespaces} + +\def\doFLOWfocus#1% + {\gdef\FLOWfocus{#1}\ignorespaces} + +\def\doFLOWoverlay#1% + {\gdef\FLOWoverlay{#1}\ignorespaces} + +\def\doFLOWfigure#1% + {\defineoverlay[\s!dummy][\overlayfigure{#1}]% + \overlay\s!dummy} + +\def\doFLOWtext + {\dosingleempty\dodoFLOWtext} + +\def\dodoFLOWtext[#1]% % #2% + {\gdef\FLOWalign{#1}\gdef\FLOWtext}% {#2}} + +\def\doFLOWcomment[#1]#2% + {\ignorespaces\dogobblesingleempty} + +\def\doFLOWlabel[#1]#2% wordt dit gebruikt ? + {\setgvalue{#1FLOWlabel}{#2}\ignorespaces} + +\def\doFLOWhelp#1% + {\gdef\FLOWhelp{#1}\ignorespaces} + +\def\doFLOWconnection + {\dodoubleempty\dodoFLOWconnection} + +\def\dodoFLOWconnection[#1][#2]#3% + {\ignorespaces} + +\def\doFLOWconnect + {\connection} + +\def\doFLOWlocate + {\location} + +\def\doFLOWexit[#1]#2% + {\setgvalue{#1FLOWexit}{#2}\ignorespaces} + +\def\startFLOWchart + {\bgroup + \let\stopFLOWchart\egroup + \obeylines % lelijk, buffers nog eens fatsoeneren + \dodoubleempty\dostartFLOWchart} + +\def\dostartFLOWchart[#1][#2]% + {\preparenextFLOWchart{#1}{#2}% + \dostartbuffer[\FLOWbufferprefix\nofFLOWcharts][startFLOWchart][stopFLOWchart]} + +\def\defineFLOWchart% + {\dodoubleempty\dodefineFLOWchart} + +\long\def\dodefineFLOWchart[#1][#2]#3% + {\preparenextFLOWchart{#1}{#2}% + \setbuffer[\FLOWbufferprefix\nofFLOWcharts]#3\endbuffer} + +\def\preparenextFLOWchart#1#2% + {\doglobal\increment\nofFLOWcharts + \flowchart{#1}% + \setxvalue{\@FLOW@-#1}{\noexpand\dohandleflowchart[\nofFLOWcharts][#2]}} + +\def\setupFLOWcharts{\dodoubleargument\getparameters[\@@FLOW]} +\def\setupFLOWlines {\dodoubleargument\getparameters[\@@FLOL]} +\def\setupFLOWshapes{\dodoubleargument\getparameters[\@@FLOS]} +\def\setupFLOWfocus {\dodoubleargument\getparameters[\@@FLOF]} +\def\setupFLOWsets {\dodoubleargument\getparameters[\@@FLOX]} + +\setupFLOWcharts + [\c!option=, + \c!bodyfont=, + \c!dot=, % private option + \c!width=12\bodyfontsize, + \c!height=7\bodyfontsize, + \c!maxwidth=, + \c!maxheight=, + \c!offset=\v!standard, % == auto offset + \c!dx=2\bodyfontsize, + \c!dy=2\bodyfontsize, + \c!nx=0, % 1, + \c!ny=0, % 1, + \c!x=1, + \c!y=1, + \c!autofocus=, + \c!focus=, + \c!background=, % \v!color, + \c!backgroundcolor=\s!white, + \c!rulethickness=\linewidth, + \c!frame=\v!off, + \c!framecolor=] + +\setupFLOWlines + [\c!corner=\v!round, + \c!arrow=\v!yes, + \c!dash=\v!no, + \c!radius=.375\bodyfontsize, % 2.5\c!rulethickness + \c!color=FLOWlinecolor, + \c!rulethickness=.15\bodyfontsize, % 2pt, + \c!offset=\v!none] + +\setupFLOWshapes + [\c!default=action, + \c!framecolor=FLOWframecolor, + \c!background=\v!color, + \c!backgroundcolor=FLOWbackgroundcolor, + \c!backgroundscreen=\@@rsscreen, + \c!rulethickness=.15\bodyfontsize, % 2pt, + \c!offset=.5\bodyfontsize] + +\setupFLOWfocus + [\c!framecolor=FLOWfocuscolor, + \c!background=\@@FLOSbackground, + \c!backgroundcolor=\@@FLOSbackgroundcolor, + \c!backgroundscreen=\@@FLOSbackgroundscreen, + \c!rulethickness=\@@FLOSrulethickness, + \c!offset=\@@FLOSoffset] + +\definecolor [FLOWfocuscolor] [s=.2] +\definecolor [FLOWlinecolor] [s=.5] +\definecolor [FLOWframecolor] [s=.7] +\definecolor [FLOWbackgroundcolor] [s=.9] + +\newcounter\includeFLOWx +\newcounter\includeFLOWy + +\def\includeFLOWchart + {\dodoubleempty\doincludeFLOWchart} + +\def\doincludeFLOWchart[#1][#2]% + {\pushmacro\includeFLOWx + \pushmacro\includeFLOWy + \getparameters[FLOWi][x=1,y=1,#2]% + \increment(\includeFLOWx,0\FLOWix)\decrement\includeFLOWx + \increment(\includeFLOWy,0\FLOWiy)\decrement\includeFLOWy + \def\dodoincludeFLOWchart##1% + {\doifdefined{\@FLOW@-##1} + {\globalpushmacro\dohandleflowchart % was local + \gdef\dohandleflowchart[####1][####2]% + {\globalpopmacro\dohandleflowchart % was local + \resetFLOWlocation + \processFLOWbuffer{####1}}% + \getvalue{\@FLOW@-##1}}}% + \processcommalist[#1]\dodoincludeFLOWchart + \popmacro\includeFLOWx + \popmacro\includeFLOWy} + +\def\resetFLOWlocation + {\globallet\lastFLOWx\!!zerocount + \globallet\lastFLOWy\!!zerocount} + +\def\dosetFLOWlocation[#1#2]#3#4% + {\processaction + [#1#2] + [ +=>\scratchcounter\numexpr#4+ 1+#3\relax, + -=>\scratchcounter\numexpr#4- 1+#3\relax, + +#2=>\scratchcounter\numexpr#4+#2+#3\relax, + -#2=>\scratchcounter\numexpr#4-#2+#3\relax, + \s!default=>\scratchcounter\numexpr#4 +#3\relax, + \s!unknown=>\scratchcounter\numexpr0#1#2+#3\relax]% + \xdef#4{\the\scratchcounter}} + +\def\setFLOWlocation#1,#2\end + {\dosetFLOWlocation[#1\empty]\includeFLOWx\lastFLOWx + \dosetFLOWlocation[#2\empty]\includeFLOWy\lastFLOWy + \xdef\FLOWlocation{\lastFLOWx,\lastFLOWy}} + +\def\FLOWshapes + {node, action, procedure, product, decision, archive, + loop, wait, subprocedure, singledocument, multidocument, + sub procedure, single document, multi document, up, down, + left, right} + +\def\FLOWlines + {up, down, left, right} + +\def\FLOWsetconnect#1% + {\donefalse + \let\cFLOWfrom\empty + \let\cFLOWto\empty + \let\zFLOWfrom\!!zerocount + \let\zFLOWto\!!zerocount + \handletokens#1\with\doFLOWsetconnect + \ifx\cFLOWto\empty\let\cFLOWfrom\empty\fi} + +\def\doFLOWsetconnect#1% + {\ifx #1p% + \ifdone\def\zFLOWto{+1}\else\def\zFLOWfrom{+1}\fi + \else\ifx#1+% + \ifdone\def\zFLOWto{+1}\else\def\zFLOWfrom{+1}\fi + \else\ifx#1n% + \ifdone\def\zFLOWto{-1}\else\def\zFLOWfrom{-1}\fi + \else\ifx#1-% + \ifdone\def\zFLOWto{-1}\else\def\zFLOWfrom{-1}\fi + \else\ifdone + \edef\cFLOWto{\FLOWconnector#1}% + \else + \edef\cFLOWfrom{\FLOWconnector#1}% + \donetrue + \fi\fi\fi\fi\fi} + +\def\FLOWconnector#1% + {\if#1bbottom\else\if#1ttop\else\if#1lleft\else\if#1rright\fi\fi\fi\fi} + +\newif\ifFLOWscaling \FLOWscalingtrue + +\def\@@FLOW@@offset{\@@FLOWoffset} + +\def\getFLOWchart + {\dodoubleempty\dogetFLOWchart} + +\def\dogetFLOWchart[#1][#2]% + {\doifundefinedelse{\@FLOW@-#1} + {\writestatus{FLOW}{unknown chart #1}% + \framed + [\c!width=12\bodyfontsize,\c!height=8\bodyfontsize] + {\tttf [chart #1]}} + {\dodogetFLOWchart[#1][#2]}} + +\def\dodogetFLOWchart[#1][#2]% to be split a bit more + {\vbox\bgroup + \insidefloattrue + \forgetall + \dontcomplain + % \offinterlineskip % we now explicitly use \nointerlineskip later on + \def\dohandleflowchart[##1][##2]% + {\def\currentFLOWnumber{##1}% + \getparameters[\@@FLOW][##2]}% + \getvalue{\@FLOW@-#1}% + \getparameters[\@@FLOW][#2]% dubbelop ? + \doifsomething{\@@FLOWautofocus} + {\checkFLOWautofocus}% + %\message{AUTOSHAPE 3: (\@@FLOWx,\@@FLOWy)->(\@@FLOWnx,\@@FLOWny)}\wait + \global\let\FLOWwidth \@@FLOWnx + \global\let\FLOWheight\@@FLOWny + \let\startFLOWcell\startFLOWcellA + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber + \ifcase\@@FLOWnx\relax \let\@@FLOWnx\FLOWwidth \fi + \ifcase\@@FLOWny\relax \let\@@FLOWny\FLOWheight \fi + \doifnothing{\@@FLOWmaxwidth\@@FLOWmaxheight}{\FLOWscalingfalse}% + \ifFLOWscaling + \doifnothing{\@@FLOWmaxwidth }{\let\@@FLOWmaxwidth \maxdimen}% + \doifnothing{\@@FLOWmaxheight}{\let\@@FLOWmaxheight\maxdimen}% + \scratchcounter\bodyfontpoints + \doloop % NOG FONTSWITCH OM EX EN EM TE LATEN WERKEN + {\ifnum\scratchcounter>1 % NU DIMENSIONS IN TERMS OF BODYFONTSIZE + \bodyfontsize=\the\scratchcounter pt + \dimen0=\@@FLOWmaxwidth + \dimen2=\@@FLOWwidth + \dimen4=\@@FLOWdx + \advance\dimen2 2\dimen4 + \dimen2=\@@FLOWnx\dimen2 + \advance\dimen2 2\dimen4 + \ifdim\dimen2>\dimen0 + \advance\scratchcounter \minusone + \else + \dimen0=\@@FLOWmaxheight + \dimen2=\@@FLOWheight + \dimen4=\@@FLOWdy + \advance\dimen2 2\dimen4 + \dimen2=\@@FLOWny\dimen2 + \advance\dimen2 2\dimen4 + \ifdim\dimen2>\dimen0 + \advance\scratchcounter \minusone + \else + \exitloop + \fi + \fi + \else + \exitloop + \fi}% + \expanded{\switchtobodyfont[\the\scratchcounter pt]}% + \forgetall + % \offinterlineskip % needed ? + \else\ifx\@@FLOWbodyfont\empty\else + \expanded{\switchtobodyfont[\@@FLOWbodyfont]}% \expanded ? + \fi\fi + \global\let\FLOWcells\empty + \dimen0=\@@FLOWwidth + \edef\FLOWshapewidth{\the\dimen0}% + \dimen2=\@@FLOWdx + \advance\dimen0 2\dimen2 + \edef\FLOWgridwidth{\the\dimen0}% + \dimen0=\@@FLOWheight + \edef\FLOWshapeheight{\the\dimen0}% + \dimen2=\@@FLOWdy + \advance\dimen0 2\dimen2 + \edef\FLOWgridheight{\the\dimen0}% + \scratchdimen=\@@FLOSrulethickness + \edef\@@FLOSrulethickness{\the\scratchdimen}% + \scratchdimen=\@@FLOFrulethickness + \edef\@@FLOFrulethickness{\the\scratchdimen}% + \scratchdimen=\@@FLOLrulethickness + \edef\@@FLOLrulethickness{\the\scratchdimen}% + \ifdim\@@FLOLradius<2.5\scratchdimen + \scratchdimen=2.5\scratchdimen + \edef\@@FLOLradius{\the\scratchdimen}% + \ifdim\@@FLOLradius>\@@FLOWdx + \scratchdimen=\@@FLOWdx + \edef\@@FLOLradius{\the\scratchdimen}% + \fi + \ifdim\@@FLOLradius>\@@FLOWdy + \scratchdimen=\@@FLOWdy + \edef\@@FLOLradius{\the\scratchdimen}% + \fi + \else + \scratchdimen=\@@FLOLradius + \edef\@@FLOLradius{\the\scratchdimen}% + \fi + \processaction % magic 2.5 + [\@@FLOWoffset] + [ \v!none=>\scratchdimen=-2.5\scratchdimen, + \v!overlay=>\scratchdimen=-2.5\scratchdimen, + \v!standard=>\scratchdimen=\scratchdimen, + \s!unknown=>\scratchdimen=\@@FLOWoffset, + \s!default=>\scratchdimen=-2.5\scratchdimen]% + \edef\@@FLOW@@offset{\the\scratchdimen}% + \forgetall + \offinterlineskip + \resetMPdrawing + \doglobal\newcounter\FLOWcomment + \startMPdrawing + if unknown context_char : input mp-char.mp ; fi ; + grid_width := \FLOWgridwidth ; + grid_height := \FLOWgridheight ; + shape_width := \FLOWshapewidth ; + shape_height := \FLOWshapeheight ; + connection_line_width := \@@FLOLrulethickness ; + connection_smooth_size := \@@FLOLradius ; + connection_arrow_size := \@@FLOLradius ; + connection_dash_size := \@@FLOLradius ; + currentpicture := nullpicture ; + begin_chart(0,\FLOWwidth,\FLOWheight); + reverse_y := true ; + chart_offset := \@@FLOW@@offset ; + \stopMPdrawing + \doifelsenothing\@@FLOWbackgroundcolor + {\startMPdrawing + chart_background_color := white ; + \stopMPdrawing} + {\startMPdrawing + chart_background_color := \MPcolor{\@@FLOWbackgroundcolor} ; + \stopMPdrawing}% + \doif\@@FLOWoption\v!test + {\startMPdrawing + show_con_points := true ; + show_mid_points := true ; + show_all_points := true ; + \stopMPdrawing}% + \processaction % private + [\@@FLOWdot] + [ \v!yes=>\startMPdrawing + show_con_points := true ; + show_mid_points := true ; + show_all_points := true ; + \stopMPdrawing, + \s!unknown=>\startMPdrawing + show_\@@FLOWdot _points := true ; + \stopMPdrawing]% +\doglobal\newcounter\FLOWcomment + \let\startFLOWcell\startFLOWcellB + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber +\doglobal\newcounter\FLOWcomment + \let\startFLOWcell\startFLOWcellC + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber + \startMPdrawing + clip_chart(\@@FLOWx,\@@FLOWy,\@@FLOWnx,\@@FLOWny) ; + end_chart ; + \stopMPdrawing + \MPdrawingdonetrue + \setbox0\hbox + {\MPstaticgraphictrue + \MPshiftdrawingfalse + \getMPdrawing}% + \def\MPmessage##1% + {\writestatus{MP charts}{##1}}% + \def\MPposition##1##2##3% + {\setvalue{\@@MPx##1}{##2}\setvalue{\@@MPy##1}{##3}}% + \def\MPclippath##1##2##3##4% + {\def\clipMPllx{##1bp}\def\clipMPlly{##2bp}% + \def\clipMPurx{##3bp}\def\clipMPury{##4bp}}% + \def\MPareapath##1##2##3##4% + {\def\areaMPllx{##1bp}\def\areaMPlly{##2bp}% + \def\areaMPurx{##3bp}\def\areaMPury{##4bp}}% + \getMPdata + \doglobal\newcounter\FLOWcomment + \let\startFLOWcell\startFLOWcellD + \setbox2\vbox to \ht0 + {\forgetall % \offinterlineskip + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber\vss}% + \setbox2\hbox + {\hskip\@@FLOW@@offset\lower\@@FLOW@@offset\box2}% + \wd2\wd0\ht2\ht0\dp2\dp0 + \let\startFLOWcell\startFLOWcellE + \setbox4\vbox to \ht0 + {\forgetall % \offinterlineskip + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber\vss}% + \setbox4\hbox + {\hskip\@@FLOW@@offset\lower\@@FLOW@@offset\box4}% + \wd4\wd0\ht4\ht0\dp4\dp0 + \doifelse\@@FLOWoption\v!test + {\setbox6\vbox + {\forgetall + \vskip\@@FLOW@@offset + \hskip\@@FLOW@@offset + \basegrid + [\c!x=\@@FLOWx,\c!nx=\@@FLOWnx,\c!dx=\withoutpt\FLOWgridwidth, + \c!y=\@@FLOWy,\c!ny=\@@FLOWny,\c!dy=\withoutpt\FLOWgridheight, + \c!xstep=1,\c!ystep=1, + \c!unit=pt,\c!location=\v!middle]}% + \wd6\wd0\ht6\ht0\dp6\dp0 + \setbox8\vbox + {\forgetall + \offinterlineskip + \vskip\@@FLOW@@offset + \dostepwiserecurse\@@FLOWy\@@FLOWny\plusone + {\vbox to \FLOWgridheight + {\vfill + \hskip\@@FLOW@@offset + \hbox + {\dostepwiserecurse\@@FLOWx\@@FLOWnx\plusone + {\hbox to \FLOWgridwidth + {\hfill + \framed + [\c!framecolor=red, + \c!width=\FLOWshapewidth, + \c!height=\FLOWshapeheight] + {}% + \hfill}}} + \vfill}}}% + \wd8\wd0\ht8\ht0\dp8\dp0 + \framed + [\c!offset=\v!overlay,\c!framecolor=green] + {\hbox{\box4\hskip-\wd0\box0\hskip-\wd2\box2\hskip-\wd6\box6\hskip-\wd8\box8}}} + {\framed + [\c!offset=\v!overlay, + \c!frame=\@@FLOWframe, + \c!rulethickness=\@@FLOWrulethickness, + \c!framecolor=\@@FLOWframecolor, + \c!background=\@@FLOWbackground, + \c!backgroundcolor=\@@FLOWbackgroundcolor] + {\hbox{\box4\hskip-\wd0\box0\hskip-\wd2\box2}}}% + %\message{[\FLOWcells]}\wait + \egroup} + +% Pass A + +\long\def\startFLOWcellA#1\stopFLOWcell% + {\resetFLOWcell + \ignorespaces#1\unskip + \expandafter\getFLOWlocationA\FLOWlocation\end + \ignorespaces} + +\def\getFLOWlocationA#1,#2\end + {\ifnum0#1>\FLOWwidth \xdef\FLOWwidth {#1}\fi + \ifnum0#2>\FLOWheight\xdef\FLOWheight{#2}\fi} + +% Pass B +% +% beware: the - after \@FLOC@ is needed since name can be +% empty and we don't want to redefine \@FLOC@ itself by +% mistake + +\long\def\startFLOWcellB#1\stopFLOWcell + {\resetFLOWcell\ignorespaces#1\unskip + \setxvalue{\@FLOC@-\FLOWname}{\FLOWlocation}% kost veel cs's + \ifx\FLOWshape\empty + \global\let\FLOWshape\@@FLOSdefault + \fi + \doifnot\FLOWshape{none} % {\v!none} + {\doifinsetelse\FLOWshape\FLOWshapes + {\edef\FLOWshapetag{shape_ \FLOWshape}% beter \expanded + \@EA\setFLOWname\@EA\FLOWshapetag\@EA{\FLOWshapetag}} + {\doifnumberelse\FLOWshape + {\let\FLOWshapetag\FLOWshape} + {\let\FLOWshapetag\empty}}% + \ifx\FLOWshapetag\empty \else + \doifinsetelse\FLOWshape\FLOWlines + {\chardef\FLOWstate0 } + {\doifcommonelse{\FLOWcell,\FLOWfocus}\@@FLOWfocus + {\chardef\FLOWstate1 } + {\chardef\FLOWstate2 }}% + \startMPdrawing + begin_sub_chart ; + \ifcase\FLOWstate + shape_line_color := \MPcolor{\@@FLOLcolor} ; + shape_fill_color := \MPcolor{\@@FLOLcolor} ; + shape_line_width := \@@FLOLrulethickness ; + \or + shape_line_color := \MPcolor{\@@FLOFframecolor} ; + shape_fill_color := \MPcolor{\@@FLOFbackgroundcolor} ; + shape_line_width := \@@FLOFrulethickness ; + \or + shape_line_color := \MPcolor{\@@FLOSframecolor} ; + shape_fill_color := \MPcolor{\@@FLOSbackgroundcolor} ; + shape_line_width := \@@FLOSrulethickness ; + \fi + %\ifx\FLOWoverlay\empty + % peepshape := false ; + %\else + % peepshape := true ; + %\fi + peepshape := \ifx\FLOWoverlay\empty false \else true \fi ; + new_shape(\FLOWlocation,\FLOWshapetag) ; + end_sub_chart ; + \stopMPdrawing + \fi}% + \ignorespaces} + +% Pass C + +\long\def\startFLOWcellC#1\stopFLOWcell% + {\resetFLOWcell +\pushmacro\lastFLOWx +\pushmacro\lastFLOWy + \ignorespaces#1\unskip % makes sure that vars are set +\popmacro\lastFLOWy +\popmacro\lastFLOWx + \let\connection\doFLOWconnectionC + \ignorespaces#1\unskip} + +\def\FLOWorigin{0,0} + +\def\doFLOWdisplace[#1,#2,#3]% experiment + {dsp_x := #1 ; dsp_y := #2 ;} + +\def\doFLOWconnectionC + {\dodoubleempty\dodoFLOWconnectionC} + +\def\dodoFLOWconnectionC[#1][#2]#3% + {\doglobal\increment\FLOWcomment + \setFLOWname\otherFLOWname{name_#3}% + \doifdefinedelse{\@FLOC@-\FLOWname} + {\edef\FLOWfrom{\getvalue{\@FLOC@-\FLOWname}}} + {\let \FLOWfrom \FLOWorigin}% + \ifx\FLOWfrom\FLOWorigin \else + \doifdefinedelse{\@FLOC@-\otherFLOWname} + {\edef\FLOWto {\getvalue{\@FLOC@-\otherFLOWname}}} + {\let \FLOWto \FLOWorigin}% + \ifx\FLOWto\FLOWorigin \else + \FLOWsetconnect{#1}% + \ifx\cFLOWfrom\empty \else + \doifelse\@@FLOLcorner\v!round + {\startMPdrawing smooth := true ; \stopMPdrawing} + {\startMPdrawing smooth := false ; \stopMPdrawing}% + \doifelse\@@FLOLdash\v!yes + {\startMPdrawing dashline := true ; \stopMPdrawing} + {\startMPdrawing dashline := false ; \stopMPdrawing}% + \doifelse\@@FLOLarrow\v!yes + {\startMPdrawing arrowtip := true ; \stopMPdrawing} + {\startMPdrawing arrowtip := false ; \stopMPdrawing}% + \doifelse\@@FLOLoffset\v!none + {\startMPdrawing touchshape := true ; \stopMPdrawing} + {\startMPdrawing touchshape := false ; \stopMPdrawing}% +%\doifsomething{#2} +% {\startMPdrawing +% \doFLOWdisplace[0#2,0,0]% +% \stopMPdrawing}% + \startMPdrawing +\doFLOWdisplace[0#2,0,0]% + connection_line_color := \MPcolor{\@@FLOLcolor} ; + connection_line_width := \@@FLOLrulethickness ; + connect_\cFLOWfrom _\cFLOWto (\FLOWfrom,\zFLOWfrom) (\FLOWto,\zFLOWto) ; +\doFLOWdisplace[0,0,0]% + \stopMPdrawing + \fi + \fi + \fi + \ignorespaces} + +% Pass D + +\long\def\startFLOWcellD#1\stopFLOWcell + {\resetFLOWcell +\pushmacro\lastFLOWx +\pushmacro\lastFLOWy + \ignorespaces#1\unskip % presets vars +\popmacro\lastFLOWy +\popmacro\lastFLOWx + \let\doprocessFLOWcell\doprocessFLOWcellD + \expandafter\doprocessFLOWcellD\FLOWlocation\end + \let\connection\doFLOWconnectionD + \let\comment\doFLOWcommentD + \ignorespaces#1\unskip\ignorespaces} + +\def\doFLOWconnectionD + {\dodoubleempty\dodoFLOWconnectionD} + +\def\dodoFLOWconnectionD[#1][#2]#3% + {\doglobal\increment\FLOWcomment + \ignorespaces} + +\def\doFLOWcommentD[#1]#2% + {\bgroup + \let\FLOW \middlebox + \let\FLOWb \bottombox + \let\FLOWbl\bottomleftbox + \let\FLOWbr\bottomrightbox + \let\FLOWt \topbox + \let\FLOWtl\topleftbox + \let\FLOWtr\toprightbox + \let\FLOWl \leftbox + \let\FLOWlt\lefttopbox + \let\FLOWlb\leftbottombox + \let\FLOWr \rightbox + \let\FLOWrt\righttopbox + \let\FLOWrb\rightbottombox + \let\FLOWc \middlebox +%\ifdefined{FLOW#1}% + \ifcase0\getvalue{\@@MPx\FLOWcomment}\getvalue{\@@MPy\FLOWcomment}\relax + \else + \ifdim\getvalue{\@@MPx\FLOWcomment}\s!bp<\areaMPllx\relax\else + \ifdim\getvalue{\@@MPx\FLOWcomment}\s!bp>\areaMPurx\relax\else + \ifdim\getvalue{\@@MPy\FLOWcomment}\s!bp<\areaMPlly\relax\else + \ifdim\getvalue{\@@MPy\FLOWcomment}\s!bp>\areaMPury\relax\else + \dimen0=\getvalue{\@@MPx\FLOWcomment}\s!bp + \advance\dimen0 -\@@FLOW@@offset + \advance\dimen0 -\clipMPllx + \dimen2=\clipMPury + \advance\dimen2 -\@@FLOW@@offset + \advance\dimen2 -\getvalue{\@@MPy\FLOWcomment}\s!bp + \setbox\scratchbox\hbox{\strut#2}% + \boxoffset.5\bodyfontsize + \setbox\scratchbox\hbox{\hskip\dimen0\lower\dimen2\getvalue{FLOW#1}{\box\scratchbox}}% + \smashbox\scratchbox + \box\scratchbox + \boxoffset\zeropoint + \nointerlineskip % really needed + \fi + \fi + \fi + \fi + \fi +%\fi + \egroup + \ignorespaces} + +% pass D + +\def\dophaseoneFLOWcellX#1#2% + {\!!counta#1\relax + \!!countb#2\relax + \!!countc\@@FLOWx + \!!countd\@@FLOWy + \advance\!!countc \@@FLOWnx + \advance\!!countd \@@FLOWny + \advance\!!countc \minusone + \advance\!!countd \minusone + \ifnum\!!counta<\@@FLOWx\relax \donefalse + \else\ifnum\!!counta>\!!countc \donefalse + \else\ifnum\!!countb<\@@FLOWy\relax \donefalse + \else\ifnum\!!countb>\!!countd \donefalse + \else \donetrue + \fi\fi\fi\fi} + +\def\dophasetwoFLOWcellX + {\advance\!!counta -\@@FLOWx + \advance\!!counta \plusone + \advance\!!countb -\@@FLOWy + \advance\!!countb \plusone + \dimen0=\FLOWgridwidth + \dimen0=\!!counta\dimen0 + \advance\dimen0 -\FLOWgridwidth + \dimen4=\FLOWgridwidth + \advance\dimen4 -\FLOWshapewidth + \advance\dimen0 .5\dimen4 + \dimen2=\FLOWgridheight + \dimen2=\!!countb\dimen2 + \dimen4=\FLOWgridheight + \advance\dimen4 -\FLOWshapeheight + \advance\dimen2 -.5\dimen4 + \edef\FLOWdx{\the\dimen0}% + \edef\FLOWdy{\the\dimen2}} + +\def\positionFLOWzero% assumes \FLOWdx and \FLOWdy are set + {\setbox0\hbox{\hskip\FLOWdx\lower\FLOWdy\box0}% + \smashbox0\box0 + \nointerlineskip} % new, needed since we somehow reset that + +\def\doFLOWtlabel#1#2#3% + {\scratchdimen\ifcase#2 \zeropoint\else\@@FLOWdy\fi + \setbox0\hbox{\hskip\dimen2\raise\scratchdimen + \hbox{\raise\dimen4\hbox{#1{\strut#3}}}}% + \positionFLOWzero}% + +\def\doFLOWblabel#1#2#3% + {\scratchdimen\ifcase#2 \zeropoint\else\@@FLOWdy\fi + \setbox0\hbox{\hskip\dimen2\raise-\scratchdimen + \hbox{#1{\strut#3}}}% + \positionFLOWzero}% + +\def\doFLOWllabel#1#2#3% + {\scratchdimen\ifcase#2 \zeropoint\else\@@FLOWdx\fi + \setbox0\hbox{\hskip-\scratchdimen\raise\dimen6 + \hbox{#1{\strut#3}}}% + \positionFLOWzero}% + +\def\doFLOWrlabel#1#2#3% + {\scratchdimen\ifcase#2 \zeropoint\else\@@FLOWdx\fi + \setbox0\hbox{\hskip\dimen0\hskip\scratchdimen + \hbox{\raise\dimen6\hbox{#1{\strut#3}}}}% + \positionFLOWzero} + +\def\doprocessFLOWcellD#1,#2\end + {\dophaseoneFLOWcellX{#1}{#2}% + \ifdone + \dophasetwoFLOWcellX + \doglobal\addtocommalist\FLOWcell\FLOWcells + \def\FLOWx{#1}% + \def\FLOWy{#2}% + \directsetup{flowcell}% + \setbox0\hbox + {\ifx\FLOWalign\empty\else + \setupframed + [\c!align=\v!normal,\c!bottom=\vfill,\c!top=\vfill]% + \@EA\processallactionsinset\@EA + [\FLOWalign] + [t=>{\setupframed[\c!bottom=\vfill,\c!top=]}, + b=>{\setupframed[\c!bottom=,\c!top=\vfill]}, + l=>{\setupframed[\c!align=\v!right]}, + r=>{\setupframed[\c!align=\v!left]}, + m=>{\setupframed[\c!align=\v!middle]}, + c=>{\setupframed[\c!align=\v!middle]}]% + \fi + \doifelse\FLOWshape{none} % {\v!none} + {\setupframed[\c!offset=\v!overlay]} + {\setupframed[\c!offset=\@@FLOSoffset]}% + \framed + [\c!frame=\v!off,\c!background=flowcell, + \c!width=\FLOWshapewidth,\c!height=\FLOWshapeheight] + {\FLOWtext}}% + \showFLOWhelp0 + \ifx\FLOWdestination\empty\else + \setbox0\hbox + {\setupinteraction[\c!color=,\c!contrastcolor=]% + \gotobox{\box0}[\FLOWdestination]}% + \fi + \positionFLOWzero + \dimen0=\FLOWshapewidth \dimen2=.5\dimen0 + \dimen4=\FLOWshapeheight\dimen6=.5\dimen4 + \boxoffset.5\bodyfontsize + \doFLOWtlabel \righttopbox0\tFLOWlabel + \doFLOWblabel\rightbottombox0\bFLOWlabel + \doFLOWllabel \lefttopbox0\lFLOWlabel + \doFLOWrlabel \righttopbox0\rFLOWlabel + \doFLOWtlabel \topbox0\tcFLOWlabel % for me only + \doFLOWblabel \bottombox0\bcFLOWlabel % for me only + \doFLOWllabel \leftbox0\lcFLOWlabel % for me only + \doFLOWrlabel \rightbox0\rcFLOWlabel % for me only + \ifnum#1=\@@FLOWx\relax \doFLOWllabel \leftbox1\lFLOWexit \fi + \ifnum#1=\!!countc \doFLOWrlabel \rightbox1\rFLOWexit \fi + \ifnum#2=\@@FLOWy\relax \doFLOWtlabel \topbox1\tFLOWexit \fi + \ifnum#2=\!!countd \doFLOWblabel \bottombox1\bFLOWexit \fi + \boxoffset\zeropoint + \fi} + +% For Willy Egger: +% +% \startsetups flowcell +% \definelayer +% [flowcell] +% [width=\FLOWshapewidth, +% height=\FLOWshapeheight] +% \setlayerframed +% [flowcell] +% [preset=rightbottom,offset=1ex] +% [frame=off] +% {\tx(\FLOWx,\FLOWy)} +% \stopsetups + +% Pass E + +\long\def\startFLOWcellE#1\stopFLOWcell + {\resetFLOWcell + \ignorespaces#1\unskip + \let\doprocessFLOWcell\doprocessFLOWcellE + \expandafter\doprocessFLOWcell\FLOWlocation\end} + +\def\doprocessFLOWcellE#1,#2\end % redundant + {\ifx\FLOWoverlay\empty \else + \dophaseoneFLOWcellX{#1}{#2}% + \ifdone + \dophasetwoFLOWcellX + \edef\FLOWdx{\the\dimen0}% + \edef\FLOWdy{\the\dimen2}% + \setbox0\hbox + {\framed + [%\c!frame=\v!off, + \c!background={\@@FLOWbackground,\FLOWoverlay}, + \c!backgroundcolor=\@@FLOSbackgroundcolor, + \c!width=\FLOWshapewidth,\c!height=\FLOWshapeheight] + {}}% + \positionFLOWzero + \fi + \fi} + +% Pass F + +\def\checkFLOWautofocus + {\def\@@FLOWminx{100}\let\@@FLOWminy\@@FLOWminx + \def\@@FLOWmaxx {0}\let\@@FLOWmaxy\@@FLOWmaxx + \def\@@FLOWabsx {0}\let\@@FLOWabsy\@@FLOWabsx + \let\startFLOWcell\startFLOWcellF + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber + %\message{AUTOSHAPE 1: (\@@FLOWminx,\@@FLOWminy)->(\@@FLOWmaxx,\@@FLOWmaxy)}% + \ifnum\@@FLOWabsx<\@@FLOWmaxx\let\@@FLOWmaxx\@@FLOWabsx\fi + \ifnum\@@FLOWabsy<\@@FLOWmaxy\let\@@FLOWmaxy\@@FLOWabsy\fi + %\message{AUTOSHAPE 2: (\@@FLOWminx,\@@FLOWminy)->(\@@FLOWmaxx,\@@FLOWmaxy)}% + \donetrue + \ifnum\@@FLOWminx=100 \donefalse\fi + \ifnum\@@FLOWminy=100 \donefalse\fi + \ifnum\@@FLOWmaxx=0 \donefalse\fi + \ifnum\@@FLOWmaxy=0 \donefalse\fi + \doFLOWcheckF\@@FLOWx\@@FLOWminx\@@FLOWmaxx\@@FLOWnx + \doFLOWcheckF\@@FLOWy\@@FLOWminy\@@FLOWmaxy\@@FLOWny} + +\def\startFLOWcellF#1\stopFLOWcell% + {\resetFLOWcell + \ignorespaces#1\unskip + \expandafter\doFLOWlocationF\FLOWlocation\end}% + +\def\doFLOWlocationF#1,#2\end% + {\ifnum#1>\@@FLOWabsx\def\@@FLOWabsx{#1}\fi + \ifnum#2>\@@FLOWabsy\def\@@FLOWabsy{#2}\fi + \doifinset\FLOWcell\@@FLOWautofocus + {\dodoFLOWlocationF{#1}<-\@@FLOWminx + \dodoFLOWlocationF{#1}>+\@@FLOWmaxx + \dodoFLOWlocationF{#2}<-\@@FLOWminy + \dodoFLOWlocationF{#2}>+\@@FLOWmaxy}} + +\def\dodoFLOWlocationF#1#2#3#4% + {\ifnum#1#2#4\relax + \!!counta=#1\advance\!!counta #31\relax + \edef#4{\ifnum\!!counta<1 1\else\the\!!counta\fi}% + \fi} + +\def\doFLOWcheckF#1#2#3#4% + {\ifdone + \let#1=#2% + \!!counta=#3% + \advance\!!counta \plusone\advance\!!counta -#2\relax + \ifnum\!!counta<1 \!!counta=1 \fi + \edef#4{\the\!!counta}% + \else + \let#1\!!plusone + \let#4\!!zerocount % no {1} + \fi} + +% \useFLOWchart[name][parent][setting,setting][additional settings] +% \useFLOWchart[name][parent][additional settings] + +\let\currentFLOWchart\empty + +\def\useFLOWchart + {\doquadrupleempty\douseFLOWchart} + +\def\douseFLOWchart[#1][#2][#3][#4]% name parent sets mainsettings + {\iffourthargument + \setvalue{\@FLOW@--#1}[##1]{\setgetFLOWchart[#2][#3][#4,##1]}% + \else + \checkparameters[#3]% + \ifparameters + \setvalue{\@FLOW@--#1}[##1]{\setgetFLOWchart[#2][][#3,##1]}% + \else + \setvalue{\@FLOW@--#1}[##1]{\setgetFLOWchart[#2][#3][##1]}% + \fi + \fi} + +\def\setgetFLOWchart[#1][#2][#3]% + {\def\docommand##1{}% cell line focus ? + \processcommalist[#2]\docommand + \getFLOWchart[#1][#3]} + +\def\doFLOWchart[#1][#2]% + {\hbox\bgroup\vbox\bgroup % vmode suppresses spaces +\def\currentFLOWchart{#1}% + \doifundefinedelse{\@FLOW@--#1} + {\getFLOWchart[#1][#2]} + {\getvalue{\@FLOW@--#1}[#2]}% + \egroup\egroup} + +\def\FLOWchart% + {\dodoubleempty\doFLOWchart} + +%D A hook into the help system. + +% \def\showFLOWhelp#1% +% {\doifhelpinfo\FLOWhelp +% {\setbox#1=\hbox +% {\setbox\scratchbox=\hbox{\lower\@@FLOWdy\hbox +% {\helpbutton +% [\c!width=\wd0,\c!color=,\c!height=\@@FLOWdy,\c!frame=\v!no]% +% [\FLOWhelp]}}% +% \smashbox\scratchbox +% \setbox#1=\vbox +% {\forgetall\offinterlineskip\box#1\box\scratchbox}% +% \box#1}}} + +\def\showFLOWhelp#1% + {} + +%D The next section is dedicated to splitting up charts. + +\def\getFLOWsize[#1]% + {\bgroup\let\dodogetFLOWchart\dogetFLOWsize\FLOWchart[#1]\egroup} + +\def\dogetFLOWsize[#1][#2]% + {\setbox\scratchbox=\vbox + {\globallet\FLOWmaxwidth \!!zerocount + \globallet\FLOWmaxheight\!!zerocount + \def\getFLOWlocation##1,##2\end + {\ifnum0##1>\FLOWmaxwidth \xdef\FLOWmaxwidth {##1}\fi + \ifnum0##2>\FLOWmaxheight\xdef\FLOWmaxheight{##2}\fi}% + \resetFLOWcell + \long\def\startFLOWcell##1\stopFLOWcell + {{##1\expandafter\getFLOWlocation\FLOWlocation\end}}% + \def\dohandleflowchart[##1][##2]% + {\resetFLOWlocation + \processFLOWbuffer{##1}}% + \getvalue{\@FLOW@-#1}}} + +\def\setupFLOWsplit% + {\dodoubleargument\getparameters[\@@FLOT]} + +\setupFLOWsplit% + [\c!nx=3,\c!ny=3, + \c!dx=1,\c!dy=1, + \c!command=, + \c!marking=\v!on, + \c!before=,\c!after=] + +\def\FLOWsplitx {1} +\def\FLOWsplity {1} +\def\FLOWsplitnx{1} +\def\FLOWsplitny{1} + +\def\FLOWcharts% + {\dodoubleempty\doFLOWcharts} + +%D While splitting, the following variables are available: +%D +%D \starttyping +%D \FLOWsplitnx \FLOWsplitny \FLOWsplitx \FLOWsplity +%D \stoptyping + +\def\doFLOWcharts[#1][#2]% + {\bgroup + \getFLOWsize[#1]% + \dodoFLOWcharts\relax + \global\let\FLOWsplitnx\FLOWsplitx + \global\let\FLOWsplitny\FLOWsplity + \dodoFLOWcharts{\dododoFLOWcharts[#1][#2]}% + \egroup} + +\def\dodoFLOWcharts#1% + {\def\@@FLOTx{1}% + \global\let\FLOWsplitx\@@FLOTx + \doloop + {\def\@@FLOTy{1}% + \global\let\FLOWsplity\@@FLOTy + \doloop + {\bgroup + \scratchcounter\FLOWmaxwidth + \advance\scratchcounter -\@@FLOTx + \advance\scratchcounter \plusone + \ifnum\scratchcounter<\@@FLOTnx\edef\@@FLOTnx{\the\scratchcounter}\fi + \scratchcounter\FLOWmaxheight + \advance\scratchcounter -\@@FLOTy + \advance\scratchcounter \plusone + \ifnum\scratchcounter<\@@FLOTny\edef\@@FLOTny{\the\scratchcounter}\fi + #1% does something with the float, or not + \egroup + \increment(\@@FLOTy,\@@FLOTny)% + \ifnum\@@FLOTy>\FLOWmaxheight + \exitloop + \else + \doglobal\increment\FLOWsplity + \decrement(\@@FLOTy,\@@FLOTdy)% + \fi}% + \increment(\@@FLOTx,\@@FLOTnx)% + \ifnum\@@FLOTx>\FLOWmaxwidth + \exitloop + \else + \doglobal\increment\FLOWsplitx + \decrement(\@@FLOTx,\@@FLOTdx)% + \fi}} + +\def\dododoFLOWcharts[#1][#2]% + {\bgroup + \@@FLOTbefore + \doifnot\@@FLOTmarking\v!on{\let\cuthbox\hbox}% + \cuthbox + {\@@FLOTcommand + {\FLOWchart[#1][#2, + \c!x=\@@FLOTx,\c!nx=\@@FLOTnx, + \c!y=\@@FLOTy,\c!ny=\@@FLOTny]}}% + \@@FLOTafter + \egroup} + +%D An example of splitting is given below: +%D +%D \starttyping +%D \setupFLOWsplit +%D [nx=5,ny=10, +%D dx=0,dy=0, +%D before=, +%D after=\page] +%D +%D \FLOWcharts[mybigflow] +%D \stoptyping +%D +%D Or, one can say: +%D +%D \starttyping +%D \splitfloat +%D {\placefigure{What a big flowchart this is!}} +%D {\FLOWcharts[mybigflow]} +%D \stoptyping + +%D \macros +%D {typeFLOWchart} +%D +%D For documentation purposes the following macro is +%D provided. Watch the use of the first and last line hooks, +%D which is needed because the start and stop commands are +%D not part of the buffer. + +\def\typeFLOWchart[#1]% + {\bgroup + \def\dohandleflowchart[##1][##2]{\typeFLOWbuffer{##1}}% + \defconvertedargument\firstverbatimfileline{\startFLOWchart[#1]}% + \defconvertedargument\lastverbatimfileline {\stopFLOWchart}% + \getvalue{\@FLOW@-#1} + \egroup} + +%D New: +%D +%D \starttyping +%D \setupFLOWcharts[command=\Whow] +%D +%D \startFLOWset[convert-en] % [tag][convert-en] +%D \subFLOWchart[a][x=1,y=1,nx=3,ny=3] +%D \subFLOWchart[b][x=1,y=2,nx=3,ny=3] +%D \subFLOWchart[c][x=2,y=1,nx=3,ny=3] +%D \stopFLOWset +%D +%D \def\Whow#1% +%D {\ifnum\currentFLOWset=1 \framed{Some Chart}\fi} +%D +%D \FLOWset[convert-en] % [tag] +%D +%D \def\Whow#1% +%D {\setuphead[state=high] +%D \startstandardmakeup +%D \centerbox{#1} +%D \stopstandardmakeup} +%D +%D \FLOWset[convert-en] % [tag] +%D \stoptyping + +\def\startFLOWset + {\dodoubleempty\dostartFLOWset} + +\def\dostartFLOWset[#1][#2]#3\stopFLOWset % tag name data + {\ifsecondargument + \long\setvalue{\@FLOX@#1}{\dohandleFLOWset{#1}{#2}{#3}}% + \else + \long\setvalue{\@FLOX@#1}{\dohandleFLOWset{#1}{#1}{#3}}% + \fi} + +\long\def\dohandleFLOWset#1#2#3% tag name data + {\bgroup + \def\subFLOWchart + {\dodoubleempty\dosubFLOWchart}% + \def\dosubFLOWchart[##1][##2]% subtag settings + {\ifsecondargument + \dodohandleFLOWset{#1}{##1}{#2}{##2}% + \else + \subFLOWchart[][##1]% + \fi}% + #3% + \egroup} + +\def\dodohandleFLOWset#1#2#3#4% tag subtag name settings + {\increment\currentFLOWset + \bgroup + \@@FLOXcommand + {\ifnum\currentFLOWset=1 \pagereference[#1]\fi + \doifsomething{#2} + {\setupreferencing[\c!prefix=]% + \pagereference[#1:#2]% -:#1:#2 + \setupreferencing[\c!prefix=#1:#2]}% + \FLOWchart[#3][#4]}% + \egroup} + +\def\FLOWset[#1]% + {\newcounter\currentFLOWset + \doifdefinedelse{\@FLOX@#1} + {\getvalue{\@FLOX@#1}} + {\dodohandleFLOWset{#1}{}{#1}{}}} + +\newcounter\currentFLOWset + +\setupFLOWsets + [\c!command=] + +%D This will be an option: + +% \def\startFLOWchart% +% {\dodoubleempty\dostartFLOWchart} +% +% \long\def\dostartFLOWchart[#1][#2]#3\stopFLOWchart +% {\preparenextFLOWchart{#1}{#2}% +% \long\setgvalue{\FLOWbufferprefix\nofFLOWcharts}{#3}} +% +% \long\def\dodefineFLOWchart[#1][#2]#3% +% {\preparenextFLOWchart{#1}{#2}% +% \long\setgvalue{\FLOWbufferprefix\nofFLOWcharts}{#3}} +% +% \def\processFLOWbuffer#1{\getvalue{\FLOWbufferprefix#1}} +% \def\typeFLOWbuffer #1{[Sorry, no verbatim chart #1 available.]} +% todo: \localpushmacro/\localpopmacro (dohandleflowchart etc) +% todo: make mkiv variant +% todo: use dimexpr/numspr + +% will be redone with layers and dimexpr or even better, by just using +% textext .. a nice example of old code + +%D This is an experimental module. Pieces of code will be moved +%D to other modules. More features are possible but will be +%D interfaces later. +%D +%D When finished this module will be documented. The main macro +%D is still a rather big one and there is some redundant and +%D slow code that needs a clean up. + +% arrow, dash +% crossing +% \goto -> \normalgoto +% class -> class:name (ref prefix) +% c, automatisch geen overlap zoeken +% eind eerder chart connecties +% relateren aan korps +% check op bestaan naam, bestaan shape +% auto als extern figuur +% subchart +% pijlen +% focus +% ook nog \MPmessage +% areapath -> krappe vlak +% clippath -> gehele vlak +% +% offset : clip offset +% breedte : breedte cel +% hoogte : hoogte cel +% dx : halve afstand in breedte (grid breedte = breedte + 2dx) +% dy : halve afstand in hoogte (grid hoogte = hoogte + 2dy) +% x : x offset (clipping) +% y : y offset (clipping) +% nx : minimaal aantal cellen horizontaal +% ny : minimaal aantal cellen vertikaal +% +% shape none en geen equivalent maken +% +% kaderkleur achtergrondkleur +% lijnkleur lijndikte +% focus focuskaderkleur focusachtergrondkleur +% richting +% +% focus koppelen aan kleur + +\unprotect + +\definesorting [flowchart] [flowcharts] [\v!none] % no access +\setupsorting [flowchart] [\c!state=\v!stop] % off by default + +\def\@FLOW@{@FLOW@} +\def\@FLOC@{@FLOC@} +\def\@FLOX@{@FLOX@} + +\def\@@FLOW{@@FLOW} +\def\@@FLOL{@@FLOL} +\def\@@FLOS{@@FLOS} +\def\@@FLOF{@@FLOF} +\def\@@FLOT{@@FLOT} +\def\@@FLOX{@@FLOX} + +\def\@@MPx {@@MPx} +\def\@@MPy {@@MPy} + +\def\FLOWbufferprefix{flw-} + +\def\processFLOWbuffer#1{\getbuffer[\FLOWbufferprefix#1]} +\def\typeFLOWbuffer #1{\typebuffer[\FLOWbufferprefix#1]} + +\def\setFLOWname#1#2% funny hack that makes sure that we get + {\bgroup % names that are acceptable for METAPOST + \lccode`0=`a\lccode`1=`b\lccode`2=`c\lccode`3=`d\lccode`4=`e% + \lccode`5=`f\lccode`6=`g\lccode`7=`h\lccode`8=`i\lccode`9=`j% + \lccode` =`\_\lccode`-=`\_\lccode`_=`\_% + \lowercase{\gdef#1{#2}}% + \egroup} + +% een gobble als default is sneller, en dan alleen setten als +% nodig + +\def\resetFLOWcell + {% variables + \global\let\FLOWname \empty + \global\let\FLOWalign \empty + \global\let\FLOWshape \empty + \global\let\FLOWlocation \empty + \global\let\FLOWtext \empty + \global\let\FLOWhelp \empty + \global\let\FLOWdestination\empty + \global\let\FLOWoverlay \empty + \global\let\FLOWfocus \empty + \global\let\tFLOWlabel \empty + \global\let\bFLOWlabel \empty + \global\let\lFLOWlabel \empty + \global\let\rFLOWlabel \empty + \global\let\bcFLOWlabel \empty + \global\let\tcFLOWlabel \empty + \global\let\lcFLOWlabel \empty + \global\let\rcFLOWlabel \empty + \global\let\tFLOWexit \empty + \global\let\bFLOWexit \empty + \global\let\lFLOWexit \empty + \global\let\rFLOWexit \empty + % commands + \let\name \doFLOWname + \let\shape \doFLOWshape + \let\destination\doFLOWdestination + \let\location \doFLOWlocation + \let\focus \doFLOWfocus + \let\overlay \doFLOWoverlay + \let\figure \doFLOWfigure + \let\text \doFLOWtext + \let\comment \doFLOWcomment + \let\label \doFLOWlabel + \let\help \doFLOWhelp + \let\connection \doFLOWconnection + \let\exit \doFLOWexit + % convenience commands + \let\locate \doFLOWlocate + \let\connect \doFLOWconnect} + +\let\FLOWcell \s!unknown +\let\FLOWshape \s!unknown +\let\FLOWdestination\s!unknown +\let\FLOWfocus \s!unknown +\let\FLOWoverlay \empty +\let\FLOWtext \empty + +\def\doFLOWname#1% + {\def\FLOWcell{#1}\setFLOWname\FLOWname{name_#1}\ignorespaces} + +\def\doFLOWshape#1% + {\gdef\FLOWshape{#1}\ignorespaces} + +\def\doFLOWdestination#1% + {\gdef\FLOWdestination{#1}\ignorespaces} + +\def\doFLOWlocation#1% + {\setFLOWlocation#1\end\ignorespaces} + +\def\doFLOWfocus#1% + {\gdef\FLOWfocus{#1}\ignorespaces} + +\def\doFLOWoverlay#1% + {\gdef\FLOWoverlay{#1}\ignorespaces} + +\def\doFLOWfigure#1% + {\defineoverlay[\s!dummy][\overlayfigure{#1}]% + \overlay\s!dummy} + +\def\doFLOWtext + {\dosingleempty\dodoFLOWtext} + +\def\dodoFLOWtext[#1]% % #2% + {\gdef\FLOWalign{#1}\gdef\FLOWtext}% {#2}} + +\def\doFLOWcomment[#1]#2% + {\ignorespaces\dogobblesingleempty} + +\def\doFLOWlabel[#1]#2% wordt dit gebruikt ? + {\setgvalue{#1FLOWlabel}{#2}\ignorespaces} + +\def\doFLOWhelp#1% + {\gdef\FLOWhelp{#1}\ignorespaces} + +\def\doFLOWconnection + {\dodoubleempty\dodoFLOWconnection} + +\def\dodoFLOWconnection[#1][#2]#3% + {\ignorespaces} + +\def\doFLOWconnect + {\connection} + +\def\doFLOWlocate + {\location} + +\def\doFLOWexit[#1]#2% + {\setgvalue{#1FLOWexit}{#2}\ignorespaces} + +\def\startFLOWchart + {\bgroup + \let\stopFLOWchart\egroup + \obeylines % lelijk, buffers nog eens fatsoeneren + \dodoubleempty\dostartFLOWchart} + +\def\dostartFLOWchart[#1][#2]% + {\preparenextFLOWchart{#1}{#2}% + \dostartbuffer[\FLOWbufferprefix\nofFLOWcharts][startFLOWchart][stopFLOWchart]} + +\def\defineFLOWchart% + {\dodoubleempty\dodefineFLOWchart} + +\long\def\dodefineFLOWchart[#1][#2]#3% + {\preparenextFLOWchart{#1}{#2}% + \setbuffer[\FLOWbufferprefix\nofFLOWcharts]#3\endbuffer} + +\def\preparenextFLOWchart#1#2% + {\doglobal\increment\nofFLOWcharts + \flowchart{#1}% + \setxvalue{\@FLOW@-#1}{\noexpand\dohandleflowchart[\nofFLOWcharts][#2]}} + +\def\setupFLOWcharts{\dodoubleargument\getparameters[\@@FLOW]} +\def\setupFLOWlines {\dodoubleargument\getparameters[\@@FLOL]} +\def\setupFLOWshapes{\dodoubleargument\getparameters[\@@FLOS]} +\def\setupFLOWfocus {\dodoubleargument\getparameters[\@@FLOF]} +\def\setupFLOWsets {\dodoubleargument\getparameters[\@@FLOX]} + +\setupFLOWcharts + [\c!option=, + \c!bodyfont=, + \c!dot=, % private option + \c!width=12\bodyfontsize, + \c!height=7\bodyfontsize, + \c!maxwidth=, + \c!maxheight=, + \c!offset=\v!standard, % == auto offset + \c!dx=2\bodyfontsize, + \c!dy=2\bodyfontsize, + \c!nx=0, % 1, + \c!ny=0, % 1, + \c!x=1, + \c!y=1, + \c!autofocus=, + \c!focus=, + \c!background=, % \v!color, + \c!backgroundcolor=\s!white, + \c!rulethickness=\linewidth, + \c!frame=\v!off, + \c!framecolor=] + +\setupFLOWlines + [\c!corner=\v!round, + \c!arrow=\v!yes, + \c!dash=\v!no, + \c!radius=.375\bodyfontsize, % 2.5\c!rulethickness + \c!color=FLOWlinecolor, + \c!rulethickness=.15\bodyfontsize, % 2pt, + \c!offset=\v!none] + +\setupFLOWshapes + [\c!default=action, + \c!framecolor=FLOWframecolor, + \c!background=\v!color, + \c!backgroundcolor=FLOWbackgroundcolor, + \c!backgroundscreen=\@@rsscreen, + \c!rulethickness=.15\bodyfontsize, % 2pt, + \c!offset=.5\bodyfontsize] + +\setupFLOWfocus + [\c!framecolor=FLOWfocuscolor, + \c!background=\@@FLOSbackground, + \c!backgroundcolor=\@@FLOSbackgroundcolor, + \c!backgroundscreen=\@@FLOSbackgroundscreen, + \c!rulethickness=\@@FLOSrulethickness, + \c!offset=\@@FLOSoffset] + +\definecolor [FLOWfocuscolor] [s=.2] +\definecolor [FLOWlinecolor] [s=.5] +\definecolor [FLOWframecolor] [s=.7] +\definecolor [FLOWbackgroundcolor] [s=.9] + +\newcounter\includeFLOWx +\newcounter\includeFLOWy + +\def\includeFLOWchart + {\dodoubleempty\doincludeFLOWchart} + +\def\doincludeFLOWchart[#1][#2]% + {\pushmacro\includeFLOWx + \pushmacro\includeFLOWy + \getparameters[FLOWi][x=1,y=1,#2]% + \increment(\includeFLOWx,0\FLOWix)\decrement\includeFLOWx + \increment(\includeFLOWy,0\FLOWiy)\decrement\includeFLOWy + \def\dodoincludeFLOWchart##1% + {\doifdefined{\@FLOW@-##1} + {\globalpushmacro\dohandleflowchart % was local + \gdef\dohandleflowchart[####1][####2]% + {\globalpopmacro\dohandleflowchart % was local + \resetFLOWlocation + \processFLOWbuffer{####1}}% + \getvalue{\@FLOW@-##1}}}% + \processcommalist[#1]\dodoincludeFLOWchart + \popmacro\includeFLOWx + \popmacro\includeFLOWy} + +\def\resetFLOWlocation + {\globallet\lastFLOWx\!!zerocount + \globallet\lastFLOWy\!!zerocount} + +\def\dosetFLOWlocation[#1#2]#3#4% + {\processaction + [#1#2] + [ +=>\scratchcounter\numexpr#4+ 1+#3\relax, + -=>\scratchcounter\numexpr#4- 1+#3\relax, + +#2=>\scratchcounter\numexpr#4+#2+#3\relax, + -#2=>\scratchcounter\numexpr#4-#2+#3\relax, + \s!default=>\scratchcounter\numexpr#4 +#3\relax, + \s!unknown=>\scratchcounter\numexpr0#1#2+#3\relax]% + \xdef#4{\the\scratchcounter}} + +\def\setFLOWlocation#1,#2\end + {\dosetFLOWlocation[#1\empty]\includeFLOWx\lastFLOWx + \dosetFLOWlocation[#2\empty]\includeFLOWy\lastFLOWy + \xdef\FLOWlocation{\lastFLOWx,\lastFLOWy}} + +\def\FLOWshapes + {node, action, procedure, product, decision, archive, + loop, wait, subprocedure, singledocument, multidocument, + sub procedure, single document, multi document, up, down, + left, right} + +\def\FLOWlines + {up, down, left, right} + +\def\FLOWsetconnect#1% + {\donefalse + \let\cFLOWfrom\empty + \let\cFLOWto\empty + \let\zFLOWfrom\!!zerocount + \let\zFLOWto\!!zerocount + \handletokens#1\with\doFLOWsetconnect + \ifx\cFLOWto\empty\let\cFLOWfrom\empty\fi} + +\def\doFLOWsetconnect#1% + {\ifx #1p% + \ifdone\def\zFLOWto{+1}\else\def\zFLOWfrom{+1}\fi + \else\ifx#1+% + \ifdone\def\zFLOWto{+1}\else\def\zFLOWfrom{+1}\fi + \else\ifx#1n% + \ifdone\def\zFLOWto{-1}\else\def\zFLOWfrom{-1}\fi + \else\ifx#1-% + \ifdone\def\zFLOWto{-1}\else\def\zFLOWfrom{-1}\fi + \else\ifdone + \edef\cFLOWto{\FLOWconnector#1}% + \else + \edef\cFLOWfrom{\FLOWconnector#1}% + \donetrue + \fi\fi\fi\fi\fi} + +\def\FLOWconnector#1% + {\if#1bbottom\else\if#1ttop\else\if#1lleft\else\if#1rright\fi\fi\fi\fi} + +\newif\ifFLOWscaling \FLOWscalingtrue + +\def\@@FLOW@@offset{\@@FLOWoffset} + +\def\getFLOWchart + {\dodoubleempty\dogetFLOWchart} + +\def\dogetFLOWchart[#1][#2]% + {\doifundefinedelse{\@FLOW@-#1} + {\writestatus{FLOW}{unknown chart #1}% + \framed + [\c!width=12\bodyfontsize,\c!height=8\bodyfontsize] + {\tttf [chart #1]}} + {\dodogetFLOWchart[#1][#2]}} + +\def\dodogetFLOWchart[#1][#2]% to be split a bit more + {\vbox\bgroup + \insidefloattrue + \forgetall + \dontcomplain + % \offinterlineskip % we now explicitly use \nointerlineskip later on + \def\dohandleflowchart[##1][##2]% + {\def\currentFLOWnumber{##1}% + \getparameters[\@@FLOW][##2]}% + \getvalue{\@FLOW@-#1}% + \getparameters[\@@FLOW][#2]% dubbelop ? + \doifsomething{\@@FLOWautofocus} + {\checkFLOWautofocus}% + %\message{AUTOSHAPE 3: (\@@FLOWx,\@@FLOWy)->(\@@FLOWnx,\@@FLOWny)}\wait + \global\let\FLOWwidth \@@FLOWnx + \global\let\FLOWheight\@@FLOWny + \let\startFLOWcell\startFLOWcellA + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber + \ifcase\@@FLOWnx\relax \let\@@FLOWnx\FLOWwidth \fi + \ifcase\@@FLOWny\relax \let\@@FLOWny\FLOWheight \fi + \doifnothing{\@@FLOWmaxwidth\@@FLOWmaxheight}{\FLOWscalingfalse}% + \ifFLOWscaling + \doifnothing{\@@FLOWmaxwidth }{\let\@@FLOWmaxwidth \maxdimen}% + \doifnothing{\@@FLOWmaxheight}{\let\@@FLOWmaxheight\maxdimen}% + \scratchcounter\bodyfontpoints + \doloop % NOG FONTSWITCH OM EX EN EM TE LATEN WERKEN + {\ifnum\scratchcounter>1 % NU DIMENSIONS IN TERMS OF BODYFONTSIZE + \bodyfontsize=\the\scratchcounter pt + \dimen0=\@@FLOWmaxwidth + \dimen2=\@@FLOWwidth + \dimen4=\@@FLOWdx + \advance\dimen2 2\dimen4 + \dimen2=\@@FLOWnx\dimen2 + \advance\dimen2 2\dimen4 + \ifdim\dimen2>\dimen0 + \advance\scratchcounter \minusone + \else + \dimen0=\@@FLOWmaxheight + \dimen2=\@@FLOWheight + \dimen4=\@@FLOWdy + \advance\dimen2 2\dimen4 + \dimen2=\@@FLOWny\dimen2 + \advance\dimen2 2\dimen4 + \ifdim\dimen2>\dimen0 + \advance\scratchcounter \minusone + \else + \exitloop + \fi + \fi + \else + \exitloop + \fi}% + \expanded{\switchtobodyfont[\the\scratchcounter pt]}% + \forgetall + % \offinterlineskip % needed ? + \else\ifx\@@FLOWbodyfont\empty\else + \expanded{\switchtobodyfont[\@@FLOWbodyfont]}% \expanded ? + \fi\fi + \global\let\FLOWcells\empty + \dimen0=\@@FLOWwidth + \edef\FLOWshapewidth{\the\dimen0}% + \dimen2=\@@FLOWdx + \advance\dimen0 2\dimen2 + \edef\FLOWgridwidth{\the\dimen0}% + \dimen0=\@@FLOWheight + \edef\FLOWshapeheight{\the\dimen0}% + \dimen2=\@@FLOWdy + \advance\dimen0 2\dimen2 + \edef\FLOWgridheight{\the\dimen0}% + \scratchdimen=\@@FLOSrulethickness + \edef\@@FLOSrulethickness{\the\scratchdimen}% + \scratchdimen=\@@FLOFrulethickness + \edef\@@FLOFrulethickness{\the\scratchdimen}% + \scratchdimen=\@@FLOLrulethickness + \edef\@@FLOLrulethickness{\the\scratchdimen}% + \ifdim\@@FLOLradius<2.5\scratchdimen + \scratchdimen=2.5\scratchdimen + \edef\@@FLOLradius{\the\scratchdimen}% + \ifdim\@@FLOLradius>\@@FLOWdx + \scratchdimen=\@@FLOWdx + \edef\@@FLOLradius{\the\scratchdimen}% + \fi + \ifdim\@@FLOLradius>\@@FLOWdy + \scratchdimen=\@@FLOWdy + \edef\@@FLOLradius{\the\scratchdimen}% + \fi + \else + \scratchdimen=\@@FLOLradius + \edef\@@FLOLradius{\the\scratchdimen}% + \fi + \processaction % magic 2.5 + [\@@FLOWoffset] + [ \v!none=>\scratchdimen=-2.5\scratchdimen, + \v!overlay=>\scratchdimen=-2.5\scratchdimen, + \v!standard=>\scratchdimen=\scratchdimen, + \s!unknown=>\scratchdimen=\@@FLOWoffset, + \s!default=>\scratchdimen=-2.5\scratchdimen]% + \edef\@@FLOW@@offset{\the\scratchdimen}% + \forgetall + \offinterlineskip + \resetMPdrawing + \doglobal\newcounter\FLOWcomment + \startMPdrawing + if unknown context_char : input mp-char.mp ; fi ; + grid_width := \FLOWgridwidth ; + grid_height := \FLOWgridheight ; + shape_width := \FLOWshapewidth ; + shape_height := \FLOWshapeheight ; + connection_line_width := \@@FLOLrulethickness ; + connection_smooth_size := \@@FLOLradius ; + connection_arrow_size := \@@FLOLradius ; + connection_dash_size := \@@FLOLradius ; + currentpicture := nullpicture ; + begin_chart(0,\FLOWwidth,\FLOWheight); + reverse_y := true ; + chart_offset := \@@FLOW@@offset ; + \stopMPdrawing + \doifelsenothing\@@FLOWbackgroundcolor + {\startMPdrawing + chart_background_color := white ; + \stopMPdrawing} + {\startMPdrawing + chart_background_color := \MPcolor{\@@FLOWbackgroundcolor} ; + \stopMPdrawing}% + \doif\@@FLOWoption\v!test + {\startMPdrawing + show_con_points := true ; + show_mid_points := true ; + show_all_points := true ; + \stopMPdrawing}% + \processaction % private + [\@@FLOWdot] + [ \v!yes=>\startMPdrawing + show_con_points := true ; + show_mid_points := true ; + show_all_points := true ; + \stopMPdrawing, + \s!unknown=>\startMPdrawing + show_\@@FLOWdot _points := true ; + \stopMPdrawing]% +\doglobal\newcounter\FLOWcomment + \let\startFLOWcell\startFLOWcellB + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber +\doglobal\newcounter\FLOWcomment + \let\startFLOWcell\startFLOWcellC + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber + \startMPdrawing + clip_chart(\@@FLOWx,\@@FLOWy,\@@FLOWnx,\@@FLOWny) ; + end_chart ; + \stopMPdrawing + \MPdrawingdonetrue + \setbox0\hbox + {\MPstaticgraphictrue + \MPshiftdrawingfalse + \getMPdrawing}% + \def\MPmessage##1% + {\writestatus{MP charts}{##1}}% + \def\MPposition##1##2##3% + {\setvalue{\@@MPx##1}{##2}\setvalue{\@@MPy##1}{##3}}% + \def\MPclippath##1##2##3##4% + {\def\clipMPllx{##1bp}\def\clipMPlly{##2bp}% + \def\clipMPurx{##3bp}\def\clipMPury{##4bp}}% + \def\MPareapath##1##2##3##4% + {\def\areaMPllx{##1bp}\def\areaMPlly{##2bp}% + \def\areaMPurx{##3bp}\def\areaMPury{##4bp}}% + \getMPdata + \doglobal\newcounter\FLOWcomment + \let\startFLOWcell\startFLOWcellD + \setbox2\vbox to \ht0 + {\forgetall % \offinterlineskip + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber\vss}% + \setbox2\hbox + {\hskip\@@FLOW@@offset\lower\@@FLOW@@offset\box2}% + \wd2\wd0\ht2\ht0\dp2\dp0 + \let\startFLOWcell\startFLOWcellE + \setbox4\vbox to \ht0 + {\forgetall % \offinterlineskip + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber\vss}% + \setbox4\hbox + {\hskip\@@FLOW@@offset\lower\@@FLOW@@offset\box4}% + \wd4\wd0\ht4\ht0\dp4\dp0 + \doifelse\@@FLOWoption\v!test + {\setbox6\vbox + {\forgetall + \vskip\@@FLOW@@offset + \hskip\@@FLOW@@offset + \basegrid + [\c!x=\@@FLOWx,\c!nx=\@@FLOWnx,\c!dx=\withoutpt\FLOWgridwidth, + \c!y=\@@FLOWy,\c!ny=\@@FLOWny,\c!dy=\withoutpt\FLOWgridheight, + \c!xstep=1,\c!ystep=1, + \c!unit=pt,\c!location=\v!middle]}% + \wd6\wd0\ht6\ht0\dp6\dp0 + \setbox8\vbox + {\forgetall + \offinterlineskip + \vskip\@@FLOW@@offset + \dostepwiserecurse\@@FLOWy\@@FLOWny\plusone + {\vbox to \FLOWgridheight + {\vfill + \hskip\@@FLOW@@offset + \hbox + {\dostepwiserecurse\@@FLOWx\@@FLOWnx\plusone + {\hbox to \FLOWgridwidth + {\hfill + \framed + [\c!framecolor=red, + \c!width=\FLOWshapewidth, + \c!height=\FLOWshapeheight] + {}% + \hfill}}} + \vfill}}}% + \wd8\wd0\ht8\ht0\dp8\dp0 + \framed + [\c!offset=\v!overlay,\c!framecolor=green] + {\hbox{\box4\hskip-\wd0\box0\hskip-\wd2\box2\hskip-\wd6\box6\hskip-\wd8\box8}}} + {\framed + [\c!offset=\v!overlay, + \c!frame=\@@FLOWframe, + \c!rulethickness=\@@FLOWrulethickness, + \c!framecolor=\@@FLOWframecolor, + \c!background=\@@FLOWbackground, + \c!backgroundcolor=\@@FLOWbackgroundcolor] + {\hbox{\box4\hskip-\wd0\box0\hskip-\wd2\box2}}}% + %\message{[\FLOWcells]}\wait + \egroup} + +% Pass A + +\long\def\startFLOWcellA#1\stopFLOWcell% + {\resetFLOWcell + \ignorespaces#1\unskip + \expandafter\getFLOWlocationA\FLOWlocation\end + \ignorespaces} + +\def\getFLOWlocationA#1,#2\end + {\ifnum0#1>\FLOWwidth \xdef\FLOWwidth {#1}\fi + \ifnum0#2>\FLOWheight\xdef\FLOWheight{#2}\fi} + +% Pass B +% +% beware: the - after \@FLOC@ is needed since name can be +% empty and we don't want to redefine \@FLOC@ itself by +% mistake + +\long\def\startFLOWcellB#1\stopFLOWcell + {\resetFLOWcell\ignorespaces#1\unskip + \setxvalue{\@FLOC@-\FLOWname}{\FLOWlocation}% kost veel cs's + \ifx\FLOWshape\empty + \global\let\FLOWshape\@@FLOSdefault + \fi + \doifnot\FLOWshape{none} % {\v!none} + {\doifinsetelse\FLOWshape\FLOWshapes + {\edef\FLOWshapetag{shape_\FLOWshape}% beter \expanded + \@EA\setFLOWname\@EA\FLOWshapetag\@EA{\FLOWshapetag}} + {\doifnumberelse\FLOWshape + {\let\FLOWshapetag\FLOWshape} + {\let\FLOWshapetag\empty}}% + \ifx\FLOWshapetag\empty \else + \doifinsetelse\FLOWshape\FLOWlines + {\chardef\FLOWstate0 } + {\doifcommonelse{\FLOWcell,\FLOWfocus}\@@FLOWfocus + {\chardef\FLOWstate1 } + {\chardef\FLOWstate2 }}% + \startMPdrawing + begin_sub_chart ; + \ifcase\FLOWstate + shape_line_color := \MPcolor{\@@FLOLcolor} ; + shape_fill_color := \MPcolor{\@@FLOLcolor} ; + shape_line_width := \@@FLOLrulethickness ; + \or + shape_line_color := \MPcolor{\@@FLOFframecolor} ; + shape_fill_color := \MPcolor{\@@FLOFbackgroundcolor} ; + shape_line_width := \@@FLOFrulethickness ; + \or + shape_line_color := \MPcolor{\@@FLOSframecolor} ; + shape_fill_color := \MPcolor{\@@FLOSbackgroundcolor} ; + shape_line_width := \@@FLOSrulethickness ; + \fi + %\ifx\FLOWoverlay\empty + % peepshape := false ; + %\else + % peepshape := true ; + %\fi + peepshape := \ifx\FLOWoverlay\empty false \else true \fi ; + new_shape(\FLOWlocation,\FLOWshapetag) ; + end_sub_chart ; + \stopMPdrawing + \fi}% + \ignorespaces} + +% Pass C + +\long\def\startFLOWcellC#1\stopFLOWcell% + {\resetFLOWcell +\pushmacro\lastFLOWx +\pushmacro\lastFLOWy + \ignorespaces#1\unskip % makes sure that vars are set +\popmacro\lastFLOWy +\popmacro\lastFLOWx + \let\connection\doFLOWconnectionC + \ignorespaces#1\unskip} + +\def\FLOWorigin{0,0} + +\def\doFLOWdisplace[#1,#2,#3]% experiment + {dsp_x := #1 ; dsp_y := #2 ;} + +\def\doFLOWconnectionC + {\dodoubleempty\dodoFLOWconnectionC} + +\def\dodoFLOWconnectionC[#1][#2]#3% + {\doglobal\increment\FLOWcomment + \setFLOWname\otherFLOWname{name_#3}% + \doifdefinedelse{\@FLOC@-\FLOWname} + {\edef\FLOWfrom{\getvalue{\@FLOC@-\FLOWname}}} + {\let \FLOWfrom \FLOWorigin}% + \ifx\FLOWfrom\FLOWorigin \else + \doifdefinedelse{\@FLOC@-\otherFLOWname} + {\edef\FLOWto {\getvalue{\@FLOC@-\otherFLOWname}}} + {\let \FLOWto \FLOWorigin}% + \ifx\FLOWto\FLOWorigin \else + \FLOWsetconnect{#1}% + \ifx\cFLOWfrom\empty \else + \doifelse\@@FLOLcorner\v!round + {\startMPdrawing smooth := true ; \stopMPdrawing} + {\startMPdrawing smooth := false ; \stopMPdrawing}% + \doifelse\@@FLOLdash\v!yes + {\startMPdrawing dashline := true ; \stopMPdrawing} + {\startMPdrawing dashline := false ; \stopMPdrawing}% + \doifelse\@@FLOLarrow\v!yes + {\startMPdrawing arrowtip := true ; \stopMPdrawing} + {\startMPdrawing arrowtip := false ; \stopMPdrawing}% + \doifelse\@@FLOLoffset\v!none + {\startMPdrawing touchshape := true ; \stopMPdrawing} + {\startMPdrawing touchshape := false ; \stopMPdrawing}% +%\doifsomething{#2} +% {\startMPdrawing +% \doFLOWdisplace[0#2,0,0]% +% \stopMPdrawing}% + \startMPdrawing +\doFLOWdisplace[0#2,0,0]% + connection_line_color := \MPcolor{\@@FLOLcolor} ; + connection_line_width := \@@FLOLrulethickness ; + connect_\cFLOWfrom _\cFLOWto (\FLOWfrom,\zFLOWfrom) (\FLOWto,\zFLOWto) ; +\doFLOWdisplace[0,0,0]% + \stopMPdrawing + \fi + \fi + \fi + \ignorespaces} + +% Pass D + +\long\def\startFLOWcellD#1\stopFLOWcell + {\resetFLOWcell +\pushmacro\lastFLOWx +\pushmacro\lastFLOWy + \ignorespaces#1\unskip % presets vars +\popmacro\lastFLOWy +\popmacro\lastFLOWx + \let\doprocessFLOWcell\doprocessFLOWcellD + \expandafter\doprocessFLOWcellD\FLOWlocation\end + \let\connection\doFLOWconnectionD + \let\comment\doFLOWcommentD + \ignorespaces#1\unskip\ignorespaces} + +\def\doFLOWconnectionD + {\dodoubleempty\dodoFLOWconnectionD} + +\def\dodoFLOWconnectionD[#1][#2]#3% + {\doglobal\increment\FLOWcomment + \ignorespaces} + +\def\doFLOWcommentD[#1]#2% + {\bgroup + \let\FLOW \middlebox + \let\FLOWb \bottombox + \let\FLOWbl\bottomleftbox + \let\FLOWbr\bottomrightbox + \let\FLOWt \topbox + \let\FLOWtl\topleftbox + \let\FLOWtr\toprightbox + \let\FLOWl \leftbox + \let\FLOWlt\lefttopbox + \let\FLOWlb\leftbottombox + \let\FLOWr \rightbox + \let\FLOWrt\righttopbox + \let\FLOWrb\rightbottombox + \let\FLOWc \middlebox +%\ifdefined{FLOW#1}% + \ifcase0\getvalue{\@@MPx\FLOWcomment}\getvalue{\@@MPy\FLOWcomment}\relax + \else + \ifdim\getvalue{\@@MPx\FLOWcomment}\s!bp<\areaMPllx\relax\else + \ifdim\getvalue{\@@MPx\FLOWcomment}\s!bp>\areaMPurx\relax\else + \ifdim\getvalue{\@@MPy\FLOWcomment}\s!bp<\areaMPlly\relax\else + \ifdim\getvalue{\@@MPy\FLOWcomment}\s!bp>\areaMPury\relax\else + \dimen0=\getvalue{\@@MPx\FLOWcomment}\s!bp + \advance\dimen0 -\@@FLOW@@offset + \advance\dimen0 -\clipMPllx + \dimen2=\clipMPury + \advance\dimen2 -\@@FLOW@@offset + \advance\dimen2 -\getvalue{\@@MPy\FLOWcomment}\s!bp + \setbox\scratchbox\hbox{\strut#2}% + \boxoffset.5\bodyfontsize + \setbox\scratchbox\hbox{\hskip\dimen0\lower\dimen2\getvalue{FLOW#1}{\box\scratchbox}}% + \smashbox\scratchbox + \box\scratchbox + \boxoffset\zeropoint + \nointerlineskip % really needed + \fi + \fi + \fi + \fi + \fi +%\fi + \egroup + \ignorespaces} + +% pass D + +\def\dophaseoneFLOWcellX#1#2% + {\!!counta#1\relax + \!!countb#2\relax + \!!countc\@@FLOWx + \!!countd\@@FLOWy + \advance\!!countc \@@FLOWnx + \advance\!!countd \@@FLOWny + \advance\!!countc \minusone + \advance\!!countd \minusone + \ifnum\!!counta<\@@FLOWx\relax \donefalse + \else\ifnum\!!counta>\!!countc \donefalse + \else\ifnum\!!countb<\@@FLOWy\relax \donefalse + \else\ifnum\!!countb>\!!countd \donefalse + \else \donetrue + \fi\fi\fi\fi} + +\def\dophasetwoFLOWcellX + {\advance\!!counta -\@@FLOWx + \advance\!!counta \plusone + \advance\!!countb -\@@FLOWy + \advance\!!countb \plusone + \dimen0=\FLOWgridwidth + \dimen0=\!!counta\dimen0 + \advance\dimen0 -\FLOWgridwidth + \dimen4=\FLOWgridwidth + \advance\dimen4 -\FLOWshapewidth + \advance\dimen0 .5\dimen4 + \dimen2=\FLOWgridheight + \dimen2=\!!countb\dimen2 + \dimen4=\FLOWgridheight + \advance\dimen4 -\FLOWshapeheight + \advance\dimen2 -.5\dimen4 + \edef\FLOWdx{\the\dimen0}% + \edef\FLOWdy{\the\dimen2}} + +\def\positionFLOWzero% assumes \FLOWdx and \FLOWdy are set + {\setbox0\hbox{\hskip\FLOWdx\lower\FLOWdy\box0}% + \smashbox0\box0 + \nointerlineskip} % new, needed since we somehow reset that + +\def\doFLOWtlabel#1#2#3% + {\scratchdimen\ifcase#2 \zeropoint\else\@@FLOWdy\fi + \setbox0\hbox{\hskip\dimen2\raise\scratchdimen + \hbox{\raise\dimen4\hbox{#1{\strut#3}}}}% + \positionFLOWzero}% + +\def\doFLOWblabel#1#2#3% + {\scratchdimen\ifcase#2 \zeropoint\else\@@FLOWdy\fi + \setbox0\hbox{\hskip\dimen2\raise-\scratchdimen + \hbox{#1{\strut#3}}}% + \positionFLOWzero}% + +\def\doFLOWllabel#1#2#3% + {\scratchdimen\ifcase#2 \zeropoint\else\@@FLOWdx\fi + \setbox0\hbox{\hskip-\scratchdimen\raise\dimen6 + \hbox{#1{\strut#3}}}% + \positionFLOWzero}% + +\def\doFLOWrlabel#1#2#3% + {\scratchdimen\ifcase#2 \zeropoint\else\@@FLOWdx\fi + \setbox0\hbox{\hskip\dimen0\hskip\scratchdimen + \hbox{\raise\dimen6\hbox{#1{\strut#3}}}}% + \positionFLOWzero} + +\def\doprocessFLOWcellD#1,#2\end + {\dophaseoneFLOWcellX{#1}{#2}% + \ifdone + \dophasetwoFLOWcellX + \doglobal\addtocommalist\FLOWcell\FLOWcells + \def\FLOWx{#1}% + \def\FLOWy{#2}% + \directsetup{flowcell}% + \setbox0\hbox + {\ifx\FLOWalign\empty\else + \setupframed + [\c!align=\v!normal,\c!bottom=\vfill,\c!top=\vfill]% + \@EA\processallactionsinset\@EA + [\FLOWalign] + [t=>{\setupframed[\c!bottom=\vfill,\c!top=]}, + b=>{\setupframed[\c!bottom=,\c!top=\vfill]}, + l=>{\setupframed[\c!align=\v!right]}, + r=>{\setupframed[\c!align=\v!left]}, + m=>{\setupframed[\c!align=\v!middle]}, + c=>{\setupframed[\c!align=\v!middle]}]% + \fi + \doifelse\FLOWshape{none} % {\v!none} + {\setupframed[\c!offset=\v!overlay]} + {\setupframed[\c!offset=\@@FLOSoffset]}% + \framed + [\c!frame=\v!off,\c!background=flowcell, + \c!width=\FLOWshapewidth,\c!height=\FLOWshapeheight] + {\FLOWtext}}% + \showFLOWhelp0 + \ifx\FLOWdestination\empty\else + \setbox0\hbox + {\setupinteraction[\c!color=,\c!contrastcolor=]% + \gotobox{\box0}[\FLOWdestination]}% + \fi + \positionFLOWzero + \dimen0=\FLOWshapewidth \dimen2=.5\dimen0 + \dimen4=\FLOWshapeheight\dimen6=.5\dimen4 + \boxoffset.5\bodyfontsize + \doFLOWtlabel \righttopbox0\tFLOWlabel + \doFLOWblabel\rightbottombox0\bFLOWlabel + \doFLOWllabel \lefttopbox0\lFLOWlabel + \doFLOWrlabel \righttopbox0\rFLOWlabel + \doFLOWtlabel \topbox0\tcFLOWlabel % for me only + \doFLOWblabel \bottombox0\bcFLOWlabel % for me only + \doFLOWllabel \leftbox0\lcFLOWlabel % for me only + \doFLOWrlabel \rightbox0\rcFLOWlabel % for me only + \ifnum#1=\@@FLOWx\relax \doFLOWllabel \leftbox1\lFLOWexit \fi + \ifnum#1=\!!countc \doFLOWrlabel \rightbox1\rFLOWexit \fi + \ifnum#2=\@@FLOWy\relax \doFLOWtlabel \topbox1\tFLOWexit \fi + \ifnum#2=\!!countd \doFLOWblabel \bottombox1\bFLOWexit \fi + \boxoffset\zeropoint + \fi} + +% For Willy Egger: +% +% \startsetups flowcell +% \definelayer +% [flowcell] +% [width=\FLOWshapewidth, +% height=\FLOWshapeheight] +% \setlayerframed +% [flowcell] +% [preset=rightbottom,offset=1ex] +% [frame=off] +% {\tx(\FLOWx,\FLOWy)} +% \stopsetups + +% Pass E + +\long\def\startFLOWcellE#1\stopFLOWcell + {\resetFLOWcell + \ignorespaces#1\unskip + \let\doprocessFLOWcell\doprocessFLOWcellE + \expandafter\doprocessFLOWcell\FLOWlocation\end} + +\def\doprocessFLOWcellE#1,#2\end % redundant + {\ifx\FLOWoverlay\empty \else + \dophaseoneFLOWcellX{#1}{#2}% + \ifdone + \dophasetwoFLOWcellX + \edef\FLOWdx{\the\dimen0}% + \edef\FLOWdy{\the\dimen2}% + \setbox0\hbox + {\framed + [%\c!frame=\v!off, + \c!background={\@@FLOWbackground,\FLOWoverlay}, + \c!backgroundcolor=\@@FLOSbackgroundcolor, + \c!width=\FLOWshapewidth,\c!height=\FLOWshapeheight] + {}}% + \positionFLOWzero + \fi + \fi} + +% Pass F + +\def\checkFLOWautofocus + {\def\@@FLOWminx{100}\let\@@FLOWminy\@@FLOWminx + \def\@@FLOWmaxx {0}\let\@@FLOWmaxy\@@FLOWmaxx + \def\@@FLOWabsx {0}\let\@@FLOWabsy\@@FLOWabsx + \let\startFLOWcell\startFLOWcellF + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber + %\message{AUTOSHAPE 1: (\@@FLOWminx,\@@FLOWminy)->(\@@FLOWmaxx,\@@FLOWmaxy)}% + \ifnum\@@FLOWabsx<\@@FLOWmaxx\let\@@FLOWmaxx\@@FLOWabsx\fi + \ifnum\@@FLOWabsy<\@@FLOWmaxy\let\@@FLOWmaxy\@@FLOWabsy\fi + %\message{AUTOSHAPE 2: (\@@FLOWminx,\@@FLOWminy)->(\@@FLOWmaxx,\@@FLOWmaxy)}% + \donetrue + \ifnum\@@FLOWminx=100 \donefalse\fi + \ifnum\@@FLOWminy=100 \donefalse\fi + \ifnum\@@FLOWmaxx=0 \donefalse\fi + \ifnum\@@FLOWmaxy=0 \donefalse\fi + \doFLOWcheckF\@@FLOWx\@@FLOWminx\@@FLOWmaxx\@@FLOWnx + \doFLOWcheckF\@@FLOWy\@@FLOWminy\@@FLOWmaxy\@@FLOWny} + +\def\startFLOWcellF#1\stopFLOWcell% + {\resetFLOWcell + \ignorespaces#1\unskip + \expandafter\doFLOWlocationF\FLOWlocation\end}% + +\def\doFLOWlocationF#1,#2\end% + {\ifnum#1>\@@FLOWabsx\def\@@FLOWabsx{#1}\fi + \ifnum#2>\@@FLOWabsy\def\@@FLOWabsy{#2}\fi + \doifinset\FLOWcell\@@FLOWautofocus + {\dodoFLOWlocationF{#1}<-\@@FLOWminx + \dodoFLOWlocationF{#1}>+\@@FLOWmaxx + \dodoFLOWlocationF{#2}<-\@@FLOWminy + \dodoFLOWlocationF{#2}>+\@@FLOWmaxy}} + +\def\dodoFLOWlocationF#1#2#3#4% + {\ifnum#1#2#4\relax + \!!counta=#1\advance\!!counta #31\relax + \edef#4{\ifnum\!!counta<1 1\else\the\!!counta\fi}% + \fi} + +\def\doFLOWcheckF#1#2#3#4% + {\ifdone + \let#1=#2% + \!!counta=#3% + \advance\!!counta \plusone\advance\!!counta -#2\relax + \ifnum\!!counta<1 \!!counta=1 \fi + \edef#4{\the\!!counta}% + \else + \let#1\!!plusone + \let#4\!!zerocount % no {1} + \fi} + +% \useFLOWchart[name][parent][setting,setting][additional settings] +% \useFLOWchart[name][parent][additional settings] + +\let\currentFLOWchart\empty + +\def\useFLOWchart + {\doquadrupleempty\douseFLOWchart} + +\def\douseFLOWchart[#1][#2][#3][#4]% name parent sets mainsettings + {\iffourthargument + \setvalue{\@FLOW@--#1}[##1]{\setgetFLOWchart[#2][#3][#4,##1]}% + \else + \checkparameters[#3]% + \ifparameters + \setvalue{\@FLOW@--#1}[##1]{\setgetFLOWchart[#2][][#3,##1]}% + \else + \setvalue{\@FLOW@--#1}[##1]{\setgetFLOWchart[#2][#3][##1]}% + \fi + \fi} + +\def\setgetFLOWchart[#1][#2][#3]% + {\def\docommand##1{}% cell line focus ? + \processcommalist[#2]\docommand + \getFLOWchart[#1][#3]} + +\def\doFLOWchart[#1][#2]% + {\hbox\bgroup\vbox\bgroup % vmode suppresses spaces +\def\currentFLOWchart{#1}% + \doifundefinedelse{\@FLOW@--#1} + {\getFLOWchart[#1][#2]} + {\getvalue{\@FLOW@--#1}[#2]}% + \egroup\egroup} + +\def\FLOWchart% + {\dodoubleempty\doFLOWchart} + +%D The next section is dedicated to splitting up charts. + +\def\getFLOWsize[#1]% + {\bgroup\let\dodogetFLOWchart\dogetFLOWsize\FLOWchart[#1]\egroup} + +\def\dogetFLOWsize[#1][#2]% + {\setbox\scratchbox=\vbox + {\globallet\FLOWmaxwidth \!!zerocount + \globallet\FLOWmaxheight\!!zerocount + \def\getFLOWlocation##1,##2\end + {\ifnum0##1>\FLOWmaxwidth \xdef\FLOWmaxwidth {##1}\fi + \ifnum0##2>\FLOWmaxheight\xdef\FLOWmaxheight{##2}\fi}% + \resetFLOWcell + \long\def\startFLOWcell##1\stopFLOWcell + {{##1\expandafter\getFLOWlocation\FLOWlocation\end}}% + \def\dohandleflowchart[##1][##2]% + {\resetFLOWlocation + \processFLOWbuffer{##1}}% + \getvalue{\@FLOW@-#1}}} + +\def\setupFLOWsplit% + {\dodoubleargument\getparameters[\@@FLOT]} + +\setupFLOWsplit% + [\c!nx=3,\c!ny=3, + \c!dx=1,\c!dy=1, + \c!command=, + \c!marking=\v!on, + \c!before=,\c!after=] + +\def\FLOWsplitx {1} +\def\FLOWsplity {1} +\def\FLOWsplitnx{1} +\def\FLOWsplitny{1} + +\def\FLOWcharts% + {\dodoubleempty\doFLOWcharts} + +%D While splitting, the following variables are available: +%D +%D \starttyping +%D \FLOWsplitnx \FLOWsplitny \FLOWsplitx \FLOWsplity +%D \stoptyping + +\def\doFLOWcharts[#1][#2]% + {\bgroup + \getFLOWsize[#1]% + \dodoFLOWcharts\relax + \global\let\FLOWsplitnx\FLOWsplitx + \global\let\FLOWsplitny\FLOWsplity + \dodoFLOWcharts{\dododoFLOWcharts[#1][#2]}% + \egroup} + +\def\dodoFLOWcharts#1% + {\def\@@FLOTx{1}% + \global\let\FLOWsplitx\@@FLOTx + \doloop + {\def\@@FLOTy{1}% + \global\let\FLOWsplity\@@FLOTy + \doloop + {\bgroup + \scratchcounter\FLOWmaxwidth + \advance\scratchcounter -\@@FLOTx + \advance\scratchcounter \plusone + \ifnum\scratchcounter<\@@FLOTnx\edef\@@FLOTnx{\the\scratchcounter}\fi + \scratchcounter\FLOWmaxheight + \advance\scratchcounter -\@@FLOTy + \advance\scratchcounter \plusone + \ifnum\scratchcounter<\@@FLOTny\edef\@@FLOTny{\the\scratchcounter}\fi + #1% does something with the float, or not + \egroup + \increment(\@@FLOTy,\@@FLOTny)% + \ifnum\@@FLOTy>\FLOWmaxheight + \exitloop + \else + \doglobal\increment\FLOWsplity + \decrement(\@@FLOTy,\@@FLOTdy)% + \fi}% + \increment(\@@FLOTx,\@@FLOTnx)% + \ifnum\@@FLOTx>\FLOWmaxwidth + \exitloop + \else + \doglobal\increment\FLOWsplitx + \decrement(\@@FLOTx,\@@FLOTdx)% + \fi}} + +\def\dododoFLOWcharts[#1][#2]% + {\bgroup + \@@FLOTbefore + \doifnot\@@FLOTmarking\v!on{\let\cuthbox\hbox}% + \cuthbox + {\@@FLOTcommand + {\FLOWchart[#1][#2, + \c!x=\@@FLOTx,\c!nx=\@@FLOTnx, + \c!y=\@@FLOTy,\c!ny=\@@FLOTny]}}% + \@@FLOTafter + \egroup} + +%D An example of splitting is given below: +%D +%D \starttyping +%D \setupFLOWsplit +%D [nx=5,ny=10, +%D dx=0,dy=0, +%D before=, +%D after=\page] +%D +%D \FLOWcharts[mybigflow] +%D \stoptyping +%D +%D Or, one can say: +%D +%D \starttyping +%D \splitfloat +%D {\placefigure{What a big flowchart this is!}} +%D {\FLOWcharts[mybigflow]} +%D \stoptyping + +%D \macros +%D {typeFLOWchart} +%D +%D For documentation purposes the following macro is +%D provided. Watch the use of the first and last line hooks, +%D which is needed because the start and stop commands are +%D not part of the buffer. + +\def\typeFLOWchart[#1]% + {\bgroup + \def\dohandleflowchart[##1][##2]{\typeFLOWbuffer{##1}}% + \defconvertedargument\firstverbatimfileline{\startFLOWchart[#1]}% + \defconvertedargument\lastverbatimfileline {\stopFLOWchart}% + \getvalue{\@FLOW@-#1} + \egroup} + +%D New: +%D +%D \starttyping +%D \setupFLOWcharts[command=\Whow] +%D +%D \startFLOWset[convert-en] % [tag][convert-en] +%D \subFLOWchart[a][x=1,y=1,nx=3,ny=3] +%D \subFLOWchart[b][x=1,y=2,nx=3,ny=3] +%D \subFLOWchart[c][x=2,y=1,nx=3,ny=3] +%D \stopFLOWset +%D +%D \def\Whow#1% +%D {\ifnum\currentFLOWset=1 \framed{Some Chart}\fi} +%D +%D \FLOWset[convert-en] % [tag] +%D +%D \def\Whow#1% +%D {\setuphead[state=high] +%D \startstandardmakeup +%D \centerbox{#1} +%D \stopstandardmakeup} +%D +%D \FLOWset[convert-en] % [tag] +%D \stoptyping + +\def\startFLOWset + {\dodoubleempty\dostartFLOWset} + +\def\dostartFLOWset[#1][#2]#3\stopFLOWset % tag name data + {\ifsecondargument + \long\setvalue{\@FLOX@#1}{\dohandleFLOWset{#1}{#2}{#3}}% + \else + \long\setvalue{\@FLOX@#1}{\dohandleFLOWset{#1}{#1}{#3}}% + \fi} + +\long\def\dohandleFLOWset#1#2#3% tag name data + {\bgroup + \def\subFLOWchart + {\dodoubleempty\dosubFLOWchart}% + \def\dosubFLOWchart[##1][##2]% subtag settings + {\ifsecondargument + \dodohandleFLOWset{#1}{##1}{#2}{##2}% + \else + \subFLOWchart[][##1]% + \fi}% + #3% + \egroup} + +\def\dodohandleFLOWset#1#2#3#4% tag subtag name settings + {\increment\currentFLOWset + \bgroup + \@@FLOXcommand + {\ifnum\currentFLOWset=1 \pagereference[#1]\fi + \doifsomething{#2} + {\setupreferencing[\c!prefix=]% + \pagereference[#1:#2]% -:#1:#2 + \setupreferencing[\c!prefix=#1:#2]}% + \FLOWchart[#3][#4]}% + \egroup} + +\def\FLOWset[#1]% + {\newcounter\currentFLOWset + \doifdefinedelse{\@FLOX@#1} + {\getvalue{\@FLOX@#1}} + {\dodohandleFLOWset{#1}{}{#1}{}}} + +\newcounter\currentFLOWset + +\setupFLOWsets + [\c!command=] + +%D This will be an option: + +% \def\startFLOWchart% +% {\dodoubleempty\dostartFLOWchart} +% +% \long\def\dostartFLOWchart[#1][#2]#3\stopFLOWchart +% {\preparenextFLOWchart{#1}{#2}% +% \long\setgvalue{\FLOWbufferprefix\nofFLOWcharts}{#3}} +% +% \long\def\dodefineFLOWchart[#1][#2]#3% +% {\preparenextFLOWchart{#1}{#2}% +% \long\setgvalue{\FLOWbufferprefix\nofFLOWcharts}{#3}} +% +% \def\processFLOWbuffer#1{\getvalue{\FLOWbufferprefix#1}} +% \def\typeFLOWbuffer #1{[Sorry, no verbatim chart #1 available.]} + +\writestatus\m!system{The chart mkiv xml interface is not yet defined!} \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/m-chart.tex b/Master/texmf-dist/tex/context/base/m-chart.tex index 5ccf4c2ad2b..c4e279d5476 100644 --- a/Master/texmf-dist/tex/context/base/m-chart.tex +++ b/Master/texmf-dist/tex/context/base/m-chart.tex @@ -11,1274 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% todo: \localpushmacro/\localpopmacro (dohandleflowchart etc) -% todo: make mkiv variant -% todo: use dimexpr/numspr - -% will be redone with layers and dimexpr or even better, by just using -% textext .. a nice example of old code - -%D This is an experimental module. Pieces of code will be moved -%D to other modules. More features are possible but will be -%D interfaces later. -%D -%D When finished this module will be documented. The main macro -%D is still a rather big one and there is some redundant and -%D slow code that needs a clean up. - -% arrow, dash -% crossing -% \goto -> \normalgoto -% class -> class:name (ref prefix) -% c, automatisch geen overlap zoeken -% eind eerder chart connecties -% relateren aan korps -% check op bestaan naam, bestaan shape -% auto als extern figuur -% subchart -% pijlen -% focus -% ook nog \MPmessage -% areapath -> krappe vlak -% clippath -> gehele vlak -% -% offset : clip offset -% breedte : breedte cel -% hoogte : hoogte cel -% dx : halve afstand in breedte (grid breedte = breedte + 2dx) -% dy : halve afstand in hoogte (grid hoogte = hoogte + 2dy) -% x : x offset (clipping) -% y : y offset (clipping) -% nx : minimaal aantal cellen horizontaal -% ny : minimaal aantal cellen vertikaal -% -% shape none en geen equivalent maken -% -% kaderkleur achtergrondkleur -% lijnkleur lijndikte -% focus focuskaderkleur focusachtergrondkleur -% richting -% -% focus koppelen aan kleur - -\unprotect - -\definesorting [flowchart] [flowcharts] [\v!none] % no access -\setupsorting [flowchart] [\c!state=\v!stop] % off by default - -\def\@FLOW@{@FLOW@} -\def\@FLOC@{@FLOC@} -\def\@FLOX@{@FLOX@} - -\def\@@FLOW{@@FLOW} -\def\@@FLOL{@@FLOL} -\def\@@FLOS{@@FLOS} -\def\@@FLOF{@@FLOF} -\def\@@FLOT{@@FLOT} -\def\@@FLOX{@@FLOX} - -\def\@@MPx {@@MPx} -\def\@@MPy {@@MPy} - -\def\FLOWbufferprefix{flw-} - -\def\processFLOWbuffer#1{\getbuffer[\FLOWbufferprefix#1]} -\def\typeFLOWbuffer #1{\typebuffer[\FLOWbufferprefix#1]} - -\def\setFLOWname#1#2% funny hack that makes sure that we get - {\bgroup % names that are acceptable for METAPOST - \lccode`0=`a\lccode`1=`b\lccode`2=`c\lccode`3=`d\lccode`4=`e% - \lccode`5=`f\lccode`6=`g\lccode`7=`h\lccode`8=`i\lccode`9=`j% - \lccode` =`\_\lccode`-=`\_\lccode`_=`\_% - \lowercase{\gdef#1{#2}}% - \egroup} - -% een gobble als default is sneller, en dan alleen setten als -% nodig - -\def\resetFLOWcell - {% variables - \global\let\FLOWname \empty - \global\let\FLOWalign \empty - \global\let\FLOWshape \empty - \global\let\FLOWlocation \empty - \global\let\FLOWtext \empty - \global\let\FLOWhelp \empty - \global\let\FLOWdestination\empty - \global\let\FLOWoverlay \empty - \global\let\FLOWfocus \empty - \global\let\tFLOWlabel \empty - \global\let\bFLOWlabel \empty - \global\let\lFLOWlabel \empty - \global\let\rFLOWlabel \empty - \global\let\bcFLOWlabel \empty - \global\let\tcFLOWlabel \empty - \global\let\lcFLOWlabel \empty - \global\let\rcFLOWlabel \empty - \global\let\tFLOWexit \empty - \global\let\bFLOWexit \empty - \global\let\lFLOWexit \empty - \global\let\rFLOWexit \empty - % commands - \let\name \doFLOWname - \let\shape \doFLOWshape - \let\destination\doFLOWdestination - \let\location \doFLOWlocation - \let\focus \doFLOWfocus - \let\overlay \doFLOWoverlay - \let\figure \doFLOWfigure - \let\text \doFLOWtext - \let\comment \doFLOWcomment - \let\label \doFLOWlabel - \let\help \doFLOWhelp - \let\connection \doFLOWconnection - \let\exit \doFLOWexit - % convenience commands - \let\locate \doFLOWlocate - \let\connect \doFLOWconnect} - -\let\FLOWcell \s!unknown -\let\FLOWshape \s!unknown -\let\FLOWdestination\s!unknown -\let\FLOWfocus \s!unknown -\let\FLOWoverlay \empty -\let\FLOWtext \empty - -\def\doFLOWname#1% - {\def\FLOWcell{#1}\setFLOWname\FLOWname{name_#1}\ignorespaces} - -\def\doFLOWshape#1% - {\gdef\FLOWshape{#1}\ignorespaces} - -\def\doFLOWdestination#1% - {\gdef\FLOWdestination{#1}\ignorespaces} - -\def\doFLOWlocation#1% - {\setFLOWlocation#1\end\ignorespaces} - -\def\doFLOWfocus#1% - {\gdef\FLOWfocus{#1}\ignorespaces} - -\def\doFLOWoverlay#1% - {\gdef\FLOWoverlay{#1}\ignorespaces} - -\def\doFLOWfigure#1% - {\defineoverlay[\s!dummy][\overlayfigure{#1}]% - \overlay\s!dummy} - -\def\doFLOWtext - {\dosingleempty\dodoFLOWtext} - -\def\dodoFLOWtext[#1]% % #2% - {\gdef\FLOWalign{#1}\gdef\FLOWtext}% {#2}} - -\def\doFLOWcomment[#1]#2% - {\ignorespaces\dogobblesingleempty} - -\def\doFLOWlabel[#1]#2% wordt dit gebruikt ? - {\setgvalue{#1FLOWlabel}{#2}\ignorespaces} - -\def\doFLOWhelp#1% - {\gdef\FLOWhelp{#1}\ignorespaces} - -\def\doFLOWconnection - {\dodoubleempty\dodoFLOWconnection} - -\def\dodoFLOWconnection[#1][#2]#3% - {\ignorespaces} - -\def\doFLOWconnect - {\connection} - -\def\doFLOWlocate - {\location} - -\def\doFLOWexit[#1]#2% - {\setgvalue{#1FLOWexit}{#2}\ignorespaces} - -\def\startFLOWchart - {\bgroup - \let\stopFLOWchart\egroup - \obeylines % lelijk, buffers nog eens fatsoeneren - \dodoubleempty\dostartFLOWchart} - -\def\dostartFLOWchart[#1][#2]% - {\preparenextFLOWchart{#1}{#2}% - \dostartbuffer[\FLOWbufferprefix\nofFLOWcharts][startFLOWchart][stopFLOWchart]} - -\def\defineFLOWchart% - {\dodoubleempty\dodefineFLOWchart} - -\long\def\dodefineFLOWchart[#1][#2]#3% - {\preparenextFLOWchart{#1}{#2}% - \setbuffer[\FLOWbufferprefix\nofFLOWcharts]#3\endbuffer} - -\def\preparenextFLOWchart#1#2% - {\doglobal\increment\nofFLOWcharts - \flowchart{#1}% - \setxvalue{\@FLOW@-#1}{\noexpand\dohandleflowchart[\nofFLOWcharts][#2]}} - -\def\setupFLOWcharts{\dodoubleargument\getparameters[\@@FLOW]} -\def\setupFLOWlines {\dodoubleargument\getparameters[\@@FLOL]} -\def\setupFLOWshapes{\dodoubleargument\getparameters[\@@FLOS]} -\def\setupFLOWfocus {\dodoubleargument\getparameters[\@@FLOF]} -\def\setupFLOWsets {\dodoubleargument\getparameters[\@@FLOX]} - -\setupFLOWcharts - [\c!option=, - \c!bodyfont=, - \c!dot=, % private option - \c!width=12\bodyfontsize, - \c!height=7\bodyfontsize, - \c!maxwidth=, - \c!maxheight=, - \c!offset=\v!standard, % == auto offset - \c!dx=2\bodyfontsize, - \c!dy=2\bodyfontsize, - \c!nx=0, % 1, - \c!ny=0, % 1, - \c!x=1, - \c!y=1, - \c!autofocus=, - \c!focus=, - \c!background=, % \v!color, - \c!backgroundcolor=\s!white, - \c!rulethickness=\linewidth, - \c!frame=\v!off, - \c!framecolor=] - -\setupFLOWlines - [\c!corner=\v!round, - \c!arrow=\v!yes, - \c!dash=\v!no, - \c!radius=.375\bodyfontsize, % 2.5\c!rulethickness - \c!color=FLOWlinecolor, - \c!rulethickness=.15\bodyfontsize, % 2pt, - \c!offset=\v!none] - -\setupFLOWshapes - [\c!default=action, - \c!framecolor=FLOWframecolor, - \c!background=\v!color, - \c!backgroundcolor=FLOWbackgroundcolor, - \c!backgroundscreen=\@@rsscreen, - \c!rulethickness=.15\bodyfontsize, % 2pt, - \c!offset=.5\bodyfontsize] - -\setupFLOWfocus - [\c!framecolor=FLOWfocuscolor, - \c!background=\@@FLOSbackground, - \c!backgroundcolor=\@@FLOSbackgroundcolor, - \c!backgroundscreen=\@@FLOSbackgroundscreen, - \c!rulethickness=\@@FLOSrulethickness, - \c!offset=\@@FLOSoffset] - -\definecolor [FLOWfocuscolor] [s=.2] -\definecolor [FLOWlinecolor] [s=.5] -\definecolor [FLOWframecolor] [s=.7] -\definecolor [FLOWbackgroundcolor] [s=.9] - -\newcounter\includeFLOWx -\newcounter\includeFLOWy - -\def\includeFLOWchart - {\dodoubleempty\doincludeFLOWchart} - -\def\doincludeFLOWchart[#1][#2]% - {\pushmacro\includeFLOWx - \pushmacro\includeFLOWy - \getparameters[FLOWi][x=1,y=1,#2]% - \increment(\includeFLOWx,0\FLOWix)\decrement\includeFLOWx - \increment(\includeFLOWy,0\FLOWiy)\decrement\includeFLOWy - \def\dodoincludeFLOWchart##1% - {\doifdefined{\@FLOW@-##1} - {\globalpushmacro\dohandleflowchart % was local - \gdef\dohandleflowchart[####1][####2]% - {\globalpopmacro\dohandleflowchart % was local - \resetFLOWlocation - \processFLOWbuffer{####1}}% - \getvalue{\@FLOW@-##1}}}% - \processcommalist[#1]\dodoincludeFLOWchart - \popmacro\includeFLOWx - \popmacro\includeFLOWy} - -\def\resetFLOWlocation - {\globallet\lastFLOWx\!!zerocount - \globallet\lastFLOWy\!!zerocount} - -\def\dosetFLOWlocation[#1#2]#3#4% - {\processaction - [#1#2] - [ +=>\scratchcounter\numexpr#4+ 1+#3\relax, - -=>\scratchcounter\numexpr#4- 1+#3\relax, - +#2=>\scratchcounter\numexpr#4+#2+#3\relax, - -#2=>\scratchcounter\numexpr#4-#2+#3\relax, - \s!default=>\scratchcounter\numexpr#4 +#3\relax, - \s!unknown=>\scratchcounter\numexpr0#1#2+#3\relax]% - \xdef#4{\the\scratchcounter}} - -\def\setFLOWlocation#1,#2\end - {\dosetFLOWlocation[#1\empty]\includeFLOWx\lastFLOWx - \dosetFLOWlocation[#2\empty]\includeFLOWy\lastFLOWy - \xdef\FLOWlocation{\lastFLOWx,\lastFLOWy}} - -\def\FLOWshapes - {node, action, procedure, product, decision, archive, - loop, wait, subprocedure, singledocument, multidocument, - sub procedure, single document, multi document, up, down, - left, right} - -\def\FLOWlines - {up, down, left, right} - -\def\FLOWsetconnect#1% - {\donefalse - \let\cFLOWfrom\empty - \let\cFLOWto\empty - \let\zFLOWfrom\!!zerocount - \let\zFLOWto\!!zerocount - \handletokens#1\with\doFLOWsetconnect - \ifx\cFLOWto\empty\let\cFLOWfrom\empty\fi} - -\def\doFLOWsetconnect#1% - {\ifx #1p% - \ifdone\def\zFLOWto{+1}\else\def\zFLOWfrom{+1}\fi - \else\ifx#1+% - \ifdone\def\zFLOWto{+1}\else\def\zFLOWfrom{+1}\fi - \else\ifx#1n% - \ifdone\def\zFLOWto{-1}\else\def\zFLOWfrom{-1}\fi - \else\ifx#1-% - \ifdone\def\zFLOWto{-1}\else\def\zFLOWfrom{-1}\fi - \else\ifdone - \edef\cFLOWto{\FLOWconnector#1}% - \else - \edef\cFLOWfrom{\FLOWconnector#1}% - \donetrue - \fi\fi\fi\fi\fi} - -\def\FLOWconnector#1% - {\if#1bbottom\else\if#1ttop\else\if#1lleft\else\if#1rright\fi\fi\fi\fi} - -\newif\ifFLOWscaling \FLOWscalingtrue - -\def\@@FLOW@@offset{\@@FLOWoffset} - -\def\getFLOWchart - {\dodoubleempty\dogetFLOWchart} - -\def\dogetFLOWchart[#1][#2]% - {\doifundefinedelse{\@FLOW@-#1} - {\writestatus{FLOW}{unknown chart #1}% - \framed - [\c!width=12\bodyfontsize,\c!height=8\bodyfontsize] - {\tttf [chart #1]}} - {\dodogetFLOWchart[#1][#2]}} - -\def\dodogetFLOWchart[#1][#2]% to be split a bit more - {\vbox\bgroup - \insidefloattrue - \forgetall - \dontcomplain - % \offinterlineskip % we now explicitly use \nointerlineskip later on - \def\dohandleflowchart[##1][##2]% - {\def\currentFLOWnumber{##1}% - \getparameters[\@@FLOW][##2]}% - \getvalue{\@FLOW@-#1}% - \getparameters[\@@FLOW][#2]% dubbelop ? - \doifsomething{\@@FLOWautofocus} - {\checkFLOWautofocus}% - %\message{AUTOSHAPE 3: (\@@FLOWx,\@@FLOWy)->(\@@FLOWnx,\@@FLOWny)}\wait - \global\let\FLOWwidth \@@FLOWnx - \global\let\FLOWheight\@@FLOWny - \let\startFLOWcell\startFLOWcellA - \resetFLOWlocation - \processFLOWbuffer\currentFLOWnumber - \ifcase\@@FLOWnx\relax \let\@@FLOWnx\FLOWwidth \fi - \ifcase\@@FLOWny\relax \let\@@FLOWny\FLOWheight \fi - \doifnothing{\@@FLOWmaxwidth\@@FLOWmaxheight}{\FLOWscalingfalse}% - \ifFLOWscaling - \doifnothing{\@@FLOWmaxwidth }{\let\@@FLOWmaxwidth \maxdimen}% - \doifnothing{\@@FLOWmaxheight}{\let\@@FLOWmaxheight\maxdimen}% - \scratchcounter\bodyfontpoints - \doloop % NOG FONTSWITCH OM EX EN EM TE LATEN WERKEN - {\ifnum\scratchcounter>1 % NU DIMENSIONS IN TERMS OF BODYFONTSIZE - \bodyfontsize=\the\scratchcounter pt - \dimen0=\@@FLOWmaxwidth - \dimen2=\@@FLOWwidth - \dimen4=\@@FLOWdx - \advance\dimen2 2\dimen4 - \dimen2=\@@FLOWnx\dimen2 - \advance\dimen2 2\dimen4 - \ifdim\dimen2>\dimen0 - \advance\scratchcounter \minusone - \else - \dimen0=\@@FLOWmaxheight - \dimen2=\@@FLOWheight - \dimen4=\@@FLOWdy - \advance\dimen2 2\dimen4 - \dimen2=\@@FLOWny\dimen2 - \advance\dimen2 2\dimen4 - \ifdim\dimen2>\dimen0 - \advance\scratchcounter \minusone - \else - \exitloop - \fi - \fi - \else - \exitloop - \fi}% - \expanded{\switchtobodyfont[\the\scratchcounter pt]}% - \forgetall - % \offinterlineskip % needed ? - \else\ifx\@@FLOWbodyfont\empty\else - \expanded{\switchtobodyfont[\@@FLOWbodyfont]}% \expanded ? - \fi\fi - \global\let\FLOWcells\empty - \dimen0=\@@FLOWwidth - \edef\FLOWshapewidth{\the\dimen0}% - \dimen2=\@@FLOWdx - \advance\dimen0 2\dimen2 - \edef\FLOWgridwidth{\the\dimen0}% - \dimen0=\@@FLOWheight - \edef\FLOWshapeheight{\the\dimen0}% - \dimen2=\@@FLOWdy - \advance\dimen0 2\dimen2 - \edef\FLOWgridheight{\the\dimen0}% - \scratchdimen=\@@FLOSrulethickness - \edef\@@FLOSrulethickness{\the\scratchdimen}% - \scratchdimen=\@@FLOFrulethickness - \edef\@@FLOFrulethickness{\the\scratchdimen}% - \scratchdimen=\@@FLOLrulethickness - \edef\@@FLOLrulethickness{\the\scratchdimen}% - \ifdim\@@FLOLradius<2.5\scratchdimen - \scratchdimen=2.5\scratchdimen - \edef\@@FLOLradius{\the\scratchdimen}% - \ifdim\@@FLOLradius>\@@FLOWdx - \scratchdimen=\@@FLOWdx - \edef\@@FLOLradius{\the\scratchdimen}% - \fi - \ifdim\@@FLOLradius>\@@FLOWdy - \scratchdimen=\@@FLOWdy - \edef\@@FLOLradius{\the\scratchdimen}% - \fi - \else - \scratchdimen=\@@FLOLradius - \edef\@@FLOLradius{\the\scratchdimen}% - \fi - \processaction % magic 2.5 - [\@@FLOWoffset] - [ \v!none=>\scratchdimen=-2.5\scratchdimen, - \v!overlay=>\scratchdimen=-2.5\scratchdimen, - \v!standard=>\scratchdimen=\scratchdimen, - \s!unknown=>\scratchdimen=\@@FLOWoffset, - \s!default=>\scratchdimen=-2.5\scratchdimen]% - \edef\@@FLOW@@offset{\the\scratchdimen}% - \forgetall - \offinterlineskip - \resetMPdrawing - \doglobal\newcounter\FLOWcomment - \startMPdrawing - if unknown context_char : input mp-char.mp ; fi ; - grid_width := \FLOWgridwidth ; - grid_height := \FLOWgridheight ; - shape_width := \FLOWshapewidth ; - shape_height := \FLOWshapeheight ; - connection_line_width := \@@FLOLrulethickness ; - connection_smooth_size := \@@FLOLradius ; - connection_arrow_size := \@@FLOLradius ; - connection_dash_size := \@@FLOLradius ; - currentpicture := nullpicture ; - begin_chart(0,\FLOWwidth,\FLOWheight); - reverse_y := true ; - chart_offset := \@@FLOW@@offset ; - \stopMPdrawing - \doifelsenothing\@@FLOWbackgroundcolor - {\startMPdrawing - chart_background_color := white ; - \stopMPdrawing} - {\startMPdrawing - chart_background_color := \MPcolor{\@@FLOWbackgroundcolor} ; - \stopMPdrawing}% - \doif\@@FLOWoption\v!test - {\startMPdrawing - show_con_points := true ; - show_mid_points := true ; - show_all_points := true ; - \stopMPdrawing}% - \processaction % private - [\@@FLOWdot] - [ \v!yes=>\startMPdrawing - show_con_points := true ; - show_mid_points := true ; - show_all_points := true ; - \stopMPdrawing, - \s!unknown=>\startMPdrawing - show_\@@FLOWdot_points := true ; - \stopMPdrawing]% -\doglobal\newcounter\FLOWcomment - \let\startFLOWcell\startFLOWcellB - \resetFLOWlocation - \processFLOWbuffer\currentFLOWnumber -\doglobal\newcounter\FLOWcomment - \let\startFLOWcell\startFLOWcellC - \resetFLOWlocation - \processFLOWbuffer\currentFLOWnumber - \startMPdrawing - clip_chart(\@@FLOWx,\@@FLOWy,\@@FLOWnx,\@@FLOWny) ; - end_chart ; - \stopMPdrawing - \MPdrawingdonetrue - \setbox0\hbox - {\MPstaticgraphictrue - \MPshiftdrawingfalse - \getMPdrawing}% - \def\MPmessage##1% - {\writestatus{MP charts}{##1}}% - \def\MPposition##1##2##3% - {\setvalue{\@@MPx##1}{##2}\setvalue{\@@MPy##1}{##3}}% - \def\MPclippath##1##2##3##4% - {\def\clipMPllx{##1bp}\def\clipMPlly{##2bp}% - \def\clipMPurx{##3bp}\def\clipMPury{##4bp}}% - \def\MPareapath##1##2##3##4% - {\def\areaMPllx{##1bp}\def\areaMPlly{##2bp}% - \def\areaMPurx{##3bp}\def\areaMPury{##4bp}}% - \getMPdata - \doglobal\newcounter\FLOWcomment - \let\startFLOWcell\startFLOWcellD - \setbox2\vbox to \ht0 - {\forgetall % \offinterlineskip - \resetFLOWlocation - \processFLOWbuffer\currentFLOWnumber\vss}% - \setbox2\hbox - {\hskip\@@FLOW@@offset\lower\@@FLOW@@offset\box2}% - \wd2\wd0\ht2\ht0\dp2\dp0 - \let\startFLOWcell\startFLOWcellE - \setbox4\vbox to \ht0 - {\forgetall % \offinterlineskip - \resetFLOWlocation - \processFLOWbuffer\currentFLOWnumber\vss}% - \setbox4\hbox - {\hskip\@@FLOW@@offset\lower\@@FLOW@@offset\box4}% - \wd4\wd0\ht4\ht0\dp4\dp0 - \doifelse\@@FLOWoption\v!test - {\setbox6\vbox - {\forgetall - \vskip\@@FLOW@@offset - \hskip\@@FLOW@@offset - \basegrid - [\c!x=\@@FLOWx,\c!nx=\@@FLOWnx,\c!dx=\withoutpt\FLOWgridwidth, - \c!y=\@@FLOWy,\c!ny=\@@FLOWny,\c!dy=\withoutpt\FLOWgridheight, - \c!xstep=1,\c!ystep=1, - \c!unit=pt,\c!location=\v!middle]}% - \wd6\wd0\ht6\ht0\dp6\dp0 - \setbox8\vbox - {\forgetall - \offinterlineskip - \vskip\@@FLOW@@offset - \dostepwiserecurse\@@FLOWy\@@FLOWny\plusone - {\vbox to \FLOWgridheight - {\vfill - \hskip\@@FLOW@@offset - \hbox - {\dostepwiserecurse\@@FLOWx\@@FLOWnx\plusone - {\hbox to \FLOWgridwidth - {\hfill - \framed - [\c!framecolor=red, - \c!width=\FLOWshapewidth, - \c!height=\FLOWshapeheight] - {}% - \hfill}}} - \vfill}}}% - \wd8\wd0\ht8\ht0\dp8\dp0 - \framed - [\c!offset=\v!overlay,\c!framecolor=green] - {\hbox{\box4\hskip-\wd0\box0\hskip-\wd2\box2\hskip-\wd6\box6\hskip-\wd8\box8}}} - {\framed - [\c!offset=\v!overlay, - \c!frame=\@@FLOWframe, - \c!rulethickness=\@@FLOWrulethickness, - \c!framecolor=\@@FLOWframecolor, - \c!background=\@@FLOWbackground, - \c!backgroundcolor=\@@FLOWbackgroundcolor] - {\hbox{\box4\hskip-\wd0\box0\hskip-\wd2\box2}}}% - %\message{[\FLOWcells]}\wait - \egroup} - -% Pass A - -\long\def\startFLOWcellA#1\stopFLOWcell% - {\resetFLOWcell - \ignorespaces#1\unskip - \expandafter\getFLOWlocationA\FLOWlocation\end - \ignorespaces} - -\def\getFLOWlocationA#1,#2\end - {\ifnum0#1>\FLOWwidth \xdef\FLOWwidth {#1}\fi - \ifnum0#2>\FLOWheight\xdef\FLOWheight{#2}\fi} - -% Pass B -% -% beware: the - after \@FLOC@ is needed since name can be -% empty and we don't want to redefine \@FLOC@ itself by -% mistake - -\long\def\startFLOWcellB#1\stopFLOWcell - {\resetFLOWcell\ignorespaces#1\unskip - \setxvalue{\@FLOC@-\FLOWname}{\FLOWlocation}% kost veel cs's - \ifx\FLOWshape\empty - \global\let\FLOWshape\@@FLOSdefault - \fi - \doifnot\FLOWshape{none} % {\v!none} - {\ExpandBothAfter\doifinsetelse{\FLOWshape}{\FLOWshapes} - {\edef\FLOWshapetag{shape_\FLOWshape}% beter \expanded - \@EA\setFLOWname\@EA\FLOWshapetag\@EA{\FLOWshapetag}} - {\doifnumberelse\FLOWshape - {\let\FLOWshapetag\FLOWshape} - {\let\FLOWshapetag\empty}}% - \ifx\FLOWshapetag\empty \else - \ExpandBothAfter\doifinsetelse{\FLOWshape}{\FLOWlines} - {\chardef\FLOWstate0 } - {\ExpandBothAfter\doifcommonelse{\FLOWcell,\FLOWfocus}{\@@FLOWfocus} - {\chardef\FLOWstate1 } - {\chardef\FLOWstate2 }}% - \startMPdrawing - begin_sub_chart ; - \ifcase\FLOWstate - shape_line_color := \MPcolor{\@@FLOLcolor} ; - shape_fill_color := \MPcolor{\@@FLOLcolor} ; - shape_line_width := \@@FLOLrulethickness ; - \or - shape_line_color := \MPcolor{\@@FLOFframecolor} ; - shape_fill_color := \MPcolor{\@@FLOFbackgroundcolor} ; - shape_line_width := \@@FLOFrulethickness ; - \or - shape_line_color := \MPcolor{\@@FLOSframecolor} ; - shape_fill_color := \MPcolor{\@@FLOSbackgroundcolor} ; - shape_line_width := \@@FLOSrulethickness ; - \fi - %\ifx\FLOWoverlay\empty - % peepshape := false ; - %\else - % peepshape := true ; - %\fi - peepshape := \ifx\FLOWoverlay\empty false \else true \fi ; - new_shape(\FLOWlocation,\FLOWshapetag) ; - end_sub_chart ; - \stopMPdrawing - \fi}% - \ignorespaces} - -% Pass C - -\long\def\startFLOWcellC#1\stopFLOWcell% - {\resetFLOWcell -\pushmacro\lastFLOWx -\pushmacro\lastFLOWy - \ignorespaces#1\unskip % makes sure that vars are set -\popmacro\lastFLOWy -\popmacro\lastFLOWx - \let\connection\doFLOWconnectionC - \ignorespaces#1\unskip} - -\def\FLOWorigin{0,0} - -\def\doFLOWdisplace[#1,#2,#3]% experiment - {dsp_x := #1 ; dsp_y := #2 ;} - -\def\doFLOWconnectionC - {\dodoubleempty\dodoFLOWconnectionC} - -\def\dodoFLOWconnectionC[#1][#2]#3% - {\doglobal\increment\FLOWcomment - \setFLOWname\otherFLOWname{name_#3}% - \doifdefinedelse{\@FLOC@-\FLOWname} - {\edef\FLOWfrom{\getvalue{\@FLOC@-\FLOWname}}} - {\let \FLOWfrom \FLOWorigin}% - \ifx\FLOWfrom\FLOWorigin \else - \doifdefinedelse{\@FLOC@-\otherFLOWname} - {\edef\FLOWto {\getvalue{\@FLOC@-\otherFLOWname}}} - {\let \FLOWto \FLOWorigin}% - \ifx\FLOWto\FLOWorigin \else - \FLOWsetconnect{#1}% - \ifx\cFLOWfrom\empty \else - \doifelse\@@FLOLcorner\v!round - {\startMPdrawing smooth := true ; \stopMPdrawing} - {\startMPdrawing smooth := false ; \stopMPdrawing}% - \doifelse\@@FLOLdash\v!yes - {\startMPdrawing dashline := true ; \stopMPdrawing} - {\startMPdrawing dashline := false ; \stopMPdrawing}% - \doifelse\@@FLOLarrow\v!yes - {\startMPdrawing arrowtip := true ; \stopMPdrawing} - {\startMPdrawing arrowtip := false ; \stopMPdrawing}% - \doifelse\@@FLOLoffset\v!none - {\startMPdrawing touchshape := true ; \stopMPdrawing} - {\startMPdrawing touchshape := false ; \stopMPdrawing}% -%\doifsomething{#2} -% {\startMPdrawing -% \doFLOWdisplace[0#2,0,0]% -% \stopMPdrawing}% - \startMPdrawing -\doFLOWdisplace[0#2,0,0]% - connection_line_color := \MPcolor{\@@FLOLcolor} ; - connection_line_width := \@@FLOLrulethickness ; - connect_\cFLOWfrom_\cFLOWto (\FLOWfrom,\zFLOWfrom) (\FLOWto,\zFLOWto) ; -\doFLOWdisplace[0,0,0]% - \stopMPdrawing - \fi - \fi - \fi - \ignorespaces} - -% Pass D - -\long\def\startFLOWcellD#1\stopFLOWcell - {\resetFLOWcell -\pushmacro\lastFLOWx -\pushmacro\lastFLOWy - \ignorespaces#1\unskip % presets vars -\popmacro\lastFLOWy -\popmacro\lastFLOWx - \let\doprocessFLOWcell\doprocessFLOWcellD - \expandafter\doprocessFLOWcellD\FLOWlocation\end - \let\connection\doFLOWconnectionD - \let\comment\doFLOWcommentD - \ignorespaces#1\unskip\ignorespaces} - -\def\doFLOWconnectionD - {\dodoubleempty\dodoFLOWconnectionD} - -\def\dodoFLOWconnectionD[#1][#2]#3% - {\doglobal\increment\FLOWcomment - \ignorespaces} - -\def\doFLOWcommentD[#1]#2% - {\bgroup - \let\FLOW \middlebox - \let\FLOWb \bottombox - \let\FLOWbl\bottomleftbox - \let\FLOWbr\bottomrightbox - \let\FLOWt \topbox - \let\FLOWtl\topleftbox - \let\FLOWtr\toprightbox - \let\FLOWl \leftbox - \let\FLOWlt\lefttopbox - \let\FLOWlb\leftbottombox - \let\FLOWr \rightbox - \let\FLOWrt\righttopbox - \let\FLOWrb\rightbottombox - \let\FLOWc \middlebox -%\ifdefined{FLOW#1}% - \ifcase0\getvalue{\@@MPx\FLOWcomment}\getvalue{\@@MPy\FLOWcomment}\relax - \else - \ifdim\getvalue{\@@MPx\FLOWcomment}\s!bp<\areaMPllx\relax\else - \ifdim\getvalue{\@@MPx\FLOWcomment}\s!bp>\areaMPurx\relax\else - \ifdim\getvalue{\@@MPy\FLOWcomment}\s!bp<\areaMPlly\relax\else - \ifdim\getvalue{\@@MPy\FLOWcomment}\s!bp>\areaMPury\relax\else - \dimen0=\getvalue{\@@MPx\FLOWcomment}\s!bp - \advance\dimen0 -\@@FLOW@@offset - \advance\dimen0 -\clipMPllx - \dimen2=\clipMPury - \advance\dimen2 -\@@FLOW@@offset - \advance\dimen2 -\getvalue{\@@MPy\FLOWcomment}\s!bp - \setbox\scratchbox\hbox{\strut#2}% - \boxoffset.5\bodyfontsize - \setbox\scratchbox\hbox{\hskip\dimen0\lower\dimen2\getvalue{FLOW#1}{\box\scratchbox}}% - \smashbox\scratchbox - \box\scratchbox - \boxoffset\zeropoint - \nointerlineskip % really needed - \fi - \fi - \fi - \fi - \fi -%\fi - \egroup - \ignorespaces} - -% pass D - -\def\dophaseoneFLOWcellX#1#2% - {\!!counta#1\relax - \!!countb#2\relax - \!!countc\@@FLOWx - \!!countd\@@FLOWy - \advance\!!countc \@@FLOWnx - \advance\!!countd \@@FLOWny - \advance\!!countc \minusone - \advance\!!countd \minusone - \ifnum\!!counta<\@@FLOWx\relax \donefalse - \else\ifnum\!!counta>\!!countc \donefalse - \else\ifnum\!!countb<\@@FLOWy\relax \donefalse - \else\ifnum\!!countb>\!!countd \donefalse - \else \donetrue - \fi\fi\fi\fi} - -\def\dophasetwoFLOWcellX - {\advance\!!counta -\@@FLOWx - \advance\!!counta \plusone - \advance\!!countb -\@@FLOWy - \advance\!!countb \plusone - \dimen0=\FLOWgridwidth - \dimen0=\!!counta\dimen0 - \advance\dimen0 -\FLOWgridwidth - \dimen4=\FLOWgridwidth - \advance\dimen4 -\FLOWshapewidth - \advance\dimen0 .5\dimen4 - \dimen2=\FLOWgridheight - \dimen2=\!!countb\dimen2 - \dimen4=\FLOWgridheight - \advance\dimen4 -\FLOWshapeheight - \advance\dimen2 -.5\dimen4 - \edef\FLOWdx{\the\dimen0}% - \edef\FLOWdy{\the\dimen2}} - -\def\positionFLOWzero% assumes \FLOWdx and \FLOWdy are set - {\setbox0\hbox{\hskip\FLOWdx\lower\FLOWdy\box0}% - \smashbox0\box0 - \nointerlineskip} % new, needed since we somehow reset that - -\def\doFLOWtlabel#1#2#3% - {\scratchdimen\ifcase#2 \zeropoint\else\@@FLOWdy\fi - \setbox0\hbox{\hskip\dimen2\raise\scratchdimen - \hbox{\raise\dimen4\hbox{#1{\strut#3}}}}% - \positionFLOWzero}% - -\def\doFLOWblabel#1#2#3% - {\scratchdimen\ifcase#2 \zeropoint\else\@@FLOWdy\fi - \setbox0\hbox{\hskip\dimen2\raise-\scratchdimen - \hbox{#1{\strut#3}}}% - \positionFLOWzero}% - -\def\doFLOWllabel#1#2#3% - {\scratchdimen\ifcase#2 \zeropoint\else\@@FLOWdx\fi - \setbox0\hbox{\hskip-\scratchdimen\raise\dimen6 - \hbox{#1{\strut#3}}}% - \positionFLOWzero}% - -\def\doFLOWrlabel#1#2#3% - {\scratchdimen\ifcase#2 \zeropoint\else\@@FLOWdx\fi - \setbox0\hbox{\hskip\dimen0\hskip\scratchdimen - \hbox{\raise\dimen6\hbox{#1{\strut#3}}}}% - \positionFLOWzero} - -\def\doprocessFLOWcellD#1,#2\end - {\dophaseoneFLOWcellX{#1}{#2}% - \ifdone - \dophasetwoFLOWcellX - \doglobal\addtocommalist\FLOWcell\FLOWcells - \def\FLOWx{#1}% - \def\FLOWy{#2}% - \directsetup{flowcell}% - \setbox0\hbox - {\ifx\FLOWalign\empty\else - \setupframed - [\c!align=\v!normal,\c!bottom=\vfill,\c!top=\vfill]% - \@EA\processallactionsinset\@EA - [\FLOWalign] - [t=>{\setupframed[\c!bottom=\vfill,\c!top=]}, - b=>{\setupframed[\c!bottom=,\c!top=\vfill]}, - l=>{\setupframed[\c!align=\v!right]}, - r=>{\setupframed[\c!align=\v!left]}, - m=>{\setupframed[\c!align=\v!middle]}, - c=>{\setupframed[\c!align=\v!middle]}]% - \fi - \doifelse\FLOWshape{none} % {\v!none} - {\setupframed[\c!offset=\v!overlay]} - {\setupframed[\c!offset=\@@FLOSoffset]}% - \framed - [\c!frame=\v!off,\c!background=flowcell, - \c!width=\FLOWshapewidth,\c!height=\FLOWshapeheight] - {\FLOWtext}}% - \showFLOWhelp0 - \ifx\FLOWdestination\empty\else - \setbox0\hbox - {\setupinteraction[\c!color=,\c!contrastcolor=]% - \gotobox{\box0}[\FLOWdestination]}% - \fi - \positionFLOWzero - \dimen0=\FLOWshapewidth \dimen2=.5\dimen0 - \dimen4=\FLOWshapeheight\dimen6=.5\dimen4 - \boxoffset.5\bodyfontsize - \doFLOWtlabel \righttopbox0\tFLOWlabel - \doFLOWblabel\rightbottombox0\bFLOWlabel - \doFLOWllabel \lefttopbox0\lFLOWlabel - \doFLOWrlabel \righttopbox0\rFLOWlabel - \doFLOWtlabel \topbox0\tcFLOWlabel % for me only - \doFLOWblabel \bottombox0\bcFLOWlabel % for me only - \doFLOWllabel \leftbox0\lcFLOWlabel % for me only - \doFLOWrlabel \rightbox0\rcFLOWlabel % for me only - \ifnum#1=\@@FLOWx\relax \doFLOWllabel \leftbox1\lFLOWexit \fi - \ifnum#1=\!!countc \doFLOWrlabel \rightbox1\rFLOWexit \fi - \ifnum#2=\@@FLOWy\relax \doFLOWtlabel \topbox1\tFLOWexit \fi - \ifnum#2=\!!countd \doFLOWblabel \bottombox1\bFLOWexit \fi - \boxoffset\zeropoint - \fi} - -% For Willy Egger: -% -% \startsetups flowcell -% \definelayer -% [flowcell] -% [width=\FLOWshapewidth, -% height=\FLOWshapeheight] -% \setlayerframed -% [flowcell] -% [preset=rightbottom,offset=1ex] -% [frame=off] -% {\tx(\FLOWx,\FLOWy)} -% \stopsetups - -% Pass E - -\long\def\startFLOWcellE#1\stopFLOWcell - {\resetFLOWcell - \ignorespaces#1\unskip - \let\doprocessFLOWcell\doprocessFLOWcellE - \expandafter\doprocessFLOWcell\FLOWlocation\end} - -\def\doprocessFLOWcellE#1,#2\end % redundant - {\ifx\FLOWoverlay\empty \else - \dophaseoneFLOWcellX{#1}{#2}% - \ifdone - \dophasetwoFLOWcellX - \edef\FLOWdx{\the\dimen0}% - \edef\FLOWdy{\the\dimen2}% - \setbox0\hbox - {\framed - [%\c!frame=\v!off, - \c!background={\@@FLOWbackground,\FLOWoverlay}, - \c!backgroundcolor=\@@FLOSbackgroundcolor, - \c!width=\FLOWshapewidth,\c!height=\FLOWshapeheight] - {}}% - \positionFLOWzero - \fi - \fi} - -% Pass F - -\def\checkFLOWautofocus - {\def\@@FLOWminx{100}\let\@@FLOWminy\@@FLOWminx - \def\@@FLOWmaxx {0}\let\@@FLOWmaxy\@@FLOWmaxx - \def\@@FLOWabsx {0}\let\@@FLOWabsy\@@FLOWabsx - \let\startFLOWcell\startFLOWcellF - \resetFLOWlocation - \processFLOWbuffer\currentFLOWnumber - %\message{AUTOSHAPE 1: (\@@FLOWminx,\@@FLOWminy)->(\@@FLOWmaxx,\@@FLOWmaxy)}% - \ifnum\@@FLOWabsx<\@@FLOWmaxx\let\@@FLOWmaxx\@@FLOWabsx\fi - \ifnum\@@FLOWabsy<\@@FLOWmaxy\let\@@FLOWmaxy\@@FLOWabsy\fi - %\message{AUTOSHAPE 2: (\@@FLOWminx,\@@FLOWminy)->(\@@FLOWmaxx,\@@FLOWmaxy)}% - \donetrue - \ifnum\@@FLOWminx=100 \donefalse\fi - \ifnum\@@FLOWminy=100 \donefalse\fi - \ifnum\@@FLOWmaxx=0 \donefalse\fi - \ifnum\@@FLOWmaxy=0 \donefalse\fi - \doFLOWcheckF\@@FLOWx\@@FLOWminx\@@FLOWmaxx\@@FLOWnx - \doFLOWcheckF\@@FLOWy\@@FLOWminy\@@FLOWmaxy\@@FLOWny} - -\def\startFLOWcellF#1\stopFLOWcell% - {\resetFLOWcell - \ignorespaces#1\unskip - \expandafter\doFLOWlocationF\FLOWlocation\end}% - -\def\doFLOWlocationF#1,#2\end% - {\ifnum#1>\@@FLOWabsx\def\@@FLOWabsx{#1}\fi - \ifnum#2>\@@FLOWabsy\def\@@FLOWabsy{#2}\fi - \ExpandBothAfter\doifinset{\FLOWcell}{\@@FLOWautofocus} - {\dodoFLOWlocationF{#1}<-\@@FLOWminx - \dodoFLOWlocationF{#1}>+\@@FLOWmaxx - \dodoFLOWlocationF{#2}<-\@@FLOWminy - \dodoFLOWlocationF{#2}>+\@@FLOWmaxy}} - -\def\dodoFLOWlocationF#1#2#3#4% - {\ifnum#1#2#4\relax - \!!counta=#1\advance\!!counta #31\relax - \edef#4{\ifnum\!!counta<1 1\else\the\!!counta\fi}% - \fi} - -\def\doFLOWcheckF#1#2#3#4% - {\ifdone - \let#1=#2% - \!!counta=#3% - \advance\!!counta \plusone\advance\!!counta -#2\relax - \ifnum\!!counta<1 \!!counta=1 \fi - \edef#4{\the\!!counta}% - \else - \let#1\!!plusone - \let#4\!!zerocount % no {1} - \fi} - -% \useFLOWchart[name][parent][setting,setting][additional settings] -% \useFLOWchart[name][parent][additional settings] - -\let\currentFLOWchart\empty - -\def\useFLOWchart - {\doquadrupleempty\douseFLOWchart} - -\def\douseFLOWchart[#1][#2][#3][#4]% name parent sets mainsettings - {\iffourthargument - \setvalue{\@FLOW@--#1}[##1]{\setgetFLOWchart[#2][#3][#4,##1]}% - \else - \checkparameters[#3]% - \ifparameters - \setvalue{\@FLOW@--#1}[##1]{\setgetFLOWchart[#2][][#3,##1]}% - \else - \setvalue{\@FLOW@--#1}[##1]{\setgetFLOWchart[#2][#3][##1]}% - \fi - \fi} - -\def\setgetFLOWchart[#1][#2][#3]% - {\def\docommand##1{}% cell line focus ? - \processcommalist[#2]\docommand - \getFLOWchart[#1][#3]} - -\def\doFLOWchart[#1][#2]% - {\hbox\bgroup\vbox\bgroup % vmode suppresses spaces -\def\currentFLOWchart{#1}% - \doifundefinedelse{\@FLOW@--#1} - {\getFLOWchart[#1][#2]} - {\getvalue{\@FLOW@--#1}[#2]}% - \egroup\egroup} - -\def\FLOWchart% - {\dodoubleempty\doFLOWchart} - -%D A hook into the help system. - -\def\showFLOWhelp#1% - {\doifhelpinfo\FLOWhelp - {\setbox#1=\hbox - {\setbox\scratchbox=\hbox{\lower\@@FLOWdy\hbox - {\helpbutton - [\c!width=\wd0,\c!color=,\c!height=\@@FLOWdy,\c!frame=\v!no]% - [\FLOWhelp]}}% - \smashbox\scratchbox - \setbox#1=\vbox - {\forgetall\offinterlineskip\box#1\box\scratchbox}% - \box#1}}} - -%D The next section is dedicated to splitting up charts. - -\def\getFLOWsize[#1]% - {\bgroup\let\dodogetFLOWchart\dogetFLOWsize\FLOWchart[#1]\egroup} - -\def\dogetFLOWsize[#1][#2]% - {\setbox\scratchbox=\vbox - {\globallet\FLOWmaxwidth \!!zerocount - \globallet\FLOWmaxheight\!!zerocount - \def\getFLOWlocation##1,##2\end - {\ifnum0##1>\FLOWmaxwidth \xdef\FLOWmaxwidth {##1}\fi - \ifnum0##2>\FLOWmaxheight\xdef\FLOWmaxheight{##2}\fi}% - \resetFLOWcell - \long\def\startFLOWcell##1\stopFLOWcell - {{##1\expandafter\getFLOWlocation\FLOWlocation\end}}% - \def\dohandleflowchart[##1][##2]% - {\resetFLOWlocation - \processFLOWbuffer{##1}}% - \getvalue{\@FLOW@-#1}}} - -\def\setupFLOWsplit% - {\dodoubleargument\getparameters[\@@FLOT]} - -\setupFLOWsplit% - [\c!nx=3,\c!ny=3, - \c!dx=1,\c!dy=1, - \c!command=, - \c!marking=\v!on, - \c!before=,\c!after=] - -\def\FLOWsplitx {1} -\def\FLOWsplity {1} -\def\FLOWsplitnx{1} -\def\FLOWsplitny{1} - -\def\FLOWcharts% - {\dodoubleempty\doFLOWcharts} - -%D While splitting, the following variables are available: -%D -%D \starttyping -%D \FLOWsplitnx \FLOWsplitny \FLOWsplitx \FLOWsplity -%D \stoptyping - -\def\doFLOWcharts[#1][#2]% - {\bgroup - \getFLOWsize[#1]% - \dodoFLOWcharts\relax - \global\let\FLOWsplitnx\FLOWsplitx - \global\let\FLOWsplitny\FLOWsplity - \dodoFLOWcharts{\dododoFLOWcharts[#1][#2]}% - \egroup} - -\def\dodoFLOWcharts#1% - {\def\@@FLOTx{1}% - \global\let\FLOWsplitx\@@FLOTx - \doloop - {\def\@@FLOTy{1}% - \global\let\FLOWsplity\@@FLOTy - \doloop - {\bgroup - \scratchcounter\FLOWmaxwidth - \advance\scratchcounter -\@@FLOTx - \advance\scratchcounter \plusone - \ifnum\scratchcounter<\@@FLOTnx\edef\@@FLOTnx{\the\scratchcounter}\fi - \scratchcounter\FLOWmaxheight - \advance\scratchcounter -\@@FLOTy - \advance\scratchcounter \plusone - \ifnum\scratchcounter<\@@FLOTny\edef\@@FLOTny{\the\scratchcounter}\fi - #1% does something with the float, or not - \egroup - \increment(\@@FLOTy,\@@FLOTny)% - \ifnum\@@FLOTy>\FLOWmaxheight - \exitloop - \else - \doglobal\increment\FLOWsplity - \decrement(\@@FLOTy,\@@FLOTdy)% - \fi}% - \increment(\@@FLOTx,\@@FLOTnx)% - \ifnum\@@FLOTx>\FLOWmaxwidth - \exitloop - \else - \doglobal\increment\FLOWsplitx - \decrement(\@@FLOTx,\@@FLOTdx)% - \fi}} - -\def\dododoFLOWcharts[#1][#2]% - {\bgroup - \@@FLOTbefore - \doifnot\@@FLOTmarking\v!on{\let\cuthbox\hbox}% - \cuthbox - {\@@FLOTcommand - {\FLOWchart[#1][#2, - \c!x=\@@FLOTx,\c!nx=\@@FLOTnx, - \c!y=\@@FLOTy,\c!ny=\@@FLOTny]}}% - \@@FLOTafter - \egroup} - -%D An example of splitting is given below: -%D -%D \starttyping -%D \setupFLOWsplit -%D [nx=5,ny=10, -%D dx=0,dy=0, -%D before=, -%D after=\page] -%D -%D \FLOWcharts[mybigflow] -%D \stoptyping -%D -%D Or, one can say: -%D -%D \starttyping -%D \splitfloat -%D {\placefigure{What a big flowchart this is!}} -%D {\FLOWcharts[mybigflow]} -%D \stoptyping - -%D \macros -%D {typeFLOWchart} -%D -%D For documentation purposes the following macro is -%D provided. Watch the use of the first and last line hooks, -%D which is needed because the start and stop commands are -%D not part of the buffer. - -\def\typeFLOWchart[#1]% - {\bgroup - \def\dohandleflowchart[##1][##2]{\typeFLOWbuffer{##1}}% - \defconvertedargument\firstverbatimfileline{\startFLOWchart[#1]}% - \defconvertedargument\lastverbatimfileline {\stopFLOWchart}% - \getvalue{\@FLOW@-#1} - \egroup} - -%D New: -%D -%D \starttyping -%D \setupFLOWcharts[command=\Whow] -%D -%D \startFLOWset[convert-en] % [tag][convert-en] -%D \subFLOWchart[a][x=1,y=1,nx=3,ny=3] -%D \subFLOWchart[b][x=1,y=2,nx=3,ny=3] -%D \subFLOWchart[c][x=2,y=1,nx=3,ny=3] -%D \stopFLOWset -%D -%D \def\Whow#1% -%D {\ifnum\currentFLOWset=1 \framed{Some Chart}\fi} -%D -%D \FLOWset[convert-en] % [tag] -%D -%D \def\Whow#1% -%D {\setuphead[state=high] -%D \startstandardmakeup -%D \centerbox{#1} -%D \stopstandardmakeup} -%D -%D \FLOWset[convert-en] % [tag] -%D \stoptyping - -\def\startFLOWset - {\dodoubleempty\dostartFLOWset} - -\def\dostartFLOWset[#1][#2]#3\stopFLOWset % tag name data - {\ifsecondargument - \long\setvalue{\@FLOX@#1}{\dohandleFLOWset{#1}{#2}{#3}}% - \else - \long\setvalue{\@FLOX@#1}{\dohandleFLOWset{#1}{#1}{#3}}% - \fi} - -\long\def\dohandleFLOWset#1#2#3% tag name data - {\bgroup - \def\subFLOWchart - {\dodoubleempty\dosubFLOWchart}% - \def\dosubFLOWchart[##1][##2]% subtag settings - {\ifsecondargument - \dodohandleFLOWset{#1}{##1}{#2}{##2}% - \else - \subFLOWchart[][##1]% - \fi}% - #3% - \egroup} - -\def\dodohandleFLOWset#1#2#3#4% tag subtag name settings - {\increment\currentFLOWset - \bgroup - \@@FLOXcommand - {\ifnum\currentFLOWset=1 \pagereference[#1]\fi - \doifsomething{#2} - {\setupreferencing[\c!prefix=]% - \pagereference[#1:#2]% -:#1:#2 - \setupreferencing[\c!prefix=#1:#2]}% - \FLOWchart[#3][#4]}% - \egroup} - -\def\FLOWset[#1]% - {\newcounter\currentFLOWset - \doifdefinedelse{\@FLOX@#1} - {\getvalue{\@FLOX@#1}} - {\dodohandleFLOWset{#1}{}{#1}{}}} - -\newcounter\currentFLOWset - -\setupFLOWsets - [\c!command=] - -%D This will be an option: - -% \def\startFLOWchart% -% {\dodoubleempty\dostartFLOWchart} -% -% \long\def\dostartFLOWchart[#1][#2]#3\stopFLOWchart -% {\preparenextFLOWchart{#1}{#2}% -% \long\setgvalue{\FLOWbufferprefix\nofFLOWcharts}{#3}} -% -% \long\def\dodefineFLOWchart[#1][#2]#3% -% {\preparenextFLOWchart{#1}{#2}% -% \long\setgvalue{\FLOWbufferprefix\nofFLOWcharts}{#3}} -% -% \def\processFLOWbuffer#1{\getvalue{\FLOWbufferprefix#1}} -% \def\typeFLOWbuffer #1{[Sorry, no verbatim chart #1 available.]} +%D This file will become obsolete. \loadmarkfile{m-chart} diff --git a/Master/texmf-dist/tex/context/base/m-chemic.tex b/Master/texmf-dist/tex/context/base/m-chemic.tex deleted file mode 100644 index 7bacf4a9048..00000000000 --- a/Master/texmf-dist/tex/context/base/m-chemic.tex +++ /dev/null @@ -1,17 +0,0 @@ -%D \module -%D [ file=ppchtex (m-chemic), -%D version=1997.03.19, -%D title=\CONTEXT\ Extra Modules, -%D subtitle=\PPCHTEX\ (Plain Pictex Context cHemie \TEX), -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}, -%D suggestions={Tobias Burnus, Dirk Kuypers \& 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. - -\loadmarkfile{m-chemic} - -\endinput diff --git a/Master/texmf-dist/tex/context/base/m-database.lua b/Master/texmf-dist/tex/context/base/m-database.lua new file mode 100644 index 00000000000..8dde9690e96 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-database.lua @@ -0,0 +1,108 @@ +if not modules then modules = { } end modules ['m-database'] = { + version = 1.001, + comment = "companion to m-database.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local sub, gmatch, format = string.sub, string.gmatch, string.format +local concat = table.concat +local lpegpatterns, lpegmatch, lpegsplitat = lpeg.patterns, lpeg.match, lpeg.splitat +local lpegP, lpegC, lpegS, lpegCt = lpeg.P, lpeg.C, lpeg.S, lpeg.Ct +local sprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes + +local trace_flush = false trackers.register("module.database.flush", function(v) trace_flush = v end) + +local report_database = logs.reporter("database") + +buffers.database = buffers.database or { } + +local separators = { -- not interfaced + tab = lpegpatterns.tab, + tabs = lpegpatterns.tab^1, + comma = lpegpatterns.comma, + space = lpegpatterns.space, + spaces = lpegpatterns.space^1, +} + +local function tracedsprint(c,str) + report_database("snippet: %s",str) + sprint(c,str) +end + +function buffers.database.process(settings) + local data + local sprint = trace_flush and tracedsprint or sprint + if settings.type == "file" then + local filename = resolvers.finders.byscheme("any",settings.database) + data = filename ~= "" and io.loaddata(filename) + data = data and string.splitlines(data) + else + data = buffers.getlines(settings.database) + end + if data and #data > 0 then + local separatorchar, quotechar, commentchar = settings.separator, settings.quotechar, settings.commentchar + local before, after = settings.before or "", settings.after or "" + local first, last = settings.first or "", settings.last or "" + local left, right = settings.left or "", settings.right or "" + local setups = settings.setups or "" + local command = settings.command + separatorchar = (not separatorchar and ",") or separators[separatorchar] or separatorchar + local separator = type(separatorchar) == "string" and lpegS(separatorchar) or separatorchar + local whatever = lpegC((1 - separator)^0) + if quotechar and quotechar ~= "" then + local quotedata = nil + for chr in gmatch(quotechar,".") do + local quotechar = lpegP(chr) + local quoteword = quotechar * lpeg.C((1 - quotechar)^0) * quotechar + if quotedata then + quotedata = quotedata + quoteword + else + quotedata = quoteword + end + end + whatever = quotedata + whatever + end + local checker = commentchar ~= "" and lpeg.S(commentchar) + local splitter = lpegCt(whatever * (separator * whatever)^0) + local found = false + for i=1,#data do + local line = data[i] + if line ~= "" and (not checker or not lpegmatch(checker,line)) then + local result, r = { }, 0 -- we collect as this is nicer in tracing + local list = lpegmatch(splitter,line) + if not found then + if setups ~= "" then + sprint(ctxcatcodes,format("\\begingroup\\setups[%s]",setups)) + end + sprint(ctxcatcodes,before) + found = true + end + r = r + 1 ; result[r] = first + for j=1,#list do + r = r + 1 ; result[r] = left + if command == "" then + r = r + 1 ; result[r] = list[j] + else + r = r + 1 ; result[r] = command + r = r + 1 ; result[r] = "{" + r = r + 1 ; result[r] = list[j] + r = r + 1 ; result[r] = "}" + end + r = r + 1 ; result[r] = right + end + r = r + 1 ; result[r] = last + sprint(ctxcatcodes,concat(result)) + end + end + if found then + sprint(ctxcatcodes,after) + if setups ~= "" then + sprint(ctxcatcodes,"\\endgroup") + end + end + else + -- message + end +end diff --git a/Master/texmf-dist/tex/context/base/m-database.mkii b/Master/texmf-dist/tex/context/base/m-database.mkii new file mode 100644 index 00000000000..3bb050f142a --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-database.mkii @@ -0,0 +1,421 @@ +%D \module +%D [ file=m-database, +%D version=2006.04.23, +%D title=\CONTEXT\ Modules, +%D subtitle=Database Thingies, +%D author=Hans Hagen\& Taco Hoekwater, +%D date=\currentdate, +%D copyright=PRAGMA +%D ] + +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +% % % to be added to mult-* files +% +% % % todo: \dontcollectseparatedlist via k/v + +\definesystemvariable{ls} + +\def\c!first {first} +\def\c!last {last} +\def\c!quotechar {quotechar} + +\let\@NX\noexpand + +%D {processquotedlist} +%D +%D An even more general list processing macro is the +%D following one: +%D +%D \starttyping +%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(){,}{"}\docommand(a=>b=>c=>d) +%D \stoptyping + +\def\processquotedlist#1#2#3#4#5% + {\def\csvquotechar{#4}% + \edef\doconvertcsvquoteditem#4##1#4##2% + {\@NX\ifx##2#3% + \let\@NX\next\@NX\doconvertcsvlist + \def\@NX\arg{#3}% + \edef\@NX\temp{##1}% + \@NX\expanded{\@NX#5{\@NX\temp}}% + \@NX\else + \let\@NX\next\@NX\redoconvertcsvquoteditem + \def\@NX\arg{##1\@NX\csvquotechar}% + \@NX\fi + \@NX\expandafter\@NX\next\@NX\arg}% + \edef\redoconvertcsvquoteditem##1#4##2% + {\@NX\ifx##2#3% + \let\@NX\next\@NX\doconvertcsvlist + \def\@NX\arg{#3}% + \edef\@NX\temp{##1}% + \@NX\expanded{\@NX#5{\@NX\temp}}% + \@NX\else + \let\@NX\next\@NX\redoconvertcsvquoteditem + \def\@NX\arg{##1\@NX\csvquotechar}% + \@NX\fi + \@NX\expandafter\@NX\next\@NX\arg}% + \edef\doconvertcsvitem##1#3% + {\edef\@NX\temp{##1}% + \@NX\expanded{\@NX#5{\@NX\temp}}% + \@NX\doconvertcsvlist#3}% + \edef\doconvertcsvlist#3##1% + {\@NX\ifx##1\@NX#2% + \let\@NX\next \@NX\gobbleoneargument + \@NX\else\@NX\ifx##1#4% + \let\@NX\next \@NX\doconvertcsvquoteditem + \@NX\else + \let\@NX\next \@NX\doconvertcsvitem + \@NX\fi\@NX\fi \@NX\next##1}% + \doconvertcsvitem} + +\gdef\doprocessseparatedquoteditem#1% + {\appendseparatedlistparameter\c!left% + \appendseparatedlistcontent{#1}% + \appendseparatedlistparameter\c!right} + +% a version more robust with regard to {a a} b c d situations: + +\edef\detokenizedrelax{\detokenize{\relax}} + +\edef\processseplistseparator{\detokenize{,}}% + +\def\dodefineprocessseplist#1#2% separator \docommand + {\edef\processseplistseparator{\detokenize{#1}}% + \def\dodoprocessseplist##1##2#1% + {\edef\!!stringa{\detokenize{##1}}% + \ifx\detokenizedrelax\!!stringa + \expandafter\nodoprocessseplist + % \else\ifx\!!stringa#1% + \else\ifx\!!stringa\processseplistseparator + #2{}% + #2{##2}% + \expandafter\expandafter\expandafter\dodoprocessseplist + \else + #2{##1##2}% + \expandafter\expandafter\expandafter\dodoprocessseplist + \fi\fi}% + \def\doprocessseplist##1\relax + {\dodoprocessseplist##1#1\relax#1\relax\relax\end}} + +\def\nodoprocessseplist#1\end + {} + +\long\def\processseplist#1#2#3\relax raw version + {\dodefineprocessseplist{#1}{#2}% + \dodoprocessseplist#3#1\relax#1\relax\relax\end} + +% \dodefineprocessseplist{,}\test +% \dodoprocessseplist{,}a,b,c\relax,\relax\relax\end +% \doprocessseplista,b,c\relax + +% \def\test#1{[#1]} +% \startlines +% \processseplist{,}\test ,2,,\relax +% \processseplist{,}\test ,,,44\relax +% \processseplist{,}\test ,,33,44\relax +% \processseplist{,}\test 11,,33,44\relax +% \processseplist{,}\test 1,2,3,4\relax +% \stoplines + +\newtoks\separatedlistdata + +\def\appendseparatedlistparameter#1% + {\@EAEAEA\appendtoks\csname\??ls\currentseparatedlist#1\endcsname\to\separatedlistdata} + +\def\appendseparatedlistcontent#1% + {\appendtoks#1\to\separatedlistdata} + +\def\flushseparatedlistdata + {\the\separatedlistdata + \separatedlistdata\emptytoks} + +\def\initializeseparatedlistdata + {\separatedlistdata{\egroup}} + +\def\dontcollectseparatedlist + {\def\dodoprocessseparatedfileline + {\the\separatedlistdata + \separatedlistdata\emptytoks + \doprocessseparatedfileline}% + \def\dodoprocessseparatedline + {\the\separatedlistdata + \separatedlistdata\emptytoks + \doprocessseparatedline}% + \let\flushseparatedlistdata\egroup + \let\initializeseparatedlistdata\donothing} + +\chardef\separatedlistmode\zerocount + +\def\setcurrentlistseparator + {\edef\currentlistseparator + {\executeifdefined + {\??ls::\csname\??ls\currentseparatedlist\c!separator\endcsname}% + {\csname\??ls\currentseparatedlist\c!separator\endcsname}}% + \doifvalue{\??ls\currentseparatedlist\c!separator}{tab} + {\catcode`\^^I=12\relax}% + \ifx\currentlistseparator\empty\def\currentlistseparator{,}\fi} + +\bgroup \catcode`\^^I=12 + \setgvalue{\??ls::tab}{ } + \setgvalue{\??ls::space}{ } + \setgvalue{\??ls::comma}{,} +\egroup + +\def\doprocessseparatedfileline + {\ifeof\scratchread + \ifcase\separatedlistmode\appendseparatedlistparameter\c!after\fi + \immediate\closein\scratchread + \expandafter\flushseparatedlistdata + \else\ifx\line\empty + % skip, can be comment + \read\scratchread to\line + \@EA\dodoprocessseparatedfileline + \else + \appendseparatedlistparameter{\ifcase\separatedlistmode\c!first\else\c!command\fi}% + \ifx\currentlistquotechar\empty% + \expandafter\doprocessseplist\line\relax + \else + \expanded{\processquotedlist{}{\noexpand\end}% + {\currentlistseparator}{\currentlistquotechar}% + \noexpand\doprocessseparatedquoteditem \line\currentlistseparator\noexpand\end}% + \fi + \ifcase\separatedlistmode\appendseparatedlistparameter\c!last\fi + \read\scratchread to\line + \@EAEAEA\dodoprocessseparatedfileline + \fi\fi} + +\def\dodoprocessseparatedfileline + {\doprocessseparatedfileline} + +\def\doprocessseparatedfile[#1][#2]% + {\bgroup + \edef\currentseparatedlist{#1}% + \doifdefined{\??ls\currentseparatedlist\c!command}{\chardef\separatedlistmode\plusone}% + \setcurrentlistseparator + \edef\currentlistquotechar{\csname\??ls\currentseparatedlist\c!quotechar\endcsname}% + \expandafter\dodefineprocessseplist\expandafter{\currentlistseparator}\doprocessseparateditem + \initializeseparatedlistdata + \directsetup{\currentseparatedlist:\executeifdefined{\??ls\currentseparatedlist\c!setups}\s!default}% + \ifcase\separatedlistmode\appendseparatedlistparameter\c!before\fi + \endlinechar\minusone + \ignorelines + \catcode`\#\@@comment + \immediate\openin\scratchread=#2\relax % todo: \doopenin + \read\scratchread to\line + \doprocessseparatedfileline} + +\def\dostartseparatedlist#1[#2]% + {\bgroup + \edef\currentseparatedlist{#2}% + \doifdefined{\??ls\currentseparatedlist\c!command}{\chardef\separatedlistmode\plusone}% + \obeylines + \let#1\relax + \def\separateslistend{#1}% + \setcurrentlistseparator + \edef\currentlistquotechar{\csname\??ls\currentseparatedlist\c!quotechar\endcsname}% + \expandafter\dodefineprocessseplist\expandafter{\currentlistseparator}\doprocessseparateditem + \directsetup{\currentseparatedlist:\executeifdefined{\??ls\currentseparatedlist\c!setups}\s!default}% + \initializeseparatedlistdata + \ifcase\separatedlistmode\appendseparatedlistparameter\c!before\fi + \dodostartseparatedlist} + +\def\redoprocessseparatedline#1% + {\def\!!stringa{#1}% + \ifx\!!stringa\separateslistend + \ifcase\separatedlistmode\appendseparatedlistparameter\c!after\fi + \expandafter\flushseparatedlistdata + \else% + \appendseparatedlistparameter{\ifcase\separatedlistmode\c!first\else\c!command\fi}% + \ifx\currentlistquotechar\empty% + \doprocessseplist#1\relax + \else% + \defconvertedargument\csvdata{#1}% + \expanded{\processquotedlist{}{\noexpand\end}% + {\currentlistseparator}{\currentlistquotechar}% + \noexpand\doprocessseparatedquoteditem \csvdata\currentlistseparator\noexpand\end}% + \fi + \ifcase\separatedlistmode\appendseparatedlistparameter\c!last\fi + \expandafter\dodoprocessseparatedline + \fi} + +\def\doprocessseparatedline + {\doifnextbgroupelse\xdoprocessseparatedline\ydoprocessseparatedline} + +\def\dodoprocessseparatedline + {\doprocessseparatedline} + +\def\doprocessseparateditem#1% + {\ifcase\separatedlistmode + \appendseparatedlistparameter\c!left + \appendseparatedlistcontent{#1}% + \appendseparatedlistparameter\c!right + \else + \appendseparatedlistcontent{{#1}}% + \fi} + + +\bgroup \obeylines + + \gdef\dodostartseparatedlist#1 + {\doprocessseparatedline} + + \gdef\xdoprocessseparatedline#1#2 + {\redoprocessseparatedline{{{#1}}#2}} + + \gdef\ydoprocessseparatedline#1 + {\redoprocessseparatedline{#1}} + +\egroup + +\startsetups CSV:unix + \catcode`\#=\@@comment +\stopsetups + +\def\defineseparatedlist + {\dodoubleempty\dodefineseparatedlist} + +\def\dodefineseparatedlist[#1][#2]% + {\setvalue{\e!start#1}{\expandafter\dostartseparatedlist\csname\e!stop#1\endcsname[#1]}% + \getparameters + [\??ls#1] + [\c!separator=, + \c!quotechar=, + \c!first=, + \c!left=, + \c!before=, + \c!right=, + \c!last=, + \c!after=, +% \c!command=, + #2]} + +\def\setupseparatedlist + {\dodoubleempty\dosetupseparatedlist} + +\def\dosetupseparatedlist[#1]% [#2] + {\getparameter[\??ls#1]} % [#2] + +\def\startseparatedlist[#1]% + {\dostartseparatedlist\stopseparatedlist[#1]} + +\def\processseparatedfile + {\dodoubleargument\doprocessseparatedfile} + +\protect \doifnotmode{demo}{\endinput} + +\defineseparatedlist + [CSV] + [separator={,}, + first=\bTR,last=\eTR, + left=\bTD,right=\eTD, + before=\bTABLE,after=\eTABLE] + +\startseparatedlist[CSV] +a,b,c +d,e,f +\stopseparatedlist + +\startCSV +a,b,c +d,e,f +\stopCSV + +\defineseparatedlist + [CSV] + [separator={,}, + quotechar={"}, + first=\NC,last=\NR, + left=,right=\NC, + before={\starttabulate[|l|l|l|]},after=\stoptabulate] + +\startCSV +a,b,"c,d" +d,"""",f +\stopCSV + +\defineseparatedlist + [CSV] + [separator={ }, + first=\NC,last=\NR, + left=,right=\NC, + before={\starttabulate[|l|l|l|]},after=\stoptabulate] + +\startCSV +a b c +d e f +\stopCSV + +\defineseparatedlist + [CSV] + [setups=unix, + first=\NC,last=\NR, + left=,right=\NC, + before={\starttabulate[|l|l|l|]},after=\stoptabulate] + +% \startsetups CSV:unix +% \catcode`\#=\@@comment +% \stopsetups + +% %1,2,3 +% 1,2,3 +% # 4,5,6 +% 4,5,6 + +\processseparatedfile[CSV][test.dat] + +\defineseparatedlist + [CSVX] + [command=\Whatever, + separator={,}, + first=\bTR,last=\eTR, + left=\bTD,right=\eTD, + before=\bTABLE,after=\eTABLE] + +\def\Whatever#1#2#3{[#1][#2][#3]\endgraf} + +\startseparatedlist[CSVX] +a,b,c +d,e,f +\stopseparatedlist + +\defineseparatedlist[CSV] + [separator=comma, + before=\bTABLE, after=\eTABLE, + first=\bTR, last=\eTR, + left=\bTD, right=\eTD] + +\startCSV +a,b,c,č +d,e,f,š +\stopCSV + +\enableregime[utf] + +\defineseparatedlist[X][separator=X,left=(,right=),first=\endgraf,last=\endgraf] +\defineseparatedlist[Y][separator=Y,left=(,right=),first=\endgraf,last=\endgraf] + +\startX +aXb +Xc +čXš +\stopX + +\startY +aYb +Yc +čYš +\stopY + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/m-database.mkiv b/Master/texmf-dist/tex/context/base/m-database.mkiv new file mode 100644 index 00000000000..0653bfa0e94 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-database.mkiv @@ -0,0 +1,241 @@ +%D \module +%D [ file=m-database, +%D version=2010.08.04, +%D title=\CONTEXT\ Modules, +%D subtitle=Database Thingies, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA +%D ] + +%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 Mojca. + +\registerctxluafile{m-database}{1.001} + +\unprotect + +\def\c!first {first} +\def\c!last {last} +\def\c!quotechar {quotechar} +\def\c!commentchar {commentchar} + +% \def\????db{@@@@db} +% +% \installparameterhandler \????db {database} +% \installcommandhandler \????db {database} \????db % #3 == defaultroot +% \installattributehandler \????db {database} +% +% or: +% +% \installnamespace{db} \installcommandhandler\????db{database}\????db +% +% \appendtoks +% \getparameters +% [\????db\currentdatabase] +% [\c!separator={,}, +% \c!quotechar=, +% \c!commentchar=, +% \c!setups=, +% \c!before=, +% \c!after=, +% \c!first=, +% \c!last=, +% \c!left=, +% \c!right=, +% \c!command=]% +% \to \everypresetdatabase +% +% or: + +\definenamespace + [db] + [type=module, + comment=database module, + version=1, + name=database, + parent=db, + setup=yes, + command=yes] + +\setupdatabase + [\c!separator={,}, + \c!quotechar=, + \c!commentchar=, + \c!before=, + \c!after=, + \c!first=, + \c!last=, + \c!left=, + \c!right=] + +% \let\currentdatabase\empty \the\everypresetdatabase % or just: + +\setupdatabase + [\c!separator={,}] + +\def\doprocessdatabase#1#2#3% + {\edef\currentdatabasetype{#1}% + \edef\currentdatabase {#2}% + \edef\currentdatabasename{#3}% + \ifx\currentdatabasename\empty + \let\currentdatabasename\currentdatabase + \let\currentdatabase\empty + \fi + \ctxlua{buffers.database.process { + name = "\currentdatabase", + type = "\currentdatabasetype", + database = "\currentdatabasename", + separator = \!!bs\databaseparameter\c!separator \!!es, + quotechar = \!!bs\databaseparameter\c!quotechar \!!es, + commentchar = \!!bs\databaseparameter\c!commentchar\!!es, + setups = \!!bs\databaseparameter\c!setups \!!es, + before = \!!bs\databaseparameter\c!before \!!es, + after = \!!bs\databaseparameter\c!after \!!es, + first = \!!bs\databaseparameter\c!first \!!es, + last = \!!bs\databaseparameter\c!last \!!es, + left = \!!bs\databaseparameter\c!left \!!es, + right = \!!bs\databaseparameter\c!right \!!es, + command = \!!bs\databaseparameter\c!command \!!es, + }}} + +\unexpanded\def\processdatabasebuffer{\dodoubleempty\doprocessdatabasebuffer} +\unexpanded\def\processdatabasefile {\dodoubleempty\doprocessdatabasefile } + +\def\doprocessdatabasebuffer[#1][#2]{\doprocessdatabase{buffer}{#1}{#2}} +\def\doprocessdatabasefile [#1][#2]{\doprocessdatabase{file} {#1}{#2}} + +% for old times sake: + +\def\defineseparatedlist {\dodoubleempty\dodefineseparatedlist } +\def\processseparatedfile{\dodoubleempty\doprocessseparatedfile} + +\def\dodefineseparatedlist[#1][#2]% + {\definedatabase[#1][#2]% + \setuvalue{\e!start#1}{\dostartbuffer[#1][\e!start#1][\e!stop#1]}% + \setuvalue{\e!stop#1}{\processdatabasebuffer[#1][#1]}} + +\def\processseparatedfile[#1][#2]% + {\processdatabasefile[#1][#2]} + +\def\startseparatedlist[#1]% to be interfaced + {\def\stopseparatedlist{\processdatabasebuffer[#1][#1]}% + \dostartbuffer[#1][startseparatedlist][stopseparatedlist]} + +\protect + +\doifnotmode{demo}{\endinput} + +\starttext + +% m-database.txt +% +% 1,2,3,4,5 +% 6,7,8,"9,x",0 +% A,B,C,D +% E,,F +% G + +\definedatabase[test] + +\setupdatabase + [test] + [separator={,}, + quotechar={"}, + before={<}, + after={>}, + first={\endgraf[}, + last={]\endgraf}, + left={ (}, + right={) }, + command=\ruledhbox] + +\startbuffer[testbuffer] +1,2,3,4,5 +6,7,8,"9,x",0 +A,B,C,D +E,,F +G +\stopbuffer + +\processdatabasebuffer[test][testbuffer] + +\processdatabasefile[test][m-database.txt] + +\defineseparatedlist + [CSV] + [separator={,}, + before=\bTABLE,after=\eTABLE, + first=\bTR,last=\eTR, + left=\bTD,right=\eTD] + +% \startseparatedlist[CSV] +% a,b,c +% d,e,f +% \stopseparatedlist + +\startCSV +a,b,c +d,e,f +\stopCSV + +\defineseparatedlist + [CSV] + [separator={,+},quotechar={"'},commentchar=\letterhash, + before={\starttabulate[|l|l|l|]},after=\stoptabulate, + first=\NC,last=\NR, + left=,right=\NC] + +\startCSV +#a,b,"c,d" +a,b,"c,d" +a,'b,c',d +"a,b"+c+d +\stopCSV + +\defineseparatedlist + [CSV] + [separator=space, + first=\NC,last=\NR, + left=,right=\NC, + before={\starttabulate[|l|l|l|]},after=\stoptabulate] + +\startCSV +a b c +d e f +\stopCSV + +\startsetups csv:unix + \catcode\hashasciicode\commentcatcode +\stopsetups + +\defineseparatedlist + [CSV] + [setups=csv:unix, + separator={,}, + first=\NC,last=\NR, + left=,right=\NC, + before={\starttabulate[|l|l|l|]},after=\stoptabulate] + +\processseparatedfile[CSV][m-database.txt] + +\defineseparatedlist[CSV] + [separator=comma, + before=\bTABLE, after=\eTABLE, + first=\bTR, last=\eTR, + left=\bTD, right=\eTD] + +\startCSV +a,b,c,č +d,e,f,š +\stopCSV + +\startseparatedlist[CSV] +a,b,c,č +d,e,f,š +\stopseparatedlist + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/m-database.tex b/Master/texmf-dist/tex/context/base/m-database.tex deleted file mode 100644 index 3bb050f142a..00000000000 --- a/Master/texmf-dist/tex/context/base/m-database.tex +++ /dev/null @@ -1,421 +0,0 @@ -%D \module -%D [ file=m-database, -%D version=2006.04.23, -%D title=\CONTEXT\ Modules, -%D subtitle=Database Thingies, -%D author=Hans Hagen\& Taco Hoekwater, -%D date=\currentdate, -%D copyright=PRAGMA -%D ] - -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\unprotect - -% % % to be added to mult-* files -% -% % % todo: \dontcollectseparatedlist via k/v - -\definesystemvariable{ls} - -\def\c!first {first} -\def\c!last {last} -\def\c!quotechar {quotechar} - -\let\@NX\noexpand - -%D {processquotedlist} -%D -%D An even more general list processing macro is the -%D following one: -%D -%D \starttyping -%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(){,}{"}\docommand(a=>b=>c=>d) -%D \stoptyping - -\def\processquotedlist#1#2#3#4#5% - {\def\csvquotechar{#4}% - \edef\doconvertcsvquoteditem#4##1#4##2% - {\@NX\ifx##2#3% - \let\@NX\next\@NX\doconvertcsvlist - \def\@NX\arg{#3}% - \edef\@NX\temp{##1}% - \@NX\expanded{\@NX#5{\@NX\temp}}% - \@NX\else - \let\@NX\next\@NX\redoconvertcsvquoteditem - \def\@NX\arg{##1\@NX\csvquotechar}% - \@NX\fi - \@NX\expandafter\@NX\next\@NX\arg}% - \edef\redoconvertcsvquoteditem##1#4##2% - {\@NX\ifx##2#3% - \let\@NX\next\@NX\doconvertcsvlist - \def\@NX\arg{#3}% - \edef\@NX\temp{##1}% - \@NX\expanded{\@NX#5{\@NX\temp}}% - \@NX\else - \let\@NX\next\@NX\redoconvertcsvquoteditem - \def\@NX\arg{##1\@NX\csvquotechar}% - \@NX\fi - \@NX\expandafter\@NX\next\@NX\arg}% - \edef\doconvertcsvitem##1#3% - {\edef\@NX\temp{##1}% - \@NX\expanded{\@NX#5{\@NX\temp}}% - \@NX\doconvertcsvlist#3}% - \edef\doconvertcsvlist#3##1% - {\@NX\ifx##1\@NX#2% - \let\@NX\next \@NX\gobbleoneargument - \@NX\else\@NX\ifx##1#4% - \let\@NX\next \@NX\doconvertcsvquoteditem - \@NX\else - \let\@NX\next \@NX\doconvertcsvitem - \@NX\fi\@NX\fi \@NX\next##1}% - \doconvertcsvitem} - -\gdef\doprocessseparatedquoteditem#1% - {\appendseparatedlistparameter\c!left% - \appendseparatedlistcontent{#1}% - \appendseparatedlistparameter\c!right} - -% a version more robust with regard to {a a} b c d situations: - -\edef\detokenizedrelax{\detokenize{\relax}} - -\edef\processseplistseparator{\detokenize{,}}% - -\def\dodefineprocessseplist#1#2% separator \docommand - {\edef\processseplistseparator{\detokenize{#1}}% - \def\dodoprocessseplist##1##2#1% - {\edef\!!stringa{\detokenize{##1}}% - \ifx\detokenizedrelax\!!stringa - \expandafter\nodoprocessseplist - % \else\ifx\!!stringa#1% - \else\ifx\!!stringa\processseplistseparator - #2{}% - #2{##2}% - \expandafter\expandafter\expandafter\dodoprocessseplist - \else - #2{##1##2}% - \expandafter\expandafter\expandafter\dodoprocessseplist - \fi\fi}% - \def\doprocessseplist##1\relax - {\dodoprocessseplist##1#1\relax#1\relax\relax\end}} - -\def\nodoprocessseplist#1\end - {} - -\long\def\processseplist#1#2#3\relax raw version - {\dodefineprocessseplist{#1}{#2}% - \dodoprocessseplist#3#1\relax#1\relax\relax\end} - -% \dodefineprocessseplist{,}\test -% \dodoprocessseplist{,}a,b,c\relax,\relax\relax\end -% \doprocessseplista,b,c\relax - -% \def\test#1{[#1]} -% \startlines -% \processseplist{,}\test ,2,,\relax -% \processseplist{,}\test ,,,44\relax -% \processseplist{,}\test ,,33,44\relax -% \processseplist{,}\test 11,,33,44\relax -% \processseplist{,}\test 1,2,3,4\relax -% \stoplines - -\newtoks\separatedlistdata - -\def\appendseparatedlistparameter#1% - {\@EAEAEA\appendtoks\csname\??ls\currentseparatedlist#1\endcsname\to\separatedlistdata} - -\def\appendseparatedlistcontent#1% - {\appendtoks#1\to\separatedlistdata} - -\def\flushseparatedlistdata - {\the\separatedlistdata - \separatedlistdata\emptytoks} - -\def\initializeseparatedlistdata - {\separatedlistdata{\egroup}} - -\def\dontcollectseparatedlist - {\def\dodoprocessseparatedfileline - {\the\separatedlistdata - \separatedlistdata\emptytoks - \doprocessseparatedfileline}% - \def\dodoprocessseparatedline - {\the\separatedlistdata - \separatedlistdata\emptytoks - \doprocessseparatedline}% - \let\flushseparatedlistdata\egroup - \let\initializeseparatedlistdata\donothing} - -\chardef\separatedlistmode\zerocount - -\def\setcurrentlistseparator - {\edef\currentlistseparator - {\executeifdefined - {\??ls::\csname\??ls\currentseparatedlist\c!separator\endcsname}% - {\csname\??ls\currentseparatedlist\c!separator\endcsname}}% - \doifvalue{\??ls\currentseparatedlist\c!separator}{tab} - {\catcode`\^^I=12\relax}% - \ifx\currentlistseparator\empty\def\currentlistseparator{,}\fi} - -\bgroup \catcode`\^^I=12 - \setgvalue{\??ls::tab}{ } - \setgvalue{\??ls::space}{ } - \setgvalue{\??ls::comma}{,} -\egroup - -\def\doprocessseparatedfileline - {\ifeof\scratchread - \ifcase\separatedlistmode\appendseparatedlistparameter\c!after\fi - \immediate\closein\scratchread - \expandafter\flushseparatedlistdata - \else\ifx\line\empty - % skip, can be comment - \read\scratchread to\line - \@EA\dodoprocessseparatedfileline - \else - \appendseparatedlistparameter{\ifcase\separatedlistmode\c!first\else\c!command\fi}% - \ifx\currentlistquotechar\empty% - \expandafter\doprocessseplist\line\relax - \else - \expanded{\processquotedlist{}{\noexpand\end}% - {\currentlistseparator}{\currentlistquotechar}% - \noexpand\doprocessseparatedquoteditem \line\currentlistseparator\noexpand\end}% - \fi - \ifcase\separatedlistmode\appendseparatedlistparameter\c!last\fi - \read\scratchread to\line - \@EAEAEA\dodoprocessseparatedfileline - \fi\fi} - -\def\dodoprocessseparatedfileline - {\doprocessseparatedfileline} - -\def\doprocessseparatedfile[#1][#2]% - {\bgroup - \edef\currentseparatedlist{#1}% - \doifdefined{\??ls\currentseparatedlist\c!command}{\chardef\separatedlistmode\plusone}% - \setcurrentlistseparator - \edef\currentlistquotechar{\csname\??ls\currentseparatedlist\c!quotechar\endcsname}% - \expandafter\dodefineprocessseplist\expandafter{\currentlistseparator}\doprocessseparateditem - \initializeseparatedlistdata - \directsetup{\currentseparatedlist:\executeifdefined{\??ls\currentseparatedlist\c!setups}\s!default}% - \ifcase\separatedlistmode\appendseparatedlistparameter\c!before\fi - \endlinechar\minusone - \ignorelines - \catcode`\#\@@comment - \immediate\openin\scratchread=#2\relax % todo: \doopenin - \read\scratchread to\line - \doprocessseparatedfileline} - -\def\dostartseparatedlist#1[#2]% - {\bgroup - \edef\currentseparatedlist{#2}% - \doifdefined{\??ls\currentseparatedlist\c!command}{\chardef\separatedlistmode\plusone}% - \obeylines - \let#1\relax - \def\separateslistend{#1}% - \setcurrentlistseparator - \edef\currentlistquotechar{\csname\??ls\currentseparatedlist\c!quotechar\endcsname}% - \expandafter\dodefineprocessseplist\expandafter{\currentlistseparator}\doprocessseparateditem - \directsetup{\currentseparatedlist:\executeifdefined{\??ls\currentseparatedlist\c!setups}\s!default}% - \initializeseparatedlistdata - \ifcase\separatedlistmode\appendseparatedlistparameter\c!before\fi - \dodostartseparatedlist} - -\def\redoprocessseparatedline#1% - {\def\!!stringa{#1}% - \ifx\!!stringa\separateslistend - \ifcase\separatedlistmode\appendseparatedlistparameter\c!after\fi - \expandafter\flushseparatedlistdata - \else% - \appendseparatedlistparameter{\ifcase\separatedlistmode\c!first\else\c!command\fi}% - \ifx\currentlistquotechar\empty% - \doprocessseplist#1\relax - \else% - \defconvertedargument\csvdata{#1}% - \expanded{\processquotedlist{}{\noexpand\end}% - {\currentlistseparator}{\currentlistquotechar}% - \noexpand\doprocessseparatedquoteditem \csvdata\currentlistseparator\noexpand\end}% - \fi - \ifcase\separatedlistmode\appendseparatedlistparameter\c!last\fi - \expandafter\dodoprocessseparatedline - \fi} - -\def\doprocessseparatedline - {\doifnextbgroupelse\xdoprocessseparatedline\ydoprocessseparatedline} - -\def\dodoprocessseparatedline - {\doprocessseparatedline} - -\def\doprocessseparateditem#1% - {\ifcase\separatedlistmode - \appendseparatedlistparameter\c!left - \appendseparatedlistcontent{#1}% - \appendseparatedlistparameter\c!right - \else - \appendseparatedlistcontent{{#1}}% - \fi} - - -\bgroup \obeylines - - \gdef\dodostartseparatedlist#1 - {\doprocessseparatedline} - - \gdef\xdoprocessseparatedline#1#2 - {\redoprocessseparatedline{{{#1}}#2}} - - \gdef\ydoprocessseparatedline#1 - {\redoprocessseparatedline{#1}} - -\egroup - -\startsetups CSV:unix - \catcode`\#=\@@comment -\stopsetups - -\def\defineseparatedlist - {\dodoubleempty\dodefineseparatedlist} - -\def\dodefineseparatedlist[#1][#2]% - {\setvalue{\e!start#1}{\expandafter\dostartseparatedlist\csname\e!stop#1\endcsname[#1]}% - \getparameters - [\??ls#1] - [\c!separator=, - \c!quotechar=, - \c!first=, - \c!left=, - \c!before=, - \c!right=, - \c!last=, - \c!after=, -% \c!command=, - #2]} - -\def\setupseparatedlist - {\dodoubleempty\dosetupseparatedlist} - -\def\dosetupseparatedlist[#1]% [#2] - {\getparameter[\??ls#1]} % [#2] - -\def\startseparatedlist[#1]% - {\dostartseparatedlist\stopseparatedlist[#1]} - -\def\processseparatedfile - {\dodoubleargument\doprocessseparatedfile} - -\protect \doifnotmode{demo}{\endinput} - -\defineseparatedlist - [CSV] - [separator={,}, - first=\bTR,last=\eTR, - left=\bTD,right=\eTD, - before=\bTABLE,after=\eTABLE] - -\startseparatedlist[CSV] -a,b,c -d,e,f -\stopseparatedlist - -\startCSV -a,b,c -d,e,f -\stopCSV - -\defineseparatedlist - [CSV] - [separator={,}, - quotechar={"}, - first=\NC,last=\NR, - left=,right=\NC, - before={\starttabulate[|l|l|l|]},after=\stoptabulate] - -\startCSV -a,b,"c,d" -d,"""",f -\stopCSV - -\defineseparatedlist - [CSV] - [separator={ }, - first=\NC,last=\NR, - left=,right=\NC, - before={\starttabulate[|l|l|l|]},after=\stoptabulate] - -\startCSV -a b c -d e f -\stopCSV - -\defineseparatedlist - [CSV] - [setups=unix, - first=\NC,last=\NR, - left=,right=\NC, - before={\starttabulate[|l|l|l|]},after=\stoptabulate] - -% \startsetups CSV:unix -% \catcode`\#=\@@comment -% \stopsetups - -% %1,2,3 -% 1,2,3 -% # 4,5,6 -% 4,5,6 - -\processseparatedfile[CSV][test.dat] - -\defineseparatedlist - [CSVX] - [command=\Whatever, - separator={,}, - first=\bTR,last=\eTR, - left=\bTD,right=\eTD, - before=\bTABLE,after=\eTABLE] - -\def\Whatever#1#2#3{[#1][#2][#3]\endgraf} - -\startseparatedlist[CSVX] -a,b,c -d,e,f -\stopseparatedlist - -\defineseparatedlist[CSV] - [separator=comma, - before=\bTABLE, after=\eTABLE, - first=\bTR, last=\eTR, - left=\bTD, right=\eTD] - -\startCSV -a,b,c,č -d,e,f,š -\stopCSV - -\enableregime[utf] - -\defineseparatedlist[X][separator=X,left=(,right=),first=\endgraf,last=\endgraf] -\defineseparatedlist[Y][separator=Y,left=(,right=),first=\endgraf,last=\endgraf] - -\startX -aXb -Xc -čXš -\stopX - -\startY -aYb -Yc -čYš -\stopY - -\stoptext diff --git a/Master/texmf-dist/tex/context/base/m-directives.mkiv b/Master/texmf-dist/tex/context/base/m-directives.mkiv new file mode 100644 index 00000000000..8b551b27abd --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-directives.mkiv @@ -0,0 +1,3 @@ +\starttext + \showdirectives +\stoptext diff --git a/Master/texmf-dist/tex/context/base/m-directives.tex b/Master/texmf-dist/tex/context/base/m-directives.tex deleted file mode 100644 index c958f6cad51..00000000000 --- a/Master/texmf-dist/tex/context/base/m-directives.tex +++ /dev/null @@ -1,5 +0,0 @@ -\doifnotmode{mkiv} {\endinput} - -\starttext - \showdirectives -\stoptext diff --git a/Master/texmf-dist/tex/context/base/m-dratex.mkii b/Master/texmf-dist/tex/context/base/m-dratex.mkii new file mode 100644 index 00000000000..6c088daf98a --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-dratex.mkii @@ -0,0 +1,21 @@ +%D \module +%D [ file=m-dratex, +%D version=2005.11.25, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=\DRATEX\ Loading Macros, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details + +\readfile{DraTex.sty}{}{\readfile{dratex.sty}{}{\endinput}} + +\letvalue{:NewCount}\newcount +\letvalue{:NewDimen}\newdimen + +\readfile{AlDraTex.sty}{}{\readfile{aldratex.sty}{}{\endinput}} + +\endinput diff --git a/Master/texmf-dist/tex/context/base/m-dratex.tex b/Master/texmf-dist/tex/context/base/m-dratex.tex deleted file mode 100644 index 6c088daf98a..00000000000 --- a/Master/texmf-dist/tex/context/base/m-dratex.tex +++ /dev/null @@ -1,21 +0,0 @@ -%D \module -%D [ file=m-dratex, -%D version=2005.11.25, -%D title=\CONTEXT\ Extra Modules, -%D subtitle=\DRATEX\ Loading Macros, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright=PRAGMA-ADE] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details - -\readfile{DraTex.sty}{}{\readfile{dratex.sty}{}{\endinput}} - -\letvalue{:NewCount}\newcount -\letvalue{:NewDimen}\newdimen - -\readfile{AlDraTex.sty}{}{\readfile{aldratex.sty}{}{\endinput}} - -\endinput diff --git a/Master/texmf-dist/tex/context/base/m-edtsnc.mkii b/Master/texmf-dist/tex/context/base/m-edtsnc.mkii new file mode 100644 index 00000000000..0926f44886a --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-edtsnc.mkii @@ -0,0 +1,207 @@ +%D \module +%D [ file=m-editsnc, +%D version=2003.12.23, +%D title=\CONTEXT\ Modules, +%D subtitle=Editor Synchronization, +%D author={Hans Hagen \& Ton Otten}, +%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.edit for +%C details. + +% \enablemode[demo] + +% This file is a variation of the file m-pdfsync. This time we do it +% in a more abstract way and prepare ourselves for support in dvi +% output. + +% \enableeditsync +% \disableeditsync +% \editsync +% \editsynctext {string} +% \editsyncnode {char} +% \editsynctracemode [chardef: 0-4] + +\writestatus{editsync}{loading and enabling editor synchronization support} + +\unprotect % not really needed + +\ifx\pdfoutput\undefined + \donefalse +\else\ifcase\pdfoutput + \donefalse +\else\ifx\pdfsavepos\undefined + \donefalse +\else + \donetrue +\fi\fi\fi + +\chardef \editsyncstate \zerocount +\chardef \editsynctracemode \zerocount +\newcount \editsynccounter +\newwrite \editsyncwrite + +\def\enableeditsync {\chardef\editsyncstate\plusone} +\def\disableeditsync{\chardef\editsyncstate\zerocount} + +% The following definitions can go into the special drivers, but +% for the moment we do it this way. + +\ifdone + + \def\dostarteditsync + {\immediate\openout\editsyncwrite\jobname.pdfsync + \immediate\write\editsyncwrite{\jobname}% + \immediate\write\editsyncwrite{version 0}} + + \def\dostopeditsync + {\closeout\editsyncwrite} + + \def\doeditsyncregisterpage#1{\immediate\write\editsyncwrite{s\space\number#1}} + \def\doeditsyncopenfile #1{\immediate\write\editsyncwrite{(\space#1}} + \def\doeditsyncclosefile #1{\immediate\write\editsyncwrite{)}} + + \def\doregistereditsyncnode#1#2#3% tag counter linenumber + {\pdfsavepos + \immediate\write\editsyncwrite{l\space\number#2\space\number#3}% + \expanded{\write\editsyncwrite{p\ifnum#1=\plusone*\fi\space\number#2\space\noexpand\the\pdflastxpos\space\noexpand\the\pdflastypos}}} + +\else + + \let\dostarteditsync \relax + \let\dostopeditsync \relax + + \let\doeditsyncregisterpage\gobbleoneargument + \let\doeditsyncopenfile \gobbleoneargument + \let\doeditsyncclosefile \gobbleoneargument + \let\doregistereditsyncnode\gobblethreearguments + + % These specials could be filtered by a dvitopdf backend and + % written to a jobname.pdfsync file. In that case, the x and + % y coordinates have to be to be resolved by driver. + + % \def\doeditsyncregisterpage#1{\special{pdfsync: s\space\number#1}} + % \def\doeditsyncopenfile #1{\special{pdfsync: ( #1}} + % \def\doeditsyncclosefile #1{\special{pdfsync: )}} + + % \def\doregistereditsyncnode#1#2#3% + % {\special{pdfsync: l the\editsynccounter\space\number#3}% + % \special{pdfsync: p\ifnum#1=\plusone*\fi\space\number#2}} + +\fi + +\let\editsynctracer\gobbleoneargument + +\editsynccounter\minusone % counting starts at zero and we increment beforehand + +\def\registereditsyncnode#1% we assume #1 is one token + {\ifcase\editsyncstate + \expandafter\gobbleoneargument + \else + \global\advance\editsynccounter\plusone + \doregistereditsyncnode#1\editsynccounter\inputlineno + \expandafter\editsynctracer + \fi} + +\def\editsync {\registereditsyncnode\plusone *} +\def\editsyncnode{\registereditsyncnode\zerocount} +\def\editsynctext{\registereditsyncnode\plusone } + +\appendtoks \dostarteditsync \to \everystarttext +%appendtoks \dostopeditsync \to \everystoptext +\appendtoks \doeditsyncregisterpage\realfolio \to \everyshipout +\appendtoks \doeditsyncopenfile\readfilename \to \everybeforereadfile +\appendtoks \doeditsyncclosefile\readfilename \to \everyafterreadfile + +\appendtoks \enableeditsync \to \everystarttext +\appendtoks \disableeditsync \to \everypagebody + +\def\editsynctracer#1% + {\ifcase\editsynctracemode\else + \begingroup + \forgetall + \disableeditsync + \ifcase\editsynctracemode\or % could be done more efficient, box around ifcase + \setbox\scratchbox\hbox to \zeropoint{\hss\infofont#1\hss}% 1 + \else + \setbox\scratchbox\hbox to \zeropoint{\hss\traceboxplacementtrue\boxcursor\hss}% 2/3/4 + \fi + \smashbox\scratchbox\box\scratchbox + \ifcase\editsynctracemode\or\or\or + \setbox\scratchbox\hbox to \zeropoint{\hss\raise1.25ex\hbox{\infofont#1}\hss}% 3 + \smashbox\scratchbox\box\scratchbox + \or + \setbox\scratchbox\hbox to \zeropoint{\hss\lower1.25ex\hbox{\infofont#1}\hss}% 4 + \smashbox\scratchbox\box\scratchbox + \fi + \endgroup + \fi} + +% \def\editsynctracer#1% more efficient but unreadable +% {\ifcase\editsynctracemode\else +% \ifcase\editsyncstate\else +% \begingroup +% \forgetall +% \disableeditsync +% \setbox\scratchbox\hbox to \zeropoint +% {\hss +% \ifcase\editsynctracemode\or +% \infofont#1% 1 +% \else +% \traceboxplacementtrue\boxcursor% 2/3/4 +% \fi +% \hss}% +% \smashbox\scratchbox\box\scratchbox +% \setbox\scratchbox\hbox to \zeropoint +% {\hss +% \ifcase\editsynctracemode\or\or\or +% \raise1.25ex\hbox{\infofont#1}% 3 +% \or +% \lower1.25ex\hbox{\infofont#1}% 4 +% \fi +% \hss}% +% \smashbox\scratchbox\box\scratchbox +% \endgroup +% \fi +% \fi} + +% beware, adding nodes this way will interfere with the typesetting + +\appendtoks \editsyncnode p\to \everypar +\appendtoks \editsyncnode m\to \everymath +\appendtoks \editsyncnode d\to \everydisplay +\appendtoks \editsyncnode h\to \everyhbox + +% For compatibility with 'pdfsync4context' we provide: + +\let\pdfsyncstart\enableeditsync +\let\pdfsyncstop \disablepdfsync +\let\pdfsync \editsync + +\protect + +\doifnotmode{demo}{\endinput} + +\chardef\editsynctracemode=3 + +\starttext + +\chapter{Test} + +\processfile{tufte} + +\startitemize +\item first +\item second +\stopitemize + +\processfile{tufte} + +\startlines +some local \editsync sync and \editsynctext{here}a marked point +some local \editsync sync and \editsyncnode{here}a marked point +\stoplines + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/m-edtsnc.tex b/Master/texmf-dist/tex/context/base/m-edtsnc.tex deleted file mode 100644 index 0926f44886a..00000000000 --- a/Master/texmf-dist/tex/context/base/m-edtsnc.tex +++ /dev/null @@ -1,207 +0,0 @@ -%D \module -%D [ file=m-editsnc, -%D version=2003.12.23, -%D title=\CONTEXT\ Modules, -%D subtitle=Editor Synchronization, -%D author={Hans Hagen \& Ton Otten}, -%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.edit for -%C details. - -% \enablemode[demo] - -% This file is a variation of the file m-pdfsync. This time we do it -% in a more abstract way and prepare ourselves for support in dvi -% output. - -% \enableeditsync -% \disableeditsync -% \editsync -% \editsynctext {string} -% \editsyncnode {char} -% \editsynctracemode [chardef: 0-4] - -\writestatus{editsync}{loading and enabling editor synchronization support} - -\unprotect % not really needed - -\ifx\pdfoutput\undefined - \donefalse -\else\ifcase\pdfoutput - \donefalse -\else\ifx\pdfsavepos\undefined - \donefalse -\else - \donetrue -\fi\fi\fi - -\chardef \editsyncstate \zerocount -\chardef \editsynctracemode \zerocount -\newcount \editsynccounter -\newwrite \editsyncwrite - -\def\enableeditsync {\chardef\editsyncstate\plusone} -\def\disableeditsync{\chardef\editsyncstate\zerocount} - -% The following definitions can go into the special drivers, but -% for the moment we do it this way. - -\ifdone - - \def\dostarteditsync - {\immediate\openout\editsyncwrite\jobname.pdfsync - \immediate\write\editsyncwrite{\jobname}% - \immediate\write\editsyncwrite{version 0}} - - \def\dostopeditsync - {\closeout\editsyncwrite} - - \def\doeditsyncregisterpage#1{\immediate\write\editsyncwrite{s\space\number#1}} - \def\doeditsyncopenfile #1{\immediate\write\editsyncwrite{(\space#1}} - \def\doeditsyncclosefile #1{\immediate\write\editsyncwrite{)}} - - \def\doregistereditsyncnode#1#2#3% tag counter linenumber - {\pdfsavepos - \immediate\write\editsyncwrite{l\space\number#2\space\number#3}% - \expanded{\write\editsyncwrite{p\ifnum#1=\plusone*\fi\space\number#2\space\noexpand\the\pdflastxpos\space\noexpand\the\pdflastypos}}} - -\else - - \let\dostarteditsync \relax - \let\dostopeditsync \relax - - \let\doeditsyncregisterpage\gobbleoneargument - \let\doeditsyncopenfile \gobbleoneargument - \let\doeditsyncclosefile \gobbleoneargument - \let\doregistereditsyncnode\gobblethreearguments - - % These specials could be filtered by a dvitopdf backend and - % written to a jobname.pdfsync file. In that case, the x and - % y coordinates have to be to be resolved by driver. - - % \def\doeditsyncregisterpage#1{\special{pdfsync: s\space\number#1}} - % \def\doeditsyncopenfile #1{\special{pdfsync: ( #1}} - % \def\doeditsyncclosefile #1{\special{pdfsync: )}} - - % \def\doregistereditsyncnode#1#2#3% - % {\special{pdfsync: l the\editsynccounter\space\number#3}% - % \special{pdfsync: p\ifnum#1=\plusone*\fi\space\number#2}} - -\fi - -\let\editsynctracer\gobbleoneargument - -\editsynccounter\minusone % counting starts at zero and we increment beforehand - -\def\registereditsyncnode#1% we assume #1 is one token - {\ifcase\editsyncstate - \expandafter\gobbleoneargument - \else - \global\advance\editsynccounter\plusone - \doregistereditsyncnode#1\editsynccounter\inputlineno - \expandafter\editsynctracer - \fi} - -\def\editsync {\registereditsyncnode\plusone *} -\def\editsyncnode{\registereditsyncnode\zerocount} -\def\editsynctext{\registereditsyncnode\plusone } - -\appendtoks \dostarteditsync \to \everystarttext -%appendtoks \dostopeditsync \to \everystoptext -\appendtoks \doeditsyncregisterpage\realfolio \to \everyshipout -\appendtoks \doeditsyncopenfile\readfilename \to \everybeforereadfile -\appendtoks \doeditsyncclosefile\readfilename \to \everyafterreadfile - -\appendtoks \enableeditsync \to \everystarttext -\appendtoks \disableeditsync \to \everypagebody - -\def\editsynctracer#1% - {\ifcase\editsynctracemode\else - \begingroup - \forgetall - \disableeditsync - \ifcase\editsynctracemode\or % could be done more efficient, box around ifcase - \setbox\scratchbox\hbox to \zeropoint{\hss\infofont#1\hss}% 1 - \else - \setbox\scratchbox\hbox to \zeropoint{\hss\traceboxplacementtrue\boxcursor\hss}% 2/3/4 - \fi - \smashbox\scratchbox\box\scratchbox - \ifcase\editsynctracemode\or\or\or - \setbox\scratchbox\hbox to \zeropoint{\hss\raise1.25ex\hbox{\infofont#1}\hss}% 3 - \smashbox\scratchbox\box\scratchbox - \or - \setbox\scratchbox\hbox to \zeropoint{\hss\lower1.25ex\hbox{\infofont#1}\hss}% 4 - \smashbox\scratchbox\box\scratchbox - \fi - \endgroup - \fi} - -% \def\editsynctracer#1% more efficient but unreadable -% {\ifcase\editsynctracemode\else -% \ifcase\editsyncstate\else -% \begingroup -% \forgetall -% \disableeditsync -% \setbox\scratchbox\hbox to \zeropoint -% {\hss -% \ifcase\editsynctracemode\or -% \infofont#1% 1 -% \else -% \traceboxplacementtrue\boxcursor% 2/3/4 -% \fi -% \hss}% -% \smashbox\scratchbox\box\scratchbox -% \setbox\scratchbox\hbox to \zeropoint -% {\hss -% \ifcase\editsynctracemode\or\or\or -% \raise1.25ex\hbox{\infofont#1}% 3 -% \or -% \lower1.25ex\hbox{\infofont#1}% 4 -% \fi -% \hss}% -% \smashbox\scratchbox\box\scratchbox -% \endgroup -% \fi -% \fi} - -% beware, adding nodes this way will interfere with the typesetting - -\appendtoks \editsyncnode p\to \everypar -\appendtoks \editsyncnode m\to \everymath -\appendtoks \editsyncnode d\to \everydisplay -\appendtoks \editsyncnode h\to \everyhbox - -% For compatibility with 'pdfsync4context' we provide: - -\let\pdfsyncstart\enableeditsync -\let\pdfsyncstop \disablepdfsync -\let\pdfsync \editsync - -\protect - -\doifnotmode{demo}{\endinput} - -\chardef\editsynctracemode=3 - -\starttext - -\chapter{Test} - -\processfile{tufte} - -\startitemize -\item first -\item second -\stopitemize - -\processfile{tufte} - -\startlines -some local \editsync sync and \editsynctext{here}a marked point -some local \editsync sync and \editsyncnode{here}a marked point -\stoplines - -\stoptext diff --git a/Master/texmf-dist/tex/context/base/m-fields.mkiv b/Master/texmf-dist/tex/context/base/m-fields.mkiv new file mode 100644 index 00000000000..cd840f377d4 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-fields.mkiv @@ -0,0 +1,70 @@ +%D \module +%D [ file=m-fields, +%D version=2010.03.14, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=Fields, +%D author=Hans Hagen, +%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 A rather old example of field usage is the following. It +%D makes no sense to have this in the core. +%D +%D \starttyping +%D before \fillinfield[oeps]{whatever} after +%D \stoptyping + +\startJSpreamble{FillInField} used later + function CheckFillInField(right) { + if (event.value.toLowerCase() == right.toLowerCase()) { + event.target.hidden = true ; + } + event.value = "" + } +\stopJSpreamble + +\newcount\noffillinfields + +\definefieldcategory + [fillinfield] + [\c!n=1024, + \c!height=\strutht, + \c!depth=\strutdp, + \c!align=\v!middle, + \c!color=red, + \c!fieldframecolor=blue, + \c!fieldbackgroundcolor=\s!white, + \c!validate=JS(CheckFillInField{\therightanswer})] + +\def\fillinfield + {\dosingleempty\dofillinfield} + +\def\dofillinfield[#1]#2% + {\dontleavehmode + \hbox + {\forgetall + \global\advance\noffillinfields\plusone + \edef\currentfillinfieldname{fillinfield:\number\noffillinfields}% + \useJSscripts[ans]% + \definefieldbody + [\currentfillinfieldname] + [\c!type=\v!line, + \c!category=fillinfield]% + \doifelsenothing{#1} + {\def\therightanswer{#2}} + {\def\therightanswer{#1}}% + \setbox0\hbox{\strut#2}% + \setbox2\hbox{\strut\therightanswer}% + \dimen0=\dimexpr\ifdim\wd0>\wd2 \wd0 \else \wd2 \fi + .2em\relax + \hbox to \wd0 + {\wd0\zeropoint + \box0 + \hss\fieldbody[\currentfillinfieldname][\c!width=\dimen0]\hss}}} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/m-graph.mkii b/Master/texmf-dist/tex/context/base/m-graph.mkii index db7538e9807..69d1d3d57ef 100644 --- a/Master/texmf-dist/tex/context/base/m-graph.mkii +++ b/Master/texmf-dist/tex/context/base/m-graph.mkii @@ -69,4 +69,163 @@ enddef ; \stopMPinclusions -\endinput +\doifnotmode {demo} {\endinput} + +%D You need to have the data files in your path, +%D otherwise the run is aborted. + +\doiffileelse {agepop91.d} {} {\writestatus{graph}{no data files found}\wait\end} + +%D The test: + +\starttext + +\startMPpage +draw begingraph(3in,2in); + gdraw "agepop91.d"; + endgraph; +\stopMPpage + +\startMPpage +draw begingraph(3in,2in); + gdraw "agepop91.d" plot btex$\bullet$etex; + endgraph; +\stopMPpage + +\startMPpage +draw begingraph(3in,2in); + glabel.lft(btex \vbox{\hbox{Population} \hbox{in millions}} etex, OUT); + glabel.bot(btex Age in years etex, OUT); + gdraw "agepopm.d"; + endgraph; +\stopMPpage + +\startMPpage +draw begingraph(3in,2in); + glabel.lft(btex \vbox{\hbox{Population} \hbox{in millions}} etex, OUT); + glabel.bot(btex Age in years etex, OUT); + setrange(origin, whatever,whatever); + gdraw "agepopm.d"; + endgraph; +\stopMPpage + +\startMPpage +draw begingraph(2.3in,2in); + setcoords(log,log); + glabel.lft(btex Seconds etex,OUT); + glabel.bot(btex Matrix size etex, + OUT); + gdraw "matmul.d" dashed evenly; + glabel.ulft(btex Standard etex,8); + gdraw "matmul.d"; + glabel.lrt(btex Strassen etex,7); + endgraph; +\stopMPpage + +\startMPpage +draw begingraph(6.5cm,4.5cm); + setrange(80,0, 90,whatever); + glabel.bot(btex Year etex, OUT); + glabel.lft(btex \vbox{\hbox{Emissions in} \hbox{thousands of} + \hbox{metric tons} \hbox{(heavy line)}}etex, OUT); + gdraw "lead.d" withpen pencircle scaled 1.5pt; + autogrid(,otick.lft); + setcoords(linear,linear); + setrange(80,0, 90,whatever); + glabel.rt(btex \vbox{\hbox{Micrograms} \hbox{per cubic} + \hbox{meter of air} \hbox{(thin line)}}etex, OUT); + gdraw "lead.d"; + autogrid(otick.bot,otick.rt); + endgraph; +\stopMPpage + +\stoptext + +% No longer needed, since John will fix it. +% +% %D For the moment we need the following patch. Adam T. Lindsay +% %D found out that the following code produced an error: +% %D +% %D \starttyping +% %D \startMPcode +% %D draw begingraph(130mm,35mm); +% %D setrange(0,0,10,22000); +% %D glabel.lft(btex {correct 0--22000} etex rotated 90, OUT); +% %D autogrid(itick.bot,grid.lft) withcolor .75white ; +% %D endgraph; +% %D \stopMPcode +% %D +% %D \startMPcode +% %D draw begingraph(130mm,35mm); +% %D setrange(0,50,10,22000); +% %D glabel.lft(btex {wrong 50--22000} etex rotated 90, OUT); +% %D autogrid(itick.bot,grid.lft) withcolor .75white ; +% %D endgraph; +% %D \stopMPcode +% %D +% %D \startMPcode +% %D draw begingraph(130mm,35mm); +% %D setrange(0,110,10,30000); +% %D glabel.lft(btex {failed 110--22000} etex rotated 90, OUT); +% %D autogrid(itick.bot,grid.lft) withcolor .75white ; +% %D endgraph; +% %D \stopMPcode +% %D \stoptyping +% %D +% %D The bug is a rather nasty one and needs some tweaking in +% %D the low level graph code. John Hobby suggested for the +% %D moment to initialize \type {setrange} as follows: +% %D +% %D \starttyping +% %D setrange(0,0,"22000","22000") +% %D \stoptyping +% %D +% %D Folowing this suggesion, I provide the following +% %D extension: + +% def begingraph(expr w, h) = +% begingroup +% save X_, Y_, Gfin_, Gcur_, Gcbb_, Gneedgr_, Gneedfr_, Gdidsc_; +% save Gdpic_, Gppic_, Ggl_, Garw_; +% picture Gfin_, Gcur_, Gcbb_, Gdpic_, Gppic_, Ggl_[]; +% boolean Gneedgr_, Gneedfr_, Gdidsc_; +% Gfin_ = nullpicture; +% Gcur_ = nullpicture; +% Gcbb_ = nullpicture; +% X_.ctyp = Y_.ctyp = linear; +% Z_.gdim = (w,h); +% X_.sc = Y_.sc = 0; +% Gneedgr_ = true; +% Gneedfr_ = true; +% Gdidsc_ = false; +% Gdpic_ = nullpicture; +% Garw_ = 0; +% scantokens everybegingraph ; +% enddef; +% +% boolean fixsetrange ; fixsetrange := true ; +% +% vardef dosetrange(text t) = +% interim warningcheck:=0; +% save r_; r_=0; +% string r_[]s; +% for x_= +% for p_=t: if pair p_: xpart p_, ypart fi p_, endfor: +% r_[incr r_] if string x_: s fi = x_; +% if r_>2: +% Gsetr_ if r_=3: X_(Gxcvlin_) else: Y_(Gycvlin_) fi( +% r_[r_-2] if unknown r_[r_-2]: s fi, x_); +% fi +% exitif r_=4; +% endfor +% enddef; +% +% vardef setrange(text t) = +% if fixsetrange : dosetrange(0,0,20000,20000) ; fi ; +% dosetrange(t) ; +% enddef ; +% +% if unknown everybegingraph : +% string everybegingraph ; +% % everybegingraph := "setrange(0,0,20000,20000)" ; +% fi ; diff --git a/Master/texmf-dist/tex/context/base/m-graph.mkiv b/Master/texmf-dist/tex/context/base/m-graph.mkiv index c9223488480..e8aeb237519 100644 --- a/Master/texmf-dist/tex/context/base/m-graph.mkiv +++ b/Master/texmf-dist/tex/context/base/m-graph.mkiv @@ -37,8 +37,44 @@ \unexpanded\long\def\MPgraphformat#1#2{\ctxlua{metapost.format_n("#1","#2")}} +% We could also delegate parsing using lower level plugins. + \startMPinclusions + % input string ; + % input marith ; input graph.mp ; + + vardef roundd(expr x, d) = + if abs d > 4 : + if d > 0 : + x + else : + 0 + fi + elseif d > 0 : + save i ; i = floor x ; + i + round(Ten_to[d]*(x-i))/Ten_to[d] + else : + round(x/Ten_to[-d])*Ten_to[-d] + fi + enddef ; + + Ten_to0 = 1 ; + Ten_to1 = 10 ; + Ten_to2 = 100 ; + Ten_to3 = 1000 ; + Ten_to4 = 10000 ; + + def sFe_base = + enddef ; + + picture Fe_plus ; Fe_plus := btex + etex ; + + vardef format (expr f,x) = dofmt_.Feform_(f,x) enddef ; + vardef Mformat (expr f,x) = dofmt_.Meform (f,x) enddef ; + vardef formatstr (expr f,x) = dofmt_.Feform_(f,x) enddef ; + vardef Mformatstr(expr f,x) = dofmt_.Meform(f,x) enddef ; + vardef escaped_format(expr s) = "" for n=1 upto length(s) : & if ASCII substring (n,n+1) of s = 37 : @@ -48,8 +84,9 @@ fi endfor enddef ; + vardef dofmt_@\#(expr f, x) = - textext("\MPgraphformat{"&escaped_format(f)&"}{"&(if string x : x else: decimal x fi)&"}") + textext("\MPgraphformat{" & escaped_format(f) & "}{" & (if string x : x else: decimal x fi) & "}") enddef ; % vardef format(expr f, x) = @@ -58,6 +95,74 @@ % vardef Mformat(expr f, x) = % format(f,x) % enddef; + \stopMPinclusions -\endinput +\doifnotmode {demo} {\endinput} + +\doiffileelse {agepop91.d} {} {\writestatus{graph}{no data files found}\wait\end} + +%D The test: + +\starttext + +% \startMPpage +% draw begingraph(3in,2in); +% gdraw "t:/metapost/grphdata/agepop91.d"; +% endgraph; +% \stopMPpage + +% \startMPpage +% draw begingraph(3in,2in); +% gdraw "agepop91.d" plot btex $\bullet$ etex; +% endgraph; +% \stopMPpage + +% \startMPpage +% draw begingraph(3in,2in); +% glabel.lft(btex \vbox{\hbox{Population} \hbox{in millions}} etex, OUT); +% glabel.bot(btex Age in years etex, OUT); +% gdraw "agepopm.d"; +% endgraph; +% \stopMPpage + +% \startMPpage +% draw begingraph(3in,2in); +% glabel.lft(btex \vbox{\hbox{Population} \hbox{in millions}} etex, OUT); +% glabel.bot(btex Age in years etex, OUT); +% setrange(origin, whatever,whatever); +% gdraw "agepopm.d"; +% endgraph; +% \stopMPpage + +% \startMPpage +% draw begingraph(2.3in,2in); +% setcoords(log,log); +% glabel.lft(btex Seconds etex,OUT); +% glabel.bot(btex Matrix size etex, +% OUT); +% gdraw "matmul.d" dashed evenly; +% glabel.ulft(btex Standard etex,8); +% gdraw "matmul.d"; +% glabel.lrt(btex Strassen etex,7); +% endgraph; +% \stopMPpage + +% \startMPpage +% draw begingraph(6.5cm,4.5cm); +% setrange(80,0, 90,whatever); +% glabel.bot(btex Year etex, OUT); +% glabel.lft(btex \vbox{\hbox{Emissions in} \hbox{thousands of} +% \hbox{metric tons} \hbox{(heavy line)}}etex, OUT); +% gdraw "lead.d" withpen pencircle scaled 1.5pt; +% autogrid(,otick.lft); +% setcoords(linear,linear); +% setrange(80,0, 90,whatever); +% glabel.rt(btex \vbox{\hbox{Micrograms} \hbox{per cubic} +% \hbox{meter of air} \hbox{(thin line)}}etex, OUT); +% gdraw "lead.d"; +% autogrid(otick.bot,otick.rt); +% endgraph; +% \stopMPpage + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/m-graph.tex b/Master/texmf-dist/tex/context/base/m-graph.tex deleted file mode 100644 index 6f71cca3c57..00000000000 --- a/Master/texmf-dist/tex/context/base/m-graph.tex +++ /dev/null @@ -1,175 +0,0 @@ -%D \module -%D [ file=m-graph, -%D version=2000.08.06, -%D title=\CONTEXT\ Extra Modules, -%D subtitle=\METAPOST\ graph module 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. - -\loadmarkfile{m-graph} - -\doifnotmode {demo} {\endinput} - -%D You need to have the data files in your path, -%D otherwise the run is aborted. - -\doiffileelse {agepop91.d} {} {\writestatus{graph}{no data files found}\wait\end} - -%D The test: - -\starttext - -\startMPpage -draw begingraph(3in,2in); - gdraw "agepop91.d"; - endgraph; -\stopMPpage - -\startMPpage -draw begingraph(3in,2in); - gdraw "agepop91.d" plot btex$\bullet$etex; - endgraph; -\stopMPpage - -\startMPpage -draw begingraph(3in,2in); - glabel.lft(btex \vbox{\hbox{Population} \hbox{in millions}} etex, OUT); - glabel.bot(btex Age in years etex, OUT); - gdraw "agepopm.d"; - endgraph; -\stopMPpage - -\startMPpage -draw begingraph(3in,2in); - glabel.lft(btex \vbox{\hbox{Population} \hbox{in millions}} etex, OUT); - glabel.bot(btex Age in years etex, OUT); - setrange(origin, whatever,whatever); - gdraw "agepopm.d"; - endgraph; -\stopMPpage - -\startMPpage -draw begingraph(2.3in,2in); - setcoords(log,log); - glabel.lft(btex Seconds etex,OUT); - glabel.bot(btex Matrix size etex, - OUT); - gdraw "matmul.d" dashed evenly; - glabel.ulft(btex Standard etex,8); - gdraw "matmul.d"; - glabel.lrt(btex Strassen etex,7); - endgraph; -\stopMPpage - -\startMPpage -draw begingraph(6.5cm,4.5cm); - setrange(80,0, 90,whatever); - glabel.bot(btex Year etex, OUT); - glabel.lft(btex \vbox{\hbox{Emissions in} \hbox{thousands of} - \hbox{metric tons} \hbox{(heavy line)}}etex, OUT); - gdraw "lead.d" withpen pencircle scaled 1.5pt; - autogrid(,otick.lft); - setcoords(linear,linear); - setrange(80,0, 90,whatever); - glabel.rt(btex \vbox{\hbox{Micrograms} \hbox{per cubic} - \hbox{meter of air} \hbox{(thin line)}}etex, OUT); - gdraw "lead.d"; - autogrid(otick.bot,otick.rt); - endgraph; -\stopMPpage - -\stoptext - -% No longer needed, since John will fix it. -% -% %D For the moment we need the following patch. Adam T. Lindsay -% %D found out that the following code produced an error: -% %D -% %D \starttyping -% %D \startMPcode -% %D draw begingraph(130mm,35mm); -% %D setrange(0,0,10,22000); -% %D glabel.lft(btex {correct 0--22000} etex rotated 90, OUT); -% %D autogrid(itick.bot,grid.lft) withcolor .75white ; -% %D endgraph; -% %D \stopMPcode -% %D -% %D \startMPcode -% %D draw begingraph(130mm,35mm); -% %D setrange(0,50,10,22000); -% %D glabel.lft(btex {wrong 50--22000} etex rotated 90, OUT); -% %D autogrid(itick.bot,grid.lft) withcolor .75white ; -% %D endgraph; -% %D \stopMPcode -% %D -% %D \startMPcode -% %D draw begingraph(130mm,35mm); -% %D setrange(0,110,10,30000); -% %D glabel.lft(btex {failed 110--22000} etex rotated 90, OUT); -% %D autogrid(itick.bot,grid.lft) withcolor .75white ; -% %D endgraph; -% %D \stopMPcode -% %D \stoptyping -% %D -% %D The bug is a rather nasty one and needs some tweaking in -% %D the low level graph code. John Hobby suggested for the -% %D moment to initialize \type {setrange} as follows: -% %D -% %D \starttyping -% %D setrange(0,0,"22000","22000") -% %D \stoptyping -% %D -% %D Folowing this suggesion, I provide the following -% %D extension: - -% def begingraph(expr w, h) = -% begingroup -% save X_, Y_, Gfin_, Gcur_, Gcbb_, Gneedgr_, Gneedfr_, Gdidsc_; -% save Gdpic_, Gppic_, Ggl_, Garw_; -% picture Gfin_, Gcur_, Gcbb_, Gdpic_, Gppic_, Ggl_[]; -% boolean Gneedgr_, Gneedfr_, Gdidsc_; -% Gfin_ = nullpicture; -% Gcur_ = nullpicture; -% Gcbb_ = nullpicture; -% X_.ctyp = Y_.ctyp = linear; -% Z_.gdim = (w,h); -% X_.sc = Y_.sc = 0; -% Gneedgr_ = true; -% Gneedfr_ = true; -% Gdidsc_ = false; -% Gdpic_ = nullpicture; -% Garw_ = 0; -% scantokens everybegingraph ; -% enddef; -% -% boolean fixsetrange ; fixsetrange := true ; -% -% vardef dosetrange(text t) = -% interim warningcheck:=0; -% save r_; r_=0; -% string r_[]s; -% for x_= -% for p_=t: if pair p_: xpart p_, ypart fi p_, endfor: -% r_[incr r_] if string x_: s fi = x_; -% if r_>2: -% Gsetr_ if r_=3: X_(Gxcvlin_) else: Y_(Gycvlin_) fi( -% r_[r_-2] if unknown r_[r_-2]: s fi, x_); -% fi -% exitif r_=4; -% endfor -% enddef; -% -% vardef setrange(text t) = -% if fixsetrange : dosetrange(0,0,20000,20000) ; fi ; -% dosetrange(t) ; -% enddef ; -% -% if unknown everybegingraph : -% string everybegingraph ; -% % everybegingraph := "setrange(0,0,20000,20000)" ; -% fi ; diff --git a/Master/texmf-dist/tex/context/base/m-level.mkii b/Master/texmf-dist/tex/context/base/m-level.mkii new file mode 100644 index 00000000000..67d5987332d --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-level.mkii @@ -0,0 +1,94 @@ +%D \module +%D [ file=level, +%D version=2002.10.20, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=Catching Nesting Errors, +%D author=Hans Hagen, +%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 + +\newcount\currentnesting + +\def\startnesting#1% + {\global\advance\currentnesting\plusone + \setxvalue{level::\number\currentnesting}{#1}} + +\def\stopnesting#1% + {\edef\nestingstring{#1}% + \relax\ifnum\currentnesting>\zerocount + \doifelsevalue{level::\number\currentnesting}\nestingstring + {\global\advance\currentnesting\minusone} + {\@EA\reportnestingerror\@EA\stoptext} + \else + \@EA\reportnestingerror\@EA\stoptext + \fi} + +\def\checknesting + {\relax\ifnum\currentnesting>\zerocount + \def\nestingstring{end of document}% + \@EA\reportnestingerror + \fi} + +\def\reportnestingerror + {\endgraf + \global\let\checknesting\relax + \bgroup \definedfont[Mono at 18pt]\incolortrue + \setupinterlinespace + \raggedright + \bgroup \red + \ifnum\currentnesting>\plusone + wrong end level + \else + too many end levels + \fi + at \nestingstring\space in line \number\inputlineno + \ifnum\currentnesting>\zerocount, stack:\fi\endgraf + \egroup + \dostepwiserecurse\currentnesting\plusone\minusone + {\space\getvalue{level::\recurselevel}} + \endgraf + \egroup + \writestatus\m!systems{quitting due to level error}\wait + \batchmode} + +\prependtoks + \checknesting +\to \everystoptext + +\protect \doifnotmode{demo}{\endinput} + +\starttext + +% \startnesting{eerste} +% \startnesting{tweede} +% \startnesting{derde} +% \startnesting{vierde} +% test +% \stopnesting{vierde} +% \stopnesting{eerste} + +% \startnesting{eerste} +% \startnesting{tweede} +% test +% \stopnesting{vierde} +% \stopnesting{derde} +% \stopnesting{tweede} +% \stopnesting{eerste} + +\startnesting{eerste} + \startnesting{tweede} + \startnesting{derde} + \startnesting{vierde} + test + \stopnesting{vierde} + \stopnesting{derde} + \stopnesting{tweede} +\stopnesting{eerste} + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/m-level.tex b/Master/texmf-dist/tex/context/base/m-level.tex deleted file mode 100644 index 67d5987332d..00000000000 --- a/Master/texmf-dist/tex/context/base/m-level.tex +++ /dev/null @@ -1,94 +0,0 @@ -%D \module -%D [ file=level, -%D version=2002.10.20, -%D title=\CONTEXT\ Extra Modules, -%D subtitle=Catching Nesting Errors, -%D author=Hans Hagen, -%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 - -\newcount\currentnesting - -\def\startnesting#1% - {\global\advance\currentnesting\plusone - \setxvalue{level::\number\currentnesting}{#1}} - -\def\stopnesting#1% - {\edef\nestingstring{#1}% - \relax\ifnum\currentnesting>\zerocount - \doifelsevalue{level::\number\currentnesting}\nestingstring - {\global\advance\currentnesting\minusone} - {\@EA\reportnestingerror\@EA\stoptext} - \else - \@EA\reportnestingerror\@EA\stoptext - \fi} - -\def\checknesting - {\relax\ifnum\currentnesting>\zerocount - \def\nestingstring{end of document}% - \@EA\reportnestingerror - \fi} - -\def\reportnestingerror - {\endgraf - \global\let\checknesting\relax - \bgroup \definedfont[Mono at 18pt]\incolortrue - \setupinterlinespace - \raggedright - \bgroup \red - \ifnum\currentnesting>\plusone - wrong end level - \else - too many end levels - \fi - at \nestingstring\space in line \number\inputlineno - \ifnum\currentnesting>\zerocount, stack:\fi\endgraf - \egroup - \dostepwiserecurse\currentnesting\plusone\minusone - {\space\getvalue{level::\recurselevel}} - \endgraf - \egroup - \writestatus\m!systems{quitting due to level error}\wait - \batchmode} - -\prependtoks - \checknesting -\to \everystoptext - -\protect \doifnotmode{demo}{\endinput} - -\starttext - -% \startnesting{eerste} -% \startnesting{tweede} -% \startnesting{derde} -% \startnesting{vierde} -% test -% \stopnesting{vierde} -% \stopnesting{eerste} - -% \startnesting{eerste} -% \startnesting{tweede} -% test -% \stopnesting{vierde} -% \stopnesting{derde} -% \stopnesting{tweede} -% \stopnesting{eerste} - -\startnesting{eerste} - \startnesting{tweede} - \startnesting{derde} - \startnesting{vierde} - test - \stopnesting{vierde} - \stopnesting{derde} - \stopnesting{tweede} -\stopnesting{eerste} - -\stoptext diff --git a/Master/texmf-dist/tex/context/base/m-logcategories.mkiv b/Master/texmf-dist/tex/context/base/m-logcategories.mkiv new file mode 100644 index 00000000000..954cd58c483 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-logcategories.mkiv @@ -0,0 +1,3 @@ +\starttext + \showlogcategories +\stoptext diff --git a/Master/texmf-dist/tex/context/base/m-mathcrap.mkiv b/Master/texmf-dist/tex/context/base/m-mathcrap.mkiv new file mode 100644 index 00000000000..0c187155b79 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-mathcrap.mkiv @@ -0,0 +1,76 @@ +%D \module +%D [ file=m-mathcrap, +%D version=2010.05.30, +%D title=\CONTEXT\ Modules, +%D subtitle=Math Crap, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This is meant for those who want to use the (incomplete and sort of useless) +%D unicode superscripts and subscripts. We should look ahead and collapse them +%D but I will only implement that in calcmath when the need is there. Now the +%D spacing can be somewhat non optimal but probably that does not matter here. +%D +%D \startbuffer +%D $a₀₁₂₃₄₅₆₇₈₉₋₌₊$ +%D \stopbuffer +%D +%D \typebuffer \blank \getbuffer \blank + +\unprotect + +\unexpanded\def\mathunicodesupercrap#1{\mathortext{{\normalsuperscript{#1}}}{\high{#1}}} +\unexpanded\def\mathunicodesubcrap #1{\mathortext{{\normalsubscript {#1}}}{\low {#1}}} + +\ifdefined\installanddefineactivecharacter\else + + \def\installanddefineactivecharacter #1 #2% we need this as command + {\normalexpanded{\noexpand\installactivecharacter \utfchar{#1} }% + \defineactivecharacter #1 {#2}} + +\fi + +\installanddefineactivecharacter "2070 {\mathunicodesupercrap 0} +\installanddefineactivecharacter "00B9 {\mathunicodesupercrap 1}₀ +\installanddefineactivecharacter "00B2 {\mathunicodesupercrap 2}₀ +\installanddefineactivecharacter "00B3 {\mathunicodesupercrap 3}₀ +\installanddefineactivecharacter "2074 {\mathunicodesupercrap 4} +\installanddefineactivecharacter "2075 {\mathunicodesupercrap 5} +\installanddefineactivecharacter "2076 {\mathunicodesupercrap 6} +\installanddefineactivecharacter "2077 {\mathunicodesupercrap 7} +\installanddefineactivecharacter "2078 {\mathunicodesupercrap 8} +\installanddefineactivecharacter "2079 {\mathunicodesupercrap 9} +\installanddefineactivecharacter "207A {\mathunicodesupercrap +} +\installanddefineactivecharacter "207B {\mathunicodesupercrap -} +\installanddefineactivecharacter "207C {\mathunicodesupercrap =} +\installanddefineactivecharacter "207D {\mathunicodesupercrap (} +\installanddefineactivecharacter "207E {\mathunicodesupercrap )} +\installanddefineactivecharacter "207F {\mathunicodesupercrap n} + +\installanddefineactivecharacter "2080 {\mathunicodesubcrap 0} +\installanddefineactivecharacter "2081 {\mathunicodesubcrap 1} +\installanddefineactivecharacter "2082 {\mathunicodesubcrap 2} +\installanddefineactivecharacter "2083 {\mathunicodesubcrap 3} +\installanddefineactivecharacter "2084 {\mathunicodesubcrap 4} +\installanddefineactivecharacter "2085 {\mathunicodesubcrap 5} +\installanddefineactivecharacter "2086 {\mathunicodesubcrap 6} +\installanddefineactivecharacter "2087 {\mathunicodesubcrap 7} +\installanddefineactivecharacter "2088 {\mathunicodesubcrap 8} +\installanddefineactivecharacter "2089 {\mathunicodesubcrap 9} +\installanddefineactivecharacter "208A {\mathunicodesubcrap +} +\installanddefineactivecharacter "208B {\mathunicodesubcrap -} +\installanddefineactivecharacter "208C {\mathunicodesubcrap =} +\installanddefineactivecharacter "208D {\mathunicodesubcrap (} +\installanddefineactivecharacter "208E {\mathunicodesubcrap )} +\installanddefineactivecharacter "2090 {\mathunicodesubcrap A} +\installanddefineactivecharacter "2091 {\mathunicodesubcrap E} +\installanddefineactivecharacter "2092 {\mathunicodesubcrap O} +\installanddefineactivecharacter "2093 {\mathunicodesubcrap X} +%installanddefineactivecharacter "2094 {\mathunicodesubcrap ?} % SCHWAA + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/m-mkii.mkiv b/Master/texmf-dist/tex/context/base/m-mkii.mkiv index cb0da6fcb9e..dcfd29d2092 100644 --- a/Master/texmf-dist/tex/context/base/m-mkii.mkiv +++ b/Master/texmf-dist/tex/context/base/m-mkii.mkiv @@ -2,7 +2,7 @@ \unprotect -\writestatus\m!systems{loading some mkii compatibility hacks} +\writestatus\m!system{loading some mkii compatibility hacks} % Compatibility for font-ini diff --git a/Master/texmf-dist/tex/context/base/m-mkivhacks.mkiv b/Master/texmf-dist/tex/context/base/m-mkivhacks.mkiv new file mode 100644 index 00000000000..0e959110e0d --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-mkivhacks.mkiv @@ -0,0 +1,50 @@ +%D \module +%D [ file=m-mkivhacks, +%D version=2008.10.20, +%D title=\CONTEXT\ Modules, +%D subtitle=Temporary Compatilibility Hacks, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D For Aditya, who needed it for his thesis. + +\startluacode + -- -- a lot or work + -- + -- mathematics.slots.euler = { + -- [0x03B1] = { "mr", 0x0B }, -- alpha + -- } + -- + -- mathematics.slots.euler = table.merge(mathematics.slots.traditional,mathematics.slots.euler) + -- + -- versus a quick hack + + document.hacks = document.hacks or { } + + function document.hacks() + mathematics.families.lcgreek = mathematics.families.mr + mathematics.families.ucgreek = mathematics.families.mr + mathematics.families.vargreek = mathematics.families.mr + + mathematics.define(mathematics.slots.euler) + end +\stopluacode + +% \usemodule[mkivhacks] \setups{eulermath} +% \definetypeface[modern][mm][math][euler][default] +% \usemathcollection[eul] +% \switchtobodyfont[modern,11pt] +% \starttext +% $\alpha$ +% \stoptext + +\startsetups eulermath + \ctxlua{document.hacks()} +\stopsetups + +\endinput diff --git a/Master/texmf-dist/tex/context/base/m-mkivhacks.tex b/Master/texmf-dist/tex/context/base/m-mkivhacks.tex deleted file mode 100644 index f4765873947..00000000000 --- a/Master/texmf-dist/tex/context/base/m-mkivhacks.tex +++ /dev/null @@ -1,52 +0,0 @@ -%D \module -%D [ file=m-mkivhacks, -%D version=2008.10.20, -%D title=\CONTEXT\ Modules, -%D subtitle=Temporary Compatilibility Hacks, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\doifnotmode{mkiv}{\endinput} - -%D For Aditya, who needed it for his thesis. - -\startluacode - -- -- a lot or work - -- - -- mathematics.slots.euler = { - -- [0x03B1] = { "mr", 0x0B }, -- alpha - -- } - -- - -- mathematics.slots.euler = table.merge(mathematics.slots.traditional,mathematics.slots.euler) - -- - -- versus a quick hack - - document.hacks = document.hacks or { } - - function document.hacks() - mathematics.families.lcgreek = mathematics.families.mr - mathematics.families.ucgreek = mathematics.families.mr - mathematics.families.vargreek = mathematics.families.mr - - mathematics.define(mathematics.slots.euler) - end -\stopluacode - -% \usemodule[mkivhacks] \setups{eulermath} -% \definetypeface[modern][mm][math][euler][default] -% \usemathcollection[eul] -% \switchtobodyfont[modern,11pt] -% \starttext -% $\alpha$ -% \stoptext - -\startsetups eulermath - \ctxlua{document.hacks()} -\stopsetups - -\endinput diff --git a/Master/texmf-dist/tex/context/base/m-morse.mkvi b/Master/texmf-dist/tex/context/base/m-morse.mkvi new file mode 100644 index 00000000000..d106acfdefb --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-morse.mkvi @@ -0,0 +1,264 @@ +%D \module +%D [ file=m-morse, +%D version=2010.12.10, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=Morse, +%D author=Hans Hagen, +%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. + +% todo: act upon the node list +% make it a buffer operation +% nice in cld manual + +\startluacode + +moduledata.morse = moduledata.morse or { } +local morse = moduledata.morse + +local utfcharacters, gsub = string.utfcharacters, string.gsub +local ucchars, shchars = characters.ucchars, characters.shchars + +local codes = { + + ["A"] = "·—", + ["B"] = "—···", + ["C"] = "—·—·", + ["D"] = "—··", + ["E"] = "·", + ["F"] = "··—·", + ["G"] = "——·", + ["H"] = "····", + ["I"] = "··", + ["J"] = "·———", + ["K"] = "—·—", + ["L"] = "·—··", + ["M"] = "——", + ["N"] = "—·", + ["O"] = "———", + ["P"] = "·——·", + ["Q"] = "——·—", + ["R"] = "·—·", + ["S"] = "···", + ["T"] = "—", + ["U"] = "··—", + ["V"] = "···—", + ["W"] = "·——", + ["X"] = "—··—", + ["Y"] = "—·——", + ["Z"] = "——··", + + ["0"] = "—————", + ["1"] = "·————", + ["2"] = "··———", + ["3"] = "···——", + ["4"] = "····—", + ["5"] = "·····", + ["6"] = "—····", + ["7"] = "——···", + ["8"] = "———··", + ["9"] = "————·", + + ["."] = "·—·—·—", + [","] = "——··——", + [":"] = "———···", + [";"] = "—·—·—", + + ["?"] = "··——··", + ["!"] = "—·—·——", + + ["-"] = "—····—", + ["/"] = "—··—· ", + + ["("] = "—·——·", + [")"] = "—·——·—", + + ["="] = "—···—", + ["@"] = "·——·—·", + + ["'"] = "·————·", + ['"'] = "·—··—·", + + ["À"] = "·——·—", + ["Å"] = "·——·—", + ["Ä"] = "·—·—", + ["Æ"] = "·—·—", + ["Ç"] = "—·—··", + ["É"] = "··—··", + ["È"] = "·—··—", + ["Ñ"] = "——·——", + ["Ö"] = "———·", + ["Ø"] = "———·", + ["Ü"] = "··——", + ["ß"] = "··· ···", + +} + +morse.codes = codes + +setmetatable(codes, { __index = function(t,k) + if k then + local u = ucchars[k] + local v = rawget(t,u) or rawget(t,shchars[u]) or false + t[k] = v + return v + else + return false + end +end }) + +local MorseBetweenWords = context.MorseBetweenWords +local MorseBetweenCharacters = context.MorseBetweenCharacters +local MorseLong = context.MorseLong +local MorseShort = context.MorseShort +local MorseSpace = context.MorseSpace +local MorseUnknown = context.MorseUnknown + +local function toverbose(str) + str = gsub(str,"%s*+%s*","+") + str = gsub(str,"%s+"," ") + local done = false + for m in utfcharacters(str) do + if done then + MorseBetweenCharacters() + end + if m == "·" or m == "." then + MorseShort() + done = true + elseif m == "—" or m == "-" then + MorseLong() + done = true + elseif m == " " then + if done then + MorseBetweenCharacters() + end + done = false + elseif m == "+" then + MorseBetweenWords() + done = false + else + MorseUnknown(m) + end + end +end + +local function toregular(str) + local inmorse = false + for s in utfcharacters(str) do + local m = codes[s] + if m then + if inmorse then + MorseBetweenWords() + else + inmorse = true + end + local done = false + for m in utfcharacters(m) do + if done then + MorseBetweenCharacters() + else + done = true + end + if m == "·" then + MorseShort() + elseif m == "—" then + MorseLong() + elseif m == " " then + MorseBetweenCharacters() + end + end + inmorse = true + elseif s == "\n" or s == " " then + MorseSpace() + inmorse = false + else + if inmorse then + MorseBetweenWords() + else + inmorse = true + end + MorseUnknown(s) + end + end +end + +local function tomorse(str,verbose) + if verbose then + toverbose(str) + else + toregular(str) + end +end + +morse.tomorse = tomorse + +function morse.filetomorse(name,verbose) + tomorse(resolvers.loadtexfile(name),verbose) +end + +function morse.showtable() + context.starttabulate { "|l|l|" } -- { "|l|l|l|" } + for k, v in table.sortedpairs(codes) do + context.NC() context(k) + -- context.NC() context(v) + context.NC() tomorse(v,true) + context.NC() context.NR() + end + context.stoptabulate() +end + +\stopluacode + +\unprotect + +% todo: \setupmorse, but probably it's not worth the trouble. + +\def\MorseWidth {0.4em} +\def\MorseHeight {0.2em} +%def\MorseShort {\dontleavehmode\blackrule[\c!height=\MorseHeight,\c!width=\dimexpr\MorseWidth]} +%def\MorseLong {\dontleavehmode\blackrule[\c!height=\MorseHeight,\c!width=3\dimexpr\MorseWidth]} +\def\MorseShort {\dontleavehmode\vrule\!!width \dimexpr\MorseWidth\!!height\MorseHeight\!!depth\zeropoint\relax} +\def\MorseLong {\dontleavehmode\vrule\!!width3\dimexpr\MorseWidth\!!height\MorseHeight\!!depth\zeropoint\relax} +\def\MorseBetweenCharacters {\kern\MorseWidth} +\def\MorseBetweenWords {\hskip3\dimexpr\MorseWidth\relax} +\def\MorseSpace {\hskip7\dimexpr\MorseWidth\relax} +\def\MorseUnknown #text{[\detokenize{#text}]} + +\def\MorseCode #text{\ctxlua{moduledata.morse.tomorse(\!!bs#text\!!es,true)}} +\def\MorseString #text{\ctxlua{moduledata.morse.tomorse(\!!bs#text\!!es)}} +\def\MorseFile #text{\ctxlua{moduledata.morse.filetomorse("#text")}} +\def\MorseTable {\ctxlua{moduledata.morse.showtable()}} + +\let\Morse \MorseString + +\protect + +\doifnotmode{demo}{\endinput} + +\starttext + +\MorseTable + +\startlines +\MorseCode{—·—· ——— —· — · —··— —+—— —·— ·· ···—} +\MorseCode{—·—· ——— —· — · —··— — + —— —·— ·· ···—} +\Morse{ÀÁÂÃÄÅàáâãäå} +\Morse{ÆÇæç} +\Morse{ÈÉÊËèéêë} +\Morse{ÌÍÎÏìíîï} +\Morse{Ññ} +\Morse{ÒÓÔÕÖòóôõö} +\Morse{Øø} +\Morse{ÙÚÛÜùúû} +\Morse{Ýýÿ} +\Morse{ß} +\Morse{Ţţ} +\stoplines + +\Morse{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z} + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/m-newmat.tex b/Master/texmf-dist/tex/context/base/m-newmat.tex index 08ce33b4ce5..3fb75df5d3e 100644 --- a/Master/texmf-dist/tex/context/base/m-newmat.tex +++ b/Master/texmf-dist/tex/context/base/m-newmat.tex @@ -11,6 +11,12 @@ %C therefore copyrighted by \PRAGMA. See licen-en.pdf for %C details. +\unprotect + +%D Code has been integrated. + +\protect \endinput + %D This module collects macros that \TEX\ users kind of expect %D to be available when typesetting math. Most of them %D originate in the \AMS\ macro packages. We have taken the @@ -19,269 +25,6 @@ %D derived from AMS math modules) and adapted|/|extended by %D Hans Hagen. -%D Here we will add code on demand. So, just let us know what -%D should go in here. - -%M \usemodule[newmat] - -\unprotect - -%D \macros -%D {qedsymbol} -%D -%D [HH] The general Quod Erat Domonstrandum symbol is defined -%D in such a way that we can configure it. Because this symbol -%D is also used in text mode, we make it a normal text symbol -%D with special behavior. - -\def\qedsymbol#1% - {\ifhmode - \unskip~\hfill#1\par - \else\ifmmode - \eqno#1\relax % Do we really need the \eqno here? - \else - \leavevmode\hbox{}\hfill#1\par - \fi\fi} - -\definesymbol [qed] [\qedsymbol{\mathematics{\square}}] - -%D \macros -%D {QED} -%D -%D [HH] For compatbility reasons we also provide the \type -%D {\QED} command. In case this command is overloaded, we still -%D have the symbol available. \symbol[qed] - -\def\QED{\symbol[qed]} - -%D \macros -%D {genfrac} -%D -%D [TH] The definition of \type {\genfrac} \& co. is not -%D trivial, because it allows some flexibility. This is -%D supposed to be a user||level command, but will fail quite -%D desparately if called outside math mode (\CONTEXT\ redefines -%D \type {\over}) -%D -%D [HH] We clean up this macro a bit and (try) to make it -%D understandable. The expansion is needed for generating -%D the second argument to \type {\dogenfrac}, which is to -%D be a control sequence like \type {\over}. - -\unexpanded\def\genfrac#1#2#3#4% - {\edef\!!stringa - {#1#2}% - \expanded - {\dogenfrac{#4}% - \csname - \ifx @#3@% - \ifx\!!stringa\empty - \strippedcsname\normalover - \else - \strippedcsname\normaloverwithdelims - \fi - \else - \ifx\!!stringa\empty - \strippedcsname\normalabove - \else - \strippedcsname\normalabovewithdelims - \fi - \fi - \endcsname}% - {#1#2#3}} - -\def\dogenfrac#1#2#3#4#5% - {{#1{\begingroup#4\endgroup#2#3\relax#5}}} - -%D \macros -%D {dfrac, tfrac, frac, dbinom, tbinom, binom} -%D -%D [TH] No need to make these \type {\unexpanded} as well. - -%\def\dfrac {\genfrac\empty\empty\empty\displaystyle} -%\def\tfrac {\genfrac\empty\empty\empty\textstyle} -%\def\frac {\genfrac\empty\empty\empty\donothing} - -\def\dfrac {\genfrac\empty\empty{}\displaystyle} -\def\tfrac {\genfrac\empty\empty{}\textstyle} -\def\frac {\genfrac\empty\empty{}\donothing} - -\def\dbinom{\genfrac()\zeropoint\displaystyle} -\def\tbinom{\genfrac()\zeropoint\textstyle} -\def\binom {\genfrac()\zeropoint\donothing} - -\def\xfrac {\genfrac\empty\empty{}\scriptstyle} -\def\xxfrac{\genfrac\empty\empty{}\scriptscriptstyle} - -%D Better: - -\unexpanded\def\frac#1#2{\mathematics{\genfrac\empty\empty{}\donothing{#1}{#2}}} - -%D [HH] This shows up as: -%D -%D \startbuffer -%D $\dfrac {1}{2} \tfrac {1}{2} \frac {1}{2}$ -%D $\dbinom{1}{2} \tbinom{1}{2} \binom{1}{2}$ -%D \stopbuffer -%D -%D \typebuffer -%D -%D \getbuffer - -%D \macros -%D {text} -%D -%D [TH] \type {\text} is a command to typeset more or less -%D ordinary text inside of super- and sub|-|scripts. It has to -%D do a full font switch to get the sides right, so it will be -%D quite slow. \type {\text} kind of replaces \CONTEXT's \type -%D {\mathstyle} command. - -%D [HH] This macro is now also moved to the core, but we -%D keep it here as well for completeness. -%D -%D \starttyping -%D \unexpanded\def\mathtext -%D {\mathortext\domathtext\hbox} % {\ifmmode\@EA\dotext\else\@EA\hbox\fi} -%D -%D \def\domathtext#1% -%D {\mathchoice -%D {\dodomathtext\displaystyle\textface {#1}}% -%D {\dodomathtext\textstyle \textface {#1}}% -%D {\dodomathtext\textstyle \scriptface {#1}}% -%D {\dodomathtext\textstyle \scriptscriptface{#1}}} -%D -%D \def\dodomathtext#1#2#3% no \everymath ! -%D %{\hbox{\everymath{#1}\switchtobodyfont [#2]#3}} % 15 sec -%D {\hbox{\everymath{#1}\setcurrentfontbody{#2}#3}} % 3 sec (no math) -%D \stoptyping - -%D [HH] We use the following indirectness because \type {\text} -%D is a natural candidate for user macros (actually, it is -%D used in some modules). -%D -%D \starttyping -%D \let\text\mathtext -%D \stoptyping - -%D [HH] Actually, the font switch is not that slow when -%D typefaces are used. If needed this macro can be sped up. -%D -%D \startbuffer -%D ordinary text $x^{\text{extra ordinary text}}$ -%D \stopbuffer -%D -%D \typebuffer -%D -%D \getbuffer - -%D \macros -%D {mathhexbox} -%D -%D [TH] \type {\mathhexbox} is also user||level (already -%D defined in Plain \TEX). It allows to get a math character -%D inserted as if it was a text character. - -\gdef\mathhexbox#1#2#3{\mathtext{$\mathsurround\zeropoint\mathchar"#1#2#3$}} - -%D \macros -%D {boxed} -%D -%D [HH] Another macro that users expect (slightly adapted): - -\def\boxed - {\ifmmode\expandafter\mframed\else\expandafter\framed\fi} - -%D \macros -%D {cfrac} -%D -%D [HH] Now let us see what this one does: -%D -%D \startbuffer -%D $\cfrac{12}{3} \cfrac[l]{12}{3} \cfrac[c]{12}{3} \cfrac[r]{12}{3}$ -%D $\cfrac{1}{23} \cfrac[l]{1}{23} \cfrac[c]{1}{23} \cfrac[r]{1}{23}$ -%D \stopbuffer -%D -%D \typebuffer -%D -%D \getbuffer - -\definecomplexorsimple\cfrac - -\def\simplecfrac - {\complexcfrac[c]} - -\def\complexcfrac[#1]#2#3% - {{\displaystyle - \frac - {\strut\ifx r#1\hfill\fi#2\ifx l#1\hfill\fi}% - {#3}}% - \kern-\nulldelimiterspace} - -%D [HH] The next alternative is nicer: - -\def\simplecfrac {\docfrac[cc]} -\def\complexcfrac[#1]{\docfrac[#1cc]} - -\def\docfrac[#1#2#3]#4#5% - {{\displaystyle - \frac - {\strut - \ifx r#1\hfill\fi#4\ifx l#1\hfill\fi}% - {\ifx r#2\hfill\fi#5\ifx l#2\hfill\fi}% - \kern-\nulldelimiterspace}} - -%D [HH] Now we can align every combination we want: -%D -%D \startbuffer -%D $\cfrac{12}{3} \cfrac[l]{12}{3} \cfrac[c]{12}{3} \cfrac[r]{12}{3}$ -%D $\cfrac{1}{23} \cfrac[l]{1}{23} \cfrac[c]{1}{23} \cfrac[r]{1}{23}$ -%D $\cfrac[cl]{12}{3} \cfrac[cc]{12}{3} \cfrac[cr]{12}{3}$ -%D $\cfrac[lc]{1}{23} \cfrac[cc]{1}{23} \cfrac[rc]{1}{23}$ -%D \stopbuffer -%D -%D \typebuffer -%D -%D \getbuffer - -%D \macros -%D {splitfrac, splitdfrac} -%D -%D Occasionally one needs to typeset multi||line fractions. -%D These commands use \tex{genfrac} to create such fractions. -%D -%D \startbuffer -%D \startformula -%D a=\frac{ -%D \splitfrac{xy + xy + xy + xy + xy} -%D {+ xy + xy + xy + xy} -%D } -%D {z} -%D =\frac{ -%D \splitdfrac{xy + xy + xy + xy + xy} -%D {+ xy + xy + xy + xy} -%D } -%D {z} -%D \stopformula -%D \stopbuffer -%D -%D \typebuffer \getbuffer -%D -%D These macros are based on Michael J.~Downes posting on -%D comp.text.tex on 2001/12/06 - -\def\splitfrac#1#2% - {\genfrac\empty\empty\zeropoint\textstyle% - {\textstyle#1\quad\hfill}% - {\textstyle\hfill\quad\mathstrut#2}} - -\def\splitdfrac#1#2% - {\genfrac\empty\empty\zeropoint\displaystyle% - {#1\quad\hfill} - {\hfill\quad\mathstrut #2}} - -\protect \endinput - %D \macros %D {startsubarray,substack,startsmallmatrix} %D diff --git a/Master/texmf-dist/tex/context/base/m-obsolete.mkii b/Master/texmf-dist/tex/context/base/m-obsolete.mkii new file mode 100644 index 00000000000..a97002cf64c --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-obsolete.mkii @@ -0,0 +1,5 @@ +\unprotect + +\writestatus\m!systems{skipping obsolete module} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/m-obsolete.mkiv b/Master/texmf-dist/tex/context/base/m-obsolete.mkiv new file mode 100644 index 00000000000..2d4518181e6 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-obsolete.mkiv @@ -0,0 +1,5 @@ +\unprotect + +\writestatus\m!system{skipping obsolete module} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/m-obsolete.tex b/Master/texmf-dist/tex/context/base/m-obsolete.tex deleted file mode 100644 index a97002cf64c..00000000000 --- a/Master/texmf-dist/tex/context/base/m-obsolete.tex +++ /dev/null @@ -1,5 +0,0 @@ -\unprotect - -\writestatus\m!systems{skipping obsolete module} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/m-pdfsnc.mkii b/Master/texmf-dist/tex/context/base/m-pdfsnc.mkii new file mode 100644 index 00000000000..da59ab5d800 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-pdfsnc.mkii @@ -0,0 +1,200 @@ +%D \module +%D [ file=m-pdfsnc, +%D version=2003.12.23, +%D title=\CONTEXT\ Modules, +%D subtitle=Editor Synchronization, +%D author={Hans Hagen \& Ton Otten}, +%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. + +% \enablemode[demo] + +% This file is a variation of the file pdfsync4context.tex that ships +% with the pdfsync package (used by iTeXMac and TeXShop) by Piero +% D'Ancona and Jrme Laurens. I made the macros a bit more efficient +% and added some basic tracing options as well as a few more options. +% I made this one while playing a bit with the Mac and TeX). Maybe I'll +% add a bit of support to the kernel in in order to get rid of redundant +% markers. Also, this had better be rewritten in a bit less \pdf +% dependent way so that it can also be supported by dvipdfmx. I could +% write a generic file as well, but since there is already support for +% other packages I'll not do that (now). + +% compatible commands: +% +% \pdfsyncstart \pdfsyncstop \pdfsync +% +% extra commands: +% +% \enablepdfsync \disablepdfsync \pdfsynctext \pdfsyncnode \pdfsynctracemode + +\ifx\pdfoutput\undefined + \donefalse +\else\ifcase\pdfoutput + \donefalse +\else\ifx\pdfsavepos\undefined + \donefalse +\else + \donetrue +\fi\fi\fi + +\chardef \pdfsyncstate \zerocount +\chardef \pdfsynctracemode \zerocount + +\ifdone + + \writestatus{pdfsync}{loading and enabling synchronization support} + +\else + + \writestatus{pdfsync}{synchronization is only available with pdftex} + + \let \pdfsyncstart \relax % brr, not per se symmetrically used, so + \let \pdfsyncstop \relax % enable and disable are better names + \let \pdfsync \relax + + \let \pdfsynctext \gobbleoneargument + \let \pdfsyncnode \gobbleoneargument + + \let \enablepdfsync \pdfsyncstart + \let \disablepdfsync \pdfsyncstop + + \expandafter\endinput +\fi + +\unprotect % not really needed + +\newcount \pdfsynccounter +\newwrite \pdfsyncwrite + +\def\pdfsyncstart{\chardef\pdfsyncstate\plusone} \let\enablepdfsync \pdfsyncstart +\def\pdfsyncstop {\chardef\pdfsyncstate\zerocount} \let\disablepdfsync\pdfsyncstop + +\def\dostartpdfsync + {\immediate\openout\pdfsyncwrite\jobname.pdfsync + \immediate\write\pdfsyncwrite{\jobname}% + \immediate\write\pdfsyncwrite{version 0}} + +\def\dostoppdfsync + {\immediate\closeout\pdfsyncwrite} + +\def\doregisterpdfsyncpage + {\immediate\write\pdfsyncwrite{s\space\realfolio}} + +\def\dopdfsyncopenfile + {\immediate\write\pdfsyncwrite{(\space\readfilename}} + +\def\dopdfsyncclosefile + {\immediate\write\pdfsyncwrite{)}} + +\def\doregisterpdfsyncnode#1% + {\ifcase\pdfsyncstate\else + \pdfsavepos + \immediate\write\pdfsyncwrite{l\space\the\pdfsynccounter\space\the\inputlineno}% + \expanded{\write\pdfsyncwrite{p\ifnum#1=\plusone*\fi\space\the\pdfsynccounter\space\noexpand\the\pdflastxpos\space\noexpand\the\pdflastypos}}% + \global\advance\pdfsynccounter\plusone + \fi} + +\let\pdfsynctracer\gobbleoneargument + +\def\pdfsync {\doregisterpdfsyncnode\plusone \pdfsynctracer*} +\def\pdfsyncnode{\doregisterpdfsyncnode\zerocount\pdfsynctracer} +\def\pdfsynctext{\doregisterpdfsyncnode\plusone \pdfsynctracer} + +\appendtoks \dostartpdfsync \to \everystarttext +%appendtoks \dostoppdfsync \to \everystoptext +\appendtoks \doregisterpdfsyncpage \to \everyshipout +\appendtoks \dopdfsyncopenfile \to \everybeforereadfile +\appendtoks \dopdfsyncclosefile \to \everyafterreadfile + +\appendtoks \enablepdfsync \to \everystarttext +\appendtoks \disablepdfsync \to \everypagebody + +% beware, adding nodes this way will interfere with the typesetting + +\appendtoks \pdfsyncnode p\to \everypar +\appendtoks \pdfsyncnode m\to \everymath +\appendtoks \pdfsyncnode h\to \everyhbox + +% just for fun + +\def\pdfsynctracer#1% + {\ifcase\pdfsynctracemode\else + \ifcase\pdfsyncstate\else + \begingroup + \forgetall + \disablepdfsync + \ifcase\pdfsynctracemode\or % could be done more efficient, box around ifcase + \setbox\scratchbox\hbox to \zeropoint{\hss\infofont#1\hss}% 1 + \else + \setbox\scratchbox\hbox to \zeropoint{\hss\traceboxplacementtrue\boxcursor\hss}% 2/3/4 + \fi + \smashbox\scratchbox\box\scratchbox + \ifcase\pdfsynctracemode\or\or\or + \setbox\scratchbox\hbox to \zeropoint{\hss\raise1.25ex\hbox{\infofont#1}\hss}% 3 + \smashbox\scratchbox\box\scratchbox + \or + \setbox\scratchbox\hbox to \zeropoint{\hss\lower1.25ex\hbox{\infofont#1}\hss}% 4 + \smashbox\scratchbox\box\scratchbox + \fi + \endgroup + \fi + \fi} + +% \def\pdfsynctracer#1% more efficient but unreadable +% {\ifcase\pdfsynctracemode\else +% \ifcase\pdfsyncstate\else +% \begingroup +% \forgetall +% \disablepdfsync +% \setbox\scratchbox\hbox to \zeropoint +% {\hss +% \ifcase\pdfsynctracemode\or +% \infofont#1% 1 +% \else +% \traceboxplacementtrue\boxcursor% 2/3/4 +% \fi +% \hss}% +% \smashbox\scratchbox\box\scratchbox +% \setbox\scratchbox\hbox to \zeropoint +% {\hss +% \ifcase\pdfsynctracemode\or\or\or +% \raise1.25ex\hbox{\infofont#1}% 3 +% \or +% \lower1.25ex\hbox{\infofont#1}% 4 +% \fi +% \hss}% +% \smashbox\scratchbox\box\scratchbox +% \endgroup +% \fi +% \fi} + +\protect + +\doifnotmode{demo}{\endinput} + +\chardef\pdfsynctracemode=3 + +\starttext + +\chapter{Test} + +\processfile{tufte} + +\startitemize +\item first +\item second +\stopitemize + +\processfile{tufte} + +\startlines +some local \pdfsync sync and \pdfsynctext{here}a marked point +some local \pdfsync sync and \pdfsyncnode{here}a marked point +\stoplines + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/m-pdfsnc.tex b/Master/texmf-dist/tex/context/base/m-pdfsnc.tex deleted file mode 100644 index da59ab5d800..00000000000 --- a/Master/texmf-dist/tex/context/base/m-pdfsnc.tex +++ /dev/null @@ -1,200 +0,0 @@ -%D \module -%D [ file=m-pdfsnc, -%D version=2003.12.23, -%D title=\CONTEXT\ Modules, -%D subtitle=Editor Synchronization, -%D author={Hans Hagen \& Ton Otten}, -%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. - -% \enablemode[demo] - -% This file is a variation of the file pdfsync4context.tex that ships -% with the pdfsync package (used by iTeXMac and TeXShop) by Piero -% D'Ancona and Jrme Laurens. I made the macros a bit more efficient -% and added some basic tracing options as well as a few more options. -% I made this one while playing a bit with the Mac and TeX). Maybe I'll -% add a bit of support to the kernel in in order to get rid of redundant -% markers. Also, this had better be rewritten in a bit less \pdf -% dependent way so that it can also be supported by dvipdfmx. I could -% write a generic file as well, but since there is already support for -% other packages I'll not do that (now). - -% compatible commands: -% -% \pdfsyncstart \pdfsyncstop \pdfsync -% -% extra commands: -% -% \enablepdfsync \disablepdfsync \pdfsynctext \pdfsyncnode \pdfsynctracemode - -\ifx\pdfoutput\undefined - \donefalse -\else\ifcase\pdfoutput - \donefalse -\else\ifx\pdfsavepos\undefined - \donefalse -\else - \donetrue -\fi\fi\fi - -\chardef \pdfsyncstate \zerocount -\chardef \pdfsynctracemode \zerocount - -\ifdone - - \writestatus{pdfsync}{loading and enabling synchronization support} - -\else - - \writestatus{pdfsync}{synchronization is only available with pdftex} - - \let \pdfsyncstart \relax % brr, not per se symmetrically used, so - \let \pdfsyncstop \relax % enable and disable are better names - \let \pdfsync \relax - - \let \pdfsynctext \gobbleoneargument - \let \pdfsyncnode \gobbleoneargument - - \let \enablepdfsync \pdfsyncstart - \let \disablepdfsync \pdfsyncstop - - \expandafter\endinput -\fi - -\unprotect % not really needed - -\newcount \pdfsynccounter -\newwrite \pdfsyncwrite - -\def\pdfsyncstart{\chardef\pdfsyncstate\plusone} \let\enablepdfsync \pdfsyncstart -\def\pdfsyncstop {\chardef\pdfsyncstate\zerocount} \let\disablepdfsync\pdfsyncstop - -\def\dostartpdfsync - {\immediate\openout\pdfsyncwrite\jobname.pdfsync - \immediate\write\pdfsyncwrite{\jobname}% - \immediate\write\pdfsyncwrite{version 0}} - -\def\dostoppdfsync - {\immediate\closeout\pdfsyncwrite} - -\def\doregisterpdfsyncpage - {\immediate\write\pdfsyncwrite{s\space\realfolio}} - -\def\dopdfsyncopenfile - {\immediate\write\pdfsyncwrite{(\space\readfilename}} - -\def\dopdfsyncclosefile - {\immediate\write\pdfsyncwrite{)}} - -\def\doregisterpdfsyncnode#1% - {\ifcase\pdfsyncstate\else - \pdfsavepos - \immediate\write\pdfsyncwrite{l\space\the\pdfsynccounter\space\the\inputlineno}% - \expanded{\write\pdfsyncwrite{p\ifnum#1=\plusone*\fi\space\the\pdfsynccounter\space\noexpand\the\pdflastxpos\space\noexpand\the\pdflastypos}}% - \global\advance\pdfsynccounter\plusone - \fi} - -\let\pdfsynctracer\gobbleoneargument - -\def\pdfsync {\doregisterpdfsyncnode\plusone \pdfsynctracer*} -\def\pdfsyncnode{\doregisterpdfsyncnode\zerocount\pdfsynctracer} -\def\pdfsynctext{\doregisterpdfsyncnode\plusone \pdfsynctracer} - -\appendtoks \dostartpdfsync \to \everystarttext -%appendtoks \dostoppdfsync \to \everystoptext -\appendtoks \doregisterpdfsyncpage \to \everyshipout -\appendtoks \dopdfsyncopenfile \to \everybeforereadfile -\appendtoks \dopdfsyncclosefile \to \everyafterreadfile - -\appendtoks \enablepdfsync \to \everystarttext -\appendtoks \disablepdfsync \to \everypagebody - -% beware, adding nodes this way will interfere with the typesetting - -\appendtoks \pdfsyncnode p\to \everypar -\appendtoks \pdfsyncnode m\to \everymath -\appendtoks \pdfsyncnode h\to \everyhbox - -% just for fun - -\def\pdfsynctracer#1% - {\ifcase\pdfsynctracemode\else - \ifcase\pdfsyncstate\else - \begingroup - \forgetall - \disablepdfsync - \ifcase\pdfsynctracemode\or % could be done more efficient, box around ifcase - \setbox\scratchbox\hbox to \zeropoint{\hss\infofont#1\hss}% 1 - \else - \setbox\scratchbox\hbox to \zeropoint{\hss\traceboxplacementtrue\boxcursor\hss}% 2/3/4 - \fi - \smashbox\scratchbox\box\scratchbox - \ifcase\pdfsynctracemode\or\or\or - \setbox\scratchbox\hbox to \zeropoint{\hss\raise1.25ex\hbox{\infofont#1}\hss}% 3 - \smashbox\scratchbox\box\scratchbox - \or - \setbox\scratchbox\hbox to \zeropoint{\hss\lower1.25ex\hbox{\infofont#1}\hss}% 4 - \smashbox\scratchbox\box\scratchbox - \fi - \endgroup - \fi - \fi} - -% \def\pdfsynctracer#1% more efficient but unreadable -% {\ifcase\pdfsynctracemode\else -% \ifcase\pdfsyncstate\else -% \begingroup -% \forgetall -% \disablepdfsync -% \setbox\scratchbox\hbox to \zeropoint -% {\hss -% \ifcase\pdfsynctracemode\or -% \infofont#1% 1 -% \else -% \traceboxplacementtrue\boxcursor% 2/3/4 -% \fi -% \hss}% -% \smashbox\scratchbox\box\scratchbox -% \setbox\scratchbox\hbox to \zeropoint -% {\hss -% \ifcase\pdfsynctracemode\or\or\or -% \raise1.25ex\hbox{\infofont#1}% 3 -% \or -% \lower1.25ex\hbox{\infofont#1}% 4 -% \fi -% \hss}% -% \smashbox\scratchbox\box\scratchbox -% \endgroup -% \fi -% \fi} - -\protect - -\doifnotmode{demo}{\endinput} - -\chardef\pdfsynctracemode=3 - -\starttext - -\chapter{Test} - -\processfile{tufte} - -\startitemize -\item first -\item second -\stopitemize - -\processfile{tufte} - -\startlines -some local \pdfsync sync and \pdfsynctext{here}a marked point -some local \pdfsync sync and \pdfsyncnode{here}a marked point -\stoplines - -\stoptext diff --git a/Master/texmf-dist/tex/context/base/m-pictex.tex b/Master/texmf-dist/tex/context/base/m-pictex.tex index abb81b76ef9..71b0a78fe72 100644 --- a/Master/texmf-dist/tex/context/base/m-pictex.tex +++ b/Master/texmf-dist/tex/context/base/m-pictex.tex @@ -27,7 +27,7 @@ \fi \ifx\beginpicture\undefined \ifx\newenvironment\undefined - \readfile{thrd-pic.tex}{}{} + \loadmarkfile{thrd-pic}% \else \input prepictex.tex \relax \input pictex.tex \relax diff --git a/Master/texmf-dist/tex/context/base/m-plus.tex b/Master/texmf-dist/tex/context/base/m-plus.tex deleted file mode 100644 index 312d9f93105..00000000000 --- a/Master/texmf-dist/tex/context/base/m-plus.tex +++ /dev/null @@ -1,30 +0,0 @@ -%D \module -%D [ file=m-plus, -%D version=2003.03.16, -%D title=\CONTEXT\ Extra Modules, -%D subtitle=Loading extra features, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright=PRAGMA-ADE] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -%D Somewhere in 2001 I started collecting new functionality -%D in a module \type {m-yesno}. As the name suggests, I was -%D not entirely sure if this functionality belonged in the -%D kernel. When (again) on the \CONTEXT\ list a request for -%D side bars was posted, I decided to move such code to plus -%D modules. Users who want this additional functionality can -%D put the following call in their \type {cont-sys.tex} file: -%D -%D \starttyping -%D \usemodule[plus] -%D \stoptyping - -% \readfile {plus-rul} \donothing \donothing -% \readfile {page-str} \donothing \donothing -% \readfile {page-plg} \donothing \donothing - -\endinput diff --git a/Master/texmf-dist/tex/context/base/m-pstricks.lua b/Master/texmf-dist/tex/context/base/m-pstricks.lua index 35cae93f65f..ab271908496 100644 --- a/Master/texmf-dist/tex/context/base/m-pstricks.lua +++ b/Master/texmf-dist/tex/context/base/m-pstricks.lua @@ -17,8 +17,9 @@ if not modules then modules = { } end modules ['m-pstricks'] = { local format, lower, concat, gmatch = string.format, string.lower, table.concat, string.gmatch local variables = interfaces.variables -plugins = plugins or { } -plugins.pstricks = plugins.pstricks or { } +moduledata.pstricks = moduledata.pstricks or { } + +local report_pstricks = logs.reporter("pstricks") local template = [[ \starttext @@ -41,16 +42,16 @@ local template = [[ local modules = { } local graphics = 0 -function plugins.pstricks.usemodule(names) +function moduledata.pstricks.usemodule(names) for name in gmatch(names,"([^%s,]+)") do modules[#modules+1] = format([[\readfile{%s}{}{}]],name) end end -function plugins.pstricks.process(n) +function moduledata.pstricks.process(n) graphics = graphics + 1 local name = string.format("%s-pstricks-%04i",tex.jobname,graphics) - local data = buffers.collect("def-"..n) + local data = buffers.collectcontent("def-"..n) local tmpfile = name .. ".tmp" local epsfile = name .. ".ps" local pdffile = name .. ".pdf" @@ -65,9 +66,9 @@ function plugins.pstricks.process(n) if lfs.isfile(pdffile) then context.externalfigure( { pdffile }, { object = variables.no } ) else - logs.report("plugins","pstricks run failed, no pdf file") + report_pstricks("run failed, no pdf file") end else - logs.report("plugins","pstricks run failed, no ps file") + report_pstricks("run failed, no ps file") end end diff --git a/Master/texmf-dist/tex/context/base/m-pstricks.mkiv b/Master/texmf-dist/tex/context/base/m-pstricks.mkiv index c800ec19935..c976982a6a0 100644 --- a/Master/texmf-dist/tex/context/base/m-pstricks.mkiv +++ b/Master/texmf-dist/tex/context/base/m-pstricks.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\ctxloadluafile{m-pstricks}{} +\registerctxluafile{m-pstricks}{} %D \startbuffer %D \usePSTRICKSmodule[pst-barcode] @@ -57,8 +57,8 @@ \definebuffer[PSTRICKS] -\unexpanded\def\processPSTRICKS {\ctxlua{plugins.pstricks.process(\thebuffernumber{PSTRICKS})}} -\unexpanded\def\usePSTRICKSmodule[#1]{\ctxlua{plugins.pstricks.usemodule("#1")}} +\unexpanded\def\processPSTRICKS {\ctxlua{moduledata.pstricks.process(\thebuffernumber{PSTRICKS})}} +\unexpanded\def\usePSTRICKSmodule[#1]{\ctxlua{moduledata.pstricks.usemodule("#1")}} \unexpanded\def\setPSTRICKS #1{\setbuffer[def-\thebuffernumber{PSTRICKS}]#1\endbuffer} \let\stopPSTRICKS\processPSTRICKS diff --git a/Master/texmf-dist/tex/context/base/m-pstricks.tex b/Master/texmf-dist/tex/context/base/m-pstricks.tex deleted file mode 100644 index 28bc9f30f2f..00000000000 --- a/Master/texmf-dist/tex/context/base/m-pstricks.tex +++ /dev/null @@ -1,16 +0,0 @@ -%D \module -%D [ file=m-pstricks, -%D version=1997.01.15, -%D title=\CONTEXT\ Extra Modules, -%D subtitle=\PSTRICKS\ Connections, -%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. - -\loadmarkfile{m-pstricks} - -\endinput diff --git a/Master/texmf-dist/tex/context/base/m-punk.mkiv b/Master/texmf-dist/tex/context/base/m-punk.mkiv index 65bf0397419..71158d2a638 100644 --- a/Master/texmf-dist/tex/context/base/m-punk.mkiv +++ b/Master/texmf-dist/tex/context/base/m-punk.mkiv @@ -17,190 +17,193 @@ % ConTeXt MkIV kernel. \startluacode -do - local concat = table.concat - local chardata = characters.data - local fontdata = fonts.ids +local concat = table.concat +local chardata = characters.data +local fontdata = fonts.hashes.identifiers - fonts.mp = fonts.mp or { } +fonts.mp = fonts.mp or { } - fonts.mp.version = fonts.mp.version or 1.11 - fonts.mp.inline = true - fonts.mp.cache = containers.define("fonts", "mp", fonts.mp.version, true) +fonts.mp.version = fonts.mp.version or 1.15 +fonts.mp.inline = true +fonts.mp.cache = containers.define("fonts", "mp", fonts.mp.version, true) - metapost.characters = metapost.characters or { } +metapost.characters = metapost.characters or { } -- todo: use table share as in otf - local characters, descriptions = { }, { } - local factor, l, n, w, h, d, total, variants = 100, { }, 0, 0, 0, 0, 0, 0, true - - -- A next version of mplib will provide the tfm font information which - -- gives better glyph dimensions, plus additional kerning information. - - local flusher = { - startfigure = function(chrnum,llx,lly,urx,ury) - l, n = { }, chrnum - w, h, d = urx - llx, ury, -lly - total = total + 1 - inline = fonts.mp.inline - end, - flushfigure = function(t) - for i=1, #t do - l[#l+1] = t[i] - end - end, - stopfigure = function() - local cd = chardata[n] - if inline then - descriptions[n] = { - -- unicode = n, - name = cd and cd.adobename, - width = w*100, - height = h*100, - depth = d*100, - boundingbox = { 0, -d, w, h }, - } - characters[n] = { - commands = { -- todo: xforms, should happen in backend - { "special", "pdf: " .. concat(l," ") }, - } - } - else - descriptions[n] = { - -- unicode = n, - name = cd and cd.adobename, - width = w*100, - height = h*100, - depth = d*100, - boundingbox = { 0, -d, w, h }, +local characters, descriptions = { }, { } +local factor, l, n, w, h, d, total, variants = 100, { }, 0, 0, 0, 0, 0, 0, true + +-- A next version of mplib will provide the tfm font information which +-- gives better glyph dimensions, plus additional kerning information. + +local flusher = { + startfigure = function(chrnum,llx,lly,urx,ury) + l, n = { }, chrnum + w, h, d = urx - llx, ury, -lly + total = total + 1 + inline = fonts.mp.inline + end, + flushfigure = function(t) + for i=1, #t do + l[#l+1] = t[i] + end + end, + stopfigure = function() + local cd = chardata[n] + if inline then + descriptions[n] = { + -- unicode = n, + name = cd and cd.adobename, + width = w*100, + height = h*100, + depth = d*100, + boundingbox = { 0, -d, w, h }, + } + characters[n] = { + commands = { -- todo: xforms, should happen in backend + { "special", "pdf: " .. concat(l," ") }, } - characters[n] = { - commands = { - { "image", { stream = concat(l," "), bbox = { 0, -d*65536, w*65536, h*65536 } } }, - } + } + else + descriptions[n] = { + -- unicode = n, + name = cd and cd.adobename, + width = w*100, + height = h*100, + depth = d*100, + boundingbox = { 0, -d, w, h }, + } + characters[n] = { + commands = { + { "image", { stream = concat(l," "), bbox = { 0, -d*65536, w*65536, h*65536 } } }, } - end + } end - } - - metapost.characters.instances = metapost.characters.instances or 10 - - function metapost.characters.process(mpxformat, name, instances, scalefactor) - statistics.starttiming(metapost.characters) - scalefactor = scalefactor or 1 - instances = instances or metapost.characters.instances or 10 - local fontname = file.removesuffix(file.basename(name)) - local hash = file.robustname(string.format("%s %05i %03i", fontname, scalefactor*1000, instances)) - local lists = containers.read(fonts.mp.cache(), hash) - if not lists then - statistics.starttiming(flusher) - -- we can use a format per font - local data = io.loaddata(resolvers.find_file(name)) - metapost.reset(mpxformat) - metapost.set_outer_color(2) -- no outer color and no reset either - lists = { } - for i=1,instances do - list = { } - characters, descriptions = { }, { } - metapost.process( - mpxformat, - { - "randomseed := " .. i*10 .. ";", - "scale_factor := " .. scalefactor .. " ;", - data - }, - false, - flusher - ) - lists[i] = { - designsize = 655360, - name = string.format("%s-%03i",hash,i), - parameters = { - slant = 0, - space = 333 * scalefactor, - space_stretch = 166.5 * scalefactor, - space_shrink = 111 * scalefactor, - x_height = 431 * scalefactor, - quad =1000 * scalefactor, - extra_space = 0 - }, - ["type"] = "virtual", - characters = characters, - descriptions = descriptions, - -- embedding = "subset", - -- mkiv: - spacer = "space", - unit = 1000, - shared = { }, - unique = { }, + end +} + +metapost.characters.instances = metapost.characters.instances or 10 + +function metapost.characters.process(mpxformat, name, instances, scalefactor) + statistics.starttiming(metapost.characters) + scalefactor = scalefactor or 1 + instances = instances or metapost.characters.instances or 10 + local fontname = file.removesuffix(file.basename(name)) + local hash = file.robustname(string.format("%s %05i %03i", fontname, scalefactor*1000, instances)) + local lists = containers.read(fonts.mp.cache, hash) + if not lists then + statistics.starttiming(flusher) + -- we can use a format per font + local data = io.loaddata(resolvers.findfile(name)) + metapost.reset(mpxformat) + metapost.setoutercolor(2) -- no outer color and no reset either + lists = { } + for i=1,instances do + characters = { } + descriptions = { } + metapost.process( + mpxformat, + { + "randomseed := " .. i*10 .. ";", + "scale_factor := " .. scalefactor .. " ;", + data + }, + false, + flusher + ) + lists[i] = { + characters = characters, + descriptions = descriptions, + parameters = { + designsize = 655360, + slant = 0, + space = 333 * scalefactor, + space_stretch = 166.5 * scalefactor, + space_shrink = 111 * scalefactor, + x_height = 431 * scalefactor, + quad = 1000 * scalefactor, + extra_space = 0, + }, + properties = { + name = string.format("%s-%03i",hash,i), + virtualized = true, + spacer = "space", } - end - metapost.reset(mpxformat) -- saves memory - lists = containers.write(fonts.mp.cache(), hash, lists) - statistics.stoptiming(flusher) + } end - variants = variants + #lists - statistics.stoptiming(metapost.characters) - return lists + metapost.reset(mpxformat) -- saves memory + lists = containers.write(fonts.mp.cache, hash, lists) + statistics.stoptiming(flusher) end + variants = variants + #lists + statistics.stoptiming(metapost.characters) + return lists +end - function fonts.vf.aux.combine.commands.metafont(g,v) - local size = g.specification.size - local data = metapost.characters.process(v[2],v[3],v[4],size/655360) - local list, t = { }, { } - for d=1,#data do - t = data[d] - t = fonts.tfm.scale(t, -1000) - local id = font.nextid() - t.fonts = { { id = id } } - fontdata[id] = t - fonts.vf.aux.compose_characters(t) - list[d] = font.define(t) - end - for k=1,#t do - g[k] = t[k] -- kind of replace, when not present, make nil - end - g.virtualized = true - g.variants = list +function fonts.handlers.vf.combiner.commands.metafont(g,v) + local size = g.specification.size + local data = metapost.characters.process(v[2],v[3],v[4],size/655360) + local list, t = { }, { } + for d=1,#data do + t = data[d] + t = fonts.constructors.scale(t, -1000) + local id = font.nextid() + t.fonts = { { id = id } } + fontdata[id] = t + fonts.handlers.vf.helpers.composecharacters(t) + list[d] = font.define(t) end - - fonts.define.methods.install( "punk", { - { "metafont", "mfplain", "punkfont.mp", 10 }, - } ) - - cases.actions[99] = function(current) - local used = fontdata[current.font].variants - if used then - local f = math.random(1,#used) - current.font = used[f] - return current, true - else - return current, false - end + for k, v in next, t do + g[k] = v -- kind of replace, when not present, make nil end + g.properties.virtualized = true + g.variants = list +end - metapost.characters.flusher = flusher - - statistics.register("metapost font generation", function() - local time = statistics.elapsedtime(flusher) - if total > 0 then - return string.format("%i glyphs, %.3f seconds runtime, %i glyphs/second", total, time, total/time) - else - return string.format("%i glyphs, %.3f seconds runtime", total, time) - end - end) +fonts.definers.methods.install( "punk", { + { "metafont", "mfplain", "punkfont.mp", 10 }, +} ) +fonts.definers.methods.install( "punkbold", { + { "metafont", "mfplain", "punkfont-bold.mp", 10 }, +} ) +fonts.definers.methods.install( "punkslanted", { + { "metafont", "mfplain", "punkfont-slanted.mp", 10 }, +} ) +fonts.definers.methods.install( "punkboldslanted", { + { "metafont", "mfplain", "punkfont-boldslanted.mp", 10 }, +} ) + +typesetters.cases.actions[99] = function(current) + local used = fontdata[current.font].variants + if used then + local f = math.random(1,#used) + current.font = used[f] + return current, true + else + return current, false + end +end - statistics.register("metapost font loading",function() - local time = statistics.elapsedtime(metapost.characters) - if variants > 0 then - return string.format("%.3f seconds, %i instances, %0.3f instances/second", time, variants, variants/time) - else - return string.format("%.3f seconds, %i instances", time, variants) - end - end) +metapost.characters.flusher = flusher -end +statistics.register("metapost font generation", function() + local time = statistics.elapsedtime(flusher) + if total > 0 then + return string.format("%i glyphs, %.3f seconds runtime, %i glyphs/second", total, time, total/time) + else + return string.format("%i glyphs, %.3f seconds runtime", total, time) + end +end) + +statistics.register("metapost font loading",function() + local time = statistics.elapsedtime(metapost.characters) + if variants > 0 then + return string.format("%.3f seconds, %i instances, %0.3f instances/second", time, variants, variants/time) + else + return string.format("%.3f seconds, %i instances", time, variants) + end +end) \stopluacode \unexpanded\def\EnableRandomPunk {\setcharactercasing[99]} @@ -209,25 +212,18 @@ end \unexpanded\def\StopRandomPunk {\endgroup} \starttypescript [serif] [punk] [default] - \setups[font:fallback:serif] % no style variants yet - \definefontsynonym [Serif] [demo@punk] + \definefontsynonym [Serif] [demo@punk] + \definefontsynonym [SerifBold] [demobold@punkbold] + \definefontsynonym [SerifSlanted] [demoslanted@punkslanted] + \definefontsynonym [SerifBoldSlanted] [demoboldslanted@punkboldslanted] + \definefontsynonym [SerifItalic] [SerifSlanted] + \definefontsynonym [SerifBoldItalic] [SerifBoldSlanted] \stoptypescript \starttypescript [punk] \definetypeface [punk] [rm] [serif] [punk] [default] \stoptypescript -\definefontfeature[punknova][mode=node,script=latn,rand=yes,kern=yes,liga=yes,tlig=yes] - -\starttypescript [serif] [punknova] - \setups[font:fallback:serif] % no style variants yet, actually it's a sans - \definefontsynonym [Serif] [file:punknova] [features=punknova] -\stoptypescript - -\starttypescript [punknova] - \definetypeface [punknova] [rm] [serif] [punknova] [default] -\stoptypescript - \endinput \usetypescript[punk] diff --git a/Master/texmf-dist/tex/context/base/m-punk.tex b/Master/texmf-dist/tex/context/base/m-punk.tex deleted file mode 100644 index fe7ec85ccdb..00000000000 --- a/Master/texmf-dist/tex/context/base/m-punk.tex +++ /dev/null @@ -1,3 +0,0 @@ -% this file will disasppear but we need it as it is still in tex live - -\loadmarkfile{m-punk} diff --git a/Master/texmf-dist/tex/context/base/m-spreadsheet.mkiv b/Master/texmf-dist/tex/context/base/m-spreadsheet.mkiv new file mode 100644 index 00000000000..49f59ded9ef --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-spreadsheet.mkiv @@ -0,0 +1,265 @@ +%D \module +%D [ file=m-spreadsheet, +%D version=2011.02.21, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=Spreadsheets, +%D author=Hans Hagen, +%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 This is an experimental follow up on discussion on the mailing list. + +\startluacode +local byte, format = string.byte, string.format +local R, P, C, Cs, Cc, Carg, lpegmatch = lpeg.R, lpeg.P, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.Carg, lpeg.match + +local spreadsheets = { } +moduledata.spreadsheets = spreadsheets + +local data = { } +spreadsheets.data = data + +local stack, current = { }, "default" + +local mt ; mt = { + __index = function(t,k) + local v = { } + setmetatable(v,mt) + t[k] = v + return v + end, +} + +function spreadsheets.reset(name) + if not name or name == "" then name = "default" end + local d = { } + setmetatable(d,mt) + data[name] = d +end + +function spreadsheets.start(name) + if not name or name == "" then name = "default" end + table.insert(stack,current) + current = name + if not data[current] then + local d = { } + setmetatable(d,mt) + data[current] = d + end +end + +function spreadsheets.stop() + current = table.remove(stack) +end + +spreadsheets.reset() + +local offset = byte("A") - 1 + +local function assign(s,n) + return format("moduledata.spreadsheets.data['%s'][%s]",n,byte(s)-offset) +end + +-------- datacell(name,a,b,...) +function datacell(a,b,...) + local n = 0 + if b then + local t = { a, b, ... } + for i=1,#t do + n = n * (i-1) * 26 + byte(t[i]) - offset + end + else + n = byte(a) - offset + end + -- return format("dat['%s'][%s]",name,n) + return format("dat[%s]",n) +end + +----- cell = (Carg(1) * C(R("AZ"))^1) / datacell * (Cc("[") * (R("09")^1) * Cc("]") + #P(1)) +local cell = C(R("AZ"))^1 / datacell * (Cc("[") * (R("09")^1) * Cc("]") + #P(1)) +local pattern = Cs(Cc("return ") * (cell + P(1))^0) + +local functions = { } +spreadsheets.functions = functions + +function functions.sum(c,f,t) + if f and t then + local r = 0 + for i=f,t do + r = r + c[i] + end + return r + else + return 0 + end +end + +function functions.fmt(pattern,n) + return format("%"..pattern,n) +end + +local template = [[ + local spr = moduledata.spreadsheets.functions + local dat = moduledata.spreadsheets.data['%s'] + local sum = spr.sum + local fmt = spr.fmt + %s +]] + +local function execute(name,r,c,str) + if name == "" then name = current if name == "" then name = "default" end end + str = lpegmatch(pattern,str,1,name) + str = format(template,name,str) + -- print(str) + local result = loadstring(str) + result = result and result() or 0 + data[name][c][r] = result + return result +end + +function spreadsheets.set(name,r,c,str) + if name == "" then name = current if name == "" then name = "default" end end + execute(name,r,c,str) +end + +function spreadsheets.get(name,r,c,str) + if name == "" then name = current if name == "" then name = "default" end end + if not str or str == "" then + context(data[name][c][r] or 0) + else + local result = execute(name,r,c,str) + if result then + if type(result) == "number" then + data[name][c][r] = result + end + context(result) + end + end +end + +function spreadsheets.doifelsecell(name,r,c) + if name == "" then name = current if name == "" then name = "default" end end + local d = data[name] + commands.testcase(d and d[c][r]) +end + +function spreadsheets.show(name) + if name == "" then name = current if name == "" then name = "default" end end + table.print(data[name],name) +end +\stopluacode + +\unprotect + +% todo: get(...) set(..) ctx(...) + +\unexpanded\def\resetspreadsheet {\dosingleempty\doresetspreadsheet} +\unexpanded\def\doresetspreadsheet [#1]{\ctxlua{moduledata.spreadsheets.reset("#1")}} +\unexpanded\def\startspreadsheet {\dosingleempty\dostartspreadsheet} +\unexpanded\def\dostartspreadsheet [#1]{\ctxlua{moduledata.spreadsheets.start("#1")}} +\unexpanded\def\stopspreadsheet {\ctxlua{moduledata.spreadsheets.stop()}} +\unexpanded\def\showspreadsheet {\dosingleempty\doshowspreadsheet} +\unexpanded\def\doshowspreadsheet [#1]{\ctxlua{moduledata.spreadsheets.show("#1")}} +\unexpanded\def\getspreadsheet {\dosingleempty\dogetspreadsheet} +\unexpanded\def\dosetspreadsheet [#1]#2#3#4{\ctxlua{moduledata.spreadsheets.set ("#1",\number#2,\number#3,"#4")}} +\unexpanded\def\setspreadsheet {\dosingleempty\dosetspreadsheet} +\unexpanded\def\dogetspreadsheet [#1]#2#3#4{\ctxlua{moduledata.spreadsheets.get ("#1",\number#2,\number#3,"#4")}} +\unexpanded\def\doifelsespreadsheetcell {\dosingleempty\dodoifelsespreadsheetcell} +\unexpanded\def\dodoifelsespreadsheetcell[#1]#2#3{\ctxlua{moduledata.spreadsheets.doifelsecell("#1","#2","#3")}} + +\def\TABLEsetspreadsheet#1{\ctxlua{moduledata.spreadsheets.set("",\number\tblrow+1,\number\tblcol,\!!bs#1\!!es)}} +\def\TABLEgetspreadsheet#1{\ctxlua{moduledata.spreadsheets.get("",\number\tblrow+1,\number\tblcol,\!!bs#1\!!es)}} + +\appendtoks + \resetspreadsheet + \let\setspr\TABLEsetspreadsheet + \let\getspr\TABLEgetspreadsheet +\to \everyTABLEpass + +\unexpanded\def\startspreadsheettable % quick and dirty + {\dosingleempty\dostartspreadsheettable} + +\unexpanded\def\dostartspreadsheettable[#1]% + {\bgroup + \startspreadsheet[#1]%% + \def\startrow{\bTR}% + \def\stoprow {\eTR}% + \def\startcell##1\stopcell{\bTD\getspr{##1}\eTD}% + \bTABLE[\c!align=flushright]} + +\unexpanded\def\stopspreadsheettable + {\eTABLE + \stopspreadsheet + \egroup} + +\protect + +\doifnotmode{demo}{\endinput} + +\starttext + +\bTABLE[align=middle] + \bTR + \bTD \getspr{100} \eTD \bTD test \setspr{30} \eTD + \eTR + \bTR + \bTD \getspr{20} \eTD \bTD \getspr{4+3} \eTD + \eTR + \bTR + \bTD \getspr{A[1] + A[2]} \eTD + \bTD \getspr{B1 + B2} \eTD + \eTR + \bTR + \bTD[nx=2] \bf \getspr{(A[3] + B[3]) /100} \eTD + \eTR + \bTR + \bTD[nx=2] \bf \getspr{string.format("\letterpercent0.3f",(A[3] + B[3]) /100)} \eTD + \eTR + \bTR + \bTD[nx=2] \bf \getspr{fmt("0.3f",(sum(A,1,2)) / 10)} \eTD + \eTR +\eTABLE + +\startspreadsheet[mysheet] + +\bTABLE[align=middle] + \bTR + \bTD \getspr{100} \eTD \bTD test \setspr{30} \eTD + \eTR + \bTR + \bTD \getspr{20} \eTD \bTD \getspr{4+3} \eTD + \eTR + \bTR + \bTD \getspr{A[1] + A[2]} \eTD + \bTD \getspr{B[1] + B[2]} \eTD + \eTR + \bTR + \bTD[nx=2] \bf \getspr{A[3] + B[3]} \eTD + \eTR +\eTABLE + +\stopspreadsheet + +\startspreadsheettable + \startrow + \startcell 3 \stopcell + \startcell 9 \stopcell + \startcell A[1] + B[1] \stopcell + \stoprow +\stopspreadsheettable + +bla bla \getspreadsheet[mysheet]{2}{2}{} + +bla bla \getspreadsheet[mysheet]{4}{1}{} + +% \showspreadsheet +% \showspreadsheet[mysheet] + +\doifelsespreadsheetcell[mysheet]{1}{2}{YES}{NOP} +\doifelsespreadsheetcell[myshoot]{1}{2}{YES}{NOP} + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/m-steps.mkii b/Master/texmf-dist/tex/context/base/m-steps.mkii deleted file mode 100644 index 3e1f86312de..00000000000 --- a/Master/texmf-dist/tex/context/base/m-steps.mkii +++ /dev/null @@ -1,83 +0,0 @@ -%D \module -%D [ file=m-steps, -%D version=2001.05.28, -%D title=\CONTEXT\ Modules, -%D subtitle=Step Charts \& Tables, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -%D The \XML\ interface: - -\unprotect - -\defineXMLdirective [stepchart] [charts] \setupSTEPcharts -\defineXMLdirective [stepchart] [cells] \setupSTEPcells -\defineXMLdirective [stepchart] [texts] \setupSTEPtexts -\defineXMLdirective [stepchart] [lines] \setupSTEPlines - -\defineXMLdirective [steptable] [tables] \setupSTEPtables -\defineXMLdirective [steptable] [cells] \setupSTEPcells -\defineXMLdirective [steptable] [texts] \setupSTEPtexts -\defineXMLdirective [steptable] [lines] \setupSTEPlines - -\defineXMLpickup[stepchart][@@STPC] - {\bgroup - \defineXMLpush[top]% - \defineXMLpush[bot]% - \defineXMLenvironment[lines][@@STEL] - {\expanded{\startlines[\theXMLarguments{@@STEL}]}} - {\stoplines}% - \defineXMLenvironment[cells][@@STEC] - {\XMLerase{top}\XMLerase{bot}} - {\expanded{\cells[\theXMLarguments{@@STEC}]{\XMLpop{top}}{\XMLpop{bot}}}}% - \defineXMLenvironment[texts][@@STET] - {\XMLerase{top}\XMLerase{bot}} - {\expanded{\texts[\theXMLarguments{@@STET}]{\XMLpop{top}}{\XMLpop{bot}}}}% - \defineXMLenvironmentpush[cell][@@STEC] - {\XMLerase{cell}} - {\expanded{\cell [\theXMLarguments{@@STEC}]{\XMLpop{cell}}}}% - \defineXMLenvironmentpush [text] [@@STET] - {\XMLerase{text}} - {\expanded{\text [\theXMLarguments{@@STET}]{\XMLpop{text}}}}% - \expanded{\startSTEPchart[\theXMLarguments{@@STPC}]}} - {\stopSTEPchart - \egroup} - -\defineXMLpickup[steptable][@@STPT] - {\bgroup - \defineXMLenvironment[lines][@@STEL] - {\expanded{\startlines[\theXMLarguments{@@STEL}]}} - {\stoplines}% - \defineXMLargument[cell][@@STEC] - {\expanded{\cell[\theXMLarguments{@@STEC}]}}% - \defineXMLargument[text][@@STET] - {\expanded{\text[\theXMLarguments{@@STET}]}}% - \defineXMLargument[prep] - {\prep}% - \expanded{\startSTEPtable[\theXMLarguments{@@STPT}]}} - {\stopSTEPtable - \egroup} - -\defineXMLpickup[stepaligntable][@@STPT] - {\bgroup - \defineXMLenvironment[lines][@@STEL] - {\expanded{\setupSTEPlines[\theXMLarguments{@@STEL}]}} - {}% - \defineXMLpush[c1]\defineXMLpush[c2]\defineXMLpush[c3]% - \defineXMLenvironment[cells][@@STEC] - {\XMLerase{c1}\XMLerase{c1}\XMLerase{c3}} - {\expanded{\cells[\theXMLarguments{@@STEC}]{\XMLpop{c1}}{\XMLpop{c2}}{\XMLpop{c3}}}}% - \defineXMLargument[text][@@STET] - {\expanded{\text[\theXMLarguments{@@STET}]}}% - \defineXMLargument[prep] - {\prep}% - \expanded{\startSTEPaligntable[\theXMLarguments{@@STPT}]}} - {\stopSTEPaligntable - \egroup} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/m-steps.mkiv b/Master/texmf-dist/tex/context/base/m-steps.mkiv deleted file mode 100644 index 9bb56c53228..00000000000 --- a/Master/texmf-dist/tex/context/base/m-steps.mkiv +++ /dev/null @@ -1,20 +0,0 @@ -%D \module -%D [ file=m-steps, -%D version=2001.05.28, -%D title=\CONTEXT\ Modules, -%D subtitle=Step Charts \& Tables, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -%D The \XML\ interface: - -\unprotect - -\writestatus\m!systems{The steps mkiv xml interface is not yet defined!} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/m-steps.tex b/Master/texmf-dist/tex/context/base/m-steps.tex index 1f6a374033c..55e13b97d3b 100644 --- a/Master/texmf-dist/tex/context/base/m-steps.tex +++ b/Master/texmf-dist/tex/context/base/m-steps.tex @@ -454,8 +454,8 @@ \ifcase\somestepboxone \box\stepboxone \vskip\@@STPCvoffset \fi \ifcase\somestepboxtwo \box\stepboxtwo \vskip\scratchdimen \fi \ifcase\sometextboxtwo \box\textboxtwo \vskip\@@STPCvoffset \fi - \global\resetbox\stepboxone \global\resetbox\stepboxtwo % needed indeed - \global\resetbox\textboxone \global\resetbox\textboxtwo % needed indeed + \global\setbox\stepboxone\emptybox \global\setbox\stepboxtwo\emptybox % needed indeed + \global\setbox\textboxone\emptybox \global\setbox\textboxtwo\emptybox % needed indeed %\kern-\scratchdimen % no, instead: \vskip-\lastskip} \hbox diff --git a/Master/texmf-dist/tex/context/base/m-tex4ht.mkii b/Master/texmf-dist/tex/context/base/m-tex4ht.mkii new file mode 100644 index 00000000000..8a3dc9dbb03 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-tex4ht.mkii @@ -0,0 +1,9 @@ +%D Preliminaty module + +\input tex4ht.sty + +\appendtoks + \Preamble{\env{ht-1},\env{ht-2},html}\EndPreamble +\to \everystarttext + +\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/m-tex4ht.tex b/Master/texmf-dist/tex/context/base/m-tex4ht.tex deleted file mode 100644 index 8a3dc9dbb03..00000000000 --- a/Master/texmf-dist/tex/context/base/m-tex4ht.tex +++ /dev/null @@ -1,9 +0,0 @@ -%D Preliminaty module - -\input tex4ht.sty - -\appendtoks - \Preamble{\env{ht-1},\env{ht-2},html}\EndPreamble -\to \everystarttext - -\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/m-timing.mkiv b/Master/texmf-dist/tex/context/base/m-timing.mkiv new file mode 100644 index 00000000000..a91891a1b2f --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-timing.mkiv @@ -0,0 +1,100 @@ +%D \module +%D [ file=m-timing, +%D version=2007.12.23, +%D title=\CONTEXT\ Modules, +%D subtitle=Timing, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=Hans Hagen] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\ifx\ShowNamedUsage\undefined \else \endinput \fi + +%D Written at the end of 2007, this module is dedicated to Taco. Reaching this +%D point in \LUATEX\ was a non trivial effort. By visualizing a bit what happens +%D when pages come out of \LUATEX, you may get an idea what is involved. It took +%D much time an dedication to reach this point in the development. Add to that +%D those daily Skype intense discussion, testing and debugging moments. Time flies +%D but progress is impressive. The motto of this module could be: what you see +%D is what you get. An there is much more to come \unknown. + +% \usemodule[timing] +% \setupcolors[state=start] +% \starttext +% \dorecurse{200}{\input tufte \par} \ShowUsage{} +% \stoptext + +\definecolor[usage:line] [darkred] +\definecolor[usage:time] [darkblue] +\definecolor[usage:frame][darkgray] + +\ctxloadluafile{trac-tim}{} + +\startluacode +local progress = moduledata.progress + +function progress.show(filename,parameters,nodes,other) + for n, name in pairs(parameters or progress.parameters(filename)) do + context.ShowNamedUsage(filename or progress.defaultfilename,name,other or "") + end + for n, name in pairs(nodes or progress.nodes(filename)) do + context.ShowNamedUsage(filename or progress.defaultfilename,name,other or "") + end +end +\stopluacode + +% \everyfirstshipout + +\startnotmode[no-timing] + \appendtoks\ctxlua{moduledata.progress.store()}\to\everystarttext + \appendtoks\ctxlua{moduledata.progress.store()}\to\everyshipout + \ctxlua{luatex.registerstopactions(function() moduledata.progress.save() end)} +\stopnotmode + +\def\ShowNamedUsage#1#2#3% + {\setbox\scratchbox\vbox\bgroup\startMPcode + begingroup ; save p, q, b, h, w ; + path p, q, b ; numeric h, w ; + p := \ctxlua{tex.sprint(moduledata.progress.path("#1","#2"))} ; +% p := p shifted -llcorner p ; + if bbwidth(p) > 1 : + h := 100 ; w := 2 * h ; + w := \the\textwidth-3pt ; % correct for pen + p := p xstretched w ; + b := boundingbox (llcorner p -- llcorner p shifted (w,h)) ; + pickup pencircle scaled 3pt ; linecap := butt ; + draw b withcolor \MPcolor{usage:frame} ; + draw p withcolor \MPcolor{usage:line} ; + if ("#3" <> "") and ("#3" <> "#2") : + q := \ctxlua{tex.sprint(moduledata.progress.path("#1","#3"))} ; +% q := q shifted -llcorner q ; + if bbwidth(q) > 1 : + q := q xstretched w ; + pickup pencircle scaled 1.5pt ; linecap := butt ; + draw q withcolor \MPcolor{usage:time} ; + fi ; + fi ; + fi ; + endgroup ; + \stopMPcode\egroup + \scratchdimen\wd\scratchbox + \ifdim\scratchdimen>\zeropoint + \startlinecorrection + \box\scratchbox \endgraf + \hbox to \scratchdimen{\tttf\strut\detokenize{#2}\hss + min:\ctxlua{tex.sprint(moduledata.progress.bot("#1","\detokenize{#2}"))}, % + max:\ctxlua{tex.sprint(moduledata.progress.top("#1","\detokenize{#2}"))}, % + pages:\ctxlua{tex.sprint(moduledata.progress.pages("#1"))}% + }% + \stoplinecorrection + \fi} + +\def\LoadUsage #1{\ctxlua{moduledata.progress.convert("#1")}} +\def\ShowUsage #1{\ctxlua{moduledata.progress.show("#1",nil,nil,"elapsed_time")}} +\def\ShowMemoryUsage#1{\ctxlua{moduledata.progress.show("#1",nil,{}, "elapsed_time")}} +\def\ShowNodeUsage #1{\ctxlua{moduledata.progress.show("#1",{},nil, "elapsed_time")}} + +\endinput diff --git a/Master/texmf-dist/tex/context/base/m-timing.tex b/Master/texmf-dist/tex/context/base/m-timing.tex deleted file mode 100644 index f02a900871b..00000000000 --- a/Master/texmf-dist/tex/context/base/m-timing.tex +++ /dev/null @@ -1,102 +0,0 @@ -%D \module -%D [ file=m-timing, -%D version=2007.12.23, -%D title=\CONTEXT\ Modules, -%D subtitle=Timing, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright=Hans Hagen] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\doifnotmode{mkiv}{\endinput} - -\ifx\ShowNamedUsage\undefined \else \endinput \fi - -%D Written at the end of 2007, this module is dedicated to Taco. Reaching this -%D point in \LUATEX\ was a non trivial effort. By visualizing a bit what happens -%D when pages come out of \LUATEX, you may get an idea what is involved. It took -%D much time an dedication to reach this point in the development. Add to that -%D those daily Skype intense discussion, testing and debugging moments. Time flies -%D but progress is impressive. The motto of this module could be: what you see -%D is what you get. An there is much more to come \unknown. - -% \usemodule[timing] -% \setupcolors[state=start] -% \starttext -% \dorecurse{200}{\input tufte \par} \ShowUsage{} -% \stoptext - -\definecolor[usage:line] [darkred] -\definecolor[usage:time] [darkblue] -\definecolor[usage:frame][darkgray] - -\ctxloadluafile{trac-tim}{} - -\startluacode -local progress = plugins.progress - -function progress.show(filename,parameters,nodes,other) - for n, name in pairs(parameters or progress.parameters(filename)) do - tex.sprint(tex.ctxcatcodes,string.format("\\ShowNamedUsage{%s}{%s}{%s}",filename or progress.defaultfilename,name,other or "")) - end - for n, name in pairs(nodes or progress.nodes(filename)) do - tex.sprint(tex.ctxcatcodes,string.format("\\ShowNamedUsage{%s}{%s}{%s}",filename or progress.defaultfilename,name,other or "")) - end -end -\stopluacode - -% \everyfirstshipout - -\startnotmode[no-timing] - \appendtoks\ctxlua{plugins.progress.store()}\to\everystarttext - \appendtoks\ctxlua{plugins.progress.store()}\to\everyshipout - \ctxlua{main.register_stop_actions(function() plugins.progress.save() end)} -\stopnotmode - -\def\ShowNamedUsage#1#2#3% - {\setbox\scratchbox\vbox\bgroup\startMPcode - begingroup ; save p, q, b, h, w ; - path p, q, b ; numeric h, w ; - p := \ctxlua{tex.sprint(plugins.progress.path("#1","#2"))} ; -% p := p shifted -llcorner p ; - if bbwidth(p) > 1 : - h := 100 ; w := 2 * h ; - w := \the\textwidth-3pt ; % correct for pen - p := p xstretched w ; - b := boundingbox (llcorner p -- llcorner p shifted (w,h)) ; - pickup pencircle scaled 3pt ; linecap := butt ; - draw b withcolor \MPcolor{usage:frame} ; - draw p withcolor \MPcolor{usage:line} ; - if ("#3" <> "") and ("#3" <> "#2") : - q := \ctxlua{tex.sprint(plugins.progress.path("#1","#3"))} ; -% q := q shifted -llcorner q ; - if bbwidth(q) > 1 : - q := q xstretched w ; - pickup pencircle scaled 1.5pt ; linecap := butt ; - draw q withcolor \MPcolor{usage:time} ; - fi ; - fi ; - fi ; - endgroup ; - \stopMPcode\egroup - \scratchdimen\wd\scratchbox - \ifdim\scratchdimen>\zeropoint - \startlinecorrection - \box\scratchbox \endgraf - \hbox to \scratchdimen{\tttf\strut\detokenize{#2}\hss - min:\ctxlua{tex.sprint(plugins.progress.bot("#1","\detokenize{#2}"))}, % - max:\ctxlua{tex.sprint(plugins.progress.top("#1","\detokenize{#2}"))}, % - pages:\ctxlua{tex.sprint(plugins.progress.pages("#1"))}% - }% - \stoplinecorrection - \fi} - -\def\LoadUsage #1{\ctxlua{plugins.progress.convert("#1")}} -\def\ShowUsage #1{\ctxlua{plugins.progress.show("#1",nil,nil,"elapsed_time")}} -\def\ShowMemoryUsage#1{\ctxlua{plugins.progress.show("#1",nil,{}, "elapsed_time")}} -\def\ShowNodeUsage #1{\ctxlua{plugins.progress.show("#1",{},nil, "elapsed_time")}} - -\endinput diff --git a/Master/texmf-dist/tex/context/base/m-trackers.mkiv b/Master/texmf-dist/tex/context/base/m-trackers.mkiv new file mode 100644 index 00000000000..95c34b16f65 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-trackers.mkiv @@ -0,0 +1,3 @@ +\starttext + \showtrackers +\stoptext diff --git a/Master/texmf-dist/tex/context/base/m-trackers.tex b/Master/texmf-dist/tex/context/base/m-trackers.tex deleted file mode 100644 index cfcbbabffbe..00000000000 --- a/Master/texmf-dist/tex/context/base/m-trackers.tex +++ /dev/null @@ -1,5 +0,0 @@ -\doifnotmode{mkiv} {\endinput} - -\starttext - \showtrackers -\stoptext diff --git a/Master/texmf-dist/tex/context/base/m-translate.mkiv b/Master/texmf-dist/tex/context/base/m-translate.mkiv new file mode 100644 index 00000000000..c0e4aad7240 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-translate.mkiv @@ -0,0 +1,96 @@ +%D \module +%D [ file=m-translate, +%D version=2008.10.09, +%D title=\CONTEXT\ Modules, +%D subtitle=Translations, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=Hans Hagen] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D We can make this module more clever (wildcards and such) but since +%D it's only a demo we stick to the simple case for now. After all, it's +%D better to fix your source. + +\startluacode + local translators = { } + + moduledata.translators = translators + + local compiled, list = nil, nil + + function translators.register(from,to) + local l = lpeg.P(from)/to + if not list then + list = l + else + list = list + l + end + compiled = nil + end + + function translators.translate(s) + if list then + if not compiled then + compiled = lpeg.Cs((list + lpeg.P(1))^0) + end + return compiled:match(s) + else + return s + end + end + + local textlineactions = resolvers.openers.helpers.textlineactions + + utilities.sequencers.appendaction(textlineactions,"after","moduledata.translators.translate") + + function translators.enable() + utilities.sequencers.enableaction(textlineactions,"moduledata.translators.translate") + end + + function translators.disable() + utilities.sequencers.disableaction(textlineactions,"moduledata.translators.translate") + end + + function translators.reset(s) + translators.enable() + list, compiled = nil, nil + end + + translators.disable() +\stopluacode + +\unprotect + +\def\translateinput{\dodoubleargument\dotranslateinput} + +\def\dotranslateinput[#1][#2]{\ctxlua{moduledata.translators.register(\!!bs#1\!!es,\!!bs#2\!!es)}} + +\def\resetinputtranslation {\ctxlua{moduledata.translators.reset()}} +\def\enableinputtranslation {\ctxlua{moduledata.translators.enable()}} +\def\disableinputtranslation{\ctxlua{moduledata.translators.disable()}} + +\def\readtranslatedfile#1% + {\enableinputtranslation + \readfile{#1}\donothing\donothing + \disableinputtranslation} + +\protect + +\doifnotmode{demo}{\endinput} + +\starttext + + \translateinput[Moica][Mojca] + \translateinput[Idris][Idris (aka ادريس)] + + \enableinputtranslation + + Well, it's not that hard to satisfy Idris and Moica. + + \readtranslatedfile{tufte} + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/m-translate.tex b/Master/texmf-dist/tex/context/base/m-translate.tex deleted file mode 100644 index 9c550eca705..00000000000 --- a/Master/texmf-dist/tex/context/base/m-translate.tex +++ /dev/null @@ -1,88 +0,0 @@ -%D \module -%D [ file=m-translate, -%D version=2008.10.09, -%D title=\CONTEXT\ Modules, -%D subtitle=Translations, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright=Hans Hagen] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\doifnotmode{mkiv}{\endinput} - -%D We can make this module more clever (wildcards and such) but since -%D it's only a demo we stick to the simple case for now. After all, it's -%D better to fix your source. - -\startluacode - translators = { } - - local compiled, list = nil, nil - - function translators.register(from,to) - local l = lpeg.P(from)/to - if not list then - list = l - else - list = list + l - end - compiled = nil - end - - function translators.translate(s) - if list then - if not compiled then - compiled = lpeg.Cs((list + lpeg.P(1))^0) - end - return compiled:match(s) - else - return s - end - end - - function translators.reset(s) - resolvers.install_text_filter("user",nil) - list, compiled = nil, nil - end - function translators.enable(s) - resolvers.install_text_filter("user",translators.translate) - end - function translators.disable(s) - resolvers.install_text_filter("user",nil) - end -\stopluacode - -\unprotect - -\def\translateinput{\dodoubleargument\dotranslateinput} - -\def\dotranslateinput[#1][#2]{\ctxlua{translators.register(\!!bs#1\!!es,\!!bs#2\!!es)}} - -\def\resetinputtranslation {\ctxlua{translators.reset()}} -\def\enableinputtranslation {\ctxlua{translators.enable()}} -\def\disableinputtranslation{\ctxlua{translators.disable()}} - -\def\readtranslatedfile#1% - {\enableinputtranslation - \readfile{#1}\donothing\donothing - \disableinputtranslation} - -\protect - -\doifnotmode{demo}{\endinput} - -\starttext - - \translateinput[Moica][Mojca] - \translateinput[Idris][Idris (aka ادريس)] - - \enableinputtranslation - - Well, it's not that hard to satisfy Idris and Moica. - - \readtranslatedfile{tufte} - -\stoptext diff --git a/Master/texmf-dist/tex/context/base/m-tryout.tex b/Master/texmf-dist/tex/context/base/m-tryout.tex deleted file mode 100644 index 4aa50376d42..00000000000 --- a/Master/texmf-dist/tex/context/base/m-tryout.tex +++ /dev/null @@ -1,55 +0,0 @@ -%D \module -%D [ file=m-tryout, -%D version=2002.05.10, -%D title=\CONTEXT\ Extra Modules, -%D subtitle=Tryout Features, -%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 - -\unprotect - -%D The following macros make sure that active colons work well -%D in French, a feature enabled with: -%D -%D \starttyping -%D \useencoding[ffr] \mainlanguage[fr] -%D \stoptyping -%D -%D This trick will disappear when proved robust. - -\startmode[activecolon] - -% this is now default - -\gdef\sectionseparator{-} - -\gdef\@@filterfirstpart [#1--#2]{#1} -\gdef\@@filtersecondpart [#1--#2]{#2} - -\gdef\@@filterblockpart [#1--#2--#3]{#1} -\gdef\@@filternumberpart [#1--#2--#3]{#2} -\gdef\@@filterpagepart [#1--#2--#3]{#3} -\gdef\@@filterblocknumberpart[#1--#2--#3]{#1--#2} - -\gdef\@@filterheadpart[#1]{\@EA\@@dofilterheadpart\@EA[#1-0]} -\gdef\@@filtertailpart[#1]{\@EA\@@dofiltertailpart\@EA[#1-0]} - -\gdef\@@dofilterheadpart[#1-#2]{#1} -\gdef\@@dofiltertailpart[#1-#2]{#2} - -\gdef\@@filterlevelpart[#1--#2--#3]{\@@dofilterlevelpart[#2-0-0-0-0]} - -\gdef\@@dofilterlevelpart[#1-0-0-0-#2]{#1} - -\reopenutilities - -\stopmode - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/m-units.mkii b/Master/texmf-dist/tex/context/base/m-units.mkii new file mode 100644 index 00000000000..6a899736bb5 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-units.mkii @@ -0,0 +1,904 @@ +%D \module +%D [ file=m-units, +%D version=1997.03.19, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=Scientific Units, +%D author={Hans Hagen \& Ton Otten}, +%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 Scientific units can be typeset in math mode pretty well, +%D but occasionally one has to take care of spacing. +%D Furthermore, entering these units is not that natural as +%D wanted. Therefore this module presents a more natural way of +%D doing things, like: +%D +%D \starttyping +%D 1.23 \Cubic \Meter \Per \Second +%D \stoptyping +%D +%D This example shows that we use the order in which we say +%D things, instead of typeset things. There is a separate +%D manual for this module. + +%D Message number~1 deals with overruling the \type {\Degrees} +%D macro defined in the core modules. Let's say that this is +%D an upward compatibility issue. + +\startmessages dutch library: units + title: eenheden + 1: gebruik \string\Degrees\space\string\Celsius\space in plaats van \string\Celsius ! +\stopmessages + +\startmessages english library: units + title: units + 1: use \string\Degrees\space\string\Celsius\space instead of \string\Celsius ! +\stopmessages + +\startmessages german library: units + title: Einheiten + 1: Verwende \string\Degrees\space\string\Celsius\space statt \string\Celsius ! +\stopmessages + +\startmessages italian library: units + title: unita + 1: usare \string\Degrees\space\string\Celsius\space invece di \string\Celsius ! +\stopmessages + +\startmessages norwegian library: units + title: enheter + 1: bruk \string\Degrees\space\string\Celsius\space istedenfor \string\Celsius ! +\stopmessages + +\startmessages romanian library: units + title: unitati + 1: folositi \string\Degrees\space\string\Celsius\space in locul \string\Celsius ! +\stopmessages + +\startmessages french library: units + title: unitas + 1: utilisez \string\Degrees\space\string\Celsius\space A la place de \string\Celsius ! +\stopmessages + +\unprotect + +%D This runtime loadable module implements a way of defining +%D units. The core macro is \type {\dimension}, a rather clever +%D one that is able to cooperate with some other dimension +%D related macros. As said, this module enables user to enter: +%D +%D \startbuffer +%D some 10 \Square \Meter \Per \Second or more +%D \stopbuffer +%D +%D \getbuffer +%D +%D as: +%D +%D \typebuffer +%D +%D The units itself are implemented as synonyms. +%D +%D \starttyping +%D \definesynonyms [unit] [units] [\unitmeaning] +%D \setupsynonyms [unit] [textstyle=\dimension] +%D \stoptyping +%D +%D This definition means that we can ask for the meaning of a +%D unit using \type {\unitmeaning} and get a list of used +%D units by saying \type {\placelistofunits} +%D +%D We have to use the command \type {\unitmeaning} instead +%D of \type {\meaning}, simply because the latter is a \TEX\ +%D primitive we don't want to loose. We use the label text +%D mechanism for translations. + +%D \macros +%D {dimension} +%D +%D The core of this module is the low level macro \type +%D {\dimension}. Before presenting this macro, it's best to +%D look at some applications, because it's supposed to show +%D some intelligence that can beter be understood from the +%D context. +%D +%D The next useless examples show some of the cases we want +%D to handle in a proper way. +%D +%D \startbuffer +%D ... 10 \Square \Meter \Per \Volt \ +%D ... 10 \Square \Meter \Volt \ +%D ... 10 \Meter \Volt \ +%D ... 10 \Milli \Square \Meter \Per \Volt \ +%D ... 10 \Square \Milli \Meter \Per \Volt \ +%D ... 10 \Meter \Times \Meter \ +%D ... 10 \Square \Meter \Times \Meter \ +%D ... 10 \Square \Milli \Meter \Times \Meter \ +%D \stopbuffer +%D +%D \typebuffer +%D +%D Becomes: +%D +%D \getbuffer + +%D \macros +%D {mathematicstypeface, dimensiontypeface, +%D dimensionhalfspace, dimensionbackspace} +%D +%D There are some low level constants, that can be changed +%D when needed. Some day I will write a decent setup command. + +\def\mathematicstypeface{\rm} +\def\dimensiontypeface {\tf} + +\def\dimensionhalfspace {\ifmmode\,\else\hskip+.1em\relax\fi} +\def\dimensionbackspace {\ifmmode\!\else\hskip-.1em\relax\fi} + +%D \macros +%D {smashdimensionpower} +%D +%D Sometimes the baseline distance is not enough to provide +%D for superscripts, so we smash their height by default. + +\newif\ifsmashdimensionpower \smashdimensionpowertrue + +%D The dimension mechanism uses a lot of signals to keep +%D track if the current state. + +\newsignal\dimensionsignal +\newsignal\dimensionpowersignal +\newsignal\dimensionmidfixsignal +\newsignal\dimensionaddfixsignal + +\let\thedimensionprefix = \empty +\let\thedimensionpower = \empty + +%D \macros +%D {spaceddimensions,textdimensions} +%D +%D The actual definition of \type {\dimension} overruled the +%D one in the core modules. The boolean can be used to +%D force spacing between units. Vergelijk {\Newton \Meter} +%D eens met {\spaceddimensionstrue \Newton \Meter}. The +%D rather ugly test prevents problems with nested dimensions. + +\newif\ifspaceddimensions \spaceddimensionsfalse % user switch +\newif\iftextdimensions \textdimensionsfalse % user switch + +%D You can see the consequence of forcing text dimensions +%D when you compare the following code: +%D +%D \starttyping +%D {\rm test \Square \Meter \Per \Second\ ziezo\Degrees} \par +%D {\ss test \Square \Meter \Per \Second\ ziezo} \par +%D {\tt test \Square \Meter \Per \Second\ ziezo} +%D +%D \textdimensionstrue +%D +%D {\rm test \Square \Meter \Per \Second\ ziezo} \par +%D {\ss test \Square \Meter \Per \Second\ ziezo} \par +%D {\tt test \Square \Meter \Per \Second\ ziezo} +%D \stoptyping + +\newif\ifnesteddimension \nesteddimensionfalse % local switch + +\def\dodimensionpower#1% + {\iftextdimensions\expandafter\high\else\expandafter^\fi{#1}} + +\def\ustartmathmode {\iftextdimensions\else\expandafter\startmathmode \fi} +\def\ustopmathmode {\iftextdimensions\else\expandafter\stopmathmode \fi} +\def\umathematicstypeface{\iftextdimensions\else\expandafter\mathematicstypeface\fi} + +%D In forced text mode, we ignore spacing in monospaced fonts. + +\def\udimensionhalfspace {\dodimensionspace\dimensionhalfspace} +\def\udimensionbackspace {\dodimensionspace\dimensionbackspace} + +\def\dodimensionspace + {\iftextdimensions + \begingroup + \setbox0\hbox{i}% + \setbox2\hbox{m}% + \ifdim\wd0=\wd2 + \endgroup + \@EAEAEA\gobbleoneargument + \else + \endgroup + \fi + \fi} + +\unexpanded\def\dimension#1% + {\begingroup + \global\let\savedthedimensionprefix\thedimensionprefix + \global\let\savedthedimensionpower\thedimensionpower + \unexpanded\def\dimension##1{\global\nesteddimensiontrue}% + \let\dimensionprefix\dimension + \let\dimensionmidfix\dimension + \let\dimensionsuffix\dimension + \let\dimensionpower \dimension + \global\nesteddimensionfalse + \setbox\scratchbox\hbox{\ustartmathmode#1\ustopmathmode}% pre-roll + \global\let\thedimensionprefix\savedthedimensionprefix + \global\let\thedimensionpower \savedthedimensionpower + \endgroup + \ifnesteddimension#1\else\dodimension{#1}\fi} + +\def\dodimension#1% + {\dontbreakdimension + \ifdim\scratchdimen=\zeropoint\relax + \ifmmode + \udimensionhalfspace + \udimensionhalfspace + \fi + \ustartmathmode\dimensiontypeface + \else + \ustartmathmode\dimensiontypeface + \ifspaceddimensions + \ifdim\scratchdimen=\dimensionsignal\relax + \udimensionhalfspace + \else\ifdim\scratchdimen=\dimensionpowersignal\relax + \udimensionhalfspace + \fi + \fi + \fi + \fi + \umathematicstypeface\thedimensionprefix#1% + \ifx\thedimensionpower\empty + \else\ifsmashdimensionpower + \setbox\scratchbox=\hbox + {\iftextdimensions + \tx\thedimensionpower + \else + $\scriptstyle\thedimensionpower$% + \fi}% + \ht\scratchbox=\zeropoint + \dodimensionpower{\box\scratchbox}% + \else + \dodimensionpower{\thedimensionpower}% + \fi\fi + \ustopmathmode + % otherwise nobreak before space in 2 \Milli \Meter\ blabla + \doifnotmode{atpragma}{\nobreak}% this was always \nobreak + % only test this at pragma + \ifx\thedimensionpower\empty + \hskip\dimensionsignal + \else + \hskip\dimensionpowersignal + \fi + \global\let\thedimensionprefix\empty + \global\let\thedimensionpower\empty} + +%D \macros +%D {dontbreakdimension, +%D dimensionprefix, dimensionaddfix, +%D dimensionnopfix, dimensionmidfix, +%D dimensionpower} +%D +%D Here are some auxilliary macros. + +\def\dontbreakdimension + {\scratchdimen\lastskip + \unskip + \nobreak + \hskip\scratchdimen + \nobreak} + +\def\dimensionprefix#1% + {\gdef\thedimensionprefix{#1}} + +\def\dimensionaddfix#1% + {\unskip + %\mathematics{\umathematicstypeface#1}% + \ustartmathmode\umathematicstypeface#1\ustopmathmode + \nobreak + \hskip\dimensionaddfixsignal} + +\def\dimensionnopfix#1% + {\dontbreakdimension + \ifdim\scratchdimen=\dimensionpowersignal\relax + \ustartmathmode + \else + \ustartmathmode + \udimensionhalfspace + \nobreak + \fi + \umathematicstypeface#1% + \ustopmathmode + \nobreak + \hskip\dimensionsignal} + +\def\dimensionmidfix#1% + {\dontbreakdimension + \ifdim\scratchdimen=\dimensionpowersignal\relax + \ustartmathmode + \udimensionbackspace + \nobreak + \else + \ustartmathmode + \fi + \umathematicstypeface#1% + \ustopmathmode + \nobreak + \hskip\dimensionmidfixsignal} + +\def\dimensionpower#1% + {\gdef\thedimensionpower{#1}} + +%D \macros +%D {SIunits, noSI, doSI} +%D +%D Some low level unit switching macros: + +\newif\ifSIunits \SIunitstrue + +\def\noSI#1{\begingroup\SIunitsfalse#1\endgroup} +\def\doSI#1{\begingroup\SIunitstrue #1\endgroup} + +%D \macros +%D {Degrees} +%D +%D We can fake the degrees symbol with: + +\def\Degrees{\dimensionaddfix{\mathematics{^\circ}}} + +%D \macros +%D {Unit, NoUnit} +%D +%D When a dimension has no leading number, we can use \type +%D {\Unit}, and when no unit is appended, \type {\NoUnit} is +%D to be used, just to prevent the prefix migrating to the +%D next occasion. + +\def\Unit {\hskip\dimensionsignal} +\def\NoUnit {\dimension{}} + +%D The mechanism described at the top of this module, depends +%D on several dimensional components, like prefixes: + +\def\Atto {\dimensionprefix{a}} +\def\Femto {\dimensionprefix{f}} +\def\Pico {\dimensionprefix{p}} +\def\Nano {\dimensionprefix{n}} +\def\Micro {\dimensionprefix{\iftextdimensions u\else\mu\fi}} +\def\Milli {\dimensionprefix{m}} +\def\Centi {\dimensionprefix{c}} +\def\Deci {\dimensionprefix{d}} % 10^01 +\def\Hecto {\dimensionprefix{h}} % 10^02 +\def\Kilo {\dimensionprefix{k}} % 10^03 +\def\Mega {\dimensionprefix{M}} % 10^06 +\def\Giga {\dimensionprefix{G}} % 10^09 +\def\Tera {\dimensionprefix{T}} % 10^12 +\def\Peta {\dimensionprefix{P}} % 10^15 +\def\Exa {\dimensionprefix{E}} % 10^18 + +%def\Terra {\dimensionprefix{T}} % for old times sake + +\def\Kibi {\dimensionprefix{ki}} % 2^10 +\def\Mebi {\dimensionprefix{Mi}} % 2^20 +\def\Gibi {\dimensionprefix{Gi}} % 2^30 +\def\Tebi {\dimensionprefix{Ti}} % 2^40 +\def\Pebi {\dimensionprefix{Pi}} % 2^50 + +%D and binary prefixes: + +\def\Kibi {\dimensionprefix{Ki}} +\def\Mebi {\dimensionprefix{Mi}} +\def\Gibi {\dimensionprefix{Gi}} +\def\Tebi {\dimensionprefix{Ti}} +\def\Pebi {\dimensionprefix{Pi}} +\def\Exbi {\dimensionprefix{Ei}} +\def\Zebi {\dimensionprefix{Zi}} +\def\Yobi {\dimensionprefix{Yi}} + +%D and operators: + +\def\Times {\dimensionnopfix{\iftextdimensions.\else\cdot\fi}} +\def\Solidus {\dimensionmidfix{/}} +\def\Per {\dimensionmidfix{/}} +\def\OutOf {\dimensionnopfix{:}} + +%D and suffixes: + +\def\Linear {\dimensionpower{1}} +\def\Square {\dimensionpower{2}} +\def\Cubic {\dimensionpower{3}} + +\def\Inverse {\dimensionpower{-1}} +\def\ILinear {\dimensionpower{-1}} +\def\ISquare {\dimensionpower{-2}} +\def\ICubic {\dimensionpower{-3}} + +%D Apart from these components, the units themselves are +%D defined using the synonym mechanism. First we define some +%D length and volume related units. + +\getvalue{\v!unit} [Meter] {m} {meter} +\getvalue{\v!unit} [pMeter] {\Pico \Meter} {picometer} +\getvalue{\v!unit} [nMeter] {\Nano \Meter} {nanometer} +\getvalue{\v!unit} [uMeter] {\Micro \Meter} {micrometer} +\getvalue{\v!unit} [mMeter] {\Milli \Meter} {millimeter} +\getvalue{\v!unit} [cMeter] {\Centi \Meter} {centimeter} +\getvalue{\v!unit} [dMeter] {\Deci \Meter} {decimeter} +\getvalue{\v!unit} [hMeter] {\Hecto \Meter} {hectometer} +\getvalue{\v!unit} [kMeter] {\Kilo \Meter} {kilometer} + +%D After some discussion on the \CONTEXT\ mailing list in +%D february 2002 it was decided to go from L to l for liters +%D (Karel Wesselings alternative: \mathematics{\ell}). + +\getvalue{\v!unit} [Liter] {l} {liter} +\getvalue{\v!unit} [mLiter] {\Milli \Liter} {milliliter} +\getvalue{\v!unit} [cLiter] {\Centi \Liter} {centiliter} +\getvalue{\v!unit} [dLiter] {\Deci \Liter} {deciliter} + +%D Next we define time related units (\type {\ifSI} still dutch only). + +\getvalue{\v!unit} [Sec] {s} {\labeltext{u:sec}} +\getvalue{\v!unit} [fSec] {\Femto \Sec} {\labeltext{u:fsec}} +\getvalue{\v!unit} [pSec] {\Pico \Sec} {\labeltext{u:psec}} +\getvalue{\v!unit} [nSec] {\Nano \Sec} {\labeltext{u:nsec}} +\getvalue{\v!unit} [uSec] {\Micro \Sec} {\labeltext{u:usec}} +\getvalue{\v!unit} [mSec] {\Milli \Sec} {\labeltext{u:msec}} +\getvalue{\v!unit} [Year] {\ifSIunits a \else j\fi} {\labeltext{u:year}} +\getvalue{\v!unit} [Month] {m} {\labeltext{u:month}} +\getvalue{\v!unit} [Week] {w} {\labeltext{u:week}} +\getvalue{\v!unit} [Day] {d} {\labeltext{u:day}} +\getvalue{\v!unit} [Hour] {\ifSIunits h \else u\fi} {\labeltext{u:hour}} +\getvalue{\v!unit} [Min] {min} {\labeltext{u:min}} + +\setuplabeltext + [\s!nl] + [u:sec=seconde, + u:psec=picoseconde, + u:fsec=femtoseconde, + u:nsec=nanoseconde, + u:usec=microseconde, + u:msec=milliseconde, + u:year=jaar, + u:month=maand, + u:week=week, + u:day=dag, + u:hour=uur, + u:min=minuten] + +\setuplabeltext + [\s!en] + [u:sec=second, + u:fsec=femtosecond, + u:psec=picosecond, + u:nsec=nanosecond, + u:usec=microsecond, + u:msec=millisecond, + u:year=year, + u:month=month, + u:week=week, + u:day=day, + u:hour=hour, + u:min=minutes] + +\setuplabeltext + [\s!de] + [u:sec=Sekunde, + u:fsec=Femtosekunde, + u:psec=Picosekunde, + u:nsec=Nanosekunde, + u:usec=Microsekunde, + u:msec=Millisekunde, + u:year=Jahr, + u:month=Monat, + u:week=Woche, + u:day=Tag, + u:hour=Stunde, + u:min=Minuten] + +\setuplabeltext + [\s!hr] + [u:sec=sekunda, + u:fsec=femtosekunda, + u:psec=pikosekunda, + u:nsec=nanosekunda, + u:usec=mikrosekunda, + u:msec=milisekunda, + u:year=godina, + u:month=mjesec, + u:week=tjedan, + u:day=dan, + u:hour=sat, + u:min=minuta] + +\setuplabeltext + [\s!it] + [u:sec=secondo, + u:fsec=femtosecondo, + u:psec=picosecondo, + u:nsec=nanosecondo, + u:usec=microsecondo, + u:msec=millisecondo, + u:year=anno, + u:month=mese, + u:week=settimana, + u:day=giorno, + u:hour=ora, + u:min=minuti] + +%D Then we define some angles. + +\getvalue{\v!unit} [Rad] {rad} {\labeltext{u:rad}} +\getvalue{\v!unit} [Deg] {{\mathematics{^\circ}}} {\labeltext{u:deg}} + +\setuplabeltext + [\s!nl] + [u:rad=hoek radialen, + u:deg=hoek graden] + +\setuplabeltext + [\s!en] + [u:rad=angle radians, + u:deg=angle degrees] + +\setuplabeltext + [\s!de] + [u:rad=Bogenma\SS, + u:deg=Gradma\SS] + +\setuplabeltext + [\s!hr] + [u:rad=radijani, + u:deg=kutni stupnjevi] + +\setuplabeltext + [\s!it] + [u:rad=radianti, + u:deg=angoli sessagesimali] + +%D Rotation and frequency related units are defined by: + +\getvalue{\v!unit} [Hertz] {Hz} {Hertz} +\getvalue{\v!unit} [kHertz] {\Kilo \Hertz} {kilo Hertz} +\getvalue{\v!unit} [MHertz] {\Mega \Hertz} {mega Hertz} +\getvalue{\v!unit} [GHertz] {\Giga \Hertz} {giga Hertz} +\getvalue{\v!unit} [THertz] {\Tera \Hertz} {tera Hertz} +\getvalue{\v!unit} [mHertz] {\Milli \Hertz} {milli Hertz} + +\getvalue{\v!unit} [RevPerSec] {RPS} {\labeltext{u:rps}} +\getvalue{\v!unit} [RevPerMin] {RPM} {\labeltext{u:rpm}} + +\setuplabeltext + [\s!nl] + [u:rps=omwentelingen per seconde, + u:rpm=omwentelingen per minuut] + +\setuplabeltext + [\s!en] + [u:rps=revolutions per second, + u:rpm=revolutions per minute] + +\setuplabeltext + [\s!de] + [u:rps=Umdrehungen pro Sekunde, + u:rpm=Umdrehungen pro Minute] + +\setuplabeltext + [\s!hr] + [u:rps=okretaji po sekundi, + u:rpm=okretaji po minuti] + +\setuplabeltext + [\s!it] + [u:rps=giri al secondo, + u:rpm=giri al minuto] + +%D Mass and force: + +\getvalue{\v!unit} [Gram] {g} {gram} +\getvalue{\v!unit} [uGram] {\Micro \Gram} {microgram} +\getvalue{\v!unit} [mGram] {\Milli \Gram} {milligram} +\getvalue{\v!unit} [kGram] {\Kilo \Gram} {kilogram} +\getvalue{\v!unit} [Atom] {u} {\labeltext{u:u}} + +\getvalue{\v!unit} [Newton] {N} {Newton} +\getvalue{\v!unit} [kNewton] {\Kilo \Newton} {kilo Newton} + +\getvalue{\v!unit} [Pascal] {Pa} {Pascal} +\getvalue{\v!unit} [mPascal] {\Milli \Pascal} {milli Pascal} +\getvalue{\v!unit} [kPascal] {\Kilo \Pascal} {kilo Pascal} + +\setuplabeltext + [\s!nl] + [u:u=atomaire massa eenheid] + +\setuplabeltext + [\s!en] + [u:u=atom mass unit] + +\setuplabeltext + [\s!de] + [u:u=Atomare Masseneinheit] + +\setuplabeltext + [\s!hr] + [u:u=unificirana atomska jedinica mase] + +\setuplabeltext + [\s!it] + [u:u=unit\`a di massa atomica] + +%D Energy units comes in two alternatives: + +\getvalue{\v!unit} [Joule] {J} {Joule} +\getvalue{\v!unit} [mJoule] {\Milli \Joule} {milli Joule} +\getvalue{\v!unit} [kJoule] {\Kilo \Joule} {kilo Joule} +\getvalue{\v!unit} [MJoule] {\Mega \Joule} {mega Joule} +\getvalue{\v!unit} [GJoule] {\Giga \Joule} {giga Joule} + +\getvalue{\v!unit} [Watt] {W} {Watt} +\getvalue{\v!unit} [mWatt] {\Milli \Watt} {milli Watt} +\getvalue{\v!unit} [kWatt] {\Kilo \Watt} {kilo Watt} +\getvalue{\v!unit} [MWatt] {\Mega \Watt} {mega Watt} +\getvalue{\v!unit} [GWatt] {\Giga \Watt} {giga Watt} +\getvalue{\v!unit} [TWatt] {\Tera \Watt} {tera Watt} + +%D Although Celsius is no longer permitted, we define it by +%D saying: + +\getvalue{\v!unit} [Celsius] {C} {Celsius} +\getvalue{\v!unit} [Kelvin] {K} {Kelvin} +\getvalue{\v!unit} [Fahrenheit] {F} {Fahrenheit} + +%D Some chemic related units are: + +\getvalue{\v!unit} [Mol] {mol} {mol} +\getvalue{\v!unit} [mMol] {\Milli \Mol} {millimol} +\getvalue{\v!unit} [kMol] {\Kilo \Mol} {kilomol} +\getvalue{\v!unit} [Molair] {M} {molair (\Mol \Per \Liter)} +\getvalue{\v!unit} [Equivalent] {eq} {equivalent} +\getvalue{\v!unit} [mEquivalent] {\Milli \Equivalent} {milli equivalent} + +%D There are quite a lot units related to electricity and +%D magnetism: + +\getvalue{\v!unit} [Farad] {F} {Farad} +\getvalue{\v!unit} [pFarad] {\Pico \Farad} {pico Farad} +\getvalue{\v!unit} [nFarad] {\Nano \Farad} {nano Farad} +\getvalue{\v!unit} [uFarad] {\Micro \Farad} {micro Farad} +\getvalue{\v!unit} [mFarad] {\Milli \Farad} {milli Farad} + +\getvalue{\v!unit} [Ohm] {\Omega} {Ohm} +\getvalue{\v!unit} [kOhm] {\Kilo \Ohm} {kilo Ohm} + +\getvalue{\v!unit} [Siemens] {S} {Siemens} + +\getvalue{\v!unit} [Ampere] {A} {Amp\`ere} +\getvalue{\v!unit} [mAmpere] {\Milli \Ampere} {milli Amp\`ere} + +\getvalue{\v!unit} [Coulomb] {C} {Coulomb} + +\getvalue{\v!unit} [Volt] {V} {Volt} +\getvalue{\v!unit} [mVolt] {\Milli \Volt} {milli Volt} +\getvalue{\v!unit} [kVolt] {\Kilo \Volt} {kilo Volt} +\getvalue{\v!unit} [eVolt] {eV} {electronvolt} +\getvalue{\v!unit} [keVolt] {\Kilo \eVolt} {kilo electronvolt} +\getvalue{\v!unit} [MeVolt] {\Mega \eVolt} {mega electronvolt} + +\getvalue{\v!unit} [Tesla] {T} {Tesla} + +\getvalue{\v!unit} [VoltAC] {V_{\xbox{ac}}} {\labeltext{u:vac}} +\getvalue{\v!unit} [VoltDC] {V_{\xbox{dc}}} {\labeltext{u:vdc}} + +\setuplabeltext + [\s!nl] + [u:vac=wisselspanning, + u:vdc=gelijkspanning] + +\setuplabeltext + [\s!en] + [u:vac=alternating current, + u:vdc=direct current] + +\setuplabeltext + [\s!de] + [u:vac=Wechselspannung, + u:vdc=Gleichspannung] + +\setuplabeltext + [\s!hr] + [u:vac=izmjeni\ccaron ni napon, + u:vdc=istosmjerni napon] + +\setuplabeltext + [\s!it] + [u:vac=corrente alternata, + u:vdc=corrente continua] + +%D Network bandwidth is specified in Bits: + +\getvalue{\v!unit} [Bit] {bit} {\labeltext{u:bit}} +\getvalue{\v!unit} [Baud] {Bd} {Baud (Bit/s)} + +%D Computer memory size is specified in Bytes: + +\getvalue{\v!unit} [Byte] {B} {\labeltext{u:byte}} +\getvalue{\v!unit} [kByte] {\Kilo \Byte} {kilo Byte} +\getvalue{\v!unit} [MByte] {\Mega \Byte} {mega Byte} +\getvalue{\v!unit} [GByte] {\Giga \Byte} {giga Byte} +\getvalue{\v!unit} [TByte] {\Tera \Byte} {tera Byte} + +\setuplabeltext + [\s!en] + [u:bit=Bit, + u:byte=Byte] + +\setuplabeltext + [\s!hr] + [u:bit=bit, + u:byte=bajt] + +%D Telecommunication call density is specified in Erlangs: + +\getvalue{\v!unit} [Erlang] {E} {Erlang} + +%D Some radiation related units: + +\getvalue{\v!unit} [Bequerel] {Bq} {Bequerel} +\getvalue{\v!unit} [MBequerel] {\Mega \Bequerel} {Bequerel} +\getvalue{\v!unit} [Sievert] {Sv} {Sievert} +\getvalue{\v!unit} [mSievert] {\Milli \Sievert} {milli Sievert} + +%D Light: + +\getvalue{\v!unit} [Candela] {cd} {Candela} + +%D and some sound ones: + +\getvalue{\v!unit} [Bell] {B} {Bell} +\getvalue{\v!unit} [dBell] {\Deci \Bell} {decibel} + +%D We also define some non||regular, sometimes even forbidden, +%D units: + +\getvalue{\v!unit} [At] {at} {\labeltext{u:at}} +\getvalue{\v!unit} [Atm] {atm} {\labeltext{u:atm}} +\getvalue{\v!unit} [Bar] {bar} {bar (100 \Kilo \Pascal)} +\getvalue{\v!unit} [EVolt] {eV} {electronvolt} +\getvalue{\v!unit} [Foot] {ft} {\labeltext{u:ft}} +\getvalue{\v!unit} [Inch] {inch} {\labeltext{u:inch}} +\getvalue{\v!unit} [Cal] {cal} {\labeltext{u:cal}} +\getvalue{\v!unit} [Force] {f} {\labeltext{u:f}} +\getvalue{\v!unit} [kCal] {\Kilo \Cal} {\labeltext{u:kcal}} +\getvalue{\v!unit} [Lux] {lux} {lux} + + +\def\xPercent {\dimensionaddfix{\percent }} +\def\xPromille{\dimensionaddfix{\promille}} + +\getvalue{\v!unit} [Percent] {\xPercent } {percent} +\getvalue{\v!unit} [Permille] {\xPromille} {promille} +\getvalue{\v!unit} [Promille] {\xPromille} {promille} + +%D Some more, thanks to Tobias: + +\getvalue{\v!unit} [Gray] {Gr} {Gray} +\getvalue{\v!unit} [Weber] {Wb} {Weber} +\getvalue{\v!unit} [Henry] {H} {Henry} +\getvalue{\v!unit} [Sterant] {sr} {Sterant} +\getvalue{\v!unit} [Angstrom] {\hbox{\Aring}} {\Aring ngstr\"om} +\getvalue{\v!unit} [Gauss] {G} {Gauss} + +\setuplabeltext + [\s!nl] + [u:at=technische atmosfeer, + u:atm=fysische atmosfeer, + u:ft=voet, + u:cal=calorie, + u:f=kracht (force), + u:kcal=kilocalorie] + +\setuplabeltext + [\s!en] + [u:at=technical atmospheric pressure, + u:atm=physical atmospheric pressure, + u:ft=foot, + u:inch=inch, + u:cal=calory, + u:f=force, + u:kcal=kilocalory] + +\setuplabeltext + [\s!de] + [u:at=Technischer atmosph\"arischer Druck, + u:atm=physkalischer atmosph\"arischer Druck, + u:ft=Fu\SS, + u:cal=Kalorien, + u:f=Force, + u:kcal=Kilokalorien] + +\setuplabeltext + [\s!hr] + [u:at=tehni\ccaron ka atmosfera, + u:atm=standardna atmosfera, + u:ft=stopa, + u:inch=in\ccaron a, + u:cal=kalorija, + u:f=Force, + u:kcal=Kilokalorien] + +\setuplabeltext + [\s!it] + [u:at=pressione atmosferica tecnica, + u:atm=pressione atmosfera fisica, + u:ft=piede, + u:cal=caloria, + u:f=forza, + u:kcal=chilocaloria] + +%D Here are some old ones, still there for compatibility +%D reasons. These will probably be obsolete in a few years. + +\def\MeterTwee {\Square \Meter} +\def\mMeterTwee {\Square \Milli \Meter} +\def\cMeterTwee {\Square \Centi \Meter} +\def\dMeterTwee {\Square \Deci \Meter} +\def\kMeterTwee {\Square \Kilo \Meter} + +\def\MeterDrie {\Cubic \Meter} +\def\mMeterDrie {\Cubic \Milli \Meter} +\def\cMeterDrie {\Kubic \Centi \Meter} +\def\dMeterDrie {\Cubic \Deci \Meter} +\def\kMeterDrie {\Cubic \Kilo \Meter} + +\def\LiterTwee {\Square \Liter} +\def\SecTwee {\Square \Sec} +\def\SecMinEen {\Inverse \Sec} + +%D To make ourselves happy, we define some dutch specific +%D units: + +\startinterface dutch + + \getvalue{\v!unit} [PaardenKracht] {pk} {paardenkracht} + \getvalue{\v!unit} [Duits] {D} {duits} + \getvalue{\v!unit} [Kwik] {Hg} {kwikkolom} + \getvalue{\v!unit} [Hectare] {ha} {hectare} + \getvalue{\v!unit} [kGramForce] {\Kilo \Gram \Force} {kilogramforce} + \getvalue{\v!unit} [kWattUur] {\Kilo \Watt \Uur} {kilowattuur} + \getvalue{\v!unit} [MeterKwik] {\Meter \Kwik} {meter kwikkolom} + \getvalue{\v!unit} [Waterkolom] {WK} {waterkolom} + \getvalue{\v!unit} [MeterWater] {\Meter \Waterkolom} {meter waterkolom} + \getvalue{\v!unit} [DrogeStof] {ds} {droge stof} + \getvalue{\v!unit} [Normaal] {N} {normaal} + + \getvalue{\v!unit} [Ton] {t} {ton} + \getvalue{\v!unit} [kTon] {\Kilo \Ton} {kiloton} + + \let \OmwPerSec \RevPerSec + \let \OmwPerMin \RevPerMin + \let \Graden \Deg + \let \PaardeKracht \PaardenKracht + \let \Atoom \Atom + \let \Heure \Hour + \let \Jaar \Year + \let \Maand \Month + \let \Dag \Day + \let \Uur \Hour + +\stopinterface + +%D Finally we define some equivalents. By using \type {\let} +%D we can be sure that they don't end up double in the lists of +%D units. + +\let \Second \Sec +\let \Kubic \Cubic +\let \IKubic \ICubic + +%D Option: + +% \def\Micro{\dimensionprefix{\iftextdimensions\mathematics\mu \else\mu \fi}} +% \def\Times{\dimensionnopfix{\iftextdimensions\mathematics\cdot\else\cdot\fi}} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/m-units.mkiv b/Master/texmf-dist/tex/context/base/m-units.mkiv new file mode 100644 index 00000000000..a7653c56677 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-units.mkiv @@ -0,0 +1,912 @@ +%D \module +%D [ file=m-units, +%D version=1997.03.19, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=Scientific Units, +%D author={Hans Hagen \& Ton Otten}, +%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 Scientific units can be typeset in math mode pretty well, +%D but occasionally one has to take care of spacing. +%D Furthermore, entering these units is not that natural as +%D wanted. Therefore this module presents a more natural way of +%D doing things, like: +%D +%D \starttyping +%D 1.23 \Cubic \Meter \Per \Second +%D \stoptyping +%D +%D This example shows that we use the order in which we say +%D things, instead of typeset things. There is a separate +%D manual for this module. + +%D Message number~1 deals with overruling the \type {\Degrees} +%D macro defined in the core modules. Let's say that this is +%D an upward compatibility issue. + +% \registerctxluafile{x-units}{} + +\startmessages dutch library: units + title: eenheden + 1: gebruik \string\Degrees\space\string\Celsius\space in plaats van \string\Celsius ! +\stopmessages + +\startmessages english library: units + title: units + 1: use \string\Degrees\space\string\Celsius\space instead of \string\Celsius ! +\stopmessages + +\startmessages german library: units + title: Einheiten + 1: Verwende \string\Degrees\space\string\Celsius\space statt \string\Celsius ! +\stopmessages + +\startmessages italian library: units + title: unita + 1: usare \string\Degrees\space\string\Celsius\space invece di \string\Celsius ! +\stopmessages + +\startmessages norwegian library: units + title: enheter + 1: bruk \string\Degrees\space\string\Celsius\space istedenfor \string\Celsius ! +\stopmessages + +\startmessages romanian library: units + title: unitati + 1: folositi \string\Degrees\space\string\Celsius\space in locul \string\Celsius ! +\stopmessages + +\startmessages french library: units + title: unitas + 1: utilisez \string\Degrees\space\string\Celsius\space A la place de \string\Celsius ! +\stopmessages + +\registerctxluafile{x-mathml}{} + +\unprotect + +\startmodule[units] + +%D This runtime loadable module implements a way of defining +%D units. The core macro is \type {\dimension}, a rather clever +%D one that is able to cooperate with some other dimension +%D related macros. As said, this module enables user to enter: +%D +%D \startbuffer +%D some 10 \Square \Meter \Per \Second or more +%D \stopbuffer +%D +%D \getbuffer +%D +%D as: +%D +%D \typebuffer +%D +%D The units itself are implemented as synonyms. +%D +%D \starttyping +%D \definesynonyms [unit] [units] [\unitmeaning] +%D \setupsynonyms [unit] [textstyle=\dimension] +%D \stoptyping +%D +%D This definition means that we can ask for the meaning of a +%D unit using \type {\unitmeaning} and get a list of used +%D units by saying \type {\placelistofunits} +%D +%D We have to use the command \type {\unitmeaning} instead +%D of \type {\meaning}, simply because the latter is a \TEX\ +%D primitive we don't want to loose. We use the label text +%D mechanism for translations. + +%D \macros +%D {dimension} +%D +%D The core of this module is the low level macro \type +%D {\dimension}. Before presenting this macro, it's best to +%D look at some applications, because it's supposed to show +%D some intelligence that can beter be understood from the +%D context. +%D +%D The next useless examples show some of the cases we want +%D to handle in a proper way. +%D +%D \startbuffer +%D ... 10 \Square \Meter \Per \Volt \ +%D ... 10 \Square \Meter \Volt \ +%D ... 10 \Meter \Volt \ +%D ... 10 \Milli \Square \Meter \Per \Volt \ +%D ... 10 \Square \Milli \Meter \Per \Volt \ +%D ... 10 \Meter \Times \Meter \ +%D ... 10 \Square \Meter \Times \Meter \ +%D ... 10 \Square \Milli \Meter \Times \Meter \ +%D \stopbuffer +%D +%D \typebuffer +%D +%D Becomes: +%D +%D \getbuffer + +%D \macros +%D {mathematicstypeface, dimensiontypeface, +%D dimensionhalfspace, dimensionbackspace} +%D +%D There are some low level constants, that can be changed +%D when needed. Some day I will write a decent setup command. + +\def\mathematicstypeface{\rm} +\def\dimensiontypeface {\tf} + +\def\dimensionhalfspace {\ifmmode\,\else\hskip+.1em\relax\fi} +\def\dimensionbackspace {\ifmmode\!\else\hskip-.1em\relax\fi} + +%D \macros +%D {smashdimensionpower} +%D +%D Sometimes the baseline distance is not enough to provide +%D for superscripts, so we smash their height by default. + +\newif\ifsmashdimensionpower \smashdimensionpowertrue + +%D The dimension mechanism uses a lot of signals to keep +%D track if the current state. + +\newsignal\dimensionsignal +\newsignal\dimensionpowersignal +\newsignal\dimensionmidfixsignal +\newsignal\dimensionaddfixsignal + +\let\thedimensionprefix = \empty +\let\thedimensionpower = \empty + +%D \macros +%D {spaceddimensions,textdimensions} +%D +%D The actual definition of \type {\dimension} overruled the +%D one in the core modules. The boolean can be used to +%D force spacing between units. Vergelijk {\Newton \Meter} +%D eens met {\spaceddimensionstrue \Newton \Meter}. The +%D rather ugly test prevents problems with nested dimensions. + +\newif\ifspaceddimensions \spaceddimensionsfalse % user switch +\newif\iftextdimensions \textdimensionsfalse % user switch + +%D You can see the consequence of forcing text dimensions +%D when you compare the following code: +%D +%D \starttyping +%D {\rm test \Square \Meter \Per \Second\ ziezo\Degrees} \par +%D {\ss test \Square \Meter \Per \Second\ ziezo} \par +%D {\tt test \Square \Meter \Per \Second\ ziezo} +%D +%D \textdimensionstrue +%D +%D {\rm test \Square \Meter \Per \Second\ ziezo} \par +%D {\ss test \Square \Meter \Per \Second\ ziezo} \par +%D {\tt test \Square \Meter \Per \Second\ ziezo} +%D \stoptyping + +\newif\ifnesteddimension \nesteddimensionfalse % local switch + +\def\dodimensionpower#1% + {\iftextdimensions\expandafter\high\else\expandafter\normalsuperscript\fi{#1}} + +\def\ustartmathmode {\iftextdimensions\else\expandafter\startmathmode \fi} +\def\ustopmathmode {\iftextdimensions\else\expandafter\stopmathmode \fi} +\def\umathematicstypeface{\iftextdimensions\else\expandafter\mathematicstypeface\fi} + +%D In forced text mode, we ignore spacing in monospaced fonts. + +\def\udimensionhalfspace {\dodimensionspace\dimensionhalfspace} +\def\udimensionbackspace {\dodimensionspace\dimensionbackspace} + +\def\dodimensionspace + {\iftextdimensions + \begingroup + \setbox0\hbox{i}% + \setbox2\hbox{m}% + \ifdim\wd0=\wd2 + \endgroup + \@EAEAEA\gobbleoneargument + \else + \endgroup + \fi + \fi} + +\unexpanded\def\dimension#1% + {\begingroup + \global\let\savedthedimensionprefix\thedimensionprefix + \global\let\savedthedimensionpower\thedimensionpower + \unexpanded\def\dimension##1{\global\nesteddimensiontrue}% + \let\dimensionprefix\dimension + \let\dimensionmidfix\dimension + \let\dimensionsuffix\dimension + \let\dimensionpower \dimension + \global\nesteddimensionfalse + \setbox\scratchbox\hbox{\ustartmathmode#1\ustopmathmode}% pre-roll + \global\let\thedimensionprefix\savedthedimensionprefix + \global\let\thedimensionpower \savedthedimensionpower + \endgroup + \ifnesteddimension#1\else\dodimension{#1}\fi} + +\def\dodimension#1% + {\dontbreakdimension + \ifdim\scratchdimen=\zeropoint\relax + \ifmmode + \udimensionhalfspace + \udimensionhalfspace + \fi + \ustartmathmode\dimensiontypeface + \else + \ustartmathmode\dimensiontypeface + \ifspaceddimensions + \ifdim\scratchdimen=\dimensionsignal\relax + \udimensionhalfspace + \else\ifdim\scratchdimen=\dimensionpowersignal\relax + \udimensionhalfspace + \fi + \fi + \fi + \fi + \umathematicstypeface\thedimensionprefix#1% + \ifx\thedimensionpower\empty + \else\ifsmashdimensionpower + \setbox\scratchbox=\hbox + {\iftextdimensions + \tx\thedimensionpower + \else + $\scriptstyle\thedimensionpower$% + \fi}% + \ht\scratchbox=\zeropoint + \dodimensionpower{\box\scratchbox}% + \else + \dodimensionpower{\thedimensionpower}% + \fi\fi + \ustopmathmode + % otherwise nobreak before space in 2 \Milli \Meter\ blabla + \doifnotmode{atpragma}{\nobreak}% this was always \nobreak + % only test this at pragma + \ifx\thedimensionpower\empty + \hskip\dimensionsignal + \else + \hskip\dimensionpowersignal + \fi + \global\let\thedimensionprefix\empty + \global\let\thedimensionpower\empty} + +%D \macros +%D {dontbreakdimension, +%D dimensionprefix, dimensionaddfix, +%D dimensionnopfix, dimensionmidfix, +%D dimensionpower} +%D +%D Here are some auxilliary macros. + +\def\dontbreakdimension + {\scratchdimen\lastskip + \unskip + \nobreak + \hskip\scratchdimen + \nobreak} + +\def\dimensionprefix#1% + {\gdef\thedimensionprefix{#1}} + +\def\dimensionaddfix#1% + {\unskip + %\mathematics{\umathematicstypeface#1}% + \ustartmathmode\umathematicstypeface#1\ustopmathmode + \nobreak + \hskip\dimensionaddfixsignal} + +\def\dimensionnopfix#1% + {\dontbreakdimension + \ifdim\scratchdimen=\dimensionpowersignal\relax + \ustartmathmode + \else + \ustartmathmode + \udimensionhalfspace + \nobreak + \fi + \umathematicstypeface#1% + \ustopmathmode + \nobreak + \hskip\dimensionsignal} + +\def\dimensionmidfix#1% + {\dontbreakdimension + \ifdim\scratchdimen=\dimensionpowersignal\relax + \ustartmathmode + \udimensionbackspace + \nobreak + \else + \ustartmathmode + \fi + \umathematicstypeface#1% + \ustopmathmode + \nobreak + \hskip\dimensionmidfixsignal} + +\def\dimensionpower#1% + {\gdef\thedimensionpower{#1}} + +%D \macros +%D {SIunits, noSI, doSI} +%D +%D Some low level unit switching macros: + +\newif\ifSIunits \SIunitstrue + +\def\noSI#1{\begingroup\SIunitsfalse#1\endgroup} +\def\doSI#1{\begingroup\SIunitstrue #1\endgroup} + +%D \macros +%D {Degrees} +%D +%D We can fake the degrees symbol with: + +\def\Degrees{\dimensionaddfix{\mathematics{\normalsuperscript\circ}}} + +%D \macros +%D {Unit, NoUnit} +%D +%D When a dimension has no leading number, we can use \type +%D {\Unit}, and when no unit is appended, \type {\NoUnit} is +%D to be used, just to prevent the prefix migrating to the +%D next occasion. + +\def\Unit {\hskip\dimensionsignal} +\def\NoUnit {\dimension{}} + +%D The mechanism described at the top of this module, depends +%D on several dimensional components, like prefixes: + +\def\Atto {\dimensionprefix{a}} +\def\Femto {\dimensionprefix{f}} +\def\Pico {\dimensionprefix{p}} +\def\Nano {\dimensionprefix{n}} +\def\Micro {\dimensionprefix{\iftextdimensions u\else\mu\fi}} +\def\Milli {\dimensionprefix{m}} +\def\Centi {\dimensionprefix{c}} +\def\Deci {\dimensionprefix{d}} % 10^{01} +\def\Hecto {\dimensionprefix{h}} % 10^{02} +\def\Kilo {\dimensionprefix{k}} % 10^{03} +\def\Mega {\dimensionprefix{M}} % 10^{06} +\def\Giga {\dimensionprefix{G}} % 10^{09} +\def\Tera {\dimensionprefix{T}} % 10^{12} +\def\Peta {\dimensionprefix{P}} % 10^{15} +\def\Exa {\dimensionprefix{E}} % 10^{18} + +%def\Terra {\dimensionprefix{T}} % for old times sake + +\def\Kibi {\dimensionprefix{ki}} % 2^{10} +\def\Mebi {\dimensionprefix{Mi}} % 2^{20} +\def\Gibi {\dimensionprefix{Gi}} % 2^{30} +\def\Tebi {\dimensionprefix{Ti}} % 2^{40} +\def\Pebi {\dimensionprefix{Pi}} % 2^{50} + +%D and binary prefixes: + +\def\Kibi {\dimensionprefix{Ki}} +\def\Mebi {\dimensionprefix{Mi}} +\def\Gibi {\dimensionprefix{Gi}} +\def\Tebi {\dimensionprefix{Ti}} +\def\Pebi {\dimensionprefix{Pi}} +\def\Exbi {\dimensionprefix{Ei}} +\def\Zebi {\dimensionprefix{Zi}} +\def\Yobi {\dimensionprefix{Yi}} + +%D and operators: + +\def\Times {\dimensionnopfix{\iftextdimensions.\else\cdot\fi}} +\def\Solidus {\dimensionmidfix{/}} +\def\Per {\dimensionmidfix{/}} +\def\OutOf {\dimensionnopfix{:}} + +%D and suffixes: + +\def\Linear {\dimensionpower{1}} +\def\Square {\dimensionpower{2}} +\def\Cubic {\dimensionpower{3}} + +\def\Inverse {\dimensionpower{-1}} +\def\ILinear {\dimensionpower{-1}} +\def\ISquare {\dimensionpower{-2}} +\def\ICubic {\dimensionpower{-3}} + +%D Apart from these components, the units themselves are +%D defined using the synonym mechanism. First we define some +%D length and volume related units. + +\getvalue{\v!unit} [Meter] {m} {meter} +\getvalue{\v!unit} [pMeter] {\Pico \Meter} {picometer} +\getvalue{\v!unit} [nMeter] {\Nano \Meter} {nanometer} +\getvalue{\v!unit} [uMeter] {\Micro \Meter} {micrometer} +\getvalue{\v!unit} [mMeter] {\Milli \Meter} {millimeter} +\getvalue{\v!unit} [cMeter] {\Centi \Meter} {centimeter} +\getvalue{\v!unit} [dMeter] {\Deci \Meter} {decimeter} +\getvalue{\v!unit} [hMeter] {\Hecto \Meter} {hectometer} +\getvalue{\v!unit} [kMeter] {\Kilo \Meter} {kilometer} + +%D After some discussion on the \CONTEXT\ mailing list in +%D february 2002 it was decided to go from L to l for liters +%D (Karel Wesselings alternative: \mathematics{\ell}). + +\getvalue{\v!unit} [Liter] {l} {liter} +\getvalue{\v!unit} [mLiter] {\Milli \Liter} {milliliter} +\getvalue{\v!unit} [cLiter] {\Centi \Liter} {centiliter} +\getvalue{\v!unit} [dLiter] {\Deci \Liter} {deciliter} + +%D Next we define time related units (\type {\ifSI} still dutch only). + +\getvalue{\v!unit} [Sec] {s} {\labeltext{u:sec}} +\getvalue{\v!unit} [fSec] {\Femto \Sec} {\labeltext{u:fsec}} +\getvalue{\v!unit} [pSec] {\Pico \Sec} {\labeltext{u:psec}} +\getvalue{\v!unit} [nSec] {\Nano \Sec} {\labeltext{u:nsec}} +\getvalue{\v!unit} [uSec] {\Micro \Sec} {\labeltext{u:usec}} +\getvalue{\v!unit} [mSec] {\Milli \Sec} {\labeltext{u:msec}} +\getvalue{\v!unit} [Year] {\ifSIunits a \else j\fi} {\labeltext{u:year}} +\getvalue{\v!unit} [Month] {m} {\labeltext{u:month}} +\getvalue{\v!unit} [Week] {w} {\labeltext{u:week}} +\getvalue{\v!unit} [Day] {d} {\labeltext{u:day}} +\getvalue{\v!unit} [Hour] {\ifSIunits h \else u\fi} {\labeltext{u:hour}} +\getvalue{\v!unit} [Min] {min} {\labeltext{u:min}} + +\setuplabeltext + [\s!nl] + [u:sec=seconde, + u:psec=picoseconde, + u:fsec=femtoseconde, + u:nsec=nanoseconde, + u:usec=microseconde, + u:msec=milliseconde, + u:year=jaar, + u:month=maand, + u:week=week, + u:day=dag, + u:hour=uur, + u:min=minuten] + +\setuplabeltext + [\s!en] + [u:sec=second, + u:fsec=femtosecond, + u:psec=picosecond, + u:nsec=nanosecond, + u:usec=microsecond, + u:msec=millisecond, + u:year=year, + u:month=month, + u:week=week, + u:day=day, + u:hour=hour, + u:min=minutes] + +\setuplabeltext + [\s!de] + [u:sec=Sekunde, + u:fsec=Femtosekunde, + u:psec=Picosekunde, + u:nsec=Nanosekunde, + u:usec=Microsekunde, + u:msec=Millisekunde, + u:year=Jahr, + u:month=Monat, + u:week=Woche, + u:day=Tag, + u:hour=Stunde, + u:min=Minuten] + +\setuplabeltext + [\s!hr] + [u:sec=sekunda, + u:fsec=femtosekunda, + u:psec=pikosekunda, + u:nsec=nanosekunda, + u:usec=mikrosekunda, + u:msec=milisekunda, + u:year=godina, + u:month=mjesec, + u:week=tjedan, + u:day=dan, + u:hour=sat, + u:min=minuta] + +\setuplabeltext + [\s!it] + [u:sec=secondo, + u:fsec=femtosecondo, + u:psec=picosecondo, + u:nsec=nanosecondo, + u:usec=microsecondo, + u:msec=millisecondo, + u:year=anno, + u:month=mese, + u:week=settimana, + u:day=giorno, + u:hour=ora, + u:min=minuti] + +%D Then we define some angles. + +\getvalue{\v!unit} [Rad] {rad} {\labeltext{u:rad}} +\getvalue{\v!unit} [Deg] {{\mathematics{\normalsuperscript\circ}}} {\labeltext{u:deg}} + +\setuplabeltext + [\s!nl] + [u:rad=hoek radialen, + u:deg=hoek graden] + +\setuplabeltext + [\s!en] + [u:rad=angle radians, + u:deg=angle degrees] + +\setuplabeltext + [\s!de] + [u:rad=Bogenma\SS, + u:deg=Gradma\SS] + +\setuplabeltext + [\s!hr] + [u:rad=radijani, + u:deg=kutni stupnjevi] + +\setuplabeltext + [\s!it] + [u:rad=radianti, + u:deg=angoli sessagesimali] + +%D Rotation and frequency related units are defined by: + +\getvalue{\v!unit} [Hertz] {Hz} {Hertz} +\getvalue{\v!unit} [kHertz] {\Kilo \Hertz} {kilo Hertz} +\getvalue{\v!unit} [MHertz] {\Mega \Hertz} {mega Hertz} +\getvalue{\v!unit} [GHertz] {\Giga \Hertz} {giga Hertz} +\getvalue{\v!unit} [THertz] {\Tera \Hertz} {tera Hertz} +\getvalue{\v!unit} [mHertz] {\Milli \Hertz} {milli Hertz} + +\getvalue{\v!unit} [RevPerSec] {RPS} {\labeltext{u:rps}} +\getvalue{\v!unit} [RevPerMin] {RPM} {\labeltext{u:rpm}} + +\setuplabeltext + [\s!nl] + [u:rps=omwentelingen per seconde, + u:rpm=omwentelingen per minuut] + +\setuplabeltext + [\s!en] + [u:rps=revolutions per second, + u:rpm=revolutions per minute] + +\setuplabeltext + [\s!de] + [u:rps=Umdrehungen pro Sekunde, + u:rpm=Umdrehungen pro Minute] + +\setuplabeltext + [\s!hr] + [u:rps=okretaji po sekundi, + u:rpm=okretaji po minuti] + +\setuplabeltext + [\s!it] + [u:rps=giri al secondo, + u:rpm=giri al minuto] + +%D Mass and force: + +\getvalue{\v!unit} [Gram] {g} {gram} +\getvalue{\v!unit} [uGram] {\Micro \Gram} {microgram} +\getvalue{\v!unit} [mGram] {\Milli \Gram} {milligram} +\getvalue{\v!unit} [kGram] {\Kilo \Gram} {kilogram} +\getvalue{\v!unit} [Atom] {u} {\labeltext{u:u}} + +\getvalue{\v!unit} [Newton] {N} {Newton} +\getvalue{\v!unit} [kNewton] {\Kilo \Newton} {kilo Newton} + +\getvalue{\v!unit} [Pascal] {Pa} {Pascal} +\getvalue{\v!unit} [mPascal] {\Milli \Pascal} {milli Pascal} +\getvalue{\v!unit} [kPascal] {\Kilo \Pascal} {kilo Pascal} + +\setuplabeltext + [\s!nl] + [u:u=atomaire massa eenheid] + +\setuplabeltext + [\s!en] + [u:u=atom mass unit] + +\setuplabeltext + [\s!de] + [u:u=Atomare Masseneinheit] + +\setuplabeltext + [\s!hr] + [u:u=unificirana atomska jedinica mase] + +\setuplabeltext + [\s!it] + [u:u=unit\`a di massa atomica] + +%D Energy units comes in two alternatives: + +\getvalue{\v!unit} [Joule] {J} {Joule} +\getvalue{\v!unit} [mJoule] {\Milli \Joule} {milli Joule} +\getvalue{\v!unit} [kJoule] {\Kilo \Joule} {kilo Joule} +\getvalue{\v!unit} [MJoule] {\Mega \Joule} {mega Joule} +\getvalue{\v!unit} [GJoule] {\Giga \Joule} {giga Joule} + +\getvalue{\v!unit} [Watt] {W} {Watt} +\getvalue{\v!unit} [mWatt] {\Milli \Watt} {milli Watt} +\getvalue{\v!unit} [kWatt] {\Kilo \Watt} {kilo Watt} +\getvalue{\v!unit} [MWatt] {\Mega \Watt} {mega Watt} +\getvalue{\v!unit} [GWatt] {\Giga \Watt} {giga Watt} +\getvalue{\v!unit} [TWatt] {\Tera \Watt} {tera Watt} + +%D Although Celsius is no longer permitted, we define it by +%D saying: + +\getvalue{\v!unit} [Celsius] {C} {Celsius} +\getvalue{\v!unit} [Kelvin] {K} {Kelvin} +\getvalue{\v!unit} [Fahrenheit] {F} {Fahrenheit} + +%D Some chemic related units are: + +\getvalue{\v!unit} [Mol] {mol} {mol} +\getvalue{\v!unit} [mMol] {\Milli \Mol} {millimol} +\getvalue{\v!unit} [kMol] {\Kilo \Mol} {kilomol} +\getvalue{\v!unit} [Molair] {M} {molair (\Mol \Per \Liter)} +\getvalue{\v!unit} [Equivalent] {eq} {equivalent} +\getvalue{\v!unit} [mEquivalent] {\Milli \Equivalent} {milli equivalent} + +%D There are quite a lot units related to electricity and +%D magnetism: + +\getvalue{\v!unit} [Farad] {F} {Farad} +\getvalue{\v!unit} [pFarad] {\Pico \Farad} {pico Farad} +\getvalue{\v!unit} [nFarad] {\Nano \Farad} {nano Farad} +\getvalue{\v!unit} [uFarad] {\Micro \Farad} {micro Farad} +\getvalue{\v!unit} [mFarad] {\Milli \Farad} {milli Farad} + +\getvalue{\v!unit} [Ohm] {\Omega} {Ohm} +\getvalue{\v!unit} [kOhm] {\Kilo \Ohm} {kilo Ohm} + +\getvalue{\v!unit} [Siemens] {S} {Siemens} + +\getvalue{\v!unit} [Ampere] {A} {Amp\`ere} +\getvalue{\v!unit} [mAmpere] {\Milli \Ampere} {milli Amp\`ere} + +\getvalue{\v!unit} [Coulomb] {C} {Coulomb} + +\getvalue{\v!unit} [Volt] {V} {Volt} +\getvalue{\v!unit} [mVolt] {\Milli \Volt} {milli Volt} +\getvalue{\v!unit} [kVolt] {\Kilo \Volt} {kilo Volt} +\getvalue{\v!unit} [eVolt] {eV} {electronvolt} +\getvalue{\v!unit} [keVolt] {\Kilo \eVolt} {kilo electronvolt} +\getvalue{\v!unit} [MeVolt] {\Mega \eVolt} {mega electronvolt} + +\getvalue{\v!unit} [Tesla] {T} {Tesla} + +\getvalue{\v!unit} [VoltAC] {V\normalsubscript{\xbox{ac}}} {\labeltext{u:vac}} +\getvalue{\v!unit} [VoltDC] {V\normalsubscript{\xbox{dc}}} {\labeltext{u:vdc}} + +\setuplabeltext + [\s!nl] + [u:vac=wisselspanning, + u:vdc=gelijkspanning] + +\setuplabeltext + [\s!en] + [u:vac=alternating current, + u:vdc=direct current] + +\setuplabeltext + [\s!de] + [u:vac=Wechselspannung, + u:vdc=Gleichspannung] + +\setuplabeltext + [\s!hr] + [u:vac=izmjeni\ccaron ni napon, + u:vdc=istosmjerni napon] + +\setuplabeltext + [\s!it] + [u:vac=corrente alternata, + u:vdc=corrente continua] + +%D Network bandwidth is specified in Bits: + +\getvalue{\v!unit} [Bit] {bit} {\labeltext{u:bit}} +\getvalue{\v!unit} [Baud] {Bd} {Baud (Bit/s)} + +%D Computer memory size is specified in Bytes: + +\getvalue{\v!unit} [Byte] {B} {\labeltext{u:byte}} +\getvalue{\v!unit} [kByte] {\Kilo \Byte} {kilo Byte} +\getvalue{\v!unit} [MByte] {\Mega \Byte} {mega Byte} +\getvalue{\v!unit} [GByte] {\Giga \Byte} {giga Byte} +\getvalue{\v!unit} [TByte] {\Tera \Byte} {tera Byte} + +\setuplabeltext + [\s!en] + [u:bit=Bit, + u:byte=Byte] + +\setuplabeltext + [\s!hr] + [u:bit=bit, + u:byte=bajt] + +%D Telecommunication call density is specified in Erlangs: + +\getvalue{\v!unit} [Erlang] {E} {Erlang} + +%D Some radiation related units: + +\getvalue{\v!unit} [Bequerel] {Bq} {Bequerel} +\getvalue{\v!unit} [MBequerel] {\Mega \Bequerel} {Bequerel} +\getvalue{\v!unit} [Sievert] {Sv} {Sievert} +\getvalue{\v!unit} [mSievert] {\Milli \Sievert} {milli Sievert} + +%D Light: + +\getvalue{\v!unit} [Candela] {cd} {Candela} + +%D and some sound ones: + +\getvalue{\v!unit} [Bell] {B} {Bell} +\getvalue{\v!unit} [dBell] {\Deci \Bell} {decibel} + +%D We also define some non||regular, sometimes even forbidden, +%D units: + +\getvalue{\v!unit} [At] {at} {\labeltext{u:at}} +\getvalue{\v!unit} [Atm] {atm} {\labeltext{u:atm}} +\getvalue{\v!unit} [Bar] {bar} {bar (100 \Kilo \Pascal)} +\getvalue{\v!unit} [EVolt] {eV} {electronvolt} +\getvalue{\v!unit} [Foot] {ft} {\labeltext{u:ft}} +\getvalue{\v!unit} [Inch] {inch} {\labeltext{u:inch}} +\getvalue{\v!unit} [Cal] {cal} {\labeltext{u:cal}} +\getvalue{\v!unit} [Force] {f} {\labeltext{u:f}} +\getvalue{\v!unit} [kCal] {\Kilo \Cal} {\labeltext{u:kcal}} +\getvalue{\v!unit} [Lux] {lux} {lux} + + +\def\xPercent {\dimensionaddfix{\percent }} +\def\xPromille{\dimensionaddfix{\promille}} + +\getvalue{\v!unit} [Percent] {\xPercent } {percent} +\getvalue{\v!unit} [Permille] {\xPromille} {promille} +\getvalue{\v!unit} [Promille] {\xPromille} {promille} + +%D Some more, thanks to Tobias: + +\getvalue{\v!unit} [Gray] {Gr} {Gray} +\getvalue{\v!unit} [Weber] {Wb} {Weber} +\getvalue{\v!unit} [Henry] {H} {Henry} +\getvalue{\v!unit} [Sterant] {sr} {Sterant} +\getvalue{\v!unit} [Angstrom] {\hbox{\Aring}} {\Aring ngstr\"om} +\getvalue{\v!unit} [Gauss] {G} {Gauss} + +\setuplabeltext + [\s!nl] + [u:at=technische atmosfeer, + u:atm=fysische atmosfeer, + u:ft=voet, + u:cal=calorie, + u:f=kracht (force), + u:kcal=kilocalorie] + +\setuplabeltext + [\s!en] + [u:at=technical atmospheric pressure, + u:atm=physical atmospheric pressure, + u:ft=foot, + u:inch=inch, + u:cal=calory, + u:f=force, + u:kcal=kilocalory] + +\setuplabeltext + [\s!de] + [u:at=Technischer atmosph\"arischer Druck, + u:atm=physkalischer atmosph\"arischer Druck, + u:ft=Fu\SS, + u:cal=Kalorien, + u:f=Force, + u:kcal=Kilokalorien] + +\setuplabeltext + [\s!hr] + [u:at=tehni\ccaron ka atmosfera, + u:atm=standardna atmosfera, + u:ft=stopa, + u:inch=in\ccaron a, + u:cal=kalorija, + u:f=Force, + u:kcal=Kilokalorien] + +\setuplabeltext + [\s!it] + [u:at=pressione atmosferica tecnica, + u:atm=pressione atmosfera fisica, + u:ft=piede, + u:cal=caloria, + u:f=forza, + u:kcal=chilocaloria] + +%D Here are some old ones, still there for compatibility +%D reasons. These will probably be obsolete in a few years. + +\def\MeterTwee {\Square \Meter} +\def\mMeterTwee {\Square \Milli \Meter} +\def\cMeterTwee {\Square \Centi \Meter} +\def\dMeterTwee {\Square \Deci \Meter} +\def\kMeterTwee {\Square \Kilo \Meter} + +\def\MeterDrie {\Cubic \Meter} +\def\mMeterDrie {\Cubic \Milli \Meter} +\def\cMeterDrie {\Kubic \Centi \Meter} +\def\dMeterDrie {\Cubic \Deci \Meter} +\def\kMeterDrie {\Cubic \Kilo \Meter} + +\def\LiterTwee {\Square \Liter} +\def\SecTwee {\Square \Sec} +\def\SecMinEen {\Inverse \Sec} + +%D To make ourselves happy, we define some dutch specific +%D units: + +\startinterface dutch + + \getvalue{\v!unit} [PaardenKracht] {pk} {paardenkracht} + \getvalue{\v!unit} [Duits] {D} {duits} + \getvalue{\v!unit} [Kwik] {Hg} {kwikkolom} + \getvalue{\v!unit} [Hectare] {ha} {hectare} + \getvalue{\v!unit} [kGramForce] {\Kilo \Gram \Force} {kilogramforce} + \getvalue{\v!unit} [kWattUur] {\Kilo \Watt \Uur} {kilowattuur} + \getvalue{\v!unit} [MeterKwik] {\Meter \Kwik} {meter kwikkolom} + \getvalue{\v!unit} [Waterkolom] {WK} {waterkolom} + \getvalue{\v!unit} [MeterWater] {\Meter \Waterkolom} {meter waterkolom} + \getvalue{\v!unit} [DrogeStof] {ds} {droge stof} + \getvalue{\v!unit} [Normaal] {N} {normaal} + + \getvalue{\v!unit} [Ton] {t} {ton} + \getvalue{\v!unit} [kTon] {\Kilo \Ton} {kiloton} + + \let \OmwPerSec \RevPerSec + \let \OmwPerMin \RevPerMin + \let \Graden \Deg + \let \PaardeKracht \PaardenKracht + \let \Atoom \Atom + \let \Heure \Hour + \let \Jaar \Year + \let \Maand \Month + \let \Dag \Day + \let \Uur \Hour + +\stopinterface + +%D Finally we define some equivalents. By using \type {\let} +%D we can be sure that they don't end up double in the lists of +%D units. + +\let \Second \Sec +\let \Kubic \Cubic +\let \IKubic \ICubic + +%D Option: + +% \def\Micro{\dimensionprefix{\iftextdimensions\mathematics\mu \else\mu \fi}} +% \def\Times{\dimensionnopfix{\iftextdimensions\mathematics\cdot\else\cdot\fi}} + +\stopmodule + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/m-units.tex b/Master/texmf-dist/tex/context/base/m-units.tex deleted file mode 100644 index d186c542b57..00000000000 --- a/Master/texmf-dist/tex/context/base/m-units.tex +++ /dev/null @@ -1,825 +0,0 @@ -%D \module -%D [ file=m-units, -%D version=1997.03.19, -%D title=\CONTEXT\ Extra Modules, -%D subtitle=Scientific Units, -%D author={Hans Hagen \& Ton Otten}, -%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 Scientific units can be typeset in math mode pretty well, -%D but occasionally one has to take care of spacing. -%D Furthermore, entering these units is not that natural as -%D wanted. Therefore this module presents a more natural way of -%D doing things, like: -%D -%D \starttyping -%D 1.23 \Cubic \Meter \Per \Second -%D \stoptyping -%D -%D This example shows that we use the order in which we say -%D things, instead of typeset things. There is a separate -%D manual for this module. - -%D Message number~1 deals with overruling the \type {\Degrees} -%D macro defined in the core modules. Let's say that this is -%D an upward compatibility issue. - -\startmessages dutch library: units - title: eenheden - 1: gebruik \string\Degrees\space\string\Celsius\space in plaats van \string\Celsius ! -\stopmessages - -\startmessages english library: units - title: units - 1: use \string\Degrees\space\string\Celsius\space instead of \string\Celsius ! -\stopmessages - -\startmessages german library: units - title: Einheiten - 1: Verwende \string\Degrees\space\string\Celsius\space statt \string\Celsius ! -\stopmessages - -\startmessages italian library: units - title: unita - 1: usare \string\Degrees\space\string\Celsius\space invece di \string\Celsius ! -\stopmessages - -\startmessages norwegian library: units - title: enheter - 1: bruk \string\Degrees\space\string\Celsius\space istedenfor \string\Celsius ! -\stopmessages - -\startmessages romanian library: units - title: unitati - 1: folositi \string\Degrees\space\string\Celsius\space in locul \string\Celsius ! -\stopmessages - -\startmessages french library: units - title: unitas - 1: utilisez \string\Degrees\space\string\Celsius\space A la place de \string\Celsius ! -\stopmessages - -\unprotect - -%D This runtime loadable module implements a way of defining -%D units. The core macro is \type {\dimension}, a rather clever -%D one that is able to cooperate with some other dimension -%D related macros. As said, this module enables user to enter: -%D -%D \startbuffer -%D some 10 \Square \Meter \Per \Second or more -%D \stopbuffer -%D -%D \getbuffer -%D -%D as: -%D -%D \typebuffer -%D -%D The units itself are implemented as synonyms. -%D -%D \starttyping -%D \definesynonyms [unit] [units] [\unitmeaning] -%D \setupsynonyms [unit] [textstyle=\dimension] -%D \stoptyping -%D -%D This definition means that we can ask for the meaning of a -%D unit using \type {\unitmeaning} and get a list of used -%D units by saying \type {\placelistofunits} -%D -%D We have to use the command \type {\unitmeaning} instead -%D of \type {\meaning}, simply because the latter is a \TEX\ -%D primitive we don't want to loose. We use the label text -%D mechanism for translations. - -%D \macros -%D {dimension} -%D -%D The core of this module is the low level macro \type -%D {\dimension}. Before presenting this macro, it's best to -%D look at some applications, because it's supposed to show -%D some intelligence that can beter be understood from the -%D context. -%D -%D The next useless examples show some of the cases we want -%D to handle in a proper way. -%D -%D \startbuffer -%D ... 10 \Square \Meter \Per \Volt \ -%D ... 10 \Square \Meter \Volt \ -%D ... 10 \Meter \Volt \ -%D ... 10 \Milli \Square \Meter \Per \Volt \ -%D ... 10 \Square \Milli \Meter \Per \Volt \ -%D ... 10 \Meter \Times \Meter \ -%D ... 10 \Square \Meter \Times \Meter \ -%D ... 10 \Square \Milli \Meter \Times \Meter \ -%D \stopbuffer -%D -%D \typebuffer -%D -%D Becomes: -%D -%D \getbuffer - -%D \macros -%D {mathematicstypeface, dimensiontypeface, -%D dimensionhalfspace, dimensionbackspace} -%D -%D There are some low level constants, that can be changed -%D when needed. Some day I will write a decent setup command. - -\def\mathematicstypeface{\rm} -\def\dimensiontypeface {\tf} - -\def\dimensionhalfspace {\ifmmode\,\else\hskip+.1em\relax\fi} -\def\dimensionbackspace {\ifmmode\!\else\hskip-.1em\relax\fi} - -%D \macros -%D {smashdimensionpower} -%D -%D Sometimes the baseline distance is not enough to provide -%D for superscripts, so we smash their height by default. - -\newif\ifsmashdimensionpower \smashdimensionpowertrue - -%D The dimension mechanism uses a lot of signals to keep -%D track if the current state. - -\newsignal\dimensionsignal -\newsignal\dimensionpowersignal -\newsignal\dimensionmidfixsignal -\newsignal\dimensionaddfixsignal - -\let\thedimensionprefix = \empty -\let\thedimensionpower = \empty - -%D \macros -%D {spaceddimensions,textdimensions} -%D -%D The actual definition of \type {\dimension} overruled the -%D one in the core modules. The boolean can be used to -%D force spacing between units. Vergelijk {\Newton \Meter} -%D eens met {\spaceddimensionstrue \Newton \Meter}. The -%D rather ugly test prevents problems with nested dimensions. - -\newif\ifspaceddimensions \spaceddimensionsfalse % user switch -\newif\iftextdimensions \textdimensionsfalse % user switch - -%D You can see the consequence of forcing text dimensions -%D when you compare the following code: -%D -%D \starttyping -%D {\rm test \Square \Meter \Per \Second\ ziezo\Degrees} \par -%D {\ss test \Square \Meter \Per \Second\ ziezo} \par -%D {\tt test \Square \Meter \Per \Second\ ziezo} -%D -%D \textdimensionstrue -%D -%D {\rm test \Square \Meter \Per \Second\ ziezo} \par -%D {\ss test \Square \Meter \Per \Second\ ziezo} \par -%D {\tt test \Square \Meter \Per \Second\ ziezo} -%D \stoptyping - -\newif\ifnesteddimension \nesteddimensionfalse % local switch - -\def\dodimensionpower#1% - {\iftextdimensions\expandafter\high\else\expandafter^\fi{#1}} - -\def\ustartmathmode {\iftextdimensions\else\expandafter\startmathmode \fi} -\def\ustopmathmode {\iftextdimensions\else\expandafter\stopmathmode \fi} -\def\umathematicstypeface{\iftextdimensions\else\expandafter\mathematicstypeface\fi} - -%D In forced text mode, we ignore spacing in monospaced fonts. - -\def\udimensionhalfspace {\dodimensionspace\dimensionhalfspace} -\def\udimensionbackspace {\dodimensionspace\dimensionbackspace} - -\def\dodimensionspace - {\iftextdimensions - \begingroup - \setbox0\hbox{i}% - \setbox2\hbox{m}% - \ifdim\wd0=\wd2 - \endgroup - \@EAEAEA\gobbleoneargument - \else - \endgroup - \fi - \fi} - -\unexpanded\def\dimension#1% - {\begingroup - \global\let\savedthedimensionprefix\thedimensionprefix - \global\let\savedthedimensionpower\thedimensionpower - \unexpanded\def\dimension##1{\global\nesteddimensiontrue}% - \let\dimensionprefix\dimension - \let\dimensionmidfix\dimension - \let\dimensionsuffix\dimension - \let\dimensionpower \dimension - \global\nesteddimensionfalse - \setbox\scratchbox\hbox{\ustartmathmode#1\ustopmathmode}% pre-roll - \global\let\thedimensionprefix\savedthedimensionprefix - \global\let\thedimensionpower \savedthedimensionpower - \endgroup - \ifnesteddimension#1\else\dodimension{#1}\fi} - -\def\dodimension#1% - {\dontbreakdimension - \ifdim\scratchdimen=\zeropoint\relax - \ifmmode - \udimensionhalfspace - \udimensionhalfspace - \fi - \ustartmathmode\dimensiontypeface - \else - \ustartmathmode\dimensiontypeface - \ifspaceddimensions - \ifdim\scratchdimen=\dimensionsignal\relax - \udimensionhalfspace - \else\ifdim\scratchdimen=\dimensionpowersignal\relax - \udimensionhalfspace - \fi - \fi - \fi - \fi - \umathematicstypeface\thedimensionprefix#1% - \ifx\thedimensionpower\empty - \else\ifsmashdimensionpower - \setbox\scratchbox=\hbox - {\iftextdimensions - \tx\thedimensionpower - \else - $\scriptstyle\thedimensionpower$% - \fi}% - \ht\scratchbox=\zeropoint - \dodimensionpower{\box\scratchbox}% - \else - \dodimensionpower{\thedimensionpower}% - \fi\fi - \ustopmathmode - % otherwise nobreak before space in 2 \Milli \Meter\ blabla - \doifnotmode{atpragma}{\nobreak}% this was always \nobreak - % only test this at pragma - \ifx\thedimensionpower\empty - \hskip\dimensionsignal - \else - \hskip\dimensionpowersignal - \fi - \global\let\thedimensionprefix\empty - \global\let\thedimensionpower\empty} - -%D \macros -%D {dontbreakdimension, -%D dimensionprefix, dimensionaddfix, -%D dimensionnopfix, dimensionmidfix, -%D dimensionpower} -%D -%D Here are some auxilliary macros. - -\def\dontbreakdimension - {\scratchdimen\lastskip - \unskip - \nobreak - \hskip\scratchdimen - \nobreak} - -\def\dimensionprefix#1% - {\gdef\thedimensionprefix{#1}} - -\def\dimensionaddfix#1% - {\unskip - %\mathematics{\umathematicstypeface#1}% - \ustartmathmode\umathematicstypeface#1\ustopmathmode - \nobreak - \hskip\dimensionaddfixsignal} - -\def\dimensionnopfix#1% - {\dontbreakdimension - \ifdim\scratchdimen=\dimensionpowersignal\relax - \ustartmathmode - \else - \ustartmathmode - \udimensionhalfspace - \nobreak - \fi - \umathematicstypeface#1% - \ustopmathmode - \nobreak - \hskip\dimensionsignal} - -\def\dimensionmidfix#1% - {\dontbreakdimension - \ifdim\scratchdimen=\dimensionpowersignal\relax - \ustartmathmode - \udimensionbackspace - \nobreak - \else - \ustartmathmode - \fi - \umathematicstypeface#1% - \ustopmathmode - \nobreak - \hskip\dimensionmidfixsignal} - -\def\dimensionpower#1% - {\gdef\thedimensionpower{#1}} - -%D \macros -%D {SIunits, noSI, doSI} -%D -%D Some low level unit switching macros: - -\newif\ifSIunits \SIunitstrue - -\def\noSI#1{\begingroup\SIunitsfalse#1\endgroup} -\def\doSI#1{\begingroup\SIunitstrue #1\endgroup} - -%D \macros -%D {Degrees} -%D -%D We can fake the degrees symbol with: - -\def\Degrees{\dimensionaddfix{\mathematics{^\circ}}} - -%D \macros -%D {Unit, NoUnit} -%D -%D When a dimension has no leading number, we can use \type -%D {\Unit}, and when no unit is appended, \type {\NoUnit} is -%D to be used, just to prevent the prefix migrating to the -%D next occasion. - -\def\Unit {\hskip\dimensionsignal} -\def\NoUnit {\dimension{}} - -%D The mechanism described at the top of this module, depends -%D on several dimensional components, like prefixes: - -\def\Atto {\dimensionprefix{a}} -\def\Femto {\dimensionprefix{f}} -\def\Pico {\dimensionprefix{p}} -\def\Nano {\dimensionprefix{n}} -\def\Micro {\dimensionprefix{\iftextdimensions u\else\mu\fi}} -\def\Milli {\dimensionprefix{m}} -\def\Centi {\dimensionprefix{c}} -\def\Deci {\dimensionprefix{d}} -\def\Hecto {\dimensionprefix{h}} -\def\Kilo {\dimensionprefix{k}} -\def\Mega {\dimensionprefix{M}} -\def\Giga {\dimensionprefix{G}} -\def\Terra {\dimensionprefix{T}} % for old times sake -\def\Tera {\dimensionprefix{T}} -\def\Peta {\dimensionprefix{P}} -\def\Exa {\dimensionprefix{E}} - -%D and operators: - -\def\Times {\dimensionnopfix{\iftextdimensions.\else\cdot\fi}} -\def\Solidus {\dimensionmidfix{/}} -\def\Per {\dimensionmidfix{/}} -\def\OutOf {\dimensionnopfix{:}} - -%D and suffixes: - -\def\Linear {\dimensionpower{1}} -\def\Square {\dimensionpower{2}} -\def\Cubic {\dimensionpower{3}} - -\def\Inverse {\dimensionpower{-1}} -\def\ILinear {\dimensionpower{-1}} -\def\ISquare {\dimensionpower{-2}} -\def\ICubic {\dimensionpower{-3}} - -%D Apart from these components, the units themselves are -%D defined using the synonym mechanism. First we define some -%D length and volume related units. - -\getvalue{\v!unit} [Meter] {m} {meter} -\getvalue{\v!unit} [pMeter] {\Pico \Meter} {picometer} -\getvalue{\v!unit} [nMeter] {\Nano \Meter} {nanometer} -\getvalue{\v!unit} [uMeter] {\Micro \Meter} {micrometer} -\getvalue{\v!unit} [mMeter] {\Milli \Meter} {millimeter} -\getvalue{\v!unit} [cMeter] {\Centi \Meter} {centimeter} -\getvalue{\v!unit} [dMeter] {\Deci \Meter} {decimeter} -\getvalue{\v!unit} [hMeter] {\Hecto \Meter} {hectometer} -\getvalue{\v!unit} [kMeter] {\Kilo \Meter} {kilometer} - -%D After some discussion on the \CONTEXT\ mailing list in -%D february 2002 it was decided to go from L to l for liters -%D (Karel Wesselings alternative: \mathematics{\ell}). - -\getvalue{\v!unit} [Liter] {l} {liter} -\getvalue{\v!unit} [mLiter] {\Milli \Liter} {milliliter} -\getvalue{\v!unit} [cLiter] {\Centi \Liter} {centiliter} -\getvalue{\v!unit} [dLiter] {\Deci \Liter} {deciliter} - -%D Next we define time related units (\type {\ifSI} still dutch only). - -\getvalue{\v!unit} [Sec] {s} {\labeltext{u:sec}} -\getvalue{\v!unit} [fSec] {\Femto \Sec} {\labeltext{u:fsec}} -\getvalue{\v!unit} [pSec] {\Pico \Sec} {\labeltext{u:psec}} -\getvalue{\v!unit} [nSec] {\Nano \Sec} {\labeltext{u:nsec}} -\getvalue{\v!unit} [uSec] {\Micro \Sec} {\labeltext{u:usec}} -\getvalue{\v!unit} [mSec] {\Milli \Sec} {\labeltext{u:msec}} -\getvalue{\v!unit} [Year] {\ifSIunits a \else j\fi} {\labeltext{u:year}} -\getvalue{\v!unit} [Month] {m} {\labeltext{u:month}} -\getvalue{\v!unit} [Week] {w} {\labeltext{u:week}} -\getvalue{\v!unit} [Day] {d} {\labeltext{u:day}} -\getvalue{\v!unit} [Hour] {\ifSIunits h \else u\fi} {\labeltext{u:hour}} -\getvalue{\v!unit} [Min] {min} {\labeltext{u:min}} - -\setuplabeltext - [\s!nl] - [u:sec=seconde, - u:psec=picoseconde, - u:fsec=femtoseconde, - u:nsec=nanoseconde, - u:usec=microseconde, - u:msec=milliseconde, - u:year=jaar, - u:month=maand, - u:week=week, - u:day=dag, - u:hour=uur, - u:min=minuten] - -\setuplabeltext - [\s!en] - [u:sec=second, - u:fsec=femtosecond, - u:psec=picosecond, - u:nsec=nanosecond, - u:usec=microsecond, - u:msec=millisecond, - u:year=year, - u:month=month, - u:week=week, - u:day=day, - u:hour=hour, - u:min=minutes] - -\setuplabeltext - [\s!de] - [u:sec=Sekunde, - u:fsec=Femtosekunde, - u:psec=Picosekunde, - u:nsec=Nanosekunde, - u:usec=Microsekunde, - u:msec=Millisekunde, - u:year=Jahr, - u:month=Monat, - u:week=Woche, - u:day=Tag, - u:hour=Stunde, - u:min=Minuten] - -\setuplabeltext - [\s!it] - [u:sec=secondo, - u:fsec=femtosecondo, - u:psec=picosecondo, - u:nsec=nanosecondo, - u:usec=microsecondo, - u:msec=millisecondo, - u:year=anno, - u:month=mese, - u:week=settimana, - u:day=giorno, - u:hour=ora, - u:min=minuti] - -%D Then we define some angles. - -\getvalue{\v!unit} [Rad] {rad} {\labeltext{u:rad}} -\getvalue{\v!unit} [Deg] {{\mathematics{^\circ}}} {\labeltext{u:deg}} - -\setuplabeltext - [\s!nl] - [u:rad=hoek radialen, - u:deg=hoek graden] - -\setuplabeltext - [\s!en] - [u:rad=angle radians, - u:deg=angle degrees] - -\setuplabeltext - [\s!de] - [u:rad=Bogenma\SS, - u:deg=Gradma\SS] - -\setuplabeltext - [\s!it] - [u:rad=radianti, - u:deg=angoli sessagesimali] - -%D Rotation and frequency related units are defined by: - -\getvalue{\v!unit} [Hertz] {Hz} {Hertz} -\getvalue{\v!unit} [kHertz] {\Kilo \Hertz} {kilo Hertz} -\getvalue{\v!unit} [MHertz] {\Mega \Hertz} {mega Hertz} -\getvalue{\v!unit} [GHertz] {\Giga \Hertz} {giga Hertz} -\getvalue{\v!unit} [THertz] {\Tera \Hertz} {tera Hertz} -\getvalue{\v!unit} [mHertz] {\Milli \Hertz} {milli Hertz} - -\getvalue{\v!unit} [RevPerSec] {RPS} {\labeltext{u:rps}} -\getvalue{\v!unit} [RevPerMin] {RPM} {\labeltext{u:rpm}} - -\setuplabeltext - [\s!nl] - [u:rps=omwentelingen per seconde, - u:rpm=omwentelingen per minuut] - -\setuplabeltext - [\s!en] - [u:rps=revolutions per second, - u:rpm=revolutions per minute] - -\setuplabeltext - [\s!de] - [u:rps=Umdrehungen pro Sekunde, - u:rpm=Umdrehungen pro Minute] - -\setuplabeltext - [\s!it] - [u:rps=giri al secondo, - u:rpm=giri al minuto] - -%D Mass and force: - -\getvalue{\v!unit} [Gram] {g} {gram} -\getvalue{\v!unit} [uGram] {\Micro \Gram} {microgram} -\getvalue{\v!unit} [mGram] {\Milli \Gram} {milligram} -\getvalue{\v!unit} [kGram] {\Kilo \Gram} {kilogram} -\getvalue{\v!unit} [Atom] {u} {\labeltext{u:u}} - -\getvalue{\v!unit} [Newton] {N} {Newton} -\getvalue{\v!unit} [kNewton] {\Kilo \Newton} {kilo Newton} - -\getvalue{\v!unit} [Pascal] {Pa} {Pascal} -\getvalue{\v!unit} [mPascal] {\Milli \Pascal} {milli Pascal} -\getvalue{\v!unit} [kPascal] {\Kilo \Pascal} {kilo Pascal} - -\setuplabeltext - [\s!nl] - [u:u=atomaire massa eenheid] - -\setuplabeltext - [\s!en] - [u:u=atom mass unit] - -\setuplabeltext - [\s!de] - [u:u=Atomare Masseneinheit] - -\setuplabeltext - [\s!it] - [u:u=unit\`a di massa atomica] - -%D Energy units comes in two alternatives: - -\getvalue{\v!unit} [Joule] {J} {Joule} -\getvalue{\v!unit} [mJoule] {\Milli \Joule} {milli Joule} -\getvalue{\v!unit} [kJoule] {\Kilo \Joule} {kilo Joule} -\getvalue{\v!unit} [MJoule] {\Mega \Joule} {mega Joule} -\getvalue{\v!unit} [GJoule] {\Giga \Joule} {giga Joule} - -\getvalue{\v!unit} [Watt] {W} {Watt} -\getvalue{\v!unit} [mWatt] {\Milli \Watt} {milli Watt} -\getvalue{\v!unit} [kWatt] {\Kilo \Watt} {kilo Watt} -\getvalue{\v!unit} [MWatt] {\Mega \Watt} {mega Watt} -\getvalue{\v!unit} [GWatt] {\Giga \Watt} {giga Watt} -\getvalue{\v!unit} [TWatt] {\Tera \Watt} {tera Watt} - -%D Although Celsius is no longer permitted, we define it by -%D saying: - -\getvalue{\v!unit} [Celsius] {C} {Celsius} -\getvalue{\v!unit} [Kelvin] {K} {Kelvin} -\getvalue{\v!unit} [Fahrenheit] {F} {Fahrenheit} - -%D Some chemic related units are: - -\getvalue{\v!unit} [Mol] {mol} {mol} -\getvalue{\v!unit} [mMol] {\Milli \Mol} {millimol} -\getvalue{\v!unit} [kMol] {\Kilo \Mol} {kilomol} -\getvalue{\v!unit} [Molair] {M} {molair (\Mol \Per \Liter)} -\getvalue{\v!unit} [Equivalent] {eq} {equivalent} -\getvalue{\v!unit} [mEquivalent] {\Milli \Equivalent} {milli equivalent} - -%D There are quite a lot units related to electricity and -%D magnetism: - -\getvalue{\v!unit} [Farad] {F} {Farad} -\getvalue{\v!unit} [pFarad] {\Pico \Farad} {pico Farad} -\getvalue{\v!unit} [nFarad] {\Nano \Farad} {nano Farad} -\getvalue{\v!unit} [uFarad] {\Micro \Farad} {micro Farad} -\getvalue{\v!unit} [mFarad] {\Milli \Farad} {milli Farad} - -\getvalue{\v!unit} [Ohm] {\Omega} {Ohm} -\getvalue{\v!unit} [kOhm] {\Kilo \Ohm} {kilo Ohm} - -\getvalue{\v!unit} [Siemens] {S} {Siemens} - -\getvalue{\v!unit} [Ampere] {A} {Amp\`ere} -\getvalue{\v!unit} [mAmpere] {\Milli \Ampere} {milli Amp\`ere} - -\getvalue{\v!unit} [Coulomb] {C} {Coulomb} - -\getvalue{\v!unit} [Volt] {V} {Volt} -\getvalue{\v!unit} [mVolt] {\Milli \Volt} {milli Volt} -\getvalue{\v!unit} [kVolt] {\Kilo \Volt} {kilo Volt} -\getvalue{\v!unit} [eVolt] {eV} {electronvolt} -\getvalue{\v!unit} [keVolt] {\Kilo \eVolt} {kilo electronvolt} -\getvalue{\v!unit} [MeVolt] {\Mega \eVolt} {mega electronvolt} - -\getvalue{\v!unit} [Tesla] {T} {Tesla} - -\getvalue{\v!unit} [VoltAC] {V_{\xbox{ac}}} {\labeltext{u:vac}} -\getvalue{\v!unit} [VoltDC] {V_{\xbox{dc}}} {\labeltext{u:vdc}} - -\setuplabeltext - [\s!nl] - [u:vac=wisselspanning, - u:vdc=gelijkspanning] - -\setuplabeltext - [\s!en] - [u:vac=alternating current, - u:vdc=direct current] - -\setuplabeltext - [\s!de] - [u:vac=Wechselspannung, - u:vdc=Gleichspannung] - -\setuplabeltext - [\s!it] - [u:vac=corrente alternata, - u:vdc=corrente continua] - -%D Computer memory is specified in Bytes: - -\getvalue{\v!unit} [Baud] {Baud} {Baud (Bit/s)} -\getvalue{\v!unit} [Bit] {Bit} {Bit} - -\getvalue{\v!unit} [Byte] {Byte} {Byte} -\getvalue{\v!unit} [kByte] {\Kilo \Byte} {kilo Byte} -\getvalue{\v!unit} [MByte] {\Mega \Byte} {mega Byte} -\getvalue{\v!unit} [GByte] {\Giga \Byte} {giga Byte} -\getvalue{\v!unit} [TByte] {\Tera \Byte} {tera Byte} - -%D Some radiation related units: - -\getvalue{\v!unit} [Bequerel] {Bq} {Bequerel} -\getvalue{\v!unit} [MBequerel] {\Mega \Bequerel} {Bequerel} -\getvalue{\v!unit} [Sievert] {Sv} {Sievert} -\getvalue{\v!unit} [mSievert] {\Milli \Sievert} {milli Sievert} - -%D Light: - -\getvalue{\v!unit} [Candela] {cd} {Candela} - -%D and some sound ones: - -\getvalue{\v!unit} [Bell] {B} {Bell} -\getvalue{\v!unit} [dBell] {\Deci \Bell} {decibel} - -%D We also define some non||regular, sometimes even forbidden, -%D units: - -\getvalue{\v!unit} [At] {at} {\labeltext{u:at}} -\getvalue{\v!unit} [Atm] {atm} {\labeltext{u:atm}} -\getvalue{\v!unit} [Bar] {bar} {bar (100 \Kilo \Pascal)} -\getvalue{\v!unit} [EVolt] {eV} {electronvolt} -\getvalue{\v!unit} [Foot] {ft} {\labeltext{u:ft}} -\getvalue{\v!unit} [Inch] {inch} {inch} -\getvalue{\v!unit} [Cal] {cal} {\labeltext{u:cal}} -\getvalue{\v!unit} [Force] {f} {\labeltext{u:f}} -\getvalue{\v!unit} [kCal] {\Kilo \Cal} {\labeltext{u:kcal}} -\getvalue{\v!unit} [Lux] {lux} {lux} - - -\def\xPercent {\dimensionaddfix{\percent }} -\def\xPromille{\dimensionaddfix{\promille}} - -\getvalue{\v!unit} [Percent] {\xPercent } {percent} -\getvalue{\v!unit} [Permille] {\xPromille} {promille} -\getvalue{\v!unit} [Promille] {\xPromille} {promille} - -%D Some more, thanks to Tobias: - -\getvalue{\v!unit} [Gray] {Gr} {Gray} -\getvalue{\v!unit} [Weber] {Wb} {Weber} -\getvalue{\v!unit} [Henry] {H} {Henry} -\getvalue{\v!unit} [Sterant] {sr} {Sterant} -\getvalue{\v!unit} [Angstrom] {\hbox{\Aring}} {\Aring ngstr\"om} -\getvalue{\v!unit} [Gauss] {G} {Gauss} - -\setuplabeltext - [\s!nl] - [u:at=technische atmosfeer, - u:atm=fysische atmosfeer, - u:ft=voet, - u:cal=calorie, - u:f=kracht (force), - u:kcal=kilocalorie] - -\setuplabeltext - [\s!en] - [u:at=technical atmosferic pressure, - u:atm=physical atmosferic pressure, - u:ft=foot, - u:cal=calory, - u:f=force, - u:kcal=kilocalory] - -\setuplabeltext - [\s!de] - [u:at=Technischer atmosph\"arischer Druck, - u:atm=physkalischer atmosph\"arischer Druck - u:ft=Fu\SS, - u:cal=Kalorien, - u:f=Force, - u:kcal=Kilokalorien] - -\setuplabeltext - [\s!it] - [u:at=pressione atmosferica tecnica, - u:atm=pressione atmosfera fisica, - u:ft=piede, - u:cal=caloria, - u:f=forza, - u:kcal=chilocaloria] - -%D Here are some old ones, still there for compatibility -%D reasons. These will probably be obsolete in a few years. - -\def\MeterTwee {\Square \Meter} -\def\mMeterTwee {\Square \Milli \Meter} -\def\cMeterTwee {\Square \Centi \Meter} -\def\dMeterTwee {\Square \Deci \Meter} -\def\kMeterTwee {\Square \Kilo \Meter} - -\def\MeterDrie {\Cubic \Meter} -\def\mMeterDrie {\Cubic \Milli \Meter} -\def\cMeterDrie {\Kubic \Centi \Meter} -\def\dMeterDrie {\Cubic \Deci \Meter} -\def\kMeterDrie {\Cubic \Kilo \Meter} - -\def\LiterTwee {\Square \Liter} -\def\SecTwee {\Square \Sec} -\def\SecMinEen {\Inverse \Sec} - -%D To make ourselves happy, we define some dutch specific -%D units: - -\startinterface dutch - - \getvalue{\v!unit} [PaardenKracht] {pk} {paardenkracht} - \getvalue{\v!unit} [Duits] {D} {duits} - \getvalue{\v!unit} [Kwik] {Hg} {kwikkolom} - \getvalue{\v!unit} [Hectare] {ha} {hectare} - \getvalue{\v!unit} [kGramForce] {\Kilo \Gram \Force} {kilogramforce} - \getvalue{\v!unit} [kWattUur] {\Kilo \Watt \Uur} {kilowattuur} - \getvalue{\v!unit} [MeterKwik] {\Meter \Kwik} {meter kwikkolom} - \getvalue{\v!unit} [Waterkolom] {WK} {waterkolom} - \getvalue{\v!unit} [MeterWater] {\Meter \Waterkolom} {meter waterkolom} - \getvalue{\v!unit} [DrogeStof] {ds} {droge stof} - \getvalue{\v!unit} [Normaal] {N} {normaal} - - \getvalue{\v!unit} [Ton] {t} {ton} - \getvalue{\v!unit} [kTon] {\Kilo \Ton} {kiloton} - - \let \OmwPerSec \RevPerSec - \let \OmwPerMin \RevPerMin - \let \Graden \Deg - \let \PaardeKracht \PaardenKracht - \let \Atoom \Atom - \let \Heure \Hour - \let \Jaar \Year - \let \Maand \Month - \let \Dag \Day - \let \Uur \Hour - -\stopinterface - -%D Finally we define some equivalents. By using \type {\let} -%D we can be sure that they don't end up double in the lists of -%D units. - -\let \Second \Sec -\let \Kubic \Cubic -\let \IKubic \ICubic - -%D Option: - -% \def\Micro{\dimensionprefix{\iftextdimensions\mathematics\mu \else\mu \fi}} -% \def\Times{\dimensionnopfix{\iftextdimensions\mathematics\cdot\else\cdot\fi}} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/m-zint.mkiv b/Master/texmf-dist/tex/context/base/m-zint.mkiv new file mode 100644 index 00000000000..3e6f7ab4366 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/m-zint.mkiv @@ -0,0 +1,87 @@ +%D \module +%D [ file=m-zint, +%D version=2010.12.07, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=Zint Barcode Generator, +%D author=Hans Hagen, +%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 Using \type {zint} seems to be the easiest way to generate +%D (PDF417) barcodes so therefore we now have this module. There +%D are proper (also windows) binaries at: +%D +%D \starttyping +%D http://www.zint.org.uk +%D \stoptyping +%D +%D There is a bit more code than needed as we want to be able to +%D feed names. + +\startluacode + +moduledata.zint = { } + +local format, lower, gsub = string.format, string.lower, string.gsub +local patterns = lpeg.patterns + +local zint = "zint" -- '"c:/program files/zint/zint.exe"' + +local whitespace = patterns.whitespace +local spaces = whitespace^0 +local key = (spaces / "") * patterns.digit^0 * (patterns.colon * spaces / "") +local value = (whitespace / "" + (1 - key))^1 +local pattern = lpeg.Cf(lpeg.Ct("") * (lpeg.Cg((lpeg.Cs(key) / tonumber) * (lpeg.Cs(value) / lower)) + patterns.anything)^0,rawset) + +local reverse + +local function cleancode(code) + return lower(gsub(code," ","")) +end + +local function numberofcode(code) + if not reverse then + local types = os.resultof(format("%s --types",zint)) or "" + local formats = lpeg.match(pattern,types) + reverse = table.swapped(formats) or { } + end + code = cleancode(code) + return reverse[code] or code +end + +function moduledata.zint.generate(code,data,suffix,options) + if not data or data == "" then + data = "unset" + end + local code = cleancode(code) + local base = format("zint-%s-%s",code,md5.hex(data)) + local name = file.addsuffix(base,suffix or "eps") + if not lfs.isfile(name) then + local temp = file.addsuffix(base,"tmp") + local code = numberofcode(code) + logs.simple("using 'zint' to generate '%s'",base) + io.savedata(temp,data) + os.execute(format('%s --barcode=%s --output="%s" --input="%s"',zint,code,name,temp,options or "")) + end + return name +end + +\stopluacode + +\doifnotmode{demo}{\endinput} + +\starttext + + \externalfigure[\cldcontext{moduledata.zint.generate("PDF417",[[Hans Hagen]])}] + \blank + \externalfigure[\cldcontext{moduledata.zint.generate("PDF417","Ton Otten")}] + \blank + \externalfigure[\cldcontext{moduledata.zint.generate("ISBN","9789490688011")}] + +\stoptext + + diff --git a/Master/texmf-dist/tex/context/base/math-act.lua b/Master/texmf-dist/tex/context/base/math-act.lua new file mode 100644 index 00000000000..03675933e8a --- /dev/null +++ b/Master/texmf-dist/tex/context/base/math-act.lua @@ -0,0 +1,142 @@ +if not modules then modules = { } end modules ['math-act'] = { + version = 1.001, + comment = "companion to math-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local trace_defining = false trackers.register("math.defining", function(v) trace_defining = v end) +local report_math = logs.reporter("mathematics","initializing") + +local mathematics = mathematics + +local sequencers = utilities.sequencers +local appendgroup = sequencers.appendgroup +local appendaction = sequencers.appendaction +local mathprocessor = nil + +local mathactions = sequencers.reset { + arguments = "target,original", +} + +function fonts.constructors.assignmathparameters(original,target) + if mathactions.dirty then -- maybe use autocompile + mathprocessor = sequencers.compile(mathactions) + end + mathprocessor(original,target) +end + +appendgroup(mathactions,"before") -- user +appendgroup(mathactions,"system") -- private +appendgroup(mathactions,"after" ) -- user + +function mathematics.initializeparameters(target,original) + local mathparameters = original.mathparameters + if mathparameters and next(mathparameters) then + target.mathparameters = mathematics.dimensions(mathparameters) + end +end + +sequencers.appendaction(mathactions,"system","mathematics.initializeparameters") + +local how = { + -- RadicalKernBeforeDegree = "horizontal", + -- RadicalKernAfterDegree = "horizontal", + RadicalDegreeBottomRaisePercent = "unscaled" +} + +function mathematics.scaleparameters(target,original) + if not target.properties.math_is_scaled then + local mathparameters = target.mathparameters + if mathparameters and next(mathparameters) then + local parameters = target.parameters + local factor = parameters.factor + local hfactor = parameters.hfactor + local vfactor = parameters.vfactor + for name, value in next, mathparameters do + local h = how[name] + if h == "unscaled" then + mathparameters[name] = value + elseif h == "horizontal" then + mathparameters[name] = value * hfactor + elseif h == "vertical"then + mathparameters[name] = value * vfactor + else + mathparameters[name] = value * factor + end + end + end + target.properties.math_is_scaled = true + end +end + +sequencers.appendaction(mathactions,"system","mathematics.scaleparameters") + +function mathematics.checkaccentbaseheight(target,original) + local mathparameters = target.mathparameters + if mathparameters then + mathparameters.AccentBaseHeight = nil -- safeguard + end +end + +sequencers.appendaction(mathactions,"system","mathematics.checkaccentbaseheight") + +function mathematics.checkprivateparameters(target,original) + local mathparameters = target.mathparameters + if mathparameters then + if not mathparameters.FractionDelimiterSize then + mathparameters.FractionDelimiterSize = 0 + end + if not mathparameters.FractionDelimiterDisplayStyleSize then + mathparameters.FractionDelimiterDisplayStyleSize = 0 + end + end +end + +sequencers.appendaction(mathactions,"system","mathematics.checkprivateparameters") + +function mathematics.overloadparameters(target,original) + local mathparameters = target.mathparameters + if mathparameters and next(mathparameters) then + local goodies = target.goodies + if goodies then + for i=1,#goodies do + local goodie = goodies[i] + local mathematics = goodie.mathematics + local parameters = mathematics and mathematics.parameters + if parameters then + if trace_defining then + report_math("overloading math parameters in '%s' @ %s",target.properties.fullname,target.parameters.size) + end + for name, value in next, parameters do + local tvalue = type(value) + if tvalue == "string" then + report_math("comment for math parameter '%s': %s",name,value) + else + local oldvalue = mathparameters[name] + local newvalue = oldvalue + if oldvalue then + if tvalue == "number" then + newvalue = value + elseif tvalue == "function" then + newvalue = value(oldvalue,target,original) + elseif not tvalue then + newvalue = nil + end + if trace_defining and oldvalue ~= newvalue then + report_math("overloading math parameter '%s': %s => %s",name,tostring(oldvalue),tostring(newvalue)) + end + else + report_math("invalid math parameter '%s'",name) + end + mathparameters[name] = newvalue + end + end + end + end + end + end +end + +sequencers.appendaction(mathactions,"system","mathematics.overloadparameters") diff --git a/Master/texmf-dist/tex/context/base/math-ali.mkiv b/Master/texmf-dist/tex/context/base/math-ali.mkiv index 31f71219a44..f83619a2271 100644 --- a/Master/texmf-dist/tex/context/base/math-ali.mkiv +++ b/Master/texmf-dist/tex/context/base/math-ali.mkiv @@ -53,7 +53,7 @@ \def\textineqalign#1{$\forgetalign#1$} \def\eqalign#1% why no halign here, probably because of displaywidth - {\null\,\vcenter + {\emptyhbox\,\vcenter {\openup.25\bodyfontsize% was: \openup\jot \mathsurround\zeropoint \ialign{\strut\hfil$\displaystyle{##}$&$\displaystyle{{}##{}}$\hfil\crcr#1\crcr}% @@ -61,7 +61,7 @@ % preamble is scanned for tabskips so we need the span to prevent an error message -\chardef\eqalignmode\plusone +\setnewconstant\eqalignmode\plusone \def\preparereqalignno {\!!toksa{\strut\firstineqalign\hfil\leftofeqalign\span\mathineqalign{##}\rightofeqalign\tabskip\zeropoint}% @@ -73,7 +73,7 @@ \else \!!toksc{\hfil\tabskip\centering&\llap{\span\textineqalign{##}}\tabskip\zeropoint}% \fi\fi - \global\chardef\mathnumberstatus\zerocount + \global\mathnumberstatus\zerocount \buildeqalign \presetdisplaymath \tabskip\centering} @@ -89,7 +89,7 @@ \else \!!toksc{\hfil\tabskip\centering&\kern-\displaywidth\rlap{\span\textineqalign{##}}\tabskip\displaywidth}% \fi\fi - \global\chardef\mathnumberstatus\zerocount + \global\mathnumberstatus\zerocount \buildeqalign \presetdisplaymath \tabskip\centering} @@ -109,7 +109,7 @@ \def\dobothaligneqalignno#1% {\ifmmode \displ@y - \global\chardef\mathnumberstatus\plusone + \global\mathnumberstatus\plusone \ifcase\mathraggedstatus \def\finishalignno{\crcr\egroup}% \else @@ -127,12 +127,12 @@ \xdef\mathnumbercorrection{\the\wd\scratchbox}% \fi \box\scratchbox - \global\chardef\mathnumberstatus\plustwo} + \global\mathnumberstatus\plustwo} % \def\dobothaligneqalignno#1% % {\ifmmode % \displ@y -% \global\chardef\mathnumberstatus\plusone +% \global\mathnumberstatus\plusone % we're in a mathbox % \vcenter\bgroup % \def\finishalignno{\crcr\egroup\egroup}% @@ -193,8 +193,8 @@ \def\rightofeqalign{\getvalue{\??eq:\v!right:\number\eqaligncolumn}} \def\doseteqaligncolumn#1% - {\letvalue{\??eq:\v!left :\number\eqaligncolumn}\empty - \letvalue{\??eq:\v!right:\number\eqaligncolumn}\empty + {\letvalueempty{\??eq:\v!left :\number\eqaligncolumn}% + \letvalueempty{\??eq:\v!right:\number\eqaligncolumn}% \doif{#1}\v!left {\letvalue{\??eq:\v!right:\number\eqaligncolumn}\hfill}% \doif{#1}\v!right {\letvalue{\??eq:\v!left :\number\eqaligncolumn}\hfill}% \doif{#1}\v!middle{\letvalue{\??eq:\v!right:\number\eqaligncolumn}\hfill @@ -611,7 +611,7 @@ \def\dodefinemathmatrix[#1]% [#2]% {\setuvalue{\e!start#1}{\dodoubleempty\dostartmathmatrix[#1]}% - \setuvalue{\e!stop #1}{\dostopmathmatrix}% + \setvalue {\e!stop #1}{\dostopmathmatrix}% no u else lookahead problem \setupmathmatrix[#1]}% [#2] \definemathmatrix[matrix] @@ -696,7 +696,7 @@ {\begingroup \edef\currentmathmatrix{#1}% \doifassignmentelse{#2}{\setupmathmatrix[#1][#2]}\donothing - \null + \emptyhbox \executeifdefined{\??mx:\mathmatrixparameter\c!location}{\getvalue{\??mx:\v!lohi}}% \mathmatrixleft \mathmatrixbox\bgroup @@ -857,8 +857,13 @@ %D Preliminary feature: %D %D {\em example code} +%D +%D The intertext commands have to be expandable (in aligment lookahead) so +%D we cannot use \type {\unexpanded}. + +\let\stopintertext\relax -\unexpanded\def\startintertext#1\stopintertext +\def\startintertext#1\stopintertext {\noalign{\dointertext{#1}}} \def\intertext#1% @@ -890,7 +895,7 @@ % \unexpanded\def\startsubstack % {\begingroup -% \null +% \emptyhbox % \vcenter\bgroup % \pushmacro\domatrixNC % \let\stopmathmode\relax @@ -1038,11 +1043,11 @@ \unexpanded\def\overset#1#2% {\preparebinrel{#2}% - \currentbinrel{\mathop{\kern\zeropoint#2}\limits^{#1}}} + \currentbinrel{\mathop{\kern\zeropoint#2}\limits\normalsuperscript{#1}}} \unexpanded\def\underset#1#2% {\preparebinrel{#2}% - \currentbinrel{\mathop{\kern\zeropoint#2}\limits_{#1}}} + \currentbinrel{\mathop{\kern\zeropoint#2}\limits\normalsubscript{#1}}} %D The following code comes from \type {math-str.mkiv}. @@ -1069,14 +1074,15 @@ \def\mathhbox {\iftracemath\ruledhbox\else\hbox\fi} -\chardef\mathraggedstatus=0 % normal left center right -\chardef\mathnumberstatus=0 % nothing normal shift_right +\newconstant\mathraggedstatus % normal left center right +\newconstant\mathnumberstatus % nothing normal shift_right + \let\mathnumbercorrection\!!zeropoint \unexpanded\def\startmathbox#1% {\hsize\displaywidth - \global\chardef\mathnumberstatus\plusone - \chardef\mathraggedstatus#1\relax + \global\mathnumberstatus\plusone + \mathraggedstatus#1\relax \let\mathnumbercorrection\!!zeropoint \global\let\@eqno \empty \def\eqno {\gdef\@eqno }% \global\let\@leqno\empty \def\leqno{\gdef\@leqno}% diff --git a/Master/texmf-dist/tex/context/base/math-arr.mkiv b/Master/texmf-dist/tex/context/base/math-arr.mkiv index 389112b1694..31f8a66eba5 100644 --- a/Master/texmf-dist/tex/context/base/math-arr.mkiv +++ b/Master/texmf-dist/tex/context/base/math-arr.mkiv @@ -52,15 +52,15 @@ \endgroup} \def\mthfrac#1#2#3#4#5{\mathchoice - {\domthfrac\displaystyle \textface {#1}{#2}{#3}{#4}{#5}} - {\domthfrac\textstyle \textface {#1}{#2}{#3}{#4}{#5}} - {\domthfrac\scriptstyle \scriptface {#1}{#2}{#3}{#4}{#5}} + {\domthfrac\displaystyle \textface {#1}{#2}{#3}{#4}{#5}}% + {\domthfrac\textstyle \textface {#1}{#2}{#3}{#4}{#5}}% + {\domthfrac\scriptstyle \scriptface {#1}{#2}{#3}{#4}{#5}}% {\domthfrac\scriptscriptstyle\scriptscriptface{#1}{#2}{#3}{#4}{#5}}} \def\mthsqrt#1#2#3{\mathchoice - {\domthsqrt\displaystyle \textface {#1}{#2}{#3}} - {\domthsqrt\textstyle \textface {#1}{#2}{#3}} - {\domthsqrt\scriptstyle \textface {#1}{#2}{#3}} + {\domthsqrt\displaystyle \textface {#1}{#2}{#3}}% + {\domthsqrt\textstyle \textface {#1}{#2}{#3}}% + {\domthsqrt\scriptstyle \textface {#1}{#2}{#3}}% {\domthsqrt\scriptscriptstyle\textface {#1}{#2}{#3}}} % temp here @@ -114,7 +114,7 @@ $}% \ifdim\wd2>\dimen0 \dimen0\wd2 \fi \setbox4\hbox to \dimen0{#3\displaystyle}% - \mathrel{\mathop{\hbox to \dimen0{\hss\copy4\hss}}\limits^{\box0}_{\box2}} + \mathrel{\mathop{\hbox to \dimen0{\hss\copy4\hss}}\limits\normalsuperscript{\box0}\normalsubscript{\box2}}% \endgroup} \let\domthxarrsingle\domthxarr diff --git a/Master/texmf-dist/tex/context/base/math-def.mkiv b/Master/texmf-dist/tex/context/base/math-def.mkiv index 50c9902dde8..a7e0df94030 100644 --- a/Master/texmf-dist/tex/context/base/math-def.mkiv +++ b/Master/texmf-dist/tex/context/base/math-def.mkiv @@ -15,16 +15,14 @@ \unprotect -\ifx\mrfam\undefined \chardef\mrfam\plusone \fi +% this will be done at the lua end \startluacode mathematics.define() - mathematics.register_xml_entities() + mathematics.xml.registerentities() \stopluacode -% special .. todo - -\mathcode`\ ="8000 \mathcode`\_="8000 \mathcode`\'="8000 +\activatemathcharacters % will be attributes @@ -108,10 +106,12 @@ % using attributes -\chardef\bigmathdelimitermethod\plusone +\setnewconstant\bigmathdelimitermethod\plusone \def\plainbigdelimiters % traditional method - {\chardef\bigmathdelimitermethod\plustwo} + {\bigmathdelimitermethod\plustwo} + +\plainbigdelimiters % is default for the moment but not so nice \def\doplainbigmath#1#2% {{\hbox{$% @@ -234,7 +234,7 @@ \def\rootwithoutdegree {\rootradical {}} \def\PLAINmatrix#1% - {\null\,\vcenter{\normalbaselines\mathsurround\zeropoint + {\emptyhbox\,\vcenter{\normalbaselines\mathsurround\zeropoint \ialign{\hfil$##$\hfil&&\quad\hfil$##$\hfil\crcr \mathstrut\crcr\noalign{\kern-\baselineskip} #1\crcr\mathstrut\crcr\noalign{\kern-\baselineskip}}}\,} diff --git a/Master/texmf-dist/tex/context/base/math-dim.lua b/Master/texmf-dist/tex/context/base/math-dim.lua index 62d805126f8..7b4b49f6860 100644 --- a/Master/texmf-dist/tex/context/base/math-dim.lua +++ b/Master/texmf-dist/tex/context/base/math-dim.lua @@ -6,12 +6,20 @@ if not modules then modules = { } end modules ['math-dim'] = { license = "see context related readme files" } --- Beware: only Taco really understands in depth what these dimensions do so --- if you run into problems ... +-- Beware: only Taco and Ulrik really understands in depth what these dimensions +-- do so if you run into problems ask on the context list. -local abs, next = math.abs, next +-- The radical_rule value is also used as a trigger. In luatex the accent +-- placement happens either the opentype way (using top_accent cum suis) or the +-- traditional way. In order to determine what method to use the \Umathradicalrule +-- setting is consulted to determine what method to use. This is more efficient +-- than analyzing the (potentially spread over multiple families) situation. For +-- this reason we need to set the radical_rule here. It used to be "" in +-- which case the engine takes the rulethickness. In c-speak: +-- +-- int compat_mode = (radical_rule(cur_style) == undefined_math_parameter) ; -mathematics = mathematics or { } +local abs, next = math.abs, next local defaults = { ['axis']={ @@ -87,7 +95,8 @@ local defaults = { ['default']={ "RadicalExtraAscender", "default_rule_thickness" }, }, ['radical_rule']={ - ['default']={ "RadicalRuleThickness", "" }, + ['default']={ "RadicalRuleThickness", "default_rule_thickness" }, + -- ['default']={ "surd_height(f)", "default_rule_thickness" }, }, ['radical_vgap']={ ['default']={ "RadicalVerticalGap", "default_rule_thickness+(abs(default_rule_thickness)/4)" }, @@ -207,10 +216,10 @@ end -- return t.default or t.text_style or 0 -- end -function mathematics.dimensions(dimens) +function mathematics.dimensions(dimens) -- beware, dimens get spoiled if dimens.SpaceAfterScript then dimens.SubscriptShiftDownWithSuperscript = dimens.SubscriptShiftDown * 1.5 - return { }, table.fastcopy(dimens) + return table.fastcopy(dimens), { } elseif dimens.AxisHeight or dimens.axis_height then local t = { } local math_x_height = dimens.x_height or 10*65526 @@ -249,10 +258,12 @@ function mathematics.dimensions(dimens) end t[variable] = tt end ---~ logs.report("warning", "version 0.47 is needed for proper delimited math") local d = { - AxisHeight = t . axis . text_style, AccentBaseHeight = t . accent_base_height . text_style, + AxisHeight = t . axis . text_style, + -- DelimitedSubFormulaMinHeight + -- DisplayOperatorMinHeight + -- FlattenedAccentBaseHeight FractionDenominatorDisplayStyleGapMin = t . fraction_denom_vgap . display_style, FractionDenominatorDisplayStyleShiftDown = t . fraction_denom_down . display_style, FractionDenominatorGapMin = t . fraction_denom_vgap . text_style, @@ -266,6 +277,8 @@ function mathematics.dimensions(dimens) FractionDelimiterDisplayStyleSize = t . fraction_del_size . display_style, LowerLimitBaselineDropMin = t . limit_below_bgap . text_style, LowerLimitGapMin = t . limit_below_vgap . text_style, + -- MathLeading + MinConnectorOverlap = t . connector_overlap_min . text_style, OverbarExtraAscender = t . overbar_kern . text_style, OverbarRuleThickness = t . overbar_rule . text_style, OverbarVerticalGap = t . overbar_vgap . text_style, @@ -276,6 +289,10 @@ function mathematics.dimensions(dimens) RadicalKernBeforeDegree = t . radical_degree_before . display_style, RadicalKernAfterDegree = t . radical_degree_after . display_style, RadicalDegreeBottomRaisePercent = t . radical_degree_raise . display_style, + -- ScriptPercentScaleDown + -- ScriptScriptPercentScaleDown + -- SkewedFractionHorizontalGap + -- SkewedFractionVerticalGap SpaceAfterScript = t . space_after_script . text_style, StackBottomDisplayStyleShiftDown = t . stack_denom_down . display_style, StackBottomShiftDown = t . stack_denom_down . text_style, @@ -283,11 +300,15 @@ function mathematics.dimensions(dimens) StackGapMin = t . stack_vgap . text_style, StackTopDisplayStyleShiftUp = t . stack_num_up . display_style, StackTopShiftUp = t . stack_num_up . text_style, + StretchStackGapBelowMin = t . over_delimiter_vgap . text_style, + StretchStackTopShiftUp = t . over_delimiter_bgap . text_style, + StretchStackGapAboveMin = t . under_delimiter_vgap . text_style, + StretchStackBottomShiftDown = t . under_delimiter_bgap . text_style, + SubSuperscriptGapMin = t . subsup_vgap . text_style, SubscriptBaselineDropMin = t . sub_shift_drop . text_style, SubscriptShiftDown = t . sub_shift_down . text_style, SubscriptShiftDownWithSuperscript = t . sub_sup_shift_down . text_style, SubscriptTopMax = t . sub_top_max . text_style, - SubSuperscriptGapMin = t . subsup_vgap . text_style, SuperscriptBaselineDropMax = t . sup_shift_drop . text_style, SuperscriptBottomMaxWithSubscript = t . sup_sub_bottom_max . text_style, SuperscriptBottomMin = t . sup_bottom_min . text_style, @@ -298,14 +319,9 @@ function mathematics.dimensions(dimens) UnderbarVerticalGap = t . underbar_vgap . text_style, UpperLimitBaselineRiseMin = t . limit_above_bgap . text_style, UpperLimitGapMin = t . limit_above_vgap . text_style, - MinConnectorOverlap = t . connector_overlap_min . text_style, - StretchStackGapBelowMin = t . over_delimiter_vgap . text_style, - StretchStackTopShiftUp = t . over_delimiter_bgap . text_style, - StretchStackGapAboveMin = t . under_delimiter_vgap . text_style, - StretchStackBottomShiftDown = t . under_delimiter_bgap . text_style, } - d.AccentBaseHeight = 0 - return t, d -- this might change + d.AccentBaseHeight = 0 -- here? still? + return d, t -- t only for diagnostics else return { }, { } end diff --git a/Master/texmf-dist/tex/context/base/math-ent.lua b/Master/texmf-dist/tex/context/base/math-ent.lua index e5e5b98f004..0eaa02939fe 100644 --- a/Master/texmf-dist/tex/context/base/math-ent.lua +++ b/Master/texmf-dist/tex/context/base/math-ent.lua @@ -5,7 +5,9 @@ if not modules then modules = { } end modules ['math-ent'] = { copyright = "derived from the mathml 2.0 specification", } -mathematics.entities={ +-- this might go into char-def + +mathematics.xml.entities = utilities.storage.allocate { ["Aacute"]=0x000C1, ["aacute"]=0x000E1, ["Abreve"]=0x00102, @@ -2098,5 +2100,4 @@ mathematics.entities={ ["plusminus"]=0x000B1, ["minusplus"]=0x02213, ["cdots"]=0x2026, - } diff --git a/Master/texmf-dist/tex/context/base/math-ext.lua b/Master/texmf-dist/tex/context/base/math-ext.lua index 673103677e0..da00c7a9ea8 100644 --- a/Master/texmf-dist/tex/context/base/math-ext.lua +++ b/Master/texmf-dist/tex/context/base/math-ext.lua @@ -8,72 +8,73 @@ if not modules then modules = { } end modules ['math-ext'] = { local trace_virtual = false trackers.register("math.virtual", function(v) trace_virtual = v end) -mathematics = mathematics or { } -characters = characters or { } +local mathematics = mathematics +local characters = characters + +local report_math = logs.reporter("mathematics") mathematics.extras = mathematics.extras or { } -characters.math = characters.math or { } +local extras = mathematics.extras -local chardata = characters.data -local mathdata = characters.math +characters.math = characters.math or { } +local mathdata = characters.math +local chardata = characters.data -function mathematics.extras.add(unicode,t) +function extras.add(unicode,t) local min, max = mathematics.extrabase, mathematics.privatebase - 1 if unicode >= min and unicode <= max then mathdata[unicode], chardata[unicode] = t, t else - logs.report("math extra","extra U+%04X should be in range U+%04X - U+%04X",unicode,min,max) + report_math("extra U+%05X should be in range U+%05X - U+%05X",unicode,min,max) end end -function mathematics.extras.copy(tfmdata) - local math_parameters = tfmdata.math_parameters - local MathConstants = tfmdata.MathConstants - if (math_parameters and next(math_parameters)) or (MathConstants and next(MathConstants)) then - local characters = tfmdata.characters - for unicode, extradesc in next, mathdata do - -- always, because in an intermediate step we can have a non math font - local extrachar = characters[unicode] - local nextinsize = extradesc.nextinsize - if nextinsize then - for i=1,#nextinsize do - local nextslot = nextinsize[i] - local nextbase = characters[nextslot] - if nextbase then - local nextnext = nextbase and nextbase.next - if nextnext then - local nextchar = characters[nextnext] - if nextchar then - if trace_virtual then - logs.report("math extra","extra U+%04X in %s at %s maps on U+%04X (class: %s, name: %s)",unicode,file.basename(tfmdata.fullname),tfmdata.size,nextslot,extradesc.mathclass or "?",extradesc.mathname or "?") - end - characters[unicode] = nextchar - break +function extras.copy(target,original) + local characters = target.characters + local properties = target.properties + local parameters = target.parameters + for unicode, extradesc in next, mathdata do + -- always, because in an intermediate step we can have a non math font + local extrachar = characters[unicode] + local nextinsize = extradesc.nextinsize + if nextinsize then + for i=1,#nextinsize do + local nextslot = nextinsize[i] + local nextbase = characters[nextslot] + if nextbase then + local nextnext = nextbase and nextbase.next + if nextnext then + local nextchar = characters[nextnext] + if nextchar then + if trace_virtual then + report_math("extra U+%05X in %s at %s maps on U+%05X (class: %s, name: %s)",unicode, + file.basename(properties.fullname),parameters.size,nextslot,extradesc.mathclass or "?",extradesc.mathname or "?") end - end - end - end - if not characters[unicode] then - for i=1,#nextinsize do - local nextbase = characters[nextinsize[i]] - if nextbase then characters[unicode] = nextchar break end end end end + if not characters[unicode] then -- can be set in previous loop + for i=1,#nextinsize do + local nextslot = nextinsize[i] + local nextbase = characters[nextslot] + if nextbase then + characters[unicode] = nextbase -- still ok? + break + end + end + end end - else - -- let's not waste time on non-math end end -table.insert(fonts.tfm.mathactions,mathematics.extras.copy) +utilities.sequencers.appendaction(mathactions,"system","mathematics.extras.copy") -- 0xFE302 -- 0xFE320 for accents -mathematics.extras.add(0xFE302, { +extras.add(0xFE302, { category="mn", description="WIDE MATHEMATICAL HAT", direction="nsm", @@ -85,7 +86,7 @@ mathematics.extras.add(0xFE302, { nextinsize={ 0x00302, 0x0005E }, } ) -mathematics.extras.add(0xFE303, { +extras.add(0xFE303, { category="mn", cjkwd="a", description="WIDE MATHEMATICAL TILDE", @@ -100,7 +101,7 @@ mathematics.extras.add(0xFE303, { -- 0xFE321 -- 0xFE340 for missing characters -mathematics.extras.add(0xFE321, { +extras.add(0xFE321, { category="sm", description="MATHEMATICAL SHORT BAR", -- direction="on", @@ -110,7 +111,7 @@ mathematics.extras.add(0xFE321, { unicodeslot=0xFE321, } ) -mathematics.extras.add(0xFE322, { +extras.add(0xFE322, { category="sm", description="MATHEMATICAL LEFT HOOK", mathclass="relation", @@ -118,7 +119,7 @@ mathematics.extras.add(0xFE322, { unicodeslot=0xFE322, } ) -mathematics.extras.add(0xFE323, { +extras.add(0xFE323, { category="sm", description="MATHEMATICAL RIGHT HOOK", mathclass="relation", @@ -126,7 +127,17 @@ mathematics.extras.add(0xFE323, { unicodeslot=0xFE323, } ) ---~ mathematics.extras.add(0xFE304, { +extras.add(0xFE324, { + category="sm", + description="MATHEMATICAL SHORT BAR MIRRORED", +-- direction="on", +-- linebreak="nu", + mathclass="relation", + mathname="mapsfromchar", + unicodeslot=0xFE324, +} ) + +--~ extras.add(0xFE304, { --~ category="sm", --~ description="TOP AND BOTTOM PARENTHESES", --~ direction="on", @@ -137,7 +148,7 @@ mathematics.extras.add(0xFE323, { --~ accents={ 0x023DC, 0x023DD }, --~ } ) ---~ mathematics.extras.add(0xFE305, { +--~ extras.add(0xFE305, { --~ category="sm", --~ description="TOP AND BOTTOM BRACES", --~ direction="on", diff --git a/Master/texmf-dist/tex/context/base/math-frc.mkii b/Master/texmf-dist/tex/context/base/math-frc.mkii index fa319bc4ad4..767c5ec5cea 100644 --- a/Master/texmf-dist/tex/context/base/math-frc.mkii +++ b/Master/texmf-dist/tex/context/base/math-frc.mkii @@ -15,7 +15,8 @@ \unprotect -\def\exmthfont#1{\symbolicsizedfont#1\plusone{MathExtension}} +\unexpanded\def\exmthfont#1% + {\symbolicsizedfont#1\plusone{MathExtension}} \def\domthfrac#1#2#3#4#5#6#7% {\begingroup @@ -49,18 +50,204 @@ \rlap{\raise\dimexpr\ht2-\ht4\relax\copy4}\copy0}}}% \endgroup} -\def\mthfrac#1#2#3#4#5{\mathchoice +\unexpanded\def\mthfrac#1#2#3#4#5{\mathchoice {\domthfrac\displaystyle \textface {#1}{#2}{#3}{#4}{#5}} {\domthfrac\textstyle \textface {#1}{#2}{#3}{#4}{#5}} {\domthfrac\scriptstyle \scriptface {#1}{#2}{#3}{#4}{#5}} {\domthfrac\scriptscriptstyle\scriptscriptface{#1}{#2}{#3}{#4}{#5}}} -\def\mthsqrt#1#2#3{\mathchoice +\unexpanded\def\mthsqrt#1#2#3{\mathchoice {\domthsqrt\displaystyle \textface {#1}{#2}{#3}} {\domthsqrt\textstyle \textface {#1}{#2}{#3}} {\domthsqrt\scriptstyle \textface {#1}{#2}{#3}} {\domthsqrt\scriptscriptstyle\textface {#1}{#2}{#3}}} -% temp here +%D Moved from math-new.tex (not that new anyway: + +%D \macros +%D {genfrac} +%D +%D [TH] The definition of \type {\genfrac} \& co. is not +%D trivial, because it allows some flexibility. This is +%D supposed to be a user||level command, but will fail quite +%D desparately if called outside math mode (\CONTEXT\ redefines +%D \type {\over}) +%D +%D [HH] We clean up this macro a bit and (try) to make it +%D understandable. The expansion is needed for generating +%D the second argument to \type {\dogenfrac}, which is to +%D be a control sequence like \type {\over}. + +\unexpanded\def\genfrac#1#2#3#4% + {\edef\!!stringa + {#1#2}% + \expanded + {\dogenfrac{#4}% + \csname + \ifx @#3@% + \ifx\!!stringa\empty + \strippedcsname\normalover + \else + \strippedcsname\normaloverwithdelims + \fi + \else + \ifx\!!stringa\empty + \strippedcsname\normalabove + \else + \strippedcsname\normalabovewithdelims + \fi + \fi + \endcsname}% + {#1#2#3}} + +\def\dogenfrac#1#2#3#4#5% + {{#1{\begingroup#4\endgroup#2#3\relax#5}}} + +%D \macros +%D {dfrac, tfrac, frac, dbinom, tbinom, binom} +%D +%D \startbuffer +%D $\dfrac {1}{2} \tfrac {1}{2} \frac {1}{2}$ +%D $\dbinom{1}{2} \tbinom{1}{2} \binom{1}{2}$ +%D \stopbuffer +%D +%D \typebuffer +%D +%D \getbuffer + +\unexpanded\def\dfrac {\genfrac\empty\empty{}\displaystyle} +\unexpanded\def\tfrac {\genfrac\empty\empty{}\textstyle} +\unexpanded\def\frac {\genfrac\empty\empty{}\donothing} + +\unexpanded\def\dbinom{\genfrac()\zeropoint\displaystyle} +\unexpanded\def\tbinom{\genfrac()\zeropoint\textstyle} +\unexpanded\def\binom {\genfrac()\zeropoint\donothing} + +\unexpanded\def\xfrac {\genfrac\empty\empty{}\scriptstyle} +\unexpanded\def\xxfrac{\genfrac\empty\empty{}\scriptscriptstyle} + +\unexpanded\def\frac#1#2{\mathematics{\genfrac\empty\empty{}\donothing{#1}{#2}}} + +%D \macros +%D {cfrac} +%D +%D \startbuffer +%D $\cfrac{12}{3} \cfrac[l]{12}{3} \cfrac[c]{12}{3} \cfrac[r]{12}{3}$ +%D $\cfrac{1}{23} \cfrac[l]{1}{23} \cfrac[c]{1}{23} \cfrac[r]{1}{23}$ +%D \stopbuffer +%D +%D \typebuffer +%D +%D \getbuffer +%D +%D Now we can align every combination we want: +%D +%D \startbuffer +%D $\cfrac{12}{3} \cfrac[l]{12}{3} \cfrac[c]{12}{3} \cfrac[r]{12}{3}$ +%D $\cfrac{1}{23} \cfrac[l]{1}{23} \cfrac[c]{1}{23} \cfrac[r]{1}{23}$ +%D $\cfrac[cl]{12}{3} \cfrac[cc]{12}{3} \cfrac[cr]{12}{3}$ +%D $\cfrac[lc]{1}{23} \cfrac[cc]{1}{23} \cfrac[rc]{1}{23}$ +%D \stopbuffer +%D +%D \typebuffer +%D +%D \getbuffer + +\definecomplexorsimple\cfrac + +\def\simplecfrac {\docfrac[cc]} +\def\complexcfrac[#1]{\docfrac[#1cc]} + +\def\docfrac[#1#2#3]#4#5% + {{\displaystyle + \frac + {\strut + \ifx r#1\hfill\fi#4\ifx l#1\hfill\fi}% + {\ifx r#2\hfill\fi#5\ifx l#2\hfill\fi}% + \kern-\nulldelimiterspace}} + +%D \macros +%D {splitfrac, splitdfrac} +%D +%D Occasionally one needs to typeset multi||line fractions. +%D These commands use \tex{genfrac} to create such fractions. +%D +%D \startbuffer +%D \startformula +%D a=\frac{ +%D \splitfrac{xy + xy + xy + xy + xy} +%D {+ xy + xy + xy + xy} +%D } +%D {z} +%D =\frac{ +%D \splitdfrac{xy + xy + xy + xy + xy} +%D {+ xy + xy + xy + xy} +%D } +%D {z} +%D \stopformula +%D \stopbuffer +%D +%D \typebuffer \getbuffer +%D +%D These macros are based on Michael J.~Downes posting on +%D comp.text.tex on 2001/12/06 + +\unexpanded\def\splitfrac#1#2% + {\genfrac\empty\empty\zeropoint\textstyle% + {\textstyle#1\quad\hfill}% + {\textstyle\hfill\quad\mathstrut#2}} + +\unexpanded\def\splitdfrac#1#2% + {\genfrac\empty\empty\zeropoint\displaystyle% + {#1\quad\hfill} + {\hfill\quad\mathstrut #2}} + +%D For thee moment here, but it might move: + +%D \macros +%D {qedsymbol} +%D +%D [HH] The general Quod Erat Domonstrandum symbol is defined +%D in such a way that we can configure it. Because this symbol +%D is also used in text mode, we make it a normal text symbol +%D with special behavior. + +\unexpanded\def\qedsymbol#1% + {\ifhmode + \unskip~\hfill#1\par + \else\ifmmode + \eqno#1\relax % Do we really need the \eqno here? + \else + \leavevmode\hbox{}\hfill#1\par + \fi\fi} + +\definesymbol [qed] [\qedsymbol{\mathematics{\square}}] + +%D \macros +%D {QED} +%D +%D [HH] For compatbility reasons we also provide the \type +%D {\QED} command. In case this command is overloaded, we still +%D have the symbol available. \symbol[qed] + +\unexpanded\def\QED{\symbol[qed]} + +%D \macros +%D {mathhexbox} +%D +%D [TH] \type {\mathhexbox} is also user||level (already +%D defined in Plain \TEX). It allows to get a math character +%D inserted as if it was a text character. + +\unexpanded\def\mathhexbox#1#2#3% + {\mathtext{$\mathsurround\zeropoint\mathchar"#1#2#3$}} + +%D \macros +%D {boxed} +%D +%D [HH] Another macro that users expect (slightly adapted): + +\unexpanded\def\boxed + {\ifmmode\expandafter\mframed\else\expandafter\framed\fi} \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/math-frc.mkiv b/Master/texmf-dist/tex/context/base/math-frc.mkiv index 2305cec3095..f6331126f51 100644 --- a/Master/texmf-dist/tex/context/base/math-frc.mkiv +++ b/Master/texmf-dist/tex/context/base/math-frc.mkiv @@ -71,14 +71,16 @@ \def\dofrac#1#2#3{\relax\mathematics{\Ustack{{#1{#2}}\normalover{#1{#3}}}}} \def\nofrac #1#2{\relax\mathematics{\Ustack{{#1}\normalover{#2}}}} -% \chardef\mathfracmode=0 $\frac{1}{2}$ -% \chardef\mathfracmode=1 $\frac{1}{2}$ -% \chardef\mathfracmode=2 $\frac{1}{2}$ -% \chardef\mathfracmode=3 $\frac{1}{2}$ -% \chardef\mathfracmode=4 $\frac{1}{2}$ -% \chardef\mathfracmode=5 $\frac{1}{2}$ +% $\mathfracmode0 \frac{1}{2}$ +% $\mathfracmode1 \frac{1}{2}$ +% $\mathfracmode2 \frac{1}{2}$ +% $\mathfracmode3 \frac{1}{2}$ +% $\mathfracmode4 \frac{1}{2}$ +% $\mathfracmode5 \frac{1}{2}$ -\chardef\mathfracmode=0 % 0=auto, 1=displaystyle, 2=textstyle, 3=scriptstyle, 4=scriptscriptstyle, 5=mathstyle +% 0=auto, 1=displaystyle, 2=textstyle, 3=scriptstyle, 4=scriptscriptstyle, 5=mathstyle + +\setnewconstant\mathfracmode\zerocount \unexpanded\def\frac {\ifcase\mathfracmode @@ -151,14 +153,15 @@ \bgroup -\catcode`\/=\@@other \global \let\normalforwardslash/ -\catcode`\/=\@@active \doglobal\appendtoks\let/\normalforwardslash\to\everymathematics +\catcode`\/=\othercatcode \global \let\normalforwardslash/ +\catcode`\/=\activecatcode \doglobal\appendtoks\let/\normalforwardslash\to\everymathematics \egroup % to be checked: -\def\exmthfont#1{\symbolicsizedfont#1\plusone{MathExtension}} +\unexpanded\def\exmthfont#1% + {\symbolicsizedfont#1\plusone{MathExtension}} \def\domthfrac#1#2#3#4#5#6#7% {\begingroup @@ -192,18 +195,204 @@ \rlap{\raise\dimexpr\ht2-\ht4\relax\copy4}\copy0}}}% \endgroup} -\def\mthfrac#1#2#3#4#5{\mathchoice +\unexpanded\def\mthfrac#1#2#3#4#5{\mathchoice {\domthfrac\displaystyle \textface {#1}{#2}{#3}{#4}{#5}} {\domthfrac\textstyle \textface {#1}{#2}{#3}{#4}{#5}} {\domthfrac\scriptstyle \scriptface {#1}{#2}{#3}{#4}{#5}} {\domthfrac\scriptscriptstyle\scriptscriptface{#1}{#2}{#3}{#4}{#5}}} -\def\mthsqrt#1#2#3{\mathchoice +\unexpanded\def\mthsqrt#1#2#3{\mathchoice {\domthsqrt\displaystyle \textface {#1}{#2}{#3}} {\domthsqrt\textstyle \textface {#1}{#2}{#3}} {\domthsqrt\scriptstyle \textface {#1}{#2}{#3}} {\domthsqrt\scriptscriptstyle\textface {#1}{#2}{#3}}} -% temp here +%D Moved from math-new.tex (not that new anyway): + +%D \macros +%D {genfrac} +%D +%D [TH] The definition of \type {\genfrac} \& co. is not +%D trivial, because it allows some flexibility. This is +%D supposed to be a user||level command, but will fail quite +%D desparately if called outside math mode (\CONTEXT\ redefines +%D \type {\over}) +%D +%D [HH] We clean up this macro a bit and (try) to make it +%D understandable. The expansion is needed for generating +%D the second argument to \type {\dogenfrac}, which is to +%D be a control sequence like \type {\over}. + +\unexpanded\def\genfrac#1#2#3#4% + {\edef\!!stringa + {#1#2}% + \expanded + {\dogenfrac{#4}% + \csname + \ifx @#3@% + \ifx\!!stringa\empty + \strippedcsname\normalover + \else + \strippedcsname\normaloverwithdelims + \fi + \else + \ifx\!!stringa\empty + \strippedcsname\normalabove + \else + \strippedcsname\normalabovewithdelims + \fi + \fi + \endcsname}% + {#1#2#3}} + +\def\dogenfrac#1#2#3#4#5% + {{#1{\begingroup#4\endgroup#2#3\relax#5}}} + +%D \macros +%D {dfrac, tfrac, frac, dbinom, tbinom, binom} +%D +%D \startbuffer +%D $\dfrac {1}{2} \tfrac {1}{2} \frac {1}{2}$ +%D $\dbinom{1}{2} \tbinom{1}{2} \binom{1}{2}$ +%D \stopbuffer +%D +%D \typebuffer +%D +%D \getbuffer + +\unexpanded\def\dfrac {\genfrac\empty\empty{}\displaystyle} +\unexpanded\def\tfrac {\genfrac\empty\empty{}\textstyle} +\unexpanded\def\frac {\genfrac\empty\empty{}\donothing} + +\unexpanded\def\dbinom{\genfrac()\zeropoint\displaystyle} +\unexpanded\def\tbinom{\genfrac()\zeropoint\textstyle} +\unexpanded\def\binom {\genfrac()\zeropoint\donothing} + +\unexpanded\def\xfrac {\genfrac\empty\empty{}\scriptstyle} +\unexpanded\def\xxfrac{\genfrac\empty\empty{}\scriptscriptstyle} + +\unexpanded\def\frac#1#2{\mathematics{\genfrac\empty\empty{}\donothing{#1}{#2}}} + +%D \macros +%D {cfrac} +%D +%D \startbuffer +%D $\cfrac{12}{3} \cfrac[l]{12}{3} \cfrac[c]{12}{3} \cfrac[r]{12}{3}$ +%D $\cfrac{1}{23} \cfrac[l]{1}{23} \cfrac[c]{1}{23} \cfrac[r]{1}{23}$ +%D \stopbuffer +%D +%D \typebuffer +%D +%D \getbuffer +%D +%D Now we can align every combination we want: +%D +%D \startbuffer +%D $\cfrac{12}{3} \cfrac[l]{12}{3} \cfrac[c]{12}{3} \cfrac[r]{12}{3}$ +%D $\cfrac{1}{23} \cfrac[l]{1}{23} \cfrac[c]{1}{23} \cfrac[r]{1}{23}$ +%D $\cfrac[cl]{12}{3} \cfrac[cc]{12}{3} \cfrac[cr]{12}{3}$ +%D $\cfrac[lc]{1}{23} \cfrac[cc]{1}{23} \cfrac[rc]{1}{23}$ +%D \stopbuffer +%D +%D \typebuffer +%D +%D \getbuffer + +\definecomplexorsimple\cfrac + +\def\simplecfrac {\docfrac[cc]} +\def\complexcfrac[#1]{\docfrac[#1cc]} + +\def\docfrac[#1#2#3]#4#5% + {{\displaystyle + \frac + {\strut + \ifx r#1\hfill\fi#4\ifx l#1\hfill\fi}% + {\ifx r#2\hfill\fi#5\ifx l#2\hfill\fi}% + \kern-\nulldelimiterspace}} + +%D \macros +%D {splitfrac, splitdfrac} +%D +%D Occasionally one needs to typeset multi||line fractions. +%D These commands use \tex{genfrac} to create such fractions. +%D +%D \startbuffer +%D \startformula +%D a=\frac{ +%D \splitfrac{xy + xy + xy + xy + xy} +%D {+ xy + xy + xy + xy} +%D } +%D {z} +%D =\frac{ +%D \splitdfrac{xy + xy + xy + xy + xy} +%D {+ xy + xy + xy + xy} +%D } +%D {z} +%D \stopformula +%D \stopbuffer +%D +%D \typebuffer \getbuffer +%D +%D These macros are based on Michael J.~Downes posting on +%D comp.text.tex on 2001/12/06 + +\unexpanded\def\splitfrac#1#2% + {\genfrac\empty\empty\zeropoint\textstyle% + {\textstyle#1\quad\hfill}% + {\textstyle\hfill\quad\mathstrut#2}} + +\unexpanded\def\splitdfrac#1#2% + {\genfrac\empty\empty\zeropoint\displaystyle% + {#1\quad\hfill} + {\hfill\quad\mathstrut #2}} + +%D For thee moment here, but it might move: + +%D \macros +%D {qedsymbol} +%D +%D [HH] The general Quod Erat Domonstrandum symbol is defined +%D in such a way that we can configure it. Because this symbol +%D is also used in text mode, we make it a normal text symbol +%D with special behavior. + +\unexpanded\def\qedsymbol#1% + {\ifhmode + \unskip~\hfill#1\par + \else\ifmmode + \eqno#1\relax % Do we really need the \eqno here? + \else + \leavevmode\hbox{}\hfill#1\par + \fi\fi} + +\definesymbol [qed] [\qedsymbol{\mathematics{\square}}] + +%D \macros +%D {QED} +%D +%D [HH] For compatbility reasons we also provide the \type +%D {\QED} command. In case this command is overloaded, we still +%D have the symbol available. \symbol[qed] + +\unexpanded\def\QED{\symbol[qed]} + +%D \macros +%D {mathhexbox} +%D +%D [TH] \type {\mathhexbox} is also user||level (already +%D defined in Plain \TEX). It allows to get a math character +%D inserted as if it was a text character. + +\unexpanded\def\mathhexbox#1#2#3% + {\mathtext{$\mathsurround\zeropoint\mathchar"#1#2#3$}} + +%D \macros +%D {boxed} +%D +%D [HH] Another macro that users expect (slightly adapted): + +\unexpanded\def\boxed + {\ifmmode\expandafter\mframed\else\expandafter\framed\fi} \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/math-ini.lua b/Master/texmf-dist/tex/context/base/math-ini.lua index 63d7cad3852..a122f722975 100644 --- a/Master/texmf-dist/tex/context/base/math-ini.lua +++ b/Master/texmf-dist/tex/context/base/math-ini.lua @@ -9,22 +9,26 @@ if not modules then modules = { } end modules ['math-ext'] = { -- if needed we can use the info here to set up xetex definition files -- the "8000 hackery influences direct characters (utf) as indirect \char's -local utf = unicode.utf8 - local texsprint, format, utfchar, utfbyte = tex.sprint, string.format, utf.char, utf.byte +local setmathcode, setdelcode = tex.setmathcode, tex.setdelcode + +local allocate = utilities.storage.allocate local trace_defining = false trackers.register("math.defining", function(v) trace_defining = v end) -mathematics = mathematics or { } +local report_math = logs.reporter("mathematics","initializing") + +mathematics = mathematics or { } +local mathematics = mathematics mathematics.extrabase = 0xFE000 -- here we push some virtuals mathematics.privatebase = 0xFF000 -- here we push the ex -local families = { - tf = 0, it = 1, sl = 2, bf = 3, bi = 4, bs = 5, -- virtual fonts or unicode otf +local families = allocate { + tf = 0, it = 1, sl = 2, bf = 3, bi = 4, bs = 5, -- no longer relevant } -local classes = { +local classes = allocate { ord = 0, -- mathordcomm mathord op = 1, -- mathopcomm mathop bin = 2, -- mathbincomm mathbin @@ -94,77 +98,127 @@ end local function mathtopaccent(class,family,slot) return format('\\Umathaccent "%X "%X "%X ',0,family,slot) -- no class end -local function mathbotaccent(class,family,slot) - return format('\\Umathbotaccent "%X "%X "%X ',0,family,slot) -- no class +if tex.luatexversion > 65 then -- this will disappear at 0.70 + local function mathbotaccent(class,family,slot) + return format('\\Umathaccent bottom "%X "%X "%X ',0,family,slot) -- no class + end +else + local function mathbotaccent(class,family,slot) + return format('\\Umathbotaccent "%X "%X "%X ',0,family,slot) -- no class + end end local function mathtopdelimiter(class,family,slot) - return format('\\Uoverdelimiter "%X "%X ',0,family,slot) -- no class + return format('\\Udelimiterover "%X "%X ',family,slot) -- no class end local function mathbotdelimiter(class,family,slot) - return format('\\Uunderdelimiter "%X "%X ',0,family,slot) -- no class + return format('\\Udelimiterunder "%X "%X ',family,slot) -- no class end local escapes = characters.filters.utf.private.escapes -local function setmathsymbol(name,class,family,slot) - if class == classes.accent then - texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathaccent(class,family,slot))) - elseif class == classes.topaccent then - texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathtopaccent(class,family,slot))) - elseif class == classes.botaccent then - texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathbotaccent(class,family,slot))) - elseif class == classes.over then - texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathtopdelimiter(class,family,slot))) - elseif class == classes.under then - texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathbotdelimiter(class,family,slot))) - elseif class == classes.open or class == classes.close then - texsprint(delcode(slot,family,slot)) - texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,delimiter(class,family,slot))) - elseif class == classes.delimiter then - texsprint(delcode(slot,family,slot)) - texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,delimiter(0,family,slot))) - elseif class == classes.radical then - texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,radical(family,slot))) - else - -- beware, open/close and other specials should not end up here ---~ local ch = utfchar(slot) ---~ if escapes[ch] then ---~ texsprint(format("\\xdef\\%s{\\char%s }",name,slot)) ---~ else - texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathchar(class,family,slot))) ---~ end +local setmathcharacter, setmathsynonym, setmathsymbol -- once updated we will inline them + +if setmathcode then + + setmathcharacter = function(class,family,slot,unicode,firsttime) + if not firsttime and class <= 7 then + setmathcode(slot,{class,family,unicode or slot}) + end end -end -local function setmathcharacter(class,family,slot,unicode,firsttime) - if not firsttime and class <= 7 then - texsprint(mathcode(slot,class,family,unicode or slot)) + setmathsynonym = function(class,family,slot,unicode,firsttime) + if not firsttime and class <= 7 then + setmathcode(slot,{class,family,unicode}) + end + if class == classes.open or class == classes.close then + setdelcode(slot,{family,unicode,0,0}) + end end -end -local function setmathsynonym(class,family,slot,unicode,firsttime) - if not firsttime and class <= 7 then - texsprint(mathcode(slot,class,family,unicode)) + setmathsymbol = function(name,class,family,slot) -- hex is nicer for tracing + if class == classes.accent then + texsprint(format([[\unexpanded\gdef\%s{\Umathaccent 0 "%X "%X }]],name,family,slot)) + elseif class == classes.topaccent then + texsprint(format([[\unexpanded\gdef\%s{\Umathaccent 0 "%X "%X }]],name,family,slot)) + elseif class == classes.botaccent then + texsprint(format([[\unexpanded\gdef\%s{\Umathbotaccent 0 "%X "%X }]],name,family,slot)) + elseif class == classes.over then + texsprint(format([[\unexpanded\gdef\%s{\Udelimiterover "%X "%X }]],name,family,slot)) + elseif class == classes.under then + texsprint(format([[\unexpanded\gdef\%s{\Udelimiterunder "%X "%X }]],name,family,slot)) + elseif class == classes.open or class == classes.close then + setdelcode(slot,{family,slot,0,0}) + texsprint(format([[\unexpanded\gdef\%s{\Udelimiter "%X "%X "%X }]],name,class,family,slot)) + elseif class == classes.delimiter then + setdelcode(slot,{family,slot,0,0}) + texsprint(format([[\unexpanded\gdef\%s{\Udelimiter 0 "%X "%X }]],name,family,slot)) + elseif class == classes.radical then + texsprint(format([[\unexpanded\gdef\%s{\Uradical "%X "%X }]],name,family,slot)) + else + -- beware, open/close and other specials should not end up here + texsprint(format([[\unexpanded\gdef\%s{\Umathchar "%X "%X "%X }]],name,class,family,slot)) + end + end + + +else + + setmathcharacter = function(class,family,slot,unicode,firsttime) + if not firsttime and class <= 7 then + texsprint(mathcode(slot,class,family,unicode or slot)) + end + end + + setmathsynonym = function(class,family,slot,unicode,firsttime) + if not firsttime and class <= 7 then + texsprint(mathcode(slot,class,family,unicode)) + end + if class == classes.open or class == classes.close then + texsprint(delcode(slot,family,unicode)) + end end - if class == classes.open or class == classes.close then - texsprint(delcode(slot,family,unicode)) + + setmathsymbol = function(name,class,family,slot) + if class == classes.accent then + texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathaccent(class,family,slot))) + elseif class == classes.topaccent then + texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathtopaccent(class,family,slot))) + elseif class == classes.botaccent then + texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathbotaccent(class,family,slot))) + elseif class == classes.over then + texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathtopdelimiter(class,family,slot))) + elseif class == classes.under then + texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathbotdelimiter(class,family,slot))) + elseif class == classes.open or class == classes.close then + texsprint(delcode(slot,family,slot)) + texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,delimiter(class,family,slot))) + elseif class == classes.delimiter then + texsprint(delcode(slot,family,slot)) + texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,delimiter(0,family,slot))) + elseif class == classes.radical then + texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,radical(family,slot))) + else + -- beware, open/close and other specials should not end up here + texsprint(format("\\unexpanded\\xdef\\%s{%s}",name,mathchar(class,family,slot))) + end end + end local function report(class,family,unicode,name) local nametype = type(name) if nametype == "string" then - logs.report("mathematics","%s:%s %s U+%05X (%s) => %s",classname,class,family,unicode,utfchar(unicode),name) + report_math("%s:%s %s U+%05X (%s) => %s",classname,class,family,unicode,utfchar(unicode),name) elseif nametype == "number" then - logs.report("mathematics","%s:%s %s U+%05X (%s) => U+%05X",classname,class,family,unicode,utfchar(unicode),name) + report_math("%s:%s %s U+%05X (%s) => U+%05X",classname,class,family,unicode,utfchar(unicode),name) else - logs.report("mathematics","%s:%s %s U+%05X (%s)", classname,class,family,unicode,utfchar(unicode)) + report_math("%s:%s %s U+%05X (%s)", classname,class,family,unicode,utfchar(unicode)) end end -- there will be a combined \(math)chardef -function mathematics.define(slots,family) +function mathematics.define(family) family = family or 0 family = families[family] or family local data = characters.data @@ -209,14 +263,12 @@ function mathematics.define(slots,family) report(class,family,unicode,name) end setmathsymbol(name,class,family,unicode) - -- setmathcharacter(class,family,unicode,unicode,i) else name = class == classes.variable or class == classes.number and character.adobename if name then if trace_defining then report(class,family,unicode,name) end - -- setmathcharacter(class,family,unicode,unicode,i) end end setmathcharacter(class,family,unicode,unicode,i) @@ -262,19 +314,21 @@ end function mathematics.utfmathcommand(chr, default) local cd = characters.data[utfbyte(chr)] local cmd = cd and cd.mathname - tex.sprint(cmd or default or "") + return cmd or default or "" end function mathematics.utfmathfiller(chr, default) local cd = characters.data[utfbyte(chr)] local cmd = cd and (cd.mathfiller or cd.mathname) - tex.sprint(cmd or default or "") + return cmd or default or "" end -mathematics.entities = mathematics.entities or { } +-- xml -function mathematics.register_xml_entities() +mathematics.xml = { entities = { } } + +function mathematics.xml.registerentities() local entities = xml.entities - for name, unicode in next, mathematics.entities do + for name, unicode in next, mathematics.xml.entities do if not entities[name] then entities[name] = utfchar(unicode) end @@ -311,30 +365,3 @@ function mathematics.big(tfmdata,unicode,n) return unicode end --- plugins - -local hvars = table.tohash { - --~ "RadicalKernBeforeDegree", - --~ "RadicalKernAfterDegree", -} - -function mathematics.scaleparameters(t,tfmtable,delta,hdelta,vdelta) - local math_parameters = tfmtable.math_parameters - if math_parameters and next(math_parameters) then - delta = delta or 1 - hdelta, vdelta = hdelta or delta, vdelta or delta - local _, mp = mathematics.dimensions(math_parameters) - for name, value in next, mp do - if name == "RadicalDegreeBottomRaisePercent" then - mp[name] = value - elseif hvars[name] then - mp[name] = hdelta * value - else - mp[name] = vdelta * value - end - end - t.MathConstants = mp - end -end - -table.insert(fonts.tfm.mathactions,mathematics.scaleparameters) diff --git a/Master/texmf-dist/tex/context/base/math-ini.mkii b/Master/texmf-dist/tex/context/base/math-ini.mkii index f9dd859c412..9f7ab49e5a1 100644 --- a/Master/texmf-dist/tex/context/base/math-ini.mkii +++ b/Master/texmf-dist/tex/context/base/math-ini.mkii @@ -405,8 +405,8 @@ \appendtoks\autoenablemathcollection\to\mathstrategies -\fetchruntimecommand \showmathcharacters {\f!mathprefix\s!run.mkii} -\fetchruntimecommand \showmathtoken {\f!mathprefix\s!run.mkii} +\fetchruntimecommand \showmathcharacters {\f!mathprefix\s!run} +\fetchruntimecommand \showmathtoken {\f!mathprefix\s!run} \def\resetmathcollection[#1]% {\def\mathcollection{#1}% diff --git a/Master/texmf-dist/tex/context/base/math-ini.mkiv b/Master/texmf-dist/tex/context/base/math-ini.mkiv index 9dbadc11f01..f778afa08c5 100644 --- a/Master/texmf-dist/tex/context/base/math-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/math-ini.mkiv @@ -29,11 +29,6 @@ \ifx\v!compact\undefined \def\v!compact{compact} \fi -%D New: - -\let\startimath\Ustartmath \let\stopimath \Ustopmath -\let\startdmath\Ustartdisplaymath \let\stopdmath \Ustopmath - %D We move these definitions into the format: % test [[\char948 \ctxlua{tex.sprint(utf.char(948))}]] @@ -41,16 +36,29 @@ \registerctxluafile{math-ini}{1.001} \registerctxluafile{math-dim}{1.001} +\registerctxluafile{math-act}{1.001} \registerctxluafile{math-ent}{1.001} \registerctxluafile{math-ext}{1.001} \registerctxluafile{math-vfu}{1.001} \registerctxluafile{math-map}{1.001} \registerctxluafile{math-noa}{1.001} +\registerctxluafile{math-tag}{1.001} + +\definesystemattribute[mathalphabet] [public] +\definesystemattribute[mathsize] [public] +\definesystemattribute[mathpunctuation][public] +\definesystemattribute[mathgreek] [public] +\definesystemattribute[mathalternate] [public] + +% experiment -\definesystemattribute[mathalphabet] \chardef\mathalphabetattribute \dogetattributeid{mathalphabet} -\definesystemattribute[mathsize] \chardef\mathsizeattribute \dogetattributeid{mathsize} -\definesystemattribute[mathpunctuation] \chardef\mathpunctuationattribute \dogetattributeid{mathpunctuation} -\definesystemattribute[mathgreek] \chardef\mathgreekattribute \dogetattributeid{mathgreek} +% Normally this is applied to only one character. +% +% $ABC$ $\cal ABC$ $\mathaltcal ABC$ + +\def\mathalternate#1{\ctxlua{mathematics.setalternate(0,"#1")}} % fam 0 + +\def\mathaltcal{\mathalternate{cal}\cal} % ss01 in xits % todo: only in mmode @@ -61,9 +69,9 @@ \let\mathgreeknormal\mathgreekupright \let\mathgreeknone \mathgreekdefault -\def\setmathattribute#1#2{\ifmmode\ctxlua{mathematics.sync_a_both ("#1","#2")}\fi} -\def\setmathalphabet #1{\ifmmode\ctxlua{mathematics.sync_a_name ("#1")}\fi} -\def\setmathstyle #1{\ifmmode\ctxlua{mathematics.sync_a_style("#1")}\fi} +\def\setmathattribute#1#2{\ifmmode\ctxlua{mathematics.syncboth ("#1","#2")}\fi} +\def\setmathalphabet #1{\ifmmode\ctxlua{mathematics.syncname ("#1")}\fi} +\def\setmathstyle #1{\ifmmode\ctxlua{mathematics.syncstyle("#1")}\fi} \unexpanded\def\mr {\setmathattribute{regular}{tf}} @@ -145,10 +153,10 @@ %D Helpers: -\def\utfmathclass #1{\ctxlua{tex.sprint(mathematics.utfmathclass ("#1"))}} -\def\utfmathstretch#1{\ctxlua{tex.sprint(mathematics.utfmathstretch("#1"))}} -\def\utfmathcommand#1{\ctxlua{tex.sprint(mathematics.utfmathcommand("#1"))}} -\def\utfmathfiller #1{\ctxlua{tex.sprint(mathematics.utfmathfiller ("#1"))}} +\def\utfmathclass #1{\cldcontext{mathematics.utfmathclass (\!!bs#1\!!es)}} +\def\utfmathstretch#1{\cldcontext{mathematics.utfmathstretch(\!!bs#1\!!es)}} +\def\utfmathcommand#1{\cldcontext{mathematics.utfmathcommand(\!!bs#1\!!es)}} +\def\utfmathfiller #1{\cldcontext{mathematics.utfmathfiller (\!!bs#1\!!es)}} % \def\utfmathclassdefault #1#2{\ctxlua{ % tex.sprint(mathematics.utfmathclass("#1","#2")) @@ -169,23 +177,23 @@ \def\@@mathboxcomm #1{\dontleavehmode\hbox\Ustartmath\mathsurround\zeropoint#1\Ustopmath} \def\@@mathchoicecomm#1{[todo #1]} -\chardef\mathordcode = 0 \let\mathordcomm \mathord -\chardef\mathopcode = 1 \let\mathopcomm \mathop -\chardef\mathbincode = 2 \let\mathbincomm \mathbin -\chardef\mathrelcode = 3 \let\mathrelcomm \mathrel -\chardef\mathopencode = 4 \let\mathopencomm \mathopen -\chardef\mathclosecode = 5 \let\mathclosecomm \mathclose -\chardef\mathpunctcode = 6 \let\mathpunctcomm \mathpunct -\chardef\mathalphacode = 7 \let\mathalphacomm \firstofoneargument -\chardef\mathinnercode = 0 \let\mathinnercomm \mathinner -\chardef\mathnothingcode= 0 \let\mathnothingcomm \firstofoneargument -\chardef\mathlimopcode = 1 \let\mathlimopcomm \@@mathlimopcomm -\chardef\mathnolopcode = 1 \let\mathnolopcomm \@@mathnolopcomm -\chardef\mathchoicecode = 0 \let\mathchoicecomm \@@mathchoicecomm -\chardef\mathboxcode = 0 \let\mathboxcomm \@@mathboxcomm - -\chardef\mathaccentcode = 8 -\chardef\mathradicalcode= 9 +\setnewconstant\mathordcode 0 \let\mathordcomm \mathord +\setnewconstant\mathopcode 1 \let\mathopcomm \mathop +\setnewconstant\mathbincode 2 \let\mathbincomm \mathbin +\setnewconstant\mathrelcode 3 \let\mathrelcomm \mathrel +\setnewconstant\mathopencode 4 \let\mathopencomm \mathopen +\setnewconstant\mathclosecode 5 \let\mathclosecomm \mathclose +\setnewconstant\mathpunctcode 6 \let\mathpunctcomm \mathpunct +\setnewconstant\mathalphacode 7 \let\mathalphacomm \firstofoneargument +\setnewconstant\mathinnercode 0 \let\mathinnercomm \mathinner +\setnewconstant\mathnothingcode 0 \let\mathnothingcomm \firstofoneargument +\setnewconstant\mathlimopcode 1 \let\mathlimopcomm \@@mathlimopcomm +\setnewconstant\mathnolopcode 1 \let\mathnolopcomm \@@mathnolopcomm +\setnewconstant\mathchoicecode 0 \let\mathchoicecomm \@@mathchoicecomm +\setnewconstant\mathboxcode 0 \let\mathboxcomm \@@mathboxcomm + +\setnewconstant\mathaccentcode 8 +\setnewconstant\mathradicalcode 9 \def\puremathcode#1{\the\csname math#1code\endcsname} \def\puremathcomm#1{\csname math#1comm\endcsname} @@ -250,10 +258,10 @@ {\normalhbox\bgroup\mf \dowithnextbox{\flushnextbox\egroup}\normalhbox} -\def\mbox +\def\mbox % we cannot add \dontleavehmode ... else no \setbox0\mbox possible {\ifmmode\normalmbox\else\normalhbox\fi} -\def\enablembox +\unexpanded\def\enablembox {\appendtoks \ifx\normalhbox\undefined\let\normalhbox\hbox\fi \let\hbox\mbox @@ -342,70 +350,133 @@ %D The result is as expected: the first line typesets ok, while the second %D one triggers an error message. +\setnewconstant\activemathcharcode "8000 + +\newtoks\activatedmathcharacters + +\def\activatemathcharacter#1% + {\appendtoks + \global\mathcode#1=\activemathcharcode + \to \activatedmathcharacters} + +\def\activatemathcharacters + {\the\activatedmathcharacters} + +\setnewconstant\primeasciicode 39 % ' + +\activatemathcharacter\circumflexasciicode +\activatemathcharacter\underscoreasciicode +\activatemathcharacter\ampersandasciicode +\activatemathcharacter\primeasciicode + +% not used: +% +% \mathcode\spaceasciicode\activemathcharcode +% +% not used: +% +% \bgroup +% \catcode\underscoreasciicode\activecatcode +% \doglobal\appendtoks +% \mathcode\underscoreasciicode\activemathcharcode +% \let_\activemathunderscore +% \to \everymathematics +% \egroup +% +% plain tex legacy: + +\bgroup + \catcode\primeasciicode\activecatcode + \doglobal\appendtoks + \let'\domathprime + \to \everymathematics +\egroup + \newtoks\everydonknuthmode \newtoks\everynonknuthmode -\def\nonknuthmode{\the\everynonknuthmode\let\nonknuthmode\relax} -\def\donknuthmode{\the\everydonknuthmode} +\newconditional \knuthmode + +\def\nonknuthmode + {\pushcatcodetable + \setcatcodetable\ctxcatcodes + \the\everynonknuthmode + \let\nonknuthmode\relax + \popcatcodetable} -\ifdefined\normalsuber\else \def\normalsuber{_} \fi -\ifdefined\normalsuper\else \def\normalsuper{^} \fi -\ifdefined\normalaltab\else \def\normalaltab{&} \fi +\def\donknuthmode + {\pushcatcodetable + \setcatcodetable\ctxcatcodes + \the\everydonknuthmode + \popcatcodetable} \bgroup - \catcode`_=\active - \catcode`^=\active - \catcode`&=\active + \catcode\underscoreasciicode\activecatcode + \catcode\circumflexasciicode\activecatcode + \catcode\ampersandasciicode \activecatcode \global \everynonknuthmode {\appendtoks - \let_\normalsuber - \let^\normalsuper - \let&\normalaltab + \let_\normalsubscript + \let^\normalsuperscript + \let&\normalmathaligntab % use \def when it's \aligntab \to \everymathematics} \egroup \appendtoks - \mathcode`_="8000 - \mathcode`^="8000 - \mathcode`&="8000 - \catcode`_=\@@other - \catcode`^=\@@other - \catcode`&=\@@other + \setfalse\knuthmode + \catcode\underscoreasciicode\othercatcode + \catcode\circumflexasciicode\othercatcode + \catcode\ampersandasciicode \othercatcode \to \everynonknuthmode \appendtoks - \catcode`_=\@@subscript - \catcode`^=\@@superscript - \catcode`&=\@@alignment + \settrue\knuthmode + \catcode\underscoreasciicode\subscriptcatcode + \catcode\circumflexasciicode\superscriptcatcode + \catcode\ampersandasciicode \alignmentcatcode \to \everydonknuthmode \appendtoks \startextendcatcodetable\ctxcatcodes - \catcode`_=\@@other - \catcode`^=\@@other - \catcode`&=\@@other + \catcode\underscoreasciicode\othercatcode + \catcode\circumflexasciicode\othercatcode + \catcode\ampersandasciicode \othercatcode \stopextendcatcodetable \to \everynonknuthmode \appendtoks \startextendcatcodetable\ctxcatcodes - \catcode`_=\@@subscript - \catcode`^=\@@superscript - \catcode`&=\@@alignment + \catcode\underscoreasciicode\subscriptcatcode + \catcode\circumflexasciicode\superscriptcatcode + \catcode\ampersandasciicode \alignmentcatcode \stopextendcatcodetable \to \everydonknuthmode -%D Needed for unicode: +% \def\prefermathcatcodes +% {\catcode\underscoreasciicode\subscriptcatcode +% \catcode\circumflexasciicode\superscriptcatcode +% \catcode\ampersandasciicode \alignmentcatcode} + +%D Even more drastic: -\def\nulloperator{\mathortext{\mathop{\null}}{\null}} +\unexpanded\def\asciimode + {\catcodetable\txtcatcodes + \nonknuthmode} -%D To be dealt with ... +\unexpanded\def\startasciimode + {\pushcatcodetable + \catcodetable\txtcatcodes + \nonknuthmode} -\mathcode`\ ="8000 % \space -\mathcode`\'="8000 % ^\prime -\mathcode`\_="8000 % \_ +\unexpanded\def\stopasciimode + {\popcatcodetable + \ifconditional\knuthmode\else\donknuthmode\fi} + +%D Needed for unicode: + +\def\nulloperator{\mathortext{\mathop{\emptyhbox}}{\emptyhbox}} %D \macros %D {setupmathematics} @@ -428,8 +499,8 @@ \appendtoks \doifelse{\mathematicsparameter\v!compact}\v!yes - {\ctxlua{fonts.vf.math.optional=true}} - {\ctxlua{fonts.vf.math.optional=false}}% + {\ctxlua{fonts.handlers.vf.math.optional=true}} + {\ctxlua{fonts.handlers.vf.math.optional=false}}% \to \everysetupmathematics \setupmathematics @@ -654,4 +725,10 @@ \def\mathoptext#1{\mathop{\text{#1}}} +% for a while: + +\ifnum\luatexversion>65 + \def\Umathbotaccent{\Umathaccent bottom } +\fi + \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/math-int.mkiv b/Master/texmf-dist/tex/context/base/math-int.mkiv index 2af471b5cb4..a99142a0423 100644 --- a/Master/texmf-dist/tex/context/base/math-int.mkiv +++ b/Master/texmf-dist/tex/context/base/math-int.mkiv @@ -33,19 +33,19 @@ %D %D Limits: \setupmathematics[integral=limits] \getbuffer -\chardef\intlimitcode\zerocount % 0 nolimits 1 displaylimits 2 limits +\newconstant\mathintlimitmode % 0 nolimits 1 displaylimits 2 limits \def\intlimits - {\ifcase\intlimitcode \nolimits \or \displaylimits \or \limits \fi} + {\ifcase\mathintlimitmode \nolimits \or \displaylimits \or \limits \fi} \ifx\v!integral\undefined \def\v!integral{integral} \fi \appendtoks \processaction [\mathematicsparameter\v!integral] - [ nolimits=>\chardef\intlimitcode\zerocount, - displaylimits=>\chardef\intlimitcode\plusone, - limits=>\chardef\intlimitcode\plustwo]% + [ nolimits=>\mathintlimitmode\zerocount, + displaylimits=>\mathintlimitmode\plusone, + limits=>\mathintlimitmode\plustwo]% \to \everysetupmathematics \setupmathematics @@ -53,22 +53,45 @@ %D More integrals (AM): -\definemathcommand [iint] {\repeatintegral\plusone } -\definemathcommand [iiint] {\repeatintegral\plustwo } -\definemathcommand [iiiint] {\repeatintegral\plusthree} - %def\integralrepeatsymbol{\intop} \def\integralrepeatsymbol{{\int}} -\def\repeatintegral#1% +% \def\repeatintegral#1% +% {\scratchtoks\emptytoks +% \let\dointlimits\donothing +% \let\dodointlimits\intlimits +% \dorecurse{#1}{\appendtoks \integralrepeatsymbol \dointkern \to \scratchtoks}% +% \appendtoks \intop \dointlimits \dodointlimits \to \scratchtoks +% \edef\dodorepeatintegral{\the\scratchtoks}% +% \futurelet\next\dorepeatintegral} + +% \definemathcommand [iint] {\repeatintegral\plusone } +% \definemathcommand [iiint] {\repeatintegral\plustwo } +% \definemathcommand [iiiint] {\repeatintegral\plusthree} + +\def\fakerepeatintegral#1% {\scratchtoks\emptytoks - \let\dointlimits\donothing - \let\dodointlimits\intlimits - \dorecurse{#1}{\appendtoks \integralrepeatsymbol \dointkern \to \scratchtoks} + \dorecurse{#1}{\appendtoks \integralrepeatsymbol \dointkern \to \scratchtoks}% \appendtoks \intop \dointlimits \dodointlimits \to \scratchtoks - \edef\dodorepeatintegral{\the\scratchtoks}% + \edef\dodorepeatintegral{\the\scratchtoks}} + +\def\repeatintegral#1#2#3% + {\let\dointlimits\donothing + \let\dodointlimits\intlimits + \iffontchar\textfont\zerocount#1\relax + %\edef\dodorepeatintegral{\utfchar{#1}}% + \let\dodorepeatintegral#2% + \else + \fakerepeatintegral{#3}% + \fi \futurelet\next\dorepeatintegral} +% This is a temporary solution, as we will make a virtual glyph in lm. + +\definemathcommand [iint] {\repeatintegral{"222B}\normaliint \plusone } +\definemathcommand [iiint] {\repeatintegral{"222C}\normaliiint \plustwo } +\definemathcommand [iiiint] {\repeatintegral{"222D}\normaliiiint\plusthree} + %D If the \type{\limits} option is used after \type{\iint}, use %D \type{\mathop} and fudge the left hand space a bit to make the %D subscript visually centered. @@ -80,7 +103,7 @@ {\ifx\next\limits \dointlimitcorrection \else \ifx\next\displaylimits \dointlimitcorrection \else \ifx\next\nolimits \donothing \else - \ifcase\intlimitcode\else \dointlimitcorrection \fi\fi\fi\fi + \ifcase\mathintlimitmode\else \dointlimitcorrection \fi\fi\fi\fi \dodorepeatintegral} \def\dointlimitcorrection diff --git a/Master/texmf-dist/tex/context/base/math-lbr.mkii b/Master/texmf-dist/tex/context/base/math-lbr.mkii index cf69eec1fbf..6392c762e56 100644 --- a/Master/texmf-dist/tex/context/base/math-lbr.mkii +++ b/Master/texmf-dist/tex/context/base/math-lbr.mkii @@ -295,12 +295,12 @@ \stopmathcollection -% \startmathcollection[lbr] -% -% \definemathcharacter [:] [punct] [tf] ["3A] % unbelievable -% \definemathcharacter [;] [punct] [tf] ["3B] % unbelievable -% -% \stopmathcollection +\startmathcollection[lbr] + +\definemathcharacter [:] [punct] [tf] ["3A] % unbelievable, but enabled again for Mojca +\definemathcharacter [;] [punct] [tf] ["3B] % unbelievable, but enabled again for Mojca + +\stopmathcollection \startmathcollection[lbr] @@ -377,7 +377,7 @@ % we define the whole lot, although only a few differ (esp dot) % \startmathcollection[lbr] -% +% % \definemathsymbol [acute] [accent] [tf] ["13] % mr -> tf % \definemathsymbol [grave] [accent] [tf] ["12] % mr -> tf % \definemathsymbol [ddot] [accent] [tf] ["7F] % mr -> tf @@ -390,7 +390,7 @@ % \definemathsymbol [dot] [accent] [tf] ["05] % mr -> tf, 5F -> 05 % \definemathsymbol [widetilde] [accent] [ex] ["65] % [ord] % \definemathsymbol [widehat] [accent] [ex] ["62] % [ord] -% +% % \stopmathcollection \startmathcollection[lbr:texnansi] @@ -444,19 +444,19 @@ \stoprawmathcollection -\def\LBRbig {\@@dobig{8.20}} -\def\LBRBig {\@@dobig{10.80}} -\def\LBRbigg {\@@dobig{13.42}} -\def\LBRBigg {\@@dobig{16.03}} -\def\LBRbiggg{\@@dobig{17.72}} -\def\LBRBiggg{\@@dobig{21.25}} - -% \def\LBRbig {\@@dobig{0.820}} -% \def\LBRBig {\@@dobig{1.080}} -% \def\LBRbigg {\@@dobig{1.342}} -% \def\LBRBigg {\@@dobig{1.603}} -% \def\LBRbiggg{\@@dobig{1.772}} -% \def\LBRBiggg{\@@dobig{2.125}} +% \def\LBRbig {\@@dobig{8.20}} +% \def\LBRBig {\@@dobig{10.80}} +% \def\LBRbigg {\@@dobig{13.42}} +% \def\LBRBigg {\@@dobig{16.03}} +% \def\LBRbiggg{\@@dobig{17.72}} +% \def\LBRBiggg{\@@dobig{21.25}} + +\def\LBRbig {\@@dobig{0.820}} +\def\LBRBig {\@@dobig{1.080}} +\def\LBRbigg {\@@dobig{1.342}} +\def\LBRBigg {\@@dobig{1.603}} +\def\LBRbiggg{\@@dobig{1.772}} +\def\LBRBiggg{\@@dobig{2.125}} \startrawmathcollection[lbr] diff --git a/Master/texmf-dist/tex/context/base/math-map.lua b/Master/texmf-dist/tex/context/base/math-map.lua index d3e8cc110e4..b6d57bff531 100644 --- a/Master/texmf-dist/tex/context/base/math-map.lua +++ b/Master/texmf-dist/tex/context/base/math-map.lua @@ -20,19 +20,24 @@ if not modules then modules = { } end modules ['math-map'] = { -- maybe: script/scriptscript dynamic, local type, next = type, next -local floor = math.floor +local floor, div = math.floor, math.div + +local allocate = utilities.storage.allocate local texattribute = tex.attribute local trace_greek = false trackers.register("math.greek", function(v) trace_greek = v end) -mathematics = mathematics or { } +local report_remapping = logs.reporter("mathematics","remapping") + +mathematics = mathematics or { } +local mathematics = mathematics -- we could use one level less and have tf etc be tables directly but the -- following approach permits easier remapping of a-a, A-Z and 0-9 to -- fallbacks; symbols is currently mostly greek -mathematics.alphabets = { +local alphabets = allocate { regular = { tf = { digits = 0x00030, @@ -267,7 +272,8 @@ mathematics.alphabets = { }, } -local alphabets = mathematics.alphabets +mathematics.alphabets = alphabets + local mathremap = { } for alphabet, styles in next, alphabets do @@ -344,12 +350,12 @@ alphabets.serif = alphabets.regular alphabets.type = alphabets.monospaced alphabets.teletype = alphabets.monospaced -function mathematics.to_a_style(attribute) +function mathematics.tostyle(attribute) local r = mathremap[attribute] return r and r.style or "tf" end -function mathematics.to_a_name(attribute) +function mathematics.toname(attribute) local r = mathremap[attribute] return r and r.alphabet or "regular" end @@ -358,13 +364,13 @@ end local mathalphabet = attributes.private("mathalphabet") -function mathematics.sync_a_both(alphabet,style) +function mathematics.syncboth(alphabet,style) local data = alphabets[alphabet or "regular"] or alphabets.regular data = data[style or "tf"] or data.tf texattribute[mathalphabet] = data and data.attribute or texattribute[mathalphabet] end -function mathematics.sync_a_style(style) +function mathematics.syncstyle(style) --~ local r = mathremap[mathalphabet] local r = mathremap[texattribute[mathalphabet]] local alphabet = r and r.alphabet or "regular" @@ -372,7 +378,7 @@ function mathematics.sync_a_style(style) texattribute[mathalphabet] = data and data.attribute or texattribute[mathalphabet] end -function mathematics.sync_a_name(alphabet) +function mathematics.syncname(alphabet) --~ local r = mathremap[mathalphabet] local r = mathremap[texattribute[mathalphabet]] local style = r and r.style or "tf" @@ -390,7 +396,7 @@ local remapping = { [3] = { what = "italic", tf = "it", bf = "bi" }, -- italic } -function mathematics.remap_alphabets(char,mathalphabet,mathgreek) +function mathematics.remapalphabets(char,mathalphabet,mathgreek) if mathgreek > 0 then local lc, uc = floor(mathgreek/10), mathgreek % 10 -- 2 == upright 3 == italic if lc > 1 or uc > 1 then @@ -400,7 +406,7 @@ function mathematics.remap_alphabets(char,mathalphabet,mathgreek) local alphabet = r and r.alphabet or "regular" local style = r and r.style or "tf" if trace_greek then - logs.report("math","before: char: %05X, alphabet: %s %s, lcgreek: %s, ucgreek: %s",char,alphabet,style,remapping[lc].what,remapping[uc].what) + report_remapping("before: char: %05X, alphabet: %s %s, lcgreek: %s, ucgreek: %s",char,alphabet,style,remapping[lc].what,remapping[uc].what) end local s = remapping[islc or isuc][style] if s then @@ -408,7 +414,7 @@ function mathematics.remap_alphabets(char,mathalphabet,mathgreek) mathalphabet, style = data and data.attribute or mathalphabet, s end if trace_greek then - logs.report("math","after : char: %05X, alphabet: %s %s, lcgreek: %s, ucgreek: %s",char,alphabet,style,remapping[lc].what,remapping[uc].what) + report_remapping("after : char: %05X, alphabet: %s %s, lcgreek: %s, ucgreek: %s",char,alphabet,style,remapping[lc].what,remapping[uc].what) end end end @@ -420,13 +426,13 @@ function mathematics.remap_alphabets(char,mathalphabet,mathgreek) -- nothing to remap elseif char >= 0x030 and char <= 0x039 then local o = offset.digits - newchar = (type(o) == "table" and (o[char] or char)) or (char - 0x030 + o) + newchar = o and ((type(o) == "table" and (o[char] or char)) or (char - 0x030 + o)) elseif char >= 0x041 and char <= 0x05A then local o = offset.ucletters - newchar = (type(o) == "table" and (o[char] or char)) or (char - 0x041 + o) + newchar = o and ((type(o) == "table" and (o[char] or char)) or (char - 0x041 + o)) elseif char >= 0x061 and char <= 0x07A then local o = offset.lcletters - newchar = (type(o) == "table" and (o[char] or char)) or (char - 0x061 + o) + newchar = o and ((type(o) == "table" and (o[char] or char)) or (char - 0x061 + o)) elseif islcgreek[char] then newchar = offset.lcgreek[char] elseif isucgreek[char] then @@ -438,3 +444,20 @@ function mathematics.remap_alphabets(char,mathalphabet,mathgreek) end return nil end + +local function checkedcopy(characters,child,parent) + for k, v in next, child do + if not characters[v] then + characters[v] = characters[parent[k]] + end + end +end + +function mathematics.addfallbacks(main) + local characters = main.characters + local regular = alphabets.regular + checkedcopy(characters,regular.bf.ucgreek,regular.tf.ucgreek) + checkedcopy(characters,regular.bf.lcgreek,regular.tf.lcgreek) + checkedcopy(characters,regular.bi.ucgreek,regular.it.ucgreek) + checkedcopy(characters,regular.bi.lcgreek,regular.it.lcgreek) +end diff --git a/Master/texmf-dist/tex/context/base/math-noa.lua b/Master/texmf-dist/tex/context/base/math-noa.lua index 02bbe0a6299..c298a8068ae 100644 --- a/Master/texmf-dist/tex/context/base/math-noa.lua +++ b/Master/texmf-dist/tex/context/base/math-noa.lua @@ -9,126 +9,132 @@ if not modules then modules = { } end modules ['math-noa'] = { -- beware: this is experimental code and there will be a more -- generic (attribute value driven) interface too but for the -- moment this is ok +-- +-- we will also make dedicated processors (faster) +-- +-- beware: names will change as we wil make noads.xxx.handler i.e. xxx +-- subnamespaces local utf = unicode.utf8 -local set_attribute = node.set_attribute -local has_attribute = node.has_attribute -local mlist_to_hlist = node.mlist_to_hlist -local font_of_family = node.family_font -local fontdata = fonts.identifiers - -local format, rep = string.format, string.rep local utfchar, utfbyte = utf.char, utf.byte +local format, rep = string.format, string.rep +local concat = table.concat -noads = noads or { } - -local trace_remapping = false trackers.register("math.remapping", function(v) trace_remapping = v end) -local trace_processing = false trackers.register("math.processing", function(v) trace_processing = v end) -local trace_analyzing = false trackers.register("math.analyzing", function(v) trace_analyzing = v end) - -local noad_ord = 0 -local noad_op_displaylimits = 1 -local noad_op_limits = 2 -local noad_op_nolimits = 3 -local noad_bin = 4 -local noad_rel = 5 -local noad_open = 6 -local noad_close = 7 -local noad_punct = 8 -local noad_inner = 9 -local noad_under = 10 -local noad_over = 11 -local noad_vcenter = 12 - --- obsolete: --- --- math_ord = node.id("ord") -- attr nucleus sub sup --- math_op = node.id("op") -- attr nucleus sub sup subtype --- math_bin = node.id("bin") -- attr nucleus sub sup --- math_rel = node.id("rel") -- attr nucleus sub sup --- math_punct = node.id("punct") -- attr nucleus sub sup --- --- math_open = node.id("open") -- attr nucleus sub sup --- math_close = node.id("close") -- attr nucleus sub sup --- --- math_inner = node.id("inner") -- attr nucleus sub sup --- math_vcenter = node.id("vcenter") -- attr nucleus sub sup --- math_under = node.id("under") -- attr nucleus sub sup --- math_over = node.id("over") -- attr nucleus sub sup - -local math_noad = node.id("noad") -- attr nucleus sub sup - -local math_accent = node.id("accent") -- attr nucleus sub sup accent -local math_radical = node.id("radical") -- attr nucleus sub sup left degree -local math_fraction = node.id("fraction") -- attr nucleus sub sup left right - -local math_box = node.id("sub_box") -- attr list -local math_sub = node.id("sub_mlist") -- attr list -local math_char = node.id("math_char") -- attr fam char -local math_text_char = node.id("math_text_char") -- attr fam char -local math_delim = node.id("delim") -- attr small_fam small_char large_fam large_char -local math_style = node.id("style") -- attr style -local math_choice = node.id("choice") -- attr display text script scriptscript -local math_fence = node.id("fence") -- attr subtype - -local simple_noads = table.tohash { - math_noad, -} +local fonts, nodes, node, mathematics = fonts, nodes, node, mathematics -local all_noads = { - math_noad, - math_box, math_sub, - math_char, math_text_char, math_delim, math_style, - math_accent, math_radical, math_fraction, math_choice, math_fence, -} +local otf = fonts.handlers.otf +local otffeatures = fonts.constructors.newfeatures("otf") +local registerotffeature = otffeatures.register + +local trace_remapping = false trackers.register("math.remapping", function(v) trace_remapping = v end) +local trace_processing = false trackers.register("math.processing", function(v) trace_processing = v end) +local trace_analyzing = false trackers.register("math.analyzing", function(v) trace_analyzing = v end) +local trace_normalizing = false trackers.register("math.normalizing", function(v) trace_normalizing = v end) + +local report_processing = logs.reporter("mathematics","processing") +local report_remapping = logs.reporter("mathematics","remapping") +local report_normalizing = logs.reporter("mathematics","normalizing") -noads.processors = noads.processors or { } +local set_attribute = node.set_attribute +local has_attribute = node.has_attribute +local mlist_to_hlist = node.mlist_to_hlist +local font_of_family = node.family_font -local function process(start,what,n) +local fonthashes = fonts.hashes +local fontdata = fonthashes.identifiers + +noads = noads or { } -- todo: only here +local noads = noads + +noads.processors = noads.processors or { } +local processors = noads.processors + +noads.handlers = noads.handlers or { } +local handlers = noads.handlers + +local tasks = nodes.tasks + +local nodecodes = nodes.nodecodes +local noadcodes = nodes.noadcodes + +local noad_ord = noadcodes.ord +local noad_rel = noadcodes.rel +local noad_punct = noadcodes.punct + +local math_noad = nodecodes.noad -- attr nucleus sub sup +local math_accent = nodecodes.accent -- attr nucleus sub sup accent +local math_radical = nodecodes.radical -- attr nucleus sub sup left degree +local math_fraction = nodecodes.fraction -- attr nucleus sub sup left right +local math_box = nodecodes.subbox -- attr list +local math_sub = nodecodes.submlist -- attr list +local math_char = nodecodes.mathchar -- attr fam char +local math_textchar = nodecodes.mathtextchar -- attr fam char +local math_delim = nodecodes.delim -- attr small_fam small_char large_fam large_char +local math_style = nodecodes.style -- attr style +local math_choice = nodecodes.choice -- attr display text script scriptscript +local math_fence = nodecodes.fence -- attr subtype + +local left_fence_code = 1 + +local function process(start,what,n,parent) if n then n = n + 1 else n = 0 end while start do + local id = start.id if trace_processing then - logs.report("math","%s%s",rep(" ",n or 0),tostring(start)) + local margin = rep(" ",n or 0) + local detail = tostring(start) + if id == math_noad then + report_processing("%s%s (class: %s)",margin,detail,noadcodes[start.subtype] or "?") + elseif id == math_char then + local char = start.char + local fam = start.fam + local font = font_of_family(fam) + report_processing("%s%s (family: %s, font: %s, char: %s, shape: %s)",margin,detail,fam,font,char,utfchar(char)) + else + report_processing("%s%s",margin,detail) + end end - local id = start.id local proc = what[id] if proc then - proc(start,what,n) - elseif id == math_char or id == math_text_char or id == math_delim then + local done, newstart = proc(start,what,n,parent or start.prev) + if newstart then + start = newstart + end + elseif id == math_char or id == math_textchar or id == math_delim then break elseif id == math_style then -- has a next elseif id == math_noad then - local noad = start.nucleus if noad then process(noad,what,n) end -- list - noad = start.sup if noad then process(noad,what,n) end -- list - noad = start.sub if noad then process(noad,what,n) end -- list + local noad = start.nucleus if noad then process(noad,what,n,start) end -- list + noad = start.sup if noad then process(noad,what,n,start) end -- list + noad = start.sub if noad then process(noad,what,n,start) end -- list elseif id == math_box or id == math_sub then - local noad = start.list if noad then process(noad,what,n) end -- list + local noad = start.list if noad then process(noad,what,n,start) end -- list elseif id == math_fraction then - local noad = start.num if noad then process(noad,what,n) end -- list - noad = start.denom if noad then process(noad,what,n) end -- list - noad = start.left if noad then process(noad,what,n) end -- delimiter - noad = start.right if noad then process(noad,what,n) end -- delimiter + local noad = start.num if noad then process(noad,what,n,start) end -- list + noad = start.denom if noad then process(noad,what,n,start) end -- list + noad = start.left if noad then process(noad,what,n,start) end -- delimiter + noad = start.right if noad then process(noad,what,n,start) end -- delimiter elseif id == math_choice then - local noad = start.display if noad then process(noad,what,n) end -- list - noad = start.text if noad then process(noad,what,n) end -- list - noad = start.script if noad then process(noad,what,n) end -- list - noad = start.scriptscript if noad then process(noad,what,n) end -- list + local noad = start.display if noad then process(noad,what,n,start) end -- list + noad = start.text if noad then process(noad,what,n,start) end -- list + noad = start.script if noad then process(noad,what,n,start) end -- list + noad = start.scriptscript if noad then process(noad,what,n,start) end -- list elseif id == math_fence then - local noad = start.delim if noad then process(noad,what,n) end -- delimiter + local noad = start.delim if noad then process(noad,what,n,start) end -- delimiter elseif id == math_radical then - local noad = start.nucleus if noad then process(noad,what,n) end -- list - noad = start.sup if noad then process(noad,what,n) end -- list - noad = start.sub if noad then process(noad,what,n) end -- list - noad = start.left if noad then process(noad,what,n) end -- delimiter - noad = start.degree if noad then process(noad,what,n) end -- list + local noad = start.nucleus if noad then process(noad,what,n,start) end -- list + noad = start.sup if noad then process(noad,what,n,start) end -- list + noad = start.sub if noad then process(noad,what,n,start) end -- list + noad = start.left if noad then process(noad,what,n,start) end -- delimiter + noad = start.degree if noad then process(noad,what,n,start) end -- list elseif id == math_accent then - local noad = start.nucleus if noad then process(noad,what,n) end -- list - noad = start.sup if noad then process(noad,what,n) end -- list - noad = start.sub if noad then process(noad,what,n) end -- list - noad = start.accent if noad then process(noad,what,n) end -- list - noad = start.bot_accent if noad then process(noad,what,n) end -- list + local noad = start.nucleus if noad then process(noad,what,n,start) end -- list + noad = start.sup if noad then process(noad,what,n,start) end -- list + noad = start.sub if noad then process(noad,what,n,start) end -- list + noad = start.accent if noad then process(noad,what,n,start) end -- list + noad = start.bot_accent if noad then process(noad,what,n,start) end -- list else -- glue, penalty, etc end @@ -143,16 +149,16 @@ noads.process = process local mathalphabet = attributes.private("mathalphabet") local mathgreek = attributes.private("mathgreek") -noads.processors.relocate = { } +processors.relocate = { } local function report_remap(tag,id,old,new,extra) - logs.report("math","remapping %s in font %s from U+%04X (%s) to U+%04X (%s)%s",tag,id,old,utfchar(old),new,utfchar(new),extra or "") + report_remapping("remapping %s in font %s from U+%05X (%s) to U+%05X (%s)%s",tag,id,old,utfchar(old),new,utfchar(new),extra or "") end -local remap_alphabets = mathematics.remap_alphabets -local fcs = fonts.color.set +local remapalphabets = mathematics.remapalphabets +local setnodecolor = nodes.tracers.colors.set --- we can have a global famdata == fonts.famdata and chrdata == fonts.chrdata +-- we can have a global famdata == fonts.famdata --~ This does not work out well, as there are no fallbacks. Ok, we could --~ define a poor mans simplify mechanism. @@ -171,7 +177,7 @@ local fcs = fonts.color.set --~ report_remap("fallback",id,char,newchar) --~ end --~ if trace_analyzing then ---~ fcs(pointer,"font:isol") +--~ setnodecolor(pointer,"font:isol") --~ end --~ pointer.char = newchar --~ return true @@ -179,7 +185,9 @@ local fcs = fonts.color.set --~ end --~ end -noads.processors.relocate[math_char] = function(pointer) +local current_id, current_characters + +processors.relocate[math_char] = function(pointer) local g = has_attribute(pointer,mathgreek) or 0 local a = has_attribute(pointer,mathalphabet) or 0 if a > 0 or g > 0 then @@ -190,17 +198,24 @@ noads.processors.relocate[math_char] = function(pointer) set_attribute(pointer,mathalphabet,0) end local char = pointer.char - local newchar = remap_alphabets(char,a,g) + local newchar = remapalphabets(char,a,g) if newchar then local fam = pointer.fam local id = font_of_family(fam) + -- local tfmdata = fontdata[id] - if tfmdata and tfmdata.characters[newchar] then -- we could probably speed this up + if tfmdata and tfmdata.characters[newchar] then + -- -- to be tested: + -- if id ~= current_id then + -- current_id = id + -- current_characters = fontdata[id].characters + -- end + -- if current_characters and current_characters[newchar] then if trace_remapping then report_remap("char",id,char,newchar) end if trace_analyzing then - fcs(pointer,"font:isol") + setnodecolor(pointer,"font:isol") end pointer.char = newchar return true @@ -214,24 +229,24 @@ noads.processors.relocate[math_char] = function(pointer) -- return checked(pointer) end if trace_analyzing then - fcs(pointer,"font:medi") + setnodecolor(pointer,"font:medi") end end -noads.processors.relocate[math_text_char] = function(pointer) +processors.relocate[math_textchar] = function(pointer) if trace_analyzing then - fcs(pointer,"font:init") + setnodecolor(pointer,"font:init") end end -noads.processors.relocate[math_delim] = function(pointer) +processors.relocate[math_delim] = function(pointer) if trace_analyzing then - fcs(pointer,"font:fina") + setnodecolor(pointer,"font:fina") end end -function noads.relocate_characters(head,style,penalties) - process(head,noads.processors.relocate) +function handlers.relocate(head,style,penalties) + process(head,processors.relocate) return true end @@ -247,10 +262,10 @@ end local mathsize = attributes.private("mathsize") -noads.processors.resize = { } +local resize = { } processors.resize = resize -noads.processors.resize[math_fence] = function(pointer) - if pointer.subtype == 1 then -- left +resize[math_fence] = function(pointer) + if pointer.subtype == left_fence_code then local a = has_attribute(pointer,mathsize) if a and a > 0 then set_attribute(pointer,mathsize,0) @@ -265,8 +280,8 @@ noads.processors.resize[math_fence] = function(pointer) end end -function noads.resize_characters(head,style,penalties) - process(head,noads.processors.resize) +function handlers.resize(head,style,penalties) + process(head,resize) return true end @@ -274,13 +289,13 @@ end local mathpunctuation = attributes.private("mathpunctuation") -noads.processors.respace = { } +local respace = { } processors.respace = respace local chardata = characters.data -- only [nd,ll,ul][po][nd,ll,ul] -noads.processors.respace[math_noad] = function(pointer) +respace[math_noad] = function(pointer) if pointer.subtype == noad_ord then local a = has_attribute(pointer,mathpunctuation) if a and a > 0 then @@ -327,40 +342,283 @@ noads.processors.respace[math_noad] = function(pointer) end end +function handlers.respace(head,style,penalties) + process(head,respace) + return true +end -function noads.respace_characters(head,style,penalties) - noads.process(head,noads.processors.respace) +-- The following code is dedicated to Luigi Scarso who pointed me +-- to the fact that \not= is not producing valid pdf-a code. +-- The code does not solve this for virtual characters but it does +-- a decent job on collapsing so that fonts that have the right +-- glyph will have a decent unicode point. + +local collapse = { } processors.collapse = collapse + +local mathpairs = characters.mathpairs + +collapse[math_noad] = function(pointer) + if pointer.subtype == noad_rel then + local current_nucleus = pointer.nucleus + if current_nucleus.id == math_char then + local current_char = current_nucleus.char + local mathpair = mathpairs[current_char] + if mathpair then + local next_noad = pointer.next + if next_noad and next_noad.id == math_noad and next_noad.subtype == noad_rel then + local next_nucleus = next_noad.nucleus + if next_nucleus.id == math_char then + local next_char = next_nucleus.char + local newchar = mathpair[next_char] + if newchar then + local fam = current_nucleus.fam + local id = font_of_family(fam) + local tfmdata = fontdata[id] + if tfmdata and tfmdata.characters[newchar] then + -- print("!!!!!",current_char,next_char,newchar) + current_nucleus.char = newchar + local next_next_noad = next_noad.next + if next_next_noad then + pointer.next = next_next_noad + next_next_noad.prev = pointer + else + pointer.next = nil + end + node.free(next_noad) + end + end + end + end + end + end + end +end + +function noads.handlers.collapse(head,style,penalties) + process(head,collapse) + return true +end + +-- normalize scripts + +local unscript = { } noads.processors.unscript = unscript + +local superscripts = characters.superscripts +local subscripts = characters.subscripts + +local replaced = { } + +local function replace(pointer) + local next = pointer.next + local start_super, stop_super, start_sub, stop_sub + local mode = "unset" + while next and next.id == math_noad do + local nextnucleus = next.nucleus + if nextnucleus and nextnucleus.id == math_char and not next.sub and not next.sup then + local char = nextnucleus.char + local s = superscripts[char] + if s then + if not start_super then + start_super = next + mode = "super" + elseif mode == "sub" then + break + end + stop_super = next + next = next.next + nextnucleus.char = s + replaced[char] = (replaced[char] or 0) + 1 + if trace_normalizing then + report_normalizing("superscript: U+05X (%s) => U+05X (%s)",char,utfchar(char),s,utfchar(s)) + end + else + local s = subscripts[char] + if s then + if not start_sub then + start_sub = next + mode = "sub" + elseif mode == "super" then + break + end + stop_sub = next + next = next.next + nextnucleus.char = s + replaced[char] = (replaced[char] or 0) + 1 + if trace_normalizing then + report_normalizing("subscript: U+05X (%s) => U+05X (%s)",char,utfchar(char),s,utfchar(s)) + end + else + break + end + end + else + break + end + end + if start_super then + if start_super == stop_super then + pointer.sup = start_super.nucleus + else + local list = node.new(math_sub) -- todo attr + list.head = start_super + pointer.sup = list + end + if mode == "super" then + pointer.next = stop_super.next + end + stop_super.next = nil + end + if start_sub then + if start_sub == stop_sub then + pointer.sub = start_sub.nucleus + else + local list = node.new(math_sub) -- todo attr + list.head = start_sub + pointer.sub = list + end + if mode == "sub" then + pointer.next = stop_sub.next + end + stop_sub.next = nil + end +end + + unscript[math_noad] = replace +-- unscript[math_accent] = replace +-- unscript[math_radical] = replace +-- unscript[math_fraction] = replace + +function handlers.unscript(head,style,penalties) + process(head,unscript) + return true +end + +statistics.register("math script replacements", function() + if next(replaced) then + local n, t = 0, { } + for k, v in table.sortedpairs(replaced) do + n = n + v + t[#t+1] = format("U+%05X:%s",k,utfchar(k)) + end + return format("%s (n=%s)",concat(t," "),n) + end +end) + +-- math alternates: (in xits lgf: $ABC$ $\cal ABC$ $\mathalternate{cal}\cal ABC$) + +local function initializemathalternates(tfmdata) + local goodies = tfmdata.goodies + if goodies then + local shared = tfmdata.shared + for i=1,#goodies do + -- first one counts + -- we can consider sharing the attributes ... todo (only once scan) + local mathgoodies = goodies[i].mathematics + local alternates = mathgoodies and mathgoodies.alternates + if alternates then + local lastattribute, attributes = 0, { } + for k, v in next, alternates do + lastattribute = lastattribute + 1 + v.attribute = lastattribute + attributes[lastattribute] = v + end + shared.mathalternates = alternates -- to be checked if shared is ok here + shared.mathalternatesattributes = attributes -- to be checked if shared is ok here + return + end + end + end +end + +registerotffeature { + name = "mathalternates", + description = "additional math alternative shapes", + initializers = { + base = initializemathalternates, + node = initializemathalternates, + } +} + +local getalternate = otf.getalternate + +local mathalternate = attributes.private("mathalternate") + +local alternate = { } -- processors.alternate = alternate + +function mathematics.setalternate(fam,tag) + local id = font_of_family(fam) + local tfmdata = fontdata[id] + local mathalternates = tfmdata.shared.mathalternates + if mathalternates then + local m = mathalternates[tag] + tex.attribute[mathalternate] = m and m.attribute or attributes.unsetvalue + end +end + +alternate[math_char] = function(pointer) + local a = has_attribute(pointer,mathalternate) + if a and a > 0 then + set_attribute(pointer,mathalternate,0) + local tfmdata = fontdata[font_of_family(pointer.fam)] -- we can also have a famdata + local mathalternatesattributes = tfmdata.shared.mathalternatesattributes + if mathalternatesattributes then + local what = mathalternatesattributes[a] + local alt = getalternate(tfmdata,pointer.char,what.feature,what.value) + if alt then + pointer.char = alt + end + end + end +end + +function handlers.check(head,style,penalties) + process(head,alternate) return true end -- the normal builder -function noads.mlist_to_hlist(head,style,penalties) +function builders.kernel.mlist_to_hlist(head,style,penalties) return mlist_to_hlist(head,style,penalties), true end -tasks.new ( - "math", - { +--~ function builders.kernel.mlist_to_hlist(head,style,penalties) +--~ print("!!!!!!! BEFORE",penalties) +--~ for n in node.traverse(head) do print(n) end +--~ print("!!!!!!!") +--~ head = mlist_to_hlist(head,style,penalties) +--~ print("!!!!!!! AFTER") +--~ for n in node.traverse(head) do print(n) end +--~ print("!!!!!!!") +--~ return head, true +--~ end + +tasks.new { + name = "math", + arguments = 2, + sequence = { "before", "normalizers", "builders", "after", } -) +} + +tasks.freezegroup("math", "normalizers") -- experimental +tasks.freezegroup("math", "builders") -- experimental -local actions = tasks.actions("math",2) -- head, style, penalties +local actions = tasks.actions("math") -- head, style, penalties local starttiming, stoptiming = statistics.starttiming, statistics.stoptiming -function nodes.processors.mlist_to_hlist(head,style,penalties) +function processors.mlist_to_hlist(head,style,penalties) starttiming(noads) local head, done = actions(head,style,penalties) stoptiming(noads) return head, done end -callbacks.register('mlist_to_hlist',nodes.processors.mlist_to_hlist,"preprocessing math list") +callbacks.register('mlist_to_hlist',processors.mlist_to_hlist,"preprocessing math list") -- tracing diff --git a/Master/texmf-dist/tex/context/base/math-pln.mkiv b/Master/texmf-dist/tex/context/base/math-pln.mkiv index ab584f10a32..6deac5efb9e 100644 --- a/Master/texmf-dist/tex/context/base/math-pln.mkiv +++ b/Master/texmf-dist/tex/context/base/math-pln.mkiv @@ -59,8 +59,8 @@ \cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill \mkern-7mu\smash-$} -\let\sp=^ % will become obsolete -\let\sb=_ % will become obsolete +% \let\sp=^ % obsolete +% \let\sb=_ % obsolete \ifx\,\undefined \def\,{\mskip \thinmuskip } \fi \ifx\>\undefined \def\>{\mskip \medmuskip } \fi @@ -68,27 +68,27 @@ \ifx\!\undefined \def\!{\mskip-\thinmuskip } \fi \ifx\*\undefined \def\*{\discretionary{\thinspace\the\textfont2\char2}{}{}} \fi -% {\catcode`\'=\active \gdef'{^\bgroup\prim@s}} +{ \catcode\circumflexasciicode\othercatcode \global\let\othercircumflextoken ^ } +{ \catcode\circumflexasciicode\superscriptcatcode \global\let\superscriptcircumflextoken^ } -\def\activemathquote{^\bgroup\prim@s} +\def\domathprime{^\bgroup\dodomathprime} -\def\prim@s - {\prime\futurelet\next\pr@m@s} +\def\dodomathprime + {\prime\futurelet\nexttoken\dododomathprime} -\def\pr@m@s - {\ifx'\next - \@EA\pr@@@s - \else\ifx^\next - \@EAEAEA\pr@@@t - \else - \@EAEAEA\egroup - \fi\fi} +\def\dododomathprime + {\csname domathprime@% + \ifx '\nexttoken a\else + \ifx\superscriptcircumflextoken\nexttoken b\else + \ifx\othercircumflextoken \nexttoken b\else + c\fi\fi\fi + \endcsname} -\def\pr@@@s#1% - {\prim@s} +\def\domathprime@a #1{\dodomathprime} +\def\domathprime@b#1#2{#2\egroup} +\def\domathprime@c {\egroup} -\def\pr@@@t#1#2% - {#2\egroup} +\let\activemathprime\domathprime % {\catcode`\_=\active \global\let_=\_} % _ in math is either subscript or \_ @@ -173,7 +173,7 @@ \right.} \def\matrix#1% - {\null + {\emptyhbox \,% \vcenter {\normalbaselines\mathsurround\zeropoint @@ -206,7 +206,7 @@ {$\kern\wd\plusone\kern-\mathparentwd\left(\kern-\wd\plusone \global\setbox\plusone\vbox{\box\plusone\kern2\points}% \vcenter{\kern-\ht\plusone\unvbox\zerocount\kern-\baselineskip}\,\right)$}% - \null + \emptyhbox \;% \vbox{\kern\ht\plusone\box\plustwo}% \endgroup} @@ -230,7 +230,7 @@ \def\displayopenupvalue{.25\bodyfontsize} \def\eqalign#1% - {\null + {\emptyhbox \,% \vcenter {\openup\displayopenupvalue % was \openup\jot @@ -282,17 +282,6 @@ % \appendtoks \setcatcodetable\mthcatcodes \to \everymath : spoils xml -% tricky, but some day we will reimplement math - -\bgroup - \catcode`\_ = 13 - \catcode`\' = 13 - \doglobal\appendtoks - \let_\activemathunderscore - \let'\activemathquote - \to \everymathematics -\egroup - % so far \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/math-scr.mkiv b/Master/texmf-dist/tex/context/base/math-scr.mkiv index eb1db4714e3..e17ce42f375 100644 --- a/Master/texmf-dist/tex/context/base/math-scr.mkiv +++ b/Master/texmf-dist/tex/context/base/math-scr.mkiv @@ -15,68 +15,6 @@ \unprotect -%D \macros -%D {super, sub} -%D -%D \TEX\ uses \type{^} and \type{_} for entering super- and -%D subscript mode. We want however a bit more control than -%D normally provided, and therefore provide \type {\super} -%D and \type{sub}. -%D -%D The grid snapping has been removed. - -\global\let\normalsuper=^ -\global\let\normalsuber=_ - -\ifdefined\supersubmode \else \newcount\supersubmode \fi -\ifdefined\newevery \else \everysupersub \EverySuperSub \fi - -\appendtoks \advance\supersubmode \plusone \to \everysupersub - -\setuptextformulas - [\c!size=\v!normal] - -\def\normalsupsub#1#2% - {^{\the\everysupersub#1}_{\the\everysupersub#2}} - -\def\super#1{^{\the\everysupersub#1}} -\def\suber#1{_{\the\everysupersub#1}} -\def\supsub#1#2{\super{#1}\suber{#2}} -\def\subsup#1#2{\suber{#1}\super{#2}} - -%D \macros -%D {enablesupersub,enablesimplesupersub} -%D -%D We can let \type {^} and \type {_} act like \type {\super} -%D and \type {\sub} by saying \type {\enablesupersub}. - -\bgroup -\catcode`\^=\@@active -\catcode`\_=\@@active -\gdef\enablesupersub - {\catcode`\^=\@@active - \def^{\ifmmode\expandafter\super\else\expandafter\normalsuper\fi}% - \catcode`\_=\@@active - \def_{\ifmmode\expandafter\suber\else\expandafter\normalsuber\fi}} -\egroup - -%D \macros -%D {restoremathstyle} -%D -%D We can pick up the current math style by calling \type -%D {\restoremathstyle}. - -\def\restoremathstyle - {\ifmmode - \ifcase\supersubmode - \textstyle - \or - \scriptstyle - \else - \scriptscriptstyle - \fi - \fi} - %D These macros were first needed by Frits Spijker (also %D known as Gajes) for typesetting the minus sign that is %D keyed into scientific calculators. @@ -132,4 +70,7 @@ %D How negative such a symbol looks is demonstrated in: %D $\negative 10^{\negative 10^{\negative 10}}$. +\setuptextformulas % why here + [\c!size=\v!normal] + \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/math-tag.lua b/Master/texmf-dist/tex/context/base/math-tag.lua new file mode 100644 index 00000000000..e5ad30be06e --- /dev/null +++ b/Master/texmf-dist/tex/context/base/math-tag.lua @@ -0,0 +1,252 @@ +if not modules then modules = { } end modules ['math-tag'] = { + version = 1.001, + comment = "companion to math-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local attributes, nodes = attributes, nodes + +local get_attribute = nodes.getattribute +local set_attribute = nodes.setattribute +local set_attributes = nodes.setattributes +local traverse_nodes = node.traverse + +local nodecodes = nodes.nodecodes + +local math_noad_code = nodecodes.noad -- attr nucleus sub sup +local math_accent_code = nodecodes.accent -- attr nucleus sub sup accent +local math_radical_code = nodecodes.radical -- attr nucleus sub sup left degree +local math_fraction_code = nodecodes.fraction -- attr nucleus sub sup left right +local math_box_code = nodecodes.subbox -- attr list +local math_sub_code = nodecodes.submlist -- attr list +local math_char_code = nodecodes.mathchar -- attr fam char +local math_textchar_code = nodecodes.mathtextchar -- attr fam char +local math_delim_code = nodecodes.delim -- attr small_fam small_char large_fam large_char +local math_style_code = nodecodes.style -- attr style +local math_choice_code = nodecodes.choice -- attr display text script scriptscript +local math_fence_code = nodecodes.fence -- attr subtype + +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist +local glyph_code = nodecodes.glyph + +local a_tagged = attributes.private('tagged') + +local tags = structures.tags + +local start_tagged = tags.start +local stop_tagged = tags.stop +local taglist = tags.taglist + +local chardata = characters.data + +local process + +local function processsubsup(start) + local nucleus, sup, sub = start.nucleus, start.sup, start.sub + if sub then + if sup then + set_attribute(start,a_tagged,start_tagged("msubsup")) + process(nucleus) + process(sup) + process(sub) + stop_tagged() + else + set_attribute(start,a_tagged,start_tagged("msub")) + process(nucleus) + process(sub) + stop_tagged() + end + elseif sup then + set_attribute(start,a_tagged,start_tagged("msup")) + process(nucleus) + process(sup) + stop_tagged() + else + process(nucleus) + end +end + +process = function(start) -- we cannot use the processor as we have no finalizers (yet) + while start do + local id = start.id + if id == math_char_code then + -- check for code + local ch = chardata[start.char] + local mc = ch and ch.mathclass + if mc == "number" then + set_attribute(start,a_tagged,start_tagged("mn")) + elseif mc == "variable" or not mc then -- variable is default + set_attribute(start,a_tagged,start_tagged("mi")) + else + set_attribute(start,a_tagged,start_tagged("mo")) + end + stop_tagged() + break + elseif id == math_textchar_code then + -- check for code + set_attribute(start,a_tagged,start_tagged("ms")) + stop_tagged() + break + elseif id == math_delim_code then + -- check for code + set_attribute(start,a_tagged,start_tagged("mo")) + stop_tagged() + break + elseif id == math_style_code then + -- has a next + elseif id == math_noad_code then + processsubsup(start) + elseif id == math_box_code or id == hlist_code or id == vlist_code then + -- keep an eye on math_box_code and see what ends up in there + local attr = get_attribute(start,a_tagged) + local text = start_tagged("mtext") + set_attribute(start,a_tagged,text) + local list = start.list + if not list then + -- empty list + elseif not attr then + -- box comes from strange place + set_attributes(list,a_tagged,text) + else + -- Beware, the first node in list is the actual list so we definitely + -- need to nest. This approach is a hack, maybe I'll make a proper + -- nesting feature to deal with this at another level. Here we just + -- fake structure by enforcing the inner one. + local tagdata = taglist[attr] + local common = #tagdata + 1 + local function runner(list) -- quite inefficient + local cache = { } -- we can have nested unboxed mess so best local to runner + for n in traverse_nodes(list) do + local id = n.id + if id == hlist_code or id == vlist_code then + runner(n.list) + elseif id == glyph_code then + local aa = get_attribute(n,a_tagged) -- only glyph needed + if aa then + local ac = cache[aa] + if not ac then + local tagdata = taglist[aa] + local extra = #tagdata + if common <= extra then + for i=common,extra do + ac = start_tagged(tagdata[i]) -- can be made faster + end + for i=common,extra do + stop_tagged() -- can be made faster + end + else + ac = text + end + cache[aa] = ac + end + set_attribute(n,a_tagged,ac) + else + set_attribute(n,a_tagged,text) + end + end + end + end + runner(list) + end + stop_tagged() + elseif id == math_sub_code then + local list = start.list + if list then + set_attribute(start,a_tagged,start_tagged("mrow")) + process(list) + stop_tagged() + end + elseif id == math_fraction_code then + local num, denom, left, right = start.num, start.denom, start.left, start.right + if left then + set_attribute(left,a_tagged,start_tagged("mo")) + process(left) + stop_tagged() + end + set_attribute(start,a_tagged,start_tagged("mfrac")) + process(num) + process(denom) + stop_tagged() + if right then + set_attribute(right,a_tagged,start_tagged("mo")) + process(right) + stop_tagged() + end + elseif id == math_choice_code then + local display, text, script, scriptscript = start.display, start.text, start.script, start.scriptscript + if display then + process(display) + end + if text then + process(text) + end + if script then + process(script) + end + if scriptscript then + process(scriptscript) + end + elseif id == math_fence_code then + local delim = start.delim + if delim then + set_attribute(start,a_tagged,start_tagged("mo")) + process(delim) + stop_tagged() + end + elseif id == math_radical_code then + local left, degree = start.left, start.degree + if left then + process(left) -- mrow needed ? + end + if degree then + set_attribute(start,a_tagged,start_tagged("mroot")) + processsubsup(start) + process(degree) + stop_tagged() + else + set_attribute(start,a_tagged,start_tagged("msqrt")) + processsubsup(start) + stop_tagged() + end + elseif id == math_accent_code then + local accent, bot_accent = start.accent, start.bot_accent + if bot_accent then + if accent then + set_attribute(start,a_tagged,start_tagged("munderover")) + process(accent) + processsubsup(start) + process(bot_accent) + stop_tagged() + else + set_attribute(start,a_tagged,start_tagged("munder")) + processsubsup(start) + process(bot_accent) + stop_tagged() + end + elseif accent then + set_attribute(start,a_tagged,start_tagged("mover")) + process(accent) + processsubsup(start) + stop_tagged() + else + processsubsup(start) + end + else + set_attribute(start,a_tagged,start_tagged("merror")) + stop_tagged() + end + start = start.next + end +end + +function noads.handlers.tags(head,style,penalties) + set_attribute(head,a_tagged,start_tagged("math")) + set_attribute(head,a_tagged,start_tagged("mrow")) + process(head) + stop_tagged() + stop_tagged() + return true +end diff --git a/Master/texmf-dist/tex/context/base/math-vfu.lua b/Master/texmf-dist/tex/context/base/math-vfu.lua index 5023e6b4d65..49bf00ffe92 100644 --- a/Master/texmf-dist/tex/context/base/math-vfu.lua +++ b/Master/texmf-dist/tex/context/base/math-vfu.lua @@ -11,42 +11,52 @@ if not modules then modules = { } end modules ['math-vfu'] = { -- characters report it to the ConTeXt mailing list. local type, next = type, next +local max = math.max + +local fonts, nodes, mathematics = fonts, nodes, mathematics local trace_virtual = false trackers.register("math.virtual", function(v) trace_virtual = v end) local trace_timings = false trackers.register("math.timings", function(v) trace_timings = v end) -fonts.enc.math = fonts.enc.math or { } +local report_virtual = logs.reporter("fonts","virtual math") -local shared = { } +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex -fonts.vf.math = fonts.vf.math or { } -fonts.vf.math.optional = false +local mathencodings = allocate() +fonts.encodings.math = mathencodings -- better is then: fonts.encodings.vectors +local vfmath = allocate() +fonts.handlers.vf.math = vfmath -local push, pop, back = { "push" }, { "pop" }, { "slot", 1, 0x2215 } +vfmath.optional = false -local function negate(main,characters,id,size,unicode,basecode) - if not characters[unicode] then - local basechar = characters[basecode] - if basechar then - local ht, wd = basechar.height, basechar.width - characters[unicode] = { - width = wd, - height = ht, - depth = basechar.depth, - italic = basechar.italic, - kerns = basechar.kerns, - commands = { - { "slot", 1, basecode }, - push, - { "down", ht/5}, - { "right", - wd/2}, - back, - push, - } - } - end - end -end +local shared = { } + +--~ local push, pop, back = { "push" }, { "pop" }, { "slot", 1, 0x2215 } + +--~ local function negate(main,characters,id,size,unicode,basecode) +--~ if not characters[unicode] then +--~ local basechar = characters[basecode] +--~ if basechar then +--~ local ht, wd = basechar.height, basechar.width +--~ characters[unicode] = { +--~ width = wd, +--~ height = ht, +--~ depth = basechar.depth, +--~ italic = basechar.italic, +--~ kerns = basechar.kerns, +--~ commands = { +--~ { "slot", 1, basecode }, +--~ push, +--~ { "down", ht/5}, +--~ { "right", - wd/2}, +--~ back, +--~ push, +--~ } +--~ } +--~ end +--~ end +--~ end --~ \Umathchardef\braceld="0 "1 "FF07A --~ \Umathchardef\bracerd="0 "1 "FF07B @@ -69,20 +79,19 @@ local function brace(main,characters,id,size,unicode,first,rule,left,right,rule, end local function arrow(main,characters,id,size,unicode,arrow,minus,isleft) - if characters[unicode] then - if isleft then - t = { - { extender = 0, glyph = arrow }, - { extender = 1, glyph = minus }, - } - else - t = { - { extender = 0, glyph = minus }, - { extender = 1, glyph = arrow }, - } - end - --~ main.characters[unicode] = { horiz_variants = t } - characters[unicode].horiz_variants = t + local chr = characters[unicode] + if not chr then + -- skip + elseif isleft then + chr.horiz_variants = { + { extender = 0, glyph = arrow }, + { extender = 1, glyph = minus }, + } + else + chr.horiz_variants = { + { extender = 0, glyph = minus }, + { extender = 1, glyph = arrow }, + } end end @@ -226,172 +235,312 @@ local function vertbar(main,characters,id,size,parent,scale,unicode) end end -function fonts.vf.math.alas(main,id,size) - local characters = main.characters - for i=0x7A,0x7D do - make(main,characters,id,size,i,1) +local function jointwo(main,characters,id,size,unicode,u1,d12,u2) + local c1, c2 = characters[u1], characters[u2] + if c1 and c2 then + local w1, w2 = c1.width, c2.width + local mu = size/18 + characters[unicode] = { + width = w1 + w2 - d12*mu, + height = max(c1.height or 0, c2.height or 0), + depth = max(c1.depth or 0, c2.depth or 0), + commands = { + { "slot", id, u1 }, + { "right", -d12*mu } , + { "slot", id, u2 }, + } + } end - brace (main,characters,id,size,0x23DE,0xFF17A,0xFF301,0xFF17D,0xFF17C,0xFF301,0xFF17B) - brace (main,characters,id,size,0x23DF,0xFF27C,0xFF401,0xFF27B,0xFF27A,0xFF401,0xFF27D) - parent (main,characters,id,size,0x23DC,0xFF17A,0xFF301,0xFF17B) - parent (main,characters,id,size,0x23DD,0xFF27C,0xFF401,0xFF27D) - negate (main,characters,id,size,0x2260,0x003D) - dots (main,characters,id,size,0x2026) -- ldots - dots (main,characters,id,size,0x22EE) -- vdots - dots (main,characters,id,size,0x22EF) -- cdots - dots (main,characters,id,size,0x22F1) -- ddots - dots (main,characters,id,size,0x22F0) -- udots - minus (main,characters,id,size,0xFF501) - arrow (main,characters,id,size,0x2190,0xFE190,0xFF501,true) -- left - arrow (main,characters,id,size,0x2192,0xFE192,0xFF501,false) -- right - vertbar(main,characters,id,size,0x0007C,0.10,0xFF601) -- big : 0.85 bodyfontsize - vertbar(main,characters,id,size,0xFF601,0.30,0xFF602) -- Big : 1.15 bodyfontsize - vertbar(main,characters,id,size,0xFF602,0.30,0xFF603) -- bigg : 1.45 bodyfontsize - vertbar(main,characters,id,size,0xFF603,0.30,0xFF604) -- Bigg : 1.75 bodyfontsize - vertbar(main,characters,id,size,0x02225,0.10,0xFF605) - vertbar(main,characters,id,size,0xFF605,0.30,0xFF606) - vertbar(main,characters,id,size,0xFF606,0.30,0xFF607) - vertbar(main,characters,id,size,0xFF607,0.30,0xFF608) end -local unique = 0 -- testcase: \startTEXpage \math{!\text{-}\text{-}\text{-}} \stopTEXpage - -function fonts.basecopy(tfmtable,name) - local characters, parameters, fullname = tfmtable.characters, tfmtable.parameters, tfmtable.fullname - local t, c, p = { }, { }, { } - for k, v in next, tfmtable do - t[k] = v - end - if characters then - for k, v in next, characters do - c[k] = v - end - t.characters = c - else - logs.report("math virtual","font %s has no characters",name) +local function jointhree(main,characters,id,size,unicode,u1,d12,u2,d23,u3) + local c1, c2, c3 = characters[u1], characters[u2], characters[u3] + if c1 and c2 and c3 then + local w1, w2, w3 = c1.width, c2.width, c3.width + local mu = size/18 + characters[unicode] = { + width = w1 + w2 + w3 - d12*mu - d23*mu, + height = max(c1.height or 0, c2.height or 0, c3.height or 0), + depth = max(c1.depth or 0, c2.depth or 0, c3.depth or 0), + commands = { + { "slot", id, u1 }, + { "right", - d12*mu } , + { "slot", id, u2 }, + { "right", - d23*mu }, + { "slot", id, u3 }, + } + } end - if parameters then - for k, v in next, parameters do - p[k] = v - end - t.parameters = p - else - logs.report("math virtual","font %s has no parameters",name) +end + +local function stack(main,characters,id,size,unicode,u1,d12,u2) + local c1, c2 = characters[u1], characters[u2] + if c1 and c2 then + local w1, w2 = c1.width, c2.width + local h1, h2 = c1.height, c2.height + local d1, d2 = c1.depth, c2.depth + local mu = size/18 + characters[unicode] = { + width = w1, + height = h1 + h2 + d12, + depth = d1, + commands = { + { "slot", id, u1 }, + { "right", - w1/2 - w2/2 } , + { "down", -h1 + d2 -d12*mu } , + { "slot", id, u2 }, + } + } end - -- tricky ... what if fullname does not exist - if fullname then - unique = unique + 1 - t.fullname = fullname .. "-" .. unique +end + +function vfmath.addmissing(main,id,size) + local characters = main.characters + local shared = main.shared + local variables = main.goodies.mathematics and main.goodies.mathematics.variables or { } + local joinrelfactor = variables.joinrelfactor or 3 + for i=0x7A,0x7D do + make(main,characters,id,size,i,1) end - return t + brace (main,characters,id,size,0x23DE,0xFF17A,0xFF301,0xFF17D,0xFF17C,0xFF301,0xFF17B) + brace (main,characters,id,size,0x23DF,0xFF27C,0xFF401,0xFF27B,0xFF27A,0xFF401,0xFF27D) + parent (main,characters,id,size,0x23DC,0xFF17A,0xFF301,0xFF17B) + parent (main,characters,id,size,0x23DD,0xFF27C,0xFF401,0xFF27D) + -- negate (main,characters,id,size,0x2260,0x003D) + dots (main,characters,id,size,0x2026) -- ldots + dots (main,characters,id,size,0x22EE) -- vdots + dots (main,characters,id,size,0x22EF) -- cdots + dots (main,characters,id,size,0x22F1) -- ddots + dots (main,characters,id,size,0x22F0) -- udots + minus (main,characters,id,size,0xFF501) + arrow (main,characters,id,size,0x2190,0xFE190,0xFF501,true) -- left + arrow (main,characters,id,size,0x2192,0xFE192,0xFF501,false) -- right + vertbar (main,characters,id,size,0x0007C,0.10,0xFF601) -- big : 0.85 bodyfontsize + vertbar (main,characters,id,size,0xFF601,0.30,0xFF602) -- Big : 1.15 bodyfontsize + vertbar (main,characters,id,size,0xFF602,0.30,0xFF603) -- bigg : 1.45 bodyfontsize + vertbar (main,characters,id,size,0xFF603,0.30,0xFF604) -- Bigg : 1.75 bodyfontsize + vertbar (main,characters,id,size,0x02016,0.10,0xFF605) + vertbar (main,characters,id,size,0xFF605,0.30,0xFF606) + vertbar (main,characters,id,size,0xFF606,0.30,0xFF607) + vertbar (main,characters,id,size,0xFF607,0.30,0xFF608) + jointwo (main,characters,id,size,0x21A6,0xFE321,0,0x02192) -- \mapstochar\rightarrow + jointwo (main,characters,id,size,0x21A9,0x02190,joinrelfactor,0xFE323) -- \leftarrow\joinrel\rhook + jointwo (main,characters,id,size,0x21AA,0xFE322,joinrelfactor,0x02192) -- \lhook\joinrel\rightarrow + stack (main,characters,id,size,0x2259,0x0003D,3,0x02227) -- \buildrel\wedge\over= + jointwo (main,characters,id,size,0x22C8,0x022B3,joinrelfactor,0x022B2) -- \mathrel\triangleright\joinrel\mathrel\triangleleft (4 looks better than 3) + jointwo (main,characters,id,size,0x2260,0x00338,0,0x0003D) -- \not\equal + jointwo (main,characters,id,size,0x2284,0x00338,0,0x02282) -- \not\subset + jointwo (main,characters,id,size,0x2285,0x00338,0,0x02283) -- \not\supset + jointwo (main,characters,id,size,0x22A7,0x0007C,joinrelfactor,0x0003D) -- \mathrel|\joinrel= + jointwo (main,characters,id,size,0x27F5,0x02190,joinrelfactor,0x0002D) -- \leftarrow\joinrel\relbar + jointwo (main,characters,id,size,0x27F6,0x0002D,joinrelfactor,0x02192) -- \relbar\joinrel\rightarrow + jointwo (main,characters,id,size,0x27F7,0x02190,joinrelfactor,0x02192) -- \leftarrow\joinrel\rightarrow + jointwo (main,characters,id,size,0x27F8,0x021D0,joinrelfactor,0x0003D) -- \Leftarrow\joinrel\Relbar + jointwo (main,characters,id,size,0x27F9,0x0003D,joinrelfactor,0x021D2) -- \Relbar\joinrel\Rightarrow + jointwo (main,characters,id,size,0x27FA,0x021D0,joinrelfactor,0x021D2) -- \Leftarrow\joinrel\Rightarrow + jointhree(main,characters,id,size,0x27FB,0x02190,joinrelfactor,0x0002D,0,0xFE324) -- \leftarrow\joinrel\relbar\mapsfromchar + jointhree(main,characters,id,size,0x27FC,0xFE321,0,0x0002D,joinrelfactor,0x02192) -- \mapstochar\relbar\joinrel\rightarrow end +local unique = 0 -- testcase: \startTEXpage \math{!\text{-}\text{-}\text{-}} \stopTEXpage + local reported = { } -local reverse -- index -> unicode +local reverse = { } -- index -> unicode -function fonts.vf.math.define(specification,set) - if not reverse then - reverse = { } - for k, v in next, fonts.enc.math do - local r = { } - for u, i in next, v do - r[i] = u - end - reverse[k] = r - end +setmetatableindex(reverse, function(t,name) + if trace_virtual then + report_virtual("initializing math vector '%s'",name) + end + local m, r = mathencodings[name], { } + for u, i in next, m do + r[i] = u end + reverse[name] = r + return r +end) + +function vfmath.define(specification,set,goodies) local name = specification.name -- symbolic name local size = specification.size -- given size - local fnt, lst, main = { }, { }, nil + local loaded, fontlist, main = { }, { }, nil local start = (trace_virtual or trace_timings) and os.clock() local okset, n = { }, 0 for s=1,#set do local ss = set[s] local ssname = ss.name - if ss.optional and fonts.vf.math.optional then + if ss.optional and vfmath.optional then if trace_virtual then - logs.report("math virtual","loading font %s subfont %s with name %s at %s is skipped",name,s,ssname,size) + report_virtual("loading font %s subfont %s with name %s at %s is skipped",name,s,ssname,size) end else - if ss.features then ssname = ssname .. "*" .. ss.features end - if ss.main then main = s end - local f, id = fonts.tfm.read_and_define(ssname,size) - if not f then - logs.report("math virtual","loading font %s subfont %s with name %s at %s is skipped, not found",name,s,ssname,size) + if ss.features then + ssname = ssname .. "*" .. ss.features + end + if ss.main then + main = s + end + local f, id = fonts.constructors.readanddefine(ssname,size) + if not f or id == 0 then + report_virtual("loading font %s subfont %s with name %s at %s is skipped, not found",name,s,ssname,size) else n = n + 1 okset[n] = ss - fnt[n] = f - lst[n] = { id = id, size = size } + loaded[n] = f + fontlist[n] = { id = id, size = size } if not shared[s] then shared[n] = { } end if trace_virtual then - logs.report("math virtual","loading font %s subfont %s with name %s at %s as id %s using encoding %s",name,s,ssname,size,id,ss.vector or "none") + report_virtual("loading font %s subfont %s with name %s at %s as id %s using encoding %s",name,s,ssname,size,id,ss.vector or "none") + end + if not ss.checked then + ss.checked = true + local vector = mathencodings[ss.vector] + if vector then + -- we resolve named glyphs only once as we can assume that vectors + -- are unique to a font set (when we read an afm we get those names + -- mapped onto the private area) + for unicode, index in next, vector do + if not tonumber(index) then + local u = f.unicodes + u = u and u[index] + if u then + if trace_virtual then + report_virtual("resolving name %s to %s",index,u) + end + else + report_virtual("unable to resolve name %s",index) + end + vector[unicode] = u + end + end + end end end end end - -- beware, fnt[1] is already passed to tex (we need to make a simple copy then .. todo) - main = fonts.basecopy(fnt[1],name) - main.name, main.fonts, main.virtualized, main.math_parameters = name, lst, true, { } - local characters, descriptions = main.characters, main.descriptions - local mp = main.parameters - if mp then - mp.x_height = mp.x_height or 0 + -- beware, loaded[1] is already passed to tex (we need to make a simple copy then .. todo) + local parent = loaded[1] -- a text font + local characters = { } + local parameters = { } + local mathparameters = { } + local descriptions = { } + local metadata = { } + local properties = { } + local goodies = { } + local main = { + metadata = metadata, + properties = properties, + characters = characters, + descriptions = descriptions, + parameters = parameters, + mathparameters = mathparameters, + fonts = fontlist, + goodies = goodies, + } + -- + -- + for key, value in next, parent do + if type(value) ~= "table" then + main[key] = value + end + end + -- + if parent.characters then + for unicode, character in next, parent.characters do + characters[unicode] = character + end + else + report_virtual("font %s has no characters",name) + end + -- + if parent.parameters then + for key, value in next, parent.parameters do + parameters[key] = value + end + else + report_virtual("font %s has no parameters",name) + end + -- + local description = { name = "" } + setmetatableindex(descriptions,function() return description end) + -- + if parent.properties then + setmetatableindex(properties,parent.properties) end + -- + if parent.goodies then + setmetatableindex(goodies,parent.goodies) + end + -- + properties.virtualized = true + properties.italic_correction = true + properties.has_math = true + -- + local fullname = properties.fullname -- parent via mt + if fullname then + unique = unique + 1 + properties.fullname = fullname .. "-" .. unique + end + -- + -- we need to set some values in main as well (still?) + -- + main.fullname = properties.fullname + main.type = "virtual" + main.nomath = false + -- + parameters.x_height = parameters.x_height or 0 + -- local already_reported = false for s=1,n do - local ss, fs = okset[s], fnt[s] + local ss, fs = okset[s], loaded[s] if not fs then -- skip, error - elseif ss.optional and fonts.vf.math.optional then + elseif ss.optional and vfmath.optional then -- skip, redundant else - local mm, fp = main.math_parameters, fs.parameters - if mm and fp and mp then - if ss.extension then - mm.math_x_height = fp.x_height or 0 -- math_x_height height of x - mm.default_rule_thickness = fp[ 8] or 0 -- default_rule_thickness thickness of \over bars - mm.big_op_spacing1 = fp[ 9] or 0 -- big_op_spacing1 minimum clearance above a displayed op - mm.big_op_spacing2 = fp[10] or 0 -- big_op_spacing2 minimum clearance below a displayed op - mm.big_op_spacing3 = fp[11] or 0 -- big_op_spacing3 minimum baselineskip above displayed op - mm.big_op_spacing4 = fp[12] or 0 -- big_op_spacing4 minimum baselineskip below displayed op - mm.big_op_spacing5 = fp[13] or 0 -- big_op_spacing5 padding above and below displayed limits - -- logs.report("math virtual","loading and virtualizing font %s at size %s, setting ex parameters",name,size) - elseif ss.parameters then - mp.x_height = fp.x_height or mp.x_height - mm.x_height = mm.x_height or fp.x_height or 0 -- x_height height of x - mm.num1 = fp[ 8] or 0 -- num1 numerator shift-up in display styles - mm.num2 = fp[ 9] or 0 -- num2 numerator shift-up in non-display, non-\atop - mm.num3 = fp[10] or 0 -- num3 numerator shift-up in non-display \atop - mm.denom1 = fp[11] or 0 -- denom1 denominator shift-down in display styles - mm.denom2 = fp[12] or 0 -- denom2 denominator shift-down in non-display styles - mm.sup1 = fp[13] or 0 -- sup1 superscript shift-up in uncramped display style - mm.sup2 = fp[14] or 0 -- sup2 superscript shift-up in uncramped non-display - mm.sup3 = fp[15] or 0 -- sup3 superscript shift-up in cramped styles - mm.sub1 = fp[16] or 0 -- sub1 subscript shift-down if superscript is absent - mm.sub2 = fp[17] or 0 -- sub2 subscript shift-down if superscript is present - mm.sup_drop = fp[18] or 0 -- sup_drop superscript baseline below top of large box - mm.sub_drop = fp[19] or 0 -- sub_drop subscript baseline below bottom of large box - mm.delim1 = fp[20] or 0 -- delim1 size of \atopwithdelims delimiters in display styles - mm.delim2 = fp[21] or 0 -- delim2 size of \atopwithdelims delimiters in non-displays - mm.axis_height = fp[22] or 0 -- axis_height height of fraction lines above the baseline - -- logs.report("math virtual","loading and virtualizing font %s at size %s, setting sy parameters",name,size) - end - else - logs.report("math virtual","font %s, no parameters set",name) + local newparameters = fs.parameters + if not newparameters then + report_virtual("font %s, no parameters set",name) + elseif ss.extension then + mathparameters.math_x_height = newparameters.x_height or 0 -- math_x_height : height of x + mathparameters.default_rule_thickness = newparameters[ 8] or 0 -- default_rule_thickness : thickness of \over bars + mathparameters.big_op_spacing1 = newparameters[ 9] or 0 -- big_op_spacing1 : minimum clearance above a displayed op + mathparameters.big_op_spacing2 = newparameters[10] or 0 -- big_op_spacing2 : minimum clearance below a displayed op + mathparameters.big_op_spacing3 = newparameters[11] or 0 -- big_op_spacing3 : minimum baselineskip above displayed op + mathparameters.big_op_spacing4 = newparameters[12] or 0 -- big_op_spacing4 : minimum baselineskip below displayed op + mathparameters.big_op_spacing5 = newparameters[13] or 0 -- big_op_spacing5 : padding above and below displayed limits + -- report_virtual("loading and virtualizing font %s at size %s, setting ex parameters",name,size) + elseif ss.parameters then + mathparameters.x_height = newparameters.x_height or mathparameters.x_height + mathparameters.x_height = mathparameters.x_height or fp.x_height or 0 -- x_height : height of x + mathparameters.num1 = newparameters[ 8] or 0 -- num1 : numerator shift-up in display styles + mathparameters.num2 = newparameters[ 9] or 0 -- num2 : numerator shift-up in non-display, non-\atop + mathparameters.num3 = newparameters[10] or 0 -- num3 : numerator shift-up in non-display \atop + mathparameters.denom1 = newparameters[11] or 0 -- denom1 : denominator shift-down in display styles + mathparameters.denom2 = newparameters[12] or 0 -- denom2 : denominator shift-down in non-display styles + mathparameters.sup1 = newparameters[13] or 0 -- sup1 : superscript shift-up in uncramped display style + mathparameters.sup2 = newparameters[14] or 0 -- sup2 : superscript shift-up in uncramped non-display + mathparameters.sup3 = newparameters[15] or 0 -- sup3 : superscript shift-up in cramped styles + mathparameters.sub1 = newparameters[16] or 0 -- sub1 : subscript shift-down if superscript is absent + mathparameters.sub2 = newparameters[17] or 0 -- sub2 : subscript shift-down if superscript is present + mathparameters.sup_drop = newparameters[18] or 0 -- sup_drop : superscript baseline below top of large box + mathparameters.sub_drop = newparameters[19] or 0 -- sub_drop : subscript baseline below bottom of large box + mathparameters.delim1 = newparameters[20] or 0 -- delim1 : size of \atopwithdelims delimiters in display styles + mathparameters.delim2 = newparameters[21] or 0 -- delim2 : size of \atopwithdelims delimiters in non-displays + mathparameters.axis_height = newparameters[22] or 0 -- axis_height : height of fraction lines above the baseline + -- report_virtual("loading and virtualizing font %s at size %s, setting sy parameters",name,size) end local vectorname = ss.vector if vectorname then local offset = 0xFF000 - local vector = fonts.enc.math[vectorname] + local vector = mathencodings[vectorname] local rotcev = reverse[vectorname] - if vector then + if vector and rotcev then local fc, fd, si = fs.characters, fs.descriptions, shared[s] local skewchar = ss.skewchar for unicode, index in next, vector do local fci = fc[index] if not fci then - local fontname = fs.name or "unknown" + local fontname = fs.properties.name or "unknown" local rf = reported[fontname] if not rf then rf = { } reported[fontname] = rf end local rv = rf[vectorname] @@ -399,9 +548,9 @@ function fonts.vf.math.define(specification,set) local ru = rv[unicode] if not ru then if trace_virtual then - logs.report("math virtual", "unicode point U+%05X has no index %04X in vector %s for font %s",unicode,index,vectorname,fontname) + report_virtual( "unicode point U+%05X has no index %04X in vector %s for font %s",unicode,index,vectorname,fontname) elseif not already_reported then - logs.report("math virtual", "the mapping is incomplete for '%s' at %s",name,number.topoints(size)) + report_virtual( "the mapping is incomplete for '%s' at %s",name,number.topoints(size)) already_reported = true end rv[unicode] = true @@ -413,13 +562,17 @@ function fonts.vf.math.define(specification,set) si[index] = ref end local kerns = fci.kerns + local width = fci.width + local italic = fci.italic + -- if italic then + -- width = width + italic -- old interpretation of otf math specs + -- end if kerns then - local width = fci.width local krn = { } - for k=1,#kerns do + for k, v in next, kerns do -- kerns is sparse local rk = rotcev[k] if rk then - krn[rk] = kerns[k] + krn[rk] = v -- kerns[k] end end if not next(krn) then @@ -429,7 +582,7 @@ function fonts.vf.math.define(specification,set) width = width, height = fci.height, depth = fci.depth, - italic = fci.italic, + italic = italic, kerns = krn, commands = ref, } @@ -442,10 +595,10 @@ function fonts.vf.math.define(specification,set) characters[unicode] = t else characters[unicode] = { - width = fci.width, + width = width, height = fci.height, depth = fci.depth, - italic = fci.italic, + italic = italic, commands = ref, } end @@ -453,7 +606,7 @@ function fonts.vf.math.define(specification,set) end if ss.extension then -- todo: if multiple ex, then 256 offsets per instance - local extension = fonts.enc.math["large-to-small"] + local extension = mathencodings["large-to-small"] local variants_done = fs.variants_done for index, fci in next, fc do -- the raw ex file if type(index) == "number" then @@ -507,31 +660,10 @@ function fonts.vf.math.define(specification,set) local cu = characters[unicode] if cu then cu.next = offset + index - --~ local n, c, d = unicode, cu, { } - --~ print("START", unicode) - --~ while n do - --~ n = c.next - --~ if n then - --~ print("NEXT", n) - --~ c = characters[n] - --~ if not c then - --~ print("EXIT") - --~ elseif d[n] then - --~ print("LOOP") - --~ break - --~ end - --~ d[n] = true - --~ end - --~ end else local fci = fc[index] if not fci then ---~ characters[unicode] = { ---~ width = 0, ---~ height = 0, ---~ depth = 0, ---~ index = 0, ---~ } + -- do nothing else local ref = si[index] if not ref then @@ -541,8 +673,11 @@ function fonts.vf.math.define(specification,set) local kerns = fci.kerns if kerns then local krn = { } - for k=1,#kerns do - krn[offset + k] = kerns[k] +--~ for k=1,#kerns do +--~ krn[offset + k] = kerns[k] +--~ end + for k, v in next, kerns do -- is kerns sparse? + krn[offset + k] = v end characters[unicode] = { width = fci.width, @@ -567,36 +702,44 @@ function fonts.vf.math.define(specification,set) end end end + else + report_virtual("error in loading %s: problematic vector %s",name,vectorname) end end mathematics.extras.copy(main) --not needed here (yet) end end - lst[#lst+1] = { id = font.nextid(), size = size } - if mp then -- weak catch - fonts.vf.math.alas(main,#lst,size) - end + -- + fontlist[#fontlist+1] = { + id = font.nextid(), + size = size, + } + -- + main.mathparameters = mathparameters -- still traditional ones + vfmath.addmissing(main,#fontlist,size) + mathematics.addfallbacks(main) + -- + main.properties.math_is_scaled = true -- signal + fonts.constructors.assignmathparameters(main,main) + -- + main.MathConstants = main.mathparameters -- we directly pass it to TeX (bypasses the scaler) so this is needed + -- if trace_virtual or trace_timings then - logs.report("math virtual","loading and virtualizing font %s at size %s took %0.3f seconds",name,size,os.clock()-start) + report_virtual("loading and virtualizing font %s at size %s took %0.3f seconds",name,size,os.clock()-start) end - main.has_italic = true - main.type = "virtual" -- not needed - mathematics.scaleparameters(main,main,1) - main.nomath = false ---~ print(table.serialize(characters[0x222B])) ---~ print(main.fontname,table.serialize(main.MathConstants)) + -- return main end -function mathematics.make_font(name, set) - fonts.define.methods[name] = function(specification) - return fonts.vf.math.define(specification,set) +function mathematics.makefont(name,set,goodies) + fonts.definers.methods.variants[name] = function(specification) + return vfmath.define(specification,set,goodies) end end -- varphi is part of the alphabet, contrary to the other var*s' -fonts.enc.math["large-to-small"] = { +mathencodings["large-to-small"] = { [0x00028] = 0x00, -- ( [0x00029] = 0x01, -- ) [0x0005B] = 0x02, -- [ @@ -640,7 +783,7 @@ fonts.enc.math["large-to-small"] = { [0x02044] = 0x0E, -- / } -fonts.enc.math["tex-ex"] = { +mathencodings["tex-ex"] = { [0x0220F] = 0x51, -- prod [0x0222B] = 0x52, -- intop [0x02210] = 0x60, -- coprod @@ -660,7 +803,7 @@ fonts.enc.math["tex-ex"] = { -- only math stuff is needed, since we always use an lm or gyre -- font as main font -fonts.enc.math["tex-mr"] = { +mathencodings["tex-mr"] = { [0x00393] = 0x00, -- Gamma [0x00394] = 0x01, -- Delta [0x00398] = 0x02, -- Theta @@ -715,11 +858,11 @@ fonts.enc.math["tex-mr"] = { -- [0x000A8] = 0x7F, -- [math]ddot } -fonts.enc.math["tex-mr-missing"] = { +mathencodings["tex-mr-missing"] = { [0x02236] = 0x3A, -- colon } -fonts.enc.math["tex-mi"] = { +mathencodings["tex-mi"] = { [0x1D6E4] = 0x00, -- Gamma [0x1D6E5] = 0x01, -- Delta [0x1D6E9] = 0x02, -- Theta @@ -803,8 +946,7 @@ fonts.enc.math["tex-mi"] = { -- 0x7F, -- (no idea what that could be) } - -fonts.enc.math["tex-it"] = { +mathencodings["tex-it"] = { -- [0x1D434] = 0x41, -- A [0x1D6E2] = 0x41, -- Alpha -- [0x1D435] = 0x42, -- B @@ -874,14 +1016,14 @@ fonts.enc.math["tex-it"] = { -- [0x1D467] = 0x7A, -- z } -fonts.enc.math["tex-ss"] = { } -fonts.enc.math["tex-tt"] = { } -fonts.enc.math["tex-bf"] = { } -fonts.enc.math["tex-bi"] = { } -fonts.enc.math["tex-fraktur"] = { } -fonts.enc.math["tex-fraktur-bold"] = { } +mathencodings["tex-ss"] = { } +mathencodings["tex-tt"] = { } +mathencodings["tex-bf"] = { } +mathencodings["tex-bi"] = { } +mathencodings["tex-fraktur"] = { } +mathencodings["tex-fraktur-bold"] = { } -function fonts.vf.math.set_letters(font_encoding, name, uppercase, lowercase) +function vfmath.setletters(font_encoding, name, uppercase, lowercase) local enc = font_encoding[name] for i = 0,25 do enc[uppercase+i] = i + 0x41 @@ -889,14 +1031,14 @@ function fonts.vf.math.set_letters(font_encoding, name, uppercase, lowercase) end end -function fonts.vf.math.set_digits(font_encoding, name, digits) +function vfmath.setdigits(font_encoding, name, digits) local enc = font_encoding[name] for i = 0,9 do enc[digits+i] = i + 0x30 end end -fonts.enc.math["tex-sy"] = { +mathencodings["tex-sy"] = { [0x0002D] = 0x00, -- - [0x02212] = 0x00, -- - -- [0x02201] = 0x00, -- complement @@ -1015,7 +1157,8 @@ fonts.enc.math["tex-sy"] = { [0x027E8] = 0x68, -- <, langle [0x027E9] = 0x69, -- >, rangle [0x0007C] = 0x6A, -- |, mid, lvert, rvert - [0x02225] = 0x6B, -- parallel, Vert, lVert, rVert, arrowvert + [0x02225] = 0x6B, -- parallel + -- [0x02016] = 0x00, -- Vert, lVert, rVert, arrowvert, Arrowvert [0x02195] = 0x6C, -- updownarrow [0x021D5] = 0x6D, -- Updownarrow [0x0005C] = 0x6E, -- \, backslash, setminus @@ -1044,7 +1187,7 @@ fonts.enc.math["tex-sy"] = { -- column, while in the second column we show the tex/ams names. As usual -- it costs hours to figure out such a table. -fonts.enc.math["tex-ma"] = { +mathencodings["tex-ma"] = { [0x022A1] = 0x00, -- squaredot \boxdot [0x0229E] = 0x01, -- squareplus \boxplus [0x022A0] = 0x02, -- squaremultiply \boxtimes @@ -1178,7 +1321,7 @@ fonts.enc.math["tex-ma"] = { [0x0229D] = 0x7F, -- circleminus \circleddash } -fonts.enc.math["tex-mb"] = { +mathencodings["tex-mb"] = { -- [0x0] = 0x00, -- lessornotequal \lvertneqq -- [0x0] = 0x01, -- greaterornotequal \gvertneqq [0x02270] = 0x02, -- notlessequal \nleq @@ -1304,7 +1447,12 @@ fonts.enc.math["tex-mb"] = { [0x003F6] = 0x7F, -- epsiloninv \backepsilon } -fonts.enc.math["tex-fraktur"] = { +mathencodings["tex-mc"] = { + -- this file has no tfm so it gets mapped in the private space + [0xFE324] = "mapsfromchar", +} + +mathencodings["tex-fraktur"] = { -- [0x1D504] = 0x41, -- A (fraktur A) -- [0x1D505] = 0x42, -- B [0x0212D] = 0x43, -- C @@ -1361,19 +1509,19 @@ fonts.enc.math["tex-fraktur"] = { -- now that all other vectors are defined ... -fonts.vf.math.set_letters(fonts.enc.math, "tex-it", 0x1D434, 0x1D44E) -fonts.vf.math.set_letters(fonts.enc.math, "tex-ss", 0x1D5A0, 0x1D5BA) -fonts.vf.math.set_letters(fonts.enc.math, "tex-tt", 0x1D670, 0x1D68A) -fonts.vf.math.set_letters(fonts.enc.math, "tex-bf", 0x1D400, 0x1D41A) -fonts.vf.math.set_letters(fonts.enc.math, "tex-bi", 0x1D468, 0x1D482) -fonts.vf.math.set_letters(fonts.enc.math, "tex-fraktur", 0x1D504, 0x1D51E) -fonts.vf.math.set_letters(fonts.enc.math, "tex-fraktur-bold", 0x1D56C, 0x1D586) +vfmath.setletters(mathencodings, "tex-it", 0x1D434, 0x1D44E) +vfmath.setletters(mathencodings, "tex-ss", 0x1D5A0, 0x1D5BA) +vfmath.setletters(mathencodings, "tex-tt", 0x1D670, 0x1D68A) +vfmath.setletters(mathencodings, "tex-bf", 0x1D400, 0x1D41A) +vfmath.setletters(mathencodings, "tex-bi", 0x1D468, 0x1D482) +vfmath.setletters(mathencodings, "tex-fraktur", 0x1D504, 0x1D51E) +vfmath.setletters(mathencodings, "tex-fraktur-bold", 0x1D56C, 0x1D586) -fonts.vf.math.set_digits (fonts.enc.math, "tex-ss", 0x1D7E2) -fonts.vf.math.set_digits (fonts.enc.math, "tex-tt", 0x1D7F6) -fonts.vf.math.set_digits (fonts.enc.math, "tex-bf", 0x1D7CE) +vfmath.setdigits (mathencodings, "tex-ss", 0x1D7E2) +vfmath.setdigits (mathencodings, "tex-tt", 0x1D7F6) +vfmath.setdigits (mathencodings, "tex-bf", 0x1D7CE) --- fonts.vf.math.set_digits (fonts.enc.math, "tex-bi", 0x1D7CE) +-- vfmath.setdigits (mathencodings, "tex-bi", 0x1D7CE) -- todo: add ss, tt, bf etc vectors -- todo: we can make ss tt etc an option diff --git a/Master/texmf-dist/tex/context/base/meta-clp.mkii b/Master/texmf-dist/tex/context/base/meta-clp.mkii new file mode 100644 index 00000000000..be2506b196c --- /dev/null +++ b/Master/texmf-dist/tex/context/base/meta-clp.mkii @@ -0,0 +1,164 @@ +%D \module +%D [ file=meta-clp, +%D version=2000.07.06, +%D title=\METAPOST\ Graphics, +%D subtitle=Clipping, +%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 In this library, we define a bunch of clipping paths that +%D can be fed to \type {\clip}. + +\startMPclip{ellipse} + clip currentpicture to unitcircle + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{negellipse} + clip currentpicture to (unitcircle peepholed unitsquare) + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{urellipse} + clip currentpicture to urcircle scaled 2 + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{ulellipse} + clip currentpicture to ulcircle scaled 2 shifted (1,0) + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{llellipse} + clip currentpicture to llcircle scaled 2 shifted (1,1) + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{lrellipse} + clip currentpicture to lrcircle scaled 2 shifted (0,1) + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{tellipse} + clip currentpicture to tcircle shifted (.5,0) yscaled 2 + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{bellipse} + clip currentpicture to bcircle shifted (.5,.5) yscaled 2 + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{lellipse} + clip currentpicture to lcircle shifted (.5,.5) xscaled 2 + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{rellipse} + clip currentpicture to rcircle shifted (0,.5) xscaled 2 + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{diamond} + clip currentpicture to unitdiamond + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{negdiamond} + clip currentpicture to (unitdiamond peepholed unitsquare) + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{urtriangle} + clip currentpicture to urtriangle scaled 2 + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{ultriangle} + clip currentpicture to ultriangle scaled 2 shifted (1,0) + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{lltriangle} + clip currentpicture to lltriangle scaled 2 shifted (1,1) + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{lrtriangle} + clip currentpicture to lrtriangle scaled 2 shifted (0,1) + xscaled \width yscaled \height ; +\stopMPclip + +% More efficient: +% +% \def\dosimpleMPclip#1 +% {clip currentpicture to (#1) xscaled \width yscaled \height ;} +% +% \def\simpleMPclip#1#2% +% {\startMPclip{#1}\dosimpleMPclip{#2}\stopMPclip} +% +% \simpleMPclip {ellipse} {unitcircle} +% \simpleMPclip {diamond} {unitdiamond} +% +% \simpleMPclip {negellipse} {unitcircle peepholed unitsquare} +% \simpleMPclip {negdiamond} {unitdiamond peepholed unitsquare} +% +% \simpleMPclip {urellipse} {urcircle scaled 2 shifted (0,0)} +% \simpleMPclip {ulellipse} {ulcircle scaled 2 shifted (1,0)} +% \simpleMPclip {llellipse} {llcircle scaled 2 shifted (1,1)} +% \simpleMPclip {lrellipse} {lrcircle scaled 2 shifted (0,1)} +% +% \simpleMPclip {tellipse} {tcircle shifted (.5,0) yscaled 2} +% \simpleMPclip {bellipse} {bcircle shifted (.5,.5) yscaled 2} +% \simpleMPclip {lellipse} {lcircle shifted (.5,.5) xscaled 2} +% \simpleMPclip {rellipse} {rcircle shifted (0,.5) xscaled 2} +% +% \simpleMPclip {urtriangle} {urtriangle scaled 2 shifted (0,0)} +% \simpleMPclip {ultriangle} {ultriangle scaled 2 shifted (1,0)} +% \simpleMPclip {lltriangle} {lltriangle scaled 2 shifted (1,1)} +% \simpleMPclip {lrtriangle} {lrtriangle scaled 2 shifted (0,1)} + +%D \in {Figure} [fig:clipping paths] shows which paths are +%D predefined. When applied to a whole picture, their usage +%D is: +%D +%D \starttyping +%D \clip[nx=1,ny=1,mp=ellipse]{some clippable content} +%D \stoptyping +%D +%D \startbuffer +%D \setupclipping [nx=1,ny=1,x=1,y=1] +%D \setupblackrules[width=2cm,height=1cm] +%D \startcombination[6*3] % \startcombination[6*3] +%D {\clip[mp=urellipse] {\blackrule}} {urellipse} +%D {\clip[mp=ulellipse] {\blackrule}} {ulellipse} +%D {\clip[mp=llellipse] {\blackrule}} {llellipse} +%D {\clip[mp=lrellipse] {\blackrule}} {lrellipse} +%D {\clip[mp=ellipse] {\blackrule}} {ellipse} +%D {\clip[mp=negellipse]{\blackrule}} {negellipse} +%D {\clip[mp=tellipse] {\blackrule}} {tellipse} +%D {\clip[mp=bellipse] {\blackrule}} {bellipse} +%D {\clip[mp=lellipse] {\blackrule}} {lellipse} +%D {\clip[mp=rellipse] {\blackrule}} {rellipse} +%D {} {} +%D {} {} +%D {\clip[mp=urtriangle]{\blackrule}} {urtriangle} +%D {\clip[mp=ultriangle]{\blackrule}} {ultriangle} +%D {\clip[mp=lltriangle]{\blackrule}} {lltriangle} +%D {\clip[mp=lrtriangle]{\blackrule}} {lrtriangle} +%D {\clip[mp=diamond] {\blackrule}} {diamond} +%D {\clip[mp=negdiamond]{\blackrule}} {negdiamond} +%D \stopcombination % \stopcombination +%D \stopbuffer +%D +%D \placefigure % \placefigure +%D [here][fig:clipping paths] +%D {The predefined clipping paths.} +%D {\getbuffer} % {\getbuffer} + +\endinput diff --git a/Master/texmf-dist/tex/context/base/meta-clp.tex b/Master/texmf-dist/tex/context/base/meta-clp.tex deleted file mode 100644 index be2506b196c..00000000000 --- a/Master/texmf-dist/tex/context/base/meta-clp.tex +++ /dev/null @@ -1,164 +0,0 @@ -%D \module -%D [ file=meta-clp, -%D version=2000.07.06, -%D title=\METAPOST\ Graphics, -%D subtitle=Clipping, -%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 In this library, we define a bunch of clipping paths that -%D can be fed to \type {\clip}. - -\startMPclip{ellipse} - clip currentpicture to unitcircle - xscaled \width yscaled \height ; -\stopMPclip - -\startMPclip{negellipse} - clip currentpicture to (unitcircle peepholed unitsquare) - xscaled \width yscaled \height ; -\stopMPclip - -\startMPclip{urellipse} - clip currentpicture to urcircle scaled 2 - xscaled \width yscaled \height ; -\stopMPclip - -\startMPclip{ulellipse} - clip currentpicture to ulcircle scaled 2 shifted (1,0) - xscaled \width yscaled \height ; -\stopMPclip - -\startMPclip{llellipse} - clip currentpicture to llcircle scaled 2 shifted (1,1) - xscaled \width yscaled \height ; -\stopMPclip - -\startMPclip{lrellipse} - clip currentpicture to lrcircle scaled 2 shifted (0,1) - xscaled \width yscaled \height ; -\stopMPclip - -\startMPclip{tellipse} - clip currentpicture to tcircle shifted (.5,0) yscaled 2 - xscaled \width yscaled \height ; -\stopMPclip - -\startMPclip{bellipse} - clip currentpicture to bcircle shifted (.5,.5) yscaled 2 - xscaled \width yscaled \height ; -\stopMPclip - -\startMPclip{lellipse} - clip currentpicture to lcircle shifted (.5,.5) xscaled 2 - xscaled \width yscaled \height ; -\stopMPclip - -\startMPclip{rellipse} - clip currentpicture to rcircle shifted (0,.5) xscaled 2 - xscaled \width yscaled \height ; -\stopMPclip - -\startMPclip{diamond} - clip currentpicture to unitdiamond - xscaled \width yscaled \height ; -\stopMPclip - -\startMPclip{negdiamond} - clip currentpicture to (unitdiamond peepholed unitsquare) - xscaled \width yscaled \height ; -\stopMPclip - -\startMPclip{urtriangle} - clip currentpicture to urtriangle scaled 2 - xscaled \width yscaled \height ; -\stopMPclip - -\startMPclip{ultriangle} - clip currentpicture to ultriangle scaled 2 shifted (1,0) - xscaled \width yscaled \height ; -\stopMPclip - -\startMPclip{lltriangle} - clip currentpicture to lltriangle scaled 2 shifted (1,1) - xscaled \width yscaled \height ; -\stopMPclip - -\startMPclip{lrtriangle} - clip currentpicture to lrtriangle scaled 2 shifted (0,1) - xscaled \width yscaled \height ; -\stopMPclip - -% More efficient: -% -% \def\dosimpleMPclip#1 -% {clip currentpicture to (#1) xscaled \width yscaled \height ;} -% -% \def\simpleMPclip#1#2% -% {\startMPclip{#1}\dosimpleMPclip{#2}\stopMPclip} -% -% \simpleMPclip {ellipse} {unitcircle} -% \simpleMPclip {diamond} {unitdiamond} -% -% \simpleMPclip {negellipse} {unitcircle peepholed unitsquare} -% \simpleMPclip {negdiamond} {unitdiamond peepholed unitsquare} -% -% \simpleMPclip {urellipse} {urcircle scaled 2 shifted (0,0)} -% \simpleMPclip {ulellipse} {ulcircle scaled 2 shifted (1,0)} -% \simpleMPclip {llellipse} {llcircle scaled 2 shifted (1,1)} -% \simpleMPclip {lrellipse} {lrcircle scaled 2 shifted (0,1)} -% -% \simpleMPclip {tellipse} {tcircle shifted (.5,0) yscaled 2} -% \simpleMPclip {bellipse} {bcircle shifted (.5,.5) yscaled 2} -% \simpleMPclip {lellipse} {lcircle shifted (.5,.5) xscaled 2} -% \simpleMPclip {rellipse} {rcircle shifted (0,.5) xscaled 2} -% -% \simpleMPclip {urtriangle} {urtriangle scaled 2 shifted (0,0)} -% \simpleMPclip {ultriangle} {ultriangle scaled 2 shifted (1,0)} -% \simpleMPclip {lltriangle} {lltriangle scaled 2 shifted (1,1)} -% \simpleMPclip {lrtriangle} {lrtriangle scaled 2 shifted (0,1)} - -%D \in {Figure} [fig:clipping paths] shows which paths are -%D predefined. When applied to a whole picture, their usage -%D is: -%D -%D \starttyping -%D \clip[nx=1,ny=1,mp=ellipse]{some clippable content} -%D \stoptyping -%D -%D \startbuffer -%D \setupclipping [nx=1,ny=1,x=1,y=1] -%D \setupblackrules[width=2cm,height=1cm] -%D \startcombination[6*3] % \startcombination[6*3] -%D {\clip[mp=urellipse] {\blackrule}} {urellipse} -%D {\clip[mp=ulellipse] {\blackrule}} {ulellipse} -%D {\clip[mp=llellipse] {\blackrule}} {llellipse} -%D {\clip[mp=lrellipse] {\blackrule}} {lrellipse} -%D {\clip[mp=ellipse] {\blackrule}} {ellipse} -%D {\clip[mp=negellipse]{\blackrule}} {negellipse} -%D {\clip[mp=tellipse] {\blackrule}} {tellipse} -%D {\clip[mp=bellipse] {\blackrule}} {bellipse} -%D {\clip[mp=lellipse] {\blackrule}} {lellipse} -%D {\clip[mp=rellipse] {\blackrule}} {rellipse} -%D {} {} -%D {} {} -%D {\clip[mp=urtriangle]{\blackrule}} {urtriangle} -%D {\clip[mp=ultriangle]{\blackrule}} {ultriangle} -%D {\clip[mp=lltriangle]{\blackrule}} {lltriangle} -%D {\clip[mp=lrtriangle]{\blackrule}} {lrtriangle} -%D {\clip[mp=diamond] {\blackrule}} {diamond} -%D {\clip[mp=negdiamond]{\blackrule}} {negdiamond} -%D \stopcombination % \stopcombination -%D \stopbuffer -%D -%D \placefigure % \placefigure -%D [here][fig:clipping paths] -%D {The predefined clipping paths.} -%D {\getbuffer} % {\getbuffer} - -\endinput diff --git a/Master/texmf-dist/tex/context/base/meta-dum.mkii b/Master/texmf-dist/tex/context/base/meta-dum.mkii new file mode 100644 index 00000000000..bc19f3c5fa8 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/meta-dum.mkii @@ -0,0 +1,123 @@ +%D \module +%D [ file=meta-dum, +%D version=2003.03.21, +%D title=\METAPOST\ Graphics, +%D subtitle=Dummy (External) 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 + +%D This library overloads the normal external figure +%D placeholder by a nicer one. +%D +%D \startbuffer +%D \useMPlibrary[dum] +%D +%D \startlinecorrection +%D \externalfigure[unknown-a][width=3cm,height=1cm] +%D \stoplinecorrection +%D +%D \startlinecorrection +%D \externalfigure[unknown-b][width=4cm,height=5cm] +%D \stoplinecorrection +%D \stopbuffer +%D +%D \typebuffer \getbuffer + +% currently preparempvariables is unable to resolve number +% fractions like reduction + +% June 22, 2003, this definition was patched to adapt itself +% to transparent colors + +\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}) ; + b := not_transparent(white) ; + w := \MPvar{width} ; + h := \MPvar{height} ; + r := \MPvar{reduction} ; + d := max(w,h) ; + p := unitsquare xyscaled (w,h) ; + cc := r[.5c,b] ; + fill p withcolor if t : transparent(1,.5,cc) else : cc fi ; + for i := 1 upto 60 : + cc := r[c randomized(.3,.9),b] ; + fill fullcircle + scaled (d/5 randomized (d/5)) + shifted (center p randomized (d)) + withcolor if t : transparent(1,.5,cc) else : cc fi ; + endfor ; + clip currentpicture to p ; +\stopuseMPgraphic + +\definepalet + [placeholder] + [1=red,2=green,3=blue,4=cyan,5=magenta,6=yellow] + +% \newcounter \figurereplacementcycle + +\let\figurereplacementcycle\relax + +\setupexternalfigures + [\c!reduction=0, + \c!text=\v!yes] + +\let\normalexternalfigurereplacement\externalfigurereplacement + +\def\externalfigurereplacement#1#2#3% + {\getpaletsize[placeholder]% + \ifx\figurereplacementcycle\relax + \getrandomnumber \figurereplacementcycle \!!plusone \paletsize + \globallet \figurereplacementcycle \figurereplacementcycle + \else + \doglobal\increment\figurereplacementcycle + \fi + \ifnum\figurereplacementcycle>\paletsize + \globallet\figurereplacementcycle\!!plusone + \fi + \weightGRAYfalse % monochrome anyway + \MPcmykcolorsfalse + \MPspotcolorsfalse + \defineoverlay + [\s!dummy] + [\useMPgraphic + {placeholder}% + {width=\figurewidth, + height=\figureheight, + reduction=\@@efreduction, + color=placeholder:\figurereplacementcycle}]% + \expanded{\localframed + [\??ef] + [\c!width=\figurewidth, + \c!height=\figureheight, + \c!frame=\v!off, + \c!strut=\v!no, + \c!background=\s!dummy, + \c!foregroundcolor=\s!white]}% + {\doif\@@eftext\v!yes + {\infofont \setupinterlinespace \dohyphens % \nohyphens + \doifelse{#1}\s!dummy \!!doneafalse\!!doneatrue + \doifelse{#2}\s!dummy \!!donebfalse\!!donebtrue + \doifelse{#3}\s!unknown\!!donecfalse\!!donectrue + \if!!donea + name: \expanded{\verbatimstring{#1}}\strut\endgraf + \fi + \if!!doneb + \if!!donea file: \else \if!!donec file: \fi \fi + \expanded{\verbatimstring{#2}}\strut\endgraf + \fi + \if!!donec + state: \expanded{\verbatimstring{#3}}\strut\endgraf + \fi}}} + +\def\dummyfigure{\externalfigure[placeholder]} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/meta-dum.tex b/Master/texmf-dist/tex/context/base/meta-dum.tex deleted file mode 100644 index bc19f3c5fa8..00000000000 --- a/Master/texmf-dist/tex/context/base/meta-dum.tex +++ /dev/null @@ -1,123 +0,0 @@ -%D \module -%D [ file=meta-dum, -%D version=2003.03.21, -%D title=\METAPOST\ Graphics, -%D subtitle=Dummy (External) 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 - -%D This library overloads the normal external figure -%D placeholder by a nicer one. -%D -%D \startbuffer -%D \useMPlibrary[dum] -%D -%D \startlinecorrection -%D \externalfigure[unknown-a][width=3cm,height=1cm] -%D \stoplinecorrection -%D -%D \startlinecorrection -%D \externalfigure[unknown-b][width=4cm,height=5cm] -%D \stoplinecorrection -%D \stopbuffer -%D -%D \typebuffer \getbuffer - -% currently preparempvariables is unable to resolve number -% fractions like reduction - -% June 22, 2003, this definition was patched to adapt itself -% to transparent colors - -\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}) ; - b := not_transparent(white) ; - w := \MPvar{width} ; - h := \MPvar{height} ; - r := \MPvar{reduction} ; - d := max(w,h) ; - p := unitsquare xyscaled (w,h) ; - cc := r[.5c,b] ; - fill p withcolor if t : transparent(1,.5,cc) else : cc fi ; - for i := 1 upto 60 : - cc := r[c randomized(.3,.9),b] ; - fill fullcircle - scaled (d/5 randomized (d/5)) - shifted (center p randomized (d)) - withcolor if t : transparent(1,.5,cc) else : cc fi ; - endfor ; - clip currentpicture to p ; -\stopuseMPgraphic - -\definepalet - [placeholder] - [1=red,2=green,3=blue,4=cyan,5=magenta,6=yellow] - -% \newcounter \figurereplacementcycle - -\let\figurereplacementcycle\relax - -\setupexternalfigures - [\c!reduction=0, - \c!text=\v!yes] - -\let\normalexternalfigurereplacement\externalfigurereplacement - -\def\externalfigurereplacement#1#2#3% - {\getpaletsize[placeholder]% - \ifx\figurereplacementcycle\relax - \getrandomnumber \figurereplacementcycle \!!plusone \paletsize - \globallet \figurereplacementcycle \figurereplacementcycle - \else - \doglobal\increment\figurereplacementcycle - \fi - \ifnum\figurereplacementcycle>\paletsize - \globallet\figurereplacementcycle\!!plusone - \fi - \weightGRAYfalse % monochrome anyway - \MPcmykcolorsfalse - \MPspotcolorsfalse - \defineoverlay - [\s!dummy] - [\useMPgraphic - {placeholder}% - {width=\figurewidth, - height=\figureheight, - reduction=\@@efreduction, - color=placeholder:\figurereplacementcycle}]% - \expanded{\localframed - [\??ef] - [\c!width=\figurewidth, - \c!height=\figureheight, - \c!frame=\v!off, - \c!strut=\v!no, - \c!background=\s!dummy, - \c!foregroundcolor=\s!white]}% - {\doif\@@eftext\v!yes - {\infofont \setupinterlinespace \dohyphens % \nohyphens - \doifelse{#1}\s!dummy \!!doneafalse\!!doneatrue - \doifelse{#2}\s!dummy \!!donebfalse\!!donebtrue - \doifelse{#3}\s!unknown\!!donecfalse\!!donectrue - \if!!donea - name: \expanded{\verbatimstring{#1}}\strut\endgraf - \fi - \if!!doneb - \if!!donea file: \else \if!!donec file: \fi \fi - \expanded{\verbatimstring{#2}}\strut\endgraf - \fi - \if!!donec - state: \expanded{\verbatimstring{#3}}\strut\endgraf - \fi}}} - -\def\dummyfigure{\externalfigure[placeholder]} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/meta-fig.mkiv b/Master/texmf-dist/tex/context/base/meta-fig.mkiv index 4738316da69..adaad4647e0 100644 --- a/Master/texmf-dist/tex/context/base/meta-fig.mkiv +++ b/Master/texmf-dist/tex/context/base/meta-fig.mkiv @@ -46,18 +46,27 @@ \unexpanded\def\setupMPpage {\dodoubleargument\getparameters[\??mg]} +% \def\startMPpage +% {\dodoubleempty\dostartMPpage} +% +% \long\def\dostartMPpage[#1][#2]#3\stopMPpage % second arg gobbles space +% {\dostartfittingpage[\??mg][#1]% +% \processMPgraphic{#3}% +% \dostopfittingpage} + \def\startMPpage - {\dodoubleempty\dostartMPpage} + {\dosingleempty\dostartMPpage} -\long\def\dostartMPpage[#1][#2]#3\stopMPpage % second arg gobbles space +\long\def\dostartMPpage[#1]#2\stopMPpage {\dostartfittingpage[\??mg][#1]% - \processMPgraphic{#3}% + \processMPgraphic{#2}% \dostopfittingpage} \let\stopMPpage \relax % so that we can use it in \expanded \setupMPpage [\c!scale=1000, + \c!pagestate=, \c!strut=\v!no, \c!align=, \c!offset=\v!overlay, diff --git a/Master/texmf-dist/tex/context/base/meta-fun.lua b/Master/texmf-dist/tex/context/base/meta-fun.lua index fef2aa12b87..9a6d971baa6 100644 --- a/Master/texmf-dist/tex/context/base/meta-fun.lua +++ b/Master/texmf-dist/tex/context/base/meta-fun.lua @@ -11,10 +11,13 @@ if not modules then modules = { } end modules ['meta-fun'] = { local format, loadstring, type = string.format, loadstring, type local texwrite = tex.write -metafun = metafun or { } +local metapost = metapost + +metapost.metafun = metapost.metafun or { } +local metafun = metapost.metafun function metafun.topath(t,connector) - tex.write("(") + texwrite("(") if #t > 0 then for i=1,#t do if i > 1 then @@ -35,7 +38,7 @@ end function metafun.interpolate(f,b,e,s,c) local done = false - tex.write("(") + texwrite("(") for i=b,e,(e-b)/s do local d = loadstring(format("return function(x) return %s end",f)) if d then diff --git a/Master/texmf-dist/tex/context/base/meta-fun.mkiv b/Master/texmf-dist/tex/context/base/meta-fun.mkiv index a43ffefffc0..fbe91fd6a08 100644 --- a/Master/texmf-dist/tex/context/base/meta-fun.mkiv +++ b/Master/texmf-dist/tex/context/base/meta-fun.mkiv @@ -17,4 +17,9 @@ \unprotect +%D Just a few handy helpers: + +\ifdefined\MPtoks\else \newtoks\MPtoks \fi +\ifdefined\MPbox \else \newbox \MPbox \fi + \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/meta-imp-clp.mkiv b/Master/texmf-dist/tex/context/base/meta-imp-clp.mkiv new file mode 100644 index 00000000000..be2506b196c --- /dev/null +++ b/Master/texmf-dist/tex/context/base/meta-imp-clp.mkiv @@ -0,0 +1,164 @@ +%D \module +%D [ file=meta-clp, +%D version=2000.07.06, +%D title=\METAPOST\ Graphics, +%D subtitle=Clipping, +%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 In this library, we define a bunch of clipping paths that +%D can be fed to \type {\clip}. + +\startMPclip{ellipse} + clip currentpicture to unitcircle + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{negellipse} + clip currentpicture to (unitcircle peepholed unitsquare) + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{urellipse} + clip currentpicture to urcircle scaled 2 + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{ulellipse} + clip currentpicture to ulcircle scaled 2 shifted (1,0) + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{llellipse} + clip currentpicture to llcircle scaled 2 shifted (1,1) + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{lrellipse} + clip currentpicture to lrcircle scaled 2 shifted (0,1) + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{tellipse} + clip currentpicture to tcircle shifted (.5,0) yscaled 2 + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{bellipse} + clip currentpicture to bcircle shifted (.5,.5) yscaled 2 + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{lellipse} + clip currentpicture to lcircle shifted (.5,.5) xscaled 2 + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{rellipse} + clip currentpicture to rcircle shifted (0,.5) xscaled 2 + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{diamond} + clip currentpicture to unitdiamond + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{negdiamond} + clip currentpicture to (unitdiamond peepholed unitsquare) + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{urtriangle} + clip currentpicture to urtriangle scaled 2 + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{ultriangle} + clip currentpicture to ultriangle scaled 2 shifted (1,0) + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{lltriangle} + clip currentpicture to lltriangle scaled 2 shifted (1,1) + xscaled \width yscaled \height ; +\stopMPclip + +\startMPclip{lrtriangle} + clip currentpicture to lrtriangle scaled 2 shifted (0,1) + xscaled \width yscaled \height ; +\stopMPclip + +% More efficient: +% +% \def\dosimpleMPclip#1 +% {clip currentpicture to (#1) xscaled \width yscaled \height ;} +% +% \def\simpleMPclip#1#2% +% {\startMPclip{#1}\dosimpleMPclip{#2}\stopMPclip} +% +% \simpleMPclip {ellipse} {unitcircle} +% \simpleMPclip {diamond} {unitdiamond} +% +% \simpleMPclip {negellipse} {unitcircle peepholed unitsquare} +% \simpleMPclip {negdiamond} {unitdiamond peepholed unitsquare} +% +% \simpleMPclip {urellipse} {urcircle scaled 2 shifted (0,0)} +% \simpleMPclip {ulellipse} {ulcircle scaled 2 shifted (1,0)} +% \simpleMPclip {llellipse} {llcircle scaled 2 shifted (1,1)} +% \simpleMPclip {lrellipse} {lrcircle scaled 2 shifted (0,1)} +% +% \simpleMPclip {tellipse} {tcircle shifted (.5,0) yscaled 2} +% \simpleMPclip {bellipse} {bcircle shifted (.5,.5) yscaled 2} +% \simpleMPclip {lellipse} {lcircle shifted (.5,.5) xscaled 2} +% \simpleMPclip {rellipse} {rcircle shifted (0,.5) xscaled 2} +% +% \simpleMPclip {urtriangle} {urtriangle scaled 2 shifted (0,0)} +% \simpleMPclip {ultriangle} {ultriangle scaled 2 shifted (1,0)} +% \simpleMPclip {lltriangle} {lltriangle scaled 2 shifted (1,1)} +% \simpleMPclip {lrtriangle} {lrtriangle scaled 2 shifted (0,1)} + +%D \in {Figure} [fig:clipping paths] shows which paths are +%D predefined. When applied to a whole picture, their usage +%D is: +%D +%D \starttyping +%D \clip[nx=1,ny=1,mp=ellipse]{some clippable content} +%D \stoptyping +%D +%D \startbuffer +%D \setupclipping [nx=1,ny=1,x=1,y=1] +%D \setupblackrules[width=2cm,height=1cm] +%D \startcombination[6*3] % \startcombination[6*3] +%D {\clip[mp=urellipse] {\blackrule}} {urellipse} +%D {\clip[mp=ulellipse] {\blackrule}} {ulellipse} +%D {\clip[mp=llellipse] {\blackrule}} {llellipse} +%D {\clip[mp=lrellipse] {\blackrule}} {lrellipse} +%D {\clip[mp=ellipse] {\blackrule}} {ellipse} +%D {\clip[mp=negellipse]{\blackrule}} {negellipse} +%D {\clip[mp=tellipse] {\blackrule}} {tellipse} +%D {\clip[mp=bellipse] {\blackrule}} {bellipse} +%D {\clip[mp=lellipse] {\blackrule}} {lellipse} +%D {\clip[mp=rellipse] {\blackrule}} {rellipse} +%D {} {} +%D {} {} +%D {\clip[mp=urtriangle]{\blackrule}} {urtriangle} +%D {\clip[mp=ultriangle]{\blackrule}} {ultriangle} +%D {\clip[mp=lltriangle]{\blackrule}} {lltriangle} +%D {\clip[mp=lrtriangle]{\blackrule}} {lrtriangle} +%D {\clip[mp=diamond] {\blackrule}} {diamond} +%D {\clip[mp=negdiamond]{\blackrule}} {negdiamond} +%D \stopcombination % \stopcombination +%D \stopbuffer +%D +%D \placefigure % \placefigure +%D [here][fig:clipping paths] +%D {The predefined clipping paths.} +%D {\getbuffer} % {\getbuffer} + +\endinput diff --git a/Master/texmf-dist/tex/context/base/meta-imp-dum.mkiv b/Master/texmf-dist/tex/context/base/meta-imp-dum.mkiv new file mode 100644 index 00000000000..60ab0a41d7c --- /dev/null +++ b/Master/texmf-dist/tex/context/base/meta-imp-dum.mkiv @@ -0,0 +1,147 @@ +%D \module +%D [ file=meta-dum, +%D version=2003.03.21, +%D title=\METAPOST\ Graphics, +%D subtitle=Dummy (External) 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 + +%D This library overloads the normal external figure +%D placeholder by a nicer one. +%D +%D \startbuffer +%D \useMPlibrary[dum] +%D +%D \startlinecorrection +%D \externalfigure[unknown-a][width=3cm,height=1cm] +%D \stoplinecorrection +%D +%D \startlinecorrection +%D \externalfigure[unknown-b][width=4cm,height=5cm] +%D \stoplinecorrection +%D \stopbuffer +%D +%D \typebuffer \getbuffer + +% currently preparempvariables is unable to resolve number +% fractions like reduction + +% June 22, 2003, this definition was patched to adapt itself +% to transparent colors, but ... in 2011 we no longer have +% is_transparent so we revert. +% +% \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}) ; +% b := not_transparent(white) ; +% w := \MPvar{width} ; +% h := \MPvar{height} ; +% r := \MPvar{reduction} ; +% d := max(w,h) ; +% p := unitsquare xyscaled (w,h) ; +% cc := r[.5c,b] ; +% fill p withcolor if t : transparent(1,.5,cc) else : cc fi ; +% for i := 1 upto 60 : +% cc := r[c randomized(.3,.9),b] ; +% fill fullcircle +% scaled (d/5 randomized (d/5)) +% shifted (center p randomized (d)) +% withcolor if t : transparent(1,.5,cc) else : cc fi ; +% endfor ; +% clip currentpicture to p ; +% \stopuseMPgraphic + +\startuseMPgraphic{placeholder}{width,height,reduction,color} + numeric w, h, d, r ; path p ; + if cmykcolor \MPvar{color} : + cmykcolor c, b ; b := (0,0,0,0) + else : + color c, b ; ; b := (1,1,1) + fi ; + c := \MPvar{color} ; + w := \MPvar{width} ; + h := \MPvar{height} ; + r := \MPvar{reduction} ; + d := max(w,h) ; + p := unitsquare xyscaled (w,h) ; + fill p withcolor r[.5c,b] ; + for i := 1 upto 60 : + fill fullcircle + scaled (d/5 randomized (d/5)) + shifted (center p randomized (d)) + withcolor r[c randomized(.3,.9),b] ; + endfor ; + clip currentpicture to p ; +\stopuseMPgraphic + +\definepalet + [placeholder] + [1=red,2=green,3=blue,4=cyan,5=magenta,6=yellow] + +% \newcounter \figurereplacementcycle + +\let\figurereplacementcycle\relax + +\setupexternalfigures + [\c!reduction=0, + \c!text=\v!yes] + +\let\normalexternalfigurereplacement\externalfigurereplacement + +\def\externalfigurereplacement#1#2#3% + {\getpaletsize[placeholder]% + \ifx\figurereplacementcycle\relax + \getrandomnumber \figurereplacementcycle \!!plusone \paletsize + \globallet \figurereplacementcycle \figurereplacementcycle + \else + \doglobal\increment\figurereplacementcycle + \fi + \ifnum\figurereplacementcycle>\paletsize + \globallet\figurereplacementcycle\!!plusone + \fi + \weightGRAYfalse % monochrome anyway + \MPcmykcolorsfalse + \MPspotcolorsfalse + \defineoverlay + [\s!dummy] + [\useMPgraphic + {placeholder}% + {width=\figurewidth, + height=\figureheight, + reduction=\@@efreduction, + color=placeholder:\figurereplacementcycle}]% + \expanded{\localframed + [\??ef] + [\c!width=\figurewidth, + \c!height=\figureheight, + \c!frame=\v!off, + \c!strut=\v!no, + \c!background=\s!dummy, + \c!foregroundcolor=\s!white]}% + {\doif\@@eftext\v!yes + {\infofont \setupinterlinespace \dohyphens % \nohyphens + \doifelse{#1}\s!dummy \!!doneafalse\!!doneatrue + \doifelse{#2}\s!dummy \!!donebfalse\!!donebtrue + \doifelse{#3}\s!unknown\!!donecfalse\!!donectrue + \if!!donea + name: \expanded{\verbatimstring{#1}}\strut\endgraf + \fi + \if!!doneb + \if!!donea file: \else \if!!donec file: \fi \fi + \expanded{\verbatimstring{#2}}\strut\endgraf + \fi + \if!!donec + state: \expanded{\verbatimstring{#3}}\strut\endgraf + \fi}}} + +\def\dummyfigure{\externalfigure[placeholder]} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/meta-imp-mis.mkiv b/Master/texmf-dist/tex/context/base/meta-imp-mis.mkiv new file mode 100644 index 00000000000..29ab43007e7 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/meta-imp-mis.mkiv @@ -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(1,0,0,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/Master/texmf-dist/tex/context/base/meta-imp-nav.mkiv b/Master/texmf-dist/tex/context/base/meta-imp-nav.mkiv new file mode 100644 index 00000000000..9c1cbb4dbb4 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/meta-imp-nav.mkiv @@ -0,0 +1,65 @@ +%D \module +%D [ file=meta-nav, +%D version=2003.03.28, +%D title=\METAPOST\ Graphics, +%D subtitle=Navigational 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. + +\startuniqueMPgraphic{navplus}{size,color,type,mode} + color c ; numeric s, t ; path p ; + t := \MPvar{type} ; c := \MPvar{color} ; s := \MPvar{size} ; + if \MPvar{mode} = 1 : c := .5[c,white] fi ; + if t = 1 : + p := ((0,0)--(1/2,0)--(1,1/3)--(1,1)--(0,1)--(0,0)--cycle) + xyscaled (3,4) ; + elseif t = 2 : + p := ((0,0)--(1,0)--(1,1)--(0,1)--(1/2,2/5)--(1,1)--(0,1)--cycle) + xyscaled (4,3) ; + else : + p := fullsquare xyscaled (3,3) ; + fi ; + draw p withpen pencircle scaled (1/2) withcolor .75white ; + fill p withcolor c ; + draw p withpen pencircle scaled (1/3) withcolor .5c ; + currentpicture := currentpicture scaled s ; + currentpicture := currentpicture shifted -center currentpicture ; +\stopuniqueMPgraphic + +\setupMPvariables + [navplus] + [size=1ex, + color=black, + type=1, + mode=0] + +\definepalet + [navplus] + [attach=darkred, + comment=darkblue] + +\definesymbol + [comment-normal] + [\uniqueMPgraphic{navplus}{type=1,color=navplus:comment}] +\definesymbol + [comment-down] + [\uniqueMPgraphic{navplus}{type=1,color=navplus:comment,mode=1}] + +\definesymbol + [attach-normal] + [\uniqueMPgraphic{navplus}{type=2,color=navplus:attach}] +\definesymbol + [attach-down] + [\uniqueMPgraphic{navplus}{type=2,color=navplus:attach,mode=1}] + +\unprotect + +\setupcomment [\c!symbol={comment-normal,comment-down}] +\setupattachments[\c!symbol={attach-normal,attach-down}] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/meta-imp-pre.mkiv b/Master/texmf-dist/tex/context/base/meta-imp-pre.mkiv new file mode 100644 index 00000000000..cb861ff20d5 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/meta-imp-pre.mkiv @@ -0,0 +1,68 @@ +%D \module +%D [ file=meta-pre, +%D version=2001.03.21, +%D title=\METAPOST\ Graphics, +%D subtitle=Predefined Goodies, +%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 In this library, we define a couple of handy graphics. + +% todo: use the predefine grid macros, mp code will move to +% mp-* file + +\startuseMPgraphic{pagegrid} + StartPage ; + drawoptions(withcolor .8white) ; + fill Field[Text][Text] ; + drawoptions(withcolor .65white) ; + fill Field[Footer][Text] ; + fill Field[Header][Text] ; + fill Field[LeftMargin][Text] ; + fill Field[RightMargin][Text] ; + drawoptions(withcolor .65yellow) ; + fill Field[LeftEdge][Text] ; + fill Field[RightEdge][Text] ; + fill Field[Bottom][Text] ; + fill Field[Top][Text] ; + drawoptions(withpen pencircle scaled .3pt withcolor .65white) ; + for i=-3cm step 1cm until PaperWidth+3cm : + draw (i,-3cm)--(i,PaperHeight+3cm) ; + endfor ; + for i=PaperHeight+3cm step -1cm until -3cm : + draw (-3cm,i)--(PaperWidth+3cm,i) ; + endfor ; + drawoptions(withpen pencircle scaled .15pt) ; + for i=.5cm-3cm step 1cm until PaperWidth+3cm : + draw (i,-3cm)--(i,PaperHeight+3cm) ; + endfor ; + for i=PaperHeight-.5cm+3cm step -1cm until -3cm : + draw (-3cm,i)--(PaperWidth+3cm,i) ; + endfor ; + drawoptions(withpen pencircle scaled .3pt withcolor .65red) ; + for i=0 step 1cm until PaperWidth : + draw (i,0)--(i,PaperHeight) ; + endfor ; + for i=PaperHeight step -1cm until 0 : + draw (0,i)--(PaperWidth,i) ; + endfor ; + drawoptions(withpen pencircle scaled .15pt withcolor .65red) ; + for i=.5cm step 1cm until PaperWidth : + draw (i,0)--(i,PaperHeight) ; + endfor ; + for i=PaperHeight-.5cm step -1cm until 0 : + draw (0,i)--(PaperWidth,i) ; + endfor ; + drawoptions(withpen pencircle scaled 5pt withcolor .65red) ; + draw ulcorner Page ; + StopPage ; +\stopuseMPgraphic + +\defineoverlay[pagegrid][\useMPgraphic{pagegrid}] + +\endinput diff --git a/Master/texmf-dist/tex/context/base/meta-imp-txt.mkiv b/Master/texmf-dist/tex/context/base/meta-imp-txt.mkiv new file mode 100644 index 00000000000..474253a4052 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/meta-imp-txt.mkiv @@ -0,0 +1,304 @@ +%D \module +%D [ file=meta-txt, +%D version=2000.07.06, +%D title=\METAPOST\ Graphics, +%D subtitle=Text Tricks, +%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 In this library some handy text manipulations are +%D defined. Some can and will be improved as soon as the +%D \TEX||\METAPOST\ interface is stable. Some of the +%D solutions may look weird, which is entirely my fault, +%D since I implemented them in the process of getting grip +%D on this kind of manipulations. Undoubtly better +%D \METAPOST\ code is possible, but my way of learning +%D this kind of trickery happens to be by \quote {trial +%D and error} and \quote {look and feel} (as well as +%D identifying tricks in Hobby's code). + +% textext ipv btex ... etex + +% we need a proper prefix here + +\unprotect + +\startMPextensions + if unknown context_text: input mp-text; fi; +\stopMPextensions + +%%%%%%% + +% \def\newchar#1{\chardef#1=0 } + +\ifdefined\MPtoks \else \newtoks\MPtoks \fi +\ifdefined\MPbox \else \newbox \MPbox \fi + +\ifdefined\parwidth \else \newdimen\parwidth \fi +\ifdefined\parheight \else \newdimen\parheight \fi +\ifdefined\parvoffset \else \newdimen\parvoffset \fi +\ifdefined\parhoffset \else \newdimen\parhoffset \fi +\ifdefined\parlines \else \newcount\parlines \fi +\ifdefined\partoks \else \newtoks \partoks \fi +\ifdefined\shapetextbox \else \newbox \shapetextbox \fi + \newif \ifparseries +\ifdefined\parfirst \else \chardef \parfirst=0 \fi + +\def\startshapetext[#1]% + {\global\newcounter\currentshapetext + \global\setbox\shapetextbox\vbox\bgroup + \expanded{\switchtobodyfont[\@@shbodyfont]}% + \dontcomplain + \hsize\parwidth + \setuptolerance[\v!verytolerant,\v!stretch]% + \!!counta\zerocount + \!!toksa\emptytoks + \def\docommand##1% + {\setbox\scratchbox\hbox{\useMPgraphic{##1}}% + \global\chardef\parfirst\zerocount + \getMPdata % \readlocfile{\MPdatafile}{}{}% + \setshapecharacteristics + \advance\!!counta by \parlines + \expandafter\appendtoks\the\partoks\to\!!toksa}% + \processcommalist[#1]\docommand + \global\parseriestrue + \xdef\totalparlines{\the\!!counta}% + \global\partoks\!!toksa + %\ifx\partoks\emptytoks\else % safeguard + \expanded{\parshape \the\!!counta \the\!!toksa}% + %\fi + \setshapecharacteristics % extra dummy + \ifparseries\def\par{\endgraf\adaptparshape}\fi + \EveryPar{\begstrut}} + +\def\stopshapetext + {\endstrut + %\removebottomthings + \egroup + \global\newcounter\currentshapetext + \getshapecharacteristics} + +\def\adaptparshape% + {\def\docommand##1% + {\ifcase\!!counta + \expandafter\appendtoks\space##1 \to\!!toksa + \else + \advance\!!counta \minusone + \fi}% + \!!counta\prevgraf + \doglobal\decrement(\totalparlines,\!!counta)% + \multiply\!!counta \plustwo + \!!toksa\emptytoks + \expanded{\processseparatedlist[\the\partoks][\space]}\docommand + \global\partoks\!!toksa + %\ifx\partoks\emptytoks\else % safeguard + \expanded{\parshape\totalparlines\the\partoks}% + }%\fi} + +\def\getshapecharacteristics% + {\doglobal\increment\currentshapetext + \doifdefinedelse{parlines:\currentshapetext} + {\global\parlines \getvalue{parlines:\currentshapetext}% + \global\chardef\parfirst \getvalue{parfirst:\currentshapetext}% + \global\parvoffset \getvalue{parvoffset:\currentshapetext}% + \global\parhoffset \getvalue{parhoffset:\currentshapetext}% + \global\parwidth \getvalue{parwidth:\currentshapetext}% + \global\parheight \getvalue{parheight:\currentshapetext}} + {\global\parlines \plusone + \global\chardef\parfirst \zerocount + \global\parvoffset \zeropoint + \global\parhoffset \zeropoint + \global\parwidth \hsize + \global\parheight \vsize}} + +\def\setshapecharacteristics% + {\doglobal\increment\currentshapetext + \setxvalue{parlines:\currentshapetext }{\the\parlines}% + \setxvalue{parfirst:\currentshapetext }{\the\parfirst}% + \setxvalue{parvoffset:\currentshapetext}{\the\parvoffset}% + \setxvalue{parhoffset:\currentshapetext}{\the\parhoffset}% + \setxvalue{parwidth:\currentshapetext }{\the\parwidth}% + \setxvalue{parheight:\currentshapetext }{\the\parheight}} + +\def\getshapetext% option: unvbox + {\vbox\bgroup + \forgetall + \setbox\scratchbox\vbox to \parheight + {\expanded{\switchtobodyfont[\@@shbodyfont]}% evt strutheight en + \splittopskip\strutheight % lineheight opslaan + \vskip\parvoffset % scheelt switch en + \ifcase\parfirst\or\vskip\lineheight\fi % is ook veiliger + \hskip\parhoffset + \hbox{\vsplit\shapetextbox to \parlines\lineheight}}% + \wd\scratchbox\parwidth + \ht\scratchbox\parheight + \dp\scratchbox\zeropoint + \box\scratchbox + \getshapecharacteristics + \egroup} + +\def\setupshapetexts% + {\dodoubleempty\getparameters[\??sh]} + +\setupshapetexts% + [\c!bodyfont=] + +%%%%%%% rotfont nog definieren + +\doifundefined{RotFont}{\definefont[RotFont][RegularBold]} + +\def\processfollowingtoken#1% strut toegevoegd + {\appendtoks#1\to\MPtoks + \setbox\MPbox=\hbox{\RotFont\setstrut\strut\the\MPtoks}% + \startMPdrawing + n := n + 1 ; len[n] := \the\wd\MPbox ; + \stopMPdrawing + \startMPdrawing[-] + % pic[n] := textext{\RotFont\setstrut\strut#1} ; % btex \RotFont\setstrut\strut#1 etex ; + pic[n] := btex \RotFont\setstrut\strut#1 etex ; + pic[n] := pic[n] shifted - llcorner pic[n] ; + \stopMPdrawing} + +\startuseMPgraphic{followtokens} + % we default to nothing +\stopuseMPgraphic + +\def\followtokens#1% + {\vbox\bgroup + \forgetall + \dontcomplain + \startMPenvironment + \doifundefined{RotFont}{\definefont[RotFont][RegularBold]} + \stopMPenvironment + \MPtoks\emptytoks + \resetMPdrawing + \startMPdrawing + \includeMPgraphic{followtokens} ; + picture pic[] ; numeric len[], n ; n := 0 ; + \stopMPdrawing + \handletokens#1\with\processfollowingtoken + \startMPdrawing + if unknown RotPath : path RotPath ; RotPath := origin ; fi ; + if unknown RotColor : color RotColor ; RotColor := black ; fi ; + if unknown TraceRot : boolean TraceRot ; TraceRot := false ; fi ; + if unknown ExtraRot : numeric ExtraRot ; ExtraRot := 0 ; fi ; + numeric al, at, pl, wid, pos ; pair ap, ad ; + al := arclength RotPath ; + if al=0 : + al := len[n] + ExtraRot ; + RotPath := origin -- (al,0) ; + fi ; + if al1 : (n-1) else : 1 fi) ; + if TraceRot : + draw RotPath withpen pencircle scaled 1pt withcolor blue ; + fi ; + for i=1 upto n : + wid := abs(xpart urcorner pic[i] - xpart llcorner pic[i]) ; + pos := len[i]-wid/2 + (i-1)*pl ; + at := arctime pos of RotPath ; + ap := point at of RotPath ; + ad := direction at of RotPath ; + draw pic[i] shifted (-wid/2,0) rotated(angle(ad)) shifted ap + withcolor RotColor ; + if TraceRot : + draw boundingbox + pic[i] shifted (-wid/2,0) rotated(angle(ad)) shifted ap + withpen pencircle scaled .25pt withcolor red ; + draw ap + withpen pencircle scaled .50pt withcolor green ; + fi ; + endfor ; + \stopMPdrawing + \MPdrawingdonetrue + \getMPdrawing + \resetMPdrawing + \egroup} + +% \followtokens +% {This is just a dummy text, kerned by T{\kern +% -.1667em\lower .5ex\hbox {E}}{\kern -.125emX} and typeset +% in a circle using {\setMFPfont M}{\setMFPfont +% E}{\setMFPfont T}{\setMFPfont A}{\setMFPfont +% P}{\setMFPfont O}{\setMFPfont S}{\setMFPfont T}.\quad} + +\startuseMPgraphic{fuzzycount} + begingroup + save height, span, drift, d, cp ; + height := 3/ 5 * \baselinedistance ; + span := 1/ 3 * height ; + drift := 1/10 * height ; + pickup pencircle scaled (1/12 * height) ; + def d = (uniformdeviate drift) enddef ; + for i := 1 upto \MPvar{n} : + draw + if (i mod 5)=0 : ((-d-4.5span,d)--(+d-0.5span,height-d)) + else : ((-d,+d)--(+d,height-d)) fi + shifted (span*i,d-drift) ; + endfor; + picture cp ; cp := currentpicture ; % for readability + setbounds currentpicture to + (llcorner cp shifted (0,-ypart llcorner cp) -- + lrcorner cp shifted (0,-ypart lrcorner cp) -- + urcorner cp -- ulcorner cp -- cycle) ; + endgroup ; +\stopuseMPgraphic + +\setupMPvariables + [fuzzycount] + [n=10] + +\def\fuzzycount#1% + {{\tx\useMPgraphic{fuzzycount}{n=#1}}} + +\defineconversion[fuzzy][\fuzzycount] + +%%%%%%% + +\setupMPvariables + [EnglishRule] + [height=1ex, + width=\the\localhsize, % without \the, problems in non e-tex + color=darkgray] + +\defineblank + [EnglishRule] + [medium] + +\startuniqueMPgraphic{EnglishRule}{height,width,color} + height = \MPvar{height} ; + x1 = 0 ; x3 = \MPvar{width} ; x2 = x4 = .5x3 ; + y1 = y3 = 0 ; y2 = -y4 = height/2 ; + fill z1..z2..z3 & z3..z4..z1 & cycle withcolor \MPvar{color} ; +\stopuniqueMPgraphic + +\def\EnglishRule% + {\startlinecorrection[EnglishRule] + \setlocalhsize \noindent \reuseMPgraphic{EnglishRule} + \stoplinecorrection} + +%D The following macro returns a tight bound character +%D sequence. +%D +%D \useMPlibrary[txt] +%D +%D \startlinecorrection +%D \TightText{\ss\bf 123}{0cm}{3cm}{red} +%D \stoplinecorrection + +\def\TightText#1#2#3#4% + {\hbox % \ruledhbox + {\startMPcode + picture p ; p := image (graphictext "#1" withfillcolor red) ; + draw p xsized #2 ysized #3 withcolor \MPcolor{#4} ; + \stopMPcode}} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/meta-ini.lua b/Master/texmf-dist/tex/context/base/meta-ini.lua new file mode 100644 index 00000000000..5150c38358f --- /dev/null +++ b/Master/texmf-dist/tex/context/base/meta-ini.lua @@ -0,0 +1,29 @@ +if not modules then modules = { } end modules ['meta-ini'] = { + version = 1.001, + comment = "companion to meta-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local format = string.format + +metapost = metapost or { } + +-- for the moment downward compatible + +local report_metapost = logs.reporter ("metapost") +local status_metapost = logs.messenger("metapost") + +local patterns = { "meta-imp-%s.mkiv", "meta-imp-%s.tex", "meta-%s.mkiv", "meta-%s.tex" } -- we are compatible + +function metapost.uselibrary(name) + commands.uselibrary(name,patterns,function(name,foundname) + context.startreadingfile() + status_metapost("loaded: library '%s'",name) + context.input(foundname) + context.stopreadingfile() + end, function(name) + report_metapost("unknown: library '%s'",name) + end) +end diff --git a/Master/texmf-dist/tex/context/base/meta-ini.mkii b/Master/texmf-dist/tex/context/base/meta-ini.mkii index e7c6d218e1f..fd6ef9a6163 100644 --- a/Master/texmf-dist/tex/context/base/meta-ini.mkii +++ b/Master/texmf-dist/tex/context/base/meta-ini.mkii @@ -612,10 +612,10 @@ \def\initializeMPgraphics {\bgroup \initializeMPgraphicfile - \ifx\bufferprefix\empty\else - \let\bufferprefix\empty - \initializeMPgraphicfile - \fi +% \ifx\bufferprefix\empty\else +% \let\bufferprefix\empty +% \initializeMPgraphicfile +% \fi \egroup} %D Loading specific \METAPOST\ related definitions is @@ -626,7 +626,11 @@ \letvalueempty{\c!file\f!metapostprefix#1}% \makeshortfilename[\truefilename{\f!metapostprefix#1}]% \startreadingfile - \readsysfile\shortfilename{\showmessage\m!metapost1{#1}}\donothing + \readsysfile{\shortfilename.\mksuffix} + {\showmessage\m!metapost1{#1}} + {\readsysfile{\shortfilename.tex} + {\showmessage\m!metapost1{#1}} + \donothing}% \stopreadingfile \fi} @@ -815,10 +819,12 @@ \box\scratchbox \egroup} +\ifx\makeMPintoPDFobject\undefined \newcount\makeMPintoPDFobject \fi + \def\includeMPasPDF#1% {\bgroup \the\everyinsertMPfile - \ifinobject \else \chardef\makeMPintoPDFobject\plustwo \fi % when needed + \ifinobject \else \makeMPintoPDFobject\plustwo \fi % when needed \convertMPtoPDF{#1}{1}{1}% no \plusone ! \egroup} diff --git a/Master/texmf-dist/tex/context/base/meta-ini.mkiv b/Master/texmf-dist/tex/context/base/meta-ini.mkiv index 61acbca32c7..e95eb178604 100644 --- a/Master/texmf-dist/tex/context/base/meta-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/meta-ini.mkiv @@ -13,6 +13,8 @@ \writestatus{loading}{MetaPost Graphics / Initializations} +\registerctxluafile{meta-ini}{1.001} + \unprotect %D Instead of sharing code with \MKII, I decided to copy @@ -134,8 +136,6 @@ \def\endMPgraphicgroup {\endgroup} -\newconditional \METAFUNinitialized - \def\MPaskedfigure{false} \def\currentMPinitializations @@ -160,19 +160,18 @@ \def\dostopcurrentMPgraphic {\global\MPinstancetoks\emptytoks - \global\settrue\METAFUNinitialized % becomes obsolete \endgroup} \unexpanded\long\def\processMPgraphic#1% todo: extensions and inclusions outside beginfig {\dostartcurrentMPgraphic \forgetall - \setbox\MPgraphicbox\hbox\bgroup + \setbox\MPgraphicbox\hbox\bgroup % ; added 20100901 (as in mkii) \normalexpanded{\noexpand\ctxlua{metapost.graphic( "\currentMPgraphicinstance", "\currentMPgraphicformat", - \!!bs#1\!!es, - \!!bs\currentMPinitializations\!!es, - \!!bs\currentMPpreamble\!!es, + \!!bs#1;\!!es, + \!!bs\currentMPinitializations;\!!es, + \!!bs\currentMPpreamble;\!!es, \MPaskedfigure )}}% \egroup @@ -202,36 +201,10 @@ {\let\handleuseMPgraphic \thirdofthreearguments \let\handlereusableMPgraphic\thirdofthreearguments} -\let\MPdrawingdata\empty - \newif\ifMPdrawingdone \MPdrawingdonefalse -\def\resetMPdrawing - {\globallet\MPdrawingdata\empty - \global\MPdrawingdonefalse} - -\def\pushMPdrawing - {\globalpushmacro\MPdrawingdata - \globallet\MPdrawingdata\empty} - -\def\popMPdrawing - {\globalpopmacro\MPdrawingdata} - -\def\getMPdrawing{\dosinglegroupempty\dogetMPdrawing} - -\def\startMPdrawing - {\dosingleempty\dostartMPdrawing} - -\long\def\dostartMPdrawing[#1]#2\stopMPdrawing - {\relax - \bgroup - \enableincludeMPgraphics - \presetMPdefinitions % in case #2 has measures - \doifelse{#1}{-}{\convertargument#2\to\asciia}{\long\def\asciia{#2}}% - \long\xdef\MPdrawingdata{\MPdrawingdata\asciia}% - \egroup} - -\let\stopMPdrawing\relax +\def\finalizeMPdrawing + {\MPdrawingdonetrue} \let\MPdrawingdata\empty @@ -267,6 +240,14 @@ \let\stopMPdrawing\relax +\long\def\MPdrawing#1% + {\relax + \bgroup + \enableincludeMPgraphics + \presetMPdefinitions + \long\xdef\MPdrawingdata{\MPdrawingdata#1}% + \egroup} + \let\stopMPclip\relax \long\def\startMPclip#1#2\stopMPclip % todo: store at the lua end or just store less @@ -424,10 +405,9 @@ %D \uniqueMPgraphic{meta:hash}{gap=10pt,angle=30} %D \stoptyping -\newcount\MPobjectcounter -\newbox \MPgraphicbox - -\chardef\MPboxmode\zerocount +\newcount \MPobjectcounter +\newbox \MPgraphicbox +\newconstant\MPboxmode \def\doobeyMPboxdepth % mode = 1 {\setbox\MPgraphicbox\hbox{\hskip\MPllx\onebasepoint\raise\MPlly\onebasepoint\box\MPgraphicbox}} @@ -439,9 +419,9 @@ \ht\MPgraphicbox\the\ht\MPgraphicbox \dp\MPgraphicbox\the\dp\MPgraphicbox}} -\def\obeyMPboxdepth {\chardef\MPboxmode\plusone} -\def\ignoreMPboxdepth{\chardef\MPboxmode\plustwo} -\def\normalMPboxdepth{\chardef\MPboxmode\zerocount} +\def\obeyMPboxdepth {\MPboxmode\plusone} +\def\ignoreMPboxdepth{\MPboxmode\plustwo} +\def\normalMPboxdepth{\MPboxmode\zerocount} % compatibility hack: @@ -660,8 +640,6 @@ def data_mpy_file = "\MPdataMPYfile" enddef ; \stopMPextensions -\chardef\currentMPgraphic\plusone - \def\getMPdata {\let\MPdata\secondoftwoarguments \startreadingfile @@ -670,15 +648,6 @@ % \stopnointerference \stopreadingfile} -%D \macros -%D {MPrunfile} -%D -%D This one is more abstract and does not assume knowledge -%D of buffer prefixes. - -\def\MPrunfile#1% - {\bufferprefix mprun.#1} - %D For the moment, the next one is a private macro: \def\processMPbuffer @@ -702,7 +671,7 @@ % we need this trick because tex.sprint does not interprets newlines and the scanner % stops at a newline; also, we do need to flush the buffer under a normal catcode % regime in order to expand embedded tex macros; #1 can be a list - \processMPgraphic{\ctxlua{buffers.feedback("\currentMPgraphicname")}}% + \processMPgraphic{\ctxcommand{feedback("\currentMPgraphicname")}}% \endMPgraphicgroup}} \def\runMPbuffer @@ -735,8 +704,6 @@ \def\resetMPenvironment {\ctxlua{metapost.tex.reset()}} -\resetMPenvironment - \def\useMPenvironmentbuffer[#1]% {\ctxlua{metapost.tex.set(buffers.content("#1"))}} @@ -774,6 +741,23 @@ \let\stopMPcode\relax +\def\MPcode{\dosinglegroupempty\doMPcode} + +\def\doMPcode + {\iffirstargument + \expandafter\dodoMPcode + \else + \expandafter\nodoMPcode + \fi} + +\def\dodoMPcode#1#2% + {\beginMPgraphicgroup{#1::\s!dummy}% name does not matter + \processMPgraphic{#2}% + \endMPgraphicgroup} + +\def\nodoMPcode#1#2% + {\processMPgraphic{#2}} + % a bit nasty (also needed for compatibility: % \startMPrun input mp-www.mp ; \stopMPrun @@ -846,17 +830,7 @@ %D Loading specific \METAPOST\ related definitions is %D accomplished by: -\def\douseMPlibrary#1% - {\ifcsname\c!file\f!metapostprefix#1\endcsname\else - \letvalueempty{\c!file\f!metapostprefix#1}% - \makeshortfilename[\truefilename{\f!metapostprefix#1}]% - \startreadingfile - \readsysfile\shortfilename{\showmessage\m!metapost1{#1}}\donothing - \stopreadingfile - \fi} - -\def\useMPlibrary[#1]% - {\processcommalist[#1]\douseMPlibrary} +\unexpanded\def\useMPlibrary[#1]{\ctxlua{metapost.uselibrary(\!!bs#1\!!es)}} %D \macros %D {setMPtext, MPtext, MPstring, MPbetex} @@ -905,6 +879,7 @@ \stopMPextensions \startMPinitializations + CurrentLayout:="\currentlayout"; OverlayWidth:=\overlaywidth; OverlayHeight:=\overlayheight; OverlayDepth:=\overlayheight; @@ -990,58 +965,6 @@ \newtoks\everyinsertMPfile -% removed in backend: -% -% \def\doinsertMPfile#1% -% {\doiffileelse{./#1}{\includeMPasPDF{./#1}}{\message{[MP #1]}}} -% -% \let\insertMPfileARG\insertMPfile -% -% \def\insertMPfile#1#2% in context #2 is empty -% {\doifelsenothing{#2}{\doinsertMPfile{#1}}{\insertMPfileARG{#1}{#2}}} -% -% \def\includeMPasEPS#1% untested !! -% {\bgroup -% \message{[MP as EPS #1]}% -% \the\everyinsertMPfile -% \dogetEPSboundingbox{#1}\!!widtha\!!heighta\!!widthb\!!heightb -% \setbox\scratchbox\vbox to \!!heightb -% {\vfill -% \let \@@DriverImageType \c!mps -% \def \@@DriverImageFile {#1}% -% \edef\@@DriverImageWidth {\the\!!widthb }% -% \edef\@@DriverImageHeight{\the\!!heightb}% -% \doinsertfile}% -% \wd\scratchbox\!!widthb -% \dp\scratchbox\zeropoint -% \box\scratchbox -% \egroup} -% -% \def\includeMPasPDF#1% -% {\bgroup -% \the\everyinsertMPfile -% \ifinobject \else \chardef\makeMPintoPDFobject\plustwo \fi % when needed -% \convertMPtoPDF{#1}{1}{1}% no \plusone ! -% \egroup} -% -% %D So, using a low level approach (thereby avoiding the slower -% %D figure analysis macros) pays off. This kind of -% %D optimizations are a bit tricky since we must make sure that -% %D special resources end up in the (PDF) files. Because the -% %D \METAPOST\ to \PDF\ can handle objects itself, it is not -% %D that complicated. -% -% %D We hook a couple of initializations into the graphic -% %D macros. -% -% \appendtoks -% \let\figuretypes\c!mps -% \runutilityfilefalse -% \consultutilityfilefalse -% \to \everyinsertMPfile -% -% %D One more: (still needed?) - \startMPextensions def initialize_form_numbers = do_initialize_numbers; @@ -1105,8 +1028,8 @@ %D Usage: %D %D \starttyping -%D \defineproperty[one][layer][state=start] -%D \defineproperty[two][layer][state=stop] +%D \defineviewerlayer[one][state=start] +%D \defineviewerlayer[two][state=stop] %D %D \startuseMPgraphic{step-1} %D fill fullcircle scaled 10cm withcolor red ; @@ -1116,8 +1039,8 @@ %D fill fullcircle scaled 5cm withcolor green ; %D \stopuseMPgraphic %D -%D \setlayer[mp]{\property[one]{\useMPgraphic{step-1}}} -%D \setlayer[mp]{\property[two]{\useMPgraphic{step-2}}} +%D \setlayer[mp]{\viewerlayer[one]{\useMPgraphic{step-1}}} +%D \setlayer[mp]{\viewerlayer[two]{\useMPgraphic{step-2}}} %D %D \ruledhbox{\flushlayer[mp]} %D \stoptyping @@ -1210,7 +1133,7 @@ %D In any case we need to tell the converter what the inherited color %D is to start with. Case~3 is kind of unpredictable as it closely %D relates to the order in which paths are flushed. If you want to -%Dinherit automatically from the surrounding, you can best stick to +%D inherit automatically from the surrounding, you can best stick to %D variant 1. Variant 0 (an isolated graphic) is the default. %D %D \startbuffer @@ -1226,21 +1149,21 @@ %D \stopuseMPgraphic %D %D \starttabulate -%D \NC 0\quad \NC \chardef\MPcolormethod0 \green XX\quad \useMPgraphic{test}\quad XX \NC \NR -%D \NC 1\quad \NC \chardef\MPcolormethod1 \green XX\quad \useMPgraphic{test}\quad XX \NC \NR -%D \NC 2\quad \NC \chardef\MPcolormethod2 \green XX\quad \useMPgraphic{test}\quad XX \NC \NR -%D \NC 3\quad \NC \chardef\MPcolormethod3 \green XX\quad \useMPgraphic{test}\quad XX \NC \NR +%D \NC 0\quad \NC \MPcolormethod0 \green XX\quad \useMPgraphic{test}\quad XX \NC \NR +%D \NC 1\quad \NC \MPcolormethod1 \green XX\quad \useMPgraphic{test}\quad XX \NC \NR +%D \NC 2\quad \NC \MPcolormethod2 \green XX\quad \useMPgraphic{test}\quad XX \NC \NR +%D \NC 3\quad \NC \MPcolormethod3 \green XX\quad \useMPgraphic{test}\quad XX \NC \NR %D \stoptabulate %D \stopbuffer %D %D \typebuffer \getbuffer -\chardef\MPcolormethod\zerocount +\newconstant\MPcolormethod % can be faster, just \appendtoks - \ctxlua{metapost.set_outer_color(\number\MPcolormethod,\number\currentcolormodel,\number\dogetattribute{color},\number\dogetattribute{transparency})}% + \ctxlua{metapost.setoutercolor(\number\MPcolormethod,\number\currentcolormodel,\number\dogetattribute{color},\number\dogetattribute{transparency})}% \to \everyMPgraphic \startMPinitializations @@ -1264,7 +1187,7 @@ %D behave in unexpected ways. \appendtoks - \doifelse\@@mpcolor\v!global{\chardef\MPcolormethod\plusone}{\chardef\MPcolormethod\zerocount}% + \doifelse\@@mpcolor\v!global{\MPcolormethod\plusone}{\MPcolormethod\zerocount}% \to \everysetupMPgraphics \setupMPgraphics diff --git a/Master/texmf-dist/tex/context/base/meta-mis.mkii b/Master/texmf-dist/tex/context/base/meta-mis.mkii new file mode 100644 index 00000000000..29ab43007e7 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/meta-mis.mkii @@ -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(1,0,0,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/Master/texmf-dist/tex/context/base/meta-mis.tex b/Master/texmf-dist/tex/context/base/meta-mis.tex deleted file mode 100644 index 29ab43007e7..00000000000 --- a/Master/texmf-dist/tex/context/base/meta-mis.tex +++ /dev/null @@ -1,54 +0,0 @@ -%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(1,0,0,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/Master/texmf-dist/tex/context/base/meta-nav.mkii b/Master/texmf-dist/tex/context/base/meta-nav.mkii new file mode 100644 index 00000000000..9c1cbb4dbb4 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/meta-nav.mkii @@ -0,0 +1,65 @@ +%D \module +%D [ file=meta-nav, +%D version=2003.03.28, +%D title=\METAPOST\ Graphics, +%D subtitle=Navigational 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. + +\startuniqueMPgraphic{navplus}{size,color,type,mode} + color c ; numeric s, t ; path p ; + t := \MPvar{type} ; c := \MPvar{color} ; s := \MPvar{size} ; + if \MPvar{mode} = 1 : c := .5[c,white] fi ; + if t = 1 : + p := ((0,0)--(1/2,0)--(1,1/3)--(1,1)--(0,1)--(0,0)--cycle) + xyscaled (3,4) ; + elseif t = 2 : + p := ((0,0)--(1,0)--(1,1)--(0,1)--(1/2,2/5)--(1,1)--(0,1)--cycle) + xyscaled (4,3) ; + else : + p := fullsquare xyscaled (3,3) ; + fi ; + draw p withpen pencircle scaled (1/2) withcolor .75white ; + fill p withcolor c ; + draw p withpen pencircle scaled (1/3) withcolor .5c ; + currentpicture := currentpicture scaled s ; + currentpicture := currentpicture shifted -center currentpicture ; +\stopuniqueMPgraphic + +\setupMPvariables + [navplus] + [size=1ex, + color=black, + type=1, + mode=0] + +\definepalet + [navplus] + [attach=darkred, + comment=darkblue] + +\definesymbol + [comment-normal] + [\uniqueMPgraphic{navplus}{type=1,color=navplus:comment}] +\definesymbol + [comment-down] + [\uniqueMPgraphic{navplus}{type=1,color=navplus:comment,mode=1}] + +\definesymbol + [attach-normal] + [\uniqueMPgraphic{navplus}{type=2,color=navplus:attach}] +\definesymbol + [attach-down] + [\uniqueMPgraphic{navplus}{type=2,color=navplus:attach,mode=1}] + +\unprotect + +\setupcomment [\c!symbol={comment-normal,comment-down}] +\setupattachments[\c!symbol={attach-normal,attach-down}] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/meta-nav.tex b/Master/texmf-dist/tex/context/base/meta-nav.tex deleted file mode 100644 index 9c1cbb4dbb4..00000000000 --- a/Master/texmf-dist/tex/context/base/meta-nav.tex +++ /dev/null @@ -1,65 +0,0 @@ -%D \module -%D [ file=meta-nav, -%D version=2003.03.28, -%D title=\METAPOST\ Graphics, -%D subtitle=Navigational 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. - -\startuniqueMPgraphic{navplus}{size,color,type,mode} - color c ; numeric s, t ; path p ; - t := \MPvar{type} ; c := \MPvar{color} ; s := \MPvar{size} ; - if \MPvar{mode} = 1 : c := .5[c,white] fi ; - if t = 1 : - p := ((0,0)--(1/2,0)--(1,1/3)--(1,1)--(0,1)--(0,0)--cycle) - xyscaled (3,4) ; - elseif t = 2 : - p := ((0,0)--(1,0)--(1,1)--(0,1)--(1/2,2/5)--(1,1)--(0,1)--cycle) - xyscaled (4,3) ; - else : - p := fullsquare xyscaled (3,3) ; - fi ; - draw p withpen pencircle scaled (1/2) withcolor .75white ; - fill p withcolor c ; - draw p withpen pencircle scaled (1/3) withcolor .5c ; - currentpicture := currentpicture scaled s ; - currentpicture := currentpicture shifted -center currentpicture ; -\stopuniqueMPgraphic - -\setupMPvariables - [navplus] - [size=1ex, - color=black, - type=1, - mode=0] - -\definepalet - [navplus] - [attach=darkred, - comment=darkblue] - -\definesymbol - [comment-normal] - [\uniqueMPgraphic{navplus}{type=1,color=navplus:comment}] -\definesymbol - [comment-down] - [\uniqueMPgraphic{navplus}{type=1,color=navplus:comment,mode=1}] - -\definesymbol - [attach-normal] - [\uniqueMPgraphic{navplus}{type=2,color=navplus:attach}] -\definesymbol - [attach-down] - [\uniqueMPgraphic{navplus}{type=2,color=navplus:attach,mode=1}] - -\unprotect - -\setupcomment [\c!symbol={comment-normal,comment-down}] -\setupattachments[\c!symbol={attach-normal,attach-down}] - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/meta-pdf.lua b/Master/texmf-dist/tex/context/base/meta-pdf.lua index 23f8d4de05d..b554810ee93 100644 --- a/Master/texmf-dist/tex/context/base/meta-pdf.lua +++ b/Master/texmf-dist/tex/context/base/meta-pdf.lua @@ -13,7 +13,10 @@ if not modules then modules = { } end modules ['meta-pdf'] = { local concat, format, gsub, find, byte, gmatch, match = table.concat, string.format, string.gsub, string.find, string.byte, string.gmatch, string.match local lpegmatch = lpeg.match local round = math.round -local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes + +local report_mptopdf = logs.reporter("graphics","mptopdf") + +local mplib, metapost, lpdf, context = mplib, metapost, lpdf, context local pdfrgbcode = lpdf.rgbcode local pdfcmykcode = lpdf.cmykcode @@ -21,9 +24,12 @@ local pdfgraycode = lpdf.graycode local pdfspotcode = lpdf.spotcode local pdftransparencycode = lpdf.transparencycode local pdffinishtransparencycode = lpdf.finishtransparencycode +local pdfliteral = nodes.pool.pdfliteral -mptopdf = { } -mptopdf.n = 0 +metapost.mptopdf = metapost.mptopdf or { } +local mptopdf = metapost.mptopdf + +mptopdf.nofconverted = 0 local m_path, m_stack, m_texts, m_version, m_date, m_shortcuts = { }, { }, { }, 0, 0, false @@ -44,18 +50,16 @@ end resetall() --- todo: collect and flush packed using pdfliteral node injection but we're --- in no hurry as this kind of conversion does not happen that often in mkiv - -local function pdfcode(str) -- could be a node.write instead - texsprint(ctxcatcodes,"\\pdfliteral{",str,"}") -end +-- -- this does not work as expected (displacement of text) +-- -- beware, needs another comment hack +-- +-- local function pdfcode(str) +-- context(pdfliteral(str)) +-- end -local function texcode(str) - texsprint(ctxcatcodes,str) -end +local pdfcode = context.pdfliteral -function mpscode(str) +local function mpscode(str) if ignore_path then pdfcode("h W n") if extra_path_code then @@ -92,11 +96,11 @@ local function flushpath(cmd) local px, py = v[3], v[4] ; v[3], v[4] = (sy*(px-tx)-ry*(py-ty))/d, (sx*(py-ty)-rx*(px-tx))/d -- mpconcat(v[3],v[4]) local px, py = v[5], v[6] ; v[5], v[6] = (sy*(px-tx)-ry*(py-ty))/d, (sx*(py-ty)-rx*(px-tx))/d -- mpconcat(v[5],v[6]) end - path[#path+1] = concat(v," ") + path[k] = concat(v," ") end else for k=1,#m_stack_path do - path[#path+1] = concat(m_stack_path[k]," ") + path[k] = concat(m_stack_path[k]," ") end end flushconcat() @@ -112,7 +116,7 @@ end -- mp interface -mps = mps or { } +local mps = { } function mps.creator(a, b, c) m_version = tonumber(b) @@ -127,7 +131,7 @@ function mps.newpath() end function mps.boundingbox(llx, lly, urx, ury) - texcode("\\MPSboundingbox{" .. llx .. "}{" .. lly .. "}{" .. urx .. "}{" .. ury .. "}") + context.MPSboundingbox(llx,lly,urx,ury) end function mps.moveto(x,y) @@ -144,10 +148,13 @@ end function mps.rlineto(x,y) local dx, dy = 0, 0 - if #m_stack_path > 0 then - dx, dy = m_stack_path[#m_stack_path][1], m_stack_path[#m_stack_path][2] + local topofstack = #m_stack_path + if topofstack > 0 then + local msp = m_stack_path[topofstack] + dx = msp[1] + dy = msp[2] end - m_stack_path[#m_stack_path+1] = {dx,dy,"l"} + m_stack_path[topofstack+1] = {dx,dy,"l"} end function mps.translate(tx,ty) @@ -221,7 +228,7 @@ function mps.textext(font, scale, str) -- old parser dx, dy = m_stack_path[1][1], m_stack_path[1][2] end flushconcat() - texcode("\\MPStextext{"..font.."}{"..scale.."}{"..str.."}{"..dx.."}{"..dy.."}") + context.MPStextext(font,scale,str,dx,dy) resetpath() end @@ -304,9 +311,9 @@ end -- not supported in mkiv , use mplib instead -handlers[10] = function() logs.report("mptopdf","skipping special %s",10) end -handlers[20] = function() logs.report("mptopdf","skipping special %s",20) end -handlers[50] = function() logs.report("mptopdf","skipping special %s",50) end +handlers[10] = function() report_mptopdf("skipping special %s",10) end +handlers[20] = function() report_mptopdf("skipping special %s",20) end +handlers[50] = function() report_mptopdf("skipping special %s",50) end --end of not supported @@ -320,7 +327,7 @@ function mps.setrgbcolor(r,g,b) -- extra check if handler then handler(s) else - logs.report("mptopdf","unknown special handler %s (1)",h) + report_mptopdf("unknown special handler %s (1)",h) end elseif r == 0.123 and g < 0.1 then g, b = round(g*1000), round(b*1000) @@ -330,7 +337,7 @@ function mps.setrgbcolor(r,g,b) -- extra check if handler then handler(s) else - logs.report("mptopdf","unknown special handler %s (2)",h) + report_mptopdf("unknown special handler %s (2)",h) end else pdfcode(pdffinishtransparencycode()) @@ -505,7 +512,6 @@ local verbose = ( -- order matters in terms of speed / we could check for procset first local captures_old = ( space + verbose + preamble )^0 ---~ local captures_new = ( space + procset + preamble + verbose )^0 local captures_new = ( space + verbose + procset + preamble )^0 local function parse(m_data) @@ -526,25 +532,26 @@ function mptopdf.convertmpstopdf(name) if ok then mps.colormodel = tex.attribute[a_colorspace] statistics.starttiming(mptopdf) - mptopdf.n = mptopdf.n + 1 - pdfcode(format("\\letterpercent\\space mptopdf begin: n=%s, file=%s",mptopdf.n,file.basename(name))) + mptopdf.nofconverted = mptopdf.nofconverted + 1 + -- pdfcode(format("%% mptopdf begin: n=%s, file=%s",mptopdf.nofconverted,file.basename(name))) + pdfcode(format("\\letterpercent\\space mptopdf begin: n=%s, file=%s",mptopdf.nofconverted,file.basename(name))) pdfcode("q 1 0 0 1 0 0 cm") parse(m_data) pdfcode(pdffinishtransparencycode()) pdfcode("Q") + -- pdfcode("% mptopdf end") pdfcode("\\letterpercent\\space mptopdf end") resetall() statistics.stoptiming(mptopdf) else - commands.writestatus("mptopdf","file '%s' not found",name) + report_mptopdf("file '%s' not found",name) end end - -- status info statistics.register("mps conversion time",function() - local n = mptopdf.n + local n = mptopdf.nofconverted if n > 0 then return format("%s seconds, %s conversions", statistics.elapsedtime(mptopdf),n) else diff --git a/Master/texmf-dist/tex/context/base/meta-pdf.mkii b/Master/texmf-dist/tex/context/base/meta-pdf.mkii index 2099b0d370c..0ba3fb9799d 100644 --- a/Master/texmf-dist/tex/context/base/meta-pdf.mkii +++ b/Master/texmf-dist/tex/context/base/meta-pdf.mkii @@ -149,9 +149,9 @@ %D The last object number used is avaliable in the macro %D \type {\lastPDFMPobject}. -\ifx\makeMPintoPDFobject \undefined \chardef\makeMPintoPDFobject \zerocount \fi -\ifx\blackoutMPgraphic \undefined \chardef\blackoutMPgraphic \plusone \fi -\ifx\everyMPtoPDFconversion\undefined \newtoks\everyMPtoPDFconversion \fi +\ifx\makeMPintoPDFobject \undefined \newcount\makeMPintoPDFobject \fi +\ifx\blackoutMPgraphic \undefined \chardef\blackoutMPgraphic\plusone \fi +\ifx\everyMPtoPDFconversion\undefined \newtoks\everyMPtoPDFconversion \fi \let\lastPDFMPobject \!!zerocount \let\currentPDFresources\empty @@ -238,7 +238,7 @@ \def\dopackageMPgraphic#1% #1 = boxregister {\ifcase\makeMPintoPDFobject\or\or\ifx\currentPDFresources\empty\else % an existing value of 2 signals object support (set elsewhere) - \chardef\makeMPintoPDFobject\plusone + \makeMPintoPDFobject\plusone \fi\fi \ifcase\makeMPintoPDFobject \box#1% diff --git a/Master/texmf-dist/tex/context/base/meta-pdf.mkiv b/Master/texmf-dist/tex/context/base/meta-pdf.mkiv index fa9627fbe75..4d5e5232add 100644 --- a/Master/texmf-dist/tex/context/base/meta-pdf.mkiv +++ b/Master/texmf-dist/tex/context/base/meta-pdf.mkiv @@ -57,7 +57,7 @@ \forgetall \offinterlineskip \setbox\scratchbox\vbox\bgroup - \ctxlua{mptopdf.convertmpstopdf("\MPfilename")}\removeunwantedspaces + \ctxlua{metapost.mptopdf.convertmpstopdf("\MPfilename")}\removeunwantedspaces \egroup \setbox\scratchbox\hbox\bgroup \hskip-\MPllx\onebasepoint diff --git a/Master/texmf-dist/tex/context/base/meta-pdh.lua b/Master/texmf-dist/tex/context/base/meta-pdh.lua index 05cdfc176d0..117300f8019 100644 --- a/Master/texmf-dist/tex/context/base/meta-pdh.lua +++ b/Master/texmf-dist/tex/context/base/meta-pdh.lua @@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['meta-pdf'] = { license = "see context related readme files" } +os.exit() + -- This file contains the history of the converter. We keep it around as it -- relates to the development of luatex. @@ -27,10 +29,14 @@ local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes local tostring, tonumber, select = tostring, tonumber, select local lpegmatch = lpeg.match -mptopdf = { } -mptopdf.parsers = { } -mptopdf.parser = 'none' -mptopdf.n = 0 +local metapost = metapost + +metapost.mptopdf = metapost.mptopdf or { } +local mptopdf = metapost.mptopdf + +mptopdf.parsers = { } +mptopdf.parser = 'none' +mptopdf.nofconverted = 0 function mptopdf.reset() mptopdf.data = "" @@ -126,9 +132,9 @@ function mptopdf.steps.convert() mptopdf.data = gsub(mptopdf.data,"%s*([^%a]-)%s*(%a+)", function(args,cmd) if cmd == "textext" then t = mptopdf.texts[tonumber(args)] - return "mps.textext(" .. "\"" .. t[2] .. "\"," .. t[3] .. ",\"" .. t[1] .. "\")\n" + return "metapost.mps.textext(" .. "\"" .. t[2] .. "\"," .. t[3] .. ",\"" .. t[1] .. "\")\n" else - return "mps." .. cmd .. "(" .. gsub(args," +",",") .. ")\n" + return "metapost.mps." .. cmd .. "(" .. gsub(args," +",",") .. ")\n" end end) end @@ -217,7 +223,7 @@ end function mptopdf.convertmpstopdf(name) if mptopdf.loaded(name) then - mptopdf.n = mptopdf.n + 1 + mptopdf.nofconverted = mptopdf.nofconverted + 1 statistics.starttiming(mptopdf) mptopdf.parse() mptopdf.reset() @@ -229,7 +235,8 @@ end -- mp interface -mps = mps or { } +metapost.mps = metapost.mps or { } +local mps = metapost.mps or { } function mps.creator(a, b, c) mptopdf.version = tonumber(b) @@ -593,7 +600,7 @@ mptopdf.parser = 'lpeg' -- status info statistics.register("mps conversion time",function() - local n = mptopdf.n + local n = mptopdf.nofconverted if n > 0 then return format("%s seconds, %s conversions", statistics.elapsedtime(mptopdf),n) else diff --git a/Master/texmf-dist/tex/context/base/meta-pdh.mkiv b/Master/texmf-dist/tex/context/base/meta-pdh.mkiv index 7cdd1471f67..978128f3a2d 100644 --- a/Master/texmf-dist/tex/context/base/meta-pdh.mkiv +++ b/Master/texmf-dist/tex/context/base/meta-pdh.mkiv @@ -36,7 +36,7 @@ %D First we define a handy constant: -\bgroup \catcode`\%=\@@other \xdef\letterpercent{\string%} \egroup +\bgroup \catcode\commentasciicode\othercatcode \xdef\letterpercent{\string%} \egroup %D \macros %D {convertMPtoPDF} @@ -78,8 +78,8 @@ %D The last object number used is avaliable in the macro %D \type {\lastPDFMPobject}. -\ifx\makeMPintoPDFobject \undefined \chardef\makeMPintoPDFobject \zerocount \fi -\ifx\everyMPtoPDFconversion\undefined \newtoks\everyMPtoPDFconversion \fi +\ifx\makeMPintoPDFobject \undefined \newconstant\makeMPintoPDFobject \fi +\ifx\everyMPtoPDFconversion\undefined \newtoks \everyMPtoPDFconversion \fi \let\lastPDFMPobject \!!zerocount \let\currentPDFresources\empty @@ -112,7 +112,7 @@ \startMPresources \pdfliteral{\letterpercent\space mps begin}% \pdfliteral{q 1 0 0 1 0 0 cm}% - \ctxlua{mptopdf.convertmpstopdf("\MPfilename")}\removeunwantedspaces + \ctxlua{metapost.mptopdf.convertmpstopdf("\MPfilename")}\removeunwantedspaces \pdfliteral{Q}% \pdfliteral{\letterpercent\space mps end}% \stopMPresources @@ -144,7 +144,7 @@ \def\dopackageMPgraphic#1% #1 = boxregister {\ifcase\makeMPintoPDFobject\or\or\ifx\currentPDFresources\empty\else % an existing value of 2 signals object support (set elsewhere) - \chardef\makeMPintoPDFobject\plusone + \makeMPintoPDFobject\plusone \fi\fi \ifcase\makeMPintoPDFobject \box#1% @@ -555,7 +555,7 @@ % {\noexpand\handleMPfigurespecial{\gMPs1}{\gMPs2}{\gMPs3}{\gMPs4}{\gMPs5}{\gMPs6}{\gMPs7}{\gMPs8}}} % % \def\handleMPfigurespecial#1#2#3#4#5#6#7#8% todo : combine with ext fig -% {\global\letvalue{\@@MPSK#8}\empty +% {\letgvalueempty{\@@MPSK#8}% % \vbox to \zeropoint % {\vss % \hbox to \zeropoint @@ -595,9 +595,9 @@ % {\noexpand\handleMPhyperlink{\gMPs1}{\gMPs2}{\gMPs3}{\gMPs4}{\gMPs5}{\gMPs6}}} % % \def\handleMPhyperlink#1#2#3#4#5#6% -% {\global\letvalue{\@@MPSK#6}\empty +% {\letgvalueempty{\@@MPSK#6}% % \setbox\scratchbox\hbox -% {\setbox\scratchbox\null +% {\setbox\scratchbox\emptyhbox % \wd\scratchbox\dimexpr-#1\onebasepoint+#3\onebasepoint\relax % \ht\scratchbox\dimexpr-#2\onebasepoint+#4\onebasepoint\relax % \gotobox{\box\scratchbox}[#5]}% diff --git a/Master/texmf-dist/tex/context/base/meta-pre.mkii b/Master/texmf-dist/tex/context/base/meta-pre.mkii new file mode 100644 index 00000000000..cb861ff20d5 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/meta-pre.mkii @@ -0,0 +1,68 @@ +%D \module +%D [ file=meta-pre, +%D version=2001.03.21, +%D title=\METAPOST\ Graphics, +%D subtitle=Predefined Goodies, +%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 In this library, we define a couple of handy graphics. + +% todo: use the predefine grid macros, mp code will move to +% mp-* file + +\startuseMPgraphic{pagegrid} + StartPage ; + drawoptions(withcolor .8white) ; + fill Field[Text][Text] ; + drawoptions(withcolor .65white) ; + fill Field[Footer][Text] ; + fill Field[Header][Text] ; + fill Field[LeftMargin][Text] ; + fill Field[RightMargin][Text] ; + drawoptions(withcolor .65yellow) ; + fill Field[LeftEdge][Text] ; + fill Field[RightEdge][Text] ; + fill Field[Bottom][Text] ; + fill Field[Top][Text] ; + drawoptions(withpen pencircle scaled .3pt withcolor .65white) ; + for i=-3cm step 1cm until PaperWidth+3cm : + draw (i,-3cm)--(i,PaperHeight+3cm) ; + endfor ; + for i=PaperHeight+3cm step -1cm until -3cm : + draw (-3cm,i)--(PaperWidth+3cm,i) ; + endfor ; + drawoptions(withpen pencircle scaled .15pt) ; + for i=.5cm-3cm step 1cm until PaperWidth+3cm : + draw (i,-3cm)--(i,PaperHeight+3cm) ; + endfor ; + for i=PaperHeight-.5cm+3cm step -1cm until -3cm : + draw (-3cm,i)--(PaperWidth+3cm,i) ; + endfor ; + drawoptions(withpen pencircle scaled .3pt withcolor .65red) ; + for i=0 step 1cm until PaperWidth : + draw (i,0)--(i,PaperHeight) ; + endfor ; + for i=PaperHeight step -1cm until 0 : + draw (0,i)--(PaperWidth,i) ; + endfor ; + drawoptions(withpen pencircle scaled .15pt withcolor .65red) ; + for i=.5cm step 1cm until PaperWidth : + draw (i,0)--(i,PaperHeight) ; + endfor ; + for i=PaperHeight-.5cm step -1cm until 0 : + draw (0,i)--(PaperWidth,i) ; + endfor ; + drawoptions(withpen pencircle scaled 5pt withcolor .65red) ; + draw ulcorner Page ; + StopPage ; +\stopuseMPgraphic + +\defineoverlay[pagegrid][\useMPgraphic{pagegrid}] + +\endinput diff --git a/Master/texmf-dist/tex/context/base/meta-pre.tex b/Master/texmf-dist/tex/context/base/meta-pre.tex deleted file mode 100644 index cb861ff20d5..00000000000 --- a/Master/texmf-dist/tex/context/base/meta-pre.tex +++ /dev/null @@ -1,68 +0,0 @@ -%D \module -%D [ file=meta-pre, -%D version=2001.03.21, -%D title=\METAPOST\ Graphics, -%D subtitle=Predefined Goodies, -%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 In this library, we define a couple of handy graphics. - -% todo: use the predefine grid macros, mp code will move to -% mp-* file - -\startuseMPgraphic{pagegrid} - StartPage ; - drawoptions(withcolor .8white) ; - fill Field[Text][Text] ; - drawoptions(withcolor .65white) ; - fill Field[Footer][Text] ; - fill Field[Header][Text] ; - fill Field[LeftMargin][Text] ; - fill Field[RightMargin][Text] ; - drawoptions(withcolor .65yellow) ; - fill Field[LeftEdge][Text] ; - fill Field[RightEdge][Text] ; - fill Field[Bottom][Text] ; - fill Field[Top][Text] ; - drawoptions(withpen pencircle scaled .3pt withcolor .65white) ; - for i=-3cm step 1cm until PaperWidth+3cm : - draw (i,-3cm)--(i,PaperHeight+3cm) ; - endfor ; - for i=PaperHeight+3cm step -1cm until -3cm : - draw (-3cm,i)--(PaperWidth+3cm,i) ; - endfor ; - drawoptions(withpen pencircle scaled .15pt) ; - for i=.5cm-3cm step 1cm until PaperWidth+3cm : - draw (i,-3cm)--(i,PaperHeight+3cm) ; - endfor ; - for i=PaperHeight-.5cm+3cm step -1cm until -3cm : - draw (-3cm,i)--(PaperWidth+3cm,i) ; - endfor ; - drawoptions(withpen pencircle scaled .3pt withcolor .65red) ; - for i=0 step 1cm until PaperWidth : - draw (i,0)--(i,PaperHeight) ; - endfor ; - for i=PaperHeight step -1cm until 0 : - draw (0,i)--(PaperWidth,i) ; - endfor ; - drawoptions(withpen pencircle scaled .15pt withcolor .65red) ; - for i=.5cm step 1cm until PaperWidth : - draw (i,0)--(i,PaperHeight) ; - endfor ; - for i=PaperHeight-.5cm step -1cm until 0 : - draw (0,i)--(PaperWidth,i) ; - endfor ; - drawoptions(withpen pencircle scaled 5pt withcolor .65red) ; - draw ulcorner Page ; - StopPage ; -\stopuseMPgraphic - -\defineoverlay[pagegrid][\useMPgraphic{pagegrid}] - -\endinput diff --git a/Master/texmf-dist/tex/context/base/meta-tex.lua b/Master/texmf-dist/tex/context/base/meta-tex.lua new file mode 100644 index 00000000000..872e8154c4f --- /dev/null +++ b/Master/texmf-dist/tex/context/base/meta-tex.lua @@ -0,0 +1,38 @@ +if not modules then modules = { } end modules ['meta-tex'] = { + version = 1.001, + comment = "companion to meta-tex.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +--~ local P, C, lpegmatch = lpeg.P, lpeg.C, lpeg.match + +-- local left = P("[") +-- local right = P("]") +-- local space = P(" ") +-- local argument = left * C((1-right)^1) * right +-- local pattern = (argument + space)^0 + +-- function metapost.sometxt(optional,str) +-- if optional == "" then +-- context.sometxta(str) +-- else +-- local one, two = lpegmatch(pattern,optional) +-- if two then +-- context.sometxtc(one,two,str) +-- elseif one then +-- context.sometxtb(one,str) +-- else +-- context.sometxta(str) +-- end +-- end +-- end + +local P, Cs, lpegmatch = lpeg.P, lpeg.Cs, lpeg.match + +local pattern = Cs((P([[\"]]) + P([["]])/"\\quotedbl{}" + P(1))^0) + +function metapost.escaped(str) + context(lpegmatch(pattern,str)) +end diff --git a/Master/texmf-dist/tex/context/base/meta-tex.mkiv b/Master/texmf-dist/tex/context/base/meta-tex.mkiv index e35f9538567..2496440c700 100644 --- a/Master/texmf-dist/tex/context/base/meta-tex.mkiv +++ b/Master/texmf-dist/tex/context/base/meta-tex.mkiv @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +\registerctxluafile{meta-tex}{1.001} + \unprotect % Ok, we support this in MkIV because Mojca kept the pressure on. It @@ -47,12 +49,119 @@ % draw \sometxt[framed]{black} rotated 45 ; % \stopMPcode -\unexpanded\def\definetextext[#1]#2{\setvalue{@@st@@[#1]}{#2}\setvalue{@@st@@[#1] }{#2}} % we don't grab spaces after [#1] +% \unexpanded\def\definetextext[#1]#2{\setvalue{@@st@@[#1]}{#2}\setvalue{@@st@@[#1] }{#2}} % we don't grab spaces after [#1] +% \long\def\sometxt #1#{\dosometxt{#1}} % grab optional [args] +% \long\def\dosometxt #1#2{textext.drt("\ifcsname @@st@@#1\endcsname\csname @@st@@#1\endcsname{#2}\else#2\fi")} + +% But Mojca wanted more! Two arguments. +% +% \definetextext[framed]{\framed} +% +% \startMPcode +% draw \sometxt{This is for} rotated 45 ; +% draw \sometxt[framed][ss,16pt]{Mojca's}; +% draw \sometxt[framed]{eyes only!} rotated -45 ; +% \stopMPcode + +% a tex one: +% +% \unexpanded\def\definetextext [#1]#2{\setvalue{@@st@@#1}{#2}} +% \def\sometxt #1#{\dosometxt{#1}} +% \def\dosometxt #1#2{textext.drt("\dodosometxt#1{#2}")} +% +% \unexpanded\def\dodosometxt {\doifnextoptionalelse\dododosometxt\relax} +% \def\dododosometxt [#1]{\dodododosometxt{#1}} +% \def\dodododosometxt #1{\doifnextoptionalelse{\dododododosometxt{#1}}{\getsometxt{#1}}} +% \def\dododododosometxt #1[#2]{\switchtobodyfont[#2]\getsometxt{#1}} +% \def\getsometxt #1#2{\csname @@st@@#1\endcsname{#2}} +% +% or: +% +% \unexpanded\def\dodosometxt {\dodoubleempty\dododosometxt} +% \def\dododosometxt {\ifsecondargument +% \expandafter\dododosometxtA +% \else\iffirstargument +% \expandafter\expandafter\expandafter\dododosometxtB +% \else +% \expandafter\expandafter\expandafter\dododosometxtC +% \fi\fi} +% \def\dododosometxtA[#1][#2]#3{\getsometxt{#1}{\switchtobodyfont[#2]#3}} +% \def\dododosometxtB[#1][#2]#3{\getsometxt{#1}{#3}} +% \def\dododosometxtC[#1][#2]#3{#3} +% \def\getsometxt #1#2{\csname @@st@@#1\endcsname{#2}} +% +% a nicer variant: + +\unexpanded\def\definetextext[#1]% + {\def\currenttextext{#1}% + \dosingleempty\dodefinetextext} + +\def\dodefinetextext + {\iffirstargument + \expandafter\dodefinetextextone + \else + \expandafter\dodefinetextextzero + \fi} -\long\def\sometxt#1#{\dosometxt{#1}} % grab optional [args] +\def\dodefinetextextone {\setvalue{@@st@@one\currenttextext}} +\def\dodefinetextextzero[#1]{\setvalue{@@st@@zero\currenttextext}} -\long\def\dosometxt#1#2% - {textext.drt("\ifcsname @@st@@#1\endcsname\csname @@st@@#1\endcsname{#2}\else#2\fi")} +\def\sometxt#1#% + {\dosometxt{#1}} + +\def\dosometxt#1#2% we need to capture embedded quotes (a bit messy as later on textext is filtered + {textext.drt("\dodosometxt#1{\ctxlua{metapost.escaped(\!!bs#2\!!es)}}")} + +\unexpanded\def\dodosometxt + {\dosingleempty\dododosometxt} + +\def\dododosometxt + {\iffirstargument + \expandafter\dosometxtsome + \else + \expandafter\dosometxtzero + \fi} + +\def\dosometxtsome[#1]% + {\def\currenttextext{#1}% + \csname @@st@@% + \ifcsname @@st@@one#1\endcsname one\else + \ifcsname @@st@@zero#1\endcsname zero\else + none\fi\fi + \endcsname} + +\def\dosometxtzero[#1]% + {} + +\def\@@st@@one {\dosingleempty\do@@st@@one} +\def\do@@st@@one{\csname @@st@@one\currenttextext\endcsname} +\def\@@st@@zero {\csname @@st@@zero\currenttextext\endcsname} +\def\@@st@@none {} + +% \definetextext[framed][#1]#2{\framed[width=4cm]{\switchtobodyfont[#1]#2}} +% \definetextext[simple]{\framed[width=8cm]} +% +% \starttext +% +% \startMPcode +% draw \sometxt{This is for} rotated 45 ; +% draw \sometxt [framed] [ss,16pt] {Mojca's}; +% draw \sometxt[framed]{eyes only!} rotated -45 ; +% draw \sometxt[simple]{Quotes "indeed" work!} rotated 180 ; +% \stopMPcode +% +% \stoptext +% +% a lua one: +% +% \unexpanded\def\definetextext[#1]#2{\setvalue{@@st@@#1}{#2}} +% +% \long\def\sometxt #1#{\dosometxt{#1}} % grab optional [args] +% \long\def\dosometxt #1#2{\ctxlua{metapost.sometxt(\!!bs#1\!!es,\!!bs#2\!!es)}} +% +% \def\sometxta #1{textext.drt("#1")} +% \def\sometxtb #1#2{textext.drt("\getvalue{@@st@@#1}{#2}")} +% \def\sometxtc #1#2#3{textext.drt("\getvalue{@@st@@#1}{\switchtobodyfont[#2]#3}")} % Best use the mp macro instead since it provides positioning. % diff --git a/Master/texmf-dist/tex/context/base/meta-txt.mkii b/Master/texmf-dist/tex/context/base/meta-txt.mkii new file mode 100644 index 00000000000..474253a4052 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/meta-txt.mkii @@ -0,0 +1,304 @@ +%D \module +%D [ file=meta-txt, +%D version=2000.07.06, +%D title=\METAPOST\ Graphics, +%D subtitle=Text Tricks, +%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 In this library some handy text manipulations are +%D defined. Some can and will be improved as soon as the +%D \TEX||\METAPOST\ interface is stable. Some of the +%D solutions may look weird, which is entirely my fault, +%D since I implemented them in the process of getting grip +%D on this kind of manipulations. Undoubtly better +%D \METAPOST\ code is possible, but my way of learning +%D this kind of trickery happens to be by \quote {trial +%D and error} and \quote {look and feel} (as well as +%D identifying tricks in Hobby's code). + +% textext ipv btex ... etex + +% we need a proper prefix here + +\unprotect + +\startMPextensions + if unknown context_text: input mp-text; fi; +\stopMPextensions + +%%%%%%% + +% \def\newchar#1{\chardef#1=0 } + +\ifdefined\MPtoks \else \newtoks\MPtoks \fi +\ifdefined\MPbox \else \newbox \MPbox \fi + +\ifdefined\parwidth \else \newdimen\parwidth \fi +\ifdefined\parheight \else \newdimen\parheight \fi +\ifdefined\parvoffset \else \newdimen\parvoffset \fi +\ifdefined\parhoffset \else \newdimen\parhoffset \fi +\ifdefined\parlines \else \newcount\parlines \fi +\ifdefined\partoks \else \newtoks \partoks \fi +\ifdefined\shapetextbox \else \newbox \shapetextbox \fi + \newif \ifparseries +\ifdefined\parfirst \else \chardef \parfirst=0 \fi + +\def\startshapetext[#1]% + {\global\newcounter\currentshapetext + \global\setbox\shapetextbox\vbox\bgroup + \expanded{\switchtobodyfont[\@@shbodyfont]}% + \dontcomplain + \hsize\parwidth + \setuptolerance[\v!verytolerant,\v!stretch]% + \!!counta\zerocount + \!!toksa\emptytoks + \def\docommand##1% + {\setbox\scratchbox\hbox{\useMPgraphic{##1}}% + \global\chardef\parfirst\zerocount + \getMPdata % \readlocfile{\MPdatafile}{}{}% + \setshapecharacteristics + \advance\!!counta by \parlines + \expandafter\appendtoks\the\partoks\to\!!toksa}% + \processcommalist[#1]\docommand + \global\parseriestrue + \xdef\totalparlines{\the\!!counta}% + \global\partoks\!!toksa + %\ifx\partoks\emptytoks\else % safeguard + \expanded{\parshape \the\!!counta \the\!!toksa}% + %\fi + \setshapecharacteristics % extra dummy + \ifparseries\def\par{\endgraf\adaptparshape}\fi + \EveryPar{\begstrut}} + +\def\stopshapetext + {\endstrut + %\removebottomthings + \egroup + \global\newcounter\currentshapetext + \getshapecharacteristics} + +\def\adaptparshape% + {\def\docommand##1% + {\ifcase\!!counta + \expandafter\appendtoks\space##1 \to\!!toksa + \else + \advance\!!counta \minusone + \fi}% + \!!counta\prevgraf + \doglobal\decrement(\totalparlines,\!!counta)% + \multiply\!!counta \plustwo + \!!toksa\emptytoks + \expanded{\processseparatedlist[\the\partoks][\space]}\docommand + \global\partoks\!!toksa + %\ifx\partoks\emptytoks\else % safeguard + \expanded{\parshape\totalparlines\the\partoks}% + }%\fi} + +\def\getshapecharacteristics% + {\doglobal\increment\currentshapetext + \doifdefinedelse{parlines:\currentshapetext} + {\global\parlines \getvalue{parlines:\currentshapetext}% + \global\chardef\parfirst \getvalue{parfirst:\currentshapetext}% + \global\parvoffset \getvalue{parvoffset:\currentshapetext}% + \global\parhoffset \getvalue{parhoffset:\currentshapetext}% + \global\parwidth \getvalue{parwidth:\currentshapetext}% + \global\parheight \getvalue{parheight:\currentshapetext}} + {\global\parlines \plusone + \global\chardef\parfirst \zerocount + \global\parvoffset \zeropoint + \global\parhoffset \zeropoint + \global\parwidth \hsize + \global\parheight \vsize}} + +\def\setshapecharacteristics% + {\doglobal\increment\currentshapetext + \setxvalue{parlines:\currentshapetext }{\the\parlines}% + \setxvalue{parfirst:\currentshapetext }{\the\parfirst}% + \setxvalue{parvoffset:\currentshapetext}{\the\parvoffset}% + \setxvalue{parhoffset:\currentshapetext}{\the\parhoffset}% + \setxvalue{parwidth:\currentshapetext }{\the\parwidth}% + \setxvalue{parheight:\currentshapetext }{\the\parheight}} + +\def\getshapetext% option: unvbox + {\vbox\bgroup + \forgetall + \setbox\scratchbox\vbox to \parheight + {\expanded{\switchtobodyfont[\@@shbodyfont]}% evt strutheight en + \splittopskip\strutheight % lineheight opslaan + \vskip\parvoffset % scheelt switch en + \ifcase\parfirst\or\vskip\lineheight\fi % is ook veiliger + \hskip\parhoffset + \hbox{\vsplit\shapetextbox to \parlines\lineheight}}% + \wd\scratchbox\parwidth + \ht\scratchbox\parheight + \dp\scratchbox\zeropoint + \box\scratchbox + \getshapecharacteristics + \egroup} + +\def\setupshapetexts% + {\dodoubleempty\getparameters[\??sh]} + +\setupshapetexts% + [\c!bodyfont=] + +%%%%%%% rotfont nog definieren + +\doifundefined{RotFont}{\definefont[RotFont][RegularBold]} + +\def\processfollowingtoken#1% strut toegevoegd + {\appendtoks#1\to\MPtoks + \setbox\MPbox=\hbox{\RotFont\setstrut\strut\the\MPtoks}% + \startMPdrawing + n := n + 1 ; len[n] := \the\wd\MPbox ; + \stopMPdrawing + \startMPdrawing[-] + % pic[n] := textext{\RotFont\setstrut\strut#1} ; % btex \RotFont\setstrut\strut#1 etex ; + pic[n] := btex \RotFont\setstrut\strut#1 etex ; + pic[n] := pic[n] shifted - llcorner pic[n] ; + \stopMPdrawing} + +\startuseMPgraphic{followtokens} + % we default to nothing +\stopuseMPgraphic + +\def\followtokens#1% + {\vbox\bgroup + \forgetall + \dontcomplain + \startMPenvironment + \doifundefined{RotFont}{\definefont[RotFont][RegularBold]} + \stopMPenvironment + \MPtoks\emptytoks + \resetMPdrawing + \startMPdrawing + \includeMPgraphic{followtokens} ; + picture pic[] ; numeric len[], n ; n := 0 ; + \stopMPdrawing + \handletokens#1\with\processfollowingtoken + \startMPdrawing + if unknown RotPath : path RotPath ; RotPath := origin ; fi ; + if unknown RotColor : color RotColor ; RotColor := black ; fi ; + if unknown TraceRot : boolean TraceRot ; TraceRot := false ; fi ; + if unknown ExtraRot : numeric ExtraRot ; ExtraRot := 0 ; fi ; + numeric al, at, pl, wid, pos ; pair ap, ad ; + al := arclength RotPath ; + if al=0 : + al := len[n] + ExtraRot ; + RotPath := origin -- (al,0) ; + fi ; + if al1 : (n-1) else : 1 fi) ; + if TraceRot : + draw RotPath withpen pencircle scaled 1pt withcolor blue ; + fi ; + for i=1 upto n : + wid := abs(xpart urcorner pic[i] - xpart llcorner pic[i]) ; + pos := len[i]-wid/2 + (i-1)*pl ; + at := arctime pos of RotPath ; + ap := point at of RotPath ; + ad := direction at of RotPath ; + draw pic[i] shifted (-wid/2,0) rotated(angle(ad)) shifted ap + withcolor RotColor ; + if TraceRot : + draw boundingbox + pic[i] shifted (-wid/2,0) rotated(angle(ad)) shifted ap + withpen pencircle scaled .25pt withcolor red ; + draw ap + withpen pencircle scaled .50pt withcolor green ; + fi ; + endfor ; + \stopMPdrawing + \MPdrawingdonetrue + \getMPdrawing + \resetMPdrawing + \egroup} + +% \followtokens +% {This is just a dummy text, kerned by T{\kern +% -.1667em\lower .5ex\hbox {E}}{\kern -.125emX} and typeset +% in a circle using {\setMFPfont M}{\setMFPfont +% E}{\setMFPfont T}{\setMFPfont A}{\setMFPfont +% P}{\setMFPfont O}{\setMFPfont S}{\setMFPfont T}.\quad} + +\startuseMPgraphic{fuzzycount} + begingroup + save height, span, drift, d, cp ; + height := 3/ 5 * \baselinedistance ; + span := 1/ 3 * height ; + drift := 1/10 * height ; + pickup pencircle scaled (1/12 * height) ; + def d = (uniformdeviate drift) enddef ; + for i := 1 upto \MPvar{n} : + draw + if (i mod 5)=0 : ((-d-4.5span,d)--(+d-0.5span,height-d)) + else : ((-d,+d)--(+d,height-d)) fi + shifted (span*i,d-drift) ; + endfor; + picture cp ; cp := currentpicture ; % for readability + setbounds currentpicture to + (llcorner cp shifted (0,-ypart llcorner cp) -- + lrcorner cp shifted (0,-ypart lrcorner cp) -- + urcorner cp -- ulcorner cp -- cycle) ; + endgroup ; +\stopuseMPgraphic + +\setupMPvariables + [fuzzycount] + [n=10] + +\def\fuzzycount#1% + {{\tx\useMPgraphic{fuzzycount}{n=#1}}} + +\defineconversion[fuzzy][\fuzzycount] + +%%%%%%% + +\setupMPvariables + [EnglishRule] + [height=1ex, + width=\the\localhsize, % without \the, problems in non e-tex + color=darkgray] + +\defineblank + [EnglishRule] + [medium] + +\startuniqueMPgraphic{EnglishRule}{height,width,color} + height = \MPvar{height} ; + x1 = 0 ; x3 = \MPvar{width} ; x2 = x4 = .5x3 ; + y1 = y3 = 0 ; y2 = -y4 = height/2 ; + fill z1..z2..z3 & z3..z4..z1 & cycle withcolor \MPvar{color} ; +\stopuniqueMPgraphic + +\def\EnglishRule% + {\startlinecorrection[EnglishRule] + \setlocalhsize \noindent \reuseMPgraphic{EnglishRule} + \stoplinecorrection} + +%D The following macro returns a tight bound character +%D sequence. +%D +%D \useMPlibrary[txt] +%D +%D \startlinecorrection +%D \TightText{\ss\bf 123}{0cm}{3cm}{red} +%D \stoplinecorrection + +\def\TightText#1#2#3#4% + {\hbox % \ruledhbox + {\startMPcode + picture p ; p := image (graphictext "#1" withfillcolor red) ; + draw p xsized #2 ysized #3 withcolor \MPcolor{#4} ; + \stopMPcode}} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/meta-txt.tex b/Master/texmf-dist/tex/context/base/meta-txt.tex deleted file mode 100644 index 474253a4052..00000000000 --- a/Master/texmf-dist/tex/context/base/meta-txt.tex +++ /dev/null @@ -1,304 +0,0 @@ -%D \module -%D [ file=meta-txt, -%D version=2000.07.06, -%D title=\METAPOST\ Graphics, -%D subtitle=Text Tricks, -%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 In this library some handy text manipulations are -%D defined. Some can and will be improved as soon as the -%D \TEX||\METAPOST\ interface is stable. Some of the -%D solutions may look weird, which is entirely my fault, -%D since I implemented them in the process of getting grip -%D on this kind of manipulations. Undoubtly better -%D \METAPOST\ code is possible, but my way of learning -%D this kind of trickery happens to be by \quote {trial -%D and error} and \quote {look and feel} (as well as -%D identifying tricks in Hobby's code). - -% textext ipv btex ... etex - -% we need a proper prefix here - -\unprotect - -\startMPextensions - if unknown context_text: input mp-text; fi; -\stopMPextensions - -%%%%%%% - -% \def\newchar#1{\chardef#1=0 } - -\ifdefined\MPtoks \else \newtoks\MPtoks \fi -\ifdefined\MPbox \else \newbox \MPbox \fi - -\ifdefined\parwidth \else \newdimen\parwidth \fi -\ifdefined\parheight \else \newdimen\parheight \fi -\ifdefined\parvoffset \else \newdimen\parvoffset \fi -\ifdefined\parhoffset \else \newdimen\parhoffset \fi -\ifdefined\parlines \else \newcount\parlines \fi -\ifdefined\partoks \else \newtoks \partoks \fi -\ifdefined\shapetextbox \else \newbox \shapetextbox \fi - \newif \ifparseries -\ifdefined\parfirst \else \chardef \parfirst=0 \fi - -\def\startshapetext[#1]% - {\global\newcounter\currentshapetext - \global\setbox\shapetextbox\vbox\bgroup - \expanded{\switchtobodyfont[\@@shbodyfont]}% - \dontcomplain - \hsize\parwidth - \setuptolerance[\v!verytolerant,\v!stretch]% - \!!counta\zerocount - \!!toksa\emptytoks - \def\docommand##1% - {\setbox\scratchbox\hbox{\useMPgraphic{##1}}% - \global\chardef\parfirst\zerocount - \getMPdata % \readlocfile{\MPdatafile}{}{}% - \setshapecharacteristics - \advance\!!counta by \parlines - \expandafter\appendtoks\the\partoks\to\!!toksa}% - \processcommalist[#1]\docommand - \global\parseriestrue - \xdef\totalparlines{\the\!!counta}% - \global\partoks\!!toksa - %\ifx\partoks\emptytoks\else % safeguard - \expanded{\parshape \the\!!counta \the\!!toksa}% - %\fi - \setshapecharacteristics % extra dummy - \ifparseries\def\par{\endgraf\adaptparshape}\fi - \EveryPar{\begstrut}} - -\def\stopshapetext - {\endstrut - %\removebottomthings - \egroup - \global\newcounter\currentshapetext - \getshapecharacteristics} - -\def\adaptparshape% - {\def\docommand##1% - {\ifcase\!!counta - \expandafter\appendtoks\space##1 \to\!!toksa - \else - \advance\!!counta \minusone - \fi}% - \!!counta\prevgraf - \doglobal\decrement(\totalparlines,\!!counta)% - \multiply\!!counta \plustwo - \!!toksa\emptytoks - \expanded{\processseparatedlist[\the\partoks][\space]}\docommand - \global\partoks\!!toksa - %\ifx\partoks\emptytoks\else % safeguard - \expanded{\parshape\totalparlines\the\partoks}% - }%\fi} - -\def\getshapecharacteristics% - {\doglobal\increment\currentshapetext - \doifdefinedelse{parlines:\currentshapetext} - {\global\parlines \getvalue{parlines:\currentshapetext}% - \global\chardef\parfirst \getvalue{parfirst:\currentshapetext}% - \global\parvoffset \getvalue{parvoffset:\currentshapetext}% - \global\parhoffset \getvalue{parhoffset:\currentshapetext}% - \global\parwidth \getvalue{parwidth:\currentshapetext}% - \global\parheight \getvalue{parheight:\currentshapetext}} - {\global\parlines \plusone - \global\chardef\parfirst \zerocount - \global\parvoffset \zeropoint - \global\parhoffset \zeropoint - \global\parwidth \hsize - \global\parheight \vsize}} - -\def\setshapecharacteristics% - {\doglobal\increment\currentshapetext - \setxvalue{parlines:\currentshapetext }{\the\parlines}% - \setxvalue{parfirst:\currentshapetext }{\the\parfirst}% - \setxvalue{parvoffset:\currentshapetext}{\the\parvoffset}% - \setxvalue{parhoffset:\currentshapetext}{\the\parhoffset}% - \setxvalue{parwidth:\currentshapetext }{\the\parwidth}% - \setxvalue{parheight:\currentshapetext }{\the\parheight}} - -\def\getshapetext% option: unvbox - {\vbox\bgroup - \forgetall - \setbox\scratchbox\vbox to \parheight - {\expanded{\switchtobodyfont[\@@shbodyfont]}% evt strutheight en - \splittopskip\strutheight % lineheight opslaan - \vskip\parvoffset % scheelt switch en - \ifcase\parfirst\or\vskip\lineheight\fi % is ook veiliger - \hskip\parhoffset - \hbox{\vsplit\shapetextbox to \parlines\lineheight}}% - \wd\scratchbox\parwidth - \ht\scratchbox\parheight - \dp\scratchbox\zeropoint - \box\scratchbox - \getshapecharacteristics - \egroup} - -\def\setupshapetexts% - {\dodoubleempty\getparameters[\??sh]} - -\setupshapetexts% - [\c!bodyfont=] - -%%%%%%% rotfont nog definieren - -\doifundefined{RotFont}{\definefont[RotFont][RegularBold]} - -\def\processfollowingtoken#1% strut toegevoegd - {\appendtoks#1\to\MPtoks - \setbox\MPbox=\hbox{\RotFont\setstrut\strut\the\MPtoks}% - \startMPdrawing - n := n + 1 ; len[n] := \the\wd\MPbox ; - \stopMPdrawing - \startMPdrawing[-] - % pic[n] := textext{\RotFont\setstrut\strut#1} ; % btex \RotFont\setstrut\strut#1 etex ; - pic[n] := btex \RotFont\setstrut\strut#1 etex ; - pic[n] := pic[n] shifted - llcorner pic[n] ; - \stopMPdrawing} - -\startuseMPgraphic{followtokens} - % we default to nothing -\stopuseMPgraphic - -\def\followtokens#1% - {\vbox\bgroup - \forgetall - \dontcomplain - \startMPenvironment - \doifundefined{RotFont}{\definefont[RotFont][RegularBold]} - \stopMPenvironment - \MPtoks\emptytoks - \resetMPdrawing - \startMPdrawing - \includeMPgraphic{followtokens} ; - picture pic[] ; numeric len[], n ; n := 0 ; - \stopMPdrawing - \handletokens#1\with\processfollowingtoken - \startMPdrawing - if unknown RotPath : path RotPath ; RotPath := origin ; fi ; - if unknown RotColor : color RotColor ; RotColor := black ; fi ; - if unknown TraceRot : boolean TraceRot ; TraceRot := false ; fi ; - if unknown ExtraRot : numeric ExtraRot ; ExtraRot := 0 ; fi ; - numeric al, at, pl, wid, pos ; pair ap, ad ; - al := arclength RotPath ; - if al=0 : - al := len[n] + ExtraRot ; - RotPath := origin -- (al,0) ; - fi ; - if al1 : (n-1) else : 1 fi) ; - if TraceRot : - draw RotPath withpen pencircle scaled 1pt withcolor blue ; - fi ; - for i=1 upto n : - wid := abs(xpart urcorner pic[i] - xpart llcorner pic[i]) ; - pos := len[i]-wid/2 + (i-1)*pl ; - at := arctime pos of RotPath ; - ap := point at of RotPath ; - ad := direction at of RotPath ; - draw pic[i] shifted (-wid/2,0) rotated(angle(ad)) shifted ap - withcolor RotColor ; - if TraceRot : - draw boundingbox - pic[i] shifted (-wid/2,0) rotated(angle(ad)) shifted ap - withpen pencircle scaled .25pt withcolor red ; - draw ap - withpen pencircle scaled .50pt withcolor green ; - fi ; - endfor ; - \stopMPdrawing - \MPdrawingdonetrue - \getMPdrawing - \resetMPdrawing - \egroup} - -% \followtokens -% {This is just a dummy text, kerned by T{\kern -% -.1667em\lower .5ex\hbox {E}}{\kern -.125emX} and typeset -% in a circle using {\setMFPfont M}{\setMFPfont -% E}{\setMFPfont T}{\setMFPfont A}{\setMFPfont -% P}{\setMFPfont O}{\setMFPfont S}{\setMFPfont T}.\quad} - -\startuseMPgraphic{fuzzycount} - begingroup - save height, span, drift, d, cp ; - height := 3/ 5 * \baselinedistance ; - span := 1/ 3 * height ; - drift := 1/10 * height ; - pickup pencircle scaled (1/12 * height) ; - def d = (uniformdeviate drift) enddef ; - for i := 1 upto \MPvar{n} : - draw - if (i mod 5)=0 : ((-d-4.5span,d)--(+d-0.5span,height-d)) - else : ((-d,+d)--(+d,height-d)) fi - shifted (span*i,d-drift) ; - endfor; - picture cp ; cp := currentpicture ; % for readability - setbounds currentpicture to - (llcorner cp shifted (0,-ypart llcorner cp) -- - lrcorner cp shifted (0,-ypart lrcorner cp) -- - urcorner cp -- ulcorner cp -- cycle) ; - endgroup ; -\stopuseMPgraphic - -\setupMPvariables - [fuzzycount] - [n=10] - -\def\fuzzycount#1% - {{\tx\useMPgraphic{fuzzycount}{n=#1}}} - -\defineconversion[fuzzy][\fuzzycount] - -%%%%%%% - -\setupMPvariables - [EnglishRule] - [height=1ex, - width=\the\localhsize, % without \the, problems in non e-tex - color=darkgray] - -\defineblank - [EnglishRule] - [medium] - -\startuniqueMPgraphic{EnglishRule}{height,width,color} - height = \MPvar{height} ; - x1 = 0 ; x3 = \MPvar{width} ; x2 = x4 = .5x3 ; - y1 = y3 = 0 ; y2 = -y4 = height/2 ; - fill z1..z2..z3 & z3..z4..z1 & cycle withcolor \MPvar{color} ; -\stopuniqueMPgraphic - -\def\EnglishRule% - {\startlinecorrection[EnglishRule] - \setlocalhsize \noindent \reuseMPgraphic{EnglishRule} - \stoplinecorrection} - -%D The following macro returns a tight bound character -%D sequence. -%D -%D \useMPlibrary[txt] -%D -%D \startlinecorrection -%D \TightText{\ss\bf 123}{0cm}{3cm}{red} -%D \stoplinecorrection - -\def\TightText#1#2#3#4% - {\hbox % \ruledhbox - {\startMPcode - picture p ; p := image (graphictext "#1" withfillcolor red) ; - draw p xsized #2 ysized #3 withcolor \MPcolor{#4} ; - \stopMPcode}} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/meta-xml.mkii b/Master/texmf-dist/tex/context/base/meta-xml.mkii new file mode 100644 index 00000000000..f6f81f767b0 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/meta-xml.mkii @@ -0,0 +1,29 @@ +%D \module +%D [ file=meta-xml, +%D version=2002.11.27, +%D title=\METAPOST\ Graphics, +%D subtitle=XML Hacks, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{MetaPost Graphics / XML Hacks} + +%D When we are dealing with XML, we need to make sure that +%D \METAPOST\ knows about it. The next macro expands its +%D argument (think of widget XFDF) into \type {\getXMLentity} +%D calls. + +\unprotect + +\def\setMPtextXML#1#2% + {\bgroup + \enableXML + \expanded{\defconvertedcommand\noexpand\ascii{#2}}% + \expanded{\egroup\noexpand\dodoglobal\noexpand\setvalue{\@@MPT#1}{\ascii}}} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/meta-xml.mkiv b/Master/texmf-dist/tex/context/base/meta-xml.mkiv new file mode 100644 index 00000000000..6ce9612ccf9 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/meta-xml.mkiv @@ -0,0 +1,20 @@ +%D \module +%D [ file=meta-xml, +%D version=2002.11.27, +%D title=\METAPOST\ Graphics, +%D subtitle=XML Hacks, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{MetaPost Graphics / XML Hacks} + +\unprotect + +% not needed in mkiv + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/meta-xml.tex b/Master/texmf-dist/tex/context/base/meta-xml.tex deleted file mode 100644 index f6f81f767b0..00000000000 --- a/Master/texmf-dist/tex/context/base/meta-xml.tex +++ /dev/null @@ -1,29 +0,0 @@ -%D \module -%D [ file=meta-xml, -%D version=2002.11.27, -%D title=\METAPOST\ Graphics, -%D subtitle=XML Hacks, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\writestatus{loading}{MetaPost Graphics / XML Hacks} - -%D When we are dealing with XML, we need to make sure that -%D \METAPOST\ knows about it. The next macro expands its -%D argument (think of widget XFDF) into \type {\getXMLentity} -%D calls. - -\unprotect - -\def\setMPtextXML#1#2% - {\bgroup - \enableXML - \expanded{\defconvertedcommand\noexpand\ascii{#2}}% - \expanded{\egroup\noexpand\dodoglobal\noexpand\setvalue{\@@MPT#1}{\ascii}}} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/metatex.lus b/Master/texmf-dist/tex/context/base/metatex.lus new file mode 100644 index 00000000000..df7bc191425 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/metatex.lus @@ -0,0 +1,9 @@ +if not modules then modules = { } end modules ['metatex'] = { + version = 1.001, + comment = "companion to metatex.tex", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +return "luat-cod.lua" diff --git a/Master/texmf-dist/tex/context/base/metatex.tex b/Master/texmf-dist/tex/context/base/metatex.tex index e90af709c0b..cb965dc48b4 100644 --- a/Master/texmf-dist/tex/context/base/metatex.tex +++ b/Master/texmf-dist/tex/context/base/metatex.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -%D We can experiment here with runtime loading, id est no longer +%D We can experiment here with runtime loading, i.e. no longer %D use a format. However, we still need a stub then but it could %D as well be luatools (mtxrun) itself then. @@ -42,7 +42,7 @@ \def\loadcorefile#1{\normalinput#1.tex \relax} \def\loadmarkfile#1{\normalinput#1.mkiv\relax} -\loadcorefile{syst-ini} +\loadmarkfile{syst-ini} \ifnum\luatexversion<60 % also change message \writestatus{!!!!}{Your luatex binary is too old, you need at least version 0.60!} @@ -51,7 +51,8 @@ \newtoks\metatexversiontoks \metatexversiontoks\expandafter{\metatexversion} % at the lua end -\loadcorefile{syst-pln} % plain tex initializations of internal registers (no further code) +\loadmarkfile{syst-pln} % plain tex initializations of internal registers (no further code) +\loadmarkfile{syst-mes} \loadmarkfile{luat-cod} % \loadmarkfile{luat-bas} % @@ -60,10 +61,10 @@ % needs stripping: \loadmarkfile{catc-ini} % catcode table management -\loadcorefile{catc-act} % active character definition mechanisms -\loadcorefile{catc-def} % some generic catcode tables -\loadcorefile{catc-ctx} % a couple of context specific tables but expected by later modules -\loadcorefile{catc-sym} % some definitions related to \letter +\loadmarkfile{catc-act} % active character definition mechanisms +\loadmarkfile{catc-def} % some generic catcode tables +\loadmarkfile{catc-ctx} % a couple of context specific tables but expected by later modules +\loadmarkfile{catc-sym} % some definitions related to \letter % helpers, maybe less @@ -85,6 +86,10 @@ \loadmarkfile{char-ini} \loadmarkfile{char-enc} % \registerctxluafile{char-enc}{1.001} +% attributes + +\loadmarkfile{attr-ini} + % nodes \loadmarkfile{node-ini} @@ -149,6 +154,12 @@ \pdfoutput\plusone +% too + +\appendtoks + \ctxlua{statistics.savefmtstatus("\jobname","\metatexversion","metatex.tex")}% can become automatic +\to \everydump + % done \errorstopmode \dump \endinput diff --git a/Master/texmf-dist/tex/context/base/mlib-ctx.lua b/Master/texmf-dist/tex/context/base/mlib-ctx.lua index cc5682e6fdc..1a5ce2a2419 100644 --- a/Master/texmf-dist/tex/context/base/mlib-ctx.lua +++ b/Master/texmf-dist/tex/context/base/mlib-ctx.lua @@ -8,12 +8,18 @@ if not modules then modules = { } end modules ['mlib-ctx'] = { -- todo -local format, join = string.format, table.concat +local format, concat = string.format, table.concat local sprint = tex.sprint +local report_metapost = logs.reporter("metapost") + local starttiming, stoptiming = statistics.starttiming, statistics.stoptiming -metapost = metapost or {} +local mplib = mplib + +metapost = metapost or {} +local metapost = metapost + metapost.defaultformat = "metafun" function metapost.graphic(instance,mpsformat,str,initializations,preamble,askedfig) @@ -29,7 +35,7 @@ function metapost.getclippath(instance,mpsformat,data,initializations,preamble) local result = mpx:execute(format("%s;beginfig(1);%s;%s;endfig;",preamble or "",initializations or "",data)) stoptiming(metapost.exectime) if result.status > 0 then - logs.report("metafun", "%s: %s", result.status, result.error or result.term or result.log) + report_metapost("%s: %s", result.status, result.error or result.term or result.log) result = nil else result = metapost.filterclippath(result) @@ -62,19 +68,19 @@ end function metapost.theclippath(...) local result = metapost.getclippath(...) if result then -- we could just print the table - result = join(metapost.flushnormalpath(result),"\n") + result = concat(metapost.flushnormalpath(result),"\n") sprint(result) end end statistics.register("metapost processing time", function() local n = metapost.n - if n > 0 then - local e, t = metapost.externals.n, statistics.elapsedtime + if n and n > 0 then + local e, t = metapost.makempy.nofconverted, statistics.elapsedtime local str = format("%s seconds, loading: %s seconds, execution: %s seconds, n: %s", t(metapost), t(mplib), t(metapost.exectime), n) if e > 0 then - return format("%s, external: %s seconds (%s calls)", str, t(metapost.externals), e) + return format("%s, external: %s seconds (%s calls)", str, t(metapost.makempy), e) else return str end @@ -82,3 +88,19 @@ statistics.register("metapost processing time", function() return nil end end) + +-- only used in graphictexts + +metapost.tex = metapost.tex or { } + +local environments = { } + +function metapost.tex.set(str) + environments[#environments+1] = str +end +function metapost.tex.reset() + environments = { } +end +function metapost.tex.get() + return concat(environments,"\n") +end diff --git a/Master/texmf-dist/tex/context/base/mlib-pdf.lua b/Master/texmf-dist/tex/context/base/mlib-pdf.lua index 352070408c1..8000d5a282e 100644 --- a/Master/texmf-dist/tex/context/base/mlib-pdf.lua +++ b/Master/texmf-dist/tex/context/base/mlib-pdf.lua @@ -7,14 +7,22 @@ if not modules then modules = { } end modules ['mlib-pdf'] = { } local format, concat, gsub = string.format, table.concat, string.gsub -local texsprint = tex.sprint local abs, sqrt, round = math.abs, math.sqrt, math.round +local setmetatable = setmetatable +local Cf, C, Cg, Ct, P, S, lpegmatch = lpeg.Cf, lpeg.C, lpeg.Cg, lpeg.Ct, lpeg.P, lpeg.S, lpeg.match -local copy_node, write_node = node.copy, node.write +local allocate = utilities.storage.allocate -local ctxcatcodes = tex.ctxcatcodes +local report_metapost = logs.reporter("metapost") + +local mplib, context = mplib, context + +local copy_node = node.copy +local write_node = node.write metapost = metapost or { } +local metapost = metapost + metapost.multipass = false metapost.n = 0 metapost.optimize = true -- false @@ -61,19 +69,19 @@ metapost.flushers.pdf = { } local savedliterals = nil -local mpsliteral = nodes.register(node.new("whatsit",8)) +local mpsliteral = nodes.pool.register(node.new("whatsit",8)) -- pdfliteral -function metapost.flush_literal(d) -- \def\MPLIBtoPDF#1{\ctxlua{metapost.flush_literal(#1)}} +function metapost.flushliteral(d) -- \def\MPLIBtoPDF#1{\ctxlua{metapost.flush_literal(#1)}} if savedliterals then local literal = copy_node(mpsliteral) literal.data = savedliterals[d] write_node(literal) else - logs.report("metapost","problem flushing literal %s",d) + report_metapost("problem flushing literal %s",d) end end -function metapost.flush_reset() +function metapost.flushreset() -- will become obsolete and internal savedliterals = nil end @@ -83,10 +91,10 @@ function metapost.flushers.pdf.comment(message) if savedliterals then local last = #savedliterals + 1 savedliterals[last] = message - texsprint(ctxcatcodes,"\\MPLIBtoPDF{",last,"}") + context.MPLIBtoPDF(last) else savedliterals = { message } - texsprint(ctxcatcodes,"\\MPLIBtoPDF{1}") + context.MPLIBtoPDF(1) end end end @@ -94,14 +102,14 @@ end function metapost.flushers.pdf.startfigure(n,llx,lly,urx,ury,message) savedliterals = nil metapost.n = metapost.n + 1 - texsprint(ctxcatcodes,format("\\startMPLIBtoPDF{%s}{%s}{%s}{%s}",llx,lly,urx,ury)) + context.startMPLIBtoPDF(llx,lly,urx,ury) if message then metapost.flushers.pdf.comment(message) end end function metapost.flushers.pdf.stopfigure(message) if message then metapost.flushers.pdf.comment(message) end - texsprint(ctxcatcodes,"\\stopMPLIBtoPDF") - texsprint(ctxcatcodes,"\\ctxlua{metapost.flush_reset()}") -- maybe just at the beginning + context.stopMPLIBtoPDF() + context.MPLIBflushreset() -- maybe just at the beginning end function metapost.flushers.pdf.flushfigure(pdfliterals) -- table @@ -110,33 +118,30 @@ function metapost.flushers.pdf.flushfigure(pdfliterals) -- table if savedliterals then local last = #savedliterals + 1 savedliterals[last] = pdfliterals - texsprint(ctxcatcodes,"\\MPLIBtoPDF{",last,"}") + context.MPLIBtoPDF(last) else savedliterals = { pdfliterals } - texsprint(ctxcatcodes,"\\MPLIBtoPDF{1}") + context.MPLIBtoPDF(1) end end end function metapost.flushers.pdf.textfigure(font,size,text,width,height,depth) -- we could save the factor text = gsub(text,".","\\hbox{%1}") -- kerning happens in metapost (i have to check if this is true for mplib) - texsprint(ctxcatcodes,format("\\MPLIBtextext{%s}{%s}{%s}{%s}{%s}",font,size,text,0,-number.dimenfactors.bp*depth)) + context.MPLIBtextext(font,size,text,0,-number.dimenfactors.bp*depth) end local bend_tolerance = 131/65536 local rx, sx, sy, ry, tx, ty, divider = 1, 0, 0, 1, 0, 0, 1 +local pen_info = mplib.pen_info + local function pen_characteristics(object) - if mplib.pen_info then - local t = mplib.pen_info(object) - rx, ry, sx, sy, tx, ty = t.rx, t.ry, t.sx, t.sy, t.tx, t.ty - divider = sx*sy - rx*ry - return not (sx==1 and rx==0 and ry==0 and sy==1 and tx==0 and ty==0), t.width - else - rx, sx, sy, ry, tx, ty, divider = 1, 0, 0, 1, 0, 0, 1 - return false, 1 - end + local t = pen_info(object) + rx, ry, sx, sy, tx, ty = t.rx, t.ry, t.sx, t.sy, t.tx, t.ty + divider = sx*sy - rx*ry + return not (sx==1 and rx==0 and ry==0 and sy==1 and tx==0 and ty==0), t.width end local function mpconcat(px, py) -- no tx, ty here / we can move this one inline if needed @@ -155,84 +160,109 @@ local function curved(ith,pth) end local function flushnormalpath(path, t, open) - t = t or { } - local pth, ith + local pth, ith, nt + if t then + nt = #t + else + t = { } + nt = 0 + end for i=1,#path do + nt = nt + 1 pth = path[i] if not ith then - t[#t+1] = format("%f %f m",pth.x_coord,pth.y_coord) + t[nt] = format("%f %f m",pth.x_coord,pth.y_coord) elseif curved(ith,pth) then - t[#t+1] = format("%f %f %f %f %f %f c",ith.right_x,ith.right_y,pth.left_x,pth.left_y,pth.x_coord,pth.y_coord) + t[nt] = format("%f %f %f %f %f %f c",ith.right_x,ith.right_y,pth.left_x,pth.left_y,pth.x_coord,pth.y_coord) else - t[#t+1] = format("%f %f l",pth.x_coord,pth.y_coord) + t[nt] = format("%f %f l",pth.x_coord,pth.y_coord) end ith = pth end if not open then + nt = nt + 1 local one = path[1] if curved(pth,one) then - t[#t+1] = format("%f %f %f %f %f %f c",pth.right_x,pth.right_y,one.left_x,one.left_y,one.x_coord,one.y_coord ) + t[nt] = format("%f %f %f %f %f %f c",pth.right_x,pth.right_y,one.left_x,one.left_y,one.x_coord,one.y_coord ) else - t[#t+1] = format("%f %f l",one.x_coord,one.y_coord) + t[nt] = format("%f %f l",one.x_coord,one.y_coord) end elseif #path == 1 then -- special case .. draw point local one = path[1] - t[#t+1] = format("%f %f l",one.x_coord,one.y_coord) + nt = nt + 1 + t[nt] = format("%f %f l",one.x_coord,one.y_coord) end return t end local function flushconcatpath(path, t, open) - t = t or { } - t[#t+1] = format("%f %f %f %f %f %f cm", sx, rx, ry, sy, tx ,ty) - local pth, ith + local pth, ith, nt + if t then + nt = #t + else + t = { } + nt = 0 + end + nt = nt + 1 + t[nt] = format("%f %f %f %f %f %f cm", sx, rx, ry, sy, tx ,ty) for i=1,#path do + nt = nt + 1 pth = path[i] if not ith then - t[#t+1] = format("%f %f m",mpconcat(pth.x_coord,pth.y_coord)) + t[nt] = format("%f %f m",mpconcat(pth.x_coord,pth.y_coord)) elseif curved(ith,pth) then local a, b = mpconcat(ith.right_x,ith.right_y) local c, d = mpconcat(pth.left_x,pth.left_y) - t[#t+1] = format("%f %f %f %f %f %f c",a,b,c,d,mpconcat(pth.x_coord,pth.y_coord)) + t[nt] = format("%f %f %f %f %f %f c",a,b,c,d,mpconcat(pth.x_coord,pth.y_coord)) else - t[#t+1] = format("%f %f l",mpconcat(pth.x_coord, pth.y_coord)) + t[nt] = format("%f %f l",mpconcat(pth.x_coord, pth.y_coord)) end ith = pth end if not open then + nt = nt + 1 local one = path[1] if curved(pth,one) then local a, b = mpconcat(pth.right_x,pth.right_y) local c, d = mpconcat(one.left_x,one.left_y) - t[#t+1] = format("%f %f %f %f %f %f c",a,b,c,d,mpconcat(one.x_coord, one.y_coord)) + t[nt] = format("%f %f %f %f %f %f c",a,b,c,d,mpconcat(one.x_coord, one.y_coord)) else - t[#t+1] = format("%f %f l",mpconcat(one.x_coord,one.y_coord)) + t[nt] = format("%f %f l",mpconcat(one.x_coord,one.y_coord)) end elseif #path == 1 then -- special case .. draw point + nt = nt + 1 local one = path[1] - t[#t+1] = format("%f %f l",mpconcat(one.x_coord,one.y_coord)) + t[nt] = format("%f %f l",mpconcat(one.x_coord,one.y_coord)) end return t end metapost.flushnormalpath = flushnormalpath -metapost.specials = metapost.specials or { } +-- The flusher is pdf based, if another backend is used, we need to overload the +-- flusher; this is beta code, the organization will change (already upgraded in +-- sync with mplib) +-- +-- We can avoid the before table but I like symmetry. There is of course a small +-- performance penalty, but so is passing extra arguments (result, flusher, after) +-- and returning stuff. --- we have two extension handlers, one for pre and postscripts, and one for colors +local function ignore() end --- the flusher is pdf based, if another backend is used, we need to overload the --- flusher; this is beta code, the organization will change - -function metapost.flush(result,flusher,askedfig) -- pdf flusher, table en dan concat is sneller, 1 literal +function metapost.flush(result,flusher,askedfig) if result then local figures = result.fig if figures then flusher = flusher or metapost.flushers.pdf - local colorconverter = metapost.colorconverter() -- function ! - local colorhandler = metapost.colorhandler + local resetplugins = metapost.resetplugins or ignore + local processplugins = metapost.processplugins or ignore + local pluginactions = metapost.pluginactions or ignore + local startfigure = flusher.startfigure + local stopfigure = flusher.stopfigure + local flushfigure = flusher.flushfigure + local textfigure = flusher.textfigure for f=1, #figures do local figure = figures[f] local objects = getobjects(result,figure,f) @@ -248,19 +278,18 @@ function metapost.flush(result,flusher,askedfig) -- pdf flusher, table en dan co metapost.ury = ury if urx < llx then -- invalid - flusher.startfigure(fignum,0,0,0,0,"invalid",figure) - flusher.stopfigure() + startfigure(fignum,0,0,0,0,"invalid",figure) + stopfigure() else - flusher.startfigure(fignum,llx,lly,urx,ury,"begin",figure) + startfigure(fignum,llx,lly,urx,ury,"begin",figure) t[#t+1] = "q" if objects then + resetplugins() -- we should move the colorinitializer here t[#t+1] = metapost.colorinitializer() - -- once we have multiple prescripts we can do more tricky things like - -- text and special colors at the same time for o=1,#objects do local object = objects[o] local objecttype = object.type - if objecttype == "start_bounds" or objecttype == "stop_bounds" then + if objecttype == "start_bounds" or objecttype == "stop_bounds" or objecttype == "special" then -- skip elseif objecttype == "start_clip" then t[#t+1] = "q" @@ -269,74 +298,44 @@ function metapost.flush(result,flusher,askedfig) -- pdf flusher, table en dan co elseif objecttype == "stop_clip" then t[#t+1] = "Q" miterlimit, linecap, linejoin, dashed = -1, -1, -1, false - elseif objecttype == "special" then - metapost.specials.register(object.prescript) elseif objecttype == "text" then t[#t+1] = "q" local ot = object.transform -- 3,4,5,6,1,2 t[#t+1] = format("%f %f %f %f %f %f cm",ot[3],ot[4],ot[5],ot[6],ot[1],ot[2]) -- TH: format("%f %f m %f %f %f %f 0 0 cm",unpack(ot)) - flusher.flushfigure(t) -- flush accumulated literals + flushfigure(t) -- flush accumulated literals t = { } - flusher.textfigure(object.font,object.dsize,object.text,object.width,object.height,object.depth) + textfigure(object.font,object.dsize,object.text,object.width,object.height,object.depth) t[#t+1] = "Q" else - -- alternatively we can pass on the stack, could be a helper - -- can be optimized with locals - local currentobject = { -- not needed when no extensions - type = object.type, - miterlimit = object.miterlimit, - linejoin = object.linejoin, - linecap = object.linecap, - color = object.color, - dash = object.dash, - path = object.path, - htap = object.htap, - pen = object.pen, - prescript = object.prescript, - postscript = object.postscript, - } - -- - local before, inbetween, after = nil, nil, nil - -- - local cs, cr = currentobject.color, nil - -- todo document why ... - if cs and colorhandler and #cs > 0 and round(cs[1]*10000) == 123 then -- test in function - currentobject, cr = colorhandler(cs,currentobject,t,colorconverter) - objecttype = currentobject.type - end - -- - local prescript = currentobject.prescript - if prescript and prescript ~= "" then - -- move test to function - local special = metapost.specials[prescript] - if special then - currentobject, before, inbetween, after = special(currentobject.postscript,currentobject,t,flusher) - objecttype = currentobject.type - end + -- we use an indirect table as we want to overload + -- entries but this is not possible in userdata + local original = object + local object = { } + setmetatable(object, { + __index = original + }) + -- first we analyze + local before, after = processplugins(object) + local objecttype = object.type -- can have changed + if before then + t = pluginactions(before,t,flushfigure) end - -- - cs = currentobject.color - if cs and #cs > 0 then - t[#t+1], cr = colorconverter(cs) - end - -- - if before then currentobject, t = before() end - local ml = currentobject.miterlimit + local ml = object.miterlimit if ml and ml ~= miterlimit then miterlimit = ml t[#t+1] = format("%f M",ml) end - local lj = currentobject.linejoin + local lj = object.linejoin if lj and lj ~= linejoin then linejoin = lj t[#t+1] = format("%i j",lj) end - local lc = currentobject.linecap + local lc = object.linecap if lc and lc ~= linecap then linecap = lc t[#t+1] = format("%i J",lc) end - local dl = currentobject.dash + local dl = object.dash if dl then local d = format("[%s] %i d",concat(dl.dashes or {}," "),dl.offset) if d ~= dashed then @@ -347,14 +346,13 @@ function metapost.flush(result,flusher,askedfig) -- pdf flusher, table en dan co t[#t+1] = "[] 0 d" dashed = false end - if inbetween then currentobject, t = inbetween() end - local path = currentobject.path + local path = object.path -- newpath local transformed, penwidth = false, 1 local open = path and path[1].left_type and path[#path].right_type -- at this moment only "end_point" - local pen = currentobject.pen + local pen = object.pen if pen then if pen.type == 'elliptical' then - transformed, penwidth = pen_characteristics(object) -- boolean, value + transformed, penwidth = pen_characteristics(original) -- boolean, value t[#t+1] = format("%f w",penwidth) -- todo: only if changed if objecttype == 'fill' then objecttype = 'both' @@ -383,7 +381,7 @@ function metapost.flush(result,flusher,askedfig) -- pdf flusher, table en dan co if transformed then t[#t+1] = "Q" end - local path = currentobject.htap + local path = object.htap if path then if transformed then t[#t+1] = "q" @@ -404,16 +402,19 @@ function metapost.flush(result,flusher,askedfig) -- pdf flusher, table en dan co t[#t+1] = "Q" end end - if cr then - t[#t+1] = cr + if after then + t = pluginactions(after,t,flushfigure) + end + if object.grouped then + -- can be qQ'd so changes can end up in groups + miterlimit, linecap, linejoin, dashed = -1, -1, -1, false end - if after then currentobject, t = after() end end - end + end end t[#t+1] = "Q" - flusher.flushfigure(t) - flusher.stopfigure("end") + flushfigure(t) + stopfigure("end") end if askedfig then break @@ -428,6 +429,7 @@ function metapost.parse(result,askedfig) if result then local figures = result.fig if figures then + local analyzeplugins = metapost.analyzeplugins for f=1, #figures do local figure = figures[f] local fignum = figure:charcode() or 0 @@ -440,17 +442,14 @@ function metapost.parse(result,askedfig) metapost.ury = ury local objects = getobjects(result,figure,f) if objects then + -- for o=1,#objects do + -- local object = objects[o] + -- local prescript = object.prescript + -- if prescript then + -- analyzeplugins(object) + -- end for o=1,#objects do - local object = objects[o] - if object.type == "outline" then - local prescript = object.prescript - if prescript then - local special = metapost.specials[prescript] - if special then - special(object.postscript,object) - end - end - end + analyzeplugins(objects[o]) end end break @@ -467,15 +466,17 @@ local t = { } local flusher = { startfigure = function() t = { } - texsprint(ctxcatcodes,"\\startnointerference") + context.startnointerference() end, flushfigure = function(literals) + local n = #t for i=1, #literals do - t[#t+1] = literals[i] + n = n + 1 + t[n] = literals[i] end end, stopfigure = function() - texsprint(ctxcatcodes,"\\stopnointerference") + context.stopnointerference() end } @@ -499,7 +500,7 @@ function metapost.totable(result) local field = fields[f] tt[field] = object[field] end - t[#t+1] = tt + t[o] = tt end local b = figure:boundingbox() return { @@ -510,21 +511,3 @@ function metapost.totable(result) return nil end end - --- will be overloaded later - -function metapost.colorconverter() - return function(cr) - local n = #cr - if n == 4 then - local c, m, y, k = cr[1], cr[2], cr[3], cr[4] - return format("%.3f %.3f %.3f %.3f k %.3f %.3f %.3f %.3f K",c,m,y,k,c,m,y,k), "0 g 0 G" - elseif n == 3 then - local r, g, b = cr[1], cr[2], cr[3] - return format("%.3f %.3f %.3f rg %.3f %.3f %.3f RG",r,g,b,r,g,b), "0 g 0 G" - else - local s = cr[1] - return format("%.3f g %.3f G",s,s), "0 g 0 G" - end - end -end diff --git a/Master/texmf-dist/tex/context/base/mlib-pdf.mkiv b/Master/texmf-dist/tex/context/base/mlib-pdf.mkiv index 2681b081044..8506b3b15e6 100644 --- a/Master/texmf-dist/tex/context/base/mlib-pdf.mkiv +++ b/Master/texmf-dist/tex/context/base/mlib-pdf.mkiv @@ -15,7 +15,7 @@ \registerctxluafile{mlib-pdf}{1.001} -\def\MPLIBtoPDF#1{\ctxlua{metapost.flush_literal(#1)}} +\def\MPLIBtoPDF#1{\ctxlua{metapost.flushliteral(#1)}} \def\MPLIBboundingbox#1#2#3#4% {\xdef\MPllx{#1}% @@ -26,7 +26,8 @@ \xdef\MPheight{\the\dimexpr#4\onebasepoint-#2\onebasepoint\relax}} \def\startMPLIBtoPDF#1#2#3#4% watch the transparency reset - {\naturalhbox\bgroup + {\dostarttagged\t!mpgraphic\empty + \naturalhbox attr \imageattribute 1 \bgroup \doactivatecolor\s!black\forcecolorhack \MPLIBboundingbox{#1}{#2}{#3}{#4}% %\forgetall % done already elsewhere @@ -52,7 +53,8 @@ \wd\scratchbox\MPwidth \ht\scratchbox\MPheight \dopackageMPgraphic\scratchbox - \egroup} + \egroup + \dostoptagged} % \def\MPLIBtextext#1#2#3#4#5% % {\begingroup @@ -88,4 +90,7 @@ \box\scratchbox \endgroup} +\def\MPLIBflushreset + {\ctxlua{metapost.flushreset()}} + \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/mlib-pps.lua b/Master/texmf-dist/tex/context/base/mlib-pps.lua index 8b36660d350..27269a14e49 100644 --- a/Master/texmf-dist/tex/context/base/mlib-pps.lua +++ b/Master/texmf-dist/tex/context/base/mlib-pps.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['mlib-pps'] = { -- prescript, postscripts and specials +if not modules then modules = { } end modules ['mlib-pps'] = { version = 1.001, comment = "companion to mlib-ctx.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -6,60 +6,65 @@ if not modules then modules = { } end modules ['mlib-pps'] = { -- prescript, pos license = "see context related readme files", } +-- pps: prescript, postscripts and specials (although specials are dropped) +-- -- current limitation: if we have textext as well as a special color then due to -- prescript/postscript overload we can have problems -- -- todo: report max textexts -local format, gmatch, concat, round, match = string.format, string.gmatch, table.concat, math.round, string.match -local sprint = tex.sprint +local format, gmatch, match = string.format, string.gmatch, string.match local tonumber, type = tonumber, type +local round = math.round +local insert, concat = table.insert, table.concat +local Cs, Cf, C, Cg, Ct, P, S, V, Carg = lpeg.Cs, lpeg.Cf, lpeg.C, lpeg.Cg, lpeg.Ct, lpeg.P, lpeg.S, lpeg.V, lpeg.Carg local lpegmatch = lpeg.match -local texbox = tex.box -local copy_list = node.copy_list -local starttiming, stoptiming = statistics.starttiming, statistics.stoptiming +local mplib, metapost, lpdf, context = mplib, metapost, lpdf, context -local ctxcatcodes = tex.ctxcatcodes +local texbox = tex.box +local copy_list = node.copy_list +local free_list = node.flush_list +local setmetatableindex = table.setmetatableindex +local sortedhash = table.sortedhash -local trace_textexts = false trackers.register("metapost.textexts", function(v) trace_textexts = v end) +local starttiming = statistics.starttiming +local stoptiming = statistics.stoptiming -colors = colors or { } +local trace_textexts = false trackers.register("metapost.textexts", function(v) trace_textexts = v end) +local trace_scripts = false trackers.register("metapost.scripts", function(v) trace_scripts = v end) -local rgbtocmyk = colors.rgbtocmyk or function() return 0,0,0,1 end -local cmyktorgb = colors.cmyktorgb or function() return 0,0,0 end -local rgbtogray = colors.rgbtogray or function() return 0 end -local cmyktogray = colors.cmyktogray or function() return 0 end +local report_metapost = logs.reporter("metapost") +local report_textexts = logs.reporter("metapost","textexts") +local report_scripts = logs.reporter("metapost","scripts") -metapost = metapost or { } -metapost.specials = metapost.specials or { } -metapost.specials.data = metapost.specials.data or { } -metapost.externals = metapost.externals or { n = 0 } +local colors = attributes.colors -local data = metapost.specials.data +local rgbtocmyk = colors.rgbtocmyk or function() return 0,0,0,1 end +local cmyktorgb = colors.cmyktorgb or function() return 0,0,0 end +local rgbtogray = colors.rgbtogray or function() return 0 end +local cmyktogray = colors.cmyktogray or function() return 0 end -local colordata = { {}, {}, {}, {}, {} } +metapost.makempy = metapost.makempy or { nofconverted = 0 } +local makempy = metapost.makempy ---~ (r,g,b) => cmyk : r=123 g= 1 b=hash ---~ => spot : r=123 g= 2 b=hash ---~ => transparent rgb : r=123 g= 3 b=hash ---~ => transparent cmyk : r=123 g= 4 b=hash ---~ => transparent spot : r=123 g= 5 b=hash ---~ => rest : r=123 g=n>10 b=whatever +local nooutercolor = "0 g 0 G" +local nooutertransparency = "/Tr0 gs" -- only when set +local outercolormode = 0 +local outercolor = nooutercolor +local outertransparency = nooutertransparency +local innercolor = nooutercolor +local innertransparency = nooutertransparency -local nooutercolor = "0 g 0 G" -local nooutertransparency = "/Tr0 gs" -- only when set -local outercolormode = 0 -local outercolor = nooutercolor -local outertransparency = nooutertransparency -local innercolor = nooutercolor -local innertransparency = nooutertransparency +local pdfcolor = lpdf.color +local pdftransparency = lpdf.transparency +local registercolor = colors.register +local registerspotcolor = colors.registerspotcolor -local pdfcolor, pdftransparency = lpdf.color, lpdf.transparency -local registercolor, registerspotcolor = colors.register, colors.registerspotcolor +local transparencies = attributes.transparencies local registertransparency = transparencies.register -function metapost.set_outer_color(mode,colormodel,colorattribute,transparencyattribute) +function metapost.setoutercolor(mode,colormodel,colorattribute,transparencyattribute) -- has always to be called before conversion -- todo: transparency (not in the mood now) outercolormode = mode @@ -90,169 +95,25 @@ local function checked_color_pair(color) end end -metapost.checked_color_pair = checked_color_pair - function metapost.colorinitializer() innercolor = outercolor innertransparency = outertransparency return outercolor, outertransparency end -function metapost.specials.register(str) -- only colors - local size, content, n, class = match(str,"^%%%%MetaPostSpecial: (%d+) (.*) (%d+) (%d+)$") - if class then - -- use lpeg splitter - local data = { } - for s in gmatch(content,"[^ ]+") do - data[#data+1] = s - end - class, n = tonumber(class), tonumber(n) - if class == 3 or class == 4 or class == 5 then - -- hm, weird - else - n = tonumber(data[1]) - end - if n then - local cc = colordata[class] - if cc then - cc[n] = data - else - logs.report("mplib","problematic special: %s (no colordata class %s)", str or "?",class) - end - else - -- there is some bug to be solved, so we issue a message - logs.report("mplib","problematic special: %s", str or "?") - end - end ---~ if match(str,"^%%%%MetaPostOption: multipass") then ---~ metapost.multipass = true ---~ end -end +--~ -local function spotcolorconverter(parent, n, d, p) - registerspotcolor(parent) - return pdfcolor(colors.model,registercolor(nil,'spot',parent,n,d,p)) -end - -function metapost.colorhandler(cs, object, result, colorconverter) -- handles specials - local cr = outercolor - local what = round(cs[2]*10000) - local data = colordata[what] - if data then - data = data[round(cs[3]*10000)] - end - if not data then - -- - elseif what == 1 then - result[#result+1], cr = colorconverter({ data[2], data[3], data[4], data[5] }) - elseif what == 2 then - result[#result+1] = spotcolorconverter(data[2],data[3],data[4],data[5]) - else - if what == 3 then - result[#result+1], cr = colorconverter({ data[3], data[4], data[5]}) - elseif what == 4 then - result[#result+1], cr = colorconverter({ data[3], data[4], data[5], data[6]}) - elseif what == 5 then - result[#result+1] = spotcolorconverter(data[3],data[4],data[5],data[6]) - end - object.prescript = "tr" - object.postscript = data[1] .. "," .. data[2] - end - object.color = nil - return object, cr -end - -function metapost.colorspec(cs) -- used for shades ... returns table (for checking) or string (spot) - local what = round(cs[2]*10000) - local data = colordata[what][round(cs[3]*10000)] - if not data then - return { 0 } - elseif what == 1 then - return { tonumber(data[2]), tonumber(data[3]), tonumber(data[4]), tonumber(data[5]) } - elseif what == 2 then - return spotcolorconverter(data[2],data[3],data[4],data[5]) - elseif what == 3 then - return { tonumber(data[3]), tonumber(data[4]), tonumber(data[5]) } - elseif what == 4 then - return { tonumber(data[3]), tonumber(data[4]), tonumber(data[5]), tonumber(data[6]) } - elseif what == 5 then - return spotcolorconverter(data[3],data[4],data[5],data[6]) - end -end - -function metapost.specials.tr(specification,object,result) - local a, t = match(specification,"^(.+),(.+)$") - local before = a and t and function() - result[#result+1] = format("/Tr%s gs",registertransparency(nil,a,t,true)) -- maybe nil instead of 'mp' - return object, result - end - local after = before and function() - result[#result+1] = outertransparency -- here we could revert to the outer color - return object, result - end - return object, before, nil, after -end - -local specificationsplitter = lpeg.Ct(lpeg.splitat(" ")) -local colorsplitter = lpeg.Ct(lpeg.splitat(":")) -local colorsplitter = lpeg.Ct(lpeg.splitter(":",tonumber)) - --- Unfortunately we cannot use cmyk colors natively because there is no --- generic color allocation primitive ... it's just an rgbcolor color.. This --- means that we cannot pass colors in either cmyk or rgb form. --- --- def cmyk(expr c,m,y,k) = --- 1 withprescript "cc" withpostscript ddddecimal (c,m,y,k) --- enddef ; --- --- This is also an example of a simple plugin. - ---~ function metapost.specials.cc(specification,object,result) ---~ object.color = lpegmatch(specificationsplitter,specification) ---~ return object, nil, nil, nil ---~ end ---~ function metapost.specials.cc(specification,object,result) ---~ local c = lpegmatch(specificationsplitter,specification) ---~ local o = object.color[1] ---~ c[1],c[2],c[3],c[4] = o*c[1],o*c[2],o*c[3],o*c[4] ---~ return object, nil, nil, nil ---~ end +local specificationsplitter = Ct(lpeg.splitat(" ")) +local colorsplitter = Ct(lpeg.splitter(":",tonumber)) -- no need for : +local domainsplitter = Ct(lpeg.splitter(" ",tonumber)) +local centersplitter = domainsplitter +local coordinatesplitter = domainsplitter -- thanks to taco's reading of the postscript manual: -- -- x' = sx * x + ry * y + tx -- y' = rx * x + sy * y + ty -function metapost.specials.fg(specification,object,result,flusher) -- graphics - local op = object.path - local first, second, fourth = op[1], op[2], op[4] - local tx, ty = first.x_coord , first.y_coord - local sx, sy = second.x_coord - tx, fourth.y_coord - ty - local rx, ry = second.y_coord - ty, fourth.x_coord - tx - if sx == 0 then sx = 0.00001 end - if sy == 0 then sy = 0.00001 end - local before = specification and function() - flusher.flushfigure(result) - sprint(ctxcatcodes,format("\\MPLIBfigure{%f}{%f}{%f}{%f}{%f}{%f}{%s}",sx,rx,ry,sy,tx,ty,specification)) - object.path = nil - return object, { } - end - return { } , before, nil, nil -- replace { } by object for tracing -end - -function metapost.specials.ps(specification,object,result) -- positions - local op = object.path - local first, third = op[1], op[3] - local x, y = first.x_coord, first.y_coord - local w, h = third.x_coord - x, third.y_coord - y - local label = specification - x = x - metapost.llx - y = metapost.ury - y - -- logs.report("mplib", "todo: position '%s' at (%s,%s) with (%s,%s)",label,x,y,w,h) - sprint(ctxcatcodes,format("\\dosavepositionwhd{%s}{0}{%sbp}{%sbp}{%sbp}{%sbp}{0pt}",label,x,y,w,h)) - return { }, nil, nil, nil -end - local nofshades = 0 -- todo: hash resources, start at 1000 in order not to clash with older local function normalize(ca,cb) @@ -276,95 +137,30 @@ end -- -- normalize(ca,cb) fails for spotcolors -function metapost.specials.cs(specification,object,result,flusher) -- spot colors? - -- a mess, not dynamic anyway - nofshades = nofshades + 1 - flusher.flushfigure(result) - result = { } - local t = lpegmatch(specificationsplitter,specification) - -- we need a way to move/scale - local ca = lpegmatch(colorsplitter,t[4]) - local cb = lpegmatch(colorsplitter,t[8]) - if round(ca[1]*10000) == 123 then ca = metapost.colorspec(ca) end - if round(cb[1]*10000) == 123 then cb = metapost.colorspec(cb) end - local name = format("MplSh%s",nofshades) - local domain = { tonumber(t[1]), tonumber(t[2]) } - local coordinates = { tonumber(t[5]), tonumber(t[6]), tonumber(t[7]), tonumber(t[9]), tonumber(t[10]), tonumber(t[11]) } - if type(ca) == "string" then - -- backend specific (will be renamed) - lpdf.circularshade(name,domain,{ 0 },{ 1 },1,"DeviceGray",coordinates) +local function spotcolorconverter(parent, n, d, p) + registerspotcolor(parent) + return pdfcolor(colors.model,registercolor(nil,'spot',parent,n,d,p)), outercolor +end + +local function checkandconvertspot(n_a,f_a,c_a,v_a,n_b,f_b,c_b,v_b) + -- must be the same but we don't check + local name = format("MpSh%s",nofshades) + local ca = string.split(v_a,",") + local cb = string.split(v_b,",") + if #ca == 0 or #cb == 0 then + return { 0 }, { 1 }, "DeviceGray", name else - if #ca > #cb then - normalize(ca,cb) - elseif #ca < #cb then - normalize(cb,ca) - end - local model = colors.model - if model == "all" then - model= (#ca == 4 and "cmyk") or (#ca == 3 and "rgb") or "gray" - end - if model == "rgb" then - if #ca == 4 then - ca[1], ca[2], ca[3] = cmyktorgb(ca[1],ca[2],ca[3],ca[4]) - cb[1], cb[2], cb[3] = cmyktorgb(cb[1],cb[2],cb[3],cb[4]) - ca[4], cb[4] = nil, nil - elseif #ca == 1 then - local a, b = 1-ca[1], 1-cb[1] - ca[1], ca[2], ca[3] = a, a, a - cb[1], cb[2], cb[3] = b, b, b - end - -- backend specific (will be renamed) - lpdf.circularshade(name,domain,ca,cb,1,"DeviceRGB",coordinates) - elseif model == "cmyk" then - if #ca == 3 then - ca[1], ca[2], ca[3], ca[4] = rgbtocmyk(ca[1],ca[2],ca[3]) - cb[1], cb[2], cb[3], ca[4] = rgbtocmyk(cb[1],cb[2],cb[3]) - elseif #ca == 1 then - ca[1], ca[2], ca[3], ca[4] = 0, 0, 0, ca[1] - cb[1], cb[2], cb[3], ca[4] = 0, 0, 0, ca[1] - end - -- backend specific (will be renamed) - lpdf.circularshade(name,domain,ca,cb,1,"DeviceCMYK",coordinates) - else - if #ca == 4 then - ca[1] = cmyktogray(ca[1],ca[2],ca[3],ca[4]) - cb[1] = cmyktogray(cb[1],cb[2],cb[3],cb[4]) - elseif #ca == 3 then - ca[1] = rgbtogray(ca[1],ca[2],ca[3]) - cb[1] = rgbtogray(cb[1],cb[2],cb[3]) - end - -- backend specific (will be renamed) - lpdf.circularshade(name,domain,ca,cb,1,"DeviceGRAY",coordinates) - end + for i=1,#ca do ca[i] = tonumber(ca[i]) or 0 end + for i=1,#cb do cb[i] = tonumber(cb[i]) or 1 end + --~ spotcolorconverter(n_a,f_a,c_a,v_a) -- not really needed + return ca, cb, n_a or n_b, name end - local before = function() - result[#result+1] = "q /Pattern cs" - return object, result - end - local after = function() - result[#result+1] = format("W n /%s sh Q", name) - return object, result - end - object.color, object.type = nil, nil - return object, before, nil, after -end - -function metapost.specials.ls(specification,object,result,flusher) - nofshades = nofshades + 1 - flusher.flushfigure(result) - result = { } - local t = lpegmatch(specificationsplitter,specification) - -- we need a way to move/scale - local ca = lpegmatch(colorsplitter,t[4]) - local cb = lpegmatch(colorsplitter,t[7]) - if round(ca[1]*10000) == 123 then ca = metapost.colorspec(ca) end - if round(cb[1]*10000) == 123 then cb = metapost.colorspec(cb) end +end + +local function checkandconvert(ca,cb) local name = format("MpSh%s",nofshades) - local domain = { tonumber(t[1]), tonumber(t[2]) } - local coordinates = { tonumber(t[5]), tonumber(t[6]), tonumber(t[8]), tonumber(t[9]) } - if type(ca) == "string" then - -- backend specific (will be renamed) - lpdf.linearshade(name,domain,{ 0 },{ 1 },1,"DeviceGray",coordinates) + if not ca or not cb or type(ca) == "string" then + return { 0 }, { 1 }, "DeviceGray", name else if #ca > #cb then normalize(ca,cb) @@ -377,79 +173,61 @@ function metapost.specials.ls(specification,object,result,flusher) end if model == "rgb" then if #ca == 4 then - ca[1], ca[2], ca[3] = cmyktorgb(ca[1],ca[2],ca[3],ca[4]) - cb[1], cb[2], cb[3] = cmyktorgb(cb[1],cb[2],cb[3],cb[4]) + ca = { cmyktorgb(ca[1],ca[2],ca[3],ca[4]) } + cb = { cmyktorgb(cb[1],cb[2],cb[3],cb[4]) } elseif #ca == 1 then local a, b = 1-ca[1], 1-cb[1] - ca[1], ca[2], ca[3] = a, a, a - cb[1], cb[2], cb[3] = b, b, b + ca = { a, a, a } + cb = { b, b, b } end - -- backend specific (will be renamed) - lpdf.linearshade(name,domain,ca,cb,1,"DeviceRGB",coordinates) + return ca, cb, "DeviceRGB", name elseif model == "cmyk" then if #ca == 3 then - ca[1], ca[2], ca[3], ca[4] = rgbtocmyk(ca[1],ca[2],ca[3]) - cb[1], cb[2], cb[3], ca[4] = rgbtocmyk(cb[1],cb[2],cb[3]) + ca = { rgbtocmyk(ca[1],ca[2],ca[3]) } + cb = { rgbtocmyk(cb[1],cb[2],cb[3]) } elseif #ca == 1 then - ca[1], ca[2], ca[3], ca[4] = 0, 0, 0, ca[1] - cb[1], cb[2], cb[3], ca[4] = 0, 0, 0, ca[1] + ca = { 0, 0, 0, ca[1] } + cb = { 0, 0, 0, ca[1] } end - -- backend specific (will be renamed) - lpdf.linearshade(name,domain,ca,cb,1,"DeviceCMYK",coordinates) + return ca, cb, "DeviceCMYK", name else if #ca == 4 then - ca[1] = cmyktogray(ca[1],ca[2],ca[3],ca[4]) - cb[1] = cmyktogray(cb[1],cb[2],cb[3],cb[4]) + ca = { cmyktogray(ca[1],ca[2],ca[3],ca[4]) } + cb = { cmyktogray(cb[1],cb[2],cb[3],cb[4]) } elseif #ca == 3 then - ca[1] = rgbtogray(ca[1],ca[2],ca[3]) - cb[1] = rgbtogray(cb[1],cb[2],cb[3]) + ca = { rgbtogray(ca[1],ca[2],ca[3]) } + cb = { rgbtogray(cb[1],cb[2],cb[3]) } end -- backend specific (will be renamed) - lpdf.linearshade(name,domain,ca,cb,1,"DeviceGRAY",coordinates) + return ca, cb, "DeviceGray", name end end - local before = function() - result[#result+1] = "q /Pattern cs" - return object, result - end - local after = function() - result[#result+1] = format("W n /%s sh Q", name) - return object, result - end - object.color, object.type = nil, nil - return object, before, nil, after end --- no need for a before here - local current_format, current_graphic, current_initializations --- metapost.first_box = metapost.first_box or 1000 --- metapost.last_box = metapost.last_box or 1100 ---~ metapost.textext_current = metapost.first_box -metapost.multipass = false - -local textexts = { } - -function metapost.free_boxes() -- todo: mp direct list ipv box - -- for i = metapost.first_box,metapost.last_box do - -- local b = texbox[i] - -- if b then - -- texbox[i] = nil -- no node.flush_list(b) needed, else double free error - -- else - -- break - -- end - -- end +metapost.multipass = false + +local textexts = { } +local scratchbox = 0 + +local function freeboxes() -- todo: mp direct list ipv box for n, box in next, textexts do local tn = textexts[n] if tn then - -- somehow not flushed (used) - textexts[n] = nil + free_list(tn) + -- texbox[scratchbox] = tn + -- texbox[scratchbox] = nil -- this frees too + if trace_textexts then + report_textexts("freeing %s",n) + end end end textexts = { } end +metapost.resettextexts = freeboxes + function metapost.settext(box,slot) textexts[slot] = copy_list(texbox[box]) texbox[box] = nil @@ -460,72 +238,10 @@ end function metapost.gettext(box,slot) texbox[box] = copy_list(textexts[slot]) --- textexts[slot] = nil -- no, pictures can be placed several times -end - -function metapost.specials.tf(specification,object) ---~ print("setting", metapost.textext_current) - local n, str = match(specification,"^(%d+):(.+)$") - if n and str then - n = tonumber(n) - -- if metapost.textext_current < metapost.last_box then - -- metapost.textext_current = metapost.first_box + n - 1 - -- end - if trace_textexts then - -- logs.report("metapost","first pass: order %s, box %s",n,metapost.textext_current) - logs.report("metapost","first pass: order %s",n) - end - -- sprint(ctxcatcodes,format("\\MPLIBsettext{%s}{%s}",metapost.textext_current,str)) - sprint(ctxcatcodes,format("\\MPLIBsettext{%s}{%s}",n,str)) - metapost.multipass = true - end - return { }, nil, nil, nil -end - -function metapost.specials.ts(specification,object,result,flusher) - -- print("getting", metapost.textext_current) - local n, str = match(specification,"^(%d+):(.+)$") - if n and str then - n = tonumber(n) - if trace_textexts then - -- logs.report("metapost","second pass: order %s, box %s",n,metapost.textext_current) - logs.report("metapost","second pass: order %s",n) - end - local op = object.path - local first, second, fourth = op[1], op[2], op[4] - local tx, ty = first.x_coord , first.y_coord - local sx, sy = second.x_coord - tx, fourth.y_coord - ty - local rx, ry = second.y_coord - ty, fourth.x_coord - tx - if sx == 0 then sx = 0.00001 end - if sy == 0 then sy = 0.00001 end - if not trace_textexts then - object.path = nil - end - local before = function() -- no need for before function (just do it directly) - --~ flusher.flushfigure(result) - --~ sprint(ctxcatcodes,format("\\MPLIBgettext{%f}{%f}{%f}{%f}{%f}{%f}{%s}",sx,rx,ry,sy,tx,ty,metapost.textext_current)) - --~ result = { } - result[#result+1] = format("q %f %f %f %f %f %f cm", sx,rx,ry,sy,tx,ty) - flusher.flushfigure(result) - -- if metapost.textext_current < metapost.last_box then - -- metapost.textext_current = metapost.first_box + n - 1 - -- end - -- local b = metapost.textext_current - -- local box = texbox[b] - local box = textexts[n] - if box then - -- sprint(ctxcatcodes,format("\\MPLIBgettextscaled{%s}{%s}{%s}",b,metapost.sxsy(box.width,box.height,box.depth))) - sprint(ctxcatcodes,format("\\MPLIBgettextscaled{%s}{%s}{%s}",n,metapost.sxsy(box.width,box.height,box.depth))) - else - -- error - end - result = { "Q" } - return object, result - end - return { }, before, nil, nil -- replace { } by object for tracing - else - return { }, nil, nil, nil -- replace { } by object for tracing + if trace_textexts then + report_textexts("putting %s in box %s",slot,box) end + -- textexts[slot] = nil -- no, pictures can be placed several times end -- rather generic pdf, so use this elsewhere too it no longer pays @@ -664,79 +380,85 @@ function models.gray(cr) return checked_color_pair(format("%.3f g %.3f G",s,s)) end -function metapost.colorconverter() - return models[colors.model] or gray +setmetatableindex(models, function(t,k) + local v = models.gray + t[k] = v + return v +end) + +local function colorconverter(cs) + return models[colors.model](cs) end -do +local btex = P("btex") +local etex = P(" etex") +local vtex = P("verbatimtex") +local ttex = P("textext") +local gtex = P("graphictext") +local multipass = P("forcemultipass") +local spacing = S(" \n\r\t\v")^0 +local dquote = P('"') - local P, S, V, Cs = lpeg.P, lpeg.S, lpeg.V, lpeg.Cs +local found, forced = false, false - local btex = P("btex") - local etex = P(" etex") - local vtex = P("verbatimtex") - local ttex = P("textext") - local gtex = P("graphictext") - local multipass = P("forcemultipass") - local spacing = S(" \n\r\t\v")^0 - local dquote = P('"') +local function convert(str) + found = true + return "rawtextext(\"" .. str .. "\")" -- centered +end +local function ditto(str) + return "\" & ditto & \"" +end +local function register() + found = true +end +local function force() + forced = true +end - local found, forced = false, false +local texmess = (dquote/ditto + (1 - etex))^0 - local function convert(str) - found = true - return "rawtextext(\"" .. str .. "\")" -- centered - end - local function ditto(str) - return "\" & ditto & \"" - end - local function register() - found = true - end - local function force() - forced = true - end +local function ignore(s) + report_metapost("ignoring verbatim tex: %s",s) + return "" +end - local texmess = (dquote/ditto + (1 - etex))^0 +-- local parser = P { +-- [1] = Cs((V(2)/register + V(4)/ignore + V(3)/convert + V(5)/force + 1)^0), +-- [2] = ttex + gtex, +-- [3] = btex * spacing * Cs(texmess) * etex, +-- [4] = vtex * spacing * Cs(texmess) * etex, +-- [5] = multipass, -- experimental, only for testing +-- } - local function ignore(s) - logs.report("mplib","ignoring verbatim tex: %s",s) - return "" - end +-- currently a a one-liner produces less code - local parser = P { - [1] = Cs((V(2)/register + V(4)/ignore + V(3)/convert + V(5)/force + 1)^0), - [2] = ttex + gtex, - [3] = btex * spacing * Cs(texmess) * etex, - [4] = vtex * spacing * Cs(texmess) * etex, - [5] = multipass, -- experimental, only for testing - } - - -- currently a a one-liner produces less code - - local parser = Cs(( - (ttex + gtex)/register - + (btex * spacing * Cs(texmess) * etex)/convert - + (vtex * spacing * Cs(texmess) * etex)/ignore - + 1 - )^0) - - function metapost.check_texts(str) - found, forced = false, false - return lpegmatch(parser,str), found, forced - end +-- textext.*(".*") can have "'s but tricky parsing as we can have concatenated strings +-- so this is something for a boring plain or train trip and we might assume proper mp +-- input anyway + +local parser = Cs(( + (ttex + gtex)/register + + (btex * spacing * Cs(texmess) * etex)/convert + + (vtex * spacing * Cs(texmess) * etex)/ignore + + 1 +)^0) +local function checktexts(str) + found, forced = false, false + return lpegmatch(parser,str), found, forced end +metapost.checktexts = checktexts + local factor = 65536*(7227/7200) function metapost.edefsxsy(wd,ht,dp) -- helper for figure local hd = ht + dp - commands.edef("sx",(wd ~= 0 and factor/wd) or 0) - commands.edef("sy",(hd ~= 0 and factor/hd) or 0) + context.setvalue("sx",wd ~= 0 and factor/wd or 0) + context.setvalue("sy",hd ~= 0 and factor/hd or 0) end -function metapost.sxsy(wd,ht,dp) -- helper for text +local function sxsy(wd,ht,dp) -- helper for text local hd = ht + dp return (wd ~= 0 and factor/wd) or 0, (hd ~= 0 and factor/hd) or 0 end @@ -748,22 +470,20 @@ local do_begin_fig = "; beginfig(1); " local do_end_fig = "; endfig ;" local do_safeguard = ";" -function metapost.text_texts_data() - local t, n = { }, 0 ---~ for i = metapost.first_box, metapost.last_box do ---~ n = n + 1 ---~ local box = texbox[i] +function metapost.texttextsdata() + local t, nt, n = { }, 0, 0 for n, box in next, textexts do - if trace_textexts then - logs.report("metapost","passed data: order %s, box %s",n,i) - end if box then - t[#t+1] = format(text_data_template,n,box.width/factor,n,box.height/factor,n,box.depth/factor) + local wd, ht, dp = box.width/factor, box.height/factor, box.depth/factor + if trace_textexts then + report_textexts("passed data %s: (%0.4f,%0.4f,%0.4f)",n,wd,ht,dp) + end + nt = nt + 1 + t[nt] = format(text_data_template,n,wd,n,ht,n,dp) else break end end ---~ print(table.serialize(t)) return t end @@ -773,16 +493,17 @@ metapost.intermediate.needed = false metapost.method = 1 -- 1:dumb 2:clever +-- maybe we can latelua the texts some day + function metapost.graphic_base_pass(mpsformat,str,initializations,preamble,askedfig) local nofig = (askedfig and "") or false local done_1, done_2, forced_1, forced_2 - str, done_1, forced_1 = metapost.check_texts(str) + str, done_1, forced_1 = checktexts(str) if not preamble or preamble == "" then preamble, done_2, forced_2 = "", false, false else - preamble, done_2, forced_2 = metapost.check_texts(preamble) + preamble, done_2, forced_2 = checktexts(preamble) end - -- metapost.textext_current = metapost.first_box metapost.intermediate.needed = false metapost.multipass = false -- no needed here current_format, current_graphic, current_initializations = mpsformat, str, initializations or "" @@ -806,7 +527,7 @@ function metapost.graphic_base_pass(mpsformat,str,initializations,preamble,asked if not flushed or not metapost.optimize then -- tricky, we can only ask once for objects and therefore -- we really need a second run when not optimized - sprint(ctxcatcodes,format("\\ctxlua{metapost.graphic_extra_pass(%s)}",askedfig or "false")) + context.MPLIBextrapass(askedfig or "false") end else metapost.process(mpsformat, { @@ -819,59 +540,30 @@ function metapost.graphic_base_pass(mpsformat,str,initializations,preamble,asked nofig or do_end_fig }, false, nil, false, false, askedfig ) end - -- here we could free the textext boxes - metapost.free_boxes() end function metapost.graphic_extra_pass(askedfig) local nofig = (askedfig and "") or false - -- metapost.textext_current = metapost.first_box metapost.process(current_format, { nofig or do_begin_fig, no_trial_run, - concat(metapost.text_texts_data()," ;\n"), + concat(metapost.texttextsdata()," ;\n"), current_initializations, do_safeguard, current_graphic, nofig or do_end_fig }, false, nil, false, true, askedfig ) + context.MPLIBresettexts() -- must happen afterwards end -metapost.tex = metapost.tex or { } - -do -- only used in graphictexts - - local environments = { } - - function metapost.tex.set(str) - environments[#environments+1] = str - end - function metapost.tex.reset() - environments = { } - end - function metapost.tex.get() - return concat(environments,"\n") - end - -end - -local graphics = { } local start = [[\starttext]] local preamble = [[\long\def\MPLIBgraphictext#1{\startTEXpage[scale=10000]#1\stopTEXpage}]] local stop = [[\stoptext]] -function metapost.specials.gt(specification,object) -- number, so that we can reorder - graphics[#graphics+1] = format("\\MPLIBgraphictext{%s}",specification) - metapost.intermediate.needed = true - metapost.multipass = true - return { }, nil, nil, nil -end - -function metapost.intermediate.actions.makempy() +function makempy.processgraphics(graphics) if #graphics > 0 then - local externals = metapost.externals - externals.n = externals.n + 1 - starttiming(externals) + makempy.nofconverted = makempy.nofconverted + 1 + starttiming(makempy) local mpofile = tex.jobname .. "-mpgraph" local mpyfile = file.replacesuffix(mpofile,"mpy") local pdffile = file.replacesuffix(mpofile,"pdf") @@ -882,16 +574,404 @@ function metapost.intermediate.actions.makempy() if io.exists(pdffile) then command = format("pstoedit -ssp -dt -f mpost %s %s", pdffile, mpyfile) os.execute(command) - local result = { } + local result, r = { }, 0 if io.exists(mpyfile) then local data = io.loaddata(mpyfile) for figure in gmatch(data,"beginfig(.-)endfig") do - result[#result+1] = format("begingraphictextfig%sendgraphictextfig ;\n", figure) + r = r + 1 + result[r] = format("begingraphictextfig%sendgraphictextfig ;\n", figure) end io.savedata(mpyfile,concat(result,"")) end end - stoptiming(externals) + stoptiming(makempy) + end +end + +-- -- the new plugin handler -- -- + +local sequencers = utilities.sequencers +local appendgroup = sequencers.appendgroup +local appendaction = sequencers.appendaction + +local resetter = nil +local analyzer = nil +local processor = nil + +local resetteractions = sequencers.reset { arguments = "" } +local analyzeractions = sequencers.reset { arguments = "object,prescript" } +local processoractions = sequencers.reset { arguments = "object,prescript,before,after" } + +appendgroup(resetteractions, "system") +appendgroup(analyzeractions, "system") +appendgroup(processoractions,"system") + +-- later entries come first + +--~ local scriptsplitter = Cf(Ct("") * ( +--~ Cg(C((1-S("= "))^1) * S("= ")^1 * C((1-S("\n\r"))^0) * S("\n\r")^0) +--~ )^0, rawset) + +local scriptsplitter = Ct ( Ct ( + C((1-S("= "))^1) * S("= ")^1 * C((1-S("\n\r"))^0) * S("\n\r")^0 +)^0 ) + +local function splitscript(script) + local hash = lpegmatch(scriptsplitter,script) + for i=#hash,1,-1 do + local h = hash[i] + hash[h[1]] = h[2] + end + if trace_scripts then + report_scripts(table.serialize(hash,"prescript")) + end + return hash +end + +function metapost.pluginactions(what,t,flushfigure) -- to be checked: too many 0 g 0 G + for i=1,#what do + local wi = what[i] + if type(wi) == "function" then + -- assume injection + flushfigure(t) + t = { } + wi() + else + t[#t+1] = wi + end + end + return t +end + +function metapost.resetplugins() + resetter() +end + +function metapost.analyzeplugins(object) + local prescript = object.prescript -- specifications + if prescript and #prescript > 0 then + return analyzer(object,splitscript(prescript)) + end +end + +function metapost.processplugins(object) -- maybe environment table + local prescript = object.prescript -- specifications + if prescript and #prescript > 0 then + local before = { } + local after = { } + processor(object,splitscript(prescript),before,after) + return #before > 0 and before, #after > 0 and after + else + local c = object.color + if c and #c > 0 then + local b, a = colorconverter(c) + return { b }, { a } + end + end +end + +-- helpers + +local basepoints = number.dimenfactors["bp"] + +local cm = function(object) + local op = object.path + local first, second, fourth = op[1], op[2], op[4] + local tx, ty = first.x_coord , first.y_coord + local sx, sy = second.x_coord - tx, fourth.y_coord - ty + local rx, ry = second.y_coord - ty, fourth.x_coord - tx + if sx == 0 then sx = 0.00001 end + if sy == 0 then sy = 0.00001 end + return sx,rx,ry,sy,tx,ty +end + +-- text + +local tx_done = { } + +local function tx_reset() + tx_done = { } +end + +local function tx_analyze(object,prescript) -- todo: hash content and reuse them + local tx_stage = prescript.tx_stage + if tx_stage then + local tx_number = tonumber(prescript.tx_number) + if not tx_done[tx_number] then + tx_done[tx_number] = true + if trace_textexts then + report_textexts("setting %s %s (first pass)",tx_stage,tx_number) + end + local s = object.postscript or "" + local c = object.color -- only simple ones, no transparency + local a = prescript.tr_alternative + local t = prescript.tr_transparency + if not c then + -- no color + elseif #c == 1 then + if a and t then + s = format("\\colored[s=%f,a=%f,t=%f]%s",c[1],a,t,s) + else + s = format("\\colored[s=%f]%s",c[1],s) + end + elseif #c == 3 then + if a and t then + s = format("\\colored[r=%f,g=%f,b=%f,a=%f,t=%f]%s",c[1],c[2],c[3],a,t,s) + else + s = format("\\colored[r=%f,g=%f,b=%f]%s",c[1],c[2],c[3],s) + end + elseif #c == 4 then + if a and t then + s = format("\\colored[c=%f,m=%f,y=%f,k=%f,a=%f,t=%f]%s",c[1],c[2],c[3],c[4],a,t,s) + else + s = format("\\colored[c=%f,m=%f,y=%f,k=%f]%s",c[1],c[2],c[3],c[4],s) + end + end + context.MPLIBsettext(tx_number,s) + metapost.multipass = true + end + end +end + +local function tx_process(object,prescript,before,after) + local tx_number = prescript.tx_number + if tx_number then + tx_number = tonumber(tx_number) + local tx_stage = prescript.tx_stage + if tx_stage == "final" then -- redundant test + if trace_textexts then + report_textexts("processing %s (second pass)",tx_number) + end + before[#before+1] = format("q %f %f %f %f %f %f cm",cm(object)) + before[#before+1] = function() + -- flush always happens, we can have a special flush function injected before + local box = textexts[tx_number] + if box then + context.MPLIBgettextscaled(tx_number,sxsy(box.width,box.height,box.depth)) + else + report_textexts("unknown %s",tx_number) + end + end + before[#before+1] = "Q" + if not trace_textexts then + object.path = false -- else: keep it + end + object.color = false + object.grouped = true + end + end +end + +-- graphics + +local graphics = { } + +function metapost.intermediate.actions.makempy() + if #graphics > 0 then + makempy.processgraphics(graphics) graphics = { } -- ? end end + +local function gt_analyze(object,prescript) + local gt_stage = prescript.gt_stage + if gt_stage == "trial" then + graphics[#graphics+1] = format("\\MPLIBgraphictext{%s}",object.postscript or "") + metapost.intermediate.needed = true + metapost.multipass = true + end +end + +-- local function gt_process(object,prescript,before,after) +-- local gt_stage = prescript.gt_stage +-- if gt_stage == "final" then +-- end +-- end + +-- shades + +local function sh_process(object,prescript,before,after) + local sh_type = prescript.sh_type + if sh_type then + nofshades = nofshades + 1 + local domain = lpegmatch(domainsplitter,prescript.sh_domain) + local centera = lpegmatch(centersplitter,prescript.sh_center_a) + local centerb = lpegmatch(centersplitter,prescript.sh_center_b) + -- + local sh_color_a = prescript.sh_color_a or "1" + local sh_color_b = prescript.sh_color_b or "1" + local ca, cb, colorspace, name, separation + if prescript.sh_color == "into" and prescript.sp_name then + -- some spotcolor + local value_a, components_a, fractions_a, name_a + local value_b, components_b, fractions_b, name_b + for i=1,#prescript do + local tag = prescript[i][1] + if not name_a and tag == "sh_color_a" then + value_a = prescript[i-4][2] + components_a = prescript[i-3][2] + fractions_a = prescript[i-2][2] + name_a = prescript[i-1][2] + elseif not name_b and tag == "sh_color_b" then + value_b = prescript[i-4][2] + components_b = prescript[i-3][2] + fractions_b = prescript[i-2][2] + name_b = prescript[i-1][2] + end + if name_a and name_b then + break + end + end + ca, cb, separation, name = checkandconvertspot( + name_a,fractions_a,components_a,value_a, + name_b,fractions_b,components_b,value_b + ) + else + local colora = lpegmatch(colorsplitter,sh_color_a) + local colorb = lpegmatch(colorsplitter,sh_color_b) + ca, cb, colorspace, name = checkandconvert(colora,colorb) + end + if not ca or not cb then + ca, cb, colorspace, name = checkandconvert() + end + if sh_type == "linear" then + local coordinates = { centera[1], centera[2], centerb[1], centerb[2] } + lpdf.linearshade(name,domain,ca,cb,1,colorspace,coordinates,separation) -- backend specific (will be renamed) + elseif sh_type == "circular" then + local radiusa = tonumber(prescript.sh_radius_a) + local radiusb = tonumber(prescript.sh_radius_b) + local coordinates = { centera[1], centera[2], radiusa, centerb[1], centerb[2], radiusb } + lpdf.circularshade(name,domain,ca,cb,1,colorspace,coordinates,separation) -- backend specific (will be renamed) + else + -- fatal error + end + before[#before+1], after[#after+1] = "q /Pattern cs", format("W n /%s sh Q",name) + object.color, object.type, object.grouped = false, false, true -- not nil, otherwise mt + end +end + +-- bitmaps + +local function bm_process(object,prescript,before,after) + local bm_xresolution = prescript.bm_xresolution + if bm_xresolution then + before[#before+1] = format("q %f %f %f %f %f %f cm",cm(object)) + before[#before+1] = function() + figures.bitmapimage { + xresolution = tonumber(bm_xresolution), + yresolution = tonumber(prescript.bm_yresolution), + width = 1/basepoints, + height = 1/basepoints, + data = object.postscript + } + end + before[#before+1] = "Q" + object.path = false + object.color = false + object.grouped = true + end +end + +-- positions + +local function ps_process(object,prescript,before,after) + local ps_label = prescript.ps_label + if ps_label then + local op = object.path + local first, third = op[1], op[3] + local x, y = first.x_coord, first.y_coord + local w, h = third.x_coord - x, third.y_coord - y + x = x - metapost.llx + y = metapost.ury - y + before[#before+1] = function() + context.MPLIBpositionwhd(ps_label,x,y,w,h) + end + end +end + +-- figures + +local function fg_process(object,prescript,before,after) + local fg_name = prescript.fg_name + if fg_name then + before[#before+1] = format("q %f %f %f %f %f %f cm",cm(object)) + before[#before+1] = function() + context.MPLIBfigure(fg_name,prescript.fg_mask or "") + end + before[#before+1] = "Q" + object.path = false + object.grouped = true + end +end + +-- color and transparency + +local value = Cs ( ( + (Carg(1) * C((1-P(","))^1)) / function(a,b) return format("%0.3f",a * tonumber(b)) end + + P(","))^1 +) + +local function tr_process(object,prescript,before,after) + -- before can be shortcut to t + local tr_alternative = prescript.tr_alternative + if tr_alternative then + tr_alternative = tonumber(tr_alternative) + local tr_transparency = tonumber(prescript.tr_transparency) + before[#before+1], after[#after+1] = format("/Tr%s gs",registertransparency(nil,tr_alternative,tr_transparency,true)), "/Tr0 gs" -- outertransparency + end + local cs = object.color + if cs and #cs > 0 then + local sp_name = prescript.sp_name + local b, a + if sp_name then + local sp_fractions = prescript.sp_fractions or 1 + local sp_components = prescript.sp_components or "" + local sp_value = prescript.sp_value or "1" + local cf = cs[1] + if cf ~= 1 then + -- beware, we do scale the spotcolors but not the alternative representation + sp_value = lpeg.match(value,sp_value,1,cf) or sp_value + end + -- should be codeinjections + b, a = spotcolorconverter(sp_name,sp_fractions,sp_components,sp_value) + else + -- should be codeinjections + b, a = colorconverter(cs) + end + before[#before+1] = b + after[#after+1] = a + end +end + +-- layers (nasty: we need to keep the 'grouping' right + +local function la_process(object,prescript,before,after) + local la_name = prescript.la_name + if la_name then + before[#before+1] = backends.codeinjections.startlayer(la_name) + insert(after,1,backends.codeinjections.stoplayer()) + end +end + +-- definitions + +appendaction(resetteractions,"system",tx_reset) + +appendaction(analyzeractions,"system",tx_analyze) +appendaction(analyzeractions,"system",gt_analyze) + +appendaction(processoractions,"system",sh_process) +-- (processoractions,"system",gt_process) +appendaction(processoractions,"system",bm_process) +appendaction(processoractions,"system",tx_process) +appendaction(processoractions,"system",ps_process) +appendaction(processoractions,"system",fg_process) +appendaction(processoractions,"system",tr_process) -- last, as color can be reset + +appendaction(processoractions,"system",la_process) + +-- no auto here + +resetter = sequencers.compile(resetteractions ) +analyzer = sequencers.compile(analyzeractions ) +processor = sequencers.compile(processoractions) diff --git a/Master/texmf-dist/tex/context/base/mlib-pps.mkiv b/Master/texmf-dist/tex/context/base/mlib-pps.mkiv index 0a78a87040e..357f85b1a1f 100644 --- a/Master/texmf-dist/tex/context/base/mlib-pps.mkiv +++ b/Master/texmf-dist/tex/context/base/mlib-pps.mkiv @@ -33,38 +33,28 @@ \newbox \MPtextbox \newtoks\everyMPLIBsettext -\def\MPLIBfigure#1#2#3#4#5#6#7% todo: move Q q to lua - {\setbox\scratchbox\hbox{\externalfigure[#7]}% +\def\MPLIBfigure#1#2% + {\setbox\scratchbox\hbox{\externalfigure[#1][\c!mask=#2]}% \ctxlua{metapost.edefsxsy(\number\wd\scratchbox,\number\ht\scratchbox,0)}% - \pdfliteral direct{q #1 #2 #3 #4 #5 #6 cm}% no direct - \vbox to \zeropoint{\vss\hbox to \zeropoint{\scale[sx=\sx,sy=\sy]{\box\scratchbox}\hss}}% - \pdfliteral direct{Q}} + \vbox to \zeropoint{\vss\hbox to \zeropoint{\scale[\c!sx=\sx,\c!sy=\sy]{\box\scratchbox}\hss}}} \def\MPLIBsettext#1% #2% {\dowithnextbox{\ctxlua{metapost.settext(\number\nextbox,#1)}}\hbox} -\def\MPLIBgettextscaled#1#2#3% why a copy - {\ctxlua{metapost.gettext(\number\MPtextbox,#1)}% - \vbox to \zeropoint{\vss\hbox to \zeropoint{\black\scale[sx=#2,sy=#3]{\raise\dp\MPtextbox\box\MPtextbox}\hss}}} +\def\MPLIBgettextscaled#1#2#3% why a copy .. can be used more often + {\ctxlua{metapost.gettext(\number\MPtextbox,#1)}% we need the colorhack or else the color backend does not sync + \vbox to \zeropoint{\vss\hbox to \zeropoint{\scale[\c!sx=#2,\c!sy=#3]{\raise\dp\MPtextbox\box\MPtextbox}\forcecolorhack\hss}}} \def\MPLIBgraphictext#1% {\startTEXpage[\c!scale=10000]#1\stopTEXpage} -\protect \endinput +\def\MPLIBpositionwhd#1#2#3#4#5% + {\dosavepositionwhd{#1}{0}{#2sp}{#3sp}{#4sp}{#5sp}{0sp}} + +\def\MPLIBextrapass#1% + {\ctxlua{metapost.graphic_extra_pass(#1)}} -% \def\MPLIBsettext#1% #2% we could as well store in hlists at the lua end i.e. just one box -% {\global\setbox#1\hbox} -% -% \def\MPLIBfreetext#1% -% {\global\setbox#1\emptybox} -% -% \def\MPLIBgettextscaled#1#2#3% why a copy -% {\vbox to \zeropoint{\vss\hbox to \zeropoint{\black\scale[sx=#2,sy=#3]{\raise\dp#1\copy#1}\hss}}} -% -% \def\MPLIBallocate#1% -% {\newbox\MPLIBfirst -% \dorecurse{\numexpr#1-1\relax}{\let\MPLIBlast\relax\newbox\MPLIBlast}% -% \MPLIBregister} -% -% \def\MPLIBregister % after allocate! -% {\ctxlua{metapost.first_box, metapost.last_box = \number\MPLIBfirst, \number\MPLIBlast}} +\def\MPLIBresettexts + {\ctxlua{metapost.resettextexts()}} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/mlib-run.lua b/Master/texmf-dist/tex/context/base/mlib-run.lua index f352e1db161..72c16775d4f 100644 --- a/Master/texmf-dist/tex/context/base/mlib-run.lua +++ b/Master/texmf-dist/tex/context/base/mlib-run.lua @@ -31,110 +31,77 @@ nears zero.

local trace_graphics = false trackers.register("metapost.graphics", function(v) trace_graphics = v end) -local format, gsub, match = string.format, string.gsub, string.match +local report_metapost = logs.reporter("metapost") + +local texerrormessage = logs.texerrormessage + +local format, gsub, match, find = string.format, string.gsub, string.match, string.find local starttiming, stoptiming = statistics.starttiming, statistics.stoptiming -metapost = metapost or { } +local mplib = mplib + +metapost = metapost or { } +local metapost = metapost -metapost.showlog = false -metapost.lastlog = "" +metapost.showlog = false +metapost.lastlog = "" +metapost.texerrors = false +metapost.exectime = metapost.exectime or { } -- hack + +local mplibone = tonumber(mplib.version()) <= 1.50 + +directives.register("mplib.texerrors", function(v) metapost.texerrors = v end) function metapost.resetlastlog() metapost.lastlog = "" end -local function finder(name, mode, ftype) - if mode=="w" then +local function finder(name, mode, ftype) -- we can use the finder to intercept btex/etex + if mode == "w" then return name elseif file.is_qualified_path(name) then return name else - return resolvers.find_file(name,ftype) + return resolvers.findfile(name,ftype) end end -metapost.finder = finder - -metapost.parameters = { - hash_size = 100000, - main_memory = 4000000, - max_in_open = 50, - param_size = 100000, -} - -metapost.exectime = metapost.exectime or { } -- hack - -local preamble = [[ -boolean mplib; string mp_parent_version; -mplib := true; -mp_parent_version := "%s"; -input %s ; dump ; -]] - -function metapost.make(name, target, version) - starttiming(mplib) - target = file.replacesuffix(target or name, "mem") - local mpx = mplib.new ( table.merged ( - metapost.parameters, - { - ini_version = true, - find_file = finder, - job_name = file.removesuffix(target), - } - ) ) - if mpx then - starttiming(metapost.exectime) - local result = mpx:execute(format(preamble,version or "unknown",name)) - stoptiming(metapost.exectime) - mpx:finish() +local function finder(name, mode, ftype) -- we use the finder to intercept btex/etex + if mode ~= "w" then + name = file.is_qualified_path(name) and name or resolvers.findfile(name,ftype) + if not (find(name,"/metapost/context/base/") or find(name,"/metapost/context/") or find(name,"/metapost/base/")) then + local data, found, forced = metapost.checktexts(io.loaddata(name) or "") + if found then + local temp = luatex.registertempfile(name,true) + io.savedata(temp,data) + name = temp + end + end end - stoptiming(mplib) + return name end -function metapost.load(name) - starttiming(mplib) - local mpx = mplib.new ( table.merged ( - metapost.parameters, - { - ini_version = false, - mem_name = file.replacesuffix(name,"mem"), - find_file = finder, - -- job_name = "mplib", - } - ) ) - local result - if not mpx then - result = { status = 99, error = "out of memory"} - end - stoptiming(mplib) - return mpx, result -end +-- -- -- -function metapost.unload(mpx) - starttiming(mplib) - if mpx then - mpx:finish() - end - stoptiming(mplib) -end +metapost.finder = finder function metapost.reporterror(result) if not result then - metapost.report("mp error: no result object returned") + report_metapost("error: no result object returned") elseif result.status > 0 then local t, e, l = result.term, result.error, result.log if t and t ~= "" then - metapost.report("mp terminal: %s",t) + (metapost.texerrors and texerrormessage or report_metapost)("terminal: %s",t) end if e then - metapost.report("mp error: %s",(e=="" and "?") or e) + (metapost.texerrors and texerrormessage or report_metapost)("error: %s",(e=="" and "?") or e) end if not t and not e and l then metapost.lastlog = metapost.lastlog .. "\n" .. l - metapost.report("mp log: %s",l) + report_metapost("log: %s",l) else - metapost.report("mp error: unknown, no error, terminal or log messages") + report_metapost("error: unknown, no error, terminal or log messages") end else return false @@ -142,48 +109,148 @@ function metapost.reporterror(result) return true end -function metapost.checkformat(mpsinput, mpsformat, dirname) - mpsinput = file.addsuffix(mpsinput or "metafun", "mp") - mpsformat = file.removesuffix(file.basename(mpsformat or texconfig.formatname or (tex and tex.formatname) or mpsinput)) - local mpsbase = file.removesuffix(file.basename(mpsinput)) - if mpsbase ~= mpsformat then - mpsformat = mpsformat .. "-" .. mpsbase +if mplibone then + + local preamble = [[ + boolean mplib ; mplib := true ; + string mp_parent_version ; mp_parent_version := "%s" ; + input %s ; dump ; + ]] + + metapost.parameters = { + hash_size = 100000, + main_memory = 4000000, + max_in_open = 50, + param_size = 100000, + } + + function metapost.make(name, target, version) + starttiming(mplib) + target = file.replacesuffix(target or name, "mem") -- redundant + local mpx = mplib.new ( table.merged ( + metapost.parameters, + { + ini_version = true, + find_file = finder, + job_name = file.removesuffix(target), + } + ) ) + if mpx then + starttiming(metapost.exectime) + local result = mpx:execute(format(preamble,version or "unknown",name)) + stoptiming(metapost.exectime) + mpx:finish() + end + stoptiming(mplib) end - mpsformat = file.addsuffix(mpsformat, "mem") - local pth = dirname or file.dirname(texconfig.formatname or "") - if pth ~= "" then - mpsformat = file.join(pth,mpsformat) + + function metapost.load(name) + starttiming(mplib) + local mpx = mplib.new ( table.merged ( + metapost.parameters, + { + ini_version = false, + mem_name = file.replacesuffix(name,"mem"), + find_file = finder, + -- job_name = "mplib", + } + ) ) + local result + if not mpx then + result = { status = 99, error = "out of memory"} + end + stoptiming(mplib) + return mpx, result end - local the_version = environment.version or "unset version" - if lfs.isfile(mpsformat) then - commands.writestatus("mplib","loading '%s' from '%s'", mpsinput, mpsformat) - local mpx, result = metapost.load(mpsformat) - if mpx then - local result = mpx:execute("show mp_parent_version ;") - if not result.log then - metapost.reporterror(result) - else - local version = match(result.log,">> *(.-)[\n\r]") or "unknown" - version = gsub(version,"[\'\"]","") - if version ~= the_version then - commands.writestatus("mplib","version mismatch: %s <> %s", version or "unknown", the_version) + + function metapost.checkformat(mpsinput) + local mpsversion = environment.version or "unset version" + local mpsinput = file.addsuffix(mpsinput or "metafun", "mp") + local mpsformat = file.removesuffix(file.basename(texconfig.formatname or (tex and tex.formatname) or mpsinput)) + local mpsbase = file.removesuffix(file.basename(mpsinput)) + if mpsbase ~= mpsformat then + mpsformat = mpsformat .. "-" .. mpsbase + end + mpsformat = file.addsuffix(mpsformat, "mem") + local mpsformatfullname = caches.getfirstreadablefile(mpsformat,"formats") or "" + if mpsformatfullname ~= "" then + report_metapost("loading '%s' from '%s'", mpsinput, mpsformatfullname) + local mpx, result = metapost.load(mpsformatfullname) + if mpx then + local result = mpx:execute("show mp_parent_version ;") + if not result.log then + metapost.reporterror(result) else - return mpx + local version = match(result.log,">> *(.-)[\n\r]") or "unknown" + version = gsub(version,"[\'\"]","") + if version ~= mpsversion then + report_metapost("version mismatch: %s <> %s", version or "unknown", mpsversion) + else + return mpx + end end + else + report_metapost("error in loading '%s' from '%s'", mpsinput, mpsformatfullname) + metapost.reporterror(result) end + end + local mpsformatfullname = caches.setfirstwritablefile(mpsformat,"formats") + report_metapost("making '%s' into '%s'", mpsinput, mpsformatfullname) + metapost.make(mpsinput,mpsformatfullname,mpsversion) -- somehow return ... fails here + if lfs.isfile(mpsformatfullname) then + report_metapost("loading '%s' from '%s'", mpsinput, mpsformatfullname) + return metapost.load(mpsformatfullname) + else + report_metapost("problems with '%s' from '%s'", mpsinput, mpsformatfullname) + end + end + +else + + local preamble = [[ + boolean mplib ; mplib := true ; + let dump = endinput ; + input %s ; + ]] + + function metapost.load(name) + starttiming(mplib) + local mpx = mplib.new { + ini_version = true, + find_file = finder, + } + local result + if not mpx then + result = { status = 99, error = "out of memory"} + else + result = mpx:execute(format(preamble, file.replacesuffix(name,"mp"))) + end + stoptiming(mplib) + metapost.reporterror(result) + return mpx, result + end + + function metapost.checkformat(mpsinput) + local mpsversion = environment.version or "unset version" + local mpsinput = file.addsuffix(mpsinput or "metafun", "mp") + report_metapost("loading '%s' (experimental metapost version two)",mpsinput) + local mpx, result = metapost.load(mpsinput) + if mpx then + return mpx else - commands.writestatus("mplib","error in loading '%s' from '%s'", mpsinput, mpsformat) + report_metapost("error in loading '%s'",mpsinput) metapost.reporterror(result) end end - commands.writestatus("mplib","making '%s' into '%s'", mpsinput, mpsformat) - metapost.make(mpsinput,mpsformat,the_version) -- somehow return ... fails here - if lfs.isfile(mpsformat) then - commands.writestatus("mplib","loading '%s' from '%s'", mpsinput, mpsformat) - return metapost.load(mpsformat) - else - commands.writestatus("mplib","problems with '%s' from '%s'", mpsinput, mpsformat) + +end + +function metapost.unload(mpx) + starttiming(mplib) + if mpx then + mpx:finish() end + stoptiming(mplib) end local mpxformats = { } @@ -192,7 +259,7 @@ function metapost.format(instance,name) name = name or instance local mpx = mpxformats[instance] if not mpx then - commands.writestatus("mplib","initializing instance '%s' using format '%s'",instance,name) + report_metapost("initializing instance '%s' using format '%s'",instance,name) mpx = metapost.checkformat(name) mpxformats[instance] = mpx end @@ -256,9 +323,9 @@ function metapost.process(mpx, data, trialrun, flusher, multipass, isextrapass, if not metapost.reporterror(result) then if metapost.showlog then local str = (result.term ~= "" and result.term) or "no terminal output" - if not str:is_empty() then + if not string.is_empty(str) then metapost.lastlog = metapost.lastlog .. "\n" .. str - metapost.report("mp log: %s",str) + report_metapost("log: %s",str) end end if result.fig then @@ -266,7 +333,7 @@ function metapost.process(mpx, data, trialrun, flusher, multipass, isextrapass, end end else - metapost.report("mp error: invalid graphic component %s",i) + report_metapost("error: invalid graphic component %s",i) end end else @@ -284,13 +351,13 @@ function metapost.process(mpx, data, trialrun, flusher, multipass, isextrapass, end -- todo: error message if not result then - metapost.report("mp error: no result object returned") + report_metapost("error: no result object returned") elseif result.status > 0 then - metapost.report("mp error: %s",(result.term or "no-term") .. "\n" .. (result.error or "no-error")) + report_metapost("error: %s",(result.term or "no-term") .. "\n" .. (result.error or "no-error")) else if metapost.showlog then metapost.lastlog = metapost.lastlog .. "\n" .. result.term - metapost.report("mp info: %s",result.term or "no-term") + report_metapost("info: %s",result.term or "no-term") end if result.fig then converted = metapost.convert(result, trialrun, flusher, multipass, askedfig) @@ -308,11 +375,7 @@ function metapost.process(mpx, data, trialrun, flusher, multipass, isextrapass, end function metapost.convert() - metapost.report('mp warning: no converter set') -end - -function metapost.report(...) - logs.report("mplib",...) + report_metapost('warning: no converter set') end -- handy @@ -324,29 +387,29 @@ function metapost.directrun(formatname,filename,outputformat,astable,mpdata) outputformat = "mps" end if not data then - logs.simple("unknown file '%s'",filename or "?") + report_metapost("unknown file '%s'",filename or "?") else - local mpx = metapost.checkformat(formatname,formatname,caches.setpath("formats")) + local mpx = metapost.checkformat(formatname) if not mpx then - logs.simple("unknown format '%s'",formatname or "?") + report_metapost("unknown format '%s'",formatname or "?") else - logs.simple("processing '%s'",(mpdata and (filename or "data")) or fullname) + report_metapost("processing '%s'",(mpdata and (filename or "data")) or fullname) local result = mpx:execute(data) if not result then - logs.simple("error: no result object returned") + report_metapost("error: no result object returned") elseif result.status > 0 then - logs.simple("error: %s",(result.term or "no-term") .. "\n" .. (result.error or "no-error")) + report_metapost("error: %s",(result.term or "no-term") .. "\n" .. (result.error or "no-error")) else if metapost.showlog then metapost.lastlog = metapost.lastlog .. "\n" .. result.term - logs.simple("info: %s",result.term or "no-term") + report_metapost("info: %s",result.term or "no-term") end local figures = result.fig if figures then local sorted = table.sortedkeys(figures) if astable then local result = { } - logs.simple("storing %s figures in table",#sorted) + report_metapost("storing %s figures in table",#sorted) for k=1,#sorted do local v = sorted[k] if outputformat == "mps" then @@ -367,7 +430,7 @@ function metapost.directrun(formatname,filename,outputformat,astable,mpdata) output = figures[v]:svg() -- (3) for prologues end local outname = format("%s-%s.%s",basename,v,outputformat) - logs.simple("saving %s bytes in '%s'",#output,outname) + report_metapost("saving %s bytes in '%s'",#output,outname) io.savedata(outname,output) end return #sorted diff --git a/Master/texmf-dist/tex/context/base/mtx-context-arrange.tex b/Master/texmf-dist/tex/context/base/mtx-context-arrange.tex index 73431567d34..b3d8a4df116 100644 --- a/Master/texmf-dist/tex/context/base/mtx-context-arrange.tex +++ b/Master/texmf-dist/tex/context/base/mtx-context-arrange.tex @@ -1,5 +1,3 @@ -% engine=luatex - %D \module %D [ file=mtx-context-arrange, %D version=2009.03.21, @@ -106,6 +104,3 @@ \stopluacode \stoptext - - - diff --git a/Master/texmf-dist/tex/context/base/mtx-context-listing.tex b/Master/texmf-dist/tex/context/base/mtx-context-listing.tex index d0dbcbba09b..0cbd73784c8 100644 --- a/Master/texmf-dist/tex/context/base/mtx-context-listing.tex +++ b/Master/texmf-dist/tex/context/base/mtx-context-listing.tex @@ -69,6 +69,12 @@ lfg = "lua", } + local pattern = document.arguments.pattern + + if pattern then + document.files = dir.glob(pattern) + end + if #document.files > 0 then if document.arguments.sort then table.sort(document.files) @@ -85,10 +91,16 @@ end context.page() context.setupfootertexts( -- return true: we need to keep this entry - { function() context.detokenize(file.basename(filename)) return true end }, + { function() context.detokenize(pattern and filename or file.basename(filename)) return true end }, { function() context.pagenumber() return true end } ) - context.setuptyping { option = types[pretty] or pretty } + if pretty then + if type(pretty) ~= "string" or pretty == "" then + context.setuptyping { option = "color" } + else + context.setuptyping { option = types[pretty] or pretty } + end + end context.typefile(filename) end end diff --git a/Master/texmf-dist/tex/context/base/mtx-context-select.tex b/Master/texmf-dist/tex/context/base/mtx-context-select.tex new file mode 100644 index 00000000000..8a02bdff729 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mtx-context-select.tex @@ -0,0 +1,109 @@ +% engine=luatex + +%D \module +%D [ file=mtx-context-select, +%D version=2008.11.10, % about that time i started playing with this +%D title=\CONTEXT\ Extra Trickry, +%D subtitle=Listing Files, +%D author=Hans Hagen, +%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 This is a \TEXEXEC\ features that has been moved to \MKIV. + +% begin help +% +% usage: context --extra=select [options] list-of-files +% +% --sort : sort filenames first +% --topspace=dimension : distance above first line +% --backspace=dimension : distance before left margin +% --selection=list : n:m,p:q,... +% --paperformat=spec : paper*print or paperxprint or 'fit' +% --interaction : add hyperlinks +% +% end help + +\input mtx-context-common.tex + +\setuppapersize + [\getdocumentargumentdefault{paperformat_from}{A4}] + [\getdocumentargumentdefault{paperformat_to}{A4}] + +\setuppaper + [offset=\getdocumentargumentdefault{paperformat_to}{0pt}] + +\setuplayout + [width=middle, + height=middle, + topspace=\getdocumentargumentdefault{topspace}{0pt}, + backspace=\getdocumentargumentdefault{backspace}{0pt}, + location=middle, + header=0pt, + footer=0pt] + +\doif {\getdocumentargument{marking}} {yes} { + \setuplayout + [marking=on] +} + +\doif {\getdocumentargument{interaction}} {yes} { + \setupinteraction + [state=start] + \setupexternalfigures + [interaction=yes] +} + +\setupexternalfigures + [directory=] + +\doifelse {\getdocumentargument{paperformat_paper}} {fit} { + \doifdocumentfilename {1} { + \getfiguredimensions + [\getdocumentfilename{1}] + \definepapersize + [fit] + [width=\figurewidth, + height=\figureheight] + \setuppapersize + [fit] + [fit] + } +} + +\starttext + +\startluacode + + local papersize = document.arguments.paperformat_paper or "A4" + local printsize = document.arguments.paperformat_print or "A4" + local selection = document.arguments.selection or "" + local textwidth = document.arguments.textwidth or "0cm" -- needed ? + + if #document.files == 0 then + context("no files given") + elseif selection == "" then + context("no selection given") + else + if document.arguments.sort then + table.sort(document.files) + end + for _, filename in ipairs(document.files) do + if not string.find(filename,"^mtx%-context%-") then + context.filterpages ( + { filename }, + { selection }, + { width = textwidth } + ) + end + end + end + +\stopluacode + +\stoptext + diff --git a/Master/texmf-dist/tex/context/base/mult-aux.lua b/Master/texmf-dist/tex/context/base/mult-aux.lua new file mode 100644 index 00000000000..cbecd2df1d5 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-aux.lua @@ -0,0 +1,147 @@ +if not modules then modules = { } end modules ['mult-aux'] = { + version = 1.001, + comment = "companion to mult-aux.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local find = string.find + +interfaces.namespaces = interfaces.namespaces or { } +local namespaces = interfaces.namespaces +local variables = interfaces.variables + +local trace_namespaces = false trackers.register("interfaces.namespaces", function(v) trace_namespaces = v end) + +local report_namespaces = logs.reporter("interface","namespaces") + +local v_yes, v_list = variables.yes, variables.list + +local prefix = "????" +local meaning = "@@@@" + +local data = { } + +function namespaces.define(namespace,settings) + if trace_namespaces then + report_namespaces("installing namespace '%s' with settings '%s'",namespace,settings) + end + if data[namespace] then + report_namespaces("namespace '%s' is already taken",namespace) + end + if #namespace < 2 then + report_namespaces("namespace '%s' should have more than 1 character",namespace) + end + local ns = { } + data[namespace] = ns + utilities.parsers.settings_to_hash(settings,ns) + local name = ns.name + if not name or name == "" then + report_namespaces("provide a (command) name in namespace '%s'",namespace) + end + local self = "\\" .. prefix .. namespace + context.unprotect() + -- context.installnamespace(namespace) + context("\\def\\%s%s{%s%s}",prefix,namespace,meaning,namespace) + if trace_namespaces then + report_namespaces("using namespace '%s' for '%s'",namespace,name) + end + local parent = ns.parent or "" + if parent ~= "" then + if trace_namespaces then + report_namespaces("namespace '%s' for '%s' uses parent '%s'",namespace,name,parent) + end + if not find(parent,"\\") then + parent = "\\" .. prefix .. parent + -- todo: check if defined + end + end + context.installparameterhandler(self,name) + if trace_namespaces then + report_namespaces("installing parameter handler for '%s'",name) + end + context.installparameterhashhandler(self,name) + if trace_namespaces then + report_namespaces("installing parameterhash handler for '%s'",name) + end + local style = ns.style + if style == v_yes then + context.installattributehandler(self,name) + if trace_namespaces then + report_namespaces("installing attribute handler for '%s'",name) + end + end + local command = ns.command + if command == v_yes then + context.installdefinehandler(self,name,parent) + if trace_namespaces then + report_namespaces("installing definition command for '%s' (single)",name) + end + elseif command == v_list then + context.installdefinehandler(self,name,parent) + if trace_namespaces then + report_namespaces("installing definition command for '%s' (multiple)",name) + end + end + local setup = ns.setup + if setup == v_yes then + context.installsetuphandler(self,name) + if trace_namespaces then + report_namespaces("installing setup command for '%s' (single)",name) + end + elseif setup == v_list then + context.installsetuphandler(self,name) + if trace_namespaces then + report_namespaces("installing setup command for '%s' (multiple)",name) + end + end + local set = ns.set + if set == v_yes then + context.installparametersethandler(self,name) + if trace_namespaces then + report_namespaces("installing set/let/reset command for '%s' (single)",name) + end + elseif set == v_list then + context.installparametersethandler(self,name) + if trace_namespaces then + report_namespaces("installing set/let/reset command for '%s' (multiple)",name) + end + end + context.protect() +end + +function utilities.formatters.list(data,key,keys) + if not keys then + keys = { } + for _, v in next, data do + for k, _ in next, v do + keys[k] = true + end + end + keys = table.sortedkeys(keys) + end + context.starttabulate { "|"..string.rep("l|",#keys+1) } + context.NC() + context(key) + for i=1,#keys do + context.NC() + context(keys[i]) + end context.NR() + context.HL() + for k, v in table.sortedhash(data) do + context.NC() + context(k) + for i=1,#keys do + context.NC() + context(v[keys[i]]) + end context.NR() + end + context.stoptabulate() +end + +function namespaces.list() + -- utilities.formatters.list(data,"namespace") + local keys = { "type", "name", "comment", "version", "parent", "definition", "setup", "style" } + utilities.formatters.list(data,"namespace",keys) +end diff --git a/Master/texmf-dist/tex/context/base/mult-aux.mkii b/Master/texmf-dist/tex/context/base/mult-aux.mkii new file mode 100644 index 00000000000..f06833bffc3 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-aux.mkii @@ -0,0 +1,152 @@ +%D \module +%D [ file=mult-aux, +%D version=2010.08.2, +%D title=\CONTEXT\ Multilingual Macros, +%D subtitle=helpers, +%D author=Hans Hagen, +%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 This is a subset of the \MKIV\ variant which has more comments). There +%D is no support for attributes (fonts and color). This code is mostly +%D meant for usage in modules that are backported from \MKIV. + +\writestatus{loading}{ConTeXt Multilingual Macros / Helpers} + +\unprotect + +%D \starttyping +%D \unprotect +%D \def\????aa{@@@@aa} +%D +%D \installparameterhandler \????aa {whatever} +%D \installsetuphandler \????aa {whatever} +%D \installdefinehandler \????aa {whatever} \????aa % #3 == defaultroot +%D +%D % \installcommandhandler \????aa {whatever} \????aa +%D \protect +%D +%D % \whateverparameter \c!test +%D % \whateverparameterhash \c!test +%D % \namedwhateverparameter \mycurrentwhatever \c!test +%D % \everydefinewhatever (sets \currentwhatever) +%D % \everypresetwhatever (can be used to reset parameters as we can redefine) +%D % \everysetupwhatever (sets \currentwhatever) +%D +%D \starttext +%D \definewhatever[first] \definewhatever[second][first] +%D test: \def\currentwhatever{first} \whateverparameter{method} \par +%D \setupwhatever [method=unset] test: \def\currentwhatever{first} \whateverparameter{method} \par +%D \setupwhatever[first] [method=first] test: \def\currentwhatever{first} \whateverparameter{method} \par +%D test: \def\currentwhatever{second} \whateverparameter{method} \par +%D \setupwhatever[second][method=second] test: \def\currentwhatever{second} \whateverparameter{method} \par +%D \stoptext +%D \stoptyping + +\unexpanded\def\doinstallparameterhandler#1#2#3#4#5#6#7#8#9% + {\def#3##1{\csname#4{#1#2}{##1}\endcsname}% + \def#4##1##2{\ifcsname##1##2\endcsname##1##2\else\expandafter#5\csname##1\s!parent\endcsname{##2}\fi}% + \def#5##1##2{\ifx##1\relax\s!empty\else#4{##1}{##2}\fi}% + \def#6##1##2{\csname#4{#1##1}{##2}\endcsname}% + \def#7##1{\detokenize\expandafter\expandafter\expandafter{\csname#1##1\endcsname}}% always root + \def#8{\dosetvalue{#1}}% ##1 {##2} (braces are mandate) + \def#9{\doletvalue{#1}}}% ##1 ##2 + +\unexpanded\def\installparameterhandler#1#2% + {%\message{\detokenize{#1}/\detokenize{#2}}% + \normalexpanded + {\doinstallparameterhandler + {\noexpand#1}% \??aa + \expandafter\noexpand\csname current#2\endcsname + \expandafter\noexpand\csname #2parameter\endcsname + \expandafter\noexpand\csname do#2parameter\endcsname + \expandafter\noexpand\csname do#2parentparameter\endcsname + \expandafter\noexpand\csname named#2parameter\endcsname + \expandafter\noexpand\csname detokenized#2parameter\endcsname + \expandafter\noexpand\csname doset#2parameter\endcsname + \expandafter\noexpand\csname dolet#2parameter\endcsname}} + +\unexpanded\def\doinstallparameterhashhandler#1#2#3#4#5% + {\def#3##1{#4{#1#2}{##1}}% + \def#4##1##2{\ifcsname##1##2\endcsname##1\else\expandafter#5\csname##1\s!parent\endcsname{##2}\fi}% + \def#5##1##2{\ifx##1\relax\else#4{##1}{##2}\fi}} + +\unexpanded\def\installparameterhashhandler#1#2% + {\normalexpanded + {\doinstallparameterhashhandler + {\noexpand#1}% \??aa + \expandafter\noexpand\csname current#2\endcsname + \expandafter\noexpand\csname #2parameterhash\endcsname + \expandafter\noexpand\csname do#2parameterhash\endcsname + \expandafter\noexpand\csname do#2parentparameterhash\endcsname}} + + +\unexpanded\def\doinstalldefinehandler#1#2#3#4#5#6#7% + {\unexpanded\def#2{\dotripleempty#5}% + \newtoks#6% + \newtoks#7% + \def#5[##1][##2][##3]% [child][parent][settings] + {\edef#4{##1}% % [child] [settings] + \the#6% predefine % [child][parent] + \ifthirdargument % [child] + \getparameters[#1#4][\s!parent=#1##2,##3]% + \else\ifsecondargument + \doifassignmentelse{##2} + {\getparameters[#1#4][\s!parent=#3,##2]} + {\getparameters[#1#4][\s!parent=#1##2]}% + \else + \getparameters[#1#4][\s!parent=#3]% + \fi\fi + \the#7}} + +\unexpanded\def\installdefinehandler#1#2#3% + {\normalexpanded + {\doinstalldefinehandler + {\noexpand#1}% \??aa + \expandafter\noexpand\csname define#2\endcsname + {\noexpand#3}% root + \expandafter\noexpand\csname current#2\endcsname + \expandafter\noexpand\csname d@define#2\endcsname + \expandafter\noexpand\csname everypreset#2\endcsname + \expandafter\noexpand\csname everydefine#2\endcsname}} + +\unexpanded\def\doinstallsetuphandler#1#2#3#4#5% + {\unexpanded\def#2{\dodoubleempty#4}% + \newtoks#5% + \def#4[##1][##2]% maybe helper + {\ifsecondargument + \def\docommand####1% we will have a simple one as well + {\edef#3{####1}% + \getparameters[#1#3][##2]% + \the#5}% + \processcommalist[##1]\docommand + \else + \let#3\empty + \getparameters[#1][##1]% + \the#5% + \fi}} + +\unexpanded\def\installsetuphandler#1#2% + {\normalexpanded + {\doinstallsetuphandler + {\noexpand#1}% \??aa + \expandafter\noexpand\csname setup#2\endcsname + \expandafter\noexpand\csname current#2\endcsname + \expandafter\noexpand\csname d@setup#2\endcsname + \expandafter\noexpand\csname everysetup#2\endcsname}} + +\unexpanded\def\installcommandhandler#1#2#3% \??self name \??parent (can be \??self) + {\installparameterhandler {#1}{#2}% + \installparameterhashhandler{#1}{#2}% + \installdefinehandler {#1}{#2}{#3}% + \installsetuphandler {#1}{#2}} + +\unexpanded\def\installnamespace#1% + {\setvalue{????#1}{@@@@#1}} + +\protect + diff --git a/Master/texmf-dist/tex/context/base/mult-aux.mkiv b/Master/texmf-dist/tex/context/base/mult-aux.mkiv new file mode 100644 index 00000000000..1dfe6fb8efd --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-aux.mkiv @@ -0,0 +1,269 @@ +%D \module +%D [ file=mult-aux, +%D version=2010.08.2, +%D title=\CONTEXT\ Multilingual Macros, +%D subtitle=helpers, +%D author=Hans Hagen, +%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 A generalization of \MKIV-like inheritance. Just something to play +%D with (interface might change). The code here evolved in an email +%D exchange between me and Wolgang Schuster. + +\writestatus{loading}{ConTeXt Multilingual Macros / Helpers} + +\registerctxluafile{mult-aux}{1.001} + +\unprotect + +%D \starttyping +%D \unprotect +%D \def\????aa{@@@@aa} +%D +%D \installparameterhandler \????aa {whatever} +%D \installsetuphandler \????aa {whatever} +%D \installdefinehandler \????aa {whatever} \????aa % #3 == defaultroot +%D \installattributehandler \????aa {whatever} +%D +%D % \installcommandhandler \????aa {whatever} \????aa +%D \protect +%D +%D % \whateverparameter \c!test +%D % \whateverparameterhash \c!test +%D % \namedwhateverparameter \mycurrentwhatever \c!test +%D % \dosetwhateverattributes \c!style \c!color +%D % \everydefinewhatever (sets \currentwhatever) +%D % \everypresetwhatever (can be used to reset parameters as we can redefine) +%D % \everysetupwhatever (sets \currentwhatever) +%D +%D \starttext +%D \definewhatever[first] \definewhatever[second][first] +%D test: \def\currentwhatever{first} \whateverparameter{method} \par +%D \setupwhatever [method=unset] test: \def\currentwhatever{first} \whateverparameter{method} \par +%D \setupwhatever[first] [method=first] test: \def\currentwhatever{first} \whateverparameter{method} \par +%D test: \def\currentwhatever{second} \whateverparameter{method} \par +%D \setupwhatever[second][method=second] test: \def\currentwhatever{second} \whateverparameter{method} \par +%D \stoptext +%D \stoptyping + +% problem: every* could clash +% +% There can be less {} in the following definitions if we assume \??aa and \c!somecs +% +% todo: \def\detokenized...parameter#1{\detokenize\expandafter\expandafter\expandafter{\csname#1#2\endcsname}} % always root +% +% it might be more efficient to do this at the lua and +% +% watch the push/pop and predefinition of current .. this is needed for nested +% definitions and overloaded defines using the predefined one + +\unexpanded\def\doinstallparameterhandler#1#2#3#4#5#6#7% + {\ifx#2\relax\let#2\empty\fi + \def#3##1{\csname#4{#1#2}{##1}\endcsname}% + \def#4##1##2{\ifcsname##1##2\endcsname##1##2\else\expandafter#5\csname##1\s!parent\endcsname{##2}\fi}% + \def#5##1##2{\ifx##1\relax\s!empty\else#4{##1}{##2}\fi}% + \def#6##1##2{\csname#4{#1##1}{##2}\endcsname}% + \def#7##1{\detokenize\expandafter\expandafter\expandafter{\csname#1##1\endcsname}}} % always root + +\unexpanded\def\installparameterhandler#1#2% + {\normalexpanded + {\doinstallparameterhandler + {\noexpand#1}% \??aa + \expandafter\noexpand\csname current#2\endcsname + \expandafter\noexpand\csname #2parameter\endcsname + \expandafter\noexpand\csname do#2parameter\endcsname + \expandafter\noexpand\csname do#2parentparameter\endcsname + \expandafter\noexpand\csname named#2parameter\endcsname + \expandafter\noexpand\csname detokenized#2parameter\endcsname}} + +\unexpanded\def\doinstallparameterhashhandler#1#2#3#4#5% + {\ifx#2\relax\let#2\empty\fi + \def#3##1{#4{#1#2}{##1}}% + \def#4##1##2{\ifcsname##1##2\endcsname##1\else\expandafter#5\csname##1\s!parent\endcsname{##2}\fi}% + \def#5##1##2{\ifx##1\relax\else#4{##1}{##2}\fi}} + +\unexpanded\def\installparameterhashhandler#1#2% + {\normalexpanded + {\doinstallparameterhashhandler + {\noexpand#1}% \??aa + \expandafter\noexpand\csname current#2\endcsname + \expandafter\noexpand\csname #2parameterhash\endcsname + \expandafter\noexpand\csname do#2parameterhash\endcsname + \expandafter\noexpand\csname do#2parentparameterhash\endcsname}} + +\unexpanded\def\doinstallparametersethandler#1#2#3#4#5% + {\ifx#2\relax\let#2\empty\fi + \def#3{\dosetvalue{#1#2}}% ##1 {##2} (braces are mandate) + \def#4{\doletvalue{#1#2}}% ##1 ##2 + \def#5{\doletvalue{#1#2}\empty}}% ##1 + +\unexpanded\def\installparametersethandler#1#2% + {\normalexpanded + {\doinstallparametersethandler + {\noexpand#1}% \??aa + \expandafter\noexpand\csname current#2\endcsname + \expandafter\noexpand\csname set#2parameter\endcsname + \expandafter\noexpand\csname let#2parameter\endcsname + \expandafter\noexpand\csname reset#2parameter\endcsname}} + +\unexpanded\def\doinstallattributehandler#1#2#3% #1 not used here + {\def#2##1##2% style color + {\edef\fontattributehash {#3{##1}}% + \edef\colorattributehash{#3{##2}}% + \ifx\fontattributehash \empty\else\dosetfontattribute \fontattributehash {##1}\fi + \ifx\colorattributehash\empty\else\dosetcolorattribute\colorattributehash{##2}\fi}} + +\unexpanded\def\installattributehandler#1#2% + {\normalexpanded + {\doinstallattributehandler + {\noexpand#1}% \??aa + \expandafter\noexpand\csname doset#2attributes\endcsname + \expandafter\noexpand\csname #2parameterhash\endcsname}} + +\let\definehandlerparent\empty + +\unexpanded\def\doinstalldefinehandler#1#2#3#4#5#6#7#8% + {\ifx#4\relax\let#4\empty\fi + \unexpanded\def#2{\dotripleempty#5}% + \newtoks#6% + \newtoks#7% + \def#5[##1][##2][##3]% [child][parent][settings] | [child][settings] | [child][parent] | [child] + {\let\saveddefinewhatever#4% + \edef#4{##1}% + \the#6% predefine + \ifthirdargument + \edef#8{##2}% + \getparameters[#1#4][\s!parent=#1##2,##3]% + \else\ifsecondargument + \doifassignmentelse{##2} + {\let#8\empty + \getparameters[#1#4][\s!parent=#3,##2]} + {\edef#8{##2}% + \getparameters[#1#4][\s!parent=#1##2]}% + \else + \let#8\empty + \getparameters[#1#4][\s!parent=#3]% + \fi\fi + \the#7% + \let#4\saveddefinewhatever}} + +\unexpanded\def\installdefinehandler#1#2#3% + {\normalexpanded + {\doinstalldefinehandler + {\noexpand#1}% \??aa + \expandafter\noexpand\csname define#2\endcsname + {\noexpand#3}% root + \expandafter\noexpand\csname current#2\endcsname + \expandafter\noexpand\csname d@define#2\endcsname + \expandafter\noexpand\csname everypreset#2\endcsname + \expandafter\noexpand\csname everydefine#2\endcsname + \expandafter\noexpand\csname current#2parent\endcsname}} + +\unexpanded\def\doinstallsetuphandler#1#2#3#4#5#6% + {\ifx#3\relax\let#3\empty\fi + \unexpanded\def#2{\dodoubleempty#4}% + \unexpanded\def#6{\getparameters[#1#3]}% + \newtoks#5% + \def#4[##1][##2]% maybe helper + {\let\savedsetupwhatever#3% + \ifsecondargument + \def\docommand####1% we will have a simple one as well + {\edef#3{####1}% + \getparameters[#1#3][##2]% + \the#5}% + \processcommalist[##1]\docommand + \else + \let#3\empty + \getparameters[#1][##1]% + \the#5% + \fi + \let#3\savedsetupwhatever}} + +\unexpanded\def\installsetuphandler#1#2% + {\normalexpanded + {\doinstallsetuphandler + {\noexpand#1}% \??aa + \expandafter\noexpand\csname setup#2\endcsname + \expandafter\noexpand\csname current#2\endcsname + \expandafter\noexpand\csname d@setup#2\endcsname + \expandafter\noexpand\csname everysetup#2\endcsname + \expandafter\noexpand\csname setupcurrent#2\endcsname}} + +\unexpanded\def\installcommandhandler#1#2#3% \??self name \??parent (can be \??self) + {\installparameterhandler {#1}{#2}% + \installparameterhashhandler{#1}{#2}% + \installparametersethandler {#1}{#2}% + \installdefinehandler {#1}{#2}{#3}% + \installsetuphandler {#1}{#2}% + \installattributehandler {#1}{#2}} + +\unexpanded\def\installnamespace#1% + {\setvalue{????#1}{@@@@#1}} + +% \enabletrackers[interfaces.namespaces,context.flush] +% +% \definenamespace +% [xy] +% [type=module, +% comment=test module, +% version=1, +% name=test, +% style=yes, +% command=yes, +% setup=list, +% set=yes, +% parent=xy] +% +% \unprotect +% \getparameters +% [\????xy] +% [text=] +% \protect +% +% \definetest[one] +% +% \starttext +% +% “\testparameter{text}” +% +% \setuptest[text=foo] +% +% “\testparameter{text}” +% +% \setuptest[one][text=bar] +% +% “\testparameter{text}” +% +% \stoptext + +\unexpanded\def\definenamespace + {\dodoubleargument\dodefinenamespace} + +\def\dodefinenamespace[#1][#2]% namespace settings + {\ctxlua{interfaces.namespaces.define(\!!bs#1\!!es,\!!bs#2\!!es)}} + +\def\listnamespaces + {\ctxlua{interfaces.namespaces.list()}} + +%D Helper: +%D +%D \starttyping +%D \showparentchain{@@am}{left} +%D \stoptyping + +\def\doshowparentchain#1% + {#1 => % + \ifcsname#1\s!parent\endcsname + \expandafter\doshowparentchain\csname#1\s!parent\endcsname + \fi} + +\def\showparentchain#1#2% + {\writestatus\m!system{chain: [ \doshowparentchain{#1#2}]}} + +\protect + diff --git a/Master/texmf-dist/tex/context/base/mult-chk.lua b/Master/texmf-dist/tex/context/base/mult-chk.lua index bdbd1dd22f9..4b1ba12ee3e 100644 --- a/Master/texmf-dist/tex/context/base/mult-chk.lua +++ b/Master/texmf-dist/tex/context/base/mult-chk.lua @@ -10,57 +10,64 @@ local format = string.format local lpegmatch = lpeg.match local type = type local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes +local make_settings_to_hash_pattern, settings_to_set = utilities.parsers.make_settings_to_hash_pattern, utilities.parsers.settings_to_set + +local allocate = utilities.storage.allocate + +local report_interface = logs.reporter("interface","checking") interfaces = interfaces or { } -interfaces.syntax = { +interfaces.syntax = allocate { test = { keys = table.tohash { "a","b","c","d","e","f","g" } } } -function interfaces.invalidkey(kind,key) - commands.writestatus("syntax","invalid key '%s' for '%s' in line %s",key,kind,tex.inputlineno) +function interfaces.invalidkey(category,key) + report_interface("invalid key '%s' for '%s' in line %s",key,category,tex.inputlineno) end -function interfaces.setvalidkeys(kind,list) - local s = interfaces.syntax[kind] +function interfaces.setvalidkeys(category,list) + local s = interfaces.syntax[category] if not s then - interfaces.syntax[kind] = { - keys = aux.settings_to_set(list) + interfaces.syntax[category] = { + keys = settings_to_set(list) } else - s.keys = aux.settings_to_set(list) + s.keys = settings_to_set(list) end end -function interfaces.addvalidkeys(kind,list) - local s = interfaces.syntax[kind] +function interfaces.addvalidkeys(category,list) + local s = interfaces.syntax[category] if not s then - interfaces.syntax[kind] = { - keys = aux.settings_to_set(list) + interfaces.syntax[category] = { + keys = settings_to_set(list) } else - aux.settings_to_set(list,s.keys) + settings_to_set(list,s.keys) end end -local prefix, kind, keys +-- weird code, looks incomplete ... probbably an experiment + +local prefix, category, keys local function set(key,value) if keys and not keys[key] then - interfaces.invalidkey(kind,key) + interfaces.invalidkey(category,key) else - texsprint(ctxcatcodes,format("\\setsomevalue{%s}{%s}{%s}",prefix,key,value)) + context.setsomevalue(prefix,key,value) end end -local pattern = aux.make_settings_to_hash_pattern(set,"tolerant") +local pattern = make_settings_to_hash_pattern(set,"tolerant") -function commands.getcheckedparameters(k,p,s) +function interfaces.getcheckedparameters(k,p,s) if s and s ~= "" then - prefix, kind = p, k + prefix, category = p, k keys = k and k ~= "" and interfaces.syntax[k].keys lpegmatch(pattern,s) end end -_gcp_ = commands.getcheckedparameters +-- _igcp_ = interfaces.getcheckedparameters diff --git a/Master/texmf-dist/tex/context/base/mult-chk.mkiv b/Master/texmf-dist/tex/context/base/mult-chk.mkiv index 7b40bd64a69..cf38daf6700 100644 --- a/Master/texmf-dist/tex/context/base/mult-chk.mkiv +++ b/Master/texmf-dist/tex/context/base/mult-chk.mkiv @@ -50,7 +50,8 @@ \fi{#1}{#3}#5} \def\dogetcheckedparametersyes#1#2#3]% - {\ctxlua{_gcp_("#1","#2",\!!bs\detokenize{#3}\!!es)}} + %{\ctxlua{_igcp_("#1","#2",\!!bs\detokenize{#3}\!!es)}} + {\ctxlua{interfaces.getcheckedparameters("#1","#2",\!!bs\detokenize{#3}\!!es)}} \def\getcheckedparametersnop[#1]#2[#3]#4[#5% {\if\noexpand#5]% diff --git a/Master/texmf-dist/tex/context/base/mult-cld.lua b/Master/texmf-dist/tex/context/base/mult-cld.lua deleted file mode 100644 index 81038b68b51..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-cld.lua +++ /dev/null @@ -1,212 +0,0 @@ -if not modules then modules = { } end modules ['mult-cld'] = { - version = 1.001, - comment = "companion to mult-cld.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- This is an experiment: generating context code at the lua end. After all --- it is surprisingly simple to implement due to metatables. I was wondering --- if there was a more natural way to deal with commands at the lua end. --- Of course it's a bit slower but often more readable when mixed with lua --- code. It can also be handy when generating documents from databases or --- when constructing large tables or so. --- --- Todo: optional checking against interface --- Todo: coroutine trickery - -context = context or { } - -local format, concat = string.format, table.concat -local next, type = next, type -local texsprint, texiowrite, ctxcatcodes = tex.sprint, texio.write, tex.ctxcatcodes - -local flush = texsprint or function(cct,...) print(table.concat{...}) end - -local _stack_, _n_ = { }, 0 - -local function _store_(ti) - _n_ = _n_ + 1 - _stack_[_n_] = ti - return _n_ -end - -local function _flush_(n) - if not _stack_[n]() then - _stack_[n] = nil - else - -- keep, beware, that way the stack can grow - end -end - -context._stack_ = _stack_ -context._store_ = _store_ -context._flush_ = _flush_ - -function tex.fprint(...) -- goodie - texsprint(ctxcatcodes,format(...)) -end - -function context.trace(intercept) - local normalflush = flush - flush = function(c,...) - logs.report("context",concat({...})) - if not intercept then - normalflush(c,...) - end - end - context.trace = function() end -end - -trackers.register("context.flush", function(v) if v then context.trace() end end) -trackers.register("context.intercept", function(v) if v then context.trace(true) end end) - -local function writer(k,...) - if k then - flush(ctxcatcodes,k) - local t = { ... } - local nt = #t - if nt > 0 then - for i=1,nt do - local ti = t[i] - local typ = type(ti) - if ti == nil then - -- next - elseif typ == "function" then - flush(ctxcatcodes,"{\\mkivflush{" .. _store_(ti) .. "}}") - elseif typ == "string" or typ == "number" then - flush(ctxcatcodes,"{",ti,"}") - elseif typ == "table" then - local tn = #ti - if tn > 0 then - for j=1,tn do - local tj = ti[j] - if type(tj) == "function" then - ti[j] = "\\mkivflush{" .. _store_(tj) .. "}" - end - end - flush(ctxcatcodes,"[",concat(ti,","),"]") - else - flush(ctxcatcodes,"[") - local done = false - for k, v in next, ti do - if done then - flush(ctxcatcodes,",",k,'=',v) - else - flush(ctxcatcodes,k,'=',v) - done = true - end - end - flush(ctxcatcodes,"]") - end - -- elseif typ == "boolean" then - -- flush(ctxcatcodes,"\n") - elseif ti == true then - flush(ctxcatcodes,"\n") - elseif typ == false then - -- if force == "direct" then - flush(ctxcatcodes,tostring(ti)) - -- end - elseif typ == "thread" then - logs.report("interfaces","coroutines not supported as we cannot yeild across boundaries") - else - logs.report("interfaces","error: %s gets a weird argument %s",k,tostring(ti)) - end - end - end - end -end - --- -- -- - -local function indexer(t,k) - local c = "\\" .. k .. " " - local f = function(...) return writer(c,...) end - t[k] = f - return f -end - -local function caller(t,f,a,...) - if a then - flush(ctxcatcodes,format(f,a,...)) - elseif type(f) == "function" then - flush(ctxcatcodes,"{\\mkivflush{" .. _store_(f) .. "}}") - elseif f then - flush(ctxcatcodes,f) - else - flush(ctxcatcodes,"\n") - end -end - -setmetatable(context, { __index = indexer, __call = caller } ) - --- the only non macro: - -local trace_cld = false - -function context.runfile(filename) - filename = resolvers.findtexfile(filename) or "" - if filename ~= "" then - local ok = dofile(filename) - if type(ok) == "function" then - if trace_cld then - commands.writestatus("cld","begin of file '%s' (function call)",filename) - end - ok() - if trace_cld then - commands.writestatus("cld","end of file '%s' (function call)",filename) - end - elseif ok then - commands.writestatus("cld","file '%s' is processed and returns true",filename) - else - commands.writestatus("cld","file '%s' is processed and returns nothing",filename) - end - else - commands.writestatus("cld","unknown file '%s'",filename) - end -end - --- tracking is using the regular mechanism; we need to define --- these 'macro' functions explictly as otherwise they are are --- delayed (as all commands print back to tex, so that tracing --- would be enabled afterwards) - -trackers.register("cld.print", function(v) - trace_cld = v - if v then - flush = function(c,...) - texiowrite(...) - texsprint(c,...) - end - else - flush = texsprint - end -end) - -function context.enabletrackers (str) trackers.enable (str) end -function context.disabletrackers(str) trackers.disable(str) end - --- see demo-cld.cld for an example - --- context.starttext(true) --- context.chapter({ "label" }, "title", true) --- context.chapter(function() return { "label" } end, "title", true) --- --- context.startchapter({ title = "test" }, { more = "oeps" }, true) --- --- context.bTABLE(true) --- for i=1,10 do --- context.bTR() --- for i=1,10 do --- context.bTD() --- context("%#2i",math.random(99)) --- context.eTD() --- end --- context.eTR(true) --- end --- context.eTABLE(true) --- --- context.stopchapter(true) --- --- context.stoptext(true) diff --git a/Master/texmf-dist/tex/context/base/mult-cld.mkiv b/Master/texmf-dist/tex/context/base/mult-cld.mkiv deleted file mode 100644 index 1c5ebd34af3..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-cld.mkiv +++ /dev/null @@ -1,29 +0,0 @@ -%D \module -%D [ file=mult-ini, -%D version=2008.10.22, % 1996.06.01, -%D title=\CONTEXT\ Multilingual 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. - -%D This is just an idea, maybe a bad one. - -\writestatus{loading}{ConTeXt Multilingual Macros / Lua} - -\registerctxluafile{mult-cld}{1.001} -\registerctxluafile{mult-clm}{1.001} - -\unprotect - -\def\defmkivstart#1{\unexpanded\expandafter\def\csname\e!start#1\endcsname} -\def\defmkivstop #1{\unexpanded\def\csname\e!stop #1\endcsname} -\def\defmkiv #1{\unexpanded\def\csname #1\endcsname} - -\def\mkivflush #1{\ctxlua{context._flush_(#1)}} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/mult-clm.lua b/Master/texmf-dist/tex/context/base/mult-clm.lua deleted file mode 100644 index 8838ea532d5..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-clm.lua +++ /dev/null @@ -1,184 +0,0 @@ -if not modules then modules = { } end modules ['mult-clm'] = { - version = 1.001, - comment = "companion to mult-clm.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- another experiment --- todo: multilingual - -local texsprint, ctxcatcodes, vrbcatcodes = tex.sprint, tex.ctxcatcodes, tex.vrbcatcodes -local format, insert, remove, concat = string.format, table.insert, table.remove, table.concat -local unpack = unpack or table.unpack - -local trace_define = false trackers.register("context.define", function(v) trace_define = v end) - -mkiv = mkiv or { } - -mkiv.h, mkiv.a = aux.settings_to_hash, aux.settings_to_array - -local starters, stoppers, macros, stack = { }, { }, { }, { } - -local checkers = { - "\\dosingleempty", - "\\dodoubleempty", - "\\dotripleempty", - "\\doquadrupleempty", - "\\doquintupleempty", - "\\dosixtupleempty", -} - -function mkiv.m(name,...) - macros[name](...) -end - -function mkiv.b(name,...) - local sn = stack[name] - insert(sn,{...}) - starters[name](...) -end - -function mkiv.e(name) - local sn = stack[name] - local sv = remove(sn) - if sv then - stoppers[name](unpack(sv)) - else - -- nesting error - end -end - -mkiv.n = tonumber - -function mkiv.define(name,specification) -- name is optional - if type(name) == "table" then - specification = name - name = specification.name - end - if name and specification then - local arguments = specification.arguments - local na = (arguments and #arguments) or 0 - local environment = specification.environment - if na == 0 then - if environment then - texsprint(ctxcatcodes,"\\defmkstart{",name,"}{\\ctxlua{mkiv.b('",name,"')}}") - texsprint(ctxcatcodes,"\\defmkstop{", name,"}{\\ctxlua{mkiv.b('",name,"')}}") - else - texsprint(ctxcatcodes,"\\defmkiv{", name,"}{\\ctxlua{mkiv.m('",name,"')}}") - end - else - stack[name] = { } - local opt, done = 0, false - local mkivdo = "\\mkivdo" .. name - texsprint(ctxcatcodes,"\\def",mkivdo) - for i=1,na do - local a = arguments[i] - local kind = a[1] - if kind == "option" then - texsprint(ctxcatcodes,"[#",i,"]") - if not done then - opt = opt + 1 - end - else - done = true -- no more optional checking after this - texsprint(ctxcatcodes,"#",i) - end - end - if environment then - texsprint(ctxcatcodes,"{\\ctxlua{mkiv.b('",name,"'") - else - texsprint(ctxcatcodes,"{\\ctxlua{mkiv.m('",name,"'") - end - for i=1,na do - local a = arguments[i] - local kind = a[2] - if kind == "list" then - texsprint(ctxcatcodes,",mkiv.a([[#",i,"]])") - elseif kind == "hash" then - texsprint(ctxcatcodes,",mkiv.h([[#",i,"]])") - elseif kind == "number" then - texsprint(ctxcatcodes,",mkiv.n([[#",i,"]])") - else - texsprint(ctxcatcodes,",[[#",i,"]]") - end - end - texsprint(ctxcatcodes,")}}") - if environment then - texsprint(ctxcatcodes,"\\defmkivstop{" ,name,"}{\\ctxlua{mkiv.e('",name,"')}}") - texsprint(ctxcatcodes,"\\defmkivstart{",name,"}{",checkers[opt],mkivdo,"}") - else - texsprint(ctxcatcodes,"\\defmkiv{", name,"}{",checkers[opt],mkivdo,"}") - end - end - if environment then - starters[name] = specification.starter - stoppers[name] = specification.stopper - else - macros[name] = specification.macro - end - end -end - -function mkiv.tolist(t) - local r = { } - for i=1,#t do - r[i] = t[i] - end - for k,v in table.sortedhash(t) do - if type(k) ~= "number" then - r[#r+1] = k .. "=" .. v - end - end - return concat(r,", ") -end - ---~ \startluacode ---~ function test(opt_1, opt_2, arg_1) ---~ context.startnarrower() ---~ context("options 1: %s",mkiv.tolist(opt_1)) ---~ context.par() ---~ context("options 2: %s",mkiv.tolist(opt_2)) ---~ context.par() ---~ context("argument 1: %s",arg_1) ---~ context.stopnarrower() ---~ end - ---~ mkiv.define { ---~ name = "test", ---~ arguments = { ---~ { "option", "list" }, ---~ { "option", "hash" }, ---~ { "content", "string" }, ---~ }, ---~ macro = test, ---~ } ---~ \stopluacode - ---~ test: \test[1][a=3]{whatever} - ---~ \startluacode ---~ local function startmore(opt_1) ---~ context.startnarrower() ---~ context("start more, options: %s",mkiv.tolist(opt_1)) ---~ context.startnarrower() ---~ end - ---~ local function stopmore(opt_1) ---~ context.stopnarrower() ---~ context("stop more, options: %s",mkiv.tolist(opt_1)) ---~ context.stopnarrower() ---~ end - ---~ mkiv.define ( "more", { ---~ environment = true, ---~ arguments = { ---~ { "option", "list" }, ---~ }, ---~ starter = startmore, ---~ stopper = stopmore, ---~ } ) ---~ \stopluacode - ---~ more: \startmore[1] one \startmore[2] two \stopmore one \stopmore diff --git a/Master/texmf-dist/tex/context/base/mult-com.mkii b/Master/texmf-dist/tex/context/base/mult-com.mkii new file mode 100644 index 00000000000..1186168377b --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-com.mkii @@ -0,0 +1,31 @@ +%D \module +%D [ file=mult-com, +%D version=1996.06.01, +%D title=\CONTEXT\ Multilingual Macros, +%D subtitle=Commands, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See licen-en.pdf for +%C details. + +%D This file has been replaced by \type {mult-def.lua} from which we +%D generate separate interface definition files. + +% obsolete: +% +% \startcommands dutch english +% german czech +% italian romanian +% french +% +% language: taal language +% sprache jazyk +% lingua limba +% langue +% +% \stopcommands + +\endinput diff --git a/Master/texmf-dist/tex/context/base/mult-com.tex b/Master/texmf-dist/tex/context/base/mult-com.tex deleted file mode 100644 index 1186168377b..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-com.tex +++ /dev/null @@ -1,31 +0,0 @@ -%D \module -%D [ file=mult-com, -%D version=1996.06.01, -%D title=\CONTEXT\ Multilingual Macros, -%D subtitle=Commands, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See licen-en.pdf for -%C details. - -%D This file has been replaced by \type {mult-def.lua} from which we -%D generate separate interface definition files. - -% obsolete: -% -% \startcommands dutch english -% german czech -% italian romanian -% french -% -% language: taal language -% sprache jazyk -% lingua limba -% langue -% -% \stopcommands - -\endinput diff --git a/Master/texmf-dist/tex/context/base/mult-con.mkii b/Master/texmf-dist/tex/context/base/mult-con.mkii new file mode 100644 index 00000000000..62e97d5671a --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-con.mkii @@ -0,0 +1,53 @@ +%D \module +%D [ file=mult-con, +%D version=2000.09.12, +%D title=\CONTEXT\ Multilingual Macros, +%D subtitle=Constants, +%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 file has been replaced by \type {mult-def.lua} from which we +%D generate separate interface definition files. + +% obsolete: +% +% +% \startvariables dutch english +% german czech +% italian romanian +% french +% +% one: een one +% eins jedna +% uno unu +% un +% \stopvariables +% +% \startconstants dutch english +% german czech +% italian romanian +% french +% +% sorttype: sortering sorttype +% sorttype sorttype +% sorttype sorttype +% sorttype +% \stopconstants +% +% \startelements dutch english +% german czech +% italian romanian +% french +% +% begin: beginvan begin +% anfang zacatek +% inizio inceput +% debut +% \stopelements + +\endinput diff --git a/Master/texmf-dist/tex/context/base/mult-con.tex b/Master/texmf-dist/tex/context/base/mult-con.tex deleted file mode 100644 index 62e97d5671a..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-con.tex +++ /dev/null @@ -1,53 +0,0 @@ -%D \module -%D [ file=mult-con, -%D version=2000.09.12, -%D title=\CONTEXT\ Multilingual Macros, -%D subtitle=Constants, -%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 file has been replaced by \type {mult-def.lua} from which we -%D generate separate interface definition files. - -% obsolete: -% -% -% \startvariables dutch english -% german czech -% italian romanian -% french -% -% one: een one -% eins jedna -% uno unu -% un -% \stopvariables -% -% \startconstants dutch english -% german czech -% italian romanian -% french -% -% sorttype: sortering sorttype -% sorttype sorttype -% sorttype sorttype -% sorttype -% \stopconstants -% -% \startelements dutch english -% german czech -% italian romanian -% french -% -% begin: beginvan begin -% anfang zacatek -% inizio inceput -% debut -% \stopelements - -\endinput diff --git a/Master/texmf-dist/tex/context/base/mult-de.mkii b/Master/texmf-dist/tex/context/base/mult-de.mkii new file mode 100644 index 00000000000..6d6b04dcaf0 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-de.mkii @@ -0,0 +1,1715 @@ +% this file is auto-generated, don't edit this file +% +% definitions for interface variables for language de +% +\setinterfacevariable{Addition}{Zusatz} +\setinterfacevariable{Balloon}{Ballon} +\setinterfacevariable{Character}{Buchstabe} +\setinterfacevariable{Characters}{Buchstaben} +\setinterfacevariable{CloseDocument}{SchliesseDokument} +\setinterfacevariable{ExitViewer}{BeendeViewer} +\setinterfacevariable{FirstPage}{ErsteSeite} +\setinterfacevariable{FitHeight}{HoehePassend} +\setinterfacevariable{FitWidth}{BreitePassend} +\setinterfacevariable{GotoPage}{GotoPage} +\setinterfacevariable{Greek}{Griechisch} +\setinterfacevariable{Help}{Hilfe} +\setinterfacevariable{HideField}{VerbergeFeld} +\setinterfacevariable{HideLayer}{HideLayer} +\setinterfacevariable{Key}{Schluessel} +\setinterfacevariable{LastPage}{LetzteSeite} +\setinterfacevariable{LoadForm}{LadeFormular} +\setinterfacevariable{MONTH}{MONAT} +\setinterfacevariable{New}{Neu} +\setinterfacevariable{NextJump}{NaechsterSprung} +\setinterfacevariable{NextPage}{FolgendeSeite} +\setinterfacevariable{Numbers}{Ziffern} +\setinterfacevariable{OpenNamedDocument}{OpenNamedDocument} +\setinterfacevariable{Paragraph}{Absatz} +\setinterfacevariable{PauseMovie}{PauseFilm} +\setinterfacevariable{PauseRendering}{PauseRendering} +\setinterfacevariable{PauseSound}{PauseSound} +\setinterfacevariable{PreviousJump}{VorigerSprung} +\setinterfacevariable{PreviousPage}{VorigeSeite} +\setinterfacevariable{PrintDocument}{DruckeDokument} +\setinterfacevariable{Query}{Query} +\setinterfacevariable{QueryAgain}{QueryAgain} +\setinterfacevariable{ResetForm}{ZuruecksetzenFormular} +\setinterfacevariable{ResumeMovie}{FortsetzenFilm} +\setinterfacevariable{ResumeRendering}{ResumeRendering} +\setinterfacevariable{ResumeSound}{ResumeSound} +\setinterfacevariable{Romannumerals}{Roemischezahlen} +\setinterfacevariable{SaveDocument}{SpeichereDokument} +\setinterfacevariable{SaveForm}{SpeicheFormular} +\setinterfacevariable{SaveNamedDocument}{SaveNamedDocument} +\setinterfacevariable{SearchAgain}{WeiterSuchen} +\setinterfacevariable{SearchDocument}{DokumentDurchsuchen} +\setinterfacevariable{ShowBookmarks}{ShowBookmarks} +\setinterfacevariable{ShowField}{ZeigeFeld} +\setinterfacevariable{ShowThumbs}{ShowThumbs} +\setinterfacevariable{StartMovie}{StartFilm} +\setinterfacevariable{StartRendering}{StartRendering} +\setinterfacevariable{StartSound}{StartSound} +\setinterfacevariable{StopMovie}{StopFilm} +\setinterfacevariable{StopRendering}{StopRendering} +\setinterfacevariable{StopSound}{StopSound} +\setinterfacevariable{SubmitForm}{VersendeFormular} +\setinterfacevariable{ToggleLayer}{ToggleLayer} +\setinterfacevariable{ToggleViewer}{WechseleViewer} +\setinterfacevariable{URL}{URL} +\setinterfacevariable{VideLayer}{VideLayer} +\setinterfacevariable{ViewerHelp}{ViewerHilfe} +\setinterfacevariable{WEEKDAY}{WOCHENTAG} +\setinterfacevariable{WORD}{WORT} +\setinterfacevariable{abbreviation}{abkuerzung} +\setinterfacevariable{abbreviations}{abkuerzungen} +\setinterfacevariable{absolute}{absolut} +\setinterfacevariable{action}{aktion} +\setinterfacevariable{after}{nach} +\setinterfacevariable{all}{alles} +\setinterfacevariable{always}{immer} +\setinterfacevariable{and}{und} +\setinterfacevariable{answerarea}{answerarea} +\setinterfacevariable{appendices}{anhaenge} +\setinterfacevariable{appendix}{anhang} +\setinterfacevariable{april}{April} +\setinterfacevariable{atmargin}{amrand} +\setinterfacevariable{atpage}{aufseite} +\setinterfacevariable{attachment}{attachment} +\setinterfacevariable{august}{August} +\setinterfacevariable{author}{autor} +\setinterfacevariable{auto}{auto} +\setinterfacevariable{autointro}{autointro} +\setinterfacevariable{back}{zurueck} +\setinterfacevariable{background}{hintergrund} +\setinterfacevariable{backmatter}{epiloge} +\setinterfacevariable{backpart}{epilog} +\setinterfacevariable{backspace}{rumpfspatium} +\setinterfacevariable{backward}{rueckwaerts} +\setinterfacevariable{bbl}{bbl} +\setinterfacevariable{before}{vor} +\setinterfacevariable{begin}{begin} +\setinterfacevariable{bib}{bib} +\setinterfacevariable{big}{gross} +\setinterfacevariable{bigbodyfont}{bigbodyfont} +\setinterfacevariable{bigger}{bigger} +\setinterfacevariable{bigpreference}{grosszuegig} +\setinterfacevariable{blank}{blanko} +\setinterfacevariable{blockquote}{blockquote} +\setinterfacevariable{bodymatter}{haupttexte} +\setinterfacevariable{bodypart}{haupttext} +\setinterfacevariable{bold}{fett} +\setinterfacevariable{bolditalic}{fettitalic} +\setinterfacevariable{boldslanted}{fettgeneigt} +\setinterfacevariable{bookmark}{bookmark} +\setinterfacevariable{both}{beide} +\setinterfacevariable{bottom}{unten} +\setinterfacevariable{brief}{brief} +\setinterfacevariable{broad}{breit} +\setinterfacevariable{buffer}{puffer} +\setinterfacevariable{by}{pro} +\setinterfacevariable{calligraphic}{kalligraphie} +\setinterfacevariable{cap}{kap} +\setinterfacevariable{capital}{versalien} +\setinterfacevariable{center}{center} +\setinterfacevariable{chapter}{kapitel} +\setinterfacevariable{character}{buchstabe} +\setinterfacevariable{characters}{buchstaben} +\setinterfacevariable{cite}{cite} +\setinterfacevariable{color}{farbe} +\setinterfacevariable{column}{column} +\setinterfacevariable{columns}{spalten} +\setinterfacevariable{command}{befehl} +\setinterfacevariable{commands}{befehle} +\setinterfacevariable{comment}{kommentar} +\setinterfacevariable{component}{komponente} +\setinterfacevariable{concept}{konzept} +\setinterfacevariable{content}{inhalt} +\setinterfacevariable{contents}{inhalte} +\setinterfacevariable{continue}{fortsetzten} +\setinterfacevariable{continued}{continued} +\setinterfacevariable{controls}{controls} +\setinterfacevariable{conversion}{konversion} +\setinterfacevariable{current}{aktuell} +\setinterfacevariable{cutspace}{cutspace} +\setinterfacevariable{date}{datum} +\setinterfacevariable{day}{tag} +\setinterfacevariable{december}{Dezember} +\setinterfacevariable{default}{default} +\setinterfacevariable{depth}{tiefe} +\setinterfacevariable{description}{beschreibung} +\setinterfacevariable{disable}{sperren} +\setinterfacevariable{display}{bildschirm} +\setinterfacevariable{dot}{punkt} +\setinterfacevariable{doublesided}{doppelseitig} +\setinterfacevariable{down}{down} +\setinterfacevariable{each}{jede} +\setinterfacevariable{edge}{kante} +\setinterfacevariable{embed}{embed} +\setinterfacevariable{empty}{leer} +\setinterfacevariable{end}{end} +\setinterfacevariable{endnote}{endnote} +\setinterfacevariable{enumeration}{nummerierung} +\setinterfacevariable{environment}{umgebung} +\setinterfacevariable{even}{gerade} +\setinterfacevariable{external}{extern} +\setinterfacevariable{fact}{gegeben} +\setinterfacevariable{february}{Februar} +\setinterfacevariable{figure}{abbildung} +\setinterfacevariable{figures}{abbildungen} +\setinterfacevariable{file}{datei} +\setinterfacevariable{final}{endfassung} +\setinterfacevariable{first}{erste} +\setinterfacevariable{firstcolumn}{firstcolumn} +\setinterfacevariable{firstpage}{ersteseite} +\setinterfacevariable{firstsubpage}{ersteunterseite} +\setinterfacevariable{fit}{passend} +\setinterfacevariable{five}{fuenf} +\setinterfacevariable{fix}{stellewiederher} +\setinterfacevariable{fixed}{fest} +\setinterfacevariable{flexible}{flexibel} +\setinterfacevariable{float}{gleitobjekt} +\setinterfacevariable{flushinner}{flushinner} +\setinterfacevariable{flushleft}{flushleft} +\setinterfacevariable{flushouter}{flushouter} +\setinterfacevariable{flushright}{flushright} +\setinterfacevariable{footer}{fusszeile} +\setinterfacevariable{footnote}{fussnote} +\setinterfacevariable{force}{zwinge} +\setinterfacevariable{foreground}{vordergrund} +\setinterfacevariable{formeel}{formeel} +\setinterfacevariable{formula}{formel} +\setinterfacevariable{formulae}{formeln} +\setinterfacevariable{forward}{vorwaerts} +\setinterfacevariable{four}{vier} +\setinterfacevariable{frame}{rahmen} +\setinterfacevariable{framedtext}{umrahmtertext} +\setinterfacevariable{friday}{freitag} +\setinterfacevariable{frontmatter}{einleitungen} +\setinterfacevariable{frontpart}{einleitung} +\setinterfacevariable{global}{global} +\setinterfacevariable{graphic}{grafik} +\setinterfacevariable{graphics}{grafiken} +\setinterfacevariable{gray}{grau} +\setinterfacevariable{greek}{griechisch} +\setinterfacevariable{grid}{gritter} +\setinterfacevariable{halfline}{halbezeile} +\setinterfacevariable{handwritten}{handschrift} +\setinterfacevariable{hang}{haengend} +\setinterfacevariable{hanging}{haengend} +\setinterfacevariable{head}{kopf} +\setinterfacevariable{header}{kopfzeile} +\setinterfacevariable{height}{hoehe} +\setinterfacevariable{helptext}{hilfetext} +\setinterfacevariable{hencefore}{vorher} +\setinterfacevariable{here}{hier} +\setinterfacevariable{hereafter}{nachher} +\setinterfacevariable{hidden}{versteckt} +\setinterfacevariable{hiding}{verbergen} +\setinterfacevariable{high}{hoch} +\setinterfacevariable{horizontal}{horizontal} +\setinterfacevariable{hyphenated}{hyphenate} +\setinterfacevariable{hz}{hz} +\setinterfacevariable{inbetween}{zwischen} +\setinterfacevariable{index}{index} +\setinterfacevariable{indices}{indizies} +\setinterfacevariable{informeel}{informeel} +\setinterfacevariable{inherit}{inherit} +\setinterfacevariable{inleft}{imlinken} +\setinterfacevariable{inmargin}{imrand} +\setinterfacevariable{inner}{innen} +\setinterfacevariable{inneredge}{inneredge} +\setinterfacevariable{innermargin}{innermargin} +\setinterfacevariable{inright}{imrechten} +\setinterfacevariable{interaction}{interaktion} +\setinterfacevariable{interactionmenu}{interaktionsmenue} +\setinterfacevariable{intermezzi}{intermezzi} +\setinterfacevariable{intermezzo}{intermezzo} +\setinterfacevariable{intext}{imtext} +\setinterfacevariable{intro}{intro} +\setinterfacevariable{italic}{italic} +\setinterfacevariable{italicbold}{italicfett} +\setinterfacevariable{item}{pos} +\setinterfacevariable{itemize}{aufzaehlung} +\setinterfacevariable{its}{its} +\setinterfacevariable{january}{Januar} +\setinterfacevariable{joinedup}{keinabstand} +\setinterfacevariable{july}{Juli} +\setinterfacevariable{june}{Juni} +\setinterfacevariable{keep}{behalte} +\setinterfacevariable{knockout}{knockout} +\setinterfacevariable{label}{label} +\setinterfacevariable{landscape}{querformat} +\setinterfacevariable{last}{letzte} +\setinterfacevariable{lastcolumn}{lastcolumn} +\setinterfacevariable{lastpage}{letzteseite} +\setinterfacevariable{lastpagenumber}{lastpagenumber} +\setinterfacevariable{lastsubpage}{letzteunterseite} +\setinterfacevariable{layer}{layer} +\setinterfacevariable{left}{links} +\setinterfacevariable{leftedge}{linkekante} +\setinterfacevariable{lefthanging}{lefthanging} +\setinterfacevariable{leftmargin}{linkerrand} +\setinterfacevariable{leftpage}{linkerseite} +\setinterfacevariable{lefttoright}{lefttoright} +\setinterfacevariable{legend}{legende} +\setinterfacevariable{lesshyphenation}{lesshyphenation} +\setinterfacevariable{line}{zeile} +\setinterfacevariable{linenote}{linenote} +\setinterfacevariable{lines}{zeilen} +\setinterfacevariable{list}{liste} +\setinterfacevariable{local}{lokal} +\setinterfacevariable{localenvironment}{lokaleumgebung} +\setinterfacevariable{logo}{logo} +\setinterfacevariable{logos}{logos} +\setinterfacevariable{lohi}{hoti} +\setinterfacevariable{loose}{lose} +\setinterfacevariable{low}{tief} +\setinterfacevariable{ls}{ls} +\setinterfacevariable{makeup}{umbruch} +\setinterfacevariable{mar}{mar} +\setinterfacevariable{march}{Maerz} +\setinterfacevariable{margin}{marginalie} +\setinterfacevariable{marginedge}{marginalkante} +\setinterfacevariable{margintitle}{marginaltitel} +\setinterfacevariable{marking}{beschriftung} +\setinterfacevariable{mathalignment}{mathalignment} +\setinterfacevariable{mathcases}{mathcases} +\setinterfacevariable{mathmatrix}{mathmatrix} +\setinterfacevariable{max}{max} +\setinterfacevariable{maxdepth}{maxdepth} +\setinterfacevariable{maxheight}{maxheight} +\setinterfacevariable{maxwidth}{maxwidth} +\setinterfacevariable{may}{Mai} +\setinterfacevariable{mediaeval}{mittelalterlich} +\setinterfacevariable{medium}{mittel} +\setinterfacevariable{middle}{mittig} +\setinterfacevariable{min}{min} +\setinterfacevariable{mindepth}{mindepth} +\setinterfacevariable{minheight}{minhoehe} +\setinterfacevariable{minwidth}{minbreite} +\setinterfacevariable{mirrored}{gespiegelt} +\setinterfacevariable{monday}{montag} +\setinterfacevariable{mono}{mono} +\setinterfacevariable{month}{monat} +\setinterfacevariable{morehyphenation}{morehyphenation} +\setinterfacevariable{name}{name} +\setinterfacevariable{narrow}{schmall} +\setinterfacevariable{negative}{negativ} +\setinterfacevariable{never}{nie} +\setinterfacevariable{new}{neu} +\setinterfacevariable{next}{folgende} +\setinterfacevariable{nextevenpage}{naechstegeradeseite} +\setinterfacevariable{nextoddpage}{naechsteungeradeseite} +\setinterfacevariable{nextpage}{folgendeseite} +\setinterfacevariable{nextsubpage}{folgendeunterseite} +\setinterfacevariable{no}{nein} +\setinterfacevariable{nocheck}{nocheck} +\setinterfacevariable{nofit}{nofit} +\setinterfacevariable{nogrid}{nogrid} +\setinterfacevariable{nohz}{nohz} +\setinterfacevariable{nomarking}{keinebeschriftung} +\setinterfacevariable{none}{kein} +\setinterfacevariable{nonumber}{nonumber} +\setinterfacevariable{normal}{normal} +\setinterfacevariable{nospacing}{nospacing} +\setinterfacevariable{not}{nicht} +\setinterfacevariable{note}{note} +\setinterfacevariable{nothanging}{nothanging} +\setinterfacevariable{nothyphenated}{nothyphenated} +\setinterfacevariable{november}{November} +\setinterfacevariable{nowhere}{nirgens} +\setinterfacevariable{nowhite}{keinweiss} +\setinterfacevariable{number}{nummer} +\setinterfacevariable{numbers}{ziffern} +\setinterfacevariable{october}{Oktober} +\setinterfacevariable{odd}{ungerade} +\setinterfacevariable{off}{aus} +\setinterfacevariable{offset}{offset} +\setinterfacevariable{old}{old} +\setinterfacevariable{on}{an} +\setinterfacevariable{one}{eins} +\setinterfacevariable{opposite}{gegenueber} +\setinterfacevariable{outer}{aussen} +\setinterfacevariable{outeredge}{outeredge} +\setinterfacevariable{outermargin}{outermargin} +\setinterfacevariable{overbar}{ueberstrichen} +\setinterfacevariable{overbars}{ueberstreichen} +\setinterfacevariable{overlay}{overlay} +\setinterfacevariable{overprint}{overprint} +\setinterfacevariable{overstrike}{durchgestrichen} +\setinterfacevariable{overstrikes}{durchstreichen} +\setinterfacevariable{packed}{gepackt} +\setinterfacevariable{page}{seite} +\setinterfacevariable{pagecomment}{pagecomment} +\setinterfacevariable{pagenumber}{seitennummer} +\setinterfacevariable{paper}{papier} +\setinterfacevariable{paragraph}{absatz} +\setinterfacevariable{part}{teil} +\setinterfacevariable{positive}{positiv} +\setinterfacevariable{postponing}{verschieben} +\setinterfacevariable{postscript}{postscript} +\setinterfacevariable{preference}{einstellung} +\setinterfacevariable{preview}{vorschau} +\setinterfacevariable{previous}{vorig} +\setinterfacevariable{previousevenpage}{vorigegeradeseite} +\setinterfacevariable{previousoddpage}{vorigeungeradeseite} +\setinterfacevariable{previouspage}{vorigeseite} +\setinterfacevariable{previoussubpage}{vorigeunterseite} +\setinterfacevariable{printable}{druckbar} +\setinterfacevariable{process}{process} +\setinterfacevariable{product}{produkt} +\setinterfacevariable{program}{programm} +\setinterfacevariable{project}{projekt} +\setinterfacevariable{protected}{geschuetzt} +\setinterfacevariable{quadruple}{viertel} +\setinterfacevariable{quotation}{zitat} +\setinterfacevariable{quote}{zitieren} +\setinterfacevariable{ran}{ran} +\setinterfacevariable{random}{zufaellig} +\setinterfacevariable{readonly}{nurlesbar} +\setinterfacevariable{rectangular}{rechteckig} +\setinterfacevariable{reference}{referenz} +\setinterfacevariable{referral}{merkmal} +\setinterfacevariable{register}{register} +\setinterfacevariable{regular}{regular} +\setinterfacevariable{rekening}{rekening} +\setinterfacevariable{relative}{relativ} +\setinterfacevariable{repeat}{wiederholen} +\setinterfacevariable{required}{obligatorisch} +\setinterfacevariable{reset}{zuruecksetzten} +\setinterfacevariable{reverse}{reverse} +\setinterfacevariable{right}{rechts} +\setinterfacevariable{rightedge}{rechterkante} +\setinterfacevariable{righthanging}{righthanging} +\setinterfacevariable{rightmargin}{rechterrand} +\setinterfacevariable{rightpage}{rechterseite} +\setinterfacevariable{righttoleft}{righttoleft} +\setinterfacevariable{roman}{antiqua} +\setinterfacevariable{romannumerals}{roemischezahlen} +\setinterfacevariable{rotate}{drehe} +\setinterfacevariable{rotated}{gedreht} +\setinterfacevariable{round}{rund} +\setinterfacevariable{row}{row} +\setinterfacevariable{rule}{linie} +\setinterfacevariable{samepage}{selbeseite} +\setinterfacevariable{sans}{sans} +\setinterfacevariable{sansbold}{sansfett} +\setinterfacevariable{sansserif}{grotesk} +\setinterfacevariable{saturday}{samstag} +\setinterfacevariable{screen}{raster} +\setinterfacevariable{section}{absatz} +\setinterfacevariable{sectionblockenvironment}{sectionblockenvironment} +\setinterfacevariable{sectionnumber}{abschnittsnummer} +\setinterfacevariable{see}{sieh} +\setinterfacevariable{september}{September} +\setinterfacevariable{serif}{serif} +\setinterfacevariable{serried}{kleinerabstand} +\setinterfacevariable{setups}{impostazioni} +\setinterfacevariable{sheet}{sheet} +\setinterfacevariable{short}{kurz} +\setinterfacevariable{singlesided}{einzelseitig} +\setinterfacevariable{slanted}{geneigt} +\setinterfacevariable{slantedbold}{geneigtfett} +\setinterfacevariable{small}{klein} +\setinterfacevariable{smallbodyfont}{smallbodyfont} +\setinterfacevariable{smallbold}{kleinfett} +\setinterfacevariable{smallbolditalic}{kleinfettitalic} +\setinterfacevariable{smallboldslanted}{kleinfettgeneigt} +\setinterfacevariable{smallcaps}{smallcaps} +\setinterfacevariable{smaller}{smaller} +\setinterfacevariable{smallitalic}{kleinitalic} +\setinterfacevariable{smallitalicbold}{kleinitalicfett} +\setinterfacevariable{smallnormal}{kleinnormal} +\setinterfacevariable{smallslanted}{kleingeneigt} +\setinterfacevariable{smallslantedbold}{kleingeneigtfett} +\setinterfacevariable{smalltype}{kleintippen} +\setinterfacevariable{somewhere}{irgendwo} +\setinterfacevariable{sorted}{sortiert} +\setinterfacevariable{space}{spatium} +\setinterfacevariable{spacing}{spatiumausgleich} +\setinterfacevariable{speech}{speech} +\setinterfacevariable{split}{split} +\setinterfacevariable{spot}{spot} +\setinterfacevariable{standard}{standard} +\setinterfacevariable{start}{start} +\setinterfacevariable{starter}{starter} +\setinterfacevariable{sticker}{sticker} +\setinterfacevariable{stop}{stop} +\setinterfacevariable{stopper}{trenner} +\setinterfacevariable{stretch}{strecken} +\setinterfacevariable{strict}{streng} +\setinterfacevariable{strong}{strong} +\setinterfacevariable{strut}{strut} +\setinterfacevariable{sub}{unter} +\setinterfacevariable{subbackward}{unterrueckwaerts} +\setinterfacevariable{subformula}{subformel} +\setinterfacevariable{subforward}{untervorwaerts} +\setinterfacevariable{subject}{thema} +\setinterfacevariable{subpage}{unterseite} +\setinterfacevariable{subsection}{unterabsatz} +\setinterfacevariable{subsubject}{unterthema} +\setinterfacevariable{subsubsection}{unterunterabsatz} +\setinterfacevariable{subsubsubject}{unterunterthema} +\setinterfacevariable{subsubsubsection}{unterunterunterabsatz} +\setinterfacevariable{subsubsubsubject}{unterunterunterthema} +\setinterfacevariable{subsubsubsubsection}{unterunterunterunterabsatz} +\setinterfacevariable{subsubsubsubsubject}{unterunterunterunterthema} +\setinterfacevariable{subsubsubsubsubsection}{unterunterunterunterunterabsatz} +\setinterfacevariable{subsubsubsubsubsubject}{unterunterunterunterunterthema} +\setinterfacevariable{subsubsubsubsubsubsection}{unterunterunterunterunterunterabsatz} +\setinterfacevariable{subsubsubsubsubsubsubject}{unterunterunterunterunterunterthema} +\setinterfacevariable{subsubsubsubsubsubsubsection}{unterunterunterunterunterunterunterabsatz} +\setinterfacevariable{subsubsubsubsubsubsubsubject}{unterunterunterunterunterunterunterthema} +\setinterfacevariable{subsubsubsubsubsubsubsubsection}{unterunterunterunterunterunterunterunterabsatz} +\setinterfacevariable{subsubsubsubsubsubsubsubsubject}{unterunterunterunterunterunterunterunterthema} +\setinterfacevariable{subsubsubsubsubsubsubsubsubsection}{unterunterunterunterunterunterunterunterunterabsatz} +\setinterfacevariable{subsubsubsubsubsubsubsubsubsubject}{unterunterunterunterunterunterunterunterunterthema} +\setinterfacevariable{sunday}{sonntag} +\setinterfacevariable{support}{support} +\setinterfacevariable{sym}{sym} +\setinterfacevariable{symbol}{symbol} +\setinterfacevariable{synchronize}{synchronize} +\setinterfacevariable{system}{systeme} +\setinterfacevariable{table}{tabelle} +\setinterfacevariable{tablehead}{tabellenueberschrift} +\setinterfacevariable{tables}{tabellen} +\setinterfacevariable{tabletail}{tabellenende} +\setinterfacevariable{tabulate}{tabulator} +\setinterfacevariable{tabulatehead}{tabulatehead} +\setinterfacevariable{tabulatetail}{tabulatetail} +\setinterfacevariable{tall}{lang} +\setinterfacevariable{teletype}{fernschreiber} +\setinterfacevariable{temporary}{temporaer} +\setinterfacevariable{test}{test} +\setinterfacevariable{text}{text} +\setinterfacevariable{three}{drei} +\setinterfacevariable{thursday}{donnerstag} +\setinterfacevariable{title}{titel} +\setinterfacevariable{toggle}{toggle} +\setinterfacevariable{tolerant}{tolerant} +\setinterfacevariable{top}{oben} +\setinterfacevariable{tuesday}{dienstag} +\setinterfacevariable{two}{zwei} +\setinterfacevariable{txt}{txt} +\setinterfacevariable{type}{tippen} +\setinterfacevariable{typing}{tippen} +\setinterfacevariable{unavailable}{nichtverfuegbar} +\setinterfacevariable{underbar}{unterstrichen} +\setinterfacevariable{underbars}{unterstreichen} +\setinterfacevariable{unit}{einheit} +\setinterfacevariable{units}{einheiten} +\setinterfacevariable{unknown}{unbekannt} +\setinterfacevariable{unpacked}{ungepackt} +\setinterfacevariable{up}{up} +\setinterfacevariable{url}{url} +\setinterfacevariable{used}{verwende} +\setinterfacevariable{value}{wert} +\setinterfacevariable{vertical}{vertikal} +\setinterfacevariable{very}{sehr} +\setinterfacevariable{verystrict}{sehrstreng} +\setinterfacevariable{verytolerant}{sehrtolerant} +\setinterfacevariable{weak}{weak} +\setinterfacevariable{wednesday}{mittwoch} +\setinterfacevariable{week}{woche} +\setinterfacevariable{weekday}{wochentag} +\setinterfacevariable{white}{weiss} +\setinterfacevariable{wide}{breit} +\setinterfacevariable{width}{breite} +\setinterfacevariable{xml}{xml} +\setinterfacevariable{year}{jahr} +\setinterfacevariable{yes}{ja} +% definitions for interface constants for language de +% +\setinterfaceconstant{action}{aktion} +\setinterfaceconstant{address}{adresse} +\setinterfaceconstant{after}{nach} +\setinterfaceconstant{afterhead}{nachkopf} +\setinterfaceconstant{afterkey}{nachtaste} +\setinterfaceconstant{aftersection}{aftersection} +\setinterfaceconstant{align}{ausrichtung} +\setinterfaceconstant{aligncharacter}{aligncharacter} +\setinterfaceconstant{alignmentcharacter}{alignmentcharacter} +\setinterfaceconstant{alignsymbol}{alignsymbol} +\setinterfaceconstant{aligntitle}{titelausrichten} +\setinterfaceconstant{alternative}{alternative} +\setinterfaceconstant{andtext}{andtext} +\setinterfaceconstant{apa}{apa} +\setinterfaceconstant{arrow}{pfeil} +\setinterfaceconstant{artauthor}{artauthor} +\setinterfaceconstant{artauthoretaldisplay}{artauthoretaldisplay} +\setinterfaceconstant{artauthoretallimit}{artauthoretallimit} +\setinterfaceconstant{artauthoretaltext}{artauthoretaltext} +\setinterfaceconstant{at}{bei} +\setinterfaceconstant{author}{autor} +\setinterfaceconstant{authoretaldisplay}{authoretaldisplay} +\setinterfaceconstant{authoretallimit}{authoretallimit} +\setinterfaceconstant{authoretaltext}{authoretaltext} +\setinterfaceconstant{auto}{auto} +\setinterfaceconstant{autocase}{autocase} +\setinterfaceconstant{autofile}{autofile} +\setinterfaceconstant{autofocus}{autofocus} +\setinterfaceconstant{autohang}{autohang} +\setinterfaceconstant{autostrut}{autostrut} +\setinterfaceconstant{autowidth}{autobreite} +\setinterfaceconstant{axis}{achsen} +\setinterfaceconstant{background}{hintergrund} +\setinterfaceconstant{backgroundcolor}{hintergrundfarbe} +\setinterfaceconstant{backgroundcorner}{hintergrundwinkel} +\setinterfaceconstant{backgrounddepth}{hintergrundtiefe} +\setinterfaceconstant{backgroundoffset}{hintergrundoffset} +\setinterfaceconstant{backgroundradius}{hintergrundradius} +\setinterfaceconstant{backgroundscreen}{hintergrundraster} +\setinterfaceconstant{backreference}{backreference} +\setinterfaceconstant{backspace}{rumpfspatium} +\setinterfaceconstant{balance}{ausgleichen} +\setinterfaceconstant{before}{vor} +\setinterfaceconstant{beforehead}{vorkopf} +\setinterfaceconstant{beforesection}{beforesection} +\setinterfaceconstant{bet}{bet} +\setinterfaceconstant{big}{gross} +\setinterfaceconstant{blank}{blanko} +\setinterfaceconstant{blockway}{blockauf} +\setinterfaceconstant{bodyfont}{fliesstext} +\setinterfaceconstant{bookmark}{bookmark} +\setinterfaceconstant{bottom}{unten} +\setinterfaceconstant{bottomafter}{bottomafter} +\setinterfaceconstant{bottombefore}{bottombefore} +\setinterfaceconstant{bottomdistance}{abstandunten} +\setinterfaceconstant{bottomframe}{untenrahmen} +\setinterfaceconstant{bottomoffset}{untenoffset} +\setinterfaceconstant{bottomspace}{bottomspace} +\setinterfaceconstant{bottomstate}{untenstatus} +\setinterfaceconstant{buffer}{buffer} +\setinterfaceconstant{cache}{cache} +\setinterfaceconstant{calculate}{berechnen} +\setinterfaceconstant{category}{category} +\setinterfaceconstant{ccommand}{cbefehl} +\setinterfaceconstant{click}{klick} +\setinterfaceconstant{clickin}{klickin} +\setinterfaceconstant{clickout}{klickaus} +\setinterfaceconstant{clipoffset}{clipoffset} +\setinterfaceconstant{closeaction}{schliessenaktion} +\setinterfaceconstant{closecommand}{closecommand} +\setinterfaceconstant{closepage}{closepage} +\setinterfaceconstant{closepageaction}{closepageaction} +\setinterfaceconstant{closesymbol}{closesymbol} +\setinterfaceconstant{color}{farbe} +\setinterfaceconstant{column}{spalte} +\setinterfaceconstant{columndistance}{spaltenabstand} +\setinterfaceconstant{columns}{spalten} +\setinterfaceconstant{command}{befehl} +\setinterfaceconstant{commandafter}{zumbefehl} +\setinterfaceconstant{commandbefore}{vorbefehl} +\setinterfaceconstant{commands}{befehle} +\setinterfaceconstant{component}{component} +\setinterfaceconstant{compoundhyphen}{compoundhyphen} +\setinterfaceconstant{compress}{compress} +\setinterfaceconstant{connector}{connector} +\setinterfaceconstant{continue}{fortsetzen} +\setinterfaceconstant{contrastcolor}{kontrastfarbe} +\setinterfaceconstant{controls}{controls} +\setinterfaceconstant{conversion}{konversion} +\setinterfaceconstant{convertfile}{konvertieredatei} +\setinterfaceconstant{corner}{winkel} +\setinterfaceconstant{coupling}{verknuepfung} +\setinterfaceconstant{couplingway}{verkopplungsart} +\setinterfaceconstant{criterium}{kriterium} +\setinterfaceconstant{current}{aktuell} +\setinterfaceconstant{cutspace}{cutspace} +\setinterfaceconstant{dash}{strich} +\setinterfaceconstant{dat}{dat} +\setinterfaceconstant{database}{database} +\setinterfaceconstant{date}{datum} +\setinterfaceconstant{deepnumbercommand}{deepnumbercommand} +\setinterfaceconstant{deeptextcommand}{deeptextcommand} +\setinterfaceconstant{default}{default} +\setinterfaceconstant{delay}{wartezeit} +\setinterfaceconstant{depth}{tiefe} +\setinterfaceconstant{depthcorrection}{tiefekorrektur} +\setinterfaceconstant{direction}{richtung} +\setinterfaceconstant{directory}{verzeichnis} +\setinterfaceconstant{display}{bildschirm} +\setinterfaceconstant{distance}{abstand} +\setinterfaceconstant{dot}{punkt} +\setinterfaceconstant{doublesided}{doppelseitig} +\setinterfaceconstant{dummy}{dummy} +\setinterfaceconstant{dx}{dx} +\setinterfaceconstant{dy}{dy} +\setinterfaceconstant{edge}{kante} +\setinterfaceconstant{edgedistance}{kantenabstand} +\setinterfaceconstant{editor}{editor} +\setinterfaceconstant{editoretaldisplay}{editoretaldisplay} +\setinterfaceconstant{editoretallimit}{editoretallimit} +\setinterfaceconstant{editoretaltext}{editoretaltext} +\setinterfaceconstant{empty}{leer} +\setinterfaceconstant{entries}{entries} +\setinterfaceconstant{equalheight}{equalheight} +\setinterfaceconstant{equalwidth}{equalwidth} +\setinterfaceconstant{escape}{escape} +\setinterfaceconstant{evenmargin}{geraderand} +\setinterfaceconstant{expansion}{expansion} +\setinterfaceconstant{export}{export} +\setinterfaceconstant{extras}{extras} +\setinterfaceconstant{factor}{faktor} +\setinterfaceconstant{fallback}{fallback} +\setinterfaceconstant{family}{familie} +\setinterfaceconstant{fieldbackgroundcolor}{feldhintergrundfarbe} +\setinterfaceconstant{fieldframecolor}{feldrahmenfarbe} +\setinterfaceconstant{fieldlayer}{fieldlayer} +\setinterfaceconstant{fieldoffset}{feldoffset} +\setinterfaceconstant{file}{datei} +\setinterfaceconstant{filtercommand}{filtercommand} +\setinterfaceconstant{finalnamesep}{finalnamesep} +\setinterfaceconstant{firstnamesep}{firstnamesep} +\setinterfaceconstant{focus}{focus} +\setinterfaceconstant{focusin}{focusin} +\setinterfaceconstant{focusout}{focusout} +\setinterfaceconstant{footer}{fusszeile} +\setinterfaceconstant{footerdistance}{fusszeilenabstand} +\setinterfaceconstant{footerstate}{fusszeilenstatus} +\setinterfaceconstant{force}{zwinge} +\setinterfaceconstant{foregroundcolor}{foregroundcolor} +\setinterfaceconstant{foregroundstyle}{foregroundstyle} +\setinterfaceconstant{format}{formatieren} +\setinterfaceconstant{frame}{rahmen} +\setinterfaceconstant{framecolor}{rahmenfarbe} +\setinterfaceconstant{framecorner}{rahmenwinkel} +\setinterfaceconstant{framedepth}{rahmentiefe} +\setinterfaceconstant{frameoffset}{rahmenoffset} +\setinterfaceconstant{frameradius}{rahmenradius} +\setinterfaceconstant{frames}{umrahmen} +\setinterfaceconstant{from}{von} +\setinterfaceconstant{get}{hole} +\setinterfaceconstant{global}{global} +\setinterfaceconstant{grid}{gritter} +\setinterfaceconstant{hang}{haengend} +\setinterfaceconstant{headalign}{headalign} +\setinterfaceconstant{headcolor}{kopffarbe} +\setinterfaceconstant{headcommand}{headcommand} +\setinterfaceconstant{headconversion}{headconversion} +\setinterfaceconstant{header}{kopfzeile} +\setinterfaceconstant{headerdistance}{kopfzeilenabstand} +\setinterfaceconstant{headerstate}{kopfzeilenstatus} +\setinterfaceconstant{headlabel}{headlabel} +\setinterfaceconstant{headnumber}{kopfnummer} +\setinterfaceconstant{headstyle}{kopfstil} +\setinterfaceconstant{height}{hoehe} +\setinterfaceconstant{hfactor}{hfaktor} +\setinterfaceconstant{hfil}{hfil} +\setinterfaceconstant{hidenumber}{hidenumber} +\setinterfaceconstant{hoffset}{hoffset} +\setinterfaceconstant{horoffset}{rumpfabstand} +\setinterfaceconstant{hyphen}{hyphen} +\setinterfaceconstant{icommand}{ibefehl} +\setinterfaceconstant{in}{in} +\setinterfaceconstant{inbetween}{zwischen} +\setinterfaceconstant{increment}{erhoehen} +\setinterfaceconstant{incrementnumber}{nummererhoehen} +\setinterfaceconstant{indenting}{einziehen} +\setinterfaceconstant{indentnext}{ziehefolgendeein} +\setinterfaceconstant{indicator}{indikator} +\setinterfaceconstant{inner}{innen} +\setinterfaceconstant{innermargin}{innermargin} +\setinterfaceconstant{inputfile}{inputfile} +\setinterfaceconstant{intent}{intent} +\setinterfaceconstant{interaction}{interaktion} +\setinterfaceconstant{interlinespace}{zeilenabstande} +\setinterfaceconstant{internalgrid}{internalgrid} +\setinterfaceconstant{itemalign}{itemalign} +\setinterfaceconstant{items}{posten} +\setinterfaceconstant{juniorsep}{juniorsep} +\setinterfaceconstant{ken}{ken} +\setinterfaceconstant{keyexpansion}{keyexpansion} +\setinterfaceconstant{keys}{keys} +\setinterfaceconstant{keyword}{keyword} +\setinterfaceconstant{label}{label} +\setinterfaceconstant{lastnamesep}{lastnamesep} +\setinterfaceconstant{lastpubsep}{lastpubsep} +\setinterfaceconstant{left}{links} +\setinterfaceconstant{leftcolor}{linkerfarbe} +\setinterfaceconstant{leftcompoundhyphen}{leftcompoundhyphen} +\setinterfaceconstant{leftedge}{linkekante} +\setinterfaceconstant{leftedgedistance}{linkerkantenabstand} +\setinterfaceconstant{leftframe}{linkerrahmen} +\setinterfaceconstant{lefthyphen}{lefthyphen} +\setinterfaceconstant{leftmargin}{linkerrand} +\setinterfaceconstant{leftmargindistance}{linkerrandabstand} +\setinterfaceconstant{leftoffset}{linkeroffset} +\setinterfaceconstant{leftquotation}{linkerzitat} +\setinterfaceconstant{leftquote}{linkerzitieren} +\setinterfaceconstant{leftsentence}{linkersatz} +\setinterfaceconstant{leftspeech}{leftspeech} +\setinterfaceconstant{leftstyle}{linkerstil} +\setinterfaceconstant{leftsubsentence}{linkersubsatz} +\setinterfaceconstant{lefttext}{linkertext} +\setinterfaceconstant{leftwidth}{linkerbreite} +\setinterfaceconstant{level}{niveau} +\setinterfaceconstant{levels}{niveaus} +\setinterfaceconstant{limittext}{limittext} +\setinterfaceconstant{line}{zeile} +\setinterfaceconstant{linecorrection}{zeilekorrektur} +\setinterfaceconstant{lines}{zeilen} +\setinterfaceconstant{list}{liste} +\setinterfaceconstant{listtext}{listtext} +\setinterfaceconstant{local}{lokal} +\setinterfaceconstant{location}{platz} +\setinterfaceconstant{logo}{logo} +\setinterfaceconstant{logos}{logos} +\setinterfaceconstant{marcolor}{beschrfarbe} +\setinterfaceconstant{margin}{marginalie} +\setinterfaceconstant{margindistance}{marginalabstand} +\setinterfaceconstant{marginedge}{marginalkante} +\setinterfaceconstant{marginedgetext}{marginalkantetext} +\setinterfaceconstant{margintext}{marginaltext} +\setinterfaceconstant{marking}{beschriftung} +\setinterfaceconstant{marstyle}{beschrstil} +\setinterfaceconstant{mask}{mask} +\setinterfaceconstant{max}{max} +\setinterfaceconstant{maxdepth}{maxdepth} +\setinterfaceconstant{maxheight}{maxhoehe} +\setinterfaceconstant{maxwidth}{maxbreite} +\setinterfaceconstant{maybeyear}{maybeyear} +\setinterfaceconstant{menu}{menue} +\setinterfaceconstant{method}{methode} +\setinterfaceconstant{middle}{mittig} +\setinterfaceconstant{middlespeech}{middlespeech} +\setinterfaceconstant{middletext}{mittigertext} +\setinterfaceconstant{midsentence}{midsentence} +\setinterfaceconstant{min}{min} +\setinterfaceconstant{mindepth}{mindepth} +\setinterfaceconstant{minheight}{minhoehe} +\setinterfaceconstant{minwidth}{minbreite} +\setinterfaceconstant{monthconversion}{monthconversion} +\setinterfaceconstant{n}{n} +\setinterfaceconstant{name}{name} +\setinterfaceconstant{namesep}{namesep} +\setinterfaceconstant{nbottom}{nunten} +\setinterfaceconstant{nc}{nc} +\setinterfaceconstant{next}{folgende} +\setinterfaceconstant{nl}{nl} +\setinterfaceconstant{nleft}{nlinks} +\setinterfaceconstant{nlines}{zzeile} +\setinterfaceconstant{norm}{norm} +\setinterfaceconstant{nr}{nr} +\setinterfaceconstant{nright}{nrechts} +\setinterfaceconstant{ntop}{noben} +\setinterfaceconstant{number}{nummer} +\setinterfaceconstant{numbercolor}{nummernfarbe} +\setinterfaceconstant{numbercommand}{nummerbefehl} +\setinterfaceconstant{numberconversion}{numberconversion} +\setinterfaceconstant{numberconversionset}{numberconversionset} +\setinterfaceconstant{numberdistance}{numberdistance} +\setinterfaceconstant{numbering}{nummerierung} +\setinterfaceconstant{numberorder}{numberorder} +\setinterfaceconstant{numberprefix}{numberprefix} +\setinterfaceconstant{numbersegments}{numbersegments} +\setinterfaceconstant{numberseparator}{nummernseperator} +\setinterfaceconstant{numberseparatorset}{numberseparatorset} +\setinterfaceconstant{numberset}{numberset} +\setinterfaceconstant{numberstarter}{numberstarter} +\setinterfaceconstant{numberstopper}{numberstopper} +\setinterfaceconstant{numberstyle}{nummernstil} +\setinterfaceconstant{numberwidth}{numberwidth} +\setinterfaceconstant{nx}{nx} +\setinterfaceconstant{ny}{ny} +\setinterfaceconstant{object}{objekt} +\setinterfaceconstant{obstruction}{gesperrt} +\setinterfaceconstant{oddmargin}{ungeraderand} +\setinterfaceconstant{offset}{offset} +\setinterfaceconstant{openaction}{oeffenaktion} +\setinterfaceconstant{openpage}{openpage} +\setinterfaceconstant{openpageaction}{openpageaction} +\setinterfaceconstant{option}{option} +\setinterfaceconstant{order}{order} +\setinterfaceconstant{orientation}{orientation} +\setinterfaceconstant{otherstext}{otherstext} +\setinterfaceconstant{outermargin}{outermargin} +\setinterfaceconstant{overprint}{overprint} +\setinterfaceconstant{ownnumber}{eigenenummer} +\setinterfaceconstant{page}{seite} +\setinterfaceconstant{pageboundaries}{seitenbegrenzung} +\setinterfaceconstant{pagecolor}{seitenfarbe} +\setinterfaceconstant{pagecommand}{seitenbefehl} +\setinterfaceconstant{pageconversion}{pageconversion} +\setinterfaceconstant{pageconversionset}{pageconversionset} +\setinterfaceconstant{pagenumber}{seitennummer} +\setinterfaceconstant{pageprefix}{pageprefix} +\setinterfaceconstant{pageprefixconnector}{pageprefixconnector} +\setinterfaceconstant{pageprefixconversion}{pageprefixconversion} +\setinterfaceconstant{pageprefixconversionset}{pageprefixconversionset} +\setinterfaceconstant{pageprefixsegments}{pageprefixsegments} +\setinterfaceconstant{pageprefixseparatorset}{pageprefixseparatorset} +\setinterfaceconstant{pageprefixset}{pageprefixset} +\setinterfaceconstant{pageprefixstarter}{pageprefixstarter} +\setinterfaceconstant{pageprefixstopper}{pageprefixstopper} +\setinterfaceconstant{pagesegments}{pagesegments} +\setinterfaceconstant{pageseparatorset}{pageseparatorset} +\setinterfaceconstant{pageset}{pageset} +\setinterfaceconstant{pagestarter}{pagestarter} +\setinterfaceconstant{pagestate}{pagestate} +\setinterfaceconstant{pagestopper}{pagestopper} +\setinterfaceconstant{pagestyle}{seitenstil} +\setinterfaceconstant{palet}{palette} +\setinterfaceconstant{paper}{papier} +\setinterfaceconstant{paragraph}{absatz} +\setinterfaceconstant{place}{platziere} +\setinterfaceconstant{placehead}{setzekopf} +\setinterfaceconstant{placestopper}{setzetrenner} +\setinterfaceconstant{position}{position} +\setinterfaceconstant{prefix}{prefix} +\setinterfaceconstant{prefixconnector}{prefixconnector} +\setinterfaceconstant{prefixconversion}{prefixconversion} +\setinterfaceconstant{prefixconversionset}{prefixconversionset} +\setinterfaceconstant{prefixsegments}{prefixsegments} +\setinterfaceconstant{prefixseparatorset}{prefixseparatorset} +\setinterfaceconstant{prefixset}{prefixset} +\setinterfaceconstant{prefixstarter}{prefixstarter} +\setinterfaceconstant{prefixstopper}{prefixstopper} +\setinterfaceconstant{preset}{voreinstellung} +\setinterfaceconstant{preview}{vorschau} +\setinterfaceconstant{previous}{vorige} +\setinterfaceconstant{previousnumber}{vorigenummer} +\setinterfaceconstant{process}{process} +\setinterfaceconstant{profile}{profile} +\setinterfaceconstant{pubsep}{pubsep} +\setinterfaceconstant{radius}{radius} +\setinterfaceconstant{random}{zufaellig} +\setinterfaceconstant{range}{range} +\setinterfaceconstant{reduction}{reduktion} +\setinterfaceconstant{ref}{ref} +\setinterfaceconstant{refcommand}{refcommand} +\setinterfaceconstant{reference}{referenz} +\setinterfaceconstant{referenceprefix}{referenceprefix} +\setinterfaceconstant{referencing}{referieren} +\setinterfaceconstant{regionin}{regionin} +\setinterfaceconstant{regionout}{regionaus} +\setinterfaceconstant{repeat}{wiederholen} +\setinterfaceconstant{reset}{reset} +\setinterfaceconstant{resetnumber}{resetnumber} +\setinterfaceconstant{resolution}{aufloesung} +\setinterfaceconstant{right}{rechts} +\setinterfaceconstant{rightcolor}{rechterfarbe} +\setinterfaceconstant{rightcompoundhyphen}{rightcompoundhyphen} +\setinterfaceconstant{rightedge}{rechtekante} +\setinterfaceconstant{rightedgedistance}{rechterkantenabstand} +\setinterfaceconstant{rightframe}{rechterrahmen} +\setinterfaceconstant{righthyphen}{righthyphen} +\setinterfaceconstant{rightmargin}{rechterrand} +\setinterfaceconstant{rightmargindistance}{rechterrandabstand} +\setinterfaceconstant{rightoffset}{rechterabstand} +\setinterfaceconstant{rightquotation}{rechterzitat} +\setinterfaceconstant{rightquote}{rechterzitieren} +\setinterfaceconstant{rightsentence}{rechtersatz} +\setinterfaceconstant{rightspeech}{rightspeech} +\setinterfaceconstant{rightstyle}{rechterstil} +\setinterfaceconstant{rightsubsentence}{rechtersubsatz} +\setinterfaceconstant{righttext}{rechtertext} +\setinterfaceconstant{rightwidth}{rechterbreite} +\setinterfaceconstant{rotation}{rotation} +\setinterfaceconstant{rule}{linie} +\setinterfaceconstant{rulecolor}{linienfarbe} +\setinterfaceconstant{rulethickness}{liniendicke} +\setinterfaceconstant{samepage}{selbeseite} +\setinterfaceconstant{sample}{muster} +\setinterfaceconstant{samplesize}{samplesize} +\setinterfaceconstant{saveinlist}{saveinlist} +\setinterfaceconstant{scale}{format} +\setinterfaceconstant{scope}{bereich} +\setinterfaceconstant{screen}{raster} +\setinterfaceconstant{section}{abschnitt} +\setinterfaceconstant{sectionconversion}{sectionconversion} +\setinterfaceconstant{sectionconversionset}{sectionconversionset} +\setinterfaceconstant{sectionnumber}{abschnittsnummer} +\setinterfaceconstant{sectionresetset}{sectionresetset} +\setinterfaceconstant{sectionsegments}{sectionsegments} +\setinterfaceconstant{sectionseparatorset}{sectionseparatorset} +\setinterfaceconstant{sectionset}{sectionset} +\setinterfaceconstant{sectionstarter}{sectionstarter} +\setinterfaceconstant{sectionstopper}{sectionstopper} +\setinterfaceconstant{separator}{seperator} +\setinterfaceconstant{set}{set} +\setinterfaceconstant{setups}{setups} +\setinterfaceconstant{side}{objektabstand} +\setinterfaceconstant{sidealign}{sidealign} +\setinterfaceconstant{sidemethod}{sidemethod} +\setinterfaceconstant{sidespaceafter}{nebennachspatium} +\setinterfaceconstant{sidespacebefore}{nebenvorspatium} +\setinterfaceconstant{sign}{zeichen} +\setinterfaceconstant{size}{groesse} +\setinterfaceconstant{small}{klein} +\setinterfaceconstant{sort}{sort} +\setinterfaceconstant{sorttype}{sorttype} +\setinterfaceconstant{source}{quelle} +\setinterfaceconstant{space}{spatium} +\setinterfaceconstant{spaceafter}{nachspatium} +\setinterfaceconstant{spacebefore}{vorspatium} +\setinterfaceconstant{spaceinbetween}{spaceinbetween} +\setinterfaceconstant{spacing}{spatiumausgleich} +\setinterfaceconstant{split}{split} +\setinterfaceconstant{splitcolor}{splitcolor} +\setinterfaceconstant{splitmethod}{splitmethod} +\setinterfaceconstant{splitoffset}{splitoffset} +\setinterfaceconstant{spot}{spot} +\setinterfaceconstant{stack}{stack} +\setinterfaceconstant{start}{start} +\setinterfaceconstant{starter}{starter} +\setinterfaceconstant{state}{status} +\setinterfaceconstant{step}{schritt} +\setinterfaceconstant{stop}{stop} +\setinterfaceconstant{stopper}{abschnitttrenner} +\setinterfaceconstant{stretch}{strecken} +\setinterfaceconstant{strip}{strip} +\setinterfaceconstant{strut}{strut} +\setinterfaceconstant{style}{stil} +\setinterfaceconstant{sub}{unter} +\setinterfaceconstant{subtitle}{untertitel} +\setinterfaceconstant{suffix}{suffix} +\setinterfaceconstant{suffixseparator}{suffixseparator} +\setinterfaceconstant{surnamesep}{surnamesep} +\setinterfaceconstant{sx}{sx} +\setinterfaceconstant{sy}{sy} +\setinterfaceconstant{symalign}{symausrichtung} +\setinterfaceconstant{symbol}{symbol} +\setinterfaceconstant{symbolset}{symbolset} +\setinterfaceconstant{symcolor}{symfarbe} +\setinterfaceconstant{symstyle}{symstil} +\setinterfaceconstant{synonym}{synonym} +\setinterfaceconstant{synonymcolor}{synonymfarbe} +\setinterfaceconstant{synonymcommand}{synonymbefehl} +\setinterfaceconstant{synonymstyle}{synonymstil} +\setinterfaceconstant{tab}{tab} +\setinterfaceconstant{text}{text} +\setinterfaceconstant{textcolor}{textfarbe} +\setinterfaceconstant{textcommand}{textbefehl} +\setinterfaceconstant{textdistance}{textdistance} +\setinterfaceconstant{textlayer}{textlayer} +\setinterfaceconstant{textmargin}{textmargin} +\setinterfaceconstant{textmethod}{textmethod} +\setinterfaceconstant{textseparator}{textseparator} +\setinterfaceconstant{textsize}{textgroesse} +\setinterfaceconstant{textstate}{textstatus} +\setinterfaceconstant{textstyle}{textstil} +\setinterfaceconstant{textwidth}{textbreite} +\setinterfaceconstant{threshold}{threshold} +\setinterfaceconstant{title}{titel} +\setinterfaceconstant{titlecolor}{titelfarbe} +\setinterfaceconstant{titlecommand}{titlecommand} +\setinterfaceconstant{titledistance}{titelabstand} +\setinterfaceconstant{titleleft}{titleleft} +\setinterfaceconstant{titleright}{titleright} +\setinterfaceconstant{titlestyle}{titelstil} +\setinterfaceconstant{to}{zu} +\setinterfaceconstant{tolerance}{toleranz} +\setinterfaceconstant{top}{oben} +\setinterfaceconstant{topdistance}{obenabstand} +\setinterfaceconstant{topframe}{obenrahmen} +\setinterfaceconstant{topoffset}{obenoffset} +\setinterfaceconstant{topspace}{kopfspatium} +\setinterfaceconstant{topstate}{statusoben} +\setinterfaceconstant{totalnumber}{totalnumber} +\setinterfaceconstant{type}{typ} +\setinterfaceconstant{unit}{einheit} +\setinterfaceconstant{unknownreference}{unbekantereferenz} +\setinterfaceconstant{urlalternative}{urlalternative} +\setinterfaceconstant{urlspace}{urlspatium} +\setinterfaceconstant{validate}{validieren} +\setinterfaceconstant{values}{values} +\setinterfaceconstant{vcommand}{vbefehl} +\setinterfaceconstant{veroffset}{kopfoffset} +\setinterfaceconstant{vfil}{vfil} +\setinterfaceconstant{voffset}{voffset} +\setinterfaceconstant{vonsep}{vonsep} +\setinterfaceconstant{way}{art} +\setinterfaceconstant{wfactor}{bfaktor} +\setinterfaceconstant{white}{weiss} +\setinterfaceconstant{width}{breite} +\setinterfaceconstant{xfactor}{xfaktor} +\setinterfaceconstant{xmax}{xmax} +\setinterfaceconstant{xoffset}{xoffset} +\setinterfaceconstant{xscale}{xformat} +\setinterfaceconstant{xstep}{xschritt} +\setinterfaceconstant{yfactor}{yfaktor} +\setinterfaceconstant{ymax}{ymax} +\setinterfaceconstant{yoffset}{yoffset} +\setinterfaceconstant{yscale}{yformat} +\setinterfaceconstant{ystep}{yschritt} +% definitions for interface elements for language de +% +\setinterfaceelement{answerlines}{answerlines} +\setinterfaceelement{answerspace}{answerspace} +\setinterfaceelement{begin}{anfang} +\setinterfaceelement{complete}{vollende} +\setinterfaceelement{coupled}{verknuepft} +\setinterfaceelement{currentlocal}{aktuelllokal} +\setinterfaceelement{emptyone}{vuoto} +\setinterfaceelement{emptytwo}{leer} +\setinterfaceelement{end}{ende} +\setinterfaceelement{endsetup}{ein} +\setinterfaceelement{get}{get} +\setinterfaceelement{increment}{erhoehen} +\setinterfaceelement{list}{auflisten} +\setinterfaceelement{listof}{auflistenvon} +\setinterfaceelement{load}{laden} +\setinterfaceelement{local}{lokal} +\setinterfaceelement{makeup}{umbruch} +\setinterfaceelement{next}{folgende} +\setinterfaceelement{place}{platziere} +\setinterfaceelement{previous}{vorige} +\setinterfaceelement{previouslocal}{voriglokal} +\setinterfaceelement{reserve}{reservieren} +\setinterfaceelement{see}{sieh} +\setinterfaceelement{setup}{stelle} +\setinterfaceelement{start}{start} +\setinterfaceelement{stop}{stop} +\setinterfaceelement{text}{text} +\setinterfaceelement{type}{type} +% definitions for interface commands for language de +% +\setinterfacecommand{CAPPED}{KAP} +\setinterfacecommand{Character}{Buchstabe} +\setinterfacecommand{Characters}{Buchstaben} +\setinterfacecommand{MONTH}{MONAT} +\setinterfacecommand{Numbers}{Ziffern} +\setinterfacecommand{Romannumerals}{Roemischezahlen} +\setinterfacecommand{SmallCapped}{Kap} +\setinterfacecommand{SmallCaps}{Kaps} +\setinterfacecommand{WEEKDAY}{WOCHENTAG} +\setinterfacecommand{WORD}{WORT} +\setinterfacecommand{WORDS}{WOERTER} +\setinterfacecommand{Word}{Wort} +\setinterfacecommand{Words}{Woerter} +\setinterfacecommand{about}{ueber} +\setinterfacecommand{adaptlayout}{passelayoutan} +\setinterfacecommand{arg}{arg} +\setinterfacecommand{at}{bei} +\setinterfacecommand{atleftmargin}{atleftmargin} +\setinterfacecommand{atpage}{aufseite} +\setinterfacecommand{atrightmargin}{atrightmargin} +\setinterfacecommand{background}{hintergrund} +\setinterfacecommand{backspace}{rumpfweite} +\setinterfacecommand{blackrule}{rechteck} +\setinterfacecommand{blackrules}{rechtecke} +\setinterfacecommand{blank}{blanko} +\setinterfacecommand{bookmark}{bookmark} +\setinterfacecommand{bottomdistance}{abstandunten} +\setinterfacecommand{bottomheight}{hoeheunten} +\setinterfacecommand{bottomspace}{bottomspace} +\setinterfacecommand{but}{but} +\setinterfacecommand{button}{knopf} +\setinterfacecommand{bypassblocks}{bypassblocks} +\setinterfacecommand{character}{buchstabe} +\setinterfacecommand{characters}{buchstaben} +\setinterfacecommand{chem}{chem} +\setinterfacecommand{clip}{ausschnitt} +\setinterfacecommand{clonefield}{klonierefeld} +\setinterfacecommand{color}{farbe} +\setinterfacecommand{colorbar}{farbbalken} +\setinterfacecommand{colorvalue}{farbewert} +\setinterfacecommand{column}{spalte} +\setinterfacecommand{comparecolorgroup}{vergleichefarbengruppe} +\setinterfacecommand{comparepalet}{vergleichepalette} +\setinterfacecommand{completepagenumber}{completepagenumber} +\setinterfacecommand{completeregister}{completeregister} +\setinterfacecommand{component}{komponente} +\setinterfacecommand{convertnumber}{konvertierezahl} +\setinterfacecommand{copyfield}{kopierefeld} +\setinterfacecommand{correctwhitespace}{korrigierezwischenraum} +\setinterfacecommand{coupledocument}{verknuepfedokument} +\setinterfacecommand{couplemarking}{verknuepfebeschriftung} +\setinterfacecommand{couplepage}{doppelseite} +\setinterfacecommand{couplepaper}{doppelseitigespapier} +\setinterfacecommand{coupleregister}{verknuepfregister} +\setinterfacecommand{crlf}{crlf} +\setinterfacecommand{currentdate}{heutigesdatum} +\setinterfacecommand{currentheadnumber}{heutigeskopfnummer} +\setinterfacecommand{cutspace}{cutspace} +\setinterfacecommand{date}{datum} +\setinterfacecommand{decouplemarking}{entknuepfebeschriftung} +\setinterfacecommand{decrementnumber}{decrementnumber} +\setinterfacecommand{define}{definieren} +\setinterfacecommand{defineaccent}{definiereakzent} +\setinterfacecommand{defineblank}{definiereblanko} +\setinterfacecommand{defineblock}{definiereblock} +\setinterfacecommand{definebodyfont}{definierefliesstext} +\setinterfacecommand{definebodyfontenvironment}{definierefliesstextumgebung} +\setinterfacecommand{definebuffer}{definierepuffer} +\setinterfacecommand{definecharacter}{definierezeichen} +\setinterfacecommand{definecolor}{definierefarbe} +\setinterfacecommand{definecolorgroup}{definierefarbengruppe} +\setinterfacecommand{definecolumnbreak}{definecolumnbreak} +\setinterfacecommand{definecolumnset}{definecolumnset} +\setinterfacecommand{definecombination}{definecombination} +\setinterfacecommand{definecombinedlist}{definierezusammengestellteliste} +\setinterfacecommand{definecommand}{definierebefehl} +\setinterfacecommand{defineconversion}{definierekonversion} +\setinterfacecommand{definedescription}{definierebeschreibung} +\setinterfacecommand{defineenumeration}{definierenummerierung} +\setinterfacecommand{definefield}{definierefeld} +\setinterfacecommand{definefieldstack}{definierefeldstapel} +\setinterfacecommand{definefiguresymbol}{definiereabbsymbol} +\setinterfacecommand{definefloat}{definieregleitobjekt} +\setinterfacecommand{definefont}{definiereschrift} +\setinterfacecommand{definefontstyle}{definiereschriftstil} +\setinterfacecommand{definefontsynonym}{defineschriftsynonym} +\setinterfacecommand{defineframed}{definiereumrahmt} +\setinterfacecommand{defineframedtext}{definiereumrahmtertext} +\setinterfacecommand{definehbox}{definierehbox} +\setinterfacecommand{definehead}{definiereueberschrift} +\setinterfacecommand{defineindenting}{definiereeinzug} +\setinterfacecommand{defineinmargin}{defineinmargin} +\setinterfacecommand{defineinteractionmenu}{definiereinteraktionsmenue} +\setinterfacecommand{defineitemgroup}{defineitemgroup} +\setinterfacecommand{definelabel}{definierelabel} +\setinterfacecommand{definelayer}{definelayer} +\setinterfacecommand{definelayout}{definelayout} +\setinterfacecommand{definelist}{definiereliste} +\setinterfacecommand{definelogo}{definierelogo} +\setinterfacecommand{definemainfield}{definierehauptfeld} +\setinterfacecommand{definemakeup}{definiereumbruch} +\setinterfacecommand{definemarking}{definierebeschriftung} +\setinterfacecommand{definemathalignment}{definemathalignment} +\setinterfacecommand{defineoutput}{defineoutput} +\setinterfacecommand{defineoverlay}{definiereoverlay} +\setinterfacecommand{definepagebreak}{definepagebreak} +\setinterfacecommand{definepalet}{definierepalette} +\setinterfacecommand{definepapersize}{definierepapierformat} +\setinterfacecommand{defineparagraphs}{definiereabsaetze} +\setinterfacecommand{defineplacement}{defineplacement} +\setinterfacecommand{defineprofile}{definiereprofil} +\setinterfacecommand{defineprogram}{definiereprogramme} +\setinterfacecommand{definerawfont}{definerawfont} +\setinterfacecommand{definereference}{definierereferenz} +\setinterfacecommand{definereferenceformat}{definierereferenzformat} +\setinterfacecommand{definereferencelist}{definierereferenzliste} +\setinterfacecommand{defineregister}{definiereregister} +\setinterfacecommand{definerule}{definerule} +\setinterfacecommand{definesection}{definiereabschnitt} +\setinterfacecommand{definesectionblock}{definiereabschnittsblock} +\setinterfacecommand{definesorting}{definieresortieren} +\setinterfacecommand{definestartstop}{definierestartstop} +\setinterfacecommand{definestyle}{definierestil} +\setinterfacecommand{definesubfield}{definieresubfeld} +\setinterfacecommand{definesymbol}{definieresymbol} +\setinterfacecommand{definesynonyms}{definieresynonyme} +\setinterfacecommand{definetabletemplate}{definieretabellenvorlage} +\setinterfacecommand{definetabulate}{definieretabulator} +\setinterfacecommand{definetext}{definieretext} +\setinterfacecommand{definetextposition}{definetextposition} +\setinterfacecommand{definetextvariable}{definetextvariable} +\setinterfacecommand{definetype}{definetype} +\setinterfacecommand{definetyping}{definieretippen} +\setinterfacecommand{defineversion}{definiereversion} +\setinterfacecommand{determineheadnumber}{bestimmekopfnummer} +\setinterfacecommand{determinelistcharacteristics}{bestimmelistencharakeristika} +\setinterfacecommand{determineregistercharacteristics}{bestimmeregistercharakteristika} +\setinterfacecommand{dimension}{dimension} +\setinterfacecommand{disableinteractionmenu}{inaktiviereinteraktionsmenue} +\setinterfacecommand{domicile}{wohnort} +\setinterfacecommand{donttest}{keintest} +\setinterfacecommand{edgedistance}{randabstand} +\setinterfacecommand{edgewidth}{randbreite} +\setinterfacecommand{emptylines}{emptylines} +\setinterfacecommand{environment}{umgebung} +\setinterfacecommand{externalfigure}{externeabbildung} +\setinterfacecommand{fact}{geg} +\setinterfacecommand{field}{feld} +\setinterfacecommand{fieldstack}{feldstapel} +\setinterfacecommand{fillinfield}{ausfuellfeld} +\setinterfacecommand{fillinline}{gefuelltezeile} +\setinterfacecommand{fillinrules}{gefuelltesrechteck} +\setinterfacecommand{fillintext}{ausfuelltext} +\setinterfacecommand{fitfield}{passendfeld} +\setinterfacecommand{fixedspace}{festesspatium} +\setinterfacecommand{fixedspaces}{festesspatium} +\setinterfacecommand{followprofile}{folgeprofil} +\setinterfacecommand{followprofileversion}{folgeprofilversion} +\setinterfacecommand{followversion}{folgeversion} +\setinterfacecommand{footerdistance}{fusszeileabstand} +\setinterfacecommand{footerheight}{fusszeilenhoehe} +\setinterfacecommand{footnote}{fussnote} +\setinterfacecommand{footnotetext}{footnotetext} +\setinterfacecommand{forceblocks}{forceblocks} +\setinterfacecommand{formulanumber}{formelnummer} +\setinterfacecommand{fraction}{bruch} +\setinterfacecommand{framed}{umrahmt} +\setinterfacecommand{from}{von} +\setinterfacecommand{getbuffer}{holepuffer} +\setinterfacecommand{getmarking}{holebeschriftung} +\setinterfacecommand{getnumber}{getnumber} +\setinterfacecommand{godown}{nachunten} +\setinterfacecommand{goto}{zu} +\setinterfacecommand{gotobox}{zurbox} +\setinterfacecommand{gotopage}{zurseite} +\setinterfacecommand{graycolor}{graufarbe} +\setinterfacecommand{greyvalue}{grauwert} +\setinterfacecommand{grid}{gitter} +\setinterfacecommand{hairline}{haarlinie} +\setinterfacecommand{head}{kopf} +\setinterfacecommand{headerdistance}{kopfzeilenabstand} +\setinterfacecommand{headerheight}{kopfzeilenhoehe} +\setinterfacecommand{headlevel}{kopfniveau} +\setinterfacecommand{headnumber}{kopfnummer} +\setinterfacecommand{headsym}{headsym} +\setinterfacecommand{headtext}{ueberschrifttext} +\setinterfacecommand{hideblocks}{verbergebloecke} +\setinterfacecommand{high}{hoch} +\setinterfacecommand{hl}{hl} +\setinterfacecommand{immediatebetweenlist}{immediatebetweenlist} +\setinterfacecommand{immediatetolist}{immediatetolist} +\setinterfacecommand{in}{in} +\setinterfacecommand{incrementnumber}{nummererhoehen} +\setinterfacecommand{indenting}{einziehen} +\setinterfacecommand{inframed}{imumriss} +\setinterfacecommand{infull}{volleswort} +\setinterfacecommand{ininner}{ininner} +\setinterfacecommand{inleft}{imlinken} +\setinterfacecommand{inleftedge}{imlinkenrand} +\setinterfacecommand{inleftmargin}{inlinkermarginale} +\setinterfacecommand{inline}{inzeile} +\setinterfacecommand{inmargin}{inmarginalie} +\setinterfacecommand{inmframed}{immaumrise} +\setinterfacecommand{inneredgedistance}{inneredgedistance} +\setinterfacecommand{inneredgewidth}{inneredgewidth} +\setinterfacecommand{innermargindistance}{innermargindistance} +\setinterfacecommand{innermarginwidth}{innermarginwidth} +\setinterfacecommand{inothermargin}{inanderermarginale} +\setinterfacecommand{inouter}{inouter} +\setinterfacecommand{inright}{imrechten} +\setinterfacecommand{inrightedge}{imrechtenrand} +\setinterfacecommand{inrightmargin}{inrechtermarginale} +\setinterfacecommand{installlanguage}{installieresprache} +\setinterfacecommand{interactionbar}{interaktionsbalken} +\setinterfacecommand{interactionbuttons}{interaktionsknopfe} +\setinterfacecommand{interactionmenu}{interaktionsmenue} +\setinterfacecommand{item}{pos} +\setinterfacecommand{items}{posten} +\setinterfacecommand{its}{its} +\setinterfacecommand{keepblocks}{behaltebloecke} +\setinterfacecommand{label}{label} +\setinterfacecommand{labels}{labels} +\setinterfacecommand{labeltext}{labeltext} +\setinterfacecommand{language}{sprache} +\setinterfacecommand{leftaligned}{linksbuendig} +\setinterfacecommand{leftedgedistance}{abstandlinkerrand} +\setinterfacecommand{leftedgewidth}{breitelinkerrand} +\setinterfacecommand{leftmargindistance}{linkemarginalafstand} +\setinterfacecommand{leftmarginwidth}{linkemarginalbreite} +\setinterfacecommand{leg}{leg} +\setinterfacecommand{linewidth}{liniendicke} +\setinterfacecommand{listheight}{listenhoehe} +\setinterfacecommand{listlength}{listenlaenge} +\setinterfacecommand{listsymbol}{listsymbol} +\setinterfacecommand{listwidth}{listenbreite} +\setinterfacecommand{logfields}{registrierefelder} +\setinterfacecommand{lohi}{tiho} +\setinterfacecommand{low}{tief} +\setinterfacecommand{macroname}{name} +\setinterfacecommand{mainlanguage}{hauptsprache} +\setinterfacecommand{makeupheight}{satzhoehe} +\setinterfacecommand{makeupwidth}{satzbreite} +\setinterfacecommand{mar}{mar} +\setinterfacecommand{margindistance}{marginalafstand} +\setinterfacecommand{marginrule}{marginallinie} +\setinterfacecommand{margintext}{marginaltext} +\setinterfacecommand{margintitle}{marginaltitel} +\setinterfacecommand{marginwidth}{marginalbreite} +\setinterfacecommand{marginword}{marginalwort} +\setinterfacecommand{marking}{beschriftung} +\setinterfacecommand{markversion}{beschrifteversion} +\setinterfacecommand{mathematics}{mathematik} +\setinterfacecommand{menubutton}{menueknopf} +\setinterfacecommand{mframed}{maumrise} +\setinterfacecommand{midaligned}{zentriert} +\setinterfacecommand{mirror}{spiegeln} +\setinterfacecommand{month}{monat} +\setinterfacecommand{moveformula}{moveformula} +\setinterfacecommand{moveongrid}{amgitterneuausrichten} +\setinterfacecommand{movesidefloat}{movesidefloat} +\setinterfacecommand{navigating}{navigating} +\setinterfacecommand{nodimension}{keindimension} +\setinterfacecommand{noheaderandfooterlines}{keinekopfundfusszeilen} +\setinterfacecommand{noindenting}{nichteinziehen} +\setinterfacecommand{nolist}{keineliste} +\setinterfacecommand{nomarking}{keinebeschriftung} +\setinterfacecommand{nomoreblocks}{keinebloeckemehr} +\setinterfacecommand{nomorefiles}{keinedateienmehr} +\setinterfacecommand{nop}{nop} +\setinterfacecommand{nospace}{keinspatium} +\setinterfacecommand{note}{notiz} +\setinterfacecommand{notopandbottomlines}{keinzeilenobenundunten} +\setinterfacecommand{notsmallcapped}{nokap} +\setinterfacecommand{nowhitespace}{keinzwischenraum} +\setinterfacecommand{numberofsubpages}{numberofsubpages} +\setinterfacecommand{numbers}{ziffern} +\setinterfacecommand{outeredgedistance}{outeredgedistance} +\setinterfacecommand{outeredgewidth}{outeredgewidth} +\setinterfacecommand{outermargindistance}{outermargindistance} +\setinterfacecommand{outermarginwidth}{outermarginwidth} +\setinterfacecommand{packed}{kleinerdurchschuss} +\setinterfacecommand{page}{seite} +\setinterfacecommand{pagedepth}{pagedepth} +\setinterfacecommand{pagenumber}{seitenummer} +\setinterfacecommand{pageoffset}{pageoffset} +\setinterfacecommand{pagereference}{seitenreferenz} +\setinterfacecommand{pagetype}{seitentyp} +\setinterfacecommand{paperheight}{papierhoehe} +\setinterfacecommand{paperwidth}{papierbreite} +\setinterfacecommand{periods}{punkt} +\setinterfacecommand{plaatsruwelijst}{placerawlist} +\setinterfacecommand{placebookmarks}{platzierebookmarks} +\setinterfacecommand{placecombinedlist}{platzierezusammengestellteliste} +\setinterfacecommand{placefloat}{placefloat} +\setinterfacecommand{placefootnotes}{platzierefussnoten} +\setinterfacecommand{placeformula}{platziereformel} +\setinterfacecommand{placeheadnumber}{placeheadnumber} +\setinterfacecommand{placeheadtext}{placeheadtext} +\setinterfacecommand{placelegend}{platzierelegende} +\setinterfacecommand{placelist}{platziereliste} +\setinterfacecommand{placelocalfootnotes}{platzierelokalefussnoten} +\setinterfacecommand{placelogos}{platzierelogo} +\setinterfacecommand{placeongrid}{amgitterausrichten} +\setinterfacecommand{placeontopofeachother}{platziereuntereinander} +\setinterfacecommand{placepagenumber}{placepagenumber} +\setinterfacecommand{placereferencelist}{placereferencelist} +\setinterfacecommand{placeregister}{platziereregister} +\setinterfacecommand{placerule}{placerule} +\setinterfacecommand{placesidebyside}{platzierenebeneinander} +\setinterfacecommand{placesubformula}{platziereunterformel} +\setinterfacecommand{placetextvariable}{placetextvariable} +\setinterfacecommand{position}{position} +\setinterfacecommand{positiontext}{positiontext} +\setinterfacecommand{printpaperheight}{printpapierhoehe} +\setinterfacecommand{printpaperwidth}{printpapierbreite} +\setinterfacecommand{processblocks}{bearbeitebloecke} +\setinterfacecommand{processpage}{bearbeiteseite} +\setinterfacecommand{product}{produkt} +\setinterfacecommand{program}{programm} +\setinterfacecommand{project}{projekt} +\setinterfacecommand{publication}{publikation} +\setinterfacecommand{quotation}{zitat} +\setinterfacecommand{quote}{zitieren} +\setinterfacecommand{ran}{ran} +\setinterfacecommand{redo}{wiederholen} +\setinterfacecommand{ref}{ref} +\setinterfacecommand{reference}{referenz} +\setinterfacecommand{referral}{verweis} +\setinterfacecommand{referraldate}{verweisdatum} +\setinterfacecommand{referring}{referieren} +\setinterfacecommand{remark}{bemerkung} +\setinterfacecommand{reset}{ruecksetzten} +\setinterfacecommand{resetmarking}{ruecksetztenbeschriftung} +\setinterfacecommand{resetnumber}{resetnumber} +\setinterfacecommand{resettext}{resettextcontent} +\setinterfacecommand{rightaligned}{rechtsbuendig} +\setinterfacecommand{rightedgedistance}{abstandrechterrand} +\setinterfacecommand{rightedgewidth}{breiterechterrand} +\setinterfacecommand{rightmargindistance}{rechtemarginalafstand} +\setinterfacecommand{rightmarginwidth}{rechtemarginalbreite} +\setinterfacecommand{romannumerals}{roemischezahlen} +\setinterfacecommand{rotate}{drehen} +\setinterfacecommand{scale}{format} +\setinterfacecommand{screen}{bildschirm} +\setinterfacecommand{selectblocks}{waehlebloeckeaus} +\setinterfacecommand{selectpaper}{waehlepapieraus} +\setinterfacecommand{selectversion}{waehleversionaus} +\setinterfacecommand{setnumber}{setnumber} +\setinterfacecommand{settextcontent}{settext} +\setinterfacecommand{settextvariable}{settextvariable} +\setinterfacecommand{setupalign}{stelleausrichtungein} +\setinterfacecommand{setupanswerarea}{setupanswerarea} +\setinterfacecommand{setuparranging}{stelleanordnenein} +\setinterfacecommand{setupbackground}{stellehintergrundein} +\setinterfacecommand{setupbackgrounds}{stellehintergruendeein} +\setinterfacecommand{setupblackrules}{stellerechteckein} +\setinterfacecommand{setupblank}{stelleblankoein} +\setinterfacecommand{setupblock}{stelleblockein} +\setinterfacecommand{setupbodyfont}{stellefliesstextein} +\setinterfacecommand{setupbodyfontenvironment}{stellefliesstextumgebungein} +\setinterfacecommand{setupbottom}{stelleuntenein} +\setinterfacecommand{setupbottomtexts}{stelletextuntenein} +\setinterfacecommand{setupbuffer}{stellepufferein} +\setinterfacecommand{setupbuttons}{stelleknopfein} +\setinterfacecommand{setupcapitals}{stelleversalienein} +\setinterfacecommand{setupcaption}{stellebildunterschriftein} +\setinterfacecommand{setupcaptions}{stellebilderunterschriftein} +\setinterfacecommand{setupclipping}{stelleausschnittein} +\setinterfacecommand{setupcolor}{stellefarbeein} +\setinterfacecommand{setupcolors}{stellefarbenein} +\setinterfacecommand{setupcolumns}{stellespaltenein} +\setinterfacecommand{setupcolumnset}{setupcolumnset} +\setinterfacecommand{setupcolumnsetlines}{setupcolumnsetlines} +\setinterfacecommand{setupcolumnsetstart}{setupcolumnsetstart} +\setinterfacecommand{setupcombinations}{stellekombinationein} +\setinterfacecommand{setupcombinedlist}{stellezusammengestelltelisteein} +\setinterfacecommand{setupcomment}{stellekommentarein} +\setinterfacecommand{setupdescriptions}{definierebeschreibungen} +\setinterfacecommand{setupenumerations}{stellebeschreibungein} +\setinterfacecommand{setupexternalfigures}{stelleexterneabbildungenein} +\setinterfacecommand{setupfield}{stellefeldein} +\setinterfacecommand{setupfields}{stellefelderin} +\setinterfacecommand{setupfillinlines}{stellegefuelltezeileein} +\setinterfacecommand{setupfillinrules}{stellegefuelltesrechteckein} +\setinterfacecommand{setupfloat}{stellegleitobjektein} +\setinterfacecommand{setupfloats}{stellegleitobjekteein} +\setinterfacecommand{setupfloatsplitting}{stelleplatziegeteiltegleitobjekt} +\setinterfacecommand{setupfooter}{stellefusszeileein} +\setinterfacecommand{setupfootertexts}{stellefusszeilentextein} +\setinterfacecommand{setupfootnotedefinition}{stellefussnotendefinitionein} +\setinterfacecommand{setupfootnotes}{stellefussnotenein} +\setinterfacecommand{setupforms}{setupforms} +\setinterfacecommand{setupformulas}{stelleformelnein} +\setinterfacecommand{setupframed}{stelleumrahmtein} +\setinterfacecommand{setupframedtexts}{stelleumrahmtetexteein} +\setinterfacecommand{setuphead}{stelleueberschriftein} +\setinterfacecommand{setupheader}{stellekopfzeileein} +\setinterfacecommand{setupheadertexts}{stellekopfzeilentextein} +\setinterfacecommand{setupheadnumber}{stellekopfzahlein} +\setinterfacecommand{setupheads}{stelleueberschriftenein} +\setinterfacecommand{setupheadtext}{stelleueberschrifttextein} +\setinterfacecommand{setuphyphenmark}{stellebindestrichein} +\setinterfacecommand{setupindentations}{stelleeinzuegein} +\setinterfacecommand{setupindenting}{stelleeinziehenein} +\setinterfacecommand{setupinmargin}{stelleinmarginalieein} +\setinterfacecommand{setupinteraction}{stelleinteraktionein} +\setinterfacecommand{setupinteractionbar}{stelleinteraktionsbalkenein} +\setinterfacecommand{setupinteractionmenu}{stelleinteraktionsmenueein} +\setinterfacecommand{setupinteractionscreen}{stelleinteraktionsbildschirmein} +\setinterfacecommand{setupinterlinespace}{stellezeilenabstandein} +\setinterfacecommand{setupitemgroup}{setupitemgroup} +\setinterfacecommand{setupitemgroups}{stelleaufzaehlungenein} +\setinterfacecommand{setupitems}{stellepostenein} +\setinterfacecommand{setuplabeltext}{stellelabeltextein} +\setinterfacecommand{setuplanguage}{stellespracheein} +\setinterfacecommand{setuplayout}{stellelayoutein} +\setinterfacecommand{setuplegend}{stellelegendeein} +\setinterfacecommand{setuplinenumbering}{stellezeilennumerierungein} +\setinterfacecommand{setuplines}{stellezeilenein} +\setinterfacecommand{setuplinewidth}{stellelinienbreiteein} +\setinterfacecommand{setuplist}{stellelisteein} +\setinterfacecommand{setupmakeup}{stelleumbruchein} +\setinterfacecommand{setupmarginblocks}{stellemarginalblockein} +\setinterfacecommand{setupmarginrules}{stellemarginallinieein} +\setinterfacecommand{setupmarking}{stellebeschriftungein} +\setinterfacecommand{setupmathalignment}{setupmathalignment} +\setinterfacecommand{setupnarrower}{stelleengerein} +\setinterfacecommand{setupnumber}{setupnumber} +\setinterfacecommand{setupnumbering}{stellenummerierungein} +\setinterfacecommand{setupoppositeplacing}{stellegegenueberplatzierenein} +\setinterfacecommand{setupoutput}{stelleausgabeein} +\setinterfacecommand{setuppagecomment}{stelleseitenkommentarein} +\setinterfacecommand{setuppagenumber}{stelleseitennummerein} +\setinterfacecommand{setuppagenumbering}{stelleseitennummeriernungein} +\setinterfacecommand{setuppagetransitions}{stelleseitenuebergangein} +\setinterfacecommand{setuppalet}{stellepaletteein} +\setinterfacecommand{setuppaper}{setuppaper} +\setinterfacecommand{setuppapersize}{stellepapierformatein} +\setinterfacecommand{setupparagraphnumbering}{stelleabsatznummerierungein} +\setinterfacecommand{setupparagraphs}{stelleabsaetzeein} +\setinterfacecommand{setupplacement}{setupplacement} +\setinterfacecommand{setuppositioning}{stellepositionierenein} +\setinterfacecommand{setupprofiles}{stelleprofilein} +\setinterfacecommand{setupprograms}{stelleprogrammein} +\setinterfacecommand{setuppublications}{stellepublikationein} +\setinterfacecommand{setupquote}{stellezitierenein} +\setinterfacecommand{setupreferencelist}{stellereferenzlisteein} +\setinterfacecommand{setupreferencing}{stellereferenzierenein} +\setinterfacecommand{setupregister}{stelleregisterein} +\setinterfacecommand{setuprotate}{stelledrehenein} +\setinterfacecommand{setuprule}{setuprule} +\setinterfacecommand{setups}{einstellungen} +\setinterfacecommand{setupscreens}{stellerasterein} +\setinterfacecommand{setupsection}{stelleabschnittein} +\setinterfacecommand{setupsectionblock}{stelleabschnittsblockein} +\setinterfacecommand{setupsorting}{stellesortierenein} +\setinterfacecommand{setupspacing}{stellespatiumein} +\setinterfacecommand{setupstartstop}{setupstartstop} +\setinterfacecommand{setupstrut}{setupstrut} +\setinterfacecommand{setupsubpagenumber}{stelleunterseitennummerein} +\setinterfacecommand{setupsymbolset}{stellesymbolsetein} +\setinterfacecommand{setupsynchronization}{stellesynchronisationein} +\setinterfacecommand{setupsynchronizationbar}{stellesynchronisationsbalkenein} +\setinterfacecommand{setupsynonyms}{stellesynonymein} +\setinterfacecommand{setupsystem}{stellesystemein} +\setinterfacecommand{setuptab}{stelletabein} +\setinterfacecommand{setuptables}{stelletabellenein} +\setinterfacecommand{setuptabulate}{stelletabulatorein} +\setinterfacecommand{setuptext}{stelletextein} +\setinterfacecommand{setuptextposition}{setuptextposition} +\setinterfacecommand{setuptextrules}{stelletextumrissein} +\setinterfacecommand{setuptexttexts}{stelletexttexteein} +\setinterfacecommand{setuptextvariable}{setuptextvariable} +\setinterfacecommand{setupthinrules}{stelleduennerumrissein} +\setinterfacecommand{setuptolerance}{stelletoleranzein} +\setinterfacecommand{setuptop}{stellenobenein} +\setinterfacecommand{setuptoptexts}{stelletextobenein} +\setinterfacecommand{setuptype}{stelletipein} +\setinterfacecommand{setuptyping}{stelletippenein} +\setinterfacecommand{setupunderbar}{stelleunterstreichenein} +\setinterfacecommand{setupurl}{stelleurlein} +\setinterfacecommand{setupversions}{stelleversionein} +\setinterfacecommand{setupwhitespace}{stellezwischenraumein} +\setinterfacecommand{showbodyfont}{zeigefliesstext} +\setinterfacecommand{showbodyfontenvironment}{zeigefliesstextumgebung} +\setinterfacecommand{showcolor}{zeigefarbe} +\setinterfacecommand{showcolorgroup}{zeigefarbengruppe} +\setinterfacecommand{showexternalfigures}{zeigeexterneabbildungen} +\setinterfacecommand{showfields}{zeigefelder} +\setinterfacecommand{showframe}{zeigerahmen} +\setinterfacecommand{showgrid}{zeigegitter} +\setinterfacecommand{showlayout}{zeigelayout} +\setinterfacecommand{showmakeup}{zeigeumbruch} +\setinterfacecommand{showpalet}{zeigepalette} +\setinterfacecommand{showprint}{zeigedruck} +\setinterfacecommand{showsetups}{zeigeeinstellungen} +\setinterfacecommand{showstruts}{zeigestruts} +\setinterfacecommand{showsymbolset}{showsymbolset} +\setinterfacecommand{smallcapped}{kap} +\setinterfacecommand{someline}{einezeile} +\setinterfacecommand{somewhere}{irgendwo} +\setinterfacecommand{space}{spatium} +\setinterfacecommand{splitfloat}{teilegleitobjekt} +\setinterfacecommand{startalignment}{startausrichtung} +\setinterfacecommand{startbackground}{starthintergrund} +\setinterfacecommand{startcoding}{startkodierung} +\setinterfacecommand{startcolor}{startfarbe} +\setinterfacecommand{startcolumnmakeup}{startcolumnmakeup} +\setinterfacecommand{startcolumns}{startspalten} +\setinterfacecommand{startcolumnset}{startcolumnset} +\setinterfacecommand{startcombination}{startkombination} +\setinterfacecommand{startcomponent}{startkomponente} +\setinterfacecommand{startdocument}{startdokument} +\setinterfacecommand{startenvironment}{startumgebung} +\setinterfacecommand{startfigure}{startabbildung} +\setinterfacecommand{startglobal}{startglobal} +\setinterfacecommand{startline}{startzeile} +\setinterfacecommand{startlinecorrection}{startzeilenkorrektur} +\setinterfacecommand{startlinenumbering}{startzeilennumerierung} +\setinterfacecommand{startlines}{startzeilen} +\setinterfacecommand{startlocal}{startlokal} +\setinterfacecommand{startlocalfootnotes}{startlokalefussnoten} +\setinterfacecommand{startmakeup}{startumbruch} +\setinterfacecommand{startmarginblock}{startmarginalblock} +\setinterfacecommand{startmarginrule}{startmarginallinie} +\setinterfacecommand{startnarrower}{startenger} +\setinterfacecommand{startopposite}{startgegenueber} +\setinterfacecommand{startoverlay}{startoverlay} +\setinterfacecommand{startoverzicht}{startueberblick} +\setinterfacecommand{startpacked}{startkleinerdurchschuss} +\setinterfacecommand{startpositioning}{startpositionieren} +\setinterfacecommand{startproduct}{startprodukt} +\setinterfacecommand{startprofile}{startprofil} +\setinterfacecommand{startproject}{startprojekt} +\setinterfacecommand{startquotation}{startzitat} +\setinterfacecommand{startraster}{startraster} +\setinterfacecommand{startsymbolset}{startsymbolset} +\setinterfacecommand{startsynchronization}{startsynchronisation} +\setinterfacecommand{starttable}{starttabelle} +\setinterfacecommand{starttables}{starttabellen} +\setinterfacecommand{starttext}{starttext} +\setinterfacecommand{starttextrule}{starttextlinie} +\setinterfacecommand{startunpacked}{startgrosserdurchschuss} +\setinterfacecommand{startversion}{startversion} +\setinterfacecommand{stopalignment}{stopausrichtung} +\setinterfacecommand{stopbackground}{stophintergrund} +\setinterfacecommand{stopcoding}{stopkodierung} +\setinterfacecommand{stopcolor}{stopfarbe} +\setinterfacecommand{stopcolumnmakeup}{stopcolumnmakeup} +\setinterfacecommand{stopcolumns}{stopspalten} +\setinterfacecommand{stopcolumnset}{stopcolumnset} +\setinterfacecommand{stopcombination}{stopkombination} +\setinterfacecommand{stopcomponent}{stopkomponente} +\setinterfacecommand{stopdocument}{stopdokument} +\setinterfacecommand{stopenvironment}{stopumgebung} +\setinterfacecommand{stopglobal}{stopglobal} +\setinterfacecommand{stopline}{stopzeile} +\setinterfacecommand{stoplinecorrection}{stopzeilenkorrektur} +\setinterfacecommand{stoplinenumbering}{stopzeilennumerierung} +\setinterfacecommand{stoplines}{stopzeilen} +\setinterfacecommand{stoplocal}{stoplokal} +\setinterfacecommand{stoplocalfootnotes}{stoplokalefussnoten} +\setinterfacecommand{stopmakeup}{stopumbruch} +\setinterfacecommand{stopmarginblock}{stopmarginalblock} +\setinterfacecommand{stopmarginrule}{stopmarginallinie} +\setinterfacecommand{stopnarrower}{stopenger} +\setinterfacecommand{stopopposite}{stopgegenueber} +\setinterfacecommand{stopoverlay}{stopoverlay} +\setinterfacecommand{stopoverzicht}{stopueberblick} +\setinterfacecommand{stoppacked}{stopkleinerdurchschuss} +\setinterfacecommand{stoppositioning}{stoppositionieren} +\setinterfacecommand{stopproduct}{stopprodukt} +\setinterfacecommand{stopprofile}{stopprofil} +\setinterfacecommand{stopproject}{stopprojekt} +\setinterfacecommand{stopquotation}{stopzitat} +\setinterfacecommand{stopraster}{stopraster} +\setinterfacecommand{stopsynchronization}{stopsynchronisation} +\setinterfacecommand{stoptable}{stoptabelle} +\setinterfacecommand{stoptables}{stoptabellen} +\setinterfacecommand{stoptext}{stoptext} +\setinterfacecommand{stoptextrule}{stoptextlinie} +\setinterfacecommand{stopunpacked}{stopgrosserdurchschuss} +\setinterfacecommand{stopversion}{stopversion} +\setinterfacecommand{stretched}{gestreckt} +\setinterfacecommand{subformulanumber}{unterformelnummer} +\setinterfacecommand{subpagenumber}{subpagenumber} +\setinterfacecommand{switchtobodyfont}{wechselezumfliesstext} +\setinterfacecommand{switchtorawfont}{switchtorawfont} +\setinterfacecommand{sym}{sym} +\setinterfacecommand{symbol}{symbol} +\setinterfacecommand{synchronizationbar}{synchronisationsbalken} +\setinterfacecommand{synchronize}{synchronisieren} +\setinterfacecommand{tab}{tab} +\setinterfacecommand{testcolumn}{testcolumn} +\setinterfacecommand{testpage}{testpage} +\setinterfacecommand{tex}{tex} +\setinterfacecommand{textheight}{texthoehe} +\setinterfacecommand{textreference}{textreferenz} +\setinterfacecommand{textrule}{textlinie} +\setinterfacecommand{textvariable}{textvariable} +\setinterfacecommand{textwidth}{textbreite} +\setinterfacecommand{thinrule}{duennelinie} +\setinterfacecommand{thinrules}{duennerumriss} +\setinterfacecommand{tooltip}{tooltip} +\setinterfacecommand{topdistance}{abstandoben} +\setinterfacecommand{topheight}{hoeheoben} +\setinterfacecommand{topspace}{kopfweite} +\setinterfacecommand{totalnumberofpages}{gesamtseitenanzahl} +\setinterfacecommand{translate}{uebersetzten} +\setinterfacecommand{txt}{txt} +\setinterfacecommand{typ}{tip} +\setinterfacecommand{type}{tippen} +\setinterfacecommand{typebuffer}{tippepuffer} +\setinterfacecommand{typefile}{tippedatei} +\setinterfacecommand{unitmeaning}{bedeutung} +\setinterfacecommand{unknown}{unbekant} +\setinterfacecommand{useJSscripts}{verwendeJSscript} +\setinterfacecommand{useURL}{verwendeURL} +\setinterfacecommand{useXMLfilter}{useXMLfilter} +\setinterfacecommand{useblocks}{verwendebloecke} +\setinterfacecommand{usecommands}{verwendebefehl} +\setinterfacecommand{useencoding}{benutzekodierung} +\setinterfacecommand{useexternaldocument}{verwendeexteresdokument} +\setinterfacecommand{useexternalfigure}{verwendeexterneabbildung} +\setinterfacecommand{useexternalfile}{verwendeexternedatei} +\setinterfacecommand{useexternalfiles}{verwendeexternedateien} +\setinterfacecommand{useexternalsoundtrack}{verwendeexternestonstueck} +\setinterfacecommand{usemodule}{verwendemodul} +\setinterfacecommand{usemodules}{verwendemodule} +\setinterfacecommand{usepath}{benutzeverzeichnis} +\setinterfacecommand{usereferences}{verwendereferenzen} +\setinterfacecommand{usespecials}{benutzespezielles} +\setinterfacecommand{usesymbols}{verwendesymbole} +\setinterfacecommand{usetypescript}{usetypescript} +\setinterfacecommand{usetypescriptfile}{usetypescriptfile} +\setinterfacecommand{useurl}{verwendeurl} +\setinterfacecommand{version}{version} +\setinterfacecommand{vl}{vl} +\setinterfacecommand{weekday}{wochentag} +\setinterfacecommand{whitespace}{zwischenraum} +\setinterfacecommand{wordright}{wortrechts} +\setinterfacecommand{writebetweenlist}{schreibezwischenliste} +\setinterfacecommand{writetolist}{schreibezurliste} +\setinterfacecommand{writetoreferencelist}{schreibezurreferenzliste} +\setinterfacecommand{writetoregister}{schreibezumregister} +% +\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-de.tex b/Master/texmf-dist/tex/context/base/mult-de.tex deleted file mode 100644 index f6f4f3bf9d1..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-de.tex +++ /dev/null @@ -1,1693 +0,0 @@ -% this file is auto-generated, don't edit this file -% -% definitions for interface variables for language de -% -\setinterfacevariable{Addition}{Zusatz} -\setinterfacevariable{Balloon}{Ballon} -\setinterfacevariable{Character}{Buchstabe} -\setinterfacevariable{Characters}{Buchstaben} -\setinterfacevariable{CloseDocument}{SchliesseDokument} -\setinterfacevariable{ExitViewer}{BeendeViewer} -\setinterfacevariable{FirstPage}{ErsteSeite} -\setinterfacevariable{FitHeight}{HoehePassend} -\setinterfacevariable{FitWidth}{BreitePassend} -\setinterfacevariable{GotoPage}{GotoPage} -\setinterfacevariable{Greek}{Griechisch} -\setinterfacevariable{Help}{Hilfe} -\setinterfacevariable{HideField}{VerbergeFeld} -\setinterfacevariable{HideLayer}{HideLayer} -\setinterfacevariable{Key}{Schluessel} -\setinterfacevariable{LastPage}{LetzteSeite} -\setinterfacevariable{LoadForm}{LadeFormular} -\setinterfacevariable{MONTH}{MONAT} -\setinterfacevariable{New}{Neu} -\setinterfacevariable{NextJump}{NaechsterSprung} -\setinterfacevariable{NextPage}{FolgendeSeite} -\setinterfacevariable{Numbers}{Ziffern} -\setinterfacevariable{OpenNamedDocument}{OpenNamedDocument} -\setinterfacevariable{Paragraph}{Absatz} -\setinterfacevariable{PauseMovie}{PauseFilm} -\setinterfacevariable{PauseRendering}{PauseRendering} -\setinterfacevariable{PauseSound}{PauseSound} -\setinterfacevariable{PreviousJump}{VorigerSprung} -\setinterfacevariable{PreviousPage}{VorigeSeite} -\setinterfacevariable{PrintDocument}{DruckeDokument} -\setinterfacevariable{Query}{Query} -\setinterfacevariable{QueryAgain}{QueryAgain} -\setinterfacevariable{ResetForm}{ZuruecksetzenFormular} -\setinterfacevariable{ResumeMovie}{FortsetzenFilm} -\setinterfacevariable{ResumeRendering}{ResumeRendering} -\setinterfacevariable{ResumeSound}{ResumeSound} -\setinterfacevariable{Romannumerals}{Roemischezahlen} -\setinterfacevariable{SaveDocument}{SpeichereDokument} -\setinterfacevariable{SaveForm}{SpeicheFormular} -\setinterfacevariable{SaveNamedDocument}{SaveNamedDocument} -\setinterfacevariable{SearchAgain}{WeiterSuchen} -\setinterfacevariable{SearchDocument}{DokumentDurchsuchen} -\setinterfacevariable{ShowBookmarks}{ShowBookmarks} -\setinterfacevariable{ShowField}{ZeigeFeld} -\setinterfacevariable{ShowThumbs}{ShowThumbs} -\setinterfacevariable{StartMovie}{StartFilm} -\setinterfacevariable{StartRendering}{StartRendering} -\setinterfacevariable{StartSound}{StartSound} -\setinterfacevariable{StopMovie}{StopFilm} -\setinterfacevariable{StopRendering}{StopRendering} -\setinterfacevariable{StopSound}{StopSound} -\setinterfacevariable{SubmitForm}{VersendeFormular} -\setinterfacevariable{ToggleLayer}{ToggleLayer} -\setinterfacevariable{ToggleViewer}{WechseleViewer} -\setinterfacevariable{URL}{URL} -\setinterfacevariable{VideLayer}{VideLayer} -\setinterfacevariable{ViewerHelp}{ViewerHilfe} -\setinterfacevariable{WEEKDAY}{WOCHENTAG} -\setinterfacevariable{WORD}{WORT} -\setinterfacevariable{abbreviation}{abkuerzung} -\setinterfacevariable{abbreviations}{abkuerzungen} -\setinterfacevariable{absolute}{absolut} -\setinterfacevariable{action}{aktion} -\setinterfacevariable{after}{nach} -\setinterfacevariable{all}{alles} -\setinterfacevariable{always}{immer} -\setinterfacevariable{answerarea}{answerarea} -\setinterfacevariable{appendices}{anhaenge} -\setinterfacevariable{appendix}{anhang} -\setinterfacevariable{april}{April} -\setinterfacevariable{atmargin}{amrand} -\setinterfacevariable{atpage}{aufseite} -\setinterfacevariable{august}{August} -\setinterfacevariable{author}{autor} -\setinterfacevariable{auto}{auto} -\setinterfacevariable{autointro}{autointro} -\setinterfacevariable{back}{zurueck} -\setinterfacevariable{background}{hintergrund} -\setinterfacevariable{backmatter}{epiloge} -\setinterfacevariable{backpart}{epilog} -\setinterfacevariable{backspace}{rumpfspatium} -\setinterfacevariable{backward}{rueckwaerts} -\setinterfacevariable{bbl}{bbl} -\setinterfacevariable{before}{vor} -\setinterfacevariable{begin}{begin} -\setinterfacevariable{bib}{bib} -\setinterfacevariable{big}{gross} -\setinterfacevariable{bigbodyfont}{bigbodyfont} -\setinterfacevariable{bigpreference}{grosszuegig} -\setinterfacevariable{blank}{blanko} -\setinterfacevariable{blockquote}{blockquote} -\setinterfacevariable{bodymatter}{haupttexte} -\setinterfacevariable{bodypart}{haupttext} -\setinterfacevariable{bold}{fett} -\setinterfacevariable{bolditalic}{fettitalic} -\setinterfacevariable{boldslanted}{fettgeneigt} -\setinterfacevariable{bookmark}{bookmark} -\setinterfacevariable{both}{beide} -\setinterfacevariable{bottom}{unten} -\setinterfacevariable{brief}{brief} -\setinterfacevariable{broad}{breit} -\setinterfacevariable{buffer}{puffer} -\setinterfacevariable{by}{pro} -\setinterfacevariable{calligraphic}{kalligraphie} -\setinterfacevariable{cap}{kap} -\setinterfacevariable{capital}{versalien} -\setinterfacevariable{center}{center} -\setinterfacevariable{chapter}{kapitel} -\setinterfacevariable{character}{buchstabe} -\setinterfacevariable{characters}{buchstaben} -\setinterfacevariable{cite}{cite} -\setinterfacevariable{color}{farbe} -\setinterfacevariable{column}{column} -\setinterfacevariable{columns}{spalten} -\setinterfacevariable{command}{befehl} -\setinterfacevariable{commands}{befehle} -\setinterfacevariable{comment}{kommentar} -\setinterfacevariable{component}{komponente} -\setinterfacevariable{concept}{konzept} -\setinterfacevariable{content}{inhalt} -\setinterfacevariable{contents}{inhalte} -\setinterfacevariable{continue}{fortsetzten} -\setinterfacevariable{controls}{controls} -\setinterfacevariable{conversion}{konversion} -\setinterfacevariable{current}{aktuell} -\setinterfacevariable{cutspace}{cutspace} -\setinterfacevariable{date}{datum} -\setinterfacevariable{day}{tag} -\setinterfacevariable{december}{Dezember} -\setinterfacevariable{default}{default} -\setinterfacevariable{depth}{tiefe} -\setinterfacevariable{description}{beschreibung} -\setinterfacevariable{disable}{sperren} -\setinterfacevariable{display}{bildschirm} -\setinterfacevariable{dot}{punkt} -\setinterfacevariable{doublesided}{doppelseitig} -\setinterfacevariable{down}{down} -\setinterfacevariable{each}{jede} -\setinterfacevariable{edge}{kante} -\setinterfacevariable{empty}{leer} -\setinterfacevariable{end}{end} -\setinterfacevariable{endnote}{endnote} -\setinterfacevariable{enumeration}{nummerierung} -\setinterfacevariable{environment}{umgebung} -\setinterfacevariable{even}{gerade} -\setinterfacevariable{external}{extern} -\setinterfacevariable{fact}{gegeben} -\setinterfacevariable{february}{Februar} -\setinterfacevariable{figure}{abbildung} -\setinterfacevariable{figures}{abbildungen} -\setinterfacevariable{file}{datei} -\setinterfacevariable{final}{endfassung} -\setinterfacevariable{first}{erste} -\setinterfacevariable{firstcolumn}{firstcolumn} -\setinterfacevariable{firstpage}{ersteseite} -\setinterfacevariable{firstsubpage}{ersteunterseite} -\setinterfacevariable{fit}{passend} -\setinterfacevariable{five}{fuenf} -\setinterfacevariable{fix}{stellewiederher} -\setinterfacevariable{fixed}{fest} -\setinterfacevariable{flexible}{flexibel} -\setinterfacevariable{float}{gleitobjekt} -\setinterfacevariable{flushinner}{flushinner} -\setinterfacevariable{flushleft}{flushleft} -\setinterfacevariable{flushouter}{flushouter} -\setinterfacevariable{flushright}{flushright} -\setinterfacevariable{footer}{fusszeile} -\setinterfacevariable{footnote}{fussnote} -\setinterfacevariable{force}{zwinge} -\setinterfacevariable{foreground}{vordergrund} -\setinterfacevariable{formeel}{formeel} -\setinterfacevariable{formula}{formel} -\setinterfacevariable{formulae}{formeln} -\setinterfacevariable{forward}{vorwaerts} -\setinterfacevariable{four}{vier} -\setinterfacevariable{frame}{rahmen} -\setinterfacevariable{framedtext}{umrahmtertext} -\setinterfacevariable{friday}{freitag} -\setinterfacevariable{frontmatter}{einleitungen} -\setinterfacevariable{frontpart}{einleitung} -\setinterfacevariable{global}{global} -\setinterfacevariable{graphic}{grafik} -\setinterfacevariable{graphics}{grafiken} -\setinterfacevariable{gray}{grau} -\setinterfacevariable{greek}{griechisch} -\setinterfacevariable{grid}{gritter} -\setinterfacevariable{halfline}{halbezeile} -\setinterfacevariable{handwritten}{handschrift} -\setinterfacevariable{hang}{haengend} -\setinterfacevariable{hanging}{haengend} -\setinterfacevariable{head}{kopf} -\setinterfacevariable{header}{kopfzeile} -\setinterfacevariable{height}{hoehe} -\setinterfacevariable{helptext}{hilfetext} -\setinterfacevariable{hencefore}{vorher} -\setinterfacevariable{here}{hier} -\setinterfacevariable{hereafter}{nachher} -\setinterfacevariable{hidden}{versteckt} -\setinterfacevariable{hiding}{verbergen} -\setinterfacevariable{high}{hoch} -\setinterfacevariable{horizontal}{horizontal} -\setinterfacevariable{hyphenated}{hyphenate} -\setinterfacevariable{hz}{hz} -\setinterfacevariable{inbetween}{zwischen} -\setinterfacevariable{index}{index} -\setinterfacevariable{indices}{indizies} -\setinterfacevariable{informeel}{informeel} -\setinterfacevariable{inherit}{inherit} -\setinterfacevariable{inleft}{imlinken} -\setinterfacevariable{inmargin}{imrand} -\setinterfacevariable{inner}{innen} -\setinterfacevariable{inneredge}{inneredge} -\setinterfacevariable{innermargin}{innermargin} -\setinterfacevariable{inright}{imrechten} -\setinterfacevariable{interaction}{interaktion} -\setinterfacevariable{interactionmenu}{interaktionsmenue} -\setinterfacevariable{intermezzi}{intermezzi} -\setinterfacevariable{intermezzo}{intermezzo} -\setinterfacevariable{intext}{imtext} -\setinterfacevariable{intro}{intro} -\setinterfacevariable{italic}{italic} -\setinterfacevariable{italicbold}{italicfett} -\setinterfacevariable{item}{pos} -\setinterfacevariable{itemize}{aufzaehlung} -\setinterfacevariable{its}{its} -\setinterfacevariable{january}{Januar} -\setinterfacevariable{joinedup}{keinabstand} -\setinterfacevariable{july}{Juli} -\setinterfacevariable{june}{Juni} -\setinterfacevariable{keep}{behalte} -\setinterfacevariable{knockout}{knockout} -\setinterfacevariable{label}{label} -\setinterfacevariable{landscape}{querformat} -\setinterfacevariable{last}{letzte} -\setinterfacevariable{lastcolumn}{lastcolumn} -\setinterfacevariable{lastpage}{letzteseite} -\setinterfacevariable{lastpagenumber}{lastpagenumber} -\setinterfacevariable{lastsubpage}{letzteunterseite} -\setinterfacevariable{layer}{layer} -\setinterfacevariable{left}{links} -\setinterfacevariable{leftedge}{linkekante} -\setinterfacevariable{lefthanging}{lefthanging} -\setinterfacevariable{leftmargin}{linkerrand} -\setinterfacevariable{leftpage}{linkerseite} -\setinterfacevariable{lefttoright}{lefttoright} -\setinterfacevariable{legend}{legende} -\setinterfacevariable{lesshyphenation}{lesshyphenation} -\setinterfacevariable{line}{zeile} -\setinterfacevariable{linenote}{linenote} -\setinterfacevariable{lines}{zeilen} -\setinterfacevariable{list}{liste} -\setinterfacevariable{local}{lokal} -\setinterfacevariable{localenvironment}{lokaleumgebung} -\setinterfacevariable{logo}{logo} -\setinterfacevariable{logos}{logos} -\setinterfacevariable{lohi}{hoti} -\setinterfacevariable{loose}{lose} -\setinterfacevariable{low}{tief} -\setinterfacevariable{ls}{ls} -\setinterfacevariable{makeup}{umbruch} -\setinterfacevariable{mar}{mar} -\setinterfacevariable{march}{Maerz} -\setinterfacevariable{margin}{marginalie} -\setinterfacevariable{marginedge}{marginalkante} -\setinterfacevariable{margintitle}{marginaltitel} -\setinterfacevariable{marking}{beschriftung} -\setinterfacevariable{mathalignment}{mathalignment} -\setinterfacevariable{mathcases}{mathcases} -\setinterfacevariable{mathmatrix}{mathmatrix} -\setinterfacevariable{max}{max} -\setinterfacevariable{maxdepth}{maxdepth} -\setinterfacevariable{maxheight}{maxheight} -\setinterfacevariable{maxwidth}{maxwidth} -\setinterfacevariable{may}{Mai} -\setinterfacevariable{mediaeval}{mittelalterlich} -\setinterfacevariable{medium}{mittel} -\setinterfacevariable{middle}{mittig} -\setinterfacevariable{min}{min} -\setinterfacevariable{mindepth}{mindepth} -\setinterfacevariable{minheight}{minhoehe} -\setinterfacevariable{minwidth}{minbreite} -\setinterfacevariable{mirrored}{gespiegelt} -\setinterfacevariable{monday}{montag} -\setinterfacevariable{mono}{mono} -\setinterfacevariable{month}{monat} -\setinterfacevariable{morehyphenation}{morehyphenation} -\setinterfacevariable{name}{name} -\setinterfacevariable{narrow}{schmall} -\setinterfacevariable{negative}{negativ} -\setinterfacevariable{never}{nie} -\setinterfacevariable{new}{neu} -\setinterfacevariable{next}{folgende} -\setinterfacevariable{nextevenpage}{naechstegeradeseite} -\setinterfacevariable{nextoddpage}{naechsteungeradeseite} -\setinterfacevariable{nextpage}{folgendeseite} -\setinterfacevariable{nextsubpage}{folgendeunterseite} -\setinterfacevariable{no}{nein} -\setinterfacevariable{nocheck}{nocheck} -\setinterfacevariable{nofit}{nofit} -\setinterfacevariable{nogrid}{nogrid} -\setinterfacevariable{nohz}{nohz} -\setinterfacevariable{nomarking}{keinebeschriftung} -\setinterfacevariable{none}{kein} -\setinterfacevariable{nonumber}{nonumber} -\setinterfacevariable{normal}{normal} -\setinterfacevariable{nospacing}{nospacing} -\setinterfacevariable{not}{nicht} -\setinterfacevariable{note}{note} -\setinterfacevariable{nothanging}{nothanging} -\setinterfacevariable{nothyphenated}{nothyphenated} -\setinterfacevariable{november}{November} -\setinterfacevariable{nowhere}{nirgens} -\setinterfacevariable{nowhite}{keinweiss} -\setinterfacevariable{number}{nummer} -\setinterfacevariable{numbers}{ziffern} -\setinterfacevariable{october}{Oktober} -\setinterfacevariable{odd}{ungerade} -\setinterfacevariable{off}{aus} -\setinterfacevariable{offset}{offset} -\setinterfacevariable{old}{old} -\setinterfacevariable{on}{an} -\setinterfacevariable{one}{eins} -\setinterfacevariable{opposite}{gegenueber} -\setinterfacevariable{outer}{aussen} -\setinterfacevariable{outeredge}{outeredge} -\setinterfacevariable{outermargin}{outermargin} -\setinterfacevariable{overbar}{ueberstrichen} -\setinterfacevariable{overbars}{ueberstreichen} -\setinterfacevariable{overlay}{overlay} -\setinterfacevariable{overprint}{overprint} -\setinterfacevariable{overstrike}{durchgestrichen} -\setinterfacevariable{overstrikes}{durchstreichen} -\setinterfacevariable{packed}{gepackt} -\setinterfacevariable{page}{seite} -\setinterfacevariable{pagecomment}{pagecomment} -\setinterfacevariable{pagenumber}{seitennummer} -\setinterfacevariable{paper}{papier} -\setinterfacevariable{paragraph}{absatz} -\setinterfacevariable{part}{teil} -\setinterfacevariable{positive}{positiv} -\setinterfacevariable{postponing}{verschieben} -\setinterfacevariable{postscript}{postscript} -\setinterfacevariable{preference}{einstellung} -\setinterfacevariable{preview}{vorschau} -\setinterfacevariable{previous}{vorig} -\setinterfacevariable{previousevenpage}{vorigegeradeseite} -\setinterfacevariable{previousoddpage}{vorigeungeradeseite} -\setinterfacevariable{previouspage}{vorigeseite} -\setinterfacevariable{previoussubpage}{vorigeunterseite} -\setinterfacevariable{printable}{druckbar} -\setinterfacevariable{process}{process} -\setinterfacevariable{product}{produkt} -\setinterfacevariable{program}{programm} -\setinterfacevariable{project}{projekt} -\setinterfacevariable{protected}{geschuetzt} -\setinterfacevariable{quadruple}{viertel} -\setinterfacevariable{quotation}{zitat} -\setinterfacevariable{quote}{zitieren} -\setinterfacevariable{ran}{ran} -\setinterfacevariable{random}{zufaellig} -\setinterfacevariable{readonly}{nurlesbar} -\setinterfacevariable{rectangular}{rechteckig} -\setinterfacevariable{referral}{merkmal} -\setinterfacevariable{register}{register} -\setinterfacevariable{regular}{regular} -\setinterfacevariable{rekening}{rekening} -\setinterfacevariable{relative}{relativ} -\setinterfacevariable{repeat}{wiederholen} -\setinterfacevariable{required}{obligatorisch} -\setinterfacevariable{reset}{zuruecksetzten} -\setinterfacevariable{reverse}{reverse} -\setinterfacevariable{right}{rechts} -\setinterfacevariable{rightedge}{rechterkante} -\setinterfacevariable{righthanging}{righthanging} -\setinterfacevariable{rightmargin}{rechterrand} -\setinterfacevariable{rightpage}{rechterseite} -\setinterfacevariable{righttoleft}{righttoleft} -\setinterfacevariable{roman}{antiqua} -\setinterfacevariable{romannumerals}{roemischezahlen} -\setinterfacevariable{rotate}{drehe} -\setinterfacevariable{rotated}{gedreht} -\setinterfacevariable{round}{rund} -\setinterfacevariable{row}{row} -\setinterfacevariable{rule}{linie} -\setinterfacevariable{samepage}{selbeseite} -\setinterfacevariable{sans}{sans} -\setinterfacevariable{sansbold}{sansfett} -\setinterfacevariable{sansserif}{grotesk} -\setinterfacevariable{saturday}{samstag} -\setinterfacevariable{screen}{raster} -\setinterfacevariable{section}{absatz} -\setinterfacevariable{sectionblockenvironment}{sectionblockenvironment} -\setinterfacevariable{sectionnumber}{abschnittsnummer} -\setinterfacevariable{see}{sieh} -\setinterfacevariable{september}{September} -\setinterfacevariable{serif}{serif} -\setinterfacevariable{serried}{kleinerabstand} -\setinterfacevariable{setups}{impostazioni} -\setinterfacevariable{sheet}{sheet} -\setinterfacevariable{short}{kurz} -\setinterfacevariable{singlesided}{einzelseitig} -\setinterfacevariable{slanted}{geneigt} -\setinterfacevariable{slantedbold}{geneigtfett} -\setinterfacevariable{small}{klein} -\setinterfacevariable{smallbodyfont}{smallbodyfont} -\setinterfacevariable{smallbold}{kleinfett} -\setinterfacevariable{smallbolditalic}{kleinfettitalic} -\setinterfacevariable{smallboldslanted}{kleinfettgeneigt} -\setinterfacevariable{smallcaps}{smallcaps} -\setinterfacevariable{smallitalic}{kleinitalic} -\setinterfacevariable{smallitalicbold}{kleinitalicfett} -\setinterfacevariable{smallnormal}{kleinnormal} -\setinterfacevariable{smallslanted}{kleingeneigt} -\setinterfacevariable{smallslantedbold}{kleingeneigtfett} -\setinterfacevariable{smalltype}{kleintippen} -\setinterfacevariable{somewhere}{irgendwo} -\setinterfacevariable{sorted}{sortiert} -\setinterfacevariable{space}{spatium} -\setinterfacevariable{spacing}{spatiumausgleich} -\setinterfacevariable{speech}{speech} -\setinterfacevariable{split}{split} -\setinterfacevariable{spot}{spot} -\setinterfacevariable{standard}{standard} -\setinterfacevariable{start}{start} -\setinterfacevariable{starter}{starter} -\setinterfacevariable{sticker}{sticker} -\setinterfacevariable{stop}{stop} -\setinterfacevariable{stopper}{trenner} -\setinterfacevariable{stretch}{strecken} -\setinterfacevariable{strict}{streng} -\setinterfacevariable{strong}{strong} -\setinterfacevariable{strut}{strut} -\setinterfacevariable{sub}{unter} -\setinterfacevariable{subbackward}{unterrueckwaerts} -\setinterfacevariable{subformula}{subformel} -\setinterfacevariable{subforward}{untervorwaerts} -\setinterfacevariable{subject}{thema} -\setinterfacevariable{subpage}{unterseite} -\setinterfacevariable{subsection}{unterabsatz} -\setinterfacevariable{subsubject}{unterthema} -\setinterfacevariable{subsubsection}{unterunterabsatz} -\setinterfacevariable{subsubsubject}{unterunterthema} -\setinterfacevariable{subsubsubsection}{unterunterunterabsatz} -\setinterfacevariable{subsubsubsubject}{unterunterunterthema} -\setinterfacevariable{subsubsubsubsection}{unterunterunterunterabsatz} -\setinterfacevariable{subsubsubsubsubject}{unterunterunterunterthema} -\setinterfacevariable{subsubsubsubsubsection}{unterunterunterunterunterabsatz} -\setinterfacevariable{subsubsubsubsubsubject}{unterunterunterunterunterthema} -\setinterfacevariable{subsubsubsubsubsubsection}{unterunterunterunterunterunterabsatz} -\setinterfacevariable{subsubsubsubsubsubsubject}{unterunterunterunterunterunterthema} -\setinterfacevariable{subsubsubsubsubsubsubsection}{unterunterunterunterunterunterunterabsatz} -\setinterfacevariable{subsubsubsubsubsubsubsubject}{unterunterunterunterunterunterunterthema} -\setinterfacevariable{subsubsubsubsubsubsubsubsection}{unterunterunterunterunterunterunterunterabsatz} -\setinterfacevariable{subsubsubsubsubsubsubsubsubject}{unterunterunterunterunterunterunterunterthema} -\setinterfacevariable{subsubsubsubsubsubsubsubsubsection}{unterunterunterunterunterunterunterunterunterabsatz} -\setinterfacevariable{subsubsubsubsubsubsubsubsubsubject}{unterunterunterunterunterunterunterunterunterthema} -\setinterfacevariable{sunday}{sonntag} -\setinterfacevariable{support}{support} -\setinterfacevariable{sym}{sym} -\setinterfacevariable{symbol}{symbol} -\setinterfacevariable{synchronize}{synchronize} -\setinterfacevariable{system}{systeme} -\setinterfacevariable{table}{tabelle} -\setinterfacevariable{tablehead}{tabellenueberschrift} -\setinterfacevariable{tables}{tabellen} -\setinterfacevariable{tabletail}{tabellenende} -\setinterfacevariable{tabulate}{tabulator} -\setinterfacevariable{tabulatehead}{tabulatehead} -\setinterfacevariable{tabulatetail}{tabulatetail} -\setinterfacevariable{tall}{lang} -\setinterfacevariable{teletype}{fernschreiber} -\setinterfacevariable{temporary}{temporaer} -\setinterfacevariable{test}{test} -\setinterfacevariable{text}{text} -\setinterfacevariable{three}{drei} -\setinterfacevariable{thursday}{donnerstag} -\setinterfacevariable{title}{titel} -\setinterfacevariable{toggle}{toggle} -\setinterfacevariable{tolerant}{tolerant} -\setinterfacevariable{top}{oben} -\setinterfacevariable{tuesday}{dienstag} -\setinterfacevariable{two}{zwei} -\setinterfacevariable{txt}{txt} -\setinterfacevariable{type}{tippen} -\setinterfacevariable{typing}{tippen} -\setinterfacevariable{unavailable}{nichtverfuegbar} -\setinterfacevariable{underbar}{unterstrichen} -\setinterfacevariable{underbars}{unterstreichen} -\setinterfacevariable{unit}{einheit} -\setinterfacevariable{units}{einheiten} -\setinterfacevariable{unknown}{unbekannt} -\setinterfacevariable{unpacked}{ungepackt} -\setinterfacevariable{up}{up} -\setinterfacevariable{url}{url} -\setinterfacevariable{used}{verwende} -\setinterfacevariable{value}{wert} -\setinterfacevariable{vertical}{vertikal} -\setinterfacevariable{very}{sehr} -\setinterfacevariable{verystrict}{sehrstreng} -\setinterfacevariable{verytolerant}{sehrtolerant} -\setinterfacevariable{weak}{weak} -\setinterfacevariable{wednesday}{mittwoch} -\setinterfacevariable{week}{woche} -\setinterfacevariable{weekday}{wochentag} -\setinterfacevariable{white}{weiss} -\setinterfacevariable{wide}{breit} -\setinterfacevariable{width}{breite} -\setinterfacevariable{xml}{xml} -\setinterfacevariable{year}{jahr} -\setinterfacevariable{yes}{ja} -% definitions for interface constants for language de -% -\setinterfaceconstant{action}{aktion} -\setinterfaceconstant{address}{adresse} -\setinterfaceconstant{after}{nach} -\setinterfaceconstant{afterhead}{nachkopf} -\setinterfaceconstant{afterkey}{nachtaste} -\setinterfaceconstant{align}{ausrichtung} -\setinterfaceconstant{aligncharacter}{aligncharacter} -\setinterfaceconstant{alignmentcharacter}{alignmentcharacter} -\setinterfaceconstant{alignsymbol}{alignsymbol} -\setinterfaceconstant{aligntitle}{titelausrichten} -\setinterfaceconstant{alternative}{alternative} -\setinterfaceconstant{andtext}{andtext} -\setinterfaceconstant{apa}{apa} -\setinterfaceconstant{arrow}{pfeil} -\setinterfaceconstant{artauthor}{artauthor} -\setinterfaceconstant{artauthoretaldisplay}{artauthoretaldisplay} -\setinterfaceconstant{artauthoretallimit}{artauthoretallimit} -\setinterfaceconstant{artauthoretaltext}{artauthoretaltext} -\setinterfaceconstant{at}{bei} -\setinterfaceconstant{author}{autor} -\setinterfaceconstant{authoretaldisplay}{authoretaldisplay} -\setinterfaceconstant{authoretallimit}{authoretallimit} -\setinterfaceconstant{authoretaltext}{authoretaltext} -\setinterfaceconstant{auto}{auto} -\setinterfaceconstant{autofile}{autofile} -\setinterfaceconstant{autofocus}{autofocus} -\setinterfaceconstant{autohang}{autohang} -\setinterfaceconstant{autostrut}{autostrut} -\setinterfaceconstant{autowidth}{autobreite} -\setinterfaceconstant{axis}{achsen} -\setinterfaceconstant{background}{hintergrund} -\setinterfaceconstant{backgroundcolor}{hintergrundfarbe} -\setinterfaceconstant{backgroundcorner}{hintergrundwinkel} -\setinterfaceconstant{backgrounddepth}{hintergrundtiefe} -\setinterfaceconstant{backgroundoffset}{hintergrundoffset} -\setinterfaceconstant{backgroundradius}{hintergrundradius} -\setinterfaceconstant{backgroundscreen}{hintergrundraster} -\setinterfaceconstant{backspace}{rumpfspatium} -\setinterfaceconstant{balance}{ausgleichen} -\setinterfaceconstant{before}{vor} -\setinterfaceconstant{beforehead}{vorkopf} -\setinterfaceconstant{bet}{bet} -\setinterfaceconstant{big}{gross} -\setinterfaceconstant{blank}{blanko} -\setinterfaceconstant{blockway}{blockauf} -\setinterfaceconstant{bodyfont}{fliesstext} -\setinterfaceconstant{bookmark}{bookmark} -\setinterfaceconstant{bottom}{unten} -\setinterfaceconstant{bottomafter}{bottomafter} -\setinterfaceconstant{bottombefore}{bottombefore} -\setinterfaceconstant{bottomdistance}{abstandunten} -\setinterfaceconstant{bottomframe}{untenrahmen} -\setinterfaceconstant{bottomoffset}{untenoffset} -\setinterfaceconstant{bottomspace}{bottomspace} -\setinterfaceconstant{bottomstate}{untenstatus} -\setinterfaceconstant{cache}{cache} -\setinterfaceconstant{calculate}{berechnen} -\setinterfaceconstant{ccommand}{cbefehl} -\setinterfaceconstant{click}{klick} -\setinterfaceconstant{clickin}{klickin} -\setinterfaceconstant{clickout}{klickaus} -\setinterfaceconstant{clipoffset}{clipoffset} -\setinterfaceconstant{closeaction}{schliessenaktion} -\setinterfaceconstant{closecommand}{closecommand} -\setinterfaceconstant{closepageaction}{closepageaction} -\setinterfaceconstant{closesymbol}{closesymbol} -\setinterfaceconstant{color}{farbe} -\setinterfaceconstant{column}{spalte} -\setinterfaceconstant{columndistance}{spaltenabstand} -\setinterfaceconstant{columns}{spalten} -\setinterfaceconstant{command}{befehl} -\setinterfaceconstant{commandafter}{zumbefehl} -\setinterfaceconstant{commandbefore}{vorbefehl} -\setinterfaceconstant{commands}{befehle} -\setinterfaceconstant{component}{component} -\setinterfaceconstant{compoundhyphen}{compoundhyphen} -\setinterfaceconstant{compress}{compress} -\setinterfaceconstant{connector}{connector} -\setinterfaceconstant{continue}{fortsetzen} -\setinterfaceconstant{contrastcolor}{kontrastfarbe} -\setinterfaceconstant{controls}{controls} -\setinterfaceconstant{conversion}{konversion} -\setinterfaceconstant{convertfile}{konvertieredatei} -\setinterfaceconstant{corner}{winkel} -\setinterfaceconstant{coupling}{verknuepfung} -\setinterfaceconstant{couplingway}{verkopplungsart} -\setinterfaceconstant{criterium}{kriterium} -\setinterfaceconstant{current}{aktuell} -\setinterfaceconstant{cutspace}{cutspace} -\setinterfaceconstant{dash}{strich} -\setinterfaceconstant{dat}{dat} -\setinterfaceconstant{database}{database} -\setinterfaceconstant{date}{datum} -\setinterfaceconstant{deepnumbercommand}{deepnumbercommand} -\setinterfaceconstant{deeptextcommand}{deeptextcommand} -\setinterfaceconstant{default}{default} -\setinterfaceconstant{delay}{wartezeit} -\setinterfaceconstant{depth}{tiefe} -\setinterfaceconstant{depthcorrection}{tiefekorrektur} -\setinterfaceconstant{direction}{richtung} -\setinterfaceconstant{directory}{verzeichnis} -\setinterfaceconstant{display}{bildschirm} -\setinterfaceconstant{distance}{abstand} -\setinterfaceconstant{dot}{punkt} -\setinterfaceconstant{doublesided}{doppelseitig} -\setinterfaceconstant{dummy}{dummy} -\setinterfaceconstant{dx}{dx} -\setinterfaceconstant{dy}{dy} -\setinterfaceconstant{edge}{kante} -\setinterfaceconstant{edgedistance}{kantenabstand} -\setinterfaceconstant{editor}{editor} -\setinterfaceconstant{editoretaldisplay}{editoretaldisplay} -\setinterfaceconstant{editoretallimit}{editoretallimit} -\setinterfaceconstant{editoretaltext}{editoretaltext} -\setinterfaceconstant{empty}{leer} -\setinterfaceconstant{equalheight}{equalheight} -\setinterfaceconstant{equalwidth}{equalwidth} -\setinterfaceconstant{escape}{escape} -\setinterfaceconstant{evenmargin}{geraderand} -\setinterfaceconstant{expansion}{expansion} -\setinterfaceconstant{export}{export} -\setinterfaceconstant{extras}{extras} -\setinterfaceconstant{factor}{faktor} -\setinterfaceconstant{fallback}{fallback} -\setinterfaceconstant{family}{familie} -\setinterfaceconstant{fieldbackgroundcolor}{feldhintergrundfarbe} -\setinterfaceconstant{fieldframecolor}{feldrahmenfarbe} -\setinterfaceconstant{fieldlayer}{fieldlayer} -\setinterfaceconstant{fieldoffset}{feldoffset} -\setinterfaceconstant{file}{datei} -\setinterfaceconstant{filtercommand}{filtercommand} -\setinterfaceconstant{finalnamesep}{finalnamesep} -\setinterfaceconstant{firstnamesep}{firstnamesep} -\setinterfaceconstant{focus}{focus} -\setinterfaceconstant{focusin}{focusin} -\setinterfaceconstant{focusout}{focusout} -\setinterfaceconstant{footer}{fusszeile} -\setinterfaceconstant{footerdistance}{fusszeilenabstand} -\setinterfaceconstant{footerstate}{fusszeilenstatus} -\setinterfaceconstant{foregroundcolor}{foregroundcolor} -\setinterfaceconstant{foregroundstyle}{foregroundstyle} -\setinterfaceconstant{format}{formatieren} -\setinterfaceconstant{frame}{rahmen} -\setinterfaceconstant{framecolor}{rahmenfarbe} -\setinterfaceconstant{framecorner}{rahmenwinkel} -\setinterfaceconstant{framedepth}{rahmentiefe} -\setinterfaceconstant{frameoffset}{rahmenoffset} -\setinterfaceconstant{frameradius}{rahmenradius} -\setinterfaceconstant{frames}{umrahmen} -\setinterfaceconstant{from}{von} -\setinterfaceconstant{get}{hole} -\setinterfaceconstant{global}{global} -\setinterfaceconstant{grid}{gritter} -\setinterfaceconstant{hang}{haengend} -\setinterfaceconstant{headalign}{headalign} -\setinterfaceconstant{headcolor}{kopffarbe} -\setinterfaceconstant{headcommand}{headcommand} -\setinterfaceconstant{headconversion}{headconversion} -\setinterfaceconstant{header}{kopfzeile} -\setinterfaceconstant{headerdistance}{kopfzeilenabstand} -\setinterfaceconstant{headerstate}{kopfzeilenstatus} -\setinterfaceconstant{headlabel}{headlabel} -\setinterfaceconstant{headnumber}{kopfnummer} -\setinterfaceconstant{headstyle}{kopfstil} -\setinterfaceconstant{height}{hoehe} -\setinterfaceconstant{hfactor}{hfaktor} -\setinterfaceconstant{hfil}{hfil} -\setinterfaceconstant{hidenumber}{hidenumber} -\setinterfaceconstant{hoffset}{hoffset} -\setinterfaceconstant{horoffset}{rumpfabstand} -\setinterfaceconstant{hyphen}{hyphen} -\setinterfaceconstant{icommand}{ibefehl} -\setinterfaceconstant{in}{in} -\setinterfaceconstant{inbetween}{zwischen} -\setinterfaceconstant{increment}{erhoehen} -\setinterfaceconstant{incrementnumber}{nummererhoehen} -\setinterfaceconstant{indenting}{einziehen} -\setinterfaceconstant{indentnext}{ziehefolgendeein} -\setinterfaceconstant{indicator}{indikator} -\setinterfaceconstant{inner}{innen} -\setinterfaceconstant{innermargin}{innermargin} -\setinterfaceconstant{inputfile}{inputfile} -\setinterfaceconstant{intent}{intent} -\setinterfaceconstant{interaction}{interaktion} -\setinterfaceconstant{interlinespace}{zeilenabstande} -\setinterfaceconstant{itemalign}{itemalign} -\setinterfaceconstant{items}{posten} -\setinterfaceconstant{juniorsep}{juniorsep} -\setinterfaceconstant{ken}{ken} -\setinterfaceconstant{keyexpansion}{keyexpansion} -\setinterfaceconstant{keyword}{keyword} -\setinterfaceconstant{label}{label} -\setinterfaceconstant{lastnamesep}{lastnamesep} -\setinterfaceconstant{lastpubsep}{lastpubsep} -\setinterfaceconstant{left}{links} -\setinterfaceconstant{leftcolor}{linkerfarbe} -\setinterfaceconstant{leftcompoundhyphen}{leftcompoundhyphen} -\setinterfaceconstant{leftedge}{linkekante} -\setinterfaceconstant{leftedgedistance}{linkerkantenabstand} -\setinterfaceconstant{leftframe}{linkerrahmen} -\setinterfaceconstant{lefthyphen}{lefthyphen} -\setinterfaceconstant{leftmargin}{linkerrand} -\setinterfaceconstant{leftmargindistance}{linkerrandabstand} -\setinterfaceconstant{leftoffset}{linkeroffset} -\setinterfaceconstant{leftquotation}{linkerzitat} -\setinterfaceconstant{leftquote}{linkerzitieren} -\setinterfaceconstant{leftsentence}{linkersatz} -\setinterfaceconstant{leftspeech}{leftspeech} -\setinterfaceconstant{leftstyle}{linkerstil} -\setinterfaceconstant{leftsubsentence}{linkersubsatz} -\setinterfaceconstant{lefttext}{linkertext} -\setinterfaceconstant{leftwidth}{linkerbreite} -\setinterfaceconstant{level}{niveau} -\setinterfaceconstant{levels}{niveaus} -\setinterfaceconstant{limittext}{limittext} -\setinterfaceconstant{line}{zeile} -\setinterfaceconstant{linecorrection}{zeilekorrektur} -\setinterfaceconstant{lines}{zeilen} -\setinterfaceconstant{list}{liste} -\setinterfaceconstant{listtext}{listtext} -\setinterfaceconstant{local}{lokal} -\setinterfaceconstant{location}{platz} -\setinterfaceconstant{logo}{logo} -\setinterfaceconstant{logos}{logos} -\setinterfaceconstant{marcolor}{beschrfarbe} -\setinterfaceconstant{margin}{marginalie} -\setinterfaceconstant{margindistance}{marginalabstand} -\setinterfaceconstant{marginedge}{marginalkante} -\setinterfaceconstant{marginedgetext}{marginalkantetext} -\setinterfaceconstant{margintext}{marginaltext} -\setinterfaceconstant{marking}{beschriftung} -\setinterfaceconstant{marstyle}{beschrstil} -\setinterfaceconstant{max}{max} -\setinterfaceconstant{maxdepth}{maxdepth} -\setinterfaceconstant{maxheight}{maxhoehe} -\setinterfaceconstant{maxwidth}{maxbreite} -\setinterfaceconstant{maybeyear}{maybeyear} -\setinterfaceconstant{menu}{menue} -\setinterfaceconstant{method}{methode} -\setinterfaceconstant{middle}{mittig} -\setinterfaceconstant{middlespeech}{middlespeech} -\setinterfaceconstant{middletext}{mittigertext} -\setinterfaceconstant{midsentence}{midsentence} -\setinterfaceconstant{min}{min} -\setinterfaceconstant{mindepth}{mindepth} -\setinterfaceconstant{minheight}{minhoehe} -\setinterfaceconstant{minwidth}{minbreite} -\setinterfaceconstant{monthconversion}{monthconversion} -\setinterfaceconstant{n}{n} -\setinterfaceconstant{name}{name} -\setinterfaceconstant{namesep}{namesep} -\setinterfaceconstant{nbottom}{nunten} -\setinterfaceconstant{nc}{nc} -\setinterfaceconstant{next}{folgende} -\setinterfaceconstant{nl}{nl} -\setinterfaceconstant{nleft}{nlinks} -\setinterfaceconstant{nlines}{zzeile} -\setinterfaceconstant{norm}{norm} -\setinterfaceconstant{nr}{nr} -\setinterfaceconstant{nright}{nrechts} -\setinterfaceconstant{ntop}{noben} -\setinterfaceconstant{number}{nummer} -\setinterfaceconstant{numbercolor}{nummernfarbe} -\setinterfaceconstant{numbercommand}{nummerbefehl} -\setinterfaceconstant{numberconversion}{numberconversion} -\setinterfaceconstant{numberconversionset}{numberconversionset} -\setinterfaceconstant{numberdistance}{numberdistance} -\setinterfaceconstant{numbering}{nummerierung} -\setinterfaceconstant{numberorder}{numberorder} -\setinterfaceconstant{numberprefix}{numberprefix} -\setinterfaceconstant{numbersegments}{numbersegments} -\setinterfaceconstant{numberseparator}{nummernseperator} -\setinterfaceconstant{numberseparatorset}{numberseparatorset} -\setinterfaceconstant{numberset}{numberset} -\setinterfaceconstant{numberstarter}{numberstarter} -\setinterfaceconstant{numberstopper}{numberstopper} -\setinterfaceconstant{numberstyle}{nummernstil} -\setinterfaceconstant{numberwidth}{numberwidth} -\setinterfaceconstant{nx}{nx} -\setinterfaceconstant{ny}{ny} -\setinterfaceconstant{object}{objekt} -\setinterfaceconstant{obstruction}{gesperrt} -\setinterfaceconstant{oddmargin}{ungeraderand} -\setinterfaceconstant{offset}{offset} -\setinterfaceconstant{openaction}{oeffenaktion} -\setinterfaceconstant{openpageaction}{openpageaction} -\setinterfaceconstant{option}{option} -\setinterfaceconstant{order}{order} -\setinterfaceconstant{orientation}{orientation} -\setinterfaceconstant{otherstext}{otherstext} -\setinterfaceconstant{outermargin}{outermargin} -\setinterfaceconstant{overprint}{overprint} -\setinterfaceconstant{ownnumber}{eigenenummer} -\setinterfaceconstant{page}{seite} -\setinterfaceconstant{pageboundaries}{seitenbegrenzung} -\setinterfaceconstant{pagecolor}{seitenfarbe} -\setinterfaceconstant{pagecommand}{seitenbefehl} -\setinterfaceconstant{pageconversion}{pageconversion} -\setinterfaceconstant{pageconversionset}{pageconversionset} -\setinterfaceconstant{pagenumber}{seitennummer} -\setinterfaceconstant{pageprefix}{pageprefix} -\setinterfaceconstant{pageprefixconnector}{pageprefixconnector} -\setinterfaceconstant{pageprefixconversion}{pageprefixconversion} -\setinterfaceconstant{pageprefixconversionset}{pageprefixconversionset} -\setinterfaceconstant{pageprefixsegments}{pageprefixsegments} -\setinterfaceconstant{pageprefixseparatorset}{pageprefixseparatorset} -\setinterfaceconstant{pageprefixset}{pageprefixset} -\setinterfaceconstant{pageprefixstarter}{pageprefixstarter} -\setinterfaceconstant{pageprefixstopper}{pageprefixstopper} -\setinterfaceconstant{pagesegments}{pagesegments} -\setinterfaceconstant{pageseparatorset}{pageseparatorset} -\setinterfaceconstant{pageset}{pageset} -\setinterfaceconstant{pagestarter}{pagestarter} -\setinterfaceconstant{pagestate}{pagestate} -\setinterfaceconstant{pagestopper}{pagestopper} -\setinterfaceconstant{pagestyle}{seitenstil} -\setinterfaceconstant{palet}{palette} -\setinterfaceconstant{paper}{papier} -\setinterfaceconstant{paragraph}{absatz} -\setinterfaceconstant{place}{platziere} -\setinterfaceconstant{placehead}{setzekopf} -\setinterfaceconstant{placestopper}{setzetrenner} -\setinterfaceconstant{position}{position} -\setinterfaceconstant{prefix}{prefix} -\setinterfaceconstant{prefixconnector}{prefixconnector} -\setinterfaceconstant{prefixconversion}{prefixconversion} -\setinterfaceconstant{prefixconversionset}{prefixconversionset} -\setinterfaceconstant{prefixsegments}{prefixsegments} -\setinterfaceconstant{prefixseparatorset}{prefixseparatorset} -\setinterfaceconstant{prefixset}{prefixset} -\setinterfaceconstant{prefixstarter}{prefixstarter} -\setinterfaceconstant{prefixstopper}{prefixstopper} -\setinterfaceconstant{preset}{voreinstellung} -\setinterfaceconstant{preview}{vorschau} -\setinterfaceconstant{previous}{vorige} -\setinterfaceconstant{previousnumber}{vorigenummer} -\setinterfaceconstant{process}{process} -\setinterfaceconstant{pubsep}{pubsep} -\setinterfaceconstant{radius}{radius} -\setinterfaceconstant{random}{zufaellig} -\setinterfaceconstant{range}{range} -\setinterfaceconstant{reduction}{reduktion} -\setinterfaceconstant{ref}{ref} -\setinterfaceconstant{refcommand}{refcommand} -\setinterfaceconstant{reference}{referenz} -\setinterfaceconstant{referenceprefix}{referenceprefix} -\setinterfaceconstant{referencing}{referieren} -\setinterfaceconstant{regionin}{regionin} -\setinterfaceconstant{regionout}{regionaus} -\setinterfaceconstant{repeat}{wiederholen} -\setinterfaceconstant{reset}{reset} -\setinterfaceconstant{resetnumber}{resetnumber} -\setinterfaceconstant{resolution}{aufloesung} -\setinterfaceconstant{right}{rechts} -\setinterfaceconstant{rightcolor}{rechterfarbe} -\setinterfaceconstant{rightcompoundhyphen}{rightcompoundhyphen} -\setinterfaceconstant{rightedge}{rechtekante} -\setinterfaceconstant{rightedgedistance}{rechterkantenabstand} -\setinterfaceconstant{rightframe}{rechterrahmen} -\setinterfaceconstant{righthyphen}{righthyphen} -\setinterfaceconstant{rightmargin}{rechterrand} -\setinterfaceconstant{rightmargindistance}{rechterrandabstand} -\setinterfaceconstant{rightoffset}{rechterabstand} -\setinterfaceconstant{rightquotation}{rechterzitat} -\setinterfaceconstant{rightquote}{rechterzitieren} -\setinterfaceconstant{rightsentence}{rechtersatz} -\setinterfaceconstant{rightspeech}{rightspeech} -\setinterfaceconstant{rightstyle}{rechterstil} -\setinterfaceconstant{rightsubsentence}{rechtersubsatz} -\setinterfaceconstant{righttext}{rechtertext} -\setinterfaceconstant{rightwidth}{rechterbreite} -\setinterfaceconstant{rotation}{rotation} -\setinterfaceconstant{rule}{linie} -\setinterfaceconstant{rulecolor}{linienfarbe} -\setinterfaceconstant{rulethickness}{liniendicke} -\setinterfaceconstant{samepage}{selbeseite} -\setinterfaceconstant{sample}{muster} -\setinterfaceconstant{samplesize}{samplesize} -\setinterfaceconstant{saveinlist}{saveinlist} -\setinterfaceconstant{scale}{format} -\setinterfaceconstant{scope}{bereich} -\setinterfaceconstant{screen}{raster} -\setinterfaceconstant{section}{abschnitt} -\setinterfaceconstant{sectionconversion}{sectionconversion} -\setinterfaceconstant{sectionconversionset}{sectionconversionset} -\setinterfaceconstant{sectionnumber}{abschnittsnummer} -\setinterfaceconstant{sectionresetset}{sectionresetset} -\setinterfaceconstant{sectionsegments}{sectionsegments} -\setinterfaceconstant{sectionseparatorset}{sectionseparatorset} -\setinterfaceconstant{sectionset}{sectionset} -\setinterfaceconstant{sectionstarter}{sectionstarter} -\setinterfaceconstant{sectionstopper}{sectionstopper} -\setinterfaceconstant{separator}{seperator} -\setinterfaceconstant{set}{set} -\setinterfaceconstant{setups}{setups} -\setinterfaceconstant{side}{objektabstand} -\setinterfaceconstant{sidealign}{sidealign} -\setinterfaceconstant{sidemethod}{sidemethod} -\setinterfaceconstant{sidespaceafter}{nebennachspatium} -\setinterfaceconstant{sidespacebefore}{nebenvorspatium} -\setinterfaceconstant{sign}{zeichen} -\setinterfaceconstant{size}{groesse} -\setinterfaceconstant{small}{klein} -\setinterfaceconstant{sort}{sort} -\setinterfaceconstant{sorttype}{sorttype} -\setinterfaceconstant{source}{quelle} -\setinterfaceconstant{space}{spatium} -\setinterfaceconstant{spaceafter}{nachspatium} -\setinterfaceconstant{spacebefore}{vorspatium} -\setinterfaceconstant{spaceinbetween}{spaceinbetween} -\setinterfaceconstant{spacing}{spatiumausgleich} -\setinterfaceconstant{split}{split} -\setinterfaceconstant{splitcolor}{splitcolor} -\setinterfaceconstant{splitmethod}{splitmethod} -\setinterfaceconstant{splitoffset}{splitoffset} -\setinterfaceconstant{spot}{spot} -\setinterfaceconstant{stack}{stack} -\setinterfaceconstant{start}{start} -\setinterfaceconstant{starter}{starter} -\setinterfaceconstant{state}{status} -\setinterfaceconstant{step}{schritt} -\setinterfaceconstant{stop}{stop} -\setinterfaceconstant{stopper}{abschnitttrenner} -\setinterfaceconstant{stretch}{strecken} -\setinterfaceconstant{strip}{strip} -\setinterfaceconstant{strut}{strut} -\setinterfaceconstant{style}{stil} -\setinterfaceconstant{sub}{unter} -\setinterfaceconstant{subtitle}{untertitel} -\setinterfaceconstant{suffix}{suffix} -\setinterfaceconstant{surnamesep}{surnamesep} -\setinterfaceconstant{sx}{sx} -\setinterfaceconstant{sy}{sy} -\setinterfaceconstant{symalign}{symausrichtung} -\setinterfaceconstant{symbol}{symbol} -\setinterfaceconstant{symbolset}{symbolset} -\setinterfaceconstant{symcolor}{symfarbe} -\setinterfaceconstant{symstyle}{symstil} -\setinterfaceconstant{synonym}{synonym} -\setinterfaceconstant{synonymcolor}{synonymfarbe} -\setinterfaceconstant{synonymcommand}{synonymbefehl} -\setinterfaceconstant{synonymstyle}{synonymstil} -\setinterfaceconstant{tab}{tab} -\setinterfaceconstant{text}{text} -\setinterfaceconstant{textcolor}{textfarbe} -\setinterfaceconstant{textcommand}{textbefehl} -\setinterfaceconstant{textdistance}{textdistance} -\setinterfaceconstant{textlayer}{textlayer} -\setinterfaceconstant{textmargin}{textmargin} -\setinterfaceconstant{textmethod}{textmethod} -\setinterfaceconstant{textseparator}{textseparator} -\setinterfaceconstant{textsize}{textgroesse} -\setinterfaceconstant{textstate}{textstatus} -\setinterfaceconstant{textstyle}{textstil} -\setinterfaceconstant{textwidth}{textbreite} -\setinterfaceconstant{title}{titel} -\setinterfaceconstant{titlecolor}{titelfarbe} -\setinterfaceconstant{titlecommand}{titlecommand} -\setinterfaceconstant{titledistance}{titelabstand} -\setinterfaceconstant{titleleft}{titleleft} -\setinterfaceconstant{titleright}{titleright} -\setinterfaceconstant{titlestyle}{titelstil} -\setinterfaceconstant{to}{zu} -\setinterfaceconstant{tolerance}{toleranz} -\setinterfaceconstant{top}{oben} -\setinterfaceconstant{topdistance}{obenabstand} -\setinterfaceconstant{topframe}{obenrahmen} -\setinterfaceconstant{topoffset}{obenoffset} -\setinterfaceconstant{topspace}{kopfspatium} -\setinterfaceconstant{topstate}{statusoben} -\setinterfaceconstant{totalnumber}{totalnumber} -\setinterfaceconstant{type}{typ} -\setinterfaceconstant{unit}{einheit} -\setinterfaceconstant{unknownreference}{unbekantereferenz} -\setinterfaceconstant{urlalternative}{urlalternative} -\setinterfaceconstant{urlspace}{urlspatium} -\setinterfaceconstant{validate}{validieren} -\setinterfaceconstant{vcommand}{vbefehl} -\setinterfaceconstant{veroffset}{kopfoffset} -\setinterfaceconstant{vfil}{vfil} -\setinterfaceconstant{voffset}{voffset} -\setinterfaceconstant{vonsep}{vonsep} -\setinterfaceconstant{way}{art} -\setinterfaceconstant{wfactor}{bfaktor} -\setinterfaceconstant{white}{weiss} -\setinterfaceconstant{width}{breite} -\setinterfaceconstant{xfactor}{xfaktor} -\setinterfaceconstant{xmax}{xmax} -\setinterfaceconstant{xoffset}{xoffset} -\setinterfaceconstant{xscale}{xformat} -\setinterfaceconstant{xstep}{xschritt} -\setinterfaceconstant{yfactor}{yfaktor} -\setinterfaceconstant{ymax}{ymax} -\setinterfaceconstant{yoffset}{yoffset} -\setinterfaceconstant{yscale}{yformat} -\setinterfaceconstant{ystep}{yschritt} -% definitions for interface elements for language de -% -\setinterfaceelement{answerlines}{answerlines} -\setinterfaceelement{answerspace}{answerspace} -\setinterfaceelement{begin}{anfang} -\setinterfaceelement{complete}{vollende} -\setinterfaceelement{coupled}{verknuepft} -\setinterfaceelement{currentlocal}{aktuelllokal} -\setinterfaceelement{emptyone}{vuoto} -\setinterfaceelement{emptytwo}{leer} -\setinterfaceelement{end}{ende} -\setinterfaceelement{endsetup}{ein} -\setinterfaceelement{get}{get} -\setinterfaceelement{increment}{erhoehen} -\setinterfaceelement{list}{auflisten} -\setinterfaceelement{listof}{auflistenvon} -\setinterfaceelement{load}{laden} -\setinterfaceelement{local}{lokal} -\setinterfaceelement{makeup}{umbruch} -\setinterfaceelement{next}{folgende} -\setinterfaceelement{place}{platziere} -\setinterfaceelement{previous}{vorige} -\setinterfaceelement{previouslocal}{voriglokal} -\setinterfaceelement{reserve}{reservieren} -\setinterfaceelement{see}{sieh} -\setinterfaceelement{setup}{stelle} -\setinterfaceelement{start}{start} -\setinterfaceelement{stop}{stop} -\setinterfaceelement{text}{text} -\setinterfaceelement{type}{type} -% definitions for interface commands for language de -% -\setinterfacecommand{CAPPED}{KAP} -\setinterfacecommand{Character}{Buchstabe} -\setinterfacecommand{Characters}{Buchstaben} -\setinterfacecommand{LABELTEXT}{LABELTEXT} -\setinterfacecommand{MONTH}{MONAT} -\setinterfacecommand{Numbers}{Ziffern} -\setinterfacecommand{Romannumerals}{Roemischezahlen} -\setinterfacecommand{SmallCapped}{Kap} -\setinterfacecommand{SmallCaps}{Kaps} -\setinterfacecommand{WEEKDAY}{WOCHENTAG} -\setinterfacecommand{WORD}{WORT} -\setinterfacecommand{WORDS}{WOERTER} -\setinterfacecommand{Word}{Wort} -\setinterfacecommand{Words}{Woerter} -\setinterfacecommand{about}{ueber} -\setinterfacecommand{adaptlayout}{passelayoutan} -\setinterfacecommand{arg}{arg} -\setinterfacecommand{at}{bei} -\setinterfacecommand{atleftmargin}{atleftmargin} -\setinterfacecommand{atpage}{aufseite} -\setinterfacecommand{atrightmargin}{atrightmargin} -\setinterfacecommand{background}{hintergrund} -\setinterfacecommand{backspace}{rumpfweite} -\setinterfacecommand{blackrule}{rechteck} -\setinterfacecommand{blackrules}{rechtecke} -\setinterfacecommand{blank}{blanko} -\setinterfacecommand{bookmark}{bookmark} -\setinterfacecommand{bottomdistance}{abstandunten} -\setinterfacecommand{bottomheight}{hoeheunten} -\setinterfacecommand{bottomspace}{bottomspace} -\setinterfacecommand{but}{but} -\setinterfacecommand{button}{knopf} -\setinterfacecommand{bypassblocks}{bypassblocks} -\setinterfacecommand{character}{buchstabe} -\setinterfacecommand{characters}{buchstaben} -\setinterfacecommand{chem}{chem} -\setinterfacecommand{clip}{ausschnitt} -\setinterfacecommand{clonefield}{klonierefeld} -\setinterfacecommand{color}{farbe} -\setinterfacecommand{colorbar}{farbbalken} -\setinterfacecommand{colorvalue}{farbewert} -\setinterfacecommand{column}{spalte} -\setinterfacecommand{comment}{kommentar} -\setinterfacecommand{comparecolorgroup}{vergleichefarbengruppe} -\setinterfacecommand{comparepalet}{vergleichepalette} -\setinterfacecommand{completepagenumber}{completepagenumber} -\setinterfacecommand{completeregister}{completeregister} -\setinterfacecommand{component}{komponente} -\setinterfacecommand{convertnumber}{konvertierezahl} -\setinterfacecommand{copyfield}{kopierefeld} -\setinterfacecommand{correctwhitespace}{korrigierezwischenraum} -\setinterfacecommand{coupledocument}{verknuepfedokument} -\setinterfacecommand{couplemarking}{verknuepfebeschriftung} -\setinterfacecommand{couplepage}{doppelseite} -\setinterfacecommand{couplepaper}{doppelseitigespapier} -\setinterfacecommand{coupleregister}{verknuepfregister} -\setinterfacecommand{crlf}{crlf} -\setinterfacecommand{currentdate}{heutigesdatum} -\setinterfacecommand{currentheadnumber}{heutigeskopfnummer} -\setinterfacecommand{cutspace}{cutspace} -\setinterfacecommand{date}{datum} -\setinterfacecommand{decouplemarking}{entknuepfebeschriftung} -\setinterfacecommand{decrementnumber}{decrementnumber} -\setinterfacecommand{define}{definieren} -\setinterfacecommand{defineaccent}{definiereakzent} -\setinterfacecommand{defineblank}{definiereblanko} -\setinterfacecommand{defineblock}{definiereblock} -\setinterfacecommand{definebodyfont}{definierefliesstext} -\setinterfacecommand{definebodyfontenvironment}{definierefliesstextumgebung} -\setinterfacecommand{definebuffer}{definierepuffer} -\setinterfacecommand{definecharacter}{definierezeichen} -\setinterfacecommand{definecolor}{definierefarbe} -\setinterfacecommand{definecolorgroup}{definierefarbengruppe} -\setinterfacecommand{definecolumnbreak}{definecolumnbreak} -\setinterfacecommand{definecolumnset}{definecolumnset} -\setinterfacecommand{definecombination}{definecombination} -\setinterfacecommand{definecombinedlist}{definierezusammengestellteliste} -\setinterfacecommand{definecommand}{definierebefehl} -\setinterfacecommand{defineconversion}{definierekonversion} -\setinterfacecommand{definedescription}{definierebeschreibung} -\setinterfacecommand{defineenumeration}{definierenummerierung} -\setinterfacecommand{definefield}{definierefeld} -\setinterfacecommand{definefieldstack}{definierefeldstapel} -\setinterfacecommand{definefiguresymbol}{definiereabbsymbol} -\setinterfacecommand{definefloat}{definieregleitobjekt} -\setinterfacecommand{definefont}{definiereschrift} -\setinterfacecommand{definefontstyle}{definiereschriftstil} -\setinterfacecommand{definefontsynonym}{defineschriftsynonym} -\setinterfacecommand{defineframed}{definiereumrahmt} -\setinterfacecommand{defineframedtext}{definiereumrahmtertext} -\setinterfacecommand{definehbox}{definierehbox} -\setinterfacecommand{definehead}{definiereueberschrift} -\setinterfacecommand{defineindenting}{definiereeinzug} -\setinterfacecommand{defineinmargin}{defineinmargin} -\setinterfacecommand{defineinteractionmenu}{definiereinteraktionsmenue} -\setinterfacecommand{defineitemgroup}{defineitemgroup} -\setinterfacecommand{definelabel}{definierelabel} -\setinterfacecommand{definelayer}{definelayer} -\setinterfacecommand{definelayout}{definelayout} -\setinterfacecommand{definelist}{definiereliste} -\setinterfacecommand{definelogo}{definierelogo} -\setinterfacecommand{definemainfield}{definierehauptfeld} -\setinterfacecommand{definemakeup}{definiereumbruch} -\setinterfacecommand{definemarking}{definierebeschriftung} -\setinterfacecommand{definemathalignment}{definemathalignment} -\setinterfacecommand{defineoutput}{defineoutput} -\setinterfacecommand{defineoverlay}{definiereoverlay} -\setinterfacecommand{definepagebreak}{definepagebreak} -\setinterfacecommand{definepalet}{definierepalette} -\setinterfacecommand{definepapersize}{definierepapierformat} -\setinterfacecommand{defineparagraphs}{definiereabsaetze} -\setinterfacecommand{defineplacement}{defineplacement} -\setinterfacecommand{defineprofile}{definiereprofil} -\setinterfacecommand{defineprogram}{definiereprogramme} -\setinterfacecommand{definerawfont}{definerawfont} -\setinterfacecommand{definereference}{definierereferenz} -\setinterfacecommand{definereferenceformat}{definierereferenzformat} -\setinterfacecommand{definereferencelist}{definierereferenzliste} -\setinterfacecommand{defineregister}{definiereregister} -\setinterfacecommand{definerule}{definerule} -\setinterfacecommand{definesection}{definiereabschnitt} -\setinterfacecommand{definesectionblock}{definiereabschnittsblock} -\setinterfacecommand{definesorting}{definieresortieren} -\setinterfacecommand{definestartstop}{definierestartstop} -\setinterfacecommand{definestyle}{definierestil} -\setinterfacecommand{definesubfield}{definieresubfeld} -\setinterfacecommand{definesymbol}{definieresymbol} -\setinterfacecommand{definesynonyms}{definieresynonyme} -\setinterfacecommand{definetabletemplate}{definieretabellenvorlage} -\setinterfacecommand{definetabulate}{definieretabulator} -\setinterfacecommand{definetext}{definieretext} -\setinterfacecommand{definetextposition}{definetextposition} -\setinterfacecommand{definetextvariable}{definetextvariable} -\setinterfacecommand{definetype}{definetype} -\setinterfacecommand{definetyping}{definieretippen} -\setinterfacecommand{defineversion}{definiereversion} -\setinterfacecommand{determineheadnumber}{bestimmekopfnummer} -\setinterfacecommand{determinelistcharacteristics}{bestimmelistencharakeristika} -\setinterfacecommand{determineregistercharacteristics}{bestimmeregistercharakteristika} -\setinterfacecommand{dimension}{dimension} -\setinterfacecommand{disableinteractionmenu}{inaktiviereinteraktionsmenue} -\setinterfacecommand{domicile}{wohnort} -\setinterfacecommand{donttest}{keintest} -\setinterfacecommand{edgedistance}{randabstand} -\setinterfacecommand{edgewidth}{randbreite} -\setinterfacecommand{emptylines}{emptylines} -\setinterfacecommand{environment}{umgebung} -\setinterfacecommand{externalfigure}{externeabbildung} -\setinterfacecommand{fact}{geg} -\setinterfacecommand{field}{feld} -\setinterfacecommand{fieldstack}{feldstapel} -\setinterfacecommand{fillinfield}{ausfuellfeld} -\setinterfacecommand{fillinline}{gefuelltezeile} -\setinterfacecommand{fillinrules}{gefuelltesrechteck} -\setinterfacecommand{fillintext}{ausfuelltext} -\setinterfacecommand{fitfield}{passendfeld} -\setinterfacecommand{fixedspace}{festesspatium} -\setinterfacecommand{fixedspaces}{festesspatium} -\setinterfacecommand{followprofile}{folgeprofil} -\setinterfacecommand{followprofileversion}{folgeprofilversion} -\setinterfacecommand{followversion}{folgeversion} -\setinterfacecommand{footerdistance}{fusszeileabstand} -\setinterfacecommand{footerheight}{fusszeilenhoehe} -\setinterfacecommand{footnote}{fussnote} -\setinterfacecommand{footnotetext}{footnotetext} -\setinterfacecommand{forceblocks}{forceblocks} -\setinterfacecommand{formulanumber}{formelnummer} -\setinterfacecommand{fraction}{bruch} -\setinterfacecommand{framed}{umrahmt} -\setinterfacecommand{from}{von} -\setinterfacecommand{getbuffer}{holepuffer} -\setinterfacecommand{getmarking}{holebeschriftung} -\setinterfacecommand{getnumber}{getnumber} -\setinterfacecommand{godown}{nachunten} -\setinterfacecommand{goto}{zu} -\setinterfacecommand{gotobox}{zurbox} -\setinterfacecommand{gotopage}{zurseite} -\setinterfacecommand{graycolor}{graufarbe} -\setinterfacecommand{greyvalue}{grauwert} -\setinterfacecommand{grid}{gitter} -\setinterfacecommand{hairline}{haarlinie} -\setinterfacecommand{head}{kopf} -\setinterfacecommand{headerdistance}{kopfzeilenabstand} -\setinterfacecommand{headerheight}{kopfzeilenhoehe} -\setinterfacecommand{headlevel}{kopfniveau} -\setinterfacecommand{headnumber}{kopfnummer} -\setinterfacecommand{headsym}{headsym} -\setinterfacecommand{headtext}{ueberschrifttext} -\setinterfacecommand{hideblocks}{verbergebloecke} -\setinterfacecommand{high}{hoch} -\setinterfacecommand{hl}{hl} -\setinterfacecommand{immediatebetweenlist}{immediatebetweenlist} -\setinterfacecommand{immediatetolist}{immediatetolist} -\setinterfacecommand{in}{in} -\setinterfacecommand{incrementnumber}{nummererhoehen} -\setinterfacecommand{indenting}{einziehen} -\setinterfacecommand{inframed}{imumriss} -\setinterfacecommand{infull}{volleswort} -\setinterfacecommand{ininner}{ininner} -\setinterfacecommand{inleft}{imlinken} -\setinterfacecommand{inleftedge}{imlinkenrand} -\setinterfacecommand{inleftmargin}{inlinkermarginale} -\setinterfacecommand{inline}{inzeile} -\setinterfacecommand{inmargin}{inmarginalie} -\setinterfacecommand{inmframed}{immaumrise} -\setinterfacecommand{inneredgedistance}{inneredgedistance} -\setinterfacecommand{inneredgewidth}{inneredgewidth} -\setinterfacecommand{innermargindistance}{innermargindistance} -\setinterfacecommand{innermarginwidth}{innermarginwidth} -\setinterfacecommand{inothermargin}{inanderermarginale} -\setinterfacecommand{inouter}{inouter} -\setinterfacecommand{inright}{imrechten} -\setinterfacecommand{inrightedge}{imrechtenrand} -\setinterfacecommand{inrightmargin}{inrechtermarginale} -\setinterfacecommand{installlanguage}{installieresprache} -\setinterfacecommand{interactionbar}{interaktionsbalken} -\setinterfacecommand{interactionbuttons}{interaktionsknopfe} -\setinterfacecommand{interactionmenu}{interaktionsmenue} -\setinterfacecommand{item}{pos} -\setinterfacecommand{items}{posten} -\setinterfacecommand{its}{its} -\setinterfacecommand{keepblocks}{behaltebloecke} -\setinterfacecommand{label}{label} -\setinterfacecommand{labels}{labels} -\setinterfacecommand{labeltext}{labeltext} -\setinterfacecommand{language}{sprache} -\setinterfacecommand{leftaligned}{linksbuendig} -\setinterfacecommand{leftedgedistance}{abstandlinkerrand} -\setinterfacecommand{leftedgewidth}{breitelinkerrand} -\setinterfacecommand{leftmargindistance}{linkemarginalafstand} -\setinterfacecommand{leftmarginwidth}{linkemarginalbreite} -\setinterfacecommand{leg}{leg} -\setinterfacecommand{linewidth}{liniendicke} -\setinterfacecommand{listheight}{listenhoehe} -\setinterfacecommand{listlength}{listenlaenge} -\setinterfacecommand{listsymbol}{listsymbol} -\setinterfacecommand{listwidth}{listenbreite} -\setinterfacecommand{logfields}{registrierefelder} -\setinterfacecommand{lohi}{tiho} -\setinterfacecommand{low}{tief} -\setinterfacecommand{macroname}{name} -\setinterfacecommand{mainlanguage}{hauptsprache} -\setinterfacecommand{makeupheight}{satzhoehe} -\setinterfacecommand{makeupwidth}{satzbreite} -\setinterfacecommand{mar}{mar} -\setinterfacecommand{margindistance}{marginalafstand} -\setinterfacecommand{marginrule}{marginallinie} -\setinterfacecommand{margintext}{marginaltext} -\setinterfacecommand{margintitle}{marginaltitel} -\setinterfacecommand{marginwidth}{marginalbreite} -\setinterfacecommand{marginword}{marginalwort} -\setinterfacecommand{marking}{beschriftung} -\setinterfacecommand{markversion}{beschrifteversion} -\setinterfacecommand{mathematics}{mathematik} -\setinterfacecommand{menubutton}{menueknopf} -\setinterfacecommand{mframed}{maumrise} -\setinterfacecommand{midaligned}{zentriert} -\setinterfacecommand{mirror}{spiegeln} -\setinterfacecommand{month}{monat} -\setinterfacecommand{moveformula}{moveformula} -\setinterfacecommand{moveongrid}{amgitterneuausrichten} -\setinterfacecommand{movesidefloat}{movesidefloat} -\setinterfacecommand{navigating}{navigating} -\setinterfacecommand{nodimension}{keindimension} -\setinterfacecommand{noheaderandfooterlines}{keinekopfundfusszeilen} -\setinterfacecommand{noindenting}{nichteinziehen} -\setinterfacecommand{nolist}{keineliste} -\setinterfacecommand{nomarking}{keinebeschriftung} -\setinterfacecommand{nomoreblocks}{keinebloeckemehr} -\setinterfacecommand{nomorefiles}{keinedateienmehr} -\setinterfacecommand{nop}{nop} -\setinterfacecommand{nospace}{keinspatium} -\setinterfacecommand{note}{notiz} -\setinterfacecommand{notopandbottomlines}{keinzeilenobenundunten} -\setinterfacecommand{notsmallcapped}{nokap} -\setinterfacecommand{nowhitespace}{keinzwischenraum} -\setinterfacecommand{numberofsubpages}{numberofsubpages} -\setinterfacecommand{numbers}{ziffern} -\setinterfacecommand{outeredgedistance}{outeredgedistance} -\setinterfacecommand{outeredgewidth}{outeredgewidth} -\setinterfacecommand{outermargindistance}{outermargindistance} -\setinterfacecommand{outermarginwidth}{outermarginwidth} -\setinterfacecommand{packed}{kleinerdurchschuss} -\setinterfacecommand{page}{seite} -\setinterfacecommand{pagedepth}{pagedepth} -\setinterfacecommand{pagenumber}{seitenummer} -\setinterfacecommand{pageoffset}{pageoffset} -\setinterfacecommand{pagereference}{seitenreferenz} -\setinterfacecommand{pagetype}{seitentyp} -\setinterfacecommand{paperheight}{papierhoehe} -\setinterfacecommand{paperwidth}{papierbreite} -\setinterfacecommand{periods}{punkt} -\setinterfacecommand{plaatsruwelijst}{placerawlist} -\setinterfacecommand{placebookmarks}{platzierebookmarks} -\setinterfacecommand{placecombinedlist}{platzierezusammengestellteliste} -\setinterfacecommand{placefloat}{placefloat} -\setinterfacecommand{placefootnotes}{platzierefussnoten} -\setinterfacecommand{placeformula}{platziereformel} -\setinterfacecommand{placeheadnumber}{placeheadnumber} -\setinterfacecommand{placeheadtext}{placeheadtext} -\setinterfacecommand{placelegend}{platzierelegende} -\setinterfacecommand{placelist}{platziereliste} -\setinterfacecommand{placelocalfootnotes}{platzierelokalefussnoten} -\setinterfacecommand{placelogos}{platzierelogo} -\setinterfacecommand{placeongrid}{amgitterausrichten} -\setinterfacecommand{placeontopofeachother}{platziereuntereinander} -\setinterfacecommand{placepagenumber}{placepagenumber} -\setinterfacecommand{placereferencelist}{placereferencelist} -\setinterfacecommand{placeregister}{platziereregister} -\setinterfacecommand{placerule}{placerule} -\setinterfacecommand{placesidebyside}{platzierenebeneinander} -\setinterfacecommand{placesubformula}{platziereunterformel} -\setinterfacecommand{placetextvariable}{placetextvariable} -\setinterfacecommand{position}{position} -\setinterfacecommand{positiontext}{positiontext} -\setinterfacecommand{printpaperheight}{printpapierhoehe} -\setinterfacecommand{printpaperwidth}{printpapierbreite} -\setinterfacecommand{processblocks}{bearbeitebloecke} -\setinterfacecommand{processpage}{bearbeiteseite} -\setinterfacecommand{product}{produkt} -\setinterfacecommand{program}{programm} -\setinterfacecommand{project}{projekt} -\setinterfacecommand{publication}{publikation} -\setinterfacecommand{quotation}{zitat} -\setinterfacecommand{quote}{zitieren} -\setinterfacecommand{ran}{ran} -\setinterfacecommand{redo}{wiederholen} -\setinterfacecommand{ref}{ref} -\setinterfacecommand{reference}{referenz} -\setinterfacecommand{referral}{verweis} -\setinterfacecommand{referraldate}{verweisdatum} -\setinterfacecommand{referring}{referieren} -\setinterfacecommand{remark}{bemerkung} -\setinterfacecommand{reset}{ruecksetzten} -\setinterfacecommand{resetmarking}{ruecksetztenbeschriftung} -\setinterfacecommand{resetnumber}{resetnumber} -\setinterfacecommand{resettext}{resettextcontent} -\setinterfacecommand{rightaligned}{rechtsbuendig} -\setinterfacecommand{rightedgedistance}{abstandrechterrand} -\setinterfacecommand{rightedgewidth}{breiterechterrand} -\setinterfacecommand{rightmargindistance}{rechtemarginalafstand} -\setinterfacecommand{rightmarginwidth}{rechtemarginalbreite} -\setinterfacecommand{romannumerals}{roemischezahlen} -\setinterfacecommand{rotate}{drehen} -\setinterfacecommand{scale}{format} -\setinterfacecommand{screen}{bildschirm} -\setinterfacecommand{selectblocks}{waehlebloeckeaus} -\setinterfacecommand{selectpaper}{waehlepapieraus} -\setinterfacecommand{selectversion}{waehleversionaus} -\setinterfacecommand{setnumber}{setnumber} -\setinterfacecommand{settextcontent}{settext} -\setinterfacecommand{settextvariable}{settextvariable} -\setinterfacecommand{setupalign}{stelleausrichtungein} -\setinterfacecommand{setupanswerarea}{setupanswerarea} -\setinterfacecommand{setuparranging}{stelleanordnenein} -\setinterfacecommand{setupbackground}{stellehintergrundein} -\setinterfacecommand{setupbackgrounds}{stellehintergruendeein} -\setinterfacecommand{setupblackrules}{stellerechteckein} -\setinterfacecommand{setupblank}{stelleblankoein} -\setinterfacecommand{setupblock}{stelleblockein} -\setinterfacecommand{setupbodyfont}{stellefliesstextein} -\setinterfacecommand{setupbodyfontenvironment}{stellefliesstextumgebungein} -\setinterfacecommand{setupbottom}{stelleuntenein} -\setinterfacecommand{setupbottomtexts}{stelletextuntenein} -\setinterfacecommand{setupbuffer}{stellepufferein} -\setinterfacecommand{setupbuttons}{stelleknopfein} -\setinterfacecommand{setupcapitals}{stelleversalienein} -\setinterfacecommand{setupcaption}{stellebildunterschriftein} -\setinterfacecommand{setupcaptions}{stellebilderunterschriftein} -\setinterfacecommand{setupclipping}{stelleausschnittein} -\setinterfacecommand{setupcolor}{stellefarbeein} -\setinterfacecommand{setupcolors}{stellefarbenein} -\setinterfacecommand{setupcolumns}{stellespaltenein} -\setinterfacecommand{setupcolumnset}{setupcolumnset} -\setinterfacecommand{setupcolumnsetlines}{setupcolumnsetlines} -\setinterfacecommand{setupcolumnsetstart}{setupcolumnsetstart} -\setinterfacecommand{setupcombinations}{stellekombinationein} -\setinterfacecommand{setupcombinedlist}{stellezusammengestelltelisteein} -\setinterfacecommand{setupcomment}{stellekommentarein} -\setinterfacecommand{setupdescriptions}{definierebeschreibungen} -\setinterfacecommand{setupenumerations}{stellebeschreibungein} -\setinterfacecommand{setupexternalfigures}{stelleexterneabbildungenein} -\setinterfacecommand{setupfield}{stellefeldein} -\setinterfacecommand{setupfields}{stellefelderin} -\setinterfacecommand{setupfillinlines}{stellegefuelltezeileein} -\setinterfacecommand{setupfillinrules}{stellegefuelltesrechteckein} -\setinterfacecommand{setupfloat}{stellegleitobjektein} -\setinterfacecommand{setupfloats}{stellegleitobjekteein} -\setinterfacecommand{setupfloatsplitting}{stelleplatziegeteiltegleitobjekt} -\setinterfacecommand{setupfooter}{stellefusszeileein} -\setinterfacecommand{setupfootertexts}{stellefusszeilentextein} -\setinterfacecommand{setupfootnotedefinition}{stellefussnotendefinitionein} -\setinterfacecommand{setupfootnotes}{stellefussnotenein} -\setinterfacecommand{setupforms}{setupforms} -\setinterfacecommand{setupformulas}{stelleformelnein} -\setinterfacecommand{setupframed}{stelleumrahmtein} -\setinterfacecommand{setupframedtexts}{stelleumrahmtetexteein} -\setinterfacecommand{setuphead}{stelleueberschriftein} -\setinterfacecommand{setupheader}{stellekopfzeileein} -\setinterfacecommand{setupheadertexts}{stellekopfzeilentextein} -\setinterfacecommand{setupheadnumber}{stellekopfzahlein} -\setinterfacecommand{setupheads}{stelleueberschriftenein} -\setinterfacecommand{setupheadtext}{stelleueberschrifttextein} -\setinterfacecommand{setuphyphenmark}{stellebindestrichein} -\setinterfacecommand{setupindentations}{stelleeinzuegein} -\setinterfacecommand{setupindenting}{stelleeinziehenein} -\setinterfacecommand{setupinmargin}{stelleinmarginalieein} -\setinterfacecommand{setupinteraction}{stelleinteraktionein} -\setinterfacecommand{setupinteractionbar}{stelleinteraktionsbalkenein} -\setinterfacecommand{setupinteractionmenu}{stelleinteraktionsmenueein} -\setinterfacecommand{setupinteractionscreen}{stelleinteraktionsbildschirmein} -\setinterfacecommand{setupinterlinespace}{stellezeilenabstandein} -\setinterfacecommand{setupitemgroup}{setupitemgroup} -\setinterfacecommand{setupitemgroups}{stelleaufzaehlungenein} -\setinterfacecommand{setupitems}{stellepostenein} -\setinterfacecommand{setuplabeltext}{stellelabeltextein} -\setinterfacecommand{setuplanguage}{stellespracheein} -\setinterfacecommand{setuplayout}{stellelayoutein} -\setinterfacecommand{setuplegend}{stellelegendeein} -\setinterfacecommand{setuplinenumbering}{stellezeilennumerierungein} -\setinterfacecommand{setuplines}{stellezeilenein} -\setinterfacecommand{setuplinewidth}{stellelinienbreiteein} -\setinterfacecommand{setuplist}{stellelisteein} -\setinterfacecommand{setupmakeup}{stelleumbruchein} -\setinterfacecommand{setupmarginblocks}{stellemarginalblockein} -\setinterfacecommand{setupmarginrules}{stellemarginallinieein} -\setinterfacecommand{setupmarking}{stellebeschriftungein} -\setinterfacecommand{setupmathalignment}{setupmathalignment} -\setinterfacecommand{setupnarrower}{stelleengerein} -\setinterfacecommand{setupnumber}{setupnumber} -\setinterfacecommand{setupnumbering}{stellenummerierungein} -\setinterfacecommand{setupoppositeplacing}{stellegegenueberplatzierenein} -\setinterfacecommand{setupoutput}{stelleausgabeein} -\setinterfacecommand{setuppagecomment}{stelleseitenkommentarein} -\setinterfacecommand{setuppagenumber}{stelleseitennummerein} -\setinterfacecommand{setuppagenumbering}{stelleseitennummeriernungein} -\setinterfacecommand{setuppagetransitions}{stelleseitenuebergangein} -\setinterfacecommand{setuppalet}{stellepaletteein} -\setinterfacecommand{setuppaper}{setuppaper} -\setinterfacecommand{setuppapersize}{stellepapierformatein} -\setinterfacecommand{setupparagraphnumbering}{stelleabsatznummerierungein} -\setinterfacecommand{setupparagraphs}{stelleabsaetzeein} -\setinterfacecommand{setupplacement}{setupplacement} -\setinterfacecommand{setuppositioning}{stellepositionierenein} -\setinterfacecommand{setupprofiles}{stelleprofilein} -\setinterfacecommand{setupprograms}{stelleprogrammein} -\setinterfacecommand{setuppublications}{stellepublikationein} -\setinterfacecommand{setupquote}{stellezitierenein} -\setinterfacecommand{setupreferencelist}{stellereferenzlisteein} -\setinterfacecommand{setupreferencing}{stellereferenzierenein} -\setinterfacecommand{setupregister}{stelleregisterein} -\setinterfacecommand{setuprotate}{stelledrehenein} -\setinterfacecommand{setuprule}{setuprule} -\setinterfacecommand{setups}{einstellungen} -\setinterfacecommand{setupscreens}{stellerasterein} -\setinterfacecommand{setupsection}{stelleabschnittein} -\setinterfacecommand{setupsectionblock}{stelleabschnittsblockein} -\setinterfacecommand{setupsorting}{stellesortierenein} -\setinterfacecommand{setupspacing}{stellespatiumein} -\setinterfacecommand{setupstartstop}{setupstartstop} -\setinterfacecommand{setupstrut}{setupstrut} -\setinterfacecommand{setupsubpagenumber}{stelleunterseitennummerein} -\setinterfacecommand{setupsymbolset}{stellesymbolsetein} -\setinterfacecommand{setupsynchronization}{stellesynchronisationein} -\setinterfacecommand{setupsynchronizationbar}{stellesynchronisationsbalkenein} -\setinterfacecommand{setupsynonyms}{stellesynonymein} -\setinterfacecommand{setupsystem}{stellesystemein} -\setinterfacecommand{setuptab}{stelletabein} -\setinterfacecommand{setuptables}{stelletabellenein} -\setinterfacecommand{setuptabulate}{stelletabulatorein} -\setinterfacecommand{setuptext}{stelletextein} -\setinterfacecommand{setuptextposition}{setuptextposition} -\setinterfacecommand{setuptextrules}{stelletextumrissein} -\setinterfacecommand{setuptexttexts}{stelletexttexteein} -\setinterfacecommand{setuptextvariable}{setuptextvariable} -\setinterfacecommand{setupthinrules}{stelleduennerumrissein} -\setinterfacecommand{setuptolerance}{stelletoleranzein} -\setinterfacecommand{setuptop}{stellenobenein} -\setinterfacecommand{setuptoptexts}{stelletextobenein} -\setinterfacecommand{setuptype}{stelletipein} -\setinterfacecommand{setuptyping}{stelletippenein} -\setinterfacecommand{setupunderbar}{stelleunterstreichenein} -\setinterfacecommand{setupurl}{stelleurlein} -\setinterfacecommand{setupversions}{stelleversionein} -\setinterfacecommand{setupwhitespace}{stellezwischenraumein} -\setinterfacecommand{showbodyfont}{zeigefliesstext} -\setinterfacecommand{showbodyfontenvironment}{zeigefliesstextumgebung} -\setinterfacecommand{showcolor}{zeigefarbe} -\setinterfacecommand{showcolorgroup}{zeigefarbengruppe} -\setinterfacecommand{showexternalfigures}{zeigeexterneabbildungen} -\setinterfacecommand{showfields}{zeigefelder} -\setinterfacecommand{showframe}{zeigerahmen} -\setinterfacecommand{showgrid}{zeigegitter} -\setinterfacecommand{showlayout}{zeigelayout} -\setinterfacecommand{showmakeup}{zeigeumbruch} -\setinterfacecommand{showpalet}{zeigepalette} -\setinterfacecommand{showprint}{zeigedruck} -\setinterfacecommand{showsetups}{zeigeeinstellungen} -\setinterfacecommand{showstruts}{zeigestruts} -\setinterfacecommand{showsymbolset}{showsymbolset} -\setinterfacecommand{smallcapped}{kap} -\setinterfacecommand{someline}{einezeile} -\setinterfacecommand{somewhere}{irgendwo} -\setinterfacecommand{space}{spatium} -\setinterfacecommand{splitfloat}{teilegleitobjekt} -\setinterfacecommand{startalignment}{startausrichtung} -\setinterfacecommand{startbackground}{starthintergrund} -\setinterfacecommand{startcoding}{startkodierung} -\setinterfacecommand{startcolor}{startfarbe} -\setinterfacecommand{startcolumnmakeup}{startcolumnmakeup} -\setinterfacecommand{startcolumns}{startspalten} -\setinterfacecommand{startcolumnset}{startcolumnset} -\setinterfacecommand{startcombination}{startkombination} -\setinterfacecommand{startcomponent}{startkomponente} -\setinterfacecommand{startdocument}{startdokument} -\setinterfacecommand{startenvironment}{startumgebung} -\setinterfacecommand{startfigure}{startabbildung} -\setinterfacecommand{startglobal}{startglobal} -\setinterfacecommand{startline}{startzeile} -\setinterfacecommand{startlinecorrection}{startzeilenkorrektur} -\setinterfacecommand{startlinenumbering}{startzeilennumerierung} -\setinterfacecommand{startlines}{startzeilen} -\setinterfacecommand{startlocal}{startlokal} -\setinterfacecommand{startlocalfootnotes}{startlokalefussnoten} -\setinterfacecommand{startmakeup}{startumbruch} -\setinterfacecommand{startmarginblock}{startmarginalblock} -\setinterfacecommand{startmarginrule}{startmarginallinie} -\setinterfacecommand{startnarrower}{startenger} -\setinterfacecommand{startopposite}{startgegenueber} -\setinterfacecommand{startoverlay}{startoverlay} -\setinterfacecommand{startoverzicht}{startueberblick} -\setinterfacecommand{startpacked}{startkleinerdurchschuss} -\setinterfacecommand{startpositioning}{startpositionieren} -\setinterfacecommand{startproduct}{startprodukt} -\setinterfacecommand{startprofile}{startprofil} -\setinterfacecommand{startproject}{startprojekt} -\setinterfacecommand{startquotation}{startzitat} -\setinterfacecommand{startraster}{startraster} -\setinterfacecommand{startsymbolset}{startsymbolset} -\setinterfacecommand{startsynchronization}{startsynchronisation} -\setinterfacecommand{starttable}{starttabelle} -\setinterfacecommand{starttables}{starttabellen} -\setinterfacecommand{starttext}{starttext} -\setinterfacecommand{starttextrule}{starttextlinie} -\setinterfacecommand{startunpacked}{startgrosserdurchschuss} -\setinterfacecommand{startversion}{startversion} -\setinterfacecommand{stopalignment}{stopausrichtung} -\setinterfacecommand{stopbackground}{stophintergrund} -\setinterfacecommand{stopcoding}{stopkodierung} -\setinterfacecommand{stopcolor}{stopfarbe} -\setinterfacecommand{stopcolumnmakeup}{stopcolumnmakeup} -\setinterfacecommand{stopcolumns}{stopspalten} -\setinterfacecommand{stopcolumnset}{stopcolumnset} -\setinterfacecommand{stopcombination}{stopkombination} -\setinterfacecommand{stopcomponent}{stopkomponente} -\setinterfacecommand{stopdocument}{stopdokument} -\setinterfacecommand{stopenvironment}{stopumgebung} -\setinterfacecommand{stopglobal}{stopglobal} -\setinterfacecommand{stopline}{stopzeile} -\setinterfacecommand{stoplinecorrection}{stopzeilenkorrektur} -\setinterfacecommand{stoplinenumbering}{stopzeilennumerierung} -\setinterfacecommand{stoplines}{stopzeilen} -\setinterfacecommand{stoplocal}{stoplokal} -\setinterfacecommand{stoplocalfootnotes}{stoplokalefussnoten} -\setinterfacecommand{stopmakeup}{stopumbruch} -\setinterfacecommand{stopmarginblock}{stopmarginalblock} -\setinterfacecommand{stopmarginrule}{stopmarginallinie} -\setinterfacecommand{stopnarrower}{stopenger} -\setinterfacecommand{stopopposite}{stopgegenueber} -\setinterfacecommand{stopoverlay}{stopoverlay} -\setinterfacecommand{stopoverzicht}{stopueberblick} -\setinterfacecommand{stoppacked}{stopkleinerdurchschuss} -\setinterfacecommand{stoppositioning}{stoppositionieren} -\setinterfacecommand{stopproduct}{stopprodukt} -\setinterfacecommand{stopprofile}{stopprofil} -\setinterfacecommand{stopproject}{stopprojekt} -\setinterfacecommand{stopquotation}{stopzitat} -\setinterfacecommand{stopraster}{stopraster} -\setinterfacecommand{stopsynchronization}{stopsynchronisation} -\setinterfacecommand{stoptable}{stoptabelle} -\setinterfacecommand{stoptables}{stoptabellen} -\setinterfacecommand{stoptext}{stoptext} -\setinterfacecommand{stoptextrule}{stoptextlinie} -\setinterfacecommand{stopunpacked}{stopgrosserdurchschuss} -\setinterfacecommand{stopversion}{stopversion} -\setinterfacecommand{stretched}{gestreckt} -\setinterfacecommand{subformulanumber}{unterformelnummer} -\setinterfacecommand{subpagenumber}{subpagenumber} -\setinterfacecommand{switchtobodyfont}{wechselezumfliesstext} -\setinterfacecommand{switchtorawfont}{switchtorawfont} -\setinterfacecommand{sym}{sym} -\setinterfacecommand{symbol}{symbol} -\setinterfacecommand{synchronizationbar}{synchronisationsbalken} -\setinterfacecommand{synchronize}{synchronisieren} -\setinterfacecommand{tab}{tab} -\setinterfacecommand{testcolumn}{testcolumn} -\setinterfacecommand{testpage}{testpage} -\setinterfacecommand{tex}{tex} -\setinterfacecommand{textheight}{texthoehe} -\setinterfacecommand{textreference}{textreferenz} -\setinterfacecommand{textrule}{textlinie} -\setinterfacecommand{textvariable}{textvariable} -\setinterfacecommand{textwidth}{textbreite} -\setinterfacecommand{thinrule}{duennelinie} -\setinterfacecommand{thinrules}{duennerumriss} -\setinterfacecommand{tooltip}{tooltip} -\setinterfacecommand{topdistance}{abstandoben} -\setinterfacecommand{topheight}{hoeheoben} -\setinterfacecommand{topspace}{kopfweite} -\setinterfacecommand{totalnumberofpages}{gesamtseitenanzahl} -\setinterfacecommand{translate}{uebersetzten} -\setinterfacecommand{txt}{txt} -\setinterfacecommand{typ}{tip} -\setinterfacecommand{type}{tippen} -\setinterfacecommand{typebuffer}{tippepuffer} -\setinterfacecommand{typefile}{tippedatei} -\setinterfacecommand{unitmeaning}{bedeutung} -\setinterfacecommand{unknown}{unbekant} -\setinterfacecommand{useJSscripts}{verwendeJSscript} -\setinterfacecommand{useURL}{verwendeURL} -\setinterfacecommand{useXMLfilter}{useXMLfilter} -\setinterfacecommand{useblocks}{verwendebloecke} -\setinterfacecommand{usecommands}{verwendebefehl} -\setinterfacecommand{useencoding}{benutzekodierung} -\setinterfacecommand{useexternaldocument}{verwendeexteresdokument} -\setinterfacecommand{useexternalfigure}{verwendeexterneabbildung} -\setinterfacecommand{useexternalfile}{verwendeexternedatei} -\setinterfacecommand{useexternalfiles}{verwendeexternedateien} -\setinterfacecommand{useexternalsoundtrack}{verwendeexternestonstueck} -\setinterfacecommand{usemodule}{verwendemodul} -\setinterfacecommand{usemodules}{verwendemodule} -\setinterfacecommand{usepath}{benutzeverzeichnis} -\setinterfacecommand{usereferences}{verwendereferenzen} -\setinterfacecommand{usespecials}{benutzespezielles} -\setinterfacecommand{usesymbols}{verwendesymbole} -\setinterfacecommand{usetypescript}{usetypescript} -\setinterfacecommand{usetypescriptfile}{usetypescriptfile} -\setinterfacecommand{useurl}{verwendeurl} -\setinterfacecommand{version}{version} -\setinterfacecommand{vl}{vl} -\setinterfacecommand{weekday}{wochentag} -\setinterfacecommand{whitespace}{zwischenraum} -\setinterfacecommand{wordright}{wortrechts} -\setinterfacecommand{writebetweenlist}{schreibezwischenliste} -\setinterfacecommand{writetolist}{schreibezurliste} -\setinterfacecommand{writetoreferencelist}{schreibezurreferenzliste} -\setinterfacecommand{writetoregister}{schreibezumregister} -% -\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-def.lua b/Master/texmf-dist/tex/context/base/mult-def.lua index ce5af2bba37..8499dd43b29 100644 --- a/Master/texmf-dist/tex/context/base/mult-def.lua +++ b/Master/texmf-dist/tex/context/base/mult-def.lua @@ -38,16 +38,16 @@ return { ["pe"]="Characters", ["ro"]="Litere", }, - ["LABELTEXT"]={ - ["cs"]="TEXTPOPISKU", - ["de"]="LABELTEXT", - ["en"]="LABELTEXT", - ["fr"]="LABELTEXTE", - ["it"]="TESTOETICHETTA", - ["nl"]="LABELTEKST", - ["pe"]="LABELTEXT", - ["ro"]="TEXTETICHETA", - }, +--~ ["LABELTEXT"]={ +--~ ["cs"]="TEXTPOPISKU", +--~ ["de"]="LABELTEXT", +--~ ["en"]="LABELTEXT", +--~ ["fr"]="LABELTEXTE", +--~ ["it"]="TESTOETICHETTA", +--~ ["nl"]="LABELTEKST", +--~ ["pe"]="LABELTEXT", +--~ ["ro"]="TEXTETICHETA", +--~ }, ["MONTH"]={ ["cs"]="MESIC", ["de"]="MONAT", @@ -168,7 +168,8 @@ return { ["pe"]="تنظیم‌طرح‌بندی", ["ro"]="adapteazaaspect", }, - ["adding"]={}, + ["adding"]={ + }, ["arg"]={ ["cs"]="arg", ["de"]="arg", @@ -429,16 +430,6 @@ return { ["pe"]="ستون", ["ro"]="coloana", }, - ["comment"]={ - ["cs"]="komentar", - ["de"]="kommentar", - ["en"]="comment", - ["fr"]="commentaire", - ["it"]="commento", - ["nl"]="commentaar", - ["pe"]="توضیح", - ["ro"]="comentariu", - }, ["comparecolorgroup"]={ ["cs"]="porovnejskupinubarev", ["de"]="vergleichefarbengruppe", @@ -6480,6 +6471,14 @@ return { }, }, ["constants"]={ + ["keys"]={ + ["en"]="keys", + ["nl"]="sleutels", -- brrr + }, + ["entries"]={ + ["en"]="entries", + ["nl"]="ingangen", + }, ["strip"]={ ["en"]="strip", }, @@ -6578,6 +6577,14 @@ return { ["maybeyear"]={ ["en"]="maybeyear", }, +--["group"]={ +-- ["en"]="group", +-- ["nl"]="groep", +--}, + ["values"]={ + ["en"]="values", + ["nl"]="waarden", + }, ["action"]={ ["cs"]="akce", ["de"]="aktion", @@ -6618,6 +6625,10 @@ return { ["pe"]="بعدازسر", ["ro"]="dupatitlu", }, + ["aftersection"]={ + ["en"]="aftersection", + ["nl"]="nasectie", + }, ["afterkey"]={ ["cs"]="klavesapo", ["de"]="nachtaste", @@ -6728,6 +6739,10 @@ return { ["pe"]="خودکار", ["ro"]="auto", }, + ["autocase"]={ + ["en"]="autocase", + ["nl"]="autocase", + }, ["autofile"]={ ["cs"]="autofile", ["de"]="autofile", @@ -6868,6 +6883,10 @@ return { ["pe"]="فضای‌پس", ["ro"]="spatiuspate", }, + ["backreference"]={ + ["en"]="backreference", + ["nl"]="terugreferentie", + }, ["balance"]={ ["cs"]="rovnovaha", ["de"]="ausgleichen", @@ -6888,6 +6907,10 @@ return { ["pe"]="قبل‌از", ["ro"]="inainte", }, + ["beforesection"]={ + ["en"]="beforesection", + ["nl"]="voorsectie", + }, ["beforehead"]={ ["cs"]="predhlavickou", ["de"]="vorkopf", @@ -7024,6 +7047,10 @@ return { ["pe"]="وضعیت‌پایین", ["ro"]="starejos", }, + ["buffer"]={ + ["en"]="buffer", + ["nl"]="buffer", + }, ["cache"]={ ["cs"]="cache", ["de"]="cache", @@ -7044,6 +7071,10 @@ return { ["pe"]="محاسبه", ["ro"]="calculeaza", }, + ["category"]={ + ["en"]="category", + ["nl"]="categorie", + }, ["ccommand"]={ ["cs"]="cprikaz", ["de"]="cbefehl", @@ -7124,6 +7155,10 @@ return { ["pe"]="بستن‌عمل‌صفحه", ["ro"]="actiuneinchiderepagina", }, + ["closepage"]={ + ["en"]="closepage", + ["nl"]="sluitpagina", + }, ["closesymbol"]={ ["cs"]="closesymbol", ["de"]="closesymbol", @@ -7480,6 +7515,10 @@ return { ["pe"]="نمایش", ["ro"]="display", }, + ["mask"]={ + ["en"]="mask", + ["nl"]="masker", + }, ["distance"]={ ["cs"]="vzdalenost", ["de"]="abstand", @@ -7783,6 +7822,16 @@ return { ["pe"]="رنگ‌پیش‌زمینه", ["ro"]="foregroundcolor", }, + ["force"]={ + ["cs"]="sila", + ["de"]="zwinge", + ["en"]="force", + ["fr"]="force", + ["it"]="forza", + ["nl"]="forceer", + ["pe"]="اجبار", + ["ro"]="fortat", + }, ["foregroundstyle"]={ ["cs"]="foregroundstyle", ["de"]="foregroundstyle", @@ -8206,6 +8255,10 @@ return { ["pe"]="فضای‌بین‌خط", ["ro"]="spatiereinterliniara", }, + ["internalgrid"]={ + ["nl"]="interngrid", + ["en"]="internalgrid", + }, ["itemalign"]={ ["cs"]="itemalign", ["de"]="itemalign", @@ -9090,6 +9143,10 @@ return { ["pe"]="عمل‌صفحه‌باز", ["ro"]="actiunedeschiderepagina", }, + ["openpage"]={ + ["en"]="openpage", + ["nl"]="openpagina", + }, ["option"]={ ["cs"]="volba", ["de"]="option", @@ -9412,6 +9469,9 @@ return { ["pe"]="پردازش", ["ro"]="process", }, + ["profile"]={ + ["en"]="profile", + }, ["radius"]={ ["cs"]="polomer", ["de"]="radius", @@ -10213,6 +10273,10 @@ return { ["pe"]="پسوند", ["ro"]="suffix", }, + ["suffixseparator"]={ + ["en"]="suffixseparator", + ["nl"]="suffixscheider", + }, ["sx"]={ ["cs"]="sx", ["de"]="sx", @@ -10453,6 +10517,9 @@ return { ["pe"]="عرض‌متن", ["ro"]="latimetext", }, + ["threshold"]={ + ["en"]="threshold", -- rather international term + }, ["title"]={ ["cs"]="titul", ["de"]="titel", @@ -11127,6 +11194,10 @@ return { }, }, ["variables"]={ + ["embed"]={ + ["en"]="embed", + ["nl"]="sluitin", + }, ["end"]={ ["en"]="end", ["nl"]="eind", @@ -11143,6 +11214,14 @@ return { ["en"]="up", ["nl"]="omhoog", }, + ["smaller"]={ + ["en"]="smaller", + ["nl"]="kleiner", + }, + ["bigger"]={ + ["en"]="bigger", + ["nl"]="groter", + }, ["underbar"]={ ["cs"]="podtrzeno", ["de"]="unterstrichen", @@ -11908,6 +11987,16 @@ return { ["pe"]="همواره", ["ro"]="totdeauna", }, + ["and"]={ + --["cs"]="", + ["de"]="und", + ["en"]="and", + --["fr"]="", + --["it"]="", + ["nl"]="en", + --["pe"]="", + --["ro"]="", + }, ["answerarea"]={ ["cs"]="answerarea", ["de"]="answerarea", @@ -11948,6 +12037,10 @@ return { ["pe"]="آوریل", ["ro"]="aprilie", }, + ["attachment"]={ + ["en"]="attachment", + ["nl"]="aanhangsel", + }, ["atmargin"]={ ["cs"]="naokraji", ["de"]="amrand", @@ -11972,7 +12065,7 @@ return { ["cs"]="srpen", ["de"]="August", ["en"]="August", - ["fr"]="aout", + ["fr"]="août", ["it"]="agosto", ["nl"]="augustus", ["pe"]="آگوست", @@ -12418,6 +12511,10 @@ return { ["pe"]="ادامه", ["ro"]="continuu", }, + ["continued"]={ + ["en"]="continued", + ["nl"]="vervolgd", + }, ["controls"]={ ["cs"]="controls", ["de"]="controls", @@ -14721,6 +14818,16 @@ return { ["pe"]="مراجعه", ["ro"]="referinta", }, + ["reference"]={ + ["cs"]="odkaz", + ["de"]="referenz", + ["en"]="reference", + ["fr"]="reference", + ["it"]="riferimento", + ["nl"]="referentie", + ["pe"]="مرجع", + ["ro"]="referinta", + }, ["register"]={ ["cs"]="rejstrik", ["de"]="register", diff --git a/Master/texmf-dist/tex/context/base/mult-def.mkii b/Master/texmf-dist/tex/context/base/mult-def.mkii new file mode 100644 index 00000000000..0e1a7dee71f --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-def.mkii @@ -0,0 +1,31 @@ +%D \module +%D [ file=mult-def, +%D version=2008.10.22, +%D title=\CONTEXT\ Multilingual Macros, +%D subtitle=Definitions, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +\setvalue{@interface@czech@}{cs} +\setvalue{@interface@german@}{de} +\setvalue{@interface@english@}{en} +\setvalue{@interface@french@}{fr} +\setvalue{@interface@italian@}{it} +\setvalue{@interface@dutch@}{nl} +\setvalue{@interface@persian@}{pe} +\setvalue{@interface@romanian@}{ro} + +\def\userinterfacetag{\ifcsname @interface@\currentinterface @\endcsname\csname @interface@\currentinterface @\endcsname\else en\fi} +\def\userresponsestag{\ifcsname @interface@\currentresponses @\endcsname\csname @interface@\currentresponses @\endcsname\else en\fi} + +\input mult-\userinterfacetag .\mksuffix \relax +\input mult-m\userresponsestag.\mksuffix \relax + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/mult-def.mkiv b/Master/texmf-dist/tex/context/base/mult-def.mkiv new file mode 100644 index 00000000000..a273fa18a03 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-def.mkiv @@ -0,0 +1,33 @@ +%D \module +%D [ file=mult-def, +%D version=2008.10.22, +%D title=\CONTEXT\ Multilingual Macros, +%D subtitle=Definitions, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +\setvalue{@interface@czech@}{cs} +\setvalue{@interface@german@}{de} +\setvalue{@interface@english@}{en} +\setvalue{@interface@french@}{fr} +\setvalue{@interface@italian@}{it} +\setvalue{@interface@dutch@}{nl} +\setvalue{@interface@persian@}{pe} +\setvalue{@interface@romanian@}{ro} + +\def\userinterfacetag{\ifcsname @interface@\currentinterface @\endcsname\csname @interface@\currentinterface @\endcsname\else en\fi} +\def\userresponsestag{\ifcsname @interface@\currentresponses @\endcsname\csname @interface@\currentresponses @\endcsname\else en\fi} + +% \input mult-\userinterfacetag \relax +% \input mult-m\userresponsestag \relax + +\ctxlua{interfaces.setuserinterface("\userinterfacetag","\userresponsestag")} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/mult-def.tex b/Master/texmf-dist/tex/context/base/mult-def.tex deleted file mode 100644 index cff9fb07434..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-def.tex +++ /dev/null @@ -1,35 +0,0 @@ -%D \module -%D [ file=mult-def, -%D version=2008.10.22, -%D title=\CONTEXT\ Multilingual Macros, -%D subtitle=Definitions, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\unprotect - -\setvalue{@interface@czech@}{cs} -\setvalue{@interface@german@}{de} -\setvalue{@interface@english@}{en} -\setvalue{@interface@french@}{fr} -\setvalue{@interface@italian@}{it} -\setvalue{@interface@dutch@}{nl} -\setvalue{@interface@persian@}{pe} -\setvalue{@interface@romanian@}{ro} - -% \def\userinterfacetag -% {\ifcsname @interface@\defaultinterface @\endcsname\csname @interface@\defaultinterface @\endcsname\else en\fi} -\def\userinterfacetag - {\ifcsname @interface@\currentinterface @\endcsname\csname @interface@\currentinterface @\endcsname\else en\fi} -\def\userresponsestag - {\ifcsname @interface@\currentresponses @\endcsname\csname @interface@\currentresponses @\endcsname\else en\fi} - -\input mult-\userinterfacetag \relax -\input mult-m\userresponsestag \relax - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/mult-en.mkii b/Master/texmf-dist/tex/context/base/mult-en.mkii new file mode 100644 index 00000000000..a40f341c63d --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-en.mkii @@ -0,0 +1,1715 @@ +% this file is auto-generated, don't edit this file +% +% definitions for interface variables for language en +% +\setinterfacevariable{Addition}{Addition} +\setinterfacevariable{Balloon}{Balloon} +\setinterfacevariable{Character}{Character} +\setinterfacevariable{Characters}{Characters} +\setinterfacevariable{CloseDocument}{CloseDocument} +\setinterfacevariable{ExitViewer}{ExitViewer} +\setinterfacevariable{FirstPage}{FirstPage} +\setinterfacevariable{FitHeight}{FitHeight} +\setinterfacevariable{FitWidth}{FitWidth} +\setinterfacevariable{GotoPage}{GotoPage} +\setinterfacevariable{Greek}{Greek} +\setinterfacevariable{Help}{Help} +\setinterfacevariable{HideField}{HideField} +\setinterfacevariable{HideLayer}{HideLayer} +\setinterfacevariable{Key}{Key} +\setinterfacevariable{LastPage}{LastPage} +\setinterfacevariable{LoadForm}{LoadForm} +\setinterfacevariable{MONTH}{MONTH} +\setinterfacevariable{New}{New} +\setinterfacevariable{NextJump}{NextJump} +\setinterfacevariable{NextPage}{NextPage} +\setinterfacevariable{Numbers}{Numbers} +\setinterfacevariable{OpenNamedDocument}{OpenNamedDocument} +\setinterfacevariable{Paragraph}{Paragraph} +\setinterfacevariable{PauseMovie}{PauseMovie} +\setinterfacevariable{PauseRendering}{PauseRendering} +\setinterfacevariable{PauseSound}{PauseSound} +\setinterfacevariable{PreviousJump}{PreviousJump} +\setinterfacevariable{PreviousPage}{PreviousPage} +\setinterfacevariable{PrintDocument}{PrintDocument} +\setinterfacevariable{Query}{Query} +\setinterfacevariable{QueryAgain}{QueryAgain} +\setinterfacevariable{ResetForm}{ResetForm} +\setinterfacevariable{ResumeMovie}{ResumeMovie} +\setinterfacevariable{ResumeRendering}{ResumeRendering} +\setinterfacevariable{ResumeSound}{ResumeSound} +\setinterfacevariable{Romannumerals}{Romannumerals} +\setinterfacevariable{SaveDocument}{SaveDocument} +\setinterfacevariable{SaveForm}{SaveForm} +\setinterfacevariable{SaveNamedDocument}{SaveNamedDocument} +\setinterfacevariable{SearchAgain}{SearchAgain} +\setinterfacevariable{SearchDocument}{SearchDocument} +\setinterfacevariable{ShowBookmarks}{ShowBookmarks} +\setinterfacevariable{ShowField}{ShowField} +\setinterfacevariable{ShowThumbs}{ShowThumbs} +\setinterfacevariable{StartMovie}{StartMovie} +\setinterfacevariable{StartRendering}{StartRendering} +\setinterfacevariable{StartSound}{StartSound} +\setinterfacevariable{StopMovie}{StopMovie} +\setinterfacevariable{StopRendering}{StopRendering} +\setinterfacevariable{StopSound}{StopSound} +\setinterfacevariable{SubmitForm}{SubmitForm} +\setinterfacevariable{ToggleLayer}{ToggleLayer} +\setinterfacevariable{ToggleViewer}{ToggleViewer} +\setinterfacevariable{URL}{URL} +\setinterfacevariable{VideLayer}{VideLayer} +\setinterfacevariable{ViewerHelp}{ViewerHelp} +\setinterfacevariable{WEEKDAY}{WEEKDAY} +\setinterfacevariable{WORD}{WORD} +\setinterfacevariable{abbreviation}{abbreviation} +\setinterfacevariable{abbreviations}{abbreviations} +\setinterfacevariable{absolute}{absolute} +\setinterfacevariable{action}{action} +\setinterfacevariable{after}{after} +\setinterfacevariable{all}{all} +\setinterfacevariable{always}{always} +\setinterfacevariable{and}{and} +\setinterfacevariable{answerarea}{answerarea} +\setinterfacevariable{appendices}{appendices} +\setinterfacevariable{appendix}{appendix} +\setinterfacevariable{april}{April} +\setinterfacevariable{atmargin}{atmargin} +\setinterfacevariable{atpage}{atpage} +\setinterfacevariable{attachment}{attachment} +\setinterfacevariable{august}{August} +\setinterfacevariable{author}{author} +\setinterfacevariable{auto}{auto} +\setinterfacevariable{autointro}{autointro} +\setinterfacevariable{back}{back} +\setinterfacevariable{background}{background} +\setinterfacevariable{backmatter}{backmatter} +\setinterfacevariable{backpart}{backpart} +\setinterfacevariable{backspace}{backspace} +\setinterfacevariable{backward}{backward} +\setinterfacevariable{bbl}{bbl} +\setinterfacevariable{before}{before} +\setinterfacevariable{begin}{begin} +\setinterfacevariable{bib}{bib} +\setinterfacevariable{big}{big} +\setinterfacevariable{bigbodyfont}{bigbodyfont} +\setinterfacevariable{bigger}{bigger} +\setinterfacevariable{bigpreference}{bigpreference} +\setinterfacevariable{blank}{blank} +\setinterfacevariable{blockquote}{blockquote} +\setinterfacevariable{bodymatter}{bodymatter} +\setinterfacevariable{bodypart}{bodypart} +\setinterfacevariable{bold}{bold} +\setinterfacevariable{bolditalic}{bolditalic} +\setinterfacevariable{boldslanted}{boldslanted} +\setinterfacevariable{bookmark}{bookmark} +\setinterfacevariable{both}{both} +\setinterfacevariable{bottom}{bottom} +\setinterfacevariable{brief}{brief} +\setinterfacevariable{broad}{broad} +\setinterfacevariable{buffer}{buffer} +\setinterfacevariable{by}{by} +\setinterfacevariable{calligraphic}{calligraphic} +\setinterfacevariable{cap}{cap} +\setinterfacevariable{capital}{capital} +\setinterfacevariable{center}{center} +\setinterfacevariable{chapter}{chapter} +\setinterfacevariable{character}{character} +\setinterfacevariable{characters}{characters} +\setinterfacevariable{cite}{cite} +\setinterfacevariable{color}{color} +\setinterfacevariable{column}{column} +\setinterfacevariable{columns}{columns} +\setinterfacevariable{command}{command} +\setinterfacevariable{commands}{commands} +\setinterfacevariable{comment}{comment} +\setinterfacevariable{component}{component} +\setinterfacevariable{concept}{concept} +\setinterfacevariable{content}{content} +\setinterfacevariable{contents}{contents} +\setinterfacevariable{continue}{continue} +\setinterfacevariable{continued}{continued} +\setinterfacevariable{controls}{controls} +\setinterfacevariable{conversion}{conversion} +\setinterfacevariable{current}{current} +\setinterfacevariable{cutspace}{cutspace} +\setinterfacevariable{date}{date} +\setinterfacevariable{day}{day} +\setinterfacevariable{december}{December} +\setinterfacevariable{default}{default} +\setinterfacevariable{depth}{depth} +\setinterfacevariable{description}{description} +\setinterfacevariable{disable}{disable} +\setinterfacevariable{display}{display} +\setinterfacevariable{dot}{dot} +\setinterfacevariable{doublesided}{doublesided} +\setinterfacevariable{down}{down} +\setinterfacevariable{each}{each} +\setinterfacevariable{edge}{edge} +\setinterfacevariable{embed}{embed} +\setinterfacevariable{empty}{empty} +\setinterfacevariable{end}{end} +\setinterfacevariable{endnote}{endnote} +\setinterfacevariable{enumeration}{enumeration} +\setinterfacevariable{environment}{environment} +\setinterfacevariable{even}{even} +\setinterfacevariable{external}{external} +\setinterfacevariable{fact}{fact} +\setinterfacevariable{february}{February} +\setinterfacevariable{figure}{figure} +\setinterfacevariable{figures}{figures} +\setinterfacevariable{file}{file} +\setinterfacevariable{final}{final} +\setinterfacevariable{first}{first} +\setinterfacevariable{firstcolumn}{firstcolumn} +\setinterfacevariable{firstpage}{firstpage} +\setinterfacevariable{firstsubpage}{firstsubpage} +\setinterfacevariable{fit}{fit} +\setinterfacevariable{five}{five} +\setinterfacevariable{fix}{fix} +\setinterfacevariable{fixed}{fixed} +\setinterfacevariable{flexible}{flexible} +\setinterfacevariable{float}{float} +\setinterfacevariable{flushinner}{flushinner} +\setinterfacevariable{flushleft}{flushleft} +\setinterfacevariable{flushouter}{flushouter} +\setinterfacevariable{flushright}{flushright} +\setinterfacevariable{footer}{footer} +\setinterfacevariable{footnote}{footnote} +\setinterfacevariable{force}{force} +\setinterfacevariable{foreground}{foreground} +\setinterfacevariable{formeel}{formeel} +\setinterfacevariable{formula}{formula} +\setinterfacevariable{formulae}{formulae} +\setinterfacevariable{forward}{forward} +\setinterfacevariable{four}{four} +\setinterfacevariable{frame}{frame} +\setinterfacevariable{framedtext}{framedtext} +\setinterfacevariable{friday}{friday} +\setinterfacevariable{frontmatter}{frontmatter} +\setinterfacevariable{frontpart}{frontpart} +\setinterfacevariable{global}{global} +\setinterfacevariable{graphic}{graphic} +\setinterfacevariable{graphics}{graphics} +\setinterfacevariable{gray}{gray} +\setinterfacevariable{greek}{greek} +\setinterfacevariable{grid}{grid} +\setinterfacevariable{halfline}{halfline} +\setinterfacevariable{handwritten}{handwritten} +\setinterfacevariable{hang}{hang} +\setinterfacevariable{hanging}{hanging} +\setinterfacevariable{head}{head} +\setinterfacevariable{header}{header} +\setinterfacevariable{height}{height} +\setinterfacevariable{helptext}{helptext} +\setinterfacevariable{hencefore}{hencefore} +\setinterfacevariable{here}{here} +\setinterfacevariable{hereafter}{hereafter} +\setinterfacevariable{hidden}{hidden} +\setinterfacevariable{hiding}{hiding} +\setinterfacevariable{high}{high} +\setinterfacevariable{horizontal}{horizontal} +\setinterfacevariable{hyphenated}{hyphenated} +\setinterfacevariable{hz}{hz} +\setinterfacevariable{inbetween}{inbetween} +\setinterfacevariable{index}{index} +\setinterfacevariable{indices}{indices} +\setinterfacevariable{informeel}{informeel} +\setinterfacevariable{inherit}{inherit} +\setinterfacevariable{inleft}{inleft} +\setinterfacevariable{inmargin}{inmargin} +\setinterfacevariable{inner}{inner} +\setinterfacevariable{inneredge}{inneredge} +\setinterfacevariable{innermargin}{innermargin} +\setinterfacevariable{inright}{inright} +\setinterfacevariable{interaction}{interaction} +\setinterfacevariable{interactionmenu}{interactionmenu} +\setinterfacevariable{intermezzi}{intermezzi} +\setinterfacevariable{intermezzo}{intermezzo} +\setinterfacevariable{intext}{intext} +\setinterfacevariable{intro}{intro} +\setinterfacevariable{italic}{italic} +\setinterfacevariable{italicbold}{italicbold} +\setinterfacevariable{item}{item} +\setinterfacevariable{itemize}{itemize} +\setinterfacevariable{its}{its} +\setinterfacevariable{january}{January} +\setinterfacevariable{joinedup}{joinedup} +\setinterfacevariable{july}{July} +\setinterfacevariable{june}{June} +\setinterfacevariable{keep}{keep} +\setinterfacevariable{knockout}{knockout} +\setinterfacevariable{label}{label} +\setinterfacevariable{landscape}{landscape} +\setinterfacevariable{last}{last} +\setinterfacevariable{lastcolumn}{lastcolumn} +\setinterfacevariable{lastpage}{lastpage} +\setinterfacevariable{lastpagenumber}{lastpagenumber} +\setinterfacevariable{lastsubpage}{lastsubpage} +\setinterfacevariable{layer}{layer} +\setinterfacevariable{left}{left} +\setinterfacevariable{leftedge}{leftedge} +\setinterfacevariable{lefthanging}{lefthanging} +\setinterfacevariable{leftmargin}{leftmargin} +\setinterfacevariable{leftpage}{leftpage} +\setinterfacevariable{lefttoright}{lefttoright} +\setinterfacevariable{legend}{legend} +\setinterfacevariable{lesshyphenation}{lesshyphenation} +\setinterfacevariable{line}{line} +\setinterfacevariable{linenote}{linenote} +\setinterfacevariable{lines}{lines} +\setinterfacevariable{list}{list} +\setinterfacevariable{local}{local} +\setinterfacevariable{localenvironment}{localenvironment} +\setinterfacevariable{logo}{logo} +\setinterfacevariable{logos}{logos} +\setinterfacevariable{lohi}{lohi} +\setinterfacevariable{loose}{loose} +\setinterfacevariable{low}{low} +\setinterfacevariable{ls}{ls} +\setinterfacevariable{makeup}{makeup} +\setinterfacevariable{mar}{mar} +\setinterfacevariable{march}{March} +\setinterfacevariable{margin}{margin} +\setinterfacevariable{marginedge}{marginedge} +\setinterfacevariable{margintitle}{margintitle} +\setinterfacevariable{marking}{marking} +\setinterfacevariable{mathalignment}{mathalignment} +\setinterfacevariable{mathcases}{mathcases} +\setinterfacevariable{mathmatrix}{mathmatrix} +\setinterfacevariable{max}{max} +\setinterfacevariable{maxdepth}{maxdepth} +\setinterfacevariable{maxheight}{maxheight} +\setinterfacevariable{maxwidth}{maxwidth} +\setinterfacevariable{may}{May} +\setinterfacevariable{mediaeval}{mediaeval} +\setinterfacevariable{medium}{medium} +\setinterfacevariable{middle}{middle} +\setinterfacevariable{min}{min} +\setinterfacevariable{mindepth}{mindepth} +\setinterfacevariable{minheight}{minheight} +\setinterfacevariable{minwidth}{minwidth} +\setinterfacevariable{mirrored}{mirrored} +\setinterfacevariable{monday}{monday} +\setinterfacevariable{mono}{mono} +\setinterfacevariable{month}{month} +\setinterfacevariable{morehyphenation}{morehyphenation} +\setinterfacevariable{name}{name} +\setinterfacevariable{narrow}{narrow} +\setinterfacevariable{negative}{negative} +\setinterfacevariable{never}{never} +\setinterfacevariable{new}{new} +\setinterfacevariable{next}{next} +\setinterfacevariable{nextevenpage}{nextevenpage} +\setinterfacevariable{nextoddpage}{nextoddpage} +\setinterfacevariable{nextpage}{nextpage} +\setinterfacevariable{nextsubpage}{nextsubpage} +\setinterfacevariable{no}{no} +\setinterfacevariable{nocheck}{nocheck} +\setinterfacevariable{nofit}{nofit} +\setinterfacevariable{nogrid}{nogrid} +\setinterfacevariable{nohz}{nohz} +\setinterfacevariable{nomarking}{nomarking} +\setinterfacevariable{none}{none} +\setinterfacevariable{nonumber}{nonumber} +\setinterfacevariable{normal}{normal} +\setinterfacevariable{nospacing}{nospacing} +\setinterfacevariable{not}{not} +\setinterfacevariable{note}{note} +\setinterfacevariable{nothanging}{nothanging} +\setinterfacevariable{nothyphenated}{nothyphenated} +\setinterfacevariable{november}{November} +\setinterfacevariable{nowhere}{nowhere} +\setinterfacevariable{nowhite}{nowhite} +\setinterfacevariable{number}{number} +\setinterfacevariable{numbers}{numbers} +\setinterfacevariable{october}{October} +\setinterfacevariable{odd}{odd} +\setinterfacevariable{off}{off} +\setinterfacevariable{offset}{offset} +\setinterfacevariable{old}{old} +\setinterfacevariable{on}{on} +\setinterfacevariable{one}{one} +\setinterfacevariable{opposite}{opposite} +\setinterfacevariable{outer}{outer} +\setinterfacevariable{outeredge}{outeredge} +\setinterfacevariable{outermargin}{outermargin} +\setinterfacevariable{overbar}{overbar} +\setinterfacevariable{overbars}{overbars} +\setinterfacevariable{overlay}{overlay} +\setinterfacevariable{overprint}{overprint} +\setinterfacevariable{overstrike}{overstrike} +\setinterfacevariable{overstrikes}{overstrikes} +\setinterfacevariable{packed}{packed} +\setinterfacevariable{page}{page} +\setinterfacevariable{pagecomment}{pagecomment} +\setinterfacevariable{pagenumber}{pagenumber} +\setinterfacevariable{paper}{paper} +\setinterfacevariable{paragraph}{paragraph} +\setinterfacevariable{part}{part} +\setinterfacevariable{positive}{positive} +\setinterfacevariable{postponing}{postponing} +\setinterfacevariable{postscript}{postscript} +\setinterfacevariable{preference}{preference} +\setinterfacevariable{preview}{preview} +\setinterfacevariable{previous}{previous} +\setinterfacevariable{previousevenpage}{previousevenpage} +\setinterfacevariable{previousoddpage}{previousoddpage} +\setinterfacevariable{previouspage}{previouspage} +\setinterfacevariable{previoussubpage}{previoussubpage} +\setinterfacevariable{printable}{printable} +\setinterfacevariable{process}{process} +\setinterfacevariable{product}{product} +\setinterfacevariable{program}{program} +\setinterfacevariable{project}{project} +\setinterfacevariable{protected}{protected} +\setinterfacevariable{quadruple}{quadruple} +\setinterfacevariable{quotation}{quotation} +\setinterfacevariable{quote}{quote} +\setinterfacevariable{ran}{ran} +\setinterfacevariable{random}{random} +\setinterfacevariable{readonly}{readonly} +\setinterfacevariable{rectangular}{rectangular} +\setinterfacevariable{reference}{reference} +\setinterfacevariable{referral}{referral} +\setinterfacevariable{register}{register} +\setinterfacevariable{regular}{regular} +\setinterfacevariable{rekening}{rekening} +\setinterfacevariable{relative}{relative} +\setinterfacevariable{repeat}{repeat} +\setinterfacevariable{required}{required} +\setinterfacevariable{reset}{reset} +\setinterfacevariable{reverse}{reverse} +\setinterfacevariable{right}{right} +\setinterfacevariable{rightedge}{rightedge} +\setinterfacevariable{righthanging}{righthanging} +\setinterfacevariable{rightmargin}{rightmargin} +\setinterfacevariable{rightpage}{rightpage} +\setinterfacevariable{righttoleft}{righttoleft} +\setinterfacevariable{roman}{roman} +\setinterfacevariable{romannumerals}{romannumerals} +\setinterfacevariable{rotate}{rotate} +\setinterfacevariable{rotated}{rotated} +\setinterfacevariable{round}{round} +\setinterfacevariable{row}{row} +\setinterfacevariable{rule}{rule} +\setinterfacevariable{samepage}{samepage} +\setinterfacevariable{sans}{sans} +\setinterfacevariable{sansbold}{sansbold} +\setinterfacevariable{sansserif}{sansserif} +\setinterfacevariable{saturday}{saturday} +\setinterfacevariable{screen}{screen} +\setinterfacevariable{section}{section} +\setinterfacevariable{sectionblockenvironment}{sectionblockenvironment} +\setinterfacevariable{sectionnumber}{sectionnumber} +\setinterfacevariable{see}{see} +\setinterfacevariable{september}{September} +\setinterfacevariable{serif}{serif} +\setinterfacevariable{serried}{serried} +\setinterfacevariable{setups}{setups} +\setinterfacevariable{sheet}{sheet} +\setinterfacevariable{short}{short} +\setinterfacevariable{singlesided}{singlesided} +\setinterfacevariable{slanted}{slanted} +\setinterfacevariable{slantedbold}{slantedbold} +\setinterfacevariable{small}{small} +\setinterfacevariable{smallbodyfont}{smallbodyfont} +\setinterfacevariable{smallbold}{smallbold} +\setinterfacevariable{smallbolditalic}{smallbolditalic} +\setinterfacevariable{smallboldslanted}{smallboldslanted} +\setinterfacevariable{smallcaps}{smallcaps} +\setinterfacevariable{smaller}{smaller} +\setinterfacevariable{smallitalic}{smallitalic} +\setinterfacevariable{smallitalicbold}{smallitalicbold} +\setinterfacevariable{smallnormal}{smallnormal} +\setinterfacevariable{smallslanted}{smallslanted} +\setinterfacevariable{smallslantedbold}{smallslantedbold} +\setinterfacevariable{smalltype}{smalltype} +\setinterfacevariable{somewhere}{somewhere} +\setinterfacevariable{sorted}{sorted} +\setinterfacevariable{space}{space} +\setinterfacevariable{spacing}{spacing} +\setinterfacevariable{speech}{speech} +\setinterfacevariable{split}{split} +\setinterfacevariable{spot}{spot} +\setinterfacevariable{standard}{standard} +\setinterfacevariable{start}{start} +\setinterfacevariable{starter}{starter} +\setinterfacevariable{sticker}{sticker} +\setinterfacevariable{stop}{stop} +\setinterfacevariable{stopper}{stopper} +\setinterfacevariable{stretch}{stretch} +\setinterfacevariable{strict}{strict} +\setinterfacevariable{strong}{strong} +\setinterfacevariable{strut}{strut} +\setinterfacevariable{sub}{sub} +\setinterfacevariable{subbackward}{subbackward} +\setinterfacevariable{subformula}{subformula} +\setinterfacevariable{subforward}{subforward} +\setinterfacevariable{subject}{subject} +\setinterfacevariable{subpage}{subpage} +\setinterfacevariable{subsection}{subsection} +\setinterfacevariable{subsubject}{subsubject} +\setinterfacevariable{subsubsection}{subsubsection} +\setinterfacevariable{subsubsubject}{subsubsubject} +\setinterfacevariable{subsubsubsection}{subsubsubsection} +\setinterfacevariable{subsubsubsubject}{subsubsubsubject} +\setinterfacevariable{subsubsubsubsection}{subsubsubsubsection} +\setinterfacevariable{subsubsubsubsubject}{subsubsubsubsubject} +\setinterfacevariable{subsubsubsubsubsection}{subsubsubsubsubsection} +\setinterfacevariable{subsubsubsubsubsubject}{subsubsubsubsubsubject} +\setinterfacevariable{subsubsubsubsubsubsection}{subsubsubsubsubsubsection} +\setinterfacevariable{subsubsubsubsubsubsubject}{subsubsubsubsubsubsubject} +\setinterfacevariable{subsubsubsubsubsubsubsection}{subsubsubsubsubsubsubsection} +\setinterfacevariable{subsubsubsubsubsubsubsubject}{subsubsubsubsubsubsubsubject} +\setinterfacevariable{subsubsubsubsubsubsubsubsection}{subsubsubsubsubsubsubsubsection} +\setinterfacevariable{subsubsubsubsubsubsubsubsubject}{subsubsubsubsubsubsubsubsubject} +\setinterfacevariable{subsubsubsubsubsubsubsubsubsection}{subsubsubsubsubsubsubsubsubsection} +\setinterfacevariable{subsubsubsubsubsubsubsubsubsubject}{subsubsubsubsubsubsubsubsubsubject} +\setinterfacevariable{sunday}{sunday} +\setinterfacevariable{support}{support} +\setinterfacevariable{sym}{sym} +\setinterfacevariable{symbol}{symbol} +\setinterfacevariable{synchronize}{synchronize} +\setinterfacevariable{system}{system} +\setinterfacevariable{table}{table} +\setinterfacevariable{tablehead}{tablehead} +\setinterfacevariable{tables}{tables} +\setinterfacevariable{tabletail}{tabletail} +\setinterfacevariable{tabulate}{tabulate} +\setinterfacevariable{tabulatehead}{tabulatehead} +\setinterfacevariable{tabulatetail}{tabulatetail} +\setinterfacevariable{tall}{tall} +\setinterfacevariable{teletype}{teletype} +\setinterfacevariable{temporary}{temporary} +\setinterfacevariable{test}{test} +\setinterfacevariable{text}{text} +\setinterfacevariable{three}{three} +\setinterfacevariable{thursday}{thursday} +\setinterfacevariable{title}{title} +\setinterfacevariable{toggle}{wissel} +\setinterfacevariable{tolerant}{tolerant} +\setinterfacevariable{top}{top} +\setinterfacevariable{tuesday}{tuesday} +\setinterfacevariable{two}{two} +\setinterfacevariable{txt}{txt} +\setinterfacevariable{type}{type} +\setinterfacevariable{typing}{typing} +\setinterfacevariable{unavailable}{unavailable} +\setinterfacevariable{underbar}{underbar} +\setinterfacevariable{underbars}{underbars} +\setinterfacevariable{unit}{unit} +\setinterfacevariable{units}{units} +\setinterfacevariable{unknown}{unknown} +\setinterfacevariable{unpacked}{unpacked} +\setinterfacevariable{up}{up} +\setinterfacevariable{url}{url} +\setinterfacevariable{used}{used} +\setinterfacevariable{value}{value} +\setinterfacevariable{vertical}{vertical} +\setinterfacevariable{very}{very} +\setinterfacevariable{verystrict}{verystrict} +\setinterfacevariable{verytolerant}{verytolerant} +\setinterfacevariable{weak}{weak} +\setinterfacevariable{wednesday}{wednesday} +\setinterfacevariable{week}{week} +\setinterfacevariable{weekday}{weekday} +\setinterfacevariable{white}{white} +\setinterfacevariable{wide}{wide} +\setinterfacevariable{width}{width} +\setinterfacevariable{xml}{xml} +\setinterfacevariable{year}{year} +\setinterfacevariable{yes}{yes} +% definitions for interface constants for language en +% +\setinterfaceconstant{action}{action} +\setinterfaceconstant{address}{address} +\setinterfaceconstant{after}{after} +\setinterfaceconstant{afterhead}{afterhead} +\setinterfaceconstant{afterkey}{afterkey} +\setinterfaceconstant{aftersection}{aftersection} +\setinterfaceconstant{align}{align} +\setinterfaceconstant{aligncharacter}{aligncharacter} +\setinterfaceconstant{alignmentcharacter}{alignmentcharacter} +\setinterfaceconstant{alignsymbol}{alignsymbol} +\setinterfaceconstant{aligntitle}{aligntitle} +\setinterfaceconstant{alternative}{alternative} +\setinterfaceconstant{andtext}{andtext} +\setinterfaceconstant{apa}{apa} +\setinterfaceconstant{arrow}{arrow} +\setinterfaceconstant{artauthor}{artauthor} +\setinterfaceconstant{artauthoretaldisplay}{artauthoretaldisplay} +\setinterfaceconstant{artauthoretallimit}{artauthoretallimit} +\setinterfaceconstant{artauthoretaltext}{artauthoretaltext} +\setinterfaceconstant{at}{at} +\setinterfaceconstant{author}{author} +\setinterfaceconstant{authoretaldisplay}{authoretaldisplay} +\setinterfaceconstant{authoretallimit}{authoretallimit} +\setinterfaceconstant{authoretaltext}{authoretaltext} +\setinterfaceconstant{auto}{auto} +\setinterfaceconstant{autocase}{autocase} +\setinterfaceconstant{autofile}{autofile} +\setinterfaceconstant{autofocus}{autofocus} +\setinterfaceconstant{autohang}{autohang} +\setinterfaceconstant{autostrut}{autostrut} +\setinterfaceconstant{autowidth}{autowidth} +\setinterfaceconstant{axis}{axis} +\setinterfaceconstant{background}{background} +\setinterfaceconstant{backgroundcolor}{backgroundcolor} +\setinterfaceconstant{backgroundcorner}{backgroundcorner} +\setinterfaceconstant{backgrounddepth}{backgrounddepth} +\setinterfaceconstant{backgroundoffset}{backgroundoffset} +\setinterfaceconstant{backgroundradius}{backgroundradius} +\setinterfaceconstant{backgroundscreen}{backgroundscreen} +\setinterfaceconstant{backreference}{backreference} +\setinterfaceconstant{backspace}{backspace} +\setinterfaceconstant{balance}{balance} +\setinterfaceconstant{before}{before} +\setinterfaceconstant{beforehead}{beforehead} +\setinterfaceconstant{beforesection}{beforesection} +\setinterfaceconstant{bet}{bet} +\setinterfaceconstant{big}{big} +\setinterfaceconstant{blank}{blank} +\setinterfaceconstant{blockway}{blockway} +\setinterfaceconstant{bodyfont}{bodyfont} +\setinterfaceconstant{bookmark}{bookmark} +\setinterfaceconstant{bottom}{bottom} +\setinterfaceconstant{bottomafter}{bottomafter} +\setinterfaceconstant{bottombefore}{bottombefore} +\setinterfaceconstant{bottomdistance}{bottomdistance} +\setinterfaceconstant{bottomframe}{bottomframe} +\setinterfaceconstant{bottomoffset}{bottomoffset} +\setinterfaceconstant{bottomspace}{bottomspace} +\setinterfaceconstant{bottomstate}{bottomstate} +\setinterfaceconstant{buffer}{buffer} +\setinterfaceconstant{cache}{cache} +\setinterfaceconstant{calculate}{calculate} +\setinterfaceconstant{category}{category} +\setinterfaceconstant{ccommand}{ccommand} +\setinterfaceconstant{click}{click} +\setinterfaceconstant{clickin}{clickin} +\setinterfaceconstant{clickout}{clickout} +\setinterfaceconstant{clipoffset}{clipoffset} +\setinterfaceconstant{closeaction}{closeaction} +\setinterfaceconstant{closecommand}{closecommand} +\setinterfaceconstant{closepage}{closepage} +\setinterfaceconstant{closepageaction}{closepageaction} +\setinterfaceconstant{closesymbol}{closesymbol} +\setinterfaceconstant{color}{color} +\setinterfaceconstant{column}{column} +\setinterfaceconstant{columndistance}{columndistance} +\setinterfaceconstant{columns}{columns} +\setinterfaceconstant{command}{command} +\setinterfaceconstant{commandafter}{commandafter} +\setinterfaceconstant{commandbefore}{commandbefore} +\setinterfaceconstant{commands}{commands} +\setinterfaceconstant{component}{component} +\setinterfaceconstant{compoundhyphen}{compoundhyphen} +\setinterfaceconstant{compress}{compress} +\setinterfaceconstant{connector}{connector} +\setinterfaceconstant{continue}{continue} +\setinterfaceconstant{contrastcolor}{contrastcolor} +\setinterfaceconstant{controls}{controls} +\setinterfaceconstant{conversion}{conversion} +\setinterfaceconstant{convertfile}{convertfile} +\setinterfaceconstant{corner}{corner} +\setinterfaceconstant{coupling}{coupling} +\setinterfaceconstant{couplingway}{couplingway} +\setinterfaceconstant{criterium}{criterium} +\setinterfaceconstant{current}{current} +\setinterfaceconstant{cutspace}{cutspace} +\setinterfaceconstant{dash}{dash} +\setinterfaceconstant{dat}{dat} +\setinterfaceconstant{database}{database} +\setinterfaceconstant{date}{date} +\setinterfaceconstant{deepnumbercommand}{deepnumbercommand} +\setinterfaceconstant{deeptextcommand}{deeptextcommand} +\setinterfaceconstant{default}{default} +\setinterfaceconstant{delay}{delay} +\setinterfaceconstant{depth}{depth} +\setinterfaceconstant{depthcorrection}{depthcorrection} +\setinterfaceconstant{direction}{direction} +\setinterfaceconstant{directory}{directory} +\setinterfaceconstant{display}{display} +\setinterfaceconstant{distance}{distance} +\setinterfaceconstant{dot}{dot} +\setinterfaceconstant{doublesided}{doublesided} +\setinterfaceconstant{dummy}{dummy} +\setinterfaceconstant{dx}{dx} +\setinterfaceconstant{dy}{dy} +\setinterfaceconstant{edge}{edge} +\setinterfaceconstant{edgedistance}{edgedistance} +\setinterfaceconstant{editor}{editor} +\setinterfaceconstant{editoretaldisplay}{editoretaldisplay} +\setinterfaceconstant{editoretallimit}{editoretallimit} +\setinterfaceconstant{editoretaltext}{editoretaltext} +\setinterfaceconstant{empty}{empty} +\setinterfaceconstant{entries}{entries} +\setinterfaceconstant{equalheight}{equalheight} +\setinterfaceconstant{equalwidth}{equalwidth} +\setinterfaceconstant{escape}{escape} +\setinterfaceconstant{evenmargin}{evenmargin} +\setinterfaceconstant{expansion}{expansion} +\setinterfaceconstant{export}{export} +\setinterfaceconstant{extras}{extras} +\setinterfaceconstant{factor}{factor} +\setinterfaceconstant{fallback}{fallback} +\setinterfaceconstant{family}{family} +\setinterfaceconstant{fieldbackgroundcolor}{fieldbackgroundcolor} +\setinterfaceconstant{fieldframecolor}{fieldframecolor} +\setinterfaceconstant{fieldlayer}{fieldlayer} +\setinterfaceconstant{fieldoffset}{fieldoffset} +\setinterfaceconstant{file}{file} +\setinterfaceconstant{filtercommand}{filtercommand} +\setinterfaceconstant{finalnamesep}{finalnamesep} +\setinterfaceconstant{firstnamesep}{firstnamesep} +\setinterfaceconstant{focus}{focus} +\setinterfaceconstant{focusin}{focusin} +\setinterfaceconstant{focusout}{focusout} +\setinterfaceconstant{footer}{footer} +\setinterfaceconstant{footerdistance}{footerdistance} +\setinterfaceconstant{footerstate}{footerstate} +\setinterfaceconstant{force}{force} +\setinterfaceconstant{foregroundcolor}{foregroundcolor} +\setinterfaceconstant{foregroundstyle}{foregroundstyle} +\setinterfaceconstant{format}{format} +\setinterfaceconstant{frame}{frame} +\setinterfaceconstant{framecolor}{framecolor} +\setinterfaceconstant{framecorner}{framecorner} +\setinterfaceconstant{framedepth}{framedepth} +\setinterfaceconstant{frameoffset}{frameoffset} +\setinterfaceconstant{frameradius}{frameradius} +\setinterfaceconstant{frames}{frames} +\setinterfaceconstant{from}{from} +\setinterfaceconstant{get}{get} +\setinterfaceconstant{global}{global} +\setinterfaceconstant{grid}{grid} +\setinterfaceconstant{hang}{hang} +\setinterfaceconstant{headalign}{headalign} +\setinterfaceconstant{headcolor}{headcolor} +\setinterfaceconstant{headcommand}{headcommand} +\setinterfaceconstant{headconversion}{headconversion} +\setinterfaceconstant{header}{header} +\setinterfaceconstant{headerdistance}{headerdistance} +\setinterfaceconstant{headerstate}{headerstate} +\setinterfaceconstant{headlabel}{headlabel} +\setinterfaceconstant{headnumber}{headnumber} +\setinterfaceconstant{headstyle}{headstyle} +\setinterfaceconstant{height}{height} +\setinterfaceconstant{hfactor}{hfactor} +\setinterfaceconstant{hfil}{hfil} +\setinterfaceconstant{hidenumber}{hidenumber} +\setinterfaceconstant{hoffset}{hoffset} +\setinterfaceconstant{horoffset}{horoffset} +\setinterfaceconstant{hyphen}{hyphen} +\setinterfaceconstant{icommand}{icommand} +\setinterfaceconstant{in}{in} +\setinterfaceconstant{inbetween}{inbetween} +\setinterfaceconstant{increment}{increment} +\setinterfaceconstant{incrementnumber}{incrementnumber} +\setinterfaceconstant{indenting}{indenting} +\setinterfaceconstant{indentnext}{indentnext} +\setinterfaceconstant{indicator}{indicator} +\setinterfaceconstant{inner}{inner} +\setinterfaceconstant{innermargin}{innermargin} +\setinterfaceconstant{inputfile}{inputfile} +\setinterfaceconstant{intent}{intent} +\setinterfaceconstant{interaction}{interaction} +\setinterfaceconstant{interlinespace}{interlinespace} +\setinterfaceconstant{internalgrid}{internalgrid} +\setinterfaceconstant{itemalign}{itemalign} +\setinterfaceconstant{items}{items} +\setinterfaceconstant{juniorsep}{juniorsep} +\setinterfaceconstant{ken}{ken} +\setinterfaceconstant{keyexpansion}{keyexpansion} +\setinterfaceconstant{keys}{keys} +\setinterfaceconstant{keyword}{keyword} +\setinterfaceconstant{label}{label} +\setinterfaceconstant{lastnamesep}{lastnamesep} +\setinterfaceconstant{lastpubsep}{lastpubsep} +\setinterfaceconstant{left}{left} +\setinterfaceconstant{leftcolor}{leftcolor} +\setinterfaceconstant{leftcompoundhyphen}{leftcompoundhyphen} +\setinterfaceconstant{leftedge}{leftedge} +\setinterfaceconstant{leftedgedistance}{leftedgedistance} +\setinterfaceconstant{leftframe}{leftframe} +\setinterfaceconstant{lefthyphen}{lefthyphen} +\setinterfaceconstant{leftmargin}{leftmargin} +\setinterfaceconstant{leftmargindistance}{leftmargindistance} +\setinterfaceconstant{leftoffset}{leftoffset} +\setinterfaceconstant{leftquotation}{leftquotation} +\setinterfaceconstant{leftquote}{leftquote} +\setinterfaceconstant{leftsentence}{leftsentence} +\setinterfaceconstant{leftspeech}{leftspeech} +\setinterfaceconstant{leftstyle}{leftstyle} +\setinterfaceconstant{leftsubsentence}{leftsubsentence} +\setinterfaceconstant{lefttext}{lefttext} +\setinterfaceconstant{leftwidth}{leftwidth} +\setinterfaceconstant{level}{level} +\setinterfaceconstant{levels}{levels} +\setinterfaceconstant{limittext}{limittext} +\setinterfaceconstant{line}{line} +\setinterfaceconstant{linecorrection}{linecorrection} +\setinterfaceconstant{lines}{lines} +\setinterfaceconstant{list}{list} +\setinterfaceconstant{listtext}{listtext} +\setinterfaceconstant{local}{local} +\setinterfaceconstant{location}{location} +\setinterfaceconstant{logo}{logo} +\setinterfaceconstant{logos}{logos} +\setinterfaceconstant{marcolor}{marcolor} +\setinterfaceconstant{margin}{margin} +\setinterfaceconstant{margindistance}{margindistance} +\setinterfaceconstant{marginedge}{marginedge} +\setinterfaceconstant{marginedgetext}{marginedgetext} +\setinterfaceconstant{margintext}{margintext} +\setinterfaceconstant{marking}{marking} +\setinterfaceconstant{marstyle}{marstyle} +\setinterfaceconstant{mask}{mask} +\setinterfaceconstant{max}{max} +\setinterfaceconstant{maxdepth}{maxdepth} +\setinterfaceconstant{maxheight}{maxheight} +\setinterfaceconstant{maxwidth}{maxwidth} +\setinterfaceconstant{maybeyear}{maybeyear} +\setinterfaceconstant{menu}{menu} +\setinterfaceconstant{method}{method} +\setinterfaceconstant{middle}{middle} +\setinterfaceconstant{middlespeech}{middlespeech} +\setinterfaceconstant{middletext}{middletext} +\setinterfaceconstant{midsentence}{midsentence} +\setinterfaceconstant{min}{min} +\setinterfaceconstant{mindepth}{mindepth} +\setinterfaceconstant{minheight}{minheight} +\setinterfaceconstant{minwidth}{minwidth} +\setinterfaceconstant{monthconversion}{monthconversion} +\setinterfaceconstant{n}{n} +\setinterfaceconstant{name}{name} +\setinterfaceconstant{namesep}{namesep} +\setinterfaceconstant{nbottom}{nbottom} +\setinterfaceconstant{nc}{nc} +\setinterfaceconstant{next}{next} +\setinterfaceconstant{nl}{nl} +\setinterfaceconstant{nleft}{nleft} +\setinterfaceconstant{nlines}{nlines} +\setinterfaceconstant{norm}{norm} +\setinterfaceconstant{nr}{nr} +\setinterfaceconstant{nright}{nright} +\setinterfaceconstant{ntop}{ntop} +\setinterfaceconstant{number}{number} +\setinterfaceconstant{numbercolor}{numbercolor} +\setinterfaceconstant{numbercommand}{numbercommand} +\setinterfaceconstant{numberconversion}{numberconversion} +\setinterfaceconstant{numberconversionset}{numberconversionset} +\setinterfaceconstant{numberdistance}{numberdistance} +\setinterfaceconstant{numbering}{numbering} +\setinterfaceconstant{numberorder}{numberorder} +\setinterfaceconstant{numberprefix}{numberprefix} +\setinterfaceconstant{numbersegments}{numbersegments} +\setinterfaceconstant{numberseparator}{numberseparator} +\setinterfaceconstant{numberseparatorset}{numberseparatorset} +\setinterfaceconstant{numberset}{numberset} +\setinterfaceconstant{numberstarter}{numberstarter} +\setinterfaceconstant{numberstopper}{numberstopper} +\setinterfaceconstant{numberstyle}{numberstyle} +\setinterfaceconstant{numberwidth}{numberwidth} +\setinterfaceconstant{nx}{nx} +\setinterfaceconstant{ny}{ny} +\setinterfaceconstant{object}{object} +\setinterfaceconstant{obstruction}{obstruction} +\setinterfaceconstant{oddmargin}{oddmargin} +\setinterfaceconstant{offset}{offset} +\setinterfaceconstant{openaction}{openaction} +\setinterfaceconstant{openpage}{openpage} +\setinterfaceconstant{openpageaction}{openpageaction} +\setinterfaceconstant{option}{option} +\setinterfaceconstant{order}{order} +\setinterfaceconstant{orientation}{orientation} +\setinterfaceconstant{otherstext}{otherstext} +\setinterfaceconstant{outermargin}{outermargin} +\setinterfaceconstant{overprint}{overprint} +\setinterfaceconstant{ownnumber}{ownnumber} +\setinterfaceconstant{page}{page} +\setinterfaceconstant{pageboundaries}{pageboundaries} +\setinterfaceconstant{pagecolor}{pagecolor} +\setinterfaceconstant{pagecommand}{pagecommand} +\setinterfaceconstant{pageconversion}{pageconversion} +\setinterfaceconstant{pageconversionset}{pageconversionset} +\setinterfaceconstant{pagenumber}{pagenumber} +\setinterfaceconstant{pageprefix}{pageprefix} +\setinterfaceconstant{pageprefixconnector}{pageprefixconnector} +\setinterfaceconstant{pageprefixconversion}{pageprefixconversion} +\setinterfaceconstant{pageprefixconversionset}{pageprefixconversionset} +\setinterfaceconstant{pageprefixsegments}{pageprefixsegments} +\setinterfaceconstant{pageprefixseparatorset}{pageprefixseparatorset} +\setinterfaceconstant{pageprefixset}{pageprefixset} +\setinterfaceconstant{pageprefixstarter}{pageprefixstarter} +\setinterfaceconstant{pageprefixstopper}{pageprefixstopper} +\setinterfaceconstant{pagesegments}{pagesegments} +\setinterfaceconstant{pageseparatorset}{pageseparatorset} +\setinterfaceconstant{pageset}{pageset} +\setinterfaceconstant{pagestarter}{pagestarter} +\setinterfaceconstant{pagestate}{pagestate} +\setinterfaceconstant{pagestopper}{pagestopper} +\setinterfaceconstant{pagestyle}{pagestyle} +\setinterfaceconstant{palet}{palet} +\setinterfaceconstant{paper}{paper} +\setinterfaceconstant{paragraph}{paragraph} +\setinterfaceconstant{place}{place} +\setinterfaceconstant{placehead}{placehead} +\setinterfaceconstant{placestopper}{placestopper} +\setinterfaceconstant{position}{position} +\setinterfaceconstant{prefix}{prefix} +\setinterfaceconstant{prefixconnector}{prefixconnector} +\setinterfaceconstant{prefixconversion}{prefixconversion} +\setinterfaceconstant{prefixconversionset}{prefixconversionset} +\setinterfaceconstant{prefixsegments}{prefixsegments} +\setinterfaceconstant{prefixseparatorset}{prefixseparatorset} +\setinterfaceconstant{prefixset}{prefixset} +\setinterfaceconstant{prefixstarter}{prefixstarter} +\setinterfaceconstant{prefixstopper}{prefixstopper} +\setinterfaceconstant{preset}{preset} +\setinterfaceconstant{preview}{preview} +\setinterfaceconstant{previous}{previous} +\setinterfaceconstant{previousnumber}{previousnumber} +\setinterfaceconstant{process}{process} +\setinterfaceconstant{profile}{profile} +\setinterfaceconstant{pubsep}{pubsep} +\setinterfaceconstant{radius}{radius} +\setinterfaceconstant{random}{random} +\setinterfaceconstant{range}{range} +\setinterfaceconstant{reduction}{reduction} +\setinterfaceconstant{ref}{ref} +\setinterfaceconstant{refcommand}{refcommand} +\setinterfaceconstant{reference}{reference} +\setinterfaceconstant{referenceprefix}{referenceprefix} +\setinterfaceconstant{referencing}{referencing} +\setinterfaceconstant{regionin}{regionin} +\setinterfaceconstant{regionout}{regionout} +\setinterfaceconstant{repeat}{repeat} +\setinterfaceconstant{reset}{reset} +\setinterfaceconstant{resetnumber}{resetnumber} +\setinterfaceconstant{resolution}{resolution} +\setinterfaceconstant{right}{right} +\setinterfaceconstant{rightcolor}{rightcolor} +\setinterfaceconstant{rightcompoundhyphen}{rightcompoundhyphen} +\setinterfaceconstant{rightedge}{rightedge} +\setinterfaceconstant{rightedgedistance}{rightedgedistance} +\setinterfaceconstant{rightframe}{rightframe} +\setinterfaceconstant{righthyphen}{righthyphen} +\setinterfaceconstant{rightmargin}{rightmargin} +\setinterfaceconstant{rightmargindistance}{rightmargindistance} +\setinterfaceconstant{rightoffset}{rightoffset} +\setinterfaceconstant{rightquotation}{rightquotation} +\setinterfaceconstant{rightquote}{rightquote} +\setinterfaceconstant{rightsentence}{rightsentence} +\setinterfaceconstant{rightspeech}{rightspeech} +\setinterfaceconstant{rightstyle}{rightstyle} +\setinterfaceconstant{rightsubsentence}{rightsubsentence} +\setinterfaceconstant{righttext}{righttext} +\setinterfaceconstant{rightwidth}{rightwidth} +\setinterfaceconstant{rotation}{rotation} +\setinterfaceconstant{rule}{rule} +\setinterfaceconstant{rulecolor}{rulecolor} +\setinterfaceconstant{rulethickness}{rulethickness} +\setinterfaceconstant{samepage}{samepage} +\setinterfaceconstant{sample}{sample} +\setinterfaceconstant{samplesize}{samplesize} +\setinterfaceconstant{saveinlist}{saveinlist} +\setinterfaceconstant{scale}{scale} +\setinterfaceconstant{scope}{scope} +\setinterfaceconstant{screen}{screen} +\setinterfaceconstant{section}{section} +\setinterfaceconstant{sectionconversion}{sectionconversion} +\setinterfaceconstant{sectionconversionset}{sectionconversionset} +\setinterfaceconstant{sectionnumber}{sectionnumber} +\setinterfaceconstant{sectionresetset}{sectionresetset} +\setinterfaceconstant{sectionsegments}{sectionsegments} +\setinterfaceconstant{sectionseparatorset}{sectionseparatorset} +\setinterfaceconstant{sectionset}{sectionset} +\setinterfaceconstant{sectionstarter}{sectionstarter} +\setinterfaceconstant{sectionstopper}{sectionstopper} +\setinterfaceconstant{separator}{separator} +\setinterfaceconstant{set}{set} +\setinterfaceconstant{setups}{setups} +\setinterfaceconstant{side}{side} +\setinterfaceconstant{sidealign}{sidealign} +\setinterfaceconstant{sidemethod}{sidemethod} +\setinterfaceconstant{sidespaceafter}{sidespaceafter} +\setinterfaceconstant{sidespacebefore}{sidespacebefore} +\setinterfaceconstant{sign}{sign} +\setinterfaceconstant{size}{size} +\setinterfaceconstant{small}{small} +\setinterfaceconstant{sort}{sort} +\setinterfaceconstant{sorttype}{sorttype} +\setinterfaceconstant{source}{source} +\setinterfaceconstant{space}{space} +\setinterfaceconstant{spaceafter}{spaceafter} +\setinterfaceconstant{spacebefore}{spacebefore} +\setinterfaceconstant{spaceinbetween}{spaceinbetween} +\setinterfaceconstant{spacing}{spacing} +\setinterfaceconstant{split}{split} +\setinterfaceconstant{splitcolor}{splitcolor} +\setinterfaceconstant{splitmethod}{splitmethod} +\setinterfaceconstant{splitoffset}{splitoffset} +\setinterfaceconstant{spot}{spot} +\setinterfaceconstant{stack}{stack} +\setinterfaceconstant{start}{start} +\setinterfaceconstant{starter}{starter} +\setinterfaceconstant{state}{state} +\setinterfaceconstant{step}{step} +\setinterfaceconstant{stop}{stop} +\setinterfaceconstant{stopper}{stopper} +\setinterfaceconstant{stretch}{stretch} +\setinterfaceconstant{strip}{strip} +\setinterfaceconstant{strut}{strut} +\setinterfaceconstant{style}{style} +\setinterfaceconstant{sub}{sub} +\setinterfaceconstant{subtitle}{subtitle} +\setinterfaceconstant{suffix}{suffix} +\setinterfaceconstant{suffixseparator}{suffixseparator} +\setinterfaceconstant{surnamesep}{surnamesep} +\setinterfaceconstant{sx}{sx} +\setinterfaceconstant{sy}{sy} +\setinterfaceconstant{symalign}{symalign} +\setinterfaceconstant{symbol}{symbol} +\setinterfaceconstant{symbolset}{symbolset} +\setinterfaceconstant{symcolor}{symcolor} +\setinterfaceconstant{symstyle}{symstyle} +\setinterfaceconstant{synonym}{synonym} +\setinterfaceconstant{synonymcolor}{synonymcolor} +\setinterfaceconstant{synonymcommand}{synonymcommand} +\setinterfaceconstant{synonymstyle}{synonymstyle} +\setinterfaceconstant{tab}{tab} +\setinterfaceconstant{text}{text} +\setinterfaceconstant{textcolor}{textcolor} +\setinterfaceconstant{textcommand}{textcommand} +\setinterfaceconstant{textdistance}{textdistance} +\setinterfaceconstant{textlayer}{textlayer} +\setinterfaceconstant{textmargin}{textmargin} +\setinterfaceconstant{textmethod}{textmethod} +\setinterfaceconstant{textseparator}{textseparator} +\setinterfaceconstant{textsize}{textsize} +\setinterfaceconstant{textstate}{textstate} +\setinterfaceconstant{textstyle}{textstyle} +\setinterfaceconstant{textwidth}{textwidth} +\setinterfaceconstant{threshold}{threshold} +\setinterfaceconstant{title}{title} +\setinterfaceconstant{titlecolor}{titlecolor} +\setinterfaceconstant{titlecommand}{titlecommand} +\setinterfaceconstant{titledistance}{titledistance} +\setinterfaceconstant{titleleft}{titleleft} +\setinterfaceconstant{titleright}{titleright} +\setinterfaceconstant{titlestyle}{titlestyle} +\setinterfaceconstant{to}{to} +\setinterfaceconstant{tolerance}{tolerance} +\setinterfaceconstant{top}{top} +\setinterfaceconstant{topdistance}{topdistance} +\setinterfaceconstant{topframe}{topframe} +\setinterfaceconstant{topoffset}{topoffset} +\setinterfaceconstant{topspace}{topspace} +\setinterfaceconstant{topstate}{topstate} +\setinterfaceconstant{totalnumber}{totalnumber} +\setinterfaceconstant{type}{type} +\setinterfaceconstant{unit}{unit} +\setinterfaceconstant{unknownreference}{unknownreference} +\setinterfaceconstant{urlalternative}{urlalternative} +\setinterfaceconstant{urlspace}{urlspace} +\setinterfaceconstant{validate}{validate} +\setinterfaceconstant{values}{values} +\setinterfaceconstant{vcommand}{vcommand} +\setinterfaceconstant{veroffset}{veroffset} +\setinterfaceconstant{vfil}{vfil} +\setinterfaceconstant{voffset}{voffset} +\setinterfaceconstant{vonsep}{vonsep} +\setinterfaceconstant{way}{way} +\setinterfaceconstant{wfactor}{wfactor} +\setinterfaceconstant{white}{white} +\setinterfaceconstant{width}{width} +\setinterfaceconstant{xfactor}{xfactor} +\setinterfaceconstant{xmax}{xmax} +\setinterfaceconstant{xoffset}{xoffset} +\setinterfaceconstant{xscale}{xscale} +\setinterfaceconstant{xstep}{xstep} +\setinterfaceconstant{yfactor}{yfactor} +\setinterfaceconstant{ymax}{ymax} +\setinterfaceconstant{yoffset}{yoffset} +\setinterfaceconstant{yscale}{yscale} +\setinterfaceconstant{ystep}{ystep} +% definitions for interface elements for language en +% +\setinterfaceelement{answerlines}{answerlines} +\setinterfaceelement{answerspace}{answerspace} +\setinterfaceelement{begin}{begin} +\setinterfaceelement{complete}{complete} +\setinterfaceelement{coupled}{coupled} +\setinterfaceelement{currentlocal}{currentlocal} +\setinterfaceelement{emptyone}{empty} +\setinterfaceelement{emptytwo}{empty} +\setinterfaceelement{end}{end} +\setinterfaceelement{endsetup}{} +\setinterfaceelement{get}{get} +\setinterfaceelement{increment}{increment} +\setinterfaceelement{list}{list} +\setinterfaceelement{listof}{listof} +\setinterfaceelement{load}{load} +\setinterfaceelement{local}{local} +\setinterfaceelement{makeup}{makeup} +\setinterfaceelement{next}{next} +\setinterfaceelement{place}{place} +\setinterfaceelement{previous}{previous} +\setinterfaceelement{previouslocal}{previouslocal} +\setinterfaceelement{reserve}{reserve} +\setinterfaceelement{see}{see} +\setinterfaceelement{setup}{setup} +\setinterfaceelement{start}{start} +\setinterfaceelement{stop}{stop} +\setinterfaceelement{text}{text} +\setinterfaceelement{type}{type} +% definitions for interface commands for language en +% +\setinterfacecommand{CAPPED}{CAP} +\setinterfacecommand{Character}{Character} +\setinterfacecommand{Characters}{Characters} +\setinterfacecommand{MONTH}{MONTH} +\setinterfacecommand{Numbers}{Numbers} +\setinterfacecommand{Romannumerals}{Romannumerals} +\setinterfacecommand{SmallCapped}{Cap} +\setinterfacecommand{SmallCaps}{Caps} +\setinterfacecommand{WEEKDAY}{WEEKDAY} +\setinterfacecommand{WORD}{WORD} +\setinterfacecommand{WORDS}{WORDS} +\setinterfacecommand{Word}{Word} +\setinterfacecommand{Words}{Words} +\setinterfacecommand{about}{about} +\setinterfacecommand{adaptlayout}{adaptlayout} +\setinterfacecommand{arg}{arg} +\setinterfacecommand{at}{at} +\setinterfacecommand{atleftmargin}{atleftmargin} +\setinterfacecommand{atpage}{atpage} +\setinterfacecommand{atrightmargin}{atrightmargin} +\setinterfacecommand{background}{background} +\setinterfacecommand{backspace}{backspace} +\setinterfacecommand{blackrule}{blackrule} +\setinterfacecommand{blackrules}{blackrules} +\setinterfacecommand{blank}{blank} +\setinterfacecommand{bookmark}{bookmark} +\setinterfacecommand{bottomdistance}{bottomdistance} +\setinterfacecommand{bottomheight}{bottomheight} +\setinterfacecommand{bottomspace}{bottomspace} +\setinterfacecommand{but}{but} +\setinterfacecommand{button}{button} +\setinterfacecommand{bypassblocks}{bypassblocks} +\setinterfacecommand{character}{character} +\setinterfacecommand{characters}{characters} +\setinterfacecommand{chem}{chem} +\setinterfacecommand{clip}{clip} +\setinterfacecommand{clonefield}{clonefield} +\setinterfacecommand{color}{color} +\setinterfacecommand{colorbar}{colorbar} +\setinterfacecommand{colorvalue}{colorvalue} +\setinterfacecommand{column}{column} +\setinterfacecommand{comparecolorgroup}{comparecolorgroup} +\setinterfacecommand{comparepalet}{comparepalet} +\setinterfacecommand{completepagenumber}{completepagenumber} +\setinterfacecommand{completeregister}{completeregister} +\setinterfacecommand{component}{component} +\setinterfacecommand{convertnumber}{convertnumber} +\setinterfacecommand{copyfield}{copyfield} +\setinterfacecommand{correctwhitespace}{correctwhitespace} +\setinterfacecommand{coupledocument}{coupledocument} +\setinterfacecommand{couplemarking}{couplemarking} +\setinterfacecommand{couplepage}{couplepage} +\setinterfacecommand{couplepaper}{couplepaper} +\setinterfacecommand{coupleregister}{coupleregister} +\setinterfacecommand{crlf}{crlf} +\setinterfacecommand{currentdate}{currentdate} +\setinterfacecommand{currentheadnumber}{currentheadnumber} +\setinterfacecommand{cutspace}{cutspace} +\setinterfacecommand{date}{date} +\setinterfacecommand{decouplemarking}{decouplemarking} +\setinterfacecommand{decrementnumber}{decrementnumber} +\setinterfacecommand{define}{define} +\setinterfacecommand{defineaccent}{defineaccent} +\setinterfacecommand{defineblank}{defineblank} +\setinterfacecommand{defineblock}{defineblock} +\setinterfacecommand{definebodyfont}{definebodyfont} +\setinterfacecommand{definebodyfontenvironment}{definebodyfontenvironment} +\setinterfacecommand{definebuffer}{definebuffer} +\setinterfacecommand{definecharacter}{definecharacter} +\setinterfacecommand{definecolor}{definecolor} +\setinterfacecommand{definecolorgroup}{definecolorgroup} +\setinterfacecommand{definecolumnbreak}{definecolumnbreak} +\setinterfacecommand{definecolumnset}{definecolumnset} +\setinterfacecommand{definecombination}{definecombination} +\setinterfacecommand{definecombinedlist}{definecombinedlist} +\setinterfacecommand{definecommand}{definecommand} +\setinterfacecommand{defineconversion}{defineconversion} +\setinterfacecommand{definedescription}{definedescription} +\setinterfacecommand{defineenumeration}{defineenumeration} +\setinterfacecommand{definefield}{definefield} +\setinterfacecommand{definefieldstack}{definefieldstack} +\setinterfacecommand{definefiguresymbol}{definefiguresymbol} +\setinterfacecommand{definefloat}{definefloat} +\setinterfacecommand{definefont}{definefont} +\setinterfacecommand{definefontstyle}{definefontstyle} +\setinterfacecommand{definefontsynonym}{definefontsynonym} +\setinterfacecommand{defineframed}{defineframed} +\setinterfacecommand{defineframedtext}{defineframedtext} +\setinterfacecommand{definehbox}{definehbox} +\setinterfacecommand{definehead}{definehead} +\setinterfacecommand{defineindenting}{defineindenting} +\setinterfacecommand{defineinmargin}{defineinmargin} +\setinterfacecommand{defineinteractionmenu}{defineinteractionmenu} +\setinterfacecommand{defineitemgroup}{defineitemgroup} +\setinterfacecommand{definelabel}{definelabel} +\setinterfacecommand{definelayer}{definelayer} +\setinterfacecommand{definelayout}{definelayout} +\setinterfacecommand{definelist}{definelist} +\setinterfacecommand{definelogo}{definelogo} +\setinterfacecommand{definemainfield}{definemainfield} +\setinterfacecommand{definemakeup}{definemakeup} +\setinterfacecommand{definemarking}{definemarking} +\setinterfacecommand{definemathalignment}{definemathalignment} +\setinterfacecommand{defineoutput}{defineoutput} +\setinterfacecommand{defineoverlay}{defineoverlay} +\setinterfacecommand{definepagebreak}{definepagebreak} +\setinterfacecommand{definepalet}{definepalet} +\setinterfacecommand{definepapersize}{definepapersize} +\setinterfacecommand{defineparagraphs}{defineparagraphs} +\setinterfacecommand{defineplacement}{defineplacement} +\setinterfacecommand{defineprofile}{defineprofile} +\setinterfacecommand{defineprogram}{defineprogram} +\setinterfacecommand{definerawfont}{definerawfont} +\setinterfacecommand{definereference}{definereference} +\setinterfacecommand{definereferenceformat}{definereferenceformat} +\setinterfacecommand{definereferencelist}{definereferencelist} +\setinterfacecommand{defineregister}{defineregister} +\setinterfacecommand{definerule}{definerule} +\setinterfacecommand{definesection}{definesection} +\setinterfacecommand{definesectionblock}{definesectionblock} +\setinterfacecommand{definesorting}{definesorting} +\setinterfacecommand{definestartstop}{definestartstop} +\setinterfacecommand{definestyle}{definestyle} +\setinterfacecommand{definesubfield}{definesubfield} +\setinterfacecommand{definesymbol}{definesymbol} +\setinterfacecommand{definesynonyms}{definesynonyms} +\setinterfacecommand{definetabletemplate}{definetabletemplate} +\setinterfacecommand{definetabulate}{definetabulate} +\setinterfacecommand{definetext}{definetext} +\setinterfacecommand{definetextposition}{definetextposition} +\setinterfacecommand{definetextvariable}{definetextvariable} +\setinterfacecommand{definetype}{definetype} +\setinterfacecommand{definetyping}{definetyping} +\setinterfacecommand{defineversion}{defineversion} +\setinterfacecommand{determineheadnumber}{determineheadnumber} +\setinterfacecommand{determinelistcharacteristics}{determinelistcharacteristics} +\setinterfacecommand{determineregistercharacteristics}{determineregistercharacteristics} +\setinterfacecommand{dimension}{dimension} +\setinterfacecommand{disableinteractionmenu}{disableinteractionmenu} +\setinterfacecommand{domicile}{domicile} +\setinterfacecommand{donttest}{donttest} +\setinterfacecommand{edgedistance}{edgedistance} +\setinterfacecommand{edgewidth}{edgewidth} +\setinterfacecommand{emptylines}{emptylines} +\setinterfacecommand{environment}{environment} +\setinterfacecommand{externalfigure}{externalfigure} +\setinterfacecommand{fact}{fact} +\setinterfacecommand{field}{field} +\setinterfacecommand{fieldstack}{fieldstack} +\setinterfacecommand{fillinfield}{fillinfield} +\setinterfacecommand{fillinline}{fillinline} +\setinterfacecommand{fillinrules}{fillinrules} +\setinterfacecommand{fillintext}{fillintext} +\setinterfacecommand{fitfield}{fitfield} +\setinterfacecommand{fixedspace}{fixedspace} +\setinterfacecommand{fixedspaces}{fixedspaces} +\setinterfacecommand{followprofile}{followprofile} +\setinterfacecommand{followprofileversion}{followprofileversion} +\setinterfacecommand{followversion}{followversion} +\setinterfacecommand{footerdistance}{footerdistance} +\setinterfacecommand{footerheight}{footerheight} +\setinterfacecommand{footnote}{footnote} +\setinterfacecommand{footnotetext}{footnotetext} +\setinterfacecommand{forceblocks}{forceblocks} +\setinterfacecommand{formulanumber}{formulanumber} +\setinterfacecommand{fraction}{fraction} +\setinterfacecommand{framed}{framed} +\setinterfacecommand{from}{from} +\setinterfacecommand{getbuffer}{getbuffer} +\setinterfacecommand{getmarking}{getmarking} +\setinterfacecommand{getnumber}{getnumber} +\setinterfacecommand{godown}{godown} +\setinterfacecommand{goto}{goto} +\setinterfacecommand{gotobox}{gotobox} +\setinterfacecommand{gotopage}{gotopage} +\setinterfacecommand{graycolor}{graycolor} +\setinterfacecommand{greyvalue}{greyvalue} +\setinterfacecommand{grid}{grid} +\setinterfacecommand{hairline}{hairline} +\setinterfacecommand{head}{head} +\setinterfacecommand{headerdistance}{headerdistance} +\setinterfacecommand{headerheight}{headerheight} +\setinterfacecommand{headlevel}{headlevel} +\setinterfacecommand{headnumber}{headnumber} +\setinterfacecommand{headsym}{headsym} +\setinterfacecommand{headtext}{headtext} +\setinterfacecommand{hideblocks}{hideblocks} +\setinterfacecommand{high}{high} +\setinterfacecommand{hl}{hl} +\setinterfacecommand{immediatebetweenlist}{immediatebetweenlist} +\setinterfacecommand{immediatetolist}{immediatetolist} +\setinterfacecommand{in}{in} +\setinterfacecommand{incrementnumber}{incrementnumber} +\setinterfacecommand{indenting}{indenting} +\setinterfacecommand{inframed}{inframed} +\setinterfacecommand{infull}{infull} +\setinterfacecommand{ininner}{ininner} +\setinterfacecommand{inleft}{inleft} +\setinterfacecommand{inleftedge}{inleftedge} +\setinterfacecommand{inleftmargin}{inleftmargin} +\setinterfacecommand{inline}{inline} +\setinterfacecommand{inmargin}{inmargin} +\setinterfacecommand{inmframed}{inmaframed} +\setinterfacecommand{inneredgedistance}{inneredgedistance} +\setinterfacecommand{inneredgewidth}{inneredgewidth} +\setinterfacecommand{innermargindistance}{innermargindistance} +\setinterfacecommand{innermarginwidth}{innermarginwidth} +\setinterfacecommand{inothermargin}{inothermargin} +\setinterfacecommand{inouter}{inouter} +\setinterfacecommand{inright}{inright} +\setinterfacecommand{inrightedge}{inrightedge} +\setinterfacecommand{inrightmargin}{inrightmargin} +\setinterfacecommand{installlanguage}{installlanguage} +\setinterfacecommand{interactionbar}{interactionbar} +\setinterfacecommand{interactionbuttons}{interactionbuttons} +\setinterfacecommand{interactionmenu}{interactionmenu} +\setinterfacecommand{item}{item} +\setinterfacecommand{items}{items} +\setinterfacecommand{its}{its} +\setinterfacecommand{keepblocks}{keepblocks} +\setinterfacecommand{label}{label} +\setinterfacecommand{labels}{labels} +\setinterfacecommand{labeltext}{labeltext} +\setinterfacecommand{language}{language} +\setinterfacecommand{leftaligned}{leftaligned} +\setinterfacecommand{leftedgedistance}{leftedgedistance} +\setinterfacecommand{leftedgewidth}{leftedgewidth} +\setinterfacecommand{leftmargindistance}{leftmargindistance} +\setinterfacecommand{leftmarginwidth}{leftmarginwidth} +\setinterfacecommand{leg}{leg} +\setinterfacecommand{linewidth}{linethickness} +\setinterfacecommand{listheight}{listheight} +\setinterfacecommand{listlength}{listlength} +\setinterfacecommand{listsymbol}{listsymbol} +\setinterfacecommand{listwidth}{listwidth} +\setinterfacecommand{logfields}{logfields} +\setinterfacecommand{lohi}{lohi} +\setinterfacecommand{low}{low} +\setinterfacecommand{macroname}{name} +\setinterfacecommand{mainlanguage}{mainlanguage} +\setinterfacecommand{makeupheight}{makeupheight} +\setinterfacecommand{makeupwidth}{makeupwidth} +\setinterfacecommand{mar}{mar} +\setinterfacecommand{margindistance}{margindistance} +\setinterfacecommand{marginrule}{marginrule} +\setinterfacecommand{margintext}{margintext} +\setinterfacecommand{margintitle}{margintitle} +\setinterfacecommand{marginwidth}{marginwidth} +\setinterfacecommand{marginword}{marginword} +\setinterfacecommand{marking}{marking} +\setinterfacecommand{markversion}{markversion} +\setinterfacecommand{mathematics}{mathematics} +\setinterfacecommand{menubutton}{menubutton} +\setinterfacecommand{mframed}{maframed} +\setinterfacecommand{midaligned}{midaligned} +\setinterfacecommand{mirror}{mirror} +\setinterfacecommand{month}{month} +\setinterfacecommand{moveformula}{moveformula} +\setinterfacecommand{moveongrid}{moveongrid} +\setinterfacecommand{movesidefloat}{movesidefloat} +\setinterfacecommand{navigating}{navigating} +\setinterfacecommand{nodimension}{nodimension} +\setinterfacecommand{noheaderandfooterlines}{noheaderandfooterlines} +\setinterfacecommand{noindenting}{noindenting} +\setinterfacecommand{nolist}{nolist} +\setinterfacecommand{nomarking}{nomarking} +\setinterfacecommand{nomoreblocks}{nomoreblocks} +\setinterfacecommand{nomorefiles}{nomorefiles} +\setinterfacecommand{nop}{nop} +\setinterfacecommand{nospace}{nospace} +\setinterfacecommand{note}{note} +\setinterfacecommand{notopandbottomlines}{notopandbottomlines} +\setinterfacecommand{notsmallcapped}{nocap} +\setinterfacecommand{nowhitespace}{nowhitespace} +\setinterfacecommand{numberofsubpages}{numberofsubpages} +\setinterfacecommand{numbers}{numbers} +\setinterfacecommand{outeredgedistance}{outeredgedistance} +\setinterfacecommand{outeredgewidth}{outeredgewidth} +\setinterfacecommand{outermargindistance}{outermargindistance} +\setinterfacecommand{outermarginwidth}{outermarginwidth} +\setinterfacecommand{packed}{packed} +\setinterfacecommand{page}{page} +\setinterfacecommand{pagedepth}{pagedepth} +\setinterfacecommand{pagenumber}{pagenumber} +\setinterfacecommand{pageoffset}{pageoffset} +\setinterfacecommand{pagereference}{pagereference} +\setinterfacecommand{pagetype}{pagetype} +\setinterfacecommand{paperheight}{paperheight} +\setinterfacecommand{paperwidth}{paperwidth} +\setinterfacecommand{periods}{periods} +\setinterfacecommand{plaatsruwelijst}{placerawlist} +\setinterfacecommand{placebookmarks}{placebookmarks} +\setinterfacecommand{placecombinedlist}{placecombinedlist} +\setinterfacecommand{placefloat}{placefloat} +\setinterfacecommand{placefootnotes}{placefootnotes} +\setinterfacecommand{placeformula}{placeformula} +\setinterfacecommand{placeheadnumber}{placeheadnumber} +\setinterfacecommand{placeheadtext}{placeheadtext} +\setinterfacecommand{placelegend}{placelegend} +\setinterfacecommand{placelist}{placelist} +\setinterfacecommand{placelocalfootnotes}{placelocalfootnotes} +\setinterfacecommand{placelogos}{placelogos} +\setinterfacecommand{placeongrid}{placeongrid} +\setinterfacecommand{placeontopofeachother}{placeontopofeachother} +\setinterfacecommand{placepagenumber}{placepagenumber} +\setinterfacecommand{placereferencelist}{placereferencelist} +\setinterfacecommand{placeregister}{placeregister} +\setinterfacecommand{placerule}{placerule} +\setinterfacecommand{placesidebyside}{placesidebyside} +\setinterfacecommand{placesubformula}{placesubformula} +\setinterfacecommand{placetextvariable}{placetextvariable} +\setinterfacecommand{position}{position} +\setinterfacecommand{positiontext}{positiontext} +\setinterfacecommand{printpaperheight}{printpaperheight} +\setinterfacecommand{printpaperwidth}{printpaperwidth} +\setinterfacecommand{processblocks}{processblocks} +\setinterfacecommand{processpage}{processpage} +\setinterfacecommand{product}{product} +\setinterfacecommand{program}{program} +\setinterfacecommand{project}{project} +\setinterfacecommand{publication}{publication} +\setinterfacecommand{quotation}{quotation} +\setinterfacecommand{quote}{quote} +\setinterfacecommand{ran}{ran} +\setinterfacecommand{redo}{redo} +\setinterfacecommand{ref}{ref} +\setinterfacecommand{reference}{reference} +\setinterfacecommand{referral}{referral} +\setinterfacecommand{referraldate}{referraldate} +\setinterfacecommand{referring}{referring} +\setinterfacecommand{remark}{remark} +\setinterfacecommand{reset}{reset} +\setinterfacecommand{resetmarking}{resetmarking} +\setinterfacecommand{resetnumber}{resetnumber} +\setinterfacecommand{resettext}{resettextcontent} +\setinterfacecommand{rightaligned}{rightaligned} +\setinterfacecommand{rightedgedistance}{rightedgedistance} +\setinterfacecommand{rightedgewidth}{rightedgewidth} +\setinterfacecommand{rightmargindistance}{rightmargindistance} +\setinterfacecommand{rightmarginwidth}{rightmarginwidth} +\setinterfacecommand{romannumerals}{romannumerals} +\setinterfacecommand{rotate}{rotate} +\setinterfacecommand{scale}{scale} +\setinterfacecommand{screen}{screen} +\setinterfacecommand{selectblocks}{selectblocks} +\setinterfacecommand{selectpaper}{selectpaper} +\setinterfacecommand{selectversion}{selectversion} +\setinterfacecommand{setnumber}{setnumber} +\setinterfacecommand{settextcontent}{settextcontent} +\setinterfacecommand{settextvariable}{settextvariable} +\setinterfacecommand{setupalign}{setupalign} +\setinterfacecommand{setupanswerarea}{setupanswerarea} +\setinterfacecommand{setuparranging}{setuparranging} +\setinterfacecommand{setupbackground}{setupbackground} +\setinterfacecommand{setupbackgrounds}{setupbackgrounds} +\setinterfacecommand{setupblackrules}{setupblackrules} +\setinterfacecommand{setupblank}{setupblank} +\setinterfacecommand{setupblock}{setupblock} +\setinterfacecommand{setupbodyfont}{setupbodyfont} +\setinterfacecommand{setupbodyfontenvironment}{setupbodyfontenvironment} +\setinterfacecommand{setupbottom}{setupbottom} +\setinterfacecommand{setupbottomtexts}{setupbottomtexts} +\setinterfacecommand{setupbuffer}{setupbuffer} +\setinterfacecommand{setupbuttons}{setupbuttons} +\setinterfacecommand{setupcapitals}{setupcapitals} +\setinterfacecommand{setupcaption}{setupcaption} +\setinterfacecommand{setupcaptions}{setupcaptions} +\setinterfacecommand{setupclipping}{setupclipping} +\setinterfacecommand{setupcolor}{setupcolor} +\setinterfacecommand{setupcolors}{setupcolors} +\setinterfacecommand{setupcolumns}{setupcolumns} +\setinterfacecommand{setupcolumnset}{setupcolumnset} +\setinterfacecommand{setupcolumnsetlines}{setupcolumnsetlines} +\setinterfacecommand{setupcolumnsetstart}{setupcolumnsetstart} +\setinterfacecommand{setupcombinations}{setupcombinations} +\setinterfacecommand{setupcombinedlist}{setupcombinedlist} +\setinterfacecommand{setupcomment}{setupcomment} +\setinterfacecommand{setupdescriptions}{setupdescriptions} +\setinterfacecommand{setupenumerations}{setupenumerations} +\setinterfacecommand{setupexternalfigures}{setupexternalfigures} +\setinterfacecommand{setupfield}{setupfield} +\setinterfacecommand{setupfields}{setupfields} +\setinterfacecommand{setupfillinlines}{setupfillinlines} +\setinterfacecommand{setupfillinrules}{setupfillinrules} +\setinterfacecommand{setupfloat}{setupfloat} +\setinterfacecommand{setupfloats}{setupfloats} +\setinterfacecommand{setupfloatsplitting}{setupfloatsplitting} +\setinterfacecommand{setupfooter}{setupfooter} +\setinterfacecommand{setupfootertexts}{setupfootertexts} +\setinterfacecommand{setupfootnotedefinition}{setupfootnotedefinition} +\setinterfacecommand{setupfootnotes}{setupfootnotes} +\setinterfacecommand{setupforms}{setupforms} +\setinterfacecommand{setupformulas}{setupformulae} +\setinterfacecommand{setupframed}{setupframed} +\setinterfacecommand{setupframedtexts}{setupframedtexts} +\setinterfacecommand{setuphead}{setuphead} +\setinterfacecommand{setupheader}{setupheader} +\setinterfacecommand{setupheadertexts}{setupheadertexts} +\setinterfacecommand{setupheadnumber}{setupheadnumber} +\setinterfacecommand{setupheads}{setupheads} +\setinterfacecommand{setupheadtext}{setupheadtext} +\setinterfacecommand{setuphyphenmark}{setuphyphenmark} +\setinterfacecommand{setupindentations}{setupindentations} +\setinterfacecommand{setupindenting}{setupindenting} +\setinterfacecommand{setupinmargin}{setupinmargin} +\setinterfacecommand{setupinteraction}{setupinteraction} +\setinterfacecommand{setupinteractionbar}{setupinteractionbar} +\setinterfacecommand{setupinteractionmenu}{setupinteractionmenu} +\setinterfacecommand{setupinteractionscreen}{setupinteractionscreen} +\setinterfacecommand{setupinterlinespace}{setupinterlinespace} +\setinterfacecommand{setupitemgroup}{setupitemgroup} +\setinterfacecommand{setupitemgroups}{setupitemizations} +\setinterfacecommand{setupitems}{setupitems} +\setinterfacecommand{setuplabeltext}{setuplabeltext} +\setinterfacecommand{setuplanguage}{setuplanguage} +\setinterfacecommand{setuplayout}{setuplayout} +\setinterfacecommand{setuplegend}{setuplegend} +\setinterfacecommand{setuplinenumbering}{setuplinenumbering} +\setinterfacecommand{setuplines}{setuplines} +\setinterfacecommand{setuplinewidth}{setuplinewidth} +\setinterfacecommand{setuplist}{setuplist} +\setinterfacecommand{setupmakeup}{setupmakeup} +\setinterfacecommand{setupmarginblocks}{setupmarginblocks} +\setinterfacecommand{setupmarginrules}{setupmarginrules} +\setinterfacecommand{setupmarking}{setupmarking} +\setinterfacecommand{setupmathalignment}{setupmathalignment} +\setinterfacecommand{setupnarrower}{setupnarrower} +\setinterfacecommand{setupnumber}{setupnumber} +\setinterfacecommand{setupnumbering}{setupnumbering} +\setinterfacecommand{setupoppositeplacing}{setupoppositeplacing} +\setinterfacecommand{setupoutput}{setupoutput} +\setinterfacecommand{setuppagecomment}{setuppagecomment} +\setinterfacecommand{setuppagenumber}{setuppagenumber} +\setinterfacecommand{setuppagenumbering}{setuppagenumbering} +\setinterfacecommand{setuppagetransitions}{setuppagetransitions} +\setinterfacecommand{setuppalet}{setuppalet} +\setinterfacecommand{setuppaper}{setuppaper} +\setinterfacecommand{setuppapersize}{setuppapersize} +\setinterfacecommand{setupparagraphnumbering}{setupparagraphnumbering} +\setinterfacecommand{setupparagraphs}{setupparagraphs} +\setinterfacecommand{setupplacement}{setupplacement} +\setinterfacecommand{setuppositioning}{setuppositioning} +\setinterfacecommand{setupprofiles}{setupprofiles} +\setinterfacecommand{setupprograms}{setupprograms} +\setinterfacecommand{setuppublications}{setuppublications} +\setinterfacecommand{setupquote}{setupquote} +\setinterfacecommand{setupreferencelist}{setupreferencelist} +\setinterfacecommand{setupreferencing}{setupreferencing} +\setinterfacecommand{setupregister}{setupregister} +\setinterfacecommand{setuprotate}{setuprotate} +\setinterfacecommand{setuprule}{setuprule} +\setinterfacecommand{setups}{setups} +\setinterfacecommand{setupscreens}{setupscreens} +\setinterfacecommand{setupsection}{setupsection} +\setinterfacecommand{setupsectionblock}{setupsectionblock} +\setinterfacecommand{setupsorting}{setupsorting} +\setinterfacecommand{setupspacing}{setupspacing} +\setinterfacecommand{setupstartstop}{setupstartstop} +\setinterfacecommand{setupstrut}{setupstrut} +\setinterfacecommand{setupsubpagenumber}{setupsubpagenumber} +\setinterfacecommand{setupsymbolset}{setupsymbolset} +\setinterfacecommand{setupsynchronization}{setupsynchronization} +\setinterfacecommand{setupsynchronizationbar}{setupsynchronizationbar} +\setinterfacecommand{setupsynonyms}{setupsynonyms} +\setinterfacecommand{setupsystem}{setupsystem} +\setinterfacecommand{setuptab}{setuptab} +\setinterfacecommand{setuptables}{setuptables} +\setinterfacecommand{setuptabulate}{setuptabulate} +\setinterfacecommand{setuptext}{setuptext} +\setinterfacecommand{setuptextposition}{setuptextposition} +\setinterfacecommand{setuptextrules}{setuptextrules} +\setinterfacecommand{setuptexttexts}{setuptexttexts} +\setinterfacecommand{setuptextvariable}{setuptextvariable} +\setinterfacecommand{setupthinrules}{setupthinrules} +\setinterfacecommand{setuptolerance}{setuptolerance} +\setinterfacecommand{setuptop}{setuptop} +\setinterfacecommand{setuptoptexts}{setuptoptexts} +\setinterfacecommand{setuptype}{setuptype} +\setinterfacecommand{setuptyping}{setuptyping} +\setinterfacecommand{setupunderbar}{setupunderbar} +\setinterfacecommand{setupurl}{setupurl} +\setinterfacecommand{setupversions}{setupversions} +\setinterfacecommand{setupwhitespace}{setupwhitespace} +\setinterfacecommand{showbodyfont}{showbodyfont} +\setinterfacecommand{showbodyfontenvironment}{showbodyfontenvironment} +\setinterfacecommand{showcolor}{showcolor} +\setinterfacecommand{showcolorgroup}{showcolorgroup} +\setinterfacecommand{showexternalfigures}{showexternalfigures} +\setinterfacecommand{showfields}{showfields} +\setinterfacecommand{showframe}{showframe} +\setinterfacecommand{showgrid}{showgrid} +\setinterfacecommand{showlayout}{showlayout} +\setinterfacecommand{showmakeup}{showmakeup} +\setinterfacecommand{showpalet}{showpalet} +\setinterfacecommand{showprint}{showprint} +\setinterfacecommand{showsetups}{showsetups} +\setinterfacecommand{showstruts}{showstruts} +\setinterfacecommand{showsymbolset}{showsymbolset} +\setinterfacecommand{smallcapped}{cap} +\setinterfacecommand{someline}{someline} +\setinterfacecommand{somewhere}{somewhere} +\setinterfacecommand{space}{space} +\setinterfacecommand{splitfloat}{splitfloat} +\setinterfacecommand{startalignment}{startalignment} +\setinterfacecommand{startbackground}{startbackground} +\setinterfacecommand{startcoding}{startcoding} +\setinterfacecommand{startcolor}{startcolor} +\setinterfacecommand{startcolumnmakeup}{startcolumnmakeup} +\setinterfacecommand{startcolumns}{startcolumns} +\setinterfacecommand{startcolumnset}{startcolumnset} +\setinterfacecommand{startcombination}{startcombination} +\setinterfacecommand{startcomponent}{startcomponent} +\setinterfacecommand{startdocument}{startdocument} +\setinterfacecommand{startenvironment}{startenvironment} +\setinterfacecommand{startfigure}{startfigure} +\setinterfacecommand{startglobal}{startglobal} +\setinterfacecommand{startline}{startline} +\setinterfacecommand{startlinecorrection}{startlinecorrection} +\setinterfacecommand{startlinenumbering}{startlinenumbering} +\setinterfacecommand{startlines}{startlines} +\setinterfacecommand{startlocal}{startlocal} +\setinterfacecommand{startlocalfootnotes}{startlocalfootnotes} +\setinterfacecommand{startmakeup}{startmakeup} +\setinterfacecommand{startmarginblock}{startmarginblock} +\setinterfacecommand{startmarginrule}{startmarginrule} +\setinterfacecommand{startnarrower}{startnarrower} +\setinterfacecommand{startopposite}{startopposite} +\setinterfacecommand{startoverlay}{startoverlay} +\setinterfacecommand{startoverzicht}{startoverview} +\setinterfacecommand{startpacked}{startpacked} +\setinterfacecommand{startpositioning}{startpositioning} +\setinterfacecommand{startproduct}{startproduct} +\setinterfacecommand{startprofile}{startprofile} +\setinterfacecommand{startproject}{startproject} +\setinterfacecommand{startquotation}{startquotation} +\setinterfacecommand{startraster}{startraster} +\setinterfacecommand{startsymbolset}{startsymbolset} +\setinterfacecommand{startsynchronization}{startsynchronization} +\setinterfacecommand{starttable}{starttable} +\setinterfacecommand{starttables}{starttables} +\setinterfacecommand{starttext}{starttext} +\setinterfacecommand{starttextrule}{starttextrule} +\setinterfacecommand{startunpacked}{startunpacked} +\setinterfacecommand{startversion}{startversion} +\setinterfacecommand{stopalignment}{stopalignment} +\setinterfacecommand{stopbackground}{stopbackground} +\setinterfacecommand{stopcoding}{stopcoding} +\setinterfacecommand{stopcolor}{stopcolor} +\setinterfacecommand{stopcolumnmakeup}{stopcolumnmakeup} +\setinterfacecommand{stopcolumns}{stopcolumns} +\setinterfacecommand{stopcolumnset}{stopcolumnset} +\setinterfacecommand{stopcombination}{stopcombination} +\setinterfacecommand{stopcomponent}{stopcomponent} +\setinterfacecommand{stopdocument}{stopdocument} +\setinterfacecommand{stopenvironment}{stopenvironment} +\setinterfacecommand{stopglobal}{stopglobal} +\setinterfacecommand{stopline}{stopline} +\setinterfacecommand{stoplinecorrection}{stoplinecorrection} +\setinterfacecommand{stoplinenumbering}{stoplinenumbering} +\setinterfacecommand{stoplines}{stoplines} +\setinterfacecommand{stoplocal}{stoplocal} +\setinterfacecommand{stoplocalfootnotes}{stoplocalfootnotes} +\setinterfacecommand{stopmakeup}{stopmakeup} +\setinterfacecommand{stopmarginblock}{stopmarginblock} +\setinterfacecommand{stopmarginrule}{stopmarginrule} +\setinterfacecommand{stopnarrower}{stopnarrower} +\setinterfacecommand{stopopposite}{stopopposite} +\setinterfacecommand{stopoverlay}{stopoverlay} +\setinterfacecommand{stopoverzicht}{stopoverview} +\setinterfacecommand{stoppacked}{stoppacked} +\setinterfacecommand{stoppositioning}{stoppositioning} +\setinterfacecommand{stopproduct}{stopproduct} +\setinterfacecommand{stopprofile}{stopprofile} +\setinterfacecommand{stopproject}{stopproject} +\setinterfacecommand{stopquotation}{stopquotation} +\setinterfacecommand{stopraster}{stopraster} +\setinterfacecommand{stopsynchronization}{stopsynchronization} +\setinterfacecommand{stoptable}{stoptable} +\setinterfacecommand{stoptables}{stoptables} +\setinterfacecommand{stoptext}{stoptext} +\setinterfacecommand{stoptextrule}{stoptextrule} +\setinterfacecommand{stopunpacked}{stopunpacked} +\setinterfacecommand{stopversion}{stopversion} +\setinterfacecommand{stretched}{stretched} +\setinterfacecommand{subformulanumber}{subformulanumber} +\setinterfacecommand{subpagenumber}{subpagenumber} +\setinterfacecommand{switchtobodyfont}{switchtobodyfont} +\setinterfacecommand{switchtorawfont}{switchtorawfont} +\setinterfacecommand{sym}{sym} +\setinterfacecommand{symbol}{symbol} +\setinterfacecommand{synchronizationbar}{synchronizationbar} +\setinterfacecommand{synchronize}{synchronize} +\setinterfacecommand{tab}{tab} +\setinterfacecommand{testcolumn}{testcolumn} +\setinterfacecommand{testpage}{testpage} +\setinterfacecommand{tex}{tex} +\setinterfacecommand{textheight}{textheight} +\setinterfacecommand{textreference}{textreference} +\setinterfacecommand{textrule}{textrule} +\setinterfacecommand{textvariable}{textvariable} +\setinterfacecommand{textwidth}{textwidth} +\setinterfacecommand{thinrule}{thinrule} +\setinterfacecommand{thinrules}{thinrules} +\setinterfacecommand{tooltip}{tooltip} +\setinterfacecommand{topdistance}{topdistance} +\setinterfacecommand{topheight}{topheight} +\setinterfacecommand{topspace}{topspace} +\setinterfacecommand{totalnumberofpages}{totalnumberofpages} +\setinterfacecommand{translate}{translate} +\setinterfacecommand{txt}{txt} +\setinterfacecommand{typ}{typ} +\setinterfacecommand{type}{type} +\setinterfacecommand{typebuffer}{typebuffer} +\setinterfacecommand{typefile}{typefile} +\setinterfacecommand{unitmeaning}{unitmeaning} +\setinterfacecommand{unknown}{unknown} +\setinterfacecommand{useJSscripts}{useJSscripts} +\setinterfacecommand{useURL}{useURL} +\setinterfacecommand{useXMLfilter}{useXMLfilter} +\setinterfacecommand{useblocks}{useblocks} +\setinterfacecommand{usecommands}{usecommands} +\setinterfacecommand{useencoding}{useencoding} +\setinterfacecommand{useexternaldocument}{useexternaldocument} +\setinterfacecommand{useexternalfigure}{useexternalfigure} +\setinterfacecommand{useexternalfile}{useexternalfile} +\setinterfacecommand{useexternalfiles}{useexternalfiles} +\setinterfacecommand{useexternalsoundtrack}{useexternalsoundtrack} +\setinterfacecommand{usemodule}{usemodule} +\setinterfacecommand{usemodules}{usemodules} +\setinterfacecommand{usepath}{usedirectory} +\setinterfacecommand{usereferences}{usereferences} +\setinterfacecommand{usespecials}{usespecials} +\setinterfacecommand{usesymbols}{usesymbols} +\setinterfacecommand{usetypescript}{usetypescript} +\setinterfacecommand{usetypescriptfile}{usetypescriptfile} +\setinterfacecommand{useurl}{useurl} +\setinterfacecommand{version}{version} +\setinterfacecommand{vl}{vl} +\setinterfacecommand{weekday}{weekday} +\setinterfacecommand{whitespace}{whitespace} +\setinterfacecommand{wordright}{wordright} +\setinterfacecommand{writebetweenlist}{writebetweenlist} +\setinterfacecommand{writetolist}{writetolist} +\setinterfacecommand{writetoreferencelist}{writetoreferencelist} +\setinterfacecommand{writetoregister}{writetoregister} +% +\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-en.tex b/Master/texmf-dist/tex/context/base/mult-en.tex deleted file mode 100644 index 20917a034ce..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-en.tex +++ /dev/null @@ -1,1693 +0,0 @@ -% this file is auto-generated, don't edit this file -% -% definitions for interface variables for language en -% -\setinterfacevariable{Addition}{Addition} -\setinterfacevariable{Balloon}{Balloon} -\setinterfacevariable{Character}{Character} -\setinterfacevariable{Characters}{Characters} -\setinterfacevariable{CloseDocument}{CloseDocument} -\setinterfacevariable{ExitViewer}{ExitViewer} -\setinterfacevariable{FirstPage}{FirstPage} -\setinterfacevariable{FitHeight}{FitHeight} -\setinterfacevariable{FitWidth}{FitWidth} -\setinterfacevariable{GotoPage}{GotoPage} -\setinterfacevariable{Greek}{Greek} -\setinterfacevariable{Help}{Help} -\setinterfacevariable{HideField}{HideField} -\setinterfacevariable{HideLayer}{HideLayer} -\setinterfacevariable{Key}{Key} -\setinterfacevariable{LastPage}{LastPage} -\setinterfacevariable{LoadForm}{LoadForm} -\setinterfacevariable{MONTH}{MONTH} -\setinterfacevariable{New}{New} -\setinterfacevariable{NextJump}{NextJump} -\setinterfacevariable{NextPage}{NextPage} -\setinterfacevariable{Numbers}{Numbers} -\setinterfacevariable{OpenNamedDocument}{OpenNamedDocument} -\setinterfacevariable{Paragraph}{Paragraph} -\setinterfacevariable{PauseMovie}{PauseMovie} -\setinterfacevariable{PauseRendering}{PauseRendering} -\setinterfacevariable{PauseSound}{PauseSound} -\setinterfacevariable{PreviousJump}{PreviousJump} -\setinterfacevariable{PreviousPage}{PreviousPage} -\setinterfacevariable{PrintDocument}{PrintDocument} -\setinterfacevariable{Query}{Query} -\setinterfacevariable{QueryAgain}{QueryAgain} -\setinterfacevariable{ResetForm}{ResetForm} -\setinterfacevariable{ResumeMovie}{ResumeMovie} -\setinterfacevariable{ResumeRendering}{ResumeRendering} -\setinterfacevariable{ResumeSound}{ResumeSound} -\setinterfacevariable{Romannumerals}{Romannumerals} -\setinterfacevariable{SaveDocument}{SaveDocument} -\setinterfacevariable{SaveForm}{SaveForm} -\setinterfacevariable{SaveNamedDocument}{SaveNamedDocument} -\setinterfacevariable{SearchAgain}{SearchAgain} -\setinterfacevariable{SearchDocument}{SearchDocument} -\setinterfacevariable{ShowBookmarks}{ShowBookmarks} -\setinterfacevariable{ShowField}{ShowField} -\setinterfacevariable{ShowThumbs}{ShowThumbs} -\setinterfacevariable{StartMovie}{StartMovie} -\setinterfacevariable{StartRendering}{StartRendering} -\setinterfacevariable{StartSound}{StartSound} -\setinterfacevariable{StopMovie}{StopMovie} -\setinterfacevariable{StopRendering}{StopRendering} -\setinterfacevariable{StopSound}{StopSound} -\setinterfacevariable{SubmitForm}{SubmitForm} -\setinterfacevariable{ToggleLayer}{ToggleLayer} -\setinterfacevariable{ToggleViewer}{ToggleViewer} -\setinterfacevariable{URL}{URL} -\setinterfacevariable{VideLayer}{VideLayer} -\setinterfacevariable{ViewerHelp}{ViewerHelp} -\setinterfacevariable{WEEKDAY}{WEEKDAY} -\setinterfacevariable{WORD}{WORD} -\setinterfacevariable{abbreviation}{abbreviation} -\setinterfacevariable{abbreviations}{abbreviations} -\setinterfacevariable{absolute}{absolute} -\setinterfacevariable{action}{action} -\setinterfacevariable{after}{after} -\setinterfacevariable{all}{all} -\setinterfacevariable{always}{always} -\setinterfacevariable{answerarea}{answerarea} -\setinterfacevariable{appendices}{appendices} -\setinterfacevariable{appendix}{appendix} -\setinterfacevariable{april}{April} -\setinterfacevariable{atmargin}{atmargin} -\setinterfacevariable{atpage}{atpage} -\setinterfacevariable{august}{August} -\setinterfacevariable{author}{author} -\setinterfacevariable{auto}{auto} -\setinterfacevariable{autointro}{autointro} -\setinterfacevariable{back}{back} -\setinterfacevariable{background}{background} -\setinterfacevariable{backmatter}{backmatter} -\setinterfacevariable{backpart}{backpart} -\setinterfacevariable{backspace}{backspace} -\setinterfacevariable{backward}{backward} -\setinterfacevariable{bbl}{bbl} -\setinterfacevariable{before}{before} -\setinterfacevariable{begin}{begin} -\setinterfacevariable{bib}{bib} -\setinterfacevariable{big}{big} -\setinterfacevariable{bigbodyfont}{bigbodyfont} -\setinterfacevariable{bigpreference}{bigpreference} -\setinterfacevariable{blank}{blank} -\setinterfacevariable{blockquote}{blockquote} -\setinterfacevariable{bodymatter}{bodymatter} -\setinterfacevariable{bodypart}{bodypart} -\setinterfacevariable{bold}{bold} -\setinterfacevariable{bolditalic}{bolditalic} -\setinterfacevariable{boldslanted}{boldslanted} -\setinterfacevariable{bookmark}{bookmark} -\setinterfacevariable{both}{both} -\setinterfacevariable{bottom}{bottom} -\setinterfacevariable{brief}{brief} -\setinterfacevariable{broad}{broad} -\setinterfacevariable{buffer}{buffer} -\setinterfacevariable{by}{by} -\setinterfacevariable{calligraphic}{calligraphic} -\setinterfacevariable{cap}{cap} -\setinterfacevariable{capital}{capital} -\setinterfacevariable{center}{center} -\setinterfacevariable{chapter}{chapter} -\setinterfacevariable{character}{character} -\setinterfacevariable{characters}{characters} -\setinterfacevariable{cite}{cite} -\setinterfacevariable{color}{color} -\setinterfacevariable{column}{column} -\setinterfacevariable{columns}{columns} -\setinterfacevariable{command}{command} -\setinterfacevariable{commands}{commands} -\setinterfacevariable{comment}{comment} -\setinterfacevariable{component}{component} -\setinterfacevariable{concept}{concept} -\setinterfacevariable{content}{content} -\setinterfacevariable{contents}{contents} -\setinterfacevariable{continue}{continue} -\setinterfacevariable{controls}{controls} -\setinterfacevariable{conversion}{conversion} -\setinterfacevariable{current}{current} -\setinterfacevariable{cutspace}{cutspace} -\setinterfacevariable{date}{date} -\setinterfacevariable{day}{day} -\setinterfacevariable{december}{December} -\setinterfacevariable{default}{default} -\setinterfacevariable{depth}{depth} -\setinterfacevariable{description}{description} -\setinterfacevariable{disable}{disable} -\setinterfacevariable{display}{display} -\setinterfacevariable{dot}{dot} -\setinterfacevariable{doublesided}{doublesided} -\setinterfacevariable{down}{down} -\setinterfacevariable{each}{each} -\setinterfacevariable{edge}{edge} -\setinterfacevariable{empty}{empty} -\setinterfacevariable{end}{end} -\setinterfacevariable{endnote}{endnote} -\setinterfacevariable{enumeration}{enumeration} -\setinterfacevariable{environment}{environment} -\setinterfacevariable{even}{even} -\setinterfacevariable{external}{external} -\setinterfacevariable{fact}{fact} -\setinterfacevariable{february}{February} -\setinterfacevariable{figure}{figure} -\setinterfacevariable{figures}{figures} -\setinterfacevariable{file}{file} -\setinterfacevariable{final}{final} -\setinterfacevariable{first}{first} -\setinterfacevariable{firstcolumn}{firstcolumn} -\setinterfacevariable{firstpage}{firstpage} -\setinterfacevariable{firstsubpage}{firstsubpage} -\setinterfacevariable{fit}{fit} -\setinterfacevariable{five}{five} -\setinterfacevariable{fix}{fix} -\setinterfacevariable{fixed}{fixed} -\setinterfacevariable{flexible}{flexible} -\setinterfacevariable{float}{float} -\setinterfacevariable{flushinner}{flushinner} -\setinterfacevariable{flushleft}{flushleft} -\setinterfacevariable{flushouter}{flushouter} -\setinterfacevariable{flushright}{flushright} -\setinterfacevariable{footer}{footer} -\setinterfacevariable{footnote}{footnote} -\setinterfacevariable{force}{force} -\setinterfacevariable{foreground}{foreground} -\setinterfacevariable{formeel}{formeel} -\setinterfacevariable{formula}{formula} -\setinterfacevariable{formulae}{formulae} -\setinterfacevariable{forward}{forward} -\setinterfacevariable{four}{four} -\setinterfacevariable{frame}{frame} -\setinterfacevariable{framedtext}{framedtext} -\setinterfacevariable{friday}{friday} -\setinterfacevariable{frontmatter}{frontmatter} -\setinterfacevariable{frontpart}{frontpart} -\setinterfacevariable{global}{global} -\setinterfacevariable{graphic}{graphic} -\setinterfacevariable{graphics}{graphics} -\setinterfacevariable{gray}{gray} -\setinterfacevariable{greek}{greek} -\setinterfacevariable{grid}{grid} -\setinterfacevariable{halfline}{halfline} -\setinterfacevariable{handwritten}{handwritten} -\setinterfacevariable{hang}{hang} -\setinterfacevariable{hanging}{hanging} -\setinterfacevariable{head}{head} -\setinterfacevariable{header}{header} -\setinterfacevariable{height}{height} -\setinterfacevariable{helptext}{helptext} -\setinterfacevariable{hencefore}{hencefore} -\setinterfacevariable{here}{here} -\setinterfacevariable{hereafter}{hereafter} -\setinterfacevariable{hidden}{hidden} -\setinterfacevariable{hiding}{hiding} -\setinterfacevariable{high}{high} -\setinterfacevariable{horizontal}{horizontal} -\setinterfacevariable{hyphenated}{hyphenated} -\setinterfacevariable{hz}{hz} -\setinterfacevariable{inbetween}{inbetween} -\setinterfacevariable{index}{index} -\setinterfacevariable{indices}{indices} -\setinterfacevariable{informeel}{informeel} -\setinterfacevariable{inherit}{inherit} -\setinterfacevariable{inleft}{inleft} -\setinterfacevariable{inmargin}{inmargin} -\setinterfacevariable{inner}{inner} -\setinterfacevariable{inneredge}{inneredge} -\setinterfacevariable{innermargin}{innermargin} -\setinterfacevariable{inright}{inright} -\setinterfacevariable{interaction}{interaction} -\setinterfacevariable{interactionmenu}{interactionmenu} -\setinterfacevariable{intermezzi}{intermezzi} -\setinterfacevariable{intermezzo}{intermezzo} -\setinterfacevariable{intext}{intext} -\setinterfacevariable{intro}{intro} -\setinterfacevariable{italic}{italic} -\setinterfacevariable{italicbold}{italicbold} -\setinterfacevariable{item}{item} -\setinterfacevariable{itemize}{itemize} -\setinterfacevariable{its}{its} -\setinterfacevariable{january}{January} -\setinterfacevariable{joinedup}{joinedup} -\setinterfacevariable{july}{July} -\setinterfacevariable{june}{June} -\setinterfacevariable{keep}{keep} -\setinterfacevariable{knockout}{knockout} -\setinterfacevariable{label}{label} -\setinterfacevariable{landscape}{landscape} -\setinterfacevariable{last}{last} -\setinterfacevariable{lastcolumn}{lastcolumn} -\setinterfacevariable{lastpage}{lastpage} -\setinterfacevariable{lastpagenumber}{lastpagenumber} -\setinterfacevariable{lastsubpage}{lastsubpage} -\setinterfacevariable{layer}{layer} -\setinterfacevariable{left}{left} -\setinterfacevariable{leftedge}{leftedge} -\setinterfacevariable{lefthanging}{lefthanging} -\setinterfacevariable{leftmargin}{leftmargin} -\setinterfacevariable{leftpage}{leftpage} -\setinterfacevariable{lefttoright}{lefttoright} -\setinterfacevariable{legend}{legend} -\setinterfacevariable{lesshyphenation}{lesshyphenation} -\setinterfacevariable{line}{line} -\setinterfacevariable{linenote}{linenote} -\setinterfacevariable{lines}{lines} -\setinterfacevariable{list}{list} -\setinterfacevariable{local}{local} -\setinterfacevariable{localenvironment}{localenvironment} -\setinterfacevariable{logo}{logo} -\setinterfacevariable{logos}{logos} -\setinterfacevariable{lohi}{lohi} -\setinterfacevariable{loose}{loose} -\setinterfacevariable{low}{low} -\setinterfacevariable{ls}{ls} -\setinterfacevariable{makeup}{makeup} -\setinterfacevariable{mar}{mar} -\setinterfacevariable{march}{March} -\setinterfacevariable{margin}{margin} -\setinterfacevariable{marginedge}{marginedge} -\setinterfacevariable{margintitle}{margintitle} -\setinterfacevariable{marking}{marking} -\setinterfacevariable{mathalignment}{mathalignment} -\setinterfacevariable{mathcases}{mathcases} -\setinterfacevariable{mathmatrix}{mathmatrix} -\setinterfacevariable{max}{max} -\setinterfacevariable{maxdepth}{maxdepth} -\setinterfacevariable{maxheight}{maxheight} -\setinterfacevariable{maxwidth}{maxwidth} -\setinterfacevariable{may}{May} -\setinterfacevariable{mediaeval}{mediaeval} -\setinterfacevariable{medium}{medium} -\setinterfacevariable{middle}{middle} -\setinterfacevariable{min}{min} -\setinterfacevariable{mindepth}{mindepth} -\setinterfacevariable{minheight}{minheight} -\setinterfacevariable{minwidth}{minwidth} -\setinterfacevariable{mirrored}{mirrored} -\setinterfacevariable{monday}{monday} -\setinterfacevariable{mono}{mono} -\setinterfacevariable{month}{month} -\setinterfacevariable{morehyphenation}{morehyphenation} -\setinterfacevariable{name}{name} -\setinterfacevariable{narrow}{narrow} -\setinterfacevariable{negative}{negative} -\setinterfacevariable{never}{never} -\setinterfacevariable{new}{new} -\setinterfacevariable{next}{next} -\setinterfacevariable{nextevenpage}{nextevenpage} -\setinterfacevariable{nextoddpage}{nextoddpage} -\setinterfacevariable{nextpage}{nextpage} -\setinterfacevariable{nextsubpage}{nextsubpage} -\setinterfacevariable{no}{no} -\setinterfacevariable{nocheck}{nocheck} -\setinterfacevariable{nofit}{nofit} -\setinterfacevariable{nogrid}{nogrid} -\setinterfacevariable{nohz}{nohz} -\setinterfacevariable{nomarking}{nomarking} -\setinterfacevariable{none}{none} -\setinterfacevariable{nonumber}{nonumber} -\setinterfacevariable{normal}{normal} -\setinterfacevariable{nospacing}{nospacing} -\setinterfacevariable{not}{not} -\setinterfacevariable{note}{note} -\setinterfacevariable{nothanging}{nothanging} -\setinterfacevariable{nothyphenated}{nothyphenated} -\setinterfacevariable{november}{November} -\setinterfacevariable{nowhere}{nowhere} -\setinterfacevariable{nowhite}{nowhite} -\setinterfacevariable{number}{number} -\setinterfacevariable{numbers}{numbers} -\setinterfacevariable{october}{October} -\setinterfacevariable{odd}{odd} -\setinterfacevariable{off}{off} -\setinterfacevariable{offset}{offset} -\setinterfacevariable{old}{old} -\setinterfacevariable{on}{on} -\setinterfacevariable{one}{one} -\setinterfacevariable{opposite}{opposite} -\setinterfacevariable{outer}{outer} -\setinterfacevariable{outeredge}{outeredge} -\setinterfacevariable{outermargin}{outermargin} -\setinterfacevariable{overbar}{overbar} -\setinterfacevariable{overbars}{overbars} -\setinterfacevariable{overlay}{overlay} -\setinterfacevariable{overprint}{overprint} -\setinterfacevariable{overstrike}{overstrike} -\setinterfacevariable{overstrikes}{overstrikes} -\setinterfacevariable{packed}{packed} -\setinterfacevariable{page}{page} -\setinterfacevariable{pagecomment}{pagecomment} -\setinterfacevariable{pagenumber}{pagenumber} -\setinterfacevariable{paper}{paper} -\setinterfacevariable{paragraph}{paragraph} -\setinterfacevariable{part}{part} -\setinterfacevariable{positive}{positive} -\setinterfacevariable{postponing}{postponing} -\setinterfacevariable{postscript}{postscript} -\setinterfacevariable{preference}{preference} -\setinterfacevariable{preview}{preview} -\setinterfacevariable{previous}{previous} -\setinterfacevariable{previousevenpage}{previousevenpage} -\setinterfacevariable{previousoddpage}{previousoddpage} -\setinterfacevariable{previouspage}{previouspage} -\setinterfacevariable{previoussubpage}{previoussubpage} -\setinterfacevariable{printable}{printable} -\setinterfacevariable{process}{process} -\setinterfacevariable{product}{product} -\setinterfacevariable{program}{program} -\setinterfacevariable{project}{project} -\setinterfacevariable{protected}{protected} -\setinterfacevariable{quadruple}{quadruple} -\setinterfacevariable{quotation}{quotation} -\setinterfacevariable{quote}{quote} -\setinterfacevariable{ran}{ran} -\setinterfacevariable{random}{random} -\setinterfacevariable{readonly}{readonly} -\setinterfacevariable{rectangular}{rectangular} -\setinterfacevariable{referral}{referral} -\setinterfacevariable{register}{register} -\setinterfacevariable{regular}{regular} -\setinterfacevariable{rekening}{rekening} -\setinterfacevariable{relative}{relative} -\setinterfacevariable{repeat}{repeat} -\setinterfacevariable{required}{required} -\setinterfacevariable{reset}{reset} -\setinterfacevariable{reverse}{reverse} -\setinterfacevariable{right}{right} -\setinterfacevariable{rightedge}{rightedge} -\setinterfacevariable{righthanging}{righthanging} -\setinterfacevariable{rightmargin}{rightmargin} -\setinterfacevariable{rightpage}{rightpage} -\setinterfacevariable{righttoleft}{righttoleft} -\setinterfacevariable{roman}{roman} -\setinterfacevariable{romannumerals}{romannumerals} -\setinterfacevariable{rotate}{rotate} -\setinterfacevariable{rotated}{rotated} -\setinterfacevariable{round}{round} -\setinterfacevariable{row}{row} -\setinterfacevariable{rule}{rule} -\setinterfacevariable{samepage}{samepage} -\setinterfacevariable{sans}{sans} -\setinterfacevariable{sansbold}{sansbold} -\setinterfacevariable{sansserif}{sansserif} -\setinterfacevariable{saturday}{saturday} -\setinterfacevariable{screen}{screen} -\setinterfacevariable{section}{section} -\setinterfacevariable{sectionblockenvironment}{sectionblockenvironment} -\setinterfacevariable{sectionnumber}{sectionnumber} -\setinterfacevariable{see}{see} -\setinterfacevariable{september}{September} -\setinterfacevariable{serif}{serif} -\setinterfacevariable{serried}{serried} -\setinterfacevariable{setups}{setups} -\setinterfacevariable{sheet}{sheet} -\setinterfacevariable{short}{short} -\setinterfacevariable{singlesided}{singlesided} -\setinterfacevariable{slanted}{slanted} -\setinterfacevariable{slantedbold}{slantedbold} -\setinterfacevariable{small}{small} -\setinterfacevariable{smallbodyfont}{smallbodyfont} -\setinterfacevariable{smallbold}{smallbold} -\setinterfacevariable{smallbolditalic}{smallbolditalic} -\setinterfacevariable{smallboldslanted}{smallboldslanted} -\setinterfacevariable{smallcaps}{smallcaps} -\setinterfacevariable{smallitalic}{smallitalic} -\setinterfacevariable{smallitalicbold}{smallitalicbold} -\setinterfacevariable{smallnormal}{smallnormal} -\setinterfacevariable{smallslanted}{smallslanted} -\setinterfacevariable{smallslantedbold}{smallslantedbold} -\setinterfacevariable{smalltype}{smalltype} -\setinterfacevariable{somewhere}{somewhere} -\setinterfacevariable{sorted}{sorted} -\setinterfacevariable{space}{space} -\setinterfacevariable{spacing}{spacing} -\setinterfacevariable{speech}{speech} -\setinterfacevariable{split}{split} -\setinterfacevariable{spot}{spot} -\setinterfacevariable{standard}{standard} -\setinterfacevariable{start}{start} -\setinterfacevariable{starter}{starter} -\setinterfacevariable{sticker}{sticker} -\setinterfacevariable{stop}{stop} -\setinterfacevariable{stopper}{stopper} -\setinterfacevariable{stretch}{stretch} -\setinterfacevariable{strict}{strict} -\setinterfacevariable{strong}{strong} -\setinterfacevariable{strut}{strut} -\setinterfacevariable{sub}{sub} -\setinterfacevariable{subbackward}{subbackward} -\setinterfacevariable{subformula}{subformula} -\setinterfacevariable{subforward}{subforward} -\setinterfacevariable{subject}{subject} -\setinterfacevariable{subpage}{subpage} -\setinterfacevariable{subsection}{subsection} -\setinterfacevariable{subsubject}{subsubject} -\setinterfacevariable{subsubsection}{subsubsection} -\setinterfacevariable{subsubsubject}{subsubsubject} -\setinterfacevariable{subsubsubsection}{subsubsubsection} -\setinterfacevariable{subsubsubsubject}{subsubsubsubject} -\setinterfacevariable{subsubsubsubsection}{subsubsubsubsection} -\setinterfacevariable{subsubsubsubsubject}{subsubsubsubsubject} -\setinterfacevariable{subsubsubsubsubsection}{subsubsubsubsubsection} -\setinterfacevariable{subsubsubsubsubsubject}{subsubsubsubsubsubject} -\setinterfacevariable{subsubsubsubsubsubsection}{subsubsubsubsubsubsection} -\setinterfacevariable{subsubsubsubsubsubsubject}{subsubsubsubsubsubsubject} -\setinterfacevariable{subsubsubsubsubsubsubsection}{subsubsubsubsubsubsubsection} -\setinterfacevariable{subsubsubsubsubsubsubsubject}{subsubsubsubsubsubsubsubject} -\setinterfacevariable{subsubsubsubsubsubsubsubsection}{subsubsubsubsubsubsubsubsection} -\setinterfacevariable{subsubsubsubsubsubsubsubsubject}{subsubsubsubsubsubsubsubsubject} -\setinterfacevariable{subsubsubsubsubsubsubsubsubsection}{subsubsubsubsubsubsubsubsubsection} -\setinterfacevariable{subsubsubsubsubsubsubsubsubsubject}{subsubsubsubsubsubsubsubsubsubject} -\setinterfacevariable{sunday}{sunday} -\setinterfacevariable{support}{support} -\setinterfacevariable{sym}{sym} -\setinterfacevariable{symbol}{symbol} -\setinterfacevariable{synchronize}{synchronize} -\setinterfacevariable{system}{system} -\setinterfacevariable{table}{table} -\setinterfacevariable{tablehead}{tablehead} -\setinterfacevariable{tables}{tables} -\setinterfacevariable{tabletail}{tabletail} -\setinterfacevariable{tabulate}{tabulate} -\setinterfacevariable{tabulatehead}{tabulatehead} -\setinterfacevariable{tabulatetail}{tabulatetail} -\setinterfacevariable{tall}{tall} -\setinterfacevariable{teletype}{teletype} -\setinterfacevariable{temporary}{temporary} -\setinterfacevariable{test}{test} -\setinterfacevariable{text}{text} -\setinterfacevariable{three}{three} -\setinterfacevariable{thursday}{thursday} -\setinterfacevariable{title}{title} -\setinterfacevariable{toggle}{wissel} -\setinterfacevariable{tolerant}{tolerant} -\setinterfacevariable{top}{top} -\setinterfacevariable{tuesday}{tuesday} -\setinterfacevariable{two}{two} -\setinterfacevariable{txt}{txt} -\setinterfacevariable{type}{type} -\setinterfacevariable{typing}{typing} -\setinterfacevariable{unavailable}{unavailable} -\setinterfacevariable{underbar}{underbar} -\setinterfacevariable{underbars}{underbars} -\setinterfacevariable{unit}{unit} -\setinterfacevariable{units}{units} -\setinterfacevariable{unknown}{unknown} -\setinterfacevariable{unpacked}{unpacked} -\setinterfacevariable{up}{up} -\setinterfacevariable{url}{url} -\setinterfacevariable{used}{used} -\setinterfacevariable{value}{value} -\setinterfacevariable{vertical}{vertical} -\setinterfacevariable{very}{very} -\setinterfacevariable{verystrict}{verystrict} -\setinterfacevariable{verytolerant}{verytolerant} -\setinterfacevariable{weak}{weak} -\setinterfacevariable{wednesday}{wednesday} -\setinterfacevariable{week}{week} -\setinterfacevariable{weekday}{weekday} -\setinterfacevariable{white}{white} -\setinterfacevariable{wide}{wide} -\setinterfacevariable{width}{width} -\setinterfacevariable{xml}{xml} -\setinterfacevariable{year}{year} -\setinterfacevariable{yes}{yes} -% definitions for interface constants for language en -% -\setinterfaceconstant{action}{action} -\setinterfaceconstant{address}{address} -\setinterfaceconstant{after}{after} -\setinterfaceconstant{afterhead}{afterhead} -\setinterfaceconstant{afterkey}{afterkey} -\setinterfaceconstant{align}{align} -\setinterfaceconstant{aligncharacter}{aligncharacter} -\setinterfaceconstant{alignmentcharacter}{alignmentcharacter} -\setinterfaceconstant{alignsymbol}{alignsymbol} -\setinterfaceconstant{aligntitle}{aligntitle} -\setinterfaceconstant{alternative}{alternative} -\setinterfaceconstant{andtext}{andtext} -\setinterfaceconstant{apa}{apa} -\setinterfaceconstant{arrow}{arrow} -\setinterfaceconstant{artauthor}{artauthor} -\setinterfaceconstant{artauthoretaldisplay}{artauthoretaldisplay} -\setinterfaceconstant{artauthoretallimit}{artauthoretallimit} -\setinterfaceconstant{artauthoretaltext}{artauthoretaltext} -\setinterfaceconstant{at}{at} -\setinterfaceconstant{author}{author} -\setinterfaceconstant{authoretaldisplay}{authoretaldisplay} -\setinterfaceconstant{authoretallimit}{authoretallimit} -\setinterfaceconstant{authoretaltext}{authoretaltext} -\setinterfaceconstant{auto}{auto} -\setinterfaceconstant{autofile}{autofile} -\setinterfaceconstant{autofocus}{autofocus} -\setinterfaceconstant{autohang}{autohang} -\setinterfaceconstant{autostrut}{autostrut} -\setinterfaceconstant{autowidth}{autowidth} -\setinterfaceconstant{axis}{axis} -\setinterfaceconstant{background}{background} -\setinterfaceconstant{backgroundcolor}{backgroundcolor} -\setinterfaceconstant{backgroundcorner}{backgroundcorner} -\setinterfaceconstant{backgrounddepth}{backgrounddepth} -\setinterfaceconstant{backgroundoffset}{backgroundoffset} -\setinterfaceconstant{backgroundradius}{backgroundradius} -\setinterfaceconstant{backgroundscreen}{backgroundscreen} -\setinterfaceconstant{backspace}{backspace} -\setinterfaceconstant{balance}{balance} -\setinterfaceconstant{before}{before} -\setinterfaceconstant{beforehead}{beforehead} -\setinterfaceconstant{bet}{bet} -\setinterfaceconstant{big}{big} -\setinterfaceconstant{blank}{blank} -\setinterfaceconstant{blockway}{blockway} -\setinterfaceconstant{bodyfont}{bodyfont} -\setinterfaceconstant{bookmark}{bookmark} -\setinterfaceconstant{bottom}{bottom} -\setinterfaceconstant{bottomafter}{bottomafter} -\setinterfaceconstant{bottombefore}{bottombefore} -\setinterfaceconstant{bottomdistance}{bottomdistance} -\setinterfaceconstant{bottomframe}{bottomframe} -\setinterfaceconstant{bottomoffset}{bottomoffset} -\setinterfaceconstant{bottomspace}{bottomspace} -\setinterfaceconstant{bottomstate}{bottomstate} -\setinterfaceconstant{cache}{cache} -\setinterfaceconstant{calculate}{calculate} -\setinterfaceconstant{ccommand}{ccommand} -\setinterfaceconstant{click}{click} -\setinterfaceconstant{clickin}{clickin} -\setinterfaceconstant{clickout}{clickout} -\setinterfaceconstant{clipoffset}{clipoffset} -\setinterfaceconstant{closeaction}{closeaction} -\setinterfaceconstant{closecommand}{closecommand} -\setinterfaceconstant{closepageaction}{closepageaction} -\setinterfaceconstant{closesymbol}{closesymbol} -\setinterfaceconstant{color}{color} -\setinterfaceconstant{column}{column} -\setinterfaceconstant{columndistance}{columndistance} -\setinterfaceconstant{columns}{columns} -\setinterfaceconstant{command}{command} -\setinterfaceconstant{commandafter}{commandafter} -\setinterfaceconstant{commandbefore}{commandbefore} -\setinterfaceconstant{commands}{commands} -\setinterfaceconstant{component}{component} -\setinterfaceconstant{compoundhyphen}{compoundhyphen} -\setinterfaceconstant{compress}{compress} -\setinterfaceconstant{connector}{connector} -\setinterfaceconstant{continue}{continue} -\setinterfaceconstant{contrastcolor}{contrastcolor} -\setinterfaceconstant{controls}{controls} -\setinterfaceconstant{conversion}{conversion} -\setinterfaceconstant{convertfile}{convertfile} -\setinterfaceconstant{corner}{corner} -\setinterfaceconstant{coupling}{coupling} -\setinterfaceconstant{couplingway}{couplingway} -\setinterfaceconstant{criterium}{criterium} -\setinterfaceconstant{current}{current} -\setinterfaceconstant{cutspace}{cutspace} -\setinterfaceconstant{dash}{dash} -\setinterfaceconstant{dat}{dat} -\setinterfaceconstant{database}{database} -\setinterfaceconstant{date}{date} -\setinterfaceconstant{deepnumbercommand}{deepnumbercommand} -\setinterfaceconstant{deeptextcommand}{deeptextcommand} -\setinterfaceconstant{default}{default} -\setinterfaceconstant{delay}{delay} -\setinterfaceconstant{depth}{depth} -\setinterfaceconstant{depthcorrection}{depthcorrection} -\setinterfaceconstant{direction}{direction} -\setinterfaceconstant{directory}{directory} -\setinterfaceconstant{display}{display} -\setinterfaceconstant{distance}{distance} -\setinterfaceconstant{dot}{dot} -\setinterfaceconstant{doublesided}{doublesided} -\setinterfaceconstant{dummy}{dummy} -\setinterfaceconstant{dx}{dx} -\setinterfaceconstant{dy}{dy} -\setinterfaceconstant{edge}{edge} -\setinterfaceconstant{edgedistance}{edgedistance} -\setinterfaceconstant{editor}{editor} -\setinterfaceconstant{editoretaldisplay}{editoretaldisplay} -\setinterfaceconstant{editoretallimit}{editoretallimit} -\setinterfaceconstant{editoretaltext}{editoretaltext} -\setinterfaceconstant{empty}{empty} -\setinterfaceconstant{equalheight}{equalheight} -\setinterfaceconstant{equalwidth}{equalwidth} -\setinterfaceconstant{escape}{escape} -\setinterfaceconstant{evenmargin}{evenmargin} -\setinterfaceconstant{expansion}{expansion} -\setinterfaceconstant{export}{export} -\setinterfaceconstant{extras}{extras} -\setinterfaceconstant{factor}{factor} -\setinterfaceconstant{fallback}{fallback} -\setinterfaceconstant{family}{family} -\setinterfaceconstant{fieldbackgroundcolor}{fieldbackgroundcolor} -\setinterfaceconstant{fieldframecolor}{fieldframecolor} -\setinterfaceconstant{fieldlayer}{fieldlayer} -\setinterfaceconstant{fieldoffset}{fieldoffset} -\setinterfaceconstant{file}{file} -\setinterfaceconstant{filtercommand}{filtercommand} -\setinterfaceconstant{finalnamesep}{finalnamesep} -\setinterfaceconstant{firstnamesep}{firstnamesep} -\setinterfaceconstant{focus}{focus} -\setinterfaceconstant{focusin}{focusin} -\setinterfaceconstant{focusout}{focusout} -\setinterfaceconstant{footer}{footer} -\setinterfaceconstant{footerdistance}{footerdistance} -\setinterfaceconstant{footerstate}{footerstate} -\setinterfaceconstant{foregroundcolor}{foregroundcolor} -\setinterfaceconstant{foregroundstyle}{foregroundstyle} -\setinterfaceconstant{format}{format} -\setinterfaceconstant{frame}{frame} -\setinterfaceconstant{framecolor}{framecolor} -\setinterfaceconstant{framecorner}{framecorner} -\setinterfaceconstant{framedepth}{framedepth} -\setinterfaceconstant{frameoffset}{frameoffset} -\setinterfaceconstant{frameradius}{frameradius} -\setinterfaceconstant{frames}{frames} -\setinterfaceconstant{from}{from} -\setinterfaceconstant{get}{get} -\setinterfaceconstant{global}{global} -\setinterfaceconstant{grid}{grid} -\setinterfaceconstant{hang}{hang} -\setinterfaceconstant{headalign}{headalign} -\setinterfaceconstant{headcolor}{headcolor} -\setinterfaceconstant{headcommand}{headcommand} -\setinterfaceconstant{headconversion}{headconversion} -\setinterfaceconstant{header}{header} -\setinterfaceconstant{headerdistance}{headerdistance} -\setinterfaceconstant{headerstate}{headerstate} -\setinterfaceconstant{headlabel}{headlabel} -\setinterfaceconstant{headnumber}{headnumber} -\setinterfaceconstant{headstyle}{headstyle} -\setinterfaceconstant{height}{height} -\setinterfaceconstant{hfactor}{hfactor} -\setinterfaceconstant{hfil}{hfil} -\setinterfaceconstant{hidenumber}{hidenumber} -\setinterfaceconstant{hoffset}{hoffset} -\setinterfaceconstant{horoffset}{horoffset} -\setinterfaceconstant{hyphen}{hyphen} -\setinterfaceconstant{icommand}{icommand} -\setinterfaceconstant{in}{in} -\setinterfaceconstant{inbetween}{inbetween} -\setinterfaceconstant{increment}{increment} -\setinterfaceconstant{incrementnumber}{incrementnumber} -\setinterfaceconstant{indenting}{indenting} -\setinterfaceconstant{indentnext}{indentnext} -\setinterfaceconstant{indicator}{indicator} -\setinterfaceconstant{inner}{inner} -\setinterfaceconstant{innermargin}{innermargin} -\setinterfaceconstant{inputfile}{inputfile} -\setinterfaceconstant{intent}{intent} -\setinterfaceconstant{interaction}{interaction} -\setinterfaceconstant{interlinespace}{interlinespace} -\setinterfaceconstant{itemalign}{itemalign} -\setinterfaceconstant{items}{items} -\setinterfaceconstant{juniorsep}{juniorsep} -\setinterfaceconstant{ken}{ken} -\setinterfaceconstant{keyexpansion}{keyexpansion} -\setinterfaceconstant{keyword}{keyword} -\setinterfaceconstant{label}{label} -\setinterfaceconstant{lastnamesep}{lastnamesep} -\setinterfaceconstant{lastpubsep}{lastpubsep} -\setinterfaceconstant{left}{left} -\setinterfaceconstant{leftcolor}{leftcolor} -\setinterfaceconstant{leftcompoundhyphen}{leftcompoundhyphen} -\setinterfaceconstant{leftedge}{leftedge} -\setinterfaceconstant{leftedgedistance}{leftedgedistance} -\setinterfaceconstant{leftframe}{leftframe} -\setinterfaceconstant{lefthyphen}{lefthyphen} -\setinterfaceconstant{leftmargin}{leftmargin} -\setinterfaceconstant{leftmargindistance}{leftmargindistance} -\setinterfaceconstant{leftoffset}{leftoffset} -\setinterfaceconstant{leftquotation}{leftquotation} -\setinterfaceconstant{leftquote}{leftquote} -\setinterfaceconstant{leftsentence}{leftsentence} -\setinterfaceconstant{leftspeech}{leftspeech} -\setinterfaceconstant{leftstyle}{leftstyle} -\setinterfaceconstant{leftsubsentence}{leftsubsentence} -\setinterfaceconstant{lefttext}{lefttext} -\setinterfaceconstant{leftwidth}{leftwidth} -\setinterfaceconstant{level}{level} -\setinterfaceconstant{levels}{levels} -\setinterfaceconstant{limittext}{limittext} -\setinterfaceconstant{line}{line} -\setinterfaceconstant{linecorrection}{linecorrection} -\setinterfaceconstant{lines}{lines} -\setinterfaceconstant{list}{list} -\setinterfaceconstant{listtext}{listtext} -\setinterfaceconstant{local}{local} -\setinterfaceconstant{location}{location} -\setinterfaceconstant{logo}{logo} -\setinterfaceconstant{logos}{logos} -\setinterfaceconstant{marcolor}{marcolor} -\setinterfaceconstant{margin}{margin} -\setinterfaceconstant{margindistance}{margindistance} -\setinterfaceconstant{marginedge}{marginedge} -\setinterfaceconstant{marginedgetext}{marginedgetext} -\setinterfaceconstant{margintext}{margintext} -\setinterfaceconstant{marking}{marking} -\setinterfaceconstant{marstyle}{marstyle} -\setinterfaceconstant{max}{max} -\setinterfaceconstant{maxdepth}{maxdepth} -\setinterfaceconstant{maxheight}{maxheight} -\setinterfaceconstant{maxwidth}{maxwidth} -\setinterfaceconstant{maybeyear}{maybeyear} -\setinterfaceconstant{menu}{menu} -\setinterfaceconstant{method}{method} -\setinterfaceconstant{middle}{middle} -\setinterfaceconstant{middlespeech}{middlespeech} -\setinterfaceconstant{middletext}{middletext} -\setinterfaceconstant{midsentence}{midsentence} -\setinterfaceconstant{min}{min} -\setinterfaceconstant{mindepth}{mindepth} -\setinterfaceconstant{minheight}{minheight} -\setinterfaceconstant{minwidth}{minwidth} -\setinterfaceconstant{monthconversion}{monthconversion} -\setinterfaceconstant{n}{n} -\setinterfaceconstant{name}{name} -\setinterfaceconstant{namesep}{namesep} -\setinterfaceconstant{nbottom}{nbottom} -\setinterfaceconstant{nc}{nc} -\setinterfaceconstant{next}{next} -\setinterfaceconstant{nl}{nl} -\setinterfaceconstant{nleft}{nleft} -\setinterfaceconstant{nlines}{nlines} -\setinterfaceconstant{norm}{norm} -\setinterfaceconstant{nr}{nr} -\setinterfaceconstant{nright}{nright} -\setinterfaceconstant{ntop}{ntop} -\setinterfaceconstant{number}{number} -\setinterfaceconstant{numbercolor}{numbercolor} -\setinterfaceconstant{numbercommand}{numbercommand} -\setinterfaceconstant{numberconversion}{numberconversion} -\setinterfaceconstant{numberconversionset}{numberconversionset} -\setinterfaceconstant{numberdistance}{numberdistance} -\setinterfaceconstant{numbering}{numbering} -\setinterfaceconstant{numberorder}{numberorder} -\setinterfaceconstant{numberprefix}{numberprefix} -\setinterfaceconstant{numbersegments}{numbersegments} -\setinterfaceconstant{numberseparator}{numberseparator} -\setinterfaceconstant{numberseparatorset}{numberseparatorset} -\setinterfaceconstant{numberset}{numberset} -\setinterfaceconstant{numberstarter}{numberstarter} -\setinterfaceconstant{numberstopper}{numberstopper} -\setinterfaceconstant{numberstyle}{numberstyle} -\setinterfaceconstant{numberwidth}{numberwidth} -\setinterfaceconstant{nx}{nx} -\setinterfaceconstant{ny}{ny} -\setinterfaceconstant{object}{object} -\setinterfaceconstant{obstruction}{obstruction} -\setinterfaceconstant{oddmargin}{oddmargin} -\setinterfaceconstant{offset}{offset} -\setinterfaceconstant{openaction}{openaction} -\setinterfaceconstant{openpageaction}{openpageaction} -\setinterfaceconstant{option}{option} -\setinterfaceconstant{order}{order} -\setinterfaceconstant{orientation}{orientation} -\setinterfaceconstant{otherstext}{otherstext} -\setinterfaceconstant{outermargin}{outermargin} -\setinterfaceconstant{overprint}{overprint} -\setinterfaceconstant{ownnumber}{ownnumber} -\setinterfaceconstant{page}{page} -\setinterfaceconstant{pageboundaries}{pageboundaries} -\setinterfaceconstant{pagecolor}{pagecolor} -\setinterfaceconstant{pagecommand}{pagecommand} -\setinterfaceconstant{pageconversion}{pageconversion} -\setinterfaceconstant{pageconversionset}{pageconversionset} -\setinterfaceconstant{pagenumber}{pagenumber} -\setinterfaceconstant{pageprefix}{pageprefix} -\setinterfaceconstant{pageprefixconnector}{pageprefixconnector} -\setinterfaceconstant{pageprefixconversion}{pageprefixconversion} -\setinterfaceconstant{pageprefixconversionset}{pageprefixconversionset} -\setinterfaceconstant{pageprefixsegments}{pageprefixsegments} -\setinterfaceconstant{pageprefixseparatorset}{pageprefixseparatorset} -\setinterfaceconstant{pageprefixset}{pageprefixset} -\setinterfaceconstant{pageprefixstarter}{pageprefixstarter} -\setinterfaceconstant{pageprefixstopper}{pageprefixstopper} -\setinterfaceconstant{pagesegments}{pagesegments} -\setinterfaceconstant{pageseparatorset}{pageseparatorset} -\setinterfaceconstant{pageset}{pageset} -\setinterfaceconstant{pagestarter}{pagestarter} -\setinterfaceconstant{pagestate}{pagestate} -\setinterfaceconstant{pagestopper}{pagestopper} -\setinterfaceconstant{pagestyle}{pagestyle} -\setinterfaceconstant{palet}{palet} -\setinterfaceconstant{paper}{paper} -\setinterfaceconstant{paragraph}{paragraph} -\setinterfaceconstant{place}{place} -\setinterfaceconstant{placehead}{placehead} -\setinterfaceconstant{placestopper}{placestopper} -\setinterfaceconstant{position}{position} -\setinterfaceconstant{prefix}{prefix} -\setinterfaceconstant{prefixconnector}{prefixconnector} -\setinterfaceconstant{prefixconversion}{prefixconversion} -\setinterfaceconstant{prefixconversionset}{prefixconversionset} -\setinterfaceconstant{prefixsegments}{prefixsegments} -\setinterfaceconstant{prefixseparatorset}{prefixseparatorset} -\setinterfaceconstant{prefixset}{prefixset} -\setinterfaceconstant{prefixstarter}{prefixstarter} -\setinterfaceconstant{prefixstopper}{prefixstopper} -\setinterfaceconstant{preset}{preset} -\setinterfaceconstant{preview}{preview} -\setinterfaceconstant{previous}{previous} -\setinterfaceconstant{previousnumber}{previousnumber} -\setinterfaceconstant{process}{process} -\setinterfaceconstant{pubsep}{pubsep} -\setinterfaceconstant{radius}{radius} -\setinterfaceconstant{random}{random} -\setinterfaceconstant{range}{range} -\setinterfaceconstant{reduction}{reduction} -\setinterfaceconstant{ref}{ref} -\setinterfaceconstant{refcommand}{refcommand} -\setinterfaceconstant{reference}{reference} -\setinterfaceconstant{referenceprefix}{referenceprefix} -\setinterfaceconstant{referencing}{referencing} -\setinterfaceconstant{regionin}{regionin} -\setinterfaceconstant{regionout}{regionout} -\setinterfaceconstant{repeat}{repeat} -\setinterfaceconstant{reset}{reset} -\setinterfaceconstant{resetnumber}{resetnumber} -\setinterfaceconstant{resolution}{resolution} -\setinterfaceconstant{right}{right} -\setinterfaceconstant{rightcolor}{rightcolor} -\setinterfaceconstant{rightcompoundhyphen}{rightcompoundhyphen} -\setinterfaceconstant{rightedge}{rightedge} -\setinterfaceconstant{rightedgedistance}{rightedgedistance} -\setinterfaceconstant{rightframe}{rightframe} -\setinterfaceconstant{righthyphen}{righthyphen} -\setinterfaceconstant{rightmargin}{rightmargin} -\setinterfaceconstant{rightmargindistance}{rightmargindistance} -\setinterfaceconstant{rightoffset}{rightoffset} -\setinterfaceconstant{rightquotation}{rightquotation} -\setinterfaceconstant{rightquote}{rightquote} -\setinterfaceconstant{rightsentence}{rightsentence} -\setinterfaceconstant{rightspeech}{rightspeech} -\setinterfaceconstant{rightstyle}{rightstyle} -\setinterfaceconstant{rightsubsentence}{rightsubsentence} -\setinterfaceconstant{righttext}{righttext} -\setinterfaceconstant{rightwidth}{rightwidth} -\setinterfaceconstant{rotation}{rotation} -\setinterfaceconstant{rule}{rule} -\setinterfaceconstant{rulecolor}{rulecolor} -\setinterfaceconstant{rulethickness}{rulethickness} -\setinterfaceconstant{samepage}{samepage} -\setinterfaceconstant{sample}{sample} -\setinterfaceconstant{samplesize}{samplesize} -\setinterfaceconstant{saveinlist}{saveinlist} -\setinterfaceconstant{scale}{scale} -\setinterfaceconstant{scope}{scope} -\setinterfaceconstant{screen}{screen} -\setinterfaceconstant{section}{section} -\setinterfaceconstant{sectionconversion}{sectionconversion} -\setinterfaceconstant{sectionconversionset}{sectionconversionset} -\setinterfaceconstant{sectionnumber}{sectionnumber} -\setinterfaceconstant{sectionresetset}{sectionresetset} -\setinterfaceconstant{sectionsegments}{sectionsegments} -\setinterfaceconstant{sectionseparatorset}{sectionseparatorset} -\setinterfaceconstant{sectionset}{sectionset} -\setinterfaceconstant{sectionstarter}{sectionstarter} -\setinterfaceconstant{sectionstopper}{sectionstopper} -\setinterfaceconstant{separator}{separator} -\setinterfaceconstant{set}{set} -\setinterfaceconstant{setups}{setups} -\setinterfaceconstant{side}{side} -\setinterfaceconstant{sidealign}{sidealign} -\setinterfaceconstant{sidemethod}{sidemethod} -\setinterfaceconstant{sidespaceafter}{sidespaceafter} -\setinterfaceconstant{sidespacebefore}{sidespacebefore} -\setinterfaceconstant{sign}{sign} -\setinterfaceconstant{size}{size} -\setinterfaceconstant{small}{small} -\setinterfaceconstant{sort}{sort} -\setinterfaceconstant{sorttype}{sorttype} -\setinterfaceconstant{source}{source} -\setinterfaceconstant{space}{space} -\setinterfaceconstant{spaceafter}{spaceafter} -\setinterfaceconstant{spacebefore}{spacebefore} -\setinterfaceconstant{spaceinbetween}{spaceinbetween} -\setinterfaceconstant{spacing}{spacing} -\setinterfaceconstant{split}{split} -\setinterfaceconstant{splitcolor}{splitcolor} -\setinterfaceconstant{splitmethod}{splitmethod} -\setinterfaceconstant{splitoffset}{splitoffset} -\setinterfaceconstant{spot}{spot} -\setinterfaceconstant{stack}{stack} -\setinterfaceconstant{start}{start} -\setinterfaceconstant{starter}{starter} -\setinterfaceconstant{state}{state} -\setinterfaceconstant{step}{step} -\setinterfaceconstant{stop}{stop} -\setinterfaceconstant{stopper}{stopper} -\setinterfaceconstant{stretch}{stretch} -\setinterfaceconstant{strip}{strip} -\setinterfaceconstant{strut}{strut} -\setinterfaceconstant{style}{style} -\setinterfaceconstant{sub}{sub} -\setinterfaceconstant{subtitle}{subtitle} -\setinterfaceconstant{suffix}{suffix} -\setinterfaceconstant{surnamesep}{surnamesep} -\setinterfaceconstant{sx}{sx} -\setinterfaceconstant{sy}{sy} -\setinterfaceconstant{symalign}{symalign} -\setinterfaceconstant{symbol}{symbol} -\setinterfaceconstant{symbolset}{symbolset} -\setinterfaceconstant{symcolor}{symcolor} -\setinterfaceconstant{symstyle}{symstyle} -\setinterfaceconstant{synonym}{synonym} -\setinterfaceconstant{synonymcolor}{synonymcolor} -\setinterfaceconstant{synonymcommand}{synonymcommand} -\setinterfaceconstant{synonymstyle}{synonymstyle} -\setinterfaceconstant{tab}{tab} -\setinterfaceconstant{text}{text} -\setinterfaceconstant{textcolor}{textcolor} -\setinterfaceconstant{textcommand}{textcommand} -\setinterfaceconstant{textdistance}{textdistance} -\setinterfaceconstant{textlayer}{textlayer} -\setinterfaceconstant{textmargin}{textmargin} -\setinterfaceconstant{textmethod}{textmethod} -\setinterfaceconstant{textseparator}{textseparator} -\setinterfaceconstant{textsize}{textsize} -\setinterfaceconstant{textstate}{textstate} -\setinterfaceconstant{textstyle}{textstyle} -\setinterfaceconstant{textwidth}{textwidth} -\setinterfaceconstant{title}{title} -\setinterfaceconstant{titlecolor}{titlecolor} -\setinterfaceconstant{titlecommand}{titlecommand} -\setinterfaceconstant{titledistance}{titledistance} -\setinterfaceconstant{titleleft}{titleleft} -\setinterfaceconstant{titleright}{titleright} -\setinterfaceconstant{titlestyle}{titlestyle} -\setinterfaceconstant{to}{to} -\setinterfaceconstant{tolerance}{tolerance} -\setinterfaceconstant{top}{top} -\setinterfaceconstant{topdistance}{topdistance} -\setinterfaceconstant{topframe}{topframe} -\setinterfaceconstant{topoffset}{topoffset} -\setinterfaceconstant{topspace}{topspace} -\setinterfaceconstant{topstate}{topstate} -\setinterfaceconstant{totalnumber}{totalnumber} -\setinterfaceconstant{type}{type} -\setinterfaceconstant{unit}{unit} -\setinterfaceconstant{unknownreference}{unknownreference} -\setinterfaceconstant{urlalternative}{urlalternative} -\setinterfaceconstant{urlspace}{urlspace} -\setinterfaceconstant{validate}{validate} -\setinterfaceconstant{vcommand}{vcommand} -\setinterfaceconstant{veroffset}{veroffset} -\setinterfaceconstant{vfil}{vfil} -\setinterfaceconstant{voffset}{voffset} -\setinterfaceconstant{vonsep}{vonsep} -\setinterfaceconstant{way}{way} -\setinterfaceconstant{wfactor}{wfactor} -\setinterfaceconstant{white}{white} -\setinterfaceconstant{width}{width} -\setinterfaceconstant{xfactor}{xfactor} -\setinterfaceconstant{xmax}{xmax} -\setinterfaceconstant{xoffset}{xoffset} -\setinterfaceconstant{xscale}{xscale} -\setinterfaceconstant{xstep}{xstep} -\setinterfaceconstant{yfactor}{yfactor} -\setinterfaceconstant{ymax}{ymax} -\setinterfaceconstant{yoffset}{yoffset} -\setinterfaceconstant{yscale}{yscale} -\setinterfaceconstant{ystep}{ystep} -% definitions for interface elements for language en -% -\setinterfaceelement{answerlines}{answerlines} -\setinterfaceelement{answerspace}{answerspace} -\setinterfaceelement{begin}{begin} -\setinterfaceelement{complete}{complete} -\setinterfaceelement{coupled}{coupled} -\setinterfaceelement{currentlocal}{currentlocal} -\setinterfaceelement{emptyone}{empty} -\setinterfaceelement{emptytwo}{empty} -\setinterfaceelement{end}{end} -\setinterfaceelement{endsetup}{} -\setinterfaceelement{get}{get} -\setinterfaceelement{increment}{increment} -\setinterfaceelement{list}{list} -\setinterfaceelement{listof}{listof} -\setinterfaceelement{load}{load} -\setinterfaceelement{local}{local} -\setinterfaceelement{makeup}{makeup} -\setinterfaceelement{next}{next} -\setinterfaceelement{place}{place} -\setinterfaceelement{previous}{previous} -\setinterfaceelement{previouslocal}{previouslocal} -\setinterfaceelement{reserve}{reserve} -\setinterfaceelement{see}{see} -\setinterfaceelement{setup}{setup} -\setinterfaceelement{start}{start} -\setinterfaceelement{stop}{stop} -\setinterfaceelement{text}{text} -\setinterfaceelement{type}{type} -% definitions for interface commands for language en -% -\setinterfacecommand{CAPPED}{CAP} -\setinterfacecommand{Character}{Character} -\setinterfacecommand{Characters}{Characters} -\setinterfacecommand{LABELTEXT}{LABELTEXT} -\setinterfacecommand{MONTH}{MONTH} -\setinterfacecommand{Numbers}{Numbers} -\setinterfacecommand{Romannumerals}{Romannumerals} -\setinterfacecommand{SmallCapped}{Cap} -\setinterfacecommand{SmallCaps}{Caps} -\setinterfacecommand{WEEKDAY}{WEEKDAY} -\setinterfacecommand{WORD}{WORD} -\setinterfacecommand{WORDS}{WORDS} -\setinterfacecommand{Word}{Word} -\setinterfacecommand{Words}{Words} -\setinterfacecommand{about}{about} -\setinterfacecommand{adaptlayout}{adaptlayout} -\setinterfacecommand{arg}{arg} -\setinterfacecommand{at}{at} -\setinterfacecommand{atleftmargin}{atleftmargin} -\setinterfacecommand{atpage}{atpage} -\setinterfacecommand{atrightmargin}{atrightmargin} -\setinterfacecommand{background}{background} -\setinterfacecommand{backspace}{backspace} -\setinterfacecommand{blackrule}{blackrule} -\setinterfacecommand{blackrules}{blackrules} -\setinterfacecommand{blank}{blank} -\setinterfacecommand{bookmark}{bookmark} -\setinterfacecommand{bottomdistance}{bottomdistance} -\setinterfacecommand{bottomheight}{bottomheight} -\setinterfacecommand{bottomspace}{bottomspace} -\setinterfacecommand{but}{but} -\setinterfacecommand{button}{button} -\setinterfacecommand{bypassblocks}{bypassblocks} -\setinterfacecommand{character}{character} -\setinterfacecommand{characters}{characters} -\setinterfacecommand{chem}{chem} -\setinterfacecommand{clip}{clip} -\setinterfacecommand{clonefield}{clonefield} -\setinterfacecommand{color}{color} -\setinterfacecommand{colorbar}{colorbar} -\setinterfacecommand{colorvalue}{colorvalue} -\setinterfacecommand{column}{column} -\setinterfacecommand{comment}{comment} -\setinterfacecommand{comparecolorgroup}{comparecolorgroup} -\setinterfacecommand{comparepalet}{comparepalet} -\setinterfacecommand{completepagenumber}{completepagenumber} -\setinterfacecommand{completeregister}{completeregister} -\setinterfacecommand{component}{component} -\setinterfacecommand{convertnumber}{convertnumber} -\setinterfacecommand{copyfield}{copyfield} -\setinterfacecommand{correctwhitespace}{correctwhitespace} -\setinterfacecommand{coupledocument}{coupledocument} -\setinterfacecommand{couplemarking}{couplemarking} -\setinterfacecommand{couplepage}{couplepage} -\setinterfacecommand{couplepaper}{couplepaper} -\setinterfacecommand{coupleregister}{coupleregister} -\setinterfacecommand{crlf}{crlf} -\setinterfacecommand{currentdate}{currentdate} -\setinterfacecommand{currentheadnumber}{currentheadnumber} -\setinterfacecommand{cutspace}{cutspace} -\setinterfacecommand{date}{date} -\setinterfacecommand{decouplemarking}{decouplemarking} -\setinterfacecommand{decrementnumber}{decrementnumber} -\setinterfacecommand{define}{define} -\setinterfacecommand{defineaccent}{defineaccent} -\setinterfacecommand{defineblank}{defineblank} -\setinterfacecommand{defineblock}{defineblock} -\setinterfacecommand{definebodyfont}{definebodyfont} -\setinterfacecommand{definebodyfontenvironment}{definebodyfontenvironment} -\setinterfacecommand{definebuffer}{definebuffer} -\setinterfacecommand{definecharacter}{definecharacter} -\setinterfacecommand{definecolor}{definecolor} -\setinterfacecommand{definecolorgroup}{definecolorgroup} -\setinterfacecommand{definecolumnbreak}{definecolumnbreak} -\setinterfacecommand{definecolumnset}{definecolumnset} -\setinterfacecommand{definecombination}{definecombination} -\setinterfacecommand{definecombinedlist}{definecombinedlist} -\setinterfacecommand{definecommand}{definecommand} -\setinterfacecommand{defineconversion}{defineconversion} -\setinterfacecommand{definedescription}{definedescription} -\setinterfacecommand{defineenumeration}{defineenumeration} -\setinterfacecommand{definefield}{definefield} -\setinterfacecommand{definefieldstack}{definefieldstack} -\setinterfacecommand{definefiguresymbol}{definefiguresymbol} -\setinterfacecommand{definefloat}{definefloat} -\setinterfacecommand{definefont}{definefont} -\setinterfacecommand{definefontstyle}{definefontstyle} -\setinterfacecommand{definefontsynonym}{definefontsynonym} -\setinterfacecommand{defineframed}{defineframed} -\setinterfacecommand{defineframedtext}{defineframedtext} -\setinterfacecommand{definehbox}{definehbox} -\setinterfacecommand{definehead}{definehead} -\setinterfacecommand{defineindenting}{defineindenting} -\setinterfacecommand{defineinmargin}{defineinmargin} -\setinterfacecommand{defineinteractionmenu}{defineinteractionmenu} -\setinterfacecommand{defineitemgroup}{defineitemgroup} -\setinterfacecommand{definelabel}{definelabel} -\setinterfacecommand{definelayer}{definelayer} -\setinterfacecommand{definelayout}{definelayout} -\setinterfacecommand{definelist}{definelist} -\setinterfacecommand{definelogo}{definelogo} -\setinterfacecommand{definemainfield}{definemainfield} -\setinterfacecommand{definemakeup}{definemakeup} -\setinterfacecommand{definemarking}{definemarking} -\setinterfacecommand{definemathalignment}{definemathalignment} -\setinterfacecommand{defineoutput}{defineoutput} -\setinterfacecommand{defineoverlay}{defineoverlay} -\setinterfacecommand{definepagebreak}{definepagebreak} -\setinterfacecommand{definepalet}{definepalet} -\setinterfacecommand{definepapersize}{definepapersize} -\setinterfacecommand{defineparagraphs}{defineparagraphs} -\setinterfacecommand{defineplacement}{defineplacement} -\setinterfacecommand{defineprofile}{defineprofile} -\setinterfacecommand{defineprogram}{defineprogram} -\setinterfacecommand{definerawfont}{definerawfont} -\setinterfacecommand{definereference}{definereference} -\setinterfacecommand{definereferenceformat}{definereferenceformat} -\setinterfacecommand{definereferencelist}{definereferencelist} -\setinterfacecommand{defineregister}{defineregister} -\setinterfacecommand{definerule}{definerule} -\setinterfacecommand{definesection}{definesection} -\setinterfacecommand{definesectionblock}{definesectionblock} -\setinterfacecommand{definesorting}{definesorting} -\setinterfacecommand{definestartstop}{definestartstop} -\setinterfacecommand{definestyle}{definestyle} -\setinterfacecommand{definesubfield}{definesubfield} -\setinterfacecommand{definesymbol}{definesymbol} -\setinterfacecommand{definesynonyms}{definesynonyms} -\setinterfacecommand{definetabletemplate}{definetabletemplate} -\setinterfacecommand{definetabulate}{definetabulate} -\setinterfacecommand{definetext}{definetext} -\setinterfacecommand{definetextposition}{definetextposition} -\setinterfacecommand{definetextvariable}{definetextvariable} -\setinterfacecommand{definetype}{definetype} -\setinterfacecommand{definetyping}{definetyping} -\setinterfacecommand{defineversion}{defineversion} -\setinterfacecommand{determineheadnumber}{determineheadnumber} -\setinterfacecommand{determinelistcharacteristics}{determinelistcharacteristics} -\setinterfacecommand{determineregistercharacteristics}{determineregistercharacteristics} -\setinterfacecommand{dimension}{dimension} -\setinterfacecommand{disableinteractionmenu}{disableinteractionmenu} -\setinterfacecommand{domicile}{domicile} -\setinterfacecommand{donttest}{donttest} -\setinterfacecommand{edgedistance}{edgedistance} -\setinterfacecommand{edgewidth}{edgewidth} -\setinterfacecommand{emptylines}{emptylines} -\setinterfacecommand{environment}{environment} -\setinterfacecommand{externalfigure}{externalfigure} -\setinterfacecommand{fact}{fact} -\setinterfacecommand{field}{field} -\setinterfacecommand{fieldstack}{fieldstack} -\setinterfacecommand{fillinfield}{fillinfield} -\setinterfacecommand{fillinline}{fillinline} -\setinterfacecommand{fillinrules}{fillinrules} -\setinterfacecommand{fillintext}{fillintext} -\setinterfacecommand{fitfield}{fitfield} -\setinterfacecommand{fixedspace}{fixedspace} -\setinterfacecommand{fixedspaces}{fixedspaces} -\setinterfacecommand{followprofile}{followprofile} -\setinterfacecommand{followprofileversion}{followprofileversion} -\setinterfacecommand{followversion}{followversion} -\setinterfacecommand{footerdistance}{footerdistance} -\setinterfacecommand{footerheight}{footerheight} -\setinterfacecommand{footnote}{footnote} -\setinterfacecommand{footnotetext}{footnotetext} -\setinterfacecommand{forceblocks}{forceblocks} -\setinterfacecommand{formulanumber}{formulanumber} -\setinterfacecommand{fraction}{fraction} -\setinterfacecommand{framed}{framed} -\setinterfacecommand{from}{from} -\setinterfacecommand{getbuffer}{getbuffer} -\setinterfacecommand{getmarking}{getmarking} -\setinterfacecommand{getnumber}{getnumber} -\setinterfacecommand{godown}{godown} -\setinterfacecommand{goto}{goto} -\setinterfacecommand{gotobox}{gotobox} -\setinterfacecommand{gotopage}{gotopage} -\setinterfacecommand{graycolor}{graycolor} -\setinterfacecommand{greyvalue}{greyvalue} -\setinterfacecommand{grid}{grid} -\setinterfacecommand{hairline}{hairline} -\setinterfacecommand{head}{head} -\setinterfacecommand{headerdistance}{headerdistance} -\setinterfacecommand{headerheight}{headerheight} -\setinterfacecommand{headlevel}{headlevel} -\setinterfacecommand{headnumber}{headnumber} -\setinterfacecommand{headsym}{headsym} -\setinterfacecommand{headtext}{headtext} -\setinterfacecommand{hideblocks}{hideblocks} -\setinterfacecommand{high}{high} -\setinterfacecommand{hl}{hl} -\setinterfacecommand{immediatebetweenlist}{immediatebetweenlist} -\setinterfacecommand{immediatetolist}{immediatetolist} -\setinterfacecommand{in}{in} -\setinterfacecommand{incrementnumber}{incrementnumber} -\setinterfacecommand{indenting}{indenting} -\setinterfacecommand{inframed}{inframed} -\setinterfacecommand{infull}{infull} -\setinterfacecommand{ininner}{ininner} -\setinterfacecommand{inleft}{inleft} -\setinterfacecommand{inleftedge}{inleftedge} -\setinterfacecommand{inleftmargin}{inleftmargin} -\setinterfacecommand{inline}{inline} -\setinterfacecommand{inmargin}{inmargin} -\setinterfacecommand{inmframed}{inmaframed} -\setinterfacecommand{inneredgedistance}{inneredgedistance} -\setinterfacecommand{inneredgewidth}{inneredgewidth} -\setinterfacecommand{innermargindistance}{innermargindistance} -\setinterfacecommand{innermarginwidth}{innermarginwidth} -\setinterfacecommand{inothermargin}{inothermargin} -\setinterfacecommand{inouter}{inouter} -\setinterfacecommand{inright}{inright} -\setinterfacecommand{inrightedge}{inrightedge} -\setinterfacecommand{inrightmargin}{inrightmargin} -\setinterfacecommand{installlanguage}{installlanguage} -\setinterfacecommand{interactionbar}{interactionbar} -\setinterfacecommand{interactionbuttons}{interactionbuttons} -\setinterfacecommand{interactionmenu}{interactionmenu} -\setinterfacecommand{item}{item} -\setinterfacecommand{items}{items} -\setinterfacecommand{its}{its} -\setinterfacecommand{keepblocks}{keepblocks} -\setinterfacecommand{label}{label} -\setinterfacecommand{labels}{labels} -\setinterfacecommand{labeltext}{labeltext} -\setinterfacecommand{language}{language} -\setinterfacecommand{leftaligned}{leftaligned} -\setinterfacecommand{leftedgedistance}{leftedgedistance} -\setinterfacecommand{leftedgewidth}{leftedgewidth} -\setinterfacecommand{leftmargindistance}{leftmargindistance} -\setinterfacecommand{leftmarginwidth}{leftmarginwidth} -\setinterfacecommand{leg}{leg} -\setinterfacecommand{linewidth}{linethickness} -\setinterfacecommand{listheight}{listheight} -\setinterfacecommand{listlength}{listlength} -\setinterfacecommand{listsymbol}{listsymbol} -\setinterfacecommand{listwidth}{listwidth} -\setinterfacecommand{logfields}{logfields} -\setinterfacecommand{lohi}{lohi} -\setinterfacecommand{low}{low} -\setinterfacecommand{macroname}{name} -\setinterfacecommand{mainlanguage}{mainlanguage} -\setinterfacecommand{makeupheight}{makeupheight} -\setinterfacecommand{makeupwidth}{makeupwidth} -\setinterfacecommand{mar}{mar} -\setinterfacecommand{margindistance}{margindistance} -\setinterfacecommand{marginrule}{marginrule} -\setinterfacecommand{margintext}{margintext} -\setinterfacecommand{margintitle}{margintitle} -\setinterfacecommand{marginwidth}{marginwidth} -\setinterfacecommand{marginword}{marginword} -\setinterfacecommand{marking}{marking} -\setinterfacecommand{markversion}{markversion} -\setinterfacecommand{mathematics}{mathematics} -\setinterfacecommand{menubutton}{menubutton} -\setinterfacecommand{mframed}{maframed} -\setinterfacecommand{midaligned}{midaligned} -\setinterfacecommand{mirror}{mirror} -\setinterfacecommand{month}{month} -\setinterfacecommand{moveformula}{moveformula} -\setinterfacecommand{moveongrid}{moveongrid} -\setinterfacecommand{movesidefloat}{movesidefloat} -\setinterfacecommand{navigating}{navigating} -\setinterfacecommand{nodimension}{nodimension} -\setinterfacecommand{noheaderandfooterlines}{noheaderandfooterlines} -\setinterfacecommand{noindenting}{noindenting} -\setinterfacecommand{nolist}{nolist} -\setinterfacecommand{nomarking}{nomarking} -\setinterfacecommand{nomoreblocks}{nomoreblocks} -\setinterfacecommand{nomorefiles}{nomorefiles} -\setinterfacecommand{nop}{nop} -\setinterfacecommand{nospace}{nospace} -\setinterfacecommand{note}{note} -\setinterfacecommand{notopandbottomlines}{notopandbottomlines} -\setinterfacecommand{notsmallcapped}{nocap} -\setinterfacecommand{nowhitespace}{nowhitespace} -\setinterfacecommand{numberofsubpages}{numberofsubpages} -\setinterfacecommand{numbers}{numbers} -\setinterfacecommand{outeredgedistance}{outeredgedistance} -\setinterfacecommand{outeredgewidth}{outeredgewidth} -\setinterfacecommand{outermargindistance}{outermargindistance} -\setinterfacecommand{outermarginwidth}{outermarginwidth} -\setinterfacecommand{packed}{packed} -\setinterfacecommand{page}{page} -\setinterfacecommand{pagedepth}{pagedepth} -\setinterfacecommand{pagenumber}{pagenumber} -\setinterfacecommand{pageoffset}{pageoffset} -\setinterfacecommand{pagereference}{pagereference} -\setinterfacecommand{pagetype}{pagetype} -\setinterfacecommand{paperheight}{paperheight} -\setinterfacecommand{paperwidth}{paperwidth} -\setinterfacecommand{periods}{periods} -\setinterfacecommand{plaatsruwelijst}{placerawlist} -\setinterfacecommand{placebookmarks}{placebookmarks} -\setinterfacecommand{placecombinedlist}{placecombinedlist} -\setinterfacecommand{placefloat}{placefloat} -\setinterfacecommand{placefootnotes}{placefootnotes} -\setinterfacecommand{placeformula}{placeformula} -\setinterfacecommand{placeheadnumber}{placeheadnumber} -\setinterfacecommand{placeheadtext}{placeheadtext} -\setinterfacecommand{placelegend}{placelegend} -\setinterfacecommand{placelist}{placelist} -\setinterfacecommand{placelocalfootnotes}{placelocalfootnotes} -\setinterfacecommand{placelogos}{placelogos} -\setinterfacecommand{placeongrid}{placeongrid} -\setinterfacecommand{placeontopofeachother}{placeontopofeachother} -\setinterfacecommand{placepagenumber}{placepagenumber} -\setinterfacecommand{placereferencelist}{placereferencelist} -\setinterfacecommand{placeregister}{placeregister} -\setinterfacecommand{placerule}{placerule} -\setinterfacecommand{placesidebyside}{placesidebyside} -\setinterfacecommand{placesubformula}{placesubformula} -\setinterfacecommand{placetextvariable}{placetextvariable} -\setinterfacecommand{position}{position} -\setinterfacecommand{positiontext}{positiontext} -\setinterfacecommand{printpaperheight}{printpaperheight} -\setinterfacecommand{printpaperwidth}{printpaperwidth} -\setinterfacecommand{processblocks}{processblocks} -\setinterfacecommand{processpage}{processpage} -\setinterfacecommand{product}{product} -\setinterfacecommand{program}{program} -\setinterfacecommand{project}{project} -\setinterfacecommand{publication}{publication} -\setinterfacecommand{quotation}{quotation} -\setinterfacecommand{quote}{quote} -\setinterfacecommand{ran}{ran} -\setinterfacecommand{redo}{redo} -\setinterfacecommand{ref}{ref} -\setinterfacecommand{reference}{reference} -\setinterfacecommand{referral}{referral} -\setinterfacecommand{referraldate}{referraldate} -\setinterfacecommand{referring}{referring} -\setinterfacecommand{remark}{remark} -\setinterfacecommand{reset}{reset} -\setinterfacecommand{resetmarking}{resetmarking} -\setinterfacecommand{resetnumber}{resetnumber} -\setinterfacecommand{resettext}{resettextcontent} -\setinterfacecommand{rightaligned}{rightaligned} -\setinterfacecommand{rightedgedistance}{rightedgedistance} -\setinterfacecommand{rightedgewidth}{rightedgewidth} -\setinterfacecommand{rightmargindistance}{rightmargindistance} -\setinterfacecommand{rightmarginwidth}{rightmarginwidth} -\setinterfacecommand{romannumerals}{romannumerals} -\setinterfacecommand{rotate}{rotate} -\setinterfacecommand{scale}{scale} -\setinterfacecommand{screen}{screen} -\setinterfacecommand{selectblocks}{selectblocks} -\setinterfacecommand{selectpaper}{selectpaper} -\setinterfacecommand{selectversion}{selectversion} -\setinterfacecommand{setnumber}{setnumber} -\setinterfacecommand{settextcontent}{settextcontent} -\setinterfacecommand{settextvariable}{settextvariable} -\setinterfacecommand{setupalign}{setupalign} -\setinterfacecommand{setupanswerarea}{setupanswerarea} -\setinterfacecommand{setuparranging}{setuparranging} -\setinterfacecommand{setupbackground}{setupbackground} -\setinterfacecommand{setupbackgrounds}{setupbackgrounds} -\setinterfacecommand{setupblackrules}{setupblackrules} -\setinterfacecommand{setupblank}{setupblank} -\setinterfacecommand{setupblock}{setupblock} -\setinterfacecommand{setupbodyfont}{setupbodyfont} -\setinterfacecommand{setupbodyfontenvironment}{setupbodyfontenvironment} -\setinterfacecommand{setupbottom}{setupbottom} -\setinterfacecommand{setupbottomtexts}{setupbottomtexts} -\setinterfacecommand{setupbuffer}{setupbuffer} -\setinterfacecommand{setupbuttons}{setupbuttons} -\setinterfacecommand{setupcapitals}{setupcapitals} -\setinterfacecommand{setupcaption}{setupcaption} -\setinterfacecommand{setupcaptions}{setupcaptions} -\setinterfacecommand{setupclipping}{setupclipping} -\setinterfacecommand{setupcolor}{setupcolor} -\setinterfacecommand{setupcolors}{setupcolors} -\setinterfacecommand{setupcolumns}{setupcolumns} -\setinterfacecommand{setupcolumnset}{setupcolumnset} -\setinterfacecommand{setupcolumnsetlines}{setupcolumnsetlines} -\setinterfacecommand{setupcolumnsetstart}{setupcolumnsetstart} -\setinterfacecommand{setupcombinations}{setupcombinations} -\setinterfacecommand{setupcombinedlist}{setupcombinedlist} -\setinterfacecommand{setupcomment}{setupcomment} -\setinterfacecommand{setupdescriptions}{setupdescriptions} -\setinterfacecommand{setupenumerations}{setupenumerations} -\setinterfacecommand{setupexternalfigures}{setupexternalfigures} -\setinterfacecommand{setupfield}{setupfield} -\setinterfacecommand{setupfields}{setupfields} -\setinterfacecommand{setupfillinlines}{setupfillinlines} -\setinterfacecommand{setupfillinrules}{setupfillinrules} -\setinterfacecommand{setupfloat}{setupfloat} -\setinterfacecommand{setupfloats}{setupfloats} -\setinterfacecommand{setupfloatsplitting}{setupfloatsplitting} -\setinterfacecommand{setupfooter}{setupfooter} -\setinterfacecommand{setupfootertexts}{setupfootertexts} -\setinterfacecommand{setupfootnotedefinition}{setupfootnotedefinition} -\setinterfacecommand{setupfootnotes}{setupfootnotes} -\setinterfacecommand{setupforms}{setupforms} -\setinterfacecommand{setupformulas}{setupformulae} -\setinterfacecommand{setupframed}{setupframed} -\setinterfacecommand{setupframedtexts}{setupframedtexts} -\setinterfacecommand{setuphead}{setuphead} -\setinterfacecommand{setupheader}{setupheader} -\setinterfacecommand{setupheadertexts}{setupheadertexts} -\setinterfacecommand{setupheadnumber}{setupheadnumber} -\setinterfacecommand{setupheads}{setupheads} -\setinterfacecommand{setupheadtext}{setupheadtext} -\setinterfacecommand{setuphyphenmark}{setuphyphenmark} -\setinterfacecommand{setupindentations}{setupindentations} -\setinterfacecommand{setupindenting}{setupindenting} -\setinterfacecommand{setupinmargin}{setupinmargin} -\setinterfacecommand{setupinteraction}{setupinteraction} -\setinterfacecommand{setupinteractionbar}{setupinteractionbar} -\setinterfacecommand{setupinteractionmenu}{setupinteractionmenu} -\setinterfacecommand{setupinteractionscreen}{setupinteractionscreen} -\setinterfacecommand{setupinterlinespace}{setupinterlinespace} -\setinterfacecommand{setupitemgroup}{setupitemgroup} -\setinterfacecommand{setupitemgroups}{setupitemizations} -\setinterfacecommand{setupitems}{setupitems} -\setinterfacecommand{setuplabeltext}{setuplabeltext} -\setinterfacecommand{setuplanguage}{setuplanguage} -\setinterfacecommand{setuplayout}{setuplayout} -\setinterfacecommand{setuplegend}{setuplegend} -\setinterfacecommand{setuplinenumbering}{setuplinenumbering} -\setinterfacecommand{setuplines}{setuplines} -\setinterfacecommand{setuplinewidth}{setuplinewidth} -\setinterfacecommand{setuplist}{setuplist} -\setinterfacecommand{setupmakeup}{setupmakeup} -\setinterfacecommand{setupmarginblocks}{setupmarginblocks} -\setinterfacecommand{setupmarginrules}{setupmarginrules} -\setinterfacecommand{setupmarking}{setupmarking} -\setinterfacecommand{setupmathalignment}{setupmathalignment} -\setinterfacecommand{setupnarrower}{setupnarrower} -\setinterfacecommand{setupnumber}{setupnumber} -\setinterfacecommand{setupnumbering}{setupnumbering} -\setinterfacecommand{setupoppositeplacing}{setupoppositeplacing} -\setinterfacecommand{setupoutput}{setupoutput} -\setinterfacecommand{setuppagecomment}{setuppagecomment} -\setinterfacecommand{setuppagenumber}{setuppagenumber} -\setinterfacecommand{setuppagenumbering}{setuppagenumbering} -\setinterfacecommand{setuppagetransitions}{setuppagetransitions} -\setinterfacecommand{setuppalet}{setuppalet} -\setinterfacecommand{setuppaper}{setuppaper} -\setinterfacecommand{setuppapersize}{setuppapersize} -\setinterfacecommand{setupparagraphnumbering}{setupparagraphnumbering} -\setinterfacecommand{setupparagraphs}{setupparagraphs} -\setinterfacecommand{setupplacement}{setupplacement} -\setinterfacecommand{setuppositioning}{setuppositioning} -\setinterfacecommand{setupprofiles}{setupprofiles} -\setinterfacecommand{setupprograms}{setupprograms} -\setinterfacecommand{setuppublications}{setuppublications} -\setinterfacecommand{setupquote}{setupquote} -\setinterfacecommand{setupreferencelist}{setupreferencelist} -\setinterfacecommand{setupreferencing}{setupreferencing} -\setinterfacecommand{setupregister}{setupregister} -\setinterfacecommand{setuprotate}{setuprotate} -\setinterfacecommand{setuprule}{setuprule} -\setinterfacecommand{setups}{setups} -\setinterfacecommand{setupscreens}{setupscreens} -\setinterfacecommand{setupsection}{setupsection} -\setinterfacecommand{setupsectionblock}{setupsectionblock} -\setinterfacecommand{setupsorting}{setupsorting} -\setinterfacecommand{setupspacing}{setupspacing} -\setinterfacecommand{setupstartstop}{setupstartstop} -\setinterfacecommand{setupstrut}{setupstrut} -\setinterfacecommand{setupsubpagenumber}{setupsubpagenumber} -\setinterfacecommand{setupsymbolset}{setupsymbolset} -\setinterfacecommand{setupsynchronization}{setupsynchronization} -\setinterfacecommand{setupsynchronizationbar}{setupsynchronizationbar} -\setinterfacecommand{setupsynonyms}{setupsynonyms} -\setinterfacecommand{setupsystem}{setupsystem} -\setinterfacecommand{setuptab}{setuptab} -\setinterfacecommand{setuptables}{setuptables} -\setinterfacecommand{setuptabulate}{setuptabulate} -\setinterfacecommand{setuptext}{setuptext} -\setinterfacecommand{setuptextposition}{setuptextposition} -\setinterfacecommand{setuptextrules}{setuptextrules} -\setinterfacecommand{setuptexttexts}{setuptexttexts} -\setinterfacecommand{setuptextvariable}{setuptextvariable} -\setinterfacecommand{setupthinrules}{setupthinrules} -\setinterfacecommand{setuptolerance}{setuptolerance} -\setinterfacecommand{setuptop}{setuptop} -\setinterfacecommand{setuptoptexts}{setuptoptexts} -\setinterfacecommand{setuptype}{setuptype} -\setinterfacecommand{setuptyping}{setuptyping} -\setinterfacecommand{setupunderbar}{setupunderbar} -\setinterfacecommand{setupurl}{setupurl} -\setinterfacecommand{setupversions}{setupversions} -\setinterfacecommand{setupwhitespace}{setupwhitespace} -\setinterfacecommand{showbodyfont}{showbodyfont} -\setinterfacecommand{showbodyfontenvironment}{showbodyfontenvironment} -\setinterfacecommand{showcolor}{showcolor} -\setinterfacecommand{showcolorgroup}{showcolorgroup} -\setinterfacecommand{showexternalfigures}{showexternalfigures} -\setinterfacecommand{showfields}{showfields} -\setinterfacecommand{showframe}{showframe} -\setinterfacecommand{showgrid}{showgrid} -\setinterfacecommand{showlayout}{showlayout} -\setinterfacecommand{showmakeup}{showmakeup} -\setinterfacecommand{showpalet}{showpalet} -\setinterfacecommand{showprint}{showprint} -\setinterfacecommand{showsetups}{showsetups} -\setinterfacecommand{showstruts}{showstruts} -\setinterfacecommand{showsymbolset}{showsymbolset} -\setinterfacecommand{smallcapped}{cap} -\setinterfacecommand{someline}{someline} -\setinterfacecommand{somewhere}{somewhere} -\setinterfacecommand{space}{space} -\setinterfacecommand{splitfloat}{splitfloat} -\setinterfacecommand{startalignment}{startalignment} -\setinterfacecommand{startbackground}{startbackground} -\setinterfacecommand{startcoding}{startcoding} -\setinterfacecommand{startcolor}{startcolor} -\setinterfacecommand{startcolumnmakeup}{startcolumnmakeup} -\setinterfacecommand{startcolumns}{startcolumns} -\setinterfacecommand{startcolumnset}{startcolumnset} -\setinterfacecommand{startcombination}{startcombination} -\setinterfacecommand{startcomponent}{startcomponent} -\setinterfacecommand{startdocument}{startdocument} -\setinterfacecommand{startenvironment}{startenvironment} -\setinterfacecommand{startfigure}{startfigure} -\setinterfacecommand{startglobal}{startglobal} -\setinterfacecommand{startline}{startline} -\setinterfacecommand{startlinecorrection}{startlinecorrection} -\setinterfacecommand{startlinenumbering}{startlinenumbering} -\setinterfacecommand{startlines}{startlines} -\setinterfacecommand{startlocal}{startlocal} -\setinterfacecommand{startlocalfootnotes}{startlocalfootnotes} -\setinterfacecommand{startmakeup}{startmakeup} -\setinterfacecommand{startmarginblock}{startmarginblock} -\setinterfacecommand{startmarginrule}{startmarginrule} -\setinterfacecommand{startnarrower}{startnarrower} -\setinterfacecommand{startopposite}{startopposite} -\setinterfacecommand{startoverlay}{startoverlay} -\setinterfacecommand{startoverzicht}{startoverview} -\setinterfacecommand{startpacked}{startpacked} -\setinterfacecommand{startpositioning}{startpositioning} -\setinterfacecommand{startproduct}{startproduct} -\setinterfacecommand{startprofile}{startprofile} -\setinterfacecommand{startproject}{startproject} -\setinterfacecommand{startquotation}{startquotation} -\setinterfacecommand{startraster}{startraster} -\setinterfacecommand{startsymbolset}{startsymbolset} -\setinterfacecommand{startsynchronization}{startsynchronization} -\setinterfacecommand{starttable}{starttable} -\setinterfacecommand{starttables}{starttables} -\setinterfacecommand{starttext}{starttext} -\setinterfacecommand{starttextrule}{starttextrule} -\setinterfacecommand{startunpacked}{startunpacked} -\setinterfacecommand{startversion}{startversion} -\setinterfacecommand{stopalignment}{stopalignment} -\setinterfacecommand{stopbackground}{stopbackground} -\setinterfacecommand{stopcoding}{stopcoding} -\setinterfacecommand{stopcolor}{stopcolor} -\setinterfacecommand{stopcolumnmakeup}{stopcolumnmakeup} -\setinterfacecommand{stopcolumns}{stopcolumns} -\setinterfacecommand{stopcolumnset}{stopcolumnset} -\setinterfacecommand{stopcombination}{stopcombination} -\setinterfacecommand{stopcomponent}{stopcomponent} -\setinterfacecommand{stopdocument}{stopdocument} -\setinterfacecommand{stopenvironment}{stopenvironment} -\setinterfacecommand{stopglobal}{stopglobal} -\setinterfacecommand{stopline}{stopline} -\setinterfacecommand{stoplinecorrection}{stoplinecorrection} -\setinterfacecommand{stoplinenumbering}{stoplinenumbering} -\setinterfacecommand{stoplines}{stoplines} -\setinterfacecommand{stoplocal}{stoplocal} -\setinterfacecommand{stoplocalfootnotes}{stoplocalfootnotes} -\setinterfacecommand{stopmakeup}{stopmakeup} -\setinterfacecommand{stopmarginblock}{stopmarginblock} -\setinterfacecommand{stopmarginrule}{stopmarginrule} -\setinterfacecommand{stopnarrower}{stopnarrower} -\setinterfacecommand{stopopposite}{stopopposite} -\setinterfacecommand{stopoverlay}{stopoverlay} -\setinterfacecommand{stopoverzicht}{stopoverview} -\setinterfacecommand{stoppacked}{stoppacked} -\setinterfacecommand{stoppositioning}{stoppositioning} -\setinterfacecommand{stopproduct}{stopproduct} -\setinterfacecommand{stopprofile}{stopprofile} -\setinterfacecommand{stopproject}{stopproject} -\setinterfacecommand{stopquotation}{stopquotation} -\setinterfacecommand{stopraster}{stopraster} -\setinterfacecommand{stopsynchronization}{stopsynchronization} -\setinterfacecommand{stoptable}{stoptable} -\setinterfacecommand{stoptables}{stoptables} -\setinterfacecommand{stoptext}{stoptext} -\setinterfacecommand{stoptextrule}{stoptextrule} -\setinterfacecommand{stopunpacked}{stopunpacked} -\setinterfacecommand{stopversion}{stopversion} -\setinterfacecommand{stretched}{stretched} -\setinterfacecommand{subformulanumber}{subformulanumber} -\setinterfacecommand{subpagenumber}{subpagenumber} -\setinterfacecommand{switchtobodyfont}{switchtobodyfont} -\setinterfacecommand{switchtorawfont}{switchtorawfont} -\setinterfacecommand{sym}{sym} -\setinterfacecommand{symbol}{symbol} -\setinterfacecommand{synchronizationbar}{synchronizationbar} -\setinterfacecommand{synchronize}{synchronize} -\setinterfacecommand{tab}{tab} -\setinterfacecommand{testcolumn}{testcolumn} -\setinterfacecommand{testpage}{testpage} -\setinterfacecommand{tex}{tex} -\setinterfacecommand{textheight}{textheight} -\setinterfacecommand{textreference}{textreference} -\setinterfacecommand{textrule}{textrule} -\setinterfacecommand{textvariable}{textvariable} -\setinterfacecommand{textwidth}{textwidth} -\setinterfacecommand{thinrule}{thinrule} -\setinterfacecommand{thinrules}{thinrules} -\setinterfacecommand{tooltip}{tooltip} -\setinterfacecommand{topdistance}{topdistance} -\setinterfacecommand{topheight}{topheight} -\setinterfacecommand{topspace}{topspace} -\setinterfacecommand{totalnumberofpages}{totalnumberofpages} -\setinterfacecommand{translate}{translate} -\setinterfacecommand{txt}{txt} -\setinterfacecommand{typ}{typ} -\setinterfacecommand{type}{type} -\setinterfacecommand{typebuffer}{typebuffer} -\setinterfacecommand{typefile}{typefile} -\setinterfacecommand{unitmeaning}{unitmeaning} -\setinterfacecommand{unknown}{unknown} -\setinterfacecommand{useJSscripts}{useJSscripts} -\setinterfacecommand{useURL}{useURL} -\setinterfacecommand{useXMLfilter}{useXMLfilter} -\setinterfacecommand{useblocks}{useblocks} -\setinterfacecommand{usecommands}{usecommands} -\setinterfacecommand{useencoding}{useencoding} -\setinterfacecommand{useexternaldocument}{useexternaldocument} -\setinterfacecommand{useexternalfigure}{useexternalfigure} -\setinterfacecommand{useexternalfile}{useexternalfile} -\setinterfacecommand{useexternalfiles}{useexternalfiles} -\setinterfacecommand{useexternalsoundtrack}{useexternalsoundtrack} -\setinterfacecommand{usemodule}{usemodule} -\setinterfacecommand{usemodules}{usemodules} -\setinterfacecommand{usepath}{usedirectory} -\setinterfacecommand{usereferences}{usereferences} -\setinterfacecommand{usespecials}{usespecials} -\setinterfacecommand{usesymbols}{usesymbols} -\setinterfacecommand{usetypescript}{usetypescript} -\setinterfacecommand{usetypescriptfile}{usetypescriptfile} -\setinterfacecommand{useurl}{useurl} -\setinterfacecommand{version}{version} -\setinterfacecommand{vl}{vl} -\setinterfacecommand{weekday}{weekday} -\setinterfacecommand{whitespace}{whitespace} -\setinterfacecommand{wordright}{wordright} -\setinterfacecommand{writebetweenlist}{writebetweenlist} -\setinterfacecommand{writetolist}{writetolist} -\setinterfacecommand{writetoreferencelist}{writetoreferencelist} -\setinterfacecommand{writetoregister}{writetoregister} -% -\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-fr.mkii b/Master/texmf-dist/tex/context/base/mult-fr.mkii new file mode 100644 index 00000000000..875d92bbcef --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-fr.mkii @@ -0,0 +1,1715 @@ +% this file is auto-generated, don't edit this file +% +% definitions for interface variables for language fr +% +\setinterfacevariable{Addition}{Ajout} +\setinterfacevariable{Balloon}{Ballon} +\setinterfacevariable{Character}{Caratere} +\setinterfacevariable{Characters}{Caracteres} +\setinterfacevariable{CloseDocument}{FermeDocument} +\setinterfacevariable{ExitViewer}{SortVisualisateur} +\setinterfacevariable{FirstPage}{PremierePage} +\setinterfacevariable{FitHeight}{AjusteHauteur} +\setinterfacevariable{FitWidth}{AjusteLargeur} +\setinterfacevariable{GotoPage}{VaalaPage} +\setinterfacevariable{Greek}{Grec} +\setinterfacevariable{Help}{Aide} +\setinterfacevariable{HideField}{CacheChamp} +\setinterfacevariable{HideLayer}{CacheCalque} +\setinterfacevariable{Key}{Cle} +\setinterfacevariable{LastPage}{DernierePage} +\setinterfacevariable{LoadForm}{ChargeForm} +\setinterfacevariable{MONTH}{MOIS} +\setinterfacevariable{New}{Nouveau} +\setinterfacevariable{NextJump}{SautSuivant} +\setinterfacevariable{NextPage}{PageSuivante} +\setinterfacevariable{Numbers}{Numeros} +\setinterfacevariable{OpenNamedDocument}{OuvreDocumentNomme} +\setinterfacevariable{Paragraph}{Paragraphe} +\setinterfacevariable{PauseMovie}{PauseFilm} +\setinterfacevariable{PauseRendering}{PauseRendering} +\setinterfacevariable{PauseSound}{PauseSon} +\setinterfacevariable{PreviousJump}{SautPrecedent} +\setinterfacevariable{PreviousPage}{PagePrecedente} +\setinterfacevariable{PrintDocument}{ImprimeDocument} +\setinterfacevariable{Query}{Query} +\setinterfacevariable{QueryAgain}{QueryAgain} +\setinterfacevariable{ResetForm}{RazForm} +\setinterfacevariable{ResumeMovie}{ReprendFilm} +\setinterfacevariable{ResumeRendering}{ResumeRendering} +\setinterfacevariable{ResumeSound}{ReprendSon} +\setinterfacevariable{Romannumerals}{Chiffresromains} +\setinterfacevariable{SaveDocument}{SauvegardeDocument} +\setinterfacevariable{SaveForm}{SauvegardeForm} +\setinterfacevariable{SaveNamedDocument}{SauvegardeDocumentNomme} +\setinterfacevariable{SearchAgain}{RechercheSuivant} +\setinterfacevariable{SearchDocument}{RechercheDocument} +\setinterfacevariable{ShowBookmarks}{ShowBookmarks} +\setinterfacevariable{ShowField}{MontreChamp} +\setinterfacevariable{ShowThumbs}{ShowThumbs} +\setinterfacevariable{StartMovie}{DemarreFilm} +\setinterfacevariable{StartRendering}{StartRendering} +\setinterfacevariable{StartSound}{DemarreSon} +\setinterfacevariable{StopMovie}{StoppeFilm} +\setinterfacevariable{StopRendering}{StopRendering} +\setinterfacevariable{StopSound}{StoppeSon} +\setinterfacevariable{SubmitForm}{SoumettreForm} +\setinterfacevariable{ToggleLayer}{ToggleLayer} +\setinterfacevariable{ToggleViewer}{ChangeVisualisateur} +\setinterfacevariable{URL}{URL} +\setinterfacevariable{VideLayer}{VideLayer} +\setinterfacevariable{ViewerHelp}{AideVisualisateur} +\setinterfacevariable{WEEKDAY}{JOURSEMAINE} +\setinterfacevariable{WORD}{MOT} +\setinterfacevariable{abbreviation}{abreviation} +\setinterfacevariable{abbreviations}{abreviations} +\setinterfacevariable{absolute}{absolute} +\setinterfacevariable{action}{action} +\setinterfacevariable{after}{apres} +\setinterfacevariable{all}{tout} +\setinterfacevariable{always}{toujours} +\setinterfacevariable{and}{and} +\setinterfacevariable{answerarea}{answerarea} +\setinterfacevariable{appendices}{annexes} +\setinterfacevariable{appendix}{annexe} +\setinterfacevariable{april}{avril} +\setinterfacevariable{atmargin}{alamarge} +\setinterfacevariable{atpage}{alapage} +\setinterfacevariable{attachment}{attachment} +\setinterfacevariable{august}{août} +\setinterfacevariable{author}{auteur} +\setinterfacevariable{auto}{auto} +\setinterfacevariable{autointro}{autointro} +\setinterfacevariable{back}{retour} +\setinterfacevariable{background}{arriereplan} +\setinterfacevariable{backmatter}{epilogue} +\setinterfacevariable{backpart}{postface} +\setinterfacevariable{backspace}{retourarriere} +\setinterfacevariable{backward}{retourarriere} +\setinterfacevariable{bbl}{bbl} +\setinterfacevariable{before}{avant} +\setinterfacevariable{begin}{begin} +\setinterfacevariable{bib}{bib} +\setinterfacevariable{big}{grand} +\setinterfacevariable{bigbodyfont}{grandepolicecorp} +\setinterfacevariable{bigger}{bigger} +\setinterfacevariable{bigpreference}{grandepreference} +\setinterfacevariable{blank}{vide} +\setinterfacevariable{blockquote}{blockquote} +\setinterfacevariable{bodymatter}{texteprincipal} +\setinterfacevariable{bodypart}{corpsdetexte} +\setinterfacevariable{bold}{gras} +\setinterfacevariable{bolditalic}{italiquegras} +\setinterfacevariable{boldslanted}{inclinegras} +\setinterfacevariable{bookmark}{marquepage} +\setinterfacevariable{both}{lesdeux} +\setinterfacevariable{bottom}{inf} +\setinterfacevariable{brief}{brief} +\setinterfacevariable{broad}{large} +\setinterfacevariable{buffer}{buffer} +\setinterfacevariable{by}{par} +\setinterfacevariable{calligraphic}{calligraphique} +\setinterfacevariable{cap}{cap} +\setinterfacevariable{capital}{capitale} +\setinterfacevariable{center}{center} +\setinterfacevariable{chapter}{chapitre} +\setinterfacevariable{character}{caractere} +\setinterfacevariable{characters}{caracteres} +\setinterfacevariable{cite}{cite} +\setinterfacevariable{color}{couleur} +\setinterfacevariable{column}{colonne} +\setinterfacevariable{columns}{colonnes} +\setinterfacevariable{command}{commande} +\setinterfacevariable{commands}{commandes} +\setinterfacevariable{comment}{commentaire} +\setinterfacevariable{component}{composant} +\setinterfacevariable{concept}{concept} +\setinterfacevariable{content}{contenu} +\setinterfacevariable{contents}{contenus} +\setinterfacevariable{continue}{continue} +\setinterfacevariable{continued}{continued} +\setinterfacevariable{controls}{controles} +\setinterfacevariable{conversion}{conversion} +\setinterfacevariable{current}{courant} +\setinterfacevariable{cutspace}{cutspace} +\setinterfacevariable{date}{date} +\setinterfacevariable{day}{jour} +\setinterfacevariable{december}{decembre} +\setinterfacevariable{default}{defaut} +\setinterfacevariable{depth}{profondeur} +\setinterfacevariable{description}{description} +\setinterfacevariable{disable}{desactiver} +\setinterfacevariable{display}{affichage} +\setinterfacevariable{dot}{point} +\setinterfacevariable{doublesided}{rectoverso} +\setinterfacevariable{down}{down} +\setinterfacevariable{each}{chaque} +\setinterfacevariable{edge}{bord} +\setinterfacevariable{embed}{embed} +\setinterfacevariable{empty}{vide} +\setinterfacevariable{end}{end} +\setinterfacevariable{endnote}{notefin} +\setinterfacevariable{enumeration}{enumeration} +\setinterfacevariable{environment}{environement} +\setinterfacevariable{even}{paire} +\setinterfacevariable{external}{external} +\setinterfacevariable{fact}{fait} +\setinterfacevariable{february}{fevrier} +\setinterfacevariable{figure}{figure} +\setinterfacevariable{figures}{figures} +\setinterfacevariable{file}{fichier} +\setinterfacevariable{final}{final} +\setinterfacevariable{first}{premier} +\setinterfacevariable{firstcolumn}{premierecolonne} +\setinterfacevariable{firstpage}{premierepage} +\setinterfacevariable{firstsubpage}{premieresouspage} +\setinterfacevariable{fit}{adapte} +\setinterfacevariable{five}{cinq} +\setinterfacevariable{fix}{fixe} +\setinterfacevariable{fixed}{fixe} +\setinterfacevariable{flexible}{flexible} +\setinterfacevariable{float}{flottant} +\setinterfacevariable{flushinner}{flushinner} +\setinterfacevariable{flushleft}{flushleft} +\setinterfacevariable{flushouter}{flushouter} +\setinterfacevariable{flushright}{flushright} +\setinterfacevariable{footer}{pdp} +\setinterfacevariable{footnote}{notepdp} +\setinterfacevariable{force}{force} +\setinterfacevariable{foreground}{premierplan} +\setinterfacevariable{formeel}{formeel} +\setinterfacevariable{formula}{formule} +\setinterfacevariable{formulae}{formules} +\setinterfacevariable{forward}{avance} +\setinterfacevariable{four}{quatre} +\setinterfacevariable{frame}{cadre} +\setinterfacevariable{framedtext}{texteencadre} +\setinterfacevariable{friday}{vendredi} +\setinterfacevariable{frontmatter}{preambule} +\setinterfacevariable{frontpart}{preface} +\setinterfacevariable{global}{global} +\setinterfacevariable{graphic}{graphique} +\setinterfacevariable{graphics}{graphiques} +\setinterfacevariable{gray}{gris} +\setinterfacevariable{greek}{grec} +\setinterfacevariable{grid}{grille} +\setinterfacevariable{halfline}{demiligne} +\setinterfacevariable{handwritten}{manuscript} +\setinterfacevariable{hang}{suspend} +\setinterfacevariable{hanging}{suspend} +\setinterfacevariable{head}{tete} +\setinterfacevariable{header}{entete} +\setinterfacevariable{height}{hauteur} +\setinterfacevariable{helptext}{texteaide} +\setinterfacevariable{hencefore}{precedent} +\setinterfacevariable{here}{ici} +\setinterfacevariable{hereafter}{suivant} +\setinterfacevariable{hidden}{cache} +\setinterfacevariable{hiding}{cache} +\setinterfacevariable{high}{haut} +\setinterfacevariable{horizontal}{horizontale} +\setinterfacevariable{hyphenated}{hyphenated} +\setinterfacevariable{hz}{hz} +\setinterfacevariable{inbetween}{entre} +\setinterfacevariable{index}{index} +\setinterfacevariable{indices}{indices} +\setinterfacevariable{informeel}{informeel} +\setinterfacevariable{inherit}{herite} +\setinterfacevariable{inleft}{dansgauche} +\setinterfacevariable{inmargin}{dansmarge} +\setinterfacevariable{inner}{interieur} +\setinterfacevariable{inneredge}{bordinterieur} +\setinterfacevariable{innermargin}{margeinterieure} +\setinterfacevariable{inright}{dansdroit} +\setinterfacevariable{interaction}{interaction} +\setinterfacevariable{interactionmenu}{menuinteraction} +\setinterfacevariable{intermezzi}{intermezzi} +\setinterfacevariable{intermezzo}{intermezzo} +\setinterfacevariable{intext}{danstexte} +\setinterfacevariable{intro}{intro} +\setinterfacevariable{italic}{italique} +\setinterfacevariable{italicbold}{grasitalique} +\setinterfacevariable{item}{element} +\setinterfacevariable{itemize}{lister} +\setinterfacevariable{its}{its} +\setinterfacevariable{january}{janvier} +\setinterfacevariable{joinedup}{joinedup} +\setinterfacevariable{july}{juillet} +\setinterfacevariable{june}{juin} +\setinterfacevariable{keep}{maintient} +\setinterfacevariable{knockout}{knockout} +\setinterfacevariable{label}{etiquette} +\setinterfacevariable{landscape}{paysage} +\setinterfacevariable{last}{dernier} +\setinterfacevariable{lastcolumn}{dernierecolonne} +\setinterfacevariable{lastpage}{dernierepage} +\setinterfacevariable{lastpagenumber}{derniernumeropage} +\setinterfacevariable{lastsubpage}{dernieresouspage} +\setinterfacevariable{layer}{layer} +\setinterfacevariable{left}{gauche} +\setinterfacevariable{leftedge}{bordgauche} +\setinterfacevariable{lefthanging}{lefthanging} +\setinterfacevariable{leftmargin}{margegauche} +\setinterfacevariable{leftpage}{pagegauche} +\setinterfacevariable{lefttoright}{lefttoright} +\setinterfacevariable{legend}{legende} +\setinterfacevariable{lesshyphenation}{lesshyphenation} +\setinterfacevariable{line}{ligne} +\setinterfacevariable{linenote}{noteligne} +\setinterfacevariable{lines}{lignes} +\setinterfacevariable{list}{liste} +\setinterfacevariable{local}{local} +\setinterfacevariable{localenvironment}{environementlocal} +\setinterfacevariable{logo}{logo} +\setinterfacevariable{logos}{logos} +\setinterfacevariable{lohi}{baha} +\setinterfacevariable{loose}{perte} +\setinterfacevariable{low}{bas} +\setinterfacevariable{ls}{ls} +\setinterfacevariable{makeup}{makeup} +\setinterfacevariable{mar}{mar} +\setinterfacevariable{march}{mars} +\setinterfacevariable{margin}{marge} +\setinterfacevariable{marginedge}{bordmarge} +\setinterfacevariable{margintitle}{titremarge} +\setinterfacevariable{marking}{marquage} +\setinterfacevariable{mathalignment}{mathalignment} +\setinterfacevariable{mathcases}{mathcases} +\setinterfacevariable{mathmatrix}{mathmatrix} +\setinterfacevariable{max}{max} +\setinterfacevariable{maxdepth}{maxdepth} +\setinterfacevariable{maxheight}{maxheight} +\setinterfacevariable{maxwidth}{maxwidth} +\setinterfacevariable{may}{mai} +\setinterfacevariable{mediaeval}{medieval} +\setinterfacevariable{medium}{moyen} +\setinterfacevariable{middle}{milieu} +\setinterfacevariable{min}{min} +\setinterfacevariable{mindepth}{mindepth} +\setinterfacevariable{minheight}{hauteurmin} +\setinterfacevariable{minwidth}{largeurmin} +\setinterfacevariable{mirrored}{reflete} +\setinterfacevariable{monday}{lundi} +\setinterfacevariable{mono}{mono} +\setinterfacevariable{month}{mois} +\setinterfacevariable{morehyphenation}{morehyphenation} +\setinterfacevariable{name}{nom} +\setinterfacevariable{narrow}{etroit} +\setinterfacevariable{negative}{negatif} +\setinterfacevariable{never}{jamais} +\setinterfacevariable{new}{nouveau} +\setinterfacevariable{next}{prochain} +\setinterfacevariable{nextevenpage}{pagepairesuivante} +\setinterfacevariable{nextoddpage}{pageimpairesuivante} +\setinterfacevariable{nextpage}{pagesuivante} +\setinterfacevariable{nextsubpage}{souspagesuivante} +\setinterfacevariable{no}{non} +\setinterfacevariable{nocheck}{nonverifie} +\setinterfacevariable{nofit}{nofit} +\setinterfacevariable{nogrid}{nogrid} +\setinterfacevariable{nohz}{nohz} +\setinterfacevariable{nomarking}{sansmarquage} +\setinterfacevariable{none}{rien} +\setinterfacevariable{nonumber}{sansnumero} +\setinterfacevariable{normal}{normal} +\setinterfacevariable{nospacing}{sansespacement} +\setinterfacevariable{not}{pas} +\setinterfacevariable{note}{note} +\setinterfacevariable{nothanging}{nonsuspendu} +\setinterfacevariable{nothyphenated}{nothyphenated} +\setinterfacevariable{november}{novembre} +\setinterfacevariable{nowhere}{nulpart} +\setinterfacevariable{nowhite}{sansblanc} +\setinterfacevariable{number}{numero} +\setinterfacevariable{numbers}{numeros} +\setinterfacevariable{october}{octobre} +\setinterfacevariable{odd}{impair} +\setinterfacevariable{off}{desactive} +\setinterfacevariable{offset}{offset} +\setinterfacevariable{old}{old} +\setinterfacevariable{on}{actif} +\setinterfacevariable{one}{un} +\setinterfacevariable{opposite}{opposition} +\setinterfacevariable{outer}{exterieur} +\setinterfacevariable{outeredge}{bordexterieur} +\setinterfacevariable{outermargin}{margeexterieure} +\setinterfacevariable{overbar}{overbar} +\setinterfacevariable{overbars}{overbars} +\setinterfacevariable{overlay}{revetement} +\setinterfacevariable{overprint}{overprint} +\setinterfacevariable{overstrike}{surlignetout} +\setinterfacevariable{overstrikes}{surligne} +\setinterfacevariable{packed}{groupe} +\setinterfacevariable{page}{page} +\setinterfacevariable{pagecomment}{commentairepage} +\setinterfacevariable{pagenumber}{numeropage} +\setinterfacevariable{paper}{papier} +\setinterfacevariable{paragraph}{paragraphe} +\setinterfacevariable{part}{partie} +\setinterfacevariable{positive}{positif} +\setinterfacevariable{postponing}{postponing} +\setinterfacevariable{postscript}{postscript} +\setinterfacevariable{preference}{preference} +\setinterfacevariable{preview}{previsualisation} +\setinterfacevariable{previous}{precedent} +\setinterfacevariable{previousevenpage}{pagepaireprecedente} +\setinterfacevariable{previousoddpage}{pageimpaireprecedente} +\setinterfacevariable{previouspage}{pageprecedente} +\setinterfacevariable{previoussubpage}{souspageprecedente} +\setinterfacevariable{printable}{editable} +\setinterfacevariable{process}{process} +\setinterfacevariable{product}{produit} +\setinterfacevariable{program}{programme} +\setinterfacevariable{project}{projet} +\setinterfacevariable{protected}{protege} +\setinterfacevariable{quadruple}{quadruple} +\setinterfacevariable{quotation}{citation} +\setinterfacevariable{quote}{citer} +\setinterfacevariable{ran}{cours} +\setinterfacevariable{random}{aleatoire} +\setinterfacevariable{readonly}{lectureseule} +\setinterfacevariable{rectangular}{rectangulaire} +\setinterfacevariable{reference}{reference} +\setinterfacevariable{referral}{referral} +\setinterfacevariable{register}{registre} +\setinterfacevariable{regular}{regulier} +\setinterfacevariable{rekening}{rekening} +\setinterfacevariable{relative}{relatif} +\setinterfacevariable{repeat}{repete} +\setinterfacevariable{required}{recquis} +\setinterfacevariable{reset}{raz} +\setinterfacevariable{reverse}{inverse} +\setinterfacevariable{right}{droite} +\setinterfacevariable{rightedge}{borddroit} +\setinterfacevariable{righthanging}{righthanging} +\setinterfacevariable{rightmargin}{margedroite} +\setinterfacevariable{rightpage}{pagedroite} +\setinterfacevariable{righttoleft}{righttoleft} +\setinterfacevariable{roman}{roman} +\setinterfacevariable{romannumerals}{chiffresromains} +\setinterfacevariable{rotate}{oriente} +\setinterfacevariable{rotated}{tourne} +\setinterfacevariable{round}{rond} +\setinterfacevariable{row}{rang} +\setinterfacevariable{rule}{regle} +\setinterfacevariable{samepage}{memepage} +\setinterfacevariable{sans}{sans} +\setinterfacevariable{sansbold}{sansgras} +\setinterfacevariable{sansserif}{sansserif} +\setinterfacevariable{saturday}{samedi} +\setinterfacevariable{screen}{ecran} +\setinterfacevariable{section}{section} +\setinterfacevariable{sectionblockenvironment}{environementblocsection} +\setinterfacevariable{sectionnumber}{numerosection} +\setinterfacevariable{see}{voit} +\setinterfacevariable{september}{septembre} +\setinterfacevariable{serif}{serif} +\setinterfacevariable{serried}{serried} +\setinterfacevariable{setups}{reglages} +\setinterfacevariable{sheet}{sheet} +\setinterfacevariable{short}{short} +\setinterfacevariable{singlesided}{recto} +\setinterfacevariable{slanted}{incline} +\setinterfacevariable{slantedbold}{grasincline} +\setinterfacevariable{small}{petit} +\setinterfacevariable{smallbodyfont}{petitepolicecorps} +\setinterfacevariable{smallbold}{graspetit} +\setinterfacevariable{smallbolditalic}{italiquegraspetit} +\setinterfacevariable{smallboldslanted}{inclinegraspetit} +\setinterfacevariable{smallcaps}{petitescapitales} +\setinterfacevariable{smaller}{smaller} +\setinterfacevariable{smallitalic}{italiquepetit} +\setinterfacevariable{smallitalicbold}{grasitaliquepetit} +\setinterfacevariable{smallnormal}{normalpetit} +\setinterfacevariable{smallslanted}{inclinepetit} +\setinterfacevariable{smallslantedbold}{grasinclinepetit} +\setinterfacevariable{smalltype}{petittype} +\setinterfacevariable{somewhere}{qqpart} +\setinterfacevariable{sorted}{trie} +\setinterfacevariable{space}{espace} +\setinterfacevariable{spacing}{espacement} +\setinterfacevariable{speech}{discours} +\setinterfacevariable{split}{split} +\setinterfacevariable{spot}{spot} +\setinterfacevariable{standard}{standard} +\setinterfacevariable{start}{demarre} +\setinterfacevariable{starter}{starter} +\setinterfacevariable{sticker}{sticker} +\setinterfacevariable{stop}{stoppe} +\setinterfacevariable{stopper}{stopper} +\setinterfacevariable{stretch}{etire} +\setinterfacevariable{strict}{strict} +\setinterfacevariable{strong}{strong} +\setinterfacevariable{strut}{strut} +\setinterfacevariable{sub}{sous} +\setinterfacevariable{subbackward}{sousretourarriere} +\setinterfacevariable{subformula}{subformule} +\setinterfacevariable{subforward}{sousavance} +\setinterfacevariable{subject}{sujet} +\setinterfacevariable{subpage}{souspage} +\setinterfacevariable{subsection}{soussection} +\setinterfacevariable{subsubject}{soussujet} +\setinterfacevariable{subsubsection}{soussoussection} +\setinterfacevariable{subsubsubject}{soussoussujet} +\setinterfacevariable{subsubsubsection}{soussoussoussection} +\setinterfacevariable{subsubsubsubject}{soussoussoussujet} +\setinterfacevariable{subsubsubsubsection}{soussoussoussoussection} +\setinterfacevariable{subsubsubsubsubject}{soussoussoussoussujet} +\setinterfacevariable{subsubsubsubsubsection}{soussoussoussoussoussection} +\setinterfacevariable{subsubsubsubsubsubject}{soussoussoussoussoussujet} +\setinterfacevariable{subsubsubsubsubsubsection}{soussoussoussoussoussoussection} +\setinterfacevariable{subsubsubsubsubsubsubject}{soussoussoussoussoussoussujet} +\setinterfacevariable{subsubsubsubsubsubsubsection}{soussoussoussoussoussoussoussection} +\setinterfacevariable{subsubsubsubsubsubsubsubject}{soussoussoussoussoussoussoussujet} +\setinterfacevariable{subsubsubsubsubsubsubsubsection}{soussoussoussoussoussoussoussoussection} +\setinterfacevariable{subsubsubsubsubsubsubsubsubject}{soussoussoussoussoussoussoussoussujet} +\setinterfacevariable{subsubsubsubsubsubsubsubsubsection}{soussoussoussoussoussoussoussoussoussection} +\setinterfacevariable{subsubsubsubsubsubsubsubsubsubject}{soussoussoussoussoussoussoussoussoussujet} +\setinterfacevariable{sunday}{dimanche} +\setinterfacevariable{support}{support} +\setinterfacevariable{sym}{sym} +\setinterfacevariable{symbol}{symbole} +\setinterfacevariable{synchronize}{synchronize} +\setinterfacevariable{system}{systeme} +\setinterfacevariable{table}{tableau} +\setinterfacevariable{tablehead}{tetetableau} +\setinterfacevariable{tables}{tables} +\setinterfacevariable{tabletail}{queuetableau} +\setinterfacevariable{tabulate}{tabule} +\setinterfacevariable{tabulatehead}{tetetabule} +\setinterfacevariable{tabulatetail}{queuetabule} +\setinterfacevariable{tall}{long} +\setinterfacevariable{teletype}{teletype} +\setinterfacevariable{temporary}{temporaire} +\setinterfacevariable{test}{test} +\setinterfacevariable{text}{texte} +\setinterfacevariable{three}{trois} +\setinterfacevariable{thursday}{jeudi} +\setinterfacevariable{title}{titre} +\setinterfacevariable{toggle}{toggle} +\setinterfacevariable{tolerant}{tolerant} +\setinterfacevariable{top}{sup} +\setinterfacevariable{tuesday}{mardi} +\setinterfacevariable{two}{deux} +\setinterfacevariable{txt}{txt} +\setinterfacevariable{type}{type} +\setinterfacevariable{typing}{typing} +\setinterfacevariable{unavailable}{indisponible} +\setinterfacevariable{underbar}{souslignetout} +\setinterfacevariable{underbars}{sousligne} +\setinterfacevariable{unit}{unite} +\setinterfacevariable{units}{unites} +\setinterfacevariable{unknown}{inconnu} +\setinterfacevariable{unpacked}{degroupe} +\setinterfacevariable{up}{up} +\setinterfacevariable{url}{url} +\setinterfacevariable{used}{used} +\setinterfacevariable{value}{valeur} +\setinterfacevariable{vertical}{verticale} +\setinterfacevariable{very}{tres} +\setinterfacevariable{verystrict}{tresstrict} +\setinterfacevariable{verytolerant}{trestolerant} +\setinterfacevariable{weak}{weak} +\setinterfacevariable{wednesday}{mercredi} +\setinterfacevariable{week}{semaine} +\setinterfacevariable{weekday}{joursemaine} +\setinterfacevariable{white}{blanc} +\setinterfacevariable{wide}{ample} +\setinterfacevariable{width}{largeur} +\setinterfacevariable{xml}{xml} +\setinterfacevariable{year}{annee} +\setinterfacevariable{yes}{oui} +% definitions for interface constants for language fr +% +\setinterfaceconstant{action}{action} +\setinterfaceconstant{address}{adresse} +\setinterfaceconstant{after}{apres} +\setinterfaceconstant{afterhead}{aprestete} +\setinterfaceconstant{afterkey}{aprescle} +\setinterfaceconstant{aftersection}{aftersection} +\setinterfaceconstant{align}{alignement} +\setinterfaceconstant{aligncharacter}{caracterealigne} +\setinterfaceconstant{alignmentcharacter}{alignementcaractere} +\setinterfaceconstant{alignsymbol}{alignsymbol} +\setinterfaceconstant{aligntitle}{alignementtitre} +\setinterfaceconstant{alternative}{alternative} +\setinterfaceconstant{andtext}{andtext} +\setinterfaceconstant{apa}{apa} +\setinterfaceconstant{arrow}{fleche} +\setinterfaceconstant{artauthor}{artauthor} +\setinterfaceconstant{artauthoretaldisplay}{artauthoretaldisplay} +\setinterfaceconstant{artauthoretallimit}{artauthoretallimit} +\setinterfaceconstant{artauthoretaltext}{artauthoretaltext} +\setinterfaceconstant{at}{a} +\setinterfaceconstant{author}{auteur} +\setinterfaceconstant{authoretaldisplay}{authoretaldisplay} +\setinterfaceconstant{authoretallimit}{authoretallimit} +\setinterfaceconstant{authoretaltext}{authoretaltext} +\setinterfaceconstant{auto}{auto} +\setinterfaceconstant{autocase}{autocase} +\setinterfaceconstant{autofile}{autofile} +\setinterfaceconstant{autofocus}{autofocus} +\setinterfaceconstant{autohang}{autohang} +\setinterfaceconstant{autostrut}{autostrut} +\setinterfaceconstant{autowidth}{autolargeur} +\setinterfaceconstant{axis}{axe} +\setinterfaceconstant{background}{arriereplan} +\setinterfaceconstant{backgroundcolor}{couleurarriereplan} +\setinterfaceconstant{backgroundcorner}{coinarriereplan} +\setinterfaceconstant{backgrounddepth}{profondeurarriereplan} +\setinterfaceconstant{backgroundoffset}{decalagearriereplan} +\setinterfaceconstant{backgroundradius}{rayonarriereplan} +\setinterfaceconstant{backgroundscreen}{ecranarriereplan} +\setinterfaceconstant{backreference}{backreference} +\setinterfaceconstant{backspace}{retour} +\setinterfaceconstant{balance}{equilibre} +\setinterfaceconstant{before}{avant} +\setinterfaceconstant{beforehead}{avanttete} +\setinterfaceconstant{beforesection}{beforesection} +\setinterfaceconstant{bet}{bet} +\setinterfaceconstant{big}{grand} +\setinterfaceconstant{blank}{vide} +\setinterfaceconstant{blockway}{blockway} +\setinterfaceconstant{bodyfont}{policecorps} +\setinterfaceconstant{bookmark}{marquepage} +\setinterfaceconstant{bottom}{inf} +\setinterfaceconstant{bottomafter}{bottomafter} +\setinterfaceconstant{bottombefore}{bottombefore} +\setinterfaceconstant{bottomdistance}{distanceinf} +\setinterfaceconstant{bottomframe}{cadreinf} +\setinterfaceconstant{bottomoffset}{decalageinf} +\setinterfaceconstant{bottomspace}{espaceinf} +\setinterfaceconstant{bottomstate}{etatinf} +\setinterfaceconstant{buffer}{buffer} +\setinterfaceconstant{cache}{cache} +\setinterfaceconstant{calculate}{calculer} +\setinterfaceconstant{category}{category} +\setinterfaceconstant{ccommand}{ccommande} +\setinterfaceconstant{click}{clic} +\setinterfaceconstant{clickin}{clicinterieur} +\setinterfaceconstant{clickout}{clicexterieur} +\setinterfaceconstant{clipoffset}{clipoffset} +\setinterfaceconstant{closeaction}{actionfermeture} +\setinterfaceconstant{closecommand}{closecommand} +\setinterfaceconstant{closepage}{closepage} +\setinterfaceconstant{closepageaction}{actionfermeturepage} +\setinterfaceconstant{closesymbol}{closesymbol} +\setinterfaceconstant{color}{couleur} +\setinterfaceconstant{column}{colonne} +\setinterfaceconstant{columndistance}{distancecolonne} +\setinterfaceconstant{columns}{colonnes} +\setinterfaceconstant{command}{commande} +\setinterfaceconstant{commandafter}{commandeapres} +\setinterfaceconstant{commandbefore}{commandeavant} +\setinterfaceconstant{commands}{commandes} +\setinterfaceconstant{component}{composant} +\setinterfaceconstant{compoundhyphen}{compoundhyphen} +\setinterfaceconstant{compress}{compress} +\setinterfaceconstant{connector}{connector} +\setinterfaceconstant{continue}{continue} +\setinterfaceconstant{contrastcolor}{coleurcontraste} +\setinterfaceconstant{controls}{controles} +\setinterfaceconstant{conversion}{conversion} +\setinterfaceconstant{convertfile}{conversionfichier} +\setinterfaceconstant{corner}{coin} +\setinterfaceconstant{coupling}{couplage} +\setinterfaceconstant{couplingway}{modecouplage} +\setinterfaceconstant{criterium}{critere} +\setinterfaceconstant{current}{courant} +\setinterfaceconstant{cutspace}{cutspace} +\setinterfaceconstant{dash}{pointille} +\setinterfaceconstant{dat}{dat} +\setinterfaceconstant{database}{database} +\setinterfaceconstant{date}{date} +\setinterfaceconstant{deepnumbercommand}{deepnumbercommand} +\setinterfaceconstant{deeptextcommand}{deeptextcommand} +\setinterfaceconstant{default}{defaut} +\setinterfaceconstant{delay}{delai} +\setinterfaceconstant{depth}{profondeur} +\setinterfaceconstant{depthcorrection}{correctionprofondeur} +\setinterfaceconstant{direction}{direction} +\setinterfaceconstant{directory}{repertoire} +\setinterfaceconstant{display}{affichage} +\setinterfaceconstant{distance}{distance} +\setinterfaceconstant{dot}{point} +\setinterfaceconstant{doublesided}{rectoverso} +\setinterfaceconstant{dummy}{dummy} +\setinterfaceconstant{dx}{dx} +\setinterfaceconstant{dy}{dy} +\setinterfaceconstant{edge}{bord} +\setinterfaceconstant{edgedistance}{distancebord} +\setinterfaceconstant{editor}{editor} +\setinterfaceconstant{editoretaldisplay}{editoretaldisplay} +\setinterfaceconstant{editoretallimit}{editoretallimit} +\setinterfaceconstant{editoretaltext}{editoretaltext} +\setinterfaceconstant{empty}{vide} +\setinterfaceconstant{entries}{entries} +\setinterfaceconstant{equalheight}{equalheight} +\setinterfaceconstant{equalwidth}{equalwidth} +\setinterfaceconstant{escape}{escape} +\setinterfaceconstant{evenmargin}{margepaire} +\setinterfaceconstant{expansion}{expansion} +\setinterfaceconstant{export}{export} +\setinterfaceconstant{extras}{extras} +\setinterfaceconstant{factor}{facteur} +\setinterfaceconstant{fallback}{fallback} +\setinterfaceconstant{family}{famille} +\setinterfaceconstant{fieldbackgroundcolor}{couleurarrierreplanchamp} +\setinterfaceconstant{fieldframecolor}{couleurcadrechamp} +\setinterfaceconstant{fieldlayer}{calquechamp} +\setinterfaceconstant{fieldoffset}{offsetchamp} +\setinterfaceconstant{file}{fichier} +\setinterfaceconstant{filtercommand}{filtercommand} +\setinterfaceconstant{finalnamesep}{finalnamesep} +\setinterfaceconstant{firstnamesep}{firstnamesep} +\setinterfaceconstant{focus}{focus} +\setinterfaceconstant{focusin}{focusin} +\setinterfaceconstant{focusout}{focusout} +\setinterfaceconstant{footer}{pdp} +\setinterfaceconstant{footerdistance}{dsitancepdp} +\setinterfaceconstant{footerstate}{etatpdp} +\setinterfaceconstant{force}{force} +\setinterfaceconstant{foregroundcolor}{couleurpremierplan} +\setinterfaceconstant{foregroundstyle}{stylepremierplan} +\setinterfaceconstant{format}{formatter} +\setinterfaceconstant{frame}{cadre} +\setinterfaceconstant{framecolor}{couleurcadre} +\setinterfaceconstant{framecorner}{coincadre} +\setinterfaceconstant{framedepth}{profondeurcadre} +\setinterfaceconstant{frameoffset}{decalagecadre} +\setinterfaceconstant{frameradius}{rayoncadre} +\setinterfaceconstant{frames}{cadres} +\setinterfaceconstant{from}{de} +\setinterfaceconstant{get}{obtient} +\setinterfaceconstant{global}{global} +\setinterfaceconstant{grid}{grille} +\setinterfaceconstant{hang}{suspend} +\setinterfaceconstant{headalign}{headalign} +\setinterfaceconstant{headcolor}{couleurtete} +\setinterfaceconstant{headcommand}{commandetete} +\setinterfaceconstant{headconversion}{conversiontete} +\setinterfaceconstant{header}{entete} +\setinterfaceconstant{headerdistance}{distanceentete} +\setinterfaceconstant{headerstate}{etatentete} +\setinterfaceconstant{headlabel}{etiquettetete} +\setinterfaceconstant{headnumber}{numerotete} +\setinterfaceconstant{headstyle}{styletete} +\setinterfaceconstant{height}{hauteur} +\setinterfaceconstant{hfactor}{facteurhauteur} +\setinterfaceconstant{hfil}{hfil} +\setinterfaceconstant{hidenumber}{hidenumber} +\setinterfaceconstant{hoffset}{decalagehauteur} +\setinterfaceconstant{horoffset}{horoffset} +\setinterfaceconstant{hyphen}{hyphen} +\setinterfaceconstant{icommand}{icommande} +\setinterfaceconstant{in}{in} +\setinterfaceconstant{inbetween}{entre} +\setinterfaceconstant{increment}{incremente} +\setinterfaceconstant{incrementnumber}{incrementenumero} +\setinterfaceconstant{indenting}{composeenalinea} +\setinterfaceconstant{indentnext}{indentesuivant} +\setinterfaceconstant{indicator}{indicateur} +\setinterfaceconstant{inner}{interieur} +\setinterfaceconstant{innermargin}{margeinterieure} +\setinterfaceconstant{inputfile}{fichierentree} +\setinterfaceconstant{intent}{intent} +\setinterfaceconstant{interaction}{interaction} +\setinterfaceconstant{interlinespace}{espaceinterligne} +\setinterfaceconstant{internalgrid}{internalgrid} +\setinterfaceconstant{itemalign}{itemalign} +\setinterfaceconstant{items}{elements} +\setinterfaceconstant{juniorsep}{juniorsep} +\setinterfaceconstant{ken}{ken} +\setinterfaceconstant{keyexpansion}{keyexpansion} +\setinterfaceconstant{keys}{keys} +\setinterfaceconstant{keyword}{motcle} +\setinterfaceconstant{label}{etiquette} +\setinterfaceconstant{lastnamesep}{lastnamesep} +\setinterfaceconstant{lastpubsep}{lastpubsep} +\setinterfaceconstant{left}{gauche} +\setinterfaceconstant{leftcolor}{couleurgauche} +\setinterfaceconstant{leftcompoundhyphen}{leftcompoundhyphen} +\setinterfaceconstant{leftedge}{bordgauche} +\setinterfaceconstant{leftedgedistance}{distancebordgauche} +\setinterfaceconstant{leftframe}{cadregauche} +\setinterfaceconstant{lefthyphen}{lefthyphen} +\setinterfaceconstant{leftmargin}{margegauche} +\setinterfaceconstant{leftmargindistance}{distancemargegauche} +\setinterfaceconstant{leftoffset}{decalagegauche} +\setinterfaceconstant{leftquotation}{citationgauche} +\setinterfaceconstant{leftquote}{citergauche} +\setinterfaceconstant{leftsentence}{phrasegauche} +\setinterfaceconstant{leftspeech}{leftspeech} +\setinterfaceconstant{leftstyle}{leftstyle} +\setinterfaceconstant{leftsubsentence}{sousphrasegauche} +\setinterfaceconstant{lefttext}{textegauche} +\setinterfaceconstant{leftwidth}{largeurgauche} +\setinterfaceconstant{level}{niveau} +\setinterfaceconstant{levels}{niveaux} +\setinterfaceconstant{limittext}{limittext} +\setinterfaceconstant{line}{ligne} +\setinterfaceconstant{linecorrection}{correctionligne} +\setinterfaceconstant{lines}{lignes} +\setinterfaceconstant{list}{liste} +\setinterfaceconstant{listtext}{texteliste} +\setinterfaceconstant{local}{local} +\setinterfaceconstant{location}{emplacement} +\setinterfaceconstant{logo}{logo} +\setinterfaceconstant{logos}{logos} +\setinterfaceconstant{marcolor}{couleurmarquage} +\setinterfaceconstant{margin}{marge} +\setinterfaceconstant{margindistance}{distancemarge} +\setinterfaceconstant{marginedge}{bordmarge} +\setinterfaceconstant{marginedgetext}{textebordmarge} +\setinterfaceconstant{margintext}{textemarge} +\setinterfaceconstant{marking}{marquage} +\setinterfaceconstant{marstyle}{stylemarquage} +\setinterfaceconstant{mask}{mask} +\setinterfaceconstant{max}{max} +\setinterfaceconstant{maxdepth}{maxdepth} +\setinterfaceconstant{maxheight}{hauteurmax} +\setinterfaceconstant{maxwidth}{largeurmax} +\setinterfaceconstant{maybeyear}{maybeyear} +\setinterfaceconstant{menu}{menu} +\setinterfaceconstant{method}{methode} +\setinterfaceconstant{middle}{milieu} +\setinterfaceconstant{middlespeech}{middlespeech} +\setinterfaceconstant{middletext}{textecentre} +\setinterfaceconstant{midsentence}{midsentence} +\setinterfaceconstant{min}{min} +\setinterfaceconstant{mindepth}{profondeurmin} +\setinterfaceconstant{minheight}{hauteurmin} +\setinterfaceconstant{minwidth}{largeurmin} +\setinterfaceconstant{monthconversion}{monthconversion} +\setinterfaceconstant{n}{n} +\setinterfaceconstant{name}{nom} +\setinterfaceconstant{namesep}{namesep} +\setinterfaceconstant{nbottom}{ninf} +\setinterfaceconstant{nc}{nc} +\setinterfaceconstant{next}{suivant} +\setinterfaceconstant{nl}{nl} +\setinterfaceconstant{nleft}{ngauche} +\setinterfaceconstant{nlines}{nlignes} +\setinterfaceconstant{norm}{norme} +\setinterfaceconstant{nr}{nr} +\setinterfaceconstant{nright}{ndroite} +\setinterfaceconstant{ntop}{nsup} +\setinterfaceconstant{number}{numero} +\setinterfaceconstant{numbercolor}{couleurnumero} +\setinterfaceconstant{numbercommand}{commandenumero} +\setinterfaceconstant{numberconversion}{numberconversion} +\setinterfaceconstant{numberconversionset}{numberconversionset} +\setinterfaceconstant{numberdistance}{numberdistance} +\setinterfaceconstant{numbering}{numerotation} +\setinterfaceconstant{numberorder}{numberorder} +\setinterfaceconstant{numberprefix}{numberprefix} +\setinterfaceconstant{numbersegments}{numbersegments} +\setinterfaceconstant{numberseparator}{separateurnumbero} +\setinterfaceconstant{numberseparatorset}{numberseparatorset} +\setinterfaceconstant{numberset}{numberset} +\setinterfaceconstant{numberstarter}{numberstarter} +\setinterfaceconstant{numberstopper}{numberstopper} +\setinterfaceconstant{numberstyle}{stylenumero} +\setinterfaceconstant{numberwidth}{numberwidth} +\setinterfaceconstant{nx}{nx} +\setinterfaceconstant{ny}{ny} +\setinterfaceconstant{object}{objet} +\setinterfaceconstant{obstruction}{obstruction} +\setinterfaceconstant{oddmargin}{margepaire} +\setinterfaceconstant{offset}{offset} +\setinterfaceconstant{openaction}{actionouverture} +\setinterfaceconstant{openpage}{openpage} +\setinterfaceconstant{openpageaction}{actionouverturepage} +\setinterfaceconstant{option}{option} +\setinterfaceconstant{order}{order} +\setinterfaceconstant{orientation}{orientation} +\setinterfaceconstant{otherstext}{otherstext} +\setinterfaceconstant{outermargin}{margeexterieure} +\setinterfaceconstant{overprint}{overprint} +\setinterfaceconstant{ownnumber}{numeroproprio} +\setinterfaceconstant{page}{page} +\setinterfaceconstant{pageboundaries}{limitespage} +\setinterfaceconstant{pagecolor}{couleurpage} +\setinterfaceconstant{pagecommand}{commandepage} +\setinterfaceconstant{pageconversion}{pageconversion} +\setinterfaceconstant{pageconversionset}{pageconversionset} +\setinterfaceconstant{pagenumber}{numeropage} +\setinterfaceconstant{pageprefix}{pageprefix} +\setinterfaceconstant{pageprefixconnector}{pageprefixconnector} +\setinterfaceconstant{pageprefixconversion}{pageprefixconversion} +\setinterfaceconstant{pageprefixconversionset}{pageprefixconversionset} +\setinterfaceconstant{pageprefixsegments}{pageprefixsegments} +\setinterfaceconstant{pageprefixseparatorset}{pageprefixseparatorset} +\setinterfaceconstant{pageprefixset}{pageprefixset} +\setinterfaceconstant{pageprefixstarter}{pageprefixstarter} +\setinterfaceconstant{pageprefixstopper}{pageprefixstopper} +\setinterfaceconstant{pagesegments}{pagesegments} +\setinterfaceconstant{pageseparatorset}{pageseparatorset} +\setinterfaceconstant{pageset}{pageset} +\setinterfaceconstant{pagestarter}{pagestarter} +\setinterfaceconstant{pagestate}{etatpage} +\setinterfaceconstant{pagestopper}{pagestopper} +\setinterfaceconstant{pagestyle}{stylepage} +\setinterfaceconstant{palet}{palette} +\setinterfaceconstant{paper}{papier} +\setinterfaceconstant{paragraph}{paragraphe} +\setinterfaceconstant{place}{place} +\setinterfaceconstant{placehead}{placetete} +\setinterfaceconstant{placestopper}{emplacementstopper} +\setinterfaceconstant{position}{position} +\setinterfaceconstant{prefix}{prefixe} +\setinterfaceconstant{prefixconnector}{prefixconnector} +\setinterfaceconstant{prefixconversion}{prefixconversion} +\setinterfaceconstant{prefixconversionset}{prefixconversionset} +\setinterfaceconstant{prefixsegments}{prefixsegments} +\setinterfaceconstant{prefixseparatorset}{prefixseparatorset} +\setinterfaceconstant{prefixset}{prefixset} +\setinterfaceconstant{prefixstarter}{prefixstarter} +\setinterfaceconstant{prefixstopper}{prefixstopper} +\setinterfaceconstant{preset}{prereglage} +\setinterfaceconstant{preview}{previsualisation} +\setinterfaceconstant{previous}{precedent} +\setinterfaceconstant{previousnumber}{numeroprecedent} +\setinterfaceconstant{process}{process} +\setinterfaceconstant{profile}{profile} +\setinterfaceconstant{pubsep}{pubsep} +\setinterfaceconstant{radius}{rayon} +\setinterfaceconstant{random}{aleatoire} +\setinterfaceconstant{range}{range} +\setinterfaceconstant{reduction}{reduction} +\setinterfaceconstant{ref}{ref} +\setinterfaceconstant{refcommand}{refcommand} +\setinterfaceconstant{reference}{reference} +\setinterfaceconstant{referenceprefix}{referenceprefix} +\setinterfaceconstant{referencing}{referencing} +\setinterfaceconstant{regionin}{entreregion} +\setinterfaceconstant{regionout}{regionexterieure} +\setinterfaceconstant{repeat}{repete} +\setinterfaceconstant{reset}{reset} +\setinterfaceconstant{resetnumber}{raznumero} +\setinterfaceconstant{resolution}{resolution} +\setinterfaceconstant{right}{droite} +\setinterfaceconstant{rightcolor}{couleurdroite} +\setinterfaceconstant{rightcompoundhyphen}{rightcompoundhyphen} +\setinterfaceconstant{rightedge}{borddroit} +\setinterfaceconstant{rightedgedistance}{distanceborddroit} +\setinterfaceconstant{rightframe}{cadredroit} +\setinterfaceconstant{righthyphen}{righthyphen} +\setinterfaceconstant{rightmargin}{margedroite} +\setinterfaceconstant{rightmargindistance}{distancemargedroite} +\setinterfaceconstant{rightoffset}{rightoffset} +\setinterfaceconstant{rightquotation}{citationdroite} +\setinterfaceconstant{rightquote}{citerdroite} +\setinterfaceconstant{rightsentence}{phrasedroite} +\setinterfaceconstant{rightspeech}{rightspeech} +\setinterfaceconstant{rightstyle}{styledroit} +\setinterfaceconstant{rightsubsentence}{sousphrasedroite} +\setinterfaceconstant{righttext}{textedroit} +\setinterfaceconstant{rightwidth}{largeurdroite} +\setinterfaceconstant{rotation}{rotation} +\setinterfaceconstant{rule}{ligne} +\setinterfaceconstant{rulecolor}{couleurligne} +\setinterfaceconstant{rulethickness}{epaisseurligne} +\setinterfaceconstant{samepage}{memepage} +\setinterfaceconstant{sample}{echantillon} +\setinterfaceconstant{samplesize}{samplesize} +\setinterfaceconstant{saveinlist}{saveinlist} +\setinterfaceconstant{scale}{echelle} +\setinterfaceconstant{scope}{scope} +\setinterfaceconstant{screen}{ecran} +\setinterfaceconstant{section}{section} +\setinterfaceconstant{sectionconversion}{sectionconversion} +\setinterfaceconstant{sectionconversionset}{sectionconversionset} +\setinterfaceconstant{sectionnumber}{numerosection} +\setinterfaceconstant{sectionresetset}{sectionresetset} +\setinterfaceconstant{sectionsegments}{sectionsegments} +\setinterfaceconstant{sectionseparatorset}{sectionseparatorset} +\setinterfaceconstant{sectionset}{sectionset} +\setinterfaceconstant{sectionstarter}{sectionstarter} +\setinterfaceconstant{sectionstopper}{sectionstopper} +\setinterfaceconstant{separator}{separateur} +\setinterfaceconstant{set}{set} +\setinterfaceconstant{setups}{reglages} +\setinterfaceconstant{side}{cote} +\setinterfaceconstant{sidealign}{sidealign} +\setinterfaceconstant{sidemethod}{sidemethod} +\setinterfaceconstant{sidespaceafter}{espacelateralapres} +\setinterfaceconstant{sidespacebefore}{espacelateralavant} +\setinterfaceconstant{sign}{signe} +\setinterfaceconstant{size}{dimension} +\setinterfaceconstant{small}{petit} +\setinterfaceconstant{sort}{sort} +\setinterfaceconstant{sorttype}{sorttype} +\setinterfaceconstant{source}{origine} +\setinterfaceconstant{space}{espace} +\setinterfaceconstant{spaceafter}{espaceapres} +\setinterfaceconstant{spacebefore}{espaceavant} +\setinterfaceconstant{spaceinbetween}{spaceinbetween} +\setinterfaceconstant{spacing}{espacement} +\setinterfaceconstant{split}{split} +\setinterfaceconstant{splitcolor}{splitcolor} +\setinterfaceconstant{splitmethod}{splitmethod} +\setinterfaceconstant{splitoffset}{splitoffset} +\setinterfaceconstant{spot}{spot} +\setinterfaceconstant{stack}{stack} +\setinterfaceconstant{start}{demarre} +\setinterfaceconstant{starter}{starter} +\setinterfaceconstant{state}{etat} +\setinterfaceconstant{step}{pas} +\setinterfaceconstant{stop}{stoppe} +\setinterfaceconstant{stopper}{taquet} +\setinterfaceconstant{stretch}{etire} +\setinterfaceconstant{strip}{strip} +\setinterfaceconstant{strut}{strut} +\setinterfaceconstant{style}{style} +\setinterfaceconstant{sub}{sous} +\setinterfaceconstant{subtitle}{soustitre} +\setinterfaceconstant{suffix}{suffix} +\setinterfaceconstant{suffixseparator}{suffixseparator} +\setinterfaceconstant{surnamesep}{surnamesep} +\setinterfaceconstant{sx}{sx} +\setinterfaceconstant{sy}{sy} +\setinterfaceconstant{symalign}{symalignement} +\setinterfaceconstant{symbol}{symbole} +\setinterfaceconstant{symbolset}{jeusymbole} +\setinterfaceconstant{symcolor}{couleursym} +\setinterfaceconstant{symstyle}{stylesym} +\setinterfaceconstant{synonym}{synonyme} +\setinterfaceconstant{synonymcolor}{couleursynonyme} +\setinterfaceconstant{synonymcommand}{synonymcommand} +\setinterfaceconstant{synonymstyle}{stylesynonyme} +\setinterfaceconstant{tab}{tab} +\setinterfaceconstant{text}{texte} +\setinterfaceconstant{textcolor}{couleurtexte} +\setinterfaceconstant{textcommand}{commandetexte} +\setinterfaceconstant{textdistance}{distancetexte} +\setinterfaceconstant{textlayer}{calquetexte} +\setinterfaceconstant{textmargin}{margetexte} +\setinterfaceconstant{textmethod}{textmethod} +\setinterfaceconstant{textseparator}{separateurtexte} +\setinterfaceconstant{textsize}{tailletexte} +\setinterfaceconstant{textstate}{etattexte} +\setinterfaceconstant{textstyle}{styletexte} +\setinterfaceconstant{textwidth}{largeurtexte} +\setinterfaceconstant{threshold}{threshold} +\setinterfaceconstant{title}{titre} +\setinterfaceconstant{titlecolor}{couleurtitre} +\setinterfaceconstant{titlecommand}{titlecommand} +\setinterfaceconstant{titledistance}{distancetitre} +\setinterfaceconstant{titleleft}{titleleft} +\setinterfaceconstant{titleright}{titleright} +\setinterfaceconstant{titlestyle}{styletitre} +\setinterfaceconstant{to}{vers} +\setinterfaceconstant{tolerance}{tolerance} +\setinterfaceconstant{top}{sup} +\setinterfaceconstant{topdistance}{distancesup} +\setinterfaceconstant{topframe}{cadresup} +\setinterfaceconstant{topoffset}{decalagesup} +\setinterfaceconstant{topspace}{espacesup} +\setinterfaceconstant{topstate}{etatsup} +\setinterfaceconstant{totalnumber}{totalnumber} +\setinterfaceconstant{type}{type} +\setinterfaceconstant{unit}{unite} +\setinterfaceconstant{unknownreference}{referenceinconnue} +\setinterfaceconstant{urlalternative}{alternativeurl} +\setinterfaceconstant{urlspace}{espaceurl} +\setinterfaceconstant{validate}{valider} +\setinterfaceconstant{values}{values} +\setinterfaceconstant{vcommand}{vcommande} +\setinterfaceconstant{veroffset}{veroffset} +\setinterfaceconstant{vfil}{vfil} +\setinterfaceconstant{voffset}{voffset} +\setinterfaceconstant{vonsep}{vonsep} +\setinterfaceconstant{way}{mode} +\setinterfaceconstant{wfactor}{facteurlargeur} +\setinterfaceconstant{white}{blanc} +\setinterfaceconstant{width}{largeur} +\setinterfaceconstant{xfactor}{xfactor} +\setinterfaceconstant{xmax}{xmax} +\setinterfaceconstant{xoffset}{xoffset} +\setinterfaceconstant{xscale}{xscale} +\setinterfaceconstant{xstep}{xstep} +\setinterfaceconstant{yfactor}{yfactor} +\setinterfaceconstant{ymax}{ymax} +\setinterfaceconstant{yoffset}{yoffset} +\setinterfaceconstant{yscale}{yscale} +\setinterfaceconstant{ystep}{ystep} +% definitions for interface elements for language fr +% +\setinterfaceelement{answerlines}{answerlines} +\setinterfaceelement{answerspace}{answerspace} +\setinterfaceelement{begin}{debut} +\setinterfaceelement{complete}{complete} +\setinterfaceelement{coupled}{couple} +\setinterfaceelement{currentlocal}{localcourant} +\setinterfaceelement{emptyone}{vide} +\setinterfaceelement{emptytwo}{vide} +\setinterfaceelement{end}{fin} +\setinterfaceelement{endsetup}{} +\setinterfaceelement{get}{obtient} +\setinterfaceelement{increment}{incremente} +\setinterfaceelement{list}{liste} +\setinterfaceelement{listof}{listede} +\setinterfaceelement{load}{charge} +\setinterfaceelement{local}{local} +\setinterfaceelement{makeup}{makeup} +\setinterfaceelement{next}{suivant} +\setinterfaceelement{place}{place} +\setinterfaceelement{previous}{precedent} +\setinterfaceelement{previouslocal}{localprecedent} +\setinterfaceelement{reserve}{reserver} +\setinterfaceelement{see}{voit} +\setinterfaceelement{setup}{regle} +\setinterfaceelement{start}{demarre} +\setinterfaceelement{stop}{stoppe} +\setinterfaceelement{text}{texte} +\setinterfaceelement{type}{type} +% definitions for interface commands for language fr +% +\setinterfacecommand{CAPPED}{CAP} +\setinterfacecommand{Character}{Caractere} +\setinterfacecommand{Characters}{Caracteres} +\setinterfacecommand{MONTH}{MOIS} +\setinterfacecommand{Numbers}{Numeros} +\setinterfacecommand{Romannumerals}{Chiffresromains} +\setinterfacecommand{SmallCapped}{Cap} +\setinterfacecommand{SmallCaps}{Caps} +\setinterfacecommand{WEEKDAY}{JOURSEMAINE} +\setinterfacecommand{WORD}{MOT} +\setinterfacecommand{WORDS}{MOTS} +\setinterfacecommand{Word}{Mot} +\setinterfacecommand{Words}{Mots} +\setinterfacecommand{about}{concernant} +\setinterfacecommand{adaptlayout}{adaptedisposition} +\setinterfacecommand{arg}{arg} +\setinterfacecommand{at}{a} +\setinterfacecommand{atleftmargin}{atleftmargin} +\setinterfacecommand{atpage}{alapage} +\setinterfacecommand{atrightmargin}{atrightmargin} +\setinterfacecommand{background}{arriereplan} +\setinterfacecommand{backspace}{retourarriere} +\setinterfacecommand{blackrule}{lignenoire} +\setinterfacecommand{blackrules}{lignesnoires} +\setinterfacecommand{blank}{vide} +\setinterfacecommand{bookmark}{marquepage} +\setinterfacecommand{bottomdistance}{distanceinf} +\setinterfacecommand{bottomheight}{hauteurinf} +\setinterfacecommand{bottomspace}{espaceinf} +\setinterfacecommand{but}{but} +\setinterfacecommand{button}{bouton} +\setinterfacecommand{bypassblocks}{sauteblocs} +\setinterfacecommand{character}{caractere} +\setinterfacecommand{characters}{caracteres} +\setinterfacecommand{chem}{chem} +\setinterfacecommand{clip}{clip} +\setinterfacecommand{clonefield}{clonechamp} +\setinterfacecommand{color}{couleur} +\setinterfacecommand{colorbar}{barrecouleur} +\setinterfacecommand{colorvalue}{valeurcouleur} +\setinterfacecommand{column}{colonne} +\setinterfacecommand{comparecolorgroup}{comparegroupecouleur} +\setinterfacecommand{comparepalet}{comparepalette} +\setinterfacecommand{completepagenumber}{completenumeropage} +\setinterfacecommand{completeregister}{completeregistre} +\setinterfacecommand{component}{composant} +\setinterfacecommand{convertnumber}{convertitnumero} +\setinterfacecommand{copyfield}{copitchamp} +\setinterfacecommand{correctwhitespace}{corrigeespaceblanc} +\setinterfacecommand{coupledocument}{coupledocument} +\setinterfacecommand{couplemarking}{couplemarquage} +\setinterfacecommand{couplepage}{pagedouble} +\setinterfacecommand{couplepaper}{couplepapier} +\setinterfacecommand{coupleregister}{coupleregistre} +\setinterfacecommand{crlf}{crlf} +\setinterfacecommand{currentdate}{datecourante} +\setinterfacecommand{currentheadnumber}{numerotetecourant} +\setinterfacecommand{cutspace}{cutspace} +\setinterfacecommand{date}{date} +\setinterfacecommand{decouplemarking}{decouplemarquage} +\setinterfacecommand{decrementnumber}{decrementenumero} +\setinterfacecommand{define}{definit} +\setinterfacecommand{defineaccent}{definitaccent} +\setinterfacecommand{defineblank}{definitvide} +\setinterfacecommand{defineblock}{definitbloc} +\setinterfacecommand{definebodyfont}{definitpolicecorps} +\setinterfacecommand{definebodyfontenvironment}{definitenvironnementpolicecorps} +\setinterfacecommand{definebuffer}{definitbuffer} +\setinterfacecommand{definecharacter}{definicaractere} +\setinterfacecommand{definecolor}{definitcouleur} +\setinterfacecommand{definecolorgroup}{definitgroupecouleur} +\setinterfacecommand{definecolumnbreak}{definitsautdecolonne} +\setinterfacecommand{definecolumnset}{definitjeucolonne} +\setinterfacecommand{definecombination}{definecombination} +\setinterfacecommand{definecombinedlist}{definitlisteimbriquee} +\setinterfacecommand{definecommand}{definitcommande} +\setinterfacecommand{defineconversion}{definitconversion} +\setinterfacecommand{definedescription}{definitdescription} +\setinterfacecommand{defineenumeration}{definitenumeration} +\setinterfacecommand{definefield}{definitchamp} +\setinterfacecommand{definefieldstack}{definitpilechamp} +\setinterfacecommand{definefiguresymbol}{definitsymbolefigure} +\setinterfacecommand{definefloat}{definitflottant} +\setinterfacecommand{definefont}{definitpolice} +\setinterfacecommand{definefontstyle}{definitstylepolice} +\setinterfacecommand{definefontsynonym}{definitsynonymepolice} +\setinterfacecommand{defineframed}{defineframed} +\setinterfacecommand{defineframedtext}{defineframedtext} +\setinterfacecommand{definehbox}{definithbox} +\setinterfacecommand{definehead}{definittete} +\setinterfacecommand{defineindenting}{definitcompoalinea} +\setinterfacecommand{defineinmargin}{definitdansmarge} +\setinterfacecommand{defineinteractionmenu}{definitmenuinteraction} +\setinterfacecommand{defineitemgroup}{defineitemgroup} +\setinterfacecommand{definelabel}{definitetiquette} +\setinterfacecommand{definelayer}{definitcalque} +\setinterfacecommand{definelayout}{definitdisposition} +\setinterfacecommand{definelist}{definitliste} +\setinterfacecommand{definelogo}{definitlogo} +\setinterfacecommand{definemainfield}{definitchampprincipal} +\setinterfacecommand{definemakeup}{definitmakeup} +\setinterfacecommand{definemarking}{definitmarquage} +\setinterfacecommand{definemathalignment}{definemathalignment} +\setinterfacecommand{defineoutput}{definitsortie} +\setinterfacecommand{defineoverlay}{definitrevetement} +\setinterfacecommand{definepagebreak}{definitsautdepage} +\setinterfacecommand{definepalet}{definitpalette} +\setinterfacecommand{definepapersize}{definittaillepapier} +\setinterfacecommand{defineparagraphs}{definitparagraphes} +\setinterfacecommand{defineplacement}{defineplacement} +\setinterfacecommand{defineprofile}{definitprofil} +\setinterfacecommand{defineprogram}{definitprogramme} +\setinterfacecommand{definerawfont}{definitpolicebrute} +\setinterfacecommand{definereference}{definitreference} +\setinterfacecommand{definereferenceformat}{definitformatreference} +\setinterfacecommand{definereferencelist}{definitlistereference} +\setinterfacecommand{defineregister}{definitregistre} +\setinterfacecommand{definerule}{definitregle} +\setinterfacecommand{definesection}{definitsection} +\setinterfacecommand{definesectionblock}{definitblocsection} +\setinterfacecommand{definesorting}{definittri} +\setinterfacecommand{definestartstop}{definitdemarrestoppe} +\setinterfacecommand{definestyle}{definitstyle} +\setinterfacecommand{definesubfield}{definitsouschamp} +\setinterfacecommand{definesymbol}{definitsymbole} +\setinterfacecommand{definesynonyms}{definitsynonymes} +\setinterfacecommand{definetabletemplate}{definittrametableau} +\setinterfacecommand{definetabulate}{definittabulation} +\setinterfacecommand{definetext}{definittexte} +\setinterfacecommand{definetextposition}{definitpositiontexte} +\setinterfacecommand{definetextvariable}{definitvariabletexte} +\setinterfacecommand{definetype}{definittype} +\setinterfacecommand{definetyping}{definitdactylo} +\setinterfacecommand{defineversion}{definitversion} +\setinterfacecommand{determineheadnumber}{determinenumerotete} +\setinterfacecommand{determinelistcharacteristics}{determinecaracteristiqueliste} +\setinterfacecommand{determineregistercharacteristics}{determinecaracteristiquesregistre} +\setinterfacecommand{dimension}{dimension} +\setinterfacecommand{disableinteractionmenu}{inhibemenuinteraction} +\setinterfacecommand{domicile}{domicile} +\setinterfacecommand{donttest}{sanstest} +\setinterfacecommand{edgedistance}{distancebord} +\setinterfacecommand{edgewidth}{largeurbord} +\setinterfacecommand{emptylines}{emptylines} +\setinterfacecommand{environment}{environement} +\setinterfacecommand{externalfigure}{figureexterne} +\setinterfacecommand{fact}{fait} +\setinterfacecommand{field}{champ} +\setinterfacecommand{fieldstack}{pilechamp} +\setinterfacecommand{fillinfield}{remplitchamp} +\setinterfacecommand{fillinline}{remplitligne} +\setinterfacecommand{fillinrules}{remplitlignesreglees} +\setinterfacecommand{fillintext}{remplittexte} +\setinterfacecommand{fitfield}{ajustechamp} +\setinterfacecommand{fixedspace}{espacefixe} +\setinterfacecommand{fixedspaces}{espacesfixes} +\setinterfacecommand{followprofile}{suivantprofil} +\setinterfacecommand{followprofileversion}{suivantversionprofil} +\setinterfacecommand{followversion}{suivantversion} +\setinterfacecommand{footerdistance}{distancepdp} +\setinterfacecommand{footerheight}{hauteurpdp} +\setinterfacecommand{footnote}{notepdp} +\setinterfacecommand{footnotetext}{textenotepdp} +\setinterfacecommand{forceblocks}{forceblocs} +\setinterfacecommand{formulanumber}{numeroformule} +\setinterfacecommand{fraction}{fraction} +\setinterfacecommand{framed}{framed} +\setinterfacecommand{from}{de} +\setinterfacecommand{getbuffer}{prendbuffer} +\setinterfacecommand{getmarking}{obtientmarquage} +\setinterfacecommand{getnumber}{getnumber} +\setinterfacecommand{godown}{vaenbas} +\setinterfacecommand{goto}{va} +\setinterfacecommand{gotobox}{vaalaboite} +\setinterfacecommand{gotopage}{vaalapage} +\setinterfacecommand{graycolor}{couleurgrise} +\setinterfacecommand{greyvalue}{valeurgris} +\setinterfacecommand{grid}{grille} +\setinterfacecommand{hairline}{ligneh} +\setinterfacecommand{head}{tete} +\setinterfacecommand{headerdistance}{distanceentete} +\setinterfacecommand{headerheight}{hauteurentete} +\setinterfacecommand{headlevel}{niveautete} +\setinterfacecommand{headnumber}{numerotete} +\setinterfacecommand{headsym}{headsym} +\setinterfacecommand{headtext}{textetete} +\setinterfacecommand{hideblocks}{cacheblocs} +\setinterfacecommand{high}{haut} +\setinterfacecommand{hl}{hl} +\setinterfacecommand{immediatebetweenlist}{immediatebetweenlist} +\setinterfacecommand{immediatetolist}{immediatetolist} +\setinterfacecommand{in}{dans} +\setinterfacecommand{incrementnumber}{incrementenumero} +\setinterfacecommand{indenting}{composeenalinea} +\setinterfacecommand{inframed}{inframed} +\setinterfacecommand{infull}{infull} +\setinterfacecommand{ininner}{ininner} +\setinterfacecommand{inleft}{dansgauche} +\setinterfacecommand{inleftedge}{dansbordgauche} +\setinterfacecommand{inleftmargin}{dansmargegauche} +\setinterfacecommand{inline}{alaligne} +\setinterfacecommand{inmargin}{dansmarge} +\setinterfacecommand{inmframed}{inmframed} +\setinterfacecommand{inneredgedistance}{inneredgedistance} +\setinterfacecommand{inneredgewidth}{inneredgewidth} +\setinterfacecommand{innermargindistance}{innermargindistance} +\setinterfacecommand{innermarginwidth}{innermarginwidth} +\setinterfacecommand{inothermargin}{dansautremarge} +\setinterfacecommand{inouter}{inouter} +\setinterfacecommand{inright}{dansdroite} +\setinterfacecommand{inrightedge}{dansborddroit} +\setinterfacecommand{inrightmargin}{dansmargedroite} +\setinterfacecommand{installlanguage}{installelangue} +\setinterfacecommand{interactionbar}{barreinteraction} +\setinterfacecommand{interactionbuttons}{boutonsinteraction} +\setinterfacecommand{interactionmenu}{menuinteraction} +\setinterfacecommand{item}{element} +\setinterfacecommand{items}{elements} +\setinterfacecommand{its}{el} +\setinterfacecommand{keepblocks}{gardeblocs} +\setinterfacecommand{label}{etiquette} +\setinterfacecommand{labels}{etiquettes} +\setinterfacecommand{labeltext}{labeltexte} +\setinterfacecommand{language}{langue} +\setinterfacecommand{leftaligned}{aligneagauche} +\setinterfacecommand{leftedgedistance}{distancebordgauche} +\setinterfacecommand{leftedgewidth}{largeurbordgauche} +\setinterfacecommand{leftmargindistance}{distancemargegauche} +\setinterfacecommand{leftmarginwidth}{largeurmargegauche} +\setinterfacecommand{leg}{leg} +\setinterfacecommand{linewidth}{largeurligne} +\setinterfacecommand{listheight}{hauteurliste} +\setinterfacecommand{listlength}{llongueurliste} +\setinterfacecommand{listsymbol}{listesymbole} +\setinterfacecommand{listwidth}{largeurliste} +\setinterfacecommand{logfields}{logchamp} +\setinterfacecommand{lohi}{baha} +\setinterfacecommand{low}{bas} +\setinterfacecommand{macroname}{nommacro} +\setinterfacecommand{mainlanguage}{langueprincipale} +\setinterfacecommand{makeupheight}{hauteurmakeup} +\setinterfacecommand{makeupwidth}{largeurmakeup} +\setinterfacecommand{mar}{mar} +\setinterfacecommand{margindistance}{distancemarge} +\setinterfacecommand{marginrule}{margereglee} +\setinterfacecommand{margintext}{textemarge} +\setinterfacecommand{margintitle}{titremarge} +\setinterfacecommand{marginwidth}{largeurmarge} +\setinterfacecommand{marginword}{motmarge} +\setinterfacecommand{marking}{marquage} +\setinterfacecommand{markversion}{marquageversion} +\setinterfacecommand{mathematics}{mathematique} +\setinterfacecommand{menubutton}{boutonmenu} +\setinterfacecommand{mframed}{mframed} +\setinterfacecommand{midaligned}{aligneaumilieu} +\setinterfacecommand{mirror}{reflete} +\setinterfacecommand{month}{mois} +\setinterfacecommand{moveformula}{deplaceformule} +\setinterfacecommand{moveongrid}{deplacesurgrille} +\setinterfacecommand{movesidefloat}{movesidefloat} +\setinterfacecommand{navigating}{navigating} +\setinterfacecommand{nodimension}{sansdimension} +\setinterfacecommand{noheaderandfooterlines}{sanslignesenteteetpdp} +\setinterfacecommand{noindenting}{sansalinea} +\setinterfacecommand{nolist}{sansliste} +\setinterfacecommand{nomarking}{sansmarquage} +\setinterfacecommand{nomoreblocks}{pasplusdeblocs} +\setinterfacecommand{nomorefiles}{pasplusdefichiers} +\setinterfacecommand{nop}{nop} +\setinterfacecommand{nospace}{sansespace} +\setinterfacecommand{note}{note} +\setinterfacecommand{notopandbottomlines}{sanslignessupetinf} +\setinterfacecommand{notsmallcapped}{nocap} +\setinterfacecommand{nowhitespace}{sansespaceblanc} +\setinterfacecommand{numberofsubpages}{nombredesouspages} +\setinterfacecommand{numbers}{numeros} +\setinterfacecommand{outeredgedistance}{outeredgedistance} +\setinterfacecommand{outeredgewidth}{outeredgewidth} +\setinterfacecommand{outermargindistance}{outermargindistance} +\setinterfacecommand{outermarginwidth}{outermarginwidth} +\setinterfacecommand{packed}{groupe} +\setinterfacecommand{page}{page} +\setinterfacecommand{pagedepth}{pagedepth} +\setinterfacecommand{pagenumber}{numeropage} +\setinterfacecommand{pageoffset}{pageoffset} +\setinterfacecommand{pagereference}{referencepage} +\setinterfacecommand{pagetype}{tapepage} +\setinterfacecommand{paperheight}{hauteurpapier} +\setinterfacecommand{paperwidth}{largeurpapier} +\setinterfacecommand{periods}{periodes} +\setinterfacecommand{plaatsruwelijst}{placerawlist} +\setinterfacecommand{placebookmarks}{placemarquespages} +\setinterfacecommand{placecombinedlist}{placelisteinmbriquee} +\setinterfacecommand{placefloat}{placeflottant} +\setinterfacecommand{placefootnotes}{placenotespdp} +\setinterfacecommand{placeformula}{placeformule} +\setinterfacecommand{placeheadnumber}{placenumerotete} +\setinterfacecommand{placeheadtext}{placetextetete} +\setinterfacecommand{placelegend}{placelegende} +\setinterfacecommand{placelist}{placeliste} +\setinterfacecommand{placelocalfootnotes}{placenotespdplocales} +\setinterfacecommand{placelogos}{placelogos} +\setinterfacecommand{placeongrid}{placesurgrille} +\setinterfacecommand{placeontopofeachother}{placelesunsaudessusdesautres} +\setinterfacecommand{placepagenumber}{placenumeropage} +\setinterfacecommand{placereferencelist}{placelistereference} +\setinterfacecommand{placeregister}{placeregistre} +\setinterfacecommand{placerule}{placeregle} +\setinterfacecommand{placesidebyside}{placecoteacote} +\setinterfacecommand{placesubformula}{placesousformule} +\setinterfacecommand{placetextvariable}{placevariabletexte} +\setinterfacecommand{position}{position} +\setinterfacecommand{positiontext}{positionnetexte} +\setinterfacecommand{printpaperheight}{hauteureditionpapier} +\setinterfacecommand{printpaperwidth}{largeureditionpapier} +\setinterfacecommand{processblocks}{traiteblocs} +\setinterfacecommand{processpage}{traitepage} +\setinterfacecommand{product}{produit} +\setinterfacecommand{program}{programme} +\setinterfacecommand{project}{projet} +\setinterfacecommand{publication}{publication} +\setinterfacecommand{quotation}{citation} +\setinterfacecommand{quote}{citer} +\setinterfacecommand{ran}{ran} +\setinterfacecommand{redo}{refait} +\setinterfacecommand{ref}{ref} +\setinterfacecommand{reference}{reference} +\setinterfacecommand{referral}{recommandation} +\setinterfacecommand{referraldate}{daterecommandation} +\setinterfacecommand{referring}{faitreference} +\setinterfacecommand{remark}{commentaire} +\setinterfacecommand{reset}{raz} +\setinterfacecommand{resetmarking}{razmarquage} +\setinterfacecommand{resetnumber}{raznumero} +\setinterfacecommand{resettext}{resettextcontent} +\setinterfacecommand{rightaligned}{aligneadroite} +\setinterfacecommand{rightedgedistance}{distanceborddroit} +\setinterfacecommand{rightedgewidth}{largeurborddroit} +\setinterfacecommand{rightmargindistance}{distancemargedroite} +\setinterfacecommand{rightmarginwidth}{largeurmargedroite} +\setinterfacecommand{romannumerals}{chiffresromains} +\setinterfacecommand{rotate}{oriente} +\setinterfacecommand{scale}{echelle} +\setinterfacecommand{screen}{ecran} +\setinterfacecommand{selectblocks}{selectionneblocs} +\setinterfacecommand{selectpaper}{selectionnepapier} +\setinterfacecommand{selectversion}{selectionneversion} +\setinterfacecommand{setnumber}{affectenumero} +\setinterfacecommand{settextcontent}{settext} +\setinterfacecommand{settextvariable}{affectevariabletexte} +\setinterfacecommand{setupalign}{reglealignement} +\setinterfacecommand{setupanswerarea}{setupanswerarea} +\setinterfacecommand{setuparranging}{reglearrangement} +\setinterfacecommand{setupbackground}{reglearriereplan} +\setinterfacecommand{setupbackgrounds}{reglearriereplans} +\setinterfacecommand{setupblackrules}{reglelignesnoires} +\setinterfacecommand{setupblank}{definitvide} +\setinterfacecommand{setupblock}{reglebloc} +\setinterfacecommand{setupbodyfont}{reglepolicecorps} +\setinterfacecommand{setupbodyfontenvironment}{regleenvironnementpolicecorps} +\setinterfacecommand{setupbottom}{regleinf} +\setinterfacecommand{setupbottomtexts}{regletextesinf} +\setinterfacecommand{setupbuffer}{reglebuffer} +\setinterfacecommand{setupbuttons}{regleboutons} +\setinterfacecommand{setupcapitals}{reglecapitales} +\setinterfacecommand{setupcaption}{regleintitule} +\setinterfacecommand{setupcaptions}{regleintitules} +\setinterfacecommand{setupclipping}{regleclipping} +\setinterfacecommand{setupcolor}{reglecouleur} +\setinterfacecommand{setupcolors}{reglecouleurs} +\setinterfacecommand{setupcolumns}{reglecolonnes} +\setinterfacecommand{setupcolumnset}{reglejeucolonne} +\setinterfacecommand{setupcolumnsetlines}{setupcolumnsetlines} +\setinterfacecommand{setupcolumnsetstart}{setupcolumnsetstart} +\setinterfacecommand{setupcombinations}{reglecombinaisons} +\setinterfacecommand{setupcombinedlist}{reglelisteimbriquee} +\setinterfacecommand{setupcomment}{reglecommentaire} +\setinterfacecommand{setupdescriptions}{regledescriptions} +\setinterfacecommand{setupenumerations}{regleenumerations} +\setinterfacecommand{setupexternalfigures}{reglefiguresexternes} +\setinterfacecommand{setupfield}{reglechamp} +\setinterfacecommand{setupfields}{reglechamps} +\setinterfacecommand{setupfillinlines}{regleremplitligne} +\setinterfacecommand{setupfillinrules}{regleremplitlignesreglees} +\setinterfacecommand{setupfloat}{regleflottant} +\setinterfacecommand{setupfloats}{regleflottants} +\setinterfacecommand{setupfloatsplitting}{regleseparationflottant} +\setinterfacecommand{setupfooter}{reglepdp} +\setinterfacecommand{setupfootertexts}{regletextespdp} +\setinterfacecommand{setupfootnotedefinition}{definitnotepdp} +\setinterfacecommand{setupfootnotes}{reglenotepdp} +\setinterfacecommand{setupforms}{regleformulaires} +\setinterfacecommand{setupformulas}{regleformules} +\setinterfacecommand{setupframed}{regleencadre} +\setinterfacecommand{setupframedtexts}{setupframedtexts} +\setinterfacecommand{setuphead}{regletete} +\setinterfacecommand{setupheader}{regleentete} +\setinterfacecommand{setupheadertexts}{regletextesentete} +\setinterfacecommand{setupheadnumber}{reglenumerotete} +\setinterfacecommand{setupheads}{regletetes} +\setinterfacecommand{setupheadtext}{regletextetete} +\setinterfacecommand{setuphyphenmark}{reglemarquagehyphenation} +\setinterfacecommand{setupindentations}{reglealineas} +\setinterfacecommand{setupindenting}{reglecomposeenalinea} +\setinterfacecommand{setupinmargin}{regledansmarge} +\setinterfacecommand{setupinteraction}{regleinteraction} +\setinterfacecommand{setupinteractionbar}{reglebarreinteraction} +\setinterfacecommand{setupinteractionmenu}{reglemenuinteraction} +\setinterfacecommand{setupinteractionscreen}{regleecraninteraction} +\setinterfacecommand{setupinterlinespace}{regleespacementinterligne} +\setinterfacecommand{setupitemgroup}{setupitemgroup} +\setinterfacecommand{setupitemgroups}{reglegroupeselements} +\setinterfacecommand{setupitems}{regleelements} +\setinterfacecommand{setuplabeltext}{reglelabeltexte} +\setinterfacecommand{setuplanguage}{reglelangue} +\setinterfacecommand{setuplayout}{regledisposition} +\setinterfacecommand{setuplegend}{reglelegende} +\setinterfacecommand{setuplinenumbering}{reglenumerotationligne} +\setinterfacecommand{setuplines}{reglelignes} +\setinterfacecommand{setuplinewidth}{regleepaisseurligne} +\setinterfacecommand{setuplist}{regleliste} +\setinterfacecommand{setupmakeup}{reglemakeup} +\setinterfacecommand{setupmarginblocks}{regleblocmarge} +\setinterfacecommand{setupmarginrules}{reglemargereglee} +\setinterfacecommand{setupmarking}{reglemarquage} +\setinterfacecommand{setupmathalignment}{setupmathalignment} +\setinterfacecommand{setupnarrower}{reglecompoetroite} +\setinterfacecommand{setupnumber}{reglenumero} +\setinterfacecommand{setupnumbering}{reglenumerotation} +\setinterfacecommand{setupoppositeplacing}{regleplacementopposition} +\setinterfacecommand{setupoutput}{reglesortie} +\setinterfacecommand{setuppagecomment}{reglecommentairepage} +\setinterfacecommand{setuppagenumber}{reglenumeropage} +\setinterfacecommand{setuppagenumbering}{reglenumerotationpage} +\setinterfacecommand{setuppagetransitions}{regletransitionspage} +\setinterfacecommand{setuppalet}{reglepalette} +\setinterfacecommand{setuppaper}{reglepapier} +\setinterfacecommand{setuppapersize}{regletaillepapier} +\setinterfacecommand{setupparagraphnumbering}{reglenumerotationparagraphe} +\setinterfacecommand{setupparagraphs}{regleparagraphes} +\setinterfacecommand{setupplacement}{setupplacement} +\setinterfacecommand{setuppositioning}{reglepositionnement} +\setinterfacecommand{setupprofiles}{regleprofils} +\setinterfacecommand{setupprograms}{regleprogrammes} +\setinterfacecommand{setuppublications}{reglepublications} +\setinterfacecommand{setupquote}{demarreciter} +\setinterfacecommand{setupreferencelist}{reglelistereference} +\setinterfacecommand{setupreferencing}{reglereferencage} +\setinterfacecommand{setupregister}{regleregistre} +\setinterfacecommand{setuprotate}{regleoriente} +\setinterfacecommand{setuprule}{regleregle} +\setinterfacecommand{setups}{reglages} +\setinterfacecommand{setupscreens}{regleecrans} +\setinterfacecommand{setupsection}{reglesection} +\setinterfacecommand{setupsectionblock}{regleblocsection} +\setinterfacecommand{setupsorting}{regletri} +\setinterfacecommand{setupspacing}{regleespacement} +\setinterfacecommand{setupstartstop}{regledemarrestoppe} +\setinterfacecommand{setupstrut}{reglestrut} +\setinterfacecommand{setupsubpagenumber}{reglesousnumeropage} +\setinterfacecommand{setupsymbolset}{reglejeusymboles} +\setinterfacecommand{setupsynchronization}{reglesynchronisation} +\setinterfacecommand{setupsynchronizationbar}{reglebarresynchronisation} +\setinterfacecommand{setupsynonyms}{reglesynonymes} +\setinterfacecommand{setupsystem}{reglesysteme} +\setinterfacecommand{setuptab}{regletab} +\setinterfacecommand{setuptables}{regletableaux} +\setinterfacecommand{setuptabulate}{regletabulation} +\setinterfacecommand{setuptext}{regletexte} +\setinterfacecommand{setuptextposition}{reglepositiontexte} +\setinterfacecommand{setuptextrules}{reglelignesreglestexte} +\setinterfacecommand{setuptexttexts}{regletextestexte} +\setinterfacecommand{setuptextvariable}{reglevariabletexte} +\setinterfacecommand{setupthinrules}{regletraitsfins} +\setinterfacecommand{setuptolerance}{regletolerance} +\setinterfacecommand{setuptop}{reglesup} +\setinterfacecommand{setuptoptexts}{regletextessup} +\setinterfacecommand{setuptype}{regletype} +\setinterfacecommand{setuptyping}{regledactylo} +\setinterfacecommand{setupunderbar}{reglesouslignage} +\setinterfacecommand{setupurl}{regleurl} +\setinterfacecommand{setupversions}{regleversions} +\setinterfacecommand{setupwhitespace}{regleespaceblanc} +\setinterfacecommand{showbodyfont}{montrepolicecorps} +\setinterfacecommand{showbodyfontenvironment}{montreenvironnementpolicecorps} +\setinterfacecommand{showcolor}{montrecouleur} +\setinterfacecommand{showcolorgroup}{montregroupecouleur} +\setinterfacecommand{showexternalfigures}{montrefiguresexternes} +\setinterfacecommand{showfields}{montrechamps} +\setinterfacecommand{showframe}{montrecadre} +\setinterfacecommand{showgrid}{montregrille} +\setinterfacecommand{showlayout}{montredisposition} +\setinterfacecommand{showmakeup}{montremakeup} +\setinterfacecommand{showpalet}{montrepalette} +\setinterfacecommand{showprint}{montreedition} +\setinterfacecommand{showsetups}{montrereglages} +\setinterfacecommand{showstruts}{montrestruts} +\setinterfacecommand{showsymbolset}{montrejeusymboles} +\setinterfacecommand{smallcapped}{cap} +\setinterfacecommand{someline}{uneligne} +\setinterfacecommand{somewhere}{qqpart} +\setinterfacecommand{space}{espace} +\setinterfacecommand{splitfloat}{separeflottant} +\setinterfacecommand{startalignment}{demarrealignement} +\setinterfacecommand{startbackground}{demarrearriereplan} +\setinterfacecommand{startcoding}{demarrecodage} +\setinterfacecommand{startcolor}{demarrecouleur} +\setinterfacecommand{startcolumnmakeup}{startcolumnmakeup} +\setinterfacecommand{startcolumns}{demarrecolonnes} +\setinterfacecommand{startcolumnset}{demarrejeucolonne} +\setinterfacecommand{startcombination}{demarrecombinaison} +\setinterfacecommand{startcomponent}{demarrecomposant} +\setinterfacecommand{startdocument}{demarredocument} +\setinterfacecommand{startenvironment}{demarreenvironement} +\setinterfacecommand{startfigure}{demarrefigure} +\setinterfacecommand{startglobal}{demarreglobal} +\setinterfacecommand{startline}{demarreligne} +\setinterfacecommand{startlinecorrection}{demarrecorrectionligne} +\setinterfacecommand{startlinenumbering}{demarrenumerotationligne} +\setinterfacecommand{startlines}{demarrelignes} +\setinterfacecommand{startlocal}{demarrelocal} +\setinterfacecommand{startlocalfootnotes}{demarrenotespdplocales} +\setinterfacecommand{startmakeup}{demarremakeup} +\setinterfacecommand{startmarginblock}{demarreblocmarge} +\setinterfacecommand{startmarginrule}{demarremargereglee} +\setinterfacecommand{startnarrower}{demarrecompoetroite} +\setinterfacecommand{startopposite}{demarreopposition} +\setinterfacecommand{startoverlay}{demarrerevetement} +\setinterfacecommand{startoverzicht}{demarrevuedensemble} +\setinterfacecommand{startpacked}{demarregroupe} +\setinterfacecommand{startpositioning}{demarrepositionnement} +\setinterfacecommand{startproduct}{demarreproduit} +\setinterfacecommand{startprofile}{demarreprofil} +\setinterfacecommand{startproject}{demarreprojet} +\setinterfacecommand{startquotation}{demarrecitation} +\setinterfacecommand{startraster}{demarreraster} +\setinterfacecommand{startsymbolset}{demarrejeusymboles} +\setinterfacecommand{startsynchronization}{demarresynchronisation} +\setinterfacecommand{starttable}{demarretableau} +\setinterfacecommand{starttables}{demarretableaux} +\setinterfacecommand{starttext}{demarretexte} +\setinterfacecommand{starttextrule}{demarreligneregleetexte} +\setinterfacecommand{startunpacked}{demarredegroupe} +\setinterfacecommand{startversion}{demarreversion} +\setinterfacecommand{stopalignment}{stoppealignement} +\setinterfacecommand{stopbackground}{stoppearriereplan} +\setinterfacecommand{stopcoding}{stoppecodage} +\setinterfacecommand{stopcolor}{stoppecouleur} +\setinterfacecommand{stopcolumnmakeup}{stopcolumnmakeup} +\setinterfacecommand{stopcolumns}{stoppecolonnes} +\setinterfacecommand{stopcolumnset}{stoppejeucolonne} +\setinterfacecommand{stopcombination}{stoppecombinaison} +\setinterfacecommand{stopcomponent}{stoppecomposant} +\setinterfacecommand{stopdocument}{stoppedocument} +\setinterfacecommand{stopenvironment}{stoppeenvironement} +\setinterfacecommand{stopglobal}{stoppeglobal} +\setinterfacecommand{stopline}{stoppeligne} +\setinterfacecommand{stoplinecorrection}{stoppecorrectionligne} +\setinterfacecommand{stoplinenumbering}{stoppenumerotationligne} +\setinterfacecommand{stoplines}{stoppelignes} +\setinterfacecommand{stoplocal}{stoppelocal} +\setinterfacecommand{stoplocalfootnotes}{stoppenotespdplocales} +\setinterfacecommand{stopmakeup}{stoppemakeup} +\setinterfacecommand{stopmarginblock}{stoppeblocmarge} +\setinterfacecommand{stopmarginrule}{stoppemargereglee} +\setinterfacecommand{stopnarrower}{stopcompoetroite} +\setinterfacecommand{stopopposite}{stoppeopposition} +\setinterfacecommand{stopoverlay}{stopperevetement} +\setinterfacecommand{stopoverzicht}{stoppevuedensemble} +\setinterfacecommand{stoppacked}{stoppegroupe} +\setinterfacecommand{stoppositioning}{stoppepositionnement} +\setinterfacecommand{stopproduct}{stoppeproduit} +\setinterfacecommand{stopprofile}{stoppeprofil} +\setinterfacecommand{stopproject}{stoppeprojet} +\setinterfacecommand{stopquotation}{stoppecitation} +\setinterfacecommand{stopraster}{stopperaster} +\setinterfacecommand{stopsynchronization}{stoppesynchronisation} +\setinterfacecommand{stoptable}{stoppetableau} +\setinterfacecommand{stoptables}{stoppetableaux} +\setinterfacecommand{stoptext}{stoppetexte} +\setinterfacecommand{stoptextrule}{stoppeligneregleetexte} +\setinterfacecommand{stopunpacked}{stoppedegroupe} +\setinterfacecommand{stopversion}{stoppeversion} +\setinterfacecommand{stretched}{etire} +\setinterfacecommand{subformulanumber}{numerosousformule} +\setinterfacecommand{subpagenumber}{sousnumeropage} +\setinterfacecommand{switchtobodyfont}{changepolicecorps} +\setinterfacecommand{switchtorawfont}{changepolicebrute} +\setinterfacecommand{sym}{sym} +\setinterfacecommand{symbol}{symbole} +\setinterfacecommand{synchronizationbar}{barresynchronisation} +\setinterfacecommand{synchronize}{synchronise} +\setinterfacecommand{tab}{tab} +\setinterfacecommand{testcolumn}{testcolumn} +\setinterfacecommand{testpage}{testpage} +\setinterfacecommand{tex}{tex} +\setinterfacecommand{textheight}{hauteurtexte} +\setinterfacecommand{textreference}{referencetexte} +\setinterfacecommand{textrule}{ligneregleetexte} +\setinterfacecommand{textvariable}{variabletexte} +\setinterfacecommand{textwidth}{largeurtexte} +\setinterfacecommand{thinrule}{traitfin} +\setinterfacecommand{thinrules}{traitsfins} +\setinterfacecommand{tooltip}{suggestion} +\setinterfacecommand{topdistance}{distancesup} +\setinterfacecommand{topheight}{hauteursup} +\setinterfacecommand{topspace}{espacesup} +\setinterfacecommand{totalnumberofpages}{nombretotaldepages} +\setinterfacecommand{translate}{traduire} +\setinterfacecommand{txt}{txt} +\setinterfacecommand{typ}{typ} +\setinterfacecommand{type}{dactylographier} +\setinterfacecommand{typebuffer}{tapebuffer} +\setinterfacecommand{typefile}{fichierdactylo} +\setinterfacecommand{unitmeaning}{sensunite} +\setinterfacecommand{unknown}{inconnu} +\setinterfacecommand{useJSscripts}{utiliseJSscripts} +\setinterfacecommand{useURL}{utiliseURL} +\setinterfacecommand{useXMLfilter}{useXMLfilter} +\setinterfacecommand{useblocks}{utiliseblocs} +\setinterfacecommand{usecommands}{utilisecommandes} +\setinterfacecommand{useencoding}{utiliseencodage} +\setinterfacecommand{useexternaldocument}{utilisedocumentexterne} +\setinterfacecommand{useexternalfigure}{utilisefigureexterne} +\setinterfacecommand{useexternalfile}{utilisefichierexterne} +\setinterfacecommand{useexternalfiles}{utilisefichiersexternes} +\setinterfacecommand{useexternalsoundtrack}{utilisepsiteaudioexterne} +\setinterfacecommand{usemodule}{utilisemodule} +\setinterfacecommand{usemodules}{utilisemodules} +\setinterfacecommand{usepath}{utilisechemin} +\setinterfacecommand{usereferences}{utilisereferences} +\setinterfacecommand{usespecials}{utilisespecialites} +\setinterfacecommand{usesymbols}{utilisesymboles} +\setinterfacecommand{usetypescript}{usetypescript} +\setinterfacecommand{usetypescriptfile}{usetypescriptfile} +\setinterfacecommand{useurl}{utiliseurl} +\setinterfacecommand{version}{version} +\setinterfacecommand{vl}{vl} +\setinterfacecommand{weekday}{joursemaine} +\setinterfacecommand{whitespace}{espaceblanc} +\setinterfacecommand{wordright}{motdroit} +\setinterfacecommand{writebetweenlist}{ecritentreliste} +\setinterfacecommand{writetolist}{ecritdansliste} +\setinterfacecommand{writetoreferencelist}{ecritdanslistereference} +\setinterfacecommand{writetoregister}{ecritregistre} +% +\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-fr.tex b/Master/texmf-dist/tex/context/base/mult-fr.tex deleted file mode 100644 index 5244565e983..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-fr.tex +++ /dev/null @@ -1,1693 +0,0 @@ -% this file is auto-generated, don't edit this file -% -% definitions for interface variables for language fr -% -\setinterfacevariable{Addition}{Ajout} -\setinterfacevariable{Balloon}{Ballon} -\setinterfacevariable{Character}{Caratere} -\setinterfacevariable{Characters}{Caracteres} -\setinterfacevariable{CloseDocument}{FermeDocument} -\setinterfacevariable{ExitViewer}{SortVisualisateur} -\setinterfacevariable{FirstPage}{PremierePage} -\setinterfacevariable{FitHeight}{AjusteHauteur} -\setinterfacevariable{FitWidth}{AjusteLargeur} -\setinterfacevariable{GotoPage}{VaalaPage} -\setinterfacevariable{Greek}{Grec} -\setinterfacevariable{Help}{Aide} -\setinterfacevariable{HideField}{CacheChamp} -\setinterfacevariable{HideLayer}{CacheCalque} -\setinterfacevariable{Key}{Cle} -\setinterfacevariable{LastPage}{DernierePage} -\setinterfacevariable{LoadForm}{ChargeForm} -\setinterfacevariable{MONTH}{MOIS} -\setinterfacevariable{New}{Nouveau} -\setinterfacevariable{NextJump}{SautSuivant} -\setinterfacevariable{NextPage}{PageSuivante} -\setinterfacevariable{Numbers}{Numeros} -\setinterfacevariable{OpenNamedDocument}{OuvreDocumentNomme} -\setinterfacevariable{Paragraph}{Paragraphe} -\setinterfacevariable{PauseMovie}{PauseFilm} -\setinterfacevariable{PauseRendering}{PauseRendering} -\setinterfacevariable{PauseSound}{PauseSon} -\setinterfacevariable{PreviousJump}{SautPrecedent} -\setinterfacevariable{PreviousPage}{PagePrecedente} -\setinterfacevariable{PrintDocument}{ImprimeDocument} -\setinterfacevariable{Query}{Query} -\setinterfacevariable{QueryAgain}{QueryAgain} -\setinterfacevariable{ResetForm}{RazForm} -\setinterfacevariable{ResumeMovie}{ReprendFilm} -\setinterfacevariable{ResumeRendering}{ResumeRendering} -\setinterfacevariable{ResumeSound}{ReprendSon} -\setinterfacevariable{Romannumerals}{Chiffresromains} -\setinterfacevariable{SaveDocument}{SauvegardeDocument} -\setinterfacevariable{SaveForm}{SauvegardeForm} -\setinterfacevariable{SaveNamedDocument}{SauvegardeDocumentNomme} -\setinterfacevariable{SearchAgain}{RechercheSuivant} -\setinterfacevariable{SearchDocument}{RechercheDocument} -\setinterfacevariable{ShowBookmarks}{ShowBookmarks} -\setinterfacevariable{ShowField}{MontreChamp} -\setinterfacevariable{ShowThumbs}{ShowThumbs} -\setinterfacevariable{StartMovie}{DemarreFilm} -\setinterfacevariable{StartRendering}{StartRendering} -\setinterfacevariable{StartSound}{DemarreSon} -\setinterfacevariable{StopMovie}{StoppeFilm} -\setinterfacevariable{StopRendering}{StopRendering} -\setinterfacevariable{StopSound}{StoppeSon} -\setinterfacevariable{SubmitForm}{SoumettreForm} -\setinterfacevariable{ToggleLayer}{ToggleLayer} -\setinterfacevariable{ToggleViewer}{ChangeVisualisateur} -\setinterfacevariable{URL}{URL} -\setinterfacevariable{VideLayer}{VideLayer} -\setinterfacevariable{ViewerHelp}{AideVisualisateur} -\setinterfacevariable{WEEKDAY}{JOURSEMAINE} -\setinterfacevariable{WORD}{MOT} -\setinterfacevariable{abbreviation}{abreviation} -\setinterfacevariable{abbreviations}{abreviations} -\setinterfacevariable{absolute}{absolute} -\setinterfacevariable{action}{action} -\setinterfacevariable{after}{apres} -\setinterfacevariable{all}{tout} -\setinterfacevariable{always}{toujours} -\setinterfacevariable{answerarea}{answerarea} -\setinterfacevariable{appendices}{annexes} -\setinterfacevariable{appendix}{annexe} -\setinterfacevariable{april}{avril} -\setinterfacevariable{atmargin}{alamarge} -\setinterfacevariable{atpage}{alapage} -\setinterfacevariable{august}{aout} -\setinterfacevariable{author}{auteur} -\setinterfacevariable{auto}{auto} -\setinterfacevariable{autointro}{autointro} -\setinterfacevariable{back}{retour} -\setinterfacevariable{background}{arriereplan} -\setinterfacevariable{backmatter}{epilogue} -\setinterfacevariable{backpart}{postface} -\setinterfacevariable{backspace}{retourarriere} -\setinterfacevariable{backward}{retourarriere} -\setinterfacevariable{bbl}{bbl} -\setinterfacevariable{before}{avant} -\setinterfacevariable{begin}{begin} -\setinterfacevariable{bib}{bib} -\setinterfacevariable{big}{grand} -\setinterfacevariable{bigbodyfont}{grandepolicecorp} -\setinterfacevariable{bigpreference}{grandepreference} -\setinterfacevariable{blank}{vide} -\setinterfacevariable{blockquote}{blockquote} -\setinterfacevariable{bodymatter}{texteprincipal} -\setinterfacevariable{bodypart}{corpsdetexte} -\setinterfacevariable{bold}{gras} -\setinterfacevariable{bolditalic}{italiquegras} -\setinterfacevariable{boldslanted}{inclinegras} -\setinterfacevariable{bookmark}{marquepage} -\setinterfacevariable{both}{lesdeux} -\setinterfacevariable{bottom}{inf} -\setinterfacevariable{brief}{brief} -\setinterfacevariable{broad}{large} -\setinterfacevariable{buffer}{buffer} -\setinterfacevariable{by}{par} -\setinterfacevariable{calligraphic}{calligraphique} -\setinterfacevariable{cap}{cap} -\setinterfacevariable{capital}{capitale} -\setinterfacevariable{center}{center} -\setinterfacevariable{chapter}{chapitre} -\setinterfacevariable{character}{caractere} -\setinterfacevariable{characters}{caracteres} -\setinterfacevariable{cite}{cite} -\setinterfacevariable{color}{couleur} -\setinterfacevariable{column}{colonne} -\setinterfacevariable{columns}{colonnes} -\setinterfacevariable{command}{commande} -\setinterfacevariable{commands}{commandes} -\setinterfacevariable{comment}{commentaire} -\setinterfacevariable{component}{composant} -\setinterfacevariable{concept}{concept} -\setinterfacevariable{content}{contenu} -\setinterfacevariable{contents}{contenus} -\setinterfacevariable{continue}{continue} -\setinterfacevariable{controls}{controles} -\setinterfacevariable{conversion}{conversion} -\setinterfacevariable{current}{courant} -\setinterfacevariable{cutspace}{cutspace} -\setinterfacevariable{date}{date} -\setinterfacevariable{day}{jour} -\setinterfacevariable{december}{decembre} -\setinterfacevariable{default}{defaut} -\setinterfacevariable{depth}{profondeur} -\setinterfacevariable{description}{description} -\setinterfacevariable{disable}{desactiver} -\setinterfacevariable{display}{affichage} -\setinterfacevariable{dot}{point} -\setinterfacevariable{doublesided}{rectoverso} -\setinterfacevariable{down}{down} -\setinterfacevariable{each}{chaque} -\setinterfacevariable{edge}{bord} -\setinterfacevariable{empty}{vide} -\setinterfacevariable{end}{end} -\setinterfacevariable{endnote}{notefin} -\setinterfacevariable{enumeration}{enumeration} -\setinterfacevariable{environment}{environement} -\setinterfacevariable{even}{paire} -\setinterfacevariable{external}{external} -\setinterfacevariable{fact}{fait} -\setinterfacevariable{february}{fevrier} -\setinterfacevariable{figure}{figure} -\setinterfacevariable{figures}{figures} -\setinterfacevariable{file}{fichier} -\setinterfacevariable{final}{final} -\setinterfacevariable{first}{premier} -\setinterfacevariable{firstcolumn}{premierecolonne} -\setinterfacevariable{firstpage}{premierepage} -\setinterfacevariable{firstsubpage}{premieresouspage} -\setinterfacevariable{fit}{adapte} -\setinterfacevariable{five}{cinq} -\setinterfacevariable{fix}{fixe} -\setinterfacevariable{fixed}{fixe} -\setinterfacevariable{flexible}{flexible} -\setinterfacevariable{float}{flottant} -\setinterfacevariable{flushinner}{flushinner} -\setinterfacevariable{flushleft}{flushleft} -\setinterfacevariable{flushouter}{flushouter} -\setinterfacevariable{flushright}{flushright} -\setinterfacevariable{footer}{pdp} -\setinterfacevariable{footnote}{notepdp} -\setinterfacevariable{force}{force} -\setinterfacevariable{foreground}{premierplan} -\setinterfacevariable{formeel}{formeel} -\setinterfacevariable{formula}{formule} -\setinterfacevariable{formulae}{formules} -\setinterfacevariable{forward}{avance} -\setinterfacevariable{four}{quatre} -\setinterfacevariable{frame}{cadre} -\setinterfacevariable{framedtext}{texteencadre} -\setinterfacevariable{friday}{vendredi} -\setinterfacevariable{frontmatter}{preambule} -\setinterfacevariable{frontpart}{preface} -\setinterfacevariable{global}{global} -\setinterfacevariable{graphic}{graphique} -\setinterfacevariable{graphics}{graphiques} -\setinterfacevariable{gray}{gris} -\setinterfacevariable{greek}{grec} -\setinterfacevariable{grid}{grille} -\setinterfacevariable{halfline}{demiligne} -\setinterfacevariable{handwritten}{manuscript} -\setinterfacevariable{hang}{suspend} -\setinterfacevariable{hanging}{suspend} -\setinterfacevariable{head}{tete} -\setinterfacevariable{header}{entete} -\setinterfacevariable{height}{hauteur} -\setinterfacevariable{helptext}{texteaide} -\setinterfacevariable{hencefore}{precedent} -\setinterfacevariable{here}{ici} -\setinterfacevariable{hereafter}{suivant} -\setinterfacevariable{hidden}{cache} -\setinterfacevariable{hiding}{cache} -\setinterfacevariable{high}{haut} -\setinterfacevariable{horizontal}{horizontale} -\setinterfacevariable{hyphenated}{hyphenated} -\setinterfacevariable{hz}{hz} -\setinterfacevariable{inbetween}{entre} -\setinterfacevariable{index}{index} -\setinterfacevariable{indices}{indices} -\setinterfacevariable{informeel}{informeel} -\setinterfacevariable{inherit}{herite} -\setinterfacevariable{inleft}{dansgauche} -\setinterfacevariable{inmargin}{dansmarge} -\setinterfacevariable{inner}{interieur} -\setinterfacevariable{inneredge}{bordinterieur} -\setinterfacevariable{innermargin}{margeinterieure} -\setinterfacevariable{inright}{dansdroit} -\setinterfacevariable{interaction}{interaction} -\setinterfacevariable{interactionmenu}{menuinteraction} -\setinterfacevariable{intermezzi}{intermezzi} -\setinterfacevariable{intermezzo}{intermezzo} -\setinterfacevariable{intext}{danstexte} -\setinterfacevariable{intro}{intro} -\setinterfacevariable{italic}{italique} -\setinterfacevariable{italicbold}{grasitalique} -\setinterfacevariable{item}{element} -\setinterfacevariable{itemize}{lister} -\setinterfacevariable{its}{its} -\setinterfacevariable{january}{janvier} -\setinterfacevariable{joinedup}{joinedup} -\setinterfacevariable{july}{juillet} -\setinterfacevariable{june}{juin} -\setinterfacevariable{keep}{maintient} -\setinterfacevariable{knockout}{knockout} -\setinterfacevariable{label}{etiquette} -\setinterfacevariable{landscape}{paysage} -\setinterfacevariable{last}{dernier} -\setinterfacevariable{lastcolumn}{dernierecolonne} -\setinterfacevariable{lastpage}{dernierepage} -\setinterfacevariable{lastpagenumber}{derniernumeropage} -\setinterfacevariable{lastsubpage}{dernieresouspage} -\setinterfacevariable{layer}{layer} -\setinterfacevariable{left}{gauche} -\setinterfacevariable{leftedge}{bordgauche} -\setinterfacevariable{lefthanging}{lefthanging} -\setinterfacevariable{leftmargin}{margegauche} -\setinterfacevariable{leftpage}{pagegauche} -\setinterfacevariable{lefttoright}{lefttoright} -\setinterfacevariable{legend}{legende} -\setinterfacevariable{lesshyphenation}{lesshyphenation} -\setinterfacevariable{line}{ligne} -\setinterfacevariable{linenote}{noteligne} -\setinterfacevariable{lines}{lignes} -\setinterfacevariable{list}{liste} -\setinterfacevariable{local}{local} -\setinterfacevariable{localenvironment}{environementlocal} -\setinterfacevariable{logo}{logo} -\setinterfacevariable{logos}{logos} -\setinterfacevariable{lohi}{baha} -\setinterfacevariable{loose}{perte} -\setinterfacevariable{low}{bas} -\setinterfacevariable{ls}{ls} -\setinterfacevariable{makeup}{makeup} -\setinterfacevariable{mar}{mar} -\setinterfacevariable{march}{mars} -\setinterfacevariable{margin}{marge} -\setinterfacevariable{marginedge}{bordmarge} -\setinterfacevariable{margintitle}{titremarge} -\setinterfacevariable{marking}{marquage} -\setinterfacevariable{mathalignment}{mathalignment} -\setinterfacevariable{mathcases}{mathcases} -\setinterfacevariable{mathmatrix}{mathmatrix} -\setinterfacevariable{max}{max} -\setinterfacevariable{maxdepth}{maxdepth} -\setinterfacevariable{maxheight}{maxheight} -\setinterfacevariable{maxwidth}{maxwidth} -\setinterfacevariable{may}{mai} -\setinterfacevariable{mediaeval}{medieval} -\setinterfacevariable{medium}{moyen} -\setinterfacevariable{middle}{milieu} -\setinterfacevariable{min}{min} -\setinterfacevariable{mindepth}{mindepth} -\setinterfacevariable{minheight}{hauteurmin} -\setinterfacevariable{minwidth}{largeurmin} -\setinterfacevariable{mirrored}{reflete} -\setinterfacevariable{monday}{lundi} -\setinterfacevariable{mono}{mono} -\setinterfacevariable{month}{mois} -\setinterfacevariable{morehyphenation}{morehyphenation} -\setinterfacevariable{name}{nom} -\setinterfacevariable{narrow}{etroit} -\setinterfacevariable{negative}{negatif} -\setinterfacevariable{never}{jamais} -\setinterfacevariable{new}{nouveau} -\setinterfacevariable{next}{prochain} -\setinterfacevariable{nextevenpage}{pagepairesuivante} -\setinterfacevariable{nextoddpage}{pageimpairesuivante} -\setinterfacevariable{nextpage}{pagesuivante} -\setinterfacevariable{nextsubpage}{souspagesuivante} -\setinterfacevariable{no}{non} -\setinterfacevariable{nocheck}{nonverifie} -\setinterfacevariable{nofit}{nofit} -\setinterfacevariable{nogrid}{nogrid} -\setinterfacevariable{nohz}{nohz} -\setinterfacevariable{nomarking}{sansmarquage} -\setinterfacevariable{none}{rien} -\setinterfacevariable{nonumber}{sansnumero} -\setinterfacevariable{normal}{normal} -\setinterfacevariable{nospacing}{sansespacement} -\setinterfacevariable{not}{pas} -\setinterfacevariable{note}{note} -\setinterfacevariable{nothanging}{nonsuspendu} -\setinterfacevariable{nothyphenated}{nothyphenated} -\setinterfacevariable{november}{novembre} -\setinterfacevariable{nowhere}{nulpart} -\setinterfacevariable{nowhite}{sansblanc} -\setinterfacevariable{number}{numero} -\setinterfacevariable{numbers}{numeros} -\setinterfacevariable{october}{octobre} -\setinterfacevariable{odd}{impair} -\setinterfacevariable{off}{desactive} -\setinterfacevariable{offset}{offset} -\setinterfacevariable{old}{old} -\setinterfacevariable{on}{actif} -\setinterfacevariable{one}{un} -\setinterfacevariable{opposite}{opposition} -\setinterfacevariable{outer}{exterieur} -\setinterfacevariable{outeredge}{bordexterieur} -\setinterfacevariable{outermargin}{margeexterieure} -\setinterfacevariable{overbar}{overbar} -\setinterfacevariable{overbars}{overbars} -\setinterfacevariable{overlay}{revetement} -\setinterfacevariable{overprint}{overprint} -\setinterfacevariable{overstrike}{surlignetout} -\setinterfacevariable{overstrikes}{surligne} -\setinterfacevariable{packed}{groupe} -\setinterfacevariable{page}{page} -\setinterfacevariable{pagecomment}{commentairepage} -\setinterfacevariable{pagenumber}{numeropage} -\setinterfacevariable{paper}{papier} -\setinterfacevariable{paragraph}{paragraphe} -\setinterfacevariable{part}{partie} -\setinterfacevariable{positive}{positif} -\setinterfacevariable{postponing}{postponing} -\setinterfacevariable{postscript}{postscript} -\setinterfacevariable{preference}{preference} -\setinterfacevariable{preview}{previsualisation} -\setinterfacevariable{previous}{precedent} -\setinterfacevariable{previousevenpage}{pagepaireprecedente} -\setinterfacevariable{previousoddpage}{pageimpaireprecedente} -\setinterfacevariable{previouspage}{pageprecedente} -\setinterfacevariable{previoussubpage}{souspageprecedente} -\setinterfacevariable{printable}{editable} -\setinterfacevariable{process}{process} -\setinterfacevariable{product}{produit} -\setinterfacevariable{program}{programme} -\setinterfacevariable{project}{projet} -\setinterfacevariable{protected}{protege} -\setinterfacevariable{quadruple}{quadruple} -\setinterfacevariable{quotation}{citation} -\setinterfacevariable{quote}{citer} -\setinterfacevariable{ran}{cours} -\setinterfacevariable{random}{aleatoire} -\setinterfacevariable{readonly}{lectureseule} -\setinterfacevariable{rectangular}{rectangulaire} -\setinterfacevariable{referral}{referral} -\setinterfacevariable{register}{registre} -\setinterfacevariable{regular}{regulier} -\setinterfacevariable{rekening}{rekening} -\setinterfacevariable{relative}{relatif} -\setinterfacevariable{repeat}{repete} -\setinterfacevariable{required}{recquis} -\setinterfacevariable{reset}{raz} -\setinterfacevariable{reverse}{inverse} -\setinterfacevariable{right}{droite} -\setinterfacevariable{rightedge}{borddroit} -\setinterfacevariable{righthanging}{righthanging} -\setinterfacevariable{rightmargin}{margedroite} -\setinterfacevariable{rightpage}{pagedroite} -\setinterfacevariable{righttoleft}{righttoleft} -\setinterfacevariable{roman}{roman} -\setinterfacevariable{romannumerals}{chiffresromains} -\setinterfacevariable{rotate}{oriente} -\setinterfacevariable{rotated}{tourne} -\setinterfacevariable{round}{rond} -\setinterfacevariable{row}{rang} -\setinterfacevariable{rule}{regle} -\setinterfacevariable{samepage}{memepage} -\setinterfacevariable{sans}{sans} -\setinterfacevariable{sansbold}{sansgras} -\setinterfacevariable{sansserif}{sansserif} -\setinterfacevariable{saturday}{samedi} -\setinterfacevariable{screen}{ecran} -\setinterfacevariable{section}{section} -\setinterfacevariable{sectionblockenvironment}{environementblocsection} -\setinterfacevariable{sectionnumber}{numerosection} -\setinterfacevariable{see}{voit} -\setinterfacevariable{september}{septembre} -\setinterfacevariable{serif}{serif} -\setinterfacevariable{serried}{serried} -\setinterfacevariable{setups}{reglages} -\setinterfacevariable{sheet}{sheet} -\setinterfacevariable{short}{short} -\setinterfacevariable{singlesided}{recto} -\setinterfacevariable{slanted}{incline} -\setinterfacevariable{slantedbold}{grasincline} -\setinterfacevariable{small}{petit} -\setinterfacevariable{smallbodyfont}{petitepolicecorps} -\setinterfacevariable{smallbold}{graspetit} -\setinterfacevariable{smallbolditalic}{italiquegraspetit} -\setinterfacevariable{smallboldslanted}{inclinegraspetit} -\setinterfacevariable{smallcaps}{petitescapitales} -\setinterfacevariable{smallitalic}{italiquepetit} -\setinterfacevariable{smallitalicbold}{grasitaliquepetit} -\setinterfacevariable{smallnormal}{normalpetit} -\setinterfacevariable{smallslanted}{inclinepetit} -\setinterfacevariable{smallslantedbold}{grasinclinepetit} -\setinterfacevariable{smalltype}{petittype} -\setinterfacevariable{somewhere}{qqpart} -\setinterfacevariable{sorted}{trie} -\setinterfacevariable{space}{espace} -\setinterfacevariable{spacing}{espacement} -\setinterfacevariable{speech}{discours} -\setinterfacevariable{split}{split} -\setinterfacevariable{spot}{spot} -\setinterfacevariable{standard}{standard} -\setinterfacevariable{start}{demarre} -\setinterfacevariable{starter}{starter} -\setinterfacevariable{sticker}{sticker} -\setinterfacevariable{stop}{stoppe} -\setinterfacevariable{stopper}{stopper} -\setinterfacevariable{stretch}{etire} -\setinterfacevariable{strict}{strict} -\setinterfacevariable{strong}{strong} -\setinterfacevariable{strut}{strut} -\setinterfacevariable{sub}{sous} -\setinterfacevariable{subbackward}{sousretourarriere} -\setinterfacevariable{subformula}{subformule} -\setinterfacevariable{subforward}{sousavance} -\setinterfacevariable{subject}{sujet} -\setinterfacevariable{subpage}{souspage} -\setinterfacevariable{subsection}{soussection} -\setinterfacevariable{subsubject}{soussujet} -\setinterfacevariable{subsubsection}{soussoussection} -\setinterfacevariable{subsubsubject}{soussoussujet} -\setinterfacevariable{subsubsubsection}{soussoussoussection} -\setinterfacevariable{subsubsubsubject}{soussoussoussujet} -\setinterfacevariable{subsubsubsubsection}{soussoussoussoussection} -\setinterfacevariable{subsubsubsubsubject}{soussoussoussoussujet} -\setinterfacevariable{subsubsubsubsubsection}{soussoussoussoussoussection} -\setinterfacevariable{subsubsubsubsubsubject}{soussoussoussoussoussujet} -\setinterfacevariable{subsubsubsubsubsubsection}{soussoussoussoussoussoussection} -\setinterfacevariable{subsubsubsubsubsubsubject}{soussoussoussoussoussoussujet} -\setinterfacevariable{subsubsubsubsubsubsubsection}{soussoussoussoussoussoussoussection} -\setinterfacevariable{subsubsubsubsubsubsubsubject}{soussoussoussoussoussoussoussujet} -\setinterfacevariable{subsubsubsubsubsubsubsubsection}{soussoussoussoussoussoussoussoussection} -\setinterfacevariable{subsubsubsubsubsubsubsubsubject}{soussoussoussoussoussoussoussoussujet} -\setinterfacevariable{subsubsubsubsubsubsubsubsubsection}{soussoussoussoussoussoussoussoussoussection} -\setinterfacevariable{subsubsubsubsubsubsubsubsubsubject}{soussoussoussoussoussoussoussoussoussujet} -\setinterfacevariable{sunday}{dimanche} -\setinterfacevariable{support}{support} -\setinterfacevariable{sym}{sym} -\setinterfacevariable{symbol}{symbole} -\setinterfacevariable{synchronize}{synchronize} -\setinterfacevariable{system}{systeme} -\setinterfacevariable{table}{tableau} -\setinterfacevariable{tablehead}{tetetableau} -\setinterfacevariable{tables}{tables} -\setinterfacevariable{tabletail}{queuetableau} -\setinterfacevariable{tabulate}{tabule} -\setinterfacevariable{tabulatehead}{tetetabule} -\setinterfacevariable{tabulatetail}{queuetabule} -\setinterfacevariable{tall}{long} -\setinterfacevariable{teletype}{teletype} -\setinterfacevariable{temporary}{temporaire} -\setinterfacevariable{test}{test} -\setinterfacevariable{text}{texte} -\setinterfacevariable{three}{trois} -\setinterfacevariable{thursday}{jeudi} -\setinterfacevariable{title}{titre} -\setinterfacevariable{toggle}{toggle} -\setinterfacevariable{tolerant}{tolerant} -\setinterfacevariable{top}{sup} -\setinterfacevariable{tuesday}{mardi} -\setinterfacevariable{two}{deux} -\setinterfacevariable{txt}{txt} -\setinterfacevariable{type}{type} -\setinterfacevariable{typing}{typing} -\setinterfacevariable{unavailable}{indisponible} -\setinterfacevariable{underbar}{souslignetout} -\setinterfacevariable{underbars}{sousligne} -\setinterfacevariable{unit}{unite} -\setinterfacevariable{units}{unites} -\setinterfacevariable{unknown}{inconnu} -\setinterfacevariable{unpacked}{degroupe} -\setinterfacevariable{up}{up} -\setinterfacevariable{url}{url} -\setinterfacevariable{used}{used} -\setinterfacevariable{value}{valeur} -\setinterfacevariable{vertical}{verticale} -\setinterfacevariable{very}{tres} -\setinterfacevariable{verystrict}{tresstrict} -\setinterfacevariable{verytolerant}{trestolerant} -\setinterfacevariable{weak}{weak} -\setinterfacevariable{wednesday}{mercredi} -\setinterfacevariable{week}{semaine} -\setinterfacevariable{weekday}{joursemaine} -\setinterfacevariable{white}{blanc} -\setinterfacevariable{wide}{ample} -\setinterfacevariable{width}{largeur} -\setinterfacevariable{xml}{xml} -\setinterfacevariable{year}{annee} -\setinterfacevariable{yes}{oui} -% definitions for interface constants for language fr -% -\setinterfaceconstant{action}{action} -\setinterfaceconstant{address}{adresse} -\setinterfaceconstant{after}{apres} -\setinterfaceconstant{afterhead}{aprestete} -\setinterfaceconstant{afterkey}{aprescle} -\setinterfaceconstant{align}{alignement} -\setinterfaceconstant{aligncharacter}{caracterealigne} -\setinterfaceconstant{alignmentcharacter}{alignementcaractere} -\setinterfaceconstant{alignsymbol}{alignsymbol} -\setinterfaceconstant{aligntitle}{alignementtitre} -\setinterfaceconstant{alternative}{alternative} -\setinterfaceconstant{andtext}{andtext} -\setinterfaceconstant{apa}{apa} -\setinterfaceconstant{arrow}{fleche} -\setinterfaceconstant{artauthor}{artauthor} -\setinterfaceconstant{artauthoretaldisplay}{artauthoretaldisplay} -\setinterfaceconstant{artauthoretallimit}{artauthoretallimit} -\setinterfaceconstant{artauthoretaltext}{artauthoretaltext} -\setinterfaceconstant{at}{a} -\setinterfaceconstant{author}{auteur} -\setinterfaceconstant{authoretaldisplay}{authoretaldisplay} -\setinterfaceconstant{authoretallimit}{authoretallimit} -\setinterfaceconstant{authoretaltext}{authoretaltext} -\setinterfaceconstant{auto}{auto} -\setinterfaceconstant{autofile}{autofile} -\setinterfaceconstant{autofocus}{autofocus} -\setinterfaceconstant{autohang}{autohang} -\setinterfaceconstant{autostrut}{autostrut} -\setinterfaceconstant{autowidth}{autolargeur} -\setinterfaceconstant{axis}{axe} -\setinterfaceconstant{background}{arriereplan} -\setinterfaceconstant{backgroundcolor}{couleurarriereplan} -\setinterfaceconstant{backgroundcorner}{coinarriereplan} -\setinterfaceconstant{backgrounddepth}{profondeurarriereplan} -\setinterfaceconstant{backgroundoffset}{decalagearriereplan} -\setinterfaceconstant{backgroundradius}{rayonarriereplan} -\setinterfaceconstant{backgroundscreen}{ecranarriereplan} -\setinterfaceconstant{backspace}{retour} -\setinterfaceconstant{balance}{equilibre} -\setinterfaceconstant{before}{avant} -\setinterfaceconstant{beforehead}{avanttete} -\setinterfaceconstant{bet}{bet} -\setinterfaceconstant{big}{grand} -\setinterfaceconstant{blank}{vide} -\setinterfaceconstant{blockway}{blockway} -\setinterfaceconstant{bodyfont}{policecorps} -\setinterfaceconstant{bookmark}{marquepage} -\setinterfaceconstant{bottom}{inf} -\setinterfaceconstant{bottomafter}{bottomafter} -\setinterfaceconstant{bottombefore}{bottombefore} -\setinterfaceconstant{bottomdistance}{distanceinf} -\setinterfaceconstant{bottomframe}{cadreinf} -\setinterfaceconstant{bottomoffset}{decalageinf} -\setinterfaceconstant{bottomspace}{espaceinf} -\setinterfaceconstant{bottomstate}{etatinf} -\setinterfaceconstant{cache}{cache} -\setinterfaceconstant{calculate}{calculer} -\setinterfaceconstant{ccommand}{ccommande} -\setinterfaceconstant{click}{clic} -\setinterfaceconstant{clickin}{clicinterieur} -\setinterfaceconstant{clickout}{clicexterieur} -\setinterfaceconstant{clipoffset}{clipoffset} -\setinterfaceconstant{closeaction}{actionfermeture} -\setinterfaceconstant{closecommand}{closecommand} -\setinterfaceconstant{closepageaction}{actionfermeturepage} -\setinterfaceconstant{closesymbol}{closesymbol} -\setinterfaceconstant{color}{couleur} -\setinterfaceconstant{column}{colonne} -\setinterfaceconstant{columndistance}{distancecolonne} -\setinterfaceconstant{columns}{colonnes} -\setinterfaceconstant{command}{commande} -\setinterfaceconstant{commandafter}{commandeapres} -\setinterfaceconstant{commandbefore}{commandeavant} -\setinterfaceconstant{commands}{commandes} -\setinterfaceconstant{component}{composant} -\setinterfaceconstant{compoundhyphen}{compoundhyphen} -\setinterfaceconstant{compress}{compress} -\setinterfaceconstant{connector}{connector} -\setinterfaceconstant{continue}{continue} -\setinterfaceconstant{contrastcolor}{coleurcontraste} -\setinterfaceconstant{controls}{controles} -\setinterfaceconstant{conversion}{conversion} -\setinterfaceconstant{convertfile}{conversionfichier} -\setinterfaceconstant{corner}{coin} -\setinterfaceconstant{coupling}{couplage} -\setinterfaceconstant{couplingway}{modecouplage} -\setinterfaceconstant{criterium}{critere} -\setinterfaceconstant{current}{courant} -\setinterfaceconstant{cutspace}{cutspace} -\setinterfaceconstant{dash}{pointille} -\setinterfaceconstant{dat}{dat} -\setinterfaceconstant{database}{database} -\setinterfaceconstant{date}{date} -\setinterfaceconstant{deepnumbercommand}{deepnumbercommand} -\setinterfaceconstant{deeptextcommand}{deeptextcommand} -\setinterfaceconstant{default}{defaut} -\setinterfaceconstant{delay}{delai} -\setinterfaceconstant{depth}{profondeur} -\setinterfaceconstant{depthcorrection}{correctionprofondeur} -\setinterfaceconstant{direction}{direction} -\setinterfaceconstant{directory}{repertoire} -\setinterfaceconstant{display}{affichage} -\setinterfaceconstant{distance}{distance} -\setinterfaceconstant{dot}{point} -\setinterfaceconstant{doublesided}{rectoverso} -\setinterfaceconstant{dummy}{dummy} -\setinterfaceconstant{dx}{dx} -\setinterfaceconstant{dy}{dy} -\setinterfaceconstant{edge}{bord} -\setinterfaceconstant{edgedistance}{distancebord} -\setinterfaceconstant{editor}{editor} -\setinterfaceconstant{editoretaldisplay}{editoretaldisplay} -\setinterfaceconstant{editoretallimit}{editoretallimit} -\setinterfaceconstant{editoretaltext}{editoretaltext} -\setinterfaceconstant{empty}{vide} -\setinterfaceconstant{equalheight}{equalheight} -\setinterfaceconstant{equalwidth}{equalwidth} -\setinterfaceconstant{escape}{escape} -\setinterfaceconstant{evenmargin}{margepaire} -\setinterfaceconstant{expansion}{expansion} -\setinterfaceconstant{export}{export} -\setinterfaceconstant{extras}{extras} -\setinterfaceconstant{factor}{facteur} -\setinterfaceconstant{fallback}{fallback} -\setinterfaceconstant{family}{famille} -\setinterfaceconstant{fieldbackgroundcolor}{couleurarrierreplanchamp} -\setinterfaceconstant{fieldframecolor}{couleurcadrechamp} -\setinterfaceconstant{fieldlayer}{calquechamp} -\setinterfaceconstant{fieldoffset}{offsetchamp} -\setinterfaceconstant{file}{fichier} -\setinterfaceconstant{filtercommand}{filtercommand} -\setinterfaceconstant{finalnamesep}{finalnamesep} -\setinterfaceconstant{firstnamesep}{firstnamesep} -\setinterfaceconstant{focus}{focus} -\setinterfaceconstant{focusin}{focusin} -\setinterfaceconstant{focusout}{focusout} -\setinterfaceconstant{footer}{pdp} -\setinterfaceconstant{footerdistance}{dsitancepdp} -\setinterfaceconstant{footerstate}{etatpdp} -\setinterfaceconstant{foregroundcolor}{couleurpremierplan} -\setinterfaceconstant{foregroundstyle}{stylepremierplan} -\setinterfaceconstant{format}{formatter} -\setinterfaceconstant{frame}{cadre} -\setinterfaceconstant{framecolor}{couleurcadre} -\setinterfaceconstant{framecorner}{coincadre} -\setinterfaceconstant{framedepth}{profondeurcadre} -\setinterfaceconstant{frameoffset}{decalagecadre} -\setinterfaceconstant{frameradius}{rayoncadre} -\setinterfaceconstant{frames}{cadres} -\setinterfaceconstant{from}{de} -\setinterfaceconstant{get}{obtient} -\setinterfaceconstant{global}{global} -\setinterfaceconstant{grid}{grille} -\setinterfaceconstant{hang}{suspend} -\setinterfaceconstant{headalign}{headalign} -\setinterfaceconstant{headcolor}{couleurtete} -\setinterfaceconstant{headcommand}{commandetete} -\setinterfaceconstant{headconversion}{conversiontete} -\setinterfaceconstant{header}{entete} -\setinterfaceconstant{headerdistance}{distanceentete} -\setinterfaceconstant{headerstate}{etatentete} -\setinterfaceconstant{headlabel}{etiquettetete} -\setinterfaceconstant{headnumber}{numerotete} -\setinterfaceconstant{headstyle}{styletete} -\setinterfaceconstant{height}{hauteur} -\setinterfaceconstant{hfactor}{facteurhauteur} -\setinterfaceconstant{hfil}{hfil} -\setinterfaceconstant{hidenumber}{hidenumber} -\setinterfaceconstant{hoffset}{decalagehauteur} -\setinterfaceconstant{horoffset}{horoffset} -\setinterfaceconstant{hyphen}{hyphen} -\setinterfaceconstant{icommand}{icommande} -\setinterfaceconstant{in}{in} -\setinterfaceconstant{inbetween}{entre} -\setinterfaceconstant{increment}{incremente} -\setinterfaceconstant{incrementnumber}{incrementenumero} -\setinterfaceconstant{indenting}{composeenalinea} -\setinterfaceconstant{indentnext}{indentesuivant} -\setinterfaceconstant{indicator}{indicateur} -\setinterfaceconstant{inner}{interieur} -\setinterfaceconstant{innermargin}{margeinterieure} -\setinterfaceconstant{inputfile}{fichierentree} -\setinterfaceconstant{intent}{intent} -\setinterfaceconstant{interaction}{interaction} -\setinterfaceconstant{interlinespace}{espaceinterligne} -\setinterfaceconstant{itemalign}{itemalign} -\setinterfaceconstant{items}{elements} -\setinterfaceconstant{juniorsep}{juniorsep} -\setinterfaceconstant{ken}{ken} -\setinterfaceconstant{keyexpansion}{keyexpansion} -\setinterfaceconstant{keyword}{motcle} -\setinterfaceconstant{label}{etiquette} -\setinterfaceconstant{lastnamesep}{lastnamesep} -\setinterfaceconstant{lastpubsep}{lastpubsep} -\setinterfaceconstant{left}{gauche} -\setinterfaceconstant{leftcolor}{couleurgauche} -\setinterfaceconstant{leftcompoundhyphen}{leftcompoundhyphen} -\setinterfaceconstant{leftedge}{bordgauche} -\setinterfaceconstant{leftedgedistance}{distancebordgauche} -\setinterfaceconstant{leftframe}{cadregauche} -\setinterfaceconstant{lefthyphen}{lefthyphen} -\setinterfaceconstant{leftmargin}{margegauche} -\setinterfaceconstant{leftmargindistance}{distancemargegauche} -\setinterfaceconstant{leftoffset}{decalagegauche} -\setinterfaceconstant{leftquotation}{citationgauche} -\setinterfaceconstant{leftquote}{citergauche} -\setinterfaceconstant{leftsentence}{phrasegauche} -\setinterfaceconstant{leftspeech}{leftspeech} -\setinterfaceconstant{leftstyle}{leftstyle} -\setinterfaceconstant{leftsubsentence}{sousphrasegauche} -\setinterfaceconstant{lefttext}{textegauche} -\setinterfaceconstant{leftwidth}{largeurgauche} -\setinterfaceconstant{level}{niveau} -\setinterfaceconstant{levels}{niveaux} -\setinterfaceconstant{limittext}{limittext} -\setinterfaceconstant{line}{ligne} -\setinterfaceconstant{linecorrection}{correctionligne} -\setinterfaceconstant{lines}{lignes} -\setinterfaceconstant{list}{liste} -\setinterfaceconstant{listtext}{texteliste} -\setinterfaceconstant{local}{local} -\setinterfaceconstant{location}{emplacement} -\setinterfaceconstant{logo}{logo} -\setinterfaceconstant{logos}{logos} -\setinterfaceconstant{marcolor}{couleurmarquage} -\setinterfaceconstant{margin}{marge} -\setinterfaceconstant{margindistance}{distancemarge} -\setinterfaceconstant{marginedge}{bordmarge} -\setinterfaceconstant{marginedgetext}{textebordmarge} -\setinterfaceconstant{margintext}{textemarge} -\setinterfaceconstant{marking}{marquage} -\setinterfaceconstant{marstyle}{stylemarquage} -\setinterfaceconstant{max}{max} -\setinterfaceconstant{maxdepth}{maxdepth} -\setinterfaceconstant{maxheight}{hauteurmax} -\setinterfaceconstant{maxwidth}{largeurmax} -\setinterfaceconstant{maybeyear}{maybeyear} -\setinterfaceconstant{menu}{menu} -\setinterfaceconstant{method}{methode} -\setinterfaceconstant{middle}{milieu} -\setinterfaceconstant{middlespeech}{middlespeech} -\setinterfaceconstant{middletext}{textecentre} -\setinterfaceconstant{midsentence}{midsentence} -\setinterfaceconstant{min}{min} -\setinterfaceconstant{mindepth}{profondeurmin} -\setinterfaceconstant{minheight}{hauteurmin} -\setinterfaceconstant{minwidth}{largeurmin} -\setinterfaceconstant{monthconversion}{monthconversion} -\setinterfaceconstant{n}{n} -\setinterfaceconstant{name}{nom} -\setinterfaceconstant{namesep}{namesep} -\setinterfaceconstant{nbottom}{ninf} -\setinterfaceconstant{nc}{nc} -\setinterfaceconstant{next}{suivant} -\setinterfaceconstant{nl}{nl} -\setinterfaceconstant{nleft}{ngauche} -\setinterfaceconstant{nlines}{nlignes} -\setinterfaceconstant{norm}{norme} -\setinterfaceconstant{nr}{nr} -\setinterfaceconstant{nright}{ndroite} -\setinterfaceconstant{ntop}{nsup} -\setinterfaceconstant{number}{numero} -\setinterfaceconstant{numbercolor}{couleurnumero} -\setinterfaceconstant{numbercommand}{commandenumero} -\setinterfaceconstant{numberconversion}{numberconversion} -\setinterfaceconstant{numberconversionset}{numberconversionset} -\setinterfaceconstant{numberdistance}{numberdistance} -\setinterfaceconstant{numbering}{numerotation} -\setinterfaceconstant{numberorder}{numberorder} -\setinterfaceconstant{numberprefix}{numberprefix} -\setinterfaceconstant{numbersegments}{numbersegments} -\setinterfaceconstant{numberseparator}{separateurnumbero} -\setinterfaceconstant{numberseparatorset}{numberseparatorset} -\setinterfaceconstant{numberset}{numberset} -\setinterfaceconstant{numberstarter}{numberstarter} -\setinterfaceconstant{numberstopper}{numberstopper} -\setinterfaceconstant{numberstyle}{stylenumero} -\setinterfaceconstant{numberwidth}{numberwidth} -\setinterfaceconstant{nx}{nx} -\setinterfaceconstant{ny}{ny} -\setinterfaceconstant{object}{objet} -\setinterfaceconstant{obstruction}{obstruction} -\setinterfaceconstant{oddmargin}{margepaire} -\setinterfaceconstant{offset}{offset} -\setinterfaceconstant{openaction}{actionouverture} -\setinterfaceconstant{openpageaction}{actionouverturepage} -\setinterfaceconstant{option}{option} -\setinterfaceconstant{order}{order} -\setinterfaceconstant{orientation}{orientation} -\setinterfaceconstant{otherstext}{otherstext} -\setinterfaceconstant{outermargin}{margeexterieure} -\setinterfaceconstant{overprint}{overprint} -\setinterfaceconstant{ownnumber}{numeroproprio} -\setinterfaceconstant{page}{page} -\setinterfaceconstant{pageboundaries}{limitespage} -\setinterfaceconstant{pagecolor}{couleurpage} -\setinterfaceconstant{pagecommand}{commandepage} -\setinterfaceconstant{pageconversion}{pageconversion} -\setinterfaceconstant{pageconversionset}{pageconversionset} -\setinterfaceconstant{pagenumber}{numeropage} -\setinterfaceconstant{pageprefix}{pageprefix} -\setinterfaceconstant{pageprefixconnector}{pageprefixconnector} -\setinterfaceconstant{pageprefixconversion}{pageprefixconversion} -\setinterfaceconstant{pageprefixconversionset}{pageprefixconversionset} -\setinterfaceconstant{pageprefixsegments}{pageprefixsegments} -\setinterfaceconstant{pageprefixseparatorset}{pageprefixseparatorset} -\setinterfaceconstant{pageprefixset}{pageprefixset} -\setinterfaceconstant{pageprefixstarter}{pageprefixstarter} -\setinterfaceconstant{pageprefixstopper}{pageprefixstopper} -\setinterfaceconstant{pagesegments}{pagesegments} -\setinterfaceconstant{pageseparatorset}{pageseparatorset} -\setinterfaceconstant{pageset}{pageset} -\setinterfaceconstant{pagestarter}{pagestarter} -\setinterfaceconstant{pagestate}{etatpage} -\setinterfaceconstant{pagestopper}{pagestopper} -\setinterfaceconstant{pagestyle}{stylepage} -\setinterfaceconstant{palet}{palette} -\setinterfaceconstant{paper}{papier} -\setinterfaceconstant{paragraph}{paragraphe} -\setinterfaceconstant{place}{place} -\setinterfaceconstant{placehead}{placetete} -\setinterfaceconstant{placestopper}{emplacementstopper} -\setinterfaceconstant{position}{position} -\setinterfaceconstant{prefix}{prefixe} -\setinterfaceconstant{prefixconnector}{prefixconnector} -\setinterfaceconstant{prefixconversion}{prefixconversion} -\setinterfaceconstant{prefixconversionset}{prefixconversionset} -\setinterfaceconstant{prefixsegments}{prefixsegments} -\setinterfaceconstant{prefixseparatorset}{prefixseparatorset} -\setinterfaceconstant{prefixset}{prefixset} -\setinterfaceconstant{prefixstarter}{prefixstarter} -\setinterfaceconstant{prefixstopper}{prefixstopper} -\setinterfaceconstant{preset}{prereglage} -\setinterfaceconstant{preview}{previsualisation} -\setinterfaceconstant{previous}{precedent} -\setinterfaceconstant{previousnumber}{numeroprecedent} -\setinterfaceconstant{process}{process} -\setinterfaceconstant{pubsep}{pubsep} -\setinterfaceconstant{radius}{rayon} -\setinterfaceconstant{random}{aleatoire} -\setinterfaceconstant{range}{range} -\setinterfaceconstant{reduction}{reduction} -\setinterfaceconstant{ref}{ref} -\setinterfaceconstant{refcommand}{refcommand} -\setinterfaceconstant{reference}{reference} -\setinterfaceconstant{referenceprefix}{referenceprefix} -\setinterfaceconstant{referencing}{referencing} -\setinterfaceconstant{regionin}{entreregion} -\setinterfaceconstant{regionout}{regionexterieure} -\setinterfaceconstant{repeat}{repete} -\setinterfaceconstant{reset}{reset} -\setinterfaceconstant{resetnumber}{raznumero} -\setinterfaceconstant{resolution}{resolution} -\setinterfaceconstant{right}{droite} -\setinterfaceconstant{rightcolor}{couleurdroite} -\setinterfaceconstant{rightcompoundhyphen}{rightcompoundhyphen} -\setinterfaceconstant{rightedge}{borddroit} -\setinterfaceconstant{rightedgedistance}{distanceborddroit} -\setinterfaceconstant{rightframe}{cadredroit} -\setinterfaceconstant{righthyphen}{righthyphen} -\setinterfaceconstant{rightmargin}{margedroite} -\setinterfaceconstant{rightmargindistance}{distancemargedroite} -\setinterfaceconstant{rightoffset}{rightoffset} -\setinterfaceconstant{rightquotation}{citationdroite} -\setinterfaceconstant{rightquote}{citerdroite} -\setinterfaceconstant{rightsentence}{phrasedroite} -\setinterfaceconstant{rightspeech}{rightspeech} -\setinterfaceconstant{rightstyle}{styledroit} -\setinterfaceconstant{rightsubsentence}{sousphrasedroite} -\setinterfaceconstant{righttext}{textedroit} -\setinterfaceconstant{rightwidth}{largeurdroite} -\setinterfaceconstant{rotation}{rotation} -\setinterfaceconstant{rule}{ligne} -\setinterfaceconstant{rulecolor}{couleurligne} -\setinterfaceconstant{rulethickness}{epaisseurligne} -\setinterfaceconstant{samepage}{memepage} -\setinterfaceconstant{sample}{echantillon} -\setinterfaceconstant{samplesize}{samplesize} -\setinterfaceconstant{saveinlist}{saveinlist} -\setinterfaceconstant{scale}{echelle} -\setinterfaceconstant{scope}{scope} -\setinterfaceconstant{screen}{ecran} -\setinterfaceconstant{section}{section} -\setinterfaceconstant{sectionconversion}{sectionconversion} -\setinterfaceconstant{sectionconversionset}{sectionconversionset} -\setinterfaceconstant{sectionnumber}{numerosection} -\setinterfaceconstant{sectionresetset}{sectionresetset} -\setinterfaceconstant{sectionsegments}{sectionsegments} -\setinterfaceconstant{sectionseparatorset}{sectionseparatorset} -\setinterfaceconstant{sectionset}{sectionset} -\setinterfaceconstant{sectionstarter}{sectionstarter} -\setinterfaceconstant{sectionstopper}{sectionstopper} -\setinterfaceconstant{separator}{separateur} -\setinterfaceconstant{set}{set} -\setinterfaceconstant{setups}{reglages} -\setinterfaceconstant{side}{cote} -\setinterfaceconstant{sidealign}{sidealign} -\setinterfaceconstant{sidemethod}{sidemethod} -\setinterfaceconstant{sidespaceafter}{espacelateralapres} -\setinterfaceconstant{sidespacebefore}{espacelateralavant} -\setinterfaceconstant{sign}{signe} -\setinterfaceconstant{size}{dimension} -\setinterfaceconstant{small}{petit} -\setinterfaceconstant{sort}{sort} -\setinterfaceconstant{sorttype}{sorttype} -\setinterfaceconstant{source}{origine} -\setinterfaceconstant{space}{espace} -\setinterfaceconstant{spaceafter}{espaceapres} -\setinterfaceconstant{spacebefore}{espaceavant} -\setinterfaceconstant{spaceinbetween}{spaceinbetween} -\setinterfaceconstant{spacing}{espacement} -\setinterfaceconstant{split}{split} -\setinterfaceconstant{splitcolor}{splitcolor} -\setinterfaceconstant{splitmethod}{splitmethod} -\setinterfaceconstant{splitoffset}{splitoffset} -\setinterfaceconstant{spot}{spot} -\setinterfaceconstant{stack}{stack} -\setinterfaceconstant{start}{demarre} -\setinterfaceconstant{starter}{starter} -\setinterfaceconstant{state}{etat} -\setinterfaceconstant{step}{pas} -\setinterfaceconstant{stop}{stoppe} -\setinterfaceconstant{stopper}{taquet} -\setinterfaceconstant{stretch}{etire} -\setinterfaceconstant{strip}{strip} -\setinterfaceconstant{strut}{strut} -\setinterfaceconstant{style}{style} -\setinterfaceconstant{sub}{sous} -\setinterfaceconstant{subtitle}{soustitre} -\setinterfaceconstant{suffix}{suffix} -\setinterfaceconstant{surnamesep}{surnamesep} -\setinterfaceconstant{sx}{sx} -\setinterfaceconstant{sy}{sy} -\setinterfaceconstant{symalign}{symalignement} -\setinterfaceconstant{symbol}{symbole} -\setinterfaceconstant{symbolset}{jeusymbole} -\setinterfaceconstant{symcolor}{couleursym} -\setinterfaceconstant{symstyle}{stylesym} -\setinterfaceconstant{synonym}{synonyme} -\setinterfaceconstant{synonymcolor}{couleursynonyme} -\setinterfaceconstant{synonymcommand}{synonymcommand} -\setinterfaceconstant{synonymstyle}{stylesynonyme} -\setinterfaceconstant{tab}{tab} -\setinterfaceconstant{text}{texte} -\setinterfaceconstant{textcolor}{couleurtexte} -\setinterfaceconstant{textcommand}{commandetexte} -\setinterfaceconstant{textdistance}{distancetexte} -\setinterfaceconstant{textlayer}{calquetexte} -\setinterfaceconstant{textmargin}{margetexte} -\setinterfaceconstant{textmethod}{textmethod} -\setinterfaceconstant{textseparator}{separateurtexte} -\setinterfaceconstant{textsize}{tailletexte} -\setinterfaceconstant{textstate}{etattexte} -\setinterfaceconstant{textstyle}{styletexte} -\setinterfaceconstant{textwidth}{largeurtexte} -\setinterfaceconstant{title}{titre} -\setinterfaceconstant{titlecolor}{couleurtitre} -\setinterfaceconstant{titlecommand}{titlecommand} -\setinterfaceconstant{titledistance}{distancetitre} -\setinterfaceconstant{titleleft}{titleleft} -\setinterfaceconstant{titleright}{titleright} -\setinterfaceconstant{titlestyle}{styletitre} -\setinterfaceconstant{to}{vers} -\setinterfaceconstant{tolerance}{tolerance} -\setinterfaceconstant{top}{sup} -\setinterfaceconstant{topdistance}{distancesup} -\setinterfaceconstant{topframe}{cadresup} -\setinterfaceconstant{topoffset}{decalagesup} -\setinterfaceconstant{topspace}{espacesup} -\setinterfaceconstant{topstate}{etatsup} -\setinterfaceconstant{totalnumber}{totalnumber} -\setinterfaceconstant{type}{type} -\setinterfaceconstant{unit}{unite} -\setinterfaceconstant{unknownreference}{referenceinconnue} -\setinterfaceconstant{urlalternative}{alternativeurl} -\setinterfaceconstant{urlspace}{espaceurl} -\setinterfaceconstant{validate}{valider} -\setinterfaceconstant{vcommand}{vcommande} -\setinterfaceconstant{veroffset}{veroffset} -\setinterfaceconstant{vfil}{vfil} -\setinterfaceconstant{voffset}{voffset} -\setinterfaceconstant{vonsep}{vonsep} -\setinterfaceconstant{way}{mode} -\setinterfaceconstant{wfactor}{facteurlargeur} -\setinterfaceconstant{white}{blanc} -\setinterfaceconstant{width}{largeur} -\setinterfaceconstant{xfactor}{xfactor} -\setinterfaceconstant{xmax}{xmax} -\setinterfaceconstant{xoffset}{xoffset} -\setinterfaceconstant{xscale}{xscale} -\setinterfaceconstant{xstep}{xstep} -\setinterfaceconstant{yfactor}{yfactor} -\setinterfaceconstant{ymax}{ymax} -\setinterfaceconstant{yoffset}{yoffset} -\setinterfaceconstant{yscale}{yscale} -\setinterfaceconstant{ystep}{ystep} -% definitions for interface elements for language fr -% -\setinterfaceelement{answerlines}{answerlines} -\setinterfaceelement{answerspace}{answerspace} -\setinterfaceelement{begin}{debut} -\setinterfaceelement{complete}{complete} -\setinterfaceelement{coupled}{couple} -\setinterfaceelement{currentlocal}{localcourant} -\setinterfaceelement{emptyone}{vide} -\setinterfaceelement{emptytwo}{vide} -\setinterfaceelement{end}{fin} -\setinterfaceelement{endsetup}{} -\setinterfaceelement{get}{obtient} -\setinterfaceelement{increment}{incremente} -\setinterfaceelement{list}{liste} -\setinterfaceelement{listof}{listede} -\setinterfaceelement{load}{charge} -\setinterfaceelement{local}{local} -\setinterfaceelement{makeup}{makeup} -\setinterfaceelement{next}{suivant} -\setinterfaceelement{place}{place} -\setinterfaceelement{previous}{precedent} -\setinterfaceelement{previouslocal}{localprecedent} -\setinterfaceelement{reserve}{reserver} -\setinterfaceelement{see}{voit} -\setinterfaceelement{setup}{regle} -\setinterfaceelement{start}{demarre} -\setinterfaceelement{stop}{stoppe} -\setinterfaceelement{text}{texte} -\setinterfaceelement{type}{type} -% definitions for interface commands for language fr -% -\setinterfacecommand{CAPPED}{CAP} -\setinterfacecommand{Character}{Caractere} -\setinterfacecommand{Characters}{Caracteres} -\setinterfacecommand{LABELTEXT}{LABELTEXTE} -\setinterfacecommand{MONTH}{MOIS} -\setinterfacecommand{Numbers}{Numeros} -\setinterfacecommand{Romannumerals}{Chiffresromains} -\setinterfacecommand{SmallCapped}{Cap} -\setinterfacecommand{SmallCaps}{Caps} -\setinterfacecommand{WEEKDAY}{JOURSEMAINE} -\setinterfacecommand{WORD}{MOT} -\setinterfacecommand{WORDS}{MOTS} -\setinterfacecommand{Word}{Mot} -\setinterfacecommand{Words}{Mots} -\setinterfacecommand{about}{concernant} -\setinterfacecommand{adaptlayout}{adaptedisposition} -\setinterfacecommand{arg}{arg} -\setinterfacecommand{at}{a} -\setinterfacecommand{atleftmargin}{atleftmargin} -\setinterfacecommand{atpage}{alapage} -\setinterfacecommand{atrightmargin}{atrightmargin} -\setinterfacecommand{background}{arriereplan} -\setinterfacecommand{backspace}{retourarriere} -\setinterfacecommand{blackrule}{lignenoire} -\setinterfacecommand{blackrules}{lignesnoires} -\setinterfacecommand{blank}{vide} -\setinterfacecommand{bookmark}{marquepage} -\setinterfacecommand{bottomdistance}{distanceinf} -\setinterfacecommand{bottomheight}{hauteurinf} -\setinterfacecommand{bottomspace}{espaceinf} -\setinterfacecommand{but}{but} -\setinterfacecommand{button}{bouton} -\setinterfacecommand{bypassblocks}{sauteblocs} -\setinterfacecommand{character}{caractere} -\setinterfacecommand{characters}{caracteres} -\setinterfacecommand{chem}{chem} -\setinterfacecommand{clip}{clip} -\setinterfacecommand{clonefield}{clonechamp} -\setinterfacecommand{color}{couleur} -\setinterfacecommand{colorbar}{barrecouleur} -\setinterfacecommand{colorvalue}{valeurcouleur} -\setinterfacecommand{column}{colonne} -\setinterfacecommand{comment}{commentaire} -\setinterfacecommand{comparecolorgroup}{comparegroupecouleur} -\setinterfacecommand{comparepalet}{comparepalette} -\setinterfacecommand{completepagenumber}{completenumeropage} -\setinterfacecommand{completeregister}{completeregistre} -\setinterfacecommand{component}{composant} -\setinterfacecommand{convertnumber}{convertitnumero} -\setinterfacecommand{copyfield}{copitchamp} -\setinterfacecommand{correctwhitespace}{corrigeespaceblanc} -\setinterfacecommand{coupledocument}{coupledocument} -\setinterfacecommand{couplemarking}{couplemarquage} -\setinterfacecommand{couplepage}{pagedouble} -\setinterfacecommand{couplepaper}{couplepapier} -\setinterfacecommand{coupleregister}{coupleregistre} -\setinterfacecommand{crlf}{crlf} -\setinterfacecommand{currentdate}{datecourante} -\setinterfacecommand{currentheadnumber}{numerotetecourant} -\setinterfacecommand{cutspace}{cutspace} -\setinterfacecommand{date}{date} -\setinterfacecommand{decouplemarking}{decouplemarquage} -\setinterfacecommand{decrementnumber}{decrementenumero} -\setinterfacecommand{define}{definit} -\setinterfacecommand{defineaccent}{definitaccent} -\setinterfacecommand{defineblank}{definitvide} -\setinterfacecommand{defineblock}{definitbloc} -\setinterfacecommand{definebodyfont}{definitpolicecorps} -\setinterfacecommand{definebodyfontenvironment}{definitenvironnementpolicecorps} -\setinterfacecommand{definebuffer}{definitbuffer} -\setinterfacecommand{definecharacter}{definicaractere} -\setinterfacecommand{definecolor}{definitcouleur} -\setinterfacecommand{definecolorgroup}{definitgroupecouleur} -\setinterfacecommand{definecolumnbreak}{definitsautdecolonne} -\setinterfacecommand{definecolumnset}{definitjeucolonne} -\setinterfacecommand{definecombination}{definecombination} -\setinterfacecommand{definecombinedlist}{definitlisteimbriquee} -\setinterfacecommand{definecommand}{definitcommande} -\setinterfacecommand{defineconversion}{definitconversion} -\setinterfacecommand{definedescription}{definitdescription} -\setinterfacecommand{defineenumeration}{definitenumeration} -\setinterfacecommand{definefield}{definitchamp} -\setinterfacecommand{definefieldstack}{definitpilechamp} -\setinterfacecommand{definefiguresymbol}{definitsymbolefigure} -\setinterfacecommand{definefloat}{definitflottant} -\setinterfacecommand{definefont}{definitpolice} -\setinterfacecommand{definefontstyle}{definitstylepolice} -\setinterfacecommand{definefontsynonym}{definitsynonymepolice} -\setinterfacecommand{defineframed}{defineframed} -\setinterfacecommand{defineframedtext}{defineframedtext} -\setinterfacecommand{definehbox}{definithbox} -\setinterfacecommand{definehead}{definittete} -\setinterfacecommand{defineindenting}{definitcompoalinea} -\setinterfacecommand{defineinmargin}{definitdansmarge} -\setinterfacecommand{defineinteractionmenu}{definitmenuinteraction} -\setinterfacecommand{defineitemgroup}{defineitemgroup} -\setinterfacecommand{definelabel}{definitetiquette} -\setinterfacecommand{definelayer}{definitcalque} -\setinterfacecommand{definelayout}{definitdisposition} -\setinterfacecommand{definelist}{definitliste} -\setinterfacecommand{definelogo}{definitlogo} -\setinterfacecommand{definemainfield}{definitchampprincipal} -\setinterfacecommand{definemakeup}{definitmakeup} -\setinterfacecommand{definemarking}{definitmarquage} -\setinterfacecommand{definemathalignment}{definemathalignment} -\setinterfacecommand{defineoutput}{definitsortie} -\setinterfacecommand{defineoverlay}{definitrevetement} -\setinterfacecommand{definepagebreak}{definitsautdepage} -\setinterfacecommand{definepalet}{definitpalette} -\setinterfacecommand{definepapersize}{definittaillepapier} -\setinterfacecommand{defineparagraphs}{definitparagraphes} -\setinterfacecommand{defineplacement}{defineplacement} -\setinterfacecommand{defineprofile}{definitprofil} -\setinterfacecommand{defineprogram}{definitprogramme} -\setinterfacecommand{definerawfont}{definitpolicebrute} -\setinterfacecommand{definereference}{definitreference} -\setinterfacecommand{definereferenceformat}{definitformatreference} -\setinterfacecommand{definereferencelist}{definitlistereference} -\setinterfacecommand{defineregister}{definitregistre} -\setinterfacecommand{definerule}{definitregle} -\setinterfacecommand{definesection}{definitsection} -\setinterfacecommand{definesectionblock}{definitblocsection} -\setinterfacecommand{definesorting}{definittri} -\setinterfacecommand{definestartstop}{definitdemarrestoppe} -\setinterfacecommand{definestyle}{definitstyle} -\setinterfacecommand{definesubfield}{definitsouschamp} -\setinterfacecommand{definesymbol}{definitsymbole} -\setinterfacecommand{definesynonyms}{definitsynonymes} -\setinterfacecommand{definetabletemplate}{definittrametableau} -\setinterfacecommand{definetabulate}{definittabulation} -\setinterfacecommand{definetext}{definittexte} -\setinterfacecommand{definetextposition}{definitpositiontexte} -\setinterfacecommand{definetextvariable}{definitvariabletexte} -\setinterfacecommand{definetype}{definittype} -\setinterfacecommand{definetyping}{definitdactylo} -\setinterfacecommand{defineversion}{definitversion} -\setinterfacecommand{determineheadnumber}{determinenumerotete} -\setinterfacecommand{determinelistcharacteristics}{determinecaracteristiqueliste} -\setinterfacecommand{determineregistercharacteristics}{determinecaracteristiquesregistre} -\setinterfacecommand{dimension}{dimension} -\setinterfacecommand{disableinteractionmenu}{inhibemenuinteraction} -\setinterfacecommand{domicile}{domicile} -\setinterfacecommand{donttest}{sanstest} -\setinterfacecommand{edgedistance}{distancebord} -\setinterfacecommand{edgewidth}{largeurbord} -\setinterfacecommand{emptylines}{emptylines} -\setinterfacecommand{environment}{environement} -\setinterfacecommand{externalfigure}{figureexterne} -\setinterfacecommand{fact}{fait} -\setinterfacecommand{field}{champ} -\setinterfacecommand{fieldstack}{pilechamp} -\setinterfacecommand{fillinfield}{remplitchamp} -\setinterfacecommand{fillinline}{remplitligne} -\setinterfacecommand{fillinrules}{remplitlignesreglees} -\setinterfacecommand{fillintext}{remplittexte} -\setinterfacecommand{fitfield}{ajustechamp} -\setinterfacecommand{fixedspace}{espacefixe} -\setinterfacecommand{fixedspaces}{espacesfixes} -\setinterfacecommand{followprofile}{suivantprofil} -\setinterfacecommand{followprofileversion}{suivantversionprofil} -\setinterfacecommand{followversion}{suivantversion} -\setinterfacecommand{footerdistance}{distancepdp} -\setinterfacecommand{footerheight}{hauteurpdp} -\setinterfacecommand{footnote}{notepdp} -\setinterfacecommand{footnotetext}{textenotepdp} -\setinterfacecommand{forceblocks}{forceblocs} -\setinterfacecommand{formulanumber}{numeroformule} -\setinterfacecommand{fraction}{fraction} -\setinterfacecommand{framed}{framed} -\setinterfacecommand{from}{de} -\setinterfacecommand{getbuffer}{prendbuffer} -\setinterfacecommand{getmarking}{obtientmarquage} -\setinterfacecommand{getnumber}{getnumber} -\setinterfacecommand{godown}{vaenbas} -\setinterfacecommand{goto}{va} -\setinterfacecommand{gotobox}{vaalaboite} -\setinterfacecommand{gotopage}{vaalapage} -\setinterfacecommand{graycolor}{couleurgrise} -\setinterfacecommand{greyvalue}{valeurgris} -\setinterfacecommand{grid}{grille} -\setinterfacecommand{hairline}{ligneh} -\setinterfacecommand{head}{tete} -\setinterfacecommand{headerdistance}{distanceentete} -\setinterfacecommand{headerheight}{hauteurentete} -\setinterfacecommand{headlevel}{niveautete} -\setinterfacecommand{headnumber}{numerotete} -\setinterfacecommand{headsym}{headsym} -\setinterfacecommand{headtext}{textetete} -\setinterfacecommand{hideblocks}{cacheblocs} -\setinterfacecommand{high}{haut} -\setinterfacecommand{hl}{hl} -\setinterfacecommand{immediatebetweenlist}{immediatebetweenlist} -\setinterfacecommand{immediatetolist}{immediatetolist} -\setinterfacecommand{in}{dans} -\setinterfacecommand{incrementnumber}{incrementenumero} -\setinterfacecommand{indenting}{composeenalinea} -\setinterfacecommand{inframed}{inframed} -\setinterfacecommand{infull}{infull} -\setinterfacecommand{ininner}{ininner} -\setinterfacecommand{inleft}{dansgauche} -\setinterfacecommand{inleftedge}{dansbordgauche} -\setinterfacecommand{inleftmargin}{dansmargegauche} -\setinterfacecommand{inline}{alaligne} -\setinterfacecommand{inmargin}{dansmarge} -\setinterfacecommand{inmframed}{inmframed} -\setinterfacecommand{inneredgedistance}{inneredgedistance} -\setinterfacecommand{inneredgewidth}{inneredgewidth} -\setinterfacecommand{innermargindistance}{innermargindistance} -\setinterfacecommand{innermarginwidth}{innermarginwidth} -\setinterfacecommand{inothermargin}{dansautremarge} -\setinterfacecommand{inouter}{inouter} -\setinterfacecommand{inright}{dansdroite} -\setinterfacecommand{inrightedge}{dansborddroit} -\setinterfacecommand{inrightmargin}{dansmargedroite} -\setinterfacecommand{installlanguage}{installelangue} -\setinterfacecommand{interactionbar}{barreinteraction} -\setinterfacecommand{interactionbuttons}{boutonsinteraction} -\setinterfacecommand{interactionmenu}{menuinteraction} -\setinterfacecommand{item}{element} -\setinterfacecommand{items}{elements} -\setinterfacecommand{its}{el} -\setinterfacecommand{keepblocks}{gardeblocs} -\setinterfacecommand{label}{etiquette} -\setinterfacecommand{labels}{etiquettes} -\setinterfacecommand{labeltext}{labeltexte} -\setinterfacecommand{language}{langue} -\setinterfacecommand{leftaligned}{aligneagauche} -\setinterfacecommand{leftedgedistance}{distancebordgauche} -\setinterfacecommand{leftedgewidth}{largeurbordgauche} -\setinterfacecommand{leftmargindistance}{distancemargegauche} -\setinterfacecommand{leftmarginwidth}{largeurmargegauche} -\setinterfacecommand{leg}{leg} -\setinterfacecommand{linewidth}{largeurligne} -\setinterfacecommand{listheight}{hauteurliste} -\setinterfacecommand{listlength}{llongueurliste} -\setinterfacecommand{listsymbol}{listesymbole} -\setinterfacecommand{listwidth}{largeurliste} -\setinterfacecommand{logfields}{logchamp} -\setinterfacecommand{lohi}{baha} -\setinterfacecommand{low}{bas} -\setinterfacecommand{macroname}{nommacro} -\setinterfacecommand{mainlanguage}{langueprincipale} -\setinterfacecommand{makeupheight}{hauteurmakeup} -\setinterfacecommand{makeupwidth}{largeurmakeup} -\setinterfacecommand{mar}{mar} -\setinterfacecommand{margindistance}{distancemarge} -\setinterfacecommand{marginrule}{margereglee} -\setinterfacecommand{margintext}{textemarge} -\setinterfacecommand{margintitle}{titremarge} -\setinterfacecommand{marginwidth}{largeurmarge} -\setinterfacecommand{marginword}{motmarge} -\setinterfacecommand{marking}{marquage} -\setinterfacecommand{markversion}{marquageversion} -\setinterfacecommand{mathematics}{mathematique} -\setinterfacecommand{menubutton}{boutonmenu} -\setinterfacecommand{mframed}{mframed} -\setinterfacecommand{midaligned}{aligneaumilieu} -\setinterfacecommand{mirror}{reflete} -\setinterfacecommand{month}{mois} -\setinterfacecommand{moveformula}{deplaceformule} -\setinterfacecommand{moveongrid}{deplacesurgrille} -\setinterfacecommand{movesidefloat}{movesidefloat} -\setinterfacecommand{navigating}{navigating} -\setinterfacecommand{nodimension}{sansdimension} -\setinterfacecommand{noheaderandfooterlines}{sanslignesenteteetpdp} -\setinterfacecommand{noindenting}{sansalinea} -\setinterfacecommand{nolist}{sansliste} -\setinterfacecommand{nomarking}{sansmarquage} -\setinterfacecommand{nomoreblocks}{pasplusdeblocs} -\setinterfacecommand{nomorefiles}{pasplusdefichiers} -\setinterfacecommand{nop}{nop} -\setinterfacecommand{nospace}{sansespace} -\setinterfacecommand{note}{note} -\setinterfacecommand{notopandbottomlines}{sanslignessupetinf} -\setinterfacecommand{notsmallcapped}{nocap} -\setinterfacecommand{nowhitespace}{sansespaceblanc} -\setinterfacecommand{numberofsubpages}{nombredesouspages} -\setinterfacecommand{numbers}{numeros} -\setinterfacecommand{outeredgedistance}{outeredgedistance} -\setinterfacecommand{outeredgewidth}{outeredgewidth} -\setinterfacecommand{outermargindistance}{outermargindistance} -\setinterfacecommand{outermarginwidth}{outermarginwidth} -\setinterfacecommand{packed}{groupe} -\setinterfacecommand{page}{page} -\setinterfacecommand{pagedepth}{pagedepth} -\setinterfacecommand{pagenumber}{numeropage} -\setinterfacecommand{pageoffset}{pageoffset} -\setinterfacecommand{pagereference}{referencepage} -\setinterfacecommand{pagetype}{tapepage} -\setinterfacecommand{paperheight}{hauteurpapier} -\setinterfacecommand{paperwidth}{largeurpapier} -\setinterfacecommand{periods}{periodes} -\setinterfacecommand{plaatsruwelijst}{placerawlist} -\setinterfacecommand{placebookmarks}{placemarquespages} -\setinterfacecommand{placecombinedlist}{placelisteinmbriquee} -\setinterfacecommand{placefloat}{placeflottant} -\setinterfacecommand{placefootnotes}{placenotespdp} -\setinterfacecommand{placeformula}{placeformule} -\setinterfacecommand{placeheadnumber}{placenumerotete} -\setinterfacecommand{placeheadtext}{placetextetete} -\setinterfacecommand{placelegend}{placelegende} -\setinterfacecommand{placelist}{placeliste} -\setinterfacecommand{placelocalfootnotes}{placenotespdplocales} -\setinterfacecommand{placelogos}{placelogos} -\setinterfacecommand{placeongrid}{placesurgrille} -\setinterfacecommand{placeontopofeachother}{placelesunsaudessusdesautres} -\setinterfacecommand{placepagenumber}{placenumeropage} -\setinterfacecommand{placereferencelist}{placelistereference} -\setinterfacecommand{placeregister}{placeregistre} -\setinterfacecommand{placerule}{placeregle} -\setinterfacecommand{placesidebyside}{placecoteacote} -\setinterfacecommand{placesubformula}{placesousformule} -\setinterfacecommand{placetextvariable}{placevariabletexte} -\setinterfacecommand{position}{position} -\setinterfacecommand{positiontext}{positionnetexte} -\setinterfacecommand{printpaperheight}{hauteureditionpapier} -\setinterfacecommand{printpaperwidth}{largeureditionpapier} -\setinterfacecommand{processblocks}{traiteblocs} -\setinterfacecommand{processpage}{traitepage} -\setinterfacecommand{product}{produit} -\setinterfacecommand{program}{programme} -\setinterfacecommand{project}{projet} -\setinterfacecommand{publication}{publication} -\setinterfacecommand{quotation}{citation} -\setinterfacecommand{quote}{citer} -\setinterfacecommand{ran}{ran} -\setinterfacecommand{redo}{refait} -\setinterfacecommand{ref}{ref} -\setinterfacecommand{reference}{reference} -\setinterfacecommand{referral}{recommandation} -\setinterfacecommand{referraldate}{daterecommandation} -\setinterfacecommand{referring}{faitreference} -\setinterfacecommand{remark}{commentaire} -\setinterfacecommand{reset}{raz} -\setinterfacecommand{resetmarking}{razmarquage} -\setinterfacecommand{resetnumber}{raznumero} -\setinterfacecommand{resettext}{resettextcontent} -\setinterfacecommand{rightaligned}{aligneadroite} -\setinterfacecommand{rightedgedistance}{distanceborddroit} -\setinterfacecommand{rightedgewidth}{largeurborddroit} -\setinterfacecommand{rightmargindistance}{distancemargedroite} -\setinterfacecommand{rightmarginwidth}{largeurmargedroite} -\setinterfacecommand{romannumerals}{chiffresromains} -\setinterfacecommand{rotate}{oriente} -\setinterfacecommand{scale}{echelle} -\setinterfacecommand{screen}{ecran} -\setinterfacecommand{selectblocks}{selectionneblocs} -\setinterfacecommand{selectpaper}{selectionnepapier} -\setinterfacecommand{selectversion}{selectionneversion} -\setinterfacecommand{setnumber}{affectenumero} -\setinterfacecommand{settextcontent}{settext} -\setinterfacecommand{settextvariable}{affectevariabletexte} -\setinterfacecommand{setupalign}{reglealignement} -\setinterfacecommand{setupanswerarea}{setupanswerarea} -\setinterfacecommand{setuparranging}{reglearrangement} -\setinterfacecommand{setupbackground}{reglearriereplan} -\setinterfacecommand{setupbackgrounds}{reglearriereplans} -\setinterfacecommand{setupblackrules}{reglelignesnoires} -\setinterfacecommand{setupblank}{definitvide} -\setinterfacecommand{setupblock}{reglebloc} -\setinterfacecommand{setupbodyfont}{reglepolicecorps} -\setinterfacecommand{setupbodyfontenvironment}{regleenvironnementpolicecorps} -\setinterfacecommand{setupbottom}{regleinf} -\setinterfacecommand{setupbottomtexts}{regletextesinf} -\setinterfacecommand{setupbuffer}{reglebuffer} -\setinterfacecommand{setupbuttons}{regleboutons} -\setinterfacecommand{setupcapitals}{reglecapitales} -\setinterfacecommand{setupcaption}{regleintitule} -\setinterfacecommand{setupcaptions}{regleintitules} -\setinterfacecommand{setupclipping}{regleclipping} -\setinterfacecommand{setupcolor}{reglecouleur} -\setinterfacecommand{setupcolors}{reglecouleurs} -\setinterfacecommand{setupcolumns}{reglecolonnes} -\setinterfacecommand{setupcolumnset}{reglejeucolonne} -\setinterfacecommand{setupcolumnsetlines}{setupcolumnsetlines} -\setinterfacecommand{setupcolumnsetstart}{setupcolumnsetstart} -\setinterfacecommand{setupcombinations}{reglecombinaisons} -\setinterfacecommand{setupcombinedlist}{reglelisteimbriquee} -\setinterfacecommand{setupcomment}{reglecommentaire} -\setinterfacecommand{setupdescriptions}{regledescriptions} -\setinterfacecommand{setupenumerations}{regleenumerations} -\setinterfacecommand{setupexternalfigures}{reglefiguresexternes} -\setinterfacecommand{setupfield}{reglechamp} -\setinterfacecommand{setupfields}{reglechamps} -\setinterfacecommand{setupfillinlines}{regleremplitligne} -\setinterfacecommand{setupfillinrules}{regleremplitlignesreglees} -\setinterfacecommand{setupfloat}{regleflottant} -\setinterfacecommand{setupfloats}{regleflottants} -\setinterfacecommand{setupfloatsplitting}{regleseparationflottant} -\setinterfacecommand{setupfooter}{reglepdp} -\setinterfacecommand{setupfootertexts}{regletextespdp} -\setinterfacecommand{setupfootnotedefinition}{definitnotepdp} -\setinterfacecommand{setupfootnotes}{reglenotepdp} -\setinterfacecommand{setupforms}{regleformulaires} -\setinterfacecommand{setupformulas}{regleformules} -\setinterfacecommand{setupframed}{regleencadre} -\setinterfacecommand{setupframedtexts}{setupframedtexts} -\setinterfacecommand{setuphead}{regletete} -\setinterfacecommand{setupheader}{regleentete} -\setinterfacecommand{setupheadertexts}{regletextesentete} -\setinterfacecommand{setupheadnumber}{reglenumerotete} -\setinterfacecommand{setupheads}{regletetes} -\setinterfacecommand{setupheadtext}{regletextetete} -\setinterfacecommand{setuphyphenmark}{reglemarquagehyphenation} -\setinterfacecommand{setupindentations}{reglealineas} -\setinterfacecommand{setupindenting}{reglecomposeenalinea} -\setinterfacecommand{setupinmargin}{regledansmarge} -\setinterfacecommand{setupinteraction}{regleinteraction} -\setinterfacecommand{setupinteractionbar}{reglebarreinteraction} -\setinterfacecommand{setupinteractionmenu}{reglemenuinteraction} -\setinterfacecommand{setupinteractionscreen}{regleecraninteraction} -\setinterfacecommand{setupinterlinespace}{regleespacementinterligne} -\setinterfacecommand{setupitemgroup}{setupitemgroup} -\setinterfacecommand{setupitemgroups}{reglegroupeselements} -\setinterfacecommand{setupitems}{regleelements} -\setinterfacecommand{setuplabeltext}{reglelabeltexte} -\setinterfacecommand{setuplanguage}{reglelangue} -\setinterfacecommand{setuplayout}{regledisposition} -\setinterfacecommand{setuplegend}{reglelegende} -\setinterfacecommand{setuplinenumbering}{reglenumerotationligne} -\setinterfacecommand{setuplines}{reglelignes} -\setinterfacecommand{setuplinewidth}{regleepaisseurligne} -\setinterfacecommand{setuplist}{regleliste} -\setinterfacecommand{setupmakeup}{reglemakeup} -\setinterfacecommand{setupmarginblocks}{regleblocmarge} -\setinterfacecommand{setupmarginrules}{reglemargereglee} -\setinterfacecommand{setupmarking}{reglemarquage} -\setinterfacecommand{setupmathalignment}{setupmathalignment} -\setinterfacecommand{setupnarrower}{reglecompoetroite} -\setinterfacecommand{setupnumber}{reglenumero} -\setinterfacecommand{setupnumbering}{reglenumerotation} -\setinterfacecommand{setupoppositeplacing}{regleplacementopposition} -\setinterfacecommand{setupoutput}{reglesortie} -\setinterfacecommand{setuppagecomment}{reglecommentairepage} -\setinterfacecommand{setuppagenumber}{reglenumeropage} -\setinterfacecommand{setuppagenumbering}{reglenumerotationpage} -\setinterfacecommand{setuppagetransitions}{regletransitionspage} -\setinterfacecommand{setuppalet}{reglepalette} -\setinterfacecommand{setuppaper}{reglepapier} -\setinterfacecommand{setuppapersize}{regletaillepapier} -\setinterfacecommand{setupparagraphnumbering}{reglenumerotationparagraphe} -\setinterfacecommand{setupparagraphs}{regleparagraphes} -\setinterfacecommand{setupplacement}{setupplacement} -\setinterfacecommand{setuppositioning}{reglepositionnement} -\setinterfacecommand{setupprofiles}{regleprofils} -\setinterfacecommand{setupprograms}{regleprogrammes} -\setinterfacecommand{setuppublications}{reglepublications} -\setinterfacecommand{setupquote}{demarreciter} -\setinterfacecommand{setupreferencelist}{reglelistereference} -\setinterfacecommand{setupreferencing}{reglereferencage} -\setinterfacecommand{setupregister}{regleregistre} -\setinterfacecommand{setuprotate}{regleoriente} -\setinterfacecommand{setuprule}{regleregle} -\setinterfacecommand{setups}{reglages} -\setinterfacecommand{setupscreens}{regleecrans} -\setinterfacecommand{setupsection}{reglesection} -\setinterfacecommand{setupsectionblock}{regleblocsection} -\setinterfacecommand{setupsorting}{regletri} -\setinterfacecommand{setupspacing}{regleespacement} -\setinterfacecommand{setupstartstop}{regledemarrestoppe} -\setinterfacecommand{setupstrut}{reglestrut} -\setinterfacecommand{setupsubpagenumber}{reglesousnumeropage} -\setinterfacecommand{setupsymbolset}{reglejeusymboles} -\setinterfacecommand{setupsynchronization}{reglesynchronisation} -\setinterfacecommand{setupsynchronizationbar}{reglebarresynchronisation} -\setinterfacecommand{setupsynonyms}{reglesynonymes} -\setinterfacecommand{setupsystem}{reglesysteme} -\setinterfacecommand{setuptab}{regletab} -\setinterfacecommand{setuptables}{regletableaux} -\setinterfacecommand{setuptabulate}{regletabulation} -\setinterfacecommand{setuptext}{regletexte} -\setinterfacecommand{setuptextposition}{reglepositiontexte} -\setinterfacecommand{setuptextrules}{reglelignesreglestexte} -\setinterfacecommand{setuptexttexts}{regletextestexte} -\setinterfacecommand{setuptextvariable}{reglevariabletexte} -\setinterfacecommand{setupthinrules}{regletraitsfins} -\setinterfacecommand{setuptolerance}{regletolerance} -\setinterfacecommand{setuptop}{reglesup} -\setinterfacecommand{setuptoptexts}{regletextessup} -\setinterfacecommand{setuptype}{regletype} -\setinterfacecommand{setuptyping}{regledactylo} -\setinterfacecommand{setupunderbar}{reglesouslignage} -\setinterfacecommand{setupurl}{regleurl} -\setinterfacecommand{setupversions}{regleversions} -\setinterfacecommand{setupwhitespace}{regleespaceblanc} -\setinterfacecommand{showbodyfont}{montrepolicecorps} -\setinterfacecommand{showbodyfontenvironment}{montreenvironnementpolicecorps} -\setinterfacecommand{showcolor}{montrecouleur} -\setinterfacecommand{showcolorgroup}{montregroupecouleur} -\setinterfacecommand{showexternalfigures}{montrefiguresexternes} -\setinterfacecommand{showfields}{montrechamps} -\setinterfacecommand{showframe}{montrecadre} -\setinterfacecommand{showgrid}{montregrille} -\setinterfacecommand{showlayout}{montredisposition} -\setinterfacecommand{showmakeup}{montremakeup} -\setinterfacecommand{showpalet}{montrepalette} -\setinterfacecommand{showprint}{montreedition} -\setinterfacecommand{showsetups}{montrereglages} -\setinterfacecommand{showstruts}{montrestruts} -\setinterfacecommand{showsymbolset}{montrejeusymboles} -\setinterfacecommand{smallcapped}{cap} -\setinterfacecommand{someline}{uneligne} -\setinterfacecommand{somewhere}{qqpart} -\setinterfacecommand{space}{espace} -\setinterfacecommand{splitfloat}{separeflottant} -\setinterfacecommand{startalignment}{demarrealignement} -\setinterfacecommand{startbackground}{demarrearriereplan} -\setinterfacecommand{startcoding}{demarrecodage} -\setinterfacecommand{startcolor}{demarrecouleur} -\setinterfacecommand{startcolumnmakeup}{startcolumnmakeup} -\setinterfacecommand{startcolumns}{demarrecolonnes} -\setinterfacecommand{startcolumnset}{demarrejeucolonne} -\setinterfacecommand{startcombination}{demarrecombinaison} -\setinterfacecommand{startcomponent}{demarrecomposant} -\setinterfacecommand{startdocument}{demarredocument} -\setinterfacecommand{startenvironment}{demarreenvironement} -\setinterfacecommand{startfigure}{demarrefigure} -\setinterfacecommand{startglobal}{demarreglobal} -\setinterfacecommand{startline}{demarreligne} -\setinterfacecommand{startlinecorrection}{demarrecorrectionligne} -\setinterfacecommand{startlinenumbering}{demarrenumerotationligne} -\setinterfacecommand{startlines}{demarrelignes} -\setinterfacecommand{startlocal}{demarrelocal} -\setinterfacecommand{startlocalfootnotes}{demarrenotespdplocales} -\setinterfacecommand{startmakeup}{demarremakeup} -\setinterfacecommand{startmarginblock}{demarreblocmarge} -\setinterfacecommand{startmarginrule}{demarremargereglee} -\setinterfacecommand{startnarrower}{demarrecompoetroite} -\setinterfacecommand{startopposite}{demarreopposition} -\setinterfacecommand{startoverlay}{demarrerevetement} -\setinterfacecommand{startoverzicht}{demarrevuedensemble} -\setinterfacecommand{startpacked}{demarregroupe} -\setinterfacecommand{startpositioning}{demarrepositionnement} -\setinterfacecommand{startproduct}{demarreproduit} -\setinterfacecommand{startprofile}{demarreprofil} -\setinterfacecommand{startproject}{demarreprojet} -\setinterfacecommand{startquotation}{demarrecitation} -\setinterfacecommand{startraster}{demarreraster} -\setinterfacecommand{startsymbolset}{demarrejeusymboles} -\setinterfacecommand{startsynchronization}{demarresynchronisation} -\setinterfacecommand{starttable}{demarretableau} -\setinterfacecommand{starttables}{demarretableaux} -\setinterfacecommand{starttext}{demarretexte} -\setinterfacecommand{starttextrule}{demarreligneregleetexte} -\setinterfacecommand{startunpacked}{demarredegroupe} -\setinterfacecommand{startversion}{demarreversion} -\setinterfacecommand{stopalignment}{stoppealignement} -\setinterfacecommand{stopbackground}{stoppearriereplan} -\setinterfacecommand{stopcoding}{stoppecodage} -\setinterfacecommand{stopcolor}{stoppecouleur} -\setinterfacecommand{stopcolumnmakeup}{stopcolumnmakeup} -\setinterfacecommand{stopcolumns}{stoppecolonnes} -\setinterfacecommand{stopcolumnset}{stoppejeucolonne} -\setinterfacecommand{stopcombination}{stoppecombinaison} -\setinterfacecommand{stopcomponent}{stoppecomposant} -\setinterfacecommand{stopdocument}{stoppedocument} -\setinterfacecommand{stopenvironment}{stoppeenvironement} -\setinterfacecommand{stopglobal}{stoppeglobal} -\setinterfacecommand{stopline}{stoppeligne} -\setinterfacecommand{stoplinecorrection}{stoppecorrectionligne} -\setinterfacecommand{stoplinenumbering}{stoppenumerotationligne} -\setinterfacecommand{stoplines}{stoppelignes} -\setinterfacecommand{stoplocal}{stoppelocal} -\setinterfacecommand{stoplocalfootnotes}{stoppenotespdplocales} -\setinterfacecommand{stopmakeup}{stoppemakeup} -\setinterfacecommand{stopmarginblock}{stoppeblocmarge} -\setinterfacecommand{stopmarginrule}{stoppemargereglee} -\setinterfacecommand{stopnarrower}{stopcompoetroite} -\setinterfacecommand{stopopposite}{stoppeopposition} -\setinterfacecommand{stopoverlay}{stopperevetement} -\setinterfacecommand{stopoverzicht}{stoppevuedensemble} -\setinterfacecommand{stoppacked}{stoppegroupe} -\setinterfacecommand{stoppositioning}{stoppepositionnement} -\setinterfacecommand{stopproduct}{stoppeproduit} -\setinterfacecommand{stopprofile}{stoppeprofil} -\setinterfacecommand{stopproject}{stoppeprojet} -\setinterfacecommand{stopquotation}{stoppecitation} -\setinterfacecommand{stopraster}{stopperaster} -\setinterfacecommand{stopsynchronization}{stoppesynchronisation} -\setinterfacecommand{stoptable}{stoppetableau} -\setinterfacecommand{stoptables}{stoppetableaux} -\setinterfacecommand{stoptext}{stoppetexte} -\setinterfacecommand{stoptextrule}{stoppeligneregleetexte} -\setinterfacecommand{stopunpacked}{stoppedegroupe} -\setinterfacecommand{stopversion}{stoppeversion} -\setinterfacecommand{stretched}{etire} -\setinterfacecommand{subformulanumber}{numerosousformule} -\setinterfacecommand{subpagenumber}{sousnumeropage} -\setinterfacecommand{switchtobodyfont}{changepolicecorps} -\setinterfacecommand{switchtorawfont}{changepolicebrute} -\setinterfacecommand{sym}{sym} -\setinterfacecommand{symbol}{symbole} -\setinterfacecommand{synchronizationbar}{barresynchronisation} -\setinterfacecommand{synchronize}{synchronise} -\setinterfacecommand{tab}{tab} -\setinterfacecommand{testcolumn}{testcolumn} -\setinterfacecommand{testpage}{testpage} -\setinterfacecommand{tex}{tex} -\setinterfacecommand{textheight}{hauteurtexte} -\setinterfacecommand{textreference}{referencetexte} -\setinterfacecommand{textrule}{ligneregleetexte} -\setinterfacecommand{textvariable}{variabletexte} -\setinterfacecommand{textwidth}{largeurtexte} -\setinterfacecommand{thinrule}{traitfin} -\setinterfacecommand{thinrules}{traitsfins} -\setinterfacecommand{tooltip}{suggestion} -\setinterfacecommand{topdistance}{distancesup} -\setinterfacecommand{topheight}{hauteursup} -\setinterfacecommand{topspace}{espacesup} -\setinterfacecommand{totalnumberofpages}{nombretotaldepages} -\setinterfacecommand{translate}{traduire} -\setinterfacecommand{txt}{txt} -\setinterfacecommand{typ}{typ} -\setinterfacecommand{type}{dactylographier} -\setinterfacecommand{typebuffer}{tapebuffer} -\setinterfacecommand{typefile}{fichierdactylo} -\setinterfacecommand{unitmeaning}{sensunite} -\setinterfacecommand{unknown}{inconnu} -\setinterfacecommand{useJSscripts}{utiliseJSscripts} -\setinterfacecommand{useURL}{utiliseURL} -\setinterfacecommand{useXMLfilter}{useXMLfilter} -\setinterfacecommand{useblocks}{utiliseblocs} -\setinterfacecommand{usecommands}{utilisecommandes} -\setinterfacecommand{useencoding}{utiliseencodage} -\setinterfacecommand{useexternaldocument}{utilisedocumentexterne} -\setinterfacecommand{useexternalfigure}{utilisefigureexterne} -\setinterfacecommand{useexternalfile}{utilisefichierexterne} -\setinterfacecommand{useexternalfiles}{utilisefichiersexternes} -\setinterfacecommand{useexternalsoundtrack}{utilisepsiteaudioexterne} -\setinterfacecommand{usemodule}{utilisemodule} -\setinterfacecommand{usemodules}{utilisemodules} -\setinterfacecommand{usepath}{utilisechemin} -\setinterfacecommand{usereferences}{utilisereferences} -\setinterfacecommand{usespecials}{utilisespecialites} -\setinterfacecommand{usesymbols}{utilisesymboles} -\setinterfacecommand{usetypescript}{usetypescript} -\setinterfacecommand{usetypescriptfile}{usetypescriptfile} -\setinterfacecommand{useurl}{utiliseurl} -\setinterfacecommand{version}{version} -\setinterfacecommand{vl}{vl} -\setinterfacecommand{weekday}{joursemaine} -\setinterfacecommand{whitespace}{espaceblanc} -\setinterfacecommand{wordright}{motdroit} -\setinterfacecommand{writebetweenlist}{ecritentreliste} -\setinterfacecommand{writetolist}{ecritdansliste} -\setinterfacecommand{writetoreferencelist}{ecritdanslistereference} -\setinterfacecommand{writetoregister}{ecritregistre} -% -\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-fst.mkii b/Master/texmf-dist/tex/context/base/mult-fst.mkii new file mode 100644 index 00000000000..e655e3d26d0 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-fst.mkii @@ -0,0 +1,36 @@ +%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\dosetvalue #1#2{\@EA\def \csname#1#2\endcsname} + \def\dosetevalue #1#2{\@EA\edef\csname#1#2\endcsname} + \def\dosetgvalue #1#2{\@EA\gdef\csname#1#2\endcsname} + \def\dosetxvalue #1#2{\@EA\gdef\csname#1#2\endcsname} + \def\docopyvalue#1#2#3{\@EA\def \csname#1#3\@EA\endcsname\@EA{\csname#2#3\endcsname}} + + \def\setinterfaceconstant#1#2{\setvalue{\c!prefix!#1}{#1}} + \def\setinterfacevariable#1#2{\setvalue{\v!prefix!#1}{#2}} + + \def\interfaced#1{#1} + +\stopinterface + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/mult-fst.mkiv b/Master/texmf-dist/tex/context/base/mult-fst.mkiv new file mode 100644 index 00000000000..11558b557c6 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-fst.mkiv @@ -0,0 +1,41 @@ +%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\dosetvalue #1#2{\@EA\def \csname#1#2\endcsname} + \def\dosetevalue #1#2{\@EA\edef\csname#1#2\endcsname} + \def\dosetgvalue #1#2{\@EA\gdef\csname#1#2\endcsname} + \def\dosetxvalue #1#2{\@EA\gdef\csname#1#2\endcsname} + \def\docopyvalue#1#2#3{\@EA\def \csname#1#3\@EA\endcsname\@EA{\csname#2#3\endcsname}} + + \def\setinterfaceconstant#1#2% + {\ctxlua{interfaces.setconstant("#1","#2")}% + \setvalue{\c!prefix!#1}{#1}} + + \def\setinterfacevariable#1#2% + {\ctxlua{interfaces.setvariable("#1","#2")}% + \setvalue{\v!prefix!#1}{#2}} + + \def\interfaced#1{#1} + +\stopinterface + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/mult-fst.tex b/Master/texmf-dist/tex/context/base/mult-fst.tex deleted file mode 100644 index c237f574399..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-fst.tex +++ /dev/null @@ -1,53 +0,0 @@ -%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\dosetvalue #1#2{\@EA\def \csname#1#2\endcsname} - \def\dosetevalue #1#2{\@EA\edef\csname#1#2\endcsname} - \def\dosetgvalue #1#2{\@EA\gdef\csname#1#2\endcsname} - \def\dosetxvalue #1#2{\@EA\gdef\csname#1#2\endcsname} - \def\docopyvalue#1#2#3{\@EA\def \csname#1#3\@EA\endcsname\@EA{\csname#2#3\endcsname}} - - \ifx\ctxlua\undefined - - \def\setinterfaceconstant#1#2% - {\setvalue{\c!prefix!#1}{#1}} - - \def\setinterfacevariable#1#2% - {\setvalue{\v!prefix!#1}{#2}} - - \else - - \def\setinterfaceconstant#1#2% - {\ctxlua{interfaces.setconstant("#1","#2")}% - \setvalue{\c!prefix!#1}{#1}} - - \def\setinterfacevariable#1#2% - {\ctxlua{interfaces.setvariable("#1","#2")}% - \setvalue{\v!prefix!#1}{#2}} - - \fi - - \def\interfaced#1{#1} - -\stopinterface - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/mult-ini.lua b/Master/texmf-dist/tex/context/base/mult-ini.lua index 92a7bc62965..4156e813d38 100644 --- a/Master/texmf-dist/tex/context/base/mult-ini.lua +++ b/Master/texmf-dist/tex/context/base/mult-ini.lua @@ -10,79 +10,232 @@ local format, gmatch, gsub = string.format, string.gmatch, string.gsub local lpegmatch = lpeg.match local serialize = table.serialize -interfaces = interfaces or { } -interfaces.messages = interfaces.messages or { } -interfaces.constants = interfaces.constants or { } -interfaces.variables = interfaces.variables or { } +local allocate = utilities.storage.allocate +local mark = utilities.storage.mark +local texsprint = tex.sprint +local setmetatableindex = table.setmetatableindex -storage.register("interfaces/messages", interfaces.messages, "interfaces.messages" ) -storage.register("interfaces/constants", interfaces.constants, "interfaces.constants") -storage.register("interfaces/variables", interfaces.variables, "interfaces.variables") +local report_interface = logs.reporter("interface","initialization") -local messages, constants, variables = interfaces.messages, interfaces.constants, interfaces.variables +interfaces = interfaces or { } +interfaces.constants = mark(interfaces.constants or { }) +interfaces.variables = mark(interfaces.variables or { }) +interfaces.elements = mark(interfaces.elements or { }) +interfaces.formats = mark(interfaces.formats or { }) +interfaces.translations = mark(interfaces.translations or { }) + +storage.register("interfaces/constants", interfaces.constants, "interfaces.constants") +storage.register("interfaces/variables", interfaces.variables, "interfaces.variables") +storage.register("interfaces/elements", interfaces.elements, "interfaces.elements") +storage.register("interfaces/formats", interfaces.formats, "interfaces.formats") +storage.register("interfaces/translations", interfaces.translations, "interfaces.translations") + +interfaces.interfaces = { + "cs", "de", "en", "fr", "it", "nl", "ro", "pe", +} + +storage.shared.currentinterface = storage.shared.currentinterface or "en" +storage.shared.currentresponse = storage.shared.currentresponse or "en" + +local currentinterface = storage.shared.currentinterface +local currentresponse = storage.shared.currentresponse + +local complete = allocate() +interfaces.complete = complete + +local function resolve(t,k) -- one access needed to get loaded + report_interface("loading interface definitions from 'mult-def.lua'") + complete = dofile(resolvers.findfile("mult-def.lua")) + report_interface("loading interface messages from 'mult-mes.lua'") + complete.messages = dofile(resolvers.findfile("mult-mes.lua")) + interfaces.complete = complete + return rawget(complete,k) +end + +setmetatableindex(complete, resolve) + +local constants = interfaces.constants +local variables = interfaces.variables +local elements = interfaces.elements +local formats = interfaces.formats +local translations = interfaces.translations +local reporters = { } -- just an optimization + +local function valueiskey(t,k) -- will be helper + t[k] = k + return k +end + +setmetatableindex(variables, valueiskey) +setmetatableindex(constants, valueiskey) +setmetatableindex(elements, valueiskey) +setmetatableindex(formats, valueiskey) +setmetatableindex(translations, valueiskey) + +local function resolve(t,k) + local v = logs.reporter(k) + t[k] = v + return v +end + +setmetatableindex(reporters, resolve) + +for category, _ in next, translations do + -- We pre-create reporters for already defined messages + -- because otherwise listing is incomplete and we want + -- to use that for checking so delaying makes not much + -- sense there. + local r = reporters[category] +end + +-- adding messages + +local function add(target,tag,values) + local t = target[tag] + if not f then + target[tag] = values + else + for k, v in next, values do + if f[k] then + -- error + else + f[k] = v + end + end + end +end + +function interfaces.settranslation(tag,values) + add(translations,tag,values) +end + +function interfaces.setformat(tag,values) + add(formats,tag,values) +end + +-- the old method: + +local function fulltag(category,tag) + tag = gsub(tag,"%-%-","%%s") + return format("%s:%s",category,tag) +end function interfaces.setmessages(category,str) - local m = messages[category] or { } - for k, v in gmatch(str,"(%S+) *: *(.-) *[\n\r]") do - m[k] = gsub(v,"%-%-","%%s") + for tag, message in gmatch(str,"(%S+) *: *(.-) *[\n\r]") do + if tag == "title" then + translations[tag] = translations[tag] or tag + else + formats[fulltag(category,tag)] = gsub(message,"%-%-","%%s") + end end - messages[category] = m end function interfaces.setmessage(category,tag,message) - local m = messages[category] - if not m then - m = { } - messages[category] = m - end - m[tag] = gsub(message,"%-%-","%%s") + formats[fulltag(category,tag)] = gsub(message,"%-%-","%%s") end function interfaces.getmessage(category,tag,default) - local m = messages[category] - return (m and m[tag]) or default or "unknown message" + return formats[fulltag(category,tag)] or default or "unknown message" end function interfaces.doifelsemessage(category,tag) - local m = messages[category] - return commands.testcase(m and m[tag]) + return commands.testcase(formats[fulltag(category,tag)]) end -local messagesplitter = lpeg.splitat(",") +local splitter = lpeg.splitat(",") -function interfaces.makemessage(category,tag,arguments) - local m = messages[category] - m = (m and (m[tag] or m[tostring(tag)])) or format("unknown message, category '%s', tag '%s'",category,tag) - if not m then - return m .. " " .. tag - elseif not arguments then - return m +function interfaces.showmessage(category,tag,arguments) + local r = reporters[category] + local f = formats[fulltag(category,tag)] + if type(arguments) == "string" and #arguments > 0 then + r(f,lpegmatch(splitter,arguments)) + elseif arguments then + r(f,arguments) else - return format(m,lpegmatch(messagesplitter,arguments)) + r(f) end end -function interfaces.showmessage(category,tag,arguments) - local m = messages[category] - commands.writestatus((m and m.title) or "unknown title",interfaces.makemessage(category,tag,arguments)) -end +-- till here function interfaces.setvariable(variable,given) ---~ variables[given] = variable - variables[variable] = given + variables[given] = variable end function interfaces.setconstant(constant,given) constants[given] = constant end --- it's nicer to have numbers as reference than a hash +function interfaces.setelement(element,given) + elements[given] = element +end + +-- the real thing: + +logs.setmessenger(context.verbatim.ctxreport) + +-- status + +function commands.writestatus(category,message) + local r = reporters[category] + r(message) +end + +-- initialization + +function interfaces.setuserinterface(interface,response) + storage.shared.currentinterface, currentinterface = interface, interface + storage.shared.currentresponse, currentresponse = response, response + if environment.initex then + local nofconstants = 0 + for given, constant in next, complete.constants do + constant = constant[interface] or constant.en or given + constants[constant] = given -- breedte -> width + texsprint("\\do@sicon{",given,"}{",constant,"}") + nofconstants = nofconstants + 1 + end + local nofvariables = 0 + for given, variable in next, complete.variables do + variable = variable[interface] or variable.en or given + variables[given] = variable -- ja -> yes + texsprint("\\do@sivar{",given,"}{",variable,"}") + nofvariables = nofvariables + 1 + end + local nofelements = 0 + for given, element in next, complete.elements do + element = element[interface] or element.en or given + elements[element] = given + texsprint("\\do@siele{",given,"}{",element,"}") + nofelements = nofelements + 1 + end + local nofcommands = 0 + for given, command in next, complete.commands do + command = command[interface] or command.en or given + if command ~= given then + texsprint("\\do@sicom{",given,"}{",command,"}") + end + nofcommands = nofcommands + 1 + end + local nofformats = 0 + for given, format in next, complete.messages.formats do + formats[given] = format[interface] or format.en or given + nofformats = nofformats + 1 + end + local noftranslations = 0 + for given, translation in next, complete.messages.translations do + translations[given] = translation[interface] or translation.en or given + noftranslations = noftranslations + 1 + end + report_interface("definitions: %s constants, %s variables, %s elements, %s commands, % formats, %s translations", + nofconstants,nofvariables,nofelements,nofcommands,nofformats,noftranslations) + end +end interfaces.cachedsetups = interfaces.cachedsetups or { } interfaces.hashedsetups = interfaces.hashedsetups or { } -storage.register("interfaces.cachedsetups", interfaces.cachedsetups, "interfaces.cachedsetups") -storage.register("interfaces.hashedsetups", interfaces.hashedsetups, "interfaces.hashedsetups") +storage.register("interfaces/cachedsetups", interfaces.cachedsetups, "interfaces.cachedsetups") +storage.register("interfaces/hashedsetups", interfaces.hashedsetups, "interfaces.hashedsetups") local cachedsetups = interfaces.cachedsetups local hashedsetups = interfaces.hashedsetups @@ -101,5 +254,10 @@ function interfaces.cachesetup(t) end function interfaces.is_command(str) - return (str and str ~= "" and token.csname_name(token.create(str)) ~= "") or false + return (str and str ~= "" and token.csname_name(token.create(str)) ~= "") or false -- there will be a proper function for this +end + +function interfaces.interfacedcommand(name) + local command = complete.commands[name] + return command and command[currentinterface] or name end diff --git a/Master/texmf-dist/tex/context/base/mult-ini.mkiv b/Master/texmf-dist/tex/context/base/mult-ini.mkiv index e20548f9b5f..afddf692e94 100644 --- a/Master/texmf-dist/tex/context/base/mult-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/mult-ini.mkiv @@ -44,7 +44,7 @@ %D \NC \type{\f!prefix!} \NC f! \NC file \NC\MR %D \NC \type{\k!prefix!} \NC k! \NC constant (indirect) \NC\MR %D \NC \type{\l!prefix!} \NC l! \NC language \NC\MR -%D \NC \type{\m!prefix!} \NC m! \NC message \NC\MR +%D \NC \type{\m!prefix!} \NC m! \NC age \NC\MR %D \NC \type{\p!prefix!} \NC p! \NC procedure \NC\MR %D \NC \type{\r!prefix!} \NC r! \NC reference \NC\MR %D \NC \type{\s!prefix!} \NC s! \NC system \NC\MR @@ -358,10 +358,12 @@ %D which puts the message text asked for in \type %D {\currentmessagetext}. +%D These will become obsolete: + \unexpanded\def\startmessages #1 library: #2 % {\bgroup \ifcsname\m!prefix!#2\endcsname\else\setgvalue{\m!prefix!#2}{#2}\fi - \catcode13=\active + \catcode13=\activecatcode \doifinsetelse{#1}{\currentresponses,all}\dostartmessages\nostartmessages{#2}} \def\dostartmessages#1#2\stopmessages @@ -375,12 +377,14 @@ {\ifcsname\m!prefix!#1\endcsname\else\setgvalue{\m!prefix!#1}{#1}\fi \ctxlua{interfaces.setmessage("#1","#2",\!!bs#3\!!es)}} -\unexpanded\def\setmessagetext #1#2{\edef\currentmessagetext{\ctxlua{tex.sprint(tex.ctxcatcodes,interfaces.getmessage("#1","#2"))}}} +\unexpanded\def\setmessagetext #1#2{\edef\currentmessagetext{\ctxsprint{interfaces.getmessage("#1","#2")}}} +\unexpanded\def\getmessage #1#2{\ctxsprint{interfaces.getmessage("#1","#2")}} + +%D Till here. + \unexpanded\def\doifelsemessage #1#2{\ctxlua{interfaces.doifelsemessage("#1","#2")}} -\unexpanded\def\getmessage #1#2{\ctxlua{tex.sprint(tex.ctxcatcodes,interfaces.getmessage("#1","#2"))}} -\unexpanded\def\getmessagedefault#1#2#3{\ctxlua{tex.sprint(tex.ctxcatcodes,interfaces.getmessage("#1","#2","#3"))}} -\unexpanded\def\makemessage #1#2#3{\ctxlua{tex.sprint(tex.ctxcatcodes,interfaces.makemessage("#1","#2","#3"))}} -\unexpanded\def\showmessage #1#2#3{\ctxlua{interfaces.showmessage("#1","#2","#3")}} +\unexpanded\def\showmessage #1#2#3{\ctxlua{interfaces.showmessage("#1","#2",\!!bs#3\!!es)}} +\unexpanded\def\writestatus #1#2{\ctxcommand{writestatus("#1",\!!bs#2\!!es)}} %D \macros %D {ifshowwarnings, ifshowmessages} @@ -431,62 +435,15 @@ %D interface. (We no longer need the link back to the main %D internal interface.) -\def\doresetvalue#1#2% - {\dosetvalue{#1}{#2}{}} +\def\doresetvalue #1#2{\dosetvalue{#1}{#2}{}} +\def\doignorevalue#1#2#3{\dosetvalue{#1}{#2}{}} -\def\doignorevalue#1#2#3% - {\dosetvalue{#1}{#2}{}} - -\def\dosetvalue#1#2% - {\let\c!internal!\c!internal!n - \ifcsname\k!prefix!#2\endcsname - \let\c!internal!\c!internal!y - \@EA\def\csname#1\csname\k!prefix!#2\endcsname%\endcsname - \else - \let\c!internal!\c!internal!y - \@EA\def\csname#1#2%\endcsname - \fi\endcsname} - -\def\dosetevalue#1#2% - {\let\c!internal!\c!internal!n - \ifcsname\k!prefix!#2\endcsname - \let\c!internal!\c!internal!y - \@EA\edef\csname#1\csname\k!prefix!#2\endcsname%\endcsname - \else - \let\c!internal!\c!internal!y - \@EA\edef\csname#1#2%\endcsname - \fi\endcsname} - -\def\dosetgvalue#1#2% - {\let\c!internal!\c!internal!n - \ifcsname\k!prefix!#2\endcsname - \let\c!internal!\c!internal!y - \@EA\gdef\csname#1\csname\k!prefix!#2\endcsname%\endcsname - \else - \let\c!internal!\c!internal!y - \@EA\gdef\csname#1#2%\endcsname - \fi\endcsname} - -\def\dosetxvalue#1#2% - {\let\c!internal!\c!internal!n - \ifcsname\k!prefix!#2\endcsname - \let\c!internal!\c!internal!y - \@EA\xdef\csname#1\csname\k!prefix!#2\endcsname%\endcsname - \else - \let\c!internal!\c!internal!y - \@EA\xdef\csname#1#2%\endcsname - \fi\endcsname} - -\def\docopyvalue#1#2#3% real tricky expansion, quite unreadable - {\let\c!internal!\c!internal!n - \ifcsname\k!prefix!#3\endcsname - \let\c!internal!\c!internal!y - \@EA\def\csname#1\csname\k!prefix!#3\endcsname - \@EA\endcsname\@EA{\csname#2\csname\k!prefix!#3\endcsname\endcsname}% - \else - \let\c!internal!\c!internal!y - \@EA\def\csname#1#3\@EA\endcsname\@EA{\csname#2#3\endcsname}% - \fi} +\def\doletvalue #1#2{\@EA \let\csname#1#2\endcsname} +\def\dosetvalue #1#2{\@EA \def\csname#1#2\endcsname} +\def\dosetevalue #1#2{\@EA\edef\csname#1#2\endcsname} +\def\dosetgvalue #1#2{\@EA\gdef\csname#1#2\endcsname} +\def\dosetxvalue #1#2{\@EA\xdef\csname#1#2\endcsname} +\def\docopyvalue#1#2#3{\@EA \def\csname#1#3\@EA\endcsname\@EA{\csname#2#3\endcsname}} %D We can now redefine some messages that will be %D introduced in the multi||lingual system module. @@ -744,22 +701,16 @@ %D user constants (keywords) become system variables %D \stopnarrower -%D Anno 2003 I've forgotten why the \type {\c!internal} is -%D still in there; it's probably a left over from the time that +%D The \type {\c!internal} is a left over from the time that %D the user interface documents were not using a specification %D alongside a keyword specification but used a shared file in %D which case we need to go in both directions. -\let\c!internal!y \string -\def\c!internal!n {-} -\let\c!internal! \c!internal!y - % temporary mkiv hack (we can best just store the whole table in memory) \def\setinterfaceconstant#1#2% {\ctxlua{interfaces.setconstant("#1","#2")}% - \setvalue{\c!prefix!#1}{\c!internal!#1}% - \setvalue{\k!prefix!#2}{#1}} + \setvalue{\c!prefix!#1}{#1}} \def\setinterfacevariable#1#2% {\ctxlua{interfaces.setvariable("#1","#2")}% @@ -791,7 +742,8 @@ %D part is needed, we use a \type{-}: \def\setinterfaceelement#1#2% - {\ifcsname\e!prefix!#1\endcsname + {\ctxlua{interfaces.setelement("#1","#2")}% + \ifcsname\e!prefix!#1\endcsname \doifnotvalue{\e!prefix!#1}{#2}{\setvalue{\e!prefix!#1}{#2}}% \else \setvalue{\e!prefix!#1}{#2}% @@ -807,6 +759,13 @@ \unexpanded\def\startelements {\gobbleuntil\stopelements} \unexpanded\def\startcommands {\gobbleuntil\stopcommands} +%D For at the \LUA\ end (experiment): + +\def\do@sicon#1#2{\@EA\gdef\csname\c!prefix!#1\endcsname{#1}} +\def\do@sivar#1#2{\@EA\gdef\csname\v!prefix!#1\endcsname{#2}} +\def\do@siele#1#2{\@EA\gdef\csname\e!prefix!#1\endcsname{#2}} +\def\do@sicom#1#2{\@EA\gdef\csname#2\@EA\endcsname\@EA{\csname#1\endcsname}} + %D \macros %D {interfaced} %D @@ -833,7 +792,8 @@ %D macro's can be enhanced with more testing facilities, but %D for the moment they suffice. -%D Out of convenience we define the banners here. +%D Out of convenience we define the banners here. This might move +%D to the Lua end. \def\contextbanner {ConTeXt \space diff --git a/Master/texmf-dist/tex/context/base/mult-it.mkii b/Master/texmf-dist/tex/context/base/mult-it.mkii new file mode 100644 index 00000000000..3823e651c08 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-it.mkii @@ -0,0 +1,1715 @@ +% this file is auto-generated, don't edit this file +% +% definitions for interface variables for language it +% +\setinterfacevariable{Addition}{Aggiunta} +\setinterfacevariable{Balloon}{Pallone} +\setinterfacevariable{Character}{Lettera} +\setinterfacevariable{Characters}{Lettere} +\setinterfacevariable{CloseDocument}{ChiudiDocumento} +\setinterfacevariable{ExitViewer}{EsciVisualizzatore} +\setinterfacevariable{FirstPage}{PrimaPagina} +\setinterfacevariable{FitHeight}{FitHeight} +\setinterfacevariable{FitWidth}{FitWidth} +\setinterfacevariable{GotoPage}{VaiAPagina} +\setinterfacevariable{Greek}{Greco} +\setinterfacevariable{Help}{Aiuto} +\setinterfacevariable{HideField}{NascondiCampo} +\setinterfacevariable{HideLayer}{HideLayer} +\setinterfacevariable{Key}{Tasto} +\setinterfacevariable{LastPage}{UltimaPagina} +\setinterfacevariable{LoadForm}{CaricaForm} +\setinterfacevariable{MONTH}{MESE} +\setinterfacevariable{New}{Nuovo} +\setinterfacevariable{NextJump}{SaltoSuccessivo} +\setinterfacevariable{NextPage}{PaginaSuccessiva} +\setinterfacevariable{Numbers}{Numeri} +\setinterfacevariable{OpenNamedDocument}{OpenNamedDocument} +\setinterfacevariable{Paragraph}{Capoverso} +\setinterfacevariable{PauseMovie}{PausaFilm} +\setinterfacevariable{PauseRendering}{PauseRendering} +\setinterfacevariable{PauseSound}{PausaSuono} +\setinterfacevariable{PreviousJump}{SaltoPrecedente} +\setinterfacevariable{PreviousPage}{PaginaPrecedente} +\setinterfacevariable{PrintDocument}{StampaDocumento} +\setinterfacevariable{Query}{Richiesta} +\setinterfacevariable{QueryAgain}{RinnovaRichiesta} +\setinterfacevariable{ResetForm}{ReimpostaForm} +\setinterfacevariable{ResumeMovie}{RiprendiFilm} +\setinterfacevariable{ResumeRendering}{ResumeRendering} +\setinterfacevariable{ResumeSound}{RiprendiSuono} +\setinterfacevariable{Romannumerals}{Numeriromani} +\setinterfacevariable{SaveDocument}{SalvaDocumento} +\setinterfacevariable{SaveForm}{SalvaForm} +\setinterfacevariable{SaveNamedDocument}{SaveNamedDocument} +\setinterfacevariable{SearchAgain}{CercaAncora} +\setinterfacevariable{SearchDocument}{CercaDocumento} +\setinterfacevariable{ShowBookmarks}{MostraSegnalibro} +\setinterfacevariable{ShowField}{MostraCampo} +\setinterfacevariable{ShowThumbs}{MostraThumbs} +\setinterfacevariable{StartMovie}{IniziaFilm} +\setinterfacevariable{StartRendering}{StartRendering} +\setinterfacevariable{StartSound}{IniziaSuono} +\setinterfacevariable{StopMovie}{FermaFilm} +\setinterfacevariable{StopRendering}{StopRendering} +\setinterfacevariable{StopSound}{FermaSuono} +\setinterfacevariable{SubmitForm}{MandaForm} +\setinterfacevariable{ToggleLayer}{ToggleLayer} +\setinterfacevariable{ToggleViewer}{ScambiaVisualizzatore} +\setinterfacevariable{URL}{URL} +\setinterfacevariable{VideLayer}{VideLayer} +\setinterfacevariable{ViewerHelp}{AiutoVisualizzatore} +\setinterfacevariable{WEEKDAY}{GIORNOSETTIMANA} +\setinterfacevariable{WORD}{PAROLA} +\setinterfacevariable{abbreviation}{abbreviazione} +\setinterfacevariable{abbreviations}{abbreviazioni} +\setinterfacevariable{absolute}{assoluto} +\setinterfacevariable{action}{azione} +\setinterfacevariable{after}{dopo} +\setinterfacevariable{all}{tutti} +\setinterfacevariable{always}{sempre} +\setinterfacevariable{and}{and} +\setinterfacevariable{answerarea}{answerarea} +\setinterfacevariable{appendices}{appendici} +\setinterfacevariable{appendix}{appendice} +\setinterfacevariable{april}{aprile} +\setinterfacevariable{atmargin}{almargine} +\setinterfacevariable{atpage}{apagina} +\setinterfacevariable{attachment}{attachment} +\setinterfacevariable{august}{agosto} +\setinterfacevariable{author}{autore} +\setinterfacevariable{auto}{auto} +\setinterfacevariable{autointro}{autointro} +\setinterfacevariable{back}{dietro} +\setinterfacevariable{background}{sfondo} +\setinterfacevariable{backmatter}{postambolo} +\setinterfacevariable{backpart}{postfazione} +\setinterfacevariable{backspace}{backspace} +\setinterfacevariable{backward}{indietro} +\setinterfacevariable{bbl}{bbl} +\setinterfacevariable{before}{prima} +\setinterfacevariable{begin}{begin} +\setinterfacevariable{bib}{bib} +\setinterfacevariable{big}{grande} +\setinterfacevariable{bigbodyfont}{grossofontdeltesto} +\setinterfacevariable{bigger}{bigger} +\setinterfacevariable{bigpreference}{grandepreferenza} +\setinterfacevariable{blank}{rigovuoto} +\setinterfacevariable{blockquote}{blockquote} +\setinterfacevariable{bodymatter}{testiprincipali} +\setinterfacevariable{bodypart}{testoprincipale} +\setinterfacevariable{bold}{grassetto} +\setinterfacevariable{bolditalic}{grassettocorsivo} +\setinterfacevariable{boldslanted}{grassettoinclinato} +\setinterfacevariable{bookmark}{segnalibro} +\setinterfacevariable{both}{entrambi} +\setinterfacevariable{bottom}{fondo} +\setinterfacevariable{brief}{brief} +\setinterfacevariable{broad}{ampio} +\setinterfacevariable{buffer}{buffer} +\setinterfacevariable{by}{da} +\setinterfacevariable{calligraphic}{calligrafico} +\setinterfacevariable{cap}{cap} +\setinterfacevariable{capital}{maiuscolo} +\setinterfacevariable{center}{center} +\setinterfacevariable{chapter}{capitolo} +\setinterfacevariable{character}{lettera} +\setinterfacevariable{characters}{lettere} +\setinterfacevariable{cite}{cite} +\setinterfacevariable{color}{colore} +\setinterfacevariable{column}{colonna} +\setinterfacevariable{columns}{colonne} +\setinterfacevariable{command}{comando} +\setinterfacevariable{commands}{comandi} +\setinterfacevariable{comment}{commento} +\setinterfacevariable{component}{componente} +\setinterfacevariable{concept}{concetto} +\setinterfacevariable{content}{indice} +\setinterfacevariable{contents}{indici} +\setinterfacevariable{continue}{continua} +\setinterfacevariable{continued}{continued} +\setinterfacevariable{controls}{controlli} +\setinterfacevariable{conversion}{coversione} +\setinterfacevariable{current}{corrente} +\setinterfacevariable{cutspace}{cutspace} +\setinterfacevariable{date}{data} +\setinterfacevariable{day}{giorno} +\setinterfacevariable{december}{dicembre} +\setinterfacevariable{default}{implicito} +\setinterfacevariable{depth}{profondita} +\setinterfacevariable{description}{descrizione} +\setinterfacevariable{disable}{disattiva} +\setinterfacevariable{display}{schermo} +\setinterfacevariable{dot}{punto} +\setinterfacevariable{doublesided}{doppiafaccia} +\setinterfacevariable{down}{down} +\setinterfacevariable{each}{ogni} +\setinterfacevariable{edge}{bordo} +\setinterfacevariable{embed}{embed} +\setinterfacevariable{empty}{vuoto} +\setinterfacevariable{end}{end} +\setinterfacevariable{endnote}{endnote} +\setinterfacevariable{enumeration}{enumerazione} +\setinterfacevariable{environment}{ambiente} +\setinterfacevariable{even}{pari} +\setinterfacevariable{external}{esterno} +\setinterfacevariable{fact}{fatto} +\setinterfacevariable{february}{febbraio} +\setinterfacevariable{figure}{figura} +\setinterfacevariable{figures}{figure} +\setinterfacevariable{file}{file} +\setinterfacevariable{final}{finale} +\setinterfacevariable{first}{primo} +\setinterfacevariable{firstcolumn}{firstcolumn} +\setinterfacevariable{firstpage}{primapagina} +\setinterfacevariable{firstsubpage}{primasottopagina} +\setinterfacevariable{fit}{adatta} +\setinterfacevariable{five}{cinque} +\setinterfacevariable{fix}{fisso} +\setinterfacevariable{fixed}{fisso} +\setinterfacevariable{flexible}{flessibile} +\setinterfacevariable{float}{oggettomobile} +\setinterfacevariable{flushinner}{flushinner} +\setinterfacevariable{flushleft}{flushleft} +\setinterfacevariable{flushouter}{flushouter} +\setinterfacevariable{flushright}{flushright} +\setinterfacevariable{footer}{piedipagina} +\setinterfacevariable{footnote}{notapdp} +\setinterfacevariable{force}{forza} +\setinterfacevariable{foreground}{foreground} +\setinterfacevariable{formeel}{formeel} +\setinterfacevariable{formula}{formula} +\setinterfacevariable{formulae}{formule} +\setinterfacevariable{forward}{avanti} +\setinterfacevariable{four}{quattro} +\setinterfacevariable{frame}{cornice} +\setinterfacevariable{framedtext}{testoincorniciato} +\setinterfacevariable{friday}{venerdi} +\setinterfacevariable{frontmatter}{preambolo} +\setinterfacevariable{frontpart}{prefazione} +\setinterfacevariable{global}{globale} +\setinterfacevariable{graphic}{grafico} +\setinterfacevariable{graphics}{grafici} +\setinterfacevariable{gray}{grigio} +\setinterfacevariable{greek}{greco} +\setinterfacevariable{grid}{griglia} +\setinterfacevariable{halfline}{mezzariga} +\setinterfacevariable{handwritten}{grafiamanuale} +\setinterfacevariable{hang}{sospendi} +\setinterfacevariable{hanging}{sospeso} +\setinterfacevariable{head}{testa} +\setinterfacevariable{header}{intestazione} +\setinterfacevariable{height}{altezza} +\setinterfacevariable{helptext}{testoaiuto} +\setinterfacevariable{hencefore}{precedente} +\setinterfacevariable{here}{qui} +\setinterfacevariable{hereafter}{seguente} +\setinterfacevariable{hidden}{nascosto} +\setinterfacevariable{hiding}{nascondere} +\setinterfacevariable{high}{alto} +\setinterfacevariable{horizontal}{orizzontale} +\setinterfacevariable{hyphenated}{sillabato} +\setinterfacevariable{hz}{hz} +\setinterfacevariable{inbetween}{tra} +\setinterfacevariable{index}{indiceanalitico} +\setinterfacevariable{indices}{indicianalitici} +\setinterfacevariable{informeel}{informeel} +\setinterfacevariable{inherit}{inherit} +\setinterfacevariable{inleft}{insinistra} +\setinterfacevariable{inmargin}{inmargine} +\setinterfacevariable{inner}{interno} +\setinterfacevariable{inneredge}{bordointerno} +\setinterfacevariable{innermargin}{margineinterno} +\setinterfacevariable{inright}{indestra} +\setinterfacevariable{interaction}{interazione} +\setinterfacevariable{interactionmenu}{menuinterattivo} +\setinterfacevariable{intermezzi}{intermezzi} +\setinterfacevariable{intermezzo}{intermezzo} +\setinterfacevariable{intext}{intesto} +\setinterfacevariable{intro}{intro} +\setinterfacevariable{italic}{corsivo} +\setinterfacevariable{italicbold}{corsivograssetto} +\setinterfacevariable{item}{elemento} +\setinterfacevariable{itemize}{elenco} +\setinterfacevariable{its}{its} +\setinterfacevariable{january}{gennaio} +\setinterfacevariable{joinedup}{unito} +\setinterfacevariable{july}{luglio} +\setinterfacevariable{june}{giugno} +\setinterfacevariable{keep}{mantieni} +\setinterfacevariable{knockout}{knockout} +\setinterfacevariable{label}{etichetta} +\setinterfacevariable{landscape}{orizzontale} +\setinterfacevariable{last}{ultimo} +\setinterfacevariable{lastcolumn}{lastcolumn} +\setinterfacevariable{lastpage}{ultimapagina} +\setinterfacevariable{lastpagenumber}{lastpagenumber} +\setinterfacevariable{lastsubpage}{ultimasottopagina} +\setinterfacevariable{layer}{layer} +\setinterfacevariable{left}{sinistra} +\setinterfacevariable{leftedge}{bordosinistro} +\setinterfacevariable{lefthanging}{lefthanging} +\setinterfacevariable{leftmargin}{marginesinistro} +\setinterfacevariable{leftpage}{paginasinistra} +\setinterfacevariable{lefttoright}{lefttoright} +\setinterfacevariable{legend}{legenda} +\setinterfacevariable{lesshyphenation}{lesshyphenation} +\setinterfacevariable{line}{riga} +\setinterfacevariable{linenote}{linenote} +\setinterfacevariable{lines}{righe} +\setinterfacevariable{list}{elenco} +\setinterfacevariable{local}{locale} +\setinterfacevariable{localenvironment}{ambientelocale} +\setinterfacevariable{logo}{logo} +\setinterfacevariable{logos}{loghi} +\setinterfacevariable{lohi}{pedap} +\setinterfacevariable{loose}{lento} +\setinterfacevariable{low}{basso} +\setinterfacevariable{ls}{ls} +\setinterfacevariable{makeup}{makeup} +\setinterfacevariable{mar}{mar} +\setinterfacevariable{march}{marzo} +\setinterfacevariable{margin}{margine} +\setinterfacevariable{marginedge}{bordomargine} +\setinterfacevariable{margintitle}{titoloinmargine} +\setinterfacevariable{marking}{marcatura} +\setinterfacevariable{mathalignment}{mathalignment} +\setinterfacevariable{mathcases}{mathcases} +\setinterfacevariable{mathmatrix}{mathmatrix} +\setinterfacevariable{max}{max} +\setinterfacevariable{maxdepth}{maxdepth} +\setinterfacevariable{maxheight}{maxheight} +\setinterfacevariable{maxwidth}{maxwidth} +\setinterfacevariable{may}{maggio} +\setinterfacevariable{mediaeval}{medievale} +\setinterfacevariable{medium}{medio} +\setinterfacevariable{middle}{centro} +\setinterfacevariable{min}{min} +\setinterfacevariable{mindepth}{mindepth} +\setinterfacevariable{minheight}{altezzamin} +\setinterfacevariable{minwidth}{ampiezzamin} +\setinterfacevariable{mirrored}{riflesso} +\setinterfacevariable{monday}{lunedi} +\setinterfacevariable{mono}{mono} +\setinterfacevariable{month}{mese} +\setinterfacevariable{morehyphenation}{morehyphenation} +\setinterfacevariable{name}{nome} +\setinterfacevariable{narrow}{stretto} +\setinterfacevariable{negative}{negativo} +\setinterfacevariable{never}{mai} +\setinterfacevariable{new}{nuovo} +\setinterfacevariable{next}{successivo} +\setinterfacevariable{nextevenpage}{paginaparisuccessiva} +\setinterfacevariable{nextoddpage}{paginadisparisuccessiva} +\setinterfacevariable{nextpage}{paginasuccessiva} +\setinterfacevariable{nextsubpage}{sottopaginasuccessiva} +\setinterfacevariable{no}{no} +\setinterfacevariable{nocheck}{nocheck} +\setinterfacevariable{nofit}{nofit} +\setinterfacevariable{nogrid}{nogrid} +\setinterfacevariable{nohz}{nohz} +\setinterfacevariable{nomarking}{nomarcature} +\setinterfacevariable{none}{nessuno} +\setinterfacevariable{nonumber}{nonumber} +\setinterfacevariable{normal}{normale} +\setinterfacevariable{nospacing}{nospacing} +\setinterfacevariable{not}{non} +\setinterfacevariable{note}{note} +\setinterfacevariable{nothanging}{nonsospeso} +\setinterfacevariable{nothyphenated}{nonsillabato} +\setinterfacevariable{november}{novembre} +\setinterfacevariable{nowhere}{danessunaparte} +\setinterfacevariable{nowhite}{nobianco} +\setinterfacevariable{number}{numero} +\setinterfacevariable{numbers}{numeri} +\setinterfacevariable{october}{ottobre} +\setinterfacevariable{odd}{dispari} +\setinterfacevariable{off}{disattivo} +\setinterfacevariable{offset}{offset} +\setinterfacevariable{old}{old} +\setinterfacevariable{on}{attivo} +\setinterfacevariable{one}{uno} +\setinterfacevariable{opposite}{opposto} +\setinterfacevariable{outer}{esterno} +\setinterfacevariable{outeredge}{bordoesterno} +\setinterfacevariable{outermargin}{margineesterno} +\setinterfacevariable{overbar}{sopralinea} +\setinterfacevariable{overbars}{sopralinee} +\setinterfacevariable{overlay}{sovrapponi} +\setinterfacevariable{overprint}{overprint} +\setinterfacevariable{overstrike}{sbarrato} +\setinterfacevariable{overstrikes}{sbarrati} +\setinterfacevariable{packed}{impaccato} +\setinterfacevariable{page}{pagina} +\setinterfacevariable{pagecomment}{commentopagina} +\setinterfacevariable{pagenumber}{numeropagina} +\setinterfacevariable{paper}{carta} +\setinterfacevariable{paragraph}{capoverso} +\setinterfacevariable{part}{parte} +\setinterfacevariable{positive}{positivo} +\setinterfacevariable{postponing}{posporre} +\setinterfacevariable{postscript}{postscript} +\setinterfacevariable{preference}{preferenza} +\setinterfacevariable{preview}{anteprima} +\setinterfacevariable{previous}{precedente} +\setinterfacevariable{previousevenpage}{paginapariprecedente} +\setinterfacevariable{previousoddpage}{paginadispariprecedente} +\setinterfacevariable{previouspage}{paginaprecedente} +\setinterfacevariable{previoussubpage}{sottopaginaprecedente} +\setinterfacevariable{printable}{stampabile} +\setinterfacevariable{process}{process} +\setinterfacevariable{product}{prodotto} +\setinterfacevariable{program}{programma} +\setinterfacevariable{project}{progetto} +\setinterfacevariable{protected}{protetto} +\setinterfacevariable{quadruple}{quadruplo} +\setinterfacevariable{quotation}{citazione} +\setinterfacevariable{quote}{menzione} +\setinterfacevariable{ran}{corse} +\setinterfacevariable{random}{casuale} +\setinterfacevariable{readonly}{solalettura} +\setinterfacevariable{rectangular}{rettangolare} +\setinterfacevariable{reference}{riferimento} +\setinterfacevariable{referral}{referral} +\setinterfacevariable{register}{registro} +\setinterfacevariable{regular}{regolare} +\setinterfacevariable{rekening}{rekening} +\setinterfacevariable{relative}{relativo} +\setinterfacevariable{repeat}{ripeti} +\setinterfacevariable{required}{richiestp} +\setinterfacevariable{reset}{reimposta} +\setinterfacevariable{reverse}{invertito} +\setinterfacevariable{right}{destra} +\setinterfacevariable{rightedge}{bordodestro} +\setinterfacevariable{righthanging}{righthanging} +\setinterfacevariable{rightmargin}{marginedestro} +\setinterfacevariable{rightpage}{paginadestra} +\setinterfacevariable{righttoleft}{righttoleft} +\setinterfacevariable{roman}{roman} +\setinterfacevariable{romannumerals}{numeriromani} +\setinterfacevariable{rotate}{ruota} +\setinterfacevariable{rotated}{ruotato} +\setinterfacevariable{round}{rotondo} +\setinterfacevariable{row}{row} +\setinterfacevariable{rule}{linea} +\setinterfacevariable{samepage}{stessapagina} +\setinterfacevariable{sans}{sans} +\setinterfacevariable{sansbold}{sansgrassetto} +\setinterfacevariable{sansserif}{sansserif} +\setinterfacevariable{saturday}{sabato} +\setinterfacevariable{screen}{schermo} +\setinterfacevariable{section}{capoverso} +\setinterfacevariable{sectionblockenvironment}{ambientebloccosezione} +\setinterfacevariable{sectionnumber}{numerosezione} +\setinterfacevariable{see}{vedi} +\setinterfacevariable{september}{settembre} +\setinterfacevariable{serif}{serif} +\setinterfacevariable{serried}{vicino} +\setinterfacevariable{setups}{nastaveni} +\setinterfacevariable{sheet}{sheet} +\setinterfacevariable{short}{short} +\setinterfacevariable{singlesided}{facciasingola} +\setinterfacevariable{slanted}{inclinato} +\setinterfacevariable{slantedbold}{inclinatograssetto} +\setinterfacevariable{small}{piccolo} +\setinterfacevariable{smallbodyfont}{piccolofontdelcorpo} +\setinterfacevariable{smallbold}{piccolograssetto} +\setinterfacevariable{smallbolditalic}{piccolograssettocorsivo} +\setinterfacevariable{smallboldslanted}{piccolograssettoinclinato} +\setinterfacevariable{smallcaps}{maiuscoletto} +\setinterfacevariable{smaller}{smaller} +\setinterfacevariable{smallitalic}{piccolocorsivo} +\setinterfacevariable{smallitalicbold}{piccolocorsivograssetto} +\setinterfacevariable{smallnormal}{piccolonormale} +\setinterfacevariable{smallslanted}{piccoloinclinato} +\setinterfacevariable{smallslantedbold}{piccoloinclinatograssetto} +\setinterfacevariable{smalltype}{piccolotype} +\setinterfacevariable{somewhere}{daqualcheparte} +\setinterfacevariable{sorted}{ordinato} +\setinterfacevariable{space}{spazio} +\setinterfacevariable{spacing}{spaziatura} +\setinterfacevariable{speech}{speech} +\setinterfacevariable{split}{separa} +\setinterfacevariable{spot}{spot} +\setinterfacevariable{standard}{standard} +\setinterfacevariable{start}{inizia} +\setinterfacevariable{starter}{starter} +\setinterfacevariable{sticker}{sticker} +\setinterfacevariable{stop}{termina} +\setinterfacevariable{stopper}{stopper} +\setinterfacevariable{stretch}{dilata} +\setinterfacevariable{strict}{rigido} +\setinterfacevariable{strong}{strong} +\setinterfacevariable{strut}{strut} +\setinterfacevariable{sub}{sotto} +\setinterfacevariable{subbackward}{sottoindietro} +\setinterfacevariable{subformula}{subformula} +\setinterfacevariable{subforward}{sottoavanti} +\setinterfacevariable{subject}{argomento} +\setinterfacevariable{subpage}{sottopagina} +\setinterfacevariable{subsection}{sottocapoverso} +\setinterfacevariable{subsubject}{sottoargomento} +\setinterfacevariable{subsubsection}{sottosottocapoverso} +\setinterfacevariable{subsubsubject}{sottosottoargomento} +\setinterfacevariable{subsubsubsection}{sottosottosottocapoverso} +\setinterfacevariable{subsubsubsubject}{sottosottosottoargomento} +\setinterfacevariable{subsubsubsubsection}{sottosottosottosottocapoverso} +\setinterfacevariable{subsubsubsubsubject}{sottosottosottosottoargomento} +\setinterfacevariable{subsubsubsubsubsection}{sottosottosottosottosottocapoverso} +\setinterfacevariable{subsubsubsubsubsubject}{sottosottosottosottosottoargomento} +\setinterfacevariable{subsubsubsubsubsubsection}{sottosottosottosottosottosottocapoverso} +\setinterfacevariable{subsubsubsubsubsubsubject}{sottosottosottosottosottosottoargomento} +\setinterfacevariable{subsubsubsubsubsubsubsection}{sottosottosottosottosottosottosottocapoverso} +\setinterfacevariable{subsubsubsubsubsubsubsubject}{sottosottosottosottosottosottosottoargomento} +\setinterfacevariable{subsubsubsubsubsubsubsubsection}{sottosottosottosottosottosottosottosottocapoverso} +\setinterfacevariable{subsubsubsubsubsubsubsubsubject}{sottosottosottosottosottosottosottosottoargomento} +\setinterfacevariable{subsubsubsubsubsubsubsubsubsection}{sottosottosottosottosottosottosottosottosottocapoverso} +\setinterfacevariable{subsubsubsubsubsubsubsubsubsubject}{sottosottosottosottosottosottosottosottosottoargomento} +\setinterfacevariable{sunday}{domenica} +\setinterfacevariable{support}{supporto} +\setinterfacevariable{sym}{sim} +\setinterfacevariable{symbol}{simbolo} +\setinterfacevariable{synchronize}{synchronize} +\setinterfacevariable{system}{sistema} +\setinterfacevariable{table}{tabella} +\setinterfacevariable{tablehead}{testatabella} +\setinterfacevariable{tables}{tabelle} +\setinterfacevariable{tabletail}{codatabella} +\setinterfacevariable{tabulate}{tabulato} +\setinterfacevariable{tabulatehead}{testatabulato} +\setinterfacevariable{tabulatetail}{codatabulato} +\setinterfacevariable{tall}{alto} +\setinterfacevariable{teletype}{teletype} +\setinterfacevariable{temporary}{temporaneo} +\setinterfacevariable{test}{test} +\setinterfacevariable{text}{testo} +\setinterfacevariable{three}{tre} +\setinterfacevariable{thursday}{giovedi} +\setinterfacevariable{title}{titolo} +\setinterfacevariable{toggle}{toggle} +\setinterfacevariable{tolerant}{tollerante} +\setinterfacevariable{top}{cima} +\setinterfacevariable{tuesday}{martedi} +\setinterfacevariable{two}{due} +\setinterfacevariable{txt}{txt} +\setinterfacevariable{type}{type} +\setinterfacevariable{typing}{typing} +\setinterfacevariable{unavailable}{nondisponibile} +\setinterfacevariable{underbar}{sottolinea} +\setinterfacevariable{underbars}{sottolinee} +\setinterfacevariable{unit}{unita} +\setinterfacevariable{units}{unita} +\setinterfacevariable{unknown}{ignoto} +\setinterfacevariable{unpacked}{unpacked} +\setinterfacevariable{up}{up} +\setinterfacevariable{url}{url} +\setinterfacevariable{used}{usato} +\setinterfacevariable{value}{valore} +\setinterfacevariable{vertical}{verticale} +\setinterfacevariable{very}{molto} +\setinterfacevariable{verystrict}{moltorigido} +\setinterfacevariable{verytolerant}{moltotollerante} +\setinterfacevariable{weak}{weak} +\setinterfacevariable{wednesday}{mercoledi} +\setinterfacevariable{week}{settimana} +\setinterfacevariable{weekday}{giornosettimana} +\setinterfacevariable{white}{bianco} +\setinterfacevariable{wide}{ampio} +\setinterfacevariable{width}{ampiezza} +\setinterfacevariable{xml}{xml} +\setinterfacevariable{year}{anno} +\setinterfacevariable{yes}{si} +% definitions for interface constants for language it +% +\setinterfaceconstant{action}{azione} +\setinterfaceconstant{address}{indirizzo} +\setinterfaceconstant{after}{dopo} +\setinterfaceconstant{afterhead}{dopotesta} +\setinterfaceconstant{afterkey}{dopotasto} +\setinterfaceconstant{aftersection}{aftersection} +\setinterfaceconstant{align}{allinea} +\setinterfaceconstant{aligncharacter}{allineacarattere} +\setinterfaceconstant{alignmentcharacter}{carattereallineamento} +\setinterfaceconstant{alignsymbol}{alignsymbol} +\setinterfaceconstant{aligntitle}{allineatitolo} +\setinterfaceconstant{alternative}{alternativa} +\setinterfaceconstant{andtext}{andtext} +\setinterfaceconstant{apa}{apa} +\setinterfaceconstant{arrow}{freccia} +\setinterfaceconstant{artauthor}{artauthor} +\setinterfaceconstant{artauthoretaldisplay}{artauthoretaldisplay} +\setinterfaceconstant{artauthoretallimit}{artauthoretallimit} +\setinterfaceconstant{artauthoretaltext}{artauthoretaltext} +\setinterfaceconstant{at}{ad} +\setinterfaceconstant{author}{autore} +\setinterfaceconstant{authoretaldisplay}{authoretaldisplay} +\setinterfaceconstant{authoretallimit}{authoretallimit} +\setinterfaceconstant{authoretaltext}{authoretaltext} +\setinterfaceconstant{auto}{auto} +\setinterfaceconstant{autocase}{autocase} +\setinterfaceconstant{autofile}{autofile} +\setinterfaceconstant{autofocus}{autofocus} +\setinterfaceconstant{autohang}{autohang} +\setinterfaceconstant{autostrut}{autostrut} +\setinterfaceconstant{autowidth}{autoampiezza} +\setinterfaceconstant{axis}{asse} +\setinterfaceconstant{background}{sfondo} +\setinterfaceconstant{backgroundcolor}{coloresfondo} +\setinterfaceconstant{backgroundcorner}{angolosfondo} +\setinterfaceconstant{backgrounddepth}{profonditasfondo} +\setinterfaceconstant{backgroundoffset}{offsetsfondo} +\setinterfaceconstant{backgroundradius}{raggiosfondo} +\setinterfaceconstant{backgroundscreen}{schermosfondo} +\setinterfaceconstant{backreference}{backreference} +\setinterfaceconstant{backspace}{backspace} +\setinterfaceconstant{balance}{bilanciamento} +\setinterfaceconstant{before}{prima} +\setinterfaceconstant{beforehead}{primaditesta} +\setinterfaceconstant{beforesection}{beforesection} +\setinterfaceconstant{bet}{bet} +\setinterfaceconstant{big}{grande} +\setinterfaceconstant{blank}{rigovuoto} +\setinterfaceconstant{blockway}{blockway} +\setinterfaceconstant{bodyfont}{fonttesto} +\setinterfaceconstant{bookmark}{segnalibro} +\setinterfaceconstant{bottom}{fondo} +\setinterfaceconstant{bottomafter}{bottomafter} +\setinterfaceconstant{bottombefore}{bottombefore} +\setinterfaceconstant{bottomdistance}{distanzafondo} +\setinterfaceconstant{bottomframe}{cornicefondo} +\setinterfaceconstant{bottomoffset}{offsetfondo} +\setinterfaceconstant{bottomspace}{spaziofondo} +\setinterfaceconstant{bottomstate}{statofondo} +\setinterfaceconstant{buffer}{buffer} +\setinterfaceconstant{cache}{cache} +\setinterfaceconstant{calculate}{calcola} +\setinterfaceconstant{category}{category} +\setinterfaceconstant{ccommand}{ccomando} +\setinterfaceconstant{click}{click} +\setinterfaceconstant{clickin}{clickdentro} +\setinterfaceconstant{clickout}{clickfuori} +\setinterfaceconstant{clipoffset}{clipoffset} +\setinterfaceconstant{closeaction}{azionechiudi} +\setinterfaceconstant{closecommand}{closecommand} +\setinterfaceconstant{closepage}{closepage} +\setinterfaceconstant{closepageaction}{azionechiudipagina} +\setinterfaceconstant{closesymbol}{closesymbol} +\setinterfaceconstant{color}{colore} +\setinterfaceconstant{column}{colonna} +\setinterfaceconstant{columndistance}{distanzacolonne} +\setinterfaceconstant{columns}{colonne} +\setinterfaceconstant{command}{comando} +\setinterfaceconstant{commandafter}{comdandodopo} +\setinterfaceconstant{commandbefore}{comandoprima} +\setinterfaceconstant{commands}{comandi} +\setinterfaceconstant{component}{component} +\setinterfaceconstant{compoundhyphen}{compoundhyphen} +\setinterfaceconstant{compress}{compress} +\setinterfaceconstant{connector}{connector} +\setinterfaceconstant{continue}{continua} +\setinterfaceconstant{contrastcolor}{colorecontrasto} +\setinterfaceconstant{controls}{controlli} +\setinterfaceconstant{conversion}{conversione} +\setinterfaceconstant{convertfile}{convertifile} +\setinterfaceconstant{corner}{angolo} +\setinterfaceconstant{coupling}{accoppiamento} +\setinterfaceconstant{couplingway}{modoaccoppiamento} +\setinterfaceconstant{criterium}{criterio} +\setinterfaceconstant{current}{corrente} +\setinterfaceconstant{cutspace}{cutspace} +\setinterfaceconstant{dash}{dash} +\setinterfaceconstant{dat}{dat} +\setinterfaceconstant{database}{database} +\setinterfaceconstant{date}{data} +\setinterfaceconstant{deepnumbercommand}{deepnumbercommand} +\setinterfaceconstant{deeptextcommand}{deeptextcommand} +\setinterfaceconstant{default}{implicito} +\setinterfaceconstant{delay}{attesa} +\setinterfaceconstant{depth}{profondita} +\setinterfaceconstant{depthcorrection}{correzioneprofondita} +\setinterfaceconstant{direction}{direzione} +\setinterfaceconstant{directory}{directory} +\setinterfaceconstant{display}{display} +\setinterfaceconstant{distance}{distanza} +\setinterfaceconstant{dot}{punto} +\setinterfaceconstant{doublesided}{doppiafaccia} +\setinterfaceconstant{dummy}{dummy} +\setinterfaceconstant{dx}{dx} +\setinterfaceconstant{dy}{dy} +\setinterfaceconstant{edge}{bordo} +\setinterfaceconstant{edgedistance}{distanzabordo} +\setinterfaceconstant{editor}{editor} +\setinterfaceconstant{editoretaldisplay}{editoretaldisplay} +\setinterfaceconstant{editoretallimit}{editoretallimit} +\setinterfaceconstant{editoretaltext}{editoretaltext} +\setinterfaceconstant{empty}{vuoto} +\setinterfaceconstant{entries}{entries} +\setinterfaceconstant{equalheight}{equalheight} +\setinterfaceconstant{equalwidth}{equalwidth} +\setinterfaceconstant{escape}{escape} +\setinterfaceconstant{evenmargin}{marginepari} +\setinterfaceconstant{expansion}{espansione} +\setinterfaceconstant{export}{export} +\setinterfaceconstant{extras}{extras} +\setinterfaceconstant{factor}{fattore} +\setinterfaceconstant{fallback}{fallback} +\setinterfaceconstant{family}{famiglia} +\setinterfaceconstant{fieldbackgroundcolor}{coloresfondocampo} +\setinterfaceconstant{fieldframecolor}{colorecornicecampo} +\setinterfaceconstant{fieldlayer}{fieldlayer} +\setinterfaceconstant{fieldoffset}{offsetcampo} +\setinterfaceconstant{file}{file} +\setinterfaceconstant{filtercommand}{filtercommand} +\setinterfaceconstant{finalnamesep}{finalnamesep} +\setinterfaceconstant{firstnamesep}{firstnamesep} +\setinterfaceconstant{focus}{focus} +\setinterfaceconstant{focusin}{focusin} +\setinterfaceconstant{focusout}{focusout} +\setinterfaceconstant{footer}{piedipagina} +\setinterfaceconstant{footerdistance}{distanzapdp} +\setinterfaceconstant{footerstate}{statopdp} +\setinterfaceconstant{force}{forza} +\setinterfaceconstant{foregroundcolor}{coloreprimopiano} +\setinterfaceconstant{foregroundstyle}{foregroundstyle} +\setinterfaceconstant{format}{format} +\setinterfaceconstant{frame}{cornice} +\setinterfaceconstant{framecolor}{colorecornice} +\setinterfaceconstant{framecorner}{angolocornice} +\setinterfaceconstant{framedepth}{profonditacornice} +\setinterfaceconstant{frameoffset}{offsetcornice} +\setinterfaceconstant{frameradius}{raggiocornice} +\setinterfaceconstant{frames}{cornici} +\setinterfaceconstant{from}{da} +\setinterfaceconstant{get}{prendi} +\setinterfaceconstant{global}{globale} +\setinterfaceconstant{grid}{griglia} +\setinterfaceconstant{hang}{sospendi} +\setinterfaceconstant{headalign}{headalign} +\setinterfaceconstant{headcolor}{coloretesta} +\setinterfaceconstant{headcommand}{headcommand} +\setinterfaceconstant{headconversion}{conversionetesta} +\setinterfaceconstant{header}{intestazione} +\setinterfaceconstant{headerdistance}{distanzaintestazione} +\setinterfaceconstant{headerstate}{statointestazione} +\setinterfaceconstant{headlabel}{etichettatesta} +\setinterfaceconstant{headnumber}{numerotesta} +\setinterfaceconstant{headstyle}{stiletesta} +\setinterfaceconstant{height}{altezza} +\setinterfaceconstant{hfactor}{hfactor} +\setinterfaceconstant{hfil}{hfil} +\setinterfaceconstant{hidenumber}{hidenumber} +\setinterfaceconstant{hoffset}{hoffset} +\setinterfaceconstant{horoffset}{horoffset} +\setinterfaceconstant{hyphen}{hyphen} +\setinterfaceconstant{icommand}{icomando} +\setinterfaceconstant{in}{in} +\setinterfaceconstant{inbetween}{tra} +\setinterfaceconstant{increment}{incremento} +\setinterfaceconstant{incrementnumber}{incrementanumero} +\setinterfaceconstant{indenting}{rientro} +\setinterfaceconstant{indentnext}{rientrasuccessivo} +\setinterfaceconstant{indicator}{indicatore} +\setinterfaceconstant{inner}{interno} +\setinterfaceconstant{innermargin}{margineinterno} +\setinterfaceconstant{inputfile}{inputfile} +\setinterfaceconstant{intent}{intent} +\setinterfaceconstant{interaction}{interazione} +\setinterfaceconstant{interlinespace}{interlinea} +\setinterfaceconstant{internalgrid}{internalgrid} +\setinterfaceconstant{itemalign}{itemalign} +\setinterfaceconstant{items}{elementi} +\setinterfaceconstant{juniorsep}{juniorsep} +\setinterfaceconstant{ken}{ken} +\setinterfaceconstant{keyexpansion}{keyexpansion} +\setinterfaceconstant{keys}{keys} +\setinterfaceconstant{keyword}{parolachiave} +\setinterfaceconstant{label}{etichetta} +\setinterfaceconstant{lastnamesep}{lastnamesep} +\setinterfaceconstant{lastpubsep}{lastpubsep} +\setinterfaceconstant{left}{sinistra} +\setinterfaceconstant{leftcolor}{coloresinistra} +\setinterfaceconstant{leftcompoundhyphen}{leftcompoundhyphen} +\setinterfaceconstant{leftedge}{bordosinistro} +\setinterfaceconstant{leftedgedistance}{distanzabordosinistro} +\setinterfaceconstant{leftframe}{cornicesinistra} +\setinterfaceconstant{lefthyphen}{lefthyphen} +\setinterfaceconstant{leftmargin}{marginesinistro} +\setinterfaceconstant{leftmargindistance}{distanzamarginesinistro} +\setinterfaceconstant{leftoffset}{offsetsinistro} +\setinterfaceconstant{leftquotation}{citazionesinistra} +\setinterfaceconstant{leftquote}{menzionesinistra} +\setinterfaceconstant{leftsentence}{frasesinistra} +\setinterfaceconstant{leftspeech}{leftspeech} +\setinterfaceconstant{leftstyle}{stilesinistra} +\setinterfaceconstant{leftsubsentence}{sottofrasesinistra} +\setinterfaceconstant{lefttext}{testosinistro} +\setinterfaceconstant{leftwidth}{ampiezzasinistra} +\setinterfaceconstant{level}{livello} +\setinterfaceconstant{levels}{livelli} +\setinterfaceconstant{limittext}{limittext} +\setinterfaceconstant{line}{riga} +\setinterfaceconstant{linecorrection}{correzioneriga} +\setinterfaceconstant{lines}{righe} +\setinterfaceconstant{list}{elenco} +\setinterfaceconstant{listtext}{listtext} +\setinterfaceconstant{local}{locale} +\setinterfaceconstant{location}{luogo} +\setinterfaceconstant{logo}{logo} +\setinterfaceconstant{logos}{loghi} +\setinterfaceconstant{marcolor}{coloremarcatura} +\setinterfaceconstant{margin}{margine} +\setinterfaceconstant{margindistance}{distanzamargine} +\setinterfaceconstant{marginedge}{bordomargine} +\setinterfaceconstant{marginedgetext}{testobordomargine} +\setinterfaceconstant{margintext}{testomargine} +\setinterfaceconstant{marking}{marcatura} +\setinterfaceconstant{marstyle}{stilemarcatura} +\setinterfaceconstant{mask}{mask} +\setinterfaceconstant{max}{max} +\setinterfaceconstant{maxdepth}{maxdepth} +\setinterfaceconstant{maxheight}{altezzamax} +\setinterfaceconstant{maxwidth}{ampiezzamax} +\setinterfaceconstant{maybeyear}{maybeyear} +\setinterfaceconstant{menu}{menu} +\setinterfaceconstant{method}{metodo} +\setinterfaceconstant{middle}{centro} +\setinterfaceconstant{middlespeech}{middlespeech} +\setinterfaceconstant{middletext}{testocentro} +\setinterfaceconstant{midsentence}{midsentence} +\setinterfaceconstant{min}{min} +\setinterfaceconstant{mindepth}{mindeoth} +\setinterfaceconstant{minheight}{altezzamin} +\setinterfaceconstant{minwidth}{ampiezzamin} +\setinterfaceconstant{monthconversion}{monthconversion} +\setinterfaceconstant{n}{n} +\setinterfaceconstant{name}{nome} +\setinterfaceconstant{namesep}{namesep} +\setinterfaceconstant{nbottom}{nfondo} +\setinterfaceconstant{nc}{nc} +\setinterfaceconstant{next}{successivo} +\setinterfaceconstant{nl}{nl} +\setinterfaceconstant{nleft}{nsinistra} +\setinterfaceconstant{nlines}{nrighe} +\setinterfaceconstant{norm}{norma} +\setinterfaceconstant{nr}{nr} +\setinterfaceconstant{nright}{ndestra} +\setinterfaceconstant{ntop}{ncima} +\setinterfaceconstant{number}{numero} +\setinterfaceconstant{numbercolor}{colorenumero} +\setinterfaceconstant{numbercommand}{comandonumero} +\setinterfaceconstant{numberconversion}{numberconversion} +\setinterfaceconstant{numberconversionset}{numberconversionset} +\setinterfaceconstant{numberdistance}{numberdistance} +\setinterfaceconstant{numbering}{numerazione} +\setinterfaceconstant{numberorder}{numberorder} +\setinterfaceconstant{numberprefix}{numberprefix} +\setinterfaceconstant{numbersegments}{numbersegments} +\setinterfaceconstant{numberseparator}{separatorenumero} +\setinterfaceconstant{numberseparatorset}{numberseparatorset} +\setinterfaceconstant{numberset}{numberset} +\setinterfaceconstant{numberstarter}{numberstarter} +\setinterfaceconstant{numberstopper}{numberstopper} +\setinterfaceconstant{numberstyle}{stilenumero} +\setinterfaceconstant{numberwidth}{numberwidth} +\setinterfaceconstant{nx}{nx} +\setinterfaceconstant{ny}{ny} +\setinterfaceconstant{object}{oggetto} +\setinterfaceconstant{obstruction}{ostruzione} +\setinterfaceconstant{oddmargin}{marginedispari} +\setinterfaceconstant{offset}{offset} +\setinterfaceconstant{openaction}{azioneapri} +\setinterfaceconstant{openpage}{openpage} +\setinterfaceconstant{openpageaction}{azioneapripagina} +\setinterfaceconstant{option}{opzione} +\setinterfaceconstant{order}{order} +\setinterfaceconstant{orientation}{orientation} +\setinterfaceconstant{otherstext}{otherstext} +\setinterfaceconstant{outermargin}{margineesterno} +\setinterfaceconstant{overprint}{overprint} +\setinterfaceconstant{ownnumber}{numeroproprio} +\setinterfaceconstant{page}{pagina} +\setinterfaceconstant{pageboundaries}{limitipagina} +\setinterfaceconstant{pagecolor}{colorepagina} +\setinterfaceconstant{pagecommand}{comandopagina} +\setinterfaceconstant{pageconversion}{pageconversion} +\setinterfaceconstant{pageconversionset}{pageconversionset} +\setinterfaceconstant{pagenumber}{numeropagina} +\setinterfaceconstant{pageprefix}{pageprefix} +\setinterfaceconstant{pageprefixconnector}{pageprefixconnector} +\setinterfaceconstant{pageprefixconversion}{pageprefixconversion} +\setinterfaceconstant{pageprefixconversionset}{pageprefixconversionset} +\setinterfaceconstant{pageprefixsegments}{pageprefixsegments} +\setinterfaceconstant{pageprefixseparatorset}{pageprefixseparatorset} +\setinterfaceconstant{pageprefixset}{pageprefixset} +\setinterfaceconstant{pageprefixstarter}{pageprefixstarter} +\setinterfaceconstant{pageprefixstopper}{pageprefixstopper} +\setinterfaceconstant{pagesegments}{pagesegments} +\setinterfaceconstant{pageseparatorset}{pageseparatorset} +\setinterfaceconstant{pageset}{pageset} +\setinterfaceconstant{pagestarter}{pagestarter} +\setinterfaceconstant{pagestate}{statopagina} +\setinterfaceconstant{pagestopper}{pagestopper} +\setinterfaceconstant{pagestyle}{stilepagina} +\setinterfaceconstant{palet}{tavolozza} +\setinterfaceconstant{paper}{carta} +\setinterfaceconstant{paragraph}{capoverso} +\setinterfaceconstant{place}{metti} +\setinterfaceconstant{placehead}{mettitesta} +\setinterfaceconstant{placestopper}{mettistopper} +\setinterfaceconstant{position}{posizione} +\setinterfaceconstant{prefix}{prefisso} +\setinterfaceconstant{prefixconnector}{prefixconnector} +\setinterfaceconstant{prefixconversion}{prefixconversion} +\setinterfaceconstant{prefixconversionset}{prefixconversionset} +\setinterfaceconstant{prefixsegments}{prefixsegments} +\setinterfaceconstant{prefixseparatorset}{prefixseparatorset} +\setinterfaceconstant{prefixset}{prefixset} +\setinterfaceconstant{prefixstarter}{prefixstarter} +\setinterfaceconstant{prefixstopper}{prefixstopper} +\setinterfaceconstant{preset}{preimpostato} +\setinterfaceconstant{preview}{anteprima} +\setinterfaceconstant{previous}{precedente} +\setinterfaceconstant{previousnumber}{numeroprecedente} +\setinterfaceconstant{process}{process} +\setinterfaceconstant{profile}{profile} +\setinterfaceconstant{pubsep}{pubsep} +\setinterfaceconstant{radius}{raggio} +\setinterfaceconstant{random}{casuale} +\setinterfaceconstant{range}{range} +\setinterfaceconstant{reduction}{riduzione} +\setinterfaceconstant{ref}{ref} +\setinterfaceconstant{refcommand}{refcommand} +\setinterfaceconstant{reference}{riferimento} +\setinterfaceconstant{referenceprefix}{referenceprefix} +\setinterfaceconstant{referencing}{referencing} +\setinterfaceconstant{regionin}{entraregione} +\setinterfaceconstant{regionout}{esciregione} +\setinterfaceconstant{repeat}{ripeti} +\setinterfaceconstant{reset}{reset} +\setinterfaceconstant{resetnumber}{resetnumber} +\setinterfaceconstant{resolution}{risoluzione} +\setinterfaceconstant{right}{destra} +\setinterfaceconstant{rightcolor}{coloredestra} +\setinterfaceconstant{rightcompoundhyphen}{rightcompoundhyphen} +\setinterfaceconstant{rightedge}{bordodestro} +\setinterfaceconstant{rightedgedistance}{distanzabordodestro} +\setinterfaceconstant{rightframe}{cornicedestra} +\setinterfaceconstant{righthyphen}{righthyphen} +\setinterfaceconstant{rightmargin}{marginedestro} +\setinterfaceconstant{rightmargindistance}{distanzamarginedestro} +\setinterfaceconstant{rightoffset}{offsetdestro} +\setinterfaceconstant{rightquotation}{citazionedestra} +\setinterfaceconstant{rightquote}{menzionedestra} +\setinterfaceconstant{rightsentence}{frasedestra} +\setinterfaceconstant{rightspeech}{rightspeech} +\setinterfaceconstant{rightstyle}{stiledestra} +\setinterfaceconstant{rightsubsentence}{sottofrasedestra} +\setinterfaceconstant{righttext}{testodestro} +\setinterfaceconstant{rightwidth}{ampiezzadestra} +\setinterfaceconstant{rotation}{rotazione} +\setinterfaceconstant{rule}{linea} +\setinterfaceconstant{rulecolor}{colorelinea} +\setinterfaceconstant{rulethickness}{spessorelinea} +\setinterfaceconstant{samepage}{stessapagina} +\setinterfaceconstant{sample}{campione} +\setinterfaceconstant{samplesize}{samplesize} +\setinterfaceconstant{saveinlist}{saveinlist} +\setinterfaceconstant{scale}{scala} +\setinterfaceconstant{scope}{scope} +\setinterfaceconstant{screen}{schermo} +\setinterfaceconstant{section}{sezione} +\setinterfaceconstant{sectionconversion}{sectionconversion} +\setinterfaceconstant{sectionconversionset}{sectionconversionset} +\setinterfaceconstant{sectionnumber}{numerosezione} +\setinterfaceconstant{sectionresetset}{sectionresetset} +\setinterfaceconstant{sectionsegments}{sectionsegments} +\setinterfaceconstant{sectionseparatorset}{sectionseparatorset} +\setinterfaceconstant{sectionset}{sectionset} +\setinterfaceconstant{sectionstarter}{sectionstarter} +\setinterfaceconstant{sectionstopper}{sectionstopper} +\setinterfaceconstant{separator}{separatore} +\setinterfaceconstant{set}{set} +\setinterfaceconstant{setups}{setups} +\setinterfaceconstant{side}{lato} +\setinterfaceconstant{sidealign}{sidealign} +\setinterfaceconstant{sidemethod}{sidemethod} +\setinterfaceconstant{sidespaceafter}{spaziolateraledopo} +\setinterfaceconstant{sidespacebefore}{spaziolateraleprima} +\setinterfaceconstant{sign}{segno} +\setinterfaceconstant{size}{dimensione} +\setinterfaceconstant{small}{piccolo} +\setinterfaceconstant{sort}{sort} +\setinterfaceconstant{sorttype}{sorttype} +\setinterfaceconstant{source}{origine} +\setinterfaceconstant{space}{spazio} +\setinterfaceconstant{spaceafter}{spaziodopo} +\setinterfaceconstant{spacebefore}{spazioprima} +\setinterfaceconstant{spaceinbetween}{spaceinbetween} +\setinterfaceconstant{spacing}{spaziatura} +\setinterfaceconstant{split}{separa} +\setinterfaceconstant{splitcolor}{splitcolor} +\setinterfaceconstant{splitmethod}{splitmethod} +\setinterfaceconstant{splitoffset}{splitoffset} +\setinterfaceconstant{spot}{spot} +\setinterfaceconstant{stack}{stack} +\setinterfaceconstant{start}{inizia} +\setinterfaceconstant{starter}{starter} +\setinterfaceconstant{state}{stato} +\setinterfaceconstant{step}{passo} +\setinterfaceconstant{stop}{termina} +\setinterfaceconstant{stopper}{stopper} +\setinterfaceconstant{stretch}{dilata} +\setinterfaceconstant{strip}{strip} +\setinterfaceconstant{strut}{strut} +\setinterfaceconstant{style}{stile} +\setinterfaceconstant{sub}{sotto} +\setinterfaceconstant{subtitle}{sottotitolo} +\setinterfaceconstant{suffix}{suffix} +\setinterfaceconstant{suffixseparator}{suffixseparator} +\setinterfaceconstant{surnamesep}{surnamesep} +\setinterfaceconstant{sx}{sx} +\setinterfaceconstant{sy}{sy} +\setinterfaceconstant{symalign}{symallinea} +\setinterfaceconstant{symbol}{simbolo} +\setinterfaceconstant{symbolset}{setsimboli} +\setinterfaceconstant{symcolor}{coloresimbolo} +\setinterfaceconstant{symstyle}{stilesimbolo} +\setinterfaceconstant{synonym}{sinonimo} +\setinterfaceconstant{synonymcolor}{coloresinonimi} +\setinterfaceconstant{synonymcommand}{synonymcommand} +\setinterfaceconstant{synonymstyle}{stilesinonimi} +\setinterfaceconstant{tab}{tab} +\setinterfaceconstant{text}{testo} +\setinterfaceconstant{textcolor}{coloretesto} +\setinterfaceconstant{textcommand}{comandotesto} +\setinterfaceconstant{textdistance}{distanzatesto} +\setinterfaceconstant{textlayer}{textlayer} +\setinterfaceconstant{textmargin}{textmargin} +\setinterfaceconstant{textmethod}{textmethod} +\setinterfaceconstant{textseparator}{separatoretesto} +\setinterfaceconstant{textsize}{dimensionetesto} +\setinterfaceconstant{textstate}{statotesto} +\setinterfaceconstant{textstyle}{stiletesto} +\setinterfaceconstant{textwidth}{ampiezzatesto} +\setinterfaceconstant{threshold}{threshold} +\setinterfaceconstant{title}{titolo} +\setinterfaceconstant{titlecolor}{coloretitolo} +\setinterfaceconstant{titlecommand}{titlecommand} +\setinterfaceconstant{titledistance}{distanzatitolo} +\setinterfaceconstant{titleleft}{titleleft} +\setinterfaceconstant{titleright}{titleright} +\setinterfaceconstant{titlestyle}{stiletitolo} +\setinterfaceconstant{to}{verso} +\setinterfaceconstant{tolerance}{tolleranza} +\setinterfaceconstant{top}{cima} +\setinterfaceconstant{topdistance}{distanzacima} +\setinterfaceconstant{topframe}{cornicecima} +\setinterfaceconstant{topoffset}{offsetcima} +\setinterfaceconstant{topspace}{spaziocima} +\setinterfaceconstant{topstate}{statocima} +\setinterfaceconstant{totalnumber}{totalnumber} +\setinterfaceconstant{type}{type} +\setinterfaceconstant{unit}{unita} +\setinterfaceconstant{unknownreference}{riferimentoingoto} +\setinterfaceconstant{urlalternative}{alternativaurl} +\setinterfaceconstant{urlspace}{spaziourl} +\setinterfaceconstant{validate}{verifica} +\setinterfaceconstant{values}{values} +\setinterfaceconstant{vcommand}{vcomando} +\setinterfaceconstant{veroffset}{veroffset} +\setinterfaceconstant{vfil}{vfil} +\setinterfaceconstant{voffset}{voffset} +\setinterfaceconstant{vonsep}{vonsep} +\setinterfaceconstant{way}{modo} +\setinterfaceconstant{wfactor}{wfactor} +\setinterfaceconstant{white}{bianco} +\setinterfaceconstant{width}{ampiezza} +\setinterfaceconstant{xfactor}{xfactor} +\setinterfaceconstant{xmax}{xmax} +\setinterfaceconstant{xoffset}{xoffset} +\setinterfaceconstant{xscale}{xscale} +\setinterfaceconstant{xstep}{xstep} +\setinterfaceconstant{yfactor}{yfactor} +\setinterfaceconstant{ymax}{ymax} +\setinterfaceconstant{yoffset}{yoffset} +\setinterfaceconstant{yscale}{yscale} +\setinterfaceconstant{ystep}{ystep} +% definitions for interface elements for language it +% +\setinterfaceelement{answerlines}{answerlines} +\setinterfaceelement{answerspace}{answerspace} +\setinterfaceelement{begin}{inizio} +\setinterfaceelement{complete}{completo} +\setinterfaceelement{coupled}{accoppiato} +\setinterfaceelement{currentlocal}{correntelocale} +\setinterfaceelement{emptyone}{prazdne} +\setinterfaceelement{emptytwo}{vuoti} +\setinterfaceelement{end}{fine} +\setinterfaceelement{endsetup}{} +\setinterfaceelement{get}{prendi} +\setinterfaceelement{increment}{incrementa} +\setinterfaceelement{list}{elenco} +\setinterfaceelement{listof}{elencodi} +\setinterfaceelement{load}{carica} +\setinterfaceelement{local}{locale} +\setinterfaceelement{makeup}{makeup} +\setinterfaceelement{next}{successivo} +\setinterfaceelement{place}{metti} +\setinterfaceelement{previous}{precedente} +\setinterfaceelement{previouslocal}{precedentelocale} +\setinterfaceelement{reserve}{riserva} +\setinterfaceelement{see}{vedi} +\setinterfaceelement{setup}{imposta} +\setinterfaceelement{start}{inizia} +\setinterfaceelement{stop}{termina} +\setinterfaceelement{text}{testo} +\setinterfaceelement{type}{type} +% definitions for interface commands for language it +% +\setinterfacecommand{CAPPED}{CAP} +\setinterfacecommand{Character}{Lettera} +\setinterfacecommand{Characters}{Lettere} +\setinterfacecommand{MONTH}{MESE} +\setinterfacecommand{Numbers}{Numeri} +\setinterfacecommand{Romannumerals}{Numeriromani} +\setinterfacecommand{SmallCapped}{Cap} +\setinterfacecommand{SmallCaps}{Caps} +\setinterfacecommand{WEEKDAY}{GIORNOSETTIMANA} +\setinterfacecommand{WORD}{PAROLA} +\setinterfacecommand{WORDS}{PAROLE} +\setinterfacecommand{Word}{Parola} +\setinterfacecommand{Words}{Parole} +\setinterfacecommand{about}{intorno} +\setinterfacecommand{adaptlayout}{adattalayout} +\setinterfacecommand{arg}{arg} +\setinterfacecommand{at}{al} +\setinterfacecommand{atleftmargin}{atleftmargin} +\setinterfacecommand{atpage}{apagina} +\setinterfacecommand{atrightmargin}{atrightmargin} +\setinterfacecommand{background}{sfondo} +\setinterfacecommand{backspace}{spaziodietro} +\setinterfacecommand{blackrule}{lineanera} +\setinterfacecommand{blackrules}{lineenere} +\setinterfacecommand{blank}{rigovuoto} +\setinterfacecommand{bookmark}{segnalibro} +\setinterfacecommand{bottomdistance}{distanzafondo} +\setinterfacecommand{bottomheight}{altezzafondo} +\setinterfacecommand{bottomspace}{spaziofondo} +\setinterfacecommand{but}{fondo} +\setinterfacecommand{button}{pulsante} +\setinterfacecommand{bypassblocks}{saltablocchi} +\setinterfacecommand{character}{lettera} +\setinterfacecommand{characters}{lettere} +\setinterfacecommand{chem}{chim} +\setinterfacecommand{clip}{clip} +\setinterfacecommand{clonefield}{clonacampo} +\setinterfacecommand{color}{colore} +\setinterfacecommand{colorbar}{barracolori} +\setinterfacecommand{colorvalue}{valorecolore} +\setinterfacecommand{column}{colonna} +\setinterfacecommand{comparecolorgroup}{confrontagruppocolori} +\setinterfacecommand{comparepalet}{confrontatavolozza} +\setinterfacecommand{completepagenumber}{numeropaginacompleto} +\setinterfacecommand{completeregister}{completeregister} +\setinterfacecommand{component}{componenet} +\setinterfacecommand{convertnumber}{convertinumero} +\setinterfacecommand{copyfield}{copiacampo} +\setinterfacecommand{correctwhitespace}{correggispaziobianco} +\setinterfacecommand{coupledocument}{accoppiadocumento} +\setinterfacecommand{couplemarking}{accoppiamarcatura} +\setinterfacecommand{couplepage}{accoppiapagina} +\setinterfacecommand{couplepaper}{accoppiacarta} +\setinterfacecommand{coupleregister}{accoppiaregistro} +\setinterfacecommand{crlf}{crlf} +\setinterfacecommand{currentdate}{datadioggi} +\setinterfacecommand{currentheadnumber}{numerotestacorrente} +\setinterfacecommand{cutspace}{cutspace} +\setinterfacecommand{date}{data} +\setinterfacecommand{decouplemarking}{separamarcatura} +\setinterfacecommand{decrementnumber}{decrementnumber} +\setinterfacecommand{define}{definisci} +\setinterfacecommand{defineaccent}{definisciaccento} +\setinterfacecommand{defineblank}{definiscirigovuoto} +\setinterfacecommand{defineblock}{definisciblocco} +\setinterfacecommand{definebodyfont}{definiscifontdeltesto} +\setinterfacecommand{definebodyfontenvironment}{definisciambientefontdeltesto} +\setinterfacecommand{definebuffer}{definiscibuffer} +\setinterfacecommand{definecharacter}{definiscicarattere} +\setinterfacecommand{definecolor}{definiscicolore} +\setinterfacecommand{definecolorgroup}{definiscigruppocolori} +\setinterfacecommand{definecolumnbreak}{definecolumnbreak} +\setinterfacecommand{definecolumnset}{definiscigruppocolonne} +\setinterfacecommand{definecombination}{definecombination} +\setinterfacecommand{definecombinedlist}{definiscielencocombinato} +\setinterfacecommand{definecommand}{definiscicomando} +\setinterfacecommand{defineconversion}{definisciconversione} +\setinterfacecommand{definedescription}{definiscidescrizione} +\setinterfacecommand{defineenumeration}{definiscienumerazione} +\setinterfacecommand{definefield}{definiscicampo} +\setinterfacecommand{definefieldstack}{definiscistackcampi} +\setinterfacecommand{definefiguresymbol}{definiscifigurasimbolo} +\setinterfacecommand{definefloat}{definiscioggettomobile} +\setinterfacecommand{definefont}{definiscifont} +\setinterfacecommand{definefontstyle}{definiscistilefont} +\setinterfacecommand{definefontsynonym}{definiscisinonimofont} +\setinterfacecommand{defineframed}{definisciincorniciato} +\setinterfacecommand{defineframedtext}{definiscitestoincorniciato} +\setinterfacecommand{definehbox}{definiscihbox} +\setinterfacecommand{definehead}{definiscitesta} +\setinterfacecommand{defineindenting}{definiscirientro} +\setinterfacecommand{defineinmargin}{defineinmargin} +\setinterfacecommand{defineinteractionmenu}{definiscimenuinterazione} +\setinterfacecommand{defineitemgroup}{defineitemgroup} +\setinterfacecommand{definelabel}{definiscietichetta} +\setinterfacecommand{definelayer}{definelayer} +\setinterfacecommand{definelayout}{definiscilayout} +\setinterfacecommand{definelist}{definiscielenco} +\setinterfacecommand{definelogo}{definiscilogo} +\setinterfacecommand{definemainfield}{definiscicampoprincipale} +\setinterfacecommand{definemakeup}{definiscimakeup} +\setinterfacecommand{definemarking}{definiscimarcatura} +\setinterfacecommand{definemathalignment}{definemathalignment} +\setinterfacecommand{defineoutput}{definiscioutput} +\setinterfacecommand{defineoverlay}{definiscisovrapposizione} +\setinterfacecommand{definepagebreak}{definepagebreak} +\setinterfacecommand{definepalet}{definiscitavolozza} +\setinterfacecommand{definepapersize}{definiscidimensionicarta} +\setinterfacecommand{defineparagraphs}{definiscicapoversi} +\setinterfacecommand{defineplacement}{defineplacement} +\setinterfacecommand{defineprofile}{definisciprofilo} +\setinterfacecommand{defineprogram}{definisciprogramma} +\setinterfacecommand{definerawfont}{definiscifontgrezzo} +\setinterfacecommand{definereference}{definisciriferimento} +\setinterfacecommand{definereferenceformat}{definisciformatoriferimento} +\setinterfacecommand{definereferencelist}{definiscilistariferimenti} +\setinterfacecommand{defineregister}{definisciregistro} +\setinterfacecommand{definerule}{definiscilinea} +\setinterfacecommand{definesection}{definiscisezione} +\setinterfacecommand{definesectionblock}{definiscibloccosezione} +\setinterfacecommand{definesorting}{definisciordinamento} +\setinterfacecommand{definestartstop}{definisciiniziatermina} +\setinterfacecommand{definestyle}{definiscistile} +\setinterfacecommand{definesubfield}{definiscisottocampo} +\setinterfacecommand{definesymbol}{definiscisimbolo} +\setinterfacecommand{definesynonyms}{definiscisinonimi} +\setinterfacecommand{definetabletemplate}{definiscimodellotabella} +\setinterfacecommand{definetabulate}{definiscitabulato} +\setinterfacecommand{definetext}{definiscitesto} +\setinterfacecommand{definetextposition}{definisciposizionetesto} +\setinterfacecommand{definetextvariable}{definiscivariabiletesto} +\setinterfacecommand{definetype}{definiscitype} +\setinterfacecommand{definetyping}{definiscityping} +\setinterfacecommand{defineversion}{definisciversion} +\setinterfacecommand{determineheadnumber}{determinanumerotesta} +\setinterfacecommand{determinelistcharacteristics}{determinacarattersticheelenco} +\setinterfacecommand{determineregistercharacteristics}{determinacaratteristicheregistro} +\setinterfacecommand{dimension}{dimensione} +\setinterfacecommand{disableinteractionmenu}{disabilitamenuinterazione} +\setinterfacecommand{domicile}{domicilio} +\setinterfacecommand{donttest}{notest} +\setinterfacecommand{edgedistance}{distanzabordo} +\setinterfacecommand{edgewidth}{ampiezzabordo} +\setinterfacecommand{emptylines}{emptylines} +\setinterfacecommand{environment}{ambiente} +\setinterfacecommand{externalfigure}{figuraesterna} +\setinterfacecommand{fact}{fatto} +\setinterfacecommand{field}{campi} +\setinterfacecommand{fieldstack}{stackcampi} +\setinterfacecommand{fillinfield}{camporiempimento} +\setinterfacecommand{fillinline}{rigariempimento} +\setinterfacecommand{fillinrules}{lineeriempimento} +\setinterfacecommand{fillintext}{testoriempimento} +\setinterfacecommand{fitfield}{adattacampo} +\setinterfacecommand{fixedspace}{spaziofisso} +\setinterfacecommand{fixedspaces}{spazifissi} +\setinterfacecommand{followprofile}{seguiprofilo} +\setinterfacecommand{followprofileversion}{seguiversioneprofilo} +\setinterfacecommand{followversion}{seguiversione} +\setinterfacecommand{footerdistance}{distanzapdp} +\setinterfacecommand{footerheight}{altezzapdp} +\setinterfacecommand{footnote}{notapdp} +\setinterfacecommand{footnotetext}{testonotapdp} +\setinterfacecommand{forceblocks}{forzablocchi} +\setinterfacecommand{formulanumber}{numeroformula} +\setinterfacecommand{fraction}{frazione} +\setinterfacecommand{framed}{incorniciato} +\setinterfacecommand{from}{da} +\setinterfacecommand{getbuffer}{prendibuffer} +\setinterfacecommand{getmarking}{prendimarcatura} +\setinterfacecommand{getnumber}{getnumber} +\setinterfacecommand{godown}{vaigiu} +\setinterfacecommand{goto}{vaia} +\setinterfacecommand{gotobox}{vaiabox} +\setinterfacecommand{gotopage}{vaiapagina} +\setinterfacecommand{graycolor}{coloregrigio} +\setinterfacecommand{greyvalue}{valoregrigio} +\setinterfacecommand{grid}{griglia} +\setinterfacecommand{hairline}{capello} +\setinterfacecommand{head}{testa} +\setinterfacecommand{headerdistance}{distanzaintestazione} +\setinterfacecommand{headerheight}{altezzaintestazione} +\setinterfacecommand{headlevel}{livellotesta} +\setinterfacecommand{headnumber}{numerotesta} +\setinterfacecommand{headsym}{headsym} +\setinterfacecommand{headtext}{testoinstestazioni} +\setinterfacecommand{hideblocks}{nascondiblocchi} +\setinterfacecommand{high}{ap} +\setinterfacecommand{hl}{hl} +\setinterfacecommand{immediatebetweenlist}{immediatebetweenlist} +\setinterfacecommand{immediatetolist}{immediatetolist} +\setinterfacecommand{in}{in} +\setinterfacecommand{incrementnumber}{incrementanumero} +\setinterfacecommand{indenting}{rientro} +\setinterfacecommand{inframed}{circondato} +\setinterfacecommand{infull}{perlungo} +\setinterfacecommand{ininner}{ininner} +\setinterfacecommand{inleft}{insinistra} +\setinterfacecommand{inleftedge}{inlatosinistro} +\setinterfacecommand{inleftmargin}{inmarginesinistro} +\setinterfacecommand{inline}{inriga} +\setinterfacecommand{inmargin}{inmargine} +\setinterfacecommand{inmframed}{inmaframed} +\setinterfacecommand{inneredgedistance}{inneredgedistance} +\setinterfacecommand{inneredgewidth}{inneredgewidth} +\setinterfacecommand{innermargindistance}{innermargindistance} +\setinterfacecommand{innermarginwidth}{innermarginwidth} +\setinterfacecommand{inothermargin}{inaltromargine} +\setinterfacecommand{inouter}{inouter} +\setinterfacecommand{inright}{indestra} +\setinterfacecommand{inrightedge}{inlatodestro} +\setinterfacecommand{inrightmargin}{inmarginedestro} +\setinterfacecommand{installlanguage}{installalingua} +\setinterfacecommand{interactionbar}{barrainterazione} +\setinterfacecommand{interactionbuttons}{pulsantinterazione} +\setinterfacecommand{interactionmenu}{menuinterattivo} +\setinterfacecommand{item}{elemento} +\setinterfacecommand{items}{elementi} +\setinterfacecommand{its}{el} +\setinterfacecommand{keepblocks}{tieniblocchi} +\setinterfacecommand{label}{etichetta} +\setinterfacecommand{labels}{etichette} +\setinterfacecommand{labeltext}{testoetichetta} +\setinterfacecommand{language}{lingua} +\setinterfacecommand{leftaligned}{allineasinistra} +\setinterfacecommand{leftedgedistance}{distanzabordosinistro} +\setinterfacecommand{leftedgewidth}{ampiezzabordosinistro} +\setinterfacecommand{leftmargindistance}{distanzamarginesinistro} +\setinterfacecommand{leftmarginwidth}{ampiezzamarginesinistro} +\setinterfacecommand{leg}{leg} +\setinterfacecommand{linewidth}{spessoreriga} +\setinterfacecommand{listheight}{altezzaelenco} +\setinterfacecommand{listlength}{lunghezzaelenco} +\setinterfacecommand{listsymbol}{listsymbol} +\setinterfacecommand{listwidth}{ampiezzaelenco} +\setinterfacecommand{logfields}{logcampi} +\setinterfacecommand{lohi}{pedap} +\setinterfacecommand{low}{ped} +\setinterfacecommand{macroname}{nome} +\setinterfacecommand{mainlanguage}{linguaprincipale} +\setinterfacecommand{makeupheight}{altezzamakeup} +\setinterfacecommand{makeupwidth}{ampiezzamakeup} +\setinterfacecommand{mar}{mar} +\setinterfacecommand{margindistance}{distanzamargine} +\setinterfacecommand{marginrule}{lineamargine} +\setinterfacecommand{margintext}{testoinmargine} +\setinterfacecommand{margintitle}{titoloinmargine} +\setinterfacecommand{marginwidth}{ampiezzamargine} +\setinterfacecommand{marginword}{parolainmargine} +\setinterfacecommand{marking}{marcatura} +\setinterfacecommand{markversion}{marcaversione} +\setinterfacecommand{mathematics}{matematica} +\setinterfacecommand{menubutton}{pulsantemenu} +\setinterfacecommand{mframed}{maframed} +\setinterfacecommand{midaligned}{allineacentro} +\setinterfacecommand{mirror}{riflessione} +\setinterfacecommand{month}{mese} +\setinterfacecommand{moveformula}{spostaformula} +\setinterfacecommand{moveongrid}{spostaagriglia} +\setinterfacecommand{movesidefloat}{movesidefloat} +\setinterfacecommand{navigating}{navigating} +\setinterfacecommand{nodimension}{nientedimensioni} +\setinterfacecommand{noheaderandfooterlines}{nientelineintestazionepdp} +\setinterfacecommand{noindenting}{nienterientro} +\setinterfacecommand{nolist}{nienteelenco} +\setinterfacecommand{nomarking}{nientemarcatura} +\setinterfacecommand{nomoreblocks}{bastablocchi} +\setinterfacecommand{nomorefiles}{bastafile} +\setinterfacecommand{nop}{nop} +\setinterfacecommand{nospace}{nientespazio} +\setinterfacecommand{note}{nota} +\setinterfacecommand{notopandbottomlines}{nientelineecimafondo} +\setinterfacecommand{notsmallcapped}{nocap} +\setinterfacecommand{nowhitespace}{nientespaziobianco} +\setinterfacecommand{numberofsubpages}{numberofsubpages} +\setinterfacecommand{numbers}{numeri} +\setinterfacecommand{outeredgedistance}{outeredgedistance} +\setinterfacecommand{outeredgewidth}{outeredgewidth} +\setinterfacecommand{outermargindistance}{outermargindistance} +\setinterfacecommand{outermarginwidth}{outermarginwidth} +\setinterfacecommand{packed}{impaccato} +\setinterfacecommand{page}{pagina} +\setinterfacecommand{pagedepth}{pagedepth} +\setinterfacecommand{pagenumber}{numeropagina} +\setinterfacecommand{pageoffset}{pageoffset} +\setinterfacecommand{pagereference}{riferimentopagina} +\setinterfacecommand{pagetype}{tipopagina} +\setinterfacecommand{paperheight}{altezzacarta} +\setinterfacecommand{paperwidth}{ampiezzacarta} +\setinterfacecommand{periods}{punti} +\setinterfacecommand{plaatsruwelijst}{placerawlist} +\setinterfacecommand{placebookmarks}{mettisegnalibro} +\setinterfacecommand{placecombinedlist}{mettielencocombinato} +\setinterfacecommand{placefloat}{placefloat} +\setinterfacecommand{placefootnotes}{mettinotepdp} +\setinterfacecommand{placeformula}{mettiformula} +\setinterfacecommand{placeheadnumber}{posizionanumerotesta} +\setinterfacecommand{placeheadtext}{posizionatestotesta} +\setinterfacecommand{placelegend}{mettilegenda} +\setinterfacecommand{placelist}{mettielenco} +\setinterfacecommand{placelocalfootnotes}{mettinotepdplocali} +\setinterfacecommand{placelogos}{mettiloghi} +\setinterfacecommand{placeongrid}{mettiingriglia} +\setinterfacecommand{placeontopofeachother}{mettiunosullaltro} +\setinterfacecommand{placepagenumber}{mettinumeropagina} +\setinterfacecommand{placereferencelist}{placereferencelist} +\setinterfacecommand{placeregister}{mettiregistro} +\setinterfacecommand{placerule}{mettilinea} +\setinterfacecommand{placesidebyside}{mettifiancoafianco} +\setinterfacecommand{placesubformula}{mettisottoformula} +\setinterfacecommand{placetextvariable}{mettivariabiletesto} +\setinterfacecommand{position}{posizione} +\setinterfacecommand{positiontext}{posizionatesto} +\setinterfacecommand{printpaperheight}{altezzacartastampa} +\setinterfacecommand{printpaperwidth}{ampiezzacartastampa} +\setinterfacecommand{processblocks}{elaborablocchi} +\setinterfacecommand{processpage}{elaborapagina} +\setinterfacecommand{product}{prodotto} +\setinterfacecommand{program}{programma} +\setinterfacecommand{project}{progetto} +\setinterfacecommand{publication}{pubblicazione} +\setinterfacecommand{quotation}{citazione} +\setinterfacecommand{quote}{menzione} +\setinterfacecommand{ran}{ran} +\setinterfacecommand{redo}{rifai} +\setinterfacecommand{ref}{rif} +\setinterfacecommand{reference}{riferimento} +\setinterfacecommand{referral}{referral} +\setinterfacecommand{referraldate}{datareferral} +\setinterfacecommand{referring}{referring} +\setinterfacecommand{remark}{commento} +\setinterfacecommand{reset}{reimposta} +\setinterfacecommand{resetmarking}{reimpostamarcatura} +\setinterfacecommand{resetnumber}{resetnumber} +\setinterfacecommand{resettext}{resettextcontent} +\setinterfacecommand{rightaligned}{allineadestra} +\setinterfacecommand{rightedgedistance}{distanzabordodestro} +\setinterfacecommand{rightedgewidth}{ampiezzabordodestro} +\setinterfacecommand{rightmargindistance}{distanzamarginedestro} +\setinterfacecommand{rightmarginwidth}{ampiezzamarginedestro} +\setinterfacecommand{romannumerals}{numeriromani} +\setinterfacecommand{rotate}{ruota} +\setinterfacecommand{scale}{scala} +\setinterfacecommand{screen}{schermo} +\setinterfacecommand{selectblocks}{selezionablocchi} +\setinterfacecommand{selectpaper}{selezionacarta} +\setinterfacecommand{selectversion}{selezionaversione} +\setinterfacecommand{setnumber}{setnumber} +\setinterfacecommand{settextcontent}{settext} +\setinterfacecommand{settextvariable}{setvariabiletesto} +\setinterfacecommand{setupalign}{impostaallineamento} +\setinterfacecommand{setupanswerarea}{setupanswerarea} +\setinterfacecommand{setuparranging}{impostaparranging} +\setinterfacecommand{setupbackground}{impostasfondo} +\setinterfacecommand{setupbackgrounds}{impostasfondi} +\setinterfacecommand{setupblackrules}{impostalineenere} +\setinterfacecommand{setupblank}{impostarigovuoto} +\setinterfacecommand{setupblock}{impostablocco} +\setinterfacecommand{setupbodyfont}{impostafontdeltesto} +\setinterfacecommand{setupbodyfontenvironment}{impostaambientefontdeltesto} +\setinterfacecommand{setupbottom}{impostafondo} +\setinterfacecommand{setupbottomtexts}{impostatestifondo} +\setinterfacecommand{setupbuffer}{impostabuffer} +\setinterfacecommand{setupbuttons}{impostapulsanti} +\setinterfacecommand{setupcapitals}{impostamaiuscole} +\setinterfacecommand{setupcaption}{impostacaption} +\setinterfacecommand{setupcaptions}{impostacaptions} +\setinterfacecommand{setupclipping}{impostaclippling} +\setinterfacecommand{setupcolor}{impostacolore} +\setinterfacecommand{setupcolors}{impostacolori} +\setinterfacecommand{setupcolumns}{impostacolonne} +\setinterfacecommand{setupcolumnset}{impostagruppocolonne} +\setinterfacecommand{setupcolumnsetlines}{setupcolumnsetlines} +\setinterfacecommand{setupcolumnsetstart}{setupcolumnsetstart} +\setinterfacecommand{setupcombinations}{impostacombinazioni} +\setinterfacecommand{setupcombinedlist}{impostaelencocombinato} +\setinterfacecommand{setupcomment}{impostacommento} +\setinterfacecommand{setupdescriptions}{impostadescrizioni} +\setinterfacecommand{setupenumerations}{impostaenumerazioni} +\setinterfacecommand{setupexternalfigures}{impostafigureesterne} +\setinterfacecommand{setupfield}{impostacampo} +\setinterfacecommand{setupfields}{impostacampi} +\setinterfacecommand{setupfillinlines}{impostarigheriempimento} +\setinterfacecommand{setupfillinrules}{impostalineeriempimento} +\setinterfacecommand{setupfloat}{impostaoggettomobile} +\setinterfacecommand{setupfloats}{impostaoggettimobili} +\setinterfacecommand{setupfloatsplitting}{impostaspezzamentooggettomobile} +\setinterfacecommand{setupfooter}{impostapdp} +\setinterfacecommand{setupfootertexts}{impostatestipdp} +\setinterfacecommand{setupfootnotedefinition}{impostadefinizionenotepdp} +\setinterfacecommand{setupfootnotes}{impostanotepdp} +\setinterfacecommand{setupforms}{impostaforms} +\setinterfacecommand{setupformulas}{impostaformule} +\setinterfacecommand{setupframed}{impostaincorniciato} +\setinterfacecommand{setupframedtexts}{impostatestiincorniciati} +\setinterfacecommand{setuphead}{impostatesta} +\setinterfacecommand{setupheader}{impostainstestazione} +\setinterfacecommand{setupheadertexts}{impostatestiintestazioni} +\setinterfacecommand{setupheadnumber}{impostanumerotesta} +\setinterfacecommand{setupheads}{impostateste} +\setinterfacecommand{setupheadtext}{impostatestointestazioni} +\setinterfacecommand{setuphyphenmark}{impostasegnosillabazione} +\setinterfacecommand{setupindentations}{impostarientri} +\setinterfacecommand{setupindenting}{impostarientro} +\setinterfacecommand{setupinmargin}{impostainmargine} +\setinterfacecommand{setupinteraction}{impostainterazione} +\setinterfacecommand{setupinteractionbar}{impostabarrainterazione} +\setinterfacecommand{setupinteractionmenu}{impostamenuinterazione} +\setinterfacecommand{setupinteractionscreen}{impostaschermointerazione} +\setinterfacecommand{setupinterlinespace}{impostainterlinea} +\setinterfacecommand{setupitemgroup}{setupitemgroup} +\setinterfacecommand{setupitemgroups}{impostaelencazioni} +\setinterfacecommand{setupitems}{impostaelementi} +\setinterfacecommand{setuplabeltext}{impostatestoetichette} +\setinterfacecommand{setuplanguage}{impostalingua} +\setinterfacecommand{setuplayout}{impostalayout} +\setinterfacecommand{setuplegend}{impostalegenda} +\setinterfacecommand{setuplinenumbering}{impostanumerazionerighe} +\setinterfacecommand{setuplines}{impostarighe} +\setinterfacecommand{setuplinewidth}{impostaampiezzariga} +\setinterfacecommand{setuplist}{impostaelenco} +\setinterfacecommand{setupmakeup}{impostamakeup} +\setinterfacecommand{setupmarginblocks}{impostablocchimargine} +\setinterfacecommand{setupmarginrules}{impostalineemargine} +\setinterfacecommand{setupmarking}{impostamarcatura} +\setinterfacecommand{setupmathalignment}{setupmathalignment} +\setinterfacecommand{setupnarrower}{impostapiustretto} +\setinterfacecommand{setupnumber}{impostanumerazione} +\setinterfacecommand{setupnumbering}{impostanumerazione} +\setinterfacecommand{setupoppositeplacing}{impostaposizionamentoopposti} +\setinterfacecommand{setupoutput}{impostaoutput} +\setinterfacecommand{setuppagecomment}{impostacommentopagina} +\setinterfacecommand{setuppagenumber}{impostanumeropagina} +\setinterfacecommand{setuppagenumbering}{impostanumerazionepagina} +\setinterfacecommand{setuppagetransitions}{impostatransizionepagina} +\setinterfacecommand{setuppalet}{impostatavolozza} +\setinterfacecommand{setuppaper}{setuppaper} +\setinterfacecommand{setuppapersize}{impostadimensionicarta} +\setinterfacecommand{setupparagraphnumbering}{impostanumerazionecapoversi} +\setinterfacecommand{setupparagraphs}{impostacapoversi} +\setinterfacecommand{setupplacement}{setupplacement} +\setinterfacecommand{setuppositioning}{impostaposizionamento} +\setinterfacecommand{setupprofiles}{impostaprofili} +\setinterfacecommand{setupprograms}{impostaprogrammi} +\setinterfacecommand{setuppublications}{impostapubblicazioni} +\setinterfacecommand{setupquote}{impostamenzione} +\setinterfacecommand{setupreferencelist}{impostalistariferimenti} +\setinterfacecommand{setupreferencing}{impostariferimento} +\setinterfacecommand{setupregister}{impostaregistro} +\setinterfacecommand{setuprotate}{impostarotazione} +\setinterfacecommand{setuprule}{impostalinea} +\setinterfacecommand{setups}{impostazioni} +\setinterfacecommand{setupscreens}{impostaschermi} +\setinterfacecommand{setupsection}{impostasezione} +\setinterfacecommand{setupsectionblock}{impostabloccosezione} +\setinterfacecommand{setupsorting}{impostaordinamento} +\setinterfacecommand{setupspacing}{impostaspaziatura} +\setinterfacecommand{setupstartstop}{impostainiziatermina} +\setinterfacecommand{setupstrut}{impostastrut} +\setinterfacecommand{setupsubpagenumber}{impostanumerosottopagina} +\setinterfacecommand{setupsymbolset}{impostasetsimboli} +\setinterfacecommand{setupsynchronization}{impostasincronizzazione} +\setinterfacecommand{setupsynchronizationbar}{impostabarrasincronizzazione} +\setinterfacecommand{setupsynonyms}{impostasinonimi} +\setinterfacecommand{setupsystem}{impostasistema} +\setinterfacecommand{setuptab}{impostatab} +\setinterfacecommand{setuptables}{impostatabelle} +\setinterfacecommand{setuptabulate}{impostatabulato} +\setinterfacecommand{setuptext}{impostatesto} +\setinterfacecommand{setuptextposition}{impostaposizionetesto} +\setinterfacecommand{setuptextrules}{impostalineetesto} +\setinterfacecommand{setuptexttexts}{impostatestotesti} +\setinterfacecommand{setuptextvariable}{impostavariabiletesto} +\setinterfacecommand{setupthinrules}{impostalineesottili} +\setinterfacecommand{setuptolerance}{impostatolleranza} +\setinterfacecommand{setuptop}{impostacima} +\setinterfacecommand{setuptoptexts}{impostatesticima} +\setinterfacecommand{setuptype}{impostatype} +\setinterfacecommand{setuptyping}{impostatyping} +\setinterfacecommand{setupunderbar}{impostasottolinea} +\setinterfacecommand{setupurl}{impostaurl} +\setinterfacecommand{setupversions}{impostaversioni} +\setinterfacecommand{setupwhitespace}{impostaspaziobianco} +\setinterfacecommand{showbodyfont}{mostrafontdeltesto} +\setinterfacecommand{showbodyfontenvironment}{mostraambientefontdeltesto} +\setinterfacecommand{showcolor}{mostracolore} +\setinterfacecommand{showcolorgroup}{mostragruppocolori} +\setinterfacecommand{showexternalfigures}{mostrafiguresterne} +\setinterfacecommand{showfields}{mostracampi} +\setinterfacecommand{showframe}{mostracornice} +\setinterfacecommand{showgrid}{mostragriglia} +\setinterfacecommand{showlayout}{mostralyout} +\setinterfacecommand{showmakeup}{mostramakeup} +\setinterfacecommand{showpalet}{mostratavolozza} +\setinterfacecommand{showprint}{mostrastampa} +\setinterfacecommand{showsetups}{mostraimpostazioni} +\setinterfacecommand{showstruts}{mostrastruts} +\setinterfacecommand{showsymbolset}{mostrasetsimboli} +\setinterfacecommand{smallcapped}{cap} +\setinterfacecommand{someline}{qualcheriga} +\setinterfacecommand{somewhere}{daqualcheparte} +\setinterfacecommand{space}{spazio} +\setinterfacecommand{splitfloat}{spezzaoggettomobile} +\setinterfacecommand{startalignment}{iniziaallineamento} +\setinterfacecommand{startbackground}{iniziasfondo} +\setinterfacecommand{startcoding}{iniziacodifica} +\setinterfacecommand{startcolor}{iniziacolore} +\setinterfacecommand{startcolumnmakeup}{startcolumnmakeup} +\setinterfacecommand{startcolumns}{iniziacolonne} +\setinterfacecommand{startcolumnset}{iniziagruppocolonne} +\setinterfacecommand{startcombination}{iniziacombinazione} +\setinterfacecommand{startcomponent}{iniziacomponente} +\setinterfacecommand{startdocument}{iniziadocumento} +\setinterfacecommand{startenvironment}{iniziaambiente} +\setinterfacecommand{startfigure}{iniziafigura} +\setinterfacecommand{startglobal}{iniziaglobale} +\setinterfacecommand{startline}{iniziariga} +\setinterfacecommand{startlinecorrection}{iniziacorrezioneriga} +\setinterfacecommand{startlinenumbering}{inizianumerazionerighe} +\setinterfacecommand{startlines}{iniziarighe} +\setinterfacecommand{startlocal}{inizialocale} +\setinterfacecommand{startlocalfootnotes}{inizianotepdplocali} +\setinterfacecommand{startmakeup}{iniziamakeup} +\setinterfacecommand{startmarginblock}{iniziabloccomargine} +\setinterfacecommand{startmarginrule}{inizialineamargine} +\setinterfacecommand{startnarrower}{iniziapiustretto} +\setinterfacecommand{startopposite}{iniziaopposto} +\setinterfacecommand{startoverlay}{iniziasovrapposizione} +\setinterfacecommand{startoverzicht}{iniziaoverview} +\setinterfacecommand{startpacked}{iniziaimpaccato} +\setinterfacecommand{startpositioning}{iniziaposizionamento} +\setinterfacecommand{startproduct}{iniziaprodotto} +\setinterfacecommand{startprofile}{iniziaprofilo} +\setinterfacecommand{startproject}{iniziaprogetto} +\setinterfacecommand{startquotation}{iniziacitazione} +\setinterfacecommand{startraster}{iniziaraster} +\setinterfacecommand{startsymbolset}{iniziasetsimboli} +\setinterfacecommand{startsynchronization}{iniziasincronizzazione} +\setinterfacecommand{starttable}{iniziatabella} +\setinterfacecommand{starttables}{iniziatabelle} +\setinterfacecommand{starttext}{iniziatesto} +\setinterfacecommand{starttextrule}{inizialineatesto} +\setinterfacecommand{startunpacked}{iniziaunpacked} +\setinterfacecommand{startversion}{iniziaversione} +\setinterfacecommand{stopalignment}{terminaallineamento} +\setinterfacecommand{stopbackground}{terminasfondo} +\setinterfacecommand{stopcoding}{terminacodifica} +\setinterfacecommand{stopcolor}{terminacolore} +\setinterfacecommand{stopcolumnmakeup}{stopcolumnmakeup} +\setinterfacecommand{stopcolumns}{terminacolonne} +\setinterfacecommand{stopcolumnset}{terminagruppocolonne} +\setinterfacecommand{stopcombination}{terminacombinazione} +\setinterfacecommand{stopcomponent}{terminacomponente} +\setinterfacecommand{stopdocument}{terminadocumento} +\setinterfacecommand{stopenvironment}{terminaambiente} +\setinterfacecommand{stopglobal}{terminaglobale} +\setinterfacecommand{stopline}{terminariga} +\setinterfacecommand{stoplinecorrection}{terminacorrezioneriga} +\setinterfacecommand{stoplinenumbering}{terminanumerazionerighe} +\setinterfacecommand{stoplines}{terminarighe} +\setinterfacecommand{stoplocal}{terminalocale} +\setinterfacecommand{stoplocalfootnotes}{terminanotepdplocali} +\setinterfacecommand{stopmakeup}{terminamakeup} +\setinterfacecommand{stopmarginblock}{terminabloccomargine} +\setinterfacecommand{stopmarginrule}{terminalineamargine} +\setinterfacecommand{stopnarrower}{terminapiustretto} +\setinterfacecommand{stopopposite}{terminaopposto} +\setinterfacecommand{stopoverlay}{terminasovrapposizione} +\setinterfacecommand{stopoverzicht}{terminaoverview} +\setinterfacecommand{stoppacked}{terminaimpaccato} +\setinterfacecommand{stoppositioning}{terminaposizionamento} +\setinterfacecommand{stopproduct}{terminaprodotto} +\setinterfacecommand{stopprofile}{terminaprofili} +\setinterfacecommand{stopproject}{terminaprogetto} +\setinterfacecommand{stopquotation}{terminacitazione} +\setinterfacecommand{stopraster}{terminaraster} +\setinterfacecommand{stopsynchronization}{terminasincronizzazione} +\setinterfacecommand{stoptable}{terminatabella} +\setinterfacecommand{stoptables}{terminatabelle} +\setinterfacecommand{stoptext}{terminatesto} +\setinterfacecommand{stoptextrule}{terminalineatesto} +\setinterfacecommand{stopunpacked}{terminaunpacked} +\setinterfacecommand{stopversion}{terminaversioni} +\setinterfacecommand{stretched}{stirato} +\setinterfacecommand{subformulanumber}{numerosottoformula} +\setinterfacecommand{subpagenumber}{subpagenumber} +\setinterfacecommand{switchtobodyfont}{cambiaafontdeltesto} +\setinterfacecommand{switchtorawfont}{passaafontgrezzo} +\setinterfacecommand{sym}{sim} +\setinterfacecommand{symbol}{simbolo} +\setinterfacecommand{synchronizationbar}{barrasincronizzazione} +\setinterfacecommand{synchronize}{sincronizza} +\setinterfacecommand{tab}{tab} +\setinterfacecommand{testcolumn}{testcolumn} +\setinterfacecommand{testpage}{testpage} +\setinterfacecommand{tex}{tex} +\setinterfacecommand{textheight}{altezzatesto} +\setinterfacecommand{textreference}{riferimentotesto} +\setinterfacecommand{textrule}{lineatesto} +\setinterfacecommand{textvariable}{variabiletesto} +\setinterfacecommand{textwidth}{ampiezzatesto} +\setinterfacecommand{thinrule}{lineasottile} +\setinterfacecommand{thinrules}{lineesottili} +\setinterfacecommand{tooltip}{tooltip} +\setinterfacecommand{topdistance}{distanzacima} +\setinterfacecommand{topheight}{altezzacima} +\setinterfacecommand{topspace}{spaziocima} +\setinterfacecommand{totalnumberofpages}{numerototaledipagine} +\setinterfacecommand{translate}{traduci} +\setinterfacecommand{txt}{txt} +\setinterfacecommand{typ}{typ} +\setinterfacecommand{type}{type} +\setinterfacecommand{typebuffer}{typebuffer} +\setinterfacecommand{typefile}{typefile} +\setinterfacecommand{unitmeaning}{nomeunita} +\setinterfacecommand{unknown}{ignoto} +\setinterfacecommand{useJSscripts}{usaJSscripts} +\setinterfacecommand{useURL}{usaURL} +\setinterfacecommand{useXMLfilter}{useXMLfilter} +\setinterfacecommand{useblocks}{usablocco} +\setinterfacecommand{usecommands}{usacomandi} +\setinterfacecommand{useencoding}{usacodifica} +\setinterfacecommand{useexternaldocument}{usadocumentoesterno} +\setinterfacecommand{useexternalfigure}{usafiguraesterna} +\setinterfacecommand{useexternalfile}{usafileesterno} +\setinterfacecommand{useexternalfiles}{usafileesterni} +\setinterfacecommand{useexternalsoundtrack}{usacolonnasonoraesterna} +\setinterfacecommand{usemodule}{usamodulo} +\setinterfacecommand{usemodules}{usamoduli} +\setinterfacecommand{usepath}{usacartella} +\setinterfacecommand{usereferences}{usariferimenti} +\setinterfacecommand{usespecials}{usaspecialita} +\setinterfacecommand{usesymbols}{usasimboli} +\setinterfacecommand{usetypescript}{usetypescript} +\setinterfacecommand{usetypescriptfile}{usetypescriptfile} +\setinterfacecommand{useurl}{usaurl} +\setinterfacecommand{version}{versione} +\setinterfacecommand{vl}{vl} +\setinterfacecommand{weekday}{giornosettimana} +\setinterfacecommand{whitespace}{spaziobianco} +\setinterfacecommand{wordright}{paroladestra} +\setinterfacecommand{writebetweenlist}{scrividentroelenco} +\setinterfacecommand{writetolist}{scriviinelenco} +\setinterfacecommand{writetoreferencelist}{scriviinlistariferimenti} +\setinterfacecommand{writetoregister}{scriviinregistro} +% +\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-it.tex b/Master/texmf-dist/tex/context/base/mult-it.tex deleted file mode 100644 index ce14800de04..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-it.tex +++ /dev/null @@ -1,1693 +0,0 @@ -% this file is auto-generated, don't edit this file -% -% definitions for interface variables for language it -% -\setinterfacevariable{Addition}{Aggiunta} -\setinterfacevariable{Balloon}{Pallone} -\setinterfacevariable{Character}{Lettera} -\setinterfacevariable{Characters}{Lettere} -\setinterfacevariable{CloseDocument}{ChiudiDocumento} -\setinterfacevariable{ExitViewer}{EsciVisualizzatore} -\setinterfacevariable{FirstPage}{PrimaPagina} -\setinterfacevariable{FitHeight}{FitHeight} -\setinterfacevariable{FitWidth}{FitWidth} -\setinterfacevariable{GotoPage}{VaiAPagina} -\setinterfacevariable{Greek}{Greco} -\setinterfacevariable{Help}{Aiuto} -\setinterfacevariable{HideField}{NascondiCampo} -\setinterfacevariable{HideLayer}{HideLayer} -\setinterfacevariable{Key}{Tasto} -\setinterfacevariable{LastPage}{UltimaPagina} -\setinterfacevariable{LoadForm}{CaricaForm} -\setinterfacevariable{MONTH}{MESE} -\setinterfacevariable{New}{Nuovo} -\setinterfacevariable{NextJump}{SaltoSuccessivo} -\setinterfacevariable{NextPage}{PaginaSuccessiva} -\setinterfacevariable{Numbers}{Numeri} -\setinterfacevariable{OpenNamedDocument}{OpenNamedDocument} -\setinterfacevariable{Paragraph}{Capoverso} -\setinterfacevariable{PauseMovie}{PausaFilm} -\setinterfacevariable{PauseRendering}{PauseRendering} -\setinterfacevariable{PauseSound}{PausaSuono} -\setinterfacevariable{PreviousJump}{SaltoPrecedente} -\setinterfacevariable{PreviousPage}{PaginaPrecedente} -\setinterfacevariable{PrintDocument}{StampaDocumento} -\setinterfacevariable{Query}{Richiesta} -\setinterfacevariable{QueryAgain}{RinnovaRichiesta} -\setinterfacevariable{ResetForm}{ReimpostaForm} -\setinterfacevariable{ResumeMovie}{RiprendiFilm} -\setinterfacevariable{ResumeRendering}{ResumeRendering} -\setinterfacevariable{ResumeSound}{RiprendiSuono} -\setinterfacevariable{Romannumerals}{Numeriromani} -\setinterfacevariable{SaveDocument}{SalvaDocumento} -\setinterfacevariable{SaveForm}{SalvaForm} -\setinterfacevariable{SaveNamedDocument}{SaveNamedDocument} -\setinterfacevariable{SearchAgain}{CercaAncora} -\setinterfacevariable{SearchDocument}{CercaDocumento} -\setinterfacevariable{ShowBookmarks}{MostraSegnalibro} -\setinterfacevariable{ShowField}{MostraCampo} -\setinterfacevariable{ShowThumbs}{MostraThumbs} -\setinterfacevariable{StartMovie}{IniziaFilm} -\setinterfacevariable{StartRendering}{StartRendering} -\setinterfacevariable{StartSound}{IniziaSuono} -\setinterfacevariable{StopMovie}{FermaFilm} -\setinterfacevariable{StopRendering}{StopRendering} -\setinterfacevariable{StopSound}{FermaSuono} -\setinterfacevariable{SubmitForm}{MandaForm} -\setinterfacevariable{ToggleLayer}{ToggleLayer} -\setinterfacevariable{ToggleViewer}{ScambiaVisualizzatore} -\setinterfacevariable{URL}{URL} -\setinterfacevariable{VideLayer}{VideLayer} -\setinterfacevariable{ViewerHelp}{AiutoVisualizzatore} -\setinterfacevariable{WEEKDAY}{GIORNOSETTIMANA} -\setinterfacevariable{WORD}{PAROLA} -\setinterfacevariable{abbreviation}{abbreviazione} -\setinterfacevariable{abbreviations}{abbreviazioni} -\setinterfacevariable{absolute}{assoluto} -\setinterfacevariable{action}{azione} -\setinterfacevariable{after}{dopo} -\setinterfacevariable{all}{tutti} -\setinterfacevariable{always}{sempre} -\setinterfacevariable{answerarea}{answerarea} -\setinterfacevariable{appendices}{appendici} -\setinterfacevariable{appendix}{appendice} -\setinterfacevariable{april}{aprile} -\setinterfacevariable{atmargin}{almargine} -\setinterfacevariable{atpage}{apagina} -\setinterfacevariable{august}{agosto} -\setinterfacevariable{author}{autore} -\setinterfacevariable{auto}{auto} -\setinterfacevariable{autointro}{autointro} -\setinterfacevariable{back}{dietro} -\setinterfacevariable{background}{sfondo} -\setinterfacevariable{backmatter}{postambolo} -\setinterfacevariable{backpart}{postfazione} -\setinterfacevariable{backspace}{backspace} -\setinterfacevariable{backward}{indietro} -\setinterfacevariable{bbl}{bbl} -\setinterfacevariable{before}{prima} -\setinterfacevariable{begin}{begin} -\setinterfacevariable{bib}{bib} -\setinterfacevariable{big}{grande} -\setinterfacevariable{bigbodyfont}{grossofontdeltesto} -\setinterfacevariable{bigpreference}{grandepreferenza} -\setinterfacevariable{blank}{rigovuoto} -\setinterfacevariable{blockquote}{blockquote} -\setinterfacevariable{bodymatter}{testiprincipali} -\setinterfacevariable{bodypart}{testoprincipale} -\setinterfacevariable{bold}{grassetto} -\setinterfacevariable{bolditalic}{grassettocorsivo} -\setinterfacevariable{boldslanted}{grassettoinclinato} -\setinterfacevariable{bookmark}{segnalibro} -\setinterfacevariable{both}{entrambi} -\setinterfacevariable{bottom}{fondo} -\setinterfacevariable{brief}{brief} -\setinterfacevariable{broad}{ampio} -\setinterfacevariable{buffer}{buffer} -\setinterfacevariable{by}{da} -\setinterfacevariable{calligraphic}{calligrafico} -\setinterfacevariable{cap}{cap} -\setinterfacevariable{capital}{maiuscolo} -\setinterfacevariable{center}{center} -\setinterfacevariable{chapter}{capitolo} -\setinterfacevariable{character}{lettera} -\setinterfacevariable{characters}{lettere} -\setinterfacevariable{cite}{cite} -\setinterfacevariable{color}{colore} -\setinterfacevariable{column}{colonna} -\setinterfacevariable{columns}{colonne} -\setinterfacevariable{command}{comando} -\setinterfacevariable{commands}{comandi} -\setinterfacevariable{comment}{commento} -\setinterfacevariable{component}{componente} -\setinterfacevariable{concept}{concetto} -\setinterfacevariable{content}{indice} -\setinterfacevariable{contents}{indici} -\setinterfacevariable{continue}{continua} -\setinterfacevariable{controls}{controlli} -\setinterfacevariable{conversion}{coversione} -\setinterfacevariable{current}{corrente} -\setinterfacevariable{cutspace}{cutspace} -\setinterfacevariable{date}{data} -\setinterfacevariable{day}{giorno} -\setinterfacevariable{december}{dicembre} -\setinterfacevariable{default}{implicito} -\setinterfacevariable{depth}{profondita} -\setinterfacevariable{description}{descrizione} -\setinterfacevariable{disable}{disattiva} -\setinterfacevariable{display}{schermo} -\setinterfacevariable{dot}{punto} -\setinterfacevariable{doublesided}{doppiafaccia} -\setinterfacevariable{down}{down} -\setinterfacevariable{each}{ogni} -\setinterfacevariable{edge}{bordo} -\setinterfacevariable{empty}{vuoto} -\setinterfacevariable{end}{end} -\setinterfacevariable{endnote}{endnote} -\setinterfacevariable{enumeration}{enumerazione} -\setinterfacevariable{environment}{ambiente} -\setinterfacevariable{even}{pari} -\setinterfacevariable{external}{esterno} -\setinterfacevariable{fact}{fatto} -\setinterfacevariable{february}{febbraio} -\setinterfacevariable{figure}{figura} -\setinterfacevariable{figures}{figure} -\setinterfacevariable{file}{file} -\setinterfacevariable{final}{finale} -\setinterfacevariable{first}{primo} -\setinterfacevariable{firstcolumn}{firstcolumn} -\setinterfacevariable{firstpage}{primapagina} -\setinterfacevariable{firstsubpage}{primasottopagina} -\setinterfacevariable{fit}{adatta} -\setinterfacevariable{five}{cinque} -\setinterfacevariable{fix}{fisso} -\setinterfacevariable{fixed}{fisso} -\setinterfacevariable{flexible}{flessibile} -\setinterfacevariable{float}{oggettomobile} -\setinterfacevariable{flushinner}{flushinner} -\setinterfacevariable{flushleft}{flushleft} -\setinterfacevariable{flushouter}{flushouter} -\setinterfacevariable{flushright}{flushright} -\setinterfacevariable{footer}{piedipagina} -\setinterfacevariable{footnote}{notapdp} -\setinterfacevariable{force}{forza} -\setinterfacevariable{foreground}{foreground} -\setinterfacevariable{formeel}{formeel} -\setinterfacevariable{formula}{formula} -\setinterfacevariable{formulae}{formule} -\setinterfacevariable{forward}{avanti} -\setinterfacevariable{four}{quattro} -\setinterfacevariable{frame}{cornice} -\setinterfacevariable{framedtext}{testoincorniciato} -\setinterfacevariable{friday}{venerdi} -\setinterfacevariable{frontmatter}{preambolo} -\setinterfacevariable{frontpart}{prefazione} -\setinterfacevariable{global}{globale} -\setinterfacevariable{graphic}{grafico} -\setinterfacevariable{graphics}{grafici} -\setinterfacevariable{gray}{grigio} -\setinterfacevariable{greek}{greco} -\setinterfacevariable{grid}{griglia} -\setinterfacevariable{halfline}{mezzariga} -\setinterfacevariable{handwritten}{grafiamanuale} -\setinterfacevariable{hang}{sospendi} -\setinterfacevariable{hanging}{sospeso} -\setinterfacevariable{head}{testa} -\setinterfacevariable{header}{intestazione} -\setinterfacevariable{height}{altezza} -\setinterfacevariable{helptext}{testoaiuto} -\setinterfacevariable{hencefore}{precedente} -\setinterfacevariable{here}{qui} -\setinterfacevariable{hereafter}{seguente} -\setinterfacevariable{hidden}{nascosto} -\setinterfacevariable{hiding}{nascondere} -\setinterfacevariable{high}{alto} -\setinterfacevariable{horizontal}{orizzontale} -\setinterfacevariable{hyphenated}{sillabato} -\setinterfacevariable{hz}{hz} -\setinterfacevariable{inbetween}{tra} -\setinterfacevariable{index}{indiceanalitico} -\setinterfacevariable{indices}{indicianalitici} -\setinterfacevariable{informeel}{informeel} -\setinterfacevariable{inherit}{inherit} -\setinterfacevariable{inleft}{insinistra} -\setinterfacevariable{inmargin}{inmargine} -\setinterfacevariable{inner}{interno} -\setinterfacevariable{inneredge}{bordointerno} -\setinterfacevariable{innermargin}{margineinterno} -\setinterfacevariable{inright}{indestra} -\setinterfacevariable{interaction}{interazione} -\setinterfacevariable{interactionmenu}{menuinterattivo} -\setinterfacevariable{intermezzi}{intermezzi} -\setinterfacevariable{intermezzo}{intermezzo} -\setinterfacevariable{intext}{intesto} -\setinterfacevariable{intro}{intro} -\setinterfacevariable{italic}{corsivo} -\setinterfacevariable{italicbold}{corsivograssetto} -\setinterfacevariable{item}{elemento} -\setinterfacevariable{itemize}{elenco} -\setinterfacevariable{its}{its} -\setinterfacevariable{january}{gennaio} -\setinterfacevariable{joinedup}{unito} -\setinterfacevariable{july}{luglio} -\setinterfacevariable{june}{giugno} -\setinterfacevariable{keep}{mantieni} -\setinterfacevariable{knockout}{knockout} -\setinterfacevariable{label}{etichetta} -\setinterfacevariable{landscape}{orizzontale} -\setinterfacevariable{last}{ultimo} -\setinterfacevariable{lastcolumn}{lastcolumn} -\setinterfacevariable{lastpage}{ultimapagina} -\setinterfacevariable{lastpagenumber}{lastpagenumber} -\setinterfacevariable{lastsubpage}{ultimasottopagina} -\setinterfacevariable{layer}{layer} -\setinterfacevariable{left}{sinistra} -\setinterfacevariable{leftedge}{bordosinistro} -\setinterfacevariable{lefthanging}{lefthanging} -\setinterfacevariable{leftmargin}{marginesinistro} -\setinterfacevariable{leftpage}{paginasinistra} -\setinterfacevariable{lefttoright}{lefttoright} -\setinterfacevariable{legend}{legenda} -\setinterfacevariable{lesshyphenation}{lesshyphenation} -\setinterfacevariable{line}{riga} -\setinterfacevariable{linenote}{linenote} -\setinterfacevariable{lines}{righe} -\setinterfacevariable{list}{elenco} -\setinterfacevariable{local}{locale} -\setinterfacevariable{localenvironment}{ambientelocale} -\setinterfacevariable{logo}{logo} -\setinterfacevariable{logos}{loghi} -\setinterfacevariable{lohi}{pedap} -\setinterfacevariable{loose}{lento} -\setinterfacevariable{low}{basso} -\setinterfacevariable{ls}{ls} -\setinterfacevariable{makeup}{makeup} -\setinterfacevariable{mar}{mar} -\setinterfacevariable{march}{marzo} -\setinterfacevariable{margin}{margine} -\setinterfacevariable{marginedge}{bordomargine} -\setinterfacevariable{margintitle}{titoloinmargine} -\setinterfacevariable{marking}{marcatura} -\setinterfacevariable{mathalignment}{mathalignment} -\setinterfacevariable{mathcases}{mathcases} -\setinterfacevariable{mathmatrix}{mathmatrix} -\setinterfacevariable{max}{max} -\setinterfacevariable{maxdepth}{maxdepth} -\setinterfacevariable{maxheight}{maxheight} -\setinterfacevariable{maxwidth}{maxwidth} -\setinterfacevariable{may}{maggio} -\setinterfacevariable{mediaeval}{medievale} -\setinterfacevariable{medium}{medio} -\setinterfacevariable{middle}{centro} -\setinterfacevariable{min}{min} -\setinterfacevariable{mindepth}{mindepth} -\setinterfacevariable{minheight}{altezzamin} -\setinterfacevariable{minwidth}{ampiezzamin} -\setinterfacevariable{mirrored}{riflesso} -\setinterfacevariable{monday}{lunedi} -\setinterfacevariable{mono}{mono} -\setinterfacevariable{month}{mese} -\setinterfacevariable{morehyphenation}{morehyphenation} -\setinterfacevariable{name}{nome} -\setinterfacevariable{narrow}{stretto} -\setinterfacevariable{negative}{negativo} -\setinterfacevariable{never}{mai} -\setinterfacevariable{new}{nuovo} -\setinterfacevariable{next}{successivo} -\setinterfacevariable{nextevenpage}{paginaparisuccessiva} -\setinterfacevariable{nextoddpage}{paginadisparisuccessiva} -\setinterfacevariable{nextpage}{paginasuccessiva} -\setinterfacevariable{nextsubpage}{sottopaginasuccessiva} -\setinterfacevariable{no}{no} -\setinterfacevariable{nocheck}{nocheck} -\setinterfacevariable{nofit}{nofit} -\setinterfacevariable{nogrid}{nogrid} -\setinterfacevariable{nohz}{nohz} -\setinterfacevariable{nomarking}{nomarcature} -\setinterfacevariable{none}{nessuno} -\setinterfacevariable{nonumber}{nonumber} -\setinterfacevariable{normal}{normale} -\setinterfacevariable{nospacing}{nospacing} -\setinterfacevariable{not}{non} -\setinterfacevariable{note}{note} -\setinterfacevariable{nothanging}{nonsospeso} -\setinterfacevariable{nothyphenated}{nonsillabato} -\setinterfacevariable{november}{novembre} -\setinterfacevariable{nowhere}{danessunaparte} -\setinterfacevariable{nowhite}{nobianco} -\setinterfacevariable{number}{numero} -\setinterfacevariable{numbers}{numeri} -\setinterfacevariable{october}{ottobre} -\setinterfacevariable{odd}{dispari} -\setinterfacevariable{off}{disattivo} -\setinterfacevariable{offset}{offset} -\setinterfacevariable{old}{old} -\setinterfacevariable{on}{attivo} -\setinterfacevariable{one}{uno} -\setinterfacevariable{opposite}{opposto} -\setinterfacevariable{outer}{esterno} -\setinterfacevariable{outeredge}{bordoesterno} -\setinterfacevariable{outermargin}{margineesterno} -\setinterfacevariable{overbar}{sopralinea} -\setinterfacevariable{overbars}{sopralinee} -\setinterfacevariable{overlay}{sovrapponi} -\setinterfacevariable{overprint}{overprint} -\setinterfacevariable{overstrike}{sbarrato} -\setinterfacevariable{overstrikes}{sbarrati} -\setinterfacevariable{packed}{impaccato} -\setinterfacevariable{page}{pagina} -\setinterfacevariable{pagecomment}{commentopagina} -\setinterfacevariable{pagenumber}{numeropagina} -\setinterfacevariable{paper}{carta} -\setinterfacevariable{paragraph}{capoverso} -\setinterfacevariable{part}{parte} -\setinterfacevariable{positive}{positivo} -\setinterfacevariable{postponing}{posporre} -\setinterfacevariable{postscript}{postscript} -\setinterfacevariable{preference}{preferenza} -\setinterfacevariable{preview}{anteprima} -\setinterfacevariable{previous}{precedente} -\setinterfacevariable{previousevenpage}{paginapariprecedente} -\setinterfacevariable{previousoddpage}{paginadispariprecedente} -\setinterfacevariable{previouspage}{paginaprecedente} -\setinterfacevariable{previoussubpage}{sottopaginaprecedente} -\setinterfacevariable{printable}{stampabile} -\setinterfacevariable{process}{process} -\setinterfacevariable{product}{prodotto} -\setinterfacevariable{program}{programma} -\setinterfacevariable{project}{progetto} -\setinterfacevariable{protected}{protetto} -\setinterfacevariable{quadruple}{quadruplo} -\setinterfacevariable{quotation}{citazione} -\setinterfacevariable{quote}{menzione} -\setinterfacevariable{ran}{corse} -\setinterfacevariable{random}{casuale} -\setinterfacevariable{readonly}{solalettura} -\setinterfacevariable{rectangular}{rettangolare} -\setinterfacevariable{referral}{referral} -\setinterfacevariable{register}{registro} -\setinterfacevariable{regular}{regolare} -\setinterfacevariable{rekening}{rekening} -\setinterfacevariable{relative}{relativo} -\setinterfacevariable{repeat}{ripeti} -\setinterfacevariable{required}{richiestp} -\setinterfacevariable{reset}{reimposta} -\setinterfacevariable{reverse}{invertito} -\setinterfacevariable{right}{destra} -\setinterfacevariable{rightedge}{bordodestro} -\setinterfacevariable{righthanging}{righthanging} -\setinterfacevariable{rightmargin}{marginedestro} -\setinterfacevariable{rightpage}{paginadestra} -\setinterfacevariable{righttoleft}{righttoleft} -\setinterfacevariable{roman}{roman} -\setinterfacevariable{romannumerals}{numeriromani} -\setinterfacevariable{rotate}{ruota} -\setinterfacevariable{rotated}{ruotato} -\setinterfacevariable{round}{rotondo} -\setinterfacevariable{row}{row} -\setinterfacevariable{rule}{linea} -\setinterfacevariable{samepage}{stessapagina} -\setinterfacevariable{sans}{sans} -\setinterfacevariable{sansbold}{sansgrassetto} -\setinterfacevariable{sansserif}{sansserif} -\setinterfacevariable{saturday}{sabato} -\setinterfacevariable{screen}{schermo} -\setinterfacevariable{section}{capoverso} -\setinterfacevariable{sectionblockenvironment}{ambientebloccosezione} -\setinterfacevariable{sectionnumber}{numerosezione} -\setinterfacevariable{see}{vedi} -\setinterfacevariable{september}{settembre} -\setinterfacevariable{serif}{serif} -\setinterfacevariable{serried}{vicino} -\setinterfacevariable{setups}{nastaveni} -\setinterfacevariable{sheet}{sheet} -\setinterfacevariable{short}{short} -\setinterfacevariable{singlesided}{facciasingola} -\setinterfacevariable{slanted}{inclinato} -\setinterfacevariable{slantedbold}{inclinatograssetto} -\setinterfacevariable{small}{piccolo} -\setinterfacevariable{smallbodyfont}{piccolofontdelcorpo} -\setinterfacevariable{smallbold}{piccolograssetto} -\setinterfacevariable{smallbolditalic}{piccolograssettocorsivo} -\setinterfacevariable{smallboldslanted}{piccolograssettoinclinato} -\setinterfacevariable{smallcaps}{maiuscoletto} -\setinterfacevariable{smallitalic}{piccolocorsivo} -\setinterfacevariable{smallitalicbold}{piccolocorsivograssetto} -\setinterfacevariable{smallnormal}{piccolonormale} -\setinterfacevariable{smallslanted}{piccoloinclinato} -\setinterfacevariable{smallslantedbold}{piccoloinclinatograssetto} -\setinterfacevariable{smalltype}{piccolotype} -\setinterfacevariable{somewhere}{daqualcheparte} -\setinterfacevariable{sorted}{ordinato} -\setinterfacevariable{space}{spazio} -\setinterfacevariable{spacing}{spaziatura} -\setinterfacevariable{speech}{speech} -\setinterfacevariable{split}{separa} -\setinterfacevariable{spot}{spot} -\setinterfacevariable{standard}{standard} -\setinterfacevariable{start}{inizia} -\setinterfacevariable{starter}{starter} -\setinterfacevariable{sticker}{sticker} -\setinterfacevariable{stop}{termina} -\setinterfacevariable{stopper}{stopper} -\setinterfacevariable{stretch}{dilata} -\setinterfacevariable{strict}{rigido} -\setinterfacevariable{strong}{strong} -\setinterfacevariable{strut}{strut} -\setinterfacevariable{sub}{sotto} -\setinterfacevariable{subbackward}{sottoindietro} -\setinterfacevariable{subformula}{subformula} -\setinterfacevariable{subforward}{sottoavanti} -\setinterfacevariable{subject}{argomento} -\setinterfacevariable{subpage}{sottopagina} -\setinterfacevariable{subsection}{sottocapoverso} -\setinterfacevariable{subsubject}{sottoargomento} -\setinterfacevariable{subsubsection}{sottosottocapoverso} -\setinterfacevariable{subsubsubject}{sottosottoargomento} -\setinterfacevariable{subsubsubsection}{sottosottosottocapoverso} -\setinterfacevariable{subsubsubsubject}{sottosottosottoargomento} -\setinterfacevariable{subsubsubsubsection}{sottosottosottosottocapoverso} -\setinterfacevariable{subsubsubsubsubject}{sottosottosottosottoargomento} -\setinterfacevariable{subsubsubsubsubsection}{sottosottosottosottosottocapoverso} -\setinterfacevariable{subsubsubsubsubsubject}{sottosottosottosottosottoargomento} -\setinterfacevariable{subsubsubsubsubsubsection}{sottosottosottosottosottosottocapoverso} -\setinterfacevariable{subsubsubsubsubsubsubject}{sottosottosottosottosottosottoargomento} -\setinterfacevariable{subsubsubsubsubsubsubsection}{sottosottosottosottosottosottosottocapoverso} -\setinterfacevariable{subsubsubsubsubsubsubsubject}{sottosottosottosottosottosottosottoargomento} -\setinterfacevariable{subsubsubsubsubsubsubsubsection}{sottosottosottosottosottosottosottosottocapoverso} -\setinterfacevariable{subsubsubsubsubsubsubsubsubject}{sottosottosottosottosottosottosottosottoargomento} -\setinterfacevariable{subsubsubsubsubsubsubsubsubsection}{sottosottosottosottosottosottosottosottosottocapoverso} -\setinterfacevariable{subsubsubsubsubsubsubsubsubsubject}{sottosottosottosottosottosottosottosottosottoargomento} -\setinterfacevariable{sunday}{domenica} -\setinterfacevariable{support}{supporto} -\setinterfacevariable{sym}{sim} -\setinterfacevariable{symbol}{simbolo} -\setinterfacevariable{synchronize}{synchronize} -\setinterfacevariable{system}{sistema} -\setinterfacevariable{table}{tabella} -\setinterfacevariable{tablehead}{testatabella} -\setinterfacevariable{tables}{tabelle} -\setinterfacevariable{tabletail}{codatabella} -\setinterfacevariable{tabulate}{tabulato} -\setinterfacevariable{tabulatehead}{testatabulato} -\setinterfacevariable{tabulatetail}{codatabulato} -\setinterfacevariable{tall}{alto} -\setinterfacevariable{teletype}{teletype} -\setinterfacevariable{temporary}{temporaneo} -\setinterfacevariable{test}{test} -\setinterfacevariable{text}{testo} -\setinterfacevariable{three}{tre} -\setinterfacevariable{thursday}{giovedi} -\setinterfacevariable{title}{titolo} -\setinterfacevariable{toggle}{toggle} -\setinterfacevariable{tolerant}{tollerante} -\setinterfacevariable{top}{cima} -\setinterfacevariable{tuesday}{martedi} -\setinterfacevariable{two}{due} -\setinterfacevariable{txt}{txt} -\setinterfacevariable{type}{type} -\setinterfacevariable{typing}{typing} -\setinterfacevariable{unavailable}{nondisponibile} -\setinterfacevariable{underbar}{sottolinea} -\setinterfacevariable{underbars}{sottolinee} -\setinterfacevariable{unit}{unita} -\setinterfacevariable{units}{unita} -\setinterfacevariable{unknown}{ignoto} -\setinterfacevariable{unpacked}{unpacked} -\setinterfacevariable{up}{up} -\setinterfacevariable{url}{url} -\setinterfacevariable{used}{usato} -\setinterfacevariable{value}{valore} -\setinterfacevariable{vertical}{verticale} -\setinterfacevariable{very}{molto} -\setinterfacevariable{verystrict}{moltorigido} -\setinterfacevariable{verytolerant}{moltotollerante} -\setinterfacevariable{weak}{weak} -\setinterfacevariable{wednesday}{mercoledi} -\setinterfacevariable{week}{settimana} -\setinterfacevariable{weekday}{giornosettimana} -\setinterfacevariable{white}{bianco} -\setinterfacevariable{wide}{ampio} -\setinterfacevariable{width}{ampiezza} -\setinterfacevariable{xml}{xml} -\setinterfacevariable{year}{anno} -\setinterfacevariable{yes}{si} -% definitions for interface constants for language it -% -\setinterfaceconstant{action}{azione} -\setinterfaceconstant{address}{indirizzo} -\setinterfaceconstant{after}{dopo} -\setinterfaceconstant{afterhead}{dopotesta} -\setinterfaceconstant{afterkey}{dopotasto} -\setinterfaceconstant{align}{allinea} -\setinterfaceconstant{aligncharacter}{allineacarattere} -\setinterfaceconstant{alignmentcharacter}{carattereallineamento} -\setinterfaceconstant{alignsymbol}{alignsymbol} -\setinterfaceconstant{aligntitle}{allineatitolo} -\setinterfaceconstant{alternative}{alternativa} -\setinterfaceconstant{andtext}{andtext} -\setinterfaceconstant{apa}{apa} -\setinterfaceconstant{arrow}{freccia} -\setinterfaceconstant{artauthor}{artauthor} -\setinterfaceconstant{artauthoretaldisplay}{artauthoretaldisplay} -\setinterfaceconstant{artauthoretallimit}{artauthoretallimit} -\setinterfaceconstant{artauthoretaltext}{artauthoretaltext} -\setinterfaceconstant{at}{ad} -\setinterfaceconstant{author}{autore} -\setinterfaceconstant{authoretaldisplay}{authoretaldisplay} -\setinterfaceconstant{authoretallimit}{authoretallimit} -\setinterfaceconstant{authoretaltext}{authoretaltext} -\setinterfaceconstant{auto}{auto} -\setinterfaceconstant{autofile}{autofile} -\setinterfaceconstant{autofocus}{autofocus} -\setinterfaceconstant{autohang}{autohang} -\setinterfaceconstant{autostrut}{autostrut} -\setinterfaceconstant{autowidth}{autoampiezza} -\setinterfaceconstant{axis}{asse} -\setinterfaceconstant{background}{sfondo} -\setinterfaceconstant{backgroundcolor}{coloresfondo} -\setinterfaceconstant{backgroundcorner}{angolosfondo} -\setinterfaceconstant{backgrounddepth}{profonditasfondo} -\setinterfaceconstant{backgroundoffset}{offsetsfondo} -\setinterfaceconstant{backgroundradius}{raggiosfondo} -\setinterfaceconstant{backgroundscreen}{schermosfondo} -\setinterfaceconstant{backspace}{backspace} -\setinterfaceconstant{balance}{bilanciamento} -\setinterfaceconstant{before}{prima} -\setinterfaceconstant{beforehead}{primaditesta} -\setinterfaceconstant{bet}{bet} -\setinterfaceconstant{big}{grande} -\setinterfaceconstant{blank}{rigovuoto} -\setinterfaceconstant{blockway}{blockway} -\setinterfaceconstant{bodyfont}{fonttesto} -\setinterfaceconstant{bookmark}{segnalibro} -\setinterfaceconstant{bottom}{fondo} -\setinterfaceconstant{bottomafter}{bottomafter} -\setinterfaceconstant{bottombefore}{bottombefore} -\setinterfaceconstant{bottomdistance}{distanzafondo} -\setinterfaceconstant{bottomframe}{cornicefondo} -\setinterfaceconstant{bottomoffset}{offsetfondo} -\setinterfaceconstant{bottomspace}{spaziofondo} -\setinterfaceconstant{bottomstate}{statofondo} -\setinterfaceconstant{cache}{cache} -\setinterfaceconstant{calculate}{calcola} -\setinterfaceconstant{ccommand}{ccomando} -\setinterfaceconstant{click}{click} -\setinterfaceconstant{clickin}{clickdentro} -\setinterfaceconstant{clickout}{clickfuori} -\setinterfaceconstant{clipoffset}{clipoffset} -\setinterfaceconstant{closeaction}{azionechiudi} -\setinterfaceconstant{closecommand}{closecommand} -\setinterfaceconstant{closepageaction}{azionechiudipagina} -\setinterfaceconstant{closesymbol}{closesymbol} -\setinterfaceconstant{color}{colore} -\setinterfaceconstant{column}{colonna} -\setinterfaceconstant{columndistance}{distanzacolonne} -\setinterfaceconstant{columns}{colonne} -\setinterfaceconstant{command}{comando} -\setinterfaceconstant{commandafter}{comdandodopo} -\setinterfaceconstant{commandbefore}{comandoprima} -\setinterfaceconstant{commands}{comandi} -\setinterfaceconstant{component}{component} -\setinterfaceconstant{compoundhyphen}{compoundhyphen} -\setinterfaceconstant{compress}{compress} -\setinterfaceconstant{connector}{connector} -\setinterfaceconstant{continue}{continua} -\setinterfaceconstant{contrastcolor}{colorecontrasto} -\setinterfaceconstant{controls}{controlli} -\setinterfaceconstant{conversion}{conversione} -\setinterfaceconstant{convertfile}{convertifile} -\setinterfaceconstant{corner}{angolo} -\setinterfaceconstant{coupling}{accoppiamento} -\setinterfaceconstant{couplingway}{modoaccoppiamento} -\setinterfaceconstant{criterium}{criterio} -\setinterfaceconstant{current}{corrente} -\setinterfaceconstant{cutspace}{cutspace} -\setinterfaceconstant{dash}{dash} -\setinterfaceconstant{dat}{dat} -\setinterfaceconstant{database}{database} -\setinterfaceconstant{date}{data} -\setinterfaceconstant{deepnumbercommand}{deepnumbercommand} -\setinterfaceconstant{deeptextcommand}{deeptextcommand} -\setinterfaceconstant{default}{implicito} -\setinterfaceconstant{delay}{attesa} -\setinterfaceconstant{depth}{profondita} -\setinterfaceconstant{depthcorrection}{correzioneprofondita} -\setinterfaceconstant{direction}{direzione} -\setinterfaceconstant{directory}{directory} -\setinterfaceconstant{display}{display} -\setinterfaceconstant{distance}{distanza} -\setinterfaceconstant{dot}{punto} -\setinterfaceconstant{doublesided}{doppiafaccia} -\setinterfaceconstant{dummy}{dummy} -\setinterfaceconstant{dx}{dx} -\setinterfaceconstant{dy}{dy} -\setinterfaceconstant{edge}{bordo} -\setinterfaceconstant{edgedistance}{distanzabordo} -\setinterfaceconstant{editor}{editor} -\setinterfaceconstant{editoretaldisplay}{editoretaldisplay} -\setinterfaceconstant{editoretallimit}{editoretallimit} -\setinterfaceconstant{editoretaltext}{editoretaltext} -\setinterfaceconstant{empty}{vuoto} -\setinterfaceconstant{equalheight}{equalheight} -\setinterfaceconstant{equalwidth}{equalwidth} -\setinterfaceconstant{escape}{escape} -\setinterfaceconstant{evenmargin}{marginepari} -\setinterfaceconstant{expansion}{espansione} -\setinterfaceconstant{export}{export} -\setinterfaceconstant{extras}{extras} -\setinterfaceconstant{factor}{fattore} -\setinterfaceconstant{fallback}{fallback} -\setinterfaceconstant{family}{famiglia} -\setinterfaceconstant{fieldbackgroundcolor}{coloresfondocampo} -\setinterfaceconstant{fieldframecolor}{colorecornicecampo} -\setinterfaceconstant{fieldlayer}{fieldlayer} -\setinterfaceconstant{fieldoffset}{offsetcampo} -\setinterfaceconstant{file}{file} -\setinterfaceconstant{filtercommand}{filtercommand} -\setinterfaceconstant{finalnamesep}{finalnamesep} -\setinterfaceconstant{firstnamesep}{firstnamesep} -\setinterfaceconstant{focus}{focus} -\setinterfaceconstant{focusin}{focusin} -\setinterfaceconstant{focusout}{focusout} -\setinterfaceconstant{footer}{piedipagina} -\setinterfaceconstant{footerdistance}{distanzapdp} -\setinterfaceconstant{footerstate}{statopdp} -\setinterfaceconstant{foregroundcolor}{coloreprimopiano} -\setinterfaceconstant{foregroundstyle}{foregroundstyle} -\setinterfaceconstant{format}{format} -\setinterfaceconstant{frame}{cornice} -\setinterfaceconstant{framecolor}{colorecornice} -\setinterfaceconstant{framecorner}{angolocornice} -\setinterfaceconstant{framedepth}{profonditacornice} -\setinterfaceconstant{frameoffset}{offsetcornice} -\setinterfaceconstant{frameradius}{raggiocornice} -\setinterfaceconstant{frames}{cornici} -\setinterfaceconstant{from}{da} -\setinterfaceconstant{get}{prendi} -\setinterfaceconstant{global}{globale} -\setinterfaceconstant{grid}{griglia} -\setinterfaceconstant{hang}{sospendi} -\setinterfaceconstant{headalign}{headalign} -\setinterfaceconstant{headcolor}{coloretesta} -\setinterfaceconstant{headcommand}{headcommand} -\setinterfaceconstant{headconversion}{conversionetesta} -\setinterfaceconstant{header}{intestazione} -\setinterfaceconstant{headerdistance}{distanzaintestazione} -\setinterfaceconstant{headerstate}{statointestazione} -\setinterfaceconstant{headlabel}{etichettatesta} -\setinterfaceconstant{headnumber}{numerotesta} -\setinterfaceconstant{headstyle}{stiletesta} -\setinterfaceconstant{height}{altezza} -\setinterfaceconstant{hfactor}{hfactor} -\setinterfaceconstant{hfil}{hfil} -\setinterfaceconstant{hidenumber}{hidenumber} -\setinterfaceconstant{hoffset}{hoffset} -\setinterfaceconstant{horoffset}{horoffset} -\setinterfaceconstant{hyphen}{hyphen} -\setinterfaceconstant{icommand}{icomando} -\setinterfaceconstant{in}{in} -\setinterfaceconstant{inbetween}{tra} -\setinterfaceconstant{increment}{incremento} -\setinterfaceconstant{incrementnumber}{incrementanumero} -\setinterfaceconstant{indenting}{rientro} -\setinterfaceconstant{indentnext}{rientrasuccessivo} -\setinterfaceconstant{indicator}{indicatore} -\setinterfaceconstant{inner}{interno} -\setinterfaceconstant{innermargin}{margineinterno} -\setinterfaceconstant{inputfile}{inputfile} -\setinterfaceconstant{intent}{intent} -\setinterfaceconstant{interaction}{interazione} -\setinterfaceconstant{interlinespace}{interlinea} -\setinterfaceconstant{itemalign}{itemalign} -\setinterfaceconstant{items}{elementi} -\setinterfaceconstant{juniorsep}{juniorsep} -\setinterfaceconstant{ken}{ken} -\setinterfaceconstant{keyexpansion}{keyexpansion} -\setinterfaceconstant{keyword}{parolachiave} -\setinterfaceconstant{label}{etichetta} -\setinterfaceconstant{lastnamesep}{lastnamesep} -\setinterfaceconstant{lastpubsep}{lastpubsep} -\setinterfaceconstant{left}{sinistra} -\setinterfaceconstant{leftcolor}{coloresinistra} -\setinterfaceconstant{leftcompoundhyphen}{leftcompoundhyphen} -\setinterfaceconstant{leftedge}{bordosinistro} -\setinterfaceconstant{leftedgedistance}{distanzabordosinistro} -\setinterfaceconstant{leftframe}{cornicesinistra} -\setinterfaceconstant{lefthyphen}{lefthyphen} -\setinterfaceconstant{leftmargin}{marginesinistro} -\setinterfaceconstant{leftmargindistance}{distanzamarginesinistro} -\setinterfaceconstant{leftoffset}{offsetsinistro} -\setinterfaceconstant{leftquotation}{citazionesinistra} -\setinterfaceconstant{leftquote}{menzionesinistra} -\setinterfaceconstant{leftsentence}{frasesinistra} -\setinterfaceconstant{leftspeech}{leftspeech} -\setinterfaceconstant{leftstyle}{stilesinistra} -\setinterfaceconstant{leftsubsentence}{sottofrasesinistra} -\setinterfaceconstant{lefttext}{testosinistro} -\setinterfaceconstant{leftwidth}{ampiezzasinistra} -\setinterfaceconstant{level}{livello} -\setinterfaceconstant{levels}{livelli} -\setinterfaceconstant{limittext}{limittext} -\setinterfaceconstant{line}{riga} -\setinterfaceconstant{linecorrection}{correzioneriga} -\setinterfaceconstant{lines}{righe} -\setinterfaceconstant{list}{elenco} -\setinterfaceconstant{listtext}{listtext} -\setinterfaceconstant{local}{locale} -\setinterfaceconstant{location}{luogo} -\setinterfaceconstant{logo}{logo} -\setinterfaceconstant{logos}{loghi} -\setinterfaceconstant{marcolor}{coloremarcatura} -\setinterfaceconstant{margin}{margine} -\setinterfaceconstant{margindistance}{distanzamargine} -\setinterfaceconstant{marginedge}{bordomargine} -\setinterfaceconstant{marginedgetext}{testobordomargine} -\setinterfaceconstant{margintext}{testomargine} -\setinterfaceconstant{marking}{marcatura} -\setinterfaceconstant{marstyle}{stilemarcatura} -\setinterfaceconstant{max}{max} -\setinterfaceconstant{maxdepth}{maxdepth} -\setinterfaceconstant{maxheight}{altezzamax} -\setinterfaceconstant{maxwidth}{ampiezzamax} -\setinterfaceconstant{maybeyear}{maybeyear} -\setinterfaceconstant{menu}{menu} -\setinterfaceconstant{method}{metodo} -\setinterfaceconstant{middle}{centro} -\setinterfaceconstant{middlespeech}{middlespeech} -\setinterfaceconstant{middletext}{testocentro} -\setinterfaceconstant{midsentence}{midsentence} -\setinterfaceconstant{min}{min} -\setinterfaceconstant{mindepth}{mindeoth} -\setinterfaceconstant{minheight}{altezzamin} -\setinterfaceconstant{minwidth}{ampiezzamin} -\setinterfaceconstant{monthconversion}{monthconversion} -\setinterfaceconstant{n}{n} -\setinterfaceconstant{name}{nome} -\setinterfaceconstant{namesep}{namesep} -\setinterfaceconstant{nbottom}{nfondo} -\setinterfaceconstant{nc}{nc} -\setinterfaceconstant{next}{successivo} -\setinterfaceconstant{nl}{nl} -\setinterfaceconstant{nleft}{nsinistra} -\setinterfaceconstant{nlines}{nrighe} -\setinterfaceconstant{norm}{norma} -\setinterfaceconstant{nr}{nr} -\setinterfaceconstant{nright}{ndestra} -\setinterfaceconstant{ntop}{ncima} -\setinterfaceconstant{number}{numero} -\setinterfaceconstant{numbercolor}{colorenumero} -\setinterfaceconstant{numbercommand}{comandonumero} -\setinterfaceconstant{numberconversion}{numberconversion} -\setinterfaceconstant{numberconversionset}{numberconversionset} -\setinterfaceconstant{numberdistance}{numberdistance} -\setinterfaceconstant{numbering}{numerazione} -\setinterfaceconstant{numberorder}{numberorder} -\setinterfaceconstant{numberprefix}{numberprefix} -\setinterfaceconstant{numbersegments}{numbersegments} -\setinterfaceconstant{numberseparator}{separatorenumero} -\setinterfaceconstant{numberseparatorset}{numberseparatorset} -\setinterfaceconstant{numberset}{numberset} -\setinterfaceconstant{numberstarter}{numberstarter} -\setinterfaceconstant{numberstopper}{numberstopper} -\setinterfaceconstant{numberstyle}{stilenumero} -\setinterfaceconstant{numberwidth}{numberwidth} -\setinterfaceconstant{nx}{nx} -\setinterfaceconstant{ny}{ny} -\setinterfaceconstant{object}{oggetto} -\setinterfaceconstant{obstruction}{ostruzione} -\setinterfaceconstant{oddmargin}{marginedispari} -\setinterfaceconstant{offset}{offset} -\setinterfaceconstant{openaction}{azioneapri} -\setinterfaceconstant{openpageaction}{azioneapripagina} -\setinterfaceconstant{option}{opzione} -\setinterfaceconstant{order}{order} -\setinterfaceconstant{orientation}{orientation} -\setinterfaceconstant{otherstext}{otherstext} -\setinterfaceconstant{outermargin}{margineesterno} -\setinterfaceconstant{overprint}{overprint} -\setinterfaceconstant{ownnumber}{numeroproprio} -\setinterfaceconstant{page}{pagina} -\setinterfaceconstant{pageboundaries}{limitipagina} -\setinterfaceconstant{pagecolor}{colorepagina} -\setinterfaceconstant{pagecommand}{comandopagina} -\setinterfaceconstant{pageconversion}{pageconversion} -\setinterfaceconstant{pageconversionset}{pageconversionset} -\setinterfaceconstant{pagenumber}{numeropagina} -\setinterfaceconstant{pageprefix}{pageprefix} -\setinterfaceconstant{pageprefixconnector}{pageprefixconnector} -\setinterfaceconstant{pageprefixconversion}{pageprefixconversion} -\setinterfaceconstant{pageprefixconversionset}{pageprefixconversionset} -\setinterfaceconstant{pageprefixsegments}{pageprefixsegments} -\setinterfaceconstant{pageprefixseparatorset}{pageprefixseparatorset} -\setinterfaceconstant{pageprefixset}{pageprefixset} -\setinterfaceconstant{pageprefixstarter}{pageprefixstarter} -\setinterfaceconstant{pageprefixstopper}{pageprefixstopper} -\setinterfaceconstant{pagesegments}{pagesegments} -\setinterfaceconstant{pageseparatorset}{pageseparatorset} -\setinterfaceconstant{pageset}{pageset} -\setinterfaceconstant{pagestarter}{pagestarter} -\setinterfaceconstant{pagestate}{statopagina} -\setinterfaceconstant{pagestopper}{pagestopper} -\setinterfaceconstant{pagestyle}{stilepagina} -\setinterfaceconstant{palet}{tavolozza} -\setinterfaceconstant{paper}{carta} -\setinterfaceconstant{paragraph}{capoverso} -\setinterfaceconstant{place}{metti} -\setinterfaceconstant{placehead}{mettitesta} -\setinterfaceconstant{placestopper}{mettistopper} -\setinterfaceconstant{position}{posizione} -\setinterfaceconstant{prefix}{prefisso} -\setinterfaceconstant{prefixconnector}{prefixconnector} -\setinterfaceconstant{prefixconversion}{prefixconversion} -\setinterfaceconstant{prefixconversionset}{prefixconversionset} -\setinterfaceconstant{prefixsegments}{prefixsegments} -\setinterfaceconstant{prefixseparatorset}{prefixseparatorset} -\setinterfaceconstant{prefixset}{prefixset} -\setinterfaceconstant{prefixstarter}{prefixstarter} -\setinterfaceconstant{prefixstopper}{prefixstopper} -\setinterfaceconstant{preset}{preimpostato} -\setinterfaceconstant{preview}{anteprima} -\setinterfaceconstant{previous}{precedente} -\setinterfaceconstant{previousnumber}{numeroprecedente} -\setinterfaceconstant{process}{process} -\setinterfaceconstant{pubsep}{pubsep} -\setinterfaceconstant{radius}{raggio} -\setinterfaceconstant{random}{casuale} -\setinterfaceconstant{range}{range} -\setinterfaceconstant{reduction}{riduzione} -\setinterfaceconstant{ref}{ref} -\setinterfaceconstant{refcommand}{refcommand} -\setinterfaceconstant{reference}{riferimento} -\setinterfaceconstant{referenceprefix}{referenceprefix} -\setinterfaceconstant{referencing}{referencing} -\setinterfaceconstant{regionin}{entraregione} -\setinterfaceconstant{regionout}{esciregione} -\setinterfaceconstant{repeat}{ripeti} -\setinterfaceconstant{reset}{reset} -\setinterfaceconstant{resetnumber}{resetnumber} -\setinterfaceconstant{resolution}{risoluzione} -\setinterfaceconstant{right}{destra} -\setinterfaceconstant{rightcolor}{coloredestra} -\setinterfaceconstant{rightcompoundhyphen}{rightcompoundhyphen} -\setinterfaceconstant{rightedge}{bordodestro} -\setinterfaceconstant{rightedgedistance}{distanzabordodestro} -\setinterfaceconstant{rightframe}{cornicedestra} -\setinterfaceconstant{righthyphen}{righthyphen} -\setinterfaceconstant{rightmargin}{marginedestro} -\setinterfaceconstant{rightmargindistance}{distanzamarginedestro} -\setinterfaceconstant{rightoffset}{offsetdestro} -\setinterfaceconstant{rightquotation}{citazionedestra} -\setinterfaceconstant{rightquote}{menzionedestra} -\setinterfaceconstant{rightsentence}{frasedestra} -\setinterfaceconstant{rightspeech}{rightspeech} -\setinterfaceconstant{rightstyle}{stiledestra} -\setinterfaceconstant{rightsubsentence}{sottofrasedestra} -\setinterfaceconstant{righttext}{testodestro} -\setinterfaceconstant{rightwidth}{ampiezzadestra} -\setinterfaceconstant{rotation}{rotazione} -\setinterfaceconstant{rule}{linea} -\setinterfaceconstant{rulecolor}{colorelinea} -\setinterfaceconstant{rulethickness}{spessorelinea} -\setinterfaceconstant{samepage}{stessapagina} -\setinterfaceconstant{sample}{campione} -\setinterfaceconstant{samplesize}{samplesize} -\setinterfaceconstant{saveinlist}{saveinlist} -\setinterfaceconstant{scale}{scala} -\setinterfaceconstant{scope}{scope} -\setinterfaceconstant{screen}{schermo} -\setinterfaceconstant{section}{sezione} -\setinterfaceconstant{sectionconversion}{sectionconversion} -\setinterfaceconstant{sectionconversionset}{sectionconversionset} -\setinterfaceconstant{sectionnumber}{numerosezione} -\setinterfaceconstant{sectionresetset}{sectionresetset} -\setinterfaceconstant{sectionsegments}{sectionsegments} -\setinterfaceconstant{sectionseparatorset}{sectionseparatorset} -\setinterfaceconstant{sectionset}{sectionset} -\setinterfaceconstant{sectionstarter}{sectionstarter} -\setinterfaceconstant{sectionstopper}{sectionstopper} -\setinterfaceconstant{separator}{separatore} -\setinterfaceconstant{set}{set} -\setinterfaceconstant{setups}{setups} -\setinterfaceconstant{side}{lato} -\setinterfaceconstant{sidealign}{sidealign} -\setinterfaceconstant{sidemethod}{sidemethod} -\setinterfaceconstant{sidespaceafter}{spaziolateraledopo} -\setinterfaceconstant{sidespacebefore}{spaziolateraleprima} -\setinterfaceconstant{sign}{segno} -\setinterfaceconstant{size}{dimensione} -\setinterfaceconstant{small}{piccolo} -\setinterfaceconstant{sort}{sort} -\setinterfaceconstant{sorttype}{sorttype} -\setinterfaceconstant{source}{origine} -\setinterfaceconstant{space}{spazio} -\setinterfaceconstant{spaceafter}{spaziodopo} -\setinterfaceconstant{spacebefore}{spazioprima} -\setinterfaceconstant{spaceinbetween}{spaceinbetween} -\setinterfaceconstant{spacing}{spaziatura} -\setinterfaceconstant{split}{separa} -\setinterfaceconstant{splitcolor}{splitcolor} -\setinterfaceconstant{splitmethod}{splitmethod} -\setinterfaceconstant{splitoffset}{splitoffset} -\setinterfaceconstant{spot}{spot} -\setinterfaceconstant{stack}{stack} -\setinterfaceconstant{start}{inizia} -\setinterfaceconstant{starter}{starter} -\setinterfaceconstant{state}{stato} -\setinterfaceconstant{step}{passo} -\setinterfaceconstant{stop}{termina} -\setinterfaceconstant{stopper}{stopper} -\setinterfaceconstant{stretch}{dilata} -\setinterfaceconstant{strip}{strip} -\setinterfaceconstant{strut}{strut} -\setinterfaceconstant{style}{stile} -\setinterfaceconstant{sub}{sotto} -\setinterfaceconstant{subtitle}{sottotitolo} -\setinterfaceconstant{suffix}{suffix} -\setinterfaceconstant{surnamesep}{surnamesep} -\setinterfaceconstant{sx}{sx} -\setinterfaceconstant{sy}{sy} -\setinterfaceconstant{symalign}{symallinea} -\setinterfaceconstant{symbol}{simbolo} -\setinterfaceconstant{symbolset}{setsimboli} -\setinterfaceconstant{symcolor}{coloresimbolo} -\setinterfaceconstant{symstyle}{stilesimbolo} -\setinterfaceconstant{synonym}{sinonimo} -\setinterfaceconstant{synonymcolor}{coloresinonimi} -\setinterfaceconstant{synonymcommand}{synonymcommand} -\setinterfaceconstant{synonymstyle}{stilesinonimi} -\setinterfaceconstant{tab}{tab} -\setinterfaceconstant{text}{testo} -\setinterfaceconstant{textcolor}{coloretesto} -\setinterfaceconstant{textcommand}{comandotesto} -\setinterfaceconstant{textdistance}{distanzatesto} -\setinterfaceconstant{textlayer}{textlayer} -\setinterfaceconstant{textmargin}{textmargin} -\setinterfaceconstant{textmethod}{textmethod} -\setinterfaceconstant{textseparator}{separatoretesto} -\setinterfaceconstant{textsize}{dimensionetesto} -\setinterfaceconstant{textstate}{statotesto} -\setinterfaceconstant{textstyle}{stiletesto} -\setinterfaceconstant{textwidth}{ampiezzatesto} -\setinterfaceconstant{title}{titolo} -\setinterfaceconstant{titlecolor}{coloretitolo} -\setinterfaceconstant{titlecommand}{titlecommand} -\setinterfaceconstant{titledistance}{distanzatitolo} -\setinterfaceconstant{titleleft}{titleleft} -\setinterfaceconstant{titleright}{titleright} -\setinterfaceconstant{titlestyle}{stiletitolo} -\setinterfaceconstant{to}{verso} -\setinterfaceconstant{tolerance}{tolleranza} -\setinterfaceconstant{top}{cima} -\setinterfaceconstant{topdistance}{distanzacima} -\setinterfaceconstant{topframe}{cornicecima} -\setinterfaceconstant{topoffset}{offsetcima} -\setinterfaceconstant{topspace}{spaziocima} -\setinterfaceconstant{topstate}{statocima} -\setinterfaceconstant{totalnumber}{totalnumber} -\setinterfaceconstant{type}{type} -\setinterfaceconstant{unit}{unita} -\setinterfaceconstant{unknownreference}{riferimentoingoto} -\setinterfaceconstant{urlalternative}{alternativaurl} -\setinterfaceconstant{urlspace}{spaziourl} -\setinterfaceconstant{validate}{verifica} -\setinterfaceconstant{vcommand}{vcomando} -\setinterfaceconstant{veroffset}{veroffset} -\setinterfaceconstant{vfil}{vfil} -\setinterfaceconstant{voffset}{voffset} -\setinterfaceconstant{vonsep}{vonsep} -\setinterfaceconstant{way}{modo} -\setinterfaceconstant{wfactor}{wfactor} -\setinterfaceconstant{white}{bianco} -\setinterfaceconstant{width}{ampiezza} -\setinterfaceconstant{xfactor}{xfactor} -\setinterfaceconstant{xmax}{xmax} -\setinterfaceconstant{xoffset}{xoffset} -\setinterfaceconstant{xscale}{xscale} -\setinterfaceconstant{xstep}{xstep} -\setinterfaceconstant{yfactor}{yfactor} -\setinterfaceconstant{ymax}{ymax} -\setinterfaceconstant{yoffset}{yoffset} -\setinterfaceconstant{yscale}{yscale} -\setinterfaceconstant{ystep}{ystep} -% definitions for interface elements for language it -% -\setinterfaceelement{answerlines}{answerlines} -\setinterfaceelement{answerspace}{answerspace} -\setinterfaceelement{begin}{inizio} -\setinterfaceelement{complete}{completo} -\setinterfaceelement{coupled}{accoppiato} -\setinterfaceelement{currentlocal}{correntelocale} -\setinterfaceelement{emptyone}{prazdne} -\setinterfaceelement{emptytwo}{vuoti} -\setinterfaceelement{end}{fine} -\setinterfaceelement{endsetup}{} -\setinterfaceelement{get}{prendi} -\setinterfaceelement{increment}{incrementa} -\setinterfaceelement{list}{elenco} -\setinterfaceelement{listof}{elencodi} -\setinterfaceelement{load}{carica} -\setinterfaceelement{local}{locale} -\setinterfaceelement{makeup}{makeup} -\setinterfaceelement{next}{successivo} -\setinterfaceelement{place}{metti} -\setinterfaceelement{previous}{precedente} -\setinterfaceelement{previouslocal}{precedentelocale} -\setinterfaceelement{reserve}{riserva} -\setinterfaceelement{see}{vedi} -\setinterfaceelement{setup}{imposta} -\setinterfaceelement{start}{inizia} -\setinterfaceelement{stop}{termina} -\setinterfaceelement{text}{testo} -\setinterfaceelement{type}{type} -% definitions for interface commands for language it -% -\setinterfacecommand{CAPPED}{CAP} -\setinterfacecommand{Character}{Lettera} -\setinterfacecommand{Characters}{Lettere} -\setinterfacecommand{LABELTEXT}{TESTOETICHETTA} -\setinterfacecommand{MONTH}{MESE} -\setinterfacecommand{Numbers}{Numeri} -\setinterfacecommand{Romannumerals}{Numeriromani} -\setinterfacecommand{SmallCapped}{Cap} -\setinterfacecommand{SmallCaps}{Caps} -\setinterfacecommand{WEEKDAY}{GIORNOSETTIMANA} -\setinterfacecommand{WORD}{PAROLA} -\setinterfacecommand{WORDS}{PAROLE} -\setinterfacecommand{Word}{Parola} -\setinterfacecommand{Words}{Parole} -\setinterfacecommand{about}{intorno} -\setinterfacecommand{adaptlayout}{adattalayout} -\setinterfacecommand{arg}{arg} -\setinterfacecommand{at}{al} -\setinterfacecommand{atleftmargin}{atleftmargin} -\setinterfacecommand{atpage}{apagina} -\setinterfacecommand{atrightmargin}{atrightmargin} -\setinterfacecommand{background}{sfondo} -\setinterfacecommand{backspace}{spaziodietro} -\setinterfacecommand{blackrule}{lineanera} -\setinterfacecommand{blackrules}{lineenere} -\setinterfacecommand{blank}{rigovuoto} -\setinterfacecommand{bookmark}{segnalibro} -\setinterfacecommand{bottomdistance}{distanzafondo} -\setinterfacecommand{bottomheight}{altezzafondo} -\setinterfacecommand{bottomspace}{spaziofondo} -\setinterfacecommand{but}{fondo} -\setinterfacecommand{button}{pulsante} -\setinterfacecommand{bypassblocks}{saltablocchi} -\setinterfacecommand{character}{lettera} -\setinterfacecommand{characters}{lettere} -\setinterfacecommand{chem}{chim} -\setinterfacecommand{clip}{clip} -\setinterfacecommand{clonefield}{clonacampo} -\setinterfacecommand{color}{colore} -\setinterfacecommand{colorbar}{barracolori} -\setinterfacecommand{colorvalue}{valorecolore} -\setinterfacecommand{column}{colonna} -\setinterfacecommand{comment}{commento} -\setinterfacecommand{comparecolorgroup}{confrontagruppocolori} -\setinterfacecommand{comparepalet}{confrontatavolozza} -\setinterfacecommand{completepagenumber}{numeropaginacompleto} -\setinterfacecommand{completeregister}{completeregister} -\setinterfacecommand{component}{componenet} -\setinterfacecommand{convertnumber}{convertinumero} -\setinterfacecommand{copyfield}{copiacampo} -\setinterfacecommand{correctwhitespace}{correggispaziobianco} -\setinterfacecommand{coupledocument}{accoppiadocumento} -\setinterfacecommand{couplemarking}{accoppiamarcatura} -\setinterfacecommand{couplepage}{accoppiapagina} -\setinterfacecommand{couplepaper}{accoppiacarta} -\setinterfacecommand{coupleregister}{accoppiaregistro} -\setinterfacecommand{crlf}{crlf} -\setinterfacecommand{currentdate}{datadioggi} -\setinterfacecommand{currentheadnumber}{numerotestacorrente} -\setinterfacecommand{cutspace}{cutspace} -\setinterfacecommand{date}{data} -\setinterfacecommand{decouplemarking}{separamarcatura} -\setinterfacecommand{decrementnumber}{decrementnumber} -\setinterfacecommand{define}{definisci} -\setinterfacecommand{defineaccent}{definisciaccento} -\setinterfacecommand{defineblank}{definiscirigovuoto} -\setinterfacecommand{defineblock}{definisciblocco} -\setinterfacecommand{definebodyfont}{definiscifontdeltesto} -\setinterfacecommand{definebodyfontenvironment}{definisciambientefontdeltesto} -\setinterfacecommand{definebuffer}{definiscibuffer} -\setinterfacecommand{definecharacter}{definiscicarattere} -\setinterfacecommand{definecolor}{definiscicolore} -\setinterfacecommand{definecolorgroup}{definiscigruppocolori} -\setinterfacecommand{definecolumnbreak}{definecolumnbreak} -\setinterfacecommand{definecolumnset}{definiscigruppocolonne} -\setinterfacecommand{definecombination}{definecombination} -\setinterfacecommand{definecombinedlist}{definiscielencocombinato} -\setinterfacecommand{definecommand}{definiscicomando} -\setinterfacecommand{defineconversion}{definisciconversione} -\setinterfacecommand{definedescription}{definiscidescrizione} -\setinterfacecommand{defineenumeration}{definiscienumerazione} -\setinterfacecommand{definefield}{definiscicampo} -\setinterfacecommand{definefieldstack}{definiscistackcampi} -\setinterfacecommand{definefiguresymbol}{definiscifigurasimbolo} -\setinterfacecommand{definefloat}{definiscioggettomobile} -\setinterfacecommand{definefont}{definiscifont} -\setinterfacecommand{definefontstyle}{definiscistilefont} -\setinterfacecommand{definefontsynonym}{definiscisinonimofont} -\setinterfacecommand{defineframed}{definisciincorniciato} -\setinterfacecommand{defineframedtext}{definiscitestoincorniciato} -\setinterfacecommand{definehbox}{definiscihbox} -\setinterfacecommand{definehead}{definiscitesta} -\setinterfacecommand{defineindenting}{definiscirientro} -\setinterfacecommand{defineinmargin}{defineinmargin} -\setinterfacecommand{defineinteractionmenu}{definiscimenuinterazione} -\setinterfacecommand{defineitemgroup}{defineitemgroup} -\setinterfacecommand{definelabel}{definiscietichetta} -\setinterfacecommand{definelayer}{definelayer} -\setinterfacecommand{definelayout}{definiscilayout} -\setinterfacecommand{definelist}{definiscielenco} -\setinterfacecommand{definelogo}{definiscilogo} -\setinterfacecommand{definemainfield}{definiscicampoprincipale} -\setinterfacecommand{definemakeup}{definiscimakeup} -\setinterfacecommand{definemarking}{definiscimarcatura} -\setinterfacecommand{definemathalignment}{definemathalignment} -\setinterfacecommand{defineoutput}{definiscioutput} -\setinterfacecommand{defineoverlay}{definiscisovrapposizione} -\setinterfacecommand{definepagebreak}{definepagebreak} -\setinterfacecommand{definepalet}{definiscitavolozza} -\setinterfacecommand{definepapersize}{definiscidimensionicarta} -\setinterfacecommand{defineparagraphs}{definiscicapoversi} -\setinterfacecommand{defineplacement}{defineplacement} -\setinterfacecommand{defineprofile}{definisciprofilo} -\setinterfacecommand{defineprogram}{definisciprogramma} -\setinterfacecommand{definerawfont}{definiscifontgrezzo} -\setinterfacecommand{definereference}{definisciriferimento} -\setinterfacecommand{definereferenceformat}{definisciformatoriferimento} -\setinterfacecommand{definereferencelist}{definiscilistariferimenti} -\setinterfacecommand{defineregister}{definisciregistro} -\setinterfacecommand{definerule}{definiscilinea} -\setinterfacecommand{definesection}{definiscisezione} -\setinterfacecommand{definesectionblock}{definiscibloccosezione} -\setinterfacecommand{definesorting}{definisciordinamento} -\setinterfacecommand{definestartstop}{definisciiniziatermina} -\setinterfacecommand{definestyle}{definiscistile} -\setinterfacecommand{definesubfield}{definiscisottocampo} -\setinterfacecommand{definesymbol}{definiscisimbolo} -\setinterfacecommand{definesynonyms}{definiscisinonimi} -\setinterfacecommand{definetabletemplate}{definiscimodellotabella} -\setinterfacecommand{definetabulate}{definiscitabulato} -\setinterfacecommand{definetext}{definiscitesto} -\setinterfacecommand{definetextposition}{definisciposizionetesto} -\setinterfacecommand{definetextvariable}{definiscivariabiletesto} -\setinterfacecommand{definetype}{definiscitype} -\setinterfacecommand{definetyping}{definiscityping} -\setinterfacecommand{defineversion}{definisciversion} -\setinterfacecommand{determineheadnumber}{determinanumerotesta} -\setinterfacecommand{determinelistcharacteristics}{determinacarattersticheelenco} -\setinterfacecommand{determineregistercharacteristics}{determinacaratteristicheregistro} -\setinterfacecommand{dimension}{dimensione} -\setinterfacecommand{disableinteractionmenu}{disabilitamenuinterazione} -\setinterfacecommand{domicile}{domicilio} -\setinterfacecommand{donttest}{notest} -\setinterfacecommand{edgedistance}{distanzabordo} -\setinterfacecommand{edgewidth}{ampiezzabordo} -\setinterfacecommand{emptylines}{emptylines} -\setinterfacecommand{environment}{ambiente} -\setinterfacecommand{externalfigure}{figuraesterna} -\setinterfacecommand{fact}{fatto} -\setinterfacecommand{field}{campi} -\setinterfacecommand{fieldstack}{stackcampi} -\setinterfacecommand{fillinfield}{camporiempimento} -\setinterfacecommand{fillinline}{rigariempimento} -\setinterfacecommand{fillinrules}{lineeriempimento} -\setinterfacecommand{fillintext}{testoriempimento} -\setinterfacecommand{fitfield}{adattacampo} -\setinterfacecommand{fixedspace}{spaziofisso} -\setinterfacecommand{fixedspaces}{spazifissi} -\setinterfacecommand{followprofile}{seguiprofilo} -\setinterfacecommand{followprofileversion}{seguiversioneprofilo} -\setinterfacecommand{followversion}{seguiversione} -\setinterfacecommand{footerdistance}{distanzapdp} -\setinterfacecommand{footerheight}{altezzapdp} -\setinterfacecommand{footnote}{notapdp} -\setinterfacecommand{footnotetext}{testonotapdp} -\setinterfacecommand{forceblocks}{forzablocchi} -\setinterfacecommand{formulanumber}{numeroformula} -\setinterfacecommand{fraction}{frazione} -\setinterfacecommand{framed}{incorniciato} -\setinterfacecommand{from}{da} -\setinterfacecommand{getbuffer}{prendibuffer} -\setinterfacecommand{getmarking}{prendimarcatura} -\setinterfacecommand{getnumber}{getnumber} -\setinterfacecommand{godown}{vaigiu} -\setinterfacecommand{goto}{vaia} -\setinterfacecommand{gotobox}{vaiabox} -\setinterfacecommand{gotopage}{vaiapagina} -\setinterfacecommand{graycolor}{coloregrigio} -\setinterfacecommand{greyvalue}{valoregrigio} -\setinterfacecommand{grid}{griglia} -\setinterfacecommand{hairline}{capello} -\setinterfacecommand{head}{testa} -\setinterfacecommand{headerdistance}{distanzaintestazione} -\setinterfacecommand{headerheight}{altezzaintestazione} -\setinterfacecommand{headlevel}{livellotesta} -\setinterfacecommand{headnumber}{numerotesta} -\setinterfacecommand{headsym}{headsym} -\setinterfacecommand{headtext}{testoinstestazioni} -\setinterfacecommand{hideblocks}{nascondiblocchi} -\setinterfacecommand{high}{ap} -\setinterfacecommand{hl}{hl} -\setinterfacecommand{immediatebetweenlist}{immediatebetweenlist} -\setinterfacecommand{immediatetolist}{immediatetolist} -\setinterfacecommand{in}{in} -\setinterfacecommand{incrementnumber}{incrementanumero} -\setinterfacecommand{indenting}{rientro} -\setinterfacecommand{inframed}{circondato} -\setinterfacecommand{infull}{perlungo} -\setinterfacecommand{ininner}{ininner} -\setinterfacecommand{inleft}{insinistra} -\setinterfacecommand{inleftedge}{inlatosinistro} -\setinterfacecommand{inleftmargin}{inmarginesinistro} -\setinterfacecommand{inline}{inriga} -\setinterfacecommand{inmargin}{inmargine} -\setinterfacecommand{inmframed}{inmaframed} -\setinterfacecommand{inneredgedistance}{inneredgedistance} -\setinterfacecommand{inneredgewidth}{inneredgewidth} -\setinterfacecommand{innermargindistance}{innermargindistance} -\setinterfacecommand{innermarginwidth}{innermarginwidth} -\setinterfacecommand{inothermargin}{inaltromargine} -\setinterfacecommand{inouter}{inouter} -\setinterfacecommand{inright}{indestra} -\setinterfacecommand{inrightedge}{inlatodestro} -\setinterfacecommand{inrightmargin}{inmarginedestro} -\setinterfacecommand{installlanguage}{installalingua} -\setinterfacecommand{interactionbar}{barrainterazione} -\setinterfacecommand{interactionbuttons}{pulsantinterazione} -\setinterfacecommand{interactionmenu}{menuinterattivo} -\setinterfacecommand{item}{elemento} -\setinterfacecommand{items}{elementi} -\setinterfacecommand{its}{el} -\setinterfacecommand{keepblocks}{tieniblocchi} -\setinterfacecommand{label}{etichetta} -\setinterfacecommand{labels}{etichette} -\setinterfacecommand{labeltext}{testoetichetta} -\setinterfacecommand{language}{lingua} -\setinterfacecommand{leftaligned}{allineasinistra} -\setinterfacecommand{leftedgedistance}{distanzabordosinistro} -\setinterfacecommand{leftedgewidth}{ampiezzabordosinistro} -\setinterfacecommand{leftmargindistance}{distanzamarginesinistro} -\setinterfacecommand{leftmarginwidth}{ampiezzamarginesinistro} -\setinterfacecommand{leg}{leg} -\setinterfacecommand{linewidth}{spessoreriga} -\setinterfacecommand{listheight}{altezzaelenco} -\setinterfacecommand{listlength}{lunghezzaelenco} -\setinterfacecommand{listsymbol}{listsymbol} -\setinterfacecommand{listwidth}{ampiezzaelenco} -\setinterfacecommand{logfields}{logcampi} -\setinterfacecommand{lohi}{pedap} -\setinterfacecommand{low}{ped} -\setinterfacecommand{macroname}{nome} -\setinterfacecommand{mainlanguage}{linguaprincipale} -\setinterfacecommand{makeupheight}{altezzamakeup} -\setinterfacecommand{makeupwidth}{ampiezzamakeup} -\setinterfacecommand{mar}{mar} -\setinterfacecommand{margindistance}{distanzamargine} -\setinterfacecommand{marginrule}{lineamargine} -\setinterfacecommand{margintext}{testoinmargine} -\setinterfacecommand{margintitle}{titoloinmargine} -\setinterfacecommand{marginwidth}{ampiezzamargine} -\setinterfacecommand{marginword}{parolainmargine} -\setinterfacecommand{marking}{marcatura} -\setinterfacecommand{markversion}{marcaversione} -\setinterfacecommand{mathematics}{matematica} -\setinterfacecommand{menubutton}{pulsantemenu} -\setinterfacecommand{mframed}{maframed} -\setinterfacecommand{midaligned}{allineacentro} -\setinterfacecommand{mirror}{riflessione} -\setinterfacecommand{month}{mese} -\setinterfacecommand{moveformula}{spostaformula} -\setinterfacecommand{moveongrid}{spostaagriglia} -\setinterfacecommand{movesidefloat}{movesidefloat} -\setinterfacecommand{navigating}{navigating} -\setinterfacecommand{nodimension}{nientedimensioni} -\setinterfacecommand{noheaderandfooterlines}{nientelineintestazionepdp} -\setinterfacecommand{noindenting}{nienterientro} -\setinterfacecommand{nolist}{nienteelenco} -\setinterfacecommand{nomarking}{nientemarcatura} -\setinterfacecommand{nomoreblocks}{bastablocchi} -\setinterfacecommand{nomorefiles}{bastafile} -\setinterfacecommand{nop}{nop} -\setinterfacecommand{nospace}{nientespazio} -\setinterfacecommand{note}{nota} -\setinterfacecommand{notopandbottomlines}{nientelineecimafondo} -\setinterfacecommand{notsmallcapped}{nocap} -\setinterfacecommand{nowhitespace}{nientespaziobianco} -\setinterfacecommand{numberofsubpages}{numberofsubpages} -\setinterfacecommand{numbers}{numeri} -\setinterfacecommand{outeredgedistance}{outeredgedistance} -\setinterfacecommand{outeredgewidth}{outeredgewidth} -\setinterfacecommand{outermargindistance}{outermargindistance} -\setinterfacecommand{outermarginwidth}{outermarginwidth} -\setinterfacecommand{packed}{impaccato} -\setinterfacecommand{page}{pagina} -\setinterfacecommand{pagedepth}{pagedepth} -\setinterfacecommand{pagenumber}{numeropagina} -\setinterfacecommand{pageoffset}{pageoffset} -\setinterfacecommand{pagereference}{riferimentopagina} -\setinterfacecommand{pagetype}{tipopagina} -\setinterfacecommand{paperheight}{altezzacarta} -\setinterfacecommand{paperwidth}{ampiezzacarta} -\setinterfacecommand{periods}{punti} -\setinterfacecommand{plaatsruwelijst}{placerawlist} -\setinterfacecommand{placebookmarks}{mettisegnalibro} -\setinterfacecommand{placecombinedlist}{mettielencocombinato} -\setinterfacecommand{placefloat}{placefloat} -\setinterfacecommand{placefootnotes}{mettinotepdp} -\setinterfacecommand{placeformula}{mettiformula} -\setinterfacecommand{placeheadnumber}{posizionanumerotesta} -\setinterfacecommand{placeheadtext}{posizionatestotesta} -\setinterfacecommand{placelegend}{mettilegenda} -\setinterfacecommand{placelist}{mettielenco} -\setinterfacecommand{placelocalfootnotes}{mettinotepdplocali} -\setinterfacecommand{placelogos}{mettiloghi} -\setinterfacecommand{placeongrid}{mettiingriglia} -\setinterfacecommand{placeontopofeachother}{mettiunosullaltro} -\setinterfacecommand{placepagenumber}{mettinumeropagina} -\setinterfacecommand{placereferencelist}{placereferencelist} -\setinterfacecommand{placeregister}{mettiregistro} -\setinterfacecommand{placerule}{mettilinea} -\setinterfacecommand{placesidebyside}{mettifiancoafianco} -\setinterfacecommand{placesubformula}{mettisottoformula} -\setinterfacecommand{placetextvariable}{mettivariabiletesto} -\setinterfacecommand{position}{posizione} -\setinterfacecommand{positiontext}{posizionatesto} -\setinterfacecommand{printpaperheight}{altezzacartastampa} -\setinterfacecommand{printpaperwidth}{ampiezzacartastampa} -\setinterfacecommand{processblocks}{elaborablocchi} -\setinterfacecommand{processpage}{elaborapagina} -\setinterfacecommand{product}{prodotto} -\setinterfacecommand{program}{programma} -\setinterfacecommand{project}{progetto} -\setinterfacecommand{publication}{pubblicazione} -\setinterfacecommand{quotation}{citazione} -\setinterfacecommand{quote}{menzione} -\setinterfacecommand{ran}{ran} -\setinterfacecommand{redo}{rifai} -\setinterfacecommand{ref}{rif} -\setinterfacecommand{reference}{riferimento} -\setinterfacecommand{referral}{referral} -\setinterfacecommand{referraldate}{datareferral} -\setinterfacecommand{referring}{referring} -\setinterfacecommand{remark}{commento} -\setinterfacecommand{reset}{reimposta} -\setinterfacecommand{resetmarking}{reimpostamarcatura} -\setinterfacecommand{resetnumber}{resetnumber} -\setinterfacecommand{resettext}{resettextcontent} -\setinterfacecommand{rightaligned}{allineadestra} -\setinterfacecommand{rightedgedistance}{distanzabordodestro} -\setinterfacecommand{rightedgewidth}{ampiezzabordodestro} -\setinterfacecommand{rightmargindistance}{distanzamarginedestro} -\setinterfacecommand{rightmarginwidth}{ampiezzamarginedestro} -\setinterfacecommand{romannumerals}{numeriromani} -\setinterfacecommand{rotate}{ruota} -\setinterfacecommand{scale}{scala} -\setinterfacecommand{screen}{schermo} -\setinterfacecommand{selectblocks}{selezionablocchi} -\setinterfacecommand{selectpaper}{selezionacarta} -\setinterfacecommand{selectversion}{selezionaversione} -\setinterfacecommand{setnumber}{setnumber} -\setinterfacecommand{settextcontent}{settext} -\setinterfacecommand{settextvariable}{setvariabiletesto} -\setinterfacecommand{setupalign}{impostaallineamento} -\setinterfacecommand{setupanswerarea}{setupanswerarea} -\setinterfacecommand{setuparranging}{impostaparranging} -\setinterfacecommand{setupbackground}{impostasfondo} -\setinterfacecommand{setupbackgrounds}{impostasfondi} -\setinterfacecommand{setupblackrules}{impostalineenere} -\setinterfacecommand{setupblank}{impostarigovuoto} -\setinterfacecommand{setupblock}{impostablocco} -\setinterfacecommand{setupbodyfont}{impostafontdeltesto} -\setinterfacecommand{setupbodyfontenvironment}{impostaambientefontdeltesto} -\setinterfacecommand{setupbottom}{impostafondo} -\setinterfacecommand{setupbottomtexts}{impostatestifondo} -\setinterfacecommand{setupbuffer}{impostabuffer} -\setinterfacecommand{setupbuttons}{impostapulsanti} -\setinterfacecommand{setupcapitals}{impostamaiuscole} -\setinterfacecommand{setupcaption}{impostacaption} -\setinterfacecommand{setupcaptions}{impostacaptions} -\setinterfacecommand{setupclipping}{impostaclippling} -\setinterfacecommand{setupcolor}{impostacolore} -\setinterfacecommand{setupcolors}{impostacolori} -\setinterfacecommand{setupcolumns}{impostacolonne} -\setinterfacecommand{setupcolumnset}{impostagruppocolonne} -\setinterfacecommand{setupcolumnsetlines}{setupcolumnsetlines} -\setinterfacecommand{setupcolumnsetstart}{setupcolumnsetstart} -\setinterfacecommand{setupcombinations}{impostacombinazioni} -\setinterfacecommand{setupcombinedlist}{impostaelencocombinato} -\setinterfacecommand{setupcomment}{impostacommento} -\setinterfacecommand{setupdescriptions}{impostadescrizioni} -\setinterfacecommand{setupenumerations}{impostaenumerazioni} -\setinterfacecommand{setupexternalfigures}{impostafigureesterne} -\setinterfacecommand{setupfield}{impostacampo} -\setinterfacecommand{setupfields}{impostacampi} -\setinterfacecommand{setupfillinlines}{impostarigheriempimento} -\setinterfacecommand{setupfillinrules}{impostalineeriempimento} -\setinterfacecommand{setupfloat}{impostaoggettomobile} -\setinterfacecommand{setupfloats}{impostaoggettimobili} -\setinterfacecommand{setupfloatsplitting}{impostaspezzamentooggettomobile} -\setinterfacecommand{setupfooter}{impostapdp} -\setinterfacecommand{setupfootertexts}{impostatestipdp} -\setinterfacecommand{setupfootnotedefinition}{impostadefinizionenotepdp} -\setinterfacecommand{setupfootnotes}{impostanotepdp} -\setinterfacecommand{setupforms}{impostaforms} -\setinterfacecommand{setupformulas}{impostaformule} -\setinterfacecommand{setupframed}{impostaincorniciato} -\setinterfacecommand{setupframedtexts}{impostatestiincorniciati} -\setinterfacecommand{setuphead}{impostatesta} -\setinterfacecommand{setupheader}{impostainstestazione} -\setinterfacecommand{setupheadertexts}{impostatestiintestazioni} -\setinterfacecommand{setupheadnumber}{impostanumerotesta} -\setinterfacecommand{setupheads}{impostateste} -\setinterfacecommand{setupheadtext}{impostatestointestazioni} -\setinterfacecommand{setuphyphenmark}{impostasegnosillabazione} -\setinterfacecommand{setupindentations}{impostarientri} -\setinterfacecommand{setupindenting}{impostarientro} -\setinterfacecommand{setupinmargin}{impostainmargine} -\setinterfacecommand{setupinteraction}{impostainterazione} -\setinterfacecommand{setupinteractionbar}{impostabarrainterazione} -\setinterfacecommand{setupinteractionmenu}{impostamenuinterazione} -\setinterfacecommand{setupinteractionscreen}{impostaschermointerazione} -\setinterfacecommand{setupinterlinespace}{impostainterlinea} -\setinterfacecommand{setupitemgroup}{setupitemgroup} -\setinterfacecommand{setupitemgroups}{impostaelencazioni} -\setinterfacecommand{setupitems}{impostaelementi} -\setinterfacecommand{setuplabeltext}{impostatestoetichette} -\setinterfacecommand{setuplanguage}{impostalingua} -\setinterfacecommand{setuplayout}{impostalayout} -\setinterfacecommand{setuplegend}{impostalegenda} -\setinterfacecommand{setuplinenumbering}{impostanumerazionerighe} -\setinterfacecommand{setuplines}{impostarighe} -\setinterfacecommand{setuplinewidth}{impostaampiezzariga} -\setinterfacecommand{setuplist}{impostaelenco} -\setinterfacecommand{setupmakeup}{impostamakeup} -\setinterfacecommand{setupmarginblocks}{impostablocchimargine} -\setinterfacecommand{setupmarginrules}{impostalineemargine} -\setinterfacecommand{setupmarking}{impostamarcatura} -\setinterfacecommand{setupmathalignment}{setupmathalignment} -\setinterfacecommand{setupnarrower}{impostapiustretto} -\setinterfacecommand{setupnumber}{impostanumerazione} -\setinterfacecommand{setupnumbering}{impostanumerazione} -\setinterfacecommand{setupoppositeplacing}{impostaposizionamentoopposti} -\setinterfacecommand{setupoutput}{impostaoutput} -\setinterfacecommand{setuppagecomment}{impostacommentopagina} -\setinterfacecommand{setuppagenumber}{impostanumeropagina} -\setinterfacecommand{setuppagenumbering}{impostanumerazionepagina} -\setinterfacecommand{setuppagetransitions}{impostatransizionepagina} -\setinterfacecommand{setuppalet}{impostatavolozza} -\setinterfacecommand{setuppaper}{setuppaper} -\setinterfacecommand{setuppapersize}{impostadimensionicarta} -\setinterfacecommand{setupparagraphnumbering}{impostanumerazionecapoversi} -\setinterfacecommand{setupparagraphs}{impostacapoversi} -\setinterfacecommand{setupplacement}{setupplacement} -\setinterfacecommand{setuppositioning}{impostaposizionamento} -\setinterfacecommand{setupprofiles}{impostaprofili} -\setinterfacecommand{setupprograms}{impostaprogrammi} -\setinterfacecommand{setuppublications}{impostapubblicazioni} -\setinterfacecommand{setupquote}{impostamenzione} -\setinterfacecommand{setupreferencelist}{impostalistariferimenti} -\setinterfacecommand{setupreferencing}{impostariferimento} -\setinterfacecommand{setupregister}{impostaregistro} -\setinterfacecommand{setuprotate}{impostarotazione} -\setinterfacecommand{setuprule}{impostalinea} -\setinterfacecommand{setups}{impostazioni} -\setinterfacecommand{setupscreens}{impostaschermi} -\setinterfacecommand{setupsection}{impostasezione} -\setinterfacecommand{setupsectionblock}{impostabloccosezione} -\setinterfacecommand{setupsorting}{impostaordinamento} -\setinterfacecommand{setupspacing}{impostaspaziatura} -\setinterfacecommand{setupstartstop}{impostainiziatermina} -\setinterfacecommand{setupstrut}{impostastrut} -\setinterfacecommand{setupsubpagenumber}{impostanumerosottopagina} -\setinterfacecommand{setupsymbolset}{impostasetsimboli} -\setinterfacecommand{setupsynchronization}{impostasincronizzazione} -\setinterfacecommand{setupsynchronizationbar}{impostabarrasincronizzazione} -\setinterfacecommand{setupsynonyms}{impostasinonimi} -\setinterfacecommand{setupsystem}{impostasistema} -\setinterfacecommand{setuptab}{impostatab} -\setinterfacecommand{setuptables}{impostatabelle} -\setinterfacecommand{setuptabulate}{impostatabulato} -\setinterfacecommand{setuptext}{impostatesto} -\setinterfacecommand{setuptextposition}{impostaposizionetesto} -\setinterfacecommand{setuptextrules}{impostalineetesto} -\setinterfacecommand{setuptexttexts}{impostatestotesti} -\setinterfacecommand{setuptextvariable}{impostavariabiletesto} -\setinterfacecommand{setupthinrules}{impostalineesottili} -\setinterfacecommand{setuptolerance}{impostatolleranza} -\setinterfacecommand{setuptop}{impostacima} -\setinterfacecommand{setuptoptexts}{impostatesticima} -\setinterfacecommand{setuptype}{impostatype} -\setinterfacecommand{setuptyping}{impostatyping} -\setinterfacecommand{setupunderbar}{impostasottolinea} -\setinterfacecommand{setupurl}{impostaurl} -\setinterfacecommand{setupversions}{impostaversioni} -\setinterfacecommand{setupwhitespace}{impostaspaziobianco} -\setinterfacecommand{showbodyfont}{mostrafontdeltesto} -\setinterfacecommand{showbodyfontenvironment}{mostraambientefontdeltesto} -\setinterfacecommand{showcolor}{mostracolore} -\setinterfacecommand{showcolorgroup}{mostragruppocolori} -\setinterfacecommand{showexternalfigures}{mostrafiguresterne} -\setinterfacecommand{showfields}{mostracampi} -\setinterfacecommand{showframe}{mostracornice} -\setinterfacecommand{showgrid}{mostragriglia} -\setinterfacecommand{showlayout}{mostralyout} -\setinterfacecommand{showmakeup}{mostramakeup} -\setinterfacecommand{showpalet}{mostratavolozza} -\setinterfacecommand{showprint}{mostrastampa} -\setinterfacecommand{showsetups}{mostraimpostazioni} -\setinterfacecommand{showstruts}{mostrastruts} -\setinterfacecommand{showsymbolset}{mostrasetsimboli} -\setinterfacecommand{smallcapped}{cap} -\setinterfacecommand{someline}{qualcheriga} -\setinterfacecommand{somewhere}{daqualcheparte} -\setinterfacecommand{space}{spazio} -\setinterfacecommand{splitfloat}{spezzaoggettomobile} -\setinterfacecommand{startalignment}{iniziaallineamento} -\setinterfacecommand{startbackground}{iniziasfondo} -\setinterfacecommand{startcoding}{iniziacodifica} -\setinterfacecommand{startcolor}{iniziacolore} -\setinterfacecommand{startcolumnmakeup}{startcolumnmakeup} -\setinterfacecommand{startcolumns}{iniziacolonne} -\setinterfacecommand{startcolumnset}{iniziagruppocolonne} -\setinterfacecommand{startcombination}{iniziacombinazione} -\setinterfacecommand{startcomponent}{iniziacomponente} -\setinterfacecommand{startdocument}{iniziadocumento} -\setinterfacecommand{startenvironment}{iniziaambiente} -\setinterfacecommand{startfigure}{iniziafigura} -\setinterfacecommand{startglobal}{iniziaglobale} -\setinterfacecommand{startline}{iniziariga} -\setinterfacecommand{startlinecorrection}{iniziacorrezioneriga} -\setinterfacecommand{startlinenumbering}{inizianumerazionerighe} -\setinterfacecommand{startlines}{iniziarighe} -\setinterfacecommand{startlocal}{inizialocale} -\setinterfacecommand{startlocalfootnotes}{inizianotepdplocali} -\setinterfacecommand{startmakeup}{iniziamakeup} -\setinterfacecommand{startmarginblock}{iniziabloccomargine} -\setinterfacecommand{startmarginrule}{inizialineamargine} -\setinterfacecommand{startnarrower}{iniziapiustretto} -\setinterfacecommand{startopposite}{iniziaopposto} -\setinterfacecommand{startoverlay}{iniziasovrapposizione} -\setinterfacecommand{startoverzicht}{iniziaoverview} -\setinterfacecommand{startpacked}{iniziaimpaccato} -\setinterfacecommand{startpositioning}{iniziaposizionamento} -\setinterfacecommand{startproduct}{iniziaprodotto} -\setinterfacecommand{startprofile}{iniziaprofilo} -\setinterfacecommand{startproject}{iniziaprogetto} -\setinterfacecommand{startquotation}{iniziacitazione} -\setinterfacecommand{startraster}{iniziaraster} -\setinterfacecommand{startsymbolset}{iniziasetsimboli} -\setinterfacecommand{startsynchronization}{iniziasincronizzazione} -\setinterfacecommand{starttable}{iniziatabella} -\setinterfacecommand{starttables}{iniziatabelle} -\setinterfacecommand{starttext}{iniziatesto} -\setinterfacecommand{starttextrule}{inizialineatesto} -\setinterfacecommand{startunpacked}{iniziaunpacked} -\setinterfacecommand{startversion}{iniziaversione} -\setinterfacecommand{stopalignment}{terminaallineamento} -\setinterfacecommand{stopbackground}{terminasfondo} -\setinterfacecommand{stopcoding}{terminacodifica} -\setinterfacecommand{stopcolor}{terminacolore} -\setinterfacecommand{stopcolumnmakeup}{stopcolumnmakeup} -\setinterfacecommand{stopcolumns}{terminacolonne} -\setinterfacecommand{stopcolumnset}{terminagruppocolonne} -\setinterfacecommand{stopcombination}{terminacombinazione} -\setinterfacecommand{stopcomponent}{terminacomponente} -\setinterfacecommand{stopdocument}{terminadocumento} -\setinterfacecommand{stopenvironment}{terminaambiente} -\setinterfacecommand{stopglobal}{terminaglobale} -\setinterfacecommand{stopline}{terminariga} -\setinterfacecommand{stoplinecorrection}{terminacorrezioneriga} -\setinterfacecommand{stoplinenumbering}{terminanumerazionerighe} -\setinterfacecommand{stoplines}{terminarighe} -\setinterfacecommand{stoplocal}{terminalocale} -\setinterfacecommand{stoplocalfootnotes}{terminanotepdplocali} -\setinterfacecommand{stopmakeup}{terminamakeup} -\setinterfacecommand{stopmarginblock}{terminabloccomargine} -\setinterfacecommand{stopmarginrule}{terminalineamargine} -\setinterfacecommand{stopnarrower}{terminapiustretto} -\setinterfacecommand{stopopposite}{terminaopposto} -\setinterfacecommand{stopoverlay}{terminasovrapposizione} -\setinterfacecommand{stopoverzicht}{terminaoverview} -\setinterfacecommand{stoppacked}{terminaimpaccato} -\setinterfacecommand{stoppositioning}{terminaposizionamento} -\setinterfacecommand{stopproduct}{terminaprodotto} -\setinterfacecommand{stopprofile}{terminaprofili} -\setinterfacecommand{stopproject}{terminaprogetto} -\setinterfacecommand{stopquotation}{terminacitazione} -\setinterfacecommand{stopraster}{terminaraster} -\setinterfacecommand{stopsynchronization}{terminasincronizzazione} -\setinterfacecommand{stoptable}{terminatabella} -\setinterfacecommand{stoptables}{terminatabelle} -\setinterfacecommand{stoptext}{terminatesto} -\setinterfacecommand{stoptextrule}{terminalineatesto} -\setinterfacecommand{stopunpacked}{terminaunpacked} -\setinterfacecommand{stopversion}{terminaversioni} -\setinterfacecommand{stretched}{stirato} -\setinterfacecommand{subformulanumber}{numerosottoformula} -\setinterfacecommand{subpagenumber}{subpagenumber} -\setinterfacecommand{switchtobodyfont}{cambiaafontdeltesto} -\setinterfacecommand{switchtorawfont}{passaafontgrezzo} -\setinterfacecommand{sym}{sim} -\setinterfacecommand{symbol}{simbolo} -\setinterfacecommand{synchronizationbar}{barrasincronizzazione} -\setinterfacecommand{synchronize}{sincronizza} -\setinterfacecommand{tab}{tab} -\setinterfacecommand{testcolumn}{testcolumn} -\setinterfacecommand{testpage}{testpage} -\setinterfacecommand{tex}{tex} -\setinterfacecommand{textheight}{altezzatesto} -\setinterfacecommand{textreference}{riferimentotesto} -\setinterfacecommand{textrule}{lineatesto} -\setinterfacecommand{textvariable}{variabiletesto} -\setinterfacecommand{textwidth}{ampiezzatesto} -\setinterfacecommand{thinrule}{lineasottile} -\setinterfacecommand{thinrules}{lineesottili} -\setinterfacecommand{tooltip}{tooltip} -\setinterfacecommand{topdistance}{distanzacima} -\setinterfacecommand{topheight}{altezzacima} -\setinterfacecommand{topspace}{spaziocima} -\setinterfacecommand{totalnumberofpages}{numerototaledipagine} -\setinterfacecommand{translate}{traduci} -\setinterfacecommand{txt}{txt} -\setinterfacecommand{typ}{typ} -\setinterfacecommand{type}{type} -\setinterfacecommand{typebuffer}{typebuffer} -\setinterfacecommand{typefile}{typefile} -\setinterfacecommand{unitmeaning}{nomeunita} -\setinterfacecommand{unknown}{ignoto} -\setinterfacecommand{useJSscripts}{usaJSscripts} -\setinterfacecommand{useURL}{usaURL} -\setinterfacecommand{useXMLfilter}{useXMLfilter} -\setinterfacecommand{useblocks}{usablocco} -\setinterfacecommand{usecommands}{usacomandi} -\setinterfacecommand{useencoding}{usacodifica} -\setinterfacecommand{useexternaldocument}{usadocumentoesterno} -\setinterfacecommand{useexternalfigure}{usafiguraesterna} -\setinterfacecommand{useexternalfile}{usafileesterno} -\setinterfacecommand{useexternalfiles}{usafileesterni} -\setinterfacecommand{useexternalsoundtrack}{usacolonnasonoraesterna} -\setinterfacecommand{usemodule}{usamodulo} -\setinterfacecommand{usemodules}{usamoduli} -\setinterfacecommand{usepath}{usacartella} -\setinterfacecommand{usereferences}{usariferimenti} -\setinterfacecommand{usespecials}{usaspecialita} -\setinterfacecommand{usesymbols}{usasimboli} -\setinterfacecommand{usetypescript}{usetypescript} -\setinterfacecommand{usetypescriptfile}{usetypescriptfile} -\setinterfacecommand{useurl}{usaurl} -\setinterfacecommand{version}{versione} -\setinterfacecommand{vl}{vl} -\setinterfacecommand{weekday}{giornosettimana} -\setinterfacecommand{whitespace}{spaziobianco} -\setinterfacecommand{wordright}{paroladestra} -\setinterfacecommand{writebetweenlist}{scrividentroelenco} -\setinterfacecommand{writetolist}{scriviinelenco} -\setinterfacecommand{writetoreferencelist}{scriviinlistariferimenti} -\setinterfacecommand{writetoregister}{scriviinregistro} -% -\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-mcs.mkii b/Master/texmf-dist/tex/context/base/mult-mcs.mkii new file mode 100644 index 00000000000..c733798e642 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-mcs.mkii @@ -0,0 +1,210 @@ +\setinterfacemessage{references}{1}{neznama reference --} +\setinterfacemessage{references}{30}{neznamy objekt --} +\setinterfacemessage{references}{3}{neznamy typ reference --} +\setinterfacemessage{references}{2}{duplicitni reference -- na strane --} +\setinterfacemessage{references}{5}{number of unknown references: --} +\setinterfacemessage{references}{4}{nedovolena reference --} +\setinterfacemessage{references}{6}{number of illegal references: --} +\setinterfacemessage{references}{25}{references from document '--' are not imported (export again)} +\setinterfacemessage{references}{24}{references from document '--' are not exported} +\setinterfacemessage{references}{title}{reference} +\setinterfacemessage{references}{26}{references from document '--' are imported} +\setinterfacemessage{references}{31}{duplicitni object --} +\setinterfacemessage{references}{21}{dokument -- nacten} +\setinterfacemessage{references}{22}{dokument -- neni interaktivni} +\setinterfacemessage{references}{23}{obskurni (nejasna) reference -- (prefix=--)} +\setinterfacemessage{documents}{1}{sheet --} +\setinterfacemessage{documents}{title}{sheets} +\setinterfacemessage{documents}{2}{number --} +\setinterfacemessage{handlings}{1}{font handling --} +\setinterfacemessage{handlings}{3}{unknown font handling --} +\setinterfacemessage{handlings}{2}{font handling -- is loaded} +\setinterfacemessage{handlings}{title}{handling} +\setinterfacemessage{systems}{title}{system} +\setinterfacemessage{systems}{41}{externi soubor -- ve skupine -- neexistuje} +\setinterfacemessage{systems}{9}{-- nenalezeno/nezpracovano} +\setinterfacemessage{systems}{91}{papertray --} +\setinterfacemessage{systems}{8}{nova verze pomocneho souboru, je treba druheho behu} +\setinterfacemessage{systems}{21}{pomocny soubor necten} +\setinterfacemessage{systems}{20}{vyznam (trideni) -- nacten} +\setinterfacemessage{systems}{5}{makra z -- nactena} +\setinterfacemessage{systems}{4}{prikaz -- je jiz definovan} +\setinterfacemessage{systems}{27}{verze} +\setinterfacemessage{systems}{26}{registry} +\setinterfacemessage{systems}{25}{reference} +\setinterfacemessage{systems}{24}{plovouci bloky} +\setinterfacemessage{systems}{1}{nacteni pomocneho souboru odlozeno (typemode)} +\setinterfacemessage{systems}{23}{-- upraveno na --} +\setinterfacemessage{systems}{22}{pouzijte platny pomocny soubor} +\setinterfacemessage{systems}{2}{-- nacteno} +\setinterfacemessage{systems}{19}{vyznam (synonyma) -- nacten} +\setinterfacemessage{systems}{18}{synonymum -- -- neexistuje} +\setinterfacemessage{systems}{7}{makra z -- jsou jiz nactena} +\setinterfacemessage{systems}{6}{zadna makra v -- nenalezena} +\setinterfacemessage{systems}{14}{vynucena nova stranka v seznamu na --} +\setinterfacemessage{systems}{15}{uklada se buffer --} +\setinterfacemessage{systems}{16}{sazi se buffer --} +\setinterfacemessage{systems}{17}{sazi se doslovny (verbatim) buffer --} +\setinterfacemessage{systems}{13}{znacka -- definovana --} +\setinterfacemessage{systems}{12}{pomosny soubor neni setriden, pouzijte texutil} +\setinterfacemessage{systems}{11}{vytvarim jednoduchy pomocny soubor} +\setinterfacemessage{systems}{10}{nepouzivejte em v --} +\setinterfacemessage{floatblocks}{1}{-- precislovano / -- => --} +\setinterfacemessage{floatblocks}{3}{-- presunuto} +\setinterfacemessage{floatblocks}{2}{-- ulozeno} +\setinterfacemessage{floatblocks}{5}{poradi prizpusobeno} +\setinterfacemessage{floatblocks}{4}{-- umisteno} +\setinterfacemessage{floatblocks}{7}{pocet spodnich plovoucich objektu je omezen na --} +\setinterfacemessage{floatblocks}{6}{pocet hornich plovoucich objektu je omezen na --} +\setinterfacemessage{floatblocks}{9}{poradi naruseno} +\setinterfacemessage{floatblocks}{8}{radku je mene nez --} +\setinterfacemessage{floatblocks}{title}{plovouciobjekty} +\setinterfacemessage{floatblocks}{13}{there is nothing to split} +\setinterfacemessage{floatblocks}{12}{nedefinovano} +\setinterfacemessage{floatblocks}{11}{nedan zadny blok} +\setinterfacemessage{floatblocks}{10}{-- omezeno} +\setinterfacemessage{interactions}{1}{pomer -- x -- (s x v)} +\setinterfacemessage{interactions}{3}{neaktivni} +\setinterfacemessage{interactions}{2}{aktivni} +\setinterfacemessage{interactions}{5}{unknown attachment --} +\setinterfacemessage{interactions}{4}{zadna strankova synchronizace (--) v hmode} +\setinterfacemessage{interactions}{6}{attachment file -- does not exist} +\setinterfacemessage{interactions}{title}{interakce} +\setinterfacemessage{interactions}{21}{-- kod vlozen} +\setinterfacemessage{regimes}{1}{kodovani --} +\setinterfacemessage{regimes}{3}{nezname kodovani --} +\setinterfacemessage{regimes}{2}{je nacteno kodovani --} +\setinterfacemessage{regimes}{title}{kodovani} +\setinterfacemessage{structures}{1}{zacatek oddilu (sekce) --} +\setinterfacemessage{structures}{title}{struktury} +\setinterfacemessage{structures}{2}{konec oddilu (sekce) --} +\setinterfacemessage{linguals}{1}{vzory -- pro -- nacteny (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{3}{deleni slov -- pro -- nacteno (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{2}{zadne vzory -- pro -- (n=--,e=--,m=--) (--,--)} +\setinterfacemessage{linguals}{5}{vzory pro -- nenacteny} +\setinterfacemessage{linguals}{4}{zadne deleni slov -- pro -- (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{7}{specificke volby jazyka [--] zavadeji -- (zavlecenou) mezeru} +\setinterfacemessage{linguals}{6}{jazyk -- neni definovan} +\setinterfacemessage{linguals}{9}{language -- is active} +\setinterfacemessage{linguals}{8}{specificke volby jazyka [--] bez mezer pripojeny} +\setinterfacemessage{linguals}{title}{jazyky} +\setinterfacemessage{linguals}{10}{vzory -- nacteny} +\setinterfacemessage{verbatims}{1}{soubor -- neexistuje} +\setinterfacemessage{verbatims}{title}{verbatim} +\setinterfacemessage{filters}{1}{filter -- is loaded} +\setinterfacemessage{filters}{title}{filter} +\setinterfacemessage{filters}{2}{unknown filter --} +\setinterfacemessage{textblocks}{1}{nova verze, je treba druhy beh} +\setinterfacemessage{textblocks}{3}{ctu bloky z --} +\setinterfacemessage{textblocks}{2}{zapisuji bloky do --} +\setinterfacemessage{textblocks}{5}{-- neni skryto} +\setinterfacemessage{textblocks}{4}{je treba druhy beh} +\setinterfacemessage{textblocks}{7}{-- skryto} +\setinterfacemessage{textblocks}{6}{-- skryto a zpracovano} +\setinterfacemessage{textblocks}{9}{-- nevysazeno} +\setinterfacemessage{textblocks}{8}{-- vysazeno} +\setinterfacemessage{textblocks}{title}{textovyblok} +\setinterfacemessage{textblocks}{12}{-- preskoceno} +\setinterfacemessage{textblocks}{11}{-- nacteno a vysazeno} +\setinterfacemessage{textblocks}{10}{-- nacteno a zpracovano} +\setinterfacemessage{encodings}{1}{kodovani --} +\setinterfacemessage{encodings}{3}{nezname kodovani --} +\setinterfacemessage{encodings}{2}{je nacteno kodovani --} +\setinterfacemessage{encodings}{title}{kodovani} +\setinterfacemessage{columns}{1}{je mozno pouze -- sloupcu} +\setinterfacemessage{columns}{3}{problem, vypina se vyvazovani} +\setinterfacemessage{columns}{2}{pouzijte \string\filbreak\space jako alternativu} +\setinterfacemessage{columns}{5}{spodni plovouci objekt jeste neni podporovan} +\setinterfacemessage{columns}{4}{horni plovouci objekt jeste neni podporovan} +\setinterfacemessage{columns}{7}{vyvazovani ukonceno po 100 krocich} +\setinterfacemessage{columns}{6}{-- plovouci objekt(y) odlozeny} +\setinterfacemessage{columns}{9}{kontrola nerovnost} +\setinterfacemessage{columns}{8}{vyvazeno v -- krocich} +\setinterfacemessage{columns}{title}{sloupce} +\setinterfacemessage{columns}{13}{siroky plovouci objekt je presunut nad sloupce} +\setinterfacemessage{columns}{12}{plovouci objekt je presunut do nasledujiciho sloupce / --} +\setinterfacemessage{columns}{11}{plovouci objekt je pro sloupec prilis siroky} +\setinterfacemessage{columns}{10}{zbyl (mene nez) 1 radek} +\setinterfacemessage{symbols}{1}{nacita se soubor symbolu --} +\setinterfacemessage{symbols}{title}{symboly} +\setinterfacemessage{files}{1}{synonymum souboru -- je jiz pouzito pro --} +\setinterfacemessage{files}{title}{soubory} +\setinterfacemessage{versions}{1}{postradam @+} +\setinterfacemessage{versions}{3}{oznacene strany: --} +\setinterfacemessage{versions}{2}{oznacuji se strany} +\setinterfacemessage{versions}{title}{verze} +\setinterfacemessage{specials}{1}{-- nacteno} +\setinterfacemessage{specials}{3}{-- je resetovano} +\setinterfacemessage{specials}{2}{neni dovoleno hlubsi zanoreni --} +\setinterfacemessage{specials}{5}{nacita se definicni soubor --} +\setinterfacemessage{specials}{4}{prikaz -- neexistuje} +\setinterfacemessage{specials}{7}{neznamy ovladac (driver) --} +\setinterfacemessage{specials}{6}{zanoreni neni dovoleno} +\setinterfacemessage{specials}{title}{speciality} +\setinterfacemessage{layouts}{1}{vyska textu prizpusobena s -- na strane --} +\setinterfacemessage{layouts}{3}{-- krat text odlozen} +\setinterfacemessage{layouts}{2}{-- krat odlozeny text umisten} +\setinterfacemessage{layouts}{5}{okrajove bloky neaktivni} +\setinterfacemessage{layouts}{4}{okrajove bloky aktivni} +\setinterfacemessage{layouts}{7}{pocita se misto pro logo} +\setinterfacemessage{layouts}{6}{sada stran -- zpracovana (velikost --)} +\setinterfacemessage{layouts}{9}{aktualne ne vice nez -- urovne/urovni vyctu} +\setinterfacemessage{layouts}{8}{pocita se pozadi} +\setinterfacemessage{layouts}{title}{layout} +\setinterfacemessage{layouts}{11}{svisla mezera -- neni povolena v pevnem radkovem rejstriku} +\setinterfacemessage{layouts}{10}{-- a -- nedava dohromady 1.0} +\setinterfacemessage{fonts}{1}{kodovani --} +\setinterfacemessage{fonts}{3}{neznama varianta --} +\setinterfacemessage{fonts}{2}{varianta -- je nactena} +\setinterfacemessage{fonts}{5}{styl -- neni definovan} +\setinterfacemessage{fonts}{4}{zakladni font -- neni definovan} +\setinterfacemessage{fonts}{7}{neznamy format --} +\setinterfacemessage{fonts}{6}{-- je nacten} +\setinterfacemessage{fonts}{14}{bodyfont -- is defined (can better be done global)} +\setinterfacemessage{fonts}{8}{styl -- definovan} +\setinterfacemessage{fonts}{title}{zakladnifont} +\setinterfacemessage{fonts}{10}{neznamy font --} +\setinterfacemessage{databases}{1}{--} +\setinterfacemessage{databases}{3}{global file --} +\setinterfacemessage{databases}{2}{local file --} +\setinterfacemessage{databases}{4}{unknown file --} +\setinterfacemessage{databases}{title}{databases} +\setinterfacemessage{publications}{1}{file -- not found, unknown style ignored} +\setinterfacemessage{publications}{3}{wrote a new auxiliary file \jobname.aux} +\setinterfacemessage{publications}{title}{publications} +\setinterfacemessage{publications}{2}{file -- not found, waiting for bibtex} +\setinterfacemessage{publications}{4}{loading database from --} +\setinterfacemessage{publications}{5}{warning: cite argument -- on line \the\inputlineno} +\setinterfacemessage{publications}{6}{loading formatting style from --} +\setinterfacemessage{javascript}{1}{nacita se soubor skriptu --} +\setinterfacemessage{javascript}{title}{javascript} +\setinterfacemessage{javascript}{2}{neznama preambule --} +\setinterfacemessage{check}{1}{postradam '=' po '--' na radku --} +\setinterfacemessage{check}{3}{-- -- nahrazuje makro, uzijte VERZALKY!} +\setinterfacemessage{check}{2}{ocekavam -- argument(y) na radku --} +\setinterfacemessage{check}{title}{kontrola} +\setinterfacemessage{metapost}{1}{loading metapost library --} +\setinterfacemessage{metapost}{title}{metapost} +\setinterfacemessage{figures}{1}{obraz -- nelze nalezt} +\setinterfacemessage{figures}{3}{dimensions of -- are determined externally} +\setinterfacemessage{figures}{2}{obraz -- nepritomen} +\setinterfacemessage{figures}{5}{dimensions of -- are unknown} +\setinterfacemessage{figures}{4}{dimenze obrazu -- nacteny primo z jeho souboru} +\setinterfacemessage{figures}{6}{dimenze obrazu -- spocteny programem rlxtools} +\setinterfacemessage{figures}{8}{obrazovy objekt -- je znovu pouzit} +\setinterfacemessage{figures}{title}{obrazy} +\setinterfacemessage{colors}{1}{system -- je globalne aktivovana} +\setinterfacemessage{colors}{3}{-- neni definovana --} +\setinterfacemessage{colors}{2}{system -- je lokalne activovana} +\setinterfacemessage{colors}{5}{neznamy system --} +\setinterfacemessage{colors}{4}{system -- je nacten} +\setinterfacemessage{colors}{7}{palette -- neni k dispozici} +\setinterfacemessage{colors}{6}{palette -- je k dispozici} +\setinterfacemessage{colors}{9}{-- prostor barev neni podporovan} +\setinterfacemessage{colors}{8}{specifikace -- v barve -- bude cerna} +\setinterfacemessage{colors}{title}{barva} +\setinterfacemessage{colors}{12}{-- is registered} +\setinterfacemessage{colors}{11}{barva je prevedena na sed} +\setinterfacemessage{colors}{10}{-- prostor barev je podporovan} +% +\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-mcs.tex b/Master/texmf-dist/tex/context/base/mult-mcs.tex deleted file mode 100644 index 98c392c9fc9..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-mcs.tex +++ /dev/null @@ -1,208 +0,0 @@ -\setinterfacemessage{references}{1}{neznama reference --} -\setinterfacemessage{references}{3}{neznamy typ reference --} -\setinterfacemessage{references}{2}{duplicitni reference -- na strane --} -\setinterfacemessage{references}{4}{nedovolena reference --} -\setinterfacemessage{references}{30}{neznamy objekt --} -\setinterfacemessage{references}{25}{references from document '--' are not imported (export again)} -\setinterfacemessage{references}{24}{references from document '--' are not exported} -\setinterfacemessage{references}{title}{reference} -\setinterfacemessage{references}{26}{references from document '--' are imported} -\setinterfacemessage{references}{31}{duplicitni object --} -\setinterfacemessage{references}{21}{dokument -- nacten} -\setinterfacemessage{references}{22}{dokument -- neni interaktivni} -\setinterfacemessage{references}{23}{obskurni (nejasna) reference -- (prefix=--)} -\setinterfacemessage{documents}{1}{sheet --} -\setinterfacemessage{documents}{title}{sheets} -\setinterfacemessage{documents}{2}{number --} -\setinterfacemessage{handlings}{1}{font handling --} -\setinterfacemessage{handlings}{3}{unknown font handling --} -\setinterfacemessage{handlings}{2}{font handling -- is loaded} -\setinterfacemessage{handlings}{title}{handling} -\setinterfacemessage{systems}{title}{system} -\setinterfacemessage{systems}{41}{externi soubor -- ve skupine -- neexistuje} -\setinterfacemessage{systems}{9}{-- nenalezeno/nezpracovano} -\setinterfacemessage{systems}{91}{papertray --} -\setinterfacemessage{systems}{8}{nova verze pomocneho souboru, je treba druheho behu} -\setinterfacemessage{systems}{21}{pomocny soubor necten} -\setinterfacemessage{systems}{20}{vyznam (trideni) -- nacten} -\setinterfacemessage{systems}{5}{makra z -- nactena} -\setinterfacemessage{systems}{4}{prikaz -- je jiz definovan} -\setinterfacemessage{systems}{27}{verze} -\setinterfacemessage{systems}{26}{registry} -\setinterfacemessage{systems}{25}{reference} -\setinterfacemessage{systems}{24}{plovouci bloky} -\setinterfacemessage{systems}{1}{nacteni pomocneho souboru odlozeno (typemode)} -\setinterfacemessage{systems}{23}{-- upraveno na --} -\setinterfacemessage{systems}{22}{pouzijte platny pomocny soubor} -\setinterfacemessage{systems}{2}{-- nacteno} -\setinterfacemessage{systems}{19}{vyznam (synonyma) -- nacten} -\setinterfacemessage{systems}{18}{synonymum -- -- neexistuje} -\setinterfacemessage{systems}{7}{makra z -- jsou jiz nactena} -\setinterfacemessage{systems}{6}{zadna makra v -- nenalezena} -\setinterfacemessage{systems}{14}{vynucena nova stranka v seznamu na --} -\setinterfacemessage{systems}{15}{uklada se buffer --} -\setinterfacemessage{systems}{16}{sazi se buffer --} -\setinterfacemessage{systems}{17}{sazi se doslovny (verbatim) buffer --} -\setinterfacemessage{systems}{13}{znacka -- definovana --} -\setinterfacemessage{systems}{12}{pomosny soubor neni setriden, pouzijte texutil} -\setinterfacemessage{systems}{11}{vytvarim jednoduchy pomocny soubor} -\setinterfacemessage{systems}{10}{nepouzivejte em v --} -\setinterfacemessage{floatblocks}{1}{-- precislovano / -- => --} -\setinterfacemessage{floatblocks}{3}{-- presunuto} -\setinterfacemessage{floatblocks}{2}{-- ulozeno} -\setinterfacemessage{floatblocks}{5}{poradi prizpusobeno} -\setinterfacemessage{floatblocks}{4}{-- umisteno} -\setinterfacemessage{floatblocks}{7}{pocet spodnich plovoucich objektu je omezen na --} -\setinterfacemessage{floatblocks}{6}{pocet hornich plovoucich objektu je omezen na --} -\setinterfacemessage{floatblocks}{9}{poradi naruseno} -\setinterfacemessage{floatblocks}{8}{radku je mene nez --} -\setinterfacemessage{floatblocks}{title}{plovouciobjekty} -\setinterfacemessage{floatblocks}{13}{there is nothing to split} -\setinterfacemessage{floatblocks}{12}{nedefinovano} -\setinterfacemessage{floatblocks}{11}{nedan zadny blok} -\setinterfacemessage{floatblocks}{10}{-- omezeno} -\setinterfacemessage{interactions}{1}{pomer -- x -- (s x v)} -\setinterfacemessage{interactions}{3}{neaktivni} -\setinterfacemessage{interactions}{2}{aktivni} -\setinterfacemessage{interactions}{5}{unknown attachment --} -\setinterfacemessage{interactions}{4}{zadna strankova synchronizace (--) v hmode} -\setinterfacemessage{interactions}{6}{attachment file -- does not exist} -\setinterfacemessage{interactions}{title}{interakce} -\setinterfacemessage{interactions}{21}{-- kod vlozen} -\setinterfacemessage{regimes}{1}{kodovani --} -\setinterfacemessage{regimes}{3}{nezname kodovani --} -\setinterfacemessage{regimes}{2}{je nacteno kodovani --} -\setinterfacemessage{regimes}{title}{kodovani} -\setinterfacemessage{structures}{1}{zacatek oddilu (sekce) --} -\setinterfacemessage{structures}{title}{struktury} -\setinterfacemessage{structures}{2}{konec oddilu (sekce) --} -\setinterfacemessage{linguals}{1}{vzory -- pro -- nacteny (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{3}{deleni slov -- pro -- nacteno (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{2}{zadne vzory -- pro -- (n=--,e=--,m=--) (--,--)} -\setinterfacemessage{linguals}{5}{vzory pro -- nenacteny} -\setinterfacemessage{linguals}{4}{zadne deleni slov -- pro -- (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{7}{specificke volby jazyka [--] zavadeji -- (zavlecenou) mezeru} -\setinterfacemessage{linguals}{6}{jazyk -- neni definovan} -\setinterfacemessage{linguals}{9}{language -- is active} -\setinterfacemessage{linguals}{8}{specificke volby jazyka [--] bez mezer pripojeny} -\setinterfacemessage{linguals}{title}{jazyky} -\setinterfacemessage{linguals}{10}{vzory --nacteny} -\setinterfacemessage{verbatims}{1}{soubor -- neexistuje} -\setinterfacemessage{verbatims}{title}{verbatim} -\setinterfacemessage{filters}{1}{filter -- is loaded} -\setinterfacemessage{filters}{title}{filter} -\setinterfacemessage{filters}{2}{unknown filter --} -\setinterfacemessage{textblocks}{1}{nova verze, je treba druhy beh} -\setinterfacemessage{textblocks}{3}{ctu bloky z --} -\setinterfacemessage{textblocks}{2}{zapisuji bloky do --} -\setinterfacemessage{textblocks}{5}{-- neni skryto} -\setinterfacemessage{textblocks}{4}{je treba druhy beh} -\setinterfacemessage{textblocks}{7}{-- skryto} -\setinterfacemessage{textblocks}{6}{-- skryto a zpracovano} -\setinterfacemessage{textblocks}{9}{-- nevysazeno} -\setinterfacemessage{textblocks}{8}{-- vysazeno} -\setinterfacemessage{textblocks}{title}{textovyblok} -\setinterfacemessage{textblocks}{12}{-- preskoceno} -\setinterfacemessage{textblocks}{11}{-- nacteno a vysazeno} -\setinterfacemessage{textblocks}{10}{-- nacteno a zpracovano} -\setinterfacemessage{encodings}{1}{kodovani --} -\setinterfacemessage{encodings}{3}{nezname kodovani --} -\setinterfacemessage{encodings}{2}{je nacteno kodovani --} -\setinterfacemessage{encodings}{title}{kodovani} -\setinterfacemessage{columns}{1}{je mozno pouze -- sloupcu} -\setinterfacemessage{columns}{3}{problem, vypina se vyvazovani} -\setinterfacemessage{columns}{2}{pouzijte \string\filbreak\space jako alternativu} -\setinterfacemessage{columns}{5}{spodni plovouci objekt jeste neni podporovan} -\setinterfacemessage{columns}{4}{horni plovouci objekt jeste neni podporovan} -\setinterfacemessage{columns}{7}{vyvazovani ukonceno po 100 krocich} -\setinterfacemessage{columns}{6}{-- plovouci objekt(y) odlozeny} -\setinterfacemessage{columns}{9}{kontrola nerovnost} -\setinterfacemessage{columns}{8}{vyvazeno v -- krocich} -\setinterfacemessage{columns}{title}{sloupce} -\setinterfacemessage{columns}{13}{siroky plovouci objekt je presunut nad sloupce} -\setinterfacemessage{columns}{12}{plovouci objekt je presunut do nasledujiciho sloupce / --} -\setinterfacemessage{columns}{11}{plovouci objekt je pro sloupec prilis siroky} -\setinterfacemessage{columns}{10}{zbyl (mene nez) 1 radek} -\setinterfacemessage{symbols}{1}{nacita se soubor symbolu --} -\setinterfacemessage{symbols}{title}{symboly} -\setinterfacemessage{files}{1}{synonymum souboru -- je jiz pouzito pro --} -\setinterfacemessage{files}{title}{soubory} -\setinterfacemessage{versions}{1}{postradam @+} -\setinterfacemessage{versions}{3}{oznacene strany: --} -\setinterfacemessage{versions}{2}{oznacuji se strany} -\setinterfacemessage{versions}{title}{verze} -\setinterfacemessage{specials}{1}{-- nacteno} -\setinterfacemessage{specials}{3}{-- je resetovano} -\setinterfacemessage{specials}{2}{neni dovoleno hlubsi zanoreni --} -\setinterfacemessage{specials}{5}{nacita se definicni soubor --} -\setinterfacemessage{specials}{4}{prikaz -- neexistuje} -\setinterfacemessage{specials}{7}{neznamy ovladac (driver) --} -\setinterfacemessage{specials}{6}{zanoreni neni dovoleno} -\setinterfacemessage{specials}{title}{speciality} -\setinterfacemessage{layouts}{1}{vyska textu prizpusobena s -- na strane --} -\setinterfacemessage{layouts}{3}{-- krat text odlozen} -\setinterfacemessage{layouts}{2}{-- krat odlozeny text umisten} -\setinterfacemessage{layouts}{5}{okrajove bloky neaktivni} -\setinterfacemessage{layouts}{4}{okrajove bloky aktivni} -\setinterfacemessage{layouts}{7}{pocita se misto pro logo} -\setinterfacemessage{layouts}{6}{sada stran -- zpracovana (velikost --)} -\setinterfacemessage{layouts}{9}{aktualne ne vice nez -- urovne/urovni vyctu} -\setinterfacemessage{layouts}{8}{pocita se pozadi} -\setinterfacemessage{layouts}{title}{layout} -\setinterfacemessage{layouts}{11}{svisla mezera -- neni povolena v pevnem radkovem rejstriku} -\setinterfacemessage{layouts}{10}{-- a -- nedava dohromady 1.0} -\setinterfacemessage{fonts}{1}{kodovani --} -\setinterfacemessage{fonts}{3}{neznama varianta --} -\setinterfacemessage{fonts}{2}{varianta -- je nactena} -\setinterfacemessage{fonts}{5}{styl -- neni definovan} -\setinterfacemessage{fonts}{4}{zakladni font -- neni definovan} -\setinterfacemessage{fonts}{7}{neznamy format --} -\setinterfacemessage{fonts}{6}{-- je nacten} -\setinterfacemessage{fonts}{14}{bodyfont -- is defined (can better be done global)} -\setinterfacemessage{fonts}{8}{styl -- definovan} -\setinterfacemessage{fonts}{title}{zakladnifont} -\setinterfacemessage{fonts}{10}{neznamy font --} -\setinterfacemessage{databases}{1}{--} -\setinterfacemessage{databases}{3}{global file --} -\setinterfacemessage{databases}{2}{local file --} -\setinterfacemessage{databases}{4}{unknown file --} -\setinterfacemessage{databases}{title}{databases} -\setinterfacemessage{publications}{1}{file -- not found, unknown style ignored} -\setinterfacemessage{publications}{3}{wrote a new auxiliary file \jobname.aux} -\setinterfacemessage{publications}{title}{publications} -\setinterfacemessage{publications}{2}{file -- not found, waiting for bibtex} -\setinterfacemessage{publications}{4}{loading database from --} -\setinterfacemessage{publications}{5}{warning: cite argument -- on line \the\inputlineno} -\setinterfacemessage{publications}{6}{loading formatting style from --} -\setinterfacemessage{javascript}{1}{nacita se soubor skriptu --} -\setinterfacemessage{javascript}{title}{javascript} -\setinterfacemessage{javascript}{2}{neznama preambule --} -\setinterfacemessage{check}{1}{postradam '=' po '--' na radku --} -\setinterfacemessage{check}{3}{-- -- nahrazuje makro, uzijte VERZALKY!} -\setinterfacemessage{check}{2}{ocekavam -- argument(y) na radku --} -\setinterfacemessage{check}{title}{kontrola} -\setinterfacemessage{metapost}{1}{loading metapost library --} -\setinterfacemessage{metapost}{title}{metapost} -\setinterfacemessage{figures}{1}{obraz -- nelze nalezt} -\setinterfacemessage{figures}{3}{dimensions of -- are determined externally} -\setinterfacemessage{figures}{2}{obraz -- nepritomen} -\setinterfacemessage{figures}{5}{dimensions of -- are unknown} -\setinterfacemessage{figures}{4}{dimenze obrazu -- nacteny primo z jeho souboru} -\setinterfacemessage{figures}{6}{dimenze obrazu -- spocteny programem rlxtools} -\setinterfacemessage{figures}{8}{obrazovy objekt -- je znovu pouzit} -\setinterfacemessage{figures}{title}{obrazy} -\setinterfacemessage{colors}{1}{system -- je globalne aktivovana} -\setinterfacemessage{colors}{3}{-- neni definovana --} -\setinterfacemessage{colors}{2}{system -- je lokalne activovana} -\setinterfacemessage{colors}{5}{neznamy system --} -\setinterfacemessage{colors}{4}{system -- je nacten} -\setinterfacemessage{colors}{7}{palette -- neni k dispozici} -\setinterfacemessage{colors}{6}{palette -- je k dispozici} -\setinterfacemessage{colors}{9}{-- prostor barev neni podporovan} -\setinterfacemessage{colors}{8}{specifikace -- v barve -- bude cerna} -\setinterfacemessage{colors}{title}{barva} -\setinterfacemessage{colors}{12}{-- is registered} -\setinterfacemessage{colors}{11}{barva je prevedena na sed} -\setinterfacemessage{colors}{10}{-- prostor barev je podporovan} -% -\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-mde.mkii b/Master/texmf-dist/tex/context/base/mult-mde.mkii new file mode 100644 index 00000000000..4d7f009e482 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-mde.mkii @@ -0,0 +1,210 @@ +\setinterfacemessage{references}{1}{unbekannte Referenz --} +\setinterfacemessage{references}{30}{unbekanntes Object --} +\setinterfacemessage{references}{3}{unbekannte Referenz Typ --} +\setinterfacemessage{references}{2}{doppelte Referenz -- auf Seite --} +\setinterfacemessage{references}{5}{number of unknown references: --} +\setinterfacemessage{references}{4}{illegale Referenz --} +\setinterfacemessage{references}{6}{number of illegal references: --} +\setinterfacemessage{references}{25}{references from document '--' are not imported (export again)} +\setinterfacemessage{references}{24}{references from document '--' are not exported} +\setinterfacemessage{references}{title}{referenzen} +\setinterfacemessage{references}{26}{references from document '--' are imported} +\setinterfacemessage{references}{31}{doppeltes Object --} +\setinterfacemessage{references}{21}{Dokument -- geladen} +\setinterfacemessage{references}{22}{Dokument -- ist nicht aktiv} +\setinterfacemessage{references}{23}{Obskure Referenz -- (Prefix=--)} +\setinterfacemessage{documents}{1}{Blatt --} +\setinterfacemessage{documents}{title}{Blaetter} +\setinterfacemessage{documents}{2}{Nummer --} +\setinterfacemessage{handlings}{1}{Font Verarbeitung --} +\setinterfacemessage{handlings}{3}{unknown font handling --} +\setinterfacemessage{handlings}{2}{Font Verarbeitung -- ist geladen} +\setinterfacemessage{handlings}{title}{handling} +\setinterfacemessage{systems}{title}{system} +\setinterfacemessage{systems}{41}{Externe Datei -- in Gruppe -- existiert nicht} +\setinterfacemessage{systems}{9}{-- nicht gefunden/verarbeitet} +\setinterfacemessage{systems}{91}{papertray --} +\setinterfacemessage{systems}{8}{Neue Version der Hilfsdatei, zweiter Durchlauf benoetigt} +\setinterfacemessage{systems}{21}{Die Hilfsdatei ist nicht geladen} +\setinterfacemessage{systems}{20}{Bedeutung (sortieren) von -- geladen} +\setinterfacemessage{systems}{5}{Modul -- geladen} +\setinterfacemessage{systems}{4}{Befehl -- ist bereits definiert} +\setinterfacemessage{systems}{27}{Version} +\setinterfacemessage{systems}{26}{Register} +\setinterfacemessage{systems}{25}{Referenzen} +\setinterfacemessage{systems}{24}{Fliessbloecke} +\setinterfacemessage{systems}{1}{Laden der Hilfsdatei aufgeschoben (Eingabe-Modus)} +\setinterfacemessage{systems}{23}{-- angeordnet auf --} +\setinterfacemessage{systems}{22}{Benoetige gueltige Hilfsdateie} +\setinterfacemessage{systems}{2}{-- geladen} +\setinterfacemessage{systems}{19}{Bedeutung (synonyme) von -- geladen} +\setinterfacemessage{systems}{18}{Synonym -- -- existiert nicht} +\setinterfacemessage{systems}{7}{Modul -- bereits geladen} +\setinterfacemessage{systems}{6}{Modul -- gefunden} +\setinterfacemessage{systems}{14}{Erzwungendes Seitenumbruch in Liste bei --} +\setinterfacemessage{systems}{15}{Speichere Buffer --} +\setinterfacemessage{systems}{16}{Setzte Buffer --} +\setinterfacemessage{systems}{17}{Setzte tippen-Buffer --} +\setinterfacemessage{systems}{13}{Beschriftung -- definiert --} +\setinterfacemessage{systems}{12}{Die Hilfdatei ist nicht sortiert, verwende texutil} +\setinterfacemessage{systems}{11}{Erstelle einfache Hilfdatei} +\setinterfacemessage{systems}{10}{Benutzte kein em in --} +\setinterfacemessage{floatblocks}{1}{-- neu nummeriert / -- => --} +\setinterfacemessage{floatblocks}{3}{-- verschoben} +\setinterfacemessage{floatblocks}{2}{-- gespeichert} +\setinterfacemessage{floatblocks}{5}{Reihenfolge angepasst} +\setinterfacemessage{floatblocks}{4}{-- plaziert} +\setinterfacemessage{floatblocks}{7}{Anz. der unteren Gleitobjekte beschraengt auf --} +\setinterfacemessage{floatblocks}{6}{Anz. der oberen Gleitobjekte beschraengt auf --} +\setinterfacemessage{floatblocks}{9}{Reigenfolge gestoert} +\setinterfacemessage{floatblocks}{8}{weniger als -- zeilen} +\setinterfacemessage{floatblocks}{title}{Gleitobjektbloecke} +\setinterfacemessage{floatblocks}{13}{there is nothing to split} +\setinterfacemessage{floatblocks}{12}{undefiniert} +\setinterfacemessage{floatblocks}{11}{kein Block gegeben} +\setinterfacemessage{floatblocks}{10}{-- begrenzt} +\setinterfacemessage{interactions}{1}{Seitenverhaeltnis -- x -- (B x H)} +\setinterfacemessage{interactions}{3}{inaktiv} +\setinterfacemessage{interactions}{2}{aktiv} +\setinterfacemessage{interactions}{5}{unknown attachment --} +\setinterfacemessage{interactions}{4}{keine Seitensynchronisation (--) im hmode} +\setinterfacemessage{interactions}{6}{attachment file -- does not exist} +\setinterfacemessage{interactions}{title}{Interaktion} +\setinterfacemessage{interactions}{21}{-- Code eingefuegt} +\setinterfacemessage{regimes}{1}{Kodierung --} +\setinterfacemessage{regimes}{3}{Unbekannte Kodierung --} +\setinterfacemessage{regimes}{2}{Kodierung -- ist geladen} +\setinterfacemessage{regimes}{title}{Kodierung} +\setinterfacemessage{structures}{1}{Begin des Abschnittsblocks --} +\setinterfacemessage{structures}{title}{struktur} +\setinterfacemessage{structures}{2}{Ende des Abschnittsblocks --} +\setinterfacemessage{linguals}{1}{Trennmuster -- fuer -- geladen (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{3}{Trenndefinitionen -- fuer -- geladen (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{2}{Keine Trennmuster -- fuer -- (n=--,e=--,m=--) (--,--)} +\setinterfacemessage{linguals}{5}{Trennmuster fuer -- nicht geladen} +\setinterfacemessage{linguals}{4}{Keine Trenndefinitionen -- fuer -- (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{7}{Sprachenspezifische Option [--] fuegt eine Luecke von -- ein} +\setinterfacemessage{linguals}{6}{Sprache -- ist undefiniert} +\setinterfacemessage{linguals}{9}{Sprache -- ist aktiv} +\setinterfacemessage{linguals}{8}{Sprachenspezifische Option [--] nahtlos hinzugefuegt} +\setinterfacemessage{linguals}{title}{Sprache} +\setinterfacemessage{linguals}{10}{Trennmuster -- geladen} +\setinterfacemessage{verbatims}{1}{Datei -- existiert nicht} +\setinterfacemessage{verbatims}{title}{verbatim} +\setinterfacemessage{filters}{1}{filter -- ist geladen} +\setinterfacemessage{filters}{title}{filter} +\setinterfacemessage{filters}{2}{unknown filter --} +\setinterfacemessage{textblocks}{1}{neue Version, zweiter Durchlauf benoetigt} +\setinterfacemessage{textblocks}{3}{lese Bloecke von --} +\setinterfacemessage{textblocks}{2}{schreibe Bloecke zu --} +\setinterfacemessage{textblocks}{5}{-- nicht verborgen} +\setinterfacemessage{textblocks}{4}{zweiter Durchlauf benoetigt} +\setinterfacemessage{textblocks}{7}{-- verborgen} +\setinterfacemessage{textblocks}{6}{-- verborgen und verarbeitet} +\setinterfacemessage{textblocks}{9}{-- nicht gesetzt} +\setinterfacemessage{textblocks}{8}{-- gesetzt} +\setinterfacemessage{textblocks}{title}{textblock} +\setinterfacemessage{textblocks}{12}{-- ausgelassen} +\setinterfacemessage{textblocks}{11}{-- geladen und gesetzt} +\setinterfacemessage{textblocks}{10}{-- geladen und verarbeitet} +\setinterfacemessage{encodings}{1}{Kodierung --} +\setinterfacemessage{encodings}{3}{Unbekannte Kodierung --} +\setinterfacemessage{encodings}{2}{Kodierung -- ist geladen} +\setinterfacemessage{encodings}{title}{Kodierung} +\setinterfacemessage{columns}{1}{nur -- Spalten moeglich} +\setinterfacemessage{columns}{3}{Problem, verwende [ausgleich=nein]} +\setinterfacemessage{columns}{2}{benutzte \string\filbreak\space als Alternative} +\setinterfacemessage{columns}{5}{Gleitobjekt unten ncoh nicht unterstuetzt} +\setinterfacemessage{columns}{4}{Gleitobjekt oben ncoh nicht unterstuetzt} +\setinterfacemessage{columns}{7}{ausgleich nach 100 Schritten abgebrocheb} +\setinterfacemessage{columns}{6}{-- Gleitobjekt(e) verschoben} +\setinterfacemessage{columns}{9}{Ausrichtung ueberpruefen} +\setinterfacemessage{columns}{8}{ausgeglichen nach -- Schritt(en)} +\setinterfacemessage{columns}{title}{Spalten} +\setinterfacemessage{columns}{13}{breites Gleitobjekt an den Anfang der Spalten verschoben} +\setinterfacemessage{columns}{12}{Gleitobjekt in naechste Zeile verschoben / --} +\setinterfacemessage{columns}{11}{Gleitobjekt zu breit fuer Spalte} +\setinterfacemessage{columns}{10}{(weniger als) 1 Zeile uebrig} +\setinterfacemessage{symbols}{1}{Lade Symboldatei --} +\setinterfacemessage{symbols}{title}{Symbole} +\setinterfacemessage{files}{1}{Dateisynonym -- wird bereits fuer -- benutzt} +\setinterfacemessage{files}{title}{files} +\setinterfacemessage{versions}{1}{fehlendes @+} +\setinterfacemessage{versions}{3}{Ausgewaehlte Seiten: --} +\setinterfacemessage{versions}{2}{Erstelle Seiten} +\setinterfacemessage{versions}{title}{Version} +\setinterfacemessage{specials}{1}{-- geladen} +\setinterfacemessage{specials}{3}{-- ist zurueckgesetzt} +\setinterfacemessage{specials}{2}{keine tiefere Verschachtelung erlaubt --} +\setinterfacemessage{specials}{5}{lade Definitionsdatei --} +\setinterfacemessage{specials}{4}{Befehl -- existiert nicht} +\setinterfacemessage{specials}{7}{unbekante Driver --} +\setinterfacemessage{specials}{6}{Verschachtelung nicht erlaubt} +\setinterfacemessage{specials}{title}{spezielles} +\setinterfacemessage{layouts}{1}{Texthoehe angepasst mit -- auf Seite --} +\setinterfacemessage{layouts}{3}{-- mal Text verschoben} +\setinterfacemessage{layouts}{2}{-- mal verschobener Text plaziert} +\setinterfacemessage{layouts}{5}{marginalbloecke inaktiv} +\setinterfacemessage{layouts}{4}{marginalbloecke aktiv} +\setinterfacemessage{layouts}{7}{berechne Platzbedarf des Logos} +\setinterfacemessage{layouts}{6}{Unterseitenfolge -- verarbeitet (Groesse --)} +\setinterfacemessage{layouts}{9}{z.Z. nicht mehr als -- Ebenen in Aufzaehlungen} +\setinterfacemessage{layouts}{8}{berechne Hintergrund} +\setinterfacemessage{layouts}{title}{Layout} +\setinterfacemessage{layouts}{11}{Zwischenraum -- nicht im Grittermoduserlau} +\setinterfacemessage{layouts}{10}{-- und -- ergeben zusammen nicht 1.0} +\setinterfacemessage{fonts}{1}{Kodierung --} +\setinterfacemessage{fonts}{3}{Unbekannte Variante --} +\setinterfacemessage{fonts}{2}{Variante -- ist geladen} +\setinterfacemessage{fonts}{5}{Stil -- ist nicht definiert} +\setinterfacemessage{fonts}{4}{Fliesstext -- ist nicht definiert} +\setinterfacemessage{fonts}{7}{unbekanntes Format --} +\setinterfacemessage{fonts}{6}{-- ist geladen} +\setinterfacemessage{fonts}{14}{Fliesstext -- wurde definiert (besser waere globale Definition)} +\setinterfacemessage{fonts}{8}{Stil -- definiert} +\setinterfacemessage{fonts}{title}{Fliesstext} +\setinterfacemessage{fonts}{10}{unbekanntes Font --} +\setinterfacemessage{databases}{1}{--} +\setinterfacemessage{databases}{3}{globale Datei --} +\setinterfacemessage{databases}{2}{lokale Datei --} +\setinterfacemessage{databases}{4}{unbekannte Datei --} +\setinterfacemessage{databases}{title}{Datenbank} +\setinterfacemessage{publications}{1}{file -- not found, unknown style ignored} +\setinterfacemessage{publications}{3}{wrote a new auxiliary file \jobname.aux} +\setinterfacemessage{publications}{title}{publications} +\setinterfacemessage{publications}{2}{file -- not found, waiting for bibtex} +\setinterfacemessage{publications}{4}{loading database from --} +\setinterfacemessage{publications}{5}{warning: cite argument -- on line \the\inputlineno} +\setinterfacemessage{publications}{6}{loading formatting style from --} +\setinterfacemessage{javascript}{1}{Lade Scriptdatei --} +\setinterfacemessage{javascript}{title}{javascript} +\setinterfacemessage{javascript}{2}{unbekannte Preamble --} +\setinterfacemessage{check}{1}{Fehlendes '=' nach '--' in Zeile --} +\setinterfacemessage{check}{3}{-- -- ersetzt ein Makro, verwende VERSALIEN!} +\setinterfacemessage{check}{2}{-- Argument(e) in Zeile -- erwartet} +\setinterfacemessage{check}{title}{check} +\setinterfacemessage{metapost}{1}{Lade metapost Bibliothek --} +\setinterfacemessage{metapost}{title}{metapost} +\setinterfacemessage{figures}{1}{Abbildung -- kann nicht gefunden werden} +\setinterfacemessage{figures}{3}{dimensions of -- are determined externally} +\setinterfacemessage{figures}{2}{Abbildung -- wird nicht erstellt} +\setinterfacemessage{figures}{5}{Dimensions of -- are unknown} +\setinterfacemessage{figures}{4}{Dimensionen von -- geladen aus der Abbildungsdatei selbst} +\setinterfacemessage{figures}{6}{Dimensionen von -- ausgerechnet durch rlxtools} +\setinterfacemessage{figures}{8}{Abbildungobjekt -- wurde wiederverwandt} +\setinterfacemessage{figures}{title}{Abbildungen} +\setinterfacemessage{colors}{1}{system -- ist global aktiviert} +\setinterfacemessage{colors}{3}{-- ist undefiniert --} +\setinterfacemessage{colors}{2}{system -- ist lokal aktiviert} +\setinterfacemessage{colors}{5}{unbekanntes System --} +\setinterfacemessage{colors}{4}{system -- ist geladen} +\setinterfacemessage{colors}{7}{palette -- ist nicht verfuegbar} +\setinterfacemessage{colors}{6}{palette -- ist verfuegbar} +\setinterfacemessage{colors}{9}{-- Farbraum wird nicht unterstuetzt} +\setinterfacemessage{colors}{8}{Spezifikation -- bei Farbe -- wird schwarz} +\setinterfacemessage{colors}{title}{farbe} +\setinterfacemessage{colors}{12}{-- is registered} +\setinterfacemessage{colors}{11}{Farbe wird in Grau umgewandelt} +\setinterfacemessage{colors}{10}{-- Farbraum wird unterstuetzt} +% +\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-mde.tex b/Master/texmf-dist/tex/context/base/mult-mde.tex deleted file mode 100644 index 4da89ba333b..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-mde.tex +++ /dev/null @@ -1,208 +0,0 @@ -\setinterfacemessage{references}{1}{unbekannte Referenz --} -\setinterfacemessage{references}{3}{unbekannte Referenz Typ --} -\setinterfacemessage{references}{2}{doppelte Referenz -- auf Seite --} -\setinterfacemessage{references}{4}{illegale Referenz --} -\setinterfacemessage{references}{30}{unbekanntes Object --} -\setinterfacemessage{references}{25}{references from document '--' are not imported (export again)} -\setinterfacemessage{references}{24}{references from document '--' are not exported} -\setinterfacemessage{references}{title}{referenzen} -\setinterfacemessage{references}{26}{references from document '--' are imported} -\setinterfacemessage{references}{31}{doppeltes Object --} -\setinterfacemessage{references}{21}{Dokument -- geladen} -\setinterfacemessage{references}{22}{Dokument -- ist nicht aktiv} -\setinterfacemessage{references}{23}{Obskure Referenz -- (Prefix=--)} -\setinterfacemessage{documents}{1}{Blatt --} -\setinterfacemessage{documents}{title}{Blaetter} -\setinterfacemessage{documents}{2}{Nummer --} -\setinterfacemessage{handlings}{1}{Font Verarbeitung --} -\setinterfacemessage{handlings}{3}{unknown font handling --} -\setinterfacemessage{handlings}{2}{Font Verarbeitung -- ist geladen} -\setinterfacemessage{handlings}{title}{handling} -\setinterfacemessage{systems}{title}{system} -\setinterfacemessage{systems}{41}{Externe Datei -- in Gruppe -- existiert nicht} -\setinterfacemessage{systems}{9}{-- nicht gefunden/verarbeitet} -\setinterfacemessage{systems}{91}{papertray --} -\setinterfacemessage{systems}{8}{Neue Version der Hilfsdatei, zweiter Durchlauf benoetigt} -\setinterfacemessage{systems}{21}{Die Hilfsdatei ist nicht geladen} -\setinterfacemessage{systems}{20}{Bedeutung (sortieren) von -- geladen} -\setinterfacemessage{systems}{5}{Modul -- geladen} -\setinterfacemessage{systems}{4}{Befehl -- ist bereits definiert} -\setinterfacemessage{systems}{27}{Version} -\setinterfacemessage{systems}{26}{Register} -\setinterfacemessage{systems}{25}{Referenzen} -\setinterfacemessage{systems}{24}{Fliessbloecke} -\setinterfacemessage{systems}{1}{Laden der Hilfsdatei aufgeschoben (Eingabe-Modus)} -\setinterfacemessage{systems}{23}{-- angeordnet auf --} -\setinterfacemessage{systems}{22}{Benoetige gueltige Hilfsdateie} -\setinterfacemessage{systems}{2}{-- geladen} -\setinterfacemessage{systems}{19}{Bedeutung (synonyme) von -- geladen} -\setinterfacemessage{systems}{18}{Synonym -- -- existiert nicht} -\setinterfacemessage{systems}{7}{Modul -- bereits geladen} -\setinterfacemessage{systems}{6}{Modul -- gefunden} -\setinterfacemessage{systems}{14}{Erzwungendes Seitenumbruch in Liste bei --} -\setinterfacemessage{systems}{15}{Speichere Buffer --} -\setinterfacemessage{systems}{16}{Setzte Buffer --} -\setinterfacemessage{systems}{17}{Setzte tippen-Buffer --} -\setinterfacemessage{systems}{13}{Beschriftung -- definiert --} -\setinterfacemessage{systems}{12}{Die Hilfdatei ist nicht sortiert, verwende texutil} -\setinterfacemessage{systems}{11}{Erstelle einfache Hilfdatei} -\setinterfacemessage{systems}{10}{Benutzte kein em in --} -\setinterfacemessage{floatblocks}{1}{-- neu nummeriert / -- => --} -\setinterfacemessage{floatblocks}{3}{-- verschoben} -\setinterfacemessage{floatblocks}{2}{-- gespeichert} -\setinterfacemessage{floatblocks}{5}{Reihenfolge angepasst} -\setinterfacemessage{floatblocks}{4}{-- plaziert} -\setinterfacemessage{floatblocks}{7}{Anz. der unteren Gleitobjekte beschraengt auf --} -\setinterfacemessage{floatblocks}{6}{Anz. der oberen Gleitobjekte beschraengt auf --} -\setinterfacemessage{floatblocks}{9}{Reigenfolge gestoert} -\setinterfacemessage{floatblocks}{8}{weniger als -- zeilen} -\setinterfacemessage{floatblocks}{title}{Gleitobjektbloecke} -\setinterfacemessage{floatblocks}{13}{there is nothing to split} -\setinterfacemessage{floatblocks}{12}{undefiniert} -\setinterfacemessage{floatblocks}{11}{kein Block gegeben} -\setinterfacemessage{floatblocks}{10}{-- begrenzt} -\setinterfacemessage{interactions}{1}{Seitenverhaeltnis -- x -- (B x H)} -\setinterfacemessage{interactions}{3}{inaktiv} -\setinterfacemessage{interactions}{2}{aktiv} -\setinterfacemessage{interactions}{5}{unknown attachment --} -\setinterfacemessage{interactions}{4}{keine Seitensynchronisation (--) im hmode} -\setinterfacemessage{interactions}{6}{attachment file -- does not exist} -\setinterfacemessage{interactions}{title}{Interaktion} -\setinterfacemessage{interactions}{21}{-- Code eingefuegt} -\setinterfacemessage{regimes}{1}{Kodierung --} -\setinterfacemessage{regimes}{3}{Unbekannte Kodierung --} -\setinterfacemessage{regimes}{2}{Kodierung -- ist geladen} -\setinterfacemessage{regimes}{title}{Kodierung} -\setinterfacemessage{structures}{1}{Begin des Abschnittsblocks --} -\setinterfacemessage{structures}{title}{struktur} -\setinterfacemessage{structures}{2}{Ende des Abschnittsblocks --} -\setinterfacemessage{linguals}{1}{Trennmuster -- fuer -- geladen (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{3}{Trenndefinitionen -- fuer -- geladen (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{2}{Keine Trennmuster -- fuer -- (n=--,e=--,m=--) (--,--)} -\setinterfacemessage{linguals}{5}{Trennmuster fuer -- nicht geladen} -\setinterfacemessage{linguals}{4}{Keine Trenndefinitionen -- fuer -- (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{7}{Sprachenspezifische Option [--] fuegt eine Luecke von -- ein} -\setinterfacemessage{linguals}{6}{Sprache -- ist undefiniert} -\setinterfacemessage{linguals}{9}{Sprache -- ist aktiv} -\setinterfacemessage{linguals}{8}{Sprachenspezifische Option [--] nahtlos hinzugefuegt} -\setinterfacemessage{linguals}{title}{Sprache} -\setinterfacemessage{linguals}{10}{Trennmuster --geladen} -\setinterfacemessage{verbatims}{1}{Datei -- existiert nicht} -\setinterfacemessage{verbatims}{title}{verbatim} -\setinterfacemessage{filters}{1}{filter -- ist geladen} -\setinterfacemessage{filters}{title}{filter} -\setinterfacemessage{filters}{2}{unknown filter --} -\setinterfacemessage{textblocks}{1}{neue Version, zweiter Durchlauf benoetigt} -\setinterfacemessage{textblocks}{3}{lese Bloecke von --} -\setinterfacemessage{textblocks}{2}{schreibe Bloecke zu --} -\setinterfacemessage{textblocks}{5}{-- nicht verborgen} -\setinterfacemessage{textblocks}{4}{zweiter Durchlauf benoetigt} -\setinterfacemessage{textblocks}{7}{-- verborgen} -\setinterfacemessage{textblocks}{6}{-- verborgen und verarbeitet} -\setinterfacemessage{textblocks}{9}{-- nicht gesetzt} -\setinterfacemessage{textblocks}{8}{-- gesetzt} -\setinterfacemessage{textblocks}{title}{textblock} -\setinterfacemessage{textblocks}{12}{-- ausgelassen} -\setinterfacemessage{textblocks}{11}{-- geladen und gesetzt} -\setinterfacemessage{textblocks}{10}{-- geladen und verarbeitet} -\setinterfacemessage{encodings}{1}{Kodierung --} -\setinterfacemessage{encodings}{3}{Unbekannte Kodierung --} -\setinterfacemessage{encodings}{2}{Kodierung -- ist geladen} -\setinterfacemessage{encodings}{title}{Kodierung} -\setinterfacemessage{columns}{1}{nur -- Spalten moeglich} -\setinterfacemessage{columns}{3}{Problem, verwende [ausgleich=nein]} -\setinterfacemessage{columns}{2}{benutzte \string\filbreak\space als Alternative} -\setinterfacemessage{columns}{5}{Gleitobjekt unten ncoh nicht unterstuetzt} -\setinterfacemessage{columns}{4}{Gleitobjekt oben ncoh nicht unterstuetzt} -\setinterfacemessage{columns}{7}{ausgleich nach 100 Schritten abgebrocheb} -\setinterfacemessage{columns}{6}{-- Gleitobjekt(e) verschoben} -\setinterfacemessage{columns}{9}{Ausrichtung ueberpruefen} -\setinterfacemessage{columns}{8}{ausgeglichen nach -- Schritt(en)} -\setinterfacemessage{columns}{title}{Spalten} -\setinterfacemessage{columns}{13}{breites Gleitobjekt an den Anfang der Spalten verschoben} -\setinterfacemessage{columns}{12}{Gleitobjekt in naechste Zeile verschoben / --} -\setinterfacemessage{columns}{11}{Gleitobjekt zu breit fuer Spalte} -\setinterfacemessage{columns}{10}{(weniger als) 1 Zeile uebrig} -\setinterfacemessage{symbols}{1}{Lade Symboldatei --} -\setinterfacemessage{symbols}{title}{Symbole} -\setinterfacemessage{files}{1}{Dateisynonym -- wird bereits fuer -- benutzt} -\setinterfacemessage{files}{title}{files} -\setinterfacemessage{versions}{1}{fehlendes @+} -\setinterfacemessage{versions}{3}{Ausgewaehlte Seiten: --} -\setinterfacemessage{versions}{2}{Erstelle Seiten} -\setinterfacemessage{versions}{title}{Version} -\setinterfacemessage{specials}{1}{-- geladen} -\setinterfacemessage{specials}{3}{-- ist zurueckgesetzt} -\setinterfacemessage{specials}{2}{keine tiefere Verschachtelung erlaubt --} -\setinterfacemessage{specials}{5}{lade Definitionsdatei --} -\setinterfacemessage{specials}{4}{Befehl -- existiert nicht} -\setinterfacemessage{specials}{7}{unbekante Driver --} -\setinterfacemessage{specials}{6}{Verschachtelung nicht erlaubt} -\setinterfacemessage{specials}{title}{spezielles} -\setinterfacemessage{layouts}{1}{Texthoehe angepasst mit -- auf Seite --} -\setinterfacemessage{layouts}{3}{-- mal Text verschoben} -\setinterfacemessage{layouts}{2}{-- mal verschobener Text plaziert} -\setinterfacemessage{layouts}{5}{marginalbloecke inaktiv} -\setinterfacemessage{layouts}{4}{marginalbloecke aktiv} -\setinterfacemessage{layouts}{7}{berechne Platzbedarf des Logos} -\setinterfacemessage{layouts}{6}{Unterseitenfolge -- verarbeitet (Groesse --)} -\setinterfacemessage{layouts}{9}{z.Z. nicht mehr als -- Ebenen in Aufzaehlungen} -\setinterfacemessage{layouts}{8}{berechne Hintergrund} -\setinterfacemessage{layouts}{title}{Layout} -\setinterfacemessage{layouts}{11}{Zwischenraum -- nicht im Grittermoduserlau} -\setinterfacemessage{layouts}{10}{-- und -- ergeben zusammen nicht 1.0} -\setinterfacemessage{fonts}{1}{Kodierung --} -\setinterfacemessage{fonts}{3}{Unbekannte Variante --} -\setinterfacemessage{fonts}{2}{Variante -- ist geladen} -\setinterfacemessage{fonts}{5}{Stil -- ist nicht definiert} -\setinterfacemessage{fonts}{4}{Fliesstext -- ist nicht definiert} -\setinterfacemessage{fonts}{7}{unbekanntes Format --} -\setinterfacemessage{fonts}{6}{-- ist geladen} -\setinterfacemessage{fonts}{14}{Fliesstext -- wurde definiert (besser waere globale Definition)} -\setinterfacemessage{fonts}{8}{Stil -- definiert} -\setinterfacemessage{fonts}{title}{Fliesstext} -\setinterfacemessage{fonts}{10}{unbekanntes Font --} -\setinterfacemessage{databases}{1}{--} -\setinterfacemessage{databases}{3}{globale Datei --} -\setinterfacemessage{databases}{2}{lokale Datei --} -\setinterfacemessage{databases}{4}{unbekannte Datei --} -\setinterfacemessage{databases}{title}{Datenbank} -\setinterfacemessage{publications}{1}{file -- not found, unknown style ignored} -\setinterfacemessage{publications}{3}{wrote a new auxiliary file \jobname.aux} -\setinterfacemessage{publications}{title}{publications} -\setinterfacemessage{publications}{2}{file -- not found, waiting for bibtex} -\setinterfacemessage{publications}{4}{loading database from --} -\setinterfacemessage{publications}{5}{warning: cite argument -- on line \the\inputlineno} -\setinterfacemessage{publications}{6}{loading formatting style from --} -\setinterfacemessage{javascript}{1}{Lade Scriptdatei --} -\setinterfacemessage{javascript}{title}{javascript} -\setinterfacemessage{javascript}{2}{unbekannte Preamble --} -\setinterfacemessage{check}{1}{Fehlendes '=' nach '--' in Zeile --} -\setinterfacemessage{check}{3}{-- -- ersetzt ein Makro, verwende VERSALIEN!} -\setinterfacemessage{check}{2}{-- Argument(e) in Zeile -- erwartet} -\setinterfacemessage{check}{title}{check} -\setinterfacemessage{metapost}{1}{Lade metapost Bibliothek --} -\setinterfacemessage{metapost}{title}{metapost} -\setinterfacemessage{figures}{1}{Abbildung -- kann nicht gefunden werden} -\setinterfacemessage{figures}{3}{dimensions of -- are determined externally} -\setinterfacemessage{figures}{2}{Abbildung -- wird nicht erstellt} -\setinterfacemessage{figures}{5}{Dimensions of -- are unknown} -\setinterfacemessage{figures}{4}{Dimensionen von -- geladen aus der Abbildungsdatei selbst} -\setinterfacemessage{figures}{6}{Dimensionen von -- ausgerechnet durch rlxtools} -\setinterfacemessage{figures}{8}{Abbildungobjekt -- wurde wiederverwandt} -\setinterfacemessage{figures}{title}{Abbildungen} -\setinterfacemessage{colors}{1}{system -- ist global aktiviert} -\setinterfacemessage{colors}{3}{-- ist undefiniert --} -\setinterfacemessage{colors}{2}{system -- ist lokal aktiviert} -\setinterfacemessage{colors}{5}{unbekanntes System --} -\setinterfacemessage{colors}{4}{system -- ist geladen} -\setinterfacemessage{colors}{7}{palette -- ist nicht verfuegbar} -\setinterfacemessage{colors}{6}{palette -- ist verfuegbar} -\setinterfacemessage{colors}{9}{-- Farbraum wird nicht unterstuetzt} -\setinterfacemessage{colors}{8}{Spezifikation -- bei Farbe -- wird schwarz} -\setinterfacemessage{colors}{title}{farbe} -\setinterfacemessage{colors}{12}{-- is registered} -\setinterfacemessage{colors}{11}{Farbe wird in Grau umgewandelt} -\setinterfacemessage{colors}{10}{-- Farbraum wird unterstuetzt} -% -\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-men.mkii b/Master/texmf-dist/tex/context/base/mult-men.mkii new file mode 100644 index 00000000000..a8d42935602 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-men.mkii @@ -0,0 +1,210 @@ +\setinterfacemessage{references}{1}{unknown reference --} +\setinterfacemessage{references}{30}{unknown object --} +\setinterfacemessage{references}{3}{unknown reference type --} +\setinterfacemessage{references}{2}{duplicate reference -- on page --} +\setinterfacemessage{references}{5}{number of unknown references: --} +\setinterfacemessage{references}{4}{illegal reference --} +\setinterfacemessage{references}{6}{number of illegal references: --} +\setinterfacemessage{references}{25}{references from document '--' are not imported (export again)} +\setinterfacemessage{references}{24}{references from document '--' are not exported} +\setinterfacemessage{references}{title}{references} +\setinterfacemessage{references}{26}{references from document '--' are imported} +\setinterfacemessage{references}{31}{duplicate object --} +\setinterfacemessage{references}{21}{document -- loaded} +\setinterfacemessage{references}{22}{document -- is not interactive} +\setinterfacemessage{references}{23}{obscure reference -- (prefix=--)} +\setinterfacemessage{documents}{1}{sheet --} +\setinterfacemessage{documents}{title}{sheets} +\setinterfacemessage{documents}{2}{number --} +\setinterfacemessage{handlings}{1}{font handling --} +\setinterfacemessage{handlings}{3}{unknown font handling --} +\setinterfacemessage{handlings}{2}{font handling -- is loaded} +\setinterfacemessage{handlings}{title}{handling} +\setinterfacemessage{systems}{title}{system} +\setinterfacemessage{systems}{41}{external file -- in group -- does not exist} +\setinterfacemessage{systems}{9}{-- not found/processed} +\setinterfacemessage{systems}{91}{papertray --} +\setinterfacemessage{systems}{8}{new version of utility file, second pass needed} +\setinterfacemessage{systems}{21}{no utility data is loaded} +\setinterfacemessage{systems}{20}{meaning (sorts) of -- loaded} +\setinterfacemessage{systems}{5}{module -- loaded} +\setinterfacemessage{systems}{4}{command -- is already defined} +\setinterfacemessage{systems}{27}{Version} +\setinterfacemessage{systems}{26}{Registers} +\setinterfacemessage{systems}{25}{References} +\setinterfacemessage{systems}{24}{Floatblocks} +\setinterfacemessage{systems}{1}{loading utility-file postponed (typemode)} +\setinterfacemessage{systems}{23}{-- arranged at --} +\setinterfacemessage{systems}{22}{use a valid utilityfile} +\setinterfacemessage{systems}{2}{-- loaded} +\setinterfacemessage{systems}{19}{meaning (synonyms) of -- loaded} +\setinterfacemessage{systems}{18}{synonym -- -- does not exist} +\setinterfacemessage{systems}{7}{module -- already loaded} +\setinterfacemessage{systems}{6}{module -- not found} +\setinterfacemessage{systems}{14}{forced newpage in list at --} +\setinterfacemessage{systems}{15}{saving buffer --} +\setinterfacemessage{systems}{16}{typesetting buffer --} +\setinterfacemessage{systems}{17}{typesetting verbatim buffer --} +\setinterfacemessage{systems}{13}{mark -- defined --} +\setinterfacemessage{systems}{12}{the utility-file is not sorted, use texutil} +\setinterfacemessage{systems}{11}{building simple util} +\setinterfacemessage{systems}{10}{don't use em in --} +\setinterfacemessage{floatblocks}{1}{-- renumbered / -- => --} +\setinterfacemessage{floatblocks}{3}{-- moved} +\setinterfacemessage{floatblocks}{2}{-- saved} +\setinterfacemessage{floatblocks}{5}{order adapted} +\setinterfacemessage{floatblocks}{4}{-- placed} +\setinterfacemessage{floatblocks}{7}{n of bottom floats limited to --} +\setinterfacemessage{floatblocks}{6}{n of top floats limited to --} +\setinterfacemessage{floatblocks}{9}{order disturbed} +\setinterfacemessage{floatblocks}{8}{less than -- lines} +\setinterfacemessage{floatblocks}{title}{floatblocks} +\setinterfacemessage{floatblocks}{13}{there is nothing to split} +\setinterfacemessage{floatblocks}{12}{undefined} +\setinterfacemessage{floatblocks}{11}{no block given} +\setinterfacemessage{floatblocks}{10}{-- limited} +\setinterfacemessage{interactions}{1}{aspect ratio -- x -- (b x h)} +\setinterfacemessage{interactions}{3}{inactive} +\setinterfacemessage{interactions}{2}{active} +\setinterfacemessage{interactions}{5}{unknown attachment --} +\setinterfacemessage{interactions}{4}{no pagesynchronisation (--) in hmode} +\setinterfacemessage{interactions}{6}{attachment file -- does not exist} +\setinterfacemessage{interactions}{title}{interaction} +\setinterfacemessage{interactions}{21}{-- code inserted} +\setinterfacemessage{regimes}{1}{regime --} +\setinterfacemessage{regimes}{3}{unknown regime --} +\setinterfacemessage{regimes}{2}{regime -- is loaded} +\setinterfacemessage{regimes}{title}{regime} +\setinterfacemessage{structures}{1}{begin of sectionblock --} +\setinterfacemessage{structures}{title}{structure} +\setinterfacemessage{structures}{2}{end of sectionblock --} +\setinterfacemessage{linguals}{1}{patterns -- for -- loaded (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{3}{hyphenations -- for -- loaded (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{2}{no patterns -- for -- (n=--,e=--,m=--) (--,--)} +\setinterfacemessage{linguals}{5}{patterns for -- not loaded} +\setinterfacemessage{linguals}{4}{no hyphenations -- for -- (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{7}{language specific options [--] introduce a -- skip} +\setinterfacemessage{linguals}{6}{language -- is undefined} +\setinterfacemessage{linguals}{9}{language -- is active} +\setinterfacemessage{linguals}{8}{language specific options [--] seamless appended} +\setinterfacemessage{linguals}{title}{language} +\setinterfacemessage{linguals}{10}{patterns -- loaded} +\setinterfacemessage{verbatims}{1}{file -- does not exist} +\setinterfacemessage{verbatims}{title}{verbatim} +\setinterfacemessage{filters}{1}{filter -- is loaded} +\setinterfacemessage{filters}{title}{filter} +\setinterfacemessage{filters}{2}{unknown filter --} +\setinterfacemessage{textblocks}{1}{new version, second pass needed} +\setinterfacemessage{textblocks}{3}{reading blocks from --} +\setinterfacemessage{textblocks}{2}{writing blocks to --} +\setinterfacemessage{textblocks}{5}{-- not hidden} +\setinterfacemessage{textblocks}{4}{second pass needed} +\setinterfacemessage{textblocks}{7}{-- hidden} +\setinterfacemessage{textblocks}{6}{-- hidden and processed} +\setinterfacemessage{textblocks}{9}{-- not typeset} +\setinterfacemessage{textblocks}{8}{-- typeset} +\setinterfacemessage{textblocks}{title}{textblocks} +\setinterfacemessage{textblocks}{12}{-- skipped} +\setinterfacemessage{textblocks}{11}{-- loaded and typeset} +\setinterfacemessage{textblocks}{10}{-- loaded and processed} +\setinterfacemessage{encodings}{1}{coding --} +\setinterfacemessage{encodings}{3}{unknown coding --} +\setinterfacemessage{encodings}{2}{coding -- is loaded} +\setinterfacemessage{encodings}{title}{encoding} +\setinterfacemessage{columns}{1}{only -- columns possible} +\setinterfacemessage{columns}{3}{problems, disable balancing} +\setinterfacemessage{columns}{2}{use \string\filbreak\space as alternative} +\setinterfacemessage{columns}{5}{bottom float not yet supported} +\setinterfacemessage{columns}{4}{top float not yet supported} +\setinterfacemessage{columns}{7}{balancing aborted after 100 steps} +\setinterfacemessage{columns}{6}{-- float(s) postponed} +\setinterfacemessage{columns}{9}{check raggedness} +\setinterfacemessage{columns}{8}{balanced in -- step(s)} +\setinterfacemessage{columns}{title}{columns} +\setinterfacemessage{columns}{13}{wide float moved to top of columns} +\setinterfacemessage{columns}{12}{float moved to next column / --} +\setinterfacemessage{columns}{11}{float too wide for column} +\setinterfacemessage{columns}{10}{(less than) 1 line left} +\setinterfacemessage{symbols}{1}{loading symbolset --} +\setinterfacemessage{symbols}{title}{symbols} +\setinterfacemessage{files}{1}{file synonym -- is already used for --} +\setinterfacemessage{files}{title}{files} +\setinterfacemessage{versions}{1}{missing @+} +\setinterfacemessage{versions}{3}{selected pages: --} +\setinterfacemessage{versions}{2}{marking pages} +\setinterfacemessage{versions}{title}{version} +\setinterfacemessage{specials}{1}{-- loaded} +\setinterfacemessage{specials}{3}{-- is reset} +\setinterfacemessage{specials}{2}{no deeper nesting is permitted --} +\setinterfacemessage{specials}{5}{loading definition file --} +\setinterfacemessage{specials}{4}{command -- does not exist} +\setinterfacemessage{specials}{7}{unknown driver --} +\setinterfacemessage{specials}{6}{nesting is not permitted} +\setinterfacemessage{specials}{title}{specials} +\setinterfacemessage{layouts}{1}{textheight adapted with -- at page --} +\setinterfacemessage{layouts}{3}{-- times text postponed} +\setinterfacemessage{layouts}{2}{-- times postponed text placed} +\setinterfacemessage{layouts}{5}{marginblocks inactive} +\setinterfacemessage{layouts}{4}{marginblocks active} +\setinterfacemessage{layouts}{7}{calculating logospace} +\setinterfacemessage{layouts}{6}{subpage set -- processed (size --)} +\setinterfacemessage{layouts}{9}{currently no more than -- levels in itemizations} +\setinterfacemessage{layouts}{8}{calculating backgrounds} +\setinterfacemessage{layouts}{title}{layout} +\setinterfacemessage{layouts}{11}{spacing -- not permitted in gridmode} +\setinterfacemessage{layouts}{10}{-- and -- don't add up to 1.0} +\setinterfacemessage{fonts}{1}{coding --} +\setinterfacemessage{fonts}{3}{unknown variant --} +\setinterfacemessage{fonts}{2}{variant -- is loaded} +\setinterfacemessage{fonts}{5}{style -- is not defined} +\setinterfacemessage{fonts}{4}{bodyfont -- is not defined} +\setinterfacemessage{fonts}{7}{unknown format --} +\setinterfacemessage{fonts}{6}{-- is loaded} +\setinterfacemessage{fonts}{14}{bodyfont -- is defined (can better be done global)} +\setinterfacemessage{fonts}{8}{style -- defined} +\setinterfacemessage{fonts}{title}{bodyfont} +\setinterfacemessage{fonts}{10}{unknown font file --} +\setinterfacemessage{databases}{1}{--} +\setinterfacemessage{databases}{3}{global file --} +\setinterfacemessage{databases}{2}{local file --} +\setinterfacemessage{databases}{4}{unknown file --} +\setinterfacemessage{databases}{title}{databases} +\setinterfacemessage{publications}{1}{file -- not found, unknown style ignored} +\setinterfacemessage{publications}{3}{wrote a new auxiliary file \jobname.aux} +\setinterfacemessage{publications}{title}{publications} +\setinterfacemessage{publications}{2}{file -- not found, waiting for bibtex} +\setinterfacemessage{publications}{4}{loading database from --} +\setinterfacemessage{publications}{5}{warning: cite argument -- on line \the\inputlineno} +\setinterfacemessage{publications}{6}{loading formatting style from --} +\setinterfacemessage{javascript}{1}{loading script set --} +\setinterfacemessage{javascript}{title}{javascript} +\setinterfacemessage{javascript}{2}{unknown preamble --} +\setinterfacemessage{check}{1}{missing or ungrouped '=' after '--' in line --} +\setinterfacemessage{check}{3}{-- -- replaces a macro, use CAPITALS!} +\setinterfacemessage{check}{2}{-- argument(s) expected in line --} +\setinterfacemessage{check}{title}{check} +\setinterfacemessage{metapost}{1}{loading metapost library --} +\setinterfacemessage{metapost}{title}{metapost} +\setinterfacemessage{figures}{1}{figure -- can not be found} +\setinterfacemessage{figures}{3}{dimensions of -- are determined externally} +\setinterfacemessage{figures}{2}{figure -- is not preset} +\setinterfacemessage{figures}{5}{dimensions of -- are unknown} +\setinterfacemessage{figures}{4}{dimensions of -- loaded from figurefile itself} +\setinterfacemessage{figures}{6}{dimensions of -- calculated by rlxtools} +\setinterfacemessage{figures}{8}{figureobject -- is reused} +\setinterfacemessage{figures}{title}{figures} +\setinterfacemessage{colors}{1}{system -- is global activated} +\setinterfacemessage{colors}{3}{-- is not defined --} +\setinterfacemessage{colors}{2}{system -- is local activated} +\setinterfacemessage{colors}{5}{unknown system --} +\setinterfacemessage{colors}{4}{system -- is loaded} +\setinterfacemessage{colors}{7}{palette -- is not available} +\setinterfacemessage{colors}{6}{palette -- is available} +\setinterfacemessage{colors}{9}{-- color space is not supported} +\setinterfacemessage{colors}{8}{specification -- at color -- becomes black} +\setinterfacemessage{colors}{title}{color} +\setinterfacemessage{colors}{12}{-- is registered} +\setinterfacemessage{colors}{11}{color is converted to gray} +\setinterfacemessage{colors}{10}{-- color space is supported} +% +\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-men.tex b/Master/texmf-dist/tex/context/base/mult-men.tex deleted file mode 100644 index 4c1bc99420a..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-men.tex +++ /dev/null @@ -1,208 +0,0 @@ -\setinterfacemessage{references}{1}{unknown reference --} -\setinterfacemessage{references}{3}{unknown reference type --} -\setinterfacemessage{references}{2}{duplicate reference -- on page --} -\setinterfacemessage{references}{4}{illegal reference --} -\setinterfacemessage{references}{30}{unknown object --} -\setinterfacemessage{references}{25}{references from document '--' are not imported (export again)} -\setinterfacemessage{references}{24}{references from document '--' are not exported} -\setinterfacemessage{references}{title}{references} -\setinterfacemessage{references}{26}{references from document '--' are imported} -\setinterfacemessage{references}{31}{duplicate object --} -\setinterfacemessage{references}{21}{document -- loaded} -\setinterfacemessage{references}{22}{document -- is not interactive} -\setinterfacemessage{references}{23}{obscure reference -- (prefix=--)} -\setinterfacemessage{documents}{1}{sheet --} -\setinterfacemessage{documents}{title}{sheets} -\setinterfacemessage{documents}{2}{number --} -\setinterfacemessage{handlings}{1}{font handling --} -\setinterfacemessage{handlings}{3}{unknown font handling --} -\setinterfacemessage{handlings}{2}{font handling -- is loaded} -\setinterfacemessage{handlings}{title}{handling} -\setinterfacemessage{systems}{title}{system} -\setinterfacemessage{systems}{41}{external file -- in group -- does not exist} -\setinterfacemessage{systems}{9}{-- not found/processed} -\setinterfacemessage{systems}{91}{papertray --} -\setinterfacemessage{systems}{8}{new version of utility file, second pass needed} -\setinterfacemessage{systems}{21}{no utility data is loaded} -\setinterfacemessage{systems}{20}{meaning (sorts) of -- loaded} -\setinterfacemessage{systems}{5}{module -- loaded} -\setinterfacemessage{systems}{4}{command -- is already defined} -\setinterfacemessage{systems}{27}{Version} -\setinterfacemessage{systems}{26}{Registers} -\setinterfacemessage{systems}{25}{References} -\setinterfacemessage{systems}{24}{Floatblocks} -\setinterfacemessage{systems}{1}{loading utility-file postponed (typemode)} -\setinterfacemessage{systems}{23}{-- arranged at --} -\setinterfacemessage{systems}{22}{use a valid utilityfile} -\setinterfacemessage{systems}{2}{-- loaded} -\setinterfacemessage{systems}{19}{meaning (synonyms) of -- loaded} -\setinterfacemessage{systems}{18}{synonym -- -- does not exist} -\setinterfacemessage{systems}{7}{module -- already loaded} -\setinterfacemessage{systems}{6}{module -- not found} -\setinterfacemessage{systems}{14}{forced newpage in list at --} -\setinterfacemessage{systems}{15}{saving buffer --} -\setinterfacemessage{systems}{16}{typesetting buffer --} -\setinterfacemessage{systems}{17}{typesetting verbatim buffer --} -\setinterfacemessage{systems}{13}{mark -- defined --} -\setinterfacemessage{systems}{12}{the utility-file is not sorted, use texutil} -\setinterfacemessage{systems}{11}{building simple util} -\setinterfacemessage{systems}{10}{don't use em in --} -\setinterfacemessage{floatblocks}{1}{-- renumbered / -- => --} -\setinterfacemessage{floatblocks}{3}{-- moved} -\setinterfacemessage{floatblocks}{2}{-- saved} -\setinterfacemessage{floatblocks}{5}{order adapted} -\setinterfacemessage{floatblocks}{4}{-- placed} -\setinterfacemessage{floatblocks}{7}{n of bottom floats limited to --} -\setinterfacemessage{floatblocks}{6}{n of top floats limited to --} -\setinterfacemessage{floatblocks}{9}{order disturbed} -\setinterfacemessage{floatblocks}{8}{less than -- lines} -\setinterfacemessage{floatblocks}{title}{floatblocks} -\setinterfacemessage{floatblocks}{13}{there is nothing to split} -\setinterfacemessage{floatblocks}{12}{undefined} -\setinterfacemessage{floatblocks}{11}{no block given} -\setinterfacemessage{floatblocks}{10}{-- limited} -\setinterfacemessage{interactions}{1}{aspect ratio -- x -- (b x h)} -\setinterfacemessage{interactions}{3}{inactive} -\setinterfacemessage{interactions}{2}{active} -\setinterfacemessage{interactions}{5}{unknown attachment --} -\setinterfacemessage{interactions}{4}{no pagesynchronisation (--) in hmode} -\setinterfacemessage{interactions}{6}{attachment file -- does not exist} -\setinterfacemessage{interactions}{title}{interaction} -\setinterfacemessage{interactions}{21}{-- code inserted} -\setinterfacemessage{regimes}{1}{regime --} -\setinterfacemessage{regimes}{3}{unknown regime --} -\setinterfacemessage{regimes}{2}{regime -- is loaded} -\setinterfacemessage{regimes}{title}{regime} -\setinterfacemessage{structures}{1}{begin of sectionblock --} -\setinterfacemessage{structures}{title}{structure} -\setinterfacemessage{structures}{2}{end of sectionblock --} -\setinterfacemessage{linguals}{1}{patterns -- for -- loaded (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{3}{hyphenations -- for -- loaded (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{2}{no patterns -- for -- (n=--,e=--,m=--) (--,--)} -\setinterfacemessage{linguals}{5}{patterns for -- not loaded} -\setinterfacemessage{linguals}{4}{no hyphenations -- for -- (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{7}{language specific options [--] introduce a -- skip} -\setinterfacemessage{linguals}{6}{language -- is undefined} -\setinterfacemessage{linguals}{9}{language -- is active} -\setinterfacemessage{linguals}{8}{language specific options [--] seamless appended} -\setinterfacemessage{linguals}{title}{language} -\setinterfacemessage{linguals}{10}{patterns --loaded} -\setinterfacemessage{verbatims}{1}{file -- does not exist} -\setinterfacemessage{verbatims}{title}{verbatim} -\setinterfacemessage{filters}{1}{filter -- is loaded} -\setinterfacemessage{filters}{title}{filter} -\setinterfacemessage{filters}{2}{unknown filter --} -\setinterfacemessage{textblocks}{1}{new version, second pass needed} -\setinterfacemessage{textblocks}{3}{reading blocks from --} -\setinterfacemessage{textblocks}{2}{writing blocks to --} -\setinterfacemessage{textblocks}{5}{-- not hidden} -\setinterfacemessage{textblocks}{4}{second pass needed} -\setinterfacemessage{textblocks}{7}{-- hidden} -\setinterfacemessage{textblocks}{6}{-- hidden and processed} -\setinterfacemessage{textblocks}{9}{-- not typeset} -\setinterfacemessage{textblocks}{8}{-- typeset} -\setinterfacemessage{textblocks}{title}{textblocks} -\setinterfacemessage{textblocks}{12}{-- skipped} -\setinterfacemessage{textblocks}{11}{-- loaded and typeset} -\setinterfacemessage{textblocks}{10}{-- loaded and processed} -\setinterfacemessage{encodings}{1}{coding --} -\setinterfacemessage{encodings}{3}{unknown coding --} -\setinterfacemessage{encodings}{2}{coding -- is loaded} -\setinterfacemessage{encodings}{title}{encoding} -\setinterfacemessage{columns}{1}{only -- columns possible} -\setinterfacemessage{columns}{3}{problems, disable balancing} -\setinterfacemessage{columns}{2}{use \string\filbreak\space as alternative} -\setinterfacemessage{columns}{5}{bottom float not yet supported} -\setinterfacemessage{columns}{4}{top float not yet supported} -\setinterfacemessage{columns}{7}{balancing aborted after 100 steps} -\setinterfacemessage{columns}{6}{-- float(s) postponed} -\setinterfacemessage{columns}{9}{check raggedness} -\setinterfacemessage{columns}{8}{balanced in -- step(s)} -\setinterfacemessage{columns}{title}{columns} -\setinterfacemessage{columns}{13}{wide float moved to top of columns} -\setinterfacemessage{columns}{12}{float moved to next column / --} -\setinterfacemessage{columns}{11}{float too wide for column} -\setinterfacemessage{columns}{10}{(less than) 1 line left} -\setinterfacemessage{symbols}{1}{loading symbolset --} -\setinterfacemessage{symbols}{title}{symbols} -\setinterfacemessage{files}{1}{file synonym -- is already used for --} -\setinterfacemessage{files}{title}{files} -\setinterfacemessage{versions}{1}{missing @+} -\setinterfacemessage{versions}{3}{selected pages: --} -\setinterfacemessage{versions}{2}{marking pages} -\setinterfacemessage{versions}{title}{version} -\setinterfacemessage{specials}{1}{-- loaded} -\setinterfacemessage{specials}{3}{-- is reset} -\setinterfacemessage{specials}{2}{no deeper nesting is permitted --} -\setinterfacemessage{specials}{5}{loading definition file --} -\setinterfacemessage{specials}{4}{command -- does not exist} -\setinterfacemessage{specials}{7}{unknown driver --} -\setinterfacemessage{specials}{6}{nesting is not permitted} -\setinterfacemessage{specials}{title}{specials} -\setinterfacemessage{layouts}{1}{textheight adapted with -- at page --} -\setinterfacemessage{layouts}{3}{-- times text postponed} -\setinterfacemessage{layouts}{2}{-- times postponed text placed} -\setinterfacemessage{layouts}{5}{marginblocks inactive} -\setinterfacemessage{layouts}{4}{marginblocks active} -\setinterfacemessage{layouts}{7}{calculating logospace} -\setinterfacemessage{layouts}{6}{subpage set -- processed (size --)} -\setinterfacemessage{layouts}{9}{currently no more than -- levels in itemizations} -\setinterfacemessage{layouts}{8}{calculating backgrounds} -\setinterfacemessage{layouts}{title}{layout} -\setinterfacemessage{layouts}{11}{spacing -- not permitted in gridmode} -\setinterfacemessage{layouts}{10}{-- and -- don't add up to 1.0} -\setinterfacemessage{fonts}{1}{coding --} -\setinterfacemessage{fonts}{3}{unknown variant --} -\setinterfacemessage{fonts}{2}{variant -- is loaded} -\setinterfacemessage{fonts}{5}{style -- is not defined} -\setinterfacemessage{fonts}{4}{bodyfont -- is not defined} -\setinterfacemessage{fonts}{7}{unknown format --} -\setinterfacemessage{fonts}{6}{-- is loaded} -\setinterfacemessage{fonts}{14}{bodyfont -- is defined (can better be done global)} -\setinterfacemessage{fonts}{8}{style -- defined} -\setinterfacemessage{fonts}{title}{bodyfont} -\setinterfacemessage{fonts}{10}{unknown font file --} -\setinterfacemessage{databases}{1}{--} -\setinterfacemessage{databases}{3}{global file --} -\setinterfacemessage{databases}{2}{local file --} -\setinterfacemessage{databases}{4}{unknown file --} -\setinterfacemessage{databases}{title}{databases} -\setinterfacemessage{publications}{1}{file -- not found, unknown style ignored} -\setinterfacemessage{publications}{3}{wrote a new auxiliary file \jobname.aux} -\setinterfacemessage{publications}{title}{publications} -\setinterfacemessage{publications}{2}{file -- not found, waiting for bibtex} -\setinterfacemessage{publications}{4}{loading database from --} -\setinterfacemessage{publications}{5}{warning: cite argument -- on line \the\inputlineno} -\setinterfacemessage{publications}{6}{loading formatting style from --} -\setinterfacemessage{javascript}{1}{loading script set --} -\setinterfacemessage{javascript}{title}{javascript} -\setinterfacemessage{javascript}{2}{unknown preamble --} -\setinterfacemessage{check}{1}{missing or ungrouped '=' after '--' in line --} -\setinterfacemessage{check}{3}{-- -- replaces a macro, use CAPITALS!} -\setinterfacemessage{check}{2}{-- argument(s) expected in line --} -\setinterfacemessage{check}{title}{check} -\setinterfacemessage{metapost}{1}{loading metapost library --} -\setinterfacemessage{metapost}{title}{metapost} -\setinterfacemessage{figures}{1}{figure -- can not be found} -\setinterfacemessage{figures}{3}{dimensions of -- are determined externally} -\setinterfacemessage{figures}{2}{figure -- is not preset} -\setinterfacemessage{figures}{5}{dimensions of -- are unknown} -\setinterfacemessage{figures}{4}{dimensions of -- loaded from figurefile itself} -\setinterfacemessage{figures}{6}{dimensions of -- calculated by rlxtools} -\setinterfacemessage{figures}{8}{figureobject -- is reused} -\setinterfacemessage{figures}{title}{figures} -\setinterfacemessage{colors}{1}{system -- is global activated} -\setinterfacemessage{colors}{3}{-- is not defined --} -\setinterfacemessage{colors}{2}{system -- is local activated} -\setinterfacemessage{colors}{5}{unknown system --} -\setinterfacemessage{colors}{4}{system -- is loaded} -\setinterfacemessage{colors}{7}{palette -- is not available} -\setinterfacemessage{colors}{6}{palette -- is available} -\setinterfacemessage{colors}{9}{-- color space is not supported} -\setinterfacemessage{colors}{8}{specification -- at color -- becomes black} -\setinterfacemessage{colors}{title}{color} -\setinterfacemessage{colors}{12}{-- is registered} -\setinterfacemessage{colors}{11}{color is converted to gray} -\setinterfacemessage{colors}{10}{-- color space is supported} -% -\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-mes.lua b/Master/texmf-dist/tex/context/base/mult-mes.lua index 5c812971136..cdd6d5ad21a 100644 --- a/Master/texmf-dist/tex/context/base/mult-mes.lua +++ b/Master/texmf-dist/tex/context/base/mult-mes.lua @@ -6,2041 +6,1752 @@ if not modules then modules = { } end modules ['mult-mes'] = { license = "see context related readme files" } +-- floatsblocks -> floats +-- bodyfont -> fonts +-- verbatims -> buffers + +-- check all interfaces.showmessage +-- replace all writestatus (tricky as %'s in names, but we can support --) + return { - ["publications"]={ - ["files"]={ "bibl-tra.mkiv" }, - ["title"]={ - ["en"]="publications", - }, - ["1"]={ - ["en"]="file -- not found, unknown style ignored", - }, - ["2"]={ - ["en"]="file -- not found, waiting for bibtex", - }, - ["3"]={ - ["en"]="wrote a new auxiliary file \\jobname.aux", - }, - ["4"]={ - ["en"]="loading database from --", - }, - ["5"]={ - ["en"]="warning: cite argument -- on line \\the\\inputlineno", - }, - ["6"]={ - ["en"]="loading formatting style from --", - }, - }, - ["check"]={ - ["1"]={ - ["cs"]="postradam '=' po '--' na radku --", - ["de"]="Fehlendes '=' nach '--' in Zeile --", - ["en"]="missing or ungrouped '=' after '--' in line --", - ["fr"]="manquant ou dégroupé '=' après '--' à la ligne --", - ["it"]="'=' mancante o non raggruppato dopo '--' alla riga --", - ["nl"]="'=' ontbreekt of zonder {} na '--' in regel --", - ["no"]="manglende '=' etter '--' i linje --", - ["ro"]="lipseste '=' dupa '--' in linia --", - }, - ["2"]={ - ["cs"]="ocekavam -- argument(y) na radku --", - ["de"]="-- Argument(e) in Zeile -- erwartet", - ["en"]="-- argument(s) expected in line --", - ["fr"]="-- argument(s) attendu(s) à la ligne --", - ["it"]="-- argomento/i attesi alla riga --", - ["nl"]="-- argument(en) verwacht in regel --", - ["no"]="-- argument forventet i linje --", - ["ro"]="argumentul(ele) -- sunt asteptate in linia --", - }, - ["3"]={ - ["cs"]="-- -- nahrazuje makro, uzijte VERZALKY!", - ["de"]="-- -- ersetzt ein Makro, verwende VERSALIEN!", - ["en"]="-- -- replaces a macro, use CAPITALS!", - ["fr"]="-- -- remplace une macro, utilisez des MAJUSCULES !", - ["it"]="-- -- sostituisce una macro, usare le MAIUSCOLE!", - ["nl"]="-- -- vervangt een macro, gebruik HOOFDLETTERS!", - ["no"]="-- -- overskygger en makro, bruk STORE BOKSTAVER!", - ["ro"]="-- -- inlocuieste un macro, folositi MAJUSCULE!", - }, - ["files"]={ "mult-sys.tex" }, - ["title"]={ - ["cs"]="kontrola", - ["de"]="check", - ["en"]="check", - ["fr"]="vérification", - ["it"]="controllo", - ["nl"]="controle", - ["no"]="kontroll", - ["ro"]="verificari", - }, - }, - ["colors"]={ - ["1"]={ - ["cs"]="system -- je globalne aktivovana", - ["de"]="system -- ist global aktiviert", - ["en"]="system -- is global activated", - ["fr"]="le système -- est globalement activé", - ["it"]="sistema -- attivato globalmente", - ["nl"]="systeem -- is globaal actief", - ["no"]="system -- er aktivert globalt", - ["ro"]="sistem -- este activata global", - }, - ["10"]={ - ["cs"]="-- prostor barev je podporovan", - ["de"]="-- Farbraum wird unterstuetzt", - ["en"]="-- color space is supported", - ["fr"]="-- l'espace de couleur est supporté", - ["it"]="spazio dei colori -- supportato", - ["nl"]="-- kleurruimte wordt ondersteund", - ["no"]="-- fargerom er støttet", - ["ro"]="spatiul de culoare -- este suportat", - }, - ["11"]={ - ["cs"]="barva je prevedena na sed", - ["de"]="Farbe wird in Grau umgewandelt", - ["en"]="color is converted to gray", - ["fr"]="la couleur est convertie en niveau de gris", - ["it"]="il colore ø convertito in grigio", - ["nl"]="kleur wordt vertaald in grijs", - ["no"]="fargen vil bli vist som grø", - ["ro"]="culoarea este convertita la gri", - }, - ["12"]={ - ["cs"]="-- is registered", - ["de"]="-- is registered", - ["en"]="-- is registered", - ["fr"]="-- est enregistré", - ["it"]="-- is registered", - ["nl"]="-- is geregistreerd", - ["no"]="-- is registered", - ["ro"]="-- is registered", - }, - ["2"]={ - ["cs"]="system -- je lokalne activovana", - ["de"]="system -- ist lokal aktiviert", - ["en"]="system -- is local activated", - ["fr"]="le système -- est localement activé", - ["it"]="sistema -- attivato localmente", - ["nl"]="systeem -- is lokaal actief", - ["no"]="system -- er aktivert lokalt", - ["ro"]="sistem -- este activata local", - }, - ["3"]={ - ["cs"]="-- neni definovana --", - ["de"]="-- ist undefiniert --", - ["en"]="-- is not defined --", - ["fr"]="-- n'est pas défini --", - ["it"]="-- non definito --", - ["nl"]="-- is niet gedefinieerd --", - ["no"]="-- er udefinert --", - ["ro"]="-- nu este definita --", - }, - ["4"]={ - ["cs"]="system -- je nacten", - ["de"]="system -- ist geladen", - ["en"]="system -- is loaded", - ["fr"]="le système -- est chargé", - ["it"]="sistema -- caricato", - ["nl"]="systeem -- wordt geladen", - ["no"]="system -- er lest inn", - ["ro"]="sistem -- este incarcata", - }, - ["5"]={ - ["cs"]="neznamy system --", - ["de"]="unbekanntes System --", - ["en"]="unknown system --", - ["fr"]="système -- inconnu", - ["it"]="sistema -- sconosciuto", - ["nl"]="onbekend systeem --", - ["no"]="ukjent system --", - ["ro"]="sistem -- necunoscuta", - }, - ["6"]={ - ["cs"]="palette -- je k dispozici", - ["de"]="palette -- ist verfuegbar", - ["en"]="palette -- is available", - ["fr"]="la palette -- est disponible", - ["it"]="tavolozza -- resa disponibile", - ["nl"]="palet -- is beschikbaar", - ["no"]="palett -- er tilgjengelig", - ["ro"]="paleta -- este disponibila", - }, - ["7"]={ - ["cs"]="palette -- neni k dispozici", - ["de"]="palette -- ist nicht verfuegbar", - ["en"]="palette -- is not available", - ["fr"]="le palette -- n'est pas disponible", - ["it"]="tavolozza -- non disponibile", - ["nl"]="palet -- is niet beschikbaar", - ["no"]="palett -- er ikke tilgjengelig", - ["ro"]="palette -- nu este disponibila", - }, - ["8"]={ - ["cs"]="specifikace -- v barve -- bude cerna", - ["de"]="Spezifikation -- bei Farbe -- wird schwarz", - ["en"]="specification -- at color -- becomes black", - ["fr"]="la spécification -- de la couleur -- devient noire", - ["it"]="specifica -- del colore -- convertita in nero", - ["nl"]="specificatie -- bij -- wordt zwart", - ["no"]="spesifikasjon -- for farge -- gir kun svart", - ["ro"]="specificatia -- la culoarea -- devine neagra", - }, - ["9"]={ - ["cs"]="-- prostor barev neni podporovan", - ["de"]="-- Farbraum wird nicht unterstuetzt", - ["en"]="-- color space is not supported", - ["fr"]="l'espace de couleur -- n'est pas supporté", - ["it"]="spazio dei colori -- non supportato", - ["nl"]="-- kleurruimte wordt niet ondersteund", - ["no"]="-- fargerom er ikke støttet", - ["ro"]="spatiul de culoare -- nu este suportat", - }, - ["files"]={ "colo-ini.tex" }, - ["title"]={ - ["cs"]="barva", - ["de"]="farbe", - ["en"]="color", - ["fr"]="couleurs", - ["it"]="colore", - ["nl"]="kleur", - ["no"]="farge", - ["ro"]="culori", - }, - }, - ["columns"]={ - ["1"]={ - ["cs"]="je mozno pouze -- sloupcu", - ["de"]="nur -- Spalten moeglich", - ["en"]="only -- columns possible", - ["fr"]="seules -- colonnes possibles", - ["it"]="solo -- colonne possibili", - ["nl"]="maximaal -- kolommen", - ["no"]="maksimalt -- kolonner", - ["ro"]="este posibil numai -- coloane", - }, - ["10"]={ - ["cs"]="zbyl (mene nez) 1 radek", - ["de"]="(weniger als) 1 Zeile uebrig", - ["en"]="(less than) 1 line left", - ["fr"]="(moins de) 1 ligne restante", - ["it"]="(meno di) una riga rimasta", - ["nl"]="(minder dan) 1 regel over", - ["no"]="(mindre enn) 1 linje igjen", - ["ro"]="a mai ramas (mai putin de) 1 linie", - }, - ["11"]={ - ["cs"]="plovouci objekt je pro sloupec prilis siroky", - ["de"]="Gleitobjekt zu breit fuer Spalte", - ["en"]="float too wide for column", - ["fr"]="flottant mis à la largeur de la colonne", - ["it"]="oggetto mobile troppo ampio per la colonna", - ["nl"]="plaatsblok te breed voor kolom", - ["no"]="flytblokk for bredt for kolonna", - ["ro"]="blocul este prea lat pentru coloana", - }, - ["12"]={ - ["cs"]="plovouci objekt je presunut do nasledujiciho sloupce / --", - ["de"]="Gleitobjekt in naechste Zeile verschoben / --", - ["en"]="float moved to next column / --", - ["fr"]="flottant déplacé à la colonne suivante / --", - ["it"]="oggetto mobile spostata alla colonna successiva / --", - ["nl"]="plaatsblok verplaatst naar volgende kolom / --", - ["no"]="flytblokk forskjøvet til neste kolonne / --", - ["ro"]="blocul este mutat pe urmatoarea coloana / --", - }, - ["13"]={ - ["cs"]="siroky plovouci objekt je presunut nad sloupce", - ["de"]="breites Gleitobjekt an den Anfang der Spalten verschoben", - ["en"]="wide float moved to top of columns", - ["fr"]="flottant large déplacé dans la partie supérieure de la colonne", - ["it"]="oggetto mobile ampio spostato sopra le colonne", - ["nl"]="breed figuur geplaatst boven kolommen", - ["no"]="bred flytblokk forksjøvet til toppen av kolonnene", - ["ro"]="blocul lat este mutat in partea de sus a coloanelor", - }, - ["2"]={ - ["cs"]="pouzijte \\string\\filbreak\\space jako alternativu", - ["de"]="benutzte \\string\\filbreak\\space als Alternative", - ["en"]="use \\string\\filbreak\\space as alternative", - ["fr"]="utilisez \\string\\filbreak\\space en tant qu'alternative", - ["it"]="in alternativa, usare \\string\\filbreak", - ["nl"]="gebruik eventueel \\string\\filbreak", - ["no"]="bruk \\string\\filbreak\\space som et alternativ", - ["ro"]="folositi \\string\\filbreak\\space ca alternativa", - }, - ["3"]={ - ["cs"]="problem, vypina se vyvazovani", - ["de"]="Problem, verwende [ausgleich=nein]", - ["en"]="problems, disable balancing", - ["fr"]="problèmes, désactive l'équilibrage", - ["it"]="problemi, disabilitare il bilanciamento", - ["nl"]="probleempje, probeer [balanceren=nee]", - ["no"]="problemer, slår av balansering", - ["ro"]="probleme, se dezactiveaza alinierea", - }, - ["4"]={ - ["cs"]="horni plovouci objekt jeste neni podporovan", - ["de"]="Gleitobjekt oben ncoh nicht unterstuetzt", - ["en"]="top float not yet supported", - ["fr"]="flottant en partie supérieure pas encore supporté", - ["it"]="float in cima non ancora supportato", - ["nl"]="plaatsblok boven nog niet mogelijk", - ["no"]="flytblokker øverst er ikke støttet enda", - ["ro"]="cadrele top (top float) nu sunt inca suportate", - }, - ["5"]={ - ["cs"]="spodni plovouci objekt jeste neni podporovan", - ["de"]="Gleitobjekt unten ncoh nicht unterstuetzt", - ["en"]="bottom float not yet supported", - ["fr"]="flottant en partie inférieure pas encore supporté", - ["it"]="float in fondo non ancora supportato", - ["nl"]="plaatsblok onder nog niet mogelijk", - ["no"]="flytblokker nedert er ikke støttet enda", - ["ro"]="cadrele bottom (bottom float) nu sunt inca suportate", - }, - ["6"]={ - ["cs"]="-- plovouci objekt(y) odlozeny", - ["de"]="-- Gleitobjekt(e) verschoben", - ["en"]="-- float(s) postponed", - ["fr"]="-- flottant(s) reporté(s)", - ["it"]="-- float(s) posticipate", - ["nl"]="-- plaatsblok(en) opgeschort", - ["no"]="-- flytblokk forskjøvet", - ["ro"]="-- blocurile sunt amanate", - }, - ["7"]={ - ["cs"]="vyvazovani ukonceno po 100 krocich", - ["de"]="ausgleich nach 100 Schritten abgebrocheb", - ["en"]="balancing aborted after 100 steps", - ["fr"]="équilibrage abandonné après 100 pas", - ["it"]="bilanciamento annullato dopo 100 passi", - ["nl"]="balanceren afgebroken na 100 stappen", - ["no"]="balansering avbrutt etter 100 iterasjoner", - ["ro"]="alinierea este oprita dupa 100 de incercari", - }, - ["8"]={ - ["cs"]="vyvazeno v -- krocich", - ["de"]="ausgeglichen nach -- Schritt(en)", - ["en"]="balanced in -- step(s)", - ["fr"]="équilibré en -- pas", - ["it"]="bilanciamento in -- passo/i", - ["nl"]="gebalanceerd in -- stap(pen)", - ["no"]="balansert etter -- iterasjoner", - ["ro"]="aliniat in -- pas(i)", - }, - ["9"]={ - ["cs"]="kontrola nerovnost", - ["de"]="Ausrichtung ueberpruefen", - ["en"]="check raggedness", - ["fr"]="vérification des irrégularités", - ["it"]="controllare seghettamento", - ["nl"]="uitlijnen controleren!", - ["no"]="kontroller tekstlayout!", - ["ro"]="verificat alinierea", - }, - ["files"]={ "page-ini.tex" }, - ["title"]={ - ["cs"]="sloupce", - ["de"]="Spalten", - ["en"]="columns", - ["fr"]="colonnes", - ["it"]="colonne", - ["nl"]="kolommen", - ["no"]="kolonner", - ["ro"]="coloane", - }, - }, - ["databases"]={ - ["1"]={ - ["cs"]="--", - ["de"]="--", - ["en"]="--", - ["fr"]="--", - ["it"]="--", - ["nl"]="--", - ["no"]="--", - ["ro"]="--", - }, - ["2"]={ - ["cs"]="local file --", - ["de"]="lokale Datei --", - ["en"]="local file --", - ["fr"]="fichier local --", - ["it"]="file locale --", - ["nl"]="lokaal bestand --", - ["no"]="lokal fil --", - ["ro"]="fisier local --", - }, - ["3"]={ - ["cs"]="global file --", - ["de"]="globale Datei --", - ["en"]="global file --", - ["fr"]="fichier global --", - ["it"]="file globale --", - ["nl"]="globaal bestand --", - ["no"]="global fil --", - ["ro"]="fisier global --", - }, - ["4"]={ - ["cs"]="unknown file --", - ["de"]="unbekannte Datei --", - ["en"]="unknown file --", - ["fr"]="fichier inconnu --", - ["it"]="file sconosciuto --", - ["nl"]="onbekend bestand --", - ["no"]="ukjent fil --", - ["ro"]="fisier necunoscut --", - }, - ["files"]={ "core-dat.tex" }, - ["title"]={ - ["cs"]="databases", - ["de"]="Datenbank", - ["en"]="databases", - ["fr"]="bases de données", - ["it"]="database", - ["nl"]="database", - ["no"]="databaser", - ["ro"]="baze de date", - }, - }, - ["documents"]={ - ["1"]={ - ["de"]="Blatt --", - ["en"]="sheet --", - ["nl"]="sheet --", - }, - ["2"]={ - ["de"]="Nummer --", - ["en"]="number --", - ["nl"]="nummer --", - }, - ["files"]={ "docs-bri.tex", "docs-she.tex" }, - ["title"]={ - ["de"]="Blaetter", - ["en"]="sheets", - ["nl"]="sheets", - }, - }, - ["encodings"]={ - ["1"]={ - ["cs"]="kodovani --", - ["de"]="Kodierung --", - ["en"]="coding --", - ["fr"]="encodage --", - ["it"]="codifica --", - ["nl"]="codering --", - ["no"]="koding --", - ["ro"]="codificarea --", - }, - ["2"]={ - ["cs"]="je nacteno kodovani --", - ["de"]="Kodierung -- ist geladen", - ["en"]="coding -- is loaded", - ["fr"]="l'encodage -- est chargé", - ["it"]="codifica -- caricata", - ["nl"]="codering -- wordt geladen", - ["no"]="koding -- er lest inn", - ["ro"]="codificarea -- este Encarcata", - }, - ["3"]={ - ["cs"]="nezname kodovani --", - ["de"]="Unbekannte Kodierung --", - ["en"]="unknown coding --", - ["fr"]="encodage -- inconnu", - ["it"]="codifica sconosciuta --", - ["nl"]="onbekende codering --", - ["no"]="ukjent koding --", - ["ro"]="codificarea -- este necunoscuta", - }, - ["files"]={ "enco-ini.mkii" }, - ["title"]={ - ["cs"]="kodovani", - ["de"]="Kodierung", - ["en"]="encoding", - ["fr"]="encodage", - ["it"]="codifica", - ["nl"]="encoding", - ["no"]="koding", - ["ro"]="codificari", - }, - }, - ["figures"]={ - ["1"]={ - ["cs"]="obraz -- nelze nalezt", - ["de"]="Abbildung -- kann nicht gefunden werden", - ["en"]="figure -- can not be found", - ["fr"]="la figure -- ne peut être trouvée", - ["it"]="figura -- non trovata", - ["nl"]="figuur -- is niet te vinden", - ["ro"]="figura -- nu poate fi gasita", - }, - ["2"]={ - ["cs"]="obraz -- nepritomen", - ["de"]="Abbildung -- wird nicht erstellt", - ["en"]="figure -- is not preset", - ["fr"]="la figure -- n'est pas pré-sélectionnée", - ["it"]="la figura -- non è preimpostata", - ["nl"]="figuur -- wordt niet preset", - ["ro"]="figura -- nu este presetata", - }, - ["3"]={ - ["cs"]="dimensions of -- are determined externally", - ["de"]="dimensions of -- are determined externally", - ["en"]="dimensions of -- are determined externally", - ["fr"]="dimensions of -- are determined externally", - ["it"]="dimensions of -- are determined externally", - ["nl"]="maten van -- worden extern vastgesteld", - ["ro"]="dimensions of -- are determined externally", - }, - ["4"]={ - ["cs"]="dimenze obrazu -- nacteny primo z jeho souboru", - ["de"]="Dimensionen von -- geladen aus der Abbildungsdatei selbst", - ["en"]="dimensions of -- loaded from figurefile itself", - ["fr"]="les dimensions de -- chargées implicitement à partir du fichier de figure", - ["it"]="dimensioni di -- caricate dal file di immagini stesso", - ["nl"]="maten van -- geladen uit figuurfile zelf", - ["ro"]="dimensiunea figurii -- se incarca din fisierul insusi", - }, - ["5"]={ - ["cs"]="dimensions of -- are unknown", - ["de"]="Dimensions of -- are unknown", - ["en"]="dimensions of -- are unknown", - ["fr"]="dimensions of -- are unknown", - ["it"]="dimensions of -- are unknown", - ["nl"]="maten van -- zijn onbekend", - ["ro"]="dimensions of -- are unknown", - }, - ["6"]={ - ["cs"]="dimenze obrazu -- spocteny programem rlxtools", - ["de"]="Dimensionen von -- ausgerechnet durch rlxtools", - ["en"]="dimensions of -- calculated by rlxtools", - ["fr"]="les dimensions de -- calculées par rlxtools", - ["it"]="dimensioni di -- calcolate da rlxtools", - ["nl"]="maten van -- berekend door rlxtools", - ["ro"]="dimensiunea figurii -- este calculata de rlxtools", - }, - ["8"]={ - ["cs"]="obrazovy objekt -- je znovu pouzit", - ["de"]="Abbildungobjekt -- wurde wiederverwandt", - ["en"]="figureobject -- is reused", - ["fr"]="figureobject -- est réutilisé", - ["it"]="oggetto-figura -- riutilizzato", - ["nl"]="figuurobject -- wordt opnieuw gebruikt", - ["ro"]="obiectul figura -- este refolosit", - }, - ["files"]={ "core-inc.mkii" }, - ["title"]={ - ["cs"]="obrazy", - ["de"]="Abbildungen", - ["en"]="figures", - ["fr"]="figures", - ["it"]="figure", - ["nl"]="figuren", - ["ro"]="figuri", - }, - }, - ["files"]={ - ["1"]={ - ["cs"]="synonymum souboru -- je jiz pouzito pro --", - ["de"]="Dateisynonym -- wird bereits fuer -- benutzt", - ["en"]="file synonym -- is already used for --", - ["fr"]="le synonyme de fichier -- est déjà utilisé pour --", - ["it"]="sinonimo file -- già in uso per --", - ["nl"]="file synoniem -- is al in gebruik voor --", - ["no"]="filesynonym -- er allerede brukt for --", - ["ro"]="sinonimul fisierelor -- este folosit deja pentru --", - }, - ["files"]={ "core-fil.tex" }, - ["title"]={ - ["cs"]="soubory", - ["de"]="files", - ["en"]="files", - ["fr"]="fichiers", - ["it"]="file", - ["nl"]="files", - ["no"]="filer", - ["ro"]="fisiere", - }, - }, - ["filters"]={ - ["1"]={ - ["cs"]="filter -- is loaded", - ["de"]="filter -- ist geladen", - ["en"]="filter -- is loaded", - ["fr"]="le filtre -- est chargé", - ["it"]="filtro -- caricato", - ["nl"]="filter -- wordt geladen", - }, - ["2"]={ - ["cs"]="unknown filter --", - ["de"]="unknown filter --", - ["en"]="unknown filter --", - ["fr"]="filtre -- inconnu", - ["it"]="filtro sconosciuto --", - ["nl"]="onbekend filter --", - }, - ["files"]={ "filt-ini.tex" }, - ["title"]={ - ["cs"]="filter", - ["de"]="filter", - ["en"]="filter", - ["fr"]="filtre", - ["it"]="filtri", - ["nl"]="filter", - }, - }, - ["floatblocks"]={ - ["1"]={ - ["cs"]="-- precislovano / -- => --", - ["de"]="-- neu nummeriert / -- => --", - ["en"]="-- renumbered / -- => --", - ["fr"]="-- renuméroté / -- => --", - ["it"]="-- rinumerato / -- => --", - ["nl"]="-- hernummerd / -- => --", - ["no"]="-- renummerert / -- => --", - ["ro"]="-- renumerotat / -- => --", - }, - ["10"]={ - ["cs"]="-- omezeno", - ["de"]="-- begrenzt", - ["en"]="-- limited", - ["fr"]="-- limité", - ["it"]="-- limitato", - ["nl"]="-- begrensd", - ["no"]="-- begrenset", - ["ro"]="-- limitat", - }, - ["11"]={ - ["cs"]="nedan zadny blok", - ["de"]="kein Block gegeben", - ["en"]="no block given", - ["fr"]="pas de bloc donné", - ["it"]="nessun oggetto specificato", - ["nl"]="geen blok opgegeven", - ["no"]="ingen blokk oppgitt", - ["ro"]="nu este dat nici un bloc", - }, - ["12"]={ - ["cs"]="nedefinovano", - ["de"]="undefiniert", - ["en"]="undefined", - ["fr"]="indéfini", - ["it"]="non definito", - ["nl"]="niet gedefinieerd", - ["no"]="udefinert", - ["ro"]="nedefinit", - }, - ["13"]={ - ["cs"]="there is nothing to split", - ["de"]="there is nothing to split", - ["en"]="there is nothing to split", - ["fr"]="there is nothing to split", - ["it"]="there is nothing to split", - ["nl"]="er is niets te splitsen", - ["no"]="there is nothing to split", - ["ro"]="there is nothing to split", - }, - ["2"]={ - ["cs"]="-- ulozeno", - ["de"]="-- gespeichert", - ["en"]="-- saved", - ["fr"]="-- sauvegardé", - ["it"]="-- salvato", - ["nl"]="-- bewaard", - ["no"]="-- lagret", - ["ro"]="-- salvat", - }, - ["3"]={ - ["cs"]="-- presunuto", - ["de"]="-- verschoben", - ["en"]="-- moved", - ["fr"]="-- déplacé", - ["it"]="-- mosso", - ["nl"]="-- verplaatst", - ["no"]="-- flyttet", - ["ro"]="-- mutat", - }, - ["4"]={ - ["cs"]="-- umisteno", - ["de"]="-- plaziert", - ["en"]="-- placed", - ["fr"]="-- placé", - ["it"]="-- sistemato", - ["nl"]="-- geplaatst", - ["no"]="-- plassert", - ["ro"]="-- plasat", - }, - ["5"]={ - ["cs"]="poradi prizpusobeno", - ["de"]="Reihenfolge angepasst", - ["en"]="order adapted", - ["fr"]="ordre adapté", - ["it"]="ordine aggiustato", - ["nl"]="volgorde aangepast", - ["no"]="rekkefølge tilpasset", - ["ro"]="ordinea adaptata", - }, - ["6"]={ - ["cs"]="pocet hornich plovoucich objektu je omezen na --", - ["de"]="Anz. der oberen Gleitobjekte beschraengt auf --", - ["en"]="n of top floats limited to --", - ["fr"]="n flottants de haut de page limité à --", - ["it"]="n di top floats limitato a --", - ["nl"]="maximaal -- boven", - ["no"]="maksimalt -- flytblokker øverst", - ["ro"]="nr. cadrelor de sus limitat la --", - }, - ["7"]={ - ["cs"]="pocet spodnich plovoucich objektu je omezen na --", - ["de"]="Anz. der unteren Gleitobjekte beschraengt auf --", - ["en"]="n of bottom floats limited to --", - ["fr"]="n flottants de bas de page limité à --", - ["it"]="n di bottom floats limitato a --", - ["nl"]="maximaal -- onder", - ["no"]="maksimalt -- flytblokker nederst", - ["ro"]="nr. blocurilor de jos limitat la --", - }, - ["8"]={ - ["cs"]="radku je mene nez --", - ["de"]="weniger als -- zeilen", - ["en"]="less than -- lines", - ["fr"]="moins de -- lignes", - ["it"]="meno di -- righe", - ["nl"]="minder dan -- regels", - ["no"]="mindre enn -- linjer", - ["ro"]="mai putin de -- linii", - }, - ["9"]={ - ["cs"]="poradi naruseno", - ["de"]="Reigenfolge gestoert", - ["en"]="order disturbed", - ["fr"]="ordre perturbé", - ["it"]="ordine disturbato", - ["nl"]="volgorde verstoord", - ["no"]="rekkefølge endret", - ["ro"]="ordinea deranjata", - }, - ["files"]={ "page-flt.tex", "strc-flt.tex" }, - ["title"]={ - ["cs"]="plovouciobjekty", - ["de"]="Gleitobjektbloecke", - ["en"]="floatblocks", - ["fr"]="blocs de flottants", - ["it"]="oggetti mobili", - ["nl"]="plaatsblokken", - ["no"]="flytblokker", - ["ro"]="Blocuri", - }, - }, - ["fonts"]={ - ["1"]={ - ["cs"]="kodovani --", - ["de"]="Kodierung --", - ["en"]="coding --", - ["fr"]="encodage --", - ["it"]="codifica --", - ["nl"]="codering --", - ["no"]="koding --", - ["ro"]="codificarea --", - }, - ["10"]={ - ["cs"]="neznamy font --", - ["de"]="unbekanntes Font --", - ["en"]="unknown font file --", - ["fr"]="fichier de police -- inconnu", - ["it"]="file di font sconosciuto --", - ["nl"]="onbekende font file --", - ["no"]="ukjent fontfil --", - ["ro"]="fisier font necunoscut --", - }, - ["14"]={ - ["cs"]="bodyfont -- is defined (can better be done global)", - ["de"]="Fliesstext -- wurde definiert (besser waere globale Definition)", - ["en"]="bodyfont -- is defined (can better be done global)", - ["fr"]="policecorps -- est défini (une définition globale pourrait être plus adéquat)", - ["it"]="corpo del testo -- definito (sarebbe meglio globale)", - ["nl"]="korps -- is gedefinieerd (kan beter globaal plaatsvinden)", - ["no"]="bodyfont -- is defined (can better be done global)", - ["ro"]="bodyfont -- is defined (can better be done global)", - }, - ["2"]={ - ["cs"]="varianta -- je nactena", - ["de"]="Variante -- ist geladen", - ["en"]="variant -- is loaded", - ["fr"]="la variante -- est chargée", - ["it"]="variante -- caricata", - ["nl"]="variant -- wordt geladen", - ["no"]="variant -- er lest inn", - ["ro"]="varianta -- este incarcata", - }, - ["3"]={ - ["cs"]="neznama varianta --", - ["de"]="Unbekannte Variante --", - ["en"]="unknown variant --", - ["fr"]="variante -- inconnue", - ["it"]="variante sconosciuta --", - ["nl"]="onbekende variant --", - ["no"]="ukjent variant --", - ["ro"]="varianta necunoscuta --", - }, - ["4"]={ - ["cs"]="zakladni font -- neni definovan", - ["de"]="Fliesstext -- ist nicht definiert", - ["en"]="bodyfont -- is not defined", - ["fr"]="policecorps -- n'est pas définie", - ["it"]="corpo del testo -- non definito", - ["nl"]="korps -- is niet gedefinieerd", - ["no"]="hovedfont -- er ikke definert", - ["ro"]="corpul de litere -- nu este definit", - }, - ["5"]={ - ["cs"]="styl -- neni definovan", - ["de"]="Stil -- ist nicht definiert", - ["en"]="style -- is not defined", - ["fr"]="le style -- n'est pas défini", - ["it"]="stile -- non definito", - ["nl"]="stijl -- is niet gedefinieerd", - ["no"]="stil -- er ikke definert", - ["ro"]="stilul -- nu este definit", - }, - ["6"]={ - ["cs"]="-- je nacten", - ["de"]="-- ist geladen", - ["en"]="-- is loaded", - ["fr"]="-- est chargé", - ["it"]="-- caricato", - ["nl"]="-- wordt geladen", - ["no"]="-- er lest inn", - ["ro"]="-- este incarcat", - }, - ["7"]={ - ["cs"]="neznamy format --", - ["de"]="unbekanntes Format --", - ["en"]="unknown format --", - ["fr"]="format -- inconnu", - ["it"]="formato sconosciuto --", - ["nl"]="onbekend formaat --", - ["no"]="ukjent format --", - ["ro"]="format necunoscut --", - }, - ["8"]={ - ["cs"]="styl -- definovan", - ["de"]="Stil -- definiert", - ["en"]="style -- defined", - ["fr"]="style -- défini", - ["it"]="stile -- definito", - ["nl"]="stijl -- gedefinieerd", - ["no"]="stil -- definert", - ["ro"]="stilul -- definit", - }, - ["files"]={ "font-ini.mkii", "font-ini.mkiv" }, - ["title"]={ - ["cs"]="zakladnifont", - ["de"]="Fliesstext", - ["en"]="bodyfont", - ["fr"]="corps de texte", - ["it"]="font del corpo", - ["nl"]="korps", - ["no"]="hovedfont", - ["ro"]="corp de litere", - }, - }, - ["handlings"]={ - ["1"]={ - ["cs"]="font handling --", - ["de"]="Font Verarbeitung --", - ["en"]="font handling --", - ["fr"]="manipulation -- de police", - ["it"]="font handling --", - ["nl"]="font afhandeling --", - ["no"]="font handling --", - ["ro"]="font handling --", - }, - ["2"]={ - ["cs"]="font handling -- is loaded", - ["de"]="Font Verarbeitung -- ist geladen", - ["en"]="font handling -- is loaded", - ["fr"]="la manipulation -- de police est chargée", - ["it"]="font handling -- is loaded", - ["nl"]="font afhandeling -- wordt geladen", - ["no"]="font handling -- is loaded", - ["ro"]="font handling -- is loaded", - }, - ["3"]={ - ["cs"]="unknown font handling --", - ["de"]="unknown font handling --", - ["en"]="unknown font handling --", - ["fr"]="manipulation -- inconnue de police", - ["it"]="unknown font handling --", - ["nl"]="onbekende font afhandeling --", - ["no"]="unknown font handling --", - ["ro"]="unknown font handling --", - }, - ["files"]={ "hand-ini.mkii" }, - ["title"]={ - ["cs"]="handling", - ["de"]="handling", - ["en"]="handling", - ["fr"]="manipulation", - ["it"]="handling", - ["nl"]="handling", - ["no"]="handling", - ["ro"]="handling", - }, - }, - ["interactions"]={ - ["1"]={ - ["cs"]="pomer -- x -- (s x v)", - ["de"]="Seitenverhaeltnis -- x -- (B x H)", - ["en"]="aspect ratio -- x -- (b x h)", - ["fr"]="ratio d'aspect -- x -- (b x h)", - ["it"]="rapporto -- x -- (b x a)", - ["nl"]="aspect ratio -- x -- (b x h)", - ["no"]="forholdstall -- x -- (b x h)", - ["ro"]="aspectul -- x -- (b x h)", - }, - ["2"]={ - ["cs"]="aktivni", - ["de"]="aktiv", - ["en"]="active", - ["fr"]="actif", - ["it"]="attiva", - ["nl"]="actief", - ["no"]="aktiv", - ["ro"]="activ", - }, - ["21"]={ - ["cs"]="-- kod vlozen", - ["de"]="-- Code eingefuegt", - ["en"]="-- code inserted", - ["fr"]="-- code inseré", - ["it"]="codice -- inserito", - ["nl"]="-- code tussengevoegd", - ["no"]="-- kode satt inn / tilføyd", - ["ro"]="-- cod inserat", - }, - ["3"]={ - ["cs"]="neaktivni", - ["de"]="inaktiv", - ["en"]="inactive", - ["fr"]="inactif", - ["it"]="inattiva", - ["nl"]="niet actief", - ["no"]="inaktiv", - ["ro"]="inactiv", - }, - ["4"]={ - ["cs"]="zadna strankova synchronizace (--) v hmode", - ["de"]="keine Seitensynchronisation (--) im hmode", - ["en"]="no pagesynchronisation (--) in hmode", - ["fr"]="pas de synchronisation de page (--) dans le hmode", - ["it"]="sincronizzazione di pagina (--) non disponibile in hmode", - ["nl"]="geen paginasynchronisatie (--) in hmode", - ["no"]="ingen sidesynkronisering (--) i hmode", - ["ro"]="nu exista sincronizare pt. pagini (--) in hmode", - }, - ["5"]={ - ["cs"]="unknown attachment --", - ["de"]="unknown attachment --", - ["en"]="unknown attachment --", - ["fr"]="le fichier joint -- est inconnu", - ["it"]="unknown attachment --", - ["nl"]="onbekend attachment --", - ["no"]="unknown attachment --", - ["ro"]="unknown attachment --", - }, - ["6"]={ - ["cs"]="attachment file -- does not exist", - ["de"]="attachment file -- does not exist", - ["en"]="attachment file -- does not exist", - ["fr"]="le fichier joint -- n'existe pas", - ["it"]="attachment file -- does not exist", - ["nl"]="attachment file -- bestaat niet", - ["no"]="attachment file -- does not exist", - ["ro"]="attachment file -- does not exist", - }, - ["files"]={ "core-int.tex", "spec-ini.tex" }, - ["title"]={ - ["cs"]="interakce", - ["de"]="Interaktion", - ["en"]="interaction", - ["fr"]="interaction", - ["it"]="interazione", - ["nl"]="interactie", - ["no"]="interaksjon", - ["ro"]="interactiuni", - }, - }, - ["javascript"]={ - ["1"]={ - ["cs"]="nacita se soubor skriptu --", - ["de"]="Lade Scriptdatei --", - ["en"]="loading script set --", - ["fr"]="chargement du jeu de script --", - ["it"]="caricamento dello script set --", - ["nl"]="script set -- wordt geladen", - ["no"]="leser inn scriptsett --", - ["ro"]="se incarca scriptul --", - }, - ["2"]={ - ["cs"]="neznama preambule --", - ["de"]="unbekannte Preamble --", - ["en"]="unknown preamble --", - ["fr"]="préambule -- inconnu", - ["it"]="preambolo sconosciuto --", - ["nl"]="onbekende preamble --", - ["no"]="ukjent 'preamble' --", - ["ro"]="preambul necunoscut --", - }, - ["files"]={ "java-ini.tex" }, - ["title"]={ - ["cs"]="javascript", - ["de"]="javascript", - ["en"]="javascript", - ["fr"]="javascript", - ["it"]="javascript", - ["nl"]="javascript", - ["no"]="javascript", - ["ro"]="javascript", - }, - }, - ["layouts"]={ - ["1"]={ - ["cs"]="vyska textu prizpusobena s -- na strane --", - ["de"]="Texthoehe angepasst mit -- auf Seite --", - ["en"]="textheight adapted with -- at page --", - ["fr"]="hauteurtexte adaptée avec -- à la page --", - ["it"]="altezza del testo adattata con -- a pagina --", - ["nl"]="teksthoogte aangepast met -- op pagina --", - ["no"]="teksthøyde tilpasset med -- på side --", - ["ro"]="textheight adaptat cu -- la pagina --", - }, - ["10"]={ - ["cs"]="-- a -- nedava dohromady 1.0", - ["de"]="-- und -- ergeben zusammen nicht 1.0", - ["en"]="-- and -- don't add up to 1.0", - ["fr"]="-- et -- ne sont pas ajoutés à 1.0", - ["it"]="-- e -- non sommano a 1.0", - ["nl"]="-- en -- tellen niet op tot 1.0", - ["no"]="-- og -- er ikke 1.0 til sammen", - ["ro"]="-- si -- nu se adauga pana la 1.0", - }, - ["11"]={ - ["cs"]="svisla mezera -- neni povolena v pevnem radkovem rejstriku", - ["de"]="Zwischenraum -- nicht im Grittermoduserlau", - ["en"]="spacing -- not permitted in gridmode", - ["fr"]="espacement -- non permis en modegrille", - ["it"]="spaziatura -- non permessa in modo griglia", - ["nl"]="interlinie -- niet toegestaan in gridmode", - ["no"]="mellomrom -- ikke tillatt i gridmodus", - ["ro"]="spatierea -- nu este permisa in gridmode", - }, - ["2"]={ - ["cs"]="-- krat odlozeny text umisten", - ["de"]="-- mal verschobener Text plaziert", - ["en"]="-- times postponed text placed", - ["fr"]="-- times postponed text placed", - ["it"]="posizionato testo posticipato -- volte", - ["nl"]="-- maal uitgestelde tekst tussengevoegd", - ["no"]="-- ganger forskjøvet tekst plassert", - ["ro"]="textul amanat de -- ori a fost plasat", - }, - ["3"]={ - ["cs"]="-- krat text odlozen", - ["de"]="-- mal Text verschoben", - ["en"]="-- times text postponed", - ["fr"]="-- times text postponed", - ["it"]="testo posticipato -- volte", - ["nl"]="-- maal tekst plaatsen uitstellen", - ["no"]="-- ganger tekst forskjøvet", - ["ro"]="textul amanat de -- ori", - }, - ["4"]={ - ["cs"]="okrajove bloky aktivni", - ["de"]="marginalbloecke aktiv", - ["en"]="marginblocks active", - ["fr"]="blocsmarge actifs", - ["it"]="blocchi in margine attivi", - ["nl"]="margeblokken actief", - ["no"]="margblokker aktive", - ["ro"]="blocuri marginale active", - }, - ["5"]={ - ["cs"]="okrajove bloky neaktivni", - ["de"]="marginalbloecke inaktiv", - ["en"]="marginblocks inactive", - ["fr"]="blocsmarge inactifs", - ["it"]="blocchi in margine inattivi", - ["nl"]="margeblokken inactief", - ["no"]="margblokker inaktive", - ["ro"]="blocuri marginale inactive", - }, - ["6"]={ - ["cs"]="sada stran -- zpracovana (velikost --)", - ["de"]="Unterseitenfolge -- verarbeitet (Groesse --)", - ["en"]="subpage set -- processed (size --)", - ["fr"]="jeu de souspage -- traité (taille --)", - ["it"]="gruppo di sottopagine -- elaborato (dimensione --)", - ["nl"]="subpagina reeks -- verwerkt (aantal --)", - ["no"]="delside sett -- behandlet (størrelse --)", - ["ro"]="setul -- de subpagini procesat (dimensiunea --)", - }, - ["7"]={ - ["cs"]="pocita se misto pro logo", - ["de"]="berechne Platzbedarf des Logos", - ["en"]="calculating logospace", - ["fr"]="calcul de l'espace pour le logo", - ["it"]="calcolo dello spazio per logo", - ["nl"]="beeldmerken berekenen", - ["no"]="beregner plass for logo", - ["ro"]="se calculeaza spatiul pentru logo", - }, - ["8"]={ - ["cs"]="pocita se pozadi", - ["de"]="berechne Hintergrund", - ["en"]="calculating backgrounds", - ["fr"]="calcul des arrières-plans", - ["it"]="calcolo dello sfondo", - ["nl"]="achtergronden berekenen", - ["no"]="beregner bakgrunn", - ["ro"]="se calculeaza fundalurile", - }, - ["9"]={ - ["cs"]="aktualne ne vice nez -- urovne/urovni vyctu", - ["de"]="z.Z. nicht mehr als -- Ebenen in Aufzaehlungen", - ["en"]="currently no more than -- levels in itemizations", - ["fr"]="pas plus de -- niveaux pour l'instant dans les élémentarisations", - ["it"]="attualmente non più di -- livelli di elencazione", - ["nl"]="momenteel maximaal -- niveaus in opsommingen", - ["no"]="for øyeblikket maksimalt -- nivåer i opplisting", - ["ro"]="acum nu se supota mai mult de -- nivele de adancime la iteratii", - }, - ["files"]={ "core-itm.tex", "page-bck.mkii", "page-bck.mkiv", "page-ini.tex", "page-log.tex", "strc-itm.tex" }, - ["title"]={ - ["cs"]="layout", - ["de"]="Layout", - ["en"]="layout", - ["fr"]="calque", - ["it"]="layout", - ["nl"]="layout", - ["no"]="layout", - ["ro"]="aranjamente", - }, - }, - ["linguals"]={ - ["1"]={ - ["cs"]="vzory -- pro -- nacteny (n=--,e=--,m=--)", - ["de"]="Trennmuster -- fuer -- geladen (n=--,e=--,m=--)", - ["en"]="patterns -- for -- loaded (n=--,e=--,m=--)", - ["fr"]="les motifs -- pour -- sont chargés (n=--,e=--,m=--)", - ["it"]="schemi -- per -- caricati (n=--,e=--,m=--)", - ["nl"]="afbreekpatronen -- voor -- geladen (n=--,e=--,m=--)", - ["no"]="orddelingsmønster -- for -- er lest inn (n=--,e=--,m=--)", - ["ro"]="sablonul -- pentru -- s-a incarcat (n=--,e=--,m=--)", - }, - ["10"]={ - ["cs"]="vzory --nacteny", - ["de"]="Trennmuster --geladen", - ["en"]="patterns --loaded", - ["fr"]="motifs -- chargés", - ["it"]="schemi -- caricati", - ["nl"]="patronen --geladen", - ["no"]="orddelingsmønster -- er lest inn", - ["ro"]="sabloanele -- incarcate", - }, - ["2"]={ - ["cs"]="zadne vzory -- pro -- (n=--,e=--,m=--) (--,--)", - ["de"]="Keine Trennmuster -- fuer -- (n=--,e=--,m=--) (--,--)", - ["en"]="no patterns -- for -- (n=--,e=--,m=--) (--,--)", - ["fr"]="pas de motifs -- pour -- (n=--,e=--,m=--) (--,--)", - ["it"]="niente schemi -- per -- (n=--,e=--,m=--) (--,--)", - ["nl"]="geen afbreekpatronen -- voor -- (n=--,e=--,m=--) (--,--)", - ["no"]="ingen orddelingsmønster -- for -- (n=--,e=--,m=--) (--,--)", - ["ro"]="nu exista sabloane -- pentru -- (n=--,e=--,m=--) (--,--)", - }, - ["3"]={ - ["cs"]="deleni slov -- pro -- nacteno (n=--,e=--,m=--)", - ["de"]="Trenndefinitionen -- fuer -- geladen (n=--,e=--,m=--)", - ["en"]="hyphenations -- for -- loaded (n=--,e=--,m=--)", - ["fr"]="hyphenations -- pour -- chargés (n=--,e=--,m=--)", - ["it"]="sillabazione -- per -- caricata (n=--,e=--,m=--)", - ["nl"]="afbreekdefinities -- voor -- geladen (n=--,e=--,m=--)", - ["no"]="orddelingsdefinisjon -- for -- er lest inn (n=--,e=--,m=--)", - ["ro"]="despartirea in silabe -- pentru -- s-a incarcat (n=--,e=--,m=--)", - }, - ["4"]={ - ["cs"]="zadne deleni slov -- pro -- (n=--,e=--,m=--)", - ["de"]="Keine Trenndefinitionen -- fuer -- (n=--,e=--,m=--)", - ["en"]="no hyphenations -- for -- (n=--,e=--,m=--)", - ["fr"]="pas d'hyphenations -- pour -- (n=--,e=--,m=--)", - ["it"]="niente sillabazione -- per -- (n=--,e=--,m=--)", - ["nl"]="geen afbreekdefinities -- voor -- (n=--,e=--,m=--)", - ["no"]="ingen orddelingsdefinisjon -- for -- (n=--,e=--,m=--)", - ["ro"]="nu exista despartire in silabe -- pentru -- (n=--,e=--,m=--)", - }, - ["5"]={ - ["cs"]="vzory pro -- nenacteny", - ["de"]="Trennmuster fuer -- nicht geladen", - ["en"]="patterns for -- not loaded", - ["fr"]="les motifs pour -- ne sont pas chargés", - ["it"]="schemi per -- non caricati", - ["nl"]="afbreekpatronen voor -- niet geladen", - ["no"]="orddelingsmønster for -- er ikke lest inn", - ["ro"]="sabloanele pentru -- nu sunt incarcate", - }, - ["6"]={ - ["cs"]="jazyk -- neni definovan", - ["de"]="Sprache -- ist undefiniert", - ["en"]="language -- is undefined", - ["fr"]="langue -- non définie", - ["it"]="lingua -- non definita", - ["nl"]="taal -- is niet gedefinieerd", - ["no"]="spràk -- er udefinert", - ["ro"]="limba -- nu este definita", - }, - ["7"]={ - ["cs"]="specificke volby jazyka [--] zavadeji -- (zavlecenou) mezeru", - ["de"]="Sprachenspezifische Option [--] fuegt eine Luecke von -- ein", - ["en"]="language specific options [--] introduce a -- skip", - ["fr"]="les options spécifiques de langue [--] introduisent un -- saut", - ["it"]="opzioni specifiche per la lingua [--] introducono un salto --", - ["nl"]="taal specifieke opties [--] introduceren een skip van --", - ["no"]="spràk spesifikk opsjon [--] introduserer et -- hopp", - ["ro"]="optiunile specifice ale limbii [--] introduc un spatiu --", - }, - ["8"]={ - ["cs"]="specificke volby jazyka [--] bez mezer pripojeny", - ["de"]="Sprachenspezifische Option [--] nahtlos hinzugefuegt", - ["en"]="language specific options [--] seamless appended", - ["fr"]="les options spécifiques de langue [--] sont ajoutés en douceur", - ["it"]="opzioni specifiche per la lingua [--] aggiunte trasparentemente", - ["nl"]="taal specifieke opties [--] naadloos toegevoegd", - ["no"]="spràk spesifikk opsjon [--] problemfritt tilføyd", - ["ro"]="optiunile specifice ale limbii [--] adaugate", - }, - ["9"]={ - ["cs"]="language -- is active", - ["de"]="Sprache -- ist aktiv", - ["en"]="language -- is active", - ["fr"]="la langue -- est active", - ["it"]="lingua -- attiva", - ["nl"]="taal -- is actief", - ["no"]="spràk -- er aktivt", - ["ro"]="limba -- este activa", - }, - ["files"]={ "lang-ini.mkii", "lang-ini.mkiv" }, - ["title"]={ - ["cs"]="jazyky", - ["de"]="Sprache", - ["en"]="language", - ["fr"]="langue", - ["it"]="lingua", - ["nl"]="taal", - ["no"]="sprøk", - ["ro"]="limbi", - }, - }, - ["metapost"]={ - ["1"]={ - ["cs"]="loading metapost library --", - ["de"]="Lade metapost Bibliothek --", - ["en"]="loading metapost library --", - ["fr"]="chargement de la bibliothèque metapost --", - ["it"]="caricamento della libreria metapost --", - ["nl"]="metapost bibliotheek -- wordt geladen", - ["no"]="metapost bibliotek -- blir lest inn", - ["ro"]="se incarca biblioteca metapost --", - }, - ["files"]={ "meta-ini.mkii", "meta-ini.mkiv" }, - ["title"]={ - ["cs"]="metapost", - ["de"]="metapost", - ["en"]="metapost", - ["fr"]="metapost", - ["it"]="metapost", - ["nl"]="metapost", - ["no"]="metapost", - ["ro"]="metapost", - }, - }, - ["references"]={ - ["1"]={ - ["cs"]="neznama reference --", - ["de"]="unbekannte Referenz --", - ["en"]="unknown reference --", - ["fr"]="réference -- inconnue", - ["it"]="riferimento sconosciuto --", - ["nl"]="onbekende verwijzing --", - ["no"]="ukjent referanse --", - ["ro"]="referinta necunoscuta --", - }, - ["2"]={ - ["cs"]="duplicitni reference -- na strane --", - ["de"]="doppelte Referenz -- auf Seite --", - ["en"]="duplicate reference -- on page --", - ["fr"]="réference -- dupliquée à la page --", - ["it"]="riferimento duplicato -- a pagina --", - ["nl"]="dubbele verwijzing -- op pagina --", - ["no"]="duplikat referanse -- pø side --", - ["ro"]="referinta duplicat -- la pagina --", - }, - ["21"]={ - ["cs"]="dokument -- nacten", - ["de"]="Dokument -- geladen", - ["en"]="document -- loaded", - ["fr"]="document -- chargé", - ["it"]="documento -- caricato", - ["nl"]="document -- geladen", - ["no"]="dokument -- er lest inn", - ["ro"]="documentul -- este incarcat", - }, - ["22"]={ - ["cs"]="dokument -- neni interaktivni", - ["de"]="Dokument -- ist nicht aktiv", - ["en"]="document -- is not interactive", - ["fr"]="le document -- n'est pas interactif", - ["it"]="il documento -- non ø interattivo", - ["nl"]="document -- is niet interactief", - ["no"]="dokument -- er ikke interaktivt", - ["ro"]="documentul -- nu este interactiv", - }, - ["23"]={ - ["cs"]="obskurni (nejasna) reference -- (prefix=--)", - ["de"]="Obskure Referenz -- (Prefix=--)", - ["en"]="obscure reference -- (prefix=--)", - ["fr"]="reference -- indéterminé (préfixe=--)", - ["it"]="riferimento ambiguo -- (prefisso=--)", - ["nl"]="onduidelijke verwijzing -- (prefix=--)", - ["no"]="obskur referanse -- (Prefix=--)", - ["ro"]="referinta obscura -- (prefix=--)", - }, - ["24"]={ - ["en"]="references from document '--' are not exported", - }, - ["25"]={ - ["en"]="references from document '--' are not imported (export again)", - }, - ["26"]={ - ["en"]="references from document '--' are imported", - }, - ["3"]={ - ["cs"]="neznamy typ reference --", - ["de"]="unbekannte Referenz Typ --", - ["en"]="unknown reference type --", - ["fr"]="type -- de réference inconnu", - ["it"]="riferimento di tipo sconosciuto --", - ["nl"]="type verwijzing -- onbekend", - ["no"]="ukjent referansetype --", - ["ro"]="tip necunoscut de referinta --", - }, - ["30"]={ - ["cs"]="neznamy objekt --", - ["de"]="unbekanntes Object --", - ["en"]="unknown object --", - ["fr"]="objet -- inconnu", - ["it"]="oggetto sconosciuto --", - ["nl"]="onbekend object --", - ["no"]="ukjent objekt --", - ["ro"]="obiect necunoscut --", - }, - ["31"]={ - ["cs"]="duplicitni object --", - ["de"]="doppeltes Object --", - ["en"]="duplicate object --", - ["fr"]="objet -- dupliqué", - ["it"]="oggetto duplicato --", - ["nl"]="dubbel object --", - ["no"]="duplikat objekt --", - ["ro"]="obiect duplicat --", - }, - ["4"]={ - ["cs"]="nedovolena reference --", - ["de"]="illegale Referenz --", - ["en"]="illegal reference --", - ["fr"]="réference -- inconnue", - ["it"]="riferimento illecito --", - ["nl"]="verboden verwijzing --", - ["no"]="ulovlig referanse --", - ["ro"]="referinta eronata --", - }, - ["files"]={ "core-obj.tex", "core-ref.tex", "strc-ref.tex" }, - ["title"]={ - ["cs"]="reference", - ["de"]="referenzen", - ["en"]="references", - ["fr"]="réferences", - ["it"]="riferimenti", - ["nl"]="verwijzingen", - ["no"]="referanser", - ["ro"]="referinte", - }, - }, - ["regimes"]={ - ["1"]={ - ["cs"]="kodovani --", - ["de"]="Kodierung --", - ["en"]="regime --", - ["fr"]="encodage --", - ["it"]="codifica --", - ["nl"]="regime --", - ["no"]="koding --", - ["ro"]="codificarea --", - }, - ["2"]={ - ["cs"]="je nacteno kodovani --", - ["de"]="Kodierung -- ist geladen", - ["en"]="regime -- is loaded", - ["fr"]="l'encodage -- est chargé", - ["it"]="codifica -- caricata", - ["nl"]="regime -- wordt geladen", - ["no"]="koding -- er lest inn", - ["ro"]="codificarea -- este Encarcata", - }, - ["3"]={ - ["cs"]="nezname kodovani --", - ["de"]="Unbekannte Kodierung --", - ["en"]="unknown regime --", - ["fr"]="encodage -- inconnu", - ["it"]="codifica sconosciuta --", - ["nl"]="onbekend regime --", - ["no"]="ukjent koding --", - ["ro"]="codificarea -- este necunoscuta", - }, - ["files"]={ "regi-ini.mkii" }, - ["title"]={ - ["cs"]="kodovani", - ["de"]="Kodierung", - ["en"]="regime", - ["fr"]="encodage", - ["it"]="codifica", - ["nl"]="regime", - ["no"]="koding", - ["ro"]="codificari", - }, - }, - ["specials"]={ - ["1"]={ - ["cs"]="-- nacteno", - ["de"]="-- geladen", - ["en"]="-- loaded", - ["fr"]="-- chargé", - ["it"]="-- caricato", - ["nl"]="-- geladen", - ["no"]="-- er lest inn", - ["ro"]="-- incarcat", - }, - ["2"]={ - ["cs"]="neni dovoleno hlubsi zanoreni --", - ["de"]="keine tiefere Verschachtelung erlaubt --", - ["en"]="no deeper nesting is permitted --", - ["fr"]="pas d'imbracations plus profondes ne sont permises --", - ["it"]="non ø permesso un annidamento maggiore --", - ["nl"]="verdere nesting is niet toegestaan --", - ["no"]="dypere 'nesting' er ikke tillatt --", - ["ro"]="nu este permis un nivel de imbricare mai mare --", - }, - ["3"]={ - ["cs"]="-- je resetovano", - ["de"]="-- ist zurueckgesetzt", - ["en"]="-- is reset", - ["fr"]="-- est remis à zéro", - ["it"]="-- reimpostato", - ["nl"]="-- gereset", - ["no"]="-- er tilbakestilt", - ["ro"]="-- s-a resetat", - }, - ["4"]={ - ["cs"]="prikaz -- neexistuje", - ["de"]="Befehl -- existiert nicht", - ["en"]="command -- does not exist", - ["fr"]="la commande -- n'existe pas", - ["it"]="il comando -- non esiste", - ["nl"]="commando -- bestaat niet", - ["no"]="kommando -- eksisterer ikke", - ["ro"]="comanda -- nu exista", - }, - ["5"]={ - ["cs"]="nacita se definicni soubor --", - ["de"]="lade Definitionsdatei --", - ["en"]="loading definition file --", - ["fr"]="chargement du fichier de définition --", - ["it"]="caricamento del file di definizione --", - ["nl"]="definitiefile -- wordt geladen", - ["no"]="leser inn definisjonsfil for --", - ["ro"]="se incarca fisierul de definitii --", - }, - ["6"]={ - ["cs"]="zanoreni neni dovoleno", - ["de"]="Verschachtelung nicht erlaubt", - ["en"]="nesting is not permitted", - ["fr"]="l'imbrication n'est pas permise", - ["it"]="annidamento non permesso", - ["nl"]="nesting is niet toegestaan", - ["no"]="'nesting' er ikke tillatt", - ["ro"]="imbricarea nu este permisa", - }, - ["7"]={ - ["cs"]="neznamy ovladac (driver) --", - ["de"]="unbekante Driver --", - ["en"]="unknown driver --", - ["fr"]="pilote -- inconnu", - ["it"]="driver sconosciuto --", - ["nl"]="onbekende driver --", - ["no"]="ukjent driver --", - ["ro"]="driver necunoscut --", - }, - ["files"]={ "spec-ini.tex" }, - ["title"]={ - ["cs"]="speciality", - ["de"]="spezielles", - ["en"]="specials", - ["fr"]="specials", - ["it"]="specialitø", - ["nl"]="specials", - ["no"]="specials", - ["ro"]="specials", - }, - }, - ["structures"]={ - ["1"]={ - ["cs"]="zacatek oddilu (sekce) --", - ["de"]="Begin des Abschnittsblocks --", - ["en"]="begin of sectionblock --", - ["fr"]="début de blocsection --", - ["it"]="inizio del blocco (sezione) --", - ["nl"]="begin van sectieblok --", - ["no"]="starten av blokk -- (seksjon)", - ["ro"]="inceput de bloc sectiune --", - }, - ["2"]={ - ["cs"]="konec oddilu (sekce) --", - ["de"]="Ende des Abschnittsblocks --", - ["en"]="end of sectionblock --", - ["fr"]="fin de blocsection --", - ["it"]="fine del blocco (sezione) --", - ["nl"]="eind van sectieblok --", - ["no"]="slutten av blokk -- (seksjon)", - ["ro"]="sfarsit de bloc sectiune --", - }, - ["files"]={ "core-sec.mkii", "core-sec.mkiv", "strc-sbe.tex" }, - ["title"]={ - ["cs"]="struktury", - ["de"]="struktur", - ["en"]="structure", - ["fr"]="structure", - ["it"]="struttura", - ["nl"]="structuur", - ["no"]="struktur", - ["ro"]="structuri", - }, - }, - ["symbols"]={ - ["1"]={ - ["cs"]="nacita se soubor symbolu --", - ["de"]="Lade Symboldatei --", - ["en"]="loading symbolset --", - ["fr"]="chargement du jeu de symbole --", - ["it"]="caricamento gruppo di simboli --", - ["nl"]="symboolset -- wordt geladen", - ["no"]="leser inn symbolsett --", - ["ro"]="se incarca setul de simboluri --", - }, - ["files"]={ "symb-ini.tex" }, - ["title"]={ - ["cs"]="symboly", - ["de"]="Symbole", - ["en"]="symbols", - ["fr"]="symboles", - ["it"]="simboli", - ["nl"]="symbolen", - ["no"]="symboler", - ["ro"]="simboluri", - }, - }, - ["systems"]={ - ["1"]={ - ["cs"]="nacteni pomocneho souboru odlozeno (typemode)", - ["de"]="Laden der Hilfsdatei aufgeschoben (Eingabe-Modus)", - ["en"]="loading utility-file postponed (typemode)", - ["fr"]="chargement de fichier utilitaire reporté (typemode)", - ["it"]="caricamento dei file supplementari posticipato (typemode)", - ["nl"]="laden hulpfile uitgesteld (typemode)", - ["no"]="innlesning av hjelpefila utsatt (typemode)", - ["ro"]="se incarca utilitarul-fisierul este amanat (typemode)", - }, - ["10"]={ - ["cs"]="nepouzivejte em v --", - ["de"]="Benutzte kein em in --", - ["en"]="don't use em in --", - ["fr"]="n'utilisez pas em dans --", - ["it"]="non usare em in --", - ["nl"]="gebruik geen em in --", - ["no"]="ikke bruk em i --", - ["ro"]="nu folositi em in --", - }, - ["11"]={ - ["cs"]="vytvarim jednoduchy pomocny soubor", - ["de"]="Erstelle einfache Hilfdatei", - ["en"]="building simple util", - ["fr"]="construction util simple", - ["it"]="costruzione di un semplice supplemento", - ["nl"]="aanmaken basale hulpfile", - ["no"]="lager enkel hjelpefil", - ["ro"]="se creeaza un utilitar simplu", - }, - ["12"]={ - ["cs"]="pomosny soubor neni setriden, pouzijte texutil", - ["de"]="Die Hilfdatei ist nicht sortiert, verwende texutil", - ["en"]="the utility-file is not sorted, use texutil", - ["fr"]="le fichier utilitaire n'est pas trié, utilise texutil", - ["it"]="file di supplemento non ordinato, usare texutil", - ["nl"]="de hulpfile is niet gesorteerd, gebruik texutil", - ["no"]="hjelpefila er ikke sortert, bruk texutil", - ["ro"]="fisierul utilitar nu este sortat, folositi texutil", - }, - ["13"]={ - ["cs"]="znacka -- definovana --", - ["de"]="Beschriftung -- definiert --", - ["en"]="mark -- defined --", - ["fr"]="marquage -- defini --", - ["it"]="marcatura -- definita --", - ["nl"]="markering -- gedefinieerd --", - ["no"]="markering -- definert --", - ["ro"]="marcajul -- definit --", - }, - ["14"]={ - ["cs"]="vynucena nova stranka v seznamu na --", - ["de"]="Erzwungendes Seitenumbruch in Liste bei --", - ["en"]="forced newpage in list at --", - ["fr"]="nouvellepage forcée dans la liste à --", - ["it"]="nuova pagina obbligata in lista a --", - ["nl"]="geforceerde paginaovergang in lijst voor --", - ["no"]="tvunget sideskift i liste ved --", - ["ro"]="s-a fortat trecere pa pagina noua in lista la --", - }, - ["15"]={ - ["cs"]="uklada se buffer --", - ["de"]="Speichere Buffer --", - ["en"]="saving buffer --", - ["fr"]="sauvegarde du tampon (buffer) --", - ["it"]="salvataggio del buffer --", - ["nl"]="wegschrijven buffer --", - ["no"]="lagrer Buffer --", - ["ro"]="buffer salvat --", - }, - ["16"]={ - ["cs"]="sazi se buffer --", - ["de"]="Setzte Buffer --", - ["en"]="typesetting buffer --", - ["fr"]="composition du tampon (buffer) --", - ["it"]="composizione del buffer --", - ["nl"]="inlezen buffer --", - ["no"]="tegnsetter buffer --", - ["ro"]="buffer-ul -- s-a cules", - }, - ["17"]={ - ["cs"]="sazi se doslovny (verbatim) buffer --", - ["de"]="Setzte tippen-Buffer --", - ["en"]="typesetting verbatim buffer --", - ["fr"]="composition textuelle du tampon (buffer) --", - ["it"]="composizione verbatim del buffer --", - ["nl"]="verbatim inlezen buffer --", - ["no"]="tegnsetter verbatim-buffer --", - ["ro"]="se culege buffer-ul verbatim --", - }, - ["18"]={ - ["cs"]="synonymum -- -- neexistuje", - ["de"]="Synonym -- -- existiert nicht", - ["en"]="synonym -- -- does not exist", - ["fr"]="le synonyme -- -- n'existe pas", - ["it"]="sinonimo -- -- non esistente", - ["nl"]="synoniem -- -- bestaat niet", - ["no"]="synonym -- -- eksisterer ikke", - ["ro"]="sinonimul -- -- nu exista", - }, - ["19"]={ - ["cs"]="vyznam (synonyma) -- nacten", - ["de"]="Bedeutung (synonyme) von -- geladen", - ["en"]="meaning (synonyms) of -- loaded", - ["fr"]="signification (synonymes) de -- chargée", - ["it"]="significato (sinonimi) di -- caricato", - ["nl"]="betekenissen (synoniemen) van -- geladen", - ["no"]="betydning (synonymer) av -- er lest inn", - ["ro"]="intelesul (sinonimele) pentru -- incarcat", - }, - ["2"]={ - ["cs"]="-- nacteno", - ["de"]="-- geladen", - ["en"]="-- loaded", - ["fr"]="-- chargé", - ["it"]="-- caricato", - ["nl"]="-- geladen", - ["no"]="-- er lest inn", - ["ro"]="-- s-a incarcat", - }, - ["20"]={ - ["cs"]="vyznam (trideni) -- nacten", - ["de"]="Bedeutung (sortieren) von -- geladen", - ["en"]="meaning (sorts) of -- loaded", - ["fr"]="signification (tris) de -- chargée", - ["it"]="significato (specie) di -- caricato", - ["nl"]="betekenissen (sorteren) van -- geladen", - ["no"]="betydning (sorterer) av -- er lest inn", - ["ro"]="intelesul (ordinea) pentru -- incarcat", - }, - ["21"]={ - ["cs"]="pomocny soubor necten", - ["de"]="Die Hilfsdatei ist nicht geladen", - ["en"]="no utility data is loaded", - ["fr"]="pas de données utilitaires chargées", - ["it"]="nessuna informazione supplementare caricata", - ["nl"]="de hulpfile is niet geladen", - ["no"]="hjelpefila er ikke lest inn", - ["ro"]="nici o data utilitara nu este incarcata", - }, - ["22"]={ - ["cs"]="pouzijte platny pomocny soubor", - ["de"]="Benoetige gueltige Hilfsdateie", - ["en"]="use a valid utilityfile", - ["fr"]="utilise un fichier utilitaire valide", - ["it"]="usare un file supplementare valido", - ["nl"]="gebruik een goede hulpfile", - ["no"]="bruk en gyldig hjelpefil", - ["ro"]="folositi un fisier utilitar valid", - }, - ["23"]={ - ["cs"]="-- upraveno na --", - ["de"]="-- angeordnet auf --", - ["en"]="-- arranged at --", - ["fr"]="-- arrangé à --", - ["it"]="-- sistemato a --", - ["nl"]="-- gearrangeerd op --", - ["no"]="-- arrangert på --", - ["ro"]="-- aranjat la --", - }, - ["24"]={ - ["cs"]="plovouci bloky", - ["de"]="Fliessbloecke", - ["en"]="Floatblocks", - ["fr"]="blocsflottants", - ["it"]="Oggetti mobili", - ["nl"]="Plaatsblokken", - ["no"]="Flytblokker", - ["ro"]="Blocuri", - }, - ["25"]={ - ["cs"]="reference", - ["de"]="Referenzen", - ["en"]="References", - ["fr"]="Réferences", - ["it"]="Riferimenti", - ["nl"]="Verwijzingen", - ["no"]="Referanser", - ["ro"]="Referinte", - }, - ["26"]={ - ["cs"]="registry", - ["de"]="Register", - ["en"]="Registers", - ["fr"]="Registres", - ["it"]="Registri", - ["nl"]="Registers", - ["no"]="Registere", - ["ro"]="Registri", - }, - ["27"]={ - ["cs"]="verze", - ["de"]="Version", - ["en"]="Version", - ["fr"]="Version", - ["it"]="Versione", - ["nl"]="Versie", - ["no"]="Versjon", - ["ro"]="Versiune", - }, - ["4"]={ - ["cs"]="prikaz -- je jiz definovan", - ["de"]="Befehl -- ist bereits definiert", - ["en"]="command -- is already defined", - ["fr"]="la commande -- est déjà définie", - ["it"]="comando -- già definito", - ["nl"]="commando -- is al gedefinieerd", - ["no"]="kommando -- er allerede definert", - ["ro"]="comanda -- este deja definita", - }, - ["41"]={ - ["cs"]="externi soubor -- ve skupine -- neexistuje", - ["de"]="Externe Datei -- in Gruppe -- existiert nicht", - ["en"]="external file -- in group -- does not exist", - ["fr"]="le fichier externe -- du groupe -- n'existe pas", - ["it"]="il file esterno -- del gruppo -- non esiste", - ["nl"]="externe file -- in groep -- bestaat niet", - ["no"]="ekstern fil -- i gruppe -- eksisterer ikke", - ["ro"]="fisierul extern -- din grupul -- nu exista", - }, - ["5"]={ - ["cs"]="makra z -- nactena", - ["de"]="Modul -- geladen", - ["en"]="module -- loaded", - ["fr"]="module -- chargé", - ["it"]="macro del modulo -- caricate", - ["nl"]="module -- geladen", - ["no"]="makroene i modul -- er lest inn", - ["ro"]="macro-urile din modulul -- s-au incarcat", - }, - ["6"]={ - ["cs"]="zadna makra v -- nenalezena", - ["de"]="Modul -- gefunden", - ["en"]="module -- not found", - ["fr"]="module -- non trouvé", - ["it"]="nessuna macro trovata nel modulo --", - ["nl"]="geen module -- gevonden", - ["no"]="ingen makroer funnet i modul ---", - ["ro"]="nu s-au gasit macro-uri in modulul --", - }, - ["7"]={ - ["cs"]="makra z -- jsou jiz nactena", - ["de"]="Modul -- bereits geladen", - ["en"]="module -- already loaded", - ["fr"]="module -- déjà chargé", - ["it"]="macro del modulo -- già caricate", - ["nl"]="module -- reeds geladen", - ["no"]="makroene i modul -- er allerede lest inn", - ["ro"]="macro-urile din modulul -- s-au incarcat deja", - }, - ["8"]={ - ["cs"]="nova verze pomocneho souboru, je treba druheho behu", - ["de"]="Neue Version der Hilfsdatei, zweiter Durchlauf benoetigt", - ["en"]="new version of utility file, second pass needed", - ["fr"]="nouvelle version de fichier utilitaire, seconde passe nécessaire", - ["it"]="nuova versione del file supplementare, seconda passata necessaria", - ["nl"]="nieuwe versie hulpfile, tweede run nodig", - ["no"]="ny versjon av hjelpefil, andre gjennomkjøring nødvendig", - ["ro"]="o noua versiune de fisier utilitar, este necesara o noua trecere", - }, - ["9"]={ - ["cs"]="-- nenalezeno/nezpracovano", - ["de"]="-- nicht gefunden/verarbeitet", - ["en"]="-- not found/processed", - ["fr"]="-- non trouvé/traité", - ["it"]="-- non trovato/elaborato", - ["nl"]="-- niet gevonden/geplaatst", - ["no"]="-- ikke funnet/behandlet", - ["ro"]="-- nu este gasit/procesat", - }, - ["91"]={ - ["en"]="papertray --", - ["nl"]="papierlade --", - }, - ["files"]={ "core-mis.tex", "page-ini.tex", "prag-gen.tex", "strc-mar.tex" }, - ["title"]={ - ["cs"]="system", - ["de"]="system", - ["en"]="system", - ["fr"]="système", - ["it"]="sistema", - ["nl"]="systeem", - ["no"]="system", - ["ro"]="sistem", - }, - }, - ["textblocks"]={ - ["1"]={ - ["cs"]="nova verze, je treba druhy beh", - ["de"]="neue Version, zweiter Durchlauf benoetigt", - ["en"]="new version, second pass needed", - ["fr"]="nouvelle version, une seconde passe est nécessaire", - ["it"]="nuova versione, seconda passata necessaria", - ["nl"]="nieuwe versie, tweede run nodig", - ["no"]="ny versjon, andre gjennomkjøring nødvendig", - ["ro"]="o noua versiune, este nevoie de inca o trecere", - }, - ["10"]={ - ["cs"]="-- nacteno a zpracovano", - ["de"]="-- geladen und verarbeitet", - ["en"]="-- loaded and processed", - ["fr"]="-- chargé et traité", - ["it"]="-- caricato ed elaborato", - ["nl"]="-- geladen en verwerkt", - ["no"]="-- lest inn og behandlet", - ["ro"]="-- incarcat si procesat", - }, - ["11"]={ - ["cs"]="-- nacteno a vysazeno", - ["de"]="-- geladen und gesetzt", - ["en"]="-- loaded and typeset", - ["fr"]="-- chargé et composé", - ["it"]="-- caricato e composto", - ["nl"]="-- geladen en geplaatst", - ["no"]="-- lest inn og tegnsatt", - ["ro"]="-- incarcat si cules", - }, - ["12"]={ - ["cs"]="-- preskoceno", - ["de"]="-- ausgelassen", - ["en"]="-- skipped", - ["fr"]="-- sauté", - ["it"]="-- saltato", - ["nl"]="-- overgeslagen", - ["no"]="-- utelatt", - ["ro"]="-- sarit peste", - }, - ["2"]={ - ["cs"]="zapisuji bloky do --", - ["de"]="schreibe Bloecke zu --", - ["en"]="writing blocks to --", - ["fr"]="ecriture des blocs vers --", - ["it"]="scrittura dei blocchi su --", - ["nl"]="wegschrijven blokken naar --", - ["no"]="skriver blokker til --", - ["ro"]="se scriu blocurile in --", - }, - ["3"]={ - ["cs"]="ctu bloky z --", - ["de"]="lese Bloecke von --", - ["en"]="reading blocks from --", - ["fr"]="lecture des blocs en provenance de --", - ["it"]="lettura dei blocchi da --", - ["nl"]="inlezen blokken uit --", - ["no"]="leser blokker fra --", - ["ro"]="se citesc blocurile din --", - }, - ["4"]={ - ["cs"]="je treba druhy beh", - ["de"]="zweiter Durchlauf benoetigt", - ["en"]="second pass needed", - ["fr"]="seconde passe nécessaire", - ["it"]="seconda passata necessaria", - ["nl"]="er is een tweede run nodig", - ["no"]="andre gjennomkjøring nødvendig", - ["ro"]="este nevoie de inca o trecere", - }, - ["5"]={ - ["cs"]="-- neni skryto", - ["de"]="-- nicht verborgen", - ["en"]="-- not hidden", - ["fr"]="-- non caché", - ["it"]="-- non nascosto", - ["nl"]="-- niet verborgen", - ["no"]="-- ikke skjult", - ["ro"]="-- nu este ascuns", - }, - ["6"]={ - ["cs"]="-- skryto a zpracovano", - ["de"]="-- verborgen und verarbeitet", - ["en"]="-- hidden and processed", - ["fr"]="-- caché et traité", - ["it"]="-- nascosto ed elaborato", - ["nl"]="-- verborgen en verwerkt", - ["no"]="-- skjult og behandlet", - ["ro"]="-- ascuns si procesat", - }, - ["7"]={ - ["cs"]="-- skryto", - ["de"]="-- verborgen", - ["en"]="-- hidden", - ["fr"]="-- caché", - ["it"]="-- nascosto", - ["nl"]="-- verborgen", - ["no"]="-- skjult", - ["ro"]="-- ascuns", - }, - ["8"]={ - ["cs"]="-- vysazeno", - ["de"]="-- gesetzt", - ["en"]="-- typeset", - ["fr"]="-- composé", - ["it"]="-- composto", - ["nl"]="-- gehandhaafd", - ["no"]="-- tegnsatt", - ["ro"]="-- cules", - }, - ["9"]={ - ["cs"]="-- nevysazeno", - ["de"]="-- nicht gesetzt", - ["en"]="-- not typeset", - ["fr"]="-- non composé", - ["it"]="-- non composto", - ["nl"]="-- niet gehandhaafd", - ["no"]="-- ikke tegnsatt", - ["ro"]="-- nu este cules", - }, - ["files"]={ "core-blk.tex" }, - ["title"]={ - ["cs"]="textovyblok", - ["de"]="textblock", - ["en"]="textblocks", - ["fr"]="blocs de texte", - ["it"]="blocchi di testo", - ["nl"]="tekstblokken", - ["no"]="tekstblokker", - ["ro"]="blocuri de text", - }, - }, - ["verbatims"]={ - ["1"]={ - ["cs"]="soubor -- neexistuje", - ["de"]="Datei -- existiert nicht", - ["en"]="file -- does not exist", - ["fr"]="le fichier -- n'existe pas", - ["it"]="il file -- non esiste", - ["nl"]="file -- bestaat niet", - ["no"]="fil -- eksisterer ikke", - ["ro"]="fisierul -- nu exista", - }, - ["files"]={ "core-ver.tex" }, - ["title"]={ - ["cs"]="verbatim", - ["de"]="verbatim", - ["en"]="verbatim", - ["fr"]="verbatim", - ["it"]="verbatim", - ["nl"]="typen", - ["no"]="verbatim", - ["ro"]="verbatim", - }, - }, - ["versions"]={ - ["1"]={ - ["cs"]="postradam @+", - ["de"]="fehlendes @+", - ["en"]="missing @+", - ["fr"]="@+ manquant", - ["it"]="@+ mancante", - ["nl"]="er mankeert een @+", - ["no"]="manglende @+", - ["ro"]="lipseste @+", - }, - ["2"]={ - ["cs"]="oznacuji se strany", - ["de"]="Erstelle Seiten", - ["en"]="marking pages", - ["fr"]="marquage des pages", - ["it"]="marcatura pagine", - ["nl"]="markeren pagina's", - ["no"]="markerer sider", - ["ro"]="pagini marcate", - }, - ["3"]={ - ["cs"]="oznacene strany: --", - ["de"]="Ausgewaehlte Seiten: --", - ["en"]="selected pages: --", - ["fr"]="pages sélectionnées : --", - ["it"]="pagine selezionate: --", - ["nl"]="geselecteerde pagina's: --", - ["no"]="valgte sider: --", - ["ro"]="pagini selectate: --", - }, - ["files"]={ "core-int.tex" }, - ["title"]={ - ["cs"]="verze", - ["de"]="Version", - ["en"]="version", - ["fr"]="version", - ["it"]="version", - ["nl"]="versie", - ["no"]="versjon", - ["ro"]="versiuni", - }, - }, + formats = { + ["adapted: preamble '%s', state '%s', order '%s'"] = { + nl = "aangepast: preamble '%s', status '%s', volgorde '%s'", + }, + ["already loaded: '%s'"] = { + nl = "al geladen: '%s'", + }, + ["check:1"] = { + cs = "postradam '=' po '%s' na radku %s", + de = "Fehlendes '=' nach '%s' in Zeile %s", + en = "missing or ungrouped '=' after '%s' in line %s", + fr = "manquant ou dégroupé '=' après '%s' à la ligne %s", + it = "'=' mancante o non raggruppato dopo '%s' alla riga %s", + nl = "'=' ontbreekt of zonder {} na '%s' in regel %s", + no = "manglende '=' etter '%s' i linje %s", + ro = "lipseste '=' dupa '%s' in linia %s", + }, + ["check:2"] = { + cs = "ocekavam %s argument(y) na radku %s", + de = "%s Argument(e) in Zeile %s erwartet", + en = "%s argument(s) expected in line %s", + fr = "%s argument(s) attendu(s) à la ligne %s", + it = "%s argomento/i attesi alla riga %s", + nl = "%s argument(en) verwacht in regel %s", + no = "%s argument forventet i linje %s", + ro = "argumentul(ele) %s sunt asteptate in linia %s", + }, + ["check:3"] = { + cs = "%s %s nahrazuje makro, uzijte VERZALKY!", + de = "%s %s ersetzt ein Makro, verwende VERSALIEN!", + en = "%s %s replaces a macro, use CAPITALS!", + fr = "%s %s remplace une macro, utilisez des MAJUSCULES !", + it = "%s %s sostituisce una macro, usare le MAIUSCOLE!", + nl = "%s %s vervangt een macro, gebruik HOOFDLETTERS!", + no = "%s %s overskygger en makro, bruk STORE BOKSTAVER!", + ro = "%s %s inlocuieste un macro, folositi MAJUSCULE!", + }, + ["checking file: '%s'"] = { + nl = "controleren file: '%s'", + }, + ["checking url: '%s'"] = { + nl = "controleren url: '%s'", + }, + ["colors:1"] = { + cs = "system %s je globalne aktivovana", + de = "system %s ist global aktiviert", + en = "system %s is global activated", + fr = "le système %s est globalement activé", + it = "sistema %s attivato globalmente", + nl = "systeem %s is globaal actief", + no = "system %s er aktivert globalt", + ro = "sistem %s este activata global", + }, + ["colors:10"] = { + cs = "%s prostor barev je podporovan", + de = "%s Farbraum wird unterstuetzt", + en = "%s color space is supported", + fr = "%s l'espace de couleur est supporté", + it = "spazio dei colori %s supportato", + nl = "%s kleurruimte wordt ondersteund", + no = "%s fargerom er støttet", + ro = "spatiul de culoare %s este suportat", + }, + ["colors:11"] = { + cs = "barva je prevedena na sed", + de = "Farbe wird in Grau umgewandelt", + en = "color is converted to gray", + fr = "la couleur est convertie en niveau de gris", + it = "il colore ø convertito in grigio", + nl = "kleur wordt vertaald in grijs", + no = "fargen vil bli vist som grø", + ro = "culoarea este convertita la gri", + }, + ["colors:12"] = { + cs = "%s is registered", + de = "%s is registered", + en = "%s is registered", + fr = "%s est enregistré", + it = "%s is registered", + nl = "%s is geregistreerd", + no = "%s is registered", + ro = "%s is registered", + }, + ["colors:2"] = { + cs = "system %s je lokalne activovana", + de = "system %s ist lokal aktiviert", + en = "system %s is local activated", + fr = "le système %s est localement activé", + it = "sistema %s attivato localmente", + nl = "systeem %s is lokaal actief", + no = "system %s er aktivert lokalt", + ro = "sistem %s este activata local", + }, + ["colors:3"] = { + cs = "%s neni definovana %s", + de = "%s ist undefiniert %s", + en = "%s is not defined %s", + fr = "%s n'est pas défini %s", + it = "%s non definito %s", + nl = "%s is niet gedefinieerd %s", + no = "%s er udefinert %s", + ro = "%s nu este definita %s", + }, + ["colors:4"] = { + cs = "system %s je nacten", + de = "system %s ist geladen", + en = "system %s is loaded", + fr = "le système %s est chargé", + it = "sistema %s caricato", + nl = "systeem %s wordt geladen", + no = "system %s er lest inn", + ro = "sistem %s este incarcata", + }, + ["colors:5"] = { + cs = "neznamy system %s", + de = "unbekanntes System %s", + en = "unknown system %s", + fr = "système %s inconnu", + it = "sistema %s sconosciuto", + nl = "onbekend systeem %s", + no = "ukjent system %s", + ro = "sistem %s necunoscuta", + }, + ["colors:6"] = { + cs = "palette %s je k dispozici", + de = "palette %s ist verfuegbar", + en = "palette %s is available", + fr = "la palette %s est disponible", + it = "tavolozza %s resa disponibile", + nl = "palet %s is beschikbaar", + no = "palett %s er tilgjengelig", + ro = "paleta %s este disponibila", + }, + ["colors:7"] = { + cs = "palette %s neni k dispozici", + de = "palette %s ist nicht verfuegbar", + en = "palette %s is not available", + fr = "le palette %s n'est pas disponible", + it = "tavolozza %s non disponibile", + nl = "palet %s is niet beschikbaar", + no = "palett %s er ikke tilgjengelig", + ro = "palette %s nu este disponibila", + }, + ["colors:8"] = { + cs = "specifikace %s v barve %s bude cerna", + de = "Spezifikation %s bei Farbe %s wird schwarz", + en = "specification %s at color %s becomes black", + fr = "la spécification %s de la couleur %s devient noire", + it = "specifica %s del colore %s convertita in nero", + nl = "specificatie %s bij %s wordt zwart", + no = "spesifikasjon %s for farge %s gir kun svart", + ro = "specificatia %s la culoarea %s devine neagra", + }, + ["colors:9"] = { + cs = "%s prostor barev neni podporovan", + de = "%s Farbraum wird nicht unterstuetzt", + en = "%s color space is not supported", + fr = "l'espace de couleur %s n'est pas supporté", + it = "spazio dei colori %s non supportato", + nl = "%s kleurruimte wordt niet ondersteund", + no = "%s fargerom er ikke støttet", + ro = "spatiul de culoare %s nu este suportat", + }, + ["columns:1"] = { + cs = "je mozno pouze %s sloupcu", + de = "nur %s Spalten moeglich", + en = "only %s columns possible", + fr = "seules %s colonnes possibles", + it = "solo %s colonne possibili", + nl = "maximaal %s kolommen", + no = "maksimalt %s kolonner", + ro = "este posibil numai %s coloane", + }, + ["columns:10"] = { + cs = "zbyl (mene nez) 1 radek", + de = "(weniger als) 1 Zeile uebrig", + en = "(less than) 1 line left", + fr = "(moins de) 1 ligne restante", + it = "(meno di) una riga rimasta", + nl = "(minder dan) 1 regel over", + no = "(mindre enn) 1 linje igjen", + ro = "a mai ramas (mai putin de) 1 linie", + }, + ["columns:11"] = { + cs = "plovouci objekt je pro sloupec prilis siroky", + de = "Gleitobjekt zu breit fuer Spalte", + en = "float too wide for column", + fr = "flottant mis à la largeur de la colonne", + it = "oggetto mobile troppo ampio per la colonna", + nl = "plaatsblok te breed voor kolom", + no = "flytblokk for bredt for kolonna", + ro = "blocul este prea lat pentru coloana", + }, + ["columns:12"] = { + cs = "plovouci objekt je presunut do nasledujiciho sloupce / %s", + de = "Gleitobjekt in naechste Zeile verschoben / %s", + en = "float moved to next column / %s", + fr = "flottant déplacé à la colonne suivante / %s", + it = "oggetto mobile spostata alla colonna successiva / %s", + nl = "plaatsblok verplaatst naar volgende kolom / %s", + no = "flytblokk forskjøvet til neste kolonne / %s", + ro = "blocul este mutat pe urmatoarea coloana / %s", + }, + ["columns:13"] = { + cs = "siroky plovouci objekt je presunut nad sloupce", + de = "breites Gleitobjekt an den Anfang der Spalten verschoben", + en = "wide float moved to top of columns", + fr = "flottant large déplacé dans la partie supérieure de la colonne", + it = "oggetto mobile ampio spostato sopra le colonne", + nl = "breed figuur geplaatst boven kolommen", + no = "bred flytblokk forksjøvet til toppen av kolonnene", + ro = "blocul lat este mutat in partea de sus a coloanelor", + }, + ["columns:2"] = { + cs = "pouzijte \\string\\filbreak\\space jako alternativu", + de = "benutzte \\string\\filbreak\\space als Alternative", + en = "use \\string\\filbreak\\space as alternative", + fr = "utilisez \\string\\filbreak\\space en tant qu'alternative", + it = "in alternativa, usare \\string\\filbreak", + nl = "gebruik eventueel \\string\\filbreak", + no = "bruk \\string\\filbreak\\space som et alternativ", + ro = "folositi \\string\\filbreak\\space ca alternativa", + }, + ["columns:3"] = { + cs = "problem, vypina se vyvazovani", + de = "Problem, verwende [ausgleich=nein]", + en = "problems, disable balancing", + fr = "problèmes, désactive l'équilibrage", + it = "problemi, disabilitare il bilanciamento", + nl = "probleempje, probeer [balanceren=nee]", + no = "problemer, slår av balansering", + ro = "probleme, se dezactiveaza alinierea", + }, + ["columns:4"] = { + cs = "horni plovouci objekt jeste neni podporovan", + de = "Gleitobjekt oben ncoh nicht unterstuetzt", + en = "top float not yet supported", + fr = "flottant en partie supérieure pas encore supporté", + it = "float in cima non ancora supportato", + nl = "plaatsblok boven nog niet mogelijk", + no = "flytblokker øverst er ikke støttet enda", + ro = "cadrele top (top float) nu sunt inca suportate", + }, + ["columns:5"] = { + cs = "spodni plovouci objekt jeste neni podporovan", + de = "Gleitobjekt unten ncoh nicht unterstuetzt", + en = "bottom float not yet supported", + fr = "flottant en partie inférieure pas encore supporté", + it = "float in fondo non ancora supportato", + nl = "plaatsblok onder nog niet mogelijk", + no = "flytblokker nedert er ikke støttet enda", + ro = "cadrele bottom (bottom float) nu sunt inca suportate", + }, + ["columns:6"] = { + cs = "%s plovouci objekt(y) odlozeny", + de = "%s Gleitobjekt(e) verschoben", + en = "%s float(s) postponed", + fr = "%s flottant(s) reporté(s)", + it = "%s float(s) posticipate", + nl = "%s plaatsblok(en) opgeschort", + no = "%s flytblokk forskjøvet", + ro = "%s blocurile sunt amanate", + }, + ["columns:7"] = { + cs = "vyvazovani ukonceno po 100 krocich", + de = "ausgleich nach 100 Schritten abgebrocheb", + en = "balancing aborted after 100 steps", + fr = "équilibrage abandonné après 100 pas", + it = "bilanciamento annullato dopo 100 passi", + nl = "balanceren afgebroken na 100 stappen", + no = "balansering avbrutt etter 100 iterasjoner", + ro = "alinierea este oprita dupa 100 de incercari", + }, + ["columns:8"] = { + cs = "vyvazeno v %s krocich", + de = "ausgeglichen nach %s Schritt(en)", + en = "balanced in %s step(s)", + fr = "équilibré en %s pas", + it = "bilanciamento in %s passo/i", + nl = "gebalanceerd in %s stap(pen)", + no = "balansert etter %s iterasjoner", + ro = "aliniat in %s pas(i)", + }, + ["columns:9"] = { + cs = "kontrola nerovnost", + de = "Ausrichtung ueberpruefen", + en = "check raggedness", + fr = "vérification des irrégularités", + it = "controllare seghettamento", + nl = "uitlijnen controleren!", + no = "kontroller tekstlayout!", + ro = "verificat alinierea", + }, + ["databases:1"] = { + cs = "%s", + de = "%s", + en = "%s", + fr = "%s", + it = "%s", + nl = "%s", + no = "%s", + ro = "%s", + }, + ["databases:2"] = { + cs = "local file %s", + de = "lokale Datei %s", + en = "local file %s", + fr = "fichier local %s", + it = "file locale %s", + nl = "lokaal bestand %s", + no = "lokal fil %s", + ro = "fisier local %s", + }, + ["databases:3"] = { + cs = "global file %s", + de = "globale Datei %s", + en = "global file %s", + fr = "fichier global %s", + it = "file globale %s", + nl = "globaal bestand %s", + no = "global fil %s", + ro = "fisier global %s", + }, + ["databases:4"] = { + cs = "unknown file %s", + de = "unbekannte Datei %s", + en = "unknown file %s", + fr = "fichier inconnu %s", + it = "file sconosciuto %s", + nl = "onbekend bestand %s", + no = "ukjent fil %s", + ro = "fisier necunoscut %s", + }, + ["extended: preamble '%s', state '%s', order '%s'"] = { + nl = "uitgebreid: preamble '%s', status '%s', volgorde '%s'", + }, + ["figures:1"] = { + cs = "obraz %s nelze nalezt", + de = "Abbildung %s kann nicht gefunden werden", + en = "figure %s can not be found", + fr = "la figure %s ne peut être trouvée", + it = "figura %s non trovata", + nl = "figuur %s is niet te vinden", + ro = "figura %s nu poate fi gasita", + }, + ["figures:2"] = { + cs = "obraz %s nepritomen", + de = "Abbildung %s wird nicht erstellt", + en = "figure %s is not preset", + fr = "la figure %s n'est pas pré-sélectionnée", + it = "la figura %s non è preimpostata", + nl = "figuur %s wordt niet preset", + ro = "figura %s nu este presetata", + }, + ["figures:3"] = { + cs = "dimensions of %s are determined externally", + de = "dimensions of %s are determined externally", + en = "dimensions of %s are determined externally", + fr = "dimensions of %s are determined externally", + it = "dimensions of %s are determined externally", + nl = "maten van %s worden extern vastgesteld", + ro = "dimensions of %s are determined externally", + }, + ["figures:4"] = { + cs = "dimenze obrazu %s nacteny primo z jeho souboru", + de = "Dimensionen von %s geladen aus der Abbildungsdatei selbst", + en = "dimensions of %s loaded from figurefile itself", + fr = "les dimensions de %s chargées implicitement à partir du fichier de figure", + it = "dimensioni di %s caricate dal file di immagini stesso", + nl = "maten van %s geladen uit figuurfile zelf", + ro = "dimensiunea figurii %s se incarca din fisierul insusi", + }, + ["figures:5"] = { + cs = "dimensions of %s are unknown", + de = "Dimensions of %s are unknown", + en = "dimensions of %s are unknown", + fr = "dimensions of %s are unknown", + it = "dimensions of %s are unknown", + nl = "maten van %s zijn onbekend", + ro = "dimensions of %s are unknown", + }, + ["figures:6"] = { + cs = "dimenze obrazu %s spocteny programem rlxtools", + de = "Dimensionen von %s ausgerechnet durch rlxtools", + en = "dimensions of %s calculated by rlxtools", + fr = "les dimensions de %s calculées par rlxtools", + it = "dimensioni di %s calcolate da rlxtools", + nl = "maten van %s berekend door rlxtools", + ro = "dimensiunea figurii %s este calculata de rlxtools", + }, + ["figures:8"] = { + cs = "obrazovy objekt %s je znovu pouzit", + de = "Abbildungobjekt %s wurde wiederverwandt", + en = "figureobject %s is reused", + fr = "figureobject %s est réutilisé", + it = "oggetto-figura %s riutilizzato", + nl = "figuurobject %s wordt opnieuw gebruikt", + ro = "obiectul figura %s este refolosit", + }, + ["files:1"] = { + cs = "synonymum souboru %s je jiz pouzito pro %s", + de = "Dateisynonym %s wird bereits fuer %s benutzt", + en = "file synonym %s is already used for %s", + fr = "le synonyme de fichier %s est déjà utilisé pour %s", + it = "sinonimo file %s già in uso per %s", + nl = "file synoniem %s is al in gebruik voor %s", + no = "filesynonym %s er allerede brukt for %s", + ro = "sinonimul fisierelor %s este folosit deja pentru %s", + }, + ["filters:1"] = { + cs = "filter %s is loaded", + de = "filter %s ist geladen", + en = "filter %s is loaded", + fr = "le filtre %s est chargé", + it = "filtro %s caricato", + nl = "filter %s wordt geladen", + }, + ["filters:2"] = { + cs = "unknown filter %s", + de = "unknown filter %s", + en = "unknown filter %s", + fr = "filtre %s inconnu", + it = "filtro sconosciuto %s", + nl = "onbekend filter %s", + }, + ["floatblocks:1"] = { + cs = "%s precislovano / %s => %s", + de = "%s neu nummeriert / %s => %s", + en = "%s renumbered / %s => %s", + fr = "%s renuméroté / %s => %s", + it = "%s rinumerato / %s => %s", + nl = "%s hernummerd / %s => %s", + no = "%s renummerert / %s => %s", + ro = "%s renumerotat / %s => %s", + }, + ["floatblocks:10"] = { + cs = "%s omezeno", + de = "%s begrenzt", + en = "%s limited", + fr = "%s limité", + it = "%s limitato", + nl = "%s begrensd", + no = "%s begrenset", + ro = "%s limitat", + }, + ["floatblocks:11"] = { + cs = "nedan zadny blok", + de = "kein Block gegeben", + en = "no block given", + fr = "pas de bloc donné", + it = "nessun oggetto specificato", + nl = "geen blok opgegeven", + no = "ingen blokk oppgitt", + ro = "nu este dat nici un bloc", + }, + ["floatblocks:12"] = { + cs = "nedefinovano", + de = "undefiniert", + en = "undefined", + fr = "indéfini", + it = "non definito", + nl = "niet gedefinieerd", + no = "udefinert", + ro = "nedefinit", + }, + ["floatblocks:13"] = { + cs = "there is nothing to split", + de = "there is nothing to split", + en = "there is nothing to split", + fr = "there is nothing to split", + it = "there is nothing to split", + nl = "er is niets te splitsen", + no = "there is nothing to split", + ro = "there is nothing to split", + }, + ["floatblocks:2"] = { + cs = "%s ulozeno", + de = "%s gespeichert", + en = "%s saved", + fr = "%s sauvegardé", + it = "%s salvato", + nl = "%s bewaard", + no = "%s lagret", + ro = "%s salvat", + }, + ["floatblocks:3"] = { + cs = "%s presunuto", + de = "%s verschoben", + en = "%s moved", + fr = "%s déplacé", + it = "%s mosso", + nl = "%s verplaatst", + no = "%s flyttet", + ro = "%s mutat", + }, + ["floatblocks:4"] = { + cs = "%s umisteno", + de = "%s plaziert", + en = "%s placed", + fr = "%s placé", + it = "%s sistemato", + nl = "%s geplaatst", + no = "%s plassert", + ro = "%s plasat", + }, + ["floatblocks:5"] = { + cs = "poradi prizpusobeno", + de = "Reihenfolge angepasst", + en = "order adapted", + fr = "ordre adapté", + it = "ordine aggiustato", + nl = "volgorde aangepast", + no = "rekkefølge tilpasset", + ro = "ordinea adaptata", + }, + ["floatblocks:6"] = { + cs = "pocet hornich plovoucich objektu je omezen na %s", + de = "Anz. der oberen Gleitobjekte beschraengt auf %s", + en = "n of top floats limited to %s", + fr = "n flottants de haut de page limité à %s", + it = "n di top floats limitato a %s", + nl = "maximaal %s boven", + no = "maksimalt %s flytblokker øverst", + ro = "nr. cadrelor de sus limitat la %s", + }, + ["floatblocks:7"] = { + cs = "pocet spodnich plovoucich objektu je omezen na %s", + de = "Anz. der unteren Gleitobjekte beschraengt auf %s", + en = "n of bottom floats limited to %s", + fr = "n flottants de bas de page limité à %s", + it = "n di bottom floats limitato a %s", + nl = "maximaal %s onder", + no = "maksimalt %s flytblokker nederst", + ro = "nr. blocurilor de jos limitat la %s", + }, + ["floatblocks:8"] = { + cs = "radku je mene nez %s", + de = "weniger als %s zeilen", + en = "less than %s lines", + fr = "moins de %s lignes", + it = "meno di %s righe", + nl = "minder dan %s regels", + no = "mindre enn %s linjer", + ro = "mai putin de %s linii", + }, + ["floatblocks:9"] = { + cs = "poradi naruseno", + de = "Reigenfolge gestoert", + en = "order disturbed", + fr = "ordre perturbé", + it = "ordine disturbato", + nl = "volgorde verstoord", + no = "rekkefølge endret", + ro = "ordinea deranjata", + }, + ["flushed: preamble '%s'"] = { + nl = "weggeschreven: preamble '%s'", + }, + ["fonts:1"] = { + cs = "kodovani %s", + de = "Kodierung %s", + en = "coding %s", + fr = "encodage %s", + it = "codifica %s", + nl = "codering %s", + no = "koding %s", + ro = "codificarea %s", + }, + ["fonts:10"] = { + cs = "neznamy font %s", + de = "unbekanntes Font %s", + en = "unknown font file %s", + fr = "fichier de police %s inconnu", + it = "file di font sconosciuto %s", + nl = "onbekende font file %s", + no = "ukjent fontfil %s", + ro = "fisier font necunoscut %s", + }, + ["fonts:14"] = { + cs = "bodyfont %s is defined (can better be done global)", + de = "Fliesstext %s wurde definiert (besser waere globale Definition)", + en = "bodyfont %s is defined (can better be done global)", + fr = "policecorps %s est défini (une définition globale pourrait être plus adéquat)", + it = "corpo del testo %s definito (sarebbe meglio globale)", + nl = "korps %s is gedefinieerd (kan beter globaal plaatsvinden)", + no = "bodyfont %s is defined (can better be done global)", + ro = "bodyfont %s is defined (can better be done global)", + }, + ["fonts:2"] = { + cs = "varianta %s je nactena", + de = "Variante %s ist geladen", + en = "variant %s is loaded", + fr = "la variante %s est chargée", + it = "variante %s caricata", + nl = "variant %s wordt geladen", + no = "variant %s er lest inn", + ro = "varianta %s este incarcata", + }, + ["fonts:3"] = { + cs = "neznama varianta %s", + de = "Unbekannte Variante %s", + en = "unknown variant %s", + fr = "variante %s inconnue", + it = "variante sconosciuta %s", + nl = "onbekende variant %s", + no = "ukjent variant %s", + ro = "varianta necunoscuta %s", + }, + ["fonts:4"] = { + cs = "zakladni font %s neni definovan", + de = "Fliesstext %s ist nicht definiert", + en = "bodyfont %s is not defined", + fr = "policecorps %s n'est pas définie", + it = "corpo del testo %s non definito", + nl = "korps %s is niet gedefinieerd", + no = "hovedfont %s er ikke definert", + ro = "corpul de litere %s nu este definit", + }, + ["fonts:5"] = { + cs = "styl %s neni definovan", + de = "Stil %s ist nicht definiert", + en = "style %s is not defined", + fr = "le style %s n'est pas défini", + it = "stile %s non definito", + nl = "stijl %s is niet gedefinieerd", + no = "stil %s er ikke definert", + ro = "stilul %s nu este definit", + }, + ["fonts:6"] = { + cs = "%s je nacten", + de = "%s ist geladen", + en = "%s is loaded", + fr = "%s est chargé", + it = "%s caricato", + nl = "%s wordt geladen", + no = "%s er lest inn", + ro = "%s este incarcat", + }, + ["fonts:7"] = { + cs = "neznamy format %s", + de = "unbekanntes Format %s", + en = "unknown format %s", + fr = "format %s inconnu", + it = "formato sconosciuto %s", + nl = "onbekend formaat %s", + no = "ukjent format %s", + ro = "format necunoscut %s", + }, + ["fonts:8"] = { + cs = "styl %s definovan", + de = "Stil %s definiert", + en = "style %s defined", + fr = "style %s défini", + it = "stile %s definito", + nl = "stijl %s gedefinieerd", + no = "stil %s definert", + ro = "stilul %s definit", + }, + ["interactions:1"] = { + cs = "pomer %s x %s (s x v)", + de = "Seitenverhaeltnis %s x %s (B x H)", + en = "aspect ratio %s x %s (b x h)", + fr = "ratio d'aspect %s x %s (b x h)", + it = "rapporto %s x %s (b x a)", + nl = "aspect ratio %s x %s (b x h)", + no = "forholdstall %s x %s (b x h)", + ro = "aspectul %s x %s (b x h)", + }, + ["interactions:2"] = { + cs = "aktivni", + de = "aktiv", + en = "active", + fr = "actif", + it = "attiva", + nl = "actief", + no = "aktiv", + ro = "activ", + }, + ["interactions:21"] = { + cs = "%s kod vlozen", + de = "%s Code eingefuegt", + en = "%s code inserted", + fr = "%s code inseré", + it = "codice %s inserito", + nl = "%s code tussengevoegd", + no = "%s kode satt inn / tilføyd", + ro = "%s cod inserat", + }, + ["interactions:3"] = { + cs = "neaktivni", + de = "inaktiv", + en = "inactive", + fr = "inactif", + it = "inattiva", + nl = "niet actief", + no = "inaktiv", + ro = "inactiv", + }, + ["interactions:4"] = { + cs = "zadna strankova synchronizace (%s) v hmode", + de = "keine Seitensynchronisation (%s) im hmode", + en = "no pagesynchronisation (%s) in hmode", + fr = "pas de synchronisation de page (%s) dans le hmode", + it = "sincronizzazione di pagina (%s) non disponibile in hmode", + nl = "geen paginasynchronisatie (%s) in hmode", + no = "ingen sidesynkronisering (%s) i hmode", + ro = "nu exista sincronizare pt. pagini (%s) in hmode", + }, + ["interactions:5"] = { + cs = "unknown attachment %s", + de = "unknown attachment %s", + en = "unknown attachment %s", + fr = "le fichier joint %s est inconnu", + it = "unknown attachment %s", + nl = "onbekend attachment %s", + no = "unknown attachment %s", + ro = "unknown attachment %s", + }, + ["interactions:6"] = { + cs = "attachment file %s does not exist", + de = "attachment file %s does not exist", + en = "attachment file %s does not exist", + fr = "le fichier joint %s n'existe pas", + it = "attachment file %s does not exist", + nl = "attachment file %s bestaat niet", + no = "attachment file %s does not exist", + ro = "attachment file %s does not exist", + }, + ["languages:1"] = { + cs = "vzory %s pro %s nacteny (n=%s,e=%s,m=%s)", + de = "Trennmuster %s fuer %s geladen (n=%s,e=%s,m=%s)", + en = "patterns %s for %s loaded (n=%s,e=%s,m=%s)", + fr = "les motifs %s pour %s sont chargés (n=%s,e=%s,m=%s)", + it = "schemi %s per %s caricati (n=%s,e=%s,m=%s)", + nl = "afbreekpatronen %s voor %s geladen (n=%s,e=%s,m=%s)", + no = "orddelingsmønster %s for %s er lest inn (n=%s,e=%s,m=%s)", + ro = "sablonul %s pentru %s s-a incarcat (n=%s,e=%s,m=%s)", + }, + ["languages:10"] = { + cs = "vzory %s nacteny", + de = "Trennmuster %s geladen", + en = "patterns %s loaded", + fr = "motifs %s chargés", + it = "schemi %s caricati", + nl = "patronen %sgeladen", + no = "orddelingsmønster %s er lest inn", + ro = "sabloanele %s incarcate", + }, + ["languages:2"] = { + cs = "zadne vzory %s pro %s (n=%s,e=%s,m=%s) (%s,%s)", + de = "Keine Trennmuster %s fuer %s (n=%s,e=%s,m=%s) (%s,%s)", + en = "no patterns %s for %s (n=%s,e=%s,m=%s) (%s,%s)", + fr = "pas de motifs %s pour %s (n=%s,e=%s,m=%s) (%s,%s)", + it = "niente schemi %s per %s (n=%s,e=%s,m=%s) (%s,%s)", + nl = "geen afbreekpatronen %s voor %s (n=%s,e=%s,m=%s) (%s,%s)", + no = "ingen orddelingsmønster %s for %s (n=%s,e=%s,m=%s) (%s,%s)", + ro = "nu exista sabloane %s pentru %s (n=%s,e=%s,m=%s) (%s,%s)", + }, + ["languages:3"] = { + cs = "deleni slov %s pro %s nacteno (n=%s,e=%s,m=%s)", + de = "Trenndefinitionen %s fuer %s geladen (n=%s,e=%s,m=%s)", + en = "hyphenations %s for %s loaded (n=%s,e=%s,m=%s)", + fr = "hyphenations %s pour %s chargés (n=%s,e=%s,m=%s)", + it = "sillabazione %s per %s caricata (n=%s,e=%s,m=%s)", + nl = "afbreekdefinities %s voor %s geladen (n=%s,e=%s,m=%s)", + no = "orddelingsdefinisjon %s for %s er lest inn (n=%s,e=%s,m=%s)", + ro = "despartirea in silabe %s pentru %s s-a incarcat (n=%s,e=%s,m=%s)", + }, + ["languages:4"] = { + cs = "zadne deleni slov %s pro %s (n=%s,e=%s,m=%s)", + de = "Keine Trenndefinitionen %s fuer %s (n=%s,e=%s,m=%s)", + en = "no hyphenations %s for %s (n=%s,e=%s,m=%s)", + fr = "pas d'hyphenations %s pour %s (n=%s,e=%s,m=%s)", + it = "niente sillabazione %s per %s (n=%s,e=%s,m=%s)", + nl = "geen afbreekdefinities %s voor %s (n=%s,e=%s,m=%s)", + no = "ingen orddelingsdefinisjon %s for %s (n=%s,e=%s,m=%s)", + ro = "nu exista despartire in silabe %s pentru %s (n=%s,e=%s,m=%s)", + }, + ["languages:5"] = { + cs = "vzory pro %s nenacteny", + de = "Trennmuster fuer %s nicht geladen", + en = "patterns for %s not loaded", + fr = "les motifs pour %s ne sont pas chargés", + it = "schemi per %s non caricati", + nl = "afbreekpatronen voor %s niet geladen", + no = "orddelingsmønster for %s er ikke lest inn", + ro = "sabloanele pentru %s nu sunt incarcate", + }, + ["languages:6"] = { + cs = "jazyk %s neni definovan", + de = "Sprache %s ist undefiniert", + en = "language %s is undefined", + fr = "langue %s non définie", + it = "lingua %s non definita", + nl = "taal %s is niet gedefinieerd", + no = "spràk %s er udefinert", + ro = "limba %s nu este definita", + }, + ["languages:7"] = { + cs = "specificke volby jazyka [%s] zavadeji %s (zavlecenou) mezeru", + de = "Sprachenspezifische Option [%s] fuegt eine Luecke von %s ein", + en = "language specific options [%s] introduce a %s skip", + fr = "les options spécifiques de langue [%s] introduisent un %s saut", + it = "opzioni specifiche per la lingua [%s] introducono un salto %s", + nl = "taal specifieke opties [%s] introduceren een skip van %s", + no = "spràk spesifikk opsjon [%s] introduserer et %s hopp", + ro = "optiunile specifice ale limbii [%s] introduc un spatiu %s", + }, + ["languages:8"] = { + cs = "specificke volby jazyka [%s] bez mezer pripojeny", + de = "Sprachenspezifische Option [%s] nahtlos hinzugefuegt", + en = "language specific options [%s] seamless appended", + fr = "les options spécifiques de langue [%s] sont ajoutés en douceur", + it = "opzioni specifiche per la lingua [%s] aggiunte trasparentemente", + nl = "taal specifieke opties [%s] naadloos toegevoegd", + no = "spràk spesifikk opsjon [%s] problemfritt tilføyd", + ro = "optiunile specifice ale limbii [%s] adaugate", + }, + ["languages:9"] = { + cs = "language %s is active", + de = "Sprache %s ist aktiv", + en = "language %s is active", + fr = "la langue %s est active", + it = "lingua %s attiva", + nl = "taal %s is actief", + no = "spràk %s er aktivt", + ro = "limba %s este activa", + }, + ["layouts:1"] = { + cs = "vyska textu prizpusobena s %s na strane %s", + de = "Texthoehe angepasst mit %s auf Seite %s", + en = "textheight adapted with %s at page %s", + fr = "hauteurtexte adaptée avec %s à la page %s", + it = "altezza del testo adattata con %s a pagina %s", + nl = "teksthoogte aangepast met %s op pagina %s", + no = "teksthøyde tilpasset med %s på side %s", + ro = "textheight adaptat cu %s la pagina %s", + }, + ["layouts:10"] = { + cs = "%s a %s nedava dohromady 1.0", + de = "%s und %s ergeben zusammen nicht 1.0", + en = "%s and %s don't add up to 1.0", + fr = "%s et %s ne sont pas ajoutés à 1.0", + it = "%s e %s non sommano a 1.0", + nl = "%s en %s tellen niet op tot 1.0", + no = "%s og %s er ikke 1.0 til sammen", + ro = "%s si %s nu se adauga pana la 1.0", + }, + ["layouts:11"] = { + cs = "svisla mezera %s neni povolena v pevnem radkovem rejstriku", + de = "Zwischenraum %s nicht im Grittermoduserlau", + en = "spacing %s not permitted in gridmode", + fr = "espacement %s non permis en modegrille", + it = "spaziatura %s non permessa in modo griglia", + nl = "interlinie %s niet toegestaan in gridmode", + no = "mellomrom %s ikke tillatt i gridmodus", + ro = "spatierea %s nu este permisa in gridmode", + }, + ["layouts:2"] = { + cs = "%s krat odlozeny text umisten", + de = "%s mal verschobener Text plaziert", + en = "%s times postponed text placed", + fr = "%s times postponed text placed", + it = "posizionato testo posticipato %s volte", + nl = "%s maal uitgestelde tekst tussengevoegd", + no = "%s ganger forskjøvet tekst plassert", + ro = "textul amanat de %s ori a fost plasat", + }, + ["layouts:3"] = { + cs = "%s krat text odlozen", + de = "%s mal Text verschoben", + en = "%s times text postponed", + fr = "%s times text postponed", + it = "testo posticipato %s volte", + nl = "%s maal tekst plaatsen uitstellen", + no = "%s ganger tekst forskjøvet", + ro = "textul amanat de %s ori", + }, + ["layouts:4"] = { + cs = "okrajove bloky aktivni", + de = "marginalbloecke aktiv", + en = "marginblocks active", + fr = "blocsmarge actifs", + it = "blocchi in margine attivi", + nl = "margeblokken actief", + no = "margblokker aktive", + ro = "blocuri marginale active", + }, + ["layouts:5"] = { + cs = "okrajove bloky neaktivni", + de = "marginalbloecke inaktiv", + en = "marginblocks inactive", + fr = "blocsmarge inactifs", + it = "blocchi in margine inattivi", + nl = "margeblokken inactief", + no = "margblokker inaktive", + ro = "blocuri marginale inactive", + }, + ["layouts:6"] = { + cs = "sada stran %s zpracovana (velikost %s)", + de = "Unterseitenfolge %s verarbeitet (Groesse %s)", + en = "subpage set %s processed (size %s)", + fr = "jeu de souspage %s traité (taille %s)", + it = "gruppo di sottopagine %s elaborato (dimensione %s)", + nl = "subpagina reeks %s verwerkt (aantal %s)", + no = "delside sett %s behandlet (størrelse %s)", + ro = "setul %s de subpagini procesat (dimensiunea %s)", + }, + ["layouts:7"] = { + cs = "pocita se misto pro logo", + de = "berechne Platzbedarf des Logos", + en = "calculating logospace", + fr = "calcul de l'espace pour le logo", + it = "calcolo dello spazio per logo", + nl = "beeldmerken berekenen", + no = "beregner plass for logo", + ro = "se calculeaza spatiul pentru logo", + }, + ["layouts:8"] = { + cs = "pocita se pozadi", + de = "berechne Hintergrund", + en = "calculating backgrounds", + fr = "calcul des arrières-plans", + it = "calcolo dello sfondo", + nl = "achtergronden berekenen", + no = "beregner bakgrunn", + ro = "se calculeaza fundalurile", + }, + ["layouts:9"] = { + cs = "aktualne ne vice nez %s urovne/urovni vyctu", + de = "z.Z. nicht mehr als %s Ebenen in Aufzaehlungen", + en = "currently no more than %s levels in itemizations", + fr = "pas plus de %s niveaux pour l'instant dans les élémentarisations", + it = "attualmente non più di %s livelli di elencazione", + nl = "momenteel maximaal %s niveaus in opsommingen", + no = "for øyeblikket maksimalt %s nivåer i opplisting", + ro = "acum nu se supota mai mult de %s nivele de adancime la iteratii", + }, + ["loaded: '%s'"] = { + nl = "geladen: '%s'", + }, + ["loaded: library '%s'"] = { + nl = "geladen: bibliotheek '%s'", + }, + ["loading: '%s'"] = { + nl = "laden: '%s'", + }, + ["locating: '%s'"] = { + nl = "zoeken: '%s'", + }, + ["not found: '%s'"] = { + nl = "niet gevonden: '%s'", + }, + ["number 1: %s, number 2: %s"] = { + en = "number 1: (%s), number 2: (%s)", + nl = "nummer 1: (%s), nummer 2: (%s)", + }, + ["popping level: %s"] = { + nl = "niveau omlaag: %s", + }, + ["publications:1"] = { + en = "file %s not found, unknown style ignored", + }, + ["publications:2"] = { + en = "file %s not found, waiting for bibtex", + }, + ["publications:3"] = { + en = "wrote a new auxiliary file \\jobname.aux", + }, + ["publications:4"] = { + en = "loading database from %s", + }, + ["publications:5"] = { + en = "warning: unknown cite argument %s on line \\the\\inputlineno", + }, + ["publications:6"] = { + en = "loading formatting style from %s", + }, + ["publications:7"] = { + en = "placing all entries, use 'text' to be more selective", + }, + ["pushing level: %s"] = { + nl = "niveau omhoog: %s", + }, + ["references:1"] = { + cs = "neznama reference %s", + de = "unbekannte Referenz %s", + en = "unknown reference %s", + fr = "réference %s inconnue", + it = "riferimento sconosciuto %s", + nl = "onbekende verwijzing %s", + no = "ukjent referanse %s", + ro = "referinta necunoscuta %s", + }, + ["references:2"] = { + cs = "duplicitni reference %s na strane %s", + de = "doppelte Referenz %s auf Seite %s", + en = "duplicate reference %s on page %s", + fr = "réference %s dupliquée à la page %s", + it = "riferimento duplicato %s a pagina %s", + nl = "dubbele verwijzing %s op pagina %s", + no = "duplikat referanse %s pø side %s", + ro = "referinta duplicat %s la pagina %s", + }, + ["references:21"] = { + cs = "dokument %s nacten", + de = "Dokument %s geladen", + en = "document %s loaded", + fr = "document %s chargé", + it = "documento %s caricato", + nl = "document %s geladen", + no = "dokument %s er lest inn", + ro = "documentul %s este incarcat", + }, + ["references:22"] = { + cs = "dokument %s neni interaktivni", + de = "Dokument %s ist nicht aktiv", + en = "document %s is not interactive", + fr = "le document %s n'est pas interactif", + it = "il documento %s non ø interattivo", + nl = "document %s is niet interactief", + no = "dokument %s er ikke interaktivt", + ro = "documentul %s nu este interactiv", + }, + ["references:23"] = { + cs = "obskurni (nejasna) reference %s (prefix=%s)", + de = "Obskure Referenz %s (Prefix=%s)", + en = "obscure reference %s (prefix=%s)", + fr = "reference %s indéterminé (préfixe=%s)", + it = "riferimento ambiguo %s (prefisso=%s)", + nl = "onduidelijke verwijzing %s (prefix=%s)", + no = "obskur referanse %s (Prefix=%s)", + ro = "referinta obscura %s (prefix=%s)", + }, + ["references:24"] = { + en = "references from document '%s' are not exported", + }, + ["references:25"] = { + en = "references from document '%s' are not imported (export again)", + }, + ["references:26"] = { + en = "references from document '%s' are imported", + }, + ["references:3"] = { + cs = "neznamy typ reference %s", + de = "unbekannte Referenz Typ %s", + en = "unknown reference type %s", + fr = "type %s de réference inconnu", + it = "riferimento di tipo sconosciuto %s", + nl = "type verwijzing %s onbekend", + no = "ukjent referansetype %s", + ro = "tip necunoscut de referinta %s", + }, + ["references:30"] = { + cs = "neznamy objekt %s", + de = "unbekanntes Object %s", + en = "unknown object %s", + fr = "objet %s inconnu", + it = "oggetto sconosciuto %s", + nl = "onbekend object %s", + no = "ukjent objekt %s", + ro = "obiect necunoscut %s", + }, + ["references:31"] = { + cs = "duplicitni object %s", + de = "doppeltes Object %s", + en = "duplicate object %s", + fr = "objet %s dupliqué", + it = "oggetto duplicato %s", + nl = "dubbel object %s", + no = "duplikat objekt %s", + ro = "obiect duplicat %s", + }, + ["references:4"] = { + cs = "nedovolena reference %s", + de = "illegale Referenz %s", + en = "illegal reference %s", + fr = "réference %s inconnue", + it = "riferimento illecito %s", + nl = "verboden verwijzing %s", + no = "ulovlig referanse %s", + ro = "referinta eronata %s", + }, + ["references:5"] = { + en = "number of unknown references: %s", + }, + ["references:6"] = { + en = "number of illegal references: %s", + }, + ["start: '%s'"] = {}, + ["stop: '%s'"] = {}, + ["stored: preamble '%s', state '%s', order '%s'"] = { + nl = "opgeslagen: preamble '%s', status '%s', volgorde '%s'", + }, + ["structures:1"] = { + cs = "zacatek oddilu (sekce) %s", + de = "Begin des Abschnittsblocks %s", + en = "begin of sectionblock %s", + fr = "début de blocsection %s", + it = "inizio del blocco (sezione) %s", + nl = "begin van sectieblok %s", + no = "starten av blokk %s (seksjon)", + ro = "inceput de bloc sectiune %s", + }, + ["structures:2"] = { + cs = "konec oddilu (sekce) %s", + de = "Ende des Abschnittsblocks %s", + en = "end of sectionblock %s", + fr = "fin de blocsection %s", + it = "fine del blocco (sezione) %s", + nl = "eind van sectieblok %s", + no = "slutten av blokk %s (seksjon)", + ro = "sfarsit de bloc sectiune %s", + }, + ["symbols:1"] = { + cs = "nacita se soubor symbolu %s", + de = "Lade Symboldatei %s", + en = "loading symbolset %s", + fr = "chargement du jeu de symbole %s", + it = "caricamento gruppo di simboli %s", + nl = "symboolset %s wordt geladen", + no = "leser inn symbolsett %s", + ro = "se incarca setul de simboluri %s", + }, + ["system:1"] = { + cs = "nacteni pomocneho souboru odlozeno (typemode)", + de = "Laden der Hilfsdatei aufgeschoben (Eingabe-Modus)", + en = "loading utility-file postponed (typemode)", + fr = "chargement de fichier utilitaire reporté (typemode)", + it = "caricamento dei file supplementari posticipato (typemode)", + nl = "laden hulpfile uitgesteld (typemode)", + no = "innlesning av hjelpefila utsatt (typemode)", + ro = "se incarca utilitarul-fisierul este amanat (typemode)", + }, + ["system:10"] = { + cs = "nepouzivejte em v %s", + de = "Benutzte kein em in %s", + en = "don't use em in %s", + fr = "n'utilisez pas em dans %s", + it = "non usare em in %s", + nl = "gebruik geen em in %s", + no = "ikke bruk em i %s", + ro = "nu folositi em in %s", + }, + ["system:11"] = { + cs = "vytvarim jednoduchy pomocny soubor", + de = "Erstelle einfache Hilfdatei", + en = "building simple util", + fr = "construction util simple", + it = "costruzione di un semplice supplemento", + nl = "aanmaken basale hulpfile", + no = "lager enkel hjelpefil", + ro = "se creeaza un utilitar simplu", + }, + ["system:12"] = { + cs = "pomosny soubor neni setriden, pouzijte texutil", + de = "Die Hilfdatei ist nicht sortiert, verwende texutil", + en = "the utility-file is not sorted, use texutil", + fr = "le fichier utilitaire n'est pas trié, utilise texutil", + it = "file di supplemento non ordinato, usare texutil", + nl = "de hulpfile is niet gesorteerd, gebruik texutil", + no = "hjelpefila er ikke sortert, bruk texutil", + ro = "fisierul utilitar nu este sortat, folositi texutil", + }, + ["system:13"] = { + cs = "znacka %s definovana %s", + de = "Beschriftung %s definiert %s", + en = "mark %s defined %s", + fr = "marquage %s defini %s", + it = "marcatura %s definita %s", + nl = "markering %s gedefinieerd %s", + no = "markering %s definert %s", + ro = "marcajul %s definit %s", + }, + ["system:14"] = { + cs = "vynucena nova stranka v seznamu na %s", + de = "Erzwungendes Seitenumbruch in Liste bei %s", + en = "forced newpage in list at %s", + fr = "nouvellepage forcée dans la liste à %s", + it = "nuova pagina obbligata in lista a %s", + nl = "geforceerde paginaovergang in lijst voor %s", + no = "tvunget sideskift i liste ved %s", + ro = "s-a fortat trecere pa pagina noua in lista la %s", + }, + ["system:15"] = { + cs = "uklada se buffer %s", + de = "Speichere Buffer %s", + en = "saving buffer %s", + fr = "sauvegarde du tampon (buffer) %s", + it = "salvataggio del buffer %s", + nl = "wegschrijven buffer %s", + no = "lagrer Buffer %s", + ro = "buffer salvat %s", + }, + ["system:16"] = { + cs = "sazi se buffer %s", + de = "Setzte Buffer %s", + en = "typesetting buffer %s", + fr = "composition du tampon (buffer) %s", + it = "composizione del buffer %s", + nl = "inlezen buffer %s", + no = "tegnsetter buffer %s", + ro = "buffer-ul %s s-a cules", + }, + ["system:17"] = { + cs = "sazi se doslovny (verbatim) buffer %s", + de = "Setzte tippen-Buffer %s", + en = "typesetting verbatim buffer %s", + fr = "composition textuelle du tampon (buffer) %s", + it = "composizione verbatim del buffer %s", + nl = "verbatim inlezen buffer %s", + no = "tegnsetter verbatim-buffer %s", + ro = "se culege buffer-ul verbatim %s", + }, + ["system:18"] = { + cs = "synonymum %s %s neexistuje", + de = "Synonym %s %s existiert nicht", + en = "synonym %s %s does not exist", + fr = "le synonyme %s %s n'existe pas", + it = "sinonimo %s %s non esistente", + nl = "synoniem %s %s bestaat niet", + no = "synonym %s %s eksisterer ikke", + ro = "sinonimul %s %s nu exista", + }, + ["system:19"] = { + cs = "vyznam (synonyma) %s nacten", + de = "Bedeutung (synonyme) von %s geladen", + en = "meaning (synonyms) of %s loaded", + fr = "signification (synonymes) de %s chargée", + it = "significato (sinonimi) di %s caricato", + nl = "betekenissen (synoniemen) van %s geladen", + no = "betydning (synonymer) av %s er lest inn", + ro = "intelesul (sinonimele) pentru %s incarcat", + }, + ["system:2"] = { + cs = "%s nacteno", + de = "%s geladen", + en = "%s loaded", + fr = "%s chargé", + it = "%s caricato", + nl = "%s geladen", + no = "%s er lest inn", + ro = "%s s-a incarcat", + }, + ["system:20"] = { + cs = "vyznam (trideni) %s nacten", + de = "Bedeutung (sortieren) von %s geladen", + en = "meaning (sorts) of %s loaded", + fr = "signification (tris) de %s chargée", + it = "significato (specie) di %s caricato", + nl = "betekenissen (sorteren) van %s geladen", + no = "betydning (sorterer) av %s er lest inn", + ro = "intelesul (ordinea) pentru %s incarcat", + }, + ["system:21"] = { + cs = "pomocny soubor necten", + de = "Die Hilfsdatei ist nicht geladen", + en = "no utility data is loaded", + fr = "pas de données utilitaires chargées", + it = "nessuna informazione supplementare caricata", + nl = "de hulpfile is niet geladen", + no = "hjelpefila er ikke lest inn", + ro = "nici o data utilitara nu este incarcata", + }, + ["system:22"] = { + cs = "pouzijte platny pomocny soubor", + de = "Benoetige gueltige Hilfsdateie", + en = "use a valid utilityfile", + fr = "utilise un fichier utilitaire valide", + it = "usare un file supplementare valido", + nl = "gebruik een goede hulpfile", + no = "bruk en gyldig hjelpefil", + ro = "folositi un fisier utilitar valid", + }, + ["system:23"] = { + cs = "%s upraveno na %s", + de = "%s angeordnet auf %s", + en = "%s arranged at %s", + fr = "%s arrangé à %s", + it = "%s sistemato a %s", + nl = "%s gearrangeerd op %s", + no = "%s arrangert på %s", + ro = "%s aranjat la %s", + }, + ["system:24"] = { + cs = "plovouci bloky", + de = "Fliessbloecke", + en = "Floatblocks", + fr = "blocsflottants", + it = "Oggetti mobili", + nl = "Plaatsblokken", + no = "Flytblokker", + ro = "Blocuri", + }, + ["system:25"] = { + cs = "reference", + de = "Referenzen", + en = "References", + fr = "Réferences", + it = "Riferimenti", + nl = "Verwijzingen", + no = "Referanser", + ro = "Referinte", + }, + ["system:26"] = { + cs = "registry", + de = "Register", + en = "Registers", + fr = "Registres", + it = "Registri", + nl = "Registers", + no = "Registere", + ro = "Registri", + }, + ["system:27"] = { + cs = "verze", + de = "Version", + en = "Version", + fr = "Version", + it = "Versione", + nl = "Versie", + no = "Versjon", + ro = "Versiune", + }, + ["system:4"] = { + cs = "prikaz %s je jiz definovan", + de = "Befehl %s ist bereits definiert", + en = "command %s is already defined", + fr = "la commande %s est déjà définie", + it = "comando %s già definito", + nl = "commando %s is al gedefinieerd", + no = "kommando %s er allerede definert", + ro = "comanda %s este deja definita", + }, + ["system:41"] = { + cs = "externi soubor %s ve skupine %s neexistuje", + de = "Externe Datei %s in Gruppe %s existiert nicht", + en = "external file %s in group %s does not exist", + fr = "le fichier externe %s du groupe %s n'existe pas", + it = "il file esterno %s del gruppo %s non esiste", + nl = "externe file %s in groep %s bestaat niet", + no = "ekstern fil %s i gruppe %s eksisterer ikke", + ro = "fisierul extern %s din grupul %s nu exista", + }, + ["system:5"] = { + cs = "makra z %s nactena", + de = "Modul %s geladen", + en = "module %s loaded", + fr = "module %s chargé", + it = "macro del modulo %s caricate", + nl = "module %s geladen", + no = "makroene i modul %s er lest inn", + ro = "macro-urile din modulul %s s-au incarcat", + }, + ["system:6"] = { + cs = "zadna makra v %s nenalezena", + de = "Modul %s gefunden", + en = "module %s not found", + fr = "module %s non trouvé", + it = "nessuna macro trovata nel modulo %s", + nl = "geen module %s gevonden", + no = "ingen makroer funnet i modul %s-", + ro = "nu s-au gasit macro-uri in modulul %s", + }, + ["system:7"] = { + cs = "makra z %s jsou jiz nactena", + de = "Modul %s bereits geladen", + en = "module %s already loaded", + fr = "module %s déjà chargé", + it = "macro del modulo %s già caricate", + nl = "module %s reeds geladen", + no = "makroene i modul %s er allerede lest inn", + ro = "macro-urile din modulul %s s-au incarcat deja", + }, + ["system:8"] = { + cs = "nova verze pomocneho souboru, je treba druheho behu", + de = "Neue Version der Hilfsdatei, zweiter Durchlauf benoetigt", + en = "new version of utility file, second pass needed", + fr = "nouvelle version de fichier utilitaire, seconde passe nécessaire", + it = "nuova versione del file supplementare, seconda passata necessaria", + nl = "nieuwe versie hulpfile, tweede run nodig", + no = "ny versjon av hjelpefil, andre gjennomkjøring nødvendig", + ro = "o noua versiune de fisier utilitar, este necesara o noua trecere", + }, + ["system:9"] = { + cs = "%s nenalezeno/nezpracovano", + de = "%s nicht gefunden/verarbeitet", + en = "%s not found/processed", + fr = "%s non trouvé/traité", + it = "%s non trovato/elaborato", + nl = "%s niet gevonden/geplaatst", + no = "%s ikke funnet/behandlet", + ro = "%s nu este gasit/procesat", + }, + ["system:91"] = { + en = "papertray %s", + nl = "papierlade %s", + }, + ["textblocks:1"] = { + cs = "nova verze, je treba druhy beh", + de = "neue Version, zweiter Durchlauf benoetigt", + en = "new version, second pass needed", + fr = "nouvelle version, une seconde passe est nécessaire", + it = "nuova versione, seconda passata necessaria", + nl = "nieuwe versie, tweede run nodig", + no = "ny versjon, andre gjennomkjøring nødvendig", + ro = "o noua versiune, este nevoie de inca o trecere", + }, + ["textblocks:10"] = { + cs = "%s nacteno a zpracovano", + de = "%s geladen und verarbeitet", + en = "%s loaded and processed", + fr = "%s chargé et traité", + it = "%s caricato ed elaborato", + nl = "%s geladen en verwerkt", + no = "%s lest inn og behandlet", + ro = "%s incarcat si procesat", + }, + ["textblocks:11"] = { + cs = "%s nacteno a vysazeno", + de = "%s geladen und gesetzt", + en = "%s loaded and typeset", + fr = "%s chargé et composé", + it = "%s caricato e composto", + nl = "%s geladen en geplaatst", + no = "%s lest inn og tegnsatt", + ro = "%s incarcat si cules", + }, + ["textblocks:12"] = { + cs = "%s preskoceno", + de = "%s ausgelassen", + en = "%s skipped", + fr = "%s sauté", + it = "%s saltato", + nl = "%s overgeslagen", + no = "%s utelatt", + ro = "%s sarit peste", + }, + ["textblocks:2"] = { + cs = "zapisuji bloky do %s", + de = "schreibe Bloecke zu %s", + en = "writing blocks to %s", + fr = "ecriture des blocs vers %s", + it = "scrittura dei blocchi su %s", + nl = "wegschrijven blokken naar %s", + no = "skriver blokker til %s", + ro = "se scriu blocurile in %s", + }, + ["textblocks:3"] = { + cs = "ctu bloky z %s", + de = "lese Bloecke von %s", + en = "reading blocks from %s", + fr = "lecture des blocs en provenance de %s", + it = "lettura dei blocchi da %s", + nl = "inlezen blokken uit %s", + no = "leser blokker fra %s", + ro = "se citesc blocurile din %s", + }, + ["textblocks:4"] = { + cs = "je treba druhy beh", + de = "zweiter Durchlauf benoetigt", + en = "second pass needed", + fr = "seconde passe nécessaire", + it = "seconda passata necessaria", + nl = "er is een tweede run nodig", + no = "andre gjennomkjøring nødvendig", + ro = "este nevoie de inca o trecere", + }, + ["textblocks:5"] = { + cs = "%s neni skryto", + de = "%s nicht verborgen", + en = "%s not hidden", + fr = "%s non caché", + it = "%s non nascosto", + nl = "%s niet verborgen", + no = "%s ikke skjult", + ro = "%s nu este ascuns", + }, + ["textblocks:6"] = { + cs = "%s skryto a zpracovano", + de = "%s verborgen und verarbeitet", + en = "%s hidden and processed", + fr = "%s caché et traité", + it = "%s nascosto ed elaborato", + nl = "%s verborgen en verwerkt", + no = "%s skjult og behandlet", + ro = "%s ascuns si procesat", + }, + ["textblocks:7"] = { + cs = "%s skryto", + de = "%s verborgen", + en = "%s hidden", + fr = "%s caché", + it = "%s nascosto", + nl = "%s verborgen", + no = "%s skjult", + ro = "%s ascuns", + }, + ["textblocks:8"] = { + cs = "%s vysazeno", + de = "%s gesetzt", + en = "%s typeset", + fr = "%s composé", + it = "%s composto", + nl = "%s gehandhaafd", + no = "%s tegnsatt", + ro = "%s cules", + }, + ["textblocks:9"] = { + cs = "%s nevysazeno", + de = "%s nicht gesetzt", + en = "%s not typeset", + fr = "%s non composé", + it = "%s non composto", + nl = "%s niet gehandhaafd", + no = "%s ikke tegnsatt", + ro = "%s nu este cules", + }, + ["unknown: library '%s'"] = { + nl = "onbekend: bibliotheek '%s'", + }, + ["used: code '%s'"] = { + nl = "gebruikt: code '%s'", + }, + ["used: code '%s', preamble '%s'"] = { + nl = "gebruikt: code '%s', preamble '%s'", + }, + ["used: function '%s'"] = { + nl = "gebruikt: functie '%s'", + }, + ["used: preamble '%s', state '%s', order '%s'"] = { + nl = "gebruikt: preamble '%s', status '%s', volgorde '%s'", + }, + ["vector '%s' is loaded"] = { + nl = "vector '%s' is geladen", + }, + ["vector '%s' is unknown"] = { + nl = "onbekende vector '%s'", + }, + ["verbatims:1"] = { + cs = "soubor %s neexistuje", + de = "Datei %s existiert nicht", + en = "file %s does not exist", + fr = "le fichier %s n'existe pas", + it = "il file %s non esiste", + nl = "file %s bestaat niet", + no = "fil %s eksisterer ikke", + ro = "fisierul %s nu exista", + }, + }, + translations = { + check = { + cs = "kontrola", + de = "check", + en = "check", + fr = "vérification", + it = "controllo", + nl = "controle", + no = "kontroll", + ro = "verificari", + }, + colors = { + cs = "barva", + de = "farbe", + en = "colors", + fr = "couleurs", + it = "colore", + nl = "kleuren", + no = "farge", + ro = "culori", + }, + columns = { + cs = "sloupce", + de = "Spalten", + en = "columns", + fr = "colonnes", + it = "colonne", + nl = "kolommen", + no = "kolonner", + ro = "coloane", + }, + databases = { + cs = "databases", + de = "Datenbank", + en = "databases", + fr = "bases de données", + it = "database", + nl = "database", + no = "databaser", + ro = "baze de date", + }, + figures = { + cs = "obrazy", + de = "Abbildungen", + en = "figures", + fr = "figures", + it = "figure", + nl = "figuren", + ro = "figuri", + }, + files = { + cs = "soubory", + de = "files", + en = "files", + fr = "fichiers", + it = "file", + nl = "files", + no = "filer", + ro = "fisiere", + }, + filters = { + cs = "filters", + de = "filters", + en = "filters", + fr = "filtre", + it = "filtri", + nl = "filters", + }, + floatblocks = { + cs = "plovouciobjekty", + de = "Gleitobjektbloecke", + en = "floatblocks", + fr = "blocs de flottants", + it = "oggetti mobili", + nl = "plaatsblokken", + no = "flytblokker", + ro = "Blocuri", + }, + fonts = { + cs = "zakladnifont", + de = "Fliesstext", + en = "bodyfont", + fr = "corps de texte", + it = "font del corpo", + nl = "korps", + no = "hovedfont", + ro = "corp de litere", + }, + interactions = { + cs = "interakce", + de = "Interaktions", + en = "interactions", + fr = "interactions", + it = "interazione", + nl = "interacties", + no = "interaksjon", + ro = "interactiuni", + }, + languages = { + cs = "jazyky", + de = "Sprache", + en = "languages", + fr = "langue", + it = "lingua", + nl = "talen", + no = "sprøk", + ro = "limbi", + }, + layouts = { + cs = "layouts", + de = "Layouts", + en = "layouts", + fr = "calque", + it = "layouts", + nl = "layouts", + no = "layouts", + ro = "aranjamente", + }, + numbers = { + nl = "nummers", + }, + publications = { + en = "publications", + }, + references = { + cs = "reference", + de = "referenzen", + en = "references", + fr = "réferences", + it = "riferimenti", + nl = "verwijzingen", + no = "referanser", + ro = "referinte", + }, + regimes = { + de = "Kodierungen", + fr = "encodages", + nl = "regimes", + }, + structures = { + cs = "struktury", + de = "strukture", + en = "structures", + fr = "structures", + it = "struttura", + nl = "structuren", + no = "struktur", + ro = "structuri", + }, + symbols = { + cs = "symboly", + de = "Symbole", + en = "symbols", + fr = "symboles", + it = "simboli", + nl = "symbolen", + no = "symboler", + ro = "simboluri", + }, + system = { + cs = "system", + de = "system", + en = "system", + fr = "système", + it = "sistema", + nl = "systeem", + no = "system", + ro = "sistem", + }, + textblocks = { + cs = "textovyblok", + de = "textblock", + en = "textblocks", + fr = "blocs de texte", + it = "blocchi di testo", + nl = "tekstblokken", + no = "tekstblokker", + ro = "blocuri de text", + }, + verbatims = { + cs = "verbatim", + de = "verbatim", + en = "verbatim", + fr = "verbatim", + it = "verbatim", + nl = "typen", + no = "verbatim", + ro = "verbatim", + }, + }, } diff --git a/Master/texmf-dist/tex/context/base/mult-mfr.mkii b/Master/texmf-dist/tex/context/base/mult-mfr.mkii new file mode 100644 index 00000000000..7fee954c039 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-mfr.mkii @@ -0,0 +1,210 @@ +\setinterfacemessage{references}{1}{réference -- inconnue} +\setinterfacemessage{references}{30}{objet -- inconnu} +\setinterfacemessage{references}{3}{type -- de réference inconnu} +\setinterfacemessage{references}{2}{réference -- dupliquée à la page --} +\setinterfacemessage{references}{5}{number of unknown references: --} +\setinterfacemessage{references}{4}{réference -- inconnue} +\setinterfacemessage{references}{6}{number of illegal references: --} +\setinterfacemessage{references}{25}{references from document '--' are not imported (export again)} +\setinterfacemessage{references}{24}{references from document '--' are not exported} +\setinterfacemessage{references}{title}{réferences} +\setinterfacemessage{references}{26}{references from document '--' are imported} +\setinterfacemessage{references}{31}{objet -- dupliqué} +\setinterfacemessage{references}{21}{document -- chargé} +\setinterfacemessage{references}{22}{le document -- n'est pas interactif} +\setinterfacemessage{references}{23}{reference -- indéterminé (préfixe=--)} +\setinterfacemessage{documents}{1}{sheet --} +\setinterfacemessage{documents}{title}{sheets} +\setinterfacemessage{documents}{2}{number --} +\setinterfacemessage{handlings}{1}{manipulation -- de police} +\setinterfacemessage{handlings}{3}{manipulation -- inconnue de police} +\setinterfacemessage{handlings}{2}{la manipulation -- de police est chargée} +\setinterfacemessage{handlings}{title}{manipulation} +\setinterfacemessage{systems}{title}{système} +\setinterfacemessage{systems}{41}{le fichier externe -- du groupe -- n'existe pas} +\setinterfacemessage{systems}{9}{-- non trouvé/traité} +\setinterfacemessage{systems}{91}{papertray --} +\setinterfacemessage{systems}{8}{nouvelle version de fichier utilitaire, seconde passe nécessaire} +\setinterfacemessage{systems}{21}{pas de données utilitaires chargées} +\setinterfacemessage{systems}{20}{signification (tris) de -- chargée} +\setinterfacemessage{systems}{5}{module -- chargé} +\setinterfacemessage{systems}{4}{la commande -- est déjà définie} +\setinterfacemessage{systems}{27}{Version} +\setinterfacemessage{systems}{26}{Registres} +\setinterfacemessage{systems}{25}{Réferences} +\setinterfacemessage{systems}{24}{blocsflottants} +\setinterfacemessage{systems}{1}{chargement de fichier utilitaire reporté (typemode)} +\setinterfacemessage{systems}{23}{-- arrangé à --} +\setinterfacemessage{systems}{22}{utilise un fichier utilitaire valide} +\setinterfacemessage{systems}{2}{-- chargé} +\setinterfacemessage{systems}{19}{signification (synonymes) de -- chargée} +\setinterfacemessage{systems}{18}{le synonyme -- -- n'existe pas} +\setinterfacemessage{systems}{7}{module -- déjà chargé} +\setinterfacemessage{systems}{6}{module -- non trouvé} +\setinterfacemessage{systems}{14}{nouvellepage forcée dans la liste à --} +\setinterfacemessage{systems}{15}{sauvegarde du tampon (buffer) --} +\setinterfacemessage{systems}{16}{composition du tampon (buffer) --} +\setinterfacemessage{systems}{17}{composition textuelle du tampon (buffer) --} +\setinterfacemessage{systems}{13}{marquage -- defini --} +\setinterfacemessage{systems}{12}{le fichier utilitaire n'est pas trié, utilise texutil} +\setinterfacemessage{systems}{11}{construction util simple} +\setinterfacemessage{systems}{10}{n'utilisez pas em dans --} +\setinterfacemessage{floatblocks}{1}{-- renuméroté / -- => --} +\setinterfacemessage{floatblocks}{3}{-- déplacé} +\setinterfacemessage{floatblocks}{2}{-- sauvegardé} +\setinterfacemessage{floatblocks}{5}{ordre adapté} +\setinterfacemessage{floatblocks}{4}{-- placé} +\setinterfacemessage{floatblocks}{7}{n flottants de bas de page limité à --} +\setinterfacemessage{floatblocks}{6}{n flottants de haut de page limité à --} +\setinterfacemessage{floatblocks}{9}{ordre perturbé} +\setinterfacemessage{floatblocks}{8}{moins de -- lignes} +\setinterfacemessage{floatblocks}{title}{blocs de flottants} +\setinterfacemessage{floatblocks}{13}{there is nothing to split} +\setinterfacemessage{floatblocks}{12}{indéfini} +\setinterfacemessage{floatblocks}{11}{pas de bloc donné} +\setinterfacemessage{floatblocks}{10}{-- limité} +\setinterfacemessage{interactions}{1}{ratio d'aspect -- x -- (b x h)} +\setinterfacemessage{interactions}{3}{inactif} +\setinterfacemessage{interactions}{2}{actif} +\setinterfacemessage{interactions}{5}{le fichier joint -- est inconnu} +\setinterfacemessage{interactions}{4}{pas de synchronisation de page (--) dans le hmode} +\setinterfacemessage{interactions}{6}{le fichier joint -- n'existe pas} +\setinterfacemessage{interactions}{title}{interaction} +\setinterfacemessage{interactions}{21}{-- code inseré} +\setinterfacemessage{regimes}{1}{encodage --} +\setinterfacemessage{regimes}{3}{encodage -- inconnu} +\setinterfacemessage{regimes}{2}{l'encodage -- est chargé} +\setinterfacemessage{regimes}{title}{encodage} +\setinterfacemessage{structures}{1}{début de blocsection --} +\setinterfacemessage{structures}{title}{structure} +\setinterfacemessage{structures}{2}{fin de blocsection --} +\setinterfacemessage{linguals}{1}{les motifs -- pour -- sont chargés (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{3}{hyphenations -- pour -- chargés (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{2}{pas de motifs -- pour -- (n=--,e=--,m=--) (--,--)} +\setinterfacemessage{linguals}{5}{les motifs pour -- ne sont pas chargés} +\setinterfacemessage{linguals}{4}{pas d'hyphenations -- pour -- (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{7}{les options spécifiques de langue [--] introduisent un -- saut} +\setinterfacemessage{linguals}{6}{langue -- non définie} +\setinterfacemessage{linguals}{9}{la langue -- est active} +\setinterfacemessage{linguals}{8}{les options spécifiques de langue [--] sont ajoutés en douceur} +\setinterfacemessage{linguals}{title}{langue} +\setinterfacemessage{linguals}{10}{motifs -- chargés} +\setinterfacemessage{verbatims}{1}{le fichier -- n'existe pas} +\setinterfacemessage{verbatims}{title}{verbatim} +\setinterfacemessage{filters}{1}{le filtre -- est chargé} +\setinterfacemessage{filters}{title}{filtre} +\setinterfacemessage{filters}{2}{filtre -- inconnu} +\setinterfacemessage{textblocks}{1}{nouvelle version, une seconde passe est nécessaire} +\setinterfacemessage{textblocks}{3}{lecture des blocs en provenance de --} +\setinterfacemessage{textblocks}{2}{ecriture des blocs vers --} +\setinterfacemessage{textblocks}{5}{-- non caché} +\setinterfacemessage{textblocks}{4}{seconde passe nécessaire} +\setinterfacemessage{textblocks}{7}{-- caché} +\setinterfacemessage{textblocks}{6}{-- caché et traité} +\setinterfacemessage{textblocks}{9}{-- non composé} +\setinterfacemessage{textblocks}{8}{-- composé} +\setinterfacemessage{textblocks}{title}{blocs de texte} +\setinterfacemessage{textblocks}{12}{-- sauté} +\setinterfacemessage{textblocks}{11}{-- chargé et composé} +\setinterfacemessage{textblocks}{10}{-- chargé et traité} +\setinterfacemessage{encodings}{1}{encodage --} +\setinterfacemessage{encodings}{3}{encodage -- inconnu} +\setinterfacemessage{encodings}{2}{l'encodage -- est chargé} +\setinterfacemessage{encodings}{title}{encodage} +\setinterfacemessage{columns}{1}{seules -- colonnes possibles} +\setinterfacemessage{columns}{3}{problèmes, désactive l'équilibrage} +\setinterfacemessage{columns}{2}{utilisez \string\filbreak\space en tant qu'alternative} +\setinterfacemessage{columns}{5}{flottant en partie inférieure pas encore supporté} +\setinterfacemessage{columns}{4}{flottant en partie supérieure pas encore supporté} +\setinterfacemessage{columns}{7}{équilibrage abandonné après 100 pas} +\setinterfacemessage{columns}{6}{-- flottant(s) reporté(s)} +\setinterfacemessage{columns}{9}{vérification des irrégularités} +\setinterfacemessage{columns}{8}{équilibré en -- pas} +\setinterfacemessage{columns}{title}{colonnes} +\setinterfacemessage{columns}{13}{flottant large déplacé dans la partie supérieure de la colonne} +\setinterfacemessage{columns}{12}{flottant déplacé à la colonne suivante / --} +\setinterfacemessage{columns}{11}{flottant mis à la largeur de la colonne} +\setinterfacemessage{columns}{10}{(moins de) 1 ligne restante} +\setinterfacemessage{symbols}{1}{chargement du jeu de symbole --} +\setinterfacemessage{symbols}{title}{symboles} +\setinterfacemessage{files}{1}{le synonyme de fichier -- est déjà utilisé pour --} +\setinterfacemessage{files}{title}{fichiers} +\setinterfacemessage{versions}{1}{@+ manquant} +\setinterfacemessage{versions}{3}{pages sélectionnées : --} +\setinterfacemessage{versions}{2}{marquage des pages} +\setinterfacemessage{versions}{title}{version} +\setinterfacemessage{specials}{1}{-- chargé} +\setinterfacemessage{specials}{3}{-- est remis à zéro} +\setinterfacemessage{specials}{2}{pas d'imbracations plus profondes ne sont permises --} +\setinterfacemessage{specials}{5}{chargement du fichier de définition --} +\setinterfacemessage{specials}{4}{la commande -- n'existe pas} +\setinterfacemessage{specials}{7}{pilote -- inconnu} +\setinterfacemessage{specials}{6}{l'imbrication n'est pas permise} +\setinterfacemessage{specials}{title}{specials} +\setinterfacemessage{layouts}{1}{hauteurtexte adaptée avec -- à la page --} +\setinterfacemessage{layouts}{3}{-- times text postponed} +\setinterfacemessage{layouts}{2}{-- times postponed text placed} +\setinterfacemessage{layouts}{5}{blocsmarge inactifs} +\setinterfacemessage{layouts}{4}{blocsmarge actifs} +\setinterfacemessage{layouts}{7}{calcul de l'espace pour le logo} +\setinterfacemessage{layouts}{6}{jeu de souspage -- traité (taille --)} +\setinterfacemessage{layouts}{9}{pas plus de -- niveaux pour l'instant dans les élémentarisations} +\setinterfacemessage{layouts}{8}{calcul des arrières-plans} +\setinterfacemessage{layouts}{title}{calque} +\setinterfacemessage{layouts}{11}{espacement -- non permis en modegrille} +\setinterfacemessage{layouts}{10}{-- et -- ne sont pas ajoutés à 1.0} +\setinterfacemessage{fonts}{1}{encodage --} +\setinterfacemessage{fonts}{3}{variante -- inconnue} +\setinterfacemessage{fonts}{2}{la variante -- est chargée} +\setinterfacemessage{fonts}{5}{le style -- n'est pas défini} +\setinterfacemessage{fonts}{4}{policecorps -- n'est pas définie} +\setinterfacemessage{fonts}{7}{format -- inconnu} +\setinterfacemessage{fonts}{6}{-- est chargé} +\setinterfacemessage{fonts}{14}{policecorps -- est défini (une définition globale pourrait être plus adéquat)} +\setinterfacemessage{fonts}{8}{style -- défini} +\setinterfacemessage{fonts}{title}{corps de texte} +\setinterfacemessage{fonts}{10}{fichier de police -- inconnu} +\setinterfacemessage{databases}{1}{--} +\setinterfacemessage{databases}{3}{fichier global --} +\setinterfacemessage{databases}{2}{fichier local --} +\setinterfacemessage{databases}{4}{fichier inconnu --} +\setinterfacemessage{databases}{title}{bases de données} +\setinterfacemessage{publications}{1}{file -- not found, unknown style ignored} +\setinterfacemessage{publications}{3}{wrote a new auxiliary file \jobname.aux} +\setinterfacemessage{publications}{title}{publications} +\setinterfacemessage{publications}{2}{file -- not found, waiting for bibtex} +\setinterfacemessage{publications}{4}{loading database from --} +\setinterfacemessage{publications}{5}{warning: cite argument -- on line \the\inputlineno} +\setinterfacemessage{publications}{6}{loading formatting style from --} +\setinterfacemessage{javascript}{1}{chargement du jeu de script --} +\setinterfacemessage{javascript}{title}{javascript} +\setinterfacemessage{javascript}{2}{préambule -- inconnu} +\setinterfacemessage{check}{1}{manquant ou dégroupé '=' après '--' à la ligne --} +\setinterfacemessage{check}{3}{-- -- remplace une macro, utilisez des MAJUSCULES !} +\setinterfacemessage{check}{2}{-- argument(s) attendu(s) à la ligne --} +\setinterfacemessage{check}{title}{vérification} +\setinterfacemessage{metapost}{1}{chargement de la bibliothèque metapost --} +\setinterfacemessage{metapost}{title}{metapost} +\setinterfacemessage{figures}{1}{la figure -- ne peut être trouvée} +\setinterfacemessage{figures}{3}{dimensions of -- are determined externally} +\setinterfacemessage{figures}{2}{la figure -- n'est pas pré-sélectionnée} +\setinterfacemessage{figures}{5}{dimensions of -- are unknown} +\setinterfacemessage{figures}{4}{les dimensions de -- chargées implicitement à partir du fichier de figure} +\setinterfacemessage{figures}{6}{les dimensions de -- calculées par rlxtools} +\setinterfacemessage{figures}{8}{figureobject -- est réutilisé} +\setinterfacemessage{figures}{title}{figures} +\setinterfacemessage{colors}{1}{le système -- est globalement activé} +\setinterfacemessage{colors}{3}{-- n'est pas défini --} +\setinterfacemessage{colors}{2}{le système -- est localement activé} +\setinterfacemessage{colors}{5}{système -- inconnu} +\setinterfacemessage{colors}{4}{le système -- est chargé} +\setinterfacemessage{colors}{7}{le palette -- n'est pas disponible} +\setinterfacemessage{colors}{6}{la palette -- est disponible} +\setinterfacemessage{colors}{9}{l'espace de couleur -- n'est pas supporté} +\setinterfacemessage{colors}{8}{la spécification -- de la couleur -- devient noire} +\setinterfacemessage{colors}{title}{couleurs} +\setinterfacemessage{colors}{12}{-- est enregistré} +\setinterfacemessage{colors}{11}{la couleur est convertie en niveau de gris} +\setinterfacemessage{colors}{10}{-- l'espace de couleur est supporté} +% +\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-mfr.tex b/Master/texmf-dist/tex/context/base/mult-mfr.tex deleted file mode 100644 index 78e4f9f17ef..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-mfr.tex +++ /dev/null @@ -1,208 +0,0 @@ -\setinterfacemessage{references}{1}{réference -- inconnue} -\setinterfacemessage{references}{3}{type -- de réference inconnu} -\setinterfacemessage{references}{2}{réference -- dupliquée à la page --} -\setinterfacemessage{references}{4}{réference -- inconnue} -\setinterfacemessage{references}{30}{objet -- inconnu} -\setinterfacemessage{references}{25}{references from document '--' are not imported (export again)} -\setinterfacemessage{references}{24}{references from document '--' are not exported} -\setinterfacemessage{references}{title}{réferences} -\setinterfacemessage{references}{26}{references from document '--' are imported} -\setinterfacemessage{references}{31}{objet -- dupliqué} -\setinterfacemessage{references}{21}{document -- chargé} -\setinterfacemessage{references}{22}{le document -- n'est pas interactif} -\setinterfacemessage{references}{23}{reference -- indéterminé (préfixe=--)} -\setinterfacemessage{documents}{1}{sheet --} -\setinterfacemessage{documents}{title}{sheets} -\setinterfacemessage{documents}{2}{number --} -\setinterfacemessage{handlings}{1}{manipulation -- de police} -\setinterfacemessage{handlings}{3}{manipulation -- inconnue de police} -\setinterfacemessage{handlings}{2}{la manipulation -- de police est chargée} -\setinterfacemessage{handlings}{title}{manipulation} -\setinterfacemessage{systems}{title}{système} -\setinterfacemessage{systems}{41}{le fichier externe -- du groupe -- n'existe pas} -\setinterfacemessage{systems}{9}{-- non trouvé/traité} -\setinterfacemessage{systems}{91}{papertray --} -\setinterfacemessage{systems}{8}{nouvelle version de fichier utilitaire, seconde passe nécessaire} -\setinterfacemessage{systems}{21}{pas de données utilitaires chargées} -\setinterfacemessage{systems}{20}{signification (tris) de -- chargée} -\setinterfacemessage{systems}{5}{module -- chargé} -\setinterfacemessage{systems}{4}{la commande -- est déjà définie} -\setinterfacemessage{systems}{27}{Version} -\setinterfacemessage{systems}{26}{Registres} -\setinterfacemessage{systems}{25}{Réferences} -\setinterfacemessage{systems}{24}{blocsflottants} -\setinterfacemessage{systems}{1}{chargement de fichier utilitaire reporté (typemode)} -\setinterfacemessage{systems}{23}{-- arrangé à --} -\setinterfacemessage{systems}{22}{utilise un fichier utilitaire valide} -\setinterfacemessage{systems}{2}{-- chargé} -\setinterfacemessage{systems}{19}{signification (synonymes) de -- chargée} -\setinterfacemessage{systems}{18}{le synonyme -- -- n'existe pas} -\setinterfacemessage{systems}{7}{module -- déjà chargé} -\setinterfacemessage{systems}{6}{module -- non trouvé} -\setinterfacemessage{systems}{14}{nouvellepage forcée dans la liste à --} -\setinterfacemessage{systems}{15}{sauvegarde du tampon (buffer) --} -\setinterfacemessage{systems}{16}{composition du tampon (buffer) --} -\setinterfacemessage{systems}{17}{composition textuelle du tampon (buffer) --} -\setinterfacemessage{systems}{13}{marquage -- defini --} -\setinterfacemessage{systems}{12}{le fichier utilitaire n'est pas trié, utilise texutil} -\setinterfacemessage{systems}{11}{construction util simple} -\setinterfacemessage{systems}{10}{n'utilisez pas em dans --} -\setinterfacemessage{floatblocks}{1}{-- renuméroté / -- => --} -\setinterfacemessage{floatblocks}{3}{-- déplacé} -\setinterfacemessage{floatblocks}{2}{-- sauvegardé} -\setinterfacemessage{floatblocks}{5}{ordre adapté} -\setinterfacemessage{floatblocks}{4}{-- placé} -\setinterfacemessage{floatblocks}{7}{n flottants de bas de page limité à --} -\setinterfacemessage{floatblocks}{6}{n flottants de haut de page limité à --} -\setinterfacemessage{floatblocks}{9}{ordre perturbé} -\setinterfacemessage{floatblocks}{8}{moins de -- lignes} -\setinterfacemessage{floatblocks}{title}{blocs de flottants} -\setinterfacemessage{floatblocks}{13}{there is nothing to split} -\setinterfacemessage{floatblocks}{12}{indéfini} -\setinterfacemessage{floatblocks}{11}{pas de bloc donné} -\setinterfacemessage{floatblocks}{10}{-- limité} -\setinterfacemessage{interactions}{1}{ratio d'aspect -- x -- (b x h)} -\setinterfacemessage{interactions}{3}{inactif} -\setinterfacemessage{interactions}{2}{actif} -\setinterfacemessage{interactions}{5}{le fichier joint -- est inconnu} -\setinterfacemessage{interactions}{4}{pas de synchronisation de page (--) dans le hmode} -\setinterfacemessage{interactions}{6}{le fichier joint -- n'existe pas} -\setinterfacemessage{interactions}{title}{interaction} -\setinterfacemessage{interactions}{21}{-- code inseré} -\setinterfacemessage{regimes}{1}{encodage --} -\setinterfacemessage{regimes}{3}{encodage -- inconnu} -\setinterfacemessage{regimes}{2}{l'encodage -- est chargé} -\setinterfacemessage{regimes}{title}{encodage} -\setinterfacemessage{structures}{1}{début de blocsection --} -\setinterfacemessage{structures}{title}{structure} -\setinterfacemessage{structures}{2}{fin de blocsection --} -\setinterfacemessage{linguals}{1}{les motifs -- pour -- sont chargés (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{3}{hyphenations -- pour -- chargés (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{2}{pas de motifs -- pour -- (n=--,e=--,m=--) (--,--)} -\setinterfacemessage{linguals}{5}{les motifs pour -- ne sont pas chargés} -\setinterfacemessage{linguals}{4}{pas d'hyphenations -- pour -- (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{7}{les options spécifiques de langue [--] introduisent un -- saut} -\setinterfacemessage{linguals}{6}{langue -- non définie} -\setinterfacemessage{linguals}{9}{la langue -- est active} -\setinterfacemessage{linguals}{8}{les options spécifiques de langue [--] sont ajoutés en douceur} -\setinterfacemessage{linguals}{title}{langue} -\setinterfacemessage{linguals}{10}{motifs -- chargés} -\setinterfacemessage{verbatims}{1}{le fichier -- n'existe pas} -\setinterfacemessage{verbatims}{title}{verbatim} -\setinterfacemessage{filters}{1}{le filtre -- est chargé} -\setinterfacemessage{filters}{title}{filtre} -\setinterfacemessage{filters}{2}{filtre -- inconnu} -\setinterfacemessage{textblocks}{1}{nouvelle version, une seconde passe est nécessaire} -\setinterfacemessage{textblocks}{3}{lecture des blocs en provenance de --} -\setinterfacemessage{textblocks}{2}{ecriture des blocs vers --} -\setinterfacemessage{textblocks}{5}{-- non caché} -\setinterfacemessage{textblocks}{4}{seconde passe nécessaire} -\setinterfacemessage{textblocks}{7}{-- caché} -\setinterfacemessage{textblocks}{6}{-- caché et traité} -\setinterfacemessage{textblocks}{9}{-- non composé} -\setinterfacemessage{textblocks}{8}{-- composé} -\setinterfacemessage{textblocks}{title}{blocs de texte} -\setinterfacemessage{textblocks}{12}{-- sauté} -\setinterfacemessage{textblocks}{11}{-- chargé et composé} -\setinterfacemessage{textblocks}{10}{-- chargé et traité} -\setinterfacemessage{encodings}{1}{encodage --} -\setinterfacemessage{encodings}{3}{encodage -- inconnu} -\setinterfacemessage{encodings}{2}{l'encodage -- est chargé} -\setinterfacemessage{encodings}{title}{encodage} -\setinterfacemessage{columns}{1}{seules -- colonnes possibles} -\setinterfacemessage{columns}{3}{problèmes, désactive l'équilibrage} -\setinterfacemessage{columns}{2}{utilisez \string\filbreak\space en tant qu'alternative} -\setinterfacemessage{columns}{5}{flottant en partie inférieure pas encore supporté} -\setinterfacemessage{columns}{4}{flottant en partie supérieure pas encore supporté} -\setinterfacemessage{columns}{7}{équilibrage abandonné après 100 pas} -\setinterfacemessage{columns}{6}{-- flottant(s) reporté(s)} -\setinterfacemessage{columns}{9}{vérification des irrégularités} -\setinterfacemessage{columns}{8}{équilibré en -- pas} -\setinterfacemessage{columns}{title}{colonnes} -\setinterfacemessage{columns}{13}{flottant large déplacé dans la partie supérieure de la colonne} -\setinterfacemessage{columns}{12}{flottant déplacé à la colonne suivante / --} -\setinterfacemessage{columns}{11}{flottant mis à la largeur de la colonne} -\setinterfacemessage{columns}{10}{(moins de) 1 ligne restante} -\setinterfacemessage{symbols}{1}{chargement du jeu de symbole --} -\setinterfacemessage{symbols}{title}{symboles} -\setinterfacemessage{files}{1}{le synonyme de fichier -- est déjà utilisé pour --} -\setinterfacemessage{files}{title}{fichiers} -\setinterfacemessage{versions}{1}{@+ manquant} -\setinterfacemessage{versions}{3}{pages sélectionnées : --} -\setinterfacemessage{versions}{2}{marquage des pages} -\setinterfacemessage{versions}{title}{version} -\setinterfacemessage{specials}{1}{-- chargé} -\setinterfacemessage{specials}{3}{-- est remis à zéro} -\setinterfacemessage{specials}{2}{pas d'imbracations plus profondes ne sont permises --} -\setinterfacemessage{specials}{5}{chargement du fichier de définition --} -\setinterfacemessage{specials}{4}{la commande -- n'existe pas} -\setinterfacemessage{specials}{7}{pilote -- inconnu} -\setinterfacemessage{specials}{6}{l'imbrication n'est pas permise} -\setinterfacemessage{specials}{title}{specials} -\setinterfacemessage{layouts}{1}{hauteurtexte adaptée avec -- à la page --} -\setinterfacemessage{layouts}{3}{-- times text postponed} -\setinterfacemessage{layouts}{2}{-- times postponed text placed} -\setinterfacemessage{layouts}{5}{blocsmarge inactifs} -\setinterfacemessage{layouts}{4}{blocsmarge actifs} -\setinterfacemessage{layouts}{7}{calcul de l'espace pour le logo} -\setinterfacemessage{layouts}{6}{jeu de souspage -- traité (taille --)} -\setinterfacemessage{layouts}{9}{pas plus de -- niveaux pour l'instant dans les élémentarisations} -\setinterfacemessage{layouts}{8}{calcul des arrières-plans} -\setinterfacemessage{layouts}{title}{calque} -\setinterfacemessage{layouts}{11}{espacement -- non permis en modegrille} -\setinterfacemessage{layouts}{10}{-- et -- ne sont pas ajoutés à 1.0} -\setinterfacemessage{fonts}{1}{encodage --} -\setinterfacemessage{fonts}{3}{variante -- inconnue} -\setinterfacemessage{fonts}{2}{la variante -- est chargée} -\setinterfacemessage{fonts}{5}{le style -- n'est pas défini} -\setinterfacemessage{fonts}{4}{policecorps -- n'est pas définie} -\setinterfacemessage{fonts}{7}{format -- inconnu} -\setinterfacemessage{fonts}{6}{-- est chargé} -\setinterfacemessage{fonts}{14}{policecorps -- est défini (une définition globale pourrait être plus adéquat)} -\setinterfacemessage{fonts}{8}{style -- défini} -\setinterfacemessage{fonts}{title}{corps de texte} -\setinterfacemessage{fonts}{10}{fichier de police -- inconnu} -\setinterfacemessage{databases}{1}{--} -\setinterfacemessage{databases}{3}{fichier global --} -\setinterfacemessage{databases}{2}{fichier local --} -\setinterfacemessage{databases}{4}{fichier inconnu --} -\setinterfacemessage{databases}{title}{bases de données} -\setinterfacemessage{publications}{1}{file -- not found, unknown style ignored} -\setinterfacemessage{publications}{3}{wrote a new auxiliary file \jobname.aux} -\setinterfacemessage{publications}{title}{publications} -\setinterfacemessage{publications}{2}{file -- not found, waiting for bibtex} -\setinterfacemessage{publications}{4}{loading database from --} -\setinterfacemessage{publications}{5}{warning: cite argument -- on line \the\inputlineno} -\setinterfacemessage{publications}{6}{loading formatting style from --} -\setinterfacemessage{javascript}{1}{chargement du jeu de script --} -\setinterfacemessage{javascript}{title}{javascript} -\setinterfacemessage{javascript}{2}{préambule -- inconnu} -\setinterfacemessage{check}{1}{manquant ou dégroupé '=' après '--' à la ligne --} -\setinterfacemessage{check}{3}{-- -- remplace une macro, utilisez des MAJUSCULES !} -\setinterfacemessage{check}{2}{-- argument(s) attendu(s) à la ligne --} -\setinterfacemessage{check}{title}{vérification} -\setinterfacemessage{metapost}{1}{chargement de la bibliothèque metapost --} -\setinterfacemessage{metapost}{title}{metapost} -\setinterfacemessage{figures}{1}{la figure -- ne peut être trouvée} -\setinterfacemessage{figures}{3}{dimensions of -- are determined externally} -\setinterfacemessage{figures}{2}{la figure -- n'est pas pré-sélectionnée} -\setinterfacemessage{figures}{5}{dimensions of -- are unknown} -\setinterfacemessage{figures}{4}{les dimensions de -- chargées implicitement à partir du fichier de figure} -\setinterfacemessage{figures}{6}{les dimensions de -- calculées par rlxtools} -\setinterfacemessage{figures}{8}{figureobject -- est réutilisé} -\setinterfacemessage{figures}{title}{figures} -\setinterfacemessage{colors}{1}{le système -- est globalement activé} -\setinterfacemessage{colors}{3}{-- n'est pas défini --} -\setinterfacemessage{colors}{2}{le système -- est localement activé} -\setinterfacemessage{colors}{5}{système -- inconnu} -\setinterfacemessage{colors}{4}{le système -- est chargé} -\setinterfacemessage{colors}{7}{le palette -- n'est pas disponible} -\setinterfacemessage{colors}{6}{la palette -- est disponible} -\setinterfacemessage{colors}{9}{l'espace de couleur -- n'est pas supporté} -\setinterfacemessage{colors}{8}{la spécification -- de la couleur -- devient noire} -\setinterfacemessage{colors}{title}{couleurs} -\setinterfacemessage{colors}{12}{-- est enregistré} -\setinterfacemessage{colors}{11}{la couleur est convertie en niveau de gris} -\setinterfacemessage{colors}{10}{-- l'espace de couleur est supporté} -% -\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-mit.mkii b/Master/texmf-dist/tex/context/base/mult-mit.mkii new file mode 100644 index 00000000000..9d09e267654 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-mit.mkii @@ -0,0 +1,210 @@ +\setinterfacemessage{references}{1}{riferimento sconosciuto --} +\setinterfacemessage{references}{30}{oggetto sconosciuto --} +\setinterfacemessage{references}{3}{riferimento di tipo sconosciuto --} +\setinterfacemessage{references}{2}{riferimento duplicato -- a pagina --} +\setinterfacemessage{references}{5}{number of unknown references: --} +\setinterfacemessage{references}{4}{riferimento illecito --} +\setinterfacemessage{references}{6}{number of illegal references: --} +\setinterfacemessage{references}{25}{references from document '--' are not imported (export again)} +\setinterfacemessage{references}{24}{references from document '--' are not exported} +\setinterfacemessage{references}{title}{riferimenti} +\setinterfacemessage{references}{26}{references from document '--' are imported} +\setinterfacemessage{references}{31}{oggetto duplicato --} +\setinterfacemessage{references}{21}{documento -- caricato} +\setinterfacemessage{references}{22}{il documento -- non ø interattivo} +\setinterfacemessage{references}{23}{riferimento ambiguo -- (prefisso=--)} +\setinterfacemessage{documents}{1}{sheet --} +\setinterfacemessage{documents}{title}{sheets} +\setinterfacemessage{documents}{2}{number --} +\setinterfacemessage{handlings}{1}{font handling --} +\setinterfacemessage{handlings}{3}{unknown font handling --} +\setinterfacemessage{handlings}{2}{font handling -- is loaded} +\setinterfacemessage{handlings}{title}{handling} +\setinterfacemessage{systems}{title}{sistema} +\setinterfacemessage{systems}{41}{il file esterno -- del gruppo -- non esiste} +\setinterfacemessage{systems}{9}{-- non trovato/elaborato} +\setinterfacemessage{systems}{91}{papertray --} +\setinterfacemessage{systems}{8}{nuova versione del file supplementare, seconda passata necessaria} +\setinterfacemessage{systems}{21}{nessuna informazione supplementare caricata} +\setinterfacemessage{systems}{20}{significato (specie) di -- caricato} +\setinterfacemessage{systems}{5}{macro del modulo -- caricate} +\setinterfacemessage{systems}{4}{comando -- già definito} +\setinterfacemessage{systems}{27}{Versione} +\setinterfacemessage{systems}{26}{Registri} +\setinterfacemessage{systems}{25}{Riferimenti} +\setinterfacemessage{systems}{24}{Oggetti mobili} +\setinterfacemessage{systems}{1}{caricamento dei file supplementari posticipato (typemode)} +\setinterfacemessage{systems}{23}{-- sistemato a --} +\setinterfacemessage{systems}{22}{usare un file supplementare valido} +\setinterfacemessage{systems}{2}{-- caricato} +\setinterfacemessage{systems}{19}{significato (sinonimi) di -- caricato} +\setinterfacemessage{systems}{18}{sinonimo -- -- non esistente} +\setinterfacemessage{systems}{7}{macro del modulo -- già caricate} +\setinterfacemessage{systems}{6}{nessuna macro trovata nel modulo --} +\setinterfacemessage{systems}{14}{nuova pagina obbligata in lista a --} +\setinterfacemessage{systems}{15}{salvataggio del buffer --} +\setinterfacemessage{systems}{16}{composizione del buffer --} +\setinterfacemessage{systems}{17}{composizione verbatim del buffer --} +\setinterfacemessage{systems}{13}{marcatura -- definita --} +\setinterfacemessage{systems}{12}{file di supplemento non ordinato, usare texutil} +\setinterfacemessage{systems}{11}{costruzione di un semplice supplemento} +\setinterfacemessage{systems}{10}{non usare em in --} +\setinterfacemessage{floatblocks}{1}{-- rinumerato / -- => --} +\setinterfacemessage{floatblocks}{3}{-- mosso} +\setinterfacemessage{floatblocks}{2}{-- salvato} +\setinterfacemessage{floatblocks}{5}{ordine aggiustato} +\setinterfacemessage{floatblocks}{4}{-- sistemato} +\setinterfacemessage{floatblocks}{7}{n di bottom floats limitato a --} +\setinterfacemessage{floatblocks}{6}{n di top floats limitato a --} +\setinterfacemessage{floatblocks}{9}{ordine disturbato} +\setinterfacemessage{floatblocks}{8}{meno di -- righe} +\setinterfacemessage{floatblocks}{title}{oggetti mobili} +\setinterfacemessage{floatblocks}{13}{there is nothing to split} +\setinterfacemessage{floatblocks}{12}{non definito} +\setinterfacemessage{floatblocks}{11}{nessun oggetto specificato} +\setinterfacemessage{floatblocks}{10}{-- limitato} +\setinterfacemessage{interactions}{1}{rapporto -- x -- (b x a)} +\setinterfacemessage{interactions}{3}{inattiva} +\setinterfacemessage{interactions}{2}{attiva} +\setinterfacemessage{interactions}{5}{unknown attachment --} +\setinterfacemessage{interactions}{4}{sincronizzazione di pagina (--) non disponibile in hmode} +\setinterfacemessage{interactions}{6}{attachment file -- does not exist} +\setinterfacemessage{interactions}{title}{interazione} +\setinterfacemessage{interactions}{21}{codice -- inserito} +\setinterfacemessage{regimes}{1}{codifica --} +\setinterfacemessage{regimes}{3}{codifica sconosciuta --} +\setinterfacemessage{regimes}{2}{codifica -- caricata} +\setinterfacemessage{regimes}{title}{codifica} +\setinterfacemessage{structures}{1}{inizio del blocco (sezione) --} +\setinterfacemessage{structures}{title}{struttura} +\setinterfacemessage{structures}{2}{fine del blocco (sezione) --} +\setinterfacemessage{linguals}{1}{schemi -- per -- caricati (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{3}{sillabazione -- per -- caricata (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{2}{niente schemi -- per -- (n=--,e=--,m=--) (--,--)} +\setinterfacemessage{linguals}{5}{schemi per -- non caricati} +\setinterfacemessage{linguals}{4}{niente sillabazione -- per -- (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{7}{opzioni specifiche per la lingua [--] introducono un salto --} +\setinterfacemessage{linguals}{6}{lingua -- non definita} +\setinterfacemessage{linguals}{9}{lingua -- attiva} +\setinterfacemessage{linguals}{8}{opzioni specifiche per la lingua [--] aggiunte trasparentemente} +\setinterfacemessage{linguals}{title}{lingua} +\setinterfacemessage{linguals}{10}{schemi -- caricati} +\setinterfacemessage{verbatims}{1}{il file -- non esiste} +\setinterfacemessage{verbatims}{title}{verbatim} +\setinterfacemessage{filters}{1}{filtro -- caricato} +\setinterfacemessage{filters}{title}{filtri} +\setinterfacemessage{filters}{2}{filtro sconosciuto --} +\setinterfacemessage{textblocks}{1}{nuova versione, seconda passata necessaria} +\setinterfacemessage{textblocks}{3}{lettura dei blocchi da --} +\setinterfacemessage{textblocks}{2}{scrittura dei blocchi su --} +\setinterfacemessage{textblocks}{5}{-- non nascosto} +\setinterfacemessage{textblocks}{4}{seconda passata necessaria} +\setinterfacemessage{textblocks}{7}{-- nascosto} +\setinterfacemessage{textblocks}{6}{-- nascosto ed elaborato} +\setinterfacemessage{textblocks}{9}{-- non composto} +\setinterfacemessage{textblocks}{8}{-- composto} +\setinterfacemessage{textblocks}{title}{blocchi di testo} +\setinterfacemessage{textblocks}{12}{-- saltato} +\setinterfacemessage{textblocks}{11}{-- caricato e composto} +\setinterfacemessage{textblocks}{10}{-- caricato ed elaborato} +\setinterfacemessage{encodings}{1}{codifica --} +\setinterfacemessage{encodings}{3}{codifica sconosciuta --} +\setinterfacemessage{encodings}{2}{codifica -- caricata} +\setinterfacemessage{encodings}{title}{codifica} +\setinterfacemessage{columns}{1}{solo -- colonne possibili} +\setinterfacemessage{columns}{3}{problemi, disabilitare il bilanciamento} +\setinterfacemessage{columns}{2}{in alternativa, usare \string\filbreak} +\setinterfacemessage{columns}{5}{float in fondo non ancora supportato} +\setinterfacemessage{columns}{4}{float in cima non ancora supportato} +\setinterfacemessage{columns}{7}{bilanciamento annullato dopo 100 passi} +\setinterfacemessage{columns}{6}{-- float(s) posticipate} +\setinterfacemessage{columns}{9}{controllare seghettamento} +\setinterfacemessage{columns}{8}{bilanciamento in -- passo/i} +\setinterfacemessage{columns}{title}{colonne} +\setinterfacemessage{columns}{13}{oggetto mobile ampio spostato sopra le colonne} +\setinterfacemessage{columns}{12}{oggetto mobile spostata alla colonna successiva / --} +\setinterfacemessage{columns}{11}{oggetto mobile troppo ampio per la colonna} +\setinterfacemessage{columns}{10}{(meno di) una riga rimasta} +\setinterfacemessage{symbols}{1}{caricamento gruppo di simboli --} +\setinterfacemessage{symbols}{title}{simboli} +\setinterfacemessage{files}{1}{sinonimo file -- già in uso per --} +\setinterfacemessage{files}{title}{file} +\setinterfacemessage{versions}{1}{@+ mancante} +\setinterfacemessage{versions}{3}{pagine selezionate: --} +\setinterfacemessage{versions}{2}{marcatura pagine} +\setinterfacemessage{versions}{title}{version} +\setinterfacemessage{specials}{1}{-- caricato} +\setinterfacemessage{specials}{3}{-- reimpostato} +\setinterfacemessage{specials}{2}{non ø permesso un annidamento maggiore --} +\setinterfacemessage{specials}{5}{caricamento del file di definizione --} +\setinterfacemessage{specials}{4}{il comando -- non esiste} +\setinterfacemessage{specials}{7}{driver sconosciuto --} +\setinterfacemessage{specials}{6}{annidamento non permesso} +\setinterfacemessage{specials}{title}{specialitø} +\setinterfacemessage{layouts}{1}{altezza del testo adattata con -- a pagina --} +\setinterfacemessage{layouts}{3}{testo posticipato -- volte} +\setinterfacemessage{layouts}{2}{posizionato testo posticipato -- volte} +\setinterfacemessage{layouts}{5}{blocchi in margine inattivi} +\setinterfacemessage{layouts}{4}{blocchi in margine attivi} +\setinterfacemessage{layouts}{7}{calcolo dello spazio per logo} +\setinterfacemessage{layouts}{6}{gruppo di sottopagine -- elaborato (dimensione --)} +\setinterfacemessage{layouts}{9}{attualmente non più di -- livelli di elencazione} +\setinterfacemessage{layouts}{8}{calcolo dello sfondo} +\setinterfacemessage{layouts}{title}{layout} +\setinterfacemessage{layouts}{11}{spaziatura -- non permessa in modo griglia} +\setinterfacemessage{layouts}{10}{-- e -- non sommano a 1.0} +\setinterfacemessage{fonts}{1}{codifica --} +\setinterfacemessage{fonts}{3}{variante sconosciuta --} +\setinterfacemessage{fonts}{2}{variante -- caricata} +\setinterfacemessage{fonts}{5}{stile -- non definito} +\setinterfacemessage{fonts}{4}{corpo del testo -- non definito} +\setinterfacemessage{fonts}{7}{formato sconosciuto --} +\setinterfacemessage{fonts}{6}{-- caricato} +\setinterfacemessage{fonts}{14}{corpo del testo -- definito (sarebbe meglio globale)} +\setinterfacemessage{fonts}{8}{stile -- definito} +\setinterfacemessage{fonts}{title}{font del corpo} +\setinterfacemessage{fonts}{10}{file di font sconosciuto --} +\setinterfacemessage{databases}{1}{--} +\setinterfacemessage{databases}{3}{file globale --} +\setinterfacemessage{databases}{2}{file locale --} +\setinterfacemessage{databases}{4}{file sconosciuto --} +\setinterfacemessage{databases}{title}{database} +\setinterfacemessage{publications}{1}{file -- not found, unknown style ignored} +\setinterfacemessage{publications}{3}{wrote a new auxiliary file \jobname.aux} +\setinterfacemessage{publications}{title}{publications} +\setinterfacemessage{publications}{2}{file -- not found, waiting for bibtex} +\setinterfacemessage{publications}{4}{loading database from --} +\setinterfacemessage{publications}{5}{warning: cite argument -- on line \the\inputlineno} +\setinterfacemessage{publications}{6}{loading formatting style from --} +\setinterfacemessage{javascript}{1}{caricamento dello script set --} +\setinterfacemessage{javascript}{title}{javascript} +\setinterfacemessage{javascript}{2}{preambolo sconosciuto --} +\setinterfacemessage{check}{1}{'=' mancante o non raggruppato dopo '--' alla riga --} +\setinterfacemessage{check}{3}{-- -- sostituisce una macro, usare le MAIUSCOLE!} +\setinterfacemessage{check}{2}{-- argomento/i attesi alla riga --} +\setinterfacemessage{check}{title}{controllo} +\setinterfacemessage{metapost}{1}{caricamento della libreria metapost --} +\setinterfacemessage{metapost}{title}{metapost} +\setinterfacemessage{figures}{1}{figura -- non trovata} +\setinterfacemessage{figures}{3}{dimensions of -- are determined externally} +\setinterfacemessage{figures}{2}{la figura -- non è preimpostata} +\setinterfacemessage{figures}{5}{dimensions of -- are unknown} +\setinterfacemessage{figures}{4}{dimensioni di -- caricate dal file di immagini stesso} +\setinterfacemessage{figures}{6}{dimensioni di -- calcolate da rlxtools} +\setinterfacemessage{figures}{8}{oggetto-figura -- riutilizzato} +\setinterfacemessage{figures}{title}{figure} +\setinterfacemessage{colors}{1}{sistema -- attivato globalmente} +\setinterfacemessage{colors}{3}{-- non definito --} +\setinterfacemessage{colors}{2}{sistema -- attivato localmente} +\setinterfacemessage{colors}{5}{sistema -- sconosciuto} +\setinterfacemessage{colors}{4}{sistema -- caricato} +\setinterfacemessage{colors}{7}{tavolozza -- non disponibile} +\setinterfacemessage{colors}{6}{tavolozza -- resa disponibile} +\setinterfacemessage{colors}{9}{spazio dei colori -- non supportato} +\setinterfacemessage{colors}{8}{specifica -- del colore -- convertita in nero} +\setinterfacemessage{colors}{title}{colore} +\setinterfacemessage{colors}{12}{-- is registered} +\setinterfacemessage{colors}{11}{il colore ø convertito in grigio} +\setinterfacemessage{colors}{10}{spazio dei colori -- supportato} +% +\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-mit.tex b/Master/texmf-dist/tex/context/base/mult-mit.tex deleted file mode 100644 index 6d2a8f51608..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-mit.tex +++ /dev/null @@ -1,208 +0,0 @@ -\setinterfacemessage{references}{1}{riferimento sconosciuto --} -\setinterfacemessage{references}{3}{riferimento di tipo sconosciuto --} -\setinterfacemessage{references}{2}{riferimento duplicato -- a pagina --} -\setinterfacemessage{references}{4}{riferimento illecito --} -\setinterfacemessage{references}{30}{oggetto sconosciuto --} -\setinterfacemessage{references}{25}{references from document '--' are not imported (export again)} -\setinterfacemessage{references}{24}{references from document '--' are not exported} -\setinterfacemessage{references}{title}{riferimenti} -\setinterfacemessage{references}{26}{references from document '--' are imported} -\setinterfacemessage{references}{31}{oggetto duplicato --} -\setinterfacemessage{references}{21}{documento -- caricato} -\setinterfacemessage{references}{22}{il documento -- non ø interattivo} -\setinterfacemessage{references}{23}{riferimento ambiguo -- (prefisso=--)} -\setinterfacemessage{documents}{1}{sheet --} -\setinterfacemessage{documents}{title}{sheets} -\setinterfacemessage{documents}{2}{number --} -\setinterfacemessage{handlings}{1}{font handling --} -\setinterfacemessage{handlings}{3}{unknown font handling --} -\setinterfacemessage{handlings}{2}{font handling -- is loaded} -\setinterfacemessage{handlings}{title}{handling} -\setinterfacemessage{systems}{title}{sistema} -\setinterfacemessage{systems}{41}{il file esterno -- del gruppo -- non esiste} -\setinterfacemessage{systems}{9}{-- non trovato/elaborato} -\setinterfacemessage{systems}{91}{papertray --} -\setinterfacemessage{systems}{8}{nuova versione del file supplementare, seconda passata necessaria} -\setinterfacemessage{systems}{21}{nessuna informazione supplementare caricata} -\setinterfacemessage{systems}{20}{significato (specie) di -- caricato} -\setinterfacemessage{systems}{5}{macro del modulo -- caricate} -\setinterfacemessage{systems}{4}{comando -- già definito} -\setinterfacemessage{systems}{27}{Versione} -\setinterfacemessage{systems}{26}{Registri} -\setinterfacemessage{systems}{25}{Riferimenti} -\setinterfacemessage{systems}{24}{Oggetti mobili} -\setinterfacemessage{systems}{1}{caricamento dei file supplementari posticipato (typemode)} -\setinterfacemessage{systems}{23}{-- sistemato a --} -\setinterfacemessage{systems}{22}{usare un file supplementare valido} -\setinterfacemessage{systems}{2}{-- caricato} -\setinterfacemessage{systems}{19}{significato (sinonimi) di -- caricato} -\setinterfacemessage{systems}{18}{sinonimo -- -- non esistente} -\setinterfacemessage{systems}{7}{macro del modulo -- già caricate} -\setinterfacemessage{systems}{6}{nessuna macro trovata nel modulo --} -\setinterfacemessage{systems}{14}{nuova pagina obbligata in lista a --} -\setinterfacemessage{systems}{15}{salvataggio del buffer --} -\setinterfacemessage{systems}{16}{composizione del buffer --} -\setinterfacemessage{systems}{17}{composizione verbatim del buffer --} -\setinterfacemessage{systems}{13}{marcatura -- definita --} -\setinterfacemessage{systems}{12}{file di supplemento non ordinato, usare texutil} -\setinterfacemessage{systems}{11}{costruzione di un semplice supplemento} -\setinterfacemessage{systems}{10}{non usare em in --} -\setinterfacemessage{floatblocks}{1}{-- rinumerato / -- => --} -\setinterfacemessage{floatblocks}{3}{-- mosso} -\setinterfacemessage{floatblocks}{2}{-- salvato} -\setinterfacemessage{floatblocks}{5}{ordine aggiustato} -\setinterfacemessage{floatblocks}{4}{-- sistemato} -\setinterfacemessage{floatblocks}{7}{n di bottom floats limitato a --} -\setinterfacemessage{floatblocks}{6}{n di top floats limitato a --} -\setinterfacemessage{floatblocks}{9}{ordine disturbato} -\setinterfacemessage{floatblocks}{8}{meno di -- righe} -\setinterfacemessage{floatblocks}{title}{oggetti mobili} -\setinterfacemessage{floatblocks}{13}{there is nothing to split} -\setinterfacemessage{floatblocks}{12}{non definito} -\setinterfacemessage{floatblocks}{11}{nessun oggetto specificato} -\setinterfacemessage{floatblocks}{10}{-- limitato} -\setinterfacemessage{interactions}{1}{rapporto -- x -- (b x a)} -\setinterfacemessage{interactions}{3}{inattiva} -\setinterfacemessage{interactions}{2}{attiva} -\setinterfacemessage{interactions}{5}{unknown attachment --} -\setinterfacemessage{interactions}{4}{sincronizzazione di pagina (--) non disponibile in hmode} -\setinterfacemessage{interactions}{6}{attachment file -- does not exist} -\setinterfacemessage{interactions}{title}{interazione} -\setinterfacemessage{interactions}{21}{codice -- inserito} -\setinterfacemessage{regimes}{1}{codifica --} -\setinterfacemessage{regimes}{3}{codifica sconosciuta --} -\setinterfacemessage{regimes}{2}{codifica -- caricata} -\setinterfacemessage{regimes}{title}{codifica} -\setinterfacemessage{structures}{1}{inizio del blocco (sezione) --} -\setinterfacemessage{structures}{title}{struttura} -\setinterfacemessage{structures}{2}{fine del blocco (sezione) --} -\setinterfacemessage{linguals}{1}{schemi -- per -- caricati (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{3}{sillabazione -- per -- caricata (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{2}{niente schemi -- per -- (n=--,e=--,m=--) (--,--)} -\setinterfacemessage{linguals}{5}{schemi per -- non caricati} -\setinterfacemessage{linguals}{4}{niente sillabazione -- per -- (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{7}{opzioni specifiche per la lingua [--] introducono un salto --} -\setinterfacemessage{linguals}{6}{lingua -- non definita} -\setinterfacemessage{linguals}{9}{lingua -- attiva} -\setinterfacemessage{linguals}{8}{opzioni specifiche per la lingua [--] aggiunte trasparentemente} -\setinterfacemessage{linguals}{title}{lingua} -\setinterfacemessage{linguals}{10}{schemi -- caricati} -\setinterfacemessage{verbatims}{1}{il file -- non esiste} -\setinterfacemessage{verbatims}{title}{verbatim} -\setinterfacemessage{filters}{1}{filtro -- caricato} -\setinterfacemessage{filters}{title}{filtri} -\setinterfacemessage{filters}{2}{filtro sconosciuto --} -\setinterfacemessage{textblocks}{1}{nuova versione, seconda passata necessaria} -\setinterfacemessage{textblocks}{3}{lettura dei blocchi da --} -\setinterfacemessage{textblocks}{2}{scrittura dei blocchi su --} -\setinterfacemessage{textblocks}{5}{-- non nascosto} -\setinterfacemessage{textblocks}{4}{seconda passata necessaria} -\setinterfacemessage{textblocks}{7}{-- nascosto} -\setinterfacemessage{textblocks}{6}{-- nascosto ed elaborato} -\setinterfacemessage{textblocks}{9}{-- non composto} -\setinterfacemessage{textblocks}{8}{-- composto} -\setinterfacemessage{textblocks}{title}{blocchi di testo} -\setinterfacemessage{textblocks}{12}{-- saltato} -\setinterfacemessage{textblocks}{11}{-- caricato e composto} -\setinterfacemessage{textblocks}{10}{-- caricato ed elaborato} -\setinterfacemessage{encodings}{1}{codifica --} -\setinterfacemessage{encodings}{3}{codifica sconosciuta --} -\setinterfacemessage{encodings}{2}{codifica -- caricata} -\setinterfacemessage{encodings}{title}{codifica} -\setinterfacemessage{columns}{1}{solo -- colonne possibili} -\setinterfacemessage{columns}{3}{problemi, disabilitare il bilanciamento} -\setinterfacemessage{columns}{2}{in alternativa, usare \string\filbreak} -\setinterfacemessage{columns}{5}{float in fondo non ancora supportato} -\setinterfacemessage{columns}{4}{float in cima non ancora supportato} -\setinterfacemessage{columns}{7}{bilanciamento annullato dopo 100 passi} -\setinterfacemessage{columns}{6}{-- float(s) posticipate} -\setinterfacemessage{columns}{9}{controllare seghettamento} -\setinterfacemessage{columns}{8}{bilanciamento in -- passo/i} -\setinterfacemessage{columns}{title}{colonne} -\setinterfacemessage{columns}{13}{oggetto mobile ampio spostato sopra le colonne} -\setinterfacemessage{columns}{12}{oggetto mobile spostata alla colonna successiva / --} -\setinterfacemessage{columns}{11}{oggetto mobile troppo ampio per la colonna} -\setinterfacemessage{columns}{10}{(meno di) una riga rimasta} -\setinterfacemessage{symbols}{1}{caricamento gruppo di simboli --} -\setinterfacemessage{symbols}{title}{simboli} -\setinterfacemessage{files}{1}{sinonimo file -- già in uso per --} -\setinterfacemessage{files}{title}{file} -\setinterfacemessage{versions}{1}{@+ mancante} -\setinterfacemessage{versions}{3}{pagine selezionate: --} -\setinterfacemessage{versions}{2}{marcatura pagine} -\setinterfacemessage{versions}{title}{version} -\setinterfacemessage{specials}{1}{-- caricato} -\setinterfacemessage{specials}{3}{-- reimpostato} -\setinterfacemessage{specials}{2}{non ø permesso un annidamento maggiore --} -\setinterfacemessage{specials}{5}{caricamento del file di definizione --} -\setinterfacemessage{specials}{4}{il comando -- non esiste} -\setinterfacemessage{specials}{7}{driver sconosciuto --} -\setinterfacemessage{specials}{6}{annidamento non permesso} -\setinterfacemessage{specials}{title}{specialitø} -\setinterfacemessage{layouts}{1}{altezza del testo adattata con -- a pagina --} -\setinterfacemessage{layouts}{3}{testo posticipato -- volte} -\setinterfacemessage{layouts}{2}{posizionato testo posticipato -- volte} -\setinterfacemessage{layouts}{5}{blocchi in margine inattivi} -\setinterfacemessage{layouts}{4}{blocchi in margine attivi} -\setinterfacemessage{layouts}{7}{calcolo dello spazio per logo} -\setinterfacemessage{layouts}{6}{gruppo di sottopagine -- elaborato (dimensione --)} -\setinterfacemessage{layouts}{9}{attualmente non più di -- livelli di elencazione} -\setinterfacemessage{layouts}{8}{calcolo dello sfondo} -\setinterfacemessage{layouts}{title}{layout} -\setinterfacemessage{layouts}{11}{spaziatura -- non permessa in modo griglia} -\setinterfacemessage{layouts}{10}{-- e -- non sommano a 1.0} -\setinterfacemessage{fonts}{1}{codifica --} -\setinterfacemessage{fonts}{3}{variante sconosciuta --} -\setinterfacemessage{fonts}{2}{variante -- caricata} -\setinterfacemessage{fonts}{5}{stile -- non definito} -\setinterfacemessage{fonts}{4}{corpo del testo -- non definito} -\setinterfacemessage{fonts}{7}{formato sconosciuto --} -\setinterfacemessage{fonts}{6}{-- caricato} -\setinterfacemessage{fonts}{14}{corpo del testo -- definito (sarebbe meglio globale)} -\setinterfacemessage{fonts}{8}{stile -- definito} -\setinterfacemessage{fonts}{title}{font del corpo} -\setinterfacemessage{fonts}{10}{file di font sconosciuto --} -\setinterfacemessage{databases}{1}{--} -\setinterfacemessage{databases}{3}{file globale --} -\setinterfacemessage{databases}{2}{file locale --} -\setinterfacemessage{databases}{4}{file sconosciuto --} -\setinterfacemessage{databases}{title}{database} -\setinterfacemessage{publications}{1}{file -- not found, unknown style ignored} -\setinterfacemessage{publications}{3}{wrote a new auxiliary file \jobname.aux} -\setinterfacemessage{publications}{title}{publications} -\setinterfacemessage{publications}{2}{file -- not found, waiting for bibtex} -\setinterfacemessage{publications}{4}{loading database from --} -\setinterfacemessage{publications}{5}{warning: cite argument -- on line \the\inputlineno} -\setinterfacemessage{publications}{6}{loading formatting style from --} -\setinterfacemessage{javascript}{1}{caricamento dello script set --} -\setinterfacemessage{javascript}{title}{javascript} -\setinterfacemessage{javascript}{2}{preambolo sconosciuto --} -\setinterfacemessage{check}{1}{'=' mancante o non raggruppato dopo '--' alla riga --} -\setinterfacemessage{check}{3}{-- -- sostituisce una macro, usare le MAIUSCOLE!} -\setinterfacemessage{check}{2}{-- argomento/i attesi alla riga --} -\setinterfacemessage{check}{title}{controllo} -\setinterfacemessage{metapost}{1}{caricamento della libreria metapost --} -\setinterfacemessage{metapost}{title}{metapost} -\setinterfacemessage{figures}{1}{figura -- non trovata} -\setinterfacemessage{figures}{3}{dimensions of -- are determined externally} -\setinterfacemessage{figures}{2}{la figura -- non è preimpostata} -\setinterfacemessage{figures}{5}{dimensions of -- are unknown} -\setinterfacemessage{figures}{4}{dimensioni di -- caricate dal file di immagini stesso} -\setinterfacemessage{figures}{6}{dimensioni di -- calcolate da rlxtools} -\setinterfacemessage{figures}{8}{oggetto-figura -- riutilizzato} -\setinterfacemessage{figures}{title}{figure} -\setinterfacemessage{colors}{1}{sistema -- attivato globalmente} -\setinterfacemessage{colors}{3}{-- non definito --} -\setinterfacemessage{colors}{2}{sistema -- attivato localmente} -\setinterfacemessage{colors}{5}{sistema -- sconosciuto} -\setinterfacemessage{colors}{4}{sistema -- caricato} -\setinterfacemessage{colors}{7}{tavolozza -- non disponibile} -\setinterfacemessage{colors}{6}{tavolozza -- resa disponibile} -\setinterfacemessage{colors}{9}{spazio dei colori -- non supportato} -\setinterfacemessage{colors}{8}{specifica -- del colore -- convertita in nero} -\setinterfacemessage{colors}{title}{colore} -\setinterfacemessage{colors}{12}{-- is registered} -\setinterfacemessage{colors}{11}{il colore ø convertito in grigio} -\setinterfacemessage{colors}{10}{spazio dei colori -- supportato} -% -\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-mnl.mkii b/Master/texmf-dist/tex/context/base/mult-mnl.mkii new file mode 100644 index 00000000000..fb527d4adeb --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-mnl.mkii @@ -0,0 +1,210 @@ +\setinterfacemessage{references}{1}{onbekende verwijzing --} +\setinterfacemessage{references}{30}{onbekend object --} +\setinterfacemessage{references}{3}{type verwijzing -- onbekend} +\setinterfacemessage{references}{2}{dubbele verwijzing -- op pagina --} +\setinterfacemessage{references}{5}{number of unknown references: --} +\setinterfacemessage{references}{4}{verboden verwijzing --} +\setinterfacemessage{references}{6}{number of illegal references: --} +\setinterfacemessage{references}{25}{references from document '--' are not imported (export again)} +\setinterfacemessage{references}{24}{references from document '--' are not exported} +\setinterfacemessage{references}{title}{verwijzingen} +\setinterfacemessage{references}{26}{references from document '--' are imported} +\setinterfacemessage{references}{31}{dubbel object --} +\setinterfacemessage{references}{21}{document -- geladen} +\setinterfacemessage{references}{22}{document -- is niet interactief} +\setinterfacemessage{references}{23}{onduidelijke verwijzing -- (prefix=--)} +\setinterfacemessage{documents}{1}{sheet --} +\setinterfacemessage{documents}{title}{sheets} +\setinterfacemessage{documents}{2}{nummer --} +\setinterfacemessage{handlings}{1}{font afhandeling --} +\setinterfacemessage{handlings}{3}{onbekende font afhandeling --} +\setinterfacemessage{handlings}{2}{font afhandeling -- wordt geladen} +\setinterfacemessage{handlings}{title}{handling} +\setinterfacemessage{systems}{title}{systeem} +\setinterfacemessage{systems}{41}{externe file -- in groep -- bestaat niet} +\setinterfacemessage{systems}{9}{-- niet gevonden/geplaatst} +\setinterfacemessage{systems}{91}{papierlade --} +\setinterfacemessage{systems}{8}{nieuwe versie hulpfile, tweede run nodig} +\setinterfacemessage{systems}{21}{de hulpfile is niet geladen} +\setinterfacemessage{systems}{20}{betekenissen (sorteren) van -- geladen} +\setinterfacemessage{systems}{5}{module -- geladen} +\setinterfacemessage{systems}{4}{commando -- is al gedefinieerd} +\setinterfacemessage{systems}{27}{Versie} +\setinterfacemessage{systems}{26}{Registers} +\setinterfacemessage{systems}{25}{Verwijzingen} +\setinterfacemessage{systems}{24}{Plaatsblokken} +\setinterfacemessage{systems}{1}{laden hulpfile uitgesteld (typemode)} +\setinterfacemessage{systems}{23}{-- gearrangeerd op --} +\setinterfacemessage{systems}{22}{gebruik een goede hulpfile} +\setinterfacemessage{systems}{2}{-- geladen} +\setinterfacemessage{systems}{19}{betekenissen (synoniemen) van -- geladen} +\setinterfacemessage{systems}{18}{synoniem -- -- bestaat niet} +\setinterfacemessage{systems}{7}{module -- reeds geladen} +\setinterfacemessage{systems}{6}{geen module -- gevonden} +\setinterfacemessage{systems}{14}{geforceerde paginaovergang in lijst voor --} +\setinterfacemessage{systems}{15}{wegschrijven buffer --} +\setinterfacemessage{systems}{16}{inlezen buffer --} +\setinterfacemessage{systems}{17}{verbatim inlezen buffer --} +\setinterfacemessage{systems}{13}{markering -- gedefinieerd --} +\setinterfacemessage{systems}{12}{de hulpfile is niet gesorteerd, gebruik texutil} +\setinterfacemessage{systems}{11}{aanmaken basale hulpfile} +\setinterfacemessage{systems}{10}{gebruik geen em in --} +\setinterfacemessage{floatblocks}{1}{-- hernummerd / -- => --} +\setinterfacemessage{floatblocks}{3}{-- verplaatst} +\setinterfacemessage{floatblocks}{2}{-- bewaard} +\setinterfacemessage{floatblocks}{5}{volgorde aangepast} +\setinterfacemessage{floatblocks}{4}{-- geplaatst} +\setinterfacemessage{floatblocks}{7}{maximaal -- onder} +\setinterfacemessage{floatblocks}{6}{maximaal -- boven} +\setinterfacemessage{floatblocks}{9}{volgorde verstoord} +\setinterfacemessage{floatblocks}{8}{minder dan -- regels} +\setinterfacemessage{floatblocks}{title}{plaatsblokken} +\setinterfacemessage{floatblocks}{13}{er is niets te splitsen} +\setinterfacemessage{floatblocks}{12}{niet gedefinieerd} +\setinterfacemessage{floatblocks}{11}{geen blok opgegeven} +\setinterfacemessage{floatblocks}{10}{-- begrensd} +\setinterfacemessage{interactions}{1}{aspect ratio -- x -- (b x h)} +\setinterfacemessage{interactions}{3}{niet actief} +\setinterfacemessage{interactions}{2}{actief} +\setinterfacemessage{interactions}{5}{onbekend attachment --} +\setinterfacemessage{interactions}{4}{geen paginasynchronisatie (--) in hmode} +\setinterfacemessage{interactions}{6}{attachment file -- bestaat niet} +\setinterfacemessage{interactions}{title}{interactie} +\setinterfacemessage{interactions}{21}{-- code tussengevoegd} +\setinterfacemessage{regimes}{1}{regime --} +\setinterfacemessage{regimes}{3}{onbekend regime --} +\setinterfacemessage{regimes}{2}{regime -- wordt geladen} +\setinterfacemessage{regimes}{title}{regime} +\setinterfacemessage{structures}{1}{begin van sectieblok --} +\setinterfacemessage{structures}{title}{structuur} +\setinterfacemessage{structures}{2}{eind van sectieblok --} +\setinterfacemessage{linguals}{1}{afbreekpatronen -- voor -- geladen (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{3}{afbreekdefinities -- voor -- geladen (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{2}{geen afbreekpatronen -- voor -- (n=--,e=--,m=--) (--,--)} +\setinterfacemessage{linguals}{5}{afbreekpatronen voor -- niet geladen} +\setinterfacemessage{linguals}{4}{geen afbreekdefinities -- voor -- (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{7}{taal specifieke opties [--] introduceren een skip van --} +\setinterfacemessage{linguals}{6}{taal -- is niet gedefinieerd} +\setinterfacemessage{linguals}{9}{taal -- is actief} +\setinterfacemessage{linguals}{8}{taal specifieke opties [--] naadloos toegevoegd} +\setinterfacemessage{linguals}{title}{taal} +\setinterfacemessage{linguals}{10}{patronen --geladen} +\setinterfacemessage{verbatims}{1}{file -- bestaat niet} +\setinterfacemessage{verbatims}{title}{typen} +\setinterfacemessage{filters}{1}{filter -- wordt geladen} +\setinterfacemessage{filters}{title}{filter} +\setinterfacemessage{filters}{2}{onbekend filter --} +\setinterfacemessage{textblocks}{1}{nieuwe versie, tweede run nodig} +\setinterfacemessage{textblocks}{3}{inlezen blokken uit --} +\setinterfacemessage{textblocks}{2}{wegschrijven blokken naar --} +\setinterfacemessage{textblocks}{5}{-- niet verborgen} +\setinterfacemessage{textblocks}{4}{er is een tweede run nodig} +\setinterfacemessage{textblocks}{7}{-- verborgen} +\setinterfacemessage{textblocks}{6}{-- verborgen en verwerkt} +\setinterfacemessage{textblocks}{9}{-- niet gehandhaafd} +\setinterfacemessage{textblocks}{8}{-- gehandhaafd} +\setinterfacemessage{textblocks}{title}{tekstblokken} +\setinterfacemessage{textblocks}{12}{-- overgeslagen} +\setinterfacemessage{textblocks}{11}{-- geladen en geplaatst} +\setinterfacemessage{textblocks}{10}{-- geladen en verwerkt} +\setinterfacemessage{encodings}{1}{codering --} +\setinterfacemessage{encodings}{3}{onbekende codering --} +\setinterfacemessage{encodings}{2}{codering -- wordt geladen} +\setinterfacemessage{encodings}{title}{encoding} +\setinterfacemessage{columns}{1}{maximaal -- kolommen} +\setinterfacemessage{columns}{3}{probleempje, probeer [balanceren=nee]} +\setinterfacemessage{columns}{2}{gebruik eventueel \string\filbreak} +\setinterfacemessage{columns}{5}{plaatsblok onder nog niet mogelijk} +\setinterfacemessage{columns}{4}{plaatsblok boven nog niet mogelijk} +\setinterfacemessage{columns}{7}{balanceren afgebroken na 100 stappen} +\setinterfacemessage{columns}{6}{-- plaatsblok(en) opgeschort} +\setinterfacemessage{columns}{9}{uitlijnen controleren!} +\setinterfacemessage{columns}{8}{gebalanceerd in -- stap(pen)} +\setinterfacemessage{columns}{title}{kolommen} +\setinterfacemessage{columns}{13}{breed figuur geplaatst boven kolommen} +\setinterfacemessage{columns}{12}{plaatsblok verplaatst naar volgende kolom / --} +\setinterfacemessage{columns}{11}{plaatsblok te breed voor kolom} +\setinterfacemessage{columns}{10}{(minder dan) 1 regel over} +\setinterfacemessage{symbols}{1}{symboolset -- wordt geladen} +\setinterfacemessage{symbols}{title}{symbolen} +\setinterfacemessage{files}{1}{file synoniem -- is al in gebruik voor --} +\setinterfacemessage{files}{title}{files} +\setinterfacemessage{versions}{1}{er mankeert een @+} +\setinterfacemessage{versions}{3}{geselecteerde pagina's: --} +\setinterfacemessage{versions}{2}{markeren pagina's} +\setinterfacemessage{versions}{title}{versie} +\setinterfacemessage{specials}{1}{-- geladen} +\setinterfacemessage{specials}{3}{-- gereset} +\setinterfacemessage{specials}{2}{verdere nesting is niet toegestaan --} +\setinterfacemessage{specials}{5}{definitiefile -- wordt geladen} +\setinterfacemessage{specials}{4}{commando -- bestaat niet} +\setinterfacemessage{specials}{7}{onbekende driver --} +\setinterfacemessage{specials}{6}{nesting is niet toegestaan} +\setinterfacemessage{specials}{title}{specials} +\setinterfacemessage{layouts}{1}{teksthoogte aangepast met -- op pagina --} +\setinterfacemessage{layouts}{3}{-- maal tekst plaatsen uitstellen} +\setinterfacemessage{layouts}{2}{-- maal uitgestelde tekst tussengevoegd} +\setinterfacemessage{layouts}{5}{margeblokken inactief} +\setinterfacemessage{layouts}{4}{margeblokken actief} +\setinterfacemessage{layouts}{7}{beeldmerken berekenen} +\setinterfacemessage{layouts}{6}{subpagina reeks -- verwerkt (aantal --)} +\setinterfacemessage{layouts}{9}{momenteel maximaal -- niveaus in opsommingen} +\setinterfacemessage{layouts}{8}{achtergronden berekenen} +\setinterfacemessage{layouts}{title}{layout} +\setinterfacemessage{layouts}{11}{interlinie -- niet toegestaan in gridmode} +\setinterfacemessage{layouts}{10}{-- en -- tellen niet op tot 1.0} +\setinterfacemessage{fonts}{1}{codering --} +\setinterfacemessage{fonts}{3}{onbekende variant --} +\setinterfacemessage{fonts}{2}{variant -- wordt geladen} +\setinterfacemessage{fonts}{5}{stijl -- is niet gedefinieerd} +\setinterfacemessage{fonts}{4}{korps -- is niet gedefinieerd} +\setinterfacemessage{fonts}{7}{onbekend formaat --} +\setinterfacemessage{fonts}{6}{-- wordt geladen} +\setinterfacemessage{fonts}{14}{korps -- is gedefinieerd (kan beter globaal plaatsvinden)} +\setinterfacemessage{fonts}{8}{stijl -- gedefinieerd} +\setinterfacemessage{fonts}{title}{korps} +\setinterfacemessage{fonts}{10}{onbekende font file --} +\setinterfacemessage{databases}{1}{--} +\setinterfacemessage{databases}{3}{globaal bestand --} +\setinterfacemessage{databases}{2}{lokaal bestand --} +\setinterfacemessage{databases}{4}{onbekend bestand --} +\setinterfacemessage{databases}{title}{database} +\setinterfacemessage{publications}{1}{file -- not found, unknown style ignored} +\setinterfacemessage{publications}{3}{wrote a new auxiliary file \jobname.aux} +\setinterfacemessage{publications}{title}{publications} +\setinterfacemessage{publications}{2}{file -- not found, waiting for bibtex} +\setinterfacemessage{publications}{4}{loading database from --} +\setinterfacemessage{publications}{5}{warning: cite argument -- on line \the\inputlineno} +\setinterfacemessage{publications}{6}{loading formatting style from --} +\setinterfacemessage{javascript}{1}{script set -- wordt geladen} +\setinterfacemessage{javascript}{title}{javascript} +\setinterfacemessage{javascript}{2}{onbekende preamble --} +\setinterfacemessage{check}{1}{'=' ontbreekt of zonder {} na '--' in regel --} +\setinterfacemessage{check}{3}{-- -- vervangt een macro, gebruik HOOFDLETTERS!} +\setinterfacemessage{check}{2}{-- argument(en) verwacht in regel --} +\setinterfacemessage{check}{title}{controle} +\setinterfacemessage{metapost}{1}{metapost bibliotheek -- wordt geladen} +\setinterfacemessage{metapost}{title}{metapost} +\setinterfacemessage{figures}{1}{figuur -- is niet te vinden} +\setinterfacemessage{figures}{3}{maten van -- worden extern vastgesteld} +\setinterfacemessage{figures}{2}{figuur -- wordt niet preset} +\setinterfacemessage{figures}{5}{maten van -- zijn onbekend} +\setinterfacemessage{figures}{4}{maten van -- geladen uit figuurfile zelf} +\setinterfacemessage{figures}{6}{maten van -- berekend door rlxtools} +\setinterfacemessage{figures}{8}{figuurobject -- wordt opnieuw gebruikt} +\setinterfacemessage{figures}{title}{figuren} +\setinterfacemessage{colors}{1}{systeem -- is globaal actief} +\setinterfacemessage{colors}{3}{-- is niet gedefinieerd --} +\setinterfacemessage{colors}{2}{systeem -- is lokaal actief} +\setinterfacemessage{colors}{5}{onbekend systeem --} +\setinterfacemessage{colors}{4}{systeem -- wordt geladen} +\setinterfacemessage{colors}{7}{palet -- is niet beschikbaar} +\setinterfacemessage{colors}{6}{palet -- is beschikbaar} +\setinterfacemessage{colors}{9}{-- kleurruimte wordt niet ondersteund} +\setinterfacemessage{colors}{8}{specificatie -- bij -- wordt zwart} +\setinterfacemessage{colors}{title}{kleur} +\setinterfacemessage{colors}{12}{-- is geregistreerd} +\setinterfacemessage{colors}{11}{kleur wordt vertaald in grijs} +\setinterfacemessage{colors}{10}{-- kleurruimte wordt ondersteund} +% +\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-mnl.tex b/Master/texmf-dist/tex/context/base/mult-mnl.tex deleted file mode 100644 index b8204a40b0c..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-mnl.tex +++ /dev/null @@ -1,208 +0,0 @@ -\setinterfacemessage{references}{1}{onbekende verwijzing --} -\setinterfacemessage{references}{3}{type verwijzing -- onbekend} -\setinterfacemessage{references}{2}{dubbele verwijzing -- op pagina --} -\setinterfacemessage{references}{4}{verboden verwijzing --} -\setinterfacemessage{references}{30}{onbekend object --} -\setinterfacemessage{references}{25}{references from document '--' are not imported (export again)} -\setinterfacemessage{references}{24}{references from document '--' are not exported} -\setinterfacemessage{references}{title}{verwijzingen} -\setinterfacemessage{references}{26}{references from document '--' are imported} -\setinterfacemessage{references}{31}{dubbel object --} -\setinterfacemessage{references}{21}{document -- geladen} -\setinterfacemessage{references}{22}{document -- is niet interactief} -\setinterfacemessage{references}{23}{onduidelijke verwijzing -- (prefix=--)} -\setinterfacemessage{documents}{1}{sheet --} -\setinterfacemessage{documents}{title}{sheets} -\setinterfacemessage{documents}{2}{nummer --} -\setinterfacemessage{handlings}{1}{font afhandeling --} -\setinterfacemessage{handlings}{3}{onbekende font afhandeling --} -\setinterfacemessage{handlings}{2}{font afhandeling -- wordt geladen} -\setinterfacemessage{handlings}{title}{handling} -\setinterfacemessage{systems}{title}{systeem} -\setinterfacemessage{systems}{41}{externe file -- in groep -- bestaat niet} -\setinterfacemessage{systems}{9}{-- niet gevonden/geplaatst} -\setinterfacemessage{systems}{91}{papierlade --} -\setinterfacemessage{systems}{8}{nieuwe versie hulpfile, tweede run nodig} -\setinterfacemessage{systems}{21}{de hulpfile is niet geladen} -\setinterfacemessage{systems}{20}{betekenissen (sorteren) van -- geladen} -\setinterfacemessage{systems}{5}{module -- geladen} -\setinterfacemessage{systems}{4}{commando -- is al gedefinieerd} -\setinterfacemessage{systems}{27}{Versie} -\setinterfacemessage{systems}{26}{Registers} -\setinterfacemessage{systems}{25}{Verwijzingen} -\setinterfacemessage{systems}{24}{Plaatsblokken} -\setinterfacemessage{systems}{1}{laden hulpfile uitgesteld (typemode)} -\setinterfacemessage{systems}{23}{-- gearrangeerd op --} -\setinterfacemessage{systems}{22}{gebruik een goede hulpfile} -\setinterfacemessage{systems}{2}{-- geladen} -\setinterfacemessage{systems}{19}{betekenissen (synoniemen) van -- geladen} -\setinterfacemessage{systems}{18}{synoniem -- -- bestaat niet} -\setinterfacemessage{systems}{7}{module -- reeds geladen} -\setinterfacemessage{systems}{6}{geen module -- gevonden} -\setinterfacemessage{systems}{14}{geforceerde paginaovergang in lijst voor --} -\setinterfacemessage{systems}{15}{wegschrijven buffer --} -\setinterfacemessage{systems}{16}{inlezen buffer --} -\setinterfacemessage{systems}{17}{verbatim inlezen buffer --} -\setinterfacemessage{systems}{13}{markering -- gedefinieerd --} -\setinterfacemessage{systems}{12}{de hulpfile is niet gesorteerd, gebruik texutil} -\setinterfacemessage{systems}{11}{aanmaken basale hulpfile} -\setinterfacemessage{systems}{10}{gebruik geen em in --} -\setinterfacemessage{floatblocks}{1}{-- hernummerd / -- => --} -\setinterfacemessage{floatblocks}{3}{-- verplaatst} -\setinterfacemessage{floatblocks}{2}{-- bewaard} -\setinterfacemessage{floatblocks}{5}{volgorde aangepast} -\setinterfacemessage{floatblocks}{4}{-- geplaatst} -\setinterfacemessage{floatblocks}{7}{maximaal -- onder} -\setinterfacemessage{floatblocks}{6}{maximaal -- boven} -\setinterfacemessage{floatblocks}{9}{volgorde verstoord} -\setinterfacemessage{floatblocks}{8}{minder dan -- regels} -\setinterfacemessage{floatblocks}{title}{plaatsblokken} -\setinterfacemessage{floatblocks}{13}{er is niets te splitsen} -\setinterfacemessage{floatblocks}{12}{niet gedefinieerd} -\setinterfacemessage{floatblocks}{11}{geen blok opgegeven} -\setinterfacemessage{floatblocks}{10}{-- begrensd} -\setinterfacemessage{interactions}{1}{aspect ratio -- x -- (b x h)} -\setinterfacemessage{interactions}{3}{niet actief} -\setinterfacemessage{interactions}{2}{actief} -\setinterfacemessage{interactions}{5}{onbekend attachment --} -\setinterfacemessage{interactions}{4}{geen paginasynchronisatie (--) in hmode} -\setinterfacemessage{interactions}{6}{attachment file -- bestaat niet} -\setinterfacemessage{interactions}{title}{interactie} -\setinterfacemessage{interactions}{21}{-- code tussengevoegd} -\setinterfacemessage{regimes}{1}{regime --} -\setinterfacemessage{regimes}{3}{onbekend regime --} -\setinterfacemessage{regimes}{2}{regime -- wordt geladen} -\setinterfacemessage{regimes}{title}{regime} -\setinterfacemessage{structures}{1}{begin van sectieblok --} -\setinterfacemessage{structures}{title}{structuur} -\setinterfacemessage{structures}{2}{eind van sectieblok --} -\setinterfacemessage{linguals}{1}{afbreekpatronen -- voor -- geladen (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{3}{afbreekdefinities -- voor -- geladen (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{2}{geen afbreekpatronen -- voor -- (n=--,e=--,m=--) (--,--)} -\setinterfacemessage{linguals}{5}{afbreekpatronen voor -- niet geladen} -\setinterfacemessage{linguals}{4}{geen afbreekdefinities -- voor -- (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{7}{taal specifieke opties [--] introduceren een skip van --} -\setinterfacemessage{linguals}{6}{taal -- is niet gedefinieerd} -\setinterfacemessage{linguals}{9}{taal -- is actief} -\setinterfacemessage{linguals}{8}{taal specifieke opties [--] naadloos toegevoegd} -\setinterfacemessage{linguals}{title}{taal} -\setinterfacemessage{linguals}{10}{patronen --geladen} -\setinterfacemessage{verbatims}{1}{file -- bestaat niet} -\setinterfacemessage{verbatims}{title}{typen} -\setinterfacemessage{filters}{1}{filter -- wordt geladen} -\setinterfacemessage{filters}{title}{filter} -\setinterfacemessage{filters}{2}{onbekend filter --} -\setinterfacemessage{textblocks}{1}{nieuwe versie, tweede run nodig} -\setinterfacemessage{textblocks}{3}{inlezen blokken uit --} -\setinterfacemessage{textblocks}{2}{wegschrijven blokken naar --} -\setinterfacemessage{textblocks}{5}{-- niet verborgen} -\setinterfacemessage{textblocks}{4}{er is een tweede run nodig} -\setinterfacemessage{textblocks}{7}{-- verborgen} -\setinterfacemessage{textblocks}{6}{-- verborgen en verwerkt} -\setinterfacemessage{textblocks}{9}{-- niet gehandhaafd} -\setinterfacemessage{textblocks}{8}{-- gehandhaafd} -\setinterfacemessage{textblocks}{title}{tekstblokken} -\setinterfacemessage{textblocks}{12}{-- overgeslagen} -\setinterfacemessage{textblocks}{11}{-- geladen en geplaatst} -\setinterfacemessage{textblocks}{10}{-- geladen en verwerkt} -\setinterfacemessage{encodings}{1}{codering --} -\setinterfacemessage{encodings}{3}{onbekende codering --} -\setinterfacemessage{encodings}{2}{codering -- wordt geladen} -\setinterfacemessage{encodings}{title}{encoding} -\setinterfacemessage{columns}{1}{maximaal -- kolommen} -\setinterfacemessage{columns}{3}{probleempje, probeer [balanceren=nee]} -\setinterfacemessage{columns}{2}{gebruik eventueel \string\filbreak} -\setinterfacemessage{columns}{5}{plaatsblok onder nog niet mogelijk} -\setinterfacemessage{columns}{4}{plaatsblok boven nog niet mogelijk} -\setinterfacemessage{columns}{7}{balanceren afgebroken na 100 stappen} -\setinterfacemessage{columns}{6}{-- plaatsblok(en) opgeschort} -\setinterfacemessage{columns}{9}{uitlijnen controleren!} -\setinterfacemessage{columns}{8}{gebalanceerd in -- stap(pen)} -\setinterfacemessage{columns}{title}{kolommen} -\setinterfacemessage{columns}{13}{breed figuur geplaatst boven kolommen} -\setinterfacemessage{columns}{12}{plaatsblok verplaatst naar volgende kolom / --} -\setinterfacemessage{columns}{11}{plaatsblok te breed voor kolom} -\setinterfacemessage{columns}{10}{(minder dan) 1 regel over} -\setinterfacemessage{symbols}{1}{symboolset -- wordt geladen} -\setinterfacemessage{symbols}{title}{symbolen} -\setinterfacemessage{files}{1}{file synoniem -- is al in gebruik voor --} -\setinterfacemessage{files}{title}{files} -\setinterfacemessage{versions}{1}{er mankeert een @+} -\setinterfacemessage{versions}{3}{geselecteerde pagina's: --} -\setinterfacemessage{versions}{2}{markeren pagina's} -\setinterfacemessage{versions}{title}{versie} -\setinterfacemessage{specials}{1}{-- geladen} -\setinterfacemessage{specials}{3}{-- gereset} -\setinterfacemessage{specials}{2}{verdere nesting is niet toegestaan --} -\setinterfacemessage{specials}{5}{definitiefile -- wordt geladen} -\setinterfacemessage{specials}{4}{commando -- bestaat niet} -\setinterfacemessage{specials}{7}{onbekende driver --} -\setinterfacemessage{specials}{6}{nesting is niet toegestaan} -\setinterfacemessage{specials}{title}{specials} -\setinterfacemessage{layouts}{1}{teksthoogte aangepast met -- op pagina --} -\setinterfacemessage{layouts}{3}{-- maal tekst plaatsen uitstellen} -\setinterfacemessage{layouts}{2}{-- maal uitgestelde tekst tussengevoegd} -\setinterfacemessage{layouts}{5}{margeblokken inactief} -\setinterfacemessage{layouts}{4}{margeblokken actief} -\setinterfacemessage{layouts}{7}{beeldmerken berekenen} -\setinterfacemessage{layouts}{6}{subpagina reeks -- verwerkt (aantal --)} -\setinterfacemessage{layouts}{9}{momenteel maximaal -- niveaus in opsommingen} -\setinterfacemessage{layouts}{8}{achtergronden berekenen} -\setinterfacemessage{layouts}{title}{layout} -\setinterfacemessage{layouts}{11}{interlinie -- niet toegestaan in gridmode} -\setinterfacemessage{layouts}{10}{-- en -- tellen niet op tot 1.0} -\setinterfacemessage{fonts}{1}{codering --} -\setinterfacemessage{fonts}{3}{onbekende variant --} -\setinterfacemessage{fonts}{2}{variant -- wordt geladen} -\setinterfacemessage{fonts}{5}{stijl -- is niet gedefinieerd} -\setinterfacemessage{fonts}{4}{korps -- is niet gedefinieerd} -\setinterfacemessage{fonts}{7}{onbekend formaat --} -\setinterfacemessage{fonts}{6}{-- wordt geladen} -\setinterfacemessage{fonts}{14}{korps -- is gedefinieerd (kan beter globaal plaatsvinden)} -\setinterfacemessage{fonts}{8}{stijl -- gedefinieerd} -\setinterfacemessage{fonts}{title}{korps} -\setinterfacemessage{fonts}{10}{onbekende font file --} -\setinterfacemessage{databases}{1}{--} -\setinterfacemessage{databases}{3}{globaal bestand --} -\setinterfacemessage{databases}{2}{lokaal bestand --} -\setinterfacemessage{databases}{4}{onbekend bestand --} -\setinterfacemessage{databases}{title}{database} -\setinterfacemessage{publications}{1}{file -- not found, unknown style ignored} -\setinterfacemessage{publications}{3}{wrote a new auxiliary file \jobname.aux} -\setinterfacemessage{publications}{title}{publications} -\setinterfacemessage{publications}{2}{file -- not found, waiting for bibtex} -\setinterfacemessage{publications}{4}{loading database from --} -\setinterfacemessage{publications}{5}{warning: cite argument -- on line \the\inputlineno} -\setinterfacemessage{publications}{6}{loading formatting style from --} -\setinterfacemessage{javascript}{1}{script set -- wordt geladen} -\setinterfacemessage{javascript}{title}{javascript} -\setinterfacemessage{javascript}{2}{onbekende preamble --} -\setinterfacemessage{check}{1}{'=' ontbreekt of zonder {} na '--' in regel --} -\setinterfacemessage{check}{3}{-- -- vervangt een macro, gebruik HOOFDLETTERS!} -\setinterfacemessage{check}{2}{-- argument(en) verwacht in regel --} -\setinterfacemessage{check}{title}{controle} -\setinterfacemessage{metapost}{1}{metapost bibliotheek -- wordt geladen} -\setinterfacemessage{metapost}{title}{metapost} -\setinterfacemessage{figures}{1}{figuur -- is niet te vinden} -\setinterfacemessage{figures}{3}{maten van -- worden extern vastgesteld} -\setinterfacemessage{figures}{2}{figuur -- wordt niet preset} -\setinterfacemessage{figures}{5}{maten van -- zijn onbekend} -\setinterfacemessage{figures}{4}{maten van -- geladen uit figuurfile zelf} -\setinterfacemessage{figures}{6}{maten van -- berekend door rlxtools} -\setinterfacemessage{figures}{8}{figuurobject -- wordt opnieuw gebruikt} -\setinterfacemessage{figures}{title}{figuren} -\setinterfacemessage{colors}{1}{systeem -- is globaal actief} -\setinterfacemessage{colors}{3}{-- is niet gedefinieerd --} -\setinterfacemessage{colors}{2}{systeem -- is lokaal actief} -\setinterfacemessage{colors}{5}{onbekend systeem --} -\setinterfacemessage{colors}{4}{systeem -- wordt geladen} -\setinterfacemessage{colors}{7}{palet -- is niet beschikbaar} -\setinterfacemessage{colors}{6}{palet -- is beschikbaar} -\setinterfacemessage{colors}{9}{-- kleurruimte wordt niet ondersteund} -\setinterfacemessage{colors}{8}{specificatie -- bij -- wordt zwart} -\setinterfacemessage{colors}{title}{kleur} -\setinterfacemessage{colors}{12}{-- is geregistreerd} -\setinterfacemessage{colors}{11}{kleur wordt vertaald in grijs} -\setinterfacemessage{colors}{10}{-- kleurruimte wordt ondersteund} -% -\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-mno.mkii b/Master/texmf-dist/tex/context/base/mult-mno.mkii new file mode 100644 index 00000000000..bbbc3a6585c --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-mno.mkii @@ -0,0 +1,210 @@ +\setinterfacemessage{references}{1}{ukjent referanse --} +\setinterfacemessage{references}{30}{ukjent objekt --} +\setinterfacemessage{references}{3}{ukjent referansetype --} +\setinterfacemessage{references}{2}{duplikat referanse -- pø side --} +\setinterfacemessage{references}{5}{number of unknown references: --} +\setinterfacemessage{references}{4}{ulovlig referanse --} +\setinterfacemessage{references}{6}{number of illegal references: --} +\setinterfacemessage{references}{25}{references from document '--' are not imported (export again)} +\setinterfacemessage{references}{24}{references from document '--' are not exported} +\setinterfacemessage{references}{title}{referanser} +\setinterfacemessage{references}{26}{references from document '--' are imported} +\setinterfacemessage{references}{31}{duplikat objekt --} +\setinterfacemessage{references}{21}{dokument -- er lest inn} +\setinterfacemessage{references}{22}{dokument -- er ikke interaktivt} +\setinterfacemessage{references}{23}{obskur referanse -- (Prefix=--)} +\setinterfacemessage{documents}{1}{sheet --} +\setinterfacemessage{documents}{title}{sheets} +\setinterfacemessage{documents}{2}{number --} +\setinterfacemessage{handlings}{1}{font handling --} +\setinterfacemessage{handlings}{3}{unknown font handling --} +\setinterfacemessage{handlings}{2}{font handling -- is loaded} +\setinterfacemessage{handlings}{title}{handling} +\setinterfacemessage{systems}{title}{system} +\setinterfacemessage{systems}{41}{ekstern fil -- i gruppe -- eksisterer ikke} +\setinterfacemessage{systems}{9}{-- ikke funnet/behandlet} +\setinterfacemessage{systems}{91}{papertray --} +\setinterfacemessage{systems}{8}{ny versjon av hjelpefil, andre gjennomkjøring nødvendig} +\setinterfacemessage{systems}{21}{hjelpefila er ikke lest inn} +\setinterfacemessage{systems}{20}{betydning (sorterer) av -- er lest inn} +\setinterfacemessage{systems}{5}{makroene i modul -- er lest inn} +\setinterfacemessage{systems}{4}{kommando -- er allerede definert} +\setinterfacemessage{systems}{27}{Versjon} +\setinterfacemessage{systems}{26}{Registere} +\setinterfacemessage{systems}{25}{Referanser} +\setinterfacemessage{systems}{24}{Flytblokker} +\setinterfacemessage{systems}{1}{innlesning av hjelpefila utsatt (typemode)} +\setinterfacemessage{systems}{23}{-- arrangert på --} +\setinterfacemessage{systems}{22}{bruk en gyldig hjelpefil} +\setinterfacemessage{systems}{2}{-- er lest inn} +\setinterfacemessage{systems}{19}{betydning (synonymer) av -- er lest inn} +\setinterfacemessage{systems}{18}{synonym -- -- eksisterer ikke} +\setinterfacemessage{systems}{7}{makroene i modul -- er allerede lest inn} +\setinterfacemessage{systems}{6}{ingen makroer funnet i modul ---} +\setinterfacemessage{systems}{14}{tvunget sideskift i liste ved --} +\setinterfacemessage{systems}{15}{lagrer Buffer --} +\setinterfacemessage{systems}{16}{tegnsetter buffer --} +\setinterfacemessage{systems}{17}{tegnsetter verbatim-buffer --} +\setinterfacemessage{systems}{13}{markering -- definert --} +\setinterfacemessage{systems}{12}{hjelpefila er ikke sortert, bruk texutil} +\setinterfacemessage{systems}{11}{lager enkel hjelpefil} +\setinterfacemessage{systems}{10}{ikke bruk em i --} +\setinterfacemessage{floatblocks}{1}{-- renummerert / -- => --} +\setinterfacemessage{floatblocks}{3}{-- flyttet} +\setinterfacemessage{floatblocks}{2}{-- lagret} +\setinterfacemessage{floatblocks}{5}{rekkefølge tilpasset} +\setinterfacemessage{floatblocks}{4}{-- plassert} +\setinterfacemessage{floatblocks}{7}{maksimalt -- flytblokker nederst} +\setinterfacemessage{floatblocks}{6}{maksimalt -- flytblokker øverst} +\setinterfacemessage{floatblocks}{9}{rekkefølge endret} +\setinterfacemessage{floatblocks}{8}{mindre enn -- linjer} +\setinterfacemessage{floatblocks}{title}{flytblokker} +\setinterfacemessage{floatblocks}{13}{there is nothing to split} +\setinterfacemessage{floatblocks}{12}{udefinert} +\setinterfacemessage{floatblocks}{11}{ingen blokk oppgitt} +\setinterfacemessage{floatblocks}{10}{-- begrenset} +\setinterfacemessage{interactions}{1}{forholdstall -- x -- (b x h)} +\setinterfacemessage{interactions}{3}{inaktiv} +\setinterfacemessage{interactions}{2}{aktiv} +\setinterfacemessage{interactions}{5}{unknown attachment --} +\setinterfacemessage{interactions}{4}{ingen sidesynkronisering (--) i hmode} +\setinterfacemessage{interactions}{6}{attachment file -- does not exist} +\setinterfacemessage{interactions}{title}{interaksjon} +\setinterfacemessage{interactions}{21}{-- kode satt inn / tilføyd} +\setinterfacemessage{regimes}{1}{koding --} +\setinterfacemessage{regimes}{3}{ukjent koding --} +\setinterfacemessage{regimes}{2}{koding -- er lest inn} +\setinterfacemessage{regimes}{title}{koding} +\setinterfacemessage{structures}{1}{starten av blokk -- (seksjon)} +\setinterfacemessage{structures}{title}{struktur} +\setinterfacemessage{structures}{2}{slutten av blokk -- (seksjon)} +\setinterfacemessage{linguals}{1}{orddelingsmønster -- for -- er lest inn (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{3}{orddelingsdefinisjon -- for -- er lest inn (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{2}{ingen orddelingsmønster -- for -- (n=--,e=--,m=--) (--,--)} +\setinterfacemessage{linguals}{5}{orddelingsmønster for -- er ikke lest inn} +\setinterfacemessage{linguals}{4}{ingen orddelingsdefinisjon -- for -- (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{7}{spràk spesifikk opsjon [--] introduserer et -- hopp} +\setinterfacemessage{linguals}{6}{spràk -- er udefinert} +\setinterfacemessage{linguals}{9}{spràk -- er aktivt} +\setinterfacemessage{linguals}{8}{spràk spesifikk opsjon [--] problemfritt tilføyd} +\setinterfacemessage{linguals}{title}{sprøk} +\setinterfacemessage{linguals}{10}{orddelingsmønster -- er lest inn} +\setinterfacemessage{verbatims}{1}{fil -- eksisterer ikke} +\setinterfacemessage{verbatims}{title}{verbatim} +\setinterfacemessage{filters}{1}{filter -- is loaded} +\setinterfacemessage{filters}{title}{filter} +\setinterfacemessage{filters}{2}{unknown filter --} +\setinterfacemessage{textblocks}{1}{ny versjon, andre gjennomkjøring nødvendig} +\setinterfacemessage{textblocks}{3}{leser blokker fra --} +\setinterfacemessage{textblocks}{2}{skriver blokker til --} +\setinterfacemessage{textblocks}{5}{-- ikke skjult} +\setinterfacemessage{textblocks}{4}{andre gjennomkjøring nødvendig} +\setinterfacemessage{textblocks}{7}{-- skjult} +\setinterfacemessage{textblocks}{6}{-- skjult og behandlet} +\setinterfacemessage{textblocks}{9}{-- ikke tegnsatt} +\setinterfacemessage{textblocks}{8}{-- tegnsatt} +\setinterfacemessage{textblocks}{title}{tekstblokker} +\setinterfacemessage{textblocks}{12}{-- utelatt} +\setinterfacemessage{textblocks}{11}{-- lest inn og tegnsatt} +\setinterfacemessage{textblocks}{10}{-- lest inn og behandlet} +\setinterfacemessage{encodings}{1}{koding --} +\setinterfacemessage{encodings}{3}{ukjent koding --} +\setinterfacemessage{encodings}{2}{koding -- er lest inn} +\setinterfacemessage{encodings}{title}{koding} +\setinterfacemessage{columns}{1}{maksimalt -- kolonner} +\setinterfacemessage{columns}{3}{problemer, slår av balansering} +\setinterfacemessage{columns}{2}{bruk \string\filbreak\space som et alternativ} +\setinterfacemessage{columns}{5}{flytblokker nedert er ikke støttet enda} +\setinterfacemessage{columns}{4}{flytblokker øverst er ikke støttet enda} +\setinterfacemessage{columns}{7}{balansering avbrutt etter 100 iterasjoner} +\setinterfacemessage{columns}{6}{-- flytblokk forskjøvet} +\setinterfacemessage{columns}{9}{kontroller tekstlayout!} +\setinterfacemessage{columns}{8}{balansert etter -- iterasjoner} +\setinterfacemessage{columns}{title}{kolonner} +\setinterfacemessage{columns}{13}{bred flytblokk forksjøvet til toppen av kolonnene} +\setinterfacemessage{columns}{12}{flytblokk forskjøvet til neste kolonne / --} +\setinterfacemessage{columns}{11}{flytblokk for bredt for kolonna} +\setinterfacemessage{columns}{10}{(mindre enn) 1 linje igjen} +\setinterfacemessage{symbols}{1}{leser inn symbolsett --} +\setinterfacemessage{symbols}{title}{symboler} +\setinterfacemessage{files}{1}{filesynonym -- er allerede brukt for --} +\setinterfacemessage{files}{title}{filer} +\setinterfacemessage{versions}{1}{manglende @+} +\setinterfacemessage{versions}{3}{valgte sider: --} +\setinterfacemessage{versions}{2}{markerer sider} +\setinterfacemessage{versions}{title}{versjon} +\setinterfacemessage{specials}{1}{-- er lest inn} +\setinterfacemessage{specials}{3}{-- er tilbakestilt} +\setinterfacemessage{specials}{2}{dypere 'nesting' er ikke tillatt --} +\setinterfacemessage{specials}{5}{leser inn definisjonsfil for --} +\setinterfacemessage{specials}{4}{kommando -- eksisterer ikke} +\setinterfacemessage{specials}{7}{ukjent driver --} +\setinterfacemessage{specials}{6}{'nesting' er ikke tillatt} +\setinterfacemessage{specials}{title}{specials} +\setinterfacemessage{layouts}{1}{teksthøyde tilpasset med -- på side --} +\setinterfacemessage{layouts}{3}{-- ganger tekst forskjøvet} +\setinterfacemessage{layouts}{2}{-- ganger forskjøvet tekst plassert} +\setinterfacemessage{layouts}{5}{margblokker inaktive} +\setinterfacemessage{layouts}{4}{margblokker aktive} +\setinterfacemessage{layouts}{7}{beregner plass for logo} +\setinterfacemessage{layouts}{6}{delside sett -- behandlet (størrelse --)} +\setinterfacemessage{layouts}{9}{for øyeblikket maksimalt -- nivåer i opplisting} +\setinterfacemessage{layouts}{8}{beregner bakgrunn} +\setinterfacemessage{layouts}{title}{layout} +\setinterfacemessage{layouts}{11}{mellomrom -- ikke tillatt i gridmodus} +\setinterfacemessage{layouts}{10}{-- og -- er ikke 1.0 til sammen} +\setinterfacemessage{fonts}{1}{koding --} +\setinterfacemessage{fonts}{3}{ukjent variant --} +\setinterfacemessage{fonts}{2}{variant -- er lest inn} +\setinterfacemessage{fonts}{5}{stil -- er ikke definert} +\setinterfacemessage{fonts}{4}{hovedfont -- er ikke definert} +\setinterfacemessage{fonts}{7}{ukjent format --} +\setinterfacemessage{fonts}{6}{-- er lest inn} +\setinterfacemessage{fonts}{14}{bodyfont -- is defined (can better be done global)} +\setinterfacemessage{fonts}{8}{stil -- definert} +\setinterfacemessage{fonts}{title}{hovedfont} +\setinterfacemessage{fonts}{10}{ukjent fontfil --} +\setinterfacemessage{databases}{1}{--} +\setinterfacemessage{databases}{3}{global fil --} +\setinterfacemessage{databases}{2}{lokal fil --} +\setinterfacemessage{databases}{4}{ukjent fil --} +\setinterfacemessage{databases}{title}{databaser} +\setinterfacemessage{publications}{1}{file -- not found, unknown style ignored} +\setinterfacemessage{publications}{3}{wrote a new auxiliary file \jobname.aux} +\setinterfacemessage{publications}{title}{publications} +\setinterfacemessage{publications}{2}{file -- not found, waiting for bibtex} +\setinterfacemessage{publications}{4}{loading database from --} +\setinterfacemessage{publications}{5}{warning: cite argument -- on line \the\inputlineno} +\setinterfacemessage{publications}{6}{loading formatting style from --} +\setinterfacemessage{javascript}{1}{leser inn scriptsett --} +\setinterfacemessage{javascript}{title}{javascript} +\setinterfacemessage{javascript}{2}{ukjent 'preamble' --} +\setinterfacemessage{check}{1}{manglende '=' etter '--' i linje --} +\setinterfacemessage{check}{3}{-- -- overskygger en makro, bruk STORE BOKSTAVER!} +\setinterfacemessage{check}{2}{-- argument forventet i linje --} +\setinterfacemessage{check}{title}{kontroll} +\setinterfacemessage{metapost}{1}{metapost bibliotek -- blir lest inn} +\setinterfacemessage{metapost}{title}{metapost} +\setinterfacemessage{figures}{1}{figure -- can not be found} +\setinterfacemessage{figures}{3}{dimensions of -- are determined externally} +\setinterfacemessage{figures}{2}{figure -- is not preset} +\setinterfacemessage{figures}{5}{dimensions of -- are unknown} +\setinterfacemessage{figures}{4}{dimensions of -- loaded from figurefile itself} +\setinterfacemessage{figures}{6}{dimensions of -- calculated by rlxtools} +\setinterfacemessage{figures}{8}{figureobject -- is reused} +\setinterfacemessage{figures}{title}{figures} +\setinterfacemessage{colors}{1}{system -- er aktivert globalt} +\setinterfacemessage{colors}{3}{-- er udefinert --} +\setinterfacemessage{colors}{2}{system -- er aktivert lokalt} +\setinterfacemessage{colors}{5}{ukjent system --} +\setinterfacemessage{colors}{4}{system -- er lest inn} +\setinterfacemessage{colors}{7}{palett -- er ikke tilgjengelig} +\setinterfacemessage{colors}{6}{palett -- er tilgjengelig} +\setinterfacemessage{colors}{9}{-- fargerom er ikke støttet} +\setinterfacemessage{colors}{8}{spesifikasjon -- for farge -- gir kun svart} +\setinterfacemessage{colors}{title}{farge} +\setinterfacemessage{colors}{12}{-- is registered} +\setinterfacemessage{colors}{11}{fargen vil bli vist som grø} +\setinterfacemessage{colors}{10}{-- fargerom er støttet} +% +\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-mno.tex b/Master/texmf-dist/tex/context/base/mult-mno.tex deleted file mode 100644 index ee6fd3273ec..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-mno.tex +++ /dev/null @@ -1,208 +0,0 @@ -\setinterfacemessage{references}{1}{ukjent referanse --} -\setinterfacemessage{references}{3}{ukjent referansetype --} -\setinterfacemessage{references}{2}{duplikat referanse -- pø side --} -\setinterfacemessage{references}{4}{ulovlig referanse --} -\setinterfacemessage{references}{30}{ukjent objekt --} -\setinterfacemessage{references}{25}{references from document '--' are not imported (export again)} -\setinterfacemessage{references}{24}{references from document '--' are not exported} -\setinterfacemessage{references}{title}{referanser} -\setinterfacemessage{references}{26}{references from document '--' are imported} -\setinterfacemessage{references}{31}{duplikat objekt --} -\setinterfacemessage{references}{21}{dokument -- er lest inn} -\setinterfacemessage{references}{22}{dokument -- er ikke interaktivt} -\setinterfacemessage{references}{23}{obskur referanse -- (Prefix=--)} -\setinterfacemessage{documents}{1}{sheet --} -\setinterfacemessage{documents}{title}{sheets} -\setinterfacemessage{documents}{2}{number --} -\setinterfacemessage{handlings}{1}{font handling --} -\setinterfacemessage{handlings}{3}{unknown font handling --} -\setinterfacemessage{handlings}{2}{font handling -- is loaded} -\setinterfacemessage{handlings}{title}{handling} -\setinterfacemessage{systems}{title}{system} -\setinterfacemessage{systems}{41}{ekstern fil -- i gruppe -- eksisterer ikke} -\setinterfacemessage{systems}{9}{-- ikke funnet/behandlet} -\setinterfacemessage{systems}{91}{papertray --} -\setinterfacemessage{systems}{8}{ny versjon av hjelpefil, andre gjennomkjøring nødvendig} -\setinterfacemessage{systems}{21}{hjelpefila er ikke lest inn} -\setinterfacemessage{systems}{20}{betydning (sorterer) av -- er lest inn} -\setinterfacemessage{systems}{5}{makroene i modul -- er lest inn} -\setinterfacemessage{systems}{4}{kommando -- er allerede definert} -\setinterfacemessage{systems}{27}{Versjon} -\setinterfacemessage{systems}{26}{Registere} -\setinterfacemessage{systems}{25}{Referanser} -\setinterfacemessage{systems}{24}{Flytblokker} -\setinterfacemessage{systems}{1}{innlesning av hjelpefila utsatt (typemode)} -\setinterfacemessage{systems}{23}{-- arrangert på --} -\setinterfacemessage{systems}{22}{bruk en gyldig hjelpefil} -\setinterfacemessage{systems}{2}{-- er lest inn} -\setinterfacemessage{systems}{19}{betydning (synonymer) av -- er lest inn} -\setinterfacemessage{systems}{18}{synonym -- -- eksisterer ikke} -\setinterfacemessage{systems}{7}{makroene i modul -- er allerede lest inn} -\setinterfacemessage{systems}{6}{ingen makroer funnet i modul ---} -\setinterfacemessage{systems}{14}{tvunget sideskift i liste ved --} -\setinterfacemessage{systems}{15}{lagrer Buffer --} -\setinterfacemessage{systems}{16}{tegnsetter buffer --} -\setinterfacemessage{systems}{17}{tegnsetter verbatim-buffer --} -\setinterfacemessage{systems}{13}{markering -- definert --} -\setinterfacemessage{systems}{12}{hjelpefila er ikke sortert, bruk texutil} -\setinterfacemessage{systems}{11}{lager enkel hjelpefil} -\setinterfacemessage{systems}{10}{ikke bruk em i --} -\setinterfacemessage{floatblocks}{1}{-- renummerert / -- => --} -\setinterfacemessage{floatblocks}{3}{-- flyttet} -\setinterfacemessage{floatblocks}{2}{-- lagret} -\setinterfacemessage{floatblocks}{5}{rekkefølge tilpasset} -\setinterfacemessage{floatblocks}{4}{-- plassert} -\setinterfacemessage{floatblocks}{7}{maksimalt -- flytblokker nederst} -\setinterfacemessage{floatblocks}{6}{maksimalt -- flytblokker øverst} -\setinterfacemessage{floatblocks}{9}{rekkefølge endret} -\setinterfacemessage{floatblocks}{8}{mindre enn -- linjer} -\setinterfacemessage{floatblocks}{title}{flytblokker} -\setinterfacemessage{floatblocks}{13}{there is nothing to split} -\setinterfacemessage{floatblocks}{12}{udefinert} -\setinterfacemessage{floatblocks}{11}{ingen blokk oppgitt} -\setinterfacemessage{floatblocks}{10}{-- begrenset} -\setinterfacemessage{interactions}{1}{forholdstall -- x -- (b x h)} -\setinterfacemessage{interactions}{3}{inaktiv} -\setinterfacemessage{interactions}{2}{aktiv} -\setinterfacemessage{interactions}{5}{unknown attachment --} -\setinterfacemessage{interactions}{4}{ingen sidesynkronisering (--) i hmode} -\setinterfacemessage{interactions}{6}{attachment file -- does not exist} -\setinterfacemessage{interactions}{title}{interaksjon} -\setinterfacemessage{interactions}{21}{-- kode satt inn / tilføyd} -\setinterfacemessage{regimes}{1}{koding --} -\setinterfacemessage{regimes}{3}{ukjent koding --} -\setinterfacemessage{regimes}{2}{koding -- er lest inn} -\setinterfacemessage{regimes}{title}{koding} -\setinterfacemessage{structures}{1}{starten av blokk -- (seksjon)} -\setinterfacemessage{structures}{title}{struktur} -\setinterfacemessage{structures}{2}{slutten av blokk -- (seksjon)} -\setinterfacemessage{linguals}{1}{orddelingsmønster -- for -- er lest inn (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{3}{orddelingsdefinisjon -- for -- er lest inn (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{2}{ingen orddelingsmønster -- for -- (n=--,e=--,m=--) (--,--)} -\setinterfacemessage{linguals}{5}{orddelingsmønster for -- er ikke lest inn} -\setinterfacemessage{linguals}{4}{ingen orddelingsdefinisjon -- for -- (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{7}{spràk spesifikk opsjon [--] introduserer et -- hopp} -\setinterfacemessage{linguals}{6}{spràk -- er udefinert} -\setinterfacemessage{linguals}{9}{spràk -- er aktivt} -\setinterfacemessage{linguals}{8}{spràk spesifikk opsjon [--] problemfritt tilføyd} -\setinterfacemessage{linguals}{title}{sprøk} -\setinterfacemessage{linguals}{10}{orddelingsmønster -- er lest inn} -\setinterfacemessage{verbatims}{1}{fil -- eksisterer ikke} -\setinterfacemessage{verbatims}{title}{verbatim} -\setinterfacemessage{filters}{1}{filter -- is loaded} -\setinterfacemessage{filters}{title}{filter} -\setinterfacemessage{filters}{2}{unknown filter --} -\setinterfacemessage{textblocks}{1}{ny versjon, andre gjennomkjøring nødvendig} -\setinterfacemessage{textblocks}{3}{leser blokker fra --} -\setinterfacemessage{textblocks}{2}{skriver blokker til --} -\setinterfacemessage{textblocks}{5}{-- ikke skjult} -\setinterfacemessage{textblocks}{4}{andre gjennomkjøring nødvendig} -\setinterfacemessage{textblocks}{7}{-- skjult} -\setinterfacemessage{textblocks}{6}{-- skjult og behandlet} -\setinterfacemessage{textblocks}{9}{-- ikke tegnsatt} -\setinterfacemessage{textblocks}{8}{-- tegnsatt} -\setinterfacemessage{textblocks}{title}{tekstblokker} -\setinterfacemessage{textblocks}{12}{-- utelatt} -\setinterfacemessage{textblocks}{11}{-- lest inn og tegnsatt} -\setinterfacemessage{textblocks}{10}{-- lest inn og behandlet} -\setinterfacemessage{encodings}{1}{koding --} -\setinterfacemessage{encodings}{3}{ukjent koding --} -\setinterfacemessage{encodings}{2}{koding -- er lest inn} -\setinterfacemessage{encodings}{title}{koding} -\setinterfacemessage{columns}{1}{maksimalt -- kolonner} -\setinterfacemessage{columns}{3}{problemer, slår av balansering} -\setinterfacemessage{columns}{2}{bruk \string\filbreak\space som et alternativ} -\setinterfacemessage{columns}{5}{flytblokker nedert er ikke støttet enda} -\setinterfacemessage{columns}{4}{flytblokker øverst er ikke støttet enda} -\setinterfacemessage{columns}{7}{balansering avbrutt etter 100 iterasjoner} -\setinterfacemessage{columns}{6}{-- flytblokk forskjøvet} -\setinterfacemessage{columns}{9}{kontroller tekstlayout!} -\setinterfacemessage{columns}{8}{balansert etter -- iterasjoner} -\setinterfacemessage{columns}{title}{kolonner} -\setinterfacemessage{columns}{13}{bred flytblokk forksjøvet til toppen av kolonnene} -\setinterfacemessage{columns}{12}{flytblokk forskjøvet til neste kolonne / --} -\setinterfacemessage{columns}{11}{flytblokk for bredt for kolonna} -\setinterfacemessage{columns}{10}{(mindre enn) 1 linje igjen} -\setinterfacemessage{symbols}{1}{leser inn symbolsett --} -\setinterfacemessage{symbols}{title}{symboler} -\setinterfacemessage{files}{1}{filesynonym -- er allerede brukt for --} -\setinterfacemessage{files}{title}{filer} -\setinterfacemessage{versions}{1}{manglende @+} -\setinterfacemessage{versions}{3}{valgte sider: --} -\setinterfacemessage{versions}{2}{markerer sider} -\setinterfacemessage{versions}{title}{versjon} -\setinterfacemessage{specials}{1}{-- er lest inn} -\setinterfacemessage{specials}{3}{-- er tilbakestilt} -\setinterfacemessage{specials}{2}{dypere 'nesting' er ikke tillatt --} -\setinterfacemessage{specials}{5}{leser inn definisjonsfil for --} -\setinterfacemessage{specials}{4}{kommando -- eksisterer ikke} -\setinterfacemessage{specials}{7}{ukjent driver --} -\setinterfacemessage{specials}{6}{'nesting' er ikke tillatt} -\setinterfacemessage{specials}{title}{specials} -\setinterfacemessage{layouts}{1}{teksthøyde tilpasset med -- på side --} -\setinterfacemessage{layouts}{3}{-- ganger tekst forskjøvet} -\setinterfacemessage{layouts}{2}{-- ganger forskjøvet tekst plassert} -\setinterfacemessage{layouts}{5}{margblokker inaktive} -\setinterfacemessage{layouts}{4}{margblokker aktive} -\setinterfacemessage{layouts}{7}{beregner plass for logo} -\setinterfacemessage{layouts}{6}{delside sett -- behandlet (størrelse --)} -\setinterfacemessage{layouts}{9}{for øyeblikket maksimalt -- nivåer i opplisting} -\setinterfacemessage{layouts}{8}{beregner bakgrunn} -\setinterfacemessage{layouts}{title}{layout} -\setinterfacemessage{layouts}{11}{mellomrom -- ikke tillatt i gridmodus} -\setinterfacemessage{layouts}{10}{-- og -- er ikke 1.0 til sammen} -\setinterfacemessage{fonts}{1}{koding --} -\setinterfacemessage{fonts}{3}{ukjent variant --} -\setinterfacemessage{fonts}{2}{variant -- er lest inn} -\setinterfacemessage{fonts}{5}{stil -- er ikke definert} -\setinterfacemessage{fonts}{4}{hovedfont -- er ikke definert} -\setinterfacemessage{fonts}{7}{ukjent format --} -\setinterfacemessage{fonts}{6}{-- er lest inn} -\setinterfacemessage{fonts}{14}{bodyfont -- is defined (can better be done global)} -\setinterfacemessage{fonts}{8}{stil -- definert} -\setinterfacemessage{fonts}{title}{hovedfont} -\setinterfacemessage{fonts}{10}{ukjent fontfil --} -\setinterfacemessage{databases}{1}{--} -\setinterfacemessage{databases}{3}{global fil --} -\setinterfacemessage{databases}{2}{lokal fil --} -\setinterfacemessage{databases}{4}{ukjent fil --} -\setinterfacemessage{databases}{title}{databaser} -\setinterfacemessage{publications}{1}{file -- not found, unknown style ignored} -\setinterfacemessage{publications}{3}{wrote a new auxiliary file \jobname.aux} -\setinterfacemessage{publications}{title}{publications} -\setinterfacemessage{publications}{2}{file -- not found, waiting for bibtex} -\setinterfacemessage{publications}{4}{loading database from --} -\setinterfacemessage{publications}{5}{warning: cite argument -- on line \the\inputlineno} -\setinterfacemessage{publications}{6}{loading formatting style from --} -\setinterfacemessage{javascript}{1}{leser inn scriptsett --} -\setinterfacemessage{javascript}{title}{javascript} -\setinterfacemessage{javascript}{2}{ukjent 'preamble' --} -\setinterfacemessage{check}{1}{manglende '=' etter '--' i linje --} -\setinterfacemessage{check}{3}{-- -- overskygger en makro, bruk STORE BOKSTAVER!} -\setinterfacemessage{check}{2}{-- argument forventet i linje --} -\setinterfacemessage{check}{title}{kontroll} -\setinterfacemessage{metapost}{1}{metapost bibliotek -- blir lest inn} -\setinterfacemessage{metapost}{title}{metapost} -\setinterfacemessage{figures}{1}{figure -- can not be found} -\setinterfacemessage{figures}{3}{dimensions of -- are determined externally} -\setinterfacemessage{figures}{2}{figure -- is not preset} -\setinterfacemessage{figures}{5}{dimensions of -- are unknown} -\setinterfacemessage{figures}{4}{dimensions of -- loaded from figurefile itself} -\setinterfacemessage{figures}{6}{dimensions of -- calculated by rlxtools} -\setinterfacemessage{figures}{8}{figureobject -- is reused} -\setinterfacemessage{figures}{title}{figures} -\setinterfacemessage{colors}{1}{system -- er aktivert globalt} -\setinterfacemessage{colors}{3}{-- er udefinert --} -\setinterfacemessage{colors}{2}{system -- er aktivert lokalt} -\setinterfacemessage{colors}{5}{ukjent system --} -\setinterfacemessage{colors}{4}{system -- er lest inn} -\setinterfacemessage{colors}{7}{palett -- er ikke tilgjengelig} -\setinterfacemessage{colors}{6}{palett -- er tilgjengelig} -\setinterfacemessage{colors}{9}{-- fargerom er ikke støttet} -\setinterfacemessage{colors}{8}{spesifikasjon -- for farge -- gir kun svart} -\setinterfacemessage{colors}{title}{farge} -\setinterfacemessage{colors}{12}{-- is registered} -\setinterfacemessage{colors}{11}{fargen vil bli vist som grø} -\setinterfacemessage{colors}{10}{-- fargerom er støttet} -% -\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-mpe.mkii b/Master/texmf-dist/tex/context/base/mult-mpe.mkii new file mode 100644 index 00000000000..a8d42935602 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-mpe.mkii @@ -0,0 +1,210 @@ +\setinterfacemessage{references}{1}{unknown reference --} +\setinterfacemessage{references}{30}{unknown object --} +\setinterfacemessage{references}{3}{unknown reference type --} +\setinterfacemessage{references}{2}{duplicate reference -- on page --} +\setinterfacemessage{references}{5}{number of unknown references: --} +\setinterfacemessage{references}{4}{illegal reference --} +\setinterfacemessage{references}{6}{number of illegal references: --} +\setinterfacemessage{references}{25}{references from document '--' are not imported (export again)} +\setinterfacemessage{references}{24}{references from document '--' are not exported} +\setinterfacemessage{references}{title}{references} +\setinterfacemessage{references}{26}{references from document '--' are imported} +\setinterfacemessage{references}{31}{duplicate object --} +\setinterfacemessage{references}{21}{document -- loaded} +\setinterfacemessage{references}{22}{document -- is not interactive} +\setinterfacemessage{references}{23}{obscure reference -- (prefix=--)} +\setinterfacemessage{documents}{1}{sheet --} +\setinterfacemessage{documents}{title}{sheets} +\setinterfacemessage{documents}{2}{number --} +\setinterfacemessage{handlings}{1}{font handling --} +\setinterfacemessage{handlings}{3}{unknown font handling --} +\setinterfacemessage{handlings}{2}{font handling -- is loaded} +\setinterfacemessage{handlings}{title}{handling} +\setinterfacemessage{systems}{title}{system} +\setinterfacemessage{systems}{41}{external file -- in group -- does not exist} +\setinterfacemessage{systems}{9}{-- not found/processed} +\setinterfacemessage{systems}{91}{papertray --} +\setinterfacemessage{systems}{8}{new version of utility file, second pass needed} +\setinterfacemessage{systems}{21}{no utility data is loaded} +\setinterfacemessage{systems}{20}{meaning (sorts) of -- loaded} +\setinterfacemessage{systems}{5}{module -- loaded} +\setinterfacemessage{systems}{4}{command -- is already defined} +\setinterfacemessage{systems}{27}{Version} +\setinterfacemessage{systems}{26}{Registers} +\setinterfacemessage{systems}{25}{References} +\setinterfacemessage{systems}{24}{Floatblocks} +\setinterfacemessage{systems}{1}{loading utility-file postponed (typemode)} +\setinterfacemessage{systems}{23}{-- arranged at --} +\setinterfacemessage{systems}{22}{use a valid utilityfile} +\setinterfacemessage{systems}{2}{-- loaded} +\setinterfacemessage{systems}{19}{meaning (synonyms) of -- loaded} +\setinterfacemessage{systems}{18}{synonym -- -- does not exist} +\setinterfacemessage{systems}{7}{module -- already loaded} +\setinterfacemessage{systems}{6}{module -- not found} +\setinterfacemessage{systems}{14}{forced newpage in list at --} +\setinterfacemessage{systems}{15}{saving buffer --} +\setinterfacemessage{systems}{16}{typesetting buffer --} +\setinterfacemessage{systems}{17}{typesetting verbatim buffer --} +\setinterfacemessage{systems}{13}{mark -- defined --} +\setinterfacemessage{systems}{12}{the utility-file is not sorted, use texutil} +\setinterfacemessage{systems}{11}{building simple util} +\setinterfacemessage{systems}{10}{don't use em in --} +\setinterfacemessage{floatblocks}{1}{-- renumbered / -- => --} +\setinterfacemessage{floatblocks}{3}{-- moved} +\setinterfacemessage{floatblocks}{2}{-- saved} +\setinterfacemessage{floatblocks}{5}{order adapted} +\setinterfacemessage{floatblocks}{4}{-- placed} +\setinterfacemessage{floatblocks}{7}{n of bottom floats limited to --} +\setinterfacemessage{floatblocks}{6}{n of top floats limited to --} +\setinterfacemessage{floatblocks}{9}{order disturbed} +\setinterfacemessage{floatblocks}{8}{less than -- lines} +\setinterfacemessage{floatblocks}{title}{floatblocks} +\setinterfacemessage{floatblocks}{13}{there is nothing to split} +\setinterfacemessage{floatblocks}{12}{undefined} +\setinterfacemessage{floatblocks}{11}{no block given} +\setinterfacemessage{floatblocks}{10}{-- limited} +\setinterfacemessage{interactions}{1}{aspect ratio -- x -- (b x h)} +\setinterfacemessage{interactions}{3}{inactive} +\setinterfacemessage{interactions}{2}{active} +\setinterfacemessage{interactions}{5}{unknown attachment --} +\setinterfacemessage{interactions}{4}{no pagesynchronisation (--) in hmode} +\setinterfacemessage{interactions}{6}{attachment file -- does not exist} +\setinterfacemessage{interactions}{title}{interaction} +\setinterfacemessage{interactions}{21}{-- code inserted} +\setinterfacemessage{regimes}{1}{regime --} +\setinterfacemessage{regimes}{3}{unknown regime --} +\setinterfacemessage{regimes}{2}{regime -- is loaded} +\setinterfacemessage{regimes}{title}{regime} +\setinterfacemessage{structures}{1}{begin of sectionblock --} +\setinterfacemessage{structures}{title}{structure} +\setinterfacemessage{structures}{2}{end of sectionblock --} +\setinterfacemessage{linguals}{1}{patterns -- for -- loaded (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{3}{hyphenations -- for -- loaded (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{2}{no patterns -- for -- (n=--,e=--,m=--) (--,--)} +\setinterfacemessage{linguals}{5}{patterns for -- not loaded} +\setinterfacemessage{linguals}{4}{no hyphenations -- for -- (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{7}{language specific options [--] introduce a -- skip} +\setinterfacemessage{linguals}{6}{language -- is undefined} +\setinterfacemessage{linguals}{9}{language -- is active} +\setinterfacemessage{linguals}{8}{language specific options [--] seamless appended} +\setinterfacemessage{linguals}{title}{language} +\setinterfacemessage{linguals}{10}{patterns -- loaded} +\setinterfacemessage{verbatims}{1}{file -- does not exist} +\setinterfacemessage{verbatims}{title}{verbatim} +\setinterfacemessage{filters}{1}{filter -- is loaded} +\setinterfacemessage{filters}{title}{filter} +\setinterfacemessage{filters}{2}{unknown filter --} +\setinterfacemessage{textblocks}{1}{new version, second pass needed} +\setinterfacemessage{textblocks}{3}{reading blocks from --} +\setinterfacemessage{textblocks}{2}{writing blocks to --} +\setinterfacemessage{textblocks}{5}{-- not hidden} +\setinterfacemessage{textblocks}{4}{second pass needed} +\setinterfacemessage{textblocks}{7}{-- hidden} +\setinterfacemessage{textblocks}{6}{-- hidden and processed} +\setinterfacemessage{textblocks}{9}{-- not typeset} +\setinterfacemessage{textblocks}{8}{-- typeset} +\setinterfacemessage{textblocks}{title}{textblocks} +\setinterfacemessage{textblocks}{12}{-- skipped} +\setinterfacemessage{textblocks}{11}{-- loaded and typeset} +\setinterfacemessage{textblocks}{10}{-- loaded and processed} +\setinterfacemessage{encodings}{1}{coding --} +\setinterfacemessage{encodings}{3}{unknown coding --} +\setinterfacemessage{encodings}{2}{coding -- is loaded} +\setinterfacemessage{encodings}{title}{encoding} +\setinterfacemessage{columns}{1}{only -- columns possible} +\setinterfacemessage{columns}{3}{problems, disable balancing} +\setinterfacemessage{columns}{2}{use \string\filbreak\space as alternative} +\setinterfacemessage{columns}{5}{bottom float not yet supported} +\setinterfacemessage{columns}{4}{top float not yet supported} +\setinterfacemessage{columns}{7}{balancing aborted after 100 steps} +\setinterfacemessage{columns}{6}{-- float(s) postponed} +\setinterfacemessage{columns}{9}{check raggedness} +\setinterfacemessage{columns}{8}{balanced in -- step(s)} +\setinterfacemessage{columns}{title}{columns} +\setinterfacemessage{columns}{13}{wide float moved to top of columns} +\setinterfacemessage{columns}{12}{float moved to next column / --} +\setinterfacemessage{columns}{11}{float too wide for column} +\setinterfacemessage{columns}{10}{(less than) 1 line left} +\setinterfacemessage{symbols}{1}{loading symbolset --} +\setinterfacemessage{symbols}{title}{symbols} +\setinterfacemessage{files}{1}{file synonym -- is already used for --} +\setinterfacemessage{files}{title}{files} +\setinterfacemessage{versions}{1}{missing @+} +\setinterfacemessage{versions}{3}{selected pages: --} +\setinterfacemessage{versions}{2}{marking pages} +\setinterfacemessage{versions}{title}{version} +\setinterfacemessage{specials}{1}{-- loaded} +\setinterfacemessage{specials}{3}{-- is reset} +\setinterfacemessage{specials}{2}{no deeper nesting is permitted --} +\setinterfacemessage{specials}{5}{loading definition file --} +\setinterfacemessage{specials}{4}{command -- does not exist} +\setinterfacemessage{specials}{7}{unknown driver --} +\setinterfacemessage{specials}{6}{nesting is not permitted} +\setinterfacemessage{specials}{title}{specials} +\setinterfacemessage{layouts}{1}{textheight adapted with -- at page --} +\setinterfacemessage{layouts}{3}{-- times text postponed} +\setinterfacemessage{layouts}{2}{-- times postponed text placed} +\setinterfacemessage{layouts}{5}{marginblocks inactive} +\setinterfacemessage{layouts}{4}{marginblocks active} +\setinterfacemessage{layouts}{7}{calculating logospace} +\setinterfacemessage{layouts}{6}{subpage set -- processed (size --)} +\setinterfacemessage{layouts}{9}{currently no more than -- levels in itemizations} +\setinterfacemessage{layouts}{8}{calculating backgrounds} +\setinterfacemessage{layouts}{title}{layout} +\setinterfacemessage{layouts}{11}{spacing -- not permitted in gridmode} +\setinterfacemessage{layouts}{10}{-- and -- don't add up to 1.0} +\setinterfacemessage{fonts}{1}{coding --} +\setinterfacemessage{fonts}{3}{unknown variant --} +\setinterfacemessage{fonts}{2}{variant -- is loaded} +\setinterfacemessage{fonts}{5}{style -- is not defined} +\setinterfacemessage{fonts}{4}{bodyfont -- is not defined} +\setinterfacemessage{fonts}{7}{unknown format --} +\setinterfacemessage{fonts}{6}{-- is loaded} +\setinterfacemessage{fonts}{14}{bodyfont -- is defined (can better be done global)} +\setinterfacemessage{fonts}{8}{style -- defined} +\setinterfacemessage{fonts}{title}{bodyfont} +\setinterfacemessage{fonts}{10}{unknown font file --} +\setinterfacemessage{databases}{1}{--} +\setinterfacemessage{databases}{3}{global file --} +\setinterfacemessage{databases}{2}{local file --} +\setinterfacemessage{databases}{4}{unknown file --} +\setinterfacemessage{databases}{title}{databases} +\setinterfacemessage{publications}{1}{file -- not found, unknown style ignored} +\setinterfacemessage{publications}{3}{wrote a new auxiliary file \jobname.aux} +\setinterfacemessage{publications}{title}{publications} +\setinterfacemessage{publications}{2}{file -- not found, waiting for bibtex} +\setinterfacemessage{publications}{4}{loading database from --} +\setinterfacemessage{publications}{5}{warning: cite argument -- on line \the\inputlineno} +\setinterfacemessage{publications}{6}{loading formatting style from --} +\setinterfacemessage{javascript}{1}{loading script set --} +\setinterfacemessage{javascript}{title}{javascript} +\setinterfacemessage{javascript}{2}{unknown preamble --} +\setinterfacemessage{check}{1}{missing or ungrouped '=' after '--' in line --} +\setinterfacemessage{check}{3}{-- -- replaces a macro, use CAPITALS!} +\setinterfacemessage{check}{2}{-- argument(s) expected in line --} +\setinterfacemessage{check}{title}{check} +\setinterfacemessage{metapost}{1}{loading metapost library --} +\setinterfacemessage{metapost}{title}{metapost} +\setinterfacemessage{figures}{1}{figure -- can not be found} +\setinterfacemessage{figures}{3}{dimensions of -- are determined externally} +\setinterfacemessage{figures}{2}{figure -- is not preset} +\setinterfacemessage{figures}{5}{dimensions of -- are unknown} +\setinterfacemessage{figures}{4}{dimensions of -- loaded from figurefile itself} +\setinterfacemessage{figures}{6}{dimensions of -- calculated by rlxtools} +\setinterfacemessage{figures}{8}{figureobject -- is reused} +\setinterfacemessage{figures}{title}{figures} +\setinterfacemessage{colors}{1}{system -- is global activated} +\setinterfacemessage{colors}{3}{-- is not defined --} +\setinterfacemessage{colors}{2}{system -- is local activated} +\setinterfacemessage{colors}{5}{unknown system --} +\setinterfacemessage{colors}{4}{system -- is loaded} +\setinterfacemessage{colors}{7}{palette -- is not available} +\setinterfacemessage{colors}{6}{palette -- is available} +\setinterfacemessage{colors}{9}{-- color space is not supported} +\setinterfacemessage{colors}{8}{specification -- at color -- becomes black} +\setinterfacemessage{colors}{title}{color} +\setinterfacemessage{colors}{12}{-- is registered} +\setinterfacemessage{colors}{11}{color is converted to gray} +\setinterfacemessage{colors}{10}{-- color space is supported} +% +\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-mpe.tex b/Master/texmf-dist/tex/context/base/mult-mpe.tex deleted file mode 100644 index 4c1bc99420a..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-mpe.tex +++ /dev/null @@ -1,208 +0,0 @@ -\setinterfacemessage{references}{1}{unknown reference --} -\setinterfacemessage{references}{3}{unknown reference type --} -\setinterfacemessage{references}{2}{duplicate reference -- on page --} -\setinterfacemessage{references}{4}{illegal reference --} -\setinterfacemessage{references}{30}{unknown object --} -\setinterfacemessage{references}{25}{references from document '--' are not imported (export again)} -\setinterfacemessage{references}{24}{references from document '--' are not exported} -\setinterfacemessage{references}{title}{references} -\setinterfacemessage{references}{26}{references from document '--' are imported} -\setinterfacemessage{references}{31}{duplicate object --} -\setinterfacemessage{references}{21}{document -- loaded} -\setinterfacemessage{references}{22}{document -- is not interactive} -\setinterfacemessage{references}{23}{obscure reference -- (prefix=--)} -\setinterfacemessage{documents}{1}{sheet --} -\setinterfacemessage{documents}{title}{sheets} -\setinterfacemessage{documents}{2}{number --} -\setinterfacemessage{handlings}{1}{font handling --} -\setinterfacemessage{handlings}{3}{unknown font handling --} -\setinterfacemessage{handlings}{2}{font handling -- is loaded} -\setinterfacemessage{handlings}{title}{handling} -\setinterfacemessage{systems}{title}{system} -\setinterfacemessage{systems}{41}{external file -- in group -- does not exist} -\setinterfacemessage{systems}{9}{-- not found/processed} -\setinterfacemessage{systems}{91}{papertray --} -\setinterfacemessage{systems}{8}{new version of utility file, second pass needed} -\setinterfacemessage{systems}{21}{no utility data is loaded} -\setinterfacemessage{systems}{20}{meaning (sorts) of -- loaded} -\setinterfacemessage{systems}{5}{module -- loaded} -\setinterfacemessage{systems}{4}{command -- is already defined} -\setinterfacemessage{systems}{27}{Version} -\setinterfacemessage{systems}{26}{Registers} -\setinterfacemessage{systems}{25}{References} -\setinterfacemessage{systems}{24}{Floatblocks} -\setinterfacemessage{systems}{1}{loading utility-file postponed (typemode)} -\setinterfacemessage{systems}{23}{-- arranged at --} -\setinterfacemessage{systems}{22}{use a valid utilityfile} -\setinterfacemessage{systems}{2}{-- loaded} -\setinterfacemessage{systems}{19}{meaning (synonyms) of -- loaded} -\setinterfacemessage{systems}{18}{synonym -- -- does not exist} -\setinterfacemessage{systems}{7}{module -- already loaded} -\setinterfacemessage{systems}{6}{module -- not found} -\setinterfacemessage{systems}{14}{forced newpage in list at --} -\setinterfacemessage{systems}{15}{saving buffer --} -\setinterfacemessage{systems}{16}{typesetting buffer --} -\setinterfacemessage{systems}{17}{typesetting verbatim buffer --} -\setinterfacemessage{systems}{13}{mark -- defined --} -\setinterfacemessage{systems}{12}{the utility-file is not sorted, use texutil} -\setinterfacemessage{systems}{11}{building simple util} -\setinterfacemessage{systems}{10}{don't use em in --} -\setinterfacemessage{floatblocks}{1}{-- renumbered / -- => --} -\setinterfacemessage{floatblocks}{3}{-- moved} -\setinterfacemessage{floatblocks}{2}{-- saved} -\setinterfacemessage{floatblocks}{5}{order adapted} -\setinterfacemessage{floatblocks}{4}{-- placed} -\setinterfacemessage{floatblocks}{7}{n of bottom floats limited to --} -\setinterfacemessage{floatblocks}{6}{n of top floats limited to --} -\setinterfacemessage{floatblocks}{9}{order disturbed} -\setinterfacemessage{floatblocks}{8}{less than -- lines} -\setinterfacemessage{floatblocks}{title}{floatblocks} -\setinterfacemessage{floatblocks}{13}{there is nothing to split} -\setinterfacemessage{floatblocks}{12}{undefined} -\setinterfacemessage{floatblocks}{11}{no block given} -\setinterfacemessage{floatblocks}{10}{-- limited} -\setinterfacemessage{interactions}{1}{aspect ratio -- x -- (b x h)} -\setinterfacemessage{interactions}{3}{inactive} -\setinterfacemessage{interactions}{2}{active} -\setinterfacemessage{interactions}{5}{unknown attachment --} -\setinterfacemessage{interactions}{4}{no pagesynchronisation (--) in hmode} -\setinterfacemessage{interactions}{6}{attachment file -- does not exist} -\setinterfacemessage{interactions}{title}{interaction} -\setinterfacemessage{interactions}{21}{-- code inserted} -\setinterfacemessage{regimes}{1}{regime --} -\setinterfacemessage{regimes}{3}{unknown regime --} -\setinterfacemessage{regimes}{2}{regime -- is loaded} -\setinterfacemessage{regimes}{title}{regime} -\setinterfacemessage{structures}{1}{begin of sectionblock --} -\setinterfacemessage{structures}{title}{structure} -\setinterfacemessage{structures}{2}{end of sectionblock --} -\setinterfacemessage{linguals}{1}{patterns -- for -- loaded (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{3}{hyphenations -- for -- loaded (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{2}{no patterns -- for -- (n=--,e=--,m=--) (--,--)} -\setinterfacemessage{linguals}{5}{patterns for -- not loaded} -\setinterfacemessage{linguals}{4}{no hyphenations -- for -- (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{7}{language specific options [--] introduce a -- skip} -\setinterfacemessage{linguals}{6}{language -- is undefined} -\setinterfacemessage{linguals}{9}{language -- is active} -\setinterfacemessage{linguals}{8}{language specific options [--] seamless appended} -\setinterfacemessage{linguals}{title}{language} -\setinterfacemessage{linguals}{10}{patterns --loaded} -\setinterfacemessage{verbatims}{1}{file -- does not exist} -\setinterfacemessage{verbatims}{title}{verbatim} -\setinterfacemessage{filters}{1}{filter -- is loaded} -\setinterfacemessage{filters}{title}{filter} -\setinterfacemessage{filters}{2}{unknown filter --} -\setinterfacemessage{textblocks}{1}{new version, second pass needed} -\setinterfacemessage{textblocks}{3}{reading blocks from --} -\setinterfacemessage{textblocks}{2}{writing blocks to --} -\setinterfacemessage{textblocks}{5}{-- not hidden} -\setinterfacemessage{textblocks}{4}{second pass needed} -\setinterfacemessage{textblocks}{7}{-- hidden} -\setinterfacemessage{textblocks}{6}{-- hidden and processed} -\setinterfacemessage{textblocks}{9}{-- not typeset} -\setinterfacemessage{textblocks}{8}{-- typeset} -\setinterfacemessage{textblocks}{title}{textblocks} -\setinterfacemessage{textblocks}{12}{-- skipped} -\setinterfacemessage{textblocks}{11}{-- loaded and typeset} -\setinterfacemessage{textblocks}{10}{-- loaded and processed} -\setinterfacemessage{encodings}{1}{coding --} -\setinterfacemessage{encodings}{3}{unknown coding --} -\setinterfacemessage{encodings}{2}{coding -- is loaded} -\setinterfacemessage{encodings}{title}{encoding} -\setinterfacemessage{columns}{1}{only -- columns possible} -\setinterfacemessage{columns}{3}{problems, disable balancing} -\setinterfacemessage{columns}{2}{use \string\filbreak\space as alternative} -\setinterfacemessage{columns}{5}{bottom float not yet supported} -\setinterfacemessage{columns}{4}{top float not yet supported} -\setinterfacemessage{columns}{7}{balancing aborted after 100 steps} -\setinterfacemessage{columns}{6}{-- float(s) postponed} -\setinterfacemessage{columns}{9}{check raggedness} -\setinterfacemessage{columns}{8}{balanced in -- step(s)} -\setinterfacemessage{columns}{title}{columns} -\setinterfacemessage{columns}{13}{wide float moved to top of columns} -\setinterfacemessage{columns}{12}{float moved to next column / --} -\setinterfacemessage{columns}{11}{float too wide for column} -\setinterfacemessage{columns}{10}{(less than) 1 line left} -\setinterfacemessage{symbols}{1}{loading symbolset --} -\setinterfacemessage{symbols}{title}{symbols} -\setinterfacemessage{files}{1}{file synonym -- is already used for --} -\setinterfacemessage{files}{title}{files} -\setinterfacemessage{versions}{1}{missing @+} -\setinterfacemessage{versions}{3}{selected pages: --} -\setinterfacemessage{versions}{2}{marking pages} -\setinterfacemessage{versions}{title}{version} -\setinterfacemessage{specials}{1}{-- loaded} -\setinterfacemessage{specials}{3}{-- is reset} -\setinterfacemessage{specials}{2}{no deeper nesting is permitted --} -\setinterfacemessage{specials}{5}{loading definition file --} -\setinterfacemessage{specials}{4}{command -- does not exist} -\setinterfacemessage{specials}{7}{unknown driver --} -\setinterfacemessage{specials}{6}{nesting is not permitted} -\setinterfacemessage{specials}{title}{specials} -\setinterfacemessage{layouts}{1}{textheight adapted with -- at page --} -\setinterfacemessage{layouts}{3}{-- times text postponed} -\setinterfacemessage{layouts}{2}{-- times postponed text placed} -\setinterfacemessage{layouts}{5}{marginblocks inactive} -\setinterfacemessage{layouts}{4}{marginblocks active} -\setinterfacemessage{layouts}{7}{calculating logospace} -\setinterfacemessage{layouts}{6}{subpage set -- processed (size --)} -\setinterfacemessage{layouts}{9}{currently no more than -- levels in itemizations} -\setinterfacemessage{layouts}{8}{calculating backgrounds} -\setinterfacemessage{layouts}{title}{layout} -\setinterfacemessage{layouts}{11}{spacing -- not permitted in gridmode} -\setinterfacemessage{layouts}{10}{-- and -- don't add up to 1.0} -\setinterfacemessage{fonts}{1}{coding --} -\setinterfacemessage{fonts}{3}{unknown variant --} -\setinterfacemessage{fonts}{2}{variant -- is loaded} -\setinterfacemessage{fonts}{5}{style -- is not defined} -\setinterfacemessage{fonts}{4}{bodyfont -- is not defined} -\setinterfacemessage{fonts}{7}{unknown format --} -\setinterfacemessage{fonts}{6}{-- is loaded} -\setinterfacemessage{fonts}{14}{bodyfont -- is defined (can better be done global)} -\setinterfacemessage{fonts}{8}{style -- defined} -\setinterfacemessage{fonts}{title}{bodyfont} -\setinterfacemessage{fonts}{10}{unknown font file --} -\setinterfacemessage{databases}{1}{--} -\setinterfacemessage{databases}{3}{global file --} -\setinterfacemessage{databases}{2}{local file --} -\setinterfacemessage{databases}{4}{unknown file --} -\setinterfacemessage{databases}{title}{databases} -\setinterfacemessage{publications}{1}{file -- not found, unknown style ignored} -\setinterfacemessage{publications}{3}{wrote a new auxiliary file \jobname.aux} -\setinterfacemessage{publications}{title}{publications} -\setinterfacemessage{publications}{2}{file -- not found, waiting for bibtex} -\setinterfacemessage{publications}{4}{loading database from --} -\setinterfacemessage{publications}{5}{warning: cite argument -- on line \the\inputlineno} -\setinterfacemessage{publications}{6}{loading formatting style from --} -\setinterfacemessage{javascript}{1}{loading script set --} -\setinterfacemessage{javascript}{title}{javascript} -\setinterfacemessage{javascript}{2}{unknown preamble --} -\setinterfacemessage{check}{1}{missing or ungrouped '=' after '--' in line --} -\setinterfacemessage{check}{3}{-- -- replaces a macro, use CAPITALS!} -\setinterfacemessage{check}{2}{-- argument(s) expected in line --} -\setinterfacemessage{check}{title}{check} -\setinterfacemessage{metapost}{1}{loading metapost library --} -\setinterfacemessage{metapost}{title}{metapost} -\setinterfacemessage{figures}{1}{figure -- can not be found} -\setinterfacemessage{figures}{3}{dimensions of -- are determined externally} -\setinterfacemessage{figures}{2}{figure -- is not preset} -\setinterfacemessage{figures}{5}{dimensions of -- are unknown} -\setinterfacemessage{figures}{4}{dimensions of -- loaded from figurefile itself} -\setinterfacemessage{figures}{6}{dimensions of -- calculated by rlxtools} -\setinterfacemessage{figures}{8}{figureobject -- is reused} -\setinterfacemessage{figures}{title}{figures} -\setinterfacemessage{colors}{1}{system -- is global activated} -\setinterfacemessage{colors}{3}{-- is not defined --} -\setinterfacemessage{colors}{2}{system -- is local activated} -\setinterfacemessage{colors}{5}{unknown system --} -\setinterfacemessage{colors}{4}{system -- is loaded} -\setinterfacemessage{colors}{7}{palette -- is not available} -\setinterfacemessage{colors}{6}{palette -- is available} -\setinterfacemessage{colors}{9}{-- color space is not supported} -\setinterfacemessage{colors}{8}{specification -- at color -- becomes black} -\setinterfacemessage{colors}{title}{color} -\setinterfacemessage{colors}{12}{-- is registered} -\setinterfacemessage{colors}{11}{color is converted to gray} -\setinterfacemessage{colors}{10}{-- color space is supported} -% -\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-mro.mkii b/Master/texmf-dist/tex/context/base/mult-mro.mkii new file mode 100644 index 00000000000..70673c31717 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-mro.mkii @@ -0,0 +1,210 @@ +\setinterfacemessage{references}{1}{referinta necunoscuta --} +\setinterfacemessage{references}{30}{obiect necunoscut --} +\setinterfacemessage{references}{3}{tip necunoscut de referinta --} +\setinterfacemessage{references}{2}{referinta duplicat -- la pagina --} +\setinterfacemessage{references}{5}{number of unknown references: --} +\setinterfacemessage{references}{4}{referinta eronata --} +\setinterfacemessage{references}{6}{number of illegal references: --} +\setinterfacemessage{references}{25}{references from document '--' are not imported (export again)} +\setinterfacemessage{references}{24}{references from document '--' are not exported} +\setinterfacemessage{references}{title}{referinte} +\setinterfacemessage{references}{26}{references from document '--' are imported} +\setinterfacemessage{references}{31}{obiect duplicat --} +\setinterfacemessage{references}{21}{documentul -- este incarcat} +\setinterfacemessage{references}{22}{documentul -- nu este interactiv} +\setinterfacemessage{references}{23}{referinta obscura -- (prefix=--)} +\setinterfacemessage{documents}{1}{sheet --} +\setinterfacemessage{documents}{title}{sheets} +\setinterfacemessage{documents}{2}{number --} +\setinterfacemessage{handlings}{1}{font handling --} +\setinterfacemessage{handlings}{3}{unknown font handling --} +\setinterfacemessage{handlings}{2}{font handling -- is loaded} +\setinterfacemessage{handlings}{title}{handling} +\setinterfacemessage{systems}{title}{sistem} +\setinterfacemessage{systems}{41}{fisierul extern -- din grupul -- nu exista} +\setinterfacemessage{systems}{9}{-- nu este gasit/procesat} +\setinterfacemessage{systems}{91}{papertray --} +\setinterfacemessage{systems}{8}{o noua versiune de fisier utilitar, este necesara o noua trecere} +\setinterfacemessage{systems}{21}{nici o data utilitara nu este incarcata} +\setinterfacemessage{systems}{20}{intelesul (ordinea) pentru -- incarcat} +\setinterfacemessage{systems}{5}{macro-urile din modulul -- s-au incarcat} +\setinterfacemessage{systems}{4}{comanda -- este deja definita} +\setinterfacemessage{systems}{27}{Versiune} +\setinterfacemessage{systems}{26}{Registri} +\setinterfacemessage{systems}{25}{Referinte} +\setinterfacemessage{systems}{24}{Blocuri} +\setinterfacemessage{systems}{1}{se incarca utilitarul-fisierul este amanat (typemode)} +\setinterfacemessage{systems}{23}{-- aranjat la --} +\setinterfacemessage{systems}{22}{folositi un fisier utilitar valid} +\setinterfacemessage{systems}{2}{-- s-a incarcat} +\setinterfacemessage{systems}{19}{intelesul (sinonimele) pentru -- incarcat} +\setinterfacemessage{systems}{18}{sinonimul -- -- nu exista} +\setinterfacemessage{systems}{7}{macro-urile din modulul -- s-au incarcat deja} +\setinterfacemessage{systems}{6}{nu s-au gasit macro-uri in modulul --} +\setinterfacemessage{systems}{14}{s-a fortat trecere pa pagina noua in lista la --} +\setinterfacemessage{systems}{15}{buffer salvat --} +\setinterfacemessage{systems}{16}{buffer-ul -- s-a cules} +\setinterfacemessage{systems}{17}{se culege buffer-ul verbatim --} +\setinterfacemessage{systems}{13}{marcajul -- definit --} +\setinterfacemessage{systems}{12}{fisierul utilitar nu este sortat, folositi texutil} +\setinterfacemessage{systems}{11}{se creeaza un utilitar simplu} +\setinterfacemessage{systems}{10}{nu folositi em in --} +\setinterfacemessage{floatblocks}{1}{-- renumerotat / -- => --} +\setinterfacemessage{floatblocks}{3}{-- mutat} +\setinterfacemessage{floatblocks}{2}{-- salvat} +\setinterfacemessage{floatblocks}{5}{ordinea adaptata} +\setinterfacemessage{floatblocks}{4}{-- plasat} +\setinterfacemessage{floatblocks}{7}{nr. blocurilor de jos limitat la --} +\setinterfacemessage{floatblocks}{6}{nr. cadrelor de sus limitat la --} +\setinterfacemessage{floatblocks}{9}{ordinea deranjata} +\setinterfacemessage{floatblocks}{8}{mai putin de -- linii} +\setinterfacemessage{floatblocks}{title}{Blocuri} +\setinterfacemessage{floatblocks}{13}{there is nothing to split} +\setinterfacemessage{floatblocks}{12}{nedefinit} +\setinterfacemessage{floatblocks}{11}{nu este dat nici un bloc} +\setinterfacemessage{floatblocks}{10}{-- limitat} +\setinterfacemessage{interactions}{1}{aspectul -- x -- (b x h)} +\setinterfacemessage{interactions}{3}{inactiv} +\setinterfacemessage{interactions}{2}{activ} +\setinterfacemessage{interactions}{5}{unknown attachment --} +\setinterfacemessage{interactions}{4}{nu exista sincronizare pt. pagini (--) in hmode} +\setinterfacemessage{interactions}{6}{attachment file -- does not exist} +\setinterfacemessage{interactions}{title}{interactiuni} +\setinterfacemessage{interactions}{21}{-- cod inserat} +\setinterfacemessage{regimes}{1}{codificarea --} +\setinterfacemessage{regimes}{3}{codificarea -- este necunoscuta} +\setinterfacemessage{regimes}{2}{codificarea -- este Encarcata} +\setinterfacemessage{regimes}{title}{codificari} +\setinterfacemessage{structures}{1}{inceput de bloc sectiune --} +\setinterfacemessage{structures}{title}{structuri} +\setinterfacemessage{structures}{2}{sfarsit de bloc sectiune --} +\setinterfacemessage{linguals}{1}{sablonul -- pentru -- s-a incarcat (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{3}{despartirea in silabe -- pentru -- s-a incarcat (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{2}{nu exista sabloane -- pentru -- (n=--,e=--,m=--) (--,--)} +\setinterfacemessage{linguals}{5}{sabloanele pentru -- nu sunt incarcate} +\setinterfacemessage{linguals}{4}{nu exista despartire in silabe -- pentru -- (n=--,e=--,m=--)} +\setinterfacemessage{linguals}{7}{optiunile specifice ale limbii [--] introduc un spatiu --} +\setinterfacemessage{linguals}{6}{limba -- nu este definita} +\setinterfacemessage{linguals}{9}{limba -- este activa} +\setinterfacemessage{linguals}{8}{optiunile specifice ale limbii [--] adaugate} +\setinterfacemessage{linguals}{title}{limbi} +\setinterfacemessage{linguals}{10}{sabloanele -- incarcate} +\setinterfacemessage{verbatims}{1}{fisierul -- nu exista} +\setinterfacemessage{verbatims}{title}{verbatim} +\setinterfacemessage{filters}{1}{filter -- is loaded} +\setinterfacemessage{filters}{title}{filter} +\setinterfacemessage{filters}{2}{unknown filter --} +\setinterfacemessage{textblocks}{1}{o noua versiune, este nevoie de inca o trecere} +\setinterfacemessage{textblocks}{3}{se citesc blocurile din --} +\setinterfacemessage{textblocks}{2}{se scriu blocurile in --} +\setinterfacemessage{textblocks}{5}{-- nu este ascuns} +\setinterfacemessage{textblocks}{4}{este nevoie de inca o trecere} +\setinterfacemessage{textblocks}{7}{-- ascuns} +\setinterfacemessage{textblocks}{6}{-- ascuns si procesat} +\setinterfacemessage{textblocks}{9}{-- nu este cules} +\setinterfacemessage{textblocks}{8}{-- cules} +\setinterfacemessage{textblocks}{title}{blocuri de text} +\setinterfacemessage{textblocks}{12}{-- sarit peste} +\setinterfacemessage{textblocks}{11}{-- incarcat si cules} +\setinterfacemessage{textblocks}{10}{-- incarcat si procesat} +\setinterfacemessage{encodings}{1}{codificarea --} +\setinterfacemessage{encodings}{3}{codificarea -- este necunoscuta} +\setinterfacemessage{encodings}{2}{codificarea -- este Encarcata} +\setinterfacemessage{encodings}{title}{codificari} +\setinterfacemessage{columns}{1}{este posibil numai -- coloane} +\setinterfacemessage{columns}{3}{probleme, se dezactiveaza alinierea} +\setinterfacemessage{columns}{2}{folositi \string\filbreak\space ca alternativa} +\setinterfacemessage{columns}{5}{cadrele bottom (bottom float) nu sunt inca suportate} +\setinterfacemessage{columns}{4}{cadrele top (top float) nu sunt inca suportate} +\setinterfacemessage{columns}{7}{alinierea este oprita dupa 100 de incercari} +\setinterfacemessage{columns}{6}{-- blocurile sunt amanate} +\setinterfacemessage{columns}{9}{verificat alinierea} +\setinterfacemessage{columns}{8}{aliniat in -- pas(i)} +\setinterfacemessage{columns}{title}{coloane} +\setinterfacemessage{columns}{13}{blocul lat este mutat in partea de sus a coloanelor} +\setinterfacemessage{columns}{12}{blocul este mutat pe urmatoarea coloana / --} +\setinterfacemessage{columns}{11}{blocul este prea lat pentru coloana} +\setinterfacemessage{columns}{10}{a mai ramas (mai putin de) 1 linie} +\setinterfacemessage{symbols}{1}{se incarca setul de simboluri --} +\setinterfacemessage{symbols}{title}{simboluri} +\setinterfacemessage{files}{1}{sinonimul fisierelor -- este folosit deja pentru --} +\setinterfacemessage{files}{title}{fisiere} +\setinterfacemessage{versions}{1}{lipseste @+} +\setinterfacemessage{versions}{3}{pagini selectate: --} +\setinterfacemessage{versions}{2}{pagini marcate} +\setinterfacemessage{versions}{title}{versiuni} +\setinterfacemessage{specials}{1}{-- incarcat} +\setinterfacemessage{specials}{3}{-- s-a resetat} +\setinterfacemessage{specials}{2}{nu este permis un nivel de imbricare mai mare --} +\setinterfacemessage{specials}{5}{se incarca fisierul de definitii --} +\setinterfacemessage{specials}{4}{comanda -- nu exista} +\setinterfacemessage{specials}{7}{driver necunoscut --} +\setinterfacemessage{specials}{6}{imbricarea nu este permisa} +\setinterfacemessage{specials}{title}{specials} +\setinterfacemessage{layouts}{1}{textheight adaptat cu -- la pagina --} +\setinterfacemessage{layouts}{3}{textul amanat de -- ori} +\setinterfacemessage{layouts}{2}{textul amanat de -- ori a fost plasat} +\setinterfacemessage{layouts}{5}{blocuri marginale inactive} +\setinterfacemessage{layouts}{4}{blocuri marginale active} +\setinterfacemessage{layouts}{7}{se calculeaza spatiul pentru logo} +\setinterfacemessage{layouts}{6}{setul -- de subpagini procesat (dimensiunea --)} +\setinterfacemessage{layouts}{9}{acum nu se supota mai mult de -- nivele de adancime la iteratii} +\setinterfacemessage{layouts}{8}{se calculeaza fundalurile} +\setinterfacemessage{layouts}{title}{aranjamente} +\setinterfacemessage{layouts}{11}{spatierea -- nu este permisa in gridmode} +\setinterfacemessage{layouts}{10}{-- si -- nu se adauga pana la 1.0} +\setinterfacemessage{fonts}{1}{codificarea --} +\setinterfacemessage{fonts}{3}{varianta necunoscuta --} +\setinterfacemessage{fonts}{2}{varianta -- este incarcata} +\setinterfacemessage{fonts}{5}{stilul -- nu este definit} +\setinterfacemessage{fonts}{4}{corpul de litere -- nu este definit} +\setinterfacemessage{fonts}{7}{format necunoscut --} +\setinterfacemessage{fonts}{6}{-- este incarcat} +\setinterfacemessage{fonts}{14}{bodyfont -- is defined (can better be done global)} +\setinterfacemessage{fonts}{8}{stilul -- definit} +\setinterfacemessage{fonts}{title}{corp de litere} +\setinterfacemessage{fonts}{10}{fisier font necunoscut --} +\setinterfacemessage{databases}{1}{--} +\setinterfacemessage{databases}{3}{fisier global --} +\setinterfacemessage{databases}{2}{fisier local --} +\setinterfacemessage{databases}{4}{fisier necunoscut --} +\setinterfacemessage{databases}{title}{baze de date} +\setinterfacemessage{publications}{1}{file -- not found, unknown style ignored} +\setinterfacemessage{publications}{3}{wrote a new auxiliary file \jobname.aux} +\setinterfacemessage{publications}{title}{publications} +\setinterfacemessage{publications}{2}{file -- not found, waiting for bibtex} +\setinterfacemessage{publications}{4}{loading database from --} +\setinterfacemessage{publications}{5}{warning: cite argument -- on line \the\inputlineno} +\setinterfacemessage{publications}{6}{loading formatting style from --} +\setinterfacemessage{javascript}{1}{se incarca scriptul --} +\setinterfacemessage{javascript}{title}{javascript} +\setinterfacemessage{javascript}{2}{preambul necunoscut --} +\setinterfacemessage{check}{1}{lipseste '=' dupa '--' in linia --} +\setinterfacemessage{check}{3}{-- -- inlocuieste un macro, folositi MAJUSCULE!} +\setinterfacemessage{check}{2}{argumentul(ele) -- sunt asteptate in linia --} +\setinterfacemessage{check}{title}{verificari} +\setinterfacemessage{metapost}{1}{se incarca biblioteca metapost --} +\setinterfacemessage{metapost}{title}{metapost} +\setinterfacemessage{figures}{1}{figura -- nu poate fi gasita} +\setinterfacemessage{figures}{3}{dimensions of -- are determined externally} +\setinterfacemessage{figures}{2}{figura -- nu este presetata} +\setinterfacemessage{figures}{5}{dimensions of -- are unknown} +\setinterfacemessage{figures}{4}{dimensiunea figurii -- se incarca din fisierul insusi} +\setinterfacemessage{figures}{6}{dimensiunea figurii -- este calculata de rlxtools} +\setinterfacemessage{figures}{8}{obiectul figura -- este refolosit} +\setinterfacemessage{figures}{title}{figuri} +\setinterfacemessage{colors}{1}{sistem -- este activata global} +\setinterfacemessage{colors}{3}{-- nu este definita --} +\setinterfacemessage{colors}{2}{sistem -- este activata local} +\setinterfacemessage{colors}{5}{sistem -- necunoscuta} +\setinterfacemessage{colors}{4}{sistem -- este incarcata} +\setinterfacemessage{colors}{7}{palette -- nu este disponibila} +\setinterfacemessage{colors}{6}{paleta -- este disponibila} +\setinterfacemessage{colors}{9}{spatiul de culoare -- nu este suportat} +\setinterfacemessage{colors}{8}{specificatia -- la culoarea -- devine neagra} +\setinterfacemessage{colors}{title}{culori} +\setinterfacemessage{colors}{12}{-- is registered} +\setinterfacemessage{colors}{11}{culoarea este convertita la gri} +\setinterfacemessage{colors}{10}{spatiul de culoare -- este suportat} +% +\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-mro.tex b/Master/texmf-dist/tex/context/base/mult-mro.tex deleted file mode 100644 index da96a23a494..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-mro.tex +++ /dev/null @@ -1,208 +0,0 @@ -\setinterfacemessage{references}{1}{referinta necunoscuta --} -\setinterfacemessage{references}{3}{tip necunoscut de referinta --} -\setinterfacemessage{references}{2}{referinta duplicat -- la pagina --} -\setinterfacemessage{references}{4}{referinta eronata --} -\setinterfacemessage{references}{30}{obiect necunoscut --} -\setinterfacemessage{references}{25}{references from document '--' are not imported (export again)} -\setinterfacemessage{references}{24}{references from document '--' are not exported} -\setinterfacemessage{references}{title}{referinte} -\setinterfacemessage{references}{26}{references from document '--' are imported} -\setinterfacemessage{references}{31}{obiect duplicat --} -\setinterfacemessage{references}{21}{documentul -- este incarcat} -\setinterfacemessage{references}{22}{documentul -- nu este interactiv} -\setinterfacemessage{references}{23}{referinta obscura -- (prefix=--)} -\setinterfacemessage{documents}{1}{sheet --} -\setinterfacemessage{documents}{title}{sheets} -\setinterfacemessage{documents}{2}{number --} -\setinterfacemessage{handlings}{1}{font handling --} -\setinterfacemessage{handlings}{3}{unknown font handling --} -\setinterfacemessage{handlings}{2}{font handling -- is loaded} -\setinterfacemessage{handlings}{title}{handling} -\setinterfacemessage{systems}{title}{sistem} -\setinterfacemessage{systems}{41}{fisierul extern -- din grupul -- nu exista} -\setinterfacemessage{systems}{9}{-- nu este gasit/procesat} -\setinterfacemessage{systems}{91}{papertray --} -\setinterfacemessage{systems}{8}{o noua versiune de fisier utilitar, este necesara o noua trecere} -\setinterfacemessage{systems}{21}{nici o data utilitara nu este incarcata} -\setinterfacemessage{systems}{20}{intelesul (ordinea) pentru -- incarcat} -\setinterfacemessage{systems}{5}{macro-urile din modulul -- s-au incarcat} -\setinterfacemessage{systems}{4}{comanda -- este deja definita} -\setinterfacemessage{systems}{27}{Versiune} -\setinterfacemessage{systems}{26}{Registri} -\setinterfacemessage{systems}{25}{Referinte} -\setinterfacemessage{systems}{24}{Blocuri} -\setinterfacemessage{systems}{1}{se incarca utilitarul-fisierul este amanat (typemode)} -\setinterfacemessage{systems}{23}{-- aranjat la --} -\setinterfacemessage{systems}{22}{folositi un fisier utilitar valid} -\setinterfacemessage{systems}{2}{-- s-a incarcat} -\setinterfacemessage{systems}{19}{intelesul (sinonimele) pentru -- incarcat} -\setinterfacemessage{systems}{18}{sinonimul -- -- nu exista} -\setinterfacemessage{systems}{7}{macro-urile din modulul -- s-au incarcat deja} -\setinterfacemessage{systems}{6}{nu s-au gasit macro-uri in modulul --} -\setinterfacemessage{systems}{14}{s-a fortat trecere pa pagina noua in lista la --} -\setinterfacemessage{systems}{15}{buffer salvat --} -\setinterfacemessage{systems}{16}{buffer-ul -- s-a cules} -\setinterfacemessage{systems}{17}{se culege buffer-ul verbatim --} -\setinterfacemessage{systems}{13}{marcajul -- definit --} -\setinterfacemessage{systems}{12}{fisierul utilitar nu este sortat, folositi texutil} -\setinterfacemessage{systems}{11}{se creeaza un utilitar simplu} -\setinterfacemessage{systems}{10}{nu folositi em in --} -\setinterfacemessage{floatblocks}{1}{-- renumerotat / -- => --} -\setinterfacemessage{floatblocks}{3}{-- mutat} -\setinterfacemessage{floatblocks}{2}{-- salvat} -\setinterfacemessage{floatblocks}{5}{ordinea adaptata} -\setinterfacemessage{floatblocks}{4}{-- plasat} -\setinterfacemessage{floatblocks}{7}{nr. blocurilor de jos limitat la --} -\setinterfacemessage{floatblocks}{6}{nr. cadrelor de sus limitat la --} -\setinterfacemessage{floatblocks}{9}{ordinea deranjata} -\setinterfacemessage{floatblocks}{8}{mai putin de -- linii} -\setinterfacemessage{floatblocks}{title}{Blocuri} -\setinterfacemessage{floatblocks}{13}{there is nothing to split} -\setinterfacemessage{floatblocks}{12}{nedefinit} -\setinterfacemessage{floatblocks}{11}{nu este dat nici un bloc} -\setinterfacemessage{floatblocks}{10}{-- limitat} -\setinterfacemessage{interactions}{1}{aspectul -- x -- (b x h)} -\setinterfacemessage{interactions}{3}{inactiv} -\setinterfacemessage{interactions}{2}{activ} -\setinterfacemessage{interactions}{5}{unknown attachment --} -\setinterfacemessage{interactions}{4}{nu exista sincronizare pt. pagini (--) in hmode} -\setinterfacemessage{interactions}{6}{attachment file -- does not exist} -\setinterfacemessage{interactions}{title}{interactiuni} -\setinterfacemessage{interactions}{21}{-- cod inserat} -\setinterfacemessage{regimes}{1}{codificarea --} -\setinterfacemessage{regimes}{3}{codificarea -- este necunoscuta} -\setinterfacemessage{regimes}{2}{codificarea -- este Encarcata} -\setinterfacemessage{regimes}{title}{codificari} -\setinterfacemessage{structures}{1}{inceput de bloc sectiune --} -\setinterfacemessage{structures}{title}{structuri} -\setinterfacemessage{structures}{2}{sfarsit de bloc sectiune --} -\setinterfacemessage{linguals}{1}{sablonul -- pentru -- s-a incarcat (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{3}{despartirea in silabe -- pentru -- s-a incarcat (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{2}{nu exista sabloane -- pentru -- (n=--,e=--,m=--) (--,--)} -\setinterfacemessage{linguals}{5}{sabloanele pentru -- nu sunt incarcate} -\setinterfacemessage{linguals}{4}{nu exista despartire in silabe -- pentru -- (n=--,e=--,m=--)} -\setinterfacemessage{linguals}{7}{optiunile specifice ale limbii [--] introduc un spatiu --} -\setinterfacemessage{linguals}{6}{limba -- nu este definita} -\setinterfacemessage{linguals}{9}{limba -- este activa} -\setinterfacemessage{linguals}{8}{optiunile specifice ale limbii [--] adaugate} -\setinterfacemessage{linguals}{title}{limbi} -\setinterfacemessage{linguals}{10}{sabloanele -- incarcate} -\setinterfacemessage{verbatims}{1}{fisierul -- nu exista} -\setinterfacemessage{verbatims}{title}{verbatim} -\setinterfacemessage{filters}{1}{filter -- is loaded} -\setinterfacemessage{filters}{title}{filter} -\setinterfacemessage{filters}{2}{unknown filter --} -\setinterfacemessage{textblocks}{1}{o noua versiune, este nevoie de inca o trecere} -\setinterfacemessage{textblocks}{3}{se citesc blocurile din --} -\setinterfacemessage{textblocks}{2}{se scriu blocurile in --} -\setinterfacemessage{textblocks}{5}{-- nu este ascuns} -\setinterfacemessage{textblocks}{4}{este nevoie de inca o trecere} -\setinterfacemessage{textblocks}{7}{-- ascuns} -\setinterfacemessage{textblocks}{6}{-- ascuns si procesat} -\setinterfacemessage{textblocks}{9}{-- nu este cules} -\setinterfacemessage{textblocks}{8}{-- cules} -\setinterfacemessage{textblocks}{title}{blocuri de text} -\setinterfacemessage{textblocks}{12}{-- sarit peste} -\setinterfacemessage{textblocks}{11}{-- incarcat si cules} -\setinterfacemessage{textblocks}{10}{-- incarcat si procesat} -\setinterfacemessage{encodings}{1}{codificarea --} -\setinterfacemessage{encodings}{3}{codificarea -- este necunoscuta} -\setinterfacemessage{encodings}{2}{codificarea -- este Encarcata} -\setinterfacemessage{encodings}{title}{codificari} -\setinterfacemessage{columns}{1}{este posibil numai -- coloane} -\setinterfacemessage{columns}{3}{probleme, se dezactiveaza alinierea} -\setinterfacemessage{columns}{2}{folositi \string\filbreak\space ca alternativa} -\setinterfacemessage{columns}{5}{cadrele bottom (bottom float) nu sunt inca suportate} -\setinterfacemessage{columns}{4}{cadrele top (top float) nu sunt inca suportate} -\setinterfacemessage{columns}{7}{alinierea este oprita dupa 100 de incercari} -\setinterfacemessage{columns}{6}{-- blocurile sunt amanate} -\setinterfacemessage{columns}{9}{verificat alinierea} -\setinterfacemessage{columns}{8}{aliniat in -- pas(i)} -\setinterfacemessage{columns}{title}{coloane} -\setinterfacemessage{columns}{13}{blocul lat este mutat in partea de sus a coloanelor} -\setinterfacemessage{columns}{12}{blocul este mutat pe urmatoarea coloana / --} -\setinterfacemessage{columns}{11}{blocul este prea lat pentru coloana} -\setinterfacemessage{columns}{10}{a mai ramas (mai putin de) 1 linie} -\setinterfacemessage{symbols}{1}{se incarca setul de simboluri --} -\setinterfacemessage{symbols}{title}{simboluri} -\setinterfacemessage{files}{1}{sinonimul fisierelor -- este folosit deja pentru --} -\setinterfacemessage{files}{title}{fisiere} -\setinterfacemessage{versions}{1}{lipseste @+} -\setinterfacemessage{versions}{3}{pagini selectate: --} -\setinterfacemessage{versions}{2}{pagini marcate} -\setinterfacemessage{versions}{title}{versiuni} -\setinterfacemessage{specials}{1}{-- incarcat} -\setinterfacemessage{specials}{3}{-- s-a resetat} -\setinterfacemessage{specials}{2}{nu este permis un nivel de imbricare mai mare --} -\setinterfacemessage{specials}{5}{se incarca fisierul de definitii --} -\setinterfacemessage{specials}{4}{comanda -- nu exista} -\setinterfacemessage{specials}{7}{driver necunoscut --} -\setinterfacemessage{specials}{6}{imbricarea nu este permisa} -\setinterfacemessage{specials}{title}{specials} -\setinterfacemessage{layouts}{1}{textheight adaptat cu -- la pagina --} -\setinterfacemessage{layouts}{3}{textul amanat de -- ori} -\setinterfacemessage{layouts}{2}{textul amanat de -- ori a fost plasat} -\setinterfacemessage{layouts}{5}{blocuri marginale inactive} -\setinterfacemessage{layouts}{4}{blocuri marginale active} -\setinterfacemessage{layouts}{7}{se calculeaza spatiul pentru logo} -\setinterfacemessage{layouts}{6}{setul -- de subpagini procesat (dimensiunea --)} -\setinterfacemessage{layouts}{9}{acum nu se supota mai mult de -- nivele de adancime la iteratii} -\setinterfacemessage{layouts}{8}{se calculeaza fundalurile} -\setinterfacemessage{layouts}{title}{aranjamente} -\setinterfacemessage{layouts}{11}{spatierea -- nu este permisa in gridmode} -\setinterfacemessage{layouts}{10}{-- si -- nu se adauga pana la 1.0} -\setinterfacemessage{fonts}{1}{codificarea --} -\setinterfacemessage{fonts}{3}{varianta necunoscuta --} -\setinterfacemessage{fonts}{2}{varianta -- este incarcata} -\setinterfacemessage{fonts}{5}{stilul -- nu este definit} -\setinterfacemessage{fonts}{4}{corpul de litere -- nu este definit} -\setinterfacemessage{fonts}{7}{format necunoscut --} -\setinterfacemessage{fonts}{6}{-- este incarcat} -\setinterfacemessage{fonts}{14}{bodyfont -- is defined (can better be done global)} -\setinterfacemessage{fonts}{8}{stilul -- definit} -\setinterfacemessage{fonts}{title}{corp de litere} -\setinterfacemessage{fonts}{10}{fisier font necunoscut --} -\setinterfacemessage{databases}{1}{--} -\setinterfacemessage{databases}{3}{fisier global --} -\setinterfacemessage{databases}{2}{fisier local --} -\setinterfacemessage{databases}{4}{fisier necunoscut --} -\setinterfacemessage{databases}{title}{baze de date} -\setinterfacemessage{publications}{1}{file -- not found, unknown style ignored} -\setinterfacemessage{publications}{3}{wrote a new auxiliary file \jobname.aux} -\setinterfacemessage{publications}{title}{publications} -\setinterfacemessage{publications}{2}{file -- not found, waiting for bibtex} -\setinterfacemessage{publications}{4}{loading database from --} -\setinterfacemessage{publications}{5}{warning: cite argument -- on line \the\inputlineno} -\setinterfacemessage{publications}{6}{loading formatting style from --} -\setinterfacemessage{javascript}{1}{se incarca scriptul --} -\setinterfacemessage{javascript}{title}{javascript} -\setinterfacemessage{javascript}{2}{preambul necunoscut --} -\setinterfacemessage{check}{1}{lipseste '=' dupa '--' in linia --} -\setinterfacemessage{check}{3}{-- -- inlocuieste un macro, folositi MAJUSCULE!} -\setinterfacemessage{check}{2}{argumentul(ele) -- sunt asteptate in linia --} -\setinterfacemessage{check}{title}{verificari} -\setinterfacemessage{metapost}{1}{se incarca biblioteca metapost --} -\setinterfacemessage{metapost}{title}{metapost} -\setinterfacemessage{figures}{1}{figura -- nu poate fi gasita} -\setinterfacemessage{figures}{3}{dimensions of -- are determined externally} -\setinterfacemessage{figures}{2}{figura -- nu este presetata} -\setinterfacemessage{figures}{5}{dimensions of -- are unknown} -\setinterfacemessage{figures}{4}{dimensiunea figurii -- se incarca din fisierul insusi} -\setinterfacemessage{figures}{6}{dimensiunea figurii -- este calculata de rlxtools} -\setinterfacemessage{figures}{8}{obiectul figura -- este refolosit} -\setinterfacemessage{figures}{title}{figuri} -\setinterfacemessage{colors}{1}{sistem -- este activata global} -\setinterfacemessage{colors}{3}{-- nu este definita --} -\setinterfacemessage{colors}{2}{sistem -- este activata local} -\setinterfacemessage{colors}{5}{sistem -- necunoscuta} -\setinterfacemessage{colors}{4}{sistem -- este incarcata} -\setinterfacemessage{colors}{7}{palette -- nu este disponibila} -\setinterfacemessage{colors}{6}{paleta -- este disponibila} -\setinterfacemessage{colors}{9}{spatiul de culoare -- nu este suportat} -\setinterfacemessage{colors}{8}{specificatia -- la culoarea -- devine neagra} -\setinterfacemessage{colors}{title}{culori} -\setinterfacemessage{colors}{12}{-- is registered} -\setinterfacemessage{colors}{11}{culoarea este convertita la gri} -\setinterfacemessage{colors}{10}{spatiul de culoare -- este suportat} -% -\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-nl.mkii b/Master/texmf-dist/tex/context/base/mult-nl.mkii new file mode 100644 index 00000000000..a5b62ad3347 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-nl.mkii @@ -0,0 +1,1715 @@ +% this file is auto-generated, don't edit this file +% +% definitions for interface variables for language nl +% +\setinterfacevariable{Addition}{Toevoeging} +\setinterfacevariable{Balloon}{Ballon} +\setinterfacevariable{Character}{Letter} +\setinterfacevariable{Characters}{Letters} +\setinterfacevariable{CloseDocument}{SluitDocument} +\setinterfacevariable{ExitViewer}{VerlaatViewer} +\setinterfacevariable{FirstPage}{EerstePagina} +\setinterfacevariable{FitHeight}{HoogtePassend} +\setinterfacevariable{FitWidth}{BreedtePassend} +\setinterfacevariable{GotoPage}{GaNaarPagina} +\setinterfacevariable{Greek}{Grieks} +\setinterfacevariable{Help}{Help} +\setinterfacevariable{HideField}{VerbergVeld} +\setinterfacevariable{HideLayer}{VerbergLaag} +\setinterfacevariable{Key}{Sleutel} +\setinterfacevariable{LastPage}{LaatstePagina} +\setinterfacevariable{LoadForm}{LaadFormulier} +\setinterfacevariable{MONTH}{MAAND} +\setinterfacevariable{New}{Nieuw} +\setinterfacevariable{NextJump}{VolgendeSprong} +\setinterfacevariable{NextPage}{VolgendePagina} +\setinterfacevariable{Numbers}{Cijfers} +\setinterfacevariable{OpenNamedDocument}{OpenDocumentOpNaam} +\setinterfacevariable{Paragraph}{Paragraaf} +\setinterfacevariable{PauseMovie}{PauzeerFilm} +\setinterfacevariable{PauseRendering}{PauzeerRendering} +\setinterfacevariable{PauseSound}{PauzeerGeluid} +\setinterfacevariable{PreviousJump}{VorigeSprong} +\setinterfacevariable{PreviousPage}{VorigePagina} +\setinterfacevariable{PrintDocument}{PrintDocument} +\setinterfacevariable{Query}{RaadpleegDocument} +\setinterfacevariable{QueryAgain}{HerhaalRaadplegen} +\setinterfacevariable{ResetForm}{ResetFormulier} +\setinterfacevariable{ResumeMovie}{HervatFilm} +\setinterfacevariable{ResumeRendering}{HervatRendering} +\setinterfacevariable{ResumeSound}{HervatGeluid} +\setinterfacevariable{Romannumerals}{Romeins} +\setinterfacevariable{SaveDocument}{BewaarDocument} +\setinterfacevariable{SaveForm}{BewaarFormulier} +\setinterfacevariable{SaveNamedDocument}{BewaarDocumentOpNaam} +\setinterfacevariable{SearchAgain}{HerhaalZoeken} +\setinterfacevariable{SearchDocument}{DoorzoekDocument} +\setinterfacevariable{ShowBookmarks}{ShowBookmarks} +\setinterfacevariable{ShowField}{ToonVeld} +\setinterfacevariable{ShowThumbs}{ShowThumbs} +\setinterfacevariable{StartMovie}{StartFilm} +\setinterfacevariable{StartRendering}{StartRendering} +\setinterfacevariable{StartSound}{StartGeluid} +\setinterfacevariable{StopMovie}{StopFilm} +\setinterfacevariable{StopRendering}{StopRendering} +\setinterfacevariable{StopSound}{StopGeluid} +\setinterfacevariable{SubmitForm}{VerzendFormulier} +\setinterfacevariable{ToggleLayer}{WisselLaag} +\setinterfacevariable{ToggleViewer}{WisselViewer} +\setinterfacevariable{URL}{URL} +\setinterfacevariable{VideLayer}{ToonLaag} +\setinterfacevariable{ViewerHelp}{ViewerHelp} +\setinterfacevariable{WEEKDAY}{WEEKDAG} +\setinterfacevariable{WORD}{WOORD} +\setinterfacevariable{abbreviation}{afkorting} +\setinterfacevariable{abbreviations}{afkortingen} +\setinterfacevariable{absolute}{absoluut} +\setinterfacevariable{action}{actie} +\setinterfacevariable{after}{na} +\setinterfacevariable{all}{alles} +\setinterfacevariable{always}{altijd} +\setinterfacevariable{and}{en} +\setinterfacevariable{answerarea}{antwoordgebied} +\setinterfacevariable{appendices}{bijlagen} +\setinterfacevariable{appendix}{bijlage} +\setinterfacevariable{april}{april} +\setinterfacevariable{atmargin}{opmarge} +\setinterfacevariable{atpage}{oppagina} +\setinterfacevariable{attachment}{aanhangsel} +\setinterfacevariable{august}{augustus} +\setinterfacevariable{author}{auteur} +\setinterfacevariable{auto}{auto} +\setinterfacevariable{autointro}{autointro} +\setinterfacevariable{back}{terug} +\setinterfacevariable{background}{achtergrond} +\setinterfacevariable{backmatter}{uitleidingen} +\setinterfacevariable{backpart}{uitleiding} +\setinterfacevariable{backspace}{rugwit} +\setinterfacevariable{backward}{achteruit} +\setinterfacevariable{bbl}{bbl} +\setinterfacevariable{before}{voor} +\setinterfacevariable{begin}{begin} +\setinterfacevariable{bib}{bib} +\setinterfacevariable{big}{groot} +\setinterfacevariable{bigbodyfont}{grootkorps} +\setinterfacevariable{bigger}{groter} +\setinterfacevariable{bigpreference}{grotevoorkeur} +\setinterfacevariable{blank}{blanko} +\setinterfacevariable{blockquote}{blokcitaat} +\setinterfacevariable{bodymatter}{hoofdteksten} +\setinterfacevariable{bodypart}{hoofdtekst} +\setinterfacevariable{bold}{vet} +\setinterfacevariable{bolditalic}{vetitalic} +\setinterfacevariable{boldslanted}{vetschuin} +\setinterfacevariable{bookmark}{bookmark} +\setinterfacevariable{both}{beide} +\setinterfacevariable{bottom}{onder} +\setinterfacevariable{brief}{brief} +\setinterfacevariable{broad}{ruim} +\setinterfacevariable{buffer}{buffer} +\setinterfacevariable{by}{per} +\setinterfacevariable{calligraphic}{calligrafie} +\setinterfacevariable{cap}{kap} +\setinterfacevariable{capital}{kapitaal} +\setinterfacevariable{center}{centreer} +\setinterfacevariable{chapter}{hoofdstuk} +\setinterfacevariable{character}{letter} +\setinterfacevariable{characters}{letters} +\setinterfacevariable{cite}{cite} +\setinterfacevariable{color}{kleur} +\setinterfacevariable{column}{kolom} +\setinterfacevariable{columns}{kolommen} +\setinterfacevariable{command}{commando} +\setinterfacevariable{commands}{commandos} +\setinterfacevariable{comment}{commentaar} +\setinterfacevariable{component}{onderdeel} +\setinterfacevariable{concept}{concept} +\setinterfacevariable{content}{inhoud} +\setinterfacevariable{contents}{inhouden} +\setinterfacevariable{continue}{verder} +\setinterfacevariable{continued}{vervolgd} +\setinterfacevariable{controls}{sturing} +\setinterfacevariable{conversion}{conversie} +\setinterfacevariable{current}{huidige} +\setinterfacevariable{cutspace}{snijwit} +\setinterfacevariable{date}{datum} +\setinterfacevariable{day}{dag} +\setinterfacevariable{december}{december} +\setinterfacevariable{default}{default} +\setinterfacevariable{depth}{diepte} +\setinterfacevariable{description}{doordefinitie} +\setinterfacevariable{disable}{blokkeer} +\setinterfacevariable{display}{scherm} +\setinterfacevariable{dot}{punt} +\setinterfacevariable{doublesided}{dubbelzijdig} +\setinterfacevariable{down}{omlaag} +\setinterfacevariable{each}{elk} +\setinterfacevariable{edge}{rand} +\setinterfacevariable{embed}{sluitin} +\setinterfacevariable{empty}{leeg} +\setinterfacevariable{end}{eind} +\setinterfacevariable{endnote}{eindnoot} +\setinterfacevariable{enumeration}{doornummering} +\setinterfacevariable{environment}{omgeving} +\setinterfacevariable{even}{even} +\setinterfacevariable{external}{extern} +\setinterfacevariable{fact}{gegeven} +\setinterfacevariable{february}{februari} +\setinterfacevariable{figure}{figuur} +\setinterfacevariable{figures}{figuren} +\setinterfacevariable{file}{file} +\setinterfacevariable{final}{definitief} +\setinterfacevariable{first}{eerste} +\setinterfacevariable{firstcolumn}{eerstekolom} +\setinterfacevariable{firstpage}{eerstepagina} +\setinterfacevariable{firstsubpage}{eerstesubpagina} +\setinterfacevariable{fit}{passend} +\setinterfacevariable{five}{vijf} +\setinterfacevariable{fix}{herstel} +\setinterfacevariable{fixed}{vast} +\setinterfacevariable{flexible}{flexibel} +\setinterfacevariable{float}{blok} +\setinterfacevariable{flushinner}{lijnbinnen} +\setinterfacevariable{flushleft}{lijnlinks} +\setinterfacevariable{flushouter}{lijnbuiten} +\setinterfacevariable{flushright}{lijnrechts} +\setinterfacevariable{footer}{voet} +\setinterfacevariable{footnote}{voetnoot} +\setinterfacevariable{force}{forceer} +\setinterfacevariable{foreground}{voorgrond} +\setinterfacevariable{formeel}{formeel} +\setinterfacevariable{formula}{formule} +\setinterfacevariable{formulae}{formules} +\setinterfacevariable{forward}{vooruit} +\setinterfacevariable{four}{vier} +\setinterfacevariable{frame}{kader} +\setinterfacevariable{framedtext}{kadertekst} +\setinterfacevariable{friday}{vrijdag} +\setinterfacevariable{frontmatter}{inleidingen} +\setinterfacevariable{frontpart}{inleiding} +\setinterfacevariable{global}{globaal} +\setinterfacevariable{graphic}{grafiek} +\setinterfacevariable{graphics}{grafieken} +\setinterfacevariable{gray}{grijs} +\setinterfacevariable{greek}{grieks} +\setinterfacevariable{grid}{grid} +\setinterfacevariable{halfline}{halveregel} +\setinterfacevariable{handwritten}{handschrift} +\setinterfacevariable{hang}{hang} +\setinterfacevariable{hanging}{hangend} +\setinterfacevariable{head}{kop} +\setinterfacevariable{header}{hoofd} +\setinterfacevariable{height}{hoogte} +\setinterfacevariable{helptext}{helptekst} +\setinterfacevariable{hencefore}{hierboven} +\setinterfacevariable{here}{hier} +\setinterfacevariable{hereafter}{hieronder} +\setinterfacevariable{hidden}{verborgen} +\setinterfacevariable{hiding}{verbergen} +\setinterfacevariable{high}{hoog} +\setinterfacevariable{horizontal}{horizontaal} +\setinterfacevariable{hyphenated}{afgebroken} +\setinterfacevariable{hz}{hz} +\setinterfacevariable{inbetween}{tussen} +\setinterfacevariable{index}{index} +\setinterfacevariable{indices}{indices} +\setinterfacevariable{informeel}{informeel} +\setinterfacevariable{inherit}{erf} +\setinterfacevariable{inleft}{inlinker} +\setinterfacevariable{inmargin}{inmarge} +\setinterfacevariable{inner}{binnen} +\setinterfacevariable{inneredge}{binnenrand} +\setinterfacevariable{innermargin}{binnenmarge} +\setinterfacevariable{inright}{inrechter} +\setinterfacevariable{interaction}{interactie} +\setinterfacevariable{interactionmenu}{interactiemenu} +\setinterfacevariable{intermezzi}{intermezzos} +\setinterfacevariable{intermezzo}{intermezzo} +\setinterfacevariable{intext}{intekst} +\setinterfacevariable{intro}{intro} +\setinterfacevariable{italic}{italic} +\setinterfacevariable{italicbold}{italicvet} +\setinterfacevariable{item}{som} +\setinterfacevariable{itemize}{opsomming} +\setinterfacevariable{its}{its} +\setinterfacevariable{january}{januari} +\setinterfacevariable{joinedup}{aansluitend} +\setinterfacevariable{july}{juli} +\setinterfacevariable{june}{juni} +\setinterfacevariable{keep}{handhaaf} +\setinterfacevariable{knockout}{knockout} +\setinterfacevariable{label}{label} +\setinterfacevariable{landscape}{liggend} +\setinterfacevariable{last}{laatste} +\setinterfacevariable{lastcolumn}{laatstekolom} +\setinterfacevariable{lastpage}{laatstepagina} +\setinterfacevariable{lastpagenumber}{laatstepaginanummer} +\setinterfacevariable{lastsubpage}{laatstesubpagina} +\setinterfacevariable{layer}{layer} +\setinterfacevariable{left}{links} +\setinterfacevariable{leftedge}{linkerrand} +\setinterfacevariable{lefthanging}{linkshangend} +\setinterfacevariable{leftmargin}{linkermarge} +\setinterfacevariable{leftpage}{linkerpagina} +\setinterfacevariable{lefttoright}{lefttoright} +\setinterfacevariable{legend}{legenda} +\setinterfacevariable{lesshyphenation}{lesshyphenation} +\setinterfacevariable{line}{regel} +\setinterfacevariable{linenote}{regelnoot} +\setinterfacevariable{lines}{regels} +\setinterfacevariable{list}{lijst} +\setinterfacevariable{local}{lokaal} +\setinterfacevariable{localenvironment}{deelomgeving} +\setinterfacevariable{logo}{logo} +\setinterfacevariable{logos}{logos} +\setinterfacevariable{lohi}{laho} +\setinterfacevariable{loose}{los} +\setinterfacevariable{low}{laag} +\setinterfacevariable{ls}{ls} +\setinterfacevariable{makeup}{opmaak} +\setinterfacevariable{mar}{mar} +\setinterfacevariable{march}{maart} +\setinterfacevariable{margin}{marge} +\setinterfacevariable{marginedge}{kantlijn} +\setinterfacevariable{margintitle}{margetitel} +\setinterfacevariable{marking}{markering} +\setinterfacevariable{mathalignment}{wiskundeuitlijnen} +\setinterfacevariable{mathcases}{mathcases} +\setinterfacevariable{mathmatrix}{wiskundematrix} +\setinterfacevariable{max}{max} +\setinterfacevariable{maxdepth}{maxdepth} +\setinterfacevariable{maxheight}{maxheight} +\setinterfacevariable{maxwidth}{maxwidth} +\setinterfacevariable{may}{mei} +\setinterfacevariable{mediaeval}{mediaeval} +\setinterfacevariable{medium}{middel} +\setinterfacevariable{middle}{midden} +\setinterfacevariable{min}{min} +\setinterfacevariable{mindepth}{mindepth} +\setinterfacevariable{minheight}{minhoogte} +\setinterfacevariable{minwidth}{minbreedte} +\setinterfacevariable{mirrored}{gespiegeld} +\setinterfacevariable{monday}{maandag} +\setinterfacevariable{mono}{mono} +\setinterfacevariable{month}{maand} +\setinterfacevariable{morehyphenation}{morehyphenation} +\setinterfacevariable{name}{naam} +\setinterfacevariable{narrow}{smal} +\setinterfacevariable{negative}{negatief} +\setinterfacevariable{never}{nooit} +\setinterfacevariable{new}{nieuw} +\setinterfacevariable{next}{volgende} +\setinterfacevariable{nextevenpage}{volgendeevenpagina} +\setinterfacevariable{nextoddpage}{volgendeonevenpagina} +\setinterfacevariable{nextpage}{volgendepagina} +\setinterfacevariable{nextsubpage}{volgendesubpagina} +\setinterfacevariable{no}{nee} +\setinterfacevariable{nocheck}{geencontrole} +\setinterfacevariable{nofit}{nietpassend} +\setinterfacevariable{nogrid}{geengrid} +\setinterfacevariable{nohz}{geenhz} +\setinterfacevariable{nomarking}{geenmarkering} +\setinterfacevariable{none}{geen} +\setinterfacevariable{nonumber}{geennummer} +\setinterfacevariable{normal}{normaal} +\setinterfacevariable{nospacing}{geenspatiering} +\setinterfacevariable{not}{niet} +\setinterfacevariable{note}{note} +\setinterfacevariable{nothanging}{niethangend} +\setinterfacevariable{nothyphenated}{nietafgebroken} +\setinterfacevariable{november}{november} +\setinterfacevariable{nowhere}{nergens} +\setinterfacevariable{nowhite}{geenwit} +\setinterfacevariable{number}{nummer} +\setinterfacevariable{numbers}{cijfers} +\setinterfacevariable{october}{oktober} +\setinterfacevariable{odd}{oneven} +\setinterfacevariable{off}{uit} +\setinterfacevariable{offset}{offset} +\setinterfacevariable{old}{oud} +\setinterfacevariable{on}{aan} +\setinterfacevariable{one}{een} +\setinterfacevariable{opposite}{naast} +\setinterfacevariable{outer}{buiten} +\setinterfacevariable{outeredge}{buitenrand} +\setinterfacevariable{outermargin}{buitenmarge} +\setinterfacevariable{overbar}{overstreep} +\setinterfacevariable{overbars}{overstrepen} +\setinterfacevariable{overlay}{overlay} +\setinterfacevariable{overprint}{overprint} +\setinterfacevariable{overstrike}{doorstreep} +\setinterfacevariable{overstrikes}{doorstrepen} +\setinterfacevariable{packed}{opelkaar} +\setinterfacevariable{page}{pagina} +\setinterfacevariable{pagecomment}{paginacommentaar} +\setinterfacevariable{pagenumber}{paginanummer} +\setinterfacevariable{paper}{papier} +\setinterfacevariable{paragraph}{alinea} +\setinterfacevariable{part}{deel} +\setinterfacevariable{positive}{positief} +\setinterfacevariable{postponing}{uitstellen} +\setinterfacevariable{postscript}{postscript} +\setinterfacevariable{preference}{voorkeur} +\setinterfacevariable{preview}{preview} +\setinterfacevariable{previous}{vorige} +\setinterfacevariable{previousevenpage}{vorigeevenpagina} +\setinterfacevariable{previousoddpage}{vorigeonevenpagina} +\setinterfacevariable{previouspage}{vorigepagina} +\setinterfacevariable{previoussubpage}{vorigesubpagina} +\setinterfacevariable{printable}{printbaar} +\setinterfacevariable{process}{proces} +\setinterfacevariable{product}{produkt} +\setinterfacevariable{program}{programma} +\setinterfacevariable{project}{project} +\setinterfacevariable{protected}{beschermd} +\setinterfacevariable{quadruple}{viertal} +\setinterfacevariable{quotation}{citaat} +\setinterfacevariable{quote}{citeer} +\setinterfacevariable{ran}{ran} +\setinterfacevariable{random}{willekeurig} +\setinterfacevariable{readonly}{alleenleesbaar} +\setinterfacevariable{rectangular}{recht} +\setinterfacevariable{reference}{referentie} +\setinterfacevariable{referral}{kenmerk} +\setinterfacevariable{register}{register} +\setinterfacevariable{regular}{regular} +\setinterfacevariable{rekening}{rekening} +\setinterfacevariable{relative}{relatief} +\setinterfacevariable{repeat}{herhaal} +\setinterfacevariable{required}{verplicht} +\setinterfacevariable{reset}{reset} +\setinterfacevariable{reverse}{omgekeerd} +\setinterfacevariable{right}{rechts} +\setinterfacevariable{rightedge}{rechterrand} +\setinterfacevariable{righthanging}{rechtshangend} +\setinterfacevariable{rightmargin}{rechtermarge} +\setinterfacevariable{rightpage}{rechterpagina} +\setinterfacevariable{righttoleft}{righttoleft} +\setinterfacevariable{roman}{romaan} +\setinterfacevariable{romannumerals}{romeins} +\setinterfacevariable{rotate}{roteer} +\setinterfacevariable{rotated}{geroteerd} +\setinterfacevariable{round}{rond} +\setinterfacevariable{row}{rij} +\setinterfacevariable{rule}{lijn} +\setinterfacevariable{samepage}{zelfdepagina} +\setinterfacevariable{sans}{sans} +\setinterfacevariable{sansbold}{sansvet} +\setinterfacevariable{sansserif}{schreefloos} +\setinterfacevariable{saturday}{zaterdag} +\setinterfacevariable{screen}{raster} +\setinterfacevariable{section}{paragraaf} +\setinterfacevariable{sectionblockenvironment}{sectieblokomgeving} +\setinterfacevariable{sectionnumber}{sectienummer} +\setinterfacevariable{see}{zie} +\setinterfacevariable{september}{september} +\setinterfacevariable{serif}{serif} +\setinterfacevariable{serried}{aanelkaar} +\setinterfacevariable{setups}{instellingen} +\setinterfacevariable{sheet}{sheet} +\setinterfacevariable{short}{kort} +\setinterfacevariable{singlesided}{enkelzijdig} +\setinterfacevariable{slanted}{schuin} +\setinterfacevariable{slantedbold}{schuinvet} +\setinterfacevariable{small}{klein} +\setinterfacevariable{smallbodyfont}{kleinkorps} +\setinterfacevariable{smallbold}{kleinvet} +\setinterfacevariable{smallbolditalic}{kleinvetitalic} +\setinterfacevariable{smallboldslanted}{kleinvetschuin} +\setinterfacevariable{smallcaps}{smallcaps} +\setinterfacevariable{smaller}{kleiner} +\setinterfacevariable{smallitalic}{kleinitalic} +\setinterfacevariable{smallitalicbold}{kleinitalicvet} +\setinterfacevariable{smallnormal}{kleinnormaal} +\setinterfacevariable{smallslanted}{kleinschuin} +\setinterfacevariable{smallslantedbold}{kleinschuinvet} +\setinterfacevariable{smalltype}{kleintype} +\setinterfacevariable{somewhere}{ergens} +\setinterfacevariable{sorted}{gesorteerd} +\setinterfacevariable{space}{spatie} +\setinterfacevariable{spacing}{spatiering} +\setinterfacevariable{speech}{spraak} +\setinterfacevariable{split}{splitsen} +\setinterfacevariable{spot}{spot} +\setinterfacevariable{standard}{standaard} +\setinterfacevariable{start}{start} +\setinterfacevariable{starter}{opener} +\setinterfacevariable{sticker}{sticker} +\setinterfacevariable{stop}{stop} +\setinterfacevariable{stopper}{afsluiter} +\setinterfacevariable{stretch}{rek} +\setinterfacevariable{strict}{streng} +\setinterfacevariable{strong}{sterk} +\setinterfacevariable{strut}{strut} +\setinterfacevariable{sub}{sub} +\setinterfacevariable{subbackward}{subachteruit} +\setinterfacevariable{subformula}{subformule} +\setinterfacevariable{subforward}{subvooruit} +\setinterfacevariable{subject}{onderwerp} +\setinterfacevariable{subpage}{subpagina} +\setinterfacevariable{subsection}{subparagraaf} +\setinterfacevariable{subsubject}{subonderwerp} +\setinterfacevariable{subsubsection}{subsubparagraaf} +\setinterfacevariable{subsubsubject}{subsubonderwerp} +\setinterfacevariable{subsubsubsection}{subsubsubparagraaf} +\setinterfacevariable{subsubsubsubject}{subsubsubonderwerp} +\setinterfacevariable{subsubsubsubsection}{subsubsubsubparagraaf} +\setinterfacevariable{subsubsubsubsubject}{subsubsubsubonderwerp} +\setinterfacevariable{subsubsubsubsubsection}{subsubsubsubsubparagraaf} +\setinterfacevariable{subsubsubsubsubsubject}{subsubsubsubsubonderwerp} +\setinterfacevariable{subsubsubsubsubsubsection}{subsubsubsubsubsubparagraaf} +\setinterfacevariable{subsubsubsubsubsubsubject}{subsubsubsubsubsubonderwerp} +\setinterfacevariable{subsubsubsubsubsubsubsection}{subsubsubsubsubsubsubparagraaf} +\setinterfacevariable{subsubsubsubsubsubsubsubject}{subsubsubsubsubsubsubonderwerp} +\setinterfacevariable{subsubsubsubsubsubsubsubsection}{subsubsubsubsubsubsubsubparagraaf} +\setinterfacevariable{subsubsubsubsubsubsubsubsubject}{subsubsubsubsubsubsubsubonderwerp} +\setinterfacevariable{subsubsubsubsubsubsubsubsubsection}{subsubsubsubsubsubsubsubsubparagraaf} +\setinterfacevariable{subsubsubsubsubsubsubsubsubsubject}{subsubsubsubsubsubsubsubsubonderwerp} +\setinterfacevariable{sunday}{zondag} +\setinterfacevariable{support}{support} +\setinterfacevariable{sym}{sym} +\setinterfacevariable{symbol}{symbool} +\setinterfacevariable{synchronize}{synchroniseer} +\setinterfacevariable{system}{systeem} +\setinterfacevariable{table}{tabel} +\setinterfacevariable{tablehead}{tabelkop} +\setinterfacevariable{tables}{tabellen} +\setinterfacevariable{tabletail}{tabelstaart} +\setinterfacevariable{tabulate}{tabulatie} +\setinterfacevariable{tabulatehead}{tabulatiekop} +\setinterfacevariable{tabulatetail}{tabulatiestaart} +\setinterfacevariable{tall}{lang} +\setinterfacevariable{teletype}{teletype} +\setinterfacevariable{temporary}{voorlopig} +\setinterfacevariable{test}{test} +\setinterfacevariable{text}{tekst} +\setinterfacevariable{three}{drie} +\setinterfacevariable{thursday}{donderdag} +\setinterfacevariable{title}{titel} +\setinterfacevariable{toggle}{toggle} +\setinterfacevariable{tolerant}{soepel} +\setinterfacevariable{top}{boven} +\setinterfacevariable{tuesday}{dinsdag} +\setinterfacevariable{two}{twee} +\setinterfacevariable{txt}{txt} +\setinterfacevariable{type}{type} +\setinterfacevariable{typing}{typen} +\setinterfacevariable{unavailable}{nietbeschikbaar} +\setinterfacevariable{underbar}{onderstreep} +\setinterfacevariable{underbars}{onderstrepen} +\setinterfacevariable{unit}{eenheid} +\setinterfacevariable{units}{eenheden} +\setinterfacevariable{unknown}{onbekend} +\setinterfacevariable{unpacked}{vanelkaar} +\setinterfacevariable{up}{omhoog} +\setinterfacevariable{url}{url} +\setinterfacevariable{used}{gebruikt} +\setinterfacevariable{value}{waarde} +\setinterfacevariable{vertical}{vertikaal} +\setinterfacevariable{very}{zeer} +\setinterfacevariable{verystrict}{zeerstreng} +\setinterfacevariable{verytolerant}{zeersoepel} +\setinterfacevariable{weak}{zwak} +\setinterfacevariable{wednesday}{woensdag} +\setinterfacevariable{week}{week} +\setinterfacevariable{weekday}{weekdag} +\setinterfacevariable{white}{wit} +\setinterfacevariable{wide}{breed} +\setinterfacevariable{width}{breedte} +\setinterfacevariable{xml}{xml} +\setinterfacevariable{year}{jaar} +\setinterfacevariable{yes}{ja} +% definitions for interface constants for language nl +% +\setinterfaceconstant{action}{actie} +\setinterfaceconstant{address}{adres} +\setinterfaceconstant{after}{na} +\setinterfaceconstant{afterhead}{kopna} +\setinterfaceconstant{afterkey}{natoets} +\setinterfaceconstant{aftersection}{nasectie} +\setinterfaceconstant{align}{uitlijnen} +\setinterfaceconstant{aligncharacter}{karakteruitlijnen} +\setinterfaceconstant{alignmentcharacter}{uitlijnkarakter} +\setinterfaceconstant{alignsymbol}{alignsymbol} +\setinterfaceconstant{aligntitle}{titeluitlijnen} +\setinterfaceconstant{alternative}{variant} +\setinterfaceconstant{andtext}{andtext} +\setinterfaceconstant{apa}{apa} +\setinterfaceconstant{arrow}{pijl} +\setinterfaceconstant{artauthor}{artauthor} +\setinterfaceconstant{artauthoretaldisplay}{artauthoretaldisplay} +\setinterfaceconstant{artauthoretallimit}{artauthoretallimit} +\setinterfaceconstant{artauthoretaltext}{artauthoretaltext} +\setinterfaceconstant{at}{op} +\setinterfaceconstant{author}{auteur} +\setinterfaceconstant{authoretaldisplay}{authoretaldisplay} +\setinterfaceconstant{authoretallimit}{authoretallimit} +\setinterfaceconstant{authoretaltext}{authoretaltext} +\setinterfaceconstant{auto}{auto} +\setinterfaceconstant{autocase}{autocase} +\setinterfaceconstant{autofile}{autofile} +\setinterfaceconstant{autofocus}{autofocus} +\setinterfaceconstant{autohang}{autohang} +\setinterfaceconstant{autostrut}{autostrut} +\setinterfaceconstant{autowidth}{autobreedte} +\setinterfaceconstant{axis}{assenstelsel} +\setinterfaceconstant{background}{achtergrond} +\setinterfaceconstant{backgroundcolor}{achtergrondkleur} +\setinterfaceconstant{backgroundcorner}{achtergrondhoek} +\setinterfaceconstant{backgrounddepth}{achtergronddiepte} +\setinterfaceconstant{backgroundoffset}{achtergrondoffset} +\setinterfaceconstant{backgroundradius}{achtergrondstraal} +\setinterfaceconstant{backgroundscreen}{achtergrondraster} +\setinterfaceconstant{backreference}{terugreferentie} +\setinterfaceconstant{backspace}{rugwit} +\setinterfaceconstant{balance}{balanceren} +\setinterfaceconstant{before}{voor} +\setinterfaceconstant{beforehead}{kopvoor} +\setinterfaceconstant{beforesection}{voorsectie} +\setinterfaceconstant{bet}{bet} +\setinterfaceconstant{big}{groot} +\setinterfaceconstant{blank}{blanko} +\setinterfaceconstant{blockway}{blokwijze} +\setinterfaceconstant{bodyfont}{korps} +\setinterfaceconstant{bookmark}{bookmark} +\setinterfaceconstant{bottom}{onder} +\setinterfaceconstant{bottomafter}{bottomafter} +\setinterfaceconstant{bottombefore}{bottombefore} +\setinterfaceconstant{bottomdistance}{onderafstand} +\setinterfaceconstant{bottomframe}{onderkader} +\setinterfaceconstant{bottomoffset}{onderoffset} +\setinterfaceconstant{bottomspace}{bodemwit} +\setinterfaceconstant{bottomstate}{onderstatus} +\setinterfaceconstant{buffer}{buffer} +\setinterfaceconstant{cache}{cache} +\setinterfaceconstant{calculate}{bereken} +\setinterfaceconstant{category}{categorie} +\setinterfaceconstant{ccommand}{ccommando} +\setinterfaceconstant{click}{klik} +\setinterfaceconstant{clickin}{klikin} +\setinterfaceconstant{clickout}{klikuit} +\setinterfaceconstant{clipoffset}{clipoffset} +\setinterfaceconstant{closeaction}{sluitactie} +\setinterfaceconstant{closecommand}{sluitcommando} +\setinterfaceconstant{closepage}{sluitpagina} +\setinterfaceconstant{closepageaction}{sluitpaginaactie} +\setinterfaceconstant{closesymbol}{sluitsymbool} +\setinterfaceconstant{color}{kleur} +\setinterfaceconstant{column}{kolom} +\setinterfaceconstant{columndistance}{kolomafstand} +\setinterfaceconstant{columns}{kolommen} +\setinterfaceconstant{command}{commando} +\setinterfaceconstant{commandafter}{nacommando} +\setinterfaceconstant{commandbefore}{voorcommando} +\setinterfaceconstant{commands}{commandos} +\setinterfaceconstant{component}{component} +\setinterfaceconstant{compoundhyphen}{koppelteken} +\setinterfaceconstant{compress}{comprimeren} +\setinterfaceconstant{connector}{connector} +\setinterfaceconstant{continue}{doorgaan} +\setinterfaceconstant{contrastcolor}{contrastkleur} +\setinterfaceconstant{controls}{sturing} +\setinterfaceconstant{conversion}{conversie} +\setinterfaceconstant{convertfile}{converteerfile} +\setinterfaceconstant{corner}{hoek} +\setinterfaceconstant{coupling}{koppeling} +\setinterfaceconstant{couplingway}{koppelwijze} +\setinterfaceconstant{criterium}{criterium} +\setinterfaceconstant{current}{huidige} +\setinterfaceconstant{cutspace}{snijwit} +\setinterfaceconstant{dash}{streep} +\setinterfaceconstant{dat}{dat} +\setinterfaceconstant{database}{database} +\setinterfaceconstant{date}{datum} +\setinterfaceconstant{deepnumbercommand}{diepnummercommando} +\setinterfaceconstant{deeptextcommand}{dieptekstcommando} +\setinterfaceconstant{default}{default} +\setinterfaceconstant{delay}{wachttijd} +\setinterfaceconstant{depth}{diepte} +\setinterfaceconstant{depthcorrection}{dieptecorrectie} +\setinterfaceconstant{direction}{richting} +\setinterfaceconstant{directory}{gebied} +\setinterfaceconstant{display}{scherm} +\setinterfaceconstant{distance}{afstand} +\setinterfaceconstant{dot}{punt} +\setinterfaceconstant{doublesided}{dubbelzijdig} +\setinterfaceconstant{dummy}{dummy} +\setinterfaceconstant{dx}{dx} +\setinterfaceconstant{dy}{dy} +\setinterfaceconstant{edge}{rand} +\setinterfaceconstant{edgedistance}{randafstand} +\setinterfaceconstant{editor}{editor} +\setinterfaceconstant{editoretaldisplay}{editoretaldisplay} +\setinterfaceconstant{editoretallimit}{editoretallimit} +\setinterfaceconstant{editoretaltext}{editoretaltext} +\setinterfaceconstant{empty}{leeg} +\setinterfaceconstant{entries}{ingangen} +\setinterfaceconstant{equalheight}{equalheight} +\setinterfaceconstant{equalwidth}{equalwidth} +\setinterfaceconstant{escape}{escape} +\setinterfaceconstant{evenmargin}{evenmarge} +\setinterfaceconstant{expansion}{expansie} +\setinterfaceconstant{export}{exporteer} +\setinterfaceconstant{extras}{extras} +\setinterfaceconstant{factor}{factor} +\setinterfaceconstant{fallback}{terugval} +\setinterfaceconstant{family}{soort} +\setinterfaceconstant{fieldbackgroundcolor}{veldachtergrondkleur} +\setinterfaceconstant{fieldframecolor}{veldkaderkleur} +\setinterfaceconstant{fieldlayer}{veldlaag} +\setinterfaceconstant{fieldoffset}{veldoffset} +\setinterfaceconstant{file}{file} +\setinterfaceconstant{filtercommand}{filtercommand} +\setinterfaceconstant{finalnamesep}{finalnamesep} +\setinterfaceconstant{firstnamesep}{firstnamesep} +\setinterfaceconstant{focus}{focus} +\setinterfaceconstant{focusin}{focusin} +\setinterfaceconstant{focusout}{focusuit} +\setinterfaceconstant{footer}{voet} +\setinterfaceconstant{footerdistance}{voetafstand} +\setinterfaceconstant{footerstate}{voetstatus} +\setinterfaceconstant{force}{forceer} +\setinterfaceconstant{foregroundcolor}{voorgrondkleur} +\setinterfaceconstant{foregroundstyle}{voorgrondletter} +\setinterfaceconstant{format}{formatteer} +\setinterfaceconstant{frame}{kader} +\setinterfaceconstant{framecolor}{kaderkleur} +\setinterfaceconstant{framecorner}{kaderhoek} +\setinterfaceconstant{framedepth}{kaderdiepte} +\setinterfaceconstant{frameoffset}{kaderoffset} +\setinterfaceconstant{frameradius}{kaderstraal} +\setinterfaceconstant{frames}{hokjes} +\setinterfaceconstant{from}{van} +\setinterfaceconstant{get}{haal} +\setinterfaceconstant{global}{globaal} +\setinterfaceconstant{grid}{grid} +\setinterfaceconstant{hang}{hang} +\setinterfaceconstant{headalign}{kopuitlijnen} +\setinterfaceconstant{headcolor}{kopkleur} +\setinterfaceconstant{headcommand}{kopcommando} +\setinterfaceconstant{headconversion}{kopconversie} +\setinterfaceconstant{header}{hoofd} +\setinterfaceconstant{headerdistance}{hoofdafstand} +\setinterfaceconstant{headerstate}{hoofdstatus} +\setinterfaceconstant{headlabel}{koplabel} +\setinterfaceconstant{headnumber}{kopnummer} +\setinterfaceconstant{headstyle}{kopletter} +\setinterfaceconstant{height}{hoogte} +\setinterfaceconstant{hfactor}{hfactor} +\setinterfaceconstant{hfil}{hfil} +\setinterfaceconstant{hidenumber}{hidenumber} +\setinterfaceconstant{hoffset}{hoffset} +\setinterfaceconstant{horoffset}{rugoffset} +\setinterfaceconstant{hyphen}{hyphen} +\setinterfaceconstant{icommand}{icommando} +\setinterfaceconstant{in}{in} +\setinterfaceconstant{inbetween}{tussen} +\setinterfaceconstant{increment}{verhoog} +\setinterfaceconstant{incrementnumber}{verhoognummer} +\setinterfaceconstant{indenting}{inspringen} +\setinterfaceconstant{indentnext}{springvolgendein} +\setinterfaceconstant{indicator}{aanduiding} +\setinterfaceconstant{inner}{binnen} +\setinterfaceconstant{innermargin}{binnenmarge} +\setinterfaceconstant{inputfile}{inputfile} +\setinterfaceconstant{intent}{intent} +\setinterfaceconstant{interaction}{interactie} +\setinterfaceconstant{interlinespace}{interlinie} +\setinterfaceconstant{internalgrid}{interngrid} +\setinterfaceconstant{itemalign}{itemuitlijnen} +\setinterfaceconstant{items}{items} +\setinterfaceconstant{juniorsep}{juniorsep} +\setinterfaceconstant{ken}{ken} +\setinterfaceconstant{keyexpansion}{sleutelexpansie} +\setinterfaceconstant{keys}{sleutels} +\setinterfaceconstant{keyword}{trefwoord} +\setinterfaceconstant{label}{label} +\setinterfaceconstant{lastnamesep}{lastnamesep} +\setinterfaceconstant{lastpubsep}{lastpubsep} +\setinterfaceconstant{left}{links} +\setinterfaceconstant{leftcolor}{linkerkleur} +\setinterfaceconstant{leftcompoundhyphen}{linkerkoppelteken} +\setinterfaceconstant{leftedge}{linkerrand} +\setinterfaceconstant{leftedgedistance}{linkerrandafstand} +\setinterfaceconstant{leftframe}{linkerkader} +\setinterfaceconstant{lefthyphen}{lefthyphen} +\setinterfaceconstant{leftmargin}{linkermarge} +\setinterfaceconstant{leftmargindistance}{linkermargeafstand} +\setinterfaceconstant{leftoffset}{linkeroffset} +\setinterfaceconstant{leftquotation}{linkercitaat} +\setinterfaceconstant{leftquote}{linkerciteer} +\setinterfaceconstant{leftsentence}{linkerzin} +\setinterfaceconstant{leftspeech}{linkeruitspraak} +\setinterfaceconstant{leftstyle}{linkerletter} +\setinterfaceconstant{leftsubsentence}{linkersubzin} +\setinterfaceconstant{lefttext}{linkertekst} +\setinterfaceconstant{leftwidth}{linkerbreedte} +\setinterfaceconstant{level}{niveau} +\setinterfaceconstant{levels}{niveaus} +\setinterfaceconstant{limittext}{limiettekst} +\setinterfaceconstant{line}{regel} +\setinterfaceconstant{linecorrection}{regelcorrectie} +\setinterfaceconstant{lines}{regels} +\setinterfaceconstant{list}{lijst} +\setinterfaceconstant{listtext}{lijsttekst} +\setinterfaceconstant{local}{lokaal} +\setinterfaceconstant{location}{plaats} +\setinterfaceconstant{logo}{logo} +\setinterfaceconstant{logos}{logos} +\setinterfaceconstant{marcolor}{markleur} +\setinterfaceconstant{margin}{marge} +\setinterfaceconstant{margindistance}{margeafstand} +\setinterfaceconstant{marginedge}{kantlijn} +\setinterfaceconstant{marginedgetext}{kantlijntekst} +\setinterfaceconstant{margintext}{margetekst} +\setinterfaceconstant{marking}{markering} +\setinterfaceconstant{marstyle}{marletter} +\setinterfaceconstant{mask}{masker} +\setinterfaceconstant{max}{max} +\setinterfaceconstant{maxdepth}{maxdepth} +\setinterfaceconstant{maxheight}{maxhoogte} +\setinterfaceconstant{maxwidth}{maxbreedte} +\setinterfaceconstant{maybeyear}{maybeyear} +\setinterfaceconstant{menu}{menu} +\setinterfaceconstant{method}{methode} +\setinterfaceconstant{middle}{midden} +\setinterfaceconstant{middlespeech}{middenuitspraak} +\setinterfaceconstant{middletext}{middentekst} +\setinterfaceconstant{midsentence}{middenzin} +\setinterfaceconstant{min}{min} +\setinterfaceconstant{mindepth}{mindiepte} +\setinterfaceconstant{minheight}{minhoogte} +\setinterfaceconstant{minwidth}{minbreedte} +\setinterfaceconstant{monthconversion}{maandconversie} +\setinterfaceconstant{n}{n} +\setinterfaceconstant{name}{naam} +\setinterfaceconstant{namesep}{namesep} +\setinterfaceconstant{nbottom}{nonder} +\setinterfaceconstant{nc}{nc} +\setinterfaceconstant{next}{volgende} +\setinterfaceconstant{nl}{nl} +\setinterfaceconstant{nleft}{nlinks} +\setinterfaceconstant{nlines}{nregels} +\setinterfaceconstant{norm}{norm} +\setinterfaceconstant{nr}{nr} +\setinterfaceconstant{nright}{nrechts} +\setinterfaceconstant{ntop}{nboven} +\setinterfaceconstant{number}{nummer} +\setinterfaceconstant{numbercolor}{nummerkleur} +\setinterfaceconstant{numbercommand}{nummercommando} +\setinterfaceconstant{numberconversion}{numberconversion} +\setinterfaceconstant{numberconversionset}{numberconversionset} +\setinterfaceconstant{numberdistance}{nummerafstand} +\setinterfaceconstant{numbering}{nummeren} +\setinterfaceconstant{numberorder}{numberorder} +\setinterfaceconstant{numberprefix}{numberprefix} +\setinterfaceconstant{numbersegments}{numbersegments} +\setinterfaceconstant{numberseparator}{nummerscheider} +\setinterfaceconstant{numberseparatorset}{numberseparatorset} +\setinterfaceconstant{numberset}{numberset} +\setinterfaceconstant{numberstarter}{numberstarter} +\setinterfaceconstant{numberstopper}{numberstopper} +\setinterfaceconstant{numberstyle}{nummerletter} +\setinterfaceconstant{numberwidth}{nummerbreedte} +\setinterfaceconstant{nx}{nx} +\setinterfaceconstant{ny}{ny} +\setinterfaceconstant{object}{object} +\setinterfaceconstant{obstruction}{blokkade} +\setinterfaceconstant{oddmargin}{onevenmarge} +\setinterfaceconstant{offset}{offset} +\setinterfaceconstant{openaction}{openactie} +\setinterfaceconstant{openpage}{openpagina} +\setinterfaceconstant{openpageaction}{openpaginaactie} +\setinterfaceconstant{option}{optie} +\setinterfaceconstant{order}{order} +\setinterfaceconstant{orientation}{orientatie} +\setinterfaceconstant{otherstext}{otherstext} +\setinterfaceconstant{outermargin}{buitenmarge} +\setinterfaceconstant{overprint}{overprint} +\setinterfaceconstant{ownnumber}{eigennummer} +\setinterfaceconstant{page}{pagina} +\setinterfaceconstant{pageboundaries}{paginaovergangen} +\setinterfaceconstant{pagecolor}{paginakleur} +\setinterfaceconstant{pagecommand}{paginacommando} +\setinterfaceconstant{pageconversion}{pageconversion} +\setinterfaceconstant{pageconversionset}{pageconversionset} +\setinterfaceconstant{pagenumber}{paginanummer} +\setinterfaceconstant{pageprefix}{pageprefix} +\setinterfaceconstant{pageprefixconnector}{pageprefixconnector} +\setinterfaceconstant{pageprefixconversion}{pageprefixconversion} +\setinterfaceconstant{pageprefixconversionset}{pageprefixconversionset} +\setinterfaceconstant{pageprefixsegments}{pageprefixsegments} +\setinterfaceconstant{pageprefixseparatorset}{pageprefixseparatorset} +\setinterfaceconstant{pageprefixset}{pageprefixset} +\setinterfaceconstant{pageprefixstarter}{pageprefixstarter} +\setinterfaceconstant{pageprefixstopper}{pageprefixstopper} +\setinterfaceconstant{pagesegments}{pagesegments} +\setinterfaceconstant{pageseparatorset}{pageseparatorset} +\setinterfaceconstant{pageset}{pageset} +\setinterfaceconstant{pagestarter}{pagestarter} +\setinterfaceconstant{pagestate}{paginastatus} +\setinterfaceconstant{pagestopper}{pagestopper} +\setinterfaceconstant{pagestyle}{paginaletter} +\setinterfaceconstant{palet}{palet} +\setinterfaceconstant{paper}{papier} +\setinterfaceconstant{paragraph}{alinea} +\setinterfaceconstant{place}{plaatsen} +\setinterfaceconstant{placehead}{plaatskop} +\setinterfaceconstant{placestopper}{plaatsafsluiter} +\setinterfaceconstant{position}{positie} +\setinterfaceconstant{prefix}{prefix} +\setinterfaceconstant{prefixconnector}{prefixconnector} +\setinterfaceconstant{prefixconversion}{prefixconversion} +\setinterfaceconstant{prefixconversionset}{prefixconversionset} +\setinterfaceconstant{prefixsegments}{prefixsegments} +\setinterfaceconstant{prefixseparatorset}{prefixseparatorset} +\setinterfaceconstant{prefixset}{prefixset} +\setinterfaceconstant{prefixstarter}{prefixstarter} +\setinterfaceconstant{prefixstopper}{prefixstopper} +\setinterfaceconstant{preset}{preset} +\setinterfaceconstant{preview}{preview} +\setinterfaceconstant{previous}{vorige} +\setinterfaceconstant{previousnumber}{vorigenummer} +\setinterfaceconstant{process}{proces} +\setinterfaceconstant{profile}{profile} +\setinterfaceconstant{pubsep}{pubsep} +\setinterfaceconstant{radius}{straal} +\setinterfaceconstant{random}{willekeur} +\setinterfaceconstant{range}{bereik} +\setinterfaceconstant{reduction}{reductie} +\setinterfaceconstant{ref}{ref} +\setinterfaceconstant{refcommand}{refcommand} +\setinterfaceconstant{reference}{verwijzing} +\setinterfaceconstant{referenceprefix}{referenceprefix} +\setinterfaceconstant{referencing}{refereren} +\setinterfaceconstant{regionin}{gebiedin} +\setinterfaceconstant{regionout}{gebieduit} +\setinterfaceconstant{repeat}{herhaal} +\setinterfaceconstant{reset}{reset} +\setinterfaceconstant{resetnumber}{resetnummer} +\setinterfaceconstant{resolution}{resolutie} +\setinterfaceconstant{right}{rechts} +\setinterfaceconstant{rightcolor}{rechterkleur} +\setinterfaceconstant{rightcompoundhyphen}{rechterkoppelteken} +\setinterfaceconstant{rightedge}{rechterrand} +\setinterfaceconstant{rightedgedistance}{rechterrandafstand} +\setinterfaceconstant{rightframe}{rechterkader} +\setinterfaceconstant{righthyphen}{righthyphen} +\setinterfaceconstant{rightmargin}{rechtermarge} +\setinterfaceconstant{rightmargindistance}{rechtermargeafstand} +\setinterfaceconstant{rightoffset}{rechteroffset} +\setinterfaceconstant{rightquotation}{rechtercitaat} +\setinterfaceconstant{rightquote}{rechterciteer} +\setinterfaceconstant{rightsentence}{rechterzin} +\setinterfaceconstant{rightspeech}{rechteruitspraak} +\setinterfaceconstant{rightstyle}{rechterletter} +\setinterfaceconstant{rightsubsentence}{rechtersubzin} +\setinterfaceconstant{righttext}{rechtertekst} +\setinterfaceconstant{rightwidth}{rechterbreedte} +\setinterfaceconstant{rotation}{rotatie} +\setinterfaceconstant{rule}{lijn} +\setinterfaceconstant{rulecolor}{lijnkleur} +\setinterfaceconstant{rulethickness}{lijndikte} +\setinterfaceconstant{samepage}{zelfdepagina} +\setinterfaceconstant{sample}{monster} +\setinterfaceconstant{samplesize}{samplesize} +\setinterfaceconstant{saveinlist}{saveinlist} +\setinterfaceconstant{scale}{schaal} +\setinterfaceconstant{scope}{scope} +\setinterfaceconstant{screen}{raster} +\setinterfaceconstant{section}{sectie} +\setinterfaceconstant{sectionconversion}{sectionconversion} +\setinterfaceconstant{sectionconversionset}{sectionconversionset} +\setinterfaceconstant{sectionnumber}{sectienummer} +\setinterfaceconstant{sectionresetset}{sectionresetset} +\setinterfaceconstant{sectionsegments}{sectionsegments} +\setinterfaceconstant{sectionseparatorset}{sectionseparatorset} +\setinterfaceconstant{sectionset}{sectionset} +\setinterfaceconstant{sectionstarter}{sectionstarter} +\setinterfaceconstant{sectionstopper}{sectionstopper} +\setinterfaceconstant{separator}{scheider} +\setinterfaceconstant{set}{set} +\setinterfaceconstant{setups}{setups} +\setinterfaceconstant{side}{zij} +\setinterfaceconstant{sidealign}{zijuitlijnen} +\setinterfaceconstant{sidemethod}{zijmethode} +\setinterfaceconstant{sidespaceafter}{zijnawit} +\setinterfaceconstant{sidespacebefore}{zijvoorwit} +\setinterfaceconstant{sign}{teken} +\setinterfaceconstant{size}{formaat} +\setinterfaceconstant{small}{klein} +\setinterfaceconstant{sort}{sort} +\setinterfaceconstant{sorttype}{sortering} +\setinterfaceconstant{source}{bron} +\setinterfaceconstant{space}{spatie} +\setinterfaceconstant{spaceafter}{nawit} +\setinterfaceconstant{spacebefore}{voorwit} +\setinterfaceconstant{spaceinbetween}{tussenwit} +\setinterfaceconstant{spacing}{spatiering} +\setinterfaceconstant{split}{splitsen} +\setinterfaceconstant{splitcolor}{splitskleur} +\setinterfaceconstant{splitmethod}{splitsmethode} +\setinterfaceconstant{splitoffset}{splitsoffset} +\setinterfaceconstant{spot}{spot} +\setinterfaceconstant{stack}{stapel} +\setinterfaceconstant{start}{start} +\setinterfaceconstant{starter}{opener} +\setinterfaceconstant{state}{status} +\setinterfaceconstant{step}{stap} +\setinterfaceconstant{stop}{stop} +\setinterfaceconstant{stopper}{afsluiter} +\setinterfaceconstant{stretch}{rek} +\setinterfaceconstant{strip}{strip} +\setinterfaceconstant{strut}{strut} +\setinterfaceconstant{style}{letter} +\setinterfaceconstant{sub}{sub} +\setinterfaceconstant{subtitle}{subtitel} +\setinterfaceconstant{suffix}{suffix} +\setinterfaceconstant{suffixseparator}{suffixscheider} +\setinterfaceconstant{surnamesep}{surnamesep} +\setinterfaceconstant{sx}{sx} +\setinterfaceconstant{sy}{sy} +\setinterfaceconstant{symalign}{symuitlijnen} +\setinterfaceconstant{symbol}{symbool} +\setinterfaceconstant{symbolset}{symboolset} +\setinterfaceconstant{symcolor}{symkleur} +\setinterfaceconstant{symstyle}{symletter} +\setinterfaceconstant{synonym}{synoniem} +\setinterfaceconstant{synonymcolor}{synoniemkleur} +\setinterfaceconstant{synonymcommand}{synoniemcommando} +\setinterfaceconstant{synonymstyle}{synoniemletter} +\setinterfaceconstant{tab}{tab} +\setinterfaceconstant{text}{tekst} +\setinterfaceconstant{textcolor}{tekstkleur} +\setinterfaceconstant{textcommand}{tekstcommando} +\setinterfaceconstant{textdistance}{tekstafstand} +\setinterfaceconstant{textlayer}{tekstlaag} +\setinterfaceconstant{textmargin}{tekstmarge} +\setinterfaceconstant{textmethod}{tekstmethode} +\setinterfaceconstant{textseparator}{tekstscheider} +\setinterfaceconstant{textsize}{tekstformaat} +\setinterfaceconstant{textstate}{tekststatus} +\setinterfaceconstant{textstyle}{tekstletter} +\setinterfaceconstant{textwidth}{tekstbreedte} +\setinterfaceconstant{threshold}{threshold} +\setinterfaceconstant{title}{titel} +\setinterfaceconstant{titlecolor}{titelkleur} +\setinterfaceconstant{titlecommand}{titelcommando} +\setinterfaceconstant{titledistance}{titelafstand} +\setinterfaceconstant{titleleft}{titellinks} +\setinterfaceconstant{titleright}{titelrechts} +\setinterfaceconstant{titlestyle}{titelletter} +\setinterfaceconstant{to}{aan} +\setinterfaceconstant{tolerance}{tolerantie} +\setinterfaceconstant{top}{boven} +\setinterfaceconstant{topdistance}{bovenafstand} +\setinterfaceconstant{topframe}{bovenkader} +\setinterfaceconstant{topoffset}{bovenoffset} +\setinterfaceconstant{topspace}{kopwit} +\setinterfaceconstant{topstate}{bovenstatus} +\setinterfaceconstant{totalnumber}{totalnumber} +\setinterfaceconstant{type}{type} +\setinterfaceconstant{unit}{eenheid} +\setinterfaceconstant{unknownreference}{onbekendeverwijzing} +\setinterfaceconstant{urlalternative}{urlvariant} +\setinterfaceconstant{urlspace}{urlspatie} +\setinterfaceconstant{validate}{valideer} +\setinterfaceconstant{values}{waarden} +\setinterfaceconstant{vcommand}{vcommando} +\setinterfaceconstant{veroffset}{kopoffset} +\setinterfaceconstant{vfil}{vfil} +\setinterfaceconstant{voffset}{voffset} +\setinterfaceconstant{vonsep}{vonsep} +\setinterfaceconstant{way}{wijze} +\setinterfaceconstant{wfactor}{bfactor} +\setinterfaceconstant{white}{wit} +\setinterfaceconstant{width}{breedte} +\setinterfaceconstant{xfactor}{xfactor} +\setinterfaceconstant{xmax}{xmax} +\setinterfaceconstant{xoffset}{xoffset} +\setinterfaceconstant{xscale}{xschaal} +\setinterfaceconstant{xstep}{xstap} +\setinterfaceconstant{yfactor}{yfactor} +\setinterfaceconstant{ymax}{ymax} +\setinterfaceconstant{yoffset}{yoffset} +\setinterfaceconstant{yscale}{yschaal} +\setinterfaceconstant{ystep}{ystap} +% definitions for interface elements for language nl +% +\setinterfaceelement{answerlines}{antwoordregels} +\setinterfaceelement{answerspace}{antwoordruimte} +\setinterfaceelement{begin}{beginvan} +\setinterfaceelement{complete}{volledige} +\setinterfaceelement{coupled}{gekoppelde} +\setinterfaceelement{currentlocal}{huidigelokale} +\setinterfaceelement{emptyone}{leeg} +\setinterfaceelement{emptytwo}{lege} +\setinterfaceelement{end}{eindvan} +\setinterfaceelement{endsetup}{in} +\setinterfaceelement{get}{haal} +\setinterfaceelement{increment}{verhoog} +\setinterfaceelement{list}{lijst} +\setinterfaceelement{listof}{lijstmet} +\setinterfaceelement{load}{laad} +\setinterfaceelement{local}{lokale} +\setinterfaceelement{makeup}{opmaak} +\setinterfaceelement{next}{volgende} +\setinterfaceelement{place}{plaats} +\setinterfaceelement{previous}{vorige} +\setinterfaceelement{previouslocal}{vorigelokale} +\setinterfaceelement{reserve}{reserveer} +\setinterfaceelement{see}{zie} +\setinterfaceelement{setup}{stel} +\setinterfaceelement{start}{start} +\setinterfaceelement{stop}{stop} +\setinterfaceelement{text}{tekst} +\setinterfaceelement{type}{type} +% definitions for interface commands for language nl +% +\setinterfacecommand{CAPPED}{KAP} +\setinterfacecommand{Character}{Letter} +\setinterfacecommand{Characters}{Letters} +\setinterfacecommand{MONTH}{MAAND} +\setinterfacecommand{Numbers}{Cijfers} +\setinterfacecommand{Romannumerals}{Romeins} +\setinterfacecommand{SmallCapped}{Kap} +\setinterfacecommand{SmallCaps}{Kaps} +\setinterfacecommand{WEEKDAY}{WEEKDAG} +\setinterfacecommand{WORD}{WOORD} +\setinterfacecommand{WORDS}{WOORDEN} +\setinterfacecommand{Word}{Woord} +\setinterfacecommand{Words}{Woorden} +\setinterfacecommand{about}{about} +\setinterfacecommand{adaptlayout}{paslayoutaan} +\setinterfacecommand{arg}{arg} +\setinterfacecommand{at}{op} +\setinterfacecommand{atleftmargin}{oplinkermarge} +\setinterfacecommand{atpage}{oppagina} +\setinterfacecommand{atrightmargin}{oprechtermarge} +\setinterfacecommand{background}{achtergrond} +\setinterfacecommand{backspace}{rugwit} +\setinterfacecommand{blackrule}{blokje} +\setinterfacecommand{blackrules}{blokjes} +\setinterfacecommand{blank}{blanko} +\setinterfacecommand{bookmark}{bookmark} +\setinterfacecommand{bottomdistance}{onderafstand} +\setinterfacecommand{bottomheight}{onderhoogte} +\setinterfacecommand{bottomspace}{bodemwit} +\setinterfacecommand{but}{but} +\setinterfacecommand{button}{button} +\setinterfacecommand{bypassblocks}{passeerblokken} +\setinterfacecommand{character}{letter} +\setinterfacecommand{characters}{letters} +\setinterfacecommand{chem}{chem} +\setinterfacecommand{clip}{clip} +\setinterfacecommand{clonefield}{kloonveld} +\setinterfacecommand{color}{kleur} +\setinterfacecommand{colorbar}{kleurenbalk} +\setinterfacecommand{colorvalue}{kleurwaarde} +\setinterfacecommand{column}{kolom} +\setinterfacecommand{comparecolorgroup}{vergelijkkleurgroep} +\setinterfacecommand{comparepalet}{vergelijkpalet} +\setinterfacecommand{completepagenumber}{volledigepaginanummer} +\setinterfacecommand{completeregister}{volledigregister} +\setinterfacecommand{component}{onderdeel} +\setinterfacecommand{convertnumber}{converteernummer} +\setinterfacecommand{copyfield}{copieerveld} +\setinterfacecommand{correctwhitespace}{corrigeerwitruimte} +\setinterfacecommand{coupledocument}{koppeldocument} +\setinterfacecommand{couplemarking}{koppelmarkering} +\setinterfacecommand{couplepage}{koppelpagina} +\setinterfacecommand{couplepaper}{koppelpapier} +\setinterfacecommand{coupleregister}{koppelregister} +\setinterfacecommand{crlf}{crlf} +\setinterfacecommand{currentdate}{huidigedatum} +\setinterfacecommand{currentheadnumber}{huidigekopnummer} +\setinterfacecommand{cutspace}{snijwit} +\setinterfacecommand{date}{datum} +\setinterfacecommand{decouplemarking}{ontkoppelmarkering} +\setinterfacecommand{decrementnumber}{verlaagnummer} +\setinterfacecommand{define}{definieer} +\setinterfacecommand{defineaccent}{definieeraccent} +\setinterfacecommand{defineblank}{definieerblanko} +\setinterfacecommand{defineblock}{definieerblok} +\setinterfacecommand{definebodyfont}{definieerkorps} +\setinterfacecommand{definebodyfontenvironment}{definieerkorpsomgeving} +\setinterfacecommand{definebuffer}{definieerbuffer} +\setinterfacecommand{definecharacter}{definieerkarakter} +\setinterfacecommand{definecolor}{definieerkleur} +\setinterfacecommand{definecolorgroup}{definieerkleurgroep} +\setinterfacecommand{definecolumnbreak}{definieerkolomovergang} +\setinterfacecommand{definecolumnset}{definieerkolomgroep} +\setinterfacecommand{definecombination}{definieercombinatie} +\setinterfacecommand{definecombinedlist}{definieersamengesteldelijst} +\setinterfacecommand{definecommand}{definieercommando} +\setinterfacecommand{defineconversion}{definieerconversie} +\setinterfacecommand{definedescription}{doordefinieren} +\setinterfacecommand{defineenumeration}{doornummeren} +\setinterfacecommand{definefield}{definieerveld} +\setinterfacecommand{definefieldstack}{definieerveldstapel} +\setinterfacecommand{definefiguresymbol}{definieerfiguursymbool} +\setinterfacecommand{definefloat}{definieerplaatsblok} +\setinterfacecommand{definefont}{definieerfont} +\setinterfacecommand{definefontstyle}{definieerfontstijl} +\setinterfacecommand{definefontsynonym}{definieerfontsynoniem} +\setinterfacecommand{defineframed}{definieeromlijnd} +\setinterfacecommand{defineframedtext}{definieerkadertekst} +\setinterfacecommand{definehbox}{definieerhbox} +\setinterfacecommand{definehead}{definieerkop} +\setinterfacecommand{defineindenting}{doorspringen} +\setinterfacecommand{defineinmargin}{definieerinmarge} +\setinterfacecommand{defineinteractionmenu}{definieerinteractiemenu} +\setinterfacecommand{defineitemgroup}{definieeritemgroep} +\setinterfacecommand{definelabel}{doorlabelen} +\setinterfacecommand{definelayer}{definieerlayer} +\setinterfacecommand{definelayout}{definieerlayout} +\setinterfacecommand{definelist}{definieerlijst} +\setinterfacecommand{definelogo}{definieerbeeldmerk} +\setinterfacecommand{definemainfield}{definieerhoofdveld} +\setinterfacecommand{definemakeup}{definieeropmaak} +\setinterfacecommand{definemarking}{definieermarkering} +\setinterfacecommand{definemathalignment}{definieerwiskundeuitlijnen} +\setinterfacecommand{defineoutput}{definieeruitvoer} +\setinterfacecommand{defineoverlay}{definieeroverlay} +\setinterfacecommand{definepagebreak}{definieerpaginaovergang} +\setinterfacecommand{definepalet}{definieerpalet} +\setinterfacecommand{definepapersize}{definieerpapierformaat} +\setinterfacecommand{defineparagraphs}{definieeralineas} +\setinterfacecommand{defineplacement}{definieerplaats} +\setinterfacecommand{defineprofile}{definieerprofiel} +\setinterfacecommand{defineprogram}{definieerprogramma} +\setinterfacecommand{definerawfont}{definerawfont} +\setinterfacecommand{definereference}{definieerreferentie} +\setinterfacecommand{definereferenceformat}{definieerreferentieformaat} +\setinterfacecommand{definereferencelist}{definieerreferentielijst} +\setinterfacecommand{defineregister}{definieerregister} +\setinterfacecommand{definerule}{definieerlijn} +\setinterfacecommand{definesection}{definieersectie} +\setinterfacecommand{definesectionblock}{definieersectieblok} +\setinterfacecommand{definesorting}{definieersorteren} +\setinterfacecommand{definestartstop}{definieerstartstop} +\setinterfacecommand{definestyle}{definieerletter} +\setinterfacecommand{definesubfield}{definieersubveld} +\setinterfacecommand{definesymbol}{definieersymbool} +\setinterfacecommand{definesynonyms}{definieersynoniemen} +\setinterfacecommand{definetabletemplate}{definieertabelvorm} +\setinterfacecommand{definetabulate}{definieertabulatie} +\setinterfacecommand{definetext}{definieertekst} +\setinterfacecommand{definetextposition}{definieertekstpositie} +\setinterfacecommand{definetextvariable}{definieertekstvariabele} +\setinterfacecommand{definetype}{definieertype} +\setinterfacecommand{definetyping}{definieertypen} +\setinterfacecommand{defineversion}{definieerversie} +\setinterfacecommand{determineheadnumber}{bepaalkopnummer} +\setinterfacecommand{determinelistcharacteristics}{bepaallijstkenmerken} +\setinterfacecommand{determineregistercharacteristics}{bepaalregisterkenmerken} +\setinterfacecommand{dimension}{dimensie} +\setinterfacecommand{disableinteractionmenu}{blokkeerinteractiemenu} +\setinterfacecommand{domicile}{woonplaats} +\setinterfacecommand{donttest}{geentest} +\setinterfacecommand{edgedistance}{randafstand} +\setinterfacecommand{edgewidth}{randbreedte} +\setinterfacecommand{emptylines}{legeregels} +\setinterfacecommand{environment}{omgeving} +\setinterfacecommand{externalfigure}{externfiguur} +\setinterfacecommand{fact}{geg} +\setinterfacecommand{field}{veld} +\setinterfacecommand{fieldstack}{veldstapel} +\setinterfacecommand{fillinfield}{invulveld} +\setinterfacecommand{fillinline}{invulregel} +\setinterfacecommand{fillinrules}{invullijnen} +\setinterfacecommand{fillintext}{invultekst} +\setinterfacecommand{fitfield}{passendveld} +\setinterfacecommand{fixedspace}{vastespatie} +\setinterfacecommand{fixedspaces}{vastespaties} +\setinterfacecommand{followprofile}{volgprofiel} +\setinterfacecommand{followprofileversion}{volgprofielversie} +\setinterfacecommand{followversion}{volgversie} +\setinterfacecommand{footerdistance}{voetafstand} +\setinterfacecommand{footerheight}{voethoogte} +\setinterfacecommand{footnote}{voetnoot} +\setinterfacecommand{footnotetext}{voetnoottekst} +\setinterfacecommand{forceblocks}{forceerblokken} +\setinterfacecommand{formulanumber}{formulenummer} +\setinterfacecommand{fraction}{breuk} +\setinterfacecommand{framed}{omlijnd} +\setinterfacecommand{from}{uit} +\setinterfacecommand{getbuffer}{haalbuffer} +\setinterfacecommand{getmarking}{haalmarkering} +\setinterfacecommand{getnumber}{haalnummer} +\setinterfacecommand{godown}{omlaag} +\setinterfacecommand{goto}{naar} +\setinterfacecommand{gotobox}{naarbox} +\setinterfacecommand{gotopage}{naarpagina} +\setinterfacecommand{graycolor}{grijskleur} +\setinterfacecommand{greyvalue}{grijswaarde} +\setinterfacecommand{grid}{rooster} +\setinterfacecommand{hairline}{haarlijn} +\setinterfacecommand{head}{kop} +\setinterfacecommand{headerdistance}{hoofdafstand} +\setinterfacecommand{headerheight}{hoofdhoogte} +\setinterfacecommand{headlevel}{kopniveau} +\setinterfacecommand{headnumber}{kopnummer} +\setinterfacecommand{headsym}{kopsym} +\setinterfacecommand{headtext}{koptekst} +\setinterfacecommand{hideblocks}{verbergblokken} +\setinterfacecommand{high}{hoog} +\setinterfacecommand{hl}{hl} +\setinterfacecommand{immediatebetweenlist}{directtussenlijst} +\setinterfacecommand{immediatetolist}{directnaarlijst} +\setinterfacecommand{in}{in} +\setinterfacecommand{incrementnumber}{verhoognummer} +\setinterfacecommand{indenting}{inspringen} +\setinterfacecommand{inframed}{inlijnd} +\setinterfacecommand{infull}{voluit} +\setinterfacecommand{ininner}{inbinnen} +\setinterfacecommand{inleft}{inlinker} +\setinterfacecommand{inleftedge}{inlinkerrand} +\setinterfacecommand{inleftmargin}{inlinkermarge} +\setinterfacecommand{inline}{inregel} +\setinterfacecommand{inmargin}{inmarge} +\setinterfacecommand{inmframed}{inwilijnd} +\setinterfacecommand{inneredgedistance}{binnenrandafstand} +\setinterfacecommand{inneredgewidth}{binnenrandbreedte} +\setinterfacecommand{innermargindistance}{binnenmargeafstand} +\setinterfacecommand{innermarginwidth}{binnenmargebreedte} +\setinterfacecommand{inothermargin}{inanderemarge} +\setinterfacecommand{inouter}{inbuiten} +\setinterfacecommand{inright}{inrechter} +\setinterfacecommand{inrightedge}{inrechterrand} +\setinterfacecommand{inrightmargin}{inrechtermarge} +\setinterfacecommand{installlanguage}{installeertaal} +\setinterfacecommand{interactionbar}{interactiebalk} +\setinterfacecommand{interactionbuttons}{interactiebuttons} +\setinterfacecommand{interactionmenu}{interactiemenu} +\setinterfacecommand{item}{som} +\setinterfacecommand{items}{items} +\setinterfacecommand{its}{its} +\setinterfacecommand{keepblocks}{handhaafblokken} +\setinterfacecommand{label}{label} +\setinterfacecommand{labels}{labels} +\setinterfacecommand{labeltext}{labeltekst} +\setinterfacecommand{language}{taal} +\setinterfacecommand{leftaligned}{regellinks} +\setinterfacecommand{leftedgedistance}{linkerrandafstand} +\setinterfacecommand{leftedgewidth}{linkerrandbreedte} +\setinterfacecommand{leftmargindistance}{linkermargeafstand} +\setinterfacecommand{leftmarginwidth}{linkermargebreedte} +\setinterfacecommand{leg}{leg} +\setinterfacecommand{linewidth}{lijndikte} +\setinterfacecommand{listheight}{lijsthoogte} +\setinterfacecommand{listlength}{lijstlengte} +\setinterfacecommand{listsymbol}{lijstsymbool} +\setinterfacecommand{listwidth}{lijstbreedte} +\setinterfacecommand{logfields}{registreervelden} +\setinterfacecommand{lohi}{laho} +\setinterfacecommand{low}{laag} +\setinterfacecommand{macroname}{naam} +\setinterfacecommand{mainlanguage}{hoofdtaal} +\setinterfacecommand{makeupheight}{zethoogte} +\setinterfacecommand{makeupwidth}{zetbreedte} +\setinterfacecommand{mar}{mar} +\setinterfacecommand{margindistance}{margeafstand} +\setinterfacecommand{marginrule}{kantlijn} +\setinterfacecommand{margintext}{margetekst} +\setinterfacecommand{margintitle}{margetitel} +\setinterfacecommand{marginwidth}{margebreedte} +\setinterfacecommand{marginword}{margewoord} +\setinterfacecommand{marking}{markeer} +\setinterfacecommand{markversion}{markeerversie} +\setinterfacecommand{mathematics}{wiskunde} +\setinterfacecommand{menubutton}{menubutton} +\setinterfacecommand{mframed}{wilijnd} +\setinterfacecommand{midaligned}{regelmidden} +\setinterfacecommand{mirror}{spiegel} +\setinterfacecommand{month}{maand} +\setinterfacecommand{moveformula}{verplaatsformule} +\setinterfacecommand{moveongrid}{verplaatsopgrid} +\setinterfacecommand{movesidefloat}{verplaatszijblok} +\setinterfacecommand{navigating}{navigerend} +\setinterfacecommand{nodimension}{geendimensie} +\setinterfacecommand{noheaderandfooterlines}{geenhoofdenvoetregels} +\setinterfacecommand{noindenting}{nietinspringen} +\setinterfacecommand{nolist}{geenlijst} +\setinterfacecommand{nomarking}{geenmarkering} +\setinterfacecommand{nomoreblocks}{geenblokkenmeer} +\setinterfacecommand{nomorefiles}{geenfilesmeer} +\setinterfacecommand{nop}{nop} +\setinterfacecommand{nospace}{geenspatie} +\setinterfacecommand{note}{noot} +\setinterfacecommand{notopandbottomlines}{geenbovenenonderregels} +\setinterfacecommand{notsmallcapped}{nokap} +\setinterfacecommand{nowhitespace}{geenwitruimte} +\setinterfacecommand{numberofsubpages}{aantalsubpaginas} +\setinterfacecommand{numbers}{cijfers} +\setinterfacecommand{outeredgedistance}{buitenrandafstand} +\setinterfacecommand{outeredgewidth}{buitenrandbreedte} +\setinterfacecommand{outermargindistance}{buitenmargeafstand} +\setinterfacecommand{outermarginwidth}{buitenmargebreedte} +\setinterfacecommand{packed}{opelkaar} +\setinterfacecommand{page}{pagina} +\setinterfacecommand{pagedepth}{paginadiepte} +\setinterfacecommand{pagenumber}{paginanummer} +\setinterfacecommand{pageoffset}{paginaoffset} +\setinterfacecommand{pagereference}{paginareferentie} +\setinterfacecommand{pagetype}{soortpagina} +\setinterfacecommand{paperheight}{papierhoogte} +\setinterfacecommand{paperwidth}{papierbreedte} +\setinterfacecommand{periods}{punten} +\setinterfacecommand{plaatsruwelijst}{plaatsruwelijst} +\setinterfacecommand{placebookmarks}{plaatsbookmarks} +\setinterfacecommand{placecombinedlist}{plaatssamengesteldelijst} +\setinterfacecommand{placefloat}{plaatsplaatsblok} +\setinterfacecommand{placefootnotes}{plaatsvoetnoten} +\setinterfacecommand{placeformula}{plaatsformule} +\setinterfacecommand{placeheadnumber}{plaatskopnummer} +\setinterfacecommand{placeheadtext}{plaatskoptekst} +\setinterfacecommand{placelegend}{plaatslegenda} +\setinterfacecommand{placelist}{plaatslijst} +\setinterfacecommand{placelocalfootnotes}{plaatslokalevoetnoten} +\setinterfacecommand{placelogos}{plaatsbeeldmerken} +\setinterfacecommand{placeongrid}{plaatsopgrid} +\setinterfacecommand{placeontopofeachother}{plaatsonderelkaar} +\setinterfacecommand{placepagenumber}{plaatspaginanummer} +\setinterfacecommand{placereferencelist}{plaatsreferentielijst} +\setinterfacecommand{placeregister}{plaatsregister} +\setinterfacecommand{placerule}{plaatslijn} +\setinterfacecommand{placesidebyside}{plaatsnaastelkaar} +\setinterfacecommand{placesubformula}{plaatssubformule} +\setinterfacecommand{placetextvariable}{plaatstekstvariabele} +\setinterfacecommand{position}{positioneer} +\setinterfacecommand{positiontext}{positioneertekst} +\setinterfacecommand{printpaperheight}{printpapierhoogte} +\setinterfacecommand{printpaperwidth}{printpapierbreedte} +\setinterfacecommand{processblocks}{verwerkblokken} +\setinterfacecommand{processpage}{verwerkpagina} +\setinterfacecommand{product}{produkt} +\setinterfacecommand{program}{programma} +\setinterfacecommand{project}{projekt} +\setinterfacecommand{publication}{publicatie} +\setinterfacecommand{quotation}{citaat} +\setinterfacecommand{quote}{citeer} +\setinterfacecommand{ran}{ran} +\setinterfacecommand{redo}{herhaal} +\setinterfacecommand{ref}{ref} +\setinterfacecommand{reference}{referentie} +\setinterfacecommand{referral}{kenmerk} +\setinterfacecommand{referraldate}{kenmerkdatum} +\setinterfacecommand{referring}{refereer} +\setinterfacecommand{remark}{toelichting} +\setinterfacecommand{reset}{reset} +\setinterfacecommand{resetmarking}{resetmarkering} +\setinterfacecommand{resetnumber}{resetnummer} +\setinterfacecommand{resettext}{resettekstinhoud} +\setinterfacecommand{rightaligned}{regelrechts} +\setinterfacecommand{rightedgedistance}{rechterrandafstand} +\setinterfacecommand{rightedgewidth}{rechterrandbreedte} +\setinterfacecommand{rightmargindistance}{rechtermargeafstand} +\setinterfacecommand{rightmarginwidth}{rechtermargebreedte} +\setinterfacecommand{romannumerals}{romeins} +\setinterfacecommand{rotate}{roteer} +\setinterfacecommand{scale}{schaal} +\setinterfacecommand{screen}{scherm} +\setinterfacecommand{selectblocks}{selecteerblokken} +\setinterfacecommand{selectpaper}{selecteerpapier} +\setinterfacecommand{selectversion}{selecteerversie} +\setinterfacecommand{setnumber}{setnummer} +\setinterfacecommand{settextcontent}{steltekstinhoudin} +\setinterfacecommand{settextvariable}{kentekstvariabeletoe} +\setinterfacecommand{setupalign}{steluitlijnenin} +\setinterfacecommand{setupanswerarea}{stelantwoordgebiedin} +\setinterfacecommand{setuparranging}{stelarrangerenin} +\setinterfacecommand{setupbackground}{stelachtergrondin} +\setinterfacecommand{setupbackgrounds}{stelachtergrondenin} +\setinterfacecommand{setupblackrules}{stelblokjesin} +\setinterfacecommand{setupblank}{stelblankoin} +\setinterfacecommand{setupblock}{stelblokin} +\setinterfacecommand{setupbodyfont}{stelkorpsin} +\setinterfacecommand{setupbodyfontenvironment}{stelkorpsomgevingin} +\setinterfacecommand{setupbottom}{stelonderin} +\setinterfacecommand{setupbottomtexts}{stelondertekstenin} +\setinterfacecommand{setupbuffer}{stelbufferin} +\setinterfacecommand{setupbuttons}{stelbuttonsin} +\setinterfacecommand{setupcapitals}{stelkapitalenin} +\setinterfacecommand{setupcaption}{stelblokkopjein} +\setinterfacecommand{setupcaptions}{stelblokkopjesin} +\setinterfacecommand{setupclipping}{stelclipin} +\setinterfacecommand{setupcolor}{stelkleurin} +\setinterfacecommand{setupcolors}{stelkleurenin} +\setinterfacecommand{setupcolumns}{stelkolommenin} +\setinterfacecommand{setupcolumnset}{stelkolomgroepin} +\setinterfacecommand{setupcolumnsetlines}{stelkolomgroepregelsin} +\setinterfacecommand{setupcolumnsetstart}{stelkolomgroepstartin} +\setinterfacecommand{setupcombinations}{stelcombinatiesin} +\setinterfacecommand{setupcombinedlist}{stelsamengesteldelijstin} +\setinterfacecommand{setupcomment}{stelcommentaarin} +\setinterfacecommand{setupdescriptions}{steldoordefinierenin} +\setinterfacecommand{setupenumerations}{steldoornummerenin} +\setinterfacecommand{setupexternalfigures}{stelexternefigurenin} +\setinterfacecommand{setupfield}{stelveldin} +\setinterfacecommand{setupfields}{stelveldenin} +\setinterfacecommand{setupfillinlines}{stelinvulregelsin} +\setinterfacecommand{setupfillinrules}{stelinvullijnenin} +\setinterfacecommand{setupfloat}{stelplaatsblokin} +\setinterfacecommand{setupfloats}{stelplaatsblokkenin} +\setinterfacecommand{setupfloatsplitting}{stelplaatsbloksplitsenin} +\setinterfacecommand{setupfooter}{stelvoetin} +\setinterfacecommand{setupfootertexts}{stelvoettekstenin} +\setinterfacecommand{setupfootnotedefinition}{stelvoetnootdefinitiein} +\setinterfacecommand{setupfootnotes}{stelvoetnotenin} +\setinterfacecommand{setupforms}{stelformulierenin} +\setinterfacecommand{setupformulas}{stelformulesin} +\setinterfacecommand{setupframed}{stelomlijndin} +\setinterfacecommand{setupframedtexts}{stelkadertekstenin} +\setinterfacecommand{setuphead}{stelkopin} +\setinterfacecommand{setupheader}{stelhoofdin} +\setinterfacecommand{setupheadertexts}{stelhoofdtekstenin} +\setinterfacecommand{setupheadnumber}{stelkopnummerin} +\setinterfacecommand{setupheads}{stelkoppenin} +\setinterfacecommand{setupheadtext}{stelkoptekstin} +\setinterfacecommand{setuphyphenmark}{stelkoppeltekenin} +\setinterfacecommand{setupindentations}{steldoorspringenin} +\setinterfacecommand{setupindenting}{stelinspringenin} +\setinterfacecommand{setupinmargin}{stelinmargein} +\setinterfacecommand{setupinteraction}{stelinteractiein} +\setinterfacecommand{setupinteractionbar}{stelinteractiebalkin} +\setinterfacecommand{setupinteractionmenu}{stelinteractiemenuin} +\setinterfacecommand{setupinteractionscreen}{stelinteractieschermin} +\setinterfacecommand{setupinterlinespace}{stelinterliniein} +\setinterfacecommand{setupitemgroup}{stelitemgroepin} +\setinterfacecommand{setupitemgroups}{stelopsommingenin} +\setinterfacecommand{setupitems}{stelitemsin} +\setinterfacecommand{setuplabeltext}{stellabeltekstin} +\setinterfacecommand{setuplanguage}{steltaalin} +\setinterfacecommand{setuplayout}{stellayoutin} +\setinterfacecommand{setuplegend}{stellegendain} +\setinterfacecommand{setuplinenumbering}{stelregelnummerenin} +\setinterfacecommand{setuplines}{stelregelsin} +\setinterfacecommand{setuplinewidth}{stellijndiktein} +\setinterfacecommand{setuplist}{stellijstin} +\setinterfacecommand{setupmakeup}{stelopmaakin} +\setinterfacecommand{setupmarginblocks}{stelmargeblokkenin} +\setinterfacecommand{setupmarginrules}{stelkantlijnin} +\setinterfacecommand{setupmarking}{stelmarkeringin} +\setinterfacecommand{setupmathalignment}{stelwiskundeuitlijnenin} +\setinterfacecommand{setupnarrower}{stelsmallerin} +\setinterfacecommand{setupnumber}{stelnummerin} +\setinterfacecommand{setupnumbering}{stelnummerenin} +\setinterfacecommand{setupoppositeplacing}{stelnaastplaatsenin} +\setinterfacecommand{setupoutput}{steluitvoerin} +\setinterfacecommand{setuppagecomment}{stelpaginacommentaarin} +\setinterfacecommand{setuppagenumber}{stelpaginanummerin} +\setinterfacecommand{setuppagenumbering}{stelpaginanummeringin} +\setinterfacecommand{setuppagetransitions}{stelpaginaovergangenin} +\setinterfacecommand{setuppalet}{stelpaletin} +\setinterfacecommand{setuppaper}{stelpapierin} +\setinterfacecommand{setuppapersize}{stelpapierformaatin} +\setinterfacecommand{setupparagraphnumbering}{stelparagraafnummerenin} +\setinterfacecommand{setupparagraphs}{stelalineasin} +\setinterfacecommand{setupplacement}{stelplaatsin} +\setinterfacecommand{setuppositioning}{stelpositionerenin} +\setinterfacecommand{setupprofiles}{stelprofielenin} +\setinterfacecommand{setupprograms}{stelprogrammasin} +\setinterfacecommand{setuppublications}{stelpublicatiesin} +\setinterfacecommand{setupquote}{stelciterenin} +\setinterfacecommand{setupreferencelist}{stelreferentielijstin} +\setinterfacecommand{setupreferencing}{stelrefererenin} +\setinterfacecommand{setupregister}{stelregisterin} +\setinterfacecommand{setuprotate}{stelroterenin} +\setinterfacecommand{setuprule}{stellijnin} +\setinterfacecommand{setups}{instellingen} +\setinterfacecommand{setupscreens}{stelrastersin} +\setinterfacecommand{setupsection}{stelsectiein} +\setinterfacecommand{setupsectionblock}{stelsectieblokin} +\setinterfacecommand{setupsorting}{stelsorterenin} +\setinterfacecommand{setupspacing}{stelspatieringin} +\setinterfacecommand{setupstartstop}{stelstartstopin} +\setinterfacecommand{setupstrut}{stelstrutin} +\setinterfacecommand{setupsubpagenumber}{stelsubpaginanummerin} +\setinterfacecommand{setupsymbolset}{stelsymboolsetin} +\setinterfacecommand{setupsynchronization}{stelsynchronisatiein} +\setinterfacecommand{setupsynchronizationbar}{stelsynchronisatiebalkin} +\setinterfacecommand{setupsynonyms}{stelsynoniemenin} +\setinterfacecommand{setupsystem}{stelsysteemin} +\setinterfacecommand{setuptab}{steltabin} +\setinterfacecommand{setuptables}{steltabellenin} +\setinterfacecommand{setuptabulate}{steltabulatiein} +\setinterfacecommand{setuptext}{steltekstin} +\setinterfacecommand{setuptextposition}{steltekstpositiein} +\setinterfacecommand{setuptextrules}{steltekstlijnenin} +\setinterfacecommand{setuptexttexts}{stelteksttekstenin} +\setinterfacecommand{setuptextvariable}{steltekstvariabelein} +\setinterfacecommand{setupthinrules}{steldunnelijnenin} +\setinterfacecommand{setuptolerance}{steltolerantiein} +\setinterfacecommand{setuptop}{stelbovenin} +\setinterfacecommand{setuptoptexts}{stelboventekstenin} +\setinterfacecommand{setuptype}{steltypein} +\setinterfacecommand{setuptyping}{steltypenin} +\setinterfacecommand{setupunderbar}{stelonderstrepenin} +\setinterfacecommand{setupurl}{stelurlin} +\setinterfacecommand{setupversions}{stelversiesin} +\setinterfacecommand{setupwhitespace}{stelwitruimtein} +\setinterfacecommand{showbodyfont}{toonkorps} +\setinterfacecommand{showbodyfontenvironment}{toonkorpsomgeving} +\setinterfacecommand{showcolor}{toonkleur} +\setinterfacecommand{showcolorgroup}{toonkleurgroep} +\setinterfacecommand{showexternalfigures}{toonexternefiguren} +\setinterfacecommand{showfields}{toonvelden} +\setinterfacecommand{showframe}{toonkader} +\setinterfacecommand{showgrid}{toongrid} +\setinterfacecommand{showlayout}{toonlayout} +\setinterfacecommand{showmakeup}{toonopmaak} +\setinterfacecommand{showpalet}{toonpalet} +\setinterfacecommand{showprint}{toonprint} +\setinterfacecommand{showsetups}{tooninstellingen} +\setinterfacecommand{showstruts}{toonstruts} +\setinterfacecommand{showsymbolset}{toonsymboolset} +\setinterfacecommand{smallcapped}{kap} +\setinterfacecommand{someline}{eenregel} +\setinterfacecommand{somewhere}{ergens} +\setinterfacecommand{space}{spatie} +\setinterfacecommand{splitfloat}{splitsplaatsblok} +\setinterfacecommand{startalignment}{startuitlijnen} +\setinterfacecommand{startbackground}{startachtergrond} +\setinterfacecommand{startcoding}{startcodering} +\setinterfacecommand{startcolor}{startkleur} +\setinterfacecommand{startcolumnmakeup}{startkolomopmaak} +\setinterfacecommand{startcolumns}{startkolommen} +\setinterfacecommand{startcolumnset}{startkolomgroep} +\setinterfacecommand{startcombination}{startcombinatie} +\setinterfacecommand{startcomponent}{startonderdeel} +\setinterfacecommand{startdocument}{startdocument} +\setinterfacecommand{startenvironment}{startomgeving} +\setinterfacecommand{startfigure}{startfiguur} +\setinterfacecommand{startglobal}{startglobaal} +\setinterfacecommand{startline}{startregel} +\setinterfacecommand{startlinecorrection}{startregelcorrectie} +\setinterfacecommand{startlinenumbering}{startregelnummeren} +\setinterfacecommand{startlines}{startregels} +\setinterfacecommand{startlocal}{startlokaal} +\setinterfacecommand{startlocalfootnotes}{startlokalevoetnoten} +\setinterfacecommand{startmakeup}{startopmaak} +\setinterfacecommand{startmarginblock}{startmargeblok} +\setinterfacecommand{startmarginrule}{startkantlijn} +\setinterfacecommand{startnarrower}{startsmaller} +\setinterfacecommand{startopposite}{startnaast} +\setinterfacecommand{startoverlay}{startoverlay} +\setinterfacecommand{startoverzicht}{startoverzicht} +\setinterfacecommand{startpacked}{startopelkaar} +\setinterfacecommand{startpositioning}{startpositioneren} +\setinterfacecommand{startproduct}{startprodukt} +\setinterfacecommand{startprofile}{startprofiel} +\setinterfacecommand{startproject}{startprojekt} +\setinterfacecommand{startquotation}{startcitaat} +\setinterfacecommand{startraster}{startraster} +\setinterfacecommand{startsymbolset}{startsymboolset} +\setinterfacecommand{startsynchronization}{startsynchronisatie} +\setinterfacecommand{starttable}{starttabel} +\setinterfacecommand{starttables}{starttabellen} +\setinterfacecommand{starttext}{starttekst} +\setinterfacecommand{starttextrule}{starttekstlijn} +\setinterfacecommand{startunpacked}{startvanelkaar} +\setinterfacecommand{startversion}{startversie} +\setinterfacecommand{stopalignment}{stopuitlijnen} +\setinterfacecommand{stopbackground}{stopachtergrond} +\setinterfacecommand{stopcoding}{stopcodering} +\setinterfacecommand{stopcolor}{stopkleur} +\setinterfacecommand{stopcolumnmakeup}{stopkolomopmaak} +\setinterfacecommand{stopcolumns}{stopkolommen} +\setinterfacecommand{stopcolumnset}{stopkolomgroep} +\setinterfacecommand{stopcombination}{stopcombinatie} +\setinterfacecommand{stopcomponent}{stoponderdeel} +\setinterfacecommand{stopdocument}{stopdocument} +\setinterfacecommand{stopenvironment}{stopomgeving} +\setinterfacecommand{stopglobal}{stopglobaal} +\setinterfacecommand{stopline}{stopregel} +\setinterfacecommand{stoplinecorrection}{stopregelcorrectie} +\setinterfacecommand{stoplinenumbering}{stopregelnummeren} +\setinterfacecommand{stoplines}{stopregels} +\setinterfacecommand{stoplocal}{stoplokaal} +\setinterfacecommand{stoplocalfootnotes}{stoplokalevoetnoten} +\setinterfacecommand{stopmakeup}{stopopmaak} +\setinterfacecommand{stopmarginblock}{stopmargeblok} +\setinterfacecommand{stopmarginrule}{stopkantlijn} +\setinterfacecommand{stopnarrower}{stopsmaller} +\setinterfacecommand{stopopposite}{stopnaast} +\setinterfacecommand{stopoverlay}{stopoverlay} +\setinterfacecommand{stopoverzicht}{stopoverzicht} +\setinterfacecommand{stoppacked}{stopopelkaar} +\setinterfacecommand{stoppositioning}{stoppositioneren} +\setinterfacecommand{stopproduct}{stopprodukt} +\setinterfacecommand{stopprofile}{stopprofiel} +\setinterfacecommand{stopproject}{stopprojekt} +\setinterfacecommand{stopquotation}{stopcitaat} +\setinterfacecommand{stopraster}{stopraster} +\setinterfacecommand{stopsynchronization}{stopsynchronisatie} +\setinterfacecommand{stoptable}{stoptabel} +\setinterfacecommand{stoptables}{stoptabellen} +\setinterfacecommand{stoptext}{stoptekst} +\setinterfacecommand{stoptextrule}{stoptekstlijn} +\setinterfacecommand{stopunpacked}{stopvanelkaar} +\setinterfacecommand{stopversion}{stopversie} +\setinterfacecommand{stretched}{uitgerekt} +\setinterfacecommand{subformulanumber}{subformulenummer} +\setinterfacecommand{subpagenumber}{subpaginanummer} +\setinterfacecommand{switchtobodyfont}{switchnaarkorps} +\setinterfacecommand{switchtorawfont}{switchtorawfont} +\setinterfacecommand{sym}{sym} +\setinterfacecommand{symbol}{symbool} +\setinterfacecommand{synchronizationbar}{synchronisatiebalk} +\setinterfacecommand{synchronize}{synchroniseer} +\setinterfacecommand{tab}{tab} +\setinterfacecommand{testcolumn}{testkolom} +\setinterfacecommand{testpage}{testpagina} +\setinterfacecommand{tex}{tex} +\setinterfacecommand{textheight}{teksthoogte} +\setinterfacecommand{textreference}{tekstreferentie} +\setinterfacecommand{textrule}{tekstlijn} +\setinterfacecommand{textvariable}{tekstvariabele} +\setinterfacecommand{textwidth}{tekstbreedte} +\setinterfacecommand{thinrule}{dunnelijn} +\setinterfacecommand{thinrules}{dunnelijnen} +\setinterfacecommand{tooltip}{suggestie} +\setinterfacecommand{topdistance}{bovenafstand} +\setinterfacecommand{topheight}{bovenhoogte} +\setinterfacecommand{topspace}{kopwit} +\setinterfacecommand{totalnumberofpages}{totaalaantalpaginas} +\setinterfacecommand{translate}{vertaal} +\setinterfacecommand{txt}{txt} +\setinterfacecommand{typ}{typ} +\setinterfacecommand{type}{type} +\setinterfacecommand{typebuffer}{typebuffer} +\setinterfacecommand{typefile}{typefile} +\setinterfacecommand{unitmeaning}{betekenis} +\setinterfacecommand{unknown}{onbekend} +\setinterfacecommand{useJSscripts}{gebruikJSscripts} +\setinterfacecommand{useURL}{gebruikURL} +\setinterfacecommand{useXMLfilter}{gebruikXMLfilter} +\setinterfacecommand{useblocks}{gebruikblokken} +\setinterfacecommand{usecommands}{gebruikcommandos} +\setinterfacecommand{useencoding}{usecodering} +\setinterfacecommand{useexternaldocument}{gebruikexterndocument} +\setinterfacecommand{useexternalfigure}{gebruikexternfiguur} +\setinterfacecommand{useexternalfile}{gebruikexternefile} +\setinterfacecommand{useexternalfiles}{gebruikexternefiles} +\setinterfacecommand{useexternalsoundtrack}{gebruikexterngeluidsfragment} +\setinterfacecommand{usemodule}{gebruikmodule} +\setinterfacecommand{usemodules}{gebruikmodules} +\setinterfacecommand{usepath}{gebruikgebied} +\setinterfacecommand{usereferences}{gebruikreferenties} +\setinterfacecommand{usespecials}{gebruikspecials} +\setinterfacecommand{usesymbols}{gebruiksymbolen} +\setinterfacecommand{usetypescript}{gebruiktypescript} +\setinterfacecommand{usetypescriptfile}{gebruiktypescriptfile} +\setinterfacecommand{useurl}{gebruikurl} +\setinterfacecommand{version}{versie} +\setinterfacecommand{vl}{vl} +\setinterfacecommand{weekday}{weekdag} +\setinterfacecommand{whitespace}{witruimte} +\setinterfacecommand{wordright}{woordrechts} +\setinterfacecommand{writebetweenlist}{schrijftussenlijst} +\setinterfacecommand{writetolist}{schrijfnaarlijst} +\setinterfacecommand{writetoreferencelist}{schrijfnaarreferentielijst} +\setinterfacecommand{writetoregister}{schrijfnaarregister} +% +\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-nl.tex b/Master/texmf-dist/tex/context/base/mult-nl.tex deleted file mode 100644 index 074d5f3d5c0..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-nl.tex +++ /dev/null @@ -1,1693 +0,0 @@ -% this file is auto-generated, don't edit this file -% -% definitions for interface variables for language nl -% -\setinterfacevariable{Addition}{Toevoeging} -\setinterfacevariable{Balloon}{Ballon} -\setinterfacevariable{Character}{Letter} -\setinterfacevariable{Characters}{Letters} -\setinterfacevariable{CloseDocument}{SluitDocument} -\setinterfacevariable{ExitViewer}{VerlaatViewer} -\setinterfacevariable{FirstPage}{EerstePagina} -\setinterfacevariable{FitHeight}{HoogtePassend} -\setinterfacevariable{FitWidth}{BreedtePassend} -\setinterfacevariable{GotoPage}{GaNaarPagina} -\setinterfacevariable{Greek}{Grieks} -\setinterfacevariable{Help}{Help} -\setinterfacevariable{HideField}{VerbergVeld} -\setinterfacevariable{HideLayer}{VerbergLaag} -\setinterfacevariable{Key}{Sleutel} -\setinterfacevariable{LastPage}{LaatstePagina} -\setinterfacevariable{LoadForm}{LaadFormulier} -\setinterfacevariable{MONTH}{MAAND} -\setinterfacevariable{New}{Nieuw} -\setinterfacevariable{NextJump}{VolgendeSprong} -\setinterfacevariable{NextPage}{VolgendePagina} -\setinterfacevariable{Numbers}{Cijfers} -\setinterfacevariable{OpenNamedDocument}{OpenDocumentOpNaam} -\setinterfacevariable{Paragraph}{Paragraaf} -\setinterfacevariable{PauseMovie}{PauzeerFilm} -\setinterfacevariable{PauseRendering}{PauzeerRendering} -\setinterfacevariable{PauseSound}{PauzeerGeluid} -\setinterfacevariable{PreviousJump}{VorigeSprong} -\setinterfacevariable{PreviousPage}{VorigePagina} -\setinterfacevariable{PrintDocument}{PrintDocument} -\setinterfacevariable{Query}{RaadpleegDocument} -\setinterfacevariable{QueryAgain}{HerhaalRaadplegen} -\setinterfacevariable{ResetForm}{ResetFormulier} -\setinterfacevariable{ResumeMovie}{HervatFilm} -\setinterfacevariable{ResumeRendering}{HervatRendering} -\setinterfacevariable{ResumeSound}{HervatGeluid} -\setinterfacevariable{Romannumerals}{Romeins} -\setinterfacevariable{SaveDocument}{BewaarDocument} -\setinterfacevariable{SaveForm}{BewaarFormulier} -\setinterfacevariable{SaveNamedDocument}{BewaarDocumentOpNaam} -\setinterfacevariable{SearchAgain}{HerhaalZoeken} -\setinterfacevariable{SearchDocument}{DoorzoekDocument} -\setinterfacevariable{ShowBookmarks}{ShowBookmarks} -\setinterfacevariable{ShowField}{ToonVeld} -\setinterfacevariable{ShowThumbs}{ShowThumbs} -\setinterfacevariable{StartMovie}{StartFilm} -\setinterfacevariable{StartRendering}{StartRendering} -\setinterfacevariable{StartSound}{StartGeluid} -\setinterfacevariable{StopMovie}{StopFilm} -\setinterfacevariable{StopRendering}{StopRendering} -\setinterfacevariable{StopSound}{StopGeluid} -\setinterfacevariable{SubmitForm}{VerzendFormulier} -\setinterfacevariable{ToggleLayer}{WisselLaag} -\setinterfacevariable{ToggleViewer}{WisselViewer} -\setinterfacevariable{URL}{URL} -\setinterfacevariable{VideLayer}{ToonLaag} -\setinterfacevariable{ViewerHelp}{ViewerHelp} -\setinterfacevariable{WEEKDAY}{WEEKDAG} -\setinterfacevariable{WORD}{WOORD} -\setinterfacevariable{abbreviation}{afkorting} -\setinterfacevariable{abbreviations}{afkortingen} -\setinterfacevariable{absolute}{absoluut} -\setinterfacevariable{action}{actie} -\setinterfacevariable{after}{na} -\setinterfacevariable{all}{alles} -\setinterfacevariable{always}{altijd} -\setinterfacevariable{answerarea}{antwoordgebied} -\setinterfacevariable{appendices}{bijlagen} -\setinterfacevariable{appendix}{bijlage} -\setinterfacevariable{april}{april} -\setinterfacevariable{atmargin}{opmarge} -\setinterfacevariable{atpage}{oppagina} -\setinterfacevariable{august}{augustus} -\setinterfacevariable{author}{auteur} -\setinterfacevariable{auto}{auto} -\setinterfacevariable{autointro}{autointro} -\setinterfacevariable{back}{terug} -\setinterfacevariable{background}{achtergrond} -\setinterfacevariable{backmatter}{uitleidingen} -\setinterfacevariable{backpart}{uitleiding} -\setinterfacevariable{backspace}{rugwit} -\setinterfacevariable{backward}{achteruit} -\setinterfacevariable{bbl}{bbl} -\setinterfacevariable{before}{voor} -\setinterfacevariable{begin}{begin} -\setinterfacevariable{bib}{bib} -\setinterfacevariable{big}{groot} -\setinterfacevariable{bigbodyfont}{grootkorps} -\setinterfacevariable{bigpreference}{grotevoorkeur} -\setinterfacevariable{blank}{blanko} -\setinterfacevariable{blockquote}{blokcitaat} -\setinterfacevariable{bodymatter}{hoofdteksten} -\setinterfacevariable{bodypart}{hoofdtekst} -\setinterfacevariable{bold}{vet} -\setinterfacevariable{bolditalic}{vetitalic} -\setinterfacevariable{boldslanted}{vetschuin} -\setinterfacevariable{bookmark}{bookmark} -\setinterfacevariable{both}{beide} -\setinterfacevariable{bottom}{onder} -\setinterfacevariable{brief}{brief} -\setinterfacevariable{broad}{ruim} -\setinterfacevariable{buffer}{buffer} -\setinterfacevariable{by}{per} -\setinterfacevariable{calligraphic}{calligrafie} -\setinterfacevariable{cap}{kap} -\setinterfacevariable{capital}{kapitaal} -\setinterfacevariable{center}{centreer} -\setinterfacevariable{chapter}{hoofdstuk} -\setinterfacevariable{character}{letter} -\setinterfacevariable{characters}{letters} -\setinterfacevariable{cite}{cite} -\setinterfacevariable{color}{kleur} -\setinterfacevariable{column}{kolom} -\setinterfacevariable{columns}{kolommen} -\setinterfacevariable{command}{commando} -\setinterfacevariable{commands}{commandos} -\setinterfacevariable{comment}{commentaar} -\setinterfacevariable{component}{onderdeel} -\setinterfacevariable{concept}{concept} -\setinterfacevariable{content}{inhoud} -\setinterfacevariable{contents}{inhouden} -\setinterfacevariable{continue}{verder} -\setinterfacevariable{controls}{sturing} -\setinterfacevariable{conversion}{conversie} -\setinterfacevariable{current}{huidige} -\setinterfacevariable{cutspace}{snijwit} -\setinterfacevariable{date}{datum} -\setinterfacevariable{day}{dag} -\setinterfacevariable{december}{december} -\setinterfacevariable{default}{default} -\setinterfacevariable{depth}{diepte} -\setinterfacevariable{description}{doordefinitie} -\setinterfacevariable{disable}{blokkeer} -\setinterfacevariable{display}{scherm} -\setinterfacevariable{dot}{punt} -\setinterfacevariable{doublesided}{dubbelzijdig} -\setinterfacevariable{down}{omlaag} -\setinterfacevariable{each}{elk} -\setinterfacevariable{edge}{rand} -\setinterfacevariable{empty}{leeg} -\setinterfacevariable{end}{eind} -\setinterfacevariable{endnote}{eindnoot} -\setinterfacevariable{enumeration}{doornummering} -\setinterfacevariable{environment}{omgeving} -\setinterfacevariable{even}{even} -\setinterfacevariable{external}{extern} -\setinterfacevariable{fact}{gegeven} -\setinterfacevariable{february}{februari} -\setinterfacevariable{figure}{figuur} -\setinterfacevariable{figures}{figuren} -\setinterfacevariable{file}{file} -\setinterfacevariable{final}{definitief} -\setinterfacevariable{first}{eerste} -\setinterfacevariable{firstcolumn}{eerstekolom} -\setinterfacevariable{firstpage}{eerstepagina} -\setinterfacevariable{firstsubpage}{eerstesubpagina} -\setinterfacevariable{fit}{passend} -\setinterfacevariable{five}{vijf} -\setinterfacevariable{fix}{herstel} -\setinterfacevariable{fixed}{vast} -\setinterfacevariable{flexible}{flexibel} -\setinterfacevariable{float}{blok} -\setinterfacevariable{flushinner}{lijnbinnen} -\setinterfacevariable{flushleft}{lijnlinks} -\setinterfacevariable{flushouter}{lijnbuiten} -\setinterfacevariable{flushright}{lijnrechts} -\setinterfacevariable{footer}{voet} -\setinterfacevariable{footnote}{voetnoot} -\setinterfacevariable{force}{forceer} -\setinterfacevariable{foreground}{voorgrond} -\setinterfacevariable{formeel}{formeel} -\setinterfacevariable{formula}{formule} -\setinterfacevariable{formulae}{formules} -\setinterfacevariable{forward}{vooruit} -\setinterfacevariable{four}{vier} -\setinterfacevariable{frame}{kader} -\setinterfacevariable{framedtext}{kadertekst} -\setinterfacevariable{friday}{vrijdag} -\setinterfacevariable{frontmatter}{inleidingen} -\setinterfacevariable{frontpart}{inleiding} -\setinterfacevariable{global}{globaal} -\setinterfacevariable{graphic}{grafiek} -\setinterfacevariable{graphics}{grafieken} -\setinterfacevariable{gray}{grijs} -\setinterfacevariable{greek}{grieks} -\setinterfacevariable{grid}{grid} -\setinterfacevariable{halfline}{halveregel} -\setinterfacevariable{handwritten}{handschrift} -\setinterfacevariable{hang}{hang} -\setinterfacevariable{hanging}{hangend} -\setinterfacevariable{head}{kop} -\setinterfacevariable{header}{hoofd} -\setinterfacevariable{height}{hoogte} -\setinterfacevariable{helptext}{helptekst} -\setinterfacevariable{hencefore}{hierboven} -\setinterfacevariable{here}{hier} -\setinterfacevariable{hereafter}{hieronder} -\setinterfacevariable{hidden}{verborgen} -\setinterfacevariable{hiding}{verbergen} -\setinterfacevariable{high}{hoog} -\setinterfacevariable{horizontal}{horizontaal} -\setinterfacevariable{hyphenated}{afgebroken} -\setinterfacevariable{hz}{hz} -\setinterfacevariable{inbetween}{tussen} -\setinterfacevariable{index}{index} -\setinterfacevariable{indices}{indices} -\setinterfacevariable{informeel}{informeel} -\setinterfacevariable{inherit}{erf} -\setinterfacevariable{inleft}{inlinker} -\setinterfacevariable{inmargin}{inmarge} -\setinterfacevariable{inner}{binnen} -\setinterfacevariable{inneredge}{binnenrand} -\setinterfacevariable{innermargin}{binnenmarge} -\setinterfacevariable{inright}{inrechter} -\setinterfacevariable{interaction}{interactie} -\setinterfacevariable{interactionmenu}{interactiemenu} -\setinterfacevariable{intermezzi}{intermezzos} -\setinterfacevariable{intermezzo}{intermezzo} -\setinterfacevariable{intext}{intekst} -\setinterfacevariable{intro}{intro} -\setinterfacevariable{italic}{italic} -\setinterfacevariable{italicbold}{italicvet} -\setinterfacevariable{item}{som} -\setinterfacevariable{itemize}{opsomming} -\setinterfacevariable{its}{its} -\setinterfacevariable{january}{januari} -\setinterfacevariable{joinedup}{aansluitend} -\setinterfacevariable{july}{juli} -\setinterfacevariable{june}{juni} -\setinterfacevariable{keep}{handhaaf} -\setinterfacevariable{knockout}{knockout} -\setinterfacevariable{label}{label} -\setinterfacevariable{landscape}{liggend} -\setinterfacevariable{last}{laatste} -\setinterfacevariable{lastcolumn}{laatstekolom} -\setinterfacevariable{lastpage}{laatstepagina} -\setinterfacevariable{lastpagenumber}{laatstepaginanummer} -\setinterfacevariable{lastsubpage}{laatstesubpagina} -\setinterfacevariable{layer}{layer} -\setinterfacevariable{left}{links} -\setinterfacevariable{leftedge}{linkerrand} -\setinterfacevariable{lefthanging}{linkshangend} -\setinterfacevariable{leftmargin}{linkermarge} -\setinterfacevariable{leftpage}{linkerpagina} -\setinterfacevariable{lefttoright}{lefttoright} -\setinterfacevariable{legend}{legenda} -\setinterfacevariable{lesshyphenation}{lesshyphenation} -\setinterfacevariable{line}{regel} -\setinterfacevariable{linenote}{regelnoot} -\setinterfacevariable{lines}{regels} -\setinterfacevariable{list}{lijst} -\setinterfacevariable{local}{lokaal} -\setinterfacevariable{localenvironment}{deelomgeving} -\setinterfacevariable{logo}{logo} -\setinterfacevariable{logos}{logos} -\setinterfacevariable{lohi}{laho} -\setinterfacevariable{loose}{los} -\setinterfacevariable{low}{laag} -\setinterfacevariable{ls}{ls} -\setinterfacevariable{makeup}{opmaak} -\setinterfacevariable{mar}{mar} -\setinterfacevariable{march}{maart} -\setinterfacevariable{margin}{marge} -\setinterfacevariable{marginedge}{kantlijn} -\setinterfacevariable{margintitle}{margetitel} -\setinterfacevariable{marking}{markering} -\setinterfacevariable{mathalignment}{wiskundeuitlijnen} -\setinterfacevariable{mathcases}{mathcases} -\setinterfacevariable{mathmatrix}{wiskundematrix} -\setinterfacevariable{max}{max} -\setinterfacevariable{maxdepth}{maxdepth} -\setinterfacevariable{maxheight}{maxheight} -\setinterfacevariable{maxwidth}{maxwidth} -\setinterfacevariable{may}{mei} -\setinterfacevariable{mediaeval}{mediaeval} -\setinterfacevariable{medium}{middel} -\setinterfacevariable{middle}{midden} -\setinterfacevariable{min}{min} -\setinterfacevariable{mindepth}{mindepth} -\setinterfacevariable{minheight}{minhoogte} -\setinterfacevariable{minwidth}{minbreedte} -\setinterfacevariable{mirrored}{gespiegeld} -\setinterfacevariable{monday}{maandag} -\setinterfacevariable{mono}{mono} -\setinterfacevariable{month}{maand} -\setinterfacevariable{morehyphenation}{morehyphenation} -\setinterfacevariable{name}{naam} -\setinterfacevariable{narrow}{smal} -\setinterfacevariable{negative}{negatief} -\setinterfacevariable{never}{nooit} -\setinterfacevariable{new}{nieuw} -\setinterfacevariable{next}{volgende} -\setinterfacevariable{nextevenpage}{volgendeevenpagina} -\setinterfacevariable{nextoddpage}{volgendeonevenpagina} -\setinterfacevariable{nextpage}{volgendepagina} -\setinterfacevariable{nextsubpage}{volgendesubpagina} -\setinterfacevariable{no}{nee} -\setinterfacevariable{nocheck}{geencontrole} -\setinterfacevariable{nofit}{nietpassend} -\setinterfacevariable{nogrid}{geengrid} -\setinterfacevariable{nohz}{geenhz} -\setinterfacevariable{nomarking}{geenmarkering} -\setinterfacevariable{none}{geen} -\setinterfacevariable{nonumber}{geennummer} -\setinterfacevariable{normal}{normaal} -\setinterfacevariable{nospacing}{geenspatiering} -\setinterfacevariable{not}{niet} -\setinterfacevariable{note}{note} -\setinterfacevariable{nothanging}{niethangend} -\setinterfacevariable{nothyphenated}{nietafgebroken} -\setinterfacevariable{november}{november} -\setinterfacevariable{nowhere}{nergens} -\setinterfacevariable{nowhite}{geenwit} -\setinterfacevariable{number}{nummer} -\setinterfacevariable{numbers}{cijfers} -\setinterfacevariable{october}{oktober} -\setinterfacevariable{odd}{oneven} -\setinterfacevariable{off}{uit} -\setinterfacevariable{offset}{offset} -\setinterfacevariable{old}{oud} -\setinterfacevariable{on}{aan} -\setinterfacevariable{one}{een} -\setinterfacevariable{opposite}{naast} -\setinterfacevariable{outer}{buiten} -\setinterfacevariable{outeredge}{buitenrand} -\setinterfacevariable{outermargin}{buitenmarge} -\setinterfacevariable{overbar}{overstreep} -\setinterfacevariable{overbars}{overstrepen} -\setinterfacevariable{overlay}{overlay} -\setinterfacevariable{overprint}{overprint} -\setinterfacevariable{overstrike}{doorstreep} -\setinterfacevariable{overstrikes}{doorstrepen} -\setinterfacevariable{packed}{opelkaar} -\setinterfacevariable{page}{pagina} -\setinterfacevariable{pagecomment}{paginacommentaar} -\setinterfacevariable{pagenumber}{paginanummer} -\setinterfacevariable{paper}{papier} -\setinterfacevariable{paragraph}{alinea} -\setinterfacevariable{part}{deel} -\setinterfacevariable{positive}{positief} -\setinterfacevariable{postponing}{uitstellen} -\setinterfacevariable{postscript}{postscript} -\setinterfacevariable{preference}{voorkeur} -\setinterfacevariable{preview}{preview} -\setinterfacevariable{previous}{vorige} -\setinterfacevariable{previousevenpage}{vorigeevenpagina} -\setinterfacevariable{previousoddpage}{vorigeonevenpagina} -\setinterfacevariable{previouspage}{vorigepagina} -\setinterfacevariable{previoussubpage}{vorigesubpagina} -\setinterfacevariable{printable}{printbaar} -\setinterfacevariable{process}{proces} -\setinterfacevariable{product}{produkt} -\setinterfacevariable{program}{programma} -\setinterfacevariable{project}{project} -\setinterfacevariable{protected}{beschermd} -\setinterfacevariable{quadruple}{viertal} -\setinterfacevariable{quotation}{citaat} -\setinterfacevariable{quote}{citeer} -\setinterfacevariable{ran}{ran} -\setinterfacevariable{random}{willekeurig} -\setinterfacevariable{readonly}{alleenleesbaar} -\setinterfacevariable{rectangular}{recht} -\setinterfacevariable{referral}{kenmerk} -\setinterfacevariable{register}{register} -\setinterfacevariable{regular}{regular} -\setinterfacevariable{rekening}{rekening} -\setinterfacevariable{relative}{relatief} -\setinterfacevariable{repeat}{herhaal} -\setinterfacevariable{required}{verplicht} -\setinterfacevariable{reset}{reset} -\setinterfacevariable{reverse}{omgekeerd} -\setinterfacevariable{right}{rechts} -\setinterfacevariable{rightedge}{rechterrand} -\setinterfacevariable{righthanging}{rechtshangend} -\setinterfacevariable{rightmargin}{rechtermarge} -\setinterfacevariable{rightpage}{rechterpagina} -\setinterfacevariable{righttoleft}{righttoleft} -\setinterfacevariable{roman}{romaan} -\setinterfacevariable{romannumerals}{romeins} -\setinterfacevariable{rotate}{roteer} -\setinterfacevariable{rotated}{geroteerd} -\setinterfacevariable{round}{rond} -\setinterfacevariable{row}{rij} -\setinterfacevariable{rule}{lijn} -\setinterfacevariable{samepage}{zelfdepagina} -\setinterfacevariable{sans}{sans} -\setinterfacevariable{sansbold}{sansvet} -\setinterfacevariable{sansserif}{schreefloos} -\setinterfacevariable{saturday}{zaterdag} -\setinterfacevariable{screen}{raster} -\setinterfacevariable{section}{paragraaf} -\setinterfacevariable{sectionblockenvironment}{sectieblokomgeving} -\setinterfacevariable{sectionnumber}{sectienummer} -\setinterfacevariable{see}{zie} -\setinterfacevariable{september}{september} -\setinterfacevariable{serif}{serif} -\setinterfacevariable{serried}{aanelkaar} -\setinterfacevariable{setups}{instellingen} -\setinterfacevariable{sheet}{sheet} -\setinterfacevariable{short}{kort} -\setinterfacevariable{singlesided}{enkelzijdig} -\setinterfacevariable{slanted}{schuin} -\setinterfacevariable{slantedbold}{schuinvet} -\setinterfacevariable{small}{klein} -\setinterfacevariable{smallbodyfont}{kleinkorps} -\setinterfacevariable{smallbold}{kleinvet} -\setinterfacevariable{smallbolditalic}{kleinvetitalic} -\setinterfacevariable{smallboldslanted}{kleinvetschuin} -\setinterfacevariable{smallcaps}{smallcaps} -\setinterfacevariable{smallitalic}{kleinitalic} -\setinterfacevariable{smallitalicbold}{kleinitalicvet} -\setinterfacevariable{smallnormal}{kleinnormaal} -\setinterfacevariable{smallslanted}{kleinschuin} -\setinterfacevariable{smallslantedbold}{kleinschuinvet} -\setinterfacevariable{smalltype}{kleintype} -\setinterfacevariable{somewhere}{ergens} -\setinterfacevariable{sorted}{gesorteerd} -\setinterfacevariable{space}{spatie} -\setinterfacevariable{spacing}{spatiering} -\setinterfacevariable{speech}{spraak} -\setinterfacevariable{split}{splitsen} -\setinterfacevariable{spot}{spot} -\setinterfacevariable{standard}{standaard} -\setinterfacevariable{start}{start} -\setinterfacevariable{starter}{opener} -\setinterfacevariable{sticker}{sticker} -\setinterfacevariable{stop}{stop} -\setinterfacevariable{stopper}{afsluiter} -\setinterfacevariable{stretch}{rek} -\setinterfacevariable{strict}{streng} -\setinterfacevariable{strong}{sterk} -\setinterfacevariable{strut}{strut} -\setinterfacevariable{sub}{sub} -\setinterfacevariable{subbackward}{subachteruit} -\setinterfacevariable{subformula}{subformule} -\setinterfacevariable{subforward}{subvooruit} -\setinterfacevariable{subject}{onderwerp} -\setinterfacevariable{subpage}{subpagina} -\setinterfacevariable{subsection}{subparagraaf} -\setinterfacevariable{subsubject}{subonderwerp} -\setinterfacevariable{subsubsection}{subsubparagraaf} -\setinterfacevariable{subsubsubject}{subsubonderwerp} -\setinterfacevariable{subsubsubsection}{subsubsubparagraaf} -\setinterfacevariable{subsubsubsubject}{subsubsubonderwerp} -\setinterfacevariable{subsubsubsubsection}{subsubsubsubparagraaf} -\setinterfacevariable{subsubsubsubsubject}{subsubsubsubonderwerp} -\setinterfacevariable{subsubsubsubsubsection}{subsubsubsubsubparagraaf} -\setinterfacevariable{subsubsubsubsubsubject}{subsubsubsubsubonderwerp} -\setinterfacevariable{subsubsubsubsubsubsection}{subsubsubsubsubsubparagraaf} -\setinterfacevariable{subsubsubsubsubsubsubject}{subsubsubsubsubsubonderwerp} -\setinterfacevariable{subsubsubsubsubsubsubsection}{subsubsubsubsubsubsubparagraaf} -\setinterfacevariable{subsubsubsubsubsubsubsubject}{subsubsubsubsubsubsubonderwerp} -\setinterfacevariable{subsubsubsubsubsubsubsubsection}{subsubsubsubsubsubsubsubparagraaf} -\setinterfacevariable{subsubsubsubsubsubsubsubsubject}{subsubsubsubsubsubsubsubonderwerp} -\setinterfacevariable{subsubsubsubsubsubsubsubsubsection}{subsubsubsubsubsubsubsubsubparagraaf} -\setinterfacevariable{subsubsubsubsubsubsubsubsubsubject}{subsubsubsubsubsubsubsubsubonderwerp} -\setinterfacevariable{sunday}{zondag} -\setinterfacevariable{support}{support} -\setinterfacevariable{sym}{sym} -\setinterfacevariable{symbol}{symbool} -\setinterfacevariable{synchronize}{synchroniseer} -\setinterfacevariable{system}{systeem} -\setinterfacevariable{table}{tabel} -\setinterfacevariable{tablehead}{tabelkop} -\setinterfacevariable{tables}{tabellen} -\setinterfacevariable{tabletail}{tabelstaart} -\setinterfacevariable{tabulate}{tabulatie} -\setinterfacevariable{tabulatehead}{tabulatiekop} -\setinterfacevariable{tabulatetail}{tabulatiestaart} -\setinterfacevariable{tall}{lang} -\setinterfacevariable{teletype}{teletype} -\setinterfacevariable{temporary}{voorlopig} -\setinterfacevariable{test}{test} -\setinterfacevariable{text}{tekst} -\setinterfacevariable{three}{drie} -\setinterfacevariable{thursday}{donderdag} -\setinterfacevariable{title}{titel} -\setinterfacevariable{toggle}{toggle} -\setinterfacevariable{tolerant}{soepel} -\setinterfacevariable{top}{boven} -\setinterfacevariable{tuesday}{dinsdag} -\setinterfacevariable{two}{twee} -\setinterfacevariable{txt}{txt} -\setinterfacevariable{type}{type} -\setinterfacevariable{typing}{typen} -\setinterfacevariable{unavailable}{nietbeschikbaar} -\setinterfacevariable{underbar}{onderstreep} -\setinterfacevariable{underbars}{onderstrepen} -\setinterfacevariable{unit}{eenheid} -\setinterfacevariable{units}{eenheden} -\setinterfacevariable{unknown}{onbekend} -\setinterfacevariable{unpacked}{vanelkaar} -\setinterfacevariable{up}{omhoog} -\setinterfacevariable{url}{url} -\setinterfacevariable{used}{gebruikt} -\setinterfacevariable{value}{waarde} -\setinterfacevariable{vertical}{vertikaal} -\setinterfacevariable{very}{zeer} -\setinterfacevariable{verystrict}{zeerstreng} -\setinterfacevariable{verytolerant}{zeersoepel} -\setinterfacevariable{weak}{zwak} -\setinterfacevariable{wednesday}{woensdag} -\setinterfacevariable{week}{week} -\setinterfacevariable{weekday}{weekdag} -\setinterfacevariable{white}{wit} -\setinterfacevariable{wide}{breed} -\setinterfacevariable{width}{breedte} -\setinterfacevariable{xml}{xml} -\setinterfacevariable{year}{jaar} -\setinterfacevariable{yes}{ja} -% definitions for interface constants for language nl -% -\setinterfaceconstant{action}{actie} -\setinterfaceconstant{address}{adres} -\setinterfaceconstant{after}{na} -\setinterfaceconstant{afterhead}{kopna} -\setinterfaceconstant{afterkey}{natoets} -\setinterfaceconstant{align}{uitlijnen} -\setinterfaceconstant{aligncharacter}{karakteruitlijnen} -\setinterfaceconstant{alignmentcharacter}{uitlijnkarakter} -\setinterfaceconstant{alignsymbol}{alignsymbol} -\setinterfaceconstant{aligntitle}{titeluitlijnen} -\setinterfaceconstant{alternative}{variant} -\setinterfaceconstant{andtext}{andtext} -\setinterfaceconstant{apa}{apa} -\setinterfaceconstant{arrow}{pijl} -\setinterfaceconstant{artauthor}{artauthor} -\setinterfaceconstant{artauthoretaldisplay}{artauthoretaldisplay} -\setinterfaceconstant{artauthoretallimit}{artauthoretallimit} -\setinterfaceconstant{artauthoretaltext}{artauthoretaltext} -\setinterfaceconstant{at}{op} -\setinterfaceconstant{author}{auteur} -\setinterfaceconstant{authoretaldisplay}{authoretaldisplay} -\setinterfaceconstant{authoretallimit}{authoretallimit} -\setinterfaceconstant{authoretaltext}{authoretaltext} -\setinterfaceconstant{auto}{auto} -\setinterfaceconstant{autofile}{autofile} -\setinterfaceconstant{autofocus}{autofocus} -\setinterfaceconstant{autohang}{autohang} -\setinterfaceconstant{autostrut}{autostrut} -\setinterfaceconstant{autowidth}{autobreedte} -\setinterfaceconstant{axis}{assenstelsel} -\setinterfaceconstant{background}{achtergrond} -\setinterfaceconstant{backgroundcolor}{achtergrondkleur} -\setinterfaceconstant{backgroundcorner}{achtergrondhoek} -\setinterfaceconstant{backgrounddepth}{achtergronddiepte} -\setinterfaceconstant{backgroundoffset}{achtergrondoffset} -\setinterfaceconstant{backgroundradius}{achtergrondstraal} -\setinterfaceconstant{backgroundscreen}{achtergrondraster} -\setinterfaceconstant{backspace}{rugwit} -\setinterfaceconstant{balance}{balanceren} -\setinterfaceconstant{before}{voor} -\setinterfaceconstant{beforehead}{kopvoor} -\setinterfaceconstant{bet}{bet} -\setinterfaceconstant{big}{groot} -\setinterfaceconstant{blank}{blanko} -\setinterfaceconstant{blockway}{blokwijze} -\setinterfaceconstant{bodyfont}{korps} -\setinterfaceconstant{bookmark}{bookmark} -\setinterfaceconstant{bottom}{onder} -\setinterfaceconstant{bottomafter}{bottomafter} -\setinterfaceconstant{bottombefore}{bottombefore} -\setinterfaceconstant{bottomdistance}{onderafstand} -\setinterfaceconstant{bottomframe}{onderkader} -\setinterfaceconstant{bottomoffset}{onderoffset} -\setinterfaceconstant{bottomspace}{bodemwit} -\setinterfaceconstant{bottomstate}{onderstatus} -\setinterfaceconstant{cache}{cache} -\setinterfaceconstant{calculate}{bereken} -\setinterfaceconstant{ccommand}{ccommando} -\setinterfaceconstant{click}{klik} -\setinterfaceconstant{clickin}{klikin} -\setinterfaceconstant{clickout}{klikuit} -\setinterfaceconstant{clipoffset}{clipoffset} -\setinterfaceconstant{closeaction}{sluitactie} -\setinterfaceconstant{closecommand}{sluitcommando} -\setinterfaceconstant{closepageaction}{sluitpaginaactie} -\setinterfaceconstant{closesymbol}{sluitsymbool} -\setinterfaceconstant{color}{kleur} -\setinterfaceconstant{column}{kolom} -\setinterfaceconstant{columndistance}{kolomafstand} -\setinterfaceconstant{columns}{kolommen} -\setinterfaceconstant{command}{commando} -\setinterfaceconstant{commandafter}{nacommando} -\setinterfaceconstant{commandbefore}{voorcommando} -\setinterfaceconstant{commands}{commandos} -\setinterfaceconstant{component}{component} -\setinterfaceconstant{compoundhyphen}{koppelteken} -\setinterfaceconstant{compress}{comprimeren} -\setinterfaceconstant{connector}{connector} -\setinterfaceconstant{continue}{doorgaan} -\setinterfaceconstant{contrastcolor}{contrastkleur} -\setinterfaceconstant{controls}{sturing} -\setinterfaceconstant{conversion}{conversie} -\setinterfaceconstant{convertfile}{converteerfile} -\setinterfaceconstant{corner}{hoek} -\setinterfaceconstant{coupling}{koppeling} -\setinterfaceconstant{couplingway}{koppelwijze} -\setinterfaceconstant{criterium}{criterium} -\setinterfaceconstant{current}{huidige} -\setinterfaceconstant{cutspace}{snijwit} -\setinterfaceconstant{dash}{streep} -\setinterfaceconstant{dat}{dat} -\setinterfaceconstant{database}{database} -\setinterfaceconstant{date}{datum} -\setinterfaceconstant{deepnumbercommand}{diepnummercommando} -\setinterfaceconstant{deeptextcommand}{dieptekstcommando} -\setinterfaceconstant{default}{default} -\setinterfaceconstant{delay}{wachttijd} -\setinterfaceconstant{depth}{diepte} -\setinterfaceconstant{depthcorrection}{dieptecorrectie} -\setinterfaceconstant{direction}{richting} -\setinterfaceconstant{directory}{gebied} -\setinterfaceconstant{display}{scherm} -\setinterfaceconstant{distance}{afstand} -\setinterfaceconstant{dot}{punt} -\setinterfaceconstant{doublesided}{dubbelzijdig} -\setinterfaceconstant{dummy}{dummy} -\setinterfaceconstant{dx}{dx} -\setinterfaceconstant{dy}{dy} -\setinterfaceconstant{edge}{rand} -\setinterfaceconstant{edgedistance}{randafstand} -\setinterfaceconstant{editor}{editor} -\setinterfaceconstant{editoretaldisplay}{editoretaldisplay} -\setinterfaceconstant{editoretallimit}{editoretallimit} -\setinterfaceconstant{editoretaltext}{editoretaltext} -\setinterfaceconstant{empty}{leeg} -\setinterfaceconstant{equalheight}{equalheight} -\setinterfaceconstant{equalwidth}{equalwidth} -\setinterfaceconstant{escape}{escape} -\setinterfaceconstant{evenmargin}{evenmarge} -\setinterfaceconstant{expansion}{expansie} -\setinterfaceconstant{export}{exporteer} -\setinterfaceconstant{extras}{extras} -\setinterfaceconstant{factor}{factor} -\setinterfaceconstant{fallback}{terugval} -\setinterfaceconstant{family}{soort} -\setinterfaceconstant{fieldbackgroundcolor}{veldachtergrondkleur} -\setinterfaceconstant{fieldframecolor}{veldkaderkleur} -\setinterfaceconstant{fieldlayer}{veldlaag} -\setinterfaceconstant{fieldoffset}{veldoffset} -\setinterfaceconstant{file}{file} -\setinterfaceconstant{filtercommand}{filtercommand} -\setinterfaceconstant{finalnamesep}{finalnamesep} -\setinterfaceconstant{firstnamesep}{firstnamesep} -\setinterfaceconstant{focus}{focus} -\setinterfaceconstant{focusin}{focusin} -\setinterfaceconstant{focusout}{focusuit} -\setinterfaceconstant{footer}{voet} -\setinterfaceconstant{footerdistance}{voetafstand} -\setinterfaceconstant{footerstate}{voetstatus} -\setinterfaceconstant{foregroundcolor}{voorgrondkleur} -\setinterfaceconstant{foregroundstyle}{voorgrondletter} -\setinterfaceconstant{format}{formatteer} -\setinterfaceconstant{frame}{kader} -\setinterfaceconstant{framecolor}{kaderkleur} -\setinterfaceconstant{framecorner}{kaderhoek} -\setinterfaceconstant{framedepth}{kaderdiepte} -\setinterfaceconstant{frameoffset}{kaderoffset} -\setinterfaceconstant{frameradius}{kaderstraal} -\setinterfaceconstant{frames}{hokjes} -\setinterfaceconstant{from}{van} -\setinterfaceconstant{get}{haal} -\setinterfaceconstant{global}{globaal} -\setinterfaceconstant{grid}{grid} -\setinterfaceconstant{hang}{hang} -\setinterfaceconstant{headalign}{kopuitlijnen} -\setinterfaceconstant{headcolor}{kopkleur} -\setinterfaceconstant{headcommand}{kopcommando} -\setinterfaceconstant{headconversion}{kopconversie} -\setinterfaceconstant{header}{hoofd} -\setinterfaceconstant{headerdistance}{hoofdafstand} -\setinterfaceconstant{headerstate}{hoofdstatus} -\setinterfaceconstant{headlabel}{koplabel} -\setinterfaceconstant{headnumber}{kopnummer} -\setinterfaceconstant{headstyle}{kopletter} -\setinterfaceconstant{height}{hoogte} -\setinterfaceconstant{hfactor}{hfactor} -\setinterfaceconstant{hfil}{hfil} -\setinterfaceconstant{hidenumber}{hidenumber} -\setinterfaceconstant{hoffset}{hoffset} -\setinterfaceconstant{horoffset}{rugoffset} -\setinterfaceconstant{hyphen}{hyphen} -\setinterfaceconstant{icommand}{icommando} -\setinterfaceconstant{in}{in} -\setinterfaceconstant{inbetween}{tussen} -\setinterfaceconstant{increment}{verhoog} -\setinterfaceconstant{incrementnumber}{verhoognummer} -\setinterfaceconstant{indenting}{inspringen} -\setinterfaceconstant{indentnext}{springvolgendein} -\setinterfaceconstant{indicator}{aanduiding} -\setinterfaceconstant{inner}{binnen} -\setinterfaceconstant{innermargin}{binnenmarge} -\setinterfaceconstant{inputfile}{inputfile} -\setinterfaceconstant{intent}{intent} -\setinterfaceconstant{interaction}{interactie} -\setinterfaceconstant{interlinespace}{interlinie} -\setinterfaceconstant{itemalign}{itemuitlijnen} -\setinterfaceconstant{items}{items} -\setinterfaceconstant{juniorsep}{juniorsep} -\setinterfaceconstant{ken}{ken} -\setinterfaceconstant{keyexpansion}{sleutelexpansie} -\setinterfaceconstant{keyword}{trefwoord} -\setinterfaceconstant{label}{label} -\setinterfaceconstant{lastnamesep}{lastnamesep} -\setinterfaceconstant{lastpubsep}{lastpubsep} -\setinterfaceconstant{left}{links} -\setinterfaceconstant{leftcolor}{linkerkleur} -\setinterfaceconstant{leftcompoundhyphen}{linkerkoppelteken} -\setinterfaceconstant{leftedge}{linkerrand} -\setinterfaceconstant{leftedgedistance}{linkerrandafstand} -\setinterfaceconstant{leftframe}{linkerkader} -\setinterfaceconstant{lefthyphen}{lefthyphen} -\setinterfaceconstant{leftmargin}{linkermarge} -\setinterfaceconstant{leftmargindistance}{linkermargeafstand} -\setinterfaceconstant{leftoffset}{linkeroffset} -\setinterfaceconstant{leftquotation}{linkercitaat} -\setinterfaceconstant{leftquote}{linkerciteer} -\setinterfaceconstant{leftsentence}{linkerzin} -\setinterfaceconstant{leftspeech}{linkeruitspraak} -\setinterfaceconstant{leftstyle}{linkerletter} -\setinterfaceconstant{leftsubsentence}{linkersubzin} -\setinterfaceconstant{lefttext}{linkertekst} -\setinterfaceconstant{leftwidth}{linkerbreedte} -\setinterfaceconstant{level}{niveau} -\setinterfaceconstant{levels}{niveaus} -\setinterfaceconstant{limittext}{limiettekst} -\setinterfaceconstant{line}{regel} -\setinterfaceconstant{linecorrection}{regelcorrectie} -\setinterfaceconstant{lines}{regels} -\setinterfaceconstant{list}{lijst} -\setinterfaceconstant{listtext}{lijsttekst} -\setinterfaceconstant{local}{lokaal} -\setinterfaceconstant{location}{plaats} -\setinterfaceconstant{logo}{logo} -\setinterfaceconstant{logos}{logos} -\setinterfaceconstant{marcolor}{markleur} -\setinterfaceconstant{margin}{marge} -\setinterfaceconstant{margindistance}{margeafstand} -\setinterfaceconstant{marginedge}{kantlijn} -\setinterfaceconstant{marginedgetext}{kantlijntekst} -\setinterfaceconstant{margintext}{margetekst} -\setinterfaceconstant{marking}{markering} -\setinterfaceconstant{marstyle}{marletter} -\setinterfaceconstant{max}{max} -\setinterfaceconstant{maxdepth}{maxdepth} -\setinterfaceconstant{maxheight}{maxhoogte} -\setinterfaceconstant{maxwidth}{maxbreedte} -\setinterfaceconstant{maybeyear}{maybeyear} -\setinterfaceconstant{menu}{menu} -\setinterfaceconstant{method}{methode} -\setinterfaceconstant{middle}{midden} -\setinterfaceconstant{middlespeech}{middenuitspraak} -\setinterfaceconstant{middletext}{middentekst} -\setinterfaceconstant{midsentence}{middenzin} -\setinterfaceconstant{min}{min} -\setinterfaceconstant{mindepth}{mindiepte} -\setinterfaceconstant{minheight}{minhoogte} -\setinterfaceconstant{minwidth}{minbreedte} -\setinterfaceconstant{monthconversion}{maandconversie} -\setinterfaceconstant{n}{n} -\setinterfaceconstant{name}{naam} -\setinterfaceconstant{namesep}{namesep} -\setinterfaceconstant{nbottom}{nonder} -\setinterfaceconstant{nc}{nc} -\setinterfaceconstant{next}{volgende} -\setinterfaceconstant{nl}{nl} -\setinterfaceconstant{nleft}{nlinks} -\setinterfaceconstant{nlines}{nregels} -\setinterfaceconstant{norm}{norm} -\setinterfaceconstant{nr}{nr} -\setinterfaceconstant{nright}{nrechts} -\setinterfaceconstant{ntop}{nboven} -\setinterfaceconstant{number}{nummer} -\setinterfaceconstant{numbercolor}{nummerkleur} -\setinterfaceconstant{numbercommand}{nummercommando} -\setinterfaceconstant{numberconversion}{numberconversion} -\setinterfaceconstant{numberconversionset}{numberconversionset} -\setinterfaceconstant{numberdistance}{nummerafstand} -\setinterfaceconstant{numbering}{nummeren} -\setinterfaceconstant{numberorder}{numberorder} -\setinterfaceconstant{numberprefix}{numberprefix} -\setinterfaceconstant{numbersegments}{numbersegments} -\setinterfaceconstant{numberseparator}{nummerscheider} -\setinterfaceconstant{numberseparatorset}{numberseparatorset} -\setinterfaceconstant{numberset}{numberset} -\setinterfaceconstant{numberstarter}{numberstarter} -\setinterfaceconstant{numberstopper}{numberstopper} -\setinterfaceconstant{numberstyle}{nummerletter} -\setinterfaceconstant{numberwidth}{nummerbreedte} -\setinterfaceconstant{nx}{nx} -\setinterfaceconstant{ny}{ny} -\setinterfaceconstant{object}{object} -\setinterfaceconstant{obstruction}{blokkade} -\setinterfaceconstant{oddmargin}{onevenmarge} -\setinterfaceconstant{offset}{offset} -\setinterfaceconstant{openaction}{openactie} -\setinterfaceconstant{openpageaction}{openpaginaactie} -\setinterfaceconstant{option}{optie} -\setinterfaceconstant{order}{order} -\setinterfaceconstant{orientation}{orientatie} -\setinterfaceconstant{otherstext}{otherstext} -\setinterfaceconstant{outermargin}{buitenmarge} -\setinterfaceconstant{overprint}{overprint} -\setinterfaceconstant{ownnumber}{eigennummer} -\setinterfaceconstant{page}{pagina} -\setinterfaceconstant{pageboundaries}{paginaovergangen} -\setinterfaceconstant{pagecolor}{paginakleur} -\setinterfaceconstant{pagecommand}{paginacommando} -\setinterfaceconstant{pageconversion}{pageconversion} -\setinterfaceconstant{pageconversionset}{pageconversionset} -\setinterfaceconstant{pagenumber}{paginanummer} -\setinterfaceconstant{pageprefix}{pageprefix} -\setinterfaceconstant{pageprefixconnector}{pageprefixconnector} -\setinterfaceconstant{pageprefixconversion}{pageprefixconversion} -\setinterfaceconstant{pageprefixconversionset}{pageprefixconversionset} -\setinterfaceconstant{pageprefixsegments}{pageprefixsegments} -\setinterfaceconstant{pageprefixseparatorset}{pageprefixseparatorset} -\setinterfaceconstant{pageprefixset}{pageprefixset} -\setinterfaceconstant{pageprefixstarter}{pageprefixstarter} -\setinterfaceconstant{pageprefixstopper}{pageprefixstopper} -\setinterfaceconstant{pagesegments}{pagesegments} -\setinterfaceconstant{pageseparatorset}{pageseparatorset} -\setinterfaceconstant{pageset}{pageset} -\setinterfaceconstant{pagestarter}{pagestarter} -\setinterfaceconstant{pagestate}{paginastatus} -\setinterfaceconstant{pagestopper}{pagestopper} -\setinterfaceconstant{pagestyle}{paginaletter} -\setinterfaceconstant{palet}{palet} -\setinterfaceconstant{paper}{papier} -\setinterfaceconstant{paragraph}{alinea} -\setinterfaceconstant{place}{plaatsen} -\setinterfaceconstant{placehead}{plaatskop} -\setinterfaceconstant{placestopper}{plaatsafsluiter} -\setinterfaceconstant{position}{positie} -\setinterfaceconstant{prefix}{prefix} -\setinterfaceconstant{prefixconnector}{prefixconnector} -\setinterfaceconstant{prefixconversion}{prefixconversion} -\setinterfaceconstant{prefixconversionset}{prefixconversionset} -\setinterfaceconstant{prefixsegments}{prefixsegments} -\setinterfaceconstant{prefixseparatorset}{prefixseparatorset} -\setinterfaceconstant{prefixset}{prefixset} -\setinterfaceconstant{prefixstarter}{prefixstarter} -\setinterfaceconstant{prefixstopper}{prefixstopper} -\setinterfaceconstant{preset}{preset} -\setinterfaceconstant{preview}{preview} -\setinterfaceconstant{previous}{vorige} -\setinterfaceconstant{previousnumber}{vorigenummer} -\setinterfaceconstant{process}{proces} -\setinterfaceconstant{pubsep}{pubsep} -\setinterfaceconstant{radius}{straal} -\setinterfaceconstant{random}{willekeur} -\setinterfaceconstant{range}{bereik} -\setinterfaceconstant{reduction}{reductie} -\setinterfaceconstant{ref}{ref} -\setinterfaceconstant{refcommand}{refcommand} -\setinterfaceconstant{reference}{verwijzing} -\setinterfaceconstant{referenceprefix}{referenceprefix} -\setinterfaceconstant{referencing}{refereren} -\setinterfaceconstant{regionin}{gebiedin} -\setinterfaceconstant{regionout}{gebieduit} -\setinterfaceconstant{repeat}{herhaal} -\setinterfaceconstant{reset}{reset} -\setinterfaceconstant{resetnumber}{resetnummer} -\setinterfaceconstant{resolution}{resolutie} -\setinterfaceconstant{right}{rechts} -\setinterfaceconstant{rightcolor}{rechterkleur} -\setinterfaceconstant{rightcompoundhyphen}{rechterkoppelteken} -\setinterfaceconstant{rightedge}{rechterrand} -\setinterfaceconstant{rightedgedistance}{rechterrandafstand} -\setinterfaceconstant{rightframe}{rechterkader} -\setinterfaceconstant{righthyphen}{righthyphen} -\setinterfaceconstant{rightmargin}{rechtermarge} -\setinterfaceconstant{rightmargindistance}{rechtermargeafstand} -\setinterfaceconstant{rightoffset}{rechteroffset} -\setinterfaceconstant{rightquotation}{rechtercitaat} -\setinterfaceconstant{rightquote}{rechterciteer} -\setinterfaceconstant{rightsentence}{rechterzin} -\setinterfaceconstant{rightspeech}{rechteruitspraak} -\setinterfaceconstant{rightstyle}{rechterletter} -\setinterfaceconstant{rightsubsentence}{rechtersubzin} -\setinterfaceconstant{righttext}{rechtertekst} -\setinterfaceconstant{rightwidth}{rechterbreedte} -\setinterfaceconstant{rotation}{rotatie} -\setinterfaceconstant{rule}{lijn} -\setinterfaceconstant{rulecolor}{lijnkleur} -\setinterfaceconstant{rulethickness}{lijndikte} -\setinterfaceconstant{samepage}{zelfdepagina} -\setinterfaceconstant{sample}{monster} -\setinterfaceconstant{samplesize}{samplesize} -\setinterfaceconstant{saveinlist}{saveinlist} -\setinterfaceconstant{scale}{schaal} -\setinterfaceconstant{scope}{scope} -\setinterfaceconstant{screen}{raster} -\setinterfaceconstant{section}{sectie} -\setinterfaceconstant{sectionconversion}{sectionconversion} -\setinterfaceconstant{sectionconversionset}{sectionconversionset} -\setinterfaceconstant{sectionnumber}{sectienummer} -\setinterfaceconstant{sectionresetset}{sectionresetset} -\setinterfaceconstant{sectionsegments}{sectionsegments} -\setinterfaceconstant{sectionseparatorset}{sectionseparatorset} -\setinterfaceconstant{sectionset}{sectionset} -\setinterfaceconstant{sectionstarter}{sectionstarter} -\setinterfaceconstant{sectionstopper}{sectionstopper} -\setinterfaceconstant{separator}{scheider} -\setinterfaceconstant{set}{set} -\setinterfaceconstant{setups}{setups} -\setinterfaceconstant{side}{zij} -\setinterfaceconstant{sidealign}{zijuitlijnen} -\setinterfaceconstant{sidemethod}{zijmethode} -\setinterfaceconstant{sidespaceafter}{zijnawit} -\setinterfaceconstant{sidespacebefore}{zijvoorwit} -\setinterfaceconstant{sign}{teken} -\setinterfaceconstant{size}{formaat} -\setinterfaceconstant{small}{klein} -\setinterfaceconstant{sort}{sort} -\setinterfaceconstant{sorttype}{sortering} -\setinterfaceconstant{source}{bron} -\setinterfaceconstant{space}{spatie} -\setinterfaceconstant{spaceafter}{nawit} -\setinterfaceconstant{spacebefore}{voorwit} -\setinterfaceconstant{spaceinbetween}{tussenwit} -\setinterfaceconstant{spacing}{spatiering} -\setinterfaceconstant{split}{splitsen} -\setinterfaceconstant{splitcolor}{splitskleur} -\setinterfaceconstant{splitmethod}{splitsmethode} -\setinterfaceconstant{splitoffset}{splitsoffset} -\setinterfaceconstant{spot}{spot} -\setinterfaceconstant{stack}{stapel} -\setinterfaceconstant{start}{start} -\setinterfaceconstant{starter}{opener} -\setinterfaceconstant{state}{status} -\setinterfaceconstant{step}{stap} -\setinterfaceconstant{stop}{stop} -\setinterfaceconstant{stopper}{afsluiter} -\setinterfaceconstant{stretch}{rek} -\setinterfaceconstant{strip}{strip} -\setinterfaceconstant{strut}{strut} -\setinterfaceconstant{style}{letter} -\setinterfaceconstant{sub}{sub} -\setinterfaceconstant{subtitle}{subtitel} -\setinterfaceconstant{suffix}{suffix} -\setinterfaceconstant{surnamesep}{surnamesep} -\setinterfaceconstant{sx}{sx} -\setinterfaceconstant{sy}{sy} -\setinterfaceconstant{symalign}{symuitlijnen} -\setinterfaceconstant{symbol}{symbool} -\setinterfaceconstant{symbolset}{symboolset} -\setinterfaceconstant{symcolor}{symkleur} -\setinterfaceconstant{symstyle}{symletter} -\setinterfaceconstant{synonym}{synoniem} -\setinterfaceconstant{synonymcolor}{synoniemkleur} -\setinterfaceconstant{synonymcommand}{synoniemcommando} -\setinterfaceconstant{synonymstyle}{synoniemletter} -\setinterfaceconstant{tab}{tab} -\setinterfaceconstant{text}{tekst} -\setinterfaceconstant{textcolor}{tekstkleur} -\setinterfaceconstant{textcommand}{tekstcommando} -\setinterfaceconstant{textdistance}{tekstafstand} -\setinterfaceconstant{textlayer}{tekstlaag} -\setinterfaceconstant{textmargin}{tekstmarge} -\setinterfaceconstant{textmethod}{tekstmethode} -\setinterfaceconstant{textseparator}{tekstscheider} -\setinterfaceconstant{textsize}{tekstformaat} -\setinterfaceconstant{textstate}{tekststatus} -\setinterfaceconstant{textstyle}{tekstletter} -\setinterfaceconstant{textwidth}{tekstbreedte} -\setinterfaceconstant{title}{titel} -\setinterfaceconstant{titlecolor}{titelkleur} -\setinterfaceconstant{titlecommand}{titelcommando} -\setinterfaceconstant{titledistance}{titelafstand} -\setinterfaceconstant{titleleft}{titellinks} -\setinterfaceconstant{titleright}{titelrechts} -\setinterfaceconstant{titlestyle}{titelletter} -\setinterfaceconstant{to}{aan} -\setinterfaceconstant{tolerance}{tolerantie} -\setinterfaceconstant{top}{boven} -\setinterfaceconstant{topdistance}{bovenafstand} -\setinterfaceconstant{topframe}{bovenkader} -\setinterfaceconstant{topoffset}{bovenoffset} -\setinterfaceconstant{topspace}{kopwit} -\setinterfaceconstant{topstate}{bovenstatus} -\setinterfaceconstant{totalnumber}{totalnumber} -\setinterfaceconstant{type}{type} -\setinterfaceconstant{unit}{eenheid} -\setinterfaceconstant{unknownreference}{onbekendeverwijzing} -\setinterfaceconstant{urlalternative}{urlvariant} -\setinterfaceconstant{urlspace}{urlspatie} -\setinterfaceconstant{validate}{valideer} -\setinterfaceconstant{vcommand}{vcommando} -\setinterfaceconstant{veroffset}{kopoffset} -\setinterfaceconstant{vfil}{vfil} -\setinterfaceconstant{voffset}{voffset} -\setinterfaceconstant{vonsep}{vonsep} -\setinterfaceconstant{way}{wijze} -\setinterfaceconstant{wfactor}{bfactor} -\setinterfaceconstant{white}{wit} -\setinterfaceconstant{width}{breedte} -\setinterfaceconstant{xfactor}{xfactor} -\setinterfaceconstant{xmax}{xmax} -\setinterfaceconstant{xoffset}{xoffset} -\setinterfaceconstant{xscale}{xschaal} -\setinterfaceconstant{xstep}{xstap} -\setinterfaceconstant{yfactor}{yfactor} -\setinterfaceconstant{ymax}{ymax} -\setinterfaceconstant{yoffset}{yoffset} -\setinterfaceconstant{yscale}{yschaal} -\setinterfaceconstant{ystep}{ystap} -% definitions for interface elements for language nl -% -\setinterfaceelement{answerlines}{antwoordregels} -\setinterfaceelement{answerspace}{antwoordruimte} -\setinterfaceelement{begin}{beginvan} -\setinterfaceelement{complete}{volledige} -\setinterfaceelement{coupled}{gekoppelde} -\setinterfaceelement{currentlocal}{huidigelokale} -\setinterfaceelement{emptyone}{leeg} -\setinterfaceelement{emptytwo}{lege} -\setinterfaceelement{end}{eindvan} -\setinterfaceelement{endsetup}{in} -\setinterfaceelement{get}{haal} -\setinterfaceelement{increment}{verhoog} -\setinterfaceelement{list}{lijst} -\setinterfaceelement{listof}{lijstmet} -\setinterfaceelement{load}{laad} -\setinterfaceelement{local}{lokale} -\setinterfaceelement{makeup}{opmaak} -\setinterfaceelement{next}{volgende} -\setinterfaceelement{place}{plaats} -\setinterfaceelement{previous}{vorige} -\setinterfaceelement{previouslocal}{vorigelokale} -\setinterfaceelement{reserve}{reserveer} -\setinterfaceelement{see}{zie} -\setinterfaceelement{setup}{stel} -\setinterfaceelement{start}{start} -\setinterfaceelement{stop}{stop} -\setinterfaceelement{text}{tekst} -\setinterfaceelement{type}{type} -% definitions for interface commands for language nl -% -\setinterfacecommand{CAPPED}{KAP} -\setinterfacecommand{Character}{Letter} -\setinterfacecommand{Characters}{Letters} -\setinterfacecommand{LABELTEXT}{LABELTEKST} -\setinterfacecommand{MONTH}{MAAND} -\setinterfacecommand{Numbers}{Cijfers} -\setinterfacecommand{Romannumerals}{Romeins} -\setinterfacecommand{SmallCapped}{Kap} -\setinterfacecommand{SmallCaps}{Kaps} -\setinterfacecommand{WEEKDAY}{WEEKDAG} -\setinterfacecommand{WORD}{WOORD} -\setinterfacecommand{WORDS}{WOORDEN} -\setinterfacecommand{Word}{Woord} -\setinterfacecommand{Words}{Woorden} -\setinterfacecommand{about}{about} -\setinterfacecommand{adaptlayout}{paslayoutaan} -\setinterfacecommand{arg}{arg} -\setinterfacecommand{at}{op} -\setinterfacecommand{atleftmargin}{oplinkermarge} -\setinterfacecommand{atpage}{oppagina} -\setinterfacecommand{atrightmargin}{oprechtermarge} -\setinterfacecommand{background}{achtergrond} -\setinterfacecommand{backspace}{rugwit} -\setinterfacecommand{blackrule}{blokje} -\setinterfacecommand{blackrules}{blokjes} -\setinterfacecommand{blank}{blanko} -\setinterfacecommand{bookmark}{bookmark} -\setinterfacecommand{bottomdistance}{onderafstand} -\setinterfacecommand{bottomheight}{onderhoogte} -\setinterfacecommand{bottomspace}{bodemwit} -\setinterfacecommand{but}{but} -\setinterfacecommand{button}{button} -\setinterfacecommand{bypassblocks}{passeerblokken} -\setinterfacecommand{character}{letter} -\setinterfacecommand{characters}{letters} -\setinterfacecommand{chem}{chem} -\setinterfacecommand{clip}{clip} -\setinterfacecommand{clonefield}{kloonveld} -\setinterfacecommand{color}{kleur} -\setinterfacecommand{colorbar}{kleurenbalk} -\setinterfacecommand{colorvalue}{kleurwaarde} -\setinterfacecommand{column}{kolom} -\setinterfacecommand{comment}{commentaar} -\setinterfacecommand{comparecolorgroup}{vergelijkkleurgroep} -\setinterfacecommand{comparepalet}{vergelijkpalet} -\setinterfacecommand{completepagenumber}{volledigepaginanummer} -\setinterfacecommand{completeregister}{volledigregister} -\setinterfacecommand{component}{onderdeel} -\setinterfacecommand{convertnumber}{converteernummer} -\setinterfacecommand{copyfield}{copieerveld} -\setinterfacecommand{correctwhitespace}{corrigeerwitruimte} -\setinterfacecommand{coupledocument}{koppeldocument} -\setinterfacecommand{couplemarking}{koppelmarkering} -\setinterfacecommand{couplepage}{koppelpagina} -\setinterfacecommand{couplepaper}{koppelpapier} -\setinterfacecommand{coupleregister}{koppelregister} -\setinterfacecommand{crlf}{crlf} -\setinterfacecommand{currentdate}{huidigedatum} -\setinterfacecommand{currentheadnumber}{huidigekopnummer} -\setinterfacecommand{cutspace}{snijwit} -\setinterfacecommand{date}{datum} -\setinterfacecommand{decouplemarking}{ontkoppelmarkering} -\setinterfacecommand{decrementnumber}{verlaagnummer} -\setinterfacecommand{define}{definieer} -\setinterfacecommand{defineaccent}{definieeraccent} -\setinterfacecommand{defineblank}{definieerblanko} -\setinterfacecommand{defineblock}{definieerblok} -\setinterfacecommand{definebodyfont}{definieerkorps} -\setinterfacecommand{definebodyfontenvironment}{definieerkorpsomgeving} -\setinterfacecommand{definebuffer}{definieerbuffer} -\setinterfacecommand{definecharacter}{definieerkarakter} -\setinterfacecommand{definecolor}{definieerkleur} -\setinterfacecommand{definecolorgroup}{definieerkleurgroep} -\setinterfacecommand{definecolumnbreak}{definieerkolomovergang} -\setinterfacecommand{definecolumnset}{definieerkolomgroep} -\setinterfacecommand{definecombination}{definieercombinatie} -\setinterfacecommand{definecombinedlist}{definieersamengesteldelijst} -\setinterfacecommand{definecommand}{definieercommando} -\setinterfacecommand{defineconversion}{definieerconversie} -\setinterfacecommand{definedescription}{doordefinieren} -\setinterfacecommand{defineenumeration}{doornummeren} -\setinterfacecommand{definefield}{definieerveld} -\setinterfacecommand{definefieldstack}{definieerveldstapel} -\setinterfacecommand{definefiguresymbol}{definieerfiguursymbool} -\setinterfacecommand{definefloat}{definieerplaatsblok} -\setinterfacecommand{definefont}{definieerfont} -\setinterfacecommand{definefontstyle}{definieerfontstijl} -\setinterfacecommand{definefontsynonym}{definieerfontsynoniem} -\setinterfacecommand{defineframed}{definieeromlijnd} -\setinterfacecommand{defineframedtext}{definieerkadertekst} -\setinterfacecommand{definehbox}{definieerhbox} -\setinterfacecommand{definehead}{definieerkop} -\setinterfacecommand{defineindenting}{doorspringen} -\setinterfacecommand{defineinmargin}{definieerinmarge} -\setinterfacecommand{defineinteractionmenu}{definieerinteractiemenu} -\setinterfacecommand{defineitemgroup}{definieeritemgroep} -\setinterfacecommand{definelabel}{doorlabelen} -\setinterfacecommand{definelayer}{definieerlayer} -\setinterfacecommand{definelayout}{definieerlayout} -\setinterfacecommand{definelist}{definieerlijst} -\setinterfacecommand{definelogo}{definieerbeeldmerk} -\setinterfacecommand{definemainfield}{definieerhoofdveld} -\setinterfacecommand{definemakeup}{definieeropmaak} -\setinterfacecommand{definemarking}{definieermarkering} -\setinterfacecommand{definemathalignment}{definieerwiskundeuitlijnen} -\setinterfacecommand{defineoutput}{definieeruitvoer} -\setinterfacecommand{defineoverlay}{definieeroverlay} -\setinterfacecommand{definepagebreak}{definieerpaginaovergang} -\setinterfacecommand{definepalet}{definieerpalet} -\setinterfacecommand{definepapersize}{definieerpapierformaat} -\setinterfacecommand{defineparagraphs}{definieeralineas} -\setinterfacecommand{defineplacement}{definieerplaats} -\setinterfacecommand{defineprofile}{definieerprofiel} -\setinterfacecommand{defineprogram}{definieerprogramma} -\setinterfacecommand{definerawfont}{definerawfont} -\setinterfacecommand{definereference}{definieerreferentie} -\setinterfacecommand{definereferenceformat}{definieerreferentieformaat} -\setinterfacecommand{definereferencelist}{definieerreferentielijst} -\setinterfacecommand{defineregister}{definieerregister} -\setinterfacecommand{definerule}{definieerlijn} -\setinterfacecommand{definesection}{definieersectie} -\setinterfacecommand{definesectionblock}{definieersectieblok} -\setinterfacecommand{definesorting}{definieersorteren} -\setinterfacecommand{definestartstop}{definieerstartstop} -\setinterfacecommand{definestyle}{definieerletter} -\setinterfacecommand{definesubfield}{definieersubveld} -\setinterfacecommand{definesymbol}{definieersymbool} -\setinterfacecommand{definesynonyms}{definieersynoniemen} -\setinterfacecommand{definetabletemplate}{definieertabelvorm} -\setinterfacecommand{definetabulate}{definieertabulatie} -\setinterfacecommand{definetext}{definieertekst} -\setinterfacecommand{definetextposition}{definieertekstpositie} -\setinterfacecommand{definetextvariable}{definieertekstvariabele} -\setinterfacecommand{definetype}{definieertype} -\setinterfacecommand{definetyping}{definieertypen} -\setinterfacecommand{defineversion}{definieerversie} -\setinterfacecommand{determineheadnumber}{bepaalkopnummer} -\setinterfacecommand{determinelistcharacteristics}{bepaallijstkenmerken} -\setinterfacecommand{determineregistercharacteristics}{bepaalregisterkenmerken} -\setinterfacecommand{dimension}{dimensie} -\setinterfacecommand{disableinteractionmenu}{blokkeerinteractiemenu} -\setinterfacecommand{domicile}{woonplaats} -\setinterfacecommand{donttest}{geentest} -\setinterfacecommand{edgedistance}{randafstand} -\setinterfacecommand{edgewidth}{randbreedte} -\setinterfacecommand{emptylines}{legeregels} -\setinterfacecommand{environment}{omgeving} -\setinterfacecommand{externalfigure}{externfiguur} -\setinterfacecommand{fact}{geg} -\setinterfacecommand{field}{veld} -\setinterfacecommand{fieldstack}{veldstapel} -\setinterfacecommand{fillinfield}{invulveld} -\setinterfacecommand{fillinline}{invulregel} -\setinterfacecommand{fillinrules}{invullijnen} -\setinterfacecommand{fillintext}{invultekst} -\setinterfacecommand{fitfield}{passendveld} -\setinterfacecommand{fixedspace}{vastespatie} -\setinterfacecommand{fixedspaces}{vastespaties} -\setinterfacecommand{followprofile}{volgprofiel} -\setinterfacecommand{followprofileversion}{volgprofielversie} -\setinterfacecommand{followversion}{volgversie} -\setinterfacecommand{footerdistance}{voetafstand} -\setinterfacecommand{footerheight}{voethoogte} -\setinterfacecommand{footnote}{voetnoot} -\setinterfacecommand{footnotetext}{voetnoottekst} -\setinterfacecommand{forceblocks}{forceerblokken} -\setinterfacecommand{formulanumber}{formulenummer} -\setinterfacecommand{fraction}{breuk} -\setinterfacecommand{framed}{omlijnd} -\setinterfacecommand{from}{uit} -\setinterfacecommand{getbuffer}{haalbuffer} -\setinterfacecommand{getmarking}{haalmarkering} -\setinterfacecommand{getnumber}{haalnummer} -\setinterfacecommand{godown}{omlaag} -\setinterfacecommand{goto}{naar} -\setinterfacecommand{gotobox}{naarbox} -\setinterfacecommand{gotopage}{naarpagina} -\setinterfacecommand{graycolor}{grijskleur} -\setinterfacecommand{greyvalue}{grijswaarde} -\setinterfacecommand{grid}{rooster} -\setinterfacecommand{hairline}{haarlijn} -\setinterfacecommand{head}{kop} -\setinterfacecommand{headerdistance}{hoofdafstand} -\setinterfacecommand{headerheight}{hoofdhoogte} -\setinterfacecommand{headlevel}{kopniveau} -\setinterfacecommand{headnumber}{kopnummer} -\setinterfacecommand{headsym}{kopsym} -\setinterfacecommand{headtext}{koptekst} -\setinterfacecommand{hideblocks}{verbergblokken} -\setinterfacecommand{high}{hoog} -\setinterfacecommand{hl}{hl} -\setinterfacecommand{immediatebetweenlist}{directtussenlijst} -\setinterfacecommand{immediatetolist}{directnaarlijst} -\setinterfacecommand{in}{in} -\setinterfacecommand{incrementnumber}{verhoognummer} -\setinterfacecommand{indenting}{inspringen} -\setinterfacecommand{inframed}{inlijnd} -\setinterfacecommand{infull}{voluit} -\setinterfacecommand{ininner}{inbinnen} -\setinterfacecommand{inleft}{inlinker} -\setinterfacecommand{inleftedge}{inlinkerrand} -\setinterfacecommand{inleftmargin}{inlinkermarge} -\setinterfacecommand{inline}{inregel} -\setinterfacecommand{inmargin}{inmarge} -\setinterfacecommand{inmframed}{inwilijnd} -\setinterfacecommand{inneredgedistance}{binnenrandafstand} -\setinterfacecommand{inneredgewidth}{binnenrandbreedte} -\setinterfacecommand{innermargindistance}{binnenmargeafstand} -\setinterfacecommand{innermarginwidth}{binnenmargebreedte} -\setinterfacecommand{inothermargin}{inanderemarge} -\setinterfacecommand{inouter}{inbuiten} -\setinterfacecommand{inright}{inrechter} -\setinterfacecommand{inrightedge}{inrechterrand} -\setinterfacecommand{inrightmargin}{inrechtermarge} -\setinterfacecommand{installlanguage}{installeertaal} -\setinterfacecommand{interactionbar}{interactiebalk} -\setinterfacecommand{interactionbuttons}{interactiebuttons} -\setinterfacecommand{interactionmenu}{interactiemenu} -\setinterfacecommand{item}{som} -\setinterfacecommand{items}{items} -\setinterfacecommand{its}{its} -\setinterfacecommand{keepblocks}{handhaafblokken} -\setinterfacecommand{label}{label} -\setinterfacecommand{labels}{labels} -\setinterfacecommand{labeltext}{labeltekst} -\setinterfacecommand{language}{taal} -\setinterfacecommand{leftaligned}{regellinks} -\setinterfacecommand{leftedgedistance}{linkerrandafstand} -\setinterfacecommand{leftedgewidth}{linkerrandbreedte} -\setinterfacecommand{leftmargindistance}{linkermargeafstand} -\setinterfacecommand{leftmarginwidth}{linkermargebreedte} -\setinterfacecommand{leg}{leg} -\setinterfacecommand{linewidth}{lijndikte} -\setinterfacecommand{listheight}{lijsthoogte} -\setinterfacecommand{listlength}{lijstlengte} -\setinterfacecommand{listsymbol}{lijstsymbool} -\setinterfacecommand{listwidth}{lijstbreedte} -\setinterfacecommand{logfields}{registreervelden} -\setinterfacecommand{lohi}{laho} -\setinterfacecommand{low}{laag} -\setinterfacecommand{macroname}{naam} -\setinterfacecommand{mainlanguage}{hoofdtaal} -\setinterfacecommand{makeupheight}{zethoogte} -\setinterfacecommand{makeupwidth}{zetbreedte} -\setinterfacecommand{mar}{mar} -\setinterfacecommand{margindistance}{margeafstand} -\setinterfacecommand{marginrule}{kantlijn} -\setinterfacecommand{margintext}{margetekst} -\setinterfacecommand{margintitle}{margetitel} -\setinterfacecommand{marginwidth}{margebreedte} -\setinterfacecommand{marginword}{margewoord} -\setinterfacecommand{marking}{markeer} -\setinterfacecommand{markversion}{markeerversie} -\setinterfacecommand{mathematics}{wiskunde} -\setinterfacecommand{menubutton}{menubutton} -\setinterfacecommand{mframed}{wilijnd} -\setinterfacecommand{midaligned}{regelmidden} -\setinterfacecommand{mirror}{spiegel} -\setinterfacecommand{month}{maand} -\setinterfacecommand{moveformula}{verplaatsformule} -\setinterfacecommand{moveongrid}{verplaatsopgrid} -\setinterfacecommand{movesidefloat}{verplaatszijblok} -\setinterfacecommand{navigating}{navigerend} -\setinterfacecommand{nodimension}{geendimensie} -\setinterfacecommand{noheaderandfooterlines}{geenhoofdenvoetregels} -\setinterfacecommand{noindenting}{nietinspringen} -\setinterfacecommand{nolist}{geenlijst} -\setinterfacecommand{nomarking}{geenmarkering} -\setinterfacecommand{nomoreblocks}{geenblokkenmeer} -\setinterfacecommand{nomorefiles}{geenfilesmeer} -\setinterfacecommand{nop}{nop} -\setinterfacecommand{nospace}{geenspatie} -\setinterfacecommand{note}{noot} -\setinterfacecommand{notopandbottomlines}{geenbovenenonderregels} -\setinterfacecommand{notsmallcapped}{nokap} -\setinterfacecommand{nowhitespace}{geenwitruimte} -\setinterfacecommand{numberofsubpages}{aantalsubpaginas} -\setinterfacecommand{numbers}{cijfers} -\setinterfacecommand{outeredgedistance}{buitenrandafstand} -\setinterfacecommand{outeredgewidth}{buitenrandbreedte} -\setinterfacecommand{outermargindistance}{buitenmargeafstand} -\setinterfacecommand{outermarginwidth}{buitenmargebreedte} -\setinterfacecommand{packed}{opelkaar} -\setinterfacecommand{page}{pagina} -\setinterfacecommand{pagedepth}{paginadiepte} -\setinterfacecommand{pagenumber}{paginanummer} -\setinterfacecommand{pageoffset}{paginaoffset} -\setinterfacecommand{pagereference}{paginareferentie} -\setinterfacecommand{pagetype}{soortpagina} -\setinterfacecommand{paperheight}{papierhoogte} -\setinterfacecommand{paperwidth}{papierbreedte} -\setinterfacecommand{periods}{punten} -\setinterfacecommand{plaatsruwelijst}{plaatsruwelijst} -\setinterfacecommand{placebookmarks}{plaatsbookmarks} -\setinterfacecommand{placecombinedlist}{plaatssamengesteldelijst} -\setinterfacecommand{placefloat}{plaatsplaatsblok} -\setinterfacecommand{placefootnotes}{plaatsvoetnoten} -\setinterfacecommand{placeformula}{plaatsformule} -\setinterfacecommand{placeheadnumber}{plaatskopnummer} -\setinterfacecommand{placeheadtext}{plaatskoptekst} -\setinterfacecommand{placelegend}{plaatslegenda} -\setinterfacecommand{placelist}{plaatslijst} -\setinterfacecommand{placelocalfootnotes}{plaatslokalevoetnoten} -\setinterfacecommand{placelogos}{plaatsbeeldmerken} -\setinterfacecommand{placeongrid}{plaatsopgrid} -\setinterfacecommand{placeontopofeachother}{plaatsonderelkaar} -\setinterfacecommand{placepagenumber}{plaatspaginanummer} -\setinterfacecommand{placereferencelist}{plaatsreferentielijst} -\setinterfacecommand{placeregister}{plaatsregister} -\setinterfacecommand{placerule}{plaatslijn} -\setinterfacecommand{placesidebyside}{plaatsnaastelkaar} -\setinterfacecommand{placesubformula}{plaatssubformule} -\setinterfacecommand{placetextvariable}{plaatstekstvariabele} -\setinterfacecommand{position}{positioneer} -\setinterfacecommand{positiontext}{positioneertekst} -\setinterfacecommand{printpaperheight}{printpapierhoogte} -\setinterfacecommand{printpaperwidth}{printpapierbreedte} -\setinterfacecommand{processblocks}{verwerkblokken} -\setinterfacecommand{processpage}{verwerkpagina} -\setinterfacecommand{product}{produkt} -\setinterfacecommand{program}{programma} -\setinterfacecommand{project}{projekt} -\setinterfacecommand{publication}{publicatie} -\setinterfacecommand{quotation}{citaat} -\setinterfacecommand{quote}{citeer} -\setinterfacecommand{ran}{ran} -\setinterfacecommand{redo}{herhaal} -\setinterfacecommand{ref}{ref} -\setinterfacecommand{reference}{referentie} -\setinterfacecommand{referral}{kenmerk} -\setinterfacecommand{referraldate}{kenmerkdatum} -\setinterfacecommand{referring}{refereer} -\setinterfacecommand{remark}{toelichting} -\setinterfacecommand{reset}{reset} -\setinterfacecommand{resetmarking}{resetmarkering} -\setinterfacecommand{resetnumber}{resetnummer} -\setinterfacecommand{resettext}{resettekstinhoud} -\setinterfacecommand{rightaligned}{regelrechts} -\setinterfacecommand{rightedgedistance}{rechterrandafstand} -\setinterfacecommand{rightedgewidth}{rechterrandbreedte} -\setinterfacecommand{rightmargindistance}{rechtermargeafstand} -\setinterfacecommand{rightmarginwidth}{rechtermargebreedte} -\setinterfacecommand{romannumerals}{romeins} -\setinterfacecommand{rotate}{roteer} -\setinterfacecommand{scale}{schaal} -\setinterfacecommand{screen}{scherm} -\setinterfacecommand{selectblocks}{selecteerblokken} -\setinterfacecommand{selectpaper}{selecteerpapier} -\setinterfacecommand{selectversion}{selecteerversie} -\setinterfacecommand{setnumber}{setnummer} -\setinterfacecommand{settextcontent}{steltekstinhoudin} -\setinterfacecommand{settextvariable}{kentekstvariabeletoe} -\setinterfacecommand{setupalign}{steluitlijnenin} -\setinterfacecommand{setupanswerarea}{stelantwoordgebiedin} -\setinterfacecommand{setuparranging}{stelarrangerenin} -\setinterfacecommand{setupbackground}{stelachtergrondin} -\setinterfacecommand{setupbackgrounds}{stelachtergrondenin} -\setinterfacecommand{setupblackrules}{stelblokjesin} -\setinterfacecommand{setupblank}{stelblankoin} -\setinterfacecommand{setupblock}{stelblokin} -\setinterfacecommand{setupbodyfont}{stelkorpsin} -\setinterfacecommand{setupbodyfontenvironment}{stelkorpsomgevingin} -\setinterfacecommand{setupbottom}{stelonderin} -\setinterfacecommand{setupbottomtexts}{stelondertekstenin} -\setinterfacecommand{setupbuffer}{stelbufferin} -\setinterfacecommand{setupbuttons}{stelbuttonsin} -\setinterfacecommand{setupcapitals}{stelkapitalenin} -\setinterfacecommand{setupcaption}{stelblokkopjein} -\setinterfacecommand{setupcaptions}{stelblokkopjesin} -\setinterfacecommand{setupclipping}{stelclipin} -\setinterfacecommand{setupcolor}{stelkleurin} -\setinterfacecommand{setupcolors}{stelkleurenin} -\setinterfacecommand{setupcolumns}{stelkolommenin} -\setinterfacecommand{setupcolumnset}{stelkolomgroepin} -\setinterfacecommand{setupcolumnsetlines}{stelkolomgroepregelsin} -\setinterfacecommand{setupcolumnsetstart}{stelkolomgroepstartin} -\setinterfacecommand{setupcombinations}{stelcombinatiesin} -\setinterfacecommand{setupcombinedlist}{stelsamengesteldelijstin} -\setinterfacecommand{setupcomment}{stelcommentaarin} -\setinterfacecommand{setupdescriptions}{steldoordefinierenin} -\setinterfacecommand{setupenumerations}{steldoornummerenin} -\setinterfacecommand{setupexternalfigures}{stelexternefigurenin} -\setinterfacecommand{setupfield}{stelveldin} -\setinterfacecommand{setupfields}{stelveldenin} -\setinterfacecommand{setupfillinlines}{stelinvulregelsin} -\setinterfacecommand{setupfillinrules}{stelinvullijnenin} -\setinterfacecommand{setupfloat}{stelplaatsblokin} -\setinterfacecommand{setupfloats}{stelplaatsblokkenin} -\setinterfacecommand{setupfloatsplitting}{stelplaatsbloksplitsenin} -\setinterfacecommand{setupfooter}{stelvoetin} -\setinterfacecommand{setupfootertexts}{stelvoettekstenin} -\setinterfacecommand{setupfootnotedefinition}{stelvoetnootdefinitiein} -\setinterfacecommand{setupfootnotes}{stelvoetnotenin} -\setinterfacecommand{setupforms}{stelformulierenin} -\setinterfacecommand{setupformulas}{stelformulesin} -\setinterfacecommand{setupframed}{stelomlijndin} -\setinterfacecommand{setupframedtexts}{stelkadertekstenin} -\setinterfacecommand{setuphead}{stelkopin} -\setinterfacecommand{setupheader}{stelhoofdin} -\setinterfacecommand{setupheadertexts}{stelhoofdtekstenin} -\setinterfacecommand{setupheadnumber}{stelkopnummerin} -\setinterfacecommand{setupheads}{stelkoppenin} -\setinterfacecommand{setupheadtext}{stelkoptekstin} -\setinterfacecommand{setuphyphenmark}{stelkoppeltekenin} -\setinterfacecommand{setupindentations}{steldoorspringenin} -\setinterfacecommand{setupindenting}{stelinspringenin} -\setinterfacecommand{setupinmargin}{stelinmargein} -\setinterfacecommand{setupinteraction}{stelinteractiein} -\setinterfacecommand{setupinteractionbar}{stelinteractiebalkin} -\setinterfacecommand{setupinteractionmenu}{stelinteractiemenuin} -\setinterfacecommand{setupinteractionscreen}{stelinteractieschermin} -\setinterfacecommand{setupinterlinespace}{stelinterliniein} -\setinterfacecommand{setupitemgroup}{stelitemgroepin} -\setinterfacecommand{setupitemgroups}{stelopsommingenin} -\setinterfacecommand{setupitems}{stelitemsin} -\setinterfacecommand{setuplabeltext}{stellabeltekstin} -\setinterfacecommand{setuplanguage}{steltaalin} -\setinterfacecommand{setuplayout}{stellayoutin} -\setinterfacecommand{setuplegend}{stellegendain} -\setinterfacecommand{setuplinenumbering}{stelregelnummerenin} -\setinterfacecommand{setuplines}{stelregelsin} -\setinterfacecommand{setuplinewidth}{stellijndiktein} -\setinterfacecommand{setuplist}{stellijstin} -\setinterfacecommand{setupmakeup}{stelopmaakin} -\setinterfacecommand{setupmarginblocks}{stelmargeblokkenin} -\setinterfacecommand{setupmarginrules}{stelkantlijnin} -\setinterfacecommand{setupmarking}{stelmarkeringin} -\setinterfacecommand{setupmathalignment}{stelwiskundeuitlijnenin} -\setinterfacecommand{setupnarrower}{stelsmallerin} -\setinterfacecommand{setupnumber}{stelnummerin} -\setinterfacecommand{setupnumbering}{stelnummerenin} -\setinterfacecommand{setupoppositeplacing}{stelnaastplaatsenin} -\setinterfacecommand{setupoutput}{steluitvoerin} -\setinterfacecommand{setuppagecomment}{stelpaginacommentaarin} -\setinterfacecommand{setuppagenumber}{stelpaginanummerin} -\setinterfacecommand{setuppagenumbering}{stelpaginanummeringin} -\setinterfacecommand{setuppagetransitions}{stelpaginaovergangenin} -\setinterfacecommand{setuppalet}{stelpaletin} -\setinterfacecommand{setuppaper}{stelpapierin} -\setinterfacecommand{setuppapersize}{stelpapierformaatin} -\setinterfacecommand{setupparagraphnumbering}{stelparagraafnummerenin} -\setinterfacecommand{setupparagraphs}{stelalineasin} -\setinterfacecommand{setupplacement}{stelplaatsin} -\setinterfacecommand{setuppositioning}{stelpositionerenin} -\setinterfacecommand{setupprofiles}{stelprofielenin} -\setinterfacecommand{setupprograms}{stelprogrammasin} -\setinterfacecommand{setuppublications}{stelpublicatiesin} -\setinterfacecommand{setupquote}{stelciterenin} -\setinterfacecommand{setupreferencelist}{stelreferentielijstin} -\setinterfacecommand{setupreferencing}{stelrefererenin} -\setinterfacecommand{setupregister}{stelregisterin} -\setinterfacecommand{setuprotate}{stelroterenin} -\setinterfacecommand{setuprule}{stellijnin} -\setinterfacecommand{setups}{instellingen} -\setinterfacecommand{setupscreens}{stelrastersin} -\setinterfacecommand{setupsection}{stelsectiein} -\setinterfacecommand{setupsectionblock}{stelsectieblokin} -\setinterfacecommand{setupsorting}{stelsorterenin} -\setinterfacecommand{setupspacing}{stelspatieringin} -\setinterfacecommand{setupstartstop}{stelstartstopin} -\setinterfacecommand{setupstrut}{stelstrutin} -\setinterfacecommand{setupsubpagenumber}{stelsubpaginanummerin} -\setinterfacecommand{setupsymbolset}{stelsymboolsetin} -\setinterfacecommand{setupsynchronization}{stelsynchronisatiein} -\setinterfacecommand{setupsynchronizationbar}{stelsynchronisatiebalkin} -\setinterfacecommand{setupsynonyms}{stelsynoniemenin} -\setinterfacecommand{setupsystem}{stelsysteemin} -\setinterfacecommand{setuptab}{steltabin} -\setinterfacecommand{setuptables}{steltabellenin} -\setinterfacecommand{setuptabulate}{steltabulatiein} -\setinterfacecommand{setuptext}{steltekstin} -\setinterfacecommand{setuptextposition}{steltekstpositiein} -\setinterfacecommand{setuptextrules}{steltekstlijnenin} -\setinterfacecommand{setuptexttexts}{stelteksttekstenin} -\setinterfacecommand{setuptextvariable}{steltekstvariabelein} -\setinterfacecommand{setupthinrules}{steldunnelijnenin} -\setinterfacecommand{setuptolerance}{steltolerantiein} -\setinterfacecommand{setuptop}{stelbovenin} -\setinterfacecommand{setuptoptexts}{stelboventekstenin} -\setinterfacecommand{setuptype}{steltypein} -\setinterfacecommand{setuptyping}{steltypenin} -\setinterfacecommand{setupunderbar}{stelonderstrepenin} -\setinterfacecommand{setupurl}{stelurlin} -\setinterfacecommand{setupversions}{stelversiesin} -\setinterfacecommand{setupwhitespace}{stelwitruimtein} -\setinterfacecommand{showbodyfont}{toonkorps} -\setinterfacecommand{showbodyfontenvironment}{toonkorpsomgeving} -\setinterfacecommand{showcolor}{toonkleur} -\setinterfacecommand{showcolorgroup}{toonkleurgroep} -\setinterfacecommand{showexternalfigures}{toonexternefiguren} -\setinterfacecommand{showfields}{toonvelden} -\setinterfacecommand{showframe}{toonkader} -\setinterfacecommand{showgrid}{toongrid} -\setinterfacecommand{showlayout}{toonlayout} -\setinterfacecommand{showmakeup}{toonopmaak} -\setinterfacecommand{showpalet}{toonpalet} -\setinterfacecommand{showprint}{toonprint} -\setinterfacecommand{showsetups}{tooninstellingen} -\setinterfacecommand{showstruts}{toonstruts} -\setinterfacecommand{showsymbolset}{toonsymboolset} -\setinterfacecommand{smallcapped}{kap} -\setinterfacecommand{someline}{eenregel} -\setinterfacecommand{somewhere}{ergens} -\setinterfacecommand{space}{spatie} -\setinterfacecommand{splitfloat}{splitsplaatsblok} -\setinterfacecommand{startalignment}{startuitlijnen} -\setinterfacecommand{startbackground}{startachtergrond} -\setinterfacecommand{startcoding}{startcodering} -\setinterfacecommand{startcolor}{startkleur} -\setinterfacecommand{startcolumnmakeup}{startkolomopmaak} -\setinterfacecommand{startcolumns}{startkolommen} -\setinterfacecommand{startcolumnset}{startkolomgroep} -\setinterfacecommand{startcombination}{startcombinatie} -\setinterfacecommand{startcomponent}{startonderdeel} -\setinterfacecommand{startdocument}{startdocument} -\setinterfacecommand{startenvironment}{startomgeving} -\setinterfacecommand{startfigure}{startfiguur} -\setinterfacecommand{startglobal}{startglobaal} -\setinterfacecommand{startline}{startregel} -\setinterfacecommand{startlinecorrection}{startregelcorrectie} -\setinterfacecommand{startlinenumbering}{startregelnummeren} -\setinterfacecommand{startlines}{startregels} -\setinterfacecommand{startlocal}{startlokaal} -\setinterfacecommand{startlocalfootnotes}{startlokalevoetnoten} -\setinterfacecommand{startmakeup}{startopmaak} -\setinterfacecommand{startmarginblock}{startmargeblok} -\setinterfacecommand{startmarginrule}{startkantlijn} -\setinterfacecommand{startnarrower}{startsmaller} -\setinterfacecommand{startopposite}{startnaast} -\setinterfacecommand{startoverlay}{startoverlay} -\setinterfacecommand{startoverzicht}{startoverzicht} -\setinterfacecommand{startpacked}{startopelkaar} -\setinterfacecommand{startpositioning}{startpositioneren} -\setinterfacecommand{startproduct}{startprodukt} -\setinterfacecommand{startprofile}{startprofiel} -\setinterfacecommand{startproject}{startprojekt} -\setinterfacecommand{startquotation}{startcitaat} -\setinterfacecommand{startraster}{startraster} -\setinterfacecommand{startsymbolset}{startsymboolset} -\setinterfacecommand{startsynchronization}{startsynchronisatie} -\setinterfacecommand{starttable}{starttabel} -\setinterfacecommand{starttables}{starttabellen} -\setinterfacecommand{starttext}{starttekst} -\setinterfacecommand{starttextrule}{starttekstlijn} -\setinterfacecommand{startunpacked}{startvanelkaar} -\setinterfacecommand{startversion}{startversie} -\setinterfacecommand{stopalignment}{stopuitlijnen} -\setinterfacecommand{stopbackground}{stopachtergrond} -\setinterfacecommand{stopcoding}{stopcodering} -\setinterfacecommand{stopcolor}{stopkleur} -\setinterfacecommand{stopcolumnmakeup}{stopkolomopmaak} -\setinterfacecommand{stopcolumns}{stopkolommen} -\setinterfacecommand{stopcolumnset}{stopkolomgroep} -\setinterfacecommand{stopcombination}{stopcombinatie} -\setinterfacecommand{stopcomponent}{stoponderdeel} -\setinterfacecommand{stopdocument}{stopdocument} -\setinterfacecommand{stopenvironment}{stopomgeving} -\setinterfacecommand{stopglobal}{stopglobaal} -\setinterfacecommand{stopline}{stopregel} -\setinterfacecommand{stoplinecorrection}{stopregelcorrectie} -\setinterfacecommand{stoplinenumbering}{stopregelnummeren} -\setinterfacecommand{stoplines}{stopregels} -\setinterfacecommand{stoplocal}{stoplokaal} -\setinterfacecommand{stoplocalfootnotes}{stoplokalevoetnoten} -\setinterfacecommand{stopmakeup}{stopopmaak} -\setinterfacecommand{stopmarginblock}{stopmargeblok} -\setinterfacecommand{stopmarginrule}{stopkantlijn} -\setinterfacecommand{stopnarrower}{stopsmaller} -\setinterfacecommand{stopopposite}{stopnaast} -\setinterfacecommand{stopoverlay}{stopoverlay} -\setinterfacecommand{stopoverzicht}{stopoverzicht} -\setinterfacecommand{stoppacked}{stopopelkaar} -\setinterfacecommand{stoppositioning}{stoppositioneren} -\setinterfacecommand{stopproduct}{stopprodukt} -\setinterfacecommand{stopprofile}{stopprofiel} -\setinterfacecommand{stopproject}{stopprojekt} -\setinterfacecommand{stopquotation}{stopcitaat} -\setinterfacecommand{stopraster}{stopraster} -\setinterfacecommand{stopsynchronization}{stopsynchronisatie} -\setinterfacecommand{stoptable}{stoptabel} -\setinterfacecommand{stoptables}{stoptabellen} -\setinterfacecommand{stoptext}{stoptekst} -\setinterfacecommand{stoptextrule}{stoptekstlijn} -\setinterfacecommand{stopunpacked}{stopvanelkaar} -\setinterfacecommand{stopversion}{stopversie} -\setinterfacecommand{stretched}{uitgerekt} -\setinterfacecommand{subformulanumber}{subformulenummer} -\setinterfacecommand{subpagenumber}{subpaginanummer} -\setinterfacecommand{switchtobodyfont}{switchnaarkorps} -\setinterfacecommand{switchtorawfont}{switchtorawfont} -\setinterfacecommand{sym}{sym} -\setinterfacecommand{symbol}{symbool} -\setinterfacecommand{synchronizationbar}{synchronisatiebalk} -\setinterfacecommand{synchronize}{synchroniseer} -\setinterfacecommand{tab}{tab} -\setinterfacecommand{testcolumn}{testkolom} -\setinterfacecommand{testpage}{testpagina} -\setinterfacecommand{tex}{tex} -\setinterfacecommand{textheight}{teksthoogte} -\setinterfacecommand{textreference}{tekstreferentie} -\setinterfacecommand{textrule}{tekstlijn} -\setinterfacecommand{textvariable}{tekstvariabele} -\setinterfacecommand{textwidth}{tekstbreedte} -\setinterfacecommand{thinrule}{dunnelijn} -\setinterfacecommand{thinrules}{dunnelijnen} -\setinterfacecommand{tooltip}{suggestie} -\setinterfacecommand{topdistance}{bovenafstand} -\setinterfacecommand{topheight}{bovenhoogte} -\setinterfacecommand{topspace}{kopwit} -\setinterfacecommand{totalnumberofpages}{totaalaantalpaginas} -\setinterfacecommand{translate}{vertaal} -\setinterfacecommand{txt}{txt} -\setinterfacecommand{typ}{typ} -\setinterfacecommand{type}{type} -\setinterfacecommand{typebuffer}{typebuffer} -\setinterfacecommand{typefile}{typefile} -\setinterfacecommand{unitmeaning}{betekenis} -\setinterfacecommand{unknown}{onbekend} -\setinterfacecommand{useJSscripts}{gebruikJSscripts} -\setinterfacecommand{useURL}{gebruikURL} -\setinterfacecommand{useXMLfilter}{gebruikXMLfilter} -\setinterfacecommand{useblocks}{gebruikblokken} -\setinterfacecommand{usecommands}{gebruikcommandos} -\setinterfacecommand{useencoding}{usecodering} -\setinterfacecommand{useexternaldocument}{gebruikexterndocument} -\setinterfacecommand{useexternalfigure}{gebruikexternfiguur} -\setinterfacecommand{useexternalfile}{gebruikexternefile} -\setinterfacecommand{useexternalfiles}{gebruikexternefiles} -\setinterfacecommand{useexternalsoundtrack}{gebruikexterngeluidsfragment} -\setinterfacecommand{usemodule}{gebruikmodule} -\setinterfacecommand{usemodules}{gebruikmodules} -\setinterfacecommand{usepath}{gebruikgebied} -\setinterfacecommand{usereferences}{gebruikreferenties} -\setinterfacecommand{usespecials}{gebruikspecials} -\setinterfacecommand{usesymbols}{gebruiksymbolen} -\setinterfacecommand{usetypescript}{gebruiktypescript} -\setinterfacecommand{usetypescriptfile}{gebruiktypescriptfile} -\setinterfacecommand{useurl}{gebruikurl} -\setinterfacecommand{version}{versie} -\setinterfacecommand{vl}{vl} -\setinterfacecommand{weekday}{weekdag} -\setinterfacecommand{whitespace}{witruimte} -\setinterfacecommand{wordright}{woordrechts} -\setinterfacecommand{writebetweenlist}{schrijftussenlijst} -\setinterfacecommand{writetolist}{schrijfnaarlijst} -\setinterfacecommand{writetoreferencelist}{schrijfnaarreferentielijst} -\setinterfacecommand{writetoregister}{schrijfnaarregister} -% -\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-pe.mkii b/Master/texmf-dist/tex/context/base/mult-pe.mkii new file mode 100644 index 00000000000..284fa40e8b0 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-pe.mkii @@ -0,0 +1,1715 @@ +% this file is auto-generated, don't edit this file +% +% definitions for interface variables for language pe +% +\setinterfacevariable{Addition}{جمع} +\setinterfacevariable{Balloon}{بادکنک} +\setinterfacevariable{Character}{Character} +\setinterfacevariable{Characters}{Characters} +\setinterfacevariable{CloseDocument}{بستن‌نوشتار} +\setinterfacevariable{ExitViewer}{خروج‌نمایشگر} +\setinterfacevariable{FirstPage}{صفحه‌اول} +\setinterfacevariable{FitHeight}{پرکردن‌ارتفاع} +\setinterfacevariable{FitWidth}{پرکردن‌عرض} +\setinterfacevariable{GotoPage}{برو‌به‌صفحه} +\setinterfacevariable{Greek}{یونانی} +\setinterfacevariable{Help}{کمک} +\setinterfacevariable{HideField}{پنهان‌میدان} +\setinterfacevariable{HideLayer}{پنهان‌لایه} +\setinterfacevariable{Key}{کلید} +\setinterfacevariable{LastPage}{صفحه‌آخر} +\setinterfacevariable{LoadForm}{بارگذاشتن‌فرم} +\setinterfacevariable{MONTH}{ماه} +\setinterfacevariable{New}{جدید} +\setinterfacevariable{NextJump}{پرش‌بعدی} +\setinterfacevariable{NextPage}{صفحه‌بعدی} +\setinterfacevariable{Numbers}{شماره‌ها} +\setinterfacevariable{OpenNamedDocument}{بازکردن‌نوشتار‌ذخیره‌شده} +\setinterfacevariable{Paragraph}{پاراگراف} +\setinterfacevariable{PauseMovie}{ایست‌فیلم} +\setinterfacevariable{PauseRendering}{توقف‌تعبیر} +\setinterfacevariable{PauseSound}{ایست‌صدا} +\setinterfacevariable{PreviousJump}{پرش‌قبلی} +\setinterfacevariable{PreviousPage}{صفحه‌قبلی} +\setinterfacevariable{PrintDocument}{چاپ‌نوشتار} +\setinterfacevariable{Query}{پرسش} +\setinterfacevariable{QueryAgain}{پرسش‌دوباره} +\setinterfacevariable{ResetForm}{دوباره‌نشانی‌فرم} +\setinterfacevariable{ResumeMovie}{ادامه‌فیلم} +\setinterfacevariable{ResumeRendering}{ادامه‌تعبیر} +\setinterfacevariable{ResumeSound}{ادامه‌صدا} +\setinterfacevariable{Romannumerals}{اعداد‌بزرگ‌لاتین} +\setinterfacevariable{SaveDocument}{ذخیره‌نوشتار} +\setinterfacevariable{SaveForm}{ذخیره‌فرم} +\setinterfacevariable{SaveNamedDocument}{ذخیره‌نوشتار‌بانام} +\setinterfacevariable{SearchAgain}{جستجوی‌دوباره} +\setinterfacevariable{SearchDocument}{جستجوی‌نوشتار} +\setinterfacevariable{ShowBookmarks}{نمایش‌چوبخط} +\setinterfacevariable{ShowField}{نمایش‌میدان} +\setinterfacevariable{ShowThumbs}{نمایش‌شصت} +\setinterfacevariable{StartMovie}{شروع‌فیلم} +\setinterfacevariable{StartRendering}{شروع‌تعبیر} +\setinterfacevariable{StartSound}{شروع‌صدا} +\setinterfacevariable{StopMovie}{پایان‌فیلم} +\setinterfacevariable{StopRendering}{پایان‌تعبیر} +\setinterfacevariable{StopSound}{پایان‌صدا} +\setinterfacevariable{SubmitForm}{تسلیم‌فرم} +\setinterfacevariable{ToggleLayer}{تغییرلایه} +\setinterfacevariable{ToggleViewer}{تغییرنمایشگر} +\setinterfacevariable{URL}{URL} +\setinterfacevariable{VideLayer}{VideLayer} +\setinterfacevariable{ViewerHelp}{کمک‌نمایشگر} +\setinterfacevariable{WEEKDAY}{روزهفته} +\setinterfacevariable{WORD}{کلمه} +\setinterfacevariable{abbreviation}{اختصار} +\setinterfacevariable{abbreviations}{اختصارات} +\setinterfacevariable{absolute}{قطعی} +\setinterfacevariable{action}{کنش} +\setinterfacevariable{after}{بعداز} +\setinterfacevariable{all}{همه} +\setinterfacevariable{always}{همواره} +\setinterfacevariable{and}{and} +\setinterfacevariable{answerarea}{answerarea} +\setinterfacevariable{appendices}{پیوستها} +\setinterfacevariable{appendix}{پیوست} +\setinterfacevariable{april}{آوریل} +\setinterfacevariable{atmargin}{درحاشیه} +\setinterfacevariable{atpage}{درصفحه} +\setinterfacevariable{attachment}{attachment} +\setinterfacevariable{august}{آگوست} +\setinterfacevariable{author}{author} +\setinterfacevariable{auto}{خودکار} +\setinterfacevariable{autointro}{پیشگفتارخودکار} +\setinterfacevariable{back}{پشت} +\setinterfacevariable{background}{پس‌زمینه} +\setinterfacevariable{backmatter}{پس‌مطلب} +\setinterfacevariable{backpart}{پس‌قسمت} +\setinterfacevariable{backspace}{فضای‌پشت} +\setinterfacevariable{backward}{عقب‌گرد} +\setinterfacevariable{bbl}{bbl} +\setinterfacevariable{before}{قبل‌از} +\setinterfacevariable{begin}{begin} +\setinterfacevariable{bib}{bib} +\setinterfacevariable{big}{بزرگ} +\setinterfacevariable{bigbodyfont}{قلم‌بدنه‌بزرگ} +\setinterfacevariable{bigger}{bigger} +\setinterfacevariable{bigpreference}{اولویت‌بزرگ} +\setinterfacevariable{blank}{خالی} +\setinterfacevariable{blockquote}{نقل‌بلوک} +\setinterfacevariable{bodymatter}{مطلب‌بدنه} +\setinterfacevariable{bodypart}{قسمت‌بدنه} +\setinterfacevariable{bold}{مشکی} +\setinterfacevariable{bolditalic}{ایتالیک‌مشکی} +\setinterfacevariable{boldslanted}{خوابیده‌مشکی} +\setinterfacevariable{bookmark}{چوبخط} +\setinterfacevariable{both}{هردو} +\setinterfacevariable{bottom}{پایین} +\setinterfacevariable{brief}{مختصر} +\setinterfacevariable{broad}{گسترده} +\setinterfacevariable{buffer}{بافر} +\setinterfacevariable{by}{بوسیله} +\setinterfacevariable{calligraphic}{خوشنویسی} +\setinterfacevariable{cap}{cap} +\setinterfacevariable{capital}{capital} +\setinterfacevariable{center}{مرکز} +\setinterfacevariable{chapter}{فصل} +\setinterfacevariable{character}{حرف} +\setinterfacevariable{characters}{حرفها} +\setinterfacevariable{cite}{cite} +\setinterfacevariable{color}{رنگ} +\setinterfacevariable{column}{ستون} +\setinterfacevariable{columns}{ستونها} +\setinterfacevariable{command}{فرمان} +\setinterfacevariable{commands}{فرمانها} +\setinterfacevariable{comment}{توضیح} +\setinterfacevariable{component}{مولفه} +\setinterfacevariable{concept}{مفهوم} +\setinterfacevariable{content}{محتوا} +\setinterfacevariable{contents}{محتویات} +\setinterfacevariable{continue}{ادامه} +\setinterfacevariable{continued}{continued} +\setinterfacevariable{controls}{کنترلها} +\setinterfacevariable{conversion}{تبدیل} +\setinterfacevariable{current}{جاری} +\setinterfacevariable{cutspace}{فضای‌برش} +\setinterfacevariable{date}{تاریخ} +\setinterfacevariable{day}{روز} +\setinterfacevariable{december}{دسامبر} +\setinterfacevariable{default}{پیش‌فرض} +\setinterfacevariable{depth}{عمق} +\setinterfacevariable{description}{شرح} +\setinterfacevariable{disable}{ناتوان} +\setinterfacevariable{display}{نمایش} +\setinterfacevariable{dot}{نقطه} +\setinterfacevariable{doublesided}{دورو} +\setinterfacevariable{down}{down} +\setinterfacevariable{each}{هر} +\setinterfacevariable{edge}{لبه} +\setinterfacevariable{embed}{embed} +\setinterfacevariable{empty}{تهی} +\setinterfacevariable{end}{end} +\setinterfacevariable{endnote}{ته‌نوشت} +\setinterfacevariable{enumeration}{شماره‌بندی} +\setinterfacevariable{environment}{محیط} +\setinterfacevariable{even}{زوج} +\setinterfacevariable{external}{خارجی} +\setinterfacevariable{fact}{fact} +\setinterfacevariable{february}{فوریه} +\setinterfacevariable{figure}{شکل} +\setinterfacevariable{figures}{شکلها} +\setinterfacevariable{file}{پرونده} +\setinterfacevariable{final}{نهایی} +\setinterfacevariable{first}{اولی} +\setinterfacevariable{firstcolumn}{ستون‌اول} +\setinterfacevariable{firstpage}{صفحه‌اول} +\setinterfacevariable{firstsubpage}{زیرصفحه‌اول} +\setinterfacevariable{fit}{پرکردن} +\setinterfacevariable{five}{پنج} +\setinterfacevariable{fix}{ثابت‌کن} +\setinterfacevariable{fixed}{ثابت} +\setinterfacevariable{flexible}{انعطافپذیر} +\setinterfacevariable{float}{شناور} +\setinterfacevariable{flushinner}{پمپ‌داخلی} +\setinterfacevariable{flushleft}{پمپ‌چپ} +\setinterfacevariable{flushouter}{پمپ‌خارجی} +\setinterfacevariable{flushright}{پمپ‌راست} +\setinterfacevariable{footer}{ته‌برگ} +\setinterfacevariable{footnote}{پانوشت} +\setinterfacevariable{force}{اجبار} +\setinterfacevariable{foreground}{پیش‌زمینه} +\setinterfacevariable{formeel}{formeel} +\setinterfacevariable{formula}{فرمول} +\setinterfacevariable{formulae}{فرمولها} +\setinterfacevariable{forward}{به‌جلو} +\setinterfacevariable{four}{چهار} +\setinterfacevariable{frame}{قالب} +\setinterfacevariable{framedtext}{متن‌قالبی} +\setinterfacevariable{friday}{جمعه} +\setinterfacevariable{frontmatter}{پیش‌مطلب} +\setinterfacevariable{frontpart}{پیش‌قسمت} +\setinterfacevariable{global}{سراسری} +\setinterfacevariable{graphic}{گرافیک} +\setinterfacevariable{graphics}{گرافیکها} +\setinterfacevariable{gray}{خاکستری} +\setinterfacevariable{greek}{یونانی} +\setinterfacevariable{grid}{توری} +\setinterfacevariable{halfline}{نیم‌خط} +\setinterfacevariable{handwritten}{دست‌نوشته} +\setinterfacevariable{hang}{بیاویز} +\setinterfacevariable{hanging}{آویزان} +\setinterfacevariable{head}{سر} +\setinterfacevariable{header}{سربرگ} +\setinterfacevariable{height}{ارتفاع} +\setinterfacevariable{helptext}{متن‌کمکی} +\setinterfacevariable{hencefore}{hencefore} +\setinterfacevariable{here}{اینجا} +\setinterfacevariable{hereafter}{ازاین‌به‌بعد} +\setinterfacevariable{hidden}{پنهانی} +\setinterfacevariable{hiding}{پنهان‌کردن} +\setinterfacevariable{high}{بلند} +\setinterfacevariable{horizontal}{افقی} +\setinterfacevariable{hyphenated}{شکسته} +\setinterfacevariable{hz}{hz} +\setinterfacevariable{inbetween}{دربین} +\setinterfacevariable{index}{نمایه} +\setinterfacevariable{indices}{نمایه‌ها} +\setinterfacevariable{informeel}{informeel} +\setinterfacevariable{inherit}{ارث‌بردن} +\setinterfacevariable{inleft}{درون‌چپ} +\setinterfacevariable{inmargin}{درون‌حاشیه} +\setinterfacevariable{inner}{داخلی} +\setinterfacevariable{inneredge}{لبه‌داخلی} +\setinterfacevariable{innermargin}{حاشیه‌داخلی} +\setinterfacevariable{inright}{درون‌راست} +\setinterfacevariable{interaction}{پانل} +\setinterfacevariable{interactionmenu}{منوی‌پانل} +\setinterfacevariable{intermezzi}{میان‌پرده‌ها} +\setinterfacevariable{intermezzo}{میان‌پرده} +\setinterfacevariable{intext}{درون‌متن} +\setinterfacevariable{intro}{پیشگفتار} +\setinterfacevariable{italic}{ایتالیک} +\setinterfacevariable{italicbold}{مشکی‌ایتالیک} +\setinterfacevariable{item}{آیتم} +\setinterfacevariable{itemize}{آیتم‌بندی} +\setinterfacevariable{its}{آیم} +\setinterfacevariable{january}{ژانویه} +\setinterfacevariable{joinedup}{متصل‌بالا} +\setinterfacevariable{july}{ژولای} +\setinterfacevariable{june}{ژوئن} +\setinterfacevariable{keep}{نگهدار} +\setinterfacevariable{knockout}{knockout} +\setinterfacevariable{label}{برچسب} +\setinterfacevariable{landscape}{صفحه‌گسترده} +\setinterfacevariable{last}{آخرین} +\setinterfacevariable{lastcolumn}{آخرین‌ستون} +\setinterfacevariable{lastpage}{صفحه‌آخر} +\setinterfacevariable{lastpagenumber}{شماه‌صفحه‌آخر} +\setinterfacevariable{lastsubpage}{زیرصفحه‌آخر} +\setinterfacevariable{layer}{layer} +\setinterfacevariable{left}{چپ} +\setinterfacevariable{leftedge}{لبه‌چپ} +\setinterfacevariable{lefthanging}{آویزان‌چپ} +\setinterfacevariable{leftmargin}{حاشیه‌چپ} +\setinterfacevariable{leftpage}{صفحه‌چپ} +\setinterfacevariable{lefttoright}{lefttoright} +\setinterfacevariable{legend}{راهنما} +\setinterfacevariable{lesshyphenation}{شکست‌کلمات‌کمتر} +\setinterfacevariable{line}{خط} +\setinterfacevariable{linenote}{خط‌نوشت} +\setinterfacevariable{lines}{خطها} +\setinterfacevariable{list}{لیست} +\setinterfacevariable{local}{موضعی} +\setinterfacevariable{localenvironment}{محیط‌موضعی} +\setinterfacevariable{logo}{آرم} +\setinterfacevariable{logos}{آرمها} +\setinterfacevariable{lohi}{پابا} +\setinterfacevariable{loose}{شل} +\setinterfacevariable{low}{پایین} +\setinterfacevariable{ls}{ls} +\setinterfacevariable{makeup}{آرایش} +\setinterfacevariable{mar}{حاش} +\setinterfacevariable{march}{مارس} +\setinterfacevariable{margin}{حاشیه} +\setinterfacevariable{marginedge}{لبه‌حاشیه} +\setinterfacevariable{margintitle}{عنوان‌حاشیه} +\setinterfacevariable{marking}{نشانه‌گذاری} +\setinterfacevariable{mathalignment}{تنظیم‌ریاضی} +\setinterfacevariable{mathcases}{حالتهای‌ریاضی} +\setinterfacevariable{mathmatrix}{ماتریش‌ریاضی} +\setinterfacevariable{max}{بیشترین} +\setinterfacevariable{maxdepth}{maxdepth} +\setinterfacevariable{maxheight}{maxheight} +\setinterfacevariable{maxwidth}{maxwidth} +\setinterfacevariable{may}{مه} +\setinterfacevariable{mediaeval}{mediaeval} +\setinterfacevariable{medium}{متوسط} +\setinterfacevariable{middle}{میان} +\setinterfacevariable{min}{کمترین} +\setinterfacevariable{mindepth}{mindepth} +\setinterfacevariable{minheight}{کمترین‌ارتفاع} +\setinterfacevariable{minwidth}{کمترین‌عرض} +\setinterfacevariable{mirrored}{منعکس} +\setinterfacevariable{monday}{دوشنبه} +\setinterfacevariable{mono}{مونو} +\setinterfacevariable{month}{ماه} +\setinterfacevariable{morehyphenation}{شکست‌کلمات‌بیشتر} +\setinterfacevariable{name}{نام} +\setinterfacevariable{narrow}{نازک} +\setinterfacevariable{negative}{منفی} +\setinterfacevariable{never}{هیچگاه} +\setinterfacevariable{new}{جدید} +\setinterfacevariable{next}{بعدی} +\setinterfacevariable{nextevenpage}{صفحه‌زوج‌بعدی} +\setinterfacevariable{nextoddpage}{صفحه‌فردبعدی} +\setinterfacevariable{nextpage}{صفحه‌بعدی} +\setinterfacevariable{nextsubpage}{زیرصفحه‌بعدی} +\setinterfacevariable{no}{نه} +\setinterfacevariable{nocheck}{بدون‌بررسی} +\setinterfacevariable{nofit}{بدون‌پرکردن} +\setinterfacevariable{nogrid}{بدون‌توری} +\setinterfacevariable{nohz}{nohz} +\setinterfacevariable{nomarking}{بدون‌نشانه‌گذاری} +\setinterfacevariable{none}{هیچکدام} +\setinterfacevariable{nonumber}{بدون‌شماره} +\setinterfacevariable{normal}{نرمال} +\setinterfacevariable{nospacing}{بدون‌فضاگذاری} +\setinterfacevariable{not}{بدون} +\setinterfacevariable{note}{note} +\setinterfacevariable{nothanging}{بدون‌آویزان‌کردن} +\setinterfacevariable{nothyphenated}{بدون‌شکست} +\setinterfacevariable{november}{نوامبر} +\setinterfacevariable{nowhere}{هیچ‌حا} +\setinterfacevariable{nowhite}{سفید‌نه} +\setinterfacevariable{number}{شماره} +\setinterfacevariable{numbers}{شماره‌ها} +\setinterfacevariable{october}{اکتبر} +\setinterfacevariable{odd}{فرد} +\setinterfacevariable{off}{خاموش} +\setinterfacevariable{offset}{آفست} +\setinterfacevariable{old}{قدیمی} +\setinterfacevariable{on}{روی} +\setinterfacevariable{one}{یک} +\setinterfacevariable{opposite}{مخالف} +\setinterfacevariable{outer}{خارجی} +\setinterfacevariable{outeredge}{لبه‌خارجی} +\setinterfacevariable{outermargin}{حاشیه‌خارجی} +\setinterfacevariable{overbar}{میله‌رو} +\setinterfacevariable{overbars}{میله‌ها‌رو} +\setinterfacevariable{overlay}{پوشش} +\setinterfacevariable{overprint}{overprint} +\setinterfacevariable{overstrike}{خط‌زدن} +\setinterfacevariable{overstrikes}{خط‌زدنها} +\setinterfacevariable{packed}{فشرده} +\setinterfacevariable{page}{صفحه} +\setinterfacevariable{pagecomment}{توضیح‌صفحه} +\setinterfacevariable{pagenumber}{شماره‌صفحه} +\setinterfacevariable{paper}{برگ} +\setinterfacevariable{paragraph}{پاراگراف} +\setinterfacevariable{part}{قسمت} +\setinterfacevariable{positive}{مثبت} +\setinterfacevariable{postponing}{تاخیر} +\setinterfacevariable{postscript}{پست‌اسکریپت} +\setinterfacevariable{preference}{ترجیح} +\setinterfacevariable{preview}{پیش‌دید} +\setinterfacevariable{previous}{قبلی} +\setinterfacevariable{previousevenpage}{صفحه‌زوج‌قبلی} +\setinterfacevariable{previousoddpage}{صفحه‌فردقبلی} +\setinterfacevariable{previouspage}{صفحه‌قبلی} +\setinterfacevariable{previoussubpage}{زیرصفحه‌قبلی} +\setinterfacevariable{printable}{قابل‌چاپ} +\setinterfacevariable{process}{پردازش} +\setinterfacevariable{product}{محصول} +\setinterfacevariable{program}{برنامه} +\setinterfacevariable{project}{پروژه} +\setinterfacevariable{protected}{حفاظت‌شده} +\setinterfacevariable{quadruple}{quadruple} +\setinterfacevariable{quotation}{نقل‌قول} +\setinterfacevariable{quote}{نقل} +\setinterfacevariable{ran}{برد} +\setinterfacevariable{random}{تصادفی} +\setinterfacevariable{readonly}{تنهاخواندنی} +\setinterfacevariable{rectangular}{چهارگوشه} +\setinterfacevariable{reference}{مرجع} +\setinterfacevariable{referral}{مراجعه} +\setinterfacevariable{register}{ثبت} +\setinterfacevariable{regular}{منظم} +\setinterfacevariable{rekening}{rekening} +\setinterfacevariable{relative}{نسبی} +\setinterfacevariable{repeat}{تکرار} +\setinterfacevariable{required}{موردنیاز} +\setinterfacevariable{reset}{بازنشانی} +\setinterfacevariable{reverse}{برعکس} +\setinterfacevariable{right}{راست} +\setinterfacevariable{rightedge}{لبه‌راست} +\setinterfacevariable{righthanging}{آویزان‌کردن‌راست} +\setinterfacevariable{rightmargin}{حاشیه‌راست} +\setinterfacevariable{rightpage}{صفحه‌راست} +\setinterfacevariable{righttoleft}{righttoleft} +\setinterfacevariable{roman}{رومن} +\setinterfacevariable{romannumerals}{شماره‌لاتین} +\setinterfacevariable{rotate}{دوران} +\setinterfacevariable{rotated}{دوران‌یافته} +\setinterfacevariable{round}{گرد} +\setinterfacevariable{row}{سطر} +\setinterfacevariable{rule}{خط} +\setinterfacevariable{samepage}{همان‌صفحه} +\setinterfacevariable{sans}{سانز} +\setinterfacevariable{sansbold}{مشکی‌سانز} +\setinterfacevariable{sansserif}{سانزسریف} +\setinterfacevariable{saturday}{شنبه} +\setinterfacevariable{screen}{پرده} +\setinterfacevariable{section}{بخش} +\setinterfacevariable{sectionblockenvironment}{محیط‌بلوک‌بخش} +\setinterfacevariable{sectionnumber}{شماره‌بخش} +\setinterfacevariable{see}{ببینید} +\setinterfacevariable{september}{سپتامبر} +\setinterfacevariable{serif}{سریف} +\setinterfacevariable{serried}{تنگ‌هم} +\setinterfacevariable{setups}{بارگذاریها} +\setinterfacevariable{sheet}{ورقه} +\setinterfacevariable{short}{short} +\setinterfacevariable{singlesided}{یک‌رو} +\setinterfacevariable{slanted}{خوابیده} +\setinterfacevariable{slantedbold}{مشکی‌خوابیده} +\setinterfacevariable{small}{کوچک} +\setinterfacevariable{smallbodyfont}{قلم‌بدنه‌کوچک} +\setinterfacevariable{smallbold}{مشکی‌کوچک} +\setinterfacevariable{smallbolditalic}{ایتالیک‌مشکی‌کوچک} +\setinterfacevariable{smallboldslanted}{خوابیده‌مشکی‌کوچک} +\setinterfacevariable{smallcaps}{smallcaps} +\setinterfacevariable{smaller}{smaller} +\setinterfacevariable{smallitalic}{ایتالیک‌کوچک} +\setinterfacevariable{smallitalicbold}{مشکی‌ایتالیک‌کوچک} +\setinterfacevariable{smallnormal}{نرمال‌کوچک} +\setinterfacevariable{smallslanted}{خوابیده‌کوچک} +\setinterfacevariable{smallslantedbold}{مشکی‌خوابیده‌کوچک} +\setinterfacevariable{smalltype}{تایپ‌کوچک} +\setinterfacevariable{somewhere}{جایی} +\setinterfacevariable{sorted}{مرتب} +\setinterfacevariable{space}{فضا} +\setinterfacevariable{spacing}{فضاگذاری} +\setinterfacevariable{speech}{سخنرانی} +\setinterfacevariable{split}{شکافتن} +\setinterfacevariable{spot}{لکه} +\setinterfacevariable{standard}{استاندارد} +\setinterfacevariable{start}{شروع} +\setinterfacevariable{starter}{starter} +\setinterfacevariable{sticker}{دشنه} +\setinterfacevariable{stop}{پایان} +\setinterfacevariable{stopper}{ایست} +\setinterfacevariable{stretch}{بکش} +\setinterfacevariable{strict}{اکید} +\setinterfacevariable{strong}{محکم} +\setinterfacevariable{strut}{بست} +\setinterfacevariable{sub}{زیر} +\setinterfacevariable{subbackward}{زیرعقب‌گرد} +\setinterfacevariable{subformula}{زیرفرمول} +\setinterfacevariable{subforward}{زیرجلوگرد} +\setinterfacevariable{subject}{موضوع} +\setinterfacevariable{subpage}{زیرصفحه} +\setinterfacevariable{subsection}{زیربخش} +\setinterfacevariable{subsubject}{زیرموضوع} +\setinterfacevariable{subsubsection}{زیرزیربخش} +\setinterfacevariable{subsubsubject}{زیرزیرموضوع} +\setinterfacevariable{subsubsubsection}{زیرزیرزیربخش} +\setinterfacevariable{subsubsubsubject}{زیرزیرزیرموضوع} +\setinterfacevariable{subsubsubsubsection}{زیرزیرزیرزیربخش} +\setinterfacevariable{subsubsubsubsubject}{زیرزیرزیرزیرموضوع} +\setinterfacevariable{subsubsubsubsubsection}{زیرزیرزیرزیرزیربخش} +\setinterfacevariable{subsubsubsubsubsubject}{زیرزیرزیرزیرزیرموضوع} +\setinterfacevariable{subsubsubsubsubsubsection}{زیرزیرزیرزیرزیرزیربخش} +\setinterfacevariable{subsubsubsubsubsubsubject}{زیرزیرزیرزیرزیرزیرموضوع} +\setinterfacevariable{subsubsubsubsubsubsubsection}{زیرزیرزیرزیرزیرزیرزیربخش} +\setinterfacevariable{subsubsubsubsubsubsubsubject}{زیرزیرزیرزیرزیرزیرزیرموضوع} +\setinterfacevariable{subsubsubsubsubsubsubsubsection}{زیرزیرزیرزیرزیرزیرزیرزیربخش} +\setinterfacevariable{subsubsubsubsubsubsubsubsubject}{زیرزیرزیرزیرزیرزیرزیرزیرموضوع} +\setinterfacevariable{subsubsubsubsubsubsubsubsubsection}{زیرزیرزیرزیرزیرزیرزیرزیرزیربخش} +\setinterfacevariable{subsubsubsubsubsubsubsubsubsubject}{زیرزیرزیرزیرزیرزیرزیرزیرزیرموضوع} +\setinterfacevariable{sunday}{یک‌شنبه} +\setinterfacevariable{support}{حمایت} +\setinterfacevariable{sym}{نم} +\setinterfacevariable{symbol}{نماد} +\setinterfacevariable{synchronize}{تطابق} +\setinterfacevariable{system}{سیستم} +\setinterfacevariable{table}{جدول} +\setinterfacevariable{tablehead}{سرجدول} +\setinterfacevariable{tables}{جدولها} +\setinterfacevariable{tabletail}{دنباله‌جدول} +\setinterfacevariable{tabulate}{جدول‌بندی} +\setinterfacevariable{tabulatehead}{سرجدول‌بندی} +\setinterfacevariable{tabulatetail}{دنباله‌جدول‌بندی} +\setinterfacevariable{tall}{دراز} +\setinterfacevariable{teletype}{دورنگاره} +\setinterfacevariable{temporary}{موقتی} +\setinterfacevariable{test}{تست} +\setinterfacevariable{text}{متن} +\setinterfacevariable{three}{سه} +\setinterfacevariable{thursday}{پنج‌شنبه} +\setinterfacevariable{title}{عنوان} +\setinterfacevariable{toggle}{تغییر} +\setinterfacevariable{tolerant}{بردبار} +\setinterfacevariable{top}{بالا} +\setinterfacevariable{tuesday}{سه‌شنبه} +\setinterfacevariable{two}{دو} +\setinterfacevariable{txt}{txt} +\setinterfacevariable{type}{تایپ} +\setinterfacevariable{typing}{تایپ‌کردن} +\setinterfacevariable{unavailable}{غیرموجود} +\setinterfacevariable{underbar}{میله‌زیر} +\setinterfacevariable{underbars}{میله‌‌های‌زیر} +\setinterfacevariable{unit}{واحد} +\setinterfacevariable{units}{واحدها} +\setinterfacevariable{unknown}{ناشناس} +\setinterfacevariable{unpacked}{غیرفشرده} +\setinterfacevariable{up}{up} +\setinterfacevariable{url}{url} +\setinterfacevariable{used}{استفاده‌شده} +\setinterfacevariable{value}{مقدار} +\setinterfacevariable{vertical}{عمودی} +\setinterfacevariable{very}{خیلی} +\setinterfacevariable{verystrict}{خیلی‌سختگیر} +\setinterfacevariable{verytolerant}{خیلی‌بردبار} +\setinterfacevariable{weak}{هفته} +\setinterfacevariable{wednesday}{چهارشنبه} +\setinterfacevariable{week}{هفته} +\setinterfacevariable{weekday}{روزهفته} +\setinterfacevariable{white}{سفید} +\setinterfacevariable{wide}{گسترده} +\setinterfacevariable{width}{عرض} +\setinterfacevariable{xml}{xml} +\setinterfacevariable{year}{سال} +\setinterfacevariable{yes}{بله} +% definitions for interface constants for language pe +% +\setinterfaceconstant{action}{کنش} +\setinterfaceconstant{address}{نشانی} +\setinterfaceconstant{after}{بعداز} +\setinterfaceconstant{afterhead}{بعدازسر} +\setinterfaceconstant{afterkey}{بعدازکلید} +\setinterfaceconstant{aftersection}{aftersection} +\setinterfaceconstant{align}{تنظیم} +\setinterfaceconstant{aligncharacter}{حرف‌تنظیم} +\setinterfaceconstant{alignmentcharacter}{حرف‌تنظیم‌کردن} +\setinterfaceconstant{alignsymbol}{alignsymbol} +\setinterfaceconstant{aligntitle}{عنوان‌تنظیم} +\setinterfaceconstant{alternative}{جایگزین} +\setinterfaceconstant{andtext}{andtext} +\setinterfaceconstant{apa}{apa} +\setinterfaceconstant{arrow}{پیکان} +\setinterfaceconstant{artauthor}{artauthor} +\setinterfaceconstant{artauthoretaldisplay}{artauthoretaldisplay} +\setinterfaceconstant{artauthoretallimit}{artauthoretallimit} +\setinterfaceconstant{artauthoretaltext}{artauthoretaltext} +\setinterfaceconstant{at}{در} +\setinterfaceconstant{author}{نویسنده} +\setinterfaceconstant{authoretaldisplay}{authoretaldisplay} +\setinterfaceconstant{authoretallimit}{authoretallimit} +\setinterfaceconstant{authoretaltext}{authoretaltext} +\setinterfaceconstant{auto}{خودکار} +\setinterfaceconstant{autocase}{autocase} +\setinterfaceconstant{autofile}{پرونده‌خودکار} +\setinterfaceconstant{autofocus}{تمرکز‌خودکار} +\setinterfaceconstant{autohang}{آویزان‌خودکار} +\setinterfaceconstant{autostrut}{بست‌خودکار} +\setinterfaceconstant{autowidth}{عرض‌خودکار} +\setinterfaceconstant{axis}{محورها} +\setinterfaceconstant{background}{پس‌زمینه} +\setinterfaceconstant{backgroundcolor}{رنگ‌پس‌زمینه} +\setinterfaceconstant{backgroundcorner}{گوشه‌پس‌زمینه} +\setinterfaceconstant{backgrounddepth}{عمق‌پس‌زمینه} +\setinterfaceconstant{backgroundoffset}{آفست‌پس‌زمینه} +\setinterfaceconstant{backgroundradius}{شعاع‌پس‌زمینه} +\setinterfaceconstant{backgroundscreen}{پرده‌پس‌زمینه} +\setinterfaceconstant{backreference}{backreference} +\setinterfaceconstant{backspace}{فضای‌پس} +\setinterfaceconstant{balance}{تعادل} +\setinterfaceconstant{before}{قبل‌از} +\setinterfaceconstant{beforehead}{قبل‌ازسر} +\setinterfaceconstant{beforesection}{beforesection} +\setinterfaceconstant{bet}{bet} +\setinterfaceconstant{big}{بزرگ} +\setinterfaceconstant{blank}{خالی} +\setinterfaceconstant{blockway}{راه‌بلوک} +\setinterfaceconstant{bodyfont}{قلم‌بدنه} +\setinterfaceconstant{bookmark}{چوبخط} +\setinterfaceconstant{bottom}{پایین} +\setinterfaceconstant{bottomafter}{bottomafter} +\setinterfaceconstant{bottombefore}{bottombefore} +\setinterfaceconstant{bottomdistance}{فاصله‌پایین} +\setinterfaceconstant{bottomframe}{قالب‌پایین} +\setinterfaceconstant{bottomoffset}{آفست‌پایین} +\setinterfaceconstant{bottomspace}{فضای‌پایین} +\setinterfaceconstant{bottomstate}{وضعیت‌پایین} +\setinterfaceconstant{buffer}{buffer} +\setinterfaceconstant{cache}{میانگیر} +\setinterfaceconstant{calculate}{محاسبه} +\setinterfaceconstant{category}{category} +\setinterfaceconstant{ccommand}{فرمان} +\setinterfaceconstant{click}{فشردن} +\setinterfaceconstant{clickin}{فشردن‌داخل} +\setinterfaceconstant{clickout}{فشردن‌خارج} +\setinterfaceconstant{clipoffset}{آفست‌کلیپ} +\setinterfaceconstant{closeaction}{بستن‌کنش} +\setinterfaceconstant{closecommand}{بستن‌فرمان} +\setinterfaceconstant{closepage}{closepage} +\setinterfaceconstant{closepageaction}{بستن‌عمل‌صفحه} +\setinterfaceconstant{closesymbol}{بستن‌نماد} +\setinterfaceconstant{color}{رنگ} +\setinterfaceconstant{column}{ستون} +\setinterfaceconstant{columndistance}{فاصله‌ستون} +\setinterfaceconstant{columns}{ستونها} +\setinterfaceconstant{command}{فرمان} +\setinterfaceconstant{commandafter}{فرمان‌بعداز} +\setinterfaceconstant{commandbefore}{فرمان‌قبل‌از} +\setinterfaceconstant{commands}{فرمانها} +\setinterfaceconstant{component}{مولفه} +\setinterfaceconstant{compoundhyphen}{compoundhyphen} +\setinterfaceconstant{compress}{فشردن} +\setinterfaceconstant{connector}{connector} +\setinterfaceconstant{continue}{ادامه} +\setinterfaceconstant{contrastcolor}{contrastcolor} +\setinterfaceconstant{controls}{کنترلها} +\setinterfaceconstant{conversion}{تبدیل} +\setinterfaceconstant{convertfile}{پرونده‌تبدیل} +\setinterfaceconstant{corner}{گوشه} +\setinterfaceconstant{coupling}{تزویج} +\setinterfaceconstant{couplingway}{روش‌تزویج} +\setinterfaceconstant{criterium}{criterium} +\setinterfaceconstant{current}{جاری} +\setinterfaceconstant{cutspace}{فضای‌برش} +\setinterfaceconstant{dash}{دش} +\setinterfaceconstant{dat}{dat} +\setinterfaceconstant{database}{database} +\setinterfaceconstant{date}{تاریخ} +\setinterfaceconstant{deepnumbercommand}{فرمان‌شماره‌عمیق} +\setinterfaceconstant{deeptextcommand}{فرمان‌متن‌عمیق} +\setinterfaceconstant{default}{پیش‌فرض} +\setinterfaceconstant{delay}{تاخیر} +\setinterfaceconstant{depth}{عمق} +\setinterfaceconstant{depthcorrection}{تصحیح‌عمق} +\setinterfaceconstant{direction}{جهت} +\setinterfaceconstant{directory}{پوشه} +\setinterfaceconstant{display}{نمایش} +\setinterfaceconstant{distance}{فاصله} +\setinterfaceconstant{dot}{نقطه} +\setinterfaceconstant{doublesided}{دورو} +\setinterfaceconstant{dummy}{مصنوعی} +\setinterfaceconstant{dx}{dx} +\setinterfaceconstant{dy}{dy} +\setinterfaceconstant{edge}{لبه} +\setinterfaceconstant{edgedistance}{فاصله‌لبه} +\setinterfaceconstant{editor}{editor} +\setinterfaceconstant{editoretaldisplay}{editoretaldisplay} +\setinterfaceconstant{editoretallimit}{editoretallimit} +\setinterfaceconstant{editoretaltext}{editoretaltext} +\setinterfaceconstant{empty}{تهی} +\setinterfaceconstant{entries}{entries} +\setinterfaceconstant{equalheight}{ارتفاع‌یکسان} +\setinterfaceconstant{equalwidth}{عرض‌یکسان} +\setinterfaceconstant{escape}{فرار} +\setinterfaceconstant{evenmargin}{حاشیه‌زوج} +\setinterfaceconstant{expansion}{گسترش} +\setinterfaceconstant{export}{export} +\setinterfaceconstant{extras}{extras} +\setinterfaceconstant{factor}{عامل} +\setinterfaceconstant{fallback}{عقب‌ریختن} +\setinterfaceconstant{family}{خانواده} +\setinterfaceconstant{fieldbackgroundcolor}{رنگ‌پس‌زمینه‌میدان} +\setinterfaceconstant{fieldframecolor}{رنگ‌قالب‌میدان} +\setinterfaceconstant{fieldlayer}{لایه‌میدان} +\setinterfaceconstant{fieldoffset}{آفست‌میدان} +\setinterfaceconstant{file}{پرونده} +\setinterfaceconstant{filtercommand}{filtercommand} +\setinterfaceconstant{finalnamesep}{finalnamesep} +\setinterfaceconstant{firstnamesep}{firstnamesep} +\setinterfaceconstant{focus}{تمرکز} +\setinterfaceconstant{focusin}{تمرکزدرون} +\setinterfaceconstant{focusout}{تمرکزبیرون} +\setinterfaceconstant{footer}{ته‌برگ} +\setinterfaceconstant{footerdistance}{فاصله‌ته‌برگ} +\setinterfaceconstant{footerstate}{وضعیت‌ته‌برگ} +\setinterfaceconstant{force}{اجبار} +\setinterfaceconstant{foregroundcolor}{رنگ‌پیش‌زمینه} +\setinterfaceconstant{foregroundstyle}{سبک‌پیش‌زمینه} +\setinterfaceconstant{format}{شمایل} +\setinterfaceconstant{frame}{قالب} +\setinterfaceconstant{framecolor}{رنگ‌قالب} +\setinterfaceconstant{framecorner}{گوشه‌قالب} +\setinterfaceconstant{framedepth}{عمق‌قالب} +\setinterfaceconstant{frameoffset}{آفست‌قالب} +\setinterfaceconstant{frameradius}{شعاع‌قالب} +\setinterfaceconstant{frames}{قالبها} +\setinterfaceconstant{from}{از} +\setinterfaceconstant{get}{بگیر} +\setinterfaceconstant{global}{سراسری} +\setinterfaceconstant{grid}{توری} +\setinterfaceconstant{hang}{بیاویز} +\setinterfaceconstant{headalign}{headalign} +\setinterfaceconstant{headcolor}{رنگ‌سر} +\setinterfaceconstant{headcommand}{فرمان‌سر} +\setinterfaceconstant{headconversion}{تبدیل‌سر} +\setinterfaceconstant{header}{سربرگ} +\setinterfaceconstant{headerdistance}{فاصله‌سربرگ} +\setinterfaceconstant{headerstate}{وضعیت‌سربرگ} +\setinterfaceconstant{headlabel}{برچسب‌سر} +\setinterfaceconstant{headnumber}{شماره‌سر} +\setinterfaceconstant{headstyle}{سبک‌سر} +\setinterfaceconstant{height}{ارتفاع} +\setinterfaceconstant{hfactor}{عامل‌ارتفاع} +\setinterfaceconstant{hfil}{پرکردن‌ارتفاع} +\setinterfaceconstant{hidenumber}{hidenumber} +\setinterfaceconstant{hoffset}{آفست‌ا} +\setinterfaceconstant{horoffset}{آفست‌افق} +\setinterfaceconstant{hyphen}{شکستن} +\setinterfaceconstant{icommand}{icommand} +\setinterfaceconstant{in}{درون} +\setinterfaceconstant{inbetween}{دربین} +\setinterfaceconstant{increment}{افزایش} +\setinterfaceconstant{incrementnumber}{شماره‌افزایش} +\setinterfaceconstant{indenting}{تورفتگی} +\setinterfaceconstant{indentnext}{متن‌تورفته} +\setinterfaceconstant{indicator}{اندیکاتور} +\setinterfaceconstant{inner}{داخلی} +\setinterfaceconstant{innermargin}{حاشیه‌داخلی} +\setinterfaceconstant{inputfile}{پرونده‌ورودی} +\setinterfaceconstant{intent}{intent} +\setinterfaceconstant{interaction}{پانل} +\setinterfaceconstant{interlinespace}{فضای‌بین‌خط} +\setinterfaceconstant{internalgrid}{internalgrid} +\setinterfaceconstant{itemalign}{تنظیم‌آیتم} +\setinterfaceconstant{items}{آیتمها} +\setinterfaceconstant{juniorsep}{juniorsep} +\setinterfaceconstant{ken}{ken} +\setinterfaceconstant{keyexpansion}{گسترش‌کلید} +\setinterfaceconstant{keys}{keys} +\setinterfaceconstant{keyword}{کلید‌واژه} +\setinterfaceconstant{label}{برچسب} +\setinterfaceconstant{lastnamesep}{lastnamesep} +\setinterfaceconstant{lastpubsep}{lastpubsep} +\setinterfaceconstant{left}{چپ} +\setinterfaceconstant{leftcolor}{رنگ‌چپ} +\setinterfaceconstant{leftcompoundhyphen}{leftcompoundhyphen} +\setinterfaceconstant{leftedge}{لبه‌چپ} +\setinterfaceconstant{leftedgedistance}{فاصله‌لبه‌چپ} +\setinterfaceconstant{leftframe}{قالب‌چپ} +\setinterfaceconstant{lefthyphen}{شکست‌چپ} +\setinterfaceconstant{leftmargin}{حاشیه‌چپ} +\setinterfaceconstant{leftmargindistance}{فاصله‌حاشیه‌چپ} +\setinterfaceconstant{leftoffset}{آفست‌چپ} +\setinterfaceconstant{leftquotation}{نقل‌قول‌چپ} +\setinterfaceconstant{leftquote}{نقل‌چپ} +\setinterfaceconstant{leftsentence}{جمله‌چپ} +\setinterfaceconstant{leftspeech}{سخنرانی‌چپ} +\setinterfaceconstant{leftstyle}{سبک‌چپ} +\setinterfaceconstant{leftsubsentence}{زیرجمله‌چپ} +\setinterfaceconstant{lefttext}{متن‌چپ} +\setinterfaceconstant{leftwidth}{عرض‌خط} +\setinterfaceconstant{level}{مرحله} +\setinterfaceconstant{levels}{مرحله‌ها} +\setinterfaceconstant{limittext}{مرزمتن} +\setinterfaceconstant{line}{خط} +\setinterfaceconstant{linecorrection}{تصحیح‌خط} +\setinterfaceconstant{lines}{خطها} +\setinterfaceconstant{list}{لیست} +\setinterfaceconstant{listtext}{متن‌لیست} +\setinterfaceconstant{local}{موضعی} +\setinterfaceconstant{location}{مکان} +\setinterfaceconstant{logo}{آرم} +\setinterfaceconstant{logos}{آرمها} +\setinterfaceconstant{marcolor}{رنگ‌حاش} +\setinterfaceconstant{margin}{حاشیه} +\setinterfaceconstant{margindistance}{فاصله‌حاشیه} +\setinterfaceconstant{marginedge}{لبه‌حاشیه} +\setinterfaceconstant{marginedgetext}{متن‌لبه‌حاشیه} +\setinterfaceconstant{margintext}{متن‌حاشیه} +\setinterfaceconstant{marking}{نشانه‌گذاری} +\setinterfaceconstant{marstyle}{سبک‌حاش} +\setinterfaceconstant{mask}{mask} +\setinterfaceconstant{max}{بیشترین} +\setinterfaceconstant{maxdepth}{maxdepth} +\setinterfaceconstant{maxheight}{بیشترین‌ارتفاع} +\setinterfaceconstant{maxwidth}{بیشترین‌عرض} +\setinterfaceconstant{maybeyear}{maybeyear} +\setinterfaceconstant{menu}{منو} +\setinterfaceconstant{method}{روش} +\setinterfaceconstant{middle}{میان} +\setinterfaceconstant{middlespeech}{سخنرانی‌میانی} +\setinterfaceconstant{middletext}{متن‌میانی} +\setinterfaceconstant{midsentence}{جمله‌میانی} +\setinterfaceconstant{min}{کمترین} +\setinterfaceconstant{mindepth}{کمترین‌عمق} +\setinterfaceconstant{minheight}{کمترین‌ارتفاع} +\setinterfaceconstant{minwidth}{کمترین‌عرض} +\setinterfaceconstant{monthconversion}{monthconversion} +\setinterfaceconstant{n}{n} +\setinterfaceconstant{name}{نام} +\setinterfaceconstant{namesep}{namesep} +\setinterfaceconstant{nbottom}{nbottom} +\setinterfaceconstant{nc}{nc} +\setinterfaceconstant{next}{بعدی} +\setinterfaceconstant{nl}{nl} +\setinterfaceconstant{nleft}{nleft} +\setinterfaceconstant{nlines}{nlines} +\setinterfaceconstant{norm}{norm} +\setinterfaceconstant{nr}{nr} +\setinterfaceconstant{nright}{nright} +\setinterfaceconstant{ntop}{ntop} +\setinterfaceconstant{number}{شماره} +\setinterfaceconstant{numbercolor}{رنگ‌شماره} +\setinterfaceconstant{numbercommand}{فرمان‌شماره} +\setinterfaceconstant{numberconversion}{numberconversion} +\setinterfaceconstant{numberconversionset}{numberconversionset} +\setinterfaceconstant{numberdistance}{فاصله‌شماره} +\setinterfaceconstant{numbering}{شماره‌گذاری} +\setinterfaceconstant{numberorder}{numberorder} +\setinterfaceconstant{numberprefix}{numberprefix} +\setinterfaceconstant{numbersegments}{numbersegments} +\setinterfaceconstant{numberseparator}{جداکننده‌شماره} +\setinterfaceconstant{numberseparatorset}{numberseparatorset} +\setinterfaceconstant{numberset}{numberset} +\setinterfaceconstant{numberstarter}{numberstarter} +\setinterfaceconstant{numberstopper}{numberstopper} +\setinterfaceconstant{numberstyle}{سبک‌شماره} +\setinterfaceconstant{numberwidth}{عرض‌شماره} +\setinterfaceconstant{nx}{nx} +\setinterfaceconstant{ny}{ny} +\setinterfaceconstant{object}{شیئ} +\setinterfaceconstant{obstruction}{انسداد} +\setinterfaceconstant{oddmargin}{حاشیه‌فرد} +\setinterfaceconstant{offset}{آفست} +\setinterfaceconstant{openaction}{عمل‌باز} +\setinterfaceconstant{openpage}{openpage} +\setinterfaceconstant{openpageaction}{عمل‌صفحه‌باز} +\setinterfaceconstant{option}{گزینه} +\setinterfaceconstant{order}{order} +\setinterfaceconstant{orientation}{جهت‌دهی} +\setinterfaceconstant{otherstext}{otherstext} +\setinterfaceconstant{outermargin}{حاشیه‌خارجی} +\setinterfaceconstant{overprint}{overprint} +\setinterfaceconstant{ownnumber}{شماره‌خود} +\setinterfaceconstant{page}{صفحه} +\setinterfaceconstant{pageboundaries}{مرزهای‌صفحه} +\setinterfaceconstant{pagecolor}{رنگ‌صفحه} +\setinterfaceconstant{pagecommand}{فرمان‌صفحه} +\setinterfaceconstant{pageconversion}{pageconversion} +\setinterfaceconstant{pageconversionset}{pageconversionset} +\setinterfaceconstant{pagenumber}{شماره‌صفحه} +\setinterfaceconstant{pageprefix}{pageprefix} +\setinterfaceconstant{pageprefixconnector}{pageprefixconnector} +\setinterfaceconstant{pageprefixconversion}{pageprefixconversion} +\setinterfaceconstant{pageprefixconversionset}{pageprefixconversionset} +\setinterfaceconstant{pageprefixsegments}{pageprefixsegments} +\setinterfaceconstant{pageprefixseparatorset}{pageprefixseparatorset} +\setinterfaceconstant{pageprefixset}{pageprefixset} +\setinterfaceconstant{pageprefixstarter}{pageprefixstarter} +\setinterfaceconstant{pageprefixstopper}{pageprefixstopper} +\setinterfaceconstant{pagesegments}{pagesegments} +\setinterfaceconstant{pageseparatorset}{pageseparatorset} +\setinterfaceconstant{pageset}{pageset} +\setinterfaceconstant{pagestarter}{pagestarter} +\setinterfaceconstant{pagestate}{وضعیت‌صفحه} +\setinterfaceconstant{pagestopper}{pagestopper} +\setinterfaceconstant{pagestyle}{سبک‌صفحه} +\setinterfaceconstant{palet}{لوح} +\setinterfaceconstant{paper}{برگ} +\setinterfaceconstant{paragraph}{پاراگراف} +\setinterfaceconstant{place}{بگذار} +\setinterfaceconstant{placehead}{بگذارسر} +\setinterfaceconstant{placestopper}{بگذارایست} +\setinterfaceconstant{position}{موقعیت} +\setinterfaceconstant{prefix}{پیشوند} +\setinterfaceconstant{prefixconnector}{prefixconnector} +\setinterfaceconstant{prefixconversion}{prefixconversion} +\setinterfaceconstant{prefixconversionset}{prefixconversionset} +\setinterfaceconstant{prefixsegments}{prefixsegments} +\setinterfaceconstant{prefixseparatorset}{prefixseparatorset} +\setinterfaceconstant{prefixset}{prefixset} +\setinterfaceconstant{prefixstarter}{prefixstarter} +\setinterfaceconstant{prefixstopper}{prefixstopper} +\setinterfaceconstant{preset}{preset} +\setinterfaceconstant{preview}{پیش‌دید} +\setinterfaceconstant{previous}{قبلی} +\setinterfaceconstant{previousnumber}{شماره‌قبلی} +\setinterfaceconstant{process}{پردازش} +\setinterfaceconstant{profile}{profile} +\setinterfaceconstant{pubsep}{pubsep} +\setinterfaceconstant{radius}{شعاع} +\setinterfaceconstant{random}{تصادفی} +\setinterfaceconstant{range}{range} +\setinterfaceconstant{reduction}{کاهش} +\setinterfaceconstant{ref}{رج} +\setinterfaceconstant{refcommand}{refcommand} +\setinterfaceconstant{reference}{مرجع} +\setinterfaceconstant{referenceprefix}{referenceprefix} +\setinterfaceconstant{referencing}{مراجعه} +\setinterfaceconstant{regionin}{ناحیه‌درون} +\setinterfaceconstant{regionout}{ناحیه‌بیرون} +\setinterfaceconstant{repeat}{تکرار} +\setinterfaceconstant{reset}{بازنشانی} +\setinterfaceconstant{resetnumber}{بازنشانی‌شماره} +\setinterfaceconstant{resolution}{کیفیت} +\setinterfaceconstant{right}{راست} +\setinterfaceconstant{rightcolor}{رنگ‌راست} +\setinterfaceconstant{rightcompoundhyphen}{rightcompoundhyphen} +\setinterfaceconstant{rightedge}{لبه‌راست} +\setinterfaceconstant{rightedgedistance}{فاصله‌لبه‌راست} +\setinterfaceconstant{rightframe}{قالب‌راست} +\setinterfaceconstant{righthyphen}{righthyphen} +\setinterfaceconstant{rightmargin}{حاشیه‌راست} +\setinterfaceconstant{rightmargindistance}{فاصله‌حاشیه‌راست} +\setinterfaceconstant{rightoffset}{آفست‌راست} +\setinterfaceconstant{rightquotation}{نقل‌قول‌راست} +\setinterfaceconstant{rightquote}{نقل‌راست} +\setinterfaceconstant{rightsentence}{جمله‌راست} +\setinterfaceconstant{rightspeech}{سخنرانی‌راست} +\setinterfaceconstant{rightstyle}{سبک‌راست} +\setinterfaceconstant{rightsubsentence}{زیرجمله‌راست} +\setinterfaceconstant{righttext}{متن‌راست} +\setinterfaceconstant{rightwidth}{عرض‌راست} +\setinterfaceconstant{rotation}{دوران} +\setinterfaceconstant{rule}{خط} +\setinterfaceconstant{rulecolor}{رنگ‌خط} +\setinterfaceconstant{rulethickness}{ضخامت‌خط} +\setinterfaceconstant{samepage}{همان‌صفحه} +\setinterfaceconstant{sample}{نمونه} +\setinterfaceconstant{samplesize}{samplesize} +\setinterfaceconstant{saveinlist}{saveinlist} +\setinterfaceconstant{scale}{مقیاس} +\setinterfaceconstant{scope}{طرح} +\setinterfaceconstant{screen}{پرده} +\setinterfaceconstant{section}{بخش} +\setinterfaceconstant{sectionconversion}{sectionconversion} +\setinterfaceconstant{sectionconversionset}{sectionconversionset} +\setinterfaceconstant{sectionnumber}{شماره‌بخش} +\setinterfaceconstant{sectionresetset}{sectionresetset} +\setinterfaceconstant{sectionsegments}{sectionsegments} +\setinterfaceconstant{sectionseparatorset}{sectionseparatorset} +\setinterfaceconstant{sectionset}{sectionset} +\setinterfaceconstant{sectionstarter}{sectionstarter} +\setinterfaceconstant{sectionstopper}{sectionstopper} +\setinterfaceconstant{separator}{جداکننده} +\setinterfaceconstant{set}{قراربده} +\setinterfaceconstant{setups}{بارگذاریها} +\setinterfaceconstant{side}{کنار} +\setinterfaceconstant{sidealign}{تنظیم‌کنار} +\setinterfaceconstant{sidemethod}{روش‌کنار} +\setinterfaceconstant{sidespaceafter}{فضای‌کناری‌بعد} +\setinterfaceconstant{sidespacebefore}{فضای‌کناری‌قبل} +\setinterfaceconstant{sign}{علامت} +\setinterfaceconstant{size}{اندازه} +\setinterfaceconstant{small}{کوچک} +\setinterfaceconstant{sort}{sort} +\setinterfaceconstant{sorttype}{ترتیب‌تایپ} +\setinterfaceconstant{source}{منبع} +\setinterfaceconstant{space}{فضا} +\setinterfaceconstant{spaceafter}{فضا‌بعداز} +\setinterfaceconstant{spacebefore}{فضا‌قبل‌از} +\setinterfaceconstant{spaceinbetween}{فضا‌دربین} +\setinterfaceconstant{spacing}{فضاگذاری} +\setinterfaceconstant{split}{شکافتن} +\setinterfaceconstant{splitcolor}{شکافتن‌رنگ} +\setinterfaceconstant{splitmethod}{روش‌شکافتن} +\setinterfaceconstant{splitoffset}{شکافتن‌آفست} +\setinterfaceconstant{spot}{لکه} +\setinterfaceconstant{stack}{توده} +\setinterfaceconstant{start}{شروع} +\setinterfaceconstant{starter}{starter} +\setinterfaceconstant{state}{وضعیت} +\setinterfaceconstant{step}{گام} +\setinterfaceconstant{stop}{پایان} +\setinterfaceconstant{stopper}{ایست} +\setinterfaceconstant{stretch}{کشیدن} +\setinterfaceconstant{strip}{strip} +\setinterfaceconstant{strut}{بست} +\setinterfaceconstant{style}{سبک} +\setinterfaceconstant{sub}{زیر} +\setinterfaceconstant{subtitle}{زیرعنوان} +\setinterfaceconstant{suffix}{پسوند} +\setinterfaceconstant{suffixseparator}{suffixseparator} +\setinterfaceconstant{surnamesep}{surnamesep} +\setinterfaceconstant{sx}{sx} +\setinterfaceconstant{sy}{sy} +\setinterfaceconstant{symalign}{تنظیم‌نماد} +\setinterfaceconstant{symbol}{نماد} +\setinterfaceconstant{symbolset}{مجموعه‌نماد} +\setinterfaceconstant{symcolor}{رنگ‌نماد} +\setinterfaceconstant{symstyle}{سبک‌نماد} +\setinterfaceconstant{synonym}{مترادف} +\setinterfaceconstant{synonymcolor}{رنگ‌مترادف} +\setinterfaceconstant{synonymcommand}{synonymcommand} +\setinterfaceconstant{synonymstyle}{سبک‌مترادف} +\setinterfaceconstant{tab}{تب} +\setinterfaceconstant{text}{متن} +\setinterfaceconstant{textcolor}{رنگ‌متن} +\setinterfaceconstant{textcommand}{فرمان‌متن} +\setinterfaceconstant{textdistance}{فاصله‌متن} +\setinterfaceconstant{textlayer}{لایه‌متن} +\setinterfaceconstant{textmargin}{حاشیه‌متن} +\setinterfaceconstant{textmethod}{روش‌متن} +\setinterfaceconstant{textseparator}{جداکننده‌متن} +\setinterfaceconstant{textsize}{اندازه‌متن} +\setinterfaceconstant{textstate}{وضعیت‌متن} +\setinterfaceconstant{textstyle}{سبک‌متن} +\setinterfaceconstant{textwidth}{عرض‌متن} +\setinterfaceconstant{threshold}{threshold} +\setinterfaceconstant{title}{عنوان} +\setinterfaceconstant{titlecolor}{رنگ‌عنوان} +\setinterfaceconstant{titlecommand}{فرمان‌عنوان} +\setinterfaceconstant{titledistance}{فاصله‌عنوان} +\setinterfaceconstant{titleleft}{عنوان‌چپ} +\setinterfaceconstant{titleright}{عنوان‌راست} +\setinterfaceconstant{titlestyle}{سبک‌عنوان} +\setinterfaceconstant{to}{به} +\setinterfaceconstant{tolerance}{بردباری} +\setinterfaceconstant{top}{بالا} +\setinterfaceconstant{topdistance}{فاصله‌بالا} +\setinterfaceconstant{topframe}{قالب‌راست} +\setinterfaceconstant{topoffset}{آفست‌بالا} +\setinterfaceconstant{topspace}{فضای‌بالا} +\setinterfaceconstant{topstate}{وضعیت‌بالا} +\setinterfaceconstant{totalnumber}{totalnumber} +\setinterfaceconstant{type}{تایپ} +\setinterfaceconstant{unit}{واحد} +\setinterfaceconstant{unknownreference}{مرجع‌ناشناس} +\setinterfaceconstant{urlalternative}{urlalternative} +\setinterfaceconstant{urlspace}{urlspace} +\setinterfaceconstant{validate}{تاییداعتبار} +\setinterfaceconstant{values}{values} +\setinterfaceconstant{vcommand}{vcommand} +\setinterfaceconstant{veroffset}{آفست‌عم} +\setinterfaceconstant{vfil}{vfil} +\setinterfaceconstant{voffset}{آفست‌ع} +\setinterfaceconstant{vonsep}{vonsep} +\setinterfaceconstant{way}{راه} +\setinterfaceconstant{wfactor}{wfactor} +\setinterfaceconstant{white}{سفید} +\setinterfaceconstant{width}{عرض} +\setinterfaceconstant{xfactor}{فاکتورایکس} +\setinterfaceconstant{xmax}{xmax} +\setinterfaceconstant{xoffset}{آفست‌ایکس} +\setinterfaceconstant{xscale}{مقیاس‌ایکس} +\setinterfaceconstant{xstep}{گام‌ایکس} +\setinterfaceconstant{yfactor}{فاکتوروای} +\setinterfaceconstant{ymax}{ymax} +\setinterfaceconstant{yoffset}{آفست‌وای} +\setinterfaceconstant{yscale}{مقیاس‌وای} +\setinterfaceconstant{ystep}{گام‌وای} +% definitions for interface elements for language pe +% +\setinterfaceelement{answerlines}{answerlines} +\setinterfaceelement{answerspace}{answerspace} +\setinterfaceelement{begin}{عنصرها} +\setinterfaceelement{complete}{کامل} +\setinterfaceelement{coupled}{مزدوج} +\setinterfaceelement{currentlocal}{موضعی‌جاری} +\setinterfaceelement{emptyone}{یک‌خالی} +\setinterfaceelement{emptytwo}{دوخالی} +\setinterfaceelement{end}{انتها} +\setinterfaceelement{endsetup}{انتهای‌بارگذاری} +\setinterfaceelement{get}{بگیر} +\setinterfaceelement{increment}{افزایش} +\setinterfaceelement{list}{لیست} +\setinterfaceelement{listof}{لیست‌از} +\setinterfaceelement{load}{بارگذاشتن} +\setinterfaceelement{local}{موضعی} +\setinterfaceelement{makeup}{آرایش} +\setinterfaceelement{next}{بعدی} +\setinterfaceelement{place}{مکان} +\setinterfaceelement{previous}{قبلی} +\setinterfaceelement{previouslocal}{موضع‌قبلی} +\setinterfaceelement{reserve}{رزرو} +\setinterfaceelement{see}{ببینید} +\setinterfaceelement{setup}{بارگذاری} +\setinterfaceelement{start}{شروع} +\setinterfaceelement{stop}{پایان} +\setinterfaceelement{text}{متن} +\setinterfaceelement{type}{تایپ} +% definitions for interface commands for language pe +% +\setinterfacecommand{CAPPED}{CAP} +\setinterfacecommand{Character}{Character} +\setinterfacecommand{Characters}{Characters} +\setinterfacecommand{MONTH}{MONTH} +\setinterfacecommand{Numbers}{Numbers} +\setinterfacecommand{Romannumerals}{Romannumerals} +\setinterfacecommand{SmallCapped}{Cap} +\setinterfacecommand{SmallCaps}{Caps} +\setinterfacecommand{WEEKDAY}{WEEKDAY} +\setinterfacecommand{WORD}{WORD} +\setinterfacecommand{WORDS}{WORDS} +\setinterfacecommand{Word}{Word} +\setinterfacecommand{Words}{Words} +\setinterfacecommand{about}{درمورد} +\setinterfacecommand{adaptlayout}{تنظیم‌طرح‌بندی} +\setinterfacecommand{arg}{افزودن} +\setinterfacecommand{at}{در} +\setinterfacecommand{atleftmargin}{درحاشیه‌چپ} +\setinterfacecommand{atpage}{درصفحه} +\setinterfacecommand{atrightmargin}{درحاشیه‌راست} +\setinterfacecommand{background}{پس‌زمینه} +\setinterfacecommand{backspace}{فاصله‌پشت} +\setinterfacecommand{blackrule}{خط‌سیاه} +\setinterfacecommand{blackrules}{خطهای‌سیاه} +\setinterfacecommand{blank}{خالی} +\setinterfacecommand{bookmark}{چوبخط} +\setinterfacecommand{bottomdistance}{فاصله‌پایین} +\setinterfacecommand{bottomheight}{ارتفاع‌پایین} +\setinterfacecommand{bottomspace}{فضای‌پایین} +\setinterfacecommand{but}{اما} +\setinterfacecommand{button}{دکمه} +\setinterfacecommand{bypassblocks}{عبوربلوکها} +\setinterfacecommand{character}{حرف} +\setinterfacecommand{characters}{حرفها} +\setinterfacecommand{chem}{chem} +\setinterfacecommand{clip}{گیره} +\setinterfacecommand{clonefield}{میدان‌شبیه‌سازی} +\setinterfacecommand{color}{رنگ} +\setinterfacecommand{colorbar}{میله‌رنگ} +\setinterfacecommand{colorvalue}{مقداررنگ} +\setinterfacecommand{column}{ستون} +\setinterfacecommand{comparecolorgroup}{مقایسه‌گروه‌رنگ} +\setinterfacecommand{comparepalet}{لوح‌مقایسه} +\setinterfacecommand{completepagenumber}{شماره‌صفحه‌کامل} +\setinterfacecommand{completeregister}{ثبت‌کامل} +\setinterfacecommand{component}{مولفه} +\setinterfacecommand{convertnumber}{شماره‌مبدل} +\setinterfacecommand{copyfield}{میدان‌کپی} +\setinterfacecommand{correctwhitespace}{فضای‌سفیدصحیح} +\setinterfacecommand{coupledocument}{نوشتارزوج} +\setinterfacecommand{couplemarking}{نشانه‌گذاری‌زوج} +\setinterfacecommand{couplepage}{صفحه‌زوج} +\setinterfacecommand{couplepaper}{کاغذزوج} +\setinterfacecommand{coupleregister}{ثبت‌زوج} +\setinterfacecommand{crlf}{crlf} +\setinterfacecommand{currentdate}{تاریخ‌جاری} +\setinterfacecommand{currentheadnumber}{شماره‌سرجاری} +\setinterfacecommand{cutspace}{فضای‌برش} +\setinterfacecommand{date}{تاریخ} +\setinterfacecommand{decouplemarking}{جداسازی‌نشانه‌گذاری} +\setinterfacecommand{decrementnumber}{شماره‌کاهش} +\setinterfacecommand{define}{تعریف} +\setinterfacecommand{defineaccent}{تعریف‌لهجه} +\setinterfacecommand{defineblank}{تعریف‌خالی} +\setinterfacecommand{defineblock}{تعریف‌بلوک} +\setinterfacecommand{definebodyfont}{تعریف‌قلم‌متن} +\setinterfacecommand{definebodyfontenvironment}{تعریف‌محیط‌قلم‌بدنه} +\setinterfacecommand{definebuffer}{تعریف‌بافر} +\setinterfacecommand{definecharacter}{تعریف‌حرف} +\setinterfacecommand{definecolor}{تعریف‌رنگ} +\setinterfacecommand{definecolorgroup}{تعریف‌گروه‌رنگ} +\setinterfacecommand{definecolumnbreak}{تعریف‌شکستن‌ستون} +\setinterfacecommand{definecolumnset}{تعریف‌مجموعه‌ستون} +\setinterfacecommand{definecombination}{تعریف‌ترکیب} +\setinterfacecommand{definecombinedlist}{تعریف‌لیست‌ترکیبی} +\setinterfacecommand{definecommand}{تعریف‌فرمان} +\setinterfacecommand{defineconversion}{تعریف‌تبدیل} +\setinterfacecommand{definedescription}{تعریف‌شرح} +\setinterfacecommand{defineenumeration}{تعریف‌شماره‌بندی} +\setinterfacecommand{definefield}{تعریف‌میدان} +\setinterfacecommand{definefieldstack}{تعریف‌توده‌میدان} +\setinterfacecommand{definefiguresymbol}{تعریف‌نمادشکل} +\setinterfacecommand{definefloat}{تعریف‌شناور} +\setinterfacecommand{definefont}{تعریف‌قلم} +\setinterfacecommand{definefontstyle}{تعریف‌سبک‌قلم} +\setinterfacecommand{definefontsynonym}{تعریف‌مترادف‌قلم} +\setinterfacecommand{defineframed}{تعریف‌قالبی} +\setinterfacecommand{defineframedtext}{تعریف‌متن‌قالبی} +\setinterfacecommand{definehbox}{تعریف‌جعبه‌‌افقی} +\setinterfacecommand{definehead}{تعریف‌سر} +\setinterfacecommand{defineindenting}{تعریف‌تورفتگی} +\setinterfacecommand{defineinmargin}{تعریف‌درون‌حاشیه} +\setinterfacecommand{defineinteractionmenu}{تعریف‌منوی‌پانل} +\setinterfacecommand{defineitemgroup}{تعریف‌گروه‌آیتم} +\setinterfacecommand{definelabel}{تعریف‌برچسب} +\setinterfacecommand{definelayer}{تعریف‌لایه} +\setinterfacecommand{definelayout}{تعریف‌طرح‌بندی} +\setinterfacecommand{definelist}{تعریف‌لیست} +\setinterfacecommand{definelogo}{تعریف‌آرم} +\setinterfacecommand{definemainfield}{تعریف‌میدان‌اصلی} +\setinterfacecommand{definemakeup}{تعریف‌آرایش} +\setinterfacecommand{definemarking}{تعریف‌نشانه‌گذاری} +\setinterfacecommand{definemathalignment}{تعریف‌تنظیم‌ریاضی} +\setinterfacecommand{defineoutput}{تعریف‌خروجی} +\setinterfacecommand{defineoverlay}{تعریف‌پوشش} +\setinterfacecommand{definepagebreak}{تعریف‌شکست‌صفحه} +\setinterfacecommand{definepalet}{تعریف‌لوح} +\setinterfacecommand{definepapersize}{تعریف‌اندازه‌برگ} +\setinterfacecommand{defineparagraphs}{تعریف‌پاراگرافها} +\setinterfacecommand{defineplacement}{تعریف‌جانشانی} +\setinterfacecommand{defineprofile}{تعریف‌پروفایل} +\setinterfacecommand{defineprogram}{تعریف‌برنامه} +\setinterfacecommand{definerawfont}{تعریف‌قلم‌خام} +\setinterfacecommand{definereference}{تعریف‌مرجع} +\setinterfacecommand{definereferenceformat}{تعریف‌شمایل‌مرجع} +\setinterfacecommand{definereferencelist}{تعریف‌لیست‌مرجع} +\setinterfacecommand{defineregister}{تعریف‌ثبت} +\setinterfacecommand{definerule}{تعریف‌خط‌حائل} +\setinterfacecommand{definesection}{تعریف‌بخش} +\setinterfacecommand{definesectionblock}{تعریف‌بلوک‌بخش} +\setinterfacecommand{definesorting}{تعریف‌ترتیب} +\setinterfacecommand{definestartstop}{تعریف‌شروع‌پایان} +\setinterfacecommand{definestyle}{تعریف‌سبک} +\setinterfacecommand{definesubfield}{تعریف‌زیرمیدان} +\setinterfacecommand{definesymbol}{تعریف‌نماد} +\setinterfacecommand{definesynonyms}{تعریف‌مترادفها} +\setinterfacecommand{definetabletemplate}{تعریف‌الگوی‌جدول} +\setinterfacecommand{definetabulate}{تعریف‌جدول‌بندی} +\setinterfacecommand{definetext}{تعریف‌متن} +\setinterfacecommand{definetextposition}{تعریف‌مکان‌متن} +\setinterfacecommand{definetextvariable}{تعریف‌متغیرمتن} +\setinterfacecommand{definetype}{تعریف‌تایپ} +\setinterfacecommand{definetyping}{تعریف‌تایپ‌کردن} +\setinterfacecommand{defineversion}{تعریف‌نسخه} +\setinterfacecommand{determineheadnumber}{تعیین‌شماره‌سر} +\setinterfacecommand{determinelistcharacteristics}{تعیین‌مشخصات‌لیست} +\setinterfacecommand{determineregistercharacteristics}{تعیین‌مشخصات‌ثبت} +\setinterfacecommand{dimension}{بعد} +\setinterfacecommand{disableinteractionmenu}{ازکارانداختن‌منوی‌پانل} +\setinterfacecommand{domicile}{مسکن} +\setinterfacecommand{donttest}{امتحان‌نکن} +\setinterfacecommand{edgedistance}{فاصله‌لبه} +\setinterfacecommand{edgewidth}{عرض‌لبه} +\setinterfacecommand{emptylines}{خطها‌خالی} +\setinterfacecommand{environment}{محیط} +\setinterfacecommand{externalfigure}{شکل‌خارجی} +\setinterfacecommand{fact}{حقیقت} +\setinterfacecommand{field}{میدان} +\setinterfacecommand{fieldstack}{میدان‌پشته} +\setinterfacecommand{fillinfield}{درج‌درمیدان} +\setinterfacecommand{fillinline}{درج‌درخط} +\setinterfacecommand{fillinrules}{درج‌درخطها} +\setinterfacecommand{fillintext}{درج‌درمتن} +\setinterfacecommand{fitfield}{پرکردن‌میدان} +\setinterfacecommand{fixedspace}{فضای‌ثابت} +\setinterfacecommand{fixedspaces}{فضاهای‌ثابت} +\setinterfacecommand{followprofile}{پیروی‌پروفایل} +\setinterfacecommand{followprofileversion}{پیروی‌نسخه‌پروفایل} +\setinterfacecommand{followversion}{پیروی‌نسخه} +\setinterfacecommand{footerdistance}{فاصله‌ته‌برگ} +\setinterfacecommand{footerheight}{ارتفاع‌ته‌برگ} +\setinterfacecommand{footnote}{پانوشت} +\setinterfacecommand{footnotetext}{متن‌پانوشت} +\setinterfacecommand{forceblocks}{اجباربلوکها} +\setinterfacecommand{formulanumber}{شماره‌فرمول} +\setinterfacecommand{fraction}{کسر} +\setinterfacecommand{framed}{قالبی} +\setinterfacecommand{from}{از} +\setinterfacecommand{getbuffer}{دریافت‌بافر} +\setinterfacecommand{getmarking}{دریافت‌نشانه} +\setinterfacecommand{getnumber}{دریافت‌شماره} +\setinterfacecommand{godown}{بروپایین} +\setinterfacecommand{goto}{بروبه} +\setinterfacecommand{gotobox}{بروبه‌جعبه} +\setinterfacecommand{gotopage}{بروبه‌صفحه} +\setinterfacecommand{graycolor}{رنگ‌خاکستری} +\setinterfacecommand{greyvalue}{مقدارخاکستری} +\setinterfacecommand{grid}{توری} +\setinterfacecommand{hairline}{خط‌مو} +\setinterfacecommand{head}{سر} +\setinterfacecommand{headerdistance}{فاصله‌سربرگ} +\setinterfacecommand{headerheight}{ارتفاع‌سربرگ} +\setinterfacecommand{headlevel}{مرحله‌سر} +\setinterfacecommand{headnumber}{شماره‌سر} +\setinterfacecommand{headsym}{نمادسر} +\setinterfacecommand{headtext}{متن‌سر} +\setinterfacecommand{hideblocks}{بلوکها‌پنهان} +\setinterfacecommand{high}{بلند} +\setinterfacecommand{hl}{خ‌ا} +\setinterfacecommand{immediatebetweenlist}{فوری‌بین‌لیست} +\setinterfacecommand{immediatetolist}{فوری‌به‌لیست} +\setinterfacecommand{in}{درون} +\setinterfacecommand{incrementnumber}{شماره‌افزایش} +\setinterfacecommand{indenting}{تورفتگی} +\setinterfacecommand{inframed}{درقالبی} +\setinterfacecommand{infull}{درپر} +\setinterfacecommand{ininner}{درداخلی} +\setinterfacecommand{inleft}{درچپ} +\setinterfacecommand{inleftedge}{درلبه‌چپ} +\setinterfacecommand{inleftmargin}{درحاشیه‌چپ} +\setinterfacecommand{inline}{درخط} +\setinterfacecommand{inmargin}{درحاشیه} +\setinterfacecommand{inmframed}{inmframed} +\setinterfacecommand{inneredgedistance}{فاصله‌لبه‌داخلی} +\setinterfacecommand{inneredgewidth}{عرض‌لبه‌داخلی} +\setinterfacecommand{innermargindistance}{فاصله‌حاشیه‌داخلی} +\setinterfacecommand{innermarginwidth}{عرض‌حاشیه‌داخلی} +\setinterfacecommand{inothermargin}{درحاشیه‌دیگر} +\setinterfacecommand{inouter}{درخارجی} +\setinterfacecommand{inright}{درراست} +\setinterfacecommand{inrightedge}{درلبه‌راست} +\setinterfacecommand{inrightmargin}{درحاشیه‌راست} +\setinterfacecommand{installlanguage}{نصب‌زبان} +\setinterfacecommand{interactionbar}{میله‌پانل} +\setinterfacecommand{interactionbuttons}{دکمه‌پانل} +\setinterfacecommand{interactionmenu}{منوی‌پانل} +\setinterfacecommand{item}{آیتم} +\setinterfacecommand{items}{آیتمها} +\setinterfacecommand{its}{its} +\setinterfacecommand{keepblocks}{حفظ‌بلوکها} +\setinterfacecommand{label}{برچسب} +\setinterfacecommand{labels}{برچسبها} +\setinterfacecommand{labeltext}{متن‌برچسب} +\setinterfacecommand{language}{زبان} +\setinterfacecommand{leftaligned}{چپ‌چین} +\setinterfacecommand{leftedgedistance}{فاصله‌لبه‌چپ} +\setinterfacecommand{leftedgewidth}{عرض‌لبه‌چپ} +\setinterfacecommand{leftmargindistance}{فاصله‌حاشیه‌چپ} +\setinterfacecommand{leftmarginwidth}{عرض‌حاشیه‌چپ} +\setinterfacecommand{leg}{پا} +\setinterfacecommand{linewidth}{عرض‌خط} +\setinterfacecommand{listheight}{ارتفاع‌خط} +\setinterfacecommand{listlength}{طول‌لیست} +\setinterfacecommand{listsymbol}{نمادلیست} +\setinterfacecommand{listwidth}{عرض‌لیست} +\setinterfacecommand{logfields}{میدانهای‌گزارش} +\setinterfacecommand{lohi}{پابا} +\setinterfacecommand{low}{پایین} +\setinterfacecommand{macroname}{نام‌ماکرو} +\setinterfacecommand{mainlanguage}{زبان‌اصلی} +\setinterfacecommand{makeupheight}{ارتفاع‌آرایش} +\setinterfacecommand{makeupwidth}{عرض‌آرایش} +\setinterfacecommand{mar}{حاش} +\setinterfacecommand{margindistance}{فاصله‌حاشیه} +\setinterfacecommand{marginrule}{خط‌حاشیه} +\setinterfacecommand{margintext}{متن‌حاشیه} +\setinterfacecommand{margintitle}{عنوان‌حاشیه} +\setinterfacecommand{marginwidth}{عرض‌حاشیه} +\setinterfacecommand{marginword}{کلمه‌حاشیه} +\setinterfacecommand{marking}{نشانه‌گذاری} +\setinterfacecommand{markversion}{نسخه‌نشانه} +\setinterfacecommand{mathematics}{ریاضی} +\setinterfacecommand{menubutton}{دکمه‌منو} +\setinterfacecommand{mframed}{mframed} +\setinterfacecommand{midaligned}{تنظیم‌وسط} +\setinterfacecommand{mirror}{آینه} +\setinterfacecommand{month}{ماه} +\setinterfacecommand{moveformula}{انتقال‌فرمول} +\setinterfacecommand{moveongrid}{انتقال‌به‌توری} +\setinterfacecommand{movesidefloat}{انتقال‌کنار‌شناور} +\setinterfacecommand{navigating}{هدایت} +\setinterfacecommand{nodimension}{بدون‌بعد} +\setinterfacecommand{noheaderandfooterlines}{بدون‌خط‌سروته‌برگ} +\setinterfacecommand{noindenting}{بدون‌تورفتگی} +\setinterfacecommand{nolist}{بدون‌لیست} +\setinterfacecommand{nomarking}{بدون‌نشانه‌گذاری} +\setinterfacecommand{nomoreblocks}{بدون‌بلوکهای‌بیشتر} +\setinterfacecommand{nomorefiles}{بدون‌فایلهای‌بیشتر} +\setinterfacecommand{nop}{منفی} +\setinterfacecommand{nospace}{بدون‌فضا} +\setinterfacecommand{note}{یادداشت} +\setinterfacecommand{notopandbottomlines}{بدون‌خط‌بالاوپایین} +\setinterfacecommand{notsmallcapped}{سرپوش‌کوچک‌نه} +\setinterfacecommand{nowhitespace}{بدون‌فضای‌سفید} +\setinterfacecommand{numberofsubpages}{شماره‌زیرصفحه} +\setinterfacecommand{numbers}{شماره‌ها} +\setinterfacecommand{outeredgedistance}{فاصله‌لبه‌خارجی} +\setinterfacecommand{outeredgewidth}{عرض‌لبه‌خارجی} +\setinterfacecommand{outermargindistance}{فاصله‌حاشیه‌خارجی} +\setinterfacecommand{outermarginwidth}{عرض‌حاشیه‌خارجی} +\setinterfacecommand{packed}{فشرده} +\setinterfacecommand{page}{صفحه} +\setinterfacecommand{pagedepth}{عمق‌صفحه} +\setinterfacecommand{pagenumber}{شماره‌صفحه} +\setinterfacecommand{pageoffset}{آفست‌صفحه} +\setinterfacecommand{pagereference}{مرجع‌صفحه} +\setinterfacecommand{pagetype}{نوع‌صفحه} +\setinterfacecommand{paperheight}{ارتفاع‌برگ} +\setinterfacecommand{paperwidth}{عرض‌برگ} +\setinterfacecommand{periods}{نقطه‌ها} +\setinterfacecommand{plaatsruwelijst}{درج‌لیست‌خام} +\setinterfacecommand{placebookmarks}{درج‌چوب‌خط} +\setinterfacecommand{placecombinedlist}{درج‌لیست‌مختلط} +\setinterfacecommand{placefloat}{درج‌شناور} +\setinterfacecommand{placefootnotes}{درج‌پانوشتها} +\setinterfacecommand{placeformula}{درج‌فرمول} +\setinterfacecommand{placeheadnumber}{درج‌شماره‌سر} +\setinterfacecommand{placeheadtext}{درج‌متن‌سر} +\setinterfacecommand{placelegend}{درج‌راهنما} +\setinterfacecommand{placelist}{درج‌لیست} +\setinterfacecommand{placelocalfootnotes}{درج‌پانوشتهای‌موضعی} +\setinterfacecommand{placelogos}{درج‌آرمها} +\setinterfacecommand{placeongrid}{درج‌در‌توری} +\setinterfacecommand{placeontopofeachother}{درج‌در‌بالای‌یکدیگر} +\setinterfacecommand{placepagenumber}{درج‌شماره‌صفحه} +\setinterfacecommand{placereferencelist}{درج‌لیست‌مرجع} +\setinterfacecommand{placeregister}{درج‌ثبت} +\setinterfacecommand{placerule}{درج‌خط} +\setinterfacecommand{placesidebyside}{درج‌کنار‌به‌کنار} +\setinterfacecommand{placesubformula}{درج‌زیرفرمول} +\setinterfacecommand{placetextvariable}{درج‌متغیرمتن} +\setinterfacecommand{position}{مکان} +\setinterfacecommand{positiontext}{مکان‌متن} +\setinterfacecommand{printpaperheight}{چاپ‌ارتفاع‌برگ} +\setinterfacecommand{printpaperwidth}{چاپ‌عرض‌برگ} +\setinterfacecommand{processblocks}{بلوکهای‌پردازش} +\setinterfacecommand{processpage}{صفحه‌پردازش} +\setinterfacecommand{product}{تولید} +\setinterfacecommand{program}{برنامه} +\setinterfacecommand{project}{پروژه} +\setinterfacecommand{publication}{نشر} +\setinterfacecommand{quotation}{نقل‌قول} +\setinterfacecommand{quote}{نقل} +\setinterfacecommand{ran}{ran} +\setinterfacecommand{redo}{انجام‌دوباره} +\setinterfacecommand{ref}{رج} +\setinterfacecommand{reference}{مرجع} +\setinterfacecommand{referral}{رجوع} +\setinterfacecommand{referraldate}{تاریخ‌رجوع} +\setinterfacecommand{referring}{مراجعه} +\setinterfacecommand{remark}{توجه} +\setinterfacecommand{reset}{بازنشانی} +\setinterfacecommand{resetmarking}{بازنشانی‌نشانه‌گذاری} +\setinterfacecommand{resetnumber}{بازنشانی‌شماره} +\setinterfacecommand{resettext}{بازنشانی‌متن} +\setinterfacecommand{rightaligned}{تنظیم‌راست} +\setinterfacecommand{rightedgedistance}{فاصله‌لبه‌راست} +\setinterfacecommand{rightedgewidth}{عرض‌لبه‌راست} +\setinterfacecommand{rightmargindistance}{فاصله‌حاشیه‌راست} +\setinterfacecommand{rightmarginwidth}{عرض‌حاشیه‌راست} +\setinterfacecommand{romannumerals}{اعدادلاتین} +\setinterfacecommand{rotate}{دوران} +\setinterfacecommand{scale}{مقیاس} +\setinterfacecommand{screen}{پرده} +\setinterfacecommand{selectblocks}{انتخاب‌بلوکها} +\setinterfacecommand{selectpaper}{انتخاب‌برگ} +\setinterfacecommand{selectversion}{انتخاب‌نسخه} +\setinterfacecommand{setnumber}{تعیین‌شماره} +\setinterfacecommand{settextcontent}{تعیین‌محتوای‌متن} +\setinterfacecommand{settextvariable}{تعیین‌متغیر‌متن} +\setinterfacecommand{setupalign}{بارگذاری‌تنظیم} +\setinterfacecommand{setupanswerarea}{setupanswerarea} +\setinterfacecommand{setuparranging}{بارگذاری‌ترتیب} +\setinterfacecommand{setupbackground}{بارگذاری‌پس‌زمینه} +\setinterfacecommand{setupbackgrounds}{بارگذاری‌پس‌زمینه‌ها} +\setinterfacecommand{setupblackrules}{بارگذاری‌خطهای‌سیاه} +\setinterfacecommand{setupblank}{بارگذاری‌خالی} +\setinterfacecommand{setupblock}{بارگذاری‌بلوک} +\setinterfacecommand{setupbodyfont}{بارگذاری‌قلم‌متن} +\setinterfacecommand{setupbodyfontenvironment}{بارگذاری‌محیط‌قلم‌متن} +\setinterfacecommand{setupbottom}{بارگذاری‌پایین} +\setinterfacecommand{setupbottomtexts}{بارگذاری‌متن‌پایین} +\setinterfacecommand{setupbuffer}{بارگذاری‌بافر} +\setinterfacecommand{setupbuttons}{بارگذاری‌دکمه‌ها} +\setinterfacecommand{setupcapitals}{setupcapitals} +\setinterfacecommand{setupcaption}{بارگذاری‌شرح} +\setinterfacecommand{setupcaptions}{بارگذاری‌شرحها} +\setinterfacecommand{setupclipping}{بارگذاری‌چیدن} +\setinterfacecommand{setupcolor}{بارگذاری‌رنگ} +\setinterfacecommand{setupcolors}{بارگذاری‌رنگها} +\setinterfacecommand{setupcolumns}{بارگذاری‌ستونها} +\setinterfacecommand{setupcolumnset}{بارگذاری‌مجموعه‌ستون} +\setinterfacecommand{setupcolumnsetlines}{بارگذاری‌خطهای‌مجموعه‌ستون} +\setinterfacecommand{setupcolumnsetstart}{بارگذاری‌شروع‌مجموعه‌ستون} +\setinterfacecommand{setupcombinations}{بارگذاری‌ترکیب‌ها} +\setinterfacecommand{setupcombinedlist}{بارگذاری‌لیست‌ترکیبی} +\setinterfacecommand{setupcomment}{بارگذاری‌توضیح} +\setinterfacecommand{setupdescriptions}{بارگذاری‌شرح} +\setinterfacecommand{setupenumerations}{بارگذاری‌شماره‌گذاریها} +\setinterfacecommand{setupexternalfigures}{بارگذاری‌شکلهای‌خارجی} +\setinterfacecommand{setupfield}{بارگذاری‌میدان} +\setinterfacecommand{setupfields}{بارگذاری‌میدانها} +\setinterfacecommand{setupfillinlines}{بارگذاری‌پرکردن‌خطها} +\setinterfacecommand{setupfillinrules}{بارگذاری‌درج‌درخطها} +\setinterfacecommand{setupfloat}{بارگذاری‌شناور} +\setinterfacecommand{setupfloats}{بارگذاری‌شناورها} +\setinterfacecommand{setupfloatsplitting}{بارگذاری‌شکافتن‌شناورها} +\setinterfacecommand{setupfooter}{بارگذاری‌ته‌برگ} +\setinterfacecommand{setupfootertexts}{بارگذاری‌متن‌پانوشت} +\setinterfacecommand{setupfootnotedefinition}{بارگذاری‌تعریف‌پانوشت} +\setinterfacecommand{setupfootnotes}{بارگذاری‌پانوشتها} +\setinterfacecommand{setupforms}{بارگذاری‌طرح} +\setinterfacecommand{setupformulas}{بارگذاری‌فرمولها} +\setinterfacecommand{setupframed}{بارگذاری‌قالبی} +\setinterfacecommand{setupframedtexts}{بارگذاری‌متن‌قالبی} +\setinterfacecommand{setuphead}{بارگذاری‌سر} +\setinterfacecommand{setupheader}{بارگذاری‌سربرگ} +\setinterfacecommand{setupheadertexts}{بارگذاری‌متن‌سربرگ} +\setinterfacecommand{setupheadnumber}{بارگذاری‌شماره‌سر} +\setinterfacecommand{setupheads}{بارگذاری‌سرها} +\setinterfacecommand{setupheadtext}{بارگذاری‌متن‌سر} +\setinterfacecommand{setuphyphenmark}{بارگذاری‌نشانه‌شکستن} +\setinterfacecommand{setupindentations}{بارگذاری‌تورفتگیها} +\setinterfacecommand{setupindenting}{بارگذاری‌تورفتگی} +\setinterfacecommand{setupinmargin}{بارگذاری‌درون‌حاشیه} +\setinterfacecommand{setupinteraction}{بارگذاری‌پانل} +\setinterfacecommand{setupinteractionbar}{بارگذاری‌میله‌پانل} +\setinterfacecommand{setupinteractionmenu}{بارگذاری‌منوی‌پانل} +\setinterfacecommand{setupinteractionscreen}{بارگذاری‌پرده‌پانل} +\setinterfacecommand{setupinterlinespace}{بارگذاری‌فاصله‌بین‌خط} +\setinterfacecommand{setupitemgroup}{بارگذاری‌گروه‌آیتم} +\setinterfacecommand{setupitemgroups}{بارگذاری‌گروههای‌آیتم} +\setinterfacecommand{setupitems}{بارگذاری‌آیتمها} +\setinterfacecommand{setuplabeltext}{باگذاری‌متن‌برچسب} +\setinterfacecommand{setuplanguage}{بارگذاری‌زبان} +\setinterfacecommand{setuplayout}{بارگذاری‌طرح‌بندی} +\setinterfacecommand{setuplegend}{بارگذاری‌راهنما} +\setinterfacecommand{setuplinenumbering}{بارگذاری‌شماره‌‌گذاری‌خط} +\setinterfacecommand{setuplines}{بارگذاری‌خطها} +\setinterfacecommand{setuplinewidth}{بارگذاری‌عرض‌خط} +\setinterfacecommand{setuplist}{بارگذاری‌لیست} +\setinterfacecommand{setupmakeup}{بارگذاری‌آرایش} +\setinterfacecommand{setupmarginblocks}{بارگذاری‌بلوکهای‌حاشیه} +\setinterfacecommand{setupmarginrules}{بارگذاری‌خطهای‌حاشیه} +\setinterfacecommand{setupmarking}{بارگذاری‌نشانه‌گذاری} +\setinterfacecommand{setupmathalignment}{بارگذاری‌تنظیم‌ریاضی} +\setinterfacecommand{setupnarrower}{بارگذاری‌باریکتر} +\setinterfacecommand{setupnumber}{بارگذاری‌شماره} +\setinterfacecommand{setupnumbering}{بارگذاری‌شماره‌گذاری} +\setinterfacecommand{setupoppositeplacing}{بارگذاری‌درج‌مخالف} +\setinterfacecommand{setupoutput}{بارگذاری‌خروجی} +\setinterfacecommand{setuppagecomment}{بارگذاری‌توضیح‌صفحه} +\setinterfacecommand{setuppagenumber}{بارگذاری‌شماره‌صفحه} +\setinterfacecommand{setuppagenumbering}{بارگذاری‌شماره‌گذاری‌صفحه} +\setinterfacecommand{setuppagetransitions}{بارگذاری‌گذارصفحه} +\setinterfacecommand{setuppalet}{بارگذاری‌لوح} +\setinterfacecommand{setuppaper}{بارگذاری‌برگ} +\setinterfacecommand{setuppapersize}{بارگذاری‌اندازه‌برگ} +\setinterfacecommand{setupparagraphnumbering}{بارگذاری‌شماره‌گذاری‌پاراگراف} +\setinterfacecommand{setupparagraphs}{بارگذاری‌پاراگرافها} +\setinterfacecommand{setupplacement}{بارگذاری‌جانشانی} +\setinterfacecommand{setuppositioning}{بارگذاری‌مکان‌گذاری} +\setinterfacecommand{setupprofiles}{بارگذاری‌پروفایلها} +\setinterfacecommand{setupprograms}{بارگذاری‌برنامه‌ها} +\setinterfacecommand{setuppublications}{بارگذاری‌نشرها} +\setinterfacecommand{setupquote}{بارگذاری‌نقل} +\setinterfacecommand{setupreferencelist}{بارگذاری‌لیست‌مرجع} +\setinterfacecommand{setupreferencing}{بارگذاری‌ارجاع} +\setinterfacecommand{setupregister}{بارگذاری‌ثبت} +\setinterfacecommand{setuprotate}{بارگذاری‌دوران} +\setinterfacecommand{setuprule}{بارگذاری‌خط} +\setinterfacecommand{setups}{بارگذاریها} +\setinterfacecommand{setupscreens}{بارگذاری‌پرده‌ها} +\setinterfacecommand{setupsection}{بارگذاری‌بخش} +\setinterfacecommand{setupsectionblock}{بارگذاری‌بلوک‌بخش} +\setinterfacecommand{setupsorting}{بارگذاری‌ترتیب} +\setinterfacecommand{setupspacing}{بارگذاری‌فضا‌گذاری} +\setinterfacecommand{setupstartstop}{بارگذاری‌شروع‌پایان} +\setinterfacecommand{setupstrut}{بارگذاری‌بست} +\setinterfacecommand{setupsubpagenumber}{بارگذاری‌شماره‌زیرصفحه} +\setinterfacecommand{setupsymbolset}{بارگذاری‌مجموعه‌نماد} +\setinterfacecommand{setupsynchronization}{بارگذاری‌تطابق} +\setinterfacecommand{setupsynchronizationbar}{بارگذاری‌میله‌تطابق} +\setinterfacecommand{setupsynonyms}{بارگذاری‌مترادفها} +\setinterfacecommand{setupsystem}{بارگذاری‌سیستم} +\setinterfacecommand{setuptab}{بارگذاری‌تب} +\setinterfacecommand{setuptables}{بارگذاری‌جدولها} +\setinterfacecommand{setuptabulate}{بارگذاری‌جدول‌بندی} +\setinterfacecommand{setuptext}{بارگذاری‌متن} +\setinterfacecommand{setuptextposition}{بارگذاری‌مکان‌متن} +\setinterfacecommand{setuptextrules}{بارگذاری‌خطهای‌متن} +\setinterfacecommand{setuptexttexts}{بارگذاری‌متن‌متنها} +\setinterfacecommand{setuptextvariable}{بارگذاری‌متغیر‌متن} +\setinterfacecommand{setupthinrules}{بارگذاری‌خطها‌ی‌نازک} +\setinterfacecommand{setuptolerance}{بارگذاری‌بردباری} +\setinterfacecommand{setuptop}{بارگذاری‌بالا} +\setinterfacecommand{setuptoptexts}{بارگذاری‌متنهای‌بالا} +\setinterfacecommand{setuptype}{بارگذاری‌تایپ} +\setinterfacecommand{setuptyping}{بارگذاری‌تایپ‌کردن} +\setinterfacecommand{setupunderbar}{بارگذاری‌میله‌زیر} +\setinterfacecommand{setupurl}{setupurl} +\setinterfacecommand{setupversions}{بارگذاری‌نسخه‌ها} +\setinterfacecommand{setupwhitespace}{بارگذاری‌فضای‌سفید} +\setinterfacecommand{showbodyfont}{نمایش‌قلم‌بدنه} +\setinterfacecommand{showbodyfontenvironment}{نمایش‌محیط‌قلم‌بدنه} +\setinterfacecommand{showcolor}{نمایش‌رنگ} +\setinterfacecommand{showcolorgroup}{نمایش‌گروه‌رنگ} +\setinterfacecommand{showexternalfigures}{نمایش‌شکلهای‌خارجی} +\setinterfacecommand{showfields}{نمایش‌میدانها} +\setinterfacecommand{showframe}{نمایش‌قالب} +\setinterfacecommand{showgrid}{نمایش‌توری} +\setinterfacecommand{showlayout}{نمایش‌طرح‌بندی} +\setinterfacecommand{showmakeup}{نمایش‌آرایش} +\setinterfacecommand{showpalet}{نمایش‌لوح} +\setinterfacecommand{showprint}{نمایش‌چاپ} +\setinterfacecommand{showsetups}{نمایش‌بارگذاریها} +\setinterfacecommand{showstruts}{نمایش‌بستها} +\setinterfacecommand{showsymbolset}{نمایش‌مجموعه‌علامت} +\setinterfacecommand{smallcapped}{cap} +\setinterfacecommand{someline}{یک‌خط} +\setinterfacecommand{somewhere}{یک‌جا} +\setinterfacecommand{space}{فضا} +\setinterfacecommand{splitfloat}{شکافتن‌شناور} +\setinterfacecommand{startalignment}{شروع‌تنظیم} +\setinterfacecommand{startbackground}{شروع‌پس‌زمینه} +\setinterfacecommand{startcoding}{شروع‌کد} +\setinterfacecommand{startcolor}{شروع‌رنگ} +\setinterfacecommand{startcolumnmakeup}{شروع‌آرایش‌ستون} +\setinterfacecommand{startcolumns}{شروع‌ستونها} +\setinterfacecommand{startcolumnset}{شروع‌مجموعه‌ستون} +\setinterfacecommand{startcombination}{شروع‌ترکیب} +\setinterfacecommand{startcomponent}{شروع‌مولفه} +\setinterfacecommand{startdocument}{شروع‌نوشتار} +\setinterfacecommand{startenvironment}{شروع‌محیط} +\setinterfacecommand{startfigure}{شروع‌شکل} +\setinterfacecommand{startglobal}{شروع‌سراسری} +\setinterfacecommand{startline}{شروع‌خط} +\setinterfacecommand{startlinecorrection}{شروع‌تصحیح‌خط} +\setinterfacecommand{startlinenumbering}{شروع‌شماره‌گذاری‌خط} +\setinterfacecommand{startlines}{شروع‌خطها} +\setinterfacecommand{startlocal}{شروع‌موضعی} +\setinterfacecommand{startlocalfootnotes}{شروع‌پانوشتهای‌موضعی} +\setinterfacecommand{startmakeup}{شروع‌آرایش} +\setinterfacecommand{startmarginblock}{شروع‌بلوک‌حاشیه} +\setinterfacecommand{startmarginrule}{شروع‌خط‌حاشیه} +\setinterfacecommand{startnarrower}{شروع‌باریکتر} +\setinterfacecommand{startopposite}{شروع‌مخالف} +\setinterfacecommand{startoverlay}{شروع‌پوشش} +\setinterfacecommand{startoverzicht}{شروع‌بازبینی} +\setinterfacecommand{startpacked}{شروع‌فشرده} +\setinterfacecommand{startpositioning}{شروع‌مکان‌گذاری} +\setinterfacecommand{startproduct}{شروع‌تولید} +\setinterfacecommand{startprofile}{شروع‌پروفایل} +\setinterfacecommand{startproject}{شروع‌پروژه} +\setinterfacecommand{startquotation}{شروع‌نقل‌قول} +\setinterfacecommand{startraster}{startraster} +\setinterfacecommand{startsymbolset}{شروع‌مجموعه‌نماد} +\setinterfacecommand{startsynchronization}{شروع‌تطابق} +\setinterfacecommand{starttable}{شروع‌جدول} +\setinterfacecommand{starttables}{شروع‌جدولها} +\setinterfacecommand{starttext}{شروع‌متن} +\setinterfacecommand{starttextrule}{شروع‌خط‌متن} +\setinterfacecommand{startunpacked}{شروع‌غیر‌فشرده} +\setinterfacecommand{startversion}{شروع‌نسخه} +\setinterfacecommand{stopalignment}{پایان‌تنظیم} +\setinterfacecommand{stopbackground}{پایان‌پس‌زمینه} +\setinterfacecommand{stopcoding}{پایان‌کد} +\setinterfacecommand{stopcolor}{پایان‌رنگ} +\setinterfacecommand{stopcolumnmakeup}{پایان‌آرایش‌ستون} +\setinterfacecommand{stopcolumns}{پایان‌ستونها} +\setinterfacecommand{stopcolumnset}{پایان‌مجموعه‌ستون} +\setinterfacecommand{stopcombination}{پایان‌ترکیب} +\setinterfacecommand{stopcomponent}{پایان‌مولفه} +\setinterfacecommand{stopdocument}{پایان‌نوشتار} +\setinterfacecommand{stopenvironment}{پایان‌محیط} +\setinterfacecommand{stopglobal}{پایان‌سراسری} +\setinterfacecommand{stopline}{پایان‌خط} +\setinterfacecommand{stoplinecorrection}{پایان‌تصحیح‌خط} +\setinterfacecommand{stoplinenumbering}{پایان‌شماره‌گذاری‌خط} +\setinterfacecommand{stoplines}{پایان‌خطها} +\setinterfacecommand{stoplocal}{پایان‌موضعی} +\setinterfacecommand{stoplocalfootnotes}{پایان‌پانوشتهای‌موضعی} +\setinterfacecommand{stopmakeup}{پایان‌آرایش} +\setinterfacecommand{stopmarginblock}{پایان‌بلوک‌حاشیه} +\setinterfacecommand{stopmarginrule}{پایان‌خط‌حاشیه} +\setinterfacecommand{stopnarrower}{پایان‌نازکتر} +\setinterfacecommand{stopopposite}{پایان‌مخالف} +\setinterfacecommand{stopoverlay}{پایان‌پوشش} +\setinterfacecommand{stopoverzicht}{پایان‌بازبینی} +\setinterfacecommand{stoppacked}{پایان‌فشرده} +\setinterfacecommand{stoppositioning}{پایان‌مکان‌گذاری} +\setinterfacecommand{stopproduct}{پایان‌تولید} +\setinterfacecommand{stopprofile}{پایان‌پروفایل} +\setinterfacecommand{stopproject}{پایان‌پروژه} +\setinterfacecommand{stopquotation}{پایان‌نقل‌قول} +\setinterfacecommand{stopraster}{stopraster} +\setinterfacecommand{stopsynchronization}{پایان‌تطابق} +\setinterfacecommand{stoptable}{پایان‌جدول} +\setinterfacecommand{stoptables}{پایان‌جدولها} +\setinterfacecommand{stoptext}{پایان‌متن} +\setinterfacecommand{stoptextrule}{پایان‌خط‌متن} +\setinterfacecommand{stopunpacked}{پایان‌غیرفشرده} +\setinterfacecommand{stopversion}{پایان‌نسخه} +\setinterfacecommand{stretched}{کشیده} +\setinterfacecommand{subformulanumber}{شماره‌زیرفرمول} +\setinterfacecommand{subpagenumber}{شماره‌زیرصفحه} +\setinterfacecommand{switchtobodyfont}{تغییربه‌قلم‌بدنه} +\setinterfacecommand{switchtorawfont}{تغییربه‌قلم‌خام} +\setinterfacecommand{sym}{نم} +\setinterfacecommand{symbol}{نماد} +\setinterfacecommand{synchronizationbar}{میله‌تطابق} +\setinterfacecommand{synchronize}{تطابق} +\setinterfacecommand{tab}{تب} +\setinterfacecommand{testcolumn}{ستون‌امتحان} +\setinterfacecommand{testpage}{صفحه‌تست} +\setinterfacecommand{tex}{تک} +\setinterfacecommand{textheight}{ارتفاع‌متن} +\setinterfacecommand{textreference}{مرجع‌متن} +\setinterfacecommand{textrule}{خط‌متن} +\setinterfacecommand{textvariable}{متغیر متن} +\setinterfacecommand{textwidth}{عرض‌متن} +\setinterfacecommand{thinrule}{خط‌نازک} +\setinterfacecommand{thinrules}{خطهای‌نازک} +\setinterfacecommand{tooltip}{tooltip} +\setinterfacecommand{topdistance}{فاصله‌بالا} +\setinterfacecommand{topheight}{ارتفاع‌بالا} +\setinterfacecommand{topspace}{فضای‌بالا} +\setinterfacecommand{totalnumberofpages}{شماره‌کل‌صفحه‌ها} +\setinterfacecommand{translate}{ترجمه} +\setinterfacecommand{txt}{txt} +\setinterfacecommand{typ}{typ} +\setinterfacecommand{type}{تایپ} +\setinterfacecommand{typebuffer}{تایپ‌بافر} +\setinterfacecommand{typefile}{تایپ‌پرونده} +\setinterfacecommand{unitmeaning}{معنی‌واحد} +\setinterfacecommand{unknown}{ناشناس} +\setinterfacecommand{useJSscripts}{useJSscripts} +\setinterfacecommand{useURL}{useURL} +\setinterfacecommand{useXMLfilter}{useXMLfilter} +\setinterfacecommand{useblocks}{استفاده‌بلوکها} +\setinterfacecommand{usecommands}{استفاده‌فرمانها} +\setinterfacecommand{useencoding}{استفاده‌رمزینه} +\setinterfacecommand{useexternaldocument}{استفاده‌نوشتارخارجی} +\setinterfacecommand{useexternalfigure}{استفاده‌شکل‌خارجی} +\setinterfacecommand{useexternalfile}{استفاده‌پرونده‌خارجی} +\setinterfacecommand{useexternalfiles}{استفاده‌پرونده‌های‌خارجی} +\setinterfacecommand{useexternalsoundtrack}{استفاده‌قطعه‌موزیک‌خارجی} +\setinterfacecommand{usemodule}{استفاده‌مدول} +\setinterfacecommand{usemodules}{استفاده‌مدولها} +\setinterfacecommand{usepath}{استفاده‌مسیر} +\setinterfacecommand{usereferences}{استفاده‌مرجعها} +\setinterfacecommand{usespecials}{استفاده‌ویژگیها} +\setinterfacecommand{usesymbols}{استفاده‌نمادها} +\setinterfacecommand{usetypescript}{استفاده‌دستخط‌تایپ} +\setinterfacecommand{usetypescriptfile}{استفاده‌پرونده‌دستخط‌تایپ} +\setinterfacecommand{useurl}{useurl} +\setinterfacecommand{version}{نسخه} +\setinterfacecommand{vl}{خ‌ع} +\setinterfacecommand{weekday}{روزهفته} +\setinterfacecommand{whitespace}{فضای‌سفید} +\setinterfacecommand{wordright}{کلمه‌راست} +\setinterfacecommand{writebetweenlist}{بنویس‌بین‌لیست} +\setinterfacecommand{writetolist}{بنویس‌در‌لیست} +\setinterfacecommand{writetoreferencelist}{بنویس‌درلیست‌مرجع} +\setinterfacecommand{writetoregister}{بنویس‌درثبت} +% +\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-ro.mkii b/Master/texmf-dist/tex/context/base/mult-ro.mkii new file mode 100644 index 00000000000..474cf7c43e0 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-ro.mkii @@ -0,0 +1,1715 @@ +% this file is auto-generated, don't edit this file +% +% definitions for interface variables for language ro +% +\setinterfacevariable{Addition}{Adaugare} +\setinterfacevariable{Balloon}{Balon} +\setinterfacevariable{Character}{Caracter} +\setinterfacevariable{Characters}{Caractere} +\setinterfacevariable{CloseDocument}{InchideDocument} +\setinterfacevariable{ExitViewer}{IesireVizualizator} +\setinterfacevariable{FirstPage}{PrimaPagina} +\setinterfacevariable{FitHeight}{AjustatInaltime} +\setinterfacevariable{FitWidth}{AjustatLatime} +\setinterfacevariable{GotoPage}{LaPagina} +\setinterfacevariable{Greek}{Grec} +\setinterfacevariable{Help}{Ajutor} +\setinterfacevariable{HideField}{AscundeCamp} +\setinterfacevariable{HideLayer}{HideLayer} +\setinterfacevariable{Key}{Cheie} +\setinterfacevariable{LastPage}{UltimaPagina} +\setinterfacevariable{LoadForm}{IncarcaFormular} +\setinterfacevariable{MONTH}{LUNA} +\setinterfacevariable{New}{Nou} +\setinterfacevariable{NextJump}{SaltUrmator} +\setinterfacevariable{NextPage}{PaginaUrmatoare} +\setinterfacevariable{Numbers}{Numere} +\setinterfacevariable{OpenNamedDocument}{OpenNamedDocument} +\setinterfacevariable{Paragraph}{Paragraf} +\setinterfacevariable{PauseMovie}{PauzaFilm} +\setinterfacevariable{PauseRendering}{PauseRendering} +\setinterfacevariable{PauseSound}{PauzaSunet} +\setinterfacevariable{PreviousJump}{SaltPrecedent} +\setinterfacevariable{PreviousPage}{PaginaPrecedenta} +\setinterfacevariable{PrintDocument}{TiparesteDocument} +\setinterfacevariable{Query}{Query} +\setinterfacevariable{QueryAgain}{QueryAgain} +\setinterfacevariable{ResetForm}{ResetareFormular} +\setinterfacevariable{ResumeMovie}{RepornesteFilm} +\setinterfacevariable{ResumeRendering}{ResumeRendering} +\setinterfacevariable{ResumeSound}{RepornesteSunet} +\setinterfacevariable{Romannumerals}{Numereromane} +\setinterfacevariable{SaveDocument}{SalvareDocument} +\setinterfacevariable{SaveForm}{SalveazaFormular} +\setinterfacevariable{SaveNamedDocument}{SaveNamedDocument} +\setinterfacevariable{SearchAgain}{CautaDinNou} +\setinterfacevariable{SearchDocument}{CautaDocument} +\setinterfacevariable{ShowBookmarks}{ShowBookmarks} +\setinterfacevariable{ShowField}{AfiseazaCamp} +\setinterfacevariable{ShowThumbs}{ShowThumbs} +\setinterfacevariable{StartMovie}{StartFilm} +\setinterfacevariable{StartRendering}{StartRendering} +\setinterfacevariable{StartSound}{StartSunet} +\setinterfacevariable{StopMovie}{StopFilm} +\setinterfacevariable{StopRendering}{StopRendering} +\setinterfacevariable{StopSound}{StopSunet} +\setinterfacevariable{SubmitForm}{TrimiteFormular} +\setinterfacevariable{ToggleLayer}{ToggleLayer} +\setinterfacevariable{ToggleViewer}{SchimbaVizualizator} +\setinterfacevariable{URL}{URL} +\setinterfacevariable{VideLayer}{VideLayer} +\setinterfacevariable{ViewerHelp}{AjutorVizualizator} +\setinterfacevariable{WEEKDAY}{ZISAPTAMANA} +\setinterfacevariable{WORD}{CUVANT} +\setinterfacevariable{abbreviation}{abreviere} +\setinterfacevariable{abbreviations}{abrevieri} +\setinterfacevariable{absolute}{absolut} +\setinterfacevariable{action}{actiune} +\setinterfacevariable{after}{dupa} +\setinterfacevariable{all}{tot} +\setinterfacevariable{always}{totdeauna} +\setinterfacevariable{and}{and} +\setinterfacevariable{answerarea}{answerarea} +\setinterfacevariable{appendices}{apendixuri} +\setinterfacevariable{appendix}{apendix} +\setinterfacevariable{april}{aprilie} +\setinterfacevariable{atmargin}{lamargine} +\setinterfacevariable{atpage}{lapagina} +\setinterfacevariable{attachment}{attachment} +\setinterfacevariable{august}{august} +\setinterfacevariable{author}{autor} +\setinterfacevariable{auto}{auto} +\setinterfacevariable{autointro}{autointro} +\setinterfacevariable{back}{inapot} +\setinterfacevariable{background}{fundal} +\setinterfacevariable{backmatter}{epilogul} +\setinterfacevariable{backpart}{epilog} +\setinterfacevariable{backspace}{spatiuspate} +\setinterfacevariable{backward}{inapoi} +\setinterfacevariable{bbl}{bbl} +\setinterfacevariable{before}{inainte} +\setinterfacevariable{begin}{begin} +\setinterfacevariable{bib}{bib} +\setinterfacevariable{big}{mare} +\setinterfacevariable{bigbodyfont}{bigbodyfont} +\setinterfacevariable{bigger}{bigger} +\setinterfacevariable{bigpreference}{preferintamare} +\setinterfacevariable{blank}{blank} +\setinterfacevariable{blockquote}{blockquote} +\setinterfacevariable{bodymatter}{principalul} +\setinterfacevariable{bodypart}{principal} +\setinterfacevariable{bold}{aldin} +\setinterfacevariable{bolditalic}{aldinitalic} +\setinterfacevariable{boldslanted}{aldininclinat} +\setinterfacevariable{bookmark}{semncarte} +\setinterfacevariable{both}{ambele} +\setinterfacevariable{bottom}{subsol} +\setinterfacevariable{brief}{brief} +\setinterfacevariable{broad}{broad} +\setinterfacevariable{buffer}{buffer} +\setinterfacevariable{by}{de} +\setinterfacevariable{calligraphic}{caligrafic} +\setinterfacevariable{cap}{cap} +\setinterfacevariable{capital}{majuscula} +\setinterfacevariable{center}{center} +\setinterfacevariable{chapter}{capitol} +\setinterfacevariable{character}{caracter} +\setinterfacevariable{characters}{caractere} +\setinterfacevariable{cite}{cite} +\setinterfacevariable{color}{culoare} +\setinterfacevariable{column}{coloana} +\setinterfacevariable{columns}{coloane} +\setinterfacevariable{command}{comanda} +\setinterfacevariable{commands}{comenzi} +\setinterfacevariable{comment}{comentariu} +\setinterfacevariable{component}{componenta} +\setinterfacevariable{concept}{concept} +\setinterfacevariable{content}{cuprins} +\setinterfacevariable{contents}{cuprinsuri} +\setinterfacevariable{continue}{continuu} +\setinterfacevariable{continued}{continued} +\setinterfacevariable{controls}{controale} +\setinterfacevariable{conversion}{conversie} +\setinterfacevariable{current}{curent} +\setinterfacevariable{cutspace}{cutspace} +\setinterfacevariable{date}{data} +\setinterfacevariable{day}{zi} +\setinterfacevariable{december}{decembrie} +\setinterfacevariable{default}{implicit} +\setinterfacevariable{depth}{adancime} +\setinterfacevariable{description}{descriere} +\setinterfacevariable{disable}{dezactivat} +\setinterfacevariable{display}{display} +\setinterfacevariable{dot}{punct} +\setinterfacevariable{doublesided}{douafete} +\setinterfacevariable{down}{down} +\setinterfacevariable{each}{fiecare} +\setinterfacevariable{edge}{bordura} +\setinterfacevariable{embed}{embed} +\setinterfacevariable{empty}{gol} +\setinterfacevariable{end}{end} +\setinterfacevariable{endnote}{endnote} +\setinterfacevariable{enumeration}{enumerare} +\setinterfacevariable{environment}{mediu} +\setinterfacevariable{even}{par} +\setinterfacevariable{external}{extern} +\setinterfacevariable{fact}{fapt} +\setinterfacevariable{february}{februarie} +\setinterfacevariable{figure}{figura} +\setinterfacevariable{figures}{figure} +\setinterfacevariable{file}{fisier} +\setinterfacevariable{final}{final} +\setinterfacevariable{first}{primul} +\setinterfacevariable{firstcolumn}{firstcolumn} +\setinterfacevariable{firstpage}{primapagina} +\setinterfacevariable{firstsubpage}{primasubpagina} +\setinterfacevariable{fit}{ajustat} +\setinterfacevariable{five}{cinci} +\setinterfacevariable{fix}{fix} +\setinterfacevariable{fixed}{fixat} +\setinterfacevariable{flexible}{flexibil} +\setinterfacevariable{float}{obiectmobil} +\setinterfacevariable{flushinner}{flushinner} +\setinterfacevariable{flushleft}{flushleft} +\setinterfacevariable{flushouter}{flushouter} +\setinterfacevariable{flushright}{flushright} +\setinterfacevariable{footer}{subsol} +\setinterfacevariable{footnote}{notasubsol} +\setinterfacevariable{force}{fortat} +\setinterfacevariable{foreground}{primplan} +\setinterfacevariable{formeel}{formeel} +\setinterfacevariable{formula}{formula} +\setinterfacevariable{formulae}{formule} +\setinterfacevariable{forward}{avans} +\setinterfacevariable{four}{patru} +\setinterfacevariable{frame}{incadrat} +\setinterfacevariable{framedtext}{textinconjurat} +\setinterfacevariable{friday}{vineri} +\setinterfacevariable{frontmatter}{prologul} +\setinterfacevariable{frontpart}{prolog} +\setinterfacevariable{global}{global} +\setinterfacevariable{graphic}{graficul} +\setinterfacevariable{graphics}{graficele} +\setinterfacevariable{gray}{gri} +\setinterfacevariable{greek}{grec} +\setinterfacevariable{grid}{grila} +\setinterfacevariable{halfline}{jumatatelinie} +\setinterfacevariable{handwritten}{scrismanual} +\setinterfacevariable{hang}{suspenda} +\setinterfacevariable{hanging}{suspendat} +\setinterfacevariable{head}{antet} +\setinterfacevariable{header}{antet} +\setinterfacevariable{height}{inaltime} +\setinterfacevariable{helptext}{textajutator} +\setinterfacevariable{hencefore}{precedent} +\setinterfacevariable{here}{aici} +\setinterfacevariable{hereafter}{urmator} +\setinterfacevariable{hidden}{ascuns} +\setinterfacevariable{hiding}{ascundere} +\setinterfacevariable{high}{inalt} +\setinterfacevariable{horizontal}{orizontal} +\setinterfacevariable{hyphenated}{despsilabe} +\setinterfacevariable{hz}{hz} +\setinterfacevariable{inbetween}{intre} +\setinterfacevariable{index}{index} +\setinterfacevariable{indices}{indexuri} +\setinterfacevariable{informeel}{informeel} +\setinterfacevariable{inherit}{inherit} +\setinterfacevariable{inleft}{instanga} +\setinterfacevariable{inmargin}{inmargine} +\setinterfacevariable{inner}{intern} +\setinterfacevariable{inneredge}{inneredge} +\setinterfacevariable{innermargin}{innermargin} +\setinterfacevariable{inright}{indreapta} +\setinterfacevariable{interaction}{interactiune} +\setinterfacevariable{interactionmenu}{meniuinteractiune} +\setinterfacevariable{intermezzi}{intermezzi} +\setinterfacevariable{intermezzo}{intermezzo} +\setinterfacevariable{intext}{intext} +\setinterfacevariable{intro}{intro} +\setinterfacevariable{italic}{italic} +\setinterfacevariable{italicbold}{italicaldin} +\setinterfacevariable{item}{element} +\setinterfacevariable{itemize}{enumerare} +\setinterfacevariable{its}{propriu} +\setinterfacevariable{january}{ianuarie} +\setinterfacevariable{joinedup}{unit} +\setinterfacevariable{july}{iulie} +\setinterfacevariable{june}{iunie} +\setinterfacevariable{keep}{mentine} +\setinterfacevariable{knockout}{knockout} +\setinterfacevariable{label}{eticheta} +\setinterfacevariable{landscape}{vedere} +\setinterfacevariable{last}{ultim} +\setinterfacevariable{lastcolumn}{lastcolumn} +\setinterfacevariable{lastpage}{ultimapagina} +\setinterfacevariable{lastpagenumber}{lastpagenumber} +\setinterfacevariable{lastsubpage}{ultimasubpagina} +\setinterfacevariable{layer}{layer} +\setinterfacevariable{left}{stanga} +\setinterfacevariable{leftedge}{bordurastanga} +\setinterfacevariable{lefthanging}{lefthanging} +\setinterfacevariable{leftmargin}{marginestanga} +\setinterfacevariable{leftpage}{paginastanga} +\setinterfacevariable{lefttoright}{lefttoright} +\setinterfacevariable{legend}{legenda} +\setinterfacevariable{lesshyphenation}{lesshyphenation} +\setinterfacevariable{line}{linie} +\setinterfacevariable{linenote}{linenote} +\setinterfacevariable{lines}{linii} +\setinterfacevariable{list}{lista} +\setinterfacevariable{local}{local} +\setinterfacevariable{localenvironment}{mediulocal} +\setinterfacevariable{logo}{logo} +\setinterfacevariable{logos}{logos} +\setinterfacevariable{lohi}{lohi} +\setinterfacevariable{loose}{larg} +\setinterfacevariable{low}{jos} +\setinterfacevariable{ls}{ls} +\setinterfacevariable{makeup}{marcaj} +\setinterfacevariable{mar}{mar} +\setinterfacevariable{march}{martie} +\setinterfacevariable{margin}{margine} +\setinterfacevariable{marginedge}{marginebordura} +\setinterfacevariable{margintitle}{titlumarginal} +\setinterfacevariable{marking}{marcaje} +\setinterfacevariable{mathalignment}{mathalignment} +\setinterfacevariable{mathcases}{mathcases} +\setinterfacevariable{mathmatrix}{mathmatrix} +\setinterfacevariable{max}{max} +\setinterfacevariable{maxdepth}{maxdepth} +\setinterfacevariable{maxheight}{maxheight} +\setinterfacevariable{maxwidth}{maxwidth} +\setinterfacevariable{may}{mai} +\setinterfacevariable{mediaeval}{medieval} +\setinterfacevariable{medium}{mediu} +\setinterfacevariable{middle}{centru} +\setinterfacevariable{min}{min} +\setinterfacevariable{mindepth}{mindepth} +\setinterfacevariable{minheight}{inaltimeminima} +\setinterfacevariable{minwidth}{latimeminima} +\setinterfacevariable{mirrored}{oglindit} +\setinterfacevariable{monday}{luni} +\setinterfacevariable{mono}{mono} +\setinterfacevariable{month}{luna} +\setinterfacevariable{morehyphenation}{morehyphenation} +\setinterfacevariable{name}{nume} +\setinterfacevariable{narrow}{ingust} +\setinterfacevariable{negative}{negativ} +\setinterfacevariable{never}{niciodata} +\setinterfacevariable{new}{nou} +\setinterfacevariable{next}{urmatorul} +\setinterfacevariable{nextevenpage}{paginaparaurmatoarea} +\setinterfacevariable{nextoddpage}{paginaimparaurmatoarea} +\setinterfacevariable{nextpage}{paginaurmatoare} +\setinterfacevariable{nextsubpage}{urmatoareasubpagina} +\setinterfacevariable{no}{nu} +\setinterfacevariable{nocheck}{nocheck} +\setinterfacevariable{nofit}{nofit} +\setinterfacevariable{nogrid}{nogrid} +\setinterfacevariable{nohz}{nohz} +\setinterfacevariable{nomarking}{faramarcare} +\setinterfacevariable{none}{niciunul} +\setinterfacevariable{nonumber}{nonumber} +\setinterfacevariable{normal}{normal} +\setinterfacevariable{nospacing}{nospacing} +\setinterfacevariable{not}{nu} +\setinterfacevariable{note}{note} +\setinterfacevariable{nothanging}{nothanging} +\setinterfacevariable{nothyphenated}{nedespsilabe} +\setinterfacevariable{november}{noiembrie} +\setinterfacevariable{nowhere}{niciunde} +\setinterfacevariable{nowhite}{faraalb} +\setinterfacevariable{number}{numar} +\setinterfacevariable{numbers}{numere} +\setinterfacevariable{october}{octombrie} +\setinterfacevariable{odd}{impar} +\setinterfacevariable{off}{dezactivat} +\setinterfacevariable{offset}{offset} +\setinterfacevariable{old}{old} +\setinterfacevariable{on}{on} +\setinterfacevariable{one}{unu} +\setinterfacevariable{opposite}{opus} +\setinterfacevariable{outer}{extern} +\setinterfacevariable{outeredge}{outeredge} +\setinterfacevariable{outermargin}{outermargin} +\setinterfacevariable{overbar}{barasus} +\setinterfacevariable{overbars}{supralinie} +\setinterfacevariable{overlay}{overlay} +\setinterfacevariable{overprint}{overprint} +\setinterfacevariable{overstrike}{liniepeste} +\setinterfacevariable{overstrikes}{liniipeste} +\setinterfacevariable{packed}{impachetat} +\setinterfacevariable{page}{pagina} +\setinterfacevariable{pagecomment}{comentariupagina} +\setinterfacevariable{pagenumber}{numarpagina} +\setinterfacevariable{paper}{foaie} +\setinterfacevariable{paragraph}{paragraf} +\setinterfacevariable{part}{parte} +\setinterfacevariable{positive}{positiv} +\setinterfacevariable{postponing}{postponing} +\setinterfacevariable{postscript}{postscript} +\setinterfacevariable{preference}{preferinta} +\setinterfacevariable{preview}{previzualizare} +\setinterfacevariable{previous}{precedent} +\setinterfacevariable{previousevenpage}{paginaparaprecedenta} +\setinterfacevariable{previousoddpage}{paginaimparaprecedenta} +\setinterfacevariable{previouspage}{paginaanterioara} +\setinterfacevariable{previoussubpage}{subpaginaanterioara} +\setinterfacevariable{printable}{tiparibil} +\setinterfacevariable{process}{process} +\setinterfacevariable{product}{produs} +\setinterfacevariable{program}{program} +\setinterfacevariable{project}{proiect} +\setinterfacevariable{protected}{protejat} +\setinterfacevariable{quadruple}{cvadrupul} +\setinterfacevariable{quotation}{citat} +\setinterfacevariable{quote}{minicitat} +\setinterfacevariable{ran}{rulat} +\setinterfacevariable{random}{aleator} +\setinterfacevariable{readonly}{readonly} +\setinterfacevariable{rectangular}{rectangular} +\setinterfacevariable{reference}{referinta} +\setinterfacevariable{referral}{referinta} +\setinterfacevariable{register}{registru} +\setinterfacevariable{regular}{regular} +\setinterfacevariable{rekening}{rekening} +\setinterfacevariable{relative}{relativ} +\setinterfacevariable{repeat}{repetat} +\setinterfacevariable{required}{obligatoriu} +\setinterfacevariable{reset}{reset} +\setinterfacevariable{reverse}{reverse} +\setinterfacevariable{right}{dreapta} +\setinterfacevariable{rightedge}{borduradreapta} +\setinterfacevariable{righthanging}{righthanging} +\setinterfacevariable{rightmargin}{marginedreapta} +\setinterfacevariable{rightpage}{paginadreapta} +\setinterfacevariable{righttoleft}{righttoleft} +\setinterfacevariable{roman}{roman} +\setinterfacevariable{romannumerals}{numereromane} +\setinterfacevariable{rotate}{rotit} +\setinterfacevariable{rotated}{rotat} +\setinterfacevariable{round}{rotund} +\setinterfacevariable{row}{rand} +\setinterfacevariable{rule}{rigla} +\setinterfacevariable{samepage}{aceeasipagina} +\setinterfacevariable{sans}{sans} +\setinterfacevariable{sansbold}{sansaldin} +\setinterfacevariable{sansserif}{sansserif} +\setinterfacevariable{saturday}{sambata} +\setinterfacevariable{screen}{ecran} +\setinterfacevariable{section}{sectiune} +\setinterfacevariable{sectionblockenvironment}{blocsectiuneambient} +\setinterfacevariable{sectionnumber}{numarsetiune} +\setinterfacevariable{see}{vezi} +\setinterfacevariable{september}{septembrie} +\setinterfacevariable{serif}{serif} +\setinterfacevariable{serried}{serried} +\setinterfacevariable{setups}{setari} +\setinterfacevariable{sheet}{sheet} +\setinterfacevariable{short}{short} +\setinterfacevariable{singlesided}{ofata} +\setinterfacevariable{slanted}{inclinat} +\setinterfacevariable{slantedbold}{inclinataldin} +\setinterfacevariable{small}{mic} +\setinterfacevariable{smallbodyfont}{smallbodyfont} +\setinterfacevariable{smallbold}{micaldin} +\setinterfacevariable{smallbolditalic}{micaldininclinat} +\setinterfacevariable{smallboldslanted}{micaldininclinat} +\setinterfacevariable{smallcaps}{majusculemici} +\setinterfacevariable{smaller}{smaller} +\setinterfacevariable{smallitalic}{micitalic} +\setinterfacevariable{smallitalicbold}{micitalicaldin} +\setinterfacevariable{smallnormal}{micnormal} +\setinterfacevariable{smallslanted}{micinclinat} +\setinterfacevariable{smallslantedbold}{micinclinataldin} +\setinterfacevariable{smalltype}{mictype} +\setinterfacevariable{somewhere}{undeva} +\setinterfacevariable{sorted}{sortat} +\setinterfacevariable{space}{spatiu} +\setinterfacevariable{spacing}{spatiere} +\setinterfacevariable{speech}{speech} +\setinterfacevariable{split}{split} +\setinterfacevariable{spot}{spot} +\setinterfacevariable{standard}{standard} +\setinterfacevariable{start}{start} +\setinterfacevariable{starter}{starter} +\setinterfacevariable{sticker}{sticker} +\setinterfacevariable{stop}{stop} +\setinterfacevariable{stopper}{stopper} +\setinterfacevariable{stretch}{dilatat} +\setinterfacevariable{strict}{strict} +\setinterfacevariable{strong}{strong} +\setinterfacevariable{strut}{strut} +\setinterfacevariable{sub}{sub} +\setinterfacevariable{subbackward}{subinapoi} +\setinterfacevariable{subformula}{subformula} +\setinterfacevariable{subforward}{subavans} +\setinterfacevariable{subject}{subiect} +\setinterfacevariable{subpage}{subpagina} +\setinterfacevariable{subsection}{subsectiune} +\setinterfacevariable{subsubject}{subsubiect} +\setinterfacevariable{subsubsection}{subsubsectiune} +\setinterfacevariable{subsubsubject}{subsubsubiect} +\setinterfacevariable{subsubsubsection}{subsubsubsectiune} +\setinterfacevariable{subsubsubsubject}{subsubsubsubiect} +\setinterfacevariable{subsubsubsubsection}{subsubsubsubsectiune} +\setinterfacevariable{subsubsubsubsubject}{subsubsubsubsubiect} +\setinterfacevariable{subsubsubsubsubsection}{subsubsubsubsubsectiune} +\setinterfacevariable{subsubsubsubsubsubject}{subsubsubsubsubsubiect} +\setinterfacevariable{subsubsubsubsubsubsection}{subsubsubsubsubsubsectiune} +\setinterfacevariable{subsubsubsubsubsubsubject}{subsubsubsubsubsubsubiect} +\setinterfacevariable{subsubsubsubsubsubsubsection}{subsubsubsubsubsubsubsectiune} +\setinterfacevariable{subsubsubsubsubsubsubsubject}{subsubsubsubsubsubsubsubiect} +\setinterfacevariable{subsubsubsubsubsubsubsubsection}{subsubsubsubsubsubsubsubsectiune} +\setinterfacevariable{subsubsubsubsubsubsubsubsubject}{subsubsubsubsubsubsubsubsubiect} +\setinterfacevariable{subsubsubsubsubsubsubsubsubsection}{subsubsubsubsubsubsubsubsubsectiune} +\setinterfacevariable{subsubsubsubsubsubsubsubsubsubject}{subsubsubsubsubsubsubsubsubsubiect} +\setinterfacevariable{sunday}{duminica} +\setinterfacevariable{support}{suport} +\setinterfacevariable{sym}{sym} +\setinterfacevariable{symbol}{simbol} +\setinterfacevariable{synchronize}{synchronize} +\setinterfacevariable{system}{sistem} +\setinterfacevariable{table}{tabelul} +\setinterfacevariable{tablehead}{antettabel} +\setinterfacevariable{tables}{tabelele} +\setinterfacevariable{tabletail}{subsoltabel} +\setinterfacevariable{tabulate}{tabulate} +\setinterfacevariable{tabulatehead}{tabulatehead} +\setinterfacevariable{tabulatetail}{tabulatetail} +\setinterfacevariable{tall}{inalt} +\setinterfacevariable{teletype}{teletype} +\setinterfacevariable{temporary}{temporar} +\setinterfacevariable{test}{test} +\setinterfacevariable{text}{text} +\setinterfacevariable{three}{trei} +\setinterfacevariable{thursday}{joi} +\setinterfacevariable{title}{titlu} +\setinterfacevariable{toggle}{toggle} +\setinterfacevariable{tolerant}{tolerant} +\setinterfacevariable{top}{sus} +\setinterfacevariable{tuesday}{marti} +\setinterfacevariable{two}{doi} +\setinterfacevariable{txt}{txt} +\setinterfacevariable{type}{type} +\setinterfacevariable{typing}{typing} +\setinterfacevariable{unavailable}{nedisponibil} +\setinterfacevariable{underbar}{sublinie} +\setinterfacevariable{underbars}{sublinii} +\setinterfacevariable{unit}{unitate} +\setinterfacevariable{units}{unitati} +\setinterfacevariable{unknown}{necunoscut} +\setinterfacevariable{unpacked}{despachetat} +\setinterfacevariable{up}{up} +\setinterfacevariable{url}{url} +\setinterfacevariable{used}{folosit} +\setinterfacevariable{value}{valoare} +\setinterfacevariable{vertical}{vertical} +\setinterfacevariable{very}{foarte} +\setinterfacevariable{verystrict}{foartestrict} +\setinterfacevariable{verytolerant}{foartetolerant} +\setinterfacevariable{weak}{weak} +\setinterfacevariable{wednesday}{miercuri} +\setinterfacevariable{week}{saptamana} +\setinterfacevariable{weekday}{zisaptamana} +\setinterfacevariable{white}{alb} +\setinterfacevariable{wide}{larg} +\setinterfacevariable{width}{latime} +\setinterfacevariable{xml}{xml} +\setinterfacevariable{year}{an} +\setinterfacevariable{yes}{da} +% definitions for interface constants for language ro +% +\setinterfaceconstant{action}{actiune} +\setinterfaceconstant{address}{adresa} +\setinterfaceconstant{after}{dupa} +\setinterfaceconstant{afterhead}{dupatitlu} +\setinterfaceconstant{afterkey}{dupatasta} +\setinterfaceconstant{aftersection}{aftersection} +\setinterfaceconstant{align}{aliniere} +\setinterfaceconstant{aligncharacter}{aliniazacaracter} +\setinterfaceconstant{alignmentcharacter}{alierecaracter} +\setinterfaceconstant{alignsymbol}{alignsymbol} +\setinterfaceconstant{aligntitle}{alinieretitlu} +\setinterfaceconstant{alternative}{alternativ} +\setinterfaceconstant{andtext}{andtext} +\setinterfaceconstant{apa}{apa} +\setinterfaceconstant{arrow}{sageata} +\setinterfaceconstant{artauthor}{artauthor} +\setinterfaceconstant{artauthoretaldisplay}{artauthoretaldisplay} +\setinterfaceconstant{artauthoretallimit}{artauthoretallimit} +\setinterfaceconstant{artauthoretaltext}{artauthoretaltext} +\setinterfaceconstant{at}{la} +\setinterfaceconstant{author}{autor} +\setinterfaceconstant{authoretaldisplay}{authoretaldisplay} +\setinterfaceconstant{authoretallimit}{authoretallimit} +\setinterfaceconstant{authoretaltext}{authoretaltext} +\setinterfaceconstant{auto}{auto} +\setinterfaceconstant{autocase}{autocase} +\setinterfaceconstant{autofile}{autofile} +\setinterfaceconstant{autofocus}{autofocus} +\setinterfaceconstant{autohang}{autohang} +\setinterfaceconstant{autostrut}{autostrut} +\setinterfaceconstant{autowidth}{autolatime} +\setinterfaceconstant{axis}{axa} +\setinterfaceconstant{background}{fundal} +\setinterfaceconstant{backgroundcolor}{culoarefundal} +\setinterfaceconstant{backgroundcorner}{coltfundal} +\setinterfaceconstant{backgrounddepth}{adancimefundal} +\setinterfaceconstant{backgroundoffset}{offsetfundal} +\setinterfaceconstant{backgroundradius}{razafundal} +\setinterfaceconstant{backgroundscreen}{ecranfundal} +\setinterfaceconstant{backreference}{backreference} +\setinterfaceconstant{backspace}{spatiuspate} +\setinterfaceconstant{balance}{balanta} +\setinterfaceconstant{before}{inainte} +\setinterfaceconstant{beforehead}{inaintetitlu} +\setinterfaceconstant{beforesection}{beforesection} +\setinterfaceconstant{bet}{bet} +\setinterfaceconstant{big}{mare} +\setinterfaceconstant{blank}{blanc} +\setinterfaceconstant{blockway}{blockway} +\setinterfaceconstant{bodyfont}{fonttext} +\setinterfaceconstant{bookmark}{semncarte} +\setinterfaceconstant{bottom}{jos} +\setinterfaceconstant{bottomafter}{bottomafter} +\setinterfaceconstant{bottombefore}{bottombefore} +\setinterfaceconstant{bottomdistance}{distantajos} +\setinterfaceconstant{bottomframe}{framejos} +\setinterfaceconstant{bottomoffset}{offsetjos} +\setinterfaceconstant{bottomspace}{spatiujos} +\setinterfaceconstant{bottomstate}{starejos} +\setinterfaceconstant{buffer}{buffer} +\setinterfaceconstant{cache}{cache} +\setinterfaceconstant{calculate}{calculeaza} +\setinterfaceconstant{category}{category} +\setinterfaceconstant{ccommand}{comandac} +\setinterfaceconstant{click}{click} +\setinterfaceconstant{clickin}{clickintru} +\setinterfaceconstant{clickout}{clickies} +\setinterfaceconstant{clipoffset}{clipoffset} +\setinterfaceconstant{closeaction}{actiuneinchidere} +\setinterfaceconstant{closecommand}{closecommand} +\setinterfaceconstant{closepage}{closepage} +\setinterfaceconstant{closepageaction}{actiuneinchiderepagina} +\setinterfaceconstant{closesymbol}{closesymbol} +\setinterfaceconstant{color}{culoare} +\setinterfaceconstant{column}{coloana} +\setinterfaceconstant{columndistance}{distantacoloane} +\setinterfaceconstant{columns}{coloane} +\setinterfaceconstant{command}{comanda} +\setinterfaceconstant{commandafter}{comandadupa} +\setinterfaceconstant{commandbefore}{comandainainte} +\setinterfaceconstant{commands}{comenzi} +\setinterfaceconstant{component}{component} +\setinterfaceconstant{compoundhyphen}{compoundhyphen} +\setinterfaceconstant{compress}{compress} +\setinterfaceconstant{connector}{connector} +\setinterfaceconstant{continue}{continua} +\setinterfaceconstant{contrastcolor}{culoarecontrast} +\setinterfaceconstant{controls}{controale} +\setinterfaceconstant{conversion}{conversie} +\setinterfaceconstant{convertfile}{convertestefisier} +\setinterfaceconstant{corner}{colt} +\setinterfaceconstant{coupling}{cuplare} +\setinterfaceconstant{couplingway}{modcuplare} +\setinterfaceconstant{criterium}{criteriu} +\setinterfaceconstant{current}{curent} +\setinterfaceconstant{cutspace}{cutspace} +\setinterfaceconstant{dash}{dash} +\setinterfaceconstant{dat}{dat} +\setinterfaceconstant{database}{database} +\setinterfaceconstant{date}{data} +\setinterfaceconstant{deepnumbercommand}{deepnumbercommand} +\setinterfaceconstant{deeptextcommand}{deeptextcommand} +\setinterfaceconstant{default}{implicit} +\setinterfaceconstant{delay}{intarziere} +\setinterfaceconstant{depth}{inaltime} +\setinterfaceconstant{depthcorrection}{corectieadancime} +\setinterfaceconstant{direction}{directie} +\setinterfaceconstant{directory}{director} +\setinterfaceconstant{display}{display} +\setinterfaceconstant{distance}{distanta} +\setinterfaceconstant{dot}{punct} +\setinterfaceconstant{doublesided}{douafete} +\setinterfaceconstant{dummy}{dummy} +\setinterfaceconstant{dx}{dx} +\setinterfaceconstant{dy}{dy} +\setinterfaceconstant{edge}{bordura} +\setinterfaceconstant{edgedistance}{distantabordura} +\setinterfaceconstant{editor}{editor} +\setinterfaceconstant{editoretaldisplay}{editoretaldisplay} +\setinterfaceconstant{editoretallimit}{editoretallimit} +\setinterfaceconstant{editoretaltext}{editoretaltext} +\setinterfaceconstant{empty}{gol} +\setinterfaceconstant{entries}{entries} +\setinterfaceconstant{equalheight}{equalheight} +\setinterfaceconstant{equalwidth}{equalwidth} +\setinterfaceconstant{escape}{escape} +\setinterfaceconstant{evenmargin}{marginepara} +\setinterfaceconstant{expansion}{expansiune} +\setinterfaceconstant{export}{export} +\setinterfaceconstant{extras}{extras} +\setinterfaceconstant{factor}{factor} +\setinterfaceconstant{fallback}{fallback} +\setinterfaceconstant{family}{familie} +\setinterfaceconstant{fieldbackgroundcolor}{culoarefundalcamp} +\setinterfaceconstant{fieldframecolor}{culoareframecamp} +\setinterfaceconstant{fieldlayer}{fieldlayer} +\setinterfaceconstant{fieldoffset}{offsetcamp} +\setinterfaceconstant{file}{fisier} +\setinterfaceconstant{filtercommand}{filtercommand} +\setinterfaceconstant{finalnamesep}{finalnamesep} +\setinterfaceconstant{firstnamesep}{firstnamesep} +\setinterfaceconstant{focus}{focus} +\setinterfaceconstant{focusin}{focusin} +\setinterfaceconstant{focusout}{focusout} +\setinterfaceconstant{footer}{subsol} +\setinterfaceconstant{footerdistance}{distantasubsol} +\setinterfaceconstant{footerstate}{staresubsol} +\setinterfaceconstant{force}{fortat} +\setinterfaceconstant{foregroundcolor}{foregroundcolor} +\setinterfaceconstant{foregroundstyle}{foregroundstyle} +\setinterfaceconstant{format}{format} +\setinterfaceconstant{frame}{frame} +\setinterfaceconstant{framecolor}{culoareframe} +\setinterfaceconstant{framecorner}{coltframe} +\setinterfaceconstant{framedepth}{adancimeframe} +\setinterfaceconstant{frameoffset}{offsetframe} +\setinterfaceconstant{frameradius}{razaframe} +\setinterfaceconstant{frames}{frames} +\setinterfaceconstant{from}{dela} +\setinterfaceconstant{get}{adu} +\setinterfaceconstant{global}{global} +\setinterfaceconstant{grid}{grid} +\setinterfaceconstant{hang}{suspenda} +\setinterfaceconstant{headalign}{headalign} +\setinterfaceconstant{headcolor}{culoaretitlu} +\setinterfaceconstant{headcommand}{headcommand} +\setinterfaceconstant{headconversion}{conversietitlu} +\setinterfaceconstant{header}{antet} +\setinterfaceconstant{headerdistance}{distantaantet} +\setinterfaceconstant{headerstate}{stareantet} +\setinterfaceconstant{headlabel}{etichetatitlu} +\setinterfaceconstant{headnumber}{numartitlu} +\setinterfaceconstant{headstyle}{stiltitlu} +\setinterfaceconstant{height}{inaltime} +\setinterfaceconstant{hfactor}{hfactor} +\setinterfaceconstant{hfil}{hfil} +\setinterfaceconstant{hidenumber}{hidenumber} +\setinterfaceconstant{hoffset}{hoffset} +\setinterfaceconstant{horoffset}{offsetoriz} +\setinterfaceconstant{hyphen}{hyphen} +\setinterfaceconstant{icommand}{comandai} +\setinterfaceconstant{in}{in} +\setinterfaceconstant{inbetween}{intre} +\setinterfaceconstant{increment}{increment} +\setinterfaceconstant{incrementnumber}{numarincrement} +\setinterfaceconstant{indenting}{aliniat} +\setinterfaceconstant{indentnext}{aliniaturmator} +\setinterfaceconstant{indicator}{indicator} +\setinterfaceconstant{inner}{intern} +\setinterfaceconstant{innermargin}{innermargin} +\setinterfaceconstant{inputfile}{inputfile} +\setinterfaceconstant{intent}{intent} +\setinterfaceconstant{interaction}{interactiune} +\setinterfaceconstant{interlinespace}{spatiereinterliniara} +\setinterfaceconstant{internalgrid}{internalgrid} +\setinterfaceconstant{itemalign}{itemalign} +\setinterfaceconstant{items}{elemente} +\setinterfaceconstant{juniorsep}{juniorsep} +\setinterfaceconstant{ken}{ken} +\setinterfaceconstant{keyexpansion}{keyexpansion} +\setinterfaceconstant{keys}{keys} +\setinterfaceconstant{keyword}{keyword} +\setinterfaceconstant{label}{eticheta} +\setinterfaceconstant{lastnamesep}{lastnamesep} +\setinterfaceconstant{lastpubsep}{lastpubsep} +\setinterfaceconstant{left}{stanga} +\setinterfaceconstant{leftcolor}{culoarestanga} +\setinterfaceconstant{leftcompoundhyphen}{leftcompoundhyphen} +\setinterfaceconstant{leftedge}{bordurastanga} +\setinterfaceconstant{leftedgedistance}{distantabordurastanga} +\setinterfaceconstant{leftframe}{framestanga} +\setinterfaceconstant{lefthyphen}{lefthyphen} +\setinterfaceconstant{leftmargin}{marginestanga} +\setinterfaceconstant{leftmargindistance}{distantamarginestanga} +\setinterfaceconstant{leftoffset}{offsetstanga} +\setinterfaceconstant{leftquotation}{citatstanga} +\setinterfaceconstant{leftquote}{minicitatstanga} +\setinterfaceconstant{leftsentence}{propozitiestanga} +\setinterfaceconstant{leftspeech}{leftspeech} +\setinterfaceconstant{leftstyle}{stilstanga} +\setinterfaceconstant{leftsubsentence}{subpropozitiestanga} +\setinterfaceconstant{lefttext}{textstanga} +\setinterfaceconstant{leftwidth}{latimestanga} +\setinterfaceconstant{level}{nivel} +\setinterfaceconstant{levels}{nivele} +\setinterfaceconstant{limittext}{limittext} +\setinterfaceconstant{line}{linie} +\setinterfaceconstant{linecorrection}{corectielinie} +\setinterfaceconstant{lines}{linii} +\setinterfaceconstant{list}{lista} +\setinterfaceconstant{listtext}{listtext} +\setinterfaceconstant{local}{local} +\setinterfaceconstant{location}{locatie} +\setinterfaceconstant{logo}{logo} +\setinterfaceconstant{logos}{logos} +\setinterfaceconstant{marcolor}{culoaremarcaj} +\setinterfaceconstant{margin}{margine} +\setinterfaceconstant{margindistance}{distantamargine} +\setinterfaceconstant{marginedge}{coltbordura} +\setinterfaceconstant{marginedgetext}{textcoltbordura} +\setinterfaceconstant{margintext}{textmargine} +\setinterfaceconstant{marking}{marcaje} +\setinterfaceconstant{marstyle}{stilmarcaj} +\setinterfaceconstant{mask}{mask} +\setinterfaceconstant{max}{max} +\setinterfaceconstant{maxdepth}{maxdepth} +\setinterfaceconstant{maxheight}{inaltimemaxima} +\setinterfaceconstant{maxwidth}{latimemaxima} +\setinterfaceconstant{maybeyear}{maybeyear} +\setinterfaceconstant{menu}{meniu} +\setinterfaceconstant{method}{metoda} +\setinterfaceconstant{middle}{mijloc} +\setinterfaceconstant{middlespeech}{middlespeech} +\setinterfaceconstant{middletext}{textmijloc} +\setinterfaceconstant{midsentence}{midsentence} +\setinterfaceconstant{min}{min} +\setinterfaceconstant{mindepth}{mindepth} +\setinterfaceconstant{minheight}{inaltimeminima} +\setinterfaceconstant{minwidth}{latimeminima} +\setinterfaceconstant{monthconversion}{monthconversion} +\setinterfaceconstant{n}{n} +\setinterfaceconstant{name}{nume} +\setinterfaceconstant{namesep}{namesep} +\setinterfaceconstant{nbottom}{njos} +\setinterfaceconstant{nc}{nc} +\setinterfaceconstant{next}{urmatorul} +\setinterfaceconstant{nl}{nl} +\setinterfaceconstant{nleft}{nstanga} +\setinterfaceconstant{nlines}{nlinii} +\setinterfaceconstant{norm}{norm} +\setinterfaceconstant{nr}{nr} +\setinterfaceconstant{nright}{ndreapta} +\setinterfaceconstant{ntop}{nsus} +\setinterfaceconstant{number}{numar} +\setinterfaceconstant{numbercolor}{culoarenumar} +\setinterfaceconstant{numbercommand}{comandanumar} +\setinterfaceconstant{numberconversion}{numberconversion} +\setinterfaceconstant{numberconversionset}{numberconversionset} +\setinterfaceconstant{numberdistance}{numberdistance} +\setinterfaceconstant{numbering}{numerotare} +\setinterfaceconstant{numberorder}{numberorder} +\setinterfaceconstant{numberprefix}{numberprefix} +\setinterfaceconstant{numbersegments}{numbersegments} +\setinterfaceconstant{numberseparator}{separatornumar} +\setinterfaceconstant{numberseparatorset}{numberseparatorset} +\setinterfaceconstant{numberset}{numberset} +\setinterfaceconstant{numberstarter}{numberstarter} +\setinterfaceconstant{numberstopper}{numberstopper} +\setinterfaceconstant{numberstyle}{stilnumar} +\setinterfaceconstant{numberwidth}{numberwidth} +\setinterfaceconstant{nx}{nx} +\setinterfaceconstant{ny}{ny} +\setinterfaceconstant{object}{obiect} +\setinterfaceconstant{obstruction}{obstructie} +\setinterfaceconstant{oddmargin}{margineimpara} +\setinterfaceconstant{offset}{offset} +\setinterfaceconstant{openaction}{actiunedeschidere} +\setinterfaceconstant{openpage}{openpage} +\setinterfaceconstant{openpageaction}{actiunedeschiderepagina} +\setinterfaceconstant{option}{optiune} +\setinterfaceconstant{order}{order} +\setinterfaceconstant{orientation}{orientation} +\setinterfaceconstant{otherstext}{otherstext} +\setinterfaceconstant{outermargin}{outermargin} +\setinterfaceconstant{overprint}{overprint} +\setinterfaceconstant{ownnumber}{numarpropriu} +\setinterfaceconstant{page}{pagina} +\setinterfaceconstant{pageboundaries}{marginipagina} +\setinterfaceconstant{pagecolor}{culoarepagina} +\setinterfaceconstant{pagecommand}{comandapagina} +\setinterfaceconstant{pageconversion}{pageconversion} +\setinterfaceconstant{pageconversionset}{pageconversionset} +\setinterfaceconstant{pagenumber}{numarpagina} +\setinterfaceconstant{pageprefix}{pageprefix} +\setinterfaceconstant{pageprefixconnector}{pageprefixconnector} +\setinterfaceconstant{pageprefixconversion}{pageprefixconversion} +\setinterfaceconstant{pageprefixconversionset}{pageprefixconversionset} +\setinterfaceconstant{pageprefixsegments}{pageprefixsegments} +\setinterfaceconstant{pageprefixseparatorset}{pageprefixseparatorset} +\setinterfaceconstant{pageprefixset}{pageprefixset} +\setinterfaceconstant{pageprefixstarter}{pageprefixstarter} +\setinterfaceconstant{pageprefixstopper}{pageprefixstopper} +\setinterfaceconstant{pagesegments}{pagesegments} +\setinterfaceconstant{pageseparatorset}{pageseparatorset} +\setinterfaceconstant{pageset}{pageset} +\setinterfaceconstant{pagestarter}{pagestarter} +\setinterfaceconstant{pagestate}{pagestate} +\setinterfaceconstant{pagestopper}{pagestopper} +\setinterfaceconstant{pagestyle}{stilpagina} +\setinterfaceconstant{palet}{paleta} +\setinterfaceconstant{paper}{hartie} +\setinterfaceconstant{paragraph}{paragraf} +\setinterfaceconstant{place}{pune} +\setinterfaceconstant{placehead}{punetitlu} +\setinterfaceconstant{placestopper}{punestopper} +\setinterfaceconstant{position}{pozitie} +\setinterfaceconstant{prefix}{prefix} +\setinterfaceconstant{prefixconnector}{prefixconnector} +\setinterfaceconstant{prefixconversion}{prefixconversion} +\setinterfaceconstant{prefixconversionset}{prefixconversionset} +\setinterfaceconstant{prefixsegments}{prefixsegments} +\setinterfaceconstant{prefixseparatorset}{prefixseparatorset} +\setinterfaceconstant{prefixset}{prefixset} +\setinterfaceconstant{prefixstarter}{prefixstarter} +\setinterfaceconstant{prefixstopper}{prefixstopper} +\setinterfaceconstant{preset}{preset} +\setinterfaceconstant{preview}{previzualizare} +\setinterfaceconstant{previous}{precendent} +\setinterfaceconstant{previousnumber}{numarprecedent} +\setinterfaceconstant{process}{process} +\setinterfaceconstant{profile}{profile} +\setinterfaceconstant{pubsep}{pubsep} +\setinterfaceconstant{radius}{raza} +\setinterfaceconstant{random}{aleator} +\setinterfaceconstant{range}{range} +\setinterfaceconstant{reduction}{reducere} +\setinterfaceconstant{ref}{ref} +\setinterfaceconstant{refcommand}{refcommand} +\setinterfaceconstant{reference}{referinta} +\setinterfaceconstant{referenceprefix}{referenceprefix} +\setinterfaceconstant{referencing}{referinta} +\setinterfaceconstant{regionin}{regiuneintrare} +\setinterfaceconstant{regionout}{regiuneiesire} +\setinterfaceconstant{repeat}{repeta} +\setinterfaceconstant{reset}{reset} +\setinterfaceconstant{resetnumber}{resetnumber} +\setinterfaceconstant{resolution}{rezolutie} +\setinterfaceconstant{right}{dreapta} +\setinterfaceconstant{rightcolor}{culoaredreapta} +\setinterfaceconstant{rightcompoundhyphen}{rightcompoundhyphen} +\setinterfaceconstant{rightedge}{borduradreapta} +\setinterfaceconstant{rightedgedistance}{distantacoltdreapta} +\setinterfaceconstant{rightframe}{framedreapta} +\setinterfaceconstant{righthyphen}{righthyphen} +\setinterfaceconstant{rightmargin}{marginedreapta} +\setinterfaceconstant{rightmargindistance}{distantamarginedreapta} +\setinterfaceconstant{rightoffset}{offsetdreapta} +\setinterfaceconstant{rightquotation}{citatdreapta} +\setinterfaceconstant{rightquote}{minicitatdreapta} +\setinterfaceconstant{rightsentence}{propozitiedreapta} +\setinterfaceconstant{rightspeech}{rightspeech} +\setinterfaceconstant{rightstyle}{stildreapta} +\setinterfaceconstant{rightsubsentence}{subpropozitiedreapta} +\setinterfaceconstant{righttext}{textdreapta} +\setinterfaceconstant{rightwidth}{marginedreapta} +\setinterfaceconstant{rotation}{rotatie} +\setinterfaceconstant{rule}{rigla} +\setinterfaceconstant{rulecolor}{culoarerigla} +\setinterfaceconstant{rulethickness}{grosimerigla} +\setinterfaceconstant{samepage}{aceeasipagina} +\setinterfaceconstant{sample}{exemplu} +\setinterfaceconstant{samplesize}{samplesize} +\setinterfaceconstant{saveinlist}{saveinlist} +\setinterfaceconstant{scale}{scala} +\setinterfaceconstant{scope}{scop} +\setinterfaceconstant{screen}{ecran} +\setinterfaceconstant{section}{sectiune} +\setinterfaceconstant{sectionconversion}{sectionconversion} +\setinterfaceconstant{sectionconversionset}{sectionconversionset} +\setinterfaceconstant{sectionnumber}{numarsectiune} +\setinterfaceconstant{sectionresetset}{sectionresetset} +\setinterfaceconstant{sectionsegments}{sectionsegments} +\setinterfaceconstant{sectionseparatorset}{sectionseparatorset} +\setinterfaceconstant{sectionset}{sectionset} +\setinterfaceconstant{sectionstarter}{sectionstarter} +\setinterfaceconstant{sectionstopper}{sectionstopper} +\setinterfaceconstant{separator}{separator} +\setinterfaceconstant{set}{set} +\setinterfaceconstant{setups}{setups} +\setinterfaceconstant{side}{parte} +\setinterfaceconstant{sidealign}{sidealign} +\setinterfaceconstant{sidemethod}{sidemethod} +\setinterfaceconstant{sidespaceafter}{spatiulateraldupa} +\setinterfaceconstant{sidespacebefore}{spatiulateralinainte} +\setinterfaceconstant{sign}{semn} +\setinterfaceconstant{size}{dimensiune} +\setinterfaceconstant{small}{mic} +\setinterfaceconstant{sort}{sort} +\setinterfaceconstant{sorttype}{sorttype} +\setinterfaceconstant{source}{sursa} +\setinterfaceconstant{space}{spatiu} +\setinterfaceconstant{spaceafter}{spatiudupa} +\setinterfaceconstant{spacebefore}{spatiuinainte} +\setinterfaceconstant{spaceinbetween}{spaceinbetween} +\setinterfaceconstant{spacing}{spatiere} +\setinterfaceconstant{split}{split} +\setinterfaceconstant{splitcolor}{splitcolor} +\setinterfaceconstant{splitmethod}{splitmethod} +\setinterfaceconstant{splitoffset}{splitoffset} +\setinterfaceconstant{spot}{spot} +\setinterfaceconstant{stack}{stack} +\setinterfaceconstant{start}{start} +\setinterfaceconstant{starter}{starter} +\setinterfaceconstant{state}{stare} +\setinterfaceconstant{step}{pas} +\setinterfaceconstant{stop}{stop} +\setinterfaceconstant{stopper}{stopper} +\setinterfaceconstant{stretch}{dilatat} +\setinterfaceconstant{strip}{strip} +\setinterfaceconstant{strut}{strut} +\setinterfaceconstant{style}{stil} +\setinterfaceconstant{sub}{sub} +\setinterfaceconstant{subtitle}{subtitlu} +\setinterfaceconstant{suffix}{suffix} +\setinterfaceconstant{suffixseparator}{suffixseparator} +\setinterfaceconstant{surnamesep}{surnamesep} +\setinterfaceconstant{sx}{sx} +\setinterfaceconstant{sy}{sy} +\setinterfaceconstant{symalign}{symaliniere} +\setinterfaceconstant{symbol}{simbol} +\setinterfaceconstant{symbolset}{setsimbol} +\setinterfaceconstant{symcolor}{culoaresimbol} +\setinterfaceconstant{symstyle}{stilsimbol} +\setinterfaceconstant{synonym}{sinonim} +\setinterfaceconstant{synonymcolor}{culoaresinonim} +\setinterfaceconstant{synonymcommand}{synonymcommand} +\setinterfaceconstant{synonymstyle}{stilsinonim} +\setinterfaceconstant{tab}{tab} +\setinterfaceconstant{text}{text} +\setinterfaceconstant{textcolor}{culoaretext} +\setinterfaceconstant{textcommand}{comandatext} +\setinterfaceconstant{textdistance}{textdistance} +\setinterfaceconstant{textlayer}{textlayer} +\setinterfaceconstant{textmargin}{textmargin} +\setinterfaceconstant{textmethod}{textmethod} +\setinterfaceconstant{textseparator}{separatortext} +\setinterfaceconstant{textsize}{dimensiunetext} +\setinterfaceconstant{textstate}{staretext} +\setinterfaceconstant{textstyle}{stiltext} +\setinterfaceconstant{textwidth}{latimetext} +\setinterfaceconstant{threshold}{threshold} +\setinterfaceconstant{title}{titlu} +\setinterfaceconstant{titlecolor}{culoaretitlu} +\setinterfaceconstant{titlecommand}{titlecommand} +\setinterfaceconstant{titledistance}{distantatitlu} +\setinterfaceconstant{titleleft}{titleleft} +\setinterfaceconstant{titleright}{titleright} +\setinterfaceconstant{titlestyle}{stiltitlu} +\setinterfaceconstant{to}{catre} +\setinterfaceconstant{tolerance}{toleranta} +\setinterfaceconstant{top}{sus} +\setinterfaceconstant{topdistance}{distantasus} +\setinterfaceconstant{topframe}{framesus} +\setinterfaceconstant{topoffset}{offsetsus} +\setinterfaceconstant{topspace}{spatiusus} +\setinterfaceconstant{topstate}{staresus} +\setinterfaceconstant{totalnumber}{totalnumber} +\setinterfaceconstant{type}{type} +\setinterfaceconstant{unit}{unitate} +\setinterfaceconstant{unknownreference}{referintanecunoscuta} +\setinterfaceconstant{urlalternative}{urlalternativ} +\setinterfaceconstant{urlspace}{spatiuurl} +\setinterfaceconstant{validate}{verifica} +\setinterfaceconstant{values}{values} +\setinterfaceconstant{vcommand}{comandav} +\setinterfaceconstant{veroffset}{veroffset} +\setinterfaceconstant{vfil}{vfil} +\setinterfaceconstant{voffset}{voffset} +\setinterfaceconstant{vonsep}{vonsep} +\setinterfaceconstant{way}{mod} +\setinterfaceconstant{wfactor}{factorw} +\setinterfaceconstant{white}{alb} +\setinterfaceconstant{width}{latime} +\setinterfaceconstant{xfactor}{xfactor} +\setinterfaceconstant{xmax}{xmax} +\setinterfaceconstant{xoffset}{xoffset} +\setinterfaceconstant{xscale}{xscala} +\setinterfaceconstant{xstep}{xstep} +\setinterfaceconstant{yfactor}{yfactor} +\setinterfaceconstant{ymax}{ymax} +\setinterfaceconstant{yoffset}{yoffset} +\setinterfaceconstant{yscale}{yscala} +\setinterfaceconstant{ystep}{ystep} +% definitions for interface elements for language ro +% +\setinterfaceelement{answerlines}{answerlines} +\setinterfaceelement{answerspace}{answerspace} +\setinterfaceelement{begin}{inceput} +\setinterfaceelement{complete}{complet} +\setinterfaceelement{coupled}{cuplat} +\setinterfaceelement{currentlocal}{localcurent} +\setinterfaceelement{emptyone}{gol} +\setinterfaceelement{emptytwo}{gol} +\setinterfaceelement{end}{sfarsit} +\setinterfaceelement{endsetup}{} +\setinterfaceelement{get}{get} +\setinterfaceelement{increment}{increment} +\setinterfaceelement{list}{lista} +\setinterfaceelement{listof}{listade} +\setinterfaceelement{load}{incarca} +\setinterfaceelement{local}{local} +\setinterfaceelement{makeup}{makeup} +\setinterfaceelement{next}{urmatorul} +\setinterfaceelement{place}{pune} +\setinterfaceelement{previous}{precedent} +\setinterfaceelement{previouslocal}{precedentlocal} +\setinterfaceelement{reserve}{rezervat} +\setinterfaceelement{see}{vezi} +\setinterfaceelement{setup}{setare} +\setinterfaceelement{start}{start} +\setinterfaceelement{stop}{stop} +\setinterfaceelement{text}{text} +\setinterfaceelement{type}{type} +% definitions for interface commands for language ro +% +\setinterfacecommand{CAPPED}{KAP} +\setinterfacecommand{Character}{Litera} +\setinterfacecommand{Characters}{Litere} +\setinterfacecommand{MONTH}{LUNA} +\setinterfacecommand{Numbers}{Numere} +\setinterfacecommand{Romannumerals}{Numereromane} +\setinterfacecommand{SmallCapped}{Kap} +\setinterfacecommand{SmallCaps}{Kaps} +\setinterfacecommand{WEEKDAY}{ZIDINSAPTAMANA} +\setinterfacecommand{WORD}{CUVANT} +\setinterfacecommand{WORDS}{CUVINTE} +\setinterfacecommand{Word}{Cuvant} +\setinterfacecommand{Words}{Cuvinte} +\setinterfacecommand{about}{despre} +\setinterfacecommand{adaptlayout}{adapteazaaspect} +\setinterfacecommand{arg}{arg} +\setinterfacecommand{at}{la} +\setinterfacecommand{atleftmargin}{atleftmargin} +\setinterfacecommand{atpage}{lapagina} +\setinterfacecommand{atrightmargin}{atrightmargin} +\setinterfacecommand{background}{fundal} +\setinterfacecommand{backspace}{spatiuspate} +\setinterfacecommand{blackrule}{linieneagra} +\setinterfacecommand{blackrules}{liniinegre} +\setinterfacecommand{blank}{blanc} +\setinterfacecommand{bookmark}{semncarte} +\setinterfacecommand{bottomdistance}{distantajos} +\setinterfacecommand{bottomheight}{inaltimejos} +\setinterfacecommand{bottomspace}{spatiujos} +\setinterfacecommand{but}{but} +\setinterfacecommand{button}{buton} +\setinterfacecommand{bypassblocks}{saripesteblocuri} +\setinterfacecommand{character}{litera} +\setinterfacecommand{characters}{litere} +\setinterfacecommand{chem}{chem} +\setinterfacecommand{clip}{clip} +\setinterfacecommand{clonefield}{cloneazacamp} +\setinterfacecommand{color}{culoare} +\setinterfacecommand{colorbar}{baraculoare} +\setinterfacecommand{colorvalue}{valoareculoare} +\setinterfacecommand{column}{coloana} +\setinterfacecommand{comparecolorgroup}{comparagrupculoare} +\setinterfacecommand{comparepalet}{comparapaleta} +\setinterfacecommand{completepagenumber}{completeazanumarpagina} +\setinterfacecommand{completeregister}{completeregister} +\setinterfacecommand{component}{componenta} +\setinterfacecommand{convertnumber}{convertestenumar} +\setinterfacecommand{copyfield}{copiazacamp} +\setinterfacecommand{correctwhitespace}{corecteazaspatiualb} +\setinterfacecommand{coupledocument}{cupleazadocument} +\setinterfacecommand{couplemarking}{cupleazamarcaje} +\setinterfacecommand{couplepage}{paginadubla} +\setinterfacecommand{couplepaper}{hartiedubla} +\setinterfacecommand{coupleregister}{cupleazaregistru} +\setinterfacecommand{crlf}{crlf} +\setinterfacecommand{currentdate}{datacurenta} +\setinterfacecommand{currentheadnumber}{numartitlucurent} +\setinterfacecommand{cutspace}{cutspace} +\setinterfacecommand{date}{data} +\setinterfacecommand{decouplemarking}{decupleazamarcaje} +\setinterfacecommand{decrementnumber}{decrementnumber} +\setinterfacecommand{define}{defineste} +\setinterfacecommand{defineaccent}{definesteaccent} +\setinterfacecommand{defineblank}{definesteblanc} +\setinterfacecommand{defineblock}{definestebloc} +\setinterfacecommand{definebodyfont}{definestefonttext} +\setinterfacecommand{definebodyfontenvironment}{definestemediulfonttext} +\setinterfacecommand{definebuffer}{definestebuffer} +\setinterfacecommand{definecharacter}{definestecaracter} +\setinterfacecommand{definecolor}{definesteculoare} +\setinterfacecommand{definecolorgroup}{definestegrupculori} +\setinterfacecommand{definecolumnbreak}{definecolumnbreak} +\setinterfacecommand{definecolumnset}{definecolumnset} +\setinterfacecommand{definecombination}{definecombination} +\setinterfacecommand{definecombinedlist}{definestelistacombinata} +\setinterfacecommand{definecommand}{definestecomanda} +\setinterfacecommand{defineconversion}{definesteconversie} +\setinterfacecommand{definedescription}{definestedescriere} +\setinterfacecommand{defineenumeration}{definesteenumerare} +\setinterfacecommand{definefield}{definestecamp} +\setinterfacecommand{definefieldstack}{definestestivacampuri} +\setinterfacecommand{definefiguresymbol}{definestesimbolfigura} +\setinterfacecommand{definefloat}{definestefloat} +\setinterfacecommand{definefont}{definestefont} +\setinterfacecommand{definefontstyle}{definestestilfont} +\setinterfacecommand{definefontsynonym}{definestesinonimfont} +\setinterfacecommand{defineframed}{definesteinconjurare} +\setinterfacecommand{defineframedtext}{definestetextinconjurat} +\setinterfacecommand{definehbox}{definestehbox} +\setinterfacecommand{definehead}{definesteantet} +\setinterfacecommand{defineindenting}{definestealiat} +\setinterfacecommand{defineinmargin}{defineinmargin} +\setinterfacecommand{defineinteractionmenu}{definestemeniuinteractiune} +\setinterfacecommand{defineitemgroup}{defineitemgroup} +\setinterfacecommand{definelabel}{definesteeticheta} +\setinterfacecommand{definelayer}{definelayer} +\setinterfacecommand{definelayout}{definelayout} +\setinterfacecommand{definelist}{definestelista} +\setinterfacecommand{definelogo}{definestelogo} +\setinterfacecommand{definemainfield}{definestecampprincipal} +\setinterfacecommand{definemakeup}{definestemakeup} +\setinterfacecommand{definemarking}{definestemarcaje} +\setinterfacecommand{definemathalignment}{definemathalignment} +\setinterfacecommand{defineoutput}{definesteoutput} +\setinterfacecommand{defineoverlay}{definesteoverlay} +\setinterfacecommand{definepagebreak}{definepagebreak} +\setinterfacecommand{definepalet}{definestepaleta} +\setinterfacecommand{definepapersize}{definestedimensiunehartie} +\setinterfacecommand{defineparagraphs}{definesteparagraf} +\setinterfacecommand{defineplacement}{defineplacement} +\setinterfacecommand{defineprofile}{definesteprofil} +\setinterfacecommand{defineprogram}{definesteprogram} +\setinterfacecommand{definerawfont}{definestefontraw} +\setinterfacecommand{definereference}{definestereferinte} +\setinterfacecommand{definereferenceformat}{definesteformatreferinte} +\setinterfacecommand{definereferencelist}{definestelistareferinte} +\setinterfacecommand{defineregister}{definesteregistru} +\setinterfacecommand{definerule}{definesterigla} +\setinterfacecommand{definesection}{definestesectiune} +\setinterfacecommand{definesectionblock}{definesteblocsectiune} +\setinterfacecommand{definesorting}{definestesortare} +\setinterfacecommand{definestartstop}{definestestartstop} +\setinterfacecommand{definestyle}{definestestil} +\setinterfacecommand{definesubfield}{definestesubcamp} +\setinterfacecommand{definesymbol}{definestesimbol} +\setinterfacecommand{definesynonyms}{definestesinonim} +\setinterfacecommand{definetabletemplate}{definestesablontabel} +\setinterfacecommand{definetabulate}{definestetabulatori} +\setinterfacecommand{definetext}{definestetext} +\setinterfacecommand{definetextposition}{definestepozitietext} +\setinterfacecommand{definetextvariable}{definestevariabilatext} +\setinterfacecommand{definetype}{definetype} +\setinterfacecommand{definetyping}{definestetyping} +\setinterfacecommand{defineversion}{definesteversiune} +\setinterfacecommand{determineheadnumber}{determinanumartitlu} +\setinterfacecommand{determinelistcharacteristics}{determinacaracteristicilelistei} +\setinterfacecommand{determineregistercharacteristics}{determinacaracteristiciregistru} +\setinterfacecommand{dimension}{dimensiune} +\setinterfacecommand{disableinteractionmenu}{dezactiveazameniuinteractiune} +\setinterfacecommand{domicile}{domiciliu} +\setinterfacecommand{donttest}{nutesta} +\setinterfacecommand{edgedistance}{distantacolt} +\setinterfacecommand{edgewidth}{latimecolturi} +\setinterfacecommand{emptylines}{emptylines} +\setinterfacecommand{environment}{mediu} +\setinterfacecommand{externalfigure}{figuraexterna} +\setinterfacecommand{fact}{fact} +\setinterfacecommand{field}{camp} +\setinterfacecommand{fieldstack}{stivacampuri} +\setinterfacecommand{fillinfield}{campumplere} +\setinterfacecommand{fillinline}{linieumplere} +\setinterfacecommand{fillinrules}{rigleumplere} +\setinterfacecommand{fillintext}{textumplere} +\setinterfacecommand{fitfield}{potrivestecamp} +\setinterfacecommand{fixedspace}{spatiufixat} +\setinterfacecommand{fixedspaces}{spatiifixate} +\setinterfacecommand{followprofile}{urmeazaprofil} +\setinterfacecommand{followprofileversion}{urmeazaversiuneprofil} +\setinterfacecommand{followversion}{urmeazaversiune} +\setinterfacecommand{footerdistance}{distantasubsol} +\setinterfacecommand{footerheight}{inaltimesubsol} +\setinterfacecommand{footnote}{notasubsol} +\setinterfacecommand{footnotetext}{footnotetext} +\setinterfacecommand{forceblocks}{forteazablocuri} +\setinterfacecommand{formulanumber}{numarformula} +\setinterfacecommand{fraction}{fractie} +\setinterfacecommand{framed}{framed} +\setinterfacecommand{from}{din} +\setinterfacecommand{getbuffer}{adubuffer} +\setinterfacecommand{getmarking}{adumarcaje} +\setinterfacecommand{getnumber}{getnumber} +\setinterfacecommand{godown}{injos} +\setinterfacecommand{goto}{dute} +\setinterfacecommand{gotobox}{dutebox} +\setinterfacecommand{gotopage}{dutepagina} +\setinterfacecommand{graycolor}{culoaregri} +\setinterfacecommand{greyvalue}{valoaregri} +\setinterfacecommand{grid}{grid} +\setinterfacecommand{hairline}{firdepar} +\setinterfacecommand{head}{titlu} +\setinterfacecommand{headerdistance}{distantaantet} +\setinterfacecommand{headerheight}{inaltimeantet} +\setinterfacecommand{headlevel}{niveltitlu} +\setinterfacecommand{headnumber}{numartitlu} +\setinterfacecommand{headsym}{headsym} +\setinterfacecommand{headtext}{texttitlu} +\setinterfacecommand{hideblocks}{ascundeblocuri} +\setinterfacecommand{high}{inalt} +\setinterfacecommand{hl}{hl} +\setinterfacecommand{immediatebetweenlist}{immediatebetweenlist} +\setinterfacecommand{immediatetolist}{immediatetolist} +\setinterfacecommand{in}{in} +\setinterfacecommand{incrementnumber}{numarincrement} +\setinterfacecommand{indenting}{aliniat} +\setinterfacecommand{inframed}{inframed} +\setinterfacecommand{infull}{pelung} +\setinterfacecommand{ininner}{ininner} +\setinterfacecommand{inleft}{instanga} +\setinterfacecommand{inleftedge}{inparteastanga} +\setinterfacecommand{inleftmargin}{inmargineastanga} +\setinterfacecommand{inline}{inlinie} +\setinterfacecommand{inmargin}{marginal} +\setinterfacecommand{inmframed}{inmaframed} +\setinterfacecommand{inneredgedistance}{inneredgedistance} +\setinterfacecommand{inneredgewidth}{inneredgewidth} +\setinterfacecommand{innermargindistance}{innermargindistance} +\setinterfacecommand{innermarginwidth}{innermarginwidth} +\setinterfacecommand{inothermargin}{inaltamargine} +\setinterfacecommand{inouter}{inouter} +\setinterfacecommand{inright}{indreapta} +\setinterfacecommand{inrightedge}{inparteadreapta} +\setinterfacecommand{inrightmargin}{inmargineadreapta} +\setinterfacecommand{installlanguage}{instalarelimba} +\setinterfacecommand{interactionbar}{barainteractiune} +\setinterfacecommand{interactionbuttons}{butoaneinteractiune} +\setinterfacecommand{interactionmenu}{meniuinteractiune} +\setinterfacecommand{item}{element} +\setinterfacecommand{items}{element} +\setinterfacecommand{its}{el} +\setinterfacecommand{keepblocks}{pastreazablocuri} +\setinterfacecommand{label}{eticheta} +\setinterfacecommand{labels}{etichete} +\setinterfacecommand{labeltext}{texteticheta} +\setinterfacecommand{language}{limba} +\setinterfacecommand{leftaligned}{aliniatstanga} +\setinterfacecommand{leftedgedistance}{distantacoltstanga} +\setinterfacecommand{leftedgewidth}{latimecoltstanga} +\setinterfacecommand{leftmargindistance}{distantamarginestanga} +\setinterfacecommand{leftmarginwidth}{latimemarginestanga} +\setinterfacecommand{leg}{leg} +\setinterfacecommand{linewidth}{grosimelinie} +\setinterfacecommand{listheight}{inaltimelista} +\setinterfacecommand{listlength}{lungimelista} +\setinterfacecommand{listsymbol}{listsymbol} +\setinterfacecommand{listwidth}{latimelista} +\setinterfacecommand{logfields}{logcampuri} +\setinterfacecommand{lohi}{jossus} +\setinterfacecommand{low}{jos} +\setinterfacecommand{macroname}{nume} +\setinterfacecommand{mainlanguage}{limbaprincipala} +\setinterfacecommand{makeupheight}{inaltimemakeup} +\setinterfacecommand{makeupwidth}{latimemakeup} +\setinterfacecommand{mar}{mar} +\setinterfacecommand{margindistance}{distantamargine} +\setinterfacecommand{marginrule}{liniemargine} +\setinterfacecommand{margintext}{textmarginal} +\setinterfacecommand{margintitle}{titlumarginal} +\setinterfacecommand{marginwidth}{latimemargine} +\setinterfacecommand{marginword}{cuvantmarginal} +\setinterfacecommand{marking}{marcaje} +\setinterfacecommand{markversion}{marcheazaversiune} +\setinterfacecommand{mathematics}{matematica} +\setinterfacecommand{menubutton}{butonmeniu} +\setinterfacecommand{mframed}{maframed} +\setinterfacecommand{midaligned}{aliniatcentru} +\setinterfacecommand{mirror}{reflexie} +\setinterfacecommand{month}{luna} +\setinterfacecommand{moveformula}{moveformula} +\setinterfacecommand{moveongrid}{mutapegrid} +\setinterfacecommand{movesidefloat}{movesidefloat} +\setinterfacecommand{navigating}{navigating} +\setinterfacecommand{nodimension}{faradimensiune} +\setinterfacecommand{noheaderandfooterlines}{faraliniiantetsisubsol} +\setinterfacecommand{noindenting}{faraaliniat} +\setinterfacecommand{nolist}{faralista} +\setinterfacecommand{nomarking}{faramarcaje} +\setinterfacecommand{nomoreblocks}{gatablocuri} +\setinterfacecommand{nomorefiles}{farafisiere} +\setinterfacecommand{nop}{nop} +\setinterfacecommand{nospace}{faraspatiu} +\setinterfacecommand{note}{nota} +\setinterfacecommand{notopandbottomlines}{faraliniisussijos} +\setinterfacecommand{notsmallcapped}{nokap} +\setinterfacecommand{nowhitespace}{faraspatiualb} +\setinterfacecommand{numberofsubpages}{numberofsubpages} +\setinterfacecommand{numbers}{numere} +\setinterfacecommand{outeredgedistance}{outeredgedistance} +\setinterfacecommand{outeredgewidth}{outeredgewidth} +\setinterfacecommand{outermargindistance}{outermargindistance} +\setinterfacecommand{outermarginwidth}{outermarginwidth} +\setinterfacecommand{packed}{impachetat} +\setinterfacecommand{page}{pagina} +\setinterfacecommand{pagedepth}{pagedepth} +\setinterfacecommand{pagenumber}{numarpagina} +\setinterfacecommand{pageoffset}{pageoffset} +\setinterfacecommand{pagereference}{referintapagina} +\setinterfacecommand{pagetype}{tippagina} +\setinterfacecommand{paperheight}{inaltimehartie} +\setinterfacecommand{paperwidth}{latimehartie} +\setinterfacecommand{periods}{puncte} +\setinterfacecommand{plaatsruwelijst}{placerawlist} +\setinterfacecommand{placebookmarks}{plaseazasemnecarte} +\setinterfacecommand{placecombinedlist}{punelistacombinata} +\setinterfacecommand{placefloat}{placefloat} +\setinterfacecommand{placefootnotes}{punenotesubsol} +\setinterfacecommand{placeformula}{puneformula} +\setinterfacecommand{placeheadnumber}{placeheadnumber} +\setinterfacecommand{placeheadtext}{placeheadtext} +\setinterfacecommand{placelegend}{punelegenda} +\setinterfacecommand{placelist}{punelista} +\setinterfacecommand{placelocalfootnotes}{punenotesubsollocale} +\setinterfacecommand{placelogos}{punelogouri} +\setinterfacecommand{placeongrid}{plaseazapegrid} +\setinterfacecommand{placeontopofeachother}{punedeasuprafiecareia} +\setinterfacecommand{placepagenumber}{punenumarpagina} +\setinterfacecommand{placereferencelist}{placereferencelist} +\setinterfacecommand{placeregister}{puneregistru} +\setinterfacecommand{placerule}{punerigla} +\setinterfacecommand{placesidebyside}{punefatainfata} +\setinterfacecommand{placesubformula}{punesubformula} +\setinterfacecommand{placetextvariable}{punevariabilatext} +\setinterfacecommand{position}{pozitie} +\setinterfacecommand{positiontext}{pozitietext} +\setinterfacecommand{printpaperheight}{inaltimehartieimprimanta} +\setinterfacecommand{printpaperwidth}{latimehartieimprimanta} +\setinterfacecommand{processblocks}{proceseazabloc} +\setinterfacecommand{processpage}{proceseazapagina} +\setinterfacecommand{product}{produs} +\setinterfacecommand{program}{program} +\setinterfacecommand{project}{proiect} +\setinterfacecommand{publication}{publicatie} +\setinterfacecommand{quotation}{citat} +\setinterfacecommand{quote}{minicitat} +\setinterfacecommand{ran}{ran} +\setinterfacecommand{redo}{refa} +\setinterfacecommand{ref}{ref} +\setinterfacecommand{reference}{referinta} +\setinterfacecommand{referral}{referit} +\setinterfacecommand{referraldate}{datareferit} +\setinterfacecommand{referring}{referring} +\setinterfacecommand{remark}{remarca} +\setinterfacecommand{reset}{reset} +\setinterfacecommand{resetmarking}{reseteazamarcaje} +\setinterfacecommand{resetnumber}{resetnumber} +\setinterfacecommand{resettext}{resettextcontent} +\setinterfacecommand{rightaligned}{aliniatdreapta} +\setinterfacecommand{rightedgedistance}{distantacoltdreapta} +\setinterfacecommand{rightedgewidth}{latimecoltdreapta} +\setinterfacecommand{rightmargindistance}{distantamarginedreapta} +\setinterfacecommand{rightmarginwidth}{latimemarginedreapta} +\setinterfacecommand{romannumerals}{numereromane} +\setinterfacecommand{rotate}{roteste} +\setinterfacecommand{scale}{scala} +\setinterfacecommand{screen}{ecran} +\setinterfacecommand{selectblocks}{selecteazablocuri} +\setinterfacecommand{selectpaper}{selecteazahartie} +\setinterfacecommand{selectversion}{selecteazaversiune} +\setinterfacecommand{setnumber}{setnumber} +\setinterfacecommand{settextcontent}{settextcontent} +\setinterfacecommand{settextvariable}{setvariabilatext} +\setinterfacecommand{setupalign}{seteazaalinierea} +\setinterfacecommand{setupanswerarea}{setupanswerarea} +\setinterfacecommand{setuparranging}{seteazaaranjareapag} +\setinterfacecommand{setupbackground}{seteazafundal} +\setinterfacecommand{setupbackgrounds}{seteazafundaluri} +\setinterfacecommand{setupblackrules}{seteazaliniinegre} +\setinterfacecommand{setupblank}{seteazablanc} +\setinterfacecommand{setupblock}{seteazabloc} +\setinterfacecommand{setupbodyfont}{seteazafonttext} +\setinterfacecommand{setupbodyfontenvironment}{seteazamediulfonttext} +\setinterfacecommand{setupbottom}{seteazajos} +\setinterfacecommand{setupbottomtexts}{seteazatextejos} +\setinterfacecommand{setupbuffer}{seteazabuffer} +\setinterfacecommand{setupbuttons}{seteazabutoane} +\setinterfacecommand{setupcapitals}{seteazamajuscule} +\setinterfacecommand{setupcaption}{seteazalegenda} +\setinterfacecommand{setupcaptions}{seteazalegendele} +\setinterfacecommand{setupclipping}{seteazaclipping} +\setinterfacecommand{setupcolor}{seteazaculoare} +\setinterfacecommand{setupcolors}{seteazaculori} +\setinterfacecommand{setupcolumns}{seteazacoloane} +\setinterfacecommand{setupcolumnset}{setupcolumnset} +\setinterfacecommand{setupcolumnsetlines}{setupcolumnsetlines} +\setinterfacecommand{setupcolumnsetstart}{setupcolumnsetstart} +\setinterfacecommand{setupcombinations}{seteazacombinari} +\setinterfacecommand{setupcombinedlist}{seteazalistacombinata} +\setinterfacecommand{setupcomment}{seteazacomentariu} +\setinterfacecommand{setupdescriptions}{seteazadescriere} +\setinterfacecommand{setupenumerations}{seteazaenumerare} +\setinterfacecommand{setupexternalfigures}{seteazafiguriexterne} +\setinterfacecommand{setupfield}{seteazacamp} +\setinterfacecommand{setupfields}{seteazacampuri} +\setinterfacecommand{setupfillinlines}{seteazaliniiumplere} +\setinterfacecommand{setupfillinrules}{seteazarigleumplere} +\setinterfacecommand{setupfloat}{seteazafloat} +\setinterfacecommand{setupfloats}{seteazafloats} +\setinterfacecommand{setupfloatsplitting}{seteazaimpartireafloat} +\setinterfacecommand{setupfooter}{seteazasubsol} +\setinterfacecommand{setupfootertexts}{seteazatextesubsol} +\setinterfacecommand{setupfootnotedefinition}{seteazadefinireanotasubsol} +\setinterfacecommand{setupfootnotes}{seteazanotasubsol} +\setinterfacecommand{setupforms}{seteazaformulare} +\setinterfacecommand{setupformulas}{seteazaformule} +\setinterfacecommand{setupframed}{seteazainconjurat} +\setinterfacecommand{setupframedtexts}{definestetexteinconjurate} +\setinterfacecommand{setuphead}{seteazatitlu} +\setinterfacecommand{setupheader}{seteazaantet} +\setinterfacecommand{setupheadertexts}{seteazatexteantet} +\setinterfacecommand{setupheadnumber}{seteazanumartitlu} +\setinterfacecommand{setupheads}{seteazatitluri} +\setinterfacecommand{setupheadtext}{seteazatexttitlu} +\setinterfacecommand{setuphyphenmark}{seteazaliniesilabe} +\setinterfacecommand{setupindentations}{seteazaaliniate} +\setinterfacecommand{setupindenting}{seteazaaliniat} +\setinterfacecommand{setupinmargin}{seteazamarginal} +\setinterfacecommand{setupinteraction}{seteazainteractiunea} +\setinterfacecommand{setupinteractionbar}{seteazabarainteractiune} +\setinterfacecommand{setupinteractionmenu}{seteazameniuinteractiune} +\setinterfacecommand{setupinteractionscreen}{seteazaecraninteractiune} +\setinterfacecommand{setupinterlinespace}{seteazaspatiuinterliniar} +\setinterfacecommand{setupitemgroup}{setupitemgroup} +\setinterfacecommand{setupitemgroups}{setareitemization} +\setinterfacecommand{setupitems}{seteazaelemente} +\setinterfacecommand{setuplabeltext}{seteazatexteticheta} +\setinterfacecommand{setuplanguage}{setarelimba} +\setinterfacecommand{setuplayout}{seteazaaspect} +\setinterfacecommand{setuplegend}{seteazalegenda} +\setinterfacecommand{setuplinenumbering}{seteazanumerotarelinii} +\setinterfacecommand{setuplines}{seteazalinii} +\setinterfacecommand{setuplinewidth}{seteazagrosimelinie} +\setinterfacecommand{setuplist}{seteazalista} +\setinterfacecommand{setupmakeup}{seteazamakeup} +\setinterfacecommand{setupmarginblocks}{seteazablocurimarginale} +\setinterfacecommand{setupmarginrules}{seteazaliniimargine} +\setinterfacecommand{setupmarking}{seteazamarcaje} +\setinterfacecommand{setupmathalignment}{setupmathalignment} +\setinterfacecommand{setupnarrower}{seteazaingust} +\setinterfacecommand{setupnumber}{setupnumber} +\setinterfacecommand{setupnumbering}{seteazanumerotare} +\setinterfacecommand{setupoppositeplacing}{seteazaplasareaopozita} +\setinterfacecommand{setupoutput}{setareoutput} +\setinterfacecommand{setuppagecomment}{seteazacomentariupagina} +\setinterfacecommand{setuppagenumber}{seteazanumarpagina} +\setinterfacecommand{setuppagenumbering}{seteazanumerotarepagina} +\setinterfacecommand{setuppagetransitions}{seteazatranzitiepagina} +\setinterfacecommand{setuppalet}{seteazapaleta} +\setinterfacecommand{setuppaper}{setuppaper} +\setinterfacecommand{setuppapersize}{seteazadimensiunihartie} +\setinterfacecommand{setupparagraphnumbering}{seteazanumerotareparagrafe} +\setinterfacecommand{setupparagraphs}{seteazaparagrafe} +\setinterfacecommand{setupplacement}{setupplacement} +\setinterfacecommand{setuppositioning}{setarepozitie} +\setinterfacecommand{setupprofiles}{seteazaprofile} +\setinterfacecommand{setupprograms}{seteazaprograme} +\setinterfacecommand{setuppublications}{seteazapublicatii} +\setinterfacecommand{setupquote}{seteazaminicitat} +\setinterfacecommand{setupreferencelist}{seteazalistareferinte} +\setinterfacecommand{setupreferencing}{seteazareferinte} +\setinterfacecommand{setupregister}{seteazaregistru} +\setinterfacecommand{setuprotate}{seteazarotare} +\setinterfacecommand{setuprule}{seteazarigla} +\setinterfacecommand{setups}{setari} +\setinterfacecommand{setupscreens}{seteazaecrane} +\setinterfacecommand{setupsection}{seteazasectiune} +\setinterfacecommand{setupsectionblock}{seteazablocsectiune} +\setinterfacecommand{setupsorting}{seteazasortare} +\setinterfacecommand{setupspacing}{seteazaspatiu} +\setinterfacecommand{setupstartstop}{setupstartstop} +\setinterfacecommand{setupstrut}{seteazastrut} +\setinterfacecommand{setupsubpagenumber}{seteazanumarsubpagina} +\setinterfacecommand{setupsymbolset}{seteazasimbol} +\setinterfacecommand{setupsynchronization}{setaresincronizare} +\setinterfacecommand{setupsynchronizationbar}{setarebarasincronizare} +\setinterfacecommand{setupsynonyms}{seteazasinonime} +\setinterfacecommand{setupsystem}{seteazasistem} +\setinterfacecommand{setuptab}{seteazatab} +\setinterfacecommand{setuptables}{seteazatabele} +\setinterfacecommand{setuptabulate}{seteazatabulatori} +\setinterfacecommand{setuptext}{seteazatext} +\setinterfacecommand{setuptextposition}{seteazapozitietext} +\setinterfacecommand{setuptextrules}{seteazarigletext} +\setinterfacecommand{setuptexttexts}{seteazatextetext} +\setinterfacecommand{setuptextvariable}{seteazavariabilatext} +\setinterfacecommand{setupthinrules}{seteazaliniesubtire} +\setinterfacecommand{setuptolerance}{seteazatoleranta} +\setinterfacecommand{setuptop}{seteazasus} +\setinterfacecommand{setuptoptexts}{seteazatextesus} +\setinterfacecommand{setuptype}{seteazatype} +\setinterfacecommand{setuptyping}{seteazatyping} +\setinterfacecommand{setupunderbar}{seteazasublinie} +\setinterfacecommand{setupurl}{seteazaurl} +\setinterfacecommand{setupversions}{seteazaversiuni} +\setinterfacecommand{setupwhitespace}{seteazaspatiualb} +\setinterfacecommand{showbodyfont}{afiseazafonttext} +\setinterfacecommand{showbodyfontenvironment}{afiseazamediufonttext} +\setinterfacecommand{showcolor}{afiseazaculoare} +\setinterfacecommand{showcolorgroup}{afiseazagrupculoare} +\setinterfacecommand{showexternalfigures}{afiseazafiguriexterne} +\setinterfacecommand{showfields}{afiseazacampuri} +\setinterfacecommand{showframe}{afiseazarama} +\setinterfacecommand{showgrid}{afiseazagrid} +\setinterfacecommand{showlayout}{afiseazaaspect} +\setinterfacecommand{showmakeup}{afiseazamakeup} +\setinterfacecommand{showpalet}{afiseazapaleta} +\setinterfacecommand{showprint}{afiseazatiparire} +\setinterfacecommand{showsetups}{afiseazasetari} +\setinterfacecommand{showstruts}{afiseazastruts} +\setinterfacecommand{showsymbolset}{afiseazasetsimboluri} +\setinterfacecommand{smallcapped}{kap} +\setinterfacecommand{someline}{olinie} +\setinterfacecommand{somewhere}{undeva} +\setinterfacecommand{space}{spatiu} +\setinterfacecommand{splitfloat}{impartefloat} +\setinterfacecommand{startalignment}{startaliniere} +\setinterfacecommand{startbackground}{startfundal} +\setinterfacecommand{startcoding}{startcodificare} +\setinterfacecommand{startcolor}{startculoare} +\setinterfacecommand{startcolumnmakeup}{startcolumnmakeup} +\setinterfacecommand{startcolumns}{startcoloane} +\setinterfacecommand{startcolumnset}{startcolumnset} +\setinterfacecommand{startcombination}{startcombinare} +\setinterfacecommand{startcomponent}{startcomponenta} +\setinterfacecommand{startdocument}{startdocument} +\setinterfacecommand{startenvironment}{startmediu} +\setinterfacecommand{startfigure}{startfigura} +\setinterfacecommand{startglobal}{startglobal} +\setinterfacecommand{startline}{startlinie} +\setinterfacecommand{startlinecorrection}{startcorectielinie} +\setinterfacecommand{startlinenumbering}{startnumerotarelinii} +\setinterfacecommand{startlines}{startlinii} +\setinterfacecommand{startlocal}{startlocal} +\setinterfacecommand{startlocalfootnotes}{startnotesubsollocale} +\setinterfacecommand{startmakeup}{startmakeup} +\setinterfacecommand{startmarginblock}{startblocmarginal} +\setinterfacecommand{startmarginrule}{startliniemargine} +\setinterfacecommand{startnarrower}{startingust} +\setinterfacecommand{startopposite}{startopozit} +\setinterfacecommand{startoverlay}{startoverlay} +\setinterfacecommand{startoverzicht}{startoverview} +\setinterfacecommand{startpacked}{startimpachetat} +\setinterfacecommand{startpositioning}{startpozitionare} +\setinterfacecommand{startproduct}{startprodus} +\setinterfacecommand{startprofile}{startprofil} +\setinterfacecommand{startproject}{startproiect} +\setinterfacecommand{startquotation}{startcitat} +\setinterfacecommand{startraster}{startraster} +\setinterfacecommand{startsymbolset}{startsetsimboluri} +\setinterfacecommand{startsynchronization}{startsincronizare} +\setinterfacecommand{starttable}{starttabel} +\setinterfacecommand{starttables}{starttabele} +\setinterfacecommand{starttext}{starttext} +\setinterfacecommand{starttextrule}{startriglatext} +\setinterfacecommand{startunpacked}{startneimpachetat} +\setinterfacecommand{startversion}{startversiune} +\setinterfacecommand{stopalignment}{stopaliniere} +\setinterfacecommand{stopbackground}{stopfundal} +\setinterfacecommand{stopcoding}{stopcodificare} +\setinterfacecommand{stopcolor}{stopculoare} +\setinterfacecommand{stopcolumnmakeup}{stopcolumnmakeup} +\setinterfacecommand{stopcolumns}{stopcoloane} +\setinterfacecommand{stopcolumnset}{stopcolumnset} +\setinterfacecommand{stopcombination}{stopcombinare} +\setinterfacecommand{stopcomponent}{stopcomponenta} +\setinterfacecommand{stopdocument}{stopdocument} +\setinterfacecommand{stopenvironment}{stopmediu} +\setinterfacecommand{stopglobal}{stopblobal} +\setinterfacecommand{stopline}{stoplinie} +\setinterfacecommand{stoplinecorrection}{stopcorectielinie} +\setinterfacecommand{stoplinenumbering}{stopnumerotarelinii} +\setinterfacecommand{stoplines}{stoplinii} +\setinterfacecommand{stoplocal}{stoplocal} +\setinterfacecommand{stoplocalfootnotes}{stopnotesubsollocale} +\setinterfacecommand{stopmakeup}{stopmakeup} +\setinterfacecommand{stopmarginblock}{stopblocmarginal} +\setinterfacecommand{stopmarginrule}{stopliniemargine} +\setinterfacecommand{stopnarrower}{stopingust} +\setinterfacecommand{stopopposite}{stopopozit} +\setinterfacecommand{stopoverlay}{stopoverlay} +\setinterfacecommand{stopoverzicht}{stopoverview} +\setinterfacecommand{stoppacked}{stopimpachetat} +\setinterfacecommand{stoppositioning}{stoppozitionare} +\setinterfacecommand{stopproduct}{stopprodus} +\setinterfacecommand{stopprofile}{stopprofil} +\setinterfacecommand{stopproject}{stopproiect} +\setinterfacecommand{stopquotation}{stopcitat} +\setinterfacecommand{stopraster}{stopraster} +\setinterfacecommand{stopsynchronization}{stopsincronizare} +\setinterfacecommand{stoptable}{stoptabel} +\setinterfacecommand{stoptables}{stoptabele} +\setinterfacecommand{stoptext}{stoptext} +\setinterfacecommand{stoptextrule}{stopriglatext} +\setinterfacecommand{stopunpacked}{stopneimpachetat} +\setinterfacecommand{stopversion}{stopversiune} +\setinterfacecommand{stretched}{intins} +\setinterfacecommand{subformulanumber}{numarsubformula} +\setinterfacecommand{subpagenumber}{subpagenumber} +\setinterfacecommand{switchtobodyfont}{trecilafonttext} +\setinterfacecommand{switchtorawfont}{trecilafontraw} +\setinterfacecommand{sym}{sim} +\setinterfacecommand{symbol}{simbol} +\setinterfacecommand{synchronizationbar}{barasincronizare} +\setinterfacecommand{synchronize}{sincronizeaza} +\setinterfacecommand{tab}{tab} +\setinterfacecommand{testcolumn}{testcolumn} +\setinterfacecommand{testpage}{testpage} +\setinterfacecommand{tex}{tex} +\setinterfacecommand{textheight}{inaltimetext} +\setinterfacecommand{textreference}{referintatext} +\setinterfacecommand{textrule}{riglatext} +\setinterfacecommand{textvariable}{variabilatext} +\setinterfacecommand{textwidth}{latimetext} +\setinterfacecommand{thinrule}{liniesubtire} +\setinterfacecommand{thinrules}{liniisubtiri} +\setinterfacecommand{tooltip}{tooltip} +\setinterfacecommand{topdistance}{distantasus} +\setinterfacecommand{topheight}{inaltimesus} +\setinterfacecommand{topspace}{spatiusus} +\setinterfacecommand{totalnumberofpages}{numartotalpagini} +\setinterfacecommand{translate}{traduce} +\setinterfacecommand{txt}{txt} +\setinterfacecommand{typ}{typ} +\setinterfacecommand{type}{type} +\setinterfacecommand{typebuffer}{scriebuffer} +\setinterfacecommand{typefile}{typefile} +\setinterfacecommand{unitmeaning}{numeunitate} +\setinterfacecommand{unknown}{necunoscut} +\setinterfacecommand{useJSscripts}{folosestescriptJS} +\setinterfacecommand{useURL}{folosesteURL} +\setinterfacecommand{useXMLfilter}{useXMLfilter} +\setinterfacecommand{useblocks}{folosestebloc} +\setinterfacecommand{usecommands}{folosestecomenzi} +\setinterfacecommand{useencoding}{folosestecodificarea} +\setinterfacecommand{useexternaldocument}{folosestedocumentextern} +\setinterfacecommand{useexternalfigure}{folosestefiguraexterna} +\setinterfacecommand{useexternalfile}{folosestefisierextern} +\setinterfacecommand{useexternalfiles}{folosestefisiereexterne} +\setinterfacecommand{useexternalsoundtrack}{folosestemuzicaexterna} +\setinterfacecommand{usemodule}{folosestemodul} +\setinterfacecommand{usemodules}{folosestemodule} +\setinterfacecommand{usepath}{folosestedirector} +\setinterfacecommand{usereferences}{folosestereferinte} +\setinterfacecommand{usespecials}{folosestespeciale} +\setinterfacecommand{usesymbols}{folosestesimboluri} +\setinterfacecommand{usetypescript}{usetypescript} +\setinterfacecommand{usetypescriptfile}{usetypescriptfile} +\setinterfacecommand{useurl}{folosesteurl} +\setinterfacecommand{version}{versiune} +\setinterfacecommand{vl}{vl} +\setinterfacecommand{weekday}{zidinsaptamana} +\setinterfacecommand{whitespace}{spatiualb} +\setinterfacecommand{wordright}{cuvantdreapta} +\setinterfacecommand{writebetweenlist}{scrieintreliste} +\setinterfacecommand{writetolist}{scrieinlista} +\setinterfacecommand{writetoreferencelist}{scrieinlistareferinte} +\setinterfacecommand{writetoregister}{scrieinregistru} +% +\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-ro.tex b/Master/texmf-dist/tex/context/base/mult-ro.tex deleted file mode 100644 index 738e49f7219..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-ro.tex +++ /dev/null @@ -1,1693 +0,0 @@ -% this file is auto-generated, don't edit this file -% -% definitions for interface variables for language ro -% -\setinterfacevariable{Addition}{Adaugare} -\setinterfacevariable{Balloon}{Balon} -\setinterfacevariable{Character}{Caracter} -\setinterfacevariable{Characters}{Caractere} -\setinterfacevariable{CloseDocument}{InchideDocument} -\setinterfacevariable{ExitViewer}{IesireVizualizator} -\setinterfacevariable{FirstPage}{PrimaPagina} -\setinterfacevariable{FitHeight}{AjustatInaltime} -\setinterfacevariable{FitWidth}{AjustatLatime} -\setinterfacevariable{GotoPage}{LaPagina} -\setinterfacevariable{Greek}{Grec} -\setinterfacevariable{Help}{Ajutor} -\setinterfacevariable{HideField}{AscundeCamp} -\setinterfacevariable{HideLayer}{HideLayer} -\setinterfacevariable{Key}{Cheie} -\setinterfacevariable{LastPage}{UltimaPagina} -\setinterfacevariable{LoadForm}{IncarcaFormular} -\setinterfacevariable{MONTH}{LUNA} -\setinterfacevariable{New}{Nou} -\setinterfacevariable{NextJump}{SaltUrmator} -\setinterfacevariable{NextPage}{PaginaUrmatoare} -\setinterfacevariable{Numbers}{Numere} -\setinterfacevariable{OpenNamedDocument}{OpenNamedDocument} -\setinterfacevariable{Paragraph}{Paragraf} -\setinterfacevariable{PauseMovie}{PauzaFilm} -\setinterfacevariable{PauseRendering}{PauseRendering} -\setinterfacevariable{PauseSound}{PauzaSunet} -\setinterfacevariable{PreviousJump}{SaltPrecedent} -\setinterfacevariable{PreviousPage}{PaginaPrecedenta} -\setinterfacevariable{PrintDocument}{TiparesteDocument} -\setinterfacevariable{Query}{Query} -\setinterfacevariable{QueryAgain}{QueryAgain} -\setinterfacevariable{ResetForm}{ResetareFormular} -\setinterfacevariable{ResumeMovie}{RepornesteFilm} -\setinterfacevariable{ResumeRendering}{ResumeRendering} -\setinterfacevariable{ResumeSound}{RepornesteSunet} -\setinterfacevariable{Romannumerals}{Numereromane} -\setinterfacevariable{SaveDocument}{SalvareDocument} -\setinterfacevariable{SaveForm}{SalveazaFormular} -\setinterfacevariable{SaveNamedDocument}{SaveNamedDocument} -\setinterfacevariable{SearchAgain}{CautaDinNou} -\setinterfacevariable{SearchDocument}{CautaDocument} -\setinterfacevariable{ShowBookmarks}{ShowBookmarks} -\setinterfacevariable{ShowField}{AfiseazaCamp} -\setinterfacevariable{ShowThumbs}{ShowThumbs} -\setinterfacevariable{StartMovie}{StartFilm} -\setinterfacevariable{StartRendering}{StartRendering} -\setinterfacevariable{StartSound}{StartSunet} -\setinterfacevariable{StopMovie}{StopFilm} -\setinterfacevariable{StopRendering}{StopRendering} -\setinterfacevariable{StopSound}{StopSunet} -\setinterfacevariable{SubmitForm}{TrimiteFormular} -\setinterfacevariable{ToggleLayer}{ToggleLayer} -\setinterfacevariable{ToggleViewer}{SchimbaVizualizator} -\setinterfacevariable{URL}{URL} -\setinterfacevariable{VideLayer}{VideLayer} -\setinterfacevariable{ViewerHelp}{AjutorVizualizator} -\setinterfacevariable{WEEKDAY}{ZISAPTAMANA} -\setinterfacevariable{WORD}{CUVANT} -\setinterfacevariable{abbreviation}{abreviere} -\setinterfacevariable{abbreviations}{abrevieri} -\setinterfacevariable{absolute}{absolut} -\setinterfacevariable{action}{actiune} -\setinterfacevariable{after}{dupa} -\setinterfacevariable{all}{tot} -\setinterfacevariable{always}{totdeauna} -\setinterfacevariable{answerarea}{answerarea} -\setinterfacevariable{appendices}{apendixuri} -\setinterfacevariable{appendix}{apendix} -\setinterfacevariable{april}{aprilie} -\setinterfacevariable{atmargin}{lamargine} -\setinterfacevariable{atpage}{lapagina} -\setinterfacevariable{august}{august} -\setinterfacevariable{author}{autor} -\setinterfacevariable{auto}{auto} -\setinterfacevariable{autointro}{autointro} -\setinterfacevariable{back}{inapot} -\setinterfacevariable{background}{fundal} -\setinterfacevariable{backmatter}{epilogul} -\setinterfacevariable{backpart}{epilog} -\setinterfacevariable{backspace}{spatiuspate} -\setinterfacevariable{backward}{inapoi} -\setinterfacevariable{bbl}{bbl} -\setinterfacevariable{before}{inainte} -\setinterfacevariable{begin}{begin} -\setinterfacevariable{bib}{bib} -\setinterfacevariable{big}{mare} -\setinterfacevariable{bigbodyfont}{bigbodyfont} -\setinterfacevariable{bigpreference}{preferintamare} -\setinterfacevariable{blank}{blank} -\setinterfacevariable{blockquote}{blockquote} -\setinterfacevariable{bodymatter}{principalul} -\setinterfacevariable{bodypart}{principal} -\setinterfacevariable{bold}{aldin} -\setinterfacevariable{bolditalic}{aldinitalic} -\setinterfacevariable{boldslanted}{aldininclinat} -\setinterfacevariable{bookmark}{semncarte} -\setinterfacevariable{both}{ambele} -\setinterfacevariable{bottom}{subsol} -\setinterfacevariable{brief}{brief} -\setinterfacevariable{broad}{broad} -\setinterfacevariable{buffer}{buffer} -\setinterfacevariable{by}{de} -\setinterfacevariable{calligraphic}{caligrafic} -\setinterfacevariable{cap}{cap} -\setinterfacevariable{capital}{majuscula} -\setinterfacevariable{center}{center} -\setinterfacevariable{chapter}{capitol} -\setinterfacevariable{character}{caracter} -\setinterfacevariable{characters}{caractere} -\setinterfacevariable{cite}{cite} -\setinterfacevariable{color}{culoare} -\setinterfacevariable{column}{coloana} -\setinterfacevariable{columns}{coloane} -\setinterfacevariable{command}{comanda} -\setinterfacevariable{commands}{comenzi} -\setinterfacevariable{comment}{comentariu} -\setinterfacevariable{component}{componenta} -\setinterfacevariable{concept}{concept} -\setinterfacevariable{content}{cuprins} -\setinterfacevariable{contents}{cuprinsuri} -\setinterfacevariable{continue}{continuu} -\setinterfacevariable{controls}{controale} -\setinterfacevariable{conversion}{conversie} -\setinterfacevariable{current}{curent} -\setinterfacevariable{cutspace}{cutspace} -\setinterfacevariable{date}{data} -\setinterfacevariable{day}{zi} -\setinterfacevariable{december}{decembrie} -\setinterfacevariable{default}{implicit} -\setinterfacevariable{depth}{adancime} -\setinterfacevariable{description}{descriere} -\setinterfacevariable{disable}{dezactivat} -\setinterfacevariable{display}{display} -\setinterfacevariable{dot}{punct} -\setinterfacevariable{doublesided}{douafete} -\setinterfacevariable{down}{down} -\setinterfacevariable{each}{fiecare} -\setinterfacevariable{edge}{bordura} -\setinterfacevariable{empty}{gol} -\setinterfacevariable{end}{end} -\setinterfacevariable{endnote}{endnote} -\setinterfacevariable{enumeration}{enumerare} -\setinterfacevariable{environment}{mediu} -\setinterfacevariable{even}{par} -\setinterfacevariable{external}{extern} -\setinterfacevariable{fact}{fapt} -\setinterfacevariable{february}{februarie} -\setinterfacevariable{figure}{figura} -\setinterfacevariable{figures}{figure} -\setinterfacevariable{file}{fisier} -\setinterfacevariable{final}{final} -\setinterfacevariable{first}{primul} -\setinterfacevariable{firstcolumn}{firstcolumn} -\setinterfacevariable{firstpage}{primapagina} -\setinterfacevariable{firstsubpage}{primasubpagina} -\setinterfacevariable{fit}{ajustat} -\setinterfacevariable{five}{cinci} -\setinterfacevariable{fix}{fix} -\setinterfacevariable{fixed}{fixat} -\setinterfacevariable{flexible}{flexibil} -\setinterfacevariable{float}{obiectmobil} -\setinterfacevariable{flushinner}{flushinner} -\setinterfacevariable{flushleft}{flushleft} -\setinterfacevariable{flushouter}{flushouter} -\setinterfacevariable{flushright}{flushright} -\setinterfacevariable{footer}{subsol} -\setinterfacevariable{footnote}{notasubsol} -\setinterfacevariable{force}{fortat} -\setinterfacevariable{foreground}{primplan} -\setinterfacevariable{formeel}{formeel} -\setinterfacevariable{formula}{formula} -\setinterfacevariable{formulae}{formule} -\setinterfacevariable{forward}{avans} -\setinterfacevariable{four}{patru} -\setinterfacevariable{frame}{incadrat} -\setinterfacevariable{framedtext}{textinconjurat} -\setinterfacevariable{friday}{vineri} -\setinterfacevariable{frontmatter}{prologul} -\setinterfacevariable{frontpart}{prolog} -\setinterfacevariable{global}{global} -\setinterfacevariable{graphic}{graficul} -\setinterfacevariable{graphics}{graficele} -\setinterfacevariable{gray}{gri} -\setinterfacevariable{greek}{grec} -\setinterfacevariable{grid}{grila} -\setinterfacevariable{halfline}{jumatatelinie} -\setinterfacevariable{handwritten}{scrismanual} -\setinterfacevariable{hang}{suspenda} -\setinterfacevariable{hanging}{suspendat} -\setinterfacevariable{head}{antet} -\setinterfacevariable{header}{antet} -\setinterfacevariable{height}{inaltime} -\setinterfacevariable{helptext}{textajutator} -\setinterfacevariable{hencefore}{precedent} -\setinterfacevariable{here}{aici} -\setinterfacevariable{hereafter}{urmator} -\setinterfacevariable{hidden}{ascuns} -\setinterfacevariable{hiding}{ascundere} -\setinterfacevariable{high}{inalt} -\setinterfacevariable{horizontal}{orizontal} -\setinterfacevariable{hyphenated}{despsilabe} -\setinterfacevariable{hz}{hz} -\setinterfacevariable{inbetween}{intre} -\setinterfacevariable{index}{index} -\setinterfacevariable{indices}{indexuri} -\setinterfacevariable{informeel}{informeel} -\setinterfacevariable{inherit}{inherit} -\setinterfacevariable{inleft}{instanga} -\setinterfacevariable{inmargin}{inmargine} -\setinterfacevariable{inner}{intern} -\setinterfacevariable{inneredge}{inneredge} -\setinterfacevariable{innermargin}{innermargin} -\setinterfacevariable{inright}{indreapta} -\setinterfacevariable{interaction}{interactiune} -\setinterfacevariable{interactionmenu}{meniuinteractiune} -\setinterfacevariable{intermezzi}{intermezzi} -\setinterfacevariable{intermezzo}{intermezzo} -\setinterfacevariable{intext}{intext} -\setinterfacevariable{intro}{intro} -\setinterfacevariable{italic}{italic} -\setinterfacevariable{italicbold}{italicaldin} -\setinterfacevariable{item}{element} -\setinterfacevariable{itemize}{enumerare} -\setinterfacevariable{its}{propriu} -\setinterfacevariable{january}{ianuarie} -\setinterfacevariable{joinedup}{unit} -\setinterfacevariable{july}{iulie} -\setinterfacevariable{june}{iunie} -\setinterfacevariable{keep}{mentine} -\setinterfacevariable{knockout}{knockout} -\setinterfacevariable{label}{eticheta} -\setinterfacevariable{landscape}{vedere} -\setinterfacevariable{last}{ultim} -\setinterfacevariable{lastcolumn}{lastcolumn} -\setinterfacevariable{lastpage}{ultimapagina} -\setinterfacevariable{lastpagenumber}{lastpagenumber} -\setinterfacevariable{lastsubpage}{ultimasubpagina} -\setinterfacevariable{layer}{layer} -\setinterfacevariable{left}{stanga} -\setinterfacevariable{leftedge}{bordurastanga} -\setinterfacevariable{lefthanging}{lefthanging} -\setinterfacevariable{leftmargin}{marginestanga} -\setinterfacevariable{leftpage}{paginastanga} -\setinterfacevariable{lefttoright}{lefttoright} -\setinterfacevariable{legend}{legenda} -\setinterfacevariable{lesshyphenation}{lesshyphenation} -\setinterfacevariable{line}{linie} -\setinterfacevariable{linenote}{linenote} -\setinterfacevariable{lines}{linii} -\setinterfacevariable{list}{lista} -\setinterfacevariable{local}{local} -\setinterfacevariable{localenvironment}{mediulocal} -\setinterfacevariable{logo}{logo} -\setinterfacevariable{logos}{logos} -\setinterfacevariable{lohi}{lohi} -\setinterfacevariable{loose}{larg} -\setinterfacevariable{low}{jos} -\setinterfacevariable{ls}{ls} -\setinterfacevariable{makeup}{marcaj} -\setinterfacevariable{mar}{mar} -\setinterfacevariable{march}{martie} -\setinterfacevariable{margin}{margine} -\setinterfacevariable{marginedge}{marginebordura} -\setinterfacevariable{margintitle}{titlumarginal} -\setinterfacevariable{marking}{marcaje} -\setinterfacevariable{mathalignment}{mathalignment} -\setinterfacevariable{mathcases}{mathcases} -\setinterfacevariable{mathmatrix}{mathmatrix} -\setinterfacevariable{max}{max} -\setinterfacevariable{maxdepth}{maxdepth} -\setinterfacevariable{maxheight}{maxheight} -\setinterfacevariable{maxwidth}{maxwidth} -\setinterfacevariable{may}{mai} -\setinterfacevariable{mediaeval}{medieval} -\setinterfacevariable{medium}{mediu} -\setinterfacevariable{middle}{centru} -\setinterfacevariable{min}{min} -\setinterfacevariable{mindepth}{mindepth} -\setinterfacevariable{minheight}{inaltimeminima} -\setinterfacevariable{minwidth}{latimeminima} -\setinterfacevariable{mirrored}{oglindit} -\setinterfacevariable{monday}{luni} -\setinterfacevariable{mono}{mono} -\setinterfacevariable{month}{luna} -\setinterfacevariable{morehyphenation}{morehyphenation} -\setinterfacevariable{name}{nume} -\setinterfacevariable{narrow}{ingust} -\setinterfacevariable{negative}{negativ} -\setinterfacevariable{never}{niciodata} -\setinterfacevariable{new}{nou} -\setinterfacevariable{next}{urmatorul} -\setinterfacevariable{nextevenpage}{paginaparaurmatoarea} -\setinterfacevariable{nextoddpage}{paginaimparaurmatoarea} -\setinterfacevariable{nextpage}{paginaurmatoare} -\setinterfacevariable{nextsubpage}{urmatoareasubpagina} -\setinterfacevariable{no}{nu} -\setinterfacevariable{nocheck}{nocheck} -\setinterfacevariable{nofit}{nofit} -\setinterfacevariable{nogrid}{nogrid} -\setinterfacevariable{nohz}{nohz} -\setinterfacevariable{nomarking}{faramarcare} -\setinterfacevariable{none}{niciunul} -\setinterfacevariable{nonumber}{nonumber} -\setinterfacevariable{normal}{normal} -\setinterfacevariable{nospacing}{nospacing} -\setinterfacevariable{not}{nu} -\setinterfacevariable{note}{note} -\setinterfacevariable{nothanging}{nothanging} -\setinterfacevariable{nothyphenated}{nedespsilabe} -\setinterfacevariable{november}{noiembrie} -\setinterfacevariable{nowhere}{niciunde} -\setinterfacevariable{nowhite}{faraalb} -\setinterfacevariable{number}{numar} -\setinterfacevariable{numbers}{numere} -\setinterfacevariable{october}{octombrie} -\setinterfacevariable{odd}{impar} -\setinterfacevariable{off}{dezactivat} -\setinterfacevariable{offset}{offset} -\setinterfacevariable{old}{old} -\setinterfacevariable{on}{on} -\setinterfacevariable{one}{unu} -\setinterfacevariable{opposite}{opus} -\setinterfacevariable{outer}{extern} -\setinterfacevariable{outeredge}{outeredge} -\setinterfacevariable{outermargin}{outermargin} -\setinterfacevariable{overbar}{barasus} -\setinterfacevariable{overbars}{supralinie} -\setinterfacevariable{overlay}{overlay} -\setinterfacevariable{overprint}{overprint} -\setinterfacevariable{overstrike}{liniepeste} -\setinterfacevariable{overstrikes}{liniipeste} -\setinterfacevariable{packed}{impachetat} -\setinterfacevariable{page}{pagina} -\setinterfacevariable{pagecomment}{comentariupagina} -\setinterfacevariable{pagenumber}{numarpagina} -\setinterfacevariable{paper}{foaie} -\setinterfacevariable{paragraph}{paragraf} -\setinterfacevariable{part}{parte} -\setinterfacevariable{positive}{positiv} -\setinterfacevariable{postponing}{postponing} -\setinterfacevariable{postscript}{postscript} -\setinterfacevariable{preference}{preferinta} -\setinterfacevariable{preview}{previzualizare} -\setinterfacevariable{previous}{precedent} -\setinterfacevariable{previousevenpage}{paginaparaprecedenta} -\setinterfacevariable{previousoddpage}{paginaimparaprecedenta} -\setinterfacevariable{previouspage}{paginaanterioara} -\setinterfacevariable{previoussubpage}{subpaginaanterioara} -\setinterfacevariable{printable}{tiparibil} -\setinterfacevariable{process}{process} -\setinterfacevariable{product}{produs} -\setinterfacevariable{program}{program} -\setinterfacevariable{project}{proiect} -\setinterfacevariable{protected}{protejat} -\setinterfacevariable{quadruple}{cvadrupul} -\setinterfacevariable{quotation}{citat} -\setinterfacevariable{quote}{minicitat} -\setinterfacevariable{ran}{rulat} -\setinterfacevariable{random}{aleator} -\setinterfacevariable{readonly}{readonly} -\setinterfacevariable{rectangular}{rectangular} -\setinterfacevariable{referral}{referinta} -\setinterfacevariable{register}{registru} -\setinterfacevariable{regular}{regular} -\setinterfacevariable{rekening}{rekening} -\setinterfacevariable{relative}{relativ} -\setinterfacevariable{repeat}{repetat} -\setinterfacevariable{required}{obligatoriu} -\setinterfacevariable{reset}{reset} -\setinterfacevariable{reverse}{reverse} -\setinterfacevariable{right}{dreapta} -\setinterfacevariable{rightedge}{borduradreapta} -\setinterfacevariable{righthanging}{righthanging} -\setinterfacevariable{rightmargin}{marginedreapta} -\setinterfacevariable{rightpage}{paginadreapta} -\setinterfacevariable{righttoleft}{righttoleft} -\setinterfacevariable{roman}{roman} -\setinterfacevariable{romannumerals}{numereromane} -\setinterfacevariable{rotate}{rotit} -\setinterfacevariable{rotated}{rotat} -\setinterfacevariable{round}{rotund} -\setinterfacevariable{row}{rand} -\setinterfacevariable{rule}{rigla} -\setinterfacevariable{samepage}{aceeasipagina} -\setinterfacevariable{sans}{sans} -\setinterfacevariable{sansbold}{sansaldin} -\setinterfacevariable{sansserif}{sansserif} -\setinterfacevariable{saturday}{sambata} -\setinterfacevariable{screen}{ecran} -\setinterfacevariable{section}{sectiune} -\setinterfacevariable{sectionblockenvironment}{blocsectiuneambient} -\setinterfacevariable{sectionnumber}{numarsetiune} -\setinterfacevariable{see}{vezi} -\setinterfacevariable{september}{septembrie} -\setinterfacevariable{serif}{serif} -\setinterfacevariable{serried}{serried} -\setinterfacevariable{setups}{setari} -\setinterfacevariable{sheet}{sheet} -\setinterfacevariable{short}{short} -\setinterfacevariable{singlesided}{ofata} -\setinterfacevariable{slanted}{inclinat} -\setinterfacevariable{slantedbold}{inclinataldin} -\setinterfacevariable{small}{mic} -\setinterfacevariable{smallbodyfont}{smallbodyfont} -\setinterfacevariable{smallbold}{micaldin} -\setinterfacevariable{smallbolditalic}{micaldininclinat} -\setinterfacevariable{smallboldslanted}{micaldininclinat} -\setinterfacevariable{smallcaps}{majusculemici} -\setinterfacevariable{smallitalic}{micitalic} -\setinterfacevariable{smallitalicbold}{micitalicaldin} -\setinterfacevariable{smallnormal}{micnormal} -\setinterfacevariable{smallslanted}{micinclinat} -\setinterfacevariable{smallslantedbold}{micinclinataldin} -\setinterfacevariable{smalltype}{mictype} -\setinterfacevariable{somewhere}{undeva} -\setinterfacevariable{sorted}{sortat} -\setinterfacevariable{space}{spatiu} -\setinterfacevariable{spacing}{spatiere} -\setinterfacevariable{speech}{speech} -\setinterfacevariable{split}{split} -\setinterfacevariable{spot}{spot} -\setinterfacevariable{standard}{standard} -\setinterfacevariable{start}{start} -\setinterfacevariable{starter}{starter} -\setinterfacevariable{sticker}{sticker} -\setinterfacevariable{stop}{stop} -\setinterfacevariable{stopper}{stopper} -\setinterfacevariable{stretch}{dilatat} -\setinterfacevariable{strict}{strict} -\setinterfacevariable{strong}{strong} -\setinterfacevariable{strut}{strut} -\setinterfacevariable{sub}{sub} -\setinterfacevariable{subbackward}{subinapoi} -\setinterfacevariable{subformula}{subformula} -\setinterfacevariable{subforward}{subavans} -\setinterfacevariable{subject}{subiect} -\setinterfacevariable{subpage}{subpagina} -\setinterfacevariable{subsection}{subsectiune} -\setinterfacevariable{subsubject}{subsubiect} -\setinterfacevariable{subsubsection}{subsubsectiune} -\setinterfacevariable{subsubsubject}{subsubsubiect} -\setinterfacevariable{subsubsubsection}{subsubsubsectiune} -\setinterfacevariable{subsubsubsubject}{subsubsubsubiect} -\setinterfacevariable{subsubsubsubsection}{subsubsubsubsectiune} -\setinterfacevariable{subsubsubsubsubject}{subsubsubsubsubiect} -\setinterfacevariable{subsubsubsubsubsection}{subsubsubsubsubsectiune} -\setinterfacevariable{subsubsubsubsubsubject}{subsubsubsubsubsubiect} -\setinterfacevariable{subsubsubsubsubsubsection}{subsubsubsubsubsubsectiune} -\setinterfacevariable{subsubsubsubsubsubsubject}{subsubsubsubsubsubsubiect} -\setinterfacevariable{subsubsubsubsubsubsubsection}{subsubsubsubsubsubsubsectiune} -\setinterfacevariable{subsubsubsubsubsubsubsubject}{subsubsubsubsubsubsubsubiect} -\setinterfacevariable{subsubsubsubsubsubsubsubsection}{subsubsubsubsubsubsubsubsectiune} -\setinterfacevariable{subsubsubsubsubsubsubsubsubject}{subsubsubsubsubsubsubsubsubiect} -\setinterfacevariable{subsubsubsubsubsubsubsubsubsection}{subsubsubsubsubsubsubsubsubsectiune} -\setinterfacevariable{subsubsubsubsubsubsubsubsubsubject}{subsubsubsubsubsubsubsubsubsubiect} -\setinterfacevariable{sunday}{duminica} -\setinterfacevariable{support}{suport} -\setinterfacevariable{sym}{sym} -\setinterfacevariable{symbol}{simbol} -\setinterfacevariable{synchronize}{synchronize} -\setinterfacevariable{system}{sistem} -\setinterfacevariable{table}{tabelul} -\setinterfacevariable{tablehead}{antettabel} -\setinterfacevariable{tables}{tabelele} -\setinterfacevariable{tabletail}{subsoltabel} -\setinterfacevariable{tabulate}{tabulate} -\setinterfacevariable{tabulatehead}{tabulatehead} -\setinterfacevariable{tabulatetail}{tabulatetail} -\setinterfacevariable{tall}{inalt} -\setinterfacevariable{teletype}{teletype} -\setinterfacevariable{temporary}{temporar} -\setinterfacevariable{test}{test} -\setinterfacevariable{text}{text} -\setinterfacevariable{three}{trei} -\setinterfacevariable{thursday}{joi} -\setinterfacevariable{title}{titlu} -\setinterfacevariable{toggle}{toggle} -\setinterfacevariable{tolerant}{tolerant} -\setinterfacevariable{top}{sus} -\setinterfacevariable{tuesday}{marti} -\setinterfacevariable{two}{doi} -\setinterfacevariable{txt}{txt} -\setinterfacevariable{type}{type} -\setinterfacevariable{typing}{typing} -\setinterfacevariable{unavailable}{nedisponibil} -\setinterfacevariable{underbar}{sublinie} -\setinterfacevariable{underbars}{sublinii} -\setinterfacevariable{unit}{unitate} -\setinterfacevariable{units}{unitati} -\setinterfacevariable{unknown}{necunoscut} -\setinterfacevariable{unpacked}{despachetat} -\setinterfacevariable{up}{up} -\setinterfacevariable{url}{url} -\setinterfacevariable{used}{folosit} -\setinterfacevariable{value}{valoare} -\setinterfacevariable{vertical}{vertical} -\setinterfacevariable{very}{foarte} -\setinterfacevariable{verystrict}{foartestrict} -\setinterfacevariable{verytolerant}{foartetolerant} -\setinterfacevariable{weak}{weak} -\setinterfacevariable{wednesday}{miercuri} -\setinterfacevariable{week}{saptamana} -\setinterfacevariable{weekday}{zisaptamana} -\setinterfacevariable{white}{alb} -\setinterfacevariable{wide}{larg} -\setinterfacevariable{width}{latime} -\setinterfacevariable{xml}{xml} -\setinterfacevariable{year}{an} -\setinterfacevariable{yes}{da} -% definitions for interface constants for language ro -% -\setinterfaceconstant{action}{actiune} -\setinterfaceconstant{address}{adresa} -\setinterfaceconstant{after}{dupa} -\setinterfaceconstant{afterhead}{dupatitlu} -\setinterfaceconstant{afterkey}{dupatasta} -\setinterfaceconstant{align}{aliniere} -\setinterfaceconstant{aligncharacter}{aliniazacaracter} -\setinterfaceconstant{alignmentcharacter}{alierecaracter} -\setinterfaceconstant{alignsymbol}{alignsymbol} -\setinterfaceconstant{aligntitle}{alinieretitlu} -\setinterfaceconstant{alternative}{alternativ} -\setinterfaceconstant{andtext}{andtext} -\setinterfaceconstant{apa}{apa} -\setinterfaceconstant{arrow}{sageata} -\setinterfaceconstant{artauthor}{artauthor} -\setinterfaceconstant{artauthoretaldisplay}{artauthoretaldisplay} -\setinterfaceconstant{artauthoretallimit}{artauthoretallimit} -\setinterfaceconstant{artauthoretaltext}{artauthoretaltext} -\setinterfaceconstant{at}{la} -\setinterfaceconstant{author}{autor} -\setinterfaceconstant{authoretaldisplay}{authoretaldisplay} -\setinterfaceconstant{authoretallimit}{authoretallimit} -\setinterfaceconstant{authoretaltext}{authoretaltext} -\setinterfaceconstant{auto}{auto} -\setinterfaceconstant{autofile}{autofile} -\setinterfaceconstant{autofocus}{autofocus} -\setinterfaceconstant{autohang}{autohang} -\setinterfaceconstant{autostrut}{autostrut} -\setinterfaceconstant{autowidth}{autolatime} -\setinterfaceconstant{axis}{axa} -\setinterfaceconstant{background}{fundal} -\setinterfaceconstant{backgroundcolor}{culoarefundal} -\setinterfaceconstant{backgroundcorner}{coltfundal} -\setinterfaceconstant{backgrounddepth}{adancimefundal} -\setinterfaceconstant{backgroundoffset}{offsetfundal} -\setinterfaceconstant{backgroundradius}{razafundal} -\setinterfaceconstant{backgroundscreen}{ecranfundal} -\setinterfaceconstant{backspace}{spatiuspate} -\setinterfaceconstant{balance}{balanta} -\setinterfaceconstant{before}{inainte} -\setinterfaceconstant{beforehead}{inaintetitlu} -\setinterfaceconstant{bet}{bet} -\setinterfaceconstant{big}{mare} -\setinterfaceconstant{blank}{blanc} -\setinterfaceconstant{blockway}{blockway} -\setinterfaceconstant{bodyfont}{fonttext} -\setinterfaceconstant{bookmark}{semncarte} -\setinterfaceconstant{bottom}{jos} -\setinterfaceconstant{bottomafter}{bottomafter} -\setinterfaceconstant{bottombefore}{bottombefore} -\setinterfaceconstant{bottomdistance}{distantajos} -\setinterfaceconstant{bottomframe}{framejos} -\setinterfaceconstant{bottomoffset}{offsetjos} -\setinterfaceconstant{bottomspace}{spatiujos} -\setinterfaceconstant{bottomstate}{starejos} -\setinterfaceconstant{cache}{cache} -\setinterfaceconstant{calculate}{calculeaza} -\setinterfaceconstant{ccommand}{comandac} -\setinterfaceconstant{click}{click} -\setinterfaceconstant{clickin}{clickintru} -\setinterfaceconstant{clickout}{clickies} -\setinterfaceconstant{clipoffset}{clipoffset} -\setinterfaceconstant{closeaction}{actiuneinchidere} -\setinterfaceconstant{closecommand}{closecommand} -\setinterfaceconstant{closepageaction}{actiuneinchiderepagina} -\setinterfaceconstant{closesymbol}{closesymbol} -\setinterfaceconstant{color}{culoare} -\setinterfaceconstant{column}{coloana} -\setinterfaceconstant{columndistance}{distantacoloane} -\setinterfaceconstant{columns}{coloane} -\setinterfaceconstant{command}{comanda} -\setinterfaceconstant{commandafter}{comandadupa} -\setinterfaceconstant{commandbefore}{comandainainte} -\setinterfaceconstant{commands}{comenzi} -\setinterfaceconstant{component}{component} -\setinterfaceconstant{compoundhyphen}{compoundhyphen} -\setinterfaceconstant{compress}{compress} -\setinterfaceconstant{connector}{connector} -\setinterfaceconstant{continue}{continua} -\setinterfaceconstant{contrastcolor}{culoarecontrast} -\setinterfaceconstant{controls}{controale} -\setinterfaceconstant{conversion}{conversie} -\setinterfaceconstant{convertfile}{convertestefisier} -\setinterfaceconstant{corner}{colt} -\setinterfaceconstant{coupling}{cuplare} -\setinterfaceconstant{couplingway}{modcuplare} -\setinterfaceconstant{criterium}{criteriu} -\setinterfaceconstant{current}{curent} -\setinterfaceconstant{cutspace}{cutspace} -\setinterfaceconstant{dash}{dash} -\setinterfaceconstant{dat}{dat} -\setinterfaceconstant{database}{database} -\setinterfaceconstant{date}{data} -\setinterfaceconstant{deepnumbercommand}{deepnumbercommand} -\setinterfaceconstant{deeptextcommand}{deeptextcommand} -\setinterfaceconstant{default}{implicit} -\setinterfaceconstant{delay}{intarziere} -\setinterfaceconstant{depth}{inaltime} -\setinterfaceconstant{depthcorrection}{corectieadancime} -\setinterfaceconstant{direction}{directie} -\setinterfaceconstant{directory}{director} -\setinterfaceconstant{display}{display} -\setinterfaceconstant{distance}{distanta} -\setinterfaceconstant{dot}{punct} -\setinterfaceconstant{doublesided}{douafete} -\setinterfaceconstant{dummy}{dummy} -\setinterfaceconstant{dx}{dx} -\setinterfaceconstant{dy}{dy} -\setinterfaceconstant{edge}{bordura} -\setinterfaceconstant{edgedistance}{distantabordura} -\setinterfaceconstant{editor}{editor} -\setinterfaceconstant{editoretaldisplay}{editoretaldisplay} -\setinterfaceconstant{editoretallimit}{editoretallimit} -\setinterfaceconstant{editoretaltext}{editoretaltext} -\setinterfaceconstant{empty}{gol} -\setinterfaceconstant{equalheight}{equalheight} -\setinterfaceconstant{equalwidth}{equalwidth} -\setinterfaceconstant{escape}{escape} -\setinterfaceconstant{evenmargin}{marginepara} -\setinterfaceconstant{expansion}{expansiune} -\setinterfaceconstant{export}{export} -\setinterfaceconstant{extras}{extras} -\setinterfaceconstant{factor}{factor} -\setinterfaceconstant{fallback}{fallback} -\setinterfaceconstant{family}{familie} -\setinterfaceconstant{fieldbackgroundcolor}{culoarefundalcamp} -\setinterfaceconstant{fieldframecolor}{culoareframecamp} -\setinterfaceconstant{fieldlayer}{fieldlayer} -\setinterfaceconstant{fieldoffset}{offsetcamp} -\setinterfaceconstant{file}{fisier} -\setinterfaceconstant{filtercommand}{filtercommand} -\setinterfaceconstant{finalnamesep}{finalnamesep} -\setinterfaceconstant{firstnamesep}{firstnamesep} -\setinterfaceconstant{focus}{focus} -\setinterfaceconstant{focusin}{focusin} -\setinterfaceconstant{focusout}{focusout} -\setinterfaceconstant{footer}{subsol} -\setinterfaceconstant{footerdistance}{distantasubsol} -\setinterfaceconstant{footerstate}{staresubsol} -\setinterfaceconstant{foregroundcolor}{foregroundcolor} -\setinterfaceconstant{foregroundstyle}{foregroundstyle} -\setinterfaceconstant{format}{format} -\setinterfaceconstant{frame}{frame} -\setinterfaceconstant{framecolor}{culoareframe} -\setinterfaceconstant{framecorner}{coltframe} -\setinterfaceconstant{framedepth}{adancimeframe} -\setinterfaceconstant{frameoffset}{offsetframe} -\setinterfaceconstant{frameradius}{razaframe} -\setinterfaceconstant{frames}{frames} -\setinterfaceconstant{from}{dela} -\setinterfaceconstant{get}{adu} -\setinterfaceconstant{global}{global} -\setinterfaceconstant{grid}{grid} -\setinterfaceconstant{hang}{suspenda} -\setinterfaceconstant{headalign}{headalign} -\setinterfaceconstant{headcolor}{culoaretitlu} -\setinterfaceconstant{headcommand}{headcommand} -\setinterfaceconstant{headconversion}{conversietitlu} -\setinterfaceconstant{header}{antet} -\setinterfaceconstant{headerdistance}{distantaantet} -\setinterfaceconstant{headerstate}{stareantet} -\setinterfaceconstant{headlabel}{etichetatitlu} -\setinterfaceconstant{headnumber}{numartitlu} -\setinterfaceconstant{headstyle}{stiltitlu} -\setinterfaceconstant{height}{inaltime} -\setinterfaceconstant{hfactor}{hfactor} -\setinterfaceconstant{hfil}{hfil} -\setinterfaceconstant{hidenumber}{hidenumber} -\setinterfaceconstant{hoffset}{hoffset} -\setinterfaceconstant{horoffset}{offsetoriz} -\setinterfaceconstant{hyphen}{hyphen} -\setinterfaceconstant{icommand}{comandai} -\setinterfaceconstant{in}{in} -\setinterfaceconstant{inbetween}{intre} -\setinterfaceconstant{increment}{increment} -\setinterfaceconstant{incrementnumber}{numarincrement} -\setinterfaceconstant{indenting}{aliniat} -\setinterfaceconstant{indentnext}{aliniaturmator} -\setinterfaceconstant{indicator}{indicator} -\setinterfaceconstant{inner}{intern} -\setinterfaceconstant{innermargin}{innermargin} -\setinterfaceconstant{inputfile}{inputfile} -\setinterfaceconstant{intent}{intent} -\setinterfaceconstant{interaction}{interactiune} -\setinterfaceconstant{interlinespace}{spatiereinterliniara} -\setinterfaceconstant{itemalign}{itemalign} -\setinterfaceconstant{items}{elemente} -\setinterfaceconstant{juniorsep}{juniorsep} -\setinterfaceconstant{ken}{ken} -\setinterfaceconstant{keyexpansion}{keyexpansion} -\setinterfaceconstant{keyword}{keyword} -\setinterfaceconstant{label}{eticheta} -\setinterfaceconstant{lastnamesep}{lastnamesep} -\setinterfaceconstant{lastpubsep}{lastpubsep} -\setinterfaceconstant{left}{stanga} -\setinterfaceconstant{leftcolor}{culoarestanga} -\setinterfaceconstant{leftcompoundhyphen}{leftcompoundhyphen} -\setinterfaceconstant{leftedge}{bordurastanga} -\setinterfaceconstant{leftedgedistance}{distantabordurastanga} -\setinterfaceconstant{leftframe}{framestanga} -\setinterfaceconstant{lefthyphen}{lefthyphen} -\setinterfaceconstant{leftmargin}{marginestanga} -\setinterfaceconstant{leftmargindistance}{distantamarginestanga} -\setinterfaceconstant{leftoffset}{offsetstanga} -\setinterfaceconstant{leftquotation}{citatstanga} -\setinterfaceconstant{leftquote}{minicitatstanga} -\setinterfaceconstant{leftsentence}{propozitiestanga} -\setinterfaceconstant{leftspeech}{leftspeech} -\setinterfaceconstant{leftstyle}{stilstanga} -\setinterfaceconstant{leftsubsentence}{subpropozitiestanga} -\setinterfaceconstant{lefttext}{textstanga} -\setinterfaceconstant{leftwidth}{latimestanga} -\setinterfaceconstant{level}{nivel} -\setinterfaceconstant{levels}{nivele} -\setinterfaceconstant{limittext}{limittext} -\setinterfaceconstant{line}{linie} -\setinterfaceconstant{linecorrection}{corectielinie} -\setinterfaceconstant{lines}{linii} -\setinterfaceconstant{list}{lista} -\setinterfaceconstant{listtext}{listtext} -\setinterfaceconstant{local}{local} -\setinterfaceconstant{location}{locatie} -\setinterfaceconstant{logo}{logo} -\setinterfaceconstant{logos}{logos} -\setinterfaceconstant{marcolor}{culoaremarcaj} -\setinterfaceconstant{margin}{margine} -\setinterfaceconstant{margindistance}{distantamargine} -\setinterfaceconstant{marginedge}{coltbordura} -\setinterfaceconstant{marginedgetext}{textcoltbordura} -\setinterfaceconstant{margintext}{textmargine} -\setinterfaceconstant{marking}{marcaje} -\setinterfaceconstant{marstyle}{stilmarcaj} -\setinterfaceconstant{max}{max} -\setinterfaceconstant{maxdepth}{maxdepth} -\setinterfaceconstant{maxheight}{inaltimemaxima} -\setinterfaceconstant{maxwidth}{latimemaxima} -\setinterfaceconstant{maybeyear}{maybeyear} -\setinterfaceconstant{menu}{meniu} -\setinterfaceconstant{method}{metoda} -\setinterfaceconstant{middle}{mijloc} -\setinterfaceconstant{middlespeech}{middlespeech} -\setinterfaceconstant{middletext}{textmijloc} -\setinterfaceconstant{midsentence}{midsentence} -\setinterfaceconstant{min}{min} -\setinterfaceconstant{mindepth}{mindepth} -\setinterfaceconstant{minheight}{inaltimeminima} -\setinterfaceconstant{minwidth}{latimeminima} -\setinterfaceconstant{monthconversion}{monthconversion} -\setinterfaceconstant{n}{n} -\setinterfaceconstant{name}{nume} -\setinterfaceconstant{namesep}{namesep} -\setinterfaceconstant{nbottom}{njos} -\setinterfaceconstant{nc}{nc} -\setinterfaceconstant{next}{urmatorul} -\setinterfaceconstant{nl}{nl} -\setinterfaceconstant{nleft}{nstanga} -\setinterfaceconstant{nlines}{nlinii} -\setinterfaceconstant{norm}{norm} -\setinterfaceconstant{nr}{nr} -\setinterfaceconstant{nright}{ndreapta} -\setinterfaceconstant{ntop}{nsus} -\setinterfaceconstant{number}{numar} -\setinterfaceconstant{numbercolor}{culoarenumar} -\setinterfaceconstant{numbercommand}{comandanumar} -\setinterfaceconstant{numberconversion}{numberconversion} -\setinterfaceconstant{numberconversionset}{numberconversionset} -\setinterfaceconstant{numberdistance}{numberdistance} -\setinterfaceconstant{numbering}{numerotare} -\setinterfaceconstant{numberorder}{numberorder} -\setinterfaceconstant{numberprefix}{numberprefix} -\setinterfaceconstant{numbersegments}{numbersegments} -\setinterfaceconstant{numberseparator}{separatornumar} -\setinterfaceconstant{numberseparatorset}{numberseparatorset} -\setinterfaceconstant{numberset}{numberset} -\setinterfaceconstant{numberstarter}{numberstarter} -\setinterfaceconstant{numberstopper}{numberstopper} -\setinterfaceconstant{numberstyle}{stilnumar} -\setinterfaceconstant{numberwidth}{numberwidth} -\setinterfaceconstant{nx}{nx} -\setinterfaceconstant{ny}{ny} -\setinterfaceconstant{object}{obiect} -\setinterfaceconstant{obstruction}{obstructie} -\setinterfaceconstant{oddmargin}{margineimpara} -\setinterfaceconstant{offset}{offset} -\setinterfaceconstant{openaction}{actiunedeschidere} -\setinterfaceconstant{openpageaction}{actiunedeschiderepagina} -\setinterfaceconstant{option}{optiune} -\setinterfaceconstant{order}{order} -\setinterfaceconstant{orientation}{orientation} -\setinterfaceconstant{otherstext}{otherstext} -\setinterfaceconstant{outermargin}{outermargin} -\setinterfaceconstant{overprint}{overprint} -\setinterfaceconstant{ownnumber}{numarpropriu} -\setinterfaceconstant{page}{pagina} -\setinterfaceconstant{pageboundaries}{marginipagina} -\setinterfaceconstant{pagecolor}{culoarepagina} -\setinterfaceconstant{pagecommand}{comandapagina} -\setinterfaceconstant{pageconversion}{pageconversion} -\setinterfaceconstant{pageconversionset}{pageconversionset} -\setinterfaceconstant{pagenumber}{numarpagina} -\setinterfaceconstant{pageprefix}{pageprefix} -\setinterfaceconstant{pageprefixconnector}{pageprefixconnector} -\setinterfaceconstant{pageprefixconversion}{pageprefixconversion} -\setinterfaceconstant{pageprefixconversionset}{pageprefixconversionset} -\setinterfaceconstant{pageprefixsegments}{pageprefixsegments} -\setinterfaceconstant{pageprefixseparatorset}{pageprefixseparatorset} -\setinterfaceconstant{pageprefixset}{pageprefixset} -\setinterfaceconstant{pageprefixstarter}{pageprefixstarter} -\setinterfaceconstant{pageprefixstopper}{pageprefixstopper} -\setinterfaceconstant{pagesegments}{pagesegments} -\setinterfaceconstant{pageseparatorset}{pageseparatorset} -\setinterfaceconstant{pageset}{pageset} -\setinterfaceconstant{pagestarter}{pagestarter} -\setinterfaceconstant{pagestate}{pagestate} -\setinterfaceconstant{pagestopper}{pagestopper} -\setinterfaceconstant{pagestyle}{stilpagina} -\setinterfaceconstant{palet}{paleta} -\setinterfaceconstant{paper}{hartie} -\setinterfaceconstant{paragraph}{paragraf} -\setinterfaceconstant{place}{pune} -\setinterfaceconstant{placehead}{punetitlu} -\setinterfaceconstant{placestopper}{punestopper} -\setinterfaceconstant{position}{pozitie} -\setinterfaceconstant{prefix}{prefix} -\setinterfaceconstant{prefixconnector}{prefixconnector} -\setinterfaceconstant{prefixconversion}{prefixconversion} -\setinterfaceconstant{prefixconversionset}{prefixconversionset} -\setinterfaceconstant{prefixsegments}{prefixsegments} -\setinterfaceconstant{prefixseparatorset}{prefixseparatorset} -\setinterfaceconstant{prefixset}{prefixset} -\setinterfaceconstant{prefixstarter}{prefixstarter} -\setinterfaceconstant{prefixstopper}{prefixstopper} -\setinterfaceconstant{preset}{preset} -\setinterfaceconstant{preview}{previzualizare} -\setinterfaceconstant{previous}{precendent} -\setinterfaceconstant{previousnumber}{numarprecedent} -\setinterfaceconstant{process}{process} -\setinterfaceconstant{pubsep}{pubsep} -\setinterfaceconstant{radius}{raza} -\setinterfaceconstant{random}{aleator} -\setinterfaceconstant{range}{range} -\setinterfaceconstant{reduction}{reducere} -\setinterfaceconstant{ref}{ref} -\setinterfaceconstant{refcommand}{refcommand} -\setinterfaceconstant{reference}{referinta} -\setinterfaceconstant{referenceprefix}{referenceprefix} -\setinterfaceconstant{referencing}{referinta} -\setinterfaceconstant{regionin}{regiuneintrare} -\setinterfaceconstant{regionout}{regiuneiesire} -\setinterfaceconstant{repeat}{repeta} -\setinterfaceconstant{reset}{reset} -\setinterfaceconstant{resetnumber}{resetnumber} -\setinterfaceconstant{resolution}{rezolutie} -\setinterfaceconstant{right}{dreapta} -\setinterfaceconstant{rightcolor}{culoaredreapta} -\setinterfaceconstant{rightcompoundhyphen}{rightcompoundhyphen} -\setinterfaceconstant{rightedge}{borduradreapta} -\setinterfaceconstant{rightedgedistance}{distantacoltdreapta} -\setinterfaceconstant{rightframe}{framedreapta} -\setinterfaceconstant{righthyphen}{righthyphen} -\setinterfaceconstant{rightmargin}{marginedreapta} -\setinterfaceconstant{rightmargindistance}{distantamarginedreapta} -\setinterfaceconstant{rightoffset}{offsetdreapta} -\setinterfaceconstant{rightquotation}{citatdreapta} -\setinterfaceconstant{rightquote}{minicitatdreapta} -\setinterfaceconstant{rightsentence}{propozitiedreapta} -\setinterfaceconstant{rightspeech}{rightspeech} -\setinterfaceconstant{rightstyle}{stildreapta} -\setinterfaceconstant{rightsubsentence}{subpropozitiedreapta} -\setinterfaceconstant{righttext}{textdreapta} -\setinterfaceconstant{rightwidth}{marginedreapta} -\setinterfaceconstant{rotation}{rotatie} -\setinterfaceconstant{rule}{rigla} -\setinterfaceconstant{rulecolor}{culoarerigla} -\setinterfaceconstant{rulethickness}{grosimerigla} -\setinterfaceconstant{samepage}{aceeasipagina} -\setinterfaceconstant{sample}{exemplu} -\setinterfaceconstant{samplesize}{samplesize} -\setinterfaceconstant{saveinlist}{saveinlist} -\setinterfaceconstant{scale}{scala} -\setinterfaceconstant{scope}{scop} -\setinterfaceconstant{screen}{ecran} -\setinterfaceconstant{section}{sectiune} -\setinterfaceconstant{sectionconversion}{sectionconversion} -\setinterfaceconstant{sectionconversionset}{sectionconversionset} -\setinterfaceconstant{sectionnumber}{numarsectiune} -\setinterfaceconstant{sectionresetset}{sectionresetset} -\setinterfaceconstant{sectionsegments}{sectionsegments} -\setinterfaceconstant{sectionseparatorset}{sectionseparatorset} -\setinterfaceconstant{sectionset}{sectionset} -\setinterfaceconstant{sectionstarter}{sectionstarter} -\setinterfaceconstant{sectionstopper}{sectionstopper} -\setinterfaceconstant{separator}{separator} -\setinterfaceconstant{set}{set} -\setinterfaceconstant{setups}{setups} -\setinterfaceconstant{side}{parte} -\setinterfaceconstant{sidealign}{sidealign} -\setinterfaceconstant{sidemethod}{sidemethod} -\setinterfaceconstant{sidespaceafter}{spatiulateraldupa} -\setinterfaceconstant{sidespacebefore}{spatiulateralinainte} -\setinterfaceconstant{sign}{semn} -\setinterfaceconstant{size}{dimensiune} -\setinterfaceconstant{small}{mic} -\setinterfaceconstant{sort}{sort} -\setinterfaceconstant{sorttype}{sorttype} -\setinterfaceconstant{source}{sursa} -\setinterfaceconstant{space}{spatiu} -\setinterfaceconstant{spaceafter}{spatiudupa} -\setinterfaceconstant{spacebefore}{spatiuinainte} -\setinterfaceconstant{spaceinbetween}{spaceinbetween} -\setinterfaceconstant{spacing}{spatiere} -\setinterfaceconstant{split}{split} -\setinterfaceconstant{splitcolor}{splitcolor} -\setinterfaceconstant{splitmethod}{splitmethod} -\setinterfaceconstant{splitoffset}{splitoffset} -\setinterfaceconstant{spot}{spot} -\setinterfaceconstant{stack}{stack} -\setinterfaceconstant{start}{start} -\setinterfaceconstant{starter}{starter} -\setinterfaceconstant{state}{stare} -\setinterfaceconstant{step}{pas} -\setinterfaceconstant{stop}{stop} -\setinterfaceconstant{stopper}{stopper} -\setinterfaceconstant{stretch}{dilatat} -\setinterfaceconstant{strip}{strip} -\setinterfaceconstant{strut}{strut} -\setinterfaceconstant{style}{stil} -\setinterfaceconstant{sub}{sub} -\setinterfaceconstant{subtitle}{subtitlu} -\setinterfaceconstant{suffix}{suffix} -\setinterfaceconstant{surnamesep}{surnamesep} -\setinterfaceconstant{sx}{sx} -\setinterfaceconstant{sy}{sy} -\setinterfaceconstant{symalign}{symaliniere} -\setinterfaceconstant{symbol}{simbol} -\setinterfaceconstant{symbolset}{setsimbol} -\setinterfaceconstant{symcolor}{culoaresimbol} -\setinterfaceconstant{symstyle}{stilsimbol} -\setinterfaceconstant{synonym}{sinonim} -\setinterfaceconstant{synonymcolor}{culoaresinonim} -\setinterfaceconstant{synonymcommand}{synonymcommand} -\setinterfaceconstant{synonymstyle}{stilsinonim} -\setinterfaceconstant{tab}{tab} -\setinterfaceconstant{text}{text} -\setinterfaceconstant{textcolor}{culoaretext} -\setinterfaceconstant{textcommand}{comandatext} -\setinterfaceconstant{textdistance}{textdistance} -\setinterfaceconstant{textlayer}{textlayer} -\setinterfaceconstant{textmargin}{textmargin} -\setinterfaceconstant{textmethod}{textmethod} -\setinterfaceconstant{textseparator}{separatortext} -\setinterfaceconstant{textsize}{dimensiunetext} -\setinterfaceconstant{textstate}{staretext} -\setinterfaceconstant{textstyle}{stiltext} -\setinterfaceconstant{textwidth}{latimetext} -\setinterfaceconstant{title}{titlu} -\setinterfaceconstant{titlecolor}{culoaretitlu} -\setinterfaceconstant{titlecommand}{titlecommand} -\setinterfaceconstant{titledistance}{distantatitlu} -\setinterfaceconstant{titleleft}{titleleft} -\setinterfaceconstant{titleright}{titleright} -\setinterfaceconstant{titlestyle}{stiltitlu} -\setinterfaceconstant{to}{catre} -\setinterfaceconstant{tolerance}{toleranta} -\setinterfaceconstant{top}{sus} -\setinterfaceconstant{topdistance}{distantasus} -\setinterfaceconstant{topframe}{framesus} -\setinterfaceconstant{topoffset}{offsetsus} -\setinterfaceconstant{topspace}{spatiusus} -\setinterfaceconstant{topstate}{staresus} -\setinterfaceconstant{totalnumber}{totalnumber} -\setinterfaceconstant{type}{type} -\setinterfaceconstant{unit}{unitate} -\setinterfaceconstant{unknownreference}{referintanecunoscuta} -\setinterfaceconstant{urlalternative}{urlalternativ} -\setinterfaceconstant{urlspace}{spatiuurl} -\setinterfaceconstant{validate}{verifica} -\setinterfaceconstant{vcommand}{comandav} -\setinterfaceconstant{veroffset}{veroffset} -\setinterfaceconstant{vfil}{vfil} -\setinterfaceconstant{voffset}{voffset} -\setinterfaceconstant{vonsep}{vonsep} -\setinterfaceconstant{way}{mod} -\setinterfaceconstant{wfactor}{factorw} -\setinterfaceconstant{white}{alb} -\setinterfaceconstant{width}{latime} -\setinterfaceconstant{xfactor}{xfactor} -\setinterfaceconstant{xmax}{xmax} -\setinterfaceconstant{xoffset}{xoffset} -\setinterfaceconstant{xscale}{xscala} -\setinterfaceconstant{xstep}{xstep} -\setinterfaceconstant{yfactor}{yfactor} -\setinterfaceconstant{ymax}{ymax} -\setinterfaceconstant{yoffset}{yoffset} -\setinterfaceconstant{yscale}{yscala} -\setinterfaceconstant{ystep}{ystep} -% definitions for interface elements for language ro -% -\setinterfaceelement{answerlines}{answerlines} -\setinterfaceelement{answerspace}{answerspace} -\setinterfaceelement{begin}{inceput} -\setinterfaceelement{complete}{complet} -\setinterfaceelement{coupled}{cuplat} -\setinterfaceelement{currentlocal}{localcurent} -\setinterfaceelement{emptyone}{gol} -\setinterfaceelement{emptytwo}{gol} -\setinterfaceelement{end}{sfarsit} -\setinterfaceelement{endsetup}{} -\setinterfaceelement{get}{get} -\setinterfaceelement{increment}{increment} -\setinterfaceelement{list}{lista} -\setinterfaceelement{listof}{listade} -\setinterfaceelement{load}{incarca} -\setinterfaceelement{local}{local} -\setinterfaceelement{makeup}{makeup} -\setinterfaceelement{next}{urmatorul} -\setinterfaceelement{place}{pune} -\setinterfaceelement{previous}{precedent} -\setinterfaceelement{previouslocal}{precedentlocal} -\setinterfaceelement{reserve}{rezervat} -\setinterfaceelement{see}{vezi} -\setinterfaceelement{setup}{setare} -\setinterfaceelement{start}{start} -\setinterfaceelement{stop}{stop} -\setinterfaceelement{text}{text} -\setinterfaceelement{type}{type} -% definitions for interface commands for language ro -% -\setinterfacecommand{CAPPED}{KAP} -\setinterfacecommand{Character}{Litera} -\setinterfacecommand{Characters}{Litere} -\setinterfacecommand{LABELTEXT}{TEXTETICHETA} -\setinterfacecommand{MONTH}{LUNA} -\setinterfacecommand{Numbers}{Numere} -\setinterfacecommand{Romannumerals}{Numereromane} -\setinterfacecommand{SmallCapped}{Kap} -\setinterfacecommand{SmallCaps}{Kaps} -\setinterfacecommand{WEEKDAY}{ZIDINSAPTAMANA} -\setinterfacecommand{WORD}{CUVANT} -\setinterfacecommand{WORDS}{CUVINTE} -\setinterfacecommand{Word}{Cuvant} -\setinterfacecommand{Words}{Cuvinte} -\setinterfacecommand{about}{despre} -\setinterfacecommand{adaptlayout}{adapteazaaspect} -\setinterfacecommand{arg}{arg} -\setinterfacecommand{at}{la} -\setinterfacecommand{atleftmargin}{atleftmargin} -\setinterfacecommand{atpage}{lapagina} -\setinterfacecommand{atrightmargin}{atrightmargin} -\setinterfacecommand{background}{fundal} -\setinterfacecommand{backspace}{spatiuspate} -\setinterfacecommand{blackrule}{linieneagra} -\setinterfacecommand{blackrules}{liniinegre} -\setinterfacecommand{blank}{blanc} -\setinterfacecommand{bookmark}{semncarte} -\setinterfacecommand{bottomdistance}{distantajos} -\setinterfacecommand{bottomheight}{inaltimejos} -\setinterfacecommand{bottomspace}{spatiujos} -\setinterfacecommand{but}{but} -\setinterfacecommand{button}{buton} -\setinterfacecommand{bypassblocks}{saripesteblocuri} -\setinterfacecommand{character}{litera} -\setinterfacecommand{characters}{litere} -\setinterfacecommand{chem}{chem} -\setinterfacecommand{clip}{clip} -\setinterfacecommand{clonefield}{cloneazacamp} -\setinterfacecommand{color}{culoare} -\setinterfacecommand{colorbar}{baraculoare} -\setinterfacecommand{colorvalue}{valoareculoare} -\setinterfacecommand{column}{coloana} -\setinterfacecommand{comment}{comentariu} -\setinterfacecommand{comparecolorgroup}{comparagrupculoare} -\setinterfacecommand{comparepalet}{comparapaleta} -\setinterfacecommand{completepagenumber}{completeazanumarpagina} -\setinterfacecommand{completeregister}{completeregister} -\setinterfacecommand{component}{componenta} -\setinterfacecommand{convertnumber}{convertestenumar} -\setinterfacecommand{copyfield}{copiazacamp} -\setinterfacecommand{correctwhitespace}{corecteazaspatiualb} -\setinterfacecommand{coupledocument}{cupleazadocument} -\setinterfacecommand{couplemarking}{cupleazamarcaje} -\setinterfacecommand{couplepage}{paginadubla} -\setinterfacecommand{couplepaper}{hartiedubla} -\setinterfacecommand{coupleregister}{cupleazaregistru} -\setinterfacecommand{crlf}{crlf} -\setinterfacecommand{currentdate}{datacurenta} -\setinterfacecommand{currentheadnumber}{numartitlucurent} -\setinterfacecommand{cutspace}{cutspace} -\setinterfacecommand{date}{data} -\setinterfacecommand{decouplemarking}{decupleazamarcaje} -\setinterfacecommand{decrementnumber}{decrementnumber} -\setinterfacecommand{define}{defineste} -\setinterfacecommand{defineaccent}{definesteaccent} -\setinterfacecommand{defineblank}{definesteblanc} -\setinterfacecommand{defineblock}{definestebloc} -\setinterfacecommand{definebodyfont}{definestefonttext} -\setinterfacecommand{definebodyfontenvironment}{definestemediulfonttext} -\setinterfacecommand{definebuffer}{definestebuffer} -\setinterfacecommand{definecharacter}{definestecaracter} -\setinterfacecommand{definecolor}{definesteculoare} -\setinterfacecommand{definecolorgroup}{definestegrupculori} -\setinterfacecommand{definecolumnbreak}{definecolumnbreak} -\setinterfacecommand{definecolumnset}{definecolumnset} -\setinterfacecommand{definecombination}{definecombination} -\setinterfacecommand{definecombinedlist}{definestelistacombinata} -\setinterfacecommand{definecommand}{definestecomanda} -\setinterfacecommand{defineconversion}{definesteconversie} -\setinterfacecommand{definedescription}{definestedescriere} -\setinterfacecommand{defineenumeration}{definesteenumerare} -\setinterfacecommand{definefield}{definestecamp} -\setinterfacecommand{definefieldstack}{definestestivacampuri} -\setinterfacecommand{definefiguresymbol}{definestesimbolfigura} -\setinterfacecommand{definefloat}{definestefloat} -\setinterfacecommand{definefont}{definestefont} -\setinterfacecommand{definefontstyle}{definestestilfont} -\setinterfacecommand{definefontsynonym}{definestesinonimfont} -\setinterfacecommand{defineframed}{definesteinconjurare} -\setinterfacecommand{defineframedtext}{definestetextinconjurat} -\setinterfacecommand{definehbox}{definestehbox} -\setinterfacecommand{definehead}{definesteantet} -\setinterfacecommand{defineindenting}{definestealiat} -\setinterfacecommand{defineinmargin}{defineinmargin} -\setinterfacecommand{defineinteractionmenu}{definestemeniuinteractiune} -\setinterfacecommand{defineitemgroup}{defineitemgroup} -\setinterfacecommand{definelabel}{definesteeticheta} -\setinterfacecommand{definelayer}{definelayer} -\setinterfacecommand{definelayout}{definelayout} -\setinterfacecommand{definelist}{definestelista} -\setinterfacecommand{definelogo}{definestelogo} -\setinterfacecommand{definemainfield}{definestecampprincipal} -\setinterfacecommand{definemakeup}{definestemakeup} -\setinterfacecommand{definemarking}{definestemarcaje} -\setinterfacecommand{definemathalignment}{definemathalignment} -\setinterfacecommand{defineoutput}{definesteoutput} -\setinterfacecommand{defineoverlay}{definesteoverlay} -\setinterfacecommand{definepagebreak}{definepagebreak} -\setinterfacecommand{definepalet}{definestepaleta} -\setinterfacecommand{definepapersize}{definestedimensiunehartie} -\setinterfacecommand{defineparagraphs}{definesteparagraf} -\setinterfacecommand{defineplacement}{defineplacement} -\setinterfacecommand{defineprofile}{definesteprofil} -\setinterfacecommand{defineprogram}{definesteprogram} -\setinterfacecommand{definerawfont}{definestefontraw} -\setinterfacecommand{definereference}{definestereferinte} -\setinterfacecommand{definereferenceformat}{definesteformatreferinte} -\setinterfacecommand{definereferencelist}{definestelistareferinte} -\setinterfacecommand{defineregister}{definesteregistru} -\setinterfacecommand{definerule}{definesterigla} -\setinterfacecommand{definesection}{definestesectiune} -\setinterfacecommand{definesectionblock}{definesteblocsectiune} -\setinterfacecommand{definesorting}{definestesortare} -\setinterfacecommand{definestartstop}{definestestartstop} -\setinterfacecommand{definestyle}{definestestil} -\setinterfacecommand{definesubfield}{definestesubcamp} -\setinterfacecommand{definesymbol}{definestesimbol} -\setinterfacecommand{definesynonyms}{definestesinonim} -\setinterfacecommand{definetabletemplate}{definestesablontabel} -\setinterfacecommand{definetabulate}{definestetabulatori} -\setinterfacecommand{definetext}{definestetext} -\setinterfacecommand{definetextposition}{definestepozitietext} -\setinterfacecommand{definetextvariable}{definestevariabilatext} -\setinterfacecommand{definetype}{definetype} -\setinterfacecommand{definetyping}{definestetyping} -\setinterfacecommand{defineversion}{definesteversiune} -\setinterfacecommand{determineheadnumber}{determinanumartitlu} -\setinterfacecommand{determinelistcharacteristics}{determinacaracteristicilelistei} -\setinterfacecommand{determineregistercharacteristics}{determinacaracteristiciregistru} -\setinterfacecommand{dimension}{dimensiune} -\setinterfacecommand{disableinteractionmenu}{dezactiveazameniuinteractiune} -\setinterfacecommand{domicile}{domiciliu} -\setinterfacecommand{donttest}{nutesta} -\setinterfacecommand{edgedistance}{distantacolt} -\setinterfacecommand{edgewidth}{latimecolturi} -\setinterfacecommand{emptylines}{emptylines} -\setinterfacecommand{environment}{mediu} -\setinterfacecommand{externalfigure}{figuraexterna} -\setinterfacecommand{fact}{fact} -\setinterfacecommand{field}{camp} -\setinterfacecommand{fieldstack}{stivacampuri} -\setinterfacecommand{fillinfield}{campumplere} -\setinterfacecommand{fillinline}{linieumplere} -\setinterfacecommand{fillinrules}{rigleumplere} -\setinterfacecommand{fillintext}{textumplere} -\setinterfacecommand{fitfield}{potrivestecamp} -\setinterfacecommand{fixedspace}{spatiufixat} -\setinterfacecommand{fixedspaces}{spatiifixate} -\setinterfacecommand{followprofile}{urmeazaprofil} -\setinterfacecommand{followprofileversion}{urmeazaversiuneprofil} -\setinterfacecommand{followversion}{urmeazaversiune} -\setinterfacecommand{footerdistance}{distantasubsol} -\setinterfacecommand{footerheight}{inaltimesubsol} -\setinterfacecommand{footnote}{notasubsol} -\setinterfacecommand{footnotetext}{footnotetext} -\setinterfacecommand{forceblocks}{forteazablocuri} -\setinterfacecommand{formulanumber}{numarformula} -\setinterfacecommand{fraction}{fractie} -\setinterfacecommand{framed}{framed} -\setinterfacecommand{from}{din} -\setinterfacecommand{getbuffer}{adubuffer} -\setinterfacecommand{getmarking}{adumarcaje} -\setinterfacecommand{getnumber}{getnumber} -\setinterfacecommand{godown}{injos} -\setinterfacecommand{goto}{dute} -\setinterfacecommand{gotobox}{dutebox} -\setinterfacecommand{gotopage}{dutepagina} -\setinterfacecommand{graycolor}{culoaregri} -\setinterfacecommand{greyvalue}{valoaregri} -\setinterfacecommand{grid}{grid} -\setinterfacecommand{hairline}{firdepar} -\setinterfacecommand{head}{titlu} -\setinterfacecommand{headerdistance}{distantaantet} -\setinterfacecommand{headerheight}{inaltimeantet} -\setinterfacecommand{headlevel}{niveltitlu} -\setinterfacecommand{headnumber}{numartitlu} -\setinterfacecommand{headsym}{headsym} -\setinterfacecommand{headtext}{texttitlu} -\setinterfacecommand{hideblocks}{ascundeblocuri} -\setinterfacecommand{high}{inalt} -\setinterfacecommand{hl}{hl} -\setinterfacecommand{immediatebetweenlist}{immediatebetweenlist} -\setinterfacecommand{immediatetolist}{immediatetolist} -\setinterfacecommand{in}{in} -\setinterfacecommand{incrementnumber}{numarincrement} -\setinterfacecommand{indenting}{aliniat} -\setinterfacecommand{inframed}{inframed} -\setinterfacecommand{infull}{pelung} -\setinterfacecommand{ininner}{ininner} -\setinterfacecommand{inleft}{instanga} -\setinterfacecommand{inleftedge}{inparteastanga} -\setinterfacecommand{inleftmargin}{inmargineastanga} -\setinterfacecommand{inline}{inlinie} -\setinterfacecommand{inmargin}{marginal} -\setinterfacecommand{inmframed}{inmaframed} -\setinterfacecommand{inneredgedistance}{inneredgedistance} -\setinterfacecommand{inneredgewidth}{inneredgewidth} -\setinterfacecommand{innermargindistance}{innermargindistance} -\setinterfacecommand{innermarginwidth}{innermarginwidth} -\setinterfacecommand{inothermargin}{inaltamargine} -\setinterfacecommand{inouter}{inouter} -\setinterfacecommand{inright}{indreapta} -\setinterfacecommand{inrightedge}{inparteadreapta} -\setinterfacecommand{inrightmargin}{inmargineadreapta} -\setinterfacecommand{installlanguage}{instalarelimba} -\setinterfacecommand{interactionbar}{barainteractiune} -\setinterfacecommand{interactionbuttons}{butoaneinteractiune} -\setinterfacecommand{interactionmenu}{meniuinteractiune} -\setinterfacecommand{item}{element} -\setinterfacecommand{items}{element} -\setinterfacecommand{its}{el} -\setinterfacecommand{keepblocks}{pastreazablocuri} -\setinterfacecommand{label}{eticheta} -\setinterfacecommand{labels}{etichete} -\setinterfacecommand{labeltext}{texteticheta} -\setinterfacecommand{language}{limba} -\setinterfacecommand{leftaligned}{aliniatstanga} -\setinterfacecommand{leftedgedistance}{distantacoltstanga} -\setinterfacecommand{leftedgewidth}{latimecoltstanga} -\setinterfacecommand{leftmargindistance}{distantamarginestanga} -\setinterfacecommand{leftmarginwidth}{latimemarginestanga} -\setinterfacecommand{leg}{leg} -\setinterfacecommand{linewidth}{grosimelinie} -\setinterfacecommand{listheight}{inaltimelista} -\setinterfacecommand{listlength}{lungimelista} -\setinterfacecommand{listsymbol}{listsymbol} -\setinterfacecommand{listwidth}{latimelista} -\setinterfacecommand{logfields}{logcampuri} -\setinterfacecommand{lohi}{jossus} -\setinterfacecommand{low}{jos} -\setinterfacecommand{macroname}{nume} -\setinterfacecommand{mainlanguage}{limbaprincipala} -\setinterfacecommand{makeupheight}{inaltimemakeup} -\setinterfacecommand{makeupwidth}{latimemakeup} -\setinterfacecommand{mar}{mar} -\setinterfacecommand{margindistance}{distantamargine} -\setinterfacecommand{marginrule}{liniemargine} -\setinterfacecommand{margintext}{textmarginal} -\setinterfacecommand{margintitle}{titlumarginal} -\setinterfacecommand{marginwidth}{latimemargine} -\setinterfacecommand{marginword}{cuvantmarginal} -\setinterfacecommand{marking}{marcaje} -\setinterfacecommand{markversion}{marcheazaversiune} -\setinterfacecommand{mathematics}{matematica} -\setinterfacecommand{menubutton}{butonmeniu} -\setinterfacecommand{mframed}{maframed} -\setinterfacecommand{midaligned}{aliniatcentru} -\setinterfacecommand{mirror}{reflexie} -\setinterfacecommand{month}{luna} -\setinterfacecommand{moveformula}{moveformula} -\setinterfacecommand{moveongrid}{mutapegrid} -\setinterfacecommand{movesidefloat}{movesidefloat} -\setinterfacecommand{navigating}{navigating} -\setinterfacecommand{nodimension}{faradimensiune} -\setinterfacecommand{noheaderandfooterlines}{faraliniiantetsisubsol} -\setinterfacecommand{noindenting}{faraaliniat} -\setinterfacecommand{nolist}{faralista} -\setinterfacecommand{nomarking}{faramarcaje} -\setinterfacecommand{nomoreblocks}{gatablocuri} -\setinterfacecommand{nomorefiles}{farafisiere} -\setinterfacecommand{nop}{nop} -\setinterfacecommand{nospace}{faraspatiu} -\setinterfacecommand{note}{nota} -\setinterfacecommand{notopandbottomlines}{faraliniisussijos} -\setinterfacecommand{notsmallcapped}{nokap} -\setinterfacecommand{nowhitespace}{faraspatiualb} -\setinterfacecommand{numberofsubpages}{numberofsubpages} -\setinterfacecommand{numbers}{numere} -\setinterfacecommand{outeredgedistance}{outeredgedistance} -\setinterfacecommand{outeredgewidth}{outeredgewidth} -\setinterfacecommand{outermargindistance}{outermargindistance} -\setinterfacecommand{outermarginwidth}{outermarginwidth} -\setinterfacecommand{packed}{impachetat} -\setinterfacecommand{page}{pagina} -\setinterfacecommand{pagedepth}{pagedepth} -\setinterfacecommand{pagenumber}{numarpagina} -\setinterfacecommand{pageoffset}{pageoffset} -\setinterfacecommand{pagereference}{referintapagina} -\setinterfacecommand{pagetype}{tippagina} -\setinterfacecommand{paperheight}{inaltimehartie} -\setinterfacecommand{paperwidth}{latimehartie} -\setinterfacecommand{periods}{puncte} -\setinterfacecommand{plaatsruwelijst}{placerawlist} -\setinterfacecommand{placebookmarks}{plaseazasemnecarte} -\setinterfacecommand{placecombinedlist}{punelistacombinata} -\setinterfacecommand{placefloat}{placefloat} -\setinterfacecommand{placefootnotes}{punenotesubsol} -\setinterfacecommand{placeformula}{puneformula} -\setinterfacecommand{placeheadnumber}{placeheadnumber} -\setinterfacecommand{placeheadtext}{placeheadtext} -\setinterfacecommand{placelegend}{punelegenda} -\setinterfacecommand{placelist}{punelista} -\setinterfacecommand{placelocalfootnotes}{punenotesubsollocale} -\setinterfacecommand{placelogos}{punelogouri} -\setinterfacecommand{placeongrid}{plaseazapegrid} -\setinterfacecommand{placeontopofeachother}{punedeasuprafiecareia} -\setinterfacecommand{placepagenumber}{punenumarpagina} -\setinterfacecommand{placereferencelist}{placereferencelist} -\setinterfacecommand{placeregister}{puneregistru} -\setinterfacecommand{placerule}{punerigla} -\setinterfacecommand{placesidebyside}{punefatainfata} -\setinterfacecommand{placesubformula}{punesubformula} -\setinterfacecommand{placetextvariable}{punevariabilatext} -\setinterfacecommand{position}{pozitie} -\setinterfacecommand{positiontext}{pozitietext} -\setinterfacecommand{printpaperheight}{inaltimehartieimprimanta} -\setinterfacecommand{printpaperwidth}{latimehartieimprimanta} -\setinterfacecommand{processblocks}{proceseazabloc} -\setinterfacecommand{processpage}{proceseazapagina} -\setinterfacecommand{product}{produs} -\setinterfacecommand{program}{program} -\setinterfacecommand{project}{proiect} -\setinterfacecommand{publication}{publicatie} -\setinterfacecommand{quotation}{citat} -\setinterfacecommand{quote}{minicitat} -\setinterfacecommand{ran}{ran} -\setinterfacecommand{redo}{refa} -\setinterfacecommand{ref}{ref} -\setinterfacecommand{reference}{referinta} -\setinterfacecommand{referral}{referit} -\setinterfacecommand{referraldate}{datareferit} -\setinterfacecommand{referring}{referring} -\setinterfacecommand{remark}{remarca} -\setinterfacecommand{reset}{reset} -\setinterfacecommand{resetmarking}{reseteazamarcaje} -\setinterfacecommand{resetnumber}{resetnumber} -\setinterfacecommand{resettext}{resettextcontent} -\setinterfacecommand{rightaligned}{aliniatdreapta} -\setinterfacecommand{rightedgedistance}{distantacoltdreapta} -\setinterfacecommand{rightedgewidth}{latimecoltdreapta} -\setinterfacecommand{rightmargindistance}{distantamarginedreapta} -\setinterfacecommand{rightmarginwidth}{latimemarginedreapta} -\setinterfacecommand{romannumerals}{numereromane} -\setinterfacecommand{rotate}{roteste} -\setinterfacecommand{scale}{scala} -\setinterfacecommand{screen}{ecran} -\setinterfacecommand{selectblocks}{selecteazablocuri} -\setinterfacecommand{selectpaper}{selecteazahartie} -\setinterfacecommand{selectversion}{selecteazaversiune} -\setinterfacecommand{setnumber}{setnumber} -\setinterfacecommand{settextcontent}{settextcontent} -\setinterfacecommand{settextvariable}{setvariabilatext} -\setinterfacecommand{setupalign}{seteazaalinierea} -\setinterfacecommand{setupanswerarea}{setupanswerarea} -\setinterfacecommand{setuparranging}{seteazaaranjareapag} -\setinterfacecommand{setupbackground}{seteazafundal} -\setinterfacecommand{setupbackgrounds}{seteazafundaluri} -\setinterfacecommand{setupblackrules}{seteazaliniinegre} -\setinterfacecommand{setupblank}{seteazablanc} -\setinterfacecommand{setupblock}{seteazabloc} -\setinterfacecommand{setupbodyfont}{seteazafonttext} -\setinterfacecommand{setupbodyfontenvironment}{seteazamediulfonttext} -\setinterfacecommand{setupbottom}{seteazajos} -\setinterfacecommand{setupbottomtexts}{seteazatextejos} -\setinterfacecommand{setupbuffer}{seteazabuffer} -\setinterfacecommand{setupbuttons}{seteazabutoane} -\setinterfacecommand{setupcapitals}{seteazamajuscule} -\setinterfacecommand{setupcaption}{seteazalegenda} -\setinterfacecommand{setupcaptions}{seteazalegendele} -\setinterfacecommand{setupclipping}{seteazaclipping} -\setinterfacecommand{setupcolor}{seteazaculoare} -\setinterfacecommand{setupcolors}{seteazaculori} -\setinterfacecommand{setupcolumns}{seteazacoloane} -\setinterfacecommand{setupcolumnset}{setupcolumnset} -\setinterfacecommand{setupcolumnsetlines}{setupcolumnsetlines} -\setinterfacecommand{setupcolumnsetstart}{setupcolumnsetstart} -\setinterfacecommand{setupcombinations}{seteazacombinari} -\setinterfacecommand{setupcombinedlist}{seteazalistacombinata} -\setinterfacecommand{setupcomment}{seteazacomentariu} -\setinterfacecommand{setupdescriptions}{seteazadescriere} -\setinterfacecommand{setupenumerations}{seteazaenumerare} -\setinterfacecommand{setupexternalfigures}{seteazafiguriexterne} -\setinterfacecommand{setupfield}{seteazacamp} -\setinterfacecommand{setupfields}{seteazacampuri} -\setinterfacecommand{setupfillinlines}{seteazaliniiumplere} -\setinterfacecommand{setupfillinrules}{seteazarigleumplere} -\setinterfacecommand{setupfloat}{seteazafloat} -\setinterfacecommand{setupfloats}{seteazafloats} -\setinterfacecommand{setupfloatsplitting}{seteazaimpartireafloat} -\setinterfacecommand{setupfooter}{seteazasubsol} -\setinterfacecommand{setupfootertexts}{seteazatextesubsol} -\setinterfacecommand{setupfootnotedefinition}{seteazadefinireanotasubsol} -\setinterfacecommand{setupfootnotes}{seteazanotasubsol} -\setinterfacecommand{setupforms}{seteazaformulare} -\setinterfacecommand{setupformulas}{seteazaformule} -\setinterfacecommand{setupframed}{seteazainconjurat} -\setinterfacecommand{setupframedtexts}{definestetexteinconjurate} -\setinterfacecommand{setuphead}{seteazatitlu} -\setinterfacecommand{setupheader}{seteazaantet} -\setinterfacecommand{setupheadertexts}{seteazatexteantet} -\setinterfacecommand{setupheadnumber}{seteazanumartitlu} -\setinterfacecommand{setupheads}{seteazatitluri} -\setinterfacecommand{setupheadtext}{seteazatexttitlu} -\setinterfacecommand{setuphyphenmark}{seteazaliniesilabe} -\setinterfacecommand{setupindentations}{seteazaaliniate} -\setinterfacecommand{setupindenting}{seteazaaliniat} -\setinterfacecommand{setupinmargin}{seteazamarginal} -\setinterfacecommand{setupinteraction}{seteazainteractiunea} -\setinterfacecommand{setupinteractionbar}{seteazabarainteractiune} -\setinterfacecommand{setupinteractionmenu}{seteazameniuinteractiune} -\setinterfacecommand{setupinteractionscreen}{seteazaecraninteractiune} -\setinterfacecommand{setupinterlinespace}{seteazaspatiuinterliniar} -\setinterfacecommand{setupitemgroup}{setupitemgroup} -\setinterfacecommand{setupitemgroups}{setareitemization} -\setinterfacecommand{setupitems}{seteazaelemente} -\setinterfacecommand{setuplabeltext}{seteazatexteticheta} -\setinterfacecommand{setuplanguage}{setarelimba} -\setinterfacecommand{setuplayout}{seteazaaspect} -\setinterfacecommand{setuplegend}{seteazalegenda} -\setinterfacecommand{setuplinenumbering}{seteazanumerotarelinii} -\setinterfacecommand{setuplines}{seteazalinii} -\setinterfacecommand{setuplinewidth}{seteazagrosimelinie} -\setinterfacecommand{setuplist}{seteazalista} -\setinterfacecommand{setupmakeup}{seteazamakeup} -\setinterfacecommand{setupmarginblocks}{seteazablocurimarginale} -\setinterfacecommand{setupmarginrules}{seteazaliniimargine} -\setinterfacecommand{setupmarking}{seteazamarcaje} -\setinterfacecommand{setupmathalignment}{setupmathalignment} -\setinterfacecommand{setupnarrower}{seteazaingust} -\setinterfacecommand{setupnumber}{setupnumber} -\setinterfacecommand{setupnumbering}{seteazanumerotare} -\setinterfacecommand{setupoppositeplacing}{seteazaplasareaopozita} -\setinterfacecommand{setupoutput}{setareoutput} -\setinterfacecommand{setuppagecomment}{seteazacomentariupagina} -\setinterfacecommand{setuppagenumber}{seteazanumarpagina} -\setinterfacecommand{setuppagenumbering}{seteazanumerotarepagina} -\setinterfacecommand{setuppagetransitions}{seteazatranzitiepagina} -\setinterfacecommand{setuppalet}{seteazapaleta} -\setinterfacecommand{setuppaper}{setuppaper} -\setinterfacecommand{setuppapersize}{seteazadimensiunihartie} -\setinterfacecommand{setupparagraphnumbering}{seteazanumerotareparagrafe} -\setinterfacecommand{setupparagraphs}{seteazaparagrafe} -\setinterfacecommand{setupplacement}{setupplacement} -\setinterfacecommand{setuppositioning}{setarepozitie} -\setinterfacecommand{setupprofiles}{seteazaprofile} -\setinterfacecommand{setupprograms}{seteazaprograme} -\setinterfacecommand{setuppublications}{seteazapublicatii} -\setinterfacecommand{setupquote}{seteazaminicitat} -\setinterfacecommand{setupreferencelist}{seteazalistareferinte} -\setinterfacecommand{setupreferencing}{seteazareferinte} -\setinterfacecommand{setupregister}{seteazaregistru} -\setinterfacecommand{setuprotate}{seteazarotare} -\setinterfacecommand{setuprule}{seteazarigla} -\setinterfacecommand{setups}{setari} -\setinterfacecommand{setupscreens}{seteazaecrane} -\setinterfacecommand{setupsection}{seteazasectiune} -\setinterfacecommand{setupsectionblock}{seteazablocsectiune} -\setinterfacecommand{setupsorting}{seteazasortare} -\setinterfacecommand{setupspacing}{seteazaspatiu} -\setinterfacecommand{setupstartstop}{setupstartstop} -\setinterfacecommand{setupstrut}{seteazastrut} -\setinterfacecommand{setupsubpagenumber}{seteazanumarsubpagina} -\setinterfacecommand{setupsymbolset}{seteazasimbol} -\setinterfacecommand{setupsynchronization}{setaresincronizare} -\setinterfacecommand{setupsynchronizationbar}{setarebarasincronizare} -\setinterfacecommand{setupsynonyms}{seteazasinonime} -\setinterfacecommand{setupsystem}{seteazasistem} -\setinterfacecommand{setuptab}{seteazatab} -\setinterfacecommand{setuptables}{seteazatabele} -\setinterfacecommand{setuptabulate}{seteazatabulatori} -\setinterfacecommand{setuptext}{seteazatext} -\setinterfacecommand{setuptextposition}{seteazapozitietext} -\setinterfacecommand{setuptextrules}{seteazarigletext} -\setinterfacecommand{setuptexttexts}{seteazatextetext} -\setinterfacecommand{setuptextvariable}{seteazavariabilatext} -\setinterfacecommand{setupthinrules}{seteazaliniesubtire} -\setinterfacecommand{setuptolerance}{seteazatoleranta} -\setinterfacecommand{setuptop}{seteazasus} -\setinterfacecommand{setuptoptexts}{seteazatextesus} -\setinterfacecommand{setuptype}{seteazatype} -\setinterfacecommand{setuptyping}{seteazatyping} -\setinterfacecommand{setupunderbar}{seteazasublinie} -\setinterfacecommand{setupurl}{seteazaurl} -\setinterfacecommand{setupversions}{seteazaversiuni} -\setinterfacecommand{setupwhitespace}{seteazaspatiualb} -\setinterfacecommand{showbodyfont}{afiseazafonttext} -\setinterfacecommand{showbodyfontenvironment}{afiseazamediufonttext} -\setinterfacecommand{showcolor}{afiseazaculoare} -\setinterfacecommand{showcolorgroup}{afiseazagrupculoare} -\setinterfacecommand{showexternalfigures}{afiseazafiguriexterne} -\setinterfacecommand{showfields}{afiseazacampuri} -\setinterfacecommand{showframe}{afiseazarama} -\setinterfacecommand{showgrid}{afiseazagrid} -\setinterfacecommand{showlayout}{afiseazaaspect} -\setinterfacecommand{showmakeup}{afiseazamakeup} -\setinterfacecommand{showpalet}{afiseazapaleta} -\setinterfacecommand{showprint}{afiseazatiparire} -\setinterfacecommand{showsetups}{afiseazasetari} -\setinterfacecommand{showstruts}{afiseazastruts} -\setinterfacecommand{showsymbolset}{afiseazasetsimboluri} -\setinterfacecommand{smallcapped}{kap} -\setinterfacecommand{someline}{olinie} -\setinterfacecommand{somewhere}{undeva} -\setinterfacecommand{space}{spatiu} -\setinterfacecommand{splitfloat}{impartefloat} -\setinterfacecommand{startalignment}{startaliniere} -\setinterfacecommand{startbackground}{startfundal} -\setinterfacecommand{startcoding}{startcodificare} -\setinterfacecommand{startcolor}{startculoare} -\setinterfacecommand{startcolumnmakeup}{startcolumnmakeup} -\setinterfacecommand{startcolumns}{startcoloane} -\setinterfacecommand{startcolumnset}{startcolumnset} -\setinterfacecommand{startcombination}{startcombinare} -\setinterfacecommand{startcomponent}{startcomponenta} -\setinterfacecommand{startdocument}{startdocument} -\setinterfacecommand{startenvironment}{startmediu} -\setinterfacecommand{startfigure}{startfigura} -\setinterfacecommand{startglobal}{startglobal} -\setinterfacecommand{startline}{startlinie} -\setinterfacecommand{startlinecorrection}{startcorectielinie} -\setinterfacecommand{startlinenumbering}{startnumerotarelinii} -\setinterfacecommand{startlines}{startlinii} -\setinterfacecommand{startlocal}{startlocal} -\setinterfacecommand{startlocalfootnotes}{startnotesubsollocale} -\setinterfacecommand{startmakeup}{startmakeup} -\setinterfacecommand{startmarginblock}{startblocmarginal} -\setinterfacecommand{startmarginrule}{startliniemargine} -\setinterfacecommand{startnarrower}{startingust} -\setinterfacecommand{startopposite}{startopozit} -\setinterfacecommand{startoverlay}{startoverlay} -\setinterfacecommand{startoverzicht}{startoverview} -\setinterfacecommand{startpacked}{startimpachetat} -\setinterfacecommand{startpositioning}{startpozitionare} -\setinterfacecommand{startproduct}{startprodus} -\setinterfacecommand{startprofile}{startprofil} -\setinterfacecommand{startproject}{startproiect} -\setinterfacecommand{startquotation}{startcitat} -\setinterfacecommand{startraster}{startraster} -\setinterfacecommand{startsymbolset}{startsetsimboluri} -\setinterfacecommand{startsynchronization}{startsincronizare} -\setinterfacecommand{starttable}{starttabel} -\setinterfacecommand{starttables}{starttabele} -\setinterfacecommand{starttext}{starttext} -\setinterfacecommand{starttextrule}{startriglatext} -\setinterfacecommand{startunpacked}{startneimpachetat} -\setinterfacecommand{startversion}{startversiune} -\setinterfacecommand{stopalignment}{stopaliniere} -\setinterfacecommand{stopbackground}{stopfundal} -\setinterfacecommand{stopcoding}{stopcodificare} -\setinterfacecommand{stopcolor}{stopculoare} -\setinterfacecommand{stopcolumnmakeup}{stopcolumnmakeup} -\setinterfacecommand{stopcolumns}{stopcoloane} -\setinterfacecommand{stopcolumnset}{stopcolumnset} -\setinterfacecommand{stopcombination}{stopcombinare} -\setinterfacecommand{stopcomponent}{stopcomponenta} -\setinterfacecommand{stopdocument}{stopdocument} -\setinterfacecommand{stopenvironment}{stopmediu} -\setinterfacecommand{stopglobal}{stopblobal} -\setinterfacecommand{stopline}{stoplinie} -\setinterfacecommand{stoplinecorrection}{stopcorectielinie} -\setinterfacecommand{stoplinenumbering}{stopnumerotarelinii} -\setinterfacecommand{stoplines}{stoplinii} -\setinterfacecommand{stoplocal}{stoplocal} -\setinterfacecommand{stoplocalfootnotes}{stopnotesubsollocale} -\setinterfacecommand{stopmakeup}{stopmakeup} -\setinterfacecommand{stopmarginblock}{stopblocmarginal} -\setinterfacecommand{stopmarginrule}{stopliniemargine} -\setinterfacecommand{stopnarrower}{stopingust} -\setinterfacecommand{stopopposite}{stopopozit} -\setinterfacecommand{stopoverlay}{stopoverlay} -\setinterfacecommand{stopoverzicht}{stopoverview} -\setinterfacecommand{stoppacked}{stopimpachetat} -\setinterfacecommand{stoppositioning}{stoppozitionare} -\setinterfacecommand{stopproduct}{stopprodus} -\setinterfacecommand{stopprofile}{stopprofil} -\setinterfacecommand{stopproject}{stopproiect} -\setinterfacecommand{stopquotation}{stopcitat} -\setinterfacecommand{stopraster}{stopraster} -\setinterfacecommand{stopsynchronization}{stopsincronizare} -\setinterfacecommand{stoptable}{stoptabel} -\setinterfacecommand{stoptables}{stoptabele} -\setinterfacecommand{stoptext}{stoptext} -\setinterfacecommand{stoptextrule}{stopriglatext} -\setinterfacecommand{stopunpacked}{stopneimpachetat} -\setinterfacecommand{stopversion}{stopversiune} -\setinterfacecommand{stretched}{intins} -\setinterfacecommand{subformulanumber}{numarsubformula} -\setinterfacecommand{subpagenumber}{subpagenumber} -\setinterfacecommand{switchtobodyfont}{trecilafonttext} -\setinterfacecommand{switchtorawfont}{trecilafontraw} -\setinterfacecommand{sym}{sim} -\setinterfacecommand{symbol}{simbol} -\setinterfacecommand{synchronizationbar}{barasincronizare} -\setinterfacecommand{synchronize}{sincronizeaza} -\setinterfacecommand{tab}{tab} -\setinterfacecommand{testcolumn}{testcolumn} -\setinterfacecommand{testpage}{testpage} -\setinterfacecommand{tex}{tex} -\setinterfacecommand{textheight}{inaltimetext} -\setinterfacecommand{textreference}{referintatext} -\setinterfacecommand{textrule}{riglatext} -\setinterfacecommand{textvariable}{variabilatext} -\setinterfacecommand{textwidth}{latimetext} -\setinterfacecommand{thinrule}{liniesubtire} -\setinterfacecommand{thinrules}{liniisubtiri} -\setinterfacecommand{tooltip}{tooltip} -\setinterfacecommand{topdistance}{distantasus} -\setinterfacecommand{topheight}{inaltimesus} -\setinterfacecommand{topspace}{spatiusus} -\setinterfacecommand{totalnumberofpages}{numartotalpagini} -\setinterfacecommand{translate}{traduce} -\setinterfacecommand{txt}{txt} -\setinterfacecommand{typ}{typ} -\setinterfacecommand{type}{type} -\setinterfacecommand{typebuffer}{scriebuffer} -\setinterfacecommand{typefile}{typefile} -\setinterfacecommand{unitmeaning}{numeunitate} -\setinterfacecommand{unknown}{necunoscut} -\setinterfacecommand{useJSscripts}{folosestescriptJS} -\setinterfacecommand{useURL}{folosesteURL} -\setinterfacecommand{useXMLfilter}{useXMLfilter} -\setinterfacecommand{useblocks}{folosestebloc} -\setinterfacecommand{usecommands}{folosestecomenzi} -\setinterfacecommand{useencoding}{folosestecodificarea} -\setinterfacecommand{useexternaldocument}{folosestedocumentextern} -\setinterfacecommand{useexternalfigure}{folosestefiguraexterna} -\setinterfacecommand{useexternalfile}{folosestefisierextern} -\setinterfacecommand{useexternalfiles}{folosestefisiereexterne} -\setinterfacecommand{useexternalsoundtrack}{folosestemuzicaexterna} -\setinterfacecommand{usemodule}{folosestemodul} -\setinterfacecommand{usemodules}{folosestemodule} -\setinterfacecommand{usepath}{folosestedirector} -\setinterfacecommand{usereferences}{folosestereferinte} -\setinterfacecommand{usespecials}{folosestespeciale} -\setinterfacecommand{usesymbols}{folosestesimboluri} -\setinterfacecommand{usetypescript}{usetypescript} -\setinterfacecommand{usetypescriptfile}{usetypescriptfile} -\setinterfacecommand{useurl}{folosesteurl} -\setinterfacecommand{version}{versiune} -\setinterfacecommand{vl}{vl} -\setinterfacecommand{weekday}{zidinsaptamana} -\setinterfacecommand{whitespace}{spatiualb} -\setinterfacecommand{wordright}{cuvantdreapta} -\setinterfacecommand{writebetweenlist}{scrieintreliste} -\setinterfacecommand{writetolist}{scrieinlista} -\setinterfacecommand{writetoreferencelist}{scrieinlistareferinte} -\setinterfacecommand{writetoregister}{scrieinregistru} -% -\endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/context/base/mult-sys.mkii b/Master/texmf-dist/tex/context/base/mult-sys.mkii new file mode 100644 index 00000000000..1484acecca5 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-sys.mkii @@ -0,0 +1,892 @@ +%D \module +%D [ file=mult-sys, +%D version=1996.06.01, +%D title=\CONTEXT\ Multilingual 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 In boring module we define a lot of obscure but useful +%D system constants. By doing so we save lots of memory while +%D at the same time we prevent ourself from typing errors. + +\writestatus{loading}{ConTeXt Multilingual Macros / System} + +\unprotect + +%D The constants are grouped in such a way that there is a +%D minimal change of conflicts. +%D +%D \starttyping +%D \definesystemconstants {word} +%D \definemessageconstant {word} +%D \stoptyping +%D +%D This commands generate \type{\s!word} and \type{\m!word}. + +\definesystemconstant {hans} +\definesystemconstant {taco} + +%D First we define some system constants used for both the +%D multi||lingual interface and multi||linguag typesetting. + +\definesystemconstant {afrikaans} \definesystemconstant {af} +\definesystemconstant {arabic} \definesystemconstant {ar} +\definesystemconstant {catalan} \definesystemconstant {ca} +\definesystemconstant {chinese} \definesystemconstant {cn} +\definesystemconstant {croatian} \definesystemconstant {hr} +\definesystemconstant {czech} \definesystemconstant {cs} \definesystemconstant {cz} +\definesystemconstant {danish} \definesystemconstant {da} +\definesystemconstant {dutch} \definesystemconstant {nl} +\definesystemconstant {english} \definesystemconstant {en} +\definesystemconstant {finish} \definesystemconstant {fi} +\definesystemconstant {french} \definesystemconstant {fr} +\definesystemconstant {german} \definesystemconstant {de} +\definesystemconstant {hungarian} \definesystemconstant {hu} +\definesystemconstant {italian} \definesystemconstant {it} +\definesystemconstant {latin} \definesystemconstant {la} +\definesystemconstant {lithuanian} \definesystemconstant {lt} +\definesystemconstant {bokmal} \definesystemconstant {nb} \definesystemconstant {norwegian} \definesystemconstant {no} +\definesystemconstant {nynorsk} \definesystemconstant {nn} +\definesystemconstant {polish} \definesystemconstant {pl} +\definesystemconstant {persian} \definesystemconstant {pe} +\definesystemconstant {portuguese} \definesystemconstant {pt} +\definesystemconstant {romanian} \definesystemconstant {ro} +\definesystemconstant {russian} \definesystemconstant {ru} +\definesystemconstant {slovak} \definesystemconstant {sk} +\definesystemconstant {slovenian} \definesystemconstant {sl} +\definesystemconstant {slovene} +\definesystemconstant {spanish} \definesystemconstant {es} +\definesystemconstant {swedish} \definesystemconstant {sv} +\definesystemconstant {turkish} \definesystemconstant {tr} +\definesystemconstant {turkmen} \definesystemconstant {tk} +\definesystemconstant {gbenglish} \definesystemconstant {gb} \definesystemconstant {ukenglish} \definesystemconstant {uk} +\definesystemconstant {usenglish} \definesystemconstant {us} +\definesystemconstant {ukrainian} \definesystemconstant {ua} +\definesystemconstant {greek} \definesystemconstant {gr} +\definesystemconstant {ancientgreek} \definesystemconstant {agr} +\definesystemconstant {vietnamese} \definesystemconstant {vi} \definesystemconstant {vn} + +%D For proper \UNICODE\ support we need a few font related +%D constants. + +\definesystemconstant {BoldItalic} +\definesystemconstant {BoldSlanted} +\definesystemconstant {Bold} +\definesystemconstant {Italic} +\definesystemconstant {Regular} +\definesystemconstant {Slanted} +\definesystemconstant {Unicode} + +\definesystemconstant {Serif} \definesystemconstant {Regular} +\definesystemconstant {Sans} \definesystemconstant {Support} +\definesystemconstant {Mono} \definesystemconstant {Type} +\definesystemconstant {Math} +\definesystemconstant {Handwriting} +\definesystemconstant {Calligraphy} +\definesystemconstant {Casual} + +\definesystemconstant {SerifBold} \definesystemconstant {SansBold} \definesystemconstant {MonoBold} +\definesystemconstant {SerifItalic} \definesystemconstant {SansItalic} \definesystemconstant {MonoItalic} +\definesystemconstant {SerifBoldItalic} \definesystemconstant {SansBoldItalic} \definesystemconstant {MonoBoldItalic} +\definesystemconstant {SerifSlanted} \definesystemconstant {SansSlanted} \definesystemconstant {MonoSlanted} +\definesystemconstant {SerifBoldSlanted} \definesystemconstant {SansBoldSlanted} \definesystemconstant {MonoBoldSlanted} +\definesystemconstant {SerifCaps} \definesystemconstant {SansCaps} \definesystemconstant {MonoCaps} + +\definesystemconstant {Normal} +\definesystemconstant {Caps} + +\definesystemconstant {mnem} % kind of generic short tag + +\definesystemconstant {file} +\definesystemconstant {name} +\definesystemconstant {spec} + +\definesystemconstant {serif} +\definesystemconstant {sans} +\definesystemconstant {mono} +\definesystemconstant {math} +\definesystemconstant {handwriting} +\definesystemconstant {calligraphy} +\definesystemconstant {casual} +\definesystemconstant {fax} + +\definesystemconstant {fallback} + +\definesystemconstant {none} +\definesystemconstant {default} +\definesystemconstant {smallcaps} + +%D As the name of their define command states, the next set of +%D constants is used in the message macro's. + +\definemessageconstant {check} +\definemessageconstant {colors} +\definemessageconstant {columns} +\definemessageconstant {encodings} +\definemessageconstant {regimes} +\definemessageconstant {figures} +\definemessageconstant {fields} +\definemessageconstant {files} +\definemessageconstant {floatblocks} +\definemessageconstant {fonts} +\definemessageconstant {handlings} +\definemessageconstant {interactions} +\definemessageconstant {javascript} +\definemessageconstant {layouts} +\definemessageconstant {linguals} +\definemessageconstant {references} +\definemessageconstant {specials} +\definemessageconstant {structures} +\definemessageconstant {symbols} +\definemessageconstant {systems} +\definemessageconstant {lua} +\definemessageconstant {textblocks} +\definemessageconstant {verbatims} +\definemessageconstant {versions} +\definemessageconstant {metapost} +\definemessageconstant {chemicals} +\definemessageconstant {publications} + +%D Net come some \CONTEXT\ constants, used in the definition +%D of private commands: + +\definesystemconstant {tex} +\definesystemconstant {xml} +\definesystemconstant {lua} + +\definesystemconstant {next} +\definesystemconstant {pickup} +\definesystemconstant {ascii} +\definesystemconstant {default} +\definesystemconstant {unknown} +\definesystemconstant {action} +\definesystemconstant {compare} +\definesystemconstant {do} +\definesystemconstant {dodo} +\definesystemconstant {complex} +\definesystemconstant {simple} +\definesystemconstant {start} +\definesystemconstant {stop} +\definesystemconstant {dummy} +\definesystemconstant {local} +\definesystemconstant {global} +\definesystemconstant {done} +\definesystemconstant {font} +\definesystemconstant {link} +\definesystemconstant {parent} +\definesystemconstant {clone} +\definesystemconstant {section} \let\v!sectionlevel\s!section % for old times sake +\definesystemconstant {handler} +\definesystemconstant {counter} +\definesystemconstant {single} +\definesystemconstant {multi} + +\definesystemconstant {hasnumber} +\definesystemconstant {hastitle} +\definesystemconstant {hascaption} +\definesystemconstant {haslevel} + +\definesystemconstant {mkiv} +\definesystemconstant {mkii} +\definesystemconstant {entities} + +\definesystemconstant {normal} +\definesystemconstant {bold} +\definesystemconstant {italic} +\definesystemconstant {slanted} + +\definesystemconstant {default} +\definesystemconstant {smallcaps} + +\definesystemconstant {text} +\definesystemconstant {page} +\definesystemconstant {leftpage} +\definesystemconstant {rightpage} +\definesystemconstant {somewhere} + +%D A more experienced \TEX\ user will recognize the next four +%D constants. We need these because font-definitions are +%D partially english. + +\definesystemconstant {run} + +\definesystemconstant {fam} +\definesystemconstant {text} +\definesystemconstant {script} +\definesystemconstant {scriptscript} + +\definesystemconstant {lefthyphenmin} +\definesystemconstant {righthyphenmin} +\definesystemconstant {lefthyphenchar} +\definesystemconstant {righthyphenchar} + +\definesystemconstant {skewchar} +\definesystemconstant {hyphenchar} +\definesystemconstant {catcodes} +\definesystemconstant {encoding} +\definesystemconstant {resource} +\definesystemconstant {mapping} +\definesystemconstant {language} +\definesystemconstant {patterns} +\definesystemconstant {rname} +\definesystemconstant {rscale} +\definesystemconstant {handling} +\definesystemconstant {features} +\definesystemconstant {fallbacks} +\definesystemconstant {goodies} +\definesystemconstant {background} +\definesystemconstant {ucmap} + +\definesystemconstant {property} +\definesystemconstant {overprint} +\definesystemconstant {layer} +\definesystemconstant {effect} +\definesystemconstant {negative} +\definesystemconstant {color} +\definesystemconstant {transparency} + +\definesystemconstant {black} +\definesystemconstant {white} + +\definesystemconstant {format} +\definesystemconstant {extensions} +\definesystemconstant {initializations} + +%D Just to be complete we define the standard \TEX\ units. + +\definesystemconstant {cm} +\definesystemconstant {em} +\definesystemconstant {ex} +\definesystemconstant {mm} +\definesystemconstant {pt} +\definesystemconstant {sp} +\definesystemconstant {bp} +\definesystemconstant {in} +\definesystemconstant {pc} +\definesystemconstant {cm} +\definesystemconstant {dd} +\definesystemconstant {cc} +\definesystemconstant {nd} +\definesystemconstant {nc} + +%D These constants are used for internal and utility +%D commands. + +\definesystemconstant {check} +\definesystemconstant {reset} +\definesystemconstant {set} + +\definesystemconstant {entrya} +\definesystemconstant {entryb} +\definesystemconstant {entryc} +\definesystemconstant {entryd} +\definesystemconstant {entry} +\definesystemconstant {see} +\definesystemconstant {from} +\definesystemconstant {to} +\definesystemconstant {line} +\definesystemconstant {page} +\definesystemconstant {realpage} +\definesystemconstant {userpage} +\definesystemconstant {subpage} + +\definesystemconstant {synonym} + +\definesystemconstant {reference} +\definesystemconstant {main} + +\definesystemconstant {list} + +\definesystemconstant {item} +\definesystemconstant {itemcount} + +\definesystemconstant {number} +\definesystemconstant {references} +\definesystemconstant {between} +\definesystemconstant {format} +\definesystemconstant {old} + +\definesystemconstant {thisisblock} +\definesystemconstant {thiswasblock} + +\definesystemconstant {figurepreset} + +\definesystemconstant {empty} + +%D Some \CONTEXT\ commands take a two||pass aproach to +%D optimize the typesetting. Each two||pass object has its +%D own tag. + +\definesystemconstant {pass} + +\definesystemconstant {data} +\definesystemconstant {float} +\definesystemconstant {list} +\definesystemconstant {page} +\definesystemconstant {subpage} +\definesystemconstant {margin} +\definesystemconstant {profile} +\definesystemconstant {versionbegin} +\definesystemconstant {versionend} +\definesystemconstant {cross} +\definesystemconstant {paragraph} + +%D A lot of macros use tags to distinguish between different +%D objects, e.g. lists and registers. + +\definesystemconstant {prt} % part (deel) +\definesystemconstant {chp} % chapter (hoofdstuk) +\definesystemconstant {sec} % section (paragraaf) +\definesystemconstant {tit} % title (titel) +\definesystemconstant {sub} % subject (onderwerp) +\definesystemconstant {mar} % margin (marge) +\definesystemconstant {num} % number (doornummeren) +\definesystemconstant {def} % definition (doordefinieren) +\definesystemconstant {for} % formula (formule) +\definesystemconstant {fnt} % footnote (voetnoot) +\definesystemconstant {ind} % index (register) +\definesystemconstant {lin} % linked index +\definesystemconstant {lst} % list (opsomming) +\definesystemconstant {flt} % float (plaatsblok) +\definesystemconstant {pag} % page (pagina) +\definesystemconstant {txt} % text (tekst) +\definesystemconstant {ref} % reference (verwijzing) +\definesystemconstant {lab} % label (label) +\definesystemconstant {aut} % automatic (inhoud, index) +\definesystemconstant {vwa} % automatic (illustrations) +\definesystemconstant {vwb} % automatic (illustrations) + +\definesystemconstant {kop} % kop % still dutch + +%D Reference labels can be tagged by users, for instance by +%D means of \type{tag:}. The reference mechanism itself uses +%D some tags too. These are definitely not to be used by users. +%D Here they are: + +\definereferenceconstant {cross} {:c:} % cross reference +\definereferenceconstant {view} {:v:} % view reference +\definereferenceconstant {viewa} {:a:} % view reference test a +\definereferenceconstant {viewb} {:b:} % view reference test b +\definereferenceconstant {page} {:p:} % page referece +\definereferenceconstant {list} {:l:} % list reference +\definereferenceconstant {exec} {:e:} % execution reference +\definereferenceconstant {form} {:m:} % form reference +\definereferenceconstant {syst} {:s:} % system reference + +\definereferenceconstant {from} {:f:} % from list reference +\definereferenceconstant {to} {:t:} % to list reference + +\definereferenceconstant {object} {:o:} % object reference +\definereferenceconstant {driver} {:d:} % driver object reference +\definereferenceconstant {widget} {:w:} % field chain reference + +\definereferenceconstant {java} {:j:} % java scripts + +%D When we use numbers and dimensions the same applies as +%D with the keywords like \type{width} and \type{plus} +%D mentioned earlier. + +\def\!!ten {10} +\def\!!twelve {12} +\def\!!hundred {100} +\def\!!thousand {1000} +\def\!!tenthousand {10000} +\def\!!maxcard {65536} +\def\!!medcard {32768} + +\def\!!zeropoint {0pt} +\def\!!onepoint {1pt} +\def\!!twopoint {2pt} +\def\!!threepoint {3pt} +\def\!!fourpoint {4pt} +\def\!!fivepoint {5pt} +\def\!!sixpoint {6pt} +\def\!!sevenpoint {7pt} +\def\!!eightpoint {8pt} +\def\!!ninepoint {9pt} +\def\!!tenpoint {10pt} +\def\!!elevenpoint {11pt} +\def\!!twelvepoint {12pt} +\def\!!fourteenpointfour {14.4pt} + +\let\onerealpoint\onepoint % needed for latex + +% D Another optimization is: +% +% \let\points\onepoint + +%D A rough test is: +%D +%D \starttyping +%D \def\TestMe % 7.75 sec on a P4/2G +%D {\dimen0=10\points\dimen0=10\points\dimen0=10\points\dimen0=10\points\dimen0=10\points +%D \dimen0=10\points\dimen0=10\points\dimen0=10\points\dimen0=10\points\dimen0=10\points} +%D +%D \def\TestMe % 11.5 sec on a P4/2G +%D {\dimen0=10pt\dimen0=10pt\dimen0=10pt\dimen0=10pt\dimen0=10pt% +%D \dimen0=10pt\dimen0=10pt\dimen0=10pt\dimen0=10pt\dimen0=10pt} +%D +%D \def\TestMe % 12.5 sec on a P4/2G +%D {\dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt% +%D \dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt} +%D +%D \testfeatureonce {500000}{\TestMe} +%D \stoptyping + +%D Variables are composed of a command specific tag and a user +%D supplied variable (system constant). The first tag \type{ag} +%D for instance is available as \type{\??ag} and expands to +%D \type{@@ag} in composed variables. + +% vervallen : hd hr hm vt vr vm tr tn te br bm bo on om or + +\definesystemvariable {ab} % AlignedBoxes +\definesystemvariable {ac} % ACcent +\definesystemvariable {ae} % AttributEs +\definesystemvariable {ag} % AchterGrond +\definesystemvariable {al} % ALinea's +\definesystemvariable {am} % interActieMenu +\definesystemvariable {an} % ANchor +\definesystemvariable {as} % AlignmentSwitch +\definesystemvariable {at} % ATtachments +\definesystemvariable {ba} % synchronisatieBAlk +\definesystemvariable {bc} % BaCkend +\definesystemvariable {be} % startstop (BeginEnd) +\definesystemvariable {bj} % BlokJe +\definesystemvariable {bk} % Blokken (floats) +\definesystemvariable {bl} % BLanko +\definesystemvariable {bg} % BleedinG +\definesystemvariable {bm} % BookMark +\definesystemvariable {bo} % BlankO (definitions) +\definesystemvariable {bp} % BreakPoint +\definesystemvariable {br} % sideBaR +\definesystemvariable {bs} % SelecteerBlokken +\definesystemvariable {bt} % BuTton +\definesystemvariable {bu} % BUffer +\definesystemvariable {bv} % Brieven +\definesystemvariable {by} % Per +\definesystemvariable {cb} % CollectBox +\definesystemvariable {cc} % Comment +\definesystemvariable {ce} % CasEs +\definesystemvariable {cf} % Style (ColorFont) +\definesystemvariable {ch} % CHaracterspacing +\definesystemvariable {ci} % CItaat +\definesystemvariable {ck} % Character Kerning +\definesystemvariable {cl} % kleur (CoLor setup) +\definesystemvariable {cn} % CollumN +\definesystemvariable {cm} % CheMical +\definesystemvariable {co} % COmbinaties +\definesystemvariable {cp} % CliP +\definesystemvariable {cr} % kleur (ColoR) +\definesystemvariable {cs} % kleur (ColorSeparation +\definesystemvariable {cv} % ConVersie +\definesystemvariable {cy} % CrYteria +\definesystemvariable {da} % DAte +\definesystemvariable {db} % Labels +\definesystemvariable {dc} % DroppedCaps +\definesystemvariable {dd} % DoorDefinieren +\definesystemvariable {de} % DEel +\definesystemvariable {di} % DIrections +\definesystemvariable {dl} % DunneLijnen +\definesystemvariable {dn} % DoorNummeren +\definesystemvariable {dm} % DefineMeasure +\definesystemvariable {do} % DefinieerOpmaak +\definesystemvariable {du} % DUmmy +\definesystemvariable {ds} % DoorSpringen +\definesystemvariable {ef} % ExternFiguur +\definesystemvariable {ec} % EnCoding +\definesystemvariable {el} % Elements +\definesystemvariable {en} % ENvironments +\definesystemvariable {ep} % ExternfiguurPreset +\definesystemvariable {eq} % EQalign +\definesystemvariable {er} % external resources +\definesystemvariable {ex} % ExterneFiguren +\definesystemvariable {fa} % font feature +\definesystemvariable {fc} % FramedContent +\definesystemvariable {fd} % FielD +\definesystemvariable {fe} % FoxetExtensions +\definesystemvariable {ff} % FontFile +\definesystemvariable {fg} % FiGuurmaten +\definesystemvariable {fi} % FIle +\definesystemvariable {fl} % Floats +\definesystemvariable {fm} % ForMules +\definesystemvariable {fn} % subformulas +\definesystemvariable {fo} % xml FO +\definesystemvariable {fp} % FilegroeP +\definesystemvariable {fq} % Features +\definesystemvariable {fr} % ForM +\definesystemvariable {fs} % FileSynonym +\definesystemvariable {ft} % FonTs +\definesystemvariable {fu} % FontSolution +\definesystemvariable {fv} % FontVariant +\definesystemvariable {fw} % simpleFonts by Wolfgang +\definesystemvariable {fx} % FoXet +\definesystemvariable {gr} % GRid +\definesystemvariable {ha} % HAng +\definesystemvariable {hs} % HSpace +\definesystemvariable {ht} % HiddenText +\definesystemvariable {ia} % Interactie +\definesystemvariable {ib} % InteractieBalk +\definesystemvariable {ic} % ICc profiles +\definesystemvariable {id} % Index +\definesystemvariable {ig} % ItemGroup +\definesystemvariable {ih} % InHoudsopgave +\definesystemvariable {ii} % stelIndexIn +\definesystemvariable {il} % stelInvulRegelsin +\definesystemvariable {im} % InMarge +\definesystemvariable {in} % INspringen +\definesystemvariable {ip} % InsertPages +\definesystemvariable {is} % Items +\definesystemvariable {it} % stelInTerliniein +\definesystemvariable {iv} % stelInvulLijnenin +\definesystemvariable {ka} % KAntlijn +\definesystemvariable {kd} % KaDerteksten +\definesystemvariable {kj} % KopJes (floats) +\definesystemvariable {kk} % Kapitalen +\definesystemvariable {kl} % KoLommen +\definesystemvariable {km} % KenMerk +\definesystemvariable {ko} % KOp(pen) +\definesystemvariable {kp} % KopPelteken +\definesystemvariable {kr} % KoRps +\definesystemvariable {ks} % KolomSpan +\definesystemvariable {kt} % KonTakten +\definesystemvariable {kw} % KontaktWaarde +\definesystemvariable {la} % LAnguage +\definesystemvariable {lb} % LaBels +\definesystemvariable {ld} % LegenDa +\definesystemvariable {le} % LinetablE +\definesystemvariable {lf} % LocalFigures +\definesystemvariable {lg} % taal (LanGuage) +\definesystemvariable {li} % LIjst +\definesystemvariable {lk} % LinK +\definesystemvariable {ll} % Layers +\definesystemvariable {lx} % LayerteXt +\definesystemvariable {ln} % LijNen +\definesystemvariable {lo} % LOgos +\definesystemvariable {lt} % LiTeratuur +\definesystemvariable {ls} % languageScript +\definesystemvariable {ly} % LaYout +\definesystemvariable {ma} % MargeAchtergrond +\definesystemvariable {mb} % MargeBlokken +\definesystemvariable {md} % MoDule +\definesystemvariable {me} % MultilingualElement (tags) +\definesystemvariable {mg} % Metapost paGe +\definesystemvariable {mh} % MultilingualHead +\definesystemvariable {mk} % MarKering +\definesystemvariable {ml} % MultilingualLabel +\definesystemvariable {mm} % MultilingualMath +\definesystemvariable {mt} % inline MaTh +\definesystemvariable {mo} % Math Options +\definesystemvariable {mp} % MetaPost +\definesystemvariable {mx} % MatriX +\definesystemvariable {ng} % parbuilders +\definesystemvariable {nh} % new heads (structure) +\definesystemvariable {nn} % structurenumbering +\definesystemvariable {nm} % Nummering +\definesystemvariable {np} % NaastPlaatsen +\definesystemvariable {nr} % Nummeren +\definesystemvariable {of} % OFfset +\definesystemvariable {oi} % OmlijndInstellingen +\definesystemvariable {ol} % OmLijnd +\definesystemvariable {od} % Omlijnd Defaults (simple) +\definesystemvariable {on} % ONderstreep +\definesystemvariable {oo} % OpsOmmingen +\definesystemvariable {op} % OPsomming +\definesystemvariable {or} % OtpfilteR +\definesystemvariable {os} % OffSet +\definesystemvariable {ot} % OTpsequence +\definesystemvariable {ov} % OVerlay +\definesystemvariable {ox} % OffsetBox +\definesystemvariable {pa} % PAlet +\definesystemvariable {pb} % PuBlication +\definesystemvariable {pc} % PageComment +\definesystemvariable {pe} % PagEhandler +\definesystemvariable {pf} % ProFiel +\definesystemvariable {pg} % KoppelPagina +\definesystemvariable {ph} % ParagrapH +\definesystemvariable {pl} % PLaats +\definesystemvariable {pn} % PaginaNummer +\definesystemvariable {po} % PrOcessor +\definesystemvariable {pp} % PaPier +\definesystemvariable {pr} % PRogrammas +\definesystemvariable {ps} % PoSitioneren +\definesystemvariable {pt} % PageshifT +\definesystemvariable {py} % PropertYs +\definesystemvariable {pv} % PublicationVariable +\definesystemvariable {ra} % RAise +\definesystemvariable {rd} % RenDering +\definesystemvariable {rf} % ReFereren +\definesystemvariable {rg} % ReGel +\definesystemvariable {rl} % ReferentieLijst +\definesystemvariable {rn} % RegelNummer +\definesystemvariable {ro} % ROteren +\definesystemvariable {rr} % linenotes +\definesystemvariable {rs} % RaSters +\definesystemvariable {rt} % RoosTers +\definesystemvariable {rv} % ReserVeerfiguur +\definesystemvariable {rw} % RenderingWindow +\definesystemvariable {sa} % ScAle +\definesystemvariable {sb} % SectieBlok +\definesystemvariable {sc} % SCherm +\definesystemvariable {sd} % SounD +\definesystemvariable {se} % SEctie +\definesystemvariable {sf} % SpeciFics +\definesystemvariable {sg} % SpacinG +\definesystemvariable {sh} % ShapeText +\definesystemvariable {si} % SplIt +\definesystemvariable {sk} % SectieKop +\definesystemvariable {sl} % SmalLer +\definesystemvariable {sm} % SynonieMen +\definesystemvariable {sn} % SubNummer +\definesystemvariable {so} % SOrteren +\definesystemvariable {sp} % SelecteerPapier +\definesystemvariable {sr} % SpacehandleR +\definesystemvariable {ss} % Symbool +\definesystemvariable {st} % STickers +\definesystemvariable {su} % SetUp +\definesystemvariable {sv} % SysteemVariabelen +\definesystemvariable {sw} % SectionWorld +\definesystemvariable {sx} % Selector +\definesystemvariable {sy} % SYnchronisatie +\definesystemvariable {ta} % TAb +\definesystemvariable {tb} % TekstBlokken +\definesystemvariable {td} % TextbackgrounDs +\definesystemvariable {te} % TEmplate +\definesystemvariable {tf} % TypeFace +\definesystemvariable {tg} % Tex paGe +\definesystemvariable {ti} % TabelInstellingen +\definesystemvariable {tk} % Teksten +\definesystemvariable {tl} % TekstLijnen +\definesystemvariable {tm} % TypesynonyM +\definesystemvariable {tp} % TyPen +\definesystemvariable {tx} % TeXtflow +\definesystemvariable {to} % TOlerance +\definesystemvariable {tr} % TRacer +\definesystemvariable {ts} % TypeScript +\definesystemvariable {tt} % TabulaTe +\definesystemvariable {ty} % TYpe +\definesystemvariable {uc} % Unicode +\definesystemvariable {ui} % UItvoer +\definesystemvariable {ur} % URl +\definesystemvariable {up} % Utility Program +\definesystemvariable {va} % VspAce +\definesystemvariable {ve} % VErsie +\definesystemvariable {vn} % VoetNoten +\definesystemvariable {vs} % VSpacing +\definesystemvariable {vt} % VerTical +\definesystemvariable {wr} % WitRuimte +\definesystemvariable {wl} % WordList +\definesystemvariable {xf} % XML File +\definesystemvariable {xl} % lxml (mkiv) +\definesystemvariable {xm} % xml (mkiv) +\definesystemvariable {xp} % XML Processing +\definesystemvariable {xy} % schaal +\definesystemvariable {za} % ZetspiegelAanpassing + +%D Next we define some language independant one letter +%D variables and keywords. + +\defineinterfaceconstant {x} {x} % x offset +\defineinterfaceconstant {y} {y} % y offset +\defineinterfaceconstant {w} {w} % width +\defineinterfaceconstant {h} {h} % height +\defineinterfaceconstant {s} {s} % size +\defineinterfaceconstant {t} {t} % title +\defineinterfaceconstant {c} {c} % creator +\defineinterfaceconstant {e} {e} % extension +\defineinterfaceconstant {f} {f} % file + +\defineinterfaceconstant {a} {a} % kunnen weg +\defineinterfaceconstant {b} {b} % kunnen weg +\defineinterfaceconstant {c} {c} % kunnen weg +\defineinterfaceconstant {d} {d} % kunnen weg +\defineinterfaceconstant {e} {e} % kunnen weg + +\defineinterfaceconstant {s} {s} +\defineinterfaceconstant {r} {r} +\defineinterfaceconstant {g} {g} +\defineinterfaceconstant {b} {b} +\defineinterfaceconstant {c} {c} +\defineinterfaceconstant {m} {m} +\defineinterfaceconstant {y} {y} +\defineinterfaceconstant {k} {k} +\defineinterfaceconstant {a} {a} % alternative +\defineinterfaceconstant {t} {t} % transparency +\defineinterfaceconstant {p} {p} % percentage + +\defineinterfaceconstant {t} {t} +\defineinterfaceconstant {h} {h} +\defineinterfaceconstant {b} {b} + +\defineinterfaceconstant {rgb} {rgb} +\defineinterfacevariable {rgb} {rgb} + +\defineinterfaceconstant {cmyk} {cmyk} +\defineinterfacevariable {cmyk} {cmyk} + +\defineinterfaceconstant {mp} {mp} +\defineinterfacevariable {mp} {mp} + +\defineinterfacevariable {s} {s} + +\defineinterfacevariable {a} {a} +\defineinterfacevariable {b} {b} +\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: +%D \type{tu}. + +\definefileconstant {utilityfilename} {texutil} + +\definefileconstant {blockextension} {tub} +\definefileconstant {figureextension} {tuf} +\definefileconstant {inputextension} {tui} +\definefileconstant {outputextension} {tuo} % tup for previous run +\definefileconstant {optionextension} {top} +\definefileconstant {temporaryextension} {tmp} +\definefileconstant {patternsextension} {pat} +\definefileconstant {hyphensextension} {hyp} +\definefileconstant {fontmapextension} {map} +\definefileconstant {bibextension} {bbl} + +%D These files are loaded at start||up. They may contain system +%D specific setups (or calls to other files), old macro's, to +%D garantee compatibility and new macro's noy yet present in +%D the format. + +\definefileconstant {errfilename} {cont-err} +\definefileconstant {sysfilename} {cont-sys} +\definefileconstant {newfilename} {cont-new} +\definefileconstant {locfilename} {cont-loc} +\definefileconstant {expfilename} {cont-exp} +%definefileconstant {usrfilename} {cont-usr} % .tex +%definefileconstant {fmtfilename} {cont-fmt} % .tex + +%D Handy for typescripts (we could use s! instead: + +\definetypescriptconstant {name} {name} +\definetypescriptconstant {default} {default} +\definetypescriptconstant {map} {map} +\definetypescriptconstant {special} {special} +\definetypescriptconstant {size} {size} + +%D The setup files for the language, font, color and special +%D subsystems have a common prefix. This means that we have at +%D most three characters for unique filenames. + +\definefileconstant {colorprefix} {colo-} +\definefileconstant {encodingprefix} {enco-} +\definefileconstant {filterprefix} {filt-} +\definefileconstant {fontprefix} {font-} +\definefileconstant {handlingprefix} {hand-} +\definefileconstant {javascriptprefix} {java-} +\definefileconstant {languageprefix} {lang-} +\definefileconstant {mathprefix} {math-} +\definefileconstant {metapostprefix} {meta-} +\definefileconstant {regimeprefix} {regi-} +\definefileconstant {specialprefix} {spec-} +\definefileconstant {symbolprefix} {symb-} +\definefileconstant {typeprefix} {type-} +\definefileconstant {xtagprefix} {xtag-} +\definefileconstant {propprefix} {prop-} +\definefileconstant {unicprefix} {unic-} +\definefileconstant {sortprefix} {sort-} +\definefileconstant {prettyprefix} {pret-} + +\definefileconstant {moduleprefix} {m-} +\definefileconstant {styleprefix} {s-} +\definefileconstant {xstyleprefix} {x-} +\definefileconstant {privateprefix} {p-} +\definefileconstant {thirdprefix} {t-} + +%definefileconstant {beforeprefix} {b-} +%definefileconstant {afterprefix} {a-} + +%D \CONTEXT\ follows different strategies for finding files. +%D The macros that are responsible for this 'clever' searching +%D make use of two (very important) path specifiers. + +\definefileconstant {pathseparator} {/} +\definefileconstant {currentpath} {.} +\definefileconstant {parentpath} {..} + +%D The way fonts are defined and called upon is language +%D independant. We follow the scheme laid down by Knuth in +%D Plain \TEX. We'll explain their meaning later. + +\defineinterfaceconstant {tf} {tf} +\defineinterfaceconstant {bf} {bf} +\defineinterfaceconstant {bs} {bs} +\defineinterfaceconstant {bi} {bi} +\defineinterfaceconstant {sl} {sl} +\defineinterfaceconstant {it} {it} +\defineinterfaceconstant {sc} {sc} +\defineinterfaceconstant {rm} {rm} +\defineinterfaceconstant {ss} {ss} +\defineinterfaceconstant {tt} {tt} +\defineinterfaceconstant {hw} {hw} +\defineinterfaceconstant {cg} {cg} +\defineinterfaceconstant {os} {os} +\defineinterfaceconstant {mm} {mm} +\defineinterfaceconstant {i} {i} +\defineinterfaceconstant {nn} {nn} + +\defineinterfaceconstant {x} {x} +\defineinterfaceconstant {xx} {xx} + +\defineinterfaceconstant {em} {em} + +\defineinterfaceconstant {mi} {mi} +\defineinterfaceconstant {sy} {sy} +\defineinterfaceconstant {ex} {ex} +\defineinterfaceconstant {mr} {mr} + +\defineinterfaceconstant {ma} {ma} +\defineinterfaceconstant {mb} {mb} +\defineinterfaceconstant {mc} {mc} + +%D For figure inclusion we need: + +\defineinterfaceconstant {tif} {tif} +\defineinterfaceconstant {eps} {eps} +\defineinterfaceconstant {mps} {mps} +\defineinterfaceconstant {jpg} {jpg} +\defineinterfaceconstant {pdf} {pdf} +\defineinterfaceconstant {png} {png} +\defineinterfaceconstant {avi} {avi} +\defineinterfaceconstant {mov} {mov} +\defineinterfaceconstant {svg} {svg} +\defineinterfaceconstant {tex} {tex} +\defineinterfaceconstant {tmp} {tmp} +\defineinterfaceconstant {cld} {cld} + +%D A careful reader will have noticed that in the module +%D \type{mult-ini} we defined \type{\selectinterface}. We were +%D not yet able to actually select an interface, because we +%D still had to define the constants and variables. Now we've +%D done so, selection is permitted. + +\selectinterface + +%D Ok, here are some more, because we've got ouselves some +%D extensions to \CONTEXT. + +\definemessageconstant {addresses} +\definemessageconstant {documents} + +\protect + +\endinput diff --git a/Master/texmf-dist/tex/context/base/mult-sys.mkiv b/Master/texmf-dist/tex/context/base/mult-sys.mkiv new file mode 100644 index 00000000000..4e3138c8634 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-sys.mkiv @@ -0,0 +1,912 @@ +%D \module +%D [ file=mult-sys, +%D version=1996.06.01, +%D title=\CONTEXT\ Multilingual 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 In boring module we define a lot of obscure but useful +%D system constants. By doing so we save lots of memory while +%D at the same time we prevent ourself from typing errors. + +\writestatus{loading}{ConTeXt Multilingual Macros / System} + +\unprotect + +%D This file is mostly the same as the \MKII\ variant but we +%D keep extending \MKIV, so it was bout time to have a dedicated +%D variant. +%D +%D The constants are grouped in such a way that there is a +%D minimal change of conflicts. +%D +%D \starttyping +%D \definesystemconstants {word} +%D \definemessageconstant {word} +%D \stoptyping +%D +%D This commands generate \type{\s!word} and \type{\m!word}. + +\definesystemconstant {hans} +\definesystemconstant {taco} + +%D First we define some system constants used for both the +%D multi||lingual interface and multi||linguag typesetting. + +\definesystemconstant {afrikaans} \definesystemconstant {af} +\definesystemconstant {arabic} \definesystemconstant {ar} +\definesystemconstant {catalan} \definesystemconstant {ca} +\definesystemconstant {chinese} \definesystemconstant {cn} +\definesystemconstant {croatian} \definesystemconstant {hr} +\definesystemconstant {czech} \definesystemconstant {cs} \definesystemconstant {cz} +\definesystemconstant {danish} \definesystemconstant {da} +\definesystemconstant {dutch} \definesystemconstant {nl} +\definesystemconstant {english} \definesystemconstant {en} +\definesystemconstant {finish} \definesystemconstant {fi} +\definesystemconstant {french} \definesystemconstant {fr} +\definesystemconstant {german} \definesystemconstant {de} +\definesystemconstant {hungarian} \definesystemconstant {hu} +\definesystemconstant {italian} \definesystemconstant {it} +\definesystemconstant {latin} \definesystemconstant {la} +\definesystemconstant {lithuanian} \definesystemconstant {lt} +\definesystemconstant {bokmal} \definesystemconstant {nb} \definesystemconstant {norwegian} \definesystemconstant {no} +\definesystemconstant {nynorsk} \definesystemconstant {nn} +\definesystemconstant {polish} \definesystemconstant {pl} +\definesystemconstant {persian} \definesystemconstant {pe} +\definesystemconstant {portuguese} \definesystemconstant {pt} +\definesystemconstant {romanian} \definesystemconstant {ro} +\definesystemconstant {russian} \definesystemconstant {ru} +\definesystemconstant {slovak} \definesystemconstant {sk} +\definesystemconstant {slovenian} \definesystemconstant {sl} +\definesystemconstant {slovene} % obsolete +\definesystemconstant {spanish} \definesystemconstant {es} +\definesystemconstant {swedish} \definesystemconstant {sv} +\definesystemconstant {turkish} \definesystemconstant {tr} +\definesystemconstant {turkmen} \definesystemconstant {tk} +\definesystemconstant {gbenglish} \definesystemconstant {gb} \definesystemconstant {ukenglish} \definesystemconstant {uk} +\definesystemconstant {usenglish} \definesystemconstant {us} +\definesystemconstant {ukrainian} \definesystemconstant {ua} +\definesystemconstant {greek} \definesystemconstant {gr} +\definesystemconstant {ancientgreek} \definesystemconstant {agr} +\definesystemconstant {vietnamese} \definesystemconstant {vi} \definesystemconstant {vn} +\definesystemconstant {chinese} \definesystemconstant {cn} +\definesystemconstant {japanese} \definesystemconstant {ja} +\definesystemconstant {korean} \definesystemconstant {kr} + +%D For proper \UNICODE\ support we need a few font related +%D constants. + +\definesystemconstant {BoldItalic} +\definesystemconstant {BoldSlanted} +\definesystemconstant {Bold} +\definesystemconstant {Italic} +\definesystemconstant {Regular} +\definesystemconstant {Slanted} +\definesystemconstant {Unicode} + +\definesystemconstant {Serif} \definesystemconstant {Regular} +\definesystemconstant {Sans} \definesystemconstant {Support} +\definesystemconstant {Mono} \definesystemconstant {Type} +\definesystemconstant {Math} +\definesystemconstant {Handwriting} +\definesystemconstant {Calligraphy} +\definesystemconstant {Casual} + +\definesystemconstant {SerifBold} \definesystemconstant {SansBold} \definesystemconstant {MonoBold} +\definesystemconstant {SerifItalic} \definesystemconstant {SansItalic} \definesystemconstant {MonoItalic} +\definesystemconstant {SerifBoldItalic} \definesystemconstant {SansBoldItalic} \definesystemconstant {MonoBoldItalic} +\definesystemconstant {SerifSlanted} \definesystemconstant {SansSlanted} \definesystemconstant {MonoSlanted} +\definesystemconstant {SerifBoldSlanted} \definesystemconstant {SansBoldSlanted} \definesystemconstant {MonoBoldSlanted} +\definesystemconstant {SerifCaps} \definesystemconstant {SansCaps} \definesystemconstant {MonoCaps} + +\definesystemconstant {Normal} +\definesystemconstant {Caps} + +\definesystemconstant {mnem} % kind of generic short tag + +\definesystemconstant {file} +\definesystemconstant {name} +\definesystemconstant {spec} + +\definesystemconstant {attribute} + +\definesystemconstant {serif} +\definesystemconstant {sans} +\definesystemconstant {mono} +\definesystemconstant {math} +\definesystemconstant {handwriting} +\definesystemconstant {calligraphy} +\definesystemconstant {casual} +\definesystemconstant {fax} + +\definesystemconstant {fallback} + +\definesystemconstant {none} +\definesystemconstant {default} +\definesystemconstant {smallcaps} + +%D As the name of their define command states, the next set of +%D constants is used in the message macro's. + +\definemessageconstant {check} +\definemessageconstant {colors} +\definemessageconstant {columns} +\definemessageconstant {regimes} +\definemessageconstant {figures} +\definemessageconstant {fields} +\definemessageconstant {files} +\definemessageconstant {floatblocks} +\definemessageconstant {fonts} +\definemessageconstant {handlings} +\definemessageconstant {interactions} +\definemessageconstant {javascripts} +\definemessageconstant {layouts} +\definemessageconstant {languages} +\definemessageconstant {references} +\definemessageconstant {structures} +\definemessageconstant {symbols} +\definemessageconstant {system} +\definemessageconstant {lua} +\definemessageconstant {textblocks} +\definemessageconstant {verbatims} +\definemessageconstant {versions} +\definemessageconstant {metapost} +\definemessageconstant {chemicals} +\definemessageconstant {publications} + +%D Net come some \CONTEXT\ constants, used in the definition +%D of private commands: + +\definesystemconstant {tex} +\definesystemconstant {xml} +\definesystemconstant {lua} + +\definesystemconstant {next} +\definesystemconstant {pickup} +\definesystemconstant {ascii} +\definesystemconstant {default} +\definesystemconstant {unknown} +\definesystemconstant {action} +\definesystemconstant {compare} +\definesystemconstant {do} +\definesystemconstant {dodo} +\definesystemconstant {complex} +\definesystemconstant {simple} +\definesystemconstant {start} +\definesystemconstant {stop} +\definesystemconstant {dummy} +\definesystemconstant {local} +\definesystemconstant {global} +\definesystemconstant {done} +\definesystemconstant {font} +\definesystemconstant {link} +\definesystemconstant {parent} +\definesystemconstant {clone} +\definesystemconstant {section} \let\v!sectionlevel\s!section % for old times sake +\definesystemconstant {handler} +\definesystemconstant {counter} +\definesystemconstant {single} +\definesystemconstant {multi} + +\definesystemconstant {hasnumber} +\definesystemconstant {hastitle} +\definesystemconstant {hascaption} +\definesystemconstant {haslevel} + +\definesystemconstant {mkiv} +\definesystemconstant {mkii} +\definesystemconstant {entities} + +\definesystemconstant {normal} +\definesystemconstant {bold} +\definesystemconstant {italic} +\definesystemconstant {slanted} + +\definesystemconstant {default} +\definesystemconstant {smallcaps} + +\definesystemconstant {text} +\definesystemconstant {page} +\definesystemconstant {leftpage} +\definesystemconstant {rightpage} +\definesystemconstant {somewhere} + +%D A more experienced \TEX\ user will recognize the next four +%D constants. We need these because font-definitions are +%D partially english. + +\definesystemconstant {run} + +\definesystemconstant {fam} +\definesystemconstant {text} +\definesystemconstant {script} +\definesystemconstant {scriptscript} + +\definesystemconstant {lefthyphenmin} +\definesystemconstant {righthyphenmin} +\definesystemconstant {lefthyphenchar} +\definesystemconstant {righthyphenchar} + +\definesystemconstant {skewchar} +\definesystemconstant {hyphenchar} +\definesystemconstant {catcodes} +\definesystemconstant {encoding} +\definesystemconstant {resource} +\definesystemconstant {mapping} +\definesystemconstant {language} +\definesystemconstant {patterns} +\definesystemconstant {rname} +\definesystemconstant {rscale} +\definesystemconstant {handling} +\definesystemconstant {features} +\definesystemconstant {fallbacks} +\definesystemconstant {goodies} +\definesystemconstant {background} +\definesystemconstant {ucmap} + +\definesystemconstant {property} +\definesystemconstant {overprint} +\definesystemconstant {layer} +\definesystemconstant {effect} +\definesystemconstant {negative} +\definesystemconstant {color} +\definesystemconstant {transparency} + +\definesystemconstant {black} +\definesystemconstant {white} + +\definesystemconstant {format} +\definesystemconstant {extensions} +\definesystemconstant {initializations} + +\definesystemconstant {system} % not yet interfaces messages + +%D Just to be complete we define the standard \TEX\ units. + +\definesystemconstant {cm} +\definesystemconstant {em} +\definesystemconstant {ex} +\definesystemconstant {mm} +\definesystemconstant {pt} +\definesystemconstant {sp} +\definesystemconstant {bp} +\definesystemconstant {in} +\definesystemconstant {pc} +\definesystemconstant {cm} +\definesystemconstant {dd} +\definesystemconstant {cc} +\definesystemconstant {nd} +\definesystemconstant {nc} + +%D These constants are used for internal and utility +%D commands. + +\definesystemconstant {check} +\definesystemconstant {reset} +\definesystemconstant {set} + +\definesystemconstant {entrya} +\definesystemconstant {entryb} +\definesystemconstant {entryc} +\definesystemconstant {entryd} +\definesystemconstant {entry} +\definesystemconstant {see} +\definesystemconstant {from} +\definesystemconstant {to} +\definesystemconstant {line} +\definesystemconstant {page} +\definesystemconstant {realpage} +\definesystemconstant {userpage} +\definesystemconstant {subpage} + +\definesystemconstant {synonym} + +\definesystemconstant {reference} +\definesystemconstant {main} + +\definesystemconstant {list} + +\definesystemconstant {item} +\definesystemconstant {itemcount} + +\definesystemconstant {number} +\definesystemconstant {references} +\definesystemconstant {between} +\definesystemconstant {format} +\definesystemconstant {old} + +\definesystemconstant {thisisblock} +\definesystemconstant {thiswasblock} + +\definesystemconstant {figurepreset} + +\definesystemconstant {empty} + +%D Some \CONTEXT\ commands take a two||pass aproach to +%D optimize the typesetting. Each two||pass object has its +%D own tag. + +\definesystemconstant {pass} + +\definesystemconstant {data} +\definesystemconstant {float} +\definesystemconstant {list} +\definesystemconstant {page} +\definesystemconstant {subpage} +\definesystemconstant {margin} +\definesystemconstant {profile} +\definesystemconstant {versionbegin} +\definesystemconstant {versionend} +\definesystemconstant {cross} +\definesystemconstant {paragraph} + +%D A lot of macros use tags to distinguish between different +%D objects, e.g. lists and registers. + +\definesystemconstant {prt} % part (deel) +\definesystemconstant {chp} % chapter (hoofdstuk) +\definesystemconstant {sec} % section (paragraaf) +\definesystemconstant {tit} % title (titel) +\definesystemconstant {sub} % subject (onderwerp) +\definesystemconstant {mar} % margin (marge) +\definesystemconstant {num} % number (doornummeren) +\definesystemconstant {def} % definition (doordefinieren) +\definesystemconstant {for} % formula (formule) +\definesystemconstant {fnt} % footnote (voetnoot) +\definesystemconstant {ind} % index (register) +\definesystemconstant {lin} % linked index +\definesystemconstant {lst} % list (opsomming) +\definesystemconstant {flt} % float (plaatsblok) +\definesystemconstant {pag} % page (pagina) +\definesystemconstant {txt} % text (tekst) +\definesystemconstant {ref} % reference (verwijzing) +\definesystemconstant {lab} % label (label) +\definesystemconstant {aut} % automatic (inhoud, index) +\definesystemconstant {vwa} % automatic (illustrations) +\definesystemconstant {vwb} % automatic (illustrations) + +\definesystemconstant {kop} % kop % still dutch + +%D Reference labels can be tagged by users, for instance by +%D means of \type{tag:}. The reference mechanism itself uses +%D some tags too. These are definitely not to be used by users. +%D Here they are: + +\definereferenceconstant {cross} {:c:} % cross reference +\definereferenceconstant {view} {:v:} % view reference +\definereferenceconstant {viewa} {:a:} % view reference test a +\definereferenceconstant {viewb} {:b:} % view reference test b +\definereferenceconstant {page} {:p:} % page referece +\definereferenceconstant {list} {:l:} % list reference +\definereferenceconstant {exec} {:e:} % execution reference +\definereferenceconstant {form} {:m:} % form reference +\definereferenceconstant {syst} {:s:} % system reference + +\definereferenceconstant {from} {:f:} % from list reference +\definereferenceconstant {to} {:t:} % to list reference + +\definereferenceconstant {object} {:o:} % object reference +\definereferenceconstant {driver} {:d:} % driver object reference +\definereferenceconstant {widget} {:w:} % field chain reference + +\definereferenceconstant {java} {:j:} % java scripts + +%D When we use numbers and dimensions the same applies as +%D with the keywords like \type{width} and \type{plus} +%D mentioned earlier. + +\def\!!ten {10} +\def\!!twelve {12} +\def\!!hundred {100} +\def\!!thousand {1000} +\def\!!tenthousand {10000} +\def\!!maxcard {65536} +\def\!!medcard {32768} + +\def\!!zeropoint {0pt} +\def\!!onepoint {1pt} +\def\!!twopoint {2pt} +\def\!!threepoint {3pt} +\def\!!fourpoint {4pt} +\def\!!fivepoint {5pt} +\def\!!sixpoint {6pt} +\def\!!sevenpoint {7pt} +\def\!!eightpoint {8pt} +\def\!!ninepoint {9pt} +\def\!!tenpoint {10pt} +\def\!!elevenpoint {11pt} +\def\!!twelvepoint {12pt} +\def\!!fourteenpointfour {14.4pt} + +\let\onerealpoint\onepoint % needed for latex + +% D Another optimization is: +% +% \let\points\onepoint + +%D A rough test is: +%D +%D \starttyping +%D \def\TestMe % 7.75 sec on a P4/2G +%D {\dimen0=10\points\dimen0=10\points\dimen0=10\points\dimen0=10\points\dimen0=10\points +%D \dimen0=10\points\dimen0=10\points\dimen0=10\points\dimen0=10\points\dimen0=10\points} +%D +%D \def\TestMe % 11.5 sec on a P4/2G +%D {\dimen0=10pt\dimen0=10pt\dimen0=10pt\dimen0=10pt\dimen0=10pt% +%D \dimen0=10pt\dimen0=10pt\dimen0=10pt\dimen0=10pt\dimen0=10pt} +%D +%D \def\TestMe % 12.5 sec on a P4/2G +%D {\dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt% +%D \dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt} +%D +%D \testfeatureonce {500000}{\TestMe} +%D \stoptyping + +%D Variables are composed of a command specific tag and a user +%D supplied variable (system constant). The first tag \type{ag} +%D for instance is available as \type{\??ag} and expands to +%D \type{@@ag} in composed variables. + +% vervallen : hd hr hm vt vr vm tr tn te br bm bo on om or + +\definesystemvariable {ab} % AlignedBoxes +\definesystemvariable {ac} % ACcent +\definesystemvariable {ae} % AttributEs +\definesystemvariable {ag} % AchterGrond +\definesystemvariable {al} % ALinea's +\definesystemvariable {am} % interActieMenu +\definesystemvariable {an} % ANchor +\definesystemvariable {as} % AlignmentSwitch +\definesystemvariable {at} % ATtachments +\definesystemvariable {ba} % synchronisatieBAlk +\definesystemvariable {bc} % BaCkend +\definesystemvariable {be} % startstop (BeginEnd) +\definesystemvariable {bj} % BlokJe +\definesystemvariable {bk} % Blokken (floats) +\definesystemvariable {bl} % BLanko +\definesystemvariable {bg} % BleedinG +\definesystemvariable {bm} % BookMark +\definesystemvariable {bo} % BlankO (definitions) +\definesystemvariable {bp} % BreakPoint +\definesystemvariable {br} % sideBaR +\definesystemvariable {bs} % SelecteerBlokken +\definesystemvariable {bt} % BuTton +\definesystemvariable {bu} % BUffer +\definesystemvariable {bv} % Brieven +\definesystemvariable {by} % Per +\definesystemvariable {cb} % CollectBox +\definesystemvariable {cc} % Comment +\definesystemvariable {ce} % CasEs +\definesystemvariable {cf} % Style (ColorFont) +\definesystemvariable {ch} % CHaracterspacing +\definesystemvariable {ci} % CItaat +\definesystemvariable {ck} % Character Kerning +\definesystemvariable {cl} % kleur (CoLor setup) +\definesystemvariable {cn} % CollumN +\definesystemvariable {cm} % CheMical +\definesystemvariable {co} % COmbinaties +\definesystemvariable {cp} % CliP +\definesystemvariable {cr} % kleur (ColoR) +\definesystemvariable {cs} % kleur (ColorSeparation +\definesystemvariable {cv} % ConVersie +\definesystemvariable {cy} % CrYteria +\definesystemvariable {da} % DAte +\definesystemvariable {db} % Labels +\definesystemvariable {dc} % DroppedCaps +\definesystemvariable {dd} % DoorDefinieren +\definesystemvariable {de} % DEel +\definesystemvariable {di} % DIrections +\definesystemvariable {dl} % DunneLijnen +\definesystemvariable {dn} % DoorNummeren +\definesystemvariable {dm} % DefineMeasure +\definesystemvariable {do} % DefinieerOpmaak +\definesystemvariable {du} % DUmmy +\definesystemvariable {ds} % DoorSpringen +\definesystemvariable {ef} % ExternFiguur +\definesystemvariable {ec} % EnCoding +\definesystemvariable {el} % Elements +\definesystemvariable {en} % ENvironments +\definesystemvariable {ep} % ExternfiguurPreset +\definesystemvariable {eq} % EQalign +\definesystemvariable {er} % external resources +\definesystemvariable {et} % EffecT +\definesystemvariable {ex} % ExterneFiguren +\definesystemvariable {fa} % font feature +\definesystemvariable {fb} % FieldBody +\definesystemvariable {fc} % FramedContent +\definesystemvariable {fd} % FielDgroup +\definesystemvariable {fe} % FoxetExtensions +\definesystemvariable {ff} % FontFile +\definesystemvariable {fg} % FiGuurmaten +\definesystemvariable {fi} % FIle +\definesystemvariable {fl} % Floats +\definesystemvariable {fm} % ForMules +\definesystemvariable {fn} % subformulas +\definesystemvariable {fo} % xml FO +\definesystemvariable {fp} % FilegroeP +\definesystemvariable {fq} % Features +\definesystemvariable {fr} % ForM +\definesystemvariable {fs} % FileSynonym +\definesystemvariable {ft} % FonTs +\definesystemvariable {fu} % FontSolution +\definesystemvariable {fv} % FontVariant +\definesystemvariable {fw} % simpleFonts by Wolfgang +\definesystemvariable {fx} % FoXet +\definesystemvariable {gr} % GRid +\definesystemvariable {ha} % HAng +\definesystemvariable {hs} % HSpace +\definesystemvariable {ht} % HiddenText +\definesystemvariable {ia} % Interactie +\definesystemvariable {ib} % InteractieBalk +\definesystemvariable {ic} % ICc profiles +\definesystemvariable {id} % Index +\definesystemvariable {ig} % ItemGroup +\definesystemvariable {ih} % InHoudsopgave +\definesystemvariable {ii} % stelIndexIn +\definesystemvariable {il} % stelInvulRegelsin +\definesystemvariable {im} % InMarge +\definesystemvariable {in} % INspringen +\definesystemvariable {ip} % InsertPages +\definesystemvariable {is} % Items +\definesystemvariable {it} % stelInTerliniein +\definesystemvariable {iv} % stelInvulLijnenin +\definesystemvariable {ka} % KAntlijn +\definesystemvariable {kd} % KaDerteksten +\definesystemvariable {kj} % KopJes (floats) +\definesystemvariable {kk} % Kapitalen +\definesystemvariable {kl} % KoLommen +\definesystemvariable {km} % KenMerk +\definesystemvariable {ko} % KOp(pen) +\definesystemvariable {kp} % KopPelteken +\definesystemvariable {kr} % KoRps +\definesystemvariable {ks} % KolomSpan +\definesystemvariable {kt} % KonTakten +\definesystemvariable {kw} % KontaktWaarde +\definesystemvariable {la} % LAnguage +\definesystemvariable {lb} % LaBels +\definesystemvariable {ld} % LegenDa +\definesystemvariable {le} % LinetablE +\definesystemvariable {lf} % LocalFigures +\definesystemvariable {lg} % taal (LanGuage) +\definesystemvariable {li} % LIjst +\definesystemvariable {lk} % LinK +\definesystemvariable {ll} % Layers +\definesystemvariable {lx} % LayerteXt +\definesystemvariable {ln} % LijNen +\definesystemvariable {lo} % LOgos +\definesystemvariable {lt} % LiTeratuur +\definesystemvariable {lr} % LayeR +\definesystemvariable {ls} % languageScript +\definesystemvariable {ly} % LaYout +\definesystemvariable {ma} % MargeAchtergrond +\definesystemvariable {mb} % MargeBlokken +\definesystemvariable {mc} % MarginCategory +\definesystemvariable {md} % MoDule +\definesystemvariable {me} % MultilingualElement (tags) +\definesystemvariable {mf} % MarginFramed +\definesystemvariable {mg} % Metapost paGe +\definesystemvariable {mh} % MultilingualHead +\definesystemvariable {mk} % MarKering +\definesystemvariable {ml} % MultilingualLabel +\definesystemvariable {mm} % MultilingualMath +\definesystemvariable {mt} % inline MaTh +\definesystemvariable {mo} % Math Options +\definesystemvariable {mp} % MetaPost +\definesystemvariable {mx} % MatriX +\definesystemvariable {ng} % parbuilders +\definesystemvariable {nh} % new heads (structure) +\definesystemvariable {nn} % structurenumbering +\definesystemvariable {nm} % Nummering +\definesystemvariable {np} % NaastPlaatsen +\definesystemvariable {nr} % Nummeren +\definesystemvariable {of} % OFfset +\definesystemvariable {oi} % OmlijndInstellingen +\definesystemvariable {ol} % OmLijnd +\definesystemvariable {od} % Omlijnd Defaults (simple) +\definesystemvariable {on} % ONderstreep +\definesystemvariable {oo} % OpsOmmingen +\definesystemvariable {op} % OPsomming +\definesystemvariable {or} % OtpfilteR +\definesystemvariable {os} % OffSet +\definesystemvariable {ot} % OTpsequence +\definesystemvariable {ov} % OVerlay +\definesystemvariable {ox} % OffsetBox +\definesystemvariable {pa} % PAlet +\definesystemvariable {pb} % PuBlication +\definesystemvariable {pc} % PageComment +\definesystemvariable {pe} % PagEhandler +\definesystemvariable {pf} % ProFiel +\definesystemvariable {pg} % KoppelPagina +\definesystemvariable {ph} % ParagrapH +\definesystemvariable {pl} % PLaats +\definesystemvariable {pn} % PaginaNummer +\definesystemvariable {po} % PrOcessor +\definesystemvariable {pp} % PaPier +\definesystemvariable {pr} % PRogrammas +\definesystemvariable {ps} % PoSitioneren +\definesystemvariable {pt} % PageshifT +\definesystemvariable {px} % Parallel +\definesystemvariable {py} % PropertYs +\definesystemvariable {pv} % PublicationVariable +\definesystemvariable {ra} % RAise +\definesystemvariable {rd} % RenDering +\definesystemvariable {rf} % ReFereren +\definesystemvariable {rg} % ReGel +\definesystemvariable {rl} % ReferentieLijst +\definesystemvariable {rn} % RegelNummer +\definesystemvariable {ro} % ROteren +\definesystemvariable {rr} % linenotes +\definesystemvariable {rs} % RaSters +\definesystemvariable {rt} % RoosTers +\definesystemvariable {rv} % ReserVeerfiguur +\definesystemvariable {rw} % RenderingWindow +\definesystemvariable {sa} % ScAle +\definesystemvariable {sb} % SectieBlok +\definesystemvariable {sc} % SCherm +\definesystemvariable {sd} % SounD +\definesystemvariable {se} % SEctie +\definesystemvariable {sf} % SpeciFics +\definesystemvariable {sg} % SpacinG +\definesystemvariable {sh} % ShapeText +\definesystemvariable {si} % SplIt +\definesystemvariable {sk} % SectieKop +\definesystemvariable {sl} % SmalLer +\definesystemvariable {sm} % SynonieMen +\definesystemvariable {sn} % SubNummer +\definesystemvariable {so} % SOrteren +\definesystemvariable {sp} % SelecteerPapier +\definesystemvariable {sr} % SpacehandleR +\definesystemvariable {ss} % Symbool +\definesystemvariable {st} % STickers +\definesystemvariable {su} % SetUp +\definesystemvariable {sv} % SysteemVariabelen +\definesystemvariable {sw} % SectionWorld +\definesystemvariable {sx} % Selector +\definesystemvariable {sy} % SYnchronisatie +\definesystemvariable {ta} % TAb +\definesystemvariable {tb} % TekstBlokken +\definesystemvariable {td} % TextbackgrounDs +\definesystemvariable {te} % TEmplate +\definesystemvariable {tf} % TypeFace +\definesystemvariable {tg} % Tex paGe +\definesystemvariable {ti} % TabelInstellingen +\definesystemvariable {tk} % Teksten +\definesystemvariable {tl} % TekstLijnen +\definesystemvariable {tm} % TypesynonyM +\definesystemvariable {to} % TOlerance +\definesystemvariable {tp} % TyPen +\definesystemvariable {tr} % TRacer +\definesystemvariable {ts} % TypeScript +\definesystemvariable {tt} % TabulaTe +\definesystemvariable {tx} % TeXtflow +\definesystemvariable {ty} % TYpe +\definesystemvariable {uc} % Unicode +\definesystemvariable {ui} % UItvoer +\definesystemvariable {ur} % URl +\definesystemvariable {up} % Utility Program +\definesystemvariable {va} % VspAce +\definesystemvariable {ve} % VErsie +\definesystemvariable {vn} % VoetNoten +\definesystemvariable {vs} % VSpacing +\definesystemvariable {vt} % VerTical +\definesystemvariable {wl} % WordList +\definesystemvariable {wr} % WitRuimte +\definesystemvariable {xf} % XML File +\definesystemvariable {xl} % lxml (mkiv) +\definesystemvariable {wl} % WidgetLabel +\definesystemvariable {wc} % WidgetContent +\definesystemvariable {wt} % WidgetTotal +\definesystemvariable {ws} % WidgetStack +\definesystemvariable {wh} % WidgetHelp +\definesystemvariable {wp} % WidgetPopuphelp +\definesystemvariable {xm} % xml (mkiv) +\definesystemvariable {xp} % XML Processing +\definesystemvariable {xy} % schaal +\definesystemvariable {za} % ZetspiegelAanpassing + +%D Next we define some language independant one letter +%D variables and keywords. + +\defineinterfaceconstant {x} {x} % x offset +\defineinterfaceconstant {y} {y} % y offset +\defineinterfaceconstant {w} {w} % width +\defineinterfaceconstant {h} {h} % height +\defineinterfaceconstant {s} {s} % size +\defineinterfaceconstant {t} {t} % title +\defineinterfaceconstant {c} {c} % creator +\defineinterfaceconstant {e} {e} % extension +\defineinterfaceconstant {f} {f} % file + +\defineinterfaceconstant {a} {a} % kunnen weg +\defineinterfaceconstant {b} {b} % kunnen weg +\defineinterfaceconstant {c} {c} % kunnen weg +\defineinterfaceconstant {d} {d} % kunnen weg +\defineinterfaceconstant {e} {e} % kunnen weg + +\defineinterfaceconstant {s} {s} +\defineinterfaceconstant {r} {r} +\defineinterfaceconstant {g} {g} +\defineinterfaceconstant {b} {b} +\defineinterfaceconstant {c} {c} +\defineinterfaceconstant {m} {m} +\defineinterfaceconstant {y} {y} +\defineinterfaceconstant {k} {k} +\defineinterfaceconstant {a} {a} % alternative +\defineinterfaceconstant {t} {t} % transparency +\defineinterfaceconstant {p} {p} % percentage + +\defineinterfaceconstant {t} {t} +\defineinterfaceconstant {h} {h} +\defineinterfaceconstant {b} {b} + +\defineinterfaceconstant {rgb} {rgb} +\defineinterfacevariable {rgb} {rgb} + +\defineinterfaceconstant {cmyk} {cmyk} +\defineinterfacevariable {cmyk} {cmyk} + +\defineinterfaceconstant {mp} {mp} +\defineinterfacevariable {mp} {mp} + +\defineinterfacevariable {s} {s} + +\defineinterfacevariable {a} {a} +\defineinterfacevariable {b} {b} +\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: +%D \type{tu}. + +\definefileconstant {utilityfilename} {texutil} + +\definefileconstant {blockextension} {tub} +\definefileconstant {figureextension} {tuf} +\definefileconstant {inputextension} {tui} +\definefileconstant {outputextension} {tuo} % tup for previous run +\definefileconstant {optionextension} {top} +\definefileconstant {temporaryextension} {tmp} +\definefileconstant {patternsextension} {pat} +\definefileconstant {hyphensextension} {hyp} +\definefileconstant {fontmapextension} {map} +\definefileconstant {bibextension} {bbl} + +%D These files are loaded at start||up. They may contain system +%D specific setups (or calls to other files), old macro's, to +%D garantee compatibility and new macro's noy yet present in +%D the format. + +\definefileconstant {errfilename} {cont-err} +\definefileconstant {sysfilename} {cont-sys} +\definefileconstant {newfilename} {cont-new} +\definefileconstant {locfilename} {cont-loc} +\definefileconstant {expfilename} {cont-exp} + +%D Handy for typescripts (we could use s! instead: + +\definetypescriptconstant {name} {name} +\definetypescriptconstant {default} {default} +\definetypescriptconstant {map} {map} +\definetypescriptconstant {special} {special} +\definetypescriptconstant {size} {size} + + +%D The setup files for the language, font, color and special +%D subsystems have a common prefix. This means that we have at +%D most three characters for unique filenames. + +\definefileconstant {colorprefix} {colo-} +\definefileconstant {encodingprefix} {enco-} +\definefileconstant {filterprefix} {filt-} +\definefileconstant {fontprefix} {font-} +%definefileconstant {handlingprefix} {hand-} +%definefileconstant {javascriptprefix} {java-} +%definefileconstant {languageprefix} {lang-} +\definefileconstant {mathprefix} {math-} +\definefileconstant {metapostprefix} {meta-} +%definefileconstant {regimeprefix} {regi-} +%definefileconstant {specialprefix} {spec-} +\definefileconstant {symbolprefix} {symb-} +\definefileconstant {typeprefix} {type-} +\definefileconstant {xtagprefix} {xtag-} +%definefileconstant {propprefix} {prop-} +%definefileconstant {unicprefix} {unic-} +%definefileconstant {sortprefix} {sort-} +%definefileconstant {prettyprefix} {pret-} + +\definefileconstant {moduleprefix} {m-} +\definefileconstant {styleprefix} {s-} +\definefileconstant {xstyleprefix} {x-} +\definefileconstant {privateprefix} {p-} +\definefileconstant {thirdprefix} {t-} + +%definefileconstant {beforeprefix} {b-} +%definefileconstant {afterprefix} {a-} + +%D \CONTEXT\ follows different strategies for finding files. +%D The macros that are responsible for this 'clever' searching +%D make use of two (very important) path specifiers. + +\definefileconstant {pathseparator} {/} +\definefileconstant {currentpath} {.} +\definefileconstant {parentpath} {..} + +%D The way fonts are defined and called upon is language +%D independant. We follow the scheme laid down by Knuth in +%D Plain \TEX. We'll explain their meaning later. + +\defineinterfaceconstant {tf} {tf} +\defineinterfaceconstant {bf} {bf} +\defineinterfaceconstant {bs} {bs} +\defineinterfaceconstant {bi} {bi} +\defineinterfaceconstant {sl} {sl} +\defineinterfaceconstant {it} {it} +\defineinterfaceconstant {sc} {sc} +\defineinterfaceconstant {rm} {rm} +\defineinterfaceconstant {ss} {ss} +\defineinterfaceconstant {tt} {tt} +\defineinterfaceconstant {hw} {hw} +\defineinterfaceconstant {cg} {cg} +\defineinterfaceconstant {os} {os} +\defineinterfaceconstant {mm} {mm} +\defineinterfaceconstant {i} {i} +\defineinterfaceconstant {nn} {nn} + +\defineinterfaceconstant {x} {x} +\defineinterfaceconstant {xx} {xx} + +\defineinterfaceconstant {em} {em} + +\defineinterfaceconstant {mi} {mi} +\defineinterfaceconstant {sy} {sy} +\defineinterfaceconstant {ex} {ex} +\defineinterfaceconstant {mr} {mr} + +\defineinterfaceconstant {ma} {ma} +\defineinterfaceconstant {mb} {mb} +\defineinterfaceconstant {mc} {mc} + +%D For figure inclusion we need: + +\defineinterfaceconstant {tif} {tif} +\defineinterfaceconstant {eps} {eps} +\defineinterfaceconstant {mps} {mps} +\defineinterfaceconstant {jpg} {jpg} +\defineinterfaceconstant {pdf} {pdf} +\defineinterfaceconstant {png} {png} +\defineinterfaceconstant {avi} {avi} +\defineinterfaceconstant {mov} {mov} +\defineinterfaceconstant {svg} {svg} +\defineinterfaceconstant {tex} {tex} +\defineinterfaceconstant {tmp} {tmp} +\defineinterfaceconstant {cld} {cld} + +%D A careful reader will have noticed that in the module +%D \type{mult-ini} we defined \type{\selectinterface}. We were +%D not yet able to actually select an interface, because we +%D still had to define the constants and variables. Now we've +%D done so, selection is permitted. + +\selectinterface + +%D Ok, here are some more, because we've got ouselves some +%D extensions to \CONTEXT. + +\definemessageconstant {addresses} +\definemessageconstant {documents} + +\protect + +\endinput diff --git a/Master/texmf-dist/tex/context/base/mult-sys.tex b/Master/texmf-dist/tex/context/base/mult-sys.tex deleted file mode 100644 index d48ce0a94e6..00000000000 --- a/Master/texmf-dist/tex/context/base/mult-sys.tex +++ /dev/null @@ -1,882 +0,0 @@ -%D \module -%D [ file=mult-sys, -%D version=1996.06.01, -%D title=\CONTEXT\ Multilingual 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 In boring module we define a lot of obscure but useful -%D system constants. By doing so we save lots of memory while -%D at the same time we prevent ourself from typing errors. - -\writestatus{loading}{ConTeXt Multilingual Macros / System} - -\unprotect - -%D The constants are grouped in such a way that there is a -%D minimal change of conflicts. -%D -%D \starttyping -%D \definesystemconstants {word} -%D \definemessageconstant {word} -%D \stoptyping -%D -%D This commands generate \type{\s!word} and \type{\m!word}. - -\definesystemconstant {hans} -\definesystemconstant {taco} - -%D First we define some system constants used for both the -%D multi||lingual interface and multi||linguag typesetting. - -\definesystemconstant {afrikaans} \definesystemconstant {af} -\definesystemconstant {arabic} \definesystemconstant {ar} -\definesystemconstant {catalan} \definesystemconstant {ca} -\definesystemconstant {chinese} \definesystemconstant {cn} -\definesystemconstant {croatian} \definesystemconstant {hr} -\definesystemconstant {czech} \definesystemconstant {cs} \definesystemconstant {cz} -\definesystemconstant {danish} \definesystemconstant {da} -\definesystemconstant {dutch} \definesystemconstant {nl} -\definesystemconstant {english} \definesystemconstant {en} -\definesystemconstant {finish} \definesystemconstant {fi} -\definesystemconstant {french} \definesystemconstant {fr} -\definesystemconstant {german} \definesystemconstant {de} -\definesystemconstant {hungarian} \definesystemconstant {hu} -\definesystemconstant {italian} \definesystemconstant {it} -\definesystemconstant {latin} \definesystemconstant {la} -\definesystemconstant {lithuanian} \definesystemconstant {lt} -\definesystemconstant {bokmal} \definesystemconstant {nb} \definesystemconstant {norwegian} \definesystemconstant {no} -\definesystemconstant {nynorsk} \definesystemconstant {nn} -\definesystemconstant {polish} \definesystemconstant {pl} -\definesystemconstant {persian} \definesystemconstant {pe} -\definesystemconstant {portuguese} \definesystemconstant {pt} -\definesystemconstant {romanian} \definesystemconstant {ro} -\definesystemconstant {russian} \definesystemconstant {ru} -\definesystemconstant {slovak} \definesystemconstant {sk} -\definesystemconstant {slovenian} \definesystemconstant {sl} -\definesystemconstant {slovene} -\definesystemconstant {spanish} \definesystemconstant {es} -\definesystemconstant {swedish} \definesystemconstant {sv} -\definesystemconstant {turkish} \definesystemconstant {tr} -\definesystemconstant {turkmen} \definesystemconstant {tk} -\definesystemconstant {gbenglish} \definesystemconstant {gb} \definesystemconstant {ukenglish} \definesystemconstant {uk} -\definesystemconstant {usenglish} \definesystemconstant {us} -\definesystemconstant {ukrainian} \definesystemconstant {ua} -\definesystemconstant {greek} \definesystemconstant {gr} -\definesystemconstant {ancientgreek} \definesystemconstant {agr} -\definesystemconstant {vietnamese} \definesystemconstant {vi} \definesystemconstant {vn} - -%D For proper \UNICODE\ support we need a few font related -%D constants. - -\definesystemconstant {BoldItalic} -\definesystemconstant {BoldSlanted} -\definesystemconstant {Bold} -\definesystemconstant {Italic} -\definesystemconstant {Regular} -\definesystemconstant {Slanted} -\definesystemconstant {Unicode} - -\definesystemconstant {Serif} \definesystemconstant {Regular} -\definesystemconstant {Sans} \definesystemconstant {Support} -\definesystemconstant {Mono} \definesystemconstant {Type} -\definesystemconstant {Math} -\definesystemconstant {Handwriting} -\definesystemconstant {Calligraphy} -\definesystemconstant {Casual} - -\definesystemconstant {SerifBold} \definesystemconstant {SansBold} \definesystemconstant {MonoBold} -\definesystemconstant {SerifItalic} \definesystemconstant {SansItalic} \definesystemconstant {MonoItalic} -\definesystemconstant {SerifBoldItalic} \definesystemconstant {SansBoldItalic} \definesystemconstant {MonoBoldItalic} -\definesystemconstant {SerifSlanted} \definesystemconstant {SansSlanted} \definesystemconstant {MonoSlanted} -\definesystemconstant {SerifBoldSlanted} \definesystemconstant {SansBoldSlanted} \definesystemconstant {MonoBoldSlanted} -\definesystemconstant {SerifCaps} \definesystemconstant {SansCaps} \definesystemconstant {MonoCaps} - -\definesystemconstant {Normal} -\definesystemconstant {Caps} - -\definesystemconstant {mnem} % kind of generic short tag - -\definesystemconstant {file} -\definesystemconstant {name} -\definesystemconstant {spec} - -\definesystemconstant {serif} -\definesystemconstant {sans} -\definesystemconstant {mono} -\definesystemconstant {math} -\definesystemconstant {handwriting} -\definesystemconstant {calligraphy} -\definesystemconstant {casual} -\definesystemconstant {fax} - -\definesystemconstant {fallback} - -\definesystemconstant {none} -\definesystemconstant {default} -\definesystemconstant {smallcaps} - -%D As the name of their define command states, the next set of -%D constants is used in the message macro's. - -\definemessageconstant {check} -\definemessageconstant {colors} -\definemessageconstant {columns} -\definemessageconstant {encodings} -\definemessageconstant {regimes} -\definemessageconstant {figures} -\definemessageconstant {fields} -\definemessageconstant {files} -\definemessageconstant {floatblocks} -\definemessageconstant {fonts} -\definemessageconstant {handlings} -\definemessageconstant {interactions} -\definemessageconstant {javascript} -\definemessageconstant {layouts} -\definemessageconstant {linguals} -\definemessageconstant {references} -\definemessageconstant {specials} -\definemessageconstant {structures} -\definemessageconstant {symbols} -\definemessageconstant {systems} -\definemessageconstant {lua} -\definemessageconstant {textblocks} -\definemessageconstant {verbatims} -\definemessageconstant {versions} -\definemessageconstant {metapost} -\definemessageconstant {chemicals} -\definemessageconstant {publications} - -%D Net come some \CONTEXT\ constants, used in the definition -%D of private commands: - -\definesystemconstant {tex} -\definesystemconstant {xml} -\definesystemconstant {lua} - -\definesystemconstant {next} -\definesystemconstant {pickup} -\definesystemconstant {ascii} -\definesystemconstant {default} -\definesystemconstant {unknown} -\definesystemconstant {action} -\definesystemconstant {compare} -\definesystemconstant {do} -\definesystemconstant {dodo} -\definesystemconstant {complex} -\definesystemconstant {simple} -\definesystemconstant {start} -\definesystemconstant {stop} -\definesystemconstant {dummy} -\definesystemconstant {local} -\definesystemconstant {global} -\definesystemconstant {done} -\definesystemconstant {font} -\definesystemconstant {link} -\definesystemconstant {parent} -\definesystemconstant {clone} -\definesystemconstant {section} \let\v!sectionlevel\s!section % for old times sake -\definesystemconstant {handler} -\definesystemconstant {counter} -\definesystemconstant {single} -\definesystemconstant {multi} - -\definesystemconstant {hasnumber} -\definesystemconstant {hastitle} -\definesystemconstant {hascaption} -\definesystemconstant {haslevel} - -\definesystemconstant {mkiv} -\definesystemconstant {mkii} -\definesystemconstant {entities} - -\definesystemconstant {normal} -\definesystemconstant {bold} -\definesystemconstant {italic} -\definesystemconstant {slanted} - -\definesystemconstant {default} -\definesystemconstant {smallcaps} - -%D A more experienced \TEX\ user will recognize the next four -%D constants. We need these because font-definitions are -%D partially english. - -\definesystemconstant {run} - -\definesystemconstant {fam} -\definesystemconstant {text} -\definesystemconstant {script} -\definesystemconstant {scriptscript} - -\definesystemconstant {lefthyphenmin} -\definesystemconstant {righthyphenmin} - -\definesystemconstant {skewchar} -\definesystemconstant {hyphenchar} -\definesystemconstant {catcodes} -\definesystemconstant {encoding} -\definesystemconstant {resource} -\definesystemconstant {mapping} -\definesystemconstant {language} -\definesystemconstant {patterns} -\definesystemconstant {rname} -\definesystemconstant {rscale} -\definesystemconstant {handling} -\definesystemconstant {features} -\definesystemconstant {fallbacks} -\definesystemconstant {background} -\definesystemconstant {ucmap} - -\definesystemconstant {property} -\definesystemconstant {overprint} -\definesystemconstant {layer} -\definesystemconstant {effect} -\definesystemconstant {negative} -\definesystemconstant {color} -\definesystemconstant {transparency} - -\definesystemconstant {black} -\definesystemconstant {white} - -\definesystemconstant {format} -\definesystemconstant {extensions} -\definesystemconstant {initializations} - -%D Just to be complete we define the standard \TEX\ units. - -\definesystemconstant {cm} -\definesystemconstant {em} -\definesystemconstant {ex} -\definesystemconstant {mm} -\definesystemconstant {pt} -\definesystemconstant {sp} -\definesystemconstant {bp} -\definesystemconstant {in} -\definesystemconstant {pc} -\definesystemconstant {cm} -\definesystemconstant {dd} -\definesystemconstant {cc} -\definesystemconstant {nd} -\definesystemconstant {nc} - -%D These constants are used for internal and utility -%D commands. - -\definesystemconstant {check} -\definesystemconstant {reset} -\definesystemconstant {set} - -\definesystemconstant {entrya} -\definesystemconstant {entryb} -\definesystemconstant {entryc} -\definesystemconstant {entryd} -\definesystemconstant {entry} -\definesystemconstant {see} -\definesystemconstant {from} -\definesystemconstant {to} -\definesystemconstant {line} -\definesystemconstant {page} -\definesystemconstant {realpage} -\definesystemconstant {userpage} -\definesystemconstant {subpage} - -\definesystemconstant {synonym} - -\definesystemconstant {reference} -\definesystemconstant {main} - -\definesystemconstant {list} - -\definesystemconstant {item} -\definesystemconstant {itemcount} - -\definesystemconstant {number} -\definesystemconstant {references} -\definesystemconstant {between} -\definesystemconstant {format} -\definesystemconstant {old} - -\definesystemconstant {thisisblock} -\definesystemconstant {thiswasblock} - -\definesystemconstant {figurepreset} - -\definesystemconstant {empty} - -%D Some \CONTEXT\ commands take a two||pass aproach to -%D optimize the typesetting. Each two||pass object has its -%D own tag. - -\definesystemconstant {pass} - -\definesystemconstant {data} -\definesystemconstant {float} -\definesystemconstant {list} -\definesystemconstant {page} -\definesystemconstant {subpage} -\definesystemconstant {margin} -\definesystemconstant {profile} -\definesystemconstant {versionbegin} -\definesystemconstant {versionend} -\definesystemconstant {cross} -\definesystemconstant {paragraph} - -%D A lot of macros use tags to distinguish between different -%D objects, e.g. lists and registers. - -\definesystemconstant {prt} % part (deel) -\definesystemconstant {chp} % chapter (hoofdstuk) -\definesystemconstant {sec} % section (paragraaf) -\definesystemconstant {tit} % title (titel) -\definesystemconstant {sub} % subject (onderwerp) -\definesystemconstant {mar} % margin (marge) -\definesystemconstant {num} % number (doornummeren) -\definesystemconstant {def} % definition (doordefinieren) -\definesystemconstant {for} % formula (formule) -\definesystemconstant {fnt} % footnote (voetnoot) -\definesystemconstant {ind} % index (register) -\definesystemconstant {lin} % linked index -\definesystemconstant {lst} % list (opsomming) -\definesystemconstant {flt} % float (plaatsblok) -\definesystemconstant {pag} % page (pagina) -\definesystemconstant {txt} % text (tekst) -\definesystemconstant {ref} % reference (verwijzing) -\definesystemconstant {lab} % label (label) -\definesystemconstant {aut} % automatic (inhoud, index) -\definesystemconstant {vwa} % automatic (illustrations) -\definesystemconstant {vwb} % automatic (illustrations) - -\definesystemconstant {kop} % kop % still dutch - -%D Reference labels can be tagged by users, for instance by -%D means of \type{tag:}. The reference mechanism itself uses -%D some tags too. These are definitely not to be used by users. -%D Here they are: - -\definereferenceconstant {cross} {:c:} % cross reference -\definereferenceconstant {view} {:v:} % view reference -\definereferenceconstant {viewa} {:a:} % view reference test a -\definereferenceconstant {viewb} {:b:} % view reference test b -\definereferenceconstant {page} {:p:} % page referece -\definereferenceconstant {list} {:l:} % list reference -\definereferenceconstant {exec} {:e:} % execution reference -\definereferenceconstant {form} {:m:} % form reference -\definereferenceconstant {syst} {:s:} % system reference - -\definereferenceconstant {from} {:f:} % from list reference -\definereferenceconstant {to} {:t:} % to list reference - -\definereferenceconstant {object} {:o:} % object reference -\definereferenceconstant {driver} {:d:} % driver object reference -\definereferenceconstant {widget} {:w:} % field chain reference - -\definereferenceconstant {java} {:j:} % java scripts - -%D When we use numbers and dimensions the same applies as -%D with the keywords like \type{width} and \type{plus} -%D mentioned earlier. - -\def\!!ten {10} -\def\!!twelve {12} -\def\!!hundred {100} -\def\!!thousand {1000} -\def\!!tenthousand {10000} -\def\!!maxcard {65536} -\def\!!medcard {32768} - -\def\!!zeropoint {0pt} -\def\!!onepoint {1pt} -\def\!!twopoint {2pt} -\def\!!threepoint {3pt} -\def\!!fourpoint {4pt} -\def\!!fivepoint {5pt} -\def\!!sixpoint {6pt} -\def\!!sevenpoint {7pt} -\def\!!eightpoint {8pt} -\def\!!ninepoint {9pt} -\def\!!tenpoint {10pt} -\def\!!elevenpoint {11pt} -\def\!!twelvepoint {12pt} -\def\!!fourteenpointfour {14.4pt} - -\let\onerealpoint\onepoint % needed for latex - -% D Another optimization is: -% -% \let\points\onepoint - -%D A rough test is: -%D -%D \starttyping -%D \def\TestMe % 7.75 sec on a P4/2G -%D {\dimen0=10\points\dimen0=10\points\dimen0=10\points\dimen0=10\points\dimen0=10\points -%D \dimen0=10\points\dimen0=10\points\dimen0=10\points\dimen0=10\points\dimen0=10\points} -%D -%D \def\TestMe % 11.5 sec on a P4/2G -%D {\dimen0=10pt\dimen0=10pt\dimen0=10pt\dimen0=10pt\dimen0=10pt% -%D \dimen0=10pt\dimen0=10pt\dimen0=10pt\dimen0=10pt\dimen0=10pt} -%D -%D \def\TestMe % 12.5 sec on a P4/2G -%D {\dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt% -%D \dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt\dimen0=10\s!pt} -%D -%D \testfeatureonce {500000}{\TestMe} -%D \stoptyping - -%D Variables are composed of a command specific tag and a user -%D supplied variable (system constant). The first tag \type{ag} -%D for instance is available as \type{\??ag} and expands to -%D \type{@@ag} in composed variables. - -% vervallen : hd hr hm vt vr vm tr tn te br bm bo on om or - -\definesystemvariable {ab} % AlignedBoxes -\definesystemvariable {ac} % ACcent -\definesystemvariable {ae} % AttributEs -\definesystemvariable {ag} % AchterGrond -\definesystemvariable {al} % ALinea's -\definesystemvariable {am} % interActieMenu -\definesystemvariable {an} % ANchor -\definesystemvariable {as} % AlignmentSwitch -\definesystemvariable {at} % ATtachments -\definesystemvariable {ba} % synchronisatieBAlk -\definesystemvariable {be} % startstop (BeginEnd) -\definesystemvariable {bj} % BlokJe -\definesystemvariable {bk} % Blokken (floats) -\definesystemvariable {bl} % BLanko -\definesystemvariable {bg} % BleedinG -\definesystemvariable {bo} % BlankO (definitions) -\definesystemvariable {bp} % BreakPoint -\definesystemvariable {br} % sideBaR -\definesystemvariable {bs} % SelecteerBlokken -\definesystemvariable {bt} % BuTton -\definesystemvariable {bu} % BUffer -\definesystemvariable {bv} % Brieven -\definesystemvariable {by} % Per -\definesystemvariable {cb} % CollectBox -\definesystemvariable {cc} % Comment -\definesystemvariable {ce} % CasEs -\definesystemvariable {ch} % CHaracterspacing -\definesystemvariable {ci} % CItaat -\definesystemvariable {ck} % Character Kerning -\definesystemvariable {cl} % kleur (CoLor setup) -\definesystemvariable {cn} % CollumN -\definesystemvariable {cm} % CheMical -\definesystemvariable {co} % COmbinaties -\definesystemvariable {cp} % CliP -\definesystemvariable {cr} % kleur (ColoR) -\definesystemvariable {cs} % kleur (ColorSeparation -\definesystemvariable {cv} % ConVersie -\definesystemvariable {cy} % CrYteria -\definesystemvariable {da} % DAte -\definesystemvariable {db} % Labels -\definesystemvariable {dc} % DroppedCaps -\definesystemvariable {dd} % DoorDefinieren -\definesystemvariable {de} % DEel -\definesystemvariable {di} % DIrections -\definesystemvariable {dl} % DunneLijnen -\definesystemvariable {dn} % DoorNummeren -\definesystemvariable {dm} % DefineMeasure -\definesystemvariable {do} % DefinieerOpmaak -\definesystemvariable {du} % DUmmy -\definesystemvariable {ds} % DoorSpringen -\definesystemvariable {ef} % ExternFiguur -\definesystemvariable {ec} % EnCoding -\definesystemvariable {en} % ENvironments -\definesystemvariable {ep} % ExternfiguurPreset -\definesystemvariable {eq} % EQalign -\definesystemvariable {er} % external resources -\definesystemvariable {ex} % ExterneFiguren -\definesystemvariable {fa} % font feature -\definesystemvariable {fc} % FramedContent -\definesystemvariable {fd} % FielD -\definesystemvariable {fe} % FoxetExtensions -\definesystemvariable {ff} % FontFile -\definesystemvariable {fg} % FiGuurmaten -\definesystemvariable {fi} % FIle -\definesystemvariable {fl} % Floats -\definesystemvariable {fm} % ForMules -\definesystemvariable {fn} % subformulas -\definesystemvariable {fo} % xml FO -\definesystemvariable {fp} % FilegroeP -\definesystemvariable {fq} % Features -\definesystemvariable {fr} % ForM -\definesystemvariable {fs} % FileSynonym -\definesystemvariable {ft} % FonTs -\definesystemvariable {fu} % FontSolution -\definesystemvariable {fv} % FontVariant -\definesystemvariable {fw} % simpleFonts by Wolfgang -\definesystemvariable {fx} % FoXet -\definesystemvariable {gr} % GRid -\definesystemvariable {ha} % HAng -\definesystemvariable {hs} % HSpace -\definesystemvariable {ht} % HiddenText -\definesystemvariable {ia} % Interactie -\definesystemvariable {ib} % InteractieBalk -\definesystemvariable {ic} % ICc profiles -\definesystemvariable {id} % Index -\definesystemvariable {ig} % ItemGroup -\definesystemvariable {ih} % InHoudsopgave -\definesystemvariable {ii} % stelIndexIn -\definesystemvariable {il} % stelInvulRegelsin -\definesystemvariable {im} % InMarge -\definesystemvariable {in} % INspringen -\definesystemvariable {ip} % InsertPages -\definesystemvariable {is} % Items -\definesystemvariable {it} % stelInTerliniein -\definesystemvariable {iv} % stelInvulLijnenin -\definesystemvariable {ka} % KAntlijn -\definesystemvariable {kd} % KaDerteksten -\definesystemvariable {kj} % KopJes (floats) -\definesystemvariable {kk} % Kapitalen -\definesystemvariable {kl} % KoLommen -\definesystemvariable {km} % KenMerk -\definesystemvariable {ko} % KOp(pen) -\definesystemvariable {kp} % KopPelteken -\definesystemvariable {kr} % KoRps -\definesystemvariable {ks} % KolomSpan -\definesystemvariable {kt} % KonTakten -\definesystemvariable {kw} % KontaktWaarde -\definesystemvariable {la} % LAnguage -\definesystemvariable {lb} % LaBels -\definesystemvariable {ld} % LegenDa -\definesystemvariable {le} % LinetablE -\definesystemvariable {lf} % LocalFigures -\definesystemvariable {lg} % taal (LanGuage) -\definesystemvariable {li} % LIjst -\definesystemvariable {lk} % LinK -\definesystemvariable {ll} % Layers -\definesystemvariable {lx} % LayerteXt -\definesystemvariable {ln} % LijNen -\definesystemvariable {lo} % LOgos -\definesystemvariable {lt} % LiTeratuur -\definesystemvariable {ls} % languageScript -\definesystemvariable {ly} % LaYout -\definesystemvariable {ma} % MargeAchtergrond -\definesystemvariable {mb} % MargeBlokken -\definesystemvariable {md} % MoDule -\definesystemvariable {mg} % Metapost paGe -\definesystemvariable {mh} % MultilingualHead -\definesystemvariable {mk} % MarKering -\definesystemvariable {ml} % MultilingualLabel -\definesystemvariable {mm} % MultilingualMath -\definesystemvariable {mt} % inline MaTh -\definesystemvariable {mo} % Math Options -\definesystemvariable {mp} % MetaPost -\definesystemvariable {mx} % MatriX -\definesystemvariable {ng} % parbuilders -\definesystemvariable {nh} % new heads (structure) -\definesystemvariable {nn} % structurenumbering -\definesystemvariable {nm} % Nummering -\definesystemvariable {np} % NaastPlaatsen -\definesystemvariable {nr} % Nummeren -\definesystemvariable {of} % OFfset -\definesystemvariable {oi} % OmlijndInstellingen -\definesystemvariable {ol} % OmLijnd -\definesystemvariable {od} % Omlijnd Defaults (simple) -\definesystemvariable {on} % ONderstreep -\definesystemvariable {oo} % OpsOmmingen -\definesystemvariable {op} % OPsomming -\definesystemvariable {or} % OtpfilteR -\definesystemvariable {os} % OffSet -\definesystemvariable {ot} % OTpsequence -\definesystemvariable {ov} % OVerlay -\definesystemvariable {ox} % OffsetBox -\definesystemvariable {pa} % PAlet -\definesystemvariable {pb} % PuBlication -\definesystemvariable {pc} % PageComment -\definesystemvariable {pe} % PagEhandler -\definesystemvariable {pf} % ProFiel -\definesystemvariable {pg} % KoppelPagina -\definesystemvariable {ph} % ParagrapH -\definesystemvariable {pl} % PLaats -\definesystemvariable {pn} % PaginaNummer -\definesystemvariable {po} % PrOcessor -\definesystemvariable {pp} % PaPier -\definesystemvariable {pr} % PRogrammas -\definesystemvariable {ps} % PoSitioneren -\definesystemvariable {pt} % PageshifT -\definesystemvariable {py} % PropertYs -\definesystemvariable {pv} % PublicationVariable -\definesystemvariable {ra} % RAise -\definesystemvariable {rd} % RenDering -\definesystemvariable {rf} % ReFereren -\definesystemvariable {rg} % ReGel -\definesystemvariable {rl} % ReferentieLijst -\definesystemvariable {rn} % RegelNummer -\definesystemvariable {ro} % ROteren -\definesystemvariable {rr} % linenotes -\definesystemvariable {rs} % RaSters -\definesystemvariable {rt} % RoosTers -\definesystemvariable {rv} % ReserVeerfiguur -\definesystemvariable {rw} % RenderingWindow -\definesystemvariable {sa} % ScAle -\definesystemvariable {sb} % SectieBlok -\definesystemvariable {sc} % SCherm -\definesystemvariable {sd} % SounD -\definesystemvariable {se} % SEctie -\definesystemvariable {sf} % SpeciFics -\definesystemvariable {sg} % SpacinG -\definesystemvariable {sh} % ShapeText -\definesystemvariable {si} % SplIt -\definesystemvariable {sk} % SectieKop -\definesystemvariable {sl} % SmalLer -\definesystemvariable {sm} % SynonieMen -\definesystemvariable {sn} % SubNummer -\definesystemvariable {so} % SOrteren -\definesystemvariable {sp} % SelecteerPapier -\definesystemvariable {sr} % SpacehandleR -\definesystemvariable {ss} % Symbool -\definesystemvariable {st} % STickers -\definesystemvariable {su} % SetUp -\definesystemvariable {sv} % SysteemVariabelen -\definesystemvariable {sw} % SectionWorld -\definesystemvariable {sx} % Selector -\definesystemvariable {sy} % SYnchronisatie -\definesystemvariable {ta} % TAb -\definesystemvariable {tb} % TekstBlokken -\definesystemvariable {td} % TextbackgrounDs -\definesystemvariable {te} % TEmplate -\definesystemvariable {tf} % TypeFace -\definesystemvariable {tg} % Tex paGe -\definesystemvariable {ti} % TabelInstellingen -\definesystemvariable {tk} % Teksten -\definesystemvariable {tl} % TekstLijnen -\definesystemvariable {tm} % TypesynonyM -\definesystemvariable {tp} % TyPen -\definesystemvariable {tx} % TeXtflow -\definesystemvariable {to} % TOlerance -\definesystemvariable {tr} % TRacer -\definesystemvariable {ts} % TypeScript -\definesystemvariable {tt} % TabulaTe -\definesystemvariable {ty} % TYpe -\definesystemvariable {uc} % Unicode -\definesystemvariable {ui} % UItvoer -\definesystemvariable {ur} % URl -\definesystemvariable {up} % Utility Program -\definesystemvariable {va} % VspAce -\definesystemvariable {ve} % VErsie -\definesystemvariable {vn} % VoetNoten -\definesystemvariable {vs} % VSpacing -\definesystemvariable {vt} % VerTical -\definesystemvariable {wr} % WitRuimte -\definesystemvariable {wl} % WordList -\definesystemvariable {xf} % XML File -\definesystemvariable {xl} % lxml (mkiv) -\definesystemvariable {xm} % xml (mkiv) -\definesystemvariable {xp} % XML Processing -\definesystemvariable {xy} % schaal -\definesystemvariable {za} % ZetspiegelAanpassing - -%D Next we define some language independant one letter -%D variables and keywords. - -\defineinterfaceconstant {x} {x} % x offset -\defineinterfaceconstant {y} {y} % y offset -\defineinterfaceconstant {w} {w} % width -\defineinterfaceconstant {h} {h} % height -\defineinterfaceconstant {s} {s} % size -\defineinterfaceconstant {t} {t} % title -\defineinterfaceconstant {c} {c} % creator -\defineinterfaceconstant {e} {e} % extension -\defineinterfaceconstant {f} {f} % file - -\defineinterfaceconstant {a} {a} % kunnen weg -\defineinterfaceconstant {b} {b} % kunnen weg -\defineinterfaceconstant {c} {c} % kunnen weg -\defineinterfaceconstant {d} {d} % kunnen weg -\defineinterfaceconstant {e} {e} % kunnen weg - -\defineinterfaceconstant {s} {s} -\defineinterfaceconstant {r} {r} -\defineinterfaceconstant {g} {g} -\defineinterfaceconstant {b} {b} -\defineinterfaceconstant {c} {c} -\defineinterfaceconstant {m} {m} -\defineinterfaceconstant {y} {y} -\defineinterfaceconstant {k} {k} -\defineinterfaceconstant {a} {a} % alternative -\defineinterfaceconstant {t} {t} % transparency -\defineinterfaceconstant {p} {p} % percentage - -\defineinterfaceconstant {t} {t} -\defineinterfaceconstant {h} {h} -\defineinterfaceconstant {b} {b} - -\defineinterfaceconstant {rgb} {rgb} -\defineinterfacevariable {rgb} {rgb} - -\defineinterfaceconstant {cmyk} {cmyk} -\defineinterfacevariable {cmyk} {cmyk} - -\defineinterfaceconstant {mp} {mp} -\defineinterfacevariable {mp} {mp} - -\defineinterfacevariable {s} {s} - -\defineinterfacevariable {a} {a} -\defineinterfacevariable {b} {b} -\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: -%D \type{tu}. - -\definefileconstant {utilityfilename} {texutil} - -\definefileconstant {blockextension} {tub} -\definefileconstant {figureextension} {tuf} -\definefileconstant {inputextension} {tui} -\definefileconstant {outputextension} {tuo} % tup for previous run -\definefileconstant {optionextension} {top} -\definefileconstant {temporaryextension} {tmp} -\definefileconstant {patternsextension} {pat} -\definefileconstant {hyphensextension} {hyp} -\definefileconstant {fontmapextension} {map} -\definefileconstant {bibextension} {bbl} - -%D These files are loaded at start||up. They may contain system -%D specific setups (or calls to other files), old macro's, to -%D garantee compatibility and new macro's noy yet present in -%D the format. - -\definefileconstant {errfilename} {cont-err} -\definefileconstant {sysfilename} {cont-sys} -\definefileconstant {oldfilename} {cont-old} -\definefileconstant {newfilename} {cont-new} -\definefileconstant {filfilename} {cont-fil} -\definefileconstant {modfilename} {cont-mod} - -%D Handy for typescripts (we could use s! instead: - -\definetypescriptconstant {name} {name} -\definetypescriptconstant {default} {default} -\definetypescriptconstant {map} {map} -\definetypescriptconstant {special} {special} -\definetypescriptconstant {size} {size} - -%D The next two files specify user settings as well as -%D \TEXEXEC\ settings when generating a format. - -\definefileconstant {usrfilename} {cont-usr} % .tex -\definefileconstant {fmtfilename} {cont-fmt} % .tex - -%D The setup files for the language, font, color and special -%D subsystems have a common prefix. This means that we have at -%D most three characters for unique filenames. - -\definefileconstant {colorprefix} {colo-} -\definefileconstant {encodingprefix} {enco-} -\definefileconstant {filterprefix} {filt-} -\definefileconstant {fontprefix} {font-} -\definefileconstant {handlingprefix} {hand-} -\definefileconstant {javascriptprefix} {java-} -\definefileconstant {languageprefix} {lang-} -\definefileconstant {mathprefix} {math-} -\definefileconstant {metapostprefix} {meta-} -\definefileconstant {regimeprefix} {regi-} -\definefileconstant {specialprefix} {spec-} -\definefileconstant {symbolprefix} {symb-} -\definefileconstant {typeprefix} {type-} -\definefileconstant {xtagprefix} {xtag-} -\definefileconstant {propprefix} {prop-} -\definefileconstant {unicprefix} {unic-} -\definefileconstant {sortprefix} {sort-} -\definefileconstant {prettyprefix} {pret-} - -\definefileconstant {moduleprefix} {m-} -\definefileconstant {styleprefix} {s-} -\definefileconstant {xstyleprefix} {x-} -\definefileconstant {privateprefix} {p-} -\definefileconstant {thirdprefix} {t-} - -%definefileconstant {beforeprefix} {b-} -%definefileconstant {afterprefix} {a-} - -%D \CONTEXT\ follows different strategies for finding files. -%D The macros that are responsible for this 'clever' searching -%D make use of two (very important) path specifiers. - -\definefileconstant {pathseparator} {/} -\definefileconstant {currentpath} {.} -\definefileconstant {parentpath} {..} - -%D The way fonts are defined and called upon is language -%D independant. We follow the scheme laid down by Knuth in -%D Plain \TEX. We'll explain their meaning later. - -\defineinterfaceconstant {tf} {tf} -\defineinterfaceconstant {bf} {bf} -\defineinterfaceconstant {bs} {bs} -\defineinterfaceconstant {bi} {bi} -\defineinterfaceconstant {sl} {sl} -\defineinterfaceconstant {it} {it} -\defineinterfaceconstant {sc} {sc} -\defineinterfaceconstant {rm} {rm} -\defineinterfaceconstant {ss} {ss} -\defineinterfaceconstant {tt} {tt} -\defineinterfaceconstant {hw} {hw} -\defineinterfaceconstant {cg} {cg} -\defineinterfaceconstant {os} {os} -\defineinterfaceconstant {mm} {mm} -\defineinterfaceconstant {i} {i} -\defineinterfaceconstant {nn} {nn} - -\defineinterfaceconstant {x} {x} -\defineinterfaceconstant {xx} {xx} - -\defineinterfaceconstant {em} {em} - -\defineinterfaceconstant {mi} {mi} -\defineinterfaceconstant {sy} {sy} -\defineinterfaceconstant {ex} {ex} -\defineinterfaceconstant {mr} {mr} - -\defineinterfaceconstant {ma} {ma} -\defineinterfaceconstant {mb} {mb} -\defineinterfaceconstant {mc} {mc} - -%D For figure inclusion we need: - -\defineinterfaceconstant {tif} {tif} -\defineinterfaceconstant {eps} {eps} -\defineinterfaceconstant {mps} {mps} -\defineinterfaceconstant {jpg} {jpg} -\defineinterfaceconstant {pdf} {pdf} -\defineinterfaceconstant {png} {png} -\defineinterfaceconstant {avi} {avi} -\defineinterfaceconstant {mov} {mov} -\defineinterfaceconstant {svg} {svg} -\defineinterfaceconstant {tex} {tex} -\defineinterfaceconstant {tmp} {tmp} - -%D A careful reader will have noticed that in the module -%D \type{mult-ini} we defined \type{\selectinterface}. We were -%D not yet able to actually select an interface, because we -%D still had to define the constants and variables. Now we've -%D done so, selection is permitted. - -\selectinterface - -%D Ok, here are some more, because we've got ouselves some -%D extensions to \CONTEXT. - -\definemessageconstant {addresses} -\definemessageconstant {documents} - -\protect - -\endinput diff --git a/Master/texmf-dist/tex/context/base/node-acc.lua b/Master/texmf-dist/tex/context/base/node-acc.lua new file mode 100644 index 00000000000..53740592102 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/node-acc.lua @@ -0,0 +1,113 @@ +if not modules then modules = { } end modules ['node-acc'] = { + version = 1.001, + comment = "companion to node-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local nodes, node = nodes, node + +local nodecodes = nodes.nodecodes +local tasks = nodes.tasks + +local traverse_nodes = node.traverse +local traverse_id = node.traverse_id +local has_attribute = node.has_attribute +local copy_node = node.copy +local free_nodelist = node.flush_list + +local glue_code = nodecodes.glue +local glyph_code = nodecodes.glyph +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist + +local function injectspaces(head) + local p + for n in traverse_nodes(head) do + local id = n.id + if id == glue_code then -- todo: check for subtype related to spacing (13/14 but most seems to be 0) + -- local at = has_attribute(n,attribute) + -- if at then + if p and p.id == glyph_code then + local g = copy_node(p) + local c = g.components + if c then -- it happens that we copied a ligature + free_nodelist(c) + g.components = nil + g.subtype = 256 + end + local s = copy_node(n.spec) + g.char, n.spec = 32, s + p.next, g.prev = g, p + g.next, n.prev = n, g + s.width = s.width - g.width + end + -- end + elseif id == hlist_code or id == vlist_code then + injectspaces(n.list,attribute) + end + p = n + end + return head, true +end + +nodes.handlers.accessibility = injectspaces + +-- todo: + +--~ local a_hyphenated = attributes.private('hyphenated') +--~ +--~ local hyphenated, codes = { }, { } +--~ +--~ local function compact(n) +--~ local t = { } +--~ for n in traverse_id(glyph_code,n) do +--~ t[#t+1] = utfchar(n.char) -- check for unicode +--~ end +--~ return concat(t,"") +--~ end +--~ +--~ local function injectspans(head) +--~ for n in traverse_nodes(head) do +--~ local id = n.id +--~ if id == disc then +--~ local r, p = n.replace, n.pre +--~ if r and p then +--~ local str = compact(r) +--~ local hsh = hyphenated[str] +--~ if not hsh then +--~ hsh = #codes + 1 +--~ hyphenated[str] = hsh +--~ codes[hsh] = str +--~ end +--~ set_attribute(n,a_hyphenated,hsh) +--~ end +--~ elseif id == hlist_code or id == vlist_code then +--~ injectspans(n.list) +--~ end +--~ end +--~ return head, true +--~ end +--~ +--~ nodes.injectspans = injectspans +--~ +--~ tasks.appendaction("processors", "words", "nodes.injectspans") +--~ +--~ local function injectspans(head) +--~ for n in traverse_nodes(head) do +--~ local id = n.id +--~ if id == disc then +--~ local a = has_attribute(n,a_hyphenated) +--~ if a then +--~ local str = codes[a] +--~ local b = new_pdfliteral(format("/Span << /ActualText %s >> BDC", lpdf.tosixteen(str))) +--~ local e = new_pdfliteral("EMC") +--~ node.insert_before(head,n,b) +--~ node.insert_after(head,n,e) +--~ end +--~ elseif id == hlist_code or id == vlist_code then +--~ injectspans(n.list) +--~ end +--~ end +--~ end diff --git a/Master/texmf-dist/tex/context/base/node-aux.lua b/Master/texmf-dist/tex/context/base/node-aux.lua index 9ed71fd728c..0b44f77248d 100644 --- a/Master/texmf-dist/tex/context/base/node-aux.lua +++ b/Master/texmf-dist/tex/context/base/node-aux.lua @@ -1,18 +1,46 @@ if not modules then modules = { } end modules ['node-aux'] = { version = 1.001, - comment = "companion to node-spl.mkiv", + comment = "companion to node-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } -local gsub, format = string.gsub, string.format +local type, tostring = type, tostring -local free_node = node.free -local hpack_nodes = node.hpack -local node_fields = node.fields +local nodes, node = nodes, node -function nodes.repack_hlist(list,...) +local utfvalues = string.utfvalues + +local nodecodes = nodes.nodecodes + +local glyph_code = nodecodes.glyph +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist + +local nodepool = nodes.pool + +local new_glue = nodepool.glue +local new_glyph = nodepool.glyph + +local traverse_nodes = node.traverse +local traverse_id = node.traverse_id +local free_node = node.free +local hpack_nodes = node.hpack +local has_attribute = node.has_attribute +local set_attribute = node.set_attribute +local get_attribute = node.get_attribute +local unset_attribute = node.unset_attribute +local first_glyph = node.first_glyph or node.first_character +local copy_node = node.copy +local slide_nodes = node.slide +local insert_node_after = node.insert_after +local isnode = node.is_node + +local texbox = tex.box + +function nodes.repackhlist(list,...) +--~ nodes.showsimplelist(list) local temp, b = hpack_nodes(list,...) list = temp.list temp.list = nil @@ -20,47 +48,49 @@ function nodes.repack_hlist(list,...) return list, b end -function nodes.merge(a,b) - if a and b then - local t = node.fields(a.id) - for i=3,#t do - local name = t[i] - a[name] = b[name] +local function set_attributes(head,attr,value) + for n in traverse_nodes(head) do + set_attribute(n,attr,value) + local id = n.id + if id == hlist_node or id == vlist_node then + set_attributes(n.list,attr,value) end end - return a, b end -local fields, whatsitfields = { }, { } - -for k, v in next, node.types() do - if v == "whatsit" then - fields[k], fields[v] = { }, { } - for kk, vv in next, node.whatsits() do - local f = node_fields(k,kk) - whatsitfields[kk], whatsitfields[vv] = f, f +local function set_unset_attributes(head,attr,value) + for n in traverse_nodes(head) do + if not has_attribute(n,attr) then + set_attribute(n,attr,value) + end + local id = n.id + if id == hlist_code or id == vlist_code then + set_unset_attributes(n.list,attr,value) end - else - local f = node_fields(k) - fields[k], fields[v] = f, f end end -nodes.fields, nodes.whatsitfields = fields, whatsitfields - -function nodes.info(n) - local id = n.id - local tp = node.type(id) - local list = (tp == "whatsit" and whatsitfields[n.subtype]) or fields[id] - logs.report(format("%14s","type"),tp) - for k,v in next, list do - logs.report(format("%14s",v),gsub(gsub(tostring(n[v]),"%s+"," "),"node ","")) +local function unset_attributes(head,attr) + for n in traverse_nodes(head) do + unset_attribute(n,attr) + local id = n.id + if id == hlist_code or id == vlist_code then + unset_attributes(n.list,attr) + end end end --- history: --- --- local function cp_skipable(a,id) -- skipable nodes at the margins during character protrusion +nodes.firstglyph = first_glyph +nodes.setattribute = set_attribute +nodes.getattribute = has_attribute +nodes.unsetattribute = unset_attribute +nodes.setattributes = set_attributes +nodes.setunsetattributes = set_unset_attributes +nodes.unsetattributes = unset_attributes + +nodes.has_attribute = has_attribute + +-- function nodes.is_skipable(a,id) -- skipable nodes at the margins during character protrusion -- return ( -- id ~= glyph_node -- or id == ins_node @@ -75,6 +105,9 @@ end -- or (id == whatsit_node and a.subtype ~= pdf_refximage_node and a.subtype ~= pdf_refxform_node) -- ) -- end + +-- history: +-- -- -- local function glyph_width(a) -- local ch = chardata[a.font][a.char] @@ -128,7 +161,7 @@ end -- local u = floor(x / 0x8000) * n + f -- 0100000 -- local v = floor(u % d) * 0x8000 + f -- 0100000 -- if floor(u / d) >= 0x8000 then -- 0100000 --- logs.error("parbuilder",'arith_error') +-- report_parbuilders('arith_error') -- else -- u = 0x8000 * floor(u / d) + floor(v / d) -- 0100000 -- end @@ -143,3 +176,144 @@ end -- end -- end +function nodes.firstcharacter(n,untagged) -- tagged == subtype > 255 + if untagged then + return first_glyph(n) + else + for g in traverse_id(glyph_code,n) do + return g + end + end +end + +function nodes.firstcharinbox(n) + local l = texbox[n].list + if l then + for g in traverse_id(glyph_code,l) do + return g.char + end + end + return 0 +end + +--~ local function firstline(n) +--~ while n do +--~ local id = n.id +--~ if id == hlist_code then +--~ if n.subtype == line_code then +--~ return n +--~ else +--~ return firstline(n.list) +--~ end +--~ elseif id == vlist_code then +--~ return firstline(n.list) +--~ end +--~ n = n.next +--~ end +--~ end + +--~ nodes.firstline = firstline + +-- this depends on fonts, so we have a funny dependency ... will be +-- sorted out .. we could make tonodes a plugin into this + +local function tonodes(str,fnt,attr) -- (str,template_glyph) -- moved from blob-ini + if not str or str == "" then + return + end + local head, tail, space, fnt, template = nil, nil, nil, nil, nil + if not fnt then + fnt = current_font() + elseif type(fnt) ~= "number" and fnt.id == "glyph" then + fnt, template = nil, fnt + -- else + -- already a number + end + for s in utfvalues(str) do + local n + if s == 32 then + if space then + n = copy_node(space) + elseif fonts then -- depedency + local parameters = fonts.hashes.identifiers[fnt].parameters + space = new_glue(parameters.space,parameters.space_stretch,parameters.space_shrink) + n = space + end + elseif template then + n = copy_node(template) + n.char = s + else + n = new_glyph(fnt,s) + end + if attr then -- normally false when template + n.attr = copy_node_list(attr) + end + if head then + insert_node_after(head,tail,n) + else + head = n + end + tail = n + end + return head, tail +end + +nodes.tonodes = tonodes + +local function link(head,tail,list,currentfont,currentattr) + for i=1,#list do + local n = list[i] + if n then + local tn = isnode(n) + if not tn then + local tn = type(n) + if tn == "number" then + local h, t = tonodes(tostring(n),currentfont,currentattr) + if not h then + -- skip + elseif not head then + head, tail = h, t + else + tail.next, h.prev, tail = h, t, t + end + elseif tn == "string" then + if #tn > 0 then + local h, t = tonodes(n,font.current(),currentattr) + if not h then + -- skip + elseif not head then + head, tail = h, t + else + tail.next, h.prev, tail = h, t, t + end + end + elseif tn == "table" then + if #tn > 0 then + head, tail = link(head,tail,n,currentfont,currentattr) + end + end + elseif not head then + head = n + if n.next then + tail = slide_nodes(n) + else + tail = n + end + else + tail.next = n + n.prev = tail + if n.next then + tail = slide_nodes(n) + else + tail = n + end + end + end + end + return head, tail +end + +function nodes.link(...) + local currentfont = font.current + return link(nil,nil,{...},currentfont,currentattr) +end diff --git a/Master/texmf-dist/tex/context/base/node-bck.lua b/Master/texmf-dist/tex/context/base/node-bck.lua index 94fbac85fd4..e1e4d46525e 100644 --- a/Master/texmf-dist/tex/context/base/node-bck.lua +++ b/Master/texmf-dist/tex/context/base/node-bck.lua @@ -9,15 +9,22 @@ if not modules then modules = { } end modules ['node-bck'] = { -- beware, this one takes quite some runtime, so we need a status flag -- maybe some page related state -local hlist = node.id("hlist") -local vlist = node.id("vlist") +local attributes, nodes, node = attributes, nodes, node -local has_attribute = node.has_attribute -local set_attribute = node.set_attribute -local traverse = node.traverse +local nodecodes = nodes.nodecodes -local new_rule = nodes.rule -local new_glue = nodes.glue +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist + +local has_attribute = node.has_attribute +local set_attribute = node.set_attribute +local traverse = node.traverse + +local nodepool = nodes.pool +local tasks = nodes.tasks + +local new_rule = nodepool.rule +local new_glue = nodepool.glue local a_color = attributes.private('color') local a_transparency = attributes.private('transparency') @@ -26,11 +33,11 @@ local a_background = attributes.private('background') local function add_backgrounds(head) -- boxes, inline will be done too local id = head.id - if id == vlist or id == hlist then + if id == vlist_code or id == hlist_code then local current = head.list while current do local id = current.id - if id == hlist then -- and current.list + if id == hlist_code then -- and current.list local background = has_attribute(current,a_background) if background then -- direct to hbox @@ -84,7 +91,7 @@ local function add_backgrounds(head) -- boxes, inline will be done too add_backgrounds(current) end end - elseif id == vlist then -- and current.list + elseif id == vlist_code then -- and current.list -- direct to vbox local background = has_attribute(current,a_background) if background then @@ -114,6 +121,6 @@ local function add_backgrounds(head) -- boxes, inline will be done too return head, true end -nodes.add_backgrounds = add_backgrounds +nodes.handlers.backgrounds = add_backgrounds -tasks.appendaction("shipouts","normalizers","nodes.add_backgrounds") +tasks.appendaction("shipouts","normalizers","nodes.handlers.backgrounds") diff --git a/Master/texmf-dist/tex/context/base/node-bck.mkiv b/Master/texmf-dist/tex/context/base/node-bck.mkiv index 41a6da2cb48..88fb390a9ed 100644 --- a/Master/texmf-dist/tex/context/base/node-bck.mkiv +++ b/Master/texmf-dist/tex/context/base/node-bck.mkiv @@ -20,10 +20,19 @@ \registerctxluafile{node-bck}{1.001} +\def\doinitializeboxbackgrounds + {\ctxlua{nodes.tasks.enableaction("shipouts","nodes.handlers.backgrounds")}% + \glet\doinitializeboxbackgrounds\donothing} + %D Box helpers: +% \backgroundvbox[green] {\input tufte } \par +% \backgroundvbox[blue] {\input ward } \par +% \backgroundvbox[red] {\input knuth } \par +% \backgroundhbox[yellow]{\rotate[rotation=45]{hello world}} \par + \def\doaddbackgroundtobox#1[#2]% - {\begingroup\faststartcolor[#2]% + {\begingroup\doinitializeboxbackgrounds\faststartcolor[#2]% \normalexpanded{\noexpand\faststopcolor\endgroup#1 attr \backgroundattribute \plusone attr \colormodelattribute \the\attribute\colormodelattribute @@ -63,101 +72,4 @@ % \def\backgroundvtop[#1]{\vtop \backgroundcolorattr{#1}} % \def\backgroundhbox[#1]{\hbox \backgroundcolorattr{#1}} -%D tabulate: - -\def\tabulatenormalcolumn#1% - {\doiffastoptionalcheckelse{\tabulatenormalcolumnyes#1}{\tabulatenormalcolumnnop#1}} - -\def\tabulatenormalcolumnnop#1% overloads anch-pgr - {&\iftabulateequal\tabulateequalpos\else\tabulatenormalpos\fi&\global\chardef\tabulatetype#1&} - -\def\tabulatenormalcolumnyes#1[#2]% - {&\iftabulateequal\tabulateequalpos\else\tabulatenormalpos\fi&\global\chardef\tabulatetype#1&% - \iftrialtypesetting\else\settabulatecolor{#2}\fi\ignorespaces} - -\newcount\maxtabularcolorcolumn - -\def\settabulatecolor#1% we could store the attributes at the cost of a lua call - {\begingroup - \global\settrue\tabulatehascolors - \ifnum\tabulatecolumn>\maxtabularcolorcolumn - \global\maxtabularcolorcolumn\tabulatecolumn - \fi - \setxvalue{\??tt:c:\the\tabulatecolumn}{#1}% - \attribute\backgroundattribute\plusone - \faststartcolor[#1]\strut\char0\faststopcolor - \endgroup} - -\def\repeatsettabulatecolor - {\begingroup - \ifcsname\??tt:c:\the\tabulatecolumn\endcsname - \attribute\backgroundattribute\plusone - \faststartcolor[\csname\??tt:c:\the\tabulatecolumn\endcsname]\strut\char0\faststopcolor - \fi - \endgroup} - -\def\resettabulatecolors - {\ifcase\maxtabularcolorcolumn\else - \doresettabulatecolors - \fi} - -\def\doresettabulatecolors - {\dorecurse\maxtabularcolorcolumn{\letgvalue{\??tt:c:\recurselevel}\undefined}} % slow - -\appendtoks - \resettabulatecolors -\to \everyaftertabulaterow - -\def\splitofftabulatebox % overloads in anch-pgr - {\dontcomplain - \global\setbox\tabulatebox % % % global ? % % % - \vsplit\tablebox\tabulatecolumn to \lineheight - \setbox\tabulatebox\normalvbox - {\unvbox\tabulatebox}% - \setbox\tabulatebox\hbox to \wd\tabulatebox - {\iftrialtypesetting\else\ifconditional\tabulatehascolors\repeatsettabulatecolor\fi\fi - \hss\dotabulatehook{\box\tabulatebox}\hss}% - \ht\tabulatebox\strutht - \dp\tabulatebox\strutdp - \box\tabulatebox - \iftrialtypesetting\else\ifconditional\tablehaspositions\doflushtabulateepos\fi\fi} - -\appendtoks - \global\setfalse\tabulatehascolors -\to \everytabulate - \protect \endinput - -% test - -\starttext - -\backgroundvbox[green] {\input tufte } \par -\backgroundvbox[blue] {\input ward } \par -\backgroundvbox[red] {\input knuth } \par -\backgroundhbox[yellow]{\rotate[rotation=45]{hello world}} \par - -\starttabulate[||p||] -\NC test \NC test \NC test \NC \NR -\NC test \NC[green] \input tufte \NC[yellow] test \NC \NR -\NC test \NC test \NC test \NC \NR -\NC test \NC test \NC test \NC \NR -\NC test \NC test \NC test \NC \NR -\NC test \NC test \NC test \NC \NR -\NC[blue] test \NC[red] test \NC test \NC \NR -\NC test \NC test \NC test \NC \NR -\NC test \NC test \NC test \NC \NR -\NC test \NC test \NC test \NC \NR -\NC test \NC test \NC[gray] test \NC \NR -\NC test \NC test \NC test \NC \NR -\NC test \NC test \NC test \NC \NR -\NC[blue] test \NC test \NC test \NC \NR -\NC test \NC test \NC test \NC \NR -\NC test \NC test \NC[magenta] test \NC \NR -\NC test \NC test \NC test \NC \NR -\NC test \NC[cyan] \dorecurse{10}{\input ward }\NC test \NC \NR -\NC test \NC test \NC test \NC \NR -\NC test \NC[yellow] test \NC test \NC \NR -\stoptabulate - -\stoptext diff --git a/Master/texmf-dist/tex/context/base/node-dir.lua b/Master/texmf-dist/tex/context/base/node-dir.lua index 05e4835e507..970313d96f3 100644 --- a/Master/texmf-dist/tex/context/base/node-dir.lua +++ b/Master/texmf-dist/tex/context/base/node-dir.lua @@ -15,24 +15,25 @@ adapted and now has the mappings as comments. This lua file is based on that file. ]]-- +local allocate = utilities.storage.allocate -nodes = nodes or { } +local nodes = nodes -nodes.is_mirrored = { +nodes.is_mirrored = allocate { -- TLT = false, -- TRT = false, -- LTL = false, -- RTT = false, } -nodes.is_rotated = { +nodes.is_rotated = allocate { -- TLT = false, -- TRT = false, -- LTL = false, RTT = true, ["+RTT"] = true, } -nodes.textdir_is_parallel = { +nodes.textdir_is_parallel = allocate { TLT = { TLT = true, ["+TLT"] = true, TRT = true, ["+TRT"] = true, @@ -59,7 +60,7 @@ nodes.textdir_is_parallel = { } } -nodes.pardir_is_parallel = { +nodes.pardir_is_parallel = allocate { TLT = { TLT = true, ["+TLT"] = true, TRT = true, ["+TRT"] = true, @@ -86,7 +87,7 @@ nodes.pardir_is_parallel = { }, } -nodes.pardir_is_opposite = { +nodes.pardir_is_opposite = allocate { TLT = { -- TLT = false, -- TRT = false, @@ -113,7 +114,7 @@ nodes.pardir_is_opposite = { }, } -nodes.textdir_is_opposite = { +nodes.textdir_is_opposite = allocate { TLT = { -- TLT = false, TRT = true, ["+TRT"] = true, @@ -140,7 +141,7 @@ nodes.textdir_is_opposite = { }, } -nodes.glyphdir_is_opposite = { +nodes.glyphdir_is_opposite = allocate { TLT = { -- TLT = false, -- TRT = false, @@ -167,7 +168,7 @@ nodes.glyphdir_is_opposite = { }, } -nodes.pardir_is_equal = { +nodes.pardir_is_equal = allocate { TLT = { TLT = true, ["+TLT"] = true, TRT = true, ["+TRT"] = true, @@ -194,7 +195,7 @@ nodes.pardir_is_equal = { }, } -nodes.textdir_is_equal = { +nodes.textdir_is_equal = allocate { TLT = { TLT = true, ["+TLT"] = true, -- TRT = false, @@ -221,7 +222,7 @@ nodes.textdir_is_equal = { }, } -nodes.glyphdir_is_equal = { +nodes.glyphdir_is_equal = allocate { TLT = { TLT = true, ["+TLT"] = true, TRT = true, ["+TRT"] = true, @@ -248,7 +249,7 @@ nodes.glyphdir_is_equal = { }, } -nodes.partextdir_is_equal = { +nodes.partextdir_is_equal = allocate { TLT = { -- TLT = false, -- TRT = false, @@ -275,28 +276,28 @@ nodes.partextdir_is_equal = { }, } -nodes.textdir_is_is = { +nodes.textdir_is_is = allocate { TLT = true, ["+TLT"] = true, -- TRT = false, -- LTL = false, -- RTT = false, } -nodes.glyphdir_is_orthogonal = { +nodes.glyphdir_is_orthogonal = allocate { TLT = true, ["+TLT"] = true, TRT = true, ["+TRT"] = true, LTL = true, ["+LTL"] = true, -- RTT = false } -nodes.dir_is_pop = { +nodes.dir_is_pop = allocate { ["-TRT"] = true, ["-TLT"] = true, ["-LTL"] = true, ["-RTT"] = true, } -nodes.dir_negation = { +nodes.dir_negation = allocate { ["-TRT"] = "+TRT", ["-TLT"] = "+TLT", ["-LTL"] = "+LTL", diff --git a/Master/texmf-dist/tex/context/base/node-dum.lua b/Master/texmf-dist/tex/context/base/node-dum.lua deleted file mode 100644 index f39a0873f70..00000000000 --- a/Master/texmf-dist/tex/context/base/node-dum.lua +++ /dev/null @@ -1,19 +0,0 @@ -if not modules then modules = { } end modules ['node-dum'] = { - version = 1.001, - comment = "companion to luatex-*.tex", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -nodes = nodes or { } - -function nodes.simple_font_handler(head) --- lang.hyphenate(head) - head = nodes.process_characters(head) - nodes.inject_kerns(head) - nodes.protect_glyphs(head) - head = node.ligaturing(head) - head = node.kerning(head) - return head -end diff --git a/Master/texmf-dist/tex/context/base/node-fin.lua b/Master/texmf-dist/tex/context/base/node-fin.lua index c6e3be44815..5c1cc9ad57a 100644 --- a/Master/texmf-dist/tex/context/base/node-fin.lua +++ b/Master/texmf-dist/tex/context/base/node-fin.lua @@ -9,29 +9,33 @@ if not modules then modules = { } end modules ['node-fin'] = { -- this module is being reconstructed local next, type, format = next, type, string.format -local texsprint = tex.sprint -local ctxcatcodes = tex.ctxcatcodes +local attributes, nodes, node = attributes, nodes, node -local glyph = node.id('glyph') -local glue = node.id('glue') -local rule = node.id('rule') -local whatsit = node.id('whatsit') -local hlist = node.id('hlist') -local vlist = node.id('vlist') +local has_attribute = node.has_attribute +local copy_node = node.copy -local has_attribute = node.has_attribute -local copy_node = node.copy +local nodecodes = nodes.nodecodes +local whatcodes = nodes.whatcodes -local starttiming, stoptiming = statistics.starttiming, statistics.stoptiming +local glyph_code = nodecodes.glyph +local disc_code = nodecodes.disc +local glue_code = nodecodes.glue +local rule_code = nodecodes.rule +local whatsit_code = nodecodes.whatsit +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist -states = states or { } -shipouts = shipouts or { } +local pdfliteral_code = whatcodes.pdfliteral +local states = attributes.states local numbers = attributes.numbers local trigger = attributes.private('trigger') local triggering = false +local starttiming = statistics.starttiming +local stoptiming = statistics.stoptiming + -- these two will be like trackers function states.enabletriggering() @@ -57,7 +61,7 @@ end -- function states.flush() -- if #collected > 0 then -- for i=1,#collected do --- texsprint(ctxcatcodes,collected[i]) -- we're in context mode anyway +-- context(collected[i]) -- we're in context mode anyway -- end -- collected = { } -- states.collected = collected @@ -109,9 +113,9 @@ local function process_attribute(head,plugin) -- head,attribute,enabled,initiali end end -nodes.process_attribute = process_attribute +-- nodes.process_attribute = process_attribute -function nodes.install_attribute_handler(plugin) -- we need to avoid this nested function +function nodes.installattributehandler(plugin) -- we need to avoid this nested function return function(head) return process_attribute(head,plugin) end @@ -159,7 +163,7 @@ end --~ end --~ ]] --~ ---~ function nodes.install_attribute_handler(plugin) -- we need to avoid this nested function +--~ function nodes.installattributehandler(plugin) -- we need to avoid this nested function --~ plugindata[plugin.name] = plugin --~ local str = format(template,plugin.name) --~ return loadstring(str)() @@ -170,20 +174,25 @@ end local insert_node_before = node.insert_before local insert_node_after = node.insert_after -local nsdata, nsdone, nsforced, nsselector, nstrigger +local nsdata, nsnone, nslistwise, nsforced, nsselector, nstrigger local current, current_selector, done = 0, 0, false -- nb, stack has a local current ! function states.initialize(namespace,attribute,head) - nsdata, nsnone = namespace.data, namespace.none - nsforced, nsselector, nslistwise = namespace.forced, namespace.selector, namespace.listwise - nstrigger = triggering and namespace.triggering and trigger - current, current_selector, done = 0, 0, false -- todo: done cleanup + nsdata = namespace.data + nsnone = namespace.none + nsforced = namespace.forced + nsselector = namespace.selector + nslistwise = namespace.listwise + nstrigger = triggering and namespace.triggering and trigger + current = 0 + current_selector = 0 + done = false -- todo: done cleanup end function states.finalize(namespace,attribute,head) -- is this one ok? if current > 0 and nsnone then local id = head.id - if id == hlist or id == vlist then + if id == hlist_code or id == vlist_code then local list = head.list if list then head.list = insert_node_before(list,list,copy_node(nsnone)) @@ -201,27 +210,30 @@ local function process(namespace,attribute,head,inheritance,default) -- one attr while stack do local id = stack.id -- we need to deal with literals too (reset as well as oval) - -- if id == glyph or (id == whatsit and stack.subtype == 8) or (id == rule and stack.width ~= 0) or (id == glue and stack.leader) then -- or disc - if id == glyph or (id == rule and stack.width ~= 0) or (id == glue and stack.leader) then -- or disc + -- if id == glyph_code or (id == whatsit_code and stack.subtype == pdfliteral_code) or (id == rule_code and stack.width ~= 0) or (id == glue_code and stack.leader) then -- or disc_code + if id == glyph_code -- or id == disc_code + or (id == rule_code and stack.width ~= 0) or (id == glue_code and stack.leader) then -- or disc_code local c = has_attribute(stack,attribute) if c then if default and c == inheritance then if current ~= default then head = insert_node_before(head,stack,copy_node(nsdata[default])) - current, done = default, true + current = default + done = true end elseif current ~= c then head = insert_node_before(head,stack,copy_node(nsdata[c])) - current, done = c, true + current = c + done = true end -- here ? compare selective - if id == glue then --leader + if id == glue_code then --leader -- same as *list local content = stack.leader if content then local savedcurrent = current local ci = content.id - if ci == hlist or ci == vlist then + if ci == hlist_code or ci == vlist_code then -- else we reset inside a box unneeded, okay, the downside is -- that we trigger color in each repeated box, so there is room -- for improvement here @@ -245,13 +257,15 @@ local function process(namespace,attribute,head,inheritance,default) -- one attr elseif default and inheritance then if current ~= default then head = insert_node_before(head,stack,copy_node(nsdata[default])) - current, done = default, true + current = default + done = true end elseif current > 0 then head = insert_node_before(head,stack,copy_node(nsnone)) - current, done = 0, true + current = 0 + done = true end - elseif id == hlist or id == vlist then + elseif id == hlist_code or id == vlist_code then local content = stack.list if content then local ok = false @@ -286,41 +300,46 @@ local function selective(namespace,attribute,head,inheritance,default) -- two at while stack do local id = stack.id -- we need to deal with literals too (reset as well as oval) - -- if id == glyph or (id == whatsit and stack.subtype == 8) or (id == rule and stack.width ~= 0) or (id == glue and stack.leader) then -- or disc - if id == glyph or (id == rule and stack.width ~= 0) or (id == glue and stack.leader) then -- or disc + -- if id == glyph_code or (id == whatsit_code and stack.subtype == pdfliteral_code) or (id == rule_code and stack.width ~= 0) or (id == glue_code and stack.leader) then -- or disc_code + if id == glyph_code -- or id == disc_code + or (id == rule_code and stack.width ~= 0) or (id == glue_code and stack.leader) then -- or disc_code local c = has_attribute(stack,attribute) if c then if default and c == inheritance then if current ~= default then local data = nsdata[default] head = insert_node_before(head,stack,copy_node(data[nsforced or has_attribute(stack,nsselector) or nsselector])) - current, done = default, true + current = default + done = true end else local s = has_attribute(stack,nsselector) if current ~= c or current_selector ~= s then local data = nsdata[c] head = insert_node_before(head,stack,copy_node(data[nsforced or has_attribute(stack,nsselector) or nsselector])) - current, current_selector, done = c, s, true + current = c + current_selector = s + done = true end end elseif default and inheritance then if current ~= default then local data = nsdata[default] head = insert_node_before(head,stack,copy_node(data[nsforced or has_attribute(stack,nsselector) or nsselector])) - current, done = default, true + current = default + done = true end elseif current > 0 then head = insert_node_before(head,stack,copy_node(nsnone)) current, current_selector, done = 0, 0, true end - if id == glue then -- leader + if id == glue_code then -- leader -- same as *list local content = stack.leader if content then local savedcurrent = current local ci = content.id - if ci == hlist or ci == vlist then + if ci == hlist_code or ci == vlist_code then -- else we reset inside a box unneeded, okay, the downside is -- that we trigger color in each repeated box, so there is room -- for improvement here @@ -341,7 +360,7 @@ local function selective(namespace,attribute,head,inheritance,default) -- two at done = done or ok end end - elseif id == hlist or id == vlist then + elseif id == hlist_code or id == vlist_code then local content = stack.list if content then local ok = false @@ -376,7 +395,7 @@ local function stacked(namespace,attribute,head,default) -- no triggering, no in local current, depth = default or 0, 0 while stack do local id = stack.id - if id == glyph or (id == rule and stack.width ~= 0) or (id == glue and stack.leader) then -- or disc + if id == glyph_code or (id == rule_code and stack.width ~= 0) or (id == glue_code and stack.leader) then -- or disc_code local c = has_attribute(stack,attribute) if c then if current ~= c then @@ -384,7 +403,7 @@ local function stacked(namespace,attribute,head,default) -- no triggering, no in depth = depth + 1 current, done = c, true end - if id == glue then + if id == glue_code then local content = stack.leader if content then -- unchecked local ok = false @@ -392,14 +411,15 @@ local function stacked(namespace,attribute,head,default) -- no triggering, no in done = done or ok end end - elseif default then +--~ elseif default then + elseif default > 0 then -- elseif current > 0 then head = insert_node_before(head,stack,copy_node(nsnone)) depth = depth - 1 current, done = 0, true end - elseif id == hlist or id == vlist then + elseif id == hlist_code or id == vlist_code then local content = stack.list if content then -- the problem is that broken lines gets the attribute which can be a later one diff --git a/Master/texmf-dist/tex/context/base/node-fin.mkiv b/Master/texmf-dist/tex/context/base/node-fin.mkiv index ea9e83f16b5..ffa4b8bf554 100644 --- a/Master/texmf-dist/tex/context/base/node-fin.mkiv +++ b/Master/texmf-dist/tex/context/base/node-fin.mkiv @@ -20,10 +20,10 @@ \registerctxluafile{node-fin}{1.001} % we might generalize this one -\definesystemattribute[trigger] \chardef\triggerattribute \dogetattributeid{trigger} % feature inheritance +\definesystemattribute[trigger][public] -\def\finalizeobjectbox #1{\ctxlua{nodes.process_page(tex.box[\number#1])}} -\def\finalizeshipoutbox#1{\ctxlua{nodes.process_page(tex.box[\number#1])}} +\def\finalizeobjectbox #1{\ctxlua{nodes.handlers.finalize(tex.box[\number#1])}} +\def\finalizeshipoutbox#1{\ctxlua{nodes.handlers.finalize(tex.box[\number#1])}} % tricky stuff: @@ -56,12 +56,12 @@ \stopinheritattributes} \def\enableattributeinheritance - {\ctxlua{states.enabletriggering()}% + {\ctxlua{attributes.states.enabletriggering()}% \let\attributedcopy\doattributedcopy \let\attributedbox \doattributedbox} \def\disableattributeinheritance - {\ctxlua{states.disabletriggering()}% + {\ctxlua{attributes.states.disabletriggering()}% \let\attributedcopy\copy \let\attributedbox \box} diff --git a/Master/texmf-dist/tex/context/base/node-fnt.lua b/Master/texmf-dist/tex/context/base/node-fnt.lua index b0d073425cc..7ceb96f80ad 100644 --- a/Master/texmf-dist/tex/context/base/node-fnt.lua +++ b/Master/texmf-dist/tex/context/base/node-fnt.lua @@ -6,22 +6,33 @@ if not modules then modules = { } end modules ['node-fnt'] = { license = "see context related readme files" } +if not context then os.exit() end -- generic function in node-dum + local next, type = next, type +local concat = table.concat + +local nodes, node, fonts = nodes, node, fonts + +local trace_characters = false trackers.register("nodes.characters", function(v) trace_characters = v end) +local trace_fontrun = false trackers.register("nodes.fontrun", function(v) trace_fontrun = v end) -local trace_characters = false trackers.register("nodes.characters", function(v) trace_characters = v end) +local report_fonts = logs.reporter("fonts","processing") -local glyph = node.id('glyph') +local fonthashes = fonts.hashes +local fontdata = fonthashes.identifiers -local traverse_id = node.traverse_id -local has_attribute = node.has_attribute +local otf = fonts.handlers.otf -local starttiming, stoptiming = statistics.starttiming, statistics.stoptiming +local traverse_id = node.traverse_id +local has_attribute = node.has_attribute +local starttiming = statistics.starttiming +local stoptiming = statistics.stoptiming +local nodecodes = nodes.nodecodes +local handlers = nodes.handlers -fonts = fonts or { } -fonts.tfm = fonts.tfm or { } -fonts.ids = fonts.ids or { } +local glyph_code = nodecodes.glyph -local fontdata = fonts.ids +local setmetatableindex = table.setmetatableindex -- some tests with using an array of dynamics[id] and processes[id] demonstrated -- that there was nothing to gain (unless we also optimize other parts) @@ -33,96 +44,123 @@ local fontdata = fonts.ids -- happen often; we could consider processing sublists but that might need mor -- checking later on; the current approach also permits variants -if tex.attribute[0] < 0 then - - texio.write_nl("log","!") - texio.write_nl("log","! Attribute 0 is reserved for ConTeXt's font feature management and has to be") - texio.write_nl("log","! set to zero. Also, some attributes in the range 1-255 are used for special") - texio.write_nl("log","! purposed so setting them at the TeX end might break the font handler.") - texio.write_nl("log","!") - - tex.attribute[0] = 0 -- else no features - -end +local run = 0 + +local setfontdynamics = { } +local fontprocesses = { } + +setmetatableindex(setfontdynamics, function(t,font) + local tfmdata = fontdata[font] + local shared = tfmdata.shared + local v = shared and shared.dynamics and otf.setdynamics or false + t[font] = v + return v +end) + +setmetatableindex(fontprocesses, function(t,font) + local tfmdata = fontdata[font] + local shared = tfmdata.shared -- we need to check shared, only when same features + local processes = shared and shared.processes + if processes and #processes > 0 then + t[font] = processes + return processes + else + t[font] = false + return false + end +end) --- this will be redone and split in a generic one and a context one +fonts.hashes.setdynamics = setfontdynamics +fonts.hashes.processes = fontprocesses -function nodes.process_characters(head) +function handlers.characters(head) -- either next or not, but definitely no already processed list starttiming(nodes) local usedfonts, attrfonts, done = { }, { }, false local a, u, prevfont, prevattr = 0, 0, nil, 0 - for n in traverse_id(glyph,head) do - local font, attr = n.font, has_attribute(n,0) -- zero attribute is reserved for fonts in context - if attr and attr > 0 then - if font ~= prevfont or attr ~= prevattr then + if trace_fontrun then + run = run + 1 + report_fonts() + report_fonts("checking node list, run %s",run) + report_fonts() + local n = head + while n do + if n.id == glyph_code then + local font = n.font + local attr = has_attribute(n,0) or 0 + report_fonts("font %03i, dynamic %03i, glyph %s",font,attr,utf.char(n.char)) + else + report_fonts("[%s]",nodecodes[n.id]) + end + n = n.next + end + end + for n in traverse_id(glyph_code,head) do + local font, attr = n.font, has_attribute(n,0) or 0 -- zero attribute is reserved for fonts in context + if font ~= prevfont or attr ~= prevattr then + if attr > 0 then local used = attrfonts[font] if not used then used = { } attrfonts[font] = used end if not used[attr] then - -- we do some testing outside the function - local tfmdata = fontdata[font] - local shared = tfmdata.shared - if shared then - local dynamics = shared.dynamics - if dynamics then - local d = shared.set_dynamics(font,dynamics,attr) -- still valid? - if d then - used[attr] = d - a = a + 1 - end + local sd = setfontdynamics[font] + if sd then -- always true ? + local d = sd(font,attr) -- can we cache this one? + if d then + used[attr] = d + a = a + 1 end end end - prevfont, prevattr = font, attr - end - elseif font ~= prevfont then - prevfont, prevattr = font, 0 - local used = usedfonts[font] - if not used then - local tfmdata = fontdata[font] - if tfmdata then - local shared = tfmdata.shared -- we need to check shared, only when same features - if shared then - local processors = shared.processes - if processors and #processors > 0 then - usedfonts[font] = processors - u = u + 1 - end + else + local used = usedfonts[font] + if not used then + local fp = fontprocesses[font] + if fp then + usedfonts[font] = fp + u = u + 1 end - else - -- probably nullfont end end - else + prevfont = font prevattr = attr end end + if trace_fontrun then + report_fonts() + report_fonts("statics : %s",(u > 0 and concat(table.keys(usedfonts)," ")) or "none") + report_fonts("dynamics: %s",(a > 0 and concat(table.keys(attrfonts)," ")) or "none") + report_fonts() + end -- we could combine these and just make the attribute nil if u == 1 then local font, processors = next(usedfonts) local n = #processors if n > 0 then - local h, d = processors[1](head,font,false) - head, done = h or head, done or d + local h, d = processors[1](head,font,0) + head = h or head + done = done or d if n > 1 then for i=2,n do - local h, d = processors[i](head,font,false) - head, done = h or head, done or d + local h, d = processors[i](head,font,0) + head = h or head + done = done or d end end end elseif u > 0 then for font, processors in next, usedfonts do local n = #processors - local h, d = processors[1](head,font,false) - head, done = h or head, done or d + local h, d = processors[1](head,font,0) + head = h or head + done = done or d if n > 1 then for i=2,n do - local h, d = processors[i](head,font,false) - head, done = h or head, done or d + local h, d = processors[i](head,font,0) + head = h or head + done = done or d end end end @@ -131,12 +169,18 @@ function nodes.process_characters(head) local font, dynamics = next(attrfonts) for attribute, processors in next, dynamics do -- attr can switch in between local n = #processors - local h, d = processors[1](head,font,attribute) - head, done = h or head, done or d - if n > 1 then - for i=2,n do - local h, d = processors[i](head,font,attribute) - head, done = h or head, done or d + if n == 0 then + report_fonts("no processors associated with dynamic %s",attribute) + else + local h, d = processors[1](head,font,attribute) + head = h or head + done = done or d + if n > 1 then + for i=2,n do + local h, d = processors[i](head,font,attribute) + head = h or head + done = done or d + end end end end @@ -144,12 +188,18 @@ function nodes.process_characters(head) for font, dynamics in next, attrfonts do for attribute, processors in next, dynamics do -- attr can switch in between local n = #processors - local h, d = processors[1](head,font,attribute) - head, done = h or head, done or d - if n > 1 then - for i=2,n do - local h, d = processors[i](head,font,attribute) - head, done = h or head, done or d + if n == 0 then + report_fonts("no processors associated with dynamic %s",attribute) + else + local h, d = processors[1](head,font,attribute) + head = h or head + done = done or d + if n > 1 then + for i=2,n do + local h, d = processors[i](head,font,attribute) + head = h or head + done = done or d + end end end end @@ -162,46 +212,5 @@ function nodes.process_characters(head) return head, true end -if node.protect_glyphs then - - nodes.protect_glyphs = node.protect_glyphs - nodes.unprotect_glyphs = node.unprotect_glyphs - -else do - - -- initial value subtype : X000 0001 = 1 = 0x01 = char - -- - -- expected before linebreak : X000 0000 = 0 = 0x00 = glyph - -- X000 0010 = 2 = 0x02 = ligature - -- X000 0100 = 4 = 0x04 = ghost - -- X000 1010 = 10 = 0x0A = leftboundary lig - -- X001 0010 = 18 = 0x12 = rightboundary lig - -- X001 1010 = 26 = 0x1A = both boundaries lig - -- X000 1100 = 12 = 0x1C = leftghost - -- X001 0100 = 20 = 0x14 = rightghost - - function nodes.protect_glyphs(head) - local done = false - for g in traverse_id(glyph,head) do - local s = g.subtype - if s == 1 then - done, g.subtype = true, 256 - elseif s <= 256 then - done, g.subtype = true, 256 + s - end - end - return done - end - - function nodes.unprotect_glyphs(head) - local done = false - for g in traverse_id(glyph,head) do - local s = g.subtype - if s > 256 then - done, g.subtype = true, s - 256 - end - end - return done - end - -end end +handlers.protectglyphs = node.protect_glyphs +handlers.unprotectglyphs = node.unprotect_glyphs diff --git a/Master/texmf-dist/tex/context/base/node-ini.lua b/Master/texmf-dist/tex/context/base/node-ini.lua index 36e240238e3..eb70fa6e6d1 100644 --- a/Master/texmf-dist/tex/context/base/node-ini.lua +++ b/Master/texmf-dist/tex/context/base/node-ini.lua @@ -15,55 +15,11 @@ modules.

local utf = unicode.utf8 local next, type = next, type -local format, concat, match, utfchar = string.format, table.concat, string.match, utf.char - -local chardata = characters and characters.data - ---[[ldx-- -

We start with a registration system for atributes so that we can use the -symbolic names later on.

---ldx]]-- - -attributes = attributes or { } - -attributes.names = attributes.names or { } -attributes.numbers = attributes.numbers or { } -attributes.list = attributes.list or { } -attributes.unsetvalue = -0x7FFFFFFF - -storage.register("attributes/names", attributes.names, "attributes.names") -storage.register("attributes/numbers", attributes.numbers, "attributes.numbers") -storage.register("attributes/list", attributes.list, "attributes.list") - -local names, numbers, list = attributes.names, attributes.numbers, attributes.list - -function attributes.define(name,number) -- at the tex end - if not numbers[name] then - numbers[name], names[number], list[number] = number, name, { } - end -end - ---[[ldx-- -

We can use the attributes in the range 127-255 (outside user space). These -are only used when no attribute is set at the \TEX\ end which normally -happens in .

---ldx]]-- - -storage.shared.attributes_last_private = storage.shared.attributes_last_private or 127 - -function attributes.private(name) -- at the lua end (hidden from user) - local number = numbers[name] - if not number then - local last = storage.shared.attributes_last_private or 127 - if last < 255 then - last = last + 1 - storage.shared.attributes_last_private = last - end - number = last - numbers[name], names[number], list[number] = number, name, { } - end - return number -end +local format, concat, match, gsub = string.format, table.concat, string.match, string.gsub +local utfchar = utf.char +local swapped = table.swapped +local lpegmatch = lpeg.match +local formatcolumns = utilities.formatters.formatcolumns --[[ldx--

Access to nodes is what gives its power. Here we @@ -98,39 +54,226 @@ into the engine, but this is a not so natural extension.

also ignore the empty nodes. [This is obsolete!]

--ldx]]-- -nodes = nodes or { } - -local hlist = node.id('hlist') -local vlist = node.id('vlist') -local glyph = node.id('glyph') -local glue = node.id('glue') -local penalty = node.id('penalty') -local kern = node.id('kern') -local whatsit = node.id('whatsit') - -local traverse_id = node.traverse_id local traverse = node.traverse +local traverse_id = node.traverse_id local free_node = node.free local remove_node = node.remove local insert_node_before = node.insert_before local insert_node_after = node.insert_after +local node_fields = node.fields + +local allocate = utilities.storage.allocate + +nodes = nodes or { } +local nodes = nodes + +nodes.handlers = nodes.handlers or { } + +-- there will be more of this: + +local skipcodes = allocate { + [ 0] = "userskip", + [ 1] = "lineskip", + [ 2] = "baselineskip", + [ 3] = "parskip", + [ 4] = "abovedisplayskip", + [ 5] = "belowdisplayskip", + [ 6] = "abovedisplayshortskip", + [ 7] = "belowdisplayshortskip", + [ 8] = "leftskip", + [ 9] = "rightskip", + [10] = "topskip", + [11] = "splittopskip", + [12] = "tabskip", + [13] = "spaceskip", + [14] = "xspaceskip", + [15] = "parfillskip", + [16] = "thinmuskip", + [17] = "medmuskip", + [18] = "thickmuskip", +} + +local noadcodes = allocate { + [ 0] = "ord", + [ 1] = "opdisplaylimits", + [ 2] = "oplimits", + [ 3] = "opnolimits", + [ 4] = "bin", + [ 5] = "rel", + [ 6] = "open", + [ 7] = "close", + [ 8] = "punct", + [ 9] = "inner", + [10] = "under", + [11] = "over", + [12] = "vcenter", +} + +local listcodes = allocate { + [ 0] = "unknown", + [ 1] = "line", + [ 2] = "box", + [ 3] = "indent", + [ 4] = "alignment", -- row or column + [ 5] = "cell", +} + +local glyphcodes = allocate { + [0] = "character", + [1] = "glyph", + [2] = "ligature", + [3] = "ghost", + [4] = "left", + [5] = "right", +} + +local kerncodes = allocate { + [0] = "fontkern", + [1] = "userkern", + [2] = "accentkern", +} + +local mathcodes = allocate { + [0] = "beginmath", + [1] = "endmath", +} -function nodes.remove(head, current, free_too) +local fillcodes = allocate { + [0] = "stretch", + [1] = "fi", + [2] = "fil", + [3] = "fill", + [4] = "filll", +} + +local function simplified(t) + local r = { } + for k, v in next, t do + r[k] = gsub(v,"_","") + end + return r +end + +local nodecodes = simplified(node.types()) +local whatcodes = simplified(node.whatsits()) + +skipcodes = allocate(swapped(skipcodes, skipcodes )) +noadcodes = allocate(swapped(noadcodes, noadcodes )) +nodecodes = allocate(swapped(nodecodes, nodecodes )) +whatcodes = allocate(swapped(whatcodes, whatcodes )) +listcodes = allocate(swapped(listcodes, listcodes )) +glyphcodes = allocate(swapped(glyphcodes,glyphcodes)) +kerncodes = allocate(swapped(kerncodes, kerncodes )) +mathcodes = allocate(swapped(mathcodes, mathcodes )) +fillcodes = allocate(swapped(fillcodes, fillcodes )) + +nodes.skipcodes = skipcodes nodes.gluecodes = skipcodes -- more official +nodes.noadcodes = noadcodes +nodes.nodecodes = nodecodes +nodes.whatcodes = whatcodes nodes.whatsitcodes = whatcodes -- more official +nodes.listcodes = listcodes +nodes.glyphcodes = glyphcodes +nodes.kerncodes = kerncodes +nodes.mathcodes = mathcodes +nodes.fillcodes = fillcodes + +listcodes.row = listcodes.alignment +listcodes.column = listcodes.alignment + +kerncodes.italiccorrection = kerncodes.userkern +kerncodes.kerning = kerncodes.fontkern + +nodes.codes = allocate { + hlist = listcodes, + vlist = listcodes, + glyph = glyphcodes, + glue = skipcodes, + kern = kerncodes, + whatsit = whatcodes, + math = mathnodes, + noad = noadcodes, +} + +function nodes.showcodes() + local t = { } + for name, codes in table.sortedhash(nodes.codes) do + local sorted = table.sortedkeys(codes) + for i=1,#sorted do + local s = sorted[i] + if type(s) ~= "number" then + t[#t+1] = { name, s, codes[s] } + end + end + end + formatcolumns(t) + for k=1,#t do + texio.write_nl(t[k]) + end +end + +local whatsit_node = nodecodes.whatsit + +local messyhack = table.tohash { -- temporary solution + nodecodes.attributelist, + nodecodes.attribute, + nodecodes.gluespec, + nodecodes.action, +} + +function nodes.fields(n) + local id = n.id + if id == whatsit_node then + return node_fields(id,n.subtype) + else + local t = node_fields(id) + if messyhack[id] then + for i=1,#t do + if t[i] == "subtype" then + table.remove(t,i) + break + end + end + end + return t + end +end + +trackers.register("system.showcodes", nodes.showcodes) + +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist +local glue_code = nodecodes.glue + +--~ if t.id == glue_code then +--~ local s = t.spec +--~ print(t) +--~ print(s,s and s.writable) +--~ if s and s.writable then +--~ free_node(s) +--~ end +--~ t.spec = nil +--~ end + +local function remove(head, current, free_too) local t = current +--~ print(t) head, current = remove_node(head,current) if t then if free_too then free_node(t) t = nil else - t.next, t.prev = nil, nil + t.next = nil + t.prev = nil end end return head, current, t end +nodes.remove = remove + function nodes.delete(head,current) - return nodes.remove(head,current,true) + return remove(head,current,true) end nodes.before = insert_node_before @@ -184,10 +327,12 @@ function nodes.replace(head,current,new) -- no head returned if false end local prev, next = current.prev, current.next if next then - new.next, next.prev = next, new + new.next = next + next.prev = new end if prev then - new.prev, prev.next = prev, new + new.prev = prev + prev.next = new end if head then if head == current then @@ -207,7 +352,7 @@ local function count(stack,flat) local n = 0 while stack do local id = stack.id - if not flat and id == hlist or id == vlist then + if not flat and id == hlist_code or id == vlist_code then local list = stack.list if list then n = n + 1 + count(list) -- self counts too @@ -224,21 +369,17 @@ end nodes.count = count --- new, will move - -function attributes.ofnode(n) - local a = n.attr - if a then - local names = attributes.names - a = a.next - while a do - local number, value = a.number, a.value - texio.write_nl(format("%s : attribute %3i, value %4i, name %s",tostring(n),number,value,names[number] or '?')) - a = a.next - end - end +local left, space = lpeg.P("<"), lpeg.P(" ") + +local reference = left * (1-left)^0 * left * space^0 * lpeg.C((1-space)^0) + +function nodes.reference(n) + return lpegmatch(reference,tostring(n)) end -local left, space = lpeg.P("<"), lpeg.P(" ") +if not node.next then -nodes.filterkey = left * (1-left)^0 * left * space^0 * lpeg.C((1-space)^0) + function node.next(n) return n and n.next end + function node.prev(n) return n and n.prev end + +end diff --git a/Master/texmf-dist/tex/context/base/node-ini.mkiv b/Master/texmf-dist/tex/context/base/node-ini.mkiv index 78725931666..8d048122f5d 100644 --- a/Master/texmf-dist/tex/context/base/node-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/node-ini.mkiv @@ -18,55 +18,20 @@ \newcount\filterstate \filterstate\plusone \registerctxluafile{node-ini}{1.001} +\registerctxluafile{node-res}{1.001} \registerctxluafile{node-dir}{1.001} \registerctxluafile{node-aux}{1.001} \registerctxluafile{node-tst}{1.001} \registerctxluafile{node-tra}{1.001} % we might split it off (module) -\registerctxluafile{node-seq}{1.001} % we might generalize this one \registerctxluafile{node-tsk}{1.001} \registerctxluafile{node-tex}{1.001} -\registerctxluafile{node-res}{1.001} \registerctxluafile{node-pro}{1.001} \registerctxluafile{node-shp}{1.001} \registerctxluafile{node-ser}{1.001} \registerctxluafile{node-ext}{1.001} -\registerctxluafile{node-inj}{1.001} % we might split it off +%registerctxluafile{node-inj}{1.001} % we might split it off \registerctxluafile{node-typ}{1.001} % experimental - -\newtoks \attributesresetlist - -\ifdefined \v!global \else \def\v!global{global} \fi % for metatex - -\unexpanded\def\defineattribute - {\dodoubleempty\dodefineattribute} - -\def\dodefineattribute[#1][#2]% alternatively we can let lua do the housekeeping - {\expandafter\newattribute\csname @attr@#1\endcsname - \expandafter \xdef\csname :attr:#1\endcsname{\number\lastallocatedattribute}% - \ctxlua{attributes.define("#1",\number\lastallocatedattribute)}% - %\writestatus\m!systems{defining attribute #1 with number \number\lastallocatedattribute}% - \doifnotinset\v!global{#2}{\appendetoks\csname @attr@#1\endcsname\attributeunsetvalue\to\attributesresetlist}} - -\unexpanded\def\definesystemattribute - {\dodoubleempty\dodefinesystemattribute} - -\def\dodefinesystemattribute[#1][#2]% alternatively we can let lua do the housekeeping - {\scratchcounter\ctxlua{tex.print(attributes.private("#1"))}\relax - \global\expandafter\attributedef\csname @attr@#1\endcsname\scratchcounter - \expandafter \xdef\csname :attr:#1\endcsname{\number\scratchcounter}% - %\writestatus\m!systems{defining system attribute #1 with number \number\scratchcounter}% - \doifnotinset\v!global{#2}{\appendetoks\csname @attr@#1\endcsname\attributeunsetvalue\to\attributesresetlist}} - -% expandable so we can \edef them for speed - -\def\dosetattribute#1#2{\csname @attr@#1\endcsname#2\relax} -\def\doresetattribute#1{\csname @attr@#1\endcsname\attributeunsetvalue} -\def\dogetattribute #1{\number\csname @attr@#1\endcsname} -\def\dogetattributeid#1{\csname :attr:#1\endcsname} - -\let\dompattribute\gobbletwoarguments - -\def\resetallattributes{\the\attributesresetlist} +\registerctxluafile{node-acc}{1.001} % experimental \newcount\shownodescounter diff --git a/Master/texmf-dist/tex/context/base/node-inj.lua b/Master/texmf-dist/tex/context/base/node-inj.lua index 9c4612a2299..b9ef9188f94 100644 --- a/Master/texmf-dist/tex/context/base/node-inj.lua +++ b/Master/texmf-dist/tex/context/base/node-inj.lua @@ -6,8 +6,6 @@ if not modules then modules = { } end modules ['node-inj'] = { license = "see context related readme files" } --- tricky ... fonts.ids is not yet defined .. to be solved (maybe general tex ini) - -- This is very experimental (this will change when we have luatex > .50 and -- a few pending thingies are available. Also, Idris needs to make a few more -- test fonts. Btw, future versions of luatex will have extended glyph properties @@ -17,23 +15,28 @@ local next = next local trace_injections = false trackers.register("nodes.injections", function(v) trace_injections = v end) -fonts = fonts or { } -fonts.tfm = fonts.tfm or { } -fonts.ids = fonts.ids or { } +local report_injections = logs.reporter("nodes","injections") + +local attributes, nodes, node = attributes, nodes, node + +fonts = fonts +local fontdata = fonts.hashes.identifiers -local fontdata = fonts.ids +nodes.injections = nodes.injections or { } +local injections = nodes.injections -local glyph = node.id('glyph') -local kern = node.id('kern') +local nodecodes = nodes.nodecodes +local glyph_code = nodecodes.glyph +local nodepool = nodes.pool +local newkern = nodepool.kern local traverse_id = node.traverse_id +local unset_attribute = node.unset_attribute local has_attribute = node.has_attribute local set_attribute = node.set_attribute local insert_node_before = node.insert_before local insert_node_after = node.insert_after -local newkern = nodes.kern - local markbase = attributes.private('markbase') local markmark = attributes.private('markmark') local markdone = attributes.private('markdone') @@ -53,7 +56,7 @@ local kerns = { } -- for the moment we pass the r2l key ... volt/arabtype tests -function nodes.set_cursive(start,nxt,factor,rlmode,exit,entry,tfmstart,tfmnext) +function injections.setcursive(start,nxt,factor,rlmode,exit,entry,tfmstart,tfmnext) local dx, dy = factor*(exit[1]-entry[1]), factor*(exit[2]-entry[2]) local ws, wn = tfmstart.width, tfmnext.width local bound = #cursives + 1 @@ -63,7 +66,7 @@ function nodes.set_cursive(start,nxt,factor,rlmode,exit,entry,tfmstart,tfmnext) return dx, dy, bound end -function nodes.set_pair(current,factor,rlmode,r2lflag,spec,tfmchr) +function injections.setpair(current,factor,rlmode,r2lflag,spec,tfmchr) local x, y, w, h = factor*spec[1], factor*spec[2], factor*spec[3], factor*spec[4] -- dy = y - h if x ~= 0 or w ~= 0 or y ~= 0 or h ~= 0 then @@ -82,17 +85,19 @@ function nodes.set_pair(current,factor,rlmode,r2lflag,spec,tfmchr) return x, y, w, h -- no bound end -function nodes.set_kern(current,factor,rlmode,x,tfmchr) +function injections.setkern(current,factor,rlmode,x,tfmchr) local dx = factor*x if dx ~= 0 then local bound = #kerns + 1 set_attribute(current,kernpair,bound) kerns[bound] = { rlmode, dx } + return dx, bound + else + return 0, 0 end - return dx, bound end -function nodes.set_mark(start,base,factor,rlmode,ba,ma,index) --ba=baseanchor, ma=markanchor +function injections.setmark(start,base,factor,rlmode,ba,ma,index) --ba=baseanchor, ma=markanchor local dx, dy = factor*(ba[1]-ma[1]), factor*(ba[2]-ma[2]) local bound = has_attribute(base,markbase) if bound then @@ -104,7 +109,7 @@ function nodes.set_mark(start,base,factor,rlmode,ba,ma,index) --ba=baseanchor, m set_attribute(start,markdone,index) return dx, dy, bound else - logs.report("nodes mark", "possible problem, U+%04X is base without data (id: %s)",base.char,bound) + report_injections("possible problem, U+%05X is base mark without data (id: %s)",base.char,bound) end end index = index or 1 @@ -112,19 +117,17 @@ function nodes.set_mark(start,base,factor,rlmode,ba,ma,index) --ba=baseanchor, m set_attribute(base,markbase,bound) set_attribute(start,markmark,bound) set_attribute(start,markdone,index) - marks[bound] = { [index] = { dx, dy } } + marks[bound] = { [index] = { dx, dy, rlmode } } return dx, dy, bound end -function nodes.trace_injection(head) - local function dir(n) - return (n and n<0 and "r-to-l") or (n and n>0 and "l-to-r") or ("unset") - end - local function report(...) - logs.report("nodes finisher",...) - end - report("begin run") - for n in traverse_id(glyph,head) do +local function dir(n) + return (n and n<0 and "r-to-l") or (n and n>0 and "l-to-r") or "unset" +end + +local function trace(head) + report_injections("begin run") + for n in traverse_id(glyph_code,head) do if n.subtype < 256 then local kp = has_attribute(n,kernpair) local mb = has_attribute(n,markbase) @@ -132,65 +135,70 @@ function nodes.trace_injection(head) local md = has_attribute(n,markdone) local cb = has_attribute(n,cursbase) local cc = has_attribute(n,curscurs) - report("char U+%05X, font=%s",n.char,n.font) + report_injections("char U+%05X, font=%s",n.char,n.font) if kp then local k = kerns[kp] if k[3] then - report(" pairkern: dir=%s, x=%s, y=%s, w=%s, h=%s",dir(k[1]),k[2] or "?",k[3] or "?",k[4] or "?",k[5] or "?") + report_injections(" pairkern: dir=%s, x=%s, y=%s, w=%s, h=%s",dir(k[1]),k[2] or "?",k[3] or "?",k[4] or "?",k[5] or "?") else - report(" kern: dir=%s, dx=%s",dir(k[1]),k[2] or "?") + report_injections(" kern: dir=%s, dx=%s",dir(k[1]),k[2] or "?") end end if mb then - report(" markbase: bound=%s",mb) + report_injections(" markbase: bound=%s",mb) end if mm then local m = marks[mm] if mb then local m = m[mb] if m then - report(" markmark: bound=%s, index=%s, dx=%s, dy=%s",mm,md or "?",m[1] or "?",m[2] or "?") + report_injections(" markmark: bound=%s, index=%s, dx=%s, dy=%s",mm,md or "?",m[1] or "?",m[2] or "?") else - report(" markmark: bound=%s, missing index",mm) + report_injections(" markmark: bound=%s, missing index",mm) end else m = m[1] - report(" markmark: bound=%s, dx=%s, dy=%s",mm,m[1] or "?",m[2] or "?") + report_injections(" markmark: bound=%s, dx=%s, dy=%s",mm,m[1] or "?",m[2] or "?") end end if cb then - report(" cursbase: bound=%s",cb) + report_injections(" cursbase: bound=%s",cb) end if cc then local c = cursives[cc] - report(" curscurs: bound=%s, dir=%s, dx=%s, dy=%s",cc,dir(c[1]),c[2] or "?",c[3] or "?") + report_injections(" curscurs: bound=%s, dir=%s, dx=%s, dy=%s",cc,dir(c[1]),c[2] or "?",c[3] or "?") end end end - report("end run") + report_injections("end run") end -- todo: reuse tables (i.e. no collection), but will be extra fields anyway +-- todo: check for attribute -function nodes.inject_kerns(head,where,keep) +-- we can have a fast test on a font being processed, so we can check faster for marks etc + +function injections.handler(head,where,keep) local has_marks, has_cursives, has_kerns = next(marks), next(cursives), next(kerns) if has_marks or has_cursives then ---~ if has_marks or has_cursives or has_kerns then if trace_injections then - nodes.trace_injection(head) + trace(head) end -- in the future variant we will not copy items but refs to tables - local done, ky, rl, valid, cx, wx, mk = false, { }, { }, { }, { }, { }, { } + local done, ky, rl, valid, cx, wx, mk, nofvalid = false, { }, { }, { }, { }, { }, { }, 0 if has_kerns then -- move outside loop local nf, tm = nil, nil - for n in traverse_id(glyph,head) do + for n in traverse_id(glyph_code,head) do -- only needed for relevant fonts if n.subtype < 256 then - valid[#valid+1] = n + nofvalid = nofvalid + 1 + valid[nofvalid] = n if n.font ~= nf then nf = n.font - tm = fontdata[nf].marks + tm = fontdata[nf].resources.marks + end + if tm then + mk[n] = tm[n.char] end - mk[n] = tm[n.char] local k = has_attribute(n,kernpair) if k then local kk = kerns[k] @@ -210,18 +218,21 @@ function nodes.inject_kerns(head,where,keep) end else local nf, tm = nil, nil - for n in traverse_id(glyph,head) do + for n in traverse_id(glyph_code,head) do if n.subtype < 256 then - valid[#valid+1] = n + nofvalid = nofvalid + 1 + valid[nofvalid] = n if n.font ~= nf then nf = n.font - tm = fontdata[nf].marks + tm = fontdata[nf].resources.marks + end + if tm then + mk[n] = tm[n.char] end - mk[n] = tm[n.char] end end end - if #valid > 0 then + if nofvalid > 0 then -- we can assume done == true because we have cursives and marks local cx = { } if has_kerns and next(ky) then @@ -234,7 +245,7 @@ function nodes.inject_kerns(head,where,keep) local p_cursbase, p = nil, nil -- since we need valid[n+1] we can also use a "while true do" local t, d, maxt = { }, { }, 0 - for i=1,#valid do -- valid == glyphs + for i=1,nofvalid do -- valid == glyphs local n = valid[i] if not mk[n] then local n_cursbase = has_attribute(n,cursbase) @@ -298,28 +309,42 @@ function nodes.inject_kerns(head,where,keep) end end if has_marks then - for i=1,#valid do + for i=1,nofvalid do local p = valid[i] local p_markbase = has_attribute(p,markbase) if p_markbase then local mrks = marks[p_markbase] - for n in traverse_id(glyph,p.next) do + for n in traverse_id(glyph_code,p.next) do local n_markmark = has_attribute(n,markmark) if p_markbase == n_markmark then local index = has_attribute(n,markdone) or 1 local d = mrks[index] if d then - -- local rlmode = d[3] -- not used - -- if rlmode and rlmode > 0 then - -- todo - -- else + local rlmode = d[3] + if rlmode and rlmode >= 0 then + -- new per 2010-10-06, width adapted per 2010-02-03 + -- we used to negate the width of marks because in tfm + -- that makes sense but we no longer do that so as a + -- consequence the sign of p.width was changed (we need + -- to keep an eye on it as we don't have that many fonts + -- that enter this branch .. i'm still not sure if this + -- one is right + local k = wx[p] + if k then + n.xoffset = p.xoffset + p.width + d[1] - k[2] + else + -- n.xoffset = p.xoffset + p.width + d[1] + -- lucida U\char"032F (default+mark) + n.xoffset = p.xoffset - p.width + d[1] -- 01-05-2011 + end + else local k = wx[p] if k then n.xoffset = p.xoffset - d[1] - k[2] else n.xoffset = p.xoffset - d[1] end - -- end + end if mk[p] then n.yoffset = p.yoffset + d[2] else @@ -342,39 +367,21 @@ function nodes.inject_kerns(head,where,keep) -- only w can be nil, can be sped up when w == nil local rl, x, w, r2l = k[1], k[2] or 0, k[4] or 0, k[6] local wx = w - x ---~ if rl < 0 then ---~ if r2l then ---~ if wx ~= 0 then ---~ insert_node_before(head,n,newkern(wx)) ---~ end ---~ if x ~= 0 then ---~ insert_node_after (head,n,newkern(x)) ---~ end ---~ else ---~ if x ~= 0 then ---~ insert_node_before(head,n,newkern(x)) ---~ end ---~ if wx ~= 0 then ---~ insert_node_after(head,n,newkern(wx)) ---~ end ---~ end ---~ else - if r2l then - if wx ~= 0 then - insert_node_before(head,n,newkern(wx)) - end - if x ~= 0 then - insert_node_after (head,n,newkern(x)) - end - else - if x ~= 0 then - insert_node_before(head,n,newkern(x)) - end - if wx ~= 0 then - insert_node_after(head,n,newkern(wx)) - end + if r2l then + if wx ~= 0 then + insert_node_before(head,n,newkern(wx)) + end + if x ~= 0 then + insert_node_after (head,n,newkern(x)) + end + else + if x ~= 0 then + insert_node_before(head,n,newkern(x)) end ---~ end + if wx ~= 0 then + insert_node_after(head,n,newkern(wx)) + end + end end end if next(cx) then @@ -398,38 +405,22 @@ function nodes.inject_kerns(head,where,keep) end elseif has_kerns then if trace_injections then - nodes.trace_injection(head) + trace(head) end - for n in traverse_id(glyph,head) do - local k = has_attribute(n,kernpair) - if k then - local kk = kerns[k] - if kk then - local rl, x, y, w = kk[1], kk[2] or 0, kk[3], kk[4] - if y and y ~= 0 then - n.yoffset = y -- todo: h ? - end - if w then - -- copied from above - local r2l = kk[6] - local wx = w - x ---~ if rl < 0 then ---~ if r2l then ---~ if x ~= 0 then ---~ insert_node_before(head,n,newkern(x)) ---~ end ---~ if wx ~= 0 then ---~ insert_node_after(head,n,newkern(wx)) ---~ end ---~ else ---~ if wx ~= 0 then ---~ insert_node_before(head,n,newkern(wx)) ---~ end ---~ if x ~= 0 then ---~ insert_node_after (head,n,newkern(x)) ---~ end ---~ end ---~ else + for n in traverse_id(glyph_code,head) do + if n.subtype < 256 then + local k = has_attribute(n,kernpair) + if k then + local kk = kerns[k] + if kk then + local rl, x, y, w = kk[1], kk[2] or 0, kk[3], kk[4] + if y and y ~= 0 then + n.yoffset = y -- todo: h ? + end + if w then + -- copied from above + local r2l = kk[6] + local wx = w - x if r2l then if wx ~= 0 then insert_node_before(head,n,newkern(wx)) @@ -445,11 +436,11 @@ function nodes.inject_kerns(head,where,keep) insert_node_after(head,n,newkern(wx)) end end ---~ end - else - -- simple (e.g. kernclass kerns) - if x ~= 0 then - insert_node_before(head,n,newkern(x)) + else + -- simple (e.g. kernclass kerns) + if x ~= 0 then + insert_node_before(head,n,newkern(x)) + end end end end diff --git a/Master/texmf-dist/tex/context/base/node-mig.lua b/Master/texmf-dist/tex/context/base/node-mig.lua index f9f0ad23184..620cb3c0e55 100644 --- a/Master/texmf-dist/tex/context/base/node-mig.lua +++ b/Master/texmf-dist/tex/context/base/node-mig.lua @@ -8,20 +8,25 @@ if not modules then modules = { } end modules ['node-mig'] = { local format = string.format -local hlist = node.id('hlist') -local vlist = node.id('vlist') -local insert = node.id('ins') -local mark = node.id('mark') +local attributes, nodes, node = attributes, nodes, node local has_attribute = node.has_attribute local set_attribute = node.set_attribute local remove_nodes = nodes.remove -local migrated = attributes.private("migrated") +local nodecodes = nodes.nodecodes +local tasks = nodes.tasks -local trace_migrations = false +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist +local insert_code = nodecodes.ins +local mark_code = nodecodes.mark -trackers.register("nodes.migrations", function(v) trace_migrations = v end) +local migrated = attributes.private("migrated") + +local trace_migrations = false trackers.register("nodes.migrations", function(v) trace_migrations = v end) + +local report_nodes = logs.reporter("nodes","migrations") local migrate_inserts, migrate_marks @@ -31,10 +36,10 @@ local function locate(head,first,last,ni,nm) local current = head while current do local id = current.id - if id == vlist or id == hlist then + if id == vlist_code or id == hlist_code then current.list, first, last, ni, nm = locate(current.list,first,last,ni,nm) current= current.next - elseif migrate_inserts and id == insert then + elseif migrate_inserts and id == insert_code then local insert head, current, insert = remove_nodes(head,current) insert.next = nil @@ -44,7 +49,7 @@ local function locate(head,first,last,ni,nm) insert.prev, first = nil, insert end last, ni = insert, ni + 1 - elseif migrate_marks and id == mark then + elseif migrate_marks and id == mark_code then local mark head, current, mark = remove_nodes(head,current) mark.next = nil @@ -61,20 +66,20 @@ local function locate(head,first,last,ni,nm) return head, first, last, ni, nm end -function nodes.migrate_outwards(head,where) +function nodes.handlers.migrate(head,where) local done = false if head then local current = head while current do local id = current.id - if id == vlist or id == hlist and not has_attribute(current,migrated) then + if id == vlist_code or id == hlist_code and not has_attribute(current,migrated) then set_attribute(current,migrated,1) t_sweeps = t_sweeps + 1 local h = current.list local first, last, ni, nm while h do local id = h.id - if id == vlist or id == hlist then + if id == vlist_code or id == hlist_code then h, first, last, ni, nm = locate(h,first,last,0,0) end h = h.next @@ -82,7 +87,7 @@ function nodes.migrate_outwards(head,where) if first then t_inserts, t_marks = t_inserts + ni, t_marks + nm if trace_migrations and (ni > 0 or nm > 0) then - logs.report("nodes","sweep %s, %s inserts and %s marks migrated outwards",t_sweeps,ni,nm) + report_nodes("sweep %s, %s inserts and %s marks migrated outwards",t_sweeps,ni,nm) end -- inserts after head local n = current.next @@ -99,16 +104,18 @@ function nodes.migrate_outwards(head,where) end end +-- for the moment this way, this will disappear + experiments.register("marks.migrate", function(v) if v then - tasks.enableaction("mvlbuilders", "nodes.migrate_outwards") + tasks.enableaction("mvlbuilders", "nodes.handlers.migrate") end migrate_marks = v end) experiments.register("inserts.migrate", function(v) if v then - tasks.enableaction("mvlbuilders", "nodes.migrate_outwards") + tasks.enableaction("mvlbuilders", "nodes.handlers.migrate") end migrate_inserts = v end) diff --git a/Master/texmf-dist/tex/context/base/node-mig.mkiv b/Master/texmf-dist/tex/context/base/node-mig.mkiv index cd731b96f79..c07f5ed5b78 100644 --- a/Master/texmf-dist/tex/context/base/node-mig.mkiv +++ b/Master/texmf-dist/tex/context/base/node-mig.mkiv @@ -45,16 +45,17 @@ \newtoks \everyautomigratefootnotes \newtoks \everyautomigratemarks -\def\automigrateinserts{\the\everyautomigratefootnotes} +\def\automigrateinserts{\the\everyautomigratefootnotes} % soon default but does not work (yet) for notes in captions (themselves inserts) \def\automigratemarks {\the\everyautomigratemarks} \appendtoks - \let\postponenotes\relax - \enableexperiments[inserts.migrate]% + \let\postponenotes\relax + \enableexperiments[inserts.migrate]% \to \everyautomigratefootnotes \appendtoks - \enableexperiments[marks.migrate]% + \writestatus\m!system{migration of marks is normally not needed}% + \enableexperiments[marks.migrate]% \to \everyautomigratemarks \protect diff --git a/Master/texmf-dist/tex/context/base/node-pag.lua b/Master/texmf-dist/tex/context/base/node-pag.lua index 4bc53c6ddb6..9b8202042c5 100644 --- a/Master/texmf-dist/tex/context/base/node-pag.lua +++ b/Master/texmf-dist/tex/context/base/node-pag.lua @@ -13,7 +13,7 @@ pagebuilders = pagebuilders or { } local starttiming, stoptiming = statistics.starttiming, statistics.stoptiming -local actions = tasks.actions("pagebuilders",5) +local actions = nodes.tasks.actions("pagebuilders") local function processor(head,groupcode,size,packtype,maxdepth,direction) starttiming(pagebuilders) diff --git a/Master/texmf-dist/tex/context/base/node-par.lua b/Master/texmf-dist/tex/context/base/node-par.lua index 7be7e7917ca..b0879c7506b 100644 --- a/Master/texmf-dist/tex/context/base/node-par.lua +++ b/Master/texmf-dist/tex/context/base/node-par.lua @@ -6,28 +6,43 @@ if not modules then modules = { } end modules ['node-par'] = { license = "see context related readme files" } -parbuilders = parbuilders or { } +local builders, nodes, node = builders, nodes, node + +builders.paragraphs = builders.paragraphs or { } +local parbuilders = builders.paragraphs + parbuilders.constructors = parbuilders.constructors or { } -parbuilders.names = parbuilders.names or { } -parbuilders.numbers = parbuilders.numbers or { } -parbuilders.attribute = attributes.numbers['parbuilder'] or 999 +local constructors = parbuilders.constructors + +constructors.names = constructors.names or { } +local names = constructors.names + +constructors.numbers = constructors.numbers or { } +local numbers = constructors.numbers + +constructors.methods = constructors.methods or { } +local methods = constructors.methods + +local p_attribute = attributes.numbers['parbuilder'] or 999 +constructors.attribute = p_attribute -storage.register("parbuilders.names", parbuilders.names, "parbuilders.names") -storage.register("parbuilders.numbers", parbuilders.numbers, "parbuilders.numbers") +local has_attribute = node.has_attribute +local starttiming = statistics.starttiming +local stoptiming = statistics.stoptiming -local constructors, names, numbers, p_attribute = parbuilders.constructors, parbuilders.names, parbuilders.numbers, parbuilders.attribute +storage.register("builders/paragraphs/constructors/names", names, "builders.paragraphs.constructors.names") +storage.register("builders/paragraphs/constructors/numbers", numbers, "builders.paragraphs.constructors.numbers") -local has_attribute = node.has_attribute -local starttiming, stoptiming = statistics.starttiming, statistics.stoptiming +local report_parbuilders = logs.reporter("parbuilders") local mainconstructor = nil -- not stored in format -function parbuilders.register(name,number) - parbuilders.names[number] = name - parbuilders.numbers[name] = number +function constructors.register(name,number) + names[number] = name + numbers[name] = number end -function parbuilders.setmain(name) +function constructors.set(name) mainconstructor = numbers[name] end @@ -37,19 +52,19 @@ end -- false : idem but dangerous -- head : list of valid vmode nodes with last being hlist -function parbuilders.constructor(head,followed_by_display) +function constructors.handler(head,followed_by_display) if type(head) == "boolean" then return head else local attribute = has_attribute(head,p_attribute) or mainconstructor if attribute then - local constructor = names[attribute] - if constructor then - local handler = constructor and constructors[constructor] + local method = names[attribute] + if method then + local handler = methods[method] if handler then return handler(head,followed_by_display) else - logs.report("parbuilders","handler '%s' is not defined",tostring(constructor)) + report_parbuilders("contructor method '%s' is not defined",tostring(method)) return true -- let tex break end end @@ -60,28 +75,28 @@ end -- just for testing -function parbuilders.constructors.default(head,followed_by_display) +function constructors.methods.default(head,followed_by_display) return true -- let tex break end -- also for testing (no surrounding spacing done) -function parbuilders.constructors.oneline(head,followed_by_display) +function constructors.methods.oneline(head,followed_by_display) return node.hpack(head) end -- It makes no sense to have a sequence here as we already have -- pre and post hooks and only one parbuilder makes sense, so no: -- --- local actions = tasks.actions("parbuilders",1) +-- local actions = nodes.tasks.actions("parbuilders") -- todo: enable one as main -local actions = parbuilders.constructor +local actions = constructors.handler local enabled = false -function parbuilders.enable () enabled = true end -function parbuilders.disable() enabled = false end +function constructors.enable () enabled = true end +function constructors.disable() enabled = false end local function processor(head,followed_by_display) if enabled then diff --git a/Master/texmf-dist/tex/context/base/node-par.mkiv b/Master/texmf-dist/tex/context/base/node-par.mkiv index cb53e643d7e..2e9efde1f3c 100644 --- a/Master/texmf-dist/tex/context/base/node-par.mkiv +++ b/Master/texmf-dist/tex/context/base/node-par.mkiv @@ -30,7 +30,7 @@ \registerctxluafile{node-par}{1.001} -\definesystemattribute[parbuilder] \chardef\parbuilderattribute \dogetattributeid{parbuilder} +\definesystemattribute[parbuilder][public] % todo auto-enable @@ -40,7 +40,7 @@ \unexpanded\def\defineparbuilder[#1]% {\global\advance\nofparbuilders\plusone - \ctxlua{parbuilders.register("#1",\number\nofparbuilders)}% + \ctxlua{builders.paragraphs.constructors.register("#1",\number\nofparbuilders)}% \setxvalue{\??ng:#1}{\attribute\parbuilderattribute\nofparbuilders}} \unexpanded\def\startparbuilder[#1]% @@ -56,7 +56,7 @@ \checkparbuilders} \def\setmainparbuilder[#1]% - {\ctxlua{parbuilders.setmain("#1")}} + {\ctxlua{builders.paragraphs.constructors.set("#1")}} % no high level interface, after all implementing a linebreaker is not something that % the average user will do @@ -65,8 +65,8 @@ \defineparbuilder[oneline] % just for testing \defineparbuilder[basic] % just for testing -\def\enableparbuilders {\ctxlua{parbuilders.enable ()}} -\def\disableparbuilders{\ctxlua{parbuilders.disable()}} +\def\enableparbuilders {\ctxlua{builders.paragraphs.constructors.enable ()}} +\def\disableparbuilders{\ctxlua{builders.paragraphs.constructors.disable()}} \def\checkparbuilders % can be more efficient as we don't want to do this to often {\ifcase\attribute\parbuilderattribute diff --git a/Master/texmf-dist/tex/context/base/node-pro.lua b/Master/texmf-dist/tex/context/base/node-pro.lua index 4f5b3dcbe9c..2d04a4d7185 100644 --- a/Master/texmf-dist/tex/context/base/node-pro.lua +++ b/Master/texmf-dist/tex/context/base/node-pro.lua @@ -7,37 +7,41 @@ if not modules then modules = { } end modules ['node-pro'] = { } local utf = unicode.utf8 +local utfchar = utf.char local format, concat = string.format, table.concat local trace_callbacks = false trackers.register("nodes.callbacks", function(v) trace_callbacks = v end) -local glyph = node.id('glyph') +local report_nodes = logs.reporter("nodes","processors") -local free_node = node.free -local first_character = node.first_character +local nodes, node = nodes, node -nodes.processors = nodes.processors or { } +local nodecodes = nodes.nodecodes +local glyph_code = nodecodes.glyph +local tasks = nodes.tasks + +local free_node = node.free +local first_glyph = node.first_glyph or node.first_character + +nodes.processors = nodes.processors or { } +local processors = nodes.processors -- vbox: grouptype: vbox vtop output split_off split_keep | box_type: exactly|aditional -- hbox: grouptype: hbox adjusted_hbox(=hbox_in_vmode) | box_type: exactly|aditional -lists = lists or { } -chars = chars or { } -words = words or { } -- not used yet - -local actions = tasks.actions("processors",4) +local actions = tasks.actions("processors") local n = 0 -local function reconstruct(head) - local t = { } - local h = head +local function reconstruct(head) -- we probably have a better one + local t, n, h = { }, 0, head while h do + n = n + 1 local id = h.id - if id == glyph then - t[#t+1] = utf.char(h.char) + if id == glyph_code then -- todo: disc etc + t[n] = utfchar(h.char) else - t[#t+1] = "[]" + t[n] = "[]" end h = h.next end @@ -52,16 +56,18 @@ local function tracer(what,state,head,groupcode,before,after,show) end n = n + 1 if show then - logs.report("nodes","%s %s: %s, group: %s, nodes: %s -> %s, string: %s",what,n,state,groupcode,before,after,reconstruct(head)) + report_nodes("%s %s: %s, group: %s, nodes: %s -> %s, string: %s",what,n,state,groupcode,before,after,reconstruct(head)) else - logs.report("nodes","%s %s: %s, group: %s, nodes: %s -> %s",what,n,state,groupcode,before,after) + report_nodes("%s %s: %s, group: %s, nodes: %s -> %s",what,n,state,groupcode,before,after) end end -nodes.processors.enabled = true -- thsi will become a proper state (like trackers) +processors.tracer = tracer -function nodes.processors.pre_linebreak_filter(head,groupcode,size,packtype,direction) - local first, found = first_character(head) +processors.enabled = true -- this will become a proper state (like trackers) + +function processors.pre_linebreak_filter(head,groupcode,size,packtype,direction) + local first, found = first_glyph(head) if found then if trace_callbacks then local before = nodes.count(head,true) @@ -84,51 +90,66 @@ function nodes.processors.pre_linebreak_filter(head,groupcode,size,packtype,dire return true end -function nodes.processors.hpack_filter(head,groupcode,size,packtype,direction) - local first, found = first_character(head) - if found then - if trace_callbacks then - local before = nodes.count(head,true) - local head, done = actions(head,groupcode,size,packtype,direction) - local after = nodes.count(head,true) - if done then - tracer("hpack","changed",head,groupcode,before,after,true) +local enabled = true + +function processors.hpack_filter(head,groupcode,size,packtype,direction) + if enabled then + local first, found = first_glyph(head) + if found then + if trace_callbacks then + local before = nodes.count(head,true) + local head, done = actions(head,groupcode,size,packtype,direction) + local after = nodes.count(head,true) + if done then + tracer("hpack","changed",head,groupcode,before,after,true) + else + tracer("hpack","unchanged",head,groupcode,before,after,true) + end + return (done and head) or true else - tracer("hpack","unchanged",head,groupcode,before,after,true) + local head, done = actions(head,groupcode,size,packtype,direction) + return (done and head) or true end - return (done and head) or true - else - local head, done = actions(head,groupcode,size,packtype,direction) - return (done and head) or true + elseif trace_callbacks then + local n = nodes.count(head,false) + tracer("hpack","no chars",head,groupcode,n,n) end - elseif trace_callbacks then - local n = nodes.count(head,false) - tracer("hpack","no chars",head,groupcode,n,n) end return true end -callbacks.register('pre_linebreak_filter', nodes.processors.pre_linebreak_filter,"all kind of horizontal manipulations (before par break)") -callbacks.register('hpack_filter' , nodes.processors.hpack_filter,"all kind of horizontal manipulations") +local hpack = node.hpack + +function nodes.fasthpack(...) -- todo: pass explicit arguments + enabled = false + local hp, b = hpack(...) + enabled = true + return hp, b +end -local actions = tasks.actions("finalizers",1) -- head, where +callbacks.register('pre_linebreak_filter', processors.pre_linebreak_filter,"all kind of horizontal manipulations (before par break)") +callbacks.register('hpack_filter' , processors.hpack_filter,"all kind of horizontal manipulations") --- beware, these are packaged boxes so no first_character test +local actions = tasks.actions("finalizers") -- head, where + +-- beware, these are packaged boxes so no first_glyph test -- maybe some day a hash with valid groupcodes -- -- beware, much can pass twice, for instance vadjust passes two times +-- +-- something weird here .. group mvl when making a vbox -function nodes.processors.post_linebreak_filter(head,groupcode) ---~ local first, found = first_character(head) +function processors.post_linebreak_filter(head,groupcode) +--~ local first, found = first_glyph(head) --~ if found then if trace_callbacks then local before = nodes.count(head,true) local head, done = actions(head,groupcode) local after = nodes.count(head,true) if done then - tracer("finalizer","changed",head,groupcode,before,after,true) + tracer("post_linebreak","changed",head,groupcode,before,after,true) else - tracer("finalizer","unchanged",head,groupcode,before,after,true) + tracer("post_linebreak","unchanged",head,groupcode,before,after,true) end return (done and head) or true else @@ -137,12 +158,12 @@ function nodes.processors.post_linebreak_filter(head,groupcode) end --~ elseif trace_callbacks then --~ local n = nodes.count(head,false) ---~ tracer("finalizer","no chars",head,groupcode,n,n) +--~ tracer("post_linebreak","no chars",head,groupcode,n,n) --~ end --~ return true end -callbacks.register('post_linebreak_filter', nodes.processors.post_linebreak_filter,"all kind of horizontal manipulations (after par break)") +callbacks.register('post_linebreak_filter', processors.post_linebreak_filter,"all kind of horizontal manipulations (after par break)") statistics.register("h-node processing time", function() return statistics.elapsedseconds(nodes,"including kernel") -- hm, ok here? diff --git a/Master/texmf-dist/tex/context/base/node-ref.lua b/Master/texmf-dist/tex/context/base/node-ref.lua index 7128b1a6d20..19d602ed673 100644 --- a/Master/texmf-dist/tex/context/base/node-ref.lua +++ b/Master/texmf-dist/tex/context/base/node-ref.lua @@ -14,10 +14,21 @@ if not modules then modules = { } end modules ['node-bck'] = { -- helper, will end up in luatex +-- is grouplevel still used? + +local allocate, mark = utilities.storage.allocate, utilities.storage.mark + local cleanupreferences, cleanupdestinations = false, true -local nodeinjections = backends.nodeinjections -local codeinjections = backends.codeinjections +local attributes, nodes, node = attributes, nodes, node + +local nodeinjections = backends.nodeinjections +local codeinjections = backends.codeinjections + +local transparencies = attributes.transparencies +local colors = attributes.colors +local references = structures.references +local tasks = nodes.tasks local hpack_list = node.hpack local list_dimensions = node.dimensions @@ -28,17 +39,37 @@ local trace_backend = false trackers.register("nodes.backend", functi local trace_references = false trackers.register("nodes.references", function(v) trace_references = v end) local trace_destinations = false trackers.register("nodes.destinations", function(v) trace_destinations = v end) -local hlist = node.id("hlist") -local vlist = node.id("vlist") -local glue = node.id("glue") -local whatsit = node.id("whatsit") +local report_reference = logs.reporter("backend","references") +local report_destination = logs.reporter("backend","destinations") +local report_area = logs.reporter("backend","areas") + +local nodecodes = nodes.nodecodes +local skipcodes = nodes.skipcodes +local whatcodes = nodes.whatcodes +local listcodes = nodes.listcodes + +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist +local glue_code = nodecodes.glue +local whatsit_code = nodecodes.whatsit -local new_kern = nodes.kern +local leftskip_code = skipcodes.leftskip +local rightskip_code = skipcodes.rightskip +local parfillskip_code = skipcodes.parfillskip -local has_attribute = node.has_attribute -local traverse = node.traverse -local find_node_tail = node.tail or node.slide -local tosequence = nodes.tosequence +local localpar_code = whatcodes.localpar +local dir_code = whatcodes.dir + +local line_code = listcodes.line + +local nodepool = nodes.pool + +local new_kern = nodepool.kern + +local has_attribute = node.has_attribute +local traverse = node.traverse +local find_node_tail = node.tail or node.slide +local tosequence = nodes.tosequence local function dimensions(parent,start,stop) stop = stop and stop.next @@ -78,14 +109,14 @@ local function inject_range(head,first,last,reference,make,stack,parent,pardir,t if result and resolved then if head == first then if trace_backend then - logs.report("backend","head: %04i %s %s %s => w=%s, h=%s, d=%s, c=%s",reference,pardir or "---",txtdir or "----",tosequence(first,last,true),width,height,depth,resolved) + report_area("head: %04i %s %s %s => w=%s, h=%s, d=%s, c=%s",reference,pardir or "---",txtdir or "----",tosequence(first,last,true),width,height,depth,resolved) end result.next = first first.prev = result return result, last else if trace_backend then - logs.report("backend","middle: %04i %s %s => w=%s, h=%s, d=%s, c=%s",reference,pardir or "---",txtdir or "----",tosequence(first,last,true),width,height,depth,resolved) + report_area("middle: %04i %s %s => w=%s, h=%s, d=%s, c=%s",reference,pardir or "---",txtdir or "----",tosequence(first,last,true),width,height,depth,resolved) end local prev = first.prev if prev then @@ -111,20 +142,17 @@ local function inject_list(id,current,reference,make,stack,pardir,txtdir) local width, height, depth, correction = current.width, current.height, current.depth, 0 local moveright = false local first = current.list - if id == hlist then + if id == hlist_code then -- box_code line_code -- can be either an explicit hbox or a line and there is no way -- to recognize this; anyway only if ht/dp (then inline) - -- - -- to be tested: 0=unknown, 1=linebreak, 2=hbox ---~ if id.subtype == 1 then local sr = stack[reference] if first then if sr and sr[2] then local last = find_node_tail(first) - if last.id == glue and last.subtype == 9 then + if last.id == glue_code and last.subtype == rightskip_code then local prev = last.prev - moveright = first.id == glue and first.subtype == 8 - if prev and prev.id == glue and prev.subtype == 15 then + moveright = first.id == glue_code and first.subtype == leftskip_code + if prev and prev.id == glue_code and prev.subtype == parfillskip_code then width = dimensions(current,first,prev.prev) -- maybe not current as we already take care of it else if moveright and first.writable then @@ -138,10 +166,6 @@ local function inject_list(id,current,reference,make,stack,pardir,txtdir) else -- also weird end ---~ else ---~ print("!!!!!!!!!!!!!!!!!") - -- simple ---~ end else -- ok end @@ -156,7 +180,7 @@ local function inject_list(id,current,reference,make,stack,pardir,txtdir) local result, resolved = make(width,height,depth,reference) if result and resolved then if trace_backend then - logs.report("backend","box: %04i %s %s: w=%s, h=%s, d=%s, c=%s",reference,pardir or "---",txtdir or "----",width,height,depth,resolved) + report_area("box: %04i %s %s: w=%s, h=%s, d=%s, c=%s",reference,pardir or "---",txtdir or "----",width,height,depth,resolved) end if not first then current.list = result @@ -186,15 +210,21 @@ local function inject_areas(head,attribute,make,stack,done,skip,parent,pardir,tx while current do local id = current.id local r = has_attribute(current,attribute) - if id == whatsit then + if id == whatsit_code then local subtype = current.subtype - if subtype == 6 then + if subtype == localpar_code then pardir = current.dir - elseif subtype == 7 then + elseif subtype == dir_code then txtdir = current.dir end - elseif id == hlist or id == vlist then - if not reference and r and (not skip or r > skip) then + elseif id == glue_code and current.subtype == leftskip_code then -- any glue at the left? + -- + elseif id == hlist_code or id == vlist_code then +-- somehow reference is true so teh following fails (second one not done) in +-- test \goto{test}[page(2)] test \gotobox{test}[page(2)] +-- so let's wait till this fails again +-- if not reference and r and (not skip or r > skip) then -- > or ~= + if r and (not skip or r > skip) then -- > or ~= inject_list(id,current,r,make,stack,pardir,txtdir) end if r then @@ -214,8 +244,8 @@ local function inject_areas(head,attribute,make,stack,done,skip,parent,pardir,tx reference, first, last, firstdir = r, current, current, txtdir elseif r == reference then last = current - elseif (done[reference] or 0) == 0 then - if not skip or r > skip then + elseif (done[reference] or 0) == 0 then -- or id == glue_code and current.subtype == right_skip_code + if not skip or r > skip then -- maybe no > test head, current = inject_range(head,first,last,reference,make,stack,parent,pardir,firstdir) reference, first, last, firstdir = nil, nil, nil, nil end @@ -239,14 +269,14 @@ local function inject_area(head,attribute,make,stack,done,parent,pardir,txtdir) while current do local id = current.id local r = has_attribute(current,attribute) - if id == whatsit then + if id == whatsit_code then local subtype = current.subtype - if subtype == 6 then + if subtype == localpar_code then pardir = current.dir - elseif subtype == 7 then + elseif subtype == dir_code then txtdir = current.dir end - elseif id == hlist or id == vlist then + elseif id == hlist_code or id == vlist_code then if r and not done[r] then done[r] = true inject_list(id,current,r,make,stack,pardir,txtdir) @@ -264,8 +294,12 @@ end -- tracing -local new_rule = nodes.rule -local new_kern = nodes.kern + +local nodepool = nodes.pool + +local new_rule = nodepool.rule +local new_kern = nodepool.kern + local set_attribute = node.set_attribute local register_color = colors.register @@ -293,6 +327,15 @@ local function colorize(width,height,depth,n) end u_colors[n] = u_color end + if width == 0 then + report_area("reference %s has no horizontal dimensions: width=%s, height=%s, depth=%s",reference,width,height,depth) + width = 65536 + end + if height + depth <= 0 then + report_area("reference %s has no vertical dimensions: width=%s, height=%s, depth=%s",reference,width,height,depth) + height = 65536/2 + depth = height + end local rule = new_rule(width,height,depth) set_attribute(rule,a_colormodel,1) -- gray color model set_attribute(rule,a_color,u_color) @@ -308,35 +351,51 @@ local function colorize(width,height,depth,n) end end -local new_kern = nodes.kern +local nodepool = nodes.pool + +local new_kern = nodepool.kern + local texattribute = tex.attribute local texcount = tex.count -- references: +local stack = { } +local done = { } +local attribute = attributes.private('reference') +local nofreferences = 0 +local topofstack = 0 + nodes.references = { - attribute = attributes.private('reference'), - stack = { }, - done = { }, + attribute = attribute, + stack = stack, + done = done, } -local stack, done, attribute = nodes.references.stack, nodes.references.done, nodes.references.attribute - -local nofreferences, topofstack = 0, 0 +-- todo: get rid of n (n is just a number, can be used for tracing, obsolete) -local function setreference(n,h,d,r) -- n is just a number, can be used for tracing +local function setreference(n,h,d,r) topofstack = topofstack + 1 - stack[topofstack] = { n, h, d, codeinjections.prerollreference(r) } -- the preroll permits us to determine samepage (but delayed also has some advantages) ---~ texattribute[attribute] = topofstack -- todo -> at tex end + -- the preroll permits us to determine samepage (but delayed also has some advantages) + -- so some part of the backend work is already done here +--~ stack[topofstack] = { n, h, d, codeinjections.prerollreference(r) } + stack[topofstack] = { r, h, d, codeinjections.prerollreference(r) } + -- texattribute[attribute] = topofstack -- todo -> at tex end texcount.lastreferenceattribute = topofstack end -nodes.setreference = setreference +function references.get(n) -- not public so functionality can change + local sn = stack[n] + return sn and sn[1] +end local function makereference(width,height,depth,reference) local sr = stack[reference] if sr then - local resolved, ht, dp, set = sr[1], sr[2], sr[3], sr[4] + if trace_references then + report_reference("resolving attribute %s",reference) + end + local resolved, ht, dp, set, n = sr[1], sr[2], sr[3], sr[4], sr[5] if ht then if height < ht then height = ht end if depth < dp then depth = dp end @@ -347,7 +406,7 @@ local function makereference(width,height,depth,reference) local result, current if trace_references then local step = 65536 - result = hpack_list(colorize(width,height-step,depth-step,2)) -- step subtracted so that we can see seperate links + result = hpack_list(colorize(width,height-step,depth-step,2,reference)) -- step subtracted so that we can see seperate links result.width = 0 current = result end @@ -356,19 +415,20 @@ local function makereference(width,height,depth,reference) else result = annot end + references.registerpage(n) result = hpack_list(result,0) result.width, result.height, result.depth = 0, 0, 0 if cleanupreferences then stack[reference] = nil end return result, resolved - else - logs.report("backends","unable to resolve reference annotation %s",reference) + elseif trace_references then + report_reference("unable to resolve annotation %s",reference) end - else - logs.report("backends","unable to resolve reference attribute %s",reference) + elseif trace_references then + report_reference("unable to resolve attribute %s",reference) end end -function nodes.add_references(head) +function nodes.references.handler(head) if topofstack > 0 then return inject_areas(head,attribute,makereference,stack,done) else @@ -376,29 +436,32 @@ function nodes.add_references(head) end end --- destinations (we can clean up once set!) +-- destinations (we can clean up once set, unless tagging!) + +local stack = { } +local done = { } +local attribute = attributes.private('destination') +local nofdestinations = 0 +local topofstack = 0 nodes.destinations = { - attribute = attributes.private('destination'), - stack = { }, - done = { }, + attribute = attribute, + stack = stack, + done = done, } -local stack, done, attribute = nodes.destinations.stack, nodes.destinations.done, nodes.destinations.attribute - -local nofdestinations, topofstack = 0, 0 - local function setdestination(n,h,d,name,view) -- n = grouplevel, name == table topofstack = topofstack + 1 stack[topofstack] = { n, h, d, name, view } return topofstack end -nodes.setdestination = setdestination - local function makedestination(width,height,depth,reference) local sr = stack[reference] if sr then + if trace_destinations then + report_destination("resolving attribute %s",reference) + end local resolved, ht, dp, name, view = sr[1], sr[2], sr[3], sr[4], sr[5] if ht then if height < ht then height = ht end @@ -412,7 +475,7 @@ local function makedestination(width,height,depth,reference) width, height, depth = 5*step, 5*step, 0 end for n=1,#name do - local rule = hpack_list(colorize(width,height,depth,3)) + local rule = hpack_list(colorize(width,height,depth,3,reference)) rule.width = 0 if not result then result, current = rule, rule @@ -435,16 +498,19 @@ local function makedestination(width,height,depth,reference) current = annot end end - result = hpack_list(result,0) - result.width, result.height, result.depth = 0, 0, 0 + if result then + -- some internal error + result = hpack_list(result,0) + result.width, result.height, result.depth = 0, 0, 0 + end if cleanupdestinations then stack[reference] = nil end return result, resolved - else - logs.report("backends","unable to resolve destination attribute %s",reference) + elseif trace_destinations then + report_destination("unable to resolve attribute %s",reference) end end -function nodes.add_destinations(head) +function nodes.destinations.handler(head) if topofstack > 0 then return inject_area(head,attribute,makedestination,stack,done) -- singular else @@ -454,12 +520,12 @@ end -- will move -function jobreferences.mark(reference,h,d,view) +function references.mark(reference,h,d,view) return setdestination(tex.currentgrouplevel,h,d,reference,view) end -function jobreferences.inject(prefix,reference,h,d,highlight,newwindow,layer) -- todo: use currentreference is possible - local set, bug = jobreferences.identify(prefix,reference) +function references.inject(prefix,reference,h,d,highlight,newwindow,layer) -- todo: use currentreference is possible + local set, bug = references.identify(prefix,reference) if bug or #set == 0 then -- unknown ref, just don't set it and issue an error else @@ -469,8 +535,8 @@ function jobreferences.inject(prefix,reference,h,d,highlight,newwindow,layer) -- end end -function jobreferences.injectcurrentset(h,d) -- used inside doifelse - local currentset = jobreferences.currentset +function references.injectcurrentset(h,d) -- used inside doifelse + local currentset = references.currentset if currentset then setreference(tex.currentgrouplevel,h,d,currentset) -- sets attribute / todo: for set[*].error end @@ -480,43 +546,16 @@ end local function checkboth(open,close) if open and open ~= "" then - local set, bug = jobreferences.identify("",open) + local set, bug = references.identify("",open) open = not bug and #set > 0 and set end if close and close ~= "" then - local set, bug = jobreferences.identify("",close) + local set, bug = references.identify("",close) close = not bug and #set > 0 and set end return open, close end --- expansion is temp hack - -local opendocument, closedocument, openpage, closepage - -local function check(what) - if what and what ~= "" then - local set, bug = jobreferences.identify("",what) - return not bug and #set > 0 and set - end -end - -function jobreferences.checkopendocumentactions (open) opendocument = check(open) end -function jobreferences.checkclosedocumentactions(close) closedocument = check(close) end -function jobreferences.checkopenpageactions (open) openpage = check(open) end -function jobreferences.checkclosepageactions (close) closepage = check(close) end - -function jobreferences.flushdocumentactions() - if opendocument or closedocument then - backends.codeinjections.flushdocumentactions(opendocument,closedocument) -- backend - end -end -function jobreferences.flushpageactions() - if openpage or closepage then - backends.codeinjections.flushpageactions(openpage,closepage) -- backend - end -end - -- end temp hack statistics.register("interactive elements", function() @@ -527,7 +566,7 @@ statistics.register("interactive elements", function() end end) -function jobreferences.enable_interaction() - tasks.enableaction("shipouts","nodes.add_references") - tasks.enableaction("shipouts","nodes.add_destinations") +function references.enableinteraction() + tasks.enableaction("shipouts","nodes.references.handler") + tasks.enableaction("shipouts","nodes.destinations.handler") end diff --git a/Master/texmf-dist/tex/context/base/node-res.lua b/Master/texmf-dist/tex/context/base/node-res.lua index a8ea8745a72..7f737ea7040 100644 --- a/Master/texmf-dist/tex/context/base/node-res.lua +++ b/Master/texmf-dist/tex/context/base/node-res.lua @@ -7,38 +7,45 @@ if not modules then modules = { } end modules ['node-res'] = { } local gmatch, format = string.gmatch, string.format -local copy_node, free_node, free_list, new_node, node_type, node_id = node.copy, node.free, node.flush_list, node.new, node.type, node.id local tonumber, round = tonumber, math.round -local glyph_node = node_id("glyph") - --[[ldx--

The next function is not that much needed but in we use for debugging node management.

--ldx]]-- -nodes = nodes or { } +local report_nodes = logs.reporter("nodes","housekeeping") -nodes.whatsits = { } -- table.swapped(node.whatsits()) +local nodes, node = nodes, node -local reserved = { } -local whatsits = nodes.whatsits +local copy_node = node.copy +local free_node = node.free +local free_list = node.flush_list +local new_node = node.new -for k, v in next, node.whatsits() do - whatsits[k], whatsits[v] = v, k -- two way -end +nodes.pool = nodes.pool or { } +local pool = nodes.pool + +local whatsitcodes = nodes.whatsitcodes +local skipcodes = nodes.skipcodes +local nodecodes = nodes.nodecodes + +local glyph_code = nodecodes.glyph + +local reserved, nofreserved = { }, 0 local function register_node(n) - reserved[#reserved+1] = n + nofreserved = nofreserved + 1 + reserved[nofreserved] = n return n end -nodes.register = register_node +pool.register = register_node -function nodes.cleanup_reserved(nofboxes) -- todo +function pool.cleanup(nofboxes) -- todo nodes.tracers.steppers.reset() -- todo: make a registration subsystem - local nr, nl = #reserved, 0 - for i=1,nr do + local nl, nr = 0, nofreserved + for i=1,nofreserved do local ri = reserved[i] -- if not (ri.id == glue_spec and not ri.is_writable) then free_node(reserved[i]) @@ -55,10 +62,11 @@ function nodes.cleanup_reserved(nofboxes) -- todo end end reserved = { } + nofreserved = 0 return nr, nl, nofboxes -- can be nil end -function nodes.usage() +function pool.usage() local t = { } for n, tag in gmatch(status.node_mem_usage,"(%d+) ([a-z_]+)") do t[tag] = n @@ -72,22 +80,23 @@ local penalty = register_node(new_node("penalty")) local glue = register_node(new_node("glue")) -- glue.spec = nil local glue_spec = register_node(new_node("glue_spec")) local glyph = register_node(new_node("glyph",0)) -local textdir = register_node(new_node("whatsit",whatsits.dir)) -- 7 (6 is local par node) +local textdir = register_node(new_node("whatsit",whatsitcodes.dir)) local rule = register_node(new_node("rule")) -local latelua = register_node(new_node("whatsit",whatsits.late_lua)) -- 35 -local user_n = register_node(new_node("whatsit",whatsits.user_defined)) user_n.type = 100 -- 44 -local user_l = register_node(new_node("whatsit",whatsits.user_defined)) user_l.type = 110 -- 44 -local user_s = register_node(new_node("whatsit",whatsits.user_defined)) user_s.type = 115 -- 44 -local user_t = register_node(new_node("whatsit",whatsits.user_defined)) user_t.type = 116 -- 44 +local latelua = register_node(new_node("whatsit",whatsitcodes.latelua)) +local user_n = register_node(new_node("whatsit",whatsitcodes.userdefined)) user_n.type = 100 -- 44 +local user_l = register_node(new_node("whatsit",whatsitcodes.userdefined)) user_l.type = 110 -- 44 +local user_s = register_node(new_node("whatsit",whatsitcodes.userdefined)) user_s.type = 115 -- 44 +local user_t = register_node(new_node("whatsit",whatsitcodes.userdefined)) user_t.type = 116 -- 44 local left_margin_kern = register_node(new_node("margin_kern",0)) local right_margin_kern = register_node(new_node("margin_kern",1)) -local lineskip = register_node(new_node("glue",1)) -local baselineskip = register_node(new_node("glue",2)) -local leftskip = register_node(new_node("glue",8)) -local rightskip = register_node(new_node("glue",9)) +local lineskip = register_node(new_node("glue",skipcodes.lineskip)) +local baselineskip = register_node(new_node("glue",skipcodes.baselineskip)) +local leftskip = register_node(new_node("glue",skipcodes.leftskip)) +local rightskip = register_node(new_node("glue",skipcodes.rightskip)) local temp = register_node(new_node("temp",0)) +local noad = register_node(new_node("noad")) -function nodes.zeroglue(n) +function pool.zeroglue(n) local s = n.spec return not writable or ( s.width == 0 @@ -98,38 +107,46 @@ function nodes.zeroglue(n) ) end -function nodes.glyph(fnt,chr) +function pool.glyph(fnt,chr) local n = copy_node(glyph) if fnt then n.font = fnt end if chr then n.char = chr end return n end -function nodes.penalty(p) +function pool.penalty(p) local n = copy_node(penalty) n.penalty = p return n end -function nodes.kern(k) +function pool.kern(k) local n = copy_node(kern) n.kern = k return n end -function nodes.glue_spec(width,stretch,shrink) +function pool.gluespec(width,stretch,shrink,stretch_order,shrink_order) local s = copy_node(glue_spec) - s.width, s.stretch, s.shrink = width, stretch, shrink + if width then s.width = width end + if stretch then s.stretch = stretch end + if shrink then s.shrink = shrink end + if stretch_order then s.stretch_order = stretch_order end + if shrink_order then s.shrink_order = shrink_order end return s end -local function someskip(skip,width,stretch,shrink) +local function someskip(skip,width,stretch,shrink,stretch_order,shrink_order) local n = copy_node(skip) if not width then -- no spec - elseif tonumber(width) then + elseif width == false or tonumber(width) then local s = copy_node(glue_spec) - s.width, s.stretch, s.shrink = width, stretch, shrink + if width then s.width = width end + if stretch then s.stretch = stretch end + if shrink then s.shrink = shrink end + if stretch_order then s.stretch_order = stretch_order end + if shrink_order then s.shrink_order = shrink_order end n.spec = s else -- shared @@ -138,33 +155,66 @@ local function someskip(skip,width,stretch,shrink) return n end -function nodes.glue(width,stretch,shrink) - return someskip(glue,width,stretch,shrink) +function pool.stretch(a,b) + local n = copy_node(glue) + local s = copy_node(glue_spec) + if b then + s.stretch = a + s.stretch_order = b + else + s.stretch = 1 + s.stretch_order = a or 1 + end + n.spec = s + return n end -function nodes.leftskip(width,stretch,shrink) - return someskip(leftskip,width,stretch,shrink) + +function pool.shrink(a,b) + local n = copy_node(glue) + local s = copy_node(glue_spec) + if b then + s.shrink = a + s.shrink_order = b + else + s.shrink = 1 + s.shrink_order = a or 1 + end + n.spec = s + return n end -function nodes.rightskip(width,stretch,shrink) - return someskip(rightskip,width,stretch,shrink) + + +function pool.glue(width,stretch,shrink,stretch_order,shrink_order) + return someskip(glue,width,stretch,shrink,stretch_order,shrink_order) +end + +function pool.leftskip(width,stretch,shrink,stretch_order,shrink_order) + return someskip(leftskip,width,stretch,shrink,stretch_order,shrink_order) end -function nodes.lineskip(width,stretch,shrink) - return someskip(lineskip,width,stretch,shrink) + +function pool.rightskip(width,stretch,shrink,stretch_order,shrink_order) + return someskip(rightskip,width,stretch,shrink,stretch_order,shrink_order) +end + +function pool.lineskip(width,stretch,shrink,stretch_order,shrink_order) + return someskip(lineskip,width,stretch,shrink,stretch_order,shrink_order) end -function nodes.baselineskip(width,stretch,shrink) + +function pool.baselineskip(width,stretch,shrink) return someskip(baselineskip,width,stretch,shrink) end -function nodes.disc() +function pool.disc() return copy_node(disc) end -function nodes.textdir(dir) +function pool.textdir(dir) local t = copy_node(textdir) t.dir = dir return t end -function nodes.rule(width,height,depth,dir) +function pool.rule(width,height,depth,dir) local n = copy_node(rule) if width then n.width = width end if height then n.height = height end @@ -173,18 +223,26 @@ function nodes.rule(width,height,depth,dir) return n end -function nodes.latelua(code) - local n = copy_node(latelua) - n.data = code - return n +if node.has_field(latelua,'string') then + function pool.latelua(code) + local n = copy_node(latelua) + n.string = code + return n + end +else + function pool.latelua(code) + local n = copy_node(latelua) + n.data = code + return n + end end -function nodes.leftmarginkern(glyph,width) +function pool.leftmarginkern(glyph,width) local n = copy_node(left_margin_kern) if not glyph then - logs.fatal("nodes","invalid pointer to left margin glyph node") - elseif glyph.id ~= glyph_node then - logs.fatal("nodes","invalid node type %s for left margin glyph node",node_type(glyph)) + report_nodes("invalid pointer to left margin glyph node") + elseif glyph.id ~= glyph_code then + report_nodes("invalid node type %s for left margin glyph node",nodecodes[glyph]) else n.glyph = glyph end @@ -194,12 +252,12 @@ function nodes.leftmarginkern(glyph,width) return n end -function nodes.rightmarginkern(glyph,width) +function pool.rightmarginkern(glyph,width) local n = copy_node(right_margin_kern) if not glyph then - logs.fatal("nodes","invalid pointer to right margin glyph node") - elseif glyph.id ~= glyph_node then - logs.fatal("nodes","invalid node type %s for right margin glyph node",node_type(p)) + report_nodes("invalid pointer to right margin glyph node") + elseif glyph.id ~= glyph_code then + report_nodes("invalid node type %s for right margin glyph node",nodecodes[p]) else n.glyph = glyph end @@ -209,9 +267,14 @@ function nodes.rightmarginkern(glyph,width) return n end -function nodes.temp() +function pool.temp() return copy_node(temp) end + +function pool.noad() + return copy_node(noad) +end + --[[

At some point we ran into a problem that the glue specification of the zeropoint dimension was overwritten when adapting a glue spec @@ -225,78 +288,87 @@ and hide it for the user. And yes, LuaTeX now gives a warning as well.

]]-- -if tex.luatexversion > 51 then - - function nodes.writable_spec(n) - local spec = n.spec - if not spec then - spec = copy_node(glue_spec) - n.spec = spec - elseif not spec.writable then - spec = copy_node(spec) - n.spec = spec - end - return spec +function nodes.writable_spec(n) -- not pool + local spec = n.spec + if not spec then + spec = copy_node(glue_spec) + n.spec = spec + elseif not spec.writable then + spec = copy_node(spec) + n.spec = spec end + return spec +end -else +-- local num = userids["my id"] +-- local str = userids[num] + +local userids = utilities.storage.allocate() pool.userids = userids +local lastid = 0 - function nodes.writable_spec(n) - local spec = n.spec - if not spec then - spec = copy_node(glue_spec) +setmetatable(userids, { + __index = function(t,k) + if type(k) == "string" then + lastid = lastid + 1 + rawset(userids,lastid,k) + rawset(userids,k,lastid) + return lastid else - spec = copy_node(spec) + rawset(userids,k,k) + return k end - n.spec = spec - return spec + end, + __call = function(t,k) + return t[k] end - -end - -local cache = { } - -function nodes.usernumber(num) - local n = cache[num] - if n then - return copy_node(n) - else - local n = copy_node(user_n) - if num then n.value = num end - return n +} ) + +function pool.usernumber(id,num) + local n = copy_node(user_n) + if num then + n.user_id, n.value = id, num + elseif id then + n.value = id end + return n end -function nodes.userlist(list) +function pool.userlist(id,list) local n = copy_node(user_l) - if list then n.value = list end + if list then + n.user_id, n.value =id, list + else + n.value = id + end return n end -local cache = { } -- we could use the same cache - -function nodes.userstring(str) - local n = cache[str] - if n then - return copy_node(n) +function pool.userstring(id,str) + local n = copy_node(user_s) + if str then + n.user_id, n.value =id, str else - local n = copy_node(user_s) - n.type = 115 - if str then n.value = str end - return n + n.value = id end + return n end -function nodes.usertokens(tokens) +function pool.usertokens(id,tokens) local n = copy_node(user_t) - if tokens then n.value = tokens end + if tokens then + n.user_id, n.value =id, tokens + else + n.value = id + end return n end statistics.register("cleaned up reserved nodes", function() - return format("%s nodes, %s lists of %s", nodes.cleanup_reserved(tex.count["lastallocatedbox"])) + return format("%s nodes, %s lists of %s", pool.cleanup(tex.count["lastallocatedbox"])) end) -- \topofboxstack statistics.register("node memory usage", function() -- comes after cleanup ! return status.node_mem_usage end) + +lua.registerfinalizer(pool.cleanup, "cleanup reserved nodes") diff --git a/Master/texmf-dist/tex/context/base/node-rul.lua b/Master/texmf-dist/tex/context/base/node-rul.lua index 9dd89bcdae3..4cbd1ad0c5f 100644 --- a/Master/texmf-dist/tex/context/base/node-rul.lua +++ b/Master/texmf-dist/tex/context/base/node-rul.lua @@ -8,73 +8,115 @@ if not modules then modules = { } end modules ['node-rul'] = { -- this will go to an auxiliary module -- beware: rules now have a dir field +-- +-- todo: make robust for layers ... order matters + +local attributes, nodes, node = attributes, nodes, node + +local nodecodes = nodes.nodecodes +local tasks = nodes.tasks -local glyph = node.id("glyph") -local disc = node.id("disc") -local rule = node.id("rule") +local glyph_code = nodecodes.glyph +local disc_code = nodecodes.disc +local rule_code = nodecodes.rule -function nodes.strip_range(first,last) -- todo: dir +function nodes.striprange(first,last) -- todo: dir if first and last then -- just to be sure - local current = first - while current and current ~= last do - local id = current.id - if id == glyph or id == disc then - --~ if id == glyph or id == rule or id == disc then - first = current + if first == last then + return first, last + end + while first and first ~= last do + local id = first.id + if id == glyph_code or id == disc_code then -- or id == rule_code break else - current = current.next + first = first.next end end - local current = last - while current and current ~= first do - local id = current.id - --~ if id == glyph or id == rule or id == disc then - if id == glyph or id == disc then - last = current + if not first then + return nil, nil + elseif first == last then + return first, last + end + while last and last ~= first do + local id = last.id + if id == glyph_code or id == disc_code then -- or id == rule_code break else - current = current.prev +local prev = last.prev -- luatex < 0.70 has italic correction kern not prev'd +if prev then + last = last.prev +else + break +end end end + if not last then + return nil, nil + end end return first, last end -- todo: order and maybe other dimensions -local trace_ruled = false trackers.register("nodes.ruled", function(v) trace_ruled = v end) - local floor = math.floor -local n_tostring, n_tosequence = nodes.ids_tostring, nodes.tosequence - -local a_ruled = attributes.private('ruled') -local a_color = attributes.private('color') -local a_transparency = attributes.private('transparency') -local a_colorspace = attributes.private('colormodel') - -local glyph = node.id("glyph") -local disc = node.id("disc") -local glue = node.id("glue") -local penalty = node.id("penalty") -local kern = node.id("kern") -local hlist = node.id("hlist") -local vlist = node.id("vlist") -local rule = node.id("rule") -local whatsit = node.id("whatsit") - -local new_rule = nodes.rule -local new_kern = nodes.kern -local new_glue = nodes.glue - -local insert_before, insert_after, strip_range = node.insert_before, node.insert_after, nodes.strip_range -local list_dimensions, has_attribute, set_attribute = node.dimensions, node.has_attribute, node.set_attribute -local hpack_nodes = node.hpack -local dimenfactor = fonts.dimenfactor -local texwrite = tex.write - -local fontdata = fonts.ids -local variables = interfaces.variables + +local trace_ruled = false trackers.register("nodes.rules", function(v) trace_ruled = v end) + +local report_ruled = logs.reporter("nodes","rules") + +local n_tostring = nodes.idstostring +local n_tosequence = nodes.tosequence + +local a_ruled = attributes.private('ruled') +local a_color = attributes.private('color') +local a_transparency = attributes.private('transparency') +local a_colorspace = attributes.private('colormodel') + +local texwrite = tex.write + +local insert_before = node.insert_before +local insert_after = node.insert_after +local striprange = nodes.striprange +local list_dimensions = node.dimensions +local has_attribute = node.has_attribute +local set_attribute = node.set_attribute + +local hpack_nodes = node.hpack + +local fontdata = fonts.hashes.identifiers +local variables = interfaces.variables +local dimenfactor = fonts.helpers.dimenfactor + +local nodecodes = nodes.nodecodes +local skipcodes = nodes.skipcodes +local whatcodes = nodes.whatcodes +local kerncodes = nodes.kerncodes + +local glyph_code = nodecodes.glyph +local disc_code = nodecodes.disc +local glue_code = nodecodes.glue +local penalty_code = nodecodes.penalty +local kern_code = nodecodes.kern +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist +local rule_code = nodecodes.rule +local whatsit_code = nodecodes.whatsit + +local userskip_code = skipcodes.userskip +local spaceskip_code = skipcodes.spaceskip +local xspaceskip_code = skipcodes.xspaceskip + +local dir_code = whatcodes.dir + +local kerning_code = kerncodes.kern + +local nodepool = nodes.pool + +local new_rule = nodepool.rule +local new_kern = nodepool.kern +local new_glue = nodepool.glue -- we can use this one elsewhere too -- @@ -86,15 +128,22 @@ local checkdir = true -- we assume {glyphruns} and no funny extra kerning, ok, maybe we need -- a dummy character as start and end; anyway we only collect glyphs +-- +-- this one needs to take layers into account (i.e. we need a list of +-- critical attributes) -local function process_words(attribute,data,flush,head,parent) -- we have hlistdir and local dir +-- omkeren class en level -> scheelt functie call in analyze + +-- todo: switching inside math + +local function processwords(attribute,data,flush,head,parent) -- we have hlistdir and local dir local n = head if n then - local f, l, a, d, i, level - local continue, done, strip = false, false, false + local f, l, a, d, i, class + local continue, done, strip, level = false, false, true, -1 while n do local id = n.id - if id == glyph or id == rule then + if id == glyph_code or id == rule_code then local aa = has_attribute(n,attribute) if aa then if aa == a then @@ -104,12 +153,18 @@ local function process_words(attribute,data,flush,head,parent) -- we have hlistd l = n else -- possible extensions: when in same class then keep spanning + local newlevel, newclass = floor(aa/1000), aa%1000 +--~ strip = not continue or level == 1 -- 0 if f then - head, done = flush(head,f,l,d,level,parent,strip), true + if class == newclass then -- and newlevel > level then + head, done = flush(head,f,l,d,level,parent,false), true + else + head, done = flush(head,f,l,d,level,parent,strip), true + end end f, l, a = n, n, aa - level, i = floor(a/1000), a%1000 - d = data[i] + level, class = newlevel, newclass + d = data[class] continue = d.continue == variables.yes end else @@ -118,27 +173,37 @@ local function process_words(attribute,data,flush,head,parent) -- we have hlistd end f, l, a = nil, nil, nil end - elseif f and (id == disc or (id == kern and n.subtype == 0)) then + elseif f and (id == disc_code or (id == kern_code and n.subtype == kerning_code)) then l = n - elseif id == hlist or id == vlist then + elseif id == hlist_code or id == vlist_code then if f then head, done = flush(head,f,l,d,level,parent,strip), true f, l, a = nil, nil, nil end local list = n.list if list then - n.list = process_words(attribute,data,flush,list,n) + n.list = processwords(attribute,data,flush,list,n) end - elseif checkdir and id == whatsit and n.subtype == 7 then -- only changes in dir, we assume proper boundaries + elseif checkdir and id == whatsit_code and n.subtype == dir_code then -- only changes in dir, we assume proper boundaries if f and a then l = n end elseif f then if continue then - if id == penalty or id == kern then + if id == penalty_code then l = n - elseif id == glue then + elseif id == kern_code then l = n + elseif id == glue_code then + -- catch \underbar{a} \underbar{a} (subtype test is needed) + local subtype = n.subtype + if continue and has_attribute(n,attribute) and + (subtype == userskip_code or subtype == spaceskip_code or subskip == xspaceskip_code) then + l = n + else + head, done = flush(head,f,l,d,level,parent,strip), true + f, l, a = nil, nil, nil + end end else head, done = flush(head,f,l,d,level,parent,strip), true @@ -156,7 +221,7 @@ local function process_words(attribute,data,flush,head,parent) -- we have hlistd end end -nodes.process_words = process_words +nodes.processwords = processwords -- @@ -172,16 +237,32 @@ function nodes.rules.define(settings) texwrite(#data) end +local a_viewerlayer = attributes.private("viewerlayer") + local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but acceptable for this purpose -- check for f and l + if f.id ~= glyph_code then + -- saveguard ... we need to deal with rules and so (math) + return head + end local r, m - if true then - f, l = strip_range(f,l) + if strip then + if trace_ruled then + local before = n_tosequence(f,l,true) + f, l = striprange(f,l) + local after = n_tosequence(f,l,true) + report_ruled("range stripper: %s -> %s",before,after) + else + f, l = striprange(f,l) + end + end + if not f then + return head end local w = list_dimensions(parent.glue_set,parent.glue_sign,parent.glue_order,f,l.next) local method, offset, continue, dy, rulethickness, unit, order, max, ma, ca, ta = d.method, d.offset, d.continue, d.dy, d.rulethickness, d.unit, d.order, d.max, d.ma, d.ca, d.ta - local e = dimenfactor(unit,fontdata[f.font]) + local e = dimenfactor(unit,fontdata[f.font]) -- what if no glyph node local colorspace = (ma > 0 and ma) or has_attribute(f,a_colorspace) or 1 local color = (ca > 0 and ca) or has_attribute(f,a_color) local transparency = (ta > 0 and ta) or has_attribute(f,a_transparency) @@ -200,6 +281,12 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a local ht = (offset+(i-1)*dy+rulethickness)*e - m local dp = -(offset+(i-1)*dy-rulethickness)*e + m local r = new_rule(w,ht,dp) + local v = has_attribute(f,a_viewerlayer) + -- quick hack + if v then + set_attribute(r,a_viewerlayer,v) + end + -- if color then set_attribute(r,a_colorspace,colorspace) set_attribute(r,a_color,color) @@ -213,11 +300,11 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a insert_after(head,k,r) l = r else - head, _ = insert_before(head,f,r) + head = insert_before(head,f,r) insert_after(head,r,k) end if trace_ruled then - logs.report("ruled", "level: %s, width: %i, height: %i, depth: %i, nodes: %s, text: %s", + report_ruled("level: %s, width: %i, height: %i, depth: %i, nodes: %s, text: %s", level,w,ht,dp,n_tostring(f,l),n_tosequence(f,l,true)) -- level,r.width,r.height,r.depth,n_tostring(f,l),n_tosequence(f,l,true)) end @@ -225,20 +312,22 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a return head end -local process = nodes.process_words +local process = nodes.processwords -nodes.rules.process = function(head) return process(a_ruled,data,flush_ruled,head) end +nodes.rules.handler = function(head) return process(a_ruled,data,flush_ruled,head) end function nodes.rules.enable() - tasks.enableaction("shipouts","nodes.rules.process") + tasks.enableaction("shipouts","nodes.rules.handler") end -- elsewhere: -- --- tasks.appendaction ("shipouts", "normalizers", "nodes.rules.process") --- tasks.disableaction("shipouts", "nodes.rules.process") -- only kick in when used +-- tasks.appendaction ("shipouts", "normalizers", "nodes.rules.handler") +-- tasks.disableaction("shipouts", "nodes.rules.handler") -- only kick in when used + +local trace_shifted = false trackers.register("nodes.shifting", function(v) trace_shifted = v end) -local trace_shifted = false trackers.register("nodes.shifted", function(v) trace_shifted = v end) +local report_shifted = logs.reporter("nodes","shifting") local a_shifted = attributes.private('shifted') @@ -256,7 +345,7 @@ end local function flush_shifted(head,first,last,data,level,parent,strip) -- not that fast but acceptable for this purpose if true then - first, last = strip_range(first,last) + first, last = striprange(first,last) end local prev, next = first.prev, last.next first.prev, last.next = nil, nil @@ -274,15 +363,15 @@ local function flush_shifted(head,first,last,data,level,parent,strip) -- not tha local raise = data.dy * dimenfactor(data.unit,fontdata[first.font]) list.shift, list.height, list.depth = raise, height, depth if trace_shifted then - logs.report("shifted", "width: %s, nodes: %s, text: %s",width,n_tostring(first,last),n_tosequence(first,last,true)) + report_shifted("width: %s, nodes: %s, text: %s",width,n_tostring(first,last),n_tosequence(first,last,true)) end return head end -local process = nodes.process_words +local process = nodes.processwords -nodes.shifts.process = function(head) return process(a_shifted,data,flush_shifted,head) end +nodes.shifts.handler = function(head) return process(a_shifted,data,flush_shifted,head) end function nodes.shifts.enable() - tasks.enableaction("shipouts","nodes.shifts.process") + tasks.enableaction("shipouts","nodes.shifts.handler") end diff --git a/Master/texmf-dist/tex/context/base/node-rul.mkiv b/Master/texmf-dist/tex/context/base/node-rul.mkiv index 1270eb81d7a..90bcd9e403f 100644 --- a/Master/texmf-dist/tex/context/base/node-rul.mkiv +++ b/Master/texmf-dist/tex/context/base/node-rul.mkiv @@ -55,6 +55,9 @@ %D %D \showsetup{setupunderbar} +%D todo: mkvi this file ... no redefine, just pass all parameters, too messy now +%D (due to grouping) so better hash settings at the lua end + \unprotect %definesystemattribute[ruled] @@ -62,41 +65,39 @@ \registerctxluafile{node-rul}{1.001} -\newtoks\checkalldefinedbars +\installcommandhandler \??on {bar} \??on -\def\barparameter #1{\csname\dobarparameter\currentbar#1\endcsname} -\def\dobarparameter #1#2{\ifcsname\??on#1#2\endcsname\??on#1#2\else\expandafter\dobarparentparameter\csname\??on#1\s!parent\endcsname#2\fi} -\def\dobarparentparameter#1#2{\ifx#1\relax\s!empty\else\dobarparameter#1#2\fi} +\newtoks\checkalldefinedbars -\unexpanded\def\definebar - {\dotripleempty\dodefinebar} +\let\setupbars\setupbar -\def\dodefinebar[#1][#2][#3]% - {\ifthirdargument - \getparameters[\??on#1][\s!parent=#2,#3]% +\appendtoks + \ifsecondargument + \dodefinebarindeed\currentbar \else - \getparameters[\??on#1][\s!parent=,#2]% + \the\checkalldefinedbars \fi - % - %\setvalue{\??on:#1}{0}% - % - \ifcsname\??on:#1:c\endcsname - \csname\??on:#1:c\endcsname\zerocount +\to \everysetupbar + +\appendtoks + \ifcsname\??on:\currentbar:c\endcsname + \csname\??on:\currentbar:c\endcsname\zerocount \else - \expandafter\newcount\csname\??on:#1:c\endcsname + \expandafter\newcount\csname\??on:\currentbar:c\endcsname \fi - \normalexpanded{\checkalldefinedbars{\noexpand\doredefinebar{#1}\the\checkalldefinedbars}}% - \dodefinebarindeed{#1}% - \setuvalue{#1}{\doruled{#1}}} + \normalexpanded{\checkalldefinedbars{\doredefinebar{\currentbar}\the\checkalldefinedbars}}% + \dodefinebarindeed\currentbar + \setuevalue\currentbar{\doruled{\currentbar}}% +\to \everydefinebar -\def\dodefinebarindeed#1% - {\bgroup - \def\currentbar{#1}% +\unexpanded\def\dodefinebarindeed#1% + {\begingroup + \edef\currentbar{#1}% \doifsomethingelse{\barparameter\c!color} {\donetrue\colored[\barparameter\c!color]} {\donefalse}% \normalexpanded - {\egroup + {\endgroup \scratchcounter\ctxlua{nodes.rules.define { method = \barparameter\c!method, offset = \barparameter\c!offset, @@ -114,7 +115,7 @@ \let\doredefinebar\dodefinebarindeed -\def\doruled#1% +\unexpanded\def\doruled#1% {\groupedcommand{\dodoruled{#1}}\relax} \def\dodoruled @@ -122,11 +123,13 @@ \glet\dodoruled\dodoruledindeed \dodoruled} -\def\dodoruledindeed#1% - {\advance\csname\??on:#1:c\endcsname\plusone +\def\dodoruledindeed#1% maybe reverse the 1000 + {\advance\csname\??on:#1:c\endcsname\plusone % local ? \scratchcounter\csname\??on:#1:c\endcsname - \attribute\ruledattribute\numexpr1000*\scratchcounter - +\csname\??on#1\ifcsname\??on#1:\number\scratchcounter\s!parent\endcsname:\number\scratchcounter\fi:a\endcsname} + \attribute\ruledattribute\numexpr + 1000*\scratchcounter + +\csname\??on#1\ifcsname\??on#1:\number\scratchcounter\s!parent\endcsname:\number\scratchcounter\fi:a\endcsname + \relax} % ungrouped @@ -149,18 +152,6 @@ {\csname\??on:s:\number\currentbarnesting\endcsname \global\advance\currentbarnesting\minusone} -\unexpanded\def\setupbars - {\dodoubleempty\dosetupbars} - -\def\dosetupbars[#1][#2]% not that efficient - {\ifsecondargument - \getparameters[\??on#1][#2]% - \dodefinebarindeed{#1}% - \else - \getparameters[\??on][#1]% - \the\checkalldefinedbars - \fi} - \setupbars [\c!method=0, % new: 0=center nested, 1=stack nested \c!continue=\v!no, @@ -197,49 +188,36 @@ %D This will move: (a bit duplicated) -\newtoks\checkalldefinedshifts - -\def\shiftparameter #1{\csname\doshiftparameter\currentshift#1\endcsname} -\def\shiftparameterhash#1{\doshiftparameterhash{\??ra\currentshift}#1} +\installcommandhandler \??ra {shift} \??ra -\def\doshiftparameter #1#2{\ifcsname\??ra#1#2\endcsname\??ra#1#2\else\expandafter\doshiftparentparameter\csname\??ra#1\s!parent\endcsname#2\fi} -\def\doshiftparameterhash#1#2{\ifcsname#1#2\endcsname#1\else\expandafter\doshiftparentparameterhash\csname#1\s!parent\endcsname#2\fi} - -\def\doshiftparentparameter #1#2{\ifx#1\relax\s!empty\else\doshiftparameter #1#2\fi} -\def\doshiftparentparameterhash#1#2{\ifx#1\relax \else\doshiftparameterhash#1#2\fi} - -\def\dosetshiftattributes#1#2% style color - {\edef\fontattributehash {\shiftparameterhash#1}% - \edef\colorattributehash{\shiftparameterhash#2}% - \ifx\fontattributehash \empty\else\dosetfontattribute \fontattributehash #1\fi - \ifx\colorattributehash\empty\else\dosetcolorattribute\colorattributehash#2\fi} +\newtoks\checkalldefinedshifts -\unexpanded\def\defineshift - {\dotripleempty\dodefineshift} +\let\setupshifts\setupshift -\def\dodefineshift[#1][#2][#3]% - {\ifthirdargument - \getparameters[\??ra#1][\s!parent=#2,#3]% +\appendtoks + \ifsecondargument + \dodefineshiftindeed\currentshift \else - \getparameters[\??ra#1][\s!parent=,#2]% + \the\checkalldefinedshifts \fi - % - %\setvalue{\??ra:#1}{0}% - % - \ifcsname\??ra:#1:c\endcsname - \csname\??ra:#1:c\endcsname\zerocount +\to \everysetupshift + +\appendtoks + \ifcsname\??ra:\currentshift:c\endcsname + \csname\??ra:\currentshift:c\endcsname\zerocount \else - \expandafter\newcount\csname\??ra:#1:c\endcsname + \expandafter\newcount\csname\??ra:\currentshift:c\endcsname \fi - \normalexpanded{\checkalldefinedshifts{\noexpand\doredefineshift{#1}\the\checkalldefinedshifts}}% - \dodefineshiftindeed{#1}% - \setuvalue{#1}{\doshifted{#1}}} + \normalexpanded{\checkalldefinedshifts{\doredefineshift{\currentshift}\the\checkalldefinedshifts}}% + \dodefineshiftindeed{\currentshift}% + \setuevalue\currentshift{\doshifted{\currentshift}}% +\to \everydefineshift -\def\dodefineshiftindeed#1% - {\bgroup - \def\currentshift{#1}% +\unexpanded\def\dodefineshiftindeed#1% + {\begingroup + \edef\currentshift{#1}% \normalexpanded - {\egroup + {\endgroup \scratchcounter\ctxlua{nodes.shifts.define { method = \shiftparameter\c!method, continue = "\shiftparameter\c!continue", @@ -250,26 +228,17 @@ \let\doredefineshift\dodefineshiftindeed -\def\doshifted#1% - {\groupedcommand{\dodoshifted{#1}}\relax} +% \unexpanded\def\doshifted#1% +% {\groupedcommand{\dodoshifted{#1}}\relax} \def\dodoshifted {\ctxlua{nodes.shifts.enable()}% \glet\dodoshifted\dodoshiftedindeed \dodoshifted} -% \def\dodoshiftedindeed#1% -% {\def\currentshift{#1}% -% \advance\csname\??ra:#1:c\endcsname\plusone -% \scratchcounter\csname\??ra:#1:c\endcsname -% \attribute\shiftedattribute\numexpr1000*\scratchcounter -% +\csname\??ra#1\ifcsname\??ra#1:\number\scratchcounter\s!parent\endcsname:\number\scratchcounter\fi:a\endcsname -% \setupalign[\shiftparameter\c!align]% -% \dosetshiftattributes\c!style\c!color} - -\def\dostartisolation{\char0 } -\def\dostopisolation {\char0 } -\def\doisolator {\char0 } +\def\dostartisolation{\signalcharacter} +\def\dostopisolation {\signalcharacter} +\def\doisolator {\signalcharacter} \def\doisolatedgroupedalign#1#2% {\groupedcommand @@ -289,7 +258,7 @@ \dosetshiftattributes\c!style\c!color \dosetupisolatedalign{\shiftparameter\c!align}} -\def\doshifted#1% +\unexpanded\def\doshifted#1% {\doisolatedgroupedalign{\dodoshifted{#1}}{}} \unexpanded\def\startshift[#1]% @@ -299,18 +268,6 @@ \unexpanded\def\stopshift {\endgroup} -\unexpanded\def\setupshifts - {\dodoubleempty\dosetupshifts} - -\def\dosetupshifts[#1][#2]% not that efficient - {\ifsecondargument - \getparameters[\??ra#1][#2]% - \dodefineshiftindeed{#1}% - \else - \getparameters[\??ra][#1]% - \the\checkalldefinedshifts - \fi} - \setupshifts [\c!method=0, \c!continue=\v!no, diff --git a/Master/texmf-dist/tex/context/base/node-seq.lua b/Master/texmf-dist/tex/context/base/node-seq.lua deleted file mode 100644 index 3a2cf5b6ef0..00000000000 --- a/Master/texmf-dist/tex/context/base/node-seq.lua +++ /dev/null @@ -1,186 +0,0 @@ -if not modules then modules = { } end modules ['node-seq'] = { - version = 1.001, - comment = "companion to node-ini.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - ---[[ldx-- -

Here we implement a mechanism for chaining the special functions -that we use in to deal with mode list processing. We -assume that namespaces for the functions are used, but for speed we -use locals to refer to them when compiling the chain.

---ldx]]-- - --- todo: delayed: i.e. we register them in the right order already but delay usage - -local format, gsub, concat, gmatch = string.format, string.gsub, table.concat, string.gmatch -local type, loadstring = type, loadstring - -sequencer = sequencer or { } - -local function validaction(action) - local g = _G - for str in gmatch(action,"[^%.]+") do - g = g[str] - if not g then - return false - end - end - return true -end - -function sequencer.reset() - return { - list = { }, - order = { }, - kind = { }, - askip = { }, - gskip = { }, - } -end - -function sequencer.prependgroup(t,group,where) - local list, order = t.list, t.order - table.remove_value(order,group) - table.insert_before_value(order,where,group) - list[group] = { } -end - -function sequencer.appendgroup(t,group,where) - local list, order = t.list, t.order - table.remove_value(order,group) - table.insert_after_value(order,where,group) - list[group] = { } -end - -function sequencer.prependaction(t,group,action,where,kind,force) - local g = t.list[group] - if g and (force or validaction(action)) then - table.remove_value(g,action) - table.insert_before_value(g,where,action) - t.kind[action] = kind - end -end - -function sequencer.appendaction(t,group,action,where,kind,force) - local g = t.list[group] - if g and (force or validaction(action)) then - table.remove_value(g,action) - table.insert_after_value(g,where,action) - t.kind[action] = kind - end -end - -function sequencer.enableaction (t,action) t.askip[action] = false end -function sequencer.disableaction(t,action) t.askip[action] = true end -function sequencer.enablegroup (t,group) t.gskip[group] = false end -function sequencer.disablegroup (t,group) t.gskip[group] = true end - -function sequencer.setkind(t,action,kind) - t.kind[action] = kind -end - -function sequencer.removeaction(t,group,action,force) - local g = t.list[group] - if g and (force or validaction(action)) then - table.remove_value(g,action) - end -end - -function sequencer.compile(t,compiler,n) - if type(t) == "string" then - -- already compiled - elseif compiler then - t = compiler(t,n) - else - t = sequencer.tostring(t) - end - return loadstring(t)() -end - -local function localize(str) - return (gsub(str,"%.","_")) -end - -local template = [[ -%s -return function(...) -%s -end]] - -function sequencer.tostring(t) - local list, order, kind, gskip, askip = t.list, t.order, t.kind, t.gskip, t.askip - local vars, calls, args = { }, { }, nil - for i=1,#order do - local group = order[i] - if not gskip[group] then - local actions = list[group] - for i=1,#actions do - local action = actions[i] - if not askip[action] then - local localized = localize(action) - vars [#vars +1] = format("local %s = %s", localized, action) - calls[#calls+1] = format(" %s(...) -- %s %i", localized, group, i) - end - end - end - end - return format(template,concat(vars,"\n"),concat(calls,"\n")) -end - --- we used to deal with tail as well but now that the lists are always --- double linked and the kernel function no longer expect tail as --- argument we stick to head and done (done can probably also go --- as luatex deals with return values efficiently now .. in the --- past there was some copying involved, but no longer) - -local template = [[ -%s -return function(head%s) - local ok, done = false, false -%s - return head, done -end]] - -function sequencer.nodeprocessor(t,n) - local list, order, kind, gskip, askip = t.list, t.order, t.kind, t.gskip, t.askip - local vars, calls, args = { }, { }, nil - if n == 0 then - args = "" - elseif n == 1 then - args = ",one" - elseif n == 2 then - args = ",one,two" - elseif n == 3 then - args = ",one,two,three" - elseif n == 4 then - args = ",one,two,three,four" - elseif n == 5 then - args = ",one,two,three,four,five" - else - args = ",..." - end - for i=1,#order do - local group = order[i] - if not gskip[group] then - local actions = list[group] - for i=1,#actions do - local action = actions[i] - if not askip[action] then - local localized = localize(action) - vars[#vars+1] = format("local %s = %s",localized,action) - if kind[action] == "nohead" then - calls[#calls+1] = format(" ok = %s(head%s) done = done or ok -- %s %i",localized,args,group,i) - else - calls[#calls+1] = format(" head, ok = %s(head%s) done = done or ok -- %s %i",localized,args,group,i) - end - end - end - end - end - local processor = format(template,concat(vars,"\n"),args,concat(calls,"\n")) ---~ print(processor) - return processor -end diff --git a/Master/texmf-dist/tex/context/base/node-ser.lua b/Master/texmf-dist/tex/context/base/node-ser.lua index e632e92da04..aa4615626e9 100644 --- a/Master/texmf-dist/tex/context/base/node-ser.lua +++ b/Master/texmf-dist/tex/context/base/node-ser.lua @@ -9,18 +9,21 @@ if not modules then modules = { } end modules ['node-ser'] = { -- beware, some field names will change in a next releases -- of luatex; this is pretty old code that needs an overhaul -local type, format, concat = type, string.format, table.concat +local type, format, concat, rep = type, string.format, table.concat, string.rep -local ctxcatcodes = tex.ctxcatcodes +local allocate = utilities.storage.allocate -local hlist = node.id('hlist') -local vlist = node.id('vlist') +local nodes, node = nodes, node local traverse = node.traverse -local node_fields = node.fields -local node_type = node.type -local expand = table.tohash { +local nodecodes = nodes.nodecodes +local nodefields = nodes.fields + +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist + +local expand = allocate ( table.tohash { "list", -- list_ptr & ins_ptr & adjust_ptr "pre", -- "post", -- @@ -35,25 +38,25 @@ local expand = table.tohash { "leader", -- leader_ptr "action", -- action_ptr "value", -- user_defined nodes with subtype 'a' en 'n' -} +} ) -- page_insert: "height", "last_ins_ptr", "best_ins_ptr" -- split_insert: "height", "last_ins_ptr", "best_ins_ptr", "broken_ptr", "broken_ins" -local ignore = table.tohash { +local ignore = allocate ( table.tohash { "page_insert", "split_insert", "ref_count", -} +} ) -local dimension = table.tohash { +local dimension = allocate ( table.tohash { "width", "height", "depth", "shift", "stretch", "shrink", "xoffset", "yoffset", "surround", "kern", "box_left_width", "box_right_width" -} +} ) -- flat: don't use next, but indexes -- verbose: also add type @@ -66,7 +69,7 @@ nodes.ignorablefields = ignore -- not ok yet: function nodes.astable(n,sparse) -- not yet ok - local f, t = node_fields(n.id,n.subtype), { } + local f, t = nodefields(n), { } for i=1,#f do local v = f[i] local d = n[v] @@ -84,7 +87,7 @@ function nodes.astable(n,sparse) -- not yet ok end end end - t.type = node_type(n.id) + t.type = nodecodes[n.id] return t end @@ -93,11 +96,11 @@ end local function totable(n,flat,verbose) -- todo: no local function local function to_table(n,flat,verbose) - local f = node_fields(n.id,n.subtype) + local f = nodefields(n) local tt = { } for k=1,#f do local v = f[k] - local nv = n[v] + local nv = v and n[v] if nv then if ignore[v] then -- skip @@ -115,15 +118,16 @@ local function totable(n,flat,verbose) end end if verbose then - tt.type = node_type(tt.id) + tt.type = nodecodes[tt.id] end return tt end if n then if flat then - local t = { } + local t, tn = { }, 0 while n do - t[#t+1] = to_table(n,flat,verbise) + tn = tn + 1 + t[tn] = to_table(n,flat,verbose) n = n.next end return t @@ -147,6 +151,8 @@ end -- not ok yet; this will become a module +-- todo: adapt to nodecodes etc + local function serialize(root,name,handle,depth,m) handle = handle or print if depth then @@ -170,7 +176,7 @@ local function serialize(root,name,handle,depth,m) if root then local fld if root.id then - fld = node_fields(root.id,root.subtype) -- we can cache these (todo) + fld = nodefields(root) -- we can cache these (todo) else fld = table.sortedkeys(root) end @@ -215,9 +221,10 @@ local function serialize(root,name,handle,depth,m) end function nodes.serialize(root,name) - local t = { } + local t, n = { }, 0 local function flush(s) - t[#t+1] = s + n = n + 1 + t[n] = s end serialize(root, name, flush, nil, 0) return concat(t,"\n") @@ -227,50 +234,46 @@ function nodes.serializebox(n,flat,verbose,name) return nodes.serialize(nodes.totable(tex.box[n],flat,verbose),name) end -function nodes.visualizebox(...) - tex.print(ctxcatcodes,"\\starttyping") - tex.print(nodes.serializebox(...)) - tex.print("\\stoptyping") +-- keep: +-- +-- function nodes.visualizebox(...) +-- tex.print(ctxcatcodes,"\\starttyping") +-- tex.print(nodes.serializebox(...)) +-- tex.print("\\stoptyping") +-- end + +function nodes.visualizebox(...) -- to be checked .. will move to module anyway + context.starttyping() + context.pushcatcodes("verbatim") + context(nodes.serializebox(...)) + context.stoptyping() + context.popcatcodes() end -function nodes.list(head,n) -- name might change to nodes.type +function nodes.list(head,n) -- name might change to nodes.type -- to be checked .. will move to module anyway if not n then - tex.print(ctxcatcodes,"\\starttyping") + context.starttyping(true) end while head do local id = head.id - tex.print(string.rep(" ",n or 0) .. tostring(head) .. "\n") - if id == hlist or id == vlist then + tex.write(rep(" ",n or 0) .. tostring(head) .. "\n") + if id == hlist_code or id == vlist_code then nodes.list(head.list,(n or 0)+1) end head = head.next end if not n then - tex.print("\\stoptyping") + context.stoptyping(true) end end function nodes.print(head,n) while head do local id = head.id - texio.write_nl(string.rep(" ",n or 0) .. tostring(head)) - if id == hlist or id == vlist then + texio.write_nl(rep(" ",n or 0) .. tostring(head)) + if id == hlist_code or id == vlist_code then nodes.print(head.list,(n or 0)+1) end head = head.next end end - -function nodes.check_for_leaks(sparse) - local l = { } - local q = node.usedlist() - for p in traverse(q) do - local s = table.serialize(nodes.astable(p,sparse),node_type(p.id)) - l[s] = (l[s] or 0) + 1 - end - node.flush_list(q) - for k, v in next, l do - texio.write_nl(format("%s * %s", v, k)) - end -end - diff --git a/Master/texmf-dist/tex/context/base/node-shp.lua b/Master/texmf-dist/tex/context/base/node-shp.lua index 50b16efa581..75177a4edde 100644 --- a/Master/texmf-dist/tex/context/base/node-shp.lua +++ b/Master/texmf-dist/tex/context/base/node-shp.lua @@ -6,27 +6,32 @@ if not modules then modules = { } end modules ['node-shp'] = { license = "see context related readme files" } -local hlist = node.id('hlist') -local vlist = node.id('vlist') -local disc = node.id('disc') -local mark = node.id('mark') -local kern = node.id('kern') -local glue = node.id('glue') +local nodes, node = nodes, node + +local nodecodes = nodes.nodecodes +local tasks = nodes.tasks + +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist +local disc_code = nodecodes.disc +local mark_code = nodecodes.mark +local kern_code = nodecodes.kern +local glue_code = nodecodes.glue local free_node = node.free local remove_node = node.remove -local function cleanup_page(head) -- rough +local function cleanup(head) -- rough local start = head while start do local id = start.id - if id == disc or (id == glue and not start.writable) or (id == kern and start.kern == 0) or id == mark then + if id == disc_code or (id == glue_code and not start.writable) or (id == kern_code and start.kern == 0) or id == mark_code then head, start, tmp = remove_node(head,start) free_node(tmp) - elseif id == hlist or id == vlist then + elseif id == hlist_code or id == vlist_code then local sl = start.list if sl then - start.list = cleanup_page(sl) + start.list = cleanup(sl) start = start.next else head, start, tmp = remove_node(head,start) @@ -39,20 +44,19 @@ local function cleanup_page(head) -- rough return head end -nodes.cleanup_page_first = false +directives.register("backend.cleanup", function() + tasks.enableaction("shipouts","nodes.handlers.cleanuppage") +end) -function nodes.cleanup_page(head) +function nodes.handlers.cleanuppage(head) -- about 10% of the nodes make no sense for the backend - if nodes.cleanup_page_first then - head = cleanup_page(head) - end - return head, false + return cleanup(head), true end -local actions = tasks.actions("shipouts",0) -- no extra arguments +local actions = tasks.actions("shipouts") -- no extra arguments -function nodes.process_page(head) -- problem, attr loaded before node, todo ... +function nodes.handlers.finalize(head) -- problem, attr loaded before node, todo ... return actions(head) end ---~ nodes.process_page = actions +--~ nodes.handlers.finalize = actions diff --git a/Master/texmf-dist/tex/context/base/node-spl.lua b/Master/texmf-dist/tex/context/base/node-spl.lua new file mode 100644 index 00000000000..0fe3f759d1d --- /dev/null +++ b/Master/texmf-dist/tex/context/base/node-spl.lua @@ -0,0 +1,619 @@ +if not modules then modules = { } end modules ['node-spl'] = { + version = 1.001, + comment = "companion to node-spl.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- This module is dedicated to the oriental tex project and for +-- the moment is too experimental to be publicly supported. +-- +-- We could cache solutions: say that we store the featureset and +-- all 'words' -> replacement ... so we create a large solution +-- database (per font) +-- +-- This module can be optimized by using a dedicated dynamics handler +-- but I'll only do that when the rest of the code is stable. +-- +-- Todo: bind setups to paragraph. + +local gmatch, concat, format, remove = string.gmatch, table.concat, string.format, table.remove +local next, tostring, tonumber = next, tostring, tonumber +local utfchar = utf.char +local random = math.random + +local trace_split = false trackers.register("builders.paragraphs.solutions.splitters.splitter", function(v) trace_split = v end) +local trace_optimize = false trackers.register("builders.paragraphs.solutions.splitters.optimizer", function(v) trace_optimize = v end) +local trace_colors = false trackers.register("builders.paragraphs.solutions.splitters.colors", function(v) trace_colors = v end) +local trace_goodies = false trackers.register("fonts.goodies", function(v) trace_goodies = v end) + +local report_solutions = logs.reporter("fonts","solutions") +local report_splitters = logs.reporter("nodes","splitters") +local report_optimizers = logs.reporter("nodes","optimizers") + +local nodes, node = nodes, node + +local variables = interfaces.variables + +local settings_to_array = utilities.parsers.settings_to_array +local settings_to_hash = utilities.parsers.settings_to_hash + +local find_node_tail = node.tail or node.slide +local free_node = node.free +local free_nodelist = node.flush_list +local has_attribute = node.has_attribute +local set_attribute = node.set_attribute +local new_node = node.new +local copy_node = node.copy +local copy_nodelist = node.copy_list +local traverse_nodes = node.traverse +local traverse_ids = node.traverse_id +local protect_glyphs = nodes.handlers.protectglyphs or node.protect_glyphs +local hpack_nodes = node.hpack +local insert_node_before = node.insert_before +local insert_node_after = node.insert_after +local repack_hlist = nodes.repackhlist + +local setnodecolor = nodes.tracers.colors.set + +local nodecodes = nodes.nodecodes +local whatsitcodes = nodes.whatsitcodes + +local glyph_code = nodecodes.glyph +local disc_code = nodecodes.disc +local hlist_code = nodecodes.hlist +local whatsit_code = nodecodes.whatsit + +local localpar_code = whatsitcodes.localpar +local dir_code = whatsitcodes.dir +local userdefined_code = whatsitcodes.userdefined + +local nodepool = nodes.pool +local tasks = nodes.tasks +local usernodeids = nodepool.userids + +local new_textdir = nodepool.textdir +local new_usernumber = nodepool.usernumber + +local starttiming = statistics.starttiming +local stoptiming = statistics.stoptiming +local process_characters = nodes.handlers.characters +local inject_kerns = nodes.injections.handler +local fontdata = fonts.hashes.identifiers +local setfontdynamics = fonts.hashes.setdynamics +local fontprocesses = fonts.hashes.processes + +local parbuilders = builders.paragraphs +parbuilders.solutions = parbuilders.solutions or { } +parbuilders.solutions.splitters = parbuilders.solutions.splitters or { } + +local splitters = parbuilders.solutions.splitters + +local preroll = true +local variant = "normal" +local split = attributes.private('splitter') +local cache = { } +local solutions = { } -- attribute sets +local variants = { } +local max_less = 0 +local max_more = 0 +local criterium = 0 +local randomseed = nil +local optimize = nil -- set later + +function splitters.setup(setups) + local method = settings_to_hash(setups.method or "") + if method[variables.preroll] then + preroll = true + else + preroll = false + end + for k, v in next, method do + if variants[k] then + optimize = variants[k] + end + end + randomseed = tonumber(setups.randomseed) + criterium = tonumber(setups.criterium) or criterium +end + +local contextsetups = fonts.specifiers.contextsetups + +local function convert(featuresets,name,set,what) + local list, numbers, nofnumbers = set[what], { }, 0 + if list then + for i=1,#list do + local feature = list[i] + local fs = featuresets[feature] + local fn = fs and fs.number + if not fn then + -- fall back on global features + fs = contextsetups[feature] + fn = fs and fs.number + end + if fn then + nofnumbers = nofnumbers + 1 + numbers[nofnumbers] = fn + if trace_goodies or trace_optimize then + report_solutions("solution %s of '%s' uses feature '%s' with number %s",i,name,feature,fn) + end + else + report_solutions("solution %s has an invalid feature reference '%s'",i,name,tostring(feature)) + end + end + return nofnumbers > 0 and numbers + end +end + +local function initialize(goodies) + local solutions = goodies.solutions + if solutions then + local featuresets = goodies.featuresets + local goodiesname = goodies.name + if trace_goodies or trace_optimize then + report_solutions("checking solutions in '%s'",goodiesname) + end + for name, set in next, solutions do + set.less = convert(featuresets,name,set,"less") + set.more = convert(featuresets,name,set,"more") + end + end +end + +fonts.goodies.register("solutions",initialize) + +function splitters.define(name,parameters) + local settings = settings_to_hash(parameters) -- todo: interfacing + local goodies, solution, less, more = settings.goodies, settings.solution, settings.less, settings.more + local less_set, more_set + local l = less and settings_to_array(less) + local m = more and settings_to_array(more) + if goodies then + goodies = fonts.goodies.get(goodies) -- also in tfmdata + if goodies then + local featuresets = goodies.featuresets + local solution = solution and goodies.solutions[solution] + if l and #l > 0 then + less_set = convert(featuresets,name,settings,"less") -- take from settings + else + less_set = solution and solution.less -- take from goodies + end + if m and #m > 0 then + more_set = convert(featuresets,name,settings,"more") -- take from settings + else + more_set = solution and solution.more -- take from goodies + end + end + else + if l then + local n = #less_set + for i=1,#l do + local ss = contextsetups[l[i]] + if ss then + n = n + 1 + less_set[n] = ss.number + end + end + end + if m then + local n = #more_set + for i=1,#m do + local ss = contextsetups[m[i]] + if ss then + n = n + 1 + more_set[n] = ss.number + end + end + end + end + if trace_optimize then + report_solutions("defining solutions '%s', less: '%s', more: '%s'",name,concat(less_set or {}," "),concat(more_set or {}," ")) + end + local nofsolutions = #solutions + 1 + solutions[nofsolutions] = { + solution = solution, + less = less_set or { }, + more = more_set or { }, + settings = settings, -- for tracing + } + tex.write(nofsolutions) +end + +local nofwords, noftries, nofadapted, nofkept, nofparagraphs = 0, 0, 0, 0, 0 + +local splitter_one = usernodeids["splitters.one"] +local splitter_two = usernodeids["splitters.two"] + +function splitters.split(head) + -- quite fast + local current, done, rlmode, start, stop, attribute = head, false, false, nil, nil, 0 + cache, max_less, max_more = { }, 0, 0 + local function flush() -- we can move this + local font = start.font + local last = stop.next + local list = last and copy_nodelist(start,last) or copy_nodelist(start) + local n = #cache + 1 + local user_one = new_usernumber(splitter_one,n) + local user_two = new_usernumber(splitter_two,n) + head, start = insert_node_before(head,start,user_one) + insert_node_after(head,stop,user_two) + if rlmode == "TRT" or rlmode == "+TRT" then + local dirnode = new_textdir("+TRT") + list.prev = dirnode + dirnode.next = list + list = dirnode + end + local c = { + original = list, + attribute = attribute, + direction = rlmode, + font = font + } + if trace_split then + report_splitters("cached %4i: font: %s, attribute: %s, word: %s, direction: %s", n, + font, attribute, nodes.listtoutf(list,true), rlmode) + end + cache[n] = c + local solution = solutions[attribute] + local l, m = #solution.less, #solution.more + if l > max_less then max_less = l end + if m > max_more then max_more = m end + start, stop, done = nil, nil, true + end + while current do + local id = current.id + if id == glyph_code and current.subtype < 256 then + local a = has_attribute(current,split) + if not a then + start, stop = nil, nil + elseif not start then + start, stop, attribute = current, current, a + elseif a ~= attribute then + start, stop = nil, nil + else + stop = current + end + current = current.next + elseif id == disc_code then + start, stop, current = nil, nil, current.next + elseif id == whatsit_code then + if start then + flush() + end + local subtype = current.subtype + if subtype == dir_code or subtype == localpar_code then + rlmode = current.dir + end + current = current.next + else + if start then + flush() + end + current = current.next + end + end + if start then + flush() + end + nofparagraphs = nofparagraphs + 1 + nofwords = nofwords + #cache + return head, done +end + +local function collect_words(list) + local words, w, word = { }, 0, nil + for current in traverse_ids(whatsit_code,list) do + if current.subtype == userdefined_code then + local user_id = current.user_id + if user_id == splitter_one then + word = { current.value, current, current } + w = w + 1 + words[w] = word + elseif user_id == splitter_two then + word[3] = current + end + end + end + return words -- check for empty (elsewhere) +end + +-- we could avoid a hpack but hpack is not that slow + +local function doit(word,list,best,width,badness,line,set,listdir) + local changed = 0 + local n = word[1] + local found = cache[n] + if found then + local original, attribute, direction = found.original, found.attribute, found.direction + local solution = solutions[attribute] + local features = solution and solution[set] + if features then + local featurenumber = features[best] -- not ok probably + if featurenumber then + noftries = noftries + 1 + local first = copy_nodelist(original) + if not trace_colors then + for n in traverse_nodes(first) do -- maybe fast force so no attr needed + set_attribute(n,0,featurenumber) -- this forces dynamics + end + elseif set == "less" then + for n in traverse_nodes(first) do + setnodecolor(n,"font:isol") + set_attribute(n,0,featurenumber) + end + else + for n in traverse_nodes(first) do + setnodecolor(n,"font:medi") + set_attribute(n,0,featurenumber) + end + end + local font = found.font + -- local dynamics = found.dynamics + -- local shared = fontdata[font].shared + -- if not dynamics then -- we cache this + -- dynamics = shared.dynamics + -- found.dynamics = dynamics + -- end + -- local processors = found[featurenumber] + -- if not processors then -- we cache this too + -- processors = fonts.handlers.otf.setdynamics(font,featurenumber) + -- found[featurenumber] = processors + -- end + local setdynamics = setfontdynamics[font] + if setdynamics then + local processes = setdynamics(font,featurenumber) + for i=1,#processes do -- often more than 1 + first = processes[i](first,font,featurenumber) + end + else + report_solutions("fatal error, no dynamics for font %s",font) + end + first = inject_kerns(first) + local h = word[2].next -- head of current word + local t = word[3].prev -- tail of current word + if first.id == whatsit_code then + local temp = first + first = first.next + free_node(temp) + end + local last = find_node_tail(first) + -- replace [u]h->t by [u]first->last + local next, prev = t.next, h.prev + prev.next, first.prev = first, prev + if next then + last.next, next.prev = next, last + end + -- check new pack + local temp, b = repack_hlist(list,width,'exactly',listdir) + if b > badness then + if trace_optimize then + report_optimizers("line %s, badness before: %s, after: %s, criterium: %s -> quit",line,badness,b,criterium) + end + -- remove last insert + prev.next, h.prev = h, prev + if next then + t.next, next.prev = next, t + else + t.next = nil + end + last.next = nil + free_nodelist(first) + else + if trace_optimize then + report_optimizers("line %s, badness before: %s, after: %s, criterium: %s -> continue",line,badness,b,criterium) + end + -- free old h->t + t.next = nil + free_nodelist(h) + changed, badness = changed + 1, b + end + if b <= criterium then + return true, changed + end + end + end + end + return false, changed +end + +-- We repeat some code but adding yet another layer of indirectness is not +-- making things better. + +variants[variables.normal] = function(words,list,best,width,badness,line,set,listdir) + local changed = 0 + for i=1,#words do + local done, c = doit(words[i],list,best,width,badness,line,set,listdir) + changed = changed + c + if done then + break + end + end + if changed > 0 then + nofadapted = nofadapted + 1 + -- todo: get rid of pack when ok because we already have packed and we only need the last b + local list, b = repack_hlist(list,width,'exactly',listdir) + return list, true, changed, b -- badness + else + nofkept = nofkept + 1 + return list, false, 0, badness + end +end + +variants[variables.reverse] = function(words,list,best,width,badness,line,set,listdir) + local changed = 0 + for i=#words,1,-1 do + local done, c = doit(words[i],list,best,width,badness,line,set,listdir) + changed = changed + c + if done then + break + end + end + if changed > 0 then + nofadapted = nofadapted + 1 + -- todo: get rid of pack when ok because we already have packed and we only need the last b + local list, b = repack_hlist(list,width,'exactly',listdir) + return list, true, changed, b -- badness + else + nofkept = nofkept + 1 + return list, false, 0, badness + end +end + +variants[variables.random] = function(words,list,best,width,badness,line,set,listdir) + local changed = 0 + while #words > 0 do + local done, c = doit(remove(words,random(1,#words)),list,best,width,badness,line,set,listdir) + changed = changed + c + if done then + break + end + end + if changed > 0 then + nofadapted = nofadapted + 1 + -- todo: get rid of pack when ok because we already have packed and we only need the last b + local list, b = repack_hlist(list,width,'exactly',listdir) + return list, true, changed, b -- badness + else + nofkept = nofkept + 1 + return list, false, 0, badness + end +end + +optimize = variants.normal -- the default + +local function show_quality(current,what,line) + local set = current.glue_set + local sign = current.glue_sign + local order = current.glue_order + local amount = set * ((sign == 2 and -1) or 1) + report_optimizers("line %s, %s, amount %s, set %s, sign %s (%s), order %s",line,what,amount,set,sign,how,order) +end + +function splitters.optimize(head) + local nc = #cache + if nc > 0 then + starttiming(splitters) + local listdir = nil -- todo ! ! ! + if randomseed then + math.setrandomseedi(randomseed) + randomseed = nil + end + local line = 0 + local tex_hbadness, tex_hfuzz = tex.hbadness, tex.hfuzz + tex.hbadness, tex.hfuzz = 10000, number.maxdimen + if trace_optimize then + report_optimizers("preroll: %s, variant: %s, preroll criterium: %s, cache size: %s", + tostring(preroll),variant,criterium,nc) + end + for current in traverse_ids(hlist_code,head) do + -- report_splitters("before: [%s] => %s",current.dir,nodes.tosequence(current.list,nil)) + line = line + 1 + local sign, dir, list, width = current.glue_sign, current.dir, current.list, current.width + local temp, badness = repack_hlist(list,width,'exactly',dir) -- it would be nice if the badness was stored in the node + if badness > 0 then + if sign == 0 then + if trace_optimize then + report_optimizers("line %s, badness %s, okay",line,badness) + end + else + local set, max + if sign == 1 then + if trace_optimize then + report_optimizers("line %s, badness %s, underfull, trying more",line,badness) + end + set, max = "more", max_more + else + if trace_optimize then + report_optimizers("line %s, badness %s, overfull, trying less",line,badness) + end + set, max = "less", max_less + end + -- we can keep the best variants + local lastbest, lastbadness = nil, badness + if preroll then + local bb, base + for i=1,max do + if base then + free_nodelist(base) + end + base = copy_nodelist(list) + local words = collect_words(base) -- beware: words is adapted + for j=i,max do + local temp, done, changes, b = optimize(words,base,j,width,badness,line,set,dir) + base = temp + if trace_optimize then + report_optimizers("line %s, alternative: %s.%s, changes: %s, badness %s",line,i,j,changes,b) + end + bb = b + if b <= criterium then + break + end + -- if done then + -- break + -- end + end + if bb and bb > criterium then -- needs checking + if not lastbest then + lastbest, lastbadness = i, bb + elseif bb > lastbadness then + lastbest, lastbadness = i, bb + end + else + break + end + end + free_nodelist(base) + end + local words = collect_words(list) + for best=lastbest or 1,max do + local temp, done, changes, b = optimize(words,list,best,width,badness,line,set,dir) + current.list = temp + if trace_optimize then + report_optimizers("line %s, alternative: %s, changes: %s, badness %s",line,best,changes,b) + end + if done then + if b <= criterium then -- was == 0 + protect_glyphs(list) + break + end + end + end + end + else + if trace_optimize then + report_optimizers("line %s, not bad enough",line) + end + end + -- we pack inside the outer hpack and that way keep the original wd/ht/dp as bonus + current.list = hpack_nodes(current.list,width,'exactly',listdir) + -- report_splitters("after: [%s] => %s",temp.dir,nodes.tosequence(temp.list,nil)) + end + for i=1,nc do + local ci = cache[i] + free_nodelist(ci.original) + end + cache = { } + tex.hbadness, tex.hfuzz = tex_hbadness, tex_hfuzz + stoptiming(splitters) + end +end + +statistics.register("optimizer statistics", function() + if nofwords > 0 then + local elapsed = statistics.elapsedtime(splitters) + local average = noftries/elapsed + return format("%s words identified in %s paragraphs, %s words retried, %s lines tried, %0.3f seconds used, %s adapted, %0.1f lines per second", + nofwords,nofparagraphs,noftries,nofadapted+nofkept,elapsed,nofadapted,average) + end +end) + +function splitters.enable() + tasks.enableaction("processors", "builders.paragraphs.solutions.splitters.split") + tasks.enableaction("finalizers", "builders.paragraphs.solutions.splitters.optimize") +end + +function splitters.disable() + tasks.disableaction("processors", "builders.paragraphs.solutions.splitters.split") + tasks.disableaction("finalizers", "builders.paragraphs.solutions.splitters.optimize") +end diff --git a/Master/texmf-dist/tex/context/base/node-spl.mkiv b/Master/texmf-dist/tex/context/base/node-spl.mkiv new file mode 100644 index 00000000000..8ad6795a5e0 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/node-spl.mkiv @@ -0,0 +1,114 @@ +%D \module +%D [ file=node-spl, +%D version=2009.05.19, +%D title=\CONTEXT\ Node Macros, +%D subtitle=Splitters, +%D author=Hans Hagen, +%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. + +\writestatus{loading}{ConTeXt Node Support / Splitters} + +\registerctxluafile{node-spl}{1.001} + +\definesystemattribute[splitter][public] + +%D This module is specially made for the oriental \TEX\ project. The working is as +%D follows (and tuned for fonts like Idris' Husayni. The following method came to +%D my mind after a couple of Skype sessions with Idris while working on the rough +%D edges of the Husayni font and playing with font dynamics. +%D +%D \startitemize[packed] +%D +%D \item We define a couple of features sets, some can have stylistics variants +%D that result in the same words getting a different width. Normally this +%D happens in a goodies file. +%D +%D \item We group such features in a solution set. A solutionset can be enabled +%D by setting an attribute. +%D +%D \item For each paragraph we identify words that get this set applied. We replace +%D these words by a user node that refers to the original. +%D +%D \item For each word we apply the features to a copy that we associate with this +%D original word. +%D +%D \item At the end we have a paragraph (node list) with user nodes that point to a +%D cache that has originals and processed variants. +%D +%D \item When the paragraph is broken into lines we optimize the spacing by +%D substituting variants. +%D +%D \stopitemize +%D +%D This approach permits us to use a dedicated paragraph builder, one that treats +%D the user nodes special and takes the alternatives into account. +%D +%D Currently we assume only one solution being active. Maybe some day I'll support +%D a mixture. This is only one way of optimizing and after several experiments this +%D one was chosen as testcase. It took quite some experiments (and time) to get thus +%D far. +%D +%D The is experimental code for the Oriental \TEX\ project and aspects of it might +%D change. +%D +%D \starttyping +%D \setupfontsolutions[method={random,preroll},criterium=1,randomseed=101] +%D +%D \definefontsolution % actually only the last run needs to be done this way +%D [FancyHusayni] +%D [goodies=husayni, +%D solution=experimental] +%D +%D \definedfont[husayni*husayni-default at 24pt] +%D \setupinterlinespace[line=36pt] +%D \righttoleft +%D \enabletrackers[parbuilders.solutions.splitters.colors] +%D \setfontsolution[FancyHusayni] +%D alb alb alb \par +%D \resetfontsolution +%D \disabletrackers[parbuilders.solutions.splitters.colors] +%D \stoptyping + +\unprotect + +\newtoks\everysetupfontsolutions + +\unexpanded\def\definefontsolution + {\dodoubleargument\dodefinefontsolution} + +\def\dodefinefontsolution[#1][#2]% we could set the attribute at the lua end + {\setxvalue{\??fu:#1}{\attribute\splitterattribute\ctxlua{builders.paragraphs.solutions.splitters.define("#1","#2")}\relax}} + +\unexpanded\def\setfontsolution[#1]% + {\ctxlua{builders.paragraphs.solutions.splitters.enable()}% + \csname\??fu:#1\endcsname} + +\unexpanded\def\resetfontsolution + {\ctxlua{builders.paragraphs.solutions.splitters.disable()}% + \attribute\splitterattribute\attributeunsetvalue} + +\letvalue{\??fu:\v!reset}\resetfontsolution + +\unexpanded\def\setupfontsolutions[#1]% + {\getparameters[\??fu][#1]% + \the\everysetupfontsolutions} + +\appendtoks + \ctxlua{builders.paragraphs.solutions.splitters.setup { + method = "\@@fumethod", + criterium = "\@@fucriterium", + }}% +\to \everysetupfontsolutions + +% We initialize this module at the \LUA\ end. +% +% \setupfontsolutions +% [\c!method={\v!normal,preroll}, +% \c!criterium=0] + +\protect diff --git a/Master/texmf-dist/tex/context/base/node-tex.lua b/Master/texmf-dist/tex/context/base/node-tex.lua index a6eef32693f..2170e0603fd 100644 --- a/Master/texmf-dist/tex/context/base/node-tex.lua +++ b/Master/texmf-dist/tex/context/base/node-tex.lua @@ -8,7 +8,9 @@ if not modules then modules = { } end modules ['node-tex'] = { local format = string.format -kernel = kernel or { } +builders = builders or { } +builders.kernel = builders.kernel or { } +local kernel = builders.kernel local starttiming, stoptiming = statistics.starttiming, statistics.stoptiming local hyphenate, ligaturing, kerning = lang.hyphenate, node.ligaturing, node.kerning diff --git a/Master/texmf-dist/tex/context/base/node-tra.lua b/Master/texmf-dist/tex/context/base/node-tra.lua index 5acd70baf2e..38855f65934 100644 --- a/Master/texmf-dist/tex/context/base/node-tra.lua +++ b/Master/texmf-dist/tex/context/base/node-tra.lua @@ -11,45 +11,71 @@ if not modules then modules = { } end modules ['node-tra'] = { might become a runtime module instead. This module will be cleaned up!

--ldx]]-- -local utf = unicode.utf8 -local format, match, concat, rep, utfchar = string.format, string.match, table.concat, string.rep, utf.char +local utfchar = utf.char +local concat = table.concat +local format, match, gmatch, concat, rep = string.format, string.match, string.gmatch, table.concat, string.rep +local lpegmatch = lpeg.match +local write_nl = texio.write_nl -local ctxcatcodes = tex.ctxcatcodes +local report_nodes = logs.reporter("nodes","tracing") -fonts = fonts or { } -fonts.tfm = fonts.tfm or { } -fonts.ids = fonts.ids or { } +fonts = fonts or { } +nodes = nodes or { } -nodes = nodes or { } -nodes.tracers = nodes.tracers or { } -nodes.tracers.characters = nodes.tracers.characters or { } -nodes.tracers.steppers = nodes.tracers.steppers or { } +local fonts, nodes, node, context = fonts, nodes, node, context -local glyph = node.id('glyph') -local hlist = node.id('hlist') -local vlist = node.id('vlist') -local disc = node.id('disc') -local glue = node.id('glue') -local kern = node.id('kern') -local rule = node.id('rule') -local whatsit = node.id('whatsit') +nodes.tracers = nodes.tracers or { } +local tracers = nodes.tracers + +nodes.tasks = nodes.tasks or { } +local tasks = nodes.tasks + +nodes.handlers = nodes.handlers or { } +local handlers = nodes.handlers + +nodes.injections = nodes.injections or { } +local injections = nodes.injections + +tracers.characters = tracers.characters or { } +tracers.steppers = tracers.steppers or { } + +local char_tracers = tracers.characters +local step_tracers = tracers.steppers local copy_node_list = node.copy_list local hpack_node_list = node.hpack local free_node_list = node.flush_list -local first_character = node.first_character -local node_type = node.type local traverse_nodes = node.traverse -local texsprint = tex.sprint -local fontdata = fonts.ids +local nodecodes = nodes.nodecodes +local whatcodes = nodes.whatcodes +local skipcodes = nodes.skipcodes + +local glyph_code = nodecodes.glyph +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist +local disc_code = nodecodes.disc +local glue_code = nodecodes.glue +local kern_code = nodecodes.kern +local rule_code = nodecodes.rule +local whatsit_code = nodecodes.whatsit + +local localpar_code = whatcodes.localpar +local dir_code = whatcodes.dir + +local userskip_code = skipcodes.userskip -function nodes.tracers.characters.collect(head,list,tag,n) +local nodepool = nodes.pool + +local new_glyph = nodepool.glyph + +function char_tracers.collect(head,list,tag,n) + local fontdata = fonts.hashes.identifiers n = n or 0 local ok, fn = false, nil while head do local id = head.id - if id == glyph then + if id == glyph_code then local f = head.font if f ~= fn then ok, fn = false, f @@ -64,7 +90,7 @@ function nodes.tracers.characters.collect(head,list,tag,n) end local l = list[n][tag] l[#l+1] = { c, f, i } - elseif id == disc then + elseif id == disc_code then -- skip else ok = false @@ -73,7 +99,7 @@ function nodes.tracers.characters.collect(head,list,tag,n) end end -function nodes.tracers.characters.equal(ta, tb) +function char_tracers.equal(ta, tb) if #ta ~= #tb then return false else @@ -87,7 +113,7 @@ function nodes.tracers.characters.equal(ta, tb) return true end -function nodes.tracers.characters.string(t) +function char_tracers.string(t) local tt = { } for i=1,#t do tt[i] = utfchar(t[i][1]) @@ -95,7 +121,7 @@ function nodes.tracers.characters.string(t) return concat(tt,"") end -function nodes.tracers.characters.unicodes(t,decimal) +function char_tracers.unicodes(t,decimal) local tt = { } for i=1,#t do local n = t[i][1] @@ -110,7 +136,7 @@ function nodes.tracers.characters.unicodes(t,decimal) return concat(tt," ") end -function nodes.tracers.characters.indices(t,decimal) +function char_tracers.indices(t,decimal) local tt = { } for i=1,#t do local n = t[i][3] @@ -125,20 +151,20 @@ function nodes.tracers.characters.indices(t,decimal) return concat(tt," ") end -function nodes.tracers.characters.start() - local npc = nodes.process_characters +function char_tracers.start() + local npc = handlers.characters local list = { } - function nodes.process_characters(head) + function handlers.characters(head) local n = #list - nodes.tracers.characters.collect(head,list,'before',n) + char_tracers.collect(head,list,'before',n) local h, d = npc(head) - nodes.tracers.characters.collect(head,list,'after',n) + char_tracers.collect(head,list,'after',n) if #list > n then list[#list+1] = { } end return h, d end - function nodes.tracers.characters.stop() + function char_tracers.stop() tracers.list['characters'] = list local variables = { ['title'] = 'ConTeXt Character Processing Information', @@ -146,7 +172,7 @@ function nodes.tracers.characters.start() ['color-background-two'] = lmx.get('color-background-purple'), } lmx.show('context-characters.lmx',variables) - nodes.process_characters = npc + handlers.characters = npc tasks.restart("processors", "characters") end tasks.restart("processors", "characters") @@ -154,14 +180,14 @@ end local stack = { } -function nodes.tracers.start(tag) +function tracers.start(tag) stack[#stack+1] = tag - local tracer = nodes.tracers[tag] + local tracer = tracers[tag] if tracer and tracer.start then tracer.start() end end -function nodes.tracers.stop() +function tracers.stop() local tracer = stack[#stack] if tracer and tracer.stop then tracer.stop() @@ -173,15 +199,15 @@ end local collection, collecting, messages = { }, false, { } -function nodes.tracers.steppers.start() +function step_tracers.start() collecting = true end -function nodes.tracers.steppers.stop() +function step_tracers.stop() collecting = false end -function nodes.tracers.steppers.reset() +function step_tracers.reset() for i=1,#collection do local c = collection[i] if c then @@ -191,23 +217,23 @@ function nodes.tracers.steppers.reset() collection, messages = { }, { } end -function nodes.tracers.steppers.nofsteps() +function step_tracers.nofsteps() return tex.write(#collection) end -function nodes.tracers.steppers.glyphs(n,i) +function step_tracers.glyphs(n,i) local c = collection[i] if c then tex.box[n] = hpack_node_list(copy_node_list(c)) end end -function nodes.tracers.steppers.features() --- local f = first_character(collection[1]) --- if f then -- something fishy with first_character +function step_tracers.features() + -- we cannot use first_glyph here as it only finds characters with subtype < 256 + local fontdata = fonts.hashes.identifiers local f = collection[1] while f do - if f.id == glyph then + if f.id == glyph_code then local tfmdata, t = fontdata[f.font], { } for feature, value in table.sortedhash(tfmdata.shared.features) do if feature == "number" or feature == "features" then @@ -223,9 +249,9 @@ function nodes.tracers.steppers.features() end end if #t > 0 then - texsprint(ctxcatcodes,concat(t,", ")) + context(concat(t,", ")) else - texsprint(ctxcatcodes,"no features") + context("no features") end return end @@ -233,41 +259,48 @@ function nodes.tracers.steppers.features() end end -function nodes.tracers.fontchar(font,char) - local n = nodes.glyph() +function tracers.fontchar(font,char) + local fontchar = fonts.hashes.characters + local n = new_glyph() n.font, n.char, n.subtype = font, char, 256 - node.write(n) + context(n) end -function nodes.tracers.steppers.codes(i,command) +function step_tracers.codes(i,command) + local fontdata = fonts.hashes.identifiers local c = collection[i] while c do local id = c.id - if id == glyph then + if id == glyph_code then if command then - texsprint(ctxcatcodes,format("%s{%s}{%s}",command,c.font,c.char)) + local f, c = c.font,c.char + local d = fontdata[f].descriptions + local d = d and d[c] + context[command](f,c,d and d.class or "") else - texsprint(ctxcatcodes,format("[%s:U+%04X]",c.font,c.char)) + context("[%s:U+%04X]",c.font,c.char) end - elseif id == whatsit and (c.subtype == 6 or c.subtype == 7) then - texsprint(ctxcatcodes,format("[%s]",c.dir)) + elseif id == whatsit_code and (c.subtype == localpar_code or c.subtype == dir_code) then + context("[%s]",c.dir) else - texsprint(ctxcatcodes,format("[%s]",node_type(id))) + context("[%s]",nodecodes[id]) end c = c.next end end -function nodes.tracers.steppers.messages(i,command,split) +function step_tracers.messages(i,command,split) local list = messages[i] -- or { "no messages" } if list then for i=1,#list do local l = list[i] - if split then + if not command then + context("(%s)",l) + elseif split then local a, b = match(l,"^(.-)%s*:%s*(.*)$") - texsprint(ctxcatcodes,format("%s{%s}{%s}",command,a or l,b or "")) + context[command](a or l or "",b or "") else - texsprint(ctxcatcodes,format("%s{%s}",command,l)) + context[command](l) end end end @@ -275,29 +308,29 @@ end -- hooks into the node list processor (see otf) -function nodes.tracers.steppers.check(head) +function step_tracers.check(head) if collecting then - nodes.tracers.steppers.reset() + step_tracers.reset() local n = copy_node_list(head) - nodes.inject_kerns(n,nil,"trace",true) - nodes.protect_glyphs(n) -- can be option + injections.handler(n,nil,"trace",true) + handlers.protectglyphs(n) -- can be option collection[1] = n end end -function nodes.tracers.steppers.register(head) +function step_tracers.register(head) if collecting then local nc = #collection+1 if messages[nc] then local n = copy_node_list(head) - nodes.inject_kerns(n,nil,"trace",true) - nodes.protect_glyphs(n) -- can be option + injections.handler(n,nil,"trace",true) + handlers.protectglyphs(n) -- can be option collection[nc] = n end end end -function nodes.tracers.steppers.message(str,...) +function step_tracers.message(str,...) str = format(str,...) if collecting then local n = #collection + 1 @@ -310,55 +343,72 @@ end -- this will be reorganized: -function nodes.show_list(head, message) +function nodes.showlist(head, message) if message then - texio.write_nl(message) + write_nl(message) end for n in traverse_nodes(head) do - texio.write_nl(tostring(n)) + write_nl(tostring(n)) end end -function nodes.check_glyphs(head,message) +function nodes.handlers.checkglyphs(head,message) local t = { } - for g in traverse_id(glyph,head) do + for g in traverse_id(glyph_code,head) do t[#t+1] = format("U+%04X:%s",g.char,g.subtype) end if #t > 0 then - logs.report(message or "nodes","%s glyphs: %s",#t,concat(t," ")) + if message and message ~= "" then + report_nodes("%s, %s glyphs: %s",message,#t,concat(t," ")) + else + report_nodes("%s glyphs: %s",#t,concat(t," ")) + end end return false end -function nodes.tosequence(start,stop,compact) +function nodes.handlers.checkforleaks(sparse) + local l = { } + local q = node.usedlist() + for p in traverse(q) do + local s = table.serialize(nodes.astable(p,sparse),nodecodes[p.id]) + l[s] = (l[s] or 0) + 1 + end + node.flush_list(q) + for k, v in next, l do + write_nl(format("%s * %s", v, k)) + end +end + +local function tosequence(start,stop,compact) if start then local t = { } while start do local id = start.id - if id == glyph then + if id == glyph_code then local c = start.char if compact then if start.components then - t[#t+1] = nodes.tosequence(start.components,nil,compact) + t[#t+1] = tosequence(start.components,nil,compact) else - t[#t+1] = format("%s",utfchar(c)) + t[#t+1] = utfchar(c) end else t[#t+1] = format("U+%04X:%s",c,utfchar(c)) end - elseif id == whatsit and start.subtype == 6 or start.subtype == 7 then + elseif id == whatsit_code and start.subtype == localpar_code or start.subtype == dir_code then t[#t+1] = "[" .. start.dir .. "]" - elseif id == rule then + elseif id == rule_code then if compact then t[#t+1] = "|" else - t[#t+1] = node_type(id) + t[#t+1] = nodecodes[id] end else if compact then t[#t+1] = "[]" else - t[#t+1] = node_type(id) + t[#t+1] = nodecodes[id] end end if start == stop then @@ -377,23 +427,25 @@ function nodes.tosequence(start,stop,compact) end end +nodes.tosequence = tosequence + function nodes.report(t,done) if done then if status.output_active then - logs.report("nodes","output, changed, %s nodes",nodes.count(t)) + report_nodes("output, changed, %s nodes",nodes.count(t)) else - texio.write("nodes","normal, changed, %s nodes",nodes.count(t)) + write_nl("nodes","normal, changed, %s nodes",nodes.count(t)) end else if status.output_active then - logs.report("nodes","output, unchanged, %s nodes",nodes.count(t)) + report_nodes("output, unchanged, %s nodes",nodes.count(t)) else - texio.write("nodes","normal, unchanged, %s nodes",nodes.count(t)) + write_nl("nodes","normal, unchanged, %s nodes",nodes.count(t)) end end end -function nodes.pack_list(head) +function nodes.packlist(head) local t = { } for n in traverse(head) do t[#t+1] = tostring(n) @@ -401,7 +453,7 @@ function nodes.pack_list(head) return t end -function nodes.ids_to_string(head,tail) +function nodes.idstostring(head,tail) local t, last_id, last_n = { }, nil, 0 for n in traverse_nodes(head,tail) do -- hm, does not stop at tail local id = n.id @@ -411,9 +463,9 @@ function nodes.ids_to_string(head,tail) last_n = last_n + 1 else if last_n > 1 then - t[#t+1] = format("[%s*%s]",last_n,node_type(last_id) or "?") + t[#t+1] = format("[%s*%s]",last_n,nodecodes[last_id] or "?") else - t[#t+1] = format("[%s]",node_type(last_id) or "?") + t[#t+1] = format("[%s]",nodecodes[last_id] or "?") end last_id, last_n = id, 1 end @@ -424,22 +476,55 @@ function nodes.ids_to_string(head,tail) if not last_id then t[#t+1] = "no nodes" elseif last_n > 1 then - t[#t+1] = format("[%s*%s]",last_n,node_type(last_id) or "?") + t[#t+1] = format("[%s*%s]",last_n,nodecodes[last_id] or "?") else - t[#t+1] = format("[%s]",node_type(last_id) or "?") + t[#t+1] = format("[%s]",nodecodes[last_id] or "?") end return concat(t," ") end -nodes.ids_tostring = nodes.ids_to_string - -local function show_simple_list(h,depth,n) +--~ function nodes.xidstostring(head,tail) -- only for special tracing of backlinks +--~ local n = head +--~ while n.next do +--~ n = n.next +--~ end +--~ local t, last_id, last_n = { }, nil, 0 +--~ while n do +--~ local id = n.id +--~ if not last_id then +--~ last_id, last_n = id, 1 +--~ elseif last_id == id then +--~ last_n = last_n + 1 +--~ else +--~ if last_n > 1 then +--~ t[#t+1] = format("[%s*%s]",last_n,nodecodes[last_id] or "?") +--~ else +--~ t[#t+1] = format("[%s]",nodecodes[last_id] or "?") +--~ end +--~ last_id, last_n = id, 1 +--~ end +--~ if n == head then +--~ break +--~ end +--~ n = n.prev +--~ end +--~ if not last_id then +--~ t[#t+1] = "no nodes" +--~ elseif last_n > 1 then +--~ t[#t+1] = format("[%s*%s]",last_n,nodecodes[last_id] or "?") +--~ else +--~ t[#t+1] = format("[%s]",nodecodes[last_id] or "?") +--~ end +--~ return table.concat(table.reversed(t)," ") +--~ end + +local function showsimplelist(h,depth,n) while h do - texio.write_nl(rep(" ",n) .. tostring(h)) + write_nl(rep(" ",n) .. tostring(h)) if not depth or n < depth then local id = h.id - if id == hlist or id == vlist then - show_simple_list(h.list,depth,n+1) + if id == hlist_code or id == vlist_code then + showsimplelist(h.list,depth,n+1) end end h = h.next @@ -454,13 +539,13 @@ end --~ callback.register('buildpage_filter',nil) --~ \stopluacode -nodes.show_simple_list = function(h,depth) show_simple_list(h,depth,0) end +nodes.showsimplelist = function(h,depth) showsimplelist(h,depth,0) end -function nodes.list_to_utf(h,joiner) +function nodes.listtoutf(h,joiner) local joiner = (joiner ==true and utfchar(0x200C)) or joiner -- zwnj local w = { } while h do - if h.id == glyph then -- always true + if h.id == glyph_code then -- always true w[#w+1] = utfchar(h.char) if joiner then w[#w+1] = joiner @@ -472,3 +557,133 @@ function nodes.list_to_utf(h,joiner) end return concat(w) end + +local what = { [0] = "unknown", "line", "box", "indent", "row", "cell" } + +local function showboxes(n,symbol,depth) + depth, symbol = depth or 0, symbol or "." + for n in traverse_nodes(n) do + local id = n.id + if id == hlist_code or id == vlist_code then + local s = n.subtype + report_nodes(rep(symbol,depth) .. what[s] or s) + showboxes(n.list,symbol,depth+1) + end + end +end + +nodes.showboxes = showboxes + +local threshold = 65536 + +local function toutf(list,result,nofresult,stopcriterium) + if list then + local fontchar = fonts.hashes.characters + for n in traverse_nodes(list) do + local id = n.id + if id == glyph_code then + local components = n.components + if components then + result, nofresult = toutf(components,result,nofresult) + else + local c = n.char + local fc = fontchar[n.font] + if fc then + local u = fc[c].tounicode + if u then + for s in gmatch(u,"....") do + nofresult = nofresult + 1 + result[nofresult] = utfchar(tonumber(s,16)) + end + else + nofresult = nofresult + 1 + result[nofresult] = utfchar(c) + end + else + nofresult = nofresult + 1 + result[nofresult] = utfchar(c) + end + end + elseif id == disc_code then + result, nofresult = toutf(n.replace,result,nofresult) -- needed? + elseif id == hlist_code or id == vlist_code then +--~ if nofresult > 0 and result[nofresult] ~= " " then +--~ nofresult = nofresult + 1 +--~ result[nofresult] = " " +--~ end + result, nofresult = toutf(n.list,result,nofresult) + elseif id == glue_code and n.subtype == userskip_code and n.spec.width > threshold then + if nofresult > 0 and result[nofresult] ~= " " then + nofresult = nofresult + 1 + result[nofresult] = " " + end + elseif id == kern_code and n.kern > threshold then + if nofresult > 0 and result[nofresult] ~= " " then + nofresult = nofresult + 1 + result[nofresult] = " " + end + end + if n == stopcriterium then + break + end + end + end + return result, nofresult +end + +function nodes.toutf(list,stopcriterium) + local result, nofresult = toutf(list,{},0,stopcriterium) + return concat(result) +end + +-- might move elsewhere + +local ptfactor = number.dimenfactors.pt +local bpfactor = number.dimenfactors.bp +local stripper = lpeg.patterns.stripzeros + +local points = function(n) + return lpegmatch(stripper,format("%.5fpt",n*ptfactor)) +end + +local basepoints = function(n) + return lpegmatch(stripper,format("%.5fbp",n*bpfactor)) +end + +number.points = points +number.basepoints = basepoints + +--~ function nodes.thespec(s) +--~ local stretch_order = s.stretch_order +--~ local shrink_order = s.shrink_order +--~ local stretch_unit = (stretch_order ~= 0) and ("fi".. string.rep("l",stretch_order)) or "sp" +--~ local shrink_unit = (shrink_order ~= 0) and ("fi".. string.rep("l",shrink_order)) or "sp" +--~ return string.format("%ssp+ %ssp - %ssp",s.width,s.stretch,stretch_unit,s.shrink,shrink_unit) +--~ end + +local colors = { } +tracers.colors = colors + +local get_attribute = node.has_attribute +local set_attribute = node.set_attribute +local unset_attribute = node.unset_attribute + +local attribute = attributes.private('color') +local colormodel = attributes.private('colormodel') +local mapping = attributes.list[attribute] or { } + +function colors.set(n,c,s) + local mc = mapping[c] + if not mc then + unset_attribute(n,attribute) + else + if not get_attribute(n,colormodel) then + set_attribute(n,colormodel,s or 1) + end + set_attribute(n,attribute,mc) + end +end + +function colors.reset(n) + unset_attribute(n,attribute) +end diff --git a/Master/texmf-dist/tex/context/base/node-tsk.lua b/Master/texmf-dist/tex/context/base/node-tsk.lua index 206b4a2668c..29a665ff031 100644 --- a/Master/texmf-dist/tex/context/base/node-tsk.lua +++ b/Master/texmf-dist/tex/context/base/node-tsk.lua @@ -6,88 +6,153 @@ if not modules then modules = { } end modules ['node-tsk'] = { license = "see context related readme files" } --- this might move to task-* +-- This might move to task-* and become less code as in sequencers +-- we already have dirty flags as well. On the other hand, nodes are +-- rather specialized and here we focus on node related tasks. local trace_tasks = false trackers.register("tasks.creation", function(v) trace_tasks = v end) -tasks = tasks or { } -tasks.data = tasks.data or { } +local report_tasks = logs.reporter("tasks") -function tasks.new(name,list) - local tasklist = sequencer.reset() - tasks.data[name] = { list = tasklist, runner = false } - for l=1,#list do - sequencer.appendgroup(tasklist,list[l]) +local allocate = utilities.storage.allocate + +local nodes = nodes + +nodes.tasks = nodes.tasks or { } +local tasks = nodes.tasks + +local tasksdata = { } -- no longer public + +local sequencers = utilities.sequencers + +local frozengroups = "no" + +function tasks.freeze(kind) + frozengroups = kind or "tolerant" -- todo: hook into jobname +end + +function tasks.new(specification) -- was: name,arguments,list + local name = specification.name + local arguments = specification.arguments or 0 + local sequence = specification.sequence + if name and sequence then + local tasklist = sequencers.reset() + tasksdata[name] = { + list = tasklist, + runner = false, + arguments = arguments, + -- sequence = sequence, + frozen = { }, + } + for l=1,#sequence do + sequencers.appendgroup(tasklist,sequence[l]) + end + end +end + +local function valid(name) + local data = tasksdata[name] + if not data then + report_tasks("unknown task %s",name) + else + return data + end +end + +local function validgroup(name,group,what) + local data = tasksdata[name] + if not data then + report_tasks("unknown task %s",name) + else + local frozen = data.frozen[group] + if frozen then + if frozengroup == "no" then + -- default + elseif frozengroup == "strict" then + report_tasks("warning: group %s of task %s is frozen, %s applied but not supported",group,name,what) + return + else -- if frozengroup == "tolerant" then + report_tasks("warning: group %s of task %s is frozen, %s ignored",group,name,what) + end + end + return data + end +end + +function tasks.freezegroup(name,group) + local data = valid(name) + if data then + data.frozen[group] = true end end function tasks.restart(name) - local data = tasks.data[name] + local data = valid(name) if data then data.runner = false end end function tasks.enableaction(name,action) - local data = tasks.data[name] + local data = valid(name) if data then - sequencer.enableaction(data.list,action) + sequencers.enableaction(data.list,action) data.runner = false end end function tasks.disableaction(name,action) - local data = tasks.data[name] + local data = valid(name) if data then - sequencer.disableaction(data.list,action) + sequencers.disableaction(data.list,action) data.runner = false end end function tasks.enablegroup(name,group) - local data = tasks.data[name] + local data = validgroup(name,"enable group") if data then - sequencer.enablegroup(data.list,group) + sequencers.enablegroup(data.list,group) data.runner = false end end function tasks.disablegroup(name,group) - local data = tasks.data[name] + local data = validgroup(name,"disable group") if data then - sequencer.disablegroup(data.list,group) + sequencers.disablegroup(data.list,group) data.runner = false end end function tasks.appendaction(name,group,action,where,kind) - local data = tasks.data[name] + local data = validgroup(name,"append action") if data then - sequencer.appendaction(data.list,group,action,where,kind) + sequencers.appendaction(data.list,group,action,where,kind) data.runner = false end end function tasks.prependaction(name,group,action,where,kind) - local data = tasks.data[name] + local data = validgroup(name,"prepend action") if data then - sequencer.prependaction(data.list,group,action,where,kind) + sequencers.prependaction(data.list,group,action,where,kind) data.runner = false end end function tasks.removeaction(name,group,action) - local data = tasks.data[name] + local data = validgroup(name,"remove action") if data then - sequencer.removeaction(data.list,group,action) + sequencers.removeaction(data.list,group,action) data.runner = false end end function tasks.showactions(name,group,action,where,kind) - local data = tasks.data[name] + local data = valid(name) if data then - logs.report("nodes","task %s, list:\n%s",name,sequencer.nodeprocessor(data.list)) + report_tasks("task %s, list:\n%s",name,sequencers.nodeprocessor(data.list)) end end @@ -100,25 +165,26 @@ local created, total = 0, 0 statistics.register("node list callback tasks", function() if total > 0 then - return string.format("%s unique task lists, %s instances (re)created, %s calls",table.count(tasks.data),created,total) + return string.format("%s unique task lists, %s instances (re)created, %s calls",table.count(tasksdata),created,total) else return nil end end) -local compile, nodeprocessor = sequencer.compile, sequencer.nodeprocessor +local compile, nodeprocessor = sequencers.compile, sequencers.nodeprocessor -function tasks.actions(name,n) -- we optimize for the number or arguments (no ...) - local data = tasks.data[name] +function tasks.actions(name) -- we optimize for the number or arguments (no ...) + local data = tasksdata[name] if data then + local n = data.arguments or 0 if n == 0 then return function(head) - local runner = data.runner total = total + 1 -- will go away + local runner = data.runner if not runner then created = created + 1 if trace_tasks then - logs.report("nodes","creating task runner '%s'",name) + report_tasks("creating runner '%s'",name) end runner = compile(data.list,nodeprocessor,0) data.runner = runner @@ -132,7 +198,7 @@ function tasks.actions(name,n) -- we optimize for the number or arguments (no .. if not runner then created = created + 1 if trace_tasks then - logs.report("nodes","creating task runner '%s' with 1 extra arguments",name) + report_tasks("creating runner '%s' with 1 extra arguments",name) end runner = compile(data.list,nodeprocessor,1) data.runner = runner @@ -146,7 +212,7 @@ function tasks.actions(name,n) -- we optimize for the number or arguments (no .. if not runner then created = created + 1 if trace_tasks then - logs.report("nodes","creating task runner '%s' with 2 extra arguments",name) + report_tasks("creating runner '%s' with 2 extra arguments",name) end runner = compile(data.list,nodeprocessor,2) data.runner = runner @@ -160,7 +226,7 @@ function tasks.actions(name,n) -- we optimize for the number or arguments (no .. if not runner then created = created + 1 if trace_tasks then - logs.report("nodes","creating task runner '%s' with 3 extra arguments",name) + report_tasks("creating runner '%s' with 3 extra arguments",name) end runner = compile(data.list,nodeprocessor,3) data.runner = runner @@ -174,7 +240,7 @@ function tasks.actions(name,n) -- we optimize for the number or arguments (no .. if not runner then created = created + 1 if trace_tasks then - logs.report("nodes","creating task runner '%s' with 4 extra arguments",name) + report_tasks("creating runner '%s' with 4 extra arguments",name) end runner = compile(data.list,nodeprocessor,4) data.runner = runner @@ -188,7 +254,7 @@ function tasks.actions(name,n) -- we optimize for the number or arguments (no .. if not runner then created = created + 1 if trace_tasks then - logs.report("nodes","creating task runner '%s' with 5 extra arguments",name) + report_tasks("creating runner '%s' with 5 extra arguments",name) end runner = compile(data.list,nodeprocessor,5) data.runner = runner @@ -202,7 +268,7 @@ function tasks.actions(name,n) -- we optimize for the number or arguments (no .. if not runner then created = created + 1 if trace_tasks then - logs.report("nodes","creating task runner '%s' with n extra arguments",name) + report_tasks("creating runner '%s' with n extra arguments",name) end runner = compile(data.list,nodeprocessor,"n") data.runner = runner @@ -216,7 +282,7 @@ function tasks.actions(name,n) -- we optimize for the number or arguments (no .. end function tasks.table(name) --maybe move this to task-deb.lua - local tsk = tasks.data[name] + local tsk = tasksdata[name] local lst = tsk and tsk.list local HL, NC, NR, bold, type = context.HL, context.NC, context.NR, context.bold, context.type if lst then @@ -242,9 +308,12 @@ function tasks.table(name) --maybe move this to task-deb.lua end end -tasks.new ( - "processors", - { +-- this will move + +tasks.new { + name = "processors", + arguments = 4, + sequence = { "before", -- for users "normalizers", "characters", @@ -253,11 +322,12 @@ tasks.new ( "lists", "after", -- for users } -) +} -tasks.new ( - "finalizers", - { +tasks.new { + name = "finalizers", + arguments = 1, + sequence = { "before", -- for users "normalizers", -- "characters", @@ -266,50 +336,55 @@ tasks.new ( "lists", "after", -- for users } -) +} -tasks.new ( - "shipouts", - { +tasks.new { + name = "shipouts", + arguments = 0, + sequence = { "before", -- for users "normalizers", "finishers", "after", -- for users } -) +} -tasks.new ( - "mvlbuilders", - { +tasks.new { + name = "mvlbuilders", + arguments = 1, + sequence = { "before", -- for users "normalizers", "after", -- for users } -) +} -tasks.new ( - "vboxbuilders", - { +tasks.new { + name = "vboxbuilders", + arguments = 5, + sequence = { "before", -- for users "normalizers", "after", -- for users } -) +} ---~ tasks.new ( ---~ "parbuilders", ---~ { +--~ tasks.new { +--~ name = "parbuilders", +--~ arguments = 1, +--~ sequence = { --~ "before", -- for users --~ "lists", --~ "after", -- for users --~ } ---~ ) +--~ } ---~ tasks.new ( ---~ "pagebuilders", ---~ { +--~ tasks.new { +--~ name = "pagebuilders", +--~ arguments = 5, +--~ sequence = { --~ "before", -- for users --~ "lists", --~ "after", -- for users --~ } ---~ ) +--~ } diff --git a/Master/texmf-dist/tex/context/base/node-tst.lua b/Master/texmf-dist/tex/context/base/node-tst.lua index d7ea96f26d9..bfe0051bdfd 100644 --- a/Master/texmf-dist/tex/context/base/node-tst.lua +++ b/Master/texmf-dist/tex/context/base/node-tst.lua @@ -6,29 +6,34 @@ if not modules then modules = { } end modules ['node-tst'] = { license = "see context related readme files" } -local glue = node.id("glue") -local penalty = node.id("penalty") -local kern = node.id("kern") -local glyph = node.id("glyph") -local whatsit = node.id("whatsit") -local hlist = node.id("hlist") +local nodes, node = nodes, node -local find_node_tail = node.tail or node.slide +local chardata = characters.data +local nodecodes = nodes.nodecodes +local skipcodes = nodes.skipcodes -local chardata = characters.data +local glue_code = nodecodes.glue +local penalty_code = nodecodes.penalty +local kern_code = nodecodes.kern +local glyph_code = nodecodes.glyph +local whatsit_code = nodecodes.whatsit +local hlist_code = nodecodes.hlist -function nodes.the_left_margin(n) -- todo: three values +local leftskip_code = skipcodes.leftskip +local rightskip_code = skipcodes.rightskip +local abovedisplayshortskip_code = skipcodes.abovedisplayshortskip +local belowdisplayshortskip_code = skipcodes.belowdisplayshortskip + +local find_node_tail = node.tail or node.slide + +function nodes.leftmarginwidth(n) -- todo: three values while n do local id = n.id - if id == glue then - if n.subtype == 8 then -- 7 in c/web source - return n.spec.width - else - return 0 - end - elseif id == whatsit then + if id == glue_code then + return n.subtype == leftskip_code and n.spec.width or 0 + elseif id == whatsit_code then n = n.next - elseif id == hlist then + elseif id == hlist_code then return n.width else break @@ -37,18 +42,14 @@ function nodes.the_left_margin(n) -- todo: three values return 0 end -function nodes.the_right_margin(n) +function nodes.rightmarginwidth(n) if n then n = find_node_tail(n) while n do local id = n.id - if id == glue then - if n.subtype == 9 then -- 8 in the c/web source - return n.spec.width - else - return 0 - end - elseif id == whatsit then + if id == glue_code then + return n.subtype == rightskip_code and n.spec.width or 0 + elseif id == whatsit_code then n = n.prev else break @@ -61,14 +62,14 @@ end function nodes.somespace(n,all) if n then local id = n.id - if id == glue then - return (all or (n.spec.width ~= 0)) and glue - elseif id == kern then + if id == glue_code then + return (all or (n.spec.width ~= 0)) and glue_code + elseif id == kern_code then return (all or (n.kern ~= 0)) and kern - elseif id == glyph then + elseif id == glyph_code then local category = chardata[n.char].category -- maybe more category checks are needed - return (category == "zs") and glyph + return (category == "zs") and glyph_code end end return false @@ -77,7 +78,7 @@ end function nodes.somepenalty(n,value) if n then local id = n.id - if id == penalty then + if id == penalty_code then if value then return n.penalty == value else @@ -92,9 +93,9 @@ function nodes.is_display_math(head) local n = head.prev while n do local id = n.id - if id == penalty then - elseif id == glue then - if n.subtype == 6 then -- above_display_short_skip + if id == penalty_code then + elseif id == glue_code then + if n.subtype == abovedisplayshortskip_code then return true end else @@ -105,9 +106,9 @@ function nodes.is_display_math(head) n = head.next while n do local id = n.id - if id == penalty then - elseif id == glue then - if n.subtype == 7 then -- below_display_short_skip + if id == penalty_code then + elseif id == glue_code then + if n.subtype == belowdisplayshortskip_code then return true end else diff --git a/Master/texmf-dist/tex/context/base/node-typ.lua b/Master/texmf-dist/tex/context/base/node-typ.lua index 5ab6b6975f4..684fc94ba6f 100644 --- a/Master/texmf-dist/tex/context/base/node-typ.lua +++ b/Master/texmf-dist/tex/context/base/node-typ.lua @@ -6,22 +6,25 @@ if not modules then modules = { } end modules ['node-typ'] = { license = "see context related readme files" } --- this will be replaced by blob-ini cum suis so typesetting will go away +-- this will be replaced by blob-ini cum suis so typesetters will go away local utfvalues = string.utfvalues -local newglyph = nodes.glyph -local newglue = nodes.glue +local hpack = node.hpack +local vpack = node.vpack -local hpack, vpack = node.hpack, node.vpack +local nodepool = nodes.pool -typesetting = typesetting or { } +local new_glyph = nodepool.glyph +local new_glue = nodepool.glue + +typesetters = typesetters or { } local function tonodes(str,fontid,spacing) -- don't use this local head, prev = nil, nil for s in utfvalues(str) do local next - if spacing and s == 32 then + if spacing and s == 32 then next = newglue(spacing or 64*1024*10) else next = newglyph(fontid or 1,s) @@ -37,17 +40,17 @@ local function tonodes(str,fontid,spacing) -- don't use this return head end -typesetting.tonodes = tonodes +typesetters.tonodes = tonodes -function typesetting.hpack(str,fontid,spacing) +function typesetters.hpack(str,fontid,spacing) return hpack(tonodes(str,fontid,spacing)) end -function typesetting.vpack(str,fontid,spacing) +function typesetters.vpack(str,fontid,spacing) -- vpack is just a hack, and a proper implentation is on the agenda -- as it needs more info etc than currently available return vpack(tonodes(str,fontid,spacing)) end ---~ node.write(typesetting.hpack("Hello World!")) ---~ node.write(typesetting.hpack("Hello World!",1,100*1024*10)) +--~ node.write(typesetters.hpack("Hello World!")) +--~ node.write(typesetters.hpack("Hello World!",1,100*1024*10)) diff --git a/Master/texmf-dist/tex/context/base/norm-alo.mkii b/Master/texmf-dist/tex/context/base/norm-alo.mkii new file mode 100644 index 00000000000..d47f49037d7 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/norm-alo.mkii @@ -0,0 +1,36 @@ +%D \module +%D [ file=norm-alo, +%D version=2009.03.19, +%D title=\CONTEXT\ Norm Macros, +%D subtitle=\ALEPH\ and \OMEGA, +%D author=Hans Hagen, +%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 This file will become obsolete! + +% omega primitives + +\let\textdir = \textdir +\let\pagedir = \pagedir +\let\mathdir = \mathdir +\let\pardir = \pardir +\let\bodydir = \bodydir +\let\leftghost = \leftghost +\let\rightghost = \rightghost +\let\localleftbox = \localleftbox +\let\localrightbox = \localrightbox +\let\localinterlinepenalty = \localinterlinepenalty +\let\localbrokenpenalty = \localbrokenpenalty + +% aleph primitives + +\let\boxdir = \boxdir +\let\pagebottomoffset = \pagebottomoffset +\let\pagerightoffset = \pagerightoffset + +\endinput diff --git a/Master/texmf-dist/tex/context/base/norm-alo.tex b/Master/texmf-dist/tex/context/base/norm-alo.tex deleted file mode 100644 index d47f49037d7..00000000000 --- a/Master/texmf-dist/tex/context/base/norm-alo.tex +++ /dev/null @@ -1,36 +0,0 @@ -%D \module -%D [ file=norm-alo, -%D version=2009.03.19, -%D title=\CONTEXT\ Norm Macros, -%D subtitle=\ALEPH\ and \OMEGA, -%D author=Hans Hagen, -%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 This file will become obsolete! - -% omega primitives - -\let\textdir = \textdir -\let\pagedir = \pagedir -\let\mathdir = \mathdir -\let\pardir = \pardir -\let\bodydir = \bodydir -\let\leftghost = \leftghost -\let\rightghost = \rightghost -\let\localleftbox = \localleftbox -\let\localrightbox = \localrightbox -\let\localinterlinepenalty = \localinterlinepenalty -\let\localbrokenpenalty = \localbrokenpenalty - -% aleph primitives - -\let\boxdir = \boxdir -\let\pagebottomoffset = \pagebottomoffset -\let\pagerightoffset = \pagerightoffset - -\endinput diff --git a/Master/texmf-dist/tex/context/base/norm-ctx.mkii b/Master/texmf-dist/tex/context/base/norm-ctx.mkii new file mode 100644 index 00000000000..707705d89eb --- /dev/null +++ b/Master/texmf-dist/tex/context/base/norm-ctx.mkii @@ -0,0 +1,16 @@ +%D \module +%D [ file=norm-ctx, +%D version=2009.03.19, +%D title=\CONTEXT\ Norm Macros, +%D subtitle=\ALEPH\ and \OMEGA, +%D author=Hans Hagen, +%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 A few more might end up here (like the weird ones in syst-ini). + +\let\normalreqno = \normaleqno diff --git a/Master/texmf-dist/tex/context/base/norm-ctx.mkiv b/Master/texmf-dist/tex/context/base/norm-ctx.mkiv new file mode 100644 index 00000000000..707705d89eb --- /dev/null +++ b/Master/texmf-dist/tex/context/base/norm-ctx.mkiv @@ -0,0 +1,16 @@ +%D \module +%D [ file=norm-ctx, +%D version=2009.03.19, +%D title=\CONTEXT\ Norm Macros, +%D subtitle=\ALEPH\ and \OMEGA, +%D author=Hans Hagen, +%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 A few more might end up here (like the weird ones in syst-ini). + +\let\normalreqno = \normaleqno diff --git a/Master/texmf-dist/tex/context/base/norm-ctx.tex b/Master/texmf-dist/tex/context/base/norm-ctx.tex deleted file mode 100644 index 707705d89eb..00000000000 --- a/Master/texmf-dist/tex/context/base/norm-ctx.tex +++ /dev/null @@ -1,16 +0,0 @@ -%D \module -%D [ file=norm-ctx, -%D version=2009.03.19, -%D title=\CONTEXT\ Norm Macros, -%D subtitle=\ALEPH\ and \OMEGA, -%D author=Hans Hagen, -%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 A few more might end up here (like the weird ones in syst-ini). - -\let\normalreqno = \normaleqno diff --git a/Master/texmf-dist/tex/context/base/norm-etx.mkii b/Master/texmf-dist/tex/context/base/norm-etx.mkii new file mode 100644 index 00000000000..3edd8e7ef1f --- /dev/null +++ b/Master/texmf-dist/tex/context/base/norm-etx.mkii @@ -0,0 +1,79 @@ +%D \module +%D [ file=norm-etx, +%D version=2009.03.19, +%D title=\CONTEXT\ Norm Macros, +%D subtitle=\ETEX, +%D author=Hans Hagen, +%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. + +% etex primitives + +\let \normalbotmarks = \botmarks +\let \normalclubpenalties = \clubpenalties +\let \normalcurrentgrouplevel = \currentgrouplevel +\let \normalcurrentgrouptype = \currentgrouptype +\let \normalcurrentifbranch = \currentifbranch +\let \normalcurrentiflevel = \currentiflevel +\let \normalcurrentiftype = \currentiftype +\let \normaldetokenize = \detokenize +\let \normaldimexpr = \dimexpr +\let \normaldisplaywidowpenalties = \displaywidowpenalties +\let \normaleTeXVersion = \eTeXVersion +\let \normaleTeXminorversion = \eTeXminorversion +\let \normaleTeXrevision = \eTeXrevision +\let \normaleTeXversion = \eTeXversion +\let \normaleveryeof = \everyeof +\let \normalfirstmarks = \firstmarks +\let \normalfontchardp = \fontchardp +\let \normalfontcharht = \fontcharht +\let \normalfontcharic = \fontcharic +\let \normalfontcharwd = \fontcharwd +\let \normalglueexpr = \glueexpr +\let \normalglueshrink = \glueshrink +\let \normalglueshrinkorder = \glueshrinkorder +\let \normalgluestretch = \gluestretch +\let \normalgluestretchorder = \gluestretchorder +\let \normalgluetomu = \gluetomu +\let \normalifcsname = \ifcsname +\let \normalifdefined = \ifdefined +\let \normaliffontchar = \iffontchar +\let \normalinteractionmode = \interactionmode +\let \normalinterlinepenalties = \interlinepenalties +\let \normallastlinefit = \lastlinefit +\let \normallastnodetype = \lastnodetype +\let \normalmarks = \marks +\let \normalmuexpr = \muexpr +\let \normalmutoglue = \mutoglue +\let \normalnumexpr = \numexpr +\let \normalpagediscards = \pagediscards +\let \normalparshapedimen = \parshapedimen +\let \normalparshapeindent = \parshapeindent +\let \normalparshapelength = \parshapelength +\let \normalpredisplaydirection = \predisplaydirection +\let \normalprotected = \protected +\let \normalreadline = \readline +\let \normalsavinghyphcodes = \savinghyphcodes +\let \normalsavingvdiscards = \savingvdiscards +\let \normalscantokens = \scantokens +\let \normalshowgroups = \showgroups +\let \normalshowifs = \showifs +\let \normalshowtokens = \showtokens +\let \normalsplitbotmarks = \splitbotmarks +\let \normalsplitdiscards = \splitdiscards +\let \normalsplitfirstmarks = \splitfirstmarks +\let \normaltopmarks = \topmarks +\let \normaltracingassigns = \tracingassigns +\let \normaltracinggroups = \tracinggroups +\let \normaltracingifs = \tracingifs +\let \normaltracingnesting = \tracingnesting +\let \normaltracingscantokens = \tracingscantokens +\let \normalunexpanded = \unexpanded +\let \normalunless = \unless +\let \normalwidowpenalties = \widowpenalties + +\endinput diff --git a/Master/texmf-dist/tex/context/base/norm-etx.tex b/Master/texmf-dist/tex/context/base/norm-etx.tex deleted file mode 100644 index 3edd8e7ef1f..00000000000 --- a/Master/texmf-dist/tex/context/base/norm-etx.tex +++ /dev/null @@ -1,79 +0,0 @@ -%D \module -%D [ file=norm-etx, -%D version=2009.03.19, -%D title=\CONTEXT\ Norm Macros, -%D subtitle=\ETEX, -%D author=Hans Hagen, -%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. - -% etex primitives - -\let \normalbotmarks = \botmarks -\let \normalclubpenalties = \clubpenalties -\let \normalcurrentgrouplevel = \currentgrouplevel -\let \normalcurrentgrouptype = \currentgrouptype -\let \normalcurrentifbranch = \currentifbranch -\let \normalcurrentiflevel = \currentiflevel -\let \normalcurrentiftype = \currentiftype -\let \normaldetokenize = \detokenize -\let \normaldimexpr = \dimexpr -\let \normaldisplaywidowpenalties = \displaywidowpenalties -\let \normaleTeXVersion = \eTeXVersion -\let \normaleTeXminorversion = \eTeXminorversion -\let \normaleTeXrevision = \eTeXrevision -\let \normaleTeXversion = \eTeXversion -\let \normaleveryeof = \everyeof -\let \normalfirstmarks = \firstmarks -\let \normalfontchardp = \fontchardp -\let \normalfontcharht = \fontcharht -\let \normalfontcharic = \fontcharic -\let \normalfontcharwd = \fontcharwd -\let \normalglueexpr = \glueexpr -\let \normalglueshrink = \glueshrink -\let \normalglueshrinkorder = \glueshrinkorder -\let \normalgluestretch = \gluestretch -\let \normalgluestretchorder = \gluestretchorder -\let \normalgluetomu = \gluetomu -\let \normalifcsname = \ifcsname -\let \normalifdefined = \ifdefined -\let \normaliffontchar = \iffontchar -\let \normalinteractionmode = \interactionmode -\let \normalinterlinepenalties = \interlinepenalties -\let \normallastlinefit = \lastlinefit -\let \normallastnodetype = \lastnodetype -\let \normalmarks = \marks -\let \normalmuexpr = \muexpr -\let \normalmutoglue = \mutoglue -\let \normalnumexpr = \numexpr -\let \normalpagediscards = \pagediscards -\let \normalparshapedimen = \parshapedimen -\let \normalparshapeindent = \parshapeindent -\let \normalparshapelength = \parshapelength -\let \normalpredisplaydirection = \predisplaydirection -\let \normalprotected = \protected -\let \normalreadline = \readline -\let \normalsavinghyphcodes = \savinghyphcodes -\let \normalsavingvdiscards = \savingvdiscards -\let \normalscantokens = \scantokens -\let \normalshowgroups = \showgroups -\let \normalshowifs = \showifs -\let \normalshowtokens = \showtokens -\let \normalsplitbotmarks = \splitbotmarks -\let \normalsplitdiscards = \splitdiscards -\let \normalsplitfirstmarks = \splitfirstmarks -\let \normaltopmarks = \topmarks -\let \normaltracingassigns = \tracingassigns -\let \normaltracinggroups = \tracinggroups -\let \normaltracingifs = \tracingifs -\let \normaltracingnesting = \tracingnesting -\let \normaltracingscantokens = \tracingscantokens -\let \normalunexpanded = \unexpanded -\let \normalunless = \unless -\let \normalwidowpenalties = \widowpenalties - -\endinput diff --git a/Master/texmf-dist/tex/context/base/norm-ltx.mkii b/Master/texmf-dist/tex/context/base/norm-ltx.mkii new file mode 100644 index 00000000000..a779735dd53 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/norm-ltx.mkii @@ -0,0 +1,177 @@ +%D \module +%D [ file=norm-ltx, +%D version=2009.03.19, +%D title=\CONTEXT\ Norm Macros, +%D subtitle=\LUATEX, +%D author=Hans Hagen, +%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 This file will become obsolete! + +% luatex primitives (incomplete) + +\let \normalUdelcode = \Udelcode +\let \normalUdelcodenum = \Udelcodenum +\let \normalUdelimiter = \Udelimiter +\let \normalUmathaccent = \Umathaccent +\let \normalUmathaccents = \Umathaccents +\let \normalUmathaxis = \Umathaxis +\let \normalUmathbinbinspacing = \Umathbinbinspacing +\let \normalUmathbinclosespacing = \Umathbinclosespacing +\let \normalUmathbininnerspacing = \Umathbininnerspacing +\let \normalUmathbinopenspacing = \Umathbinopenspacing +\let \normalUmathbinopspacing = \Umathbinopspacing +\let \normalUmathbinordspacing = \Umathbinordspacing +\let \normalUmathbinpunctspacing = \Umathbinpunctspacing +\let \normalUmathbinrelspacing = \Umathbinrelspacing +\let \normalUmathbotaccent = \Umathbotaccent +\let \normalUmathchar = \Umathchar +\let \normalUmathchardef = \Umathchardef +\let \normalUmathcharnum = \Umathcharnum +\let \normalUmathclosebinspacing = \Umathclosebinspacing +\let \normalUmathcloseclosespacing = \Umathcloseclosespacing +\let \normalUmathcloseinnerspacing = \Umathcloseinnerspacing +\let \normalUmathcloseopenspacing = \Umathcloseopenspacing +\let \normalUmathcloseopspacing = \Umathcloseopspacing +\let \normalUmathcloseordspacing = \Umathcloseordspacing +\let \normalUmathclosepunctspacing = \Umathclosepunctspacing +\let \normalUmathcloserelspacing = \Umathcloserelspacing +\let \normalUmathcode = \Umathcode +\let \normalUmathcodenum = \Umathcodenum +\let \normalUmathconnectoroverlapmin = \Umathconnectoroverlapmin +\let \normalUmathfractiondelsize = \Umathfractiondelsize +\let \normalUmathfractiondenomdown = \Umathfractiondenomdown +\let \normalUmathfractiondenomvgap = \Umathfractiondenomvgap +\let \normalUmathfractionnumup = \Umathfractionnumup +\let \normalUmathfractionnumvgap = \Umathfractionnumvgap +\let \normalUmathfractionrule = \Umathfractionrule +\let \normalUmathinnerbinspacing = \Umathinnerbinspacing +\let \normalUmathinnerclosespacing = \Umathinnerclosespacing +\let \normalUmathinnerinnerspacing = \Umathinnerinnerspacing +\let \normalUmathinneropenspacing = \Umathinneropenspacing +\let \normalUmathinneropspacing = \Umathinneropspacing +\let \normalUmathinnerordspacing = \Umathinnerordspacing +\let \normalUmathinnerpunctspacing = \Umathinnerpunctspacing +\let \normalUmathinnerrelspacing = \Umathinnerrelspacing +\let \normalUmathlimitabovebgap = \Umathlimitabovebgap +\let \normalUmathlimitabovekern = \Umathlimitabovekern +\let \normalUmathlimitabovevgap = \Umathlimitabovevgap +\let \normalUmathlimitdownbgap = \Umathlimitdownbgap +\let \normalUmathlimitdownkern = \Umathlimitdownkern +\let \normalUmathlimitdownvgap = \Umathlimitdownvgap +\let \normalUmathopbinspacing = \Umathopbinspacing +\let \normalUmathopclosespacing = \Umathopclosespacing +\let \normalUmathopenbinspacing = \Umathopenbinspacing +\let \normalUmathopenclosespacing = \Umathopenclosespacing +\let \normalUmathopeninnerspacing = \Umathopeninnerspacing +\let \normalUmathopenopenspacing = \Umathopenopenspacing +\let \normalUmathopenopspacing = \Umathopenopspacing +\let \normalUmathopenordspacing = \Umathopenordspacing +\let \normalUmathopenpunctspacing = \Umathopenpunctspacing +\let \normalUmathopenrelspacing = \Umathopenrelspacing +\let \normalUmathoperatorsize = \Umathoperatorsize +\let \normalUmathopinnerspacing = \Umathopinnerspacing +\let \normalUmathopopenspacing = \Umathopopenspacing +\let \normalUmathopopspacing = \Umathopopspacing +\let \normalUmathopordspacing = \Umathopordspacing +\let \normalUmathoppunctspacing = \Umathoppunctspacing +\let \normalUmathoprelspacing = \Umathoprelspacing +\let \normalUmathordbinspacing = \Umathordbinspacing +\let \normalUmathordclosespacing = \Umathordclosespacing +\let \normalUmathordinnerspacing = \Umathordinnerspacing +\let \normalUmathordopenspacing = \Umathordopenspacing +\let \normalUmathordopspacing = \Umathordopspacing +\let \normalUmathordordspacing = \Umathordordspacing +\let \normalUmathordpunctspacing = \Umathordpunctspacing +\let \normalUmathordrelspacing = \Umathordrelspacing +\let \normalUmathoverbarkern = \Umathoverbarkern +\let \normalUmathoverbarrule = \Umathoverbarrule +\let \normalUmathoverbarvgap = \Umathoverbarvgap +\let \normalUmathoverdelimiterbgap = \Umathoverdelimiterbgap +\let \normalUmathoverdelimitervgap = \Umathoverdelimitervgap +\let \normalUmathpunctbinspacing = \Umathpunctbinspacing +\let \normalUmathpunctclosespacing = \Umathpunctclosespacing +\let \normalUmathpunctinnerspacing = \Umathpunctinnerspacing +\let \normalUmathpunctopenspacing = \Umathpunctopenspacing +\let \normalUmathpunctopspacing = \Umathpunctopspacing +\let \normalUmathpunctordspacing = \Umathpunctordspacing +\let \normalUmathpunctpunctspacing = \Umathpunctpunctspacing +\let \normalUmathpunctrelspacing = \Umathpunctrelspacing +\let \normalUmathquad = \Umathquad +\let \normalUmathradicaldegreeafter = \Umathradicaldegreeafter +\let \normalUmathradicaldegreebefore = \Umathradicaldegreebefore +\let \normalUmathradicaldegreeraise = \Umathradicaldegreeraise +\let \normalUmathradicalkern = \Umathradicalkern +\let \normalUmathradicalrule = \Umathradicalrule +\let \normalUmathradicalvgap = \Umathradicalvgap +\let \normalUmathrelbinspacing = \Umathrelbinspacing +\let \normalUmathrelclosespacing = \Umathrelclosespacing +\let \normalUmathrelinnerspacing = \Umathrelinnerspacing +\let \normalUmathrelopenspacing = \Umathrelopenspacing +\let \normalUmathrelopspacing = \Umathrelopspacing +\let \normalUmathrelordspacing = \Umathrelordspacing +\let \normalUmathrelpunctspacing = \Umathrelpunctspacing +\let \normalUmathrelrelspacing = \Umathrelrelspacing +\let \normalUmathspaceafterscript = \Umathspaceafterscript +\let \normalUmathstackdenomdown = \Umathstackdenomdown +\let \normalUmathstacknumup = \Umathstacknumup +\let \normalUmathstackvgap = \Umathstackvgap +\let \normalUmathsubshiftdown = \Umathsubshiftdown +\let \normalUmathsubshiftdrop = \Umathsubshiftdrop +\let \normalUmathsubsupshiftdown = \Umathsubsupshiftdown +\let \normalUmathsubsupvgap = \Umathsubsupvgap +\let \normalUmathsubtopmax = \Umathsubtopmax +\let \normalUmathsupbottommin = \Umathsupbottommin +\let \normalUmathsupshiftdrop = \Umathsupshiftdrop +\let \normalUmathsupshiftup = \Umathsupshiftup +\let \normalUmathsupsubbottommax = \Umathsupsubbottommax +\let \normalUmathunderbarkern = \Umathunderbarkern +\let \normalUmathunderbarrule = \Umathunderbarrule +\let \normalUmathunderbarvgap = \Umathunderbarvgap +\let \normalUmathunderdelimiterbgap = \Umathunderdelimiterbgap +\let \normalUmathunderdelimitervgap = \Umathunderdelimitervgap +\let \normalUoverdelimiter = \Uoverdelimiter +\let \normalUradical = \Uradical +\let \normalUroot = \Uroot +\let \normalUunderdelimiter = \Uunderdelimiter +\let \normalattribute = \attribute +\let \normalattributedef = \attributedef +\let \normalcatcodetable = \catcodetable +\let \normalclearmarks = \clearmarks +\let \normalcrampeddisplaystyle = \crampeddisplaystyle +\let \normalcrampedscriptscriptstyle = \crampedscriptscriptstyle +\let \normalcrampedscriptstyle = \crampedscriptstyle +\let \normalcrampedtextstyle = \crampedtextstyle +\let \normalformatname = \formatname +\let \normalifabsdim = \ifabsdim +\let \normalifabsnum = \ifabsnum +\let \normalifprimitive = \ifprimitive +\let \normalinitcatcodetable = \initcatcodetable +\let \normallatelua = \latelua +\let \normalluaescapestring = \luaescapestring +\let \normalluastartup = \luastartup +\let \normalluatexdatestamp = \luatexdatestamp +\let \normalluatexrevision = \luatexrevision +\let \normalluatexversion = \luatexversion +\let \normalnokerns = \nokerns +\let \normalnoligs = \noligs +\let \normalpageleftoffset = \pageleftoffset +\let \normalpagetopoffset = \pagetopoffset +\let \normalpostexhyphenchar = \postexhyphenchar +\let \normalposthyphenchar = \posthyphenchar +\let \normalpreexhyphenchar = \preexhyphenchar +\let \normalprehyphenchar = \prehyphenchar +\let \normalprimitive = \primitive +\let \normalsavecatcodetable = \savecatcodetable +\let \normalscantextokens = \scantextokens +\let \normalsuppressfontnotfounderror = \suppressfontnotfounderror +\let \normalsuppressifcsnameerror = \suppressifcsnameerror +\let \normalsuppresslongerror = \suppresslongerror +\let \normalsynctex = \synctex + +\endinput diff --git a/Master/texmf-dist/tex/context/base/norm-ltx.tex b/Master/texmf-dist/tex/context/base/norm-ltx.tex deleted file mode 100644 index a779735dd53..00000000000 --- a/Master/texmf-dist/tex/context/base/norm-ltx.tex +++ /dev/null @@ -1,177 +0,0 @@ -%D \module -%D [ file=norm-ltx, -%D version=2009.03.19, -%D title=\CONTEXT\ Norm Macros, -%D subtitle=\LUATEX, -%D author=Hans Hagen, -%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 This file will become obsolete! - -% luatex primitives (incomplete) - -\let \normalUdelcode = \Udelcode -\let \normalUdelcodenum = \Udelcodenum -\let \normalUdelimiter = \Udelimiter -\let \normalUmathaccent = \Umathaccent -\let \normalUmathaccents = \Umathaccents -\let \normalUmathaxis = \Umathaxis -\let \normalUmathbinbinspacing = \Umathbinbinspacing -\let \normalUmathbinclosespacing = \Umathbinclosespacing -\let \normalUmathbininnerspacing = \Umathbininnerspacing -\let \normalUmathbinopenspacing = \Umathbinopenspacing -\let \normalUmathbinopspacing = \Umathbinopspacing -\let \normalUmathbinordspacing = \Umathbinordspacing -\let \normalUmathbinpunctspacing = \Umathbinpunctspacing -\let \normalUmathbinrelspacing = \Umathbinrelspacing -\let \normalUmathbotaccent = \Umathbotaccent -\let \normalUmathchar = \Umathchar -\let \normalUmathchardef = \Umathchardef -\let \normalUmathcharnum = \Umathcharnum -\let \normalUmathclosebinspacing = \Umathclosebinspacing -\let \normalUmathcloseclosespacing = \Umathcloseclosespacing -\let \normalUmathcloseinnerspacing = \Umathcloseinnerspacing -\let \normalUmathcloseopenspacing = \Umathcloseopenspacing -\let \normalUmathcloseopspacing = \Umathcloseopspacing -\let \normalUmathcloseordspacing = \Umathcloseordspacing -\let \normalUmathclosepunctspacing = \Umathclosepunctspacing -\let \normalUmathcloserelspacing = \Umathcloserelspacing -\let \normalUmathcode = \Umathcode -\let \normalUmathcodenum = \Umathcodenum -\let \normalUmathconnectoroverlapmin = \Umathconnectoroverlapmin -\let \normalUmathfractiondelsize = \Umathfractiondelsize -\let \normalUmathfractiondenomdown = \Umathfractiondenomdown -\let \normalUmathfractiondenomvgap = \Umathfractiondenomvgap -\let \normalUmathfractionnumup = \Umathfractionnumup -\let \normalUmathfractionnumvgap = \Umathfractionnumvgap -\let \normalUmathfractionrule = \Umathfractionrule -\let \normalUmathinnerbinspacing = \Umathinnerbinspacing -\let \normalUmathinnerclosespacing = \Umathinnerclosespacing -\let \normalUmathinnerinnerspacing = \Umathinnerinnerspacing -\let \normalUmathinneropenspacing = \Umathinneropenspacing -\let \normalUmathinneropspacing = \Umathinneropspacing -\let \normalUmathinnerordspacing = \Umathinnerordspacing -\let \normalUmathinnerpunctspacing = \Umathinnerpunctspacing -\let \normalUmathinnerrelspacing = \Umathinnerrelspacing -\let \normalUmathlimitabovebgap = \Umathlimitabovebgap -\let \normalUmathlimitabovekern = \Umathlimitabovekern -\let \normalUmathlimitabovevgap = \Umathlimitabovevgap -\let \normalUmathlimitdownbgap = \Umathlimitdownbgap -\let \normalUmathlimitdownkern = \Umathlimitdownkern -\let \normalUmathlimitdownvgap = \Umathlimitdownvgap -\let \normalUmathopbinspacing = \Umathopbinspacing -\let \normalUmathopclosespacing = \Umathopclosespacing -\let \normalUmathopenbinspacing = \Umathopenbinspacing -\let \normalUmathopenclosespacing = \Umathopenclosespacing -\let \normalUmathopeninnerspacing = \Umathopeninnerspacing -\let \normalUmathopenopenspacing = \Umathopenopenspacing -\let \normalUmathopenopspacing = \Umathopenopspacing -\let \normalUmathopenordspacing = \Umathopenordspacing -\let \normalUmathopenpunctspacing = \Umathopenpunctspacing -\let \normalUmathopenrelspacing = \Umathopenrelspacing -\let \normalUmathoperatorsize = \Umathoperatorsize -\let \normalUmathopinnerspacing = \Umathopinnerspacing -\let \normalUmathopopenspacing = \Umathopopenspacing -\let \normalUmathopopspacing = \Umathopopspacing -\let \normalUmathopordspacing = \Umathopordspacing -\let \normalUmathoppunctspacing = \Umathoppunctspacing -\let \normalUmathoprelspacing = \Umathoprelspacing -\let \normalUmathordbinspacing = \Umathordbinspacing -\let \normalUmathordclosespacing = \Umathordclosespacing -\let \normalUmathordinnerspacing = \Umathordinnerspacing -\let \normalUmathordopenspacing = \Umathordopenspacing -\let \normalUmathordopspacing = \Umathordopspacing -\let \normalUmathordordspacing = \Umathordordspacing -\let \normalUmathordpunctspacing = \Umathordpunctspacing -\let \normalUmathordrelspacing = \Umathordrelspacing -\let \normalUmathoverbarkern = \Umathoverbarkern -\let \normalUmathoverbarrule = \Umathoverbarrule -\let \normalUmathoverbarvgap = \Umathoverbarvgap -\let \normalUmathoverdelimiterbgap = \Umathoverdelimiterbgap -\let \normalUmathoverdelimitervgap = \Umathoverdelimitervgap -\let \normalUmathpunctbinspacing = \Umathpunctbinspacing -\let \normalUmathpunctclosespacing = \Umathpunctclosespacing -\let \normalUmathpunctinnerspacing = \Umathpunctinnerspacing -\let \normalUmathpunctopenspacing = \Umathpunctopenspacing -\let \normalUmathpunctopspacing = \Umathpunctopspacing -\let \normalUmathpunctordspacing = \Umathpunctordspacing -\let \normalUmathpunctpunctspacing = \Umathpunctpunctspacing -\let \normalUmathpunctrelspacing = \Umathpunctrelspacing -\let \normalUmathquad = \Umathquad -\let \normalUmathradicaldegreeafter = \Umathradicaldegreeafter -\let \normalUmathradicaldegreebefore = \Umathradicaldegreebefore -\let \normalUmathradicaldegreeraise = \Umathradicaldegreeraise -\let \normalUmathradicalkern = \Umathradicalkern -\let \normalUmathradicalrule = \Umathradicalrule -\let \normalUmathradicalvgap = \Umathradicalvgap -\let \normalUmathrelbinspacing = \Umathrelbinspacing -\let \normalUmathrelclosespacing = \Umathrelclosespacing -\let \normalUmathrelinnerspacing = \Umathrelinnerspacing -\let \normalUmathrelopenspacing = \Umathrelopenspacing -\let \normalUmathrelopspacing = \Umathrelopspacing -\let \normalUmathrelordspacing = \Umathrelordspacing -\let \normalUmathrelpunctspacing = \Umathrelpunctspacing -\let \normalUmathrelrelspacing = \Umathrelrelspacing -\let \normalUmathspaceafterscript = \Umathspaceafterscript -\let \normalUmathstackdenomdown = \Umathstackdenomdown -\let \normalUmathstacknumup = \Umathstacknumup -\let \normalUmathstackvgap = \Umathstackvgap -\let \normalUmathsubshiftdown = \Umathsubshiftdown -\let \normalUmathsubshiftdrop = \Umathsubshiftdrop -\let \normalUmathsubsupshiftdown = \Umathsubsupshiftdown -\let \normalUmathsubsupvgap = \Umathsubsupvgap -\let \normalUmathsubtopmax = \Umathsubtopmax -\let \normalUmathsupbottommin = \Umathsupbottommin -\let \normalUmathsupshiftdrop = \Umathsupshiftdrop -\let \normalUmathsupshiftup = \Umathsupshiftup -\let \normalUmathsupsubbottommax = \Umathsupsubbottommax -\let \normalUmathunderbarkern = \Umathunderbarkern -\let \normalUmathunderbarrule = \Umathunderbarrule -\let \normalUmathunderbarvgap = \Umathunderbarvgap -\let \normalUmathunderdelimiterbgap = \Umathunderdelimiterbgap -\let \normalUmathunderdelimitervgap = \Umathunderdelimitervgap -\let \normalUoverdelimiter = \Uoverdelimiter -\let \normalUradical = \Uradical -\let \normalUroot = \Uroot -\let \normalUunderdelimiter = \Uunderdelimiter -\let \normalattribute = \attribute -\let \normalattributedef = \attributedef -\let \normalcatcodetable = \catcodetable -\let \normalclearmarks = \clearmarks -\let \normalcrampeddisplaystyle = \crampeddisplaystyle -\let \normalcrampedscriptscriptstyle = \crampedscriptscriptstyle -\let \normalcrampedscriptstyle = \crampedscriptstyle -\let \normalcrampedtextstyle = \crampedtextstyle -\let \normalformatname = \formatname -\let \normalifabsdim = \ifabsdim -\let \normalifabsnum = \ifabsnum -\let \normalifprimitive = \ifprimitive -\let \normalinitcatcodetable = \initcatcodetable -\let \normallatelua = \latelua -\let \normalluaescapestring = \luaescapestring -\let \normalluastartup = \luastartup -\let \normalluatexdatestamp = \luatexdatestamp -\let \normalluatexrevision = \luatexrevision -\let \normalluatexversion = \luatexversion -\let \normalnokerns = \nokerns -\let \normalnoligs = \noligs -\let \normalpageleftoffset = \pageleftoffset -\let \normalpagetopoffset = \pagetopoffset -\let \normalpostexhyphenchar = \postexhyphenchar -\let \normalposthyphenchar = \posthyphenchar -\let \normalpreexhyphenchar = \preexhyphenchar -\let \normalprehyphenchar = \prehyphenchar -\let \normalprimitive = \primitive -\let \normalsavecatcodetable = \savecatcodetable -\let \normalscantextokens = \scantextokens -\let \normalsuppressfontnotfounderror = \suppressfontnotfounderror -\let \normalsuppressifcsnameerror = \suppressifcsnameerror -\let \normalsuppresslongerror = \suppresslongerror -\let \normalsynctex = \synctex - -\endinput diff --git a/Master/texmf-dist/tex/context/base/norm-ptx.mkii b/Master/texmf-dist/tex/context/base/norm-ptx.mkii new file mode 100644 index 00000000000..352a884f014 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/norm-ptx.mkii @@ -0,0 +1,132 @@ +%D \module +%D [ file=norm-ptx, +%D version=2009.03.19, +%D title=\CONTEXT\ Norm Macros, +%D subtitle=\PDFTEX, +%D author=Hans Hagen, +%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 Eventually most of these will be disabled in \MKIV. + +\let \normalefcode = \efcode +\let \normalexpanded = \expanded +\let \normalifincsname = \ifincsname +\let \normalifpdfabsdim = \ifpdfabsdim +\let \normalifpdfabsnum = \ifpdfabsnum +\let \normalifpdfprimitive = \ifpdfprimitive +\let \normalleftmarginkern = \leftmarginkern +\let \normalletterspacefont = \letterspacefont +\let \normallpcode = \lpcode +\let \normalpdfadjustspacing = \pdfadjustspacing +\let \normalpdfannot = \pdfannot +\let \normalpdfcatalog = \pdfcatalog +\let \normalpdfcolorstack = \pdfcolorstack +\let \normalpdfcolorstackinit = \pdfcolorstackinit +\let \normalpdfcompresslevel = \pdfcompresslevel +\let \normalpdfcopyfont = \pdfcopyfont +\let \normalpdfcreationdate = \pdfcreationdate +\let \normalpdfdecimaldigits = \pdfdecimaldigits +\let \normalpdfdest = \pdfdest +\let \normalpdfdestmargin = \pdfdestmargin +\let \normalpdfdraftmode = \pdfdraftmode +\let \normalpdfeachlinedepth = \pdfeachlinedepth +\let \normalpdfeachlineheight = \pdfeachlineheight +\let \normalpdfendlink = \pdfendlink +\let \normalpdfendthread = \pdfendthread +\let \normalpdffirstlineheight = \pdffirstlineheight +\let \normalpdffontattr = \pdffontattr +\let \normalpdffontexpand = \pdffontexpand +\let \normalpdffontname = \pdffontname +\let \normalpdffontobjnum = \pdffontobjnum +\let \normalpdffontsize = \pdffontsize +\let \normalpdfforcepagebox = \pdfforcepagebox % obsolete +\let \normalpdfgamma = \pdfgamma +\let \normalpdfgentounicode = \pdfgentounicode +\let \normalpdfglyphtounicode = \pdfglyphtounicode +\let \normalpdfhorigin = \pdfhorigin +\let \normalpdfignoreddimen = \pdfignoreddimen +\let \normalpdfimageapplygamma = \pdfimageapplygamma +\let \normalpdfimagegamma = \pdfimagegamma +\let \normalpdfimagehicolor = \pdfimagehicolor +\let \normalpdfimageresolution = \pdfimageresolution +\let \normalpdfincludechars = \pdfincludechars +\let \normalpdfinclusioncopyfonts = \pdfinclusioncopyfonts +\let \normalpdfinclusionerrorlevel = \pdfinclusionerrorlevel +\let \normalpdfinfo = \pdfinfo +\let \normalpdfinsertht = \pdfinsertht +\let \normalpdflastannot = \pdflastannot +\let \normalpdflastlinedepth = \pdflastlinedepth +\let \normalpdflastlink = \pdflastlink +\let \normalpdflastobj = \pdflastobj +\let \normalpdflastxform = \pdflastxform +\let \normalpdflastximage = \pdflastximage +\let \normalpdflastximagecolordepth = \pdflastximagecolordepth +\let \normalpdflastximagepages = \pdflastximagepages +\let \normalpdflastxpos = \pdflastxpos +\let \normalpdflastypos = \pdflastypos +\let \normalpdflinkmargin = \pdflinkmargin +\let \normalpdfliteral = \pdfliteral +\let \normalpdfmapfile = \pdfmapfile +\let \normalpdfmapline = \pdfmapline +\let \normalpdfminorversion = \pdfminorversion +\let \normalpdfmovechars = \pdfmovechars % obsolete +\let \normalpdfnames = \pdfnames +\let \normalpdfnoligatures = \pdfnoligatures +\let \normalpdfnormaldeviate = \pdfnormaldeviate +\let \normalpdfobj = \pdfobj +\let \normalpdfobjcompresslevel = \pdfobjcompresslevel +\let \normalpdfoptionalwaysusepdfpagebox = \pdfoptionalwaysusepdfpagebox % obsolete +\let \normalpdfoptionpdfinclusionerrorlevel = \pdfoptionpdfinclusionerrorlevel % obsolete +\let \normalpdfoptionpdfminorversion = \pdfoptionpdfminorversion +\let \normalpdfoutline = \pdfoutline +\let \normalpdfoutput = \pdfoutput +\let \normalpdfpageattr = \pdfpageattr +\let \normalpdfpagebox = \pdfpagebox +\let \normalpdfpageheight = \pdfpageheight +\let \normalpdfpageref = \pdfpageref +\let \normalpdfpageresources = \pdfpageresources +\let \normalpdfpagesattr = \pdfpagesattr +\let \normalpdfpagewidth = \pdfpagewidth +\let \normalpdfpkmode = \pdfpkmode +\let \normalpdfpkresolution = \pdfpkresolution +\let \normalpdfprimitive = \pdfprimitive +\let \normalpdfprotrudechars = \pdfprotrudechars +\let \normalpdfpxdimen = \pdfpxdimen +\let \normalpdfrandomseed = \pdfrandomseed +\let \normalpdfrefobj = \pdfrefobj +\let \normalpdfrefxform = \pdfrefxform +\let \normalpdfrefximage = \pdfrefximage +\let \normalpdfreplacefont = \pdfreplacefont +\let \normalpdfrestore = \pdfrestore +\let \normalpdfretval = \pdfretval +\let \normalpdfsave = \pdfsave +\let \normalpdfsavepos = \pdfsavepos +\let \normalpdfsetmatrix = \pdfsetmatrix +\let \normalpdfsetrandomseed = \pdfsetrandomseed +\let \normalpdfstartlink = \pdfstartlink +\let \normalpdfstartthread = \pdfstartthread +\let \normalpdftexbanner = \pdftexbanner +\let \normalpdftexrevision = \pdftexrevision +\let \normalpdftexversion = \pdftexversion +\let \normalpdfthread = \pdfthread +\let \normalpdfthreadmargin = \pdfthreadmargin +\let \normalpdftracingfonts = \pdftracingfonts +\let \normalpdftrailer = \pdftrailer +\let \normalpdfuniformdeviate = \pdfuniformdeviate +\let \normalpdfuniqueresname = \pdfuniqueresname +\let \normalpdfvorigin = \pdfvorigin +\let \normalpdfxform = \pdfxform +\let \normalpdfxformname = \pdfxformname +\let \normalpdfximage = \pdfximage +\let \normalpdfximagebbox = \pdfximagebbox +\let \normalquitvmode = \quitvmode +\let \normalrightmarginkern = \rightmarginkern +\let \normalrpcode = \rpcode +\let \normaltagcode = \tagcode + +\endinput diff --git a/Master/texmf-dist/tex/context/base/norm-ptx.tex b/Master/texmf-dist/tex/context/base/norm-ptx.tex deleted file mode 100644 index 8f911d874b6..00000000000 --- a/Master/texmf-dist/tex/context/base/norm-ptx.tex +++ /dev/null @@ -1,130 +0,0 @@ -%D \module -%D [ file=norm-ptx, -%D version=2009.03.19, -%D title=\CONTEXT\ Norm Macros, -%D subtitle=\PDFTEX, -%D author=Hans Hagen, -%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. - -\let \normalefcode = \efcode -\let \normalexpanded = \expanded -\let \normalifincsname = \ifincsname -\let \normalifpdfabsdim = \ifpdfabsdim -\let \normalifpdfabsnum = \ifpdfabsnum -\let \normalifpdfprimitive = \ifpdfprimitive -\let \normalleftmarginkern = \leftmarginkern -\let \normalletterspacefont = \letterspacefont -\let \normallpcode = \lpcode -\let \normalpdfadjustspacing = \pdfadjustspacing -\let \normalpdfannot = \pdfannot -\let \normalpdfcatalog = \pdfcatalog -\let \normalpdfcolorstack = \pdfcolorstack -\let \normalpdfcolorstackinit = \pdfcolorstackinit -\let \normalpdfcompresslevel = \pdfcompresslevel -\let \normalpdfcopyfont = \pdfcopyfont -\let \normalpdfcreationdate = \pdfcreationdate -\let \normalpdfdecimaldigits = \pdfdecimaldigits -\let \normalpdfdest = \pdfdest -\let \normalpdfdestmargin = \pdfdestmargin -\let \normalpdfdraftmode = \pdfdraftmode -\let \normalpdfeachlinedepth = \pdfeachlinedepth -\let \normalpdfeachlineheight = \pdfeachlineheight -\let \normalpdfendlink = \pdfendlink -\let \normalpdfendthread = \pdfendthread -\let \normalpdffirstlineheight = \pdffirstlineheight -\let \normalpdffontattr = \pdffontattr -\let \normalpdffontexpand = \pdffontexpand -\let \normalpdffontname = \pdffontname -\let \normalpdffontobjnum = \pdffontobjnum -\let \normalpdffontsize = \pdffontsize -\let \normalpdfforcepagebox = \pdfforcepagebox % obsolete -\let \normalpdfgamma = \pdfgamma -\let \normalpdfgentounicode = \pdfgentounicode -\let \normalpdfglyphtounicode = \pdfglyphtounicode -\let \normalpdfhorigin = \pdfhorigin -\let \normalpdfignoreddimen = \pdfignoreddimen -\let \normalpdfimageapplygamma = \pdfimageapplygamma -\let \normalpdfimagegamma = \pdfimagegamma -\let \normalpdfimagehicolor = \pdfimagehicolor -\let \normalpdfimageresolution = \pdfimageresolution -\let \normalpdfincludechars = \pdfincludechars -\let \normalpdfinclusioncopyfonts = \pdfinclusioncopyfonts -\let \normalpdfinclusionerrorlevel = \pdfinclusionerrorlevel -\let \normalpdfinfo = \pdfinfo -\let \normalpdfinsertht = \pdfinsertht -\let \normalpdflastannot = \pdflastannot -\let \normalpdflastlinedepth = \pdflastlinedepth -\let \normalpdflastlink = \pdflastlink -\let \normalpdflastobj = \pdflastobj -\let \normalpdflastxform = \pdflastxform -\let \normalpdflastximage = \pdflastximage -\let \normalpdflastximagecolordepth = \pdflastximagecolordepth -\let \normalpdflastximagepages = \pdflastximagepages -\let \normalpdflastxpos = \pdflastxpos -\let \normalpdflastypos = \pdflastypos -\let \normalpdflinkmargin = \pdflinkmargin -\let \normalpdfliteral = \pdfliteral -\let \normalpdfmapfile = \pdfmapfile -\let \normalpdfmapline = \pdfmapline -\let \normalpdfminorversion = \pdfminorversion -\let \normalpdfmovechars = \pdfmovechars % obsolete -\let \normalpdfnames = \pdfnames -\let \normalpdfnoligatures = \pdfnoligatures -\let \normalpdfnormaldeviate = \pdfnormaldeviate -\let \normalpdfobj = \pdfobj -\let \normalpdfobjcompresslevel = \pdfobjcompresslevel -\let \normalpdfoptionalwaysusepdfpagebox = \pdfoptionalwaysusepdfpagebox % obsolete -\let \normalpdfoptionpdfinclusionerrorlevel = \pdfoptionpdfinclusionerrorlevel % obsolete -\let \normalpdfoptionpdfminorversion = \pdfoptionpdfminorversion -\let \normalpdfoutline = \pdfoutline -\let \normalpdfoutput = \pdfoutput -\let \normalpdfpageattr = \pdfpageattr -\let \normalpdfpagebox = \pdfpagebox -\let \normalpdfpageheight = \pdfpageheight -\let \normalpdfpageref = \pdfpageref -\let \normalpdfpageresources = \pdfpageresources -\let \normalpdfpagesattr = \pdfpagesattr -\let \normalpdfpagewidth = \pdfpagewidth -\let \normalpdfpkmode = \pdfpkmode -\let \normalpdfpkresolution = \pdfpkresolution -\let \normalpdfprimitive = \pdfprimitive -\let \normalpdfprotrudechars = \pdfprotrudechars -\let \normalpdfpxdimen = \pdfpxdimen -\let \normalpdfrandomseed = \pdfrandomseed -\let \normalpdfrefobj = \pdfrefobj -\let \normalpdfrefxform = \pdfrefxform -\let \normalpdfrefximage = \pdfrefximage -\let \normalpdfreplacefont = \pdfreplacefont -\let \normalpdfrestore = \pdfrestore -\let \normalpdfretval = \pdfretval -\let \normalpdfsave = \pdfsave -\let \normalpdfsavepos = \pdfsavepos -\let \normalpdfsetmatrix = \pdfsetmatrix -\let \normalpdfsetrandomseed = \pdfsetrandomseed -\let \normalpdfstartlink = \pdfstartlink -\let \normalpdfstartthread = \pdfstartthread -\let \normalpdftexbanner = \pdftexbanner -\let \normalpdftexrevision = \pdftexrevision -\let \normalpdftexversion = \pdftexversion -\let \normalpdfthread = \pdfthread -\let \normalpdfthreadmargin = \pdfthreadmargin -\let \normalpdftracingfonts = \pdftracingfonts -\let \normalpdftrailer = \pdftrailer -\let \normalpdfuniformdeviate = \pdfuniformdeviate -\let \normalpdfuniqueresname = \pdfuniqueresname -\let \normalpdfvorigin = \pdfvorigin -\let \normalpdfxform = \pdfxform -\let \normalpdfxformname = \pdfxformname -\let \normalpdfximage = \pdfximage -\let \normalpdfximagebbox = \pdfximagebbox -\let \normalquitvmode = \quitvmode -\let \normalrightmarginkern = \rightmarginkern -\let \normalrpcode = \rpcode -\let \normaltagcode = \tagcode - -\endinput diff --git a/Master/texmf-dist/tex/context/base/norm-tex.mkii b/Master/texmf-dist/tex/context/base/norm-tex.mkii new file mode 100644 index 00000000000..61f9740efe4 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/norm-tex.mkii @@ -0,0 +1,351 @@ +%D \module +%D [ file=norm-etx, +%D version=2009.03.19, +%D title=\CONTEXT\ Norm Macros, +%D subtitle=\TEX, +%D author=Hans Hagen, +%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 Since \LUATEX\ can generate these lists internally it started +%D to make sense to cleanup this \type {\normalstuff} for \MKII\ as +%D well. The tables are generated with a \LUA\ script. + +% tex primitives + +% Beware, we already redefined \dump, \outer and \everyjob ! + +% \normal = \ +% \normal- = \- +% \normal/ = \/ +\let \normalabove = \above +\let \normalabovedisplayshortskip = \abovedisplayshortskip +\let \normalabovedisplayskip = \abovedisplayskip +\let \normalabovewithdelims = \abovewithdelims +\let \normalaccent = \accent +\let \normaladjdemerits = \adjdemerits +\let \normaladvance = \advance +\let \normalafterassignment = \afterassignment +\let \normalaftergroup = \aftergroup +\let \normalatop = \atop +\let \normalatopwithdelims = \atopwithdelims +\let \normalbadness = \badness +\let \normalbaselineskip = \baselineskip +\let \normalbatchmode = \batchmode +\let \normalbegingroup = \begingroup +\let \normalbelowdisplayshortskip = \belowdisplayshortskip +\let \normalbelowdisplayskip = \belowdisplayskip +\let \normalbinoppenalty = \binoppenalty +\let \normalbotmark = \botmark +\let \normalbox = \box +\let \normalboxmaxdepth = \boxmaxdepth +\let \normalbrokenpenalty = \brokenpenalty +\let \normalcatcode = \catcode +\let \normalchar = \char +\let \normalchardef = \chardef +\let \normalcleaders = \cleaders +\let \normalclosein = \closein +\let \normalcloseout = \closeout +\let \normalclubpenalty = \clubpenalty +\let \normalcopy = \copy +\let \normalcount = \count +\let \normalcountdef = \countdef +\let \normalcr = \cr +\let \normalcrcr = \crcr +\let \normalcsname = \csname +\let \normalday = \day +\let \normaldeadcycles = \deadcycles +\let \normaldef = \def +\let \normaldefaulthyphenchar = \defaulthyphenchar +\let \normaldefaultskewchar = \defaultskewchar +\let \normaldelcode = \delcode +\let \normaldelimiter = \delimiter +\let \normaldelimiterfactor = \delimiterfactor +\let \normaldelimitershortfall = \delimitershortfall +\let \normaldimen = \dimen +\let \normaldimendef = \dimendef +\let \normaldirectlua = \directlua +\let \normaldiscretionary = \discretionary +\let \normaldisplayindent = \displayindent +\let \normaldisplaylimits = \displaylimits +\let \normaldisplaystyle = \displaystyle +\let \normaldisplaywidowpenalty = \displaywidowpenalty +\let \normaldisplaywidth = \displaywidth +\let \normaldivide = \divide +\let \normaldoublehyphendemerits = \doublehyphendemerits +\let \normaldp = \dp +% \normaldump = \dump +\let \normaledef = \edef +\let \normalelse = \else +\let \normalemergencystretch = \emergencystretch +\let \normalend = \end +\let \normalendcsname = \endcsname +\let \normalendgroup = \endgroup +\let \normalendinput = \endinput +\let \normalendlinechar = \endlinechar +\let \normaleqno = \eqno +\let \normalerrhelp = \errhelp +\let \normalerrmessage = \errmessage +\let \normalerrorcontextlines = \errorcontextlines +\let \normalerrorstopmode = \errorstopmode +\let \normalescapechar = \escapechar +\let \normaleverycr = \everycr +\let \normaleverydisplay = \everydisplay +\let \normaleveryhbox = \everyhbox +% \normaleveryjob = \everyjob +\let \normaleverymath = \everymath +\let \normaleverypar = \everypar +\let \normaleveryvbox = \everyvbox +\let \normalexhyphenchar = \exhyphenchar +\let \normalexhyphenpenalty = \exhyphenpenalty +\let \normalexpandafter = \expandafter +\let \normalfam = \fam +\let \normalfi = \fi +\let \normalfinalhyphendemerits = \finalhyphendemerits +\let \normalfirstmark = \firstmark +\let \normalfloatingpenalty = \floatingpenalty +\let \normalfont = \font +\let \normalfontdimen = \fontdimen +\let \normalfontname = \fontname +\let \normalfuturelet = \futurelet +\let \normalgdef = \gdef +\let \normalglobal = \global +\let \normalglobaldefs = \globaldefs +\let \normalhalign = \halign +\let \normalhangafter = \hangafter +\let \normalhangindent = \hangindent +\let \normalhbadness = \hbadness +\let \normalhbox = \hbox +\let \normalhfil = \hfil +\let \normalhfill = \hfill +\let \normalhfilneg = \hfilneg +\let \normalhfuzz = \hfuzz +\let \normalhoffset = \hoffset +\let \normalholdinginserts = \holdinginserts +\let \normalhrule = \hrule +\let \normalhsize = \hsize +\let \normalhskip = \hskip +\let \normalhss = \hss +\let \normalht = \ht +\let \normalhyphenation = \hyphenation +\let \normalhyphenchar = \hyphenchar +\let \normalhyphenpenalty = \hyphenpenalty +\let \normalif = \if +\let \normalifcase = \ifcase +\let \normalifcat = \ifcat +\let \normalifdim = \ifdim +\let \normalifeof = \ifeof +\let \normaliffalse = \iffalse +\let \normalifhbox = \ifhbox +\let \normalifhmode = \ifhmode +\let \normalifinner = \ifinner +\let \normalifmmode = \ifmmode +\let \normalifnum = \ifnum +\let \normalifodd = \ifodd +\let \normaliftrue = \iftrue +\let \normalifvbox = \ifvbox +\let \normalifvmode = \ifvmode +\let \normalifvoid = \ifvoid +\let \normalifx = \ifx +\let \normalignorespaces = \ignorespaces +\let \normalimmediate = \immediate +\let \normalindent = \indent +% \normalinput = \input +\let \normalinputlineno = \inputlineno +\let \normalinsert = \insert +\let \normalinsertpenalties = \insertpenalties +\let \normalinterlinepenalty = \interlinepenalty +\let \normaljobname = \jobname +\let \normalkern = \kern +\let \normallanguage = \language +\let \normallastbox = \lastbox +\let \normallastkern = \lastkern +\let \normallastpenalty = \lastpenalty +\let \normallastskip = \lastskip +\let \normallccode = \lccode +\let \normalleaders = \leaders +\let \normalleft = \left +\let \normallefthyphenmin = \lefthyphenmin +\let \normalleftskip = \leftskip +\let \normalleqno = \leqno +\let \normallet = \let +\let \normallimits = \limits +\let \normallinepenalty = \linepenalty +\let \normallineskip = \lineskip +\let \normallineskiplimit = \lineskiplimit +\let \normallong = \long +\let \normallooseness = \looseness +\let \normallower = \lower +\let \normallowercase = \lowercase +\let \normalmag = \mag +\let \normalmark = \mark +\let \normalmathaccent = \mathaccent +\let \normalmathbin = \mathbin +\let \normalmathchar = \mathchar +\let \normalmathchardef = \mathchardef +\let \normalmathchoice = \mathchoice +\let \normalmathclose = \mathclose +\let \normalmathcode = \mathcode +\let \normalmathinner = \mathinner +\let \normalmathop = \mathop +\let \normalmathopen = \mathopen +\let \normalmathord = \mathord +\let \normalmathpunct = \mathpunct +\let \normalmathrel = \mathrel +\let \normalmathsurround = \mathsurround +\let \normalmaxdeadcycles = \maxdeadcycles +\let \normalmaxdepth = \maxdepth +\let \normalmeaning = \meaning +\let \normalmedmuskip = \medmuskip +\let \normalmessage = \message +\let \normalmiddle = \middle +\let \normalmkern = \mkern +\let \normalmonth = \month +\let \normalmoveleft = \moveleft +\let \normalmoveright = \moveright +\let \normalmskip = \mskip +\let \normalmultiply = \multiply +\let \normalmuskip = \muskip +\let \normalmuskipdef = \muskipdef +\let \normalnewlinechar = \newlinechar +\let \normalnoalign = \noalign +\let \normalnoboundary = \noboundary +\let \normalnoexpand = \noexpand +\let \normalnoindent = \noindent +\let \normalnolimits = \nolimits +\let \normalnonscript = \nonscript +\let \normalnonstopmode = \nonstopmode +\let \normalnulldelimiterspace = \nulldelimiterspace +\let \normalnullfont = \nullfont +\let \normalnumber = \number +\let \normalomit = \omit +\let \normalopenin = \openin +\let \normalopenout = \openout +\let \normalor = \or +% \normalouter = \outer +\let \normaloutput = \output +\let \normaloutputpenalty = \outputpenalty +\let \normalover = \over +\let \normaloverfullrule = \overfullrule +\let \normaloverline = \overline +\let \normaloverwithdelims = \overwithdelims +\let \normalpagedepth = \pagedepth +\let \normalpagefilllstretch = \pagefilllstretch +\let \normalpagefillstretch = \pagefillstretch +\let \normalpagefilstretch = \pagefilstretch +\let \normalpagegoal = \pagegoal +\let \normalpageshrink = \pageshrink +\let \normalpagestretch = \pagestretch +\let \normalpagetotal = \pagetotal +\let \normalpar = \par +\let \normalparfillskip = \parfillskip +\let \normalparindent = \parindent +\let \normalparshape = \parshape +\let \normalparskip = \parskip +\let \normalpatterns = \patterns +\let \normalpausing = \pausing +\let \normalpenalty = \penalty +\let \normalpostdisplaypenalty = \postdisplaypenalty +\let \normalpredisplaypenalty = \predisplaypenalty +\let \normalpredisplaysize = \predisplaysize +\let \normalpretolerance = \pretolerance +\let \normalprevdepth = \prevdepth +\let \normalprevgraf = \prevgraf +\let \normalradical = \radical +\let \normalraise = \raise +\let \normalread = \read +\let \normalrelax = \relax +\let \normalrelpenalty = \relpenalty +\let \normalright = \right +\let \normalrighthyphenmin = \righthyphenmin +\let \normalrightskip = \rightskip +\let \normalromannumeral = \romannumeral +\let \normalscriptfont = \scriptfont +\let \normalscriptscriptfont = \scriptscriptfont +\let \normalscriptscriptstyle = \scriptscriptstyle +\let \normalscriptspace = \scriptspace +\let \normalscriptstyle = \scriptstyle +\let \normalscrollmode = \scrollmode +\let \normalsetbox = \setbox +\let \normalsetlanguage = \setlanguage +\let \normalsfcode = \sfcode +\let \normalshipout = \shipout +\let \normalshow = \show +\let \normalshowbox = \showbox +\let \normalshowboxbreadth = \showboxbreadth +\let \normalshowboxdepth = \showboxdepth +\let \normalshowlists = \showlists +\let \normalshowthe = \showthe +\let \normalskewchar = \skewchar +\let \normalskip = \skip +\let \normalskipdef = \skipdef +\let \normalspacefactor = \spacefactor +\let \normalspaceskip = \spaceskip +\let \normalspan = \span +\let \normalspecial = \special +\let \normalsplitbotmark = \splitbotmark +\let \normalsplitfirstmark = \splitfirstmark +\let \normalsplitmaxdepth = \splitmaxdepth +\let \normalsplittopskip = \splittopskip +\let \normalstring = \string +\let \normaltabskip = \tabskip +\let \normaltextfont = \textfont +\let \normaltextstyle = \textstyle +\let \normalthe = \the +\let \normalthickmuskip = \thickmuskip +\let \normalthinmuskip = \thinmuskip +\let \normaltime = \time +\let \normaltoks = \toks +\let \normaltoksdef = \toksdef +\let \normaltolerance = \tolerance +\let \normaltopmark = \topmark +\let \normaltopskip = \topskip +\let \normaltracingcommands = \tracingcommands +\let \normaltracinglostchars = \tracinglostchars +\let \normaltracingmacros = \tracingmacros +\let \normaltracingonline = \tracingonline +\let \normaltracingoutput = \tracingoutput +\let \normaltracingpages = \tracingpages +\let \normaltracingparagraphs = \tracingparagraphs +\let \normaltracingrestores = \tracingrestores +\let \normaltracingstats = \tracingstats +\let \normaluccode = \uccode +\let \normaluchyph = \uchyph +\let \normalunderline = \underline +\let \normalunhbox = \unhbox +\let \normalunhcopy = \unhcopy +\let \normalunkern = \unkern +\let \normalunpenalty = \unpenalty +\let \normalunskip = \unskip +\let \normalunvbox = \unvbox +\let \normalunvcopy = \unvcopy +\let \normaluppercase = \uppercase +\let \normalvadjust = \vadjust +\let \normalvalign = \valign +\let \normalvbadness = \vbadness +\let \normalvbox = \vbox +\let \normalvcenter = \vcenter +\let \normalvfil = \vfil +\let \normalvfill = \vfill +\let \normalvfilneg = \vfilneg +\let \normalvfuzz = \vfuzz +\let \normalvoffset = \voffset +\let \normalvrule = \vrule +\let \normalvsize = \vsize +\let \normalvskip = \vskip +\let \normalvsplit = \vsplit +\let \normalvss = \vss +\let \normalvtop = \vtop +\let \normalwd = \wd +\let \normalwidowpenalty = \widowpenalty +\let \normalwrite = \write +\let \normalxdef = \xdef +\let \normalxleaders = \xleaders +\let \normalxspaceskip = \xspaceskip +\let \normalyear = \year + +\endinput diff --git a/Master/texmf-dist/tex/context/base/norm-tex.tex b/Master/texmf-dist/tex/context/base/norm-tex.tex deleted file mode 100644 index 61f9740efe4..00000000000 --- a/Master/texmf-dist/tex/context/base/norm-tex.tex +++ /dev/null @@ -1,351 +0,0 @@ -%D \module -%D [ file=norm-etx, -%D version=2009.03.19, -%D title=\CONTEXT\ Norm Macros, -%D subtitle=\TEX, -%D author=Hans Hagen, -%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 Since \LUATEX\ can generate these lists internally it started -%D to make sense to cleanup this \type {\normalstuff} for \MKII\ as -%D well. The tables are generated with a \LUA\ script. - -% tex primitives - -% Beware, we already redefined \dump, \outer and \everyjob ! - -% \normal = \ -% \normal- = \- -% \normal/ = \/ -\let \normalabove = \above -\let \normalabovedisplayshortskip = \abovedisplayshortskip -\let \normalabovedisplayskip = \abovedisplayskip -\let \normalabovewithdelims = \abovewithdelims -\let \normalaccent = \accent -\let \normaladjdemerits = \adjdemerits -\let \normaladvance = \advance -\let \normalafterassignment = \afterassignment -\let \normalaftergroup = \aftergroup -\let \normalatop = \atop -\let \normalatopwithdelims = \atopwithdelims -\let \normalbadness = \badness -\let \normalbaselineskip = \baselineskip -\let \normalbatchmode = \batchmode -\let \normalbegingroup = \begingroup -\let \normalbelowdisplayshortskip = \belowdisplayshortskip -\let \normalbelowdisplayskip = \belowdisplayskip -\let \normalbinoppenalty = \binoppenalty -\let \normalbotmark = \botmark -\let \normalbox = \box -\let \normalboxmaxdepth = \boxmaxdepth -\let \normalbrokenpenalty = \brokenpenalty -\let \normalcatcode = \catcode -\let \normalchar = \char -\let \normalchardef = \chardef -\let \normalcleaders = \cleaders -\let \normalclosein = \closein -\let \normalcloseout = \closeout -\let \normalclubpenalty = \clubpenalty -\let \normalcopy = \copy -\let \normalcount = \count -\let \normalcountdef = \countdef -\let \normalcr = \cr -\let \normalcrcr = \crcr -\let \normalcsname = \csname -\let \normalday = \day -\let \normaldeadcycles = \deadcycles -\let \normaldef = \def -\let \normaldefaulthyphenchar = \defaulthyphenchar -\let \normaldefaultskewchar = \defaultskewchar -\let \normaldelcode = \delcode -\let \normaldelimiter = \delimiter -\let \normaldelimiterfactor = \delimiterfactor -\let \normaldelimitershortfall = \delimitershortfall -\let \normaldimen = \dimen -\let \normaldimendef = \dimendef -\let \normaldirectlua = \directlua -\let \normaldiscretionary = \discretionary -\let \normaldisplayindent = \displayindent -\let \normaldisplaylimits = \displaylimits -\let \normaldisplaystyle = \displaystyle -\let \normaldisplaywidowpenalty = \displaywidowpenalty -\let \normaldisplaywidth = \displaywidth -\let \normaldivide = \divide -\let \normaldoublehyphendemerits = \doublehyphendemerits -\let \normaldp = \dp -% \normaldump = \dump -\let \normaledef = \edef -\let \normalelse = \else -\let \normalemergencystretch = \emergencystretch -\let \normalend = \end -\let \normalendcsname = \endcsname -\let \normalendgroup = \endgroup -\let \normalendinput = \endinput -\let \normalendlinechar = \endlinechar -\let \normaleqno = \eqno -\let \normalerrhelp = \errhelp -\let \normalerrmessage = \errmessage -\let \normalerrorcontextlines = \errorcontextlines -\let \normalerrorstopmode = \errorstopmode -\let \normalescapechar = \escapechar -\let \normaleverycr = \everycr -\let \normaleverydisplay = \everydisplay -\let \normaleveryhbox = \everyhbox -% \normaleveryjob = \everyjob -\let \normaleverymath = \everymath -\let \normaleverypar = \everypar -\let \normaleveryvbox = \everyvbox -\let \normalexhyphenchar = \exhyphenchar -\let \normalexhyphenpenalty = \exhyphenpenalty -\let \normalexpandafter = \expandafter -\let \normalfam = \fam -\let \normalfi = \fi -\let \normalfinalhyphendemerits = \finalhyphendemerits -\let \normalfirstmark = \firstmark -\let \normalfloatingpenalty = \floatingpenalty -\let \normalfont = \font -\let \normalfontdimen = \fontdimen -\let \normalfontname = \fontname -\let \normalfuturelet = \futurelet -\let \normalgdef = \gdef -\let \normalglobal = \global -\let \normalglobaldefs = \globaldefs -\let \normalhalign = \halign -\let \normalhangafter = \hangafter -\let \normalhangindent = \hangindent -\let \normalhbadness = \hbadness -\let \normalhbox = \hbox -\let \normalhfil = \hfil -\let \normalhfill = \hfill -\let \normalhfilneg = \hfilneg -\let \normalhfuzz = \hfuzz -\let \normalhoffset = \hoffset -\let \normalholdinginserts = \holdinginserts -\let \normalhrule = \hrule -\let \normalhsize = \hsize -\let \normalhskip = \hskip -\let \normalhss = \hss -\let \normalht = \ht -\let \normalhyphenation = \hyphenation -\let \normalhyphenchar = \hyphenchar -\let \normalhyphenpenalty = \hyphenpenalty -\let \normalif = \if -\let \normalifcase = \ifcase -\let \normalifcat = \ifcat -\let \normalifdim = \ifdim -\let \normalifeof = \ifeof -\let \normaliffalse = \iffalse -\let \normalifhbox = \ifhbox -\let \normalifhmode = \ifhmode -\let \normalifinner = \ifinner -\let \normalifmmode = \ifmmode -\let \normalifnum = \ifnum -\let \normalifodd = \ifodd -\let \normaliftrue = \iftrue -\let \normalifvbox = \ifvbox -\let \normalifvmode = \ifvmode -\let \normalifvoid = \ifvoid -\let \normalifx = \ifx -\let \normalignorespaces = \ignorespaces -\let \normalimmediate = \immediate -\let \normalindent = \indent -% \normalinput = \input -\let \normalinputlineno = \inputlineno -\let \normalinsert = \insert -\let \normalinsertpenalties = \insertpenalties -\let \normalinterlinepenalty = \interlinepenalty -\let \normaljobname = \jobname -\let \normalkern = \kern -\let \normallanguage = \language -\let \normallastbox = \lastbox -\let \normallastkern = \lastkern -\let \normallastpenalty = \lastpenalty -\let \normallastskip = \lastskip -\let \normallccode = \lccode -\let \normalleaders = \leaders -\let \normalleft = \left -\let \normallefthyphenmin = \lefthyphenmin -\let \normalleftskip = \leftskip -\let \normalleqno = \leqno -\let \normallet = \let -\let \normallimits = \limits -\let \normallinepenalty = \linepenalty -\let \normallineskip = \lineskip -\let \normallineskiplimit = \lineskiplimit -\let \normallong = \long -\let \normallooseness = \looseness -\let \normallower = \lower -\let \normallowercase = \lowercase -\let \normalmag = \mag -\let \normalmark = \mark -\let \normalmathaccent = \mathaccent -\let \normalmathbin = \mathbin -\let \normalmathchar = \mathchar -\let \normalmathchardef = \mathchardef -\let \normalmathchoice = \mathchoice -\let \normalmathclose = \mathclose -\let \normalmathcode = \mathcode -\let \normalmathinner = \mathinner -\let \normalmathop = \mathop -\let \normalmathopen = \mathopen -\let \normalmathord = \mathord -\let \normalmathpunct = \mathpunct -\let \normalmathrel = \mathrel -\let \normalmathsurround = \mathsurround -\let \normalmaxdeadcycles = \maxdeadcycles -\let \normalmaxdepth = \maxdepth -\let \normalmeaning = \meaning -\let \normalmedmuskip = \medmuskip -\let \normalmessage = \message -\let \normalmiddle = \middle -\let \normalmkern = \mkern -\let \normalmonth = \month -\let \normalmoveleft = \moveleft -\let \normalmoveright = \moveright -\let \normalmskip = \mskip -\let \normalmultiply = \multiply -\let \normalmuskip = \muskip -\let \normalmuskipdef = \muskipdef -\let \normalnewlinechar = \newlinechar -\let \normalnoalign = \noalign -\let \normalnoboundary = \noboundary -\let \normalnoexpand = \noexpand -\let \normalnoindent = \noindent -\let \normalnolimits = \nolimits -\let \normalnonscript = \nonscript -\let \normalnonstopmode = \nonstopmode -\let \normalnulldelimiterspace = \nulldelimiterspace -\let \normalnullfont = \nullfont -\let \normalnumber = \number -\let \normalomit = \omit -\let \normalopenin = \openin -\let \normalopenout = \openout -\let \normalor = \or -% \normalouter = \outer -\let \normaloutput = \output -\let \normaloutputpenalty = \outputpenalty -\let \normalover = \over -\let \normaloverfullrule = \overfullrule -\let \normaloverline = \overline -\let \normaloverwithdelims = \overwithdelims -\let \normalpagedepth = \pagedepth -\let \normalpagefilllstretch = \pagefilllstretch -\let \normalpagefillstretch = \pagefillstretch -\let \normalpagefilstretch = \pagefilstretch -\let \normalpagegoal = \pagegoal -\let \normalpageshrink = \pageshrink -\let \normalpagestretch = \pagestretch -\let \normalpagetotal = \pagetotal -\let \normalpar = \par -\let \normalparfillskip = \parfillskip -\let \normalparindent = \parindent -\let \normalparshape = \parshape -\let \normalparskip = \parskip -\let \normalpatterns = \patterns -\let \normalpausing = \pausing -\let \normalpenalty = \penalty -\let \normalpostdisplaypenalty = \postdisplaypenalty -\let \normalpredisplaypenalty = \predisplaypenalty -\let \normalpredisplaysize = \predisplaysize -\let \normalpretolerance = \pretolerance -\let \normalprevdepth = \prevdepth -\let \normalprevgraf = \prevgraf -\let \normalradical = \radical -\let \normalraise = \raise -\let \normalread = \read -\let \normalrelax = \relax -\let \normalrelpenalty = \relpenalty -\let \normalright = \right -\let \normalrighthyphenmin = \righthyphenmin -\let \normalrightskip = \rightskip -\let \normalromannumeral = \romannumeral -\let \normalscriptfont = \scriptfont -\let \normalscriptscriptfont = \scriptscriptfont -\let \normalscriptscriptstyle = \scriptscriptstyle -\let \normalscriptspace = \scriptspace -\let \normalscriptstyle = \scriptstyle -\let \normalscrollmode = \scrollmode -\let \normalsetbox = \setbox -\let \normalsetlanguage = \setlanguage -\let \normalsfcode = \sfcode -\let \normalshipout = \shipout -\let \normalshow = \show -\let \normalshowbox = \showbox -\let \normalshowboxbreadth = \showboxbreadth -\let \normalshowboxdepth = \showboxdepth -\let \normalshowlists = \showlists -\let \normalshowthe = \showthe -\let \normalskewchar = \skewchar -\let \normalskip = \skip -\let \normalskipdef = \skipdef -\let \normalspacefactor = \spacefactor -\let \normalspaceskip = \spaceskip -\let \normalspan = \span -\let \normalspecial = \special -\let \normalsplitbotmark = \splitbotmark -\let \normalsplitfirstmark = \splitfirstmark -\let \normalsplitmaxdepth = \splitmaxdepth -\let \normalsplittopskip = \splittopskip -\let \normalstring = \string -\let \normaltabskip = \tabskip -\let \normaltextfont = \textfont -\let \normaltextstyle = \textstyle -\let \normalthe = \the -\let \normalthickmuskip = \thickmuskip -\let \normalthinmuskip = \thinmuskip -\let \normaltime = \time -\let \normaltoks = \toks -\let \normaltoksdef = \toksdef -\let \normaltolerance = \tolerance -\let \normaltopmark = \topmark -\let \normaltopskip = \topskip -\let \normaltracingcommands = \tracingcommands -\let \normaltracinglostchars = \tracinglostchars -\let \normaltracingmacros = \tracingmacros -\let \normaltracingonline = \tracingonline -\let \normaltracingoutput = \tracingoutput -\let \normaltracingpages = \tracingpages -\let \normaltracingparagraphs = \tracingparagraphs -\let \normaltracingrestores = \tracingrestores -\let \normaltracingstats = \tracingstats -\let \normaluccode = \uccode -\let \normaluchyph = \uchyph -\let \normalunderline = \underline -\let \normalunhbox = \unhbox -\let \normalunhcopy = \unhcopy -\let \normalunkern = \unkern -\let \normalunpenalty = \unpenalty -\let \normalunskip = \unskip -\let \normalunvbox = \unvbox -\let \normalunvcopy = \unvcopy -\let \normaluppercase = \uppercase -\let \normalvadjust = \vadjust -\let \normalvalign = \valign -\let \normalvbadness = \vbadness -\let \normalvbox = \vbox -\let \normalvcenter = \vcenter -\let \normalvfil = \vfil -\let \normalvfill = \vfill -\let \normalvfilneg = \vfilneg -\let \normalvfuzz = \vfuzz -\let \normalvoffset = \voffset -\let \normalvrule = \vrule -\let \normalvsize = \vsize -\let \normalvskip = \vskip -\let \normalvsplit = \vsplit -\let \normalvss = \vss -\let \normalvtop = \vtop -\let \normalwd = \wd -\let \normalwidowpenalty = \widowpenalty -\let \normalwrite = \write -\let \normalxdef = \xdef -\let \normalxleaders = \xleaders -\let \normalxspaceskip = \xspaceskip -\let \normalyear = \year - -\endinput diff --git a/Master/texmf-dist/tex/context/base/norm-xtx.mkii b/Master/texmf-dist/tex/context/base/norm-xtx.mkii new file mode 100644 index 00000000000..3da94465624 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/norm-xtx.mkii @@ -0,0 +1,18 @@ +%D \module +%D [ file=norm-xtx, +%D version=2009.03.19, +%D title=\CONTEXT\ Norm Macros, +%D subtitle=\XETEX, +%D author=Hans Hagen, +%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. + +% xetex primitives + +% nothing yet (also defined pdftex primitives) + +\endinput diff --git a/Master/texmf-dist/tex/context/base/norm-xtx.tex b/Master/texmf-dist/tex/context/base/norm-xtx.tex deleted file mode 100644 index 3da94465624..00000000000 --- a/Master/texmf-dist/tex/context/base/norm-xtx.tex +++ /dev/null @@ -1,18 +0,0 @@ -%D \module -%D [ file=norm-xtx, -%D version=2009.03.19, -%D title=\CONTEXT\ Norm Macros, -%D subtitle=\XETEX, -%D author=Hans Hagen, -%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. - -% xetex primitives - -% nothing yet (also defined pdftex primitives) - -\endinput diff --git a/Master/texmf-dist/tex/context/base/pack-box.mkii b/Master/texmf-dist/tex/context/base/pack-box.mkii index 8adeedb91b5..f27d8b4fd83 100644 --- a/Master/texmf-dist/tex/context/base/pack-box.mkii +++ b/Master/texmf-dist/tex/context/base/pack-box.mkii @@ -447,7 +447,6 @@ \def\bleed {\dosingleempty\dobleed} - \def\bleedwidth {\the\hsize}% \def\bleedheight{\the\vsize}% @@ -478,12 +477,13 @@ rt=>\!!donebtrue\!!donectrue]% \doifelse\@@bgstretch\v!yes\donetrue\donefalse \scratchdimen\@@bgwidth + \edef\currentbgposition {\??bg:\number\nofbleeds}% + \edef\currentpageposition{page:0}% todo: per page \ifdone \if!!donea - \advance\scratchdimen\MPx{\??bg:\number\nofbleeds}% + \advance\scratchdimen\dimexpr \MPx\currentbgposition-\MPx\currentpageposition\relax \else\if!!doneb - \scratchdimen\paperwidth - \advance\scratchdimen-\MPx{\??bg:\number\nofbleeds}% + \scratchdimen\dimexpr\paperwidth-\MPx\currentbgposition-\MPx\currentpageposition\relax % not checked \fi\fi \fi \advance\scratchdimen\@@bghoffset @@ -491,10 +491,9 @@ \scratchdimen\@@bgheight \ifdone \if!!donec - \scratchdimen\paperheight - \advance\scratchdimen-\MPy{\??bg:\number\nofbleeds}% + \scratchdimen\dimexpr\paperheight-\MPy\currentbgposition-\MPy\currentpageposition\relax % not checked \else\if!!doned - \advance\scratchdimen\MPy{\??bg:\number\nofbleeds}% + \advance\scratchdimen\dimexpr \MPy\currentbgposition-\MPy\currentpageposition\relax % not checked \fi\fi \fi \advance\scratchdimen\@@bgvoffset @@ -514,7 +513,7 @@ \ht\scratchbox\@@bgheight \dp\scratchbox\zeropoint \ifdone - \hpos{\??bg:\number\nofbleeds}{\box\scratchbox}% + \hpos\currentbgposition{\box\scratchbox}% \else \box\scratchbox \fi diff --git a/Master/texmf-dist/tex/context/base/pack-box.mkiv b/Master/texmf-dist/tex/context/base/pack-box.mkiv index 6cb492aa6df..fa771b4855a 100644 --- a/Master/texmf-dist/tex/context/base/pack-box.mkiv +++ b/Master/texmf-dist/tex/context/base/pack-box.mkiv @@ -82,7 +82,7 @@ {\dowithnextbox {\bgroup \checktextbackgrounds - \setbox\scratchbox\null + \setbox\scratchbox\emptyhbox \wd\scratchbox\nextboxwd \ht\scratchbox\nextboxht \dp\scratchbox\nextboxdp @@ -443,10 +443,9 @@ \c!voffset=\@@bgoffset, \c!hoffset=\@@bgoffset] -\def\bleed +\unexpanded\def\bleed {\dosingleempty\dobleed} - \def\bleedwidth {\the\hsize}% \def\bleedheight{\the\vsize}% @@ -477,12 +476,13 @@ rt=>\!!donebtrue\!!donectrue]% \doifelse\@@bgstretch\v!yes\donetrue\donefalse \scratchdimen\@@bgwidth + \edef\currentbgposition {\??bg:\number\nofbleeds}% + \edef\currentpageposition{page:0}% todo: per page \ifdone \if!!donea - \advance\scratchdimen\MPx{\??bg:\number\nofbleeds}% + \advance\scratchdimen\dimexpr \MPx\currentbgposition-\MPx\currentpageposition\relax \else\if!!doneb - \scratchdimen\paperwidth - \advance\scratchdimen-\MPx{\??bg:\number\nofbleeds}% + \scratchdimen\dimexpr\paperwidth-\MPx\currentbgposition+\MPx\currentpageposition\relax % not checked \fi\fi \fi \advance\scratchdimen\@@bghoffset @@ -490,17 +490,21 @@ \scratchdimen\@@bgheight \ifdone \if!!donec - \scratchdimen\paperheight - \advance\scratchdimen-\MPy{\??bg:\number\nofbleeds}% + \scratchdimen\dimexpr\paperheight-\MPy\currentbgposition+\MPy\currentpageposition\relax % not checked \else\if!!doned - \advance\scratchdimen\MPy{\??bg:\number\nofbleeds}% + \advance\scratchdimen\dimexpr \MPy\currentbgposition-\MPy\currentpageposition\relax % not checked \fi\fi \fi \advance\scratchdimen\@@bgvoffset \xdef\bleedheight{\the\scratchdimen}% + % + \bgroup \hsize\bleedwidth \vsize\bleedheight - \setbox\scratchbox\hbox{#2}% + \global\setbox\globalscratchbox\hbox{#2}% + \egroup + \setbox\scratchbox\box\globalscratchbox + % \doif\@@bgpage\v!yes {\setbox\scratchbox\topskippedbox{\box\scratchbox}}% \setbox\scratchbox\hbox to \@@bgwidth @@ -513,7 +517,7 @@ \ht\scratchbox\@@bgheight \dp\scratchbox\zeropoint \ifdone - \hpos{\??bg:\number\nofbleeds}{\box\scratchbox}% + \hpos\currentbgposition{\box\scratchbox}% \else \box\scratchbox \fi @@ -521,7 +525,7 @@ \setupbleeding[\c!stretch=\v!yes] -\defineexternalfigure[bleed][\c!width=\bleedwidth,\c!height=\bleedheight] +\defineexternalfigure[bleed][\c!width=\bleedwidth,\c!height=\bleedheight] % should be \v!bleed % \placefigure[left]{none} % {\bleed[width=5cm,height=3cm,location=lt]{\externalfigure[koe][bleed]}} @@ -900,7 +904,7 @@ [\c!width=\zeropoint,% \c!height=\zeropoint,% \c!depth=\zeropoint,#1]% - \setbox\scratchbox\null + \setbox\scratchbox\emptyhbox \wd\scratchbox\@@olwidth \ht\scratchbox\@@olheight \dp\scratchbox\@@oldepth diff --git a/Master/texmf-dist/tex/context/base/pack-lyr.mkiv b/Master/texmf-dist/tex/context/base/pack-lyr.mkiv index 0cb3ee24456..5242b56de21 100644 --- a/Master/texmf-dist/tex/context/base/pack-lyr.mkiv +++ b/Master/texmf-dist/tex/context/base/pack-lyr.mkiv @@ -140,15 +140,6 @@ \def\setlayer {\dotripleempty\dosetlayer} -% \def\dosetlayer[#1][#2][#3]% #4 == box do \fi is ok -% {\doifelsevalue{\??ll#1\c!state}\v!stop -% {\dowithnextbox\donothing\hbox} -% {\ifthirdargument -% \dodosetlayer[#1][#2][#3]% -% \else -% \dodosetlayer[#1][][#2]% -% \fi}} - \def\dosetlayer[#1][#2][#3]% #4 == box do \fi is ok {\doifelsevalue{\??ll#1\c!state}\v!stop {\dowithnextbox\donothing\hbox} @@ -237,8 +228,6 @@ \newdimen\layerwidth \newdimen\layerheight -\chardef\@@lacome=1 % LAyerCOnstructionMEthod / temp, will be default - \def\dododosetlayer[#1][#2][#3]% will be sped up {% we use the global width, never change this \def\currentlayer{#1}% @@ -343,20 +332,16 @@ \ifdim\scratchdimen<\getboxllx\layerpagebox \gsetboxllx\layerpagebox\scratchdimen \fi - \ifcase\@@lacome\or % this test will become obsolete - \advance\scratchdimen\nextboxwd - \nextboxwd\ifdim\scratchdimen>\lastlayerwidth \scratchdimen \else \lastlayerwidth \fi - \fi + \advance\scratchdimen\nextboxwd + \nextboxwd\ifdim\scratchdimen>\lastlayerwidth \scratchdimen \else \lastlayerwidth \fi \scratchdimen\dimexpr\@@layerypos+\@@layeryoff\relax \ifdim\scratchdimen<\getboxlly\layerpagebox \gsetboxlly\layerpagebox\scratchdimen \fi % ll compensation - \ifcase\@@lacome\or % this test will become obsolete - \advance\scratchdimen\dimexpr\nextboxht+\nextboxdp\relax - \nextboxht\ifdim\scratchdimen>\lastlayerheight \scratchdimen \else \lastlayerheight \fi - \nextboxdp\zeropoint - \fi + \advance\scratchdimen\dimexpr\nextboxht+\nextboxdp\relax + \nextboxht\ifdim\scratchdimen>\lastlayerheight \scratchdimen \else \lastlayerheight \fi + \nextboxdp\zeropoint % placement \hsize\layerparameter\c!width % new, keep box small \vbox to \layerparameter\c!height \bgroup @@ -430,20 +415,6 @@ % todo: setups before flush, handy hook -% \unexpanded\def\flushlayer[#1]% -% {\doifelsevalue{\??ll#1\c!state}\v!next -% {\global\letvalue{\??ll#1\c!state}\v!start} % dangerous, stack-built-up -% {\doifelsevalue{\??ll#1\c!state}\v!continue -% {\global\letvalue{\??ll#1\c!state}\v!repeat} % dangerous, stack-built-up -% {\doifelsevalue{\??ll#1\c!doublesided}\v!yes -% {\doifundefinedelse{\@@layerbox#1}% -% {\dodoflushlayerA[#1]} -% {\doifbothsidesoverruled -% {\dodoflushlayerB\v!left [#1]}% left -% {\dodoflushlayerB\v!right[#1]}% right -% {\dodoflushlayerB\v!left [#1]}}}% left -% {\dodoflushlayerA[#1]}}}} - \unexpanded\def\flushlayer[#1]% quite core, so optimized {\begingroup \forgetall @@ -645,121 +616,10 @@ [\c!background={\v!foreground,#1}, \c!frame=\v!off, \c!offset=\v!overlay,#2]} - -% The next mechanism is obsolete and will be removed in \MKIV\ (or move to -% the compatibility module. - -\newskip\xposition \newskip\yposition -\newskip\xdimension \newskip\ydimension -\newskip\xoffset \newskip\yoffset - -% already defined \newbox\positionbox - -\unexpanded\def\startpositioning - {\bgroup - \xposition \zeropoint \yposition \zeropoint - \xdimension\zeropoint \ydimension\zeropoint - \xoffset \zeropoint \yoffset \zeropoint - \hfuzz \paperwidth \vfuzz \paperheight - \setbox\positionbox\hbox\bgroup} - -\unexpanded\def\stoppositioning - {\doifnot\@@psoffset\v!yes - {\global\xoffset\zeropoint - \global\yoffset\zeropoint}% - \global\advance\xdimension \xoffset - \global\advance\ydimension \yoffset - \egroup - \vbox to \ydimension - {\vskip\yoffset - \hbox to \xdimension - {\hskip\xoffset - \box\positionbox - \hfill} - \vfill}% - \egroup} - -\def\resetpositioning - {\getparameters[\??ps] - [\c!state=\v!start,% - \c!unit=\s!cm,% - \c!factor=1,% - \c!scale=1,% - \c!xfactor=\@@psfactor,% - \c!yfactor=\@@psfactor,% - \c!xscale=\@@psscale,% - \c!yscale=\@@psscale,% - \c!xstep=\v!absolute,% - \c!ystep=\v!absolute,% - \c!xoffset=\!!zeropoint,% - \c!yoffset=\!!zeropoint]} - -\unexpanded\def\setuppositioning - {\resetpositioning - \dodoubleargument\getparameters[\??ps]} - -\def\calculateposition#1#2#3#4#5#6#7#8#9% - {\setdimensionwithunit\scratchskip{#1}\@@psunit - \scratchskip#8\scratchskip - \scratchskip#9\scratchskip - \advance\scratchskip #4\relax - \doif{#2}\v!relative - {\advance\scratchskip #3% - \let#4\!!zeropoint}% - #3\scratchskip\relax - \doifnot\@@psstate\v!overlay - {\scratchskip#5\relax - \advance\scratchskip #3\relax - \ifdim#3<-#7\relax \global#7-#3\relax \fi - \ifdim\scratchskip>#6\relax \global#6\scratchskip\relax \fi}} - -\def\position - {\dosingleempty\doposition} - -\def\doposition[#1]#2(#3,#4)% - {\dowithnextbox - {\bgroup - \getparameters[\??ps][#1]% - \dontcomplain - \calculateposition{#3}\@@psxstep\xposition - \@@psxoffset{\nextboxwd}\xdimension\xoffset - \@@psxscale\@@psxfactor - \scratchdimen\nextboxht \advance\scratchdimen \nextboxdp - \calculateposition{#4}\@@psystep\yposition - \@@psyoffset\scratchdimen\ydimension\yoffset - \@@psyscale\@@psyfactor - \vbox to \zeropoint % kan beter. - {\vskip\yposition - \hbox to \zeropoint - {\hskip\xposition - \flushnextbox - \hss} - \vss}% - \xdef\dopoppositioning - {\xposition\the\xposition - \yposition\the\yposition - \noexpand\def\noexpand\@@psxoffset{\@@psxoffset}% - \noexpand\def\noexpand\@@psyoffset{\@@psyoffset}}% - \egroup - \dopoppositioning - \ignorespaces} - \hbox} - -\resetpositioning - -\setuppositioning - [\c!unit=\s!cm, - \c!factor=1, - \c!scale=1, - \c!xstep=\v!absolute, - \c!ystep=\v!absolute, - \c!offset=\v!yes, - \c!xoffset=\!!zeropoint, - \c!yoffset=\!!zeropoint] %D Watch out, a redefinition: -\ifx\settextpagecontent\undefined \writestatus\m!systems{error in page-lyr.tex} \wait \fi +\ifx\settextpagecontent\undefined \writestatus\m!system{error in page-lyr.tex} \wait \fi \let\normalsettextpagecontent\settextpagecontent diff --git a/Master/texmf-dist/tex/context/base/pack-mis.mkvi b/Master/texmf-dist/tex/context/base/pack-mis.mkvi new file mode 100644 index 00000000000..ab6d2b3343d --- /dev/null +++ b/Master/texmf-dist/tex/context/base/pack-mis.mkvi @@ -0,0 +1,84 @@ +%D \module +%D [ file=pack-mis, % moved from e.g. core-mis +%D version=1998.01.29, +%D title=\CONTEXT\ Core Macros, +%D subtitle=Miscelaneous, +%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 Packing Macros / Misc Commands} + +\unprotect + +% a quite old mechanism already (but inheritance added) +% +% \defineplacement[name][settings] +% \setupplacement [name][settings] +% \placement [name][settings] +% \place [settings] + +\installcommandhandler \??pl {placement} \??pl + +\appendtoks + \setuevalue{\e!place\currentplacement}{\pack_placement{\currentplacement}}% +\to \everydefineplacement + +\setupplacement + [\c!left=\hss, + \c!right=\hss, + \c!linecorrection=\v!off, + \c!depthcorrection=\v!off, + \c!grid=\v!middle, + %\c!before=, + %\c!after=, + \c!margin=\v!standard] + +\unexpanded\def\placement[#tag]% + {\pack_placement{#tag}} + +\unexpanded\def\pack_placement#tag% + {\bgroup + \edef\currentplacement{#tag}% + \dosingleempty\pack_placement_indeed} + +\def\pack_placement_indeed[#settings]% set test can be sped up but non critical + {\iffirstargument + \setupcurrentplacement[#settings]% + \fi + \dowithnextboxcontent{\forgetall}{\pack_placement_flush\egroup}\vbox} + +\def\pack_placement_flush + {\setlocalhsize + \placementparameter\c!before + \begingroup + \disableparpositions + \setbox\nextbox\hbox to \localhsize + {\placementparameter\c!left + \flushnextbox + \placementparameter\c!right}% + \ifinsidefloat \else + \addlocalbackgroundtobox\nextbox + \fi + \ifgridsnapping + \doifinset{\placementparameter\c!margin}{\v!standard,\v!yes}\noindent % unchecked + \doifelsenothing{\placementparameter\c!grid} + {\snaptogrid[\v!middle]} + {\snaptogrid[\placementparameter\c!grid]}% + \hbox{\flushnextbox}% + \else + \doif{\placementparameter\c!linecorrection}\v!on \startbaselinecorrection + \doifinset{\placementparameter\c!margin}{\v!standard,\v!yes}\noindent + \flushnextbox + \doif{\placementparameter\c!depthcorrection}\v!on\baselinecorrection + \doif{\placementparameter\c!linecorrection }\v!on\stopbaselinecorrection + \fi + \endgroup + \placementparameter\c!after} + +\protect \endinput + diff --git a/Master/texmf-dist/tex/context/base/pack-obj.lua b/Master/texmf-dist/tex/context/base/pack-obj.lua index 0ee46fc99d1..2dabfa7846a 100644 --- a/Master/texmf-dist/tex/context/base/pack-obj.lua +++ b/Master/texmf-dist/tex/context/base/pack-obj.lua @@ -12,18 +12,24 @@ reusable components.

--ldx]]-- local texsprint, texcount = tex.sprint, tex.count +local allocate = utilities.storage.allocate -jobobjects = jobobjects or { } -jobobjects.collected = jobobjects.collected or { } -jobobjects.tobesaved = jobobjects.tobesaved or { } +local collected = allocate() +local tobesaved = allocate() -local collected, tobesaved = jobobjects.collected, jobobjects.tobesaved +local jobobjects = { + collected = collected, + tobesaved = tobesaved, +} + +job.objects = jobobjects local function initializer() - collected, tobesaved = jobobjects.collected, jobobjects.tobesaved + collected = jobobjects.collected + tobesaved = jobobjects.tobesaved end -job.register('jobobjects.collected', jobobjects.tobesaved, initializer, nil) +job.register('job.objects.collected', tobesaved, initializer, nil) function jobobjects.save(tag,number,page) local t = { number, page } diff --git a/Master/texmf-dist/tex/context/base/pack-obj.mkiv b/Master/texmf-dist/tex/context/base/pack-obj.mkiv index 81220e32437..3d87f52b57d 100644 --- a/Master/texmf-dist/tex/context/base/pack-obj.mkiv +++ b/Master/texmf-dist/tex/context/base/pack-obj.mkiv @@ -41,7 +41,7 @@ % function objects.register(name) % objects.n = objects.n + 1 % local list = texbox.objectbox -% nodes.process_page(list) +% nodes.handlers.finalize(list) % data[name] = { % codeinjections.restore(list), % texdimen.objectwd, @@ -90,6 +90,8 @@ % end % \stopluacode % +% \unprotect +% % \newbox \objectbox % \newtoks \everyobject % \newif \ifinobject @@ -101,7 +103,7 @@ % % \def\objectoffset{1cm} % -% \everyobject{\the\everyPDFxform} +% \everyobject{\the\pdfbackendeveryxform} % % \let\doresetobjects\relax % @@ -263,25 +265,55 @@ {\globalpopmacro\crossreferenceobject \dododosetobject{#1}{#2}{#3}\egroup}} -\def\dododosetobject#1#2#3% - {\begingroup - \dontshowcomposition % rather fuzzy in \setxvalue ... \hbox - \scratchdimen\objectoffset - \@EA\xdef\csname\r!object#2::#3\endcsname - {\noexpand\dohandleobject{#2}{#3}% - {\ifhbox\nextbox\hbox\else\vbox\fi}% - {\number\nextboxwd}{\number\nextboxht}{\number\nextboxdp}% - {\number\scratchdimen}}% - \expanded % freeze the dimensions since \dostartobject may use \nextbox - {\dostartobject{#2}{#3}{\the\nextboxwd}{\the\nextboxht}{\the\nextboxdp}}% - \ifcase#1\relax\else \ifdim\objectoffset>\zeropoint - \setbox\nextbox\vbox spread 2\scratchdimen - {\forgetall \offinterlineskip - \vss\hbox spread 2\scratchdimen{\hss\flushnextbox\hss}\vss}% - \fi \fi - \flushnextbox - \dostopobject - \endgroup} +\ifnum\luatexversion<66 + + \def\dododosetobject#1#2#3% this is a hack: luatex adds 1bp around each side + {\begingroup + \dontshowcomposition % rather fuzzy in \setxvalue ... \hbox + \ifcase#1\relax + \scratchdimen-\onebasepoint % compensates auto 1 bp + \else\ifdim\objectoffset>\zeropoint + \scratchdimen \objectoffset + \else + \scratchdimen-\onebasepoint % compensates auto 1 bp + \fi\fi + \@EA\xdef\csname\r!object#2::#3\endcsname + {\noexpand\dohandleobject{#2}{#3}% + {\ifhbox\nextbox\hbox\else\vbox\fi}% + {\number\nextboxwd}{\number\nextboxht}{\number\nextboxdp}% + {\number\scratchdimen}}% + \expanded % freeze the dimensions since \dostartobject may use \nextbox + {\dostartobject{#2}{#3}{\the\nextboxwd}{\the\nextboxht}{\the\nextboxdp}}% + \setbox\nextbox\vbox spread 2\scratchdimen + {\forgetall \offinterlineskip + \vss\hbox spread 2\scratchdimen{\hss\flushnextbox\hss}\vss}% + \flushnextbox + \dostopobject + \endgroup} + +\else + + \def\dododosetobject#1#2#3% + {\begingroup + \dontshowcomposition % rather fuzzy in \setxvalue ... \hbox + \scratchdimen\objectoffset + \@EA\xdef\csname\r!object#2::#3\endcsname + {\noexpand\dohandleobject{#2}{#3}% + {\ifhbox\nextbox\hbox\else\vbox\fi}% + {\number\nextboxwd}{\number\nextboxht}{\number\nextboxdp}% + {\number\scratchdimen}}% + \expanded % freeze the dimensions since \dostartobject may use \nextbox + {\dostartobject{#2}{#3}{\the\nextboxwd}{\the\nextboxht}{\the\nextboxdp}}% + \ifcase#1\relax\else \ifdim\objectoffset>\zeropoint + \setbox\nextbox\vbox spread 2\scratchdimen + {\forgetall \offinterlineskip + \vss\hbox spread 2\scratchdimen{\hss\flushnextbox\hss}\vss}% + \fi \fi + \flushnextbox + \dostopobject + \endgroup} + +\fi \def\getobject#1#2% {\begingroup @@ -353,8 +385,8 @@ % no undefined test ! ! ! ! (pdftex fails on undefined objects) -\def\doregisterobjectreference#1#2#3{\normalexpanded{\noexpand\ctxlatelua{jobobjects.save("#1::#2",#3,\noexpand\the\realpageno)}}} -\def\dooverloadobjectreference#1#2#3{\ctxlua{jobobjects.set("#1::#2",#3,\the\realpageno)}} +\def\doregisterobjectreference#1#2#3{\normalexpanded{\noexpand\ctxlatelua{job.objects.save("#1::#2",#3,\noexpand\the\realpageno)}}} +\def\dooverloadobjectreference#1#2#3{\ctxlua{job.objects.set("#1::#2",#3,\the\realpageno)}} \def\dosetobjectreference {\ifcase\crossreferenceobject @@ -370,8 +402,8 @@ \def\defaultobjectreference#1#2{0} % driver dependent \def\defaultobjectpage #1#2{\realfolio} -\def\dogetobjectreference #1#2#3{\xdef#3{\ctxlua{jobobjects.number("#1::#2","\defaultobjectreference{#1}{#2}")}}} -\def\dogetobjectreferencepage#1#2#3{\xdef#3{\ctxlua{jobobjects.page("#1::#2","\defaultobjectpage{#1}{#2}")}}} +\def\dogetobjectreference #1#2#3{\xdef#3{\ctxlua{job.objects.number("#1::#2","\defaultobjectreference{#1}{#2}")}}} +\def\dogetobjectreferencepage#1#2#3{\xdef#3{\ctxlua{job.objects.page("#1::#2","\defaultobjectpage{#1}{#2}")}}} \def\setobject {\driverreferenced\dosetobject1} \def\settightobject{\driverreferenced\dosetobject0} @@ -394,6 +426,6 @@ \expandafter\secondoftwoarguments \fi} -\def\doifobjectreferencefoundelse#1#2{\ctxlua{jobobjects.doifelse("#1::#2")}} +\def\doifobjectreferencefoundelse#1#2{\ctxlua{job.objects.doifelse("#1::#2")}} \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/pack-pos.mkiv b/Master/texmf-dist/tex/context/base/pack-pos.mkiv new file mode 100644 index 00000000000..42a80b5ae27 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/pack-pos.mkiv @@ -0,0 +1,151 @@ +%D \module +%D [ file=pack-pos, +%D version=2010.11.17 % real old code, updated a bit +%D title=\CONTEXT\ Packaging Macros, +%D subtitle=Positioning, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{ConTeXt Packaging Macros / Positioning} + +\unprotect + +% An old but still usefull mechanism (updated in mkiv): +% +% \ruledvbox{\startpositioning +% \position(1,1){test} +% \position[xstep=relative](1,1){test} +% \position[ystep=relative](3,-1){test} +% \position(10,10){test} +% \stoppositioning} + +\newdimen\positioningxposition \newdimen\positioningyposition +\newdimen\positioningxdimension \newdimen\positioningydimension +\newdimen\positioningxoffset \newdimen\positioningyoffset + +\newbox\positioningbox + +\unexpanded\def\startpositioning + {\dosingleempty\dostartpositioning} + +\def\dostartpositioning[#1]% + {\bgroup + \getparameters[\??ps][#1]% + \positioningxposition \zeropoint \positioningyposition \zeropoint + \positioningxdimension\zeropoint \positioningydimension\zeropoint + \positioningxoffset \zeropoint \positioningyoffset \zeropoint + \hfuzz \paperwidth \vfuzz \paperheight + \setbox\positioningbox\hbox\bgroup + \ignorespaces} + +\unexpanded\def\stoppositioning + {\removeunwantedspaces + \doifnot\@@psoffset\v!yes + {\global\positioningxoffset\zeropoint + \global\positioningyoffset\zeropoint}% + \global\advance\positioningxdimension \positioningxoffset + \global\advance\positioningydimension \positioningyoffset + \egroup + \vbox to \positioningydimension + {\vskip\positioningyoffset + \hbox to \positioningxdimension + {\hskip\positioningxoffset + \box\positioningbox + \hfill} + \vfill}% + \egroup} + +% \def\resetpositioning +% {\getparameters[\??ps] +% [\c!state=\v!start, +% \c!unit=\s!cm, +% \c!factor=\plusone, +% \c!scale=\plusone, +% \c!xfactor=\@@psfactor, +% \c!yfactor=\@@psfactor, +% \c!xscale=\@@psscale, +% \c!yscale=\@@psscale, +% \c!xstep=\v!absolute, +% \c!ystep=\v!absolute, +% \c!xoffset=\zeropoint, +% \c!yoffset=\zeropoint]} + +\def\resetpositioning + {\let\@@psstate \v!start + \let\@@psunit \s!cm + \let\@@psfactor \plusone + \let\@@psscale \plusone + \def\@@psxfactor{\@@psfactor}% + \def\@@psyfactor{\@@psfactor}% + \def\@@psxscale {\@@psscale}% + \def\@@psyscale {\@@psscale}% + \let\@@psxstep \v!absolute + \let\@@psystep \v!absolute + \let\@@psxoffset \zeropoint + \let\@@psyoffset \zeropoint} + +\resetpositioning + +\unexpanded\def\setuppositioning + {\resetpositioning + \dodoubleargument\getparameters[\??ps]} + +\def\calculateposition#1#2#3#4#5#6#7#8#9% + {\setdimensionwithunit\scratchdimen{#1}\@@psunit + \scratchdimen#8\scratchdimen + \scratchdimen#9\scratchdimen + \advance\scratchdimen #4\relax + % == \scratchdimen\dimexpr#8\dimexpr#9\scratchdimen\relax+#4\relax + \doif{#2}\v!relative + {\advance\scratchdimen#3% + \let#4\zeropoint}% + #3\scratchdimen + \doifnot\@@psstate\v!overlay + {\scratchdimen\dimexpr#5+#3\relax + \ifdim #3<-#7\relax \global#7-#3\relax \fi + \ifdim\scratchdimen> #6\relax \global#6\scratchdimen\fi}} + +\def\position + {\dosingleempty\doposition} + +\def\doposition[#1]#2(#3,#4)% + {\removeunwantedspaces + \dowithnextbox{\dodoposition{#1}{#2}{#3}{#4}}\hbox} + +\def\dodoposition#1#2#3#4% + {\bgroup + \dontcomplain + \getparameters[\??ps][#1]% + \calculateposition{#3}\@@psxstep\positioningxposition\@@psxoffset\nextboxwd \positioningxdimension\positioningxoffset\@@psxscale\@@psxfactor + \calculateposition{#4}\@@psystep\positioningyposition\@@psyoffset\nextboxhtdp\positioningydimension\positioningyoffset\@@psyscale\@@psyfactor + \vbox to \zeropoint + {\vskip\positioningyposition + \hbox to \zeropoint + {\hskip\positioningxposition + \flushnextbox + \hss} + \vss}% + \normalexpanded + {\egroup + \positioningxposition\the\positioningxposition + \positioningyposition\the\positioningyposition + \def\noexpand\@@psxoffset{\the\dimexpr\@@psxoffset}% + \def\noexpand\@@psyoffset{\the\dimexpr\@@psyoffset}}% + \ignorespaces} + +\setuppositioning + [\c!unit=\s!cm, + \c!factor=\plusone, + \c!scale=\plusone, + \c!xstep=\v!absolute, + \c!ystep=\v!absolute, + \c!offset=\v!yes, + \c!xoffset=\zeropoint, + \c!yoffset=\zeropoint] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/pack-rul.lua b/Master/texmf-dist/tex/context/base/pack-rul.lua index 378167c979a..181bff2343f 100644 --- a/Master/texmf-dist/tex/context/base/pack-rul.lua +++ b/Master/texmf-dist/tex/context/base/pack-rul.lua @@ -10,16 +10,23 @@ if not modules then modules = { } end modules ['pack-rul'] = {

An explanation is given in the history document mk.

--ldx]]-- -local texdimen, texcount, texbox = tex.dimen, tex.count, tex.box +local texsetdimen, texsetcount, texbox = tex.setdimen, tex.setcount, tex.box local hpack, free, copy, traverse_id = node.hpack, node.free, node.copy_list, node.traverse_id +local texdimen, texcount = tex.dimen, tex.count + +-- fastrepack function commands.doreshapeframedbox(n) - local noflines, lastlinelength, box = 0, 0, texbox[n] + local box, noflines, firstheight, lastdepth, lastlinelength = texbox[n], 0, nil, nil, 0 if box.width ~= 0 then local list = box.list if list then local width, done = 0, false for h in traverse_id('hlist',list) do -- no dir etc needed + if not firstheight then + firstheight = h.height + end + lastdepth = h.depth local l = h.list if l then done = true @@ -48,6 +55,28 @@ function commands.doreshapeframedbox(n) end end end - texdimen["framedlastlength"] = lastlinelength - texcount["framednoflines"] = noflines +--~ print("reshape", noflines, firstheight or 0, lastdepth or 0) + texsetcount("global","framednoflines", noflines) + texsetdimen("global","framedfirstheight", firstheight or 0) + texsetdimen("global","framedlastdepth", lastdepth or 0) +end + +function commands.doanalyzeframedbox(n) + local box, noflines, firstheight, lastdepth = texbox[n], 0, nil, nil + if box.width ~= 0 then + local list = box.list + if list then + for h in traverse_id('hlist',list) do + if not firstheight then + firstheight = h.height + end + lastdepth = h.depth + noflines = noflines + 1 + end + end + end +--~ print("analyze", noflines, firstheight or 0, lastdepth or 0) + texsetcount("global","framednoflines", noflines) + texsetdimen("global","framedfirstheight", firstheight or 0) + texsetdimen("global","framedlastdepth", lastdepth or 0) end diff --git a/Master/texmf-dist/tex/context/base/pack-rul.mkiv b/Master/texmf-dist/tex/context/base/pack-rul.mkiv index afacc2901b1..c137aea01a2 100644 --- a/Master/texmf-dist/tex/context/base/pack-rul.mkiv +++ b/Master/texmf-dist/tex/context/base/pack-rul.mkiv @@ -328,6 +328,16 @@ \box\scratchbox \egroup} +%D \macros +%D {overlayfakebox} + +\def\overlayfakebox + {\hbox + {\setbox\scratchbox\emptyhbox + \wd\scratchbox\overlaywidth + \ht\scratchbox\overlayheight + \box\scratchbox}} + %D The empty case is: \let\executeoverlay\gobblesevenarguments @@ -469,7 +479,7 @@ \fi\fi} \def\dostrokedlinedbox - {\setbox\scratchbox\null + {\setbox\scratchbox\emptyhbox \wd\scratchbox\frameddimenwd \ht\scratchbox\frameddimenht \dp\scratchbox\frameddimendp @@ -571,8 +581,6 @@ %D start with defining some booleans. These give an impression %D of what we are going to take into account. -% todo: chardefs - \newif\ifboxhasoffset \newif\ifboxhaswidth \newif\ifboxhasheight @@ -612,8 +620,6 @@ \def\inheritlocalframed[#1]#2[#3]{\letvalue{#1\s!parent}#3} \def\copylocalframed [#1]#2[#3]{\setvalue{#1\s!parent}{#3}} -\let\setuplocalframed\getparameters % obsolete - \presetlocalframed[\??ol] \newcount\framednesting @@ -622,28 +628,38 @@ {\bgroup \advance\framednesting\plusone \expandafter\let\csname\??ol:\the\framednesting\s!parent\endcsname\??ol - \dodoubleempty\startlocalframed[\??ol:\the\framednesting]} + \dodoubleempty\dolocalframed[\??ol:\the\framednesting]} \unexpanded\def\setupframed {\dodoubleempty\dosetupframed} -\def\dosetupframed +% \def\dosetupframed +% {\ifsecondargument +% \@EA\dodoublesetupframed +% \else +% \@EA\dosinglesetupframed +% \fi} + +% we can consider setting the parent of the regular framed to +% something else in the otr so that we isolate it there + +\def\dosetupframed[#1][#2]% {\ifsecondargument - \@EA\dodoublesetupframed + \getparameters[\??ol#1][#2]% \else - \@EA\dosinglesetupframed + \getparameters[\??ol][#1]% \fi} -\def\dosinglesetupframed[#1][#2]% - {\getparameters[\??ol][#1]} +% \def\dosinglesetupframed[#1][#2]% +% {\getparameters[\??ol][#1]} -\def\dodoublesetupframed[#1][#2]% - {\bgroup - \let\dodoubleempty\empty - \def\doframed[##1]{\gdef\globalredefinedframed{\dodoubleempty\doframed[##1,#2]}}% - \getvalue{#1}% - \egroup - \letvalue{#1}\globalredefinedframed} +% \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} @@ -655,7 +671,6 @@ %D %D \startbuffer %D \presetlocalframed[myframed] -%D \setuplocalframed[myframed][width=4cm,height=2cm] %D \localframed[myframed][framecolor=green]{oeps} %D \stopbuffer %D @@ -675,14 +690,10 @@ \newif\ifinframed -\def\localframed - {\bgroup - \dodoubleempty\startlocalframed} - %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 +\unexpanded\def\fastlocalframed[#1]#2[#3]#4% 3-4 {\bgroup \inframedtrue \edef\@@framed{#1}% @@ -884,14 +895,40 @@ % todo: protect local \framednames -\unexpanded\def\startlocalframed[#1][#2]% +\unexpanded\def\localframed + {\bgroup + \dodoubleempty\dolocalframed} + +\unexpanded\def\dolocalframed[#1][#2]% assumes a \dodoubleempty (slows down), also should have leading \bgroup {\bgroup \inframedtrue \edef\@@framed{#1}% \ifsecondargument % faster \getparameters[\@@framed][#2]% here ! \fi - \!!framedframeoffset\framedparameter\c!frameoffset + \dodolocalframed} + +\unexpanded\def\directlocalframed[#1]% no optional + {\bgroup + \bgroup + \inframedtrue + \edef\@@framed{#1}% + \dodolocalframed} + +\unexpanded\def\localframedwithsettings[#1][#2]% no checking (so no spaces between) + {\bgroup + \bgroup + \inframedtrue + \edef\@@framed{#1}% + \getparameters[\@@framed][#2]% here ! + \dodolocalframed} + +\def\c!fr!analyze{fr:analyze} % private option + +% we can make macros for the offset, width, and height branches or do an \csname + +\unexpanded\def\dodolocalframed + {\!!framedframeoffset\framedparameter\c!frameoffset \edef\@@framedbackgroundoffset{\framedparameter\c!backgroundoffset}% \ifx\@@framedbackgroundoffset\v!frame \!!framedbackgroundoffset\!!framedframeoffset @@ -922,6 +959,7 @@ \edef\@@localorientation{\framedparameter\c!orientation}% % \edef\@@localautowidth {\framedparameter\c!autowidth}% + \edef\@@localfranalyze {\framedparameter\c!fr!analyze}% experimental option % \ifx\@@localframing\v!overlay % no frame, no offset, no framewidth \boxhasframefalse @@ -973,7 +1011,14 @@ \fi\fi \!!framedheight\zeropoint \!!framedwidth \zeropoint - \ifx\localwidth\v!fit + \ifx\localwidth\empty % fallback to fit + \ifboxhasformat + \boxhaswidthtrue + \!!framedwidth\hsize + \else + \boxhaswidthfalse + \fi + \else\ifx\localwidth\v!fit \ifboxhasformat \boxhaswidthtrue \!!framedwidth\hsize @@ -997,15 +1042,17 @@ \else \boxhaswidthtrue \!!framedwidth\localwidth - \fi\fi\fi\fi - \ifx\localheight\v!fit + \fi\fi\fi\fi\fi + \ifx\localheight\empty % fallback to fit + \boxhasheightfalse + \else\ifx\localheight\v!fit \boxhasheightfalse % no longer: \boxhasstrutfalse \else\ifx\localheight\v!broad \boxhasheightfalse \else \boxhasheighttrue \!!framedheight\localheight - \fi\fi + \fi\fi\fi \ifboxhasheight % obey user set height, also downward compatible \else @@ -1113,7 +1160,7 @@ \def\dowithframebox {% moved : \let\postprocessframebox\relax - \stoplocalframed} + \finishlocalframed} \def\dodowithframebox {\aftergroup\dowithframebox} @@ -1127,6 +1174,23 @@ %D Nevertheless we implement the whole scheme, if not for %D future extensions. +%D \macros +%D {\doassigncheckedframeoffset} +%D +%D Offset helper (see menus): + +\def\doassigncheckedframeoffset#1#2% + {\edef\checkedframeoffset{#2}% + #1% + \ifx\checkedframeoffset\empty \zeropoint\else + \ifx\checkedframeoffset\v!overlay\zeropoint\else + \ifx\checkedframeoffset\v!none \zeropoint\else + \ifx\checkedframeoffset\v!frame \zeropoint\else + \ifx\checkedframeoffset\v!default\zeropoint\else + #2% + \fi\fi\fi\fi\fi + \relax} + %D \macros %D {ifreshapeframebox} %D @@ -1153,31 +1217,59 @@ %D ...,bottom=\kern0pt,... %D \stoptyping -\unexpanded\def\stoplocalframed +% experiment ... \@@localfranalyze -> we could support 'first' as location key +% option but then we will always do an analysis and reimplement the location +% options (btw, beware of location settings of derived functionality that bleed +% into this + +\def\finishlocalframeda + {\ifreshapeframebox + \doreshapeframedbox + \else\ifx\@@localfranalyze\v!yes + \doanalyzeframedbox + \else + \resetshapeframebox + \fi\fi + \boxhaswidthfalse} + +\def\finishlocalframedb + {\ifx\@@localfranalyze\v!yes + \doanalyzeframedbox + \else + \resetshapeframebox + \fi + \boxhaswidthfalse} + +\def\finishlocalframedc + {\ifx\@@localfranalyze\v!yes + \doanalyzeframedbox + \else + \resetshapeframebox + \fi} + +\unexpanded\def\finishlocalframed {\dontshowcomposition \@@stopframedorientation % hm, wrong place ! should rotate the result (after reshape) \handleframedlocator\c!before\@@locallocation \ifboxhasformat \ifx\@@localautowidth\v!force - \ifreshapeframebox\doreshapeframedbox\fi - \boxhaswidthfalse - \else - \ifx\localwidth\v!fit - \ifx\@@localautowidth\v!yes - \ifreshapeframebox\doreshapeframedbox\fi - \fi - \boxhaswidthfalse - \else\ifx\localwidth\v!fixed - \boxhaswidthfalse + \finishlocalframeda + \else\ifx\localwidth\v!fit + \ifx\@@localautowidth\v!yes + \finishlocalframeda \else - \resetshapeframebox - \fi\fi + \finishlocalframedb + \fi + \else\ifx\localwidth\v!fixed + \finishlocalframedb + \else + \finishlocalframedc + \fi\fi\fi + \ifconditional\boxcontentneedsprocessing + \mkdoprocessboxcontents\framebox \fi - \ifconditional\boxcontentneedsprocessing - \mkdoprocessboxcontents\framebox - \fi - \else - \resetshapeframebox + \else + \finishlocalframedc \fi \ifboxhaswidth \wd\framebox\!!framedwidth @@ -1212,7 +1304,7 @@ \egroup} \def\dosetfakedframebox - {\setbox\scratchbox\null + {\setbox\scratchbox\emptyhbox \wd\scratchbox\wd\framebox \ht\scratchbox\ht\framebox \dp\scratchbox\dp\framebox @@ -1622,13 +1714,13 @@ %D Beware, since we entered a group and either or not grab the next %D bgroup token, we need to finish the group in the oneliner mode. -\ifx\raggedoneliner\undefined \chardef\raggedoneliner\zerocount \fi +\ifdefined\raggedonelinerstate \else \newconditional\raggedonelinerstate \fi \def\doformatonelinerbox % beware: assumes explicit preceding bgroup - {\ifcase\raggedoneliner - \expandafter\nodoformatonelinerbox - \else + {\ifconditional\raggedonelinerstate \expandafter\dodoformatonelinerbox + \else + \expandafter\nodoformatonelinerbox \fi} \def\dodoformatonelinerbox @@ -1827,21 +1919,20 @@ %D doing so, we need to reshape the box: \newcount\framednoflines -\newdimen\framedlastlength +\newdimen\framedfirstheight +\newdimen\framedlastdepth \def\resetshapeframebox - {\framednoflines \zerocount - \framedlastlength\zeropoint} + {\framednoflines \zerocount + \framedfirstheight\zeropoint + \framedlastdepth \zeropoint} \let\framedboxwidth \!!zeropoint \let\framedboxheight\!!zeropoint \let\framedboxdepth \!!zeropoint -\def\doreshapeframedbox{\ifvbox\framebox\ctxlua{commands.doreshapeframedbox(\number\framebox)}\fi} - -%D The two variables \type {\framednoflines} and \type -%D {\framedlastlength} can be used in a second pass to -%D optimized framed material. +\def\doreshapeframedbox{\ifvbox\framebox\ctxcommand{doreshapeframedbox(\number\framebox)}\fi} +\def\doanalyzeframedbox{\ifvbox\framebox\ctxcommand{doanalyzeframedbox(\number\framebox)}\fi} % torture test / strange case (much depth) / method 2 needed % @@ -2011,10 +2102,10 @@ %D sort of newline signal. In horizontal boxes it expands to a %D space. -\def\vboxednewline +\unexpanded\def\vboxednewline {\endgraf\ignorespaces} -\def\hboxednewline +\unexpanded\def\hboxednewline {\unskip\normalspace\ignorespaces} %D We can set each rule on or off. The default setting is @@ -2082,10 +2173,12 @@ %D %D \showsetup{blackrule} -\def\complexblackrule[#1]% +\definecomplexorsimple\blackrule + +\unexpanded\def\complexblackrule[#1]% {\hbox\bgroup\getparameters[\??bj][#1]\domakeblackrule\egroup} -\def\simpleblackrule +\unexpanded\def\simpleblackrule {\hbox\bgroup\domakeblackrule\egroup} \def\domakeblackrule @@ -2099,8 +2192,6 @@ \!!depth \@@bjdepth \stopcolor} -\definecomplexorsimple\blackrule - %D \macros %D {blackrules} %D @@ -2290,20 +2381,18 @@ \def\dovlwdhtdp#1#2#3% {\bgroup - \!!dimena#2\strutht - \!!dimenb#3\strutdp \setbox\scratchbox\hbox {\vrule \!!width #1\linewidth - \!!height\!!dimena - \!!depth \!!dimenb}% + \!!height#2\strutht + \!!depth #3\strutdp}% \dp\scratchbox\strutdp \ht\scratchbox\strutht \box\scratchbox \egroup} \def\complexvl[#1]% - {\dovlwdhtdp{1}{#1}{#1}} + {\dovlwdhtdp\plusone{#1}{#1}} \def\complexhl[#1]% {\hbox @@ -2361,25 +2450,27 @@ %D %D which looks like: \thinrules[n=2] +\newconstant\ruletype + \def\thinrule {\strut \bgroup - \chardef\ruletype\plusone + \ruletype\plusone \processaction [\@@dlalternative] - [ \v!a=>\chardef\ruletype0,% no line - %\v!b=>\chardef\ruletype1,% height/depth - \v!c=>\chardef\ruletype2,% topheight/botdepth - % 11=>\chardef\ruletype1,% fallback for backgrounds - 0=>\chardef\ruletype0,% compatible with backgrounds - % 1=>\chardef\ruletype1,% compatible with backgrounds - 2=>\chardef\ruletype2]% compatible with backgrounds + [ \v!a=>\ruletype\zerocount,% no line + %\v!b=>\ruletype\plusone ,% height/depth + \v!c=>\ruletype\plustwo ,% topheight/botdepth + % 11=>\ruletype\plusone ,% fallback for backgrounds + 0=>\ruletype\zerocount,% compatible with backgrounds + % 1=>\ruletype\plusone ,% compatible with backgrounds + 2=>\ruletype\plustwo ]% compatible with backgrounds \doifsomething\@@dlrulethickness {\linewidth\@@dlrulethickness}% \ifdim\linewidth=\zeropoint - \chardef\ruletype\zerocount + \ruletype\zerocount \else - \doifnot\@@dlframe\v!on{\chardef\ruletype\zerocount}% + \doifnot\@@dlframe\v!on{\ruletype\zerocount}% \fi \ifnum\ruletype=\plusone \doif\@@dlheight\v!max{\let\@@dlheight\!!plusone}% @@ -2622,108 +2713,78 @@ %D %D The next definition shows the defaults. -\def\dodefineframedtext[#1][#2]% - {\presetlocalframed[\??kd#1]% - \getparameters[\??kd#1] - [\c!width=0.75\hsize, - \c!height=\v!fit, - \c!align=\v!yes, - \c!top=, - \c!bottom=\vfill, - \c!offset=1em, - \c!bodyfont=, - \c!style=, - \c!color=, - \c!left=, - \c!right=\hfill, - \c!before=\blank, - \c!after=\blank, - \c!inner=, - \c!frame=\v!on, - \c!topframe=, - \c!bottomframe=, - \c!leftframe=, - \c!rightframe=, - \c!radius=.5\bodyfontsize, - \c!corner=\v!rectangular, - \c!foregroundcolor=, - \c!foregroundstyle=, - \c!background=, - \c!backgroundcolor=, - \c!backgroundscreen=\@@rsscreen, - \c!linecorrection=\v!on, - \c!depthcorrection=\v!on, - \c!margin=\v!standard, - \c!orientation=, - \c!indenting=, - #2]% - \setuvalue{\e!start#1}{\dostartframedtext[#1]}% - \setuvalue{\e!stop #1}{\dostopframedtext }% - \setuvalue {#1}{\doframedtext [#1]}} - -\unexpanded\def\defineframedtext - {\dodoubleempty\dodefineframedtext} - -%D We define the general (and original) case by just saying: - -\defineframedtext[\v!framedtext] - -%D We need several steps before the actual job is done, -%D because we have to handle an optional identifier (and -%D because these commands evolved out of a single case). +\installcommandhandler \??kd {framedtext} \??kd -\def\framedtextparameter#1#2% todo: currentframedtext - {\csname\??kd#1#2\endcsname} - -\def\dosetupframedtexts[#1][#2]% - {\ifsecondargument - \def\docommand##1{\getparameters[\??kd##1][#2]}% - \processcommacommand[#1]\docommand % new, #1 may be macro - \else - \getparameters[\??kd\v!framedtext][#1]% - \fi} +\let\setupframedtexts\setupframedtext -\unexpanded\def\setupframedtexts - {\dodoubleempty\dosetupframedtexts} +\presetlocalframed[\??kd] -\def\dostartframedtext - {\bgroup\dotripleempty\dodostartframedtext} +\setupframedtext + [\c!width=0.75\hsize, + \c!height=\v!fit, + \c!align=\v!yes, + %\c!top=, + \c!bottom=\vfill, + \c!offset=1em, + %\c!bodyfont=, + %\c!style=, + %\c!color=, + %\c!left=, + \c!right=\hfill, + \c!before=\blank, + \c!after=\blank, + %\c!inner=, + \c!frame=\v!on, + %\c!topframe=, + %\c!bottomframe=, + %\c!leftframe=, + %\c!rightframe=, + \c!radius=.5\bodyfontsize, + \c!corner=\v!rectangular, + %\c!orientation=, + %\c!indenting=, + %\c!foregroundcolor=, + %\c!foregroundstyle=, + %\c!background=, + %\c!backgroundcolor=, + \c!backgroundscreen=\@@rsscreen, + \c!linecorrection=\v!on, + \c!depthcorrection=\v!on, + \c!margin=\v!standard] -\def\dodostartframedtext[#1][#2][#3]% - {\doifassignmentelse{#2} - {\dododostartframedtext[#1][][#2]} - {\dododostartframedtext[#1][#2][#3]}} +\appendtoks + \setuevalue{\e!start\currentframedtext}{\dostartframedtext{\currentframedtext}}% + \setuevalue{\e!stop \currentframedtext}{\dostopframedtext }% + \setuevalue {\currentframedtext}{\doframedtext {\currentframedtext}}% +\to \everydefineframedtext -\setfalse\framedtextlocationnone +\unexpanded\def\dostartframedtext#1% + {\bgroup + \edef\currentframedtext{#1}% + \dodoubleempty\dodostartframedtext} -\def\checkframedtext % messy dependency - {\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} +\def\dodostartframedtext[#1][#2]% + {\doifassignmentelse{#1} + {\dododostartframedtext[][#1]} + {\dododostartframedtext[#1][#2]}} -\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 +\def\dododostartframedtext[#1][#2]% #2 only passed to framed, not to framedtext + {\setupframedtexts[\currentframedtext][#2]% + \doifsomething{#1}{\setframedtextparameter\c!location{#1}}% does not listen to #3 \setfalse\framedtextlocationnone + % somewhat messy ... needs to be redone \processaction % \v!low en \v!depth are already taken ! - [\framedtextparameter{#1}\c!location] - [ \v!left=>\letvalue{\??kd#1\c!left }\relax - \letvalue{\??kd#1\c!right}\hfill, - \v!right=>\letvalue{\??kd#1\c!left }\hfill - \letvalue{\??kd#1\c!right}\relax, - \v!middle=>\letvalue{\??kd#1\c!left }\hfill - \letvalue{\??kd#1\c!right}\hfill, - \v!none=>\letvalue{\??kd#1\c!left }\relax % new - \letvalue{\??kd#1\c!right}\relax % new + [\framedtextparameter\c!location] + [ \v!left=>\letframedtextparameter\c!left \relax + \letframedtextparameter\c!right\hfill, + \v!right=>\letframedtextparameter\c!left \hfill + \letframedtextparameter\c!right\relax, + \v!middle=>\letframedtextparameter\c!left \hfill + \letframedtextparameter\c!right\hfill, + \v!none=>\letframedtextparameter\c!left \relax % new + \letframedtextparameter\c!right\relax % new \settrue\framedtextlocationnone]% - \letvalue{\??kd#1\c!location}\empty + \resetframedtextparameter\c!location % removed 06/2001 % \forgetparindent % added 06/2001 [see demo-bbv] @@ -2733,43 +2794,28 @@ \startboxedcontent \hsize\localhsize % \insidefloattrue % ? better - \normalexpanded{\noexpand\switchtobodyfont[\framedtextparameter{#1}\c!bodyfont]}% - \startcolor[\framedtextparameter{#1}\c!color]% - \localframed[\??kd#1][\c!strut=\v!no,#3]% todo: use delayedstrut + \normalexpanded{\noexpand\switchtobodyfont[\framedtextparameter\c!bodyfont]}% + \startcolor[\framedtextparameter\c!color]% + \localframed[\??kd\currentframedtext][\c!strut=\v!no]% todo: use delayedstrut \bgroup \let\\=\endgraf - \framedtextparameter{#1}\c!inner % oud spul - \doifvalue{\??kd#1\c!depthcorrection}\v!on % new, inside box - {\bgroup - \verticalstrut - % we need \nowhitespace in case of setups setting whitespace - % nb, not safe, text vs \vbox as next - \vskip-\struttotal - \nowhitespace % na vskip ! new 20/05/2004, fails with next content being box (\scale{..}) - }% + \framedtextparameter\c!inner % oud spul + \doif{\framedtextparameter\c!depthcorrection}\v!on\doftstartdepthcorrection \doinhibitblank % \blank[\v!disable]% plaatst signal -\setupindenting[\framedtextparameter{#1}\c!indenting]% - \doconvertfont{\framedtextparameter{#1}\c!style}\empty - \def\dostopframedtext{\dodostopframedtext{#1}{#2}}} + \setupindenting[\framedtextparameter\c!indenting]% + %\doconvertfont{\framedtextparameter\c!style}\empty} %%%%% todo: attr setter + \dosetframedtextattributes\c!style\c!color} %D The \type {none} option is handy for nested usage, as %D in the presentation styles, where we don't want %D interference. -\def\dodostopframedtext#1#2% % no \baselinecorrection, see faq docs +\defineplacement[\??kd][\s!parent=\??kd\currentframedtext] + +\unexpanded\def\dostopframedtext % no \baselinecorrection, see faq docs {\endgraf \removelastskip - \doifvalue{\??kd#1\c!depthcorrection}\v!on % local and global - {\forgetall - \vskip-\struttotal - \verticalstrut - \egroup - \forgetall % brrr too often - \vskip-\lineheight - % will be an option, not default - % \setbaselinecorrections - % \donegbotbaselinecorrection - \verticalstrut} + \doif{\framedtextparameter\c!depthcorrection}\v!on\doftstopdepthcorrection \stopboxedcontent \stopcolor \ifconditional\framedtextlocationnone @@ -2780,10 +2826,47 @@ \box\framebox \else \egroup - \doplacement[\??kd#1][\c!depthcorrection=\v!off]{\box\framebox}% + \placement[\??kd][\c!depthcorrection=\v!off]{\box\framebox}% \fi\fi \egroup} +%D We define the general (and original) case by just saying: + +\setfalse\framedtextlocationnone + +\def\checkframedtext % messy dependency + {\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} + +\def\doftstartdepthcorrection + {\bgroup + \verticalstrut + % we need \nowhitespace in case of setups setting whitespace + % nb, not safe, text vs \vbox as next + \vskip-\struttotal + \nowhitespace} % na vskip ! new 20/05/2004, fails with next content being box (\scale{..}) + +\def\doftstopdepthcorrection + {\forgetall + \vskip-\struttotal + \verticalstrut + \egroup + \forgetall % brrr too often + \vskip-\lineheight + % will be an option, not default + % \setbaselinecorrections + % \donegbotbaselinecorrection + \verticalstrut} + %D Placement can be ignored: %D %D \starttyping @@ -2802,17 +2885,19 @@ %D The simple brace (or group) delimited case is typeset %D slightly different and is not aligned. -\def\doframedtext - {\bgroup\dodoubleempty\dodoframedtext} +\unexpanded\def\doframedtext#1% + {\bgroup + \edef\currentframedtext{#1}% + \dosingleempty\dodoframedtext} -\def\dodoframedtext[#1][#2]% beware! - {\normalexpanded{\noexpand\switchtobodyfont[\getvalue{\??kd#1\c!bodyfont}]}% - \localframed[\??kd#1][\c!strut=\v!no,#2]% +\def\dodoframedtext[#1]% beware! + {\normalexpanded{\noexpand\switchtobodyfont[\\framedtextparameter\c!bodyfont]}% + \localframed[\??kd\currentframedtext][\c!strut=\v!no,#1]% \bgroup \blank[\v!disable]% \let\\=\endgraf - \getvalue{\??kd#1\c!inner}% % kleur naar outer level - \dostartattributes{\??kd#1}\c!style\c!color\empty + \framedtextparameter\c!inner + \dosetframedtextattributes\c!style\c!color \bgroup \aftergroup\docloseframedtext \let\next=} @@ -2823,23 +2908,46 @@ \egroup \egroup} +\defineframedtext[\v!framedtext] + %D \macros %D {defineframed} %D %D One can also define simple framed texts, using: %D %D \showsetup{defineframed} +%D +%D As suggested by Wolfgang we can now use the new \MKIV\ inheritance +%D model instead of passing a combination of arguments. This also +%D also simplified the \type {\setupframed} command. There are +%D certainly more places where such improvements can be made. -\unexpanded\def\defineframed +\def\defineframed {\dodoubleempty\dodefineframed} \def\dodefineframed[#1][#2]% - {\iffirstargument - \setuvalue{#1}{\dodoubleempty\doframed[#2]}% - \fi} + {\ifcsname\??ol:#1\endcsname + % already defined, keeps settings + \else + \expandafter\newcount\csname\??ol:#1\endcsname % \the\everypresetframed + \fi + \getparameters[\??ol#1][\s!parent=\??ol,#2]% + \setuvalue{#1}{\doframed[#1]}}% % \the\everydefineframed -\def\doframed[#1][#2]% - {\framed[#1,#2]} +\def\doframed[#1]% + {\bgroup + \expandafter\let\expandafter\tempframedcount\csname\??ol:#1\endcsname + \advance\tempframedcount\plusone + \expandafter\def\csname\??ol#1:\the\tempframedcount\s!parent\endcsname{\??ol#1}% \copylocalframed + \dodoubleempty\dolocalframed[\??ol#1:\the\tempframedcount]} + +%D We can do: +%D +%D \starttyping +%D \defineframed[\v!framed] +%D \stoptyping +%D +%D but the existing one is ok as well (less csname messy too). %D \macros %D {textrule, starttextrule, setuptextrules} @@ -3196,7 +3304,7 @@ % 0=no-split, 1=no-split+indent, 2=split, 3=split+indent -\chardef\backgroundsplitmode\plusthree +\setnewconstant\backgroundsplitmode\plusthree %D The \type{\vbox to \lineheight{}\vskip\zeropoint} %D construction gives the first real line a decent height by @@ -3225,7 +3333,7 @@ \dimen2\leftskip % new ** \forgetall \ifinsidefloat - \chardef\backgroundsplitmode\zerocount + \backgroundsplitmode\zerocount \fi \ifcase\backgroundsplitmode \localframed[\??ag][\c!offset=\v!overlay]{\box0}% @@ -3239,11 +3347,11 @@ \loop \ifdim\pagetotal=\zeropoint % empty page \scratchdimen\textheight - \chardef\backgroundsplit\plusone % split to max height + \backgroundsplitmode\plusone % split to max height \else \setbox\scratchbox\vbox{\@@agbefore}% \scratchdimen\dimexpr\pagegoal-\ht\scratchbox-\pagetotal\relax - \chardef\backgroundsplit\plustwo % split to partial height + \backgroundsplitmode\plustwo % split to partial height \fi \advance\scratchdimen\dimexpr-\@@agtopoffset-\@@agbottomoffset\relax \ifdim\scratchdimen>2\lineheight\relax % reasonable, will be configurable @@ -3251,9 +3359,9 @@ \setbox2\vsplit0 to \scratchdimen \else \setbox2\box0 - \chardef\backgroundsplit\zerocount % no split + \backgroundsplitmode\zerocount % no split \fi - \setbox2\vbox \ifcase\backgroundsplit\or to \textheight \fi % max split + \setbox2\vbox \ifcase\backgroundsplitmode\or to \textheight \fi % max split {\vskip\@@agtopoffset \unvcopy2 \prevdepth\dp2 @@ -3261,7 +3369,7 @@ \vskip\@@agbottomoffset \vfill} \@@agbefore - \ifcase\backgroundsplit\or\or % partial split + \ifcase\backgroundsplitmode\or\or % partial split \ifdim\pagegoal<\maxdimen \pagegoal=1.2\pagegoal % be a bit more tolerant \fi @@ -3271,7 +3379,7 @@ \ifnum\backgroundsplitmode=\plusthree \hskip\dimen2 \fi % \localframed[\??ag][\c!offset=\v!overlay]{\box2}% new ** \stoplinecorrection - \ifcase\backgroundsplit % no split + \ifcase\backgroundsplitmode % no split \@@agafter \else % some split \vfill\eject % geen \page ! @@ -3334,74 +3442,6 @@ %D %D \typebuffer -% \unexpanded\def\defineframedcontent -% {\dodoubleempty\dodefineframedcontent} -% -% \def\dodefineframedcontent[#1][#2]% -% {\presetlocalframed[\??fc#1]% -% \getparameters[\??fc#1] -% [\c!leftoffset=\zeropoint, -% \c!rightoffset=\getvalue{\??fc#1\c!leftoffset}, -% \c!topoffset=\zeropoint, -% \c!bottomoffset=\getvalue{\??fc#1\c!topoffset}, -% \c!strut=\v!no, -% \c!offset=\v!overlay, -% \c!linecorrection=\v!no, -% \c!left=, -% \c!right=, -% #2]} -% -% \unexpanded\def\setupframedcontent -% {\dodoubleempty\dosetupframedcontent} -% -% \def\dosetupframedcontent[#1][#2]% -% {\def\docommand##1{\getparameters[\??fc##1][#2]}% -% \processcommacommand[#1]\docommand} -% -% \unexpanded\def\startframedcontent[#1]% -% {\bgroup -% \doifelse{#1}\v!off -% {\let\stopframedcontent\egroup} -% {\ifcsname\??fc#1\c!frame\endcsname -% \dostartframedcontent{#1}% -% \fi}} -% -% \def\dostartframedcontent#1% -% {\unexpanded\def\stopframedcontent{\dostopframedcontent{#1}}% -% \setbox\framebox\hbox\bgroup -% \setlocalhsize -% \hsize\localhsize -% \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}% -% \vbox\bgroup -% \forgetall -% \blank[\v!disable]} -% -% \def\dostopframedcontent#1% -% {\removelastskip -% \egroup -% \vskip\getvalue{\??fc#1\c!bottomoffset}% -% \egroup -% \hskip\getvalue{\??fc#1\c!rightoffset}% -% \egroup -% \doifvalue{\??fc#1\c!width}\v!fit -% {\letvalue{\??fc#1\c!width}\v!fixed}% no shapebox -% \ifinsidefloat -% \donefalse -% \else -% \doifelsevalue{\??fc#1\c!linecorrection}\v!yes\donetrue\donefalse -% \fi -% % plaats ? -% \ifdone\startlinecorrection\fi -% \getvalue{\??fc#1\c!left}% new -% \localframed[\??fc#1]{\box\framebox}% -% \getvalue{\??fc#1\c!right}% new -% \ifdone\stoplinecorrection\fi -% \egroup} - \def\framedcontentparameter #1{\csname\doframedcontentparameter{\??fc\@@framedcontent}#1\endcsname} \def\doframedcontentparameter #1#2{\ifcsname#1#2\endcsname#1#2\else\expandafter\doframedcontentparentparameter\csname#1\s!parent\endcsname#2\fi} \def\doframedcontentparentparameter#1#2{\ifx#1\relax\s!empty\else\doframedcontentparameter#1#2\fi} @@ -3521,6 +3561,9 @@ \setuplinewidth [\v!medium] +% We could omit the empty setings but that is some 10% slower due to +% extra testing in the chain. + \setupframed [\c!width=\v!fit, \c!height=\v!broad, @@ -3554,12 +3597,12 @@ \c!align=, \c!bottom=\vss, \c!top=, - \c!strut=\v!yes, \c!autostrut=\v!yes, \c!location=\v!normal, \c!orientation=, \c!autowidth=\v!yes, - \c!setups=] + \c!setups=, + \c!strut=\v!yes] \setupscreens [%\c!factor=1.0, % obsolete diff --git a/Master/texmf-dist/tex/context/base/page-app.mkiv b/Master/texmf-dist/tex/context/base/page-app.mkiv index 7dd71cf2ab8..b42eef05403 100644 --- a/Master/texmf-dist/tex/context/base/page-app.mkiv +++ b/Master/texmf-dist/tex/context/base/page-app.mkiv @@ -13,8 +13,7 @@ \writestatus{loading}{ConTeXt Page Macros / Applications} -%D The fitting page code is moved from \type {meta-fig} to -%D here. +%D This needs an update with a proper define and inheritance. \unprotect @@ -35,7 +34,6 @@ \c!rightmargin=\!!zeropoint,\c!rightedge=\!!zeropoint, \c!header=\!!zeropoint,\c!footer=\!!zeropoint] - \def\dostartfittingpage[#1][#2]% {\page % this is kind of tricky! there can be preceding page refs \autostarttext @@ -74,7 +72,7 @@ \let\checkcurrentlayout\relax % else interference with odd/even layout \processaction [\getvalue{\currentfittingpage\c!paper}] - [ \v!auto=>\let\fittingpapersize\printpapersize, + [ \v!auto=>\def\fittingpapersize{\printpapersize}, \s!unknown=>\let\fittingpapersize\commalistelement, \s!default=>\def\fittingpapersize{\??fp\s!dummy}]% \expanded{\setuppapersize[\??fp\s!dummy][\fittingpapersize]}% @@ -85,7 +83,7 @@ \c!height=\fittinght]% \setuplayout [\v!page]% - \startmakeup[\v!standard][\c!textstate=\v!empty,\c!doublesided=\v!no,\c!page=]% + \startmakeup[\v!standard][\c!textstate=\v!empty,\c!doublesided=\v!no,\c!pagestate=\getvalue{\currentfittingpage\c!pagestate}]% \centerbox{\box\scratchbox}% \stopmakeup \stoplocallayout @@ -111,6 +109,7 @@ \setupTEXpage [\c!scale=1000, + \c!pagestate=, \c!strut=\v!no, \c!align=\v!normal, % needed, else problems ! \c!offset=\v!overlay, @@ -130,7 +129,7 @@ \unexpanded\def\startTEXstream {\dosingleempty\dostartTEXstream} -\def\dostartTEXstream[#1]% +\def\dostartTEXstream[#1]% old code, to be redone {\page \defineoutputstream[tex]% \enableoutputstream[tex]% @@ -140,61 +139,18 @@ \outputstreamunvbox[tex]% \stopTEXpage}} -%D Application pages (for an example, see \type {m-pstric}): - -\def\@@texapp{texapp} -\def\@@texdim{texdim} +%D Application pages, a quick \MKIV\ hack: -\def\saveTEXapplication#1#2% - {\immediate\openout\scratchwrite=\bufferprefix\@@texdim.tmp - \immediate\write\scratchwrite{\dimen#1=\the\ht\scratchbox}% - \immediate\write\scratchwrite{\dimen#2=\the\wd\scratchbox}% - \immediate\closeout\scratchwrite} +\definetypesetting[TEXapplication] +\definebuffer[TEXapplication] -\def\restoreTEXapplication - {\readlocfile{\bufferprefix\@@texdim.tmp}\donothing\donothing} +% we could use a counter and saves runs on numbering them. -\def\startTEXapplication - {\dosingleempty\dostartTEXapplication} +\def\TEXapplicationfilename{\jobname-texapplication.tex} -\long\def\dostartTEXapplication[#1]#2#3\stopTEXapplication - {\bgroup - \bgroup - \let\f!temporaryextension\c!tex - \setbuffer[\@@texapp]% - \starttext - #2% preamble - \startTEXpage[#1]% - \topskip\zeropoint - \setbox\scratchbox\hbox{#3}% - \saveTEXapplication02% dimensions - \box\scratchbox - \stopTEXpage - \stoptext - \endbuffer - \egroup - \doifelse\jobsuffix{dvi}\donetrue\donefalse - \executesystemcommand{texexec \bufferprefix\@@texapp.tex --once --batch}% - \ifdone % eps - \executesystemcommand{dvips -E* -o \@@texapp.eps \@@texapp}% - \else % pdf - \executesystemcommand{dvips \bufferprefix\@@texapp}% - \executesystemcommand{ps2pdf \bufferprefix\@@texapp.ps \bufferprefix\@@texapp.pdf}% -% \executesystemcommand{texmfstart pstopdf \bufferprefix\@@texapp.ps \bufferprefix\@@texapp.pdf}% - \fi - \restoreTEXapplication % dimensions - \doifelse\jobsuffix{dvi}\donetrue\donefalse - \setbox\scratchbox\hbox - {\expanded{\externalfigure - [\bufferprefix\@@texapp.\ifdone eps\else pdf\fi] - [\c!object=\v!no]}}% - \setbox\scratchbox\hbox - {\lower\ht\scratchbox\hbox{\raise\dimen2\box\scratchbox}}% - \wd\scratchbox\dimen0 - \ht\scratchbox\dimen2 - \dp\scratchbox\zeropoint - \box\scratchbox - \egroup} +\def\stopTEXapplication + {\savebuffer[\thedefinedbuffer{TEXapplication}][\TEXapplicationfilename]% + \typesetfile[TEXapplication][\TEXapplicationfilename]\relax} %D \macros %D {startpagefigure} diff --git a/Master/texmf-dist/tex/context/base/page-bck.mkiv b/Master/texmf-dist/tex/context/base/page-bck.mkiv index 93400943d50..81392f5af87 100644 --- a/Master/texmf-dist/tex/context/base/page-bck.mkiv +++ b/Master/texmf-dist/tex/context/base/page-bck.mkiv @@ -13,8 +13,6 @@ \writestatus{loading}{ConTeXt Page Macros / Backgrounds} -% \chardef\kindofpagetextareas=1 will isolate graphics from backgrounds - % todo \fastlocalframed -> \localbackgroundframed \unprotect @@ -248,8 +246,8 @@ %D background at the same time since something may have %D changed halfway a page. -\chardef\newrightbackground\zerocount -\chardef\newleftbackground \zerocount +\newconditional\newrightbackground +\newconditional\newleftbackground \def\recalculatebackgrounds {\global\newbackgroundtrue} @@ -262,28 +260,31 @@ \ifx\@@mastate\v!repeat\else\global\newbackgroundfalse\fi} \def\dosetbackgroundboxesr - {\global\chardef\newrightbackground\plusone - \global\chardef\newleftbackground\plusone + {\global\settrue\newrightbackground + \global\settrue\newleftbackground \global\setbox\leftbackground\emptybox \global\setbox\rightbackground\emptybox} + \def\dosetbackgroundboxesa - {\ifcase\newleftbackground \else + {\ifconditional\newleftbackground % \showmessage\m!layouts8\empty \setbackgroundbox\leftbackground\relax - \global\chardef\newleftbackground\zerocount - \global\chardef\newrightbackground\zerocount + \global\setfalse\newleftbackground + \global\setfalse\newrightbackground \fi} + \def\dosetbackgroundboxesb - {\ifcase\newleftbackground \else + {\ifconditional\newleftbackground % \showmessage\m!layouts8\empty \setbackgroundbox\leftbackground\relax - \global\chardef\newleftbackground\zerocount + \global\setfalse\newleftbackground \fi} + \def\dosetbackgroundboxesc - {\ifcase\newrightbackground \else + {\ifconditional\newrightbackground % \showmessage\m!layouts8\empty \setbackgroundbox\rightbackground\doswapmargins - \global\chardef\newrightbackground\zerocount + \global\setfalse\newrightbackground \fi} \def\addmainbackground#1% todo: dimension spec @@ -295,7 +296,7 @@ \box#1}% \fi} -\newdimen\pagebackgroundhoffset +\newdimen\pagebackgroundhoffset % THESE WILL BECOME OBSOLETE \newdimen\pagebackgroundvoffset \newdimen\pagebackgrounddepth \newdimen\pagebackgroundoffset diff --git a/Master/texmf-dist/tex/context/base/page-com.mkiv b/Master/texmf-dist/tex/context/base/page-com.mkiv new file mode 100644 index 00000000000..dbb160058c1 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/page-com.mkiv @@ -0,0 +1,116 @@ +%D \module +%D [ file=page-com, % moved from page-imp +%D version=1998.01.15, +%D title=\CONTEXT\ Page Macros, +%D subtitle=Page Comments, +%D author=Hans Hagen, +%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 This will become runtime loaded code. + +\writestatus{loading}{ConTeXt Page Macros / Page Comments} + +\unprotect + +%D \macros +%D {setuppagecomment,startpagecomment} +%D +%D This command is not yet documented. Usage: +%D +%D \starttyping +%D \setuppagecomment[state=start,location=right] +%D +%D \startpagecomment +%D \input knuth +%D \stoppagecomment +%D \stoptyping + +\unexpanded\def\setuppagecomment + {\dosingleempty\dosetuppagecomment} + +\def\dosetuppagecomment[#1]% + {\getparameters[\??pc][#1]% + \doifelse\@@pcstate\v!start + {\doifinsetelse\@@pclocation{\v!bottom,\v!top} + {\setuppapersize[\c!left=\hskip\@@pcoffset]% + \edef\@@pcpaperheight{\the\dimexpr\paperheight+\@@pcoffset+\@@pcoffset+\@@pcdistance+\@@pcheight}% + \edef\@@pcpaperwidth {\the\dimexpr\paperwidth +\@@pcoffset+\@@pcoffset}% + \defineoverlay[\v!pagecomment][\placepagecommentTB]} + {\setuppapersize[\c!top=\vskip\@@pcoffset]% + \edef\@@pcpaperheight{\the\dimexpr\paperheight+\@@pcoffset+\@@pcoffset}% + \edef\@@pcpaperwidth {\the\dimexpr\paperwidth +\@@pcoffset+\@@pcoffset+\@@pcdistance+\@@pcwidth}% + \defineoverlay[\v!pagecomment][\placepagecommentLR]}% + \processaction + [\@@pclocation] + [ \v!bottom=>{\setuplayout[\c!location=]\setuppapersize[\c!bottom=\vss,\c!top =\vskip\@@pcoffset]}, + \v!top=>{\setuplayout[\c!location=]\setuppapersize[\c!top =\vss,\c!bottom=\vskip\@@pcoffset]}, + \v!left=>{\setuplayout[\c!location=]\setuppapersize[\c!left =\hss,\c!right =\hskip\@@pcoffset]}, + \v!right=>{\setuplayout[\c!location=]\setuppapersize[\c!right =\hss,\c!left =\hskip\@@pcoffset]}]% + \definepapersize + [\v!pagecomment] + [\c!height=\@@pcpaperheight, + \c!width=\@@pcpaperwidth]% + \let\@@pcprintpapersize\printpapersize + \setuppapersize[\papersize][\v!pagecomment]% + \setupbackgrounds[\v!paper][\c!background=\v!pagecomment]}% todo append if already set + {\doif\@@pcstate\v!stop % else initialization invokes backgrounds + {% this should be tested first + % \normalexpanded{\noexpand\setuppapersize[\papersize][\@@pcprintpapersize]}% + \setupbackgrounds[\v!paper][\c!background=]}}} + +\def\@@pcprintpapersize{\printpapersize} + +\unexpanded\def\placepagecommentTB + {\vbox to \printpaperheight + {%\forgetall + \hsize\printpaperwidth + \vskip\@@pcoffset + \doifelse\@@pclocation\v!bottom{\vskip\dimexpr\paperheight+\@@pcdistance\relax}\vss + \hskip\@@pcoffset + \vbox to \@@pcheight + {%\forgetall + \hsize\paperwidth + \ifpagecomment + \getbuffer[\v!pagecomment]% + \global\pagecommentfalse + \fi}% + \hfill + \doifelse\@@pclocation\v!bottom\vss{\vskip\dimexpr\paperheight+\@@pcdistance\relax}% + \vskip\@@pcoffset}} + +\unexpanded\def\placepagecommentLR + {\hbox to \printpaperwidth + {\hskip\@@pcoffset + \doifelse\@@pclocation\v!right{\hskip\paperwidth\hskip\@@pcdistance}\hss + \vbox to \printpaperheight + {%\forgetall + \vskip\@@pcoffset + \hsize\@@pcwidth + \ifpagecomment + \getbuffer[\v!pagecomment]% + \global\pagecommentfalse + \fi + \vss}% + \doifelse\@@pclocation\v!right\hss{\hskip\paperwidth\hskip\@@pcdistance}% + \hskip\@@pcoffset}} + +\newif\ifpagecomment + +\setvalue{\e!start\v!pagecomment}% + {\global\pagecommenttrue + \dostartbuffer[\v!pagecomment][\e!start\v!pagecomment][\e!stop\v!pagecomment]} + +\setuppagecomment + [\c!state=, % \v!stop would invoke background calculation + \c!location=\v!bottom, + \c!offset=.5cm, + \c!distance=.5cm, + \c!height=5cm, + \c!width=10cm] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/page-flt.lua b/Master/texmf-dist/tex/context/base/page-flt.lua index 74d1e4e8c04..b691dbd45c1 100644 --- a/Master/texmf-dist/tex/context/base/page-flt.lua +++ b/Master/texmf-dist/tex/context/base/page-flt.lua @@ -6,18 +6,25 @@ if not modules then modules = { } end modules ['page-flt'] = { license = "see context related readme files" } -local setdimen, setbox, setcount, texbox = tex.setdimen, tex.setbox, tex.setcount, tex.box +-- floats -> managers.floats + local insert, remove = table.insert, table.remove -local texwrite, texsprint, ctxcatcodes = tex.write, tex.sprint, tex.ctxcatcodes +local find = string.find +local setdimen, setcount, texbox = tex.setdimen, tex.setcount, tex.box local copy_node_list = node.copy_list local trace_floats = false trackers.register("graphics.floats", function(v) trace_floats = v end) -- name might change +local report_floats = logs.reporter("structure","floats") + +local C, S, P, lpegmatch = lpeg.C, lpeg.S, lpeg.P, lpeg.match + -- we use floatbox, floatwidth, floatheight -- text page leftpage rightpage (todo: top, bottom, margin, order) -floats = floats or { } +floats = floats or { } +local floats = floats local noffloats, last, default, pushed = 0, nil, "text", { } @@ -27,6 +34,7 @@ local function initialize() page = { }, leftpage = { }, rightpage = { }, + somewhere = { }, } end @@ -39,7 +47,7 @@ function floats.stacked(which) -- floats.thenofstacked end function floats.thestacked(which) - return texwrite(#stacks[which or default]) + return context(#stacks[which or default]) end function floats.push() @@ -71,34 +79,48 @@ local function setdimensions(b) return w, h, d end -local function get(stack,n) - n = n or #stack - if n > 0 then - local t = stack[n] - if t then - return t, t.box, n +local function get(stack,n,bylabel) + if bylabel then + for i=1,#stack do + local s = stack[i] + local n = string.topattern(tostring(n)) -- to be sure + if find(s.data.label,n) then + return s, s.box, i + end + end + else + n = n or #stack + if n > 0 then + local t = stack[n] + if t then + return t, t.box, n + end end end end function floats.save(which,data) which = which or default - local stack = stacks[which] - noffloats = noffloats + 1 local b = texbox.floatbox - local w, h, d = b.width, b.height, b.depth - local t = { - n = noffloats, - data = data or { }, - box = copy_node_list(b), - } - texbox.floatbox = nil - insert(stack,t) - setcount("global","savednoffloats",#stacks[default]) - if trace_floats then - logs.report("floats","saving %s float %s in slot %s (%i,%i,%i)",which,noffloats,#stack,w,h,d) + if b then + local stack = stacks[which] + noffloats = noffloats + 1 + local w, h, d = b.width, b.height, b.depth + local t = { + n = noffloats, + data = data or { }, + box = copy_node_list(b), + } + texbox.floatbox = nil + insert(stack,t) + setcount("global","savednoffloats",#stacks[default]) + if trace_floats then + report_floats("saving %s float %s in slot %s (%i,%i,%i)",which,noffloats,#stack,w,h,d) + else + interfaces.showmessage("floatblocks",2,noffloats) + end else - interfaces.showmessage("floatblocks",2,noffloats) + report_floats("unable to save %s float %s (empty)",which,noffloats) end end @@ -113,30 +135,30 @@ function floats.resave(which) insert(stack,1,last) setcount("global","savednoffloats",#stacks[default]) if trace_floats then - logs.report("floats","resaving %s float %s in slot %s (%i,%i,%i)",which,noffloats,#stack,w,h,d) + report_floats("resaving %s float %s in slot %s (%i,%i,%i)",which,noffloats,#stack,w,h,d) else interfaces.showmessage("floatblocks",2,noffloats) end else - logs.report("floats","unable to resave float") + report_floats("unable to resave float") end end -function floats.flush(which,n) +function floats.flush(which,n,bylabel) which = which or default local stack = stacks[which] - local t, b, n = get(stack,n or 1) + local t, b, n = get(stack,n or 1,bylabel) if t then local w, h, d = setdimensions(b) if trace_floats then - logs.report("floats","flushing %s float %s from slot %s (%i,%i,%i)",which,t.n,n,w,h,d) + report_floats("flushing %s float %s from slot %s (%i,%i,%i)",which,t.n,n,w,h,d) else interfaces.showmessage("floatblocks",3,t.n) end texbox.floatbox = b last = remove(stack,n) last.box = nil - setcount("global","savednoffloats",#stacks[default]) + setcount("global","savednoffloats",#stacks[default]) -- default? else setdimensions() end @@ -145,7 +167,7 @@ end function floats.thevar(name,default) local value = last and last.data[name] or default if value and value ~= "" then - texsprint(ctxcatcodes,value) + context(value) end end @@ -156,12 +178,12 @@ function floats.consult(which,n) if t then local w, h, d = setdimensions(b) if trace_floats then - logs.report("floats","consulting %s float %s in slot %s (%i,%i,%i)",which,t.n,n,w,h,d) + report_floats("consulting %s float %s in slot %s (%i,%i,%i)",which,t.n,n,w,h,d) end return t, b, n else if trace_floats then - logs.report("floats","nothing to consult") + report_floats("nothing to consult") end setdimensions() end @@ -198,7 +220,7 @@ end function floats.thecheckedpagefloat(packed) local result = "" - if structure.pages.is_odd() then + if structures.pages.is_odd() then if #stacks.rightpage > 0 then result = "rightpage" elseif #stacks.page > 0 then @@ -223,5 +245,28 @@ function floats.thecheckedpagefloat(packed) end end end - texsprint(ctxcatcodes,result) + context(result) +end + +local method = C((1-S(", :"))^1) +local position = P(":") * C((1-S("*,"))^1) * P("*") * C((1-S(","))^1) +local label = P(":") * C((1-S(",*: "))^0) + +local pattern = method * (label * position + C("") * position + label + C("") * C("") * C("")) + +-- table.print { lpeg.match(pattern,"somewhere:blabla,crap") } +-- table.print { lpeg.match(pattern,"somewhere:1*2") } +-- table.print { lpeg.match(pattern,"somewhere:blabla:1*2") } +-- table.print { lpeg.match(pattern,"somewhere::1*2") } +-- table.print { lpeg.match(pattern,"somewhere,") } +-- table.print { lpeg.match(pattern,"somewhere") } + +function floats.analysemethod(str) + if str ~= "" then -- extra check, already done at the tex end + local method, label, row, column = lpegmatch(pattern,str) + context.setvalue("floatmethod",method or "") + context.setvalue("floatlabel", label or "") + context.setvalue("floatrow", row or "") + context.setvalue("floatcolumn",column or "") + end end diff --git a/Master/texmf-dist/tex/context/base/page-flt.mkiv b/Master/texmf-dist/tex/context/base/page-flt.mkiv index 944626b8e9c..6d23891767c 100644 --- a/Master/texmf-dist/tex/context/base/page-flt.mkiv +++ b/Master/texmf-dist/tex/context/base/page-flt.mkiv @@ -75,6 +75,10 @@ {\ctxlua{floats.flush("#1",\number#2)}% \the\everyfloatscheck} +\def\dofloatsflushbylabel#1#2% + {\ctxlua{floats.flush("#1","#2",true)}% + \the\everyfloatscheck} + \def\dofloatssave#1% {\ctxlua{floats.save("#1")}% \the\everyfloatscheck} @@ -95,7 +99,7 @@ {\ctxlua{floats.consult("#1")}} \def\doifsavedfloatelse#1% - {\ctxlua{commands.doifsavedfloatelse("#1")}} + {\ctxcommand{doifsavedfloatelse("#1")}} \def\dofloatscollect#1#2#3% {\ctxlua{floats.collect("#1",\number\dimexpr#2,\number\dimexpr#3)}} @@ -112,6 +116,41 @@ \def\dofloatssavepagefloat#1#2% {\ctxlua{floats.save("#1", { specification = "#2" })}} +\def\dofloatssavesomewherefloat#1#2% #1=method + {\ctxlua{floats.save("#1", { specification = "#2", label = "\floatlabel" })}} + +%D This is an experimental new feature (for Alan Braslau), a prelude to more: +%D +%D \starttyping +%D test \placefigure{}{} +%D test \placefigure[somewhere:alpha][whatever]{}{} +%D test \placefigure[somewhere:beta] [whatever]{}{} +%D test \placefigure[somewhere:gamma][whatever]{}{} +%D test \placefigure[somewhere:delta][whatever]{}{} +%D test \placefigure{}{} +%D +%D in \in{figure}[whatever] bla bla +%D +%D \placenamedfloat[figure][*l*] +%D \placenamedfloat[figure][gamma] +%D \placenamedfloat[figure][beta] +%D \stoptyping + +\def\placenamedfloat + {\dodoubleargument\doplacenamedfloat} + +\def\doplacenamedfloat[#1][#2]% + {\doloop + {\dofloatsflushbylabel\s!somewhere{#2}% + \ifvoid\floatbox + \exitloop + \else + \def\currentfloat{#1}% + \blank[\@@bkspacebefore]% + \box\floatbox + \blank[\@@bkspaceafter] + \fi}} + %D The following code is in transition as we don't want to break the %D current single column, multi column, and columnset mechanism. %D @@ -119,7 +158,7 @@ \def\dogetfloat {\ifsomefloatwaiting - \dofloatsflush{text}{1}% + \dofloatsflush\s!text{1}% \ifcenterfloatbox \ifdim\wd\globalscratchbox<\hsize \global\setbox\floatbox\hbox to \hsize{\hss\box\floatbox\hss}% @@ -138,14 +177,14 @@ \fi} \def\dosavefloat - {\dofloatssave{text}% + {\dofloatssave\s!text \nonoindentation} % brrr nonoindentation here \def\doresavefloat - {\dofloatsresave{text}} + {\dofloatsresave\s!text} \def\doreversesavefloat - {\dofloatsresave{text}} + {\dofloatsresave\s!text} \def\doflushsavedfloats % simplified \OTRONEdodoflushfloats {\doloop @@ -177,21 +216,21 @@ % \def\doflushpagefloats % {\doifoddpageelse -% {\ifnum\dofloatsnofstacked{rightpage}>\zerocount -% \doflushsomepagefloat{rightpage}% -% \else\ifnum\dofloatsnofstacked{page}>\zerocount -% \doflushsomepagefloat{page} -% \else\ifnum\dofloatsnofstacked{leftpage}>\zerocount -% \null\vfill\eject -% %\doflushsomepagefloat{leftpage}% +% {\ifnum\dofloatsnofstacked\s!rightpage>\zerocount +% \doflushsomepagefloat\s!rightpage +% \else\ifnum\dofloatsnofstacked\s!page>\zerocount +% \doflushsomepagefloat\s!page +% \else\ifnum\dofloatsnofstacked\s!leftpage>\zerocount +% \emptyhbox\vfill\eject +% %\doflushsomepagefloat\s!leftpage % \fi\fi\fi} -% {\ifnum\dofloatsnofstacked{leftpage}>\zerocount -% \doflushsomepagefloat{leftpage}% -% \else\ifnum\dofloatsnofstacked{page}>\zerocount -% \doflushsomepagefloat{page} -% \else\ifnum\dofloatsnofstacked{rightpage}>\zerocount -% \null\vfill\eject -% %\doflushsomepagefloat{rightpage}% +% {\ifnum\dofloatsnofstacked\s!leftpage>\zerocount +% \doflushsomepagefloat\s!leftpage +% \else\ifnum\dofloatsnofstacked\s!page>\zerocount +% \doflushsomepagefloat\s!page +% \else\ifnum\dofloatsnofstacked\s!rightpage>\zerocount +% \emptyhbox\vfill\eject +% %\doflushsomepagefloat\s!rightpage % \fi\fi\fi}} \def\doflushpagefloats @@ -199,7 +238,7 @@ \ifx\checkedpagefloat\empty % nothing \else\ifx\checkedpagefloat\v!empty - \null\vfill\eject + \emptyhbox\vfill\eject \else \doflushsomepagefloat\checkedpagefloat \fi\fi} @@ -230,4 +269,20 @@ \ifdefined\doflushfloats\else \let\doflushfloats\relax \fi \ifdefined\flushfloatbox\else \let\flushfloatbox\relax \fi +% temp hack, needed to prevent floatbox being forgotten during +% output, this will change to using another box for flushing +% +% \dorecurse{700}{text } \placefigure[top][]{First} {\framed{bla 1}} +% \placefigure[top][]{Second}{\framed{bla 2}} +% \dorecurse {40}{text } \placefigure[top][]{Third} {\framed{bla 3}} + +\newbox\savedfloatbox + +\appendtoks + \global\setbox\savedfloatbox\box\floatbox +\to \everybeforeoutput +\appendtoks + \global\setbox\floatbox\box\savedfloatbox +\to \everyafteroutput + \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/page-imp.mkii b/Master/texmf-dist/tex/context/base/page-imp.mkii index e4ece04a626..4c22d4d2d6d 100644 --- a/Master/texmf-dist/tex/context/base/page-imp.mkii +++ b/Master/texmf-dist/tex/context/base/page-imp.mkii @@ -3,7 +3,7 @@ %D version=1998.01.15, %D title=\CONTEXT\ Page Macros, %D subtitle=Pagebody Building (Imposition), -%D author=Hans Hagen, +%D author=Hans Hagen & Willi Egger, %D date=\currentdate, %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C @@ -355,7 +355,7 @@ \pusharrangedpageTWO\poparrangedpagesTWO\handlearrangedpageTWODOWN} \installpagearrangement 2*4*2 % one defined by Willy Egger: - {\dosetuparrangement{2}{2}{4}{3}{2}% + {\dosetuparrangement{2}{2}{4}{3}{3}% \pusharrangedpageSIXTEENTWO\poparrangedpagesAtoD\relax} \installpagearrangement 2*2*4 % onother one of Willy Egger @@ -806,6 +806,364 @@ \setuppaper [\c!width =\dimexpr\printpaperwidth -2\dimexpr\@@ppbackspace\relax\relax, \c!height=\dimexpr\printpaperheight-2\dimexpr\@@pptopspace \relax\relax] + +%D Might be used if a printer is printing from a rol or creating mini-books from A4: +%D This section has 16 pages. The folding scheme is first a Z-fold and at the end +%D a final fold in the spine. +%D Coding: [2*8*Z] + +\installpagearrangement 2*8*Z + {\dosetuparrangement{2}{4}{8}{3}{5}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageSIXTEENZ\poparrangedpagesAB\relax} + +\def\pusharrangedpageSIXTEENZ#1% + {\doglobal\increment\arrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 1 + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}101\arrangedpageB % 3 + \or \handlearrangedpageXandY{#1}111\arrangedpageA % 4 + \or \handlearrangedpageXandY{#1}012\arrangedpageA % 5 + \or \handlearrangedpageXandY{#1}002\arrangedpageB % 6 + \or \handlearrangedpageXandY{#1}103\arrangedpageB % 7 + \or \handlearrangedpageXandY{#1}113\arrangedpageA % 8 + \or \handlearrangedpageXandY{#1}103\arrangedpageA % 9 + \or \handlearrangedpageXandY{#1}113\arrangedpageB % 10 + \or \handlearrangedpageXandY{#1}012\arrangedpageB % 11 + \or \handlearrangedpageXandY{#1}002\arrangedpageA % 12 + \or \handlearrangedpageXandY{#1}101\arrangedpageA % 13 + \or \handlearrangedpageXandY{#1}111\arrangedpageB % 14 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 15 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 16 + \poparrangedpages + \fi} + +%D Another Z-folded section with 12 pages +%D Coding: [2*6*Z] + +\installpagearrangement 2*6*Z + {\dosetuparrangement{2}{3}{6}{3}{4}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageTWELVEZ\poparrangedpagesAB\relax} + +\def\pusharrangedpageTWELVEZ#1% + {\doglobal\increment\arrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 1: rotation (0=upright),x (0=first column),y (0=first row) + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}101\arrangedpageB % 3 + \or \handlearrangedpageXandY{#1}111\arrangedpageA % 4 + \or \handlearrangedpageXandY{#1}012\arrangedpageA % 5 + \or \handlearrangedpageXandY{#1}002\arrangedpageB % 6 + \or \handlearrangedpageXandY{#1}012\arrangedpageB % 7 + \or \handlearrangedpageXandY{#1}002\arrangedpageA % 8 + \or \handlearrangedpageXandY{#1}101\arrangedpageA % 9 + \or \handlearrangedpageXandY{#1}111\arrangedpageB % 10 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 11 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 12 + \poparrangedpages + \fi} + +%D For Heinz' special greeting cards folding. This scheme is also used for the PocketDiary (module): +%D Coding: [1*8] + +\installpagearrangement 1*8 + {\dosetuparrangement{4}{2}{8}{5}{3} % X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageEIGHTSINGLESIDEDFOLDED\poparrangedpagesTWO\relax} + +\def\pusharrangedpageEIGHTSINGLESIDEDFOLDED#1% + {\doglobal\increment\arrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}020\arrangedpageA % 2 + \or \handlearrangedpageXandY{#1}030\arrangedpageA % 3 + \or \handlearrangedpageXandY{#1}131\arrangedpageA % 4 + \or \handlearrangedpageXandY{#1}121\arrangedpageA % 5 + \or \handlearrangedpageXandY{#1}111\arrangedpageA % 6 + \or \handlearrangedpageXandY{#1}101\arrangedpageA % 7 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 8 + \poparrangedpages + \fi} + +%D This is not a section. \CONTEXT\ places 4 pages on a sheet of paper, singlesided +%D Coding: [1*4] + +\installpagearrangement 1*4 + {\dosetuparrangement{2}{2}{4}{3}{3} % X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageFOURSINGLESIDEDFOLDED\poparrangedpagesTWO\relax} + +\def\pusharrangedpageFOURSINGLESIDEDFOLDED#1% + {\doglobal\increment\arrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}100\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}001\arrangedpageA % 2 + \or \handlearrangedpageXandY{#1}011\arrangedpageA % 3 + \or \handlearrangedpageXandY{#1}110\arrangedpageA % 4 + \poparrangedpages + \fi} + +%D This imposition scheme was requested by Hraban Ramm, by Willi Egger 21-07-2003 +%D Coding: [3SIDE] + +\installpagearrangement 3SIDE + {\dosetuparrangement{3}{1}{3}{4}{2}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageTHREESIDE\poparrangedpagesAB\relax} + +\def\pusharrangedpageTHREESIDE#1% Willi's approach + {\doglobal\increment\arrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 2 + \or \handlearrangedpageXandY{#1}020\arrangedpageA % 3 + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 4 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 5 + \or \handlearrangedpageXandY{#1}020\arrangedpageB % 6 + \poparrangedpages + \fi} + +%D FLYER in three parts and 6 pages 22-10-2010 +%D Coding: [TRYPTICHON] + +\installpagearrangement TRYPTICHON + {\dosetuparrangement{3}{1}{3}{4}{2}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageFOLDERSIX\poparrangedpagesAB\relax} + +\def\pusharrangedpageFOLDERSIX#1% Willi's approach + {\doglobal\increment\arrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}020\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 3 + \or \handlearrangedpageXandY{#1}020\arrangedpageB % 4 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 5 + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 6 + \poparrangedpages + \fi} + +%D FLYER in Z-fold with 8 pages 22-01-2010 +%D Coding: [ZFLYER-8] + +\installpagearrangement ZFLYER-8 + {\dosetuparrangement{4}{1}{4}{5}{2}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageZFOLDEREIGHT\poparrangedpagesAB\relax} + +\def\pusharrangedpageZFOLDEREIGHT#1% Willi's approach + {\doglobal\increment\arrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}030\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 3 + \or \handlearrangedpageXandY{#1}020\arrangedpageB % 4 + \or \handlearrangedpageXandY{#1}030\arrangedpageB % 5 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 6 + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 7 + \or \handlearrangedpageXandY{#1}020\arrangedpageA % 8 + \poparrangedpages + \fi} + +%D FLYER in Z-fold with 10 pages 04-08-2010 +%D Coding: [ZFLYER-10] + +\installpagearrangement ZFLYER-10 + {\dosetuparrangement{5}{1}{5}{6}{2}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageZFLYERTEN\poparrangedpagesAB\relax} + +\def\pusharrangedpageZFLYERTEN#1% Willi's approach + {\doglobal\increment\arrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}040\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 3 + \or \handlearrangedpageXandY{#1}020\arrangedpageB % 4 + \or \handlearrangedpageXandY{#1}030\arrangedpageB % 5 + \or \handlearrangedpageXandY{#1}040\arrangedpageB % 6 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 7 + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 8 + \or \handlearrangedpageXandY{#1}020\arrangedpageA % 9 + \or \handlearrangedpageXandY{#1}030\arrangedpageA % 10 + \poparrangedpages + \fi} + + +%D FLYER in Z-fold with 12 pages 04-08-2010 +%D Coding: [ZFLYER-12] + +\installpagearrangement ZFLYER-12 + {\dosetuparrangement{6}{1}{6}{7}{2}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageZFLYERTWELVE\poparrangedpagesAB\relax} + +\def\pusharrangedpageZFLYERTWELVE#1% Willi's approach + {\doglobal\increment\arrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}050\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 3 + \or \handlearrangedpageXandY{#1}020\arrangedpageB % 4 + \or \handlearrangedpageXandY{#1}030\arrangedpageB % 5 + \or \handlearrangedpageXandY{#1}040\arrangedpageB % 6 + \or \handlearrangedpageXandY{#1}050\arrangedpageB % 7 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 8 + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 9 + \or \handlearrangedpageXandY{#1}020\arrangedpageA % 10 + \or \handlearrangedpageXandY{#1}030\arrangedpageA % 11 + \or \handlearrangedpageXandY{#1}040\arrangedpageA % 12 + \poparrangedpages + \fi} + +%D FLYER folded as a map with 6 pages per side. +%D Coding: [MAPFLYER-12] + +\installpagearrangement MAPFLYER-12 + {\dosetuparrangement{3}{2}{6}{4}{2}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageMFOLDERTWELVE\poparrangedpagesAB\relax} + +\def\pusharrangedpageMFOLDERTWELVE#1% Willi's approach + {\doglobal\increment\arrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}020\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}001\arrangedpageB % 3 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 4 + \or \handlearrangedpageXandY{#1}011\arrangedpageB % 5 + \or \handlearrangedpageXandY{#1}020\arrangedpageB % 6 + \or \handlearrangedpageXandY{#1}021\arrangedpageB % 7 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 8 + \or \handlearrangedpageXandY{#1}001\arrangedpageA % 9 + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 10 + \or \handlearrangedpageXandY{#1}011\arrangedpageA % 11 + \or \handlearrangedpageXandY{#1}021\arrangedpageA % 12 + \poparrangedpages + \fi} + +%D FLYER folded as double window with 4 pages per side. +%D Coding: [DOUBLEWINDOW] + +\installpagearrangement DOUBLEWINDOW + {\dosetuparrangement{4}{1}{4}{5}{2}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageDOUBLEWINDOWEIGHT\poparrangedpagesAB\relax} + +\def\pusharrangedpageDOUBLEWINDOWEIGHT#1% Willi's approach + {\doglobal\increment\arrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}020\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}030\arrangedpageA % 2 + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 3 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 4 + \or \handlearrangedpageXandY{#1}020\arrangedpageB % 5 + \or \handlearrangedpageXandY{#1}030\arrangedpageB % 6 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 7 + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 8 + \poparrangedpages + \fi} + +%D Imposition as requested by Jan Pohanka 26-08-2010, 4 pages, two verso, two recto, +%D uneven pages upright and down, even pages top and rotated 180. +%D Implementation with 2 pages for conference-name-display +%D Coding: [1*2-Conference] + +\installpagearrangement 1*2-Conference + {\dosetuparrangement{1}{2}{4}{3}{2}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageCONFERENCE2\poparrangedpagesAB\relax} + +\def\pusharrangedpageCONFERENCE2#1% + {\doglobal\increment\arrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}001\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}100\arrangedpageA % 2 + \poparrangedpages + \fi} + +%D Implementation with 4 pages for conference-name-display +%D Coding: [1*4-Conference] + +\installpagearrangement 1*4-Conference + {\dosetuparrangement{1}{2}{4}{3}{2}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageCONFERENCE4\poparrangedpagesAB\relax} + +\def\pusharrangedpageCONFERENCE4#1% + {\doglobal\increment\arrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}001\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}100\arrangedpageA % 2 + \or \handlearrangedpageXandY{#1}011\arrangedpageB % 3 + \or \handlearrangedpageXandY{#1}110\arrangedpageB % 4 + \poparrangedpages + \fi} + +% There should be arrangements for section made of heavy and thick paper. i.e. the heavier the paper +% the fewer pages per section: +% Section with 8 pages put on to sheets of paper. Each sheet carries recto 2 and verso 2 pages. +% Coding: [2*2*2] + +\installpagearrangement 2*2*2 + {\dosetuparrangement{2}{1}{2}{3}{2}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageEIGHTTWO\poparrangedpagesAtoD\relax} + +\def\pusharrangedpageEIGHTWO#1% + {\doglobal\increment\arrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}010\arrangedpageC % 3 + \or \handlearrangedpageXandY{#1}000\arrangedpageD % 4 + \or \handlearrangedpageXandY{#1}010\arrangedpageD % 5 + \or \handlearrangedpageXandY{#1}000\arrangedpageC % 6 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 7 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 8 + \poparrangedpages + \fi} + +% Section with 12 pages, built from three sheets of paper. +% Each sheet carries 2 pages recto and verso. +% Coding: [2*2*3] + +\def\poparrangedpagesAtoF + {\ifnum\arrangedpageN>\zerocount + \paperwidth \arrangedpageX\paperwidth + \paperheight\arrangedpageY\paperheight + \outputarrangedbox\arrangedpageA + \outputarrangedbox\arrangedpageB + \outputarrangedbox\arrangedpageC + \outputarrangedbox\arrangedpageD + \outputarrangedbox\arrangedpageE + \outputarrangedbox\arrangedpageF + \global\arrangedpageN\zerocount + \fi} +\installpagearrangement 2*2*3 + {\dosetuparrangement{2}{1}{2}{3}{2}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageTWELVETWO\poparrangedpagesAtoD\relax} + +\def\pusharrangedpageTWELVETWO#1% + {\doglobal\increment\arrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}010\arrangedpageC % 3 + \or \handlearrangedpageXandY{#1}000\arrangedpageD % 4 + \or \handlearrangedpageXandY{#1}010\arrangedpageE % 5 + \or \handlearrangedpageXandY{#1}000\arrangedpageF % 6 + \or \handlearrangedpageXandY{#1}010\arrangedpageF % 7 + \or \handlearrangedpageXandY{#1}000\arrangedpageE % 8 + \or \handlearrangedpageXandY{#1}010\arrangedpageD % 9 + \or \handlearrangedpageXandY{#1}000\arrangedpageC % 10 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 11 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 12 + \poparrangedpages + \fi} % \definepageshift[test][horizontal][10pt,20pt,30pt,40pt,50pt] % \definepageshift[test][vertical] [10pt,20pt,30pt,40pt,50pt] diff --git a/Master/texmf-dist/tex/context/base/page-imp.mkiv b/Master/texmf-dist/tex/context/base/page-imp.mkiv index a0f32ef8611..b6fa75c8ba6 100644 --- a/Master/texmf-dist/tex/context/base/page-imp.mkiv +++ b/Master/texmf-dist/tex/context/base/page-imp.mkiv @@ -3,7 +3,7 @@ %D version=1998.01.15, %D title=\CONTEXT\ Page Macros, %D subtitle=Pagebody Building (Imposition), -%D author=Hans Hagen, +%D author=Hans Hagen & Willi Egger, %D date=\currentdate, %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C @@ -23,9 +23,7 @@ % % \starttext \dorecurse{10}{\input tufte \par} \stoptext -% to be moved code: - -\newif\ifclipprintbox \clipprintboxtrue +\newif\ifclipprintbox \clipprintboxtrue % todo: conditional %newif\ifclippagebox \clippageboxtrue \def\clippedprintbox#1#2% can be made more efficient, see other clipper @@ -59,7 +57,7 @@ \let\clippagebox \gobbleoneargument \let\clipprintbox\gobbleoneargument - + % \setuppagenumbering[alternative=doublesided] % \setupcolors[state=start] % \setuppapersize[A4][A4,oversized] @@ -106,7 +104,7 @@ %D This is a user macro (appending to every last shipout is not %D really user friendly. -\newtoks \collectedtextdata +\newtoks\collectedtextdata \long\unexpanded\def\starttextdata#1\stoptextdata {\doglobal\appendtoks#1\to\collectedtextdata} @@ -127,6 +125,7 @@ \def\myshipout#1% {\beforeshipout % voor de pagebody dus ! \dontshowcomposition + \dontcomplain \executeifdefined{\??pp:\c!method:\@@ppmethod}\gobbleoneargument{#1}% \setnextrealpageno \aftershipout} @@ -148,11 +147,14 @@ % \stoptypen \newcount\shippedoutpages +\newcount\combinedpagescounter + +\let\pagestoshipout\empty % {1,3,6} +\newconstant\whichpagetoshipout % 0=all 1=odd 2=even -\let\pagestoshipout\empty % {1,3,6} -\chardef\whichpagetoshipout=0 % 0=all 1=odd 2=even +\newbox\shipoutscratchbox -\def\actualshipout#1% +\def\actualshipout#1% todo: less callbacks {\global\advance\shippedoutpages\plusone % this is not resource safe! \ifx\pagestoshipout\empty @@ -170,33 +172,33 @@ \donetrue\donefalse \fi \ifdone + \begingroup + \setbox\shipoutscratchbox\hbox{#1}% just in case there are objects there, hook for testing + \finalizeshipoutbox\shipoutscratchbox + \setbox\scratchbox\hbox + {% before the main one ! + \ifcase\realfolio \or + \the\everyfirstshipout + \global\everyfirstshipout\emptytoks + \fi + % the main one + \the\everyshipout\relax + % always last (and after the main one) + \ifnum\realpageno=\lastpage\relax + \the\everylastshipout + \global\everylastshipout\emptytoks + \fi}% + \smashbox\scratchbox \shipout\vbox - {%\forgetall - \offinterlineskip - \dontcomplain - \scratchdimen-1in + {\offinterlineskip + \scratchdimen-1in % to be done in luatex: zero that one \vskip\scratchdimen \hskip\scratchdimen - \setbox0\hbox{#1}% just in case there are objects there, hook for testing - \finalizeshipoutbox0% - \setbox\scratchbox\hbox - {% before the main one ! - \ifcase\realfolio \or - \the\everyfirstshipout - \global\everyfirstshipout\emptytoks - \fi - % the main one - \the\everyshipout\relax - % always last (and after the main one) - \ifnum\realpageno=\lastpage\relax - \the\everylastshipout - \global\everylastshipout\emptytoks - \fi}% - \smashbox\scratchbox \hbox % \setbox0=\box.. is nicer {\box\scratchbox \ifvoid\postponedcontent\else\box\postponedcontent\fi % evt ver naar links ! - \box0}}% + \box\shipoutscratchbox}}% + \endgroup \else \message {[\ifarrangingpages arranged \fi page @@ -214,87 +216,114 @@ %D We need a couple of boxes for duplex printing \unknown \newbox\arrangedpageA \newbox\arrangedpageB - -%D \unknown\ and some for simulating big sheets. - \newbox\arrangedpageC \newbox\arrangedpageD \newbox\arrangedpageE \newbox\arrangedpageF \newbox\arrangedpageG \newbox\arrangedpageH -\newif\ifswaparranged -\newif\ifnegatearranged -\newif\ifmirrorarranged -\newif\ifdoublearranged - -\newif\ifarrangingdisabled +\newconditional\arrangedswapstate +\newconditional\arrangednegatestate +\newconditional\arrangedmirrorstate +\newconditional\arrangeddoublestate +\newconditional\arrangingdisabledstate +\newconditional\arrangedbackgroundstate \def\arrangedrotationO{0} \def\arrangedrotationE{0} -\newcounter\arrangedpageN -\newcounter\arrangedpageM +\newcount\arrangedpageN +\newcount\arrangedpageM -\chardef\arrangedpageT=1 -\chardef\arrangedpageX=1 -\chardef\arrangedpageY=1 +\newcount\arrangedpageT \arrangedpageT\plusone +\newcount\arrangedpageX \arrangedpageX\plusone +\newcount\arrangedpageY \arrangedpageY\plusone \def\calculatepaperoffsets#1% - {\scratchdimen\getvalue{\??pp#1\c!offset}% - \divide\scratchdimen \arrangedpageX - \global\advance\paperwidth -2\scratchdimen - \scratchdimen\getvalue{\??pp#1\c!offset}% - \divide\scratchdimen \arrangedpageY - \global\advance\paperheight-2\scratchdimen} + {\global\paperoffset\getvalue{\??pp#1\c!offset}% + \global\advance\paperwidth -2\dimexpr\paperoffset/\arrangedpageX\relax + \global\advance\paperheight-2\dimexpr\paperoffset/\arrangedpageY\relax} + +\def\doinstallarrangedoption#1#2% + {\setvalue{\??pp=>#1}{#2}} + +\def\doinstalledarrangedoption#1% + {\ifcsname\??pp=>#1\endcsname + \csname\??pp=>#1\endcsname + \else + \checkinstalledpagearrangement{#1}% this installs the arranger + \fi} + +\doinstallarrangedoption\empty + {} % no default and check if empty, we can have ,,, -\newconditional\arrangedbackgroundokay % more ifs -> conditionals +\doinstallarrangedoption\v!disable + {\global\settrue\arrangingdisabledstate} + +\doinstallarrangedoption\v!mirrored + {\global\settrue\arrangedmirrorstate} + +\doinstallarrangedoption\v!doublesided + {\global\settrue\arrangeddoublestate} + +\doinstallarrangedoption\v!negative + {\global\settrue\arrangednegatestate} + +\doinstallarrangedoption\v!rotated + {\gdef\arrangedrotationO {90}% + \gdef\arrangedrotationE{270}% + \swapcounts\horizontalcutmarks\verticalcutmarks} + +\doinstallarrangedoption{90} + {\gdef\arrangedrotationO {90}% + \gdef\arrangedrotationE{270}% + \swapcounts\horizontalcutmarks\verticalcutmarks} + +\doinstallarrangedoption{180} + {\gdef\arrangedrotationO{180}% + \gdef\arrangedrotationE {0}} + +\doinstallarrangedoption{270} + {\gdef\arrangedrotationO{270}% + \gdef\arrangedrotationE {90}% + \swapcounts\horizontalcutmarks\verticalcutmarks} + +\doinstallarrangedoption\s!reset + {\global\arrangingpagesfalse} + +\doinstallarrangedoption\v!background + {\global\settrue\arrangedbackgroundstate} \unexpanded\def\setuparranging[#1]% - {\ifarrangingdisabled \else - \doifelse{#1}\v!disable - {\global\arrangingdisabledtrue} - {\global\arrangingdisabledfalse}% - \global\arrangingpagestrue - \global\negatearrangedfalse - \global\mirrorarrangedfalse - \global\doublearrangedfalse + {\ifconditional\arrangingdisabledstate \else + %global\setfalse\arrangingdisabledstate + \global\arrangingpagestrue % will be conditional + \global\setfalse\arrangednegatestate + \global\setfalse\arrangedmirrorstate + \global\setfalse\arrangeddoublestate + \global\setfalse\arrangedswapstate \gdef\arrangedrotationO{0}% \gdef\arrangedrotationE{180}% - \processallactionsinset - [#1] - [ \v!mirrored=>\global\mirrorarrangedtrue, - \v!doublesided=>\global\doublearrangedtrue, - \v!negative=>\global\negatearrangedtrue, - \v!rotated=>\gdef\arrangedrotationO {90}\gdef\arrangedrotationE{270}, - 90=>\gdef\arrangedrotationO {90}\gdef\arrangedrotationE{270}, - 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 + \processcommalist[#1]\doinstalledarrangedoption \ifx\handlearrangedpage\undefined \global\arrangingpagesfalse \fi - \doifcommonelse{#1}{90,270,\v!rotated} - {\swapmacros\horizontalcutmarks\verticalcutmarks}{}% ugly solution \setuppapersize \fi} -\def\installpagearrangement #1 % +\def\installpagearrangement #1 % will lchange, no space {\setgvalue{\??pp\??pp#1}} \def\checkinstalledpagearrangement#1% can be empty: aaa,,bbb {\executeifdefined{\??pp\??pp#1}\donothing} \def\dosetuparrangement#1#2#3#4#5#6#7#8% - {\global\chardef\arrangedpageX #1% - \global\chardef\arrangedpageY #2% - \global\chardef\arrangedpageT #3% - \global\chardef\horizontalcutmarks#4% - \global\chardef\verticalcutmarks #5% - \global\let \pusharrangedpage #6% - \global\let \poparrangedpages #7% - \global\let \handlearrangedpage#8} + {\global\arrangedpageX #1% + \global\arrangedpageY #2% + \global\arrangedpageT #3% + \global\horizontalcutmarks #4% + \global\verticalcutmarks #5% + \global\let\pusharrangedpage #6% + \global\let\poparrangedpages #7% + \global\let\handlearrangedpage#8} \installpagearrangement {\v!normal} {\global\arrangingpagesfalse} @@ -336,7 +365,7 @@ \pusharrangedpageTWO\poparrangedpagesTWO\handlearrangedpageTWODOWN} \installpagearrangement 2*4*2 % one defined by Willy Egger: - {\dosetuparrangement{2}{2}{4}{3}{2}% + {\dosetuparrangement{2}{2}{4}{3}{3}% \pusharrangedpageSIXTEENTWO\poparrangedpagesAtoD\relax} \installpagearrangement 2*2*4 % onother one of Willy Egger @@ -347,16 +376,6 @@ {\dosetuparrangement{1}{2}{4}{2}{3}% \pusharrangedpageTWOTOPSIDE\poparrangedpagesTWOTOPSIDE\handlearrangedpageTOP} -% \def\filluparrangedpages % beware: \realpageno is 1 ahead -% {\ifarrangingpages -% \scratchcounter-\realpageno -% \divide\scratchcounter \arrangedpageT -% \multiply\scratchcounter \arrangedpageT -% \advance\scratchcounter \realpageno -% \advance\scratchcounter \minusone -% \dorecurse\scratchcounter{\noheaderandfooterlines\ejectdummypage}% -% \fi} - \def\filluparrangedpages % beware: \realpageno is 1 ahead {\ifarrangingpages \scratchcounter\numexpr\realpageno-\plusone\relax @@ -371,9 +390,7 @@ \def\handlearrangedpageXandY#1#2#3#4#5% {\global\setbox#5\hbox to \arrangedpageX\paperwidth {\setbox\scratchbox\vbox to \arrangedpageY\paperheight - {%\forgetall - \offinterlineskip - \dontcomplain + {\offinterlineskip \vskip#4\paperheight \hskip#3\paperwidth \dorotatebox{\ifcase#2 0\else180\fi}\hbox{\box#1}% @@ -391,7 +408,7 @@ \gotonextarrangepage \ifnum\arrangedrotationO\arrangedrotationE>\zerocount \setbox#1\vbox - {\ifdoublearranged + {\ifconditional\arrangeddoublestate \ifodd\arrangeno \dorotatebox\arrangedrotationO\hbox{\box#1}% \else @@ -401,36 +418,41 @@ \dorotatebox\arrangedrotationO\hbox{\box#1}% \fi}% \fi - \ifmirrorarranged + \ifconditional\arrangedmirrorstate \setbox#1\vbox{\domirrorbox\vbox{\box#1}}% \fi - \ifnegatearranged + \ifconditional\arrangednegatestate \negatecolorbox{#1}% \fi \finishpagebox#1% - \ifconditional\arrangedbackgroundokay\addprintbackground#1\fi + \ifconditional\arrangedbackgroundstate\addprintbackground#1\fi \actualshipout{\box#1}% \egroup} %D The format file can be 16K smaller when we postpone the %D real arrangments. Some day ... +\def\reportarrangedpage#1% + {\showmessage\m!system{23}{\the\realpageno.\the\pageno\ifnum\subpageno>0 .\the\subpageno\fi,\number#1}} + +\def\advancearrangedpageN + {\global\advance\arrangedpageN\plusone} + % TOP % 32/16/8/4/SIDE \def\poparrangedpagesAB {\ifnum\arrangedpageN>\zerocount - \dontcomplain \paperwidth\arrangedpageX\paperwidth \paperheight\arrangedpageY\paperheight \outputarrangedbox\arrangedpageA \outputarrangedbox\arrangedpageB - \doglobal\newcounter\arrangedpageN + \global\arrangedpageN\zerocount \fi} \def\pusharrangedpageTHIRTYTWO#1% taco's challenge - {\doglobal\increment\arrangedpageN + {\advancearrangedpageN \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN \or \handlearrangedpageXandY{#1}033\arrangedpageA % 1 @@ -469,7 +491,7 @@ \fi} \def\pusharrangedpageSIXTEEN#1% changed to match the official way of doing - {\doglobal\increment\arrangedpageN + {\advancearrangedpageN \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN \or \handlearrangedpageXandY{#1}031\arrangedpageA % 1 @@ -492,7 +514,7 @@ \fi} \def\pusharrangedpageEIGHT#1% changed to match the official way of doing - {\doglobal\increment\arrangedpageN + {\advancearrangedpageN \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN \or \handlearrangedpageXandY{#1}011\arrangedpageA % 1 @@ -510,7 +532,7 @@ \def\pusharrangedpageFOURB{\pusharrangedpageFOURdo10} \def\pusharrangedpageFOURdo#1#2#3% - {\doglobal\increment\arrangedpageN + {\advancearrangedpageN \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN \or \handlearrangedpageXandY{#3}010\arrangedpageA % 1 @@ -521,7 +543,7 @@ \fi} \def\pusharrangedpageSIDETOP#1% - {\doglobal\increment\arrangedpageN + {\advancearrangedpageN \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN \or \handlearrangedpageXandY{#1}000\arrangedpageA % 1 @@ -540,8 +562,7 @@ {\global\ht\arrangedpageA\paperheight \global\ht\arrangedpageB\paperheight \global\setbox\arrangedpageA\vbox - {%\forgetall - \offinterlineskip\vskip\paperheight + {\offinterlineskip\vskip\paperheight \box\arrangedpageA\box\arrangedpageB}% \global\setbox\arrangedpageB\box\scratchbox} % ? @@ -557,16 +578,16 @@ \def\handlearrangedpageTWOUP {\splitoffarrangedpagesTWO - \ifswaparranged + \ifconditional\arrangedswapstate \global\setbox\arrangedpageA\hbox - {\clippedprintbox0\arrangedpageA - \clippedprintbox1\arrangedpageB}% - \swaparrangedfalse + {\clippedprintbox\zerocount\arrangedpageA + \clippedprintbox\plusone \arrangedpageB}% + \setfalse\arrangedswapstate \else \global\setbox\arrangedpageA\hbox - {\clippedprintbox0\arrangedpageB - \clippedprintbox1\arrangedpageA}% - \swaparrangedtrue + {\clippedprintbox\zerocount\arrangedpageB + \clippedprintbox\plusone \arrangedpageA}% + \settrue\arrangedswapstate \fi \global\ht\arrangedpageA\paperheight \global\setbox\arrangedpageB\box\scratchbox} @@ -575,29 +596,26 @@ {\splitoffarrangedpagesTWO \global\ht\arrangedpageA\paperheight \global\ht\arrangedpageB\paperheight - \ifswaparranged + \ifconditional\arrangedswapstate \global\setbox\arrangedpageA\vbox - {%\forgetall - \offinterlineskip\vskip\paperheight + {\offinterlineskip\vskip\paperheight \box\arrangedpageA\box\arrangedpageB}% - \swaparrangedfalse + \setfalse\arrangedswapstate \else \global\setbox\arrangedpageA\vbox - {%\forgetall - \offinterlineskip\vskip\paperheight + {\offinterlineskip\vskip\paperheight \box\arrangedpageB\box\arrangedpageA}% - \swaparrangedtrue + \settrue\arrangedswapstate \fi \global\setbox\arrangedpageB\box\scratchbox} \def\poparrangedpagesTWO {\ifnum\arrangedpageN>\zerocount - \dontcomplain - \swaparrangedfalse + \setfalse\arrangedswapstate \doloop {\handlearrangedpage \bgroup - \paperwidth\arrangedpageX\paperwidth + \paperwidth \arrangedpageX\paperwidth \paperheight\arrangedpageY\paperheight \ht\arrangedpageA\paperheight \wd\arrangedpageA\paperwidth @@ -606,15 +624,14 @@ \ifdim\ht\arrangedpageB=\zeropoint \exitloop \fi}% - \doglobal\newcounter\arrangedpageN + \global\arrangedpageN\zerocount \fi} \def\pusharrangedpageTWO#1% - {\doglobal\increment\arrangedpageN + {\advancearrangedpageN \reportarrangedpage\arrangedpageN \global\setbox\arrangedpageB\vbox - {%\forgetall - \offinterlineskip + {\offinterlineskip \unvbox\arrangedpageB \allowbreak \ht#1\onepoint @@ -624,16 +641,18 @@ \def\poparrangedpagesTWOTOPSIDE {\ifnum\arrangedpageN>\zerocount \bgroup - \gdef\arrangedpageN{2}\poparrangedpagesTWO + \global\arrangedpageN\plustwo + \poparrangedpagesTWO \let\arrangedpageA\arrangedpageC \let\arrangedpageB\arrangedpageD - \gdef\arrangedpageN{2}\poparrangedpagesTWO - \doglobal\newcounter\arrangedpageN + \global\arrangedpageN\plustwo + \poparrangedpagesTWO + \global\arrangedpageN\zerocount \egroup \fi} \def\pusharrangedpageTWOTOPSIDE#1% - {\doglobal\increment\arrangedpageN + {\advancearrangedpageN \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN \or \handlearrangedpageXandY{#1}000\arrangedpageA % 1 @@ -647,8 +666,7 @@ \def\poparrangedpagesAtoH {\ifnum\arrangedpageN>\zerocount - \dontcomplain - \paperwidth\arrangedpageX\paperwidth + \paperwidth \arrangedpageX\paperwidth \paperheight\arrangedpageY\paperheight \outputarrangedbox\arrangedpageA \outputarrangedbox\arrangedpageB @@ -658,27 +676,26 @@ \outputarrangedbox\arrangedpageF \outputarrangedbox\arrangedpageG \outputarrangedbox\arrangedpageH - \doglobal\newcounter\arrangedpageN + \global\arrangedpageN\zerocount \fi} % to arrange 16 pages on 2 sheets to form one booklet \def\poparrangedpagesAtoD {\ifnum\arrangedpageN>\zerocount - \dontcomplain \paperwidth\arrangedpageX\paperwidth \paperheight\arrangedpageY\paperheight \outputarrangedbox\arrangedpageA \outputarrangedbox\arrangedpageB \outputarrangedbox\arrangedpageC \outputarrangedbox\arrangedpageD - \doglobal\newcounter\arrangedpageN + \global\arrangedpageN\zerocount \fi} % to arrange 16 pages on 4 sheets to form one booklet \def\pusharrangedpageSIXTEENFOUR#1% - {\doglobal\increment\arrangedpageN + {\advancearrangedpageN \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN \or \handlearrangedpageXandY{#1}010\arrangedpageA % 1 @@ -703,7 +720,7 @@ % to arrange 16 pages on 2 sheets to form one booklet \def\pusharrangedpageSIXTEENTWO#1% - {\doglobal\increment\arrangedpageN + {\advancearrangedpageN \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN \or \handlearrangedpageXandY{#1}011\arrangedpageA % 1 @@ -724,6 +741,365 @@ \or \handlearrangedpageXandY{#1}001\arrangedpageA % 16 \poparrangedpages \fi} + +%D Might be used if a printer is printing from a rol or creating mini-books from A4: +%D This section has 16 pages. The folding scheme is first a Z-fold and at the end +%D a final fold in the spine. +%D Coding: [2*8*Z] + +\installpagearrangement 2*8*Z + {\dosetuparrangement{2}{4}{8}{3}{5}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageSIXTEENZ\poparrangedpagesAB\relax} + + +\def\pusharrangedpageSIXTEENZ#1% + {\advancearrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 1 + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}101\arrangedpageB % 3 + \or \handlearrangedpageXandY{#1}111\arrangedpageA % 4 + \or \handlearrangedpageXandY{#1}012\arrangedpageA % 5 + \or \handlearrangedpageXandY{#1}002\arrangedpageB % 6 + \or \handlearrangedpageXandY{#1}103\arrangedpageB % 7 + \or \handlearrangedpageXandY{#1}113\arrangedpageA % 8 + \or \handlearrangedpageXandY{#1}103\arrangedpageA % 9 + \or \handlearrangedpageXandY{#1}113\arrangedpageB % 10 + \or \handlearrangedpageXandY{#1}012\arrangedpageB % 11 + \or \handlearrangedpageXandY{#1}002\arrangedpageA % 12 + \or \handlearrangedpageXandY{#1}101\arrangedpageA % 13 + \or \handlearrangedpageXandY{#1}111\arrangedpageB % 14 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 15 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 16 + \poparrangedpages + \fi} + +%D Another Z-folded section with 12 pages +%D Coding: [2*6*Z] + +\installpagearrangement 2*6*Z + {\dosetuparrangement{2}{3}{6}{3}{4}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageTWELVEZ\poparrangedpagesAB\relax} + +\def\pusharrangedpageTWELVEZ#1% + {\advancearrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 1: rotation (0=upright),x (0=first column),y (0=first row) + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}101\arrangedpageB % 3 + \or \handlearrangedpageXandY{#1}111\arrangedpageA % 4 + \or \handlearrangedpageXandY{#1}012\arrangedpageA % 5 + \or \handlearrangedpageXandY{#1}002\arrangedpageB % 6 + \or \handlearrangedpageXandY{#1}012\arrangedpageB % 7 + \or \handlearrangedpageXandY{#1}002\arrangedpageA % 8 + \or \handlearrangedpageXandY{#1}101\arrangedpageA % 9 + \or \handlearrangedpageXandY{#1}111\arrangedpageB % 10 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 11 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 12 + \poparrangedpages + \fi} + +%D For Heinz' special greeting cards folding. This scheme is also used for the PocketDiary (module): +%D Coding: [1*8] + +\installpagearrangement 1*8 + {\dosetuparrangement{4}{2}{8}{5}{3}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageEIGHTSINGLESIDEDFOLDED\poparrangedpagesTWO\relax} + +\def\pusharrangedpageEIGHTSINGLESIDEDFOLDED#1% + {\advancearrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}020\arrangedpageA % 2 + \or \handlearrangedpageXandY{#1}030\arrangedpageA % 3 + \or \handlearrangedpageXandY{#1}131\arrangedpageA % 4 + \or \handlearrangedpageXandY{#1}121\arrangedpageA % 5 + \or \handlearrangedpageXandY{#1}111\arrangedpageA % 6 + \or \handlearrangedpageXandY{#1}101\arrangedpageA % 7 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 8 + \poparrangedpages + \fi} + +%D This is not a section. \CONTEXT\ places 4 pages on a sheet of paper, singlesided +%D Coding: [1*4] + +\installpagearrangement 1*4 + {\dosetuparrangement{2}{2}{4}{3}{3}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageFOURSINGLESIDEDFOLDED\poparrangedpagesTWO\relax} + +\def\pusharrangedpageFOURSINGLESIDEDFOLDED#1% + {\advancearrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}100\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}001\arrangedpageA % 2 + \or \handlearrangedpageXandY{#1}011\arrangedpageA % 3 + \or \handlearrangedpageXandY{#1}110\arrangedpageA % 4 + \poparrangedpages + \fi} + +%D This imposition scheme was requested by Hraban Ramm, by Willi Egger 21-07-2003 +%D Coding: [3SIDE] + +\installpagearrangement 3SIDE + {\dosetuparrangement{3}{1}{3}{4}{2}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageTHREESIDE\poparrangedpagesAB\relax} + +\def\pusharrangedpageTHREESIDE#1% Willi's approach + {\advancearrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 2 + \or \handlearrangedpageXandY{#1}020\arrangedpageA % 3 + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 4 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 5 + \or \handlearrangedpageXandY{#1}020\arrangedpageB % 6 + \poparrangedpages + \fi} + +%D FLYER in three parts and 6 pages 22-10-2010 +%D Coding: [TRYPTICHON] + +\installpagearrangement TRYPTICHON + {\dosetuparrangement{3}{1}{3}{4}{2}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageFLYERSIX\poparrangedpagesAB\relax} + +\def\pusharrangedpageFLYERSIX#1% Willi's approach + {\advancearrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}020\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 3 + \or \handlearrangedpageXandY{#1}020\arrangedpageB % 4 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 5 + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 6 + \poparrangedpages + \fi} + +%D FLYER in Z-fold with 8 pages 22-01-2010 +%D Coding: [ZFLYER-8] + +\installpagearrangement ZFLYER-8 + {\dosetuparrangement{4}{1}{4}{5}{2}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageZFLYEREIGHT\poparrangedpagesAB\relax} + +\def\pusharrangedpageZFLYEREIGHT#1% Willi's approach + {\advancearrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}030\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 3 + \or \handlearrangedpageXandY{#1}020\arrangedpageB % 4 + \or \handlearrangedpageXandY{#1}030\arrangedpageB % 5 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 6 + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 7 + \or \handlearrangedpageXandY{#1}020\arrangedpageA % 8 + \poparrangedpages + \fi} + +%D FLYER in Z-fold with 10 pages 04-08-2010 +%D Coding: [ZFLYER-10] + +\installpagearrangement ZFLYER-10 + {\dosetuparrangement{5}{1}{5}{6}{2}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageZFLYERTEN\poparrangedpagesAB\relax} + +\def\pusharrangedpageZFLYERTEN#1% Willi's approach + {\advancearrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}040\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 3 + \or \handlearrangedpageXandY{#1}020\arrangedpageB % 4 + \or \handlearrangedpageXandY{#1}030\arrangedpageB % 5 + \or \handlearrangedpageXandY{#1}040\arrangedpageB % 6 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 7 + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 8 + \or \handlearrangedpageXandY{#1}020\arrangedpageA % 9 + \or \handlearrangedpageXandY{#1}030\arrangedpageA % 10 + \poparrangedpages + \fi} + +%D FLYER in Z-fold with 12 pages 04-08-2010 +%D Coding: [ZFLYER-12] + +\installpagearrangement ZFLYER-12 + {\dosetuparrangement{6}{1}{6}{7}{2}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageZFLYERTWELVE\poparrangedpagesAB\relax} + +\def\pusharrangedpageZFLYERTWELVE#1% Willi's approach + {\advancearrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}050\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 3 + \or \handlearrangedpageXandY{#1}020\arrangedpageB % 4 + \or \handlearrangedpageXandY{#1}030\arrangedpageB % 5 + \or \handlearrangedpageXandY{#1}040\arrangedpageB % 6 + \or \handlearrangedpageXandY{#1}050\arrangedpageB % 7 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 8 + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 9 + \or \handlearrangedpageXandY{#1}020\arrangedpageA % 10 + \or \handlearrangedpageXandY{#1}030\arrangedpageA % 11 + \or \handlearrangedpageXandY{#1}040\arrangedpageA % 12 + \poparrangedpages + \fi} + +%D FLYER folded as a map with 6 pages per side. +%D Coding: [MAPFLYER-12] + +\installpagearrangement MAPFLYER-12 + {\dosetuparrangement{3}{2}{6}{4}{3}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageMFLYERTWELVE\poparrangedpagesAB\relax} + +\def\pusharrangedpageMFLYERTWELVE#1% Willi's approach + {\advancearrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}020\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}001\arrangedpageB % 3 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 4 + \or \handlearrangedpageXandY{#1}011\arrangedpageB % 5 + \or \handlearrangedpageXandY{#1}020\arrangedpageB % 6 + \or \handlearrangedpageXandY{#1}021\arrangedpageB % 7 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 8 + \or \handlearrangedpageXandY{#1}001\arrangedpageA % 9 + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 10 + \or \handlearrangedpageXandY{#1}011\arrangedpageA % 11 + \or \handlearrangedpageXandY{#1}021\arrangedpageA % 12 + \poparrangedpages + \fi} + +%D FLYER folded as double window with 4 pages per side. +%D Coding: [DOUBLEWINDOW] + +\installpagearrangement DOUBLEWINDOW + {\dosetuparrangement{4}{1}{4}{5}{2}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageDOUBLEWINDOWEIGHT\poparrangedpagesAB\relax} + +\def\pusharrangedpageDOUBLEWINDOWEIGHT#1% Willi's approach + {\advancearrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}020\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}030\arrangedpageA % 2 + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 3 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 4 + \or \handlearrangedpageXandY{#1}020\arrangedpageB % 5 + \or \handlearrangedpageXandY{#1}030\arrangedpageB % 6 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 7 + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 8 + \poparrangedpages + \fi} + +%D Imposition as requested by Jan Pohanka 26-08-2010, 4 pages, two verso, two recto, +%D uneven pages upright and down, even pages top and rotated 180. +%D Implementation with 2 pages for conference-name-display +%D Coding: [1*2-Conference] + +\installpagearrangement 1*2-Conference + {\dosetuparrangement{1}{2}{4}{3}{2}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageCONFERENCE2\poparrangedpagesAB\relax} + +\def\pusharrangedpageCONFERENCE2#1% + {\advancearrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}001\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}100\arrangedpageA % 2 + \poparrangedpages + \fi} + +%D Implementation with 4 pages for conference-name-display +%D Coding: [1*4-Conference] + +\installpagearrangement 1*4-Conference + {\dosetuparrangement{1}{2}{4}{3}{2}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageCONFERENCE4\poparrangedpagesAB\relax} + +\def\pusharrangedpageCONFERENCE4#1% + {\advancearrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}001\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}100\arrangedpageA % 2 + \or \handlearrangedpageXandY{#1}011\arrangedpageB % 3 + \or \handlearrangedpageXandY{#1}110\arrangedpageB % 4 + \poparrangedpages + \fi} + +%D There should be arrangements for sections made of heavy and thick paper. i.e. the heavier the paper +%D the fewer pages per section: +%D Section with 8 pages put on to sheets of paper. Each sheet carries recto 2 and verso 2 pages. +%D Coding: [2*2*2] + +\installpagearrangement 2*2*2 + {\dosetuparrangement{2}{1}{2}{3}{2}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageEIGHTTWO\poparrangedpagesAtoD\relax} + +\def\pusharrangedpageEIGHTTWO#1% + {\advancearrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}010\arrangedpageC % 3 + \or \handlearrangedpageXandY{#1}000\arrangedpageD % 4 + \or \handlearrangedpageXandY{#1}010\arrangedpageD % 5 + \or \handlearrangedpageXandY{#1}000\arrangedpageC % 6 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 7 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 8 + \poparrangedpages + \fi} + +%D Section with 12 pages, built from three sheets of paper. +%D Each sheet carries 2 pages recto and verso. +%D Coding: [2*2*3] + +\def\poparrangedpagesAtoF + {\ifnum\arrangedpageN>\zerocount + \paperwidth \arrangedpageX\paperwidth + \paperheight\arrangedpageY\paperheight + \outputarrangedbox\arrangedpageA + \outputarrangedbox\arrangedpageB + \outputarrangedbox\arrangedpageC + \outputarrangedbox\arrangedpageD + \outputarrangedbox\arrangedpageE + \outputarrangedbox\arrangedpageF + \global\arrangedpageN\zerocount + \fi} + +\installpagearrangement 2*2*3 + {\dosetuparrangement{2}{1}{2}{3}{2}% X,Y,Total,hcutmarks,vcutmarks + \pusharrangedpageTWELVETWO\poparrangedpagesAtoF\relax} + +\def\pusharrangedpageTWELVETWO#1% + {\advancearrangedpageN + \reportarrangedpage\arrangedpageN + \ifcase\arrangedpageN + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 1 rot,hskip,vskip + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}010\arrangedpageC % 3 + \or \handlearrangedpageXandY{#1}000\arrangedpageD % 4 + \or \handlearrangedpageXandY{#1}010\arrangedpageE % 5 + \or \handlearrangedpageXandY{#1}000\arrangedpageF % 6 + \or \handlearrangedpageXandY{#1}010\arrangedpageF % 7 + \or \handlearrangedpageXandY{#1}000\arrangedpageE % 8 + \or \handlearrangedpageXandY{#1}010\arrangedpageD % 9 + \or \handlearrangedpageXandY{#1}000\arrangedpageC % 10 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 11 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 12 + \poparrangedpages + \fi} % % handy for stickers etc, this way we can treat them as page % @@ -738,11 +1114,10 @@ % \starttext \dorecurse{30}{test \recurselevel \page} \stoptext \def\pusharrangedpageXY#1% - {\doglobal\increment\arrangedpageN - \reportarrangedpage\arrangedpageN - \doglobal\increment\arrangedpageM - \global\setbox\arrangedpageB\hbox - \ifdim\@@ppwidth>\zeropoint to \@@ppwidth \fi + {\advancearrangedpageN + \global\advance\arrangedpageM\plusone + \reportarrangedpage\arrangedpageN + \global\setbox\arrangedpageB\hbox \ifdim\@@ppwidth>\zeropoint to \@@ppwidth \fi {\ifvoid\arrangedpageB\else \unhbox\arrangedpageB \ifdim\@@ppdx>\zeropoint \else \hss\fi @@ -751,8 +1126,7 @@ \fi \box#1}% \ifnum\arrangedpageM<\arrangedpageX\else - \global\setbox\arrangedpageA\vbox - \ifdim\@@ppheight>\zeropoint to \@@ppheight \fi + \global\setbox\arrangedpageA\vbox \ifdim\@@ppheight>\zeropoint to \@@ppheight \fi {\offinterlineskip \ifvoid\arrangedpageA\else \unvbox\arrangedpageA @@ -761,7 +1135,7 @@ \ifdim\@@ppdy>\zeropoint \else \vss\fi \fi \box\arrangedpageB}% - \doglobal\newcounter\arrangedpageM + \global\arrangedpageM\zerocount \fi \ifnum\arrangedpageN<\arrangedpageT\else \poparrangedpages @@ -769,12 +1143,11 @@ \def\poparrangedpagesXY {\ifnum\arrangedpageN>\zerocount - \dontcomplain - \paperwidth\arrangedpageX\paperwidth - \paperheight \arrangedpageY\paperheight + \paperwidth \arrangedpageX\paperwidth + \paperheight\arrangedpageY\paperheight \outputarrangedbox\arrangedpageA - \doglobal\newcounter\arrangedpageN - \doglobal\newcounter\arrangedpageM + \global\arrangedpageN\zerocount + \global\arrangedpageM\zerocount \fi} \installpagearrangement XY @@ -813,20 +1186,17 @@ \def\dodefinepageshift[#1][#2][#3]% {\setvalue{\??pt#2:#1}{#3}} -\letempty \hpageshifts \newcounter\nofhpageshifts -\letempty \vpageshifts \newcounter\nofvpageshifts - -% \let\shiftprintpagebox\gobbleoneargument -% \let\shiftpaperpagebox\gobbleoneargument +\letempty\hpageshifts \newcount\nofhpageshifts +\letempty\vpageshifts \newcount\nofvpageshifts \def\dogetpageshift#1#2#3% #1=\dimenx #2=\xpageshifts #3=\nofxpageshifts - {\ifx#2\empty + {\ifx#2\empty % we could do this in lua #1\zeropoint \else - \doglobal\increment#3% + \global\advance#3\plusone \getfromcommacommand[#2][#3]% \ifx\commalistelement\empty - \globallet#3\!!plusone + \global#3\plusone % we cycle \getfromcommacommand[#2][#3]% \fi \ifx\commalistelement\empty @@ -853,16 +1223,10 @@ \def\dosetuppageshift[#1][#2][#3]% page|paper horizontal vertical {\ifthirdargument % paper=arrange - \let\hpageshifts\empty - \let\vpageshifts\empty - \let\shiftprintpagebox\gobbleoneargument - \let\shiftpaperpagebox\gobbleoneargument - \doifdefined{\??pt\v!horizontal:#2} - {\edef\hpageshifts{\getvalue{\??pt\v!horizontal:#2}}}% - \doifdefined{\??pt\v!vertical :#3} - {\edef\vpageshifts{\getvalue{\??pt\v!vertical :#3}}}% - \doif{#1}\v!page{\let\shiftprintpagebox\shiftpagebox}% - \doif{#1}\v!paper{\let\shiftpaperpagebox\shiftpagebox}% + \edef\hpageshifts{\ifcsname\??pt\v!horizontal:#2\endcsname\csname\??pt\v!horizontal:#2\endcsname\fi}% + \edef\vpageshifts{\ifcsname\??pt\v!vertical :#3\endcsname\csname\??pt\v!vertical :#3\endcsname\fi}% + \doifelse{#1}\v!page {\let\shiftprintpagebox\shiftpagebox}{\let\shiftprintpagebox\gobbleoneargument}% + \doifelse{#1}\v!paper{\let\shiftpaperpagebox\shiftpagebox}{\let\shiftpaperpagebox\gobbleoneargument}% \else\ifsecondargument \doifinsetelse{#1}{\v!page,\v!paper} {\setuppageshift[#1][#2][#2]} @@ -870,430 +1234,6 @@ \else\iffirstargument \setuppageshift[\v!page][#1][#1]% \fi\fi\fi} - -%D One can (mis)use this mechanism, in close cooperation -%D with \PDFTEX\ to arrange pages of already produced files. -%D -%D \starttyping -%D \insertpages[file.pdf][1,3][n=30,width=18cm] -%D \stoptyping -%D -%D The pages are inserted in the text area, and even pages -%D are repositioned according to the width. In this example -%D empty pages are added after page 1 and 3. -%D -%D Selecting pages can be accomplished by: -%D -%D \starttyping -%D \filterpages[file.pdf][1,3,5][n=30,width=18cm] -%D \stoptyping -%D -%D One may pass \type {odd} or \type {even} instead of a -%D comma separated list. A third alternative is: -%D -%D \starttyping -%D \copypages[file.pdf][n=30,scale=950] -%D \stoptyping -%D -%D This macros inserts the page, according to the settings -%D provided. - -\def\insertpages - {\dotripleempty\doinsertpages} - -\def\doinsertpages[#1][#2][#3]% - {\doifassignmentelse{#2} - {\dodoinsertpages[#1][][#2]} - {\dodoinsertpages[#1][#2][#3]}} - -\def\dodoinsertpages[#1][#2][#3]% - {\bgroup - \dontcomplain - \getfiguredimensions[#1]% - \getparameters[\??ip][\c!n=\noffigurepages,\c!width=\!!zeropoint,#3]% - \doifinset0{#2}{\null\page}% - \dorecurse\@@ipn - {\dofilterpage{#1}\recurselevel - \doifinset\recurselevel{#2}{\null\page}}% - \egroup} - -\def\filterpages - {\dotripleempty\dofilterpages} - -\def\dofilterpages[#1][#2][#3]% % \noffigurepages not yet supported - {\bgroup - \dontcomplain - \getfiguredimensions[#1]% - \getparameters[\??ip][\c!n=\noffigurepages,\c!width=\!!zeropoint,#3]% - \doifelse{#2}\v!even - {\dorecurse\@@ipn - {\ifodd\recurselevel\relax\else\dofilterpage{#1}\recurselevel\fi}} - {\doifelse{#2}\v!odd - {\dorecurse\@@ipn - {\ifodd\recurselevel\relax\dofilterpage{#1}\recurselevel\fi}} - {\def\dodocommand##1% - {\ifnum##1>\@@ipn\else\dofilterpage{#1}{##1}\fi}% - \def\docommand##1% - {\dowithrange{##1}\dodocommand}% - \processcommalist[#2]\docommand}}% - \egroup} - -\def\dofilterpage#1#2% - {\hbox to \textwidth - {\ifdoublesided\ifdim\@@ipwidth>\zeropoint\relax\ifodd\realpageno\else - \hfill - \def\dowithfigure{\hskip-\@@ipwidth}% - \fi\fi\fi - \setbox0\hbox - {\externalfigure[#1][\c!page=#2,\c!height=\textheight]}% - \wd0\zeropoint - \box0} - \page} - -\def\copypages - {\dodoubleempty\docopypages} - -\def\docopypages[#1][#2]% - {\bgroup - \getfiguredimensions[#1]% - \getparameters[\??ip] - [\c!n=\noffigurepages, - \c!marking=\v!off, - \c!scale=\!!thousand, - \c!offset=\!!zeropoint, - #2]% - \dorecurse\@@ipn - {\vbox to \textheight - {\hsize\textwidth - \scratchdimen\@@ipoffset - \centeredbox - {\doifelse\@@ipmarking\v!on\cuthbox\hbox - {\ifdim\scratchdimen>\zeropoint\relax - \advance\vsize -2\scratchdimen - \advance\hsize -2\scratchdimen - \externalfigure[#1][\c!page=\recurselevel,#2,\c!scale=,\c!factor=\v!max,\c!offset=\v!overlay]% - \else - \externalfigure[#1][\c!page=\recurselevel,#2,\c!offset=\v!overlay]% - \fi}}} - \page} - \egroup} - -%D \macros -%D {combinepages} -%D -%D Yet another way of postprocessing is handles by \type -%D {\combinepages}. This macro builds a matrix of pages from a -%D file, for example: -%D -%D \starttyping -%D \setuppapersize -%D [A4][A4] % or [A4,landscape][A4,landscape] -%D -%D \setuplayout -%D [header=0pt,footer=1cm, -%D backspace=1cm,topspace=1cm, -%D width=middle,height=middle] -%D -%D \setupfootertexts -%D [presentation---\currentdate\space---\space\pagenumber] -%D -%D \starttext -%D \combinepages[slides][nx=2,ny=3,frame=on] -%D \stoptext -%D \stoptyping -%D -%D One can influence the way the pages are combined. (This -%D will be explained some time.) - -\def\combinepages - {\dodoubleempty\docombinepages} - -\def\docombinepages[#1][#2]% a=perpag b=free - {\bgroup - \dontcomplain - \getfiguredimensions[#1]% - \getparameters - [\??ip] - [\c!alternative=\v!a, - \c!n=\noffigurepages,\c!nx=2,\c!ny=2,\c!start=1,\c!stop=\!!maxcard, - \c!distance=\bodyfontsize, - \c!bottom=\vfill,\c!top=\vss, - \c!left=\hss,\c!right=\hss, - \c!before=\page,\c!after=\page,\c!inbetween=\blank, - \c!frame=,\c!background=,\c!backgroundcolor=, - #2]% - \def\@@ipname{#1}% - \@@ipbefore - \expandcheckedcsname{\??ip::\c!alternative:}\@@ipalternative\v!b - \@@ipafter - \egroup} - -\setvalue{\??ip::\c!alternative:\v!a}% - {\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}} - -\setvalue{\??ip::\c!alternative:\v!c}% - {\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}} - -\setvalue{\??ip::\c!alternative:\v!horizontal}{\getvalue{\??ip::\c!alternative:\v!a}} -\setvalue{\??ip::\c!alternative:\v!vertical }{\getvalue{\??ip::\c!alternative:\v!c}} - -\setvalue{\??ip::\c!alternative:\v!b}% - {\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 - \normalexpanded{\noexpand\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 -%D This command is not yet documented. Usage: -%D -%D \starttyping -%D \setuppagecomment[state=start,location=right] -%D -%D \startpagecomment -%D \input knuth -%D \stoppagecomment -%D \stoptyping - -\unexpanded\def\setuppagecomment - {\dosingleempty\dosetuppagecomment} - -\def\dosetuppagecomment[#1]% - {\getparameters[\??pc][#1]% - \doifelse\@@pcstate\v!start - {\doifinsetelse\@@pclocation{\v!bottom,\v!top} - {\setuppapersize[\c!left=\hskip\@@pcoffset]% - \edef\@@pcpaperheight{\the\dimexpr\paperheight+\@@pcoffset+\@@pcoffset+\@@pcdistance+\@@pcheight\relax}% - \edef\@@pcpaperwidth {\the\dimexpr\paperwidth+\@@pcoffset+\@@pcoffset\relax}% - \defineoverlay[\v!pagecomment][\placepagecommentTB]} - {\setuppapersize[\c!top=\vskip\@@pcoffset]% - \edef\@@pcpaperheight{\the\dimexpr\paperheight+\@@pcoffset+\@@pcoffset\relax}% - \edef\@@pcpaperwidth {\the\dimexpr\paperwidth+\@@pcoffset+\@@pcoffset+\@@pcdistance+\@@pcwidth\relax}% - \defineoverlay[\v!pagecomment][\placepagecommentLR]}% - \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]}]% - \definepapersize - [\v!pagecomment] - [\c!height=\@@pcpaperheight, - \c!width=\@@pcpaperwidth]% - \let\@@pcprintpapersize\printpapersize - \setuppapersize[\papersize][\v!pagecomment]% - \setupbackgrounds[\v!paper][\c!background=\v!pagecomment]} - {\doif\@@pcstate\v!stop % else initialization invokes backgrounds - {% this should be tested first - % \normalexpanded{\noexpand\setuppapersize[\papersize][\@@pcprintpapersize]}% - \setupbackgrounds[\v!paper][\c!background=]}}} - -\def\@@pcprintpapersize{\printpapersize} - -\unexpanded\def\placepagecommentTB - {\vbox to \printpaperheight - {%\forgetall - \hsize\printpaperwidth - \vskip\@@pcoffset - \doifelse\@@pclocation\v!bottom{\vskip\dimexpr\paperheight+\@@pcdistance\relax}\vss - \hskip\@@pcoffset - \vbox to \@@pcheight - {%\forgetall - \hsize\paperwidth - \ifpagecomment - \getbuffer[\v!pagecomment]% - \global\pagecommentfalse - \fi}% - \hfill - \doifelse\@@pclocation\v!bottom\vss{\vskip\dimexpr\paperheight+\@@pcdistance\relax}% - \vskip\@@pcoffset}} - -\unexpanded\def\placepagecommentLR - {\hbox to \printpaperwidth - {\hskip\@@pcoffset - \doifelse\@@pclocation\v!right{\hskip\paperwidth\hskip\@@pcdistance}\hss - \vbox to \printpaperheight - {%\forgetall - \vskip\@@pcoffset - \hsize\@@pcwidth - \ifpagecomment - \getbuffer[\v!pagecomment]% - \global\pagecommentfalse - \fi - \vss}% - \doifelse\@@pclocation\v!right\hss{\hskip\paperwidth\hskip\@@pcdistance}% - \hskip\@@pcoffset}} - -\newif\ifpagecomment - -\setvalue{\e!start\v!pagecomment}% - {\global\pagecommenttrue - \dostartbuffer[\v!pagecomment][\e!start\v!pagecomment][\e!stop\v!pagecomment]} - -\setuppagecomment - [\c!state=, % \v!stop would invoke background calculation - \c!location=\v!bottom, - \c!offset=.5cm, - \c!distance=.5cm, - \c!height=5cm, - \c!width=10cm] - -% This macro cuts a page into n parts that can be pasted -% together. - -\def\slicepages - {\dotripleempty\doslicepages} - -\def\doslicepages[#1][#2][#3]% - {\ifthirdargument - \dodoslicepages[#1][#2][#3]% - \else - \dodoslicepages[#1][#2][#2]% - \fi} - -\newcounter\slicedpagenumber - -\def\dodoslicepages[#1][#2][#3]% - {\bgroup - \dontcomplain - \globallet\slicedpagenumber\!!zerocount - \getfiguredimensions[#1] - \getparameters - [\??ip] - [\c!n=1, - \c!offset=\!!zeropoint, - \c!hoffset=\!!zeropoint,\c!voffset=\!!zeropoint, - \c!width=\figurewidth,\c!height=\figureheight,#2] - \ifnum\@@ipn>\zerocount - \definepapersize - [\s!dummy][\c!height=\@@ipheight,\c!width=\@@ipwidth] - \setuppapersize - [\s!dummy][\s!dummy] - \setuplayout - [\c!backspace=\!!zeropoint,\c!topspace=\!!zeropoint, - \c!height=\v!middle,\c!width=\v!middle, - \c!textdistance=\!!zeropoint, - \c!header=\!!zeropoint,\c!footer=\!!zeropoint] - \fi - \dorecurse\noffigurepages - {\global\let\slicedpagenumber\recurselevel - \ifnum\@@ipn>\plusone - \dorecurse\@@ipn - {\let\xslice\recurselevel - \dorecurse\@@ipn - {\let\yslice\recurselevel - \clip - [\c!nx=\@@ipn,\c!ny=\@@ipn,\c!x=\xslice,\c!y=\yslice] - {\scale - [\c!scale=\@@ipn000] - {\externalfigure[#1][\c!page=\slicedpagenumber]}} - \page}} - \else - \ifodd\slicedpagenumber\relax - \getparameters[\??ip][#2] - \else - \getparameters[\??ip][#3] - \fi - \hskip\@@ipoffset - \clip - [\c!hoffset=\@@iphoffset,\c!voffset=\@@ipvoffset, - \c!height=\@@ipheight,\c!width=\@@ipwidth] - {\externalfigure[#1][\c!page=\slicedpagenumber]} - \page - \fi} - \egroup} -% \starttext \slicepages[slice1.pdf][n=3] \stoptext \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/page-ini.mkiv b/Master/texmf-dist/tex/context/base/page-ini.mkiv index 07d3422829c..7969e4f3e46 100644 --- a/Master/texmf-dist/tex/context/base/page-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/page-ini.mkiv @@ -28,7 +28,7 @@ \def\m!otr{otr} -\chardef\normalpagebox=255 +% \setnewconstant\normalpagebox 255 % already set \newbox\pagebox @@ -300,11 +300,14 @@ \expandafter\invokenormaloutputroutine \fi} -\mainoutput{\invokeoutputroutine} \output{\inotrtrue\the\mainoutput} +\mainoutput{\invokeoutputroutine} %D Some hooks: -\output{\inotrtrue\the\everybeforeoutput\the\mainoutput\the\everyafteroutput} +\def\setoutputroutine#1% + {\global\output{\inotrtrue\the\everybeforeoutput#1\the\everyafteroutput}} + +\setoutputroutine{\the\mainoutput} \ifx\pagediscards\undefined \let\pagediscards\relax \fi @@ -332,8 +335,8 @@ \newcount\nofcolumns \nofcolumns = 1 \newcount\mofcolumns \mofcolumns = 1 -\chardef\maxnofcolumns = 50 -\chardef\allocatednofcolumns = 0 +\setnewconstant\maxnofcolumns 50 +\setnewconstant\allocatednofcolumns 0 %D The next dimensions reports the final column height @@ -366,7 +369,7 @@ \@EA\newbox\csname\@col@-\recurselevel-h\endcsname % top insert \@EA\newbox\csname\@col@-\recurselevel-l\endcsname % top insert \fi}% - \global\chardef\allocatednofcolumns=\nofcolumns + \global\allocatednofcolumns\nofcolumns \fi} \def\firstcolumnbox {\columntextbox\plusone} @@ -448,7 +451,7 @@ \newdimen\localcolumnwidth \newdimen\savedpagetotal -\chardef\columndirection=0 % 0:lr 1:rl +\newconstant\columndirection % 0:lr 1:rl \def\minbalancetoplines {1} \def\minfreecolumnlines {2} @@ -562,8 +565,7 @@ \fi \fi#1#2% \resetselectiepagina - \incrementpagenumber - \incrementsubpagenumber + \doincrementpageboundcounters % should hook into an every \checkpagedimensions \ifnum\outputpenalty>\superpenalty \else \dosupereject @@ -576,8 +578,6 @@ \maxdeadcycles=1000 -% will be installable tracer; better use chardef - % this needs a real cleanup \def\doplaceversiontext#1#2% @@ -601,7 +601,7 @@ \vskip\!!sixpoint \hbox to \makeupwidth {\infofont - \getmessage\m!systems{27}:\space\currentdate\space + \getmessage\m!system{27}:\space\currentdate\space \doplaceversiontext\v!project \currentproject \doplaceversiontext\v!product \currentproduct \doplaceversiontext\v!component\currentcomponent @@ -612,13 +612,13 @@ % tot hier \def\doversion[#1]% - {\chardef\conceptmode\zerocount + {\conceptmode\zerocount \overfullrule\zeropoint \processaction % \v!final=> [#1] - [ \v!concept=>\chardef\conceptmode\plusone, % simple banner - \v!file=>\chardef\conceptmode\plustwo, % full banner - \v!temporary=>\chardef\conceptmode\plusthree % full banner plus + [ \v!concept=>\conceptmode\plusone, % simple banner + \v!file=>\conceptmode\plustwo, % full banner + \v!temporary=>\conceptmode\plusthree % full banner plus \overfullrule5\points]} % info in the margin \def\version @@ -699,28 +699,28 @@ \newtoks\afterpage \newtoks\aftereverypage \newtoks\beforepage \newtoks\beforeeverypage -\chardef\showgridstate=0 +\newconstant\showgridstate -\def\showgrid +\unexpanded\def\showgrid {\dosingleempty\doshowgrid} \def\doshowgrid[#1]% - {\chardef\showgridstate \plusone % downward compatible default - \chardef\gridboxlinemode \plusone - \chardef\gridboxlinenomode\plusone + {\showgridstate \plusone % downward compatible default + \gridboxlinemode \plusone + \gridboxlinenomode\plusone \processallactionsinset [#1]% - [ \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, - \v!outer=>\chardef\gridboxlinenomode\plusthree]% + [ \v!reset=>\showgridstate \zerocount, + \v!bottom=>\showgridstate \plusone, + \v!top=>\showgridstate \plustwo, + \v!none=>\gridboxlinemode \zerocount, + \v!all=>\gridboxlinemode \plusone, + \v!lines=>\gridboxlinemode \plustwo, + \v!frame=>\gridboxlinemode \plusthree, + \v!nonumber=>\gridboxlinenomode\zerocount, + \v!right=>\gridboxlinenomode\plusone, + \v!left=>\gridboxlinenomode\plustwo, + \v!outer=>\gridboxlinenomode\plusthree]% \ifcase\showgridstate \let\addtextgridlayer\gobbleoneargument \else % 1=bottom 2=top @@ -781,50 +781,56 @@ \newif\ifarrangingpages \arrangingpagesfalse -\chardef\pageornamentstate\zerocount % 0=on 1=one-off 2=always-off +\newconstant\pageornamentstate % 0=on 1=one-off 2=always-off -\def\pagebodyornamentstrue {\chardef\pageornamentstate\zerocount} % for a while -\def\pagebodyornamentsfalse{\chardef\pageornamentstate\plusone} % for a while +\def\pagebodyornamentstrue {\pageornamentstate\zerocount} % for a while +\def\pagebodyornamentsfalse{\pageornamentstate\plusone} % for a while \appendtoks \ifcase\pageornamentstate\or - \chardef\pageornamentstate\zerocount + \pageornamentstate\zerocount \fi \to \everyaftershipout \let\poparrangedpages\relax \let\pusharrangedpage\relax -\ifx\shiftprintpagebox\undefined +\ifdefined\shiftprintpagebox \else \let\shiftprintpagebox\gobbleoneargument \let\shiftpaperpagebox\gobbleoneargument \fi -\ifx\registerpageposition\undefined +\ifdefined\registerpageposition \else \let\registerpageposition\gobbleoneargument \fi -\def\reportarrangedpage#1% - {\showmessage\m!systems - {23}{\the\realpageno.\the\pageno\ifnum\subpageno>0 .\the\subpageno\fi,#1}} - \newif\ifsavepagebody \newbox\savedpagebody % beware, \??ly is used before defined, i.e. bad module design \setuplayout[\c!method=\v!normal] +\def\docolumnpagebodymarks#1#2#3#4% first last column box + {\ifnum#3=#1\relax + \dosynchronizemarking[\number#3,\v!column:\number#3,\v!first,\v!column:\v!first][#4]% + \else\ifnum#3=#2\relax + \dosynchronizemarking[\number#3,\v!column:\number#3,\v!last, \v!column:\v!last ][#4]% + \else + \dosynchronizemarking[\number#3,\v!column:\number#3 ][#4]% + \fi\fi} + \def\buildpagebody#1#2% {\ifsavepagebody\global\setbox\savedpagebody\fi \vbox - {\beginrestorecatcodes -% \forgetall % igv problemen, check: \boxmaxdepth\maxdimen + {%\pushcatcodetable + %\forgetall % igv problemen, check: \boxmaxdepth\maxdimen \boxmaxdepth\maxdimen % new \dontcomplain + % marks get done here + \dosynchronizemarking[\v!page][#2]% % the following plugin uses and sets pagebox; beware: this % will change and is for my (hh) personal experiments - \executeifdefined{\??ly\c!method\@@lymethod}% - {\getvalue{\??ly\c!method\v!normal}}#1#2% + \executeifdefined{\??ly\c!method\@@lymethod}{\getvalue{\??ly\c!method\v!normal}}#1#2% % the finishing touch \ifcase\pageornamentstate \addpagebackground \pagebox @@ -852,7 +858,7 @@ \negateprintbox \pagebox \fi \box\pagebox - \endrestorecatcodes}% + }% \popcatcodetable \ifsavepagebody\copy\savedpagebody\fi} \setvalue{\??ly\c!method\v!normal}#1#2% @@ -893,8 +899,7 @@ \prependtoks \let\nextbox\nestednextbox \to \everybeforepagebody \def\dopagebody#1#2% - {%\getallmarks % now in following token register - \the\everybeforepagebody + {\the\everybeforepagebody \starttextproperties % \setnextsubpageno % nog eens: als in pagina (tbv standaard opmaak) \dontshowboxes % dan hier blokkeren en verderop resetten @@ -919,8 +924,8 @@ \newif\ifpagebreakdisabled \pagebreakdisabledfalse -\chardef\testpagemethod \zerocount % todo: \testnewpage[method=,lines=,voffset=] -\chardef\testpagetrigger\zerocount +\newconstant\testpagemethod % todo: \testnewpage[method=,lines=,voffset=] +\newconstant\testpagetrigger \def\testpage {\dotripleempty\dotestpage[\plusone ]} % \def\testpageonly{\dotripleempty\dotestpage[\plustwo ]} % no penalties added to the mvl @@ -1020,9 +1025,9 @@ \penalty-\!!tenthousand % untested ! ! \column \fi \fi} -\let\resetcurrentsectionmarks\relax - -% was: \resetsectionmarks\firstsection, zie \handlepagebreak +\ifdefined\resetcurrentstructuremarkswithpage \else + \let\resetcurrentstructuremarkswithpage\relax +\fi \def\page{\pagebreak} % the short form of \pagebreak (mult-com one) @@ -1057,7 +1062,7 @@ \edef\prevrealpageno{\the\realpageno}% \ifcase\pageornamentstate \or % disable reset after shipout - \global\chardef\pageornamentstate\plustwo + \global\pageornamentstate\plustwo \fi \iffirstargument % or if empty i.e. [] \executepagebreakhandlers{#1}% @@ -1070,7 +1075,7 @@ % as WS found out so we have to wait till the next side % effect shows up % \ifcase\pageornamentstate\or - \global\chardef\pageornamentstate\zerocount + \global\pageornamentstate\zerocount % \fi \fi \egroup} @@ -1106,7 +1111,7 @@ {} % do nothing if empty \installpagebreakhandler \v!reset - {% better not: \global\chardef\pageornamentstate\zerocount + {% better not: \global\pageornamentstate\zerocount \resetpagebreak} \installpagebreakhandler \v!disable @@ -1128,7 +1133,7 @@ \installpagebreakhandler \v!blank {\ifcase\pageornamentstate - \global\chardef\pageornamentstate\plusone + \global\pageornamentstate\plusone \fi} \installpagebreakhandler \v!no @@ -1164,20 +1169,20 @@ \installpagebreakhandler \v!left {\ejectinsert \gotonextpageX % will become \gotonextpage - \doifbothsidesoverruled{}{\resetcurrentsectionmarks\ejectdummypage}{}} + \doifbothsidesoverruled{}{\resetcurrentstructuremarkswithpage\ejectdummypage}{}} \installpagebreakhandler \v!right {\ejectinsert \gotonextpageX % will become \gotonextpage - \doifbothsidesoverruled{}{}{\resetcurrentsectionmarks\ejectdummypage}} + \doifbothsidesoverruled{}{}{\resetcurrentstructuremarkswithpage\ejectdummypage}} \installpagebreakhandler \v!even {\page - \doifoddpageelse{\resetcurrentsectionmarks\ejectdummypage}\donothing} + \doifoddpageelse{\resetcurrentstructuremarkswithpage\ejectdummypage}\donothing} \installpagebreakhandler \v!odd {\page - \doifoddpageelse\donothing{\resetcurrentsectionmarks\ejectdummypage}} + \doifoddpageelse\donothing{\resetcurrentstructuremarkswithpage\ejectdummypage}} \installpagebreakhandler \v!quadruple % not yet ok inside columnsets {\ifdoublesided @@ -1298,7 +1303,7 @@ % We don't want spurious last pages (due to left over marks): \def\noshipout - {\writestatus\m!systems{ignoring further shipouts}% + {\writestatus\m!system{ignoring further shipouts}% \global\advance\realpageno\minusone % else no flush of resources \dowithnextbox{\deadcycles\zerocount}} @@ -1424,7 +1429,7 @@ \def\registeredtextarea#1#2#3% #1=lower-dp #2=correct-ht #3=box {\hbox\bgroup \ifregistertextareas \ifx\registerMPtextarea\undefined \else - \setbox\registertextbox\null + \setbox\registertextbox\emptyhbox \wd\registertextbox\wd#3% \ht\registertextbox\ht#3% \dp\registertextbox\dp#3% @@ -1494,7 +1499,7 @@ {\ifvoid\facingpage\else \ifnum\realpageno>\plusone \bgroup - \chardef\pageornamentstate\plusone + \pageornamentstate\plusone \finishfacingpage \myshipout{\buildpagebody\box\facingpage}% \egroup diff --git a/Master/texmf-dist/tex/context/base/page-lay.mkii b/Master/texmf-dist/tex/context/base/page-lay.mkii index de1194c2ae8..d40e1ccb7b9 100644 --- a/Master/texmf-dist/tex/context/base/page-lay.mkii +++ b/Master/texmf-dist/tex/context/base/page-lay.mkii @@ -295,7 +295,7 @@ {\doifelsenothing{#2} {\expanded{\dodosetuppapersize [\executeifdefined{\??pp:1:#1}{#1}]% - [\executeifdefined{\??pp:2:#1}{}]}} + [\executeifdefined{\??pp:2:#1}{\v!default}]}} {\doifassignmentelse{#2} {\getparameters[\??pp\executeifdefined{\??pp:1:#1}{#1}][#2]} {\expanded{\dodosetuppapersize @@ -1150,11 +1150,11 @@ %D \showsetup{showsetups} %D %showsetup{showmargins} -\fetchruntimecommand \showprint {page-run.mkii} -\fetchruntimecommand \showframe {page-run.mkii} -\fetchruntimecommand \showlayout {page-run.mkii} -\fetchruntimecommand \showsetups {page-run.mkii} -\fetchruntimecommand \showmargins {page-run.mkii} +\fetchruntimecommand \showprint {page-run} +\fetchruntimecommand \showframe {page-run} +\fetchruntimecommand \showlayout {page-run} +\fetchruntimecommand \showsetups {page-run} +\fetchruntimecommand \showmargins {page-run} %D The default dimensions are quite old and will not change. %D The funny fractions were introduced when we went from fixed @@ -1372,10 +1372,7 @@ %D paper size with the typeset paper size. This setting should %D come after the first layout specification (already done). -\setuppapersize - [A4][A4] - -%D A few goodies: +% not interfaced ! \definepapersize [oversized] @@ -1392,6 +1389,19 @@ [ \c!width=\dimexpr \paperheight+1.5cm\relax, \c!height=\dimexpr2\paperwidth +1.5cm\relax] +\definepapersize + [\v!default] + [ \c!width=\paperwidth, + \c!height=\paperheight] + +\definepapersize + [samesized] + [ \c!width=\paperwidth, + \c!height=\paperheight] + +\setuppapersize + [A4][samesized] + %D For orthogonality: \definepapersize diff --git a/Master/texmf-dist/tex/context/base/page-lay.mkiv b/Master/texmf-dist/tex/context/base/page-lay.mkiv index 28f9be594dc..812f3a3aca8 100644 --- a/Master/texmf-dist/tex/context/base/page-lay.mkiv +++ b/Master/texmf-dist/tex/context/base/page-lay.mkiv @@ -13,13 +13,6 @@ \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 -% level, wel binnen bepaalde berekeningen - %D Before you start wondering why some of the page related %D modules skip upward or left in order to place elements, you %D must realize that the reference point is the top left @@ -42,6 +35,7 @@ \newdimen\paperheight \paperheight = 297mm \newdimen\paperwidth \paperwidth = 210mm +\newdimen\paperoffset \paperoffset = 0mm \newdimen\printpaperheight \printpaperheight = \paperheight \newdimen\printpaperwidth \printpaperwidth = \paperwidth @@ -114,9 +108,6 @@ %D is no area, we use a zero distance in case there is no %D area. -\def\layoutdistance#1#2% - {\ifdim\zeropoint<#1\layoutparameter#2\else\zeropoint\fi} - %D The horizontal distances are: \newdimen \leftedgedistance @@ -133,23 +124,53 @@ %D We need to calculate the extra distances: +\newdimen\naturalmarginwidth +\newdimen\naturaledgewidth +\newdimen\naturalmargindistance +\newdimen\naturaledgedistance +\newdimen\naturalleftedgedistance +\newdimen\naturalrightedgedistance +\newdimen\naturalleftmargindistance +\newdimen\naturalrightmargindistance +\newdimen\naturaltopdistance +\newdimen\naturalheaderdistance +\newdimen\naturalfooterdistance +\newdimen\naturalbottomdistance + +\def\layoutdistance#1#2{\ifdim\zeropoint<#1#2\else\zeropoint\fi} + \def\setlayoutdimensions - {\global\marginwidth \layoutparameter\c!margin - \global\edgewidth \layoutparameter\c!edge - \global\margindistance \layoutparameter\c!margindistance - \global\edgedistance \layoutparameter\c!edgedistance - \global\leftedgedistance \layoutdistance \leftedgewidth \c!leftedgedistance - \global\rightedgedistance \layoutdistance \rightedgewidth \c!rightedgedistance - \global\leftmargindistance \layoutdistance \leftmarginwidth \c!leftmargindistance - \global\rightmargindistance\layoutdistance \rightmarginwidth \c!rightmargindistance - \global\topdistance \layoutdistance \topheight \c!topdistance - \global\headerdistance \layoutdistance \headerheight \c!headerdistance - \global\footerdistance \layoutdistance \footerheight \c!footerdistance - \global\bottomdistance \layoutdistance \bottomheight \c!bottomdistance} + {\global\naturalmarginwidth \layoutparameter\c!margin + \global\naturaledgewidth \layoutparameter\c!edge + \global\naturalmargindistance \layoutparameter\c!margindistance + \global\naturaledgedistance \layoutparameter\c!edgedistance + \global\naturalleftedgedistance \layoutparameter\c!leftedgedistance + \global\naturalrightedgedistance \layoutparameter\c!rightedgedistance + \global\naturalleftmargindistance \layoutparameter\c!leftmargindistance + \global\naturalrightmargindistance\layoutparameter\c!rightmargindistance + \global\naturaltopdistance \layoutparameter\c!topdistance + \global\naturalheaderdistance \layoutparameter\c!headerdistance + \global\naturalfooterdistance \layoutparameter\c!footerdistance + \global\naturalbottomdistance \layoutparameter\c!bottomdistance + % + \global\marginwidth \naturalmarginwidth + \global\edgewidth \naturaledgewidth + \global\margindistance \naturalmargindistance + \global\edgedistance \naturaledgedistance + % + \global\leftedgedistance \layoutdistance\leftedgewidth \naturalleftedgedistance + \global\rightedgedistance \layoutdistance\rightedgewidth \naturalrightedgedistance + \global\leftmargindistance \layoutdistance\leftmarginwidth \naturalleftmargindistance + \global\rightmargindistance \layoutdistance\rightmarginwidth\naturalrightmargindistance + \global\topdistance \layoutdistance\topheight \naturaltopdistance + \global\headerdistance \layoutdistance\headerheight \naturalheaderdistance + \global\footerdistance \layoutdistance\footerheight \naturalfooterdistance + \global\bottomdistance \layoutdistance\bottomheight \naturalbottomdistance + } \def\setlayoutdistances % local in \setreducedvsize - {\headerdistance\layoutdistance\headerheight\c!headerdistance - \footerdistance\layoutdistance\footerheight\c!footerdistance} + {\headerdistance\layoutdistance\headerheight\naturalheaderdistance + \footerdistance\layoutdistance\footerheight\naturalfooterdistance} % these are wrong in the running text, assumes some swapping, needs a cleanup @@ -266,10 +287,10 @@ %D We keep track of these features with the following %D variables. -\chardef\papermirror =0 \chardef\printmirror =0 -\chardef\paperorientation=0 \chardef\printorientation=0 % beware: later no chardef -\chardef\paperreverse =0 \chardef\printreverse =0 -\chardef\paperlandscape =0 \chardef\printlandscape =0 +\newconditional\papermirror \newconditional\printmirror +\newconstant \paperorientation \newconstant \printorientation +\newconstant \paperreverse \newconstant \printreverse +\newconditional\paperlandscape \newconditional\printlandscape \let\papersize\empty \let\printpapersize\empty @@ -295,7 +316,8 @@ {\doifelsenothing{#2} {\expanded{\dodosetuppapersize [\executeifdefined{\??pp:1:#1}{#1}]% - [\executeifdefined{\??pp:2:#1}{}]}} +% [\executeifdefined{\??pp:2:#1}{\v!default}]}} + [\executeifdefined{\??pp:2:#1}{#1}]}} {\doifassignmentelse{#2} {\getparameters[\??pp\executeifdefined{\??pp:1:#1}{#1}][#2]} {\expanded{\dodosetuppapersize @@ -361,10 +383,10 @@ \global\setdimentoatleast\paperheight \onepoint \global\setdimentoatleast\printpaperwidth \onepoint \global\setdimentoatleast\printpaperheight\onepoint - \ifcase\paperlandscape\else + \ifconditional\paperlandscape \doglobal\swapdimens\paperwidth\paperheight \fi - \ifcase\printlandscape\else + \ifconditional\printlandscape \doglobal\swapdimens\printpaperwidth\printpaperheight \fi % this check can be confusing, so we've added the possibility @@ -372,37 +394,45 @@ \doif\@@ppoption\v!max % \v!fit is {\bgroup % we need to pre-swap else we get the wrong paper size - \ifcase\paperorientation\else - \doifinset\paperorientation{90,270}{\swapdimens\paperwidth\paperheight}% - \fi - \ifcase\printorientation\else - \doifinset\printorientation{90,270}{\swapdimens\printpaperwidth\printpaperheight}% - \fi + \ifnum\paperorientation=\rightrotatioangle + \swapdimens\paperwidth\paperheight + \else\ifnum\paperorientation=\leftrotatioangle + \swapdimens\paperwidth\paperheight + \fi\fi + \ifnum\printorientation=\rightrotatioangle + \swapdimens\printpaperwidth\printpaperheight + \else\ifnum\printorientation=\leftrotatioangle + \swapdimens\printpaperwidth\printpaperheight + \fi\fi \ifdim\paperheight>\printpaperheight \global\printpaperheight\paperheight - \writestatus\m!systems{print height forced to paper height}% + \writestatus\m!system{print height forced to paper height}% \fi \ifdim\paperwidth>\printpaperwidth \global\printpaperwidth\paperwidth - \writestatus\m!systems{print width forced to paper width}% + \writestatus\m!system{print width forced to paper width}% \fi \egroup}} \def\dosetuppaperorientation#1#2#3#4#5% - {\global\chardef#2\zerocount - \global\chardef#5\zerocount - \globallet#3\!!zerocount - \globallet#4\!!zerocount + {\global\setfalse#2% + \global\setfalse#5% + \global#3\uprotationangle + \global#4\uprotationangle \global\negateprintboxfalse \processallactionsinset [#1] - [ \v!landscape=>\global\chardef#2\plusone, - \v!mirrored=>\global\chardef#5\plusone, - \v!rotated=>\gdef#3{90}\gdef#4{270}, + [ \v!landscape=>\global\settrue#2, + \v!mirrored=>\global\settrue#5, + \v!rotated=>\global#3\rightrotatioangle + \global#4\leftrotatioangle, \v!negative=>\global\negateprintboxtrue, - 90=>\gdef#3{90}\gdef#4{270}, - 180=>\gdef#3{180}\gdef#4{0}, - 270=>\gdef#3{270}\gdef#4{90}]} + 90=>\global#3\rightrotatioangle + \global#4\leftrotatioangle, + 180=>\global#3\downrotatioangle + \global#4\zerocount, + 270=>\global#3\leftrotatioangle + \global#4\rightrotatioangle]} \ifx\calculatepaperoffsets\undefined @@ -419,7 +449,7 @@ % {\beforesplitstring#1\at em\to\asciia % \doifnot\asciia{#1} % {\aftersplitstring\asciia\at=\to\asciia -% \doifsomething\asciia{\showmessage\m!systems{10}{#1}}}} +% \doifsomething\asciia{\showmessage\m!system{10}{#1}}}} % % \def\checkforems[#1]% % {\processcommalist[#1]\docheckforems} @@ -642,16 +672,43 @@ \newif\ifdoublesidedprint -\def\presetcenterpagebox % in \setuplayout !!!!!!!!!!!!!!!! +\newconditional\page_location_is_set + +\def\page_location_reset + {\setfalse\page_location_is_set + \let\page_location_left_fill \relax + \let\page_location_right_fill \relax + \let\page_location_top_fill \relax + \let\page_location_bottom_fill\relax} + +\page_location_reset + +\setvalue{\??ly:\c!location:\v!right }{\settrue\page_location_is_set + \let\page_location_left_fill \hss} +\setvalue{\??ly:\c!location:\v!left }{\settrue\page_location_is_set + \let\page_location_right_fill \hss} +\setvalue{\??ly:\c!location:\v!bottom }{\settrue\page_location_is_set + \let\page_location_top_fill \vss} +\setvalue{\??ly:\c!location:\v!top }{\settrue\page_location_is_set + \let\page_location_bottom_fill\vss} +\setvalue{\??ly:\c!location:\v!middle }{\settrue\page_location_is_set + \let\page_location_left_fill \hss + \let\page_location_right_fill \hss + \let\page_location_top_fill \vss + \let\page_location_bottom_fill\vss} +\setvalue{\??ly:\c!location:\empty }{\setfalse\page_location_is_set % default also signal to scrn_ + \let\page_location_right_fill \hss + \let\page_location_bottom_fill\hss} +\setvalue{\??ly:\c!location:\v!doublesided}{\doublesidedprinttrue} +\setvalue{\??ly:\c!location:\v!singlesided}{\doublesidedprintfalse} + +\def\dopresetcenterpagebox#1% + {\ifcsname\??ly:\c!location:#1\endcsname\csname\??ly:\c!location:#1\endcsname\fi} + +\def\presetcenterpagebox {\doublesidedprintfalse - \normalexpanded{\noexpand\processallactionsinset[\@@lylocation]} - [ \v!middle=>{\setuppapersize[\c!left=\hss,\c!right=\hss,\c!top=\vss,\c!bottom=\vss]}, - \v!left=>{\setuppapersize[\c!left=,\c!right=\hss]}, - \v!right=>{\setuppapersize[\c!left=\hss,\c!right=]}, - \v!bottom=>{\setuppapersize[\c!top=\vss,\c!bottom=]}, - \v!top=>{\setuppapersize[\c!top=,\c!bottom=\vss]},% - \v!doublesided=>\doublesidedprinttrue, - \v!singlesided=>\doublesidedprintfalse]} + \page_location_reset + \processcommacommand[\@@lylocation]\dopresetcenterpagebox} \unexpanded\def\definelayout {\dodoubleargument\dodefinelayout} @@ -659,31 +716,41 @@ \def\dodefinelayout[#1][#2]% {\getparameters[\??ly#1][\c!state=\v!start,#2]} -% \def\dodosetuplayout[#1][#2]% -% {\ConvertToConstant\doifnot{#2}\v!reset % #2 ? -% {\getparameters[\??ly#1][#2]% -% \checkforems[#2]}} - \def\dodosetuplayout[#1][#2]% {\doifnot{#2}\v!reset{\getparameters[\??ly#1][#2]}} % global needed for non-doublesided standardmakeup +\unexpanded\def\setuplayout + {\dodoubleempty\dosetuplayout} + \def\dosetuplayout[#1][#2]% - {\globallet\currentlayout\empty % new, global + {\globallet\currentlayout\empty \ifsecondargument \dodosetuplayout[#1][#2]% \else\iffirstargument \doifassignmentelse{#1} {\dodosetuplayout[][#1]} - {\doifnot{#1}\v!reset{\xdef\currentlayout{#1}}}% new, global + {\doifelse{#1}\v!reset + {\let\@@lymethod\v!normal}% hardcodes, assumes a definition + {\xdef\currentlayout{#1}}}% \fi\fi \recalculatelayout - \checkcurrentlayout % here ? + %\checkcurrentlayout % here? + \dochecknextlayout % here? \presetcenterpagebox} -\unexpanded\def\setuplayout - {\dodoubleempty\dosetuplayout} +\def\installlayouthandler#1#2% + {\setgvalue{\??ly:\c!method:#1}{#2}} + +\installlayouthandler\v!default + {\checkcurrentlayout} + +\installlayouthandler\v!normal + {\checkcurrentlayout} + +\def\dochecknextlayout + {\executeifdefined{\??ly:\c!method:\@@lymethod}\checkcurrentlayout} \let\@@zaheight\!!zeropoint @@ -771,22 +838,33 @@ %D by the \type {top}, \type {bottom}, \type {left} and \type %D {right} parameters. -\def\centerpagebox#1% +\def\centerpagebox#1% we could test for a difference (saves packing) {\printpaperwidth \paperscale\printpaperwidth \printpaperheight\paperscale\printpaperheight - \setbox#1\vbox to \printpaperheight - {\@@pptop - \hbox to \printpaperwidth - {\ifdoublesidedprint - \doifbothsides - {\@@ppleft \box#1\@@ppright} - {\@@ppleft \box#1\@@ppright} - {\@@ppright\box#1\@@ppleft }% - \else - \@@ppleft \box#1\@@ppright - \fi}% - \par - \@@ppbottom}} + \ifdim\printpaperheight>\ht#1\relax + \donetrue + \else\ifdim\printpaperwidth>\wd#1\relax + \donetrue + \else + \donefalse + \fi\fi + \ifdone + \setbox#1\vbox to \printpaperheight + {\@@pptop + \page_location_top_fill + \hbox to \printpaperwidth + {\ifdoublesidedprint + \doifbothsides + {\@@ppleft \page_location_left_fill \box#1\page_location_right_fill\@@ppright}% + {\@@ppleft \page_location_left_fill \box#1\page_location_right_fill\@@ppright}% + {\@@ppright\page_location_right_fill\box#1\page_location_left_fill \@@ppleft }% + \else + \@@ppleft \page_location_left_fill \box#1\page_location_right_fill\@@ppright + \fi}% + \par + \page_location_bottom_fill + \@@ppbottom}% + \fi} \def\offsetprintbox#1% {\ifdim\topoffset=\zeropoint % \relax @@ -826,36 +904,42 @@ \fi} \def\orientpagebodybox#1#2#3% - {\ifnum#2#3>\zerocount - \setbox#1\vbox - {\edef\somerotation{\ifdoublesided\ifodd\realpageno#2\else#3\fi\else#2\fi}% - \dorotatebox\somerotation\hbox{\box#1}}% + {\ifnum\number#1\number#2>\zerocount + \setbox#3\vbox + {\edef\somerotation{\number\ifdoublesided\ifodd\realpageno#1\else#2\fi\else#1\fi}% + \dorotatebox\somerotation\hbox{\box#3}}% \fi} -\def\orientpaperbox#1% - {\orientpagebodybox{#1}\paperorientation\paperreverse} - -\def\orientprintbox#1% - {\orientpagebodybox{#1}\printorientation\printreverse} +\def\orientpaperbox{\orientpagebodybox\paperorientation\paperreverse} +\def\orientprintbox{\orientpagebodybox\printorientation\printreverse} \def\mirrorpagebodybox#1#2% - {\ifcase#2\or - \setbox#1\vbox{\domirrorbox\vbox{\box#1}}% + {\ifconditional#1\relax + \setbox#2\vbox{\domirrorbox\vbox{\box#2}}% \fi} -\def\mirrorpaperbox#1% - {\mirrorpagebodybox{#1}\papermirror} - -\def\mirrorprintbox#1% - {\mirrorpagebodybox{#1}\printmirror} +\def\mirrorpaperbox{\mirrorpagebodybox\papermirror} +\def\mirrorprintbox{\mirrorpagebodybox\printmirror} \def\scalepagebox#1% - {\ifdim\@@lyscale\points=\onepoint \else - \setbox#1\vbox{\scale[\c!sx=\@@lyscale,\c!sy=\@@lyscale]{\box#1}}% - \paperwidth \@@lyscale\paperwidth - \paperheight\@@lyscale\paperheight + {\ifdim\@@lyscale\points=\onepoint + \ifdim\@@lysx\points=\onepoint + \ifdim\@@lysy\points=\onepoint + \else + \doscalepagebox{#1}\@@lysx\@@lysy + \fi + \else + \doscalepagebox{#1}\@@lysx\@@lysy + \fi + \else + \doscalepagebox{#1}\@@lyscale\@@lyscale \fi} +\def\doscalepagebox#1#2#3% + {\setbox#1\vbox{\scale[\c!sx=#2,\c!sy=#3]{\box#1}}% + \paperwidth #2\paperwidth + \paperheight#3\paperheight} + \def\negateprintbox#1% {\ifnegateprintbox \negatecolorbox{#1}% @@ -910,8 +994,8 @@ \def\doaddpagecolormarks#1#2% {\makepagecutbox{#2}% - \ifnum\horizontalcutmarks>\plustwo \chardef\colormarkoffset\plusfour \fi - \ifnum\verticalcutmarks >\plustwo \chardef\colormarkoffset\plusfour \fi + \ifnum\horizontalcutmarks>\plustwo \def\colormarkoffset{\plusfour}\fi + \ifnum\verticalcutmarks >\plustwo \def\colormarkoffset{\plusfour}\fi #1{#2}} % NOG EENS NAGAAN WANNEER NU GLOBAL EN WANNEER NIET @@ -963,10 +1047,10 @@ \newdimen\innermakeupwidth % special purpose \newdimen\innermakeupmargin % special purpose -\chardef\innermakeupcompensation\plusone +\newconditional\innermakeupcompensation \settrue\innermakeupcompensation \def\compensatedinnermakeupmargin - {\dimexpr\ifnum\innermakeupcompensation=\plusone+\innermakeupmargin\else\zeropoint\fi\relax} + {\dimexpr\ifconditional\innermakeupcompensation+\innermakeupmargin\else\zeropoint\fi\relax} \def\freezetextwidth % \makeupwidth may be set to \textwidth {\textwidth\makeupwidth % which is a tricky but valid value @@ -1146,11 +1230,11 @@ %D \showsetup{showsetups} %D %showsetup{showmargins} -\fetchruntimecommand \showprint {page-run.mkii} -\fetchruntimecommand \showframe {page-run.mkii} -\fetchruntimecommand \showlayout {page-run.mkii} -\fetchruntimecommand \showsetups {page-run.mkii} -\fetchruntimecommand \showmargins {page-run.mkii} +\fetchruntimecommand \showprint {page-run} +\fetchruntimecommand \showframe {page-run} +\fetchruntimecommand \showlayout {page-run} +\fetchruntimecommand \showsetups {page-run} +\fetchruntimecommand \showmargins {page-run} %D The default dimensions are quite old and will not change. %D The funny fractions were introduced when we went from fixed @@ -1166,6 +1250,25 @@ %D since they could change while going to a new page, %D depending on the current font setting. +\setuppaper % (size) % only used in XY imposition + [\c!width=\zeropoint, + \c!height=\zeropoint, + \c!topspace=\zeropoint, + \c!backspace=\zeropoint, + \c!dx=\zeropoint, + \c!dy=\zeropoint, + \c!nx=1, + \c!ny=1, + \c!method=\v!normal] + +\setuppapersize + [\c!option=\v!max, + \c!top=, + \c!bottom=, + \c!left=, + \c!right=, + \c!location=] + \setuplayout [ \c!topspace=.08417508418\paperheight, % 2.5cm \c!top=\zeropoint, @@ -1201,8 +1304,10 @@ \c!style=, \c!color=, \c!marking=\v!off, - \c!location=, % \v!singlesided, but empty is signal + \c!location=,% \v!singlesided, but unset is signal (no other default, spoils arrange) \c!scale=1, + \c!sx=1, + \c!sy=1, \c!nx=1, \c!ny=1, \c!dx=\zeropoint, @@ -1220,27 +1325,6 @@ %D First we define a whole range of (DIN) papersizes, %D of which the A-series makes most sense. We enable checking. -%D We also set some of the parameters that will be used when -%D positioning the typeset paper onto the print paper. - -\setuppaper % (size) % only used in XY imposition - [\c!width=\zeropoint, - \c!height=\zeropoint, - \c!topspace=\zeropoint, - \c!backspace=\zeropoint, - \c!dx=\zeropoint, - \c!dy=\zeropoint, - \c!nx=1, - \c!ny=1, - \c!method=\v!normal] - -\setuppapersize - [\c!option=\v!max, - \c!top=, - \c!bottom=\vss, - \c!left=, - \c!right=\hss] - \definepapersize [A0] [\c!width=841mm,\c!height=1189mm] \definepapersize [A1] [\c!width=594mm,\c!height=841mm] \definepapersize [A2] [\c!width=420mm,\c!height=594mm] @@ -1368,10 +1452,15 @@ %D paper size with the typeset paper size. This setting should %D come after the first layout specification (already done). -\setuppapersize - [A4][A4] +% \definepapersize +% [\v!default] +% [ \c!width=\paperwidth, +% \c!height=\paperheight] -%D A few goodies: +% \definepapersize +% [samesized] +% [ \c!width=\paperwidth, +% \c!height=\paperheight] \definepapersize [oversized] @@ -1388,6 +1477,14 @@ [ \c!width=\dimexpr \paperheight+1.5cm\relax, \c!height=\dimexpr2\paperwidth +1.5cm\relax] +% \setuppapersize +% [A4][A4] + +\setuppapersize + [A4][samesized] + +%D A few goodies: + %D For orthogonality: \definepapersize diff --git a/Master/texmf-dist/tex/context/base/page-lin.lua b/Master/texmf-dist/tex/context/base/page-lin.lua index 1f2c9625116..676a4c7f656 100644 --- a/Master/texmf-dist/tex/context/base/page-lin.lua +++ b/Master/texmf-dist/tex/context/base/page-lin.lua @@ -6,34 +6,48 @@ if not modules then modules = { } end modules ['page-lin'] = { license = "see context related readme files" } --- experimental +-- experimental -> will become builders local trace_numbers = false trackers.register("lines.numbers", function(v) trace_numbers = v end) -local format = string.format -local texsprint, texwrite, texbox = tex.sprint, tex.write, tex.box +local report_lines = logs.reporter("lines") -local ctxcatcodes = tex.ctxcatcodes -local variables = interfaces.variables +local texbox = tex.box -nodes = nodes or { } -nodes.lines = nodes.lines or { } -nodes.lines.data = nodes.lines.data or { } -- start step tag +local attributes, nodes, node, context = attributes, nodes, node, context -storage.register("lines/data", nodes.lines.data, "nodes.lines.data") +nodes.lines = nodes.lines or { } +local lines = nodes.lines + +lines.data = lines.data or { } -- start step tag +local data = lines.data +local last = #data + +lines.scratchbox = lines.scratchbox or 0 + +local leftmarginwidth = nodes.leftmarginwidth + +storage.register("lines/data", lines.data, "nodes.lines.data") -- if there is demand for it, we can support multiple numbering streams -- and use more than one attibute -local hlist, vlist, whatsit = node.id('hlist'), node.id('vlist'), node.id('whatsit') +local variables = interfaces.variables -local display_math = attributes.private('display-math') -local line_number = attributes.private('line-number') -local line_reference = attributes.private('line-reference') +local nodecodes = nodes.nodecodes -local current_list = { } -local cross_references = { } -local chunksize = 250 -- not used in boxed +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist +local whatsit_code = nodecodes.whatsit + +local a_displaymath = attributes.private('displaymath') +local a_linenumber = attributes.private('linenumber') +local a_linereference = attributes.private('linereference') +local a_verbatimline = attributes.private('verbatimline') + +local current_list = { } +local cross_references = { } +local chunksize = 250 -- not used in boxed local has_attribute = node.has_attribute local traverse_id = node.traverse_id @@ -43,16 +57,9 @@ local hpack_node = node.hpack local insert_node_after = node.insert_after local insert_node_before = node.insert_before -local whatsit = node.id("whatsit") - -local data = nodes.lines.data -local last = #data - -nodes.lines.scratchbox = nodes.lines.scratchbox or 0 - -- cross referencing -function nodes.lines.number(n) +function lines.number(n) n = tonumber(n) local cr = cross_references[n] or 0 cross_references[n] = nil @@ -62,20 +69,20 @@ end local function resolve(n,m) -- we can now check the 'line' flag (todo) while n do local id = n.id - if id == whatsit then -- why whatsit - local a = has_attribute(n,line_reference) + if id == whatsit_code then -- why whatsit + local a = has_attribute(n,a_linereference) if a then cross_references[a] = m end - elseif id == hlist or id == vlist then + elseif id == hlist_code or id == vlist_code then resolve(n.list,m) end n = n.next end end -function nodes.lines.finalize(t) - local getnumber = nodes.lines.number +function lines.finalize(t) + local getnumber = lines.number for _,p in next, t do for _,r in next, p do if r.metadata.kind == "line" then @@ -89,16 +96,16 @@ function nodes.lines.finalize(t) end end -local filters = jobreferences.filters -local helpers = structure.helpers +local filters = structures.references.filters +local helpers = structures.helpers -jobreferences.registerfinalizer(nodes.lines.finalize) +structures.references.registerfinalizer(lines.finalize) filters.line = filters.line or { } function filters.line.default(data) -- helpers.title(data.entries.linenumber or "?",data.metadata) - texsprint(ctxcatcodes,format("\\convertnumber{%s}{%s}",data.entries.conversion or "numbers",data.entries.linenumber or "0")) + context.convertnumber(data.entries.conversion or "numbers",data.entries.linenumber or "0") end function filters.line.page(data,prefixspec,pagespec) -- redundant @@ -106,90 +113,139 @@ function filters.line.page(data,prefixspec,pagespec) -- redundant end function filters.line.linenumber(data) -- raw - texwrite(data.entries.linenumber or "0") + context(data.entries.linenumber or "0") end -- boxed variant, todo: use number mechanism -nodes.lines.boxed = { } +lines.boxed = { } +local boxed = lines.boxed -- todo: cache setups, and free id no longer used -- use interfaces.cachesetup(t) -function nodes.lines.boxed.register(configuration) +function boxed.register(configuration) last = last + 1 data[last] = configuration if trace_numbers then - logs.report("lines","registering setup %s",last) + report_lines("registering setup %s",last) end return last end -function nodes.lines.boxed.setup(n,configuration) +function boxed.setup(n,configuration) local d = data[n] if d then if trace_numbers then - logs.report("lines","updating setup %s",n) + report_lines("updating setup %s",n) end for k,v in next, configuration do d[k] = v end else if trace_numbers then - logs.report("lines","registering setup %s (br)",n) + report_lines("registering setup %s (br)",n) end data[n] = configuration end return n end -local the_left_margin = nodes.the_left_margin - -local function check_number(n,a,skip) -- move inline +local function check_number(n,a,skip,sameline) local d = data[a] if d then - local s = d.start or 1 + local tag, skipflag, s = d.tag or "", 0, d.start or 1 current_list[#current_list+1] = { n, s } - if not skip and s % d.step == 0 then - local tag = d.tag or "" - texsprint(ctxcatcodes, format("\\makenumber{%s}{%s}{%s}{%s}{%s}{%s}\\endgraf",tag,s,n.shift,n.width,the_left_margin(n.list),n.dir)) + if sameline then + skipflag = 0 + if trace_numbers then + report_lines("skipping broken line number %s for setup %s: %s (%s)",#current_list,a,s,d.continue or "no") + end + elseif not skip and s % d.step == 0 then + skipflag, d.start = 1, s + 1 -- (d.step or 1) if trace_numbers then - logs.report("numbers","making number %s for setup %s: %s (%s)",#current_list,a,s,d.continue or "no") + report_lines("making number %s for setup %s: %s (%s)",#current_list,a,s,d.continue or "no") end else - texsprint(ctxcatcodes, "\\skipnumber\\endgraf") + skipflag, d.start = 0, s + 1 -- (d.step or 1) + if trace_numbers then + report_lines("skipping line number %s for setup %s: %s (%s)",#current_list,a,s,d.continue or "no") + end + end + context.makelinenumber(tag,skipflag,s,n.shift,n.width,leftmarginwidth(n.list),n.dir) + end +end + +-- xlist +-- xlist +-- hlist + +local function identify(list) + if list then + for n in traverse_id(hlist_code,list) do + if has_attribute(n,a_linenumber) then + return list + end + end + local n = list + while n do + local id = n.id + if id == hlist_code or id == vlist_code then + local ok = identify(n.list) + if ok then + return ok + end + end + n = n.next end - d.start = s + 1 -- (d.step or 1) end end -function nodes.lines.boxed.stage_one(n) +function boxed.stage_zero(n) + return identify(texbox[n].list) +end + +function boxed.stage_one(n,nested) current_list = { } local head = texbox[n] if head then local list = head.list - local last_a, skip = nil, false - for n in traverse_id(hlist,list) do -- attr test here and quit as soon as zero found + if nested then + list = identify(list) + end + local last_a, last_v, skip = nil, -1, false + for n in traverse_id(hlist_code,list) do -- attr test here and quit as soon as zero found if n.height == 0 and n.depth == 0 then - -- skip funny hlists + -- skip funny hlists -- todo: check line subtype else - local a = has_attribute(n.list,line_number) + local list = n.list + local a = has_attribute(list,a_linenumber) if a and a > 0 then if last_a ~= a then - if data[a].method == variables.next then + local da = data[a] + local ma = da.method + if ma == variables.next then skip = true + elseif ma == variables.page then + da.start = 1 -- eventually we will have a normal counter end last_a = a + if trace_numbers then + report_lines("starting line number range %s: start %s, continue",a,da.start,da.continue or "no") + end end - if has_attribute(n,display_math) then + if has_attribute(n,a_displaymath) then if nodes.is_display_math(n) then check_number(n,a,skip) end else - -- the following test fails somehow (change in luatex?) - -- if node.first_character(n.list) then + local v = has_attribute(list,a_verbatimline) + if not v or v ~= last_v then + last_v = v check_number(n,a,skip) - -- end + else + check_number(n,a,skip,true) + end end skip = false end @@ -198,18 +254,24 @@ function nodes.lines.boxed.stage_one(n) end end -function nodes.lines.boxed.stage_two(n,m) +function boxed.stage_two(n,m) if #current_list > 0 then - m = m or nodes.lines.scratchbox - local t, i = { }, 0 - for l in traverse_id(hlist,texbox[m].list) do - t[#t+1] = copy_node(l) + m = m or lines.scratchbox + local t, tn = { }, 0 + for l in traverse_id(hlist_code,texbox[m].list) do + tn = tn + 1 + t[tn] = copy_node(l) end for i=1,#current_list do local li = current_list[i] local n, m, ti = li[1], li[2], t[i] - ti.next, n.list = n.list, ti - resolve(n,m) + if ti then + ti.next, n.list = n.list, ti + resolve(n,m) + else + report_lines("error in linenumbering (1)") + return + end end end end diff --git a/Master/texmf-dist/tex/context/base/page-lin.mkiv b/Master/texmf-dist/tex/context/base/page-lin.mkiv index 51f02763985..4f2226f6e33 100644 --- a/Master/texmf-dist/tex/context/base/page-lin.mkiv +++ b/Master/texmf-dist/tex/context/base/page-lin.mkiv @@ -12,47 +12,75 @@ %C details. % generic or not ... maybe not bother too much and simplify to mkiv only +% get rid of \mk* \writestatus{loading}{ConTeXt Core Macros / Line Numbering} \unprotect % todo: save settings - +% % low level interface +% +% we should use normal counters but then we need to sync settings + +% not yet ok, we need to give the top line a proper height +% +% \newbox\locallinenumberbox +% +% \unexpanded\def\startlocallinenumbering +% {\setbox\locallinenumberbox\vbox\bgroup +% \startlinenumbering} +% +% \unexpanded\def\stoplocallinenumbering +% {\stoplinenumbering +% \egroup +% \mkdoprocessdeepboxcontents\locallinenumberbox +% \unvbox\locallinenumberbox} + +% some line +% +% \startlocallinenumbering +% some source code 1\par +% some source code 2\par +% some source code 3\par +% \stoplocallinenumbering +% +% some line \registerctxluafile{page-lin}{1.001} -\definesystemattribute[line-number] \chardef\linenumberattribute \dogetattributeid{line-number} -\definesystemattribute[line-reference] \chardef\linereferenceattribute \dogetattributeid{line-reference} +\definesystemattribute[linenumber] [public] +\definesystemattribute[linereference][public] \appendtoksonce \attribute\linenumberattribute \attributeunsetvalue \to \everyforgetall \appendtoksonce \attribute\displaymathattribute\plusone \to \everybeforedisplayformula -\newcount\linenumber -\newbox \linenumberscratchbox -\newcount\linenumberchunk -\newcount\linerefcounter +\newcount \linenumber % not used +\newbox \linenumberscratchbox +\newcount \linenumberchunk +\newcount \linerefcounter +\newconstant\linenumbernesting \newconditional\tracelinenumbering -\def\mkprocesstextlinenumbers#1% - {\setbox\linenumberscratchbox\vbox{\forgetall\offinterlineskip\ctxlua{nodes.lines.boxed.stage_one(\number#1)}}% +\def\mkprocesstextlinenumbers#1#2% + {\setbox\linenumberscratchbox\vbox + {\forgetall + \offinterlineskip + \ctxlua{nodes.lines.boxed.stage_one(\number#1,\ifcase\linenumbernesting false\else true\fi)}}% \ctxlua{nodes.lines.boxed.stage_two(\number#1,\number\linenumberscratchbox)}}% can move to lua code % id nr shift width leftskip dir -% \def\mkskiplinenumber #1#2#3#4#6#5{} -% \def\mkleftlinenumber #1#2#3#4#5#6{\hbox{\llap{#2\quad\hskip#3\scaledpoint}}} -% \def\mkrightlinenumber#1#2#3#4#5#6{\hbox{\rlap{\hskip#4\scaledpoint\hskip#3\scaledpoint\quad#2}}} - -\let\makenumber\gobblesixarguments +\let\makelinenumber\gobblesevenarguments \newconditional\boxcontentneedsprocessing -\def\mkdoprocesspagecontents #1{\mkaddtextlinenumbers{#1}\plusone \plusone} -\def\mkdoprocessboxcontents #1{\mkaddtextlinenumbers{#1}\plusone \plusone} -\def\mkdoprocesscolumncontents#1{\mkaddtextlinenumbers{#1}\currentcolumn\nofcolumns} +\def\mkdoprocesspagecontents #1{\mkaddtextlinenumbers{#1}\plusone \plusone \zerocount} +\def\mkdoprocessboxcontents #1{\mkaddtextlinenumbers{#1}\plusone \plusone \zerocount} +\def\mkdoprocessdeepboxcontents#1{\mkaddtextlinenumbers{#1}\plusone \plusone \plusone } +\def\mkdoprocesscolumncontents #1{\mkaddtextlinenumbers{#1}\currentcolumn\nofcolumns\zerocount} \def\mklinenumberparameters {continue = "\linenumberparameter\c!continue", @@ -117,9 +145,9 @@ \let\currentlinenumbering\empty -\chardef\linenumbermode = 1 % 0=continue, 1=restart -\chardef\linenumberlocation = 1 % 0=middle, 1=left, 2=right, 3=inner, 4=outer, 5=text, 6=begin, 7=end -\chardef\linenumberalignment = 5 % 0=middle, 1=left, 2=right, 5=auto +\setnewconstant\linenumbermode \plusone % 0=continue, 1=restart +\setnewconstant\linenumberlocation \plusone % 0=middle, 1=left, 2=right, 3=inner, 4=outer, 5=text, 6=begin, 7=end +\setnewconstant\linenumberalignment\plusfive % 0=middle, 1=left, 2=right, 5=auto \newevery \beforeeverylinenumbering \relax \newevery \aftereverylinenumbering \relax @@ -180,29 +208,29 @@ % todo: text -\expandafter\chardef\csname\??rn:l:\v!middle \endcsname \zerocount -\expandafter\chardef\csname\??rn:l:\v!left \endcsname \plusone -\expandafter\chardef\csname\??rn:l:\v!margin \endcsname \plusone -\expandafter\chardef\csname\??rn:l:\v!inmargin\endcsname \plusone -\expandafter\chardef\csname\??rn:l:\v!inleft \endcsname \plusone -\expandafter\chardef\csname\??rn:l:\v!right \endcsname \plustwo -\expandafter\chardef\csname\??rn:l:\v!inright \endcsname \plustwo -\expandafter\chardef\csname\??rn:l:\v!inner \endcsname \plusthree -\expandafter\chardef\csname\??rn:l:\v!outer \endcsname \plusfour -\expandafter\chardef\csname\??rn:l:\v!text \endcsname \plusfive -\expandafter\chardef\csname\??rn:l:\v!begin \endcsname \plussix -\expandafter\chardef\csname\??rn:l:\v!end \endcsname \plusseven - -\expandafter\chardef\csname\??rn:a:\v!middle \endcsname \zerocount -\expandafter\chardef\csname\??rn:a:\v!right \endcsname \plusone -\expandafter\chardef\csname\??rn:a:\v!flushleft \endcsname \plusone -\expandafter\chardef\csname\??rn:a:\v!left \endcsname \plustwo -\expandafter\chardef\csname\??rn:a:\v!flushright\endcsname \plustwo -\expandafter\chardef\csname\??rn:a:\v!auto \endcsname \plusfive +\expandafter\let\csname\??rn:l:\v!middle \endcsname \zerocount +\expandafter\let\csname\??rn:l:\v!left \endcsname \plusone +\expandafter\let\csname\??rn:l:\v!margin \endcsname \plusone +\expandafter\let\csname\??rn:l:\v!inmargin \endcsname \plusone +\expandafter\let\csname\??rn:l:\v!inleft \endcsname \plusone +\expandafter\let\csname\??rn:l:\v!right \endcsname \plustwo +\expandafter\let\csname\??rn:l:\v!inright \endcsname \plustwo +\expandafter\let\csname\??rn:l:\v!inner \endcsname \plusthree +\expandafter\let\csname\??rn:l:\v!outer \endcsname \plusfour +\expandafter\let\csname\??rn:l:\v!text \endcsname \plusfive +\expandafter\let\csname\??rn:l:\v!begin \endcsname \plussix +\expandafter\let\csname\??rn:l:\v!end \endcsname \plusseven + +\expandafter\let\csname\??rn:a:\v!middle \endcsname \zerocount +\expandafter\let\csname\??rn:a:\v!right \endcsname \plusone +\expandafter\let\csname\??rn:a:\v!flushleft \endcsname \plusone +\expandafter\let\csname\??rn:a:\v!left \endcsname \plustwo +\expandafter\let\csname\??rn:a:\v!flushright\endcsname \plustwo +\expandafter\let\csname\??rn:a:\v!auto \endcsname \plusfive \def\dostartlinenumbering[#1][#2]% todo: c!continue {\begingroup - \chardef\linenumbermode\plusone + \linenumbermode\plusone \ifsecondargument \def\currentlinenumbering{#1}% \doifassignmentelse{#2} @@ -211,7 +239,7 @@ {\setvalue{\??rn#1\c!start}{#2}}% {\doif{#2}\v!continue {\getparameters[\??rn\currentlinenumbering][\c!continue=\v!yes]% - \chardef\linenumbermode\zerocount}}}% + \linenumbermode\zerocount}}}% \else\iffirstargument \doifnumberelse{#1}% downward compatible {\let\currentlinenumbering\empty @@ -219,11 +247,11 @@ {\doifelse{#1}\v!continue {\let\currentlinenumbering\empty \getparameters[\??rn\currentlinenumbering][\c!continue=\v!yes]% - \chardef\linenumbermode\zerocount} + \linenumbermode\zerocount} {\def\currentlinenumbering{#1}}}% \fi\fi \doif{\linenumberparameter\c!continue}\v!yes - {\chardef\linenumbermode\zerocount}% + {\linenumbermode\zerocount}% \numberinglinestrue \the\beforeeverylinenumbering \mkstarttextlinenumbering\currentlinenumbering\linenumbermode} @@ -235,8 +263,6 @@ % number placement -\let\mkskiplinenumber \gobblesixarguments - \def\mkdoinnerlinenumber{\doifoddpageelse\mkdoleftlinenumber\mkdorightlinenumber} \def\mkdoouterlinenumber{\doifoddpageelse\mkdorightlinenumber\mkdoleftlinenumber} @@ -278,79 +304,89 @@ \expandafter\mkdobeginlinenumber \fi} -\def\mkaddtextlinenumbers#1#2#3% box col max +\newconditional\faketextlinenumber +\newconstant \linenumberbox +\newconstant \linenumbercolumn +\newconstant \linenumberlastcolumn + +\def\mkaddtextlinenumbers#1#2#3#4% box col max nesting {\bgroup - \chardef\linenumberbox #1\relax - \chardef\linenumbercolumn #2\relax - \chardef\linenumberlastcolumn#3\relax + \linenumberbox #1\relax + \linenumbercolumn #2\relax + \linenumberlastcolumn#3\relax + \linenumbernesting #4\relax \fullrestoreglobalbodyfont - \def\skipnumber{\hbox{}}% - \let\makenumber\maketextlinenumber - \mkprocesstextlinenumbers\linenumberbox + \let\makelinenumber\maketextlinenumber + \mkprocesstextlinenumbers\linenumberbox\linenumbernesting \egroup} -\def\maketextlinenumber#1% +\def\maketextlinenumber#1#2% {\edef\currentlinenumbering{#1}% - \chardef\linenumberlocation \executeifdefined{\??rn:l:\linenumberparameter\c!location}\plusone % left - \chardef\linenumberalignment\executeifdefined{\??rn:a:\linenumberparameter\c!align }\plusfive % auto + \ifcase#2\relax + \settrue \faketextlinenumber + \else + \setfalse\faketextlinenumber + \fi + \linenumberlocation \executeifdefined{\??rn:l:\linenumberparameter\c!location}\plusone % left + \linenumberalignment\executeifdefined{\??rn:a:\linenumberparameter\c!align }\plusfive % auto \ifcase\linenumberlastcolumn\relax - \let\domakenumber\mkskiplinenumber + \settrue \faketextlinenumber \or % one column \ifcase\linenumberlocation - \let\domakenumber\mkskiplinenumber + \settrue \faketextlinenumber % hm \or - \let\domakenumber\mkleftlinenumber + \let\domakelinenumber\mkleftlinenumber \or - \let\domakenumber\mkrightlinenumber + \let\domakelinenumber\mkrightlinenumber \or % inner - \let\domakenumber\mkdoinnerlinenumber + \let\domakelinenumber\mkdoinnerlinenumber \or % outer - \let\domakenumber\mkdoouterlinenumber + \let\domakelinenumber\mkdoouterlinenumber \or % text - \let\domakenumber\mkdotextlinenumber + \let\domakelinenumber\mkdotextlinenumber \or - \let\domakenumber\mkdobeginlinenumber + \let\domakelinenumber\mkdobeginlinenumber \or - \let\domakenumber\mkdoendlinenumber + \let\domakelinenumber\mkdoendlinenumber \fi \else\ifcase\linenumbercolumn\relax - \let\domakenumber\mkskiplinenumber + \settrue \faketextlinenumber \or - \let\domakenumber\mkleftlinenumber + \let\domakelinenumber\mkleftlinenumber \ifcase\linenumberlocation\or - \chardef\linenumberlocation\plusone + \linenumberlocation\plusone \or - \chardef\linenumberlocation\plustwo + \linenumberlocation\plustwo \else - \chardef\linenumberlocation\plusone + \linenumberlocation\plusone \or - \chardef\linenumberlocation\plusone + \linenumberlocation\plusone \or - \chardef\linenumberlocation\plusone + \linenumberlocation\plusone \or - \chardef\linenumberlocation\plusone % todo + \linenumberlocation\plusone % todo \or - \chardef\linenumberlocation\plusone % todo + \linenumberlocation\plusone % todo \fi \else - \let\domakenumber\mkrightlinenumber + \let\domakelinenumber\mkrightlinenumber \ifcase\linenumberlocation\or - \chardef\linenumberlocation\plustwo + \linenumberlocation\plustwo \or - \chardef\linenumberlocation\plusone + \linenumberlocation\plusone \or - \chardef\linenumberlocation\plustwo + \linenumberlocation\plustwo \or - \chardef\linenumberlocation\plustwo + \linenumberlocation\plustwo \or - \chardef\linenumberlocation\plustwo % todo + \linenumberlocation\plustwo % todo \or - \chardef\linenumberlocation\plustwo % todo + \linenumberlocation\plustwo % todo \fi \fi\fi - \domakenumber{#1}} + \domakelinenumber{#1}} \def\mkdotextlinenumber #1#2#3#4#5#6% beware, one needs so compensate for this in the width ! {\hbox{\dosomelinenumber{#1}{2}{#2}{#5}\hskip#3\scaledpoint}} @@ -370,19 +406,19 @@ \def\mkdobeginlinenumber #1#2#3#4#5#6% {\ifcase\istltdir#6\relax - \chardef\linenumberlocation\plusone + \linenumberlocation\plusone \expandafter\mkdoleftlinenumber \else - \chardef\linenumberlocation\plustwo + \linenumberlocation\plustwo \expandafter\mkdorightlinenumber \fi{#1}{#2}{#3}{#4}{#5}{#6}} \def\mkdoendlinenumber#1#2#3#4#5#6% {\ifcase\istltdir#6\relax - \chardef\linenumberlocation\plustwo + \linenumberlocation\plustwo \expandafter\mkdorightlinenumber \else - \chardef\linenumberlocation\plusone + \linenumberlocation\plusone \expandafter\mkdoleftlinenumber \fi{#1}{#2}{#3}{#4}{#5}{#6}} @@ -397,16 +433,16 @@ \ifcase#2\relax\or\hskip\linenumberdistance\fi\relax \ifnum\linenumberlocation=\plusfive \scratchdimen\dimexpr#4\scaledpoint-\linenumberdistance\relax - \chardef\linenumberlocation\plusone + \linenumberlocation\plusone \else \scratchdimen\zeropoint \fi \ifcase\linenumberalignment - \chardef\linenumberlocation\zerocount % middle + \linenumberlocation\zerocount % middle \or - \chardef\linenumberlocation\plusone % left + \linenumberlocation\plusone % left \or - \chardef\linenumberlocation\plustwo % right + \linenumberlocation\plustwo % right \fi \ifconditional\tracelinenumbering\ruledhbox\else\hbox\fi to \linenumberwidth {\ifcase\linenumberlocation @@ -420,11 +456,15 @@ \or \doifoddpageelse\hss\relax % outer \fi - \linenumberattributes\c!style\c!color - {\linenumberparameter\c!command - {\linenumberparameter\c!left - \convertnumber{\linenumberparameter\c!conversion}{#3}% - \linenumberparameter\c!right}}% + \ifconditional\faketextlinenumber + % we need to reserve space + \else + \linenumberattributes\c!style\c!color + {\linenumberparameter\c!command + {\linenumberparameter\c!left + \convertnumber{\linenumberparameter\c!conversion}{#3}% + \linenumberparameter\c!right}}% + \fi \ifcase\linenumberlocation \hss % middle \or @@ -447,7 +487,7 @@ % referencing -\def\someline [#1]{\mkstartlinereference{#1}\mkstoplinereference{#1}} +\unexpanded\def\someline [#1]{\mkstartlinereference{#1}\mkstoplinereference{#1}} % was just a def \unexpanded\def\startline[#1]{\mkstartlinereference{#1}} \unexpanded\def\stopline [#1]{\mkstoplinereference {#1}} @@ -457,6 +497,7 @@ {\vrule\!!width\onepoint\!!depth\strutdp\!!height.8\strutht\raise.85\strutht\hbox{\llap{\tt\txx#1}}}}% \smashbox\scratchbox\box\scratchbox \fi} + \def\mkshowstoplinereference#1% {\ifconditional\tracelinenumbering \setbox\scratchbox\hbox{\rlap @@ -469,7 +510,7 @@ % eventually we will do this in lua -\def\currentreferencelinenumber{\ctxlua{jobreferences.filter("linenumber")}} +\def\currentreferencelinenumber{\ctxlua{structures.references.filter("linenumber")}} \def\doifelsesamelinereference#1#2#3% {\doifreferencefoundelse{lr:b:#1} @@ -478,8 +519,8 @@ {\edef\tline{\currentreferencelinenumber}% %[\fline,\tline] \ifx\fline\tline#2\else#3\fi} - {\unknownreference{#1}#2}} - {\unknownreference{#1}#2}} + {#2}} + {#2}} \def\inline#1[#2]% {\doifelsenothing{#1} diff --git a/Master/texmf-dist/tex/context/base/page-mak.mkii b/Master/texmf-dist/tex/context/base/page-mak.mkii index 040feb1d214..2087a68400b 100644 --- a/Master/texmf-dist/tex/context/base/page-mak.mkii +++ b/Master/texmf-dist/tex/context/base/page-mak.mkii @@ -42,8 +42,6 @@ [\??do#1]% [\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, @@ -214,8 +212,6 @@ [\v!standard] [\c!width=\innermakeupwidth, \c!height=\textheight, - \c!voffset=\!!zeropoint, - \c!hoffset=\!!zeropoint, \c!page=\v!right, \c!doublesided=\v!empty] diff --git a/Master/texmf-dist/tex/context/base/page-mak.mkiv b/Master/texmf-dist/tex/context/base/page-mak.mkiv index fd89a45ff77..ea285bcb8bc 100644 --- a/Master/texmf-dist/tex/context/base/page-mak.mkiv +++ b/Master/texmf-dist/tex/context/base/page-mak.mkiv @@ -42,8 +42,6 @@ [\??do#1]% [\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, @@ -80,8 +78,6 @@ \newtoks\everymakeup -\appendtoks \postponemarks \to \everymakeup - \let\currentmakeup\empty \unexpanded\def\startmakeup @@ -111,7 +107,6 @@ \def\donostopmakeup {\egroup - \flushmarks % new, here, else empty pages \page \egroup} @@ -121,7 +116,7 @@ \def\dodostartmakeup {\doifvaluesomething{\??do\currentmakeup\c!page} - {\ExpandFirstAfter\page[\makeupparameter\c!page]}% + {\page[\makeupparameter\c!page]}% \pagetype[\currentmakeup]% \setsystemmode\v!makeup \setupmakeuplayout @@ -141,7 +136,6 @@ \makeupparameter\c!bottom \doifsomething{\makeupparameter\c!color}{\stopcolor}% \egroup - \flushmarks % new, here, else empty pages \doflushmakeup \egroup \calculatehsizes @@ -185,11 +179,11 @@ \ifdoublesided \ifodd\realpageno\else \processaction [\makeupparameter\c!doublesided] - [ \v!yes=>\null + [ \v!yes=>\emptyhbox \page, \v!empty=>{\setupmakeuplayout \page[\v!blank]% - \null + \emptyhbox \page}]% \fi \fi \poppagestate} % new @@ -213,8 +207,6 @@ [\v!standard] [\c!width=\innermakeupwidth, \c!height=\textheight, - \c!voffset=\!!zeropoint, - \c!hoffset=\!!zeropoint, \c!page=\v!right, \c!doublesided=\v!empty] diff --git a/Master/texmf-dist/tex/context/base/page-mar.mkiv b/Master/texmf-dist/tex/context/base/page-mar.mkiv index 464b4f9bb09..433364a0638 100644 --- a/Master/texmf-dist/tex/context/base/page-mar.mkiv +++ b/Master/texmf-dist/tex/context/base/page-mar.mkiv @@ -11,12 +11,16 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +\endinput % obsolete, also commented code in anch-pgr.mkiv + %D Support for margin words is one of the reasons for writing %D \CONTEXT. Over time support for marginal content has been %D extended en enhanced. Therefore it's always good to watch %D out for unexpected side effects. -\writestatus{loading}{ConTeXt Page Macros / Maginal Things} +%D TODO: use parents etc + +\writestatus{loading}{ConTeXt Page Macros / Marginal Things} \unprotect @@ -60,12 +64,16 @@ #2]% \setuvalue{#1}{\dohandlemarginline{#1}}} -\def\marginlineparameter #1{\csname\??im\??im\currentmarginline#1\endcsname} -\def\marginlineexecuter #1#2{\executeifdefined{\??im\??im\currentmarginline#1}{#2}} +\def\marginlineparameter#1{\csname\??im\??im\currentmarginline#1\endcsname} + +\def\marginlineexecuter#1#2% + {\dostarttagged\t!margintext\currentmarginline + \executeifdefined{\??im\??im\currentmarginline#1}{#2}% + \dostoptagged} -\def\dohandlemarginline#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} + \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 @@ -182,17 +190,20 @@ %D The next bunch of macros looks messy which is due to its %D multi-purpose character. -\chardef\margincontentdisplacement \zerocount -\let \margincontentdistance \!!zeropoint -\let \margincontenthoffset \!!zeropoint -\def \margincontentlines {1} -\def \margincontenttag {0} -\let \margincontentseparator \empty -\def \margincontentstrutheight {\strutht} +\setnewconstant\margincontentdisplacement \zerocount +\let \margincontentdistance \!!zeropoint +\let \margincontenthoffset \!!zeropoint +\def \margincontentlines {1} +\def \margincontenttag {0} +\let \margincontentseparator \empty +\def \margincontentstrutheight {\strutht} \newcount\margincontentlevel \newdimen\margincontentheight +% \installparameterhandler \??im{inmargin} +% \installparameterhashhandler\??im{inmargin} + \unexpanded\def\setupinmargin {\dodoubleempty\dosetupinmargin} @@ -203,10 +214,6 @@ \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]% @@ -255,7 +262,7 @@ \donothing \doifnumberelse\margincontenttag {\ifnum\margincontenttag>25 % to be translated - \writestatus\m!systems{potential margin stack overflow (\margincontenttag)}% + \writestatus\m!system{potential margin stack overflow (\margincontenttag)}% \fi} \donothing % we need to preserve {a,b,c} kind of settings @@ -266,8 +273,10 @@ \v!no=>\let\margincontentalign\v!normal, \v!inner=>\let\margincontentalign#1, \v!outer=>\let\margincontentalign#2, + \v!flushright=>\let\margincontentalign\v!left, \v!left=>\let\margincontentalign\v!left, \v!middle=>\let\margincontentalign\v!middle, + \v!flushleft=>\let\margincontentalign\v!right, \v!right=>\let\margincontentalign\v!right]% \doifvaluesomething{\??im\margincontenttag\c!align} % watch {} around set {\edef\margincontentalign{{\getvalue{\??im\margincontenttag\c!align},\margincontentalign}}}% @@ -284,7 +293,9 @@ \@@imbefore \dostartattributes{\??im\margincontenttag}\c!style\c!color\empty \dosetupstrut[\margincontentstrut]% was: \setstrut % yes or no + \dostarttagged\t!margintextblock\currentmargincontent % margincontenttag \begstrut#3\endstrut\endgraf + \dostoptagged \xdef\margincontentstrutheight{\the\strutht}% so that it's known outside the framed \dostopattributes \@@imafter}% @@ -349,8 +360,9 @@ % 2 only natural height % 3 also stack height -\chardef\margincontentmethod \plusthree % beware: 1 = old method -\chardef\marginpagecheckmethod\plusone +\setnewconstant\margincontentmethod \plusthree % beware: 1 = old method +\setnewconstant\marginpagecheckmethod \plusone +\setnewconstant\marginrepositionmethod\plusone \def\margincontentextralines{1} % old method, play safe \def\nofmargincontentlines {0} @@ -401,14 +413,6 @@ %\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% {\doifelsenothing\margincontentdistance {\hskip\dimexpr @@ -416,7 +420,7 @@ +\compensatedinnermakeupmargin +\csname\??im#1\c!distance\endcsname \relax} - {\dimexpr + {\hskip\dimexpr +\margincontenthoffset +\compensatedinnermakeupmargin +\margincontentdistance @@ -467,26 +471,6 @@ \edef\inmargintaglist{+,-,\v!low,\v!left,\v!right,\v!inner,\v!outer} -% the old one: -% -% \def\doinmargin[#1][#2][#3][#4][#5]% #6 #7 -% {\doifcommonelse{+,-,\v!laag}{#4} -% {\dodoinmargin[#1][#2][#3][#4][#5]} -% {\dodoinmargin[#1][#2][#3][][#4]}} -% -% an alternative: -% -% \letvalue{\??im\v!laag\c!offset}\empty -% \letvalue{\??im +\c!offset}\empty -% \letvalue{\??im -\c!offset}\empty -% -% \def\doinmargin[#1][#2][#3][#4][#5]% #6 #7 -% {\doifnumberelse{#4} -% {\dodoinmargin[#1][#2][#3][#4][#5]} -% {\doifdefinedelse{\??im#4\c!offset} -% {\dodoinmargin[#1][#2][#3][#4][#5]} -% {\dodoinmargin[#1][#2][#3][][#4]}}} -% % the problem is that we need to keep downward compatibility % with respect to the first argument thing a reference or a % directive; the alternative is to force users to pass a @@ -608,15 +592,15 @@ {\bgroup % 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 + \marginrepositionmethod\executeifdefined{\??im\currentmargincontent\c!sidemethod }\plusone + \margincontentmethod \executeifdefined{\??im\currentmargincontent\c!textmethod }\plusthree + \marginpagecheckmethod \executeifdefined{\??im\currentmargincontent\c!splitmethod}\plusone % so far \forgetall % otherwise sidefloat problems, added 2005/07/20, maybe dangerous \postponenotes % group is (somehow) needed \doifinsetelse\v!low{#4} - {\chardef\margincontentdisplacement\plusone} - {\chardef\margincontentdisplacement\zerocount}% + {\margincontentdisplacement\plusone} + {\margincontentdisplacement\zerocount}% \doif\v!reverse{#2} {\swapmacros\dorightmarginblock\doleftmarginblock}% \processaction @@ -660,10 +644,10 @@ \def\margintitle{\margintext} % txt mark as well \newtoks\collectedmargintexts % so .. delayed! -\chardef\margintextcollected \zerocount +\newconditional\margintextcollected \def\domargincontent[#1][#2]#3% we used to check for #2/#1 being number, no longer now - {\global\chardef\margintextcollected\plusone + {\global\settrue\margintextcollected \global\let\flushmargincontents\doflushmargincontents \edef\margincontenttag{#1}% \ifx\margincontenttag\empty @@ -676,11 +660,11 @@ \noexpand \doinmargin[\executeifdefined{\??im\margincontenttag\c!location}\@@imlocation][\v!normal][\margincontenttag][\margincontenttag][#2]% \to \collectedmargintexts \doglobal \appendtoks - {#3}% + {#3}% argument to previously appended \doinmargin \to \collectedmargintexts} \def\doflushmargincontents % plural - {\ifcase\margintextcollected\else + {\ifconditional\margintextcollected \expandafter\flushmargincontentsindeed \fi} @@ -758,14 +742,14 @@ \def\resetmargincontent {\global\margincontentlevel\zerocount - \global\chardef\margintextcollected\zerocount + \global\setfalse\margintextcollected \global\collectedmargintexts\emptytoks} \unexpanded\def\placemargincontent - {\ifcase\margintextcollected\else % was level check + {\ifconditional\margintextcollected % was level check \bgroup \redoconvertfont % !! - \chardef\graphicvadjustmode\zerocount + %\setfalse\graphicvadjustmode % not used \flushmargincontentsindeed \egroup \fi} diff --git a/Master/texmf-dist/tex/context/base/page-mis.mkiv b/Master/texmf-dist/tex/context/base/page-mis.mkiv index f7c3d529d1a..02083d1814e 100644 --- a/Master/texmf-dist/tex/context/base/page-mis.mkiv +++ b/Master/texmf-dist/tex/context/base/page-mis.mkiv @@ -105,7 +105,7 @@ \v!middle=>\doifbothsidesoverruled\rightmarginbox\leftmarginbox\rightmarginbox, \v!left=>\leftmarginbox, \v!right=>\rightmarginbox, - \s!unknown=>\setbox\preparedmarginbox\hbox{}]} + \s!unknown=>\setbox\preparedmarginbox\emptyhbox]} \def\dostartmarginblock % 2 maal \vbox ivm \unvbox elders {\global\setbox\marginbox\vtop\bgroup\vbox\bgroup diff --git a/Master/texmf-dist/tex/context/base/page-mul.mkii b/Master/texmf-dist/tex/context/base/page-mul.mkii index c78af074ada..801ae5d657a 100644 --- a/Master/texmf-dist/tex/context/base/page-mul.mkii +++ b/Master/texmf-dist/tex/context/base/page-mul.mkii @@ -1179,11 +1179,11 @@ \egroup} \def\multicolumnseject - {\ifdim\pagetotal>\textheight - \eject % new - \else + {%\ifdim\pagetotal>\textheight + % \eject % new, but wrong as fails on mixed-001.tex (wrong pagetotal at this point) + %\else \allowbreak - \fi} + }%\fi} %D The multicolumn mechanism is incorporated in a \CONTEXT\ %D interface, which acts like: diff --git a/Master/texmf-dist/tex/context/base/page-mul.mkiv b/Master/texmf-dist/tex/context/base/page-mul.mkiv index 88ec7a5e7be..581ba5a598a 100644 --- a/Master/texmf-dist/tex/context/base/page-mul.mkiv +++ b/Master/texmf-dist/tex/context/base/page-mul.mkiv @@ -358,8 +358,7 @@ \newdimen\mcscratchdimen \newcount\nofcolumnlines -\chardef\multicolumnlinemethod\zerocount % 0: overshoot (old default), 1: tight -% \chardef\multicolumnlinemethod\plusone +\newconstant\multicolumnlinemethod % 0: overshoot (old default), 1: tight \def\getmulticolumnlines {\mcscratchdimen-\columntextoffset @@ -443,12 +442,14 @@ \vskip-\struttotal \fi \global\savedpagetotal\pagetotal - \global\singlecolumnout\output + \global\singlecolumnout\output % hm %\global\output{\global\setbox\precolumnbox\vbox{\unvbox\normalpagebox}}% - \global\output{\global\setbox\precolumnbox\vbox{\dotopinsertions\unvbox\normalpagebox}}% + %\global\output{\global\setbox\precolumnbox\vbox{\dotopinsertions\unvbox\normalpagebox}}% + \setoutputroutine{\global\setbox\precolumnbox\vbox{\dotopinsertions\unvbox\normalpagebox}}% \eject % no \holdinginserts=1, can make footnote disappear ! \global\precolumnboxheight\ht\precolumnbox - \global\output{\continuousmulticolumnsout}% + %\global\output{\continuousmulticolumnsout}% + \setoutputroutine{\continuousmulticolumnsout}% \setcolumnfloats \dohandleallcolumns {\global\setbox\currenttopcolumnbox\emptybox}% @@ -475,7 +476,7 @@ %D e.g. when there is no text given between \type{\begin..} %D and \type{\end..}. The \type{\par} is needed! -\chardef\multicolumnendsyncmethod\plusone % 1: old sync 2: new sync (cont-loc/project) / may fail ! ! ! ! +\setnewconstant\multicolumnendsyncmethod\plusone % 1: old sync 2: new sync (cont-loc/project) / may fail ! ! ! ! \def\endmulticolumns {%\par @@ -493,17 +494,21 @@ \par \ifbalancecolumns \ifnum\multicolumnendsyncmethod=\plusone - \global\output{\continuousmulticolumnsout}% + %\global\output{\continuousmulticolumnsout}% + \setoutputroutine{\continuousmulticolumnsout}% \goodbreak \fi - \global\output{\balancedmulticolumnsout}% + %\global\output{\balancedmulticolumnsout}% + \setoutputroutine{\balancedmulticolumnsout}% \else \goodbreak \fi \eject % the prevdepth is important, try e.g. toclist in \prevdepth\zeropoint % columns before some noncolumned text text - \global\output\singlecolumnout - \global\output{\the\mainoutput}% % % % % todo + %\global\output\singlecolumnout + \setoutputroutine{\singlecolumnout}% + %\global\output{\the\mainoutput}% % % % % todo + \setoutputroutine{\the\mainoutput}% % % % % todo \ifvoid\precolumnbox\else \unvbox\precolumnbox \fi @@ -569,8 +574,8 @@ \edef\maxcolumndepth{\the\dp\currentcolumnbox}% \fi}} -\chardef\multicolumntopflushmethod\plusone % 0: no correction, 1: correction when topstuff, 2: correction, 3: correction++ -\chardef\multicolumntopalignmethod\plustwo % 0: nothing, 1: force grid, 2: follow grid +\setnewconstant\multicolumntopflushmethod\plusone % 0: no correction, 1: correction when topstuff, 2: correction, 3: correction++ +\setnewconstant\multicolumntopalignmethod\plustwo % 0: nothing, 1: force grid, 2: follow grid \def\flushprecolumnboxnogrid {\unvbox\precolumnbox} @@ -599,6 +604,8 @@ \setmaxcolumndimensions \dohandleallcolumns {\mkprocesscolumncontents\currentcolumnbox}% + \dohandleallcolumns + {\docolumnpagebodymarks\plusone\nofcolumns\mofcolumns\currentcolumnbox}% \postprocesscolumns \dohandleallcolumns % \hbox i.v.m. \showcomposition {\global\setbox\currentcolumnbox\hbox to \localcolumnwidth @@ -1022,30 +1029,27 @@ \dontshowcomposition \widowpenalty\zerocount \setbox0\vbox{\unvbox\normalpagebox}% -\ifdim\ht0>\openlineheight % at least one line - \ifnum\minbalancetoplines<2 % balance anyway - \donetrue - \else % check criterium to available lines - \getnoflines{\ht0}% - \divide\noflines \nofcolumns \relax - \ifnum\noflines<\minbalancetoplines \relax - \dimen0\ht0 - \advance\dimen0 \ht\firsttopcolumnbox - \advance\dimen0 \openlineheight \relax % let's play safe - \ifdim\dimen0>\columntextheight % column exceeding text height - \donetrue - \else % it seems to fit - \donefalse - \fi - \else % balance indeed - \donetrue - \fi + \ifdim\ht0>\openlineheight % at least one line + \ifnum\minbalancetoplines<2 % balance anyway + \donetrue + \else % check criterium to available lines + \getnoflines{\ht0}% + \divide\noflines \nofcolumns \relax + \ifnum\noflines<\minbalancetoplines \relax + % let's play safe + \ifdim\dimexpr\ht0+\ht\firsttopcolumnbox+\openlineheight\relax>\columntextheight + \donetrue % column exceeding text height + \else + \donefalse % it seems to fit + \fi + \else % balance indeed + \donetrue + \fi + \fi + \else % balancing does not make sense + \donefalse \fi -\else % balancing does not make sense - \donefalse -\fi -\ifdone % start balancing - %\ifdim\ht0>\openlineheight + \ifdone % start balancing, was: \ifdim\ht0>\openlineheight \dimen0\ht0 \advance\dimen0 \topskip \advance\dimen0 -\baselineskip @@ -1160,18 +1164,19 @@ \showmessage\m!columns{10}\empty \global\setbox\firstcolumnbox\vbox{\unvbox0}% \fi - \global\output{\balancingerror}% + %\global\output{\balancingerror}% + \setoutputroutine{\balancingerror}% \b@selinebottomtrue % forces depth in separation rule \flushcolumnedpage\plusone \multicolumnseject \egroup} \def\multicolumnseject - {\ifdim\pagetotal>\textheight - \eject % new - \else + {%\ifdim\pagetotal>\textheight + % \eject % new, but wrong as fails on mixed-001.tex (wrong pagetotal at this point) + %\else \allowbreak - \fi} + }%\fi} %D The multicolumn mechanism is incorporated in a \CONTEXT\ %D interface, which acts like: @@ -1251,9 +1256,17 @@ \def\OTRMULdotopinsertions {\ifconditional\onlylocalcolumnfloats\relax \else\OTRONEdotopinsertions \fi} \def\OTRMULdoflushfloats {\ifconditional\onlylocalcolumnfloats\doflushcolumnfloats\else\OTRONEdoflushfloats \fi} +\newtoks\everylocalcolumnfloatspar + +\everylocalcolumnfloatspar + {\flushnotes + \flushcolumnfloat + % \flushmargincontents + \checkindentation} + \def\setlocalcolumnfloats {\settrue\onlylocalcolumnfloats - \everypar{\flushnotes\flushcolumnfloat\flushmargincontents\checkindentation}% + \everypar\everylocalcolumnfloatspar \let\flushcolumnfloat\doflushcolumnfloat \let\flushcolumnfloats\doflushcolumnfloats} @@ -1326,7 +1339,7 @@ \else \bgroup \getcolumnstatus\column\count255\total\dimen0\goal\dimen2\\% - \dofloatsgetinfo{text}% + \dofloatsgetinfo\s!text \setbox\scratchbox\vbox % tricky met objecten ? {\blank[\@@bkspacebefore] \snaptogrid\vbox{\vskip\floatheight}}% copy? @@ -1356,7 +1369,7 @@ \let\doflushcolumnfloat\relax \getcolumnstatus\column\mofcolumns\total\dimen0\goal\dimen2\\% \ifdim\dimen0>\zeropoint - \dofloatsgetinfo{text}% + \dofloatsgetinfo\s!text \ifdim\floatwidth>\hsize % dropped ? \else @@ -1368,7 +1381,7 @@ \ifnum\mofcolumns<\nofcolumns \advance\mofcolumns \plusone \ifdim\ht\currenttopcolumnbox=\zeropoint - \dofloatsflush{text}{1}% + \dofloatsflush\s!text{1}% \global\setbox\currenttopcolumnbox\vbox {\snaptogrid\vbox{\box\floatbox} \whitespace % nodig ? @@ -1392,7 +1405,7 @@ \blank[\@@bkspacebefore] \nobreak \fi - \dofloatsflush{text}{1}% + \dofloatsflush\s!text{1}% \flushfloatbox \blank[\@@bkspaceafter] \fi @@ -1415,7 +1428,6 @@ %D When handling lots of (small) floats spacing can get worse %D because of lining out the columns. - \def\doflushcolumnfloats {\ifpostponecolumnfloats\else \bgroup @@ -1434,7 +1446,7 @@ \whitespace % nodig ? \blank[\@@bkspaceafter]}% \else - \dofloatsgetinfo{text}% + \dofloatsgetinfo\s!text \ifdim\floatwidth>\hsize \dimen0\dimexpr\floatwidth+\intercolumnwidth+.5pt\relax \dimen2\dimexpr\hsize +\intercolumnwidth+.5pt\relax @@ -1445,7 +1457,7 @@ \count0\zerocount \else \dimen0\dimexpr\count0\hsize+\count0\intercolumnwidth-\intercolumnwidth\relax - \dofloatsflush{text}{1}% + \dofloatsflush\s!text{1}% \ifdim\floatwidth>\finalcolumntextwidth % better somewhere else too \global\setbox\floatbox\hbox to \finalcolumntextwidth{\hss\box\floatbox\hss}% \fi % otherwise the graphic may disappear @@ -1458,7 +1470,7 @@ \fi \showmessage\m!columns{13}\empty \else - \dofloatsflush{text}{1}% + \dofloatsflush\s!text{1}% \ifdim\floatwidth>\finalcolumntextwidth % better somewhere else too \global\setbox\floatbox\hbox to \finalcolumntextwidth{\hss\box\floatbox\hss}% \fi % otherwise the graphic may disappear diff --git a/Master/texmf-dist/tex/context/base/page-one.mkiv b/Master/texmf-dist/tex/context/base/page-one.mkiv index bbd35181e7b..babaf4f5ddb 100644 --- a/Master/texmf-dist/tex/context/base/page-one.mkiv +++ b/Master/texmf-dist/tex/context/base/page-one.mkiv @@ -59,8 +59,6 @@ \fi \fi} -\chardef\kindofpagetextareas=2 % whole page (public variable! never change) - % can we avoind the extra vboxing here? \def\OTRONEregisteredtextarea#1% @@ -72,15 +70,13 @@ #1% \fi} -% \chardef\kindofpagetextareas\plusone - \def\doOTRONEregisteredtextareaA#1% {\ifregistertextareas \xypos{pbd:\realfolio:b}% we could save bytes by only saving the y \endgraf \begingroup \scratchdimen\dimexpr\MPy{pbd:\realfolio:b}-\MPy{pbd:\realfolio:e}\relax - \setbox\scratchbox\null + \setbox\scratchbox\emptyhbox \wd\scratchbox\makeupwidth \ht\scratchbox\scratchdimen \vsmash{\registeredtextarea00\scratchbox}% @@ -104,6 +100,10 @@ \let\OTRONEregisteredtextareaA\firstofoneargument \let\OTRONEregisteredtextareaB\firstofoneargument +% 1 = partial page, 2 = whole page, 3 = partial page + +\setnewconstant\kindofpagetextareas\plustwo + \def\OTRONEdopagecontents#1#2% \box \unvbox {\bgroup % niet breedte zetten, kan fractie zijn! \ifcase\kindofpagetextareas @@ -285,7 +285,7 @@ \fi \fi} -\chardef\topinserttopskipmode=0 % 1 no topskip +\newconstant\topinserttopskipmode % 1 = no topskip \def\OTRONEdotopinsertions {\ifvoid\topins\else @@ -343,15 +343,15 @@ {\ifsomefloatwaiting \ifpackflushedfloats \centerfloatboxfalse % not needed as we do call directly - \dofloatscollect{text}{\hsize}{1em}% + \dofloatscollect\s!text{\hsize}{1em}% \OTRONEsetvsize \global\setbox\floatbox\hbox to \hsize {\hfil \dorecurse\nofcollectedfloats {\ifcase\columndirection % nog document wide - \dofloatsflush{text}{1}% + \dofloatsflush\s!text{1}% \else - \dofloatsflushn{text}{\the\numexpr\nofcollectedfloats-\recurselevel+1\relax}% + \dofloatsflushn\s!text{\the\numexpr\nofcollectedfloats-\recurselevel+1\relax}% \fi \ifdim\wd\floatbox>\makeupwidth % \hsize \hbox to \makeupwidth{\hss\box\floatbox\hss}% @@ -433,7 +433,7 @@ % [before force] \input thuan % \placefigure[force]{force}{\framed[height=8cm,width=8cm]{}}} -\chardef\fixedfloatmethod=3 +\setnewconstant\fixedfloatmethod\plusthree % \def\OTRONEsomefixdfloat % [#1] % {\docheckiffloatfits @@ -490,9 +490,11 @@ \doifinset\v!tall{#1}\flushsidefloatsafterpar \fi} -\def\OTRONEsomepagefloat [#1]{\dofloatssavepagefloat{page} {#1}} -\def\OTRONEsomeleftpagefloat [#1]{\dofloatssavepagefloat{leftpage} {#1}} -\def\OTRONEsomerightpagefloat[#1]{\dofloatssavepagefloat{rightpage}{#1}} +\def\OTRONEsomepagefloat [#1]{\dofloatssavepagefloat {\s!page} {#1}} +\def\OTRONEsomeleftpagefloat [#1]{\dofloatssavepagefloat {\s!leftpage} {#1}} +\def\OTRONEsomerightpagefloat[#1]{\dofloatssavepagefloat {\s!rightpage}{#1}} + +%def\OTRONEsomesoemwherefloat[#1]{\dofloatssavesomewherefloat{\s!somewhere}{#1}} \def\OTRONEsometopsfloat[#1]% {\ifdim\topinserted=\zeropoint diff --git a/Master/texmf-dist/tex/context/base/page-par.mkiv b/Master/texmf-dist/tex/context/base/page-par.mkiv index fb8631eec83..c687c424dbf 100644 --- a/Master/texmf-dist/tex/context/base/page-par.mkiv +++ b/Master/texmf-dist/tex/context/base/page-par.mkiv @@ -38,11 +38,13 @@ \kern\@@phdistance}} \def\doshowparagraphnumberA - {\ifprocessingverbatim - \iflinepar\dodoshowparagraphnumber\fi - \else + {%\ifprocessingverbatim + % \iflinepar + % % obsolete: \dodoshowparagraphnumber + % \fi + %\else \dodoshowparagraphnumber - \fi} + }%\fi} \def\doshowparagraphnumberB {\ifnumberinglines diff --git a/Master/texmf-dist/tex/context/base/page-plg.mkiv b/Master/texmf-dist/tex/context/base/page-plg.mkiv index 7d7612153d7..83c3e77f114 100644 --- a/Master/texmf-dist/tex/context/base/page-plg.mkiv +++ b/Master/texmf-dist/tex/context/base/page-plg.mkiv @@ -190,7 +190,7 @@ % {\long\setvalue{\??ly\c!method:#1}{#2}} \long\unexpanded\def\startpagelayout - {\bgroup\catcode`\^^M=\@@ignore\dostartpagelayout} + {\bgroup\catcode\endoflineasciicode\ignorecatcode\dostartpagelayout} \long\def\dostartpagelayout[#1]#2\stoppagelayout {\egroup\long\setvalue{\??ly\c!method:#1}{#2}} diff --git a/Master/texmf-dist/tex/context/base/page-run.mkiv b/Master/texmf-dist/tex/context/base/page-run.mkiv index ae5af81e94c..cce746c742f 100644 --- a/Master/texmf-dist/tex/context/base/page-run.mkiv +++ b/Master/texmf-dist/tex/context/base/page-run.mkiv @@ -22,28 +22,28 @@ {\forgetall \dontcomplain \globaldefs\minusone - \dimen0\pagegoal + \dimen\zerocount\pagegoal \definepapersize[X][\c!width=4em, \c!height=6em]% \definepapersize[Y][\c!width=12em,\c!height=14em]% \setuppapersize[#1,X][#2,Y]% \setuplayout[#3]% - \setbox0\vbox + \setbox\zerocount\vbox {\framed [\c!offset=\v!overlay,\c!strut=\v!no, \c!width=\paperwidth,\c!height=\paperheight] {\ss ABC\par DEF}}% \doublesidedfalse \def\cutmarklength{.5em}% - \addpagecutmarks0% - \replicatepagebox0% - \scalepagebox0% - \mirrorpaperbox0% - \orientpaperbox0% - \centerpagebox0% - \mirrorprintbox0% - \orientprintbox0% - \offsetprintbox0% - \pagegoal\dimen0 + \addpagecutmarks \zerocount + \replicatepagebox\zerocount + \scalepagebox \zerocount + \mirrorpaperbox \zerocount + \orientpaperbox \zerocount + \centerpagebox \zerocount + \mirrorprintbox \zerocount + \orientprintbox \zerocount + \offsetprintbox \zerocount + \pagegoal\dimen\zerocount \box0}} \gdef\showprint @@ -88,7 +88,151 @@ % {\toonprint[][gespiegeld][plaats=midden]} {\strut\break\type{gespiegeld}} % {\toonprint[gespiegeld][gespiegeld][plaats=midden]} {\type{gespiegeld}\break\type{gespiegeld}} % \stopcombinatie - + +% maybe we will have page-run.lua + +\startluacode +local function todimen(name,unit,fmt) + return number.todimen(tex.dimen[name],unit,fmt) +end + +local function showdimension(name) + context.NC() + context.tex(interfaces.interfacedcommand(name)) + context.NC() + context(todimen(name,"pt","%0.4fpt")) + context.NC() + context(todimen(name,"cm","%0.4fcm")) + context.NC() + context(todimen(name,"bp","%0.4fbp")) + context.NC() + context(todimen(name,"dd","%0.4fdd")) + context.NC() + context.NR() +end + +local function showmacro(name) + context.NC() + context.tex(interfaces.interfacedcommand(name)) + context.NC() + context.getvalue(name) + context.NC() + context.NR() +end + +local function reportdimension(name) + commands.writestatus("layout",string.format("%-24s %12s %12s %12s %12s", + interfaces.interfacedcommand(name), + todimen(name,"pt","%0.4fpt"), + todimen(name,"cm","%0.4fcm"), + todimen(name,"bp","%0.4fbp"), + todimen(name,"dd","%0.4fdd") + )) +end + +function commands.showlayoutvariables() + + if tex.count.textlevel == 0 then + + -- especially for Luigi: + + reportdimension("paperheight") + reportdimension("paperwidth") + reportdimension("printpaperheight") + reportdimension("printpaperwidth") + reportdimension("topspace") + reportdimension("backspace") + reportdimension("makeupheight") + reportdimension("makeupwidth") + reportdimension("topheight") + reportdimension("topdistance") + reportdimension("headerheight") + reportdimension("headerdistance") + reportdimension("textheight") + reportdimension("footerdistance") + reportdimension("footerheight") + reportdimension("bottomdistance") + reportdimension("bottomheight") + reportdimension("leftedgewidth") + reportdimension("leftedgedistance") + reportdimension("leftmarginwidth") + reportdimension("leftmargindistance") + reportdimension("textwidth") + reportdimension("rightmargindistance") + reportdimension("rightmarginwidth") + reportdimension("rightedgedistance") + reportdimension("rightedgewidth") + reportdimension("bodyfontsize") + reportdimension("lineheight") + + else + + context.starttabulate { "|l|Tr|Tr|Tr|Tr|" } + + showdimension("paperheight") + showdimension("paperwidth") + showdimension("printpaperheight") + showdimension("printpaperwidth") + showdimension("topspace") + showdimension("backspace") + showdimension("makeupheight") + showdimension("makeupwidth") + showdimension("topheight") + showdimension("topdistance") + showdimension("headerheight") + showdimension("headerdistance") + showdimension("textheight") + showdimension("footerdistance") + showdimension("footerheight") + showdimension("bottomdistance") + showdimension("bottomheight") + showdimension("leftedgewidth") + showdimension("leftedgedistance") + showdimension("leftmarginwidth") + showdimension("leftmargindistance") + showdimension("textwidth") + showdimension("rightmargindistance") + showdimension("rightmarginwidth") + showdimension("rightedgedistance") + showdimension("rightedgewidth") + context.NR() + showdimension("bodyfontsize") + showdimension("lineheight") + context.NR() + showmacro("strutheightfactor") + showmacro("strutdepthfactor") + showmacro("topskipfactor") + showmacro("maxdepthfactor") + + context.stoptabulate() + + end + +end + +function commands.showlayout() + + if tex.count.textlevel == 0 then + + commands.showlayoutvariables() + + else + + context.page() + context.bgroup() + context.showframe() + context.setuplayout { marking = interfaces.variables.on } + for i=1,4 do + commands.showlayoutvariables() + context.page() + end + context.egroup() + + end + +end +\stopluacode + \gdef\doshowframe[#1][#2]% {\ifsecondargument \setupbackgrounds @@ -112,7 +256,9 @@ [#1] \else \showframe - [\v!header,\v!text,\v!footer] + [\v!top,\v!header, + \v!text, + \v!footer,\v!bottom] [\v!leftedge,\v!leftmargin, \v!text, \v!rightmargin,\v!rightedge] @@ -120,254 +266,14 @@ \setupbackgrounds [\c!state=\v!repeat]} -\gdef\showframe{\dodoubleempty\doshowframe} - -\gdef\showsetupA#1#2% - {#1&\PtToCm{\the#2}&\the#2&\tttf\string#2\cr} - -\gdef\showsetupB#1#2#3% - {#1&#3&\tttf\string#3\cr} - -% \startinterface english % english is fallback - -\gdef\showsetups - {\noindent - \vbox - {\forgetall - \dontcomplain - \switchtobodyfont[\v!small] - \tabskip\zeropoint - \halign - {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr - \showsetupA{paperheight} \paperheight - \showsetupA{paperwidth} \paperwidth - \showsetupA{printpaperheight} \printpaperheight - \showsetupA{printpaperwidth} \printpaperwidth - \showsetupA{topspace} \topspace - \showsetupA{backspace} \backspace - \showsetupA{height} \makeupheight - \showsetupA{width} \makeupwidth - \showsetupA{top} \topheight - \showsetupA{topdistance} \topdistance - \showsetupA{header} \headerheight - \showsetupA{headerdistance} \headerdistance - \showsetupA{textheight} \textheight - \showsetupA{footerdistance} \footerdistance - \showsetupA{footer} \footerheight - \showsetupA{bottomdistance} \bottomdistance - \showsetupA{bottom} \bottomheight - \showsetupA{leftedge} \leftedgewidth - \showsetupA{leftedgedistance} \leftedgedistance - \showsetupA{leftmargin} \leftmarginwidth - \showsetupA{leftmargindistance} \leftmargindistance - \showsetupA{textwidth} \textwidth - \showsetupA{rightmargindistance}\rightmargindistance - \showsetupA{rightmargin} \rightmarginwidth - \showsetupA{rightedgedistance} \rightedgedistance - \showsetupA{rightedge} \rightedgewidth - \showsetupB{bodyfontsize} \the \globalbodyfontsize - \showsetupB{line} \relax \normallineheight - \showsetupB{height} \relax \strutheightfactor - \showsetupB{depth} \relax \strutdepthfactor - \showsetupB{topskip} \relax \topskipfactor - \showsetupB{maxdepth} \relax \maxdepthfactor}}} - -% \stopinterface - -\startinterface dutch +\gdef\showframe + {\dodoubleempty\doshowframe} \gdef\showsetups - {\noindent - \vbox - {\forgetall - \dontcomplain - \switchtobodyfont[\v!small] - \tabskip\zeropoint - \halign - {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr - \showsetupA{papierhoogte} \papierhoogte - \showsetupA{papierbreedte} \papierbreedte - \showsetupA{printpapierhoogte} \printpapierhoogte - \showsetupA{printpapierbreedte} \printpapierbreedte - \showsetupA{kopwit} \kopwit - \showsetupA{rugwit} \rugwit - \showsetupA{snijwit} \snijwit - \showsetupA{hoogte} \zethoogte - \showsetupA{breedte} \zetbreedte - \showsetupA{boven} \bovenhoogte - \showsetupA{bovenafstand} \bovenafstand - \showsetupA{hoofd} \hoofdhoogte - \showsetupA{hoofdafstand} \hoofdafstand - \showsetupA{teksthoogte} \teksthoogte - \showsetupA{voetafstand} \voetafstand - \showsetupA{voet} \voethoogte - \showsetupA{onderafstand} \onderafstand - \showsetupA{onder} \onderhoogte - \showsetupA{linkerrand} \linkerrandbreedte - \showsetupA{linkerrandafstand} \linkerrandafstand - \showsetupA{linkermarge} \linkermargebreedte - \showsetupA{linkermargeafstand} \linkermargeafstand - \showsetupA{tekstbreedte} \tekstbreedte - \showsetupA{rechtermargeafstand}\rechtermargeafstand - \showsetupA{rechtermarge} \rechtermargebreedte - \showsetupA{rechterrandafstand} \rechterrandafstand - \showsetupA{rechterrand} \rechterrandbreedte - \showsetupB{korps} \the \globalbodyfontsize - \showsetupB{regel} \relax \normallineheight - \showsetupB{hoogte} \relax \strutheightfactor - \showsetupB{diepte} \relax \strutdepthfactor - \showsetupB{boven} \relax \topskipfactor - \showsetupB{onder} \relax \maxdepthfactor}}} - -\stopinterface - -% todo: \showsetupA{rugwit} \rugwit - -\startinterface german - -\gdef\showsetups% - {\noindent - \vbox - {\forgetall - \dontcomplain - \switchtobodyfont[\v!small] - \tabskip\zeropoint - \halign - {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr - \showsetupA{papierhoehe} \papierhoehe - \showsetupA{papierbreite} \papierbreite - \showsetupA{printpapierhoehe} \printpapierhoehe - \showsetupA{printpapierbreite} \printpapierbreite - \showsetupA{kopfweite} \kopfweite - \showsetupA{rumpfweite} \rumpfweite - \showsetupA{hoehe} \satzhoehe - \showsetupA{breite} \satzbreite - \showsetupA{oben} \hoeheoben - \showsetupA{abstandoben} \abstandoben - \showsetupA{kopfzeile} \kopfzeilenhoehe - \showsetupA{kopfzeilenabstand} \kopfzeilenabstand - \showsetupA{texthoehe} \texthoehe - \showsetupA{fusszeileabstand} \fusszeileabstand - \showsetupA{fusszeilen} \fusszeilenhoehe - \showsetupA{abstandunten} \abstandunten - \showsetupA{hoeheunten} \hoeheunten - \showsetupA{linkerrand} \breitelinkerrand - \showsetupA{abstandlinkerrand} \abstandlinkerrand - \showsetupA{linkemarginal} \linkemarginalbreite - \showsetupA{linkemarginalafstand} \linkemarginalafstand - \showsetupA{textbreite} \textbreite - \showsetupA{rechtemarginalafstand}\rechtemarginalafstand - \showsetupA{rechtemarginal} \rechtemarginalbreite - \showsetupA{abstandrechterrand} \abstandrechterrand - \showsetupA{rechterrand} \breiterechterrand - \showsetupB{fliesstext} \the \globalbodyfontsize - \showsetupB{linie} \relax \normallineheight - \showsetupB{hoehe} \relax \strutheightfactor - \showsetupB{tiefe} \relax \strutdepthfactor - \showsetupB{topskip} \relax \topskipfactor - \showsetupB{maxdepth} \relax \maxdepthfactor}}} - -\stopinterface - -\startinterface czech - -\gdef\showsetups% - {\noindent - \vbox - {\forgetall - \dontcomplain - \switchtobodyfont[\v!small] - \tabskip\zeropoint - \halign - {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr - \showsetupA{vyskapapiru} \vyskapapiru - \showsetupA{sirkapapiru} \sirkapapiru - \showsetupA{vyskatiskpapiru} \vyskatiskpapiru - \showsetupA{sirkatiskpapiru} \sirkatiskpapiru - \showsetupA{hornimezera} \hornimezera - \showsetupA{spodnimezera} \spodnimezera - \showsetupA{vyska} \vyskasazby - \showsetupA{breite} \sirkasazby - \showsetupA{vyskatextu} \vyskatextu - \showsetupA{sirkatextu} \sirkatextu - \showsetupA{horejsek} \vyskahorejsku - \showsetupA{vzdalenosthorejsku} \vzdalenosthorejsku - \showsetupA{zahlavi} \vyskazahlavi - \showsetupA{vzdalenostzahlavi} \vzdalenostzahlavi - \showsetupA{fusszeileabstand} \vzdalenostupati - \showsetupA{upati} \vyskaupati - \showsetupA{vzdalenostspodku} \vzdalenostspodku - \showsetupA{spodek} \vyakaspodku - \showsetupA{levyokraj} \sirkalevehookraje - \showsetupA{vzdalenostlevehookraje} \vzdalenostlevehookraje - \showsetupA{levamarginalie} \sirkalevemarginalie - \showsetupA{vzdalenostlevemarginalie} \vzdalenostlevemarginalie - \showsetupA{vzdalenostpravemarginalie}\vzdalenostpravemarginalie - \showsetupA{pravamarginalie} \sirkapravemarginalie - \showsetupA{vzdalenostpravehookraje} \vzdalenostpravehookraje - \showsetupA{pravyokraj} \sirkapravehookraje - \showsetupB{zakladnivelikost} \the \globalbodyfontsize - \showsetupB{linka} \relax \normallineheight - \showsetupB{vyska} \relax \strutheightfactor - \showsetupB{hloubka} \relax \strutdepthfactor - \showsetupB{topskip} \relax \topskipfactor - \showsetupB{maxdepth} \relax \maxdepthfactor}}} - -\stopinterface - -\startinterface romanian - -\gdef\showsetups% - {\noindent - \vbox - {\forgetall - \dontcomplain - \switchtobodyfont[\v!small] - \tabskip\zeropoint - \halign - {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr - \showsetupA{paperheight} \paperheight - \showsetupA{paperwidth} \paperwidth - \showsetupA{printpaperheight} \printpaperheight - \showsetupA{printpaperwidth} \printpaperwidth - \showsetupA{topspace} \topspace - \showsetupA{backspace} \backspace - \showsetupA{height} \makeupheight - \showsetupA{width} \makeupwidth - \showsetupA{top} \topheight - \showsetupA{topdistance} \topdistance - \showsetupA{header} \headerheight - \showsetupA{headerdistance} \headerdistance - \showsetupA{textheight} \textheight - \showsetupA{footerdistance} \footerdistance - \showsetupA{footer} \footerheight - \showsetupA{bottomdistance} \bottomdistance - \showsetupA{bottom} \bottomheight - \showsetupA{leftedge} \leftedgewidth - \showsetupA{leftedgedistance} \leftedgedistance - \showsetupA{leftmargin} \leftmarginwidth - \showsetupA{leftmargindistance} \leftmargindistance - \showsetupA{textwidth} \textwidth - \showsetupA{rightmargindistance}\rightmargindistance - \showsetupA{rightmargin} \rightmarginwidth - \showsetupA{rightedgedistance} \rightedgedistance - \showsetupA{rightedge} \rightedgewidth - \showsetupB{bodyfontsize} \the \globalbodyfontsize - \showsetupB{line} \relax \normallineheight - \showsetupB{height} \relax \strutheightfactor - \showsetupB{depth} \relax \strutdepthfactor - \showsetupB{topskip} \relax \topskipfactor - \showsetupB{maxdepth} \relax \maxdepthfactor}}} - -\stopinterface + {\ctxcommand{showlayoutvariables()}} \gdef\showlayout % interfereert lelijk met een \typefile er na - {\bgroup - \page - \showframe - \setuplayout[\c!marking=\v!on] - \dorecurse{4}{\showsetups\page} - \egroup} + {\ctxcommand{showlayout()}} \gdef\showmargins {\starttabulate diff --git a/Master/texmf-dist/tex/context/base/page-sel.mkiv b/Master/texmf-dist/tex/context/base/page-sel.mkiv new file mode 100644 index 00000000000..9192d143053 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/page-sel.mkiv @@ -0,0 +1,347 @@ +%D \module +%D [ file=page-sel, % moved from page-imp +%D version=1998.01.15, +%D title=\CONTEXT\ Page Macros, +%D subtitle=Page Selection, +%D author=Hans Hagen, +%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 This will become runtime loaded code. + +\writestatus{loading}{ConTeXt Page Macros / Page Selection} + +\unprotect + +%D One can (mis)use this mechanism, in close cooperation +%D with \PDFTEX\ to arrange pages of already produced files. +%D +%D \starttyping +%D \insertpages[file.pdf][1,3][n=30,width=18cm] +%D \stoptyping +%D +%D The pages are inserted in the text area, and even pages +%D are repositioned according to the width. In this example +%D empty pages are added after page 1 and 3. +%D +%D Selecting pages can be accomplished by: +%D +%D \starttyping +%D \filterpages[file.pdf][1,3,5][n=30,width=18cm] +%D \stoptyping +%D +%D One may pass \type {odd} or \type {even} instead of a +%D comma separated list. A third alternative is: +%D +%D \starttyping +%D \copypages[file.pdf][n=30,scale=950] +%D \stoptyping +%D +%D This macros inserts the page, according to the settings +%D provided. + +\def\insertpages + {\dotripleempty\doinsertpages} + +\def\doinsertpages[#1][#2][#3]% + {\doifassignmentelse{#2} + {\dodoinsertpages[#1][][#2]} + {\dodoinsertpages[#1][#2][#3]}} + +\def\dodoinsertpages[#1][#2][#3]% + {\bgroup + \dontcomplain + \getfiguredimensions[#1]% + \getparameters[\??ip][\c!n=\noffigurepages,\c!width=\!!zeropoint,#3]% + \doifinset0{#2}{\emptyhbox\page}% + \dorecurse\@@ipn + {\dofilterpage{#1}\recurselevel + \doifinset\recurselevel{#2}{\emptyhbox\page}}% + \egroup} + +\def\filterpages + {\dotripleempty\dofilterpages} + +\def\dofilterpages[#1][#2][#3]% % \noffigurepages not yet supported + {\bgroup + \dontcomplain + \getfiguredimensions[#1]% + \getparameters[\??ip][\c!n=\noffigurepages,\c!width=\!!zeropoint,#3]% + \doifelse{#2}\v!even + {\dorecurse\@@ipn + {\ifodd\recurselevel\relax\else\dofilterpage{#1}\recurselevel\fi}} + {\doifelse{#2}\v!odd + {\dorecurse\@@ipn + {\ifodd\recurselevel\relax\dofilterpage{#1}\recurselevel\fi}} + {\def\dodocommand##1{\ifnum##1>\@@ipn\else\dofilterpage{#1}{##1}\fi}% + \def\docommand ##1{\dowithrange{##1}\dodocommand}% + \processcommalist[#2]\docommand}}% + \egroup} + +\def\dofilterpage#1#2% + {\hbox to \textwidth + {\ifdoublesided\ifdim\@@ipwidth>\zeropoint\relax\ifodd\realpageno\else + \hfill + \def\dowithfigure{\hskip-\@@ipwidth}% + \fi\fi\fi + \setbox0\hbox + {\externalfigure[#1][\c!page=#2,\c!height=\textheight]}% + \wd0\zeropoint + \box0} + \page} + +\def\copypages + {\dodoubleempty\docopypages} + +\def\docopypages[#1][#2]% + {\bgroup + \getfiguredimensions[#1]% + \getparameters[\??ip] + [\c!n=\noffigurepages, + \c!marking=\v!off, + \c!scale=\!!thousand, + \c!offset=\!!zeropoint, + #2]% + \dorecurse\@@ipn + {\vbox to \textheight + {\hsize\textwidth + \scratchdimen\@@ipoffset + \centeredbox + {\doifelse\@@ipmarking\v!on\cuthbox\hbox + {\ifdim\scratchdimen>\zeropoint\relax + \advance\vsize -2\scratchdimen + \advance\hsize -2\scratchdimen + \externalfigure[#1][\c!page=\recurselevel,#2,\c!scale=,\c!factor=\v!max,\c!offset=\v!overlay]% + \else + \externalfigure[#1][\c!page=\recurselevel,#2,\c!offset=\v!overlay]% + \fi}}} + \page} + \egroup} + +%D \macros +%D {combinepages} +%D +%D Yet another way of postprocessing is handles by \type +%D {\combinepages}. This macro builds a matrix of pages from a +%D file, for example: +%D +%D \starttyping +%D \setuppapersize +%D [A4][A4] % or [A4,landscape][A4,landscape] +%D +%D \setuplayout +%D [header=0pt,footer=1cm, +%D backspace=1cm,topspace=1cm, +%D width=middle,height=middle] +%D +%D \setupfootertexts +%D [presentation---\currentdate\space---\space\pagenumber] +%D +%D \starttext +%D \combinepages[slides][nx=2,ny=3,frame=on] +%D \stoptext +%D \stoptyping +%D +%D One can influence the way the pages are combined. (This +%D will be explained some time.) + +\def\combinepages + {\dodoubleempty\docombinepages} + +\def\docombinepages[#1][#2]% a=perpag b=free + {\bgroup + \dontcomplain + \getfiguredimensions[#1]% + \getparameters + [\??ip] + [\c!alternative=\v!a, + \c!n=\noffigurepages,\c!nx=2,\c!ny=2,\c!start=1,\c!stop=\!!maxcard, + \c!distance=\bodyfontsize, + \c!bottom=\vfill,\c!top=\vss, + \c!left=\hss,\c!right=\hss, + \c!before=\page,\c!after=\page,\c!inbetween=\blank, + \c!frame=,\c!background=,\c!backgroundcolor=, + #2]% + \def\@@ipname{#1}% + \@@ipbefore + \expandcheckedcsname{\??ip::\c!alternative:}\@@ipalternative\v!b + \@@ipafter + \egroup} + +\setvalue{\??ip::\c!alternative:\v!a}% + {\global\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=\number\combinedpagescounter, + \c!factor=\v!max, + \c!background=\@@ipbackground, + \c!backgroundcolor=\@@ipbackgroundcolor, + \c!frame=\@@ipframe]% + \fi\fi + \@@ipright} + \@@ipbottom}% + \global\advance\combinedpagescounter\plusone + \hfil}% + \hfilneg} + \vfil}% + \vfilneg}% + \page + \ifnum\combinedpagescounter>\@@ipn \exitloop\fi}} + +\setvalue{\??ip::\c!alternative:\v!c}% + {\global\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=\number\combinedpagescounter, + \c!factor=\v!max, + \c!background=\@@ipbackground, + \c!backgroundcolor=\@@ipbackgroundcolor, + \c!frame=\@@ipframe]% + \fi\fi}} + \global\advance\combinedpagescounter\plusone + \@@ipbottom}% + \vfil}% + \vfilneg} + \hfil}% + \hfilneg}} + \page + \ifnum\combinedpagescounter>\@@ipn \exitloop\fi}} + +\setvalue{\??ip::\c!alternative:\v!horizontal}{\getvalue{\??ip::\c!alternative:\v!a}} +\setvalue{\??ip::\c!alternative:\v!vertical }{\getvalue{\??ip::\c!alternative:\v!c}} + +\setvalue{\??ip::\c!alternative:\v!b}% + {\global\combinedpagescounter\@@ipstart + \doloop + {\startbaselinecorrection + \scratchdimen\@@ipdistance + \!!widtha\dimexpr(\hsize-\@@ipnx\scratchdimen+\scratchdimen)/\@@ipnx\relax + \hbox to \hsize + {\dorecurse\@@ipnx + {\global\advance\combinedpagescounter\plusone + \ifnum\combinedpagescounter>\@@ipn \else + \normalexpanded{\noexpand\externalfigure[\@@ipname] + [\c!page=\number\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}} + +% This macro cuts a page into n parts that can be pasted +% together. + +\def\slicepages + {\dotripleempty\doslicepages} + +\def\doslicepages[#1][#2][#3]% + {\ifthirdargument + \dodoslicepages[#1][#2][#3]% + \else + \dodoslicepages[#1][#2][#2]% + \fi} + +\newcounter\slicedpagenumber + +\def\dodoslicepages[#1][#2][#3]% + {\bgroup + \dontcomplain + \globallet\slicedpagenumber\!!zerocount + \getfiguredimensions[#1] + \getparameters + [\??ip] + [\c!n=1, + \c!offset=\!!zeropoint, + \c!hoffset=\!!zeropoint,\c!voffset=\!!zeropoint, + \c!width=\figurewidth,\c!height=\figureheight,#2] + \ifnum\@@ipn>\zerocount + \definepapersize + [\s!dummy][\c!height=\@@ipheight,\c!width=\@@ipwidth] + \setuppapersize + [\s!dummy][\s!dummy] + \setuplayout + [\c!backspace=\!!zeropoint,\c!topspace=\!!zeropoint, + \c!height=\v!middle,\c!width=\v!middle, + \c!textdistance=\!!zeropoint, + \c!header=\!!zeropoint,\c!footer=\!!zeropoint] + \fi + \dorecurse\noffigurepages + {\global\let\slicedpagenumber\recurselevel + \ifnum\@@ipn>\plusone + \dorecurse\@@ipn + {\let\xslice\recurselevel + \dorecurse\@@ipn + {\let\yslice\recurselevel + \clip + [\c!nx=\@@ipn,\c!ny=\@@ipn,\c!x=\xslice,\c!y=\yslice] + {\scale + [\c!scale=\@@ipn000] + {\externalfigure[#1][\c!page=\slicedpagenumber]}} + \page}} + \else + \ifodd\slicedpagenumber\relax + \getparameters[\??ip][#2] + \else + \getparameters[\??ip][#3] + \fi + \hskip\@@ipoffset + \clip + [\c!hoffset=\@@iphoffset,\c!voffset=\@@ipvoffset, + \c!height=\@@ipheight,\c!width=\@@ipwidth] + {\externalfigure[#1][\c!page=\slicedpagenumber]} + \page + \fi} + \egroup} + +% \starttext \slicepages[slice1.pdf][n=3] \stoptext + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/page-set.mkii b/Master/texmf-dist/tex/context/base/page-set.mkii index eb01799ae8d..e4817066dc1 100644 --- a/Master/texmf-dist/tex/context/base/page-set.mkii +++ b/Master/texmf-dist/tex/context/base/page-set.mkii @@ -2019,6 +2019,21 @@ \def\OTRSETinhibitinserts {\disablenotes} +% undocumented goodie + +\def\definecolumnsethsize#1#2#3#4% will be improved/speed up + {\bgroup + \def\OTRSETidentifier{#1}% + \ifcase\columnsetlevel\relax + \mofcolumns\plusone + \OTRSETinitializecolumns + \OTRSETassignwidths + \OTRSETsethsize + \fi + \!!counta#2\!!countb#3\docalculatecolumnsetspan + \expandafter\egroup\expandafter\edef\expandafter + #4\expandafter{\the\!!widtha}} + % interface to footnotes \def\OTRSETassignwidths diff --git a/Master/texmf-dist/tex/context/base/page-set.mkiv b/Master/texmf-dist/tex/context/base/page-set.mkiv index cc6fbb5e6d9..8c3566bc087 100644 --- a/Master/texmf-dist/tex/context/base/page-set.mkiv +++ b/Master/texmf-dist/tex/context/base/page-set.mkiv @@ -133,28 +133,6 @@ %D \stoptext %D \stoptyping -% not ok yet, for column sets we need a special case: within a column we -% need to bubble-up the marks; the indirectness permits overloading here - -\let\saveOTRSETmark \refreshsavedmark -\let\bubbleOTRSETmark\bubblesavedmark -\let\resetOTRSETmark \resetsavedmark -\let\presetOTRSETmark\presetsavedmark - -\def\doregisterOTRSETmarks#1{\saveOTRSETmark [#1][\number\mofcolumns]} -\def\dobubbleOTRSETmarks #1{\bubbleOTRSETmark[#1][\number\mofcolumns]} -\def\doresetOTRSETmarks #1{\resetOTRSETmark [#1][\recurselevel]} -\def\dopresetOTRSETmarks #1{\presetOTRSETmark[#1][\recurselevel]} - -\def\registerOTRSETmarks - {\processcommacommand[\alldefinedmarks]\doregisterOTRSETmarks} -\def\bubbleOTRSETmarks - {\processcommacommand[\alldefinedmarks]\dobubbleOTRSETmarks} -\def\resetOTRSETmarks - {\dorecurse\nofcolumns{\processcommacommand[\alldefinedmarks]\doresetOTRSETmarks}} -\def\presetOTRSETmarks - {\dorecurse\nofcolumns{\processcommacommand[\alldefinedmarks]\dopresetOTRSETmarks}} - %D test case of Vit Zika (context list): %D %D \starttyping @@ -222,7 +200,7 @@ \box\csname\@otr@:\!!stringb:\recurselevel\endcsname %\global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\box\csname\@otr@:\!!stringb:\recurselevel\endcsname \else - \emptybox + \emptyhbox %\global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\emptybox \expandafter\newbox\csname\@otr@:\!!stringb:\recurselevel\endcsname \fi @@ -459,6 +437,7 @@ \vss \fi}% \wd\scratchbox\localcolumnwidth % \textwidth + \docolumnpagebodymarks{#1}{#2}\recurselevel\scratchbox \ifcase\columndirection \hskip\OTRSETgetparameter\c!distance\recurselevel\box\scratchbox \else @@ -512,7 +491,6 @@ \def\OTRSETdoflush {\ifcollectingcontent - \registerOTRSETmarks \global\mofcolumns\plusone \else \OTRSETdofinalflush @@ -524,7 +502,6 @@ \OTRSETinitializecolumns %\OTRSETdoflushfloats \OTRSETstartnextpage -\presetOTRSETmarks \initializecolumntextareas \fi} @@ -590,7 +567,7 @@ \doOTRSETsetgridcells {\copy\placeholderboxe} \plusone\plusone\nofcolumns\scratchcounter - \null + \emptybox \fi} \def\OTRSETsetvsize % snap per sectie (gap here?) @@ -739,7 +716,7 @@ % 2 = a solution that works ok, is experimental and above % all messy -\chardef\OTRSETflushtextmode=0 +\newconstant\OTRSETflushtextmode % will be replaced \def\OTRSETflushtextsofar {\ifcase\OTRSETflushtextmode @@ -861,9 +838,7 @@ {\OTRSETsetfreecells\mofcolumns\columnlastcell \ifsomefreecolumncells % okay - \bubbleOTRSETmarks % not robust because we reenter \else - \registerOTRSETmarks % not robust because we reenter \global\advance\mofcolumns \plusone \ifnum\mofcolumns>\nofcolumns \OTRSETdoflush @@ -1148,7 +1123,7 @@ \pofcolumns \pofcolumns +\currenthcell \columnmaxcells\preferedrow-\currentvcell{#1}} -\chardef\OTRSETforcefixedfloats=0 +\newconstant\OTRSETforcefixedfloats \def\OTRSETstoreincolumnslotHERE#1% fixed column {\ifcase\OTRSETforcefixedfloats @@ -1179,9 +1154,9 @@ \ifdim\scratchdimen<\pagegoal %OTRSETprepareforcolumnslot3{#1}% %ruledvskip\columnslotspacing\lineheight - \blank[\columnslotspacing*\v!line]% + \blank[\number\columnslotspacing*\v!line]% \snaptogrid\hbox to \hsize{\hss\box#1\hss}% strange, why the centering - \blank[\columnslotspacing*\v!line]% + \blank[\number\columnslotspacing*\v!line]% \else \OTRSETstoreincolumnslotSOMEWHERE2{#1}% \fi @@ -1279,7 +1254,7 @@ \OTRSETsavebox{#9}% \fi} -\chardef\columnslotspacing \plusone +\setnewconstant\columnslotspacing\plusone \def\OTRSETstoreincolumnslot#1% #2 % {method} {box} % alleen last {% no messing around here @@ -1333,11 +1308,11 @@ \def\OTRSETsavebox#1% clean up the skips {\OTRSETunpreparebox{#1}% - \dofloatssave{text}} + \dofloatssave\s!text} \def\OTRSETresavebox#1% clean up the skips {\OTRSETunpreparebox{#1}% - \dofloatsresave{text}} + \dofloatsresave\s!text} \def\OTRSETflushfloatbox % nog verder doorvoeren en meer info in marge {\iftestfloatbox\ruledhbox\fi{\box\floatbox}} @@ -1348,10 +1323,10 @@ \doloop {\ifsomefloatwaiting \OTRSETskipstart - \dofloatsgetinfo{text}% + \dofloatsgetinfo\s!text \ifdim\floatwidth>\zeropoint \!!doneatrue - \dofloatsflush{text}{1}% + \dofloatsflush\s!text{1}% \dp\floatbox\zeropoint \OTRSETstoreincolumnslot{TBLR}\floatbox \if!!donea @@ -1624,7 +1599,8 @@ \newcounter\columnsetlevel \let\currentcolumnset\empty -\chardef\OTRSETfinish\zerocount + +\newconditional\OTRSETfinish % never checked \unexpanded\def\startcolumnset {\dodoubleempty\dostartcolumnset} @@ -1632,8 +1608,7 @@ \def\dostartcolumnset[#1][#2]% {\increment\columnsetlevel\relax \globallet\localcolumnmaxcells\!!zerocount - \global\chardef\OTRSETfinish\zerocount - \resetOTRSETmarks + \global\setfalse\OTRSETfinish \ifnum\columnsetlevel=\plusone \bgroup \saveinterlinespace @@ -1666,7 +1641,7 @@ {\OTRSETdoifcellelse{1}{1} {\bgroup \OTRSETcentergridcells - \chardef\OTRSETbalancemethod\plusone + \OTRSETbalancemethod\plusone \OTRSETreducegridbox \global\setbox\OTRfinalpagebox\OTRSETmakegridbox \global\ht\OTRfinalpagebox\textheight % signals output that there is content @@ -1679,7 +1654,7 @@ {\relax \ifnum\columnsetlevel=\plusone \endgraf % needed, else wrong vsize in one par case - \global\chardef\OTRSETfinish\plusone + \global\settrue\OTRSETfinish % no, extra page \pagebreak % (test on pascal toc) \dostopcolumnset \egroup @@ -1694,7 +1669,7 @@ \box\OTRfinalpagebox \fi \fi - \global\chardef\OTRSETfinish\zerocount + \global\setfalse\OTRSETfinish \ifsomefloatwaiting \setvsize \pagebreak \setvsize \fi \OTRSETflushleftovers \else @@ -1702,7 +1677,7 @@ \fi \decrement\columnsetlevel\relax} -\chardef\OTRSETbalancemethod\zerocount +\newconstant\OTRSETbalancemethod \def\dostopcolumnset {%\OTRSETdofinalflushfloats % yes/no @@ -1761,7 +1736,6 @@ \fi \vfill \eject -\registerOTRSETmarks % brr, may result in empty page after nicely fit text % or if left, then lost of first column only text \ifnum\mofcolumns>\plusone @@ -1826,15 +1800,15 @@ \getrawnoflines\textheight\xdef\columnmaxcells{\the\noflines}% % direction \doifelsevalue{\??mc\OTRSETidentifier\c!direction}\v!right - {\chardef\columndirection\zerocount} - {\chardef\columndirection\plusone}% + {\columndirection\zerocount} + {\columndirection\plusone}% % balancing - \chardef\OTRSETbalancemethod\zerocount + \OTRSETbalancemethod\zerocount \processaction [\getvalue{\??mc\OTRSETidentifier\c!balance}] - [ \v!yes=>\chardef\OTRSETbalancemethod\plusone, - \v!top=>\chardef\OTRSETbalancemethod\plustwo, - \v!bottom=>\chardef\OTRSETbalancemethod\plusthree]} + [ \v!yes=>\OTRSETbalancemethod\plusone, + \v!top=>\OTRSETbalancemethod\plustwo, + \v!bottom=>\OTRSETbalancemethod\plusthree]} % test: % @@ -1925,6 +1899,21 @@ \def\OTRSETinhibitinserts {\disablenotes} +% undocumented goodie + +\def\definecolumnsethsize#1#2#3#4% will be improved/speed up + {\bgroup + \def\OTRSETidentifier{#1}% + \ifcase\columnsetlevel\relax + \mofcolumns\plusone + \OTRSETinitializecolumns + \OTRSETassignwidths + \OTRSETsethsize + \fi + \!!counta#2\!!countb#3\docalculatecolumnsetspan + \expandafter\egroup\expandafter\edef\expandafter + #4\expandafter{\the\!!widtha}} + % interface to footnotes \def\OTRSETassignwidths @@ -2423,7 +2412,7 @@ \def\dodefinecolumnsetspan[#1][#2]% {%\ifsecondargument - \defineframedtext + \defineframedtext % we can have a parent [cs:#1] [\c!frame=\v!off, \c!before=, @@ -2477,7 +2466,7 @@ \c!depthcorrection=\v!off, #2]% % determine widths - \!!countc\framedtextparameter{cs:#1}\c!n + \!!countc\namedframedtextparameter{cs:#1}\c!n % \!!countd\numexpr(\nofcolumns-\mofcolumns+\plusone)% \!!countd\nofcolumns % n <= n of columns @@ -2485,7 +2474,7 @@ \advance\!!countd -\mofcolumns \advance\!!countd \plusone % n <= n of available columns (alternative a) - \doif{\framedtextparameter{cs:#1}\c!alternative}\v!a + \doif{\namedframedtextparameter{cs:#1}\c!alternative}\v!a {\ifnum\!!countc>\!!countd \!!countc\!!countd \fi}% % here it all starts \setcolumnsetspanhsize\mofcolumns\!!countc % a/b used @@ -2494,7 +2483,7 @@ \dostartframedtext[cs:#1][\v!none]% geen nils placement % spoils spacing : \vskip-\struttotal\par\verticalstrut\par \ifnum\columnsetlevel>\zerocount - \framedtextparameter{cs:#1}\c!before + \namedframedtextparameter{cs:#1}\c!before \fi \unexpanded\def\stopcolumnsetspan{\dostopcolumnsetspan{#1}}} @@ -2504,8 +2493,8 @@ \kern-2\struttotal \verticalstrut \ifnum\columnsetlevel>\zerocount - \doifsomething{\framedtextparameter{cs:#1}\c!after} - {\framedtextparameter{cs:#1}\c!after + \doifsomething{\namedframedtextparameter{cs:#1}\c!after} + {\namedframedtextparameter{cs:#1}\c!after \kern\zeropoint}% otherwise blanks disappear, better be a switch \else \endgraf @@ -2514,16 +2503,15 @@ \egroup \setbox\scratchbox\frozenhbox to \hsize {\dontcomplain - \alignedline{\framedtextparameter{cs:#1}\c!location}\v!middle - {\lower\strutdepth\box\scratchbox}}% + \alignedline{\namedframedtextparameter{cs:#1}\c!location}\v!middle{\lower\strutdepth\box\scratchbox}}% \dp\scratchbox\zeropoint % else wrong snap insidefloat % % to be tested first (strange in grid mode) % % \setbox\scratchbox\frozenhbox to \hsize % {\dontcomplain -% \chardef\alignstrutmode\zerocount -% \alignedline{\framedtextparameter{cs:#1}\c!plaats}\v!midden +% \alignstrutmode\zerocount +% \alignedline{\namedframedtextparameter{cs:#1}\c!plaats}\v!midden % {\box\scratchbox}}% % \ifinsidefloat @@ -2531,24 +2519,24 @@ \else\ifnum\columnsetlevel>\zerocount % we only set \columnsetspacing when asked for, else bottom problems % don't change this any more (test naw) - \chardef\columnslotspacing\framedtextparameter{cs:#1}\c!nlines\relax - % todo: nboven/onder & \chardef\columnslotlocation2 + \columnslotspacing\namedframedtextparameter{cs:#1}\c!nlines\relax + % todo: nboven/onder %\OTRSETstoreincolumnslotHERE\scratchbox - \edef\floatmethod{\framedtextparameter{cs:#1}\c!default}% + \edef\floatmethod{\namedframedtextparameter{cs:#1}\c!default}% \@EA\uppercasestring\floatmethod\to\floatmethod % todo : \v!here -> here enzovoorts \OTRSETstoreincolumnslot\floatmethod\scratchbox % watch out: no \dochecknextindentation{tag} - \checknextindentation[\framedtextparameter{cs:#1}\c!indentnext]% + \checknextindentation[\namedframedtextparameter{cs:#1}\c!indentnext]% \else % of course we needed a one-column fall back for tm; brrr, the box has now too % much height (try \ruledvbox); don't change this without testing techniek \scratchdimen\ht\scratchbox \advance\scratchdimen-\strutdp \ht\scratchbox\scratchdimen - \framedtextparameter{cs:#1}\c!before + \namedframedtextparameter{cs:#1}\c!before \snaptogrid\vbox{\box\scratchbox}% - \framedtextparameter{cs:#1}\c!after + \namedframedtextparameter{cs:#1}\c!after \fi\fi \egroup \endgraf} diff --git a/Master/texmf-dist/tex/context/base/page-sid.mkii b/Master/texmf-dist/tex/context/base/page-sid.mkii index 0848c9d8c4d..806acc6f133 100644 --- a/Master/texmf-dist/tex/context/base/page-sid.mkii +++ b/Master/texmf-dist/tex/context/base/page-sid.mkii @@ -906,7 +906,7 @@ \divide\!!counta \baselineskip \advance\!!counta \plusone \parskip\zeropoint - \dorecurse\!!counta{\line{}} + \dorecurse\!!counta{\line{}}% \kern-\!!counta\baselineskip \penalty\zerocount } diff --git a/Master/texmf-dist/tex/context/base/page-sid.mkiv b/Master/texmf-dist/tex/context/base/page-sid.mkiv index c30204a4e68..9365f7508b5 100644 --- a/Master/texmf-dist/tex/context/base/page-sid.mkiv +++ b/Master/texmf-dist/tex/context/base/page-sid.mkiv @@ -84,16 +84,16 @@ % 7 = rightedge % 8 = cutspace -\chardef\sidefloattype\zerocount +\newconstant\sidefloattype -\def\backspacefloat {\global\chardef\sidefloattype1 \putsidefloat} -\def\leftedgefloat {\global\chardef\sidefloattype2 \putsidefloat} -\def\leftmarginfloat {\global\chardef\sidefloattype3 \putsidefloat} -\def\leftfloat {\global\chardef\sidefloattype4 \putsidefloat} -\def\rightfloat {\global\chardef\sidefloattype5 \putsidefloat} -\def\rightmarginfloat {\global\chardef\sidefloattype6 \putsidefloat} -\def\rightedgefloat {\global\chardef\sidefloattype7 \putsidefloat} -\def\cutspacefloat {\global\chardef\sidefloattype8 \putsidefloat} +\def\backspacefloat {\global\sidefloattype1 \putsidefloat} +\def\leftedgefloat {\global\sidefloattype2 \putsidefloat} +\def\leftmarginfloat {\global\sidefloattype3 \putsidefloat} +\def\leftfloat {\global\sidefloattype4 \putsidefloat} +\def\rightfloat {\global\sidefloattype5 \putsidefloat} +\def\rightmarginfloat {\global\sidefloattype6 \putsidefloat} +\def\rightedgefloat {\global\sidefloattype7 \putsidefloat} +\def\cutspacefloat {\global\sidefloattype8 \putsidefloat} \let\marginfloat \cutspacefloat @@ -474,9 +474,9 @@ \fi\fi \else \ifnum\sidefloattype<\plusfour - \global\chardef\sidefloattype\plusfour + \global\sidefloattype\plusfour \else\ifnum\sidefloattype>\plusfive - \global\chardef\sidefloattype\plusfive + \global\sidefloattype\plusfive \fi\fi \fi \previoussidefloat @@ -770,7 +770,7 @@ \divide\!!counta \baselineskip \advance\!!counta \plusone \parskip\zeropoint - \dorecurse\!!counta{\line{}} + \dorecurse\!!counta{\line{}}% \kern-\!!counta\baselineskip \penalty\zerocount } diff --git a/Master/texmf-dist/tex/context/base/page-spr.mkiv b/Master/texmf-dist/tex/context/base/page-spr.mkiv index 75b91dff773..fd01e584ca6 100644 --- a/Master/texmf-dist/tex/context/base/page-spr.mkiv +++ b/Master/texmf-dist/tex/context/base/page-spr.mkiv @@ -20,7 +20,7 @@ \newbox\spreadbox \newif \ifinspread -\chardef\showspreadmode\plusone +\setnewconstant\showspreadmode\plusone % beware, ugly overload, to be redone @@ -43,7 +43,7 @@ \else % prevent duplicate writes in normal run \ifarrangingpages \else \ifcase\showspreadmode - \global\setbox\spreadbox\null + \global\setbox\spreadbox\emptyhbox \wd\spreadbox\makeupwidth \ht\spreadbox\textheight \fi \fi @@ -56,7 +56,7 @@ \def\doflushspread {\ifinspread \ifvoid\spreadbox\else % this page will be discarded later - \null \page + \emptyhbox \page \fi \fi } \unexpanded\def\startspread diff --git a/Master/texmf-dist/tex/context/base/page-str.lua b/Master/texmf-dist/tex/context/base/page-str.lua index c4d1957c3e8..7ce0f3c0fa6 100644 --- a/Master/texmf-dist/tex/context/base/page-str.lua +++ b/Master/texmf-dist/tex/context/base/page-str.lua @@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['page-str'] = { license = "see context related readme files" } +-- streams -> managers.streams + -- work in progresss .. unfinished local concat = table.concat @@ -13,14 +15,23 @@ local concat = table.concat local find_tail, write_node, free_node, copy_nodelist = node.slide, node.write, node.free, node.copy_list local vpack_nodelist, hpack_nodelist = node.vpack, node.hpack local texdimen, texbox = tex.dimen, tex.box +local settings_to_array = utilities.parsers.settings_to_array + +local nodes, node = nodes, node -local new_kern = nodes.kern -local new_glyph = nodes.glyph +local nodepool = nodes.pool +local tasks = nodes.tasks + +local new_kern = nodepool.kern +local new_glyph = nodepool.glyph local trace_collecting = false trackers.register("streams.collecting", function(v) trace_collecting = v end) local trace_flushing = false trackers.register("streams.flushing", function(v) trace_flushing = v end) -streams = streams or { } +local report_streams = logs.reporter("streams") + +streams = streams or { } -- might move to the builders namespace +local streams = streams local data, name, stack = { }, nil, { } @@ -63,7 +74,7 @@ function streams.collect(head,where) dana[1] = head end if trace_collecting then - logs.report("streams","appending snippet '%s' to slot %s",name,#dana) + report_streams("appending snippet '%s' to slot %s",name,#dana) end return nil, true else @@ -80,7 +91,7 @@ function streams.push(thename) if dana then dana[#dana+1] = false if trace_collecting then - logs.report("streams","pushing snippet '%s'",thename) + report_streams("pushing snippet '%s'",thename) end end end @@ -94,7 +105,7 @@ function streams.flush(name,copy) -- problem: we need to migrate afterwards -- nothing to flush elseif copy then if trace_flushing then - logs.report("streams","flushing copies of %s slots of '%s'",dn,name) + report_streams("flushing copies of %s slots of '%s'",dn,name) end for i=1,dn do local di = dana[i] @@ -107,7 +118,7 @@ function streams.flush(name,copy) -- problem: we need to migrate afterwards end else if trace_flushing then - logs.report("streams","flushing %s slots of '%s'",dn,name) + report_streams("flushing %s slots of '%s'",dn,name) end for i=1,dn do local di = dana[i] @@ -123,10 +134,10 @@ end function streams.synchronize(list) -- this is an experiment ! -- we don't optimize this as we want to trace in detail - list = aux.settings_to_array(list) + list = settings_to_array(list) local max = 0 if trace_flushing then - logs.report("streams","synchronizing list: %s",concat(list," ")) + report_streams("synchronizing list: %s",concat(list," ")) end for i=1,#list do local dana = data[list[i]] @@ -138,7 +149,7 @@ function streams.synchronize(list) -- this is an experiment ! end end if trace_flushing then - logs.report("streams","maximum number of slots: %s",max) + report_streams("maximum number of slots: %s",max) end for m=1,max do local height, depth = 0, 0 @@ -157,12 +168,12 @@ function streams.synchronize(list) -- this is an experiment ! end dana[m] = vbox if trace_flushing then - logs.report("streams","slot %s of '%s' is packed to height %s and depth %s",m,name,ht,dp) + report_streams("slot %s of '%s' is packed to height %s and depth %s",m,name,ht,dp) end end end if trace_flushing then - logs.report("streams","slot %s has max height %s and max depth %s",m,height,depth) + report_streams("slot %s has max height %s and max depth %s",m,height,depth) end local strutht, strutdp = texdimen.globalbodyfontstrutheight, texdimen.globalbodyfontstrutdepth local struthtdp = strutht + strutdp @@ -178,7 +189,7 @@ function streams.synchronize(list) -- this is an experiment ! -- actually we need to add glue and repack vbox.height, vbox.depth = height, depth if trace_flushing then - logs.report("streams","slot %s of '%s' with delta (%s,%s) is compensated",m,i,delta_height,delta_depth) + report_streams("slot %s of '%s' with delta (%s,%s) is compensated",m,i,delta_height,delta_depth) end else -- this is not yet ok as we also need to keep an eye on vertical spacing @@ -199,7 +210,7 @@ function streams.synchronize(list) -- this is an experiment ! vbox.list = nil free_node(vbox) if trace_flushing then - logs.report("streams","slot %s:%s with delta (%s,%s) is compensated by %s lines",m,i,delta_height,delta_depth,n) + report_streams("slot %s:%s with delta (%s,%s) is compensated by %s lines",m,i,delta_height,delta_depth,n) end end end diff --git a/Master/texmf-dist/tex/context/base/page-str.mkii b/Master/texmf-dist/tex/context/base/page-str.mkii index cfaebe3985b..71d76484e6e 100644 --- a/Master/texmf-dist/tex/context/base/page-str.mkii +++ b/Master/texmf-dist/tex/context/base/page-str.mkii @@ -325,51 +325,6 @@ \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. - - \def\setuplocalfloats - {\getparameters[\??lf]} - - \setuplocalfloats - [%before=\blank, - %after=\blank, - inbetween=\blank] - - \installfloathandler \v!local \somelocalfloat - - \initializeboxstack{localfloats} - - \newcounter\noflocalfloats - - \def\resetlocalfloats - {\doglobal\newcounter\noflocalfloats - \initializeboxstack{localfloats}} - - \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\flushlocalfloats - {\getlocalfloats - \resetlocalfloats} - - \def\getlocalfloat#1{\expanded{\foundbox{localfloats}{\number#1}}} - - \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/Master/texmf-dist/tex/context/base/page-str.mkiv b/Master/texmf-dist/tex/context/base/page-str.mkiv index d73643cbe67..8cce9945f26 100644 --- a/Master/texmf-dist/tex/context/base/page-str.mkiv +++ b/Master/texmf-dist/tex/context/base/page-str.mkiv @@ -47,7 +47,7 @@ {\ctxlua{streams.initialize()}% \glet\initializeoutputstreams\relax} -\def\enableoutputstream[#1]% +\def\enableoutputstream[#1]% could be \startoutputsubstream {\initializeoutputstreams \the\everyenableoutputstream \inoutputstreamtrue @@ -71,6 +71,16 @@ {\ctxlua{streams.stop()}% \endgroup} +\let\currentoutputsubstream\empty + +\def\startoutputsubstream[#1]% + {\glet\savedcurrentoutputstream\currentoutputstream + \enableoutputstream[#1]} + +\def\stopoutputsubstream + {\glet\currentoutputstream\savedcurrentoutputstream + \enableoutputstream[\savedcurrentoutputstream]} + \def\flushoutputstream [#1]{\ctxlua{streams.flush("#1")}} \def\outputstreamcopy [#1]{\vbox{\ctxlua{streams.flush("#1",true)}}} \def\outputstreambox [#1]{\vbox{\ctxlua{streams.flush("#1")}}} diff --git a/Master/texmf-dist/tex/context/base/page-txt.mkiv b/Master/texmf-dist/tex/context/base/page-txt.mkiv index bdc7c1bb6cd..dc516a94e33 100644 --- a/Master/texmf-dist/tex/context/base/page-txt.mkiv +++ b/Master/texmf-dist/tex/context/base/page-txt.mkiv @@ -172,8 +172,8 @@ {\c!rightstyle\c!rightcolor\c!rightwidth}{#3}% {\c!rightstyle\c!rightcolor\c!rightwidth}{#3}}% \else\ifsecondargument % new - \letvalue{\??tk#1\v!text\c!lefttext }\empty - \letvalue{\??tk#1\v!text\c!righttext }\empty + \letvalueempty{\??tk#1\v!text\c!lefttext}% + \letvalueempty{\??tk#1\v!text\c!righttext}% \setvalue{\??tk#1\v!text\c!middletext}{\dosingletexts{#1}\v!text\c!style\c!color\c!width{#2}}% \else \dosixtupleempty\dosetuptexts[#1][\v!text ][][][][]% @@ -305,7 +305,8 @@ \setvalue{\??tk::\v!nomarking}#1#2% {\bgroup \resettextlinestatus#1% - \let\dogetmarking\nogetmarking + \settrue\inhibitgetmarking + \let\dogetmarking\nogetmarking % obsolete in new marking mechanism \doplacelayouttextline#1#2% \egroup} @@ -367,19 +368,19 @@ \def\doresettextcontent[#1][#2][#3]% header text middle {\ifthirdargument - \letvalue{\??tk#1#2\executeifdefined{:\c!text:#3:}\c!middletext}\empty + \letvalueempty{\??tk#1#2\executeifdefined{:\c!text:#3:}\c!middletext}% \else\ifsecondargument - \letvalue{\??tk#1#2\c!lefttext }\empty - \letvalue{\??tk#1#2\c!middletext}\empty - \letvalue{\??tk#1#2\c!righttext }\empty + \letvalueempty{\??tk#1#2\c!lefttext}% + \letvalueempty{\??tk#1#2\c!middletext}% + \letvalueempty{\??tk#1#2\c!righttext}% \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 } +\letvalue{:\c!middle:\c!text:}\c!middletext +\letvalue{:\c!left :\c!text:}\c!lefttext +\letvalue{:\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 @@ -392,12 +393,28 @@ \newbox\scratchpagebox +% \newbox\collectedprepagecontent % only for delayed stuff + +% \def\flushcollectedpagecontent +% {\ifvoid\collectedprepagecontent \else +% \smashbox\collectedprepagecontent +% \box\collectedprepagecontent +% \fi} + +% \def\delaytillpageisflushhed#1% +% {\global\setbox\collectedprepagecontent\hbox +% {\ifvoid\collectedprepagecontent \else +% \unhbox\collectedprepagecontent +% \fi % ignore and remove not really needed +% \ignorespaces#1\removeunwantedspaces}} + \def\gettextboxes {\setbox\scratchpagebox\vbox {\dontcomplain \calculatereducedvsizes \swapmargins \offinterlineskip +% \flushcollectedpagecontent \vskip\dimexpr-\topheight-\topdistance\relax \the\toptextcontent \vskip\dimexpr\topheight+\topdistance\relax @@ -487,79 +504,6 @@ \def\ignoredlinebreak{\unskip\space\ignorespaces} -% \def\doplacelayouttextline#1#2% -% {\ifdim#2>\zeropoint\relax % prevents pagenumbers when zero height -% \goleftonpage -% \hbox -% {\setbox\scratchpagebox\vbox to #2 -% {\vsize#2\relax -% \normalbaselines -% \let\\\ignoredlinebreak -% \let\crlf\ignoredlinebreak -% \csname\??tk#1\c!before\endcsname -% \doifbothsidesoverruled -% {\dodoplacelayouttextline#1\c!lefttext \c!middletext\c!righttext\zerocount\plusone} -% {\dodoplacelayouttextline#1\c!lefttext \c!middletext\c!righttext\zerocount\plusone} -% {\dodoplacelayouttextline#1\c!righttext\c!middletext\c!lefttext \plusone\zerocount}% -% \csname\??tk#1\c!after\endcsname -% \kern\zeropoint}% keep the \dp, beware of \vtops, never change this! -% \dp\scratchpagebox\zeropoint -% \box\scratchpagebox}% -% \vskip-#2\relax -% \fi} -% -% \def\dodoplacelayouttextline#1#2#3#4#5#6% \hsize toegevoegd, \hss's niet meer wijzigen -% {\hbox -% {\ifdim\leftedgewidth>\zeropoint -% \dododoplacelayouttextline\leftedgewidth#1\v!edge -% {\hss\csname\??tk#1\v!edge#2\endcsname}% -% \hskip\leftedgedistance -% \fi -% \ifdim\leftmarginwidth>\zeropoint -% \dododoplacelayouttextline\leftmarginwidth#1\v!margin -% {\hbox to \leftmarginwidth -% {\hss\csname\??tk#1\v!margin#2\endcsname}% -% \hskip-\leftmarginwidth -% \hbox to \leftmarginwidth -% {\hss\ifcase#5\or\csname\??tk#1\v!margin\c!margintext\endcsname\fi}}% -% \hskip\leftmargindistance -% \fi -% \ifdim\makeupwidth>\zeropoint -% \dododoplacelayouttextline\makeupwidth{#1}\v!text -% {\hbox to \makeupwidth -% {\ifcase#5\or\@@nmpre{\csname\??tk#1\v!text\c!marginedgetext\endcsname}\fi -% \csname\??tk#1\v!text#2\endcsname\hss}% -% \hskip-\makeupwidth -% \hbox to \makeupwidth -% {\hss\csname\??tk#1\v!text#3\endcsname\hss}% -% \hskip-\makeupwidth -% \hbox to \makeupwidth -% {\hss\csname\??tk#1\v!text#4\endcsname -% \ifcase#6\or\@@nmpos{\csname\??tk#1\v!text\c!marginedgetext\endcsname}\fi}}% -% \fi -% \ifdim\rightmarginwidth>\zeropoint -% \hskip\rightmargindistance -% \dododoplacelayouttextline\rightmarginwidth{#1}\v!margin -% {\hbox to \rightmarginwidth -% {\csname\??tk#1\v!margin#4\endcsname\hss}% -% \hskip-\rightmarginwidth -% \hbox to \rightmarginwidth -% {\ifcase#6\or\csname\??tk#1\v!margin\c!margintext\endcsname\fi\hss}}% -% \fi -% \ifdim\rightedgewidth>\zeropoint -% \hskip\rightedgedistance -% \dododoplacelayouttextline\rightedgewidth{#1}\v!edge -% {\csname\??tk#1\v!edge#4\endcsname\hss}% -% \fi}} -% -% \def\dododoplacelayouttextline#1#2#3#4% -% {\vbox % to \vsize -% {\hsize#1\relax -% \csname\??tk#2#3\c!before\endcsname -% \setlayoutcomponentattribute#2#3% -% \hbox \layoutcomponentboxattribute to #1{#4}% -% \csname\??tk#2#3\c!after\endcsname}} - \def\doplacelayouttextline#1#2% {\let\currentlayouttextline#1% \ifdim#2>\zeropoint\relax % prevents pagenumbers when zero height @@ -682,7 +626,7 @@ \def\@@nmpre#1% {\begingroup - \setbox\scratchbox\normalhbox{\trialtypesettingtrue\ignorespaces#1\removeunwantedspaces}% + \setbox\scratchbox\normalhbox{\settrialtypesetting\ignorespaces#1\removeunwantedspaces}% \ifzeropt\wd\scratchbox\else \doifelsenothing\@@nmwidth {\box\scratchbox\tfskip} @@ -692,7 +636,7 @@ \def\@@nmpos#1% {\begingroup - \setbox\scratchbox\normalhbox{\trialtypesettingtrue\ignorespaces#1\removeunwantedspaces}% + \setbox\scratchbox\normalhbox{\settrialtypesetting\ignorespaces#1\removeunwantedspaces}% \ifzeropt\wd\scratchbox\else \doifelsenothing\@@nmwidth {\tfskip\box\scratchbox} diff --git a/Master/texmf-dist/tex/context/base/ppchtex.mkiv b/Master/texmf-dist/tex/context/base/ppchtex.mkiv index e81551eeab2..1162c1fcf6a 100644 --- a/Master/texmf-dist/tex/context/base/ppchtex.mkiv +++ b/Master/texmf-dist/tex/context/base/ppchtex.mkiv @@ -97,13 +97,15 @@ \doifundefined{fiverm} % In the more recent LaTeX versions {\font\fiverm=cmr5 } % \fiverm is no longer (pre)defined. +\newconstant\chemicaldrawingmode + \doifdefinedelse{beginpicture} % PiCTeX {\doifdefinedelse{startMPdrawing} - {\chardef\chemicaldrawingmode=2 } % MetaPost - {\chardef\chemicaldrawingmode=0 }} % raw + {\chemicaldrawingmode\plustwo } % MetaPost + {\chemicaldrawingmode\zerocount}} % raw {\doifdefinedelse{psaxes} - {\chardef\chemicaldrawingmode=1 } % PSTricks - {\chardef\chemicaldrawingmode=3 }} % unknown + {\chemicaldrawingmode\plusone } % PSTricks + {\chemicaldrawingmode\plusthree}} % unknown \ifcase\chemicaldrawingmode \writestatus{ppchtex}{using PiCTeX} @@ -283,22 +285,10 @@ % regels iets verder uit elkaar gezet. Jammer. Italic fonts % hebben grotere cijfers en vallen min of meer uit de boot. -\newif\ifloweredsubscripts - -% Due to some upward incompatibality of LaTeX to LaTeX2.09 -% and/or LaTeX2e we had to force \@@dochemicalstyle. Otherwise -% some weird \nullfont error comes up. - -\def\beginlatexmathmodehack - {\ifmmode - \let\endlatexmathmodehack=\relax - \else - \def\endlatexmathmodehack{$}$\@@dochemicalstyle\empty - \fi} +\newif\ifloweredsubscripts % this will be redone in the mkiv ways \def\setsubscripts - {\beginlatexmathmodehack - \def\dosetsubscript##1##2##3% + {\def\dosetsubscript##1##2##3% {\dimen0=##3\fontexheight##2% \setxvalue{@@\string##1\string##2}{\the##1##2\relax}% ##1##2=\dimen0\relax}% @@ -309,12 +299,10 @@ %dodosetsubscript\mathsupnormal {?}% \dodosetsubscript\mathsubnormal {.7}% \dodosetsubscript\mathsubcombined{.7}% - \global\loweredsubscriptstrue - \endlatexmathmodehack} + \global\loweredsubscriptstrue} \def\resetsubscripts {\ifloweredsubscripts - \beginlatexmathmodehack \def\doresetsubscript##1##2% {\dimen0=\getvalue{@@\string##1\string##2}\relax ##1##2=\dimen0}% @@ -326,7 +314,6 @@ \dodoresetsubscript\mathsubnormal \dodoresetsubscript\mathsubcombined \global\loweredsubscriptsfalse - \endlatexmathmodehack \fi} \ifx\Umathchar\undefined \else @@ -390,11 +377,8 @@ \def\dowithchemical% {} -\doifdefinedelse{@@iastate} - {\def\localgotochemical#1#2{\naarbox{#2}[#1]}% - \def\localthisischemical#1{\pagereference[#1]}} - {\def\localgotochemical#1{}% - \def\localthisischemical#1{}} +\def\localgotochemical#1#2{\gotobox{#2}[#1]} +\def\localthisischemical#1{\pagereference[#1]} % eind van experiment @@ -719,8 +703,8 @@ \ignorespaces} \def\dostartchemical% - {\catcode`\^=\@@superscript% t.b.v. \enableduplication - \catcode`\_=\@@subscript % t.b.v. de zekerheid + {\catcode`\^=\superscriptcatcode% t.b.v. \enableduplication + \catcode`\_=\subscriptcatcode % t.b.v. de zekerheid \begingroup \inchemicaltrue \def\toptext##1{\gdef\thetoptext{##1}\ignorespaces}\toptext{}% @@ -1096,7 +1080,7 @@ \dosetsubscripts \setbox2=\hbox{\@@dochemicalcolor $\@@dochemicalstyle{\@@localchemicalformat \chemicaltext}$}% - \setbox4=\hbox{$\@@dochemicalstyle{\@@localchemicalformat C_2^2}$}% + \setbox4=\hbox{$\@@dochemicalstyle{\@@localchemicalformat C\normalsubscript2\normapsuperscript2}$}% \setbox6=\hbox{$\@@dochemicalstyle{\@@localchemicalformat O}$}% or C \doresetsubscripts \doifnot\@@chemicallocation\v!intext @@ -1204,7 +1188,7 @@ % #3: x-coordinaat eindpunt % #4: y-coordinaat eindpunt -\chardef\chemicallinetype=0 +\newconstant\chemicallinetype \def\doplotchemicalline {\!!counte=\!!countc \advance\!!counte by -\!!counta @@ -1407,7 +1391,7 @@ \getvalue{\s!chemicallinesegment#2#1}} \def\doprocesschemicallinesegment#1#2#3#4#5% - {\chardef\chemicallinetype=#1 + {\chemicallinetype#1\relax \def\chemicallineposition{#2}% \def\doprocess[##1##2##3##4##5]% {\doifelse{##1}{?} @@ -1778,8 +1762,8 @@ \innerchemicalfalse \fi \bgroup - \catcode`\^=\@@superscript % t.b.v. \enableduplication - \catcode`\_=\@@subscript % t.b.v. de zekerheid + \catcode`\^=\superscriptcatcode % t.b.v. \enableduplication + \catcode`\_=\subscriptcatcode % t.b.v. de zekerheid \ifmmode \ifinnerchemical \def\next{\dotriplegroupempty\dosimplechemicalA}% @@ -2006,7 +1990,7 @@ {\@@dochemicalcolor $\@@dochemicalstyle{\scriptscriptstyle\hskip-.15em#2}$}% \wd0=0pt - \big#1_{\hskip.1em\box0}% + \big#1\normapsubscript{\hskip.1em\box0}% \egroup} \def\disablechemicalspecials% @@ -2204,13 +2188,11 @@ \doresetsubscripts}% \mathop{\box0}% \ifthirdargument - \doifnot{#2}{} - {^{\@@dochemicalstyle{\strut#2}}}% - \doifnot{#3}{} - {_{\@@dochemicalstyle{\strut#3}}}% + \doifnot{#2}{}{\normapsuperscript{\@@dochemicalstyle{\strut#2}}}% + \doifnot{#3}{}{\normapsubscript {\@@dochemicalstyle{\strut#3}}}% \else \doifnot{#2}{} - {_{\@@dochemicalstyle{\strut#2}}}% + {\normapsubscript{\@@dochemicalstyle{\strut#2}}}% \fi \egroup \chemicalspace} diff --git a/Master/texmf-dist/tex/context/base/pret-lua.lua b/Master/texmf-dist/tex/context/base/pret-lua.lua deleted file mode 100644 index 8803971f3eb..00000000000 --- a/Master/texmf-dist/tex/context/base/pret-lua.lua +++ /dev/null @@ -1,319 +0,0 @@ -if not modules then modules = { } end modules ['pret-lua'] = { - version = 1.001, - comment = "companion to buff-ver.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- this is not a real parser as we also want to typeset wrong output --- and a real parser would choke on that - -local utf = unicode.utf8 - -local utfcharacters, utfvalues = string.utfcharacters, string.utfvalues -local utfbyte, utffind = utf.byte, utf.find -local byte, sub, find, match = string.byte, string.sub, string.find, string.match -local texsprint, texwrite = tex.sprint, tex.write -local ctxcatcodes = tex.ctxcatcodes - -local visualizer = buffers.newvisualizer("lua") - -visualizer.identifiers = { } - --- borrowed from scite --- --- depricated: --- --- gcinfo unpack getfenv setfenv loadlib --- table.maxn table.getn table.setn --- math.log10 math.mod math.modf math.fmod - -visualizer.identifiers.core = { - "and", "break", "do", "else", "elseif", "end", "false", "for", "function", - "if", "in", "local", "nil", "not", "or", "repeat", "return", "then", - "true", "until", "while" -} - -visualizer.identifiers.base = { - "assert", "collectgarbage", "dofile", "error", "loadfile", - "loadstring", "print", "rawget", "rawset", "require", "tonumber", - "tostring", "type", -} - -visualizer.identifiers.five = { - "_G", "getmetatable", "ipairs", "next", "pairs", - "pcall", "rawequal", "setmetatable", "xpcall", "string", "table", - "math", "coroutine", "io", "os", "debug", "load", "module", "select", -} - -visualizer.identifiers.libs = { - -- coroutine - "coroutine.create", "coroutine.resume", "coroutine.status", "coroutine.wrap", - "coroutine.yield", "coroutine.running", - -- package - "package.cpath", "package.loaded", "package.loadlib", "package.path", "package.config", - -- io - "io.close", "io.flush", "io.input", "io.lines", "io.open", "io.output", - "io.read", "io.tmpfile", "io.type", "io.write", "io.stdin", "io.stdout", - "io.stderr", "io.popen", - -- math - "math.abs", "math.acos", "math.asin", "math.atan", "math.atan2", "math.ceil", - "math.cos", "math.deg", "math.exp", "math.floor math.", "math.ldexp", - "math.log", "math.max", "math.min", "math.pi", "math.pow", - "math.rad", "math.random", "math.randomseed", "math.sin", "math.sqrt", - "math.tan", "math.cosh", "math.sinh", "math.tanh", - "math.huge", - -- string - "string.byte", "string.char", "string.dump", "string.find", "string.len", - "string.lower", "string.rep", "string.sub", "string.upper", "string.format", - "string.gfind", "string.gsub", "string.gmatch", "string.match", "string.reverse", - -- table - "table.concat", "table.foreach", "table.foreachi", - "table.sort", "table.insert", "table.remove", - "table.pack", "table.unpack", - -- os - "os.clock", "os.date", "os.difftime", "os.execute", "os.exit", "os.getenv", - "os.remove", "os.rename", "os.setlocale", "os.time", "os.tmpname", - -- package - "package.preload", "package.seeall", - -- bit - -- ... todo ... -} - -local known_words = { } - -for k,v in next, visualizer.identifiers do - for _,w in next, v do - known_words[w] = k - end -end - -visualizer.styles = { - core = "", - base = "\\sl ", - five = "\\sl ", - libs = "\\sl ", -} - -local styles = visualizer.styles - -local colors = { - "prettyone", - "prettytwo", - "prettythree", - "prettyfour", -} - -local states = { - ['"']=1, ["'"]=1, ["[["] = 1, ["]]"] = 1, - ['+']=1, ['-']=1, ['*']=1, ['/']=1, ['%']=1, ['^']=1, - ["("] = 3, [")"] = 3, ["["] = 3, ["]"] = 3, - ['--']=4, -} - -local change_state, finish_state = buffers.change_state, buffers.finish_state - -local function flush_lua_word(state, word) - if word then - local id = known_words[word] - if id then - state = change_state(2,state) - if styles[id] then - texsprint(ctxcatcodes,styles[id]) - end - texwrite(word) - state = finish_state(state) - else - state = finish_state(state) -- ? - texwrite(word) - end - else - state = finish_state(state) - end - return state -end - -local incomment, inlongstring = false, false - -function visualizer.reset() - incomment, inlongstring = false, false -- needs to be hooked into flusher -end - --- we will also provide a proper parser based pretty printer although normaly --- a pretty printer should handle faulty code too (educational purposes) - -local function written(state,c,i) - if c == " " then - state = finish_state(state) - texsprint(ctxcatcodes,"\\obs") - elseif c == "\t" then - state = finish_state(state) - texsprint(ctxcatcodes,"\\obs") - if buffers.visualizers.enabletab then - texsprint(ctxcatcodes,rep("\\obs ",i%buffers.visualizers.tablength)) - end - else - texwrite(c) - end - return state, 0 -end - -function visualizer.flush_line(str, nested) - local state, instr, inesc, word = 0, false, false, nil - buffers.currentcolors = colors - local code, comment = match(str,"^(.-)%-%-%[%[(.*)$") - if comment then - -- process the code and then flush the comment - elseif incomment then - comment, code = match(str,"^(.-)%]%](.*)$") - if comment then - -- flush the comment and then process the code - for c in utfcharacters(comment) do - if c == " " then texsprint(ctxcatcodes,"\\obs") else texwrite(c) end - end - state = change_state(states['--'], state) - texwrite("]]") - state = finish_state(state) - incomment = false - else - for c in utfcharacters(str) do - if c == " " then texsprint(ctxcatcodes,"\\obs") else texwrite(c) end - end - end - comment = nil - else - code = str - end - if code and code ~= "" then - local pre, post = match(code,"^(.-)%-%-(.*)$") - if pre then - code = pre - end - local p, s, i = nil, nil, 0 - for c in utfcharacters(code) do - i = i + 1 - if instr then - if p then - texwrite(p) - p = nil - end - if c == s then - if inesc then - texwrite(c) - inesc = false - else - state = change_state(states[c],state) - instr = false - texwrite(c) - state = finish_state(state) - end - s = nil - else - if c == "\\" then - inesc = not inesc - else - inesc = false - end - state, i = written(state,c,i) - end - elseif c == "[" then - if word then - texwrite(word) - word = nil - end - if p == "[" then - inlongstring = true - state = change_state(states["[["],state) - texwrite(p,c) - state = finish_state(state) - p = nil - else - if p then - state, i = written(state,p,i) - end - p = c - end - elseif c == "]" then - if word then - texwrite(word) - word = nil - end - if p == "]" then - inlongstring = false - state = change_state(states["]]"],state) - texwrite(p,c) - state = finish_state(state) - p = nil - else - if p then - state, i = written(state,p,i) - end - p = c - end - else - if p then - state = change_state(states[p],state) - texwrite(p) - state = finish_state(state) - p = nil - end - if c == " " or c == "\t" then - if word then - state = flush_lua_word(state,word) - word = nil - end - state, i = written(state,c,i) - elseif inlongstring then - state, i = written(state,c,i) - elseif c == '"' or c == "'" then -if word then - state = flush_lua_word(state,word) - word = nil -end - instr = true - state = change_state(states[c],state) - state, i = written(state,c,i) - state = finish_state(state) - s = c - elseif find(c,"^[%a]$") then - state = finish_state(state) - if word then word = word .. c else word = c end - elseif word and (#word > 1) and find(c,"^[%d%.%_]$") then - if word then word = word .. c else word = c end - else - state = flush_lua_word(state,word) - word = nil - state = change_state(states[c],state) - texwrite(c) - instr = (c == '"') - end - end - end - if p then - texwrite(p) - -- state, i = written(state,p,i) - p = nil - end - state = flush_lua_word(state,word) - if post then - state = change_state(states['--'], state) - texwrite("--") - state = finish_state(state) - for c in utfcharacters(post) do - state, i = written(state,c,i) - end - end - end - if comment then - incomment = true - state = change_state(states['--'], state) - texwrite("[[") - state = finish_state(state) - -- texwrite(comment) -- maybe also split and - for c in utfcharacters(comment) do - state, i = written(state,c,i) - end - end - state = finish_state(state) -end diff --git a/Master/texmf-dist/tex/context/base/pret-mp.lua b/Master/texmf-dist/tex/context/base/pret-mp.lua deleted file mode 100644 index 782adf5f5a2..00000000000 --- a/Master/texmf-dist/tex/context/base/pret-mp.lua +++ /dev/null @@ -1,236 +0,0 @@ -if not modules then modules = { } end modules ['pret-mp'] = { - version = 1.001, - comment = "companion to buff-ver.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local utf = unicode.utf8 - -local utfcharacters, utfvalues = string.utfcharacters, string.utfvalues -local utfbyte, utffind = utf.byte, utf.find -local texsprint, texwrite = tex.sprint, tex.write -local ctxcatcodes = tex.ctxcatcodes - -local visualizer = buffers.newvisualizer("mp") - -visualizer.identifiers = { } - -visualizer.identifiers.primitives = { - 'charcode', 'day', 'linecap', 'linejoin', 'miterlimit', 'month', 'pausing', - 'prologues', 'showstopping', 'time', 'tracingcapsules', 'tracingchoices', - 'tracingcommands', 'tracingequations', 'tracinglostchars', - 'tracingmacros', 'tracingonline', 'tracingoutput', 'tracingrestores', - 'tracingspecs', 'tracingstats', 'tracingtitles', 'truecorners', - 'warningcheck', 'year', 'mpprocset', - 'false', 'nullpicture', 'pencircle', 'true', - 'and', 'angle', 'arclength', 'arctime', 'ASCII', 'bluepart', 'boolean', 'bot', - 'char', 'color', 'cosd', 'cycle', 'decimal', 'directiontime', 'floor', 'fontsize', - 'greenpart', 'hex', 'infont', 'intersectiontimes', 'known', 'length', 'llcorner', - 'lrcorner', 'makepath', 'makepen', 'mexp', 'mlog', 'normaldeviate', 'not', - 'numeric', 'oct', 'odd', 'or', 'path', 'pair', 'pen', 'penoffset', 'picture', 'point', - 'postcontrol', 'precontrol', 'redpart', 'reverse', 'rotated', 'scaled', - 'shifted', 'sind', 'slanted', 'sqrt', 'str', 'string', 'subpath', 'substring', - 'transform', 'transformed', 'ulcorner', 'uniformdeviate', 'unknown', - 'urcorner', 'xpart', 'xscaled', 'xxpart', 'xypart', 'ypart', 'yscaled', 'yxpart', - 'yypart', 'zscaled', - 'addto', 'clip', 'input', 'interim', 'let', 'newinternal', 'save', 'setbounds', - 'shipout', 'show', 'showdependencies', 'showtoken', 'showvariable', - 'special', - 'begingroup', 'endgroup', 'of', 'curl', 'tension', 'and', 'controls', - 'reflectedabout', 'rotatedaround', 'interpath', 'on', 'off', 'beginfig', - 'endfig', 'def', 'vardef', 'enddef', 'epxr', 'suffix', 'text', 'primary', 'secondary', - 'tertiary', 'primarydef', 'secondarydef', 'tertiarydef', 'top', 'bottom', - 'ulft', 'urt', 'llft', 'lrt', 'randomseed', 'also', 'contour', 'doublepath', - 'withcolor', 'withpen', 'dashed', 'if', 'else', 'elseif', 'fi', 'for', 'endfor', 'forever', 'exitif', - 'forsuffixes', 'downto', 'upto', 'step', 'until', - 'charlist', 'extensible', 'fontdimen', 'headerbyte', 'kern', 'ligtable', - 'boundarychar', 'chardp', 'charext', 'charht', 'charic', 'charwd', 'designsize', - 'fontmaking', 'charexists', - 'cullit', 'currenttransform', 'gfcorners', 'grayfont', 'hround', - 'imagerules', 'lowres_fix', 'nodisplays', 'notransforms', 'openit', - 'displaying', 'currentwindow', 'screen_rows', 'screen_cols', - 'pixels_per_inch', 'cull', 'display', 'openwindow', 'numspecial', - 'totalweight', 'autorounding', 'fillin', 'proofing', 'tracingpens', - 'xoffset', 'chardx', 'granularity', 'smoothing', 'turningcheck', 'yoffset', - 'chardy', 'hppp', 'tracingedges', 'vppp', - 'extra_beginfig', 'extra_endfig', 'mpxbreak', - 'end', 'btex', 'etex', 'verbatimtex' -} - -visualizer.identifiers.plain = { - 'ahangle', 'ahlength', 'bboxmargin', 'defaultpen', 'defaultscale', - 'labeloffset', 'background', 'currentpen', 'currentpicture', 'cuttings', - 'defaultfont', 'extra_beginfig', 'extra_endfig', - 'beveled', 'black', 'blue', 'bp', 'butt', 'cc', 'cm', 'dd', 'ditto', 'down', 'epsilon', - 'evenly', 'fullcircle', 'green', 'halfcircle', 'identity', 'in', 'infinity', 'left', - 'mitered', 'mm', 'origin', 'pensquare', 'pt', 'quartercircle', 'red', 'right', - 'rounded', 'squared', 'unitsquare', 'up', 'white', 'withdots', - 'abs', 'bbox', 'ceiling', 'center', 'cutafter', 'cutbefore', 'dir', - 'directionpoint', 'div', 'dotprod', 'intersectionpoint', 'inverse', 'mod', 'lft', - 'round', 'rt', 'unitvector', 'whatever', - 'cutdraw', 'draw', 'drawarrow', 'drawdblarrow', 'fill', 'filldraw', 'drawdot', - 'loggingall', 'pickup', 'tracingall', 'tracingnone', 'undraw', 'unfill', - 'unfilldraw', - 'buildcycle', 'dashpattern', 'decr', 'dotlabel', 'dotlabels', 'drawoptions', - 'incr', 'label', 'labels', 'max', 'min', 'thelabel', 'z', - 'beginchar', 'blacker', 'capsule_end', 'change_width', - 'define_blacker_pixels', 'define_corrected_pixels', - 'define_good_x_pixels', 'define_good_y_pixels', - 'define_horizontal_corrected_pixels', 'define_pixels', - 'define_whole_blacker_pixels', 'define_whole_pixels', - 'define_whole_vertical_blacker_pixels', - 'define_whole_vertical_pixels', 'endchar', 'extra_beginchar', - 'extra_endchar', 'extra_setup', 'font_coding_scheme', - 'font_extra_space' -} - -visualizer.identifiers.metafun = { - 'unitcircle', 'fulldiamond', 'unitdiamond', - 'halfcircle', 'quartercircle', - 'llcircle', 'lrcircle', 'urcircle', 'ulcircle', - 'tcircle', 'bcircle', 'lcircle', 'rcircle', - 'lltriangle', 'lrtriangle', 'urtriangle', 'ultriangle', - 'smoothed', 'cornered', 'superellipsed', 'randomized', 'squeezed', - 'punked', 'curved', 'unspiked', 'simplified', 'blownup', 'stretched', - 'paralled', 'enlonged', 'shortened', - 'enlarged', 'leftenlarged', 'topenlarged', 'rightenlarged', 'bottomenlarged', - 'llenlarged', 'lrenlarged', 'urenlarged', 'ulenlarged', - 'llmoved', 'lrmoved', 'urmoved', 'ulmoved', - 'boundingbox', 'innerboundingbox', 'outerboundingbox', - 'bottomboundary', 'leftboundary', 'topboundary', 'rightboundary', - 'xsized', 'ysized', 'xysized', - 'cmyk', 'transparent', 'withshade', 'spotcolor', - 'drawfill', 'undrawfill', - 'inverted', 'uncolored', 'softened', 'grayed', - 'textext', 'graphictext', - 'loadfigure', 'externalfigure' -} - -visualizer.styles = { - primitives = "", - plain = "\\sl", - metafun = "\\sl", -} - -local styles = visualizer.styles - --- btex .. etex - -local colors = { - "prettyone", - "prettytwo", - "prettythree", - "prettyfour", -} - -local states = { - [';']=1, ['$']=1, ['@']=1, ['#']=1, - ['\\']=2, - ['(']=3, [')']=3, ['[']=3, [']']=3, [':']=3, ['=']=3, ['<']=3, ['>']=3, ['"']=3, - ['-']=4, ['+']=4, ['/']=4, ['*']=4, ['|']=4, ['`']=4, ['!']=4, ['?']=4, ['^']=4, ['&']=4, ['%']=4, - ['%']=4, ['.']=4, [',']=4 -} - -local known_words = { } - -for k,v in next, visualizer.identifiers do - for _,w in next, v do - known_words[w] = k - end -end - -local change_state, finish_state = buffers.change_state, buffers.finish_state - -local function flush_mp_word(state, word, intex) - if word then - if intex then - if word == 'etex' then - state = change_state(2,state) - texwrite(word) - state = finish_state(state) - return state, false - else - texwrite(word) - return state, true - end - else - local id = known_words[word] - if id then - state = change_state(2,state) - if styles[id] then - texsprint(ctxcatcodes,styles[id]) - end - texwrite(word) - state = finish_state(state) - return state, (word == 'btex') or (word == 'verbatimtex') - else - state = finish_state(state) - texwrite(word) - return state, intex - end - end - else - state = finish_state(state) - return state, intex - end -end - --- todo: split string in code and comment, and escape comment fast --- could be generic - --- to be considered: visualizer => table [result, instr, incomment, word] - -function visualizer.flush_line(str,nested) - local state, word, instr, intex, incomment = 0, nil, false, false, false - buffers.currentcolors = colors - for c in utfcharacters(str) do - if c == " " then - state, intex = flush_mp_word(state, word, intex) - word = nil - texsprint(ctxcatcodes,"\\obs") - elseif incomment then - texwrite(c) - elseif c == '%' then - state = change_state(states[c], state) - incomment = true - texwrite(c) - state = finish_state(state) - elseif instr then - if c == '"' then - state = change_state(states[c],state) - instr = false - texwrite(c) - state = finish_state(state) - else - texwrite(c) - end - elseif intex then - if utffind(c,"^[%a]$") then - if word then word = word .. c else word = c end - else - state, intex = flush_mp_word(state, word, intex) - word = nil - if intex then - texwrite(c) - else - state = change_state(states[c], state) - texwrite(c) - end - end - elseif utffind(c,"^[%a]$") then - state = finish_state(state) - if word then word = word .. c else word = c end - else - state, intex = flush_mp_word(state, word, intex) - word = nil - state = change_state(states[c], state) - texwrite(c) - state = finish_state(state) - instr = (c == '"') - end - end - state, intex = flush_mp_word(state, word, intex) - state = finish_state(state) -end diff --git a/Master/texmf-dist/tex/context/base/pret-tex.lua b/Master/texmf-dist/tex/context/base/pret-tex.lua deleted file mode 100644 index 5d128fa3b90..00000000000 --- a/Master/texmf-dist/tex/context/base/pret-tex.lua +++ /dev/null @@ -1,87 +0,0 @@ -if not modules then modules = { } end modules ['pret-tex'] = { - version = 1.001, - comment = "companion to buff-ver.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local utf = unicode.utf8 - -local utfcharacters, utfvalues = string.utfcharacters, string.utfvalues -local utfbyte, utffind = utf.byte, utf.find -local rep = string.rep -local texsprint, texwrite = tex.sprint, tex.write -local ctxcatcodes, vrbcatcodes = tex.ctxcatcodes, tex.vrbcatcodes - -local visualizer = buffers.newvisualizer("tex") - -local colors = { - "prettytwo", - "prettyone", - "prettythree", - "prettyfour" -} - -local states = { - ['$']=2, ['{']=2, ['}']=2, - ['[']=3, [']']=3, ['(']=3, [')']=3, ['<']=3, ['>']=3, ['#']=3, ['=']=3, ['"']=3, - ['/']=4, ['^']=4, ['_']=4, ['-']=4, ['&']=4, ['+']=4, ["'"]=4, ['`']=4, ['|']=4, ['%']=4 -} - --- some day I'll make an lpeg - -local change_state, finish_state = buffers.change_state, buffers.finish_state - -local chardata = characters.data -local is_letter = characters.is_letter - -function visualizer.flush_line(str,nested) - local state, first, i = 0, false, 0 - buffers.currentcolors = colors - for c in utfcharacters(str) do - i = i + 1 - if c == " " then - state = finish_state(state) - texsprint(ctxcatcodes,"\\obs") - first = false - elseif c == "\t" then - state = finish_state(state) - texsprint(ctxcatcodes,"\\obs") - if buffers.visualizers.enabletab then - texsprint(ctxcatcodes,rep("\\obs ",i%buffers.visualizers.tablength)) - i = 0 - end - first = false - elseif first then - state = 1 - texwrite(c) - if not utffind(c,"^[%a%!%?%@]$") then - state = finish_state(state) - end - first = false - elseif state == 1 then - if utffind(c,"^[%a%!%?%@]$") then - texwrite(c) - first = false - elseif c == "\\" then - state = change_state(1, state) - texwrite(c) - first = true - else - state = change_state(states[c], state) - texwrite(c) - first = false - end - elseif c == "\\" then - first = true - state = change_state(1, state) - texwrite(c) - else - state = change_state(states[c], state) - texwrite(c) - first = false - end - end - state = finish_state(state) -end diff --git a/Master/texmf-dist/tex/context/base/pret-xml.lua b/Master/texmf-dist/tex/context/base/pret-xml.lua deleted file mode 100644 index b11dccb99c3..00000000000 --- a/Master/texmf-dist/tex/context/base/pret-xml.lua +++ /dev/null @@ -1,136 +0,0 @@ -if not modules then modules = { } end modules ['pret-xml'] = { - version = 1.001, - comment = "companion to buff-ver.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- line by line, no check because can be snippet (educational) and --- a somewhat simplified view on xml; we forget about dtd's and --- cdata (some day i'll make a visualizer for valid xml using the --- built in parser) - -local utf = unicode.utf8 - -local utfcharacters, utfvalues = string.utfcharacters, string.utfvalues -local utfbyte, utffind = utf.byte, utf.find -local rep = string.rep -local texsprint, texwrite = tex.sprint, tex.write -local ctxcatcodes = tex.ctxcatcodes - -local visualizer = buffers.newvisualizer("xml") - -local colors = { - "prettytwo", - "prettyone", - "prettythree", - "prettyfour" -} - -local states = { - ['"']=2, ["'"]=2, - ["-"]=1, ["?"]=1, ["!"]=1, [":"]=1, ["_"]=1, ["/"]=1, -} - -local change_state, finish_state = buffers.change_state, buffers.finish_state - -local state, intag, dotag, inentity, inquote - -function visualizer.reset() - state, intag, dotag, inentity, inquote = 0, false, false, false, false -end - -function visualizer.flush_line(str,nested) - buffers.currentcolors = colors - for c in utfcharacters(str) do - if c == "&" then - inentity = true -- no further checking - state = change_state(3, state) - texwrite(c) - elseif c == ";" then - if inentity then - inentity = false - state = change_state(3, state) - texwrite(c) - state = finish_state(state) - else - texwrite(c) - end - elseif inentity then - state = change_state(3, state) - texwrite(c) - elseif c == " " then - state = finish_state(state) - texsprint(ctxcatcodes,"\\obs") - intag = false - elseif c == "\t" then - state = finish_state(state) - texsprint(ctxcatcodes,"\\obs") - if buffers.visualizers.enabletab then - texsprint(ctxcatcodes,rep("\\obs ",i%buffers.visualizers.tablength)) - end - intag = false - elseif c == "<" then - if intag then - state = finish_state(state) - -- error - else - intag = 1 - dotag = true - state = change_state(1, state) - end - texwrite(c) - elseif c == ">" then - if intag then - texwrite(c) - state = finish_state(state) - intag, dotag = false, false - elseif dotag then - state = change_state(1, state) - texwrite(c) - state = finish_state(state) - intag, dotag = false, false - else - state = finish_state(state) - texwrite(c) - end - elseif intag then - if utffind(c,"^[%S]$") then - state = change_state(1, state) - texwrite(c) - intag = intag + 1 - else - intag = false - state = finish_state(state) - texwrite(c) - end - elseif dotag then - if c == "'" or c == '"' then - if inquote then - if c == inquote then - state = change_state(states[c], state) -- 2 - texwrite(c) - state = finish_state(state) - inquote = false - else - texwrite(c) - end - else - inquote = c - state = change_state(states[c], state) - texwrite(c) - state = finish_state(state) - end - elseif inquote then - texwrite(c) - else - state = change_state(states[c], state) - texwrite(c) - end - else - texwrite(c) - end - end - state = finish_state(state) -end diff --git a/Master/texmf-dist/tex/context/base/prop-ini.mkiv b/Master/texmf-dist/tex/context/base/prop-ini.mkiv index 97d72582e3f..3cb5d2a6f5a 100644 --- a/Master/texmf-dist/tex/context/base/prop-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/prop-ini.mkiv @@ -13,33 +13,32 @@ \writestatus{loading}{ConTeXt Property Macros / Initialization} -%D Welcome to the third alternative of this yet undocumented module, -%D which means that there is no public interface yet! +%D This module is replaced by dedicated mechanisms. Originally properties were +%D a sort of attributes in \MKII, but now we do things different anyway. We keep +%D a surrogate mechanism around for compatibility reasons but even this will +%D become obsolete some day. \unprotect -\newcount\propertylevel +\def\propertyobsoletemessage + {\writestatus\m!system{properties are obsolete, use dedicated commands}% + \glet\propertyobsoletemessage\donothing} -\def\currentpropertylevel {\csname\??py:l:\currentpropertytype\endcsname} % counter -\def\previouspropertylevel{\csname\??py:p:\currentpropertytype\endcsname} % counter +\setvalue{\??py:d:\v!layer }[#1][#2][#3]{\defineviewerlayer[#1][#3]} +\setvalue{\??py:d:\s!effect }[#1][#2][#3]{\defineeffect [#1][#3]} +\setvalue{\??py:d:\v!negative}[#1][#2][#3]{} -\def\currentproperty {\csname\??py:c:\number\currentpropertylevel \endcsname} % string -\def\previousproperty {\csname\??py:c:\number\previouspropertylevel\endcsname} % string - -% more efficient: - -\def\currentproperty {\csname\??py:c:\number\propertylevel\endcsname} % string -\def\currentpropertytype {\csname\??py\currentproperty\c!type\endcsname} +\unexpanded\def\defineproperty + {\dotripleempty\dodefineproperty} -\def\docheckproperty % watch the s instead of e - {\csname\s!check\currentpropertytype property\endcsname - \global\expandafter\let\csname\??py\s!check\currentproperty\endcsname\empty} +\def\dodefineproperty[#1][#2][#3]% + {\propertyobsoletemessage + \setevalue{\??py#1\c!type}{#2}% + \getvalue{\??py:d:#2}[#1][#2][#3]} -\def\checkproperty[#1]% - {\bgroup - \def\currentproperty{#1}% - \csname\??py\s!check\currentproperty\endcsname - \egroup} +\setvalue{\??py:s:\v!layer }#1{\let\dostopproperty\stopviewerlayer\startviewerlayer[#1]} +\setvalue{\??py:s:\s!effect }#1{\let\dostopproperty\stopeffect \starteffect [#1]} +\setvalue{\??py:s:\v!negative}#1{\let\dostopproperty\stopnegative \startnegative } \unexpanded\def\property[#1]% {\groupedcommand{\dostartproperty{#1}}\dostopproperty} @@ -50,101 +49,12 @@ \unexpanded\def\stopproperty {\dostopproperty} -\def\dostartgproperty - {\begingroup\dostartproperty} - -\def\dostopgproperty - {\dostopproperty\endgroup} - -\def\dostartproperty#1% evt pack: {current}{level}{ - {\global\advance\propertylevel\plusone - \@EAEAEA\xdef\currentproperty{#1}% - \global\advance\previouspropertylevel\plusone - \global\advance\currentpropertylevel\plusone - \csname\??py\s!check\currentproperty\endcsname - \csname\s!start\currentpropertytype\s!property\endcsname} - -\def\dostopproperty - {\csname\s!stop\currentpropertytype\s!property\endcsname - \global\advance\currentpropertylevel\minusone - \global\advance\previouspropertylevel\minusone - \global\advance\propertylevel\minusone} - -\unexpanded\def\defineproperty - {\dotripleempty\dodefineproperty} - -\def\dodefineproperty[#1]% - {\ifcsname\??py#1\c!global\endcsname - \expandafter\nododefineproperty - \else - \expandafter\dododefineproperty - \fi[#1]} - -% due to initializations/counters, definitions are always global -% -% global : yes : ungrouped -% no : grouped -% method : command : define commands -% none : no commands - -\def\dododefineproperty[#1][#2][#3]% global ! ! ! - {\getgparameters[\??py#1][\c!global=\v!no,\c!type=#2,\c!method=\v!none,#3]% global ! ! ! ! - \ifcsname\??py:l:#2\endcsname \else - \expandafter\newcount\csname\??py:l:#2\endcsname % current level - \expandafter\newcount\csname\??py:p:#2\endcsname % previous level - \global\csname\??py:p:#2\endcsname\minusone - \global\expandafter\let\csname\??py:c:0\endcsname\empty - \fi - \letgvalue{\??py\s!check#1}\docheckproperty - \doifelsevalue{\??py#1\c!method}\v!command - {\doifelsevalue{\??py#1\c!global}\v!yes - {\setugvalue{\e!start#1}{\dostartproperty{#1}}% - \setugvalue{\e!stop #1}{\dostopproperty}}% - {\setugvalue{\e!start#1}{\dostartgproperty{#1}}% - \setugvalue{\e!stop #1}{\dostopgproperty}}}% - {\doifelsevalue{\??py#1\c!global}\v!yes - {\setugvalue{\e!start#2}[##1]{\dostartproperty{##1}}% - \setugvalue{\e!stop #2}{\dostopproperty}}% - {\setugvalue{\e!start#2}[##1]{\dostartgproperty{##1}}% - \setugvalue{\e!stop #2}{\dostopgproperty}}}} - -\def\nododefineproperty[#1][#2][#3]% - {} - -\def\doifelseproperty#1{\doifdefinedelse{\??py#1\c!global}} - -\unexpanded\def\setupproperty - {\dodoubleempty\dosetupproperty} - -\def\dosetupproperty[#1][#2]% local - {\ifsecondargument - \getparameters[\??py#1][#2]% - \else - \getparameters[\??py][#1]% - \fi} - -\letvalue{\??py\s!empty}\empty - -% beware, normally \*parameter concerns the current one - -\def\propertyparameter#1#2% expands to #1 when not defined (see \define...) - {\csname\??py - \ifcsname\??py#1#2\endcsname - #1#2% - \else\ifcsname\??py\csname\??py#1\c!type\endcsname#2\endcsname - \csname\??py#1\c!type\endcsname#2% - \else - \s!empty - \fi\fi - \endcsname} - -\def\currentpropertyparameter % self and class - {\propertyparameter\currentproperty} - -\def\checkedpropertyparameter#1% only self - {\ifcsname\??py\currentproperty#1\endcsname\csname\??py\currentproperty#1\endcsname\fi} +\unexpanded\def\dostartproperty#1% + {\pushmacro\dostopproperty + \getvalue{\??py:s:\getvalue{\??py#1\c!type}}{#1}} -\unexpanded\def\definepropertyhandler#1{\setvalue{\??py*#1}} -\def\propertyhandler #1{\getvalue{\??py*#1}} +\unexpanded\def\dostopproperty + {\dostopproperty + \popmacro\dostopproperty} \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/prop-lay.mkiv b/Master/texmf-dist/tex/context/base/prop-lay.mkiv deleted file mode 100644 index 7711dae529a..00000000000 --- a/Master/texmf-dist/tex/context/base/prop-lay.mkiv +++ /dev/null @@ -1,140 +0,0 @@ -%D \module -%D [ file=prop-lay, -%D version=2003.04.20, -%D title=\CONTEXT\ Property Macros, -%D subtitle=Layers, -%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 Property Macros / Layers} - -%D Highly experimental, will probably change/evolve. Also, quite certainly -%D we will no longer share code between mkii and mkiv. - -% test, nesting is somewhat special with layers -% -% \defineproperty[hans][layer] -% \defineproperty[ton] [layer] -% \setupheadertexts[no layer] -% 1\startproperty[hans]2\startproperty[ton]3\stopproperty4\stopproperty5 - -\unprotect - -% will be redone ... no longer using property mechanism (less clashes) - -\let\currentviewerlayer\empty - -\appendtoks - \let\currentviewerlayer\empty -\to \everypagebody - -\unexpanded\def\startlayerproperty - {\pushmacro\currentviewerlayer % grouped (used in interaction) - \let\currentlayerproperty\currentproperty % can be cross group - \dotriggerviewerlayer\currentlayerproperty} - -\unexpanded\def\stoplayerproperty - {\popmacro\currentviewerlayer % grouped (used in interaction) - \let\currentlayerproperty\previousproperty % can be cross group - \dotriggerviewerlayer\currentlayerproperty} - -\def\checklayerproperty % could be made more clever - {\registerviewerlayer\currentproperty\currentproperty - \ctxlua{backends.codeinjections.defineviewerlayer{ - tag = "\currentproperty", - title = "\checkedpropertyparameter\c!title\currentproperty", - visible = "\checkedpropertyparameter\c!state\v!start", - kind = 0, % 1 == frozen - printable = "\checkedpropertyparameter\v!printable\v!yes" % v! looks wrong - }}} - -%D \starttext -%D -%D \setuppapersize[S4][S4] -%D \setuplayout[middle] -%D \setupcolors[state=start] -%D \setupinteraction[state=start,color=,contrastcolor=] -%D -%D \defineproperty [L1] [layer] [title=layer 1] -%D \defineproperty [L2] [layer] [title=layer 2] -%D -%D \button{HIDE L1}[HideLayer{L1}] -%D \button{VIDE L1}[VideLayer{L1}] -%D \button{TOGGLE L1}[ToggleLayer{L1}] -%D -%D \button{HIDE L2}[HideLayer{L2}] -%D \button{VIDE L2}[VideLayer{L2}] -%D \button{TOGGLE L2}[ToggleLayer{L2}] -%D -%D \noheaderandfooterlines \centerbox{\startoverlay -%D {\definedfont[Mono at 150pt]% -%D \startproperty[L1]\red TEST\stopproperty} -%D {\definedfont[Mono at 150pt]% -%D \startproperty[L2]\green TEST\stopproperty} -%D \stopoverlay} \page -%D -%D \noheaderandfooterlines \centerbox{\startoverlay -%D {\definedfont[Mono at 15pt]% -%D \goto{\startproperty[L1]\red TEST\stopproperty}[CloseDocument]} -%D {\definedfont[Mono at 15pt]% -%D \goto{\startproperty[L2]\green TEST\stopproperty}[CloseDocument]} -%D \stopoverlay} \page -%D -%D \startproperty[L1] -%D level 1 \startproperty[L2]level 2 \stopproperty level 1 -%D \stopproperty -%D -%D \startproperty[L1] -%D level 1 \page \startproperty[L2]level 2 \stopproperty level 1 -%D \stopproperty -%D -%D \stoptext - -\def\doinitializelayoutcomponent#1#2% - {\ctxlua{backends.codeinjections.defineviewerlayer{% this will move to the lua end i.e be merged with register - tag = "#1:#2", - title = "#1 #2", - visible = "\v!start", - kind = 0, % 1 == frozen - printable = "\v!yes" - }}% - \edef\layoutcomponentboxattribute{attr \viewerlayerattribute \ctxlua{tex.write(viewerlayers.register('#1:#2',true))}\relax}% - \expandafter\glet\csname\??ly>#1:#2\endcsname\layoutcomponentboxattribute} - -\def\dosetlayoutcomponentattribute#1#2% make this faster - {\expandafter\let\expandafter\layoutcomponentboxattribute\csname\??ly>#1:#2\endcsname - \ifx\layoutcomponentboxattribute\relax - \doinitializelayoutcomponent{#1}{#2}% get rid of { } - \fi} - -\def\doresetlayoutcomponentattribute - {\let\layoutcomponentboxattribute\empty} - -\let\setlayoutcomponentattribute \gobbletwoarguments -\let\resetlayoutcomponentattribute\relax -\let\layoutcomponentboxattribute \empty - -\def\showlayoutcomponents - {\ctxlua{viewerlayers.enable()}% - \let\setlayoutcomponentattribute \dosetlayoutcomponentattribute - \let\resetlayoutcomponentattribute\doresetlayoutcomponentattribute} - -\protect \endinput - -% \starttext -% \showlayoutcomponents -% \setupinteraction[state=start] -% \setupheadertexts[{\goto{page 1}[page(2)]}] -% test \setlayoutcomponentattribute{test}{aap}\hbox \layoutcomponentboxattribute \bgroup aap -% \setlayoutcomponentattribute{test}{noot}\hbox \layoutcomponentboxattribute \bgroup noot -% \setlayoutcomponentattribute{test}{mies}\hbox \layoutcomponentboxattribute \bgroup mies -% \egroup noot \egroup aap \egroup -% test \setlayoutcomponentattribute{test}{hans}\hbox \layoutcomponentboxattribute \bgroup aap \hbox{!} aap\egroup -% test \page test \page -% \stoptext - diff --git a/Master/texmf-dist/tex/context/base/prop-mis.mkiv b/Master/texmf-dist/tex/context/base/prop-mis.mkiv deleted file mode 100644 index 37c1d797396..00000000000 --- a/Master/texmf-dist/tex/context/base/prop-mis.mkiv +++ /dev/null @@ -1,74 +0,0 @@ -%D \module -%D [ file=prop-mis, -%D version=2004.05.29, % some code moved from private modules -%D title=\CONTEXT\ Property Macros, -%D subtitle=Miscelaneous, -%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 Property Macros / Miscelaneous} - -%D This module contains some code that has been in use in some -%D private modules (p-*). These features depend on the fact -%D that pdftex writes the page content as one stream. - -%D EXPERIMENTAL - -\unprotect - -% D Overprint cum suis. -% -% \defineproperty[\v!overprint][\s!overprint] [\c!method=\v!command] -% \defineproperty[\v!knockout] [\s!overprint] [\c!method=\v!command] -% -% \definepropertyhandler \v!overprint {\dotriggeroverprint\v!overprint} -% \definepropertyhandler \v!knockout {\dotriggeroverprint\v!knockout } -% -% \unexpanded\def\startoverprintproperty{\dotriggeroverprint\v!overprint} -% \unexpanded\def\stopoverprintproperty {\dotriggeroverprint\v!knockout } - -%D Negative cum suis. - -\defineproperty [\v!negative] [\s!negative] [\c!method=\v!command] -\defineproperty [\v!positive] [\s!negative] [\c!method=\v!command] - -\definepropertyhandler \v!negative {\dotriggernegative\v!negative} -\definepropertyhandler \v!positive {\dotriggernegative\v!positive} - -\unexpanded\def\startnegativeproperty{\dotriggernegative\v!negative} -\unexpanded\def\stopnegativeproperty {\dotriggernegative\v!positive} - -%D Special font effects. - -\setupproperty - [\s!effect] - [\c!rulethickness=\zeropoint, - \c!stretch=0] - -\defineproperty [\v!inner] [\s!effect] [\c!rulethickness=.25pt] -\defineproperty [\v!outer] [\s!effect] [\c!rulethickness=.25pt] -\defineproperty [\v!both] [\s!effect] [\c!rulethickness=.25pt] -\defineproperty [\v!normal] [\s!effect] -\defineproperty [\v!hidden] [\s!effect] - -\defineproperty [\v!stretch] [\s!effect] [\c!stretch=1] - -\def\mktriggereffect#1% - {\dotriggereffect{#1}{\propertyparameter{#1}\c!stretch}{\propertyparameter{#1}\c!rulethickness}} - -\definepropertyhandler \v!normal {\mktriggereffect\v!normal} -\definepropertyhandler \v!inner {\mktriggereffect\v!inner } -\definepropertyhandler \v!outer {\mktriggereffect\v!outer } -\definepropertyhandler \v!both {\mktriggereffect\v!both } -\definepropertyhandler \v!hidden {\mktriggereffect\v!hidden} -\definepropertyhandler \v!stretch{\mktriggereffect\v!normal} - -\unexpanded\def\starteffectproperty{\mktriggereffect\currentproperty} -\unexpanded\def\stopeffectproperty {\mktriggereffect\v!normal } - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/regi-8859-1.lua b/Master/texmf-dist/tex/context/base/regi-8859-1.lua index b8f0a857311..ff2182afa2c 100644 --- a/Master/texmf-dist/tex/context/base/regi-8859-1.lua +++ b/Master/texmf-dist/tex/context/base/regi-8859-1.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-8859-1'] = { license = "see context related readme files" } -regimes.data["8859-1"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, + 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF } diff --git a/Master/texmf-dist/tex/context/base/regi-8859-10.lua b/Master/texmf-dist/tex/context/base/regi-8859-10.lua index 574d4ac50cc..f23744b4a24 100644 --- a/Master/texmf-dist/tex/context/base/regi-8859-10.lua +++ b/Master/texmf-dist/tex/context/base/regi-8859-10.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-8859-10'] = { license = "see context related readme files" } -regimes.data["8859-10"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0104, 0x0112, 0x0122, 0x012A, 0x0128, 0x0136, 0x00A7, 0x013B, 0x0110, 0x0160, 0x0166, 0x017D, 0x00AD, 0x016A, 0x014A, - 0x00B0, 0x0105, 0x0113, 0x0123, 0x012B, 0x0129, 0x0137, 0x00B7, 0x013C, 0x0111, 0x0161, 0x0167, 0x017E, 0x2015, 0x016B, 0x014B, - 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x00CF, - 0x00D0, 0x0145, 0x014C, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x0168, 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, - 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x00EF, - 0x00F0, 0x0146, 0x014D, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x0169, 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x0138 +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x0104, 0x0112, 0x0122, 0x012A, 0x0128, 0x0136, 0x00A7, 0x013B, 0x0110, 0x0160, 0x0166, 0x017D, 0x00AD, 0x016A, 0x014A, + 0x00B0, 0x0105, 0x0113, 0x0123, 0x012B, 0x0129, 0x0137, 0x00B7, 0x013C, 0x0111, 0x0161, 0x0167, 0x017E, 0x2015, 0x016B, 0x014B, + 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x00CF, + 0x00D0, 0x0145, 0x014C, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x0168, 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, + 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x00EF, + 0x00F0, 0x0146, 0x014D, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x0169, 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x0138 } diff --git a/Master/texmf-dist/tex/context/base/regi-8859-11.lua b/Master/texmf-dist/tex/context/base/regi-8859-11.lua index 1910bbb5d0a..54e5626c28f 100644 --- a/Master/texmf-dist/tex/context/base/regi-8859-11.lua +++ b/Master/texmf-dist/tex/context/base/regi-8859-11.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-8859-11'] = { license = "see context related readme files" } -regimes.data["8859-11"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07, 0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F, - 0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17, 0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F, - 0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27, 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F, - 0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37, 0x0E38, 0x0E39, 0x0E3A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0E3F, - 0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47, 0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F, - 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0x0000, 0x0000, 0x0000, 0x0000 +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07, 0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F, + 0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17, 0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F, + 0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27, 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F, + 0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37, 0x0E38, 0x0E39, 0x0E3A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0E3F, + 0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47, 0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F, + 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0x0000, 0x0000, 0x0000, 0x0000 } diff --git a/Master/texmf-dist/tex/context/base/regi-8859-13.lua b/Master/texmf-dist/tex/context/base/regi-8859-13.lua index a6f71cb7865..1646133b5ae 100644 --- a/Master/texmf-dist/tex/context/base/regi-8859-13.lua +++ b/Master/texmf-dist/tex/context/base/regi-8859-13.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-8859-13'] = { license = "see context related readme files" } -regimes.data["8859-13"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x201D, 0x00A2, 0x00A3, 0x00A4, 0x201E, 0x00A6, 0x00A7, 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x201C, 0x00B5, 0x00B6, 0x00B7, 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6, - 0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B, - 0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF, - 0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, - 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x2019 +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x201D, 0x00A2, 0x00A3, 0x00A4, 0x201E, 0x00A6, 0x00A7, 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x201C, 0x00B5, 0x00B6, 0x00B7, 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6, + 0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B, + 0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF, + 0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, + 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x2019 } diff --git a/Master/texmf-dist/tex/context/base/regi-8859-14.lua b/Master/texmf-dist/tex/context/base/regi-8859-14.lua index 0c34748659b..2b0c6881445 100644 --- a/Master/texmf-dist/tex/context/base/regi-8859-14.lua +++ b/Master/texmf-dist/tex/context/base/regi-8859-14.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-8859-14'] = { license = "see context related readme files" } -regimes.data["8859-14"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x1E02, 0x1E03, 0x00A3, 0x010A, 0x010B, 0x1E0A, 0x00A7, 0x1E80, 0x00A9, 0x1E82, 0x1E0B, 0x1EF2, 0x00AD, 0x00AE, 0x0178, - 0x1E1E, 0x1E1F, 0x0120, 0x0121, 0x1E40, 0x1E41, 0x00B6, 0x1E56, 0x1E81, 0x1E57, 0x1E83, 0x1E60, 0x1EF3, 0x1E84, 0x1E85, 0x1E61, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x0174, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x1E6A, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x0176, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x0175, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x1E6B, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x0177, 0x00FF +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x1E02, 0x1E03, 0x00A3, 0x010A, 0x010B, 0x1E0A, 0x00A7, 0x1E80, 0x00A9, 0x1E82, 0x1E0B, 0x1EF2, 0x00AD, 0x00AE, 0x0178, + 0x1E1E, 0x1E1F, 0x0120, 0x0121, 0x1E40, 0x1E41, 0x00B6, 0x1E56, 0x1E81, 0x1E57, 0x1E83, 0x1E60, 0x1EF3, 0x1E84, 0x1E85, 0x1E61, + 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x0174, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x1E6A, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x0176, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x0175, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x1E6B, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x0177, 0x00FF } diff --git a/Master/texmf-dist/tex/context/base/regi-8859-15.lua b/Master/texmf-dist/tex/context/base/regi-8859-15.lua index a5626d6537b..48861f39690 100644 --- a/Master/texmf-dist/tex/context/base/regi-8859-15.lua +++ b/Master/texmf-dist/tex/context/base/regi-8859-15.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-8859-15'] = { license = "see context related readme files" } -regimes.data["8859-15"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AC, 0x00A5, 0x0160, 0x00A7, 0x0161, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x017D, 0x00B5, 0x00B6, 0x00B7, 0x017E, 0x00B9, 0x00BA, 0x00BB, 0x0152, 0x0153, 0x0178, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AC, 0x00A5, 0x0160, 0x00A7, 0x0161, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x017D, 0x00B5, 0x00B6, 0x00B7, 0x017E, 0x00B9, 0x00BA, 0x00BB, 0x0152, 0x0153, 0x0178, 0x00BF, + 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF } diff --git a/Master/texmf-dist/tex/context/base/regi-8859-16.lua b/Master/texmf-dist/tex/context/base/regi-8859-16.lua index 817b41db2f1..e122a2042a4 100644 --- a/Master/texmf-dist/tex/context/base/regi-8859-16.lua +++ b/Master/texmf-dist/tex/context/base/regi-8859-16.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-8859-16'] = { license = "see context related readme files" } -regimes.data["8859-16"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0104, 0x0105, 0x0141, 0x20AC, 0x201E, 0x0160, 0x00A7, 0x0161, 0x00A9, 0x0218, 0x00AB, 0x0179, 0x00AD, 0x017A, 0x017B, - 0x00B0, 0x00B1, 0x010C, 0x0142, 0x017D, 0x201D, 0x00B6, 0x00B7, 0x017E, 0x010D, 0x0219, 0x00BB, 0x0152, 0x0153, 0x0178, 0x017C, - 0x00C0, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0106, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x0110, 0x0143, 0x00D2, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x015A, 0x0170, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0118, 0x021A, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x0107, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x0111, 0x0144, 0x00F2, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x015B, 0x0171, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0119, 0x021B, 0x00FF +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x0104, 0x0105, 0x0141, 0x20AC, 0x201E, 0x0160, 0x00A7, 0x0161, 0x00A9, 0x0218, 0x00AB, 0x0179, 0x00AD, 0x017A, 0x017B, + 0x00B0, 0x00B1, 0x010C, 0x0142, 0x017D, 0x201D, 0x00B6, 0x00B7, 0x017E, 0x010D, 0x0219, 0x00BB, 0x0152, 0x0153, 0x0178, 0x017C, + 0x00C0, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0106, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x0110, 0x0143, 0x00D2, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x015A, 0x0170, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0118, 0x021A, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x0107, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x0111, 0x0144, 0x00F2, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x015B, 0x0171, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0119, 0x021B, 0x00FF } diff --git a/Master/texmf-dist/tex/context/base/regi-8859-2.lua b/Master/texmf-dist/tex/context/base/regi-8859-2.lua index 7ae59d0fa22..affd6c3ca20 100644 --- a/Master/texmf-dist/tex/context/base/regi-8859-2.lua +++ b/Master/texmf-dist/tex/context/base/regi-8859-2.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-8859-2'] = { license = "see context related readme files" } -regimes.data["8859-2"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, 0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B, - 0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7, 0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C, - 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, - 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, - 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, - 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9 +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, 0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B, + 0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7, 0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C, + 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, + 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, + 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, + 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9 } diff --git a/Master/texmf-dist/tex/context/base/regi-8859-3.lua b/Master/texmf-dist/tex/context/base/regi-8859-3.lua index a83d63bac72..4b5c54b4fbb 100644 --- a/Master/texmf-dist/tex/context/base/regi-8859-3.lua +++ b/Master/texmf-dist/tex/context/base/regi-8859-3.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-8859-3'] = { license = "see context related readme files" } -regimes.data["8859-3"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0126, 0x02D8, 0x00A3, 0x00A4, 0x0000, 0x0124, 0x00A7, 0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, 0x0000, 0x017B, - 0x00B0, 0x0127, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0125, 0x00B7, 0x00B8, 0x0131, 0x015F, 0x011F, 0x0135, 0x00BD, 0x0000, 0x017C, - 0x00C0, 0x00C1, 0x00C2, 0x0000, 0x00C4, 0x010A, 0x0108, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x0000, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x0120, 0x00D6, 0x00D7, 0x011C, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x016C, 0x015C, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x0000, 0x00E4, 0x010B, 0x0109, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x0000, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0121, 0x00F6, 0x00F7, 0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9 +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x0126, 0x02D8, 0x00A3, 0x00A4, 0x0000, 0x0124, 0x00A7, 0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, 0x0000, 0x017B, + 0x00B0, 0x0127, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0125, 0x00B7, 0x00B8, 0x0131, 0x015F, 0x011F, 0x0135, 0x00BD, 0x0000, 0x017C, + 0x00C0, 0x00C1, 0x00C2, 0x0000, 0x00C4, 0x010A, 0x0108, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x0000, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x0120, 0x00D6, 0x00D7, 0x011C, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x016C, 0x015C, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x0000, 0x00E4, 0x010B, 0x0109, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x0000, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0121, 0x00F6, 0x00F7, 0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9 } diff --git a/Master/texmf-dist/tex/context/base/regi-8859-4.lua b/Master/texmf-dist/tex/context/base/regi-8859-4.lua index 939d55026f9..774ec2e1056 100644 --- a/Master/texmf-dist/tex/context/base/regi-8859-4.lua +++ b/Master/texmf-dist/tex/context/base/regi-8859-4.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-8859-4'] = { license = "see context related readme files" } -regimes.data["8859-4"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0104, 0x0138, 0x0156, 0x00A4, 0x0128, 0x013B, 0x00A7, 0x00A8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00AD, 0x017D, 0x00AF, - 0x00B0, 0x0105, 0x02DB, 0x0157, 0x00B4, 0x0129, 0x013C, 0x02C7, 0x00B8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014A, 0x017E, 0x014B, - 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x012A, - 0x0110, 0x0145, 0x014C, 0x0136, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x0168, 0x016A, 0x00DF, - 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x012B, - 0x0111, 0x0146, 0x014D, 0x0137, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x0169, 0x016B, 0x02D9 +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x0104, 0x0138, 0x0156, 0x00A4, 0x0128, 0x013B, 0x00A7, 0x00A8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00AD, 0x017D, 0x00AF, + 0x00B0, 0x0105, 0x02DB, 0x0157, 0x00B4, 0x0129, 0x013C, 0x02C7, 0x00B8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014A, 0x017E, 0x014B, + 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x012A, + 0x0110, 0x0145, 0x014C, 0x0136, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x0168, 0x016A, 0x00DF, + 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x012B, + 0x0111, 0x0146, 0x014D, 0x0137, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x0169, 0x016B, 0x02D9 } diff --git a/Master/texmf-dist/tex/context/base/regi-8859-5.lua b/Master/texmf-dist/tex/context/base/regi-8859-5.lua index ab093d139a8..1137f37bb2e 100644 --- a/Master/texmf-dist/tex/context/base/regi-8859-5.lua +++ b/Master/texmf-dist/tex/context/base/regi-8859-5.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-8859-5'] = { license = "see context related readme files" } -regimes.data["8859-5"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00AD, 0x040E, 0x040F, - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, - 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00A7, 0x045E, 0x045F +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00AD, 0x040E, 0x040F, + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, + 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00A7, 0x045E, 0x045F } diff --git a/Master/texmf-dist/tex/context/base/regi-8859-6.lua b/Master/texmf-dist/tex/context/base/regi-8859-6.lua index e094129f271..651ae79ffe6 100644 --- a/Master/texmf-dist/tex/context/base/regi-8859-6.lua +++ b/Master/texmf-dist/tex/context/base/regi-8859-6.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-8859-6'] = { license = "see context related readme files" } -regimes.data["8859-6"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0000, 0x0000, 0x0000, 0x00A4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x060C, 0x00AD, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x061B, 0x0000, 0x0000, 0x0000, 0x061F, - 0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, - 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, 0x0638, 0x0639, 0x063A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, 0x0648, 0x0649, 0x064A, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F, - 0x0650, 0x0651, 0x0652, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x0000, 0x0000, 0x0000, 0x00A4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x060C, 0x00AD, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x061B, 0x0000, 0x0000, 0x0000, 0x061F, + 0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, + 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, 0x0638, 0x0639, 0x063A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, 0x0648, 0x0649, 0x064A, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F, + 0x0650, 0x0651, 0x0652, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 } diff --git a/Master/texmf-dist/tex/context/base/regi-8859-7.lua b/Master/texmf-dist/tex/context/base/regi-8859-7.lua index cee253582f4..08cbbab6edf 100644 --- a/Master/texmf-dist/tex/context/base/regi-8859-7.lua +++ b/Master/texmf-dist/tex/context/base/regi-8859-7.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-8859-7'] = { license = "see context related readme files" } -regimes.data["8859-7"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x2018, 0x2019, 0x00A3, 0x20AC, 0x20AF, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x037A, 0x00AB, 0x00AC, 0x00AD, 0x0000, 0x2015, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x0385, 0x0386, 0x00B7, 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F, - 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, - 0x03A0, 0x03A1, 0x0000, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, - 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, - 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0x0000 +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x2018, 0x2019, 0x00A3, 0x20AC, 0x20AF, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x037A, 0x00AB, 0x00AC, 0x00AD, 0x0000, 0x2015, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x0385, 0x0386, 0x00B7, 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F, + 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, + 0x03A0, 0x03A1, 0x0000, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, + 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, + 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0x0000 } diff --git a/Master/texmf-dist/tex/context/base/regi-8859-8.lua b/Master/texmf-dist/tex/context/base/regi-8859-8.lua index 062b080adf1..b6960999174 100644 --- a/Master/texmf-dist/tex/context/base/regi-8859-8.lua +++ b/Master/texmf-dist/tex/context/base/regi-8859-8.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-8859-8'] = { license = "see context related readme files" } -regimes.data["8859-8"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0000, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2017, - 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, - 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, 0x05E8, 0x05E9, 0x05EA, 0x0000, 0x0000, 0x200E, 0x200F, 0x0000 +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x0000, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2017, + 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, + 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, 0x05E8, 0x05E9, 0x05EA, 0x0000, 0x0000, 0x200E, 0x200F, 0x0000 } diff --git a/Master/texmf-dist/tex/context/base/regi-8859-9.lua b/Master/texmf-dist/tex/context/base/regi-8859-9.lua index 2af118a8c87..773307fff09 100644 --- a/Master/texmf-dist/tex/context/base/regi-8859-9.lua +++ b/Master/texmf-dist/tex/context/base/regi-8859-9.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-8859-9'] = { license = "see context related readme files" } -regimes.data["8859-9"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, + 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF } diff --git a/Master/texmf-dist/tex/context/base/regi-cp1250.lua b/Master/texmf-dist/tex/context/base/regi-cp1250.lua index a37ca46b4fe..00d55d1b83f 100644 --- a/Master/texmf-dist/tex/context/base/regi-cp1250.lua +++ b/Master/texmf-dist/tex/context/base/regi-cp1250.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-cp1250'] = { license = "see context related readme files" } -regimes.data["cp1250"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x20AC, 0x0000, 0x201A, 0x0000, 0x201E, 0x2026, 0x2020, 0x2021, 0x0000, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179, - 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0161, 0x203A, 0x015B, 0x0165, 0x017E, 0x017A, - 0x00A0, 0x02C7, 0x02D8, 0x0141, 0x00A4, 0x0104, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x015E, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x017B, - 0x00B0, 0x00B1, 0x02DB, 0x0142, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x0105, 0x015F, 0x00BB, 0x013D, 0x02DD, 0x013E, 0x017C, - 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, - 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, - 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, - 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9 +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x20AC, 0x0000, 0x201A, 0x0000, 0x201E, 0x2026, 0x2020, 0x2021, 0x0000, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179, + 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0161, 0x203A, 0x015B, 0x0165, 0x017E, 0x017A, + 0x00A0, 0x02C7, 0x02D8, 0x0141, 0x00A4, 0x0104, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x015E, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x017B, + 0x00B0, 0x00B1, 0x02DB, 0x0142, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x0105, 0x015F, 0x00BB, 0x013D, 0x02DD, 0x013E, 0x017C, + 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, + 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, + 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, + 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9 } diff --git a/Master/texmf-dist/tex/context/base/regi-cp1251.lua b/Master/texmf-dist/tex/context/base/regi-cp1251.lua index 42fe0b34092..7bb72e0ccab 100644 --- a/Master/texmf-dist/tex/context/base/regi-cp1251.lua +++ b/Master/texmf-dist/tex/context/base/regi-cp1251.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-cp1251'] = { license = "see context related readme files" } -regimes.data["cp1251"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, 0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, - 0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F, - 0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7, 0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407, - 0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7, 0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457, - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, 0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, + 0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F, + 0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7, 0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407, + 0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7, 0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457, + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F } diff --git a/Master/texmf-dist/tex/context/base/regi-cp1252.lua b/Master/texmf-dist/tex/context/base/regi-cp1252.lua index 74b2f3761c8..86954c9af36 100644 --- a/Master/texmf-dist/tex/context/base/regi-cp1252.lua +++ b/Master/texmf-dist/tex/context/base/regi-cp1252.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-cp1252'] = { license = "see context related readme files" } -regimes.data["cp1252"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0000, 0x017D, 0x0000, - 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x0000, 0x017E, 0x0178, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0000, 0x017D, 0x0000, + 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x0000, 0x017E, 0x0178, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, + 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF } diff --git a/Master/texmf-dist/tex/context/base/regi-cp1253.lua b/Master/texmf-dist/tex/context/base/regi-cp1253.lua index f14a186bb94..31a411efeec 100644 --- a/Master/texmf-dist/tex/context/base/regi-cp1253.lua +++ b/Master/texmf-dist/tex/context/base/regi-cp1253.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-cp1253'] = { license = "see context related readme files" } -regimes.data["cp1253"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x0000, 0x2030, 0x0000, 0x2039, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0000, 0x203A, 0x0000, 0x0000, 0x0000, 0x0000, - 0x00A0, 0x0385, 0x0386, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x0000, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x2015, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x00B5, 0x00B6, 0x00B7, 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F, - 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, - 0x03A0, 0x03A1, 0x0000, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, - 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, - 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0x0000 +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x0000, 0x2030, 0x0000, 0x2039, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0000, 0x203A, 0x0000, 0x0000, 0x0000, 0x0000, + 0x00A0, 0x0385, 0x0386, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x0000, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x2015, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x00B5, 0x00B6, 0x00B7, 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F, + 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, + 0x03A0, 0x03A1, 0x0000, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, + 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, + 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0x0000 } diff --git a/Master/texmf-dist/tex/context/base/regi-cp1254.lua b/Master/texmf-dist/tex/context/base/regi-cp1254.lua index 76fbe9c49f2..73b9927c6ca 100644 --- a/Master/texmf-dist/tex/context/base/regi-cp1254.lua +++ b/Master/texmf-dist/tex/context/base/regi-cp1254.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-cp1254'] = { license = "see context related readme files" } -regimes.data["cp1254"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0000, 0x0000, 0x0000, - 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x0000, 0x0000, 0x0178, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0000, 0x0000, 0x0000, + 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x0000, 0x0000, 0x0178, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, + 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF } diff --git a/Master/texmf-dist/tex/context/base/regi-cp1255.lua b/Master/texmf-dist/tex/context/base/regi-cp1255.lua index 9ea807fbdfb..2abb16b54e7 100644 --- a/Master/texmf-dist/tex/context/base/regi-cp1255.lua +++ b/Master/texmf-dist/tex/context/base/regi-cp1255.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-cp1255'] = { license = "see context related readme files" } -regimes.data["cp1255"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0000, 0x2039, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0000, 0x203A, 0x0000, 0x0000, 0x0000, 0x0000, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AA, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x05B0, 0x05B1, 0x05B2, 0x05B3, 0x05B4, 0x05B5, 0x05B6, 0x05B7, 0x05B8, 0x05B9, 0x0000, 0x05BB, 0x05BC, 0x05BD, 0x05BE, 0x05BF, - 0x05C0, 0x05C1, 0x05C2, 0x05C3, 0x05F0, 0x05F1, 0x05F2, 0x05F3, 0x05F4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, - 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, 0x05E8, 0x05E9, 0x05EA, 0x0000, 0x0000, 0x200E, 0x200F, 0x0000 +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0000, 0x2039, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0000, 0x203A, 0x0000, 0x0000, 0x0000, 0x0000, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AA, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, + 0x05B0, 0x05B1, 0x05B2, 0x05B3, 0x05B4, 0x05B5, 0x05B6, 0x05B7, 0x05B8, 0x05B9, 0x0000, 0x05BB, 0x05BC, 0x05BD, 0x05BE, 0x05BF, + 0x05C0, 0x05C1, 0x05C2, 0x05C3, 0x05F0, 0x05F1, 0x05F2, 0x05F3, 0x05F4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, + 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, 0x05E8, 0x05E9, 0x05EA, 0x0000, 0x0000, 0x200E, 0x200F, 0x0000 } diff --git a/Master/texmf-dist/tex/context/base/regi-cp1256.lua b/Master/texmf-dist/tex/context/base/regi-cp1256.lua index e77525bcf83..a0697c321c4 100644 --- a/Master/texmf-dist/tex/context/base/regi-cp1256.lua +++ b/Master/texmf-dist/tex/context/base/regi-cp1256.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-cp1256'] = { license = "see context related readme files" } -regimes.data["cp1256"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, - 0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x06A9, 0x2122, 0x0691, 0x203A, 0x0153, 0x200C, 0x200D, 0x06BA, - 0x00A0, 0x060C, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x06BE, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x061B, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x061F, - 0x06C1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, - 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00D7, 0x0637, 0x0638, 0x0639, 0x063A, 0x0640, 0x0641, 0x0642, 0x0643, - 0x00E0, 0x0644, 0x00E2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF, - 0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7, 0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2 +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, + 0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x06A9, 0x2122, 0x0691, 0x203A, 0x0153, 0x200C, 0x200D, 0x06BA, + 0x00A0, 0x060C, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x06BE, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x061B, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x061F, + 0x06C1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, + 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00D7, 0x0637, 0x0638, 0x0639, 0x063A, 0x0640, 0x0641, 0x0642, 0x0643, + 0x00E0, 0x0644, 0x00E2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF, + 0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7, 0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2 } diff --git a/Master/texmf-dist/tex/context/base/regi-cp1257.lua b/Master/texmf-dist/tex/context/base/regi-cp1257.lua index 1b5d5337989..6e39c10d4bb 100644 --- a/Master/texmf-dist/tex/context/base/regi-cp1257.lua +++ b/Master/texmf-dist/tex/context/base/regi-cp1257.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-cp1257'] = { license = "see context related readme files" } -regimes.data["cp1257"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x20AC, 0x0000, 0x201A, 0x0000, 0x201E, 0x2026, 0x2020, 0x2021, 0x0000, 0x2030, 0x0000, 0x2039, 0x0000, 0x00A8, 0x02C7, 0x00B8, - 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0000, 0x203A, 0x0000, 0x00AF, 0x02DB, 0x0000, - 0x00A0, 0x0000, 0x00A2, 0x00A3, 0x00A4, 0x0000, 0x00A6, 0x00A7, 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6, - 0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B, - 0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF, - 0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, - 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9 +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x20AC, 0x0000, 0x201A, 0x0000, 0x201E, 0x2026, 0x2020, 0x2021, 0x0000, 0x2030, 0x0000, 0x2039, 0x0000, 0x00A8, 0x02C7, 0x00B8, + 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0000, 0x203A, 0x0000, 0x00AF, 0x02DB, 0x0000, + 0x00A0, 0x0000, 0x00A2, 0x00A3, 0x00A4, 0x0000, 0x00A6, 0x00A7, 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6, + 0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B, + 0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF, + 0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, + 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9 } diff --git a/Master/texmf-dist/tex/context/base/regi-cp1258.lua b/Master/texmf-dist/tex/context/base/regi-cp1258.lua index 271db30096e..cf64d2ab629 100644 --- a/Master/texmf-dist/tex/context/base/regi-cp1258.lua +++ b/Master/texmf-dist/tex/context/base/regi-cp1258.lua @@ -6,21 +6,21 @@ if not modules then modules = { } end modules ['regi-cp1258'] = { license = "see context related readme files" } -regimes.data["cp1258"] = { [0] = - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0000, 0x2039, 0x0152, 0x0000, 0x0000, 0x0000, - 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0000, 0x203A, 0x0153, 0x0000, 0x0000, 0x0178, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x0300, 0x00CD, 0x00CE, 0x00CF, - 0x0110, 0x00D1, 0x0309, 0x00D3, 0x00D4, 0x01A0, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x01AF, 0x0303, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0301, 0x00ED, 0x00EE, 0x00EF, - 0x0111, 0x00F1, 0x0323, 0x00F3, 0x00F4, 0x01A1, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x01B0, 0x20AB, 0x00FF +return { [0] = + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, + 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0000, 0x2039, 0x0152, 0x0000, 0x0000, 0x0000, + 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0000, 0x203A, 0x0153, 0x0000, 0x0000, 0x0178, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, + 0x00C0, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x0300, 0x00CD, 0x00CE, 0x00CF, + 0x0110, 0x00D1, 0x0309, 0x00D3, 0x00D4, 0x01A0, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x01AF, 0x0303, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0301, 0x00ED, 0x00EE, 0x00EF, + 0x0111, 0x00F1, 0x0323, 0x00F3, 0x00F4, 0x01A1, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x01B0, 0x20AB, 0x00FF } diff --git a/Master/texmf-dist/tex/context/base/regi-demo.lua b/Master/texmf-dist/tex/context/base/regi-demo.lua new file mode 100644 index 00000000000..689f44e32c5 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/regi-demo.lua @@ -0,0 +1,22 @@ +if not modules then modules = { } end modules ['regi-demo'] = { + version = 1.001, + comment = "companion to regi-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- digits -> * + +return { + [0x0030] = 0x002A, + [0x0031] = 0x002A, + [0x0032] = 0x002A, + [0x0033] = 0x002A, + [0x0034] = 0x002A, + [0x0035] = 0x002A, + [0x0036] = 0x002A, + [0x0037] = 0x002A, + [0x0038] = 0x002A, + [0x0039] = 0x002A, +} diff --git a/Master/texmf-dist/tex/context/base/regi-ini.lua b/Master/texmf-dist/tex/context/base/regi-ini.lua index 83739760758..a440b65771a 100644 --- a/Master/texmf-dist/tex/context/base/regi-ini.lua +++ b/Master/texmf-dist/tex/context/base/regi-ini.lua @@ -6,83 +6,217 @@ if not modules then modules = { } end modules ['regi-ini'] = { license = "see context related readme files" } -local utf = unicode.utf8 -local char, utfchar, gsub = string.char, utf.char, string.gsub -local texsprint = tex.sprint - -local ctxcatcodes = tex.ctxcatcodes - --[[ldx--

Regimes take care of converting the input characters into sequences. The conversion tables are loaded at runtime.

--ldx]]-- -regimes = regimes or { } -regimes.data = regimes.data or { } -regimes.utf = regimes.utf or { } -regimes.synonyms = regimes.synonyms or { } - -storage.register("regimes/synonyms", regimes.synonyms, "regimes.synonyms") +local utfchar = utf.char +local char, gsub, format = string.char, string.gsub, string.format +local next = next +local insert, remove = table.insert, table.remove --- setmetatable(regimes.data,_empty_table_) - -regimes.currentregime = "utf" +local sequencers = utilities.sequencers +local textlineactions = resolvers.openers.helpers.textlineactions +local setmetatableindex = table.setmetatableindex --[[ldx--

We will hook regime handling code into the input methods.

--ldx]]-- -function regimes.number(n) - if type(n) == "string" then return tonumber(n,16) else return n end +local trace_translating = false trackers.register("regimes.translating", function(v) trace_translating = v end) + +local report_loading = logs.reporter("regimes","loading") +local report_translating = logs.reporter("regimes","translating") + +regimes = regimes or { } +local regimes = regimes + +local mapping = { + utf = false +} + +local synonyms = { -- backward compatibility list + + ["windows-1250"] = "cp1250", + ["windows-1251"] = "cp1251", + ["windows-1252"] = "cp1252", + ["windows-1253"] = "cp1253", + ["windows-1254"] = "cp1254", + ["windows-1255"] = "cp1255", + ["windows-1256"] = "cp1256", + ["windows-1257"] = "cp1257", + ["windows-1258"] = "cp1258", + + ["il1"] = "8859-1", + ["il2"] = "8859-2", + ["il3"] = "8859-3", + ["il4"] = "8859-4", + ["il5"] = "8859-9", + ["il6"] = "8859-10", + ["il7"] = "8859-13", + ["il8"] = "8859-14", + ["il9"] = "8859-15", + ["il10"] = "8859-16", + + ["iso-8859-1"] = "8859-1", + ["iso-8859-2"] = "8859-2", + ["iso-8859-3"] = "8859-3", + ["iso-8859-4"] = "8859-4", + ["iso-8859-9"] = "8859-9", + ["iso-8859-10"] = "8859-10", + ["iso-8859-13"] = "8859-13", + ["iso-8859-14"] = "8859-14", + ["iso-8859-15"] = "8859-15", + ["iso-8859-16"] = "8859-16", + + ["latin1"] = "8859-1", + ["latin2"] = "8859-2", + ["latin3"] = "8859-3", + ["latin4"] = "8859-4", + ["latin5"] = "8859-9", + ["latin6"] = "8859-10", + ["latin7"] = "8859-13", + ["latin8"] = "8859-14", + ["latin9"] = "8859-15", + ["latin10"] = "8859-16", + + ["utf-8"] = "utf", + ["utf8"] = "utf", + [""] = "utf", + + ["windows"] = "cp1252", + +} + +local currentregime = "utf" + +local function loadregime(mapping,regime) + local name = resolvers.findfile(format("regi-%s.lua",regime)) or "" + local data = name ~= "" and dofile(name) + if data then + vector = { } + for eightbit, unicode in next, data do + vector[char(eightbit)] = utfchar(unicode) + end + report_loading("vector '%s' is loaded",regime) + else + vector = false + report_loading("vector '%s' is unknown",regime) + end + mapping[regime] = vector + return vector end -function regimes.setsynonym(synonym,target) - regimes.synonyms[synonym] = target +setmetatableindex(mapping, loadregime) + +local function translate(line,regime) + if line and #line > 0 then + local map = mapping[regime and synonyms[regime] or regime or currentregime] + if map then + line = gsub(line,".",map) + end + end + return line +end + +local function disable() + currentregime = "utf" + sequencers.disableaction(textlineactions,"regimes.process") end -function regimes.truename(regime) - texsprint(ctxcatcodes,(regime and regimes.synonyms[synonym] or regime) or regimes.currentregime) +local function enable(regime) + regime = synonyms[regime] or regime + if mapping[regime] == false then + disable() + else + currentregime = regime + sequencers.enableaction(textlineactions,"regimes.process") + end end -function regimes.load(regime) - regime = regimes.synonyms[regime] or regime - if not regimes.data[regime] then - environment.loadluafile("regi-"..regime, 1.001) - if regimes.data[regime] then - regimes.utf[regime] = { } - for k,v in next, regimes.data[regime] do - regimes.utf[regime][char(k)] = utfchar(v) - end +regimes.translate = translate +regimes.enable = enable +regimes.disable = disable + +-- The following function can be used when we want to make sure that +-- utf gets passed unharmed. This is needed for modules. + +local level = 0 + +function regimes.process(str) + if level == 0 then + str = translate(str,currentregime) + if trace_translating then + report_translating("utf: %s",str) end end + return str +end + +function regimes.push() + level = level + 1 + if trace_translating then + report_translating("pushing level: %s",level) + end end -function regimes.translate(line,regime) - regime = regimes.synonyms[regime] or regime - if regime and line then - local rur = regimes.utf[regime] - if rur then - return (gsub(line,"(.)",rur)) -- () redundant +function regimes.pop() + if level > 0 then + if trace_translating then + report_translating("popping level: %s",level) end + level = level - 1 end - return line end -function regimes.enable(regime) - regime = regimes.synonyms[regime] or regime - if regimes.data[regime] then - regimes.currentregime = regime - local translate = regimes.translate - resolvers.install_text_filter('input',function(s) - return translate(s,regime) - end) - else - regimes.disable() +sequencers.prependaction(textlineactions,"system","regimes.process") +sequencers.disableaction(textlineactions,"regimes.process") + +-- interface: + +commands.enableregime = enable +commands.disableregime = disable + +function commands.currentregime() + context(currentregime) +end + +local stack = { } + +function commands.startregime(regime) + insert(stack,currentregime) + if trace_translating then + report_translating("start: '%s'",regime) end + enable(regime) end -function regimes.disable() - regimes.currentregime = "utf" - resolvers.install_text_filter('input',nil) +function commands.stopregime() + if #stack > 0 then + local regime = remove(stack) + if trace_translating then + report_translating("stop: '%s'",regime) + end + enable(regime) + end end + +-- obsolete: +-- +-- function regimes.setsynonym(synonym,target) +-- synonyms[synonym] = target +-- end +-- +-- function regimes.truename(regime) +-- return regime and synonyms[regime] or regime or currentregime +-- end +-- +-- function commands.trueregimename(regime) +-- context(regimes.truename(regime)) +-- end +-- +-- function regimes.load(regime) +-- return mapping[synonyms[regime] or regime] +-- end diff --git a/Master/texmf-dist/tex/context/base/regi-ini.mkiv b/Master/texmf-dist/tex/context/base/regi-ini.mkiv index db7a224ac9a..41f00142663 100644 --- a/Master/texmf-dist/tex/context/base/regi-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/regi-ini.mkiv @@ -11,45 +11,39 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\unprotect - -%D First some initialization code: - \registerctxluafile{regi-ini}{1.001} -%D \macros -%D {currentregime} - -\def\currentregime{utf} - -%D \macros -%D {defineregimesynonym,trueregimename} - -\unexpanded\def\defineregimesynonym - {\dodoubleargument\dodefineregimesynonym} - -\def\dodefineregimesynonym[#1][#2]% - {\ctxlua{regimes.setsynonym("#1","#2")}} - -\def\trueregimename#1% - {\ctxlua{regimes.truename("#1")}} - -%D \macros -%D {useregime} - -\def\useregime[#1]% - {\processcommalist[#1]\douseregime} - -\def\douseregime#1% - {\ctxlua{regimes.load("#1")}} +\unprotect %D \macros -%D {enableregime,disableregime} - -\def\enableregime[#1]% - {\edef\currentregime{\ctxlua{regimes.load("#1") regimes.enable("#1") regimes.truename()}}} - -\def\disableregime - {\edef\currentregime{\ctxlua{regimes.disable()}}} +%D {enableregime,disableregime,currentregime} +%D +%D Beware, the enable and disable commands are global switches, so +%D best use the start|/|stop commands. + +\unexpanded\def\enableregime[#1]{\ctxcommand{enableregime("#1")}} +\unexpanded\def\disableregime {\ctxcommand{disableregime()}} +\unexpanded\def\startregime [#1]{\ctxcommand{startregime("#1")}} +\unexpanded\def\stopregime {\ctxcommand{stopregime()}} + \def\currentregime {\ctxcommand{currentregime()}} + +% D \macros +% D {defineregimesynonym,trueregimename} +% +% \unexpanded\def\defineregimesynonym % more or less obsolete +% {\dodoubleargument\dodefineregimesynonym} +% +% \def\dodefineregimesynonym[#1][#2]% +% {\ctxlua{regimes.setsynonym("#1","#2")}} +% +% \def\trueregimename#1% +% {\ctxcommand{trueregimename("#1")}} + +% D \macros +% D {useregime} +% D +% D This one is sort of obsolete but we keep them around. + +\unexpanded\def\useregime[#1]{} \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/regi-syn.mkii b/Master/texmf-dist/tex/context/base/regi-syn.mkii new file mode 100644 index 00000000000..7a8a9c146ca --- /dev/null +++ b/Master/texmf-dist/tex/context/base/regi-syn.mkii @@ -0,0 +1,73 @@ +%D \module +%D [ file=regi-syn, +%D version=2006.04.04, +%D title=\CONTEXT\ Regime Macros, +%D subtitle=Synonyms, +%D author=Mojca Miklavec \& Hans Hagen, +%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. + +\writestatus{loading}{ConTeXt Regime Macros / Synonyms} + +\unprotect + +\defineregimesynonym [windows-1250] [cp1250] +\defineregimesynonym [windows-1251] [cp1251] +\defineregimesynonym [windows-1252] [cp1252] +\defineregimesynonym [windows-1253] [cp1253] +\defineregimesynonym [windows-1254] [cp1254] +%defineregimesynonym [windows-1255] [cp1255] % not supported yet (Hebrew) +%defineregimesynonym [windows-1256] [cp1256] % not supported yet (Arabic) +\defineregimesynonym [windows-1257] [cp1257] +%defineregimesynonym [windows-1258] [cp1258] % not supported yet (Vietnamese) + +\defineregimesynonym [il1] [8859-1] +\defineregimesynonym [il2] [8859-2] +\defineregimesynonym [il3] [8859-3] +\defineregimesynonym [il4] [8859-4] +\defineregimesynonym [il5] [8859-9] +\defineregimesynonym [il6] [8859-10] +\defineregimesynonym [il7] [8859-13] +%defineregimesynonym [il8] [8859-14] +\defineregimesynonym [il9] [8859-15] +\defineregimesynonym [il10] [8859-16] + +\defineregimesynonym [iso-8859-1] [8859-1] +\defineregimesynonym [iso-8859-2] [8859-2] +\defineregimesynonym [iso-8859-3] [8859-3] +\defineregimesynonym [iso-8859-4] [8859-4] +\defineregimesynonym [iso-8859-9] [8859-9] +\defineregimesynonym [iso-8859-10] [8859-10] +\defineregimesynonym [iso-8859-13] [8859-13] +%defineregimesynonym [iso-8859-14] [8859-14] +\defineregimesynonym [iso-8859-15] [8859-15] +\defineregimesynonym [iso-8859-16] [8859-16] + +\defineregimesynonym [latin1] [8859-1] +\defineregimesynonym [latin2] [8859-2] +\defineregimesynonym [latin3] [8859-3] +\defineregimesynonym [latin4] [8859-4] +\defineregimesynonym [latin5] [8859-9] +\defineregimesynonym [latin6] [8859-10] +\defineregimesynonym [latin7] [8859-13] +%defineregimesynonym [latin8] [8859-14] +\defineregimesynonym [latin9] [8859-15] +\defineregimesynonym [latin10] [8859-16] + +% kind of special + +\defineregimesynonym [utf-8] [utf] +\defineregimesynonym [utf8] [utf] + +% for historical reasons / compatibility + +\defineregimesynonym [windows] [cp1252] +\defineregimesynonym [grk] [8859-7] +\defineregimesynonym [iso88595] [8859-5] + +\protect \endinput + diff --git a/Master/texmf-dist/tex/context/base/regi-syn.tex b/Master/texmf-dist/tex/context/base/regi-syn.tex deleted file mode 100644 index 7a8a9c146ca..00000000000 --- a/Master/texmf-dist/tex/context/base/regi-syn.tex +++ /dev/null @@ -1,73 +0,0 @@ -%D \module -%D [ file=regi-syn, -%D version=2006.04.04, -%D title=\CONTEXT\ Regime Macros, -%D subtitle=Synonyms, -%D author=Mojca Miklavec \& Hans Hagen, -%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. - -\writestatus{loading}{ConTeXt Regime Macros / Synonyms} - -\unprotect - -\defineregimesynonym [windows-1250] [cp1250] -\defineregimesynonym [windows-1251] [cp1251] -\defineregimesynonym [windows-1252] [cp1252] -\defineregimesynonym [windows-1253] [cp1253] -\defineregimesynonym [windows-1254] [cp1254] -%defineregimesynonym [windows-1255] [cp1255] % not supported yet (Hebrew) -%defineregimesynonym [windows-1256] [cp1256] % not supported yet (Arabic) -\defineregimesynonym [windows-1257] [cp1257] -%defineregimesynonym [windows-1258] [cp1258] % not supported yet (Vietnamese) - -\defineregimesynonym [il1] [8859-1] -\defineregimesynonym [il2] [8859-2] -\defineregimesynonym [il3] [8859-3] -\defineregimesynonym [il4] [8859-4] -\defineregimesynonym [il5] [8859-9] -\defineregimesynonym [il6] [8859-10] -\defineregimesynonym [il7] [8859-13] -%defineregimesynonym [il8] [8859-14] -\defineregimesynonym [il9] [8859-15] -\defineregimesynonym [il10] [8859-16] - -\defineregimesynonym [iso-8859-1] [8859-1] -\defineregimesynonym [iso-8859-2] [8859-2] -\defineregimesynonym [iso-8859-3] [8859-3] -\defineregimesynonym [iso-8859-4] [8859-4] -\defineregimesynonym [iso-8859-9] [8859-9] -\defineregimesynonym [iso-8859-10] [8859-10] -\defineregimesynonym [iso-8859-13] [8859-13] -%defineregimesynonym [iso-8859-14] [8859-14] -\defineregimesynonym [iso-8859-15] [8859-15] -\defineregimesynonym [iso-8859-16] [8859-16] - -\defineregimesynonym [latin1] [8859-1] -\defineregimesynonym [latin2] [8859-2] -\defineregimesynonym [latin3] [8859-3] -\defineregimesynonym [latin4] [8859-4] -\defineregimesynonym [latin5] [8859-9] -\defineregimesynonym [latin6] [8859-10] -\defineregimesynonym [latin7] [8859-13] -%defineregimesynonym [latin8] [8859-14] -\defineregimesynonym [latin9] [8859-15] -\defineregimesynonym [latin10] [8859-16] - -% kind of special - -\defineregimesynonym [utf-8] [utf] -\defineregimesynonym [utf8] [utf] - -% for historical reasons / compatibility - -\defineregimesynonym [windows] [cp1252] -\defineregimesynonym [grk] [8859-7] -\defineregimesynonym [iso88595] [8859-5] - -\protect \endinput - diff --git a/Master/texmf-dist/tex/context/base/s-abr-01.tex b/Master/texmf-dist/tex/context/base/s-abr-01.tex index a55eb95f18d..e4927814cea 100644 --- a/Master/texmf-dist/tex/context/base/s-abr-01.tex +++ b/Master/texmf-dist/tex/context/base/s-abr-01.tex @@ -19,10 +19,11 @@ \protect -\logo [MKI] {MkI} +\logo [MKI] {MkI} % joke \logo [MKII] {MkII} -\logo [MKIII] {MkIII} +\logo [MKIII] {MkIII} % joke \logo [MKIV] {MkIV} +\logo [MKVI] {MkVI} %logo [FGA] {fga} %logo [FGBBS] {fgbbs} @@ -51,6 +52,7 @@ \logo [CID] {cid} \logo [CJK] {cjk} \logo [CMR] {cmr} +\logo [CLD] {cld} \logo [CMYK] {cmyk} \logo [CODHOST] {CodHost} \logo [CONTEXT] {\ConTeXt} @@ -74,6 +76,7 @@ \logo [DVIPSONE] {dvipsone} \logo [DVISCR] {dviscr} \logo [DVIWINDO] {dviwindo} +\logo [EBCDIC] {ebcdic} \logo [EC] {ec} \logo [EIFFEL] {Eiffel} \logo [EMACS] {emacs} @@ -92,6 +95,7 @@ \logo [EXAMPLET] {examplet} \logo [EXAMPLEX] {examplex} \logo [EXIMPLE] {eXiMpLe} +\logo [FLAC] {flac} \logo [FAQ] {faq} \logo [FDF] {fdf} \logo [FONTFORGE] {FontForge} @@ -155,6 +159,7 @@ \logo [MPTOPDF] {mptopdf} \logo [MPLIB] {mplib} \logo [MSDOS] {msdos} +\logo [MICROSOFT] {MicroSoft} \logo [MSWINDOWS] {MS~Windows} \logo [MTXRUN] {mtxrun} \logo [MTXTOOLS] {mtxtools} @@ -287,33 +292,36 @@ \def\SystemSpecialA#1{$\langle\it#1\rangle$} \def\SystemSpecialB#1{{\tttf<#1>}} -\def\CATCODE {\SystemSpecialA{catcode}} -\def\CATCODES {\SystemSpecialA{catcodes}} -\def\DIMENSION {\SystemSpecialA{dimension}} -\def\DIMENSIONS {\SystemSpecialA{dimensions}} -\def\COUNTER {\SystemSpecialA{counter}} -\def\COUNTERS {\SystemSpecialA{counters}} -\def\HBOX {\SystemSpecialA{hbox}} -\def\HBOXES {\SystemSpecialA{hboxes}} -\def\VBOX {\SystemSpecialA{vbox}} -\def\VBOXES {\SystemSpecialA{vboxes}} -\def\BOX {\SystemSpecialA{box}} -\def\BOXES {\SystemSpecialA{boxes}} -\def\TOKENLIST {\SystemSpecialA{token list}} -\def\TOKENLISTS {\SystemSpecialA{token lists}} -\def\NEWLINE {\SystemSpecialA{newline}} -\def\SKIP {\SystemSpecialA{skip}} -\def\SKIPS {\SystemSpecialA{skips}} -\def\MUSKIP {\SystemSpecialA{muskip}} -\def\MUSKIPS {\SystemSpecialA{muskips}} -\def\MARK {\SystemSpecialA{mark}} -\def\MARKS {\SystemSpecialA{marks}} +\unexpanded\def\CATCODE {\SystemSpecialA{catcode}} +\unexpanded\def\CATCODES {\SystemSpecialA{catcodes}} +\unexpanded\def\DIMENSION {\SystemSpecialA{dimension}} +\unexpanded\def\DIMENSIONS {\SystemSpecialA{dimensions}} +\unexpanded\def\COUNTER {\SystemSpecialA{counter}} +\unexpanded\def\COUNTERS {\SystemSpecialA{counters}} +\unexpanded\def\HBOX {\SystemSpecialA{hbox}} +\unexpanded\def\HBOXES {\SystemSpecialA{hboxes}} +\unexpanded\def\VBOX {\SystemSpecialA{vbox}} +\unexpanded\def\VBOXES {\SystemSpecialA{vboxes}} +\unexpanded\def\BOX {\SystemSpecialA{box}} +\unexpanded\def\BOXES {\SystemSpecialA{boxes}} +\unexpanded\def\TOKENLIST {\SystemSpecialA{token list}} +\unexpanded\def\TOKENLISTS {\SystemSpecialA{token lists}} +\unexpanded\def\NEWLINE {\SystemSpecialA{newline}} +\unexpanded\def\SKIP {\SystemSpecialA{skip}} +\unexpanded\def\SKIPS {\SystemSpecialA{skips}} +\unexpanded\def\MUSKIP {\SystemSpecialA{muskip}} +\unexpanded\def\MUSKIPS {\SystemSpecialA{muskips}} +\unexpanded\def\MARK {\SystemSpecialA{mark}} +\unexpanded\def\MARKS {\SystemSpecialA{marks}} -\def\SPACE {\SystemSpecialB{space}} -\def\EOF {\SystemSpecialB{eof}} -\def\TAB {\SystemSpecialB{tab}} -\def\NEWPAGE {\SystemSpecialB{newpage}} -\def\NEWLINE {\SystemSpecialB{newline}} +\unexpanded\def\SPACE {\SystemSpecialB{space}} +\unexpanded\def\EOF {\SystemSpecialB{eof}} +\unexpanded\def\TAB {\SystemSpecialB{tab}} +\unexpanded\def\NEWPAGE {\SystemSpecialB{newpage}} +\unexpanded\def\NEWLINE {\SystemSpecialB{newline}} + +\unexpanded\def\LUWATEEKH {لُواتيخ} % kh ī t ā w [u] l +\unexpanded\def\luwateekh {luwātīkh} \doifmodeelse {mkiv} { \unexpanded\def\THANH{H\agrave n Th\ecircumflexacute\ Th\agrave nh} diff --git a/Master/texmf-dist/tex/context/base/s-abr-04.tex b/Master/texmf-dist/tex/context/base/s-abr-04.tex new file mode 100644 index 00000000000..98e76c86fc3 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-abr-04.tex @@ -0,0 +1,321 @@ +%D \module +%D [ file=s-abr-01, +%D version=1996.01.01, +%D title=\CONTEXT\ Style File, +%D subtitle=General Abbreviations 1, +%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 + +% \setupsorting[logo][\c!style=\v!capital] + +% \setupcapitals[\c!title=\v!no] + +\protect + +\logo [MKI] {MkI} +\logo [MKII] {MkII} +\logo [MKIII] {MkIII} +\logo [MKIV] {MkIV} + +%logo [FGA] {fga} +%logo [FGBBS] {fgbbs} +\logo [ACROBAT] {Acro\-bat} +\logo [AFM] {afm} +\logo [API] {api} +\logo [ALEPH] {Aleph} % {\mathematics{\aleph}} +\logo [ALGOL] {ALGOL} +\logo [AMS] {ams} +\logo [AMSLATEX] {AmS\LATEX} +\logo [AMSTEX] {AmS\TeX} +\logo [ANSI] {ansi} +\logo [ARABTEX] {Arab\TeX} +\logo [ASCII] {ascii} +\logo [ASCIITEX] {ascii\TeX} +\logo [BACHOTEX] {Bacho\TeX} +\logo [BIBTEX] {bib\TeX} +\logo [BLUESKY] {BlueSky} +\logo [BMP] {bmp} +\logo [BSD] {bsd} +\logo [CCODE] {c} +\logo [CALCMATH] {CalcMath} +\logo [CD] {cd} +\logo [CPU] {cpu} +\logo [CDROM] {cdrom} +\logo [CID] {cid} +\logo [CJK] {cjk} +\logo [CMR] {cmr} +\logo [CMYK] {cmyk} +\logo [CODHOST] {CodHost} +\logo [CONTEXT] {Con{\TeX}t} +\logo [CSS] {css} +\logo [CTAN] {ctan} +\logo [CTXTOOLS] {ctxtools} +\logo [CWEB] {cweb} +\logo [DANTE] {Dante} +\logo [DISTILLER] {distiller} +\logo [DRATEX] {Dra\TeX} +\logo [DSC] {dsc} +\logo [DTD] {dtd} +\logo [DTK] {dtk} +\logo [DTP] {dtp} +\logo [DVD] {dvd} +\logo [DVI] {dvi} +\logo [DVIPDFM] {dvipdfm} +\logo [DVIPDFMX] {dvipdfmx} +\logo [DVIPOS] {dvipos} +\logo [DVIPS] {dvips} +\logo [DVIPSONE] {dvipsone} +\logo [DVISCR] {dviscr} +\logo [DVIWINDO] {dviwindo} +\logo [EC] {ec} +\logo [EIFFEL] {Eiffel} +\logo [EMACS] {emacs} +\logo [EMTEX] {em\TeX} +\logo [ENCODING] {enc} +\logo [ENCTEX] {enc\TeX} +\logo [EPS] {eps} +\logo [ETEX] {\eTeX} +\logo [EUROBACHOTEX] {EuroBacho\TeX} +\logo [EUROMATH] {EuroMath} +\logo [EUROTEX] {Euro\TeX} +\logo [EXAMPLE] {eXaMpLe} +\logo [EXAMPLED] {exampled} +\logo [EXAMPLEQ] {exampleq} +\logo [EXAMPLER] {exampler} +\logo [EXAMPLET] {examplet} +\logo [EXAMPLEX] {examplex} +\logo [EXIMPLE] {eXiMpLe} +\logo [FAQ] {faq} +\logo [FDF] {fdf} +\logo [FONTFORGE] {FontForge} +\logo [FOXET] {foXet} +\logo [FPTEX] {fp\TeX} +\logo [FREEBSD] {FreeBSD} +\logo [FTP] {ftp} +\logo [GHOSTSCRIPT]{Ghost\-script} +\logo [GHOSTVIEW] {Ghost\-view} +\logo [GIF] {gif} +\logo [GNU] {gnu} +\logo [GNUPLOT] {gnuplot} +\logo [GS] {Ghost\-Script} +\logo [GUST] {Gust} +\logo [GWTEX] {gw\TeX} +\logo [HSB] {hsb} +\logo [HTML] {html} +\logo [HTTP] {http} +\logo [HZ] {hz} +\logo [IBM] {ibm} +\logo [IMAGEMAGICK]{ImageMagick} +\logo [INITEX] {ini\TeX} +\logo [INRSTEX] {inrs\TeX} +\logo [IO] {io} +\logo [IRCNET] {IRCnet} +\logo [ISO] {iso} +\logo [JAVA] {Java} +\logo [JAVASCRIPT] {Java\-Script} +\logo [JPEG] {jpeg} +\logo [JPG] {jpg} +\logo [KPATHSEA] {kpathsea} +\logo [KPSE] {kpse} +\logo [KPSEWHICH] {kpsewhich} +\logo [MKTEXLSR] {mktexlsr} +\logo [LAMSTEX] {LamS\TeX} +\logo [LATEX] {La\TeX} +\logo [LATEXTE] {La\TeX2e} +\logo [LATEXTN] {La\TeX2.09} +\logo [LINUX] {linux} +\logo [LISP] {Lisp} +\logo [LPEG] {lpeg} +\logo [LUA] {Lua} +\logo [LUAJIT] {LuaJIT} +\logo [LUATEX] {Lua\TeX} +\logo [LUATOOLS] {luatools} +\logo [MACOSX] {MacOSX} +\logo [MACROTEX] {Macro\TeX} +\logo [MAKEMPY] {MakeMPY} +\logo [MAPPING] {map} +\logo [MAPS] {Maps} +\logo [MATHML] {MathML} +\logo [METAFONT] {MetaFont} +\logo [METAPOST] {MetaPost} +\logo [METATEX] {Meta\TeX} +\logo [MIKTEX] {Mik\TeX} +\logo [MLTEX] {ml\TeX} +\logo [METATYPE] {MetaType1} +\logo [MODULA] {Modula} +\logo [MOV] {mov} +\logo [MPS] {mps} +\logo [MPTOPDF] {mptopdf} +\logo [MPLIB] {MPlib} +\logo [MSDOS] {msdos} +\logo [MSWINDOWS] {MS~Windows} +\logo [MTXRUN] {mtxrun} +\logo [MTXTOOLS] {mtxtools} +\logo [NETPBM] {NetPBM} +\logo [NTG] {ntg} +\logo [NTS] {nts} +\logo [OFM] {ofm} +\logo [OMEGA] {Omega} +\logo [OPENMATH] {OpenMath} +\logo [OPENTYPE] {OpenType} +\logo [OPI] {opi} +\logo [OTF] {otf} +\logo [OTP] {otp} +\logo [OVF] {ovf} +\logo [PASCAL] {Pascal} +\logo [PCTEX] {pc\TeX} +\logo [PDF] {pdf} +\logo [PDFETEX] {pdfe\TeX} +\logo [PDFTEX] {pdf\TeX} +\logo [PDFTOOLS] {pdftools} +\logo [PDFTOPS] {pdftops} +\logo [PERL] {Perl} +\logo [PERLTK] {Perl/Tk} +\logo [PICTEX] {\PiCTeX} +\logo [PK] {pk} +\logo [PLAIN] {Plain} +\logo [PNG] {png} +\logo [POSIX] {posix} +\logo [POSTSCRIPT] {Post\-Script} +\logo [PPCHTEX] {\PPCHTeX} +\logo [PRAGMA] {Pragma ADE} +\logo [PRESS] {press} +\logo [PRIFIL] {prifil} +\logo [PS] {Post\-Script} +\logo [PSCHECK] {pscheck} +\logo [PSTOEDIT] {pstoedit} +\logo [PSTOPAGE] {pstopage} +\logo [PSTOPDF] {pstopdf} +\logo [PSTRICKS] {pstricks} +\logo [RAM] {ram} +\logo [READER] {Acro\-bat Reader} +\logo [RELAXNG] {Relax\kern.125emNG} +\logo [RGB] {rgb} +\logo [RLXTOOLS] {rlxtools} +\logo [RUBY] {Ruby} +\logo [SCITE] {SciTE} +\logo [SGML] {sgml} +\logo [SI] {si} +\logo [SQL] {sql} +\logo [TABLE] {\TaBlE} +\logo [TCPIP] {tcp/ip} +\logo [TDS] {tds} % no sc te +\logo [TETEX] {te\TeX} % no sc te +\logo [TEX] {\TeX} +\logo [TEXADRES] {\TeX adress} +\logo [TEXBASE] {\TeX base} +\logo [TEXEDIT] {\TeX edit} +\logo [TEXEXEC] {\TeX exec} +\logo [TEXFONT] {\TeX font} +\logo [TEXFORM] {\TeX form} +\logo [TEXLIVE] {\TeX Live} +\logo [TEXLUA] {\TeX Lua} +\logo [TEXMF] {texmf} +\logo [TEXMFSTART] {texmfstart} +\logo [TEXNL] {tex-nl} +\logo [TEXSHOW] {\TeX show} +\logo [TEXSPELL] {\TeX spell} +\logo [TEXGYRE] {\TeX\ Gyre} +\logo [TEXSYNC] {texsync} +\logo [TEXTMATE] {TextMate} +\logo [TEXTOOLS] {\TeX tools} +\logo [TEXUTIL] {\TeX util} +\logo [TEXWORK] {\TeX work} +\logo [TEXXET] {\TeX\XeT} \def\XeT{XeT} +\logo [TFM] {tfm} +\logo [TIF] {tif} +\logo [TIFF] {tiff} +\logo [TIFFINFO] {tiffinfo} +\logo [TIFFTAGS] {tifftags} +\logo [TMFTOOLS] {tmftools} +\logo [TPIC] {tpic} +\logo [TPM] {tpm} +\logo [TRUETYPE] {TrueType} +\logo [TTF] {ttf} +\logo [TUG] {tug} +\logo [TUGBOAT] {Tug\-Boat} +\logo [TUGNEWS] {Tug\-News} +\logo [TYPEONE] {Type1} +\logo [UCS] {ucs} +\logo [UNICODE] {Uni\-code} +\logo [UNIX] {Unix} +\logo [URI] {uri} +\logo [URL] {url} +\logo [USA] {usa} +\logo [USENET] {usenet} +\logo [UTF] {utf} +\logo [UTF] {utf} +\logo [VF] {vf} +\logo [WDT] {wdt} +\logo [WEB] {web} +\logo [WEBC] {web2c} +\logo [WIKI] {Wiki} +\logo [WINDOWS] {Windows} +\logo [WINNT] {WinNT} +\logo [WINNX] {Win9x} +\logo [WWW] {www} +\logo [WYSIWYG] {wysiwyg} +\logo [XDVI] {Xdvi} +\logo [XETEX] {\XeTeX} +\logo [XFDF] {xfdf} +\logo [XHTML] {xhtml} +\logo [XINDY] {Xindy} +\logo [XML] {xml} +\logo [XPATH] {xpath} +\logo [XMLTOOLS] {xmltools} +\logo [XPDFETEX] {xpdfe\TeX} +\logo [XSL] {xsl} +\logo [XSLFO] {xsl-fo} +\logo [XSLT] {xslt} +\logo [XSLTPROC] {xsltproc} +\logo [XYPIC] {XYPIC} % wrong logo +\logo [YandY] {y\&y} +\logo [ZIP] {zip} + +\def\METAFUN {\MetaFun} + +\logo [METAFUN] {\MetaFun} + +\def\SystemSpecialA#1{$\langle\it#1\rangle$} +\def\SystemSpecialB#1{{\tttf<#1>}} + +\def\CATCODE {\SystemSpecialA{catcode}} +\def\CATCODES {\SystemSpecialA{catcodes}} +\def\DIMENSION {\SystemSpecialA{dimension}} +\def\DIMENSIONS {\SystemSpecialA{dimensions}} +\def\COUNTER {\SystemSpecialA{counter}} +\def\COUNTERS {\SystemSpecialA{counters}} +\def\HBOX {\SystemSpecialA{hbox}} +\def\HBOXES {\SystemSpecialA{hboxes}} +\def\VBOX {\SystemSpecialA{vbox}} +\def\VBOXES {\SystemSpecialA{vboxes}} +\def\BOX {\SystemSpecialA{box}} +\def\BOXES {\SystemSpecialA{boxes}} +\def\TOKENLIST {\SystemSpecialA{token list}} +\def\TOKENLISTS {\SystemSpecialA{token lists}} +\def\NEWLINE {\SystemSpecialA{newline}} +\def\SKIP {\SystemSpecialA{skip}} +\def\SKIPS {\SystemSpecialA{skips}} +\def\MUSKIP {\SystemSpecialA{muskip}} +\def\MUSKIPS {\SystemSpecialA{muskips}} +\def\MARK {\SystemSpecialA{mark}} +\def\MARKS {\SystemSpecialA{marks}} + +\def\SPACE {\SystemSpecialB{space}} +\def\EOF {\SystemSpecialB{eof}} +\def\TAB {\SystemSpecialB{tab}} +\def\NEWPAGE {\SystemSpecialB{newpage}} +\def\NEWLINE {\SystemSpecialB{newline}} + +\def\THANH {H\`an Th\^e\llap{\raise 0.5ex\hbox{\'{}}} Th\`anh} + +\def\THANH {H\`an Th\ecircumflexacute\ Th\`anh} + +\endinput diff --git a/Master/texmf-dist/tex/context/base/s-cdr-01.tex b/Master/texmf-dist/tex/context/base/s-cdr-01.tex index 80103936d4f..164d812856a 100644 --- a/Master/texmf-dist/tex/context/base/s-cdr-01.tex +++ b/Master/texmf-dist/tex/context/base/s-cdr-01.tex @@ -11,6 +11,10 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +\startmodule[cdr-01] + +\setupmodule[cdr-01][option=] + \def\PDFMPformoffset{20cm} \definepapersize @@ -57,39 +61,47 @@ \defineoverlay[leftcover] [\useMPgraphic{leftcover}] \defineoverlay[rightcover][\useMPgraphic{rightcover}] +\definecolor [cd-color] [s=0] +\definemeasure[cd-linewidth][.4pt] + +\doif {\moduleparameter{cdr-01}{option}} {light} { + \definecolor [cd-color] [s=.85] + \definemeasure[cd-linewidth][.2pt] +} + \startuseMPgraphic{leftcover} StartPage ; - pickup pencircle scaled .5pt ; + pickup pencircle scaled \measure{cd-linewidth} ; draw bottomboundary Page & rightboundary Page & - topboundary Page ; + topboundary Page withcolor \MPcolor{cd-color} ; draw bottomboundary (Page enlarged 3mm) & rightboundary (Page enlarged 3mm) & - topboundary (Page enlarged 3mm) dashed evenly ; + topboundary (Page enlarged 3mm) dashed evenly withcolor \MPcolor{cd-color} ; StopPage ; \stopuseMPgraphic \startuseMPgraphic{rightcover} StartPage ; - pickup pencircle scaled .5pt ; + pickup pencircle scaled \measure{cd-linewidth} ; draw topboundary Page & leftboundary Page & - bottomboundary Page ; + bottomboundary Page withcolor \MPcolor{cd-color} ; draw topboundary (Page enlarged 3mm) & leftboundary (Page enlarged 3mm) & - bottomboundary (Page enlarged 3mm) dashed evenly ; + bottomboundary (Page enlarged 3mm) dashed evenly withcolor \MPcolor{cd-color} ; draw bottomboundary Page -- lrcorner Page shifted (-5mm,-1cm) -- - llcorner Page shifted ( 5mm,-1cm) -- cycle ; + llcorner Page shifted ( 5mm,-1cm) -- cycle withcolor \MPcolor{cd-color} ; draw topboundary Page -- ulcorner Page shifted ( 5mm, 1cm) -- - urcorner Page shifted (-5mm, 1cm) -- cycle ; + urcorner Page shifted (-5mm, 1cm) -- cycle withcolor \MPcolor{cd-color} ; StopPage ; setbounds currentpicture to Page ; \stopuseMPgraphic @@ -118,6 +130,8 @@ height=fit, width=\textheight] +\stopmodule + \doifnotmode{demo}{\endinput} \starttext diff --git a/Master/texmf-dist/tex/context/base/s-chi-00.mkii b/Master/texmf-dist/tex/context/base/s-chi-00.mkii new file mode 100644 index 00000000000..bec86f6d2f0 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-chi-00.mkii @@ -0,0 +1,76 @@ +%D \module +%D [ file=s-chi-00, +%D version=1999.12.21, +%D title=\CONTEXT\ Style File, +%D subtitle=Basic Chinese Style, +%D author=Hans Hagen, +%D date=\currentdate, +%D suggestions=Wang Lei, +%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. + +\input font-chi.mkii % faster than \setupbodyfont[chi] + +\mainlanguage [cn] + +\unprotect + +\setupsection [\s!section-1] [\c!headconversion=\s!chinese] +\setupsection [\s!section-2] [\c!headconversion=\s!chinese] +\setupsection [\s!section-3] [\c!headconversion=\s!chinese] + +\setupsection [\s!section-2] [\v!appendix\c!conversion=] + +\setuphead [\v!chapter] [\c!distance=1.25em] +\setuphead [\v!section] [\c!distance=1.25em] +\setuphead [\v!subsection] [\c!distance=1.00em] + +\setuplist [\v!chapter] [\c!headlabel=\v!yes,\c!headconversion=\v!yes,\c!width=5em] +\setuplist [\v!section] [\c!headlabel=\v!yes,\c!headconversion=\v!yes,\c!width=5em] + +\setupmarking [\v!chapter\v!number] [\c!headlabel=\v!yes,\c!headconversion=\v!yes] +\setupmarking [\v!section\v!number] [\c!headlabel=\v!yes,\c!headconversion=\v!yes] + +\setuplabeltext [cn] [\v!subsection={\symbol[S]\kern.25em}] +\setuplabeltext [cn] [\v!subsubsection={\symbol[S]\kern.25em}] +\setuplabeltext [cn] [\v!subsubsubsection={\symbol[S]\kern.25em}] +\setuplabeltext [cn] [\v!subsubsubsubsection={\symbol[S]\kern.25em}] + +% nog taalonafhankelijk maken -> \e!tabel enz + +\definereferenceformat [intable] [\c!label=\v!table] +\definereferenceformat [infigure] [\c!label=\v!figure] +\definereferenceformat [inchapter] [\c!label=\v!chapter] +\definereferenceformat [insection] [\c!label=\v!section] + +% important + +\setuptyping[\c!tab=\v!no] + +%D This module (and font support) adapts to the \UTF\ regime, but you +%D need to enable \UTF\ first! +%D +%D \starttyping +%D \enableregime[utf] \usemodule[chi-00] +%D +%D \starttext +%D +%D 兡也包因沘氓侷柵苗孫孫財 +%D 崧淫設弼琶跑愍窟榜蒸奭稽 +%D 霄瓢館縲擻鼕孃魔釁佉沎岠 +%D 狋垚柛胅娭涘罞偟惈牻荺傒 +%D 焱菏酡廅滘絺赩塴榗箂踃嬁 +%D 澕蓴醊獧螗餟燱螬駸礑鎞瀧 +%D 鄿瀯騬醹躕鱕 +%D +%D \blank +%D +%D Wang Lei is written as: 王磊 +%D +%D \stoptext +%D \stoptyping + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/s-chi-00.tex b/Master/texmf-dist/tex/context/base/s-chi-00.tex deleted file mode 100644 index bec86f6d2f0..00000000000 --- a/Master/texmf-dist/tex/context/base/s-chi-00.tex +++ /dev/null @@ -1,76 +0,0 @@ -%D \module -%D [ file=s-chi-00, -%D version=1999.12.21, -%D title=\CONTEXT\ Style File, -%D subtitle=Basic Chinese Style, -%D author=Hans Hagen, -%D date=\currentdate, -%D suggestions=Wang Lei, -%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. - -\input font-chi.mkii % faster than \setupbodyfont[chi] - -\mainlanguage [cn] - -\unprotect - -\setupsection [\s!section-1] [\c!headconversion=\s!chinese] -\setupsection [\s!section-2] [\c!headconversion=\s!chinese] -\setupsection [\s!section-3] [\c!headconversion=\s!chinese] - -\setupsection [\s!section-2] [\v!appendix\c!conversion=] - -\setuphead [\v!chapter] [\c!distance=1.25em] -\setuphead [\v!section] [\c!distance=1.25em] -\setuphead [\v!subsection] [\c!distance=1.00em] - -\setuplist [\v!chapter] [\c!headlabel=\v!yes,\c!headconversion=\v!yes,\c!width=5em] -\setuplist [\v!section] [\c!headlabel=\v!yes,\c!headconversion=\v!yes,\c!width=5em] - -\setupmarking [\v!chapter\v!number] [\c!headlabel=\v!yes,\c!headconversion=\v!yes] -\setupmarking [\v!section\v!number] [\c!headlabel=\v!yes,\c!headconversion=\v!yes] - -\setuplabeltext [cn] [\v!subsection={\symbol[S]\kern.25em}] -\setuplabeltext [cn] [\v!subsubsection={\symbol[S]\kern.25em}] -\setuplabeltext [cn] [\v!subsubsubsection={\symbol[S]\kern.25em}] -\setuplabeltext [cn] [\v!subsubsubsubsection={\symbol[S]\kern.25em}] - -% nog taalonafhankelijk maken -> \e!tabel enz - -\definereferenceformat [intable] [\c!label=\v!table] -\definereferenceformat [infigure] [\c!label=\v!figure] -\definereferenceformat [inchapter] [\c!label=\v!chapter] -\definereferenceformat [insection] [\c!label=\v!section] - -% important - -\setuptyping[\c!tab=\v!no] - -%D This module (and font support) adapts to the \UTF\ regime, but you -%D need to enable \UTF\ first! -%D -%D \starttyping -%D \enableregime[utf] \usemodule[chi-00] -%D -%D \starttext -%D -%D 兡也包因沘氓侷柵苗孫孫財 -%D 崧淫設弼琶跑愍窟榜蒸奭稽 -%D 霄瓢館縲擻鼕孃魔釁佉沎岠 -%D 狋垚柛胅娭涘罞偟惈牻荺傒 -%D 焱菏酡廅滘絺赩塴榗箂踃嬁 -%D 澕蓴醊獧螗餟燱螬駸礑鎞瀧 -%D 鄿瀯騬醹躕鱕 -%D -%D \blank -%D -%D Wang Lei is written as: 王磊 -%D -%D \stoptext -%D \stoptyping - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/s-def-01.mkiv b/Master/texmf-dist/tex/context/base/s-def-01.mkiv new file mode 100644 index 00000000000..c54cee764f3 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-def-01.mkiv @@ -0,0 +1,10 @@ +% yes or no + +\unprotect + +\startsetups defaults:frontpart:pagenumbers:roman + \definestructureconversionset[\c!frontpart:\c!pagenumber][][romannumerals] + \setupuserpagenumber[\c!way=\v!byblock] +\stopsetups + +\protect diff --git a/Master/texmf-dist/tex/context/base/s-fnt-01.mkii b/Master/texmf-dist/tex/context/base/s-fnt-01.mkii new file mode 100644 index 00000000000..69c8efab966 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-fnt-01.mkii @@ -0,0 +1,61 @@ +%D \module +%D [ file=s-fnt-01, +%D version=2001.08.22, +%D title=\CONTEXT\ Style File, +%D subtitle=Font Environment 1, +%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 file is used by the \type {texfont.pl} installation +%D script. It is of no use for \MKIV. + +%D Modes: compact + +\dontcomplain + +\setupbodyfont + [10pt] + +\setuplayout + [backspace=30pt, + topspace=30pt, + footer=0pt, + header=36pt, + width=middle, + height=middle] + +\setupcolors + [state=start] + +\def\ShowFont + {\dotripleempty\doShowFont} + +\def\doShowFont[#1][#2][#3]% + {\doifsomething{#1} + {\bgroup + \ifthirdargument + \definefontsynonym[WhateverName][#2][encoding=#3] + \definefont[WhateverFont][WhateverName] + \setupheadertexts[\tttf#2\quad#1\quad#3] + \WhateverFont + \setupinterlinespace + \showfont[WhateverName] + \showligatures[WhateverName] + \doifnotmode{compact}{\showaccents\showcharacters} + \else + \definefontsynonym[WhateverName][#2] + \definefont[WhateverFont][WhateverName] + \setupheadertexts[\tttf#2\quad#1\quad(special font)] + \WhateverFont + \setupinterlinespace + \showfont[WhateverName] + \fi + \page + \egroup}} + +\endinput diff --git a/Master/texmf-dist/tex/context/base/s-fnt-01.tex b/Master/texmf-dist/tex/context/base/s-fnt-01.tex deleted file mode 100644 index 69c8efab966..00000000000 --- a/Master/texmf-dist/tex/context/base/s-fnt-01.tex +++ /dev/null @@ -1,61 +0,0 @@ -%D \module -%D [ file=s-fnt-01, -%D version=2001.08.22, -%D title=\CONTEXT\ Style File, -%D subtitle=Font Environment 1, -%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 file is used by the \type {texfont.pl} installation -%D script. It is of no use for \MKIV. - -%D Modes: compact - -\dontcomplain - -\setupbodyfont - [10pt] - -\setuplayout - [backspace=30pt, - topspace=30pt, - footer=0pt, - header=36pt, - width=middle, - height=middle] - -\setupcolors - [state=start] - -\def\ShowFont - {\dotripleempty\doShowFont} - -\def\doShowFont[#1][#2][#3]% - {\doifsomething{#1} - {\bgroup - \ifthirdargument - \definefontsynonym[WhateverName][#2][encoding=#3] - \definefont[WhateverFont][WhateverName] - \setupheadertexts[\tttf#2\quad#1\quad#3] - \WhateverFont - \setupinterlinespace - \showfont[WhateverName] - \showligatures[WhateverName] - \doifnotmode{compact}{\showaccents\showcharacters} - \else - \definefontsynonym[WhateverName][#2] - \definefont[WhateverFont][WhateverName] - \setupheadertexts[\tttf#2\quad#1\quad(special font)] - \WhateverFont - \setupinterlinespace - \showfont[WhateverName] - \fi - \page - \egroup}} - -\endinput diff --git a/Master/texmf-dist/tex/context/base/s-fnt-02.mkii b/Master/texmf-dist/tex/context/base/s-fnt-02.mkii new file mode 100644 index 00000000000..69f976102b1 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-fnt-02.mkii @@ -0,0 +1,133 @@ +% output=pdftex modes=demo + +% nice example: +% +% \usemodule[s-fnt-02] +% +% \usetypescriptfile[type-ghz.tex] +% +% \usetypescript [sans] [optima,optima-nova] [texnansi] +% +% \setvariables +% [glyphs] +% [name-1=OptimaLT, +% name-2=OptimaNovaLT-Regular] +% +% \starttext +% +% \setups[show-glyphs] +% +% \stoptext +% +% see end, for other example (or run texexec s-fnt-02 --mode=demo) + +\setvariables + [glyphs] + [frame=on, + name-1=cmr10, + name-2=cmtt10, + map-1=, + map-2=] + +\setuppapersize[S4][S4] + +\setupcolors[state=start] + +\setuplayout[page] + +\definecolor[Gray] [s=.2] +\definecolor[ColorNone][s=1,t=.5,a=1] +\definecolor[ColorOne] [r=1,t=.5,a=1] +\definecolor[ColorTwo] [g=1,t=.5,a=1] +\definecolor[BackOne] [b=1,t=.5,a=1] +\definecolor[BackTwo] [r=1,g=1,t=.5,a=1] + +\setupbackgrounds + [page] + [background=color, + backgroundcolor=Gray] + +\startsetups[show-glyphs] + + \doifnothing{\getvariable{glyphs}{name-1}}{\endinput} + \doifnothing{\getvariable{glyphs}{name-2}}{\endinput} + + \doifsomething{\getvariable{glyphs}{map-1}}{\loadmapfile[\getvariable{glyphs}{map-1}]} + \doifsomething{\getvariable{glyphs}{map-2}}{\loadmapfile[\getvariable{glyphs}{map-2}]} + + \definefont[FontOne][\getvariable{glyphs}{name-1} at 280pt] + \definefont[FontTwo][\getvariable{glyphs}{name-2} at 280pt] + +% \dostepwiserecurse{0}{255}{1} +% {\doiffontcharelse{\getvariable{glyphs}{name-1}}{\recurselevel} +% {\doiffontcharelse{\getvariable{glyphs}{name-2}}{\recurselevel} +% {\startstandardmakeup +% \doifelse{\getvariable{glyphs}{frame}}{on} % too many box calculations when off, but who cares +% {\boxrulewidth=2pt} +% {\boxrulewidth=0pt} +% \setbox 0=\hbox{\white\ruledhbox{\FontOne \char\recurselevel}} +% \setbox 2=\hbox{\white\ruledhbox{\FontTwo \char\recurselevel}} +% \setbox 4=\hbox{\FontOne \ColorOne \char\recurselevel} +% \setbox 6=\hbox{\FontTwo \ColorTwo \char\recurselevel} +% \setbox 8=\hbox{\BackOne \ruledhbox{\FontOne \phantom{\char\recurselevel}}} +% \setbox10=\hbox{\BackTwo \ruledhbox{\FontTwo \phantom{\char\recurselevel}}} +% \vfill +% \hbox{\dostepwiserecurse{0}{10}{2}{\hbox to \hsize{\hss\box\recurselevel\hss}\hskip-\hsize}} +% \vfill +% \tttf +% \setstrut +% \hbox to \hsize{\strut\hss +% {\ColorOne \getvariable{glyphs}{name-1}}\quad +% {\ColorTwo \getvariable{glyphs}{name-2}}\quad +% {\ColorNone char \recurselevel }\hss} +% \stopstandardmakeup} +% {}} +% {}} + + \dostepwiserecurse{0}{255}{1} + {\donefalse + \doiffontcharelse{\getvariable{glyphs}{name-1}}{\recurselevel}{\donetrue}{}% + \doiffontcharelse{\getvariable{glyphs}{name-2}}{\recurselevel}{\donetrue}{}% + \ifdone + \startstandardmakeup + \doifelse{\getvariable{glyphs}{frame}}{on} % too many box calculations when off, but who cares + {\boxrulewidth=2pt} + {\boxrulewidth=0pt} + \setbox 0=\hbox{\white\ruledhbox{\FontOne \char\recurselevel}} + \setbox 2=\hbox{\white\ruledhbox{\FontTwo \char\recurselevel}} + \setbox 4=\hbox{\FontOne \ColorOne \char\recurselevel} + \setbox 6=\hbox{\FontTwo \ColorTwo \char\recurselevel} + \setbox 8=\hbox{\BackOne \ruledhbox{\FontOne \phantom{\char\recurselevel}}} + \setbox10=\hbox{\BackTwo \ruledhbox{\FontTwo \phantom{\char\recurselevel}}} + \vfill + \hbox{\dostepwiserecurse{0}{10}{2}{\hbox to \hsize{\hss\box\recurselevel\hss}\hskip-\hsize}} + \vfill + \tttf + \setstrut + \hbox to \hsize{\strut\hss + {\ColorOne \getvariable{glyphs}{name-1}}\quad + {\ColorTwo \getvariable{glyphs}{name-2}}\quad + {\ColorNone char \recurselevel }\hss} + \stopstandardmakeup + \fi} + +\stopsetups + +\doifnotmode{demo}{\endinput} + +\starttext + + \setupencoding[default=ec] + + \loadmapline [=][aer10 = 0 then - sprint(tex.ctxcatcodes,format("\\NC %s \\NC %s \\NC \\char%s \\NC\\NR",name,unicode,unicode)) - end - end - sprint(tex.ctxcatcodes,format("\\stoptabulate")) - end - end -end - -function fonts.show_all() - local tfmdata = fonts.ids[font.current()] - if tfmdata then - local chars = tfmdata.characters - local descs = tfmdata.descriptions or { } - local data = characters.data - sprint(tex.ctxcatcodes,format("\\setuptabulate[header=repeat]")) - sprint(tex.ctxcatcodes,format("\\starttabulatehead")) - sprint(tex.ctxcatcodes,"\\NC\\bf unicode\\NC\\bf visual\\NC\\bf index\\NC\\bf glyph\\NC\\bf adobe\\NC\\bf context\\NC\\NR") - sprint(tex.ctxcatcodes,"\\HL") - sprint(tex.ctxcatcodes,format("\\stoptabulatehead")) - sprint(tex.ctxcatcodes,format("\\starttabulate[|l|c|l|p|p|p|]")) - for k, unicode in ipairs(table.sortedkeys(chars)) do --- for unicode, _ in table.sortedpairs(chars) do - if unicode >= 0 then - local chr, des, dat = chars[unicode], descs[unicode], data[unicode] - local index = chr.index or 0 - local cname = (dat and dat.contextname) or "" - local aname = (dat and dat.adobename) or "" - local gname = (des and des.name) or "" - local mname = dat and dat.mathname - if type(mname) ~= "string" then - mname = "" - end - local mspec = dat and dat.mathspec - if mspec then - for m=1,#mspec do - local n = mspec[m].name - if n then - if mname == "" then - mname = n - else - mname = mname .. " " .. n - end - end - end - end - if mname ~= "" then - mname = "m: " .. mname - if cname ~= "" then - cname = cname .. " " .. mname - else - cname = mname - end - end - sprint(tex.ctxcatcodes,format("\\NC\\tttf U+%05X\\NC\\char%s\\NC\\tttf %05X\\NC\\tttf %s\\NC\\tttf %s\\NC\\tttf %s\\NC\\NR",unicode,unicode,index,gname,aname,cname)) - end - end - sprint(tex.ctxcatcodes,format("\\stoptabulate")) - else - sprint(tex.ctxcatcodes,"problems") - end -end - -function fonts.show_glyphs() - local tfmdata = fonts.ids[font.current()] - if tfmdata then - local chars = tfmdata.characters - for k, v in ipairs(table.sortedkeys(chars)) do - if v >=0 then - sprint(tex.ctxcatcodes,format("\\dontleavehmode{\\strut\\char%s}\\endgraf",v)) - end - end - end -end -\stopluacode - -\def\ShowCompleteFont#1#2#3% - {\bgroup - \page - \font\TestFont=#1 at #2 - \setuplayout[style=\TestFont] - \setupheadertexts[] - \setupfootertexts[#1 -- \pagenumber] - \setupfootertexts[pagenumber] - \setuplayout[width=middle,height=middle,topspace=1cm,backspace=1cm] - \TestFont - \nonknuthmode - \startcolumns[n=#3] - \TestFont - \ctxlua { fonts.show_all() } - \stopcolumns - \page - \egroup} - -\def\ShowAllGlyphs#1#2#3% - {\bgroup - \page - \font\TestFontA=#1 at 12pt - \font\TestFontB=#1 at #2 - \setuplayout[style=\TestFontA] - \setupheadertexts[] - \setupfootertexts[#1 -- \pagenumber] - \setuplayout[width=middle,height=middle,topspace=1cm,backspace=1cm,header=1cm,footer=2cm] - \TestFontB \setupinterlinespace[line=1.2\dimexpr#2\relax] \raggedcenter - \nonknuthmode - \startcolumns[n=#3] - \TestFontB - \ctxlua { fonts.show_glyphs() } - \stopcolumns - \page - \egroup} - -\endinput - -\starttext - -% \ShowCompleteFont{name:dejavusansmono}{10pt}{2} -% \ShowCompleteFont{name:dejavuserif}{10pt}{2} -% \ShowCompleteFont{name:officinasansbookitcregular}{10pt}{2} -% \ShowCompleteFont{name:officinaserifbookitcregular}{10pt}{2} -% \ShowCompleteFont{name:serpentineserifeflight}{10pt}{2} -% \ShowCompleteFont{name:lmtypewriter10-regular}{10pt}{2} -% \ShowCompleteFont{lt55485}{10pt}{2} -% \ShowCompleteFont{lmr10}{10pt}{2} -% \ShowCompleteFont{lbr}{10pt}{2} -% \ShowCompleteFont{name:Cambria}{10pt}{2} -% \ShowCompleteFont{name:CambriaMath}{10pt}{2} -% \ShowCompleteFont{name:texgyrepagella-regular}{10pt}{2} -% \ShowCompleteFont{name:texgyrechorus-mediumitalic}{10pt}{2} -% \ShowAllGlyphs {name:texgyrepagella-regular} {48pt}{2} -% \ShowAllGlyphs {name:texgyrechorus-mediumitalic}{48pt}{2} -% \ShowCompleteFont{name:euler10-regular}{10pt}{2} - -% \ShowCompleteFont{name:palatinosansinformalcombold}{20pt}{2} -% \ShowCompleteFont{name:palatinonovaregular}{11pt}{2} -% \ShowCompleteFont{name:optimanovaltregular}{11pt}{2} - -\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-fnt-11.mkiv b/Master/texmf-dist/tex/context/base/s-fnt-11.mkiv new file mode 100644 index 00000000000..f2171ecd05a --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-fnt-11.mkiv @@ -0,0 +1,73 @@ +%D \module +%D [ file=s-fnt-11, +%D version=2006.02.01, % or so +%D title=\CONTEXT\ Style File, +%D subtitle=Listing Installed Fonts, +%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 code usd to be in the kernel but since it's hardly used +%D it's now a module. +%D +%D \starttyping +%D \showinstalledfonts[officinasans.*][all] +%D \showinstalledfonts[officinaserif.*][all] +%D \showinstalledfonts[officina.*itc.*][all] +%D +%D \showinstalledfonts[officina.*itc.*][all,new] +%D \stoptyping + +\startluacode +function fonts.names.table(pattern,reload,all) + local t = fonts.names.list(pattern,reload) + if t then + local NC, NR, HL = context.NC, context.NR, context.HL + context.start() + context.nonknuthmode() + context.starttabulate { "|T|T|T|T|T|" } + NC(false,hashname) + NC(false,type) + NC(false,fontname) + NC(false,filename) + NC() NR() HL() + for v,tv in table.sortedpairs(t) do + local kind, name, file = tv[1], tv[2], tv[3] + if all or v == string.lower(name) then + if kind and name and file then + NC(false,v) + NC(false,kind) + NC(false,name) + NC(false,file) + NC() NR() + else + logs.report("font table", "skipping %s", v) + end + end + end + context.stoptabulate() + context.stop() + end +end +\stopluacode + +\unprotect + +\def\showinstalledfonts + {\dodoubleempty\doshowinstalledfonts} + +\def\doshowinstalledfonts[#1][#2]% + {\bgroup + \def\pattern{#1}% + \def\all{false}% + \def\reload{false}% + \doifnothing\pattern{\def\pattern{.*}}% + \processallactionsinset[#2][\v!new=>\def\reload{true},\v!all=>\def\all{true}]% + \ctxlua{fonts.names.table("#1",\reload,\all)}% + \egroup} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/s-fnt-11.tex b/Master/texmf-dist/tex/context/base/s-fnt-11.tex deleted file mode 100644 index 8f855cc7214..00000000000 --- a/Master/texmf-dist/tex/context/base/s-fnt-11.tex +++ /dev/null @@ -1,61 +0,0 @@ -%D \module -%D [ file=s-fnt-11, -%D version=2006.02.01, % or so -%D title=\CONTEXT\ Style File, -%D subtitle=Listing Installed Fonts, -%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 code usd to be in the kernel but since it's hardly used -%D it's now a module. -%D -%D \starttyping -%D \showinstalledfonts[officinasans.*][all] -%D \showinstalledfonts[officinaserif.*][all] -%D \showinstalledfonts[officina.*itc.*][all] -%D -%D \showinstalledfonts[officina.*itc.*][all,new] -%D \stoptyping - -\startluacode -function fonts.names.table(pattern,reload,all) - local t = fonts.names.list(pattern,reload) - if t then - tex.sprint(tex.ctxcatcodes,"\\start\\nonknuthmode\\starttabulate[|T|T|T|T|T|]") - tex.sprint(tex.ctxcatcodes,"\\NC hashname\\NC type\\NC fontname\\NC filename\\NC\\NR\\HL") - for v,tv in table.sortedpairs(t) do - local kind, name, file = tv[1], tv[2], tv[3] - if all or v == string.lower(name) then - if kind and name and file then - tex.sprint(tex.ctxcatcodes,string.format("\\NC %s\\NC %s\\NC %s\\NC %s\\NC\\NR",v,kind,name,file)) - else - logs.report("font table", "skipping %s", v) - end - end - end - tex.sprint(tex.ctxcatcodes,"\\stoptabulate\\stop") - end -end -\stopluacode - -\unprotect - -\def\showinstalledfonts - {\dodoubleempty\doshowinstalledfonts} - -\def\doshowinstalledfonts[#1][#2]% - {\bgroup - \def\pattern{#1}% - \def\all{false}% - \def\reload{false}% - \doifnothing\pattern{\def\pattern{.*}}% - \processallactionsinset[#2][\v!new=>\def\reload{true},\v!all=>\def\all{true}]% - \ctxlua{fonts.names.table("#1",\reload,\all)}% - \egroup} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/s-fnt-20.mkiv b/Master/texmf-dist/tex/context/base/s-fnt-20.mkiv new file mode 100644 index 00000000000..a57c0ba4758 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-fnt-20.mkiv @@ -0,0 +1,140 @@ +%D \module +%D [ file=s-fnt-20, +%D version=2009.01.10, +%D title=\CONTEXT\ Style File, +%D subtitle=Tracing Feature Application (1), +%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 file is used by Idris and me in the process of getting the +%D best arabic fonts getting rendered best. As such it might change. + +% \setvariables +% [otftracker] +% [title=Reverse Chaining, +% figure=test-003-volt.pdf, +% font=husayni, +% sample={ببب بببب ببببب بببببب}] + +\def\checkedfeature#1#2{\ifnum\featureattribute{#1}=\zerocount#2\else#1\fi} + +% we can consider adding a dir key to features + +\definefontfeature + [otftracker-default] + [default] + [mode=node] + +\definefontfeature + [otftracker-arabtype] + [mode=node,analyze=yes, + language=dflt,script=arab,ccmp=yes, + init=yes,medi=yes,fina=yes,isol=yes, + liga=yes,dlig=yes,rlig=yes,clig=yes, + mark=yes,mkmk=yes,kern=yes,curs=yes] + +% \definefontfeature +% [otftracker-husayni] +% [analyze=yes,mode=node, +% language=dflt,script=arab,ccmp=yes, +% init=yes,medi=yes,fina=yes,isol=yes, +% calt=yes, +% mark=yes,mkmk=yes,kern=yes,curs=yes] + +\definefontfeature + [otftracker-husayni] + [analyze=yes,mode=node, + language=dflt,script=arab,ccmp=no, + init=yes,medi=yes,fina=yes, + rlig=yes, + ccmp=yes, + ss01=yes, % full Allah, Muhammad, Allahumma + ss05=yes, % full Jiim stacking + ss09=yes, % full Haa stacking + ss10=yes, % partial dipped Miim + % ss11=yes, % full dipped Miim + ss13=yes, % full stacked Miim + ss15=yes, % full stacked Laam-on-Miim + ss17=yes, % full stacked Ayn-on-Miim + ss19=yes, % LM_im + ss24=yes,ss25=yes,ss26=yes, % BX, LH_im, full Yaa.final specials + ss27=yes, % partial thin Miim.final + ss31=yes, % partial Raa.final contexts + ss34=yes, % partial Raa.final contexts + ss35=yes, % full Kaaf contexts + ss36=yes, % full Laam contexts + ss37=yes, % Miim-Miim contexts + ss38=yes, % fancy thin Haa.medial-Miim.final + ss39=yes, % high and low Baa strings + ss40=yes, % diagonal entry + ss41=yes, % initial alternates + % js06=yes,js08=yes,js10=yes,js11=yes,js17=yes, + % ttwl=yes, + mark=yes,mkmk=yes, + kern=yes,curs=yes] + +\definefontfeature + [otftracker-simplenaskhi] + [analyze=yes,mode=node, + language=dflt,script=arab, + init=yes,medi=yes,fina=yes,calt=yes, + rlig=yes,liga=yes,dlig=yes, + mark=yes,mkmk=yes,curs=yes] + +\setvalue{otftracker-direction-arabtype}{-1} +\setvalue{otftracker-direction-husayni}{-1} +\setvalue{otftracker-direction-simplenaskhi}{-1} + +\setvariables + [otftracker] + [font=Serif, + features=\checkedfeature{otftracker-\getvariable{otftracker}{font}}{otftracker-default}, + size=48pt, + figure=, + title=Feature Check, + sample=no sample, + direction=\executeifdefined{otftracker-direction-\getvariable{otftracker}{font}}{0}, + set=\setups{otftracker}] + +\setuplayout + [topspace=1.5cm, + backspace=1.5cm, + width=middle, + height=middle, + header=1.5cm, + footer=1.5cm] + +\setuphead + [chapter] + [header=high, + number=no] + +\setupfootertexts + [chapter] + +\setupalign + [flushleft] + +\setupcolors + [state=start] + +\startsetups otftracker + \setupbodyfont[tt,10pt] + \starttext + \chapter{\getvariable{otftracker}{title}} + \doifsomething {\getvariable{otftracker}{figure}} { + \startlinecorrection + \externalfigure[\getvariable{otftracker}{figure}] + \stoplinecorrection + } + \showotfcomposition + {\getvariable{otftracker}{font}*\getvariable{otftracker}{features} at \getvariable{otftracker}{size}} + {\getvariable{otftracker}{direction}} + {\getvariable{otftracker}{sample}} + \stoptext +\stopsetups diff --git a/Master/texmf-dist/tex/context/base/s-fnt-20.tex b/Master/texmf-dist/tex/context/base/s-fnt-20.tex deleted file mode 100644 index a57c0ba4758..00000000000 --- a/Master/texmf-dist/tex/context/base/s-fnt-20.tex +++ /dev/null @@ -1,140 +0,0 @@ -%D \module -%D [ file=s-fnt-20, -%D version=2009.01.10, -%D title=\CONTEXT\ Style File, -%D subtitle=Tracing Feature Application (1), -%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 file is used by Idris and me in the process of getting the -%D best arabic fonts getting rendered best. As such it might change. - -% \setvariables -% [otftracker] -% [title=Reverse Chaining, -% figure=test-003-volt.pdf, -% font=husayni, -% sample={ببب بببب ببببب بببببب}] - -\def\checkedfeature#1#2{\ifnum\featureattribute{#1}=\zerocount#2\else#1\fi} - -% we can consider adding a dir key to features - -\definefontfeature - [otftracker-default] - [default] - [mode=node] - -\definefontfeature - [otftracker-arabtype] - [mode=node,analyze=yes, - language=dflt,script=arab,ccmp=yes, - init=yes,medi=yes,fina=yes,isol=yes, - liga=yes,dlig=yes,rlig=yes,clig=yes, - mark=yes,mkmk=yes,kern=yes,curs=yes] - -% \definefontfeature -% [otftracker-husayni] -% [analyze=yes,mode=node, -% language=dflt,script=arab,ccmp=yes, -% init=yes,medi=yes,fina=yes,isol=yes, -% calt=yes, -% mark=yes,mkmk=yes,kern=yes,curs=yes] - -\definefontfeature - [otftracker-husayni] - [analyze=yes,mode=node, - language=dflt,script=arab,ccmp=no, - init=yes,medi=yes,fina=yes, - rlig=yes, - ccmp=yes, - ss01=yes, % full Allah, Muhammad, Allahumma - ss05=yes, % full Jiim stacking - ss09=yes, % full Haa stacking - ss10=yes, % partial dipped Miim - % ss11=yes, % full dipped Miim - ss13=yes, % full stacked Miim - ss15=yes, % full stacked Laam-on-Miim - ss17=yes, % full stacked Ayn-on-Miim - ss19=yes, % LM_im - ss24=yes,ss25=yes,ss26=yes, % BX, LH_im, full Yaa.final specials - ss27=yes, % partial thin Miim.final - ss31=yes, % partial Raa.final contexts - ss34=yes, % partial Raa.final contexts - ss35=yes, % full Kaaf contexts - ss36=yes, % full Laam contexts - ss37=yes, % Miim-Miim contexts - ss38=yes, % fancy thin Haa.medial-Miim.final - ss39=yes, % high and low Baa strings - ss40=yes, % diagonal entry - ss41=yes, % initial alternates - % js06=yes,js08=yes,js10=yes,js11=yes,js17=yes, - % ttwl=yes, - mark=yes,mkmk=yes, - kern=yes,curs=yes] - -\definefontfeature - [otftracker-simplenaskhi] - [analyze=yes,mode=node, - language=dflt,script=arab, - init=yes,medi=yes,fina=yes,calt=yes, - rlig=yes,liga=yes,dlig=yes, - mark=yes,mkmk=yes,curs=yes] - -\setvalue{otftracker-direction-arabtype}{-1} -\setvalue{otftracker-direction-husayni}{-1} -\setvalue{otftracker-direction-simplenaskhi}{-1} - -\setvariables - [otftracker] - [font=Serif, - features=\checkedfeature{otftracker-\getvariable{otftracker}{font}}{otftracker-default}, - size=48pt, - figure=, - title=Feature Check, - sample=no sample, - direction=\executeifdefined{otftracker-direction-\getvariable{otftracker}{font}}{0}, - set=\setups{otftracker}] - -\setuplayout - [topspace=1.5cm, - backspace=1.5cm, - width=middle, - height=middle, - header=1.5cm, - footer=1.5cm] - -\setuphead - [chapter] - [header=high, - number=no] - -\setupfootertexts - [chapter] - -\setupalign - [flushleft] - -\setupcolors - [state=start] - -\startsetups otftracker - \setupbodyfont[tt,10pt] - \starttext - \chapter{\getvariable{otftracker}{title}} - \doifsomething {\getvariable{otftracker}{figure}} { - \startlinecorrection - \externalfigure[\getvariable{otftracker}{figure}] - \stoplinecorrection - } - \showotfcomposition - {\getvariable{otftracker}{font}*\getvariable{otftracker}{features} at \getvariable{otftracker}{size}} - {\getvariable{otftracker}{direction}} - {\getvariable{otftracker}{sample}} - \stoptext -\stopsetups diff --git a/Master/texmf-dist/tex/context/base/s-fnt-21.mkiv b/Master/texmf-dist/tex/context/base/s-fnt-21.mkiv new file mode 100644 index 00000000000..dd8de398d0b --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-fnt-21.mkiv @@ -0,0 +1,46 @@ +%D \module +%D [ file=s-fnt-20, +%D version=2009.01.10, +%D title=\CONTEXT\ Style File, +%D subtitle=Tracing Feature Application (2), +%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 is related to: + +\usemodule[fnt-20] + +\setvariables + [otftracker] + [set=\setups{araball}] + +\startsetups araball + \begingroup + \setupcolors[state=start]% + \enabletrackers[otf.analyzing]% beware, kind of global + \ruledhbox \bgroup + \definedfont[\getvariable{otftracker}{font}*\getvariable{otftracker}{features} at \getvariable{otftracker}{size}]% + \ifnum\getvariable{otftracker}{direction}<0 \textdir TRT\else\ifnum\getvariable{otftracker}{direction}>0 \textdir TLT\fi\fi\relax + \getvariable{otftracker}{sample}% + \egroup + \disabletrackers[otf.analyzing]% + \endgroup +\stopsetups + +\def\ShowOtfTrackerSample#1% + {\doiffile{#1} + {\blank + \startlinecorrection + \vbox \bgroup + \forgetall + \setbox\scratchbox\hbox{\component #1 \relax} + \hbox{\copy\scratchbox\quad\lower\dp\scratchbox\hbox{\ruledhbox{\externalfigure[#1-volt.pdf][height=\htdp\scratchbox]}}} + \hbox{\strut\tttf#1}% + \egroup + \stoplinecorrection + \blank}} diff --git a/Master/texmf-dist/tex/context/base/s-fnt-21.tex b/Master/texmf-dist/tex/context/base/s-fnt-21.tex deleted file mode 100644 index dd8de398d0b..00000000000 --- a/Master/texmf-dist/tex/context/base/s-fnt-21.tex +++ /dev/null @@ -1,46 +0,0 @@ -%D \module -%D [ file=s-fnt-20, -%D version=2009.01.10, -%D title=\CONTEXT\ Style File, -%D subtitle=Tracing Feature Application (2), -%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 is related to: - -\usemodule[fnt-20] - -\setvariables - [otftracker] - [set=\setups{araball}] - -\startsetups araball - \begingroup - \setupcolors[state=start]% - \enabletrackers[otf.analyzing]% beware, kind of global - \ruledhbox \bgroup - \definedfont[\getvariable{otftracker}{font}*\getvariable{otftracker}{features} at \getvariable{otftracker}{size}]% - \ifnum\getvariable{otftracker}{direction}<0 \textdir TRT\else\ifnum\getvariable{otftracker}{direction}>0 \textdir TLT\fi\fi\relax - \getvariable{otftracker}{sample}% - \egroup - \disabletrackers[otf.analyzing]% - \endgroup -\stopsetups - -\def\ShowOtfTrackerSample#1% - {\doiffile{#1} - {\blank - \startlinecorrection - \vbox \bgroup - \forgetall - \setbox\scratchbox\hbox{\component #1 \relax} - \hbox{\copy\scratchbox\quad\lower\dp\scratchbox\hbox{\ruledhbox{\externalfigure[#1-volt.pdf][height=\htdp\scratchbox]}}} - \hbox{\strut\tttf#1}% - \egroup - \stoplinecorrection - \blank}} diff --git a/Master/texmf-dist/tex/context/base/s-fnt-23.mkiv b/Master/texmf-dist/tex/context/base/s-fnt-23.mkiv new file mode 100644 index 00000000000..1dc7367a462 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-fnt-23.mkiv @@ -0,0 +1,290 @@ +%D \module +%D [ file=s-fnt-23, +%D version=2009.03.04, +%D title=\CONTEXT\ Style File, +%D subtitle=Tracing Feature Application (3), +%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. + +% last_data was written wrong so it needs checking + +\startluacode + local fontdata = fonts.hashes.identifiers + local otfhandler = fonts.handlers.otf --- will be moduledata + + local last_data = nil + + local format = string.format + + function otfhandler.show_shape(n) + local tfmdata = fontdata[font.current()] + last_data = tfmdata + local charnum = tonumber(n) + if not charnum then + -- charnum = tfmdata.unicodes[n] + charnum = fonts.helpers.nametoslot(n) + end + local c = tfmdata.characters[charnum] + local d = tfmdata.descriptions[charnum] + local parameters = tfmdata.parameters + if d then + local factor = (parameters.size/parameters.units)*((7200/7227)/65536) + local llx, lly, urx, ury = unpack(d.boundingbox) + llx, lly, urx, ury = llx*factor, lly*factor, urx*factor, ury*factor + local width, italic = (d.width or 0)*factor, (d.italic or 0)*factor + local top_accent, bot_accent = (d.top_accent or 0)*factor, (d.bot_accent or 0)*factor + local anchors, math = d.anchors, d.math + context.startMPcode() + context("pickup pencircle scaled .25bp ; ") + context('picture p ; p := image(draw textext.drt("\\gray\\char%s");); draw p ;',charnum) + context('draw (%s,%s)--(%s,%s)--(%s,%s)--(%s,%s)--cycle withcolor green ;',llx,lly,urx,lly,urx,ury,llx,ury) + context('draw (%s,%s)--(%s,%s) withcolor green ;',llx,0,urx,0) + context('draw boundingbox p withcolor .2white withpen pencircle scaled .065bp ;') + context("defaultscale := 0.05 ; ") + -- inefficient but non critical + local function slant_1(v,dx,dy,txt,xsign,ysign,loc,labloc) + if #v > 0 then + local l = { } + for kk, vv in ipairs(v) do + local h, k = vv.height, vv.kern + if h and k then + l[#l+1] = format("((%s,%s) shifted (%s,%s))",xsign*k*factor,ysign*h*factor,dx,dy) + end + end + context("draw ((%s,%s) shifted (%s,%s))--%s dashed (evenly scaled .25) withcolor .5white;", xsign*v[1].kern*factor,lly,dx,dy,l[1]) + context("draw laddered (%s) withcolor .5white ;",table.concat(l,"..")) + context("draw ((%s,%s) shifted (%s,%s))--%s dashed (evenly scaled .25) withcolor .5white;", xsign*v[#v].kern*factor,ury,dx,dy,l[#l]) + for k, v in ipairs(l) do + context("draw %s withcolor blue withpen pencircle scaled 1bp;",v) + end + end + end + local function slant_2(v,dx,dy,txt,xsign,ysign,loc,labloc) + if #v > 0 then + local l = { } + for kk, vv in ipairs(v) do + local h, k = vv.height, vv.kern + if h and k then + l[#l+1] = format("((%s,%s) shifted (%s,%s))",xsign*k*factor,ysign*h*factor,dx,dy) + end + end + if loc == "top" then + context('label.%s("\\type{%s}",%s shifted (0,-1bp)) ;',loc,txt,l[#l]) + else + context('label.%s("\\type{%s}",%s shifted (0,2bp)) ;',loc,txt,l[1]) + end + for kk, vv in ipairs(v) do + local h, k = vv.height, vv.kern + if h and k then + context('label.top("(%s,%s)",%s shifted (0,-2bp));',k,h,l[kk]) + end + end + end + end + if math then + local kerns = math.kerns + if kerns then + for _, slant in ipairs { slant_1, slant_2 } do + for k,v in pairs(kerns) do + if k == "top_right" then + slant(v,width+italic,0,k,1,1,"top","ulft") + elseif k == "bottom_right" then + slant(v,width,0,k,1,1,"bot","lrt") + elseif k == "top_left" then + slant(v,0,0,k,-1,1,"top","ulft") + elseif k == "bottom_left" then + slant(v,0,0,k,-1,1,"bot","lrt") + end + end + end + end + end + local function show(x,y,txt) + local xx, yy = x*factor, y*factor + context("draw (%s,%s) withcolor blue withpen pencircle scaled 1bp;",xx,yy) + context('label.top("\\type{%s}",(%s,%s-2bp)) ;',txt,xx,yy) + context('label.bot("(%s,%s)",(%s,%s+2bp)) ;',x,y,xx,yy) + end + if anchors then + local a = anchors.baselig + if a then + for k, v in pairs(a) do + for kk, vv in ipairs(v) do + show(vv[1],vv[2],k .. ":" .. kk) + end + end + end + local a = anchors.mark + if a then + for k, v in pairs(a) do + show(v[1],v[2],k) + end + end + local a = anchors.basechar + if a then + for k, v in pairs(a) do + show(v[1],v[2],k) + end + end + local ba = anchors.centry + if a then + for k, v in pairs(a) do + show(v[1],v[2],k) + end + end + local a = anchors.cexit + if a then + for k, v in pairs(a) do + show(v[1],v[2],k) + end + end + end + if italic ~= 0 then + context('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue;',width,ury,width,ury) + context('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue;',width+italic,ury,width+italic,ury) + context('draw (%s,%s-1bp)--(%s,%s-1bp) withcolor blue;',width,ury,width+italic,ury) + context('label.lft("\\type{%s}",(%s+2bp,%s-1bp));',"italic",width,ury) + context('label.rt("%s",(%s-2bp,%s-1bp));',d.italic,width+italic,ury) + end + if top_accent ~= 0 then + context('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',top_accent,ury,top_accent,ury) + context('label.bot("\\type{%s}",(%s,%s+1bp));',"top_accent",top_accent,ury) + context('label.top("%s",(%s,%s-1bp));',d.top_accent,top_accent,ury) + end + if bot_accent ~= 0 then + context('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',bot_accent,lly,bot_accent,lly) + context('label.top("\\type{%s}",(%s,%s-1bp));',"bot_accent",top_accent,ury) + context('label.bot("%s",(%s,%s+1bp));',d.bot_accent,bot_accent,lly) + end + context('draw origin withcolor red withpen pencircle scaled 1bp;') + context("setbounds currentpicture to boundingbox currentpicture enlarged 1bp ;") + context("currentpicture := currentpicture scaled 8 ;") + context.stopMPcode() + elseif c then + local factor = (7200/7227)/65536 + context.startMPcode() + context("pickup pencircle scaled .25bp ; ") + context('picture p ; p := image(draw textext.drt("\\gray\\char%s");); draw p ;',charnum) + context('draw boundingbox p withcolor .2white withpen pencircle scaled .065bp ;') + context("defaultscale := 0.05 ; ") + local italic, top_accent, bot_accent = (c.italic or 0)*factor, (c.top_accent or 0)*factor, (c.bot_accent or 0)*factor + local width, height, depth = (c.width or 0)*factor, (c.height or 0)*factor, (c.depth or 0)*factor + local ury = height + if italic ~= 0 then + context('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue;',width,ury,width,ury) + context('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue;',width+italic,ury,width+italic,ury) + context('draw (%s,%s-1bp)--(%s,%s-1bp) withcolor blue;',width,ury,width+italic,height) + context('label.lft("\\type{%s}",(%s+2bp,%s-1bp));',"italic",width,height) + context('label.rt("%6.3f bp",(%s-2bp,%s-1bp));',italic,width+italic,height) + end + if top_accent ~= 0 then + context('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',top_accent,ury,top_accent,height) + context('label.bot("\\type{%s}",(%s,%s+1bp));',"top_accent",top_accent,height) + context('label.top("%6.3f bp",(%s,%s-1bp));',top_accent,top_accent,height) + end + if bot_accent ~= 0 then + context('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',bot_accent,lly,bot_accent,height) + context('label.top("\\type{%s}",(%s,%s-1bp));',"bot_accent",top_accent,height) + context('label.bot("%6.3f bp",(%s,%s+1bp));',bot_accent,bot_accent,height) + end + context('draw origin withcolor red withpen pencircle scaled 1bp;') + context("setbounds currentpicture to boundingbox currentpicture enlarged 1bp ;") + context("currentpicture := currentpicture scaled 8 ;") + context.stopMPcode() + else + context("no such shape: %s",n) + end + end + function otfhandler.show_all_shapes(start,stop) + local tfmdata = fontdata[font.current()] + last_data = tfmdata + start, stop = start or "\\startTEXpage\\gobbleoneargument", stop or "\\stopTEXpage" + local unicodes, descriptions = tfmdata.unicodes, tfmdata.descriptions + for unicode, description in fonts.iterators.descriptions(tfmdata) do + local name = description.name + context("%s{%s}%%",start,unicode) + context("\\writestatus{glyph}{U+%04X -> %s}%%",unicode,name) + otfhandler.show_shape(unicode) + context(stop) + end + end + function otfhandler.show_shape_field(unicode,name) + local tfmdata = last_data or fontdata[font.current()] + local d = tfmdata.descriptions[unicode] + if d then + if name == "unicode" then + context("U+%04X",unicode) + else + d = d[name] + if d then + context(d) + end + end + end + end +\stopluacode + +\setupcolors + [state=start] + +\def\GetGlyphField#1#2% + {\ctxlua{fonts.handlers.otf.show_shape_field(#1,"#2")}} + +\def\StartShowGlyphShape#1% + {\startTEXpage + \nonknuthmode + \def\GlyphUnicode{#1}} + +\def\StopShowGlyphShape + {\par + \midaligned{\tttf\setstrut\strut\GetGlyphField\GlyphUnicode{unicode}: \GetGlyphField\GlyphUnicode{name}}% + \stopTEXpage} + +\def\ShowGlyphShape#1#2#3% name size glyph + {\begingroup + \definedfont[#1 at #2]% + \obeyMPboxdepth + \ctxlua{fonts.handlers.otf.show_shape("#3")}% + \endgroup} + +\def\ShowAllGlyphShapes#1#2% name size + {\begingroup + \nonknuthmode + \definedfont[#1 at #2]% + \ctxlua{fonts.handlers.otf.show_all_shapes("\\StartShowGlyphShape","\\StopShowGlyphShape")}% + \endgroup} + +\setupcolors + [state=start] + +\doifnotmode{demo}{\endinput} + +\starttext + +% \startTEXpage \ShowGlyphShape{simplenaskhi}{100bp}{0x62A} \stopTEXpage +% \startTEXpage \ShowGlyphShape{simplenaskhi}{100bp}{0x2004} \stopTEXpage +% \startTEXpage \ShowGlyphShape{simplenaskhi}{100bp}{0xF0299} \stopTEXpage +% \startTEXpage \ShowGlyphShape{simplenaskhi}{100bp}{NameMe.1190} \stopTEXpage + +% \ShowAllGlyphShapes{simplenaskhi}{100bp} +% \ShowAllGlyphShapes{xits}{100bp} + +\switchtobodyfont[cambria,10pt] + +\startTEXpage[offset=10pt] \ShowGlyphShape{name:cambria-math} {40bp}{0x00066} \stopTEXpage +\startTEXpage[offset=10pt] \ShowGlyphShape{name:cambria-math} {40bp}{0x1D453} \stopTEXpage +\startTEXpage[offset=10pt] \ShowGlyphShape{name:cambria-math} {40bp}{0x1D43F} \stopTEXpage +\startTEXpage[offset=10pt] \ShowGlyphShape{name:cambria-math}{100bp}{0x1D444} \stopTEXpage +\startTEXpage[offset=10pt] \ShowGlyphShape{name:cambria-math}{100bp}{0x1D447} \stopTEXpage +\startTEXpage[offset=10pt] \ShowGlyphShape{name:cambria-math}{100bp}{0x02112} \stopTEXpage +\startTEXpage[offset=10pt] \ShowGlyphShape{name:cambria-math}{100bp}{0x1D432} \stopTEXpage +\startTEXpage[offset=10pt] \ShowGlyphShape{name:cambria-math}{100bp}{0x1D43D} \stopTEXpage +\startTEXpage[offset=10pt] \ShowGlyphShape{name:cambria-math}{100bp}{0x1D44A} \stopTEXpage +\startTEXpage[offset=10pt] \ShowGlyphShape{name:cambria-math}{100bp}{0x1D45D} \stopTEXpage + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-fnt-23.tex b/Master/texmf-dist/tex/context/base/s-fnt-23.tex deleted file mode 100644 index 096c8fbf5ed..00000000000 --- a/Master/texmf-dist/tex/context/base/s-fnt-23.tex +++ /dev/null @@ -1,272 +0,0 @@ -%D \module -%D [ file=s-fnt-23, -%D version=2009.03.04, -%D title=\CONTEXT\ Style File, -%D subtitle=Tracing Feature Application (3), -%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. - -\startluacode - local last_data = nil - local format = string.format - local function tpf(...) --- print("!!!!",...) - tex.print(tex.ctxcatcodes,format(...)) - end - function fonts.otf.show_shape(n) - local tfmdata = fonts.ids[font.current()] - lastdata = tfmdata - local charnum = tonumber(n) - if not charnum then - charnum = tfmdata.unicodes[n] - end - local c = tfmdata.characters[charnum] - local d = tfmdata.descriptions[charnum] - if d then - local factor = (tfmdata.size/tfmdata.units)*((7200/7227)/65536) - local llx, lly, urx, ury = unpack(d.boundingbox) - llx, lly, urx, ury = llx*factor, lly*factor, urx*factor, ury*factor - local width, italic = (d.width or 0)*factor, (d.italic or 0)*factor - local top_accent, bot_accent = (d.top_accent or 0)*factor, (d.bot_accent or 0)*factor - local anchors, math = d.anchors, d.math - tpf("\\startMPcode") - tpf("pickup pencircle scaled .25bp ; ") - tpf('picture p ; p := image(draw textext.drt("\\gray\\char%s");); draw p ;',charnum) - tpf('draw (%s,%s)--(%s,%s)--(%s,%s)--(%s,%s)--cycle withcolor green ;',llx,lly,urx,lly,urx,ury,llx,ury) - tpf('draw (%s,%s)--(%s,%s) withcolor green ;',llx,0,urx,0) - tpf('draw boundingbox p withcolor .2white withpen pencircle scaled .065bp ;') - tpf("defaultscale := 0.05 ; ") - -- inefficient but non critical - local function slant_1(v,dx,dy,txt,xsign,ysign,loc,labloc) - if #v > 0 then - local l = { } - for kk, vv in ipairs(v) do - local h, k = vv.height, vv.kern - if h and k then - l[#l+1] = format("((%s,%s) shifted (%s,%s))",xsign*k*factor,ysign*h*factor,dx,dy) - end - end - tpf("draw ((%s,%s) shifted (%s,%s))--%s dashed (evenly scaled .25) withcolor .5white;", xsign*v[1].kern*factor,lly,dx,dy,l[1]) - tpf("draw laddered (%s) withcolor .5white ;",table.concat(l,"..")) - tpf("draw ((%s,%s) shifted (%s,%s))--%s dashed (evenly scaled .25) withcolor .5white;", xsign*v[#v].kern*factor,ury,dx,dy,l[#l]) - for k, v in ipairs(l) do - tpf("draw %s withcolor blue withpen pencircle scaled 1bp;",v) - end - end - end - local function slant_2(v,dx,dy,txt,xsign,ysign,loc,labloc) - if #v > 0 then - local l = { } - for kk, vv in ipairs(v) do - local h, k = vv.height, vv.kern - if h and k then - l[#l+1] = format("((%s,%s) shifted (%s,%s))",xsign*k*factor,ysign*h*factor,dx,dy) - end - end - if loc == "top" then - tpf('label.%s("\\type{%s}",%s shifted (0,-1bp)) ;',loc,txt,l[#l]) - else - tpf('label.%s("\\type{%s}",%s shifted (0,2bp)) ;',loc,txt,l[1]) - end - for kk, vv in ipairs(v) do - local h, k = vv.height, vv.kern - if h and k then - tpf('label.top("(%s,%s)",%s shifted (0,-2bp));',k,h,l[kk]) - end - end - end - end - if math then - local kerns = math.kerns - if kerns then - for _, slant in ipairs { slant_1, slant_2 } do - for k,v in pairs(kerns) do - if k == "top_right" then - slant(v,width+italic,0,k,1,1,"top","ulft") - elseif k == "bottom_right" then - slant(v,width,0,k,1,1,"bot","lrt") - elseif k == "top_left" then - slant(v,0,0,k,-1,1,"top","ulft") - elseif k == "bottom_left" then - slant(v,0,0,k,-1,1,"bot","lrt") - end - end - end - end - end - local function show(x,y,txt) - local xx, yy = x*factor, y*factor - tpf("draw (%s,%s) withcolor blue withpen pencircle scaled 1bp;",xx,yy) - tpf('label.top("\\type{%s}",(%s,%s-2bp)) ;',txt,xx,yy) - tpf('label.bot("(%s,%s)",(%s,%s+2bp)) ;',x,y,xx,yy) - end - if anchors then - local a = anchors.baselig - if a then - for k, v in pairs(a) do - for kk, vv in ipairs(v) do - show(vv[1],vv[2],k .. ":" .. kk) - end - end - end - local a = anchors.mark - if a then - for k, v in pairs(a) do - show(v[1],v[2],k) - end - end - local a = anchors.basechar - if a then - for k, v in pairs(a) do - show(v[1],v[2],k) - end - end - local ba = anchors.centry - if a then - for k, v in pairs(a) do - show(v[1],v[2],k) - end - end - local a = anchors.cexit - if a then - for k, v in pairs(a) do - show(v[1],v[2],k) - end - end - end - if italic ~= 0 then - tpf('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue;',width,ury,width,ury) - tpf('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue;',width+italic,ury,width+italic,ury) - tpf('draw (%s,%s-1bp)--(%s,%s-1bp) withcolor blue;',width,ury,width+italic,ury) - tpf('label.lft("\\type{%s}",(%s+2bp,%s-1bp));',"italic",width,ury) - tpf('label.rt("%s",(%s-2bp,%s-1bp));',d.italic,width+italic,ury) - end - if top_accent ~= 0 then - tpf('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',top_accent,ury,top_accent,ury) - tpf('label.bot("\\type{%s}",(%s,%s+1bp));',"top_accent",top_accent,ury) - tpf('label.top("%s",(%s,%s-1bp));',d.top_accent,top_accent,ury) - end - if bot_accent ~= 0 then - tpf('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',bot_accent,lly,bot_accent,lly) - tpf('label.top("\\type{%s}",(%s,%s-1bp));',"bot_accent",top_accent,ury) - tpf('label.bot("%s",(%s,%s+1bp));',d.bot_accent,bot_accent,lly) - end - tpf('draw origin withcolor red withpen pencircle scaled 1bp;') - tpf("setbounds currentpicture to boundingbox currentpicture enlarged 1bp ;") - tpf("currentpicture := currentpicture scaled 8 ;") - tpf("\\stopMPcode") - elseif c then - local factor = (7200/7227)/65536 - tpf("\\startMPcode") - tpf("pickup pencircle scaled .25bp ; ") - tpf('picture p ; p := image(draw textext.drt("\\gray\\char%s");); draw p ;',charnum) - tpf('draw boundingbox p withcolor .2white withpen pencircle scaled .065bp ;') - tpf("defaultscale := 0.05 ; ") - local italic, top_accent, bot_accent = (c.italic or 0)*factor, (c.top_accent or 0)*factor, (c.bot_accent or 0)*factor - local width, height, depth = (c.width or 0)*factor, (c.height or 0)*factor, (c.depth or 0)*factor - local ury = height - if italic ~= 0 then - tpf('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue;',width,ury,width,ury) - tpf('draw (%s,%s-1bp)--(%s,%s-0.5bp) withcolor blue;',width+italic,ury,width+italic,ury) - tpf('draw (%s,%s-1bp)--(%s,%s-1bp) withcolor blue;',width,ury,width+italic,height) - tpf('label.lft("\\type{%s}",(%s+2bp,%s-1bp));',"italic",width,height) - tpf('label.rt("%6.3f bp",(%s-2bp,%s-1bp));',italic,width+italic,height) - end - if top_accent ~= 0 then - tpf('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',top_accent,ury,top_accent,height) - tpf('label.bot("\\type{%s}",(%s,%s+1bp));',"top_accent",top_accent,height) - tpf('label.top("%6.3f bp",(%s,%s-1bp));',top_accent,top_accent,height) - end - if bot_accent ~= 0 then - tpf('draw (%s,%s+1bp)--(%s,%s-1bp) withcolor blue;',bot_accent,lly,bot_accent,height) - tpf('label.top("\\type{%s}",(%s,%s-1bp));',"bot_accent",top_accent,height) - tpf('label.bot("%6.3f bp",(%s,%s+1bp));',bot_accent,bot_accent,height) - end - tpf('draw origin withcolor red withpen pencircle scaled 1bp;') - tpf("setbounds currentpicture to boundingbox currentpicture enlarged 1bp ;") - tpf("currentpicture := currentpicture scaled 8 ;") - tpf("\\stopMPcode") - else - tpf("no such shape: %s",n) - end - end - function fonts.otf.show_all_shapes(start,stop) - local tfmdata = fonts.ids[font.current()] - lastdata = tfmdata - start, stop = start or "\\startTEXpage\\gobbleoneargument", stop or "\\stopTEXpage" - local unicodes, indices, descriptions = tfmdata.unicodes, tfmdata.indices, tfmdata.descriptions - for _, unicode in next, table.sortedkeys(descriptions) do - local d = descriptions[unicode] - local name = d.name - tpf("%s{%s}%%",start,unicode) - tpf("\\writestatus{glyph}{U+%04X -> %s}%%",unicode,name) - fonts.otf.show_shape(unicode) - tpf(stop) - end - end - function fonts.otf.show_shape_field(unicode,name) - local tfmdata = lastdata or fonts.ids[font.current()] - local d = tfmdata.descriptions[unicode] - if d then - if name == "unicode" then - tpf("U+%04X",unicode) - else - d = d[name] - if d then - tpf(d) - end - end - end - end -\stopluacode - -\setupcolors - [state=start] - -\def\GetGlyphField#1#2% - {\ctxlua{fonts.otf.show_shape_field(#1,"#2")}} - -\def\StartShowGlyphShape#1% - {\startTEXpage - \nonknuthmode - \def\GlyphUnicode{#1}} - -\def\StopShowGlyphShape - {\par - \midaligned{\tttf\setstrut\strut\GetGlyphField\GlyphUnicode{unicode}: \GetGlyphField\GlyphUnicode{name}}% - \stopTEXpage} - -\def\ShowGlyphShape#1#2#3% name size glyph - {\begingroup - \definedfont[#1 at #2]% - \obeyMPboxdepth - \ctxlua{fonts.otf.show_shape("#3")}% - \endgroup} - -\def\ShowAllGlyphShapes#1#2% name size - {\begingroup - \nonknuthmode - \definedfont[#1 at #2]% - \ctxlua{fonts.otf.show_all_shapes("\\StartShowGlyphShape","\\StopShowGlyphShape")}% - \endgroup} - -\setupcolors - [state=start] - -\doifnotmode{demo}{\endinput} - -\starttext - -\startTEXpage \ShowGlyphShape{simplenaskhi}{100bp}{0x62A} \stopTEXpage -\startTEXpage \ShowGlyphShape{simplenaskhi}{100bp}{0x2004} \stopTEXpage -\startTEXpage \ShowGlyphShape{simplenaskhi}{100bp}{0xF0299} \stopTEXpage -\startTEXpage \ShowGlyphShape{simplenaskhi}{100bp}{NameMe.1190} \stopTEXpage - -\ShowAllGlyphShapes{simplenaskhi}{100bp} - -\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-fnt-24.mkiv b/Master/texmf-dist/tex/context/base/s-fnt-24.mkiv new file mode 100644 index 00000000000..de485557b91 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-fnt-24.mkiv @@ -0,0 +1,83 @@ +%D \module +%D [ file=s-fnt-24, +%D version=2009.02.06, +%D title=\CONTEXT\ Style File, +%D subtitle=CJK Glyph Combination Testing, +%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\ShowChineseCombiChar#1#2#3#4% + {\blank[small] + \dontleavehmode + \hbox\bgroup + \dontcomplain + \setstrut + \hbox to 7em{\ruledhbox{\char#1}\hskip.25em\type{+}\hskip.25em\ruledhbox{\char#2}\hskip.25em\type{=}\hskip.25em\ruledhbox{\char#1\char#2}\hss}\relax + \ruledvtop{\hsize1em\char#1\char#2}\relax + \hskip2em + \ruledvtop{\hsize.625em\char#1\char#2}\relax + \hskip2em + \ruledvtop{\hsize1.5em\char#1\char#2}\relax + \hskip2em + \type{#3 + #4}\relax + \egroup + \blank[small]} + +\startluacode +local example = { + korean = 0x0AC00, + chinese = 0x04E55, + full_width_open = 0x03008, + full_width_close = 0x03009, + half_width_open = 0x02018, + half_width_close = 0x02019, + hyphen = 0x02026, + non_starter = 0x03005, + other = 0x0004D, -- M +} + +function fonts.analyzers.cjktest(first,second) + for k, v in next, example do + if (not first or first == "") or first == k then + for kk, vv in next, example do + if (not second or second == "") or second == kk then + context.ShowChineseCombiChar(v,vv,k,kk) + end + end + end + end +end +\stopluacode + +\def\ShowCombinationsKorean + {\dodoubleempty\doShowCombinationsKorean} + +\def\doShowCombinationsKorean[#1][#2]% + {\startpacked + \setscript[hangul] + \setupcolors[\c!state=\v!start] + \enabletrackers[cjk.analyzing] + \ctxlua{fonts.analyzers.cjktest("#1","#2")}\par % ! + \disabletrackers[cjk.analyzing] + \stoppacked} + +\def\ShowCombinationsChinese + {\dodoubleempty\doShowCombinationsChinese} + +\def\doShowCombinationsChinese[#1][#2]% + {\startpacked + \setscript[hanzi] + \setupcolors[\c!state=\v!start] + \enabletrackers[cjk.analyzing] + \ctxlua{fonts.analyzers.cjktest("#1","#2")}\par % ! + \disabletrackers[cjk.analyzing] + \stoppacked} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/s-fnt-24.tex b/Master/texmf-dist/tex/context/base/s-fnt-24.tex deleted file mode 100644 index 073588033e2..00000000000 --- a/Master/texmf-dist/tex/context/base/s-fnt-24.tex +++ /dev/null @@ -1,83 +0,0 @@ -%D \module -%D [ file=s-fnt-24, -%D version=2009.02.06, -%D title=\CONTEXT\ Style File, -%D subtitle=CJK Glyph Combination Testing, -%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\ShowChineseCombiChar#1#2#3#4% - {\blank[small] - \dontleavehmode - \hbox\bgroup - \dontcomplain - \setstrut - \hbox to 7em{\ruledhbox{\char#1}\hskip.25em\type{+}\hskip.25em\ruledhbox{\char#2}\hskip.25em\type{=}\hskip.25em\ruledhbox{\char#1\char#2}\hss}\relax - \ruledvtop{\hsize1em\char#1\char#2}\relax - \hskip2em - \ruledvtop{\hsize.625em\char#1\char#2}\relax - \hskip2em - \ruledvtop{\hsize1.5em\char#1\char#2}\relax - \hskip2em - \type{#3 + #4}\relax - \egroup - \blank[small]} - -\startluacode -local example = { - korean = 0x0AC00, - chinese = 0x04E55, - full_width_open = 0x03008, - full_width_close = 0x03009, - half_width_open = 0x02018, - half_width_close = 0x02019, - hyphen = 0x02026, - non_starter = 0x03005, - other = 0x0004D, -- M -} - -function fonts.analyzers.cjktest(first,second) - for k, v in next, example do - if (not first or first == "") or first == k then - for kk, vv in next, example do - if (not second or second == "") or second == kk then - tex.sprint(tex.ctxcatcodes,string.format("\\ShowChineseCombiChar{%s}{%s}{%s}{%s}",v,vv,k,kk)) - end - end - end - end -end -\stopluacode - -\def\ShowCombinationsKorean - {\dodoubleempty\doShowCombinationsKorean} - -\def\doShowCombinationsKorean[#1][#2]% - {\startpacked - \setscript[hangul] - \setupcolors[\c!state=\v!start] - \enabletrackers[cjk.analyzing] - \ctxlua{fonts.analyzers.cjktest("#1","#2")}\par % ! - \disabletrackers[cjk.analyzing] - \stoppacked} - -\def\ShowCombinationsChinese - {\dodoubleempty\doShowCombinationsChinese} - -\def\doShowCombinationsChinese[#1][#2]% - {\startpacked - \setscript[hanzi] - \setupcolors[\c!state=\v!start] - \enabletrackers[cjk.analyzing] - \ctxlua{fonts.analyzers.cjktest("#1","#2")}\par % ! - \disabletrackers[cjk.analyzing] - \stoppacked} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/s-fnt-25.mkiv b/Master/texmf-dist/tex/context/base/s-fnt-25.mkiv new file mode 100644 index 00000000000..159d8325d50 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-fnt-25.mkiv @@ -0,0 +1,198 @@ +%D \module +%D [ file=s-fnt-25, +%D version=2009.01.25, +%D title=\CONTEXT\ Style File, +%D subtitle=Math Glyph 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. + +\def\enableshowmathfontvirtual + {\ctxlua{fonts.constructors.autocleanup=false}} + +\def\showmathfontcharacters + {\dodoubleempty\doshowmathfontcharacters} + +\def\doshowmathfontcharacters[#1][#2]% + {\begingroup + \dontcomplain + \doifelsenothing{#1} + {\definedfont[MathRoman*math-text]} + {\definedfont[#1]}% + \doifelsenothing{#2} + {\ctxlua{document.showmathfont(font.current())}} + {\def\dodoshowmathfontcharacters##1{\ctxlua{document.showmathfont(font.current(),##1)}}% + \processcommalist[#2]\dodoshowmathfontcharacters}% + \endgroup} + +\def\startmathfontlist + {\startpacked} + +\def\stopmathfontlist + {\stoppacked} + +\def\startmathfontlistentry + {\blank + \begingroup} + +\def\stopmathfontlistentry + {\endgroup + \blank} + +\def\mathfontlistentryhexdectit#1#2#3% + {#1: \char#2\enspace\ruledhbox{\char#2}\enspace#3\par + \advance\leftskip 1em\relax} + +\def\mathfontlistentrywdhtdpic#1#2#3#4% + {width: #1, height: #2, depth: #3, italic: #4\par} + +\def\mathfontlistentryresource#1% + {virtual: #1\par} + +\def\mathfontlistentrynext#1#2% + {#1~\ruledhbox{\char#2}} + +\def\mathfontlistentrynextlist#1% + {next: #1\par} + +\def\fontlistentryvariants#1#2% + {#1~\ruledhbox{\char#2}} + +\def\mathfontlistentryvariantslist#1% + {variants: #1\par} + +\def\mathfontlistentrynextvariantslist#1#2% + {next: #1 => variants: #2\par} + +\def\mathfontlistentryclassname#1#2% + {mathclass: #1, mathname: #2\par} + +\def\mathfontlistentrysymbol#1#2% + {mathsymbol: #1~\ruledhbox{\char#2}\par} + +\startluacode +local concat = table.concat +local format, lower = string.format, string.lower + +local fontdata = fonts.hashes.identifiers + +function document.showmathfont(id,slot) + local data = characters.data + local tfmdata = fontdata[id] + local characters = tfmdata.characters + local sorted = (slot and { slot }) or table.sortedkeys(characters) + local virtual, names = tfmdata.properties.virtualized, { } + if virtual then + for k, v in ipairs(tfmdata.fonts) do + local id = v.id + local name = fontdata[id].properties.name + names[k] = (name and file.basename(name)) or id + end + end + local round = math.round + local limited = true + for _, s in next, sorted do + if not limited or s < 0xF0000 then + local char = characters[s] + if char then + local info = data[s] + local cnext, cvert_variants, choriz_variants = char.next, char.vert_variants, char.horiz_variants + context.startmathfontlistentry() + context.mathfontlistentryhexdectit(format("U+%05X",s),s,lower(info.description or "no description, private to font")) + context.mathfontlistentrywdhtdpic(round(char.width or 0),round(char.height or 0),round(char.depth or 0),round(char.italic or 0)) + if virtual then + local commands = char.commands + if commands then + local t = { } + for i=1,#commands do + local ci = commands[i] + if ci[1] == "slot" then + local fnt, idx = ci[2], ci[3] + t[#t+1] = format("%s/%0X",names[fnt] or fnt,idx) + end + end + if #t > 0 then + context.mathfontlistentryresource(concat(t,", ")) + end + end + end + if info.mathclass then + context.mathfontlistentryclassname(info.mathclass,info.mathname or "no name") + end + if info.mathspec then + for i=1,#info.mathspec do + context.mathfontlistentryclassname(info.mathspec[i].class,info.mathspec[i].name or "no name") + end + end + if info.mathsymbol then + context.mathfontlistentrysymbol(format("U+%05X",info.mathsymbol),info.mathsymbol) + end + if cnext then + local t, done = { }, { } + while cnext do + if done[cnext] then + t[#t+1] = "CYCLE" + break + else + done[cnext] = true + t[#t+1] = context.nested.mathfontlistentrynext(format("U+%05X",cnext),cnext) + cnext = characters[cnext] + cvert_variants = cnext.vert_variants or cvert_variants + choriz_variants = cnext.horiz_variants or choriz_variants + if cnext then + cnext = cnext.next + end + end + end + cnext = t + end + if cvert_variants then + local t = { } + for k, v in next, cvert_variants do + t[#t+1] = context.nested.fontlistentryvariants(format("U+%05X",v.glyph),v.glyph) + end + cvert_variants = t + end + if choriz_variants then + local t = { } + for k, v in next, choriz_variants do + t[#t+1] = context.nested.fontlistentryvariants(format("U+%05X",v.glyph),v.glyph) + end + choriz_variants = t + end + local cvariants = choriz_variants or cvert_variants + if cvariants and cnext then + context.mathfontlistentrynextvariantslist(concat(cnext," => "),concat(cvariants," => ")) + else + if cnext then + context.mathfontlistentrynextlist(concat(cnext," => ")) + end + if cvariants then + context.mathfontlistentryvariantslist(concat(cvariants," ")) + end + end + context.stopmathfontlistentry() + end + end + end +end +\stopluacode + +\doifnotmode{demo}{\endinput} + +\starttext + \setupbodyfont[cambria, 12pt] \showmathfontcharacters +% \setupbodyfont[lmvirtual,12pt] \showmathfontcharacters +% \setupbodyfont[pxvirtual,12pt] \showmathfontcharacters +% \setupbodyfont[txvirtual,12pt] \showmathfontcharacters +% \setupbodyfont[palatino, 10pt] \showmathfontcharacters +% \setupbodyfont[mathtimes,12pt] \showmathfontcharacters +% \setupbodyfont[stix, 12pt] \showmathfontcharacters +% \setupbodyfont[xits, 12pt] \showmathfontcharacters +% \setupbodyfont[lucida, 12pt] \showmathfontcharacters +\stoptext + diff --git a/Master/texmf-dist/tex/context/base/s-fnt-25.tex b/Master/texmf-dist/tex/context/base/s-fnt-25.tex deleted file mode 100644 index a8b398716c7..00000000000 --- a/Master/texmf-dist/tex/context/base/s-fnt-25.tex +++ /dev/null @@ -1,194 +0,0 @@ -%D \module -%D [ file=s-fnt-25, -%D version=2009.01.25, -%D title=\CONTEXT\ Style File, -%D subtitle=Math Glyph 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. - -\def\enableshowmathfontvirtual - {\ctxlua{fonts.tfm.auto_cleanup=false}} - -\def\showmathfontcharacters - {\dodoubleempty\doshowmathfontcharacters} - -\def\doshowmathfontcharacters[#1][#2]% - {\begingroup - \dontcomplain - \doifelsenothing{#1} - {\definedfont[MathRoman*math-text]} - {\definedfont[#1]}% - \doifelsenothing{#2} - {\ctxlua{document.showmathfont(font.current())}} - {\def\dodoshowmathfontcharacters##1{\ctxlua{document.showmathfont(font.current(),##1)}}% - \processcommalist[#2]\dodoshowmathfontcharacters}% - \endgroup} - -\def\startmathfontlist - {\startpacked} - -\def\stopmathfontlist - {\stoppacked} - -\def\startmathfontlistentry - {\blank - \begingroup} - -\def\stopmathfontlistentry - {\endgroup - \blank} - -\def\mathfontlistentryhexdectit#1#2#3% - {#1: \char#2\enspace\ruledhbox{\char#2}\enspace#3\par - \advance\leftskip 1em\relax} - -\def\mathfontlistentrywdhtdpic#1#2#3#4% - {width: #1, height: #2, depth: #3, italic: #4\par} - -\def\mathfontlistentryresource#1% - {virtual: #1\par} - -\def\mathfontlistentrynext#1#2% - {#1~\ruledhbox{\char#2}} - -\def\mathfontlistentrynextlist#1% - {next: #1\par} - -\def\fontlistentryvariants#1#2% - {#1~\ruledhbox{\char#2}} - -\def\mathfontlistentryvariantslist#1% - {variants: #1\par} - -\def\mathfontlistentrynextvariantslist#1#2% - {next: #1 => variants: #2\par} - -\def\mathfontlistentryclassname#1#2% - {mathclass: #1, mathname: #2\par} - -\def\mathfontlistentrysymbol#1#2% - {mathsymbol: #1~\ruledhbox{\char#2}\par} - -\startluacode -function document.showmathfont(id,slot) - local data = characters.data - local tfmdata = fonts.ids[id] - local characters = tfmdata.characters - local sorted = (slot and { slot }) or table.sortedkeys(characters) - local function report(...) - tex.sprint(tex.ctxcatcodes,string.format(...)) - end - local virtual, names = tfmdata.type == "virtual", { } - if virtual then - for k, v in ipairs(tfmdata.fonts) do - local name = fonts.ids[v.id].name - names[k] = (name and file.basename(name)) or v.id - end - end - local round = math.round --- print(table.serialize(names)) - for _, s in next, sorted do - local char = characters[s] - if char then - local info = data[s] - local cnext, cvert_variants, choriz_variants = char.next, char.vert_variants, char.horiz_variants - report("\\startmathfontlistentry") - report("\\mathfontlistentryhexdectit{U+%05X}{%s}{%s}",s,s,string.lower(info.description or "no description, private to font")) - report("\\mathfontlistentrywdhtdpic{%s}{%s}{%s}{%s}",round(char.width or 0),round(char.height or 0),round(char.depth or 0),round(char.italic or 0)) - if virtual then - local commands = char.commands - if commands then - local t = { } - for i=1,#commands do - local ci = commands[i] - if ci[1] == "slot" then - local fnt, idx = ci[2], ci[3] - t[#t+1] = string.format("%s/%0X",names[fnt] or fnt,idx) - end - end - if #t > 0 then - report("\\mathfontlistentryresource{%s}",table.concat(t,", ")) - end - end - end - if info.mathclass then - report("\\mathfontlistentryclassname{%s}{%s}",info.mathclass,info.mathname or "no name") - end - if info.mathspec then - for i=1,#info.mathspec do - report("\\mathfontlistentryclassname{%s}{%s}",info.mathspec[i].class,info.mathspec[i].name or "no name") - end - end - if info.mathsymbol then - report("\\mathfontlistentrysymbol{U+%05X}{%s}",info.mathsymbol,info.mathsymbol) - end - if cnext then - local t, done = { }, { } - while cnext do - if done[cnext] then - t[#t+1] = "CYCLE" - break - else - done[cnext] = true - t[#t+1] = string.format("\\mathfontlistentrynext{U+%05X}{%s}",cnext,cnext) - cnext = characters[cnext] - cvert_variants = cnext.vert_variants or cvert_variants - choriz_variants = cnext.horiz_variants or choriz_variants - if cnext then - cnext = cnext.next - end - end - end - cnext = t - end - if cvert_variants then - local t = { } - for k, v in next, cvert_variants do - t[#t+1] = string.format("\\fontlistentryvariants{U+%05X}{%s}",v.glyph,v.glyph) - end - cvert_variants = t - end - if choriz_variants then - local t = { } - for k, v in next, choriz_variants do - t[#t+1] = string.format("\\fontlistentryvariants{U+%05X}{%s}",v.glyph,v.glyph) - end - choriz_variants = t - end - local cvariants = choriz_variants or cvert_variants - if cvariants and cnext then - report("\\mathfontlistentrynextvariantslist{%s}{%s}",table.concat(cnext," => "),table.concat(cvariants," => ")) - else - if cnext then - report("\\mathfontlistentrynextlist{%s}",table.concat(cnext," => ")) - end - if variants then - report("\\mathfontlistentryvariantslist{%s}",table.concat(cvariants," ")) - end - end - report("\\stopmathfontlistentry") - end - end -end -\stopluacode - -\endinput - -\startbuffer[mathtest] - \begingroup\mm\mr\showmathfontcharacters\endgroup -\stopbuffer - -\starttext - \usetypescript[cambria] \setupbodyfont[cambria, 12pt] \getbuffer[mathtest] - \usetypescript[lmvirtual] \setupbodyfont[lmvirtual,12pt] \getbuffer[mathtest] - \usetypescript[pxvirtual] \setupbodyfont[pxvirtual,12pt] \getbuffer[mathtest] - \usetypescript[txvirtual] \setupbodyfont[txvirtual,12pt] \getbuffer[mathtest] - \usetypescript[palatino] \setupbodyfont[palatino, 10pt] \getbuffer[mathtest] - \usetypescript[mathtimes] \setupbodyfont[mathtimes,12pt] \getbuffer[mathtest] -\stoptext - diff --git a/Master/texmf-dist/tex/context/base/s-fnt-26.mkiv b/Master/texmf-dist/tex/context/base/s-fnt-26.mkiv new file mode 100644 index 00000000000..18d1d657333 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-fnt-26.mkiv @@ -0,0 +1,74 @@ +%D \module +%D [ file=s-fnt-26, +%D version=2009.10.26, +%D title=\CONTEXT\ Style File, +%D subtitle=Goodies Tables, +%D author=Hans Hagen, +%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. + +\startluacode + + function document.show_goodies_stylistics(name) + local goodies = fonts.goodies.get(name) + local stylistics = goodies and goodies.stylistics + if stylistics then + local col, row, type = context.NC, context.NR, context.type + context.starttabulate { "|l|pl|" } + col() context("feature") col() context("meaning") col() row() + for feature, meaning in table.sortedpairs(stylistics) do + col() type(feature) col() type(meaning) col() row() + end + context.stoptabulate() + end + end + + function document.show_goodies_featuresets(name) + local goodies = fonts.goodies.get(name) + local featuresets = goodies and goodies.featuresets + if featuresets then + local col, row, type = context.NC, context.NR, context.type + context.starttabulate { "|l|pl|" } + col() context("featureset") col() context("definitions") col() row() + for featureset, definitions in table.sortedpairs(featuresets) do + col() type(featureset) col() + for k, v in table.sortedpairs(definitions) do + type(string.format("%s=%s",k,tostring(v))) + context.quad() + end + col() row() + end + context.stoptabulate() + end + end + + function document.show_goodies_colorschemes(name) + local goodies = fonts.goodies.get(name) + local colorschemes = goodies and goodies.colorschemes + if colorschemes then + local col, row, type = context.NC, context.NR, context.type + context.starttabulate { "|l|pl|" } + col() context("colorscheme") col() context("numbers") col() row() + for colorscheme, numbers in table.sortedpairs(colorschemes) do + col() type(colorscheme) col() + for i=1,#numbers do + type(i) + context.quad() + end + col() row() + end + context.stoptabulate() + end + end + +\stopluacode + +\def\showgoodiesstylistics #1{\ctxlua{document.show_goodies_stylistics ("#1")}} +\def\showgoodiesfeaturesets #1{\ctxlua{document.show_goodies_featuresets ("#1")}} +\def\showgoodiescolorschemes#1{\ctxlua{document.show_goodies_colorschemes("#1")}} + +\endinput diff --git a/Master/texmf-dist/tex/context/base/s-fnt-26.tex b/Master/texmf-dist/tex/context/base/s-fnt-26.tex deleted file mode 100644 index 026abf29be3..00000000000 --- a/Master/texmf-dist/tex/context/base/s-fnt-26.tex +++ /dev/null @@ -1,73 +0,0 @@ -%D \module -%D [ file=s-fnt-26, -%D version=2009.10.26, -%D title=\CONTEXT\ Style File, -%D subtitle=Goodies Tables, -%D author=Hans Hagen, -%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. - -\startluacode - - function document.show_goodies_stylistics(name) - local goodies = fonts.goodies.get(name) - local stylistics = goodies and goodies.stylistics - if stylistics then - local col, row, type = context.NC, context.NR, context.type - context.starttabulate { "|l|pl|" } - col() context("feature") col() context("meaning") col() row() - for feature, meaning in table.sortedpairs(stylistics) do - col() type(feature) col() type(meaning) col() row() - end - context.stoptabulate() - end - end - - function document.show_goodies_featuresets(name) - local goodies = fonts.goodies.get(name) - local featuresets = goodies and goodies.featuresets - if featuresets then - local col, row, type = context.NC, context.NR, context.type - context.starttabulate { "|l|pl|" } - col() context("featureset") col() context("definitions") col() row() - for featureset, definitions in table.sortedpairs(featuresets) do - col() type(featureset) col() - for k, v in table.sortedpairs(definitions) do - type(string.format("%s=%s",k,tostring(v))) - context.quad() - end - col() row() - end - context.stoptabulate() - end - end - - function document.show_goodies_colorschemes(name) - local goodies = fonts.goodies.get(name) - local colorschemes = goodies and goodies.colorschemes - if colorschemes then - local col, row, type = context.NC, context.NR, context.type - context.starttabulate { "|l|pl|" } - col() context("colorscheme") col() context("numbers") col() row() - for colorscheme, numbers in table.sortedpairs(colorschemes) do - col() type(colorscheme) col() - for i=1,#numbers do - type(i) - context.quad() - end - col() row() - end - context.stoptabulate() - end - -\stopluacode - -\def\showgoodiesstylistics #1{\ctxlua{document.show_goodies_stylistics ("#1")}} -\def\showgoodiesfeaturesets #1{\ctxlua{document.show_goodies_featuresets ("#1")}} -\def\showgoodiescolorschemes#1{\ctxlua{document.show_goodies_colorschemes("#1")}} - -\endinput diff --git a/Master/texmf-dist/tex/context/base/s-fnt-28.mkiv b/Master/texmf-dist/tex/context/base/s-fnt-28.mkiv new file mode 100644 index 00000000000..839c7d4ae44 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-fnt-28.mkiv @@ -0,0 +1,46 @@ +%D \module +%D [ file=s-fnt-28, +%D version=2010.09.22, +%D title=\CONTEXT\ Style File, +%D subtitle=Tracing Names, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\startluacode + function fonts.tracers.files(goodyfile) + local goodies = fonts.goodies.get(goodyfile) + if goodies then + local files = goodies.files + if files and files.list then + for filename, specification in table.sortedpairs(files.list) do + context.start() + context.dontleavehmode() + context.definedfont{ filename .. "*default" } + context("%s-%s-%s-%s-%s", + specification.name or files.name, + specification.weight or "normal", + specification.style or "normal", + specification.width or "normal", + specification.variant or "normal") + context.par() + context.stop() + end + end + end + end +\stopluacode + +\doifnotmode{demo}{\endinput} + +\starttext + + \loadfontgoodies[antykwapoltawskiego] + + \ctxlua{fonts.tracers.files("antykwapoltawskiego")} + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-fnt-29.mkiv b/Master/texmf-dist/tex/context/base/s-fnt-29.mkiv new file mode 100644 index 00000000000..0b63635b2ae --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-fnt-29.mkiv @@ -0,0 +1,71 @@ +%D \module +%D [ file=s-fnt-29, +%D version=2010.09.27, +%D title=\CONTEXT\ Style File, +%D subtitle=Tracing Shapes, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\startluacode + + local fontdata = fonts.hashes.identifiers + + function fonts.tracers.shapes() -- todo: ranges + local NC, NR = context.NC, context.NR + local char = context.char + local chrs = fontdata[font.current()].characters + -- local desc = fontdata[font.current()].descriptions + context.starttabulate { "|l|c|c|c|c|l|" } + context.FL() + NC() context("unicode") + NC() context("glyph") + NC() context("shape") + NC() context("lower") + NC() context("upper") + -- NC() context("name") + NC() context("description") + NC() NR() + context.TL() + for k, v in next, characters.data do + if chrs[k] then + NC() context("0x%05X",k) + NC() char(k) + NC() char(v.shcode) + NC() char(v.lccode or k) + NC() char(v.uccode or k) + -- NC() context(desc[k].name) + NC() context(v.description) + NC() NR() + end + end + context.stoptabulate() + end + +\stopluacode + +\doifnotmode{demo}{\endinput} + +\setupbodyfont[dejavu,tt,9pt] + +\setuplayout + [backspace=1cm, + topspace=1cm, + footer=1cm, + header=0cm, + height=middle, + width=middle] + +\setupfootertexts + [] + [\fontname\font\quad\pagenumber] + +\starttext + + \ctxlua{fonts.tracers.shapes()} + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-fnt-30.mkiv b/Master/texmf-dist/tex/context/base/s-fnt-30.mkiv new file mode 100644 index 00000000000..c824b2b6ccf --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-fnt-30.mkiv @@ -0,0 +1,54 @@ +%D \module +%D [ file=s-fnt-30, +%D version=2006.05.10, % abou tthen, quite old already +%D title=\CONTEXT\ Style File, +%D subtitle=Showing Character 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. + +% begin info +% +% title : show character data +% +% comment : show some info about characters in the character database +% status : experimental, used for luatex testing +% +% end info + +\startluacode +function document.show_character_data(n) + local n = characters.number(n) + local d = characters.data[n] + local NC, NR = context.NC, context.NR + if d then + local function entry(label,name) + NC() context(label) + NC() context(d[name]) + NC() NR() + end + context.starttabulate { "|Tl|Tl|]" } + entry("unicode index" , "unicodeslot") + entry("context name" , "contextname") + entry("adobe name" , "adobename") + entry("category" , "category") + entry("description" , "description") + entry("uppercase code", "uccode") + entry("lowercase code", "lccode") + entry("specials" , "specials") + context.stoptabulate() + end +end +\stopluacode + +\def\ShowCharacterData#1% + {\ctxlua{document.show_character_data(#1)}} + +% \ShowCharacterData{123} +% \ShowCharacterData{0x7B} + +% \dostepwiserecurse{`A}{`Z}{1}{\ShowCharacterData{#1}} diff --git a/Master/texmf-dist/tex/context/base/s-fnt-30.tex b/Master/texmf-dist/tex/context/base/s-fnt-30.tex deleted file mode 100644 index 81b6c8d19c4..00000000000 --- a/Master/texmf-dist/tex/context/base/s-fnt-30.tex +++ /dev/null @@ -1,42 +0,0 @@ -%D \module -%D [ file=s-fnt-30, -%D version=2006.05.10, % abou tthen, quite old already -%D title=\CONTEXT\ Style File, -%D subtitle=Showing Character 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. - -\startluacode -function document.show_character_data(n) - local n = characters.number(n) - local d = characters.data[n] - if d then - local function entry(label,name) - texsprint(tex.ctxcatcodes,format("\\NC %s\\NC %s\\NC\\NR",label,characters.valid(d[name]))) - end - texsprint(tex.ctxcatcodes,"\\starttabulate[|Tl|Tl|]") - entry("unicode index" , "unicodeslot") - entry("context name" , "contextname") - entry("adobe name" , "adobename") - entry("category" , "category") - entry("description" , "description") - entry("uppercase code", "uccode") - entry("lowercase code", "lccode") - entry("specials" , "specials") - texsprint(tex.ctxcatcodes,"\\stoptabulate ") - end -end -\stopluacode - -\def\ShowCharacterData#1% - {\ctxlua{document.show_character_data(#1)}} - -% \ShowCharacterData{123} -% \ShowCharacterData{0x7B} - -% \dostepwiserecurse{`A}{`Z}{1}{\ShowCharacterData{#1}} diff --git a/Master/texmf-dist/tex/context/base/s-fnt-31.mkiv b/Master/texmf-dist/tex/context/base/s-fnt-31.mkiv new file mode 100644 index 00000000000..3cd689d9719 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-fnt-31.mkiv @@ -0,0 +1,166 @@ +%D \module +%D [ file=s-fnt-31, +%D version=2011.01.02, % about +%D title=\CONTEXT\ Style File, +%D subtitle=Comparing Fonts, +%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. + +% begin info +% +% title : compare glyphs in fonts +% +% comment : show glyphs in several fonts alongside in order to to compare coverage +% status : experimental, used for luatex testing +% +% end info + +\startluacode + +local format, upper, find = string.format, string.upper, string.find +local chardata = characters.data + +function fonts.tracers.coverage(fontfiles,pattern) -- todo: patterns + + local present, names = { }, { } + local pattern = pattern and upper(pattern) + + for i=1,#fontfiles do + local fontname = format("testfont-%s",i) + local fontfile = fontfiles[i] + local fontsize = tex.dimen.bodyfontsize + local id, fontdata = fonts.definers.define { + name = fontfile, + size = fontsize, + cs = fontname, + } + for k, v in next, fontdata.characters do + present[k] = true + end + names[i] = fontname + end + + context.starttabulate {"|Tr" .. string.rep("|l",#names) .. "|" } + for i=1,#names do + context.NC() + context(i) + context.NC() + -- context.getvalue(names[i]) + context.type(fontfiles[i]) + context.NC() + context.NR() + end + context.stoptabulate() + + context.starttabulate {"|Tl" .. string.rep("|c",#names) .. "|Tl|" } + context.NC() + context.type("unicode") + context.NC() + for i=1,#names do + context.type(i) + context.NC() + end + context.type("description") + context.NC() + context.NR() + context.HL() + for k, v in table.sortedpairs(present) do + local description = chardata[k].description + if not pattern or (pattern == k) or (description and find(description,pattern)) then + context.NC() + context(format("%05X",k)) + context.NC() + for i=1,#names do + context.getvalue(names[i]) + context.char(k) + context.NC() + end + context(description) + context.NC() + context.NR() + end + end + context.stoptabulate() + +end + +\stopluacode + +\doifnotmode{demo}{\endinput} + +\setupbodyfont[10pt] + +\setuplayout + [backspace=1cm, + topspace=1cm, + footer=1cm, + header=0cm, + height=middle, + width=middle] + +\starttext + +% \startluacode +% fonts.tracers.coverage { +% "pirat.ttf", +% } +% \stopluacode + +% \startluacode +% fonts.tracers.coverage { +% -- "cambria.ttf", +% "lbr.afm", +% "LucidaBrightRegular.ttf", +% "lbi.afm", +% "LucidaBrightItalic.ttf", +% "lbd.afm", +% "LucidaBrightDemiBold.ttf", +% "lbdi.afm", +% "LucidaBrightDemiItalic.ttf", +% } +% \stopluacode + +% \startluacode +% fonts.tracers.coverage ( { +% "LucidaBrightRegular.ttf", +% "cambria.ttf", +% "iwona-regular.otf", +% "texgyrepagella-regular.otf", +% "texgyretermes-regular.otf", +% "texgyrebonum-regular.otf", +% "antpolt-regular.otf", +% }, "OGONEK") +% \stopluacode + +% \loadfontgoodies[lucida-math] +% \loadfontgoodies[lm-math] + +% \startluacode +% fonts.tracers.coverage { +% "LucidaBrightRegular.ttf", +% "LucidaBrightOne@lucida-math", +% "cambria.ttc(Cambria Math)", +% "xits-math.otf", +% "LMMath10-Regular@lmroman10-math", +% } +% \stopluacode + +\loadfontgoodies[px-math] +\loadfontgoodies[lm-math] + +\startluacode + fonts.tracers.coverage { + "cambria.ttc(Cambria Math)", + "xits-math.otf", + "LMMath10-Regular@lmroman10-math", + "pxmath@px-math", + -- "LinLibertine_Re-4.7.5.otf", + } +\stopluacode + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-fnt-32.mkiv b/Master/texmf-dist/tex/context/base/s-fnt-32.mkiv new file mode 100644 index 00000000000..ea55e9e7458 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-fnt-32.mkiv @@ -0,0 +1,60 @@ +%D \module +%D [ file=s-fnt-31, +%D version=2011.05.12, +%D title=\CONTEXT\ Style File, +%D subtitle=Unicode Math Scripts, +%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. + +\startluacode + function fonts.tracers.mathscripts() + context.starttabulate { "|cT|c|cT|c|c|l|" } + for k, v in table.sortedpairs(table.merged(characters.superscripts,characters.subscripts)) do + local ck = utf.char(k) + local cv = utf.char(v) + local ss = characters.superscripts[k] and "^" or "_" + context.NC() context("U+%05X",k) + context.NC() context(ck) + context.NC() context("U+%05X",v) + context.NC() context(cv) + context.NC() context("$x%s = x%s%s$",ck,ss,cv) + context.NC() context(string.lower(characters.data[k].description)) + context.NC() context.NR() + end + context.stoptabulate() + end +\stopluacode + +\doifnotmode{demo}{\endinput} + +\setupbodyfont[dejavu,10pt] + +% \enabletrackers[math.normalizing] +% \setupbackend[export=yes] + +\setuplayout + [backspace=1cm, + topspace=1cm, + footer=1cm, + header=0cm, + height=middle, + width=middle] + +\starttext + +\startbuffer +$e=mc²$ ${}²$ $²$ $x²ᶞ$ $x⁽²⁺²⁼²⁺²⁾$ $x²⁺²⁼²⁺²$ $x₅²$ $x²₅²$ +\stopbuffer + +\typebuffer \getbuffer + +\startluacode + fonts.tracers.mathscripts() +\stopluacode + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-grk-00.mkii b/Master/texmf-dist/tex/context/base/s-grk-00.mkii new file mode 100644 index 00000000000..ec5ddf1f7f2 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-grk-00.mkii @@ -0,0 +1,77 @@ +%D \module +%D [ file=s-grk-00, +%D version=2004.08.23, +%D title=\CONTEXT\ Style File, +%D subtitle=CB Greek Support, +%D author=Hans Hagen, +%D date=\currentdate, +%D suggestions=Giuseppe Bilotta, +%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. + +\usetypescriptfile[type-cbg] + +\usetypescript [all] [cbgreek-medium] + +\startsetups [cbgreek] + + \catcode`~=\other + \catcode`|=\other + + \language[greek] + \switchtobodyfont[cbgreek] + +\stopsetups + +\definestartstop + [greek] + [commands=\directsetup{cbgreek}] + +\doifnotmode{demo}{\endinput} + +% The following sample file was submitted to the \CONTEXT\ +% mailing list by Giuseppe Bilotta, along with the right +% typescripts. + +% already loaded: \usemodule[greek] + +\mainlanguage[english] + +\starttext + +We can easily use plain English for normal text, and then switch +to greek when we want; as a first try we type the lower and +upper case 26 letters of the latin alphabet and see how they come +out in greek: + +\startgreek +a b c d e f g h i j k l m n o p q r s t u v w x y z \par +A B C D E F G H I J K L M N O P Q R S T U V W X Y Z +\stopgreek + +As it can be observed, some uppercase letters have strange +outcomes; also, j gives \greek{j} and c gives the +end-of-word sigma \greek{c}; interestingly, s gives either the +normal sigma or the end-of-word one, depending on whether it's at +the end of the word or not: \greek{satrapws}. + +Of course we can use the various diacritical signs: accents +(\greek{`a, 'a, ~a}), breathings (\greek{w, a"}) and +subscribed iotas (\greek{a|, h|, w|}) (these last are pretty ugly in my +opinion); observe how they automatically get the correct position +with uppercase letters: (\greek{`A, 'A, ~A, A, A|}). + +Can the thing be used for serious work? + +\startgreek +>>'Andra moi >'ennepe, Mo~usa, pol'utropon, >'os m'ala poll`a\hfill\break +pl'agqjh, >epe`i Tro'ihs 'eperse;\hfill\break +poll~wn d" >anjr'wpwn >'iden >'astea ka`i n'oon >'egnw,\hfill\break +poll`a d" <'o g" >en p'ontw| p'ajen >'algea <`on kat`a jum'on,\hfill\break +>>arn'umenos <'hn te yuq`hn ka`i n'oston w, a"}) and -subscribed iotas (\greek{a|, h|, w|}) (these last are pretty ugly in my -opinion); observe how they automatically get the correct position -with uppercase letters: (\greek{`A, 'A, ~A, A, A|}). - -Can the thing be used for serious work? - -\startgreek ->>'Andra moi >'ennepe, Mo~usa, pol'utropon, >'os m'ala poll`a\hfill\break -pl'agqjh, >epe`i Tro'ihs 'eperse;\hfill\break -poll~wn d" >anjr'wpwn >'iden >'astea ka`i n'oon >'egnw,\hfill\break -poll`a d" <'o g" >en p'ontw| p'ajen >'algea <`on kat`a jum'on,\hfill\break ->>arn'umenos <'hn te yuq`hn ka`i n'oston max then max = v[i] end end + end + return max, what, function(n) return (max == 0 and 0) or (n == 0 and 0) or n/max end + end + + function document.context_state_1(what) + local max, what, norm = prepare(what) + context.starttabulate { "|Tl|T|T|T|T|T|" } + context.NC() + context(category) + context.NC() + for i, t in ipairs(types) do + local n, m = 0, 0 + for k, v in pairs(list) do + local nn, mm = what[k][i], what[k][i+5] + n = n + nn + m = m + (mm or nn) + end + context.Top(t,norm(max),n,m) + context.NC() + end + context.NC() + context.NR() + context.HL() + for k, v in table.sortedpairs(what) do + local c = (what == size and comp[k]) or nope + context.NC() + context("%s~%s~~%s~~%s", + (used.mkii[k] and "ii") or "~~", + (used.mkiv[k] and "iv") or "~~", + (used.mkvi[k] and "vi") or "~~", + k + ) + context.NC() + for i, t in ipairs(types) do + context.Bar(t,v[i],c[i],norm(v[i])) + context.NC() + end + context.NR() + end + context.stoptabulate() + end + + function document.context_state_2(what) + local max, what, norm = prepare(what) + for k, v in table.sortedpairs(what) do + local c = (what == size and comp[k]) or nope + context.StartUp(k) + for i, t in ipairs(types) do + context.Up(t,norm(v[i])) + end + context.StopUp() + end + end + +\stopluacode + +\definecolor[bar:tex] [middlegreen] +\definecolor[bar:mkii][middleblue] +\definecolor[bar:mkiv][middlered] +\definecolor[bar:mkvi][middleyellow] +\definecolor[bar:lua] [middlegray] + +\newcount\UpCounter + +\starttexdefinition Top #what#fraction#total#bigones + \hbox to 5em{\hss#total}% + \enspace + \hbox {#what\ifnum#total=#bigones\else~#bigones\rlap{~+}\fi\hss}% +\stoptexdefinition + +\starttexdefinition Bar #color#size#nobigones#fraction + \ifcase#size\else + \hbox to 5em{\hss\ifcase#nobigones\else\llap{-~}\fi#size}% + \enspace + \blackrule[color=bar:#color,width=#fraction\dimexpr 20em\relax,height=.8\strutht]% + \fi +\stoptexdefinition + +\starttexdefinition StartUp #name + \def\UpName{#name}% + \dontleavehmode\framed[frame=off,align={middle,low},height=18em]\bgroup +\stoptexdefinition + +\starttexdefinition StopUp + \par\nointerlineskip\blackrule[height=1pt,width=5em,depth=0pt,color=darkgray] + \par\tttf\strut\UpName\par + \egroup + \ifnum\UpCounter=17 + \par \UpCounter\zerocount + \else + \kern1em \advance\UpCounter\plusone + \fi +\stoptexdefinition + +\starttexdefinition Up #color#width + \scratchdimen#width\dimexpr 16em\relax + \ifdim\scratchdimen=\zeropoint + \kern1em + \else + \ifdim\scratchdimen<\onepoint \scratchdimen\onepoint \fi + \blackrule[color=bar:#color,height=\scratchdimen,width=1em]% + \fi +\stoptexdefinition + +\starttexdefinition Show #title#how#what + \startTEXpage[offset=1em,width=fit] + \hbox{\tttf\strut\currentdate~-~#title} + \par + \ctxlua{document.context_state_\number#how("#what")} + \stopTEXpage +\stoptexdefinition + +% \doifnotmode{demo}{\endinput} + +\starttext + \Show + {The number of files used in ConTeXt (base modules and styles).} + {1}{number} + \Show + {The size of (core) files used in ConTeXt (- indicates exclusion of large data files; + indicates inclusion of large data files; comment and spaces removed.)} + {1}{size} + \Show + {The relative number of files used in ConTeXt (tex, mkii, mkiv, mkvi, lua).} + {2}{number} + \Show + {The relative size of files used in ConTeXt (tex, mkii, mkiv, mkvi, lua).} + {2}{size} +\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-inf-01.tex b/Master/texmf-dist/tex/context/base/s-inf-01.tex deleted file mode 100644 index a2a693ae214..00000000000 --- a/Master/texmf-dist/tex/context/base/s-inf-01.tex +++ /dev/null @@ -1,203 +0,0 @@ -%D \module -%D [ file=s-inf-01, -%D version=2009.07.09, -%D title=\CONTEXT\ Style File, -%D subtitle=Information 1 (\MKII/\MKIV\ usage), -%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 Some day I will generalize this table mechanism. - -\startluacode - local format, gsub, find, match = string.format, string.gsub, string.find, string.match - local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes - - local list, size, comp, used, nope = { }, { }, { }, { mkii = { }, mkiv = { } }, { 0, 0, 0, 0 } - - local omit = { - "char%-def%.lua", - "mult%-def%.lua", "mult%-..%.tex", "mult%-m..%.tex", - } - local skip = { - "prag%-.*%.tex", "docs%-.*.tex", "list%-.*%.tex", "test%-.*%.tex", "demo%-.*%.tex", - "opti%-.*%.tex", "chrt%-.*%.tex", - } - local types = { - "tex", "mkii", "mkiv", "lua" - } - - local function collect(list,suffix,n) - local path = file.dirname(resolvers.find_file("context.tex"),".") - local pattern = path .. "/*." .. suffix - local texfiles = dir.glob(pattern) - for _, name in ipairs(texfiles) do - local base = file.basename(name) - local category = match(base,"^([a-z][a-z][a-z][a-z])%-[a-z0-9]+%.[a-z]+") - if category and lfs.isfile(name) then - local okay = true - for s=1,#skip do - if find(base,skip[s]) then - okay = false - break - end - end - if okay then - local lm, sm, cm = list[category], size[category], comp[category] - if not lm then - lm, sm, cm = { 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0 } - list[category], size[category], comp[category] = lm, sm, cm - end - lm[n] = lm[n] + 1 - local done = true - for o=1,#omit do - if find(base,omit[o]) then - done = false - break - end - end - local data = io.loaddata(name) - if suffix == "lua" then - data = gsub(data,"%-%-%[%[.-%]%]%-%-","") - data = gsub(data,"%-%-.-[\n\r]","") - else - data = gsub(data,"%%.-[\n\r]","") - end - data = gsub(data,"%s","") - sm[n+4] = sm[n+4] + #data - if done then - sm[n] = sm[n] + #data - else - cm[n] = cm[n] + 1 - end - end - end - end - end - - local function prepare(what) - if next(list) then - -- already loaded - else - for k, v in ipairs(types) do - collect(list,v,k) - end - for category, _ in pairs(list) do - pattern ="{"..category.."%-" - for suffix, t in pairs(used) do - local data = io.loaddata(resolvers.find_file("context."..suffix)) - if find(data,pattern) then - t[category] = true - end - end - end - end - local max, what = 0, (what == "size" and size) or list - for k, v in table.sortedpairs(what) do - for i=1,4 do if v[i] > max then max = v[i] end end - end - return max, what, function(n) return n/max end - end - - function document.context_state_1(what) - local max, what, norm = prepare(what) - texsprint(ctxcatcodes,"\\starttabulate[|Tc|T|T|T|T|]") - texsprint(ctxcatcodes,"\\NC category\\NC") - for i, t in ipairs(types) do - local n, m = 0, 0 - for k, v in pairs(list) do - local nn, mm = what[k][i], what[k][i+4] - n = n + nn - m = m + (mm or nn) - end - texsprint(ctxcatcodes,format("\\Top{%s}{%s}{%s}{%s}\\NC",t,norm(max),n,m)) - end - texsprint(ctxcatcodes,"\\NC\\NR\\HL") - for k, v in table.sortedpairs(what) do - local c = (what == size and comp[k]) or nope - local cat = format("%s~%s~~%s",(used.mkii[k] and "ii") or "~~",(used.mkiv[k] and "iv") or "~~",k) - texsprint(ctxcatcodes,"\\NC",cat,"\\NC") - for i, t in ipairs(types) do - texsprint(ctxcatcodes,format("\\Bar{%s}{%s}{%s}{%s}\\NC",t,v[i],c[i],norm(v[i]))) - end - texsprint(ctxcatcodes,"\\NR") - end - texsprint(ctxcatcodes,"\\stoptabulate") - end - - function document.context_state_2(what) - local max, what, norm = prepare(what) - for k, v in table.sortedpairs(what) do - local c = (what == size and comp[k]) or nope - texsprint(ctxcatcodes,format("\\StartUp{%s}",k)) - for i, t in ipairs(types) do - texsprint(ctxcatcodes,format("\\Up{%s}{%s}",t,norm(v[i]))) - end - texsprint(ctxcatcodes,"\\StopUp") - end - end - -\stopluacode - -\definecolor[bar:tex] [middlegreen] -\definecolor[bar:mkii][middleblue] -\definecolor[bar:mkiv][middlered] -\definecolor[bar:lua] [middlegray] - -\def\Top#1#2#3#4% - {\hbox to 5em{\hss#3}% - \enspace - \hbox to #2\dimexpr 20em\relax{#1\ifnum#3=#4\else~#4\rlap{~+}\fi\hss}} - -\def\Bar#1#2#3#4% - {\ifcase#2\else - \hbox to 5em{\hss\ifcase#3\else\llap{-~}\fi#2}% - \enspace - \blackrule[color=bar:#1,width=#4\dimexpr 20em\relax,height=.8\strutht]% - \fi} - -\newcount\UpCounter - -\def\StartUp#1% - {\dontleavehmode\framed[frame=off,align={middle,low},height=18em]\bgroup - \def\StopUp - {\par\nointerlineskip\blackrule[height=1pt,width=4em,depth=0pt,color=darkgray]% - \par\tttf\strut#1\par - \egroup - \ifnum\UpCounter=17 \par \UpCounter\zerocount\else \kern1em \advance\UpCounter\plusone \fi}} - -\def\Up#1#2% - {\scratchdimen#2\dimexpr 16em\relax - \ifdim\scratchdimen=\zeropoint - \kern1em - \else - \ifdim\scratchdimen<\onepoint \scratchdimen\onepoint \fi - \blackrule[color=bar:#1,height=\scratchdimen,width=1em]% - \fi} - -\def\Show#1#2#3% - {\startTEXpage[offset=1em,width=fit] - \hbox{\tttf\strut\currentdate~-~#1} - \ctxlua{document.context_state_\number#2("#3")} - \stopTEXpage} - -% \doifnotmode{demo}{\endinput} - -\starttext - \Show - {The number of files used in ConTeXt (modules and styles are excluded).} - {1}{number} - \Show - {The size of (core) files used in ConTeXt (- indicates exclusion of large data files; + indicates inclusion of large data files; comment and spaces removed.)} - {1}{size} - \Show - {The relative number of files used in ConTeXt (tex, mkii, mkiv, lua).} - {2}{number} - \Show - {The relative size of files used in ConTeXt (tex, mkii, mkiv, lua).} - {2}{size} -\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-inf-02.mkiv b/Master/texmf-dist/tex/context/base/s-inf-02.mkiv new file mode 100644 index 00000000000..77a3f650c51 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-inf-02.mkiv @@ -0,0 +1,27 @@ +%D \module +%D [ file=s-inf-02, +%D version=2009.11.25, +%D title=\CONTEXT\ Style File, +%D subtitle=Information 2 (filenames), +%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. + +\starttext + +\starttabulate [|T|T|] + \NC \type{\jobname} \NC \jobname \NC \NR + \NC \type{\jobfilename} \NC \jobfilename \NC \NR + \NC \type{\jobfilesuffix} \NC \jobfilesuffix \NC \NR + \NC \type{\inputfilename} \NC \inputfilename \NC \NR + \NC \type{\inputfilebarename} \NC \inputfilebarename \NC \NR + \NC \type{\inputfilesuffix} \NC \inputfilesuffix \NC \NR + \NC \type{\outputfilename} \NC \outputfilename \NC \NR + \NC \type{\operatingsystem} \NC \operatingsystem \NC \NR +\stoptabulate + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-inf-02.tex b/Master/texmf-dist/tex/context/base/s-inf-02.tex deleted file mode 100644 index 77a3f650c51..00000000000 --- a/Master/texmf-dist/tex/context/base/s-inf-02.tex +++ /dev/null @@ -1,27 +0,0 @@ -%D \module -%D [ file=s-inf-02, -%D version=2009.11.25, -%D title=\CONTEXT\ Style File, -%D subtitle=Information 2 (filenames), -%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. - -\starttext - -\starttabulate [|T|T|] - \NC \type{\jobname} \NC \jobname \NC \NR - \NC \type{\jobfilename} \NC \jobfilename \NC \NR - \NC \type{\jobfilesuffix} \NC \jobfilesuffix \NC \NR - \NC \type{\inputfilename} \NC \inputfilename \NC \NR - \NC \type{\inputfilebarename} \NC \inputfilebarename \NC \NR - \NC \type{\inputfilesuffix} \NC \inputfilesuffix \NC \NR - \NC \type{\outputfilename} \NC \outputfilename \NC \NR - \NC \type{\operatingsystem} \NC \operatingsystem \NC \NR -\stoptabulate - -\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-inf-03.mkiv b/Master/texmf-dist/tex/context/base/s-inf-03.mkiv new file mode 100644 index 00000000000..85440f0db97 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-inf-03.mkiv @@ -0,0 +1,353 @@ +% \nopdfcompression + +% \enablemode[ipad] + +\doifmodeelse {ipad} { + + \setuppapersize + [S6,landscape] + [S6,landscape] + + \definefont + [TitlePageFont] + [MonoBold at 20pt] + +} { + + \definefont + [TitlePageFont] + [MonoBold at 26pt] + +} + +\setuplayout + [header=0cm, + footer=1cm, + backspace=.5cm, + topspace=.5cm, + width=middle, + height=middle] + +\setuphead + [title] + [style=\ttc, + interaction=reference] + +\definehead + [xtitle] + [title] + +\setuphead + [xtitle] + [color=darkgreen] + +\setupbodyfont + [tt] + +\setupfootertexts + [\llap{\goto{\hbox to 5cm{\hss previous}}[previouspage]}% + \quad\pagenumber\quad + \rlap{\goto{\hbox to 5cm{next\hss}}[nextpage]}] + +\setupinteraction + [state=start, + style=, + color=, + title={ConTeXt MkIV}, + subtitle={Lua modules and functions}, + author={Hans Hagen - automatically generated}, + contrastcolor=] + +\setupinteractionscreen + [option=bookmark] + +\placebookmarks + [title,xtitle] + [force=yes] + +\definecolor[darkyellow][r=.5,g=.5,b=0] +\definecolor[darkgray] [s=.15] + +\nonknuthmode + +\starttext + +\startbuffer +\startluacode +local basiclua = libraries.basiclua +local basictex = libraries.basictex +local extratex = libraries.extratex +local extralua = libraries.extralua +local obsolete = libraries.obsolete + +local find = string.find +local color, goto = context.color, context.goto + +for k, v in table.sortedpairs(_G) do + if obsolete[k] or find(k,"_") or k == "arg" or k == "utf" then + -- + elseif basiclua[k] then + goto(function() color( { "darkred" }, k) end, { k } ) + elseif extralua[k] then + goto(function() color( { "darkgreen" }, k) end, { k } ) + elseif basictex[k] then + goto(function() color( { "darkblue" }, k) end, { k } ) + elseif extratex[k] then + goto(function() color( { "darkyellow" }, k) end, { k } ) + elseif type(v) == "table" then + goto(function() color( { "white" }, k) end, { k } ) + end + context(" ") +end +\stopluacode +\stopbuffer + +\setupbackgrounds + [page] + [background=color, + backgroundcolor=darkgray, + backgroundoffset=2mm] + +\setuplayout + [page] + +\startstandardmakeup + \vfill + \pagereference[global] + \startnarrower[5mm] + \raggedcenter + \TitlePageFont \setupinterlinespace + \getbuffer % luabuffer + \par + \stopnarrower + \vfill + \vfill + \hskip10mm\scale[width=\dimexpr\paperwidth-20mm\relax]{\ttbf\white\ConTeXt\ MkIV} + \par + % \hskip10mm\scale[width=\dimexpr\paperwidth-20mm\relax]{\white \strut Lua infrastructure \emdash\ \currentdate} + \vfill +\stopstandardmakeup + +\setuplayout + +\setupbackgrounds + [page] + [background=] + +\startluacode +local builtin = libraries.builtin +local globals = libraries.globals +local basiclua = libraries.basiclua +local basictex = libraries.basictex +local extratex = libraries.extratex +local extralua = libraries.extralua +local obsolete = libraries.obsolete + +local sortedkeys = table.sortedkeys +local mark = storage.mark +local marked = storage.marked +local gsub = string.gsub +local sub = string.sub +local byte = string.byte +local upper = string.upper + +local skipglobal = table.tohash { + "_G", "context", "modules", "global", "arg", "utf", 1, + "_ptbs_", "_pcol_", "_plib_", "_clib_", "_tlib_", + "_M", "kpse", +} + +local skipkeys = table.tohash { + "_pcol_", "_plib_", "_clib_", "_tlib_", "_bpnf_", "_ptbs_", + "_cldf_", "_cldn_", + "_clmb_", "_clme_", "_clmm_", "_clmn_", "_clma_", "_clmh_", + "_G", "_M", "_VERSION", "_COPYRIGHT", "_DESCRIPTION", "_NAME", "_PACKAGE", "__unload", +} + +local sameglobal = { + ["global"] = "_G", + -- ["commands"] = "cs", -- already gone +} + +-- -- -- -- -- -- -- -- -- -- -- -- -- +-- this should be done internally +-- -- -- -- -- -- -- -- -- -- -- -- -- + +for k,v in next, modules do + mark(v) +end + +mark(document.arguments) +mark(environment.arguments) +mark(environment.engineflags) +mark(characters.data) + +-- -- -- -- -- -- -- -- -- -- -- -- -- +-- -- -- -- -- -- -- -- -- -- -- -- -- + +local variant = 1 -- all parents +local variant = 2 -- parent name too +local variant = 3 -- no parents + +local function childtables(key,tab,handler,depth) + depth = depth or 1 + local keys = sortedkeys(tab) -- no sorted_pairs + for i=1,#keys do + local k = keys[i] +-- if k ~= "_G" and k ~= "_M" and type(k) == "string" then + if not skipkeys[k] and type(k) == "string" then + local v = tab[k] + local t = type(v) + local s = k + if variant ~= 3 then + s = key and (key .. "." .. s) or s + end + if t == "table" then + if marked(v) then + t = "data" + handler(s,t,depth) + else + handler(s,t,depth) + if variant == 3 then + childtables(false,v,handler,depth+1) + elseif variant == 2 then + childtables(k,v,handler,depth+1) + else + childtables(s,v,handler,depth+1) + end + end + else + handler(s,t,depth) + end + end + end +end + +local NC, NR = context.NC, context.NR +local overstrike, rlap, bf = context.overstrike, context.rlap, context.bf +local color, goto = context.color, context.goto + +local function cleanup(s) + return "\\char" ..byte(s) .. " " +end + +local function handler(k,t,depth) + k = gsub(k,"([~#$%%^&{}\\\|])",cleanup) +-- NC() rlap("\\quad\\tx " .. upper(sub(t,1,1)) .. " ".. k) NC() NC() NR() + NC() rlap("\\quad\\tx\\kern" .. (depth or 0).. "em" .. upper(sub(t,1,1)) .. " ".. k) NC() NC() NR() +end + +local function show(title,subtitle,alias,builtin,t,lib,libcolor,glo,glocolor,mark,obsolete) + -- todo: table as argument + local keys = sortedkeys(t) -- no sorted_pairs + if #keys > 0 then + local fulltitle = title + if subtitle and subtitle ~= "" then + fulltitle = fulltitle .. " (" .. subtitle .. ")" + end + if alias and alias ~= "" then + fulltitle = fulltitle .. " (alias: " .. alias .. ")" + end + if builtin then + context.startxtitle { reference = title, title = fulltitle, backreference = "global" } + else + context.starttitle { reference = title, title = fulltitle, backreference = "global" } + end + context.startcolumns { n = 2 } + context.starttabulate { "|||" } + local t_obsolete = t.obsolete + if type(t_obsolete) ~= "table" then + t_obsolete = nil + end + for i=1,#keys do + local k = keys[i] + local v = t[k] + if k ~= "obsolete" and not skipkeys[k] and (not obsolete or not obsolete[k]) then + local inlib = lib and lib[k] + local inglo = glo and glo[k] + if k then + local t = type(v) + local kstr, tstr = k, t + local obs = t_obsolete and t_obsolete[k] + if obs then + tstr = function() overstrike(t) end + kstr = function() overstrike(k) end + end + local marked = marked(v) + if marked then + tstr = "data table" + end + if t == "table" then + local m = getmetatable(v) + if m and m.__call then + tstr = "function" + end + end + if not mark then + -- + elseif inlib and tostring(inlib) ~= tostring(v) then + tstr = "overloaded ".. tstr + elseif inglo and tostring(inglo) ~= tostring(v) then + tstr = "overloaded ".. tstr + end + NC() bf() + if inlib then + if not mark and t == "table" then + goto(function() color( { libcolor }, kstr) end, { k } ) + else + color( { libcolor }, kstr) + end + elseif inglo then + if not mark and t == "table" then + goto(function() color( { glocolor }, kstr) end, { k } ) + else + color( { glocolor }, kstr) + end + else + if not mark and t == "table" then + goto(k, { kstr } ) + else + context(kstr) + end + end + NC() + if inlib then + color( { libcolor }, tstr) + elseif inglo then + color( { glocolor }, tstr) + else + context(tstr) + end + NC() NR() + if mark and t == "table" and title ~= "libraries" and title ~= "package" and not marked then + childtables(false,v,handler) -- (k,v,handler) + end + end + end + end + context.stoptabulate() + context.stopcolumns() + if builtin then + context.stopxtitle() + else + context.stoptitle() + end + end +end + +show("global","",sameglobal.global,false,_G,builtin,"darkgreen",globals,"darkblue",false,obsolete) + +for k, v in table.sortedpairs(_G) do + if not skipglobal[k] and not obsolete[k] and type(v) == "table" and not marked(v) then + if basiclua[k] then show(k,"basic lua",sameglobal[k],basiclua[k],v,builtin[k],"darkred", false,false,true) + elseif extralua[k] then show(k,"extra lua",sameglobal[k],extralua[k],v,builtin[k],"darkred", false,false,true) + elseif basictex[k] then show(k,"basic tex",sameglobal[k],basictex[k],v,builtin[k],"darkred", false,false,true) + elseif extratex[k] then show(k,"extra tex",sameglobal[k],extratex[k],v,builtin[k],"darkred", false,false,true) + else show(k,"context", sameglobal[k],false, v,builtin[k],"darkyellow",false,false,true) + end + end +end + +\stopluacode + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-jap-00.mkii b/Master/texmf-dist/tex/context/base/s-jap-00.mkii new file mode 100644 index 00000000000..28cb6c2415a --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-jap-00.mkii @@ -0,0 +1,23 @@ +%D \module +%D [ file=s-jap-00, +%D version=2006.01.19, +%D title=\CONTEXT\ Style File, +%D subtitle=Basic Japanese Style, +%D author=Hans Hagen, +%D date=\currentdate, +%D suggestions=Richard Gabriel, +%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. + +\input font-jap.tex % faster than \setupbodyfont[jap] + +\mainlanguage [ja] + +\unprotect + +\setuptyping[\c!tab=\v!no] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/s-jap-00.tex b/Master/texmf-dist/tex/context/base/s-jap-00.tex deleted file mode 100644 index 28cb6c2415a..00000000000 --- a/Master/texmf-dist/tex/context/base/s-jap-00.tex +++ /dev/null @@ -1,23 +0,0 @@ -%D \module -%D [ file=s-jap-00, -%D version=2006.01.19, -%D title=\CONTEXT\ Style File, -%D subtitle=Basic Japanese Style, -%D author=Hans Hagen, -%D date=\currentdate, -%D suggestions=Richard Gabriel, -%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. - -\input font-jap.tex % faster than \setupbodyfont[jap] - -\mainlanguage [ja] - -\unprotect - -\setuptyping[\c!tab=\v!no] - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/s-lan-03.mkiv b/Master/texmf-dist/tex/context/base/s-lan-03.mkiv new file mode 100644 index 00000000000..b8d24539b52 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-lan-03.mkiv @@ -0,0 +1,40 @@ +%D \module +%D [ file=s-lan-03, +%D version=2010.10.21, +%D title=\CONTEXT\ Style File, +%D subtitle=Language Environment 3, +%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. + +\startluacode +languages.words.tracers = languages.words.tracers or { } + +function languages.words.tracers.showwords(filename) + filename = filename or file.addsuffix(tex.jobname,"words") + if lfs.isfile(filename) then + local w = dofile(filename) + if w then + -- table.print(w) + for cname, category in table.sortedpairs(w.categories) do + for lname, language in table.sortedpairs(category.languages) do + context.bold(string.format("category: %s, language: %s, total: %s, unique: %s:", + cname, lname, language.total or 0, language.unique or 0) + ) + for word, n in table.sortedpairs(language.list) do + context(" %s (%s)",word,n) + end + context.par() + end + end + end + end +end +\stopluacode + +% \ctxlua{languages.words.tracers.showwords("words-003.words")} + diff --git a/Master/texmf-dist/tex/context/base/s-lan-04.mkiv b/Master/texmf-dist/tex/context/base/s-lan-04.mkiv new file mode 100644 index 00000000000..3fb57529911 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-lan-04.mkiv @@ -0,0 +1,153 @@ +%D \module +%D [ file=s-lan-04, +%D version=2011.05.01, +%D title=\CONTEXT\ Style File, +%D subtitle=Language Environment 4, +%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 Mojca. + +\startluacode + local a_colormodel = attributes.private('colormodel') + + local nodecodes = nodes.nodecodes + local nodepool = nodes.pool + local disc = nodecodes.disc + local glyph = nodecodes.glyph + local quads = fonts.hashes.quads + local newkern = nodepool.kern + local newrule = nodepool.rule + local newglue = nodepool.glue + + local get_attribute = node.has_attribute + + local tracers = nodes.tracers + local colortracers = tracers and tracers.colors + local setnodecolor = colortracers.set + + local function identify(head,marked) + local current, prev = head, nil + while current do + local id = current.id + local next = current.next + if id == disc then + if prev and next.id == glyph then -- catch other usage of disc + marked[#marked+1] = prev + end + elseif id == glyph then + prev = current + end + current = next + end + end + + local function strip(head,marked) + for i=1,#marked do + local prev = marked[i] + nodes.remove(head,prev.next,true) + end + end + + local function mark(head,marked,what,how) + for i=1,#marked do + local prev = marked[i] + local font = prev.font + local quad = quads[font] + head, prev = node.insert_after(head,prev,newkern(-quad/40)) + if what then + local rule = newrule(quad/20,.75*quad,0) + head, prev = node.insert_after(head,prev,rule) + setnodecolor(rule,how,get_attribute(prev,a_colormodel)) + else + local rule = newrule(quad/20,0,.5*quad) + head, prev = node.insert_after(head,prev,rule) + setnodecolor(rule,how,get_attribute(prev,a_colormodel)) + end + head, prev = node.insert_after(head,prev,newkern(-quad/40)) + head, prev = node.insert_after(head,prev,newglue(0)) + end + end + + local language_one, language_two, tag_one, tag_two + + function nodes.showhyphens(head) + local marked_1, marked_2 = { }, { } + if language_one then + for n in node.traverse_id(glyph,head) do + n.lang = language_one + end + lang.hyphenate(head,node.slide(head)) + identify(head,marked_1) + strip(head,marked_1) + end + if language_two then + for n in node.traverse_id(glyph,head) do + n.lang = language_two + end + lang.hyphenate(head,node.slide(head)) + identify(head,marked_2) + strip(head,marked_2) + end + if tag_one then + mark(head,marked_1,true,"hyphenation:"..tag_one) + end + if tag_two then + mark(head,marked_2,false,"hyphenation:"..tag_two) + end + return head, true + end + + function languages.startcomparepatterns(list) + local list = utilities.parsers.settings_to_array(list) + tag_one = list[1] + tag_two = list[2] + language_one = tag_one and languages.getnumber(tag_one) + language_two = tag_two and languages.getnumber(tag_two) + -- nodes.tasks.appendaction("processors","words","nodes.showhyphens") + nodes.tasks.appendaction("processors","before","nodes.showhyphens") + nodes.tasks.enableaction("processors","nodes.showhyphens") + end + + function languages.stopcomparepatterns() + nodes.tasks.disableaction("processors","nodes.showhyphens") + end + +\stopluacode + +\unprotect + +\def\startcomparepatterns[#1]% + {\bgroup + \language\zerocount + \setupalign[\v!nothyphenated]% + \ctxlua{languages.startcomparepatterns("#1")}} + +\def\stopcomparepatterns + {\ctxlua{languages.stopcomparepatterns()}% + \egroup} + +\protect + +\definecolor[hyphenation:en] [r=.8] +\definecolor[hyphenation:de] [g=.8] +\definecolor[hyphenation:nl] [b=.8] + +\doifnotmode{demo}{\endinput} + +\starttext + + \startcomparepatterns[en,de] + \input tufte\par + \stopcomparepatterns + + \startcomparepatterns[de,nl] + \input tufte\par + \stopcomparepatterns + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-map-10.mkii b/Master/texmf-dist/tex/context/base/s-map-10.mkii new file mode 100644 index 00000000000..865132f9743 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-map-10.mkii @@ -0,0 +1,488 @@ +%\module [ +% file=s-map-se, +% version=2005.02.03, +% title=\CONTEXT\ Style File, +% subtitle=\MAPS\ basis stijl, +% author={Hans Hagen, Taco Hoekwater and Siep Kroonenberg}, +% date=\currentdate, +% copyright={NTG / MAPS}% +%] + +% This module re-implements the MAPS style for use with the Context +% macro package. The original MAPS layout was designed and +% implemented in LaTeX by Taco Hoekwater and Siep Kroonenberg. + +% This style will be cleaned up as soon as we have time for it. + +% - three layouts: +% 1. two columns +% 2. one column, with wide outer margins (option onecolumn) +% 3. one column, with wide left margin (option asym) +% - font sizes deviate from TeX's usual geometric progression +% - use of sans-serif for headers and various details +% - option realfonts uses Bitstream Charter, Euler Math and Latin Modern. +% This is used for final typesetting. +% The default font setup, intended for authors, uses Computer +% Modern. + +% A mode nosubsub defines only two levels of sectioning. If you +% don't need more and use the two-column layout, then this option +% will probably improve the looks of your paper. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% pdftex support + +\newif\ifMapsInColumns +\doifmode{asym}{\enablemode[onecolumn]} % implies onecolumn +\doifnotmode{onecolumn}{\MapsInColumnstrue} + +\enablemode[realfonts] + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% fonts + +%%%%%%%%% first, font sizes +\definebodyfontenvironment [7pt][% LaTeX: scriptsize + interlinespace=8pt, + big=8pt, + small=6pt% +] + +\definebodyfontenvironment [8pt][% LaTeX: footnotesize + interlinespace=9pt, + big=9pt, + small=7pt, + x=6pt% +] + +\definebodyfontenvironment [9pt][% LaTeX: small + interlinespace=10pt, + big=10pt, + small=7pt,% + x=7pt,% + script=7pt% +] + +\definebodyfontenvironment [10pt][% LaTeX: normalsize + interlinespace=11pt, + big=11pt, + small=9pt,% + x=8pt,% + script=7pt% +] + +\definebodyfontenvironment [11pt][% LaTeX: large + interlinespace=11pt, + big=11pt, + small=10pt,% + x=9pt,% + script=8pt% +] + +\definebodyfontenvironment [14pt][% + interlinespace=14pt, + big=24pt, + small=11pt, + x=10pt% +] + +\definebodyfontenvironment [24pt][% + interlinespace=24pt, + big=24pt, + small=14pt, + x=11pt% +] + +%%% font families + +\starttypescript [map] [texnansi] + + \definetypeface[map][ss][sans] [map] [default][encoding=\typescripttwo] + \definetypeface[map][rm][serif][charter] [default][encoding=\typescripttwo,rscale=0.95] + \definetypeface[map][tt][mono] [modern] [default][encoding=\typescripttwo] + \definetypeface[map][mm][math] [euler] [default][encoding=\typescripttwo] + +% \usemathcollection[eul] + +\stoptypescript + +% activate protruding + +\setupinterlinespace[line=11pt] + +\setupfontsynonym[handling=pure] + +\setupalign[hanging] + +\usetypescript[map][texnansi] + +\setupbodyfont [map,10pt] + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% additional general typographic details + +\setupindenting [yes,next,11pt] % indenting after enumerations etc. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% 3 versions of layout with matching headers + +% I would like to move the entire layout slightly toward the spine, +% but Context seems to provide no good handle for that. +% So instead, I'll use a two-column layout centered on the page and +% matching single-column layouts. + +% It is easy to do the shift toward the spine when assembling the +% volume with LaTeX pdfpages. + +\definepapersize [maps][% + width=595.3bp, % 21cm + height=756bp% 10.5in +] + +\setuppapersize [maps][maps] + +% parameters: +% margin -> latex marginparwith + +\setuplayout[% + topspace=40pt, + height=692pt, + header=33pt, + margin=106pt, + leftmargindistance=11pt, + rightmargindistance=11pt% +] + + +\setupblank[5.5pt] + +\setuppagenumbering [location=] + +\definetyping [widetyping] + +\setupheader [style=\ss] +\setupfooter [style=\ss] + +\def\AuHead{% + %\ifnum\pageno=\MapsPage \hbox{}\else + \MapsRunningAuthor%\fi +} +\def\TiHead{% + \ifnum\pageno=\MapsPage \relax \MapsRunningAuthor %\hbox{} + \else \MapsRunningTitle\fi} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% sectioning + +\setupheads[sectionnumber=no, align=right] + +\def\hfonti{\bfa} +\def\hfontii{\bf} +\def\hfontiii{\rm\bi} +\def\runin#1#2{#2.} + +\doifmodeelse{nosubsub}{% +\setuphead [section][% + style=\hfontii, + before={\blank[halfline]}, + after={}% +] +\setuphead [subsection][% + style=\hfontiii, + command=\runin, + alternative=text, + before={\blank[halfline]}% +]}{% +\setuphead [section][% + style=\hfonti, + before={\blank[13pt]}, + after={\blank[6pt]}% +] +\setuphead [subsection][% + style=\hfontii, + before={\blank[6pt]}, + after={}% +] +\setuphead [subsubsection][% + style=\hfontiii, + command=\runin, + alternative=text, + before={\blank[halfline]}% +]} + +\doifmodeelse{nosubsub}{% +\setuphead [subject][% + style=\hfontii, + before={\blank[halfline]}, + after={}% +] +\setuphead [subsubject][% + style=\hfontiii, + command=\runin, + alternative=text, + before={\blank[halfline]}% +]}{% +\setuphead [subject][% + style=\hfonti, + before={\blank}, + after={\blank[halfline]}% +] +\setuphead [subsubject][% + style=\hfontii, + before={\blank[halfline]}, + after={}% +] +\setuphead [subsubsubject][% + style=\hfontiii, + command=\runin, + alternative=text, + before={\blank[halfline]}% +]} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% floats + +\setupfloats [location=left, before={\ss}] +\setupcaptions [style={\ss}, + stopper=., + inbetween={\blank[halfline]}] + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% various document elements + +%\startnotmode[realfonts] +\def\ChkBox{% + \hbox {\boxrulewidth=.4pt \raise.2ex\ruledvbox + {\phantom{\vrule width .85ex height .85ex% +}}}} +%\stopnotmode +%\startmode[realfonts] +%\def\ChkBox{\raise.12ex\hbox{\ws \char50}} +%\stopmode +\definesymbol [1][\ChkBox] + +\setupitemize[1][packed] + +\setupitemize [each][% + indentnext=no, + align=right, + width=1em, + distance=0pt% +] + +% an outer form of itemize that does not indent +% the paragraph. + +\definecomplexorsimpleempty\startouteritemize +\def\complexstartouteritemize[#1]{\begingroup + \startitemize[width=1sp,#1] + \let\doitem\item + \def\item{\doitem[]\hbox{}\kern12pt\rightskip=0pt}% +} + +\def\stopouteritemize{\stopitemize\endgroup} + + +\setupenumerations [indentnext=no] + +\setupdescriptions [indentnext=no] + +\unexpanded\def\smalltyping{% + \switchtobodyfont[tt,9pt]% + \setuplocalinterlinespace[line=11pt]% + \parindent=0pt +} + +% typing: +% - prettyverbatim is NOT the default +% - smaller size + +\setuptyping [% + style={\smalltyping}, + option=none, + indentnext=no% +] + +\def\footnum#1{#1.} + +\setupfootnotes + [location=none, + width=\textwidth, + bodyfont=9pt, + before=, + numbercommand=\footnum] + +\setupfootnotedefinition + [location=serried, + before=, + after=, + distance=0.5em] + +\setuptabulate + [before=\blank, + inner=\ss, + after=\blank] + +\def\startIntroEntry#1% + {\blank[line] + \startbaselinecorrection + \bgroup + \setupalign[right] + \setuptolerance[verytolerant] + \setupindenting[no] + \switchtobodyfont[9pt]% + \hyphenpenalty10000 + \parfillskip 0pt plus 1fill + \rightskip6pt plus 1fill + \ss + \bgroup\bf #1\par\egroup + \ignorespaces } + +\def\stopIntroEntry + {\par\egroup \stopbaselinecorrection} + +\def\defineIntroEntry[#1][#2][#3]% + {\setvalue{start#1}{\startIntroEntry{#2}}% + \setvalue {stop#1}{\stopIntroEntry#3}} + +\defineIntroEntry[Keywords][Keywords][] +\defineIntroEntry[Abstract][Abstract][] + +% article parameters (other fields and defaults) +\def\MapsBibData[#1]% + {\getparameters [Maps] + [SubTitle=, + RunningAuthor=, + RunningTitle=, + Email=, + Address=, + Page=1, + Title=No Title given, + Author=No Author given, + Period=, + Number=99, + Year=2006, + #1]% + \doifnothing\MapsRunningAuthor + {\global\let\MapsRunningAuthor\MapsAuthor}% + \doifnothing\MapsRunningTitle + {\global\let\MapsRunningTitle\MapsTitle}}% + +\def\dostartArticle[#1]{% + \MapsBibData[#1] + \pageno=\MapsPage + \count0=\MapsPage + \setuppagenumber[number=\MapsPage] + \bgroup + \hsize = 457pt + \let\\\crlf + \blank[29pt,force] + \switchtobodyfont[rm,24pt] + \setupalign[right] + {\bf\noindent\MapsTitle\par\blank[6pt]} + \ifx\MapsSubTitle\empty \else + { \switchtobodyfont[ss,24pt]\sl\noindent + \advance \rightskip 0pt plus 2em + \MapsSubTitle\par} + \fi + \doifmodeelse{newstyle} + {\blank[22pt]} + {\blank[30pt]} + \egroup + \switchtobodyfont[rm,10pt] + \doifmode{newstyle} + {\noindent\MapsAuthor\blank[line]} + \setupalign[width] + \ifMapsInColumns + \startcolumns\hyphenpenalty1000 + \else + \clubpenalty10000 + \widowpenalty10000 + \fi +} + +\definecolumnset[mapsset][n=2,grid=on] + +\def\startArticle{\dosingleempty\dostartArticle} + +\def\stopArticle{% + {\blank\let\\\crlf + \noindent\switchtobodyfont[ss,9pt]% + \MapsAuthor + \doifsomething{\MapsAddress}{\\\MapsAddress}% + \doifsomething{\MapsEmail}{\\\MapsEmail}}% + \ifMapsInColumns \stopcolumns \fi + \page +} + +\installpagebreakhandler{last}{} + +%%% `logos' %%%%%%%%%%%%%%%%%%%%%%%%%% + +\def\LATEX{La\TeX} +\def\LaTeX{La\TeX} +\def\TEX{\TeX} +\def\CONTEXT{Con{\TeX}t} +\def\ConTeXt{Con{\TeX}t} +\def\METAFONT{Metafont} +\def\METAPOST{MetaPost} +\def\POSTSCRIPT{PostScript} + + +%%%%%%%%%%% + +\doifmodeelse{onecolumn}{% + \setuplayout[width=340pt] + \doifmodeelse{asym}{% one col, asymmetric + \setuplayout[backspace=187.3pt]% + \setuptyping [widetyping][oddmargin=-117pt] + \setuppagenumbering [alternative={singlesided,doublesided}] + \setupheadertexts + [{\hbox{}\hskip-117pt\TiHead}] + [{{\tfx\MapsPeriod~}\MapsYear\quad\bf\pagenumber\hskip-30pt\hbox{}}] + [{\hbox{}\hskip-147pt{\bf\pagenumber}\quad {\tfx MAPS~}\MapsNumber}] + [\AuHead] + \setupfootertexts + }{% one col, symmetric + \setuplayout[backspace=70.3pt] + \setuppagenumbering [alternative=doublesided] + \setuptyping[blank=halfline] + \setupheadertexts + [\TiHead] + [{{\tfx\MapsPeriod~}\MapsYear\quad\bf\pagenumber\hskip-147pt\hbox{}}] + [{\hbox{}\hskip-147pt{\bf\pagenumber}\quad {\tfx MAPS~}\MapsNumber}] + [\AuHead] + \setupfootertexts +}}{% two col + \setuplayout[width=457pt] + \setupcolumns[n=2,tolerance=verytolerant,distance=11pt] + \setuplayout[backspace=70.3pt,grid=yes] + \setuppagenumbering [alternative=doublesided] + \setuptyping[blank=halfline] + \setupheadertexts + [\TiHead] + [{{\tfx\MapsPeriod~}\MapsYear\quad\bf\pagenumber\hskip-30pt\hbox{}}] + [{\hbox{}\hskip-30pt{\bf\pagenumber}\quad {\tfx MAPS~}\MapsNumber}] + [\AuHead] + \setupfootertexts +} + +%\MapsBibData +% [] + +%\abovedisplayskip = 12pt +%\abovedisplayshortskip = 6pt + +\newdimen\iabovedisplayskip +\newdimen\iabovedisplayshortskip +%\let\abovedisplayskip\iabovedisplayskip +%\let\abovedisplayshortskip\iabovedisplayshortskip + +\setuplanguage + [nl] + [\c!leftquote=\upperleftsinglesixquote, + \c!leftquotation=\upperleftdoublesixquote] + +%\protect +\endinput diff --git a/Master/texmf-dist/tex/context/base/s-map-10.mkiv b/Master/texmf-dist/tex/context/base/s-map-10.mkiv new file mode 100644 index 00000000000..22ceeb16158 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-map-10.mkiv @@ -0,0 +1,567 @@ +%\module [ +% file=s-map-se, +% version=2005.02.03, +% title=\CONTEXT\ Style File, +% subtitle=\MAPS\ basis stijl, +% author={Hans Hagen, Taco Hoekwater and Siep Kroonenberg}, +% date=\currentdate, +% copyright={NTG / MAPS}% +%] + +% This module re-implements the MAPS style for use with the Context +% macro package. The original MAPS layout was designed and +% implemented in LaTeX by Taco Hoekwater and Siep Kroonenberg. + +% This style will be cleaned up as soon as we have time for it. + +% - three layouts: +% 1. two columns +% 2. one column, with wide outer margins (option onecolumn) +% 3. one column, with wide left margin (option asym) +% - font sizes deviate from TeX's usual geometric progression +% - use of sans-serif for headers and various details +% - option realfonts uses Bitstream Charter, Euler Math and Latin Modern. +% This is used for final typesetting. +% The default font setup, intended for authors, uses Computer +% Modern. + +% A mode nosubsub defines only two levels of sectioning. If you +% don't need more and use the two-column layout, then this option +% will probably improve the looks of your paper. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% pdftex support + +\newif\ifMapsInColumns +\doifmode{asym}{\enablemode[onecolumn]} % implies onecolumn +\doifnotmode{onecolumn}{\MapsInColumnstrue} + +\enablemode[realfonts] + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% fonts + +%%%%%%%%% first, font sizes +\definebodyfontenvironment [7pt][% LaTeX: scriptsize + interlinespace=8pt, + big=8pt, + small=6pt% +] + +\definebodyfontenvironment [8pt][% LaTeX: footnotesize + interlinespace=9pt, + big=9pt, + small=7pt, + x=6pt% +] + +\definebodyfontenvironment [9pt][% LaTeX: small + interlinespace=10pt, + big=10pt, + small=8pt,% + x=7pt,% + script=6pt% +] + +\definebodyfontenvironment [10pt][% LaTeX: normalsize + interlinespace=11pt, + big=11pt, + a=11pt, + small=9pt,% + x=8pt,% + script=7pt% +] + +\definebodyfontenvironment [11pt][% LaTeX: large + interlinespace=11pt, + big=11pt, + small=10pt,% + x=9pt,% + script=8pt% +] + +\definebodyfontenvironment [14pt][% + interlinespace=14pt, + big=18pt, + small=11pt, + x=10pt% +] + +\definebodyfontenvironment [18pt][% + interlinespace=18pt, + big=24pt, + small=14pt, + x=10pt% +] + +\definebodyfontenvironment [24pt][% + interlinespace=24pt, + big=24pt, + small=18pt, + x=11pt% +] + +%%% font families + +\usetypescriptfile[type-libertine] + +\usetypescriptfile[type-inconsolata] + +\startmode[mkii] +\starttypescript [maps] [ec] +\definetypeface [maps] [mm] [math] [euler] [default] [encoding=default,rscale=0.9] +\usemathcollection[euler] +\definetypeface [maps] [tt] [mono] [inconsolata] [default] [encoding=ec,rscale=0.92] +\definetypeface [maps] [ss] [sans] [default] [default] [encoding=ec,rscale=0.95] +\definetypeface [maps] [rm] [serif] [libertine] [default] [encoding=ec] +\stoptypescript +\usetypescript[maps] [ec] +\stopmode + +\startmode[mkiv] +\starttypescript [maps] +\definetypeface [maps] [mm] [math] [euler] [default] [rscale=0.9] +\definetypeface [maps] [tt] [mono] [inconsolata] [default] [rscale=0.92] +\definetypeface [maps] [ss] [sans] [modern] [default] [rscale=0.95] +\definetypeface [maps] [rm] [serif] [libertine] [default] +\stoptypescript +\usetypescript[maps] +\stopmode + +\setupbodyfont[maps,10pt,rm] + +% activate protruding +\setupinterlinespace[line=11pt] + +\setupfontsynonym[handling=pure] + +\setupalign[hanging] + +% \usetypescript[map][texnansi] + +% \setupbodyfont [map,10pt] + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% additional general typographic details + +\setupindenting [yes,next,11pt] % indenting after enumerations etc. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% 3 versions of layout with matching headers + +% I would like to move the entire layout slightly toward the spine, +% but Context seems to provide no good handle for that. +% So instead, I'll use a two-column layout centered on the page and +% matching single-column layouts. + +% It is easy to do the shift toward the spine when assembling the +% volume with LaTeX pdfpages. + +\definepapersize [maps][% + width=595.3bp, % 21cm + height=756bp% 10.5in +] + +\setuppapersize [maps][maps] + +% parameters: +% margin -> latex marginparwith + +\setuplayout[% + topspace=40pt, + height=688pt, + header=33pt, + margin=106pt, + leftmargindistance=11pt, + rightmargindistance=11pt% +] + + +\setupblank[5.5pt] + +\setuppagenumbering [location=] + +\definetyping [widetyping] + +\setupheader [style=\ss] +\setupfooter [style=\ss] + +\def\AuHead{% + %\ifnum\pageno=\MapsPage \hbox{}\else + \MapsRunningAuthor%\fi +} +\def\TiHead{% + \ifnum\pageno=\MapsPage \relax \MapsRunningAuthor %\hbox{} + \else \MapsRunningTitle\fi} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% sectioning + +\setupheads[sectionnumber=no, align=right] + +\def\hfonti{\ssbfa} +\def\hfontii{\ssbf} +\def\hfontiii{\rm\it} +\def\runin#1#2{#2.} + +\doifmodeelse{nosubsub}{% +\setuphead [section][% + style=\hfontii, + before={\blank[line]}, + after={}% +] +\setuphead [subsection][% + style=\hfontiii, + command=\runin, + alternative=text, + distance=6pt, + before={\blank[halfline]}% +]}{% +\setuphead [section][% + style=\hfonti, + before={\blank[line]}, + after={\blank[halfline]}% +] +\setuphead [subsection][% + style=\hfontii, + before={\blank[halfline]}, + after={}% +] +\setuphead [subsubsection][% + style=\hfontiii, + command=\runin, + distance=6pt, + alternative=text, + before={\blank[halfline]}% +]} + +\doifmodeelse{nosubsub}{% +\setuphead [subject][% + style=\hfontii, + before={\blank[halfline]}, + after={}% +] +\setuphead [subsubject][% + style=\hfontiii, + command=\runin, + alternative=text, + before={\blank[halfline]}% +]}{% +\setuphead [subject][% + style=\hfonti, + before={\blank}, + after={\blank[halfline]}% +] +\setuphead [subsubject][% + style=\hfontii, + before={\blank[halfline]}, + after={}% +] +\setuphead [subsubsubject][% + style=\hfontiii, + command=\runin, + alternative=text, + before={\blank[halfline]}% +]} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% floats + +\setupfloats [location=center, before={\ss}] +\setupcaptions [headstyle={\ss},style={\ssx}, + stopper=.,distance=6pt, + inbetween={\blank[halfline]}] + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% various document elements + +%\startnotmode[realfonts] +\def\ChkBox{% + \hbox {\boxrulewidth=.4pt \raise.2ex\ruledvbox + {\phantom{\vrule width .85ex height .85ex% +}}}} + +\startmode[mkii] +\pdfmapline{stmary10 stmary10 latex marginparwith - -\setuplayout[% - topspace=40pt, - height=692pt, - header=33pt, - margin=106pt, - leftmargindistance=11pt, - rightmargindistance=11pt% -] - - -\setupblank[5.5pt] - -\setuppagenumbering [location=] - -\definetyping [widetyping] - -\setupheader [style=\ss] -\setupfooter [style=\ss] - -\def\AuHead{% - %\ifnum\pageno=\MapsPage \hbox{}\else - \MapsRunningAuthor%\fi -} -\def\TiHead{% - \ifnum\pageno=\MapsPage \relax \MapsRunningAuthor %\hbox{} - \else \MapsRunningTitle\fi} - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% sectioning - -\setupheads[sectionnumber=no, align=right] - -\def\hfonti{\bfa} -\def\hfontii{\bf} -\def\hfontiii{\rm\bi} -\def\runin#1#2{#2.} - -\doifmodeelse{nosubsub}{% -\setuphead [section][% - style=\hfontii, - before={\blank[halfline]}, - after={}% -] -\setuphead [subsection][% - style=\hfontiii, - command=\runin, - alternative=text, - before={\blank[halfline]}% -]}{% -\setuphead [section][% - style=\hfonti, - before={\blank[13pt]}, - after={\blank[6pt]}% -] -\setuphead [subsection][% - style=\hfontii, - before={\blank[6pt]}, - after={}% -] -\setuphead [subsubsection][% - style=\hfontiii, - command=\runin, - alternative=text, - before={\blank[halfline]}% -]} - -\doifmodeelse{nosubsub}{% -\setuphead [subject][% - style=\hfontii, - before={\blank[halfline]}, - after={}% -] -\setuphead [subsubject][% - style=\hfontiii, - command=\runin, - alternative=text, - before={\blank[halfline]}% -]}{% -\setuphead [subject][% - style=\hfonti, - before={\blank}, - after={\blank[halfline]}% -] -\setuphead [subsubject][% - style=\hfontii, - before={\blank[halfline]}, - after={}% -] -\setuphead [subsubsubject][% - style=\hfontiii, - command=\runin, - alternative=text, - before={\blank[halfline]}% -]} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% floats - -\setupfloats [location=left, before={\ss}] -\setupcaptions [style={\ss}, - stopper=., - inbetween={\blank[halfline]}] - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% various document elements - -%\startnotmode[realfonts] -\def\ChkBox{% - \hbox {\boxrulewidth=.4pt \raise.2ex\ruledvbox - {\phantom{\vrule width .85ex height .85ex% -}}}} -%\stopnotmode -%\startmode[realfonts] -%\def\ChkBox{\raise.12ex\hbox{\ws \char50}} -%\stopmode -\definesymbol [1][\ChkBox] - -\setupitemize[1][packed] - -\setupitemize [each][% - indentnext=no, - align=right, - width=1em, - distance=0pt% -] - -% an outer form of itemize that does not indent -% the paragraph. - -\definecomplexorsimpleempty\startouteritemize -\def\complexstartouteritemize[#1]{\begingroup - \startitemize[width=1sp,#1] - \let\doitem\item - \def\item{\doitem[]\hbox{}\kern12pt\rightskip=0pt}% -} - -\def\stopouteritemize{\stopitemize\endgroup} - - -\setupenumerations [indentnext=no] - -\setupdescriptions [indentnext=no] - -\unexpanded\def\smalltyping{% - \switchtobodyfont[tt,9pt]% - \setuplocalinterlinespace[line=11pt]% - \parindent=0pt -} - -% typing: -% - prettyverbatim is NOT the default -% - smaller size - -\setuptyping [% - style={\smalltyping}, - option=none, - indentnext=no% -] - -\def\footnum#1{#1.} - -\setupfootnotes - [location=none, - width=\textwidth, - bodyfont=9pt, - before=, - numbercommand=\footnum] - -\setupfootnotedefinition - [location=serried, - before=, - after=, - distance=0.5em] - -\setuptabulate - [before=\blank, - inner=\ss, - after=\blank] - -\def\startIntroEntry#1% - {\blank[line] - \startbaselinecorrection - \bgroup - \setupalign[right] - \setuptolerance[verytolerant] - \setupindenting[no] - \switchtobodyfont[9pt]% - \hyphenpenalty10000 - \parfillskip 0pt plus 1fill - \rightskip6pt plus 1fill - \ss - \bgroup\bf #1\par\egroup - \ignorespaces } - -\def\stopIntroEntry - {\par\egroup \stopbaselinecorrection} - -\def\defineIntroEntry[#1][#2][#3]% - {\setvalue{start#1}{\startIntroEntry{#2}}% - \setvalue {stop#1}{\stopIntroEntry#3}} - -\defineIntroEntry[Keywords][Keywords][] -\defineIntroEntry[Abstract][Abstract][] - -% article parameters (other fields and defaults) -\def\MapsBibData[#1]% - {\getparameters [Maps] - [SubTitle=, - RunningAuthor=, - RunningTitle=, - Email=, - Address=, - Page=1, - Title=No Title given, - Author=No Author given, - Period=, - Number=99, - Year=2006, - #1]% - \doifnothing\MapsRunningAuthor - {\global\let\MapsRunningAuthor\MapsAuthor}% - \doifnothing\MapsRunningTitle - {\global\let\MapsRunningTitle\MapsTitle}}% - -\def\dostartArticle[#1]{% - \MapsBibData[#1] - \pageno=\MapsPage - \count0=\MapsPage - \setuppagenumber[number=\MapsPage] - \bgroup - \hsize = 457pt - \let\\\crlf - \blank[29pt,force] - \switchtobodyfont[rm,24pt] - \setupalign[right] - {\bf\noindent\MapsTitle\par\blank[6pt]} - \ifx\MapsSubTitle\empty \else - { \switchtobodyfont[ss,24pt]\sl\noindent - \advance \rightskip 0pt plus 2em - \MapsSubTitle\par} - \fi - \doifmodeelse{newstyle} - {\blank[22pt]} - {\blank[30pt]} - \egroup - \switchtobodyfont[rm,10pt] - \doifmode{newstyle} - {\noindent\MapsAuthor\blank[line]} - \setupalign[width] - \ifMapsInColumns - \startcolumns\hyphenpenalty1000 - \else - \clubpenalty10000 - \widowpenalty10000 - \fi -} - -\definecolumnset[mapsset][n=2,grid=on] - -\def\startArticle{\dosingleempty\dostartArticle} - -\def\stopArticle{% - {\blank\let\\\crlf - \noindent\switchtobodyfont[ss,9pt]% - \MapsAuthor - \doifsomething{\MapsAddress}{\\\MapsAddress}% - \doifsomething{\MapsEmail}{\\\MapsEmail}}% - \ifMapsInColumns \stopcolumns \fi - \page -} - -\installpagebreakhandler{last}{} - -%%% `logos' %%%%%%%%%%%%%%%%%%%%%%%%%% - -\def\LATEX{La\TeX} -\def\LaTeX{La\TeX} -\def\TEX{\TeX} -\def\CONTEXT{Con{\TeX}t} -\def\ConTeXt{Con{\TeX}t} -\def\METAFONT{Metafont} -\def\METAPOST{MetaPost} -\def\POSTSCRIPT{PostScript} - - -%%%%%%%%%%% - -\doifmodeelse{onecolumn}{% - \setuplayout[width=340pt] - \doifmodeelse{asym}{% one col, asymmetric - \setuplayout[backspace=187.3pt]% - \setuptyping [widetyping][oddmargin=-117pt] - \setuppagenumbering [alternative={singlesided,doublesided}] - \setupheadertexts - [{\hbox{}\hskip-117pt\TiHead}] - [{{\tfx\MapsPeriod~}\MapsYear\quad\bf\pagenumber\hskip-30pt\hbox{}}] - [{\hbox{}\hskip-147pt{\bf\pagenumber}\quad {\tfx MAPS~}\MapsNumber}] - [\AuHead] - \setupfootertexts - }{% one col, symmetric - \setuplayout[backspace=70.3pt] - \setuppagenumbering [alternative=doublesided] - \setuptyping[blank=halfline] - \setupheadertexts - [\TiHead] - [{{\tfx\MapsPeriod~}\MapsYear\quad\bf\pagenumber\hskip-147pt\hbox{}}] - [{\hbox{}\hskip-147pt{\bf\pagenumber}\quad {\tfx MAPS~}\MapsNumber}] - [\AuHead] - \setupfootertexts -}}{% two col - \setuplayout[width=457pt] - \setupcolumns[n=2,tolerance=verytolerant,distance=11pt] - \setuplayout[backspace=70.3pt,grid=yes] - \setuppagenumbering [alternative=doublesided] - \setuptyping[blank=halfline] - \setupheadertexts - [\TiHead] - [{{\tfx\MapsPeriod~}\MapsYear\quad\bf\pagenumber\hskip-30pt\hbox{}}] - [{\hbox{}\hskip-30pt{\bf\pagenumber}\quad {\tfx MAPS~}\MapsNumber}] - [\AuHead] - \setupfootertexts -} - -%\MapsBibData -% [] - -%\abovedisplayskip = 12pt -%\abovedisplayshortskip = 6pt - -\newdimen\iabovedisplayskip -\newdimen\iabovedisplayshortskip -%\let\abovedisplayskip\iabovedisplayskip -%\let\abovedisplayshortskip\iabovedisplayshortskip - -\setuplanguage - [nl] - [\c!leftquote=\upperleftsinglesixquote, - \c!leftquotation=\upperleftdoublesixquote] - -%\protect -\endinput diff --git a/Master/texmf-dist/tex/context/base/s-mod-00.mkii b/Master/texmf-dist/tex/context/base/s-mod-00.mkii new file mode 100644 index 00000000000..e2d07200c6a --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-mod-00.mkii @@ -0,0 +1,511 @@ +%D \module +%D [ file=s-mod-00, +%D version=very-old, +%D title=\CONTEXT\ Style File, +%D subtitle=Documentation Base Environment, +%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 looks like crap, is not documented, will +%D change, and used to be called modu-*.tex. + +% todo: +% +% file inclusions -> hyperlinks + +\mainlanguage[en] % better not here + +\usemodule[units] + +\enableactivediscretionaries +\newprettytrue + +\unprotect + +% beter: +% +% group -> title +% title -> category +% subtitle -> subtitle + +% herzien ivm fonts + +% nog eens \interface \\ \\ verder doorvoeren + +\def\resetmodule + {\getrawparameters + [Module] + [ file=\jobname, + type=, + version={\currentdate[\v!year,{.},\v!month,{.},\v!day]}, + system=\CONTEXT, + title=Unknown Title, + subtitle=, + author=Unknown Author, + date=\currentdate, + copyright=Unknown Copyright, + suggestions=]} + +\resetmodule + +\def\dostartmodule[#1]% + {\newcounter\ParagraphNumber + \resetmodule + \getrawparameters[Module][type=tex,#1]} + +\def\startmodule + {\starttext + \dosingleempty\dostartmodule} + +\def\complexmodule[#1]% + {\startglobal % i.v.m. \bgroup in \startdocumentation + \getrawparameters[Module][#1] + \stopglobal % i.v.m. \bgroup in \startdocumentation + \moduletitle} + +\def\stopmodule + {\page + \placeregister + [\v!index] + [\c!balance=\v!yes, + \c!indicator=\v!no, + \c!criterium=\v!text] + \stoptext} + +\def\simplemodule#1% + {\type{#1}} + +\definecomplexorsimple\module + +% \startmode[atpragma] +% +% \def\TitlePage#1% can be done more efficient +% {\startMPrun +% mpgraph := #1 ; +% input mp-cont ; +% \stopMPrun +% \externalfigure +% [\bufferprefix mprun.#1] +% [\c!height=\vsize, +% \c!width=\hsize]} +% +% \defineoverlay[titlepage][\TitlePage{512}] +% +% \stopmode + +\startuseMPgraphic{titlepage} + + width := PaperWidth ; + height := PaperHeight ; + + color local_red, local_white, local_blue ; + + local_white := white ; + + local_blue := local_white randomized (.6,.8) ; + local_red := local_white randomized (.3,.4) ; + + u := width/400 ; + + def a_module (expr dx, dy) = + picture p ; p := image + ( ddy := 0 ; sx := 60u ; + for i=1 upto (4 randomized 2) : + sy := 7u randomized 3u ; + fill unitsquare xyscaled(sx,sy) shifted (0,ddy) + withcolor local_red ; + ddy := ddy + sy + 4u ; + endfor ) ; + p := p shifted (dx,dy) shifted - center p ; + fill boundingbox p enlarged 8u withcolor local_white ; + fill boundingbox p enlarged 4u withcolor local_blue ; + draw p ; + enddef ; + + set_grid(width, height, width/15, height/15) ; + forever: + if new_on_grid(uniformdeviate width,uniformdeviate height): + a_module(dx,dy) ; + fi ; + exitif grid_full ; + endfor ; + + clip currentpicture to unitsquare xyscaled(width,height) ; +\stopuseMPgraphic + +\defineoverlay + [titlepage] + [\useMPgraphic{titlepage}] + +\doifmode{atpragma}{\readfile{s-mod-04.tex}{}{}} + +\defineframed + [TitleFrame] + [\c!background=\v!color, + \c!backgroundcolor=white, + \c!align=\v!right, + \c!offset=12pt, + \c!strut=\v!no, + \c!frame=\v!off, + \c!bottom=] + +\definelayout + [titlepage] + [\c!backspace=0pt, + \c!topspace=0pt, + \c!header=0pt, + \c!footer=0pt, + \c!height=\v!middle, + \c!width=\v!middle] + +\def\moduletitle + {\setuplayout[titlepage] + \ifx\ModuleNumber\undefined \else + \ifnum\ModuleNumber<10 + \edef\ModuleNumber{00\ModuleNumber} + \else\ifnum\ModuleNumber<100 + \edef\ModuleNumber{0\ModuleNumber} + \fi\fi + \setupbackgrounds + [\v!page] + [\c!background=titlepage] + \fi + \startmakeup[\v!standard][\c!headerstate=\v!none,\c!footerstate=\v!none] + \switchtobodyfont[14.4pt,ss] + \bgroup + \def\CONTEXT {Con\kern-.15em\TeX t} + \def\TEXUTIL {\TeX Util} + \def\PPCHTEX {PPCH\TeX} + \def\METAPOST{MetaPost} + \hfill + {\definedfont[SansBold at 96pt]\setstrut + \TitleFrame{\Modulesystem}} + \vfill + \definetabulate[temp][|l|l|]% + \switchtobodyfont[17.3pt,ss] + \hfill + {\bf\setstrut + \TitleFrame + {\insidefloattrue\setuptabulate[\c!before=,\c!after=]% + \starttemp + \doifsomething{\Moduletitle} + {\NC title \EQ \Moduletitle \NC\NR}% + \doifsomething{\Modulesubtitle} + {\NC subtitle \EQ \Modulesubtitle \NC\NR}% + \doifsomething{\Moduleauthor} + {\NC author \EQ \Moduleauthor \NC\NR}% + \NC date \EQ \currentdate \NC\NR + %\doifsomething{\Modulesuggestions} % todo: generates space + % {\NC suggestions \NC \Modulesuggestions \NC\NR}% + \stoptemp}} + \egroup + \stopmakeup + \ifx\ModuleNumber\undefined \else + \setupbackgrounds + [\v!page] + [\c!background=] + \fi + \setuplayout} + +\let\stopdocumentation=\relax + +\def\startdocumentation + {\bgroup + \doglobal\newcounter\NOfMarginLines + \def\stopdocumentation{\par\egroup}} + +\newif\ifcompressdefinitions + +\def\startcompressdefinitions {\global\compressdefinitionstrue} +\def\stopcompressdefinitions {\global\compressdefinitionsfalse} + +\gdef\CompressDefinitions% + {\ifcompressdefinitions + \switchtobodyfont[\v!small]% + \fi} + +\startnotmode[nocode] + + \definetyping + [definition] + + \setuptyping + [definition] + [\c!before={\page[\v!preference]}\blank\PresetParagraphNumber\CompressDefinitions, + \c!after=\ResetParagraphNumber\blank, + \c!option=\Moduletype] + +\stopnotmode + +\startmode[nocode] + +% \definieerbuffer[definition] % ignore + + \long\def\startdefinition#1\stopdefinition{} + +\stopmode + +\definetyping [PL] [\c!option=PL, \c!margin=\v!standard] +\definetyping [JV] [\c!option=JV, \c!margin=\v!standard] +\definetyping [MP] [\c!option=MP, \c!margin=\v!standard] +\definetyping [TEX] [\c!option=TEX,\c!margin=\v!standard] + +\setuptyping [\v!typing] [\c!margin=\v!standard] +\setuptyping [\v!file] [\c!margin=\v!standard] +\setuptyping [definition] [\c!margin=0pt] + +\newcounter\NOfMarginLines +\newcounter\ParagraphNumber + +\def\ResetParagraphNumber + {\egroup} + +\def\PresetParagraphNumber + {\bgroup + \xdef\NOfTextLines% + {\the\prevgraf}% + \doglobal\decrement\NOfMarginLines + \doglobal\increment\ParagraphNumber + \message{.}% + \gdef\ShowParagraphNumber% + {\llap{\slx\ParagraphNumber\hskip\leftmargindistance}}% + \gdef\ShowParagraphNumberA% + {\ifnum\NOfMarginLines>\NOfTextLines\relax + \doglobal\increment\NOfTextLines + \else + \ShowParagraphNumber + \global\let\ShowParagraphNumberA=\relax + \global\let\ShowParagraphNumberB=\ShowParagraphNumber + \doglobal\newcounter\NOfMarginLines + \fi}% + \gdef\ShowParagraphNumberB% + {}% + \EveryLine + {\ShowParagraphNumberA}% + \EveryPar + {\vadjust{\nobreak}% + \ShowParagraphNumberB}} + +\EveryPar % skip one + {\EveryPar + {\doglobal\newcounter\NOfMarginLines}} + +\def\dodomargeaanduidingen[#1]#2% + {\def\docommand##1% + {\indent\hbox + {\ifx#2\relax + \index{##1}% + \else + \index{#2{##1}}% + \fi + #2{\doboundtext{##1}{\leftmarginwidth}{..}}}% + \doglobal\increment\NOfMarginLines + \endgraf}% + \processcommalist[#1]\docommand} + +\def\margeaanduidingen#1[#2]% + {\def\domargeaanduidingen##1##2% + {\margintitle[#2]% + {\switchtobodyfont[\v!small]% + \doglobal\newcounter\NOfMarginLines + \dodomargeaanduidingen[##1]#1% + \scratchcounter=\NOfMarginLines + \multiply\scratchcounter by 10 + \divide\scratchcounter by 12 + \advance\scratchcounter by 1 + \xdef\NOfMarginLines{\the\scratchcounter}% + \processcommalist[##2]\index}}% + \dodoublegroupempty\domargeaanduidingen} + +\def\complexmacros{\margeaanduidingen\tex } +\def\complexextras{\margeaanduidingen\relax} + +\def\complexelements + {\margeaanduidingen\someelement} + +\def\someelement#1{\type{<#1>}} + +\definecomplexorsimpleempty\macros +\definecomplexorsimpleempty\extras +\definecomplexorsimpleempty\elements + +\def\showelements{\dodoubleempty\doshowelements} + +\def\doshowelements[#1][#2] + {\bgroup + \processXMLbuffer + \typebuffer + \setupcolors[\c!state=\v!stop] + \showXSDcomponent[#1][#2] + \egroup} + +% \macros{a,b} +% \macros{a,b}{b} +% \macros[a]{a,b}{b} + +% weg ermee + +\defineparagraphs [interface] [\c!n=2] +\setupparagraphs [interface] [1] [\c!width=4cm] + +\def\startexample{\par\startnarrower} \let\startvoorbeeld\startexample +\def\stopexample {\stopnarrower} \let\stopvoorbeeld \stopexample + +\gdef\VisualizeLastSpace{\ifdim\lastskip>0pt\unskip\tttf\char32\fi} + +\gdef\ShowHeadText #1{\tttf#1\VL\mainlanguage[\currentlanguage]\headtext {#1}\VisualizeLastSpace} +\gdef\ShowLabelText#1{\tttf#1\VL\mainlanguage[\currentlanguage]\labeltext{#1}\VisualizeLastSpace} + +\startbuffer[lang-a] +\starttable[|l|l|] + \HL + \VL \bf head key \VL \bf current value \VL\SR + \HL + \VL \ShowHeadText \v!abbreviations \VL\FR + \VL \ShowHeadText \v!units \VL\MR + \VL \ShowHeadText \v!figures \VL\MR + \VL \ShowHeadText \v!graphics \VL\MR + \VL \ShowHeadText \v!index \VL\MR + \VL \ShowHeadText \v!content \VL\MR + \VL \ShowHeadText \v!intermezzi \VL\MR + \VL \ShowHeadText \v!logos \VL\MR + \VL \ShowHeadText \v!tables \VL\LR + \HL +\stoptable +\stopbuffer + +\startbuffer[lang-b] +\starttable[|l|l|] + \HL + \VL \bf label key \VL \bf current value \VL\SR + \HL + \VL \ShowLabelText \v!table \VL\FR + \VL \ShowLabelText \v!figure \VL\MR + \VL \ShowLabelText \v!intermezzo \VL\MR + \VL \ShowLabelText \v!graphic \VL\MR + \VL \ShowLabelText \v!chapter \VL\MR + \VL \ShowLabelText \v!section \VL\MR + \VL \ShowLabelText \v!subsection \VL\MR + \VL \ShowLabelText \v!subsubsection \VL\MR + \VL \ShowLabelText \v!appendix \VL\MR + \VL \ShowLabelText \v!part \VL\MR + \VL \ShowLabelText \v!line \VL\MR + \VL \ShowLabelText \v!lines \VL\LR + \HL +\stoptable +\stopbuffer + +\startbuffer[lang-c] +\starttable[|l|l|] + \HL + \VL \bf label key \VL \bf current value \VL\SR + \HL + \VL \ShowLabelText \v!january \VL\FR + \VL \ShowLabelText \v!february \VL\MR + \VL \ShowLabelText \v!march \VL\MR + \VL \ShowLabelText \v!april \VL\MR + \VL \ShowLabelText \v!may \VL\MR + \VL \ShowLabelText \v!june \VL\MR + \VL \ShowLabelText \v!july \VL\MR + \VL \ShowLabelText \v!august \VL\MR + \VL \ShowLabelText \v!september \VL\MR + \VL \ShowLabelText \v!october \VL\MR + \VL \ShowLabelText \v!november \VL\MR + \VL \ShowLabelText \v!december \VL\LR + \HL +\stoptable +\stopbuffer + +\startbuffer[lang-d] +\starttable[|l|l|] + \HL + \VL \bf label key \VL \bf current value \VL\SR + \HL + \VL \ShowLabelText \v!sunday \VL\FR + \VL \ShowLabelText \v!monday \VL\MR + \VL \ShowLabelText \v!tuesday \VL\MR + \VL \ShowLabelText \v!wednesday \VL\MR + \VL \ShowLabelText \v!thursday \VL\MR + \VL \ShowLabelText \v!friday \VL\MR + \VL \ShowLabelText \v!saturday \VL\LR + \HL +\stoptable +\stopbuffer + +\gdef\ShowTextsValues[#1][#2]% + {\vbox\bgroup + \language[#1]% + \setbox\scratchbox\hbox to \hsize{\hss\bfb#2 language defaults\hss} + \dp\scratchbox\zeropoint + \box\scratchbox + \vskip1em + \hrule + \vskip2em + \halign + {\hss##\hss&##\hskip1em&\hss##\hss\cr + $\vcenter{\getbuffer[lang-a]}$&&$\vcenter{\getbuffer[lang-b]}$\cr + \noalign{\vskip1em} + $\vcenter{\getbuffer[lang-c]}$&&$\vcenter{\getbuffer[lang-d]}$\cr}% + \egroup} + +\gdef\ShowLanguageValues[#1][#2]#3#4% + {\hbox to \hsize + {\hss + \vbox + \bgroup + \language[#1]% + \let\normalbar=| + \starttable[||||] + \HL + \VL \THREE{\bf subsentence symbol and quotes} \VL\SR + \HL + \VL \quotation{#3 #4} \VL \quote{#2} \VL \let|=\normalbar |<||<|#3|>|#4|>| \VL\FR + \VL \quotation{#3 #4} \VL \quote{#2} \VL |<||<|#3|>|#4|>| \VL\LR + \HL + \stoptable + \egroup + \hss}} + +\gdef\doShowAllLanguageValues[#1][#2]#3#4% + {\vbox + {\ShowTextsValues[#1][#2] + \vskip2em + \ShowLanguageValues[#1][#2]{#3}{#4}} + \protect + \page} + +\gdef\ShowAllLanguageValues + {\page + \unprotect + \dodoubleargument\doShowAllLanguageValues} + +\protect + +%D Command references: + +% \input setupa +% \input setupb + +\usemodule[int-load] \loadsetups + +\unprotect + +% \def\showsetup +% {\doglobal\newcounter\CurrentArgument +% \setup} + +\def\showsetup#1% + {{\def\y##1{\writestatus{setups}{warning: remove y! from #1}}% + \setup{#1}}} + +\setupframedtexts + [setuptext] + [\c!background=\v!screen, + \c!frame=\v!off] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/s-mod-00.mkiv b/Master/texmf-dist/tex/context/base/s-mod-00.mkiv new file mode 100644 index 00000000000..f6b6f7ba2e2 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-mod-00.mkiv @@ -0,0 +1,481 @@ +%D \module +%D [ file=s-mod-00, +%D version=very-old, +%D title=\CONTEXT\ Style File, +%D subtitle=Documentation Base Environment, +%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 looks like crap, is not documented, will +%D change, and used to be called modu-*.tex. + +% now split in mkii/mkiv so we will cleanup + +\mainlanguage[en] % better not here + +\usemodule[units] + +\unprotect + +% beter: +% +% group -> title +% title -> category +% subtitle -> subtitle + +% herzien ivm fonts + +% nog eens \interface \\ \\ verder doorvoeren + +\def\resetmodule + {\getrawparameters + [Module] + [ file=\jobname, + type=, + version={\currentdate[\v!year,{.},\v!month,{.},\v!day]}, + system=\CONTEXT, + title=Unknown Title, + subtitle=, + author=Unknown Author, + date=\currentdate, + copyright=Unknown Copyright, + suggestions=]} + +\resetmodule + +\def\dostartmodule[#1]% + {\newcounter\ParagraphNumber + \resetmodule + \getrawparameters[Module][type=tex,#1]} + +\def\startmodule + {\starttext + \dosingleempty\dostartmodule} + +\def\complexmodule[#1]% + {\startglobal % i.v.m. \bgroup in \startdocumentation + \getrawparameters[Module][#1] + \stopglobal % i.v.m. \bgroup in \startdocumentation + \moduletitle} + +\def\stopmodule + {\page + \placeregister + [\v!index] + [\c!balance=\v!yes, + \c!indicator=\v!no, + \c!criterium=\v!text] + \stoptext} + +\def\simplemodule#1% + {\type{#1}} + +\definecomplexorsimple\module + +\startuseMPgraphic{titlepage} + + width := PaperWidth ; + height := PaperHeight ; + + color local_red, local_white, local_blue ; + + local_white := white ; + + local_blue := local_white randomized (.6,.8) ; + local_red := local_white randomized (.3,.4) ; + + u := width/400 ; + + def a_module (expr dx, dy) = + picture p ; p := image + ( ddy := 0 ; sx := 60u ; + for i=1 upto (4 randomized 2) : + sy := 7u randomized 3u ; + fill unitsquare xyscaled(sx,sy) shifted (0,ddy) + withcolor local_red ; + ddy := ddy + sy + 4u ; + endfor ) ; + p := p shifted (dx,dy) shifted - center p ; + fill boundingbox p enlarged 8u withcolor local_white ; + fill boundingbox p enlarged 4u withcolor local_blue ; + draw p ; + enddef ; + + set_grid(width, height, width/15, height/15) ; + forever: + if new_on_grid(uniformdeviate width,uniformdeviate height): + a_module(dx,dy) ; + fi ; + exitif grid_full ; + endfor ; + + clip currentpicture to unitsquare xyscaled(width,height) ; +\stopuseMPgraphic + +\defineoverlay + [titlepage] + [\useMPgraphic{titlepage}] + +\doifmode{atpragma}{\readfile{s-mod-04.tex}{}{}} + +\defineframed + [TitleFrame] + [\c!background=\v!color, + \c!backgroundcolor=white, + \c!align=\v!right, + \c!offset=12pt, + \c!strut=\v!no, + \c!frame=\v!off, + \c!bottom=] + +\definelayout + [titlepage] + [\c!backspace=0pt, + \c!topspace=0pt, + \c!header=0pt, + \c!footer=0pt, + \c!height=\v!middle, + \c!width=\v!middle] + +\def\moduletitle + {\setuplayout[titlepage] + \ifx\ModuleNumber\undefined \else + \ifnum\ModuleNumber<10 + \edef\ModuleNumber{00\ModuleNumber} + \else\ifnum\ModuleNumber<100 + \edef\ModuleNumber{0\ModuleNumber} + \fi\fi + \setupbackgrounds + [\v!page] + [\c!background=titlepage] + \fi + \startmakeup[\v!standard][\c!headerstate=\v!none,\c!footerstate=\v!none] + \switchtobodyfont[14.4pt,ss] + \bgroup + \def\CONTEXT {Con\kern-.15em\TeX t} + \def\TEXUTIL {\TeX Util} + \def\PPCHTEX {PPCH\TeX} + \def\METAPOST{MetaPost} + \hfill + {\definedfont[SansBold at 96pt]\setstrut + \TitleFrame{\Modulesystem}} + \vfill + \definetabulate[temp][|l|l|]% + \switchtobodyfont[17.3pt,ss] + \hfill + {\bf\setstrut + \TitleFrame + {\insidefloattrue\setuptabulate[\c!before=,\c!after=]% + \starttemp + \doifsomething{\Moduletitle} + {\NC title \EQ \Moduletitle \NC\NR}% + \doifsomething{\Modulesubtitle} + {\NC subtitle \EQ \Modulesubtitle \NC\NR}% + \doifsomething{\Moduleauthor} + {\NC author \EQ \Moduleauthor \NC\NR}% + \NC date \EQ \currentdate \NC\NR + %\doifsomething{\Modulesuggestions} % todo: generates space + % {\NC suggestions \NC \Modulesuggestions \NC\NR}% + \stoptemp}} + \egroup + \stopmakeup + \ifx\ModuleNumber\undefined \else + \setupbackgrounds + [\v!page] + [\c!background=] + \fi + \setuplayout} + +\let\stopdocumentation=\relax + +\def\startdocumentation + {\bgroup + \doglobal\newcounter\NOfMarginLines + \def\stopdocumentation{\par\egroup}} + +\newif\ifcompressdefinitions + +\def\startcompressdefinitions {\global\compressdefinitionstrue} +\def\stopcompressdefinitions {\global\compressdefinitionsfalse} + +\gdef\CompressDefinitions% + {\ifcompressdefinitions + \switchtobodyfont[\v!small]% + \fi} + +\startnotmode[nocode] + + \definetyping + [definition] + + \setuptyping + [definition] + [\c!before={\page[\v!preference]}\blank\PresetParagraphNumber\CompressDefinitions, + \c!after=\ResetParagraphNumber\blank, + \c!option=\Moduletype] + +\stopnotmode + +\startmode[nocode] + + \long\def\startdefinition#1\stopdefinition{} + +\stopmode + +\definetyping [PL] [\c!option=PL, \c!margin=\v!standard] +\definetyping [JV] [\c!option=JV, \c!margin=\v!standard] +\definetyping [MP] [\c!option=MP, \c!margin=\v!standard] +\definetyping [TEX] [\c!option=TEX,\c!margin=\v!standard] + +\setuptyping [\v!typing] [\c!margin=\v!standard] +\setuptyping [\v!file] [\c!margin=\v!standard] +\setuptyping [definition] [\c!margin=0pt] + +\newcounter\NOfMarginLines +\newcounter\ParagraphNumber + +\def\ResetParagraphNumber + {\egroup} + +\def\PresetParagraphNumber + {\bgroup + \xdef\NOfTextLines% + {\the\prevgraf}% + \doglobal\decrement\NOfMarginLines + \doglobal\increment\ParagraphNumber + \message{.}% + \gdef\ShowParagraphNumber% + {\llap{\slx\ParagraphNumber\hskip\leftmargindistance}}% + \gdef\ShowParagraphNumberA% + {\ifnum\NOfMarginLines>\NOfTextLines\relax + \doglobal\increment\NOfTextLines + \else + \ShowParagraphNumber + \global\let\ShowParagraphNumberA=\relax + \global\let\ShowParagraphNumberB=\ShowParagraphNumber + \doglobal\newcounter\NOfMarginLines + \fi}% + \gdef\ShowParagraphNumberB% + {}% + \EveryLine + {\ShowParagraphNumberA}% + \EveryPar + {\vadjust{\nobreak}% + \ShowParagraphNumberB}} + +\EveryPar % skip one + {\EveryPar + {\doglobal\newcounter\NOfMarginLines}} + +\def\dodomargeaanduidingen[#1]#2% + {\def\docommand##1% + {\indent\hbox + {\ifx#2\relax + \index{##1}% + \else + \index{#2{##1}}% + \fi + #2{\doboundtext{##1}{\leftmarginwidth}{..}}}% + \doglobal\increment\NOfMarginLines + \endgraf}% + \processcommalist[#1]\docommand} + +\def\margeaanduidingen#1[#2]% + {\def\domargeaanduidingen##1##2% + {\margintitle[#2]% + {\switchtobodyfont[\v!small]% + \doglobal\newcounter\NOfMarginLines + \dodomargeaanduidingen[##1]#1% + \scratchcounter=\NOfMarginLines + \multiply\scratchcounter by 10 + \divide\scratchcounter by 12 + \advance\scratchcounter by 1 + \xdef\NOfMarginLines{\the\scratchcounter}% + \processcommalist[##2]\index}}% + \dodoublegroupempty\domargeaanduidingen} + +\def\complexmacros{\margeaanduidingen\tex } +\def\complexextras{\margeaanduidingen\relax} + +\def\complexelements + {\margeaanduidingen\someelement} + +\def\someelement#1{\type{<#1>}} + +\definecomplexorsimpleempty\macros +\definecomplexorsimpleempty\extras +\definecomplexorsimpleempty\elements + +\def\showelements{\dodoubleempty\doshowelements} + +\def\doshowelements[#1][#2] + {\bgroup + \processXMLbuffer + \typebuffer + \setupcolors[\c!state=\v!stop] + \showXSDcomponent[#1][#2] + \egroup} + +% \macros{a,b} +% \macros{a,b}{b} +% \macros[a]{a,b}{b} + +% weg ermee + +\defineparagraphs [interface] [\c!n=2] +\setupparagraphs [interface] [1] [\c!width=4cm] + +\def\startexample{\par\startnarrower} \let\startvoorbeeld\startexample +\def\stopexample {\stopnarrower} \let\stopvoorbeeld \stopexample + +\gdef\VisualizeLastSpace{\ifdim\lastskip>0pt\unskip\tttf\char32\fi} + +\gdef\ShowHeadText #1{\tttf#1\VL\mainlanguage[\currentlanguage]\headtext {#1}\VisualizeLastSpace} +\gdef\ShowLabelText#1{\tttf#1\VL\mainlanguage[\currentlanguage]\labeltext{#1}\VisualizeLastSpace} + +\startbuffer[lang-a] +\starttable[|l|l|] + \HL + \VL \bf head key \VL \bf current value \VL\SR + \HL + \VL \ShowHeadText \v!abbreviations \VL\FR + \VL \ShowHeadText \v!units \VL\MR + \VL \ShowHeadText \v!figures \VL\MR + \VL \ShowHeadText \v!graphics \VL\MR + \VL \ShowHeadText \v!index \VL\MR + \VL \ShowHeadText \v!content \VL\MR + \VL \ShowHeadText \v!intermezzi \VL\MR + \VL \ShowHeadText \v!logos \VL\MR + \VL \ShowHeadText \v!tables \VL\LR + \HL +\stoptable +\stopbuffer + +\startbuffer[lang-b] +\starttable[|l|l|] + \HL + \VL \bf label key \VL \bf current value \VL\SR + \HL + \VL \ShowLabelText \v!table \VL\FR + \VL \ShowLabelText \v!figure \VL\MR + \VL \ShowLabelText \v!intermezzo \VL\MR + \VL \ShowLabelText \v!graphic \VL\MR + \VL \ShowLabelText \v!chapter \VL\MR + \VL \ShowLabelText \v!section \VL\MR + \VL \ShowLabelText \v!subsection \VL\MR + \VL \ShowLabelText \v!subsubsection \VL\MR + \VL \ShowLabelText \v!appendix \VL\MR + \VL \ShowLabelText \v!part \VL\MR + \VL \ShowLabelText \v!line \VL\MR + \VL \ShowLabelText \v!lines \VL\LR + \HL +\stoptable +\stopbuffer + +\startbuffer[lang-c] +\starttable[|l|l|] + \HL + \VL \bf label key \VL \bf current value \VL\SR + \HL + \VL \ShowLabelText \v!january \VL\FR + \VL \ShowLabelText \v!february \VL\MR + \VL \ShowLabelText \v!march \VL\MR + \VL \ShowLabelText \v!april \VL\MR + \VL \ShowLabelText \v!may \VL\MR + \VL \ShowLabelText \v!june \VL\MR + \VL \ShowLabelText \v!july \VL\MR + \VL \ShowLabelText \v!august \VL\MR + \VL \ShowLabelText \v!september \VL\MR + \VL \ShowLabelText \v!october \VL\MR + \VL \ShowLabelText \v!november \VL\MR + \VL \ShowLabelText \v!december \VL\LR + \HL +\stoptable +\stopbuffer + +\startbuffer[lang-d] +\starttable[|l|l|] + \HL + \VL \bf label key \VL \bf current value \VL\SR + \HL + \VL \ShowLabelText \v!sunday \VL\FR + \VL \ShowLabelText \v!monday \VL\MR + \VL \ShowLabelText \v!tuesday \VL\MR + \VL \ShowLabelText \v!wednesday \VL\MR + \VL \ShowLabelText \v!thursday \VL\MR + \VL \ShowLabelText \v!friday \VL\MR + \VL \ShowLabelText \v!saturday \VL\LR + \HL +\stoptable +\stopbuffer + +\gdef\ShowTextsValues[#1][#2]% + {\vbox\bgroup + \language[#1]% + \setbox\scratchbox\hbox to \hsize{\hss\bfb#2 language defaults\hss} + \dp\scratchbox\zeropoint + \box\scratchbox + \vskip1em + \hrule + \vskip2em + \halign + {\hss##\hss&##\hskip1em&\hss##\hss\cr + $\vcenter{\getbuffer[lang-a]}$&&$\vcenter{\getbuffer[lang-b]}$\cr + \noalign{\vskip1em} + $\vcenter{\getbuffer[lang-c]}$&&$\vcenter{\getbuffer[lang-d]}$\cr}% + \egroup} + +\gdef\ShowLanguageValues[#1][#2]#3#4% + {\hbox to \hsize + {\hss + \vbox + \bgroup + \language[#1]% + \let\normalbar=| + \starttable[||||] + \HL + \VL \THREE{\bf subsentence symbol and quotes} \VL\SR + \HL + \VL \quotation{#3 #4} \VL \quote{#2} \VL \let|=\normalbar |<||<|#3|>|#4|>| \VL\FR + \VL \quotation{#3 #4} \VL \quote{#2} \VL |<||<|#3|>|#4|>| \VL\LR + \HL + \stoptable + \egroup + \hss}} + +\gdef\doShowAllLanguageValues[#1][#2]#3#4% + {\vbox + {\ShowTextsValues[#1][#2] + \vskip2em + \ShowLanguageValues[#1][#2]{#3}{#4}} + \protect + \page} + +\gdef\ShowAllLanguageValues + {\page + \unprotect + \dodoubleargument\doShowAllLanguageValues} + +\protect + +%D Command references: + +\usemodule[int-load] \loadsetups + +\unprotect + +\def\showsetup#1% + {{\def\y##1{\writestatus{setups}{warning: remove y! from #1}}% + \setup{#1}}} + +\setupframedtexts + [setuptext] + [\c!background=\v!screen, + \c!frame=\v!off] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/s-mod-00.tex b/Master/texmf-dist/tex/context/base/s-mod-00.tex deleted file mode 100644 index 270f7a9b4c7..00000000000 --- a/Master/texmf-dist/tex/context/base/s-mod-00.tex +++ /dev/null @@ -1,512 +0,0 @@ -%D \module -%D [ file=s-mod-00, -%D version=very-old, -%D title=\CONTEXT\ Style File, -%D subtitle=Documentation Base Environment, -%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 looks like crap, is not documented, will -%D change, and used to be called modu-*.tex. - -% todo: -% -% file inclusions -> hyperlinks - -\mainlanguage[en] % better not here - -\usemodule[units] - -\doifnotmode{mkiv}{ - \enableactivediscretionaries - \newprettytrue -} - -\unprotect - -% beter: -% -% group -> title -% title -> category -% subtitle -> subtitle - -% herzien ivm fonts - -% nog eens \interface \\ \\ verder doorvoeren - -\def\resetmodule - {\getrawparameters - [Module] - [ file=\jobname, - version={\currentdate[\v!year,{.},\v!month,{.},\v!day]}, - system=\CONTEXT, - title=, - subtitle=, - author=Hans Hagen, - date=\currentdate, - copyright={PRAGMA / Hans Hagen \& Ton Otten}, - suggestions=]} - -\resetmodule - -\def\dostartmodule[#1]% - {\newcounter\ParagraphNumber - \resetmodule - \getrawparameters[Module][type=tex,#1]} - -\def\startmodule - {\starttext - \dosingleempty\dostartmodule} - -\def\complexmodule[#1]% - {\startglobal % i.v.m. \bgroup in \startdocumentation - \getrawparameters[Module][#1] - \stopglobal % i.v.m. \bgroup in \startdocumentation - \moduletitle} - -\def\stopmodule - {\page - \placeregister - [\v!index] - [\c!balance=\v!yes, - \c!indicator=\v!no, - \c!criterium=\v!text] - \stoptext} - -\def\simplemodule#1% - {\type{#1}} - -\definecomplexorsimple\module - -% \startmode[atpragma] -% -% \def\TitlePage#1% can be done more efficient -% {\startMPrun -% mpgraph := #1 ; -% input mp-cont ; -% \stopMPrun -% \externalfigure -% [\bufferprefix mprun.#1] -% [\c!height=\vsize, -% \c!width=\hsize]} -% -% \defineoverlay[titlepage][\TitlePage{512}] -% -% \stopmode - -\startuseMPgraphic{titlepage} - - width := PaperWidth ; - height := PaperHeight ; - - color local_red, local_white, local_blue ; - - local_white := white ; - - local_blue := local_white randomized (.6,.8) ; - local_red := local_white randomized (.3,.4) ; - - u := width/400 ; - - def a_module (expr dx, dy) = - picture p ; p := image - ( ddy := 0 ; sx := 60u ; - for i=1 upto (4 randomized 2) : - sy := 7u randomized 3u ; - fill unitsquare xyscaled(sx,sy) shifted (0,ddy) - withcolor local_red ; - ddy := ddy + sy + 4u ; - endfor ) ; - p := p shifted (dx,dy) shifted - center p ; - fill boundingbox p enlarged 8u withcolor local_white ; - fill boundingbox p enlarged 4u withcolor local_blue ; - draw p ; - enddef ; - - set_grid(width, height, width/15, height/15) ; - forever: - if new_on_grid(uniformdeviate width,uniformdeviate height): - a_module(dx,dy) ; - fi ; - exitif grid_full ; - endfor ; - - clip currentpicture to unitsquare xyscaled(width,height) ; -\stopuseMPgraphic - -\defineoverlay - [titlepage] - [\useMPgraphic{titlepage}] - -\doifmode{atpragma}{\readfile{s-mod-04.tex}{}{}} - -\defineframed - [TitleFrame] - [\c!background=\v!color, - \c!backgroundcolor=white, - \c!align=\v!right, - \c!offset=12pt, - \c!strut=\v!no, - \c!frame=\v!off, - \c!bottom=] - -\definelayout - [titlepage] - [\c!backspace=0pt, - \c!topspace=0pt, - \c!header=0pt, - \c!footer=0pt, - \c!height=\v!middle, - \c!width=\v!middle] - -\def\moduletitle - {\setuplayout[titlepage] - \ifx\ModuleNumber\undefined \else - \ifnum\ModuleNumber<10 - \edef\ModuleNumber{00\ModuleNumber} - \else\ifnum\ModuleNumber<100 - \edef\ModuleNumber{0\ModuleNumber} - \fi\fi - \setupbackgrounds - [\v!page] - [\c!background=titlepage] - \fi - \startmakeup[\v!standard][\c!headerstate=\v!none,\c!footerstate=\v!none] - \switchtobodyfont[14.4pt,ss] - \bgroup - \def\CONTEXT {Con\kern-.15em\TeX t} - \def\TEXUTIL {\TeX Util} - \def\PPCHTEX {PPCH\TeX} - \def\METAPOST{MetaPost} - \hfill - {\definedfont[SansBold at 96pt]\setstrut - \TitleFrame{\Modulesystem}} - \vfill - \definetabulate[temp][|l|l|]% - \switchtobodyfont[17.3pt,ss] - \hfill - {\bf\setstrut - \TitleFrame - {\insidefloattrue\setuptabulate[\c!before=,\c!after=]% - \starttemp - \doifsomething{\Moduletitle} - {\NC title \EQ \Moduletitle \NC\NR}% - \doifsomething{\Modulesubtitle} - {\NC subtitle \EQ \Modulesubtitle \NC\NR}% - \doifsomething{\Moduleauthor} - {\NC author \EQ \Moduleauthor \NC\NR}% - \NC date \EQ \currentdate \NC\NR - %\doifsomething{\Modulesuggestions} % todo: generates space - % {\NC suggestions \NC \Modulesuggestions \NC\NR}% - \stoptemp}} - \egroup - \stopmakeup - \ifx\ModuleNumber\undefined \else - \setupbackgrounds - [\v!page] - [\c!background=] - \fi - \setuplayout} - -\let\stopdocumentation=\relax - -\def\startdocumentation - {\bgroup - \doglobal\newcounter\NOfMarginLines - \def\stopdocumentation{\par\egroup}} - -\newif\ifcompressdefinitions - -\def\startcompressdefinitions {\global\compressdefinitionstrue} -\def\stopcompressdefinitions {\global\compressdefinitionsfalse} - -\gdef\CompressDefinitions% - {\ifcompressdefinitions - \switchtobodyfont[\v!small]% - \fi} - -\startnotmode[nocode] - - \definetyping - [definition] - - \setuptyping - [definition] - [\c!before={\page[\v!preference]}\blank\PresetParagraphNumber\CompressDefinitions, - \c!after=\ResetParagraphNumber\blank, - \c!option=\Moduletype] - -\stopnotmode - -\startmode[nocode] - -% \definieerbuffer[definition] % ignore - - \long\def\startdefinition#1\stopdefinition{} - -\stopmode - -\definetyping [PL] [\c!option=PL, \c!margin=\v!standard] -\definetyping [JV] [\c!option=JV, \c!margin=\v!standard] -\definetyping [MP] [\c!option=MP, \c!margin=\v!standard] -\definetyping [TEX] [\c!option=TEX,\c!margin=\v!standard] - -\setuptyping [\v!typing] [\c!margin=\v!standard] -\setuptyping [\v!file] [\c!margin=\v!standard] -\setuptyping [definition] [\c!margin=0pt] - -\newcounter\NOfMarginLines -\newcounter\ParagraphNumber - -\def\ResetParagraphNumber - {\egroup} - -\def\PresetParagraphNumber - {\bgroup - \xdef\NOfTextLines% - {\the\prevgraf}% - \doglobal\decrement\NOfMarginLines - \doglobal\increment\ParagraphNumber - \message{.}% - \gdef\ShowParagraphNumber% - {\llap{\slx\ParagraphNumber\hskip\leftmargindistance}}% - \gdef\ShowParagraphNumberA% - {\ifnum\NOfMarginLines>\NOfTextLines\relax - \doglobal\increment\NOfTextLines - \else - \ShowParagraphNumber - \global\let\ShowParagraphNumberA=\relax - \global\let\ShowParagraphNumberB=\ShowParagraphNumber - \doglobal\newcounter\NOfMarginLines - \fi}% - \gdef\ShowParagraphNumberB% - {}% - \EveryLine - {\ShowParagraphNumberA}% - \EveryPar - {\vadjust{\nobreak}% - \ShowParagraphNumberB}} - -\EveryPar % skip one - {\EveryPar - {\doglobal\newcounter\NOfMarginLines}} - -\def\dodomargeaanduidingen[#1]#2% - {\def\docommand##1% - {\indent\hbox - {\ifx#2\relax - \index{##1}% - \else - \index{#2{##1}}% - \fi - #2{\doboundtext{##1}{\leftmarginwidth}{..}}}% - \doglobal\increment\NOfMarginLines - \endgraf}% - \processcommalist[#1]\docommand} - -\def\margeaanduidingen#1[#2]% - {\def\domargeaanduidingen##1##2% - {\margintitle[#2]% - {\switchtobodyfont[\v!small]% - \doglobal\newcounter\NOfMarginLines - \dodomargeaanduidingen[##1]#1% - \scratchcounter=\NOfMarginLines - \multiply\scratchcounter by 10 - \divide\scratchcounter by 12 - \advance\scratchcounter by 1 - \xdef\NOfMarginLines{\the\scratchcounter}% - \processcommalist[##2]\index}}% - \dodoublegroupempty\domargeaanduidingen} - -\def\complexmacros{\margeaanduidingen\tex } -\def\complexextras{\margeaanduidingen\relax} - -\def\complexelements - {\margeaanduidingen\someelement} - -\def\someelement#1{\type{<#1>}} - -\definecomplexorsimpleempty\macros -\definecomplexorsimpleempty\extras -\definecomplexorsimpleempty\elements - -\def\showelements{\dodoubleempty\doshowelements} - -\def\doshowelements[#1][#2] - {\bgroup - \processXMLbuffer - \typebuffer - \setupcolors[\c!state=\v!stop] - \showXSDcomponent[#1][#2] - \egroup} - -% \macros{a,b} -% \macros{a,b}{b} -% \macros[a]{a,b}{b} - -% weg ermee - -\defineparagraphs [interface] [\c!n=2] -\setupparagraphs [interface] [1] [\c!width=4cm] - -\def\startexample{\par\startnarrower} \let\startvoorbeeld\startexample -\def\stopexample {\stopnarrower} \let\stopvoorbeeld \stopexample - -\gdef\VisualizeLastSpace{\ifdim\lastskip>0pt\unskip\tttf\char32\fi} - -\gdef\ShowHeadText #1{\tttf#1\VL\mainlanguage[\currentlanguage]\headtext {#1}\VisualizeLastSpace} -\gdef\ShowLabelText#1{\tttf#1\VL\mainlanguage[\currentlanguage]\labeltext{#1}\VisualizeLastSpace} - -\startbuffer[lang-a] -\starttable[|l|l|] - \HL - \VL \bf head key \VL \bf current value \VL\SR - \HL - \VL \ShowHeadText \v!abbreviations \VL\FR - \VL \ShowHeadText \v!units \VL\MR - \VL \ShowHeadText \v!figures \VL\MR - \VL \ShowHeadText \v!graphics \VL\MR - \VL \ShowHeadText \v!index \VL\MR - \VL \ShowHeadText \v!content \VL\MR - \VL \ShowHeadText \v!intermezzi \VL\MR - \VL \ShowHeadText \v!logos \VL\MR - \VL \ShowHeadText \v!tables \VL\LR - \HL -\stoptable -\stopbuffer - -\startbuffer[lang-b] -\starttable[|l|l|] - \HL - \VL \bf label key \VL \bf current value \VL\SR - \HL - \VL \ShowLabelText \v!table \VL\FR - \VL \ShowLabelText \v!figure \VL\MR - \VL \ShowLabelText \v!intermezzo \VL\MR - \VL \ShowLabelText \v!graphic \VL\MR - \VL \ShowLabelText \v!chapter \VL\MR - \VL \ShowLabelText \v!section \VL\MR - \VL \ShowLabelText \v!subsection \VL\MR - \VL \ShowLabelText \v!subsubsection \VL\MR - \VL \ShowLabelText \v!appendix \VL\MR - \VL \ShowLabelText \v!part \VL\MR - \VL \ShowLabelText \v!line \VL\MR - \VL \ShowLabelText \v!lines \VL\LR - \HL -\stoptable -\stopbuffer - -\startbuffer[lang-c] -\starttable[|l|l|] - \HL - \VL \bf label key \VL \bf current value \VL\SR - \HL - \VL \ShowLabelText \v!january \VL\FR - \VL \ShowLabelText \v!february \VL\MR - \VL \ShowLabelText \v!march \VL\MR - \VL \ShowLabelText \v!april \VL\MR - \VL \ShowLabelText \v!may \VL\MR - \VL \ShowLabelText \v!june \VL\MR - \VL \ShowLabelText \v!july \VL\MR - \VL \ShowLabelText \v!august \VL\MR - \VL \ShowLabelText \v!september \VL\MR - \VL \ShowLabelText \v!october \VL\MR - \VL \ShowLabelText \v!november \VL\MR - \VL \ShowLabelText \v!december \VL\LR - \HL -\stoptable -\stopbuffer - -\startbuffer[lang-d] -\starttable[|l|l|] - \HL - \VL \bf label key \VL \bf current value \VL\SR - \HL - \VL \ShowLabelText \v!sunday \VL\FR - \VL \ShowLabelText \v!monday \VL\MR - \VL \ShowLabelText \v!tuesday \VL\MR - \VL \ShowLabelText \v!wednesday \VL\MR - \VL \ShowLabelText \v!thursday \VL\MR - \VL \ShowLabelText \v!friday \VL\MR - \VL \ShowLabelText \v!saturday \VL\LR - \HL -\stoptable -\stopbuffer - -\gdef\ShowTextsValues[#1][#2]% - {\vbox\bgroup - \language[#1]% - \setbox\scratchbox\hbox to \hsize{\hss\bfb#2 language defaults\hss} - \dp\scratchbox\zeropoint - \box\scratchbox - \vskip1em - \hrule - \vskip2em - \halign - {\hss##\hss&##\hskip1em&\hss##\hss\cr - $\vcenter{\getbuffer[lang-a]}$&&$\vcenter{\getbuffer[lang-b]}$\cr - \noalign{\vskip1em} - $\vcenter{\getbuffer[lang-c]}$&&$\vcenter{\getbuffer[lang-d]}$\cr}% - \egroup} - -\gdef\ShowLanguageValues[#1][#2]#3#4% - {\hbox to \hsize - {\hss - \vbox - \bgroup - \language[#1]% - \let\normalbar=| - \starttable[||||] - \HL - \VL \THREE{\bf subsentence symbol and quotes} \VL\SR - \HL - \VL \quotation{#3 #4} \VL \quote{#2} \VL \let|=\normalbar |<||<|#3|>|#4|>| \VL\FR - \VL \quotation{#3 #4} \VL \quote{#2} \VL |<||<|#3|>|#4|>| \VL\LR - \HL - \stoptable - \egroup - \hss}} - -\gdef\doShowAllLanguageValues[#1][#2]#3#4% - {\vbox - {\ShowTextsValues[#1][#2] - \vskip2em - \ShowLanguageValues[#1][#2]{#3}{#4}} - \protect - \page} - -\gdef\ShowAllLanguageValues - {\page - \unprotect - \dodoubleargument\doShowAllLanguageValues} - -\protect - -%D Command references: - -% \input setupa -% \input setupb - -\usemodule[int-load] \loadsetups - -\unprotect - -% \def\showsetup -% {\doglobal\newcounter\CurrentArgument -% \setup} - -\def\showsetup#1% - {{\def\y##1{\writestatus{setups}{warning: remove y! from #1}}% - \setup{#1}}} - -\setupframedtexts - [setuptext] - [\c!background=\v!screen, - \c!frame=\v!off] - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/s-mod-01.mkii b/Master/texmf-dist/tex/context/base/s-mod-01.mkii new file mode 100644 index 00000000000..64b533d0316 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-mod-01.mkii @@ -0,0 +1,155 @@ +%D \module +%D [ file=s-mod-01, +%D version=very-old, +%D title=\CONTEXT\ Style File, +%D subtitle=Documentation Paper Environment, +%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 looks like crap, is not documented, will +%D change, and used to be called modu-*.tex. + +\usemodule[mod-00,abr-01] + +\dontcomplain + +\unprotect + +\setupbodyfont + [10pt] + +\definetypeface + [narrowtt] [tt] + [mono] [modern-cond] [default] [encoding=\defaultencoding] + +\setuptyping[\v!typing][\c!style=\narrowtt] +\setuptype [\v!type] [\c!style=\narrowtt] + +\mainlanguage + [en] + +\setupwhitespace + [\v!big] + +\setuptolerance + [\v!verytolerant,\v!!stretch] + +\setuplayout + [\c!backspace=3.5cm, + \c!leftmargin=1.75cm, + \c!rightmargin=0cm, + \c!margindistance=.5cm, + \c!leftedgedistance=.25cm, + \c!rightedgedistance=.5cm, + \c!edge=1.5cm, + \c!width=15.55333cm, % 13.998cm at 9pt => 15.55333 at 10pt + \c!topspace=2cm, + \c!header=1.25cm, + \c!footer=1.25cm, + \c!height=middle, + \c!style=\ss] + +\setupsetup + [\c!reference=1] + +\startnotmode[single] + + \setuppagenumbering + [\c!alternative={\v!doublesided,\v!singlesided}] + +\stopnotmode + +\setuppagenumbering + [\c!location=] + +\expanded{\setupfootertexts + [\v!edge] + [][\v!pagenumber]} + +\startmode[single] + + \setupfootertexts + [\v!margin] + [\filename{\Modulefile}][] + +\stopmode + +\startnotmode[single] + + \setupfootertexts + [\v!margin] + [\filename{\Modulefile}][] + [\filename{\Modulefile}][] + +\stopnotmode + +\setupfootertexts + [\v!text] + [\CONTEXT] + [\Moduletitle] + +\setupheadertexts + [\v!text] + [] + [\Modulesubtitle] + +\setupinmargin + [\c!location=\v!left] + +\setupheads + [\c!alternative=\v!inmargin] + +\setuphead + [\v!chapter] + [\c!style=\ssc, + \c!page=\v!right, + \c!header=\v!empty] + +\setuphead + [\v!section] + [\c!style=\ssb, + \c!page=\v!right] + +\setuplist + [\v!chapter] + [\c!style=\v!bold, + \c!after=\blank] + +\setupcombinedlist + [\v!content] + [\c!width=3em, + \c!aligntitle=\v!yes] + +\setupregister + [\v!index] + [\c!balance=\v!yes, + \c!indicator=\v!no] + +\startnotmode[nocolor] + +\setupcolors + [\c!state=\v!start] + +\stopnotmode + +\startnotmode[color] + + \setupcolors + [\c!conversion=\v!always] + + \setuptyping + [\c!palet=graypretty] + +\stopnotmode + +\setupinteraction + [\c!state=\v!start, + \c!color=, + \c!style=] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/s-mod-01.mkiv b/Master/texmf-dist/tex/context/base/s-mod-01.mkiv new file mode 100644 index 00000000000..ed87346d6f5 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-mod-01.mkiv @@ -0,0 +1,146 @@ +%D \module +%D [ file=s-mod-01, +%D version=very-old, +%D title=\CONTEXT\ Style File, +%D subtitle=Documentation Paper Environment, +%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 looks like crap, is not documented, will +%D change, and used to be called modu-*.tex. + +% now split in mkii/mkiv so we will cleanup + +\usemodule[mod-00,abr-01] + +\dontcomplain + +\unprotect + +\setupbodyfont + [10pt] + +\definetypeface [narrowtt] [tt] [mono] [modern-cond] [default] + +\setuptyping[\v!typing][\c!style=\narrowtt] +\setuptype [\v!type] [\c!style=\narrowtt] + +\mainlanguage + [en] + +\setupwhitespace + [\v!big] + +\setuptolerance + [\v!verytolerant,\v!stretch] + +\setuplayout + [\c!backspace=3.5cm, + \c!leftmargin=1.75cm, + \c!rightmargin=0cm, + \c!margindistance=.5cm, + \c!leftedgedistance=.25cm, + \c!rightedgedistance=.5cm, + \c!edge=1.5cm, + \c!width=15.55333cm, % 13.998cm at 9pt => 15.55333 at 10pt + \c!topspace=2cm, + \c!header=1.25cm, + \c!footer=1.25cm, + \c!height=middle, + \c!style=\ss] + +\setupsetup + [\c!reference=1] % mkiv? + +\startnotmode[single] + + \setuppagenumbering + [\c!alternative={\v!doublesided,\v!singlesided}] + +\stopnotmode + +\setuppagenumbering + [\c!location=] + +\setupfootertexts + [\v!edge] + [][\v!pagenumber] + +\startmode[single] + + \setupfootertexts + [\v!margin] + [\filename{\Modulefile}][] + +\stopmode + +\startnotmode[single] + + \setupfootertexts + [\v!margin] + [\filename{\Modulefile}][] + [\filename{\Modulefile}][] + +\stopnotmode + +\setupfootertexts + [\v!text] + [\CONTEXT] + [\Moduletitle] + +\setupheadertexts + [\v!text] + [] + [\Modulesubtitle] + +\setupinmargin + [\c!location=\v!left] + +\setupheads + [\c!alternative=\v!inmargin] + +\setuphead + [\v!chapter] + [\c!style=\ssc, + \c!page=\v!right, + \c!header=\v!empty] + +\setuphead + [\v!section] + [\c!style=\ssb, + \c!page=\v!right] + +\setuplist + [\v!chapter] + [\c!style=\v!bold, + \c!after=\blank] + +\setupcombinedlist + [\v!content] + [\c!width=3em, + \c!aligntitle=\v!yes] + +\setupregister + [\v!index] + [\c!balance=\v!yes, + \c!indicator=\v!no] + +\startmode[nocolor] + + \setupcolors + [\c!conversion=\v!always] + +\stopmode + +\setupinteraction + [\c!state=\v!start, + \c!color=, + \c!contrastcolor=, + \c!style=] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/s-mod-01.tex b/Master/texmf-dist/tex/context/base/s-mod-01.tex deleted file mode 100644 index 4454986ce6d..00000000000 --- a/Master/texmf-dist/tex/context/base/s-mod-01.tex +++ /dev/null @@ -1,157 +0,0 @@ -%D \module -%D [ file=s-mod-01, -%D version=very-old, -%D title=\CONTEXT\ Style File, -%D subtitle=Documentation Paper Environment, -%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 looks like crap, is not documented, will -%D change, and used to be called modu-*.tex. - -\usemodule[mod-00,abr-01] - -\dontcomplain - -\unprotect - -\setupbodyfont - [10pt] - -\definetypeface - [narrowtt] [tt] - [mono] [modern-cond] [default] [encoding=\defaultencoding] - -\setuptyping[\v!typing][\c!style=\narrowtt] -\setuptype [\v!type] [\c!style=\narrowtt] - -\mainlanguage - [en] - -\setupwhitespace - [\v!big] - -\setuptolerance - [\v!tolerant] - -\emergencystretch=5em - -\setuplayout - [\c!backspace=3.5cm, - \c!leftmargin=1.75cm, - \c!rightmargin=0cm, - \c!margindistance=.5cm, - \c!leftedgedistance=.25cm, - \c!rightedgedistance=.5cm, - \c!edge=1.5cm, - \c!width=15.55333cm, % 13.998cm at 9pt => 15.55333 at 10pt - \c!topspace=2cm, - \c!header=1.25cm, - \c!footer=1.25cm, - \c!height=middle, - \c!style=\ss] - -\setupsetup - [\c!reference=1] - -\startnotmode[single] - - \setuppagenumbering - [\c!alternative={\v!doublesided,\v!singlesided}] - -\stopnotmode - -\setuppagenumbering - [\c!location=] - -\expanded{\setupfootertexts - [\v!edge] - [][\v!pagenumber]} - -\startmode[single] - - \setupfootertexts - [\v!margin] - [\filename{\Modulefile}][] - -\stopmode - -\startnotmode[single] - - \setupfootertexts - [\v!margin] - [\filename{\Modulefile}][] - [\filename{\Modulefile}][] - -\stopnotmode - -\setupfootertexts - [\v!text] - [\CONTEXT] - [\Moduletitle] - -\setupheadertexts - [\v!text] - [] - [\Modulesubtitle] - -\setupinmargin - [\c!location=\v!left] - -\setupheads - [\c!alternative=\v!inmargin] - -\setuphead - [\v!chapter] - [\c!style=\ssc, - \c!page=\v!right, - \c!header=\v!empty] - -\setuphead - [\v!section] - [\c!style=\ssb, - \c!page=\v!right] - -\setuplist - [\v!chapter] - [\c!style=\v!bold, - \c!after=\blank] - -\setupcombinedlist - [\v!content] - [\c!width=3em, - \c!aligntitle=\v!yes] - -\setupregister - [\v!index] - [\c!balance=\v!yes, - \c!indicator=\v!no] - -\startnotmode[nocolor] - -\setupcolors - [\c!state=\v!start] - -\stopnotmode - -\startnotmode[color] - - \setupcolors - [\c!conversion=\v!always] - - \setuptyping - [\c!palet=graypretty] - -\stopnotmode - -\setupinteraction - [\c!state=\v!start, - \c!color=, - \c!style=] - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/s-mod-02.mkii b/Master/texmf-dist/tex/context/base/s-mod-02.mkii new file mode 100644 index 00000000000..bc53f689008 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-mod-02.mkii @@ -0,0 +1,421 @@ +%D \module +%D [ file=s-mod-02, +%D version=very-old, +%D title=\CONTEXT\ Style File, +%D subtitle=Documentation Screen Environment, +%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 looks like crap, is not documented, will +%D change, and used to be called modu-*.tex. + +% Macro's + +\usemodule[mod-00] + +\unprotect + +% todo: internationalize + setups + +\setuphead[paragraaf][expansion=command] +\setuphead[section][expansion=command] + +\def\complexmodule[#1]% redefined + {\startglobal % i.v.m. \bgroup in \startdocumentation + \getparameters[Module][#1] + \stopglobal % i.v.m. \bgroup in \startdocumentation + %%\section{\Modulesubtitle} + \xdef\Temp{\Modulesubtitle}%%Modulesubtitle:\framed{BEGIN \Modulesubtitle END} :#1 !} + \@EA\section\@EA{\Temp} + \WriteLists} + +\def\stopmodule % redefined + {\page + \determineregistercharacteristics + [index] + [criterium=section] + \doifmode{*register} + {\pagereference + [index] + \placeregister + [index] + [balance=yes, + indicator=no, + criterium=section]}} + +\let\ComposeLists=\relax + +\newcounter\ModuleNumber + +\newwrite\BatchFile \openout\BatchFile=\jobname.bat + +\def\WriteBatchFile + {\doglobal\increment\ModuleNumber +% \immediate\write\BatchFile{call modu-run \FileName\space \ModuleNumber}} +% \immediate\write\BatchFile{texmfstart texutil --modu \FileName}} + \immediate\write\BatchFile{texmfstart texexec --pdf --modu --batch \FileName }} + +\newif\ifProcessingPublic + +\def\WriteLists + {\writetolist[FileNames] {}{\FileName} + \writetolist[GroupItems]{}{\GroupItem}} + +\def\moduletitle{} + +\def\TypeZeroModule#1% + {\section{[to be extracted: #1]} + {\em This module is not yet split off.} + \WriteLists} + +\def\TypeOneModule#1% + {\section{[to be documented: #1]} + {\em This module is not yet fully documented.} + \WriteLists} + +\def\TypeTwoModule#1% + {\ifProcessingPublic + \readfile{#1.ted}{}{}% + \WriteBatchFile + \else + \section{[not yet public: #1]} + {\em This module is documented but not yet public.} + \WriteLists + \fi} + +\def\TypeThreeModule#1% + {\readfile{#1.ted}{}{}% + \WriteBatchFile} + +\def\processmodule#1#2% + {\page + \bgroup + \def\FileName{#1} + \setupreferencing[prefix=#1] + \useexternaldocument[PaperVersion][#1][] + \aftersplitstring#1\at-\to\GroupItem + \ComposeLists + \ifcase#2 + \TypeZeroModule{#1} + \or + \TypeOneModule{#1} + \or + \TypeTwoModule{#1} + \or + \TypeThreeModule{#1} + \fi + \page + \setupreferencing[prefix=] + \egroup} + +\def\ModuleGroup#1#2% + {\page + \let\Modulefile=\empty + \setupreferencing[prefix=#1] + \def\FileGroup{#1} + \writetolist[FileGroups]{}{\FileGroup} + \chapter[content]{#2} + \MakeListOfItems + \MakeListOfNames + \MakeListOfGroups + \placecontent[criterium=chapter,level=section]} + +% Layout + +\setupbodyfont + [9pt] + +\setuppapersize + [S6][S6] + +\setuplayout + [backspace=72.5pt, + leftmargin=50pt, + leftmargindistance=12.5pt, + rightmargin=0pt, + rightedge=80pt, + rightedgedistance=10pt, + leftedge=0pt, + width=430pt, + topspace=10pt, + header=0pt, + footer=30pt, + bottomdistance=10pt, + bottom=15pt, + height=410pt, + style=\ss] + +\setuptyping + [palet=colorpretty] + +\setupsetup + [reference=3] + +\definecolor [AchtergrondKleur] [s=.6] +\definecolor [ButtonKleur] [r=.2,g=.2,b=.6] +\definecolor [TekstKleur] [r=.6,g=.2,b=.2] + +\definecolor [colorprettyone] [r=.6,g=.0,b=.0] % red +\definecolor [colorprettytwo] [r=.0,g=.6,b=.0] % green +\definecolor [colorprettythree] [r=.0,g=.0,b=.6] % blue +\definecolor [colorprettyfour] [r=.6,g=.6,b=.0] % yellow + +\setupinteraction + [state=start, + page=yes, + contrastcolor=, + menu=on, + color=] + +\setupbackgrounds + [page] + [background=color, + backgroundcolor=AchtergrondKleur, + offset=2.5pt] % this offset influences the menus! + +\setupbackgrounds + [text,footer] + [text,leftmargin] + [background=color, + backgroundcolor=white] + +\setupsubpagenumber + [way=bysection, + state=start] + +\setupinteractionbar + [frame=off, + offset=0pt, + height=fit] + +\setupwhitespace + [big] + +\setuptyping + [typing] + [option=color] + +\setuptyping + [definition] + [option=color] + +\setuptyping + [file] + [option=color] + +\setuppagenumbering + [alternative=singlesided, + way=bysection, + state=none] + +\setupinmargin + [location=left] + +\setupheads + [alternative=inmargin] + +\setuphead + [chapter] + [style=\ssc, + page=right] + +\setuphead + [section] + [style=\ssb, + page=right] + +\setuplist + [chapter] + [style=bold, + after=\blank] + +\setupcontent + [width=2em] + +\setupindex + [balance=yes, + indicator=no] + +\setupcolors + [state=start] + +\def\TitelBlad#1% + {\startstandardmakeup + \definefont[GrootFont] [SansBold at 72pt] + \definefont[MiddelFont][Sans at 32pt] + \definefont[KleinFont] [Sans at 24pt] + \startcolor[AchtergrondKleur] + \vskip12pt + \midaligned{\GrootFont\setstrut\strut Con\TeX t} + \vskip24pt + \midaligned{\MiddelFont\setstrut\strut #1} + \vskip24pt + \midaligned{\KleinFont\setstrut\strut Hans Hagen} + \vfilll + \midaligned{\KleinFont\setstrut\strut PRAGMA ADE} + \vskip24pt + \midaligned{\KleinFont\setstrut\strut www.pragma-ade.com --- \currentdate} + \vskip12pt + \stopcolor + \stopstandardmakeup} + +\def\ColofonBlad + {\startmode[atpragma] + \page + \bgroup + \def\PragmaHoogte {\makeupheight} + \def\PragmaBreedte{\textwidth} + \def\PragmaKopwit {\topspace} + \def\PragmaRugwit {\backspace} + \def\PragmaMarge {0pt} + \PragmaLijnentrue + \PlaatsPragmaLogo[ADE] + \vfill + todo: colofon + \startnarrower[3*middle] + This is the official documentation of \CONTEXT\ version + \referraldate, a \TEX\ macropackage developed by J.~Hagen + \& A.F.~Otten, who both hold the copyrights. + \stopnarrower + \vfill + \page + \egroup + \stopmode} + +\def\ColofonBlad + {} + +\newbox\ListOfItems +\newbox\ListOfGroups +\newbox\ListOfNames + +\definelist[FileNames] \def\FileName {} +\definelist[FileGroups] \def\FileGroup {} +\definelist[GroupItems] \def\GroupItem {} + +\setuplist + [FileNames,FileGroups,FileGroups] + [expansion=yes, + pagenumber=no, + style=\ss\bf] + +\setuplist + [FileNames] + [command=\FileNameEntry, + after=\endgraf, + alternative=none] % horizontal + +\setuplist + [FileGroups] + [command=\FileGroupEntry, + after=\hss, + alternative=horizontal] + +\def\FileNameEntry#1#2#3% + {\strut\hbox{#2}\endgraf} + +\def\FileGroupEntry#1#2#3% + {\strut\hbox{#2}\endgraf} + +\def\MakeListOfItems + {\setbox\ListOfItems=\vbox + {\ss\bf + \placelist[GroupItems][color=ButtonKleur,contrastcolor=white,criterium=chapter]}} + +\def\MakeListOfNames + {\setbox\ListOfNames=\vbox + {\hsize\rightedgewidth + \ss\bf\setupinterlinespace + \startsimplecolumns[distance=10pt] + \placelist[FileNames][color=ButtonKleur,contrastcolor=white,criterium=chapter] + \stopsimplecolumns}} + +\def\MakeListOfGroups + {\setbox\ListOfGroups=\hbox to \textwidth + {\ss\bf + \setupinteraction[color=ButtonKleur]% + \placelist[FileGroups][color=ButtonKleur,contrastcolor=white,criterium=all]\unskip\unskip}} + +\setbox\ListOfGroups=\hbox{} + +%\setupfootertexts +% [rand] +% [] +% [{\interactiebalk[variant=g]}] + +\setupinteractionmenu + [right,bottom] + [state=start, + frame=off, + color=AchtergrondKleur, + contrastcolor=white, + style=\ss\bf, + height=15pt, + offset=0pt, + inbetween=\vskip5pt, + background=color, + backgroundcolor=ButtonKleur] + +\startinteractionmenu[right] + \boxofsize \vbox \textheight \footerdistance \footerheight 5pt + \bgroup + \copy\ListOfNames + \vfill + \but [\FileGroup:content] local contents \\ + \but [\FileName:index] local register \\ + \but [PaperVersion::begin] paper version \\ + \but [content] main contents \\ + \but [index] main register \\ + \but [PreviousJump] previous jump \\ + \but [CloseDocument] close document \\ + \unskip + \egroup +\stopinteractionmenu + +\startinteractionmenu[bottom] + \unhcopy\ListOfGroups +\stopinteractionmenu + +\def\placemoduleregister + {\startbackmatter + \setupsubpagenumber[reset] + \title[-:index]{Register} + \placeregister[index] + \stopbackmatter} + +\def\placemodulecontent + {\startfrontmatter + \title[-:content]{Contents} + \setupinteractionbar[state=stop] + \placecontent[criterium=text,level=chapter] + \stopfrontmatter} + +\setupcontent + [pagenumber=no, + level=chapter, + interaction=all, + style=, + before=, + after=] + +\setupfootertexts + [margin] + [\tt\Modulefile] + [] + +\setupfootertexts + [text] + [chapter][chapter] + +\setupindex + [symbol=1] + +\setuptolerance + [verytolerant] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/s-mod-02.mkiv b/Master/texmf-dist/tex/context/base/s-mod-02.mkiv new file mode 100644 index 00000000000..1ca88b796d9 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-mod-02.mkiv @@ -0,0 +1,423 @@ +%D \module +%D [ file=s-mod-02, +%D version=very-old, +%D title=\CONTEXT\ Style File, +%D subtitle=Documentation Screen Environment, +%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 looks like crap, is not documented, will +%D change, and used to be called modu-*.tex. + +% now split in mkii/mkiv so we will cleanup + +% Macro's + +\usemodule[mod-00] + +\unprotect + +% todo: internationalize + setups + +\setuphead[paragraaf][expansion=command] +\setuphead[section][expansion=command] + +\def\complexmodule[#1]% redefined + {\startglobal % i.v.m. \bgroup in \startdocumentation + \getparameters[Module][#1] + \stopglobal % i.v.m. \bgroup in \startdocumentation + %%\section{\Modulesubtitle} + \xdef\Temp{\Modulesubtitle}%%Modulesubtitle:\framed{BEGIN \Modulesubtitle END} :#1 !} + \@EA\section\@EA{\Temp} + \WriteLists} + +\def\stopmodule % redefined + {\page + \determineregistercharacteristics + [index] + [criterium=section] + \doifmode{*register} + {\pagereference + [index] + \placeregister + [index] + [balance=yes, + indicator=no, + criterium=section]}} + +\let\ComposeLists=\relax + +\newcounter\ModuleNumber + +\newwrite\BatchFile \openout\BatchFile=\jobname.bat + +\def\WriteBatchFile + {\doglobal\increment\ModuleNumber +% \immediate\write\BatchFile{call modu-run \FileName\space \ModuleNumber}} +% \immediate\write\BatchFile{texmfstart texutil --modu \FileName}} + \immediate\write\BatchFile{texmfstart texexec --pdf --modu --batch \FileName }} + +\newif\ifProcessingPublic + +\def\WriteLists + {\writetolist[FileNames] {}{\FileName} + \writetolist[GroupItems]{}{\GroupItem}} + +\def\moduletitle{} + +\def\TypeZeroModule#1% + {\section{[to be extracted: #1]} + {\em This module is not yet split off.} + \WriteLists} + +\def\TypeOneModule#1% + {\section{[to be documented: #1]} + {\em This module is not yet fully documented.} + \WriteLists} + +\def\TypeTwoModule#1% + {\ifProcessingPublic + \readfile{#1.ted}{}{}% + \WriteBatchFile + \else + \section{[not yet public: #1]} + {\em This module is documented but not yet public.} + \WriteLists + \fi} + +\def\TypeThreeModule#1% + {\readfile{#1.ted}{}{}% + \WriteBatchFile} + +\def\processmodule#1#2% + {\page + \bgroup + \def\FileName{#1} + \setupreferencing[prefix=#1] + \useexternaldocument[PaperVersion][#1][] + \aftersplitstring#1\at-\to\GroupItem + \ComposeLists + \ifcase#2 + \TypeZeroModule{#1} + \or + \TypeOneModule{#1} + \or + \TypeTwoModule{#1} + \or + \TypeThreeModule{#1} + \fi + \page + \setupreferencing[prefix=] + \egroup} + +\def\ModuleGroup#1#2% + {\page + \let\Modulefile=\empty + \setupreferencing[prefix=#1] + \def\FileGroup{#1} + \writetolist[FileGroups]{}{\FileGroup} + \chapter[content]{#2} + \MakeListOfItems + \MakeListOfNames + \MakeListOfGroups + \placecontent[criterium=chapter,level=section]} + +% Layout + +\setupbodyfont + [9pt] + +\setuppapersize + [S6][S6] + +\setuplayout + [backspace=72.5pt, + leftmargin=50pt, + leftmargindistance=12.5pt, + rightmargin=0pt, + rightedge=80pt, + rightedgedistance=10pt, + leftedge=0pt, + width=430pt, + topspace=10pt, + header=0pt, + footer=30pt, + bottomdistance=10pt, + bottom=15pt, + height=410pt, + style=\ss] + +\setuptyping + [palet=colorpretty] + +\setupsetup + [reference=3] + +\definecolor [AchtergrondKleur] [s=.6] +\definecolor [ButtonKleur] [r=.2,g=.2,b=.6] +\definecolor [TekstKleur] [r=.6,g=.2,b=.2] + +\definecolor [colorprettyone] [r=.6,g=.0,b=.0] % red +\definecolor [colorprettytwo] [r=.0,g=.6,b=.0] % green +\definecolor [colorprettythree] [r=.0,g=.0,b=.6] % blue +\definecolor [colorprettyfour] [r=.6,g=.6,b=.0] % yellow + +\setupinteraction + [state=start, + page=yes, + contrastcolor=, + menu=on, + color=] + +\setupbackgrounds + [page] + [background=color, + backgroundcolor=AchtergrondKleur, + offset=2.5pt] % this offset influences the menus! + +\setupbackgrounds + [text,footer] + [text,leftmargin] + [background=color, + backgroundcolor=white] + +\setupsubpagenumber + [way=bysection, + state=start] + +\setupinteractionbar + [frame=off, + offset=0pt, + height=fit] + +\setupwhitespace + [big] + +\setuptyping + [typing] + [option=color] + +\setuptyping + [definition] + [option=color] + +\setuptyping + [file] + [option=color] + +\setuppagenumbering + [alternative=singlesided, + way=bysection, + state=none] + +\setupinmargin + [location=left] + +\setupheads + [alternative=inmargin] + +\setuphead + [chapter] + [style=\ssc, + page=right] + +\setuphead + [section] + [style=\ssb, + page=right] + +\setuplist + [chapter] + [style=bold, + after=\blank] + +\setupcontent + [width=2em] + +\setupindex + [balance=yes, + indicator=no] + +\setupcolors + [state=start] + +\def\TitelBlad#1% + {\startstandardmakeup + \definefont[GrootFont] [SansBold at 72pt] + \definefont[MiddelFont][Sans at 32pt] + \definefont[KleinFont] [Sans at 24pt] + \startcolor[AchtergrondKleur] + \vskip12pt + \midaligned{\GrootFont\setstrut\strut Con\TeX t} + \vskip24pt + \midaligned{\MiddelFont\setstrut\strut #1} + \vskip24pt + \midaligned{\KleinFont\setstrut\strut Hans Hagen} + \vfilll + \midaligned{\KleinFont\setstrut\strut PRAGMA ADE} + \vskip24pt + \midaligned{\KleinFont\setstrut\strut www.pragma-ade.com --- \currentdate} + \vskip12pt + \stopcolor + \stopstandardmakeup} + +\def\ColofonBlad + {\startmode[atpragma] + \page + \bgroup + \def\PragmaHoogte {\makeupheight} + \def\PragmaBreedte{\textwidth} + \def\PragmaKopwit {\topspace} + \def\PragmaRugwit {\backspace} + \def\PragmaMarge {0pt} + \PragmaLijnentrue + \PlaatsPragmaLogo[ADE] + \vfill + todo: colofon + \startnarrower[3*middle] + This is the official documentation of \CONTEXT\ version + \referraldate, a \TEX\ macropackage developed by J.~Hagen + \& A.F.~Otten, who both hold the copyrights. + \stopnarrower + \vfill + \page + \egroup + \stopmode} + +\def\ColofonBlad + {} + +\newbox\ListOfItems +\newbox\ListOfGroups +\newbox\ListOfNames + +\definelist[FileNames] \def\FileName {} +\definelist[FileGroups] \def\FileGroup {} +\definelist[GroupItems] \def\GroupItem {} + +\setuplist + [FileNames,FileGroups,FileGroups] + [expansion=yes, + pagenumber=no, + style=\ss\bf] + +\setuplist + [FileNames] + [command=\FileNameEntry, + after=\endgraf, + alternative=none] % horizontal + +\setuplist + [FileGroups] + [command=\FileGroupEntry, + after=\hss, + alternative=horizontal] + +\def\FileNameEntry#1#2#3% + {\strut\hbox{#2}\endgraf} + +\def\FileGroupEntry#1#2#3% + {\strut\hbox{#2}\endgraf} + +\def\MakeListOfItems + {\setbox\ListOfItems=\vbox + {\ss\bf + \placelist[GroupItems][color=ButtonKleur,contrastcolor=white,criterium=chapter]}} + +\def\MakeListOfNames + {\setbox\ListOfNames=\vbox + {\hsize\rightedgewidth + \ss\bf\setupinterlinespace + \startsimplecolumns[distance=10pt] + \placelist[FileNames][color=ButtonKleur,contrastcolor=white,criterium=chapter] + \stopsimplecolumns}} + +\def\MakeListOfGroups + {\setbox\ListOfGroups=\hbox to \textwidth + {\ss\bf + \setupinteraction[color=ButtonKleur]% + \placelist[FileGroups][color=ButtonKleur,contrastcolor=white,criterium=all]\unskip\unskip}} + +\setbox\ListOfGroups=\hbox{} + +%\setupfootertexts +% [rand] +% [] +% [{\interactiebalk[variant=g]}] + +\setupinteractionmenu + [right,bottom] + [state=start, + frame=off, + color=AchtergrondKleur, + contrastcolor=white, + style=\ss\bf, + height=15pt, + offset=0pt, + inbetween=\vskip5pt, + background=color, + backgroundcolor=ButtonKleur] + +\startinteractionmenu[right] + \boxofsize \vbox \textheight \footerdistance \footerheight 5pt + \bgroup + \copy\ListOfNames + \vfill + \but [\FileGroup:content] local contents \\ + \but [\FileName:index] local register \\ + \but [PaperVersion::begin] paper version \\ + \but [content] main contents \\ + \but [index] main register \\ + \but [PreviousJump] previous jump \\ + \but [CloseDocument] close document \\ + \unskip + \egroup +\stopinteractionmenu + +\startinteractionmenu[bottom] + \unhcopy\ListOfGroups +\stopinteractionmenu + +\def\placemoduleregister + {\startbackmatter + \setupsubpagenumber[reset] + \title[-:index]{Register} + \placeregister[index] + \stopbackmatter} + +\def\placemodulecontent + {\startfrontmatter + \title[-:content]{Contents} + \setupinteractionbar[state=stop] + \placecontent[criterium=text,level=chapter] + \stopfrontmatter} + +\setupcontent + [pagenumber=no, + level=chapter, + interaction=all, + style=, + before=, + after=] + +\setupfootertexts + [margin] + [\tt\Modulefile] + [] + +\setupfootertexts + [text] + [chapter][chapter] + +\setupindex + [symbol=1] + +\setuptolerance + [verytolerant] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/s-mod-02.tex b/Master/texmf-dist/tex/context/base/s-mod-02.tex deleted file mode 100644 index 9dae3ecc0dd..00000000000 --- a/Master/texmf-dist/tex/context/base/s-mod-02.tex +++ /dev/null @@ -1,420 +0,0 @@ -%D \module -%D [ file=s-mod-02, -%D version=very-old, -%D title=\CONTEXT\ Style File, -%D subtitle=Documentation Screen Environment, -%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 looks like crap, is not documented, will -%D change, and used to be called modu-*.tex. - -% Macro's - -\usemodule[mod-00] - -% todo: internationalize + setups - -\setuphead[paragraaf][expansion=command] -\setuphead[section][expansion=command] - -\def\complexmodule[#1]% redefined - {\startglobal % i.v.m. \bgroup in \startdocumentation - \getparameters[Module][#1] - \stopglobal % i.v.m. \bgroup in \startdocumentation - %%\section{\Modulesubtitle} - \xdef\Temp{\Modulesubtitle}%%Modulesubtitle:\framed{BEGIN \Modulesubtitle END} :#1 !} - \@EA\section\@EA{\Temp} - \WriteLists} - -\def\stopmodule % redefined - {\page - \determineregistercharacteristics - [index] - [criterium=section] - \ifutilitydone - \pagereference - [index] - \placeregister - [index] - [balance=yes, - indicator=no, - criterium=section] - \fi} - -\let\ComposeLists=\relax - -\newcounter\ModuleNumber - -\newwrite\BatchFile \openout\BatchFile=\jobname.bat - -\def\WriteBatchFile - {\doglobal\increment\ModuleNumber -% \immediate\write\BatchFile{call modu-run \FileName\space \ModuleNumber}} -% \immediate\write\BatchFile{texmfstart texutil --modu \FileName}} - \immediate\write\BatchFile{texmfstart texexec --pdf --modu --batch \FileName }} - -\newif\ifProcessingPublic - -\def\WriteLists - {\writetolist[FileNames] {}{\FileName} - \writetolist[GroupItems]{}{\GroupItem}} - -\def\moduletitle{} - -\def\TypeZeroModule#1% - {\section{[to be extracted: #1]} - {\em This module is not yet split off.} - \WriteLists} - -\def\TypeOneModule#1% - {\section{[to be documented: #1]} - {\em This module is not yet fully documented.} - \WriteLists} - -\def\TypeTwoModule#1% - {\ifProcessingPublic - \readfile{#1.ted}{}{}% - \WriteBatchFile - \else - \section{[not yet public: #1]} - {\em This module is documented but not yet public.} - \WriteLists - \fi} - -\def\TypeThreeModule#1% - {\readfile{#1.ted}{}{}% - \WriteBatchFile} - -\def\processmodule#1#2% - {\page - \bgroup - \def\FileName{#1} - \setupreferencing[prefix=#1] - \useexternaldocument[PaperVersion][#1][] - \aftersplitstring#1\at-\to\GroupItem - \ComposeLists - \ifcase#2 - \TypeZeroModule{#1} - \or - \TypeOneModule{#1} - \or - \TypeTwoModule{#1} - \or - \TypeThreeModule{#1} - \fi - \page - \setupreferencing[prefix=] - \egroup} - -\def\ModuleGroup#1#2% - {\page - \let\Modulefile=\empty - \setupreferencing[prefix=#1] - \def\FileGroup{#1} - \writetolist[FileGroups]{}{\FileGroup} - \chapter[content]{#2} - \MakeListOfItems - \MakeListOfNames - \MakeListOfGroups - \placecontent[criterium=chapter,level=section]} - -% Layout - -\setupbodyfont - [9pt] - -\setuppapersize - [S6][S6] - -\setuplayout - [backspace=72.5pt, - leftmargin=50pt, - leftmargindistance=12.5pt, - rightmargin=0pt, - rightedge=80pt, - rightedgedistance=10pt, - leftedge=0pt, - width=430pt, - topspace=10pt, - header=0pt, - footer=30pt, - bottomdistance=10pt, - bottom=15pt, - height=410pt, - style=\ss] - -\setuptyping - [palet=colorpretty] - -\setupsetup - [reference=3] - -\definecolor [AchtergrondKleur] [s=.6] -\definecolor [ButtonKleur] [r=.2,g=.2,b=.6] -\definecolor [TekstKleur] [r=.6,g=.2,b=.2] - -\definecolor [colorprettyone] [r=.6,g=.0,b=.0] % red -\definecolor [colorprettytwo] [r=.0,g=.6,b=.0] % green -\definecolor [colorprettythree] [r=.0,g=.0,b=.6] % blue -\definecolor [colorprettyfour] [r=.6,g=.6,b=.0] % yellow - -\setupinteraction - [state=start, - page=yes, - contrastcolor=, - menu=on, - color=] - -\setupbackgrounds - [page] - [background=color, - backgroundcolor=AchtergrondKleur, - offset=2.5pt] % this offset influences the menus! - -\setupbackgrounds - [text,footer] - [text,leftmargin] - [background=color, - backgroundcolor=white] - -\setupsubpagenumber - [way=bysection, - state=start] - -\setupinteractionbar - [frame=off, - offset=0pt, - height=fit] - -\setupwhitespace - [big] - -\setuptyping - [typing] - [option=color] - -\setuptyping - [definition] - [option=color] - -\setuptyping - [file] - [option=color] - -\setuppagenumbering - [alternative=singlesided, - way=bysection, - state=none] - -\setupinmargin - [location=left] - -\setupheads - [alternative=inmargin] - -\setuphead - [chapter] - [style=\ssc, - page=right] - -\setuphead - [section] - [style=\ssb, - page=right] - -\setuplist - [chapter] - [style=bold, - after=\blank] - -\setupcontent - [width=2em] - -\setupindex - [balance=yes, - indicator=no] - -\setupcolors - [state=start] - -\def\TitelBlad#1% - {\startstandardmakeup - \definefont[GrootFont] [SansBold at 72pt] - \definefont[MiddelFont][Sans at 32pt] - \definefont[KleinFont] [Sans at 24pt] - \startcolor[AchtergrondKleur] - \vskip12pt - \midaligned{\GrootFont\setstrut\strut Con\TeX t} - \vskip24pt - \midaligned{\MiddelFont\setstrut\strut #1} - \vskip24pt - \midaligned{\KleinFont\setstrut\strut Hans Hagen} - \vfilll - \midaligned{\KleinFont\setstrut\strut PRAGMA ADE} - \vskip24pt - \midaligned{\KleinFont\setstrut\strut www.pragma-ade.com --- \currentdate} - \vskip12pt - \stopcolor - \stopstandardmakeup} - -\def\ColofonBlad - {\startmode[atpragma] - \page - \bgroup - \def\PragmaHoogte {\makeupheight} - \def\PragmaBreedte{\textwidth} - \def\PragmaKopwit {\topspace} - \def\PragmaRugwit {\backspace} - \def\PragmaMarge {0pt} - \PragmaLijnentrue - \PlaatsPragmaLogo[ADE] - \vfill - todo: colofon - \startnarrower[3*middle] - This is the official documentation of \CONTEXT\ version - \referraldate, a \TEX\ macropackage developed by J.~Hagen - \& A.F.~Otten, who both hold the copyrights. - \stopnarrower - \vfill - \page - \egroup - \stopmode} - -\def\ColofonBlad - {} - -\newbox\ListOfItems -\newbox\ListOfGroups -\newbox\ListOfNames - -\definelist[FileNames] \def\FileName {} -\definelist[FileGroups] \def\FileGroup {} -\definelist[GroupItems] \def\GroupItem {} - -\setuplist - [FileNames,FileGroups,FileGroups] - [expansion=yes, - pagenumber=no, - style=\ss\bf] - -\setuplist - [FileNames] - [command=\FileNameEntry, - after=\endgraf, - alternative=none] % horizontal - -\setuplist - [FileGroups] - [command=\FileGroupEntry, - after=\hss, - alternative=horizontal] - -\def\FileNameEntry#1#2#3% - {\strut\hbox{#2}\endgraf} - -\def\FileGroupEntry#1#2#3% - {\strut\hbox{#2}\endgraf} - -\def\MakeListOfItems - {\setbox\ListOfItems=\vbox - {\ss\bf - \placelist[GroupItems][color=ButtonKleur,contrastcolor=white,criterium=chapter]}} - -\def\MakeListOfNames - {\setbox\ListOfNames=\vbox - {\hsize\rightedgewidth - \ss\bf\setupinterlinespace - \startsimplecolumns[distance=10pt] - \placelist[FileNames][color=ButtonKleur,contrastcolor=white,criterium=chapter] - \stopsimplecolumns}} - -\def\MakeListOfGroups - {\setbox\ListOfGroups=\hbox to \textwidth - {\ss\bf - \setupinteraction[color=ButtonKleur]% - \placelist[FileGroups][color=ButtonKleur,contrastcolor=white,criterium=all]\unskip\unskip}} - -\setbox\ListOfGroups=\hbox{} - -%\setupfootertexts -% [rand] -% [] -% [{\interactiebalk[variant=g]}] - -\setupinteractionmenu - [right,bottom] - [state=start, - frame=off, - color=AchtergrondKleur, - contrastcolor=white, - style=\ss\bf, - height=15pt, - offset=0pt, - inbetween=\vskip5pt, - background=color, - backgroundcolor=ButtonKleur] - -\startinteractionmenu[right] - \boxofsize \vbox \textheight \footerdistance \footerheight 5pt - \bgroup - \copy\ListOfNames - \vfill - \but [\FileGroup:content] local contents \\ - \but [\FileName:index] local register \\ - \but [PaperVersion::begin] paper version \\ - \but [content] main contents \\ - \but [index] main register \\ - \but [PreviousJump] previous jump \\ - \but [CloseDocument] close document \\ - \unskip - \egroup -\stopinteractionmenu - -\startinteractionmenu[bottom] - \unhcopy\ListOfGroups -\stopinteractionmenu - -\def\placemoduleregister - {\startbackmatter - \setupsubpagenumber[reset] - \title[-:index]{Register} - \placeregister[index] - \stopbackmatter} - -\def\placemodulecontent - {\startfrontmatter - \title[-:content]{Contents} - \setupinteractionbar[state=stop] - \placecontent[criterium=text,level=chapter] - \stopfrontmatter} - -\setupcontent - [pagenumber=no, - level=chapter, - interaction=all, - style=, - before=, - after=] - -\setupfootertexts - [margin] - [\tt\Modulefile] - [] - -\setupfootertexts - [text] - [chapter][chapter] - -\setupindex - [symbol=1] - -\setuptolerance - [verytolerant] - -\endinput diff --git a/Master/texmf-dist/tex/context/base/s-pre-14.tex b/Master/texmf-dist/tex/context/base/s-pre-14.tex index f44117e7c9c..93f8cdbc35e 100644 --- a/Master/texmf-dist/tex/context/base/s-pre-14.tex +++ b/Master/texmf-dist/tex/context/base/s-pre-14.tex @@ -11,7 +11,6 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. - %D In the process of making a couple of simple styles for %D \EUROTEX\ 99, I came to this one. The joke is in the %D pagenumber. This style can be used for short presentations diff --git a/Master/texmf-dist/tex/context/base/s-pre-18.tex b/Master/texmf-dist/tex/context/base/s-pre-18.tex index 407f3082406..d92117aaf79 100644 --- a/Master/texmf-dist/tex/context/base/s-pre-18.tex +++ b/Master/texmf-dist/tex/context/base/s-pre-18.tex @@ -11,28 +11,24 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. - - -% output=pdftex interface=en - -% todo: met pos en dan iedere titel +% todo: met pos en dan iedere titel \setuppapersize [S6][S6] \setupbodyfont - [loc,ppl] + [loc,ppl] \setupcolors [state=start] -\definecolor [shade-1] [s=.7] -\definecolor [shade-2] [s=.1] +\definecolor [shade-1] [s=.7] +\definecolor [shade-2] [s=.1] -\definecolor [shade-3] [s=.8] -\definecolor [shade-4] [b=.8] +\definecolor [shade-3] [s=.8] +\definecolor [shade-4] [b=.8] -\definecolor [shade-5] [g=.6] +\definecolor [shade-5] [g=.6] \setuplayout [topspace=1cm, @@ -52,58 +48,58 @@ \defineoverlay [text] [\useMPgraphic{text}] \startuseMPgraphic{page} - StartPage ; - path p ; numeric s ; pair cp ; cp := center Page ; + StartPage ; + path p ; numeric s ; pair cp ; cp := center Page ; s := define_circular_shade(cp,cp,0,TextWidth, - \MPcolor{shade-1},\MPcolor{shade-2}) ; - fill Page withshade s ; + \MPcolor{shade-1},\MPcolor{shade-2}) ; + fill Page withshade s ; p := fullcircle xyscaled (TextWidth+1cm, TextHeight+1cm) shifted cp ; s := define_circular_shade(cp,cp,0,TextWidth,\MPcolor{shade-3}, - \MPcolor{shade-4}) ; - fill p withshade s ; + \MPcolor{shade-4}) ; + fill p withshade s ; StopPage \stopuseMPgraphic \startuseMPgraphic{text} - StartPage ; - path p ; numeric s, t ; pair cp ; cp := center Page ; + StartPage ; + path p ; numeric s, t ; pair cp ; cp := center Page ; s := define_circular_shade(cp,cp,0,TextWidth, - \MPcolor{shade-1},\MPcolor{shade-2}) ; - fill Page withshade s ; - p := llcorner Field[Text][Bottom] -- - lrcorner Field[Text][Bottom] -- - urcorner Field[Text][Text] -- - ulcorner Field[Text][Text] -- cycle ; - p := p enlarged .5cm randomized .5cm ; - t := define_circular_shade(cp,cp,0,TextWidth,\MPcolor{shade-3}, - \MPcolor{shade-4}) ; - fill p withshade t ; - - def bottom_menu_button (expr nn, rr, pp, xx, yy, ww, hh, dd) = - if (pp>0) and (rr>0) : - if nn = 1 : - p := (0,0)--(ww,hh/2)--(0,hh)--cycle ; - elseif nn = 2 : - p := (0,hh/2)--(ww,hh)--(ww,0)--cycle ; + \MPcolor{shade-1},\MPcolor{shade-2}) ; + fill Page withshade s ; + p := llcorner Field[Text][Bottom] -- + lrcorner Field[Text][Bottom] -- + urcorner Field[Text][Text] -- + ulcorner Field[Text][Text] -- cycle ; + p := p enlarged .5cm randomized .5cm ; + t := define_circular_shade(cp,cp,0,TextWidth,\MPcolor{shade-3}, + \MPcolor{shade-4}) ; + fill p withshade t ; + + def bottom_menu_button (expr nn, rr, pp, xx, yy, ww, hh, dd) = + if (pp>0) and (rr>0) : + if nn = 1 : + p := (0,0)--(ww,hh/2)--(0,hh)--cycle ; + elseif nn = 2 : + p := (0,hh/2)--(ww,hh)--(ww,0)--cycle ; else : - p := origin--cycle ; - fi ; - fill p randomized 2.5mm shifted (xx,yy) withshade s ; - fi ; - enddef ; + p := origin--cycle ; + fi ; + fill p randomized 2.5mm shifted (xx,yy) withshade s ; + fi ; + enddef ; - \MPmenubuttons{bottom} + \MPmenubuttons{bottom} - if length \MPstring{topic} > 0 : + if length \MPstring{topic} > 0 : graphictext - \MPstring{topic} + \MPstring{topic} scaled 3 - shifted ulcorner Field[Text][Text] - shifted (0,-1.5cm) + shifted ulcorner Field[Text][Text] + shifted (0,-1.5cm) withshade s ; fi ; - StopPage ; + StopPage ; \stopuseMPgraphic \setupinteractionmenu @@ -116,8 +112,8 @@ position=yes] \startinteractionmenu[bottom] - \but [previouspage] \\ - \but [nextpage] \\ + \but [previouspage] \\ + \but [nextpage] \\ \stopinteractionmenu \setupinteraction @@ -148,20 +144,20 @@ \setupbackgrounds[page][background=text]} \def\TitleString#1#2% - {\indent + {\indent \startMPcode graphictext - "#2" + "#2" scaled #1 withdrawcolor .4white withfillcolor .7white withpen pencircle scaled 2pt ; \stopMPcode - \vfill} + \vfill} -\doifnotmode{demo}{\endinput} +\doifnotmode{demo}{\endinput} -\starttext +\starttext \StartTitlePage \TitleString{8}{Welcome} @@ -169,9 +165,9 @@ \TitleString{8}{Quotes} \StopTitlePage -\Topic {Douglas R. Hofstadter} \input douglas \page -\Topic {Donald E. Knuth} \input knuth \page -\Topic {Edward R. Tufte} \input tufte \page -\Topic {Hermann Zapf} \input zapf \page +\Topic {Douglas R. Hofstadter} \input douglas \page +\Topic {Donald E. Knuth} \input knuth \page +\Topic {Edward R. Tufte} \input tufte \page +\Topic {Hermann Zapf} \input zapf \page -\stoptext +\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-pre-22.tex b/Master/texmf-dist/tex/context/base/s-pre-22.tex index cb09816dc4b..8930c34be02 100644 --- a/Master/texmf-dist/tex/context/base/s-pre-22.tex +++ b/Master/texmf-dist/tex/context/base/s-pre-22.tex @@ -14,27 +14,27 @@ %D This style was made on behalf of the \PDFTEX\ presentation %D at \TUG\ 2000. It cycled a summary of each talk, with name %D and title. When documenting this style, I changed -%D reprocessing into pushing on layers. -%D +%D reprocessing into pushing on layers. +%D %D A \quote {problem} like this can be solved in several ways: -%D +%D %D \startitemize -%D \item writing a lot of semi||complex \TEX\ code as shown -%D \item keeping track of positions and draw everything on the +%D \item writing a lot of semi||complex \TEX\ code as shown +%D \item keeping track of positions and draw everything on the %D page layer -%D \item defining an overlay for each summary and changing the -%D order when flushing +%D \item defining an overlay for each summary and changing the +%D order when flushing %D \item maintaining a so called field stack %D \stopitemize -%D -%D We go for the first method. We assume that summaries are -%D simple text snippets. +%D +%D We go for the first method. We assume that summaries are +%D simple text snippets. \startmode[asintended] \setupbodyfont[lbr] \stopmode \setupbodyfont[14.4pt] -%D We use the whole page area. +%D We use the whole page area. \setuppapersize [S6][S6] @@ -47,8 +47,8 @@ width=middle, height=middle] -%D We define a couple of matching colors and gray scales. -%D Watch out, some are really meant to look dim. +%D We define a couple of matching colors and gray scales. +%D Watch out, some are really meant to look dim. \setupcolors [state=start] @@ -63,14 +63,14 @@ %D We will use foreground colors. Because these can interfere %D with the colors they overload, we can bets make sure that -%D we don't have local colors. +%D we don't have local colors. \setupinteraction [state=start, color=, contrastcolor=] -%D The presentation is supposed to cycle automatically. +%D The presentation is supposed to cycle automatically. \setupinteractionscreen [option=max, @@ -78,13 +78,13 @@ \setuppagetransitions -%D We will use random positioning of objects. +%D We will use random positioning of objects. \setupsystem - [random=medium] + [random=medium] %D We have two kind of graphics: the page background and -%D the shape around the textual elements. +%D the shape around the textual elements. \defineoverlay [shape] [\uniqueMPgraphic{shape}] \defineoverlay [page] [\reuseMPgraphic{page}] @@ -106,30 +106,30 @@ draw p withpen pencircle scaled .50cm withcolor \MPcolor{PageColor} ; fill p withcolor OverlayColor ; draw p withpen pencircle scaled .25cm withcolor OverlayLineColor ; - currentpicture := currentpicture xysized(OverlayWidth,OverlayHeight) ; + currentpicture := currentpicture xysized(OverlayWidth,OverlayHeight) ; \stopuniqueMPgraphic -%D The resizing at the end is needed to get a nice inverted -%D hyperlink when we click on it in a browser. +%D The resizing at the end is needed to get a nice inverted +%D hyperlink when we click on it in a browser. -%D Behind the page we put a forward button: +%D Behind the page we put a forward button: \defineoverlay [forward] [\overlaybutton{forward}] -%D The content will be managed by means of two layers. +%D The content will be managed by means of two layers. \definelayer [main] \defineoverlay [main] [\composedlayer{main}] \definelayer [temp] \defineoverlay [temp] [\composedlayer{temp}] %D The first layer will hold everything to be shown, while -%D the second one gets the data we currently focus on. -%D Therefore the first layer will not be flushed each page. +%D the second one gets the data we currently focus on. +%D Therefore the first layer will not be flushed each page. \setuplayer [main] [state=repeat] -%D All the overlays go onto the page area. +%D All the overlays go onto the page area. \setupbackgrounds [page] @@ -138,16 +138,16 @@ %D We have to collect all data before we typeset it. Each %D element will be typeset dim and bright. The dim %D alternatives will be collected on the main layer, but each -%D bring one goes onto a box stack. +%D bring one goes onto a box stack. \initializeboxstack{Summary} \initializeboxstack{Subtext} -%D The macros that take care of all this manipulations look -%D more complicated than they actually are. We use a -%D scratchbox to collect and inspect data. Also, because we -%D typeset each element twice, we need to make sure that we use -%D the same random seed for both. +%D The macros that take care of all this manipulations look +%D more complicated than they actually are. We use a +%D scratchbox to collect and inspect data. Also, because we +%D typeset each element twice, we need to make sure that we use +%D the same random seed for both. \doglobal\newcounter\CurrentSummary @@ -158,12 +158,12 @@ {\doglobal\increment\CurrentSummary \setbox\scratchbox=\hbox{\strut#1} \getrandomseed\RandomSeed - \setlayer[main] + \setlayer[main] {\RandomSubtextBox{DoneColor}{BotColor}{BotColor}} \setrandomseed\RandomSeed \savebox{Subtext}{\CurrentSummary} {\RandomSubtextBox{TextColor}{BotColor}{black}} - \setbox\scratchbox=\hbox \bgroup + \setbox\scratchbox=\hbox \bgroup \setbox\scratchbox=\hbox{\bfb\setstrut\strut\quad#2\quad}% \SetAcceptableWidth \framed [offset=0pt,width=fit,frame=off,align=middle,strut=no] @@ -171,9 +171,9 @@ \doifsomething{#2}{\noindent\box\scratchbox\blank}} \def\StopSummary - {\egroup \egroup + {\egroup \egroup \getrandomseed\RandomSeed - \setlayer[main] + \setlayer[main] {\RandomSummaryBox{DoneColor}{TopColor}{TopColor}} \setrandomseed\RandomSeed \savebox{Summary}{\CurrentSummary} @@ -182,11 +182,11 @@ %D A \type {\doStartSummary#1#2#3\StopSummary} could have been %D used too but this one is less sensitive for catcode changes %D (not that we expect problems like this in this kind of -%D application). +%D application). -%D The width is either derived from the width ot the title or +%D The width is either derived from the width ot the title or %D at random. The final width of the box is detemined by the -%D content. +%D content. \def\SetAcceptableWidth {\scratchdimen=.5\makeupwidth @@ -196,15 +196,15 @@ \getrandomdimen\hsize{.5\makeupwidth}{.7\makeupwidth}% \fi} -%D The subtext box goes at the bottom, somewhere in the right -%D corner. +%D The subtext box goes at the bottom, somewhere in the right +%D corner. \def\RandomSubtextBox#1#2#3% {\vbox to \makeupheight {\vfill \hbox to \makeupwidth {\hfill - \button + \button [offset=2ex,frame=off,background=shape,strut=no, backgroundcolor=#1,framecolor=#2,foregroundcolor=#3] {\copy\scratchbox}% @@ -214,8 +214,8 @@ \getrandomdimen\scratchdimen{.5cm}{1.5cm} \vskip \scratchdimen}} -%D The main text goes in the top half of the page, not to -%D far from the center. The last \type {\vskip} makes sure +%D The main text goes in the top half of the page, not to +%D far from the center. The last \type {\vskip} makes sure %D that we don't clash with the subtexts. \definereference[thispage][page(\CurrentSummary)] @@ -227,7 +227,7 @@ \hbox to \makeupwidth {\getrandomdimen\scratchdimen{.5cm}\makeupwidth \hskip 0pt plus \scratchdimen - \button + \button [offset=3ex,frame=off,background=shape,strut=no, backgroundcolor=#1,framecolor=#2,foregroundcolor=#3] {\copy\scratchbox}% @@ -239,8 +239,8 @@ \vskip.2\makeupheight}} %D Because we conly collect data, we hav eto make sure that at -%D some moment it is processed and flushed. The following loop -%D does this. +%D some moment it is processed and flushed. The following loop +%D does this. \def\BuildPage {\dorecurse{\CurrentSummary} @@ -249,11 +249,11 @@ \setlayer[temp]{\foundbox{Subtext}\recurselevel} \stopstandardmakeup}} -%D We hook this macro into the \type {\stoptext} macro. +%D We hook this macro into the \type {\stoptext} macro. \appendtoks \BuildPage \to \everystoptext -%D We still need a title page. +%D We still need a title page. \def\TitlePage% {\dodoublegroupempty\doTitlePage} @@ -270,13 +270,13 @@ \def\MakeTitlePage#1#2% {\StartSummary{#1}{#2}\StopSummary} -%D For old times sake: +%D For old times sake: \long\def\StartTopic#1\StopTopic{\StartSummary#1\StopSummary} \doifnotmode{demo}{\endinput} -%D The demo text. +%D The demo text. \starttext diff --git a/Master/texmf-dist/tex/context/base/s-pre-30.mkii b/Master/texmf-dist/tex/context/base/s-pre-30.mkii new file mode 100644 index 00000000000..2a3899c9290 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-pre-30.mkii @@ -0,0 +1,258 @@ +%D \module +%D [ file=s-pre-30, +%D version=2006.04.25, +%D title=\CONTEXT\ Style File, +%D subtitle=Presentation Environment 30, +%D author=Hans Hagen, +%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. + +\usemodule[streams] + +\setuppapersize + [S6] [S6] + +\setupbodyfont + [12pt,tt] + +\definemeasure[bleed][6pt] + +\definecolor[maincolor-3][r=.5,g=.2,b=.2] +\definecolor[maincolor-1][r=.2,g=.5,b=.2] +\definecolor[maincolor-2][r=.2,g=.2,b=.5] + +\definecolor[pagecolor] [s=.5] +\definecolor[resultcolor][s=1,t=.85,a=1] +\definecolor[maincolor] [maincolor-3] + +\definecolorgroup + [maingroup] + [.5:.2:.2, + .2:.5:.2, + .2:.2:.5] + +\definecolorgroup + [resultgroup] + [1:.85:.85, + .85:1:.85, + .85:.85:1] + +\def\CurrentColor{1} + +\definecolor[maincolor] [maingroup:\CurrentColor] +\definecolor[resultcolor][resultgroup:\CurrentColor] + +\def\NextColor{\ifnum\CurrentColor=3 \def\CurrentColor{1}\else\doglobal\increment\CurrentColor\fi} + +\setuplayout + [backspace=\measure{bleed}, + topspace=30pt, + bottomdistance=\measure{bleed}, + bottom=\dimexpr30pt-\measure{bleed}\relax, + header=0pt, + footer=0pt, + topdistance=\measure{bleed}, + top=\dimexpr30pt-\measure{bleed}\relax, + width=middle, + height=middle] + +\setuptop + [before=\vfill, + after=\vfill, + strut=yes] + +\setupbackgrounds + [text] + [backgroundoffset=\measure{bleed}, + background=color, + backgroundcolor=maincolor] + +\setupbackgrounds + [page] + [background=color, + backgroundcolor=pagecolor] + +\setupcolors + [state=start, + textcolor=white] + +\setuphead + [chapter] + [style=\ttd] + +\setuphead + [section] + [style=\ttd] + +\defineproperty + [result] + [layer] + [state=stop] + +\definelayer + [result] + +\setuplayer + [result] + [width=\textwidth, + height=\textheight] + +\setupbackgrounds + [text] + [background={color,toggle,foreground,result}] + +\setupinteraction + [state=start, + click=no, + menu=on, + color=white, + contrastcolor=white, + closepageaction=HideLayer{result}, + openpageaction=HideLayer{result}] + +% We add a dummy color switch so that each page has at least one +% transparency; else acrobat will render the pages differently +% bug in 6 and 7). + +\startinteractionmenu[bottom] +% \color[resultcolor]{ }% + \hfill + \got [content] content \\ + \got [previouspage] previous \\ + \got [nextpage] next \\ + \got [ToggleLayer{result}] result \\ + \got [CloseDocument] close \\ +\stopinteractionmenu + +\setuphead + [section] + [placehead=no, + incrementnumber=list] + +\setuplist + [section] + [alternative=f] + +\defineoverlay + [toggle] + [\overlaybutton{ToggleLayer{result}}] + +\definestreamlayer + [resultstream] + +\startsetups streamlayer:resultstream:flush + \setlayer + [result] + [preset=middlebottom, + hoffset=\measure{bleed}, +% voffset=-\measure{bleed}] + voffset=\measure{bleed}] + {\startproperty[result]% +% \framed +% [offset=overlay, +% frame=off, +% background=color, +% backgroundoffset=1\dimexpr\measure{bleed}\relax, +% backgroundcolor=maincolor] + {\framed + [offset=overlay, + frame=off, + foregroundcolor=maincolor, + background=color, + backgroundoffset=1\dimexpr\measure{bleed}\relax, + backgroundcolor=resultcolor] + {\tightlayer[\currentstreamlayer]}} + \stopproperty} +\stopsetups + +\startsetups show-definition + \subject{definition} + \typebuffer + \getbuffer + \page +\stopsetups + +\startsetups show-result + \startstreamlayer[resultstream] + \subject{result} + \getbuffer + \stopstreamlayer + \placestreamlayer[resultstream] + \page +\stopsetups + +\startsetups show-usage + \subject{usage} + \typebuffer + \startstreamlayer[resultstream] + \subject{result} + \getbuffer + \stopstreamlayer + \placestreamlayer[resultstream] + \page +\stopsetups + +\startsetups show-usage-lines + \subject{usage} + \typebuffer + \startstreamlayer[resultstream] + \subject{result} + \startlines + \getbuffer + \stoplines + \stopstreamlayer + \placestreamlayer[resultstream] + \page +\stopsetups + +\startsetups show-contents + \startcolumns[n=3] + \placelist[section][criterium=text] + \stopcolumns + \pagereference[content] + \page + \NextColor +\stopsetups + +\def\TitlePage#1% + {\title{#1} + \setups{show-contents}} + +\def\StartSample#1% + {\starttext + \page + \section{#1} + \setuptoptexts[][\processedfile\enspace:\enspace\lowercase{#1}]} + +\def\StopSample + {\page + \setuptoptexts[][] + \stoptext + \NextColor} + +\endinput + +\usemodule[pre-30] + +% \TitlePage{Howling to the moon} + +\StartSample{Basics} + +\startbuffer +\lua{a = 1.5 ; b = 1.8 ; c = a*b ; tex.print(c) ;} + +\startlua + a = 1 + b = 2 + c = a*b + tex.print(c) +\stoplua +\stopbuffer + +\setups{show-usage} + +\StopSample diff --git a/Master/texmf-dist/tex/context/base/s-pre-30.mkiv b/Master/texmf-dist/tex/context/base/s-pre-30.mkiv new file mode 100644 index 00000000000..c3b524047d6 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-pre-30.mkiv @@ -0,0 +1,257 @@ +%D \module +%D [ file=s-pre-30, +%D version=2006.04.25, +%D title=\CONTEXT\ Style File, +%D subtitle=Presentation Environment 30, +%D author=Hans Hagen, +%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. + +\usemodule[streams] + +\setuppapersize + [S6] [S6] + +\setupbodyfont + [12pt,tt] + +\definemeasure[bleed][6pt] + +\definecolor[maincolor-3][r=.5,g=.2,b=.2] +\definecolor[maincolor-1][r=.2,g=.5,b=.2] +\definecolor[maincolor-2][r=.2,g=.2,b=.5] + +\definecolor[pagecolor] [s=.5] +\definecolor[resultcolor][s=1,t=.85,a=1] +\definecolor[maincolor] [maincolor-3] + +\definecolorgroup + [maingroup] + [.5:.2:.2, + .2:.5:.2, + .2:.2:.5] + +\definecolorgroup + [resultgroup] + [1:.85:.85, + .85:1:.85, + .85:.85:1] + +\def\CurrentColor{1} + +\definecolor[maincolor] [maingroup:\CurrentColor] +\definecolor[resultcolor][resultgroup:\CurrentColor] + +\def\NextColor{\ifnum\CurrentColor=3 \def\CurrentColor{1}\else\doglobal\increment\CurrentColor\fi} + +\setuplayout + [backspace=\measure{bleed}, + topspace=30pt, + bottomdistance=\measure{bleed}, + bottom=\dimexpr30pt-\measure{bleed}\relax, + header=0pt, + footer=0pt, + topdistance=\measure{bleed}, + top=\dimexpr30pt-\measure{bleed}\relax, + width=middle, + height=middle] + +\setuptop + [before=\vfill, + after=\vfill, + strut=yes] + +\setupbackgrounds + [text] + [backgroundoffset=\measure{bleed}, + background=color, + backgroundcolor=maincolor] + +\setupbackgrounds + [page] + [background=color, + backgroundcolor=pagecolor] + +\setupcolors + [state=start, + textcolor=white] + +\setuphead + [chapter] + [style=\ttd] + +\setuphead + [section] + [style=\ttd] + +\defineviewerlayer + [result] + [state=stop] + +\definelayer + [result] + +\setuplayer + [result] + [width=\textwidth, + height=\textheight] + +\setupbackgrounds + [text] + [background={color,toggle,foreground,result}] + +\setupinteraction + [state=start, + click=no, + menu=on, + color=white, + contrastcolor=white, + closepageaction=HideLayer{result}, + openpageaction=HideLayer{result}] + +% We add a dummy color switch so that each page has at least one +% transparency; else acrobat will render the pages differently +% bug in 6 and 7). + +\startinteractionmenu[bottom] +% \color[resultcolor]{ }% + \hfill + \got [content] content \\ + \got [previouspage] previous \\ + \got [nextpage] next \\ + \got [ToggleLayer{result}] result \\ + \got [CloseDocument] close \\ +\stopinteractionmenu + +\setuphead + [section] + [placehead=no, + incrementnumber=list] + +\setuplist + [section] + [alternative=f] + +\defineoverlay + [toggle] + [\overlaybutton{ToggleLayer{result}}] + +\definestreamlayer + [resultstream] + +\startsetups streamlayer:resultstream:flush + \setlayer + [result] + [preset=middlebottom, + hoffset=\measure{bleed}, +% voffset=-\measure{bleed}] + voffset=\measure{bleed}] + {\startviewerlayer[result]% +% \framed +% [offset=overlay, +% frame=off, +% background=color, +% backgroundoffset=1\dimexpr\measure{bleed}\relax, +% backgroundcolor=maincolor] + {\framed + [offset=overlay, + frame=off, + foregroundcolor=maincolor, + background=color, + backgroundoffset=1\dimexpr\measure{bleed}\relax, + backgroundcolor=resultcolor] + {\tightlayer[\currentstreamlayer]}} + \stopviewerlayer} +\stopsetups + +\startsetups show-definition + \subject{definition} + \typebuffer + \getbuffer + \page +\stopsetups + +\startsetups show-result + \startstreamlayer[resultstream] + \subject{result} + \getbuffer + \stopstreamlayer + \placestreamlayer[resultstream] + \page +\stopsetups + +\startsetups show-usage + \subject{usage} + \typebuffer + \startstreamlayer[resultstream] + \subject{result} + \getbuffer + \stopstreamlayer + \placestreamlayer[resultstream] + \page +\stopsetups + +\startsetups show-usage-lines + \subject{usage} + \typebuffer + \startstreamlayer[resultstream] + \subject{result} + \startlines + \getbuffer + \stoplines + \stopstreamlayer + \placestreamlayer[resultstream] + \page +\stopsetups + +\startsetups show-contents + \startcolumns[n=3] + \placelist[section][criterium=text] + \stopcolumns + \pagereference[content] + \page + \NextColor +\stopsetups + +\def\TitlePage#1% + {\title{#1} + \setups{show-contents}} + +\def\StartSample#1% + {\starttext + \page + \section{#1} + \setuptoptexts[][\processedfile\enspace:\enspace\lowercase{#1}]} + +\def\StopSample + {\page + \setuptoptexts[][] + \stoptext + \NextColor} + +\endinput + +\usemodule[pre-30] + +% \TitlePage{Howling to the moon} + +\StartSample{Basics} + +\startbuffer +\lua{a = 1.5 ; b = 1.8 ; c = a*b ; tex.print(c) ;} + +\startlua + a = 1 + b = 2 + c = a*b + tex.print(c) +\stoplua +\stopbuffer + +\setups{show-usage} + +\StopSample diff --git a/Master/texmf-dist/tex/context/base/s-pre-30.tex b/Master/texmf-dist/tex/context/base/s-pre-30.tex deleted file mode 100644 index 2a3899c9290..00000000000 --- a/Master/texmf-dist/tex/context/base/s-pre-30.tex +++ /dev/null @@ -1,258 +0,0 @@ -%D \module -%D [ file=s-pre-30, -%D version=2006.04.25, -%D title=\CONTEXT\ Style File, -%D subtitle=Presentation Environment 30, -%D author=Hans Hagen, -%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. - -\usemodule[streams] - -\setuppapersize - [S6] [S6] - -\setupbodyfont - [12pt,tt] - -\definemeasure[bleed][6pt] - -\definecolor[maincolor-3][r=.5,g=.2,b=.2] -\definecolor[maincolor-1][r=.2,g=.5,b=.2] -\definecolor[maincolor-2][r=.2,g=.2,b=.5] - -\definecolor[pagecolor] [s=.5] -\definecolor[resultcolor][s=1,t=.85,a=1] -\definecolor[maincolor] [maincolor-3] - -\definecolorgroup - [maingroup] - [.5:.2:.2, - .2:.5:.2, - .2:.2:.5] - -\definecolorgroup - [resultgroup] - [1:.85:.85, - .85:1:.85, - .85:.85:1] - -\def\CurrentColor{1} - -\definecolor[maincolor] [maingroup:\CurrentColor] -\definecolor[resultcolor][resultgroup:\CurrentColor] - -\def\NextColor{\ifnum\CurrentColor=3 \def\CurrentColor{1}\else\doglobal\increment\CurrentColor\fi} - -\setuplayout - [backspace=\measure{bleed}, - topspace=30pt, - bottomdistance=\measure{bleed}, - bottom=\dimexpr30pt-\measure{bleed}\relax, - header=0pt, - footer=0pt, - topdistance=\measure{bleed}, - top=\dimexpr30pt-\measure{bleed}\relax, - width=middle, - height=middle] - -\setuptop - [before=\vfill, - after=\vfill, - strut=yes] - -\setupbackgrounds - [text] - [backgroundoffset=\measure{bleed}, - background=color, - backgroundcolor=maincolor] - -\setupbackgrounds - [page] - [background=color, - backgroundcolor=pagecolor] - -\setupcolors - [state=start, - textcolor=white] - -\setuphead - [chapter] - [style=\ttd] - -\setuphead - [section] - [style=\ttd] - -\defineproperty - [result] - [layer] - [state=stop] - -\definelayer - [result] - -\setuplayer - [result] - [width=\textwidth, - height=\textheight] - -\setupbackgrounds - [text] - [background={color,toggle,foreground,result}] - -\setupinteraction - [state=start, - click=no, - menu=on, - color=white, - contrastcolor=white, - closepageaction=HideLayer{result}, - openpageaction=HideLayer{result}] - -% We add a dummy color switch so that each page has at least one -% transparency; else acrobat will render the pages differently -% bug in 6 and 7). - -\startinteractionmenu[bottom] -% \color[resultcolor]{ }% - \hfill - \got [content] content \\ - \got [previouspage] previous \\ - \got [nextpage] next \\ - \got [ToggleLayer{result}] result \\ - \got [CloseDocument] close \\ -\stopinteractionmenu - -\setuphead - [section] - [placehead=no, - incrementnumber=list] - -\setuplist - [section] - [alternative=f] - -\defineoverlay - [toggle] - [\overlaybutton{ToggleLayer{result}}] - -\definestreamlayer - [resultstream] - -\startsetups streamlayer:resultstream:flush - \setlayer - [result] - [preset=middlebottom, - hoffset=\measure{bleed}, -% voffset=-\measure{bleed}] - voffset=\measure{bleed}] - {\startproperty[result]% -% \framed -% [offset=overlay, -% frame=off, -% background=color, -% backgroundoffset=1\dimexpr\measure{bleed}\relax, -% backgroundcolor=maincolor] - {\framed - [offset=overlay, - frame=off, - foregroundcolor=maincolor, - background=color, - backgroundoffset=1\dimexpr\measure{bleed}\relax, - backgroundcolor=resultcolor] - {\tightlayer[\currentstreamlayer]}} - \stopproperty} -\stopsetups - -\startsetups show-definition - \subject{definition} - \typebuffer - \getbuffer - \page -\stopsetups - -\startsetups show-result - \startstreamlayer[resultstream] - \subject{result} - \getbuffer - \stopstreamlayer - \placestreamlayer[resultstream] - \page -\stopsetups - -\startsetups show-usage - \subject{usage} - \typebuffer - \startstreamlayer[resultstream] - \subject{result} - \getbuffer - \stopstreamlayer - \placestreamlayer[resultstream] - \page -\stopsetups - -\startsetups show-usage-lines - \subject{usage} - \typebuffer - \startstreamlayer[resultstream] - \subject{result} - \startlines - \getbuffer - \stoplines - \stopstreamlayer - \placestreamlayer[resultstream] - \page -\stopsetups - -\startsetups show-contents - \startcolumns[n=3] - \placelist[section][criterium=text] - \stopcolumns - \pagereference[content] - \page - \NextColor -\stopsetups - -\def\TitlePage#1% - {\title{#1} - \setups{show-contents}} - -\def\StartSample#1% - {\starttext - \page - \section{#1} - \setuptoptexts[][\processedfile\enspace:\enspace\lowercase{#1}]} - -\def\StopSample - {\page - \setuptoptexts[][] - \stoptext - \NextColor} - -\endinput - -\usemodule[pre-30] - -% \TitlePage{Howling to the moon} - -\StartSample{Basics} - -\startbuffer -\lua{a = 1.5 ; b = 1.8 ; c = a*b ; tex.print(c) ;} - -\startlua - a = 1 - b = 2 - c = a*b - tex.print(c) -\stoplua -\stopbuffer - -\setups{show-usage} - -\StopSample diff --git a/Master/texmf-dist/tex/context/base/s-pre-50.tex b/Master/texmf-dist/tex/context/base/s-pre-50.tex index 782f6aea102..41ae048215d 100644 --- a/Master/texmf-dist/tex/context/base/s-pre-50.tex +++ b/Master/texmf-dist/tex/context/base/s-pre-50.tex @@ -62,7 +62,7 @@ %D Structure and trick. \def\StartSteps - {\checkutilities} + {\doifnotmode{mkiv}{\checkutilities}} \def\StopSteps {\resetcollector[contribution]} diff --git a/Master/texmf-dist/tex/context/base/s-pre-60.mkii b/Master/texmf-dist/tex/context/base/s-pre-60.mkii new file mode 100644 index 00000000000..4df3e8a617b --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-pre-60.mkii @@ -0,0 +1,143 @@ +%D \module +%D [ file=s-pre-60, +%D version=2004.03.15, +%D title=\CONTEXT\ Style File, +%D subtitle=Presentation Environment 60, +%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. + +\startmode[paper,print] + \let\StartSteps\relax + \let\StopSteps \relax + \let\FlushStep \relax + \let\ResetStep \relax + \let\StartBusy\relax + \let\StopBusy \relax + \endinput +\stopmode + +\newcounter\StepCounter +\newcounter\StepMaximum + +\useJSscripts[stp] + +\startsetups[set-stepper] + + \ifnum\getvariable{stepper}{nofsteps}>\StepMaximum + + \dostepwiserecurse {\numexpr(\StepMaximum+1)} {\getvariable{stepper}{nofsteps}} {1} + {\doifnotmode{nosteps,nostep} + {\expanded{\defineproperty[step:\recurselevel][layer][state=stop,global=yes]}}} + + \xdef\StepMaximum{\getvariable{stepper}{nofsteps}} + + \fi + +\stopsetups + +\setvariables + [stepper] + [set=\setups{set-stepper}, + nofsteps=50] + +\defineproperty[step:busy][layer][state=start,global=no] + +\definereference [SetupStepper] [JS(SetupStepper{step,\StepMaximum})] +\definereference [ResetStepper] [JS(ResetStepper)] +\definereference [CheckStepper] [JS(CheckStepper{\StepCounter})] +\definereference [InvokeStepper] [JS(InvokeStepper)] + +\def\ResetStep {\doglobal\newcounter\StepCounter} +\def\NextStep {\doglobal\increment \StepCounter} +\def\PrevStep {\doglobal\decrement \StepCounter} + +% todo: roll back blank + +\def\StepLayer {step:\StepCounter} +\def\NextStepLayer {step:\the\numexpr\StepCounter+1\relax} +\def\FirstStepLayer{step:1} + +\def\StartStep + {\ifvmode + \scratchskip\lastskip + \vskip-\scratchskip + \startproperty[\StepLayer]% + \vskip\scratchskip + \else + \startproperty[\StepLayer]% + \fi + \ignorespaces} + +\def\StopStep + {\removeunwantedspaces + \stopproperty} + +\def\StartSteps{\iftrialtypesetting\else\ResetStep\NextStep\StartStep\fi} +\def\StopSteps {\iftrialtypesetting\else\StopStep \PrevStep \fi} +\def\FlushStep {\iftrialtypesetting\else\StopStep \NextStep\StartStep\fi} + +\appendtoks + \ResetStep +\to \everyaftershipout + +\def\StartBusy{\startproperty[step:busy]\ignorespaces} +\def\StopBusy {\removeunwantedspaces\stopproperty} + +\setupinteraction + [%openaction=SetupStepper, + closeaction=ResetStepper, + openpageaction=CheckStepper, + closepageaction=ResetStepper] + +\defineoverlay[invoke][\overlaybutton{InvokeStepper}] + +\setupbackgrounds + [text] + [background=invoke] + +% bonus + +\useMPlibrary[nav] + +\definepalet + [navplus] + [attach=interactioncolor, + comment=interactioncolor] + +\setupcomment + [symbol={comment-normal,comment-down}, + textlayer=\StepLayer, + option=buffer, + height=\textheight, + width=\textwidth, + margin=0pt] + +\setupattachments + [symbol={attach-normal,attach-down}, + textlayer=\StepLayer] + +%D Handy: + +\def\StartLocalSteps{\ResetStep} +\def\StopLocalSteps {} + +\def\StartLocalStep {\NextStep\StartStep} +\def\StopLocalStep {\StopStep} + +%D used as (given some definitions): +%D +%D \starttyping +%D \StartLocalSteps +%D \startcombination[both] +%D {\StartLocalStep\placestreamlayer[left]\StopLocalStep} {} +%D {\StartLocalStep\placestreamlayer[right]\StopLocalStep} {} +%D \stopcombination +%D \StopLocalSteps +%D \stoptyping + +\endinput diff --git a/Master/texmf-dist/tex/context/base/s-pre-60.mkiv b/Master/texmf-dist/tex/context/base/s-pre-60.mkiv new file mode 100644 index 00000000000..aa5ec36d085 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-pre-60.mkiv @@ -0,0 +1,134 @@ +%D \module +%D [ file=s-pre-60, +%D version=2004.03.15, +%D title=\CONTEXT\ Style File, +%D subtitle=Presentation Environment 60, +%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. + +% use lua instead of global mess + +\startmode[paper,print] + \let\StartSteps\relax + \let\StopSteps \relax + \let\FlushStep \relax + \let\ResetStep \relax + \let\StartBusy \relax + \let\StopBusy \relax + \endinput +\stopmode + +\newcounter\StepCounter +\newcounter\StepMaximum + +\useJSscripts[stp] + +\startsetups[set-stepper] + + \ifnum\getvariable{stepper}{nofsteps}>\StepMaximum + + \dostepwiserecurse {\numexpr\StepMaximum+1\relax} {\getvariable{stepper}{nofsteps}} {1} { + \doifnotmode{nosteps,nostep} { + \expanded{\defineviewerlayer[step:\recurselevel][state=stop,scope=global]} + } + } + + \xdef\StepMaximum{\getvariable{stepper}{nofsteps}} + + \fi + +\stopsetups + +\setvariables + [stepper] + [set=\setups{set-stepper}, + nofsteps=50] + +\defineviewerlayer[step:busy][state=start] + +\definereference [SetupStepper] [JS(SetupStepper{step,\StepMaximum})] +\definereference [ResetStepper] [JS(ResetStepper)] +\definereference [CheckStepper] [JS(CheckStepper{\StepCounter})] +\definereference [InvokeStepper] [JS(InvokeStepper)] + +% todo: roll back blank + +\def\ResetStep {\doglobal\newcounter\StepCounter} +\def\NextStep {\doglobal\increment \StepCounter} +\def\PrevStep {\doglobal\decrement \StepCounter} + +\def\StepLayer {step:\StepCounter} +\def\NextStepLayer {step:\the\numexpr\StepCounter+1\relax} +\def\FirstStepLayer{step:1} + +\def\StartStep {\startviewerlayer[\StepLayer]\ignorespaces} +\def\StopStep {\removeunwantedspaces\stopviewerlayer} +\def\StartSteps {\iftrialtypesetting\else\ResetStep\NextStep\StartStep\fi} +\def\StopSteps {\iftrialtypesetting\else\StopStep \PrevStep \fi} +\def\FlushStep {\iftrialtypesetting\else\StopStep \NextStep\StartStep\fi} + +\def\StartBusy {\startviewerlayer[step:busy]\ignorespaces} +\def\StopBusy {\removeunwantedspaces\stopviewerlayer} + +\appendtoks + \ResetStep +\to \everyaftershipout + +\setupinteraction + [%openaction=SetupStepper, + closeaction=ResetStepper, + openpageaction=CheckStepper, + closepageaction=ResetStepper] + +\defineoverlay[invoke][\overlaybutton{InvokeStepper}] + +\setupbackgrounds + [text] + [background=invoke] + +% bonus + +\useMPlibrary[nav] + +\definepalet + [navplus] + [attach=interactioncolor, + comment=interactioncolor] + +\setupcomment + [symbol={comment-normal,comment-down}, + textlayer=\StepLayer, + option=buffer, + height=\textheight, + width=\textwidth, + margin=0pt] + +\setupattachments + [symbol={attach-normal,attach-down}, + textlayer=\StepLayer] + +%D Handy: + +\def\StartLocalSteps{\ResetStep} +\def\StopLocalSteps {} + +\def\StartLocalStep {\NextStep\StartStep} +\def\StopLocalStep {\StopStep} + +%D used as (given some definitions): +%D +%D \starttyping +%D \StartLocalSteps +%D \startcombination[both] +%D {\StartLocalStep\placestreamlayer[left]\StopLocalStep} {} +%D {\StartLocalStep\placestreamlayer[right]\StopLocalStep} {} +%D \stopcombination +%D \StopLocalSteps +%D \stoptyping + +\endinput diff --git a/Master/texmf-dist/tex/context/base/s-pre-60.tex b/Master/texmf-dist/tex/context/base/s-pre-60.tex deleted file mode 100644 index f12b98b0633..00000000000 --- a/Master/texmf-dist/tex/context/base/s-pre-60.tex +++ /dev/null @@ -1,159 +0,0 @@ -%D \module -%D [ file=s-pre-60, -%D version=2004.03.15, -%D title=\CONTEXT\ Style File, -%D subtitle=Presentation Environment 60, -%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. - -\startmode[paper,print] - \let\StartSteps\relax - \let\StopSteps \relax - \let\FlushStep \relax - \let\ResetStep \relax - \let\StartBusy\relax - \let\StopBusy \relax - \endinput -\stopmode - -\newcounter\StepCounter -\newcounter\StepMaximum - -\useJSscripts[stp] - -\startsetups[set-stepper] - - \ifnum\getvariable{stepper}{nofsteps}>\StepMaximum - - \dostepwiserecurse {\numexpr(\StepMaximum+1)} {\getvariable{stepper}{nofsteps}} {1} - {\doifnotmode{nosteps,nostep} - {\expanded{\defineproperty[step:\recurselevel][layer][state=stop,global=yes]}}} - - \xdef\StepMaximum{\getvariable{stepper}{nofsteps}} - - \fi - -\stopsetups - -\setvariables - [stepper] - [set=\setups{set-stepper}, - nofsteps=50] - -\defineproperty[step:busy][layer][state=start,global=no] - -\definereference [SetupStepper] [JS(SetupStepper{step,\StepMaximum})] -\definereference [ResetStepper] [JS(ResetStepper)] -\definereference [CheckStepper] [JS(CheckStepper{\StepCounter})] -\definereference [InvokeStepper] [JS(InvokeStepper)] - -\def\ResetStep {\doglobal\newcounter\StepCounter} -\def\NextStep {\doglobal\increment \StepCounter} -\def\PrevStep {\doglobal\decrement \StepCounter} - -% todo: roll back blank - -\def\StepLayer {step:\StepCounter} -\def\NextStepLayer {step:\the\numexpr\StepCounter+1\relax} -\def\FirstStepLayer{step:1} - -\startmode[mkiv] - - \def\StartStep - {\startproperty[\StepLayer]% - \ignorespaces} - - \def\StopStep - {\removeunwantedspaces - \stopproperty} - -\stopmode - -\startnotmode[mkiv] - - \def\StartStep - {\ifvmode - \scratchskip\lastskip - \vskip-\scratchskip - \startproperty[\StepLayer]% - \vskip\scratchskip - \else - \startproperty[\StepLayer]% - \fi - \ignorespaces} - - \def\StopStep - {\removeunwantedspaces - \stopproperty} - -\stopnotmode - -\def\StartSteps{\iftrialtypesetting\else\ResetStep\NextStep\StartStep\fi} -\def\StopSteps {\iftrialtypesetting\else\StopStep \PrevStep \fi} -\def\FlushStep {\iftrialtypesetting\else\StopStep \NextStep\StartStep\fi} - -\appendtoks - \ResetStep -\to \everyaftershipout - -\def\StartBusy{\startproperty[step:busy]\ignorespaces} -\def\StopBusy {\removeunwantedspaces\stopproperty} - -\setupinteraction - [%openaction=SetupStepper, - closeaction=ResetStepper, - openpageaction=CheckStepper, - closepageaction=ResetStepper] - -\defineoverlay[invoke][\overlaybutton{InvokeStepper}] - -\setupbackgrounds - [text] - [background=invoke] - -% bonus - -\useMPlibrary[nav] - -\definepalet - [navplus] - [attach=interactioncolor, - comment=interactioncolor] - -\setupcomment - [symbol={comment-normal,comment-down}, - textlayer=\StepLayer, - option=buffer, - height=\textheight, - width=\textwidth, - margin=0pt] - -\setupattachments - [symbol={attach-normal,attach-down}, - textlayer=\StepLayer] - -%D Handy: - -\def\StartLocalSteps{\ResetStep} -\def\StopLocalSteps {} - -\def\StartLocalStep {\NextStep\StartStep} -\def\StopLocalStep {\StopStep} - -%D used as (given some definitions): -%D -%D \starttyping -%D \StartLocalSteps -%D \startcombination[both] -%D {\StartLocalStep\placestreamlayer[left]\StopLocalStep} {} -%D {\StartLocalStep\placestreamlayer[right]\StopLocalStep} {} -%D \stopcombination -%D \StopLocalSteps -%D \stoptyping - -\endinput diff --git a/Master/texmf-dist/tex/context/base/s-pre-61.tex b/Master/texmf-dist/tex/context/base/s-pre-61.tex index fa52d158a87..216bb9a003c 100644 --- a/Master/texmf-dist/tex/context/base/s-pre-61.tex +++ b/Master/texmf-dist/tex/context/base/s-pre-61.tex @@ -221,7 +221,7 @@ [bottom] [text] [background=topics] -% \doifnotmode{demo}{\endinput} +\doifnotmode{demo}{\endinput} \starttext diff --git a/Master/texmf-dist/tex/context/base/s-pre-62.tex b/Master/texmf-dist/tex/context/base/s-pre-62.tex index 64bb3495b5d..8e50af5292e 100644 --- a/Master/texmf-dist/tex/context/base/s-pre-62.tex +++ b/Master/texmf-dist/tex/context/base/s-pre-62.tex @@ -18,10 +18,21 @@ \usetypescriptfile [type-ghz] -\definetypeface[mainface][rm][serif][melior] [default][encoding=texnansi] -\definetypeface[mainface][tt][mono] [modern] [default][encoding=texnansi,rscale=1.05] -\definetypeface[mainface][ss][serif][melior] [default][encoding=texnansi] -\definetypeface[mainface][mm][math] [palatino][default][encoding=texnansi,rscale=0.95] +\doifmodeelse {mkiv} { + + \definetypeface[mainface][rm][serif][melior] [default] + \definetypeface[mainface][tt][mono] [modern] [default][rscale=1.05] + \definetypeface[mainface][ss][serif][melior] [default] + \definetypeface[mainface][mm][math] [palatino][default][rscale=0.95] + +} { + + \definetypeface[mainface][rm][serif][melior] [default][encoding=texnansi] + \definetypeface[mainface][tt][mono] [modern] [default][encoding=texnansi,rscale=1.05] + \definetypeface[mainface][ss][serif][melior] [default][encoding=texnansi] + \definetypeface[mainface][mm][math] [palatino][default][encoding=texnansi,rscale=0.95] + +} \setupbodyfont [mainface,14.4pt] @@ -207,22 +218,8 @@ \def\TitlePage {\doTitlePage\TitleFont\relax} \def\SubTitlePage{\doTitlePage\TitleFont\SubTitleFont} -\doifnotmode{demo} {\endinput} +\long\def\StartTitlePage #1\StopTitlePage {\TitlePage {#1}} +\long\def\StartSubTitlePage#1\StopSubTitlePage{\SubTitlePage{#1}} -\starttext - -\StartTitlePage -bla\\bla bla\\bla -\StopTitlePage - -\StartRemark {Bla Bla} - Bla Bla Bla. \FlushStep - Bla Bla Bla. \FlushStep -\StopRemark - -\StartRemark {Bla Bla} - Bla Bla Bla. \FlushStep - Bla Bla Bla. \FlushStep -\StopRemark +\doifnotmode{demo} {\endinput} -\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-pre-63.tex b/Master/texmf-dist/tex/context/base/s-pre-63.tex index 76de8b99186..1a0fdf607c1 100644 --- a/Master/texmf-dist/tex/context/base/s-pre-63.tex +++ b/Master/texmf-dist/tex/context/base/s-pre-63.tex @@ -11,6 +11,10 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +this module is under reconstruction + +\endinput + \usemodule[pre-61,streams] \definemeasure[textgap] [\dimexpr24pt\relax] @@ -58,12 +62,11 @@ \def\StartPair {} \def\StopPair {\setups[place:both]} -\doifnotmode {demo} {\endinput} +% \doifnotmode {demo} {\endinput} \setupbodyfont[8pt] \definefont[BigFont][Normal sa 4] \starttext - \StartPage \StartPair \StartLeft ZAPF \StopLeft \StartRight \input zapf \StopRight \StopPair \StartPair \StartLeft DAVIS \StopLeft \StartRight \input davis \StopRight \StopPair diff --git a/Master/texmf-dist/tex/context/base/s-pre-64.tex b/Master/texmf-dist/tex/context/base/s-pre-64.tex index b9dc10002c8..9e82b255c55 100644 --- a/Master/texmf-dist/tex/context/base/s-pre-64.tex +++ b/Master/texmf-dist/tex/context/base/s-pre-64.tex @@ -161,43 +161,48 @@ {\setuplayer[base][state=repeat] \setlayer[base][preset=rightbottom]{\color[white]{\scale[height=9pt]{\strut#1}}}} -\let\titlefont\relax +\let\TitleFont\relax \startmode[atpragma] \definefontfeature[default][method=node,script=latn,language=dflt,liga=yes,onum=yes,kern=yes] - \definedfont[palatinosanscom-regular*default at 12pt] \setupinterlinespace[line=15pt] - \definefont[titlefont][palatinosanscom-bold*default at 48pt] + \definefont[TitleFont][palatinosanscom-bold*default at 48pt] + \definefont[MainTextFont][palatinosanscom-regular*default at 12pt] \setupinterlinespace[line=15pt] + \appendtoks + \MainTextFont % hack, as we define a bodyfont at that point (better have a proper typeface) + \to \everystarttext \stopmode -\endinput +\doifnotmode{demo}{\endinput} -% \starttext +\starttext -% \SetBanner{tug 2007 san diego} +\usemodule[abr-01] -% \Title {hans hagen} +\SetBanner{tug 2007 san diego} -% \startstandardmakeup \titlefont \setupinterlinespace[line=3ex] \vfill +\Title {hans hagen} -% \StartItem \dontleavehmode \quad {\morecolor zapfino, a} \StopItem -% \StartItem \dontleavehmode \quad {\morecolor torture test} \StopItem -% \StartItem \dontleavehmode \quad {\morecolor for luatex} \StopItem +\startstandardmakeup \TitleFont \setupinterlinespace[line=3ex] \vfill -% \vfill \stopstandardmakeup +\StartItem \dontleavehmode \quad {\morecolor zapfino, a} \StopItem +\StartItem \dontleavehmode \quad {\morecolor torture test} \StopItem +\StartItem \dontleavehmode \quad {\morecolor for luatex} \StopItem -% \Title{loading fonts} +\vfill \stopstandardmakeup -% \StartSteps +\Title{loading fonts} -% \StartItem the \OPENTYPE\ font reader is borrowed from \FONTFORGE\ \FlushStep \StopItem -% \StartItem once it was ready, we could look into such a font \FlushStep \StopItem -% \StartItem it tooks while to figure out the format due to rather fuzzy specs \FlushStep \StopItem -% \StartItem it took us even more time to find out that the loader was flawed \FlushStep \StopItem -% \StartItem one reason was that fonts themselves may have bugs or be incomplete \FlushStep \StopItem -% \StartItem then we changed to \FONTFORGE\ version 2 \FlushStep \StopItem -% \StartItem this made the missing pieces surface in more complex feature handling \FlushStep \StopItem -% \StartItem while implementing features the new table format was cleaned up \FlushStep \StopItem +\StartSteps -% \StopSteps +\StartItem the \OPENTYPE\ font reader is borrowed from \FONTFORGE\ \FlushStep \StopItem +\StartItem once it was ready, we could look into such a font \FlushStep \StopItem +\StartItem it tooks while to figure out the format due to rather fuzzy specs \FlushStep \StopItem +\StartItem it took us even more time to find out that the loader was flawed \FlushStep \StopItem +\StartItem one reason was that fonts themselves may have bugs or be incomplete \FlushStep \StopItem +\StartItem then we changed to \FONTFORGE\ version 2 \FlushStep \StopItem +\StartItem this made the missing pieces surface in more complex feature handling \FlushStep \StopItem +\StartItem while implementing features the new table format was cleaned up \FlushStep \StopItem -% \stoptext +\StopSteps + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-pre-66.tex b/Master/texmf-dist/tex/context/base/s-pre-66.tex index 916a7de66b6..e085caedafd 100644 --- a/Master/texmf-dist/tex/context/base/s-pre-66.tex +++ b/Master/texmf-dist/tex/context/base/s-pre-66.tex @@ -131,3 +131,31 @@ \def\StopTitlePage {\stopstandardmakeup} + +\doifnotmode{demo} {\endinput} + +\starttext + +\StartTitlePage x\\y\\z \StopTitlePage + +\StartRemark{a} + a \FlushStep + a \FlushStep +\StopRemark + +\StartRemark{b} + b \FlushStep + b \FlushStep + b \FlushStep +\StopRemark + +\StartRemark{c} + c \FlushStep + c \FlushStep + c \FlushStep + c \FlushStep +\StopRemark + +\stoptext + + diff --git a/Master/texmf-dist/tex/context/base/s-pre-67.tex b/Master/texmf-dist/tex/context/base/s-pre-67.tex index 53c3260f59b..88043aa24a2 100644 --- a/Master/texmf-dist/tex/context/base/s-pre-67.tex +++ b/Master/texmf-dist/tex/context/base/s-pre-67.tex @@ -124,13 +124,13 @@ \def\titlepage#1#2% {\startstandardmakeup - \definefont[LargeFont][Normal at 120pt] + \definefont[LargeFont][Normal at 100pt] \setlayerframed [title] [preset=lefttop,x=1cm,y=.25cm] [align=flushleft,foregroundstyle=\LargeFont,offset=0pt,foregroundcolor=lightcolor,frame=off] {#1} - \definefont[SmallFont][Normal at 60pt] + \definefont[SmallFont][Normal at 50pt] \setlayerframed [title] [preset=rightbottom,x=1cm,y=.5cm] @@ -141,4 +141,15 @@ \let\Title\title \let\TitlePage\titlepage +\doifnotmode{demo}{\endinput} + +\starttext + \chapter{Test} + \startitemize + \startitem test \stopitem + \startitem test \stopitem + \startitem test \stopitem + \stopitemize +\stoptext + \endinput diff --git a/Master/texmf-dist/tex/context/base/s-pre-68.tex b/Master/texmf-dist/tex/context/base/s-pre-68.tex new file mode 100644 index 00000000000..616d410eb9c --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-pre-68.tex @@ -0,0 +1,150 @@ +%D \module +%D [ file=s-pre-68, +%D version=2009.08.28, +%D title=\CONTEXT\ Style File, +%D subtitle=Presentation Environment 68, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\usemodule[pre-60,abr-02] + +% style + +\setuppapersize + [S66][S66] + +\setuplayout + [height=middle, + width=middle, + header=0pt, + footer=0pt, + backspace=2cm, + topspace=2cm] + +\setupinteraction + [state=start, + click=no] + +\definecolor[maincolor][r=.4] + +\startreusableMPgraphic{page} + StartPage ; + fill Page enlarged 5mm withcolor \MPcolor{maincolor} ; + StopPage ; +\stopreusableMPgraphic + +\startreusableMPgraphic{next} + fill ultriangle scaled .15PaperWidth withcolor white ; +\stopreusableMPgraphic + +\startreusableMPgraphic{last} + fill boundingbox(ultriangle scaled .15PaperWidth) withcolor white ; +\stopreusableMPgraphic + +\startuniqueMPgraphic{bullit} + fill ultriangle scaled 2ExHeight withcolor white ; +\stopuniqueMPgraphic + +\definelayer + [extra] + [width=\paperwidth, + height=\paperheight] + +\defineoverlay + [page] + [\reuseMPgraphic{page}] + +\setupbackgrounds + [page] + [background={page,extra}] + +\setupcolors + [state=start, + textcolor=white] + +\setuphead + [chapter] + [style=\bfc] + +\definehead[Title][title] + +\definesymbol[MyBullet][\uniqueMPgraphic{bullit}] + +\setupitemgroup[itemize][each][symbol=MyBullet] + +\usetypescript[cambria] +\setupbodyfont[cambria,14.4pt] + +% interface + +\def\StartItems + {\begingroup + \StartSteps + \startitemize + \def\StartItems{\startitemize\def\StopItems{\stopitemize}}} + +\def\StopItems + {\FlushStep + \stopitemize + \NextPageSymbol + \StopSteps + \endgroup} + +\def\Item + {\def\Item{\FlushStep\item} + \item} + +\def\NextPageSymbol + {\setlayer + [extra] + [preset=rightbottom,offset=2mm] + {\ifnum\realpageno=\lastpage + \reuseMPgraphic{last}% + \else\ifnum\realpageno>1 + \reuseMPgraphic{next}% + \fi\fi + \FlushStep}} + +\def\TitlePage#1#2% + {\startstandardmakeup[bottom=,top=] + \scale[width=\textwidth]{\framed[align=flushleft,foregroundstyle=\bf,frame=off]{#1}} + \vfilll + \hfill\scale[width=.5\textwidth]{\framed[align=flushright,foregroundstyle=\bf,frame=off]{#2}} + \stopstandardmakeup} + +\doifnotmode{demo}{\endinput} + +\starttext + +\TitlePage{I'm running\\out of examples}{Hans Hagen\\Someplace, 2031} + +\Title{Alpha} + +\StartItems +\Item one +\Item two +\Item three +\StopItems + +\Title{Beta} + +\StartItems +\Item four +\Item five +\Item six +\StopItems + +\Title{Gamma} + +\StartItems +\Item seven +\Item eight +\Item nine +\StopItems + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-pre-69.mkiv b/Master/texmf-dist/tex/context/base/s-pre-69.mkiv new file mode 100644 index 00000000000..9cf6fdfd55a --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-pre-69.mkiv @@ -0,0 +1,335 @@ +%D \module +%D [ file=s-pre-69, +%D version=2010.04.28, +%D title=\CONTEXT\ Style File, +%D subtitle=Presentation Environment 69, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\setuppapersize[S6][S6] +\setuppapersize[SM][SM] + +\usemodule + [abr-01,pre-60] + +\setupinteraction + [state=start, + contrastcolor=white, + color=white, + click=no] + +\setuplayout + [location=middle, + topspace=60pt, + bottomspace=80pt, + backspace=80pt, + header=0pt, + footer=0pt, + width=middle, + height=middle] + +\setupcolors + [textcolor=white] + +\setupbodyfont[euler] + +\definecolor[maincolor] [blue] +\definecolor[extracolor][green] + +% \definecolor[maincolor] [red] +% \definecolor[extracolor][blue] + +\startMPinitializations + if unknown MyColor[1] : + color MyColor[] ; + MyColor[1] := transparent(1,.25,\MPcolor{maincolor}) ; + MyColor[2] := transparent(1,.25,\MPcolor{extracolor}) ; + + picture MySoFar ; MySoFar := nullpicture ; + path MyLastOne ; MyLastOne := origin -- cycle ; + color MyPageColor ; MyPageColor := MyColor[1] ; + path MyLeftSteps, MyRightSteps ; + boolean MyPageDone ; MyPageDone := false ; + + vardef MySmallShape(expr parent) = + path p ; p := boundingbox parent ; + p := boundingbox parent ; + numeric w, h ; w := bbwidth(p) ; h := bbheight(p) ; + urcorner p shifted (-uniformdeviate w/4,0) -- + lrcorner p shifted (0,uniformdeviate h/4) -- + llcorner p shifted (uniformdeviate w/4,0) -- + ulcorner p shifted (0,-uniformdeviate h/4) -- cycle + enddef ; + + vardef MyShape(expr parent) = + path p ; p := boundingbox parent ; + if MyPageDone : + MyPageDone := false ; + urcorner p shifted (-EmWidth + -uniformdeviate CutSpace/2,0) -- + lrcorner p shifted (0,EmWidth + uniformdeviate BottomSpace/2) -- + llcorner p shifted (EmWidth + uniformdeviate BackSpace/2,0) -- + ulcorner p shifted (0,-EmWidth + -uniformdeviate TopSpace/2) -- cycle + else : + MyPageDone := true ; + urcorner p shifted (0,-EmWidth + -uniformdeviate TopSpace/2) -- + lrcorner p shifted (-EmWidth + -uniformdeviate CutSpace/2,0) -- + llcorner p shifted (0,EmWidth + uniformdeviate BottomSpace/2) -- + ulcorner p shifted (EmWidth + uniformdeviate BackSpace/2,0) -- cycle + fi + enddef ; + + vardef MyMakeOne = + MyLastOne := MyShape(Page) ; + enddef ; + + vardef MyAddOne = + addto MySoFar also image(fill MyLastOne withcolor MyPageColor ; ) ; + enddef ; + + vardef MyDrawOne = + fill MyLastOne withcolor black ; + fill MyLastOne withcolor MyPageColor ; + enddef ; + + vardef MyDrawPage = + draw MySoFar ; + enddef ; + + vardef MySetSteps = + path l, r ; numeric s ; path ll[], rr[] ; path t ; + l := point 2 of MyLastOne -- point 3 of MyLastOne ; + r := point 0 of MyLastOne -- point 1 of MyLastOne ; + t := topboundary Field[Text][Text] rightenlarged TextWidth leftenlarged TextWidth ; + s := bbheight(Field[Text][Text])/LineHeight + 2 ; + t := t shifted (0,-TopSkip) ; + for i=1 upto s : + ll[i] := t intersectionpoint l ; + rr[i] := t intersectionpoint r ; + t := t shifted (0,-LineHeight) ; + endfor ; + MyLeftSteps := for i=1 upto s : ll[i] -- endfor cycle ; + MyRightSteps := for i=1 upto s : rr[i] -- endfor cycle ; + enddef ; + + vardef MyDrawText(expr txt) = + pair a ; a := (point 1 of MyLastOne) - (point 2 of MyLastOne) ; + picture p ; p := txt ; + p := p + shifted (-EmWidth,EmWidth) + shifted ulcorner txt + shifted point 1 of MyLastOne ; + p := p rotatedaround(lrcorner p, radian * tan(ypart a/xpart a)) ; + setbounds p to origin -- cycle ; + draw p ; + enddef ; + + vardef MyDrawTitle(expr txt) = + % pair a ; a := (point 2 of MyLastOne) - (point 3 of MyLastOne) ; + pair a ; a := (point 3 of MyLastOne) - (point 4 of MyLastOne) ; + picture p ; + if bbheight(txt) > bbwidth(txt) : + p := txt ysized(0.8*TextHeight) ; + else : + p := txt xsized(0.8*TextWidth) ; + fi ; + numeric d ; d := arclength(point 2 of MyLastOne -- point 3 of MyLastOne) - bbheight(p) ; + p := p + shifted (BackSpace,-d/2) + shifted -ulcorner p + shifted point 3 of MyLastOne ; + % p := p rotatedaround(ulcorner p, - radian * tan(xpart a/ypart a)) ; + % p := p rotatedaround(ulcorner p, radian * tan(ypart a/xpart a)) ; + setbounds p to origin -- cycle ; + draw p ; + enddef ; + + vardef MyDrawSteps = + s := bbheight(Field[Text][Text])/LineHeight + 2 ; + for i=1 upto s : + draw ll[i] withpen pencircle scaled 1mm ; + draw rr[i] withpen pencircle scaled 1mm ; + draw ll[i] -- rr[i] ; + endfor ; + draw Field[Text][Text] ; + enddef ; + + fi ; +\stopMPinitializations + +\startuseMPgraphic{initialization} + StartPage ; + MySoFar := image(fill Page enlarged 12pt withcolor MyPageColor) ; + MyMakeOne ; + MySetSteps ; + StopPage ; +\stopuseMPgraphic + +\appendtoks + \startnointerference + \useMPgraphic{initialization} + \stopnointerference +\to \everystarttext + +\startuseMPgraphic{page} + StartPage ; + MyDrawPage ; + MyDrawOne ; + MySetSteps ; + MyDrawTitle(textext("\getvariable{document}{title}")) ; + MyDrawText(textext("\getvariable{document}{topic}")) ; + % + % we have multiple runs when we have text + % +% MyDrawSteps ; +% MyMakeOne ; +% MySetSteps ; + StopPage ; +\stopuseMPgraphic + +\appendtoks + \startnointerference + \startMPcode + MyAddOne ; + MyMakeOne ; + MySetSteps ; + \stopMPcode + \stopnointerference +\to \everyshipout + +\defineoverlay[page][\useMPgraphic{page}] + +\startuseMPgraphic{symbol} + color cc ; cc := MyColor[2] ; + path p ; p := MySmallShape(unitsquare scaled (.6*LineHeight)) ; + fill p withcolor white ; + fill p withcolor cc ; +\stopuseMPgraphic + +\definesymbol[mysymbol][\struttedbox{\useMPgraphic{symbol}}] + +\setupitemgroup[itemize][1][symbol=mysymbol] + +\setupbackgrounds + [page] + [background=page] + +\startluacode + local texdimen = tex.dimen + function document.SetParShape() + local leftpath = metapost.getclippath("metafun","metafun","clip currentpicture to MyLeftSteps ;") + local rightpath = metapost.getclippath("metafun","metafun","clip currentpicture to MyRightSteps ;") + local shape = { } + for i=1,#leftpath do + local left = leftpath[i].x_coord + local right = rightpath[i].x_coord + local hsize = right - left - (texdimen.backspace + texdimen.cutspace)*number.dimenfactors.bp + shape[#shape+1] = string.format("%sbp %sbp",left,hsize) + end + -- print(table.serialize(shape)) + tex.sprint(tex.ctxcatcodes,string.format("\\parshape %s %s",#shape,table.concat(shape," "))) + end +\stopluacode + +\nopenalties \dontcomplain + +\setupwhitespace[none] + +\def\StartText#1#2% + {\starttext + \setvariable{document}{title}{\framed[frame=off,offset=0pt,align=flushleft,foregroundstyle=\tfd\setupinterlinespace]{\begstrut#1\endstrut}} + \setvariable{document}{topic}{\tfb#2} + \startstandardmakeup + % dummy page + \stopstandardmakeup + \setvariable{document}{title}{} + \setvariable{document}{topic}{}} + +\def\StopText + {\stoptext} + +\def\StartItems#1% + {\setvariable{document}{topic}{\tfb#1} + \startstandardmakeup[top=,bottom=\vss] + \startelement[items][title={#1}]% + \ctxlua{document.SetParShape()} + \StartSteps} + +\def\StopItems + {\StopSteps + \stopelement + \stopstandardmakeup} + +\def\StartItem + {\dontleavehmode + \startelement[item]% + \llap{\symbol[mysymbol]\quad}% graphic + \ignorespaces} + +\def\StopItem + {\removeunwantedspaces + \nobreak + \crlf + \stopelement + \crlf + \FlushStep} + +\def\ShapeParagraph + {\ctxlua{document.SetParShape()}} + +% no parshape yet + +\def\StartParagraphs#1% + {\setvariable{document}{topic}{\tfb#1} + \startstandardmakeup[top=,bottom=\vss] + %\ctxlua{document.SetParShape()} + \startelement[paragraphs]% + \StartSteps} + +\def\StopParagraphs + {\StopSteps + \stopelement + \stopstandardmakeup} + +\def\StartParagraph + {\startelement[paragraph]} + +\def\StopParagraph + {\par + \stopelement + \FlushStep} + +% experiment .. likely to change + +\setelementexporttag[items] [nature][display] +\setelementexporttag[item] [nature][mixed] +\setelementexporttag[paragraphs][nature][display] +\setelementexporttag[paragraph] [nature][mixed] + +\doifnotmode{demo}{\endinput} + +% finetuning: \StartText{\TEX\ and Reality\vskip2exClashing Mindsets?\vskip1ex}{Bacho\TEX, May 1, 2010} + +\StartText{Just\\A Demo}{Bacho\TEX, May 1, 2010} + +\StartItems{Quote from Tufte and Ward} + \StartItem + \input tufte + \StopItem + \StartItem + \input ward + \StopItem +\StopItems + +% \dorecurse{20}{ +% \ctxlua{document.SetParShape()} +% \input tufte +% \page +% } + +\StopText + diff --git a/Master/texmf-dist/tex/context/base/s-pre-70.mkiv b/Master/texmf-dist/tex/context/base/s-pre-70.mkiv new file mode 100644 index 00000000000..60462cf7a9b --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-pre-70.mkiv @@ -0,0 +1,172 @@ +%D \module +%D [ file=s-pre-70, +%D version=2008.04.15, +%D title=\CONTEXT\ Style File, +%D subtitle=Presentation Environment 70, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA / Hans Hagen] +%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 At the cost of more runtime and a larger output file, we +%D turn on randomization. The instances are cached in the +%D MkIV cache, so successive runs use the same shapes. + +% \usemodule[punk] \usetypescript[punk] \setupbodyfont[punk,20pt] +% +% \EnableRandomPunk + +\setupbodyfont[punknova,20pt] % we now use the opentype variant + +%D We use the regular screen size paper and layout setup. + +\setuppapersize + [S6][S6] + +\setuplayout + [topspace=30pt, + backspace=30pt, + width=middle, + height=fit, + header=0pt, + footer=0pt, + bottomdistance=24pt, + bottom=30pt, + bottom=18pt, + top=0pt] + +\setupinterlinespace + [top=height, + line=1.25\bodyfontsize] + +\setupcolors + [state=start, + textcolor=white] + +\setupinteraction + [state=start, + %click=off, + menu=on] + +%D We predefine a few palets. Of course you can define more. + +\definecolor[punkblue] [r=.4,b=.8,g=.4] +\definecolor[punkgreen] [r=.4,b=.4,g=.8] +\definecolor[punkred] [r=.8,b=.4,g=.4] +\definecolor[punkyellow][r=.6,g=.6,b=.2] + +\definepalet [punk-one] [textcolor=punkblue,pagecolor=punkgreen] +\definepalet [punk-two] [textcolor=punkred,pagecolor=punkyellow] +\definepalet [punk-three] [textcolor=punkblue,pagecolor=punkyellow] +\definepalet [punk-one-reverse] [textcolor=punkgreen,pagecolor=punkblue] +\definepalet [punk-two-reverse] [textcolor=punkyellow,pagecolor=punkred] +\definepalet [punk-three-reverse] [textcolor=punkyellow,pagecolor=punkblue] + +\setuppalet[punk-one] + +%D We use a few backgrounds. The hyperlink that invokes the +%D stepper is hooked into the text background. + +\definelayer + [page] + [width=\paperwidth, + height=\paperheight] + +\setupbackgrounds + [page] + [background={color,page}, + backgroundcolor=pagecolor, + setups=pagestuff] + +\setupbackgrounds + [text] + [background={color,invoke}, + backgroundoffset=12pt, + backgroundcolor=textcolor] + +%D We need different symbols for itemized lists. + +\definesymbol[1][\hbox{\lower1ex\hbox{*}}] +\definesymbol[2][\endash] +\definesymbol[3][\letterhash] +\definesymbol[3][>] + +%D We don't want these reversed clicked areas in Acrobat. + +\setupinteraction + [click=no, + color=white, % pagecolor, + contrastcolor=white] % pagecolor, + +%D We define a rather simple navigational panel at the +%D bottom + +\setupinteractionmenu + [bottom] + [color=white, % pagecolor, + contrastcolor=white, % pagecolor, + background=color, + backgroundcolor=textcolor, + frame=off, + height=24pt, + left=\hfill, + middle=\hskip12pt] + +\setupsubpagenumber + [state=start] + +\startinteractionmenu[bottom] + \txt + \interactionbar + [alternative=d, + symbol=yes, + color=white, + contrastcolor=textcolor] + \\ + \hfilll + \but [previouspage] < < < \\ + \but [nextpage] > > > \\ +\stopinteractionmenu + +%D Instead of the normal symbols we use more punky ones. + +\startsymbolset [punk] + \definesymbol[previous] [\string<\string<] + \definesymbol[somewhere] [\string^\string^] + \definesymbol[next] [\string>\string>] +\stopsymbolset + +\setupinteraction[symbolset=punk] + +%D Because the font is rather large, we use less whitespace. + +\setuphead + [chapter] + [after={\blank[big]}] + +%D Run this file with the command: \type {context --mode=demo s-pre-70} +%D in order to get an example. + +\doifnotmode{demo} {\endinput} + +\usemodule[pre-60] % use the stepper + +\starttext + +\title {Punk for dummies} + +\dorecurse{10} { + \title{Just a few dummy pages} + \StartSteps \startitemize[packed] + \startitemize + \startitem bla \FlushStep \stopitem + \startitem bla bla \FlushStep \stopitem + \startitem bla bla bla \FlushStep \stopitem + \startitem bla bla bla bla \FlushStep \stopitem + \stopitemize \StopSteps +} + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-pre-70.tex b/Master/texmf-dist/tex/context/base/s-pre-70.tex deleted file mode 100644 index 1a842388b0e..00000000000 --- a/Master/texmf-dist/tex/context/base/s-pre-70.tex +++ /dev/null @@ -1,170 +0,0 @@ -% engine=luatex - -%D \module -%D [ file=s-pre-70, -%D version=2008.04.15, -%D title=\CONTEXT\ Style File, -%D subtitle=Presentation Environment 70, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright=PRAGMA / Hans Hagen] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\usemodule[punk] \usetypescript[punk] \setupbodyfont[punk,20pt] - -%D At the cost of more runtime and a larger output file, we -%D turn on randomization. The instances are cached in the -%D MkIV cache, so successive runs use the same shapes. - -\EnableRandomPunk - -%D We use the regular screen size paper and layout setup. - -\setuppapersize - [S6][S6] - -\setuplayout - [topspace=30pt, - backspace=30pt, - width=middle, - height=fit, - header=0pt, - footer=0pt, - bottomdistance=24pt, - bottom=30pt, - bottom=18pt, - top=0pt] - -\setupinterlinespace - [top=height, - line=1.25\bodyfontsize] - -\setupcolors - [state=start, - textcolor=white] - -\setupinteraction - [state=start, - %click=off, - menu=on] - -%D We predefine a few palets. Of course you can define more. - -\definecolor[punkblue] [r=.4,b=.8,g=.4] -\definecolor[punkgreen] [r=.4,b=.4,g=.8] -\definecolor[punkred] [r=.8,b=.4,g=.4] -\definecolor[punkyellow][r=.6,g=.6,b=.2] - -\definepalet [punk-one] [textcolor=punkblue,pagecolor=punkgreen] -\definepalet [punk-two] [textcolor=punkred,pagecolor=punkyellow] -\definepalet [punk-three] [textcolor=punkblue,pagecolor=punkyellow] -\definepalet [punk-one-reverse] [textcolor=punkgreen,pagecolor=punkblue] -\definepalet [punk-two-reverse] [textcolor=punkyellow,pagecolor=punkred] -\definepalet [punk-three-reverse] [textcolor=punkyellow,pagecolor=punkblue] - -\setuppalet[punk-one] - -%D We use a few backgrounds. The hyperlink that invokes the -%D stepper is hooked into the text background. - -\definelayer - [page] - [width=\paperwidth, - height=\paperheight] - -\setupbackgrounds - [page] - [background={color,page}, - backgroundcolor=pagecolor, - setups=pagestuff] - -\setupbackgrounds - [text] - [background={color,invoke}, - backgroundoffset=12pt, - backgroundcolor=textcolor] - -%D We need different symbols for itemized lists. - -\definesymbol[1][\hbox{\lower1ex\hbox{*}}] -\definesymbol[2][\endash] -\definesymbol[3][\letterhash] -\definesymbol[3][>] - -%D We don't want these reversed clicked areas in Acrobat. - -\setupinteraction - [click=no] - -%D We define a rather simple navigational panel at the -%D bottom - -\setupinteractionmenu - [bottom] - [color=white, % pagecolor, - contrastcolor=white, % pagecolor, - background=color, - backgroundcolor=textcolor, - frame=off, - height=24pt, - left=\hfill, - middle=\hskip12pt] - -\setupsubpagenumber - [state=start] - -\startinteractionmenu[bottom] - \txt - \interactionbar - [alternative=d, - symbol=yes, - color=white, - contrastcolor=textcolor] - \\ - \hfilll - \but [previouspage] < < < \\ - \but [nextpage] > > > \\ -\stopinteractionmenu - -%D Instead of the normal symbols we use more punky ones. - -\startsymbolset [punk] - \definesymbol[previous] [\string<\string<] - \definesymbol[somewhere] [\string^\string^] - \definesymbol[next] [\string>\string>] -\stopsymbolset - -\setupinteraction[symbolset=punk] - -%D Because the font is rather large, we use less whitespace. - -\setuphead - [chapter] - [after={\blank[big]}] - -%D Run this file with the command: \type {context --mode=demo s-pre-70} -%D in order to get an example. - -\doifnotmode{demo} {\endinput} - -\usemodule[pre-60] % use the stepper - -\starttext - -\title {Punk for dummies} - -\dorecurse{10} { - \title{Just a few dummy pages} - \StartSteps \startitemize[packed] - \startitemize - \startitem bla \FlushStep \stopitem - \startitem bla bla \FlushStep \stopitem - \startitem bla bla bla \FlushStep \stopitem - \startitem bla bla bla bla \FlushStep \stopitem - \stopitemize \StopSteps -} - -\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-pre-71.lua b/Master/texmf-dist/tex/context/base/s-pre-71.lua new file mode 100644 index 00000000000..bfa45a70578 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-pre-71.lua @@ -0,0 +1,63 @@ +if not modules then modules = { } end modules ['steps'] = { + version = 1.001, + comment = "companion to steps.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +moduledata.steps = moduledata.steps or { } +local steps = moduledata.steps + +local locations = { + 'lefttop', + 'middletop', + 'righttop', + 'middleleft', + 'middle', + 'middleright', + 'leftbottom', + 'middlebottom', + 'rightbottom', +} + +local done, current, previous, n + +function steps.reset_locations() + done, current, previous, n = table.tohash(locations,false), 0, 0, 0 +end + +function steps.next_location(loc) + previous = current + n = n + 1 + loc = loc and loc ~= "" and tonumber(loc) + while true do + current = loc or math.random(1,#locations) + if not done[current] then + done[current] = true + break + end + end +end + +function steps.current_location() + context(locations[current] or "") +end + +function steps.previous_location() + context(locations[previous] or "") +end + +function steps.current_n() + context(current) +end + +function steps.previous_n() + context(previous) +end + +function steps.step() + context(n) +end + +steps.reset_locations() diff --git a/Master/texmf-dist/tex/context/base/s-pre-71.mkii b/Master/texmf-dist/tex/context/base/s-pre-71.mkii new file mode 100644 index 00000000000..db65c8e2819 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-pre-71.mkii @@ -0,0 +1,213 @@ +% engine=luatex + +%D \module +%D [ file=s-pre-71, +%D version=2008.08.05, +%D title=\CONTEXT\ Style File, +%D subtitle=Presentation Environment 71, +%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 I might improve this module so consider it experimental. + +% \enablemode[numbers] +% \enablemode[paper] + +\usemodule[pre-60,abr-02] + +\setupinteraction[state=start,click=off] + +\definepapersize[wide][width=900pt,height=600pt] + +\setuppapersize[wide][wide] + +\setuplayout[page] + +% \setupbodyfont[15pt] + +\usetypescriptfile[type-hgz] +\usetypescript[palatino-informal] +\setupbodyfont[palatino-informal,15pt] + +\setupsorting[logo][style=] + +\startnotmode[paper] + \setupbackgrounds[page][background=color,backgroundcolor=black] +\stopnotmode + +\TransparencyHack + +\definelayer[page][width=\paperwidth,height=\paperheight] + +\definecolor[TopicColor-1][r=.3,g=.4,b=.5] +\definecolor[TopicColor-2][r=.3,g=.5,b=.4] +\definecolor[TopicColor-3][r=.4,g=.3,b=.5] +\definecolor[TopicColor-4][r=.4,g=.5,b=.3] +\definecolor[TopicColor-5][r=.5,g=.3,b=.4] +\definecolor[TopicColor-6][r=.5,g=.4,b=.3] +\definecolor[TopicColor-7][r=.35,g=.35,b=.6] +\definecolor[TopicColor-8][r=.6,g=.35,b=.35] +\definecolor[TopicColor-9][r=.35,g=.6,b=.35] + +\definecolor[TopicColor-0][t=.5,a=1,s=.5] +\definecolor[TopicColor] [s=1] + +\setupcolors[state=start] +\setupcolors[textcolor=TopicColor] + +\startluacode + local locations = { + 'lefttop', + 'middletop', + 'righttop', + 'middleleft', + 'middle', + 'middleright', + 'leftbottom', + 'middlebottom', + 'rightbottom', + } + local done, current, previous, n = table.tohash(locations,false), 0, 0, 0 + function document.reset_locations() + done, current, previous, n = table.tohash(locations,false), 0, 0, 0 + end + function document.next_location(loc) + previous = current + n = n + 1 + loc = loc and loc ~= "" and tonumber(loc) + while true do + current = loc or math.random(1,#locations) + if not done[current] then + done[current] = true + break + end + end + end + function document.current_location() + tex.print(locations[current] or "") + end + function document.previous_location() + tex.print(locations[previous] or "") + end + function document.current_n() + tex.print(tostring(current)) + end + function document.previous_n() + tex.print(tostring(previous)) + end + function document.step() + tex.print(tostring(n)) + end +\stopluacode + +\def\StartTopics + {\startstandardmakeup + \ctxlua{document.reset_locations()} + \doifnotmode{paper}{\StartLocalSteps}} + +\def\StopTopics + {\doifnotmode{paper}{\StopLocalSteps} + \flushlayer[page] + \stopstandardmakeup} + +\def\StartTopic + {\dosingleempty\doStartTopic} + +\def\doStartTopic[#1]% + {\doifnotmode{paper}{\NextStep} + \ctxlua{document.next_location("#1")} + \startnotmode[paper] + \doifnothing{#1} + {\ifcase\ctxlua{document.previous_n()}\else + \setlayer + [page] + [preset=\ctxlua{document.previous_location()}] + \bgroup + \doifnotmode{paper}{\startproperty[\StepLayer]}% + \framed + [offset=20pt, + strut=no, + align=normal, + frame=off, + height=\dimexpr\paperheight/3\relax, + width=\dimexpr\paperwidth/3\relax, + background=color, + backgroundcolor=TopicColor-0] + {}% + \doifnotmode{paper}{\stopproperty}% + \egroup + \fi} + \stopnotmode + \setlayer + [page] + [preset=\ctxlua{document.current_location()}] + \bgroup + \doifnotmode{paper}{\startproperty[\StepLayer]}% + \framed + [offset=20pt, + strut=no, + align=\expdoifelse{#1}{}{normal}{middle,lohi}, + align=\expdoifelse{#1}{}{flushleft,verytolerant}{middle,lohi}, + frame=off, + height=\dimexpr\paperheight/3\relax, + width=\dimexpr\paperwidth/3\relax, + background=color, + backgroundcolor=TopicColor-\ctxlua{document.current_n()}] + \bgroup + \ignorespaces} + +\def\StopTopic + {\removeunwantedspaces + \egroup + \doifnotmode{paper}{\stopproperty}% + \egroup + \startmode[numbers] + \setlayerframed + [page] + [preset=\ctxlua{document.current_location()}] + [height=\dimexpr\paperheight/3\relax, + width=\dimexpr\paperwidth/3\relax, + frame=off, + foregroundstyle=\bfa, + align={flushright,low}] + {\doifnotmode{paper}{\startproperty[\StepLayer]}% + \ctxlua{document.step()}\kern\strutdepth + \doifnotmode{paper}{\stopproperty}} + \stopmode} + +\logo [METAPOST] {MetaPost} + +\definefont[TitleFont][SansBold at 60pt] +\definefont[TempFont] [SansBold at 12pt] + +\let\StartText\starttext +\let\StopText \stoptext + +\doifnotmode{demo}{\endinput} + +\starttext + +\StartTopics + \StartTopic[1] A \StopTopic + \StartTopic[5] B \StopTopic + \StartTopic[9] C \StopTopic +\StopTopics + +\StartTopics + \StartTopic A \StopTopic + \StartTopic B \StopTopic + \StartTopic C \StopTopic + \StartTopic D \StopTopic + \StartTopic E \StopTopic + \StartTopic F \StopTopic + \StartTopic G \StopTopic + \StartTopic H \StopTopic + \StartTopic I \StopTopic +\StopTopics + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-pre-71.mkiv b/Master/texmf-dist/tex/context/base/s-pre-71.mkiv new file mode 100644 index 00000000000..69280243b55 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-pre-71.mkiv @@ -0,0 +1,170 @@ +% engine=luatex + +%D \module +%D [ file=s-pre-71, +%D version=2008.08.05, +%D title=\CONTEXT\ Style File, +%D subtitle=Presentation Environment 71, +%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 I might improve this module so consider it experimental. + +% \enablemode[numbers] +% \enablemode[paper] + +\usemodule[pre-60,abr-02] + +\registerctxluafile{s-pre-71}{} + +\setupinteraction[state=start,click=off] + +\definepapersize[wide][width=900pt,height=600pt] + +\setuppapersize[wide][wide] + +\setuplayout[page] + +% \setupbodyfont[15pt] + +\usetypescriptfile[type-hgz] +\usetypescript[palatino-informal] +\setupbodyfont[palatino-informal,15pt] + +\setupsorting[logo][style=] + +\startnotmode[paper] + \setupbackgrounds[page][background=color,backgroundcolor=black] +\stopnotmode + +\TransparencyHack + +\definelayer[page][width=\paperwidth,height=\paperheight] + +\definecolor[TopicColor-1][r=.3,g=.4,b=.5] +\definecolor[TopicColor-2][r=.3,g=.5,b=.4] +\definecolor[TopicColor-3][r=.4,g=.3,b=.5] +\definecolor[TopicColor-4][r=.4,g=.5,b=.3] +\definecolor[TopicColor-5][r=.5,g=.3,b=.4] +\definecolor[TopicColor-6][r=.5,g=.4,b=.3] +\definecolor[TopicColor-7][r=.35,g=.35,b=.6] +\definecolor[TopicColor-8][r=.6,g=.35,b=.35] +\definecolor[TopicColor-9][r=.35,g=.6,b=.35] + +\definecolor[TopicColor-0][t=.5,a=1,s=.5] +\definecolor[TopicColor] [s=1] + +\setupcolors[state=start] +\setupcolors[textcolor=TopicColor] + +\def\StartTopics + {\startstandardmakeup + \ctxlua{moduledata.steps.reset_locations()} + \doifnotmode{paper}{\StartLocalSteps}} + +\def\StopTopics + {\doifnotmode{paper}{\StopLocalSteps} + \flushlayer[page] + \stopstandardmakeup} + +\def\StartTopic + {\dosingleempty\doStartTopic} + +\def\doStartTopic[#1]% + {\doifnotmode{paper}{\NextStep} + \ctxlua{moduledata.steps.next_location("#1")} + \startnotmode[paper] + \doifnothing{#1} + {\ifcase\ctxlua{moduledata.steps.previous_n()}\else + \setlayer + [page] + [preset=\ctxlua{moduledata.steps.previous_location()}] + \bgroup + \doifnotmode{paper}{\startviewerlayer[\StepLayer]}% + \framed + [offset=20pt, + strut=no, + align=normal, + frame=off, + height=\dimexpr\paperheight/3\relax, + width=\dimexpr\paperwidth/3\relax, + background=color, + backgroundcolor=TopicColor-0] + {}% + \doifnotmode{paper}{\stopviewerlayer}% + \egroup + \fi} + \stopnotmode + \setlayer + [page] + [preset=\ctxlua{moduledata.steps.current_location()}] + \bgroup + \doifnotmode{paper}{\startviewerlayer[\StepLayer]}% + \framed + [offset=20pt, + strut=no, + align=\expdoifelse{#1}{}{normal}{middle,lohi}, + align=\expdoifelse{#1}{}{flushleft,verytolerant}{middle,lohi}, + frame=off, + height=\dimexpr\paperheight/3\relax, + width=\dimexpr\paperwidth/3\relax, + background=color, + backgroundcolor=TopicColor-\ctxlua{moduledata.steps.current_n()}] + \bgroup + \ignorespaces} + +\def\StopTopic + {\removeunwantedspaces + \egroup + \doifnotmode{paper}{\stopviewerlayer}% + \egroup + \startmode[numbers] + \setlayerframed + [page] + [preset=\ctxlua{moduledata.steps.current_location()}] + [height=\dimexpr\paperheight/3\relax, + width=\dimexpr\paperwidth/3\relax, + frame=off, + foregroundstyle=\bfa, + align={flushright,low}] + {\doifnotmode{paper}{\startviewerlayer[\StepLayer]}% + \ctxlua{moduledata.steps.step()}\kern\strutdepth + \doifnotmode{paper}{\stopviewerlayer}} + \stopmode} + +\logo [METAPOST] {MetaPost} + +\definefont[TitleFont][SansBold at 60pt] +\definefont[TempFont] [SansBold at 12pt] + +\let\StartText\starttext +\let\StopText \stoptext + +\doifnotmode{demo}{\endinput} + +\starttext + +\StartTopics + \StartTopic[1] A \StopTopic + \StartTopic[5] B \StopTopic + \StartTopic[9] C \StopTopic +\StopTopics + +\StartTopics + \StartTopic A \StopTopic + \StartTopic B \StopTopic + \StartTopic C \StopTopic + \StartTopic D \StopTopic + \StartTopic E \StopTopic + \StartTopic F \StopTopic + \StartTopic G \StopTopic + \StartTopic H \StopTopic + \StartTopic I \StopTopic +\StopTopics + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-pre-71.tex b/Master/texmf-dist/tex/context/base/s-pre-71.tex deleted file mode 100644 index 91075d54d37..00000000000 --- a/Master/texmf-dist/tex/context/base/s-pre-71.tex +++ /dev/null @@ -1,210 +0,0 @@ -% engine=luatex - -%D \module -%D [ file=s-pre-71, -%D version=2008.08.05, -%D title=\CONTEXT\ Style File, -%D subtitle=Presentation Environment 71, -%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 I might improve this module so consider it experimental. - -% \enablemode[numbers] -% \enablemode[paper] - -\usemodule[pre-60,abr-02] - -\setupinteraction[state=start,click=off] - -\definepapersize[wide][width=900pt,height=600pt] - -\setuppapersize[wide][wide] - -\setuplayout[page] - -% \setupbodyfont[15pt] - -\usetypescriptfile[type-hgz] -\usetypescript[palatino-informal] -\setupbodyfont[palatino-informal,15pt] - -\setupsorting[logo][style=] - -\startnotmode[paper] - \setupbackgrounds[page][background=color,backgroundcolor=black] -\stopnotmode - -\TransparencyHack - -\definelayer[page][width=\paperwidth,height=\paperheight] - -\definecolor[TopicColor-1][r=.3,g=.4,b=.5] -\definecolor[TopicColor-2][r=.3,g=.5,b=.4] -\definecolor[TopicColor-3][r=.4,g=.3,b=.5] -\definecolor[TopicColor-4][r=.4,g=.5,b=.3] -\definecolor[TopicColor-5][r=.5,g=.3,b=.4] -\definecolor[TopicColor-6][r=.5,g=.4,b=.3] -\definecolor[TopicColor-7][r=.35,g=.35,b=.6] -\definecolor[TopicColor-8][r=.6,g=.35,b=.35] -\definecolor[TopicColor-9][r=.35,g=.6,b=.35] - -\definecolor[TopicColor-0][t=.5,a=1,s=.5] -\definecolor[TopicColor] [s=1] - -\setupcolors[state=start] -\setupcolors[textcolor=TopicColor] - -\startluacode - local locations = { - 'lefttop', - 'middletop', - 'righttop', - 'middleleft', - 'middle', - 'middleright', - 'leftbottom', - 'middlebottom', - 'rightbottom', - } - local done, current, previous, n = table.tohash(locations,false), 0, 0, 0 - function document.reset_locations() - done, current, previous, n = table.tohash(locations,false), 0, 0, 0 - end - function document.next_location(loc) - previous = current - n = n + 1 - loc = loc and loc ~= "" and tonumber(loc) - while true do - current = loc or math.random(1,#locations) - if not done[current] then - done[current] = true - break - end - end - end - function document.current_location() - tex.print(locations[current] or "") - end - function document.previous_location() - tex.print(locations[previous] or "") - end - function document.current_n() - tex.print(tostring(current)) - end - function document.previous_n() - tex.print(tostring(previous)) - end - function document.step() - tex.print(tostring(n)) - end -\stopluacode - -\def\StartTopics - {\startstandardmakeup - \ctxlua{document.reset_locations()} - \doifnotmode{paper}{\StartLocalSteps}} - -\def\StopTopics - {\doifnotmode{paper}{\StopLocalSteps} - \flushlayer[page] - \stopstandardmakeup} - -\def\StartTopic - {\dosingleempty\doStartTopic} - -\def\doStartTopic[#1]% - {\doifnotmode{paper}{\NextStep} - \ctxlua{document.next_location("#1")} - \startnotmode[paper] - \doifnothing{#1} - {\ifcase\ctxlua{document.previous_n()}\else - \setlayer - [page] - [preset=\ctxlua{document.previous_location()}] - \bgroup - \doifnotmode{paper}{\startproperty[\StepLayer]}% - \framed - [offset=20pt, - strut=no, - align=normal, - frame=off, - height=\dimexpr\paperheight/3\relax, - width=\dimexpr\paperwidth/3\relax, - background=color, - backgroundcolor=TopicColor-0] - {}% - \doifnotmode{paper}{\stopproperty}% - \egroup - \fi} - \stopnotmode - \setlayer - [page] - [preset=\ctxlua{document.current_location()}] - \bgroup - \doifnotmode{paper}{\startproperty[\StepLayer]}% - \framed - [offset=20pt, - strut=no, - align=\expdoifelse{#1}{}{normal}{middle,lohi}, - align=\expdoifelse{#1}{}{flushleft,verytolerant}{middle,lohi}, - frame=off, - height=\dimexpr\paperheight/3\relax, - width=\dimexpr\paperwidth/3\relax, - background=color, - backgroundcolor=TopicColor-\ctxlua{document.current_n()}] - \bgroup - \ignorespaces} - -\def\StopTopic - {\removeunwantedspaces - \egroup - \doifnotmode{paper}{\stopproperty}% - \egroup - \startmode[numbers] - \setlayerframed - [page] - [preset=\ctxlua{document.current_location()}] - [height=\dimexpr\paperheight/3\relax, - width=\dimexpr\paperwidth/3\relax, - frame=off, - foregroundstyle=\bfa, - align={flushright,low}] - {\doifnotmode{paper}{\startproperty[\StepLayer]}% - \ctxlua{document.step()}\kern\strutdepth - \doifnotmode{paper}{\stopproperty}} - \stopmode} - -\logo [METAPOST] {MetaPost} - -\definefont[TitleFont][SansBold at 60pt] -\definefont[TempFont] [SansBold at 12pt] - -\doifnotmode{demo}{\endinput} - -\starttext - -\StartTopics - \StartTopic[1] A \StopTopic - \StartTopic[5] B \StopTopic - \StartTopic[9] C \StopTopic -\StopTopics - -\StartTopics - \StartTopic A \StopTopic - \StartTopic B \StopTopic - \StartTopic C \StopTopic - \StartTopic D \StopTopic - \StartTopic E \StopTopic - \StartTopic F \StopTopic - \StartTopic G \StopTopic - \StartTopic H \StopTopic - \StartTopic I \StopTopic -\StopTopics - -\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-pre-93.tex b/Master/texmf-dist/tex/context/base/s-pre-93.tex index b6764580656..7eabd5ed133 100644 --- a/Master/texmf-dist/tex/context/base/s-pre-93.tex +++ b/Master/texmf-dist/tex/context/base/s-pre-93.tex @@ -169,8 +169,6 @@ \starttext -\setupoutput[pdftex] - \TitlePage{August 2000}{Something Very Important} \StartTopic{Alpha} diff --git a/Master/texmf-dist/tex/context/base/s-pre-96.tex b/Master/texmf-dist/tex/context/base/s-pre-96.tex new file mode 100644 index 00000000000..705e74eecd4 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-pre-96.tex @@ -0,0 +1,188 @@ +%D \module +%D [ file=s-pre-26, +%D version=1999.08.20, +%D title=\CONTEXT\ Style File, +%D subtitle=Presentation Environment 26, +%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. + +\setuppapersize + [S44][S44] + +\definetypeface[main][rm][casual][informal][default] + +\setupbodyfont[main,13pt] + +\setuplayout + [backspace=0pt, + topspace=0pt, + header=0pt, + footer=0pt, + bottom=0pt, + width=middle, + height=fit] + +\setupbottom + [style=\ssbf, + color=white] + +\setupfooter + [style=\ssbfb, + color=white] + +\setupinteraction + [state=start, + click=no] + +\setupinteractionscreen + [option=max] + +\definecolor[white] [s=.8] +\definecolor[red] [r=.7] +\definecolor[green] [g=.7] +\definecolor[blue] [b=.7] +\definecolor[yellow][r=.7,g=.7] + +\setupcolors + [state=start] + +\defineoverlay [page] [\reuseMPgraphic{page}] +\defineoverlay [text] [\useMPgraphic {text}] +\defineoverlay [continue] [\overlaybutton {nextpage}] + +\setupbackgrounds % otherwise in acrobat 5 rounding error + [paper] % and one pixel white line + [background=page] + +\setupbackgrounds + [page] + [background={page,continue}] + +\definecolor [PageColor][black] + +\definecolor [TextColor 0][white] +\definecolor [TextColor 1][red] +\definecolor [TextColor 2][green] +\definecolor [TextColor 3][blue] +\definecolor [TextColor 4][yellow] + +\definecolor [TextColor] [TextColor 0] + +\defineframedtext + [TopicPage] + +\defineframedtext + [TopicText] + +\setupframedtexts + [TopicPage] + [width=\textwidth, + height=\textheight, + offset=overlay] + +\setupframedtexts + [TopicText] + [offset=10pt, + style=bold, + width=\TopicWidth, + background=text, + align=normal] + +\setupframedtexts + [TopicPage,TopicText] + [frame=off, + depthcorrection=off, + before=, + after=] + +\newbox \TopicBox % we stack old pages +\newcounter\KindOfTopic % and cycle through corners +\newdimen \TopicWidth % with randomized widths + +\setupinteraction + [color=lightgray, + contrastcolor=lightgray, + style=] + +\def\StartTopic + {\definecolor[TextColor][TextColor \KindOfTopic] + \ifcase\KindOfTopic\relax + \TopicWidth=.7\textwidth + \else + \getrandomdimen\TopicWidth{.55\textwidth}{.7\textwidth} + \fi + \ifcase\KindOfTopic\relax + \setupframedtexts [TopicPage] [align={middle,lohi}] \or + \setupframedtexts [TopicPage] [align={right,high}] \or + \setupframedtexts [TopicPage] [align={left,high}] \or + \setupframedtexts [TopicPage] [align={left,low}] \or + \setupframedtexts [TopicPage] [align={right,low}] \fi + \setbox\scratchbox=\vbox \bgroup \dontcomplain + \noindent \startTopicPage [none] + \noindent \startTopicText [none] } + +\def\StopTopic% + {\stopTopicText + \stopTopicPage + \egroup + \global\setbox\TopicBox=\vbox + {\startoverlay + {\box\TopicBox} {\box\scratchbox} + \stopoverlay} + \copy\TopicBox + \ifnum\KindOfTopic=4 + \def\KindOfTopic{1} + \else + \increment\KindOfTopic + \fi + \getrandomdimen\TopicWidth{.55\textwidth}{.7\textwidth} + \page} + +\startuseMPgraphic{text} + path p ; p := unitsquare xyscaled (OverlayWidth,OverlayHeight) ; + color c ; c := (.7+uniformdeviate.3)*\MPcolor{TextColor} ; + p := p enlarged -1.25pt ; + filldraw p withcolor c ; + draw p withpen pencircle scaled 2.5pt withcolor .75c ; +\stopuseMPgraphic + +\startreusableMPgraphic{page} + path p ; p := unitsquare xyscaled (OverlayWidth,OverlayHeight) ; + color c ; c := \MPcolor{PageColor} ; + filldraw p enlarged 5pt withcolor c ; % bleeding + draw p withpen pencircle scaled 2.5pt withcolor c ; +\stopreusableMPgraphic + +\def\StartNopic + {\def\KindOfTopic{0} % centered at the page + \StartTopic + \bfd\setupinterlinespace + \def\\{\blank\bfb\setupinterlinespace} + \raggedcenter} + +\def\StopNopic + {\StopTopic} + +\def\TitlePage#1% + {\StartNopic#1\StopNopic} + +\doifnotmode{demo}{\endinput} + +\starttext + +\StartNopic + a dull talk \\ \currentdate +\StopNopic + +\dorecurse{10}{\StartTopic \input tufte \StopTopic} + +\StartNopic + that's it \\ goodbye +\StopNopic + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-reg-01.mkiv b/Master/texmf-dist/tex/context/base/s-reg-01.mkiv new file mode 100644 index 00000000000..d3e456881c8 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-reg-01.mkiv @@ -0,0 +1,60 @@ +%D \module +%D [ file=s-reg-01, +%D version=2005.04.25, +%D title=\CONTEXT\ Style File, +%D subtitle=Extra Regime Support, +%D author=Hans Hagen, +%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 \macros +%D {showregime} +%D +%D This code is moved from the kernel to here. (We could make it +%D auto-loadable). + +\startluacode +--[[ldx-- +

The following code is rather specific.

+--ldx]]-- + +function regimes.show(regime) + regime = regimes.synonyms[regime] or regime + local r = regimes.data[regime] + if r then + local chardata = characters.data + context.starttabulate { "|rT|T|rT|lT|lT|lT|" } + for k, v in ipairs(r) do + local chr = chardata[v] + if chr then + context.NC() context(k) + context.NC() context.getvalue(chr.contextname]) + context.NC() context("%U+05X",v) + context.NC() context(chr.contextname) + context.NC() context(chr.category) + context.NC() context(chr.description) + context.NC() context.NR() + else + -- can't happen + end + end + context.stoptabulate() + else + context("unknown regime %s",regime) + end +end +\stopluacode + +\unprotect + +\def\showregime + {\dosingleempty\doshowregime} + +\def\doshowregime[#1]% + {\ctxlua{regimes.show("#1")}} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/s-reg-01.tex b/Master/texmf-dist/tex/context/base/s-reg-01.tex deleted file mode 100644 index 123b97384d8..00000000000 --- a/Master/texmf-dist/tex/context/base/s-reg-01.tex +++ /dev/null @@ -1,50 +0,0 @@ -%D \module -%D [ file=s-reg-01, -%D version=2005.04.25, -%D title=\CONTEXT\ Style File, -%D subtitle=Extra Regime Support, -%D author=Hans Hagen, -%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 \macros -%D {showregime} -%D -%D This code is moved from the kernel to here. (We could make it -%D auto-loadable). - -\startluacode ---[[ldx-- -

The following code is rather specific.

---ldx]]-- - -function regimes.show(regime) - regime = regimes.synonyms[regime] or regime - local r = regimes.data[regime] - if r then - tex.sprint(tc,"\\starttabulate[|rT|T|rT|lT|lT|lT|]") - for k, v in ipairs(r) do - tex.sprint(tex.ctxcatcodes, string.format("\\NC %s\\NC\\getvalue{%s}\\NC %s\\NC %s\\NC %s\\NC %s\\NC\\NR", k, - characters.contextname(v), characters.hexindex(v), characters.contextname(v), - characters.category(v), characters.description(v))) - end - tex.sprint(tex.ctxcatcodes,"\\stoptabulate") - else - tex.sprint(tex.ctxcatcodes,"unknown regime " .. regime) - end -end -\stopluacode - -\unprotect - -\def\showregime - {\dosingleempty\doshowregime} - -\def\doshowregime[#1]% - {\ctxlua{regimes.show("#1")}} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/s-set-31.mkiv b/Master/texmf-dist/tex/context/base/s-set-31.mkiv new file mode 100644 index 00000000000..53037a78db4 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/s-set-31.mkiv @@ -0,0 +1,118 @@ +% show missing translations + +\startluacode +function interfaces.show_missing(whatinterfaces) + whatinterfaces = whatinterfaces or interfaces.interfaces + local list = dofile(resolvers.find_file("mult-def.lua")) + local NC, NR, HL = context.NC, context.NR, context.HL + for k,v in table.sortedhash(list) do + context.title(k) + context.starttabulate { string.rep("|",#whatinterfaces+1) } + for i=1,#whatinterfaces do + NC() + context(whatinterfaces[i]) + end + NC() NR() HL() + for kk, vv in next, v do + if not string.find(kk,"subsub") then + local okay = true + for i=1,#whatinterfaces do + local int = whatinterfaces[i] + local str = vv[int] + if not str or (int ~= "en" and str == vv.en) then + okay = false + break + end + end + if not okay then + for i=1,#whatinterfaces do + local int = whatinterfaces[i] + local str = vv[int] + context.NC() + if not str then + -- nothing + elseif int == "en" then + context.color( { "darkgreen" }, str ) + elseif str == vv.en then + context.color( { "darkred" }, str ) + elseif int == "pe" then + context("\\righttoleft " .. str) + else + context(str) + end + end + NC() NR() + end + end + end + context.stoptabulate() + end +end + +function interfaces.show_missing_messages(whatinterfaces) + whatinterfaces = whatinterfaces or interfaces.interfaces + local list = dofile(resolvers.find_file("mult-mes.lua")) + local NC, NR, HL = context.NC, context.NR, context.HL + for k,v in table.sortedhash(list) do + context.title("message: " .. k) + context.starttabulate { "|l|" .. string.rep("pl|",#whatinterfaces) } + NC() + for i=1,#whatinterfaces do + NC() + context(whatinterfaces[i]) + end + NC() NR() HL() + local sorted = table.sortedkeys(v) + for i=1,#sorted do + local kk = sorted[i] + local vv = v[kk] + if kk ~= "files" then + local okay = true + for i=1,#whatinterfaces do + local int = whatinterfaces[i] + local str = vv[int] + if not str or (int ~= "en" and str == vv.en) then + okay = false + break + end + end + if not okay then + context.NC() + context(kk) + for i=1,#whatinterfaces do + local int = whatinterfaces[i] + local str = vv[int] + NC() + if not str then + -- nothing + elseif int == "en" then + context.color( { "darkgreen" }, str ) + elseif str == vv.en then + context.color( { "darkred" }, str ) + elseif int == "pe" then + context("\\righttoleft " .. str) + else + context(str) + end + end + NC() NR() + end + end + end + context.stoptabulate() + end +end +\stopluacode + +\starttext + +\setupbodyfont[dejavu,7pt,tt] +\setuppapersize[A4,landscape][A4,landscape] +\setuplayout[backspace=.5cm,width=middle,topspace=.5cm,height=middle,header=1cm,footer=0cm] + +\startluacode + interfaces.show_missing() -- { "en","nl" } + interfaces.show_missing_messages() -- { "en","nl" } +\stopluacode + +\stoptext diff --git a/Master/texmf-dist/tex/context/base/s-sys-01.tex b/Master/texmf-dist/tex/context/base/s-sys-01.tex deleted file mode 100644 index 77d3410c418..00000000000 --- a/Master/texmf-dist/tex/context/base/s-sys-01.tex +++ /dev/null @@ -1,61 +0,0 @@ -% engine=luatex - -%D \module -%D [ file=s-sys-01, -%D version=2008.03.32, -%D title=\CONTEXT\ Style File, -%D subtitle=Generate List of Math Symbol, -%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. - -\startluacode -function showmath() - local slots = mathematics.slots.traditional - local escape = characters.filters.utf.private.escape - local data = characters.data - tex.sprint(tex.ctxcatcodes,"\\starttabulate[|T|c|T|T|T|T||||]") - local texsprint = tex.sprint -% -- function texsprint(a,b) print(b) end - for _, v in ipairs(table.sortedkeys(slots)) do - local t, d, u = slots[v], data[v], escape(utf.char(v)) - local class, name, description = d.mathclass or "", d.mathname or "" , d.description or "" - if class == "accent" then - u = "" - end - if t[3] and t[4] then - texsprint(tex.ctxcatcodes,string.format( - "\\NC 0x%04X\\NC $%s$\\NC %s\\NC 0x%04X\\NC %s\\NC 0x%04X\\NC %s\\NC %s\\NC %s\\NC\\NR", - v,u,t[1],t[2],t[3],t[4],class,name,description)) - else - texsprint(tex.ctxcatcodes,string.format( - "\\NC 0x%04X\\NC $%s$\\NC %s\\NC 0x%04X\\NC\\NC\\NC %s\\NC %s\\NC %s\\NC\\NR", - v,u,t[1],t[2],class,name,description)) - end - end - tex.sprint(tex.ctxcatcodes,"\\stoptabulate") -end -\stopluacode - -\setuplayout - [backspace=1cm, - topspace=1cm, - footer=1cm, - header=0cm, - height=middle, - width=middle] - -\setupbodyfont - [9pt] - -\setupfootertexts - [] - [math characters -- \pagenumber] - -\starttext -\ctxlua{showmath()} -\stoptext diff --git a/Master/texmf-dist/tex/context/base/scrn-bar.mkiv b/Master/texmf-dist/tex/context/base/scrn-bar.mkiv deleted file mode 100644 index dbeaf6d7f5a..00000000000 --- a/Master/texmf-dist/tex/context/base/scrn-bar.mkiv +++ /dev/null @@ -1,398 +0,0 @@ -%D \module -%D [ file=scrn-bar, % was part of scrn-int -%D version=1995.01.01, -%D title=\CONTEXT\ Core Macros, -%D subtitle=Progress Bars, -%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 Screen Macros / Progress Bars} - -\unprotect - -%D The code is a bit upgraded to \MKIV\ but the output is mostly the same. -%D In retrospect this shoul dhave been a module. - -% todo: replace blackrule by stupid rules - -% \setupinteraction[state=start] -% \setupsubpagenumber[state=start] -% -% \startsetups bars -% \vbox -% {\hsize 5cm -% \hbox{\interactionbar[a]}\blank -% \hbox{\interactionbar[b]}\blank -% \hbox{\interactionbar[c]}\blank -% \hbox{\interactionbar[d]}\blank -% \hbox{\interactionbar[e]}\blank -% \hbox{\interactionbar[f]}\blank -% \hbox{\interactionbar[g]}\blank -% } -% \stopsetups -% -% \setupheadertexts[\setups{bars}] -% -% \starttext -% \dorecurse{10}{test \page } -% \stoptext - -\presetlocalframed[\??ib] - -%D First the usual definition code. - -\let\currentinteractionbar\empty - -\def\setinteractionbarparameter#1#2#3{\@EA\def\csname\??ib#1#2\endcsname{#3}} -\def\letinteractionbarparameter #1#2{\@EA\let\csname\??ib#1#2\endcsname} - -\def\interactionbarparameter #1{\csname\dointeractionbarparameter{\??ib\currentinteractionbar}#1\endcsname} -\def\namedinteractionbarparameter#1#2{\csname\dointeractionbarparameter{\??ib#1}#2\endcsname} -\def\interactionbarparameterhash #1{\dointeractionbarparameterhash {\??ib\currentinteractionbar}#1} - -\def\dointeractionbarparameter #1#2{\ifcsname#1#2\endcsname#1#2\else\expandafter\dointeractionbarparentparameter \csname#1\s!parent\endcsname#2\fi} -\def\dointeractionbarparameterhash#1#2{\ifcsname#1#2\endcsname #1\else\expandafter\dointeractionbarparentparameterhash\csname#1\s!parent\endcsname#2\fi} - -\def\dointeractionbarparentparameter #1#2{\ifx#1\relax\s!empty\else\dointeractionbarparameter #1#2\fi} -\def\dointeractionbarparentparameterhash#1#2{\ifx#1\relax \else\dointeractionbarparameterhash#1#2\fi} - -\unexpanded\def\defineinteractionbar{\dodoubleargument\dodefineinteractionbar} -\unexpanded\def\setupinteractionbar {\dodoubleempty \dosetupinteractionbar} -\def\interactionbar {\dodoubleempty \dointeractionbar} - -\def\dosetupinteractionbar[#1][#2]% - {\ifsecondargument - \getparameters[\??ib#1][#2]% - \else - \getparameters[\??ib][#1]% - \fi} - -\def\dodefineinteractionbar[#1][#2]% - {\getparameters - [\??ib#1]% - [\s!parent=\??ib,% -% \c!foregroundcolor=\interactionbarparameter\c!color,% -% \c!foregroundstyle=\interactionbarparameter\c!style,% - #2]} - -\def\dointeractionbar[#1][#2]% - {\iflocation - \begingroup - \doifnot{#1}\v!reset % obsolete, no caching any more - {\doifassignmentelse{#1} - {\getparameters[\??ib][#2]% - \edef\currentinteractionbar{\interactionbarparameter\c!alternative}}% - {\edef\currentinteractionbar{#1}% - \ifsecondargument\getparameters[\??ib#1][#2]\fi}% - \doif{\interactionbarparameter\c!state}\v!start - {\interactionbarparameter\c!command}}% - \endgroup - \fi} - -\newdimen\interactionbarwidth -\newdimen\interactionbarheight -\newdimen\interactionbardepth -\newdimen\interactionbardistance - -%D Interaction buttons, in fact a row of tiny buttons, are -%D typically only used for navigational purposed. The next -%D macro builds such a row based on a specification list. -%D -%D \startbuffer -%D \interactionbuttons[width=\hsize][page,PreviousJump,ExitViewer] -%D \stopbuffer -%D -%D \typebuffer -%D -%D gives -%D -%D \getbuffer -%D -%D Apart from individual entries, one can use \type{page} and -%D \type {subpage} as shortcuts to their four associated buttons. -%D The symbols are derived from the symbols linked to the -%D entries. - -\def\interactionbuttons - {\dodoubleempty\dointeractionbuttons} - -\def\dointeractionbuttons[#1][#2]% er is een verdeel macro \horizontalfractions - {\iflocation - \begingroup - % beware, is already set \let\currentinteractionbar\empty - \doif{\interactionbarparameter\c!state}\v!stop\locationfalse - \iflocation - \ifsecondargument - \let\menuparameter\interactionbarparameter - \setupinteractionbar[#1]% - \interactionbarwidth\interactionbarparameter\c!width - \ifdim\interactionbarwidth=\zeropoint - \interactionbarwidth1.5\emwidth - \fi - \doifnothing\@@ibheight{\letinteractionbarparameter\c!height\v!broad}% - \doifnothing\@@ibdepth {\letinteractionbarparameter\c!depth\!!zeropoint}%%% - \setbox2\hbox{\localframed[\??ib\currentinteractionbar][\c!background=]{\symbol[\@@iasymbolset][\v!previouspage]}}% - \!!heighta\ht2 % needed because we default to nothing - \setupinteractionbar[\c!strut=\v!no]% - \setinteractionparameter\c!width\!!zeropoint - \!!counta\zerocount % new, was 1 - \processallactionsinset - [#2] - [ \v!page=>\advance\!!counta 4, - \v!subpage=>\advance\!!counta 4, - \s!unknown=>\advance\!!counta 1]% - \ifdim\interactionbarwidth=\zeropoint - \!!widtha\dimexpr2\emwidth+\interactionbardistance\relax - \!!widthb\dimexpr\!!counta\!!widtha-\interactionbardistance\relax - \else - \!!widtha\interactionbarwidth - \!!widthb\dimexpr\!!counta\interactionbardistance-\interactionbardistance\relax - \advance\!!widtha -\!!widthb - \divide\!!widtha \!!counta - \!!widthb\interactionbarwidth - \fi - \hbox to \!!widthb - {\setnostrut - \processallactionsinset - [#2] - [ \v!page=>\interactionbargotox\v!firstpage \interactionbargotox\v!nextpage \interactionbargotox\v!previouspage \interactionbargotox\v!lastpage, - \v!subpage=>\interactionbargotox\v!firstsubpage\interactionbargotox\v!nextsubpage\interactionbargotox\v!previoussubpage\interactionbargotox\v!lastsubpage, - \s!unknown=>\interactionbargotox\commalistelement]% - \unskip}% - \else - \interactionbuttons[][#1]% - \fi - \fi - \endgroup - \fi} - -\def\interactionbargotox#1% - {\normalexpanded{\noexpand\dodocomplexbutton -% {\??ib\currentinteractionbar}% - {\??ib}% - [\c!height=\the\!!heighta,\c!width=\the\!!widtha]% - {\noexpand\symbol[\@@iasymbolset][#1]}% - [#1]}% - \hss} - -\def\interactionbara - {\iflocation - \interactionbarwidth \interactionbarparameter\c!width - \interactionbardistance\interactionbarparameter\c!distance - \interactionbarheight \interactionbarparameter\c!height - \interactionbardepth \interactionbarparameter\c!depth - \noindent\hbox to \interactionbarwidth \bgroup - \dontcomplain - \setupblackrules[\c!height=\v!max,\c!depth=\v!max]% - \!!widthb\dimexpr\interactionbarwidth-4\emwidth\relax - \processaction - [\interactionbarparameter\c!step] - [ \v!small=>\scratchcounter 20, - \v!medium=>\scratchcounter 10, - \v!big=>\scratchcounter 5, - \s!unknown=>\scratchcounter 10]% - \!!widtha\dimexpr\!!widthb/\scratchcounter\relax - \setupblackrules[\c!width=\!!widtha]% - \setbox\scratchbox\hbox to \interactionbarwidth - {\hskip2\emwidth - \setbox\scratchbox\hbox{\blackrule[\c!color=\interactionbarparameter\c!backgroundcolor]}% - \dorecurse\scratchcounter - {\hss\normalexpanded{\directgotodumbbox{\copy\scratchbox}[page(\the\numexpr\recurselevel*\lastpage/\scratchcounter\relax)]}}% - \hss - \hskip2\emwidth}% - \wd\scratchbox\zeropoint - \box \scratchbox - \setupblackrules[\c!width=\emwidth]% - \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\blackrule}[\v!firstpage]}% - \hskip\emwidth - \ifnum\realpageno>\plusone - \hskip\zeropoint\!!plus\numexpr\realpageno-\plustwo\relax \s!sp\relax % cm gives overflow - \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\blackrule}[\v!previouspage)]}% - \fi - \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\blackrule}[page(\number\realpageno)]}% todo: \v!currentpage - \ifnum\realpageno<\lastpage\relax - \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\blackrule}[\v!nextpage]}% - \hskip\zeropoint\!!plus\numexpr\lastpage-\realpageno-\plusone\relax \s!sp\relax % cm gives overflow - \fi - \hskip\emwidth - \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\blackrule}[\v!lastpage]}% - \egroup - \fi} - -\def\interactionbarb - {\ifnum\lastpage>\firstpage\relax - \interactionbuttons[\v!firstpage,\v!previouspage,\v!nextpage,\v!lastpage]% - \fi} - -\def\interactionbarc - {\iflocation \ifnum\lastpage>\plusone - \interactionbarwidth\interactionbarparameter\c!width - \hbox to \interactionbarwidth - {\setupblackrules[\c!height=\interactionbarparameter\c!height,\c!depth=\interactionbarparameter\c!depth,\c!width=\emwidth]% - \scratchdimen\dimexpr(\interactionbarwidth-4\emwidth)/\numexpr\lastpage+\minusone\relax\relax - \!!widtha\numexpr\realpageno+\minusone\relax\scratchdimen - \!!widthb\numexpr\lastpage-\realpageno\relax\scratchdimen - \directgotospecbox\interactionbarparameter{\blackrule}[\v!firstpage]% - \hss - \directgotospecbox\interactionbarparameter{\blackrule[\c!width=\!!widtha]}[\v!previouspage]% - \blackrule[\c!color=\interactionbarparameter\c!contrastcolor]% - \directgotospecbox\interactionbarparameter{\blackrule[\c!width=\!!widthb]}[\v!nextpage]% - \hss - \directgotospecbox\interactionbarparameter{\blackrule}[\v!lastpage]}% - \fi \fi} - -\unexpanded\def\@@commoninteractionbargotoa#1% - {\symbol[\ifcase#1\v!previous\or\v!somewhere\or\v!next\fi]} - -\unexpanded\def\@@commoninteractionbargotob#1% - {\vrule\!!height\interactionbarheight\!!depth\interactionbardepth\!!width\!!widtha\relax} - -\unexpanded\def\@@commoninteractionbargotoc#1% - {\symbol[\ifcase#1\v!previous\or\v!somewhere\or\v!somewhere\or\v!somewhere\or\v!next\fi} - -\unexpanded\def\@@commoninteractionbargotod#1% - {\vrule \!!width\!!widtha \ifcase#1% - \!!height \interactionbarheight \!!depth \interactionbardepth \or - \!!height.5\interactionbarheight \!!depth.5\interactionbardepth \or - \!!height \interactionbarheight \!!depth \interactionbardepth \or - \!!height.5\interactionbarheight \!!depth.5\interactionbardepth \else - \!!height \interactionbarheight \!!depth \interactionbardepth \fi} - -\unexpanded\def\@@commoninteractionbarx#1% - {\doifelse{\interactionbarparameter\c!symbol}\v!yes - {\setupsymbolset[\@@iasymbolset]% - \let\dogotox\@@commoninteractionbargotoa} - {\let\dogotox\@@commoninteractionbargotob}% - \dorecurse\nofsubpages - {\scratchcounter\numexpr\recurselevel+\firstsubpage+\minusone\relax - \chardef\what - \ifnum\scratchcounter<\realpageno \zerocount \else - \ifnum\scratchcounter=\realpageno \plusone \else - \plustwo \fi\fi - \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\dogotox\what}[page(\the\scratchcounter)]}% - #1}% - \unskip} - -\def\interactionbard - {\iflocation \ifnum\nofsubpages>\plusone \doif{\structurecounterparameter\s!subpage\c!state}\v!start{% - \interactionbarwidth \interactionbarparameter\c!width - \interactionbardistance\interactionbarparameter\c!distance - \interactionbarheight \interactionbarparameter\c!height - \interactionbardepth \interactionbarparameter\c!depth - \!!widtha\interactionbarwidth - \noindent\hbox{\@@commoninteractionbarx{\hskip\interactionbardistance}}% - }\fi \fi} - -\def\interactionbare - {\iflocation \ifnum\nofsubpages>\plusone \doif{\structurecounterparameter\s!subpage\c!state}\v!start{% - \begingroup - \interactionbarwidth \interactionbarparameter\c!width - \interactionbardistance\interactionbarparameter\c!distance - \interactionbarheight \interactionbarparameter\c!height - \interactionbardepth \interactionbarparameter\c!depth - \!!widthb\dimexpr\nofsubpages\interactionbardistance-\interactionbardistance\relax % (n-1) - \!!widtha\dimexpr(\interactionbarwidth-\!!widthb)/\nofsubpages\relax - \ifdim\!!widtha<\interactionbardistance - \interactionbarf - \else - \noindent\hbox to \interactionbarwidth{\@@commoninteractionbarx{\hss}\unskip}% - \fi - \endgroup - }\fi\fi} - -\def\interactionbarf - {\iflocation \ifnum\nofsubpages>\plusone \doif{\structurecounterparameter\s!subpage\c!state}\v!start{% - \interactionbarwidth \interactionbarparameter\c!width - \interactionbardistance\interactionbarparameter\c!distance - \interactionbarheight \interactionbarparameter\c!height - \interactionbardepth \interactionbarparameter\c!depth - \noindent \hbox to \interactionbarwidth \bgroup - \doloop - {\!!countc\numexpr(\nofsubpages/\recurselevel)+\plusone\relax % rounding - \!!widthb\interactionbardistance - \multiply\!!widthb \!!countc - \advance\!!widthb -\interactionbardistance - \!!widtha\interactionbarwidth - \advance\!!widtha -\!!widthb - \divide\!!widtha \!!countc - \ifdim\!!widtha<\interactionbardistance\else - \!!countb\recurselevel - \exitloop - \fi}% - \ifnum\!!countc>\plusone - % this is not that well tested - \advance\!!countc \minustwo - \!!widtha-\interactionbardistance - \!!widtha\!!countc\!!widtha - \advance\!!widtha \interactionbarwidth - \advance\!!countc \plusone - \divide\!!widtha \!!countc - \fi - \doifelse{\interactionbarparameter\c!symbol}\v!yes - {\setupsymbolset[\@@iasymbolset]% - \let\dogotox\@@commoninteractionbargotoc}% - {\let\dogotox\@@commoninteractionbargotod}% - \!!countc\numexpr\realpageno-\plustwo\relax - \!!countd\numexpr\realpageno+\plustwo\relax - \ifnum\!!countc<\plusone \!!countc\plusone \fi - \!!countf\zerocount - \dostepwiserecurse\firstsubpage\lastsubpage\plusone - {\!!doneafalse - \advance\!!countf \plusone - \ifnum\recurselevel=\firstsubpage\relax \!!doneatrue \fi - \ifnum\recurselevel=\lastsubpage \relax \!!doneatrue \fi - \chardef\what \if!!donea - \ifnum\recurselevel<\realpageno \zerocount \else - \ifnum\recurselevel>\realpageno \plustwo \else - \plusfour \fi\fi - \else \ifnum\!!countf=\!!countb - \ifnum\recurselevel<\realpageno \plusone \else - \ifnum\recurselevel>\realpageno \plusthree \else - \plustwo \fi\fi - \fi \fi - \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\dogotox\what}[page(\recurselevel)]}% - \hss - \!!countf\zerocount}% - \unskip - \egroup - }\fi\fi} - -\def\interactionbarg - {\iflocation \ifnum\lastsubpage>\firstsubpage\relax % no test for state? - \interactionbuttons[\v!firstsubpage,\v!previoussubpage,\v!nextsubpage,\v!lastsubpage]% - \fi \fi} - -\setupinteractionbar - [\c!state=\v!start, - \c!alternative=a, - \c!symbol=\v!no, - \c!width=10\emwidth, - \c!height=.5\emwidth, - \c!depth=\zeropoint, - \c!distance=.5\emwidth, - \c!step=\v!medium, - \c!foregroundcolor=\interactionbarparameter\c!color, - \c!foregroundstyle=\interactionbarparameter\c!style, - \c!color=\@@iacolor, - \c!contrastcolor=\@@iacontrastcolor, - \c!style=, - \c!frame=\v!on, - \c!background=color, - \c!backgroundcolor=gray, - \c!samepage=\v!yes, - \c!unknownreference=\v!yes] - -\defineinteractionbar[a][\c!command=\interactionbara] -\defineinteractionbar[b][\c!command=\interactionbarb,\c!height=\v!broad] -\defineinteractionbar[c][\c!command=\interactionbarc,\c!height=\v!max,\c!depth=\v!max] -\defineinteractionbar[d][\c!command=\interactionbard,\c!width=.5\emwidth] -\defineinteractionbar[e][\c!command=\interactionbare] -\defineinteractionbar[f][\c!command=\interactionbarf] -\defineinteractionbar[g][\c!command=\interactionbarg,\c!height=\v!broad] - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/scrn-bar.mkvi b/Master/texmf-dist/tex/context/base/scrn-bar.mkvi new file mode 100644 index 00000000000..4605f1d2e16 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/scrn-bar.mkvi @@ -0,0 +1,405 @@ +%D \module +%D [ file=scrn-bar, % was part of scrn-int +%D version=1995.01.01, +%D title=\CONTEXT\ Core Macros, +%D subtitle=Progress Bars, +%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 Screen Macros / Progress Bars} + +\unprotect + +%D The code is a bit upgraded to \MKIV\ but the output is mostly the +%D same. In retrospect this should have been a module. We can move +%D some definitions to scrn-run-bar.mkiv if needed. We can also make +%D the code a bit more efficient. + +% todo: replace blackrule by stupid rules + +%D \starttyping +%D \setupinteraction +%D [state=start] +%D +%D \setupsubpagenumber +%D [state=start] +%D +%D \setuplayout +%D [middle] +%D +%D \setuppapersize +%D [S4][S4] +%D +%D \startsetups bars +%D \ruledvbox to \textheight \bgroup +%D a \ruledhbox{\interactionbar[a]}\vss +%D b \ruledhbox{\interactionbar[b]}\vss +%D c \ruledhbox{\interactionbar[c]}\vss +%D d \ruledhbox{\interactionbar[d]}\vss +%D e \ruledhbox{\interactionbar[e]}\vss +%D f \ruledhbox{\interactionbar[f]}\vss +%D g \ruledhbox{\interactionbar[g]}\vss +%D \egroup +%D \stopsetups +%D +%D \setuptexttexts[\setups{bars}] +%D +%D \starttext +%D \dorecurse {12} { +%D \startstandardmakeup +%D \stopstandardmakeup +%D } +%D \stoptext +%D \stoptyping + +\installcommandhandler \??ib {interactionbar} \??ib + +\presetlocalframed[\??ib] + +\unexpanded\def\interactionbar + {\dodoubleempty\scrn_bar_direct} + +\def\scrn_bar_direct[#tag][#settings]% somewhat messy + {\iflocation + \begingroup + \doifassignmentelse{#tag} + {\getparameters[\??ib][#tag]% + \edef\currentinteractionbar{\interactionbarparameter\c!alternative}}% + {\edef\currentinteractionbar{#tag}% + \ifsecondargument\getparameters[\??ib#tag][#settings]\fi}% + \doif{\interactionbarparameter\c!state}\v!start + {\interactionbarparameter\c!command}% + \endgroup + \fi} + +\newdimen\scrn_bar_width +\newdimen\scrn_bar_height +\newdimen\scrn_bar_depth +\newdimen\scrn_bar_distance + +%D Interaction buttons, in fact a row of tiny buttons, are +%D typically only used for navigational purposed. The next +%D macro builds such a row based on a specification list. +%D +%D \startbuffer +%D \interactionbuttons[width=\hsize][page,PreviousJump,ExitViewer] +%D \stopbuffer +%D +%D \typebuffer +%D +%D gives +%D +%D \getbuffer +%D +%D Apart from individual entries, one can use \type{page} and +%D \type {subpage} as shortcuts to their four associated buttons. +%D The symbols are derived from the symbols linked to the +%D entries. + +\unexpanded\def\interactionbuttons + {\dodoubleempty\scrn_bar_buttons} + +\def\scrn_bar_buttons + {\iflocation + \expandafter\scrn_bar_buttons_status + \else + \expandafter\scrn_bar_buttons_ignore + \fi} + +\def\scrn_bar_buttons_status[#settings][#list]% + {\doif{\interactionbarparameter\c!state}\v!start + {\ifsecondargument + \scrn_bar_buttons_indeed[#settings][#list]% + \else + \scrn_bar_buttons_indeed[][#settings]% + \fi}} + +\def\scrn_bar_buttons_ignore[#settings][#list]% \gobbletwooptionals + {} + +\def\scrn_bar_buttons_indeed[#settings][#list]% + {\begingroup + %\let\menuparameter\interactionbarparameter + \setupinteractionbar[#settings]% + \scrn_bar_width\interactionbarparameter\c!width + \ifdim\scrn_bar_width=\zeropoint + \scrn_bar_width1.5\emwidth + \fi + \doifnothing{\interactionbarparameter\c!height}{\letinteractionbarparameter\c!height\v!broad}% + \doifnothing{\interactionbarparameter\c!depth }{\letinteractionbarparameter\c!depth\!!zeropoint}%%% + \setbox2\hbox{\localframed[\??ib\currentinteractionbar][\c!background=]{\symbol[\interactionparameter\c!symbolset][\v!previouspage]}}% + \!!heighta\ht2 % needed because we default to nothing + \setupinteractionbar[\c!strut=\v!no]% + \letinteractionparameter\c!width\zeropoint + \!!counta\zerocount % new, was 1 + \processallactionsinset + [#list] + [ \v!page=>\advance\!!counta 4, + \v!subpage=>\advance\!!counta 4, + \s!unknown=>\advance\!!counta 1]% + \ifdim\scrn_bar_width=\zeropoint + \!!widtha\dimexpr2\emwidth+\scrn_bar_distance\relax + \!!widthb\dimexpr\!!counta\!!widtha-\scrn_bar_distance\relax + \else + \!!widtha\scrn_bar_width + \!!widthb\dimexpr\!!counta\scrn_bar_distance-\scrn_bar_distance\relax + \advance\!!widtha -\!!widthb + \divide\!!widtha \!!counta + \!!widthb\scrn_bar_width + \fi + \hbox to \!!widthb + {\setnostrut + \startsymbolset[\interactionparameter\c!symbolset]% + \processallactionsinset + [#list] + [ \v!page=>\scrn_bar_goto\v!firstpage + \scrn_bar_goto\v!nextpage + \scrn_bar_goto\v!previouspage + \scrn_bar_goto\v!lastpage, + \v!subpage=>\scrn_bar_goto\v!firstsubpage + \scrn_bar_goto\v!nextsubpage + \scrn_bar_goto\v!previoussubpage + \scrn_bar_goto\v!lastsubpage, + \s!unknown=>\scrn_bar_goto\commalistelement]% + \unskip + \stopsymbolset}% + \endgroup} + +\def\scrn_bar_goto#action% + {\button + [\c!height=\the\!!heighta,\c!width=\the\!!widtha]% + {\symbol[#action]}% we could expand this one once only + [#action]% + \hss} + +\def\scrn_bar_alternative_a + {\scrn_bar_width \interactionbarparameter\c!width + \scrn_bar_distance\interactionbarparameter\c!distance + \scrn_bar_height \interactionbarparameter\c!height + \scrn_bar_depth \interactionbarparameter\c!depth + \noindent\hbox to \scrn_bar_width \bgroup + \dontcomplain + \setupblackrules[\c!height=\v!max,\c!depth=\v!max]% + \!!widthb\dimexpr\scrn_bar_width-4\emwidth\relax + \processaction + [\interactionbarparameter\c!step] + [ \v!small=>\scratchcounter 20, + \v!medium=>\scratchcounter 10, + \v!big=>\scratchcounter 5, + \s!unknown=>\scratchcounter 10]% + \!!widtha\dimexpr\!!widthb/\scratchcounter\relax + \setupblackrules[\c!width=\!!widtha]% + \setbox\scratchbox\hbox to \scrn_bar_width + {\hskip2\emwidth + \setbox\scratchbox\hbox{\blackrule[\c!color=\interactionbarparameter\c!backgroundcolor]}% + \dorecurse\scratchcounter + {\hss\normalexpanded{\directgotodumbbox{\copy\scratchbox}[page(\the\numexpr\recurselevel*\lastpage/\scratchcounter\relax)]}}% + \hss + \hskip2\emwidth}% + \wd\scratchbox\zeropoint + \box \scratchbox + \setupblackrules[\c!width=\emwidth]% + \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\blackrule}[\v!firstpage]}% + \hskip\emwidth + \ifnum\realpageno>\plusone + \hskip\zeropoint\!!plus\numexpr\realpageno-\plustwo\relax \s!sp\relax % cm gives overflow + \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\blackrule}[\v!previouspage)]}% + \fi + \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\blackrule}[page(\number\realpageno)]}% todo: \v!currentpage + \ifnum\realpageno<\lastpage\relax + \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\blackrule}[\v!nextpage]}% + \hskip\zeropoint\!!plus\numexpr\lastpage-\realpageno-\plusone\relax \s!sp\relax % cm gives overflow + \fi + \hskip\emwidth + \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\blackrule}[\v!lastpage]}% + \egroup} + +\def\scrn_bar_alternative_b + {\ifnum\lastpage>\firstpage\relax + \interactionbuttons[\v!firstpage,\v!previouspage,\v!nextpage,\v!lastpage]% + \fi} + +\def\scrn_bar_alternative_c + {\ifnum\lastpage>\plusone + \scrn_bar_width\interactionbarparameter\c!width + \hbox to \scrn_bar_width + {\setupblackrules[\c!height=\interactionbarparameter\c!height,\c!depth=\interactionbarparameter\c!depth,\c!width=\emwidth]% + \scratchdimen\dimexpr(\scrn_bar_width-4\emwidth)/\numexpr\lastpage+\minusone\relax\relax + \!!widtha\numexpr\realpageno+\minusone\relax\scratchdimen + \!!widthb\numexpr\lastpage-\realpageno\relax\scratchdimen + \directgotospecbox\interactionbarparameter{\blackrule}[\v!firstpage]% + \hss + \directgotospecbox\interactionbarparameter{\blackrule[\c!width=\!!widtha]}[\v!previouspage]% + \blackrule[\c!color=\interactionbarparameter\c!contrastcolor]% + \directgotospecbox\interactionbarparameter{\blackrule[\c!width=\!!widthb]}[\v!nextpage]% + \hss + \directgotospecbox\interactionbarparameter{\blackrule}[\v!lastpage]}% + \fi} + +\unexpanded\def\scrn_bar_goto_a#whereto% + {\symbol[\ifcase#whereto\v!previous\or\v!somewhere\or\v!next\fi]} + +\unexpanded\def\scrn_bar_goto_b#whereto% + {\vrule\!!height\scrn_bar_height\!!depth\scrn_bar_depth\!!width\!!widtha\relax} + +\unexpanded\def\scrn_bar_goto_c#whereto% + {\symbol[\ifcase#whereto\v!previous\or\v!somewhere\or\v!somewhere\or\v!somewhere\or\v!next\fi} + +\unexpanded\def\scrn_bar_goto_d#whereto% + {\vrule \!!width\!!widtha \ifcase#whereto% + \!!height \scrn_bar_height \!!depth \scrn_bar_depth \or + \!!height.5\scrn_bar_height \!!depth.5\scrn_bar_depth \or + \!!height \scrn_bar_height \!!depth \scrn_bar_depth \or + \!!height.5\scrn_bar_height \!!depth.5\scrn_bar_depth \else + \!!height \scrn_bar_height \!!depth \scrn_bar_depth \fi} + +\newconstant\scrn_bar_mode + +\unexpanded\def\scrn_bar_goto_x#command% + {\doifelse{\interactionbarparameter\c!symbol}\v!yes + {\setupsymbolset[\interactionparameter\c!symbolset]% + \let\scrn_bar_goto_indeed\scrn_bar_goto_a} + {\let\scrn_bar_goto_indeed\scrn_bar_goto_b}% + \dorecurse\nofsubpages + {\scratchcounter\numexpr\recurselevel+\firstsubpage+\minusone\relax + \scrn_bar_mode + \ifnum\scratchcounter<\realpageno \zerocount \else + \ifnum\scratchcounter=\realpageno \plusone \else + \plustwo \fi\fi + \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\scrn_bar_goto_indeed\scrn_bar_mode}[page(\the\scratchcounter)]}% + #command}% + \unskip} + +\def\scrn_bar_alternative_d + {\ifnum\nofsubpages>\plusone \doif{\structurecounterparameter\s!subpage\c!state}\v!start{% + \scrn_bar_width \interactionbarparameter\c!width + \scrn_bar_distance\interactionbarparameter\c!distance + \scrn_bar_height \interactionbarparameter\c!height + \scrn_bar_depth \interactionbarparameter\c!depth + \!!widtha\scrn_bar_width + \noindent\hbox{\scrn_bar_goto_x{\hskip\scrn_bar_distance}}% + }\fi} + +\def\scrn_bar_alternative_e + {\ifnum\nofsubpages>\plusone \doif{\structurecounterparameter\s!subpage\c!state}\v!start{% + \scrn_bar_width \interactionbarparameter\c!width + \scrn_bar_distance\interactionbarparameter\c!distance + \scrn_bar_height \interactionbarparameter\c!height + \scrn_bar_depth \interactionbarparameter\c!depth + \!!widthb\dimexpr\nofsubpages\scrn_bar_distance-\scrn_bar_distance\relax % (n-1) + \!!widtha\dimexpr(\scrn_bar_width-\!!widthb)/\nofsubpages\relax + \ifdim\!!widtha<\scrn_bar_distance + \scrn_bar_alternative_f + \else + \noindent\hbox to \scrn_bar_width{\scrn_bar_goto_x{\hss}\unskip}% + \fi + }\fi} + +\def\scrn_bar_alternative_f + {\ifnum\nofsubpages>\plusone \doif{\structurecounterparameter\s!subpage\c!state}\v!start{% + \scrn_bar_width \interactionbarparameter\c!width + \scrn_bar_distance\interactionbarparameter\c!distance + \scrn_bar_height \interactionbarparameter\c!height + \scrn_bar_depth \interactionbarparameter\c!depth + \noindent \hbox to \scrn_bar_width \bgroup + \doloop + {\!!countc\numexpr(\nofsubpages/\recurselevel)+\plusone\relax % rounding + \!!widthb\scrn_bar_distance + \multiply\!!widthb \!!countc + \advance\!!widthb -\scrn_bar_distance + \!!widtha\scrn_bar_width + \advance\!!widtha -\!!widthb + \divide\!!widtha \!!countc + \ifdim\!!widtha<\scrn_bar_distance\else + \!!countb\recurselevel + \exitloop + \fi}% + \ifnum\!!countc>\plusone + % this is not that well tested + \advance\!!countc \minustwo + \!!widtha-\scrn_bar_distance + \!!widtha\!!countc\!!widtha + \advance\!!widtha \scrn_bar_width + \advance\!!countc \plusone + \divide\!!widtha \!!countc + \fi + \doifelse{\interactionbarparameter\c!symbol}\v!yes + {\setupsymbolset[\interactionparameter\c!symbolset]% + \let\scrn_bar_goto_indeed\scrn_bar_goto_c}% + {\let\scrn_bar_goto_indeed\scrn_bar_goto_d}% + \!!countc\numexpr\realpageno-\plustwo\relax + \!!countd\numexpr\realpageno+\plustwo\relax + \ifnum\!!countc<\plusone \!!countc\plusone \fi + \!!countf\zerocount + \dostepwiserecurse\firstsubpage\lastsubpage\plusone + {\!!doneafalse + \advance\!!countf \plusone + \ifnum\recurselevel=\firstsubpage\relax \!!doneatrue \fi + \ifnum\recurselevel=\lastsubpage \relax \!!doneatrue \fi + \scrn_bar_mode + \if!!donea + \ifnum\recurselevel<\realpageno + \zerocount + \else\ifnum\recurselevel>\realpageno + \plustwo + \else + \plusfour + \fi\fi + \else + \ifnum\!!countf=\!!countb + \ifnum\recurselevel<\realpageno + \plusone + \else\ifnum\recurselevel>\realpageno + \plusthree + \else + \plustwo + \fi\fi + \else + \plusthree + \fi + \fi + \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\scrn_bar_goto_indeed\scrn_bar_mode}[page(\recurselevel)]}% + \hss + \!!countf\zerocount}% + \unskip + \egroup + }\fi} + +\def\scrn_bar_alternative_g + {\ifnum\lastsubpage>\firstsubpage\relax % no test for state? + \interactionbuttons[\v!firstsubpage,\v!previoussubpage,\v!nextsubpage,\v!lastsubpage]% + \fi} + +\setupinteractionbar + [\c!state=\v!start, + \c!alternative=a, + \c!symbol=\v!no, + \c!width=10\emwidth, + \c!height=.5\emwidth, + \c!depth=\zeropoint, + \c!distance=.5\emwidth, + \c!step=\v!medium, + \c!foregroundcolor=\interactionbarparameter\c!color, + \c!foregroundstyle=\interactionbarparameter\c!style, + \c!color=\interactionparameter\c!color, + \c!contrastcolor=\interactionparameter\c!contrastcolor, + \c!style=, + \c!frame=\v!on, + \c!background=color, + \c!backgroundcolor=gray, + \c!samepage=\v!yes] + +\defineinteractionbar[a][\c!command=\scrn_bar_alternative_a] +\defineinteractionbar[b][\c!command=\scrn_bar_alternative_b,\c!height=\v!broad] +\defineinteractionbar[c][\c!command=\scrn_bar_alternative_c,\c!height=\v!max,\c!depth=\v!max] +\defineinteractionbar[d][\c!command=\scrn_bar_alternative_d,\c!width=.5\emwidth] +\defineinteractionbar[e][\c!command=\scrn_bar_alternative_e] +\defineinteractionbar[f][\c!command=\scrn_bar_alternative_f] +\defineinteractionbar[g][\c!command=\scrn_bar_alternative_g,\c!height=\v!broad] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/scrn-but.lua b/Master/texmf-dist/tex/context/base/scrn-but.lua new file mode 100644 index 00000000000..b5b0a8ae42a --- /dev/null +++ b/Master/texmf-dist/tex/context/base/scrn-but.lua @@ -0,0 +1,19 @@ +if not modules then modules = { } end modules ['scrn-but'] = { + version = 1.001, + comment = "companion to scrn-but.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local format = string.format + +function commands.registerbuttons(tag,register,language) + local data = sorters.definitions[language] + local orders = daya and data.orders or sorters.definitions.default.orders + local tag = tag == "" and { "" } or { tag } + for i=1,#orders do + local order = orders[i] + context.menubutton(tag,format("%s:%s",register,order),order) + end +end diff --git a/Master/texmf-dist/tex/context/base/scrn-but.mkiv b/Master/texmf-dist/tex/context/base/scrn-but.mkiv deleted file mode 100644 index 9a72a756bd9..00000000000 --- a/Master/texmf-dist/tex/context/base/scrn-but.mkiv +++ /dev/null @@ -1,127 +0,0 @@ -%D \module -%D [ file=scrn-but, % moved code -%D version=1995.01.01, -%D title=\CONTEXT\ Core Macros, -%D subtitle=Interaction, -%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 Screen Macros / Buttons} - -\unprotect - -%D Buttons are just what their names says: things that can be -%D clicked (pushed) on. They are similar to \type{\goto}, -%D except that the text argument is not interpreted. -%D Furthermore one can apply anything to them that can be done -%D with \type{\framed}. -%D -%D \startbuffer -%D \button[width=3cm,height=1.5cm]{Exit}[ExitViewer] -%D \stopbuffer -%D -%D \typebuffer -%D -%D gives -%D -%D \getbuffer -%D -%D This command is formally specified as: -%D -%D \showsetup{button} -%D -%D The characteristics can be set with: -%D -%D \showsetup{setupbuttons} - -\unexpanded\def\setupbuttons - {\dodoubleargument\getparameters[\??bt]} - -\definecomplexorsimpleempty\button - -\def\complexbutton - {\docomplexbutton\??bt} - -\presetlocalframed[\??bt] - -\def\buttonparameter#1{\csname\??bt#1\endcsname} % simple version - -\long\def\docomplexbutton#1[#2]#3#4% get rid of possible space before [#4] - {\dodocomplexbutton#1[#2]{#3}#4} % #4 == [ - -\def\buttonframed{\dodoubleempty\localframed[\??bt]} % goodie - -% #3=none is obsolete, just use empty=yes - -\long\def\dodocomplexbutton#1[#2]#3[#4]% #3 can contain [] -> {#3} later - {\begingroup - \let\menuparameter\buttonparameter - \doif{\buttonparameter\c!state}\v!stop\locationfalse - \iflocation - \setlocationboxyes#1[#2]{#3}[#4]% - \fi - \endgroup} - -%D \macros -%D {overlaybutton} -%D -%D For converience we provide: -%D -%D \starttyping -%D \overlaybutton[reference] -%D \stoptyping -%D -%D This command can be used to define overlays an/or can be -%D used in the whatevertext areas, like: -%D -%D \starttyping -%D \defineoverlay[PrevPage][\overlaybutton{PrevPage}] -%D \setupbackgrounds[page][background=PrevPage] -%D \setuptexttexts[\overlaybutton{NextPage}] -%D \stoptyping -%D -%D For practical reasons, this macro accepts square brackets -%D as well as braces. - -\definecomplexorsimple\overlaybutton - -\def\simpleoverlaybutton#1% - {\complexoverlaybutton[#1]} - -\def\complexoverlaybutton[#1]% - {\iflocation - \gotobox{\overlayfakebox}[#1]% - \fi} - -\def\overlayfakebox - {\hbox - {\setbox\scratchbox\null - \wd\scratchbox\overlaywidth - \ht\scratchbox\overlayheight - \box\scratchbox}} - -%D Done. - -\setupbuttons - [\c!state=\v!start, - \c!width=\v!fit, - \c!height=\v!broad, - \c!offset=0.25em, - \c!frame=\v!on, - \c!background=, - \c!backgroundcolor=, - \c!foregroundstyle=\buttonparameter\c!style, - \c!foregroundcolor=\buttonparameter\c!color, - \c!style=\@@iastyle, - \c!color=\@@iacolor, - \c!contrastcolor=\@@iacontrastcolor, - \c!samepage=\v!yes, - \c!unknownreference=\v!yes, - \c!distance=\zeropoint] % for menubuttons - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/scrn-but.mkvi b/Master/texmf-dist/tex/context/base/scrn-but.mkvi new file mode 100644 index 00000000000..e1dedd6051b --- /dev/null +++ b/Master/texmf-dist/tex/context/base/scrn-but.mkvi @@ -0,0 +1,995 @@ +%D \module +%D [ file=scrn-but, % moved code +%D version=1995.01.01, +%D title=\CONTEXT\ Core Macros, +%D subtitle=Interaction, +%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. + +% \restorestandardblank +% better namespace for pos + +\writestatus{loading}{ConTeXt Screen Macros / Buttons} + +\registerctxluafile{scrn-but}{1.001} + +\unprotect + +%D Buttons are just what their names says: things that can be +%D clicked (pushed) on. They are similar to \type{\goto}, +%D except that the text argument is not interpreted. +%D Furthermore one can apply anything to them that can be done +%D with \type{\framed}. +%D +%D \startbuffer +%D \button[width=3cm,height=1.5cm]{Exit}[ExitViewer] +%D \stopbuffer +%D +%D \typebuffer +%D +%D gives +%D +%D \getbuffer +%D +%D This command is formally specified as: +%D +%D \showsetup{button} +%D +%D The characteristics can be set with: +%D +%D \showsetup{setupbuttons} + +\installcommandhandler \??bt {button} \??bt + +\let\setupbuttons\setupbutton + +\presetlocalframed[\??bt] + +\appendtoks + \setuevalue\currentbutton{\scrn_button_direct{\currentbutton}}% + \setevalue{\??bt:\currentbutton\s!parent}{\??bt\currentbutton}% framed +\to \everydefinebutton + +\unexpanded\def\scrn_button_direct#tag% + {\begingroup + \edef\currentbutton{#tag}% + \doifelselocation + {\dosingleempty\scrn_button_direct_status}% + {\dosingleempty\scrn_button_direct_ignore}} + +\def\scrn_button_direct_status + {\doifelse{\buttonparameter\c!state}\v!start + \scrn_button_direct_indeed + \scrn_button_direct_ignore} + +%\def\buttonframed{\dodoubleempty\localframed[\??bt]} % goodie + +% empty=yes +% +% \button[settings]{}[action] % normally used at the tex end + +\def\scrn_button_direct_indeed[#settings]#text[#action]% + {\iffirstargument + \setupbuttons[\currentbutton][#settings]% + \fi + \scrn_button_make\??bt\currentbutton\buttonparameter{#text}{#action}% + \endgroup} + +\def\scrn_button_direct_ignore[#settings]#text[#destination]% + {\endgroup} + +\definebutton[button] % english + +\setupbuttons + [\c!state=\v!start, + \c!width=\v!fit, + \c!height=\v!broad, + \c!offset=0.25em, + \c!frame=\v!on, + \c!background=, + \c!backgroundcolor=, + \c!foregroundstyle=\buttonparameter\c!style, + \c!foregroundcolor=\buttonparameter\c!color, + \c!style=\interactionparameter\c!style, + \c!color=\interactionparameter\c!color, + \c!contrastcolor=\interactionparameter\c!contrastcolor, + \c!samepage=\v!yes, + \c!unknownreference=\v!yes, + \c!distance=\zeropoint] % for menubuttons + +%D \macros +%D {overlaybutton} +%D +%D For converience we provide: +%D +%D \starttyping +%D \overlaybutton[reference] +%D \stoptyping +%D +%D This command can be used to define overlays an/or can be +%D used in the whatevertext areas, like: +%D +%D \starttyping +%D \defineoverlay[PrevPage][\overlaybutton{PrevPage}] +%D \setupbackgrounds[page][background=PrevPage] +%D \setuptexttexts[\overlaybutton{NextPage}] +%D \stoptyping +%D +%D For practical reasons, this macro accepts square brackets +%D as well as braces. + +\unexpanded\def\overlaybutton + {\dosingleempty\scrn_button_overlay} + +\def\scrn_button_overlay[#1]% + {\iffirstargument + \scrn_button_overlay_indeed{#1}% + \else + \expandafter\scrn_button_overlay_indeed + \fi} + +\def\scrn_button_overlay_indeed#1% + {\iflocation + \gotobox{\overlayfakebox}[#1]% + \fi} + +%D The renderers: + +\expandafter\let\csname\??bt:\c!location:\v!yes \endcsname\zerocount +\expandafter\let\csname\??bt:\c!location:\v!empty \endcsname\plusone +\expandafter\let\csname\??bt:\c!location:\v!no \endcsname\plustwo +\expandafter\let\csname\??bt:\c!location:\v!none \endcsname\plusthree +\expandafter\let\csname\??bt:\c!location:\v!normal \endcsname\plusone % default +\expandafter\let\csname\??bt:\c!location:\s!default\endcsname\plusone % default +\expandafter\let\csname\??bt:\c!location:\s!empty \endcsname\plusone % default + +\newconditional\scrn_button_skipped + +\def\scrn_button_make#namespace#current#currentparameter#text#action% + {\begingroup + \attribute\referenceattribute\attributeunsetvalue + \global\setfalse\scrn_button_skipped + \chardef\locationboxpagestate\csname\??bt:\c!location:#currentparameter\c!samepage\endcsname + \doifreferencefoundelse{#action}\scrn_button_make_yes\scrn_button_make_nop + {#namespace}{#current}{#currentparameter}{#text}% + \endgroup} + +\def\scrn_button_make_yes + {\analyzecurrentreference % needed as we act on the state + \ifcase\referencepagestate + \expandafter\scrn_button_make_normal % no state : something else than a page reference + \or + \ifcase\locationboxpagestate\relax + \expandafter\expandafter\expandafter\scrn_button_make_contrast % same page: yes: same page or not ... todo + \or + \expandafter\expandafter\expandafter\scrn_button_make_empty % same page: empty but frame: no click + \or + \expandafter\expandafter\expandafter\scrn_button_make_nothing % same page: empty no frame: no + \else + \expandafter\expandafter\expandafter\scrn_button_make_skipped % same page: nothing at all + \fi + \else + \ifcase\locationboxpagestate\relax + \expandafter\expandafter\expandafter\scrn_button_make_normal % other page: yes: same page or not ... todo + \or + \expandafter\expandafter\expandafter\scrn_button_make_normal % other page: empty but frame: no click + \or + \expandafter\expandafter\expandafter\scrn_button_make_normal % other page: empty no frame: no + \else + \expandafter\expandafter\expandafter\scrn_button_make_skipped % other page: nothing at all + \fi% + \fi} + +\def\scrn_button_make_nop + {\ifcase\locationboxpagestate\relax + \expandafter\scrn_button_make_framed + \or + \expandafter\scrn_button_make_empty + \or + \expandafter\scrn_button_make_nothing + \or + \expandafter\scrn_button_make_skipped + \fi} + +\def\scrn_button_make_framed#namespace#current#currentparameter#text% + {\directlocalframed[#namespace:#current]{\ignorespaces#text\removeunwantedspaces}} + +\def\scrn_button_make_skipped#namespace#current#currentparameter#text% + {\global\settrue\scrn_button_skipped} + +\def\scrn_button_make_normal#namespace#current#currentparameter#text% + {\ctxlua{structures.references.injectcurrentset(nil,nil)}% + \hbox attr \referenceattribute \lastreferenceattribute + {\directlocalframed + [#namespace:#current]% + {\ignorespaces#text\removeunwantedspaces}}} + +\def\scrn_button_make_contrast#namespace#current#currentparameter#text% + {\ctxlua{structures.references.injectcurrentset(nil,nil)}% + \hbox attr \referenceattribute \lastreferenceattribute + {\localframedwithsettings + [#namespace:#current]% + [\c!foregroundcolor=#currentparameter\c!contrastcolor]% + {\ignorespaces#text\removeunwantedspaces}}} + +\def\scrn_button_make_empty#namespace#current#currentparameter#text% + {\localframedwithsettings + [#namespace:#current]% + [\c!empty=\v!yes]% + {\ignorespaces#text\removeunwantedspaces}} + +\def\scrn_button_make_nothing#namespace#current#currentparameter#text% + {\localframedwithsettings + [#namespace:#current]% + [\c!empty=\v!yes,\c!frame=,\c!background=]% + {\ignorespaces#text\removeunwantedspaces}} + +%D Menus: +%D +%D \starttyping +%D \setuppapersize +%D [S6][S6] +%D +%D \setuplayout +%D [backspace=6cm, cutspace=6cm, +%D leftedge=3cm, rightedge=3cm, +%D leftmargin=1cm, rightmargin=1cm, +%D margindistance=5mm, edgedistance=5mm, +%D topspace=4cm, bottomspace=4cm, +%D header=0pt, footer=0pt, +%D top=1cm, bottom=1cm, +%D topdistance=5mm, bottomdistance=5mm, +%D width=middle, height=middle] +%D +%D \setupinteraction +%D [state=start, +%D menu=on] +%D +%D \setupinteractionmenu +%D [right] +%D [state=start,background=color,frame=off,backgroundcolor=red,color=white,contrastcolor=blue] +%D \setupinteractionmenu +%D [left] +%D [state=start,background=color,frame=off,backgroundcolor=green,color=white] +%D \setupinteractionmenu +%D [top] +%D [state=start,background=color,frame=off,backgroundcolor=blue,color=white] +%D \setupinteractionmenu +%D [bottom] +%D [state=start,background=color,frame=off,backgroundcolor=yellow,color=white] +%D +%D \setupinteractionmenu +%D [left] +%D [state=local] +%D \setupinteractionmenu +%D [bottom] +%D [state=local] +%D +%D \startinteractionmenu[right] +%D \startbut [page(2)] Page 2 \stopbut +%D \startbut [page(1)] Page 1 \stopbut +%D \includemenu[left] +%D \includemenu[bottom] +%D \stopinteractionmenu +%D +%D \startinteractionmenu[left] +%D \startbut [page(1)] Page 1 \stopbut +%D \startbut [page(2)] Page 2 \stopbut +%D \stopinteractionmenu +%D +%D \startinteractionmenu[top] +%D \startbut [page(1)] Page 1 \stopbut +%D \startbut [page(2)] Page 2 \stopbut +%D \stopinteractionmenu +%D +%D \startinteractionmenu[bottom] +%D \startbut [page(2)] Page 2 \stopbut +%D \startbut [page(1)] Page 1 \stopbut +%D \stopinteractionmenu +%D \stoptyping +%D +%D \starttyping +%D \startinteractionmenu[rechts] +%D \startbut [eerste] eerste \stopbut +%D \starttxt hello world \stoptxt +%D \startbut [tweede] tweede \stopbut +%D \startnop \stopnop +%D \startbut [tweede] tweede \stopbut +%D \startrul whow \stoprul +%D \startbut [tweede] tweede \stopbut +%D \startraw hello world \stopraw +%D \startbut [tweede] tweede \stopbut +%D \startcom \vfill \stopcom +%D \startbut [derde] derde \stopbut +%D \stopinteractionmenu +%D \stoptyping +%D +%D \starttyping +%D \setupinteractionmenu[right][samepage=yes, unknownreference=yes] +%D \setupinteractionmenu[right][samepage=empty,unknownreference=empty] +%D \setupinteractionmenu[right][samepage=no, unknownreference=no] +%D \setupinteractionmenu[right][samepage=none, unknownreference=none] +%D \stoptyping + +\installcommandhandler \??am {interactionmenu} \??am + +\let\setupinteractionmenus\setupinteractionmenu + +\presetlocalframed[\??am] + +\let\scrn_menu_action\relax + +\let\scrn_menu_define_original\defineinteractionmenu + +\unexpanded\def\defineinteractionmenu + {\dotripleempty\scrn_menu_define} + +\def\scrn_menu_define[#tag][#category][#settings]% category reflects location, settings can be parent + {\ifthirdargument + \doifassignmentelse{#settings}% + {\scrn_menu_define_original[#tag][#category][\c!category=#category,#settings]}% child definition + {\scrn_menu_define_original[#tag][#settings][\c!category=#category]}% % child definition + \scrn_menu_register{#tag}{#category}% + \setevalue{\??am:#tag\s!parent}{\??am#tag}% framed + \else\ifsecondargument + \doifassignmentelse{#category}% + {\scrn_menu_define_original[#tag][#category]% % root definition + \setevalue{\??am:#tag\s!parent}{\??am}}% framed + {\scrn_menu_define_original[#tag][#category][\c!category=#category]% % child definition + \scrn_menu_register{#tag}{#category}% + \setevalue{\??am:#tag\s!parent}{\??am#tag}}% framed + \else + \scrn_menu_define_original[#tag]% % root definition + \setevalue{\??am:#tag\s!parent}{\??am}% framed + \fi\fi} + +\def\scrn_menu_register#tag#category% + {\ifcsname\??am:t:#category\endcsname \else + \expandafter\newtoks \csname\??am:t:#category\endcsname + \expandafter\setfalse\csname\??am:c:#category\endcsname + \fi + \normalexpanded{\csname\??am:t:#category\endcsname{\the\csname\??am:t:#category\endcsname\scrn_menu_action{#tag}}}} + +\def\scrn_menu_actions#category% + {\the\csname\??am:t:#category\endcsname} + +%D Fill menus: + +\normalexpanded{\long\def\expandafter\noexpand\csname\e!start\v!interactionmenu\endcsname[#tag]#content\expandafter\noexpand\csname\e!stop\v!interactionmenu\endcsname}% + {\def\currentinteractionmenu{#tag}% + \expandafter\settrue\csname\??am:c:\interactionmenuparameter\c!category\endcsname + \setinteractionmenuparameter\c!menu{#content}} + +\def\resetinteractionmenu[#tag]% + {\def\currentinteractionmenu{#tag}% + \resetinteractionmenuparameter\c!menu} + +%D Placement of menus: +%D +%D The offset mechanism is not the same as in in \MKII. There we +%D adapted automatically to offsets in the text backgrounds. Here we +%D have a bit more (but manual) control. +%D +%D \starttyping +%D \setupbackgrounds +%D [text][text] +%D [background=color,backgroundcolor=gray,backgroundoffset=2mm] +%D +%D \setupbackgrounds +%D [text] +%D [rightedge,leftedge] +%D [background=color,backgroundcolor=gray] +%D +%D \setupbackgrounds +%D [top,bottom] +%D [text] +%D [background=color,backgroundcolor=gray] +%D +%D \setupinteractionmenu +%D [right] +%D [topoffset=0mm,bottomoffset=0mm] +%D +%D \setupinteractionmenu +%D [top] +%D [topoffset=2mm,bottomoffset=2mm,rightoffset=2mm,leftoffset=2mm] +%D \stoptyping +%D +%D The no longer hard coded text areas offset compensation makes tuning +%D easier. After all, menus need some setup anyway. + +\newbox \scrn_menu_box + +\newdimen\scrn_menu_next_distance +\newdimen\scrn_menu_final_width +\newdimen\scrn_menu_final_height +\newdimen\scrn_menu_used_width +\newdimen\scrn_menu_used_height +\newdimen\scrn_menu_asked_width +\newdimen\scrn_menu_asked_height +\newdimen\scrn_menu_offset_top +\newdimen\scrn_menu_offset_bottom +\newdimen\scrn_menu_offset_left +\newdimen\scrn_menu_offset_right + +\newconditional\scrn_menu_zerodimensions + +\def\scrn_menu_set_used + {\doassigncheckedframeoffset\scrn_menu_offset_left {\interactionmenuparameter\c!leftoffset }% + \doassigncheckedframeoffset\scrn_menu_offset_right {\interactionmenuparameter\c!rightoffset }% + \doassigncheckedframeoffset\scrn_menu_offset_top {\interactionmenuparameter\c!topoffset }% + \doassigncheckedframeoffset\scrn_menu_offset_bottom{\interactionmenuparameter\c!bottomoffset}% + \scrn_menu_asked_width \interactionmenuparameter\c!maxwidth + \scrn_menu_asked_height \interactionmenuparameter\c!maxheight + \scrn_menu_used_width\dimexpr + \scrn_menu_asked_width + \scrn_menu_offset_left + \scrn_menu_offset_right + \relax + \scrn_menu_used_height\dimexpr + \scrn_menu_asked_height + \scrn_menu_offset_top + \scrn_menu_offset_bottom + \relax} + +\def\scrn_menu_set_final + {\scrn_menu_final_width \namedinteractionmenuparameter\askedinteractionmenulocation\c!maxwidth + \scrn_menu_final_height\namedinteractionmenuparameter\askedinteractionmenulocation\c!maxheight} + +\def\scrn_menu_apply_final + {\ifconditional\scrn_menu_zerodimensions + \wd\scrn_menu_box\zeropoint + \ht\scrn_menu_box\zeropoint + \else + \wd\scrn_menu_box\scrn_menu_final_width + \ht\scrn_menu_box\scrn_menu_final_height + \fi + \dp\scrn_menu_box\zeropoint} + +\def\scrn_menu_apply_used + {\ifdim\scrn_menu_offset_left=\zeropoint \else + \setbox\scrn_menu_box\hbox{\hskip-\scrn_menu_offset_left \box\scrn_menu_box}% + \fi + \ifdim\scrn_menu_offset_bottom=\zeropoint \else + \setbox\scrn_menu_box\hbox{\lower \scrn_menu_offset_bottom \box\scrn_menu_box}% + \fi + \wd\scrn_menu_box\scrn_menu_asked_width + \ht\scrn_menu_box\scrn_menu_asked_height + \dp\scrn_menu_box\zeropoint} + +\setvalue{scrn_menu_align_\v!right }{\let\scrn_menu_left_align\raggedright} +\setvalue{scrn_menu_align_\v!left }{\let\scrn_menu_left_align\raggedleft} +\setvalue{scrn_menu_align_\v!flushright}{\let\scrn_menu_left_align\raggedleft} +\setvalue{scrn_menu_align_\v!flushleft }{\let\scrn_menu_left_align\raggedright} +\setvalue{scrn_menu_align_\v!middle }{\let\scrn_menu_left_align\raggedcenter} +\setvalue{scrn_menu_align_\v!low }{\let\scrn_menu_top_align\vss\let\scrn_menu_bottom_align\relax} +\setvalue{scrn_menu_align_\v!high }{\let\scrn_menu_top_align\relax\let\scrn_menu_bottom_align\vss} +\setvalue{scrn_menu_align_\v!lohi }{\let\scrn_menu_top_align\vss\let\scrn_menu_bottom_align\vss} + +\let\scrn_menu_left_align \relax +\let\scrn_menu_right_align \relax +\let\scrn_menu_top_align \relax +\let\scrn_menu_bottom_align\relax + +\def\scrn_menu_set_align + {\csname scrn_menu_align_\interactionmenuparameter\c!itemalign\endcsname} + +%D Hook into the pagebuilder (as less testing as possible): + +\def\scrn_menu_insert + {\iflocation + \expandafter\scrn_menu_insert_checked + \else + \expandafter\gobbleoneargument + \fi} + +\def\scrn_menu_insert_checked#location% + {\ifconditional\csname\??am:c:#location\endcsname + \scrn_menu_insert_indeed{#location}% + \fi} + +\def\scrn_menu_insert_indeed#location% + {\begingroup + \xdef\askedinteractionmenulocation{#location}% + \scrn_menu_set_final + \ifcase\scrn_menu_final_width \else \ifcase\scrn_menu_final_height \else + \forgetall + \global\scrn_menu_next_distance\zeropoint + \let\scrn_menu_action\scrn_menu_package_indeed + \the\everysetmenucommands + \csname\??am:\c!menu:\namedinteractionmenuparameter\askedinteractionmenulocation\c!alternative\endcsname + \fi \fi + \endgroup} + +%D This calls: % can be \c!command for vertical/horizontal + +\setvalue{\??am:\c!menu:\v!vertical}% all menus + {\let\scrn_menu_packager\scrn_menu_packager_vertical + \setbox\scrn_menu_box\hbox{\scrn_menu_actions\askedinteractionmenulocation}% + \scrn_menu_apply_final + \box\scrn_menu_box} + +\setvalue{\??am:\c!menu:\v!horizontal}% all menus + {\let\scrn_menu_packager\scrn_menu_packager_horizontal + \setbox\scrn_menu_box\vbox{\scrn_menu_actions\askedinteractionmenulocation}% + \scrn_menu_apply_final + \box\scrn_menu_box} + +% stop : skipped +% start: processed +% local: skipped but can be included +% empty: processed but invisible + +\unexpanded\def\scrn_menu_package_indeed#tag% one menu + {\begingroup + \edef\currentinteractionmenu{#tag}% + \edef\currentinteractionmenustate{\interactionmenuparameter\c!state}% + \ifx\currentinteractionmenustate\v!start + \scrn_menu_packager + \else\ifx\currentinteractionmenustate\v!empty + \scrn_menu_packager + \fi\fi + \endgroup} + +%D With the packager being one of: + +\def\scrn_menu_packager_vertical + {\scrn_menu_set_used + \hskip\scrn_menu_next_distance + \setbox\scrn_menu_box\hbox to \scrn_menu_used_width + {\ifx\currentinteractionmenustate\v!empty \else + \interactionmenuparameter\c!left + \scrn_menu_package_vertical{\interactionmenuparameter\c!menu}% + \interactionmenuparameter\c!right + \fi}% + \edef\currentinteractionmenudistance{\interactionmenuparameter\c!distance}% + \ifx\currentinteractionmenudistance\v!overlay + \global\scrn_menu_next_distance\zeropoint + \wd\scrn_menu_box\zeropoint + \else + \global\scrn_menu_next_distance\currentinteractionmenudistance + \scrn_menu_apply_used + \fi + \box\scrn_menu_box} + +\def\scrn_menu_packager_horizontal + {\scrn_menu_set_used + \vskip\scrn_menu_next_distance + \scrn_menu_set_align + \setbox\scrn_menu_box\vbox to \scrn_menu_used_height + {\ifx\currentinteractionmenustate\v!none \else + \scrn_menu_top_align + \interactionmenuparameter\c!before + \scrn_menu_package_horizontal{\interactionmenuparameter\c!menu}% + \interactionmenuparameter\c!after + \scrn_menu_bottom_align + \fi}% + \edef\currentinteractionmenudistance{\interactionmenuparameter\c!distance}% + \ifx\currentinteractionmenudistance\v!overlay + \global\scrn_menu_next_distance\zeropoint + \offinterlineskip + \dp\scrn_menu_box\zeropoint + \ht\scrn_menu_box\zeropoint + \else + \global\scrn_menu_next_distance\currentinteractionmenudistance + \scrn_menu_apply_used + \fi + \box\scrn_menu_box} + +%D For a right menu, a sequence of calls to \type +%D {right_menu_button} is generated. +%D +%D \starttyping +%D right_menu_button (n, p, s=0/1/2, x, y, w, h, d) ; +%D \stoptyping +%D +%D Here, n is the number of the button, s a status variable, +%D while the rest is positional info. The status variable is +%D 0, 1 or~2: not found, found and found but current page. + +\newcount \scrn_menu_position +\newconstant \scrn_menu_page_mode % 0=notfound 1=found 2=currentpage +\newconditional\scrn_menu_positioning +\newtoks \scrn_menu_mp_data + +\def\scrn_menu_button_mp_template + {\askedinteractionmenulocation _menu_button(% + \number\scrn_menu_position,% + \number\scrn_menu_page_mode,% + \MPpos{\askedinteractionmenulocation:\number\scrn_menu_position}% + );} + +\def\MPmenubuttons#1{\the\scrn_menu_mp_data} + +\appendtoks + \global\scrn_menu_mp_data\emptytoks +\to \everyshipout + +\def\scrn_menu_whole_position % cannot happen in previous due to align + {\setbox\scrn_menu_box\hbox \bgroup + \hpos{menu:\askedinteractionmenulocation:\the\realpageno}{\box\scrn_menu_box}% + \egroup} + +% removed: \restorestandardblank (vspacing) ... should happen elsewhere + +\def\scrn_menu_package_vertical#content% + {\begingroup + \global\scrn_menu_position\zerocount + \def\scrn_menu_between_action_indeed{\interactionmenuparameter\c!inbetween}% + \doifelse{\interactionmenuparameter\c!position}\v!yes\settrue\setfalse\scrn_menu_positioning + \scrn_menu_set_align + \setbox\scrn_menu_box\vbox to \scrn_menu_used_height \bgroup + \hsize\scrn_menu_used_width + \scrn_menu_left_align + \interactionmenuparameter\c!before\relax + \ignorespaces#content\unskip + \interactionmenuparameter\c!after + \scrn_menu_right_align + \egroup + \ifconditional\scrn_menu_positioning + \scrn_menu_whole_position + \fi + \box\scrn_menu_box + \endgroup} + +\def\scrn_menu_package_horizontal#content% + {\begingroup + \global\scrn_menu_position\zerocount + \def\scrn_menu_between_action_indeed{\interactionmenuparameter\c!middle}% + \doifelse{\interactionmenuparameter\c!position}\v!yes\settrue\setfalse\scrn_menu_positioning + \setbox\scrn_menu_box\hbox to \scrn_menu_used_width \bgroup + \interactionmenuparameter\c!left\relax + \ignorespaces#content\unskip + \interactionmenuparameter\c!right + \egroup + \ifconditional\scrn_menu_positioning + \scrn_menu_whole_position + \fi + \box\scrn_menu_box + \endgroup} + +\def\scrn_menu_action_start + {\dontleavehmode + \begingroup} + +\def\scrn_menu_action_stop + {\ifconditional\scrn_button_skipped \else + \scrn_menu_between_action_indeed + \fi + \endgroup + \ignorespaces} + +\unexpanded\def\scrn_menu_raw_start[#action]#text\stopraw + {\scrn_menu_action_start + \gotobox{\ignorespaces#text\unskip}[#action]% + \scrn_menu_action_stop} + +\unexpanded\def\scrn_menu_but_start[#action]#text\stopbut + {\scrn_menu_action_start + \ifconditional\scrn_menu_positioning + \expandafter\scrn_button_make_position + \else + \expandafter\scrn_button_make + \fi\??am\currentinteractionmenu\interactionmenuparameter{#text}{#action}% + \scrn_menu_action_stop} + +\def\scrn_button_make_position#namespace#current#currentparameter#text#action% + {\global\advance\scrn_menu_position\plusone + \doifreferencefoundelse{#action}% 0=not found, 1=same page, >1=elsewhere + {\scrn_menu_page_mode\ifnum\currentreferencerealpage=\realpageno\plusone\else\plustwo\fi}% + {\scrn_menu_page_mode\plustwo}% + \doglobal\appendetoks + \scrn_menu_button_mp_template + \to \scrn_menu_mp_data + \hpos + {\askedinteractionmenulocation:\number\scrn_menu_position}% + {\scrn_button_make{#namespace}{#current}{#currentparameter}{#text}{#action}}} + +\unexpanded\def\scrn_menu_got_start[#action]#text\stopgot + {\scrn_menu_action_start + \setupbuttons[\currentinteractionmenu][\c!frame=\v!off,\c!background=]% + \scrn_button_make\??am\currentinteractionmenu\interactionmenuparameter{#text}{#action}% + \scrn_menu_action_stop} + +\unexpanded\def\scrn_menu_nop_start#text\stopnop + {\scrn_menu_action_start + \localframedwithsettings + [\??am:\currentinteractionmenu]% + [\c!frame=\v!off,\c!background=,\c!empty=\v!yes]% + {\ignorespaces#text\removeunwantedspaces}% + \scrn_menu_action_stop} + +\unexpanded\def\scrn_menu_txt_start#text\stoptxt + {\scrn_menu_action_start + \localframedwithsettings + [\??am:\currentinteractionmenu]% + [\c!frame=\v!off,\c!background=]% + {\ignorespaces#text\removeunwantedspaces}% + \scrn_menu_action_stop} + +\unexpanded\def\scrn_menu_rul_start#text\stoprul + {\scrn_menu_action_start + \directlocalframed + [\??am:\currentinteractionmenu]% + {\ignorespaces#text\removeunwantedspaces}% + \scrn_menu_action_stop} + +\unexpanded\def\scrn_menu_com_start#text\stopcom + {\ignorespaces#text\removeunwantedspaces + \ignorespaces} + +\unexpanded\def\scrn_menu_raw#content\\{\scrn_menu_raw_start#content\stopraw} \let\stopraw\relax +\unexpanded\def\scrn_menu_but#content\\{\scrn_menu_but_start#content\stopbut} \let\stopbut\relax +\unexpanded\def\scrn_menu_got#content\\{\scrn_menu_got_start#content\stopgot} \let\stopgot\relax +\unexpanded\def\scrn_menu_nop#content\\{\scrn_menu_nop_start#content\stopnop} \let\stopnop\relax +\unexpanded\def\scrn_menu_txt#content\\{\scrn_menu_nop_start#content\stoptxt} \let\stoptxt\relax +\unexpanded\def\scrn_menu_rul#content\\{\scrn_menu_rul_start#content\stoprul} \let\stoprul\relax +\unexpanded\def\scrn_menu_com#content\\{\scrn_menu_com_start#content\stopcom} \let\stopcom\relax + +\newtoks\everysetmenucommands % public + +\appendtoks + \let\raw\scrn_menu_raw \let\startraw\scrn_menu_raw_start + \let\but\scrn_menu_but \let\startbut\scrn_menu_but_start + \let\got\scrn_menu_got \let\startgot\scrn_menu_got_start + \let\nop\scrn_menu_nop \let\startnop\scrn_menu_nop_start + \let\txt\scrn_menu_txt \let\starttxt\scrn_menu_txt_start + \let\rul\scrn_menu_rul \let\startrul\scrn_menu_rul_start + \let\com\scrn_menu_com \let\startcom\scrn_menu_com_start +\to \everysetmenucommands + +%D Sometimes handy: +%D +%D \starttyping +%D \setupinteractionmenu +%D [left] +%D [state=local] +%D +%D \startinteractionmenu[right] +%D ... +%D \includemenu[left] +%D ... +%D \stopinteractionmenu +%D \stoptyping + +\unexpanded\def\includemenu[#tag]% + {\begingroup + \edef\currentinteractionmenu{#tag}% + \doif{\interactionmenuparameter\c!state}\v!local + {\letinteractionmenuparameter\c!state\v!start + \setinteractionmenuparameter\s!parent{\??am\askedinteractionmenulocation}% nice hack + \interactionmenuparameter\c!menu}% + \endgroup} + +%D Direct call (todo): + +\unexpanded\def\interactionmenu + {\dodoubleempty\scrn_menu_interaction_menu} + +\def\scrn_menu_interaction_menu[#tag][#settings]% + {\begingroup + \setupinteractionmenu[#tag][#settings]% +% \edef\currentinteractionmenu {#tag}% +% \edef\askedinteractionmenulocation {\interactionmenuparameter\c!category}% +% \edef\askedinteractionmenualternative{\interactionmenuparameter\c!alternative}% +% \def\scrn_menu_actions#dummy{\scrn_menu_package_indeed\currentinteractionmenu}% +% \csname\??am:\c!menu:\askedinteractionmenualternative\endcsname + \scrn_menu_insert{#tag}% + \endgroup} + +%D Plugin handler: + +\unexpanded\def\scrn_menu_insert_content_indeed + {\iflocation % here as we can have a fast turn-off + \expandafter\firstofoneargument + \else + \expandafter\gobbleoneargument + \fi} + +\let\scrn_menu_insert_content_ignore\gobbleoneargument + +\appendtoks + \doifelse{\interactionparameter\c!menu}\v!on + {\let\scrn_menu_insert_content\scrn_menu_insert_content_indeed}% + {\let\scrn_menu_insert_content\scrn_menu_insert_content_ignore}% +\to \everysetupinteraction + +%D Plugs into the page builder: + +\unexpanded\def\scrn_menu_leftedge + {\hbox to \leftedgewidth \bgroup + \hsize\leftedgewidth + %\csname\??tk\v!leftedge\c!left\endcsname + \settrue\scrn_menu_zerodimensions + \scrn_menu_insert\v!left + %\csname\??tk\v!leftedge\c!right\endcsname + \egroup + \hskip-\leftedgewidth} + +\unexpanded\def\scrn_menu_rightedge + {\hbox to \rightedgewidth \bgroup + \hsize\rightedgewidth + %\csname\??tk\v!rightedge\c!left\endcsname + \settrue\scrn_menu_zerodimensions + \scrn_menu_insert\v!right + %\csname\??tk\v!rightedge\c!right\endcsname + \egroup + \hskip-\rightedgewidth} + +\unexpanded\def\scrn_menu_top % uses \??tk + {\vbox to \topheight \bgroup + \vsize\topheight + %\csname\??tk\v!top\c!before\endcsname + \settrue\scrn_menu_zerodimensions + \scrn_menu_insert\v!top + %\csname\??tk\v!top\c!after\endcsname + \kern\zeropoint + \egroup + \vskip-\topheight} + +\unexpanded\def\scrn_menu_bottom % uses \??tk + {\vbox to \bottomheight \bgroup + \vsize\bottomheight + %\csname\??tk\v!bottom\c!before\endcsname + \settrue\scrn_menu_zerodimensions + \scrn_menu_insert\v!bottom + %\csname\??tk\v!bottom\c!after\endcsname + \kern\zeropoint + \egroup + \vskip-\bottomheight} + +\appendtoks \scrn_menu_insert_content\scrn_menu_leftedge \to \leftedgetextcontent +\appendtoks \scrn_menu_insert_content\scrn_menu_rightedge \to \rightedgetextcontent +\appendtoks \scrn_menu_insert_content\scrn_menu_top \to \toptextcontent +\appendtoks \scrn_menu_insert_content\scrn_menu_bottom \to \bottomtextcontent + +%D Initialization (root definitions, main builders): + +\defineinteractionmenu [\v!vertical] [\c!alternative=\v!vertical] +\defineinteractionmenu [\v!horizontal] [\c!alternative=\v!horizontal] + +%D Initialization (parent definitions, 4 area builders): + +\defineinteractionmenu [\v!right ] [\v!right ] [\v!vertical ] +\defineinteractionmenu [\v!left ] [\v!left ] [\v!vertical ] +\defineinteractionmenu [\v!top ] [\v!top ] [\v!horizontal] +\defineinteractionmenu [\v!bottom] [\v!bottom] [\v!horizontal] + +\setupinteraction + [\c!menu=\v!off] + +\setupinteractionmenu + [\c!offset=.25em, + \c!position=\v!no, + \c!frame=\v!on, + \c!maxwidth=\hsize, + \c!maxheight=\vsize, + \c!background=, + \c!backgroundcolor=, + \c!foregroundstyle=\interactionmenuparameter\c!style, + \c!foregroundcolor=\interactionmenuparameter\c!color, + \c!style=\interactionparameter\c!style, + \c!color=\interactionparameter\c!color, + \c!contrastcolor=\interactionparameter\c!contrastcolor, + \c!state=\v!start, + \c!samepage=\v!yes, + \c!unknownreference=\v!empty, + \c!distance=\bodyfontsize, + \c!topoffset=\zeropoint, + \c!bottomoffset=\zeropoint, + \c!leftoffset=\zeropoint, + \c!rightoffset=\zeropoint] + +\setupinteractionmenu + [\v!vertical] % not really a menu + [\c!inbetween=\blank, + \c!before=, + \c!after=\vfil, + %\c!width=\v!fit, + \c!height=\v!broad] + +\setupinteractionmenu + [\v!horizontal] % not really a menu + [\c!middle=\hfil, + %\c!left=\hss, + %\c!right=\hss, + \c!width=\v!fit, + \c!height=\v!broad] + +\setupinteractionmenu + [\v!left] + [\c!itemalign=\v!flushright, + \c!maxwidth=\leftedgewidth, + \c!maxheight=\makeupheight] + +\setupinteractionmenu + [\v!right] + [\c!itemalign=\v!flushleft, + \c!maxwidth=\rightedgewidth, + \c!maxheight=\makeupheight] + +\setupinteractionmenu + [\v!top] + [\c!itemalign=\v!high, + \c!maxwidth=\makeupwidth, + \c!maxheight=\topheight] + +\setupinteractionmenu + [\v!bottom] + [\c!itemalign=\v!low, + \c!maxwidth=\makeupwidth, + \c!maxheight=\bottomheight] + +%D Lists: + +\setvalue{\@@dodolistelement\v!left }{\def\dosomelistelement{\scrn_menu_list_element\v!left }} +\setvalue{\@@dodolistelement\v!right }{\def\dosomelistelement{\scrn_menu_list_element\v!right }} +\setvalue{\@@dodolistelement\v!top }{\def\dosomelistelement{\scrn_menu_list_element\v!top }} +\setvalue{\@@dodolistelement\v!bottom}{\def\dosomelistelement{\scrn_menu_list_element\v!bottom}} + +\def\scrn_menu_list_element#1#2#3#4#5#6#7% + {\startbut[internal(#3)] + \limitatetext{#5}{\namedlistparameter{#2}\c!maxwidth}\unknown% + \stopbut} + +%D Sometimes handy: + +\unexpanded\def\menubutton % tag settings text action + {\dodoubleempty\scrn_menu_menu_button} + +\def\scrn_button_direct_status + {\doifelse{\buttonparameter\c!state}\v!start + {\dosingleempty\scrn_button_direct_indeed}% + {\dosingleempty\scrn_button_direct_ignore}} + +\def\scrn_menu_menu_button + {\iflocation + \expandafter\scrn_menu_menu_button_indeed + \else + \expandafter\scrn_menu_menu_button_ignore + \fi} + +\def\scrn_menu_menu_button_indeed[#menutag][#settings]#text[#action]% + {\ifsecondargument + \scrn_menu_menu_button_a + {#menutag}{#settings}{#text}{#action}% + \else + \doifassignmentelse{#menutag}\scrn_menu_menu_button_b\scrn_menu_menu_button_c{#menutag}{#text}{#action}% + \fi} + +\def\scrn_menu_menu_button_ignore[#menutag][#settings]#text[#action]% + {} + +\def\scrn_menu_menu_button_a#tag#settings#text#action% + {\doif{\interactionmenuparameter\c!state}\v!start + {\dontleavehmode \begingroup + \setupinteractionmenu[#tag][#settings]% + \scrn_button_make\??am{#tag}\menuparameter{#text}{#action}% + \endgroup}} + +\def\scrn_menu_menu_button_b#settings#text#action% + {\doif{\buttonparameter\c!state}\v!start + {\dontleavehmode \begingroup + \setupbuttons[#settings]% + \scrn_button_make\??bt\empty\buttonparameter{#text}{#action}% + \endgroup}} + +\def\scrn_menu_menu_button_c#tag#text#action% + {\doif{\interactionmenuparameter\c!state}\v!start + {\dontleavehmode \begingroup + \scrn_button_make\??am{#tag}\menuparameter{#text}{#action}% + \endgroup}} + +%D Untested: + +\unexpanded\def\registermenubuttons + {\dodoubleempty\scrn_menu_register_menu_buttons} + +\def\scrn_menu_register_menu_buttons[#menu][#register]% + {\ifsecondargument + \ctxcommand{registerbuttons("menu","#register","\currentlanguage")} + \else + \ctxcommand{registerbuttons("","#menu","\currentlanguage")} + \fi} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/scrn-fld.lua b/Master/texmf-dist/tex/context/base/scrn-fld.lua new file mode 100644 index 00000000000..439de13b3f5 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/scrn-fld.lua @@ -0,0 +1,76 @@ +if not modules then modules = { } end modules ['scrn-fld'] = { + version = 1.001, + comment = "companion to scrn-fld.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- we should move some code from lpdf-fld to here + +local fields = { } +interactions.fields = fields + +local codeinjections = backends.codeinjections +local nodeinjections = backends.nodeinjections + +local function define(specification) + codeinjections.definefield(specification) +end + +local function defineset(name,set) + codeinjections.definefield(name,set) +end + +local function clone(specification) + codeinjections.clonefield(specification) +end + +local function insert(name,specification) + return nodeinjections.typesetfield(name,specification) +end + +fields.define = define +fields.defineset = defineset +fields.clone = clone +fields.insert = insert + +commands.definefield = define +commands.definefieldset = defineset +commands.clonefield = clone + +function commands.insertfield(name,specification) + tex.box["scrn_field_box_body"] = insert(name,specification) +end + +-- (for the monent) only tex interface + +function commands.getfieldcategory(name) + local g = codeinjections.getfieldcategory(name) + if g then + context(g) + end +end + +function commands.getdefaultfieldvalue(name) + local d = codeinjections.getdefaultfieldvalue(name) + if d then + context(d) + end +end + +function commands.setformsmethod(method) + codeinjections.setformsmethod(method) +end + +function commands.doiffieldcategoryelse(name) + commands.testcase(codeinjections.validfieldcategory(name)) +end + +function commands.doiffieldsetelse(tag) + commands.testcase(codeinjections.validfieldset(name)) +end + +function commands.doiffieldelse(name) + commands.testcase(codeinjections.validfield(name)) +end diff --git a/Master/texmf-dist/tex/context/base/scrn-fld.mkiv b/Master/texmf-dist/tex/context/base/scrn-fld.mkiv deleted file mode 100644 index f895089e884..00000000000 --- a/Master/texmf-dist/tex/context/base/scrn-fld.mkiv +++ /dev/null @@ -1,686 +0,0 @@ -%D \module -%D [ file=scrn-fld, -%D version=1997.05.18, -%D title=\CONTEXT\ Screen Macros, -%D subtitle=Fields, -%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 Screen Macros / Fields} - -\unprotect - -%D First we hook fields into the (viewer based) layering mechanism -%D (implemented as properties). - -\appendtoks - \doif\@@iafieldlayer\v!auto{\def\@@iafieldlayer{\currentviewerlayer}}% -\to \everysetupinteraction - -\setupinteraction - [\c!fieldlayer=\v!auto] % auto by default - -%D \starttyping -%D \definefield [name] [type] [group] [values] [default] -%D -%D \definefield [WWWW] [text] [textsetup] [default text] -%D \definefield [XXXX] [push] [pushsetup] [yes,no] [yes] -%D \definefield [XXXX] [check] [checksetup] [yes,no] [yes] -%D \definefield [YYYY] [combo] [combosetup] [a,b,c,d] [b] -%D \definefield [ZZZZ] [radio] [radiosetup] [W,X,Y,Z] [Y] -%D -%D \definesubfield [W] [subsetup] [p,q] -%D \definesubfield [X,Y] [subsetup] [p,r] -%D \definesubfield [Z] [subsetup] [y,z] -%D -%D evt \definemainfield ... wanneer geplaatst voor subs gegeven -%D -%D \clonefield [XXXX] [XX,YY] [mysetup] [on,off] -%D \clonefield [Z] [AA,BB] [somesetup] [true,false] -%D \clonefield [Z] [CC,DD] [anothersetup] -%D -%D \copyfield [XXXX] [PP,QQ,RR] -%D -%D \field[XXXX] -%D \fitfield[XXXX] -%D \stoptyping - -%D Internal command, linked to \type{\definesymbol}. - -\def\dogetfieldsymbol#1% - {\getobject{SYM}{#1}} - -\def\dopresetfieldsymbol#1% - {\doifobjectfoundelse{SYM}{#1} - {} - {\settightobject{SYM}{#1}\hbox{\symbol[#1]}% - \flushatshipout - {\setbox0\hbox{\hskip-\maxdimen\getobject{SYM}{#1}}% - \smashbox0\box0}}} - -\def\presetfieldsymbols[#1]% slow - {\def\dopresetfieldsymbols##1{\processcommalist[##1]\dopresetfieldsymbol}% - \@EA\processcommalist\@EA[#1]\dopresetfieldsymbols} - -\unexpanded\def\definedefaultsymbols - {\definesymbol[defaultyes][\mathematics{\times}]% - \definesymbol[defaultno ][\mathematics{\cdot }]} - -\def\resetfieldsymbol[#1]% for experimental usage only - {\resetobject{SYM}{#1}} - -%D The interface to the specials. DEFAULT NOG ANDERS - -\def\typesetfield - {\bgroup - \dosetfontattribute\??fd\c!style - \ctxlua{backends.codeinjections.typesetfield("\currentfieldname", { - title = "\currentfieldname", - width = \number\dimexpr\@@fdwidth\relax, - height = \number\dimexpr\@@fdheight\relax, - align = "\@@fdalign", - length = tonumber("\@@fdn") or 0, - style = "\@@fdstyle", - fontstyle = "\fontstyle", - fontalternative = "\fontalternative", - fontsize = "\currentfontbodysize", - color = "\@@fdcolor", - backgroundcolor = "\@@fdfieldbackgroundcolor", - framecolor = "\@@fdfieldframecolor", - layer = "\@@fdfieldlayer", - options = "\@@fdoption", - align = "\@@fdalign", - clickin = "\@@fdclickin", - clickout = "\@@fdclickout", - regionin = "\@@fdregionin", - regionout = "\@@fdregionout", - afterkey = "\@@fdafterkey", - format = "\@@fdformat", - validate = "\@@fdvalidate", - calculate = "\@@fdcalculate", - focusin = "\@@fdfocusin", - focusout = "\@@fdfocusout", - }) }% - \egroup} - -\unexpanded\def\definefieldset {\dodoubleargument\dodefinefieldset} -\unexpanded\def\definefield {\doquintupleempty\dodefinefield} -\unexpanded\def\definemainfield{\doquintupleempty\dodefinefield} % redundant -\unexpanded\def\definesubfield {\dotripleempty \dodefinesubfield} -\unexpanded\def\clonefield {\doquadrupleempty\doclonefield} -\unexpanded\def\copyfield {\dodoubleempty \docopyfield} -\unexpanded\def\field {\dodoubleempty \donormalfield} -\unexpanded\def\fitfield {\dodoubleempty \dofitfield} -\unexpanded\def\setupfield {\doquintupleempty\dosetupfield} -\unexpanded\def\setupfields {\doquadrupleempty\dosetupfields} - -% misc - -% \appendtoks\ctxlua{backends.codeinjections.finishfields()}\to\everylastshipout - -% testing - -\def\doiffieldelse #1{\ctxlua{backends.codeinjections.doiffieldelse("#1")}} -\def\doiffieldgroupelse#1{\ctxlua{backends.codeinjections.doiffieldgroupelse("#1")}} - -% definition - -\def\dodefinefield[#1][#2][#3][#4][#5]% [name] [kind] [group] [values] [default] | [name] [kind] [group] [default] - {\ctxlua{backends.codeinjections.definefield{ variant="normal", name="#1", kind="#2", group="#3", values=\!!bs#4\!!es, default=\!!bs#5\!!es }}} - -\def\dodefinesubfield[#1][#2][#3]% [name] [group] [values] - {\ctxlua{backends.codeinjections.definefield{ variant="normal", name="#1", kind="sub", group="#2", values=\!!bs#3\!!es }}} - -\def\doclonefield[#1][#2][#3][#4]% [parent] [children] [group] [values] - {\ctxlua{backends.codeinjections.clonefield{ variant="clone", parent="#1", children="#2", group="#3", values=\!!bs#4\!!es }}} - -\def\docopyfield[#1][#2]% [parent] [children] - {\ctxlua{backends.codeinjections.clonefield{ variant="copy", parent="#1", children="#2" }}} - -\def\dodefinefieldset[#1][#2]% - {\ctxlua{backends.codeinjections.definefieldset("#1","#2")}} - -% usage -% -% \iftrialtypesetting -% -% just a default setup - -\def\loadfieldscripts{\useJSscripts[fld]\globallet\loadfieldscripts\relax} - -\def\donormalfield{\doprocessfield\dohandlefield} -\def\dofitfield {\doprocessfield\dohandlefitfield} - -\def\dosetupfieldindeed#1#2[#3]% [#4][#5][#6][#7]% - {#1[#2]} % [#4][#5][#6][#7]} - -\def\doprocessfield#1[#2][#3]% \method [name] [label] - {\dontleavehmode - \begingroup - \loadfieldscripts - \edef\currentfieldname {#2}% - \edef\currentfieldlabel{#3}% - \edef\currentfieldgroup{\ctxlua{backends.codeinjections.getfieldgroup("#2")}}% - \ifx\currentfieldlabel\empty - \let\currentfieldlabel\currentfieldname - \fi - \ifx\currentfieldgroup\empty - #1[#2][\v!label,\v!frame,\v!horizontal][][][]% - \else - \def\dosetupfield{\dosetupfieldindeed{#1}{#2}}% - \getvalue{\??fd::\currentfieldgroup}% - \fi - \endgroup} - -% setups - -\def\dosetupfield[#1][#2][#3][#4][#5]% - {\iffifthargument - \def\docommand##1{\dodosetupfield[##1][#2][#3][#4][#5]}% - \processcommalist[#1]\docommand - \else\ifthirdargument - \def\docommand##1{\dodosetupfield[##1][#2][][][#3]}% - \processcommalist[#1]\docommand - \else\ifsecondargument - \doifelse{#2}\v!reset - {\def\docommand##1{\donosetupfield[#1][][][][]}} - {\def\docommand##1{\dodosetupfield[##1][][][][#2]}}% - \processcommalist[#1]\docommand - \else\iffirstargument - \def\docommand##1{\dodosetupfield[##1][][][][]}% - \processcommalist[#1]\docommand - \else - \writestatus\m!fields{provide either 1, 2, 3 or 5 arguments}% - \fi\fi\fi\fi} - -\def\normaldodosetupfield[#1][#2][#3][#4][#5]% - {\ifcsname\??fd::#1\endcsname - \pushmacro\dosetupfield - \def\dosetupfield[##1][##2][##3][##4][##5]{\setvalue{\??fd::#1}{\dosetupfield[#1][##2,#2][##3,#3][##4,#4][##5,#5]}}% - \getvalue{\??fd::#1}% - \popmacro\dosetupfield - \else - \setvalue{\??fd::#1}{\dosetupfield[#1][#2][#3][#4][#5]}% - \fi} - -\let\dodosetupfield\normaldodosetupfield - -\def\donosetupfield[#1][#2][#3][#4][#5]% - {\setvalue{\??fd::#1}{\dosetupfield[#1][#2][#3][#4][#5]}} - -\def\dosetupfields[#1][#2][#3][#4]% - {\ifsecondargument - \def\dodosetupfield[##1][##2][##3][##4][##5]% - {\ifcsname\??fd::##1\endcsname - \def\dosetupfield[####1][####2][####3][####4][####5]% - {\setvalue{\??fd::##1}{\dosetupfield[##1][#1,####2,##2][#2,####3,##3][#3,####4,##4][#4,####5,##5]}}% - \getvalue{\??fd::##1}% - \else - \setvalue{\??fd::##1}{\dosetupfield[##1][#1,##2][#2,##3][#3,##4][#4,##5]}% - \fi}% - \else\iffirstargument - \doifelse{#1}\v!reset - {\resetfields} - {\setupfields[][][][#1]}% checken - \else - \writestatus\m!fields{provide either 1 or 4 arguments}% - \fi\fi} - -\def\resetfields - {\let\dodosetupfield\normaldodosetupfield} - -% \setupfields[\v!reset] - -% opties: veld, label, kader, vertikaal/horizontaal - -\newif\ifShowFieldLabel -\newif\ifShowFieldFrame -\newif\ifVerticalField -\newif\ifHorizontalField - -% way to slow/complicated, we need some simple alternative -% as well - -\def\dohandlefield[#1][#2][#3][#4][#5]% - {\presetlocalframed[\??fd]% - \processallactionsinset - [#2] - [ \v!reset=>\ShowFieldLabelfalse\ShowFieldFramefalse\HorizontalFieldfalse\VerticalFieldfalse, - \v!label=>\ShowFieldLabeltrue, - \v!frame=>\ShowFieldFrametrue, - \v!horizontal=>\HorizontalFieldtrue, - \v!vertical=>\VerticalFieldtrue]% - \ifVerticalField - \getparameters[\??fd][\c!distance=\zeropoint,\c!inbetween=\vskip\@@localoffset,\c!align=\v!right,\c!width=20em]% - \else\ifHorizontalField - \getparameters[\??fd][\c!distance=\@@localoffset,\c!inbetween=,\c!align=\c!left,\c!height=10ex]% - \else - \getparameters[\??fd][\c!distance=\zeropoint,\c!inbetween=,\c!align=\c!left]% - \fi\fi - \getparameters[\??fd][\c!n=,\c!before=,\c!after=\vss,\c!style=,\c!color=,#3]% - \ifShowFieldFrame - \localframed[\??fd][\c!strut=\v!no,\c!align=]\bgroup - \else - \vbox\bgroup - \fi - \dontcomplain - \ifShowFieldLabel - \setbox0\hbox - {\reshapeframeboxtrue % else wrong dimensions - \framed - [\c!style=,\c!color=,\c!align=\c!right,#4] - {\currentfieldlabel}}% - \fi - \setbox2\hbox - {\reshapeframeboxtrue % else wrong dimensions - \ifVerticalField - \setupframed[\c!height=6ex,\c!width=\hsize]% - \else\ifHorizontalField - \setupframed[\c!height=\vsize,\c!width=20em]% - \else - \setupframed[\c!height=2cm,\c!width=2cm]% - \fi\fi - \framed - [\c!align=\v!right,\c!strut=\v!no,#5] - {\getparameters - [\??fd] - [\c!color=,\c!style=,\c!align=\v!right,\c!option=, - \c!clickin=,\c!clickout=,\c!regionin=,\c!regionout=, - \c!afterkey=,\c!format=,\c!validate=,\c!calculate=, - \c!focusin=,\c!focusout=, - \c!fieldoffset=-\framedoffset,\c!fieldbackgroundcolor=, - \c!fieldframecolor=,\c!fieldlayer=\@@iafieldlayer,#5]% - \scratchdimen\framedwidth \edef\@@fdwidth {\the\scratchdimen}% - \scratchdimen\framedheight\edef\@@fdheight{\the\scratchdimen}% - \vfill - \hbox{\lower\@@fdfieldoffset\hbox{\typesetfield}} - \vss}}% - \ifShowFieldLabel - \ifVerticalField - \vbox - {\copy0 - \@@fdinbetween - \copy2}% - \else - \hbox - {\vbox \ifdim\ht2>\ht0 to \ht2 \fi - {\@@fdbefore - \copy0 - \@@fdafter}% - \hskip\@@fddistance - \vbox \ifdim\ht0>\ht2 to \ht0 \fi - {\@@fdbefore - \box2 - \@@fdafter}}% - \fi - \else - \box2 - \fi - \egroup} - -\chardef\fitfieldmode\plusone % 3 = best - -\def\dohandlefitfield[#1][#2][#3][#4][#5]% alleen check - {\presetlocalframed[\??fd]% - \localframed - [\??fd] - [\c!n=1024, % beware: weblink plug in truncates - \c!strut=\v!no,\c!color=,\c!style=,\c!option=, - \c!clickin=,\c!clickout=,\c!regionin=,\c!regionout=, - \c!focusin=,\c!focusout=, - \c!afterkey=,\c!format=,\c!validate=,\c!calculate=, - \c!fieldoffset=\zeropoint,\c!fieldbackgroundcolor=, - \c!fieldframecolor=,\c!fieldlayer=\@@iafieldlayer,#5,\c!align=] - {\edef\defaultfield{\ctxlua{backends.codeinjections.getdefaultfieldvalue("#1")}}% - % \dopresetsymbol\defaultfield - \setbox\scratchbox\hbox{\symbol[\defaultfield]}% - \edef\@@fdwidth {\the\wd\scratchbox}% - \ifcase\fitfieldmode - \edef\@@fdheight{\the\ht\scratchbox}% - \typesetfield - \or % 1 = ignore depth (original, assumed no depth, actually a bug) - \edef\@@fdheight{\the\ht\scratchbox}% - \vbox to \ht\scratchbox{\vfill\hbox to \wd\scratchbox{\typesetfield\hfill}\vss}% - \or % 2 = add depth to height, but no depth in result - \edef\@@fdheight{\the\htdp\scratchbox}% - \vbox to \ht\scratchbox{\vfill\hbox to \wd\scratchbox{\typesetfield\hfill}\vss}% - \or % 3 = add depth to height, and apply depth to result - \edef\@@fdheight{\the\htdp\scratchbox}% - \hbox to \wd\scratchbox{\lower\dp\scratchbox\hbox{\typesetfield}\hfill}% - \fi}} - -%D Common stuff - -\newcount\nofsystemfields - -\def\nextsystemfield - {\global\advance\nofsystemfields\plusone - \def\currentsystemfield{sys::\number\nofsystemfields}} - -%D An example: - -\def\fillinfield - {\dosingleempty\dofillinfield} - -\def\dofillinfield[#1]#2% - {\dontleavehmode - \hbox - {\forgetall - \setupfields[\v!reset]% - \nextsystemfield - \useJSscripts[ans]% - \doifelsenothing{#1} - {\def\therightanswer{#2}} - {\def\therightanswer{#1}}% - \setbox0\hbox{#2}% - \setbox2\hbox{\therightanswer}% - \dimen0=\ifdim\wd0>\wd2 \wd0 \else \wd2 \fi - \advance\dimen0 .2em - \definefield - [\currentsystemfield][line][systemfield]% - \setupfield - [systemfield] - [\c!n=1024, % beware: weblink plugin truncates - \c!location=\v!low,\c!strut=\v!yes,\c!fieldoffset=\zeropoint, - \c!height=1.2\openlineheight,\c!width=\dimen0,\c!offset=\v!overlay, - \c!style=,\c!align=\v!middle,\c!frame=\v!off, - \c!color=red,\c!fieldbackgroundcolor=\s!white,\c!fieldframecolor=blue, - \c!validate=JS(Check_Answer{\currentsystemfield,\therightanswer})]% - \switchtobodyfont - [\c!small]% - \hbox to \wd0 - {\copy0\hskip-\wd0\hss\field[\currentsystemfield]\hss}}} - -%D and another one: - -\def\tooltip - {\dosingleempty\dotooltip} - -\def\dotooltip[#1]#2#3% - {\dontleavehmode - \begingroup - \setupfields[\v!reset]% - \useJSscripts[fld]% - \setbox0\hbox - {\dontcomplain - \nextsystemfield - \setbox0\hbox{#2}% - \definesymbol - [\currentsystemfield:txt] - [{\inframed[\c!frame=\v!off,\c!background=\v!screen]{#3}}]% - \setbox2\hbox{\symbol[\currentsystemfield:txt]}% - \definefield - [\currentsystemfield:txt][check] - [dummy][\currentsystemfield:txt][\currentsystemfield:txt]% - \setupfield - [dummy] - [\c!frame=\v!off, - \c!regionout=JS(Hide_Field{\currentsystemfield:txt}), - \c!option=\v!hidden]% - \hbox to \zeropoint - {\dimen0\wd2\advance\dimen0 -\wd0 - \doifelse{#1}\v!left - {\hskip-\dimen0} - {\doif{#1}\v!middle - {\hskip-.5\dimen0}}% - \lower\openlineheight\hbox to \zeropoint - {\fitfield[\currentsystemfield:txt]}}% - \dimen0=\ifdim\wd0=\zeropoint 3em\else\wd0\fi - \definesymbol - [\currentsystemfield:but] - [{\framed[\c!height=2ex,\c!width=\dimen0,\c!frame=\v!off]{}}]% - \definefield - [\currentsystemfield:but][push] - [dummy][\currentsystemfield:but][\currentsystemfield:but]% - \setupfield - [dummy] - [\c!frame=\v!off, - \c!option=, - \c!regionin=JS(Vide_Field{\currentsystemfield:txt}), - \c!regionout=JS(Hide_Field{\currentsystemfield:txt}), - \c!fieldlayer=\@@iafieldlayer]% - \lower2ex\hbox to \zeropoint - {\fitfield[\currentsystemfield:but]}% - #2}% - \ht0\strutht\dp0\strutdp\box0 - \endgroup} - -%D And one more: - -\unexpanded\def\definefieldstack - {\dotripleargument\dodefinefieldstack} - -\def\dodefinefieldstack[#1][#2][#3]% name, symbols, settings - {\ifcsname fieldstack:#1\endcsname \else - \setgvalue{fieldstack:#1}{\dodofieldstack[#1][#2][#3]}% - \fi} - -\def\fieldstack - {\dotripleempty\dofieldstack} - -\def\dofieldstack[#1][#2][#3]% - {\ifsecondargument - \dodefinefieldstack[#1][#2][#3]\fieldstack[#1]% - \else - \getvalue {fieldstack:#1}% - \setgvalue{fieldstack:#1}{[#1]}% - \fi} - -\def\dodofieldstack[#1][#2][#3]% start=n, 0 == leeg - {\dontleavehmode - \begingroup - \getparameters[\??fd][\c!start=1,#3]% - \setupfields[\v!reset]% - % \definesymbol[\v!empty][]% - \useJSscripts[fld][FieldStack]% - \newcounter\stackedfieldnumber - \def\dododofieldstack##1% - {\increment\stackedfieldnumber - \ifnum\stackedfieldnumber=\@@fdstart\relax - \definefield[#1:\stackedfieldnumber][check][#1][##1,\empty][##1]% \v!empty fails - \else - \definefield[#1:\stackedfieldnumber][check][#1][##1,\empty][\empty]% \v!empty fails - \fi}% - \processcommalist[#2]\dododofieldstack - \setupfield[#1][\v!reset]% added - \setupfield[#1][\c!option=\v!readonly,#3]% #3 swapped - \newcounter\stackedfieldnumber - \def\dododofieldstack##1% - {\doglobal\increment\stackedfieldnumber - \fitfield[#1:\stackedfieldnumber]\egroup\bgroup}% - \startoverlay - \bgroup - \globalprocesscommalist[#2]\dododofieldstack - \egroup - \stopoverlay - \endgroup} - -%D When submitting a form, we need to tell the driver module -%D that we want \FDF\ or \HTML. - -\newtoks\everysetupforms - -\unexpanded\def\setupforms{\dosingleempty\dosetupforms} - -\def\dosetupforms[#1] - {\getparameters[\??fr][#1]% - \the\everysetupforms} - -\appendtoks - \ctxlua{backends.codeinjections.setformsmethod("@@frmethod")}% -\to \everysetupforms - -\setupforms - [\c!method=XML] % no need for everyjob initialization as this is the default - -%D Goodie: (unchecked in \MKIV) - -\unexpanded\def\definepushbutton % name optional setup - {\dodoubleempty\dodefinepushbutton} - -\def\dodefinepushbutton[#1][#2]% name setup - {\dododefinepushbutton{#1}{n}{push}% - \dododefinepushbutton{#1}{r}{\symbol[psym:#1:n]}% - \dododefinepushbutton{#1}{d}{\symbol[psym:#1:r]}% - \setvalue{pushbutton:#1}{\dohandlepushbutton{#1}{#2}}} - -\def\dododefinepushbutton#1#2#3% - {\doifsymboldefinedelse{psym:#1:#2}% - \donothing{\definesymbol[psym:#1:#2][{#3}]}} - -\unexpanded\def\definepushsymbol - {\dotripleargument\dodefinepushsymbol} - -\def\dodefinepushsymbol[#1][#2]% [#3] - {\definesymbol[psym:#1:#2]} - -\def\dopushbutton[#1][#2]% - {\executeifdefined{pushbutton:#1}\gobbleoneargument{#2}} - -\def\pushbutton - {\dodoubleargument\dopushbutton} - -\def\dohandlepushbutton#1#2#3% identifier setup script - {\bgroup - \nextsystemfield - \setupfield - [pushbutton] - [\c!frame=\v!overlay, - \c!offset=\v!overlay, - \c!clickout=#3,#2]% - \definefield - [\currentsystemfield] - [push] - [pushbutton] - [psym:#1:n,psym:#1:r,psym:#1:d]% - \fitfield - [\currentsystemfield]% - \egroup} - -% \def\menu@psh -% {\dodoubleargument\domenu@psh} -% -% \def\domenu@psh[#1][#2]#3\\% -% {\txt\pushbutton[#1][#2]\\}% -% -%\appendtoks \let\psh\do@@ampsh \to \everysetmenucommands - -\unexpanded\def\menu@psh{\txt\pushbutton} - -\appendtoks \let\psh\menu@psh \to \everysetmenucommands - -% \definepushbutton [reset] -% -% \definepushsymbol [reset] [n] [\uniqueMPgraphic{whatever}{color=green}] -% \definepushsymbol [reset] [r] [\uniqueMPgraphic{whatever}{color=white}] -% -% \startinteractionmenu[bottom] -% \psh [reset] [JS(reset_something)] \\ -% \stopinteractionmenu - -%D Another goodie: (unchecked in \MKIV) - -% \definecolor[rollover:n][red] -% \definecolor[rollover:r][green] -% \definecolor[rollover:d][blue] - -\definepalet - [rollover] - [n=red, - r=green, - d=blue] - -\newcounter\nofrollovers -\newcounter\nofrollbuttons - -\def\dorollbutton[#1][#2]#3[#4]% - {\dontleavehmode - \bgroup - \doglobal\increment\nofrollovers - \doglobal\increment\nofrollbuttons - \unexpanded\def\dosetlocationbox[##1]##2[##3]% - {\getparameters[##1][##3]% - \definecolor[rollover][rollover:##2]% - \doifelse{##2}{n}{\doifelsevalue{##1\c!alternative}\v!hidden\phantom\hbox}\hbox - {\localframed[##1] - [\c!framecolor=rollover,\c!backgroundcolor=rollover,\c!color=rollover]% - {\dolocationattributes{##1}\c!style\c!color{#3}}}}% - \iffirstargument - \ifsecondargument - \def\setlocationbox##1{\dosetlocationbox[\??am#1]{##1}[#2]}% - \else - \doifassignmentelse{#1} - {\def\setlocationbox##1{\dosetlocationbox[\??bt]{##1}[#1]}} - {\def\setlocationbox##1{\dosetlocationbox[\??am#1]{##1}[]}}% - \fi - \else - \def\setlocationbox##1{\dosetlocationbox[\??bt]{##1}[]}% - \fi - % todo: share symbols, tricky since different dimensions - \definesymbol[rsym:\nofrollovers:n][\setlocationbox n]% - \definesymbol[rsym:\nofrollovers:r][\setlocationbox r]% - \definesymbol[rsym:\nofrollovers:d][\setlocationbox d]% - \setupfield - [rollbutton] - [\c!frame=\v!off, - \c!offset=\v!overlay, - \c!clickout={#4}]% - \definefield - [roll:\nofrollbuttons][push][rollbutton] - [rsym:\nofrollovers:n,% - rsym:\nofrollovers:r,% - rsym:\nofrollovers:d]% - \fitfield[roll:\nofrollbuttons]% - \egroup} - -\unexpanded\def\rollbutton - {\dodoubleempty\dorollbutton} - -\def\menu@rob[#1]#2\\% - {\txt\rollbutton[\currentmenu]{\ignorespaces#2\unskip}[#1]\\}% - -\appendtoks \let\rob\menu@rob \to \everysetmenucommands - -% calls: -% {..} [JS..] -% [left] {..} [JS..] -% [a=b] {..} [JS..] -% [left] [a=b] {..} [JS..] -% -% \setupbuttons[offset=0pt,frame=off] % alternative=hidden -% -% \rollbutton {Manuals} [JS(Goto_File{show-man.pdf})] -% \rollbutton {Articles} [JS(Goto_File{show-art.pdf})] -% \rollbutton {Papers} [JS(Goto_File{show-pap.pdf})] -% \rollbutton {Presentations} [JS(Goto_File{show-pre.pdf})] -% \rollbutton {Resources} [JS(Goto_File{show-res.pdf})] -% -% \rob [JS(...)] bla bla \\ - -\unexpanded\def\overlayrollbutton - {\dodoubleargument\dooverlayrollbutton} - -\def\dooverlayrollbutton[#1][#2]% - {\bgroup - \nextsystemfield - \setupfield - [overlayrollbutton] - [\c!frame=\v!off,\c!offset=\v!overlay,\c!regionin={#1},\c!regionout={#2}]% - \definesymbol - [\currentsystemfield] - [{\framed[\c!frame=\v!off,\c!width=\overlaywidth,\c!height=\overlayheight]{}}]% - \definefield - [\currentsystemfield][push][overlayrollbutton][\currentsystemfield][\currentsystemfield]% - \fitfield[\currentsystemfield]% - \egroup} - -% \defineoverlay -% [ShowMenu] -% [{\overlayrollbutton[VideLayer{navigation}][HideLayer{navigation}]}] - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/scrn-fld.mkvi b/Master/texmf-dist/tex/context/base/scrn-fld.mkvi new file mode 100644 index 00000000000..bf84f15b79f --- /dev/null +++ b/Master/texmf-dist/tex/context/base/scrn-fld.mkvi @@ -0,0 +1,972 @@ +%D \module +%D [ file=scrn-fld, +%D version=1997.05.18, +%D title=\CONTEXT\ Screen Macros, +%D subtitle=Fields, +%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. + +% There is still some leftover code from mkii, where we need to +% be sparse with hash entries and so have a somewhat complex +% setup mechanism. + +% interaction checking + +\writestatus{loading}{ConTeXt Screen Macros / Fields} + +\unprotect + +\registerctxluafile{scrn-fld}{1.001} + +%D In \MKII\ we had to cheat a bit with setups in order not to run +%D out of memory with thousands of fields, which we happen to need at +%D that time. In \MKIV\ we can store some data at the \LUA\ end and +%D use a somewhat slower but quite okay inheritance mechanism. For +%D this reason we now have split definitions, although the old method +%D is still somewhat supported. The clone and copy commands are +%D somewhat obsolete for several reasons: we can now use inheritance +%D and autocloning has been supported for a while. In most cases +%D cloning (especially with check boxes) the acrobat browser is not +%D stable enough with respect to appearance handling. +%D +%D A fieldcategory is nothing more than a collection of settings. +%D +%D \starttyping +%D \definefieldcategory +%D [all-email] +%D [height=1cm, +%D width=14cm, +%D style=sstf] +%D \stoptyping +%D +%D A definition can refer to this category: +%D +%D \starttyping +%D \definefieldbody [email] [type=line,category=all-email,default=pragma@wxs.nl] +%D \stoptyping +%D +%D A copy of a field is made as follows: +%D +%D \starttyping +%D \definefieldbody [xmail] [email] +%D \stoptyping +%D +%D You can also be more specific: +%D +%D \starttyping +%D \definefieldbody[buttona][type=check,values={one,two}] +%D \definefieldbody[buttonb][type=check,values={three,four}] +%D \definefieldbody[buttonc][buttona][values={three,four}] +%D \stoptyping +%D +%D Actually typesetting a field happens this way: +%D +%D \starttyping +%D \fieldbody [Email] +%D \fieldbody [Email] [width=6cm] +%D \fieldbody [eMAIL] +%D \fieldbody [eMAIL] [width=7cm] +%D +%D \fieldbody [buttona] +%D \fieldbody [buttona] +%D \fieldbody [buttonb] +%D \fieldbody [buttonb] +%D \fieldbody [buttonc] +%D \fieldbody [buttonc] +%D \stoptyping +%D +%D So, you can call up a field many times and quite some parameters +%D can be set. +%D +%D Because there are persistent problems with acrobat rendering +%D associated appearance streams (some messy /MK interferende) we +%D also support native (built-in dingbat) symbols: check, circle, +%D cross, diamond, square and star. +%D +%D \starttyping +%D \definefield[test1][check] +%D \definefield[test2][check] +%D +%D \fieldbody[test1][width=1em,height=\strutht,depth=\strutdp,symbol=check] +%D \fieldbody[test1][width=1em,height=\strutht,depth=\strutdp,symbol=circle] +%D \fieldbody[test2][width=1em,height=\strutht,depth=\strutdp,symbol=square] +%D \stoptyping +%D +%D When submitting a form, we need to tell the driver module +%D that we want \FDF\ or \HTML. + +\newtoks\everysetupforms + +\unexpanded\def\setupforms + {\dosingleempty\scrn_forms_setup} + +\def\scrn_forms_setup[#settings] + {\getparameters[\??fr][#settings]% + \the\everysetupforms} + +\appendtoks + \ctxcommand{setformsmethod("@@frmethod")}% +\to \everysetupforms + +\setupforms + [\c!method=XML] % no need for everyjob initialization as this is the default + +%D We need to initialize symbols in a special way so that they +%D can be used as rendering for a widget. + +\unexpanded\def\presetfieldsymbols[#list]% slow + {\processcommacommand[#list]\scrn_symbols_preset} + +\def\scrn_symbols_preset#set% + {\processcommalist[#set]\scrn_symbols_preset_indeed}% + +\def\scrn_symbols_preset_indeed#tag% + {\doifobjectfoundelse{SYM}{#tag} + {} + {\settightobject{SYM}{#tag}\hbox{\symbol[#tag]}% + \flushatshipout + {\setbox0\hbox{\hskip-\maxdimen\getobject{SYM}{#tag}}% + \smashbox0\box0}}} + +\let\dosetfieldsymbol\scrn_symbols_preset_indeed + +\def\dogetfieldsymbol#tag% + {\getobject{SYM}{#tag}} + +\unexpanded\def\definedefaultsymbols % used ? + {\definesymbol[defaultyes][\mathematics{\times}]% + \definesymbol[defaultno ][\mathematics{\cdot }]} + +% \def\resetfieldsymbol[#tag]% for experimental usage only +% {\resetobject{SYM}{#tag}} + +%D Now comes the real code: + +\installcommandhandler \??fd {fieldcategory} \??fd +\installcommandhandler \??fb {fieldbody} \??fb + +\newbox\scrn_field_box_body + +\setupfieldcategory + [\c!alternative=\v!normal, % normal clone copy + \c!type=\v!line, % line text ... + \c!width=5em, + \c!height=1em, + \c!depth=\zeropoint, + \c!align=\v!flushleft, + \c!option=\v!printable, % maybe we need a globaloptions and marge them + \c!n=1024] + +\def\scrn_field_check_category + {\edef\currentfieldbodycategory{\fieldbodyparameter\c!category}% + \ifx\currentfieldbodycategory\empty + \setevalue{\??fb\currentfieldbody\s!parent}{\??fd}% + \else + \setevalue{\??fb\currentfieldbody\s!parent}{\??fd\currentfieldbodycategory}% + \fi} + +\appendtoks % we cannot use parent .. maybe s!parent has to change + \ifx\currentfieldbodyparent\empty + \scrn_field_check_category + \ctxcommand{definefield{ + name = "\currentfieldbody", + alternative = "normal", + type = "\fieldbodyparameter\c!type", + category = "\fieldbodyparameter\c!category", + values = \!!bs\fieldbodyparameter\c!values\!!es, + default = \!!bs\fieldbodyparameter\c!default\!!es + }}% + \else + \ctxcommand{clonefield{ + children = "\currentfieldbody", + alternative = "clone", + parent = "\currentfieldbodyparent", + category = "\fieldbodyparameter\c!category", + values = \!!bs\fieldbodyparameter\c!values\!!es, + default = \!!bs\fieldbodyparameter\c!default\!!es + }}% + \fi +\to \everydefinefieldbody + +\unexpanded\def\fieldbody + {\dodoubleempty\scrn_field_body} + +\def\scrn_field_body[#tag][#settings]% + {\iflocation + \hbox\bgroup + \edef\currentfieldbody{#tag}% + \ifsecondargument + \setupfieldbody[#tag][#settings]% + \fi + \scrn_field_body_typeset + \box\scrn_field_box_body + \egroup + \fi} + +\def\scrn_field_body_typeset % todo: fieldsymbol (checkfields /MK mess) + {\edef\currentfieldframecolor{\fieldbodyparameter\c!fieldframecolor}% + \ifx\currentfieldframecolor\empty\else + \getcolorattributevalue\currentfieldframecolor\currentfieldframecolorvalue + \fi + \edef\currentfieldbackgroundcolor{\fieldbodyparameter\c!fieldbackgroundcolor}% + \ifx\currentfieldbackgroundcolor\empty\else + \getcolorattributevalue\currentfieldbackgroundcolor\currentfieldbackgroundcolorvalue + \fi + \dosetfieldbodyattributes\c!style\c!color + \ctxcommand{insertfield("\currentfieldbody", { + title = "\currentfieldbody", + width = \number\dimexpr\fieldbodyparameter\c!width \relax, + height = \number\dimexpr\fieldbodyparameter\c!height\relax, + depth = \number\dimexpr\fieldbodyparameter\c!depth \relax, + align = "\fieldbodyparameter\c!align", + length = "\fieldbodyparameter\c!n", + style = "\fieldbodyparameter\c!style", + fontstyle = "\fontstyle", + fontalternative = "\fontalternative", + fontsize = "\fontbody", + fontsymbol = "\fieldbodyparameter\c!symbol", + color = "\fieldbodyparameter\c!color", + colorvalue = \number\attribute\colorattribute, + \ifx\currentfieldbackgroundcolor\empty \else + backgroundcolor = "\currentfieldbackgroundcolor", + backgroundcolorvalue = "\currentfieldbackgroundcolorvalue", + \fi + \ifx\currentfieldframecolor\empty \else + framecolor = "\currentfieldframecolor", + framecolorvalue = "\currentfieldframecolorvalue", + \fi + layer = "\fieldbodyparameter\c!fieldlayer", + option = "\fieldbodyparameter\c!option", + align = "\fieldbodyparameter\c!align", + clickin = "\fieldbodyparameter\c!clickin", + clickout = "\fieldbodyparameter\c!clickout", + regionin = "\fieldbodyparameter\c!regionin", + regionout = "\fieldbodyparameter\c!regionout", + afterkey = "\fieldbodyparameter\c!afterkey", + format = "\fieldbodyparameter\c!format", + validate = "\fieldbodyparameter\c!validate", + calculate = "\fieldbodyparameter\c!calculate", + focusin = "\fieldbodyparameter\c!focusin", + focusout = "\fieldbodyparameter\c!focusout", + openpage = "\fieldbodyparameter\c!openpage", + closepage = "\fieldbodyparameter\c!closepage", + })}} + +%D The sets are used in grouped calculations. +%D +%D [name] [set] + +\unexpanded\def\definefieldbodyset + {\dodoubleempty\scrn_field_define_set} + +\def\scrn_field_define_set[#tag][#list]% + {\ctxcommand{definefieldset("#tag","#list")}} + +\let\dodefinefieldset\definefieldbodyset % compatibility + +%D A few testing macros: + +\def\doiffieldbodyelse #tag{\ctxcommand{doiffieldelse("#tag")}} +\def\doiffieldcategoryelse#tag{\ctxcommand{doiffieldcategoryelse("#tag")}} + +\let\doiffieldelse\doiffieldbodyelse % compatibility + +%D We still support the traditional method of defining fields: +%D +%D \starttyping +%D \definefield [name] [type] [category] [values] [default] +%D +%D \definefield [WWWW] [text] [textsetup] [default text] +%D \definefield [XXXX] [push] [pushsetup] [yes,no] [yes] +%D \definefield [XXXX] [check] [checksetup] [yes,no] [yes] +%D \definefield [YYYY] [combo] [combosetup] [a,b,c,d] [b] +%D \definefield [ZZZZ] [radio] [radiosetup] [W,X,Y,Z] [Y] +%D +%D \definesubfield [W] [subsetup] [p,q] +%D \definesubfield [X,Y] [subsetup] [p,r] +%D \definesubfield [Z] [subsetup] [y,z] +%D +%D evt \definemainfield ... wanneer geplaatst voor subs gegeven +%D +%D \clonefield [XXXX] [XX,YY] [mysetup] [on,off] +%D \clonefield [Z] [AA,BB] [somesetup] [true,false] +%D \clonefield [Z] [CC,DD] [anothersetup] +%D +%D \copyfield [XXXX] [PP,QQ,RR] +%D \stoptyping +%D +%D Keep in mind that you can also use \type {\definefieldbody} to +%D achieve the same. + +\unexpanded\def\definefield {\doquintupleempty\scrn_field_define_field} +\unexpanded\def\definesubfield{\dotripleempty \scrn_field_define_subfield} +\unexpanded\def\clonefield {\doquadrupleempty\scrn_field_clone_field} +\unexpanded\def\copyfield {\dodoubleempty \scrn_field_copy_field} + +\let\definemainfield\definefield % obsolete ! + +\def\scrn_field_define_field[#tag][#type][#category][#values][#default]% + {\definefieldbody[#tag][\c!type=#type,\c!category=#category,\c!values={#values},\c!default={#default}]} + +\def\scrn_field_define_subfield[#tag][#category][#values]% + {\definefieldbody[#tag][\c!type=sub,\c!category=#category,\c!values={#values}]} + +\def\scrn_field_clone_field[#parent][#tag][#category][#values]% + {\definefieldbody[#tag][#parent][\c!category=#category,\c!values={#values}]} + +\def\scrn_field_copy_field[#parent][#tag]% + {\definefieldbody[#tag][#parent]} + +%D We hook fields into the (viewer based) layering mechanism +%D (implemented as properties). + +\appendtoks + \doifelse{\interactionparameter\c!fieldlayer}\v!auto + {\setupfieldcategory[\c!fieldlayer=\currentviewerlayer]}% + {\setupfieldcategory[\c!fieldlayer=]}% +\to \everysetupinteraction + +\setupinteraction + [\c!fieldlayer=\v!auto] % auto by default + +%D The \type {\fieldbody} is the more bare one. One step further goes +%D \type {\fitfield}, in fact it (now) uses a dedicated instance of +%D framed: \type {fitfieldframed}. +%D +%D \starttyping +%D \ruledhbox{\fieldbody[Email][height=\strutht,depth=\strutdp,style=normal]} +%D \ruledhbox{\fitfield[Email][height=\strutht,depth=\strutdp,style=normal]} +%D \ruledhbox{\fitfield[buttona]} +%D \stoptyping + +\newbox\scrn_field_box_fit_symbol + +\defineframed + [fitfieldframed] + [\c!strut=\v!no, + \c!frame=off, + \c!offset=\v!overlay, + \c!align=] + +\unexpanded\def\fitfield + {\dodoubleempty\scrn_field_fit} + +\def\scrn_field_fit[#tag][#settings]% + {\iflocation + \begingroup + \edef\currentdefaultfieldvalue{\ctxcommand{getdefaultfieldvalue("#tag")}}% + \setbox\scrn_field_box_fit_symbol\hbox{\symbol[\currentdefaultfieldvalue]}% + \fitfieldframed[#tag] + {\fieldbody[#tag] + [\c!width=\wd\scrn_field_box_fit_symbol, + \c!height=\ht\scrn_field_box_fit_symbol, + \c!depth=\dp\scrn_field_box_fit_symbol, + #settings]}% + \endgroup + \fi} + +%D The traditional field command does some labeling and +%D boxing: + +\installparameterhandler \??wl {fieldlabelframed} +\installparameterhandler \??wc {fieldcontentframed} +\installparameterhandler \??wt {fieldtotalframed} + +\installsetuphandler \??wl {fieldlabelframed} +\installsetuphandler \??wc {fieldcontentframed} +\installsetuphandler \??wt {fieldtotalframed} + +\unexpanded\def\setupfield {\doquintupleempty\scrn_field_setup_field} +\unexpanded\def\setupfields{\doquadrupleempty\scrn_field_setup_fields} + +% \presetlocalframed[\??wl] +% \presetlocalframed[\??wc] +% \presetlocalframed[\??wt] + +\setupfieldcontentframed + [\c!align=\v!flushleft, + \c!strut=\v!no, + \s!parent=\??ol] + +\setupfieldcontentframed % independent + [\c!alternative=\v!normal, + \c!type=\v!line, + \c!width=5em, + \c!height=1em, + \c!depth=\zeropoint, + \c!align=\v!flushleft, + \c!option=\v!printable, + \c!n=1024] + +\setupfieldlabelframed + [\c!style=, + \c!color=, + \c!align=\v!flushleft, + \s!parent=\??ol] + +\setupfieldtotalframed + [%\c!alternative={\v!label,\v!frame,\v!horizontal}, + \c!strut=\v!no, + \c!align=, + \s!parent=\??ol] + +\def\scrn_field_setup_field[#tag][#variant][#totalsettings][#labelsettings][#fieldsettings]% + {\iffifthargument + \definefieldcategory[#tag][\s!parent=\??wc#tag,#fieldsettings] + \setupfieldtotalframed [#tag][\s!parent=\??wt,\c!alternative={#variant},#totalsettings]% + \setupfieldlabelframed [#tag][\s!parent=\??wl,#labelsettings]% + \setupfieldcontentframed[#tag][\s!parent=\??wc,#fieldsettings]% + \else\iffourthargument + \definefieldcategory[#tag][\s!parent=\??wc#tag,#labelsettings] + \setupfieldtotalframed [#tag][\s!parent=\??wt,\c!alternative={#variant},#totalsettings]% + \setupfieldlabelframed [#tag][\s!parent=\??wl]% + \setupfieldcontentframed[#tag][\s!parent=\??wc,#labelsettings]% + \else\ifthirdargument + \definefieldcategory[#tag][\s!parent=\??wc#tag,#totalsettings] + \setupfieldtotalframed [#tag][\s!parent=\??wt,\c!alternative={#variant}]% + \setupfieldlabelframed [#tag][\s!parent=\??wl]% + \setupfieldcontentframed[#tag][\s!parent=\??wc,#totalsettings]% + \else\ifsecondargument + \definefieldcategory[#tag][\s!parent=\??wc#tag,#variant] + \setupfieldtotalframed [#tag][\s!parent=\??wt]% + \setupfieldlabelframed [#tag][\s!parent=\??wl]% + \setupfieldcontentframed[#tag][\s!parent=\??wc,#variant]% + \fi\fi\fi\fi} + +\def\scrn_field_setup_fields[#variant][#totalsettings][#labelsettings][#fieldsettings] + {\iffourthargument + \setupfieldtotalframed [\c!alternative={#variant},#totalsettings]% + \setupfieldlabelframed [#labelsettings]% + \setupfieldcontentframed[#fieldsettings]% + \else\ifthirdargument + \setupfieldtotalframed [#variant]% + \setupfieldlabelframed [#totalsettings]% + \setupfieldcontentframed[#labelsettings]% + \else\ifsecondargument + \setupfieldtotalframed [#variant]% + \setupfieldcontentframed[#totalsettings]% + \else + \setupfieldtotalframed [#variant]% + \fi\fi\fi} + +% just to get the chain right for no category: + +\definefieldcategory [][\s!parent=\??wc] +\setupfieldtotalframed [][\s!parent=\??wt] +\setupfieldlabelframed [][\s!parent=\??wl] +\setupfieldcontentframed[][\s!parent=\??wc] + +% no longer supported: + +\let\resetfields\relax + +\def\scrn_field_load_scripts{\useJSscripts[fld]\globallet\scrn_field_load_scripts\relax} + +\newconditional\fieldlabelshown +\newconditional\fieldframeshown +\newconditional\fieldisvertical +\newconditional\fieldishorizontal + +\unexpanded\def\field + {\dodoubleempty\scrn_field_direct} + +\def\scrn_field_direct[#tag][#label]% + {\iflocation + \dontleavehmode + \begingroup + \scrn_field_load_scripts + \edef\currentfieldbody {#tag}% + \edef\currentfieldlabel {#label}% + \edef\currentfieldcategory{\ctxcommand{getfieldcategory("#tag")}}% + \ifx\currentfieldlabel\empty + \let\currentfieldlabel\currentfieldbody + \fi + \ifx\currentfieldcategory\empty + \setupfieldtotalframed [\currentfieldbody][\s!parent=\??wt]% + \setupfieldlabelframed [\currentfieldbody][\s!parent=\??wl]% + \setupfieldcontentframed[\currentfieldbody][\s!parent=\??wc]% + \definefieldcategory [\currentfieldbody]% + \setupfieldbody [\currentfieldbody][\c!category=\currentfieldbody]% + \let\currentfieldcategory\currentfieldbody + \fi + \let\currentfieldtotalframed \currentfieldcategory + \let\currentfieldlabelframed \currentfieldcategory + \let\currentfieldcontentframed\currentfieldcategory + \scrn_field_analyze_setups + \ifconditional\fieldframeshown + \localframed[\??wt\currentfieldcategory]\bgroup + \else + \vbox\bgroup + \fi + \dontcomplain + \ifconditional\fieldlabelshown + \scrn_field_set_label_box + \fi + \scrn_field_set_content_box + \ifconditional\fieldlabelshown + \ifconditional\fieldisvertical + \scrn_field_flush_vertical + \else + \scrn_field_flush_horizontal + \fi + \else + \scrn_field_flush_content + \fi + \egroup + \endgroup + \fi} + +% opties: veld, label, kader, vertikaal/horizontaal + +\newbox\scrn_field_box_label +\newbox\scrn_field_box_content + +% lower framedoffset + +\def\scrn_field_set_label_box + {\setbox\scrn_field_box_label\hbox + {\reshapeframeboxtrue % else wrong dimensions % still needed? + \localframed + [\??wl\currentfieldcategory] + {\currentfieldlabel}}} + +% \c!fieldoffset=-\framedoffset,\c!fieldbackgroundcolor=, +% \hbox{\lower\@@fdfieldoffset\hbox{\typesetfield}} + +\def\scrn_field_set_content_box + {\setbox\scrn_field_box_content\hbox + {\reshapeframeboxtrue % else wrong dimensions (to be checked) + \ifconditional\fieldisvertical + \setupfieldcontentframed[\c!height=6ex,\c!width=\hsize]% + \else\ifconditional\fieldishorizontal + \setupfieldcontentframed[\c!height=\vsize,\c!width=20em]% + \else + \setupfieldcontentframed[\c!height=2cm,\c!width=2cm]% + \fi\fi + \localframed % lower framedoffset + [\??wc\currentfieldcategory] + {\fieldbody + [\currentfieldbody] + [\c!width=\framedwidth,\c!height=\framedheight]}}} + +\def\scrn_field_flush_vertical + {\vbox + {\copy\scrn_field_box_label + \fieldtotalframedparameter\c!inbetween + \copy\scrn_field_box_content}} + +\def\scrn_field_flush_horizontal + {\hbox + {\vbox \ifdim\ht\scrn_field_box_content>\ht\scrn_field_box_label to \ht\scrn_field_box_content \fi + {\fieldtotalframedparameter\c!before + \copy\scrn_field_box_label + \fieldtotalframedparameter\c!after}% + \hskip\fieldtotalframedparameter\c!distance + \vbox \ifdim\ht\scrn_field_box_label>\ht\scrn_field_box_content to \ht\scrn_field_box_label \fi + {\fieldtotalframedparameter\c!before + \box\scrn_field_box_content + \fieldtotalframedparameter\c!after}}} + +\def\scrn_field_flush_content + {\box\scrn_field_box_content} + +\def\scrn_field_analyze_setups + {\setfalse\fieldlabelshown + \setfalse\fieldframeshown + \setfalse\fieldishorizontal + \setfalse\fieldisvertical + \normalexpanded{\processallactionsinset[\fieldtotalframedparameter\c!alternative]} + [ \v!reset=>\setfalse\fieldlabelshown + \setfalse\fieldframeshown + \setfalse\fieldishorizontal + \setfalse\fieldisvertical, + \v!label=>\settrue\fieldlabelshown, + \v!frame=>\settrue\fieldframeshown, + \v!horizontal=>\settrue\fieldishorizontal, + \v!vertical=>\settrue\fieldisvertical]% + \ifconditional\fieldisvertical + \setupfieldtotalframed[\c!distance=\zeropoint,\c!inbetween=\vskip\@@localoffset,\c!align=\v!right,\c!width=20em]% + \else\ifconditional\fieldishorizontal + \setupfieldtotalframed[\c!distance=\@@localoffset,\c!inbetween=,\c!align=\c!left,\c!height=10ex]% + \else + \setupfieldtotalframed[\c!distance=\zeropoint,\c!inbetween=,\c!align=\c!left]% + \fi\fi + \setupfieldtotalframed[\c!n=,\c!before=,\c!after=\vss,\c!style=,\c!color=]} + +%D Common stuff (obsolete) + +\newcount\scrn_field_system_n + +\def\nextsystemfield + {\global\advance\scrn_field_system_n\plusone + \def\currentsystemfield{sys::\number\scrn_field_system_n}} + +%D \CONTEXT\ had tooltips right from the moment that it +%D supported fields. Due to the at that moment somewhat +%D limited \PDF\ specification, they were implemented +%D using \JAVASCRIPT, but nowadays more kind of actions +%D are supported, so we can do without. The \MKIV\ version +%D also supports definition of tooltips and configuration. +%D +%D \starttyping +%D before \tooltip[right]{inbetween}{a very nice tip} after\par +%D before \tooltip[align=normal]{inbetween}{a very\\nice tip} after\par +%D before \tooltip[middle]{inbetween}{a very nice tip} after\par +%D before \tooltip[left]{inbetween}{a very nice tip} after\par +%D \stoptyping + +\newbox \scrn_tooltip_box_anchor +\newbox \scrn_tooltip_box_text +\newcount\scrn_tooltip_n + +\installcommandhandler \??wh {tooltip} \??wh + +\setuptooltip + [\c!location=\v!right, + \c!frame=\v!off, + \c!offset=.1ex, + \c!background=\v!color, + \c!backgroundcolor=gray] + +\presetlocalframed[\??wh] + +\appendtoks + \setuevalue\currenttooltip{\scrn_tooltip_direct{\currenttooltip}}% +\to \everydefinetooltip + +\unexpanded\def\scrn_tooltip_direct#tag% + {\def\currenttooltip{#tag}% + \doifelselocation + {\dosingleempty\scrn_tooltip_indeed} + {\dosingleempty\scrn_tooltip_ignore}} + +\def\scrn_tooltip_ignore[#settings]#anchortext#tiptext% + {#anchortext} + +\def\scrn_tooltip_indeed[#settings]#anchortext#tiptext% a more modern aproach (push buttons) + {\dontleavehmode \hbox \bgroup + \dontcomplain + \global\advance\scrn_tooltip_n\plusone + \edef\currenttooltipname{tooltip:\number\scrn_tooltip_n}% + \setbox\scrn_tooltip_box_anchor\hbox + {\strut#anchortext}% + \doifassignmentelse{#settings} + {\setuptooltip[\currenttooltip][#settings]}% + {\setuptooltip[\currenttooltip][\c!location=#settings]}% + \setbox\scrn_tooltip_box_text\hbox + {\localframed[\??wh\currenttooltip][\c!location=]{#tiptext}}% + \definesymbol + [\currenttooltipname:txt] + [\copy\scrn_tooltip_box_text]% + \definefieldbody + [\currenttooltipname:txt] + [\c!type=push, + \c!width=\wd\scrn_tooltip_box_text, + \c!height=\ht\scrn_tooltip_box_text, + \c!depth=\dp\scrn_tooltip_box_text, + \c!option=\v!hidden, + \c!values=\currenttooltipname:txt]% + \setbox\scrn_tooltip_box_text\hbox + {\fieldbody[\currenttooltipname:txt]}% + \setbox\scrn_tooltip_box_text\hbox + {\strut\lower\dimexpr.25ex+\ht\scrn_tooltip_box_text\relax\box\scrn_tooltip_box_text}% + \edef\currenttooltiplocation{\tooltipparameter\c!location}% + \ifx\currenttooltiplocation\v!left + \hsmashed{\hskip\wd\scrn_tooltip_box_anchor\llap{\box\scrn_tooltip_box_text}}% + \else\ifx\currenttooltiplocation\v!middle + \hsmashed to \wd\scrn_tooltip_box_anchor{\hss\box\scrn_tooltip_box_text\hss}% + \else + \hsmashed{\box\scrn_tooltip_box_text}% + \fi\fi + \definesymbol + [\currenttooltipname:but] + [\hphantom{\copy\scrn_tooltip_box_anchor}]% + \definefieldbody + [\currenttooltipname:but] + [\c!type=push, + \c!regionin=action(show{\currenttooltipname:txt}), + \c!regionout=action(hide{\currenttooltipname:txt}), + \c!width=\wd\scrn_tooltip_box_anchor, + \c!height=\ht\scrn_tooltip_box_anchor, + \c!depth=\dp\scrn_tooltip_box_anchor]% + \hsmashed{\fieldbody[\currenttooltipname:but]}% + \egroup + #anchortext}% when hyphenated the text wil stick out ... such are fields and we cannot use a link here + +\definetooltip[tooltip] + +%D From messages on the mailing list we can conclude that +%D fieldstacks are used so we keep them in the core: +%D +%D \starttyping +%D \definesymbol[one] [one] +%D \definesymbol[two] [two] +%D \definesymbol[three][three] +%D +%D \definefieldstack[mine][one,two,three] +%D \fieldstack[mine] +%D \fieldstack[mine] +%D +%D \goto{walk field}[Walk{mine}] +%D \stoptyping + +\unexpanded\def\definefieldstack + {\dotripleargument\scrn_fieldstack_define} + +\def\scrn_fieldstack_define[#tag][#symbols][#settings]% + {\ifcsname scrn_fieldstack:#tag\endcsname \else + \setgvalue{scrn_fieldstack:#tag}{\scrn_fieldstack_construct[#tag][#symbols][#settings]}% + \fi} + +\unexpanded\def\fieldstack + {\dotripleempty\scrn_fieldstack_direct} + +\def\scrn_fieldstack_direct[#tag][#symbols][#settings]% + {\ifsecondargument + \scrn_fieldstack_define[#tag][#symbols][#settings]% + \fi + \getvalue{scrn_fieldstack:#tag}} + +\newbox\scrn_fieldstack_box + +\def\scrn_fieldstack_add#tag#settings#symbol% + {\advance\scratchcounter\plusone + \edef\currentfieldstackname{#tag:\number\scratchcounter}% + \ifnum\scratchcounter=\@@fdstart\relax + \definefieldbody[\currentfieldstackname][\c!type=check,\c!values={#symbol,\empty},\c!default={#symbol}]% + \else + \definefieldbody[\currentfieldstackname][\c!type=check,\c!values={#symbol,\empty},\c!default=]% + \fi + \setbox\scrn_fieldstack_box\hbox{\symbol[#symbol]}% + \setcollector + [fieldstack] + {\fieldbody + [\currentfieldstackname] + [\c!option=\v!readonly, + \c!width=\wd\scrn_fieldstack_box, + \c!height=\ht\scrn_fieldstack_box, + \c!depth=\dp\scrn_fieldstack_box, + #settings]}} + +\def\scrn_fieldstack_construct[#tag][#symbols][#settings]% start=n, 0 == leeg + {\iflocation + \dontleavehmode + \begingroup + \getparameters[\??fd][\c!start=1,#settings]% + \scrn_field_load_scripts + \definecollector + [fieldstack]% + [\c!corner=\v!middle, + \c!location=\v!middle]% + \scratchcounter\zerocount + \processcommalist[#symbols]{\scrn_fieldstack_add{#tag}{#settings}}% + \flushcollector[fieldstack]% + \endgroup + \fi} + +%D Another goodie. Two actions can be hookes into an overlay. +%D +%D \starttyping +%D \defineviewerlayer[test] +%D +%D \startviewerlayer[test]Hide Me\stopviewerlayer +%D +%D \defineoverlay +%D [WithTest] +%D [{\overlayrollbutton[HideLayer{test}][VideLayer{test}]}] +%D +%D \framed[background=WithTest]{toggle} +%D \stoptyping + +\newcount\scrn_rollbutton_n + +\unexpanded\def\overlayrollbutton + {\dodoubleargument\scrn_rollbutton_overlay} + +\def\scrn_rollbutton_overlay[#regionin][#regionout]% + {\iflocation + \bgroup + \global\advance\scrn_rollbutton_n\plusone + \definesymbol + [rollbutton:\number\scrn_rollbutton_n] + [{\framed[\c!frame=\v!off,\c!width=\overlaywidth,\c!height=\overlayheight]{}}]% + \definefieldbody + [rollbutton:\number\scrn_rollbutton_n] + [\c!type=push, + \c!regionin={#regionin}, + \c!regionout={#regionout}, + \c!values=\currentsystemfield, + \c!default=\currentsystemfield]% + \fitfield[\currentsystemfield]% + \egroup + \fi} + +\protect \endinput + +%D I will redo these when I need them. + +% \definepushbutton [reset] +% +% \definepushsymbol [reset] [n] [\uniqueMPgraphic{whatever}{color=green}] +% \definepushsymbol [reset] [r] [\uniqueMPgraphic{whatever}{color=white}] +% +% \startinteractionmenu[bottom] +% \psh [reset] [JS(reset_something)] \\ +% \stopinteractionmenu + +\newcount\scrn_pushbutton_n + +\unexpanded\def\definepushbutton % name optional setup + {\dodoubleempty\scrn_pushbutton_define} + +\def\scrn_pushbutton_define[#tag][#settings]% + {\scrn_pushbutton_define_variant{#tag}{n}{push}% + \scrn_pushbutton_define_variant{#tag}{r}{\symbol[pushsymbol:#tag:n]}% + \scrn_pushbutton_define_variant{#tag}{d}{\symbol[pushsymbol:#tag:r]}% + \setvalue{pushbutton:#tag}{\scrn_pushbutton_handle{#tag}{#settings}}} + +\def\scrn_pushbutton_define_variant#tag#variant#content% + {\doifsymboldefinedelse{pushsymbol:#tag:#variant} + \donothing + {\definesymbol[pushsymbol:#tag:#variant][{#content}]}} + +\def\scrn_pushbutton_handle#tag#settings#reference% + {\bgroup + \global\advance\scrn_pushbutton_n\plusone + \setupfield + [pushbutton] + [\c!frame=\v!overlay, + \c!offset=\v!overlay, + \c!clickout={#reference}, + #settings]% + \definefield + [pushbutton:\number\scrn_pushbutton_n]% + [push] + [pushbutton] + [pushsymbol:#tag:n,pushsymbol:#tag:r,pushsymbol:#tag:d]% + \fitfield + [pushbutton:\number\scrn_pushbutton_n]% + \egroup} + +\unexpanded\def\definepushsymbol + {\dotripleargument\scrn_pushsymbol_define} + +\def\scrn_pushsymbol_define[#tag][#variant]% [#reference] + {\definesymbol[pushsymbol:#tag:#variant]} + +\def\pushbutton + {\dodoubleargument\scrn_pushbutton_direct} + +\def\scrn_pushbutton_direct[#tag][#variant]% + {\executeifdefined{pushbutton:#tag}\gobbleoneargument{#variant}} + +%D We plug into the menu system + +\unexpanded\def\scrn_menu_psh_start[#reference]#text\stoppsh + {\starttxt\pushbutton[\currentmenu][#reference]\stoptxt} + +\unexpanded\def\scrn_menu_psh_direct[#reference]#text\\ + {\scrn_menu_psh_start[#reference]\stoprob} + +\appendtoks + \let\startpsh\scrn_menu_psh_start + \let\stoppsh \relax + \let\psh \scrn_menu_psh_direct +\everysetmenucommands + +%D Another goodie: (unchecked in \MKIV) + +% calls: +% {..} [JS..] +% [left] {..} [JS..] +% [a=b] {..} [JS..] +% [left] [a=b] {..} [JS..] +% +% \setupbuttons[offset=0pt,frame=off] % alternative=hidden +% +% \rollbutton {Manuals} [JS(Goto_File{show-man.pdf})] +% \rollbutton {Articles} [JS(Goto_File{show-art.pdf})] +% \rollbutton {Papers} [JS(Goto_File{show-pap.pdf})] +% \rollbutton {Presentations} [JS(Goto_File{show-pre.pdf})] +% \rollbutton {Resources} [JS(Goto_File{show-res.pdf})] +% +% \rob [JS(...)] bla bla \\ + +% \definecolor[rollover:n][red] +% \definecolor[rollover:r][green] +% \definecolor[rollover:d][blue] + +\definepalet + [rollover] + [n=red, + r=green, + d=blue] + +\newcount\scrn_rollbutton_n_button +\newcount\scrn_rollbutton_n_symbol + +\unexpanded\def\rollbutton + {\dodoubleempty\scrn_rollbutton} + +\def\scrn_rollbutton[#tag][#settings]#text[#reference]% + {\dontleavehmode + \bgroup + \doglobal\advance\scrn_rollbutton_n_button + \doglobal\advance\scrn_rollbutton_n_symbol + \iffirstargument + \ifsecondargument + \getparameters[\??am#tag][#settings]% + \def\scrn_rollbutton_symbol{\scrn_rollbutton_symbol_indeed{\??am#tag}{#text}}% + \else + \doifassignmentelse{#tag} + {\getparameters[\??bt][#tag]% + \def\scrn_rollbutton_symbol{\scrn_rollbutton_symbol_indeed{\??bt}{#text}}} + {\def\scrn_rollbutton_symbol{\scrn_rollbutton_symbol_indeed{\??am#tag}{#text}}}% + \fi + \else + \def\scrn_rollbutton_symbol{\set_location_box_indeed_indeed{\??bt}{#text}}% + \fi + % todo: share symbols, tricky since different dimensions + \definesymbol[rollsymbol:\number\scrn_rollbutton_n_symbol:n][\scrn_rollbutton_symbol{n}]% + \definesymbol[rollsymbol:\number\scrn_rollbutton_n_symbol:r][\scrn_rollbutton_symbol{r}]% + \definesymbol[rollsymbol:\number\scrn_rollbutton_n_symbol:d][\scrn_rollbutton_symbol{d}]% + \setupfield + [rollbutton] + [\c!frame=\v!off, + \c!offset=\v!overlay, + \c!clickout={#reference}]% + \definefield + [rollbutton:\number\scrn_rollbutton_n_button][push][rollbutton] + [rollsymbol:\number\scrn_rollbutton_n_symbol:n,% + rollsymbol:\number\scrn_rollbutton_n_symbol:r,% + rollsymbol:\number\scrn_rollbutton_n_symbol:d]% + \fitfield[rollbutton:\number\scrn_rollbutton_n_button]% + \egroup} + +\unexpanded\def\scrn_rollbutton_symbol_indeed#namespace#text#what% + {\definecolor[rollover][rollover:#what]% + \doifelse{#what}{n}{\doifelsevalue{#namespace\c!alternative}\v!hidden\phantom\hbox}\hbox + {\localframed[#namespace] + [\c!framecolor=rollover,\c!backgroundcolor=rollover,\c!color=rollover]% + {\dolocationattributes{#namespace}\c!style\c!color{#text}}}}% + +%D We plug into the menu system + +\unexpanded\def\scrn_menu_rob_start[#reference]#text\stoprob + {\starttxt\rollbutton[\currentmenu]{\ignorespaces#text\unskip}[#reference]\stoptxt} + +\unexpanded\def\scrn_menu_rob_direct[#reference]#text\\ + {\scrn_menu_rob_start[#reference]#text\stoprob} + +\appendtoks + \let\startrob\scrn_menu_rob_start + \let\stoprob \relax + \let\rob \scrn_menu_rob_direct +\everysetmenucommands + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/scrn-hlp.lua b/Master/texmf-dist/tex/context/base/scrn-hlp.lua new file mode 100644 index 00000000000..81d68840b15 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/scrn-hlp.lua @@ -0,0 +1,120 @@ +if not modules then modules = { } end modules ['scrn-hlp'] = { + version = 1.001, + comment = "companion to scrn-hlp.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local format = string.format + +local help = { } +interactions.help = help + +local a_help = attributes.private("help") + +local has_attribute = node.has_attribute +local copy_nodelist = node.copy_list +local hpack_nodelist = node.hpack + +local register_list = nodes.pool.register + +local nodecodes = nodes.nodecodes + +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist + +local data, references = { }, { } + +local helpscript = [[ + function Hide_All_Help(prefix) { + var n = 0 + while (true) { + n += 1 ; + v = this.getField(prefix + n) ; + if (v) { + v.hidden = true ; + this.dirty = false ; + } else { + return ; + } + } + } +]] + +local template = "javascript(Hide_All_Help{help:}),action(show{help:%s})" + +function help.register(number,name,box) + if helpscript then + interactions.javascripts.setpreamble("HelpTexts",helpscript) + helpscript = false + end + local b = copy_nodelist(tex.box[box]) + register_list(b) + data[number] = b + if name and name ~= "" then + references[name] = number + structures.references.define("",name,format(template,number)) + end +end + +local function collect(head,used) + while head do + local id = head.id + if id == hlist_code then + local a = has_attribute(head,a_help) + if a then + if not used then + used = { a } + else + used[#used+1] = a + end + else + used = collect(head.list,used) + end + elseif id == vlist_code then + used = collect(head.list,used) + end + head = head.next + end + return used +end + +function help.collect(box) + if next(data) then + return collect(tex.box[box].list) + end +end + +commands.registerhelp = help.register + +function commands.collecthelp(box) + local used = help.collect(box) + if used then + local done = { } + context.startoverlay() + for i=1,#used do + local d = data[used[i]] + if d and not done[d] then + local box = hpack_nodelist(copy_nodelist(d)) + context(false,box) + done[d] = true + else + -- error + end + end + context.stopoverlay() + end +end + +function help.reference(name) + return references[name] or tonumber(name) or 0 +end + +function commands.helpreference(name) + context(references[name] or tonumber(name) or 0) +end + +function commands.helpaction(name) + context(template,references[name] or tonumber(name) or 0) +end diff --git a/Master/texmf-dist/tex/context/base/scrn-hlp.mkiv b/Master/texmf-dist/tex/context/base/scrn-hlp.mkiv deleted file mode 100644 index 4eaa340ca26..00000000000 --- a/Master/texmf-dist/tex/context/base/scrn-hlp.mkiv +++ /dev/null @@ -1,179 +0,0 @@ -%D \module -%D [ file=scrn-hlp, -%D version=1998.10.10, -%D title=\CONTEXT\ Screen Macros, -%D subtitle=Help (Experimental), -%D author={Hans Hagen \& Ton Otten}, -%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. - -% todo : dedicated vide/hide voor helps - -\writestatus{loading}{ConTeXt Screen Macros / Help popups} - -%D This is an experimental and private module, so the interface -%D and functionality can change. Pieces of code will be moved -%D to other modules. More features are possible but will be -%D interfaces later. See m-chart for an application as well -%D as the second tno-tpd manual (graphic in margin, click -%D on it, pop up big one, use menu with hides, as well as -%D background, etc. etc. - -\unprotect - -\defineframedtext - [\v!helptext] - -\setupframedtexts - [\v!helptext] - [\c!width=.75\textwidth, - \c!align=\v!normal, - \c!frame=\v!off, - \c!background=\v!screen] - -\newcounter \nofhelpdataentries -\newconditional \somehelpdatadefined - -\let\getpagehelpdata \relax -\let\synchronizepagehelpdata\relax - -\appendtoks \getpagehelpdata \to \beforeeverypage -\appendtoks \synchronizepagehelpdata \to \aftereverypage - -% will be proper state variable - -\let\pagehelpdata\empty - -\def\dontresetpagedata - {\let\synchronizepagehelpdataindeed\relax} - -\def\resetpagehelpdata - {\iflocation - \let\synchronizepagehelpdataindeed\resetpagehelpdata - \global\let\pagehelpdata\empty - \resetreference[HideHelp]% - \fi} - -\let\synchronizepagehelpdataindeed\resetpagehelpdata - -\resetreference[HideHelp] - -\def\getpagehelpdataindeed - {\iflocation\ifcase\nofhelpdataentries\else - \dogetpagehelpdataindeed - \fi\fi} - -\def\dogetpagehelpdataindeed - {\let\pagehelpdata\empty - \ifconditional\somehelpdatadefined - \definetwopasslist{hlp:\realfolio}% - \doloop - {\gettwopassdata{hlp:\realfolio}% - \iftwopassdatafound - \addtocommalist\twopassdata\pagehelpdata - \else - \exitloop - \fi}% - \fi - \ifx\pagehelpdata\empty \else - \useJSscripts[fld]% - \definereference[HideHelp][JS(Hide_Fields)]% for the moment - \fi} - -\def\setpagehelpdata[#1]% - {\iflocation\expanded{\dosetpagehelpdata{#1}}\fi} - -\def\dosetpagehelpdata#1% - {\doglobal\increment\nofhelpdataentries - \global\let\getpagehelpdata\getpagehelpdataindeed - \global\let\synchronizepagehelpdata\synchronizepagehelpdataindeed - \savetwopassdata{hlp:\realfolio}{\nofhelpdataentries}{#1}} - -\setvalue{\e!start\v!helptext}[#1]% - {\iflocation - \global\settrue\somehelpdatadefined - \setvalue{\e!stop\v!helptext}% - %{\definesymbol[helpinfo:#1][{\doframedtext[\v!helptext]{\getbuffer[\v!helptext]}}]% - % \dopresetfieldsymbol{helpinfo:#1}}% - {\definesymbol[\v!helptext:#1][{\doframedtext[\v!helptext]{\getbuffer[\v!helptext]}}]% - \dopresetfieldsymbol{\v!helptext:#1}}% - \else - \letvalue{\e!stop\v!helptext}\relax - \fi - \dostartbuffer[\v!helptext][\e!start\v!helptext][\e!stop\v!helptext]} - -\long\def\helptext[#1]#2% - {\iflocation - \global\settrue\somehelpdatadefined - %\definesymbol[helpinfo:#1][{\doframedtext[\v!helptext]{#2}}]% - %\dopresetfieldsymbol{helpinfo:#1}% - \definesymbol[\v!helptext:#1][{\doframedtext[\v!helptext]{#2}}]% - \dopresetfieldsymbol{\v!helptext:#1}% - \fi} - -\let\definehelptext\helptext % for backward compabilities sake - -\def\dohelpdata#1% - {\setbox\scratchbox\hbox - {\startoverlay - {\box\scratchbox} - %{\definemainfield[help:#1][check][helpsetup][helpinfo:#1][helpinfo:#1]% - {\definemainfield[help:#1][check][helpsetup][\v!helptext:#1][\v!helptext:#1]% - \fitfield[help:#1]} - \stopoverlay}} - -\def\helpdata - {\iflocation - \bgroup - %\getpagehelpdata - \ifx\pagehelpdata\empty \else - \setupfields[\v!reset]% - \setupfield - [helpsetup] - [\c!width=\v!fit, - \c!height=\v!fit, - \c!frame=\v!off, - \c!clickin=JS(Hide_Fields), - \c!option={\v!readonly,\v!hidden}]% - \setbox\scratchbox\emptybox - \processcommacommand[\pagehelpdata]\dohelpdata - \box\scratchbox - \fi - \egroup - \fi} - -\def\helpbutton % also gobble spaces between [][] - {\dodoubleempty\dohelpbutton} - -\def\dohelpbutton - {\ifsecondargument - \expandafter\donohelpbutton - \else - \expandafter\dodohelpbutton - \fi} - -\def\dodohelpbutton[#1][#2]#3[#4]% #2 is space gobbling dummy - {\iflocation - \setpagehelpdata[#4]% - \useJSscripts[fld]% - \button[#1]{#3}[JS(Vide_Hide_Fields{help:#4})]% - \fi} - -\def\donohelpbutton[#1][#2]% - {\dodohelpbutton[#1][]{}[#2]} - -\def\doifhelpinfo#1#2% - {\iflocation - \doifsymboldefinedelse{helpinfo:#1}{#2}\donothing - \fi} - -\def\doifelsehelpinfo#1#2#3% - {\iflocation - \doifsymboldefinedelse{helpinfo:#1}{#2}{#3}% - \fi} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/scrn-hlp.mkvi b/Master/texmf-dist/tex/context/base/scrn-hlp.mkvi new file mode 100644 index 00000000000..d9782430056 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/scrn-hlp.mkvi @@ -0,0 +1,162 @@ +%D \module +%D [ file=scrn-hlp, +%D version=1998.10.10, +%D title=\CONTEXT\ Screen Macros, +%D subtitle=Help (Experimental), +%D author={Hans Hagen \& Ton Otten}, +%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 Screen Macros / Help popups} + +%D As this functionality was in the core and as I don't know +%D how often it is used, we'll keep it around. However, it is +%D upgraded and usage has changed a bit. We also use some +%D \LUA\ magic in order to avoid multiple passes. + +\registerctxluafile{scrn-hlp}{1.001} + +%D Using help boils down to plugging the placement macro +%D someplace visible, like: +%D +%D \starttyping +%D \setuptexttexts[\centerbox{\placehelp}] +%D \stoptyping +%D +%D When this is done, the following should work out okay: +%D +%D \starttyping +%D test \helptext{word}{tip top 1 is somewhat longer} test +%D test \helptext{word}{tip top 2} test +%D +%D \starthelptext[oeps] +%D \input tufte +%D \stophelptext +%D +%D test test \showhelp{some help}[oeps] test +%D test test \button[location=depth]{\helpsignal{oeps}OEPS}[oeps] test +%D +%D test test \button[location=depth]{next}[page(2)] test +%D +%D \page +%D +%D test \helptext{word}{tip top one} test +%D test \helptext{word}{tip top two} test +%D \stoptyping +%D +%D Currently you need to use the signal in custom macros but +%D that might change at some point. + +\unprotect + +% also status + +\newbox \scrn_help_box +\newcount\scrn_help_n + +\definesystemattribute[help][public] + +\installcommandhandler \??wp {help} \??wp + +\setuphelp + [\c!frame=\v!off, + \c!align=\v!normal, + \c!background=\v!color, + \c!backgroundcolor=gray] + +\presetlocalframed[\??wp] + +\appendtoks + \setuevalue \currenthelp {\scrn_help_argument{\currenthelp}}% + \setuevalue{\e!start\currenthelp}{\scrn_help_start {\currenthelp}}% + \setuevalue{\e!stop \currenthelp}{\scrn_help_stop }% +\to \everydefinehelp + +\unexpanded\def\scrn_help_argument#category% + {\def\currenthelp{#category}% + \global\advance\scrn_help_n\plusone + \edef\currenthelpname{help:\number\scrn_help_n}% + \doifelselocation + {\dosingleempty\scrn_help_argument_indeed} + {\dosingleempty\scrn_help_argument_ignore}} + +\def\scrn_help_argument_indeed[#reference]#text#target% + {\edef\currenthelpreference{#reference}% + \dontleavehmode \hbox \bgroup + \dontcomplain + \setbox\scrn_help_box\hbox{\strut#text}% + \doregisterhelp{#target}% + \egroup % can be usernode instead + \goto + {\helpsignal{\number\scrn_help_n}#target}% + [\helpaction{\number\scrn_help_n}]} + +\def\scrn_help_argument_ignore[#reference]#text#target% + {#target} + +\unexpanded\def\scrn_help_start#category% + {\def\currenthelp{#category}% + \global\advance\scrn_help_n\plusone + \edef\currenthelpname{help:\number\scrn_help_n}% + \dosingleempty\scrn_help_start_indeed} + +\def\scrn_help_start_indeed[#reference]% + {\edef\currenthelpreference{#reference}% + \dostartbuffer[\currenthelp][\e!start\currenthelp][\e!stop\currenthelp]} + +\unexpanded\def\scrn_help_stop + {\iflocation + \scrn_help_register{\getbuffer[\currenthelp]}% + \fi} + +\def\scrn_help_register#text% + {\setbox\scrn_help_box\hbox + {\localframed[\??wp\currenthelp]{#text}}% + \definesymbol + [\currenthelpname] + [\copy\scrn_help_box]% + \definefieldbody + [\currenthelpname] + [\c!type=push, + \c!width=\wd\scrn_help_box, + \c!height=\ht\scrn_help_box, + \c!depth=\dp\scrn_help_box, + \c!option=\v!hidden, + \c!clickin=action(hide{\currenthelpname}), + \c!closepage=action(hide{\currenthelpname}), + \c!values=\currenthelpname]% + \setbox\scrn_help_box\hbox + {\fieldbody[\currenthelpname]}% + \ctxcommand{registerhelp(\number\scrn_help_n,"\currenthelpreference",\number\scrn_help_box)}} + +\def\doifelsehelp + {\ifcase\scrn_help_n + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} + +\def\placehelp % was \helpdata + {\ifinpagebody\ifcase\scrn_help_n\else + \ctxcommand{collecthelp(255)}% rather hard coded ... bad + \fi\fi} + +\def\helpreference#category% + {\ctxcommand{helpreference("#category")}} + +\def\helpaction#category% + {\ctxcommand{helpaction("#category")}} + +\unexpanded\def\helpsignal#category% + {\hbox attr \helpattribute \helpreference{#category}{}} + +\unexpanded\def\showhelp#target[#category]% + {\goto{\helpsignal{#category}#target}[#category]} + +\definehelp[\v!helptext] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/scrn-ini.lua b/Master/texmf-dist/tex/context/base/scrn-ini.lua new file mode 100644 index 00000000000..2836362dfd4 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/scrn-ini.lua @@ -0,0 +1,30 @@ +if not modules then modules = { } end modules ['scrn-int'] = { + version = 1.001, + comment = "companion to scrn-int.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +interactions = { } +interactions.general = interactions.general or { } +local general = interactions.general + +local codeinjections = backends.codeinjections + +local identitydata = { } + +local function setupidentity(specification) + for k, v in next, specification do + identitydata[k] = v + end + codeinjections.setupidentity(specification) +end + +function general.getidentity() + return identitydata +end + +general.setupidentity = setupidentity + +commands.setupidentity = setupidentity diff --git a/Master/texmf-dist/tex/context/base/scrn-ini.mkvi b/Master/texmf-dist/tex/context/base/scrn-ini.mkvi new file mode 100644 index 00000000000..860c696c0e8 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/scrn-ini.mkvi @@ -0,0 +1,178 @@ +%D \module +%D [ file=scrn-ini, +%D version=2011.02.27, +%D title=\CONTEXT\ Interaction 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. + +\writestatus{loading}{ConTeXt Interaction Macros / Initialization} + +\unprotect + +\registerctxluafile{scrn-ini}{1.001} + +%D There is no interaction at all unless enabled by saying: +%D +%D \starttyping +%D \setupinteraction[state=start] +%D \stoptyping +%D +%D The other settings are: +%D +%D \showsetup{setupinteraction} + +\installcommandhandler\??ia{interaction}\??ia + +\let\currentinteraction\empty + +\appendtoks + \doifelse{\interactionparameter\c!state}\v!start + {\locationtrue \setsystemmode \v!interaction}% + {\locationfalse \resetsystemmode\v!interaction}% +\to \everysetupinteraction + +\def\doifelselocation + {\iflocation + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} + +\setupinteraction + [\c!state=\v!stop] + +\appendtoks + \setupinteraction % todo: remember info at the lua end (already possible) +\to \everyjob + +% it makes no sense to create an environment as we will seldom have structured +% interactionso a general start-stop will do +% +% \appendtoks +% \setuevalue \currentinteraction {\scrn_interaction_direct{\currentinteraction}}% +% \setuevalue{\e!start\currentinteraction}{\scrn_interaction_start {\currentinteraction}}% +% \setuevalue{\e!stop \currentinteraction}{\scrn_interaction_stop }% +% \to \everydefineinteraction +% +% \unexpanded\def\scrn_interaction_direct#1% +% {\edef\currentinteraction{#1}} +% +% \unexpanded\def\scrn_interaction_start#1% +% {\pushmacro\currentinteraction +% \edef\currentinteraction{#1}} +% +% \unexpanded\def\scrn_interaction_stop +% {\popmacro\currentinteraction} +% +% \unexpanded\def\setinteraction[#1]% +% {\def\currentinteraction{#1}} +% +% \defineinteraction[\v!interaction] + +\unexpanded\def\startinteraction[#1]% + {\pushmacro\currentinteraction + \edef\currentinteraction{#1}} + +\unexpanded\def\stopinteraction + {\popmacro\currentinteraction} + +\unexpanded\def\setinteraction[#1]% + {\def\currentinteraction{#1}} + +%D As long as there a natural feeling of what can be considered +%D hyper active or not, we have to tell users where they can +%D possibly click. We've already seen a few macros that deal +%D with this visualization, something we definitely do not let +%D up to the viewer. One way of telling is using a distinctive +%D typeface, another way is using color. +%D +%D There are two colors involved: one for normal hyperlinks, +%D and one for those that point to the currentpage, the +%D contrast color. + +\definecolor [interactioncolor] [r=0, g=.6, b=0] +\definecolor [interactioncontrastcolor] [r=.8, g=0, b=0] + +%D The next few macros are responsible for highlighting hyper +%D links. The first one, \type{\showlocation}, is used in those +%D situations where the typeface is handled by the calling +%D macro. + +%D When we're dealing with pure page references, contrast +%D colors are used when we are already at the page mentioned. + +\def\setlocationcolor#1% not grouped ! + {\ifnum\referencepagestate=\plusone + \edef\askedcontrastcolor{\csname#1\c!contrastcolor\endcsname}% + \ifx\askedcontrastcolor\empty + \dosetcolorattribute{#1}\c!color + \else + \dosetcolorattribute{#1}\c!contrastcolor + \fi + \else % we could just set and if > 0 set again + \dosetcolorattribute{#1}\c!color + \fi} + +\def\setlocationfont#1% + {\dosetfontattribute{#1}\c!style} + +\def\setlocationattributes#1% + {\ifnum\referencepagestate=\plusone + \edef\askedcontrastcolor{\csname#1\c!contrastcolor\endcsname}% + \ifx\askedcontrastcolor\empty + \dosetcolorattribute{#1}\c!color + \else + \dosetcolorattribute{#1}\c!contrastcolor + \fi + \else % we could just set and if > 0 set again + \dosetcolorattribute{#1}\c!color + \fi + \dosetfontattribute{#1}\c!style} + +\def\setlocationcolorspec#1% \resolver + {\ifnum\referencepagestate=\plusone + \edef\askedcontrastcolor{#1\c!contrastcolor}% + \ifx\askedcontrastcolor\empty + \doactivatecolor{#1\c!color}% + \else + \doactivatecolor\askedcontrastcolor + \fi + \else + \doactivatecolor{#1\c!color}% + \fi} + +\setupinteraction + [\c!style=\v!bold, + \c!color=interactioncolor, + \c!contrastcolor=interactioncontrastcolor] + +%D Identity + +\def\scrn_identity_synchronize + {\ctxcommand{setupidentity{ + title = \!!bs\interactionparameter\c!title\!!es, + subtitle = \!!bs\interactionparameter\c!subtitle\!!es, + author = \!!bs\interactionparameter\c!author\!!es, + creator = \!!bs ConTeXt - \contextversion\!!es, + date = \!!bs\interactionparameter\c!date\!!es, + keywords = \!!bs\interactionparameter\c!keyword\!!es, + }}} + +\appendtoks + \scrn_identity_synchronize +\to \everysetupinteraction + +\setupinteraction + [\c!title=, + \c!subtitle=, + \c!author=, + \c!keyword=, + \c!date=] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/scrn-int.lua b/Master/texmf-dist/tex/context/base/scrn-int.lua deleted file mode 100644 index 7036bbf6a8d..00000000000 --- a/Master/texmf-dist/tex/context/base/scrn-int.lua +++ /dev/null @@ -1,111 +0,0 @@ -if not modules then modules = { } end modules ['scrn-int'] = { - version = 1.001, - comment = "companion to scrn-int.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local format = string.format -local texsprint, texcount, ctxcatcodes = tex.sprint, tex.count, tex.ctxcatcodes - -interactions = interactions or { } - -local attachments = { } - -function interactions.registerattachment(specification) - if specification.label then - specification.filename = specification.filename or specification.label - specification.newname = specification.newname or specification.filename - specification.title = specification.title or specification.filename - specification.newname = file.addsuffix(specification.newname,file.extname(specification.filename)) - attachments[specification.label] = specification - return specification - end -end - -function interactions.attachment(label) - local at = attachments[label] - if not at then - interfaces.showmessage("interactions",6,label) - return interactions.registerattachment { label = label } - else - return at - end -end - -function interactions.attachmentvar(label,key) - local at = attachments[label] - texsprint(ctxcatcodes,at and at[key] or "") -end - -local soundclips = { } - -function interactions.registersoundclip(specification) - if specification.label then - specification.filename = specification.filename or specification.label - soundclips[specification.label] = specification - return specification - end -end - -function interactions.soundclip(label) - local sc = soundclips[label] - if not sc then - -- todo: message - return interactions.registersoundclip { label = label } - else - return sc - end -end - -local renderings = { } - -function interactions.registerrendering(specification) - if specification.label then - renderings[specification.label] = specification - return specification - end -end - -function interactions.rendering(label) - local rn = renderings[label] - if not rn then - -- todo: message - return interactions.registerrendering { label = label } - else - return rn - end -end - -function interactions.renderingvar(label,key) - local rn = renderings[label] - texsprint(ctxcatcodes,rn and rn[key] or "") -end - --- linked lists - -function interactions.definelinkedlist(name) - -- no need -end - -function interactions.addlinktolist(name) - local tobesaved = jobpasses.gettobesaved(name) - local collected = jobpasses.getcollected(name) or { } - local currentlink = #tobesaved + 1 - local noflinks = #collected - tobesaved[currentlink] = 0 - local f = collected[1] or 0 - local l = collected[noflinks] or 0 - local p = collected[currentlink-1] or f - local n = collected[currentlink+1] or l - texsprint(ctxcatcodes,format("\\setlinkproperties{%s}{%s}{%s}{%s}{%s}{%s}",currentlink,noflinks,f,p,n,l)) -end - -function interactions.enhancelinkoflist(name,n) - local ll = jobpasses.gettobesaved(name) - if ll then - ll[n] = texcount.realpageno - end -end - diff --git a/Master/texmf-dist/tex/context/base/scrn-int.mkiv b/Master/texmf-dist/tex/context/base/scrn-int.mkiv deleted file mode 100644 index 11734e0d7e4..00000000000 --- a/Master/texmf-dist/tex/context/base/scrn-int.mkiv +++ /dev/null @@ -1,610 +0,0 @@ -%D \module -%D [ file=scrn-int, -%D version=1995.01.01, -%D title=\CONTEXT\ Core Macros, -%D subtitle=Interaction, -%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 Screen Macros / Interaction} - -\registerctxluafile{scrn-int}{1.001} - -\unprotect - -%D This is an update of \MKII\ code. In the process profiles and versions -%D were removed as I never used them (although they were kind of cool at -%D that time). - -% a bit complex due to papercomment (see imposition code) - -\newtoks\everysetupinteractionscreen - -\unexpanded\def\setupinteractionscreen - {\dosingleempty\dosetupinteractionscreen} - -\def\dosetupinteractionscreen[#1]% - {\getparameters[\??sc][#1]% - \the\everysetupinteractionscreen} - -\def\synchronizepaperdimensionssimple % simple version - {\bgroup - \ifx\@@ppleft \empty - \ifx\@@ppright \empty - \ifx\@@pptop \empty - \ifx\@@ppbottom \empty - \ifx\@@pcstate\v!start - \locationfalse\fi\else - \locationfalse\fi\else - \locationfalse\fi\else - \locationfalse\fi\else - \locationfalse\fi - \iflocation % without screen settings - \ctxlua{backends.codeinjections.setupcanvas { - paperwidth = \number\paperwidth, - paperheight = \number\paperheight - }}% - \else - \ctxlua{backends.codeinjections.setupcanvas { - paperwidth = \number\printpaperwidth, - paperheight = \number\printpaperheight - }}% - \fi - \egroup} - -\def\synchronizepaperdimensionscomplex % complex version - {\bgroup - \edef\@@scwidth {\@@scwidth}% - \edef\@@scheight{\@@scheight}% - \ifx\@@scwidth\v!fit - \!!widtha\leftcombitotal - \ifdim\backspace>\!!widtha\ifdim\backspace>\zeropoint\relax - \advance\backspace -\!!widtha - \fi\fi - \advance\!!widtha\dimexpr\rightcombitotal+2\dimexpr\@@scbackspace+\@@schoroffset\relax\relax - \else\ifx\@@scwidth\v!max - \!!widtha\printpaperwidth - \else - \!!widtha\@@scwidth - \fi\fi - \ifx\@@scheight\v!fit - \!!heighta\dimexpr\topheight+\topdistance\relax - \ifdim\topspace>\!!heighta\ifdim\topspace>\zeropoint\relax - \advance\topspace -\!!heighta - \fi\fi - \advance\!!heighta\dimexpr\makeupheight+\bottomdistance+\bottomheight+2\dimexpr\@@sctopspace+\@@scveroffset\relax\relax - \else\ifx\@@scheight\v!max - \!!heighta\printpaperheight - \else - \!!heighta\@@scheight - \fi\fi - \doif\@@scdelay\v!none{\let\@@scdelay\zerocountervalue}% - \ifdim\!!widtha>\paperwidth\ifdim\!!widtha>\zeropoint - \paperwidth\!!widtha - \fi\fi - \ifdim\!!heighta>\paperheight\ifdim\!!heighta>\zeropoint - \paperheight\!!heighta - \fi\fi - \ctxlua{backends.codeinjections.setupcanvas { - mode = "\@@scoption", - % doublesided = \ifsinglesided false\else\ifdoublesided true\else false\fi\fi, - singlesided = \ifsinglesided true\else false\fi, - doublesided = \ifdoublesided true\else false\fi, - leftoffset = \number\dimexpr\backoffset\relax, - topoffset = \number\dimexpr\topoffset \relax, - width = \number\dimexpr\!!widtha \relax, - height = \number\dimexpr\!!heighta \relax, - paperwidth = \number\paperwidth, - paperheight = \number\paperheight - }}% - \egroup} - -\let\synchronizepaperdimensions \synchronizepaperdimensionscomplex - -\appendtoks - \ifproductionrun - \doifelse\@@pcstate\v!start - {\let\synchronizepaperdimensions\synchronizepaperdimensionssimple} - {\let\synchronizepaperdimensions\synchronizepaperdimensionscomplex}% - \fi -\to \everysetupinteractionscreen - -\appendtoks \synchronizepaperdimensions \to \everyshipout - -%D The next mechanism, linked lists, is quite old and -%D is \MKIV'd for completeness. I will finish the -%D confuguration part when I need it. - -% todo: a kind of button that gets a tag passed (\??tk) - -% \starttext -% \setupinteraction[state=start] -% \definelinkedlist[demo] -% \dorecurse{10}{\linkedlistelement[demo]{link \recurselevel} \page} -% \stoptext - -\def\linkedlistparameter #1{\csname\dolinkedlistparameter{\??lk\currentlinkedlist}#1\endcsname} -\def\dolinkedlistparameter #1#2{\ifcsname#1#2\endcsname#1#2\else\expandafter\dolinkedlistparentparameter\csname#1\s!parent\endcsname#2\fi} -\def\dolinkedlistparentparameter#1#2{\ifx#1\relax\s!empty\else\dolinkedlistparameter#1#2\fi} - -\unexpanded\def\definelinkedlist{\dodoubleargument\dodefinelinkedlist} -\unexpanded\def\setuplinkedlist {\dodoubleargument\dosetuplinkedlist } -\unexpanded\def\setuplinkedlists{\dosingleargument\dosetuplinkedlists} - -\def\dodefinelinkedlist[#1][#2]% - {\ctxlua{interactions.definelinkedlist("#1")}% - \getparameters[\??lk#1][\s!parent=\??lk,#2]} - -\def\dosetuplinkedlist[#1][#2]% - {\getparameters[\??lk#1][#2]} - -\def\dosetuplinkedlists[#1]% - {\getparameters[\??lk][#1]} - -\def\setlinkproperties#1#2#3#4#5#6% - {\def\currentlink {#1}% - \def\noflinks {#2}% - \def\firstlink {#3}% - \def\previouslink{#4}% - \def\nextlink {#5}% - \def\lastlink {#6}} - -\def\linkedlistelement[#1]#2% currently no view support - {\dontleavehmode\hbox\bgroup - #2% - \iflocation - \edef\currentlinkedlist{#1}% - \ifcsname\??lk\currentlinkedlist\s!parent\endcsname - \hskip\linkedlistparameter\c!distance - \ctxlua{interactions.addlinktolist("\currentlinkedlist")}% - \expanded{\ctxlatelua{interactions.enhancelinkoflist("\currentlinkedlist",\currentlink)}}% - \dogotosomepage {\??lk\currentlinkedlist}\gotobegincharacter \firstlink - \ifnum\noflinks>\plustwo - \dogotosomepage{\??lk\currentlinkedlist}\gobackwardcharacter\previouslink - \dogotosomepage{\??lk\currentlinkedlist}\goforwardcharacter \nextlink - \fi - \dogotosomepage {\??lk\currentlinkedlist}\gotoendcharacter \lastlink - \else - \writestatus\m!interactions{no such linked list: \currentlinkedlist}% - \fi - \fi - \egroup} - -\setuplinkedlists - [\c!distance=.25em, - \c!width=\v!fit, - \c!location=\v!low, - \c!color=\@@iacolor, - \c!frame=\v!off, - \c!background=, - \c!backgroundcolor=] - -\def\koppeling {\linkedlistelement} -\def\stelkoppelingenin {\setuplinkedlists} -\def\definieerkoppeling{\definelinkedlist} - -%D Conditional page breaks: - -\def\screen - {\dosingleempty\doscreen} - -\def\doscreen[#1]% - {\iflocation\page[#1]\fi} - -%D Page transitions: - -\let\askedpagetransitions\empty - -\unexpanded\def\setuppagetransitions - {\dosingleempty\dosetuppagetransitions} - -\def\dosetuppagetransitions[#1]% - {\edef\askedpagetransitions{#1}} - -\def\setpagetransition - {\iflocation \ifx\askedpagetransitions\empty \else - \ctxlua{backends.codeinjections.setpagetransition{ n = "\askedpagetransitions", delay = "\@@scdelay" }}% - \fi \fi} - -\prependtoks \setpagetransition \to \everyshipout - -\setuppagetransitions - [\v!reset] - -%D Comments: - -\newbox\commentcollection -\newbox\commentbox -\newbox\commentboxone -\newbox\commentboxtwo - -\def\raisedcommentanchors#1#2{#1{\hbox{\raise\strutht#2}}} - -\setvalue{\??cc:\c!location:\v!inmargin }{\raisedcommentanchors\inmargin } -\setvalue{\??cc:\c!location:\v!leftedge }{\raisedcommentanchors\inleftedge } -\setvalue{\??cc:\c!location:\v!rightedge }{\raisedcommentanchors\inrightedge } -\setvalue{\??cc:\c!location:\v!leftmargin }{\raisedcommentanchors\inleftmargin } -\setvalue{\??cc:\c!location:\v!rightmargin}{\raisedcommentanchors\inrightmargin} - -\let\flushcommentanchors\relax - -\def\doflushcommentanchors - {\global\let\flushcommentanchors\relax - \ifvoid\commentbox\else\dodoflushcommentanchors\fi} % in everypar so indirect - -\def\dodoflushcommentanchors - {\executeifdefined{\??cc:\c!location:\@@cclocation}\hbox{\box\commentbox}} - -\unexpanded\def\setupcomment - {\dodoubleargument\getparameters[\??cc]} - -\unexpanded\def\placecomments{\box\commentcollection} % when option=buffer - -\def\doinsertcomment#1% - {\begingroup - \ctxlua{backends.codeinjections.presetsymbollist("\@@ccsymbol")}% - % in between predefined symbols are dealt with - \ctxlua{backends.codeinjections.registercomment { - title = "\@@cctitle", - width = \number\dimexpr\@@ccwidth \relax, - height = \number\dimexpr\@@ccheight\relax, - colormodel = \number\currentcolormodel, - colorvalue = \thecolorattribute{\@@cccolor}, - open = \@@ccopen, - symbol = "\@@ccsymbol", - buffer = "#1", - layer = "\@@cctextlayer" - }}% - \box\commentboxone - \doif\@@ccoption\v!buffer - {\setbox\scratchbox\vbox to \@@ccheight{\forgetall\vss\box\commentboxtwo}% - \wd\scratchbox\@@ccwidth - \global\setbox\commentcollection\vbox - {\startoverlay{\box\commentcollection}{\box\scratchbox}\stopoverlay}}% - \endgroup} - -\setvalue{\e!start\v!comment}{\dotripleempty\dostartcomment}% the dummy triple gobbles trailing spaces - -\def\dostartcomment[#1][#2][#3]% - {\bgroup - \doifassignmentelse{#1}{\getparameters[\??cc][#1]}{\getparameters[\??cc][\c!title=#1,#2]}% - \doifelse\@@ccoption\v!max{\let\@@ccopen\s!true}{\let\@@ccopen\s!false}% - \setcurrentbuffer{\v!comment\v!buffer}% - \dostartbuffer[\v!comment\v!buffer][\v!comment\v!buffer][\e!start\v!comment][\e!stop\v!comment]} - -\unexpanded\def\stopcomment - {\doif\@@ccstate\v!start - {\global\let\flushcommentanchors\doflushcommentanchors - \global\setbox\commentbox\frozenhbox - {\hbox to \zeropoint{\struttedbox{\tbox{\doinsertcomment{\v!comment\v!buffer}}}\hss}% - \hskip\ifvoid\commentbox\@@ccmargin\else\@@ccdistance\fi - \box\commentbox}}% - \egroup} - -\def\comment - {\dodoubleempty\docomment} - -\def\docomment[#1][#2]#3% - {\doif\@@ccstate\v!start - {\hbox to \zeropoint - {\doifassignmentelse{#1}{\getparameters[\??cc][#1]}{\getparameters[\??cc][\c!title=#1,#2]}% - \hskip-\@@ccmargin - \ctxlua{buffers.set("\v!comment\v!buffer", \!!bs\detokenize{#3}\!!es)}% - \struttedbox{\tbox{\doinsertcomment{\v!comment\v!buffer}}\hss}}}% - \ignorespaces} - -% test -% -% \startcomment -% hello beautiful\\world -% \stopcomment -% -% test -% -% \startcomment[hello] -% hello << eerste >> -% beautiful -% world -% \stopcomment -% -% test -% -% \startcomment[hello][color=green,width=10cm,height=3cm] -% hello \leftguillemot\ \'e\'erste \rightguillemot\ -% beautiful -% world -% \stopcomment -% -% test -% -% \startcomment[hello][color=red,width=4cm,height=3cm] -% hello \leftguillemot\ \'e\'erste \rightguillemot\ test -% -% beautiful -% -% world -% \stopcomment -% -% test -% -% \startcomment[symbol=Balloon] -% Do we want this kind of rubish? And, why isn't this and -% some more features related to text annotations so poorly -% (actually not) documented? Anyhow, by providing this -% functionality we demonstrate that \pdfTeX\ can do it. By -% the way, it's funny that when in Acrobat we scale up the -% text, the symbols scale down. -% \stopcomment -% -% test -% -% \definesymbol [comment-normal][{\externalfigure[cow.pdf]}] -% \definesymbol [comment-down] [{\externalfigure[cow.pdf]}] -% -% \def\CowSymbol#1#2% -% {\scale -% [\c!height=#1] -% {\startMPcode -% loadfigure "koe.mp" number 1 ; -% refill currentpicture withcolor #2 ; -% \stopMPcode}} -% -% \definesymbol [comment-normal] -% [\CowSymbol{4ex}{red}] -% -% \definesymbol [comment-down] -% [\CowSymbol{4ex}{green}] -% -% \setupcomment -% [\c!symbol={comment-normal,comment-down}, -% \c!option=\v!buffer] -% -% \startcomment[hello] -% oeps -% \stopcomment -% -% test -% -% \setupcomment -% [\c!symbol=normal, -% \c!option=max,width=10cm] -% -% \startcomment[hello] -% oeps -% \stopcomment -% -% test - -\setupcomment - [\c!state=\v!start, - \c!margin=2.5em, - \c!distance=1em, - \c!width=.3\textwidth, - \c!height=.2\textheight, - \c!color=\@@iacolor, - \c!title=, - \c!space=\v!no, - \c!symbol=\v!normal, - \c!location=\v!inmargin, - \c!option=, - \c!textlayer=] - -%D Attachments: - -% \setupinteraction[state=start] -% -% \useattachment[test.tex] -% \useattachment[whatever][test.tex] -% \useattachment[whatever][newname][test.tex] -% \useattachment[whatever][title][newname][test.tex] -% -% % \setupattachments[\c!symbol={symbol-normal,symbol-down}] -% -% \starttext \attachment[whatever] \stoptext - -\def\useattachment - {\doquadrupleempty\douseattachment} - -\def\douseattachment[#1][#2][#3][#4]% tag title newname filename - {\iffourthargument - \ctxlua{interactions.registerattachment{ label="#1", title="#2", newname="#3", filename="#4" }}% - \else\ifthirdargument - \ctxlua{interactions.registerattachment{ label="#1", title="#2", newname="#2", filename="#3" }}% - \else\ifsecondargument - \ctxlua{interactions.registerattachment{ label="#1", title="#2", newname="#2", filename="#2" }}% - \else - \ctxlua{interactions.registerattachment{ label="#1", title="#1", newname="#1", filename="#1" }}% - \fi\fi\fi} - -\def\attachment - {\dodoubleempty\doattachment} - -\def\doattachment[#1][#2]% [tag] [settings] - {\iflocation - \doif\@@atstate\v!start - {\bgroup - \setupattachments[#2]% - \ctxlua{backends.codeinjections.presetsymbollist("\@@atsymbol")}% - % we cannot yet ask for the wd/ht/dp of an xform else we could use those - \setbox\scratchbox\hbox{\symbol[\lastpredefinedsymbol]}% - \doif\@@atwidth \v!fit{\edef\@@atwidth {\the\wd\scratchbox}}% - \doif\@@atheight\v!fit{\edef\@@atheight{\the\ht\scratchbox}}% - \doif\@@atdepth \v!fit{\edef\@@atdepth {\the\dp\scratchbox}}% - % - \setbox\scratchbox\hbox - {\getvalue{\??at:\@@atalternative}{\ctxlua{backends.codeinjections.attachfile{ - label = "#1", - width = \number\dimexpr\@@atwidth \relax, - height = \number\dimexpr\@@atheight\relax, - depth = \number\dimexpr\@@atdepth \relax, - color = "\@@atcolor", - symbol = "\@@atsymbol", - layer = "\@@attextlayer", - }}}}% - \wd\scratchbox\@@atwidth - \ht\scratchbox\@@atheight - \dp\scratchbox\@@atdepth - \box\scratchbox - \egroup}% - \fi} - -\setvalue{\??at:\v!high}#1{\struttedbox{\tbox{#1}}} - -\unexpanded\def\setupattachments - {\dodoubleempty\getparameters[\??at]} - -\setupattachments - [\c!state=\v!start, - \c!color=\@@iacolor, - \c!textlayer=, - \c!width=\v!fit, - \c!height=\v!fit, - \c!depth=\v!fit, - \c!alternative=\v!high, - \c!symbol=] - -%D Defining sound tracks: -%D -%D \starttyping -%D \useexternalsoundtrack[label][file] -%D \stoptyping -%D -%D associated actions: StartSound StopSound PauseSound ResumeSound -%D -%D Todo: like external figures, also search on path, -%D although, they need to be present ar viewing time, so ... - -\def\useexternalsoundtrack - {\dodoubleargument\douseexternalsoundtrack} - -\def\douseexternalsoundtrack[#1][#2]% - {\ctxlua{interactions.registersound{ label="#1", filename="#2" }}} - -\def\checksoundtrack#1% yet untested in mkiv (also move management to lua) - {\iflocation - \ctxlua{codeinjections.insertsound{ - label = "#1", - repeat = "\@@sdoption", % not entirely ok but works - }}% - \fi} - -\unexpanded\def\setupexternalsoundtracks - {\dodoubleargument\getparameters[\??sd]} - -\setupexternalsoundtracks - [\c!option=] - -%D Multi Media: - -% todo: multiple instances, dus indirect - -\let\currentrendering\empty - -\definereference[StartCurrentRendering] [\v!StartRendering {\currentrendering}] -\definereference[StopCurrentRendering] [\v!StopRendering {\currentrendering}] -\definereference[PauseCurrentRendering] [\v!PauseRendering {\currentrendering}] -\definereference[ResumeCurrentRendering][\v!ResumeRendering{\currentrendering}] - -\newcounter\nofexternalrenderings - -\def\useexternalrendering{\doquadrupleempty\douseexternalrendering} -\def\setinternalrendering{\dodoubleempty \dosetinternalrendering} - -\def\douseexternalrendering[#1][#2][#3][#4]% tag mime file options - {\ctxlua{interactions.registerrendering { - kind = "external", - label = "#1", - mime = "#2", - filename = "#3", - options = "#4", - }}} - -\def\dosetinternalrendering[#1][#2]% tag options {content} - {\bgroup - \dowithnextbox - {\ctxlua{interactions.registerrendering { - kind = "internal", - label = "#1", - mime = "IRO", - filename = "#1", - options = "#2", - }}% - \let\objectoffset\zeropoint - \setobject{IRO}{#1}\hbox{\box\nextbox}% - \egroup}% - \hbox} - -\def\renderingtype #1{\ctxlua{interactions.renderingvar("#1","kind")}} -\def\renderingoptions#1{\ctxlua{interactions.renderingvar("#1","options")}} - -\def\renderingwidth {8cm} -\def\renderingheight {6cm} - -\unexpanded\def\definerenderingwindow - {\dodoubleempty\dodefinerenderingwindow} - -\def\dodefinerenderingwindow[#1][#2]% - {\presetlocalframed[\??rw#1]% - \getparameters - [\??rw#1]% - [\c!openpageaction=,\c!closepageaction=,% - \c!width=\renderingwidth,\c!height=\renderingheight,% - #2]} - -\unexpanded\def\setuprenderingwindow - {\dodoubleargument\dosetuprenderingwindow} - -\def\dosetuprenderingwindow[#1]% - {\getparameters[\??rw#1]} - -\unexpanded\def\placerenderingwindow - {\dodoubleempty\doplacerenderingwindow} - -\def\doplacerenderingwindow[#1][#2]% - {\bgroup - \edef\currentrendering{\ifsecondargument#2\else#1\fi}% - \doifelse{\renderingtype\currentrendering}{internal} % an object - {\getobjectdimensions{IRO}\currentrendering - \edef\renderingheight{\the\dimexpr\objectheight+\objectdepth\relax}% - \edef\renderingwidth{\objectwidth}% - \dogetobjectreferencepage{IRO}\currentrendering\renderingpage}% - {\def\renderingheight{\vsize}% - \def\renderingwidth{\hsize}% - \def\renderingpage{\realpageno}}% - % create fall back if needed - \ifcsname\??rw#1\c!width\endcsname - \def\currentrenderingwindow{#1}% - \else - \let\currentrenderingwindow\s!default - \definerenderingwindow[\currentrenderingwindow]% - \fi -% todo -% \handlereferenceactions{\getvalue{\??rw\currentrenderingwindow\c!openpageaction }}\dosetuprenderingopenpageaction -% \handlereferenceactions{\getvalue{\??rw\currentrenderingwindow\c!closepageaction}}\dosetuprenderingclosepageaction - \localframed - [\??rw\currentrenderingwindow][\c!offset=\v!overlay]% - {\ctxlua{backends.codeinjections.insertrenderingwindow { - label = "\currentrendering", - width = \number\dimexpr\renderingwidth\relax, - height = \number\dimexpr\renderingheight\relax, - options = "\renderingoptions\currentrendering", - page = \number\renderingpage, - }}}% - \egroup} - -\setupinteractionscreen - [\c!width=\printpaperwidth, - \c!height=\printpaperheight, - \c!horoffset=\!!zeropoint, - \c!veroffset=\!!zeropoint, - \c!backspace=\backspace, - \c!topspace=\topspace, - \c!option=\v!auto, - \c!delay=\v!none] - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/scrn-men.mkiv b/Master/texmf-dist/tex/context/base/scrn-men.mkiv deleted file mode 100644 index 246d31bfddd..00000000000 --- a/Master/texmf-dist/tex/context/base/scrn-men.mkiv +++ /dev/null @@ -1,615 +0,0 @@ -%D \module -%D [ file=scrn-bar, % was part of scrn-int -%D version=1995.01.01, -%D title=\CONTEXT\ Core Macros, -%D subtitle=Menus, -%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 Screen Macros / Menus} - -\unprotect - -% \startinteractionmenu[rechts] -% \but [eerste] eerste \\ -% \txt hello world \\ -% \but [tweede] tweede \\ -% \nop \\ -% \but [tweede] tweede \\ -% \rul whow \\ -% \but [tweede] tweede \\ -% \raw hello world \\ -% \but [tweede] tweede \\ -% \com \vfill \\ -% \but [derde] derde \\ -% \stopinteractionmenu - -% \setupinteraction[menu=on,state=start] -% -% \defineinteractionmenuclass[test] [vertical] -% \defineinteractionmenuclass[another][horizontal] -% -% \defineinteractionmenu[test] [left][state=start,width=4cm] -% \defineinteractionmenu[another][top] [state=start,height=1cm] -% -% \startinteractionmenu[test] -% \but [firstpage] test-a \\ -% \but [nextpage] test-b \\ -% \stopinteractionmenu -% -% \startinteractionmenu[another] -% \but [firstpage] test-a \\ -% \but [nextpage] test-b \\ -% \stopinteractionmenu -% -% \setupheadertexts[{\interactionmenu[another]}] -% -% \starttext -% -% test \interactionmenu[test] \page -% test \interactionmenu[test] \page -% -% \stoptext - -% ja : kader/achtergrond met tekst -% leeg : kader/achtergrond maar geen tekst -% nee : alleen ruimte reserveren -% geen : helemaal weglaten -% -% \setupinteractionmenu[right][samepage=yes, unknownreference=yes] -% \setupinteractionmenu[right][samepage=empty,unknownreference=empty] -% \setupinteractionmenu[right][samepage=no, unknownreference=no] -% \setupinteractionmenu[right][samepage=none, unknownreference=none] -% -% \startinteractionmenu[right] -% \but [firstpage] first \\ -% \but [lastpage] last \\ -% \but [somepage] crap \\ -% \stopinteractionmenu - -%D Define menus: - -\def\setmenuparameter#1#2#3{\@EA\def\csname\??am#1#2\endcsname{#3}} -\def\letmenuparameter #1#2{\@EA\let\csname\??am#1#2\endcsname} - -\def\menuparameter #1{\csname\domenuparameter{\??am\currentmenu}#1\endcsname} -\def\namedmenuparameter#1#2{\csname\domenuparameter{\??am #1}#2\endcsname} -\def\menuparameterhash #1{\domenuparameterhash {\??am\currentmenu}#1} - -\def\domenuparameter #1#2{\ifcsname#1#2\endcsname#1#2\else\expandafter\domenuparentparameter \csname#1\s!parent\endcsname#2\fi} -\def\domenuparameterhash#1#2{\ifcsname#1#2\endcsname #1\else\expandafter\domenuparentparameterhash\csname#1\s!parent\endcsname#2\fi} - -\def\domenuparentparameter #1#2{\ifx#1\relax\s!empty\else\domenuparameter #1#2\fi} -\def\domenuparentparameterhash#1#2{\ifx#1\relax \else\domenuparameterhash#1#2\fi} - -\unexpanded\def\defineinteractionmenu - {\dotripleempty\dodefineinteractionmenu} - -\def\dodefineinteractionmenu[#1][#2][#3]% [name] [location] [settings] - {\ifsecondargument - \ifcsname\??am:\c!list:#2\endcsname \else - \letvalue{\??am:\c!list:#2}\empty - \fi - \normalexpanded{\noexpand\addtocommalist{#1}\@EA\noexpand\csname\??am:\c!list:#2\endcsname}% - \setvalue{\@@dodolistelement#1}{\def\dosomelistelement{\dodomenulistelement{#1}}}% - \ifthirdargument - \presetlocalframed[\??am#1]% - \doifassignmentelse{#3} - {\doifelse{#1}{#2} - {\getparameters[\??am#1][\c!location=#2,\c!menu=,\s!parent=\??am,#3]} - {\getparameters[\??am#1][\c!location=#2,\c!menu=,\s!parent=\??am#2,#3]}}% - {\doifelsenothing{#3} - {\getparameters[\??am#1][\c!location=#2,\c!menu=,\s!parent=\??am]} - {\getparameters[\??am#1][\c!location=#2,\c!menu=,\s!parent=\??am#3]}}% - \else - \getparameters[\??am#1][\c!location=#2,\c!menu=,\s!parent=\??am#2]% - \fi - \else - \getparameters[\??am#1][\s!parent=\??am]% simple cloning - \fi} - -\def\currentmenulist{\ifcsname\??am:\c!list:\currentmenu\endcsname\csname\??am:\c!list:\currentmenu\endcsname\fi} - -%D Setup menus: - -\unexpanded\def\setupinteractionmenu - {\dodoubleargument\dosetupinteractionmenu} - -\def\dosetupinteractionmenu[#1][#2]% - {\def\docommand##1{\getparameters[\??am##1][#2]}% - \processcommalist[#1]\docommand} - -\unexpanded\def\setupinteractionmenus[#1]% - {\getparameters[\??am][#1]} - -%D Fill menus: - -\normalexpanded{\long\def\expandafter\noexpand\csname\e!start\v!interactionmenu\endcsname[#1]#2\expandafter\noexpand\csname\e!stop\v!interactionmenu\endcsname}% - {\long\setmenuparameter{#1}\c!menu{\dointeractionmenu{#1}{#2}}} - -\def\resetinteractionmenu[#1]% - {\letmenuparameter{#1}\c!menu\empty} - -%D Check if menus permitted: - -\newif\iflocationmenupermitted - -\def\testinteractionmenu - {\iflocation - \doifelse\@@iamenu\v!on - {\doifelse{\menuparameter\c!state}\v!start - {\global\locationmenupermittedtrue} - {\global\locationmenupermittedfalse}} - {\global\locationmenupermittedfalse}% - \else - \global\locationmenupermittedfalse - \fi} - -%D Placement of menus: - -\def\interactionmenus[#1]% location - {\iflocation - \csname\??am:\c!menu:#1\endcsname - \fi} - -% \unexpanded\def\defineinteractionmenuclass -% {\dodoubleargument\dodefineinteractionmenuclass} -% -% \def\dodefineinteractionmenuclass[#1][#2]% tag hori|veri -% {\doifelse{#2}\v!vertical -% {\setvalue{\??am:\c!menu:#1}{\verticalinteractionmenu {#1}{\getvalue{\??am#1\c!width }}}} -% {\setvalue{\??am:\c!menu:#1}{\horizontalinteractionmenu{#1}{\getvalue{\??am#1\c!height}}}}} -% -% \defineinteractionmenuclass[\v!left ][\v!horizontal] -% \defineinteractionmenuclass[\v!right ][\v!horizontal] -% \defineinteractionmenuclass[\v!top ][\v!vertical] -% \defineinteractionmenuclass[\v!bottom][\v!vertical] - -\setvalue{\??am:\c!menu :\v!left }{\horizontalinteractionmenu\v!left \leftedgewidth } -\setvalue{\??am:\c!menu :\v!right }{\horizontalinteractionmenu\v!right \rightedgewidth} -\setvalue{\??am:\c!menu :\v!top }{\verticalinteractionmenu \v!top \topheight } -\setvalue{\??am:\c!menu :\v!bottom}{\verticalinteractionmenu \v!bottom\bottomheight } - -\setvalue{\??am:\c!command:\v!right }{\@@amvbox{}\rightedgewidth} -\setvalue{\??am:\c!command:\v!left }{\@@amvbox{}\leftedgewidth } -\setvalue{\??am:\c!command:\v!top }{\@@amhbox{}\topheight } -\setvalue{\??am:\c!command:\v!bottom}{\@@amhbox{}\bottomheight } - -\def\dointeractionmenu#1#2% - {\edef\currentmenu{#1}% - \getvalue{\??am:\c!command:\menuparameter\c!location}\currentmenu{#2}} - -\unexpanded\def\interactionmenu[#1]% - {\def\currentmenu{#1}% - \menuparameter\c!menu} - -\newdimen \intermenudistance -\newdimen \finalmenuwidth -\newdimen \finalmenuheight - -\newcounter\currentamposition % better \currentmenuposition -\newtoks \everysetmenucommands - -\def\horizontalinteractionmenu#1#2% location vhsize before/after - {\ifdim#2>\zeropoint - \edef\currentmenu{#1}% - \finalmenuwidth#2\relax - \horizontalinteractionmenuindeed - \fi} - -\def\verticalinteractionmenu#1#2% - {\ifdim#2>\zeropoint - \edef\currentmenu{#1}% - \finalmenuheight#2\relax - \verticalinteractionmenuindeed - \fi} - -\def\horizontalinteractionmenuindeed - {\global\intermenudistance\zeropoint - \setbox\scratchbox\hbox - {\processcommacommand[\currentmenulist]\somehorizontalinteractionmenu}% - \wd\scratchbox\finalmenuwidth\relax - \box\scratchbox} - -\def\verticalinteractionmenuindeed - {\global\intermenudistance\zeropoint - \setbox\scratchbox\vbox - {\processcommacommand[\currentmenulist]\someverticalinteractionmenu}% - \ht\scratchbox\finalmenuheight - \dp\scratchbox\zeropoint - \box\scratchbox} - -\def\somehorizontalinteractionmenu#1% - {\begingroup - \edef\currentmenu{#1}% - \doifnot{\menuparameter\c!state}\v!none - {\hskip\intermenudistance - \setbox\scratchbox\hbox to \finalmenuwidth - {\menuparameter\c!left - \interactionmenu[#1]% - \menuparameter\c!right}% - \doifelse{\menuparameter\c!distance}\v!overlay - {\global\intermenudistance\zeropoint - \wd\scratchbox\zeropoint}% - {\global\intermenudistance\menuparameter\c!distance}% - \box\scratchbox}% - \endgroup} - -\def\someverticalinteractionmenu#1% - {\begingroup - \edef\currentmenu{#1}% - \doifnot{\menuparameter\c!state}\v!none - {\vskip\intermenudistance - \setbox\scratchbox\vbox to \finalmenuheight - {\menuparameter\c!before - \interactionmenu[#1]% - \menuparameter\c!after}% - \doifelse{\menuparameter\c!distance}\v!overlay - {\global\intermenudistance\zeropoint - \offinterlineskip - \dp\scratchbox\zeropoint - \ht\scratchbox\zeropoint}% - {\global\intermenudistance\menuparameter\c!distance}% - \box\scratchbox}% - \endgroup} - -% don't change skipping, this one works! \showcomposition removed - -\def\@@amhbox#1#2#3#4% #1 obsolete, #3 is redundant - {\edef\currentmenu{#3}% - \testinteractionmenu - \iflocationmenupermitted - \begingroup - \forgetall - \scratchdimen\dimexpr\makeupwidth+\pagebackgroundhoffset*2-\menuparameter\c!leftoffset-\menuparameter\c!rightoffset\relax - \setbox\scratchbox\hbox to \scratchdimen - {\executeamboxcommands{#3}{#4}\c!left\c!middle\c!right}% - \setbox\scratchbox\hbox{\dowholemenuposition{#3}{\box\scratchbox}}% cannot happen in previous due to align - \wd\scratchbox\makeupwidth % geen \ht=#2 setting (yet) - \hskip\dimexpr-\pagebackgroundhoffset+\menuparameter\c!leftoffset\relax - \box\scratchbox - \endgroup - \fi} - -\def\@@amvbox#1#2#3#4% #1 obsolete, #3 is redundant - {\edef\currentmenu{#3}% - \testinteractionmenu - \iflocationmenupermitted - \bgroup - \forgetall - \scratchdimen\dimexpr\textheight+\pagebackgroundvoffset*2+\pagebackgrounddepth-\menuparameter\c!topoffset-\menuparameter\c!bottomoffset\relax - \setbox\scratchbox\vbox to \scratchdimen - {\restorestandardblank % todo: vspacing - \hsize#2\relax - \executeamboxcommands{#3}{#4}\c!before\c!inbetween\c!after}% - % strange: when we mnake this a hbox the content disappears - \setbox\scratchbox\vbox{\dowholemenuposition{#3}{\box\scratchbox}}% cannot happen in previous due to align - \setbox\scratchbox\vbox - {\ht\scratchbox\zeropoint - \vskip\dimexpr-\pagebackgroundvoffset+\menuparameter\c!topoffset\relax - \box\scratchbox - \vskip\pagebackgroundvoffset}% overbodig - \ht\scratchbox\textheight - \wd\scratchbox#2\relax - \box\scratchbox - \egroup - \fi} - -\def\executeamboxcommands#1#2#3#4#5% - {\begingroup - \edef\currentmenu{#1}% - \menuparameter#3\relax - \setamboxcommands{#1}{#4}% - \ignorespaces#2\unskip - \menuparameter#5\relax - \endgroup} - -\def\setamboxcommands#1#2% - {\edef\currentmenu{#1}% - \edef\betweenmenu{#2}% - \doglobal\newcounter\currentamposition - \the\everysetmenucommands} - -\def\addsomemenuitem#1% - {\dontleavehmode - \begingroup - \ignorespaces#1\unskip\relax - \ifconditional\skippedmenuitem \else - \menuparameter\betweenmenu - \fi - \endgroup - \ignorespaces} - -%D This can save complicated menu macros when one want to -%D keep control over parts of a menu (i.e.\ turn them on and -%D off). We could have achieved something similar with modes. - -\def\local@@ambox#1#2#3#4% don't change skipping, this one works! - {\begingroup - \edef\currentmenu{#3}% - \iflocationmenupermitted - \executeamboxcommands{#3}{#4}\c!before\c!inbetween\c!after - \fi - \endgroup} - -\def\includemenu[#1]% - {\begingroup - \edef\currentmenu{#1}% - \doif{\menuparameter\c!state}\v!local - {\letmenuparameter\currentmenu\c!state\v!start - \let\@@amvbox\local@@ambox - \let\@@amhbox\local@@ambox - \menuparameter\c!menu}% - \endgroup} - -%D The menu commands: - -% ja : kader/achtergrond met tekst -% leeg : kader/achtergrond maar geen tekst -% nee : alleen ruimte reserveren -% geen : helemaal weglaten - -\newconditional\skippedmenuitem -\newconditional\usemenuclick - -\def\dosetlocationboxcontent#1[#2]#3[#4]% to be checked - {\global\setfalse\skippedmenuitem - \setbox\locationbox\hbox{\localframed[#1][#2]{#3}}% - \ifconditional\usemenuclick - \gotobox{\box\locationbox}[#4]% - \else - \box\locationbox - \fi} - -\def\dosetlocationboxempty#1[% - {\dosetlocationboxcontent{#1}[\c!empty=\v!yes,} - -\def\dosetlocationboxno#1[% - {\dosetlocationboxcontent{#1}[\c!empty=\v!yes,\c!frame=,\c!background=,} - -\def\dosetlocationboxnone#1[#2]#3[#4]% - {\global\settrue\skippedmenuitem} - -% make two sub macros - -% \dosetfontattribute {#1}{#2}% -% \dosetcolorattribute{#1}{#3}% - -\def\setlocationboxyes#1[#2]#3[#4]% needs to be split as the attr is not applicable to the box - {\begingroup - \settrue\usemenuclick - \global\setfalse\skippedmenuitem - \attribute\referenceattribute\attributeunsetvalue - \doifreferencefoundelse{#4} - {\analyzecurrentreference % we need to act on the state - \ifcase\referencepagestate - % something else than a page reference - \ctxlua{jobreferences.injectcurrentset(nil,nil)}% - \hbox attr \referenceattribute \lastreferenceattribute {\localframed[#1][#2]{#3}}% - \else\ifcase\csname\??am:\c!location:\menuparameter\c!samepage\endcsname\relax - % yes: same page or not ... todo - \ctxlua{jobreferences.injectcurrentset(nil,nil)}% - \ifnum\referencepagestate=\plusone % same page - \hbox attr \referenceattribute \lastreferenceattribute {\localframed[#1][#2,\c!color=\menuparameter\c!contrastcolor]{#3}}% - \else % elsewhere - \hbox attr \referenceattribute \lastreferenceattribute {\localframed[#1][#2]{#3}}% - \fi - \or - % empty but frame: no click - \localframed[#1][\c!empty=\v!yes,#2]{#3}% - \or - % empty no frame: no - \localframed[#1][\c!empty=\v!yes,\c!frame=,\c!background=,#2]{#3}% - \or - % nothing at all - \global\settrue\skippedmenuitem - \fi\fi}% - {\unknownreference{#4}% - \ifcase\csname\??am:\c!location:\menuparameter\c!unknownreference\endcsname\relax - \localframed[#1][#2]{#3}% - \or - \localframed[#1][\c!empty=\v!yes,#2]{#3}% - \or - \localframed[#1][\c!empty=\v!yes,\c!frame=,\c!background=,#2]{#1}% - \or - \global\skippedmenuitemtrue - \fi}% - \endgroup} - -\def\setlocationboxraw#1[#2]#3[#4]% - {\localframed[#1][#2]{#3}} - -\def\setlocationnop#1[#2]#3% - {\localframed[#1][#2]{#3}} - -\def\menu@raw[#1]#2\\% - {\addsomemenuitem{\gotobox{\ignorespaces#2\unskip}[#1]}} - -\def\menu@but[#1]#2\\% - {\addsomemenuitem{\domenuitemposition\currentmenu{#1}{\setlocationboxyes{\??am\currentmenu}[]{\ignorespaces#2\unskip}[#1]}}} - -\def\menu@got[#1]#2\\% - {\addsomemenuitem{\setlocationboxyes{\??am\currentmenu}[\c!frame=\v!off,\c!background=]{\ignorespaces#2\unskip}[#1]}} - -\def\menu@nop#1\\% - {\addsomemenuitem{\setlocationboxraw{\??am\currentmenu}[\c!frame=\v!off,\c!background=,\c!empty=\v!yes]{\ignorespaces#1\unskip}[]}} - -\def\menu@txt#1\\% - {\addsomemenuitem{\localframed[\??am\currentmenu][\c!frame=\v!off,\c!background=]{\ignorespaces#1\unskip}}} - -\def\menu@rul#1\\% - {\addsomemenuitem{\localframed[\??am\currentmenu][]{\ignorespaces#1\unskip}}} - -\def\menu@com#1\\% - {\ignorespaces#1\unskip\ignorespaces} - -\appendtoks - \let\raw\menu@raw \let\but\menu@but \let\got\menu@got \let\nop\menu@nop - \let\txt\menu@txt \let\rul\menu@rul \let\com\menu@com -\to \everysetmenucommands - -\ifdefined\domenuitemposition \else \let\domenuitemposition \gobbletwoarguments \fi -\ifdefined\dowholemenuposition \else \let\dowholemenuposition\gobbleoneargument \fi - -%D We also need an explicit position control some day. I'll -%D do that when I need it. [The stacking order.] - -% [name] [location] -% [name] [location] [pars] - -\expandafter\chardef\csname\??am:\c!location:\v!yes \endcsname\zerocount -\expandafter\chardef\csname\??am:\c!location:\v!empty \endcsname\plusone -\expandafter\chardef\csname\??am:\c!location:\v!no \endcsname\plustwo -\expandafter\chardef\csname\??am:\c!location:\v!none \endcsname\plusthree - -\expandafter\chardef\csname\??am:\c!location:\v!normal \endcsname\plusone % default -\expandafter\chardef\csname\??am:\c!location:\s!default\endcsname\plusone % default -\expandafter\chardef\csname\??am:\c!location:\s!empty \endcsname\plusone % default - -\def\dodomenulistelement#1#2#3#4#5#6#7% - {\addsomemenuitem{\domenuitemposition\currentmenu{internal(#3)}% - {\setlocationboxyes{\??am\currentmenu}[]{\limitatetext{#5}{\namedlistparameter{#2}\c!maxwidth}{\unknown}}[internal(#3)]}}} - -\unexpanded\def\menubutton - {\dodoubleempty\domenubutton} - -\def\domenubutton[#1]% - {\iffirstargument - \ifsecondargument - \@EAEAEA\domenubuttonB - \else - \doifassignmentelse{#1} - {\@EAEAEA\domenubuttonC} - {\@EAEAEA\domenubuttonD}% - \fi - \else - \@EA\domenubuttonA - \fi[#1]} - -\def\domenubuttonA[#1][#2]#3[#4]{\setlocationboxyes\??bt[]{#3}[#4]} % normal button, no parameters -\def\domenubuttonB[#1][#2]#3[#4]{\setlocationboxyes{\??am#1}[#2]{#3}[#4]} % menu button, with parameters -\def\domenubuttonC[#1][#2]#3[#4]{\setlocationboxyes\??bt[#1]{#3}[#4]} % normal button, with parameters -\def\domenubuttonD[#1][#2]#3[#4]{\setlocationboxyes{\??am#1}[]{#3}[#4]} % menu button, no parameters - -\def\menubox - {\dodoubleempty\domenubox} - -\def\domenubox[#1][#2]#3% - {\bgroup - \let\setlocationboxyes\setlocationboxraw - \domenubutton[#1][#2]#3[]% - \egroup} - -% jammer, tussen/midden had erin gemoeten; \c!commando toevoegen - -\def\registermenucommand#1% - {{\textonly\noindent#1\space}} % no math switching - -\def\doregistermenubuttons[#1][#2]% [menu id] [register] - {\bgroup - \ifsecondargument - \setupinteractionmenu[#1][\c!unknownreference=\v!yes,\c!samepage=\v!yes]% - \def\docommand##1{\registermenucommand{\menubutton[#1]{##1}[#2:##1]}}% - \else - \def\docommand##1{\registermenucommand{\button[\c!unknownreference=\v!yes,\c!samepage=\v!yes]{##1}[#1:##1]}}% - \fi - \handletokens abcdefghijklmnopqrstuvwxyz\with\docommand % moet anders - \egroup} - -\def\registermenubuttons - {\dodoubleempty\doregistermenubuttons} - -\defineinteractionmenu [\v!vertical] % we happen to know that this works out ok (just a setup set) -\defineinteractionmenu [\v!horizontal] % we happen to know that this works out ok (just a setup set) - -\defineinteractionmenu [\v!right ] [\v!right ] [\v!vertical ] % we share a setup set -\defineinteractionmenu [\v!left ] [\v!left ] [\v!vertical ] % we share a setup set -\defineinteractionmenu [\v!top ] [\v!top ] [\v!horizontal] % we share a setup set -\defineinteractionmenu [\v!bottom] [\v!bottom] [\v!horizontal] % we share a setup set - -\setupinteractionmenus - [\c!offset=.25em, - \c!position=\v!no, - \c!frame=\v!on, - \c!background=, - \c!backgroundcolor=, - \c!foregroundstyle=\menuparameter\c!style, - \c!foregroundcolor=\menuparameter\c!color, - \c!style=\@@iastyle, - \c!color=\@@iacolor, - \c!contrastcolor=\@@iacontrastcolor, - \c!state=\v!start, - \c!samepage=\v!yes, - \c!unknownreference=\v!empty, - \c!distance=\bodyfontsize, % 12pt - \c!topoffset=\zeropoint, - \c!bottomoffset=\zeropoint, - \c!leftoffset=\zeropoint, - \c!rightoffset=\zeropoint] - -\setupinteractionmenu - [\v!vertical] % not really a menu - [\c!before=, - \c!after=\vfil, - \c!inbetween=\blank, - \c!left=\hss, - \c!right=\hss, - \c!height=\v!broad] - -\setupinteractionmenu - [\v!horizontal] % not really a menu - [\c!before=\vss, - \c!after=\vss, - \c!middle=\hfil, - \c!width=\v!fit, - \c!height=\v!broad] - -\setupinteractionmenu[\v!left ][\c!width=\leftedgewidth ] -\setupinteractionmenu[\v!right ][\c!width=\rightedgewidth] -% \setupinteractionmenu[\v!top ] [\c!height=\topheight ] -% \setupinteractionmenu[\v!bottom] [\c!height=\bottomheight ] - -\unexpanded\def\placeleftedgetextblock % Is \hss/\hsize really needed here? (check outer level and settings) - {\hbox to \leftedgewidth{\hsize\leftedgewidth\hss\interactionmenus[\v!left]}} - -\unexpanded\def\placerightedgetextblock % Is \hss/\hsize really needed here? (check outer level and settings) - {\hbox to \rightedgewidth{\hsize\rightedgewidth\interactionmenus[\v!right]\hss}} - -\unexpanded\def\placetoptextblock - {\vbox to \topheight - {\vsize\topheight - \csname\??tk\v!top\c!before\endcsname - \interactionmenus[\v!top]% - \csname\??tk\v!top\c!after\endcsname - \kern\zeropoint}} - -\unexpanded\def\placebottomtextblock - {\vbox to \bottomheight - {\vsize\bottomheight - \csname\??tk\v!bottom\c!before\endcsname - \interactionmenus[\v!bottom]% - \csname\??tk\v!bottom\c!after\endcsname - \kern\zeropoint}} - -\ifdefined\leftedgetextcontent - - \appendtoks \iflocation\placeleftedgetextblock \hskip-\leftedgewidth \fi\to \leftedgetextcontent - \appendtoks \iflocation\placerightedgetextblock \hskip-\rightedgewidth \fi\to \rightedgetextcontent - \appendtoks \iflocation\placetoptextblock \vskip-\topheight \fi\to \toptextcontent - \appendtoks \iflocation\placebottomtextblock \vskip-\bottomheight \fi\to \bottomtextcontent - -\fi - -%D Enable and disable menus \unknown\ obsolete: - -\def\gobbletwoparameters[#1][#2]{} - -\def\disableinteractionmenu{\dodoubleempty\gobbletwoparameters} -\def\enableinteractionmenu {\dodoubleempty\gobbletwoparameters} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/scrn-nav.mkiv b/Master/texmf-dist/tex/context/base/scrn-nav.mkiv deleted file mode 100644 index 264e3ded2e9..00000000000 --- a/Master/texmf-dist/tex/context/base/scrn-nav.mkiv +++ /dev/null @@ -1,256 +0,0 @@ -%D \module -%D [ file=scrn-nav, -%D version=1998.01.15, -%D title=\CONTEXT\ Screen Macros, -%D subtitle=Navigation, -%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 Screen Macros / Navigation} - -\unprotect - -%D Support for interactive document is very present in -%D \CONTEXT\ and interwoven in many modules. This means that in -%D this module, where we deal with some common navigational -%D features, there will be quite some forward references. -%D -%D The current support in \MKIV\ is mostly the same as in -%D \MKII\ and the old files have some more detailed -%D (sometimes historic) information. - -%D There is no interaction at all unless enabled by saying: -%D -%D \starttyping -%D \setupinteraction[state=start] -%D \stoptyping -%D -%D The other settings are: -%D -%D \showsetup{setupinteraction} - -% use with care, no checking done - -\def\setinteractionparameter#1#2% - {\expandafter\def\csname\??ia#1\endcsname{#2}} - -\def\resetinteractionparameter#1% - {\expandafter\let\csname\??ia#1\endcsname\empty} - -\newtoks\everysetupinteraction - -\unexpanded\def\setupinteraction - {\dosingleargument\dodosetupinteraction} - -\def\dodosetupinteraction[#1]% % \dosetupinteraction == special - {\getparameters[\??ia][#1]% - \the\everysetupinteraction} - -% todo, move partial append to where the action happens - -\appendtoks - \doifelse\@@iastate\v!start - {\iflocation\else - \showmessage\m!interactions2{\ifusepagedestinations\space(PAGE)\fi}% - \global\locationtrue - \fi}% - {\iflocation - \showmessage\m!interactions3{\ifusepagedestinations\space(PAGE)\fi}% - \global\locationfalse - \fi}% - \iflocation - \setsystemmode \v!interaction - \else - \resetsystemmode\v!interaction - \fi - \doifsomething\@@iacalculate - {\doregistercalculationset\@@iacalculate}% - \doifelse\@@iastrut \v!yes \settrue \setfalse \uselocationstrut - \doifelse\@@iaclick \v!yes \settrue \setfalse \highlighthyperlinks - \doifelse\@@iadisplay\v!new \settrue \setfalse \gotonewwindow - \doifelse\@@iapage \v!yes \settrue \setfalse \usepagedestinations -\to \everysetupinteraction - -\def\synchronizebackendidentity - {\ctxlua{backends.codeinjections.setupidentity{ - title = \!!bs\@@iatitle\!!es, - subject = \!!bs\@@iasubtitle\!!es, - author = \!!bs\@@iaauthor\!!es, - creator = \!!bs ConTeXt - \contextversion\!!es, - date = \!!bs\@@iadate\!!es, - keywords = \!!bs\@@iakeyword\!!es, - }}} - -\appendtoks - \synchronizebackendidentity -\to \everyfirstshipout - -%D We have to make sure of some settings: - -\def\dolocationstartup - {\iflocation - \donefalse - \ifx\@@iaopenaction\empty \else \donetrue - \ctxlua{jobreferences.checkopendocumentactions("\@@iaopenaction")}% - \ctxlua{jobreferences.expandcurrent()}% - \fi - \ifx\@@iacloseaction\empty \else \donetrue - \ctxlua{jobreferences.checkclosedocumentactions("\@@iacloseaction")}% - \ctxlua{jobreferences.expandcurrent()}% - \fi - \ifdone - \ctxlua{jobreferences.flushdocumentactions()}% - \fi - \global\let\dolocationstartup\relax - \fi} - -\def\dolocationpagecheck - {\iflocation - \donefalse - \ifx\@@iaopenpageaction\empty \else \donetrue - \ctxlua{jobreferences.checkopenpageactions("\@@iaopenpageaction")}% - \ctxlua{jobreferences.expandcurrent()}% - \fi - \ifx\@@iaclosepageaction\empty \else \donetrue - \ctxlua{jobreferences.checkclosepageactions("\@@iaclosepageaction")}% - \ctxlua{jobreferences.expandcurrent()}% - \fi - \ifdone - \ctxlua{jobreferences.flushpageactions()}% - \fi - \fi} - -\appendtoks \dolocationstartup \to \everyshipout -\appendtoks \dolocationpagecheck \to \everyshipout - -%D As long as there a natural feeling of what can be considered -%D hyper active or not, we have to tell users where they can -%D possibly click. We've already seen a few macros that deal -%D with this visualization, something we definitely do not let -%D up to the viewer. One way of telling is using a distinctive -%D typeface, another way is using color. -%D -%D There are two colors involved: one for normal hyperlinks, -%D and one for those that point to the currentpage, the -%D contrast color. - -\definecolor [interactioncolor] [r=0, g=.6, b=0] -\definecolor [interactioncontrastcolor] [r=.8, g=0, b=0] - -\definecolor [interactiekleur] [interactioncolor] -\definecolor [interactiecontrastkleur] [interactioncontrastcolor] - -%D The next few macros are responsible for highlighting hyper -%D links. The first one, \type{\showlocation}, is used in those -%D situations where the typeface is handled by the calling -%D macro. - -%D When we're dealing with pure page references, contrast -%D colors are used when we are already at the page mentioned. - -\def\setlocationcolor#1% not grouped ! - {\ifnum\referencepagestate=\plusone - \edef\askedcontrastcolor{\csname#1\c!contrastcolor\endcsname}% - \ifx\askedcontrastcolor\empty - \dosetcolorattribute{#1}\c!color - \else - \dosetcolorattribute{#1}\c!contrastcolor - \fi - \else % we could just set and if > 0 set again - \dosetcolorattribute{#1}\c!color - \fi} - -\def\setlocationfont#1% - {\dosetfontattribute{#1}\c!style} - -\def\setlocationattributes#1% - {\ifnum\referencepagestate=\plusone - \edef\askedcontrastcolor{\csname#1\c!contrastcolor\endcsname}% - \ifx\askedcontrastcolor\empty - \dosetcolorattribute{#1}\c!color - \else - \dosetcolorattribute{#1}\c!contrastcolor - \fi - \else % we could just set and if > 0 set again - \dosetcolorattribute{#1}\c!color - \fi - \dosetfontattribute{#1}\c!style} - -\def\setlocationcolorspec#1% \resolver - {\ifnum\referencepagestate=\plusone - \edef\askedcontrastcolor{#1\c!contrastcolor}% - \ifx\askedcontrastcolor\empty - \doactivatecolor{#1\c!color}% - \else - \doactivatecolor\askedcontrastcolor - \fi - \else - \doactivatecolor{#1\c!color}% - \fi} - -%D delayed ... - -\def\enableinteractivereferences - {\ifproductionrun - \ctxlua{jobreferences.enable_interaction()}% - \globallet\enableinteractivereferences\relax - \fi} - -\appendtoks - \enableinteractivereferences -\to \everysetupinteraction - -%D More tokens are spend when we want both typeface and color -%D highlighting. - -\def\@@iatimestamp - {\the\normalyear - \ifnum\normalmonth<10 0\fi\the\normalmonth - \ifnum\normalday <10 0\fi\the\normalday} - -\setupinteraction % start fit page and reset form - [\c!state=\v!stop, - \c!page=\v!no, - \c!click=\v!yes, - \c!display=, - \c!openaction=, - \c!closeaction=, - \c!openpageaction=, - \c!closepageaction=, - \c!display=\v!normal, - \c!focus=\v!fit, - \c!menu=\v!off, - \c!style=\v!bold, - \c!calculate=, - \c!strut=\v!yes, - \c!split=\v!yes, - \c!color=interactioncolor, - \c!contrastcolor=interactioncontrastcolor, - \c!symbolset=, - \c!width=1em, - \c!height=\!!zeropoint, - \c!depth=\!!zeropoint, - \c!title=\jobname, % needed for fdf/x - \c!subtitle=, - \c!author=, - \c!keyword=, - \c!date=\@@iatimestamp] - -%D XMP support: - -\setupinteraction - [xmpfile=] - -\appendtoks - % this will move as it is a backend issue - \doifsomething\@@iaxmpfile - {\ctxlua{if lpdf then lpdf.setxmpfile("\@@iaxmpfile") end}% - \globallet\@@iaxmpfile\empty}% -\to \everysetupinteraction - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/scrn-pag.lua b/Master/texmf-dist/tex/context/base/scrn-pag.lua new file mode 100644 index 00000000000..7003d028508 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/scrn-pag.lua @@ -0,0 +1,27 @@ +if not modules then modules = { } end modules ['scrn-pag'] = { + version = 1.001, + comment = "companion to scrn-pag.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +interactions = interactions or { } +interactions.pages = interactions.pages or { } +local pages = interactions.pages + +local codeinjections = backends.codeinjections + +local function setupcanvas(specification) + codeinjections.setupcanvas(specification) +end + +local function setpagetransition(specification) + codeinjections.setpagetransition(specification) +end + +pages.setupcanvas = setupcanvas +pages.setpagetransition = setpagetransition + +commands.setupcanvas = setupcanvas +commands.setpagetransition = setpagetransition diff --git a/Master/texmf-dist/tex/context/base/scrn-pag.mkvi b/Master/texmf-dist/tex/context/base/scrn-pag.mkvi new file mode 100644 index 00000000000..8e1dbde8e9c --- /dev/null +++ b/Master/texmf-dist/tex/context/base/scrn-pag.mkvi @@ -0,0 +1,249 @@ +%D \module +%D [ file=scrn-pag, +%D version=1998.01.15, +%D title=\CONTEXT\ Screen Macros, +%D subtitle=Pages, % moved code +%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. + +% pagecomments will be done differently + +\writestatus{loading}{ConTeXt Screen Macros / Pages} + +\registerctxluafile{scrn-pag}{1.001} + +\unprotect + +\installparameterhandler \??sc {interactionscreen} +\installsetuphandler \??sc {interactionscreen} + +\newdimen\canvaswidth +\newdimen\canvasheight +\newdimen\canvasbackoffset +\newdimen\canvastopoffset +\newdimen\canvasmaxwidth +\newdimen\canvasmaxheight + +\newconditional\scrn_canvas_tight_page + +% \def\scrn_canvas_calculate +% {\begingroup +% \edef\currentinteractionscreenwidth {\interactionscreenparameter\c!width }% +% \edef\currentinteractionscreenheight{\interactionscreenparameter\c!height}% +% \canvasbackoffset\backspace +% \canvastopoffset\topspace +% \ifx\currentinteractionscreenwidth\v!fit +% \global\canvaswidth\leftcombitotal +% \ifdim\backspace>\canvaswidth +% \ifdim\backspace>\zeropoint\relax +% \global\advance\canvasbackoffset -\canvaswidth +% \fi +% \fi +% \global\advance\canvaswidth\dimexpr +% \rightcombitotal +% + 2\dimexpr +% \interactionscreenparameter\c!backspace +% + \interactionscreenparameter\c!horoffset +% \relax +% \relax +% \donetrue +% \else\ifx\currentinteractionscreenwidth\v!max +% \global\canvaswidth\printpaperwidth +% \donetrue +% \else +% \global\canvaswidth\currentinteractionscreenwidth +% \donefalse +% \fi\fi +% \ifdone +% \ifdim\canvaswidth>\paperwidth\ifdim\canvaswidth>\zeropoint +% \global\paperwidth\canvaswidth % kills location=middle +% \fi\fi +% \fi +% \ifx\currentinteractionscreenheight\v!fit +% \global\canvasheight\dimexpr\topheight+\topdistance\relax +% \ifdim\topspace>\canvasheight +% \ifdim\topspace>\zeropoint\relax +% \global\advance\canvastopoffset -\canvasheight +% \fi +% \fi +% \global\advance\canvasheight\dimexpr +% \makeupheight +% + \bottomdistance +% + \bottomheight +% + 2\dimexpr +% \interactionscreenparameter\c!topspace +% + \interactionscreenparameter\c!veroffset +% \relax +% \relax +% \else\ifx\currentinteractionscreenheight\v!max +% \global\canvasheight\printpaperheight +% \else +% \global\canvasheight\currentinteractionscreenheight +% \fi\fi +% \ifdone +% \ifdim\canvasheight>\paperheight\ifdim\canvasheight>\zeropoint +% \global\paperheight\canvasheight % kills location=middle +% \fi\fi +% \fi +% \endgroup} + +\def\scrn_canvas_calculate + {\begingroup + \edef\currentinteractionscreenwidth {\interactionscreenparameter\c!width }% + \edef\currentinteractionscreenheight{\interactionscreenparameter\c!height}% + \canvasbackoffset\backspace + \canvastopoffset\topspace + \ifx\currentinteractionscreenwidth\v!fit + \global\canvaswidth\leftcombitotal + \ifdim\backspace>\canvaswidth + \ifdim\backspace>\zeropoint\relax + \global\advance\canvasbackoffset -\canvaswidth + \fi + \fi + \global\advance\canvaswidth\dimexpr + \rightcombitotal + + 2\dimexpr + \interactionscreenparameter\c!backspace + + \interactionscreenparameter\c!horoffset + \relax + \relax + \else\ifx\currentinteractionscreenwidth\v!max + \global\canvaswidth\printpaperwidth + \else + \global\canvaswidth\currentinteractionscreenwidth + \fi\fi + \ifx\currentinteractionscreenheight\v!fit + \global\canvasheight\dimexpr\topheight+\topdistance\relax + \ifdim\topspace>\canvasheight + \ifdim\topspace>\zeropoint\relax + \global\advance\canvastopoffset -\canvasheight + \fi + \fi + \global\advance\canvasheight\dimexpr + \makeupheight + + \bottomdistance + + \bottomheight + + 2\dimexpr + \interactionscreenparameter\c!topspace + + \interactionscreenparameter\c!veroffset + \relax + \relax + \else\ifx\currentinteractionscreenheight\v!max + \global\canvasheight\printpaperheight + \else + \global\canvasheight\currentinteractionscreenheight + \fi\fi + \ifconditional\page_location_is_set + \global\setfalse\scrn_canvas_tight_page + \fi + \ifconditional\scrn_canvas_tight_page + \global\canvasmaxwidth \paperwidth + \global\canvasmaxheight\paperheight + \else + \global\canvasmaxwidth \printpaperwidth + \global\canvasmaxheight\printpaperheight + \fi + \endgroup} + +% test the next when something is changed here: +% +% \setuppapersize[A5][A3] \showframe +% +% % \setuplayout[location=middle] \setupinteractionscreen[option=fit] +% % \setuplayout[location=middle] \setupinteractionscreen[option=auto] +% % \setupinteractionscreen[option=fit] +% % \setupinteractionscreen[option=auto] +% +% \starttext \input ward \stoptext + +\def\scrn_canvas_synchronize_simple + {\ctxcommand{setupcanvas{ + paperwidth = \number\printpaperwidth, + paperheight = \number\printpaperheight + }}} + +\def\scrn_canvas_synchronize_complex + {\scrn_canvas_calculate % otherwise we need to hook it into setuppage etc + \ctxcommand{setupcanvas{ + mode = "\interactionscreenparameter\c!option", + singlesided = \ifsinglesided true\else false\fi, + doublesided = \ifdoublesided true\else false\fi, + leftoffset = \number\canvasbackoffset, + topoffset = \number\canvastopoffset, + width = \number\canvaswidth, + height = \number\canvasheight, + paperwidth = \number\canvasmaxwidth, + paperheight = \number\canvasmaxheight + }}} + +\appendtoks + \doifcommonelse{\interactionscreenparameter\c!option}{\v!max,\v!fit}% + {\global\settrue \scrn_canvas_tight_page}% + {\global\setfalse\scrn_canvas_tight_page}% +\to \everysetupinteractionscreen + +\appendtoks + \doifelse\@@pcstate\v!start + \scrn_canvas_synchronize_simple + \scrn_canvas_synchronize_complex +\to \everyshipout + +\setupinteractionscreen + [\c!width=\printpaperwidth, + \c!height=\printpaperheight, + \c!horoffset=\zeropoint, + \c!veroffset=\zeropoint, + \c!backspace=\backspace, + \c!topspace=\topspace, + \c!option=\v!auto] + +%D Conditional page breaks: + +\unexpanded\def\screen + {\dosingleempty\scrn_screen} + +\def\scrn_screen[#list]% + {\iflocation + \page[#list]% + \fi} + +%D Page transitions: + +\let\scrn_transitions_list\empty + +\unexpanded\def\setuppagetransitions + {\dosingleempty\scrn_transitions_setup} + +\def\scrn_transitions_setup[#list]% + {\edef\scrn_transitions_list{#list}} + +\def\scrn_transitions_set + {\iflocation \ifx\scrn_transitions_list\empty \else + \scrn_transitions_set_indeed + \fi \fi} + +\def\scrn_transitions_set_indeed + {\begingroup + \edef\currentinteractionscreendelay{\interactionscreenparameter\c!delay}% + \ctxcommand{setpagetransition{ + n = "\scrn_transitions_list", + delay = "\ifx\currentinteractionscreendelay\v!none 0\else\currentinteractionscreendelay\fi" + }}% + \endgroup} + +\prependtoks + \scrn_transitions_set +\to \everyshipout + +\setupinteractionscreen + [\c!delay=\v!none] + +\setuppagetransitions + [\v!reset] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/scrn-ref.lua b/Master/texmf-dist/tex/context/base/scrn-ref.lua new file mode 100644 index 00000000000..0b1dff2c12e --- /dev/null +++ b/Master/texmf-dist/tex/context/base/scrn-ref.lua @@ -0,0 +1,65 @@ +if not modules then modules = { } end modules ['scrn-int'] = { + version = 1.001, + comment = "companion to scrn-int.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +interactions = interactions or { } +interactions.references = interactions.references or { } +local references = interactions.references + +local codeinjections = backends.codeinjections + +local expandcurrent = structures.references.expandcurrent +local identify = structures.references.identify + +local function check(what) + if what and what ~= "" then + local set, bug = identify("",what) + return not bug and #set > 0 and set + end +end + +local function setopendocumentaction(open) + local opendocument = check(open) + if opendocument then + codeinjections.registerdocumentopenaction(opendocument) + expandcurrent() + end +end + +local function setclosedocumentaction(close) + local closedocument = check(close) + if closedocument then + codeinjections.registerdocumentcloseaction(closedocument) + expandcurrent() + end +end + +local function setopenpageaction(open) + local openpage = check(open) + if openpage then + codeinjections.registerpageopenaction(openpage) + expandcurrent() + end +end + +local function setclosepageaction(close) + local closepage = check(close) + if closepage then + codeinjections.registerpagecloseaction(closepage) + expandcurrent() + end +end + +references.setopendocument = setopendocumentaction +references.setclosedocument = setclosedocumentaction +references.setopenpage = setopenpageaction +references.setclosepage = setclosepageaction + +commands.setopendocumentaction = setopendocumentaction +commands.setclosedocumentaction = setclosedocumentaction +commands.setopenpageaction = setopenpageaction +commands.setclosepageaction = setclosepageaction diff --git a/Master/texmf-dist/tex/context/base/scrn-ref.mkvi b/Master/texmf-dist/tex/context/base/scrn-ref.mkvi new file mode 100644 index 00000000000..8c3f4fb4aba --- /dev/null +++ b/Master/texmf-dist/tex/context/base/scrn-ref.mkvi @@ -0,0 +1,90 @@ +%D \module +%D [ file=scrn-ref, +%D version=1998.01.15, +%D title=\CONTEXT\ Screen Macros, +%D subtitle=References, % moved code +%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 Screen Macros / References} + +\registerctxluafile{scrn-ref}{1.001} + +\unprotect + +\appendtoks + \doifsomething{\interactionparameter\c!calculate}{\doregistercalculationset{\interactionparameter\c!calculate}}% + \doifelse{\interactionparameter\c!click }\v!yes \settrue \setfalse \highlighthyperlinks + \doifelse{\interactionparameter\c!display}\v!new \settrue \setfalse \gotonewwindow + \doifnot {\interactionparameter\c!page }\v!no \scrn_reference_enable_page_destinations +\to \everysetupinteraction + +\def\scrn_reference_enable_page_destinations % no reset + {\ctxlua{structures.references.setinnermethod("\interactionparameter\c!page")}} + +\setupinteraction % start fit page and reset form + [\c!page=\v!no, + \c!click=\v!yes, + \c!display=\v!normal, + \c!focus=\v!fit, + \c!calculate=, + % rendering: + \c!width=1em, + \c!height=\zeropoint, + \c!depth=\zeropoint, + \c!symbolset=] + +%D We have to make sure of some settings: + +\def\scrn_reference_set_text_actions + {\iflocation + \edef\currentinteractionopenaction {\interactionparameter\c!openaction }% + \edef\currentinteractioncloseaction{\interactionparameter\c!closeaction}% + \ifx\currentinteractionopenaction\empty \else + \ctxcommand{setopendocumentaction("\currentinteractionopenaction")}% + \fi + \ifx\currentinteractioncloseaction\empty \else + \ctxcommand{setclosedocumentaction("\currentinteractioncloseaction")}% + \fi + \glet\scrn_reference_set_text_actions\relax + \fi} + +\def\scrn_reference_set_page_actions + {\iflocation + \edef\currentinteractionopenpageaction {\interactionparameter\c!openpageaction }% + \edef\currentinteractionclosepageaction{\interactionparameter\c!closepageaction}% + \ifx\currentinteractionopenpageaction\empty \else + \ctxcommand{setopenpageaction("\currentinteractionopenpageaction")}% + \fi + \ifx\currentinteractionclosepageaction\empty \else + \ctxcommand{setclosepageaction("\currentinteractionclosepageaction")}% + \fi + \fi} + +\appendtoks \scrn_reference_set_text_actions \to \everyshipout +\appendtoks \scrn_reference_set_page_actions \to \everyshipout + +%D delayed ... + +\def\scrn_reference_enable_references + {\ifproductionrun + \ctxlua{structures.references.enableinteraction()}% + \glet\scrn_reference_enable_references\relax + \fi} + +\appendtoks + \scrn_reference_enable_references +\to \everysetupinteraction + +\setupinteraction % start fit page and reset form + [\c!openaction=, + \c!closeaction=, + \c!openpageaction=, + \c!closepageaction=] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/scrn-wid.lua b/Master/texmf-dist/tex/context/base/scrn-wid.lua new file mode 100644 index 00000000000..7b1dd940a2c --- /dev/null +++ b/Master/texmf-dist/tex/context/base/scrn-wid.lua @@ -0,0 +1,194 @@ +if not modules then modules = { } end modules ['scrn-wid'] = { + version = 1.001, + comment = "companion to scrn-wid.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +interactions = interactions or { } +local interactions = interactions + +local attachments = { } +local comments = { } +local soundclips = { } +local renderings = { } +local linkedlists = { } + +interactions.attachments = attachments +interactions.soundclips = soundclips +interactions.renderings = renderings +interactions.linkedlists = linkedlists + +local jobpasses = job.passes + +local codeinjections = backends.codeinjections +local nodeinjections = backends.nodeinjections + +local variables = interfaces.variables +local v_auto = variables.auto + +-- Symbols + +function commands.presetsymbollist(list) + codeinjections.presetsymbollist(list) +end + +-- Attachments +-- +-- registered : unique id +-- tag : used at the tex end +-- file : name that the file has on the filesystem +-- name : name that the file will get in the output +-- title : up to the backend +-- subtitle : up to the backend +-- author : up to the backend +-- method : up to the backend (hidden == no rendering) + +local nofautoattachments, lastregistered = 0, nil + +local function checkregistered(specification) + local registered = specification.registered + if not registered or registered == "" or registered == v_auto then + nofautoattachments = nofautoattachments + 1 + lastregistered = "attachment-" .. nofautoattachments + specification.registered = lastregistered + return lastregistered + else + return registered + end +end + +local function checkbuffer(specification) + local buffer = specification.buffer + if buffer ~= "" then + specification.data = buffers.getcontent(buffer) or "" + end +end + +function attachments.register(specification) + checkregistered(specification) + checkbuffer(specification) + attachments[lastregistered] = specification + return specification +end + +function attachments.insert(specification) + local registered = checkregistered(specification) + local r = attachments[registered] + if r then + for k, v in next, r do + local s = specification[k] + if s == "" then + specification[k] = v + end + end + end + checkbuffer(specification) + return nodeinjections.attachfile(specification) +end + +commands.registerattachment = attachments.register + +function commands.insertattachment(specification) + tex.box["scrn_attachment_box_link"] = attachments.insert(specification) +end + +-- Comment + +function comments.insert(specification) + local buffer = specification.buffer + if buffer ~= "" then + specification.data = buffers.getcontent(buffer) or "" + end + return nodeinjections.comment(specification) +end + +function commands.insertcomment(specification) + tex.box["scrn_comment_box_link"] = comments.insert(specification) +end + +-- Soundclips + +function soundclips.register(specification) + local tag = specification.tag + if tag and tag ~= "" then + local filename = specification.file + if not filename or filename == "" then + filename = tag + specification.file = filename + end + soundclips[tag] = specification + return specification + end +end + +function soundclips.insert(tag) + local sc = soundclips[tag] + if not sc then + -- todo: message + return soundclips.register { tag = tag } + else + return sc + end +end + +commands.registersoundclip = soundclips.register +commands.insertsoundclip = soundclips.insert + +-- Renderings + +function renderings.register(specification) + if specification.label then + renderings[specification.label] = specification + return specification + end +end + +function renderings.rendering(label) + local rn = renderings[label] + if not rn then + -- todo: message + return renderings.register { label = label } + else + return rn + end +end + +function renderings.var(label,key) + local rn = renderings[label] + context(rn and rn[key] or "") +end + +-- Rendering: + +function commands.insertrenderingwindow(specification) + codeinjections.insertrenderingwindow(specification) +end + +-- Linkedlists (only a context interface) + +function commands.definelinkedlist(tag) + -- no need +end + +function commands.enhancelinkedlist(tag,n) + local ll = jobpasses.gettobesaved(tag) + if ll then + ll[n] = texcount.realpageno + end +end + +function commands.addlinklistelement(tag) + local tobesaved = jobpasses.gettobesaved(tag) + local collected = jobpasses.getcollected(tag) or { } + local currentlink = #tobesaved + 1 + local noflinks = #collected + tobesaved[currentlink] = 0 + local f = collected[1] or 0 + local l = collected[noflinks] or 0 + local p = collected[currentlink-1] or f + local n = collected[currentlink+1] or l + context.setlinkedlistproperties(currentlink,noflinks,f,p,n,l) + -- context.ctxlatelua(function() commands.enhancelinkedlist(tag,currentlink) end) +end diff --git a/Master/texmf-dist/tex/context/base/scrn-wid.mkvi b/Master/texmf-dist/tex/context/base/scrn-wid.mkvi new file mode 100644 index 00000000000..72f5255bbce --- /dev/null +++ b/Master/texmf-dist/tex/context/base/scrn-wid.mkvi @@ -0,0 +1,702 @@ +%D \module +%D [ file=scrn-int, +%D version=2011.02.27, % moved from scrn-int +%D title=\CONTEXT\ Core Macros, +%D subtitle=Widgets, +%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 Interaction Macros / Widgets} + +\registerctxluafile{scrn-wid}{1.001} + +% todo: expansion in comments (default is expanded) + +\unprotect + +%D Attachments (mkiv upgraded): +%D +%D As usual in \CONTEXT\ we separate the general definition (frontend) +%D and the rendering (backend). + +% old but stil valid method: +% +% \useattachment[test.tex] +% \useattachment[whatever][test.tex] +% \useattachment[whatever][newname][test.tex] +% \useattachment[whatever][title][newname][test.tex] +% +% new method: +% +% \registerattachment[sometag][specification] % name file author title subtitle +% +% \attachment[sometag][extra specs] +% \attachment[test.tex] +% \attachment[file=test.tex] +% \attachment[file=test.tex,method=hidden] +% \attachment[name=newname,file=test.tex] +% \attachment[title=mytitle,name=newname,file=test.tex] +% +% indirect +% +% \defineattachment[whatever5][file=test.tex] \attachment[whatever5][method=hidden] +% \defineattachment[whatever5][file=test.tex,method=hidden] \attachment[whatever5] +% +% direct (no definitions) +% +% \attachment[test][file=oeps.tex,title=Oeps,author=Hans,subtitle=TeX File,method=hidden] +% \attachment[label=test,file=oeps.tex,title=Oeps,author=Hans,subtitle=TeX File,method=hidden] +% +% autolabel: +% +% \attachment[file=oeps.tex,title=Oeps,author=Hans,subtitle=TeX File,method=hidden] +% +% % \setupattachments[\c!symbol={symbol-normal,symbol-down}] + +% startattachment -> temp file + +\newbox\scrn_attachment_box_collect +\newbox\scrn_attachment_box_link +\newbox\scrn_attachment_box_symbol + +\installcommandhandler\??at{attachment}\??at + +\let\setupattachments\setupattachment % convenience and compatibility + +\setupattachment + [\c!state=\v!start, + \c!color=\interactionparameter\c!color, + %\c!textlayer=, + %\c!symbol=, + %\c!title=, + %\c!subtitle=, + %\c!file=, % input filename + %\c!name=, % new filename + %\c!author=, + %\c!method=, % \v!hidden = not in menu + %\c!buffer= + \c!symbol=, + \c!distance=1em, + \c!width=\v!fit, + \c!height=\v!fit, + \c!depth=\v!fit, + \c!location=\v!high] + +\unexpanded\def\registerattachment + {\dodoubleempty\scrn_attachment_register} + +\def\scrn_attachment_register[#tag][#settings]% we save (globally) at the lua end + {\ifsecondargument + \begingroup + \def\currentattachment{_}% + \setupattachment[_][#settings,\s!parent=\??at]% + \ctxcommand{registerattachment{ + tag = "#tag", + title = "\attachmentparameter\c!title", + subtitle = "\attachmentparameter\c!subtitle", + author = "\attachmentparameter\c!author", + file = "\attachmentparameter\c!file", + name = "\attachmentparameter\c!name", + buffer = "\attachmentparameter\c!buffer", + }}% + \endgroup + \fi} + +\appendtoks + \setuevalue \currentattachment {\scrn_attachment_direct{\currentattachment}}% + \setuevalue{\e!start\currentattachment}{\scrn_attachment_start {\currentattachment}}% + \setuevalue{\e!stop \currentattachment}{\scrn_attachment_stop }% +\to \everydefineattachment + +\unexpanded\def\scrn_attachment_direct#tag% + {\edef\currentattachment{#tag}% + \doifelselocation + {\dodoubleempty\scrn_attachment_direct_status} + {\dodoubleempty\scrn_attachment_direct_ignore}} + +\def\scrn_attachment_direct_status + {\doifelse{\attachmentparameter\c!state}\v!start + \scrn_attachment_direct_indeed + \scrn_attachment_direct_ignore} + +\def\scrn_attachment_direct_indeed[#registered][#settings]% + {\bgroup + \doifelsenothing{#registered} + {\scrn_attachment_inject[\v!auto][]} + {\doifassignmentelse{#registered} + {\scrn_attachment_inject[\v!auto][#registered]} + {\scrn_attachment_inject[#registered][#settings]}}% + \egroup} + +\def\scrn_attachment_direct_ignore[#tag][#settings]% + {} + +\unexpanded\def\scrn_attachment_start#tag% + {\edef\currentattachment{#tag}% + \doifelselocation + {\dodoubleempty\scrn_attachment_start_indeed} + {\dodoubleempty\scrn_attachment_start_ignore}} + +\unexpanded\def\scrn_attachment_stop + {} + +\def\scrn_attachment_start_indeed + {\doif{\attachmentparameter\c!state}\v!start + {\scrn_attachment_start_indeed} + {\scrn_attachment_start_ignore}} + +\def\scrn_attachment_start_indeed[#registered][#settings]% + {\bgroup + \doifelsenothing{#registered} + {\def\scrn_attachment_stop{\scrn_attachment_inject[\v!auto][\c!buffer=\v!attachment]\egroup}}% + {\doifassignmentelse{#registered} + {\def\scrn_attachment_stop{\scrn_attachment_inject[\v!auto][\c!buffer=\v!attachment,#registered]\egroup}}% + {\def\scrn_attachment_stop{\scrn_attachment_inject[#registered][\c!buffer=\v!attachment,#settings]\egroup}}}% + \dostartbuffer[\v!attachment][\e!start\currentattachment][\e!stop\currentattachment]} + +\def\scrn_attachment_start_ignore + {\expandafter\gobbleuntil\csname\e!stop\currentattachment\endcsname} + +\def\scrn_attachment_inject[#registered][#settings]% + {\edef\currentattachmentregistered{#registered}% + \setupattachment[\currentattachment][#settings]% + \expandcheckedcsname{scrn_attachment_method_}{\attachmentparameter\c!method}\v!normal} + +\setvalue{scrn_attachment_method_\v!normal}% + {\edef\currentattachmentsymbol{\attachmentparameter\c!symbol}% + \edef\currentattachmentwidth {\attachmentparameter\c!width }% + \edef\currentattachmentheight{\attachmentparameter\c!height}% + \edef\currentattachmentdepth {\attachmentparameter\c!depth }% + \ifx\currentattachmentsymbol\empty + \ifx\currentattachmentwidth \v!fit\edef\currentattachmentwidth {.5em}\fi + \ifx\currentattachmentheight\v!fit\edef\currentattachmentheight{.5em}\fi + \ifx\currentattachmentdepth \v!fit\let \currentattachmentdepth \zeropoint\fi + \else + \ctxcommand{presetsymbollist("\attachmentparameter\c!symbol")}% + % we cannot yet ask for the wd/ht/dp of an xform else we could use those + \setbox\scrn_attachment_box_symbol\hbox{\symbol[\lastpredefinedsymbol]}% + \ifx\currentattachmentwidth \v!fit\edef\currentattachmentwidth {\wd\scrn_attachment_box_symbol}\fi + \ifx\currentattachmentheight\v!fit\edef\currentattachmentheight{\ht\scrn_attachment_box_symbol}\fi + \ifx\currentattachmentdepth \v!fit\edef\currentattachmentdepth {\dp\scrn_attachment_box_symbol}\fi + \fi + \ctxcommand{insertattachment{ + tag = "\currentattachment", + registered = "\currentattachmentregistered", + width = \number\dimexpr\currentattachmentwidth \relax, + height = \number\dimexpr\currentattachmentheight\relax, + depth = \number\dimexpr\currentattachmentdepth \relax, + color = "\attachmentparameter\c!color", + colormodel = \number\currentcolormodel, + colorvalue = \thecolorattribute{\attachmentparameter\c!color}, + transparencyvalue = \thetransparencyattribute{\attachmentparameter\c!color}, + symbol = "\currentattachmentsymbol", + layer = "\attachmentparameter\c!textlayer", + % these will be overloaded by registered when available + title = "\attachmentparameter\c!title", + subtitle = "\attachmentparameter\c!subtitle", + author = "\attachmentparameter\c!author", + file = "\attachmentparameter\c!file", + name = "\attachmentparameter\c!name", + buffer = "\attachmentparameter\c!buffer", + }}% + \setbox\scrn_attachment_box_link\hbox{\scrn_attachment_place}% + \wd\scrn_attachment_box_link\currentattachmentwidth + \ht\scrn_attachment_box_link\currentattachmentheight + \dp\scrn_attachment_box_link\currentattachmentdepth + \box\scrn_attachment_box_link} + +\setvalue{scrn_attachment_method_\v!hidden}% + {\ctxcommand{insertattachment{ + tag = "\currentattachment", + registered = "\currentattachmentregistered", + method = "\v!hidden" + }}} + +\def\scrn_attachment_place + {\executeifdefined + {\??at:\c!location:\attachmentparameter\c!location}\hbox + {\box\scrn_attachment_box_link}} + +\setvalue{\??at:\c!location:\v!inmargin }{\inmargin } +\setvalue{\??at:\c!location:\v!leftedge }{\inleftedge } +\setvalue{\??at:\c!location:\v!rightedge }{\inrightedge } +\setvalue{\??at:\c!location:\v!leftmargin }{\inleftmargin } +\setvalue{\??at:\c!location:\v!rightmargin}{\inrightmargin} +\setvalue{\??at:\c!location:\v!high }{\high} +\setvalue{\??at:\c!location:\v!none }{\scrn_attachment_collect} + +\def\scrn_attachment_collect#content% + {\global\setbox\scrn_attachment_box_collect\hbox\bgroup + \ifvoid\scrn_attachment_box_collect\else + \box\scrn_attachment_box_collect + \hskip\attachmentparameter\c!distance + \fi + #content% + \egroup} + +\unexpanded\def\placeattachments + {\ifvoid\scrn_attachment_box_collect\else + \box\scrn_attachment_box_collect + \fi} + +\defineattachment[attachment] + +% \ifx\currentinterface\defaultinterface \else +% \defineattachment[\v!attachment] +% \fi + +% backward compatible: + +\unexpanded\def\useattachment + {\doquadrupleempty\scrn_attachment_use} + +\def\scrn_attachment_use[#tag][#title][#name][#file]% + {\iffourthargument + \registerattachment[#tag][title=#title,name=#name,file=#file]% + \else\ifthirdargument + \registerattachment[#tag][title=#title,name=#title,file=#name]% + \else\ifsecondargument + \registerattachment[#tag][title=#title,name=#title,file=#title]% + \else + \registerattachment[#tag][title=#title,name=#tag,file=#tag]% + \fi\fi\fi} + +%D Comments: + +% test +% +% \startcomment +% hello beautiful\\world +% \stopcomment +% +% test +% +% \startcomment[hello] +% hello << eerste >> +% beautiful +% world +% \stopcomment +% +% test +% +% \startcomment[hello][color=green,width=10cm,height=3cm] +% hello +% beautiful +% world +% \stopcomment +% +% test +% +% \startcomment[hello][color=red,width=4cm,height=3cm] +% hello +% +% beautiful +% +% world +% \stopcomment +% +% test +% +% \startcomment[symbol=Balloon] +% Do we want this kind of rubish? +% \stopcomment +% +% test +% +% \definesymbol [comment-normal][{\externalfigure[cow.pdf]}] +% \definesymbol [comment-down] [{\externalfigure[cow.pdf]}] +% +% \def\CowSymbol#1#2% +% {\scale +% [\c!height=#1] +% {\startMPcode +% loadfigure "koe.mp" number 1 ; +% refill currentpicture withcolor #2 ; +% \stopMPcode}} +% +% \definesymbol [comment-normal] +% [\CowSymbol{4ex}{red}] +% +% \definesymbol [comment-down] +% [\CowSymbol{4ex}{green}] +% +% \setupcomment +% [\c!symbol={comment-normal,comment-down}, +% \c!option=\v!buffer] +% +% \startcomment[hello] +% oeps +% \stopcomment +% +% test +% +% \setupcomment +% [\c!symbol=normal, +% \c!option=max,width=10cm] +% +% \startcomment[hello] +% oeps +% \stopcomment +% +% test + +\installcommandhandler\??cc{comment}\??cc + +\newbox\scrn_comment_box_collect +\newbox\scrn_comment_box_rendering +\newbox\scrn_comment_box_link +\newbox\scrn_comment_box_symbol + +\setupcomment + [\c!state=\v!start, + \c!distance=1em, + \c!color=\interactionparameter\c!color, + \c!space=\v!no, + \c!symbol=, + %\c!title=, + %\c!option=, + %\c!textlayer=, + \c!width=\v!fit, + \c!height=\v!fit, + \c!depth=\v!fit, + \c!nx=40, + \c!ny=10, + \c!location=\v!high] + +\presetlocalframed[\??cc] + +\appendtoks + \setuevalue \currentcomment {\scrn_comment_argument{\currentcomment}}% + \setuevalue{\e!start\currentcomment}{\scrn_comment_start {\currentcomment}}% + \setuevalue{\e!stop \currentcomment}{\scrn_comment_stop }% +\to \everydefinecomment + +\unexpanded\def\scrn_comment_argument#category% + {\def\currentcomment{#category}% + \doifelselocation + {\dodoubleempty\scrn_comment_argument_status} + {\dodoubleempty\scrn_comment_argument_ignore}} + +\def\scrn_comment_argument_status + {\doifelse{\commentparameter\c!state}\v!start + \scrn_comment_argument_indeed + \scrn_comment_argument_ignore} + +\def\scrn_comment_argument_indeed[#title][#settings]#text% + {\doifassignmentelse{#title} + {\setupcomment[\currentcomment][#title]} + {\setupcomment[\currentcomment][\c!title=#title,#settings]}% + \ctxlua{buffers.assign("\v!comment",\!!bs#text\!!es)}% todo: expansion control, but expanded by default (xml) + \scrn_comment_inject + \ignorespaces} + +\def\scrn_comment_argument_ignore[#title][#settings]#text% + {\ignorespaces} + +\unexpanded\def\scrn_comment_start#category% + {\def\currentcomment{#category}% + \doifelselocation + {\dodoubleempty\scrn_comment_start_indeed} + {\dodoubleempty\scrn_comment_start_ignore}} + +\def\scrn_comment_start_indeed + {\doifelse{\commentparameter\c!state}\v!start + {\scrn_comment_start_indeed} + {\scrn_comment_start_ignore}} + +\def\scrn_comment_start_indeed[#title][#settings]% + {\bgroup + \doifassignmentelse{#title} + {\setupcomment[\currentcomment][#title]} + {\setupcomment[\currentcomment][\c!title=#title,#settings]}% + \def\scrn_comment_stop{\scrn_comment_inject\egroup}% + \dostartbuffer[\v!comment][\e!start\currentcomment][\e!stop\currentcomment]} + +\def\scrn_comment_start_ignore + {\expandafter\gobbleuntil\csname\e!stop\currentcomment\endcsname} + +\unexpanded\def\scrn_comment_stop + {} + +\def\scrn_comment_inject + {\expandcheckedcsname{scrn_comment_method_}{\commentparameter\c!method}\v!normal} + +%D Beware: comments symbols don't scale in acrobat (cf. spec but somewhat +%D weird, esp because for instance attachment symbols do scale). + +\setvalue{scrn_comment_method_\v!normal}% + {\edef\currentcommentsymbol{\commentparameter\c!symbol}% + \edef\currentcommentwidth {\commentparameter\c!width }% + \edef\currentcommentheight{\commentparameter\c!height}% + \edef\currentcommentdepth {\commentparameter\c!depth }% + \ifx\currentcommentsymbol\empty + \ifx\currentcommentwidth \v!fit\edef\currentcommentwidth {.5em}\fi + \ifx\currentcommentheight\v!fit\edef\currentcommentheight{.5em}\fi + \ifx\currentcommentdepth \v!fit\let \currentcommentdepth \zeropoint\fi + \else + \ctxcommand{presetsymbollist("\commentparameter\c!symbol")}% + % we cannot yet ask for the wd/ht/dp of an xform else we could use those + \setbox\scrn_comment_box_symbol\hbox{\symbol[\lastpredefinedsymbol]}% + \ifx\currentcommentwidth \v!fit\edef\currentcommentwidth {\wd\scrn_comment_box_symbol}\fi + \ifx\currentcommentheight\v!fit\edef\currentcommentheight{\ht\scrn_comment_box_symbol}\fi + \ifx\currentcommentdepth \v!fit\edef\currentcommentdepth {\dp\scrn_comment_box_symbol}\fi + \fi + \ctxcommand{insertcomment{ + tag = "\currentcomment", + title = "\commentparameter\c!title", + subtitle = "\commentparameter\c!subtitle", + author = "\commentparameter\c!author", + width = \number\dimexpr\currentcommentwidth, + height = \number\dimexpr\currentcommentheight, + depth = \number\dimexpr\currentcommentdepth, + nx = \commentparameter\c!nx, + ny = \commentparameter\c!ny, + colormodel = \number\currentcolormodel, + colorvalue = \thecolorattribute{\commentparameter\c!color}, + transparencyvalue = \thetransparencyattribute{\commentparameter\c!color}, + option = "\commentparameter\c!option", % todo + symbol = "\commentparameter\c!symbol", + buffer = "\v!comment", + layer = "\commentparameter\c!textlayer" + }}% + \wd\scrn_comment_box_link\currentcommentwidth + \ht\scrn_comment_box_link\currentcommentheight + \dp\scrn_comment_box_link\currentcommentdepth + \scrn_comment_place} + +\setvalue{scrn_comment_method_\v!hidden}% + {} + +% todo: dedicated margin classes + +\def\scrn_comment_place + {\executeifdefined + {\??cc:\c!location:\commentparameter\c!location}\hbox + {\hbox{\box\scrn_comment_box_link}}} + +\setvalue{\??cc:\c!location:\v!inmargin }{\inmargin } +\setvalue{\??cc:\c!location:\v!leftedge }{\inleftedge } +\setvalue{\??cc:\c!location:\v!rightedge }{\inrightedge } +\setvalue{\??cc:\c!location:\v!leftmargin }{\inleftmargin } +\setvalue{\??cc:\c!location:\v!rightmargin}{\inrightmargin} +\setvalue{\??cc:\c!location:\v!high }{\high} +\setvalue{\??cc:\c!location:\v!none }{\scrn_comment_collect} + +\def\scrn_comment_collect#content% + {\global\setbox\scrn_comment_box_collect\hbox\bgroup + \ifvoid\scrn_comment_box_collect\else + \box\scrn_comment_box_collect + \hskip\commentparameter\c!distance + \fi + #content% + \egroup} + +\unexpanded\def\placecomments + {\ifvoid\scrn_comment_box_collect\else + \box\scrn_comment_box_collect + \fi} + +\definecomment[comment] + +% \ifx\currentinterface\defaultinterface \else +% \definecomment[\v!comment] +% \fi + +%D Soundclips: +%D +%D Defining sound tracks: +%D +%D \starttyping +%D \useexternalsoundtrack[label][file] +%D \stoptyping +%D +%D associated actions: StartSound StopSound PauseSound ResumeSound +%D +%D Todo: like external figures, also search on path, +%D although, they need to be present ar viewing time, so ... + +\unexpanded\def\useexternalsoundtrack + {\dodoubleargument\scrn_soundtrack_indeed} + +\def\scrn_soundtrack_indeed[#tag][#filename]% + {\ctxcommand{registersoundclip{ + tag = "#tag", + file = "#filename" + }}} + +\def\checksoundtrack#tag% yet untested in mkiv (also move management to lua) + {\iflocation + \ctxcommand{insertsoundclip{ + tag = "#tag", + repeat = "\@@sdoption", % not entirely ok but works + }}% + \fi} + +\unexpanded\def\setupexternalsoundtracks + {\dodoubleargument\getparameters[\??sd]} + +\setupexternalsoundtracks + [\c!option=] + +%D Renderings (not yet tested in mkvi): + +% Todo: multiple instances and inheritance .. will be done when +% needed i.e. when I see usage. + +\let\currentrendering\empty + +\definereference[StartCurrentRendering] [\v!StartRendering {\currentrendering}] +\definereference[StopCurrentRendering] [\v!StopRendering {\currentrendering}] +\definereference[PauseCurrentRendering] [\v!PauseRendering {\currentrendering}] +\definereference[ResumeCurrentRendering][\v!ResumeRendering{\currentrendering}] + +\def\useexternalrendering{\doquadrupleempty\scrn_rendering_use} +\def\setinternalrendering{\dodoubleempty \scrn_rendering_set} + +\def\scrn_rendering_use[#tag][#mime][#file][#option]% + {\ctxlua{interactions.renderings.register { + type = "external", + label = "#tag", + mime = "#mime", + filename = "#file", + option = "#option", + }}} + +\def\scrn_rendering_set[#tag][#option]% {content} + {\bgroup + \dowithnextbox + {\ctxlua{interactions.renderings.register { + type = "internal", + label = "#tag", + mime = "IRO", % brrr + filename = "#tag", + option = "#option", + }}% + \let\objectoffset\zeropoint + \setobject{IRO}{#tag}\hbox{\box\nextbox}% + \egroup}% + \hbox} + +\def\renderingtype #tag{\ctxlua{interactions.renderings.var("#tag","type")}} +\def\renderingoption#tag{\ctxlua{interactions.renderings.var("#tag","option")}} + +\def\renderingwidth {8cm} % will become private +\def\renderingheight {6cm} % will become private + +\unexpanded\def\definerenderingwindow + {\dodoubleempty\scrn_rendering_define_window} + +\def\scrn_rendering_define_window[#tag][#settings]% + {\presetlocalframed[\??rw#tag]% + \getparameters + [\??rw#tag]% + [\c!openpageaction=,\c!closepageaction=,% + \c!width=\renderingwidth,\c!height=\renderingheight,% + #settings]} + +\unexpanded\def\setuprenderingwindow + {\dodoubleargument\scrn_rendering_setup_window} + +\def\scrn_rendering_setup_window[#tag]% + {\getparameters[\??rw#tag]} + +\unexpanded\def\placerenderingwindow + {\dodoubleempty\scrn_rendering_place_window} + +\def\scrn_rendering_place_window[#window][#rendering]% + {\bgroup + \edef\currentrendering{\ifsecondargument#rendering\else#window\fi}% + \doifelse{\renderingtype\currentrendering}{internal} % an object + {\getobjectdimensions{IRO}\currentrendering + \edef\renderingheight{\the\dimexpr\objectheight+\objectdepth\relax}% + \edef\renderingwidth{\objectwidth}% + \dogetobjectreferencepage{IRO}\currentrendering\renderingpage}% + {\def\renderingheight{\vsize}% + \def\renderingwidth{\hsize}% + \def\renderingpage{\realpageno}}% + % create fall back if needed + \ifcsname\??rw#window\c!width\endcsname + \def\currentrenderingwindow{#window}% + \else + \let\currentrenderingwindow\s!default + \scrn_rendering_define_window[\currentrenderingwindow]% + \fi +% todo +% \handlereferenceactions{\getvalue{\??rw\currentrenderingwindow\c!openpageaction }}\dosetuprenderingopenpageaction +% \handlereferenceactions{\getvalue{\??rw\currentrenderingwindow\c!closepageaction}}\dosetuprenderingclosepageaction + \localframed + [\??rw\currentrenderingwindow][\c!offset=\v!overlay]% + {\vfill + \ctxcommand{insertrenderingwindow { + label = "\currentrendering", + width = \number\dimexpr\renderingwidth\relax, + height = \number\dimexpr\renderingheight\relax, + option = "\renderingoption\currentrendering", + page = \number\renderingpage, + }}\hfill}% + \egroup} + +%D Linkedlists (not tested in mkvi): + +% %D The next mechanism, linked lists, is quite old and +% %D is \MKIV'd for completeness. I will finish the +% %D configuration part when I need it. +% %D +% %D \starttyping +% %D \setupinteraction[state=start] +% %D \definelinkedlist[demo] +% %D \dorecurse{10}{\linkedlistelement[demo]{link \recurselevel} \page} +% %D \stoptyping +% +% \installcommandhandler\??lk{linkedlist}\??lk +% +% \let\setupbutton\setuplinkedlists\setuplinkedlist +% +% \appendtoks +% \ctxcommand{definelinkedlist("\currentlinkedlist")}% +% \to \everydefinelinkedlist +% +% \def\setlinkedlistproperties#1#2#3#4#5#6% +% {\def\currentlink {#1}% +% \def\noflinks {#2}% +% \def\firstlink {#3}% +% \def\previouslink{#4}% +% \def\nextlink {#5}% +% \def\lastlink {#6}} +% +% \def\linkedlistelement[#1]#2% currently no view support +% {\dontleavehmode\hbox\bgroup +% #2% +% \iflocation +% \edef\currentlinkedlist{#1}% +% \ifcsname\??lk\currentlinkedlist\s!parent\endcsname +% \hskip\linkedlistparameter\c!distance +% \ctxcommand{addlinklistelement("\currentlinkedlist")}% +% \expanded{\ctxlatelua{commands.enhancelinkedlist("\currentlinkedlist",\currentlink)}}% can also be done at the lua end +% \dogotosomepage {\??lk\currentlinkedlist}\gotobegincharacter \firstlink +% \ifnum\noflinks>\plustwo +% \dogotosomepage{\??lk\currentlinkedlist}\gobackwardcharacter\previouslink +% \dogotosomepage{\??lk\currentlinkedlist}\goforwardcharacter \nextlink +% \fi +% \dogotosomepage {\??lk\currentlinkedlist}\gotoendcharacter \lastlink +% \else +% \writestatus\m!interactions{no such linked list: \currentlinkedlist}% +% \fi +% \fi +% \egroup} +% +% \setuplinkedlists +% [\c!distance=.25em, +% \c!width=\v!fit, +% \c!location=\v!low, +% \c!color=\interactionparameter\c!color, +% \c!frame=\v!off, +% \c!background=, +% \c!backgroundcolor=] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/scrp-cjk.lua b/Master/texmf-dist/tex/context/base/scrp-cjk.lua index 997baaa962b..d817c28cf86 100644 --- a/Master/texmf-dist/tex/context/base/scrp-cjk.lua +++ b/Master/texmf-dist/tex/context/base/scrp-cjk.lua @@ -7,28 +7,28 @@ if not modules then modules = { } end modules ['scrp-cjk'] = { } local has_attribute = node.has_attribute -local make_glue_node = nodes.glue -local make_penalty_node = nodes.penalty local insert_node_after = node.insert_after local insert_node_before = node.insert_before local remove_node = nodes.remove -local glyph = node.id('glyph') -local glue = node.id('glue') -local penalty = node.id('penalty') +local nodepool = nodes.pool +local new_glue = nodepool.glue +local new_penalty = nodepool.penalty -local preproc = attributes.private('preproc') -local prestat = attributes.private('prestat') +local nodecodes = nodes.nodecodes +local glyph_code = nodecodes.glyph -scripts.cjk = scripts.cjk or { } +local a_prestat = attributes.private('prestat') +local a_preproc = attributes.private('preproc') -local kind_to_number = scripts.kind_to_number -local number_to_kind = scripts.number_to_kind -local hash = scripts.hash -local cjk = scripts.cjk +local categorytonumber = scripts.categorytonumber +local numbertocategory = scripts.numbertocategory +local hash = scripts.hash +local numbertodataset = scripts.numbertodataset -local fontdata = fonts.identifiers -local quaddata = fonts.quads +local fonthashes = fonts.hashes +local fontdata = fonthashes.identifiers +local quaddata = fonthashes.quads -- raggedleft is controlled by leftskip and we might end up with a situation where -- the intercharacter spacing interferes with this; the solution is to patch the @@ -50,123 +50,135 @@ end -- at font definition time and/or just assume a correct font local function nobreak(head,current) - insert_node_before(head,current,make_penalty_node(10000)) + insert_node_before(head,current,new_penalty(10000)) end + local function stretch_break(head,current) - insert_node_before(head,current,make_glue_node(0,inter_char_stretch,0)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) end + local function shrink_break(head,current) - insert_node_before(head,current,make_glue_node(0,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end + local function nobreak_stretch(head,current) - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,inter_char_stretch,0)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) end + local function korean_break(head,current) - insert_node_before(head,current,make_penalty_node(inter_char_hangul_penalty)) + insert_node_before(head,current,new_penalty(inter_char_hangul_penalty)) end local function nobreak_shrink(head,current) - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,0,inter_char_half_shrink)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end + local function nobreak_autoshrink(head,current) if true then - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,0,inter_char_half_shrink)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end end local function nobreak_stretch_nobreak_shrink(head,current) - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,inter_char_stretch,0)) - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,0,inter_char_half_shrink)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end + local function nobreak_stretch_nobreak_autoshrink(head,current) - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,inter_char_stretch,0)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) if true then - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,0,inter_char_half_shrink)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end end local function nobreak_shrink_nobreak_stretch(head,current) - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,0,inter_char_half_shrink)) - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,inter_char_stretch,0)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) end + local function nobreak_autoshrink_nobreak_stretch(head,current) if true then - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,0,inter_char_half_shrink)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,inter_char_stretch,0)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) end local function nobreak_shrink_break_stretch(head,current) - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,0,inter_char_half_shrink)) - insert_node_before(head,current,make_glue_node(0,inter_char_stretch,0)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) end + local function nobreak_autoshrink_break_stretch(head,current) if true then - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,0,inter_char_half_shrink)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end - insert_node_before(head,current,make_glue_node(0,inter_char_stretch,0)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) end local function nobreak_shrink_break_stretch_nobreak_shrink(head,current) - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,0,inter_char_half_shrink)) - insert_node_before(head,current,make_glue_node(0,inter_char_stretch,0)) - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,inter_char_stretch,0)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) end + local function nobreak_autoshrink_break_stretch_nobreak_autoshrink(head,current) if true then - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,0,inter_char_half_shrink)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end - insert_node_before(head,current,make_glue_node(0,inter_char_stretch,0)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) if true then - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,0,inter_char_half_shrink)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end end + local function nobreak_autoshrink_break_stretch_nobreak_shrink(head,current) if true then - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,0,inter_char_half_shrink)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end - insert_node_before(head,current,make_glue_node(0,inter_char_stretch,0)) - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end + local function nobreak_shrink_break_stretch_nobreak_autoshrink(head,current) - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,0,inter_char_half_shrink)) - insert_node_before(head,current,make_glue_node(0,inter_char_stretch,0)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) if true then - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,inter_char_stretch,0)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) end end local function nobreak_stretch_break_shrink(head,current) - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,inter_char_stretch,0)) - insert_node_before(head,current,make_glue_node(0,0,inter_char_half_shrink)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end + local function nobreak_stretch_break_autoshrink(head,current) - insert_node_before(head,current,make_penalty_node(10000)) - insert_node_before(head,current,make_glue_node(0,inter_char_stretch,0)) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) if true then - insert_node_before(head,current,make_glue_node(0,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end end @@ -307,28 +319,22 @@ local injectors = { -- [previous] [current] }, } -local dataset = { - inter_char_stretch_factor = 0.50, -- of quad - inter_char_half_shrink_factor = 0.50, -- of quad - inter_char_hangul_penalty = 50, -} - local function process(head,first,last) if first ~= last then - local lastfont, previous, originals, last = nil, "start", nil, nil + local lastfont, previous, last = nil, "start", nil while true do local upcoming, id = first.next, first.id - if id == glyph then - local a = has_attribute(first,prestat) - local current = number_to_kind[a] + if id == glyph_code then + local a = has_attribute(first,a_prestat) + local current = numbertocategory[a] local action = injectors[previous] if action then action = action[current] if action then local font = first.font if font ~= lastfont then - lastfont, done = font, true - set_parameters(font,dataset) + lastfont = font + set_parameters(font,numbertodataset[has_attribute(first,a_preproc)]) end action(head,first) end @@ -338,9 +344,9 @@ local function process(head,first,last) local p, n = first.prev, upcoming if p and n then local pid, nid = p.id, n.id - if pid == glyph and nid == glyph then - local pa, na = has_attribute(p,prestat), has_attribute(n,prestat) - local pcjk, ncjk = pa and number_to_kind[pa], na and number_to_kind[na] + if pid == glyph_code and nid == glyph_code then + local pa, na = has_attribute(p,a_prestat), has_attribute(n,a_prestat) + local pcjk, ncjk = pa and numbertocategory[pa], na and numbertocategory[na] if not pcjk or not ncjk or pcjk == "korean" or ncjk == "korean" or pcjk == "other" or ncjk == "other" @@ -359,7 +365,7 @@ local function process(head,first,last) previous = "start" end end - if upcoming == stop then + if upcoming == last then -- was stop break else first = upcoming @@ -368,9 +374,16 @@ local function process(head,first,last) end end -scripts.install { - name = "hangul", - process = process, +scripts.installmethod { + name = "hangul", + process = process, + datasets = { + default = { + inter_char_stretch_factor = 0.50, -- of quad + inter_char_half_shrink_factor = 0.50, -- of quad + inter_char_hangul_penalty = 50, + }, + }, } -- hanzi (chinese) @@ -510,28 +523,22 @@ local injectors = { -- [previous] [current] }, } -local dataset = { - inter_char_stretch_factor = 0.50, -- of quad - inter_char_half_shrink_factor = 0.50, -- of quad - inter_char_hangul_penalty = 50, -} - local function process(head,first,last) if first ~= last then - local lastfont, previous, originals, last = nil, "start", nil, nil + local lastfont, previous, last = nil, "start", nil while true do local upcoming, id = first.next, first.id - if id == glyph then - local a = has_attribute(first,prestat) - local current = number_to_kind[a] + if id == glyph_code then + local a = has_attribute(first,a_prestat) + local current = numbertocategory[a] local action = injectors[previous] if action then action = action[current] if action then local font = first.font if font ~= lastfont then - lastfont, done = font, true - set_parameters(font,dataset) + lastfont = font + set_parameters(font,numbertodataset[has_attribute(first,a_preproc)]) end action(head,first) end @@ -541,13 +548,14 @@ local function process(head,first,last) local p, n = first.prev, upcoming if p and n then local pid, nid = p.id, n.id - if pid == glyph and nid == glyph then - local pa, na = has_attribute(p,prestat), has_attribute(n,prestat) - local pcjk, ncjk = pa and number_to_kind[pa], na and number_to_kind[na] + if pid == glyph_code and nid == glyph_code then + local pa, na = has_attribute(p,a_prestat), has_attribute(n,a_prestat) + local pcjk, ncjk = pa and numbertocategory[pa], na and numbertocategory[na] if not pcjk or not ncjk or pcjk == "korean" or ncjk == "korean" or pcjk == "other" or ncjk == "other" - or pcjk == "jamo_final" or ncjk == "jamo_initial" then + -- or pcjk == "jamo_final" or ncjk == "jamo_initial" then + or pcjk == "jamo_final" or ncjk == "jamo_initial" or pcjk == "half_width_close" or ncjk == "half_width_open" then previous = "start" else -- if head ~= first then remove_node(head,first,true) @@ -562,7 +570,7 @@ local function process(head,first,last) previous = "start" end end - if upcoming == stop then + if upcoming == last then -- was stop break else first = upcoming @@ -571,7 +579,14 @@ local function process(head,first,last) end end -scripts.install { - name = "hanzi", - process = process, +scripts.installmethod { + name = "hanzi", + process = process, + datasets = { + default = { + inter_char_stretch_factor = 0.50, -- of quad + inter_char_half_shrink_factor = 0.50, -- of quad + inter_char_hangul_penalty = 50, + }, + }, } diff --git a/Master/texmf-dist/tex/context/base/scrp-eth.lua b/Master/texmf-dist/tex/context/base/scrp-eth.lua new file mode 100644 index 00000000000..75fad24811c --- /dev/null +++ b/Master/texmf-dist/tex/context/base/scrp-eth.lua @@ -0,0 +1,151 @@ +if not modules then modules = { } end modules ['scrp-eth'] = { + version = 1.001, + comment = "companion to scrp-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- at some point I will review the script code but for the moment we +-- do it this way; so space settings like with cjk yet + +local has_attribute = node.has_attribute +local insert_node_before = node.insert_before + +local nodepool = nodes.pool + +local new_glue = nodepool.glue +local new_penalty = nodepool.penalty + +local nodecodes = nodes.nodecodes +local glyph_code = nodecodes.glyph + +local a_prestat = attributes.private('prestat') +local a_preproc = attributes.private('preproc') + +local categorytonumber = scripts.categorytonumber +local numbertocategory = scripts.numbertocategory +local hash = scripts.hash +local numbertodataset = scripts.numbertodataset + +local fonthashes = fonts.hashes +local parameters = fonthashes.parameters + +local space, stretch, shrink, lastfont + +local inter_character_space_factor = 1 +local inter_character_stretch_factor = 1 +local inter_character_shrink_factor = 1 + +local function space_glue(current) + local data = numbertodataset[has_attribute(current,a_preproc)] + if data then + inter_character_space_factor = data.inter_character_space_factor or 1 + inter_character_stretch_factor = data.inter_character_stretch_factor or 1 + inter_character_shrink_factor = data.inter_character_shrink_factor or 1 + end + local font = current.font + if lastfont ~= font then + local pf = parameters[font] + space = pf.space + stretch = pf.space_stretch + shrink = pf.space_shrink + lastfont = font + end + return new_glue( + inter_character_space_factor * space, + inter_character_stretch_factor * stretch, + inter_character_shrink_factor * shrink + ) +end + +local function insert_space(head,current) + insert_node_before(head,current,space_glue(current)) +end + +local function insert_zerowidthspace(head,current) + insert_node_before(head,current,new_glue(0)) +end + +local function insert_nobreakspace(head,current) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,space_glue(current)) +end + +-- syllable [zerowidthspace] syllable +-- syllable [zerowidthspace] word +-- syllable [zerowidthspace] sentence +-- word [nobreakspace] syllable +-- word [space] word +-- word [space] sentence +-- sentence [nobreakspace] syllable +-- sentence [space] word +-- sentence [space] sentence + +local injectors = { -- [previous] [current] + ethiopic_syllable = { + ethiopic_syllable = insert_zerowidthspace, + ethiopic_word = insert_nobreakspace, + ethiopic_sentence = insert_nobreakspace, + }, + ethiopic_word = { + ethiopic_syllable = insert_space, + ethiopic_word = insert_space, + ethiopic_sentence = insert_space, + }, + ethiopic_sentence = { + ethiopic_syllable = insert_space, + ethiopic_word = insert_space, + ethiopic_sentence = insert_space, + }, +} + +local function process(head,first,last) + if first ~= last then + local injector = false + local current = first + while current do + local id = current.id + if id == glyph_code then + local prestat = has_attribute(current,a_prestat) + local category = numbertocategory[prestat] + if injector then + local action = injector[category] + if action then + action(head,current) + end + end + injector = injectors[category] + else + -- nothing yet + end + if current == last then + break + else + current = current.next + end + end + end +end + +scripts.installmethod { + name = "ethiopic", + process = process, + datasets = { + default = { + inter_character_space_factor = 1, + inter_character_stretch_factor = 1, + inter_character_shrink_factor = 1, + }, + half = { + inter_character_space_factor = 0.5, + inter_character_stretch_factor = 0.5, + inter_character_shrink_factor = 0.5, + }, + quarter = { + inter_character_space_factor = 0.25, + inter_character_stretch_factor = 0.25, + inter_character_shrink_factor = 0.25, + }, + }, +} diff --git a/Master/texmf-dist/tex/context/base/scrp-ini.lua b/Master/texmf-dist/tex/context/base/scrp-ini.lua index b28c297d0bd..ef036cdf686 100644 --- a/Master/texmf-dist/tex/context/base/scrp-ini.lua +++ b/Master/texmf-dist/tex/context/base/scrp-ini.lua @@ -6,39 +6,53 @@ if not modules then modules = { } end modules ['scrp-ini'] = { license = "see context related readme files" } +-- we need to rewrite this a bit ... rather old code + +local attributes, nodes, node = attributes, nodes, node + +local texwrite = tex.write + local trace_analyzing = false trackers.register("scripts.analyzing", function(v) trace_analyzing = v end) local trace_injections = false trackers.register("scripts.injections", function(v) trace_injections = v end) +local report_preprocessing = logs.reporter("scripts","preprocessing") + +local allocate = utilities.storage.allocate + local set_attribute = node.set_attribute local has_attribute = node.has_attribute -local first_character = node.first_character +local first_glyph = node.first_glyph or node.first_character local traverse_id = node.traverse_id -local glyph = node.id('glyph') -local glue = node.id('glue') -local penalty = node.id('penalty') +local texsetattribute = tex.setattribute + +local nodecodes = nodes.nodecodes +local unsetvalue = attributes.unsetvalue + +local glyph_code = nodecodes.glyph +local glue_code = nodecodes.glue -local fcs = (fonts.color and fonts.color.set) or function() end -local fcr = (fonts.color and fonts.color.reset) or function() end +local a_preproc = attributes.private('preproc') +local a_prestat = attributes.private('prestat') -local state = attributes.private('state') -local preproc = attributes.private('preproc') -local prestat = attributes.private('prestat') +local fontdata = fonts.hashes.identifiers -local fontdata = fonts.ids +local setnodecolor = nodes.tracers.colors.set -scripts = scripts or { } -scripts.handlers = scripts.handlers or { } +scripts = scripts or { } +local scripts = scripts -scripts.names = scripts.names or { } -scripts.numbers = scripts.numbers or { } -scripts.hash = scripts.hash or { } +scripts.hash = scripts.hash or { } +local hash = scripts.hash -storage.register("scripts/hash", scripts.hash, "scripts.hash") +local handlers = allocate() +scripts.handlers = handlers -if not next(scripts.hash) then +storage.register("scripts/hash", hash, "scripts.hash") - local hash = { +if not next(hash) then + + hash = { -- no local -- -- half width opening parenthesis [0x0028] = "half_width_open", @@ -159,26 +173,121 @@ if not next(scripts.hash) then for i=0x01160,0x011A7 do if not hash[i] then hash[i] = "jamo_medial" end end for i=0x011A8,0x011FF do if not hash[i] then hash[i] = "jamo_final" end end + for i=0x01200,0x0139F do hash[i] = "ethiopic_syllable" end + + hash[0x01361] = "ethiopic_word" + hash[0x01362] = "ethiopic_sentence" + scripts.hash = hash end -scripts.colors = { -- todo: just named colors - korean = "font:isol", - chinese = "font:rest", - full_width_open = "font:init", - full_width_close = "font:fina", - half_width_open = "font:init", - half_width_close = "font:fina", - hyphen = "font:medi", - non_starter = "font:isol", - jamo_initial = "font:init", - jamo_medial = "font:medi", - jamo_final = "font:fina", +local numbertodataset = allocate() +local numbertohandler = allocate() + +--~ storage.register("scripts/hash", hash, "scripts.hash") + +scripts.numbertodataset = numbertodataset + +function scripts.installmethod(handler) + local name = handler.name + handlers[name] = handler + local attributes = { } + local datasets = handler.datasets + if not datasets or not datasets.default then + report_preprocessing("missing (default) dataset in script '%s'",name) + end + setmetatable(attributes, { + __index = function(t,k) + local v = datasets[k] or datasets.default + local a = unsetvalue + if v then + v.name = name -- for tracing + a = #numbertodataset + 1 + numbertodataset[a] = v + numbertohandler[a] = handler + end + t[k] = a + return a + end + } ) + handler.attributes = attributes +end + +function scripts.installdataset(specification) -- global overload + local method = specification.method + local name = specification.name + local dataset = specification.dataset + if method and name and dataset then + local parent = specification.parent or "" + local handler = handlers[method] + if handler then + local datasets = handler.datasets + if datasets then + local defaultset = datasets.default + if defaultset then + if parent ~= "" then + local p = datasets[parent] + if p then + defaultset = p + else + report_preprocessing("dataset, unknown parent '%s' for method '%s'",parent,method) + end + end + setmetatable(dataset,defaultset) + local existing = datasets[name] + if existing then + for k, v in next, existing do + existing[k] = dataset + end + else + datasets[name] = dataset + end + else + report_preprocessing("dataset, no default for method '%s'",method) + end + else + report_preprocessing("dataset, no datasets for method '%s'",method) + end + else + report_preprocessing("dataset, no method '%s'",method) + end + else + report_preprocessing("dataset, invalid specification") -- maybe report table + end +end + +function scripts.set(name,method,preset) + local handler = handlers[method] + texsetattribute(a_preproc,handler and handler.attributes[preset] or unsetvalue) +end + +function scripts.reset() + texsetattribute(handler.attributes[preset]) +end + +-- the following tables will become a proper installer (move to cjk/eth) +local scriptcolors = allocate { -- todo: just named colors + korean = "trace:0", + chinese = "trace:0", + full_width_open = "trace:1", + full_width_close = "trace:2", + half_width_open = "trace:3", + half_width_close = "trace:4", + hyphen = "trace:5", + non_starter = "trace:6", + jamo_initial = "trace:7", + jamo_medial = "trace:8", + jamo_final = "trace:9", + ethiopic_syllable = "trace:1", + ethiopic_word = "trace:2", + ethiopic_sentence = "trace:3", } -scripts.number_to_kind = { +scripts.colors = scriptcolors + +local numbertocategory = allocate { -- rather bound to cjk ... will be generalized "korean", "chinese", "full_width_open", @@ -190,62 +299,23 @@ scripts.number_to_kind = { "jamo_initial", "jamo_medial", "jamo_final", + "ethiopic_syllable", + "ethiopic_word", + "ethiopic_sentence", } -scripts.kind_to_number = { - korean = 1, - chinese = 2, - full_width_open = 3, - full_width_close = 4, - half_width_open = 5, - half_width_close = 6, - hyphen = 7, - non_starter = 8, - jamo_initial = 9, - jamo_medial = 10, - jamo_final = 11, -} - -local kind_to_number = scripts.kind_to_number -local number_to_kind = scripts.number_to_kind - --- no, this time loading the lua always precedes the definitions --- --- storage.register("scripts/names", scripts.names, "scripts.names") --- storage.register("scripts/numbers", scripts.numbers, "scripts.numbers") - -local handlers = scripts.handlers -local names = scripts.names -local numbers = scripts.numbers -local hash = scripts.hash -local colors = scripts.colors - --- maybe also process - -function scripts.install(handler) - local name = handler.name - if not names[name] then - local n = #numbers + 1 - numbers[n] = name - names[name] = n - handlers[n] = handler - end - return names[name] -end - -function scripts.define(name) - tex.write(names[name] or attributes.unsetvalue) -end +local categorytonumber = allocate(table.swapped(numbertocategory)) -- could be one table --- some time i will make a fonts.originals[id] +scripts.categorytonumber = categorytonumber +scripts.numbertocategory = numbertocategory local function colorize(start,stop) - for n in traverse_id(glyph,start) do - local kind = number_to_kind[has_attribute(n,prestat)] + for n in traverse_id(glyph_code,start) do + local kind = numbertocategory[has_attribute(n,a_prestat)] if kind then - local ac = colors[kind] + local ac = scriptcolors[kind] if ac then - fcs(n,ac) + setnodecolor(n,ac) end end if n == stop then @@ -257,9 +327,11 @@ end local function traced_process(head,first,last,process,a) if start ~= last then local f, l = first, last - logs.report("preprocess","before %s: %s",names[a] or "?",nodes.tosequence(f,l)) + local name = numbertodataset[a] + name = name and name.name or "?" + report_preprocessing("before %s: %s",name,nodes.tosequence(f,l)) process(head,first,last) - logs.report("preprocess","after %s: %s", names[a] or "?",nodes.tosequence(f,l)) + report_preprocessing("after %s: %s", name,nodes.tosequence(f,l)) end end @@ -269,7 +341,7 @@ end -- one of the time consuming functiions: function scripts.preprocess(head) - local start = first_character(head) + local start = first_glyph(head) if not start then return head, false else @@ -277,8 +349,8 @@ function scripts.preprocess(head) local done, first, last, ok = false, nil, nil, false while start do local id = start.id - if id == glyph then - local a = has_attribute(start,preproc) + if id == glyph_code then + local a = has_attribute(start,a_preproc) if a then if a ~= last_a then if first then @@ -296,20 +368,20 @@ function scripts.preprocess(head) first, last = nil, nil end last_a = a - local handler = handlers[a] + local handler = numbertohandler[a] normal_process = handler.process end if normal_process then local f = start.font if f ~= lastfont then - originals = fontdata[f].originals + originals = fontdata[f].resources.originals lastfont = f end local c = start.char if originals then c = originals[c] or c end local h = hash[c] if h then - set_attribute(start,prestat,kind_to_number[h]) + set_attribute(start,a_prestat,categorytonumber[h]) if not first then first, last = start, start else @@ -347,7 +419,7 @@ function scripts.preprocess(head) end first, last = nil, nil end - elseif id == glue then + elseif id == glue_code then if ok then -- continue elseif first then diff --git a/Master/texmf-dist/tex/context/base/scrp-ini.mkiv b/Master/texmf-dist/tex/context/base/scrp-ini.mkiv index 6e6b1061032..0e50452ff3b 100644 --- a/Master/texmf-dist/tex/context/base/scrp-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/scrp-ini.mkiv @@ -15,9 +15,10 @@ \registerctxluafile{scrp-ini}{1.001} \registerctxluafile{scrp-cjk}{1.001} +\registerctxluafile{scrp-eth}{1.001} -\definesystemattribute[preproc] \chardef\preprocattribute \dogetattributeid{preproc} -\definesystemattribute[prestat] \chardef\prestatattribute \dogetattributeid{prestat} +\definesystemattribute[preproc][public] +\definesystemattribute[prestat][public] %D Since scripts need specific \LUA\ code we use hard coded attribute %D values, but we might have more tricks at some time, so we use a @@ -25,67 +26,39 @@ \unprotect -\def\s!attribute{attribute} +\installcommandhandler\??ls{script}\??ls -\def\namedscriptparameter#1#2% - {\csname\doscriptparameter{\??ls#1}#2\endcsname} +% presets are global and are currently defined in lua -\def\scriptparameter#1% - {\csname\doscriptparameter{\??ls\currentscript}#1\endcsname} +\appendtoks + \setuevalue\currentscript{\setscript[\currentscript]}% +\to \everydefinescript -\def\doscriptparameter#1#2% - {\ifcsname#1#2\endcsname#1#2\else\expandafter\doscriptparentparameter\csname#1\s!parent\endcsname#2\fi} +\unexpanded\def\dosetscript + {\ctxlua{scripts.set("\currentscript","\scriptparameter\c!method","\scriptparameter\c!preset")}} -\def\doscriptparentparameter#1#2% - {\ifx#1\relax\s!empty\else\doscriptparameter#1#2\fi} +\unexpanded\def\setscript[#1]% + {\edef\currentscript{#1}% + \dosetscript} -% \def\scriptparameterhash#1% -% {\doscriptparameterhash{\??ls\currentscript}#1} -% -% \def\doscriptparameterhash#1#2% -% {\ifcsname#1#2\endcsname#1\else\expandafter\doscriptparentparameterhash\csname#1\s!parent\endcsname#2\fi} -% -% \def\doscriptparentparameterhash#1#2% -% {\ifx#1\relax\else\doscriptparameterhash#1#2\fi} +\unexpanded\def\resetscript + {\ctxlua{scripts.reset()}} -% when #2 == string, then only synonym, no settings +\unexpanded\def\startscript[#1]% + {\begingroup + \edef\currentscript{#1}% + \dosetscript} -\unexpanded\def\definescript - {\dodoubleargument\dodefinescript} +\unexpanded\def\stopscript + {\endgroup} -\def\dodefinescript[#1][#2]% - {\doifassignmentelse{#2} - {\getparameters[\??ls#1][\c!method=,\s!parent=,#2]% - \doifelsenothing{\namedscriptparameter{#1}\c!method} - {\letvalue {\??ls#1\s!attribute}\attributeunsetvalue}% - {\setevalue{\??ls#1\s!attribute}{\ctxlua{scripts.define("\namedscriptparameter{#1}\c!method")}}}}% - {\getparameters[\??ls#1][\s!parent=#2]}% - \setvalue{#1}{\dosetscript{#1}}} - -\unexpanded\def\setupscript - {\dodoubleargument\dosetupscript} - -\def\dosetupscript[#1][#2]% - {\getparameters[\??ls#1][#2]} - -\def\dosetscript#1% - {\def\currentscript{#1}% - \edef\currentscriptattribute{\scriptparameter\s!attribute}% - \ifx\currentscriptattribute\empty - \let\currentscript\empty - \attribute\preprocattribute\attributeunsetvalue - \else - \attribute\preprocattribute\currentscriptattribute\relax % we can speed this up by storing the attribute in ??ls:a:#1 - \fi} +% \setscript[hangul] \hangul \startscript[hangul] -\def\setscript [#1]{\dosetscript{#1}} -\unexpanded\def\startscript[#1]{\begingroup\dosetscript{#1}} -\unexpanded\def\stopscript {\endgroup} +\definescript[hangul] [\c!method=hangul] +\definescript[hanzi] [\c!method=hanzi] -% \setscript[hangul] \hangul \startscript[hangul] +\definescript[ethiopic] [\c!method=ethiopic] -\definescript[latin] [\c!method=] % resets the attribute -\definescript[hangul][\c!method=hangul] -\definescript[hanzi] [\c!method=hanzi] +\definescript[latin] [\c!method=] % resets the attribute (also currentscript) \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/sort-ini.lua b/Master/texmf-dist/tex/context/base/sort-ini.lua index b745c9aa5db..7a91910ca7d 100644 --- a/Master/texmf-dist/tex/context/base/sort-ini.lua +++ b/Master/texmf-dist/tex/context/base/sort-ini.lua @@ -9,88 +9,444 @@ if not modules then modules = { } end modules ['sort-ini'] = { -- It took a while to get there, but with Fleetwood Mac's "Don't Stop" -- playing in the background we sort of got it done. --- todo: cleanup splits (in other modules) +--[[

The code here evolved from the rather old mkii approach. There +we concatinate the key and (raw) entry into a new string. Numbers and +special characters get some treatment so that they sort ok. In +addition some normalization (lowercasing, accent stripping) takes +place and again data is appended ror prepended. Eventually these +strings are sorted using a regular string sorter. The relative order +of character is dealt with by weighting them. It took a while to +figure this all out but eventually it worked ok for most languages, +given that the right datatables were provided.

+ +

Here we do follow a similar approach but this time we don't append +the manipulated keys and entries but create tables for each of them +with entries being tables themselves having different properties. In +these tables characters are represented by numbers and sorting takes +place using these numbers. Strings are simplified using lowercasing +as well as shape codes. Numbers are filtered and after getting an offset +they end up at the right end of the spectrum (more clever parser will +be added some day). There are definitely more solutions to the problem +and it is a nice puzzle to solve.

+ +

In the future more methods can be added, as there is practically no +limit to what goes into the tables. For that we will provide hooks.

+ +

Todo: decomposition with specific order of accents, this is +relatively easy to do.

+ +

Todo: investigate what standards and conventions there are and see +how they map onto this mechanism. I've learned that users can come up +with any demand so nothing here is frozen.

+ +

In the future index entries will become more clever, i.e. they will +have language etc properties that then can be used.

+]]-- + local utf = unicode.utf8 -local gsub, rep, sort, concat = string.gsub, string.rep, table.sort, table.concat +local gsub, rep, sub, sort, concat = string.gsub, string.rep, string.sub, table.sort, table.concat local utfbyte, utfchar = utf.byte, utf.char -local utfcharacters, utfvalues, strcharacters = string.utfcharacters, string.utfvalues, string.characters -local chardata = characters.data -local next, type, tonumber = next, type, tonumber - -local trace_tests = false trackers.register("sorters.tests", function(v) trace_tests = v end) - -sorters = { } -sorters.comparers = { } -sorters.splitters = { } -sorters.entries = { } -sorters.mappings = { } -sorters.replacements = { } - -sorters.ignored_offset = 0x10000 -sorters.replacement_offset = 0x10000 -sorters.digits_offset = 0x20000 -sorters.digits_maximum = 0xFFFFF - -local ignored_offset = sorters.ignored_offset -local digits_offset = sorters.digits_offset -local digits_maximum = sorters.digits_maximum - -local mappings = sorters.mappings -local entries = sorters.entries -local replacements = sorters.replacements - -local language, defaultlanguage, dummy = 'en', 'en', { } - -local currentreplacements, currentmappings, currententries - -function sorters.setlanguage(lang) - language = lang or language or defaultlanguage - currentreplacements = replacements[language] or replacements[defaultlanguage] or dummy - currentmappings = mappings [language] or mappings [defaultlanguage] or dummy - currententries = entries [language] or entries [defaultlanguage] or dummy - return currentreplacements, currentmappings, currententries -end +local utfcharacters, utfvalues = string.utfcharacters, string.utfvalues +local next, type, tonumber, rawget, rawset = next, type, tonumber, rawget, rawset -sorters.setlanguage() +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex --- maybe inline code if it's too slow +local trace_tests = false trackers.register("sorters.tests", function(v) trace_tests = v end) +local trace_methods = false trackers.register("sorters.methods", function(v) trace_methods = v end) -local function basicsort(sort_a,sort_b) - if not sort_a or not sort_b then - return 0 - elseif #sort_a > #sort_b then - if #sort_b == 0 then - return 1 - else - for i=1,#sort_b do - local ai, bi = sort_a[i], sort_b[i] - if ai > bi then - return 1 - elseif ai < bi then - return -1 +local report_sorters = logs.reporter("languages","sorters") + +local comparers = { } +local splitters = { } +local definitions = allocate() +local tracers = allocate() +local ignoredoffset = 0x10000 -- frozen +local replacementoffset = 0x10000 -- frozen +local digitsoffset = 0x20000 -- frozen +local digitsmaximum = 0xFFFFF -- frozen + +local lccodes = characters.lccodes +local lcchars = characters.lcchars +local shchars = characters.shchars +local fscodes = characters.fscodes +local fschars = characters.fschars + +local decomposed = characters.decomposed + +local variables = interfaces.variables + +local v_numbers = variables.numbers +local v_default = variables.default +local v_before = variables.before +local v_after = variables.after +local v_first = variables.first +local v_last = variables.last + +local validmethods = table.tohash { + -- "ch", -- raw character + "mm", -- minus mapping + "zm", -- zero mapping + "pm", -- plus mapping + "mc", -- lower case - 1 + "zc", -- lower case + "pc", -- lower case + 1 + "uc", -- unicode +} + +local predefinedmethods = { + [v_before] = "mm,mc,uc", + [v_after] = "pm,mc,uc", + [v_first] = "pc,mm,uc", + [v_last] = "mc,mm,uc", +} + +sorters = { + comparers = comparers, + splitters = splitters, + definitions = definitions, + tracers = tracers, + constants = { + ignoredoffset = ignoredoffset, + replacementoffset = replacementoffset, + digitsoffset = digitsoffset, + digitsmaximum = digitsmaximum, + defaultlanguage = v_default, + defaultmethod = v_before, + defaultdigits = v_numbers, + } +} + +local sorters = sorters +local constants = sorters.constants + +local data, language, method, digits +local replacements, m_mappings, z_mappings, p_mappings, entries, orders, lower, upper, method, sequence +local thefirstofsplit + +local mte = { + __index = function(t,k) + if k ~= "" and utfbyte(k) < digitsoffset then + local el + if k then + local l = lower[k] or lcchars[k] + el = rawget(t,l) + end + if not el then + local l = shchars[k] + if l and l ~= k then + if #l > 1 then + l = sub(l,1,1) -- todo + end + el = rawget(t,l) + if not el then + l = lower[k] or lcchars[l] + if l then + el = rawget(t,l) + end + end end + el = el or k end - return 1 + -- rawset(t,k,el) also make a copy? + return el end - elseif #sort_a < #sort_b then - if #sort_a == 0 then - return -1 - else - for i=1,#sort_a do - local ai, bi = sort_a[i], sort_b[i] - if ai > bi then - return 1 - elseif ai < bi then - return -1 + end +} + +local noorder = false + +local function preparetables(data) + local orders, lower, m_mappings, z_mappings, p_mappings = data.orders, data.lower, { }, { }, { } + for i=1,#orders do + local oi = orders[i] + local n = { 2 * i } + m_mappings[oi], z_mappings[oi], p_mappings[oi] = n, n, n + end + local mtm = { + __index = function(t,k) + local n, nn + if k then + if trace_tests then + report_sorters("simplifing character 0x%04X %s",utfbyte(k),k) + end + local l = lower[k] or lcchars[k] + if l then + if trace_tests then + report_sorters(" 1 lower: %s",l) + end + local ml = rawget(t,l) + if ml then + n = { } + nn = 0 + for i=1,#ml do + nn = nn + 1 + n[nn] = ml[i] + (t.__delta or 0) + end + if trace_tests then + report_sorters(" 2 order: %s",concat(n," ")) + end + end + end + if not n then + local s = shchars[k] -- maybe all components? + if s and s ~= k then + if trace_tests then + report_sorters(" 3 shape: %s",s) + end + n = { } + nn = 0 + for l in utfcharacters(s) do + local ml = rawget(t,l) + if ml then + if trace_tests then + report_sorters(" 4 keep: %s",l) + end + if ml then + for i=1,#ml do + nn = nn + 1 + n[nn] = ml[i] + end + end + else + l = lower[l] or lcchars[l] + if l then + if trace_tests then + report_sorters(" 5 lower: %s",l) + end + local ml = rawget(t,l) + if ml then + for i=1,#ml do + nn = nn + 1 + n[nn] = ml[i] + (t.__delta or 0) + end + end + end + end + end + else -- we probably never enter this branch + -- fschars returns a single char +--~ s = fschars[k] +--~ if s and s ~= k then +--~ if trace_tests then +--~ report_sorters(" 6 split: %s",s) +--~ end +--~ local ml = rawget(t,s) +--~ if ml then +--~ n = { } +--~ nn = 0 +--~ for i=1,#ml do +--~ nn = nn + 1 +--~ n[nn] = ml[i] +--~ end +--~ end +--~ end + local b = utfbyte(k) + n = decomposed[b] or { b } + if trace_tests then + report_sorters(" 6 split: %s",utf.string(b)) + end + end + if n then + if trace_tests then + report_sorters(" 7 order: %s",concat(n," ")) + end + else + n = noorder + if trace_tests then + report_sorters(" 8 order: 0") + end + end + end + else + n = noorder + if trace_tests then + report_sorters(" 9 order: 0") end end - return -1 + rawset(t,k,n) + return n end - elseif #sort_a == 0 then - return 0 - else - for i=1,#sort_a do + } + data.m_mappings = m_mappings + data.z_mappings = z_mappings + data.p_mappings = p_mappings + m_mappings.__delta = -1 + z_mappings.__delta = 0 + p_mappings.__delta = 1 + setmetatable(data.entries,mte) + setmetatable(data.m_mappings,mtm) + setmetatable(data.z_mappings,mtm) + setmetatable(data.p_mappings,mtm) + thefirstofsplit = data.firstofsplit +end + +local function update() -- prepare parent chains, needed when new languages are added + for language, data in next, definitions do + local parent = data.parent or "default" + if language ~= "default" then + setmetatableindex(data,definitions[parent] or definitions.default) + end + data.language = language + data.parent = parent + data.m_mappings = { } -- free temp data + data.z_mappings = { } -- free temp data + data.p_mappings = { } -- free temp data + end +end + +local function setlanguage(l,m,d,u) + language = (l ~= "" and l) or constants.defaultlanguage + data = definitions[language or constants.defaultlanguage] or definitions[constants.defaultlanguage] + method = (m ~= "" and m) or data.method or constants.defaultmethod + digits = (d ~= "" and d) or data.digits or constants.defaultdigits + if trace_tests then + report_sorters("setting language '%s', method '%s', digits '%s'",language,method,digits) + end + replacements = data.replacements + entries = data.entries + orders = data.orders + lower = data.lower + upper = data.upper + preparetables(data) + m_mappings = data.m_mappings + z_mappings = data.z_mappings + p_mappings = data.p_mappings + -- + method = predefinedmethods[variables[method]] or method + data.method = method + -- + data.digits = digite + -- + local seq = utilities.parsers.settings_to_array(method or "") -- check the list + sequence = { } + local nofsequence = 0 + for i=1,#seq do + local s = seq[i] + if validmethods[s] then + nofsequence = nofsequence + 1 + sequence[nofsequence] = s + else + report_sorters("invalid sorter method '%s' in '%s'",s,method) + end + end + data.sequence = sequence + if trace_tests then + report_sorters("using sort sequence: %s",concat(sequence," ")) + end + -- + return data +end + +function sorters.update() + update() + setlanguage(language,method,numberorder) -- resync current language and method +end + +function sorters.setlanguage(language,method,numberorder) + update() + setlanguage(language,method,numberorder) -- new language and method +end + +-- tricky: { 0, 0, 0 } vs { 0, 0, 0, 0 } => longer wins and mm, pm, zm can have them + +--~ local function basicsort(sort_a,sort_b) -- todo: local # +--~ if not sort_a or not sort_b then +--~ return 0 +--~ elseif #sort_a > #sort_b then +--~ if #sort_b == 0 then +--~ return 1 +--~ else +--~ for i=1,#sort_b do +--~ local ai, bi = sort_a[i], sort_b[i] +--~ if ai > bi then +--~ return 1 +--~ elseif ai < bi then +--~ return -1 +--~ end +--~ end +--~ return 1 +--~ end +--~ elseif #sort_a < #sort_b then +--~ if #sort_a == 0 then +--~ return -1 +--~ else +--~ for i=1,#sort_a do +--~ local ai, bi = sort_a[i], sort_b[i] +--~ if ai > bi then +--~ return 1 +--~ elseif ai < bi then +--~ return -1 +--~ end +--~ end +--~ return -1 +--~ end +--~ elseif #sort_a == 0 then +--~ return 0 +--~ else +--~ for i=1,#sort_a do +--~ local ai, bi = sort_a[i], sort_b[i] +--~ if ai > bi then +--~ return 1 +--~ elseif ai < bi then +--~ return -1 +--~ end +--~ end +--~ return 0 +--~ end +--~ end + +--~ function comparers.basic(a,b) -- trace ea and eb +--~ local ea, eb = a.split, b.split +--~ local na, nb = #ea, #eb +--~ if na == 0 and nb == 0 then +--~ -- simple variant (single word) +--~ local result = 0 +--~ for j=1,#sequence do +--~ local m = sequence[j] +--~ result = basicsort(ea[m],eb[m]) +--~ if result ~= 0 then +--~ return result +--~ end +--~ end +--~ return result +--~ else +--~ -- complex variant, used in register (multiple words) +--~ local result = 0 +--~ for i=1,nb < na and nb or na do +--~ local eai, ebi = ea[i], eb[i] +--~ for j=1,#sequence do +--~ local m = sequence[j] +--~ result = basicsort(eai[m],ebi[m]) +--~ if result ~= 0 then +--~ return result +--~ end +--~ end +--~ if result ~= 0 then +--~ return result +--~ end +--~ end +--~ if result ~= 0 then +--~ return result +--~ elseif na > nb then +--~ return 1 +--~ elseif nb > na then +--~ return -1 +--~ else +--~ return 0 +--~ end +--~ end +--~ end + +local function basicsort(sort_a,sort_b) + if sort_a and sort_b then + local na = #sort_a + local nb = #sort_b + if na > nb then + na = nb + end + for i=1,na do local ai, bi = sort_a[i], sort_b[i] if ai > bi then return 1 @@ -98,28 +454,56 @@ local function basicsort(sort_a,sort_b) return -1 end end - return 0 end + return 0 end -function sorters.comparers.basic(a,b) +function comparers.basic(a,b) -- trace ea and eb local ea, eb = a.split, b.split local na, nb = #ea, #eb if na == 0 and nb == 0 then -- simple variant (single word) - local result = basicsort(ea.e,eb.e) - return result == 0 and result or basicsort(ea.m,eb.m) + local result = 0 + for j=1,#sequence do + local m = sequence[j] + result = basicsort(ea[m],eb[m]) + if result ~= 0 then + return result + end + end + if result == 0 then + local la, lb = #ea.uc, #eb.uc + if la > lb then + return 1 + elseif lb > la then + return -1 + else + return 0 + end + else + return result + end else -- complex variant, used in register (multiple words) local result = 0 for i=1,nb < na and nb or na do local eai, ebi = ea[i], eb[i] - result = basicsort(eai.e,ebi.e) - if result == 0 then - result = basicsort(eai.m,ebi.m) -- only needed it there are m's + for j=1,#sequence do + local m = sequence[j] + result = basicsort(eai[m],ebi[m]) + if result ~= 0 then + return result + end end - if result ~= 0 then - break + if result == 0 then + local la, lb = #eai.uc, #ebi.uc + if la > lb then + return 1 + elseif lb > la then + return -1 + end + else + return result end end if result ~= 0 then @@ -135,22 +519,22 @@ function sorters.comparers.basic(a,b) end local function numify(s) - return rep(" ",10-#s) .. s -- or format with padd -end - -local function numify(s) - s = digits_offset + tonumber(s) - if s > digits_maximum then - s = digits_maximum + s = digitsoffset + tonumber(s) -- alternatively we can create range + if s > digitsmaximum then + s = digitsmaximum end return utfchar(s) end function sorters.strip(str) -- todo: only letters and such utf.gsub("([^%w%d])","") if str then - str = gsub(str,"\\%S*","") + str = gsub(str,"\\[\"\'~^`]*","") -- \"e + str = gsub(str,"\\%S*","") -- the rest + str = gsub(str,"%s","\001") -- can be option str = gsub(str,"[%s%[%](){}%$\"\']*","") - str = gsub(str,"(%d+)",numify) -- sort numbers properly + if digits == v_numbers then + str = gsub(str,"(%d+)",numify) -- sort numbers properly + end return str else return "" @@ -161,98 +545,191 @@ local function firstofsplit(entry) -- numbers are left padded by spaces local split = entry.split if #split > 0 then - split = split[1].s + split = split[1].ch + else + split = split.ch + end + local first = split and split[1] or "" + if thefirstofsplit then + return thefirstofsplit(first,data,entry) -- normally the first one is needed else - split = split.s + return first, entries[first] or "\000" -- tag end - local entry = split and split[1] or "" - return entry, currententries[entry] or "\000" end sorters.firstofsplit = firstofsplit --- beware, numbers get spaces in front +-- for the moment we use an inefficient bunch of tables but once +-- we know what combinations make sense we can optimize this -function sorters.splitters.utf(str) - if #currentreplacements > 0 then - for k=1,#currentreplacements do - local v = currentreplacements[k] +function splitters.utf(str) -- we could append m and u but this is cleaner, s is for tracing + if #replacements > 0 then + -- todo make an lpeg for this + for k=1,#replacements do + local v = replacements[k] str = gsub(str,v[1],v[2]) end end - local s, e, m, n = { }, { }, { }, 0 - for sc in utfcharacters(str) do -- maybe an lpeg - local ec, mc = currententries[sc], currentmappings[sc] or utfbyte(sc) - n = n + 1 - s[n] = sc - e[n] = currentmappings[ec] or mc - m[n] = mc - end - return { s = s, e = e, m = m } + local m_case, z_case, p_case, m_mapping, z_mapping, p_mapping, char, byte, n = { }, { }, { }, { }, { }, { }, { }, { }, 0 + local nm, nz, np = 0, 0, 0 + for sc in utfcharacters(str) do + local b = utfbyte(sc) + if b >= digitsoffset then + if n == 0 then + -- we need to force number to the top + z_case[1] = 0 + m_case[1] = 0 + p_case[1] = 0 + char[1] = sc + byte[1] = 0 + m_mapping[1] = 0 + z_mapping[1] = 0 + p_mapping[1] = 0 + n = 2 + else + n = n + 1 + end + z_case[n] = b + m_case[n] = b + p_case[n] = b + char[n] = sc + byte[n] = b + nm = nm + 1 + nz = nz + 1 + np = np + 1 + m_mapping[nm] = b + z_mapping[nz] = b + p_mapping[np] = b + else + n = n + 1 + local l = lower[sc] + l = l and utfbyte(l) or lccodes[b] + if type(l) == "table" then + l = l[1] -- there are currently no tables in lccodes but it can be some, day + end + z_case[n] = l + if l ~= b then + m_case[n] = l - 1 + p_case[n] = l + 1 + else + m_case[n] = l + p_case[n] = l + end + char[n], byte[n] = sc, b +local fs = fscodes[b] or b + local msc = m_mappings[sc] + if msc ~= noorder then +if not msc then + msc = m_mappings[fs] end - --- we can use one array instead (sort of like in mkii) --- but for the moment we do it this way as it is more --- handy for tracing - --- function sorters.splitters.utf(str) --- if #currentreplacements > 0 then --- for k=1,#currentreplacements do --- local v = currentreplacements[k] --- str = gsub(str,v[1],v[2]) --- end --- end --- local s, e, m, n = { }, { }, { }, 0 --- for sc in utfcharacters(str) do -- maybe an lpeg --- local ec, mc = currententries[sc], currentmappings[sc] or utfbyte(sc) --- n = n + 1 --- ec = currentmappings[ec] or mc --- s[n] = sc --- e[n] = ec --- if ec ~= mc then --- n = n + 1 --- e[n] = mc --- end --- end --- return { s = s, e = e } --- end - -function table.remap(t) - local tt = { } - for k,v in next, t do - tt[v] = k + for i=1,#msc do + nm = nm + 1 + m_mapping[nm] = msc[i] + end + end + local zsc = z_mappings[sc] + if zsc ~= noorder then +if not zsc then + zsc = z_mappings[fs] +end + for i=1,#zsc do + nz = nz + 1 + z_mapping[nz] = zsc[i] + end + end + local psc = p_mappings[sc] + if psc ~= noorder then +if not psc then + psc = p_mappings[fs] +end + for i=1,#psc do + np = np + 1 + p_mapping[np] = psc[i] + end + end + end end - return tt + + -- only those needed that are part of a sequence + +--~ local b = byte[1] +--~ if b then +--~ -- we set them to the first split code (korean) +--~ local fs = fscodes[b] or b +--~ if #m_mapping == 0 then +--~ m_mapping = { m_mappings[fs][1] } +--~ end +--~ if #z_mapping == 0 then +--~ z_mapping = { z_mappings[fs][1] } +--~ end +--~ if #p_mapping == 0 then +--~ p_mapping = { p_mappings[fs][1] } +--~ end +--~ end + + local t = { + ch = char, + uc = byte, + mc = m_case, + zc = z_case, + pc = p_case, + mm = m_mapping, + zm = z_mapping, + pm = p_mapping, + } + + return t end -local function pack(entry) - local t = { } +local function packch(entry) local split = entry.split - if #split > 0 then + if #split > 0 then -- useless test + local t = { } for i=1,#split do - local tt, li = { }, split[i].s + local tt, li = { }, split[i].ch for j=1,#li do local lij = li[j] - tt[j] = utfbyte(lij) > ignored_offset and "[]" or lij + tt[j] = utfbyte(lij) > ignoredoffset and "[]" or lij end t[i] = concat(tt) end return concat(t," + ") else - local t, li = { }, split.s + local t, li = { }, split.ch for j=1,#li do local lij = li[j] - t[j] = utfbyte(lij) > ignored_offset and "[]" or lij + t[j] = utfbyte(lij) > ignoredoffset and "[]" or lij end return concat(t) end end +local function packuc(entry) + local split = entry.split + if #split > 0 then -- useless test + local t = { } + for i=1,#split do + t[i] = concat(split[i].uc, " ") + end + return concat(t," + ") + else + return concat(split.uc," ") + end +end + function sorters.sort(entries,cmp) + if trace_tests or trace_methods then + local nofentries = #entries + report_sorters("entries: %s, language: %s, method: %s, digits: %s",nofentries,language,method,tostring(digits)) + for i=1,nofentries do + report_sorters("entry %s",table.serialize(entries[i].split,i,true,true,true)) + end + end if trace_tests then sort(entries,function(a,b) local r = cmp(a,b) - logs.report("sorter","%s %s %s",pack(a),(not r and "?") or (r<0 and "<") or (r>0 and ">") or "=",pack(b)) + local e = (not r and "?") or (r<0 and "<") or (r>0 and ">") or "=" + report_sorters("%s %s %s | %s %s %s",packch(a),e,packch(b),packuc(a),e,packuc(b)) return r == -1 end) local s @@ -263,9 +740,9 @@ function sorters.sort(entries,cmp) first = " " else s = first - logs.report("sorter",">> %s 0x%05X (%s 0x%05X)",first,utfbyte(first),letter,utfbyte(letter)) + report_sorters(">> %s 0x%05X (%s 0x%05X)",first,utfbyte(first),letter,utfbyte(letter)) end - logs.report("sorter"," %s",pack(entry)) + report_sorters(" %s | %s",packch(entry),packuc(entry)) end else sort(entries,function(a,b) @@ -273,45 +750,3 @@ function sorters.sort(entries,cmp) end) end end - --- some day we can have a characters.upper and characters.lower - -function sorters.add_uppercase_replacements(what) - local rep, new = replacements[what], { } - for i=1,#rep do - local r = rep[i] - local u = chardata[utfbyte(r[1])].uccode - if u then - new[utfchar(u)] = r[2] - end - end - for k, v in next, new do - rep[k] = v - end -end - -function sorters.add_uppercase_entries(what) - local ent, new = entries[what], { } - for k, v in next, ent do - local u = chardata[utfbyte(k)].uccode - if u then - new[utfchar(u)] = v - end - end - for k, v in next, new do - ent[k] = v - end -end - -function sorters.add_uppercase_mappings(what,offset) - local map, new, offset = mappings[what], { }, offset or 0 - for k, v in next, map do - local u = chardata[utfbyte(k)].uccode - if u then - new[utfchar(u)] = v + offset - end - end - for k, v in next, new do - map[k] = v - end -end diff --git a/Master/texmf-dist/tex/context/base/sort-lan.lua b/Master/texmf-dist/tex/context/base/sort-lan.lua index ed7e8ba3550..e7556c1de7b 100644 --- a/Master/texmf-dist/tex/context/base/sort-lan.lua +++ b/Master/texmf-dist/tex/context/base/sort-lan.lua @@ -6,314 +6,873 @@ if not modules then modules = { } end modules ['sort-lan'] = { license = "see context related readme files" } --- this is a rather preliminary and incomplete file --- maybe we should load this kind of stuff runtime - --- replacements are indexed as they need to be applied in sequence - -local utf = unicode.utf8 -local uc = utf.char -local ub = utf.byte - -local mappings = sorters.mappings -local entries = sorters.entries -local replacements = sorters.replacements - -local add_uppercase_replacements = sorters.add_uppercase_replacements -local add_uppercase_entries = sorters.add_uppercase_entries -local add_uppercase_mappings = sorters.add_uppercase_mappings +-- Many vectors were supplied by Wolfgang Schuster and Philipp +-- Gesang. However this is a quite adapted and reformatted variant +-- so it needs some checking. + +local utfchar, utfbyte = utf.char, utf.byte +local sorters = sorters +local definitions = sorters.definitions +local replacementoffset = sorters.constants.replacementoffset +local variables = interfaces.variables + +definitions["default"] = { + method = variables.before, + replacements = { + -- no replacements + }, + entries = { + ["a"] = "a", ["b"] = "b", ["c"] = "c", ["d"] = "d", ["e"] = "e", + ["f"] = "f", ["g"] = "g", ["h"] = "h", ["i"] = "i", ["j"] = "j", + ["k"] = "k", ["l"] = "l", ["m"] = "m", ["n"] = "n", ["o"] = "o", + ["p"] = "p", ["q"] = "q", ["r"] = "r", ["s"] = "s", ["t"] = "t", + ["u"] = "u", ["v"] = "v", ["w"] = "w", ["x"] = "x", ["y"] = "y", + ["z"] = "z", + }, + orders = { + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", + "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", + "u", "v", "w", "x", "y", "z", + }, + lower = { + -- no replacements + }, + upper = { + -- no replacements + } +} -local replacement_offset = sorters.replacement_offset +sorters.setlanguage("default") -- english -entries['en'] = { - ["a"] = "a", ["b"] = "b", ["c"] = "c", ["d"] = "d", ["e"] = "e", - ["f"] = "f", ["g"] = "g", ["h"] = "h", ["i"] = "i", ["j"] = "j", - ["k"] = "k", ["l"] = "l", ["m"] = "m", ["n"] = "n", ["o"] = "o", - ["p"] = "p", ["q"] = "q", ["r"] = "r", ["s"] = "s", ["t"] = "t", - ["u"] = "u", ["v"] = "v", ["w"] = "w", ["x"] = "x", ["y"] = "y", - ["z"] = "z", - ["A"] = "a", ["B"] = "b", ["C"] = "c", ["D"] = "d", ["E"] = "e", - ["F"] = "f", ["G"] = "g", ["H"] = "h", ["I"] = "i", ["J"] = "j", - ["K"] = "k", ["L"] = "l", ["M"] = "m", ["N"] = "n", ["O"] = "o", - ["P"] = "p", ["Q"] = "q", ["R"] = "r", ["S"] = "s", ["T"] = "t", - ["U"] = "u", ["V"] = "v", ["W"] = "w", ["X"] = "x", ["Y"] = "y", - ["Z"] = "z", -} - -mappings['en'] = { - ["a"] = 1, ["b"] = 3, ["c"] = 5, ["d"] = 7, ["e"] = 9, - ["f"] = 11, ["g"] = 13, ["h"] = 15, ["i"] = 17, ["j"] = 19, - ["k"] = 21, ["l"] = 23, ["m"] = 25, ["n"] = 27, ["o"] = 29, - ["p"] = 31, ["q"] = 33, ["r"] = 35, ["s"] = 37, ["t"] = 39, - ["u"] = 41, ["v"] = 43, ["w"] = 45, ["x"] = 47, ["y"] = 49, - ["z"] = 51, - ["A"] = 1, ["B"] = 3, ["C"] = 5, ["D"] = 7, ["E"] = 9, - ["F"] = 11, ["G"] = 13, ["H"] = 15, ["I"] = 17, ["J"] = 19, - ["K"] = 21, ["L"] = 23, ["M"] = 25, ["N"] = 27, ["O"] = 29, - ["P"] = 31, ["Q"] = 33, ["R"] = 35, ["S"] = 37, ["T"] = 39, - ["U"] = 41, ["V"] = 43, ["W"] = 45, ["X"] = 47, ["Y"] = 49, - ["Z"] = 51, - -- - -- uppercase after lowercase - -- - -- ["A"] = 2, ["B"] = 4, ["C"] = 6, ["D"] = 8, ["E"] = 10, - -- ["F"] = 12, ["G"] = 14, ["H"] = 16, ["I"] = 18, ["J"] = 20, - -- ["K"] = 22, ["L"] = 24, ["M"] = 26, ["N"] = 28, ["O"] = 30, - -- ["P"] = 32, ["Q"] = 34, ["R"] = 36, ["S"] = 38, ["T"] = 40, - -- ["U"] = 42, ["V"] = 44, ["W"] = 46, ["X"] = 48, ["Y"] = 50, - -- ["Z"] = 52, -} +definitions["en"] = { parent = "default" } -- dutch -replacements['nl'] = { { "ij", 'y' }, { "IJ", 'Y' } } -entries ['nl'] = entries ['en'] -mappings ['nl'] = mappings['en'] - --- czech - -local cz_ch = uc(replacement_offset + 1) -local cz_CH = uc(replacement_offset + 2) - -replacements['cz'] = { - [1] = { "ch", cz_ch } -} - -entries['cz'] = { - ['a'] = "a", -- a - [uc(0x00E1)] = "a", -- aacute - ['b'] = "b", -- b - ['c'] = "c", -- c - [uc(0x010D)] = uc(0x010D), -- ccaron - ['d'] = "d", -- d - [uc(0x010F)] = "d", -- dcaron - ['e'] = "e", -- e - [uc(0x00E9)] = "e", -- eacute - [uc(0x011B)] = "e", -- ecaron - ['f'] = "f", -- f - ['g'] = "g", -- g - ['h'] = "h", -- h - [cz_ch] = "ch", -- ch - ['i'] = "i", -- i - [uc(0x00ED)] = "i", -- iacute - ['j'] = "j", -- j - ['k'] = "k", -- k - ['l'] = "l", -- l - ['m'] = "m", -- m - ['n'] = "n", -- n - ['ň'] = "n", -- ncaron - ['o'] = "o", -- o - ['p'] = "p", -- p - ['q'] = "q", -- q - ['r'] = "r", -- r - ['ř'] = "ř", -- rcaron - ['s'] = "s", -- s - [uc(0x0161)] = uc(0x0161), -- scaron - ['t'] = "t", -- t - [uc(0x0165)] = "t", -- tcaron - ['u'] = "u", -- u - [uc(0x00FA)] = "u", -- uacute - [uc(0x016F)] = "u", -- uring - ['v'] = "v", -- v - ['w'] = "w", -- w - ['x'] = "x", -- x - ['y'] = "y", -- y - [uc(0x00FD)] = "y", -- yacute - ['z'] = "z", -- z - [uc(0x017E)] = uc(0x017E), -- zcaron -} - -mappings['cz'] = { - ['a'] = 1, -- a - [uc(0x00E1)] = 3, -- aacute - ['b'] = 5, -- b - ['c'] = 7, -- c - [uc(0x010D)] = 9, -- ccaron - ['d'] = 11, -- d - [uc(0x010F)] = 13, -- dcaron - ['e'] = 15, -- e - [uc(0x00E9)] = 17, -- eacute - [uc(0x011B)] = 19, -- ecaron - ['f'] = 21, -- f - ['g'] = 23, -- g - ['h'] = 25, -- h - [cz_ch] = 27, -- ch - ['i'] = 29, -- i - [uc(0x00ED)] = 31, -- iacute - ['j'] = 33, -- j - ['k'] = 35, -- k - ['l'] = 37, -- l - ['m'] = 39, -- m - ['n'] = 41, -- n - ['ň'] = 43, -- ncaron - ['o'] = 45, -- o - ['p'] = 47, -- p - ['q'] = 49, -- q - ['r'] = 51, -- r - ['ř'] = 53, -- rcaron - ['s'] = 55, -- s - [uc(0x0161)] = 57, -- scaron - ['t'] = 59, -- t - [uc(0x0165)] = 61, -- tcaron - ['u'] = 63, -- u - [uc(0x00FA)] = 65, -- uacute - [uc(0x016F)] = 67, -- uring - ['v'] = 69, -- v - ['w'] = 71, -- w - ['x'] = 73, -- x - ['y'] = 75, -- y - [uc(0x00FD)] = 77, -- yacute - ['z'] = 79, -- z - [uc(0x017E)] = 81, -- zcaron -} - -add_uppercase_entries ("cz") -add_uppercase_mappings("cz") -- 1 can be option (but then we need a runtime variant) - -entries ['cz'][cz_CH] = entries ['cz'][cz_ch] -mappings['cz'][cz_CH] = mappings['cz'][cz_ch] - -replacements['cs'] = replacements['cz'] -entries ['cs'] = entries ['cz'] -mappings ['cs'] = mappings ['cz'] - ---~ print(table.serialize(mappings.cs)) +definitions['nl'] = { + parent = 'default', + replacements = { + { "ij", 'y' }, { "IJ", 'Y' }, + }, +} -- French -entries ['fr'] = entries ['en'] -mappings['fr'] = mappings['en'] +definitions['fr'] = { parent = 'default' } -- German (by Wolfgang Schuster) -- DIN 5007-1 -entries ['DIN 5007-1'] = entries ['en'] -mappings ['DIN 5007-1'] = mappings['en'] +definitions['DIN 5007-1'] = { parent = 'default' } -- DIN 5007-2 -replacements['DIN 5007-2'] = { -- todo: add_uppercase_replacements - { "ä", 'ae' }, - { "ö", 'oe' }, - { "ü", 'ue' }, - { "Ä", 'Ae' }, - { "Ö", 'Oe' }, - { "Ü", 'Ue' }, +definitions['DIN 5007-2'] = { + parent = 'default', + replacements = { + { "ä", 'ae' }, { "Ä", 'Ae' }, + { "ö", 'oe' }, { "Ö", 'Oe' }, + { "ü", 'ue' }, { "Ü", 'Ue' }, + }, } ---~ add_uppercase_replacements('DIN 5007-2') +-- Duden + +definitions['Duden'] = { + parent = 'default', + replacements = { { "ß", 's' } }, +} -entries ['DIN 5007-2'] = entries ['en'] -mappings ['DIN 5007-2'] = mappings['en'] +definitions['de'] = { parent = 'default' } -- new german +definitions['deo'] = { parent = 'de' } -- old german +definitions['de-DE'] = { parent = 'de' } -- german - Germany +definitions['de-CH'] = { parent = 'de' } -- german - Swiss --- Duden +-- german - Austria + +definitions['de-AT'] = { + entries = { + ["a"] = "a", ["ä"] = "ä", ["b"] = "b", ["c"] = "c", ["d"] = "d", + ["e"] = "e", ["f"] = "f", ["g"] = "g", ["h"] = "h", ["i"] = "i", + ["j"] = "j", ["k"] = "k", ["l"] = "l", ["m"] = "m", ["n"] = "n", + ["o"] = "o", ["ö"] = "ö", ["p"] = "p", ["q"] = "q", ["r"] = "r", + ["s"] = "s", ["t"] = "t", ["u"] = "u", ["ü"] = "ü", ["v"] = "v", + ["w"] = "w", ["x"] = "x", ["y"] = "y", ["z"] = "z", + }, + orders = { + "a", "ä", "b", "c", "d", "e", "f", "g", "h", "i", + "j", "k", "l", "m", "n", "o", "ö", "p", "q", "r", + "s", "t", "u", "ü", "v", "w", "x", "y", "z", + }, +} -replacements['Duden'] = { { "ß", 's' } } -entries ['Duden'] = entries ['en'] -mappings ['Duden'] = mappings['en'] +-- finish (by Wolfgang Schuster) --- new german +definitions['fi'] = { + entries = { + ["a"] = "a", ["b"] = "b", ["c"] = "c", ["d"] = "d", ["e"] = "e", + ["f"] = "f", ["g"] = "g", ["h"] = "h", ["i"] = "i", ["j"] = "j", + ["k"] = "k", ["l"] = "l", ["m"] = "m", ["n"] = "n", ["o"] = "o", + ["p"] = "p", ["q"] = "q", ["r"] = "r", ["s"] = "s", ["t"] = "t", + ["u"] = "u", ["v"] = "v", ["w"] = "w", ["x"] = "x", ["y"] = "y", + ["z"] = "z", ["å"] = "å", ["ä"] = "ä", ["ö"] = "ö", + }, + orders = { + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", + "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", + "u", "v", "w", "x", "y", "z", "å", "ä", "ö", + } +} -entries ['de'] = entries ['en'] -mappings ['de'] = mappings['en'] +-- slovenian by MM: this will change since we need to add accented vowels + +definitions['sl'] = { + entries = { + ["a"] = "a", ["b"] = "b", ["c"] = "c", ["č"] = "č", ["ć"] = "ć", ["d"] = "d", + ["đ"] = "đ", ["e"] = "e", ["f"] = "f", ["g"] = "g", ["h"] = "h", ["i"] = "i", + ["j"] = "j", ["k"] = "k", ["l"] = "l", ["m"] = "m", ["n"] = "n", ["o"] = "o", + ["p"] = "p", ["q"] = "q", ["r"] = "r", ["s"] = "s", ["š"] = "š", ["t"] = "t", + ["u"] = "u", ["v"] = "v", ["w"] = "w", ["x"] = "x", ["y"] = "y", ["z"] = "z", + ["ž"] = "ž", + }, + orders = { + "a", "b", "c", "č", "ć", "d", "đ", "e", "f", "g", "h", "i", + "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "š", "t", + "u", "v", "w", "x", "y", "z", "ž", + } +} --- old german +-- The following data was provided by Philipp Gesang. + +definitions["ru"] = { + entries = { + ["а"] = "а", ["б"] = "б", ["в"] = "в", ["г"] = "г", ["д"] = "д", + ["е"] = "е", ["ё"] = "е", ["ж"] = "ж", ["з"] = "з", ["и"] = "и", + ["і"] = "и", ["й"] = "й", ["к"] = "к", ["л"] = "л", ["м"] = "м", + ["н"] = "н", ["о"] = "о", ["п"] = "п", ["р"] = "р", ["с"] = "с", + ["т"] = "т", ["у"] = "у", ["ф"] = "ф", ["х"] = "х", ["ц"] = "ц", + ["ч"] = "ч", ["ш"] = "ш", ["щ"] = "щ", ["ъ"] = "ъ", ["ы"] = "ы", + ["ь"] = "ь", ["ѣ"] = "ѣ", ["э"] = "э", ["ю"] = "ю", ["я"] = "я", + ["ѳ"] = "ѳ", ["ѵ"] = "ѵ", + }, + orders = { + "а", "б", "в", "г", "д", "е", "ё", "ж", "з", "и", + "і", "й", "к", "л", "м", "н", "о", "п", "р", "с", + "т", "у", "ф", "х", "ц", "ч", "ш", "щ", "ъ", "ы", + "ь", "ѣ", "э", "ю", "я", "ѳ", "ѵ", + } +} -entries ['deo'] = entries ['de'] -mappings ['deo'] = mappings['de'] +--- Basic Ukrainian + +definitions["uk"] = { + entries = { + ["а"] = "а", ["б"] = "б", ["в"] = "в", ["г"] = "г", ["ґ"] = "ґ", + ["д"] = "д", ["е"] = "е", ["є"] = "є", ["ж"] = "ж", ["з"] = "з", + ["и"] = "и", ["і"] = "і", ["ї"] = "ї", ["й"] = "й", ["к"] = "к", + ["л"] = "л", ["м"] = "м", ["н"] = "н", ["о"] = "о", ["п"] = "п", + ["р"] = "р", ["с"] = "с", ["т"] = "т", ["у"] = "у", ["ф"] = "ф", + ["х"] = "х", ["ц"] = "ц", ["ч"] = "ч", ["ш"] = "ш", ["щ"] = "щ", + ["ь"] = "ь", ["ю"] = "ю", ["я"] = "я", + }, + orders = { + "а", "б", "в", "г", "ґ", "д", "е", "є", "ж", "з", "и", "і", + "ї", "й", "к", "л", "м", "н", "о", "п", "р", "с", "т", "у", + "ф", "х", "ц", "ч", "ш", "щ", "ь", "ю", "я", + } +} --- german - Germany +--- Belarusian + +definitions["be"] = { + entries = { + ["а"] = "а", ["б"] = "б", ["в"] = "в", ["г"] = "г", ["д"] = "д", + ["е"] = "е", ["ё"] = "е", ["ж"] = "ж", ["з"] = "з", ["і"] = "і", + ["й"] = "й", ["к"] = "к", ["л"] = "л", ["м"] = "м", ["н"] = "н", + ["о"] = "о", ["п"] = "п", ["р"] = "р", ["с"] = "с", ["т"] = "т", + ["у"] = "у", ["ў"] = "ў", ["ф"] = "ф", ["х"] = "х", ["ц"] = "ц", + ["ч"] = "ч", ["ш"] = "ш", ["ы"] = "ы", ["ь"] = "ь", ["э"] = "э", + ["ю"] = "ю", ["я"] = "я", + }, + orders = { + "а", "б", "в", "г", "д", "е", "ё", "ж", "з", "і", + "й", "к", "л", "м", "н", "о", "п", "р", "с", "т", + "у", "ў", "ф", "х", "ц", "ч", "ш", "ы", "ь", "э", + "ю", "я", + } +} -entries ['de-DE'] = entries ['de'] -mappings ['de-DE'] = mappings['de'] +--- Bulgarian + +definitions["bg"] = { + entries = { + ["а"] = "а", ["б"] = "б", ["в"] = "в", ["г"] = "г", ["д"] = "д", + ["е"] = "е", ["ж"] = "ж", ["з"] = "з", ["и"] = "и", ["й"] = "й", + ["к"] = "к", ["a"] = "a", ["л"] = "л", ["a"] = "a", ["м"] = "м", + ["н"] = "н", ["о"] = "о", ["п"] = "п", ["р"] = "р", ["с"] = "с", + ["т"] = "т", ["у"] = "у", ["ф"] = "ф", ["х"] = "х", ["ц"] = "ц", + ["ч"] = "ч", ["ш"] = "ш", ["щ"] = "щ", ["ъ"] = "ъ", ["ь"] = "ь", + ["ю"] = "ю", ["я"] = "я", + }, + orders = { + "а", "б", "в", "г", "д", "е", "ж", "з","и", "й", + "к", "a", "л", "a", "м", "н", "о", "п", "р", "с", + "т", "у", "ф", "х", "ц", "ч", "ш", "щ", "ъ", "ь", + "ю", "я", + } +} --- german - Swiss +--- Old Church Slavonic + +-- The language symbol “cu” is taken from the Wikipedia subdomain +-- cu.wikipedia.org. + +local uk, UK = utfchar(replacementoffset + 1), utfchar(replacementoffset + 11) + +definitions["cu"] = { + replacements = { + { "оу", uk }, { "ОУ", UK }, + }, + entries = { + ["а"] = "а", ["б"] = "б", ["в"] = "в", ["г"] = "г", ["д"] = "д", + ["є"] = "є", ["ж"] = "ж", ["ѕ"] = "ѕ", ["ꙃ"] = "ѕ", ["з"] = "з", + ["ꙁ"] = "з", ["и"] = "и", ["і"] = "и", ["ї"] = "и", ["ћ"] = "ћ", + ["к"] = "к", ["л"] = "л", ["м"] = "м", ["н"] = "н", ["о"] = "о", + ["п"] = "п", ["р"] = "р", ["с"] = "с", ["т"] = "т", ["у"] = "у", + ["ѹ"] = "у", ["ꙋ"] = "у", [uk] = "у", ["ф"] = "ф", ["х"] = "х", + ["ѡ"] = "ѡ", ["ѿ"] = "ѡ", ["ѽ"] = "ѡ", ["ꙍ"] = "ѡ", ["ц"] = "ц", + ["ч"] = "ч", ["ш"] = "ш", ["щ"] = "щ", ["ъ"] = "ъ", ["ы"] = "ы", + ["ꙑ"] = "ы", ["ь"] = "ь", ["ѣ"] = "ѣ", ["ю"] = "ю", ["ꙗ"] = "ꙗ", + ["ѥ"] = "ѥ", ["ѧ"] = "ѧ", ["ѩ"] = "ѩ", ["ѫ"] = "ѫ", ["ѭ"] = "ѭ", + ["ѯ"] = "ѯ", ["ѱ"] = "ѱ", ["ѳ"] = "ѳ", ["ѵ"] = "ѵ", ["ѷ"] = "ѵ", + }, + orders = { + "а", "б", "в", "г", "д", "є", "ж", "ѕ", "ꙃ", "з", -- Dzělo, U+0292, alternative: dz U+01f3 + "ꙁ", "и", "і", "ї", "ћ", "к", "л", "м", "н", "о", -- Zemlja + "п", "р", "с", "т", "у", "ѹ", "ꙋ", uk, "ф", "х", -- U+0478 uk, horizontal ligature, U+0479 uk, vertical ligature + "ѡ", "ѿ", "ѽ", "ꙍ", "ц", "ч", "ш", "щ", "ъ", "ы", -- "ō", U+047f \, U+047d > Omega variants, U+064D / + "ꙑ", "ь", "ѣ", "ю", "ꙗ", "ѥ", "ѧ", "ѩ", "ѫ", "ѭ", -- Old jery (U+a651) as used e.g. by the OCS Wikipedia. IOTIFIED A + "ѯ", "ѱ", "ѳ", "ѵ", "ѷ", + }, + upper = { + uk = UK, + }, + lower = { + UK = uk, + } +} -entries ['de-CH'] = entries ['de'] -mappings ['de-CH'] = mappings['de'] +--- Polish (including the letters q, v, x) Cf. ftp://ftp.gust.org.pl/pub/GUST/bulletin/03/02-bl.pdf. + +definitions["pl"] = { + entries = { + ["a"] = "a", ["ą"] = "ą", ["b"] = "b", ["c"] = "c", ["ć"] = "ć", + ["d"] = "d", ["e"] = "e", ["ę"] = "ę", ["f"] = "f", ["g"] = "g", + ["h"] = "h", ["i"] = "i", ["j"] = "j", ["k"] = "k", ["l"] = "l", + ["ł"] = "ł", ["m"] = "m", ["n"] = "n", ["ń"] = "ń", ["o"] = "o", + ["ó"] = "ó", ["p"] = "p", ["q"] = "q", ["r"] = "r", ["s"] = "s", + ["ś"] = "ś", ["t"] = "t", ["u"] = "u", ["v"] = "v", ["w"] = "w", + ["x"] = "x", ["y"] = "y", ["z"] = "z", ["ź"] = "ź", ["ż"] = "ż", + }, + orders = { + "a", "ą", "b", "c", "ć", "d", "e", "ę", "f", "g", + "h", "i", "j", "k", "l", "ł", "m", "n", "ń", "o", + "ó", "p", "q", "r", "s", "ś", "t", "u", "v", "w", + "x", "y", "z", "ź", "ż", + }, +} --- german - Austria +-- Czech, modified to treat quantities and other secondary characteristics indifferently. Cf. +-- http://racek.vlada.cz/usneseni/usneseni_webtest.nsf/WebGovRes/0AD8FEF4CC04B7A4C12571B6006D69D0?OpenDocument +-- (2.4.3; via ) + +local ch, CH = utfchar(replacementoffset + 1), utfchar(replacementoffset + 11) + +definitions["cz"] = { + replacements = { + { "ch", ch }, { "CH", CH } + }, + entries = { + ["a"] = "a", ["á"] = "a", ["b"] = "b", ["c"] = "c", ["č"] = "č", + ["d"] = "d", ["ď"] = "d", ["e"] = "e", ["é"] = "e", ["ě"] = "e", + ["f"] = "f", ["g"] = "g", ["h"] = "h", [ch] = "ch", ["i"] = "i", + ["í"] = "i", ["j"] = "j", ["k"] = "k", ["l"] = "l", ["m"] = "m", + ["n"] = "n", ["ň"] = "n", ["o"] = "o", ["ó"] = "o", ["p"] = "p", + ["q"] = "q", ["r"] = "r", ["ř"] = "ř", ["s"] = "s", ["š"] = "š", + ["t"] = "t", ["ť"] = "t", ["u"] = "u", ["ú"] = "u", ["ů"] = "u", + ["v"] = "v", ["w"] = "w", ["x"] = "x", ["y"] = "y", ["ý"] = "y", + ["z"] = "z", ["ž"] = "ž", + }, + orders = { + "a", "á", "b", "c", "č", "d", "ď", "e", "é", "ě", + "f", "g", "h", ch, "i", "í", "j", "k", "l", "m", + "n", "ň", "o", "ó", "p", "q", "r", "ř", "s", "š", + "t", "ť", "u", "ú", "ů", "v", "w", "x", "y", "ý", + "z", "ž", + }, + upper = { + ch = CH, + }, + lower = { + CH = ch, + } +} -entries['de-AT'] = { - ["a"] = "a", ["ä"] = "ä", ["b"] = "b", ["c"] = "c", ["d"] = "d", - ["e"] = "e", ["f"] = "f", ["g"] = "g", ["h"] = "h", ["i"] = "i", - ["j"] = "j", ["k"] = "k", ["l"] = "l", ["m"] = "m", ["n"] = "n", - ["o"] = "o", ["ö"] = "ö", ["p"] = "p", ["q"] = "q", ["r"] = "r", - ["s"] = "s", ["t"] = "t", ["u"] = "u", ["ü"] = "ü", ["v"] = "v", - ["w"] = "w", ["x"] = "x", ["y"] = "y", ["z"] = "z", --- ["A"] = "a", ["Ä"] = "ä", ["B"] = "b", ["C"] = "c", ["D"] = "d", --- ["E"] = "e", ["F"] = "f", ["G"] = "g", ["H"] = "h", ["I"] = "i", --- ["J"] = "j", ["K"] = "k", ["L"] = "l", ["M"] = "m", ["N"] = "n", --- ["O"] = "o", ["Ö"] = "ö", ["P"] = "p", ["Q"] = "q", ["R"] = "r", --- ["S"] = "s", ["T"] = "t", ["U"] = "u", ["Ü"] = "ü", ["V"] = "v", --- ["W"] = "w", ["X"] = "x", ["Y"] = "y", ["Z"] = "z", -} - -mappings['de-AT'] = { - ["a"] = 1, ["ä"] = 3, ["b"] = 5, ["c"] = 7, ["d"] = 9, - ["e"] = 11, ["f"] = 13, ["g"] = 15, ["h"] = 17, ["i"] = 19, - ["j"] = 21, ["k"] = 23, ["l"] = 25, ["m"] = 27, ["n"] = 29, - ["o"] = 31, ["ö"] = 33, ["p"] = 35, ["q"] = 37, ["r"] = 39, - ["s"] = 41, ["t"] = 43, ["u"] = 45, ["ü"] = 47, ["v"] = 49, - ["w"] = 51, ["x"] = 53, ["y"] = 55, ["z"] = 57, --- ["A"] = 2, ["Ä"] = 4, ["B"] = 6, ["C"] = 8, ["D"] = 10, --- ["E"] = 12, ["F"] = 14, ["G"] = 16, ["H"] = 18, ["I"] = 20, --- ["J"] = 22, ["K"] = 24, ["L"] = 26, ["M"] = 28, ["N"] = 30, --- ["O"] = 32, ["Ö"] = 34, ["P"] = 36, ["Q"] = 38, ["R"] = 40, --- ["S"] = 42, ["T"] = 44, ["U"] = 46, ["Ü"] = 48, ["V"] = 50, --- ["W"] = 52, ["X"] = 54, ["Y"] = 56, ["Z"] = 58, -} - -add_uppercase_entries ('de-AT') -add_uppercase_mappings('de-AT',1) +definitions["cs"] = { parent = "cz" } + +--- Slovak. + +-- Vowel and consonant quantities, "ď", "ľ", "ň", "ť", "ô", and "ä" are treated +-- indifferently as their base character, as in my dictionary. If you prefer them +-- to affect collation order, then use the values given in the comments. We could +-- define an additional vector for that. + +local dz, DZ = utfchar(replacementoffset + 1), utfchar(replacementoffset + 11) +local dzh, DZH = utfchar(replacementoffset + 2), utfchar(replacementoffset + 12) +local ch, CH = utfchar(replacementoffset + 3), utfchar(replacementoffset + 13) + +definitions["sk"] = { + replacements = { + { "dz", dz }, { "dz", DZ }, + { "dž", dzh }, { "dž", DZH }, + { "ch", ch }, { "ch", CH }, + }, + entries = { + ["a"] = "a", ["á"] = "a", ["ä"] = "a", ["b"] = "b", ["c"] = "c", + ["č"] = "č", ["d"] = "d", ["ď"] = "d", [dz] = "dz", [dzh] = "dž", + ["e"] = "e", ["é"] = "e", ["f"] = "f", ["g"] = "g", ["h"] = "h", + [ch] = "ch", ["i"] = "i", ["í"] = "i", ["j"] = "j", ["k"] = "k", + ["l"] = "l", ["ĺ"] = "l", ["ľ"] = "l", ["m"] = "m", ["n"] = "n", + ["ň"] = "n", ["o"] = "o", ["ó"] = "o", ["ô"] = "o", ["p"] = "p", + ["q"] = "q", ["r"] = "r", ["ŕ"] = "r", ["s"] = "s", ["š"] = "š", + ["t"] = "t", ["ť"] = "t", ["u"] = "u", ["ú"] = "u", ["v"] = "v", + ["w"] = "w", ["x"] = "x", ["y"] = "y", ["ý"] = "y", ["z"] = "z", + ["ž"] = "ž", + }, + orders = { + "a", "á", "ä", "b", "c", "č", "d", "ď", dz, dzh, + "e", "é", "f", "g", "h", ch, "i", "í", "j", "k", + "l", "ĺ", "ľ", "m", "n", "ň", "o", "ó", "ô", "p", + "q", "r", "ŕ", "s", "š", "t", "ť", "u", "ú", "v", + "w", "x", "y", "ý", "z", "ž", + }, + upper = { + dz = DZ, dzh = DZH, ch = CH, + }, + lower = { + DZ = dz, DZH = dzh, CH = ch, + } +} --- finish (by Wolfgang Schuster) +--- Croatian + +local dzh, DZH = utfchar(replacementoffset + 1), utfchar(replacementoffset + 11) +local lj, LJ = utfchar(replacementoffset + 2), utfchar(replacementoffset + 12) +local nj, NJ = utfchar(replacementoffset + 3), utfchar(replacementoffset + 13) + +definitions["hr"] = { + replacements = { + { "dž", dzh }, { "DŽ", DZH }, + { "lj", lj }, { "LJ", LJ }, + { "nj", nj }, { "NJ", NJ }, + }, + entries = { + ["a"] = "a", ["b"] = "b", ["c"] = "c", ["č"] = "č", ["ć"] = "ć", + ["d"] = "d", [dzh] = "dž", ["đ"] = "đ", ["e"] = "e", ["f"] = "f", + ["g"] = "g", ["h"] = "h", ["i"] = "i", ["j"] = "j", ["k"] = "k", + ["l"] = "l", [lj] = "lj", ["m"] = "m", ["n"] = "n", [nj] = "nj", + ["o"] = "o", ["p"] = "p", ["r"] = "r", ["s"] = "s", ["š"] = "š", + ["t"] = "t", ["u"] = "u", ["v"] = "v", ["z"] = "z", ["ž"] = "ž", + }, + orders = { + "a", "b", "c", "č", "ć", "d", dzh, "đ", "e", "f", + "g", "h", "i", "j", "k", "l", lj, "m", "n", nj, + "o", "p", "r", "s", "š", "t", "u", "v", "z", "ž", + }, + upper = { + dzh = DZH, lj = LJ, nj = NJ, + }, + lower = { + DZH = dzh, LJ = lj, NJ = nj, + } +} -entries['fi'] = { - ["a"] = "a", ["b"] = "b", ["c"] = "c", ["d"] = "d", ["e"] = "e", - ["f"] = "f", ["g"] = "g", ["h"] = "h", ["i"] = "i", ["j"] = "j", - ["k"] = "k", ["l"] = "l", ["m"] = "m", ["n"] = "n", ["o"] = "o", - ["p"] = "p", ["q"] = "q", ["r"] = "r", ["s"] = "s", ["t"] = "t", - ["u"] = "u", ["v"] = "v", ["w"] = "w", ["x"] = "x", ["y"] = "y", - ["z"] = "z", ["å"] = "å", ["ä"] = "ä", ["ö"] = "ö", + +--- Serbian + +definitions["sr"] = { + entries = { + ["а"] = "а", ["б"] = "б", ["в"] = "в", ["г"] = "г", ["д"] = "д", + ["ђ"] = "ђ", ["е"] = "е", ["ж"] = "ж", ["з"] = "з", ["и"] = "и", + ["ј"] = "ј", ["к"] = "к", ["л"] = "л", ["љ"] = "љ", ["м"] = "м", + ["н"] = "н", ["њ"] = "њ", ["о"] = "о", ["п"] = "п", ["р"] = "р", + ["с"] = "с", ["т"] = "т", ["ћ"] = "ћ", ["у"] = "у", ["ф"] = "ф", + ["х"] = "х", ["ц"] = "ц", ["ч"] = "ч", ["џ"] = "џ", + ["ш"] = "ш", + }, + orders = { + "а", "б", "в", "г", "д", "ђ", "е", "ж", "з", "и", + "ј", "к", "л", "љ", "м", "н", "њ", "о", "п", "р", + "с", "т", "ћ", "у", "ф", "х", "ц", "ч", "џ", "ш", + } +} + +--- Transliteration: Russian|ISO9-1995 + +-- Keeping the same collation order as Russian (v.s.). +-- Matches the tables from: +-- http://bitbucket.org/phg/transliterator/src/tip/tex/context/third/transliterator/trans_tables_iso9.lua + +local yer = utfchar(replacementoffset + 1) + +definitions["ru-iso9"] = { + replacements = { + { "''", yer }, + }, + entries = { + ["a"] = "a", ["b"] = "b", ["v"] = "v", ["g"] = "g", ["d"] = "d", + ["e"] = "e", ["ë"] = "ë", ["ž"] = "ž", ["z"] = "z", ["i"] = "i", + ["ì"] = "ì", ["j"] = "j", ["k"] = "k", ["l"] = "l", ["m"] = "m", + ["n"] = "n", ["o"] = "o", ["p"] = "p", ["r"] = "r", ["s"] = "s", + ["t"] = "t", ["u"] = "u", ["f"] = "f", ["h"] = "h", ["c"] = "c", + ["č"] = "č", ["š"] = "š", ["ŝ"] = "ŝ", ["ʺ"] = "ʺ", [yer] = "ʺ", + ["y"] = "y", ["ʹ"] = "ʹ", ["'"] = "ʹ", ["ě"] = "ě", ["è"] = "è", + ["û"] = "û", ["â"] = "â", ["û"] = "û", ["â"] = "â", + }, + orders = { + "a", "b", "v", "g", "d", "e", "ë", "ž", "z", "i", + "ì", "j", "k", "l", "m", "n", "o", "p", "r", "s", + "t", "u", "f", "h", "c", "č", "š", "ŝ", "ʺ", yer, + "y", "ʹ", "'", "ě", "è", "û", "â", "û", "â", + } +} + +--- Transliteration: Old Slavonic|scientific + +-- Matches the tables from: +-- http://bitbucket.org/phg/transliterator/src/tip/tex/context/third/transliterator/trans_tables_scntfc.lua + +local uk, UK = utfchar(replacementoffset + 1), utfchar(replacementoffset + 21) +local tshe, TSHE = utfchar(replacementoffset + 2), utfchar(replacementoffset + 22) +local sht, SHT = utfchar(replacementoffset + 3), utfchar(replacementoffset + 23) +local ju, JU = utfchar(replacementoffset + 4), utfchar(replacementoffset + 24) +local ja, JA = utfchar(replacementoffset + 5), utfchar(replacementoffset + 25) +local je, JE = utfchar(replacementoffset + 6), utfchar(replacementoffset + 26) +local ijus, IJUS = utfchar(replacementoffset + 7), utfchar(replacementoffset + 27) +local ibigjus, IBIGJUS = utfchar(replacementoffset + 8), utfchar(replacementoffset + 28) +local xi, XI = utfchar(replacementoffset + 9), utfchar(replacementoffset + 29) +local psi, PSI = utfchar(replacementoffset + 10), utfchar(replacementoffset + 30) +local theta, THETA = utfchar(replacementoffset + 11), utfchar(replacementoffset + 31) +local shch, SHCH = utfchar(replacementoffset + 12), utfchar(replacementoffset + 32) + +definitions["ocs-scn"] = { + replacements = { + { "ou", uk }, { "OU", UK }, + { "g’", tshe }, { "G’", TSHE }, + { "št", sht }, { "ŠT", SHT }, + { "ju", ju }, { "JU", JU }, + { "ja", ja }, { "JA", JA }, + { "je", je }, { "JE", JE }, + { "ję", ijus }, { "JĘ", IJUS }, + { "jǫ", ibigjus }, { "JǪ", IBIGJUS }, + { "ks", xi }, { "KS", XI }, + { "ps", psi }, { "PS", PSI }, + { "th", theta }, { "TH", THETA }, + { "šč", shch }, { "ŠČ", SHCH }, + }, + entries = { + ["a"] = "a", ["b"] = "b", ["v"] = "v", ["g"] = "g", ["d"] = "d", + ["e"] = "e", ["ž"] = "ž", ["ʒ"] = "ʒ", ["z"] = "z", ["i"] = "i", + ["ï"] = "ï", [tshe] = "g’", ["k"] = "k", ["l"] = "l", ["m"] = "m", + ["n"] = "n", ["o"] = "o", ["p"] = "p", ["r"] = "r", ["s"] = "s", + ["t"] = "t", ["u"] = "u", ["f"] = "f", ["x"] = "x", ["o"] = "o", + ["c"] = "c", ["č"] = "č", ["š"] = "š", [sht] = "št", [shch] = "šč", + ["ъ"] = "ъ", ["y"] = "y", [uk] = "y", ["ь"] = "ь", ["ě"] = "ě", + [ju] = "ju", [ja] = "ja", [je] = "je", ["ę"] = "ę", [ijus] = "ję", + ["ǫ"] = "ǫ", [ibigjus] = "jǫ", [xi] = "ks", [psi] = "ps", [theta] = "th", + ["ü"] = "ü", + }, + orders = { + "a", "b", "v", "g", "d", "e", "ž", "ʒ", "z", "i", "ï", + tshe, "k", "l", "m", "n", "o", "p", "r", "s", "t", "u", + "f", "x", "o", "c", "č", "š", sht, shch, "ъ", "y", uk, + "ь", "ě", ju, ja, je, "ę", ijus, "ǫ", ibigjus, xi, psi, + theta, "ü", + }, + upper = { + uk = UK, tshe = TSHE, sht = SHT, ju = JU, ja = JA, je = JE, ijus = IJUS, ibigjus = IBIGJUS, xi = XI, psi = PSI, theta = THETA, shch = SHCH, + }, + lower = { + UK = uk, TSHE = tshe, SHT = sht, JU = ju, JA = ja, JE = je, IJUS = ijus, IBIGJUS = ibigjus, XI = xi, PSI = psi, THETA = theta, SHCH = shch, + }, +} + + +--- Norwegian (bokmål). + +definitions["no"] = { + entries = { + ["a"] = "a", ["b"] = "b", ["c"] = "c", ["d"] = "d", ["e"] = "e", + ["f"] = "f", ["g"] = "g", ["h"] = "h", ["i"] = "i", ["j"] = "j", + ["k"] = "k", ["l"] = "l", ["m"] = "m", ["n"] = "n", ["o"] = "o", + ["p"] = "p", ["q"] = "q", ["r"] = "r", ["s"] = "s", ["t"] = "t", + ["u"] = "u", ["v"] = "v", ["w"] = "w", ["x"] = "x", ["y"] = "y", + ["z"] = "z", ["æ"] = "æ", ["ø"] = "ø", ["å"] = "å", + }, + orders = { + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", + "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", + "u", "v", "w", "x", "y", "z", "æ", "ø", "å", + } +} + +--- Danish (-> Norwegian). + +definitions["da"] = { parent = "no" } + +--- Swedish + +definitions["sv"] = { + entries = { + ["a"] = "a", ["b"] = "b", ["c"] = "c", ["d"] = "d", ["e"] = "e", + ["f"] = "f", ["g"] = "g", ["h"] = "h", ["i"] = "i", ["j"] = "j", + ["k"] = "k", ["l"] = "l", ["m"] = "m", ["n"] = "n", ["o"] = "o", + ["p"] = "p", ["q"] = "q", ["r"] = "r", ["s"] = "s", ["t"] = "t", + ["u"] = "u", ["v"] = "v", ["w"] = "w", ["x"] = "x", ["y"] = "y", + ["z"] = "z", ["å"] = "å", ["ä"] = "ä", ["ö"] = "ö", + }, + orders = { + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", + "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", + "u", "v", "w", "x", "y", "z", "å", "ä", "ö", + } +} + +--- Icelandic + +-- Treating quantities as allographs. + +definitions["is"] = { + entries = { + ["a"] = "a", ["á"] = "a", ["b"] = "b", ["d"] = "d", ["ð"] = "ð", + ["e"] = "e", ["é"] = "e", ["f"] = "f", ["g"] = "g", ["h"] = "h", + ["i"] = "i", ["í"] = "i", ["j"] = "j", ["k"] = "k", ["l"] = "l", + ["m"] = "m", ["n"] = "n", ["o"] = "o", ["ó"] = "o", ["p"] = "p", + ["r"] = "r", ["s"] = "s", ["t"] = "t", ["u"] = "u", ["ú"] = "u", + ["v"] = "v", ["x"] = "x", ["y"] = "y", ["ý"] = "y", ["þ"] = "þ", + ["æ"] = "æ", ["ö"] = "ö", + }, + orders = { + "a", "á", "b", "d", "ð", "e", "é", "f", "g", "h", + "i", "í", "j", "k", "l", "m", "n", "o", "ó", "p", + "r", "s", "t", "u", "ú", "v", "x", "y", "ý", "þ", + "æ", "ö", + }, +} + +--- Greek + +definitions["gr"] = { + entries = { + ["α"] = "α", ["ά"] = "α", ["ὰ"] = "α", ["ᾶ"] = "α", ["ᾳ"] = "α", + ["ἀ"] = "α", ["ἁ"] = "α", ["ἄ"] = "α", ["ἂ"] = "α", ["ἆ"] = "α", + ["ἁ"] = "α", ["ἅ"] = "α", ["ἃ"] = "α", ["ἇ"] = "α", ["ᾁ"] = "α", + ["ᾴ"] = "α", ["ᾲ"] = "α", ["ᾷ"] = "α", ["ᾄ"] = "α", ["ᾂ"] = "α", + ["ᾅ"] = "α", ["ᾃ"] = "α", ["ᾆ"] = "α", ["ᾇ"] = "α", ["β"] = "β", + ["γ"] = "γ", ["δ"] = "δ", ["ε"] = "ε", ["έ"] = "ε", ["ὲ"] = "ε", + ["ἐ"] = "ε", ["ἔ"] = "ε", ["ἒ"] = "ε", ["ἑ"] = "ε", ["ἕ"] = "ε", + ["ἓ"] = "ε", ["ζ"] = "ζ", ["η"] = "η", ["η"] = "η", ["ή"] = "η", + ["ὴ"] = "η", ["ῆ"] = "η", ["ῃ"] = "η", ["ἠ"] = "η", ["ἤ"] = "η", + ["ἢ"] = "η", ["ἦ"] = "η", ["ᾐ"] = "η", ["ἡ"] = "η", ["ἥ"] = "η", + ["ἣ"] = "η", ["ἧ"] = "η", ["ᾑ"] = "η", ["ῄ"] = "η", ["ῂ"] = "η", + ["ῇ"] = "η", ["ᾔ"] = "η", ["ᾒ"] = "η", ["ᾕ"] = "η", ["ᾓ"] = "η", + ["ᾖ"] = "η", ["ᾗ"] = "η", ["θ"] = "θ", ["ι"] = "ι", ["ί"] = "ι", + ["ὶ"] = "ι", ["ῖ"] = "ι", ["ἰ"] = "ι", ["ἴ"] = "ι", ["ἲ"] = "ι", + ["ἶ"] = "ι", ["ἱ"] = "ι", ["ἵ"] = "ι", ["ἳ"] = "ι", ["ἷ"] = "ι", + ["ϊ"] = "ι", ["ΐ"] = "ι", ["ῒ"] = "ι", ["ῗ"] = "ι", ["κ"] = "κ", + ["λ"] = "λ", ["μ"] = "μ", ["ν"] = "ν", ["ξ"] = "ξ", ["ο"] = "ο", + ["ό"] = "ο", ["ὸ"] = "ο", ["ὀ"] = "ο", ["ὄ"] = "ο", ["ὂ"] = "ο", + ["ὁ"] = "ο", ["ὅ"] = "ο", ["ὃ"] = "ο", ["π"] = "π", ["ρ"] = "ρ", + ["ῤ"] = "ῤ", ["ῥ"] = "ῥ", ["σ"] = "σ", ["ς"] = "ς", ["τ"] = "τ", + ["υ"] = "υ", ["ύ"] = "υ", ["ὺ"] = "υ", ["ῦ"] = "υ", ["ὐ"] = "υ", + ["ὔ"] = "υ", ["ὒ"] = "υ", ["ὖ"] = "υ", ["ὑ"] = "υ", ["ὕ"] = "υ", + ["ὓ"] = "υ", ["ὗ"] = "υ", ["ϋ"] = "υ", ["ΰ"] = "υ", ["ῢ"] = "υ", + ["ῧ"] = "υ", ["φ"] = "φ", ["χ"] = "χ", ["ψ"] = "ω", ["ω"] = "ω", + ["ώ"] = "ω", ["ὼ"] = "ω", ["ῶ"] = "ω", ["ῳ"] = "ω", ["ὠ"] = "ω", + ["ὤ"] = "ω", ["ὢ"] = "ω", ["ὦ"] = "ω", ["ᾠ"] = "ω", ["ὡ"] = "ω", + ["ὥ"] = "ω", ["ὣ"] = "ω", ["ὧ"] = "ω", ["ᾡ"] = "ω", ["ῴ"] = "ω", + ["ῲ"] = "ω", ["ῷ"] = "ω", ["ᾤ"] = "ω", ["ᾢ"] = "ω", ["ᾥ"] = "ω", + ["ᾣ"] = "ω", ["ᾦ"] = "ω", ["ᾧ"] = "ω", + }, + orders = { + "α", "ά", "ὰ", "ᾶ", "ᾳ", "ἀ", "ἁ", "ἄ", "ἂ", "ἆ", + "ἁ", "ἅ", "ἃ", "ἇ", "ᾁ", "ᾴ", "ᾲ", "ᾷ", "ᾄ", "ᾂ", + "ᾅ", "ᾃ", "ᾆ", "ᾇ", "β", "γ", "δ", "ε", "έ", "ὲ", + "ἐ", "ἔ", "ἒ", "ἑ", "ἕ", "ἓ", "ζ", "η", "η", "ή", + "ὴ", "ῆ", "ῃ", "ἠ", "ἤ", "ἢ", "ἦ", "ᾐ", "ἡ", "ἥ", + "ἣ", "ἧ", "ᾑ", "ῄ", "ῂ", "ῇ", "ᾔ", "ᾒ", "ᾕ", "ᾓ", + "ᾖ", "ᾗ", "θ", "ι", "ί", "ὶ", "ῖ", "ἰ", "ἴ", "ἲ", + "ἶ", "ἱ", "ἵ", "ἳ", "ἷ", "ϊ", "ΐ", "ῒ", "ῗ", "κ", + "λ", "μ", "ν", "ξ", "ο", "ό", "ὸ", "ὀ", "ὄ", "ὂ", + "ὁ", "ὅ", "ὃ", "π", "ρ", "ῤ", "ῥ", "σ", "ς", "τ", + "υ", "ύ", "ὺ", "ῦ", "ὐ", "ὔ", "ὒ", "ὖ", "ὑ", "ὕ", + "ὓ", "ὗ", "ϋ", "ΰ", "ῢ", "ῧ", "φ", "χ", "ψ", "ω", + "ώ", "ὼ", "ῶ", "ῳ", "ὠ", "ὤ", "ὢ", "ὦ", "ᾠ", "ὡ", + "ὥ", "ὣ", "ὧ", "ᾡ", "ῴ", "ῲ", "ῷ", "ᾤ", "ᾢ", "ᾥ", + "ᾣ", "ᾦ", "ᾧ", + }, } -mappings['fi'] = { - ["a"] = 1, ["b"] = 3, ["c"] = 5, ["d"] = 7, ["e"] = 9, - ["f"] = 11, ["g"] = 13, ["h"] = 15, ["i"] = 17, ["j"] = 19, - ["k"] = 21, ["l"] = 23, ["m"] = 25, ["n"] = 27, ["o"] = 29, - ["p"] = 31, ["q"] = 33, ["r"] = 35, ["s"] = 37, ["t"] = 39, - ["u"] = 41, ["v"] = 43, ["w"] = 45, ["x"] = 47, ["y"] = 49, - ["z"] = 51, ["å"] = 53, ["ä"] = 55, ["ö"] = 57, +--- Latin + +-- Treating the post-classical fricatives “j” and “v” as “i” and “u” +-- respectively. + +definitions["la"] = { + replacements = { + { "æ", "ae" }, { "Æ", "AE" }, + }, + entries = { + ["a"] = "a", ["ā"] = "a", ["ă"] = "a", ["b"] = "b", ["c"] = "c", + ["d"] = "d", ["e"] = "e", ["ē"] = "e", ["ĕ"] = "e", ["f"] = "f", + ["g"] = "g", ["h"] = "h", ["i"] = "i", ["ī"] = "i", ["ĭ"] = "i", + ["j"] = "i", ["k"] = "k", ["l"] = "l", ["m"] = "m", ["n"] = "n", + ["o"] = "o", ["ō"] = "o", ["ŏ"] = "o", ["p"] = "p", ["q"] = "q", + ["r"] = "r", ["s"] = "s", ["t"] = "t", ["u"] = "u", ["ū"] = "u", + ["ŭ"] = "u", ["v"] = "u", ["w"] = "w", ["x"] = "x", ["y"] = "y", + ["ȳ"] = "y", ["y̆"] = "y", ["z"] = "z", + }, + orders = { + "a", "ā", "ă", "b", "c", "d", "e", "ē", "ĕ", "f", + "g", "h", "i", "ī", "ĭ", "j", "k", "l", "m", "n", + "o", "ō", "ŏ", "p", "q", "r", "s", "t", "u", "ū", + "ŭ", "v", "w", "x", "y", "ȳ", "y̆", "z", + } } -add_uppercase_entries ("fi") -add_uppercase_mappings("fi") +--- Italian + +definitions["it"] = { + entries = { + ["a"] = "a", ["á"] = "a", ["b"] = "b", ["c"] = "c", ["d"] = "d", + ["e"] = "e", ["é"] = "e", ["è"] = "e", ["f"] = "f", ["g"] = "g", + ["h"] = "h", ["i"] = "i", ["í"] = "i", ["ì"] = "i", ["j"] = "i", + ["k"] = "k", ["l"] = "l", ["m"] = "m", ["n"] = "n", ["o"] = "o", + ["ó"] = "o", ["ò"] = "o", ["p"] = "p", ["q"] = "q", ["r"] = "r", + ["s"] = "s", ["t"] = "t", ["u"] = "u", ["ú"] = "u", ["ù"] = "u", + ["v"] = "u", ["w"] = "w", ["x"] = "x", ["y"] = "y", ["z"] = "z", + }, + orders = { + "a", "á", "b", "c", "d", "e", "é", "è", "f", "g", + "h", "i", "í", "ì", "j", "k", "l", "m", "n", "o", + "ó", "ò", "p", "q", "r", "s", "t", "u", "ú", "ù", + "v", "w", "x", "y", "z", + } +} + +--- Romanian + +definitions["ro"] = { + entries = { + ["a"] = "a", ["ă"] = "ă", ["â"] = "â", ["b"] = "b", ["c"] = "c", + ["d"] = "d", ["e"] = "e", ["f"] = "f", ["g"] = "g", ["h"] = "h", + ["i"] = "i", ["î"] = "î", ["j"] = "j", ["k"] = "k", ["l"] = "l", + ["m"] = "m", ["n"] = "n", ["o"] = "o", ["p"] = "p", ["q"] = "q", + ["r"] = "r", ["s"] = "s", ["ș"] = "ș", ["t"] = "t", ["ț"] = "ț", + ["u"] = "u", ["v"] = "v", ["w"] = "w", ["x"] = "x", ["y"] = "y", + ["z"] = "z", + }, + orders = { + "a", "ă", "â", "b", "c", "d", "e", "f", "g", "h", + "i", "î", "j", "k", "l", "m", "n", "o", "p", "q", + "r", "s", "ș", "t", "ț", "u", "v", "w", "x", "y", + "z", + } +} + +--- Spanish + +definitions["es"] = { + entries = { + ["a"] = "a", ["á"] = "a", ["b"] = "b", ["c"] = "c", ["d"] = "d", + ["e"] = "e", ["é"] = "e", ["f"] = "f", ["g"] = "g", ["h"] = "h", + ["i"] = "i", ["í"] = "i", ["j"] = "j", ["k"] = "k", ["l"] = "l", + ["m"] = "m", ["n"] = "n", ["ñ"] = "ñ", ["o"] = "o", ["ó"] = "o", + ["p"] = "p", ["q"] = "q", ["r"] = "r", ["s"] = "s", ["t"] = "t", + ["u"] = "u", ["ú"] = "u", ["ü"] = "u", ["v"] = "v", ["w"] = "w", + ["x"] = "x", ["y"] = "y", ["z"] = "z", + }, + orders = { + "a", "á", "b", "c", "d", "e", "é", "f", "g", "h", + "i", "í", "j", "k", "l", "m", "n", "ñ", "o", "ó", + "p", "q", "r", "s", "t", "u", "ú", "ü", "v", "w", + "x", "y", "z", + } +} + +--- Portuguese + +definitions["pt"] = { + entries = { + ["a"] = "a", ["á"] = "a", ["â"] = "a", ["ã"] = "a", ["à"] = "a", + ["b"] = "b", ["c"] = "c", ["ç"] = "c", ["d"] = "d", ["e"] = "e", + ["é"] = "e", ["ê"] = "e", ["f"] = "f", ["g"] = "g", ["h"] = "h", + ["i"] = "i", ["í"] = "i", ["j"] = "j", ["k"] = "k", ["l"] = "l", + ["m"] = "m", ["n"] = "n", ["o"] = "o", ["ó"] = "o", ["ô"] = "o", + ["õ"] = "o", ["p"] = "p", ["q"] = "q", ["r"] = "r", ["s"] = "s", + ["t"] = "t", ["u"] = "u", ["ú"] = "u", ["ü"] = "u", ["v"] = "v", + ["w"] = "w", ["x"] = "x", ["y"] = "y", ["z"] = "z", + }, + orders = { + "a", "á", "â", "ã", "à", "b", "c", "ç", "d", "e", + "é", "ê", "f", "g", "h", "i", "í", "j", "k", "l", + "m", "n", "o", "ó", "ô", "õ", "p", "q", "r", "s", + "t", "u", "ú", "ü", "v", "w", "x", "y", "z", + } +} --- slovenian --- --- MM: this will change since we need to add accented vowels +--- Lithuanian + +local ch, CH = utfchar(replacementoffset + 1), utfchar(replacementoffset + 11) + +definitions["lt"] = { + replacements = { + { "ch", ch }, { "CH", CH} + }, + entries = { + ["a"] = "a", ["ą"] = "a", ["b"] = "b", ["c"] = "c", [ch ] = "c", + ["č"] = "č", ["d"] = "d", ["e"] = "e", ["ę"] = "e", ["ė"] = "e", + ["f"] = "f", ["g"] = "g", ["h"] = "h", ["i"] = "i", ["į"] = "i", + ["y"] = "i", ["j"] = "j", ["k"] = "k", ["l"] = "l", ["m"] = "m", + ["n"] = "n", ["o"] = "o", ["p"] = "p", ["r"] = "r", ["s"] = "s", + ["š"] = "š", ["t"] = "t", ["u"] = "u", ["ų"] = "u", ["ū"] = "u", + ["v"] = "v", ["z"] = "z", ["ž"] = "ž", + }, + orders = { + "a", "ą", "b", "c", ch, "č", "d", "e", "ę", "ė", + "f", "g", "h", "i", "į", "y", "j", "k", "l", "m", + "n", "o", "p", "r", "s", "š", "t", "u", "ų", "ū", + "v", "z", "ž", + }, + lower = { + ch = CH, + }, + upper = { + CH = ch, + }, +} + +--- Latvian + +definitions["lv"] = { + entries = { + ["a"] = "a", ["ā"] = "a", ["b"] = "b", ["c"] = "c", ["č"] = "č", + ["d"] = "d", ["e"] = "e", ["ē"] = "e", ["f"] = "f", ["g"] = "g", + ["ģ"] = "ģ", ["h"] = "h", ["i"] = "i", ["ī"] = "i", ["j"] = "j", + ["k"] = "k", ["ķ"] = "ķ", ["l"] = "l", ["ļ"] = "ļ", ["m"] = "m", + ["n"] = "n", ["ņ"] = "ņ", ["o"] = "o", ["ō"] = "o", ["p"] = "p", + ["r"] = "r", ["ŗ"] = "ŗ", ["s"] = "s", ["š"] = "š", ["t"] = "t", + ["u"] = "u", ["ū"] = "u", ["v"] = "v", ["z"] = "z", ["ž"] = "ž", + }, + orders = { + "a", "ā", "b", "c", "č", "d", "e", "ē", "f", "g", + "ģ", "h", "i", "ī", "j", "k", "ķ", "l", "ļ", "m", + "n", "ņ", "o", "ō", "p", "r", "ŗ", "s", "š", "t", + "u", "ū", "v", "z", "ž", + } +} -entries['sl'] = { - ["a"] = "a", ["b"] = "b", ["c"] = "c", ["č"] = "č", ["ć"] = "ć", ["d"] = "d", - ["đ"] = "đ", ["e"] = "e", ["f"] = "f", ["g"] = "g", ["h"] = "h", ["i"] = "i", - ["j"] = "j", ["k"] = "k", ["l"] = "l", ["m"] = "m", ["n"] = "n", ["o"] = "o", - ["p"] = "p", ["q"] = "q", ["r"] = "r", ["s"] = "s", ["š"] = "š", ["t"] = "t", - ["u"] = "u", ["v"] = "v", ["w"] = "w", ["x"] = "x", ["y"] = "y", ["z"] = "z", - ["ž"] = "ž", +--- Hungarian + +-- Helpful but disturbing: +-- http://en.wikipedia.org/wiki/Hungarian_alphabet#Alphabetical_ordering_.28collation.29 +-- (In short: you'd have to analyse word-compounds to realize a correct order +-- for sequences like “nny”, “ssz”, and “zsz”. This is left as an exercise to +-- the reader…) + +local cs, CS = utfchar(replacementoffset + 1), utfchar(replacementoffset + 11) +local dz, DZ = utfchar(replacementoffset + 2), utfchar(replacementoffset + 12) +local dzs, DZS = utfchar(replacementoffset + 3), utfchar(replacementoffset + 13) +local gy, GY = utfchar(replacementoffset + 4), utfchar(replacementoffset + 14) +local ly, LY = utfchar(replacementoffset + 5), utfchar(replacementoffset + 15) +local ny, NY = utfchar(replacementoffset + 6), utfchar(replacementoffset + 16) +local sz, SZ = utfchar(replacementoffset + 7), utfchar(replacementoffset + 17) +local ty, TY = utfchar(replacementoffset + 8), utfchar(replacementoffset + 18) +local zs, ZS = utfchar(replacementoffset + 9), utfchar(replacementoffset + 19) + +definitions["hu"] = { + replacements = { + { "cs", cs }, { "CS", CS }, + { "dz", dz }, { "DZ", DZ }, + { "dzs", dzs }, { "DZS", DZS }, + { "gy", gy }, { "GY", GY }, + { "ly", ly }, { "LY", LY }, + { "ny", ny }, { "NY", NY }, + { "sz", sz }, { "SZ", SZ }, + { "ty", ty }, { "TY", TY }, + { "zs", zs }, { "ZS", ZS }, + }, + entries = { + ["a"] = "a", ["á"] = "a", ["b"] = "b", ["c"] = "c", [cs ] = "cs", + ["d"] = "d", [dz ] = "dz", [dzs] = "dzs", ["e"] = "e", ["é"] = "e", + ["f"] = "f", ["g"] = "g", [gy ] = "gy", ["h"] = "h", ["i"] = "i", + ["í"] = "i", ["j"] = "j", ["k"] = "k", ["l"] = "l", [ly ] = "ly", + ["m"] = "m", ["n"] = "n", [ny ] = "ny", ["o"] = "o", ["ó"] = "o", + ["ö"] = "ö", ["ő"] = "ö", ["p"] = "p", ["q"] = "q", ["r"] = "r", + ["s"] = "s", [sz ] = "sz", ["t"] = "t", [ty ] = "ty", ["u"] = "u", + ["ú"] = "u", ["ü"] = "ü", ["ű"] = "ü", ["v"] = "v", ["w"] = "w", + ["x"] = "x", ["y"] = "y", ["z"] = "z", [zs ] = "zs", + }, + orders = { + "a", "á", "b", "c", cs, "d", dz, dzs, "e", "é", + "f", "g", gy, "h", "i", "í", "j", "k", "l", ly, + "m", "n", ny, "o", "ó", "ö", "ő", "p", "q", "r", + "s", sz, "t", ty, "u", "ú", "ü", "ű", "v", "w", + "x", "y", "z", zs, + }, + lower = { + CS = cs, DZ = dz, DZS = dzs, GY = gy, LY = ly, NY = ny, SZ = sz, TY = ty, ZS = zs, + }, + upper = { + cs = CS, dz = DZ, dzs = DZS, gy = GY, ly = LY, ny = NY, sz = SZ, ty = TY, zs = ZS, + }, } -mappings['sl'] = { - ["a"] = 1, ["b"] = 3, ["c"] = 5, ["č"] = 7, ["ć"] = 9, ["d"] = 11, - ["đ"] = 13, ["e"] = 15, ["f"] = 17, ["g"] = 19, ["h"] = 21, ["i"] = 23, - ["j"] = 25, ["k"] = 27, ["l"] = 29, ["m"] = 31, ["n"] = 33, ["o"] = 35, - ["p"] = 37, ["q"] = 39, ["r"] = 41, ["s"] = 43, ["š"] = 45, ["t"] = 47, - ["u"] = 49, ["v"] = 51, ["w"] = 53, ["x"] = 55, ["y"] = 57, ["z"] = 59, - ["ž"] = 61, +--- Estonian + +definitions["et"] = { + entries = { -- w x y are used for foreign words only + ["a"] = "a", ["b"] = "b", ["d"] = "d", ["e"] = "e", ["f"] = "f", + ["g"] = "g", ["h"] = "h", ["i"] = "i", ["j"] = "j", ["k"] = "k", + ["l"] = "l", ["m"] = "m", ["n"] = "n", ["o"] = "o", ["p"] = "p", + ["r"] = "r", ["s"] = "s", ["š"] = "š", ["z"] = "z", ["ž"] = "ž", + ["t"] = "t", ["u"] = "u", ["v"] = "v", ["w"] = "v", ["õ"] = "õ", + ["ä"] = "ä", ["ö"] = "ö", ["ü"] = "ü", ["x"] = "x", ["y"] = "y", + }, + orders = { + "a", "b", "d", "e", "f", "g", "h", "i", "j", "k", + "l", "m", "n", "o", "p", "r", "s", "š", "z", "ž", + "t", "u", "v", "w", "õ", "ä", "ö", "ü", "x", "y", + } } -add_uppercase_entries ("sl") -add_uppercase_mappings("sl") -- cf. MM +--- Korean + +local fschars = characters.fschars + +local function firstofsplit(first) + local fs = fschars[first] or first + -- print(string.format("%04x %04x",utfbyte(first),utfbyte(fs))) + return fs, fs -- entry, tag +end + +definitions["kr"] = { + firstofsplit = firstofsplit, + orders = { + "ㄱ", "ㄴ", "ㄷ", "ㄹ", "ㅁ", "ㅂ", "ㅅ", "ㅇ", "ㅈ", "ㅊ", "ㅋ", "ㅌ", "ㅍ", "ㅎ", + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", + "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", + } +} diff --git a/Master/texmf-dist/tex/context/base/spac-ali.lua b/Master/texmf-dist/tex/context/base/spac-ali.lua new file mode 100644 index 00000000000..37bff74d1e2 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/spac-ali.lua @@ -0,0 +1,132 @@ +if not modules then modules = { } end modules ['spac-ali'] = { + version = 1.001, + comment = "companion to spac-ali.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local div = math.div + +local tasks = nodes.tasks +local appendaction = tasks.appendaction +local prependaction = tasks.prependaction +local disableaction = tasks.disableaction +local enableaction = tasks.enableaction + +local has_attribute = node.has_attribute +local unset_attribute = node.unset_attribute +local slide_nodes = node.slide +local hpack_nodes = node.hpack -- nodes.fasthpack not really faster here + +local link_nodes = nodes.link + +local nodecodes = nodes.nodecodes +local listcodes = nodes.listcodes + +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist +local line_code = listcodes.line + +local nodepool = nodes.pool + +local new_stretch = nodepool.stretch + +local a_realign = attributes.private("realign") + +local texattribute = tex.attribute +local texcount = tex.count + +local isleftpage = layouts.status.isleftpage + +local alignments = { } +typesetters.alignments = alignments + +local report_realign = logs.reporter("typesetters","margindata") +local trace_realign = trackers.register("typesetters.margindata", function(v) trace_margindata = v end) + +local nofrealigned = 0 + +-- leftskip rightskip parfillskip +-- raggedleft 0 + 0 - +-- raggedright 0 0 fil +-- raggedcenter 0 + 0 + - + +local function handler(head,leftpage,realpageno) + local current = head + local done = false + while current do + local id = current.id + if id == hlist_code then + if current.subtype == line_code then + local a = has_attribute(current,a_realign) + if not a or a == 0 then + -- skip + else + local align = a % 10 + local pageno = div(a,10) + if pageno == realpageno then + -- already ok + else + local action = 0 + if align == 1 then -- flushright + action = leftpage and 1 or 2 + elseif align == 2 then -- flushleft + action = leftpage and 2 or 1 + end + if action == 1 then + current.list = hpack_nodes(link_nodes(current.list,new_stretch(3)),current.width,"exactly") + if trace_realign then + report_realign("flush left: align %s, page %s, realpage %s",align,pageno,realpageno) + end + elseif action == 2 then + current.list = hpack_nodes(link_nodes(new_stretch(3),current.list),current.width,"exactly") + if trace_realign then + report_realign("flush right: align %s, page %s, realpage %s",align,pageno,realpageno) + end + elseif trace_realign then + report_realign("invalid: align %s, page %s, realpage %s",align,pageno,realpageno) + end + done = true + nofrealigned = nofrealigned + 1 + end + unset_attribute(current,a_realign) + end + end + handler(current.list,leftpage,realpageno) + elseif id == vlist_code then + handler(current.list,leftpage,realpageno) + end + current = current.next + end + return head, done +end + +function alignments.handler(head) + local leftpage = isleftpage(true,false) + local realpageno = texcount.realpageno + return handler(head,leftpage,realpageno) +end + +local enabled = false + +function alignments.set(n) + if not enabled then + enableaction("shipouts","typesetters.alignments.handler") + enabled = true + if trace_realign then + report_realign("enabled") + end + end + texattribute[a_realign] = texcount.realpageno * 10 + n +end + +commands.setrealign = alignments.set + +statistics.register("realigning", function() + if nofrealigned > 0 then + return string.format("%s processed",nofrealigned) + else + return nil + end +end) diff --git a/Master/texmf-dist/tex/context/base/spac-ali.mkiv b/Master/texmf-dist/tex/context/base/spac-ali.mkiv index b168a02be27..0cf22f470cf 100644 --- a/Master/texmf-dist/tex/context/base/spac-ali.mkiv +++ b/Master/texmf-dist/tex/context/base/spac-ali.mkiv @@ -15,6 +15,18 @@ \unprotect +\registerctxluafile{spac-ali}{1.001} + +\definesystemattribute[realign][public] + +\unexpanded\def\resetrealignsignal{\attribute\realignattribute\attributeunsetvalue} +\unexpanded\def\signalinnerrealign{\ctxcommand{setrealign(2)}} +\unexpanded\def\signalouterrealign{\ctxcommand{setrealign(1)}} + +\appendtoks + \resetrealignsignal +\to \everyforgetall + % We will not use bodydir and pagedir so we disable them. That way we get % normal hyperlink support. @@ -69,44 +81,66 @@ \unexpanded\def\definehbox {\dodoubleargument\dodefinehbox} -\def\iobox#1#2#3#% here #3# is not really needed - {\vbox\bgroup % we want to return a vbox like the others - \hbox\bgroup% we need to pack the signal with the box - \signalrightpage - \dowithnextboxcontent - {\let\\=\endgraf\forgetall\doifrightpageelse#1#2} - {\box\nextbox\egroup\egroup} - \vbox#3} +% To be redone: + +\def\ibox#1#2#3% + {\vbox\bgroup + \forgetall + \let\\=\endgraf + \ifdoublesided\signalinnerrealign\fi + \doifrightpageelse\raggedright\raggedleft + \let\next} + +\def\obox#1#2#3% + {\vbox\bgroup + \forgetall + \let\\=\endgraf + \ifdoublesided\signalouterrealign\fi + \doifrightpageelse\raggedleft\raggedright + \let\next} + +\def\@@ragged@@command{@@ragged@@c} +\def\@@ragged@@hbox {@@ragged@@h} +\def\@@ragged@@vbox {@@ragged@@v} + +\def\dosetraggedvbox#1% can be more keys + {\let\raggedbox\vbox + \processcommacommand[#1]\dosetraggedvbox} -\def\obox{\iobox\raggedleft \raggedright} % outerbox -\def\ibox{\iobox\raggedright\raggedleft} % innerbox +\def\dosetraggedhbox#1% can be more keys + {\let\raggedbox\hbox + \processcommacommand[#1]\dosetraggedhbox} \def\dosetraggedvbox#1% - {\let\raggedbox\vbox - \processfirstactioninset - [#1] - [ \v!left=>\let\raggedbox\lbox, - \v!right=>\let\raggedbox\rbox, - \v!middle=>\let\raggedbox\cbox, - \v!inner=>\let\raggedbox\ibox, - \v!outer=>\let\raggedbox\obox, - \v!flushleft=>\let\raggedbox\rbox, - \v!flushright=>\let\raggedbox\lbox, - \v!center=>\let\raggedbox\cbox, - \v!no=>\def\raggedbox{\vbox\bgroup\raggedright\let\next=}]} + {\ifcsname\@@ragged@@vbox#1\endcsname + \csname\@@ragged@@vbox#1\endcsname + \quitcommalist + \fi} \def\dosetraggedhbox#1% - {\let\raggedbox\hbox - \processaction % slow - [#1] - [ \v!left=>\def\raggedbox{\doalignedline\v!left }, - \v!right=>\def\raggedbox{\doalignedline\v!right }, - \v!middle=>\def\raggedbox{\doalignedline\v!middle}, - \v!inner=>\def\raggedbox{\doalignedline\v!inner }, - \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}]} + {\ifcsname\@@ragged@@hbox#1\endcsname + \csname\@@ragged@@hbox#1\endcsname + \quitcommalist + \fi} + +\setvalue{\@@ragged@@vbox\v!left }{\let\raggedbox\lbox} +\setvalue{\@@ragged@@vbox\v!right }{\let\raggedbox\rbox} +\setvalue{\@@ragged@@vbox\v!middle }{\let\raggedbox\cbox} +\setvalue{\@@ragged@@vbox\v!inner }{\let\raggedbox\ibox} +\setvalue{\@@ragged@@vbox\v!outer }{\let\raggedbox\obox} +\setvalue{\@@ragged@@vbox\v!flushleft }{\let\raggedbox\rbox} +\setvalue{\@@ragged@@vbox\v!flushright}{\let\raggedbox\lbox} +\setvalue{\@@ragged@@vbox\v!center }{\let\raggedbox\cbox} +\setvalue{\@@ragged@@vbox\v!no }{\def\raggedbox{\vbox\bgroup\raggedright\let\next=}]} + +\setvalue{\@@ragged@@hbox\v!left }{\def\raggedbox{\doalignedline\v!left }} +\setvalue{\@@ragged@@hbox\v!right }{\def\raggedbox{\doalignedline\v!right }} +\setvalue{\@@ragged@@hbox\v!middle }{\def\raggedbox{\doalignedline\v!middle}} +\setvalue{\@@ragged@@hbox\v!inner }{\def\raggedbox{\doalignedline\v!inner }} +\setvalue{\@@ragged@@hbox\v!outer }{\def\raggedbox{\doalignedline\v!outer }} +\setvalue{\@@ragged@@hbox\v!flushleft }{\def\raggedbox{\doalignedline\v!right }} +\setvalue{\@@ragged@@hbox\v!flushright}{\def\raggedbox{\doalignedline\v!left }} +\setvalue{\@@ragged@@hbox\v!center }{\def\raggedbox{\doalignedline\v!middle}} \def\dosetraggedcommand#1% {\normalexpanded{\noexpand\dodosetraggedcommand{#1}}} @@ -115,12 +149,17 @@ \def\raggedcommand{\the\everyraggedcommand} -\def\dodosetraggedcommand#1% beware: #1=empty is ignored, keep that! - {\everyraggedcommand\emptytoks +% slow, we can do this in lua ... some day + +\let\raggedbox\relax + +\unexpanded\def\dodosetraggedcommand#1% beware: #1=empty is ignored, keep that! + {\everyraggedcommand{\resetrealignsignal}% \emptytoks maybe only when #1 <> empty \let\raggedtopcommand\empty \let\raggedbottomcommand\empty - \chardef\raggedoneliner\zerocount - \doifsomething{#1} + \let\raggedbox\relax + \setfalse\raggedonelinerstate + \doifsomething{#1}% {\doifinsetelse\v!broad{#1}\!!doneatrue\!!doneafalse \doifinsetelse\v!wide {#1}\!!donebtrue\!!donebfalse \!!donectrue @@ -129,8 +168,6 @@ \def\dododosetraggedcommand#1% {\executeifdefined{\@@ragged@@command\string#1}\relax} -\def\@@ragged@@command{@@raggedcommand} - \setvalue{\@@ragged@@command\v!hanging }{\appendtoks\enableprotruding \to\everyraggedcommand} \setvalue{\@@ragged@@command\v!nothanging }{\appendtoks\disableprotruding \to\everyraggedcommand} \setvalue{\@@ragged@@command\v!hz }{\appendtoks\enableadjusting \to\everyraggedcommand} @@ -193,16 +230,20 @@ \setvalue{\@@ragged@@command\v!normal}% {\appendtoks\notragged\to\everyraggedcommand} -\setvalue{\@@ragged@@command\v!inner}% not yet perfect - {\signalrightpage % may interfere - \doifrightpageelse - {\getvalue{\@@ragged@@command\v!right}} - {\getvalue{\@@ragged@@command\v!left}}} +\setvalue{\@@ragged@@command\v!inner}% + {\ifdoublesided + \appendtoks\signalinnerrealign\to\everyraggedcommand + \fi + \rightorleftpageaction + {\getvalue{\@@ragged@@command\v!right}}% + {\getvalue{\@@ragged@@command\v!left }}} -\setvalue{\@@ragged@@command\v!outer}% not yet perfect - {\signalrightpage % may interfere - \doifrightpageelse - {\getvalue{\@@ragged@@command\v!left}} +\setvalue{\@@ragged@@command\v!outer}% + {\ifdoublesided + \appendtoks\signalouterrealign\to\everyraggedcommand + \fi + \rightorleftpageaction + {\getvalue{\@@ragged@@command\v!left }}% {\getvalue{\@@ragged@@command\v!right}}} \setvalue{\@@ragged@@command\v!lesshyphenation}% @@ -223,10 +264,10 @@ \setvalue{\@@ragged@@command\v!disable}% for one liners {\appendtoks\raggedright\parfillskip\zeropoint\to\everyraggedcommand} -\chardef\raggedoneliner\zerocount +\ifdefined\raggedonelinerstate \else \newconditional\raggedonelinerstate \fi \setvalue{\@@ragged@@command\v!line}% - {\chardef\raggedoneliner\plusone} + {\settrue\raggedonelinerstate} % More alignments: @@ -234,7 +275,7 @@ % \tolerance >= 1500 % was 200 % \raggedness = 2 .. 6\bodyfontsize -\chardef\raggedstatus=0 % normal left center right +\newconstant\raggedstatus % normal left center right \def\leftraggedness {2\bodyfontsize} \def\rightraggedness {2\bodyfontsize} @@ -249,7 +290,7 @@ %D More hyphenation control, will be combined with align %D setup. -\def\nohyphens +\def\nohyphens % % % % % not clever, we still hyphenate but supress application {\ifx\dohyphens\relax \edef\dohyphens {\hyphenpenalty\the\hyphenpenalty @@ -285,7 +326,7 @@ \updateraggedskips} \def\dosetraggedskips#1#2#3#4#5#6#7% - {\chardef \raggedstatus#1\relax + {\raggedstatus#1\relax \leftskip 1\leftskip \!!plus#2\relax % zie: Tex By Topic 8.1.3 \rightskip 1\rightskip\!!plus#3\relax % zie: Tex By Topic 8.1.3 \spaceskip #4\relax @@ -325,7 +366,7 @@ \begingroup \dontshowcomposition \inleftmargin{\vsmash - {\switchtobodyfont[7pt,tt]% + {\infofont \framed[\c!align=\v!right]{\thepardata}}}% \endgroup} @@ -347,7 +388,7 @@ \def\raggedxspaceamount {.5em} \unexpanded\def\notragged - {\chardef\raggedstatus\zerocount + {\raggedstatus\zerocount \leftskip 1\leftskip \rightskip 1\rightskip \spaceskip \zeropoint @@ -433,6 +474,11 @@ \setvalue{@@ngila@@\v!broad }{\!!doneatrue} \setvalue{@@ngila@@\v!wide }{\!!donebtrue} +\def\setraggedparagraphmode + {\doifrightpageelse + {\ifdoublesided\signalinnerrealign\expandafter\firstoftwoarguments \fi} + {\ifdoublesided\signalouterrealign\expandafter\secondoftwoarguments\fi}} + \def\installalign#1#2{\setvalue{@@align@@#1}{#2}} % can be used for overloads \installalign \v!new {\@@asraggedfalse} @@ -504,6 +550,8 @@ \def\dosetupalign[#1]% can be made faster by checking for defined #1 {\!!doneafalse \!!donebfalse + \raggedstatus\zerocount + \resetrealignsignal \processcommacommand[#1]\dodosetupngila \processcommacommand[#1]\dodosetupalign} @@ -524,7 +572,7 @@ {\par \egroup} -\chardef\alignstrutmode=1 +\setnewconstant\alignstrutmode\plusone % see later for the real definition, which in the simple case is: @@ -568,7 +616,7 @@ \let\centeraligned\midaligned -\def\regelbegrensd#1{\limitatetext{#1}{\hsize}{\unknown}} % to be translated +% \def\regelbegrensd#1{\limitatetext{#1}{\hsize}{\unknown}} % to be translated % indirecte commando's @@ -579,9 +627,10 @@ \letvalue{\s!do\v!line\v!flushright}\leftaligned \letvalue{\s!do\v!line\v!center }\midaligned -\def\doalignedline#1{\csname\s!do\v!line#1\endcsname} +\def\doalignedline#1{\resetrealignsignal\csname\s!do\v!line#1\endcsname} -%D Experimental: +%D Experimental (will be redone when floats are redone as it's real messy +%D now): \def\doxalignline#1#2#3#4#5#6% {\noindentation % was \noindent @@ -602,7 +651,7 @@ \endgroup} \hbox} -\def\doxcheckline +\def\doxcheckline % used for floats so multipass anyway {\signalrightpage\doifrightpageelse\donetrue\donefalse} \setvalue{\s!do\v!line\v!inner }{\doxalignline\doxcheckline++\zeropoint \relax\hss } @@ -630,9 +679,6 @@ \def\alignedline#1#2% setting default {\csname\s!do\v!line\ifcsname\s!do\v!line#1\endcsname#1\else#2\fi\endcsname} -% \def\woordrechts -% {\groupedcommand{\hfill\hbox}{\parfillskip\zeropoint}} - % beware: \wordright{whatever\kern-\rightskip} should work! % so, no funny boxing here @@ -666,12 +712,35 @@ % \simplealignedbox{2cm}{right}{x} -\setvalue{\s!simple\c!align\v!right }#1#2{\hbox to #1{#2\hss}} -\setvalue{\s!simple\c!align\v!left }#1#2{\hbox to #1{\hss#2}} -\setvalue{\s!simple\c!align\v!flushright }#1#2{\hbox to #1{\hss#2}} -\setvalue{\s!simple\c!align\v!flushleft }#1#2{\hbox to #1{#2\hss}} -\setvalue{\s!simple\c!align\v!middle }#1#2{\hbox to #1{\hss#2\hss}} - -\unexpanded\def\simplealignedbox#1{\executeifdefined{\s!simple\c!align#1}{\getvalue{\s!simple\c!align\v!right}}} +% \setvalue{\s!simple\c!align\v!right }#1#2{\hbox to #1{#2\hss}} +% \setvalue{\s!simple\c!align\v!left }#1#2{\hbox to #1{\hss#2}} +% \setvalue{\s!simple\c!align\v!flushright }#1#2{\hbox to #1{\hss#2}} +% \setvalue{\s!simple\c!align\v!flushleft }#1#2{\hbox to #1{#2\hss}} +% \setvalue{\s!simple\c!align\v!middle }#1#2{\hbox to #1{\hss#2\hss}} + +% \unexpanded\def\simplealignedbox#1% +% {\csname\s!simple\c!align\ifcsname\s!simple\c!align#1\endcsname#1\else\v!right\fi\endcsname} + +\setvalue{\s!simple:\c!align:\v!right }#1{{#1\hss}} +\setvalue{\s!simple:\c!align:\v!left }#1{{\hss#1}} +\setvalue{\s!simple:\c!align:\v!flushright }#1{{\hss#1}} +\setvalue{\s!simple:\c!align:\v!flushleft }#1{{#1\hss}} +\setvalue{\s!simple:\c!align:\v!middle }#1{{\hss#1\hss}} + +\unexpanded\def\simplealignedbox#1#2% + {\hbox to #1\csname\s!simple:\c!align:\ifcsname\s!simple:\c!align:#2\endcsname#2\else\v!right\fi\endcsname} + +% \setvalue{spac_align_set_ss_\v!right }#1#2{\let#1\relax\let#2\hss } +% \setvalue{spac_align_set_ss_\v!left }#1#2{\let#1\hss \let#2\relax} +% \setvalue{spac_align_set_ss_\v!flushright}#1#2{\let#1\hss \let#2\relax} +% \setvalue{spac_align_set_ss_\v!flushleft }#1#2{\let#1\relax\let#2\hss } +% \setvalue{spac_align_set_ss_\v!middle }#1#2{\let#1\hss \let#2\hss } +% \setvalue{spac_align_set_ss_\v!low }#1#2{\let#1\vss \let#2\relax} +% \setvalue{spac_align_set_ss_\v!high }#1#2{\let#1\relax\let#2\vss } +% \setvalue{spac_align_set_ss_\v!lohi }#1#2{\let#1\vss \let#2\vss } +% \setvalue{spac_align_set_ss_\s!unknown }#1#2{\let#1\relax\let#2\relax} + +% \unexpanded\def\spac_align_set_ss#1% +% {\csname spac_align_set_ss_\ifcsname spac_align_set_ss_#1\endcsname#1\else\s!unknown\fi\endcsname} \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/spac-gen.mkii b/Master/texmf-dist/tex/context/base/spac-gen.mkii index 8274db1b925..4e7b3810c5f 100644 --- a/Master/texmf-dist/tex/context/base/spac-gen.mkii +++ b/Master/texmf-dist/tex/context/base/spac-gen.mkii @@ -1483,6 +1483,21 @@ \fi +\unexpanded\def\textormathglue#1#2#3% cleaned up one + {\begingroup + \ifmmode + \mskip#1#2% + \else + \scratchdimen#1\hspaceamount\empty{#3}% + \scratchskip\scratchdimen\!!plus.5\scratchdimen\!!minus.3\scratchdimen + \hskip\scratchskip + \fi + \endgroup} + +\def\thinglue {\textormathglue+\thinmuskip 1} +\def\medglue {\textormathglue+\medmuskip 2} +\def\thickglue{\textormathglue+\thickmuskip3} + \ifx\eject\undefined \def\eject{\par\break} diff --git a/Master/texmf-dist/tex/context/base/spac-grd.mkiv b/Master/texmf-dist/tex/context/base/spac-grd.mkiv index bd5c51a853e..8701f4d7ee2 100644 --- a/Master/texmf-dist/tex/context/base/spac-grd.mkiv +++ b/Master/texmf-dist/tex/context/base/spac-grd.mkiv @@ -126,12 +126,12 @@ {\def\dobaselinecorrection % visualization is not watertight! {\bgroup \ifdim\prevdepth>\zeropoint\kern-\prevdepth\fi - \setbox0\null - \wd0\hsize - \dp0\strutdp + \setbox\scratchbox\emptyhbox + \wd\scratchbox\hsize + \dp\scratchbox\strutdp \nointerlineskip \forgetall - \ruledvbox{\box0}% + \ruledvbox{\box\scratchbox}% \egroup \prevdepth\strutdp}% \def\dotopbaselinecorrection @@ -208,11 +208,11 @@ %D is not needed, but I want to look the visualization as good %D as possible too. -\chardef\baselinecorrectionmode\plusone +\setnewconstant\baselinecorrectionmode\plusone -\def\onbaselinecorrection {\chardef\baselinecorrectionmode\plusone } -\def\offbaselinecorrection {\chardef\baselinecorrectionmode\plustwo } -\def\forcebaselinecorrection{\chardef\baselinecorrectionmode\plusthree} +\def\onbaselinecorrection {\baselinecorrectionmode\plusone } +\def\offbaselinecorrection {\baselinecorrectionmode\plustwo } +\def\forcebaselinecorrection{\baselinecorrectionmode\plusthree} %D \macros %D {topbaselinecorrection,botbaselinecorrection} @@ -228,7 +228,7 @@ {\ifvmode \bgroup \setbaselinecorrections - \whitespace + \whitespace % no longer ok \nointerlineskip \dotopbaselinecorrection \egroup @@ -246,11 +246,57 @@ \let\forcedbotbaselinecorrection\botbaselinecorrection +% experiment, todo: proper mkiv mechanism +% +% \input ward \par +% \startframedtext test \stopframedtext +% \input ward \par +% \startlinecorrection \framed{xxx} \stoplinecorrection +% \input ward \par +% +% \setupwhitespace[big] +% +% \input ward \par +% \startframedtext test \stopframedtext +% \input ward \par +% \startlinecorrection \framed{xxx} \stoplinecorrection +% \input ward \par + +\def\dotopbaselinecorrection {\blank[\thetopbaselinecorrection ]} +\def\dobotbaselinecorrection {\blank[\thebotbaselinecorrection ]} +\def\donegtopbaselinecorrection{\blank[\thenegtopbaselinecorrection]} +\def\donegbotbaselinecorrection{\blank[\thenegbotbaselinecorrection]} + +% nointerlineskip +% +% startpacked +% \startlinecorrection \framed{test} \stoplinecorrection +% \startlinecorrection \framed{test} \stoplinecorrection +% \stoppacked + +\def\forcedtopbaselinecorrection + {\ifvmode + \bgroup + \setbaselinecorrections + \vspacing[white] +% \nointerlineskip % + \dotopbaselinecorrection + \egroup +\fi} + +\def\dobaselinecorrection + {\ifdim\prevdepth>\zeropoint + \vspacing[\the\dimexpr-\prevdepth+\strutdp\relax]% + \else + \vspacing[\the\dimexpr\strutdp\relax]% + \fi + \prevdepth\strutdp} + \let\normalstartbaselinecorrection\startbaselinecorrection \unexpanded\def\startbaselinecorrection {\ifgridsnapping - \snaptogrid[v!normal]\vbox\bgroup + \snaptogrid[\v!normal]\vbox\bgroup \let\stopbaselinecorrection\egroup \else \normalstartbaselinecorrection diff --git a/Master/texmf-dist/tex/context/base/spac-hor.lua b/Master/texmf-dist/tex/context/base/spac-hor.lua index 6cb6e3f497b..09920bd4647 100644 --- a/Master/texmf-dist/tex/context/base/spac-hor.lua +++ b/Master/texmf-dist/tex/context/base/spac-hor.lua @@ -26,7 +26,6 @@ function commands.autonextspace(str) -- todo: use nexttoken local ch = match(str,"the letter (.)") or match(str,"the character (.)") ch = ch and chardata[utfbyte(ch)] if ch and can_have_space[ch.category] then - -- texsprint(ctxcatcodes,"\\space") -- faster context.space() end end diff --git a/Master/texmf-dist/tex/context/base/spac-hor.mkiv b/Master/texmf-dist/tex/context/base/spac-hor.mkiv index 9f902678a4c..39edaa2ff00 100644 --- a/Master/texmf-dist/tex/context/base/spac-hor.mkiv +++ b/Master/texmf-dist/tex/context/base/spac-hor.mkiv @@ -23,8 +23,9 @@ \newdimen \ctxparindent \parindent\ctxparindent % for the show -\newif \ifindentfirstparagraph \indentfirstparagraphtrue -\chardef\indentingtoggle\zerocount +\newif\ifindentfirstparagraph \indentfirstparagraphtrue + +\newconstant\indentingtogglestate %D After a blank or comparable situation (left side floats) we %D need to check if the next paragraph has to be indented. @@ -38,35 +39,46 @@ \def\checkeverypar % currently a hack {\ifzeropt\parindent\else - \doifsometokselse\everypar\donothing{\appendtoks\checkindentation\to\everypar}% + \doifsometokselse\everypar\donothing\docheckupcomingindentation \fi} +\def\docheckupcomingindentation + {\appendtoks\checkindentation\to\everypar} + \definecomplexorsimple\setupindenting \def\complexsetupindenting[#1]% {\edef\currentindenting{#1}% - \doifsomething\currentindenting % handy when a parameter is passed - {% not here: \indentfirstparagraphtrue - % not here: \parindent\ctxparindent - % not here: \chardef\indentingtoggle\zerocount - % we use commacommand in order to catch #1 being a command (expanded parameter) - \processcommacommand[\currentindenting]\docomplexsetupindentingA % catch small, medium, etc - \processcommacommand[\currentindenting]\docomplexsetupindentingB % catch rest - \checkeverypar % only when non-empty #1 - \ifindentfirstparagraph\else\noindentation\fi % added - \toggleindentation}} + \ifx\currentindenting\empty \else + \doapplycurrentindenting + \fi} + +\def\doapplycurrentindenting + {% not here: \indentfirstparagraphtrue + % not here: \parindent\ctxparindent + % not here: \indentingtogglestate\zerocount + % we use commacommand in order to catch #1 being a command (expanded parameter) + \processcommacommand[\currentindenting]\docomplexsetupindentingA % catch small, medium, etc + \processcommacommand[\currentindenting]\docomplexsetupindentingB % catch rest + \checkeverypar % only when non-empty #1 + \ifindentfirstparagraph\else\noindentation\fi % added + \toggleindentation} \def\docomplexsetupindentingA#1% - {\edefconvertedargument\!!stringa{#1}% can this be done differently now? - \ifcsname\??in:\!!stringa\endcsname \else + {\ifcsname\??in:#1\endcsname + % case b + \else \edef\currentindentation{#1}% \let\normalindentation\currentindentation \simplesetupindenting \fi} \def\docomplexsetupindentingB#1% - {\edefconvertedargument\!!stringa{#1}% catch #1=\somedimen - \executeifdefined{\??in:\!!stringa}\donothing} + {\ifcsname\??in:#1\endcsname + \csname\??in:#1\endcsname + \else + % case a + \fi} \def\simplesetupindenting % empty case, a it strange, needed this way? {\assigndimension\currentindentation\ctxparindent{1em}{1.5em}{2em}} @@ -89,10 +101,10 @@ \defineindentingmethod [\v!always] {\parindent\ctxparindent\relax} % no \indent ! \defineindentingmethod [\v!never] {\parindent\zeropoint\relax % no \indent ! - \chardef\indentingtoggle\zerocount} + \indentingtogglestate\zerocount} -\defineindentingmethod [\v!odd] {\chardef\indentingtoggle\plusone} -\defineindentingmethod [\v!even] {\chardef\indentingtoggle\plustwo} +\defineindentingmethod [\v!odd] {\indentingtogglestate\plusone} +\defineindentingmethod [\v!even] {\indentingtogglestate\plustwo} \defineindentingmethod [\v!normal] {\ifx\normalindentation\empty\else \let\currentindentation\normalindentation @@ -101,7 +113,7 @@ \defineindentingmethod [\v!reset] {\indentfirstparagraphtrue \parindent\zeropoint - \chardef\indentingtoggle\zerocount} + \indentingtogglestate\zerocount} \def\noindenting{\indenting[\v!no, \v!next ]} \def\doindenting{\indenting[\v!yes,\v!first]} @@ -159,7 +171,7 @@ \fi \fi} \def\toggleindentation % does not play well with noindentation - {\ifcase\indentingtoggle + {\ifcase\indentingtogglestate % nothing \or \notoggleindentation @@ -186,27 +198,15 @@ \popmacro\checkindentation \to \everypopsomestate -% we need to save the state if we want to adapt behaviour to empty lines -% -% \def\setlasthvmode -% {\global\chardef\savedhvmode\ifhmode\plusone\else\ifvmode\plustwo\else\zerocount\fi\fi} -% -% \def\resetlasthvmode -% {\global\chardef\savedhvmode\zerocount} -% -% \chardef\savedhvmode\zerocount - % This is a user requested hack (using the auto-hook). -\chardef\recheckindentationmode\zerocount +\newconditional\recheckindentationmode \def\dontrechecknextindentation - {\global\chardef\recheckindentationmode\zerocount} + {\global\setfalse\recheckindentationmode} \def\dorechecknextindentation - {\ifcase\recheckindentationmode - % nothing - \or + {\ifconditional\recheckindentationmode \dontrechecknextindentation \expandafter\doautoindentation \fi} @@ -215,7 +215,7 @@ {\doifnextcharelse\par\donothing\noindentation} \def\autoindentation - {\global\chardef\recheckindentationmode\plusone} + {\global\settrue\recheckindentationmode} %D An example of usage: %D @@ -260,7 +260,7 @@ %D \macros %D {frenchspacing,nonfrenchspacing} %D -%D Smehow \type{\frenchspacing} can lead to hyphenation between +%D Somehow \type{\frenchspacing} can lead to hyphenation between %D dashes so we now have \type {\newfrenchspacing} (moved from %D \type {syst-chr}). @@ -339,7 +339,7 @@ \unexpanded\def\nonbreakablespace{\penalty\plustenthousand\normalspaceprimitive} % no space in math -\letcatcodecommand \ctxcatcodes `\~ \nonbreakablespace % overloaded later +\letcatcodecommand \ctxcatcodes \tildeasciicode \nonbreakablespace % overloaded later \def\space { } \def\removelastspace{\ifhmode\unskip\fi} @@ -347,8 +347,8 @@ \ifdefined\softhyphen \else \let\softhyphen\- \fi -\ctxlua{tex.sprint(tex.ctxcatcodes,"\string\\unexpanded\string\\def\string\\\string\n{\string\\space}")} -% \ctxlua{tex.sprint(tex.ctxcatcodes,"\string\\let\string\\\string\n=\string\\space")} +\ctxsprint{"\string\\unexpanded\string\\def\string\\\string\n{\string\\space}"} +%ctxsprint{"\string\\let\string\\\string\n=\string\\space"} % in tables we need: % @@ -361,7 +361,7 @@ \hskip\wd\scratchbox\relax} \def\fixedspaces - {\letcatcodecommand \ctxcatcodes `\~ \fixedspace} + {\letcatcodecommand \ctxcatcodes \tildeasciicode \fixedspace} \appendtoks \let~\space @@ -590,14 +590,6 @@ \newskip\leftskipadaption \newskip\rightskipadaption -\def\doadaptleftskip#1% - {\dosetleftskipadaption{#1}% - \advance\leftskip \leftskipadaption} - -\def\doadaptrightskip#1% - {\dosetrightskipadaption{#1}% - \advance\rightskip \rightskipadaption} - \setvalue{@lsa@\v!standard}{\ifdim\ctxparindent=\zeropoint\@@slleft\else\ctxparindent\fi} \setvalue{@lsa@\v!yes }{\ifdim\ctxparindent=\zeropoint\@@slleft\else\ctxparindent\fi} \letvalue{@lsa@\v!no }\zeropoint @@ -607,25 +599,11 @@ \letvalue{@rsa@\v!no }\zeropoint \letvalue{@rsa@\empty }\zeropoint -\def\dosetleftskipadaption#1% - {\edefconvertedargument\ascii{@lsa@#1}% - \leftskipadaption - \ifcsname\ascii\endcsname - \csname\ascii\endcsname - \else - #1% - \fi - \relax} - -\def\dosetrightskipadaption#1% - {\edefconvertedargument\ascii{@rsa@#1}% - \rightskipadaption - \ifcsname\ascii\endcsname - \csname\ascii\endcsname - \else - #1% - \fi - \relax} +\def\dosetleftskipadaption #1{\leftskipadaption \ifcsname @lsa@#1\endcsname\csname @lsa@#1\endcsname\else#1\fi\relax} +\def\dosetrightskipadaption#1{\rightskipadaption\ifcsname @rsa@#1\endcsname\csname @rsa@#1\endcsname\else#1\fi\relax} + +\def\doadaptleftskip #1{\dosetleftskipadaption {#1}\advance\leftskip \leftskipadaption } +\def\doadaptrightskip#1{\dosetrightskipadaption{#1}\advance\rightskip\rightskipadaption} %D Tolerance: @@ -910,7 +888,7 @@ \normalspaces % to be sure \to \everybeforeoutput -%D A more robust variant ofthe \MKII\ one: +%D A more robust variant of the \MKII\ one: %D %D \startbuffer %D bla \TEX\autoinsertnextspace bla @@ -928,7 +906,7 @@ {\futurelet\nexttoken\doautoinsertnextspace} \def\doautoinsertnextspace - {\ctxlua{commands.autonextspace("\meaning\nexttoken")}} % todo, just consult nexttoken at the lua end + {\ctxcommand{autonextspace("\meaning\nexttoken")}} % todo, just consult nexttoken at the lua end %D Moved from bib module: @@ -943,4 +921,21 @@ \chardef\zwnj="200C \chardef\zwj ="200D +% TODO (but used in languages): + +\unexpanded\def\textormathglue#1#2#3% cleaned up one + {\begingroup + \ifmmode + \mskip#1#2% + \else + \scratchdimen#1\hspaceamount\empty{#3}% + \scratchskip\scratchdimen\!!plus.5\scratchdimen\!!minus.3\scratchdimen + \hskip\scratchskip + \fi + \endgroup} + +\def\thinglue {\textormathglue+\thinmuskip 1} +\def\medglue {\textormathglue+\medmuskip 2} +\def\thickglue{\textormathglue+\thickmuskip3} + \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/spac-pag.mkiv b/Master/texmf-dist/tex/context/base/spac-pag.mkiv index 353afa5363f..9babab29a27 100644 --- a/Master/texmf-dist/tex/context/base/spac-pag.mkiv +++ b/Master/texmf-dist/tex/context/base/spac-pag.mkiv @@ -25,10 +25,10 @@ \def\setalignmentswitch#1% {\chardef\alignmentswitch0\csname\??as#1\endcsname\relax} -\newcount \noftrackedpagestates -\newif \ifpagestatemismatch -\newcount \realpagestateno -\chardef \frozenpagestate \zerocount +\newcount \noftrackedpagestates +\newif \ifpagestatemismatch +\newcount \realpagestateno +\newconstant\frozenpagestate \def\dotrackpagestate#1#2% {\ifdoublesided \ifinpagebody \else @@ -113,8 +113,8 @@ \@EA\secondoftwoarguments \fi} -\def\freezepagestate {\chardef\frozenpagestate\plusone } -\def\defrostpagestate{\chardef\frozenpagestate\zerocount} +\def\freezepagestate {\frozenpagestate\plusone } +\def\defrostpagestate{\frozenpagestate\zerocount} % we can make more of these on top, but how to deal with mixed frozen states @@ -138,8 +138,8 @@ {\ifcase\pagesignallevel\or\postsignalrightpage\fi \advance\pagesignallevel\minusone} -\def\setraggedparagraphmode - {\signalrightpage\doifrightpageelse} % move it there +% \def\setraggedparagraphmode +% {\signalrightpage\doifrightpageelse} % move it there \ifx\swapmargins\undefined \let\swapmargins\undefined \fi % todo diff --git a/Master/texmf-dist/tex/context/base/spac-par.lua b/Master/texmf-dist/tex/context/base/spac-par.lua new file mode 100644 index 00000000000..f695e11e92f --- /dev/null +++ b/Master/texmf-dist/tex/context/base/spac-par.lua @@ -0,0 +1,59 @@ +if not modules then modules = { } end modules ['spac-par'] = { + version = 1.001, + comment = "companion to spac-par.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- sort of obsolete code + +local attribute = attributes.private('graphicvadjust') + +local nodecodes = nodes.nodecodes + +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist + +local remove_node = nodes.remove +local hpack_node = node.hpack +local vpack_node = node.vpack +local has_attribute = node.has_attribute + +function nodes.handlers.graphicvadjust(head,groupcode) -- we can make an actionchain for mvl only + if groupcode == "" then -- mvl only + local h, p, done = head, nil, false + while h do + local id = h.id + if id == hlist_code or id == vlist_code then + local a = has_attribute(h,attribute) + if a then + if p then + local n + head, h, n = remove_node(head,h) + local pl = p.list + if n.width ~= 0 then + n = hpack_node(n,0,'exactly') -- todo: dir + end + if pl then + pl.prev = n + n.next = pl + end + p.list = n + done = true + else + -- can't happen + end + else + p = h + h = h.next + end + else + h = h.next + end + end + return head, done + else + return head, false + end +end diff --git a/Master/texmf-dist/tex/context/base/spac-par.mkiv b/Master/texmf-dist/tex/context/base/spac-par.mkiv index 3477b1c1b14..222f4fd2c20 100644 --- a/Master/texmf-dist/tex/context/base/spac-par.mkiv +++ b/Master/texmf-dist/tex/context/base/spac-par.mkiv @@ -52,7 +52,7 @@ \newtoks\everynextparagraphintro \newtoks\@@everyparagraphtoks -\chardef\everyparagraphintro\zerocount +\newconstant\everyparagraphintrostate \unexpanded\def\setupparagraphintro {\dodoubleempty\dosetupparagraphintro} @@ -60,14 +60,14 @@ \def\dosetupparagraphintro[#1][#2]% {\processallactionsinset [#1] - [ \v!reset=>\global\chardef\everyparagraphintro\zerocount + [ \v!reset=>\global\everyparagraphintrostate\zerocount \global\everyfirstparagraphintro\emptytoks \global\everynextparagraphintro \emptytoks, - \v!first=>\global\chardef\everyparagraphintro\plusone + \v!first=>\global\everyparagraphintrostate\plusone \doglobal\appendtoks#2\to\everyfirstparagraphintro, - \v!next=>\ifcase\everyparagraphintro\global\chardef\everyparagraphintro\plusone\fi + \v!next=>\ifcase\everyparagraphintrostate\global\everyparagraphintrostate\plusone\fi \doglobal\appendtoks#2\to\everynextparagraphintro, - \v!each=>\ifcase\everyparagraphintro\global\chardef\everyparagraphintro\plustwo\fi + \v!each=>\ifcase\everyparagraphintrostate\global\everyparagraphintrostate\plustwo\fi \doglobal\appendtoks#2\to\everyfirstparagraphintro \doglobal\appendtoks#2\to\everynextparagraphintro]} @@ -84,22 +84,22 @@ %D \stoptyping \def\flushatparagraph#1% - {\global\chardef\everyparagraphintro\plusone + {\global\everyparagraphintrostate\plusone \global\appendtoks{#1}\to\everyfirstparagraphintro \global\let\insertparagraphintro\doinsertparagraphintro} \def\doinsertparagraphintro % can be merged with the next - {\ifcase\everyparagraphintro\else\@EA\dodoinsertparagraphintro\fi} + {\ifcase\everyparagraphintrostate\else\@EA\dodoinsertparagraphintro\fi} \def\dodoinsertparagraphintro {\begingroup \everypar\emptytoks - \ifcase\everyparagraphintro\relax + \ifcase\everyparagraphintrostate\relax % no data \@@everyparagraphtoks\emptytoks \or % first data - \global\chardef\everyparagraphintro\plustwo + \global\everyparagraphintrostate\plustwo \@@everyparagraphtoks\everyfirstparagraphintro \global\everyfirstparagraphintro\emptytoks \or @@ -156,10 +156,19 @@ % Very nasty but needed for margin stuff inside colored % paragraphs. +\registerctxluafile{spac-par}{1.001} + +\definesystemattribute [graphicvadjust] [public] + \let\normalvadjust\vadjust -\def\graphicvadjust % nasty bidi handling - {\dowithnextboxcontent +\def\enablegraphicvadjust + {\ctxlua{nodes.tasks.enableaction("finalizers","nodes.handlers.graphicvadjust")}% + \glet\enablegraphicvadjust\relax} + +\def\graphicvadjust % currently not enabled; nasty bidi handling + {\enablegraphicvadjust + \dowithnextboxcontent {\forgetall} {\vadjust{\vbox attr \graphicvadjustattribute \plusone {\unvbox\nextbox diff --git a/Master/texmf-dist/tex/context/base/spac-ver.lua b/Master/texmf-dist/tex/context/base/spac-ver.lua index c75eb1baa68..83ee6e49208 100644 --- a/Master/texmf-dist/tex/context/base/spac-ver.lua +++ b/Master/texmf-dist/tex/context/base/spac-ver.lua @@ -20,69 +20,89 @@ if not modules then modules = { } end modules ['spac-ver'] = { -- todo: strip baselineskip around display math local next, type, tonumber = next, type, tonumber -local format, gmatch, concat, match = string.format, string.gmatch, table.concat, string.match -local ceil, floor, max, min, round = math.ceil, math.floor, math.max, math.min, math.round -local texsprint, texlists, texdimen, texbox = tex.sprint, tex.lists, tex.dimen, tex.box +local format, gmatch, concat, match, rep = string.format, string.gmatch, table.concat, string.match, string.rep +local ceil, floor, max, min, round, abs = math.ceil, math.floor, math.max, math.min, math.round, math.abs +local texlists, texdimen, texbox = tex.lists, tex.dimen, tex.box local lpegmatch = lpeg.match local unpack = unpack or table.unpack +local points = number.points +local allocate = utilities.storage.allocate -local ctxcatcodes = tex.ctxcatcodes -local variables = interfaces.variables +local P, C, R, S, Cc = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cc -local starttiming, stoptiming = statistics.starttiming, statistics.stoptiming +local nodes, node, trackers, attributes, context = nodes, node, trackers, attributes, context + +local variables = interfaces.variables + +local starttiming = statistics.starttiming +local stoptiming = statistics.stoptiming -- vertical space handler -local trace_vbox_vspacing = false trackers.register("nodes.vbox_vspacing", function(v) trace_vbox_vspacing = v end) -local trace_page_vspacing = false trackers.register("nodes.page_vspacing", function(v) trace_page_vspacing = v end) -local trace_collect_vspacing = false trackers.register("nodes.collect_vspacing", function(v) trace_collect_vspacing = v end) -local trace_vspacing = false trackers.register("nodes.vspacing", function(v) trace_vspacing = v end) -local trace_vsnapping = false trackers.register("nodes.vsnapping", function(v) trace_vsnapping = v end) - -local skip_category = attributes.private('skip-category') -local skip_penalty = attributes.private('skip-penalty') -local skip_order = attributes.private('skip-order') -local snap_category = attributes.private('snap-category') -local display_math = attributes.private('display-math') -local snap_method = attributes.private('snap-method') -local snap_done = attributes.private('snap-done') - -local has_attribute = node.has_attribute -local unset_attribute = node.unset_attribute -local set_attribute = node.set_attribute -local find_node_tail = node.tail -local free_node = node.free -local copy_node = node.copy -local traverse_nodes = node.traverse -local traverse_nodes_id = node.traverse_id -local insert_node_before = node.insert_before -local insert_node_after = node.insert_after -local remove_node = nodes.remove -local make_penalty_node = nodes.penalty -local make_kern_node = nodes.kern -local make_rule_node = nodes.rule -local count_nodes = nodes.count -local node_ids_to_string = nodes.ids_to_string -local hpack_node = node.hpack -local vpack_node = node.vpack -local writable_spec = nodes.writable_spec - -local glyph = node.id("glyph") -local penalty = node.id("penalty") -local kern = node.id("kern") -local glue = node.id('glue') -local hlist = node.id('hlist') -local vlist = node.id('vlist') -local adjust = node.id('adjust') - -vspacing = vspacing or { } -vspacing.data = vspacing.data or { } +local trace_vbox_vspacing = false trackers.register("builders.vbox_vspacing", function(v) trace_vbox_vspacing = v end) +local trace_page_vspacing = false trackers.register("builders.page_vspacing", function(v) trace_page_vspacing = v end) +local trace_collect_vspacing = false trackers.register("builders.collect_vspacing", function(v) trace_collect_vspacing = v end) +local trace_vspacing = false trackers.register("builders.vspacing", function(v) trace_vspacing = v end) +local trace_vsnapping = false trackers.register("builders.vsnapping", function(v) trace_vsnapping = v end) +local trace_vpacking = false trackers.register("builders.vpacking", function(v) trace_vpacking = v end) + +local report_vspacing = logs.reporter("vspacing","spacing") +local report_collapser = logs.reporter("vspacing","collapsing") +local report_snapper = logs.reporter("vspacing","snapping") + +local a_skipcategory = attributes.private('skipcategory') +local a_skippenalty = attributes.private('skippenalty') +local a_skiporder = attributes.private('skiporder') +----- snap_category = attributes.private('snapcategory') +local a_snapmethod = attributes.private('snapmethod') +local a_snapvbox = attributes.private('snapvbox') + +local has_attribute = node.has_attribute +local unset_attribute = node.unset_attribute +local set_attribute = node.set_attribute +local find_node_tail = node.tail +local free_node = node.free +local copy_node = node.copy +local traverse_nodes = node.traverse +local traverse_nodes_id = node.traverse_id +local insert_node_before = node.insert_before +local insert_node_after = node.insert_after +local remove_node = nodes.remove +local count_nodes = nodes.count +local nodeidstostring = nodes.idstostring +local hpack_node = node.hpack +local vpack_node = node.vpack +local writable_spec = nodes.writable_spec +local listtoutf = nodes.listtoutf + +local nodepool = nodes.pool + +local new_penalty = nodepool.penalty +local new_kern = nodepool.kern +local new_rule = nodepool.rule +local new_gluespec = nodepool.gluespec + +local nodecodes = nodes.nodecodes +local skipcodes = nodes.skipcodes +local fillcodes = nodes.fillcodes + +local penalty_code = nodecodes.penalty +local kern_code = nodecodes.kern +local glue_code = nodecodes.glue +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist +local whatsit_code = nodecodes.whatsit + +local userskip_code = skipcodes.userskip + +builders.vspacing = builders.vspacing or { } +local vspacing = builders.vspacing +vspacing.data = vspacing.data or { } vspacing.data.snapmethods = vspacing.data.snapmethods or { } +local snapmethods = vspacing.data.snapmethods --maybe some older code can go -storage.register("vspacing/data/snapmethods", vspacing.data.snapmethods, "vspacing.data.snapmethods") - -local snapmethods = vspacing.data.snapmethods --maybe some older code can go +storage.register("builders/vspacing/data/snapmethods", snapmethods, "builders.vspacing.data.snapmethods") local default = { maxheight = true, @@ -144,7 +164,7 @@ local function listtohash(str) end end -function vspacing.define_snap_method(name,method) +function vspacing.definesnapmethod(name,method) local n = #snapmethods + 1 local t = listtohash(method) snapmethods[n] = t @@ -152,8 +172,8 @@ function vspacing.define_snap_method(name,method) tex.write(n) end ---~ local rule_id = node.id("rule") ---~ local vlist_id = node.id("vlist") +--~ local rule_id = nodecodes.rule +--~ local vlist_id = nodecodes.vlist --~ function nodes.makevtop(n) --~ if n.id == vlist_id then --~ local list = n.list @@ -163,14 +183,111 @@ end --~ end --~ end -local function snap_hlist(current,method,height,depth) -- method.strut is default - local snapht, snapdp +local reference = nodes.reference + +local function validvbox(parentid,list) + if parentid == hlist_code then + local id = list.id + if id == whatsit_code then -- check for initial par subtype + list = list.next + if not next then + return nil + end + end + local done = nil + for n in traverse_nodes(list) do + local id = n.id + if id == vlist_code or id == hlist_code then + if done then + return nil + else + done = n + end + elseif id == penalty_code or id == glue_code then + -- go on + else + return nil -- whatever + end + end + if done and done.id == hlist_code then + return validvbox(done.id,done.list) + end + return done -- only one vbox + end +end + +local function already_done(parentid,list,a_snapmethod) -- todo: done when only boxes and all snapped + -- problem: any snapped vbox ends up in a line + if list and parentid == hlist_code then + local id = list.id + if id == whatsit_code then -- check for initial par subtype + list = list.next + if not next then + return false + end + end +--~ local i = 0 + for n in traverse_nodes(list) do + local id = n.id +--~ i = i + 1 print(i,nodecodes[id],has_attribute(n,a_snapmethod)) + if id == hlist_code or id == vlist_code then + local a = has_attribute(n,a_snapmethod) + if not a then + -- return true -- not snapped at all + elseif a == 0 then + return true -- already snapped + end + elseif id == penalty_code or id == glue_code then -- whatsit is weak spot + -- go on + else + return false -- whatever + end + end + end + return false +end + + +-- quite tricky: ceil(-something) => -0 + +local function ceiled(n) + if n < 0 or n < 0.01 then + return 0 + else + return ceil(n) + end +end + +local function floored(n) + if n < 0 or n < 0.01 then + return 0 + else + return floor(n) + end +end + +local function snap_hlist(where,current,method,height,depth) -- method.strut is default + local list = current.list --~ print(table.serialize(method)) + local t = trace_vsnapping and { } + if t then + t[#t+1] = format("list content: %s",nodes.toutf(list)) + t[#t+1] = format("parent id: %s",reference(current)) + t[#t+1] = format("snap method: %s",method.name) + t[#t+1] = format("specification: %s",method.specification) + end + local snapht, snapdp if method["local"] then -- snapping is done immediately here snapht, snapdp = texdimen.bodyfontstrutheight, texdimen.bodyfontstrutdepth + if t then + t[#t+1] = format("local: snapht %s snapdp %s",points(snapht),points(snapdp)) + end elseif method["global"] then snapht, snapdp = texdimen.globalbodyfontstrutheight, texdimen.globalbodyfontstrutdepth + if t then + t[#t+1] = format("global: snapht %s snapdp %s",points(snapht),points(snapdp)) + end else -- maybe autolocal -- snapping might happen later in the otr @@ -179,110 +296,207 @@ local function snap_hlist(current,method,height,depth) -- method.strut is defaul if snapht ~= lsnapht and snapdp ~= lsnapdp then snapht, snapdp = lsnapht, lsnapdp end + if t then + t[#t+1] = format("auto: snapht %s snapdp %s",points(snapht),points(snapdp)) + end end local h, d = height or current.height, depth or current.depth local hr, dr, ch, cd = method.hfraction or 1, method.dfraction or 1, h, d local tlines, blines = method.tlines or 1, method.blines or 1 local done, plusht, plusdp = false, snapht, snapdp local snaphtdp = snapht + snapdp + if method.none then plusht, plusdp = 0, 0 + if t then + t[#t+1] = format("none: plusht 0pt plusdp 0pt") + end end - if method.halfline then + if method.halfline then -- extra halfline plusht, plusdp = plusht + snaphtdp/2, plusdp + snaphtdp/2 + if t then + t[#t+1] = format("halfline: plusht %s plusdp %s",points(plusht),points(plusdp)) + end end - if method.line then + if method.line then -- extra line plusht, plusdp = plusht + snaphtdp, plusdp + snaphtdp + if t then + t[#t+1] = format("line: plusht %s plusdp %s",points(plusht),points(plusdp)) + end end if method.first then - if current.id == vlist then - local list, lh, ld = current.list - for n in traverse_nodes_id(hlist,list) do + local thebox = current + local id = thebox.id + if id == hlist_code then + thebox = validvbox(id,thebox.list) + id = thebox and thebox.id + end + if thebox and id == vlist_code then + local list, lh, ld = thebox.list + for n in traverse_nodes_id(hlist_code,list) do lh, ld = n.height, n.depth break end if lh then - local x = max(ceil((lh-hr*snapht)/snaphtdp),0)*snaphtdp + plusht - local n = make_kern_node(x-lh) - n.next, list.prev, current.list = list, n, n - ch = x + snaphtdp - cd = max(ceil((d+h-lh-dr*snapdp-hr*snapht)/snaphtdp),0)*snaphtdp + plusdp + local ht, dp = thebox.height, thebox.depth + if t then + t[#t+1] = format("first line: height %s depth %s",points(lh),points(ld)) + t[#t+1] = format("dimensions: height %s depth %s",points(ht),points(dp)) + end + local delta = h - lh + ch, cd = lh, delta + d +--~ ch = ch + plusht +--~ cd = cd + plusdp +h, d = ch, cd + local shifted = hpack_node(current.list) + shifted.shift = delta + current.list = shifted done = true + if t then + t[#t+1] = format("first: height %s depth %s shift %s",points(ch),points(cd),points(delta)) + end + elseif t then + t[#t+1] = "first: not done, no content" end + elseif t then + t[#t+1] = "first: not done, no vbox" end elseif method.last then - if current.id == vlist then - local list, lh, ld = current.list - for n in traverse_nodes_id(hlist,list) do + local thebox = current + local id = thebox.id + if id == hlist_code then + thebox = validvbox(id,thebox.list) + id = thebox and thebox.id + end + if thebox and id == vlist_code then + local list, lh, ld = thebox.list + for n in traverse_nodes_id(hlist_code,list) do lh, ld = n.height, n.depth end if lh then - local baseline_till_top = h + d - ld - local x = max(ceil((baseline_till_top-hr*snapht)/snaphtdp),0)*snaphtdp + plusht - local n = make_kern_node(x-baseline_till_top) - n.next, list.prev, current.list = list, n, n - ch = x - cd = max(ceil((ld-dr*snapdp)/snaphtdp),0)*snaphtdp + plusdp + local ht, dp = thebox.height, thebox.depth + if t then + t[#t+1] = format("last line: height %s depth %s",points(lh),points(ld)) + t[#t+1] = format("dimensions: height %s depth %s",points(ht),points(dp)) + end + local delta = d - ld + cd, ch = ld, delta + h +--~ ch = ch + plusht +--~ cd = cd + plusdp +h, d = ch, cd + local shifted = hpack_node(current.list) + shifted.shift = delta + current.list = shifted done = true + if t then + t[#t+1] = format("last: height %s depth %s shift %s",points(ch),points(cd),points(delta)) + end + elseif t then + t[#t+1] = "last: not done, no content" end + elseif t then + t[#t+1] = "last: not done, no vbox" end end - if done then - -- first or last - elseif method.minheight then - ch = max(floor((h-hr*snapht)/snaphtdp),0)*snaphtdp + plusht +--~ if done then +--~ -- first or last +--~ else + if method.minheight then + -- ch = max(floor((h-hr*snapht)/snaphtdp),0)*snaphtdp + plusht + ch = floored((h-hr*snapht)/snaphtdp)*snaphtdp + plusht + if t then + t[#t+1] = format("minheight: %s",points(ch)) + end elseif method.maxheight then - ch = max(ceil((h-hr*snapht)/snaphtdp),0)*snaphtdp + plusht + -- ch = max(ceil((h-hr*snapht)/snaphtdp),0)*snaphtdp + plusht + ch = ceiled((h-hr*snapht)/snaphtdp)*snaphtdp + plusht + if t then + t[#t+1] = format("maxheight: %s",points(ch)) + end else ch = plusht + if t then + t[#t+1] = format("set height: %s",points(ch)) + end end - if done then - -- first or last - elseif method.mindepth then - cd = max(floor((d-dr*snapdp)/snaphtdp),0)*snaphtdp + plusdp +--~ if done then +--~ -- first or last +--~ else + if method.mindepth then + -- cd = max(floor((d-dr*snapdp)/snaphtdp),0)*snaphtdp + plusdp + cd = floored((d-dr*snapdp)/snaphtdp)*snaphtdp + plusdp + if t then + t[#t+1] = format("mindepth: %s",points(cd)) + end elseif method.maxdepth then - cd = max(ceil((d-dr*snapdp)/snaphtdp),0)*snaphtdp + plusdp + -- cd = max(ceil((d-dr*snapdp)/snaphtdp),0)*snaphtdp + plusdp + cd = ceiled((d-dr*snapdp)/snaphtdp)*snaphtdp + plusdp + if t then + t[#t+1] = format("maxdepth: %s",points(cd)) + end else cd = plusdp + if t then + t[#t+1] = format("set depth: %s",points(cd)) + end end if method.top then ch = ch + tlines * snaphtdp + if t then + t[#t+1] = format("top height: %s",points(ch)) + end end if method.bottom then cd = cd + blines * snaphtdp + if t then + t[#t+1] = format("bottom depth: %s",points(cd)) + end end local offset = method.offset if offset then -- we need to set the attr - local shifted = vpack_node(current.list) + if t then + t[#t+1] = format("before offset: %s (width %s height %s depth %s)", + points(offset),points(current.width),points(current.height),points(current.depth)) + end + local shifted = hpack_node(current.list) shifted.shift = offset current.list = shifted + if t then + t[#t+1] = format("after offset: %s (width %s height %s depth %s)", + points(offset),points(current.width),points(current.height),points(current.depth)) + end + set_attribute(shifted,a_snapmethod,0) + set_attribute(current,a_snapmethod,0) end if not height then current.height = ch + if t then + t[#t+1] = format("forced height: %s",points(ch)) + end end if not depth then current.depth = cd + if t then + t[#t+1] = format("forced depth: %s",points(cd)) + end + end + local lines = (ch+cd)/snaphtdp + if t then + local original = (h+d)/snaphtdp + t[#t+1] = format("final lines: %s -> %s",original,lines) + t[#t+1] = format("final height: %s -> %s",points(h),points(ch)) + t[#t+1] = format("final depth: %s -> %s",points(d),points(cd)) + end + if t then + report_snapper("trace: %s type %s\n\t%s",where,nodecodes[current.id],concat(t,"\n\t")) end - -- set_attribute(current,snap_method,0) - return h, d, ch, cd, (ch+cd)/snaphtdp + return h, d, ch, cd, lines end ---~ local function snap_topskip(current,method) ---~ local spec = current.spec ---~ local w = spec.width ---~ local wd = w ---~ if spec then ---~ wd = 0 ---~ spec = writable_spec(current) ---~ spec.width = wd ---~ end ---~ return w, wd ---~ end - local function snap_topskip(current,method) local spec = current.spec local w = spec.width @@ -293,7 +507,7 @@ local function snap_topskip(current,method) return w, wd end -vspacing.categories = { +local categories = allocate { [0] = 'discard', [1] = 'largest', [2] = 'force' , @@ -305,7 +519,7 @@ vspacing.categories = { [8] = 'together' } -local categories = vspacing.categories +vspacing.categories = categories function vspacing.tocategories(str) local t = { } @@ -328,73 +542,68 @@ function vspacing.tocategory(str) end end -vspacing.data.map = vspacing.data.map or { } -vspacing.data.skip = vspacing.data.skip or { } +vspacing.data.map = vspacing.data.map or { } -- allocate ? +vspacing.data.skip = vspacing.data.skip or { } -- allocate ? -storage.register("vspacing/data/map", vspacing.data.map, "vspacing.data.map") -storage.register("vspacing/data/skip", vspacing.data.skip, "vspacing.data.skip") +storage.register("builders/vspacing/data/map", vspacing.data.map, "builders.vspacing.data.map") +storage.register("builders/vspacing/data/skip", vspacing.data.skip, "builders.vspacing.data.skip") do -- todo: interface.variables - local function logger(c,...) - logs.report("vspacing",concat {...}) - texsprint(c,...) - end - vspacing.fixed = false local map = vspacing.data.map local skip = vspacing.data.skip - local multiplier = lpeg.C(lpeg.S("+-")^0 * lpeg.R("09")^1) * lpeg.P("*") - local category = lpeg.P(":") * lpeg.C(lpeg.P(1)^1) - local keyword = lpeg.C((1-category)^1) - local splitter = (multiplier + lpeg.Cc(1)) * keyword * (category + lpeg.Cc(false)) + local multiplier = C(S("+-")^0 * R("09")^1) * P("*") + local category = P(":") * C(P(1)^1) + local keyword = C((1-category)^1) + local splitter = (multiplier + Cc(1)) * keyword * (category + Cc(false)) local k_fixed, k_flexible, k_category, k_penalty, k_order = variables.fixed, variables.flexible, "category", "penalty", "order" -- This will change: just node.write and we can store the values in skips which -- then obeys grouping - local function analyse(str,oldcategory,texsprint) -- we could use shorter names + local function analyze(str,oldcategory) -- we could use shorter names for s in gmatch(str,"([^ ,]+)") do local amount, keyword, detail = lpegmatch(splitter,s) if not keyword then - logs.report("vspacing","unknown directive: %s",s) + report_vspacing("unknown directive: %s",s) else local mk = map[keyword] if mk then - category = analyse(mk,category,texsprint) + category = analyze(mk,category) elseif keyword == k_fixed then - texsprint(ctxcatcodes,"\\fixedblankskip") + context.fixedblankskip() elseif keyword == k_flexible then - texsprint(ctxcatcodes,"\\flexibleblankskip") + context.flexibleblankskip() elseif keyword == k_category then local category = tonumber(detail) if category then - texsprint(ctxcatcodes,"\\setblankcategory{",category,"}") + context.setblankcategory(category) if category ~= oldcategory then - texsprint(ctxcatcodes,"\\flushblankhandling") + context.flushblankhandling() oldcategory = category end end elseif keyword == k_order and detail then local order = tonumber(detail) if order then - texsprint(ctxcatcodes,"\\setblankorder{",order,"}") + context.setblankorder(order) end elseif keyword == k_penalty and detail then local penalty = tonumber(detail) if penalty then - texsprint(ctxcatcodes,"\\setblankpenalty{",penalty,"}") + context.setblankpenalty(penalty) end else amount = tonumber(amount) or 1 local sk = skip[keyword] if sk then - texsprint(ctxcatcodes,"\\addpredefinedblankskip{",amount,"}{",keyword,"}") + context.addpredefinedblankskip(amount,keyword) else -- no check - texsprint(ctxcatcodes,"\\addaskedblankskip{",amount,"}{",keyword,"}") + context.addaskedblankskip(amount,keyword) end end end @@ -402,11 +611,16 @@ do -- todo: interface.variables return category end - function vspacing.analyse(str) - local texsprint = (trace_vspacing and logger) or texsprint - texsprint(ctxcatcodes,"\\startblankhandling") - analyse(str,1,texsprint) - texsprint(ctxcatcodes,"\\stopblankhandling") + function vspacing.analyze(str) + if trace_vspacing then + context.pushlogger(report_vspacing) + end + context.startblankhandling() + analyze(str,1) + context.stopblankhandling() + if trace_vspacing then + context.poplogger() + end end -- @@ -434,19 +648,20 @@ end local trace_list, tracing_info, before, after = { }, false, "", "" +local stripzeros, topoints = utilities.formatters.stripzeros, number.topoints + local function glue_to_string(glue) local spec = glue.spec - local t = { } - t[#t+1] = aux.strip_zeros(number.topoints(spec.width)) + local t = { points(spec.width) } if spec.stretch_order and spec.stretch_order ~= 0 then - t[#t+1] = format("plus -%sfi%s",spec.stretch/65536,string.rep("l",math.abs(spec.stretch_order)-1)) + t[#t+1] = format("plus %s%s",spec.stretch/65536,fillcodes[spec.stretch_order]) elseif spec.stretch and spec.stretch ~= 0 then - t[#t+1] = format("plus %s",aux.strip_zeros(number.topoints(spec.stretch))) + t[#t+1] = format("plus %s",stripzeros(topoints(spec.stretch))) end if spec.shrink_order and spec.shrink_order ~= 0 then - t[#t+1] = format("minus -%sfi%s",spec.shrink/65536,string.rep("l",math.abs(spec.shrink_order)-1)) + t[#t+1] = format("minus %s%s",spec.shrink/65536,fillcodes[spec.shrink_order]) elseif spec.shrink and spec.shrink ~= 0 then - t[#t+1] = format("minus %s",aux.strip_zeros(number.topoints(spec.shrink))) + t[#t+1] = format("minus %s",stripzeros(topoints(spec.shrink))) end return concat(t," ") end @@ -455,13 +670,13 @@ local function nodes_to_string(head) local current, t = head, { } while current do local id = current.id - local ty = node.type(id) - if id == penalty then + local ty = nodecodes[id] + if id == penalty_code then t[#t+1] = format("%s:%s",ty,current.penalty) - elseif id == glue then - t[#t+1] = format("%s:%s",ty,aux.strip_zeros(number.topoints(current.spec.width))) - elseif id == kern then - t[#t+1] = format("%s:%s",ty,aux.strip_zeros(number.topoints(current.kern))) + elseif id == glue_code then + t[#t+1] = format("%s:%s",ty,stripzeros(topoints(current.spec.width))) + elseif id == kern_code then + t[#t+1] = format("%s:%s",ty,stripzeros(topoints(current.kern))) else t[#t+1] = ty end @@ -489,7 +704,7 @@ local function trace_info(message, where, what) end local function trace_node(what) - local nt = node.type(what.id) + local nt = nodecodes[what.id] local tl = trace_list[#trace_list] if tl and tl[1] == "node" then trace_list[#trace_list] = { "node", tl[2] .. " + " .. nt } @@ -499,7 +714,7 @@ local function trace_node(what) end local function trace_done(str,data) - if data.id == penalty then + if data.id == penalty_code then trace_list[#trace_list+1] = { "penalty", format("%s | %s", str, data.penalty) } else trace_list[#trace_list+1] = { "glue", format("%s | %s", str, glue_to_string(data)) } @@ -513,84 +728,72 @@ local function show_tracing(head) for i=1,#trace_list do local tag, text = unpack(trace_list[i]) if tag == "info" then - logs.report("collapse",text) + report_collapser(text) else - logs.report("collapse"," %s: %s",tag,text) + report_collapser(" %s: %s",tag,text) end end - logs.report("collapse","before: %s",before) - logs.report("collapse","after : %s",after) + report_collapser("before: %s",before) + report_collapser("after : %s",after) end end -- alignment box begin_of_par vmode_par hmode_par insert penalty before_display after_display -local user_skip = 0 -local line_skip = 1 -local baseline_skip = 2 -local par_skip = 3 -local above_display_skip = 4 -local below_display_skip = 5 -local above_display_short_skip = 6 -local below_display_short_skip = 7 -local left_skip_code = 8 -local right_skip_code = 9 -local top_skip_code = 10 -local split_top_skip_code = 11 -local tab_skip_code = 12 -local space_skip_code = 13 -local xspace_skip_code = 14 -local par_fill_skip_code = 15 -local thin_mu_skip_code = 16 -local med_mu_skip_code = 17 -local thick_mu_skip_code = 18 - -local skips = { - [ 0] = "user_skip", - [ 1] = "line_skip", - [ 2] = "baseline_skip", - [ 3] = "par_skip", - [ 4] = "above_display_skip", - [ 5] = "below_display_skip", - [ 6] = "above_display_short_skip", - [ 7] = "below_display_short_skip", - [ 8] = "left_skip_code", - [ 9] = "right_skip_code", - [10] = "top_skip_code", - [11] = "split_top_skip_code", - [12] = "tab_skip_code", - [13] = "space_skip_code", - [14] = "xspace_skip_code", - [15] = "par_fill_skip_code", - [16] = "thin_mu_skip_code", - [17] = "med_mu_skip_code", - [18] = "thick_mu_skip_code", -} +local skipcodes = nodes.skipcodes + +local userskip_code = skipcodes.userskip +local lineskip_code = skipcodes.lineskip +local baselineskip_code = skipcodes.baselineskip +local parskip_code = skipcodes.parskip +local abovedisplayskip_code = skipcodes.abovedisplayskip +local belowdisplayskip_code = skipcodes.belowdisplayskip +local abovedisplayshortskip_code = skipcodes.abovedisplayshortskip +local belowdisplayshortskip_code = skipcodes.belowdisplayshortskip +local topskip_code = skipcodes.topskip +local splittopskip_code = skipcodes.splittopskip local free_glue_node = free_node local discard, largest, force, penalty, add, disable, nowhite, goback, together = 0, 1, 2, 3, 4, 5, 6, 7, 8 ---~ local function free_glue_node(n) free_node(n.spec) free_node(n) end +--~ local function free_glue_node(n) +--~ -- free_node(n.spec) +--~ print("before",n) +--~ logs.flush() +--~ free_node(n) +--~ print("after") +--~ logs.flush() +--~ end -function vspacing.snap_box(n,how) +function vspacing.snapbox(n,how) local sv = snapmethods[how] if sv then local box = texbox[n] local list = box.list ---~ if list and (list.id == hlist or list.id == vlist) then if list then - local s = has_attribute(list,snap_method) + local s = has_attribute(list,a_snapmethod) if s == 0 then if trace_vsnapping then - -- logs.report("snapper", "hlist not snapped, already done") + -- report_snapper("box list not snapped, already done") end else - local h, d, ch, cd, lines = snap_hlist(box,sv,box.height,box.depth) - box.height, box.depth = ch, cd - if trace_vsnapping then - logs.report("snapper", "hlist snapped from (%s,%s) to (%s,%s) using method '%s' (%s) for '%s' (%s lines)",h,d,ch,cd,sv.name,sv.specification,"direct",lines) + local ht, dp = box.height, box.depth + if false then -- todo: already_done + -- assume that the box is already snapped + if trace_vsnapping then + report_snapper("box list already snapped at (%s,%s): %s", + ht,dp,listtoutf(list)) + end + else + local h, d, ch, cd, lines = snap_hlist("box",box,sv,ht,dp) + box.height, box.depth = ch, cd + if trace_vsnapping then + report_snapper("box list snapped from (%s,%s) to (%s,%s) using method '%s' (%s) for '%s' (%s lines): %s", + h,d,ch,cd,sv.name,sv.specification,"direct",lines,listtoutf(list)) + end + set_attribute(box, a_snapmethod,0) -- + set_attribute(list,a_snapmethod,0) -- yes or no end - set_attribute(list,snap_method,0) end end end @@ -598,23 +801,23 @@ end local function forced_skip(head,current,width,where,trace) if where == "after" then - head, current = insert_node_after(head,current,make_rule_node(0,0,0)) - head, current = insert_node_after(head,current,make_kern_node(width)) - head, current = insert_node_after(head,current,make_rule_node(0,0,0)) + head, current = insert_node_after(head,current,new_rule(0,0,0)) + head, current = insert_node_after(head,current,new_kern(width)) + head, current = insert_node_after(head,current,new_rule(0,0,0)) else local c = current - head, current = insert_node_before(head,current,make_rule_node(0,0,0)) - head, current = insert_node_before(head,current,make_kern_node(width)) - head, current = insert_node_before(head,current,make_rule_node(0,0,0)) + head, current = insert_node_before(head,current,new_rule(0,0,0)) + head, current = insert_node_before(head,current,new_kern(width)) + head, current = insert_node_before(head,current,new_rule(0,0,0)) current = c end if trace then - logs.report("vspacing", "inserting forced skip of %s",width) + report_vspacing("inserting forced skip of %s",width) end return head, current end -local function collapser(head,where,what,trace,snap) -- maybe also pass tail +local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also pass tail if trace then reset_tracing(head) end @@ -627,18 +830,18 @@ local function collapser(head,where,what,trace,snap) -- maybe also pass tail -- local function flush(why) if penalty_data then - local p = make_penalty_node(penalty_data) + local p = new_penalty(penalty_data) if trace then trace_done("flushed due to " .. why,p) end - head, _ = insert_node_before(head,current,p) + head = insert_node_before(head,current,p) end if glue_data then if force_glue then if trace then trace_done("flushed due to " .. why,glue_data) end - head, _ = forced_skip(head,current,glue_data.spec.width,"before",trace) + head = forced_skip(head,current,glue_data.spec.width,"before",trace) free_glue_node(glue_data) elseif glue_data.spec.writable then if trace then trace_done("flushed due to " .. why,glue_data) end - head, _ = insert_node_before(head,current,glue_data) + head = insert_node_before(head,current,glue_data) else free_glue_node(glue_data) end @@ -649,36 +852,47 @@ local function collapser(head,where,what,trace,snap) -- maybe also pass tail parskip, ignore_parskip, ignore_following, ignore_whitespace = nil, false, false, false end if trace_vsnapping then - logs.report("snapper", "global ht/dp = %s/%s, local ht/dp = %s/%s", + report_snapper("global ht/dp = %s/%s, local ht/dp = %s/%s", texdimen.globalbodyfontstrutheight, texdimen.globalbodyfontstrutdepth, texdimen.bodyfontstrutheight, texdimen.bodyfontstrutdepth) end if trace then trace_info("start analyzing",where,what) end while current do local id, subtype = current.id, current.subtype - if id == hlist or id == vlist then --- needs checking, why so many calls + if id == hlist_code or id == vlist_code then + -- needs checking, why so many calls if snap then - local s = has_attribute(current,snap_method) + local list = current.list + local s = has_attribute(current,a_snapmethod) if not s then -- if trace_vsnapping then - -- logs.report("snapper", "hlist not snapped") + -- report_snapper("mvl list not snapped") -- end elseif s == 0 then if trace_vsnapping then - -- logs.report("snapper", "hlist not snapped, already done") + report_snapper("mvl %s not snapped, already done: %s",nodecodes[id],listtoutf(list)) end else local sv = snapmethods[s] if sv then - local h, d, ch, cd, lines = snap_hlist(current,sv) - if trace_vsnapping then - logs.report("snapper", "hlist snapped from (%s,%s) to (%s,%s) using method '%s' (%s) for '%s' (%s lines)",h,d,ch,cd,sv.name,sv.specification,where,lines) + -- check if already snapped + if list and already_done(id,list,a_snapmethod) then + local ht, dp = current.height, current.depth + -- assume that the box is already snapped + if trace_vsnapping then + report_snapper("mvl list already snapped at (%s,%s): %s",ht,dp,listtoutf(list)) + end + else + local h, d, ch, cd, lines = snap_hlist("mvl",current,sv) + if trace_vsnapping then + report_snapper("mvl %s snapped from (%s,%s) to (%s,%s) using method '%s' (%s) for '%s' (%s lines): %s", + nodecodes[id],h,d,ch,cd,sv.name,sv.specification,where,lines,listtoutf(list)) + end end elseif trace_vsnapping then - logs.report("snapper", "hlist not snapped due to unknown snap specification") + report_snapper("mvl %s not snapped due to unknown snap specification: %s",nodecodes[id],listtoutf(list)) end - set_attribute(current,snap_method,0) + set_attribute(current,a_snapmethod,0) end else -- @@ -686,25 +900,25 @@ local function collapser(head,where,what,trace,snap) -- maybe also pass tail -- tex.prevdepth = 0 flush("list") current = current.next - elseif id == penalty then + elseif id == penalty_code then --~ natural_penalty = current.penalty --~ if trace then trace_done("removed penalty",current) end --~ head, current = remove_node(head, current, true) current = current.next - elseif id == kern then + elseif id == kern_code then if snap and trace_vsnapping and current.kern ~= 0 then --~ current.kern = 0 - logs.report("snapper", "kern of %s (kept)",current.kern) + report_snapper("kern of %s (kept)",current.kern) end flush("kern") current = current.next - elseif id ~= glue then + elseif id ~= glue_code then flush("something else") current = current.next - elseif subtype == user_skip then -- todo, other subtypes, like math - local sc = has_attribute(current,skip_category) -- has no default, no unset (yet) - local so = has_attribute(current,skip_order ) or 1 -- has 1 default, no unset (yet) - local sp = has_attribute(current,skip_penalty ) -- has no default, no unset (yet) + elseif subtype == userskip_code then + local sc = has_attribute(current,a_skipcategory) -- has no default, no unset (yet) + local so = has_attribute(current,a_skiporder ) or 1 -- has 1 default, no unset (yet) + local sp = has_attribute(current,a_skippenalty ) -- has no default, no unset (yet) if sp and sc == penalty then if not penalty_data then penalty_data = sp @@ -718,21 +932,22 @@ local function collapser(head,where,what,trace,snap) -- maybe also pass tail elseif not sc then -- if not sc then if glue_data then if trace then trace_done("flush",glue_data) end - head, current = nodes.before(head,current,glue_data) + head = insert_node_before(head,current,glue_data) if trace then trace_natural("natural",current) end current = current.next else -- not look back across head local previous = current.prev - if previous and previous.id == glue and previous.subtype == 0 then + if previous and previous.id == glue_code and previous.subtype == userskip_code then local ps = previous.spec if ps.writable then local cs = current.spec if cs.writable and ps.stretch_order == 0 and ps.shrink_order == 0 and cs.stretch_order == 0 and cs.shrink_order == 0 then local pw, pp, pm = ps.width, ps.stretch, ps.shrink local cw, cp, cm = cs.width, cs.stretch, cs.shrink - ps = writable_spec(previous) -- no writable needed here - ps.width, ps.stretch, ps.shrink = pw + cw, pp + cp, pm + cm +--~ ps = writable_spec(previous) -- no writable needed here +--~ ps.width, ps.stretch, ps.shrink = pw + cw, pp + cp, pm + cm +previous.spec = new_gluespec(pw + cw, pp + cp, pm + cm) -- else topskip can disappear if trace then trace_natural("removed",current) end head, current = remove_node(head, current, true) -- current = previous @@ -809,7 +1024,7 @@ local function collapser(head,where,what,trace,snap) -- maybe also pass tail head, current = remove_node(head, current, true) elseif sc == add then if trace then trace_skip('add',sc,so,sp,current) end ---~ local old, new = glue_data.spec, current.spec + -- local old, new = glue_data.spec, current.spec local old, new = writable_spec(glue_data), current.spec old.width = old.width + new.width old.stretch = old.stretch + new.stretch @@ -827,16 +1042,16 @@ local function collapser(head,where,what,trace,snap) -- maybe also pass tail if sc == force then force_glue = true end - elseif subtype == line_skip then + elseif subtype == lineskip_code then if snap then - local s = has_attribute(current,snap_method) + local s = has_attribute(current,a_snapmethod) if s and s ~= 0 then - set_attribute(current,snap_method,0) + set_attribute(current,a_snapmethod,0) if current.spec.writable then local spec = writable_spec(current) spec.width = 0 if trace_vsnapping then - logs.report("snapper", "lineskip set to zero") + report_snapper("lineskip set to zero") end end else @@ -848,16 +1063,16 @@ local function collapser(head,where,what,trace,snap) -- maybe also pass tail flush("lineskip") end current = current.next - elseif subtype == baseline_skip then + elseif subtype == baselineskip_code then if snap then - local s = has_attribute(current,snap_method) + local s = has_attribute(current,a_snapmethod) if s and s ~= 0 then - set_attribute(current,snap_method,0) + set_attribute(current,a_snapmethod,0) if current.spec.writable then local spec = writable_spec(current) spec.width = 0 if trace_vsnapping then - logs.report("snapper", "baselineskip set to zero") + report_snapper("baselineskip set to zero") end end else @@ -869,7 +1084,7 @@ local function collapser(head,where,what,trace,snap) -- maybe also pass tail flush("baselineskip") end current = current.next - elseif subtype == par_skip then + elseif subtype == parskip_code then -- parskip always comes later if ignore_whitespace then if trace then trace_natural("ignored parskip",current) end @@ -887,15 +1102,15 @@ local function collapser(head,where,what,trace,snap) -- maybe also pass tail if trace then trace_natural("honored parskip",current) end head, current, glue_data = remove_node(head, current) end - elseif subtype == top_skip_code or subtype == split_top_skip_code then + elseif subtype == topskip_code or subtype == splittopskip_code then if snap then - local s = has_attribute(current,snap_method) + local s = has_attribute(current,a_snapmethod) if s and s ~= 0 then - set_attribute(current,snap_method,0) + set_attribute(current,a_snapmethod,0) local sv = snapmethods[s] local w, cw = snap_topskip(current,sv) if trace_vsnapping then - logs.report("snapper", "topskip snapped from %s to %s for '%s'",w,cw,where) + report_snapper("topskip snapped from %s to %s for '%s'",w,cw,where) end else if trace then trace_skip("topskip",sc,so,sp,current) end @@ -906,25 +1121,25 @@ local function collapser(head,where,what,trace,snap) -- maybe also pass tail flush("topskip") end current = current.next - elseif subtype == above_display_skip then + elseif subtype == abovedisplayskip_code then -- if trace then trace_skip("above display skip (normal)",sc,so,sp,current) end flush("above display skip (normal)") current = current.next -- - elseif subtype == below_display_skip then + elseif subtype == belowdisplayskip_code then -- if trace then trace_skip("below display skip (normal)",sc,so,sp,current) end flush("below display skip (normal)") current = current.next -- - elseif subtype == above_display_short_skip then + elseif subtype == abovedisplayshortskip_code then -- if trace then trace_skip("above display skip (short)",sc,so,sp,current) end flush("above display skip (short)") current = current.next -- - elseif subtype == below_display_short_skip then + elseif subtype == belowdisplayshortskip_code then -- if trace then trace_skip("below display skip (short)",sc,so,sp,current) end flush("below display skip (short)") @@ -932,7 +1147,7 @@ local function collapser(head,where,what,trace,snap) -- maybe also pass tail -- else -- other glue if snap and trace_vsnapping and current.spec.writable and current.spec.width ~= 0 then - logs.report("snapper", "%s of %s (kept)",skips[subtype],current.spec.width) + report_snapper("%s of %s (kept)",skipcodes[subtype],current.spec.width) --~ current.spec.width = 0 end if trace then trace_skip(format("some glue (%s)",subtype),sc,so,sp,current) end @@ -950,7 +1165,7 @@ local function collapser(head,where,what,trace,snap) -- maybe also pass tail local tail if penalty_data then tail = find_node_tail(head) - local p = make_penalty_node(penalty_data) + local p = new_penalty(penalty_data) if trace then trace_done("result",p) end head, tail = insert_node_after(head,tail,p) end @@ -970,7 +1185,7 @@ local function collapser(head,where,what,trace,snap) -- maybe also pass tail end show_tracing(head) if oldhead ~= head then - trace_info("head has been changed from '%s' to '%s'",node.type(oldhead.id),node.type(head.id)) + trace_info("head has been changed from '%s' to '%s'",nodecodes[oldhead.id],nodecodes[head.id]) end end return head, true @@ -989,21 +1204,21 @@ end local stackhead, stacktail, stackhack = nil, nil, false local function report(message,lst) - logs.report("vspacing",message,count_nodes(lst,true),node_ids_to_string(lst)) + report_vspacing(message,count_nodes(lst,true),nodeidstostring(lst)) end -function nodes.handle_page_spacing(newhead,where) ---~ local newhead = texlists.contrib_head +function vspacing.pagehandler(newhead,where) + -- local newhead = texlists.contrib_head if newhead then ---~ starttiming(vspacing) + -- starttiming(vspacing) local newtail = find_node_tail(newhead) local flush = false stackhack = true -- todo: only when grid snapping once enabled for n in traverse_nodes(newhead) do -- we could just look for glue nodes local id = n.id - if id == glue then - if n.subtype == 0 then - if has_attribute(n,skip_category) then + if id == glue_code then + if n.subtype == userskip_code then + if has_attribute(n,a_skipcategory) then stackhack = true else flush = true @@ -1026,8 +1241,8 @@ function nodes.handle_page_spacing(newhead,where) if stackhack then stackhack = false if trace_collect_vspacing then report("processing %s nodes: %s",newhead) end ---~ texlists.contrib_head = collapser(newhead,"page",where,trace_page_vspacing,true) -newhead = collapser(newhead,"page",where,trace_page_vspacing,true) +--~ texlists.contrib_head = collapser(newhead,"page",where,trace_page_vspacing,true,a_snapmethod) + newhead = collapser(newhead,"page",where,trace_page_vspacing,true,a_snapmethod) else if trace_collect_vspacing then report("flushing %s nodes: %s",newhead) end --~ texlists.contrib_head = newhead @@ -1042,12 +1257,12 @@ newhead = collapser(newhead,"page",where,trace_page_vspacing,true) stackhead = newhead end stacktail = newtail ---~ texlists.contrib_head = nil -newhead = nil + -- texlists.contrib_head = nil + newhead = nil end ---~ stoptiming(vspacing) + -- stoptiming(vspacing) end -return newhead + return newhead end local ignore = table.tohash { @@ -1056,102 +1271,44 @@ local ignore = table.tohash { -- "vbox", } -function nodes.handle_vbox_spacing(head,where) +function vspacing.vboxhandler(head,where) if head and not ignore[where] and head.next then -- starttiming(vspacing) - head = collapser(head,"vbox",where,trace_vbox_vspacing,false) + head = collapser(head,"vbox",where,trace_vbox_vspacing,true,a_snapvbox) -- todo: local snapper -- stoptiming(vspacing) end return head end -function nodes.collapse_vbox(n) -- for boxes +function vspacing.collapsevbox(n) -- for boxes but using global a_snapmethod local list = texbox[n].list if list then -- starttiming(vspacing) - texbox[n].list = vpack_node(collapser(list,"snapper","vbox",trace_vbox_vspacing,true)) + texbox[n].list = vpack_node(collapser(list,"snapper","vbox",trace_vbox_vspacing,true,a_snapmethod)) -- stoptiming(vspacing) end end --- we will split this module hence the locals - -local attribute = attributes.private('graphicvadjust') - -local hlist = node.id('hlist') -local vlist = node.id('vlist') - -local remove_node = nodes.remove -local hpack_node = node.hpack -local vpack_node = node.vpack -local has_attribute = node.has_attribute - -function nodes.repackage_graphicvadjust(head,groupcode) -- we can make an actionchain for mvl only - if groupcode == "" then -- mvl only - local h, p, done = head, nil, false - while h do - local id = h.id - if id == hlist or id == vlist then - local a = has_attribute(h,attribute) - if a then - if p then - local n - head, h, n = remove_node(head,h) - local pl = p.list - if n.width ~= 0 then - n = hpack_node(n,0,'exactly') -- todo: dir - end - if pl then - pl.prev = n - n.next = pl - end - p.list = n - done = true - else - -- can't happen - end - else - p = h - h = h.next - end - else - h = h.next - end - end - return head, done - else - return head, false - end -end - ---~ function nodes.repackage_graphicvadjust(head,groupcode) -- we can make an actionchain for mvl only ---~ if groupcode == "" then -- mvl only ---~ return head, false ---~ else ---~ return head, false ---~ end ---~ end - ---~ tasks.appendaction("finalizers", "lists", "nodes.repackage_graphicvadjust") +-- We will split this module so a few locals are repeated. Also this will be +-- rewritten. nodes.builders = nodes.builder or { } - local builders = nodes.builders -local actions = tasks.actions("vboxbuilders",5) +local actions = nodes.tasks.actions("vboxbuilders") function nodes.builders.vpack_filter(head,groupcode,size,packtype,maxdepth,direction) local done = false if head then starttiming(builders) - if trace_callbacks then + if trace_vpacking then local before = nodes.count(head) head, done = actions(head,groupcode,size,packtype,maxdepth,direction) local after = nodes.count(head) if done then - tracer("vpack","changed",head,groupcode,before,after,true) + nodes.processors.tracer("vpack","changed",head,groupcode,before,after,true) else - tracer("vpack","unchanged",head,groupcode,before,after,true) + nodes.processors.tracer("vpack","unchanged",head,groupcode,before,after,true) end stoptiming(builders) else @@ -1166,7 +1323,7 @@ end -- and we operate on the mlv. Also, we need to do the -- vspacing last as it removes items from the mvl. -local actions = tasks.actions("mvlbuilders",1) +local actions = nodes.tasks.actions("mvlbuilders") function nodes.builders.buildpage_filter(groupcode) starttiming(builders) @@ -1177,7 +1334,7 @@ function nodes.builders.buildpage_filter(groupcode) return (done and head) or true end -callbacks.register('vpack_filter', nodes.builders.vpack_filter, "vertical spacing etc") +callbacks.register('vpack_filter', nodes.builders.vpack_filter, "vertical spacing etc") callbacks.register('buildpage_filter', nodes.builders.buildpage_filter, "vertical spacing etc (mvl)") statistics.register("v-node processing time", function() diff --git a/Master/texmf-dist/tex/context/base/spac-ver.mkiv b/Master/texmf-dist/tex/context/base/spac-ver.mkiv index 75af82df79a..d04ed672423 100644 --- a/Master/texmf-dist/tex/context/base/spac-ver.mkiv +++ b/Master/texmf-dist/tex/context/base/spac-ver.mkiv @@ -78,39 +78,6 @@ \fi -% \def\presetnormallineheight -% {\edef\normallineheight{\@@itline}% -% %done elsewhere : \spacing\!!plusone % new per 10/08/2004, else problems in otr / !! needed -% \iflocalinterlinespace \else -% \doifdefined\bodyfontinterlinespecs -% {\doifsomething\bodyfontinterlinespace -% {\edef\normallineheight{\bodyfontinterlinespace}}}% -% \fi} - -% \unexpanded\def\setupspecifiedinterlinespace[#1]% -% {\getparameters[\??it][#1]% -% \scratchdimen0\@@itheight\points -% \advance\scratchdimen 0\@@itdepth\points -% \ifdim\scratchdimen>\onepoint -% \showmessage\m!layouts{10}{\@@itheight,\@@itdepth}% -% \let\@@itheight\strutheightfactor -% \let\@@itdepth \strutdepthfactor -% \else -% \let\strutheightfactor\@@itheight -% \let\strutdepthfactor \@@itdepth -% \fi -% \let\minimumstrutheight \@@itminheight -% \let\minimumstrutdepth \@@itmindepth -% \let\minimumlinedistance\@@itdistance -% \let\normallineheight \@@itline % let ! ! ! ! ! ivm ex -% \doifelse\@@ittop\v!height % new, topskip does more bad than good -% {\let\topskipfactor \@@itheight} -% {\let\topskipfactor \@@ittop }% -% \let\maxdepthfactor \@@itbottom -% \let\baselinegluefactor \@@itstretch -% \setfontparameters % redundant, can be \setstrut, test first -% \updateraggedskips} % yes indeed - \def\presetnormallineheight {\edef\normallineheight{\interlinespaceparameter\c!line}% %done elsewhere : \spacing\!!plusone % new per 10/08/2004, else problems in otr / !! needed @@ -150,16 +117,6 @@ \setfontparameters} \setvalue{\??it::\v!auto }{\let\setrelativeinterlinespace\dosetrelativeinterlinespace} -% \def\dosetspecifiedrelativeinterlinespace#1% -% {\assignvalue{#1}\currentrelativeinterlinespace{1.00}{1.25}{1.50}% -% \spacing\currentrelativeinterlinespace} - -% \def\dosetspecifiedrelativeinterlinespace#1% fragile? -% {\doifdimensionelse{#1} -% {\setupspecifiedinterlinespace[\c!line=#1]} -% {\assignvalue{#1}\currentrelativeinterlinespace{1.00}{1.25}{1.50}% -% \spacing\currentrelativeinterlinespace}} - \def\dosetspecifiedrelativeinterlinespace#1% fragile? {\doifdimenstringelse{#1} {\setupspecifiedinterlinespace[\c!line=#1]} @@ -183,15 +140,9 @@ \let\setrelativeinterlinespace\relax -% \appendtoks \setrelativeinterlinespace \to \everybodyfont - \newtoks \everysetupglobalinterlinespace \newtoks \everysetuplocalinterlinespace -% \def\complexsetupinterlinespace[#1]% \commalistelement ipv #1 -% {\doifassignmentelse{#1}\setupspecifiedinterlinespace\setuprelativeinterlinespace[#1]% -% \the\iflocalinterlinespace\everysetuplocalinterlinespace\else\everysetupglobalinterlinespace\fi} - \def\interlinespaceparameter #1{\csname\dointerlinespaceparameter{\??it\currentinterlinespace}#1\endcsname} \def\dointerlinespaceparameter #1#2{\ifcsname#1#2\endcsname#1#2\else\expandafter\dointerlinespaceparentparameter\csname#1\s!parent\endcsname#2\fi} \def\dointerlinespaceparentparameter#1#2{\ifx#1\relax\s!empty\else\dointerlinespaceparameter#1#2\fi} @@ -236,23 +187,6 @@ \the\everysetuplocalinterlinespace \localinterlinespacefalse} -% \def\dosetupcheckedinterlinespace#1% often a chain -% {\edef\askedinterlinespace{#1}% -% \ifx\askedinterlinespace\empty -% \simplesetupinterlinespace -% \else -% \normalexpanded{\noexpand\doifassignmentelse{\askedinterlinespace}% -% \noexpand\setupspecifiedinterlinespace -% \noexpand\setuprelativeinterlinespace[\askedinterlinespace]}% -% \iflocalinterlinespace -% \the\everysetuplocalinterlinespace -% \else -% \localinterlinespacetrue -% \the\everysetuplocalinterlinespace -% \localinterlinespacefalse -% \fi -% \fi} - \def\dosetupcheckedinterlinespace#1% often a chain {\edef\askedinterlinespace{#1}% \ifx\askedinterlinespace\empty @@ -282,29 +216,6 @@ \fi \fi\fi} -% \unexpanded\def\setuplocalinterlinespace[#1]% -% {\localinterlinespacetrue -% \let\@@saveditheight \@@itheight -% \let\@@saveditdepth \@@itdepth -% \let\@@saveditline \@@itline -% \let\@@saveditminheight\@@itminheight -% \let\@@saveditmindepth \@@itmindepth -% \let\@@saveditdistance \@@itdistance -% \let\@@savedittop \@@ittop -% \let\@@saveditbottom \@@itbottom -% \let\@@saveditstretch \@@itstretch -% \setupinterlinespace[#1]% -% \let\@@itheight \@@saveditheight -% \let\@@itdepth \@@saveditdepth -% \let\@@itline \@@saveditline -% \let\@@itminheight\@@saveditminheight -% \let\@@itmindepth \@@saveditmindepth -% \let\@@itdistance \@@saveditdistance -% \let\@@ittop \@@savedittop -% \let\@@itbottom \@@saveditbottom -% \let\@@itstretch \@@saveditstretch -% \localinterlinespacefalse} - \unexpanded\def\setuplocalinterlinespace[#1]% {\localinterlinespacetrue \pushmacro\currentinterlinespace @@ -468,6 +379,8 @@ \dosetupwhitespace \fi} +\newconstant\baselinegridmode % option in layout / 1=permit_half_lines + \def\dosetupwhitespace % quick test for no list {\ifcsname\??ws\??ws\currentwhitespace\endcsname \csname\??ws\??ws\currentwhitespace\endcsname @@ -495,8 +408,6 @@ \fi \parskip\ctxparskip} -\chardef\baselinegridmode=0 % option in layout / 1=permit_half_lines - \def\dodosetupwhitespace {\ifgridsnapping \setfalse\flexiblewhitespace @@ -537,46 +448,15 @@ \def\dowhitespacemethod#1% {\ifcsname\??ws\??ws#1\endcsname\csname\??ws\??ws#1\endcsname\else\ctxparskip#1\fi\relax} - -% \def\nowhitespace -% {\ifdim\parskip>\zeropoint\relax -% \ifdim\lastskip=-\parskip -% \else -% \vskip-\parskip -% \fi -% \fi} -% -% \def\nowhitespaceunlessskip -% {\ifdim\lastskip>\zeropoint \else -% \nowhitespace -% \fi} -% -% \def\whitespace -% {\par -% \ifdim\parskip>\zeropoint\relax -% %\ifdim\lastskip>\parskip \else -% % \removelastskip interferes with blanko blokkeer en klein -% \vskip\parskip -% %\fi -% \fi} \def\nowhitespace{\vspacing[\v!nowhite]} \def\whitespace {\vspacing[\v!white]} -% obsolete: -% -% \def\savedcurrentwhitespace{\currentwhitespace} -% \def\savecurrentwhitespace {\edef\savedcurrentwhitespace{\currentwhitespace}} -% \def\restorecurrentwhitespace{\edef\currentwhitespace{\savedcurrentwhitespace}} - % De onderstaande macro handelt ook de situatie dat er geen % tekst tussen \start ... \stop is geplaatst. Daartoe wordt de % laatste skip over de lege tekst heen gehaald. Dit komt goed % van pas bij het plaatsen van (mogelijk lege) lijsten. -\newsignal \noparskipsignal % \def\noparskipsignal {0.00001pt} -\def\lastdoneparskip {0pt} - \newconditional\noblankinpacked \newcount\packeddepth @@ -970,7 +850,7 @@ % experiment -\newbox\emptystrutbox \setbox\emptystrutbox\hbox{} +\newbox\emptystrutbox \setbox\emptystrutbox\emptyhbox \def\dosetstruthide {\setbox\strutbox\copy\emptystrutbox @@ -979,7 +859,6 @@ \def\strut{\relax\dontleavehmode\copy\strutbox} % still callbacks for \hbox{\strut} - \let\normalstrut\strut %D Sometimes a capstrut comes in handy @@ -992,20 +871,24 @@ %D \NC \NC a normal strut \NC {\showstruts\setupstrut\strut} \NC \NR %D \stoptabulate +\setvalue{@strut@\v!yes }{\setstrut} +\setvalue{@strut@\v!auto }{\setautostrut} +\setvalue{@strut@\v!no }{\setnostrut} +\setvalue{@strut@\v!cap }{\setcapstrut} +\setvalue{@strut@\v!fit }{\setfontstrut} +\setvalue{@strut@\v!line }{\setstrut} +\setvalue{@strut@\s!default}{\setstrut} +\setvalue{@strut@\s!empty }{\setstrut} + \unexpanded\def\setupstrut {\dosingleempty\dosetupstrut} \def\dosetupstrut[#1]% yet undocumented, todo: fontstrut - {\processaction - [#1] - [ \v!yes=>\setstrut, - \v!auto=>\setautostrut, - \v!no=>\setnostrut, - \v!cap=>\setcapstrut, - \v!fit=>\setfontstrut, - \v!line=>\setstrut, - \s!default=>\setstrut, - \s!unknown=>\setcharstrut\commalistelement]} + {\ifcsname @strut@#1\endcsname + \csname @strut@#1\endcsname + \else + \setcharstrut{#1}% + \fi} \def\showstruts {\setteststrut @@ -1067,7 +950,7 @@ \fi \fi\fi} -\newbox\nostrutbox \setbox\nostrutbox\normalhbox{} % {\normalhbox{}} +\newbox\nostrutbox \setbox\nostrutbox\emptyhbox \def\setnostrut {\setbox\strutbox\copy\nostrutbox @@ -1117,13 +1000,6 @@ %D why|>| this assignment gives troubles in for instance the %D visual debugger. -%D The plain ones: - -% \def\offinterlineskip -% {\baselineskip-\thousandpoint -% \lineskip\zeropoint -% \lineskiplimit\maxdimen} - \def\offinterlineskip {\baselineskip-\thousandpoint \lineskip\zeropoint @@ -1281,7 +1157,7 @@ %D Page spacing -\chardef\bottomraggedness=0 % 0=ragged 1=normal/align 2=baseline +\newconstant\bottomraggednessmode % 0=ragged 1=normal/align 2=baseline \def\bottomalignlimit{3\lineheight} @@ -1294,21 +1170,21 @@ \r@ggedbottomfalse} \def\raggedbottom - {\chardef\bottomraggedness\zerocount + {\bottomraggednessmode\zerocount \n@rmalbottomfalse \r@ggedbottomtrue \b@selinebottomfalse \settopskip} \def\alignbottom - {\chardef\bottomraggedness\plusone + {\bottomraggednessmode\plusone \n@rmalbottomtrue \r@ggedbottomfalse \b@selinebottomfalse \settopskip} \def\baselinebottom - {\chardef\bottomraggedness\plustwo + {\bottomraggednessmode\plustwo \n@rmalbottomfalse \r@ggedbottomfalse \b@selinebottomtrue @@ -1318,27 +1194,26 @@ % so, the new one will be % -% \chardef\bottomraggedness=0 % 0=ragged 1=normal/align 2=baseline +% \bottomraggednessmode=0 % 0=ragged 1=normal/align 2=baseline % % \def\bottomalignlimit{3\lineheight} % will be settable % -% \def\raggedbottom {\chardef\bottomraggedness=0 \settopskip} -% \def\alignbottom {\chardef\bottomraggedness=1 \settopskip} -% \def\baselinebottom{\chardef\bottomraggedness=2 \settopskip} +% \def\raggedbottom {\bottomraggednessmode\zerocount\settopskip} +% \def\alignbottom {\bottomraggednessmode\plusone \settopskip} +% \def\baselinebottom{\bottomraggednessmode\plustwo \settopskip} % % \let\normalbottom =\alignbottom %D Good old blank redone: -\definesystemattribute[kern-chars] -\definesystemattribute[skip-category] \chardef\skipcategoryattribute \dogetattributeid{skip-category} -\definesystemattribute[skip-penalty] \chardef\skippenaltyattribute \dogetattributeid{skip-penalty} -\definesystemattribute[skip-order] \chardef\skiporderattribute \dogetattributeid{skip-order} -\definesystemattribute[display-math] \chardef\displaymathattribute \dogetattributeid{display-math} -\definesystemattribute[snap-method] \chardef\snapmethodattribute \dogetattributeid{snap-method} -\definesystemattribute[snap-done] \chardef\snapdoneattribute \dogetattributeid{snap-done} - -%definesystemattribute[snap-category] \chardef\snapcategoryattribute \dogetattributeid{snap-category} +%definesystemattribute[kernchars] [public] +\definesystemattribute[skipcategory] [public] +\definesystemattribute[skippenalty] [public] +\definesystemattribute[skiporder] [public] +\definesystemattribute[displaymath] [public] +\definesystemattribute[snapmethod] [public] +\definesystemattribute[snapvbox] [public] +%definesystemattribute[snapcategory] [public] % TODO: NAMED SNAPPERS @@ -1350,14 +1225,20 @@ \newdimen \globalbodyfontstrutheight \newdimen \globalbodyfontstrutdepth -% \appendtoks -% \dosetupgridsnapping -% \to \everysetupbodyfont +\def\snappedvboxattribute{\ifgridsnapping attr \snapvboxattribute \attribute\snapmethodattribute\fi} +\def\setlocalgridsnapping{\ifgridsnapping \attribute \snapvboxattribute \attribute\snapmethodattribute\fi} + +\def\dosetlocalgridsnapping#1% + {\ifgridsnapping + \doifsomething{#1}% + {\autosetsnapvalue{#1}% + \attribute \snapvboxattribute \attribute\snapmethodattribute}% + \fi} \def\installsnapvalues#1#2% todo: a proper define {\edef\currentsnapper{#1:#2}% \ifcsname\currentsnapper\endcsname \else - \setevalue\currentsnapper{\ctxlua{vspacing.define_snap_method("#1","#2")}}% + \setevalue\currentsnapper{\ctxlua{builders.vspacing.definesnapmethod("#1","#2")}}% \fi \setevalue{\??gr:#1}{\attribute\snapmethodattribute\csname\currentsnapper\endcsname\space}} @@ -1440,11 +1321,6 @@ \global\globalbodyfontstrutheight\strutheight \global\globalbodyfontstrutdepth \strutdepth} -% \appendtoks -% \synchronizegloballinespecs -% \synchronizelocallinespecs -% \to \everysetupgridsnapping - \appendtoks \synchronizegloballinespecs \synchronizelocallinespecs @@ -1454,10 +1330,6 @@ \synchronizelocallinespecs \to \everysetuplocalinterlinespace -% \appendtoks -% \resetsnapvalues -% \to \everyforgetall - %D Snapping. \newif\ifgridsnapping @@ -1472,7 +1344,7 @@ {} % gone, unless we set an attribute \def\doplaceongrid[#1]% - {\snaptogrid[#1]\vbox} + {\snaptogrid[#1]\vbox} % mark as done \def\dosnaptogrid[#1]% list or predefined {\ifgridsnapping @@ -1489,32 +1361,35 @@ % eventually there will always be a line snap \def\dododosnaptogrid#1% - {\ifvbox\nextbox - \ctxlua{nodes.collapse_vbox(\number\nextbox)}% + {\ifvbox\nextbox % this will go away + \ctxlua{builders.vspacing.collapsevbox(\number\nextbox)}% isn't that already done? \fi \doifelsenothing{#1}{\setsnapvalue\v!normal}{\autosetsnapvalue{#1}}% - \ctxlua{vspacing.snap_box(\number\nextbox,\number\attribute\snapmethodattribute)}% -% \ifzeropt\ht\nextbox -% \ifzeropt\dp\nextbox -% \box\nextbox % here, else empty and zero -% \kern-\bodyfontlineheight -% \else -% \box\nextbox -% \fi -% \else - \box\nextbox -% \fi + \ctxlua{builders.vspacing.snapbox(\number\nextbox,\number\attribute\snapmethodattribute)}% + \ifvbox\nextbox\vbox\else\hbox\fi attr \snapmethodattribute \zerocount {\box\nextbox}% \egroup} +\def\docheckgridsnappingnop + {\gridsnappingfalse + \resetsystemmode\v!grid + \resetsnapvalue} + +\def\docheckgridsnappinyes + {\gridsnappingtrue + \setsystemmode\v!grid + \autosetsnapvalue\askedgridmode} + \def\docheckgridsnapping - {\edef\askedgridmode{\layoutparameter\c!grid}% needs checking by WS - \doifelse\askedgridmode\v!no - {\gridsnappingfalse - \resetsystemmode\v!grid - \resetsnapvalue} - {\gridsnappingtrue - \setsystemmode\v!grid - \autosetsnapvalue\askedgridmode}} + {\edef\askedgridmode{\layoutparameter\c!grid}% + \ifx\askedgridmode\v!no % official + \docheckgridsnappingnop + \else\ifx\askedgridmode\v!off % for taco and luigi + \docheckgridsnappingnop + \else\ifx\askedgridmode\empty % to be sure + \docheckgridsnappingnop + \else + \docheckgridsnappingyes + \fi\fi\fi} %D Visualization: @@ -1534,8 +1409,8 @@ \hss}% \flushnextbox}}} -\chardef\gridboxlinenomode\plusone % 0:nothing 1:all 2:lines 3:frame 4:l/r -\chardef\gridboxlinemode \plusone +\setnewconstant\gridboxlinenomode\plusone % 0:nothing 1:all 2:lines 3:frame 4:l/r +\setnewconstant\gridboxlinemode \plusone \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} @@ -1548,14 +1423,10 @@ \hsize#2% \baselinerulefalse \ifnum\gridboxlinenomode=\plusthree - \chardef\gridboxlinenomode\ifodd\realpageno\plusone\else\plustwo\fi + \gridboxlinenomode\ifodd\realpageno\plusone\else\plustwo\fi \fi \gridboxvbox % calculated size {\getrawnoflines{#3}% \getnoflines{#3}% -% \ifgridsnapping \else -% \vskip\topskip -% \vskip-\strutht -% \fi \scratchdimen#2\advance\scratchdimen \lineheight \dorecurse\noflines {\strut @@ -1581,10 +1452,6 @@ \def\fuzzysnappedbox#1#2% \box \unvbox {#1#2} -% \def\moveboxontogrid#1#2#3% will become obsolete -% {\doif{#2}\v!top {\setbox#1\hbox{\snaptogrid[\v!first]\box#1}}% -% \doif{#2}\v!bottom{\setbox#1\hbox{\snaptogrid[\v!last ]\box#1}}} - \def\moveboxontogrid#1#2#3% will become obsolete {} @@ -1607,19 +1474,6 @@ % \start \dosetstretch{.25em} \setuptolerance[tolerant,stretch] \input tufte \endgraf \stop % \start \dosetstretch{.5em} effe flink doorfietsen \stop -% \def\dosetupgridsnapping % calls too often, only needed in gridsnapping -% {\ctxlua{nodes.setsnapvalue(1,\number\openstrutheight,\number\openstrutdepth)}} -% -% \def\doenablegridsnapping -% {\attribute\snapcategoryattribute\plusone -% \topskip\strutht -% \offinterlineskip} -% -% \def\dodisablegridsnapping -% {\attribute\snapcategoryattribute\attributeunsetvalue -% % reset topskip -% \oninterlineskip} - % experimental code, not yet interfaced: % category: @@ -1638,7 +1492,7 @@ % % \defineblankmethod [\v!joinedup] {\ifvmode\nointerlineskip\fi} -% todo, in grid mode: vspacing.fixed = false +% todo, in grid mode: builders.vspacing.fixed = false \let\saveouterspacing \relax % for old times sake \let\restoreouterspacing\relax % for old times sake @@ -1738,12 +1592,9 @@ \unexpanded\def\definevspacingamount {\dotripleempty\dodefinevspacingamount} -% \def\dodefinevspacingamount[#1][#2][#3]% -% {\ctxlua{vspacing.setskip("#1",\!!bs\detokenize{#2}\!!es,\!!bs\detokenize{#3}\!!es)}} - \def\dodefinevspacingamount[#1][#2][#3]% can be combined {\setvalue{\??vs:#1}{\ifgridsnapping#3\else#2\fi}% - \ctxlua{vspacing.setskip("#1")}} + \ctxlua{builders.vspacing.setskip("#1")}} \def\addpredefinedblankskip#1#2% {\settrue\someblankdone @@ -1757,7 +1608,7 @@ {\dodoubleempty\dodefinevspacing} \def\dodefinevspacing[#1][#2]% - {\ctxlua{vspacing.setmap("#1","#2")}} + {\ctxlua{builders.vspacing.setmap("#1","#2")}} \unexpanded\def\vspacing {\dosingleempty\dovspacing} @@ -1774,7 +1625,8 @@ \fi\fi} \def\dovspacingyes[#1]% - {\ifmmode\else\ctxlua{vspacing.analyse("\iffirstargument#1\else\s!default\fi")}\fi} + %{\ifmmode\else\ctxlua{builders.vspacing.analyze("\iffirstargument#1\else\s!default\fi")}\fi} + {\ifmmode\else\ctxlua{builders.vspacing.analyze("\iffirstargument#1\else\currentvspacing\fi")}\fi} \def\dovspacingnop[#1]% {\ifmmode\else\par\fi} @@ -1783,7 +1635,7 @@ \definecomplexorsimple\setupvspacing -\let\currentvspacing\empty +\let\currentvspacing\s!default \def\complexsetupvspacing[#1]% {\edef\currentvspacing{#1}} @@ -1799,7 +1651,7 @@ % used both -\def\doinhibitblank{\vspacing[\v!disable]} % can be made faster +\def\doinhibitblank{\vspacing[\v!disable]} % can be made faster (keep this command, used in styles) \def\inhibitblank {\vspacing[\v!disable]} % can be made faster \let\setupblank \setupvspacing @@ -1808,16 +1660,6 @@ % category:4 is default -% \definevspacingamount[\v!big] [\bigskipamount] [\openlineheight] -% \definevspacingamount[\v!medium] [\medskipamount] [0.50\openlineheight] -% \definevspacingamount[\v!small] [\smallskipamount] [0.25\openlineheight] -% \definevspacingamount[\v!line] [\openlineheight] [\openlineheight] -% \definevspacingamount[\v!halfline][0.50\openlineheight][0.50\openlineheight] -% \definevspacingamount[\v!formula] [\medskipamount] [0.50\openlineheight] -% \definevspacingamount[\v!white] [\parskip] [\openlineheight] -% \definevspacingamount[\v!height] [\strutheight] [\strutheight] -% \definevspacingamount[\v!depth] [\strutdepth] [\strutdepth] - \definevspacingamount[\v!none] [\zeropoint] [\zeropoint] \definevspacingamount[\v!big] [\bigskipamount] [\bodyfontlineheight] \definevspacingamount[\v!medium] [\medskipamount] [0.50\bodyfontlineheight] @@ -1851,31 +1693,11 @@ \definevspacing[\v!weak] [order:0] \definevspacing[\v!strong] [order:100] -\definevspacing[\s!default] [\v!white] % was big for a while +\definevspacing[\s!default] [\v!white] % was big for a while \dorecurse{10} % todo: other values < 4000 {\expanded{\definevspacing[\v!samepage-\recurselevel][penalty:\the\numexpr4000+250*\recurselevel\relax]}} -% \setfalse\vspacingenabled -% -% \newtoks\everyenablevspacing -% \newtoks\everydisablevspacing -% -% \def\enablevspacing {\the\everyenablevspacing} -% \def\disablevspacing{\the\everydisablevspacing} -% -% \appendtoks -% \writestatus\m!systems{! ! enabling vspacing ! !}% -% \settrue\vspacingenabled -% \ctxlua{vspacing.enable()}% -% \to \everyenablevspacing -% -% \appendtoks -% \writestatus\m!systems{! ! disabling vspacing ! !}% -% \setfalse\vspacingenabled -% \ctxlua{vspacing.disable()}% -% \to \everydisablevspacing - \let\blank \vspacing \let\defineblank \definevspacing \let\defineblankmethod\definevspacingamount @@ -1944,48 +1766,6 @@ %D \stoplines %D \stoptyping -% \unexpanded\def\setuplines -% {\dodoubleargument\getparameters[\??rg]} -% -% \unexpanded\def\startlines -% {\@@rgbefore -% \pushmacro\checkindentation -% \whitespace -% %\page[\v!preference]} gaat mis na koppen, nieuw: later \nobreak -% \begingroup -% \setupindenting[\@@rgindenting]% -% \typesettinglinestrue -% \setupwhitespace[\v!none]% -% \obeylines -% \ignorespaces -% \gdef\afterfirstobeyedline % tzt two pass, net als opsomming -% {\gdef\afterfirstobeyedline -% {\nobreak -% \doifnot\@@rgoption\v!packed{\global\let\afterfirstobeyedline\relax}}}% -% \def\obeyedline -% {\par -% \futurelet\next\dobetweenthelines}% -% \activatespacehandler\@@rgspace -% \GotoPar} -% -% \unexpanded\def\stoplines -% {\endgroup -% \popmacro\checkindentation -% \@@rgafter} -% -% \def\dobetweenthelines -% {\doifmeaningelse\next\obeyedline -% {\@@rginbetween} -% {\afterfirstobeyedline}} -% -% \setuplines -% [\c!option=, -% \c!before=\blank, -% \c!after=\blank, -% \c!inbetween=\blank, -% \c!indenting=\v!no, -% \c!space=\v!default] - %D Contrary to \MKII\ we can now define classes of lines (generalized by %D Wolfgang). I will probably rewrite bits in \LUA. @@ -2009,6 +1789,7 @@ \getparameters [\??rg] [\c!option=, + \c!command=, \c!before=\blank, \c!after=\blank, \c!inbetween=\blank, @@ -2035,6 +1816,14 @@ \def\dostartlines[#1]% {\bgroup \edef\currentlines{#1}% + \obeylines + \dosingleempty\dodostartlines} + +\def\dodostartlines[#1]% new: optional second argument (WS) + {\iffirstargument + \getparameters[\??rg\currentlines][#1]% + \fi + \edef\linesoption{\linesparameter\c!option}% \linesparameter\c!before \pushmacro\checkindentation \whitespace @@ -2044,12 +1833,13 @@ \setupalign[\linesparameter\c!align]% \typesettinglinestrue \setupwhitespace[\v!none]% - \obeylines + %\obeylines % move upwards to keep spaces in the first line due to optional argument \ignorespaces \gdef\afterfirstobeyedline % tzt two pass, net als opsomming - {\gdef\afterfirstobeyedline - {\nobreak - \doifnot{\linesparameter\c!option}\v!packed{\global\let\afterfirstobeyedline\relax}}}% + {\linesparameter\c!command + \gdef\afterfirstobeyedline + {\ifx\linesoption\v!packed\nobreak\fi + \linesparameter\c!command}}% \def\obeyedline {\par \futurelet\next\dobetweenthelines}% diff --git a/Master/texmf-dist/tex/context/base/spec-dpm.mkii b/Master/texmf-dist/tex/context/base/spec-dpm.mkii index efecd792806..ddbb6caf811 100644 --- a/Master/texmf-dist/tex/context/base/spec-dpm.mkii +++ b/Master/texmf-dist/tex/context/base/spec-dpm.mkii @@ -11,8 +11,6 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\unprotect - %D This driver is build on top of the general \PDF\ macros, %D as defined in \type{spec-fdf}, so we inherit that one. Remark: %D this driver is no longer actively maintained, use the dpx one @@ -443,4 +441,4 @@ \stopspecials -\protect \endinput +\endinput diff --git a/Master/texmf-dist/tex/context/base/spec-dpx.mkii b/Master/texmf-dist/tex/context/base/spec-dpx.mkii index c521da8c72c..323152e0b3c 100644 --- a/Master/texmf-dist/tex/context/base/spec-dpx.mkii +++ b/Master/texmf-dist/tex/context/base/spec-dpx.mkii @@ -20,8 +20,6 @@ %C %C http://project.ktug.or.kr/dvipdfmx/ -\unprotect - %D This driver is built on top of the general \PDF\ macros, %D as defined in \type{spec-fdf}, so we inherit that one. @@ -791,4 +789,4 @@ \stopspecials -\protect \endinput +\endinput diff --git a/Master/texmf-dist/tex/context/base/spec-dvi.mkii b/Master/texmf-dist/tex/context/base/spec-dvi.mkii index 1a8f653f050..52289085191 100644 --- a/Master/texmf-dist/tex/context/base/spec-dvi.mkii +++ b/Master/texmf-dist/tex/context/base/spec-dvi.mkii @@ -11,8 +11,6 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\unprotect - %D \macros %D {dostartobject, %D dostopobject, @@ -115,4 +113,4 @@ \stopspecials -\protect \endinput +\endinput diff --git a/Master/texmf-dist/tex/context/base/spec-mis.mkii b/Master/texmf-dist/tex/context/base/spec-mis.mkii index 3d263eaceae..d56eca27e4a 100644 --- a/Master/texmf-dist/tex/context/base/spec-mis.mkii +++ b/Master/texmf-dist/tex/context/base/spec-mis.mkii @@ -196,8 +196,10 @@ %D %D \METAPOST\ support. +\ifx\makeMPintoPDFobject\undefined \newcount\makeMPintoPDFobject \fi + \appendtoks - \chardef\makeMPintoPDFobject\zerocount + \makeMPintoPDFobject\zerocount \def\setMPPDFobject#1#2{\def\getMPPDFobject{\box#2}}% \to \everyresetspecials diff --git a/Master/texmf-dist/tex/context/base/spec-pdf.mkii b/Master/texmf-dist/tex/context/base/spec-pdf.mkii index 2191eaeae3a..222c4e3a6c6 100644 --- a/Master/texmf-dist/tex/context/base/spec-pdf.mkii +++ b/Master/texmf-dist/tex/context/base/spec-pdf.mkii @@ -13,8 +13,6 @@ % funny things: mail to yeny: "please geen auto-crlf in special" -\unprotect - %D This driver is build on top of the general \PDF\ macros, %D as defined in \type{spec-fdf}, so we inherit that one. @@ -481,4 +479,4 @@ \stopspecials -\protect \endinput +\endinput diff --git a/Master/texmf-dist/tex/context/base/spec-tst.mkii b/Master/texmf-dist/tex/context/base/spec-tst.mkii index 543baa647b3..628a0dbbf77 100644 --- a/Master/texmf-dist/tex/context/base/spec-tst.mkii +++ b/Master/texmf-dist/tex/context/base/spec-tst.mkii @@ -11,12 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\unprotect - %D The code is now merged into spec-*.mkii -\protect - \doifnotmode{demo}{\endinput} \mainlanguage[vn] diff --git a/Master/texmf-dist/tex/context/base/spec-win.mkii b/Master/texmf-dist/tex/context/base/spec-win.mkii index 73db8830e9c..55ceec691df 100644 --- a/Master/texmf-dist/tex/context/base/spec-win.mkii +++ b/Master/texmf-dist/tex/context/base/spec-win.mkii @@ -11,8 +11,6 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\unprotect - %D Remark: chained references are not yet implemented. %D \macros @@ -96,4 +94,4 @@ \stopspecials -\protect \endinput +\endinput diff --git a/Master/texmf-dist/tex/context/base/spec-xtx.mkii b/Master/texmf-dist/tex/context/base/spec-xtx.mkii index 799c6ca8d31..81b83e66318 100644 --- a/Master/texmf-dist/tex/context/base/spec-xtx.mkii +++ b/Master/texmf-dist/tex/context/base/spec-xtx.mkii @@ -7,8 +7,6 @@ %D date=\currentdate, %D copyright={Adam Lindsay \& Hans Hagen}] -\unprotect - \startspecials[xetex][reset,dpx] %D Actually, there's an intermediate ``\type{xdv}'' @@ -84,4 +82,4 @@ \stopspecials -\protect \endinput +\endinput diff --git a/Master/texmf-dist/tex/context/base/status-files.pdf b/Master/texmf-dist/tex/context/base/status-files.pdf new file mode 100644 index 00000000000..fb377d90e58 Binary files /dev/null and b/Master/texmf-dist/tex/context/base/status-files.pdf differ diff --git a/Master/texmf-dist/tex/context/base/status-lua.pdf b/Master/texmf-dist/tex/context/base/status-lua.pdf new file mode 100644 index 00000000000..ac8fc6ac377 Binary files /dev/null and b/Master/texmf-dist/tex/context/base/status-lua.pdf differ diff --git a/Master/texmf-dist/tex/context/base/strc-bkm.lua b/Master/texmf-dist/tex/context/base/strc-bkm.lua index f34d83ec557..6a2cc382775 100644 --- a/Master/texmf-dist/tex/context/base/strc-bkm.lua +++ b/Master/texmf-dist/tex/context/base/strc-bkm.lua @@ -9,25 +9,56 @@ if not modules then modules = { } end modules ['strc-bkm'] = { -- Future version will support adding arbitrary bookmarks with -- associated complex actions (rather trivial to implement). +-- this should become proper separated backend code + +-- we should hook the placement into everystoptext ... needs checking + local format, concat, gsub = string.format, table.concat, string.gsub -local texsprint, utfvalues = tex.sprint, string.utfvalues +local utfvalues = string.utfvalues +local settings_to_hash = utilities.parsers.settings_to_hash + +local codeinjections = backends.codeinjections + +local trace_bookmarks = false trackers.register("references.bookmarks", function(v) trace_bookmarks = v end) -local ctxcatcodes = tex.ctxcatcodes +local report_bookmarks = logs.reporter("structure","bookmarks") -local lists = structure.lists -local levelmap = structure.sections.levelmap +local structures = structures -structure.bookmarks = structure.bookmarks or { } +structures.bookmarks = structures.bookmarks or { } -local bookmarks = structure.bookmarks +local bookmarks = structures.bookmarks +local sections = structures.sections +local lists = structures.lists + +local levelmap = sections.levelmap +local variables = interfaces.variables bookmarks.method = "internal" -- or "page" -local names, opened = "", "" +local names, opened, forced, numbered = { }, { }, { }, { } -function bookmarks.register(n,o) - if names == "" then names = n else names = names .. "," .. n end - if opened == "" then opened = o else opened = opened .. "," .. o end +function bookmarks.register(settings) + local force = settings.force == variables.yes + local number = settings.number == variables.yes + local allopen = settings.opened == variables.all + for k, v in next, settings_to_hash(settings.names or "") do + names[k] = true + if force then + forced[k] = true + if allopen then + opened[k] = true + end + end + if number then + numbered[k] = true + end + end + if not allopen then + for k, v in next, settings_to_hash(settings.opened or "") do + opened[k] = true + end + end end function bookmarks.overload(name,text) @@ -61,23 +92,32 @@ end -- todo: collect specs and collect later i.e. multiple places +local numberspec = { } + +function bookmarks.setup(spec) + -- table.merge(numberspec,spec) + for k, v in next, spec do + numberspec[k] = v + end +end + function bookmarks.place() - if names ~= "" then - local list = lists.filter(names,"all",nil,lists.collected) - local lastlevel = 1 + if next(names) then + local list = lists.filtercollected(names,"all",nil,lists.collected,forced) if #list > 0 then - local opened, levels = aux.settings_to_set(opened), { } + local levels, noflevels, lastlevel = { }, 0, 1 for i=1,#list do local li = list[i] local metadata = li.metadata local name = metadata.name - if not metadata.nolist then -- and levelmap[name] then + if not metadata.nolist or forced[name] then -- and levelmap[name] then local titledata = li.titledata if titledata then local structural = levelmap[name] lastlevel = structural or lastlevel local title = titledata.bookmark if not title or title == "" then + -- We could typeset the title and then convert it. if not structural then -- placeholder, todo: bookmarklabel title = name .. ": " .. (titledata.title or "?") @@ -85,47 +125,66 @@ function bookmarks.place() title = titledata.title or "?" end end - levels[#levels+1] = { + if numbered[name] then + local sectiondata = sections.collected[li.references.section] + local numberdata = li.numberdata + if sectiondata and numberdata and not numberdata.hidenumber then + -- we could typeset the number and convert it + title = concat(sections.typesetnumber(sectiondata,"direct",numberspec,sectiondata)) .. " " .. title + end + end + noflevels = noflevels + 1 + levels[noflevels] = { lastlevel, - stripped(title), + stripped(title), -- can be replaced by converter li.references, -- has internal and realpage allopen or opened[name] } end end end - backends.codeinjections.addbookmarks(levels,bookmarks.method) + bookmarks.finalize(levels) end function bookmarks.place() end -- prevent second run end end -lpdf.registerdocumentfinalizer(function() structure.bookmarks.place() end,1) - --- bkm ---~ function nodes.toutf(list) ---~ local t= { } ---~ for n in node.traverse(list) do ---~ local id = n.id ---~ if id == node.id("glyph") then ---~ local c = n.char ---~ local f = fonts.ids[n.font] ---~ if f then ---~ local u = f.characters[c].tounicode ---~ if u then ---~ for s in string.gmatch(u,"..") do ---~ t[#t+1] = utf.char(tonumber(s,16)) ---~ end ---~ else ---~ t[#t+1] = utf.char(c) ---~ end ---~ else ---~ t[#t+1] = utf.char(c) ---~ end ---~ elseif id == node.id("glue") then ---~ t[#t+1] = " " ---~ end ---~ end ---~ return table.concat(t,"") ---~ end ---~ print(nodes.toutf(tex.box[999].list)) +function bookmarks.flatten(levels) + -- This function promotes leading structurelements with a higher level + -- to the next lower level. Such situations are the result of lack of + -- structure: a subject preceding a chapter in a sectionblock. So, the + -- following code runs over section blocks as well. (bookmarks-007.tex) + local noflevels = #levels + if noflevels > 1 then + local skip, start, one = false, 1, levels[1] + local first, block = one[1], one[3].block + for i=2,noflevels do + local li = levels[i] + local new, newblock = li[1], li[3].block + if newblock ~= block then + first, block, start, skip = new, newblock, i, false + elseif skip then + -- go on + elseif new > first then + skip = true + elseif new < first then + for j=start,i-1 do + local lj = levels[j] + local old = lj[1] + lj[1] = new + if trace_bookmarks then + report_bookmarks("promoting entry %s from level %s to %s: %s",j,old,new,lj[2]) + end + end + skip = true + end + end + end +end + +function bookmarks.finalize(levels) + -- This function can be overloaded by an optional converter + -- that uses nodes.toutf on a typeset stream. This is something + -- that we will support when the main loop has become a coroutine. + codeinjections.addbookmarks(levels,bookmarks.method) +end diff --git a/Master/texmf-dist/tex/context/base/strc-bkm.mkiv b/Master/texmf-dist/tex/context/base/strc-bkm.mkiv index 77854738d2f..b7a5bc805eb 100644 --- a/Master/texmf-dist/tex/context/base/strc-bkm.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-bkm.mkiv @@ -50,25 +50,67 @@ \def\dobookmark[#1]#2% {\begingroup \simplifycommands - \ctxlua{structure.bookmarks.overload("#1",\!!bs\detokenize\expandafter{\normalexpanded{#2}}\!!es)}% + \ctxlua{structures.bookmarks.overload("#1",\!!bs\detokenize\expandafter{\normalexpanded{#2}}\!!es)}% \endgroup} %D Placement \unknown\ look how simple compared to \MKII: +\newtoks \everysetupbookmarks + +\def\bookmarkparameter#1{\ifcsname\??bm#1\endcsname\csname\??bm#1\endcsname\fi} + +\unexpanded\def\setupbookmarks[#1]% + {\getparameters[\??bm][#1]% + \the\everysetupbookmarks} + \unexpanded\def\placebookmarks - {\dodoubleempty\doplacebookmarks} + {\dotripleempty\doplacebookmarks} -\def\doplacebookmarks[#1][#2]% +% Use force to get titles in the bookmarklist. This is somewhat tricky as one +% does not want "Contents" in a table of contents but it has to be in the +% bookmark list. + +\def\doplacebookmarks[#1][#2][#3]% {\iflocation - \iffirstargument - \ctxlua{structure.bookmarks.register("#1","#2")}% - \else - \normalexpanded{\noexpand\placebookmarks[\getvalue{\??ih\v!content\c!list}]}% + \begingroup + \edef\askednames{#1}% + \edef\askedopened{#2}% + \ifx\askednames\empty + \edef\askednames{\getvalue{\??ih\v!content\c!list}}% + \fi + \ifx\askednames\empty + \let\askednames\v!all \fi + \ifthirdargument + \getparameters[\??bm][#3]% + \else\ifsecondargument + \doifassignmentelse{#2}{\let\askedopened\empty\getparameters[\??bm][#2]}\donothing + \fi\fi + \ctxlua{structures.bookmarks.register { + names = "\askednames", + opened = "\askedopened", + force = "\bookmarkparameter\c!force", + number = "\bookmarkparameter\c!number", + }}% + \endgroup \fi} -% \prependtoks\ctxlua{structure.bookmarks.place()}\to\everystoptext % too late -% \prependtoks\ctxlua{structure.bookmarks.place()}\to\everylastbackendshipout % okay but not nice +\setupbookmarks + [\c!force=\v!no, % it's easier to force that to inhibit + \c!number=\v!yes] % might become v!no + +\appendtoks + \ctxlua{structures.bookmarks.setup { + separatorset = "\bookmarkparameter\c!numberseparatorset", + conversionset = "\bookmarkparameter\c!numberconversionset", + starter = \!!bs\bookmarkparameter\c!numberstarter\!!es, + stopper = \!!bs\bookmarkparameter\c!numberstopper\!!es, + segments = "\bookmarkparameter\c!numbersegments", + }}% +\to \everysetupbookmarks + +% \prependtoks\ctxlua{structures.bookmarks.place()}\to\everystoptext % too late +% \prependtoks\ctxlua{structures.bookmarks.place()}\to\everylastbackendshipout % okay but not nice \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/strc-blk.lua b/Master/texmf-dist/tex/context/base/strc-blk.lua index 2589190eb5c..cbdc8c6ea36 100644 --- a/Master/texmf-dist/tex/context/base/strc-blk.lua +++ b/Master/texmf-dist/tex/context/base/strc-blk.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['strc--blk'] = { +if not modules then modules = { } end modules ['strc-blk'] = { version = 1.001, comment = "companion to strc-blk.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -8,47 +8,49 @@ if not modules then modules = { } end modules ['strc--blk'] = { -- this one runs on top of buffers and structure -local texprint, format, gmatch, find = tex.print, string.format, string.gmatch, string.find +local type = type +local gmatch, find = string.gmatch, string.find local lpegmatch = lpeg.match +local settings_to_set, settings_to_array = utilities.parsers.settings_to_set, utilities.parsers.settings_to_array +local allocate, mark = utilities.storage.allocate, utilities.storage.mark -local ctxcatcodes = tex.ctxcatcodes +local structures, context = structures, context -structure = structure or { } -structure.blocks = structure.blocks or { } +structures.blocks = structures.blocks or { } -local blocks = structure.blocks +local blocks = structures.blocks +local sections = structures.sections +local lists = structures.lists -blocks.collected = blocks.collected or { } -blocks.tobesaved = blocks.tobesaved or { } -blocks.states = blocks.states or { } +local collected = allocate() +local tobesaved = allocate() +local states = allocate() -local tobesaved, collected, states = blocks.tobesaved, blocks.collected, blocks.states +blocks.collected = collected +blocks.tobesaved = tobesaved +blocks.states = states local function initializer() - collected, tobesaved = blocks.collected, blocks.tobesaved + collected = blocks.collected + tobesaved = blocks.tobesaved end -job.register('structure.blocks.collected', structure.blocks.tobesaved, initializer) +job.register('structures.blocks.collected', tobesaved, initializer) -local printer = (lpeg.patterns.textline/texprint)^0 -- can be shared +local printer = (lpeg.patterns.textline/tex.print)^0 -- can be shared +local listitem = utilities.parsers.listitem function blocks.print(name,data,hide) if hide then - texprint(ctxcatcodes,format("\\dostarthiddenblock{%s}",name)) + context.dostarthiddenblock(name) else - texprint(ctxcatcodes,format("\\dostartnormalblock{%s}",name)) - end - if type(data) == "table" then - for i=1,#data do - texprint(data[i]) - end - else - lpegmatch(printer,data) + context.dostartnormalblock(name) end + context.viafile(data) if hide then - texprint(ctxcatcodes,"\\dostophiddenblock") + context.dostophiddenblock() else - texprint(ctxcatcodes,"\\dostopnormalblock") + context.dostopnormalblock() end end @@ -58,8 +60,8 @@ end function blocks.setstate(state,name,tag) local all = tag == "" - local tags = not all and aux.settings_to_array(tag) - for n in gmatch(name,"%s*([^,]+)") do + local tags = not all and settings_to_array(tag) + for n in listitem(name) do local sn = states[n] if not sn then -- error @@ -73,17 +75,15 @@ function blocks.setstate(state,name,tag) end end ---~ filter_collected(names, criterium, number, collected) - function blocks.select(state,name,tag,criterium) criterium = criterium or "text" if find(tag,"=") then tag = "" end - local names = aux.settings_to_set(name) + local names = settings_to_set(name) local all = tag == "" - local tags = not all and aux.settings_to_set(tag) + local tags = not all and settings_to_set(tag) local hide = state == "process" - local n = structure.sections.number_at_depth(criterium) - local result = structure.lists.filter_collected("all", criterium, n, collected) + local n = sections.numberatdepth(criterium) + local result = lists.filtercollected("all", criterium, n, collected, { }) for i=1,#result do local ri = result[i] local metadata = ri.metadata @@ -104,8 +104,8 @@ function blocks.select(state,name,tag,criterium) end function blocks.save(name,tag,buffer) -- wrong, not yet adapted - local data = buffers.data[buffer] - local tags = aux.settings_to_set(tag) + local data = buffers.getcontent(buffer) + local tags = settings_to_set(tag) local plus, minus = false, false if tags['+'] then plus = true tags['+'] = nil end if tags['-'] then minus = true tags['-'] = nil end @@ -117,7 +117,7 @@ function blocks.save(name,tag,buffer) -- wrong, not yet adapted minus = minus, }, references = { - section = structure.sections.currentid(), + section = sections.currentid(), }, data = data or "error", } @@ -142,5 +142,5 @@ function blocks.save(name,tag,buffer) -- wrong, not yet adapted end end end - buffers.data[buffer] = nil + buffers.erase(buffer) end diff --git a/Master/texmf-dist/tex/context/base/strc-blk.mkiv b/Master/texmf-dist/tex/context/base/strc-blk.mkiv index 8aa8568407f..f625fa44849 100644 --- a/Master/texmf-dist/tex/context/base/strc-blk.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-blk.mkiv @@ -23,7 +23,7 @@ % check functionality % alternative files (needs further integration elsewhere) -\def\blockparameter#1#2{\ifcsname\??tb#1#2\endcsname\csname\??tb#1#2\endcsname\fi} +\def\namedblockparameter#1#2{\ifcsname\??tb#1#2\endcsname\csname\??tb#1#2\endcsname\fi} \unexpanded\def\setupblockparameters{\dodoubleargument \dosetupblock} % fast one (for compatibility) \unexpanded\def\setupblock {\dodoubleargumentwithset\dosetupblock} % handles set @@ -41,13 +41,14 @@ \c!inner=, \c!style=, \c!file=]% todo - \ctxlua{structure.blocks.define("#1")}% - \setvalue{\e!begin#1}{\dodoubleempty\dobeginofblock[#1]}% + \ctxlua{structures.blocks.define("#1")}% + \setuvalue{\e!begin#1}{\dodoubleempty\dobeginofblock[#1]}% \letvalue{\e!end#1}\relax} \long\def\dobeginofblock[#1][#2]% {\normalexpanded{\noexpand\dodowithbuffer{@block@}{\e!begin#1}{\e!end#1}} - {}{\ctxlua{structure.blocks.save("#1","#2","@block@")}}}% before after + {}% before + {\ctxlua{structures.blocks.save("#1","#2","@block@")}}}% after \def\dostarthiddenblock {\startnointerference @@ -69,30 +70,30 @@ \edef\currentblock{#1}% \doblocksetups\currentblock \let\doblocksetups\gobbleoneargument - \blockparameter\currentblock\c!before + \namedblockparameter\currentblock\c!before \dosetfontattribute{\??tb\currentblock}\c!style \dosetcolorattribute{\??tb\currentblock}\c!color - \blockparameter\currentblock\c!inner + \namedblockparameter\currentblock\c!inner \ignorespaces} \def\dostopnormalblock {\removeunwantedspaces - \blockparameter\currentblock\c!after + \namedblockparameter\currentblock\c!after \par % todo: alternative = text, paragraph \egroup} \def\dosetblockstate[#1][#2][#3]% state name tag - {\ctxlua{structure.blocks.setstate("#1","#2","#3")}} + {\ctxlua{structures.blocks.setstate("#1","#2","#3")}} \def\doselectblocks[#1][#2][#3][#4]% state name tag setups {\bgroup \doifassignmentelse{#3} {\getparameters[\??tb\??tb][\c!criterium=\v!text,#3]% \def\doblocksetups##1{\getparameters[\??tb##1][#3]}% - \ctxlua{structure.blocks.select("#1","#2","","\@@tb@@tbcriterium")}} + \ctxlua{structures.blocks.select("#1","#2","","\@@tb@@tbcriterium")}} {\getparameters[\??tb\??tb][\c!criterium=\v!text,#4]% \def\doblocksetups##1{\getparameters[\??tb##1][#4]}% - \ctxlua{structure.blocks.select("#1","#2","#3","\@@tb@@tbcriterium")}}% + \ctxlua{structures.blocks.select("#1","#2","#3","\@@tb@@tbcriterium")}}% \egroup} % hide: save, if [+] also hidden execute diff --git a/Master/texmf-dist/tex/context/base/strc-def.mkiv b/Master/texmf-dist/tex/context/base/strc-def.mkiv index 77793c7eb7e..e386902e02c 100644 --- a/Master/texmf-dist/tex/context/base/strc-def.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-def.mkiv @@ -12,7 +12,7 @@ \writestatus{loading}{ConTeXt Structure Macros / Definitions} -% \registerctxluafile{strc-def}{1.001} +%registerctxluafile{strc-def}{1.001} \unprotect @@ -109,21 +109,30 @@ % \part{second} \chapter{gamma} \section{a} \section{b} \subsection{x} \subsection{y} \chapter{delta} % \stoptext -\definestructureseparatorset [\s!default] [] [.] -\definestructureconversionset [\s!default] [] [numbers] -\definestructureresetset [\s!default] [] [1] % each level -\definestructureprefixset [\s!default] [section-1,section-2,section-3] [] +\definestructureseparatorset [\s!default] [] [.] +\definestructureconversionset [\s!default] [] [numbers] +\definestructureresetset [\s!default] [] [1] % each level +\definestructureprefixset [\s!default] [section-1,section-2,section-3] [] -\definestructureprefixset [\v!all] [section-1,section-2,section-3,section-4,section-5,section-6,section-7,section-8] [] -\definestructureprefixset [\v!none] [] [] +\definestructureconversionset [\v!pagenumber] [] [numbers] -\definestructureprefixset [\v!part] [section-1] [] -\definestructureprefixset [\v!chapter] [section-2] [] +\definestructureprefixset [\v!all] [section-1,section-2,section-3,section-4,section-5,section-6,section-7,section-8] [] +\definestructureprefixset [\v!none] [] [] + +\definestructureprefixset [\v!part] [section-1] [] +\definestructureprefixset [\v!chapter] [section-2] [] \definestructureseparatorset [\v!appendix:\s!default] [] [.] \definestructureconversionset [\v!appendix:\s!default] [Romannumerals,Characters] [numbers] \definestructureresetset [\v!appendix:\s!default] [] [1] % why was this 0 +\setupuserpagenumber [\c!numberconversionset=\v!pagenumber] + +% \startsetups defaults:frontpart:pagenumbers:roman +% \definestructureconversionset[\c!frontpart:\c!pagenumber][][romannumerals] +% \setupuserpagenumber[\c!way=\v!byblock] +% \stopsetups + % \definesectionblock \definestructureblock [\v!frontpart] [\v!frontmatter] [\c!number=\v!no] @@ -249,6 +258,7 @@ %\c!indentnext=\v!no, \c!continue=\v!no, \c!page=\v!right, + \c!marking=\v!page, \c!header=, \c!style=\tfc, \c!distance=.75em, diff --git a/Master/texmf-dist/tex/context/base/strc-des.mkiv b/Master/texmf-dist/tex/context/base/strc-des.mkiv index 29e4ea36c80..54eba1eaa65 100644 --- a/Master/texmf-dist/tex/context/base/strc-des.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-des.mkiv @@ -70,6 +70,8 @@ \def\descriptionmainparameter #1{\csname\dodescriptionparameter{\??dd\currentdescriptionmain }#1\endcsname} \def\descriptionnumberparameter#1{\csname\dodescriptionparameter{\??dd\currentdescriptionnumber}#1\endcsname} +\def\nameddescriptionparameter #1#2{\csname\dodescriptionparameter{\??dd#1}#2\endcsname} + \def\detokenizeddescriptionparameter#1{\detokenize\expandafter\expandafter\expandafter{\csname\??dd\currentdescription#1\endcsname}} \def\dodescriptionparameter#1#2% @@ -239,10 +241,10 @@ \nobreak \@@dodescription} -\def\do@@description#1% +\def\do@@description#1% temp hack, the scope {\def\\{\crlf}% \noindent - #1{\ifhbox\descriptionheadbox\unhcopy\else\copy\fi\descriptionheadbox}% + #1[\c!scope=\v!local]{\ifhbox\descriptionheadbox\unhcopy\else\copy\fi\descriptionheadbox}% \@@dodescription} \setvalue{@@description\v!inmargin }{\do@@description\inmargin} @@ -321,8 +323,10 @@ %D A new key 'headalign' in definitions. +\newconstant\nesteddescriptionstate + \def\resetdescriptions % to be used in e.g. footnotes - {\chardef\nesteddescriptionstate\zerocount} + {\nesteddescriptionstate\zerocount} \resetdescriptions @@ -338,7 +342,7 @@ \fi \setbox\descriptionheadbox\hbox {\forgetall\dontcomplain - \trialtypesettingtrue + \settrialtypesetting \doifelsenothing{\descriptionparameter\c!sample} {\dodescriptionhandler\currentdescriptiontext}% {\dodescriptionhandler\currentdescriptionsample}}% @@ -359,9 +363,9 @@ \normalexpanded{\noexpand\indenting[\descriptionparameter\c!indenting]}% % better a system mode \ifcase\nesteddescriptionstate - \chardef\nesteddescriptionstate\plusone + \nesteddescriptionstate\plusone \or - \chardef\nesteddescriptionstate\plustwo + \nesteddescriptionstate\plustwo \fi % now happens elsewhere : \noindent\ignorespaces \@@resetdescriptionclosesymbol} @@ -374,11 +378,14 @@ \def\@@stopdescription {\@@placedescriptionclosesymbol - \par % else we loose + \doifnot{\descriptionparameter\c!display}\v!no\par + \dostoptagged + \dostoptagged \endgroup \descriptionparameter\c!after % which currentdescription is taken here? - \egroup % temporary hack - \checknextindentation[\descriptionparameter\c!indentnext] + \normalexpanded + {\egroup % temporary hack + \noexpand\checknextindentation[\descriptionparameter\c!indentnext]}% \dorechecknextindentation} \def\@@dodescription @@ -412,6 +419,8 @@ \BeforePar{\@@makedescription[#1]{#2}}% \GotoPar} +\let\dotagsetdescriptiontag\relax + \def\@@dostartdescriptionindeed {\edef\currentdescriptionlocation{\descriptionparameter\c!location}% \ifx\currentdescriptionlocation\empty @@ -420,15 +429,20 @@ \ifcsname @@description\currentdescriptionlocation\endcsname \else \let\currentdescriptionlocation\v!left \fi + \dostarttagged\t!description\currentdescription + \dostarttagged\t!descriptiontag\empty + \dotagsetdescriptiontag \@@dostartdescription - \csname @@description\currentdescriptionlocation\endcsname} % args not needed + \csname @@description\currentdescriptionlocation\endcsname + \dostoptagged + \dostarttagged\t!descriptioncontent\empty} % args not needed \def\@@makedescription[#1]#2% - {\postponenotes % new, assumes grouping - \edef\currentdescriptionreference{#1}% - \doenumerationcheckconditions - \dodescriptioncomponent[\c!reference=#1,\c!label={\descriptionparameter\c!text},\c!title={#2},\c!bookmark=,\c!list=][]% - \@@dostartdescriptionindeed} + {\postponenotes % new, assumes grouping + \edef\currentdescriptionreference{#1}% + \doenumerationcheckconditions + \dodescriptioncomponent[\c!reference=#1,\c!label={\descriptionparameter\c!text},\c!title={#2},\c!bookmark=,\c!list=][]% + \@@dostartdescriptionindeed} \def\dostartstoreddescription {\@@dostartdescriptionindeed} @@ -522,7 +536,7 @@ \fi#1} \def\@@dododescriptiontext - {\ctxlua{structure.lists.savedtitle("\currentdescriptionmain",\currentdescriptionnumberentry)}} + {\ctxlua{structures.lists.savedtitle("\currentdescriptionmain",\currentdescriptionnumberentry)}} \def\@@dodescriptiontext {\begingroup @@ -590,7 +604,7 @@ \def\dosetupenumerationcounter#1% {\edef\currentenumerationcountername{#1}% only used in the token list - \edef\currentdiscription{#1}% + \edef\currentdescription{#1}% \the\everysetupenumerationcounter} \appendtoks @@ -603,9 +617,12 @@ \def\dodefineenumerationcommands#1#2#3#4% since we use \currentdescription, we need an edef {\setevalue{\??dd#3#1\s!parent}{#4}% - \setuevalue {#3#1}{\noexpand\doenumerationcommand{#1}{#2}{#3}}% - \setuevalue{\e!start#3#1}{\noexpand\doenumerationstart {#1}{#2}{#3}}% - \setuevalue{\e!stop #3#1}{\noexpand\doenumerationstop {#1}{#2}{#3}}} + \setuevalue {#3#1}{\noexpand\doenumerationcommand {#1}{#2}{#3}}% + \setuevalue{\c!reset#3#1}{\noexpand\doresetenumerationnumber{#1}{#2}{#3}}% + %setuevalue{\c!set #3#1}{\noexpand\dosetenumerationnumber {#1}{#2}{#3}}% + \setuevalue{\e!next #3#1}{\noexpand\donextenumerationnumber {#1}{#2}{#3}}% + \setuevalue{\e!start#3#1}{\noexpand\doenumerationstart {#1}{#2}{#3}}% + \setuevalue{\e!stop #3#1}{\noexpand\doenumerationstop {#1}{#2}{#3}}} % handle enumeration @@ -643,13 +660,13 @@ \let\@@doenumerationhandler\@@dodescriptionhandler % \def\currentenumerationfullnumber -% {\ctxlua{structure.lists.savedprefixednumber("\currentdescriptionmain",\currentdescriptionnumberentry)}} +% {\ctxlua{structures.lists.savedprefixednumber("\currentdescriptionmain",\currentdescriptionnumberentry)}} \def\@@doenumerationnumber - {\ctxlua{structure.lists.savedprefixednumber("\currentdescriptionmain",\currentdescriptionnumberentry)}} + {\ctxlua{structures.lists.savedprefixednumber("\currentdescriptionmain",\currentdescriptionnumberentry)}} \def\@@dodoenumerationtext - {\ctxlua{structure.lists.savedtitle("\currentdescriptionmain",\currentdescriptionnumberentry)}} + {\ctxlua{structures.lists.savedtitle("\currentdescriptionmain",\currentdescriptionnumberentry)}} \def\doenumerationnumber {\descriptionparameter\c!left @@ -661,18 +678,32 @@ \def\@@doenumerationtext {\ifconditional\enumerationnumberenabled \iftrialtypesetting - \doenumerationfullnumber\showdntext + \doenumerationfullnumberyes \doenumerationcouplingsymbol \else \doenumerationregistercoupling - \doenumerationfullnumber\showdntext + \doenumerationfullnumberyes \doenumerationcouplingsymbol \fi \else - \doenumerationfullnumber\showdnpuretext + \doenumerationfullnumbernop \fi} -\def\doenumerationfullnumber#1% text, title +\def\doenumerationfullnumberyes % text, title + {\begingroup + \dosetdescriptionattributes\c!headstyle\c!headcolor + \the\everyenumeration + \descriptionparameter\c!command{\strut\showdntext\doenumerationnumber\doenumerationextratext}% + \endgroup} + +\def\doenumerationfullnumbernop % text, title + {\begingroup + \dosetdescriptionattributes\c!headstyle\c!headcolor + \the\everyenumeration + \descriptionparameter\c!command{\strut\showdnpuretext\doenumerationextratext}% + \endgroup} + +\def\doenumerationfullnumber#1% text, title (used in notes) .. todo {\begingroup \dosetdescriptionattributes\c!headstyle\c!headcolor \the\everyenumeration @@ -681,14 +712,15 @@ \def\doenumerationextratext {\doif{\descriptionparameter\c!title}\v!yes - {\begingroup - \dosetdescriptionattributes\c!titlestyle\c!titlecolor - \hskip\descriptionparameter\c!titledistance - \descriptionparameter\c!titlecommand - {\descriptionparameter\c!titleleft - \begstrut\@@dodoenumerationtext\endstrut - \descriptionparameter\c!titleright}% - \endgroup}} + {\doifsomething\@@dodoenumerationtext + {\begingroup + \dosetdescriptionattributes\c!titlestyle\c!titlecolor + \hskip\descriptionparameter\c!titledistance + \descriptionparameter\c!titlecommand + {\descriptionparameter\c!titleleft + \begstrut\@@dodoenumerationtext\endstrut + \descriptionparameter\c!titleright}% + \endgroup}}} \def\doenumerationsavecounter {\savestructurecounter[\currentdescriptionnumber]} \def\doenumerationrestorecounter {\restorestructurecounter[\currentdescriptionnumber]} @@ -719,7 +751,7 @@ \fi \fi} \def\skipenumerationcoupling[#1]% e.g. for questions with no answer - {\ctxlua{jobreferences.setnextorder("description","#1")}} + {\ctxlua{structures.references.setnextorder("description","#1")}} \def\showdnpuretext{\strut\descriptionparameter\c!text} % geen spatie \def\showdnlisttext{\descriptionparameter\c!listtext} % space in default @@ -745,7 +777,7 @@ \newif\ifnodescriptioncaption \def\doifelsedescriptioncomponent - {\ctxlua{structure.lists.doifstoredelse(currentdescriptionnumberentry)}} + {\ctxlua{structures.lists.doifstoredelse(currentdescriptionnumberentry)}} \def\dodescriptioncomponent {\doifelsedescriptioncomponent\nododescriptioncomponent\dododescriptioncomponent} @@ -821,11 +853,11 @@ \else %\setnextinternalreference \setnextinternalreferences{description}\currentdescriptionname % plural - \xdef\currentdescriptionnumberentry{\ctxlua{structure.lists.push{ + \xdef\currentdescriptionnumberentry{\ctxlua{structures.lists.push{ metadata = { kind = "description", name = "\currentdescriptionname", - level = structure.sections.currentlevel(), + level = structures.sections.currentlevel(), catcodes = \the\catcodetable, % \currentdirectionparameters }, @@ -835,7 +867,7 @@ reference = "\currentdescriptionreference", referenceprefix = "\referenceprefix", block = "\currentstructureblock", - section = structure.sections.currentid(), + section = structures.sections.currentid(), }, titledata = { label = \!!bs\detokenize\expandafter{\currentdescriptionlabel }\!!es, @@ -858,7 +890,7 @@ connector = \!!bs\descriptionparameter\c!prefixconnector\!!es, }, numberdata = { - numbers = structure.counters.compact("\currentdescriptionnumber",nil,true), % ! number can be cloned + numbers = structures.counters.compact("\currentdescriptionnumber",nil,true), % ! number can be cloned separatorset = "\descriptionparameter\c!numberseparatorset", conversion = "\descriptionparameter\c!numberconversion", conversionset = "\descriptionparameter\c!numberconversionset", @@ -867,11 +899,11 @@ segments = "\descriptionparameter\c!numbersegments", }, \fi - userdata = structure.helpers.touserdata(\!!bs\detokenize{#2}\!!es) + userdata = structures.helpers.touserdata(\!!bs\detokenize{#2}\!!es) } }}% - \xdef\currentdescriptionattribute {\ctxlua {tex.write(jobreferences.setinternalreference("\referenceprefix","\currentdescriptionreference",\nextinternalreference,"\@@iafocus"))}}% - \xdef\currentdescriptionsynchronize{\ctxlatelua{structure.lists.enhance(\currentdescriptionnumberentry)}}% + \xdef\currentdescriptionattribute {\ctxlua {tex.write(structures.references.setinternalreference("\referenceprefix","\currentdescriptionreference",\nextinternalreference,"\interactionparameter\c!focus"))}}% + \xdef\currentdescriptionsynchronize{\ctxlatelua{structures.lists.enhance(\currentdescriptionnumberentry)}}% \fi \endgroup} @@ -880,8 +912,8 @@ % macros. \def\reinstatedescriptionnumberentry#1% - {\xdef\currentdescriptionattribute {\ctxlua {tex.write(jobreferences.getinternalreference(#1))}}% - \xdef\currentdescriptionsynchronize{\ctxlatelua{structure.lists.enhance(#1)}}} + {\xdef\currentdescriptionattribute {\ctxlua {tex.write(structures.references.getinternalreference(#1))}}% + \xdef\currentdescriptionsynchronize{\ctxlatelua{structures.lists.enhance(#1)}}} \installstructurelistprocessor{description}{\usestructurelistprocessor{number+title}} @@ -1042,6 +1074,7 @@ \c!titleright=), \c!closesymbol=, \c!closecommand=\wordright, + \c!display=\v!yes, \c!command=, \c!titlecommand=] diff --git a/Master/texmf-dist/tex/context/base/strc-doc.lua b/Master/texmf-dist/tex/context/base/strc-doc.lua index 7faf0d5b393..d50d49b9236 100644 --- a/Master/texmf-dist/tex/context/base/strc-doc.lua +++ b/Master/texmf-dist/tex/context/base/strc-doc.lua @@ -15,32 +15,33 @@ local format, gsub, find, concat, gmatch, match = string.format, string.gsub, st local texsprint, texwrite = tex.sprint, tex.write local concat = table.concat local max, min = math.max, math.min +local allocate, mark = utilities.storage.allocate, utilities.storage.mark local ctxcatcodes = tex.ctxcatcodes local variables = interfaces.variables --~ if not trackers then trackers = { register = function() end } end -local trace_sectioning = false trackers.register("structure.sectioning", function(v) trace_sectioning = v end) -local trace_detail = false trackers.register("structure.detail", function(v) trace_detail = v end) +local trace_sectioning = false trackers.register("structures.sectioning", function(v) trace_sectioning = v end) +local trace_detail = false trackers.register("structures.detail", function(v) trace_detail = v end) -local function report(...) ---~ print(...) - logs.report("sectioning:",...) -end +local report_structure = logs.reporter("structure","sectioning") + +local structures, context = structures, context + +local helpers = structures.helpers +local documents = structures.documents +local sections = structures.sections +local lists = structures.lists +local counters = structures.counters +local sets = structures.sets +local tags = structures.tags +local processors = structures.processors -structure = structure or { } -structure.helpers = structure.helpers or { } -structure.documents = structure.documents or { } -structure.sections = structure.sections or { } -structure.sets = structure.sets or { } -structure.processors = structure.processors or { } +local sprintprocessor = processors.sprint +local ignoreprocessor = processors.ignore -local helpers = structure.helpers -local documents = structure.documents -local sections = structure.sections -local sets = structure.sets -local processors = structure.processors +local a_internal = attributes.private('internal') -- -- -- document -- -- -- @@ -73,17 +74,19 @@ documents.initialize() -- -- -- sections -- -- -- -jobsections = jobsections or { } -jobsections.collected = jobsections.collected or { } -jobsections.tobesaved = jobsections.tobesaved or { } -local collected, tobesaved = jobsections.collected, jobsections.tobesaved +local collected = allocate() +local tobesaved = allocate() + +sections.collected = collected +sections.tobesaved = tobesaved --~ local function initializer() ---~ collected, tobesaved = jobsections.collected, jobsections.tobesaved +--~ collected = sections.collected +--~ tobesaved = sections.tobesaved --~ end ---~ job.register('jobsections.collected', jobsections.tobesaved, initializer) +--~ job.register('structures.sections.collected', tobesaved, initializer) function sections.currentid() return #tobesaved @@ -106,7 +109,7 @@ end function sections.load() setmetatable(collected,nil) - local l = structure.lists.collected + local l = lists.collected for i=1,#l do local li = l[i] local lm = li.metadata @@ -129,11 +132,11 @@ setmetatable(collected, { -- -structure.sections.levelmap = structure.sections.levelmap or { } +sections.levelmap = sections.levelmap or { } -local levelmap = structure.sections.levelmap +local levelmap = sections.levelmap -storage.register("structure/sections/levelmap", structure.sections.levelmap, "structure.sections.levelmap") +storage.register("structures/sections/levelmap", sections.levelmap, "structures.sections.levelmap") sections.verbose = true @@ -156,7 +159,7 @@ function sections.getlevel(name) end function sections.way(way,by) - texsprint(ctxcatcodes,(gsub(way,"^"..by,""))) + context((gsub(way,"^"..by,""))) end function sections.setblock(name) @@ -166,7 +169,7 @@ function sections.setblock(name) end function sections.pushblock(name) - structure.counters.check(0) -- we assume sane usage of \page between blocks + counters.check(0) -- we assume sane usage of \page between blocks local block = name or data.block data.blocks[#data.blocks+1] = block data.block = block @@ -207,7 +210,7 @@ function sections.somelevel(given) -- normally these are passed as argument but nowadays we provide several -- interfaces (we need this because we want to be compatible) if trace_detail then - logs.report("structure","name '%s', mapped level '%s', old depth '%s', new depth '%s', reset set '%s'",givenname,mappedlevel,olddepth,newdepth,resetset) + report_structure("name '%s', mapped level '%s', old depth '%s', new depth '%s', reset set '%s'",givenname,mappedlevel,olddepth,newdepth,resetset) end local u = given.userdata if u then @@ -223,7 +226,7 @@ function sections.somelevel(given) for i=olddepth+1,newdepth do local s = tonumber(sets.get("structure:resets",data.block,resetset,i)) if trace_detail then - logs.report("structure","new>old (%s>%s), reset set '%s', reset value '%s', current '%s'",olddepth,newdepth,resetset,s or "?",numbers[i] or "?") + report_structure("new>old (%s>%s), reset set '%s', reset value '%s', current '%s'",olddepth,newdepth,resetset,s or "?",numbers[i] or "?") end if not s or s == 0 then numbers[i] = numbers[i] or 0 @@ -238,7 +241,7 @@ function sections.somelevel(given) for i=olddepth,newdepth+1,-1 do local s = tonumber(sets.get("structure:resets",data.block,resetset,i)) if trace_detail then - logs.report("structure","new %s",m,depth,n,o,t) + report_structure("%s @ level %i : (%s) %s -> %s",m,depth,n,o,t) elseif d.directives and d.directives.hidenumber then - commands.writestatus("structure","%s @ level %i : (%s) -> %s",m,depth,n,t) + report_structure("%s @ level %i : (%s) -> %s",m,depth,n,t) else - commands.writestatus("structure","%s @ level %i : %s -> %s",m,depth,n,t) + report_structure("%s @ level %i : %s -> %s",m,depth,n,t) end end end @@ -351,7 +360,7 @@ function sections.setnumber(depth,n) end end -function sections.number_at_depth(depth) +function sections.numberatdepth(depth) return data.numbers[tonumber(depth) or sections.getlevel(depth) or 0] or 0 end @@ -359,7 +368,7 @@ function sections.numbers() return data.numbers end -function sections.matching_till_depth(depth,numbers,parentnumbers) +function sections.matchingtilldepth(depth,numbers,parentnumbers) local dn = parentnumbers or data.numbers local ok = false for i=1,depth do @@ -382,7 +391,7 @@ end function sections.cct() local metadata = data.status[data.depth].metadata - texsprint((metadata and metadata.catcodes) or ctxcatcodes) + context(metadata and metadata.catcodes or ctxcatcodes) end function sections.structuredata(depth,key,default,honorcatcodetable) -- todo: spec table and then also depth @@ -402,20 +411,20 @@ function sections.structuredata(depth,key,default,honorcatcodetable) -- todo: sp local metadata = data.metadata texsprint((metadata and metadata.catcodes) or ctxcatcodes,d) elseif not honorcatcodetable then - texsprint(ctxcatcodes,d) + context(d) elseif type(honorcatcodetable) == "number" then texsprint(honorcatcodetable,d) elseif type(honorcatcodetable) == "string" and honorcatcodetable ~= "" then honorcatcodetable = tex[honorcatcodetable] or ctxcatcodes-- we should move ctxcatcodes to another table, ctx or so texsprint(honorcatcodetable,d) else - texsprint(ctxcatcodes,d) + context(d) end return end end if default then - texsprint(ctxcatcodes,default) + context(default) end end @@ -426,7 +435,7 @@ function sections.userdata(depth,key,default) userdata = userdata and userdata.userdata userdata = (userdata and userdata[key]) or default if userdata then - texsprint(ctxcatcodes,userdata) + context(userdata) end end end @@ -460,7 +469,7 @@ end -- -function structure.currentsectionnumber() -- brr, namespace wrong +function structures.currentsectionnumber() -- brr, namespace wrong local sc = sections.current() return sc and sc.numberdata end @@ -474,6 +483,53 @@ end -- sign=positive => also zero -- sign=hang => llap sign +--~ todo: test this +--~ + +local function process(index,numbers,ownnumbers,criterium,separatorset,conversion,conversionset,index,entry,result,preceding,done) + -- todo: too much (100 steps) + local number = numbers and (numbers[index] or 0) + local ownnumber = ownnumbers and ownnumbers[index] or "" + if number > criterium or (ownnumber ~= "") then + local block = (entry.block ~= "" and entry.block) or sections.currentblock() -- added + if preceding then + local separator = sets.get("structure:separators",block,separatorset,preceding,".") + if separator then + if result then + result[#result+1] = ignoreprocessor(separator) + else + sprintprocessor(ctxcatcodes,separator) + end + end + preceding = false + end + if result then + if ownnumber ~= "" then + result[#result+1] = ownnumber + elseif conversion and conversion ~= "" then -- traditional (e.g. used in itemgroups) .. inherited! + result[#result+1] = converters.convert(conversion,number) + else + local theconversion = sets.get("structure:conversions",block,conversionset,index,"numbers") + result[#result+1] = converters.convert(theconversion,number) + end + else + if ownnumber ~= "" then + sprintprocessor(ctxcatcodes,ownnumber) + elseif conversion and conversion ~= "" then -- traditional (e.g. used in itemgroups) + context.convertnumber(conversion,number) + else + local theconversion = sets.get("structure:conversions",block,conversionset,index,"numbers") + sprintprocessor(ctxcatcodes,theconversion,function(str) + return format("\\convertnumber{%s}{%s}",str or "numbers",number) + end) + end + end + return index, true + else + return preceding or false, done + end +end + function sections.typesetnumber(entry,kind,...) -- kind='section','number','prefix' if entry and entry.hidenumber ~= true then -- can be nil local separatorset = "" @@ -538,113 +594,92 @@ function sections.typesetnumber(entry,kind,...) -- kind='section','number','pref local numbers, ownnumbers = entry.numbers, entry.ownnumbers if numbers then local done, preceding = false, false - local function process(index) -- move to outer - -- todo: too much (100 steps) - local number = numbers and (numbers[index] or 0) - local ownnumber = ownnumbers and ownnumbers[index] or "" - if number > criterium or (ownnumber ~= "") then - local block = (entry.block ~= "" and entry.block) or sections.currentblock() -- added - if preceding then - local separator = sets.get("structure:separators",block,separatorset,preceding,".") - if separator then - processors.sprint(ctxcatcodes,separator) - end - preceding = false - end - if ownnumber ~= "" then - processors.sprint(ctxcatcodes,ownnumber) - -- elseif conversion and conversion ~= "" then - -- texsprint(ctxcatcodes,format("\\convertnumber{%s}{%s}",conversion,number)) - elseif conversion and conversion ~= "" then - -- traditional (e.g. used in itemgroups) - texsprint(ctxcatcodes,format("\\convertnumber{%s}{%s}",conversion,number)) - else - local theconversion = sets.get("structure:conversions",block,conversionset,index,"numbers") - processors.sprint(ctxcatcodes,theconversion,function(str) - return format("\\convertnumber{%s}{%s}",str or "numbers",number) - end) - end - preceding, done = index, true - else - preceding = preceding or false - end + -- + local result = kind == "direct" and { } + if result then + connector = false end -- local prefixlist = set and sets.getall("structure:prefixes","",set) -- "" == block if starter then - processors.sprint(ctxcatcodes,starter) + if result then + result[#result+1] = ignoreprocessor(starter) + else + sprintprocessor(ctxcatcodes,starter) + end end - if prefixlist and (kind == 'section' or kind == 'prefix') then + if prefixlist and (kind == 'section' or kind == 'prefix' or kind == 'direct') then -- find valid set (problem: for sectionnumber we should pass the level) - -- if kind == "section" then - -- no holes - local b, e, bb, ee = 1, #prefixlist, 0, 0 - -- find last valid number - for k=e,b,-1 do - local prefix = prefixlist[k] - local index = sections.getlevel(prefix) or k - if index >= firstprefix and index <= lastprefix then - local number = numbers and numbers[index] - if number then - local ownnumber = ownnumbers and ownnumbers[index] or "" - if number > 0 or (ownnumber ~= "") then - break - else - e = k -1 - end + -- no holes + local b, e, bb, ee = 1, #prefixlist, 0, 0 + -- find last valid number + for k=e,b,-1 do + local prefix = prefixlist[k] + local index = sections.getlevel(prefix) or k + if index >= firstprefix and index <= lastprefix then + local number = numbers and numbers[index] + if number then + local ownnumber = ownnumbers and ownnumbers[index] or "" + if number > 0 or (ownnumber ~= "") then + break + else + e = k -1 end end end - -- find valid range - for k=b,e do - local prefix = prefixlist[k] - local index = sections.getlevel(prefix) or k - if index >= firstprefix and index <= lastprefix then - local number = numbers and numbers[index] - if number then - local ownnumber = ownnumbers and ownnumbers[index] or "" - if number > 0 or (ownnumber ~= "") then - if bb == 0 then bb = k end - ee = k - else - bb, ee = 0, 0 - end + end + -- find valid range + for k=b,e do + local prefix = prefixlist[k] + local index = sections.getlevel(prefix) or k + if index >= firstprefix and index <= lastprefix then + local number = numbers and numbers[index] + if number then + local ownnumber = ownnumbers and ownnumbers[index] or "" + if number > 0 or (ownnumber ~= "") then + if bb == 0 then bb = k end + ee = k else - break + bb, ee = 0, 0 end + else + break end end - -- print valid range - for k=bb,ee do - local prefix = prefixlist[k] - local index = sections.getlevel(prefix) or k - if index >= firstprefix and index <= lastprefix then - process(index) - end + end + -- print valid range + for k=bb,ee do + local prefix = prefixlist[k] + local index = sections.getlevel(prefix) or k + if index >= firstprefix and index <= lastprefix then + -- process(index,result) + preceding, done = process(index,numbers,ownnumbers,criterium,separatorset,conversion,conversionset,index,entry,result,preceding,done) end - -- else - -- for k=1,#prefixlist do - -- local prefix = prefixlist[k] - -- local index = sections.getlevel(prefix) or k - -- if index >= firstprefix and index <= lastprefix then - -- process(index) - -- end - -- end - -- end + end else -- also holes check - for prefix=firstprefix,lastprefix do - process(prefix) + for index=firstprefix,lastprefix do + -- process(index,result) + preceding, done = process(index,numbers,ownnumbers,criterium,separatorset,conversion,conversionset,index,entry,result,preceding,done) end end -- if done and connector and kind == 'prefix' then - processors.sprint(ctxcatcodes,connector) + if result then + -- can't happen as we're in 'direct' + else + sprintprocessor(ctxcatcodes,connector) + end elseif done and stopper then - processors.sprint(ctxcatcodes,stopper) + if result then + result[#result+1] = ignoreprocessor(stopper) + else + sprintprocessor(ctxcatcodes,stopper) + end end + return result -- a table ! else - -- report("error: no numbers") + -- report_structure("error: no numbers") end end end @@ -660,7 +695,7 @@ function sections.findnumber(depth,what) local data = data.status[depth or data.depth] if data then local index = data.references.section - local collected = jobsections.collected + local collected = sections.collected local sectiondata = collected[index] if sectiondata and sectiondata.hidenumber ~= true then -- can be nil if what == variables.first then @@ -689,7 +724,7 @@ function sections.findnumber(depth,what) end end -function sections.fullnumber(depth,what,raw) +function sections.fullnumber(depth,what) local sectiondata = sections.findnumber(depth,what) if sectiondata then sections.typesetnumber(sectiondata,'section',sectiondata) diff --git a/Master/texmf-dist/tex/context/base/strc-doc.mkiv b/Master/texmf-dist/tex/context/base/strc-doc.mkiv index e10efb3f70d..683d65d2f0f 100644 --- a/Master/texmf-dist/tex/context/base/strc-doc.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-doc.mkiv @@ -22,7 +22,7 @@ % We operate in a \type {@@ns} namespace. All data is passed through % variables. Of course we can built another interface on top of this % that accepts multiple arguments. We might change this approach and -% remove this layer. +% remove this layer but it was needed for the transition. \def\currentstructurecounter{0} @@ -36,10 +36,23 @@ \getparameters % initialization, used not grouped anyway [\??ns] - [\c!number=,\c!level=,\c!name=,\c!title=,\c!bookmark=,\c!marking=,\c!list=,\c!label=,\c!coupling=,\c!ownnumber=, - \c!sectionseparatorset=\s!default,\c!sectionconversionset=\s!default, - \c!sectionstopper=,\c!sectionstarter,\c!sectionsegments=, - \c!sectionresetset=,\c!reference=, + [\c!number=, + \c!level=, + \c!name=, + \c!title=, + \c!bookmark=, + \c!marking=, + \c!list=, + \c!label=, + \c!coupling=, + \c!ownnumber=, + \c!sectionseparatorset=\s!default, + \c!sectionconversionset=\s!default, + \c!sectionstopper=, + \c!sectionstarter=, + \c!sectionsegments=, + \c!sectionresetset=, + \c!reference=, \c!expansion=\v!no, \c!xmlsetup=, \s!catcodes=, @@ -63,6 +76,7 @@ \xdef\currentstructurelabel {\structureparameter\c!label}% \xdef\currentstructurereference {\structureparameter\c!reference}% \xdef\currentstructurereferenceprefix{\structureparameter\c!referenceprefix}% + \xdef\currentstructurebackreference {\structureparameter\c!backreference}% \xdef\currentstructureshownumber {\structureparameter\c!number}% \xdef\currentstructuresaveinlist {\structureparameter\c!saveinlist}% \xdef\currentstructureincrementnumber{\structureparameter\c!incrementnumber}% @@ -102,12 +116,13 @@ \fi \setnextinternalreference \xdef\currentstructurenumber{\ctxlua{ % todo: combine with next call, adapt marks accordingly - structure.sections.somelevel { + structures.sections.somelevel { references = { internal = \nextinternalreference, block = "\currentstructureblock", reference = "\currentstructurereference", referenceprefix = "\currentstructurereferenceprefix", + backreference = "\currentstructurebackreference", }, directives = { resetset = "\structureparameter\c!sectionresetset", @@ -159,10 +174,10 @@ segments = "\structureparameter\c!sectionsegments", ownnumber = "\currentstructureownnumber", }, - userdata = structure.helpers.touserdata(\!!bs\detokenize{#2}\!!es) + userdata = structures.helpers.touserdata(\!!bs\detokenize{#2}\!!es) } }}% - \xdef\currentstructurelistnumber{\ctxlua{structure.lists.push(structure.sections.current())}}% + \xdef\currentstructurelistnumber{\ctxlua{structures.lists.push(structures.sections.current())}}% % \currentstructuresynchronize has to be called someplace, since it introduces a node \setstructuresynchronization\currentstructurelistnumber \structureparameter\c!command @@ -173,10 +188,10 @@ \let\previousstructurecounter\!!zerocount \def\setstructuresynchronization#1% - {\xdef\currentstructureattribute {\ctxlua {tex.write(jobreferences.setinternalreference("\currentstructurereferenceprefix","\currentstructurereference",\nextinternalreference,"\@@iafocus"))}}% - \xdef\currentstructuresynchronize{\ctxlatelua{structure.lists.enhance(#1)}}} + {\xdef\currentstructureattribute {\ctxlua {tex.write(structures.references.setinternalreference("\currentstructurereferenceprefix","\currentstructurereference",\nextinternalreference,"\interactionparameter\c!focus"))}}% + \xdef\currentstructuresynchronize{\ctxlatelua{structures.lists.enhance(#1)}}} -\def\reportcurrentstructure{\ctxlua{structure.sections.writestatus()}} +\def\reportcurrentstructure{\ctxlua{structures.sections.reportstructure()}} % Beware: we need to flush the data to the list explicitly. This is because % node in inserted and we may want control over when that happens. @@ -206,11 +221,12 @@ % \stopchapter % \stoptext -\def\structurevariable #1{\ctxlua{structure.sections.structuredata(nil,"#1")}} -\def\structureuservariable #1{\ctxlua{structure.sections.userdata(nil,"#1")}} -\def\structurenumber {\ctxlua{structure.sections.fullnumber()}} -\def\structurecatcodedget #1{\ctxlua{structure.sections.structuredata(nil,"#1",nil,true)}} % bad name -\def\structuregivencatcodedget#1#2{\ctxlua{structure.sections.structuredata(nil,"#1",nil,\number#2)}} % bad name -\def\structureautocatcodedget #1#2{\ctxlua{structure.sections.structuredata(nil,"#1",nil,"#2")}} +\def\structurevariable #1{\ctxlua{structures.sections.structuredata(nil,"#1")}} +\def\structureuservariable #1{\ctxlua{structures.sections.userdata(nil,"#1")}} +\def\structurenumber {\ctxlua{structures.sections.fullnumber()}} +\def\structuretitle {\ctxlua{structures.sections.title()}} +\def\structurecatcodedget #1{\ctxlua{structures.sections.structuredata(nil,"#1",nil,true)}} % bad name +\def\structuregivencatcodedget#1#2{\ctxlua{structures.sections.structuredata(nil,"#1",nil,\number#2)}} % bad name +\def\structureautocatcodedget #1#2{\ctxlua{structures.sections.structuredata(nil,"#1",nil,"#2")}} \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/strc-flt.mkii b/Master/texmf-dist/tex/context/base/strc-flt.mkii index e64a439ec39..3d07cdc2064 100644 --- a/Master/texmf-dist/tex/context/base/strc-flt.mkii +++ b/Master/texmf-dist/tex/context/base/strc-flt.mkii @@ -2035,7 +2035,7 @@ \c!nbottom=0, \c!nlines=4, \c!local=, - \c!default=\v!figure, + \c!default=, % was \v!figure but this is the location \c!numbering=\v!yes] % float strategy, replaces some of the above macros @@ -2139,5 +2139,49 @@ \def\somerightpagefloat{\placesomerightpagefloat} \def\somefacefloat {\placesomefacefloat} \def\someslotfloat {\placesomeslotfloat} - + +%D Local floats. + +\def\setuplocalfloats + {\getparameters[\??lf]} + +\setuplocalfloats + [%\c!before=\blank, + %\c!after=\blank, + \c!inbetween=\blank] + +\installfloathandler \v!local \somelocalfloat + +\initializeboxstack{localfloats} + +\newcounter\noflocalfloats + +\def\resetlocalfloats + {\doglobal\newcounter\noflocalfloats + \initializeboxstack{localfloats}} + +\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\flushlocalfloats + {\getlocalfloats + \resetlocalfloats} + +\def\getlocalfloat#1{\expanded{\foundbox{localfloats}{\number#1}}} + +\def\forcelocalfloats{\let\forcedfloatmethod\v!local} + \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/strc-flt.mkiv b/Master/texmf-dist/tex/context/base/strc-flt.mkiv index 67023d701a6..32024a27695 100644 --- a/Master/texmf-dist/tex/context/base/strc-flt.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-flt.mkiv @@ -21,12 +21,12 @@ %D strc-flt.tex and page-flt.mkiv cq. page-flt.mkii. \ifdefined\addlocalbackgroundtobox\else \def\addlocalbackgroundtobox{\resetglobal\gobbleoneargument} \fi - + \unexpanded\def\placefloats{\doflushfloats} % keep this one - + \let\currentfloat\empty -\def\letfloatparameter #1{\expandafter\csname\??fl\currentfloat#1\endcsname} +\def\letfloatparameter #1{\expandafter\let\csname\??fl\currentfloat#1\endcsname} \def\floatparameter #1{\csname\dofloatparameter{\??fl\currentfloat}#1\endcsname} \def\floatsharedparameter#1{\csname \??fl #1\endcsname} @@ -110,17 +110,18 @@ \c!textcolor=, \c!align=, \c!number=\v!yes, -% \c!prefix=\v!no, -% \c!prefixconnector=., -% \c!way=\v!by\v!chapter, -% \c!prefixsegments=2:2, -% \c!way=\@@nrway, -% \c!blockway=\@@nrblockway, -% \c!sectionnumber=\@@nrsectionnumber, -% \c!separator=\@@koseparator, -% \c!starter=\@@kostarter, -% \c!stopper=\@@kostopper, -% \c!suffix=\floatcaptionsuffix, % hook + % \c!prefix=\v!no, + % \c!prefixconnector=., + % \c!way=\v!by\v!chapter, + % \c!prefixsegments=2:2, + % \c!way=\@@nrway, + % \c!blockway=\@@nrblockway, + % \c!sectionnumber=\@@nrsectionnumber, + % \c!separator=\@@koseparator, + % \c!starter=\@@kostarter, + % \c!stopper=\@@kostopper, + \c!suffixseparator=, % currently rather hard coded + \c!suffix=\floatcaptionsuffix, \c!distance=1em, \c!conversion=\v!numbers, \c!command=] @@ -169,7 +170,7 @@ \c!local=, \c!bottombefore=, % e.g. \vfill \c!bottomafter=, - \c!default=\v!figure, + \c!default=, % default location \c!numbering=\v!yes] \def\@@bknumbering {\floatsharedparameter\c!numbering } % global one @@ -180,6 +181,7 @@ \def\@@bknlines {\floatsharedparameter\c!nlines } % global one \def\@@bkmargin {\floatsharedparameter\c!margin } % global one \def\@@bkcache {\floatsharedparameter\c!cache } % global one +\def\@@bklocation {\floatsharedparameter\c!location } % float % @@ -205,7 +207,6 @@ % \c!sectionnumber=\floatcaptionparameter\c!sectionnumber, % \c!conversion=\floatcaptionparameter\c!conversion]% - %D Individial settings: \unexpanded\def\setupfloat {\dodoubleargument\dosetupfloat} @@ -303,23 +304,35 @@ % \def\thecurrentfloatnumber % {\ifnofloatcaption \else \ifnofloatnumber \else -% % \labeltexts\currentfloat{\convertedstructurecounter[\currentfloat]}% ! ! todo: use a lua call instead % \ifx\currentfloatnumber\relax\else -% \labeltexts\currentfloat{\ctxlua{structure.lists.savednumber("\currentfloat",\currentfloatnumber)}}% +% \dostarttagged\t!floattag\empty +% \labeltexts\currentfloat{\ctxlua{structures.lists.savedprefixednumber("\currentfloat",\currentfloatnumber)}}% +% \dostoptagged % \fi % \fi \fi} +\unexpanded\def\thecurrentfloatnumbersuffix + {\doifsomething{\floatcaptionparameter\c!suffix} + {\floatcaptionparameter\c!suffixseparator + \floatcaptionparameter\c!suffix}} + \def\thecurrentfloatnumber {\ifnofloatcaption \else \ifnofloatnumber \else \ifx\currentfloatnumber\relax\else - \labeltexts\currentfloat{\ctxlua{structure.lists.savedprefixednumber("\currentfloat",\currentfloatnumber)}}% + \dostarttagged\t!floattag\empty + \labeltexts\currentfloat + {\ctxlua{structures.lists.savedprefixednumber("\currentfloat",\currentfloatnumber)}% + \thecurrentfloatnumbersuffix}% + \dostoptagged \fi \fi \fi} \def\thecurrentfloatcaption {\ifnofloatcaption \else \ifx\currentfloatnumber\relax\else - \ctxlua{structure.lists.savedtitle("\currentfloat",\currentfloatnumber)}% + \dostarttagged\t!floattext\empty + \ctxlua{structures.lists.savedtitle("\currentfloat",\currentfloatnumber)}% + \dostoptagged \fi \fi} @@ -367,11 +380,11 @@ \begingroup \dosetfloatcaptionattributes\c!style\c!color \begingroup - \dosetfloatcaptionattributes\c!headstyle\c!headcolor + \dosetfloatcaptionattributes\c!headstyle\c!headcolor \labeltexts{#1}{\preparednumber}% \endgroup \begingroup - \dosetfloatcaptionattributes\c!textstyle\c!textcolor + \dosetfloatcaptionattributes\c!textstyle\c!textcolor \dotfskip{\floatcaptionparameter\c!distance}#3% \endgroup \endgroup}% @@ -467,10 +480,10 @@ \long\def\docheckcaptioncontent#1#2% {\ifnofloatcaption \else \setbox\tempcaptionbox\hbox - {\trialtypesettingtrue + {\settrialtypesetting \notesenabledfalse \putcompletecaption{#1}{#2}}% - % new, \placefigure{\XMLflush{somecaption}}{} passes earlier empty check + % new, \placefigure{\xmlfirst{#1}{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) \ifdim\wd\tempcaptionbox=\zeropoint @@ -510,21 +523,21 @@ \newconditional\retainfloatnumber -\def\preparefloatnumber#1% +\def\preparefloatnumber#1% use in special case see below {\xdef\floatcaptionnumber{#1}% \doifelsenodelocation{\v!float\@@thenumber{#1}} - \donothing {\chardef\nodelocationmode\zerocount}% + \donothing {\nodelocationmode\zerocount}% \doifelse{\floatsharedparameter\c!numbering}\v!nocheck {\incrementnumber[#1]% \makesectionnumber[#1]% \ifconditional\retainfloatnumber\decrementnumber[#1]\fi} {\ifinsidecolumns - \chardef\nodelocationmode\zerocount + \nodelocationmode\zerocount % to be perfected: - % \chardef\nodelocationmode\plustwo + % \nodelocationmode\plustwo \fi % FOR THE MOMENT NOT AVAILABLE -\chardef\nodelocationmode\zerocount +\nodelocationmode\zerocount % BUT NOT THAT HARD TO DO \ifcase\nodelocationmode \incrementnumber[#1]% @@ -610,6 +623,7 @@ \fi \global\insidefloattrue \begingroup % ** + \dostarttagged\t!float\currentfloat \ifmarginblocks \doifinset\v!margin{#2}{\hsize\@@mbwidth}% \fi @@ -619,15 +633,17 @@ \dowithnextboxcontent % better a \the\everyfloattoks {\setlocalfloathsize \floatparameter\c!inner + \dostarttagged\t!floatcontent\empty + \aftergroup\dostoptagged % tricky, never change \dowithnextboxcontent \postponenotes} % new {\doifsomething{\floatparameter\c!criterium} {\ifdim\wd\nextbox>\floatparameter\c!criterium\relax - \edef\forcedfloatmethod{\floatvariable\c!fallback}% + \edef\forcedfloatmethod{\floatparameter\c!fallback}% \ifx\forcedfloatmethod\empty\let\forcedfloatmethod\v!here\fi \fi}% - \xdocompletefloat{#1}{#3}{#2}{#4}% ** not yet done - % we need to carry over the par because of side floats - \doifnotinset\v!text{#2}{\carryoverpar\endgroup}% + \xdocompletefloat{#1}{#3}{#2}{#4}% ** not yet done + % we need to carry over the par because of side floats + \doifnotinset\v!text{#2}{\dostoptagged\carryoverpar\endgroup}% ** \global\sidefloatdownshift \zeropoint \global\sidefloatextrashift\zeropoint \ifparfloat @@ -639,8 +655,9 @@ \def\xxdocompletefloat#1#2% {\rightorleftpageaction{\let\@@extrafloat#1}{\let\@@extrafloat#2}} -\chardef\textfloatmethod=0 % 0=raw 1=safe (.99) 2=tight (-1pt) -\chardef\sidefloatmethod=1 % 0=raw 1=safe (.99) 2=tight (-1pt) +\setnewconstant\sidefloatalign \zerocount +\setnewconstant\textfloatmethod\zerocount % 0=raw 1=safe (.99) 2=tight (-1pt) +\setnewconstant\sidefloatmethod\plusone % 0=raw 1=safe (.99) 2=tight (-1pt) \let\floatrotation\!!zerocount @@ -659,26 +676,26 @@ \fi \global\sidefloatshift\zeropoint \global\sidefloatmaximum\zeropoint - \global\chardef\sidefloatmethod\floatparameter\c!sidemethod - \global\chardef\textfloatmethod\floatparameter\c!textmethod - \global\chardef\sidefloatalign\zerocount + \global\sidefloatmethod\floatparameter\c!sidemethod + \global\textfloatmethod\floatparameter\c!textmethod + \global\sidefloatalign\zerocount \globallet\floatrotation\!!zerocount \calculatefloatskips \ifparfloat \processaction [\floatparameter\c!sidealign] - [\v!height=>\global\chardef\sidefloatalign\plusone,% - \v!line=>\global\chardef\sidefloatalign\plustwo,% (***) - \v!depth=>\global\chardef\sidefloatalign\plusthree,% - \v!grid=>\global\chardef\sidefloatalign\plusfour,% - \v!halfline=>\global\chardef\sidefloatalign\plusfive]% - % todo (test first): \doifinset\v!lokaal{#2}{\chardef\sidefloatalign\zerocount}% + [\v!height=>\global\sidefloatalign\plusone,% + \v!line=>\global\sidefloatalign\plustwo,% (***) + \v!depth=>\global\sidefloatalign\plusthree,% + \v!grid=>\global\sidefloatalign\plusfour,% + \v!halfline=>\global\sidefloatalign\plusfive]% + % todo (test first): \doifinset\v!lokaal{#2}{\global\sidefloatalign\zerocount}% \ifcase\sidefloatalign\relax % todo: optie v!lokaal => \else - \doifinset\v!height {#2}{\global\chardef\sidefloatalign\plusone}% - \doifinset\v!line {#2}{\global\chardef\sidefloatalign\plustwo}% - \doifinset\v!depth {#2}{\global\chardef\sidefloatalign\plusthree}% - \doifinset\v!grid {#2}{\global\chardef\sidefloatalign\plusfour}% - \doifinset\v!halfline{#2}{\global\chardef\sidefloatalign\plusfive}% meant for 'none' + \doifinset\v!height {#2}{\global\sidefloatalign\plusone}% + \doifinset\v!line {#2}{\global\sidefloatalign\plustwo}% + \doifinset\v!depth {#2}{\global\sidefloatalign\plusthree}% + \doifinset\v!grid {#2}{\global\sidefloatalign\plusfour}% + \doifinset\v!halfline{#2}{\global\sidefloatalign\plusfive}% meant for 'none' \fi \doifinset\v!high{#2}{\global\sidefloattopskip \zeropoint}% \doifinset\v!low {#2}{\global\sidefloatbottomskip\zeropoint}% @@ -751,9 +768,11 @@ \let\currentfloatattribute\empty % to be checked \def\floatcaptionattribute - {\iflocation \ifnofloatnumber \else \ifnofloatcaption \else + {\iflocation \ifnofloatnumber \else \ifnofloatcaption \else \ifinsidesplitfloat \else attr \destinationattribute \currentfloatattribute - \fi \fi \fi} + \fi \fi \fi \fi} + +\newconditional\usesamefloatnumber \long\def\docompletefloat#1#2#3#4#5% #1:floatclass #2:reference #3:optionlist #4:caption #5:box number {\presetfloatvariables{#1}{#3}{#2}{#5}% check this one @@ -762,24 +781,32 @@ % % \dofloatcomponent[\c!name=#1,\c!reference=#2,\c!bookmark=,\c!title={#4}][]% ifnofloatnumber ifnofloatcaption \tracefloatnumber{#1}% % - \dostructurecountercomponent - {float}% - \getcaptionparameters - \floatcaptionparameter - \detokenizedcaptionparameter - \relax - \relax - \relax - [\c!name=\currentfloat,\s!counter=\@@thestructurecounter\currentfloat,% - \s!hascaption=\ifnofloatcaption \v!no\else\v!yes\fi,% - \s!hasnumber=\ifnofloatnumber \v!no\else\v!yes\fi,% - \s!hastitle=\ifemptyfloatcaption\v!no\else\v!yes\fi,% - \c!reference=#2,\c!title={#4},\c!bookmark=]% - []% - \globallet\currentfloatnumber \laststructurecounternumber - \globallet\currentfloatattribute \laststructurecounterattribute - \globallet\currentfloatsynchronize\laststructurecountersynchronize + \ifconditional\usesamefloatnumber + \globallet\currentfloatnumber \previousfloatnumber + \globallet\currentfloatattribute \empty + \globallet\currentfloatsynchronize\relax + \else + \dostructurecountercomponent + {float}% + \getcaptionparameters + \floatcaptionparameter + \detokenizedcaptionparameter + \relax + \relax + \relax + [\c!name=\currentfloat,\s!counter=\@@thestructurecounter\currentfloat,% + \s!hascaption=\ifnofloatcaption \v!no\else\v!yes\fi,% + \s!hasnumber=\ifnofloatnumber \v!no\else\v!yes\fi,% + \s!hastitle=\ifemptyfloatcaption\v!no\else\v!yes\fi,% + \c!reference=#2,\c!title={#4},\c!bookmark=]% + []% + \globallet\previousfloatnumber \laststructurecounternumber + \globallet\currentfloatnumber \laststructurecounternumber + \globallet\currentfloatattribute \laststructurecounterattribute + \globallet\currentfloatsynchronize\laststructurecountersynchronize + \fi % + \global\setfalse\usesamefloatnumber % one shot % check float box \setnaturalfloatdimensions#5% \global\setbox\floatbox\vbox{\floatparameter\c!command{\box#5}}% @@ -798,6 +825,7 @@ \egroup % place the float \dofloat{#3}{\thecurrentfloatnumber}{\thecurrentfloatcaption}% +% \dostoptagged % tricky here, we need an extra mechanism (add to previous or so) \global\insidefloatfalse} \def\setlocalfloathsize @@ -832,7 +860,7 @@ \fi} \appendtoks - \let\rightorleftpageaction\doifrightpagefloatelse + \let\rightorleftpageaction\doifrightpagefloatelse \to \everyinsidefloat \newif\ifextrafloatactions \extrafloatactionstrue @@ -928,14 +956,14 @@ \ifextrafloatactions \ifdim\sidefloatdownshift=\zeropoint\else \global\setbox\floatbox\vbox - {\vskip\sidefloatdownshift\nointerlineskip\box\floatbox}% + {\vskip\sidefloatdownshift\nointerlineskip\box\floatbox}% \fi \doifsomething{\floatparameter\c!minwidth} {\scratchdimen\floatparameter\c!minwidth\relax \ifdim\wd\floatbox<\scratchdimen \global\setbox\floatbox\hbox to \scratchdimen {\doifnot{\floatparameter\c!location}\v!left \hss - \box\floatbox% + \box\floatbox \doifnot{\floatparameter\c!location}\v!right\hss}% \fi}% % todo: rand / rug @@ -947,8 +975,7 @@ \doifsomething{\floatparameter\c!maxwidth} {\scratchdimen\floatparameter\c!maxwidth\relax \ifdim\wd\floatbox>\scratchdimen - \doifcommonelse{\v!inright,\v!rightmargin,\v!rightedge - \v!inleft,\v!leftmargin,\v!leftedge}{#1} + \doifcommonelse{\v!inright,\v!rightmargin,\v!rightedge,\v!inleft,\v!leftmargin,\v!leftedge}{#1} {\global\sidefloatmaximum\scratchdimen} {\global\setbox\floatbox\hbox to \scratchdimen {\doifcommonelse{\v!right,\v!left}{#1} @@ -1128,8 +1155,10 @@ \doifnotinset\v!tall{#1}% {\dp\floatbox\openstrutdepth}% dp\strutbox}% % toegevoegd \box\floatbox + \dostoptagged \blank[\floatsharedparameter\c!spaceafter]% \endgroup % ** +% \dostoptagged \doinsertfloatinfo} \def\somefacefloat[#1]% links, rechts, midden, hoog, midden, laag @@ -1202,14 +1231,14 @@ \ifdefined\moveboxontogrid\else \let\movecaptionontogrid\gobblethreearguments \fi \def\locatefloatbox - {\chardef\alignstrutmode\zerocount + {\alignstrutmode\zerocount \shiftalignedline {\floatparameter\c!leftmargin }{\floatparameter\c!rightmargin}% {\floatparameter\c!innermargin}{\floatparameter\c!outermargin}% \alignedline{\floatparameter\c!location}\v!middle} \def\locatecaptionbox - {\chardef\alignstrutmode\zerocount + {\alignstrutmode\zerocount \shiftalignedline {\floatcaptionparameter\c!leftmargin }{\floatcaptionparameter\c!rightmargin}% {\floatcaptionparameter\c!innermargin}{\floatcaptionparameter\c!outermargin}% @@ -1270,7 +1299,8 @@ \locatefloat{\copy\tempfloatbox}}} \def\dopreparedocaption#1#2#3% - {\doifinsetelse{\floatcaptionparameter\c!location}{\v!top,\v!bottom} + {\dostarttagged\t!floatcaption\empty + \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 @@ -1286,7 +1316,8 @@ {\dopreparesidewidthcaption{#1}{#2}{#3}}}% new, special effects (see icare) {\doifinsetelse{\floatcaptionparameter\c!width}{\v!fit,\v!max} {\dopreparesideautocaption{#1}{#2}{#3}} - {\dopreparesidewidthcaption{#1}{#2}{#3}}}} + {\dopreparesidewidthcaption{#1}{#2}{#3}}}% + \dostoptagged} % \def\dosettempcaptionbox % {\dosetraggedvbox{\floatcaptionparameter\c!align}% @@ -1344,7 +1375,7 @@ \ifdim\captionhsize>\hsize % float is wider than \hsize \dosettempcaptionbox - {\trialtypesettingtrue + {\settrialtypesetting \hsize\captionhsize \notesenabledfalse \putcompletecaption{#2}{#3}}% @@ -1368,7 +1399,7 @@ \edef\captionhsize{\the\scratchdimen}% \fi \setbox\scratchbox\vbox % test with overshoot - {\trialtypesettingtrue + {\settrialtypesetting \scratchdimen\captionhsize \advance\scratchdimen \captionovershoot \advance\scratchdimen 3em % an average word length @@ -1720,7 +1751,7 @@ \newif\ifpostponecolumnfloats \postponecolumnfloatsfalse % don't change -\chardef\postcenterfloatmethod\plusone +\setnewconstant\postcenterfloatmethod\plusone \def\postcenterfloatbox#1% {\scratchdimen @@ -1796,7 +1827,7 @@ \let\locatecaption\relax \def\locatesidefloat##1% {\begingroup - \chardef\alignstrutmode\zerocount + \alignstrutmode\zerocount \hsize\tempfloatwidth \forgetall \alignedline{\floatparameter\c!location}\v!middle{##1}% \endgroup}% @@ -1859,25 +1890,34 @@ % float strategy, replaces some of the above macros \let\floatmethod \empty +\let\floatlabel \empty \let\floatcolumn \empty \let\floatrow \empty \let\forcedfloatmethod\empty +% \def\setfloatmethodvariables#1% +% {\getfromcommalist[#1][1]% +% \@EA\beforesplitstring\commalistelement\at:\to\floatmethod +% \@EA\aftersplitstring \commalistelement\at:\to\floatcolumn +% \@EA\aftersplitstring \floatcolumn\at*\to\floatrow +% \@EA\beforesplitstring\floatcolumn\at*\to\floatcolumn} + +\def\setfloatmethodvariables#1% \floatmethod \floatlabel \floatrow \floatcolumn + {\ctxlua{floats.analysemethod("#1")}} + \def\dogetfloatbox#1#2% {\ifvisible - \doifelsenothing{#2} - {\getfromcommalist[#1][1]% - \@EA\beforesplitstring\commalistelement\at:\to\floatmethod - \@EA\aftersplitstring \commalistelement\at:\to\floatcolumn - \@EA\aftersplitstring \floatcolumn\at*\to\floatrow - \@EA\beforesplitstring\floatcolumn\at*\to\floatcolumn - % todo: nog algemeen otr - \ifdefined\OTRSETsetpreferedcolumnslot - \OTRSETsetpreferedcolumnslot\floatcolumn\floatrow - \fi} - {\let\floatcolumn\empty - \let\floatrow\empty - \edef\floatmethod{#2}}% + \let \floatlabel \empty + \let \floatcolumn\empty + \let \floatrow \empty + \edef\floatmethod{#2}% + \ifx\floatmethod\empty + \setfloatmethodvariables{#1}% + % todo: nog algemeen otr + \ifdefined\OTRSETsetpreferedcolumnslot + \OTRSETsetpreferedcolumnslot\floatcolumn\floatrow + \fi + \fi \doifundefined{\string\floatmethod\floatmethod} {\let\floatmethod\v!here}% \doifsomething\forcedfloatmethod @@ -1889,6 +1929,9 @@ \def\installfloathandler#1#2% #1=keyword #2=handler {\setvalue{\string\floatmethod#1}{#2}} +\def\somesomewherefloat[#1]% + {\dofloatssavesomewherefloat\s!somewhere{#1}} + \installfloathandler \v!here \someherefloat \installfloathandler \v!force \somefixdfloat \installfloathandler \v!left \someleftsidefloat @@ -1910,6 +1953,8 @@ \installfloathandler \v!leftedge \someinleftedgefloat \installfloathandler \v!rightedge \someinrightedgefloat +\installfloathandler \v!somewhere \somesomewherefloat + \installfloathandler \v!backspace \somebackspacefloat \installfloathandler \v!cutspace \somecutspacefloat @@ -1953,6 +1998,7 @@ \unexpanded\def\placesomebotsfloat {\OTRcommand\somebotsfloat} \unexpanded\def\placesomesidefloat {\OTRcommand\somesidefloat} \unexpanded\def\placesomefacefloat {\OTRcommand\somefacefloat} +%unexpanded\def\placesomesomewherefloat{\OTRcommand\somesomewherefloat} \def\somefixdfloat {\placesomefixdfloat} \def\somepagefloat {\placesomepagefloat} @@ -1960,5 +2006,49 @@ \def\somerightpagefloat{\placesomerightpagefloat} \def\somefacefloat {\placesomefacefloat} \def\someslotfloat {\placesomeslotfloat} - + +%D Local floats: + +\def\setuplocalfloats + {\getparameters[\??lf]} + +\setuplocalfloats + [%\c!before=\blank, + %\c!after=\blank, + \c!inbetween=\blank] + +\installfloathandler \v!local \somelocalfloat + +\initializeboxstack{localfloats} + +\newcounter\noflocalfloats + +\def\resetlocalfloats + {\doglobal\newcounter\noflocalfloats + \initializeboxstack{localfloats}} + +\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\flushlocalfloats + {\getlocalfloats + \resetlocalfloats} + +\def\getlocalfloat#1{\expanded{\foundbox{localfloats}{\number#1}}} + +\def\forcelocalfloats{\let\forcedfloatmethod\v!local} + \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/strc-ini.lua b/Master/texmf-dist/tex/context/base/strc-ini.lua index 61c26a20eed..a9013c641a3 100644 --- a/Master/texmf-dist/tex/context/base/strc-ini.lua +++ b/Master/texmf-dist/tex/context/base/strc-ini.lua @@ -24,60 +24,76 @@ local format, concat, match = string.format, table.concat, string.match local count, texwrite, texprint, texsprint = tex.count, tex.write, tex.print, tex.sprint local type, next, tonumber, tostring = type, next, tonumber, tostring local lpegmatch = lpeg.match +local settings_to_array, settings_to_hash = utilities.parsers.settings_to_array, utilities.parsers.settings_to_hash +local allocate = utilities.storage.allocate local ctxcatcodes, xmlcatcodes, notcatcodes = tex.ctxcatcodes, tex.xmlcatcodes, tex.notcatcodes -- tricky as we're in notcatcodes -local trace_processors = false trackers.register("structure.processors", function(v) trace_processors = v end) +local trace_processors = false trackers.register("structures.processors", function(v) trace_processors = v end) + +local report_processors = logs.reporter("structure","processors") -- move this -commands = commands or { } +commands = commands or { } +local commands = commands -function commands.first_in_list(str) +function commands.firstinlist(str) local first = match(str,"^([^,]+),") texsprint(ctxcatcodes,first or str) end -- -- -- namespace -- -- -- -structure = structure or { } - --- -- -- cache -- -- -- - -structure.shares = structure.shares or { } -structure.shares.cache = structure.shares.cache or { } - -local shares = structure.shares -local cache = shares.cache - -function shares.put(data) - cache[#cache+1] = data - return #cache -end - -function shares.get(n) -- n can be string - n = tonumber(n) or -1 - return cache[n] -end +-- This is tricky: we have stored and initialized already some of +-- the job.registered tables so we have a forward reference! + +structures = structures or { } +local structures = structures + +structures.blocks = structures.blocks or { } +structures.sections = structures.sections or { } +structures.pages = structures.pages or { } +structures.registers = structures.registers or { } +structures.references = structures.references or { } +structures.lists = structures.lists or { } +structures.helpers = structures.helpers or { } +structures.processors = structures.processors or { } +structures.documents = structures.documents or { } +structures.notes = structures.notes or { } +structures.descriptions = structures.descriptions or { } +structures.itemgroups = structures.itemgroups or { } +structures.specials = structures.specials or { } +structures.counters = structures.counters or { } +structures.tags = structures.tags or { } +structures.formulas = structures.formulas or { } +structures.sets = structures.sets or { } +structures.marks = structures.marks or { } +structures.floats = structures.floats or { } +structures.synonyms = structures.synonyms or { } + +--~ table.print(structures) -- -- -- specials -- -- -- -- we can store information and get back a reference; this permits -- us to store rather raw data in references -local specials = { } structure.specials = specials +local specials = structures.specials -specials.collected = specials.collected or { } -specials.tobesaved = specials.collected or { } +local collected = allocate() +local tobesaved = allocate() -local collected, tobesaved = specials.collected, specials.tobesaved +specials.collected = collected +specials.tobesaved = tobesaved local function initializer() - collected, tobesaved = specials.collected, specials.tobesaved + collected = specials.collected + tobesaved = specials.tobesaved end if job then - job.register('structure.specials.collected', structure.specials.tobesaved, initializer) + job.register('structures.specials.collected', tobesaved, initializer) end function specials.store(class,data) @@ -103,12 +119,10 @@ end -- -- -- helpers -- -- -- -structure.helpers = structure.helpers or { } - -local helpers = structure.helpers +local helpers = structures.helpers function helpers.touserdata(str) - local hash = str and str ~= "" and aux.settings_to_hash(str) + local hash = str and str ~= "" and settings_to_hash(str) if hash and next(hash) then return hash end @@ -129,8 +143,6 @@ local function simplify(d,nodefault) t[k] = v end end ---~ print(table.serialize(d,"before")) ---~ print(table.serialize(t,"after")) return next(t) and t elseif nodefault then return nil @@ -158,21 +170,43 @@ local tags = { entry = "ctx:registerentry", } -function helpers.title(title,metadata) -- brrr - if title and title ~= "" then +-- We had the following but it overloads the main document so it's a no-go as we +-- no longer push and pop. So now we use the tag as buffername, namespace and also +-- (optionally) as a setups to be applied but keep in mind that document setups +-- also get applied (when they use #1's). +-- +-- local command = format("\\xmlprocessbuffer{%s}{%s}{}",metadata.xmlroot or "main",tag) + +function helpers.title(title,metadata) -- coding is xml is rather old and not that much needed now + if title and title ~= "" then -- so it might disappear if metadata then + local xmlsetup = metadata.xmlsetup if metadata.coding == "xml" then - tag = tags[metadata.kind] or tags.generic - buffers.set(tag,format("<%s>%s",tag,title,tag)) - texsprint(ctxcatcodes,format("\\xmlprocessbuffer{%s}{%s}{}",metadata.xmlroot or "main",tag)) - elseif metadata.xmlsetup then - texsprint(ctxcatcodes,format("\\xmlsetup{%s}{%s}",title,metadata.xmlsetup)) -- nasty + -- title can contain raw xml + local tag = tags[metadata.kind] or tags.generic + local xmldata = format("<%s>%s",tag,title,tag) + buffers.assign(tag,xmldata) + if trace_processors then + report_processors("putting xml data in buffer: %s",xmldata) + report_processors("processing buffer with setup '%s' and tag '%s'",xmlsetup or "",tag) + end + context.xmlprocessbuffer("dummy",tag,xmlsetup or "") + elseif xmlsetup then -- title is reference to node (so \xmlraw should have been used) + if trace_processors then + report_processors("feeding xmlsetup '%s' using node '%s'",xmlsetup,title) + end + context.xmlsetup(title,metadata.xmlsetup) else local catcodes = metadata.catcodes ---~ print(tex.ctxcatcodes,tex.xmlcatcodes,catcodes,title) if catcodes == notcatcodes or catcodes == xmlcatcodes then - texsprint(ctxcatcodes,title) -- nasty + if trace_processors then + report_processors("cct: %s (overloads %s), txt: %s",ctxcatcodes,catcodes,title) + end + context(title) -- nasty else + if trace_processors then + report_processors("cct: %s, txt: %s",catcodes,title) + end texsprint(catcodes,title) end end @@ -182,9 +216,9 @@ function helpers.title(title,metadata) -- brrr end end --- -- -- processors -- -- -- syntax: processor->data +-- -- -- processors -- -- -- syntax: processor->data ... not ok yet -local processors = { } structure.processors = processors +local processors = structures.processors local registered = { } @@ -207,7 +241,7 @@ function processors.split(str) end end -function processors.sprint(catcodes,str,fnc,...) +function processors.sprint(catcodes,str,fnc,...) -- not ok: mixed local p, s = lpegmatch(splitter,str) local code if registered[p] then @@ -216,7 +250,7 @@ function processors.sprint(catcodes,str,fnc,...) code = (fnc and fnc(str,...)) or str end if trace_processors then - logs.report("processors","cct: %s, seq: %s",catcodes,code) + report_processors("cct: %s, seq: %s",catcodes,code) end texsprint(catcodes,code) end @@ -230,14 +264,19 @@ function processors.apply(str) end end +function processors.ignore(str) + local p, s = lpegmatch(splitter,str) + return s or str +end + -- -- -- sets -- -- -- -structure.sets = structure.sets or { } -structure.sets.setlist = structure.sets.setlist or { } +local sets = structures.sets + +sets.setlist = sets.setlist or { } -storage.register("structure/sets/setlist", structure.sets.setlist, "structure.sets.setlist") +storage.register("structures/sets/setlist", structures.sets.setlist, "structures.sets.setlist") -local sets = structure.sets local setlist = sets.setlist function sets.define(namespace,name,values,default,numbers) @@ -249,7 +288,7 @@ function sets.define(namespace,name,values,default,numbers) if values == "" then dn[name] = { { }, default } else - local split = aux.settings_to_array(values) + local split = settings_to_array(values) if numbers then -- convert to numbers (e.g. for reset) for i=1,#split do diff --git a/Master/texmf-dist/tex/context/base/strc-ini.mkiv b/Master/texmf-dist/tex/context/base/strc-ini.mkiv index 5ed7b423c3a..b1b11d8718a 100644 --- a/Master/texmf-dist/tex/context/base/strc-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-ini.mkiv @@ -17,12 +17,6 @@ \unprotect -% \def\zerosection{0} -% \def\resetsectionmarks{} -% \setuppagenumbering - -% maybe use structurecomponent more consistently as name below - % segments: 0:100 2:3 chapter:subsection 3 (=self+2) (alternative: sectionset) % section : [sectionnumber(s)] @@ -76,10 +70,10 @@ \unexpanded\def\definestructureconversionset{\dotripleempty\dodefinestructureconversionset} \unexpanded\def\definestructureprefixset {\dotripleempty\dodefinestructureprefixset} -\def\dodefinestructureresetset [#1][#2][#3]{\ctxlua{structure.sets.define("structure:resets", "#1","\luaescapestring{\detokenize{#2}}","\luaescapestring{\detokenize{#3}}",true)}} -\def\dodefinestructureseparatorset [#1][#2][#3]{\ctxlua{structure.sets.define("structure:separators", "#1","\luaescapestring{\detokenize{#2}}","\luaescapestring{\detokenize{#3}}")}} -\def\dodefinestructureconversionset[#1][#2][#3]{\ctxlua{structure.sets.define("structure:conversions","#1","\luaescapestring{\detokenize{#2}}","\luaescapestring{\detokenize{#3}}")}} -\def\dodefinestructureprefixset [#1][#2][#3]{\ctxlua{structure.sets.define("structure:prefixes", "#1","\luaescapestring{\detokenize{#2}}","\luaescapestring{\detokenize{#3}}")}} +\def\dodefinestructureresetset [#1][#2][#3]{\ctxlua{structures.sets.define("structure:resets", "#1","\luaescapestring{\detokenize{#2}}","\luaescapestring{\detokenize{#3}}",true)}} +\def\dodefinestructureseparatorset [#1][#2][#3]{\ctxlua{structures.sets.define("structure:separators", "#1","\luaescapestring{\detokenize{#2}}","\luaescapestring{\detokenize{#3}}")}} +\def\dodefinestructureconversionset[#1][#2][#3]{\ctxlua{structures.sets.define("structure:conversions","#1","\luaescapestring{\detokenize{#2}}","\luaescapestring{\detokenize{#3}}")}} +\def\dodefinestructureprefixset [#1][#2][#3]{\ctxlua{structures.sets.define("structure:prefixes", "#1","\luaescapestring{\detokenize{#2}}","\luaescapestring{\detokenize{#3}}")}} % \definestructureseparatorset [weird][!,?,*][:] % tex content % \definestructureconversionset[weird][numbers,characters,romannumerals][numbers] % symbolic names diff --git a/Master/texmf-dist/tex/context/base/strc-itm.lua b/Master/texmf-dist/tex/context/base/strc-itm.lua index e776f326d1c..1c7c2adb59e 100644 --- a/Master/texmf-dist/tex/context/base/strc-itm.lua +++ b/Master/texmf-dist/tex/context/base/strc-itm.lua @@ -6,10 +6,9 @@ if not modules then modules = { } end modules ['strc-itm'] = { license = "see context related readme files" } -structure = structure or { } -structure.itemgroups = structure.itemgroups or { } - -local itemgroups = structure.itemgroups +local structures = structures +local itemgroups = structures.itemgroups +local jobpasses = job.passes function itemgroups.register(name,nofitems,maxwidth) jobpasses.savedata("itemgroup", { nofitems, maxwidth }) diff --git a/Master/texmf-dist/tex/context/base/strc-itm.mkiv b/Master/texmf-dist/tex/context/base/strc-itm.mkiv index 7207494ed49..67f42f86672 100644 --- a/Master/texmf-dist/tex/context/base/strc-itm.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-itm.mkiv @@ -15,6 +15,9 @@ \registerctxluafile{strc-itm}{1.001} +% this will be reimplemented: \startitem ... \stopitem will be the main macros and +% \item will then call them + \unprotect \newconditional\sublistitem \setfalse\sublistitem @@ -43,7 +46,7 @@ \newcount\noflistelements \newcount\itemcolumndepth \newcount\itemdepth -\newcount\maxitemdepth \maxitemdepth=6 +% \newcount\maxitemdepth \maxitemdepth=6 \newdimen\itemgrouplistwidth \newdimen\itemgroupaskedwidth @@ -59,19 +62,20 @@ \def\dolistreference {\iftrialtypesetting \else % no need for different treatment of \continuelistitems - \ctxlua{structure.itemgroups.register("\currentitemgroup",\number\noflistelements,"\getitemparameter\currentitemlevel\c!maxwidth")}% + \ctxlua{structures.itemgroups.register("\currentitemgroup",\number\noflistelements,"\getitemparameter\currentitemlevel\c!maxwidth")}% \fi} \def\checkcurrentnofitems % we could do this at the lua end and save a call - {\edef\currentnofitems {\ctxlua{structure.itemgroups.nofitems("\currentitemgroup",\number\currentnoflists)}}% - \edef\currentitemmaxwidth{\ctxlua{structure.itemgroups.maxwidth("\currentitemgroup",\number\currentnoflists)}\scaledpoint}} + {\edef\currentnofitems {\ctxlua{structures.itemgroups.nofitems("\currentitemgroup",\number\currentnoflists)}}% + \edef\currentitemmaxwidth{\ctxlua{structures.itemgroups.maxwidth("\currentitemgroup",\number\currentnoflists)}\scaledpoint}} % todo: \dodosetreference -> \dostructurecountercomponent (to be checked) \def\dohandleitemreference % we will make a decent number helper {\ifx\currentitemreference \empty \else +\iftrialtypesetting \else \setnextinternalreference - \ctxlua { jobreferences.setandgetattribute("\s!full", "\referenceprefix","\currentitemreference", + \ctxlua {structures.references.setandgetattribute("\s!full", "\referenceprefix","\currentitemreference", { metadata = { kind = "item",% ? @@ -80,9 +84,9 @@ }, references = { internal = \nextinternalreference, - section = structure.sections.currentid(), + section = structures.sections.currentid(), }, - prefixdata = structure.helpers.simplify { + prefixdata = structures.helpers.simplify { prefix = "\structurecounterparameter\currentitemgroupcounter\c!prefix", separatorset = "\structurecounterparameter\currentitemgroupcounter\c!prefixseparatorset", conversion = \!!bs\structurecounterparameter\currentitemgroupcounter\c!prefixconversion\!!es, @@ -92,8 +96,8 @@ % segments = "\askedprefixsegments", connector = \!!bs\structurecounterparameter\currentitemgroupcounter\c!prefixconnector\!!es, }, - numberdata = structure.helpers.simplify { - numbers = structure.counters.compact("\currentitemgroupcounter",nil,true), + numberdata = structures.helpers.simplify { + numbers = structures.counters.compact("\currentitemgroupcounter",nil,true), separatorset = "\structurecounterparameter\currentitemgroupcounter\c!numberseparatorset", conversion = "\structurecounterparameter\currentitemgroupcounter\c!numberconversion", conversionset = "\structurecounterparameter\currentitemgroupcounter\c!numberconversionset", @@ -104,10 +108,10 @@ }) }% \xdef\currentitemattribute{\number\lastdestinationattribute}% - \begingroup\attribute\destinationattribute\currentitemattribute\kern\zeropoint\endgroup % todo + \begingroup\attribute\destinationattribute\currentitemattribute\kern\zeropoint\endgroup % todo, apply attribute to symbol +\fi \fi} - % \startitemize[n,packed] % \item test \item test \item test % \stopitemize @@ -198,10 +202,11 @@ % so we have: \def\initializeitemgrouplevel#1% - {\ifcsname\??op\currentitemgroup#1\s!parent\endcsname + {\ifcsname\??op\currentitemgroup\number#1\s!parent\endcsname % ok \else - \setevalue{\??op\currentitemgroup#1\s!parent}{\??op\currentitemgroup}% + \setxvalue{\??op\currentitemgroup \c!levels}{\number#1}% + \setxvalue{\??op\currentitemgroup\number#1\s!parent}{\??op\currentitemgroup}% \fi} \unexpanded\def\defineitemgroup @@ -211,15 +216,15 @@ {\doifsomething{#1} {\pushmacro\currentitemgroup \def\currentitemgroup{#1}% - \setvalue{\e!start#1}{\startitemgroup[#1]}% - \setvalue{\e!stop#1}{\stopitemgroup}% - \setvalue{\e!setup#1\e!endsetup}{\setupitemgroup[#1]}% for old times sake + \setuvalue{\e!start#1}{\startitemgroup[#1]}% + \setuvalue{\e!stop#1}{\stopitemgroup}% + \setuvalue{\e!setup#1\e!endsetup}{\setupitemgroup[#1]}% for old times sake \doifelsenothing{#2} {\getparameters[\??op#1][\s!parent=\??oo,#3]}% {\doifassignmentelse{#2} {\getparameters[\??op#1][\s!parent=\??oo,#2]}% {\getparameters[\??op#1][\s!parent=\??op#2,#3]}}% - \dorecurse\maxitemdepth{\initializeitemgrouplevel\recurselevel}% + \dorecurse{\itemparameter\empty\c!levels}{\initializeitemgrouplevel\recurselevel}% \definestructurecounter[itemgroup:#1]% \popmacro\currentitemgroup}} @@ -310,10 +315,13 @@ % \empty \else \getitemparameter\currentitemlevel\c!before - \fi\fi} + \fi\fi + \dostarttagged\t!itemgroup\currentitemgroup + \dotagsetitemize} \def\itemaftercommand - {\ifconditional\nowhitelistitem + {\dostoptagged + \ifconditional\nowhitelistitem \ifconditional\afterlistitem \ifcase\currentitemlevel\or\getitemparameter\currentitemlevel\c!after\fi \else @@ -352,7 +360,7 @@ \getitemparameter\currentitemlevel\c!afterhead \fi\fi} -\def\dododododosetupitemgroup[#1][#2]% +\unexpanded\def\dododododosetupitemgroup[#1][#2]% prevent expansion below {\doifassignmentelse{#2}% {\dosetupitemgroupvariable[#1][#2]}% {\setitemparameter{#1}\c!option{#2}}}% @@ -360,19 +368,8 @@ \def\dodododosetupitemgroup[#1][#2]% {\doifsomething{#2} {\doifelse{#1}\v!each - {\dorecurse\maxitemdepth{\normalexpanded{\noexpand\dododododosetupitemgroup[\recurselevel]}[#2]}} - {\normalexpanded{\noexpand\dododododosetupitemgroup[#1]}[#2]}}} - -% \def\dododosetupitemgroup[#1][#2]% -% {\doifelsenothing{#2} -% {\doifelsenothing{#1} -% {\dodododosetupitemgroup[\currentitemlevel][#2]} -% {\dodododosetupitemgroup[#1][#2]}} -% {\ifcase\currentitemlevel\relax -% \dodododosetupitemgroup[\v!each][#1]% -% \else -% \dodododosetupitemgroup[\currentitemlevel][#1]% -% \fi}} + {\dorecurse{\itemparameter\empty\c!levels}{\normalexpanded{\dododododosetupitemgroup[\recurselevel]}[#2]}} + {\normalexpanded{\dododododosetupitemgroup[#1]}[#2]}}} \def\dododosetupitemgroup[#1][#2]% {\doifelsenothing{#2} @@ -531,13 +528,8 @@ \def\dodostartitemgroup[#1]% [#2]% {\relax % prevents lookahead - \ifnum\currentitemlevel=\maxitemdepth\relax - \showmessage\m!layouts9{\number\maxitemdepth}% - \let\itemincrement\zerocount - \else - \let\itemincrement\plusone - \fi - \global\advance\itemdepth\itemincrement + \global\advance\itemdepth\plusone + \initializeitemgrouplevel\itemdepth \xdef\currentitemlevel{\number\itemdepth}% \edef\itemgroupoptions{\getitemparameter\currentitemlevel\c!option}% \ifx\itemgroupoptions\empty @@ -575,7 +567,7 @@ \@EA\long\@EA\def\@EA\collectitemgroupitem\@EA#\@EA1\csname\e!stop\v!item\endcsname {\increment\itemcollectcounter - \long\setvalue{\v!item*\itemcollectcounter}{\item#1\par}} + \long\setvalue{\v!item*\itemcollectcounter}{\startitemgroupitem#1\stopitemgroupitem}} \def\flushcollecteditems {\ifconditional\randomizeitems @@ -622,6 +614,8 @@ \let\currentitemindenting\empty +\let\dotagsetitemize\relax + \def\redostartitemgroup[#1][#2]% {\setfalse\inlinelistitem % new, no indent (leftskip) \setfalse\concatnextitem % new, concat @@ -649,6 +643,9 @@ \doifinsetelse\v!random {#1}{\settrue\randomizeitems }{\setfalse\randomizeitems }% \doifinsetelse\v!continue{#1}{\settrue\continuelistitems}{\setfalse\continuelistitems}% % == \doifinsetelse\v!intro{#1}\settrue\setfalse\introlistitem +\iftrialtypesetting + \savestructurecounter[\currentitemgroupcounter]%[\currentitemlevel]% todo: per level +\fi \global\advance\noflists\plusone \currentnoflists\noflists \noflistelements\zerocount @@ -761,6 +758,11 @@ % \item \input ward \item \input ward \item \input ward % \stopitemize \blank +\def\dorestoreitemgroup + {\restorestructurecounter[\currentitemgroupcounter]% [\currentitemlevel]% todo: per level + \global\advance\noflists\minusone + \currentnoflists\noflists} + \unexpanded\def\stopitemgroup {\stopcollectitems \ifconditional\textlistitem @@ -769,7 +771,12 @@ \par \fi \dolistreference - \ifconditional\firstlistitem \else \endgroup \fi % toegevoegd, eerste \som opent groep + \ifconditional\firstlistitem + \else + \dostoptagged + \dostoptagged + \endgroup + \fi % toegevoegd, eerste \som opent groep \ifnum\itemcolumndepth=\currentitemlevel\relax \stopcolumns \global\itemcolumndepth\zerocount @@ -791,14 +798,17 @@ \fi \fi % new test, needed in sidefloats (surfaced in volker's proceedings) +\iftrialtypesetting + \dorestoreitemgroup +\fi \ifconditional\textlistitem % else forgotten \endgroup - \global\advance\itemdepth-\itemincrement + \global\advance\itemdepth-\plusone \xdef\currentitemlevel{\number\itemdepth}% \egroup \else \endgroup - \global\advance\itemdepth-\itemincrement + \global\advance\itemdepth-\plusone \xdef\currentitemlevel{\number\itemdepth}% \egroup \par @@ -889,14 +899,33 @@ % % so we need to keep that property +\let\startitemgroupitem\itemgroupitem + +\def\stopitemgroupitem + {\ifconditional\textlistitem + % nothing + \else + \endgraf + \fi} + +\def\startitemgroupitemhead#1% + {\itemgrouphead#1\par} + +\def\stopitemgroupitemhead + {\ifconditional\textlistitem + % to be tested + \else + \endgraf + \fi} + \appendtoks - \letvalue{\e!start\v!item}\itemgroupitem - \letvalue{\e!stop \v!item}\endgraf + \letvalue{\e!start\v!item}\startitemgroupitem + \letvalue{\e!stop \v!item}\stopitemgroupitem \to \itemgroupcommands \appendtoks - \setvalue{\e!start\v!head}#1{\itemgrouphead#1\par}% - \letvalue{\e!stop \v!head}\endgraf + \letvalue{\e!start\v!head}\startitemgroupitemhead + \letvalue{\e!stop \v!head}\stopitemgroupitemhead \to \itemgroupcommands % \startitemize @@ -1043,15 +1072,15 @@ \fi \ifdim\currentitemmaxwidth>\zeropoint \setbox\itemgroupitembox\simplealignedbox - {\getitemparameter\currentitemlevel\c!itemalign} {\dimexpr\currentitemmaxwidth+\getitemparameter\currentitemlevel\c!distance\relax} + {\getitemparameter\currentitemlevel\c!itemalign} {\box\itemgroupitembox\hskip\getitemparameter\currentitemlevel\c!distance}% \fi \else\ifdim\itemgroupaskedwidth>\zeropoint \doifsomething{\getitemparameter\currentitemlevel\c!itemalign} {\setbox\itemgroupitembox\simplealignedbox - {\getitemparameter\currentitemlevel\c!itemalign} {\dimexpr\itemgroupaskedwidth+\getitemparameter\currentitemlevel\c!distance\relax} + {\getitemparameter\currentitemlevel\c!itemalign} {\box\itemgroupitembox\hskip\getitemparameter\currentitemlevel\c!distance}}% \fi\fi \globallet\doitemdestination\empty @@ -1140,7 +1169,10 @@ % \setupitemize[each][atmargin][width=3em] % \startitemize[n,repeat,packed] \getbuffer \stopitemize -\chardef\autoitemgroupspacing=2 % 0 = voor/na, 1=tussen als geen voor 2=(prev)tussen=old/normal +\setnewconstant\autoitemgroupspacing\plustwo % 0 = voor/na, 1=tussen als geen voor 2=(prev)tussen=old/normal + +% todo: assume startitem ... stopitem and do an autostopitem .. cleaner for +% elements \def\complexdoitemgroupitem[#1]% {\def\currentitemreference{#1}% @@ -1176,6 +1208,8 @@ \fi \fi \else +\dostoptagged +\dostoptagged \ifconditional\textlistitem % was bugged: \inlinelistitem \ifhmode % WS: make the distance between items customizable, think about better default values -> see itemize-1.tex @@ -1190,7 +1224,10 @@ \vskip-\dimexpr\lastskip+\lineheight\relax \nobreak \fi +\dostarttagged\t!item\empty +\dostarttagged\t!itemtag\empty \dolistitem +\dostoptagged \relax \ifconditional\packlistitem \setupwhitespace[\v!none]% @@ -1198,6 +1235,7 @@ \getitemparameter\currentitemlevel\c!inner \marsymbol \let\marsymbol\relax +\dostarttagged\t!itemcontent\empty \strut % added 11-08-99 \setfalse\concatnextitem % new, concat \nobreak % else problems with intext items @@ -1242,19 +1280,23 @@ % \item {test} is this okay? % \stopitemize -\def\complexitem[#1]#2\par % todo: no two pass data - {\startitemgroup[#1]% - \complexdoitemgroupitem[]\begstrut#2\endstrut\par +% \def\complexitem[#1]#2\par % todo: no two pass data +% {\startitemgroup[#1]% +% \complexdoitemgroupitem[]\begstrut#2\endstrut\par +% \stopitemgroup} + +\def\complexitem[#1]#2\par + {\doifsomethingelse{#1}{\startitemgroup[#1]}{\startitemgroup[\v!itemize]}% + \startitem#2\stopitem \stopitemgroup} +\setvalue{\e!start\v!item}% + {\startitemgroup[\v!itemize]\startitem + \setvalue{\e!stop \v!item}{\endgraf\stopitemgroup}} % inside, else overloaded + \definecomplexorsimpleempty\item \definecomplexorsimpleempty\doitemgroupitem -\def\complexhead[#1]#2\par#3\par - {\startitemgroup[#1]% - \complexdoitemgrouphead[]\begstrut#2\endstrut\par\begstrut#3\endstrut\par - \stopitemgroup} - % the next solution accepts \head test \type{x{x}x} test ... \let\doenditemhead\relax @@ -1291,7 +1333,7 @@ \def\sym#1% {\noindent \begingroup - \setbox\scratchbox\hbox{\trialtypesettingtrue#1}% + \setbox\scratchbox\hbox{\settrialtypesetting#1}% \setbox\scratchbox\hbox \ifdim\wd\scratchbox<1em to 1.5\else spread 1\fi em{#1\hfil}% \normalexpanded{\box\scratchbox\endgroup\hangindent\the\wd\scratchbox}% @@ -1328,6 +1370,7 @@ %\c!inner=, \c!n=2, \c!items=4, + \c!levels=10, \c!lefttext=(, \c!righttext=), \c!start=1, diff --git a/Master/texmf-dist/tex/context/base/strc-lev.lua b/Master/texmf-dist/tex/context/base/strc-lev.lua new file mode 100644 index 00000000000..ff30c3f91ad --- /dev/null +++ b/Master/texmf-dist/tex/context/base/strc-lev.lua @@ -0,0 +1,46 @@ +if not modules then modules = { } end modules ['strc-lev'] = { + version = 1.001, + comment = "companion to strc-lev.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local format = string.format +local insert, remove = table.insert, table.remove + +local sections = structures.sections +local default = interfaces.variables.default + +sections.levels = sections.levels or { } + +local level, levels, categories = 0, sections.levels, { } + +storage.register("structures/sections/levels", levels, "structures.sections.levels") + +function sections.defineautolevels(category,list) + levels[category] = utilities.parsers.settings_to_array(list) +end + +function sections.startautolevel(category) + category = category ~= "" and category or default + level = level + 1 + local lc = levels[category] + if not lc or level > #lc then + context.nostartstructurehead { format("%s:%s",category,level) } + else + context.dostartstructurehead { lc[level] } + end + insert(categories,category) +end + +function sections.stopautolevel() + local category = remove(categories) + local lc = levels[category] + if not lc or level > #lc then + context.nostopstructurehead { format("%s:%s",category,level) } + else + context.dostopstructurehead { lc[level] } + end + level = level - 1 +end diff --git a/Master/texmf-dist/tex/context/base/strc-lev.mkiv b/Master/texmf-dist/tex/context/base/strc-lev.mkiv new file mode 100644 index 00000000000..4c4605bcd14 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/strc-lev.mkiv @@ -0,0 +1,92 @@ +%D \module +%D [ file=strc-lev, +%D version=2010.09.23, +%D title=\CONTEXT\ Structure Macros, +%D subtitle=Automatic Levels, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA-ADE / Hans Hagen] +%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 Structure Macros / Automatic Levels} + +%D This module is the result of a discussion between Alan Braslau and +%D me. I used to have a private (\MKII) module for this but the new +%D structure code in \MKIV\ is more suitable for this so now we have +%D it as core functionality. For the moment this an experiment that +%D Alan and I conduct so it might evolve. + +\registerctxluafile{strc-lev}{1.001} + +\unprotect + +\unexpanded\def\definestructurelevels{\dodoubleargument\dodefinestructurelevels} +\unexpanded\def\startstructurelevel {\dosingleempty\dostartstructurelevel} + +\unexpanded\def\dodefinestructurelevels[#1][#2]{\ctxlua{structures.sections.defineautolevels("#1","#2")}} +\unexpanded\def\dostartstructurelevel [#1]{\ctxlua{structures.sections.startautolevel("#1")}} +\unexpanded\def\stopstructurelevel {\ctxlua{structures.sections.stopautolevel()}} + +\unexpanded\def\nostartstructurehead{\dotripleargument\nonostartstructurehead} +\unexpanded\def\nostopstructurehead {\dosingleargument\nonostopstructurehead } + +\unexpanded\def\dostartstructurelevel[#1]% + {\doifassignmentelse{#1} + {\ctxlua{structures.sections.startautolevel("\v!default")}[#1]} + {\ctxlua{structures.sections.startautolevel("#1")}}} + +\unexpanded\def\nonostartstructurehead[#1][#2][#3]% + {\blank + \noindentation{\tttf[start missing structure level #1]} + \blank} + +\unexpanded\def\nonostopstructurehead[#1]% + {\blank + \noindentation{\tttf[stop missing structure level #1]} + \blank} + +\definestructurelevels + [\v!default] + [\v!chapter, + \v!section, + \v!subsection, + \v!subsubsection, + \v!subsubsubsection, + \v!subsubsubsubsection] + +\protect \endinput + +% \starttext + +% \definehead[xxxxxxsection][subsubsection] +% \setuphead [xxxxxxsection][color=red] + +% \definestructurelevels[main][chapter,section,subsection,subsubsection] +% \definestructurelevels[next][chapter,section,subsection,xxxxxxsection] + +% \startstructurelevel [main] [title=first top level] + +% \startstructurelevel [main] [title=first lower level] +% \startstructurelevel [main] [title=second lower level] +% \startstructurelevel [main] [title=third lower level] +% test +% \stopstructurelevel +% \stopstructurelevel +% \stopstructurelevel + +% \startstructurelevel [main] [title=first lower level] +% \startstructurelevel [main] [title=second lower level] +% \startstructurelevel [next] [title=third lower level] +% test +% \stopstructurelevel +% \stopstructurelevel +% \stopstructurelevel + +% \stopstructurelevel + + +% \stoptext + diff --git a/Master/texmf-dist/tex/context/base/strc-lnt.mkiv b/Master/texmf-dist/tex/context/base/strc-lnt.mkiv index 0df44294bdd..442a9378fb6 100644 --- a/Master/texmf-dist/tex/context/base/strc-lnt.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-lnt.mkiv @@ -17,13 +17,13 @@ \unprotect -\newcounter\linenotecounter \newif\iftracelinenotes % will be tracker +\newcount\noflinenotes \newif\iftracelinenotes % will be tracker \def\dohandlelinenote#1#2#3% {\bgroup \def\linenotelinenumber##1{\inlinerange[#2]}% ##1 == order - \setupnote[ln:#1][\c!numbercommand=\linenotelinenumber,\c!textcommand=\gobbleoneargument]% todo: deep hook - \setnote[ln:#1]{#3}% + \setupnote[#1][\c!numbercommand=\linenotelinenumber,\c!textcommand=\gobbleoneargument]% todo: deep hook + \getvalue{\??vn:ln:#1}{#3}% \egroup} \def\dotracedlinenote#1% @@ -32,7 +32,7 @@ {\forgetall \hsize\zeropoint \hss - \vbox to \strutheight{\llap{\red\infofont\setstrut\linenotecounter}\vss}% + \vbox to \strutheight{\llap{\red\infofont\setstrut\the\noflinenotes}\vss}% {\color[blue]{\vl}}% \vbox to \strutheight{\rlap{\red\infofont\setstrut#1}\vss}% \hss}% @@ -40,13 +40,13 @@ \fi} \def\dolinenote#1#2% - {\doglobal\increment\linenotecounter - \dohandlelinenote{#1}{\linenotecounter}{#2}% + {\global\advance\noflinenotes\plusone + \dohandlelinenote{#1}{\the\noflinenotes}{#2}% \dotracedlinenote\empty - \expanded{\someline[\linenotecounter]}} + \normalexpanded{\someline[\the\noflinenotes]}} \def\dostartlinenote#1[#2]#3% - {\doglobal\increment\linenotecounter + {\global\advance\noflinenotes\plusone \dohandlelinenote{#1}{#2}{#3}% \dotracedlinenote{#2}% \startline[#2]} @@ -55,68 +55,69 @@ {\stopline[#2]} \unexpanded\def\definelinenote - {\dodoubleempty\dodefinelinenote} + {\dotripleempty\dodefinelinenote} -\def\dodefinelinenote[#1][#2]% - {\definenote[ln:#1][#2]% +\def\dodefinelinenote[#1][#2][#3]% + {\dodefinenote[#1][#2][#3]% do as we need to test for arguments + \expandafter\let\csname\??vn:ln:#1\expandafter\endcsname\csname#1\endcsname % use copy command \setuvalue {#1}{\dolinenote {#1}}% \setuvalue{\e!start#1}{\dostartlinenote{#1}}% \setuvalue{\e!stop #1}{\dostoplinenote {#1}}} -\unexpanded\def\setuplinenote[#1]% convenient - {\setupnote[ln:#1]} +\let\setuplinenote\setupnote % We predefine one, namely \type {\linenote} cum suis. \definelinenote[\v!linenote] +% beware: line numbers are added later on so grouping setups is a bad idea +% % \startbuffer[test] % \startlinenumbering[100] -% test \linenote {oeps} test test test test test test -% test \startlinenote [well] {oeps} test test test test test test -% test \linenote {oeps} test test test test test test -% test \linenote {oeps} test test test test test test -% test \linenote {oeps} test test test test test test -% test \linenote {oeps} test test test test test test +% test \linenote {oeps 1} test test test test test test +% test \startlinenote [well] {oeps X} test test test test test test +% test \linenote {oeps 2} test test test test test test +% test \linenote {oeps 3} test test test test test test +% test \linenote {oeps 4} test test test test test test +% test \linenote {oeps 5} test test test test test test % test \stoplinenote [well] test test test test test test % \stoplinenumbering % \stopbuffer % -% \setupnotedefinition[linenote] [location=serried,distance=.5em] -% -% {\typebuffer[test] \getbuffer[test]} \page +% \typebuffer[test] \getbuffer[test] \page % % \startbuffer[setup] % \setuplinenumbering -% [align=left] +% [align=flushleft] % \stopbuffer % -% {\typebuffer[setup] \getbuffer[setup,test]} \page +% \typebuffer[setup] \getbuffer[setup,test] \page % % \startbuffer[setup] % \setuplinenumbering -% [width=1em, -% align=left] +% [width=4em, +% distance=1em, +% align=flushright] % \stopbuffer % -% {\typebuffer[setup] \getbuffer[setup,test]} \page +% \typebuffer[setup] \getbuffer[setup,test] \page % % \startbuffer[setup] % \setuplinenumbering -% [width=2em, -% distance=.5em, -% align=left] +% [width=4em, +% align=flushleft] % \stopbuffer % -% {\typebuffer[setup] \getbuffer[setup,test]} \page +% \typebuffer[setup] \getbuffer[setup,test] \page % % \startbuffer[setup] % \setuplinenumbering % [width=2em, +% distance=.5em, % align=middle] % \stopbuffer % -% {\typebuffer[setup] \getbuffer[setup,test]} \page +% \typebuffer[setup] \getbuffer[setup,test] \page % % \startbuffer[setup] % \setuplinenumbering @@ -129,7 +130,7 @@ % width=1.5em] % \stopbuffer % -% {\typebuffer[setup] \startnarrower\getbuffer[setup,test]\stopnarrower} \page +% \typebuffer[setup] \getbuffer[setup] \startnarrower\getbuffer[test]\stopnarrower \page % % \startbuffer[setup] % \setuplinenumbering @@ -139,7 +140,7 @@ % align=middle] % \stopbuffer % -% {\typebuffer[setup] \getbuffer[setup,test]} \page +% \typebuffer[setup] \getbuffer[setup,test] \page % % \startbuffer[setup-1] % \setuplinenumbering @@ -159,7 +160,7 @@ % {#1}} % \stopbuffer % -% {\typebuffer[setup-1,setup-2] \getbuffer[setup-1,setup-2,test]} \page +% \typebuffer[setup-1,setup-2] \getbuffer[setup-1,setup-2,test] \page % % \startbuffer[setup-1] % \setuplinenumbering @@ -168,6 +169,6 @@ % command=\WatchThis] % \stopbuffer % -% {\typebuffer[setup-1] \getbuffer[setup-1,setup-2,test]} \page +% \typebuffer[setup-1] \getbuffer[setup-1,setup-2,test] \page \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/strc-lst.lua b/Master/texmf-dist/tex/context/base/strc-lst.lua index fefbe52ce29..21015e43a21 100644 --- a/Master/texmf-dist/tex/context/base/strc-lst.lua +++ b/Master/texmf-dist/tex/context/base/strc-lst.lua @@ -16,37 +16,67 @@ local tonumber = tonumber local texsprint, texprint, texwrite, texcount = tex.sprint, tex.print, tex.write, tex.count local concat, insert, remove = table.concat, table.insert, table.remove local lpegmatch = lpeg.match +local simple_hash_to_string, settings_to_hash = utilities.parsers.simple_hash_to_string, utilities.parsers.settings_to_hash +local allocate, checked = utilities.storage.allocate, utilities.storage.checked -local trace_lists = false trackers.register("structure.lists", function(v) trace_lists = v end) +local trace_lists = false trackers.register("structures.lists", function(v) trace_lists = v end) -local ctxcatcodes = tex.ctxcatcodes +local report_lists = logs.reporter("structure","lists") -structure.lists = structure.lists or { } -structure.sections = structure.sections or { } -structure.helpers = structure.helpers or { } -structure.documents = structure.documents or { } -structure.pages = structure.pages or { } +local ctxcatcodes = tex.ctxcatcodes -local lists = structure.lists -local sections = structure.sections -local helpers = structure.helpers -local documents = structure.documents -local pages = structure.pages +local structures = structures +local lists = structures.lists +local sections = structures.sections +local helpers = structures.helpers +local documents = structures.documents +local pages = structures.pages +local tags = structures.tags +local references = structures.references -lists.collected = lists.collected or { } -lists.tobesaved = lists.tobesaved or { } -lists.enhancers = lists.enhancers or { } -lists.internals = lists.internals or { } -lists.ordered = lists.ordered or { } +local collected = allocate() +local tobesaved = allocate() +local cached = allocate() +local pushed = allocate() + +lists.collected = collected +lists.tobesaved = tobesaved + +lists.enhancers = lists.enhancers or { } +lists.internals = allocate(lists.internals or { }) -- to be checked +lists.ordered = allocate(lists.ordered or { }) -- to be checked +lists.cached = cached +lists.pushed = pushed + +references.specials = references.specials or { } local variables = interfaces.variables -local matching_till_depth, number_at_depth = sections.matching_till_depth, sections.number_at_depth +local matchingtilldepth, numberatdepth = sections.matchingtilldepth, sections.numberatdepth + +-- -- -- -- -- -- + +local function zerostrippedconcat(t,separator) -- for the moment not public + local f, l = 1, #t + for i=f,l do + if t[i] == 0 then + f = f + 1 + end + end + for i=l,f,-1 do + if t[i] == 0 then + l = l - 1 + end + end + return concat(t,separator,f,l) +end + +-- -- -- -- -- -- local function initializer() -- create a cross reference between internal references -- and list entries local collected = lists.collected - local internals = jobreferences.internals + local internals = checked(references.internals) local ordered = lists.ordered for i=1,#collected do local c = collected[i] @@ -77,13 +107,10 @@ local function initializer() end end -if job then - job.register('structure.lists.collected', structure.lists.tobesaved, initializer) -end - -local cached, pushed = { }, { } +job.register('structures.lists.collected', tobesaved, initializer) function lists.push(t) + local m = t.metadata local r = t.references local i = (r and r.internal) or 0 -- brrr local p = pushed[i] @@ -105,21 +132,49 @@ function lists.enhance(n) -- todo: symbolic names for counters local l = cached[n] if l then + local metadata = l.metadata + local references = l.references -- l.directives = nil -- might change -- save in the right order (happens at shipout) lists.tobesaved[#lists.tobesaved+1] = l -- default enhancer (cross referencing) - l.references.realpage = texcount.realpageno + references.realpage = texcount.realpageno + -- tags + local kind = metadata.kind + local name = metadata.name + if references then + references.tag = tags.getid(kind,name) + end -- specific enhancer (kind of obsolete) - local kind = l.metadata.kind local enhancer = kind and lists.enhancers[kind] if enhancer then enhancer(l) end + return l end end +--~ function lists.enforce(n) +--~ -- todo: symbolic names for counters +--~ local l = cached[n] +--~ if l then +--~ -- +--~ l.directives = nil -- might change +--~ -- save in the right order (happens at shipout) +--~ lists.tobesaved[#lists.tobesaved+1] = l +--~ -- default enhancer (cross referencing) +--~ l.references.realpage = texcount.realpageno +--~ -- specific enhancer (kind of obsolete) +--~ local kind = l.metadata.kind +--~ local enhancer = kind and lists.enhancers[kind] +--~ if enhancer then +--~ enhancer(l) +--~ end +--~ return l +--~ end +--~ end + -- we can use level instead but we can also decide to remove level from the metadata local nesting = { } @@ -139,17 +194,55 @@ end -- will be split -local function filter_collected(names, criterium, number, collected, nested) +-- Historically we had blocks but in the mkiv approach that could as well be a level +-- which would simplify things a bit. + +local splitter = lpeg.splitat(":") + +-- this will become filtercollected(specification) and then we'll also have sectionblock as key + +local sorters = { + [variables.command] = function(a,b) + if a.metadata.kind == "command" or b.metadata.kind == "command" then + return a.references.internal < b.references.internal + else + return a.references.order < b.references.order + end + end, + [variables.all] = function(a,b) + return a.references.internal < b.references.internal + end, +} + +-- some day soon we will pass a table + +local function filtercollected(names, criterium, number, collected, forced, nested, sortorder) -- names is hash or string local numbers, depth = documents.data.numbers, documents.data.depth - local hash, result, all, detail = { }, { }, not names or names == "" or names == variables.all, nil - names, criterium = gsub(names," ",""), gsub(criterium," ","") - if trace_lists then - logs.report("lists","filtering names: %s, criterium: %s, number: %s",names,criterium,number or "-") + local result, nofresult, detail = { }, 0, nil + local block = false -- all + criterium = gsub(criterium or ""," ","") -- not needed + -- new, will be applied stepwise + local wantedblock, wantedcriterium = lpegmatch(splitter,criterium) -- block:criterium + if not wantedcriterium then + block = documents.data.block + elseif wantedblock == "" or wantedblock == variables.all or wantedblock == variables.text then + criterium = wantedcriterium ~= "" and wantedcriterium or criterium + else + block, criterium = wantedblock, wantedcriterium end - if not all then - for s in gmatch(names,"[^, ]+") do -- sort of settings to hash - hash[s] = true - end + if block == "" then + block = false + end +--~ print(">>",block,criterium) + -- + forced = forced or { } -- todo: also on other branched, for the moment only needed for bookmarks + if type(names) == "string" then + names = settings_to_hash(names) + end + local all = not next(names) or names[variables.all] or false + if trace_lists then + report_lists("filtering names: %s, criterium: %s, block: %s, number: %s", + simple_hash_to_string(names),criterium,block or "*", number or "-") end if criterium == variables.intro then -- special case, no structure yet @@ -157,37 +250,40 @@ local function filter_collected(names, criterium, number, collected, nested) local v = collected[i] local r = v.references if r and r.section == 0 then - result[#result+1] = v + nofresult = nofresult + 1 + result[nofresult] = v end end - elseif criterium == variables.all or criterium == variables.text then + elseif all or criterium == variables.all or criterium == variables.text then for i=1,#collected do local v = collected[i] local r = v.references if r then - local sectionnumber = (r.section == 0) or jobsections.collected[r.section] - if sectionnumber then -- and not sectionnumber.hidenumber then - local metadata = v.metadata - if metadata and not metadata.nolist and (all or hash[metadata.name or false]) then - result[#result+1] = v + local metadata = v.metadata + if metadata then + local name = metadata.name or false + local sectionnumber = (r.section == 0) or sections.collected[r.section] + if forced[name] or (sectionnumber and not metadata.nolist and (all or names[name])) then -- and not sectionnumber.hidenumber then + nofresult = nofresult + 1 + result[nofresult] = v end end end end elseif criterium == variables.current then if depth == 0 then - return filter_collected(names,variables.intro,number,collected) + return filtercollected(names,variables.intro,number,collected,forced,false,sortorder) else for i=1,#collected do local v = collected[i] local r = v.references - if r then - local sectionnumber = jobsections.collected[r.section] + if r and (not block or not r.block or block == r.block) then + local sectionnumber = sections.collected[r.section] if sectionnumber then -- and not sectionnumber.hidenumber then local cnumbers = sectionnumber.numbers local metadata = v.metadata if cnumbers then - if metadata and not metadata.nolist and (all or hash[metadata.name or false]) and #cnumbers > depth then + if metadata and not metadata.nolist and (all or names[metadata.name or false]) and #cnumbers > depth then local ok = true for d=1,depth do local cnd = cnumbers[d] @@ -197,7 +293,8 @@ local function filter_collected(names, criterium, number, collected, nested) end end if ok then - result[#result+1] = v + nofresult = nofresult + 1 + result[nofresult] = v end end end @@ -208,19 +305,19 @@ local function filter_collected(names, criterium, number, collected, nested) elseif criterium == variables.here then -- this is quite dirty ... as cnumbers is not sparse we can misuse #cnumbers if depth == 0 then - return filter_collected(names,variables.intro,number,collected) + return filtercollected(names,variables.intro,number,collected,forced,false,sortorder) else for i=1,#collected do local v = collected[i] local r = v.references - if r then - local sectionnumber = jobsections.collected[r.section] + if r then -- and (not block or not r.block or block == r.block) then + local sectionnumber = sections.collected[r.section] if sectionnumber then -- and not sectionnumber.hidenumber then local cnumbers = sectionnumber.numbers local metadata = v.metadata if cnumbers then ---~ print(#cnumbers, depth, table.concat(cnumbers)) - if metadata and not metadata.nolist and (all or hash[metadata.name or false]) and #cnumbers >= depth then +--~ print(#cnumbers, depth, concat(cnumbers)) + if metadata and not metadata.nolist and (all or names[metadata.name or false]) and #cnumbers >= depth then local ok = true for d=1,depth do local cnd = cnumbers[d] @@ -230,7 +327,8 @@ local function filter_collected(names, criterium, number, collected, nested) end end if ok then - result[#result+1] = v + nofresult = nofresult + 1 + result[nofresult] = v end end end @@ -240,18 +338,18 @@ local function filter_collected(names, criterium, number, collected, nested) end elseif criterium == variables.previous then if depth == 0 then - return filter_collected(names,variables.intro,number,collected) + return filtercollected(names,variables.intro,number,collected,forced,false,sortorder) else for i=1,#collected do local v = collected[i] local r = v.references - if r then - local sectionnumber = jobsections.collected[r.section] + if r and (not block or not r.block or block == r.block) then + local sectionnumber = sections.collected[r.section] if sectionnumber then -- and not sectionnumber.hidenumber then local cnumbers = sectionnumber.numbers local metadata = v.metadata if cnumbers then - if metadata and not metadata.nolist and (all or hash[metadata.name or false]) and #cnumbers >= depth then + if metadata and not metadata.nolist and (all or names[metadata.name or false]) and #cnumbers >= depth then local ok = true for d=1,depth-1 do local cnd = cnumbers[d] @@ -261,7 +359,8 @@ local function filter_collected(names, criterium, number, collected, nested) end end if ok then - result[#result+1] = v + nofresult = nofresult + 1 + result[nofresult] = v end end end @@ -272,16 +371,16 @@ local function filter_collected(names, criterium, number, collected, nested) elseif criterium == variables["local"] then -- not yet ok local nested = nesting[#nesting] if nested then - return filter_collected(names,nested.name,nested.number,collected,nested) + return filtercollected(names,nested.name,nested.number,collected,forced,nested,sortorder) elseif sections.autodepth(documents.data.numbers) == 0 then - return filter_collected(names,variables.all,number,collected) + return filtercollected(names,variables.all,number,collected,forced,false,sortorder) else - return filter_collected(names,variables.current,number,collected) + return filtercollected(names,variables.current,number,collected,forced,false,sortorder) end else -- sectionname, number -- not the same as register local depth = sections.getlevel(criterium) - local number = tonumber(number) or number_at_depth(depth) or 0 + local number = tonumber(number) or numberatdepth(depth) or 0 if trace_lists then local t = sections.numbers() detail = format("depth: %s, number: %s, numbers: %s, startset: %s",depth,number,(#t>0 and concat(t,".",1,depth)) or "?",#collected) @@ -291,14 +390,15 @@ local function filter_collected(names, criterium, number, collected, nested) for i=1,#collected do local v = collected[i] local r = v.references - if r then - local sectionnumber = jobsections.collected[r.section] + if r then -- block ? + local sectionnumber = sections.collected[r.section] if sectionnumber then local metadata = v.metadata local cnumbers = sectionnumber.numbers if cnumbers then - if (all or hash[metadata.name or false]) and #cnumbers >= depth and matching_till_depth(depth,cnumbers,parent) then - result[#result+1] = v + if (all or names[metadata.name or false]) and #cnumbers >= depth and matchingtilldepth(depth,cnumbers,parent) then + nofresult = nofresult + 1 + result[nofresult] = v end end end @@ -308,34 +408,58 @@ local function filter_collected(names, criterium, number, collected, nested) end if trace_lists then if detail then - logs.report("lists","criterium: %s, %s, found: %s",criterium,detail,#result) + report_lists("criterium: %s, block: %s, %s, found: %s",criterium,block or "*",detail,#result) else - logs.report("lists","criterium: %s, found: %s",criterium,#result) + report_lists("criterium: %s, block: %s, found: %s",criterium,block or "*",#result) + end + end + + if sortorder then -- experiment + local sorter = sorters[sortorder] + if sorter then + if trace_lists then + report_lists("sorting list using method %s",sortorder) + end + for i=1,#result do + result[i].references.order = i + end + table.sort(result,sorter) end end + return result end -lists.filter_collected = filter_collected - -function lists.filter(names, criterium, number) - return filter_collected(names, criterium, number, lists.collected) +lists.filtercollected = filtercollected + +function lists.filter(specification) + return filtercollected( + specification.names, + specification.criterium, + specification.number, + lists.collected, + specification.forced, + false, + specification.order + ) end lists.result = { } -function lists.process(...) - lists.result = lists.filter(...) +function lists.process(specification) + lists.result = lists.filter(specification) + local specials = utilities.parsers.settings_to_hash(specification.extras or "") + specials = next(specials) and specials or nil for i=1,#lists.result do local r = lists.result[i] local m = r.metadata - texsprint(ctxcatcodes,format("\\processlistofstructure{%s}{%s}{%i}",m.name,m.kind,i)) ---~ context.processlistofstructure(m.name,m.kind,i) + local s = specials and r.numberdata and specials[zerostrippedconcat(r.numberdata.numbers,".")] or "" + context.processlistofstructure(m.name,m.kind,i,s) end end -function lists.analyze(...) - lists.result = lists.filter(...) +function lists.analyze(specification) + lists.result = lists.filter(specification) end function lists.userdata(name,r,tag) -- to tex (todo: xml) @@ -365,9 +489,17 @@ function lists.location(n) texsprint(l.references.internal or n) end +function lists.label(n,default) + local l = lists.result[n] + local t = l.titledata + if t then + texsprint(t.label or default or "") + end +end + function lists.sectionnumber(name,n,spec) local data = lists.result[n] - local sectiondata = jobsections.collected[data.references.section] + local sectiondata = sections.collected[data.references.section] -- hm, prefixnumber? sections.typesetnumber(sectiondata,"prefix",spec,sectiondata) -- data happens to contain the spec too end @@ -390,7 +522,6 @@ function lists.savedtitle(name,n,tag) local titledata = data.titledata if titledata then helpers.title(titledata[tag] or titledata.title or "",data.metadata) ---~ texsprint(ctxcatcodes,titledata[tag] or titledata.title or "") end end end @@ -411,7 +542,6 @@ function lists.savedprefixednumber(name,n) helpers.prefix(data,data.prefixdata) local numberdata = data.numberdata if numberdata then ---~ print(name,n,table.serialize(numberdata)) sections.typesetnumber(numberdata,"number",numberdata or false) end end @@ -469,7 +599,7 @@ end local splitter = lpeg.splitat(":") -function jobreferences.specials.order(var,actions) -- jobreferences.specials ! +function references.specials.order(var,actions) -- references.specials ! local operation = var.operation if operation then local kind, name, n = lpegmatch(splitter,operation) @@ -480,7 +610,7 @@ function jobreferences.specials.order(var,actions) -- jobreferences.specials ! if r then actions.realpage = r var.operation = r -- brrr, but test anyway - return jobreferences.specials.page(var,actions) + return references.specials.page(var,actions) end end end diff --git a/Master/texmf-dist/tex/context/base/strc-lst.mkiv b/Master/texmf-dist/tex/context/base/strc-lst.mkiv index 413052882e5..c2be8338a45 100644 --- a/Master/texmf-dist/tex/context/base/strc-lst.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-lst.mkiv @@ -70,31 +70,55 @@ \def\structurelistinject{\dotripleempty\dostructurelistinject} -\def\dostructurelistinject[#1][#2][#3]% +\def\dostructurelistinject[#1]% [#2][#3]% no check on nofarguments here {\begingroup - \edef\currentlistname{#1}% + \edef\currentlist{#1}% + \doifelse{\listparameter\c!state}\v!start\dodostructurelistinject\nonostructurelistinject} + +\def\dodostructurelistinject[#1][#2]% + {\endgroup} + +\def\dodostructurelistinject[#1][#2]% + {\getparameters[\??li\??li][\c!type=userdata,\c!location=\v!none,#1]% + \edef\currentlisttype {\@@li@@litype}% + \edef\currentlistlocation{\@@li@@lilocation}% \setnextinternalreference - \edef\currentlistnumber{\ctxlua{structure.lists.push{ + \edef\currentlistnumber{\ctxlua{structures.lists.push{ references = { internal = \nextinternalreference, - section = structure.sections.currentid(), + block = "\currentstructureblock", % handy for lists, like bibl + section = structures.sections.currentid(), + % location = "\currentlistlocation", }, metadata = { - kind = "#2", - name = "\currentlistname", - level = structure.sections.currentlevel(), + kind = "\currentlisttype", + name = "\currentlist", + level = structures.sections.currentlevel(), catcodes = \the\catcodetable, }, - userdata = structure.helpers.touserdata(\!!bs\detokenize{#3}\!!es) + userdata = structures.helpers.touserdata(\!!bs\detokenize{#2}\!!es) }}}% - \expanded{\ctxlatelua{structure.lists.enhance(\currentlistnumber)}}% + % we can do the enhance injection at the lua end which saves tokenization and a call + \ifx\currentlistlocation\v!here + % this injects nodes ! + \expanded{\ctxlatelua{structures.lists.enhance(\currentlistnumber)}}% + % new from here + \xdef\currentstructurelistattribute{\ctxlua{tex.write(structures.references.setinternalreference(nil,nil,\nextinternalreference))}}% + \xdef\currentdestinationattribute{\number\lastdestinationattribute}% + %begingroup\attribute\destinationattribute\currentdestinationattribute\dontleavehmode\emptyhbox\endgroup % todo + \dontleavehmode\hbox attr \destinationattribute \currentdestinationattribute{}% todo + % end of new + \else + \ctxlua{structures.lists.enhance(\currentlistnumber)}% direct injection + \fi \endgroup} \def\structurelistlocation - {\ctxlua{structure.lists.location(\currentlistindex)}} + {\ctxlua{structures.lists.location(\currentlistindex)}} \def\structurelistpagenumber - {\ctxlua{structure.lists.prefixedpage( + {\dostarttagged\t!listpage\empty + \ctxlua{structures.lists.prefixedpage( "\currentlist", \currentlistindex, { @@ -110,38 +134,57 @@ starter = \!!bs\listparameter\c!pagestarter\!!es, stopper = \!!bs\listparameter\c!pagestopper\!!es, } - )}} + )}% + \dostoptagged} \def\structurelistrealpagenumber - {\ctxlua{structure.lists.realpage("\currentlist",\currentlistindex)}} + {\ctxlua{structures.lists.realpage("\currentlist",\currentlistindex)}} \def\structurelistfirst - {\ctxlua{structure.lists.userdata("\currentlist",\currentlistindex,"first")}} + {\dostarttagged\t!listdata{first}% not always ok + \ctxlua{structures.lists.userdata("\currentlist",\currentlistindex,"first")}% + \dostoptagged} \def\structurelistsecond - {\ctxlua{structure.lists.userdata("\currentlist",\currentlistindex,"second")}} + {\dostarttagged\t!listdata{second}% + \ctxlua{structures.lists.userdata("\currentlist",\currentlistindex,"second")}% + \dostoptagged} \def\structurelistuservariable#1% - {\ctxlua{structure.lists.userdata("\currentlist",\currentlistindex,"#1")}} + {\dostarttagged\t!listdata{#1}% + \ctxlua{structures.lists.userdata("\currentlist",\currentlistindex,"#1")}% + \dostoptagged} % \appendtoks % \to \everystructurelist -\unexpanded\def\placestructurelist#1#2#3% hm ... [][][] - {\ctxlua{structure.lists.process("#1","#2","#3")}} - -\def\analysestructurelist#1#2#3% - {\ctxlua{structure.lists.analyze("#1","#2","#3")}} +\unexpanded\def\doplacestructurelist#1#2#3#4#5% beware, not a user command + {\dostarttagged\t!list\empty + \ctxlua{structures.lists.process { + names = "#1", + criterium = "#2", + number = "#3", + extras = "#4", + order = "#5" + }}% + \dostoptagged} + +\unexpanded\def\doanalyzestructurelist#1#2#3% + {\ctxlua{structures.lists.analyze { + names = "#1", + criterium = "#2", + number = "#3" + }}} \def\firststructureelementinlist#1% - {\ctxlua{commands.first_in_list("#1")}} + {\ctxcommand{firstinlist("#1")}} \def\structurelistsize - {\ctxlua{structure.lists.size()}} + {\ctxlua{structures.lists.size()}} \def\@@structurelistprocess{structurelist:process:} -\def\installstructurelistprocessor#1#2% +\unexpanded\def\installstructurelistprocessor#1#2% {\expandafter\def\csname\@@structurelistprocess#1\endcsname{#2}} \def\usestructurelistprocessor#1% @@ -158,24 +201,44 @@ % \chapter{Two} \section{First} \section{Second} % \stoptext -\def\processlistofstructure#1#2#3% name, method, n - {\ctxlua{structure.lists.pushnesting(#3)}% - \edef\currentlist {#1}% - \edef\currentlistmethod{#2}% - \edef\currentlistindex {#3}% +\def\definelistextra + {\dodoubleargument\dodefinelistextra} + +\def\dodefinelistextra[#1][#2]% + {\getparameters[\??li:\c!extras:#1:][#2]} + +% todo: more generic tracing + +\definelistextra + [\v!page] + [\c!before={\showmessage\m!system{14}{\currentlist/\currentlistindex}\page}] + +\def\processlistextrabefore{\executeifdefined{\??li:\c!extras:\currentlistextra:\c!before}\relax} +\def\processlistextraafter {\executeifdefined{\??li:\c!extras:\currentlistextra:\c!after }\relax} + +\unexpanded\def\processlistofstructure#1#2#3#4% name, method, n, extra + {\ctxlua{structures.lists.pushnesting(#3)}% + \edef\currentlist {#1}% + \edef\currentlistmethod {#2}% + \edef\currentlistindex {#3}% + \edef\currentlistextra {#4}% + \processlistextrabefore + \dostarttagged\t!listitem\currentlist \csname\@@structurelistprocess \ifcsname\@@structurelistprocess\currentlist:\currentlistmethod\endcsname\currentlist:\currentlistmethod\else \ifcsname\@@structurelistprocess\currentlistmethod \endcsname\currentlistmethod \else \ifcsname\@@structurelistprocess\currentlist \endcsname\currentlist \else \s!default \fi\fi\fi \endcsname - \ctxlua{structure.lists.popnesting()}} + \dostoptagged + \processlistextraafter + \ctxlua{structures.lists.popnesting()}} % \installstructcurelistprocessor{pubs:userdata} -% {\ctxlua{structure.lists.userdata("\currentlist",\currentlistindex,"bibref")}} +% {\ctxlua{structures.lists.userdata("\currentlist",\currentlistindex,"bibref")}} \installstructurelistprocessor{command} - {\ctxlua{structure.lists.userdata("\currentlist",\currentlistindex,"command")}} + {\ctxlua{structures.lists.userdata("\currentlist",\currentlistindex,"command")}} \installstructurelistprocessor{section} {\dodolistelement @@ -211,7 +274,8 @@ \setuplistalternative[b][\c!distance=5em,\c!width=2em,\c!stretch=10em,\c!command=\hfill] \setuplistalternative[c][\c!distance=5em,\c!width=0pt,\c!stretch=10em,\c!command=\hskip.5em\listdots\hskip.5em\relax] -\def\listdots{\leaders\hbox to .5em{\hss.\hss}\hfill} +%def\listdots{\leaders \hbox to .5em{\hss.\hss}\hfill} +\def\listdots{\gleaders\hbox to .5em{\hss.\hss}\hfill} % \setvalue{\??li\c!alternative}{\getvalue{\??li\c!alternative b}} % ? % \getvalue{\??li\c!alternative} % ? @@ -264,7 +328,7 @@ \c!pagecommand=\listpagecommand, \c!pagenumber=\v!yes, \c!headnumber=\v!yes, - \c!pageboundaries=, + \c!extras=, \c!margin=\!!zeropoint, \c!aligntitle=, \c!before=, @@ -324,21 +388,58 @@ % writing to lists -\def\writetolist[#1]{\gobbletwoarguments} \let\dowritetolist \gobblefourarguments \let\dodowritetolist\gobblefourarguments -\def\writebetweenlist[#1]#2% - {\doif{\namedlistparameter{#1}\c!state}\v!start{\structurelistinject[#1][command][command={#2}]}} -\def\writedatatolist - {\dodoubleargument\dowritedatatolist} - -\def\dowritedatatolist[#1][#2]% - {\doif{\namedlistparameter{#1}\c!state}\v!start{\structurelistinject[#1][userdata][#2]}} - -\def\writetolist[#1]#2#3% - {\doif{\namedlistparameter{#1}\c!state}\v!start{\structurelistinject[#1][simple][first={#2},second={#3}]}} +%D Regular list entries are bound to a specific location in order to +%D get the right pagenumber etc.\ associated. When pushing something +%D inbetween (in mkiv) it ends up directtly in the list. This is the +%D default because otherwise users will wonder why spacing might get +%D messed up (due to an unseen but present node). It is possible to +%D force a location by explicitly setting \type {location} to \type +%D {here}. +%D +%D Another way to force a certain order is to set the \type {order} +%D variable when placing a list. The \type {command} option only +%D pushes commands into the right order, and \type {all} orders all +%D entries (which might be too much). In this case no specific +%D location is needed with the inbetween method. Maybe additional +%D mechanisms show up some day. See \type {inbetween-001.tex} for an +%D example. + +% command : location=none +% userdata : location=none +% simple : location=here + +\unexpanded\def\writebetweenlist{\dodoubleempty \dowritebetweenlist} +\unexpanded\def\writedatatolist {\dotripleargument\dowritedatatolist} +\unexpanded\def\writetolist {\dodoubleempty \dowritetolist} + +\def\dowritebetweenlist[#1][#2]#3% we can overload location + {\doif{\namedlistparameter{#1}\c!state}\v!start + {\ifsecondargument + \dostructurelistinject[#1][#2,\c!type=command][command={#3}]% + \else + \dostructurelistinject[#1][\c!type=command][command={#3}]% + \fi}} + +\def\dowritedatatolist[#1][#2][#3]% we can overload location + {\doif{\namedlistparameter{#1}\c!state}\v!start + {\ifthirdargument + \dostructurelistinject[#1][#2,\c!type=userdata][#3]% + \else + \dostructurelistinject[#1][\c!type=userdata][#2]% + \fi}} + + +\def\dowritetolist[#1][#2]#3#4% we can overload location + {\doif{\namedlistparameter{#1}\c!state}\v!start + {\ifsecondargument + \dostructurelistinject[#1][\c!location=\v!here,#2,\c!type=simple][first={#3},second={#4}]% + \else + \dostructurelistinject[#1][\c!location=\v!here,\c!type=simple][first={#3},second={#4}]% + \fi}} \installstructurelistprocessor{simple} {\dodolistelement @@ -357,16 +458,21 @@ \edef\currentlist{\firststructureelementinlist{#1}}% \the\everystructurelist \doif{\listparameter\c!coupling}\v!on{\startlistreferences{#1}}% - \placestructurelist{#1}{\listparameter\c!criterium}{\number\listparameter\c!number}% + \doplacestructurelist + {#1}% + {\listparameter\c!criterium}% + {\number\listparameter\c!number}% + {\listparameter\c!extras}% + {\listparameter\c!order}% \stoplistreferences \endgroup \dosetlistmode} -\def\dosetlistmode % utilitydone will disappear +\def\dosetlistmode {\ifcase\structurelistsize\relax - \utilitydonefalse \resetsystemmode\v!list + \resetsystemmode\v!list \else - \utilitydonetrue \setsystemmode \v!list + \setsystemmode \v!list \fi} \unexpanded\def\systemsuppliedchapter {\getvalue{\v!chapter}} % brrr @@ -379,7 +485,7 @@ \def\docompletelist[#1][#2]% {\dodocompletelist[#1][#1][#2]} -\def\completelist +\unexpanded\def\completelist {\dodoubleempty\docompletelist} \def\listelements {} % list of page breaks @@ -390,10 +496,10 @@ \def\doassigndimen#1#2#3% {\doifinsetelse{#2}{\v!fit,\v!broad}{#1=#3}{#1=#2}\relax} -\def\listsymbol[#1]#2% +\unexpanded\def\listsymbol[#1]#2% {\begingroup \edef\currentlist{#1}% - \edef\currentlistnumber{#2}% + \def\currentlistnumber{#2}% no edef else tag problems \currentlistsymbol \endgroup} @@ -444,28 +550,34 @@ \endgroup} \def\listsymbol@default - {% prefix = no, none, yes - \strut - \doif{\listparameter\c!label}\v!yes{\leftlabeltext\currentlist}% we can use the new command that does left and right - \listparameter\c!starter - \currentlistnumber - \listparameter\c!stopper - \doif{\listparameter\c!label}\v!yes{\rightlabeltext\currentlist}} - -\def\listsymbol@default - {% todo: - % prefix=no (first gone)|none (all gone)|yes - % number=no|yes - \strut - \doifelse{\listparameter\c!label}\v!yes - {\leftlabeltext\currentlist - \listparameter\c!starter - \currentlistnumber - \listparameter\c!stopper - \rightlabeltext\currentlist} - {\listparameter\c!starter - \currentlistnumber - \listparameter\c!stopper}} + {\strut + \begingroup + \edef\currentlistlabel{\listparameter\c!label}% + \ifx\currentlistlabel\empty % default + \listparameter\c!starter + \currentlistnumber + \listparameter\c!stopper + \else\ifx\currentlistlabel\v!no % also default + \listparameter\c!starter + \currentlistnumber + \listparameter\c!stopper + \else\ifx\currentlistlabel\v!none % real minimal (as suggested by WS) + \currentlistnumber + \else\ifx\currentlistlabel\v!yes % auto (use value stored in tuc file) + \edef\currentlistlabel{\ctxlua{structures.lists.label(\currentlistindex,"\currentlistlabel")}}% + \leftlabeltext\currentlistlabel + \listparameter\c!starter + \currentlistnumber + \listparameter\c!stopper + \rightlabeltext\currentlistlabel + \else % use whatever is set + \leftlabeltext\currentlistlabel + \listparameter\c!starter + \currentlistnumber + \listparameter\c!stopper + \rightlabeltext\currentlistlabel + \fi\fi\fi\fi + \endgroup} \def\listsymbol@unknown {\listparameter\c!symbol} @@ -527,20 +639,11 @@ \def\dodolistelement#1#2#3#4#5#6% {\edef\currentlist{#1}% - \edef\currentlistnumber{#3}% + \def\currentlistnumber{#3}% no edef else tag problem \docurrentlistalternative - %\showcomposition - \let\@@iawidth\!!zeropoint % moet boolean worden - \begingroup - \edef\listelements{\listparameter\c!pageboundaries}% - \normalexpanded{\noexpand\doifinset{#3}{\listelements}} - {\showmessage\m!systems{14}{#3}% - \page}% - \endgroup + \letinteractionparameter\c!width\zeropoint \dontcomplain - %\setfullsectionnumber{\??li\currentlist}% todo - \dosomelistelement{#1}{#2}{#3}{#4}{#5}{#6}% - \global\utilitydonetrue} % ? + \dosomelistelement{#1}{#2}{#3}{#4}{#5}{#6}} \def\dodocommandlistelement#1#2#3#4#5#6% {\doifdefinedelse{\??li#1\c!command} @@ -549,13 +652,18 @@ \def\domakelistelement#1#2#3#4% ref internal command data {\dontleavehmode - \iflocation % we cannot tewak \iflocation as we nest + \iflocation % we cannot tweak \iflocation as we nest \doifelse{\listparameter\c!interaction}{#1} - {\directgoto{\setlocationcolor\??ia#4}[internal(#2)]}% was \directgotobox - {#3{#4}}% - \else + {\begingroup + \doif{\namedstructureheadparameter\currentlist\c!interaction}\v!list + {\dosetsimplepagereference{bck:#2}% + \attribute\destinationattribute\currentdestinationattribute}% + \directgoto{\setlocationcolor\??ia#4}[internal(#2)]% we can get the attribute instead so then we don't need a goto + \endgroup}% was \directgotobox + {#3{#4}}% + \else #3{#4}% - \fi} + \fi} \def\dodofreelistelement#1#2#3#4#5#6#7#8% {\listparameter\c!before% can be \hskip @@ -637,7 +745,7 @@ \hfill}}} {\!!widtha\zeropoint \!!widthc\zeropoint - \setbox2\hbox{}}% + \setbox2\emptyhbox}% \setbox4\hbox {\doif{\listparameter\c!pagenumber}\v!yes {\doifsomething{#5} % \listwidth is new ; temp hack @@ -824,12 +932,12 @@ \dosetuplist[#1][#2]% \edef\currentlist{\firststructureelementinlist{#1}}% \the\everystructurelist - \analysestructurelist{#1}{\listparameter\c!criterium}{\number\listparameter\c!number}% + \doanalyzestructurelist{#1}{\listparameter\c!criterium}{\number\listparameter\c!number}% \xdef\utilitylistlength{\structurelistsize}% \endgroup \dosetlistmode} -\def\determinelistcharacteristics +\unexpanded\def\determinelistcharacteristics {\dodoubleempty\dodeterminelistcharacteristics} \def\combinedlistparameter#1{\csname\??ih\currentcombinedlist#1\endcsname} @@ -866,7 +974,12 @@ \doif{\combinedlistparameter\c!coupling}\v!on{\startlistreferences{#1}}% \dobeginoflist \normalexpanded{\noexpand\dosetuplist[\combinedlist][#2]}% - \placestructurelist{\combinedlist}{\combinedlistparameter\c!criterium}{\combinedlistparameter\c!number}% + \doplacestructurelist + {\combinedlist}% + {\combinedlistparameter\c!criterium}% + {\combinedlistparameter\c!number}% + {\combinedlistparameter\c!extras}% + {\combinedlistparameter\c!order}% \doendoflist \stoplistreferences \endgroup @@ -888,10 +1001,13 @@ \structurelistrealpagenumber} \def\structurelistgenerictitle - {\ctxlua{structure.lists.title("\currentlist",\currentlistindex)}} + {\dostarttagged\t!listcontent\empty + \ctxlua{structures.lists.title("\currentlist",\currentlistindex)}% + \dostoptagged} -\def\structurelistgenericnumber{\ctxlua{ - structure.lists.prefixednumber("\currentlist",\currentlistindex, { +\def\structurelistgenericnumber % tricky, we need to delay tagging as we have nested lua calls + {\dostarttagged\t!listtag\empty + \ctxlua{structures.lists.prefixednumber("\currentlist",\currentlistindex, { prefix = "\listparameter\c!prefix", separatorset = "\listparameter\c!prefixseparatorset", conversionset = "\listparameter\c!prefixconversionset", @@ -907,7 +1023,8 @@ starter = \!!bs\listparameter\c!numberstarter\!!es, stopper = \!!bs\listparameter\c!numberstopper\!!es, segments = "\listparameter\c!numbersegments", - } )}} + } )}% + \dostoptagged} % new and yet undocumented (used in cocoa qa), temporarily disabled in mkiv % diff --git a/Master/texmf-dist/tex/context/base/strc-mar.lua b/Master/texmf-dist/tex/context/base/strc-mar.lua index 8ee814d7743..5bb40fa94e3 100644 --- a/Master/texmf-dist/tex/context/base/strc-mar.lua +++ b/Master/texmf-dist/tex/context/base/strc-mar.lua @@ -6,13 +6,616 @@ if not modules then modules = { } end modules ['strc-mar'] = { license = "see context related readme files" } -structure.marks = structure.marks or { } +-- todo: cleanup stack (structures.marks.reset(v_all) also does the job) -function structure.marks.title(tag,n) - structure.lists.savedtitle(tag,n,"marking") +local insert, concat = table.insert, table.concat +local tostring, next, rawget = tostring, next, rawget +local lpegmatch = lpeg.match + +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex + +local nodecodes = nodes.nodecodes +local glyph_code = nodecodes.glyph +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist + +local getattribute = nodes.getattribute +local traversenodes = node.traverse +local texsetattribute = tex.setattribute +local texbox = tex.box + +local a_marks = attributes.private("structure","marks") + +local trace_marks_set = false trackers.register("marks.set", function(v) trace_marks_set = v end) +local trace_marks_get = false trackers.register("marks.get", function(v) trace_marks_get = v end) +local trace_marks_all = false trackers.register("marks.detail", function(v) trace_marks_all = v end) + +local report_marks = logs.reporter("structure","marks") + +local variables = interfaces.variables + +local v_first = variables.first +local v_last = variables.last +local v_previous = variables.previous +local v_next = variables.next +local v_top = variables.top +local v_bottom = variables.bottom +local v_current = variables.current +local v_default = variables.default +local v_page = variables.page +local v_all = variables.all + +local v_nocheck_suffix = ":" .. variables.nocheck + +local v_first_nocheck = variables.first .. v_nocheck_suffix +local v_last_nocheck = variables.last .. v_nocheck_suffix +local v_previous_nocheck = variables.previous .. v_nocheck_suffix +local v_next_nocheck = variables.next .. v_nocheck_suffix +local v_top_nocheck = variables.top .. v_nocheck_suffix +local v_bottom_nocheck = variables.bottom .. v_nocheck_suffix + +local structures = structures +local marks = structures.marks +local lists = structures.lists + +local settings_to_array = utilities.parsers.settings_to_array + +marks.data = marks.data or allocate() + +storage.register("structures/marks/data", marks.data, "structures.marks.data") + +local data = marks.data +local stack, topofstack = { }, 0 + +local ranges = { + [v_page] = { + first = 0, + last = 0, + }, +} + +local function resolve(t,k) + if k then + if trace_marks_set or trace_marks_get then + report_marks("undefined: name=%s",k) + end + local crap = { autodefined = true } + t[k] = crap + return crap + else + -- weird: k is nil + end +end + +setmetatableindex(data, resolve) + +function marks.exists(name) + return rawget(data,name) ~= nil +end + +-- identify range + +local function sweep(head,first,last) + for n in traversenodes(head) do + local id = n.id + if id == glyph_code then + local a = getattribute(n,a_marks) + if not a then + -- next + elseif first == 0 then + first, last = a, a + elseif a > last then + last = a + end + elseif id == hlist_code or id == vlist_code then + local a = getattribute(n,a_marks) + if not a then + -- next + elseif first == 0 then + first, last = a, a + elseif a > last then + last = a + end + local list = n.list + if list then + first, last = sweep(list, first, last) + end + end + end + return first, last +end + +local classes = { } + +setmetatableindex(classes, function(t,k) local s = settings_to_array(k) t[k] = s return s end) + +function marks.synchronize(class,n) + local box = texbox[n] + if box then + local first, last = sweep(box.list,0,0) + local classlist = classes[class] + for i=1,#classlist do + local class = classlist[i] + local range = ranges[class] + if not range then + range = { } + ranges[class] = range + end + range.first, range.last = first, last + if trace_marks_get or trace_marks_set then + report_marks("synchronize: class=%s, first=%s, last=%s",class,range.first,range.last) + end + end + elseif trace_marks_get or trace_marks_set then + report_marks("synchronize: class=%s, box=%s, no content",class,n) + end +end + +-- define etc + +local function resolve(t,k) + if k == "fullchain" then + local fullchain = { } + local chain = t.chain + while chain and chain ~= "" do + insert(fullchain,1,chain) + chain = data[chain].chain + end + t[k] = fullchain + return fullchain + elseif k == "chain" then + t[k] = "" + return "" + elseif k == "reset" or k == "set" then + t[k] = 0 + return 0 + elseif k == "parent" then + t[k] = false + return false + end +end + +function marks.define(name,settings) + settings = settings or { } + data[name] = settings + local parent = settings.parent + if parent == nil or parent == "" then + settings.parent = false + else + local dp = data[parent] + if not dp then + settings.parent = false + elseif dp.parent then + settings.parent = dp.parent + end + end + setmetatableindex(settings, resolve) +end + +for k, v in next, data do + setmetatableindex(v,resolve) -- runtime loaded table end -function structure.marks.number(tag,n) -- no spec +local function parentname(name) + local dn = data[name] + return dn and dn.parent or name +end + +function marks.relate(name,chain) + local dn = data[name] + if dn and not dn.parent then + if chain and chain ~= "" then + dn.chain = chain + local dc = data[chain] + if dc then + local children = dc.children + if not children then + children = { } + dc.children = children + end + children[#children+1] = name + end + elseif trace_marks_set then + report_marks("invalid relation: name=%s, chain=%s",name,chain or "-") + end + end +end + +local function resetchildren(new,name) + local dn = data[name] + if dn and not dn.parent then + local children = dn.children + if children then + for i=1,#children do + local ci = children[i] + new[ci] = false + if trace_marks_set then + report_marks("reset: parent=%s, child=%s",name,ci) + end + resetchildren(new,ci) + end + end + end +end + +function marks.set(name,value) + local dn = data[name] + if dn then + local child = name + local parent = dn.parent + if parent then + name = parent + dn = data[name] + end + dn.set = topofstack + local top = stack[topofstack] + local new = { } + if top then + for k, v in next, top do + local d = data[k] + local r = d.reset + local s = d.set + if r <= topofstack and s < r then + new[k] = false + else + new[k] = v + end + end + end + resetchildren(new,name) + new[name] = value + topofstack = topofstack + 1 + stack[topofstack] = new + if trace_marks_set then + if name == child then + report_marks("set: name=%s, index=%s, value=%s",name,topofstack,value) + else + report_marks("set: parent=%s, child=%s, index=%s, value=%s",parent,child,topofstack,value) + end + end + tex.setattribute("global",a_marks,topofstack) + end +end + +local function reset(name) + if v_all then + if trace_marks_set then + report_marks("reset: all") + end + stack = { } + for name, dn in next, data do + local parent = dn.parent + if parent then + dn.reset = 0 + dn.set = 0 + end + end + else + local dn = data[name] + if dn then + local parent = dn.parent + if parent then + name = parent + dn = data[name] + end + if trace_marks_set then + report_marks("reset: name=%s, index=%s",name,topofstack) + end + dn.reset = topofstack + local children = dn.children + if children then + for i=1,#children do + local ci = children[i] + reset(ci) + end + end + end + end +end + +marks.reset = reset + +function marks.get(n,name,value) + local dn = data[name] + if dn then + name = dn.parent or name + local top = stack[n] + if top then + context(top[name]) + end + end +end + +function marks.show(first,last) + if first and last then + for k=first,last do + local v = stack[k] + if v then + report_marks("% 4i: %s",k,table.sequenced(v)) + end + end + else + for k, v in table.sortedpairs(stack) do + report_marks("% 4i: %s",k,table.sequenced(v)) + end + end +end + +local function resolve(name,first,last,strict,quitonfalse,notrace) + local dn = data[name] + if dn then + local child = name + local parent = dn.parent + name = parent or child + dn = data[name] + local step, method + if first > last then + step, method = -1, "bottom-up" + else + step, method = 1, "top-down" + end + if trace_marks_get and not notrace then + report_marks("request: strategy=%s, name=%s, parent=%s, strict=%s",method,child,parent or "",tostring(strict or false)) + end + if trace_marks_all and not notrace then + marks.show(first,last) + end + local r = dn.reset + local s = dn.set + if first <= last and first <= r then + if trace_marks_get and not notrace then + report_marks("reset (first case): name=%s, first=%s, last=%s, reset=%s, index=%s",name,first,last,r,first) + end + elseif first >= last and last <= r then + if trace_marks_get and not notrace then + report_marks("reset (last case): name=%s, first=%s, last=%s, reset=%s, index=%s",name,first,last,r,last) + end + elseif not stack[first] or not stack[last] then + if trace_marks_get and not notrace then + -- a previous or next method can give an out of range, which is valid + report_marks("out of range: name=%s, reset=%s, index=%s",name,r,first) + end + elseif strict then + local top = stack[first] + local fullchain = dn.fullchain + if not fullchain or #fullchain == 0 then + if trace_marks_get and not notrace then + report_marks("no full chain, trying: name=%s, first=%s, last=%s",name,first,last) + end + return resolve(name,first,last) + else + if trace_marks_get and not notrace then + report_marks("found chain: %s",concat(fullchain," => ")) + end + local chaindata, chainlength = { }, #fullchain + for i=1,chainlength do + local cname = fullchain[i] + if data[cname].set > 0 then + local value = resolve(cname,first,last,false,false,true) + if value == "" then + if trace_marks_get and not notrace then + report_marks("quit chain: name=%s, reset=%s, start=%s",name,r,first) + end + return "" + else + chaindata[i] = value + end + end + end + if trace_marks_get and not notrace then + report_marks("chain list: %s",concat(chaindata," => ")) + end + local value, index, found = resolve(name,first,last,false,false,true) + if value ~= "" then + if trace_marks_get and not notrace then + report_marks("following chain: %s",concat(fullchain," => ")) + end + for i=1,chainlength do + local cname = fullchain[i] + if data[cname].set > 0 and chaindata[i] ~= found[cname] then + if trace_marks_get and not notrace then + report_marks("empty in chain: name=%s, reset=%s, index=%s",name,r,first) + end + return "" + end + end + if trace_marks_get and not notrace then + report_marks("found: name=%s, reset=%s, start=%s, index=%s, value=%s",name,r,first,index,value) + end + return value, index, found + elseif trace_marks_get and not notrace then + report_marks("not found: name=%s, reset=%s",name,r) + end + end + else + for i=first,last,step do + local current = stack[i] + local value = current and current[name] + if value == nil then + -- search on + elseif value == false then + if quitonfalse then + return "" + end + elseif value == true then + if trace_marks_get and not notrace then + report_marks("quit: name=%s, reset=%s, start=%s, index=%s",name,r,first,i) + end + return "" + elseif value ~= "" then + if trace_marks_get and not notrace then + report_marks("found: name=%s, reset=%s, start=%s, index=%s, value=%s",name,r,first,i,value) + end + return value, i, current + end + end + if trace_marks_get and not notrace then + report_marks("not found: name=%s, reset=%s",name,r) + end + end + end + return "" +end + +-- todo: column:first column:last + +local methods = { } + +local function doresolve(name,rangename,swap,df,dl,strict) + local range = ranges[rangename] or ranges[v_page] + local first, last = range.first, range.last + if trace_marks_get then + report_marks("resolve: name=%s, range=%s, swap=%s, first=%s, last=%s, df=%s, dl=%s, strict=%s", + name,rangename,tostring(swap or false),first,last,df,dl,tostring(strict or false)) + end + if swap then + first, last = last + df, first + dl + else + first, last = first + df, last + dl + end + local value, index, found = resolve(name,first,last,strict) + -- maybe something more + return value, index, found +end + +methods[v_previous] = function(name,range) return doresolve(name,range,false,-1,0,true ) end -- strict +methods[v_top] = function(name,range) return doresolve(name,range,false, 0,0,true ) end -- strict +methods[v_bottom] = function(name,range) return doresolve(name,range,true , 0,0,true ) end -- strict +methods[v_next] = function(name,range) return doresolve(name,range,true , 0,1,true ) end -- strict + +methods[v_previous_nocheck] = function(name,range) return doresolve(name,range,false,-1,0,false) end +methods[v_top_nocheck] = function(name,range) return doresolve(name,range,false, 0,0,false) end +methods[v_bottom_nocheck] = function(name,range) return doresolve(name,range,true , 0,0,false) end +methods[v_next_nocheck] = function(name,range) return doresolve(name,range,true , 0,1,false) end + +local function resolve(name,range,f_swap,l_swap,step,strict) -- we can have an offset + local f_value, f_index, f_found = doresolve(name,range,f_swap,0,0,strict) + local l_value, l_index, l_found = doresolve(name,range,l_swap,0,0,strict) + if f_found and l_found and l_index > f_index then + local name = parentname(name) + for i=f_index,l_index,step do + local si = stack[i] + local sn = si[name] + if sn and sn ~= false and sn ~= true and sn ~= "" and sn ~= f_value then + return sn, i, si + end + end + end + return f_value, f_index, f_found +end + +methods[v_first ] = function(name,range) return resolve(name,range,false,true, 1,true ) end -- strict +methods[v_last ] = function(name,range) return resolve(name,range,true,false,-1,true ) end -- strict + +methods[v_first_nocheck] = function(name,range) return resolve(name,range,false,true, 1,false) end +methods[v_last_nocheck ] = function(name,range) return resolve(name,range,true,false,-1,false) end + +methods[v_current] = function(name,range) -- range is ignored here + local top = stack[topofstack] + return top and top[parentname(name)] or "" +end + +local function fetched(name,range,method) + local value = (methods[method] or methods[v_first])(name,range) or "" + if not trace_marks_get then + -- no report + elseif value == "" then + report_marks("nothing fetched: name=%s, range=%s, method=%s",name,range,method) + else + report_marks("marking fetched: name=%s, range=%s, method=%s, value=%s",name,range,method,value) + end + return value or "" +end + +-- can be used at the lua end: + +marks.fetched = fetched + +-- this will move to a separate runtime modules + +marks.tracers = marks.tracers or { } + +function marks.tracers.showtable() + context.starttabulate { "|l|l|l|lp|lp|" } + context.tabulaterowbold("name","parent","chain","children","fullchain") + context.ML() + for k, v in table.sortedpairs(data) do + local parent, chain, children, fullchain = v.parent or "", v.chain or "", v.children or { }, v.fullchain or { } + table.sort(children) -- in-place but harmless + context.tabulaterowtyp(k,parent,chain,concat(children," "),concat(fullchain," ")) + end + context.stoptabulate() +end + +-- pushing to context: + +local separator = context.nested.markingseparator +local command = context.nested.markingcommand +local ctxconcat = context.concat + +local function fetchonemark(name,range,method) + context(command(name,fetched(name,range,method))) +end + +local function fetchtwomarks(name,range) + ctxconcat( { + command(name,fetched(name,range,v_first)), + command(name,fetched(name,range,v_last)), + }, separator(name)) +end + +local function fetchallmarks(name,range) + ctxconcat( { + command(name,fetched(name,range,v_previous)), + command(name,fetched(name,range,v_first)), + command(name,fetched(name,range,v_last)), + }, separator(name)) +end + +function marks.fetch(name,range,method) -- chapter page first | chapter column:1 first + if trace_marks_get then + report_marks("marking asked: name=%s, range=%s, method=%s",name,range,method) + end + if method == "" or method == v_default then + fetchonemark(name,range,v_first) + elseif method == v_both then + fetchtwomarks(name,range) + elseif method == v_all then + fetchallmarks(name,range) + else + fetchonemark(name,range,method) + end +end + +function marks.fetchonemark (name,range,method) fetchonemark (name,range,method) end +function marks.fetchtwomarks(name,range) fetchtwomarks(name,range ) end +function marks.fetchallmarks(name,range) fetchallmarks(name,range ) end + +-- here we have a few helpers + +function marks.title(tag,n) + lists.savedtitle(tag,n,"marking") +end + +function marks.number(tag,n) -- no spec -- no prefix (as it is the prefix) - structure.lists.savednumber(tag,n) + lists.savednumber(tag,n) end + +-- interface + +commands.definemarking = marks.define +commands.relatemarking = marks.relate +commands.setmarking = marks.set +commands.resetmarking = marks.reset +commands.synchronizemarking = marks.synchronize +commands.getmarking = marks.fetch +commands.fetchonemark = marks.fetchonemark +commands.fetchtwomarks = marks.fetchtwomarks +commands.fetchallmarks = marks.fetchallmarks + +function commands.doifelsemarking(str) -- can be shortcut + commands.testcase(marks.exists(str)) +end + diff --git a/Master/texmf-dist/tex/context/base/strc-mar.mkiv b/Master/texmf-dist/tex/context/base/strc-mar.mkiv index bb87051e026..2fe8631b27b 100644 --- a/Master/texmf-dist/tex/context/base/strc-mar.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-mar.mkiv @@ -17,479 +17,168 @@ \unprotect -%D Old stuff. - -\newtoks \listofmarks - -\let \getmarks \gobbleoneargument -\let \getallmarks \relax -\let \getsplitmarks \gobbleoneargument -\let \getallsplitmarks \relax - -%D \macros -%D {expandmarks} +%D Synchronizing marks is a rather tricky and messy business. When +%D setting a mark, a node is added to the list in order for to \TEX\ +%D be able to figure out the 3 current marks when a page is made +%D (last mark on previous page, first on current page, last on +%D current page; in \LUATEX\ we might at one point have the first on +%D the next page as well). %D -%D We can force expansion of marks with the following switch. - -% Synchronizing marks is a rather tricky and messy business. When -% setting a mark, a node is added to the list in order for to \TEX\ -% be able to figure out the 3 current marks when a page is made -% (last mark on previous page, first on current page, last on -% current page; in \LUATEX\ we might at one point have the first on -% the next page as well). - -% Resetting a mark is not easy. An empty one will not erase the last -% one on the previous page for instance. In \LUATEX\ we can clear a -% marks state register with \type {\clearmarks} but since this is an -% immediate operation it might have unwanted side effects when \TEX\ -% has collected several pages of text and finishing off these pages -% uses marks. - -% In \MKIV\ we provide a model that permits some control over the -% way marks are used. It is not entirely compatible with \MKII\ but -% in practice this is not a real problem. Quality has a price. - -% In fact we define multiple marks per visible mark and define -% additional ones on the fly. This has some price in terms of used -% mark registers but given the way that we fill marks in \MKIV\ -% their accumulated content is not really the issue. Also, -% periodically we cleanup any leftovers. - -\newif\ifexpandmarks \expandmarkstrue - -\def\marksomecs #1#2{\csname\string#1:m:\number#2\endcsname} -\def\markautocs #1{\csname\string#1:m:\number\csname\string#1:s\endcsname\endcsname} -\def\markmaincs #1{\csname\string#1:m\endcsname} -\def\markresetcs #1{\csname\string#1:r\endcsname} -\def\markstatecs #1{\csname\string#1:s\endcsname} -\def\markcurrentcs#1{\csname\string#1:c\endcsname} -\def\marktokscs #1{\csname\string#1:t\endcsname} - -\def\renewmarks#1% - {\ifx#1\relax - % \writestatus\m!systems{defining low level mark: \string#1}% - \newmarks#1% - \else - \clearmarks#1% - \fi} - -\unexpanded\def\definenewmark#1% - {\ifcsname\string#1:m\endcsname\else - \@EA\@EA\@EA\newcount \markstatecs #1\global\markstatecs#1\plusone - \@EA\@EA\@EA\renewmarks\markautocs #1% - \@EA\@EA\@EA\renewmarks\markmaincs #1% - \@EA\@EA\@EA\renewmarks\markresetcs #1% - \@EA\@EA\@EA\newtoks \marktokscs #1% - \@EA\@EA\@EA\let \markcurrentcs#1\empty - \listofmarks\expandafter{\the\listofmarks\checkmark#1}% - \fi} - -\long\def\setmark#1#2% marks expand - {\@EA\@EA\@EA\xdef \markcurrentcs#1{\ifexpandmarks#2\else\normalunexpanded{#2}\fi}% - \marks\markautocs #1{\ifexpandmarks#2\else\normalunexpanded{#2}\fi}% we could expand current one level - \marks\markmaincs #1{\ifexpandmarks#2\else\normalunexpanded{#2}\fi}% we could expand current one level - \marks\markresetcs #1{\number\markstatecs#1}} - -\def\resetmark#1% - {\global\advance\markstatecs#1\plusone - \@EA\@EA\@EA\glet\markcurrentcs#1\empty - \@EA\@EA\@EA\renewmarks\markautocs#1% - \the\marktokscs#1\relax} - -\def\addmarkreset#1#2% - {\global\marktokscs#2\@EA{\the\marktokscs#2\resetmark#1}} - -% already there: \prependtoks \getallmarks \to \everybeforepagebody -% -% \def\getallmarks{\the\listofmarks} +%D Resetting a mark is not easy. An empty one will not erase the last +%D one on the previous page for instance. In \LUATEX\ we can clear a +%D marks state register with \type {\clearmarks} but since this is an +%D immediate operation it might have unwanted side effects when \TEX\ +%D has collected several pages of text and finishing off these pages +%D uses marks. +%D +%D In \MKIV\ we provide an alternative model that permits some more +%D control over the way marks are used. It is not entirely compatible +%D with \MKII\ or previous \MKIV\ implementations but in practice this +%D is not a real problem. It's also easier now to extend this mechanism. -\let\checkmark\gobbleoneargument +% if global has side effects we will need to nil it selectively +% and optionally enable it in for instance postponed content -\prependtoks \clearmarkswhenemptypage \to \everybeforepagebody +\definesystemattribute [marks] [global] -\def\clearmarkswhenemptypage - {\iffalse % check if page is empty - \clearallmarks - \fi} - -\def\clearallmarks - {\let\checkmark\clearmarkchain - \the\listofmarks - \let\checkmark\gobbleoneargument} - -\def\clearmarkchain#1% - {\@EA\@EA\@EA\clearmarks\markmaincs#1% - \@EA\@EA\@EA\clearmarks\markresetcs#1% - \@EA\doclearmarkchain\@EA{\number\csname\string#1:s\endcsname}#1% - \@EA\@EA\@EA\glet\markcurrentcs#1\empty - \global\markstatecs#1\plusone} - -\def\doclearmarkchain#1#2% - {\@EA\@EA\@EA\clearmarks\marksomecs#1{#2}% - \@EA\doclearmarkchain\@EA#1\@EA{\number\numexpr#2+\minusone}} - -% Fetching (expandable versions, so no intermediate counter): - -\def\currenttopmarknumber #1{\number0\topmarks \markresetcs#1} -\def\currentfirstmarknumber#1{\number0\firstmarks\markresetcs#1} -\def\currentbotmarknumber #1{\number0\botmarks \markresetcs#1} - -\def\checkedcurrentmarkrange#1{[\currenttopmarknumber#1,\currentfirstmarknumber#1,\currentbotmarknumber#1]} - -\def\checkedcurrentmarks{\markcurrentcs} % #1 shared current mark - -\let\currentsplitfirstmarknumber\currentfirstmarknumber -\let\currentsplittopmarknumber \currenttopmarknumber -\let\currentsplitbotmarknumber \currentbotmarknumber -\let\normalsplittopmarks \normaltopmarks - -\def\uncheckedautotopmark {\normaltopmarks \markautocs} % #1 -\def\uncheckedautofirstmark {\normalfirstmarks \markautocs} % #1 -\def\uncheckedautobotmark {\normalbotmarks \markautocs} % #1 -\def\uncheckedautosplittopmark {\normalsplittopmarks \markautocs} % #1 -\def\uncheckedautosplitfirstmark {\normalsplitfirstmarks\markautocs} % #1 -\def\uncheckedautosplitbotmark {\normalsplitbotmarks \markautocs} % #1 - -\def\uncheckedmaintopmark {\normaltopmarks \markmaincs} % #1 -\def\uncheckedmainfirstmark {\normalfirstmarks \markmaincs} % #1 -\def\uncheckedmainbotmark {\normalbotmarks \markmaincs} % #1 -\def\uncheckedmainsplittopmark {\normalsplittopmarks \markmaincs} % #1 -\def\uncheckedmainsplitfirstmark {\normalsplitfirstmarks\markmaincs} % #1 -\def\uncheckedmainsplitbotmark {\normalsplitbotmarks \markmaincs} % #1 - -\def\checkedpagetopmarks #1{\ifcase\currentbotmarknumber #1\else\normaltopmarks \marksomecs#1{\currentbotmarknumber #1}\fi} -\def\checkedpagefirstmarks #1{\ifcase\currentbotmarknumber #1\else\normalfirstmarks \marksomecs#1{\currentbotmarknumber #1}\fi} -\def\checkedpagebotmarks #1{\ifcase\currentbotmarknumber #1\else\normalbotmarks \marksomecs#1{\currentbotmarknumber #1}\fi} -\def\checkedpagesplittopmarks #1{\ifcase\currentsplitbotmarknumber #1\else\normalsplittopmarks \marksomecs#1{\currentsplitbotmarknumber #1}\fi} -\def\checkedpagesplitfirstmarks#1{\ifcase\currentsplitbotmarknumber #1\else\normalsplitfirstmarks\marksomecs#1{\currentsplitbotmarknumber #1}\fi} -\def\checkedpagesplitbotmarks #1{\ifcase\currentsplitbotmarknumber #1\else\normalsplitbotmarks \marksomecs#1{\currentsplitbotmarknumber #1}\fi} - -\def\checkedfulltopmarks #1{\ifcase\currenttopmarknumber #1\else\normaltopmarks \marksomecs#1{\currenttopmarknumber #1}\fi} -\def\checkedfullfirstmarks #1{\ifcase\currentfirstmarknumber #1\else\normalfirstmarks \marksomecs#1{\currentfirstmarknumber #1}\fi} -\def\checkedfullbotmarks #1{\ifcase\currentbotmarknumber #1\else\normalbotmarks \marksomecs#1{\currentbotmarknumber #1}\fi} -\def\checkedfullsplittopmarks #1{\ifcase\currentsplittopmarknumber #1\else\normalsplittopmarks \marksomecs#1{\currentsplittopmarknumber #1}\fi} -\def\checkedfullsplitfirstmarks#1{\ifcase\currentsplitfirstmarknumber#1\else\normalsplitfirstmarks\marksomecs#1{\currentsplitfirstmarknumber#1}\fi} -\def\checkedfullsplitbotmarks #1{\ifcase\currentsplitbotmarknumber #1\else\normalsplitbotmarks \marksomecs#1{\currentsplitbotmarknumber #1}\fi} - -% Interface macros: - -\def\getcurrentmark {\checkedcurrentmarks } -\def\gettopmark {\checkedfulltopmarks } -\def\getfirstmark {\checkedfullfirstmarks } -\def\getbotmark {\checkedfullbotmarks } -\def\getsplittopmark {\checkedfullsplittopmarks } -\def\getsplitfirstmark {\checkedfullsplitfirstmarks} -\def\getsplitbotmark {\checkedfullsplitbotmarks } - -\def\getbottommark {\getbotmark} -\def\getsplitbottommark{\getsplitbotmark} - -%D Some of these will go away (in the process of rewriting). - -\let \newmark \definenewmark -\let \newpersistentmark \newmarks -\let \normalsetmark \setmark -\let \rawnewmark \newmarks -\let \rawdefinemark \newmarks -\let \rawsetmark \normalmarks -\let \rawgettopmark \normaltopmarks -\let \rawgetfirstmark \normalfirstmarks -\let \rawgetbotmark \normalbotmarks -\let \rawgetsplitbotmark \normalsplitbotmarks -\let \rawgetsplitfirstmark \normalsplitfirstmarks -\let \rawgetsplittopmark \normalsplitfirstmarks - -\let \noninterferingmarks \relax % old color interference related hack - -%D Next comes the layer around the previous mechanism. -%D -%D Parameters +\let\currentmarking\empty -\def\markingparameter #1#2{\csname\domarkingparameter{\??mk#1}#2\endcsname} -\def\domarkingparameter #1#2{\ifcsname#1#2\endcsname#1#2\else\@EA\domarkingparentparameter\csname#1\s!parent\endcsname#2\fi} +\def\markingparameter #1{\csname\domarkingparameter{\??mk\currentmarking}#1\endcsname} +\def\namedmarkingparameter #1#2{\csname\domarkingparameter{\??mk#1}#2\endcsname} +\def\domarkingparameter #1#2{\ifcsname#1#2\endcsname#1#2\else\expandafter\domarkingparentparameter\csname#1\s!parent\endcsname#2\fi} \def\domarkingparentparameter#1#2{\ifx#1\relax\s!empty\else\domarkingparameter#1#2\fi} -\def\markingcoupling #1{\ifcsname\??mk#1\c!coupling\endcsname\@EA\markingcoupling\csname\??mk#1\c!coupling\endcsname\else#1\fi} - -\let\mainmarking\markingcoupling % compatibility - -\def\doifelsemarking#1% - {\ifcsname\??mk#1\c!coupling\endcsname - \expandafter\firstoftwoarguments - \else - \expandafter\secondoftwoarguments - \fi} -\def\dowithmarkcommandone#1#2% \command {mark} - {\expandafter#1\csname\??mk:\markingcoupling{#2}\endcsname} +% \def\markingparameterhash #1{\domarkingparameterhash{\??mk\currentmarking}#1} +% \def\domarkingparameterhash #1#2{\ifcsname#1#2\endcsname#1\else\expandafter\domarkingparentparameterhash\csname#1\s!parent\endcsname#2\fi} +% \def\domarkingparentparameterhash#1#2{\ifx#1\relax\else\domarkingparameterhash#1#2\fi} +% +% \def\detokenizedmarkingparameter#1{\detokenize\expandafter\expandafter\expandafter{\csname\??mk\currentmarking#1\endcsname}} +% +% \def\dosetmarkingattributes#1#2% style color +% {\edef\fontattributehash {\markingparameterhash#1}% +% \edef\colorattributehash{\markingparameterhash#2}% +% \ifx\fontattributehash \empty\else\dosetfontattribute \fontattributehash #1\fi +% \ifx\colorattributehash\empty\else\dosetcolorattribute\colorattributehash#2\fi} -\def\dowithmarkcommandtwo#1#2#3% \command {mark} {mark} - {\expandafter#1\csname\??mk:\markingcoupling{#2}\expandafter\endcsname\csname\??mk:\markingcoupling{#3}\endcsname} +\newconditional\inhibitgetmarking +\newconditional\inhibitsetmarking +\newtoks \everymarking \unexpanded\def\setupmarking {\dodoubleargument\dosetupmarking} \def\dosetupmarking[#1][#2]% - {\def\docommand##1{\getparameters[\??mk##1][#2]}% - \processcommalist[#1]\docommand} - -%D The filtercommand key is used to hook in a filtering command. Users are -%D adviced not to misuse this key. - -\getparameters - [\??mk] - [\c!expansion=\v!no, % saves a macro - \c!separator={\space\emdash\space}, - \c!limittext=\@@kolimittext, - \c!filtercommand=\firstofoneargument, - \c!state=\v!start] - -\let\alldefinedmarks\empty - -\unexpanded\def\definemarking - {\dodoubleempty\dodefinemarking} - -\def\dodefinemarking[#1][#2]% - {\doifelsenothing{#2}\donormaldefinemarking\docloneddefinemarking[#1][#2]} - -\def\donormaldefinemarking[#1][#2]% #2 empty - {\ifcsname\??mk#1\s!parent\endcsname - % already defined - \else - \letgvalue{\??mk#1\s!parent}\??mk - \dowithmarkcommandone\newmark{#1}% - \doglobal\addtocommalist{#2}\alldefinedmarks - \ifproductionrun\showmessage\m!systems{13}{#1,[#1]}\fi - \fi} - -\def\docloneddefinemarking[#1][#2]% - {\ifcsname\??mk#1\s!parent\endcsname \else \ifcsname\??mk#2\s!parent\endcsname - \doifnot{#1}{#2}% - {\setxvalue{\??mk#1\s!parent}{\??mk#2}% - \setxvalue{\??mk#1\c!coupling}{#2}% - \ifproductionrun\showmessage\m!systems{13}{#1,[#2]}\fi}% - \fi \fi} - -\def\decouplemarking[#1]% - {\letbeundefined{\??mk#1\c!coupling}} + {\ifsecondargument + \def\docommand##1{\getparameters[\??mk##1][#2]}% + \processcommalist[#1]\docommand + \else + \getparameters[\??mk][#1]% + \fi} -\def\couplemarking[#1]#2[#3]% couple 1 to 2 (this macro is not really needed) - {\setvalue{\??mk#1\c!coupling}{#3}} +% management -\def\relatemarking[#1]#2[#3]% define 1 as child of 2 - {\dowithmarkcommandtwo\addmarkreset{#1}{#3}} +\unexpanded\def\definemarking {\dodoubleempty \dodefinemarking} +\unexpanded\def\relatemarking {\dodoubleempty \dorelatemarking} +\unexpanded\def\setmarking {\dosingleargument\dosetmarking } \let\marking\setmarking +\unexpanded\def\resetmarking {\dosingleargument\doresetmarking } +\unexpanded\def\synchronizemarking{\dodoubleargument\dosynchronizemarking } -\unexpanded\def\definerawmarking[#1]% - {\dododefinemarking[#1][#1]% - \getgparameters[\??mk#1][\c!limittext=]} % global ! +\def\dodefinemarking[#1][#2]% marking parent + {\doifelsenothing{#2} + {\ctxcommand{definemarking("#1")}% + \getparameters[\??mk#1][\s!parent=\??mk]} + {\ctxcommand{definemarking("#1",{ parent = "#2" })}% + \getparameters[\??mk#1][\s!parent=\??mk#2]}} -% \decouplemarking[#1]% % no coupling with sections +\def\dorelatemarking[#1][#2]% + {\ctxcommand{relatemarking("#1","#2")}} -\def\fastresetmarker#1% - {\ifcsname\??mk#1\s!parent\endcsname - \dowithmarkcommandone\resetmark{#1}% +\def\dosetmarking[#1]#2% + {\ifconditional\inhibitsetmarking + % nothing + \else + \doifelse{\namedmarkingparameter{#1}\c!expansion}\v!yes + {\ctxcommand{setmarking("#1",\!!bs#2\!!es)}} + {\ctxcommand{setmarking("#1",\!!bs\detokenize{#2}\!!es)}}% \fi} -\def\fastresetmarkerlist[#1]% - {\normalexpanded{\noexpand\rawprocesscommalist[#1]}\fastresetmarker} - -\def\resetmarking - {\dosingleargument\doresetmarking} - \def\doresetmarking[#1]% - {\processcommalist[#1]\fastresetmarker} - -%D Used elsewhere: - -\let\nomarking\empty + {\ctxcommand{resetmarking("#1")}} -%D Basic fetching: - -\letvalue{\??mk::\??mk::\v!previous}\firstoffourarguments -\letvalue{\??mk::\??mk::\v!first }\secondoffourarguments -\letvalue{\??mk::\??mk::\v!last }\thirdoffourarguments -\letvalue{\??mk::\??mk::\v!current }\fourthoffourarguments - -\letvalue{\??mk\??mk\v!previous}\gettopmark -\letvalue{\??mk\??mk\v!first }\getfirstmark -\letvalue{\??mk\??mk\v!last }\getbotmark -\letvalue{\??mk\??mk\v!current }\getcurrentmark - -\letvalue{\??mk\??mk\v!column:\v!first}\getsplitfirstmark -\letvalue{\??mk\??mk\v!column:\v!last }\getsplitbottommark - -\def\fetchmark[#1]#2[#3]% % expandable / never use \unexpanded - {\ifcsname\??mk::#1\endcsname % saved mark - \markingparameter{#1}\c!filtercommand{\csname\??mk::\??mk::#3\@EA\@EA\@EA\endcsname\csname\??mk::#1\endcsname}% - \else\ifcsname\??mk#1\s!parent\endcsname % real mark - \markingparameter{#1}\c!filtercommand{\expandafter\dowithmarkcommandone\csname\??mk\??mk#3\endcsname{#1}}% - \fi\fi} +\def\doifelsemarking#1% + {\ctxcommand{doifelsemarking("#1")}} -\def\fetchtwomarks[#1]% - {\dofetchtwomarks[#1][#1]} +\def\dosynchronizemarking[#1][#2]% class boxnumber (some day also name), maybe second argument table + {\ifvoid#2\else\ctxcommand{synchronizemarking("#1",\number#2)}\fi} -\def\fetchallmarks[#1]% - {\dofetchallmarks[#1][#1]} +% \appendtoks +% \dosynchronizemarking[\v!page][\normalpagebox]% +% \to \everybeforepagebody -\def\dofetchtwomarks[#1][#2]% class class:tag - {\doifsomething{\fetchmark[#2][\v!first]} - {\fetchmark[#2][\v!first]% - \doifsomething{\fetchmark[#2][\v!last]} - {\doifnot{\fetchmark[#2][\v!first]}{\fetchmark[#2][\v!last]} - {\markingparameter{#1}\c!separator\fetchmark[#2][\v!last]}}}} +% defaults -\def\dofetchallmarks[#1][#2]% - {\doifsomething{\fetchmark[#2][\v!first]} - {\doifsomething{\fetchmark[#2][\v!previous]} - {\doifnot{\fetchmark[#2][\v!previous]}{\fetchmark[#2][\v!first]} - {\fetchmark[#2][\v!previous]\markingparameter{#1}\c!separator}}}% - \fetchtwomarks[#1][#2]} +\setupmarking + [\c!expansion=\v!no, + \c!separator=\space\emdash\space, + \c!filtercommand=\firstofoneargument, + \c!state=\v!start] -% \newtoks \everymarking +% fetching, regular interface -% \def\Interesting{\doifmodeelse{*\v!marking}{Interesting}{Boring}} -% \setupheadertexts[chapter] -% \starttext -% \chapter{This Is \Interesting} -% \stoptext +\unexpanded\def\getmarking + {\ifconditional\inhibitgetmarking + \expandafter\dotripleargument\expandafter\nogetmarking + \else + \expandafter\dotripleargument\expandafter\dogetmarking + \fi} -\def\markingnomarking#1{\splitsequence{\markingparameter{#1}\c!limittext}} % #2 +\def\nogetmarking[#1][#2][#3]% + {} \def\dogetmarking[#1][#2][#3]% - {\doif{\markingparameter{#1}\c!state}\v!start - {\bgroup + {\doif{\namedmarkingparameter{#1}\c!state}\v!start + {\begingroup \setsystemmode\v!marking \the\everymarking - \def\nomarking{\markingnomarking{#1}}% just for good old times, might disappear \ifthirdargument - \dodogetmarking{#3}{#1}{#1:#2}{#3}% + \ctxcommand{getmarking("#1","#2","#3")}% \else - \dodogetmarking{#2}{#1}{#1}{#2}% + \ctxcommand{getmarking("#1","\v!page","#2")}% \fi - \egroup}} - -\def\dodogetmarking#1#2#3#4% to be made faster - {\processaction % slow - [#1] - [ \v!both=>{\dofetchtwomarks[#2][#3]}, - \v!all=>{\dofetchallmarks[#2][#3]}, - \s!default=>{\fetchmark[#3][\v!first]}, - \s!unknown=>{\fetchmark[#3][#4]}]} - -\def\nogetmarking[#1][#2][#3]% - {} - -\unexpanded\def\getmarking - {\dotripleargument\dogetmarking} - -\let\setsomemark\setmark - -\def\setmarking - {\dosingleargument\dosetmarking} + \endgroup}} -\def\dosetmarking[#1]#2% - {\ifcsname\??mk#1\s!parent\endcsname - \begingroup - \doifelse{\markingparameter{#1}\c!expansion}\v!yes\expandmarkstrue\expandmarksfalse - \dowithmarkcommandone\setsomemark{#1}{#2}% - \endgroup - \fi} - -\let\marking\setmarking - -% to be adapted for mkiv: -% -% this version can be used when a page is built up in steps without -% feedback of the otr'd list to the mvl (i.e.\ a page made of pages, -% as in column sets where content is buffered) - -% reset at begin -% preset before page -% bubble in column -% refresh at end - -% marks is a kind of toks, so maybe we need a low level \the\marks -% -% use \normalunexpanded here - -\def\refreshsavedmark[#1][#2]% mark tag (packing saves many hash entries) - {\setxvalue{\??mk::#1:#2}% - {{\@EA\ifx\csname\??mk::#1:pp\endcsname\relax - % empty - \else - \csname\??mk::#1:pp\endcsname - \fi}% - {\@EA\ifx\csname\??mk::#1:ff\endcsname\relax - \fetchmark[#1][\v!first]% - \else - \csname\??mk::#1:ff\endcsname - \fi}% - {\fetchmark[#1][\v!last]}% - {\fetchmark[#1][\v!current]}}% - \setxvalue{\??mk::#1:pp}{\fetchmark[#1][\v!first]}% - \letgvalue{\??mk::#1:ff}\relax - } - -\def\bubblesavedmark[#1][#2]% no packing (not now, maybe make a six-pack later) - {\@EA\ifx\csname\??mk::#1:ff\endcsname\relax - \setxvalue{\??mk::#1:ff}{\fetchmark[#1][\v!first]}% - \fi} - -\def\resetsavedmark[#1][#2]% mark tag - {\doifelsenothing{\fetchmark[#1][\v!previous]} - {\letgvalue{\??mk::#1:pp}\relax} - {\setxvalue{\??mk::#1:pp}{\fetchmark[#1][\v!previous]}}% - \doifelsenothing{\fetchmark[#1][\v!first]} - {\letgvalue{\??mk::#1:ff}\relax} - {\setxvalue{\??mk::#1:ff}{\fetchmark[#1][\v!first]}}% - \letgvalue{\??mk::#1:#2}\emptysavedmark} +% the fetchers are fully expandable: [name][method] -\def\presetsavedmark[#1][#2]% mark tag - {\letgvalue{\??mk::#1:#2}\emptysavedmark} +\def\fetchonemark[#1]#2[#3]{\ifconditional\inhibitgetmarking\else\ctxcommand{fetchonemark ("#1","\v!page","#2")}\fi} +\def\fetchtwomarks [#1]{\ifconditional\inhibitgetmarking\else\ctxcommand{fetchtwomarks("#1","\v!page")}\fi} +\def\fetchallmarks [#1]{\ifconditional\inhibitgetmarking\else\ctxcommand{fetchallmarks("#1","\v!page")}\fi} -\def\emptysavedmark{{}{}{}{}} +\let\fetchmark\fetchonemark -% new (can be used in column sets) -% -% \getsavedmarking[M][previous] -% \getsavedmarking[M][first] -% \getsavedmarking[M][last] - -\def\getsavedmarking - {\dodoubleargument\dogetsavedmarking} - -\def\dogetsavedmarking[#1][#2]% - {\doifelse{#2}\v!previous - {\getmarking[#1][1][\v!previous]} - {\doifelse{#2}\v!first - {\getmarking[#1][1][\v!first]} - {\getmarking[#1][\v!last]}}} +% also fully expandable but here we have: [name][range][method] -%D And then \unknown\ we had a chaptertitle packaged in a -%D makeup environment. And we don't want to loose marks there! +\def\fetchonemarking[#1]#2[#3]#4[#5]{\ifconditional\inhibitgetmarking\else\ctxcommand{fetchonemark ("#1","#3","#5")}\fi} +\def\fetchtwomarkings [#1]#2[#3]{\ifconditional\inhibitgetmarking\else\ctxcommand{fetchtwomarks("#1","#3")}\fi} +\def\fetchallmarkings [#1]#2[#3]{\ifconditional\inhibitgetmarking\else\ctxcommand{fetchallmarks("#1","#3")}\fi} -\newbox\collectedmarks +\let\fetchmarking\fetchonemarking -\def\flushmarks % use with care to avoid empty pages - {\ifvoid\collectedmarks\else\unhbox\collectedmarks\fi} +\def\markingseparator#1{\namedmarkingparameter{#1}\c!separator} +\def\markingcommand #1{\namedmarkingparameter{#1}\c!filtercommand} -\def\postponemarks - {\let\setsomemark\postponemark} - -\def\postponemark#1#2% - {\global\setbox\collectedmarks\hbox{\unhbox\collectedmarks\setmark{#1}{#2}}} +%D Experimental: +%D +%D \starttyping +%D \definemarking[boxmark] +%D +%D \setbox0\ruledvbox{ +%D \marking[boxmark]{tufte} \input tufte \par +%D \marking[boxmark]{ward} \input ward \par +%D } +%D +%D \synchronizemarking[zerobox][0] \box0 +%D +%D marks: (\getmarking[boxmark][zerobox][first],\getmarking[boxmark][zerobox][last]) +%D \stoptyping \protect \endinput - -% todo: make it work in balancing -% -% \definemarking[vers][] -% \setupheadertexts -% [\doiftext{\getmarking[vers][first]} -% {\doiftextelse{\getmarking[vers][column:last]} -% {\getmarking[vers][first] -- \getmarking[vers][column:last]} -% {\getmarking[vers][first]}}] -% \starttext -% \startcolumns[n=2,balance=no] -% \dorecurse{10}{\normalexpanded{\noexpand\marking[vers]{\recurselevel}} \recurselevel:\dorecurse{4}{\input ward } \endgraf} -% \stopcolumns -% \stoptext diff --git a/Master/texmf-dist/tex/context/base/strc-mat.lua b/Master/texmf-dist/tex/context/base/strc-mat.lua index 291cc8845d6..d9cca27176a 100644 --- a/Master/texmf-dist/tex/context/base/strc-mat.lua +++ b/Master/texmf-dist/tex/context/base/strc-mat.lua @@ -6,19 +6,15 @@ if not modules then modules = { } end modules ['strc-mat'] = { license = "see context related readme files" } -structure = structure or { } -structure.helpers = structure.helpers or { } -structure.lists = structure.lists or { } -structure.lists.enhancers = structure.lists.enhancers or { } -structure.sections = structure.sections or { } -structure.helpers = structure.helpers or { } -structure.formulas = structure.formulas or { } - -local lists = structure.lists -local sections = structure.sections -local floats = structure.floats -local helpers = structure.helpers -local formulas = structure.formulas +local structures = structures + +local lists = structures.lists +local sections = structures.sections +local floats = structures.floats +local helpers = structures.helpers +local formulas = structures.formulas + +lists.enhancers = lists.enhancers or { } -- maybe we want to do clever things with formulas, the store might go away diff --git a/Master/texmf-dist/tex/context/base/strc-mat.mkiv b/Master/texmf-dist/tex/context/base/strc-mat.mkiv index 2064db2c586..8d408936036 100644 --- a/Master/texmf-dist/tex/context/base/strc-mat.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-mat.mkiv @@ -73,8 +73,9 @@ [\c!name=\v!formula,\s!counter=\v!formula,% \s!hascaption=\v!yes,\s!hastitle=\v!yes,\s!hasnumber=\v!yes,%\s!haslevel=#6,% \s!hasnumber=\v!no,% - \c!reference=#1,\c!title=,\c!bookmark=]% + \c!reference=#1,\c!title=\namedformulaentry,\c!bookmark=]% [#2]% + \glet\namedformulaentry\relax \globallet#3\laststructurecounternumber \globallet#4\laststructurecountersynchronize \globallet#5\laststructurecounterattribute} @@ -86,6 +87,13 @@ \newtoks\everyresetformulas +% 0=unset, 1=forced, 2=none, 3=reference + +\newconstant\placeformulanumbermode +\newconstant\formulasnumbermode +\newconstant\subformulasnumbermode +\newconstant\nestedformulanumbermode + \newconditional\insideplaceformula \newconditional\insideplacesubformula \newconditional\insideformulas @@ -129,11 +137,17 @@ \def\doplacecurrentformulanumber {\dohandlecurrentformulareferences - %\currentformulasattribute % todo - %\currentformulasattribute % todo - %\currentsubformulaattribute % todo \labeltexts\currentformula{\doconvertedstructurecounter[\v!formula][]}} +% \def\theboxdestinationattribute#1{\iflocation\ifx#1\relax\else\ifx#1\empty\else attr \destinationattribute#1\fi\fi\fi} +% \def\thedestinationattribute #1{\iflocation\ifx#1\relax\else\ifx#1\empty\else \attribute\destinationattribute#1\fi\fi\fi} + +\def\theformuladestinationattribute#1% + {\iflocation\ifx#1\relax\else\ifx#1\empty\else + \attribute\destinationattribute#1% + \glet#1\relax + \fi\fi\fi} + \appendtoks \glet\currentplaceformulasynchronize \relax \glet\currentformulassynchronize \relax @@ -142,6 +156,8 @@ \let\currentformula\empty \to \everyresetformulas +% currently we do the number, some day we will do the (sub) formula + \def\dohandlecurrentformulareferences {\ifnum\placeformulanumbermode=\plusthree \storecurrentformulanumber @@ -152,6 +168,7 @@ \currentplaceformulaattribute \currentplaceformulasynchronize \glet\currentplaceformulasynchronize\relax + \theformuladestinationattribute\currentplaceformulaattribute \fi \ifnum\formulasnumbermode=\plusthree \storecurrentformulanumber @@ -162,6 +179,7 @@ \currentformulasattribute \currentformulassynchronize \glet\currentformulassynchronize\relax + \theformuladestinationattribute\currentformulasattribute \fi \ifnum\subformulasnumbermode=\plusthree \currentsubformulassynchronize @@ -176,17 +194,21 @@ \currentnestedformulaattribute \currentnestedformulasynchronize \glet\currentnestedformulasynchronize\relax + \theformuladestinationattribute\currentnestedformulaattribute \fi} +% needs checking ... too many: + +\let\currentplaceformulaattribute\relax \let\currentplaceformulasynchronize\relax \let\currentplaceformulanumber\relax +\let\currentformulaattribute \relax \let\currentformulasynchronize \relax \let\currentformulanumber \relax +\let\currentsubformulaattribute \relax \let\currentsubformulasynchronize \relax \let\currentsubformulanumber \relax +\let\currentformulasattribute \relax \let\currentformulassynchronize \relax \let\currentformulasnumber \relax + \let\currentformulasreference \empty \let\currentformulassuffix \empty \let\currentformulareference \empty \let\currentformulasuffix \empty \let\currentsubformulareference \empty \let\currentsubformulasuffix \empty \let\currentnestedformulareference\empty \let\currentnestedformulasuffix\empty -\let\currentformulasynchronize \relax \let\currentformulaattribute \relax -\let\currentsubformulasynchronize\relax \let\currentsubformulaattribute\relax -\let\currentformulassynchronize \relax \let\currentformulasattribute \relax - \def\dohandleformulanumbering {\doincrementsubstructurecounter[\v!formula][1]% \doiftext\currentplaceformulasuffix{\setsubstructurecounterown[\v!formula][2]{\currentplaceformulasuffix}}% @@ -241,6 +263,15 @@ \definelist[\v!formula] +\installstructurelistprocessor\v!formula % to be checked ... + {\dodolistelement + \currentlist + \structurelistlocation + \structurelistgenericnumber + \structurelistgenerictitle % hm, can end up in message (volkers test) + \structurelistpagenumber + \structurelistrealpagenumber} + \appendtoks \global\setfalse\insideplaceformula \global\setfalse\insideplacesubformula @@ -425,6 +456,7 @@ \def\dodostartformula[#1][#2]% setting leftskip adaption is slow ! {\bgroup % HERE \def\currentformula{#1}% + \dostarttagged\t!formula\currentformula \the\everybeforedisplayformula \formulaparskip\parskip \formulastrutdp\strutdepth @@ -439,7 +471,7 @@ \doifsomething{\formulaparameter\c!margin}% so we test first {\dosetleftskipadaption{\formulaparameter\c!margin}% \edef\leftdisplaymargin{\the\leftskipadaption}}% overloaded - \long\def\dostartformula##1{\bgroup\let\dostopformula\egroup}% + \long\def\dostartformula##1{\bgroup\dostarttagged\t!subformula\def\dostopformula{\dostoptagged\egroup}}% \freezedimenmacro\leftdisplayskip \freezedimenmacro\rightdisplayskip \freezedimenmacro\leftdisplaymargin @@ -448,6 +480,15 @@ \forgetdisplayskips \getvalue{\e!start\formulaparameter\c!alternative\v!formula}} +% experiment: + +\appendtoks + \edef\currentformulagrid{\formulaparameter\c!grid}% + \ifx\currentformulagrid\empty \else + \autosetsnapvalue\currentformulagrid + \fi +\to \everybeforedisplayformula + \def\switchtoformulabodyfont{\switchtobodyfont} \setvalue{\v!formula}{\dosingleempty\doformula} @@ -460,8 +501,13 @@ \endgroup} \def\dostopformula - {\doplaceformulanumber + {\dostarttagged\t!formulatag\empty + \doplaceformulanumber + \dostoptagged + \dostarttagged\t!formulacontent\empty \getvalue{\e!stop\formulaparameter\c!alternative\v!formula}% + \dostoptagged + \dostoptagged \nonoindentation \checknextindentation[\formulaparameter\c!indentnext]% \egroup @@ -573,6 +619,7 @@ \def\dostartformulas[#1]#2\stopformulas % new / to be internationalized {\bgroup + \dostarttagged\t!formulaset\empty \global\settrue\insideformulas \edef\currentformulasreference{#1}% \handleformulasnumbering @@ -597,6 +644,7 @@ \egroup \stopdisplaymath \global\setfalse\insideformulas + \dostoptagged \egroup \the\everyresetformulas \hangafter\minusone % added for side floats @@ -604,19 +652,13 @@ % place -% 0=unset, 1=forced, 2=none, 3=reference - -\chardef\placeformulanumbermode \zerocount -\chardef\formulanumbermode \zerocount -\chardef\formulasnumbermode \zerocount -\chardef\subformulasnumbermode \zerocount -\chardef\nestedformulanumbermode\zerocount - \def\inhibitformulanumberflag{-} \def\forceformulanumberflag {+} \def\docheckformulareference#1#2% - {\chardef#1\ifx#2\empty + {#1\unless\ifx\namedformulaentry\relax % new 29/8/2010 + \plusthree + \else\ifx#2\empty \zerocount \else\ifx#2\forceformulanumberflag \plusone @@ -624,7 +666,7 @@ \plustwo \else \plusthree - \fi\fi\fi} + \fi\fi\fi\fi} \def\formulanumber{\doformulanumber} % for the moment @@ -640,41 +682,16 @@ \dododoformulanumber} \unexpanded\def\placeformula - {\doglobal\settrue\insideplaceformula + {\global\settrue\insideplaceformula \settrue\incrementformulanumber - \dodoubleempty\doplaceformula} + \dosingleempty\doplaceformula} \unexpanded\def\placesubformula - {\doglobal\settrue\insideplacesubformula + {\global\settrue\insideplacesubformula \setfalse\incrementformulanumber - \dodoubleempty\doplaceformula} - -% \def\doplaceformula[#1][#2]% #2 = dummy, gobbles spaces -% {\def\currentplaceformulareference{#1}% -% \let\currentplaceformulasuffix\empty -% \futurelet\next\redoplaceformulaone} -% -% \let\mathdollarsign$ % no def -% -% \def\redoplaceformulaone % use doifnextcharelse -% {\ifx\next\bgroup -% \@EA\moreplaceformula % [ref]{} -% \else -% \@EA\redoplaceformulatwo -% \fi} -% -% \long\def\moreplaceformula#1#2% #1 dummy #1 gobbles spaces -% {\def\currentplaceformulasuffix{#1}% -% \futurelet\next\redoplaceformulatwo#2} -% -% \def\redoplaceformulatwo -% {\ifx\next\mathdollarsign -% \@EA\dispplaceformula % [ref]$$ -% \else -% \@EA\dodoplaceformula % [ref]\start -% \fi}% + \dosingleempty\doplaceformula} -\def\doplaceformula[#1][#2]% #2 = dummy, gobbles spaces +\def\doplaceformula[#1]% {\def\currentplaceformulareference{#1}% \let\currentplaceformulasuffix\empty \doifnextbgroupelse\moreplaceformula\redoplaceformula} % [ref]{} @@ -747,12 +764,10 @@ \setformulalistentry{#2}% \next} -\global\let\doflushformulalistentry\gobbleoneargument +\glet\namedformulaentry\relax % this will become a key/value so that we can do bookmarks \def\setformulalistentry#1% - {\gdef\doflushformulalistentry##1% - {\normalexpanded{\noexpand\writetolist[\v!formula]{##1}}{#1}% - \global\let\doflushformulalistentry\gobbleoneargument}} + {\gdef\namedformulaentry{#1}} \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/strc-not.lua b/Master/texmf-dist/tex/context/base/strc-not.lua index be883af57eb..07cd3249646 100644 --- a/Master/texmf-dist/tex/context/base/strc-not.lua +++ b/Master/texmf-dist/tex/context/base/strc-not.lua @@ -8,33 +8,31 @@ if not modules then modules = { } end modules ['strc-not'] = { local format = string.format local next = next -local texsprint, texwrite, texcount = tex.sprint, tex.write, tex.count +local texcount = tex.count -local ctxcatcodes = tex.ctxcatcodes +local trace_notes = false trackers.register("structures.notes", function(v) trace_notes = v end) -local trace_notes = false trackers.register("structure.notes", function(v) trace_notes = v end) +local report_notes = logs.reporter("structure","notes") -structure = structure or { } -structure.helpers = structure.helpers or { } -structure.lists = structure.lists or { } -structure.sections = structure.sections or { } -structure.counters = structure.counters or { } -structure.notes = structure.notes or { } +local structures = structures +local helpers = structures.helpers +local lists = structures.lists +local sections = structures.sections +local counters = structures.counters +local notes = structures.notes +local references = structures.references -structure.notes.states = structure.notes.states or { } -structure.lists.enhancers = structure.lists.enhancers or { } +notes.states = notes.states or { } +lists.enhancers = lists.enhancers or { } -storage.register("structure/notes/states", structure.notes.states, "structure.notes.states") +storage.register("structures/notes/states", notes.states, "structures.notes.states") -local helpers = structure.helpers -local lists = structure.lists -local sections = structure.sections -local counters = structure.counters -local notes = structure.notes - -local notestates = structure.notes.states +local notestates = notes.states local notedata = { } +local variables = interfaces.variables +local context = context + -- state: store, insert, postpone function notes.store(tag,n) @@ -43,16 +41,16 @@ function notes.store(tag,n) nd = { } notedata[tag] = nd end - local nnd = #nd+1 + local nnd = #nd + 1 nd[nnd] = n local state = notestates[tag] if state.kind ~= "insert" then if trace_notes then - logs.report("notes","storing %s with state %s as %s",tag,state.kind,nnd) + report_notes("storing %s with state %s as %s",tag,state.kind,nnd) end state.start = state.start or nnd end - texwrite(#nd) + context(#nd) end local function get(tag,n) @@ -62,9 +60,11 @@ local function get(tag,n) nd = nd[n] if nd then if trace_notes then - logs.report("notes","getting %s of %s",n,tag) + report_notes("getting note %s of '%s'",n,tag) end - return structure.lists.collected[nd] + -- is this right? + local newdata = lists.collected[nd] + return newdata end end end @@ -74,13 +74,14 @@ local function getn(tag) return (nd and #nd) or 0 end -nodes.get = get -nodes.getn = getn +notes.get = get +notes.getn = getn -- we could make a special enhancer function notes.listindex(tag,n) - return notedata[tag][n] + local ndt = notedata[tag] + return ndt and ndt[n] end function notes.define(tag,kind,number) @@ -92,11 +93,12 @@ function notes.save(tag,newkind) local state = notestates[tag] if state and not state.saved then if trace_notes then - logs.report("notes","saving state of %s: %s -> %s",tag,state.kind,newkind or state.kind) + report_notes("saving state of '%s': %s -> %s",tag,state.kind,newkind or state.kind) end - state.saved = notedata[tag] + state.saveddata = notedata[tag] state.savedkind = state.kind state.kind = newkind or state.kind + state.saved = true notedata[tag] = { } end end @@ -105,18 +107,19 @@ function notes.restore(tag,forcedstate) local state = notestates[tag] if state and state.saved then if trace_notes then - logs.report("notes","restoring state of %s: %s -> %s",tag,state.kind,state.savedkind) + report_notes("restoring state of '%s': %s -> %s",tag,state.kind,state.savedkind) end - state.saved = nil + notedata[tag] = state.saveddata state.kind = forcedstate or state.savedkind - notedata[tag] = state.saved + state.saveddata = nil + state.saved = false end end function notes.setstate(tag,newkind) local state = notestates[tag] if trace_notes then - logs.report("notes","setting state of %s from %s to %s",tag,(state and state.kind) or "unset",newkind) + report_notes("setting state of '%s' from %s to %s",tag,(state and state.kind) or "unset",newkind) end if not state then state = { @@ -136,7 +139,7 @@ end function notes.getstate(tag) local state = notestates[tag] - texsprint(ctxcatcodes,(state and state.kind ) or "unknown") + context(state and state.kind or "unknown") end function notes.doifcontent(tag) @@ -162,7 +165,7 @@ local function internal(tag,n) if r then local i = r.internal --~ return i and lists.internals[i] - return i and jobreferences.internals[i] + return i and references.internals[i] -- dependency on references end end return nil @@ -214,7 +217,7 @@ function notes.deltapage(tag,n) if li then local metadata, pagenumber = li.metadata, li.pagenumber if metadata and pagenumber then - local symbolpage = metadata.symbolpage or 0 + local symbolpage = references.symbolpage or 0 local notepage = pagenumber.number or 0 if notepage > 0 and symbolpage > 0 then if notepage < symbolpage then @@ -231,12 +234,12 @@ function notes.deltapage(tag,n) what = 3 end end - texwrite(what) + context(what) end function notes.postpone() if trace_notes then - logs.report("notes","postponing all insert notes") + report_notes("postponing all insert notes") end for tag, state in next, notestates do if state.kind ~= "store" then @@ -245,28 +248,39 @@ function notes.postpone() end end -function notes.setsymbolpage(tag,n) - local nd = get(tag,n) - if nd then - nd.metadata.symbolpage = texcount.realpageno +function notes.setsymbolpage(tag,n,l) + local l = l or notes.listindex(tag,n) + if l then + local p = texcount.realpageno + if trace_notes then + report_notes("note %s of '%s' with list index %s gets page %s",n,tag,l,p) + end + lists.cached[l].references.symbolpage = p + else + report_notes("internal error: note %s of '%s' is not initialized",n,tag) end end function notes.getsymbolpage(tag,n) local nd = get(tag,n) - nd = nd and nd.metadata.symbolpage - texwrite(nd or 0) + local p = nd and nd.references.symbolpage or 0 + if trace_notes then + report_notes("page number of note symbol %s of '%s' is %s",n,tag,p) + end + context(p) end function notes.getnumberpage(tag,n) local li = internal(tag,n) - li = li and li.pagenumber - li = li and li.numbers - li = li and li[1] - texwrite(li or 0) + li = li and li.references + li = li and li.realpage or 0 + if trace_notes then + report_notes("page number of note number %s of '%s' is %s",n,tag,li) + end + context(li) end -function notes.flush(tag,whatkind) -- store and postpone +function notes.flush(tag,whatkind,how) -- store and postpone local state = notestates[tag] local kind = state.kind if kind == whatkind then @@ -275,10 +289,10 @@ function notes.flush(tag,whatkind) -- store and postpone if kind == "postpone" then if nd and ns then if trace_notes then - logs.report("notes","flushing state %s of %s from %s to %s",whatkind,tag,ns,#nd) + report_notes("flushing state %s of %s from %s to %s",whatkind,tag,ns,#nd) end for i=ns,#nd do - texsprint(ctxcatcodes,format("\\handlenoteinsert{%s}{%s}",tag,i)) + context.handlenoteinsert(tag,i) end end state.start = nil @@ -286,31 +300,45 @@ function notes.flush(tag,whatkind) -- store and postpone elseif kind == "store" then if nd and ns then if trace_notes then - logs.report("notes","flushing state %s of %s from %s to %s",whatkind,tag,ns,#nd) + report_notes("flushing state %s of %s from %s to %s",whatkind,tag,ns,#nd) end + -- todo: as registers: start, stop, inbetween for i=ns,#nd do - texsprint(ctxcatcodes,format("\\handlenoteitself{%s}{%s}",tag,i)) + -- tricky : trialtypesetting + if how == variables.page then + local rp = get(tag,i) + rp = rp and rp.references + rp = rp and rp.symbolpage or 0 + if rp > texcount.realpageno then + state.start = i + return + end + end + if i > ns then + context.betweennoteitself(tag) + end + context.handlenoteitself(tag,i) end end state.start = nil elseif kind == "reset" then if nd and ns then if trace_notes then - logs.report("notes","flushing state %s of %s from %s to %s",whatkind,tag,ns,#nd) + report_notes("flushing state %s of %s from %s to %s",whatkind,tag,ns,#nd) end end state.start = nil elseif trace_notes then - logs.report("notes","not flushing state %s of %s",whatkind,tag) + report_notes("not flushing state %s of %s",whatkind,tag) end elseif trace_notes then - logs.report("notes","not flushing state %s of %s",whatkind,tag) + report_notes("not flushing state %s of %s",whatkind,tag) end end function notes.flushpostponed() if trace_notes then - logs.report("notes","flushing all postponed notes") + report_notes("flushing all postponed notes") end for tag, _ in next, notestates do notes.flush(tag,"postpone") @@ -319,7 +347,7 @@ end function notes.resetpostponed() if trace_notes then - logs.report("notes","resetting all postponed notes") + report_notes("resetting all postponed notes") end for tag, state in next, notestates do if state.kind == "postpone" then @@ -330,9 +358,17 @@ function notes.resetpostponed() end function notes.title(tag,n) - structure.lists.savedtitle(tag,notedata[tag][n]) + lists.savedtitle(tag,notedata[tag][n]) end function notes.number(tag,n,spec) - structure.lists.savedprefixednumber(tag,notedata[tag][n]) + lists.savedprefixednumber(tag,notedata[tag][n]) +end + +function notes.internalid(tag,n) + local nd = get(tag,n) + if nd then + local r = nd.references + return r.internal + end end diff --git a/Master/texmf-dist/tex/context/base/strc-not.mkii b/Master/texmf-dist/tex/context/base/strc-not.mkii index f6fae3378ce..ec38410d483 100644 --- a/Master/texmf-dist/tex/context/base/strc-not.mkii +++ b/Master/texmf-dist/tex/context/base/strc-not.mkii @@ -285,8 +285,6 @@ % todo: make sure less calls, is quite some code -% BEWARE, OVERLOADED IN cont-new.mkiv - \def\dochecknote % only to be called locally, some bools will become class-ones {% for the moment no mixed text/endnotes modes, so we use % \footnoteparameter and not \noteparameter (**) @@ -536,7 +534,7 @@ \unexpanded\def\setnotetext{\dotripleempty\dosetnote[0]} \def\dosetnote[#1][#2][#3]% - {\unskip + {\removeunwantedspaces \def\currentnote{#2}% \dochecknote % sometimes needed for local notes \ifcase#1\relax diff --git a/Master/texmf-dist/tex/context/base/strc-not.mkiv b/Master/texmf-dist/tex/context/base/strc-not.mkiv index 45e37b276f5..bf815c7281f 100644 --- a/Master/texmf-dist/tex/context/base/strc-not.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-not.mkiv @@ -19,14 +19,10 @@ % this needs a further cleanup ... % -% -- set breakpoin in descriptions +% -- set breakpoint in descriptions % -- reset after trialtypesetting % -- that way we can trick the symbol space -% obsolete - -\let\autopostponenotes\relax - % removed: % % \pushsomestates @@ -38,17 +34,12 @@ % saveinsertionbox % eraseinsertionbackup % restoreinsertionbackup -% -% \def\doprocessnotescs#1#2% #1 == \cs that takes arg -% {\def\currentnote{#2}\@EA#1\csname\??vn:\currentnote\endcsname} -% \def\processnotescs#1{\processcommacommand[\noteinsertions]{\doprocessnotescs#1}} -% \def\noteinsertion #1{\csname\??vn:#1\endcsname} -\def\savenotedata {\writestatus{todo}{save note data}} -\def\restorenotedata {\writestatus{todo}{restore note data}} -\def\savenotecontent {\writestatus{todo}{save note content}} -\def\restorenotecontent{\writestatus{todo}{restore note content}} -\def\erasenotebackup {\writestatus{todo}{erase note backup}} +\def\savenotedata {} % \writestatus{todo}{save note data}} +\def\restorenotedata {} % \writestatus{todo}{restore note data}} +\def\savenotecontent {} % \writestatus{todo}{save note content}} +\def\restorenotecontent{} % \writestatus{todo}{restore note content}} +\def\erasenotebackup {} % \writestatus{todo}{erase note backup}} % page-set: @@ -183,7 +174,7 @@ \c!width=\defaultnotewidth, \c!height=\textheight, \c!numbercommand=\high, - \c!command=\noteparameter\c!numbercommand, % downward compatible + \c!command=, % \noteparameter\c!numbercommand, % (command in enumeration) too messy, called twice \c!separator=,% \@@koseparator, \c!textcommand=\high, \c!textstyle=\tx, @@ -192,9 +183,11 @@ %\c!factor=, %\c!scope=, % \v!text \v!page \c!prefixconnector=., - %\c!next=\autoinsertnextspace + %\c!next=\autoinsertnextspace, \c!prefix=\v!no, %\c!continue=\v!no, + \c!paragraph=\v!no, + \c!inbetween=\hskip1em, \c!n=1] \setupnotes @@ -214,40 +207,85 @@ \newtoks \everysetupnote \unexpanded\def\definenote - {\dodoubleempty\dodefinenote} + {\dotripleempty\dodefinenote} -\def\dodefinenote[#1][#2]% +\def\dodefinenote[#1][#2][#3]% note [parent] [settings] {\edef\currentnote{#1}% \ifcsname\??vn:\currentnote\endcsname\else \@EA\installinsertion\csname\??vn:\currentnote\endcsname\relax \appendtoks\doprocesssomenote{#1}\to\tobeprocessednotes \fi - \defineenumeration % description + \ifsecondargument + \doifassignmentelse{#2}{\dodefinenotewithsettings{#2}}{\dodefinenotewithparent{#2}{#3}}% + \else + \dodefinenotesimple + \fi + \ctxlua{structures.notes.define("\currentnote","insert",\number\csname\??vn:\currentnote\endcsname)}% + \the\everysetupnote + \dochecknote} + +\def\dodefinenotesimple + {\defineenumeration [\currentnote] - [\c!location=\@@defaultnotedefloc, + [\s!handler=\v!note, + \c!text=, + \c!location=\@@defaultnotedefloc, \c!distance=\@@defaultnotedefdis, \c!width=\v!fit, - \c!headstyle=\noteparameter\c!style, % hm - \c!headcolor=\noteparameter\c!color, % hm - \s!handler=\v!note, + \c!headstyle=\noteparameter\c!style, + \c!headcolor=\noteparameter\c!color, + \c!before=, + \c!after=]% + \doredefinenotecommands + \presetlocalframed + [\??vn\currentnote]% + \setupenumerations + [\currentnote] + [\s!parent=\??vn\currentnote, + \c!number=\v!yes]% no inheritance from decriptions which is okay + \getparameters + [\??vn\currentnote] + [\s!parent=\??vn]} + +\def\dodefinenotewithsettings#1% + {\defineenumeration % description + [\currentnote] + [\s!handler=\v!note, \c!text=, + \c!location=\@@defaultnotedefloc, + \c!distance=\@@defaultnotedefdis, + \c!width=\v!fit, + \c!headstyle=\noteparameter\c!style, + \c!headcolor=\noteparameter\c!color, \c!before=, \c!after=]% - \doredefinenotecommands\currentnote + \doredefinenotecommands + \presetlocalframed + [\??vn\currentnote]% \setupenumerations [\currentnote] [\s!parent=\??vn\currentnote, - \c!number=\v!yes] % no inheritance from decriptions which is okay + \c!number=\v!yes]% + \getparameters + [\??vn\currentnote] + [\s!parent=\??vn,#1]} + +\def\dodefinenotewithparent#1#2% + {%setevalue{\??vn:#2:kids}{\ifcsname\??vn:#2:kids\endcsname\csname\??vn:#2:kids\endcsname,\fi#1}% + \defineenumeration + [\currentnote] + [\s!handler=\v!note, + \c!text=]% + \doredefinenotecommands \presetlocalframed [\??vn\currentnote]% + \setupenumerations + [\currentnote] + [\s!parent=\??dd#1, + \c!number=\v!yes]% \getparameters [\??vn\currentnote] - [\s!parent=\??vn,#2]% -% \definestructurecounter -% [\currentnote]% - \ctxlua{structure.notes.define("\currentnote","insert",\number\csname\??vn:\currentnote\endcsname)}% - \the\everysetupnote - \dochecknote} + [\s!parent=\??vn#1,#2]} % \starttext % text \startfootnote Test.\stopfootnote @@ -263,25 +301,27 @@ {\begingroup \doenumerationinit{#1}{#2}{#3}% \@@notemakedescription[##1]{}{##2}% - \endgroup}} + \expandafter\endgroup\noteparameter\c!next}} % WS: added \noteparameter\c!next -\def\doredefinenotecommands#1% - {\normalexpanded{\noexpand\dodoredefinenotecommands{#1}{1}{}}% +\def\doredefinenotecommands + {\normalexpanded{\noexpand\dodoredefinenotecommands{\currentnote}{1}{}}% \let\@@subslevel\empty \dostepwiserecurse{2}{\descriptionparameter\c!levels}{1} - {\normalexpanded{\noexpand\dodoredefinenotecommands{#1}{\recurselevel}{\@@subslevel\v!sub}}% + {\normalexpanded{\noexpand\dodoredefinenotecommands{\currentnote}{\recurselevel}{\@@subslevel\v!sub}}% \edef\@@subslevel{\@@subslevel\v!sub}}} \let\setupnotedefinition\setupenumerations +% \def\dodowithcurrentnoteandkids#1#2% action kid +% {\pushmacro\currentnote +% \def\currentnote{#2}% +% \dowithcurrentnoteandkids{#1}% recursive +% \popmacro\currentnote}% + \appendtoks \setupenumerations[\currentnote][]% \to \everysetupnote -% \appendtoks -% \dochecknote -% \to \everysetupnote - \unexpanded\def\setupnote {\dodoubleempty\dosetupnote} @@ -338,8 +378,8 @@ % compatibility (will go away) -\newif\ifendnotes -\newif\ifbottomnotes +\newif\ifbottomnotes % still used in page-one.mkiv +%newif\endnotes % no longer used % locations: @@ -351,10 +391,9 @@ \def\clevernotes % compatibility hack, will be redone {\numexpr\ifcase\namednoteparameter\v!footnote\s!noteloc\or0\or2\or2\or1\else0\fi\relax} -\def\setnotelocation #1{\expandafter\chardef\csname\??vn\currentnote\s!noteloc\endcsname#1\relax} -\def\setnoteposition #1{\expandafter\chardef\csname\??vn\currentnote\s!notepos\endcsname#1\relax} -\def\setnoteformatting#1{\expandafter\chardef\csname\??vn\currentnote\s!notefmt\endcsname#1\relax} -\def\setnotecolumns #1{\expandafter\chardef\csname\??vn\currentnote\s!notecol\endcsname#1\relax} +\def\setnotelocation #1{\expandafter\let\csname\??vn\currentnote\s!noteloc\endcsname#1\relax} +\def\setnoteposition #1{\expandafter\let\csname\??vn\currentnote\s!notepos\endcsname#1\relax} +\def\setnoteformatting#1{\expandafter\let\csname\??vn\currentnote\s!notefmt\endcsname#1\relax} \def\currentnofcolumns{\@@kln} @@ -369,20 +408,25 @@ \def\dosetcheckednote#1{\csname\??vn @#1\endcsname} +\newtoks\everychecknote + \def\dochecknote {% node states - \setnotelocation\plusone - \setnoteposition\plustwo - \normalexpanded{\noexpand\rawprocesscommalist[\noteparameter\c!location]}\dosetcheckednote + \setnotelocation\plusone % page + \setnoteposition\plustwo % high + \normalexpanded{\rawprocesscommalist[\noteparameter\c!location]}\dosetcheckednote % compatibility hack - \ifnum\noteparameter\s!noteloc=\plusfive \endnotestrue \else \endnotesfalse \fi + %ifnum\noteparameter\s!noteloc=\plusfive \endnotestrue \else \endnotesfalse \fi \ifnum\noteparameter\s!notepos=\plustwo \bottomnotestrue \else \bottomnotesfalse \fi % set column multiplier \edef\currentnotenofcolumns{\noteparameter\c!n}% \ifx\currentnotenofcolumns\empty \let\currentnotenofcolumns\!!plusone \fi - \ifcase\noteparameter\s!noteloc\or + \ifcase\noteparameter\s!noteloc + % can't happen + \scratchcounter\plusone + \or % page \scratchcounter \currentnotenofcolumns \or @@ -399,6 +443,9 @@ \scratchcounter\currentnotenofcolumns \fi % column factor + \ifcase\scratchcounter + \scratchcounter\plusone + \fi \global\count\currentnoteins\plusthousand \global\count\currentnoteins\numexpr\plusthousand/\scratchcounter\relax % maximize height @@ -409,17 +456,19 @@ \dosetnotedistance % play safe \ifnum\noteparameter\s!noteloc=\plusfive - \ctxlua{structure.notes.setstate("\currentnote","store")}% + \ctxlua{structures.notes.setstate("\currentnote","store")}% % text notes (e.g. end notes) but we don't use inserts anyway \global\dimen\currentnoteins\maxdimen \global\count\currentnoteins\zerocount \global\skip \currentnoteins\zeropoint - \fi} + \fi + \the\everychecknote} \def\dosetnotedistance {\begingroup \setbox\scratchbox\vbox {\forgetall +% \setnotebodyfont \dontcomplain \noteparameter\c!before \placenoterule @@ -580,7 +629,7 @@ \unexpanded\def\setnotetext[#1]{\global\settrue\skipnoteplacement\getvalue{#1}} \def\domovednote#1#2#3#4% - {\ifcase\ctxlua{structure.notes.deltapage("#1",#2)}\or\symbol[#3]\or\symbol[#4]\fi} + {\ifcase\ctxlua{structures.notes.deltapage("#1",#2)}\or\symbol[#3]\or\symbol[#4]\fi} \setvalue{\??dd:\v!note:\s!handler:\s!text }{\@@donotetext} \setvalue{\??dd:\v!note:\s!handler:\s!number}{\@@donotenumber} @@ -605,7 +654,7 @@ \doenumerationcheckconditions \let\currentnote\currentdescriptionmain \dodescriptioncomponent[\c!reference=#1,\c!label={\descriptionparameter\c!text},\c!title={#3},\c!list=,\c!bookmark=,][]% - \xdef\currentnotenumber{\ctxlua{structure.notes.store("\currentnote",\currentdescriptionnumberentry)}}% + \xdef\currentnotenumber{\ctxlua{structures.notes.store("\currentnote",\currentdescriptionnumberentry)}}% \settrue\processingnote \ifconditional\skipnoteplacement \globallet\lastnotesymbol\dolastnotesymbol @@ -637,15 +686,21 @@ \fi} \def\dolastnotesymbol - {\typesetsomenotesymbol\currentnote\currentnotenumber} + {\typesetsomenotesymbol\currentnote\currentnotenumber\currentdescriptionnumberentry} + +\let\dotagsetnotesymbol\relax -\def\dotypesetsomenotesymbol#1#2% running text +\def\dotypesetsomenotesymbol#1#2#3% running text (messy: #1 and current mixed) {\dodonotesymbol - {\synchronizesomenotesymbol{#1}{#2}% - \ctxlua{structure.notes.number("\currentnote",\currentnotenumber)}% \currentdescriptionnumberentry + {\synchronizesomenotesymbol{#1}{#2}{#3}% +% \ctxlua{structures.notes.number("\currentnote",\currentnotenumber)}% \currentdescriptionnumberentry + \dostarttagged\t!descriptionsymbol\currentnote + \dotagsetnotesymbol + \ctxlua{structures.notes.number("#1",#2)}% + \dostoptagged \domovednote{#1}{#2}\v!previouspage\v!nextpage}} -\unexpanded\def\typesetsomenotesymbol#1#2% running text +\unexpanded\def\typesetsomenotesymbol#1#2#3% running text {\removeunwantedspaces \doifitalicelse\/\donothing % Charles IV \footnote{the fourth} \ifdim\lastkern=\notesignal @@ -653,8 +708,8 @@ \fi \nobreak \doifelse{\noteparameter\c!interaction}\v!no - {\dotypesetsomenotesymbol{#1}{#2}} - {\directgotobox{\dotypesetsomenotesymbol{#1}{#2}}[page(\ctxlua{structure.notes.getnumberpage("#1",\number#2)})]}% f: + {\dotypesetsomenotesymbol{#1}{#2}{#3}} + {\directgotobox{\dotypesetsomenotesymbol{#1}{#2}{#3}}[page(\ctxlua{structures.notes.getnumberpage("#1",\number#2)})]}% f: \globallet\lastnotesymbol\relax} \unexpanded\def\typesetdummynotesymbol % temp hack @@ -668,7 +723,7 @@ \globallet\lastnotesymbol\relax} \def\currentnotedescriptiontext % todo: can be other number - {\ctxlua{structure.notes.title("\currentnote",\currentdescriptionnumberentry)}} + {\ctxlua{structures.notes.title("\currentnote",\currentdescriptionnumberentry)}} \def\@@donotetext {\ifconditional\enumerationnumberenabled @@ -690,34 +745,46 @@ {\docurrentnoteenumerationfullnumber}% {\directgotobox {\docurrentnoteenumerationfullnumber}% - [page(\ctxlua{structure.notes.getsymbolpage("\currentnote",\currentdescriptionnumberentry)})]}} + [page(\ctxlua{structures.notes.getsymbolpage("\currentnote",\currentdescriptionnumberentry)})]}} \def\docurrentnoteenumerationfullnumber {\noteparameter\c!numbercommand {\dosetnoteattributes\c!numberstyle\c!numbercolor - \ctxlua{structure.notes.number("\currentnote",\currentdescriptionnumberentry)}% + \ctxlua{structures.notes.number("\currentnote",\currentdescriptionnumberentry)}% \domovednote\currentdescription\currentdescriptionnumberentry\v!nextpage\v!previouspage}} -\def\synchronizesomenotesymbol#1#2% called more often than needed - {\expanded{\noexpand\ctxlatelua{structure.notes.setsymbolpage("#1",#2)}}} +\def\synchronizesomenotesymbol#1#2#3% called more often than needed + {\iftrialtypesetting\else + \normalexpanded{\noexpand\ctxlatelua{structures.notes.setsymbolpage("#1",#2,#3)}}% + \fi} -\def\handlenoteinsert#1#2% +\def\handlenoteinsert#1#2% tg, id {\begingroup \edef\currentnote{#1}% \the\everybeforenoteinsert \insert\currentnoteins\bgroup \the\everyinsidenoteinsert \doprocesslocalsetups{\noteparameter\c!setups}% experimental - \handlenoteitself{#1}{#2}% + \doifelse{\noteparameter\c!paragraph}\v!yes + {\nointerlineskip + \startvboxtohbox + \handlenoteitself{#1}{#2}% + % add some slack + \stopvboxtohbox} + {\handlenoteitself{#1}{#2}}% \egroup \the\everyafternoteinsert \endgroup} +\def\betweennoteitself#1% tg + {\edef\currentnote{#1}% + \doif{\noteparameter\c!paragraph}\v!yes\dobetweenparagraphnotes} + \def\handlenoteitself#1#2% tg, id {\edef\currentdescription{#1}% \edef\currentnote{#1}% \edef\currentdescriptionnumberentry{#2}% - \edef\currentdescriptionlistentry{\ctxlua{tex.write(structure.notes.listindex("#1",#2))}}% + \edef\currentdescriptionlistentry{\ctxlua{tex.write(structures.notes.listindex("#1",#2))}}% % as we can have collected notes (e.g. in tables) we need to recover % \currentdescriptionattribute and \currentdescriptionsynchronize \reinstatedescriptionnumberentry\currentdescriptionlistentry % we could store the number in the entry @@ -737,7 +804,6 @@ %D footnotes can be handled by a straight insert, but we do so %D by using an indirect call to the \type{\insert} primitive. -%D Making footnote numbers active is not always that logical, %D Making footnote numbers active is not always that logical, %D especially when we keep the reference and text at one page. %D On the other hand we need interactivity when we refer to @@ -747,10 +813,8 @@ %D mainly because endnotes had to be supported.} that is, %D automatically (vise versa) and by user supplied reference. -\newcount\internalnotereference - -\let\startpushnote=\relax -\let\stoppushnote =\relax +\let\startpushnote\relax +\let\stoppushnote \relax \newsignal\notesignal \newcount \notepenalty @@ -768,6 +832,7 @@ \let\flushnotes\relax \let\postponenotes\relax \forgetall + \resetallattributes % new, we don't want color bleed into notes \to \everybeforenoteinsert \appendtoks @@ -780,9 +845,9 @@ \splitmaxdepth\strutdp % not actually needed here \leftmargindistance\noteparameter\c!margindistance \rightmargindistance\leftmargindistance - \ifnum\noteparameter\c!n=\zerocount % no ifcase new 31-07-99 ; always ? - \doifnotinset{\noteparameter\c!width}{\v!fit,\v!broad}\setnotehsize % ? - \fi +% \ifnum\noteparameter\c!n=\zerocount % no ifcase new 31-07-99 ; always ? +% \doifnotinset{\noteparameter\c!width}{\v!fit,\v!broad}\setnotehsize % ? +% \fi \to \everyinsidenoteinsert % not: \appendtoks \setnotehsize \to \everyinsidenoteinsert (spoils columns) @@ -833,6 +898,47 @@ \unexpanded\def\unvboxed {\ifvmode\unvbox \else\box \fi} \unexpanded\def\unvcopied{\ifvmode\unvcopy\else\copy\fi} +% idea: tag with attr and then just flush them again + +\def\dobetweenparagraphnotes % should not be too much + {\noteparameter\c!inbetween} + +\def\doflushgobalnotes + {\doifelse{\noteparameter\c!paragraph}\v!yes + {\vbox + {\beginofshapebox + \iftrialtypesetting\unvcopied\else\unvboxed\fi\currentnoteins + \endofshapebox + %\doreshapebox{\box\shapebox}{}{}{}% get rid of penalties etc + \gdef\dodobetweenparagraphnotes{\glet\dodobetweenparagraphnotes\dobetweenparagraphnotes}% shape works reverse + \doreshapebox{\hbox{\unhbox\shapebox\dodobetweenparagraphnotes}}{}{}{}% get rid of penalties etc + \innerflushshapebox + \convertvboxtohbox}} + {\iftrialtypesetting\unvcopied\else\unvboxed\fi\currentnoteins}} + +\def\dodoplacenoteinserts + {\ifcase\noteparameter\c!n\relax + % should not happen + \or + \doglobalflushnotesnormal + \else + \doglobalflushnotescolums + \fi} + +\def\doglobalflushnotesnormal + {%\iftrialtypesetting\copy\else\box\fi\currentnoteins + \doflushgobalnotes + \obeydepth} % (a) added , since split footnotes will not align properly + +\def\doglobalflushnotescolums + {\edef\currentnotewidth{\noteparameter\c!width}% + \doifdimensionelse\currentnotewidth\donothing + {\edef\currentnotewidth{\the\hsize}}% + \startsimplecolumns[\c!distance=\noteparameter\c!columndistance,\c!n=\noteparameter\c!n,\c!width=\currentnotewidth]% + %\iftrialtypesetting\unvcopied\else\unvboxed\fi\currentnoteins % compare with local + \doflushgobalnotes + \stopsimplecolumns} + \def\doplacenoteinserts {\relax\ifdim\ht\currentnoteins>\zeropoint\relax \ifnum\noteparameter\s!noteloc=\plusfive @@ -842,24 +948,15 @@ \whitespace \noteparameter\c!before \fi -% \bgroup -% \setupalign[\noteparameter\c!align]% + % \bgroup + % \setupalign[\noteparameter\c!align]% \placenoterule % alleen in ..mode -% \par -% \egroup + % \par + % \egroup \bgroup \setnotebodyfont \setbox\scratchbox\hbox - {% this should be checked, smells like a mix-up - % does not split: \ifcase\noteparameter\c!n\unvbox\else\box\fi\currentnoteins - \ifcase\noteparameter\c!n\relax - \iftrialtypesetting\unvcopied\else\unvboxed\fi\currentnoteins % is this needed? - \or - \iftrialtypesetting\copy\else\box\fi\currentnoteins - \obeydepth % (a) added , since split footnotes will not align properly - \else - \iftrialtypesetting\unvcopied\else\unvboxed\fi\currentnoteins - \fi}% + {\dodoplacenoteinserts}% \setbox\scratchbox\hbox {\localframed [\??vn\currentnote] @@ -919,7 +1016,7 @@ {\ifconditional\postponingnotes\else \global\settrue\postponingnotes \global\let\flushnotes\doflushnotes - \ctxlua{structure.notes.postpone()}% + \ctxlua{structures.notes.postpone()}% \fi} \let\flushnotes\relax @@ -929,7 +1026,7 @@ \begingroup \let\flushnotes \relax \let\postponenotes\relax - \ctxlua{structure.notes.flushpostponed()}% this also resets the states ! + \ctxlua{structures.notes.flushpostponed()}% this also resets the states ! \global\setfalse\postponednote \global\setfalse\postponingnotes \global\let\flushnotes\relax @@ -974,25 +1071,25 @@ {\doifnot{\noteparameter\c!continue}\v!yes {\savestructurecounter[#1]% \resetstructurecounter[#1]}% - \ctxlua{structure.notes.save("#1","store")}} + \ctxlua{structures.notes.save("#1","store")}} \def\dodostoplocalnotes#1% {\doifnot{\noteparameter\c!continue}\v!yes {\restorestructurecounter[#1]}% - \ctxlua{structure.notes.restore("#1")}} + \ctxlua{structures.notes.restore("#1")}} \unexpanded\def\placelocalnotes {\dodoubleempty\doplacelocalnotes} \def\doplacelocalnotes[#1][#2]% - {\doif{\ctxlua{structure.notes.getstate("#1")}}{store}{\dodoplacelocalnotes{#2}{#1}}} + {\doif{\ctxlua{structures.notes.getstate("#1")}}{store}{\dodoplacelocalnotes{#2}{#1}}} \def\dodoplacelocalnotes#1#2% settings note {\begingroup \the\everyplacelocalnotes % beware, we cannot trust setting \currentnote here \getparameters[\??vn#2][\c!width=\v!fit,\c!height=\v!fit,\c!strut=\v!no,\c!offset=\v!overlay,#1]% we only need a selective one - \donotealternative{#2}% + \dolocalnotealternative{#2}% \endgroup \dochecknote} % we need to restore the old state @@ -1042,7 +1139,7 @@ \def\dodoplacenotes#1#2% settings note {\edef\currentnote{#2}% - \doifelse{\ctxlua{structure.notes.getstate("#2")}}{store} + \doifelse{\ctxlua{structures.notes.getstate("#2")}}{store} \dodoplacelocalnotes \dodoplaceglobalnotes {#1}{#2}} @@ -1060,9 +1157,9 @@ {\setvalue{\??vn:\c!alternative:#1}{#2}} \def\doifnotescollected#1% - {\ctxlua{structure.notes.doifcontent("#1")}} + {\ctxlua{structures.notes.doifcontent("#1")}} -\def\donotealternative#1% +\def\dolocalnotealternative#1% {\edef\currentnote{#1}% \doifnotescollected\currentnote {\endgraf @@ -1086,7 +1183,8 @@ %D \setupfootnotes[location=text,alternative=none] %D \stoptyping -\def\flushlocalnotes#1{\ctxlua{structure.notes.flush("#1","store")}} +% \def\flushlocalnotes#1{\ctxlua{structures.notes.flush("#1","store")}} +\def\flushlocalnotes#1{\ctxlua{structures.notes.flush("#1","store","\noteparameter\c!criterium")}} \installnotealternative \v!none {\flushlocalnotes\currentnote} @@ -1235,7 +1333,7 @@ \unexpanded\def\setupfootnotedefinition{\setupnotedefinition [\v!footnote]} \unexpanded\def\setupfootnotes {\setupnote [\v!footnote]} %unexpanded\def\footnote {\setnote [\v!footnote]} -\def\footnotetext {\setnotetext [\v!footnote]} +\def\footnotetext {\setnotetext [\v!footnote]} %unexpanded\def\note {\dodoubleempty\notesymbol [\v!footnote]} % alleen footnote \unexpanded\def\placefootnotes {\dodoubleempty\doplacefootnotes [\v!footnote]} \unexpanded\def\placelocalfootnotes {\dodoubleempty\doplacelocalfootnotes[\v!footnote]} @@ -1257,7 +1355,7 @@ %D } %D \stoptyping -\def\doifnoteonsamepageelse[#1]{\ctxlua{structure.notes.doifonsamepageasprevious("#1")}} +\def\doifnoteonsamepageelse[#1]{\ctxlua{structures.notes.doifonsamepageasprevious("#1")}} %D New trickery: diff --git a/Master/texmf-dist/tex/context/base/strc-num.lua b/Master/texmf-dist/tex/context/base/strc-num.lua index 8165d078617..95cf6d94127 100644 --- a/Master/texmf-dist/tex/context/base/strc-num.lua +++ b/Master/texmf-dist/tex/context/base/strc-num.lua @@ -6,46 +6,52 @@ if not modules then modules = { } end modules ['strc-num'] = { license = "see context related readme files" } +-- this will be reimplemented + local format = string.format local next, type = next, type local min, max = math.min, math.max local texsprint, texcount = tex.sprint, tex.count -local trace_counters = false trackers.register("structure.counters", function(v) trace_counters = v end) - -structure = structure or { } -structure.helpers = structure.helpers or { } -structure.sections = structure.sections or { } -structure.counters = structure.counters or { } -structure.documents = structure.documents or { } +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex -structure.counters = structure.counters or { } -structure.counters.data = structure.counters.data or { } -structure.counters.specials = structure.counters.specials or { } +local trace_counters = false trackers.register("structures.counters", function(v) trace_counters = v end) +local report_counters = logs.reporter("structure","counters") -local helpers = structure.helpers -local sections = structure.sections -local counters = structure.counters -local documents = structure.documents +local structures = structures +local helpers = structures.helpers +local sections = structures.sections +local counters = structures.counters +local documents = structures.documents -local variables = interfaces.variables +local variables = interfaces.variables -- state: start stop none reset -local counterdata = counters.data +counters.specials = counters.specials or { } +local counterspecials = counters.specials + local counterranges, tbs = { }, 0 -local counterspecials = counters.specials -counters.collected = counters.collected or { } +counters.collected = allocate() counters.tobesaved = counters.tobesaved or { } +counters.data = counters.data or { } -storage.register("structure/counters/data", structure.counters.data, "structure.counters.data") -storage.register("structure/counters/tobesaved", structure.counters.tobesaved, "structure.counters.tobesaved") +storage.register("structures/counters/data", counters.data, "structures.counters.data") +storage.register("structures/counters/tobesaved", counters.tobesaved, "structures.counters.tobesaved") -local collected, tobesaved = counters.collected, counters.tobesaved +local collected = counters.collected +local tobesaved = counters.tobesaved +local counterdata = counters.data + +local function initializer() -- not really needed + collected = counters.collected + tobesaved = counters.tobesaved + counterdata = counters.data +end local function finalizer() - local ct = counters.tobesaved for name, cd in next, counterdata do local cs = tobesaved[name] local data = cd.data @@ -58,13 +64,7 @@ local function finalizer() end end -local function initializer() - collected, tobesaved = counters.collected, counters.tobesaved -end - -if job then - job.register('structure.counters.collected', structure.counters.tobesaved, initializer, finalizer) -end +job.register('structures.counters.collected', tobesaved, initializer, finalizer) local function constructor(t,s,name,i) if s == "last" then @@ -108,28 +108,29 @@ local function constructor(t,s,name,i) end end -local enhance = function() +local function enhance() for name, cd in next, counterdata do local data = cd.data for i=1,#data do local ci = data[i] - setmetatable(ci, { __index = function(t,s) return constructor(t,s,name,i) end }) + setmetatableindex(ci, function(t,s) return constructor(t,s,name,i) end) end end enhance = nil end -local function allocate(name,i) +local function allocate(name,i) -- can be metatable local cd = counterdata[name] if not cd then cd = { - level = 1, ---~ block = "", -- todo + level = 1, + -- block = "", -- todo numbers = nil, - state = variables.start, -- true - data = { } + state = variables.start, -- true + data = { }, + saved = { }, } - tobesaved[name] = { } + tobesaved[name] = { } counterdata[name] = cd end cd = cd.data @@ -137,15 +138,14 @@ local function allocate(name,i) if not ci then ci = { number = 0, - start = 0, - saved = 0, - step = 1, - range = 1, + start = 0, + saved = 0, + step = 1, + range = 1, offset = false, - -- via metatable: last, first, and for tracing: - stop = 0, + stop = 0, -- via metatable: last, first, stop only for tracing } - setmetatable(ci, { __index = function(t,s) return constructor(t,s,name,i) end }) + setmetatableindex(ci, function(t,s) return constructor(t,s,name,i) end) cd[i] = ci tobesaved[name][i] = { } else @@ -163,9 +163,17 @@ local function savevalue(name,i) local cd = counterdata[name].data[i] local cs = tobesaved[name][i] local cc = collected[name] + if trace_counters then + report_counters("saving value %s of counter named %s",cd.number,name) + end local cr = cd.range local old = (cc and cc[i] and cc[i][cr]) or 0 - cs[cr] = cd.number + local number = cd.number + if cd.method == variables.page then + -- we can be one page ahead + number = number - 1 + end + cs[cr] = (number >= 0) and number or 0 cd.range = cr + 1 return old else @@ -173,11 +181,13 @@ local function savevalue(name,i) end end -function counters.define(name, start, counter) -- todo: step +function counters.define(name, start, counter, method) -- todo: step local d = allocate(name,1) d.start = start + d.state = variables.start or "" if counter ~= "" then d.counter = counter -- only for special purposes, cannot be false + d.method = method -- frozen at define time end end @@ -270,19 +280,18 @@ function counters.setoffset(name,value) counters.setvalue(name,"offset",value) end - local function synchronize(name,d) local dc = d.counter if dc then if trace_counters then - logs.report("counters","setting counter %s with name %s to %s",dc,name,d.number) + report_counters("setting counter %s with name %s to %s",dc,name,d.number) end tex.setcount("global",dc,d.number) end local cs = counterspecials[name] if cs then if trace_counters then - logs.report("counters","invoking special for name %s",name) + report_counters("invoking special for name %s",name) end cs() end @@ -334,7 +343,7 @@ function counters.setown(name,n,value) elseif level > 0 then check(name,d,n+1) elseif level == 0 then - -- happens elsewhere + -- happens elsewhere, check this for block end synchronize(name,d) end @@ -355,27 +364,31 @@ end function counters.save(name) -- or just number local cd = counterdata[name] if cd then - cd.saved = table.copy(cd.data) + table.insert(cd.saved,table.copy(cd.data)) end end function counters.restore(name) local cd = counterdata[name] if cd and cd.saved then - cd.data = cd.saved - cd.saved = nil + cd.data = table.remove(cd.saved) end end function counters.add(name,n,delta) local cd = counterdata[name] - if cd and cd.state == variables.start then +--~ table.print(cd,name) + if cd and (cd.state == variables.start or cd.state == "") then local data = cd.data local d = allocate(name,n) d.number = (d.number or d.start or 0) + delta*(d.step or 0) + -- d.own = nil local level = cd.level if not level or level == -1 then -- -1 is signal that we reset manually + elseif level == -2 then + -- -2 is signal that we work per text + check(name,data,n+1) elseif level > 0 then -- within countergroup check(name,data,n+1) @@ -390,10 +403,10 @@ end function counters.check(level) -- not used (yet) for name, cd in next, counterdata do - -- logs.report("counters","%s %s %s",name,cd.level,level) + -- report_counters("%s %s %s",name,cd.level,level) if cd.level == level then if trace_counters then - logs.report("counters","resetting %s at level %s",name,level) + report_counters("resetting %s at level %s",name,level) end counters.reset(name) end @@ -468,54 +481,54 @@ function counters.converted(name,spec) -- name can be number and reference to st end end --- move to strc-pag.lua - -function counters.analyse(name,counterspecification) - local cd = counterdata[name] - -- safeguard - if not cd then - return false, false, "no counter data" - end - -- section data - local sectiondata = sections.current() - if not sectiondata then - return cd, false, "not in section" - end - local references = sectiondata.references - if not references then - return cd, false, "no references" - end - local section = references.section - if not section then - return cd, false, "no section" - end - sectiondata = jobsections.collected[references.section] - if not sectiondata then - return cd, false, "no section data" - end - -- local preferences - local no = variables.no - if counterspecification and counterspecification.prefix == no then - return cd, false, "current spec blocks prefix" - end - -- stored preferences (not used) - if cd.prefix == no then - return cd, false, "entry blocks prefix" - end - -- sectioning - -- if sectiondata.prefix == no then - -- return false, false, "sectiondata blocks prefix" - -- end - -- final verdict - return cd, sectiondata, "okay" -end - -function counters.prefixedconverted(name,prefixspec,numberspec) - local cd, prefixdata, result = counters.analyse(name,prefixspec) - if cd then - if prefixdata then - sections.typesetnumber(prefixdata,"prefix",prefixspec or false,cd or false) - end - counters.converted(name,numberspec) - end -end +--~ -- move to strc-pag.lua + +--~ function counters.analyze(name,counterspecification) +--~ local cd = counterdata[name] +--~ -- safeguard +--~ if not cd then +--~ return false, false, "no counter data" +--~ end +--~ -- section data +--~ local sectiondata = sections.current() +--~ if not sectiondata then +--~ return cd, false, "not in section" +--~ end +--~ local references = sectiondata.references +--~ if not references then +--~ return cd, false, "no references" +--~ end +--~ local section = references.section +--~ if not section then +--~ return cd, false, "no section" +--~ end +--~ sectiondata = sections.collected[references.section] +--~ if not sectiondata then +--~ return cd, false, "no section data" +--~ end +--~ -- local preferences +--~ local no = variables.no +--~ if counterspecification and counterspecification.prefix == no then +--~ return cd, false, "current spec blocks prefix" +--~ end +--~ -- stored preferences (not used) +--~ if cd.prefix == no then +--~ return cd, false, "entry blocks prefix" +--~ end +--~ -- sectioning +--~ -- if sectiondata.prefix == no then +--~ -- return false, false, "sectiondata blocks prefix" +--~ -- end +--~ -- final verdict +--~ return cd, sectiondata, "okay" +--~ end + +--~ function counters.prefixedconverted(name,prefixspec,numberspec) +--~ local cd, prefixdata, result = counters.analyze(name,prefixspec) +--~ if cd then +--~ if prefixdata then +--~ sections.typesetnumber(prefixdata,"prefix",prefixspec or false,cd or false) +--~ end +--~ counters.converted(name,numberspec) +--~ end +--~ end diff --git a/Master/texmf-dist/tex/context/base/strc-num.mkiv b/Master/texmf-dist/tex/context/base/strc-num.mkiv index 5b5aebe7dc8..b386b5d9518 100644 --- a/Master/texmf-dist/tex/context/base/strc-num.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-num.mkiv @@ -49,7 +49,6 @@ \c!prefixconnector=., \c!prefixsegments=\thenamedstructurecounterlevel\currentstructurecounter, \c!start=0, - \c!state=\v!start, \c!prefix=\v!yes, \c!state=\v!start] @@ -57,9 +56,7 @@ [\c!prefixsegments=\autostructureprefixsegments\sharedstructurecounterparameter] \def\autostructureprefixsegments#1% todo: \c!prefixsegments=\v!auto - {2:\thenamedstructureheadlevel{\ctxlua{structure.sections.way("#1\c!way","\v!by")}}} - -% \letvalue{\??nn\s!empty}\empty + {2:\thenamedstructureheadlevel{\ctxlua{structures.sections.way("#1\c!way","\v!by")}}} \def\structurecounterparameter#1#2% {\csname @@ -108,7 +105,10 @@ \def\dododefinestructurecounter[#1][#2]% {\getparameters[\??nn#1][\s!counter=,#2]% counter is for internal purposes - \ctxlua{structure.counters.define("#1",tonumber("\structurecounterparameter{#1}\c!start") or 0,"\structurecounterparameter{#1}\s!counter")}% + \ctxlua{structures.counters.define("#1", % this will be a table + tonumber("\structurecounterparameter{#1}\c!start") or 0, + "\structurecounterparameter{#1}\s!counter", + "\structurecounterparameter{#1}\c!method")}% \docheckstructurecountersetup{#1}} \def\donodefinestructurecounter[#1][#2]% inherit @@ -123,7 +123,7 @@ \docheckstructurecountersetup{#1}} \def\structurecounterway#1% slow, we need to store it at the tex end - {\ctxlua{structure.sections.way("\structurecounterparameter{#1}\c!way","\v!by")}} + {\ctxlua{structures.sections.way("\structurecounterparameter{#1}\c!way","\v!by")}} \def\thenamedstructurecounterlevel#1% {\thenamedstructureheadlevel{\structurecounterway{#1}}} @@ -139,36 +139,36 @@ \else \edef\currentstructurecounterlevel{\thenamedstructurecounterlevel{#1}}% \ctxlua{ - structure.counters.restart("#1",1,"\structurecounterparameter{#1}\c!start") - structure.counters.setstate("#1","\structurecounterparameter{#1}\c!state") - structure.counters.setlevel("#1",\currentstructurecounterlevel) - structure.sections.setchecker("#1",\currentstructurecounterlevel,structure.counters.reset) + structures.counters.restart("#1",1,"\structurecounterparameter{#1}\c!start") + structures.counters.setstate("#1","\structurecounterparameter{#1}\c!state") + structures.counters.setlevel("#1",\currentstructurecounterlevel) + structures.sections.setchecker("#1",\currentstructurecounterlevel,structures.counters.reset) }% \fi} -\def\doifstructurecounterelse#1{\ctxlua{structure.counters.doifelse("\@@thestructurecounter{#1}")}} -\def\doifstructurecounter #1{\ctxlua{structure.counters.doif ("\@@thestructurecounter{#1}")}} -\def\doifnotstructurecounter #1{\ctxlua{structure.counters.doifnot ("\@@thestructurecounter{#1}")}} - -\def\setstructurecounter [#1]#2{\ctxlua{structure.counters.set ("\@@thestructurecounter{#1}",1,\number#2)}} -\def\setstructurecounterown [#1]#2{\ctxlua{structure.counters.setown ("\@@thestructurecounter{#1}",1,"#2")}} -\def\resetstructurecounter [#1]{\ctxlua{structure.counters.reset ("\@@thestructurecounter{#1}",1)}} -\def\restartstructurecounter [#1]#2{\ctxlua{structure.counters.restart("\@@thestructurecounter{#1}",1,#2)}} -\def\savestructurecounter [#1]{\ctxlua{structure.counters.save ("\@@thestructurecounter{#1}")}} -\def\restorestructurecounter [#1]{\ctxlua{structure.counters.restore("\@@thestructurecounter{#1}")}} -\def\incrementstructurecounter [#1]{\ctxlua{structure.counters.add ("\@@thestructurecounter{#1}",1,1)}} -\def\decrementstructurecounter [#1]{\ctxlua{structure.counters.add ("\@@thestructurecounter{#1}",1,-1)}} -\def\rawstructurecounter [#1]{\ctxlua{structure.counters.value ("\@@thestructurecounter{#1}",1)}} -\def\laststructurecounter [#1]{\ctxlua{structure.counters.last ("\@@thestructurecounter{#1}",1)}} -\def\firststructurecounter [#1]{\ctxlua{structure.counters.first ("\@@thestructurecounter{#1}",1)}} -\def\nextstructurecounter [#1]{\ctxlua{structure.counters.next ("\@@thestructurecounter{#1}",1)}} -\def\prevstructurecounter [#1]{\ctxlua{structure.counters.prev ("\@@thestructurecounter{#1}",1)}} -\def\structurecountersubs [#1]{\ctxlua{structure.counters.subs ("\@@thestructurecounter{#1}",1)}} - -\def\tracestructurecounter [#1]{\ctxlua{structure.counters.trace ("\@@thestructurecounter{#1}")}} - -\def\incrementedstructurecounter[#1]{\ctxlua{tex.write(structure.counters.add("\@@thestructurecounter{#1}",1,1))}} -\def\decrementedstructurecounter[#1]{\ctxlua{tex.write(structure.counters.add("\@@thestructurecounter{#1}",1,-1))}} +\def\doifstructurecounterelse#1{\ctxlua{structures.counters.doifelse("\@@thestructurecounter{#1}")}} +\def\doifstructurecounter #1{\ctxlua{structures.counters.doif ("\@@thestructurecounter{#1}")}} +\def\doifnotstructurecounter #1{\ctxlua{structures.counters.doifnot ("\@@thestructurecounter{#1}")}} + +\def\setstructurecounter [#1]#2{\ctxlua{structures.counters.set ("\@@thestructurecounter{#1}",1,\number#2)}} +\def\setstructurecounterown [#1]#2{\ctxlua{structures.counters.setown ("\@@thestructurecounter{#1}",1,"#2")}} +\def\resetstructurecounter [#1]{\ctxlua{structures.counters.reset ("\@@thestructurecounter{#1}",1)}} +\def\restartstructurecounter [#1]#2{\ctxlua{structures.counters.restart("\@@thestructurecounter{#1}",1,#2)}} +\def\savestructurecounter [#1]{\ctxlua{structures.counters.save ("\@@thestructurecounter{#1}")}} +\def\restorestructurecounter [#1]{\ctxlua{structures.counters.restore("\@@thestructurecounter{#1}")}} +\def\incrementstructurecounter [#1]{\ctxlua{structures.counters.add ("\@@thestructurecounter{#1}",1,1)}} +\def\decrementstructurecounter [#1]{\ctxlua{structures.counters.add ("\@@thestructurecounter{#1}",1,-1)}} +\def\rawstructurecounter [#1]{\ctxlua{structures.counters.value ("\@@thestructurecounter{#1}",1)}} +\def\laststructurecounter [#1]{\ctxlua{structures.counters.last ("\@@thestructurecounter{#1}",1)}} +\def\firststructurecounter [#1]{\ctxlua{structures.counters.first ("\@@thestructurecounter{#1}",1)}} +\def\nextstructurecounter [#1]{\ctxlua{structures.counters.next ("\@@thestructurecounter{#1}",1)}} +\def\prevstructurecounter [#1]{\ctxlua{structures.counters.prev ("\@@thestructurecounter{#1}",1)}} +\def\structurecountersubs [#1]{\ctxlua{structures.counters.subs ("\@@thestructurecounter{#1}",1)}} + +\def\tracestructurecounter [#1]{\ctxlua{structures.counters.trace ("\@@thestructurecounter{#1}")}} + +\def\incrementedstructurecounter[#1]{\ctxlua{tex.write(structures.counters.add("\@@thestructurecounter{#1}",1,1))}} +\def\decrementedstructurecounter[#1]{\ctxlua{tex.write(structures.counters.add("\@@thestructurecounter{#1}",1,-1))}} \def\setsubstructurecounter {\dodoubleargument\dosetsubstructurecounter} \def\setsubstructurecounterown {\dodoubleargument\dosetsubstructurecounterown} @@ -178,16 +178,16 @@ \def\decrementsubstructurecounter {\dodoubleargument\dodecrementsubstructurecounter} \def\rawsubstructurecounter {\dodoubleargument\dorawsubstructurecounter} -\def\dosetsubstructurecounter [#1][#2]#3{\ctxlua{structure.counters.set ("\@@thestructurecounter{#1}",#2,\number#3)}} -\def\dosetsubstructurecounterown [#1][#2]#3{\ctxlua{structure.counters.setown ("\@@thestructurecounter{#1}",#2,"#3")}} -\def\doresetsubstructurecounter [#1][#2]{\ctxlua{structure.counters.reset ("\@@thestructurecounter{#1}",#2)}} -\def\dorestartsubstructurecounter [#1][#2]#3{\ctxlua{structure.counters.restart("\@@thestructurecounter{#1}",#2,#3)}} -\def\doincrementsubstructurecounter [#1][#2]{\ctxlua{structure.counters.add ("\@@thestructurecounter{#1}",#2,1)}} -\def\dodecrementsubstructurecounter [#1][#2]{\ctxlua{structure.counters.add ("\@@thestructurecounter{#1}",#2,-1)}} -\def\dorawsubstructurecounter [#1][#2]{\ctxlua{structure.counters.value ("\@@thestructurecounter{#1}",#2)}} -\def\dolastsubstructurecounter [#1][#2]{\ctxlua{structure.counters.last ("\@@thestructurecounter{#1}",#2)}} -\def\dofirstsubstructurecounter [#1][#2]{\ctxlua{structure.counters.first ("\@@thestructurecounter{#1}",#2)}} -\def\dosubstructurecountersubs [#1][#2]{\ctxlua{structure.counters.subs ("\@@thestructurecounter{#1}",#2)}} +\def\dosetsubstructurecounter [#1][#2]#3{\ctxlua{structures.counters.set ("\@@thestructurecounter{#1}",#2,\number#3)}} +\def\dosetsubstructurecounterown [#1][#2]#3{\ctxlua{structures.counters.setown ("\@@thestructurecounter{#1}",#2,"#3")}} +\def\doresetsubstructurecounter [#1][#2]{\ctxlua{structures.counters.reset ("\@@thestructurecounter{#1}",#2)}} +\def\dorestartsubstructurecounter [#1][#2]#3{\ctxlua{structures.counters.restart("\@@thestructurecounter{#1}",#2,#3)}} +\def\doincrementsubstructurecounter [#1][#2]{\ctxlua{structures.counters.add ("\@@thestructurecounter{#1}",#2,1)}} +\def\dodecrementsubstructurecounter [#1][#2]{\ctxlua{structures.counters.add ("\@@thestructurecounter{#1}",#2,-1)}} +\def\dorawsubstructurecounter [#1][#2]{\ctxlua{structures.counters.value ("\@@thestructurecounter{#1}",#2)}} +\def\dolastsubstructurecounter [#1][#2]{\ctxlua{structures.counters.last ("\@@thestructurecounter{#1}",#2)}} +\def\dofirstsubstructurecounter [#1][#2]{\ctxlua{structures.counters.first ("\@@thestructurecounter{#1}",#2)}} +\def\dosubstructurecountersubs [#1][#2]{\ctxlua{structures.counters.subs ("\@@thestructurecounter{#1}",#2)}} % The bypage check needs a multipass reference and therefore % we only check for it when we increment and know that some @@ -200,11 +200,11 @@ \def\incrementstructurecounter[#1]% {\docheckstructurecounterbypage{#1}% - \ctxlua{structure.counters.add("\@@thestructurecounter{#1}",1,1)}} + \ctxlua{structures.counters.add("\@@thestructurecounter{#1}",1,1)}} \def\doincrementsubstructurecounter[#1][#2]% {\docheckstructurecounterbypage{#1}% - \ctxlua{structure.counters.add("\@@thestructurecounter{#1}",#2,1)}} + \ctxlua{structures.counters.add("\@@thestructurecounter{#1}",#2,1)}} \def\convertedstructurecounter {\dodoubleempty\doconvertedstructurecounter} @@ -212,7 +212,7 @@ \def\doconvertedstructurecounter[#1][#2]% {\begingroup \ifsecondargument\getparameters[\??nn#1][#2]\fi - \ctxlua{structure.counters.prefixedconverted( + \ctxlua{structures.counters.prefixedconverted( "\@@thestructurecounter{#1}", { prefix = "\structurecounterparameter{#1}\c!prefix", @@ -241,7 +241,7 @@ \def\directconvertedstructurecounter#1#2% name, type {\begingroup - \ctxlua{structure.counters.prefixedconverted( + \ctxlua{structures.counters.prefixedconverted( "\@@thestructurecounter{#1}", { prefix = "\structurecounterparameter{#1}\c!prefix", @@ -403,11 +403,11 @@ \edef\currentlabel{#3\c!label}% \edef\currentreference{#3\c!reference}% \setnextinternalreference - \xdef\laststructurecounternumber{\ctxlua{structure.lists.push{ + \xdef\laststructurecounternumber{\ctxlua{structures.lists.push{ metadata = { kind = "#1", name = "\currentname", - level = structure.sections.currentlevel(), + level = structures.sections.currentlevel(), catcodes = \the\catcodetable, }, references = { @@ -415,7 +415,7 @@ reference = "\currentreference", referenceprefix = "\referenceprefix", block = "\currentstructureblock", - section = structure.sections.currentid(), + section = structures.sections.currentid(), }, titledata = { label = \!!bs\detokenize\expandafter{\currentlabel }\!!es, @@ -439,7 +439,7 @@ connector = \!!bs#3\c!prefixconnector\!!es, }, numberdata = { - numbers = structure.counters.compact("\currentcounter",nil,true), + numbers = structures.counters.compact("\currentcounter",nil,true), separatorset = "#3\c!numberseparatorset", conversion = \!!bs#3\c!numberconversion\!!es, conversionset = "#3\c!numberconversionset", @@ -448,11 +448,11 @@ segments = "#3\c!numbersegments", }, \fi - userdata = structure.helpers.touserdata(\!!bs\detokenize{#9}\!!es) + userdata = structures.helpers.touserdata(\!!bs\detokenize{#9}\!!es) } }}% - \xdef\laststructurecounterattribute {\ctxlua {tex.write(jobreferences.setinternalreference(nil,nil,\nextinternalreference))}}% - \xdef\laststructurecountersynchronize{\ctxlatelua{structure.lists.enhance(\laststructurecounternumber)}}% + \xdef\laststructurecounterattribute {\ctxlua {tex.write(structures.references.setinternalreference(nil,nil,\nextinternalreference))}}% + \xdef\laststructurecountersynchronize{\ctxlatelua{structures.lists.enhance(\laststructurecounternumber)}}% \else \glet\laststructurecounternumber \relax \glet\laststructurecounterattribute \attributeunsetvalue @@ -468,7 +468,7 @@ {\setupstructurecounter [#1] [ \c!start=#2\c!start, - \c!state=#2\c!state, + \c!state=#2\c!state, % beware, "" == start \c!way=#2\c!way, % \c!prefix=#2\c!prefix, diff --git a/Master/texmf-dist/tex/context/base/strc-pag.lua b/Master/texmf-dist/tex/context/base/strc-pag.lua index 2610595872a..bce8a2c3a4e 100644 --- a/Master/texmf-dist/tex/context/base/strc-pag.lua +++ b/Master/texmf-dist/tex/context/base/strc-pag.lua @@ -9,33 +9,39 @@ if not modules then modules = { } end modules ['strc-pag'] = { local texcount, format = tex.count, string.format local ctxcatcodes = tex.ctxcatcodes -local texsprint, texwrite = tex.sprint, tex.write +local allocate, mark = utilities.storage.allocate, utilities.storage.mark -local trace_pages = false trackers.register("structure.pages", function(v) trace_pages = v end) +local trace_pages = false trackers.register("structures.pages", function(v) trace_pages = v end) -structure.pages = structure.pages or { } +local report_pages = logs.reporter("structure","pages") -local helpers = structure.helpers or { } -local sections = structure.sections or { } -local pages = structure.pages or { } -local processors = structure.processors or { } -local sets = structure.sets or { } +local structures = structures -local variables = interfaces.variables +local helpers = structures.helpers +local sections = structures.sections +local pages = structures.pages +local processors = structures.processors +local sets = structures.sets +local counters = structures.counters + +local counterdata = counters.data + +local variables = interfaces.variables +local context = context -- storage -jobpages = jobpages or { } -jobpages.collected = jobpages.collected or { } -jobpages.tobesaved = jobpages.tobesaved or { } +local collected, tobesaved = allocate(), allocate() -local collected, tobesaved = jobpages.collected, jobpages.tobesaved +pages.collected = collected +pages.tobesaved = tobesaved local function initializer() - collected, tobesaved = jobpages.collected, jobpages.tobesaved + collected = pages.collected + tobesaved = pages.tobesaved end -job.register('jobpages.collected', jobpages.tobesaved, initializer) +job.register('structures.pages.collected', tobesaved, initializer) local specification = { } -- to be checked @@ -43,7 +49,7 @@ function pages.save(prefixdata,numberdata) local realpage, userpage = texcount.realpageno, texcount.userpageno if realpage > 0 then if trace_pages then - logs.report("pages","saving page %s.%s",realpage,userpage) + report_pages("saving page %s.%s",realpage,userpage) end local data = { number = userpage, @@ -56,40 +62,23 @@ function pages.save(prefixdata,numberdata) collected[realpage] = data end elseif trace_pages then - logs.report("pages","not saving page %s.%s",realpage,userpage) + report_pages("not saving page %s.%s",realpage,userpage) end end -function structure.counters.specials.userpage() +function counters.specials.userpage() local r = texcount.realpageno if r > 0 then local t = tobesaved[r] if t then t.number = texcount.userpageno if trace_pages then - logs.report("pages","forcing pagenumber of realpage %s to %s",r,t.number) + report_pages("forcing pagenumber of realpage %s to %s",r,t.number) end end end end ---~ function pages.pagenumber(localspec) ---~ local deltaspec ---~ if localspec then ---~ for k,v in next, localspec do ---~ if v ~= "" and v ~= specification[k] then ---~ if not deltaspec then deltaspec = { } end ---~ deltaspec[k] = v ---~ end ---~ end ---~ end ---~ if deltaspec then ---~ return { realpage = texcount.realpageno, specification = deltaspec } ---~ else ---~ return { realpage = texcount.realpageno } ---~ end ---~ end - local function convertnumber(str,n) return format("\\convertnumber{%s}{%s}",str or "numbers",n) end @@ -105,10 +94,10 @@ function pages.number(realdata,pagespec) processors.sprint(ctxcatcodes,starter) end if conversion ~= "" then - texsprint(ctxcatcodes,format("\\convertnumber{%s}{%s}",conversion,userpage)) + context.convertnumber(conversion,userpage) else if conversionset == "" then conversionset = "default" end - local theconversion = sets.get("structure:conversions",block,conversionset,index,"numbers") + local theconversion = sets.get("structure:conversions",block,conversionset,1,"numbers") -- to be checked: 1 processors.sprint(ctxcatcodes,theconversion,convertnumber,userpage) end if stopper ~= "" then @@ -118,7 +107,7 @@ end -- (pagespec.prefix == yes|unset) and (pages.prefix == yes) => prefix -function pages.analyse(entry,pagespecification) +function pages.analyze(entry,pagespecification) -- safeguard if not entry then return false, false, "no entry" @@ -154,12 +143,12 @@ function pages.analyse(entry,pagespecification) return pagedata, false, "pagedata blocks prefix" end -- final verdict - return pagedata, jobsections.collected[references.section], "okay" + return pagedata, sections.collected[references.section], "okay" end function helpers.page(data,pagespec) if data then - local pagedata = pages.analyse(data,pagespec) + local pagedata = pages.analyze(data,pagespec) if pagedata then pages.number(pagedata,pagespec) end @@ -168,7 +157,7 @@ end function helpers.prefixpage(data,prefixspec,pagespec) if data then - local pagedata, prefixdata, e = pages.analyse(data,pagespec) + local pagedata, prefixdata, e = pages.analyze(data,pagespec) if pagedata then if prefixdata then sections.typesetnumber(prefixdata,"prefix",prefixspec or false,prefixdata or false,pagedata.prefixdata or false) @@ -190,7 +179,7 @@ end -- -function helpers.analyse(entry,specification) +function helpers.analyze(entry,specification) -- safeguard if not entry then return false, false, "no entry" @@ -205,7 +194,7 @@ function helpers.analyse(entry,specification) if not section then return entry, false, "no section" end - sectiondata = jobsections.collected[references.section] + local sectiondata = sections.collected[references.section] if not sectiondata then return entry, false, "no section data" end @@ -224,7 +213,7 @@ end function helpers.prefix(data,prefixspec) if data then - local _, prefixdata, status = helpers.analyse(data,prefixspec) + local _, prefixdata, status = helpers.analyze(data,prefixspec) if prefixdata then sections.typesetnumber(prefixdata,"prefix",prefixspec or false,data.prefixdata or false,prefixdata or false) end @@ -239,3 +228,55 @@ function pages.is_odd(n) return n % 2 ~= 0 end end + +-- move to strc-pag.lua + +function counters.analyze(name,counterspecification) + local cd = counterdata[name] + -- safeguard + if not cd then + return false, false, "no counter data" + end + -- section data + local sectiondata = sections.current() + if not sectiondata then + return cd, false, "not in section" + end + local references = sectiondata.references + if not references then + return cd, false, "no references" + end + local section = references.section + if not section then + return cd, false, "no section" + end + sectiondata = sections.collected[references.section] + if not sectiondata then + return cd, false, "no section data" + end + -- local preferences + local no = variables.no + if counterspecification and counterspecification.prefix == no then + return cd, false, "current spec blocks prefix" + end + -- stored preferences (not used) + if cd.prefix == no then + return cd, false, "entry blocks prefix" + end + -- sectioning + -- if sectiondata.prefix == no then + -- return false, false, "sectiondata blocks prefix" + -- end + -- final verdict + return cd, sectiondata, "okay" +end + +function counters.prefixedconverted(name,prefixspec,numberspec) + local cd, prefixdata, result = counters.analyze(name,prefixspec) + if cd then + if prefixdata then + sections.typesetnumber(prefixdata,"prefix",prefixspec or false,cd or false) + end + counters.converted(name,numberspec) + end +end diff --git a/Master/texmf-dist/tex/context/base/strc-pag.mkiv b/Master/texmf-dist/tex/context/base/strc-pag.mkiv index 0f3d7ba3b07..f4b658365f9 100644 --- a/Master/texmf-dist/tex/context/base/strc-pag.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-pag.mkiv @@ -17,10 +17,6 @@ \unprotect -% Hacks: - -\let\preparepageprefix\gobbleoneargument - % Allocation: \countdef\realpageno = 0 \realpageno = 1 @@ -40,7 +36,7 @@ \def\initializepagecounters{\the\everyinitializepagecounters} \appendtoks - \initializepagecounters + \initializepagecounters \to \everyjob % Page numbers are kind of independent of each other and therefore they @@ -75,10 +71,9 @@ % \stopbodymatter % \stoptext - -\definestructurecounter[\s!realpage][\c!prefix=\v!no,\c!start=1,\c!prefixsegments=,\s!counter=realpageno] -\definestructurecounter[\s!userpage][\c!prefix=\v!no,\c!start=1,\c!prefixsegments=,\s!counter=userpageno] -\definestructurecounter[\s!subpage] [\c!prefix=\v!no,\c!start=1,\c!prefixsegments=,\s!counter=subpageno] +\definestructurecounter[\s!realpage][\c!prefix=\v!no,\c!start=1,\c!prefixsegments=,\s!counter=realpageno,\c!method=\v!page] +\definestructurecounter[\s!userpage][\c!prefix=\v!no,\c!start=1,\c!prefixsegments=,\s!counter=userpageno,\c!method=\v!page] +\definestructurecounter[\s!subpage] [\c!prefix=\v!no,\c!start=1,\c!prefixsegments=,\s!counter=subpageno, \c!method=\v!page] \newtoks\everysetuprealpagenumber % todo: set state: none, start, stop, reset \newtoks\everysetupuserpagenumber % todo: set state: none, start, stop, reset @@ -108,7 +103,7 @@ \let\resetpagenumber\resetuserpagenumber \def\savecurrentpagestate % \normalexpanded? - {\ctxlua{structure.pages.save({ + {\ctxlua{structures.pages.save({ prefix = "\structurecounterparameter\s!userpage\c!prefix", separatorset = "\structurecounterparameter\s!userpage\c!prefixseparatorset", conversion = "\structurecounterparameter\s!userpage\c!prefixconversion", @@ -226,11 +221,18 @@ \def\nextuserpagenumber {\directconvertedstructurecounter\s!userpage\v!next} \def\nextsubpagenumber {\directconvertedstructurecounter\s!subpage \v!next} -\appendtoks - \decrementstructurecounter[\s!realpage]% +\def\dodeincrementpageboundcounters % only at the end + {\decrementstructurecounter[\s!realpage]% \decrementstructurecounter[\s!userpage]% - \decrementstructurecounter[\s!subpage]% -\to\everygoodbye + \decrementstructurecounter[\s!subpage ]} + +\def\doincrementpageboundcounters + {\incrementpagenumber + \incrementsubpagenumber} + +\appendtoks + \dodeincrementpageboundcounters +\to \everygoodbye % Equivalents (compatibility): % @@ -251,8 +253,8 @@ % States: \newif\ifrightpage \rightpagetrue -\newif\ifdoublesided -\newif\ifsinglesided +\newif\ifdoublesided \newconditional\layoutisdoublesided +\newif\ifsinglesided \newconditional\layoutissinglesided % Realpage and subpage numbers: @@ -302,12 +304,12 @@ {\getparameters[\??nm][#1]\the\everysetuppagenumbering} \appendtoks - \singlesidedfalse - \doublesidedfalse + \singlesidedfalse \setfalse\layoutisdoublesided + \doublesidedfalse \setfalse\layoutissinglesided \normalexpanded{\noexpand\processallactionsinset[\@@nmalternative]} - [ \v!singlesided=>\singlesidedtrue, - \v!doublesided=>\doublesidedtrue]% - \ifx\trackingmarginnotestrue\undefined\else + [ \v!singlesided=>\singlesidedtrue\settrue\layoutissinglesided, + \v!doublesided=>\doublesidedtrue\settrue\layoutisdoublesided]% + \ifdefined\trackingmarginnotestrue \ifdoublesided \trackingmarginnotestrue \else @@ -395,17 +397,17 @@ % compatible. So, in fact there can be multiple handlers active at the % same time, but only the current one does something. -\chardef\realpagenumberstate =2 % counter state : 0=stop, 1=start, 2=start and visible -\chardef\userpagenumberstate =2 % counter state : 0=stop, 1=start, 2=start and visible -\chardef\subpagenumberstate =2 % counter state : 0=stop, 1=start, 2=start and visible -\chardef\overallpagenumberstate=1 % general number: 0=invisible, 1=visible +\setnewconstant\realpagenumberstate \plustwo % counter state : 0=stop, 1=start, 2=start and visible +\setnewconstant\userpagenumberstate \plustwo % counter state : 0=stop, 1=start, 2=start and visible +\setnewconstant\subpagenumberstate \plustwo % counter state : 0=stop, 1=start, 2=start and visible +\setnewconstant\overallpagenumberstate\plusone % general number: 0=invisible, 1=visible \def\checkpagenumberstatechange#1#2% {\edef\newpagenumberstate{\structurecounterparameter#1\c!state}% \ifx\newpagenumberstate\oldpagenumberstate \else \doifelse\newpagenumberstate\v!start - {\chardef#2\plustwo}% - {\chardef#2\zerocount}% + {#2\plustwo}% + {#2\zerocount}% \fi} \appendtoks % todo: set state: none, start, stop, reset @@ -422,8 +424,8 @@ \appendtoks % todo: set state: none, start, stop, reset \doifelse\@@nmstate\v!start - {\chardef\overallpagenumberstate\plusone}% - {\chardef\overallpagenumberstate\zerocount}% + {\overallpagenumberstate\plusone }% + {\overallpagenumberstate\zerocount}% \to \everysetuppagenumbering % Done diff --git a/Master/texmf-dist/tex/context/base/strc-prc.mkiv b/Master/texmf-dist/tex/context/base/strc-prc.mkiv index 2955a396b5a..68339ed9274 100644 --- a/Master/texmf-dist/tex/context/base/strc-prc.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-prc.mkiv @@ -50,11 +50,11 @@ \def\dodefineprocessor[#1][#2]% {\ifsecondargument \letbeundefined{\??po#1\c!command}% - \ctxlua{structure.processors.register("#1")}% + \ctxlua{structures.processors.register("#1")}% \getparameters[\??po#1][\c!style=,\c!color=,\c!left=,\c!right=,#2]% \else \letbeundefined{\??po#1\c!style}% - \ctxlua{structure.processors.reset("#1")}% + \ctxlua{structures.processors.reset("#1")}% \fi} %D The following command can be used by users but normally it will be diff --git a/Master/texmf-dist/tex/context/base/strc-ref.lua b/Master/texmf-dist/tex/context/base/strc-ref.lua index 475ab318a8a..ee32353f0c4 100644 --- a/Master/texmf-dist/tex/context/base/strc-ref.lua +++ b/Master/texmf-dist/tex/context/base/strc-ref.lua @@ -7,14 +7,24 @@ if not modules then modules = { } end modules ['strc-ref'] = { } local format, find, gmatch, match, concat = string.format, string.find, string.gmatch, string.match, table.concat -local lpegmatch = lpeg.match -local texsprint, texwrite, texcount, texsetcount = tex.sprint, tex.write, tex.count, tex.setcount +local lpegmatch, lpegP, lpegCs = lpeg.match, lpeg.P, lpeg.Cs +local texcount, texsetcount = tex.count, tex.setcount +local rawget = rawget -local trace_referencing = false trackers.register("structure.referencing", function(v) trace_referencing = v end) +local allocate = utilities.storage.allocate +local mark = utilities.storage.mark +local setmetatableindex = table.setmetatableindex + +local trace_referencing = false trackers.register("structures.referencing", function(v) trace_referencing = v end) + +local report_references = logs.reporter("structure","references") -local ctxcatcodes = tex.ctxcatcodes local variables = interfaces.variables local constants = interfaces.constants +local context = context + +local settings_to_array = utilities.parsers.settings_to_array +local unsetvalue = attributes.unsetvalue -- beware, this is a first step in the rewrite (just getting rid of -- the tuo file); later all access and parsing will also move to lua @@ -22,50 +32,119 @@ local constants = interfaces.constants -- the useddata and pagedata names might change -- todo: pack exported data -jobreferences = jobreferences or { } -jobreferences.tobesaved = jobreferences.tobesaved or { } -jobreferences.collected = jobreferences.collected or { } -jobreferences.defined = jobreferences.defined or { } -- indirect ones -jobreferences.derived = jobreferences.derived or { } -- taken from lists -jobreferences.specials = jobreferences.specials or { } -- system references -jobreferences.runners = jobreferences.runners or { } -jobreferences.internals = jobreferences.internals or { } -jobreferences.exporters = jobreferences.exporters or { } -jobreferences.imported = jobreferences.imported or { } - -storage.register("jobreferences/defined", jobreferences.defined, "jobreferences.defined") - -local tobesaved, collected = jobreferences.tobesaved, jobreferences.collected -local defined, derived, specials = jobreferences.defined, jobreferences.derived, jobreferences.specials -local exporters, runners = jobreferences.exporters, jobreferences.runners +local structures = structures +local helpers = structures.helpers +local sections = structures.sections +local references = structures.references +local lists = structures.lists +local counters = structures.counters + +-- some might become local + +references.defined = references.defined or allocate() + +local defined = references.defined +local derived = allocate() +local specials = allocate() +local runners = allocate() +local internals = allocate() +local exporters = allocate() +local imported = allocate() +local filters = allocate() +local executers = allocate() +local handlers = allocate() +local tobesaved = allocate() +local collected = allocate() +local tobereferred = allocate() +local referred = allocate() + +references.derived = derived +references.specials = specials +references.runners = runners +references.internals = internals +references.exporters = exporters +references.imported = imported +references.filters = filters +references.executers = executers +references.handlers = handlers +references.tobesaved = tobesaved +references.collected = collected +references.tobereferred = tobereferred +references.referred = referred + +storage.register("structures/references/defined", references.defined, "structures.references.defined") local currentreference = nil local initializers = { } local finalizers = { } -function jobreferences.registerinitializer(func) -- we could use a token register instead +function references.registerinitializer(func) -- we could use a token register instead initializers[#initializers+1] = func end -function jobreferences.registerfinalizer(func) -- we could use a token register instead +function references.registerfinalizer(func) -- we could use a token register instead finalizers[#finalizers+1] = func end -local function initializer() - tobesaved, collected = jobreferences.tobesaved, jobreferences.collected +local function initializer() -- can we use a tobesaved as metatable for collected? + tobesaved = references.tobesaved + collected = references.collected for i=1,#initializers do initializers[i](tobesaved,collected) end end + local function finalizer() - tobesaved = jobreferences.tobesaved for i=1,#finalizers do finalizers[i](tobesaved) end end -if job then - job.register('jobreferences.collected', jobreferences.tobesaved, initializer, finalizer) +job.register('structures.references.collected', tobesaved, initializer, finalizer) + +local maxreferred = 1 + +local function initializer() -- can we use a tobesaved as metatable for collected? + tobereferred = references.tobereferred + referred = references.referred + local function get(t,n) -- catch sparse, a bit slow but who cares + for i=n,1,-1 do -- we could make a tree ... too much work + local p = rawget(t,i) + if p then + return p + end + end + end + setmetatableindex(referred, get) +end + +local function finalizer() -- make sparse + local last + for i=1,maxreferred do + local r = tobereferred[i] + if not last then + last = r + elseif r == last then + tobereferred[i] = nil + else + last = r + end + end +end + +job.register('structures.references.referred', tobereferred, initializer, finalizer) + +function references.referredpage(n) + return referred[n] or referred[n] or texcount.realpageno +end + +function references.registerpage(n) + if not tobereferred[n] then + if n > maxreferred then + maxreferred = n + end + tobereferred[n] = texcount.realpageno + end end -- todo: delay split till later as in destinations we split anyway @@ -86,18 +165,18 @@ local function setnextorder(kind,name) texsetcount("global","locationorder",lastorder) end -jobreferences.setnextorder = setnextorder +references.setnextorder = setnextorder -function jobreferences.setnextinternal(kind,name) +function references.setnextinternal(kind,name) setnextorder(kind,name) -- always incremented with internal texsetcount("global","locationcount",texcount.locationcount + 1) end -function jobreferences.currentorder(kind,name) - texwrite((orders[kind] and orders[kind][name]) or lastorder) +function references.currentorder(kind,name) + context(orders[kind] and orders[kind][name] or lastorder) end -function jobreferences.set(kind,prefix,tag,data) +function references.set(kind,prefix,tag,data) for ref in gmatch(tag,"[^,]+") do local p, r = match(ref,"^(%-):(.-)$") if p and r then @@ -112,17 +191,17 @@ function jobreferences.set(kind,prefix,tag,data) tobesaved[prefix] = pd end pd[ref] = data - texsprint(ctxcatcodes,format("\\dofinish%sreference{%s}{%s}",kind,prefix,ref)) + context.dofinishsomereference(kind,prefix,ref) end end end -function jobreferences.setandgetattribute(kind,prefix,tag,data,view) -- maybe do internal automatically here - jobreferences.set(kind,prefix,tag,data) - texcount.lastdestinationattribute = jobreferences.setinternalreference(prefix,tag,nil,view) or -0x7FFFFFFF +function references.setandgetattribute(kind,prefix,tag,data,view) -- maybe do internal automatically here + references.set(kind,prefix,tag,data) + texcount.lastdestinationattribute = references.setinternalreference(prefix,tag,nil,view) or -0x7FFFFFFF end -function jobreferences.enhance(prefix,tag,spec) +function references.enhance(prefix,tag,spec) local l = tobesaved[prefix][tag] if l then l.references.realpage = texcount.realpageno @@ -133,9 +212,9 @@ end local result = { } -local lparent, rparent, lbrace, rbrace, dcolon, backslash = lpeg.P("("), lpeg.P(")"), lpeg.P("{"), lpeg.P("}"), lpeg.P("::"), lpeg.P("\\") +local lparent, rparent, lbrace, rbrace, dcolon, backslash = lpegP("("), lpegP(")"), lpegP("{"), lpegP("}"), lpegP("::"), lpegP("\\") -local reset = lpeg.P("") / function() result = { } end +local reset = lpegP("") / function() result = { } end local b_token = backslash / function(s) result.has_tex = true return s end local o_token = 1 - rparent - rbrace - lparent - lbrace @@ -144,11 +223,11 @@ local s_token = 1 - lparent - lbrace - lparent - lbrace local i_token = 1 - lparent - lbrace local f_token = 1 - lparent - lbrace - dcolon -local outer = (f_token )^1 / function (s) result.outer = s end -local operation = lpeg.Cs((b_token + o_token)^1) / function (s) result.operation = s end -local arguments = lpeg.Cs((b_token + a_token)^0) / function (s) result.arguments = s end -local special = (s_token )^1 / function (s) result.special = s end -local inner = (i_token )^1 / function (s) result.inner = s end +local outer = (f_token )^1 / function (s) result.outer = s end +local operation = lpegCs((b_token + o_token)^1) / function (s) result.operation = s end +local arguments = lpegCs((b_token + a_token)^0) / function (s) result.arguments = s end +local special = (s_token )^1 / function (s) result.special = s end +local inner = (i_token )^1 / function (s) result.inner = s end local outer_reference = (outer * dcolon)^0 @@ -160,34 +239,34 @@ local special_reference = special * lparent * (operation * optional_arguments + local scanner = (reset * outer_reference * (special_reference + inner_reference)^-1 * -1) / function() return result end ---~ function jobreferences.analyse(str) -- overloaded +--~ function references.analyze(str) -- overloaded --~ return lpegmatch(scanner,str) --~ end -function jobreferences.split(str) +function references.split(str) return lpegmatch(scanner,str or "") end ---~ print(table.serialize(jobreferences.analyse(""))) ---~ print(table.serialize(jobreferences.analyse("inner"))) ---~ print(table.serialize(jobreferences.analyse("special(operation{argument,argument})"))) ---~ print(table.serialize(jobreferences.analyse("special(operation)"))) ---~ print(table.serialize(jobreferences.analyse("special()"))) ---~ print(table.serialize(jobreferences.analyse("inner{argument}"))) ---~ print(table.serialize(jobreferences.analyse("outer::"))) ---~ print(table.serialize(jobreferences.analyse("outer::inner"))) ---~ print(table.serialize(jobreferences.analyse("outer::special(operation{argument,argument})"))) ---~ print(table.serialize(jobreferences.analyse("outer::special(operation)"))) ---~ print(table.serialize(jobreferences.analyse("outer::special()"))) ---~ print(table.serialize(jobreferences.analyse("outer::inner{argument}"))) ---~ print(table.serialize(jobreferences.analyse("special(outer::operation)"))) +--~ print(table.serialize(references.analyze(""))) +--~ print(table.serialize(references.analyze("inner"))) +--~ print(table.serialize(references.analyze("special(operation{argument,argument})"))) +--~ print(table.serialize(references.analyze("special(operation)"))) +--~ print(table.serialize(references.analyze("special()"))) +--~ print(table.serialize(references.analyze("inner{argument}"))) +--~ print(table.serialize(references.analyze("outer::"))) +--~ print(table.serialize(references.analyze("outer::inner"))) +--~ print(table.serialize(references.analyze("outer::special(operation{argument,argument})"))) +--~ print(table.serialize(references.analyze("outer::special(operation)"))) +--~ print(table.serialize(references.analyze("outer::special()"))) +--~ print(table.serialize(references.analyze("outer::inner{argument}"))) +--~ print(table.serialize(references.analyze("special(outer::operation)"))) -- -- -- related to strc-ini.lua -- -- -- -jobreferences.resolvers = jobreferences.resolvers or { } +references.resolvers = references.resolvers or { } -function jobreferences.resolvers.section(var) - local vi = structure.lists.collected[var.i[2]] +function references.resolvers.section(var) + local vi = lists.collected[var.i[2]] if vi then var.i = vi var.r = (vi.references and vi.references.realpage) or (vi.pagedata and vi.pagedata.realpage) or 1 @@ -197,12 +276,12 @@ function jobreferences.resolvers.section(var) end end -jobreferences.resolvers.float = jobreferences.resolvers.section -jobreferences.resolvers.description = jobreferences.resolvers.section -jobreferences.resolvers.formula = jobreferences.resolvers.section -jobreferences.resolvers.note = jobreferences.resolvers.section +references.resolvers.float = references.resolvers.section +references.resolvers.description = references.resolvers.section +references.resolvers.formula = references.resolvers.section +references.resolvers.note = references.resolvers.section -function jobreferences.resolvers.reference(var) +function references.resolvers.reference(var) local vi = var.i[2] if vi then var.i = vi @@ -214,6 +293,7 @@ function jobreferences.resolvers.reference(var) end local function register_from_lists(collected,derived) + local g = derived[""] if not g then g = { } derived[""] = g end -- global for i=1,#collected do local entry = collected[i] local m, r = entry.metadata, entry.references @@ -226,9 +306,10 @@ local function register_from_lists(collected,derived) local t = { kind, i } for s in gmatch(reference,"%s*([^,]+)") do if trace_referencing then - logs.report("referencing","list entry %s provides %s reference '%s' on realpage %s",i,kind,s,realpage) + report_references("list entry %s provides %s reference '%s' on realpage %s",i,kind,s,realpage) end - d[s] = t -- share them + d[s] = d[s] or t -- share them + g[s] = g[s] or t -- first wins end end end @@ -236,30 +317,34 @@ local function register_from_lists(collected,derived) end end -jobreferences.registerinitializer(function() register_from_lists(structure.lists.collected,derived) end) +references.registerinitializer(function() register_from_lists(lists.collected,derived) end) -- urls -jobreferences.urls = jobreferences.urls or { } -jobreferences.urls.data = jobreferences.urls.data or { } +references.urls = references.urls or { } +references.urls.data = references.urls.data or { } -local urls = jobreferences.urls.data +local urls = references.urls.data -function jobreferences.urls.define(name,url,file,description) +function references.urls.define(name,url,file,description) if name and name ~= "" then urls[name] = { url or "", file or "", description or url or file or ""} end end -function jobreferences.urls.get(name,method,space) -- method: none, before, after, both, space: yes/no +local pushcatcodes, popcatcodes, txtcatcodes = context.pushcatcodes, context.popcatcodes, tex.txtcatcodes + +function references.urls.get(name,method,space) -- method: none, before, after, both, space: yes/no local u = urls[name] if u then local url, file = u[1], u[2] + pushcatcodes(txtcatcodes) if file and file ~= "" then - texsprint(ctxcatcodes,url,"/",file) + context("%s/%s",url,file) else - texsprint(ctxcatcodes,url) + context(url) end + popcatcodes() end end @@ -269,21 +354,21 @@ end -- files -jobreferences.files = jobreferences.files or { } -jobreferences.files.data = jobreferences.files.data or { } +references.files = references.files or { } +references.files.data = references.files.data or { } -local files = jobreferences.files.data +local files = references.files.data -function jobreferences.files.define(name,file,description) +function references.files.define(name,file,description) if name and name ~= "" then files[name] = { file or "", description or file or ""} end end -function jobreferences.files.get(name,method,space) -- method: none, before, after, both, space: yes/no +function references.files.get(name,method,space) -- method: none, before, after, both, space: yes/no local f = files[name] if f then - texsprint(ctxcatcodes,f[1]) + context(f[1]) end end @@ -293,7 +378,7 @@ end -- helpers -function jobreferences.checkedfile(whatever) -- return whatever if not resolved +function references.checkedfile(whatever) -- return whatever if not resolved if whatever then local w = files[whatever] if w then @@ -304,7 +389,7 @@ function jobreferences.checkedfile(whatever) -- return whatever if not resolved end end -function jobreferences.checkedurl(whatever) -- return whatever if not resolved +function references.checkedurl(whatever) -- return whatever if not resolved if whatever then local w = urls[whatever] if w then @@ -320,7 +405,7 @@ function jobreferences.checkedurl(whatever) -- return whatever if not resolved end end -function jobreferences.checkedfileorurl(whatever,default) -- return nil, nil if not resolved +function references.checkedfileorurl(whatever,default) -- return nil, nil if not resolved if whatever then local w = files[whatever] if w then @@ -342,25 +427,25 @@ end -- programs -jobreferences.programs = jobreferences.programs or { } -jobreferences.programs.data = jobreferences.programs.data or { } +references.programs = references.programs or { } +references.programs.data = references.programs.data or { } -local programs = jobreferences.programs.data +local programs = references.programs.data -function jobreferences.programs.define(name,file,description) +function references.programs.define(name,file,description) if name and name ~= "" then programs[name] = { file or "", description or file or ""} end end -function jobreferences.programs.get(name) +function references.programs.get(name) local f = programs[name] if f then - texsprint(ctxcatcodes,f[1]) + context(f[1]) end end -function jobreferences.checkedprogram(whatever) -- return whatever if not resolved +function references.checkedprogram(whatever) -- return whatever if not resolved if whatever then local w = programs[whatever] if w then @@ -373,36 +458,36 @@ end -- shared by urls and files -function jobreferences.whatfrom(name) - texsprint(ctxcatcodes,(urls[name] and variables.url) or (files[name] and variables.file) or variables.unknown) +function references.whatfrom(name) + context((urls[name] and variables.url) or (files[name] and variables.file) or variables.unknown) end ---~ function jobreferences.from(name) +--~ function references.from(name) --~ local u = urls[name] --~ if u then --~ local url, file, description = u[1], u[2], u[3] --~ if description ~= "" then ---~ texsprint(ctxcatcodes,format("\\dofromurldescription{%s}",description)) +--~ context.dofromurldescription(description) --~ -- ok --~ elseif file and file ~= "" then ---~ texsprint(ctxcatcodes,format("\\dofromurlliteral{%s}",url .. "/" .. file)) +--~ context.dofromurlliteral(url .. "/" .. file) --~ else ---~ texsprint(ctxcatcodes,format("\\dofromurlliteral{%s}",url)) +--~ context(dofromurlliteral,url) --~ end --~ else --~ local f = files[name] --~ if f then --~ local description, file = f[1], f[2] --~ if description ~= "" then ---~ texsprint(ctxcatcodes,format("\\dofromfiledescription{%s}",description)) +--~ context.dofromfiledescription(description) --~ else ---~ texsprint(ctxcatcodes,format("\\dofromfileliteral{%s}",file)) +--~ context.dofromfileliteral(file) --~ end --~ end --~ end --~ end -function jobreferences.from(name) +function references.from(name) local u = urls[name] if u then local url, file, description = u[1], u[2], u[3] @@ -456,11 +541,12 @@ function exporters.lists.generic(data) end if numberdata then local numbers = numberdata.numbers - local t = { } + local t, tn = { }, 0 for i=1,#numbers do local n = numbers[i] if n ~= 0 then - t[#t+1] = n + tn = tn + 1 + t[tn] = n end end useddata.number = concat(t,".") @@ -481,13 +567,16 @@ local function referencer(data) } end -function jobreferences.export(usedname) +-- Exported and imported references ... not yet used but don't forget it +-- and redo it. + +function references.export(usedname) local exported = { } local e_references, e_lists = exporters.references, exporters.lists local g_references, g_lists = e_references.generic, e_lists.generic -- todo: pagenumbers -- todo: some packing - for prefix, references in next, jobreferences.tobesaved do + for prefix, references in next, references.tobesaved do local pe = exported[prefix] if not pe then pe = { } exported[prefix] = pe end for key, data in next, references do local metadata = data.metadata @@ -506,7 +595,7 @@ function jobreferences.export(usedname) end end local pe = exported[""] if not pe then pe = { } exported[""] = pe end - for n, data in next, structure.lists.tobesaved do + for n, data in next, lists.tobesaved do local metadata = data.metadata local exporter = e_lists[metadata.kind] or g_lists if exporter then @@ -531,9 +620,8 @@ function jobreferences.export(usedname) io.savedata(file.replacesuffix(usedname or tex.jobname,"tue"),table.serialize(e,true)) end -function jobreferences.import(usedname) +function references.import(usedname) if usedname then - local imported = jobreferences.imported local jdn = imported[usedname] if not jdn then local filename = files[usedname] @@ -574,20 +662,20 @@ function jobreferences.import(usedname) end end -function jobreferences.load(usedname) +function references.load(usedname) -- gone end -function jobreferences.define(prefix,reference,list) +function references.define(prefix,reference,list) local d = defined[prefix] if not d then d = { } defined[prefix] = d end d[reference] = { "defined", list } end ---~ function jobreferences.registerspecial(name,action,...) +--~ function references.registerspecial(name,action,...) --~ specials[name] = { action, ... } --~ end -function jobreferences.reset(prefix,reference) +function references.reset(prefix,reference) local d = defined[prefix] if d then d[reference] = nil @@ -600,25 +688,55 @@ end -- t.special t.operation t.arguments t.outer t.inner -local settings_to_array = aux.settings_to_array +-- to what extend do we check the non prefixed variant + +local strict = false local function resolve(prefix,reference,args,set) -- we start with prefix,reference texcount.referencehastexstate = 0 if reference and reference ~= "" then - set = set or { } + if not set then + set = { prefix = prefix, reference = reference } + else + set.reference = set.reference or reference + set.prefix = set.prefix or prefix + end local r = settings_to_array(reference) for i=1,#r do local ri = r[i] - local dp = defined[prefix] or defined[""] - local d = dp[ri] + local d + if strict then + d = defined[prefix] or defined[""] + d = d and d[ri] + else + d = defined[prefix] + d = d and d[ri] + if not d then + d = defined[""] + d = d and d[ri] + end + end if d then resolve(prefix,d[2],nil,set) else local var = lpegmatch(scanner,ri) if var then var.reference = ri - if not var.outer and var.inner then - local d = defined[prefix][var.inner] or defined[""][var.inner] + local vo, vi = var.outer, var.inner + if not vo and vi then + -- to be checked + if strict then + d = defined[prefix] or defined[""] + d = d and d[vi] + else + d = defined[prefix] + d = d and d[vi] + if not d then + d = defined[""] + d = d and d[vi] + end + end + -- if d then resolve(prefix,d[2],var.arguments,set) -- args can be nil else @@ -633,13 +751,14 @@ local function resolve(prefix,reference,args,set) -- we start with prefix,refere set.has_tex = true end else - -- logs.report("references","funny pattern: %s",ri or "?") + -- report_references("funny pattern: %s",ri or "?") end end end if set.has_tex then texcount.referencehastexstate = 1 end +--~ table.print(set) return set else return { } @@ -648,41 +767,69 @@ end -- prefix == "" is valid prefix which saves multistep lookup -jobreferences.currentset = nil +references.currentset = nil + +--~ local b, e = "\\ctxlua{local jc = structures.references.currentset;", "}" +--~ local o, a = 'jc[%s].operation=[[%s]];', 'jc[%s].arguments=[[%s]];' +--~ +--~ function references.expandcurrent() -- todo: two booleans: o_has_tex& a_has_tex +--~ local currentset = references.currentset +--~ if currentset and currentset.has_tex then +--~ local done = false +--~ for i=1,#currentset do +--~ local ci = currentset[i] +--~ local operation = ci.operation +--~ if operation then +--~ if find(operation,"\\") then -- if o_has_tex then +--~ if not done then +--~ context(b) +--~ done = true +--~ end +--~ context(o,i,operation) +--~ end +--~ end +--~ local arguments = ci.arguments +--~ if arguments then +--~ if find(arguments,"\\") then -- if a_has_tex then +--~ if not done then +--~ context(b) +--~ done = true +--~ end +--~ context(a,i,arguments) +--~ end +--~ end +--~ end +--~ if done then +--~ context(e) +--~ end +--~ end +--~ end + +function commands.setreferenceoperation(k,v) + references.currentset[k].operation = v +end + +function commands.setreferencearguments(k,v) + references.currentset[k].arguments = v +end -local b, e = "\\ctxlua{local jc = jobreferences.currentset;", "}" -local o, a = 'jc[%s].operation=[[%s]];', 'jc[%s].arguments=[[%s]];' +local expandreferenceoperation = context.expandreferenceoperation +local expandreferencearguments = context.expandreferencearguments -function jobreferences.expandcurrent() -- todo: two booleans: o_has_tex& a_has_tex - local currentset = jobreferences.currentset +function references.expandcurrent() -- todo: two booleans: o_has_tex& a_has_tex + local currentset = references.currentset if currentset and currentset.has_tex then - local done = false for i=1,#currentset do local ci = currentset[i] local operation = ci.operation - if operation then - if find(operation,"\\") then -- if o_has_tex then - if not done then - texsprint(ctxcatcodes,b) - done = true - end - texsprint(ctxcatcodes,format(o,i,operation)) - end + if operation and find(operation,"\\") then -- if o_has_tex then + expandreferenceoperation(i,operation) end local arguments = ci.arguments - if arguments then - if find(arguments,"\\") then -- if a_has_tex then - if not done then - texsprint(ctxcatcodes,b) - done = true - end - texsprint(ctxcatcodes,format(a,i,arguments)) - end + if arguments and find(arguments,"\\") then -- if a_has_tex then + expandreferencearguments(i,arguments) end end - if done then - texsprint(ctxcatcodes,e) - end end end @@ -696,9 +843,17 @@ end --~ end --~ end +local prefixsplitter = lpegCs(lpegP((1-lpegP(":"))^1 * lpegP(":"))) * lpegCs(lpegP(1)^1) + +-- todo: add lots of tracing here + +local n = 0 + local function identify(prefix,reference) local set = resolve(prefix,reference) local bug = false +n = n + 1 +set.n = n for i=1,#set do local var = set[i] local special, inner, outer, arguments, operation = var.special, var.inner, var.outer, var.arguments, var.operation @@ -730,7 +885,7 @@ local function identify(prefix,reference) var.error = "unknown special" end elseif outer then - local e = jobreferences.import(outer) + local e = references.import(outer) if e then if inner then local r = e.references @@ -747,7 +902,7 @@ local function identify(prefix,reference) var.kind = "outer with inner" end var.i = { "reference", r } - jobreferences.resolvers.reference(var) + references.resolvers.reference(var) var.f = outer var.e = true -- external end @@ -769,7 +924,7 @@ local function identify(prefix,reference) var.kind = "outer with inner" end var.i = r - jobreferences.resolvers[r[1]](var) + references.resolvers[r[1]](var) var.f = outer end end @@ -812,7 +967,7 @@ local function identify(prefix,reference) var.kind = "outer with inner" end var.i = { "reference", inner } - jobreferences.resolvers.reference(var) + references.resolvers.reference(var) var.f = outer elseif special then local s = specials[special] @@ -849,47 +1004,101 @@ local function identify(prefix,reference) var.error = "unknown inner or special" end else - -- inner ---~ local i = tobesaved[prefix] - local i = collected[prefix] - i = i and i[inner] + -- inner ... we could move the prefix logic into the parser so that we have 'm for each entry + -- foo:bar -> foo == prefix (first we try the global one) + -- -:bar -> ignore prefix + local p, i = prefix, nil + local splitprefix, splitinner = lpegmatch(prefixsplitter,inner) + -- these are taken from other anonymous references + if splitprefix and splitinner then + if splitprefix == "-" then + i = collected[""] + i = i and i[splitinner] + if i then + p = "" + end + else + i = collected[splitprefix] + i = i and i[splitinner] + if i then + p = splitprefix + end + end + end + -- todo: strict here + if not i then + i = collected[prefix] + i = i and i[inner] + if i then + p = prefix + end + end + if not i and prefix ~= "" then + i = collected[""] + i = i and i[inner] + if i then + p = "" + end + end if i then var.i = { "reference", i } - jobreferences.resolvers.reference(var) + references.resolvers.reference(var) var.kind = "inner" - var.p = prefix + var.p = p else - i = derived[prefix] - i = i and i[inner] + -- these are taken from other data structures (like lists) +--~ print("!!!!!!!!!!!!!!",splitprefix,splitinner) +--~ table.print(derived) + if splitprefix and splitinner then + if splitprefix == "-" then + i = derived[""] + i = i and i[splitinner] + if i then + p = "" + end + else + i = derived[splitprefix] + i = i and i[splitinner] + if i then + p = splitprefix + end + end + end + if not i then + i = derived[prefix] + i = i and i[inner] + if i then + p = prefix + end + end + if not i and prefix ~= "" then + i = derived[""] + i = i and i[inner] + if i then + p = "" + end + end if i then var.kind = "inner" var.i = i - jobreferences.resolvers[i[1]](var) - var.p = prefix + references.resolvers[i[1]](var) + var.p = p else - i = collected[prefix] - i = i and i[inner] - if i then - var.kind = "inner" - var.i = { "reference", i } - jobreferences.resolvers.reference(var) - var.p = prefix + -- no prefixes here + local s = specials[inner] + if s then + var.kind = "special" else - local s = specials[inner] - if s then - var.kind = "special" + i = (collected[""] and collected[""][inner]) or + (derived [""] and derived [""][inner]) or + (tobesaved[""] and tobesaved[""][inner]) + if i then + var.kind = "inner" + var.i = { "reference", i } + references.resolvers.reference(var) + var.p = "" else - i = (collected[""] and collected[""][inner]) or - (derived [""] and derived [""][inner]) or - (tobesaved[""] and tobesaved[""][inner]) - if i then - var.kind = "inner" - var.i = { "reference", i } - jobreferences.resolvers.reference(var) - var.p = "" - else - var.error = "unknown inner or special" - end + var.error = "unknown inner or special" end end end @@ -899,87 +1108,131 @@ local function identify(prefix,reference) bug = bug or var.error set[i] = var end - jobreferences.currentset = set --- print(bug,table.serialize(set)) + references.currentset = mark(set) -- mark, else in api doc +--~ table.print(set,tostring(bug)) return set, bug end -jobreferences.identify = identify +references.identify = identify -function jobreferences.doifelse(prefix,reference,highlight,newwindow,layer) +local unknowns, nofunknowns = { }, 0 + +function references.doifelse(prefix,reference,highlight,newwindow,layer) local set, bug = identify(prefix,reference) local unknown = bug or #set == 0 if unknown then currentreference = nil -- will go away + local str = format("[%s][%s]",prefix,reference) + local u = unknowns[str] + if not u then + interfaces.showmessage("references",1,str) -- 1 = unknown, 4 = illegal + unknowns[str] = 1 + nofunknowns = nofunknowns + 1 + else + unknowns[str] = u + 1 + end else set.highlight, set.newwindow,set.layer = highlight, newwindow, layer currentreference = set[1] end -- we can do the expansion here which saves a call +--~ print("!!!!!!",not unknown) commands.doifelse(not unknown) end -function jobreferences.setinternalreference(prefix,tag,internal,view) - local t = { } - if tag then - if prefix and prefix ~= "" then - prefix = prefix .. ":" - for ref in gmatch(tag,"[^,]+") do - t[#t+1] = prefix .. ref - end - else - for ref in gmatch(tag,"[^,]+") do - t[#t+1] = ref - end +function references.reportproblems() -- might become local + if nofunknowns > 0 then + interfaces.showmessage("references",5,nofunknowns) -- 5 = unknown, 6 = illegal + -- -- we need a proper logger specific for the log file + -- texio.write_nl("log",format("%s unknown references",nofunknowns)) + -- for k, v in table.sortedpairs(unknowns) do + -- texio.write_nl("log",format("%s (n=%s)",k,v)) + -- end + -- texio.write_nl("log","") + end +end + +luatex.registerstopactions(references.reportproblems) + +local innermethod = "names" + +function references.setinnermethod(m) + if m then + if m == "page" or m == "mixed" or m == "names" then + innermethod = m + elseif m == true or m == variables.yes then + innermethod = "page" end end - if internal then - t[#t+1] = "aut:" .. internal + function references.setinnermethod() + report_references("inner method is already set and frozen to '%s'",innermethod) end - local destination = jobreferences.mark(t,nil,nil,view) -- returns an attribute - texcount.lastdestinationattribute = destination - return destination end -function jobreferences.getinternalreference(n) -- n points into list - local l = structure.lists.collected[n] - texsprint(ctxcatcodes,(l and l.references.internal) or n) +function references.getinnermethod() + return innermethod or "names" +end + +directives.register("references.linkmethod", function(v) -- page mixed names + references.setinnermethod(v) +end) + +function references.setinternalreference(prefix,tag,internal,view) + if innermethod == "page" then + return unsetvalue + else + local t, tn = { }, 0 -- maybe add to current + if tag then + if prefix and prefix ~= "" then + prefix = prefix .. ":" + for ref in gmatch(tag,"[^,]+") do + tn = tn + 1 + t[tn] = prefix .. ref + end + else + for ref in gmatch(tag,"[^,]+") do + tn = tn + 1 + t[tn] = ref + end + end + end + if internal and innermethod == "names" then -- mixed or page + tn = tn + 1 + t[tn] = "aut:" .. internal + end + local destination = references.mark(t,nil,nil,view) -- returns an attribute + texcount.lastdestinationattribute = destination + return destination + end end +function references.getinternalreference(n) -- n points into list (todo: registers) + local l = lists.collected[n] + context(l and l.references.internal or n) +end -- -function jobreferences.get_current_metadata(tag) +function references.getcurrentmetadata(tag) local data = currentreference and currentreference.i data = data and data.metadata and data.metadata[tag] if data then - texsprint(ctxcatcodes,data) + context(data) end end -local function current_metadata(tag) + +local function currentmetadata(tag) local data = currentreference and currentreference.i return data and data.metadata and data.metadata[tag] end -jobreferences.current_metadata = current_metadata -function jobreferences.get_current_prefixspec(default) -- todo: message - texsprint(ctxcatcodes,"\\getreferencestructureprefix{", - current_metadata("kind") or "?", "}{", current_metadata("name") or "?", "}{", default or "?", "}") -end - ---~ function jobreferences.get_current_prefixspec(default) -- we can consider storing the data at the lua end ---~ context.getreferencestructureprefix(current_metadata("kind"),current_metadata("name"),default) ---~ end +references.currentmetadata = currentmetadata --- - -jobreferences.filters = jobreferences.filters or { } - -local filters = jobreferences.filters -local helpers = structure.helpers -local sections = structure.sections +function references.getcurrentprefixspec(default) -- todo: message + context.getreferencestructureprefix(currentmetadata("kind") or "?",currentmetadata("name") or "?",default or "?") +end -function jobreferences.filter(name,...) -- number page title ... +function references.filter(name,...) -- number page title ... local data = currentreference and currentreference.i if data then local kind = data.metadata and data.metadata.kind @@ -988,17 +1241,17 @@ function jobreferences.filter(name,...) -- number page title ... filter = filter and (filter[name] or filter.unknown or filters.generic[name] or filters.generic.unknown) if filter then if trace_referencing then - logs.report("referencing","name '%s', kind '%s', using dedicated filter",name,kind) + report_references("name '%s', kind '%s', using dedicated filter",name,kind) end filter(data,name,...) elseif trace_referencing then - logs.report("referencing","name '%s', kind '%s', using generic filter",name,kind) + report_references("name '%s', kind '%s', using generic filter",name,kind) end elseif trace_referencing then - logs.report("referencing","name '%s', unknown kind",name) + report_references("name '%s', unknown kind",name) end elseif trace_referencing then - logs.report("referencing","name '%s', no reference",name) + report_references("name '%s', no reference",name) end end @@ -1032,7 +1285,7 @@ function filters.generic.number(data,what,prefixspec) -- todo: spec and then no else local useddata = data.useddata if useddata and useddsta.number then - tex.sprint(tex.ctxcatcodes,useddata.number) + context(useddata.number) end end end @@ -1047,9 +1300,9 @@ function filters.generic.page(data,prefixspec,pagespec) if not number then -- error elseif conversion then - tex.sprint(tex.ctxcatcodes,format("\\convertnumber{%s}{%s}",conversion,number)) + context.convertnumber(conversion,number) else - tex.sprint(tex.ctxcatcodes,number) + context(number) end else helpers.prefixpage(data,prefixspec,pagespec) @@ -1072,7 +1325,7 @@ function filters.user.unknown(data,name) end local namedata = userdata and userdata[name] if namedata then - texsprint(ctxcatcodes,namedata) + context(namedata) end end end @@ -1080,12 +1333,10 @@ end filters.text = { } function filters.text.title(data) --- texsprint(ctxcatcodes,"[text title]") helpers.title(data.entries.text or "?",data.metadata) end function filters.text.number(data) --- texsprint(ctxcatcodes,"[text number]") helpers.title(data.entries.text or "?",data.metadata) end @@ -1103,7 +1354,7 @@ function filters.section.number(data,what,prefixspec) else local useddata = data.useddata if useddata and useddata.number then - tex.sprint(tex.ctxcatcodes,useddata.number) + context(useddata.number) end end end @@ -1119,12 +1370,6 @@ filters.float = { default = filters.generic.number } filters.description = { default = filters.generic.number } filters.item = { default = filters.generic.number } -structure.references = structure.references or { } -structure.helpers = structure.helpers or { } - -local references = structure.references -local helpers = structure.helpers - function references.sectiontitle(n) helpers.sectiontitle(lists.collected[tonumber(n) or 0]) end @@ -1137,25 +1382,39 @@ function references.sectionpage(n,prefixspec,pagespec) helpers.prefixedpage(lists.collected[tonumber(n) or 0],prefixspec,pagespec) end --- analyse +-- analyze -jobreferences.testrunners = jobreferences.testrunners or { } -jobreferences.testspecials = jobreferences.testspecials or { } +references.testrunners = references.testrunners or { } +references.testspecials = references.testspecials or { } -local runners = jobreferences.testrunners -local specials = jobreferences.testspecials +local runners = references.testrunners +local specials = references.testspecials -function jobreferences.analyse(actions) - actions = actions or jobreferences.currentset +local function checkedpagestate(n,page) + local r, p = referred[n] or texcount.realpageno, tonumber(page) + if not p then + return 0 + elseif p > r then + return 3 + elseif p < r then + return 2 + else + return 1 + end +end + +function references.analyze(actions) + actions = actions or references.currentset if not actions then actions = { realpage = 0 } + texcount.referencepagestate = 0 elseif actions.realpage then - -- already analysed + -- already analyzed + texcount.referencepagestate = checkedpagestate(actions.n,actions.realpage) else -- we store some analysis data alongside the indexed array - -- at this moment only the real reference page is analysed + -- at this moment only the real reference page is analyzed -- normally such an analysis happens in the backend code - texcount.referencepagestate = 0 local nofactions = #actions if nofactions > 0 then for i=1,nofactions do @@ -1165,43 +1424,53 @@ function jobreferences.analyse(actions) what = what(a,actions) end end - local realpage, p = texcount.realpageno, tonumber(actions.realpage) - if not p then - -- sorry - elseif p > realpage then - texcount.referencepagestate = 3 - elseif p < realpage then - texcount.referencepagestate = 2 - else - texcount.referencepagestate = 1 - end + texcount.referencepagestate = checkedpagestate(actions.n,actions.realpage) + else + texcount.referencepagestate = 0 end end return actions end -function jobreferences.realpage() -- special case, we always want result - local cs = jobreferences.analyse() - texwrite(cs.realpage or 0) +function references.realpage() -- special case, we always want result + local cs = references.analyze() + context(cs.realpage or 0) end +local plist + +local function realpageofpage(p) + if not plist then + local pages = structures.pages.collected + plist = { } + for rp=1,#pages do + plist[pages[rp].number] = rp + end + end + return plist[p] +end + +references.realpageofpage = realpageofpage + -- -jobreferences.pages = { - [variables.firstpage] = function() return structure.counters.record("realpage")["first"] end, - [variables.previouspage] = function() return structure.counters.record("realpage")["previous"] end, - [variables.nextpage] = function() return structure.counters.record("realpage")["next"] end, - [variables.lastpage] = function() return structure.counters.record("realpage")["last"] end, +local pages = allocate { + [variables.firstpage] = function() return counters.record("realpage")["first"] end, + [variables.previouspage] = function() return counters.record("realpage")["previous"] end, + [variables.nextpage] = function() return counters.record("realpage")["next"] end, + [variables.lastpage] = function() return counters.record("realpage")["last"] end, - [variables.firstsubpage] = function() return structure.counters.record("subpage" )["first"] end, - [variables.previoussubpage] = function() return structure.counters.record("subpage" )["previous"] end, - [variables.nextsubpage] = function() return structure.counters.record("subpage" )["next"] end, - [variables.lastsubpage] = function() return structure.counters.record("subpage" )["last"] end, + [variables.firstsubpage] = function() return counters.record("subpage" )["first"] end, + [variables.previoussubpage] = function() return counters.record("subpage" )["previous"] end, + [variables.nextsubpage] = function() return counters.record("subpage" )["next"] end, + [variables.lastsubpage] = function() return counters.record("subpage" )["last"] end, - [variables.forward] = function() return structure.counters.record("realpage")["forward"] end, - [variables.backward] = function() return structure.counters.record("realpage")["backward"] end, + [variables.forward] = function() return counters.record("realpage")["forward"] end, + [variables.backward] = function() return counters.record("realpage")["backward"] end, } +references.pages = pages + -- maybe some day i will merge this in the backend code with a testmode (so each -- runner then implements a branch) @@ -1220,10 +1489,10 @@ end runners["special operation"] = runners["special"] runners["special operation with arguments"] = runners["special"] -local pages = jobreferences.pages +-- weird, why is this code here and in lpdf-ano function specials.internal(var,actions) - local v = jobreferences.internals[tonumber(var.operation)] + local v = references.internals[tonumber(var.operation)] local r = v and v.references.realpage if r then actions.realpage = r @@ -1232,12 +1501,32 @@ end specials.i = specials.internal -function specials.page(var,actions) -- is this ok? - local p = pages[var.operation] +function specials.page(var,actions) + local o = var.operation + local p = pages[o] if type(p) == "function" then p = p() + else + p = tonumber(realpageofpage(tonumber(o))) + end + if p then + var.r = p + actions.realpage = actions.realpage or p -- first wins end +end + +function specials.realpage(var,actions) + local p = tonumber(var.operation) + if p then + var.r = p + actions.realpage = actions.realpage or p -- first wins + end +end + +function specials.userpage(var,actions) + local p = tonumber(realpageofpage(var.operation)) if p then - actions.realpage = p + var.r = p + actions.realpage = actions.realpage or p -- first wins end end diff --git a/Master/texmf-dist/tex/context/base/strc-ref.mkii b/Master/texmf-dist/tex/context/base/strc-ref.mkii index 1df5d09d826..4550f714430 100644 --- a/Master/texmf-dist/tex/context/base/strc-ref.mkii +++ b/Master/texmf-dist/tex/context/base/strc-ref.mkii @@ -44,22 +44,6 @@ \unprotect -% messages moved - -% messages moved - -% messages moved - -% messages moved - -% messages moved - -% messages moved - -% messages moved - -% messages moved - %D This module deals with referencing. In \CONTEXT\ referencing %D is one of the core features, although at a first glance %D probably nobody will notice. This is good, because @@ -786,7 +770,7 @@ %D \starttyping %D \pagereference[important] %D \pagereference[unimportant] -%D \setupreferencing[prefixprefix=sidetrack] +%D \setupreferencing[prefix=sidetrack] %D \pagereference[important] %D \stoptyping %D diff --git a/Master/texmf-dist/tex/context/base/strc-ref.mkiv b/Master/texmf-dist/tex/context/base/strc-ref.mkiv index 8290a1b1380..bec96e05c23 100644 --- a/Master/texmf-dist/tex/context/base/strc-ref.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-ref.mkiv @@ -112,16 +112,28 @@ \newcount\lastreferenceattribute \newcount\lastdestinationattribute -\def\dofinishfullreference#1#2{\normalexpanded{\ctxlatelua{jobreferences.enhance("#1","#2")}}} -\def\dofinishtextreference#1#2{\normalexpanded{\ctxlatelua{jobreferences.enhance("#1","#2",{})}}} +\def\dofinishfullreference#1#2{\normalexpanded{\ctxlatelua{structures.references.enhance("#1","#2")}}} +\def\dofinishtextreference#1#2{\normalexpanded{\ctxlatelua{structures.references.enhance("#1","#2",{})}}} \let\dofinishpagereference\dofinishfullreference \let\dofinishuserreference\dofinishfullreference -\def\dodosetreference#1#2#3#4% kind labels userdata text -> todo: userdata +\def\dofinishsomereference#1{\executeifdefined{dofinish#1reference}\gobbletwoarguments} + +\def\dodosetreference + {\ifreferencing + \expandafter\dododosetreference + \else + \expandafter\gobblefourarguments + \fi} + +\def\dododosetreference#1#2#3#4% kind labels userdata text -> todo: userdata {\ifreferencing + % we could have a more efficient one for page references but for the moment + % we don't care too much \edef\currentreferencekind{#1}% \edef\currentreferencelabels{#2}% + \edef\currentreferenceuserdata{#3}% \edef\currentreferenceexpansion{\@@rfexpansion}% {\referenceparameter\c!expansion} \ifx\currentreferencelabels\empty \else \ifx\currentreferenceexpansion\s!xml @@ -137,36 +149,69 @@ \fi \globallet\currentreferencecoding\s!tex \fi - % beware, the jobreferences.set writes a + % beware, the structures.references.set writes a % \setnextinternalreference - \ctxlua{jobreferences.setandgetattribute("\currentreferencekind", "\referenceprefix","\currentreferencelabels", + \ctxlua{structures.references.setandgetattribute("\currentreferencekind", "\referenceprefix","\currentreferencelabels", { references = { % internal = \nextinternalreference, % no need for an internal as we have an explicit block = "\currentstructureblock", - section = structure.sections.currentid(), + section = structures.sections.currentid(), }, - metadata = { - kind = "#1", - catcodes = \the\catcodetable, - xmlroot = \ifx\currentreferencecoding\s!xml "\xmldocument" \else nil \fi, % only useful when text + metadata = { % we could assume page to have no metadata + kind = "#1", + \ifx\currentreferencekind\s!page\else + catcodes = \the\catcodetable, + xmlroot = \ifx\currentreferencecoding\s!xml "\xmldocument" \else nil \fi, % only useful when text + \fi }, \ifx\currentreferencedata\empty\else entries = { text = \!!bs\currentreferencedata\!!es }, \fi - userdata = structure.helpers.touserdata(\!!bs\detokenize{#3}\!!es) - },"\@@iafocus") + \ifx\currentreferenceuserdata\empty\else + userdata = structures.helpers.touserdata(\!!bs\detokenize{#3}\!!es) + \fi + },"\interactionparameter\c!focus") }% + % todo: optional \xdef\currentdestinationattribute{\number\lastdestinationattribute}% - \begingroup\attribute\destinationattribute\currentdestinationattribute\hbox{}\endgroup % todo + \begingroup\attribute\destinationattribute\currentdestinationattribute\emptyhbox\endgroup % todo \fi \fi} \def\defaultreferencepage#1{[[[#1]]]} \def\defaultreferencetext#1{[[[#1]]]} +%D For internal usage: + +\def\dosetsimplepagereference#1% label + {\iflocation + \ctxlua{structures.references.setandgetattribute("\s!page", "\referenceprefix","#1", + { + references = { + % block = "\currentstructureblock", + % section = structures.sections.currentid(), + }, + metadata = { % we could assume page to have no metadata + kind = "\s!page", + }, + },"\interactionparameter\c!focus") + }% + \xdef\currentdestinationattribute{\number\lastdestinationattribute}% + \else + \xdef\currentdestinationattribute{\number\attributeunsetvalue}% + \fi} + +\def\dogetsimplepagereference#1% + {\iflocation + \ctxlua{structures.references.inject("\referenceprefix","#1",\number\ht\strutbox,\number\dp\strutbox,\extrareferencearguments)}% + \xdef\currentreferenceattribute{\number\lastreferenceattribute}% + \else + \xdef\currentreferenceattribute{\number\attributeunsetvalue}% + \fi} + %D These macros depend on three other ones, %D \type {\makesectionformat}, that generated \type %D {\sectionformat}, \type {\pagenumber}. The not yet used @@ -213,7 +258,7 @@ %D \stoptabulate \def\usereferences[#1]% not yet - {\writestatus\m!systems{references from other files are handled automatically}} + {\writestatus\m!system{references from other files are handled automatically}} %D As mentioned we will also use the cross reference mechanism %D for navigational purposes. The main reason for this is that @@ -371,13 +416,13 @@ {\dodoubleempty\dodefinereference} \def\dodefinereference[#1][#2]% - {\ctxlua{jobreferences.define("\referenceprefix","#1",\!!bs\detokenize{#2}\!!es)}} + {\ctxlua{structures.references.define("\referenceprefix","#1",\!!bs\detokenize{#2}\!!es)}} \def\resetreference[#1]% - {\ctxlua{jobreferences.reset("\referenceprefix","#1")}} + {\ctxlua{structures.references.reset("\referenceprefix","#1")}} \def\setpagereference#1#2% name, specification - {\ctxlua{jobreferences.define("","#1",\!!bs\v!page(\luaescapestring{#2})\!!es)}} + {\ctxlua{structures.references.define("","#1",\!!bs\v!page(\luaescapestring{#2})\!!es)}} %D Chained references are defined as: %D @@ -407,10 +452,13 @@ \newconditional\gotonewwindow \setfalse\gotonewwindow \def\expandtexincurrentreference % will happen in lua some time - {\ifcase\referencehastexstate\else\ctxlua{jobreferences.expandcurrent()}\fi} + {\ifcase\referencehastexstate\else\ctxlua{structures.references.expandcurrent()}\fi} + +\def\expandreferenceoperation#1#2{\ctxcommand{setreferenceoperation(#1,\!!bs#2\!!es)}} +\def\expandreferencearguments#1#2{\ctxcommand{setreferencearguments(#1,\!!bs#2\!!es)}} \def\doifreferencefoundelse#1#2#3% - {\ctxlua{jobreferences.doifelse("\referenceprefix","#1",\luaconditional\highlighthyperlinks,\luaconditional\gotonewwindow)}% + {\ctxlua{structures.references.doifelse("\referenceprefix","#1",\luaconditional\highlighthyperlinks,\luaconditional\gotonewwindow)}% {\expandtexincurrentreference#2}% {#3}} @@ -422,7 +470,7 @@ %D be called. \def\analyzecurrentreference - {\ctxlua{jobreferences.analyse()}} + {\ctxlua{structures.references.analyze()}} %D The inner case is simple. Only two cases have to be taken %D care of: @@ -446,14 +494,14 @@ %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% only once (keep track in lua) - {\ifinpagebody \else - \doifconcepttracing{\doifsomething{#2}{\inleft{\infofont\doboundtext{#2}{\dimexpr\leftmarginwidth-2em\relax}{..}->}}}% - \fi - \showmessage\m!references{#1}{[\referenceprefix][#2]}} +% \def\unknownreference#1% +% {\iftrialtypesetting \else +% \ifinpagebody \else +% \doifconcepttracing{\doifsomething{#1}{\inleft{\infofont\doboundtext{#1}{\dimexpr\leftmarginwidth-2em\relax}{..}->}}}% +% \fi +% \fi} -\def\unknownreference{\reportreferenceerror1} -\def\illegalreference{\reportreferenceerror4} +\let\unknownreference\gobbleoneargument %D When a reference is not found, we typeset a placeholder %D (two glyphs are often enough to represent the reference @@ -521,26 +569,31 @@ \newcount\locationorder \newbox \locationbox -\def\nextinternalreference {\the\locationcount} +\def\nextinternalreference {\the\locationcount} \def\nextinternalorderreference{\the\locationorder} \def\setnextinternalreference {\global\advance\locationcount\plusone} \def\setnextinternalreferences#1#2% plural - {\ctxlua{jobreferences.setnextinternal("#1","#2")}} + {\ctxlua{structures.references.setnextinternal("#1","#2")}} \def\getinternalorderreference#1#2% - {\ctxlua{jobreferences.currentorder("#1","#2")}} + {\ctxlua{structures.references.currentorder("#1","#2")}} \def\thisissomeinternal#1#2% tag reference (only for old time sake) - {\begingroup\attribute\destinationattribute\ctxlua{jobreferences.mark("#1:#2")}\hbox{}\endgroup} + {\begingroup + \ctxlua{structures.references.setinternalreference("","#1:#2")}% + \hbox attr \destinationattribute\lastdestinationattribute{}% + \endgroup} + +\newconditional\preferpagereferences \def\gotosomeinternal#1#2#3#4% - {\ifinternalnamedreferences - \directgoto{#4}[#1:#2]% - \else + {\ifconditional\preferpagereferences \directgoto{#4}[page(#3)]% + \else + \directgoto{#4}[#1:#2]% \fi} \def\gotonextinternal#1#2% @@ -587,41 +640,60 @@ %D document). By setting the \type{interaction} variable, one %D can influences the way interactive references are set. -\chardef\autocrossfilereferences=0 +\newconstant\autocrossfilereferences % not yet supported in mkiv +\newconstant\referencefilecaseswap % not yet supported in mkiv + +\newtoks \everysetupreferencing \unexpanded\def\setupreferencing {\dosingleargument\dosetupreferencing} \def\dosetupreferencing[#1]% - {\getparameters - [\??rf] - [\c!prefix=\s!unknown,#1]% + {\getparameters[\??rf][\c!prefix=\s!unknown,#1]% + \the\everysetupreferencing} + +\appendtoks \processaction [\@@rfstate] [ \v!stop=>\referencingfalse, \v!start=>\referencingtrue]% +\to \everysetupreferencing + +% \newconstant \referencecontentmode +% +% \appendtoks +% \processaction +% [\@@rfinteraction] +% [ \v!all=>\referencecontentmode\zerocount, +% \v!label=>\referencecontentmode\plusone, +% \v!text=>\referencecontentmode\plustwo, +% \v!symbol=>\referencecontentmode\plusthree]% +% \to \everysetupreferencing + +\appendtoks + \autocrossfilereferences\zerocount \processaction - [\@@rfinteraction] - [ \v!all=>\let\dowantedreference\docompletereference, - \v!label=>\let\dowantedreference\dolabelonlyreference, - \v!text=>\let\dowantedreference\dotextonlyreference, - \v!symbol=>\let\dowantedreference\dosymbolreference]% - \chardef\autocrossfilereferences\zerocount - \processaction - [\@@rfautofile] - [ \v!yes=>\chardef\autocrossfilereferences\plusone, - \v!page=>\chardef\autocrossfilereferences\plustwo]% - \chardef\referencefilecase\zerocount - \processaction[\@@rfconvertfile] - [ \v!yes=>\chardef\referencefilecase\plusone, - \v!big=>\chardef\referencefilecase\plusone, - \v!small=>\chardef\referencefilecase\plustwo]% + [\@@rfautofile] % not yet in mkiv + [ \v!yes=>\autocrossfilereferences\plusone, + \v!page=>\autocrossfilereferences\plustwo]% +\to \everysetupreferencing + +\appendtoks + \referencefilecaseswap\zerocount + \processaction[\@@rfconvertfile] % not yet in mkiv + [ \v!yes=>\referencefilecaseswap\plusone, + \v!big=>\referencefilecaseswap\plusone, + \v!small=>\referencefilecaseswap\plustwo]% +\to \everysetupreferencing + +\appendtoks \setupreferenceprefix[\@@rfprefix]% \doifelse\@@rfglobal\v!yes - {\settrue \autoglobalfilereferences} - {\setfalse\autoglobalfilereferences}} + {\settrue \autoglobalfilereferences}% + {\setfalse\autoglobalfilereferences}% +\to \everysetupreferencing -% \appendtoks\ctxlua{jobreferences.export("whatever")}\to\everystoptext +% \appendtoks\ctxlua{structures.references.export("whatever")}\to\everystoptext % \starttext % \chapter[test]{test} % test \in{IN}[more] and \in{IN}[test] or \at{AT}[more] and \at{AT}[test]\par @@ -630,7 +702,7 @@ % \stoptext \def\exportreferences - {\doif\@@rfexport\v!yes{\ctxlua{jobreferences.export()}}} + {\doif\@@rfexport\v!yes{\ctxlua{structures.references.export()}}} \appendtoks \exportreferences @@ -700,7 +772,7 @@ {\ifsecondargument \doifreferencefoundelse{#2} {\executeifdefined{reftype#1}\reftypep} - {\unknownreference{#2}\dummyreference}% + {\dummyreference}% \else \dummyreference \fi} @@ -761,14 +833,14 @@ % \definecommand from {\dospecialfrom} % \definecommand over {\dospecialabout} % needed here, else math problems -\def\currentreferencenumber {\ctxlua{jobreferences.filter("number")}} -\def\currentreferencepage {\ctxlua{jobreferences.filter("page")}} -\def\currentreferencetitle {\ctxlua{jobreferences.filter("title")}} -\def\currentreferencetext {\ctxlua{jobreferences.filter("text")}} -\def\currentreferencedefault {\ctxlua{jobreferences.filter("default")}} -\def\currentreferencerealpage{\ctxlua{jobreferences.realpage()}} +\def\currentreferencenumber {\ctxlua{structures.references.filter("number")}} +\def\currentreferencepage {\ctxlua{structures.references.filter("page")}} +\def\currentreferencetitle {\ctxlua{structures.references.filter("title")}} +\def\currentreferencetext {\ctxlua{structures.references.filter("text")}} +\def\currentreferencedefault {\ctxlua{structures.references.filter("default")}} +\def\currentreferencerealpage{\ctxlua{structures.references.realpage()}} -\def\getreferenceentry#1{\ctxlua{jobreferences.filter("#1")}} % user entry +\def\getreferenceentry#1{\ctxlua{structures.references.filter("#1")}} % user entry \unexpanded\def\dospecialabout[#1]% {\dontleavehmode @@ -799,12 +871,12 @@ % Yet untested: \unexpanded\def\somewhere#1#2#3[#4]% #3 gobbles space around #2 % todo - {\doifreferencefoundelse{#4}% kind of inefficient as \goto also analyses + {\doifreferencefoundelse{#4}% kind of inefficient as \goto also analyzes {\goto{\analyzecurrentreference\ifcase\referencepagestate\relax#1/#2\or#2\or#1\or#2\fi}[#4]} {[#1/#2]}} \unexpanded\def\atpage[#1]% todo - {\doifreferencefoundelse{#1}% kind of inefficient as \goto also analyses + {\doifreferencefoundelse{#1}% kind of inefficient as \goto also analyzes {\goto{\analyzecurrentreference\ifcase\referencepagestate \labeltexts\v!page\dummyreference \or @@ -822,7 +894,7 @@ \unexpanded\def\referencesymbol {\hbox{\strut\high - {\setupsymbolset[\@@iasymbolset]% + {\setupsymbolset[\interactionparameter\c!symbolset]% \symbol [\ifcase\referencepagestate \v!somewhere @@ -834,49 +906,99 @@ \v!next% \fi]}}} -% \def\dosymbolreference#1#2[#3]% -% {\removeunwantedspaces -% \goto{\setupsymbolset[\@@iasymbolset]\high{\symbol -% [\ifcase\referencepagestate -% \v!somewhere -% \or % same -% \v!nowhere -% \or % before -% \v!previous -% \or % after -% \v!next% -% \fi]}}[#3]} +%D The other alternatives just conform their names: only the +%D label, only the text, or the label and the text. -\def\dosymbolreference#1#2[#3]% - {\removeunwantedspaces - \goto{\referencesymbol}[#3]} +% \dounknownreference -> \dummyreference -\def\symbolreference[#1]% - {\removeunwantedspaces - \goto{\referencesymbol}[#1]} +\def\symbolreference[#1]% for old times sake + {\goto{\referencesymbol}[#1]} +% \referencecontentmode 0=all 1=label 2=text 3=symbol -%D The other alternatives just conform their names: only the -%D label, only the text, or the label and the text. +\newtoks\leftreferencetoks +\newtoks\rightreferencetoks +\newtoks\defaultleftreferencetoks +\newtoks\defaultrightreferencetoks + +\def\leftofreferencecontent {\nobreakspace} % we cannot do \definereferenceformat[at] .. so we need this +\let\rightofreferencecontent \empty +\let\leftofreference \empty +\let\rightofreference \empty + +\setvalue{\??rf\c!interaction\v!all}% + {\leftofreference + \the\leftreferencetoks + \doifsometokselse\leftreferencetoks \leftofreferencecontent \donothing + \currentreferencecontent + \doifsometokselse\rightreferencetoks\rightofreferencecontent\donothing + \the\rightreferencetoks + \rightofreference} + +\setvalue{\??rf\c!interaction\v!label}% + {\leftofreference + \the\leftreferencetoks + \the\rightreferencetoks + \rightofreference} + +\setvalue{\??rf\c!interaction\v!text}% + {\leftofreference + \currentreferencecontent + \rightofreference} + +\setvalue{\??rf\c!interaction\v!symbol}% + {\referencesymbol} + +\def\referencesequence + {\csname \??rf\c!interaction + \ifcsname\??rf\c!interaction\@@rfinteraction\endcsname + \@@rfinteraction + \else + \v!all + \fi + \endcsname} -\def\dounknownreference#1#2[#3]% - {\unknownreference{#3}\dotextprefix{#2}\dummyreference}% +\newtoks\everyresetinatreference -\def\docompletereference#1#2[#3]% - {\goto{\dotextprefix{#2}#1}[#3]} +\appendtoks + \glet\leftofreference \relax + \glet\rightofreference\relax +\to \everyresetinatreference + +\def\dostartgotoreference + {\dontleavehmode + \begingroup} -% \def\dolabelonlyreference#1#2[#3]% -% {\doifsomespaceelse{#2}% space? -% {\doifsomething{#2}{\goto{#2}[#3]}} -% {\goto{\dotextprefix{#2}}[#3]}} +\def\dostopgotoreference + {\the\everyresetinatreference + \endgroup} -\def\dolabelonlyreference#1#2[#3]% - {\goto{\dotextprefix{#2}}[#3]} +\def\dopickupgotoreference + {\dodoublegroupempty\dodopickupgotoreference} -\def\dotextonlyreference#1#2[#3]% - {\dotextprefix{#2}\goto{#1}[#3]} +\def\dodopickupgotoreference#1#2#3[#4]% #3 gobbles spaces (really needed) + {\leftreferencetoks + \iffirstargument + {#1}% + \else + \defaultleftreferencetoks + \let\leftofreferencecontent\empty + \fi + \rightreferencetoks + \ifsecondargument + {#2}% + \else + \defaultrightreferencetoks + \let\rightofreferencecontent\empty + \fi + \doifreferencefoundelse{#4} % we need to resolve the text + {\goto{\referencesequence}[#4]} + {\let\currentreferencecontent\dummyreference + \goto{\referencesequence}[#4]}% + \dostopgotoreference} -\let\dowantedreference\docompletereference +\unexpanded\def\dospecialin{\dostartgotoreference\let\currentreferencecontent\currentreferencedefault\dopickupgotoreference} +\unexpanded\def\dospecialat{\dostartgotoreference\let\currentreferencecontent\currentreferencepage \dopickupgotoreference} %D \macros %D {definereferenceformat} @@ -885,8 +1007,6 @@ %D Hoekwater. They can be used for predefining reference %D texts, and thereby stimulate efficiency. %D -%D [more documentation will be added] -%D %D \starttyping %D \definereferenceformat[informula] [left=(,right=),text=formula] %D \definereferenceformat[informulas] [left=(,right=),text=formulas] @@ -902,61 +1022,83 @@ %D %D Instead of a text, one can specify a label, which should %D be defined with \type {\setuplabeltext}. +%D +%D +%D Watch out: the second argument is somewhat special and mostly +%D meant for a suffix to a number: +%D +%D \startbuffer +%D \definereferenceformat [intesta] [left=(,right=),text=Whatever~] +%D \definereferenceformat [intestb] [left=(,right=),label=figure] +%D +%D \placeformula[x]\startformula a \stopformula +%D +%D \starttabulate[|||||] +%D \NC \in [x] \NC \in {left}[x] \NC \in {}{right}[x] \NC \in {left}{right}[x] \NC \NR +%D \NC \intesta[x] \NC \intesta{left}[x] \NC \intesta{}{right}[x] \NC \intesta{left}{right}[x] \NC \NR +%D \NC \intestb[x] \NC \intestb{left}[x] \NC \intestb{}{right}[x] \NC \intestb{left}{right}[x] \NC \NR +%D \stoptabulate +%D \stopbuffer +%D +%D \typebuffer \getbuffer + +% todo: inherit -% todo: inherit; probably not yet mkiv okay +\let\currentreferenceformat\empty + +\def\referenceformatparameter#1% some day we will add inheritance + {\ifcsname\??rf\currentreferenceformat#1\endcsname\csname\??rf\currentreferenceformat#1\expandafter\endcsname\fi} \unexpanded\def\definereferenceformat {\dodoubleargument\dodefinereferenceformat} +% left right text label + \def\dodefinereferenceformat[#1][#2]% {\iffirstargument - \getparameters[\??rf#1] - [\c!left=, % of the number - \c!right=, % of the number - \c!text=, % before the number - \c!label=, % can be {left}{right} - \c!command=\in, - #2]% - \setuvalue{#1}% - {\dontleavehmode\doexecutereferenceformat{#1}}% + \getparameters[\??rf#1][\c!left=,\c!right=,\c!text=,\c!label=,\c!autocase=v!no,#2]% + \setuvalue{#1}{\doexecutereferenceformat{#1}}% \fi} -\def\noexecutelabelreferenceformat#1% - {\doifvaluesomething{\??rf#1\c!text}{\gdef\textofreference{\csname\??rf#1\c!text\endcsname}}% - \csname\??rf#1\c!command\endcsname} - -\def\doexecutelabelreferenceformat#1% - {\csname\??rf#1\c!command\endcsname - {\leftlabeltext {\csname\??rf#1\c!label\endcsname}}% - {\rightlabeltext{\csname\??rf#1\c!label\endcsname}}} - -\def\doexecutereferenceformat#1% - {\gdef\leftofreference {\csname\??rf#1\c!left \endcsname}% - \gdef\rightofreference{\csname\??rf#1\c!right\endcsname}% - \global\let\textofreference\empty % otherwise ~ added - \doifelsevaluenothing{\??rf#1\c!label}\noexecutelabelreferenceformat\doexecutelabelreferenceformat{#1}} +\def\doexecutereferenceformat#1% quite slow due to all assignments but we will speed it up + {\dostartgotoreference % once it's stable + \edef\currentreferenceformat{#1}% + \gdef\leftofreference {\referenceformatparameter\c!left }% + \gdef\rightofreference{\referenceformatparameter\c!right}% + % we can make a helper for this .. we will use the new parameter handler anyway + % but at least aditya can play with it now + \doifsomething{\referenceformatparameter\c!style} + {\dosetfontattribute{\??rf\currentreferenceformat}\c!style + \resetinteractionparameter\c!style}% + \doifsomething{\referenceformatparameter\c!color} + {\dosetcolorattribute{\??rf\currentreferenceformat}\c!color + \resetinteractionparameter\c!contrastcolor + \resetinteractionparameter\c!color}% + % + \edef\currentreferenceformatlabel{\referenceformatparameter\c!label}% + \ifx\currentreferenceformatlabel\autoreferencelabeltextflag + \edef\currentreferenceformatlabel{\autoreferencelabeltext}% + \fi + \doif{\referenceformatparameter\c!autocase}\v!yes + {\setcharactercleaning[1]}% + \ifx\currentreferenceformatlabel\empty + \defaultleftreferencetoks {\referenceformatparameter\c!text}% + \defaultrightreferencetoks\emptytoks + \else + \defaultleftreferencetoks {\leftlabeltext \currentreferenceformatlabel}% + \defaultrightreferencetoks{\rightlabeltext\currentreferenceformatlabel}% + \fi + \doifelse{\referenceformatparameter\c!type}\v!page + {\let\currentreferencecontent\currentreferencepage} + {\let\currentreferencecontent\currentreferencedefault}% + \let\leftofreferencecontent \empty + \let\rightofreferencecontent\empty + \dopickupgotoreference} -\let\leftofreference \relax -\let\rightofreference\relax -\let\textofreference \relax +\def\autoreferencelabeltextflag{*} % a proper key like 'auto' or 'name' can clash with a label key -% fails on metafun {\leftofreference#1\ignorespaces#3\removeunwantedspaces\rightofreference}{#2}[#4]% -% -% \def\dodododoinatreference#1#2#3[#4]% no \removeunwantedspaces (fails on metafun) -% {\ifx\next\bgroup -% \dododododoinatreference{\leftofreference#1\ignorespaces#3\rightofreference}{#2}[#4]% -% \else -% \dododododoinatreference{\leftofreference#1\rightofreference}{#2#3}[#4]% -% \fi} -% -% \def\dododododoinatreference#1#2[#3]% -% {\dontleavehmode % replaces \leaveoutervmode -% \begingroup -% \postponenotes -% \doifreferencefoundelse{#3} -% {\doifelsenothing{#1}\dosymbolreference\dowantedreference{#1}{#2}[#3]}% -% {\dounknownreference{#1}{#2}[#3]}% -% \endgroup} +\unexpanded\def\autoreferencelabeltext + {\ctxlua{structures.references.getcurrentmetadata("name")}} % \starttext % \definereferenceformat[inxx] [left=(,right=),text=txt] @@ -970,62 +1112,6 @@ % [\inxx{a}{b}[one]] % \stoptext -\unexpanded\def\dospecialin{\let\currentreferencecontent\currentreferencedefault\doinatreference} -\unexpanded\def\dospecialat{\let\currentreferencecontent\currentreferencepage \doinatreference} - -\newtoks\leftreferencetoks -\newtoks\rightreferencetoks - -\def\doinatreference - {\futurelet\next\doinatreferenceone} - -\def\doinatreferenceone - {\ifx\next\bgroup - \afterassignment\doinatreferenceonetwo - \expandafter\leftreferencetoks - \else - \leftreferencetoks\emptytoks - \expandafter\dodoinatreferencenone - \fi} - -\def\doinatreferenceonetwo - {\futurelet\next\doinatreferencetwo} - -\def\doinatreferencetwo - {\ifx\next\bgroup - \afterassignment\dodoinatreferenceboth - \expandafter\rightreferencetoks - \else - \rightreferencetoks\emptytoks - \expandafter\dodoinatreferenceleft - \fi} - -\def\dodoinatreferencenone - {\dodoinatreferenceindeed - {\leftofreference\currentreferencecontent\rightofreference} - {}} - -\def\dodoinatreferenceleft - {\dodoinatreferenceindeed - {\leftofreference\currentreferencecontent\rightofreference} - {\the\leftreferencetoks}} - -\def\dodoinatreferenceboth - {\dodoinatreferenceindeed - {\leftofreference\currentreferencecontent\the\rightreferencetoks\rightofreference} - {\the\leftreferencetoks}} - -\def\dodoinatreferenceindeed#1#2#3[#4]% #3 gobbles space - {\dontleavehmode % replaces \leaveoutervmode - \begingroup - \postponenotes - \doifreferencefoundelse{#4} - {\doifelsenothing{#1}\dosymbolreference\dowantedreference{#1}{#2}[#4]}% - {\dounknownreference{#1}{#2}[#4]}% - \endgroup} - -\let\dosymbolreference\dowantedreference - %D In interactive documents going to a specific location is not %D bound to cross references. The \type{\goto} commands can be %D used to let users access another part of the document. In @@ -1058,74 +1144,107 @@ % The unbox trick is needed in order to permit \par inside a reference. Otherwise % the reference attribute migrates to the outer boxes. +\newcount\lastsavedreferenceattribute + \newbox\referencebox +\def\revivesavedreferenceattribute % sometimes handy as no test etc needed + {\attribute\referenceattribute\lastsavedreferenceattribute} + \def\dodirectgoto#1[#2]% no test for valid references {\dontleavehmode \begingroup \attribute\referenceattribute\attributeunsetvalue + \global\lastsavedreferenceattribute\attributeunsetvalue \iflocation - \ctxlua{jobreferences.inject("\referenceprefix","#2",\number\ht\strutbox,\number\dp\strutbox,\extrareferencearguments)}% + \ctxlua{structures.references.inject("\referenceprefix","#2",\number\ht\strutbox,\number\dp\strutbox,\extrareferencearguments)}% \setlocationattributes\??ia \setstrut % can be option + \global\lastsavedreferenceattribute\lastreferenceattribute \attribute\referenceattribute\lastreferenceattribute + \dostarttagged\t!link\empty % not here + #1% + \dostoptagged + \else + #1% \fi - #1% \endgroup} \def\dodirectgotohtdp#1[#2]% no test for valid references {\dontleavehmode \begingroup + \global\lastsavedreferenceattribute\attributeunsetvalue \attribute\referenceattribute\attributeunsetvalue \iflocation - \ctxlua{jobreferences.inject("\referenceprefix","#2",\number\dimexpr\@@iaheight\relax,\number\dimexpr\@@iadepth\relax,\extrareferencearguments)}% + \ctxlua{structures.references.inject("\referenceprefix","#2",\number\dimexpr\interactionparameter\c!height\relax,\number\dimexpr\interactionparameter\c!depth\relax,\extrareferencearguments)}% \setlocationattributes\??ia \attribute\referenceattribute\lastreferenceattribute + \global\lastsavedreferenceattribute\lastreferenceattribute + \dostarttagged\t!link\empty + #1% + \dostoptagged + \else + #1% \fi - #1% \endgroup} \def\dogoto#1#2[#3]% #2 gobbles spaces after #1 so that \goto{xx} [yy] works ok {\dontleavehmode \begingroup %\setbox\referencebox\hbox\bgroup % experiment, might change again to non \par support + \global\lastsavedreferenceattribute\attributeunsetvalue \attribute\referenceattribute\attributeunsetvalue \iflocation - \ctxlua{jobreferences.doifelse("\referenceprefix","#3",\extrareferencearguments)}% + \ctxlua{structures.references.doifelse("\referenceprefix","#3",\extrareferencearguments)}% {\expandtexincurrentreference - \ctxlua{jobreferences.injectcurrentset(\number\ht\strutbox,\number\dp\strutbox)}% + \ctxlua{structures.references.injectcurrentset(\number\ht\strutbox,\number\dp\strutbox)}% \setlocationattributes\??ia \setstrut % can be option - \attribute\referenceattribute\lastreferenceattribute}% - {\unknownreference{#3}}% + \global\lastsavedreferenceattribute\lastreferenceattribute + \attribute\referenceattribute\lastreferenceattribute + \dostarttagged\t!link\empty + #1% + \dostoptagged}% + {#1}% + \else + #1% \fi - #1% %\egroup\unhbox\referencebox} \endgroup} \def\dogotohtdp#1#2[#3]% #2 gobbles spaces after #1 so that \goto{xx} [yy] works ok {\dontleavehmode \begingroup + \global\lastsavedreferenceattribute\attributeunsetvalue \attribute\referenceattribute\attributeunsetvalue \iflocation - \ctxlua{jobreferences.doifelse("\referenceprefix","#3",\extrareferencearguments)}% + \ctxlua{structures.references.doifelse("\referenceprefix","#3",\extrareferencearguments)}% {\expandtexincurrentreference - \ctxlua{jobreferences.injectcurrentset(\number\dimexpr\@@iaheight\relax,\number\dimexpr\@@iadepth\relax)}% + \ctxlua{structures.references.injectcurrentset(\number\dimexpr\interactionparameter\c!height\relax,\number\dimexpr\interactionparameter\c!depth\relax)}% \setlocationattributes\??ia - \attribute\referenceattribute\lastreferenceattribute}% - {\unknownreference{#3}}% + \global\lastsavedreferenceattribute\lastreferenceattribute + \attribute\referenceattribute\lastreferenceattribute + \dostarttagged\t!link\empty + #1% + \dostoptagged}% + {#1}% + \else + #1% \fi - #1% \endgroup} \unexpanded\def\directgotobox#1[#2]% no test for valid references {\dontleavehmode \begingroup + \global\lastsavedreferenceattribute\attributeunsetvalue \attribute\referenceattribute\attributeunsetvalue \iflocation - \ctxlua{jobreferences.inject("\referenceprefix","#2",nil,nil,\extrareferencearguments)}% + \ctxlua{structures.references.inject("\referenceprefix","#2",nil,nil,\extrareferencearguments)}% \setlocationattributes\??ia + \global\lastsavedreferenceattribute\lastreferenceattribute + \dostarttagged\t!link\empty \hbox attr \referenceattribute \lastreferenceattribute {#1}% + \dostoptagged \else #1% \fi @@ -1134,11 +1253,15 @@ \unexpanded\def\directgotospecbox#1#2[#3]% no test for valid references {\dontleavehmode \begingroup + \global\lastsavedreferenceattribute\attributeunsetvalue \attribute\referenceattribute\attributeunsetvalue \iflocation - \ctxlua{jobreferences.inject("\referenceprefix","#3",nil,nil,\extrareferencearguments)}% + \ctxlua{structures.references.inject("\referenceprefix","#3",nil,nil,\extrareferencearguments)}% \setlocationcolorspec{#1}% no consequence for strut + \global\lastsavedreferenceattribute\lastreferenceattribute + \dostarttagged\t!link\empty \hbox attr \referenceattribute \lastreferenceattribute {#2}% + \dostoptagged \else #2% \fi @@ -1147,10 +1270,14 @@ \unexpanded\def\directgotodumbbox#1[#2]% no test for valid references {\dontleavehmode \begingroup + \global\lastsavedreferenceattribute\attributeunsetvalue \attribute\referenceattribute\attributeunsetvalue \iflocation - \ctxlua{jobreferences.inject("\referenceprefix","#2",nil,nil,\extrareferencearguments)}% + \ctxlua{structures.references.inject("\referenceprefix","#2",nil,nil,\extrareferencearguments)}% + \global\lastsavedreferenceattribute\lastreferenceattribute + \dostarttagged\t!link\empty \hbox attr \referenceattribute \lastreferenceattribute {#1}% + \dostoptagged \else #1% \fi @@ -1159,19 +1286,36 @@ \unexpanded\def\gotobox#1[#2]% no test for valid references {\dontleavehmode \begingroup + \global\lastsavedreferenceattribute\attributeunsetvalue \attribute\referenceattribute\attributeunsetvalue \iflocation - \ctxlua{jobreferences.doifelse("\referenceprefix","#2",\extrareferencearguments)}% + \ctxlua{structures.references.doifelse("\referenceprefix","#2",\extrareferencearguments)}% {\expandtexincurrentreference - \ctxlua{jobreferences.injectcurrentset(nil,nil)}% + \ctxlua{structures.references.injectcurrentset(nil,nil)}% \setlocationattributes\??ia - \hbox attr \referenceattribute \lastreferenceattribute {#1}}% - {\unknownreference{#2}}% + \global\lastsavedreferenceattribute\lastreferenceattribute + \dostarttagged\t!link\empty + \hbox attr \referenceattribute \lastreferenceattribute {#1}% + \dostoptagged}% + {#1}% \else #1% \fi \endgroup} - + +\unexpanded\def\gotowdhtbox#1#2[#3]% fast variant for overlays + {\dontleavehmode + \begingroup + \setbox\scratchbox\emptyhbox\wd\scratchbox#1\ht\scratchbox#2% + \global\lastsavedreferenceattribute\attributeunsetvalue + \attribute\referenceattribute\attributeunsetvalue + \ctxlua{structures.references.doifelse("\referenceprefix","#3",\extrareferencearguments)}% + {\ctxlua{structures.references.injectcurrentset(nil,nil)}% + \global\lastsavedreferenceattribute\lastreferenceattribute + \hbox attr \referenceattribute \lastreferenceattribute {\box\scratchbox}} + {\box\scratchbox}% + \endgroup} + %D An reference to another document can be specified as a file %D or as an \URL. Both are handled by the same mechanism and %D can be issued by saying something like: @@ -1228,13 +1372,13 @@ \let\useexternaldocument\usefile \def\douseurl[#1][#2][#3][#4]% - {\ctxlua{jobreferences.urls.define("#1",\!!bs\detokenize{#2}\!!es,\!!bs\detokenize{#3}\!!es,\!!bs\detokenize{#4}\!!es)}} + {\ctxlua{structures.references.urls.define("#1",\!!bs\detokenize{#2}\!!es,\!!bs\detokenize{#3}\!!es,\!!bs\detokenize{#4}\!!es)}} \def\dousefile[#1][#2][#3]% - {\ctxlua{jobreferences.files.define("#1",\!!bs\detokenize{#2}\!!es,\!!bs\detokenize{#3}\!!es)}} + {\ctxlua{structures.references.files.define("#1",\!!bs\detokenize{#2}\!!es,\!!bs\detokenize{#3}\!!es)}} -\def\doifurldefinedelse #1{\ctxlua{commands.doifurldefinedelse ("#1")}} -\def\doiffiledefinedelse#1{\ctxlua{commands.doiffiledefinedelse("#1")}} +\def\doifurldefinedelse #1{\ctxcommand{doifurldefinedelse ("#1")}} +\def\doiffiledefinedelse#1{\ctxcommand{doiffiledefinedelse("#1")}} %D \macros %D {url,setupurl} @@ -1261,7 +1405,7 @@ \begingroup \dosetfontattribute\??ur\c!style \dosetcolorattribute\??ur\c!color - \hyphenatedurl{\ctxlua{jobreferences.urls.get("#1","\@@uralternative","\@@urspace")}}% + \hyphenatedurl{\ctxlua{structures.references.urls.get("#1","\@@uralternative","\@@urspace")}}% \endgroup} % # fails @@ -1311,7 +1455,7 @@ \def\dodospecialfrom[#1]% {\dontleavehmode - \goto{\ctxlua{jobreferences.from("#1")}}[fileorurl(#1)]} + \goto{\ctxlua{structures.references.from("#1")}}[fileorurl(#1)]} \def\dofromurldescription#1% {#1} @@ -1356,14 +1500,14 @@ {\dotripleargument\dodefineprogram} \def\dodefineprogram[#1][#2][#3]% - {\ctxlua{jobreferences.programs.define("#1","#2","#3")}} + {\ctxlua{structures.references.programs.define("#1","#2","#3")}} \def\program[#1]% incompatible, more consistent, hardy used anyway {\dontleavehmode \begingroup \dosetfontattribute\??pr\c!style \dosetcolorattribute\??pr\c!color - \ctxlua{jobreferences.programs.get("#1","\@@pralternative","\@@prspace")}% + \ctxlua{structures.references.programs.get("#1","\@@pralternative","\@@prspace")}% \endgroup} %D As we can see, we directly use the special reference @@ -1449,8 +1593,6 @@ %D key \type{file}, which is interpreted as the file to jump %D to, that is, when one clicks on the title. -\newif\ifautocrossdocument - \def\coupledocument {\doquadrupleempty\docoupledocument} @@ -1459,185 +1601,6 @@ % this will be done differently (when it's needed) \fi} -%D Buttons are just what their names says: things that can be -%D clicked (pushed) on. They are similar to \type{\goto}, -%D except that the text argument is not interpreted. -%D Furthermore one can apply anything to them that can be done -%D with \type{\framed}. -%D -%D \startbuffer -%D \button[width=3cm,height=1.5cm]{Exit}[ExitViewer] -%D \stopbuffer -%D -%D \typebuffer -%D -%D gives -%D -%D \getbuffer -%D -%D This command is formally specified as: -%D -%D \showsetup{button} -%D -%D The characteristics can be set with: -%D -%D \showsetup{setupbuttons} - -\unexpanded\def\setupbuttons - {\dodoubleargument\getparameters[\??bt]} - -\definecomplexorsimpleempty\button - -\def\complexbutton - {\docomplexbutton\??bt} - -\presetlocalframed[\??bt] - -\long\def\docomplexbutton#1[#2]#3#4% get rid of possible space before [#4] - {\dodocomplexbutton#1[#2]{#3}#4} % #4 == [ - -\def\buttonframed{\dodoubleempty\localframed[\??bt]} % goodie - -\long\def\dodocomplexbutton#1[#2]#3[#4]% #3 can contain [] -> {#3} later - {\begingroup - \doifvalue{#1\c!state}\v!stop\locationfalse - \iflocation - \ConvertConstantAfter\doifelse{#3}\v!none\hphantom\hbox - {\doifelsenothing{#4} - {\setlocationboxnop#1[#2]{#3}[#4]} - {\doifreferencefoundelse{#4} % INEFFICIENT - {\setlocationboxyes#1[#2]{#3}[#4]} - {\unknownreference{#4}% - \setlocationboxnop#1[#2]{#3}[#4]}}}% - \fi - \endgroup} - -\setupbuttons - [\c!state=\v!start] - -%D Interaction buttons, in fact a row of tiny buttons, are -%D typically only used for navigational purposed. The next -%D macro builds such a row based on a specification list. -%D -%D \startbuffer -%D \interactionbuttons -%D [width=\hsize][page,PreviousJump,ExitViewer] -%D \stopbuffer -%D -%D \typebuffer -%D -%D gives -%D -%D \getbuffer -%D -%D Apart from individual entries, one can use \type{page} and -%D \type {subpage} as shortcuts to their four associated buttons. -%D The symbols are derived from the symbols linked to the -%D entries. - -% does not work well with for instance SomeRef{whatever} - -\def\interactionbuttons - {\dodoubleempty\dointeractionbuttons} - -\def\dointeractionbuttons[#1][#2]% er is een verdeel macro \horizontalfractions - {\iflocation - % BUG: fails when frame=off; best is to rewrite this macro - \bgroup - \doif\@@ibstate\v!stop\locationfalse - \iflocation - \ifsecondargument - \setupinteractionbar[#1]% - \checkinteractionbar{1.5em}\v!broad\!!zeropoint % brrrrr - \setbox2\hbox{\localframed[\??ib][\c!background=]{\symbol[\@@iasymbolset][\v!previouspage]}}% - \!!heighta\ht2 % needed because we default to nothing - \setupinteractionbar[\c!strut=\v!no]% - \setinteractionparameter\c!width\!!zeropoint - \!!counta\zerocount % new, was 1 - \processallactionsinset - [#2] - [ \v!page=>\advance\!!counta 4, - \v!subpage=>\advance\!!counta 4, - \s!unknown=>\advance\!!counta 1]% - \ifdim\@@ibwidth=\zeropoint - \!!widtha2em - \advance\!!widtha \@@ibdistance % new - \!!widthb\!!counta\!!widtha - \advance\!!widthb -\@@ibdistance % new - \else - \!!widtha\@@ibwidth - \!!widthb\@@ibdistance % new - \multiply\!!widthb \!!counta % new - \advance\!!widthb -\@@ibdistance % new - \advance\!!widtha -\!!widthb % new - \divide\!!widtha \!!counta - \!!widthb\@@ibwidth - \fi - \def\xgoto##1% clash ? - {\setnostrut - \edef\localreference{##1}% - \normalexpanded{\noexpand\dodocomplexbutton\??ib[\c!height=\the\!!heighta,\c!width=\the\!!widtha]}% - {\dontleavehmode\symbol[\@@iasymbolset][\localreference]}% - [\localreference]% - \hss}% - \hbox to \!!widthb - {\processallactionsinset - [#2] - [ \v!page=>\xgoto\v!firstpage - \xgoto\v!nextpage - \xgoto\v!previouspage - \xgoto\v!lastpage, - \v!subpage=>\xgoto\v!firstsubpage - \xgoto\v!nextsubpage - \xgoto\v!previoussubpage - \xgoto\v!lastsubpage, - \s!unknown=>\xgoto\commalistelement]% - \unskip}% - \else - \interactionbuttons[][#1]% - \fi - \fi - \egroup - \fi} - -%D \macros -%D {overlaybutton} -%D -%D For converience we provide: -%D -%D \starttyping -%D \overlaybutton[reference] -%D \stoptyping -%D -%D This command can be used to define overlays an/or can be -%D used in the whatevertext areas, like: -%D -%D \starttyping -%D \defineoverlay[PrevPage][\overlaybutton{PrevPage}] -%D \setupbackgrounds[page][background=PrevPage] -%D \setuptexttexts[\overlaybutton{NextPage}] -%D \stoptyping -%D -%D For practical reasons, this macro accepts square brackets -%D as well as braces. - -\definecomplexorsimple\overlaybutton - -\def\simpleoverlaybutton#1% - {\complexoverlaybutton[#1]} - -\def\complexoverlaybutton[#1]% - {\iflocation - \gotobox{\overlayfakebox}[#1]% - \fi} - -\def\overlayfakebox - {\hbox - {\setbox\scratchbox\null - \wd\scratchbox\overlaywidth - \ht\scratchbox\overlayheight - \box\scratchbox}} - %D \macros %D {dotextprefix} %D @@ -1730,7 +1693,6 @@ \definereference [\v!HideField ] [action(hide)] \definereference [\v!ShowField ] [action(show)] \definereference [\v!GotoPage ] [action(gotopage)] -\definereference [\v!GotoPage ] [action(gotopage)] \definereference [\v!Query ] [action(query)] \definereference [\v!QueryAgain ] [action(queryagain)] \definereference [\v!FitWidth ] [action(fitwidth)] @@ -1738,6 +1700,10 @@ \definereference [\v!ShowThumbs ] [action(thumbnails)] \definereference [\v!ShowBookmarks ] [action(bookmarks)] +\definereference [\v!HideLayer ] [action(hidelayer)] +\definereference [\v!VideLayer ] [action(videlayer)] +\definereference [\v!ToggleLayer ] [action(togglelayer)] + \definereference [\v!firstpage] [page(firstpage)] \definereference [\v!previouspage] [page(previouspage)] \definereference [\v!nextpage] [page(nextpage)] @@ -1817,16 +1783,16 @@ % \def\getreferencestructureprefixspec#1% we can save one call by moving this to the lua end % {\getreferencestructureprefix -% {\ctxlua{jobreferences.get_current_metadata("kind")}} -% {\ctxlua{jobreferences.get_current_metadata("name")}} +% {\ctxlua{structures.references.getcurrentmetadata("kind")}} +% {\ctxlua{structures.references.getcurrentmetadata("name")}} % {#1}} % \def\currentreferencedefault -% {\ctxlua{jobreferences.filter("default",\getreferencestructureprefixspec\v!default)}} +% {\ctxlua{structures.references.filter("default",\getreferencestructureprefixspec\v!default)}} % % this is shortcut for: \def\currentreferencedefault - {\ctxlua{jobreferences.filter("default",\ctxlua{jobreferences.get_current_prefixspec("\v!default")})}} + {\ctxlua{structures.references.filter("default",\ctxlua{structures.references.getcurrentprefixspec("\v!default")})}} \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/strc-reg.lua b/Master/texmf-dist/tex/context/base/strc-reg.lua index c5b2c93741c..c19ae12d65c 100644 --- a/Master/texmf-dist/tex/context/base/strc-reg.lua +++ b/Master/texmf-dist/tex/context/base/strc-reg.lua @@ -7,39 +7,45 @@ if not modules then modules = { } end modules ['strc-reg'] = { } local next, type = next, type -local texwrite, texsprint, texcount = tex.write, tex.sprint, tex.count -local format, gmatch, concat = string.format, string.gmatch, table.concat +local texwrite, texcount = tex.write, tex.count +local format, gmatch = string.format, string.gmatch +local equal, concat, remove = table.are_equal, table.concat, table.remove local utfchar = utf.char local lpegmatch = lpeg.match +local allocate = utilities.storage.allocate -local trace_registers = false trackers.register("structure.registers", function(v) trace_registers = v end) +local trace_registers = false trackers.register("structures.registers", function(v) trace_registers = v end) -local ctxcatcodes = tex.ctxcatcodes +local report_registers = logs.reporter("structure","registers") -local variables = interfaces.variables +local structures = structures +local registers = structures.registers +local helpers = structures.helpers +local sections = structures.sections +local documents = structures.documents +local pages = structures.pages +local processors = structures.processors +local references = structures.references -local helpers = structure.helpers -local sections = structure.sections -local documents = structure.documents -local pages = structure.pages -local processors = structure.processors - -local mappings = sorters.mappings -local entries = sorters.entries -local replacements = sorters.replacements +local mappings = sorters.mappings +local entries = sorters.entries +local replacements = sorters.replacements local processor_split = processors.split -local matching_till_depth, number_at_depth = sections.matching_till_depth, sections.number_at_depth +local variables = interfaces.variables +local context = context + +local matchingtilldepth, numberatdepth = sections.matchingtilldepth, sections.numberatdepth -- some day we will share registers and lists (although there are some conceptual -- differences in the application of keywords) -local function filter_collected(names,criterium,number,collected,prevmode) +local function filtercollected(names,criterium,number,collected,prevmode) if not criterium or criterium == "" then criterium = variables.all end local data = documents.data local numbers, depth = data.numbers, data.depth - local hash, result, all, detail = { }, { }, not names or names == "" or names == variables.all, nil + local hash, result, nofresult, all, detail = { }, { }, 0, not names or names == "" or names == variables.all, nil if not all then for s in gmatch(names,"[^, ]+") do hash[s] = true @@ -49,18 +55,20 @@ local function filter_collected(names,criterium,number,collected,prevmode) for i=1,#collected do local v = collected[i] if all then - result[#result+1] = v + nofresult = nofresult + 1 + result[nofresult] = v else local vmn = v.metadata and v.metadata.name if hash[vmn] then - result[#result+1] = v + nofresult = nofresult + 1 + result[nofresult] = v end end end elseif criterium == variables.current then for i=1,#collected do local v = collected[i] - local sectionnumber = jobsections.collected[v.references.section] + local sectionnumber = sections.collected[v.references.section] if sectionnumber then local cnumbers = sectionnumber.numbers if prevmode then @@ -73,7 +81,8 @@ local function filter_collected(names,criterium,number,collected,prevmode) end end if ok then - result[#result+1] = v + nofresult = nofresult + 1 + result[nofresult] = v end end else @@ -87,7 +96,8 @@ local function filter_collected(names,criterium,number,collected,prevmode) end end if ok then - result[#result+1] = v + nofresult = nofresult + 1 + result[nofresult] = v end end end @@ -96,7 +106,7 @@ local function filter_collected(names,criterium,number,collected,prevmode) elseif criterium == variables.previous then for i=1,#collected do local v = collected[i] - local sectionnumber = jobsections.collected[v.references.section] + local sectionnumber = sections.collected[v.references.section] if sectionnumber then local cnumbers = sectionnumber.numbers if (all or hash[v.metadata.name]) and #cnumbers >= depth then @@ -118,21 +128,22 @@ local function filter_collected(names,criterium,number,collected,prevmode) end end if ok then - result[#result+1] = v + nofresult = nofresult + 1 + result[nofresult] = v end end end end elseif criterium == variables["local"] then if sections.autodepth(data.numbers) == 0 then - return filter_collected(names,variables.all,number,collected,prevmode) + return filtercollected(names,variables.all,number,collected,prevmode) else - return filter_collected(names,variables.current,number,collected,prevmode) + return filtercollected(names,variables.current,number,collected,prevmode) end else -- sectionname, number -- beware, this works ok for registers local depth = sections.getlevel(criterium) - local number = tonumber(number) or number_at_depth(depth) or 0 + local number = tonumber(number) or numberatdepth(depth) or 0 if trace_registers then detail = format("depth: %s, number: %s, numbers: %s, startset: %s",depth,number,concat(sections.numbers(),".",1,depth),#collected) end @@ -141,13 +152,14 @@ local function filter_collected(names,criterium,number,collected,prevmode) local v = collected[i] local r = v.references if r then - local sectionnumber = jobsections.collected[r.section] + local sectionnumber = sections.collected[r.section] if sectionnumber then local metadata = v.metadata local cnumbers = sectionnumber.numbers if cnumbers then - if (all or hash[metadata.name or false]) and #cnumbers >= depth and matching_till_depth(depth,cnumbers) then - result[#result+1] = v + if (all or hash[metadata.name or false]) and #cnumbers >= depth and matchingtilldepth(depth,cnumbers) then + nofresult = nofresult + 1 + result[nofresult] = v end end end @@ -157,29 +169,29 @@ local function filter_collected(names,criterium,number,collected,prevmode) end if trace_registers then if detail then - logs.report("registers","criterium: %s, %s, found: %s",criterium,detail,#result) + report_registers("criterium: %s, %s, found: %s",criterium,detail,#result) else - logs.report("registers","criterium: %s, found: %s",criterium,#result) + report_registers("criterium: %s, found: %s",criterium,#result) end end return result end -jobregisters = jobregisters or { } -jobregisters.collected = jobregisters.collected or { } -jobregisters.tobesaved = jobregisters.tobesaved or { } +local tobesaved = allocate() +local collected = allocate() -jobregisters.filter_collected = filter_collected +registers.collected = collected +registers.tobesaved = tobesaved +registers.filtercollected = filtercollected -- we follow a different strategy than by lists, where we have a global -- result table; we might do that here as well but since sorting code is -- older we delay that decision -local tobesaved, collected = jobregisters.tobesaved, jobregisters.collected - local function initializer() - tobesaved, collected = jobregisters.tobesaved, jobregisters.collected - local internals = jobreferences.internals + tobesaved = registers.tobesaved + collected = registers.collected + local internals = references.internals for name, list in next, collected do local entries = list.entries for e=1,#entries do @@ -195,7 +207,7 @@ local function initializer() end end -job.register('jobregisters.collected', jobregisters.tobesaved, initializer) +job.register('structures.registers.collected', tobesaved, initializer) local function allocate(class) local d = tobesaved[class] @@ -213,7 +225,7 @@ local function allocate(class) return d end -jobregisters.define = allocate +registers.define = allocate local entrysplitter = lpeg.Ct(lpeg.splitat('+')) -- & obsolete in mkiv @@ -222,6 +234,7 @@ local tagged = { } local function preprocessentries(rawdata) local entries = rawdata.entries if entries then +--~ table.print(rawdata) local e, k = entries[1] or "", entries[2] or "" local et, kt, entryproc, pageproc if type(e) == "table" then @@ -231,7 +244,7 @@ local function preprocessentries(rawdata) et = lpegmatch(entrysplitter,e) end if type(k) == "table" then - kt = e + kt = k else pageproc, k = processor_split(k) kt = lpegmatch(entrysplitter,k) @@ -252,12 +265,10 @@ local function preprocessentries(rawdata) rawdata.processors = { entryproc, pageproc } end rawdata.entries = nil - else - rawdata.list = { { "", "" } } -- br end end -function jobregisters.store(rawdata) -- metadata, references, entries +function registers.store(rawdata) -- metadata, references, entries local data = allocate(rawdata.metadata.name).entries local references = rawdata.references references.realpage = references.realpage or 0 -- just to be sure as it can be refered to @@ -268,14 +279,14 @@ function jobregisters.store(rawdata) -- metadata, references, entries texwrite(#data) end -function jobregisters.enhance(name,n) +function registers.enhance(name,n) local r = tobesaved[name].entries[n] if r then r.references.realpage = texcount.realpageno end end -function jobregisters.extend(name,tag,rawdata) -- maybe do lastsection internally +function registers.extend(name,tag,rawdata) -- maybe do lastsection internally if type(tag) == "string" then tag = tagged[tag] end @@ -284,16 +295,22 @@ function jobregisters.extend(name,tag,rawdata) -- maybe do lastsection internall if r then local rr = r.references rr.lastrealpage = texcount.realpageno - rr.lastsection = structure.sections.currentid() + rr.lastsection = sections.currentid() if rawdata then - preprocessentries(rawdata) + if rawdata.entries then + preprocessentries(rawdata) + end for k,v in next, rawdata do if not r[k] then r[k] = v else local rk = r[k] for kk,vv in next, v do - if vv ~= "" then + if type(vv) == "table" then + if next(vv) then + rk[kk] = vv + end + elseif vv ~= "" then rk[kk] = vv end end @@ -308,28 +325,124 @@ end local compare = sorters.comparers.basic -function jobregisters.compare(a,b) +function registers.compare(a,b) local result = compare(a,b) if result ~= 0 then return result - elseif a.metadata.kind == 'entry' then -- e/f/t - local page_a, page_b = a.references.realpage, b.references.realpage - if not page_a or not page_b then - return 0 - elseif page_a < page_b then + else + local ka, kb = a.metadata.kind, b.metadata.kind + if ka == kb then + local page_a, page_b = a.references.realpage, b.references.realpage + if not page_a or not page_b then + return 0 + elseif page_a < page_b then + return -1 + elseif page_a > page_b then + return 1 + end + elseif ka == "see" then + return 1 + elseif kb == "see" then return -1 - elseif page_a > page_b then - return 1 end end return 0 end -function jobregisters.filter(data,options) - data.result = jobregisters.filter_collected(nil,options.criterium,options.number,data.entries,true) +function registers.filter(data,options) + data.result = registers.filtercollected(nil,options.criterium,options.number,data.entries,true) +end + +local seeindex = 0 + +-- meerdere loops, seewords, dan words, an seewords + +local function crosslinkseewords(result) -- all words + -- collect all seewords + local seewords = { } + for i=1,#result do + local data = result[i] + local seeword = data.seeword + if seeword then + local seetext = seeword.text + if seetext and not seewords[seetext] then + seeindex = seeindex + 1 + seewords[seetext] = seeindex + if trace_registers then + report_registers("see word %03i: %s",seeindex,seetext) + end + end + end + end + -- mark seeparents + local seeparents = { } + for i=1,#result do + local data = result[i] + local word = data.list[1] + word = word and word[1] + if word then + local seeindex = seewords[word] + if seeindex then + seeparents[word] = data + data.references.seeparent = seeindex + if trace_registers then + report_registers("see parent %03i: %s",seeindex,word) + end + end + end + end + -- mark seewords and extend sort list + for i=1,#result do + local data = result[i] + local seeword = data.seeword + if seeword then + local text = seeword.text + if text then + local seeparent = seeparents[text] + if seeparent then + local seeindex = seewords[text] + local s, ns, d, w, l = { }, 0, data.split, seeparent.split, data.list + -- trick: we influence sorting by adding fake subentries + for i=1,#d do + ns = ns + 1 + s[ns] = d[i] -- parent + end + for i=1,#w do + ns = ns + 1 + s[ns] = w[i] -- see + end + data.split = s + -- we also register a fake extra list entry so that the + -- collapser works okay + l[#l+1] = { text, "" } + data.references.seeindex = seeindex + if trace_registers then + report_registers("see crosslink %03i: %s",seeindex,text) + end + end + end + end + end +end + +local function removeemptyentries(result) + local i, n, m = 1, #result, 0 + while i <= n do + local entry = result[i] + if #entry.list == 0 or #entry.split == 0 then + remove(result,i) + n = n - 1 + m = m + 1 + else + i = i + 1 + end + end + if m > 0 then + report_registers("%s empty entries removed in register",m) + end end -function jobregisters.prepare(data) +function registers.prepare(data) -- data has 'list' table local strip = sorters.strip local splitter = sorters.splitters.utf @@ -350,75 +463,85 @@ function jobregisters.prepare(data) end entry.split = split end + removeemptyentries(result) + crosslinkseewords(result) end end -function jobregisters.sort(data,options) - sorters.sort(data.result,jobregisters.compare) +function registers.sort(data,options) + sorters.sort(data.result,registers.compare) end -function jobregisters.unique(data,options) - local result, prev, equal = { }, nil, table.are_equal +function registers.unique(data,options) + local result, nofresult, prev = { }, 0, nil local dataresult = data.result for k=1,#dataresult do local v = dataresult[k] - if not prev then - result[#result+1], prev = v, v - else + if prev then local pr, vr = prev.references, v.references if not equal(prev.list,v.list) then - result[#result+1], prev = v, v + -- ok elseif pr.realpage ~= vr.realpage then - result[#result+1], prev = v, v + -- ok else local pl, vl = pr.lastrealpage, vr.lastrealpage if pl or vl then if not vl then - result[#result+1], prev = v, v + -- ok elseif not pl then - result[#result+1], prev = v, v + -- ok elseif pl ~= vl then - result[#result+1], prev = v, v + -- ok + else + v = nil end + else + v = nil end end end + if v then + nofresult = nofresult + 1 + result[nofresult] = v + prev = v + end end data.result = result end -function jobregisters.finalize(data,options) +function registers.finalize(data,options) -- maps character to index (order) local result = data.result data.metadata.nofsorted = #result - local split, lasttag, s, d = { }, nil, nil, nil - -- maps character to index (order) + local split, nofsplit, lasttag, done, nofdone = { }, 0, nil, nil, 0 + local firstofsplit = sorters.firstofsplit for k=1,#result do local v = result[k] - local entry, tag = sorters.firstofsplit(v) + local entry, tag = firstofsplit(v) if tag ~= lasttag then if trace_registers then - logs.report("registers","splitting at %s",tag) + report_registers("splitting at %s",tag) end - d = { } - s = { tag = tag, data = d } - split[#split+1] = s + done, nofdone = { }, 0 + nofsplit = nofsplit + 1 + split[nofsplit] = { tag = tag, data = done } lasttag = tag end - d[#d+1] = v + nofdone = nofdone + 1 + done[nofdone] = v end data.result = split end -function jobregisters.analysed(class,options) +function registers.analyzed(class,options) local data = collected[class] if data and data.entries then options = options or { } - sorters.setlanguage(options.language) - jobregisters.filter(data,options) -- filter entries into results (criteria) - jobregisters.prepare(data,options) -- adds split table parallel to list table - jobregisters.sort(data,options) -- sorts results - jobregisters.unique(data,options) -- get rid of duplicates - jobregisters.finalize(data,options) -- split result in ranges + sorters.setlanguage(options.language,options.method,options.numberorder) + registers.filter(data,options) -- filter entries into results (criteria) + registers.prepare(data,options) -- adds split table parallel to list table + registers.sort(data,options) -- sorts results + registers.unique(data,options) -- get rid of duplicates + registers.finalize(data,options) -- split result in ranges data.metadata.sorted = true return data.metadata.nofsorted or 0 else @@ -428,267 +551,251 @@ end -- todo take conversion from index -function jobregisters.userdata(index,name) - local data = jobreferences.internals[tonumber(index)] +function registers.userdata(index,name) + local data = references.internals[tonumber(index)] data = data and data.userdata and data.userdata[name] if data then - texsprint(ctxcatcodes,data) + context(data) end end --- proc can be wrapped +-- todo: ownnumber -function jobregisters.flush(data,options,prefixspec,pagespec) - local equal = table.are_equal - texsprint(ctxcatcodes,"\\startregisteroutput") - local collapse_singles = options.compress == interfaces.variables.yes - local collapse_ranges = options.compress == interfaces.variables.all - local result = data.result - -- todo ownnumber - local function pagenumber(entry) - local er = entry.references - texsprint(ctxcatcodes,format("\\registeronepage{%s}{%s}{",er.internal or 0,er.realpage or 0)) -- internal realpage content - local proc = entry.processors and entry.processors[2] - if proc then - texsprint(ctxcatcodes,"\\applyprocessor{",proc,"}{") - helpers.prefixpage(entry,prefixspec,pagespec) - texsprint(ctxcatcodes,"}") - else - helpers.prefixpage(entry,prefixspec,pagespec) - end - texsprint(ctxcatcodes,"}") - end - local function pagerange(f_entry,t_entry,is_last) - local er = f_entry.references - texsprint(ctxcatcodes,format("\\registerpagerange{%s}{%s}{",er.internal or 0,er.realpage or 0)) - local proc = f_entry.processors and f_entry.processors[2] - if proc then - texsprint(ctxcatcodes,"\\applyprocessor{",proc,"}{") - helpers.prefixpage(f_entry,prefixspec,pagespec) - texsprint(ctxcatcodes,"}") - else +local function pagerange(f_entry,t_entry,is_last,prefixspec,pagespec) + local fer, ter = f_entry.references, t_entry.references + context.registerpagerange( + f_entry.processors and f_entry.processors[2] or "", + fer.internal or 0, + fer.realpage or 0, + function() helpers.prefixpage(f_entry,prefixspec,pagespec) - end - local er = t_entry.references - texsprint(ctxcatcodes,format("}{%s}{%s}{",er.internal or 0,er.lastrealpage or er.realpage or 0)) - if is_last then - if proc then - texsprint(ctxcatcodes,"\\applyprocessor{",proc,"}{") + end, + ter.internal or 0, + ter.lastrealpage or ter.realpage or 0, + function() + if is_last then helpers.prefixlastpage(t_entry,prefixspec,pagespec) -- swaps page and realpage keys - texsprint(ctxcatcodes,"}") else - helpers.prefixlastpage(t_entry,prefixspec,pagespec) -- swaps page and realpage keys + helpers.prefixpage (t_entry,prefixspec,pagespec) end - else - if proc then - texsprint(ctxcatcodes,"\\applyprocessor{",proc,"}{") - helpers.prefixpage(t_entry,prefixspec,pagespec) - texsprint(ctxcatcodes,"}") - else - helpers.prefixpage(t_entry,prefixspec,pagespec) + end + ) +end + +local function pagenumber(entry,prefixspec,pagespec) + local er = entry.references + context.registeronepage( + entry.processors and entry.processors[2] or "", + er.internal or 0, + er.realpage or 0, + function() helpers.prefixpage(entry,prefixspec,pagespec) end + ) +end + +local function collapsedpage(pages) + for i=2,#pages do + local first, second = pages[i-1], pages[i] + local first_first, first_last, second_first, second_last = first[1], first[2], second[1], second[2] + local first_last_pn = first_last .references.realpage + local second_first_pn = second_first.references.realpage + local second_last_pn = second_last .references.realpage + local first_last_last = first_last .references.lastrealpage + local second_first_last = second_first.references.lastrealpage + if first_last_last then + first_last_pn = first_last_last + if second_first == second_last and second_first_pn <= first_last_pn then + -- 2=8, 5 -> 12=8 + remove(pages,i) + return true + elseif second_first == second_last and second_first_pn > first_last_pn then + -- 2=8, 9 -> 2-9 + pages[i-1] = { first_first, second_last } + remove(pages,i) + return true + elseif second_last_pn < first_last_pn then + -- 2=8, 3-4 -> 2=8 + remove(pages,i) + return true + elseif first_last_pn < second_last_pn then + -- 2=8, 3-9 -> 2-9 + pages[i-1] = { first_first, second_last } + remove(pages,i) + return true + elseif first_last_pn + 1 == second_first_pn and second_last_pn > first_last_pn then + -- 2=8, 9-11 -> 2-11 + pages[i-1] = { first_first, second_last } + remove(pages,i) + return true + elseif second_first.references.lastrealpage then + -- 2=8, 9=11 -> 2-11 + pages[i-1] = { first_first, second_last } + remove(pages,i) + return true + end + elseif second_first_last then + second_first_pn = second_first_last + if first_last_pn == second_first_pn then + -- 2-4, 5=9 -> 2-9 + pages[i-1] = { first_first, second_last } + remove(pages,i) + return true end + elseif first_last_pn == second_first_pn then + -- 2-3, 3-4 -> 2-4 + pages[i-1] = { first_last, second_last } + remove(pages,i) + return true end - texsprint(ctxcatcodes,"}") end - -- ranges need checking ! + return false +end + +local function collapsepages(pages) + while collapsedpage(pages) do end + return #pages +end + +function registers.flush(data,options,prefixspec,pagespec) + local collapse_singles = options.compress == variables.yes + local collapse_ranges = options.compress == variables.all + local result = data.result + context.startregisteroutput() for i=1,#result do + -- ranges need checking ! local sublist = result[i] local done = { false, false, false, false } local data = sublist.data local d, n = 0, 0 - texsprint(ctxcatcodes,format("\\startregistersection{%s}",sublist.tag)) + context.startregistersection(sublist.tag) + for d=1,#data do + local entry = data[d] + if entry.metadata.kind == "see" then + local list = entry.list + if #list > 1 then + list[#list] = nil + else + -- we have an \seeindex{Foo}{Bar} without Foo being defined anywhere + report_registers("invalid see entry in register '%s', reference '%s'", + entry.metadata.name or "?",list[1][1] or "?") + end + end + end while d < #data do d = d + 1 local entry = data[d] local e = { false, false, false, false } local metadata = entry.metadata + local kind = metadata.kind + local list = entry.list for i=1,4 do -- max 4 - if entry.list[i] then - e[i] = entry.list[i][1] + if list[i] then + e[i] = list[i][1] end if e[i] ~= done[i] then if e[i] and e[i] ~= "" then done[i] = e[i] if n == i then - texsprint(ctxcatcodes,format("\\stopregisterentries\\startregisterentries{%s}",n)) + context.stopregisterentries() + context.startregisterentries(n) else while n > i do n = n - 1 - texsprint(ctxcatcodes,"\\stopregisterentries") + context.stopregisterentries() end while n < i do n = n + 1 - texsprint(ctxcatcodes,format("\\startregisterentries{%s}",n)) + context.startregisterentries(n) end end + local internal = entry.references.internal or 0 + local seeparent = entry.references.seeparent or "" + local processor = entry.processors and entry.processors[1] or "" if metadata then - texsprint(ctxcatcodes,"\\registerentry{") - local proc = entry.processors and entry.processors[1] - if proc then - texsprint(ctxcatcodes,"\\applyprocessor{",proc,"}{") - helpers.title(e[i],metadata) - texsprint(ctxcatcodes,"}") - else - helpers.title(e[i],metadata) - end - texsprint(ctxcatcodes,"}") - else - local proc = entry.processors and entry.processors[1] - if proc then - texsprint(ctxcatcodes,"\\applyprocessor{",proc,"}{") - texsprint(ctxcatcodes,format("\\registerentry{%s}",e[i])) - texsprint(ctxcatcodes,"}") - else - texsprint(ctxcatcodes,format("\\registerentry{%s}",e[i])) - end + context.registerentry(processor,internal,seeparent,function() helpers.title(e[i],metadata) end) + else -- ? + context.registerentry(processor,internal,seeindex,e[i]) end else done[i] = false end end end - local kind = entry.metadata.kind if kind == 'entry' then - texsprint(ctxcatcodes,"\\startregisterpages") - --~ collapse_ranges = true + context.startregisterpages() if collapse_singles or collapse_ranges then -- we collapse ranges and keep existing ranges as they are -- so we get prebuilt as well as built ranges - local first, last, prev = entry, nil, entry - local pages = { } - local dd = d + local first, last, prev, pages, dd, nofpages = entry, nil, entry, { }, d, 0 while dd < #data do dd = dd + 1 local next = data[dd] - local el, nl = entry.list, next.list - if not equal(el,nl) then + if next and next.metadata.kind == "see" then dd = dd - 1 - --~ first = nil break - elseif next.references.lastrealpage then - if first then - pages[#pages+1] = { first, last or first } + else + local el, nl = entry.list, next.list + if not equal(el,nl) then + dd = dd - 1 + --~ first = nil + break + elseif next.references.lastrealpage then + nofpages = nofpages + 1 + pages[nofpages] = first and { first, last or first } or { entry, entry } + nofpages = nofpages + 1 + pages[nofpages] = { next, next } + first, last, prev = nil, nil, nil + elseif not first then + first, prev = next, next + elseif next.references.realpage - prev.references.realpage == 1 then -- 1 ? + last, prev = next, next else - pages[#pages+1] = { entry, entry } + nofpages = nofpages + 1 + pages[nofpages] = { first, last or first } + first, last, prev = next, nil, next end - pages[#pages+1] = { next, next } - first, last, prev = nil, nil, nil - elseif not first then - first, prev = next, next - elseif next.references.realpage - prev.references.realpage == 1 then -- 1 ? - last, prev = next, next - else - pages[#pages+1] = { first, last or first } - first, last, prev = next, nil, next end end if first then - pages[#pages+1] = { first, last or first } + nofpages = nofpages + 1 + pages[nofpages] = { first, last or first } end - if collapse_ranges and #pages > 1 then - -- ok, not that efficient - local function doit() - local function bubble(i) - for j=i,#pages-1 do - pages[j] = pages[j+1] - end - pages[#pages] = nil - end - for i=2,#pages do - local first, second = pages[i-1], pages[i] - local first_first, first_last, second_first, second_last = first[1], first[2], second[1], second[2] - local first_last_pn = first_last .references.realpage - local second_first_pn = second_first.references.realpage - local second_last_pn = second_last .references.realpage - local first_last_last = first_last .references.lastrealpage - local second_first_last = second_first.references.lastrealpage - if first_last_last then - first_last_pn = first_last_last - if second_first == second_last and second_first_pn <= first_last_pn then - -- 2=8, 5 -> 12=8 - bubble(i) - return true - elseif second_first == second_last and second_first_pn > first_last_pn then - -- 2=8, 9 -> 2-9 - pages[i-1] = { first_first, second_last } - bubble(i) - return true - elseif second_last_pn < first_last_pn then - -- 2=8, 3-4 -> 2=8 - bubble(i) - return true - elseif first_last_pn < second_last_pn then - -- 2=8, 3-9 -> 2-9 - pages[i-1] = { first_first, second_last } - bubble(i) - return true - elseif first_last_pn + 1 == second_first_pn and second_last_pn > first_last_pn then - -- 2=8, 9-11 -> 2-11 - pages[i-1] = { first_first, second_last } - bubble(i) - return true - elseif second_first.references.lastrealpage then - -- 2=8, 9=11 -> 2-11 - pages[i-1] = { first_first, second_last } - bubble(i) - return true - end - elseif second_first_last then - second_first_pn = second_first_last - if first_last_pn == second_first_pn then - -- 2-4, 5=9 -> 2-9 - pages[i-1] = { first_first, second_last } - bubble(i) - return true - end - elseif first_last_pn == second_first_pn then - -- 2-3, 3-4 -> 2-4 - pages[i-1] = { first_last, second_last } - bubble(i) - return true - end - end - return false - end - while doit() do end + if collapse_ranges and nofpages > 1 then + nofpages = collapsepages(pages) end - -- - if #pages > 0 then -- or 0 + if nofpages > 0 then -- or 0 d = dd - for p=1,#pages do + for p=1,nofpages do local first, last = pages[p][1], pages[p][2] if first == last then if first.references.lastrealpage then - pagerange(first,first,true) + pagerange(first,first,true,prefixspec,pagespec) else - pagenumber(first) + pagenumber(first,prefixspec,pagespec) end elseif last.references.lastrealpage then - pagerange(first,last,true) + pagerange(first,last,true,prefixspec,pagespec) else - pagerange(first,last,false) + pagerange(first,last,false,prefixspec,pagespec) end end + elseif entry.references.lastrealpage then + pagerange(entry,entry,true,prefixspec,pagespec) else - if entry.references.lastrealpage then - pagerange(entry,entry,true) - else - pagenumber(entry) - end + pagenumber(entry,prefixspec,pagespec) end else while true do if entry.references.lastrealpage then - pagerange(entry,entry,true) + pagerange(entry,entry,true,prefixspec,pagespec) else - pagenumber(entry) + pagenumber(entry,prefixspec,pagespec) end if d == #data then break else d = d + 1 local next = data[d] - if not equal(entry.list,next.list) then + if next.metadata.kind == "see" or not equal(entry.list,next.list) then d = d - 1 break else @@ -697,39 +804,55 @@ function jobregisters.flush(data,options,prefixspec,pagespec) end end end - texsprint(ctxcatcodes,"\\stopregisterpages") + context.stopregisterpages() elseif kind == 'see' then - -- maybe some day more words - texsprint(ctxcatcodes,"\\startregisterseewords") - local proc = entry.processors and entry.processors[1] - if proc then - texsprint(ctxcatcodes,"\\applyprocessor{",proc,"}{") - texsprint(ctxcatcodes,format("\\registeroneword{0}{0}{%s}",entry.seeword.text)) -- todo: internal - texsprint(ctxcatcodes,"}") - else - texsprint(ctxcatcodes,format("\\registeroneword{0}{0}{%s}",entry.seeword.text)) -- todo: internal + local t, nt = { }, 0 + while true do + nt = nt + 1 + t[nt] = entry + if d == #data then + break + else + d = d + 1 + local next = data[d] + if next.metadata.kind ~= "see" or not equal(entry.list,next.list) then + d = d - 1 + break + else + entry = next + end + end end - texsprint(ctxcatcodes,"\\stopregisterseewords") + context.startregisterseewords() + for i=1,nt do + local entry = t[i] + local processor = entry.processors and entry.processors[1] or "" + local seeindex = entry.references.seeindex or "" + local seeword = entry.seeword.text or "" + context.registerseeword(i,n,processor,0,seeindex,seeword) + end + context.stopregisterseewords() end end while n > 0 do - texsprint(ctxcatcodes,"\\stopregisterentries") + context.stopregisterentries() n = n - 1 end - texsprint(ctxcatcodes,"\\stopregistersection") + context.stopregistersection() end - texsprint(ctxcatcodes,"\\stopregisteroutput") + context.stopregisteroutput() -- for now, maybe at some point we will do a multipass or so data.result = nil data.metadata.sorted = false end -function jobregisters.analyse(class,options) - texwrite(jobregisters.analysed(class,options)) +function registers.analyze(class,options) + texwrite(registers.analyzed(class,options)) end -function jobregisters.process(class,...) - if jobregisters.analysed(class,...) > 0 then - jobregisters.flush(collected[class],...) +function registers.process(class,...) + if registers.analyzed(class,...) > 0 then + registers.flush(collected[class],...) end end + diff --git a/Master/texmf-dist/tex/context/base/strc-reg.mkiv b/Master/texmf-dist/tex/context/base/strc-reg.mkiv index fcc37549c44..19634390dba 100644 --- a/Master/texmf-dist/tex/context/base/strc-reg.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-reg.mkiv @@ -17,9 +17,6 @@ \unprotect -\def\c!keys {keys} -\def\c!entries{entries} - % todo: tag:: becomes rendering % todo: language, character, linked, location @@ -117,10 +114,13 @@ \c!prefix=\v!both, %\c!expansion=, %\c!xmlsetup=, + \c!pagenumber=\v!yes, \c!pageprefixconnector=\endash, \c!pagesegments=2:2, \c!file=\jobname, %\c!deeptextcommand=, % undefined by default ! + \c!method=, % no default as we have them in the module, maybe some day in lang-* + \c!numberorder=\v!numbers, % \v!characters \s!language=\currentmainlanguage]% %D Definition: @@ -130,7 +130,7 @@ \def\dodefineregister[#1][#2]% #2? {\setupregister[#1][\s!parent=\??id]% - \ctxlua{jobregisters.define('#1')}% + \ctxlua{structures.registers.define('#1')}% \presetheadtext[#1=\Word{#1}]% \setuvalue{#1}{\dodoubleempty\doregister[#1]}% \setuvalue{\e!see#1}{\dodoubleempty\doseeregister[#1]}% @@ -223,24 +223,24 @@ % we could consider storing register entries in a list which we % could then sort \xdef\currentregisternumber{\ctxlua{ - jobregisters.store { % 'own' should not be in metadata + structures.registers.store { % 'own' should not be in metadata metadata = { kind = "entry", name = "\currentregister", - level = structure.sections.currentlevel(), + level = structures.sections.currentlevel(), coding = "\currentregistercoding", catcodes = \the\catcodetable, \ifx\currentregisterownnumber\v!yes own = "\registerparameter\c!alternative", % can be used instead of pagenumber \fi xmlroot = \ifx\currentreferencecoding\s!xml "\xmldocument" \else nil \fi, % only useful when text -\ifx\currentregisterxmlsetup\empty \else - xmlsetup = "\currentregisterxmlsetup", -\fi + \ifx\currentregisterxmlsetup\empty \else + xmlsetup = "\currentregisterxmlsetup", + \fi }, references = { internal = \nextinternalreference, - section = structure.sections.currentid(), % hm, why then not also lastsection the same way + section = structures.sections.currentid(), % hm, why then not also lastsection the same way label = "\currentregisterlabel", }, % \ifx\currentregisterentries\empty \else @@ -258,16 +258,18 @@ \fi }, % \fi - userdata = structure.helpers.touserdata(\!!bs\detokenize{#3}\!!es) + userdata = structures.helpers.touserdata(\!!bs\detokenize{#3}\!!es) } } }% - \ctxlua{jobreferences.setinternalreference(nil,nil,\nextinternalreference)}% + \ctxlua{structures.references.setinternalreference(nil,nil,\nextinternalreference)}% \ifx\currentregisterownnumber\v!yes \glet\currentregistersynchronize\relax \else - \xdef\currentregistersynchronize{\ctxlatelua{jobregisters.enhance("\currentregister",\currentregisternumber)}}% + \xdef\currentregistersynchronize{\ctxlatelua{structures.registers.enhance("\currentregister",\currentregisternumber)}}% \fi \currentregistersynchronize % here? + % needs thinking ... bla\index{bla}. will break before the . but adding a + % penalty is also no solution \attribute\destinationattribute\lastdestinationattribute \forcecolorhack % no \strut as it will be removed during cleanup \endgroup} @@ -296,7 +298,7 @@ \fi} \def\dostopregister[#1][#2]% - {\normalexpanded{\ctxlatelua{jobregisters.extend("#1","#2")}}} + {\normalexpanded{\ctxlatelua{structures.registers.extend("#1","#2")}}} \def\setregisterentry {\dotripleempty\dosetregisterentry} \def\finishregisterentry{\dotripleempty\dofinishregisterentry} @@ -327,18 +329,19 @@ \fi \globallet\currentregistercoding\s!tex \fi + % I hate this kind of mess ... but it's a user request. \ifx\currentregisterentries\empty - \normalexpanded{\ctxlua{jobregisters.extend("\currentregister","\currentregisterlabel", { + \normalexpanded{\ctxlua{structures.registers.extend("\currentregister","\currentregisterlabel", { metadata = { \ifx\currentregisterownnumber\v!yes own = "\registerparameter\c!alternative", % can be used instead of pagenumber \fi }, - userdata = structure.helpers.touserdata(\!!bs\detokenize{#3}\!!es) + userdata = structures.helpers.touserdata(\!!bs\detokenize{#3}\!!es) })% }}% \else - \normalexpanded{\ctxlua{jobregisters.extend("\currentregister","\currentregisterlabel", { + \normalexpanded{\ctxlua{structures.registers.extend("\currentregister","\currentregisterlabel", { metadata = { catcodes = \the\catcodetable, coding = "\currentregistercoding", @@ -350,7 +353,7 @@ % we need a special one for xml, this is just a single one \!!bs\currentregisterentries\!!es, \!!bs\currentregisterkeys\!!es }, - userdata = structure.helpers.touserdata(\!!bs\detokenize{#3}\!!es) + userdata = structures.helpers.touserdata(\!!bs\detokenize{#3}\!!es) }) }}% \fi @@ -387,7 +390,7 @@ {\doflushatpar{\doregisterstructurepageregister{#1}{\c!label=#2,#3}{#4}}} \def\dostopstructurepageregister[#1][#2]% - {\normalexpanded{\ctxlatelua{jobregisters.extend("#1","#2")}}} + {\normalexpanded{\ctxlatelua{structures.registers.extend("#1","#2")}}} % So far. @@ -416,16 +419,16 @@ \fi \setnextinternalreference % we could consider storing register entries in list - \edef\temp{\ctxlua{ jobregisters.store { + \edef\temp{\ctxlua{ structures.registers.store { metadata = { kind = "see", name = "\currentregister", - level = structure.sections.currentlevel(), + level = structures.sections.currentlevel(), catcodes = \the\catcodetable, }, references = { internal = \nextinternalreference, - section = structure.sections.currentid(), + section = structures.sections.currentid(), }, entries = { % we need a special one for xml, this is just a single one @@ -440,6 +443,8 @@ %D Rendering: +% todo: c!language ipv s!language + \let\utilityregisterlength\!!zerocount \def\determineregistercharacteristics @@ -449,10 +454,12 @@ {\begingroup \edef\currentregister{#1}% \setupregister[\currentregister][#2]% - \normalexpanded{\endgroup\noexpand\xdef\noexpand\utilityregisterlength{\ctxlua{jobregisters.analyse('\currentregister',{ - language = "\registerparameter\s!language", - compress = "\registerparameter\c!compress", - criterium = "\registerparameter\c!criterium", + \normalexpanded{\endgroup\noexpand\xdef\noexpand\utilityregisterlength{\ctxlua{structures.registers.analyze('\currentregister',{ + language = "\registerparameter\s!language", + method = "\registerparameter\c!method", + numberorder = "\registerparameter\c!numberorder", + compress = "\registerparameter\c!compress", + criterium = "\registerparameter\c!criterium", })}}}% brrr \ifcase\utilityregisterlength\relax \resetsystemmode\v!register @@ -482,10 +489,12 @@ \c!align=\registerparameter\c!align, \c!tolerance=\registerparameter\c!tolerance]% \startpacked[\v!blank]% - \ctxlua{jobregisters.process('\currentregister',{ - language = "\registerparameter\s!language", - compress = "\registerparameter\c!compress", - criterium = "\registerparameter\c!criterium", + \ctxlua{structures.registers.process('\currentregister',{ + language = "\registerparameter\s!language", + method = "\registerparameter\c!method", + numberorder = "\registerparameter\c!numberorder", + compress = "\registerparameter\c!compress", + criterium = "\registerparameter\c!criterium", }, { % prefix = "\registerparameter\c!pageprefix", @@ -561,9 +570,23 @@ {\doifsomething{#1} {\doifnot{#1}\s!unknown {\doifelse{\registerparameter\c!indicator}\v!yes - {\expandcheckedcsname{\??id:\c!indicator:}{\registerparameter\c!alternative}{a}{#1}} + {\doregistercharacter{#1}} {\noregistercharacter{#1}}}}} +% \def\doregistercharacter#1% +% {\expandcheckedcsname % why no \executeifdefined +% {\??id:\c!indicator:}% +% {\registerparameter\c!alternative}% +% {a}% +% {#1}} + +\def\doregistercharacter#1% + {\expandcheckedcsname % why no \executeifdefined + {\??id:\c!indicator:}% + {\registerparameter\c!alternative}% + {a}% + {#1}} + \def\noregistercharacter#1% {\registerparameter\c!before \goodbreak} @@ -573,19 +596,31 @@ \setvalue{\??id:\c!indicator:a}#1% {\registerparameter\c!before % bugged, why does leftskip gets set: \vskip\lineheight\goodbreak\vskip-\lineheight - \begingroup\dosetregisterattributes\c!style\c!color - \registerparameter\c!command{\strut#1}% + \begingroup + \dosetregisterattributes\c!style\c!color + \dontleavehmode + \strut + \iflocation + \pagereference[\currentregister:\v!section:#1]% + \fi + \registerparameter\c!command{#1}% \endgroup \registerparameter\c!after - \par\nobreak} - + \par + \nobreak} % b = -\setvalue{\??id:\c!indicator:b}#1% +\setvalue{\??id:\c!indicator:b}#1% will be shared with a {\registerparameter\c!before - \begingroup\dosetregisterattributes\c!style\c!color - \registerparameter\c!command{\strut#1}% + \begingroup + \dosetregisterattributes\c!style\c!color + \dontleavehmode + \strut + \iflocation + \pagereference[\currentregister:\v!section:#1]% + \fi + \registerparameter\c!command{#1}% \endgroup \registerparameter\c!after \nobreak} @@ -603,47 +638,60 @@ \unexpanded\def\startregisteroutput {\endgraf \begingroup + \dostarttagged\t!register\currentregister \forgetparindent \forgetparskip} \unexpanded\def\stopregisteroutput {\endgraf + \dostoptagged \endgroup} \unexpanded\def\startregisterentries#1% depth {\endgraf \begingroup + \dostarttagged\t!registerentries\empty \dosetregisterattributes\c!textstyle\c!textcolor \advance\leftskip\numexpr#1-1\relax\dimexpr\registerparameter\c!distance\relax \hangindent\registerparameter\c!distance\hangafter\plusone} \unexpanded\def\stopregisterentries {\endgraf + \dostoptagged \endgroup} \unexpanded\def\startregistersection#1% title - {\registercharacter{#1}\endgraf} + {\dostarttagged\t!registersection\empty + \dostarttagged\t!registertag\empty + \registercharacter{#1}\endgraf + \dostoptagged} \unexpanded\def\stopregistersection - {\endgraf} + {\dostoptagged + \endgraf} \newconditional\registerpagedone \unexpanded\def\startregisterpages {\begingroup + \dostarttagged\t!registerpages\empty \setfalse\registerpagedone \dosetregisterattributes\c!pagestyle\c!pagecolor} \unexpanded\def\stopregisterpages - {\endgroup} + {\dostoptagged + \endgroup} \unexpanded\def\startregisterseewords - {\begingroup + {\ifhmode\crlf\fi + \begingroup \setfalse\registerpagedone + \dostarttagged\t!registerpage\empty \dosetregisterattributes\c!pagestyle\c!pagecolor} \unexpanded\def\stopregisterseewords - {\endgroup} + {\dostoptagged + \endgroup} \def\registerpageseparator% todo: , configurable {\ifconditional\registerpagedone @@ -655,30 +703,79 @@ \def\registeronepagerangeseparator{|\endash|} -\def\withregisterpagecommand#1#2#3% - {\def\currentregisterpageindex{#1}% +\def\withregisterpagecommand#1#2#3#4% + {\def\currentregisterpageindex{#2}% \iflocation - \goto{\registerparameter\c!pagecommand{#3}}[internal(#1)]% + \goto{\registerparameter\c!pagecommand{#4}}[internal(#2)]% \else - \registerparameter\c!pagecommand{#3}% + \registerparameter\c!pagecommand{#4}% \fi} -\def\registeronepage#1#2#3% content +\def\registeronepage#1#2#3#4% #1:processor content {\registerpageseparator - \withregisterpagecommand{#1}{#2}{#3}} + \dostarttagged\t!registerpage\empty + \withregisterpagecommand{#1}{#2}{#3}{#4}% + \dostoptagged} -\def\registerpagerange#1#2#3#4#5#6% content, content todo: -- configurable +\def\registerpagerange#1#2#3#4#5#6#7% #1:processor content, content todo: -- configurable {\registerpageseparator - \withregisterpagecommand{#1}{#2}{#3}% + \dostarttagged\t!registerpagerange\empty + \dostarttagged\t!registerfrompage\empty + \withregisterpagecommand{#1}{#2}{#3}{#4}% + \dostoptagged \registeronepagerangeseparator - \withregisterpagecommand{#4}{#5}{#6}} + \dostarttagged\t!registertopage\empty + \withregisterpagecommand{#1}{#5}{#6}{#7}% + \dostoptagged + \dostoptagged} + +\def\doapplyregisterentrycommand#1#2% processor text + {\dostarttagged\t!registerentry\empty + \ifx\currentregisterseeindex\empty \else + \dontleavehmode + \pagereference[seeindex:\currentregisterseeindex]% maybe some day we will support an area + \fi + \applyprocessor{#1}{\registerparameter\c!textcommand{\limitedregisterentry{\registerparameter\c!deeptextcommand{#2}}}}% + \dostoptagged} -\def\registeroneword#1#2#3% content - {\registerpageseparator - \registerseeword{#3}} +\def\defaultregisterentry#1#2#3#4% #1:processor #2:internal #3:seeindex #4:word + {\def\currentregisterpageindex{#2}% + \iflocation + \def\currentregisterseeindex{#3}% + \doifelse{\registerparameter\c!interaction}\v!text + {\directgoto{\setlocationcolor\??ia\doapplyregisterentrycommand{#1}{#4}}[internal(#2)]} + {\doapplyregisterentrycommand{#1}{#4}}% + \else + \let\currentregisterseeindex\empty + \doapplyregisterentrycommand{#1}{#4}% + \fi} + +\unexpanded\def\doapplyregisterseecommand#1#2% + {\ifx\currentregisterseeindex\empty + % \dontleavehmode + \applyprocessor{#1}{#2}% + \else + \goto{\applyprocessor{#1}{#2}}[seeindex:\currentregisterseeindex]% + \fi} -\def\defaultregisterentry #1{\registerparameter\c!textcommand{\limitedregisterentry{\registerparameter\c!deeptextcommand{#1}}}} -\def\defaultregisterseeword#1{\labeltexts\v!see{#1}} +\def\defaultregisterseeword#1#2#3#4#5#6% i n #3:processor #4:internal #5:seeindex #6:word + {%\registerpageseparator + \def\currentregisterpageindex{#4}% + \dostarttagged\t!registersee\empty + \settrue\registerpagedone + \iflocation + \def\currentregisterseeindex{#5}% + \else + \let\currentregisterseeindex\empty + \fi + \ifnum#1=\plusone + \labeltexts\v!see{\doapplyregisterseecommand{#3}{#6}}% + \else\ifnum#1=#2\relax + \labeltexts\v!and{\doapplyregisterseecommand{#3}{#6}}% + \else + ,\space\doapplyregisterseecommand{#3}{#6}% + \fi\fi + \dostoptagged} \let\registerseeword \defaultregisterseeword \let\registerentry \defaultregisterentry @@ -700,7 +797,7 @@ % \placeregister[index][n=1,pagecommand=\MyRegisterPageCommand] % \stoptext -\def\registerpageuserdata #1#2{\ctxlua{jobregisters.userdata(#1,"#2")}} +\def\registerpageuserdata #1#2{\ctxlua{structures.registers.userdata(#1,"#2")}} \def\currentregisterpageuserdata {\registerpageuserdata\currentregisterpageindex} % {#1} % not yet ok : new internal handler names @@ -715,423 +812,44 @@ \setvalue{\??id:\c!symbol:\v!none}% {\let\registerpageseparatorsymbol\empty - \let\registeronepage \gobblethreearguments - \let\registerpagerange \gobblesixarguments} + \let\registeronepage \gobblefourarguments + \let\registerpagerange \gobblesevenarguments} \setvalue{\??id:\c!symbol:1}% {\let\registerpageseparatorsymbol\space - \def\registeronepage {\symbol[1]\gobblethreearguments}% - \def\registerpagerange {\symbol[1]\gobblesixarguments}} + \def\registeronepage {\symbol[1]\gobblefourarguments}% + \def\registerpagerange {\symbol[1]\gobblesevenarguments}} \setvalue{\??id:\c!symbol:2}% {\let\registerpageseparatorsymbol\space - \def\registeronepage {\registerpagebuttonsymbol\gobblethreearguments}% - \def\registerpagerange {\registerpagebuttonsymbol\gobblesixarguments}} + \def\registeronepage {\registerpagebuttonsymbol\gobblefourarguments}% + \def\registerpagerange {\registerpagebuttonsymbol\gobblesevenarguments}} \def\setregisterpagerendering - {\edef\currentregisterpagesymbol{\registerparameter\c!symbol}% + {\doifelse{\registerparameter\c!pagenumber}\v!no + {\let \currentregisterpagesymbol\v!none} + {\edef\currentregisterpagesymbol{\registerparameter\c!symbol}}% \ifx\currentregisterpagesymbol\empty \csname\??id:\c!symbol:\c!n\endcsname \else\ifcsname\??id:\c!symbol:\currentregisterpagesymbol\endcsname \csname\??id:\c!symbol:\currentregisterpagesymbol\endcsname \else \let\registerpageseparatorsymbol\space - \def\registeronepage {\registerparameter\c!symbol\gobblethreearguments}% - \def\registerpagerange {\registerparameter\c!symbol\gobblesixarguments}% + \def\registeronepage {\registerparameter\c!symbol\gobblefourarguments}% + \def\registerpagerange {\registerparameter\c!symbol\gobblesevenarguments}% \fi\fi} \appendtoks \setregisterpagerendering \to \everyplaceregister -% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % -% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % -% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % - -%D The following code will be reimplemented (not that hard) when it's needed +%D The linked register code will be reimplemented (not that hard) when it's needed %D again and/or when I'm bored. -% \def\getalllistreferences#1#2% -% {\gdefconvertexpanded\currentregisterentry{\getvalue{\??id#1\c!expansion}}{#2}% -% \doifdefinedelse{\??id#1\??id\currentregisterentry} -% {\edef\alllistreferences% -% {\getvalue{\??id#1\??id\currentregisterentry}}% -% \beforesplitstring\alllistreferences\at::\to\internallistreference -% \aftersplitstring \alllistreferences\at::\to\alllistreferences} -% {\let\alllistreferences\empty -% \def\internallistreference{0}}} - -% \def\dosetlinkregister#1% is die page reference echt nodig? -% {\setregisterpage{#1}% -% \global\let\currentregisterentry\empty -% \global\firstsubentrytrue % not needed -% \global\firstsubsubentrytrue % not needed too -% \setvalue{#1\s!entrya}##1{\dosetlinkregisterentrya{#1}{##1}}% -% \setvalue{#1\s!entry }##1{\dosetpageregisterletter{#1}{##1}}} - -% \def\dosetlinkregisterentrya#1#2% -% {\global\utilitydonetrue -% \c!entryletter -% \iflocation -% \getalllistreferences{#1}{#2}% -% % no \endgraf -% \hangindent1em\noindent\c!entryreference -% % -% %\thisissomeinternal{\s!lin}{\internallistreference}% -% % -% \pagereference[-:\s!lin:\internallistreference]% -: added -% % -% \getcommacommandsize[\alllistreferences]% -% \getfromcommacommand[\alllistreferences][1]% -% \ifnum\commalistsize=1 -% \let\firstlistreference\empty -% \let\midlistreference\commalistelement -% \let\lastlistreference\empty -% \else -% \let\firstlistreference\commalistelement -% \getfromcommacommand[\alllistreferences][\commalistsize]% -% \let\lastlistreference\commalistelement -% \ifnum\commalistsize=2 -% \let\midlistreference\empty -% \else -% \!!counta\commalistsize -% \divide\!!counta 2 -% \getfromcommacommand[\alllistreferences][\!!counta]% -% \let\midlistreference\commalistelement -% \fi -% \fi -% % aangepast -% \def\dodocommand[##1-##2]% -% {\gotonextinternal{\s!ind}{##1}{##2}{\box0}}% -% \doifelsevalue{\??id#1\c!interaction}\v!pagenumber -% {\limitedregisterentry{#1}{#2}} % paginanummer -% {{\setbox0\hbox{\limitedregisterentry{#1}{\begstrut#2}}% -% \ifx\firstlistreference\empty % tekst,alles -% \ifx\midlistreference\empty -% \box0 -% \else -% \expandafter\dodocommand\expandafter[\midlistreference]% -% \fi -% \else -% \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\docommand##1##2% -% {{\setbox0\hbox{\showlocation{\hbox to 1em{\hss\symbol[##2]\hss}}}% -% \ifx##1\empty -% % \hskip\wd0 % (optioneel maken) -% \else -% \expandafter\dodocommand\expandafter[##1]% -% \fi}}% -% \hskip\getvalue{\??id#1\c!distance}% -% \docommand\firstlistreference\v!previous -% \docommand\midlistreference\v!somewhere -% \docommand\lastlistreference\v!next}% -% % tot hier -% \else -% % no \endgraf -% \noindent\c!entryreference -% \limitedregisterentry{#1}{#2}% -% \fi -% \endgraf} - -% \def\dosetregister#1% -% {\doifelsevalue{\??id#1\c!coupling}\v!yes -% {\ifautoregisterhack -% \dosetautoregister{#1}% -% \else -% \dosetlinkregister{#1}% -% \fi} -% {\dosetpageregister{#1}}} - -% \def\dosetregister#1% -% {\dosetpageregister{#1}} - -% \newcounter\internallistreference - -% \def\doloadregisterlinks#1% -% {\setregisterpage{#1}% -% \global\let\currentregisterentry\empty -% \global\firstregisterpagetrue -% \setvalue{#1\s!entrya}##1% -% {\global\firstregisterpagetrue -% \gdefconvertedargument\currentregisterentry{##1}% global nodig? -% \doglobal\increment\internallistreference}% -% \setvalue{#1\s!from}% -% {\getvalue{#1\s!page}}% -% \ifautoregisterhack -% \setvalue{#1\s!page}##1##2##3##4% -% {\doifreglevelelse[##3] -% {\global\utilitydonetrue -% \iffirstregisterpage -% \@EA\xdef\csname\??id#1\??id\currentregisterentry\endcsname -% {\internallistreference::##4}% -% \else % catches errors in index -% \ifcsname\??id#1\??id\currentregisterentry\endcsname -% \@EA\xdef\csname\??id#1\??id\currentregisterentry\endcsname -% {\csname\??id#1\??id\currentregisterentry\endcsname,##4}% -% \fi -% \fi} -% {}}% -% \else -% \setvalue{#1\s!page}##1##2##3##4% -% {\doifreglevelelse[##3] -% {\global\utilitydonetrue -% \iffirstregisterpage -% \global\firstregisterpagefalse -% \@EA\xdef\csname\??id#1\??id\currentregisterentry\endcsname -% {\internallistreference::##2-##4}% -% \else % catches errors in index -% \ifcsname\??id#1\??id\currentregisterentry\endcsname -% \@EA\xdef\csname\??id#1\??id\currentregisterentry\endcsname -% {\csname\??id#1\??id\currentregisterentry\endcsname,##2-##4}% -% \fi -% \fi} -% {}}% -% \fi} - -% \def\docoupleregister[#1][#2]% -% {\iflocation -% \ifcase0\countervalue{autolink:#1}\relax % only once -% \begingroup -% \let\dosetregister\doloadregisterlinks -% \def\currentregister{#1}% -% \setupregister[#1][#2]% -% \mkloadregister\currentregister\dobeforeplaceregister\doafterplaceregister -% \endgroup -% \ifautoregisterhack -% \doinitializeautoregister{#1}% -% \else -% \doinitializelinkregister{#1}% -% \fi -% \fi -% \fi} - -% \def\coupleregister -% {\dodoubleempty\docoupleregister} - -% \def\dodocommandprolinrefAA[#1-#2]% -% {\def\lastlistreference{#1-#2}} - -% \def\dodocommandprolinrefA[#1-#2]% -% {\def\lastlistreference{#1-#2}% -% \ifx\firstlistreference\empty -% \let\firstlistreference\lastlistreference -% \fi -% \ifnum#1<\nextinternalreference\relax -% \let\prevlistreference\lastlistreference -% \else\ifnum#1>\nextinternalreference\relax -% \let\nextlistreference\lastlistreference -% \let\dodocommandprolinrefA\dodocommandprolinrefAA -% \else -% \let\selflistreference\lastlistreference -% \fi\fi} - -% \def\docommandprolinrefA#1% -% {\dodocommandprolinrefA[#1]} - -% \def\dodocommandprolinrefB[#1-#2]% -% {\gotonextinternal{\s!ind}{#1}{#2}{\box0}} - -% \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\dodocommandprolinrefB\expandafter[#2]% -% \fi -% \egroup} - -% \def\doprocesslinkregister[#1][#2]#3% -% {\hbox -% {\doprocesspageregister{}{#2}{}{#3}% -% \let\firstlistreference\empty -% \let\lastlistreference\empty -% \let\selflistreference\empty -% \let\prevlistreference\empty -% \let\nextlistreference\empty -% \getalllistreferences{#1}{#3}% -% \ifx\alllistreferences\empty \else -% \normalexpanded{\noexpand\rawprocesscommalist[\alllistreferences]}\docommandprolinrefA -% \fi -% \ifx\prevlistreference\empty -% \let\prevlistreference\lastlistreference -% \fi -% \ifx\nextlistreference\empty -% \let\nextlistreference\firstlistreference -% \fi -% \ifx\prevlistreference\selflistreference -% \let\prevlistreference\empty -% \let\nextlistreference\empty -% \fi -% \setalignmentswitch{\getvalue{\??id#1\c!location}}% -% \ifcase\alignmentswitch -% % links -% \docommandprolinrefB{#1}\prevlistreference\v!previous -% \docommandprolinrefB{#1}\nextlistreference\v!next -% \or -% % midden -% \docommandprolinrefB{#1}\prevlistreference\v!previous -% \or -% % rechts -% \fi -% \doifreferencefoundelse{\s!lin:\internallistreference} -% {\gotosomeinternal -% \s!lin \internallistreference \currentrealreference -% {\showlocation{\limitedregisterentry{#1}{#3}}}} -% {\hbox{\limitedregisterentry{#1}{#3}}}% -% \ifcase\alignmentswitch -% % links -% \or -% % midden -% \docommandprolinrefB{#1}\nextlistreference\v!next -% \or -% % rechts -% \docommandprolinrefB{#1}\prevlistreference\v!previous -% \docommandprolinrefB{#1}\nextlistreference\v!next -% \fi}} - -% \def\doprocesslinkedregister[#1][#2]#3% page auto link -% {\bgroup -% \chardef\registerpagestatus\plusone -% \def\currentregister{#1}% -% \iflocation % \next is not needed -% \ifautoregisterhack -% \def\next{\doprocessautoregister[#1][#2]}% -% \else -% \def\next{\doprocesslinkregister[#1][#2]}% -% \fi -% \else -% \def\next{\doprocesspageregister{}{#2}{}}% -% \fi -% \next{#3}% -% \egroup} - -% \def\dodolinkedregister[#1][#2]#3% page auto link -% {\doflushatpar{\doprocesslinkedregister[#1][#2]{#3}}} - -% \def\dolinkedregister#1% -% {\dodoubleempty\dodolinkedregister[#1]} - -% \def\dosetautoregister#1% -% {\makecounter{autolink:#1}% -% \setregisterpage{#1}% -% \global\let\currentregisterentry\empty -% \global\firstsubentrytrue % not needed -% \global\firstsubsubentrytrue % not needed too -% \setvalue{#1\s!entrya}##1{\dosetautoregisterentrya{#1}{##1}}% -% \setvalue{#1\s!entry }##1{\dosetpageregisterletter{#1}{##1}}} - -% \def\dosetautoregisterentrya#1#2% -% {\global\utilitydonetrue -% \c!entryletter -% \iflocation -% \getalllistreferences{#1}{#2}% -% \endgraf\hangindent1em\noindent\c!entryreference -% \pagereference[-:\s!lin:\internallistreference]% -% \pluscounter{autolink:#1}% -% \bgroup -% %\setupinteraction[\c!color=,\c!contrastcolor=,\c!style=]% kan sneller -% \resetinteractionparameter\c!color -% \resetinteractionparameter\c!contrastcolor -% \resetinteractionparameter\c!style -% \gotobox -% {\limitedregisterentry{#1}{\begstrut#2}}% -% [JS(SetRegisterEntry{\v!register,\countervalue{autolink:#1},#2,{\alllistreferences}})]% -% \egroup -% \else -% \endgraf\noindent\c!entryreference -% \limitedregisterentry{#1}{#2}% -% \fi} - -% \def\doprocessautoregister[#1][#2]#3% -% {\hbox -% {\doprocesspageregister{}{#2}{}{#3}% -% \doifreferencefoundelse{\s!lin:\internallistreference} -% {\gotosomeinternal \s!lin -% {\internallistreference}{\currentrealreference} -% {\showlocation{\limitedregisterentry{#1}{#3}}}} -% {\hbox{\limitedregisterentry{#1}{#3}}}}} - -% \appendmacro aan openpaginaactie (in shipout) - -%D The first implementation used one main field with clones. -%D In a 2500 page document this resulted in a rather (anoying) -%D long start||up time. This \quote {every page its own field} -%D solution, combined with a \quote {page open action}, works -%D much faster, but is conceptually pretty weak. - -% \def\complexregisterfield[#1]% -% {\definefield[#1:\realfolio][line][\v!register]% -% \field[#1:\realfolio]} - -% \def\simpleregisterfield -% {\complexregisterfield[\v!register]} - -% \definecomplexorsimple\registerfield - -% \appendtoks -% % for now -% \setupfield -% [\v!register] -% [\c!width=10em, -% \c!height=3ex, -% \c!align=\v!middle, -% \c!option=\v!readonly, -% \c!location=\v!low] -% \to \everydump - -% \def\doinitializeautoregister#1% -% {\useJSscripts[reg]% -% \useJSpreamblenow{LinkedRegisters}% -% \setupinteraction[\c!openpageaction=JS(UpdateRegisterField{\v!register})]% -% \definereference[\v!reset\v!register][JS(ResetRegisterEntry{\v!register})]% -% \definereference[\v!first\v!register][JS(GotoFirstRegisterEntry{\v!register})]% -% \definereference[\v!previous\v!register][JS(GotoPreviousRegisterEntry{\v!register})]% -% \definereference[\v!next\v!register][JS(GotoNextRegisterEntry{\v!register})]% -% \definereference[\v!last\v!register][JS(GotoLastRegisterEntry{\v!register})]} - -% \def\doinitializelinkregister#1% -% {} - -% todo ruwe register - %D Default index: \defineregister [\v!index] [\v!indices] -% \setupregister[index][koppeling=ja] -% -% \stelveldenin -% [register][achtergrond=raster,kader=uit] -% -% \stelvoettekstenin -% [{\field[index]}] -% -% \stelhoofdtekstenin -% [{\naar {first}[eersteindex]\quad -% \naar{previous}[vorigeindex]\quad -% \naar {next}[volgendeindex]\quad -% \naar {last}[laatsteindex]\quad\quad -% \naar {index}[index]}] -% -% \starttekst -% -% oeps~~~\gekoppeldeindex{oeps} \blanko -% flop~~~\gekoppeldeindex{flop} \blanko -% test~~~\gekoppeldeindex{test} \pagina -% flop~~~\gekoppeldeindex{flop} \blanko -% test~~~\gekoppeldeindex{test} \pagina -% oeps~~~\gekoppeldeindex{oeps} \blanko -% test~~~\gekoppeldeindex{test} \pagina -% flop~~~\gekoppeldeindex{flop} \blanko -% oeps~~~\gekoppeldeindex{oeps} \pagina -% -% \volledigeindex - \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/strc-ren.mkiv b/Master/texmf-dist/tex/context/base/strc-ren.mkiv index 3a60a34a380..73eb0ccd206 100644 --- a/Master/texmf-dist/tex/context/base/strc-ren.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-ren.mkiv @@ -15,10 +15,8 @@ \unprotect -\chardef\headtimingmode=0 +\newconstant\headtimingmode -% \chardef\headtimingmode=1 % 0 also works ok now too -% % Martin Kolarik's problem: % % \setuphead[section][command=\doTitle] @@ -32,7 +30,8 @@ \doif{\structureheadparameter\c!margintext}\v!yes\placemargincontent} \unexpanded\def\setupheadcomponentfont#1#2% - {\ifconditional\structureheadisdisplay + {\dontconvertfont + \ifconditional\structureheadisdisplay \edef\askedstructureheadinterlinespace{\structureheadparameter\c!interlinespace}% \ifx\askedstructureheadinterlinespace\empty % here the interline space is only set when style sets no space @@ -70,30 +69,25 @@ \ifconditional\fontattributeisset \setupspacing \fi - \fi - \dontconvertfont} + \fi} -\def\doplaceheadtextcomponent#1#2% +\def\doplaceheadtextcomponent#1% {\begingroup \setupheadcomponentfont\c!textstyle\c!textcolor - % \ifcase\headtimingmode#1\fi % can introduce cr \structureheadparameter\c!commandbefore \placeheadmargintexts + \ifcsname\??nh\currentstructurehead\c!deeptextcommand\endcsname + \expandafter\let\expandafter\deepstructuretitlecommand\csname\??nh\currentstructurehead\c!deeptextcommand\endcsname + \fi \ifconditional\structureheadisdisplay % \ifdisplaysectionhead - \structureheadparameter\c!textcommand% struts can be nilled with \setnostrut - {\setstrut - \begstrut - \ifcase\headtimingmode\hbox{#1}\fi - \executeifdefined{\??nh\currentstructurehead\c!deeptextcommand}\firstofoneargument{#2}% - \endstrut}% \hbox prevents break + % struts can be nilled with \setnostrut + \structureheadparameter\c!textcommand{\setstrut\begstrut#1\endstrut}% \xdef\localheadheight {\the\strutht}% \xdef\localheaddepth {\the\strutdp}% \xdef\localheadlineheight{\the\lineheight}% % == \globallet\localheaddepth\strutdepth \else - \ifcase\headtimingmode#1\fi - \structureheadparameter\c!textcommand - {\executeifdefined{\??nh\currentstructurehead\c!deeptextcommand}\firstofoneargument{#2}}% + \structureheadparameter\c!textcommand{#1}% \fi \structureheadparameter\c!commandafter \ifconditional\structureheadisdisplay % \ifdisplaysectionhead @@ -101,21 +95,18 @@ \fi \endgroup} -\def\doplaceheadnumbercomponent#1#2% +\def\doplaceheadnumbercomponent#1% {\begingroup \setupheadcomponentfont\c!numberstyle\c!numbercolor - % \getvalue{\??ko\currentstructurehead\c!commandbefore}% strange, why here? moved 21/11/2005 \placeheadmargintexts + \ifcsname\??nh\currentstructurehead\c!deepnumbercommand\endcsname + \expandafter\let\expandafter\deepstructurenumbercommand\csname\??nh\currentstructurehead\c!deeptextcommand\endcsname + \fi \ifconditional\structureheadisdisplay % \ifdisplaysectionhead % can be nilled with \setnostrut - \structureheadparameter\c!numbercommand - {\setstrut - \begstrut - \executeifdefined{\??nh\currentstructurehead\c!deepnumbercommand}\firstofoneargument{#2}% - \endstrut}% + \structureheadparameter\c!numbercommand{\setstrut\begstrut#1\endstrut}% \else - \structureheadparameter\c!numbercommand - {\executeifdefined{\??nh\currentstructurehead\c!deepnumbercommand}\firstofoneargument{#2}}% + \structureheadparameter\c!numbercommand{#1}% \fi \endgroup} @@ -123,45 +114,76 @@ % \newif\ifemptyhead % \newif\ifdisplaysectionhead -\def\structureheadattribute{\iflocation attr \destinationattribute \currentstructureattribute\fi} +\let\currentstructurereferenceattribute\attributeunsetvalue + +\def\structureheadreferenceattributes + {\iflocation + attr \destinationattribute \currentstructureattribute + attr \referenceattribute \currentstructurereferenceattribute + % attr \internalattribute \nextinternalreference + \fi} -\def\doplacestructureheadtext#1#2#3% nodes, text, endstuff +\def\setinlinestructureheadreferenceattributes + {\ifconditional\structureheadisdisplay \else \iflocation + \attribute\destinationattribute\currentstructureattribute + \attribute\referenceattribute \currentstructurereferenceattribute + % \attribute\internalattribute \nextinternalreference + \fi \fi} + +\def\docheckstructureheadreference + {\edef\currentstructureheadinteraction{\structureheadparameter\c!interaction}% + \ifx\currentstructureheadinteraction\v!list + % setuphead[
][interaction=list,...] + \dogetsimplepagereference{bck:\nextinternalreference}% + \let\currentstructurereferenceattribute\currentreferenceattribute + \else\ifx\currentstructureheadinteraction\v!reference + % setuphead[
][interaction=reference,...] start
[backreference=abc,...] + \edef\currentstructureheadbackreference{\structurevariable{references.backreference}}% + \ifx\currentstructureheadbackreference\empty \else + \dogetsimplepagereference\currentstructureheadbackreference + \let\currentstructurereferenceattribute\currentreferenceattribute + \fi + \else + % maybe auto: backreference when given, else list + \fi\fi} + +\unexpanded\def\placestructureheadtext {\beginheadplacement + \setstructureheadmarking \doresettructureheadnumbercontent \ifconditional\structureheadleaveempty - \setbox\sectionheadbox\ifvertical\vbox\else\hbox\fi \structureheadattribute to \zeropoint {#1}% + \setbox\sectionheadbox\ifvertical\vbox\else\hbox\fi \structureheadreferenceattributes to \zeropoint{}% \makestrutofbox\sectionheadbox \else - \setbox\sectionheadbox\ifvertical\vbox\else\hbox\fi \structureheadattribute - {\doresettructureheadnumbercontent - \ifcase\headtimingmode\or#1\fi % outerside font determines distance + \docheckstructureheadreference + \setbox\sectionheadbox\ifvertical\vbox\else\hbox\fi \structureheadreferenceattributes + {\dosetlocalgridsnapping{\structureheadparameter\c!internalgrid}% + \doresettructureheadnumbercontent \dosetfontattribute{\??nh\currentstructurehead}\c!style % but we don't want color to influence user command, todo: get the if-else out of it - \structureheadparameter\c!command{}{\doplaceheadtextcomponent{#1}{#2}}}% + \setinlinestructureheadreferenceattributes + \structureheadparameter\c!command{}{\doplaceheadtextcomponent\getstructureheadtitle}}% \fi - \endheadplacement{#3}} + \endheadplacement{\getstructureheadsyncs}} -\def\doplacestructureheadnumbertext#1#2#3#4% nodes number text nodes +\unexpanded\def\placestructureheadnumbertext {\beginheadplacement - \doiftextelse{#2}\dosettructureheadnumbercontent\doresettructureheadnumbercontent + \setstructureheadmarking + \doiftextelse{\getstructureheadnumber}\dosettructureheadnumbercontent\doresettructureheadnumbercontent \ifconditional\structureheadleaveempty - \setbox\sectionheadbox\ifvertical\vbox\else\hbox\fi \structureheadattribute to \zeropoint{#1}% + \setbox\sectionheadbox\ifvertical\vbox\else\hbox\fi \structureheadreferenceattributes to \zeropoint{}% \makestrutofbox\sectionheadbox \else % = needed - \setbox\sectionheadbox\ifvertical\vbox\else\hbox\fi \structureheadattribute - {\ifcase\headtimingmode\or#1\fi + \docheckstructureheadreference + \setbox\sectionheadbox\ifvertical\vbox\else\hbox\fi \structureheadreferenceattributes + {\dosetlocalgridsnapping{\structureheadparameter\c!internalgrid}% \dosetfontattribute{\??nh\currentstructurehead}\c!style - \structureheadparameter\c!command{\doplaceheadnumbercomponent{#1}{#2}}{\doplaceheadtextcomponent{#1}{#3}}}% + \setinlinestructureheadreferenceattributes + \structureheadparameter\c!command{\doplaceheadnumbercomponent\getstructureheadnumber}{\doplaceheadtextcomponent\getstructureheadtitle}}% \fi - \endheadplacement{#4}} - -\unexpanded\def\placestructureheadnumbertext - {\doplacestructureheadnumbertext\empty\getstructureheadnumber\getstructureheadtitle\getstructureheadsyncs} - -\unexpanded\def\placestructureheadtext - {\doplacestructureheadtext\empty\getstructureheadtitle\getstructureheadsyncs} + \endheadplacement{\getstructureheadsyncs}} \unexpanded\def\placestructureheadempty - {\hbox \structureheadattribute {\getstructureheadsyncs}} + {\hbox \structureheadreferenceattributes {\getstructureheadsyncs}} %D \starttyping %D \def\StretchedBox#1% @@ -214,7 +236,7 @@ \iflocation \ifconditional\structureheadisdisplay % \ifdisplaysectionhead \else - \noninterferingmarks + % obsolete: \noninterferingmarks \fi \fi \resetinteractionparameter\c!style @@ -353,11 +375,6 @@ \def\presetnumberheadalternative {\doifelsevalue{\??ns:\numberheadalternative}\v!horizontal\setfalse\settrue\structureheadisdisplay} -% \def\normalplacehead -% {\executeifdefined -% {\??ns::\numberheadalternative} -% {\getvalue{\??ns::\v!normal}}} - \def\normalplacehead {\csname\??ns::\ifcsname\??ns::\numberheadalternative\endcsname\numberheadalternative\else\v!normal\fi\endcsname} @@ -370,23 +387,6 @@ \fi #2}} -% \defineheadplacement[\v!normal][\v!vertical]#1#2% -% {\ifconditional\structureheadshownumber % \ifheadnumbercontent -% \setbox0\hbox{{#1}\hskip\numberheaddistance}% -% \vbox -% {\localheadsetup -% \hangindent 1\wd0 -% \hangafter 1 -% \noindent -% \unhbox0 % don't use \strut's here! -% #2}% -% \else -% \vbox -% {\localheadsetup\noindent#2}% -% \fi} -% -% enhanced version: - % \setuphead % [chapter] % [numberwidth=2cm,hang=line,after={\blank[3*line]}] @@ -400,7 +400,7 @@ \edef\headwidth {\structureheadparameter\c!width }% \edef\headnumberwidth{\structureheadparameter\c!numberwidth}% \edef\headtextwidth {\structureheadparameter\c!textwidth }% - \ifconditional\structureheadshownumber % \ifheadnumbercontent + \ifconditional\structureheadshownumber \ifx\headwidth\empty \else \ifx\headnumberwidth\empty @@ -444,8 +444,8 @@ {\localheadsetup \begstrut % use one \strut here! \dontleavehmode % in case there is no strut, else side effects with llap - \ifconditional\structureheadshownumber % \ifheadnumbercontent - \llap{\hbox to 5em{\hfill{#1}\hskip\localheadskip\hskip\leftmargindistance}}% introduces whitespace + \ifconditional\structureheadshownumber + \llap{\hbox{\hfill{#1}\hskip\localheadskip\hskip\leftmargindistance}}% introduces whitespace % maybe better: % \inleftmargin{\hbox{\hss{#1}\hskip\localheadskip}}% \fi @@ -460,7 +460,7 @@ \veryraggedcenter \let\\\endgraf \let\crlf\endgraf - \ifconditional\structureheadshownumber % \ifheadnumbercontent + \ifconditional\structureheadshownumber \strut#1\par \fi \begstrut#2}} @@ -468,14 +468,14 @@ \defineheadplacement[\v!text][\v!horizontal]#1#2% {\bgroup \localheadsetup % no stretch in distance - \ifconditional\structureheadshownumber % \ifheadnumbercontent + \ifconditional\structureheadshownumber {#1}\kern\numberheaddistance \fi {\begstrut#2}% \egroup} \unexpanded\def\placeheadlohi#1#2#3% - {\ifconditional\structureheadshownumber % \ifheadnumbercontent + {\ifconditional\structureheadshownumber \setbox0\hbox{#2} \setbox2=#1{\localheadsetup\advance\hsize-\wd0\relax#3}% \hbox{\box0\hskip\numberheaddistance\box2}% @@ -489,4 +489,24 @@ \defineheadplacement[\v!bottom][\v!vertical]#1#2{\placeheadlohi\vbox{#1}{#2}} \defineheadplacement[\v!top] [\v!vertical]#1#2{\placeheadlohi\vtop{#1}{#2}} +% helpers + +% \defineinmargin [ChapterInMargin] [outer] [normal] [distance=0.3em] +% +% \defineheadplacement[MyTest][horizontal]#1#2% +% {\startlocalheadsetup +% %\ChapterInMargin{\structureheadhbox{\strut#2}}% proper destination, ref okay +% \ChapterInMargin{\strut#2}% zero destination, ref okay +% \stoplocalheadsetup} +% +% \setuphead +% [chapter] +% [alternative=MyTest] + +\unexpanded\def\structureheadhbox{\hbox\structureheadreferenceattributes} +\unexpanded\def\structureheadvbox{\vbox\structureheadreferenceattributes} + +\unexpanded\def\startlocalheadsetup{\bgroup\localheadsetup} +\unexpanded\def\stoplocalheadsetup {\egroup} + \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/strc-sbe.mkiv b/Master/texmf-dist/tex/context/base/strc-sbe.mkiv index 206ac8a9c4f..e9d8d9c1ae1 100644 --- a/Master/texmf-dist/tex/context/base/strc-sbe.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-sbe.mkiv @@ -56,31 +56,37 @@ \setvalue {\e!start#2}{\startstructureblock[#1]}% \setvalue {\e!stop #2}{\stopstructureblock}} +\ifdefined \resetallstructuremarks \else + \let\resetallstructuremarks\relax +\fi + \appendtoks \doifsomething{\structureblockparameter\c!page}{\page[\structureblockparameter\c!page]}% -% TODO \resetsectionmarks\zerosection + \resetallstructuremarks \getstructureblockenvironment\currentstructureblock \structureblockparameter\c!before % don't move + \dostarttagged\t!division\currentstructureblock \to \everybeforestructureblock \appendtoks \structureblockparameter\c!after % don't move \doifsomething{\structureblockparameter\c!page}{\page[\structureblockparameter\c!page]}% -% TODO \resetsectionmarks\zerosection + \dostoptagged + \resetallstructuremarks \to \everyafterstructureblock \def\dosetupstructureblock[#1]% {\getparameters[\??nb#1]}% [#2] \def\dosetstructureblock[#1]% used to set the default - {\edef\currentstructureblock{\ctxlua{structure.sections.setblock("#1")}}} + {\edef\currentstructureblock{\ctxlua{structures.sections.setblock("#1")}}} \let\currentstructureblock\s!unknown \unexpanded\def\startstructureblock[#1]% - {%\ctxlua{structure.counters.check(0)}% we assume sane usage of \page, as this is the only workable place (in push) + {%\ctxlua{structures.counters.check(0)}% we assume sane usage of \page, as this is the only workable place (in push) \begingroup - \edef\currentstructureblock{\ctxlua{structure.sections.pushblock("#1")}}% + \edef\currentstructureblock{\ctxlua{structures.sections.pushblock("#1")}}% \csname #1true\endcsname % for old times sake \setsystemmode\currentstructureblock \the\everybeforestructureblock\relax @@ -89,7 +95,7 @@ \unexpanded\def\stopstructureblock {\showmessage\m!structures2\currentstructureblock \the\everyafterstructureblock\relax - \edef\currentstructureblock{\ctxlua{structure.sections.popblock()}}% + \edef\currentstructureblock{\ctxlua{structures.sections.popblock()}}% \endgroup} \long\def\setstructureblockenvironment#1#2% diff --git a/Master/texmf-dist/tex/context/base/strc-sec.mkiv b/Master/texmf-dist/tex/context/base/strc-sec.mkiv index 35927d98a00..6cb6f84c142 100644 --- a/Master/texmf-dist/tex/context/base/strc-sec.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-sec.mkiv @@ -15,6 +15,8 @@ \unprotect +\ifdefined \v!block \else \def\v!block{block} \fi + % compatibility issue: % % \def\setfullsectionnumber #1{} @@ -41,25 +43,26 @@ % lua interface / names and interface might change -\def\setstructurelevel #1#2{\ctxlua{structure.sections.setlevel("#1","#2")}} % name, level|parent -\def\getstructurelevel #1{\ctxlua{structure.sections.getcurrentlevel("#1")}}% name -\def\setstructurenumber #1#2{\ctxlua{structure.sections.setnumber(#1,"#2")}} % level, number (+/-) -\def\getstructurenumber #1{\ctxlua{structure.sections.getnumber(#1)}} % level -\def\getsomestructurenumber #1#2{\ctxlua{structure.sections.getnumber(#1,"#2")}} % level, what -\def\getfullstructurenumber #1{\ctxlua{structure.sections.fullnumber(#1)}} % level -\def\getsomefullstructurenumber#1#2{\ctxlua{structure.sections.fullnumber(#1,"#2")}} -\def\getspecificstructuretitle #1{\ctxlua{structure.sections.structuredata(#1,"titledata.title",nil,"\structureheadparameter\s!catcodes")}}% +\def\setstructurelevel #1#2{\ctxlua{structures.sections.setlevel("#1","#2")}} % name, level|parent +\def\getstructurelevel #1{\ctxlua{structures.sections.getcurrentlevel("#1")}}% name +\def\setstructurenumber #1#2{\ctxlua{structures.sections.setnumber(#1,"#2")}} % level, number (+/-) +\def\getstructurenumber #1{\ctxlua{structures.sections.getnumber(#1)}} % level +\def\getsomestructurenumber #1#2{\ctxlua{structures.sections.getnumber(#1,"#2")}} % level, what +\def\getfullstructurenumber #1{\ctxlua{structures.sections.fullnumber(#1)}} % level +\def\getsomefullstructurenumber#1#2{\ctxlua{structures.sections.fullnumber(#1,"#2")}} +\def\getspecificstructuretitle #1{\ctxlua{structures.sections.structuredata(#1,"titledata.title",nil,"\structureheadparameter\s!catcodes")}}% % interface -\def\structureheadparameter #1{\csname\dostructureheadparameter{\??nh\currentstructurehead}#1\endcsname} -\def\structureheadparameterhash#1{\dostructureheadparameterhash {\??nh\currentstructurehead}#1} +\def\structureheadparameter #1{\csname\dostructureheadparameter{\??nh\currentstructurehead}{#1}\endcsname} +\def\structureheadparameterhash #1{\dostructureheadparameterhash {\??nh\currentstructurehead}{#1}} +\def\namedstructureheadparameter#1#2{\csname\dostructureheadparameter{\??nh#1}{#2}\endcsname} -\def\dostructureheadparameter #1#2{\ifcsname#1#2\endcsname#1#2\else\expandafter\dostructureheadparentparameter \csname#1\s!parent\endcsname#2\fi} -\def\dostructureheadparameterhash#1#2{\ifcsname#1#2\endcsname #1\else\expandafter\dostructureheadparentparameterhash\csname#1\s!parent\endcsname#2\fi} +\def\dostructureheadparameter #1#2{\ifcsname#1#2\endcsname#1#2\else\expandafter\dostructureheadparentparameter \csname#1\s!parent\endcsname{#2}\fi} +\def\dostructureheadparameterhash#1#2{\ifcsname#1#2\endcsname #1\else\expandafter\dostructureheadparentparameterhash\csname#1\s!parent\endcsname{#2}\fi} -\def\dostructureheadparentparameter #1#2{\ifx#1\relax\s!empty\else\dostructureheadparameter #1#2\fi} -\def\dostructureheadparentparameterhash#1#2{\ifx#1\relax \else\dostructureheadparameterhash#1#2\fi} +\def\dostructureheadparentparameter #1#2{\ifx#1\relax\s!empty\else\dostructureheadparameter #1{#2}\fi} +\def\dostructureheadparentparameterhash#1#2{\ifx#1\relax \else\dostructureheadparameterhash#1{#2}\fi} \def\structureheadparameterstrict#1{\csname\ifcsname\??nh\currentstructurehead#1\endcsname\??nh\currentstructurehead#1\else\s!empty\fi\endcsname} @@ -75,28 +78,64 @@ \let\laststructuresectionname\empty +\let\resetallstructuremarks \relax +\let\resetcurrentstructuremarks \relax +\let\resetcurrentstructuremarkswithpage\relax + +\def\resetallstructuremarks {\resetmarking[\v!section-1]} % will become option +\def\resetcurrentstructuremarks {\resetmarking[\laststructuresectionname]} % will become option +%def\resetcurrentstructuremarkswithpage{\resetmarking[\laststructuresectionname]} % will become option + +% \c!before=, +% \c!after=, +% \c!distance=\zeropoint, +% \c!page=, +% \c!header=, +% \c!text=, +% \c!footer=, +% \c!numbercommand=, +% \c!textcommand=, +% \c!ownnumber=\v!no, +% \c!number=\v!yes, +% \c!file=, +% \c!expansion=, +% \c!grid=, +% \c!margintext=, +% +% \c!xmlsetup=, +% \s!catcodes=, + +\newtoks\everydefinestructuresection + +\appendtoks + % This is a rather practical default that we don't want to + % be part of the parent chain lookup mechanism; it's also + % mkii compatible. Somewhat weird that it's part of the + % top level structure but it will be flattened anyway. + \getparameters[\??nh\currentstructuresection] + [ \c!textstyle=\structureheadparameterstrict\c!style, + \c!textcolor=\structureheadparameterstrict\c!color, + \c!numberstyle=\structureheadparameterstrict\c!style, + \c!numbercolor=\structureheadparameterstrict\c!color]% +\to \everydefinestructuresection + \unexpanded\def\definestructuresection[#1]% - {\doifundefined{\??nh#1} - {\global\advance\maxstructuredepth\plusone - \setevalue{\??nh#1\c!level}{\the\maxstructuredepth}% - \setstructurelevel{#1}{\the\maxstructuredepth}% -% \letvalue{\??nh#1\c!marking}\empty % ? - %\writestatus{structure}{#1\ifx\laststructuresectionname\empty\else\space->\space\laststructuresectionname\fi}% - \normalexpanded{\noexpand\getparameters[\??nh#1][\s!parent=\??nh\laststructuresectionname]}% - % this is a rather practical default that we don't want to be part of the parent chain - % lookup mechanism; it's also mkii compativle; this might become \everystructureheaddefine - \getparameters[\??nh#1] - [ \c!textstyle=\structureheadparameterstrict\c!style, - \c!textcolor=\structureheadparameterstrict\c!color, - \c!numberstyle=\structureheadparameterstrict\c!style, - \c!numbercolor=\structureheadparameterstrict\c!color]% - % so far for these default inheritances - \definemarking[#1]% - \ifnum\maxstructuredepth>\plusone -% \normalexpanded{\noexpand\couplemarking[#1][\laststructuresectionname]}% so, the child inherits settings from the parent - \normalexpanded{\noexpand\relatemarking[#1][\laststructuresectionname]}% so, the parent will reset the child - \fi - \xdef\laststructuresectionname{#1}}} + {\ifcsname\??nh#1\endcsname + % redefinition is a rather fatal error + \else + \edef\currentstructuresection{#1}% + \global\advance\maxstructuredepth\plusone + \setevalue{\??nh#1\c!level}{\the\maxstructuredepth}% + \setstructurelevel{#1}{\the\maxstructuredepth}% + \normalexpanded{\noexpand\getparameters[\??nh#1][\s!parent=\??nh\laststructuresectionname]}% + \the\everydefinestructuresection + % so far for these default inheritances + \definemarking[#1]% + \ifnum\maxstructuredepth>\plusone + \normalexpanded{\noexpand\relatemarking[#1][\laststructuresectionname]}% so, the parent will reset the child + \fi + \xdef\laststructuresectionname{#1}% + \fi} \unexpanded\def\setupstructuresection {\dotripleempty\dosetupstructuresection} @@ -113,10 +152,14 @@ \getparameters[\??nh#1][#2]% \fi} +% -2=text -1=manual 0=block 1+=structurelevel + \def\structuresectionlevel#1% {\executeifdefined{\??nh#1\c!level}{-1}} -\setvalue{\??nh block\c!level}{0} % -1 == manual +\setvalue{\??nh\v!block\c!level}{0} +\setvalue{\??nh\v!none \c!level}{-1} +\setvalue{\??nh\v!text \c!level}{-2} % head -> structurehead @@ -166,30 +209,24 @@ \edef\currentstructureheaddefault{\structureheadparameter\c!default}% \edef\currentstructureheadsection{\structureheadparameter\c!section}% \edef\currentstructureheadparent - {\??nh - \ifx\currentstructurehead\currentstructureheaddefault + {\ifx\currentstructurehead\currentstructureheaddefault \currentstructureheadsection \else\ifx\currentstructureheaddefault\empty \currentstructureheadsection \else \currentstructureheaddefault \fi\fi}% - \normalexpanded{\noexpand\getparameters[\??nh#1][\s!parent=\currentstructureheadparent]}% \setevalue{\??nh#1\s!parent}{\currentstructureheadparent}% - \ifx\currentstructureheadsection\empty - %\writestatus{structure}{#1->\currentstructureheadparent}% - \else - %\writestatus{structure}{#1->\currentstructureheadparent\space(\currentstructureheadsection)}% - % todo: filtercommand - \definemarking[#1][\currentstructureheadsection]% - \definemarking[#1\v!number][#1]% - \setupmarking[#1][\c!filtercommand=\sectionheadmarkingtitle{#1}]% - \setupmarking[#1\c!number][\c!filtercommand=\sectionheadmarkingnumber{#1}]% - \fi + \normalexpanded{\noexpand\getparameters[\??nh#1][\s!parent=\??nh\currentstructureheadparent]}% + % or just \setevalue{\??nh#1\s!parent}{\??nh\currentstructureheadparent}% + \definemarking[#1] [\currentstructureheadsection]% + \definemarking[#1\v!number][\currentstructureheadsection]% + \setupmarking [#1] [\c!filtercommand=\sectionheadmarkingtitle {#1}]% + \setupmarking [#1\c!number][\c!filtercommand=\sectionheadmarkingnumber{#1}]% \doifundefined{\??li#1}{\definelist[#1][\c!prefix=\v!no]}% definestructurelist ? \the\everystructureheadsetup} -\def\sectionheadmarkingtitle #1#2{\ctxlua{structure.marks.title("#1","#2")}} -\def\sectionheadmarkingnumber#1#2{\ctxlua{structure.marks.number("#1","#2")}} +\def\sectionheadmarkingtitle #1#2{\ctxlua{structures.marks.title("#1","#2")}} +\def\sectionheadmarkingnumber#1#2{\ctxlua{structures.marks.number("#1","#2")}} \def\dodefineclonedstructurehead#1#2% class parent {\def\currentstructurehead{#1}% @@ -198,20 +235,19 @@ {\getparameters[\??nh#1][\c!label=#1]% \doifundefined{\??li#1}{\definelist[#1][\c!prefix=\v!no]}}% definestructurelist ? {\getparameters[\??nh#1][\s!parent=\??nh#2,\c!label=#1,\c!coupling=#2]% - \definemarking[#1][#2]% + \definemarking[#1] [#2]% \definemarking[#1\v!number][#2\c!number]% \doifundefined{\??li#1}{\definelist[#1][#2][\c!prefix=\v!no]}}% definestructurelist ? \the\everystructureheadsetup} \appendtoks -% \setstructurelevel\currentstructurehead{\structuresectionheadsection{\structuresectionheadcoupling\currentstructurehead}}% \setstructurelevel\currentstructurehead{\thenamedstructureheadlevel\currentstructurehead}% \doifelse{\structureheadparameter\c!ownnumber}\v!yes - {\setevalue\currentstructurehead{\noexpand\dohandlestructureheadown[\currentstructurehead]}} - {\setevalue\currentstructurehead{\noexpand\dohandlestructureheadnop[\currentstructurehead]}}% - \setevalue{\e!next \currentstructurehead}{\noexpand\donextstructurehead [\currentstructurehead]}% - \setevalue{\e!start\currentstructurehead}{\noexpand\dostartstructurehead[\currentstructurehead]}% - \setevalue{\e!stop \currentstructurehead}{\noexpand\dostopstructurehead [\currentstructurehead]}% + {\setevalue\currentstructurehead{\dohandlestructureheadown[\currentstructurehead]}} + {\setevalue\currentstructurehead{\dohandlestructureheadnop[\currentstructurehead]}}% + \setevalue{\e!next \currentstructurehead}{\donextstructurehead [\currentstructurehead]}% + \setevalue{\e!start\currentstructurehead}{\dostartstructurehead[\currentstructurehead]}% + \setevalue{\e!stop \currentstructurehead}{\dostopstructurehead [\currentstructurehead]}% \to \everystructureheadsetup % todo, check if section is defined @@ -228,36 +264,49 @@ % head construction -\def\dohandlestructureheadown{\dodoubleempty\dodohandlestructureheadown} % [ref] {nr} {title} -\def\dohandlestructureheadnop{\dodoubleempty\dodohandlestructureheadnop} % [ref] {title} -\def\dostartstructurehead {\dotripleempty\dodostartstructurehead} % [settings] [userdata] +\unexpanded\def\dohandlestructureheadown{\dodoubleempty\dodohandlestructureheadown} % [ref] {nr} {title} +\unexpanded\def\dohandlestructureheadnop{\dodoubleempty\dodohandlestructureheadnop} % [ref] {title} +\unexpanded\def\dostartstructurehead {\dotripleempty\dodostartstructurehead} % [settings] [userdata] \newconditional\currentstructureown -\def\dodohandlestructureheadown[#1][#2]#3#4% +\newtoks\everybeforestructurehead % hook, todo: before/after keys +\newtoks\everyafterstructurehead % hook, todo: before/after keys + +\unexpanded\def\dodohandlestructureheadown[#1][#2]#3#4% {\settrue\currentstructureown \dohandlestructurehead{#1}{\c!reference={#2},\c!ownnumber={#3},\c!title={#4}}{}} % name ref nr title -- -\def\dodohandlestructureheadnop[#1][#2]#3% +% \unexpanded\def\dodohandlestructureheadnop[#1][#2]#3% +% {\setfalse\currentstructureown +% \dohandlestructurehead{#1}{\c!reference={#2},\c!title={#3}}{}} % name ref nr title -- + +\unexpanded\def\dodohandlestructureheadnop[#1][#2]% for taco: [key=value] variant {\setfalse\currentstructureown - \dohandlestructurehead{#1}{\c!reference={#2},\c!title={#3}}{}} % name ref nr title -- + \doifassignmentelse{#2}\dodohandlestructureheadnopA\dodohandlestructureheadnopB{#1}{#2}} -\newtoks\everybeforestructurehead % hook, todo: before/after keys -\newtoks\everyafterstructurehead % hook, todo: before/after keys +\unexpanded\def\dodohandlestructureheadnopA#1#2% + {\dohandlestructurehead{#1}{#2}{}} + +\unexpanded\def\dodohandlestructureheadnopB#1#2#3% + {\dohandlestructurehead{#1}{\c!reference={#2},\c!title={#3}}{}} % name ref nr title -- -\def\dodostartstructurehead[#1][#2][#3]% for the moment no grouping, too annoying with page breaks +\unexpanded\def\dodostartstructurehead[#1][#2][#3]% for the moment no grouping, too annoying with page breaks {\setfalse\currentstructureown %\globalpushmacro\currentstructurehead \xdef\currentstructurehead{#1}% + \structureheadparameter\c!beforesection \the\everybeforestructurehead - \dohandlestructurehead{#1}{#2}{#3}} % name -- -- -- userdata + \dohandlestructurehead{#1}{#2}{#3}} % name -- -- -- userdata (we might move the tagged to here) -\def\dostopstructurehead[#1]% - {%\globalpopmacro\currentstructurehead +\unexpanded\def\dostopstructurehead[#1]% + {\dostoptagged\dostoptagged + %\globalpopmacro\currentstructurehead \xdef\currentstructurehead{#1}% recover + \structureheadparameter\c!aftersection \the\everyafterstructurehead} -\def\donextstructurehead[#1][#2][#3]% +\unexpanded\def\donextstructurehead[#1][#2][#3]% {\setfalse\currentstructureown \xdef\currentstructurehead{#1}% \dohandlestructurehead{#1}{#2}{#3}} % name -- -- -- userdata @@ -275,22 +324,35 @@ \let\structureheadprefix\empty \def\structureheadprefixplus{+} % When do we reset the referenceprefix? This needs to be checked. Does it work -% at all? +% at all? Todo: pushpop. + +% \def\setstructureheadreference +% {\edef\structureheadreference {\structureheadparameter\c!reference}% +% \edef\structureheadreferenceprefix{\structureheadparameter\c!prefix}% +% \ifx\structureheadreferenceprefix\empty +% \ifx\currentrefenceprefix\structureheadreferenceprefixplus +% \setupreferenceprefix[]% yes or no? only when set by structure +% \fi +% \else\ifx\structureheadreferenceprefix\structureheadreferenceprefixplus +% \ifx\structureheadreference\empty +% \expanded{\setupreferenceprefix[\structureheadreferenceprefixplus]}% +% \else +% \expanded{\setupreferenceprefix[\structureheadreference]}% we assume just one reference +% \fi +% \else +% \expanded{\setupreferenceprefix[\structureheadreferenceprefix]}% +% \fi\fi} -\def\setstructureheadreference#1% reference - {\edef\structureheadreference{#1}% +% pop in stopsection commands unless empty + +\def\setstructureheadreference + {\edef\structureheadreference {\structureheadparameter\c!reference}% \edef\structureheadreferenceprefix{\structureheadparameter\c!prefix}% \ifx\structureheadreferenceprefix\empty - \setupreferenceprefix[]% yes or no? - \else\ifx\structureheadreferenceprefix\structureheadreferenceprefixplus - \ifx\structureheadreference\empty - \setupreferenceprefix[\structureheadreferenceprefixplus] - \else - \setupreferenceprefix[#1]% we assume just one reference - \fi + \let\structureheadreferenceprefix\referenceprefix \else - \setupreferenceprefix[\structureheadreferenceprefix]% - \fi\fi} + \setupreferenceprefix[\structureheadreferenceprefix]% currenty no pop + \fi} \setvalue{\??nh:\c!incrementnumber:\v!yes }{\settrue \structureheaddoincrement\settrue \structureheadtolist} \setvalue{\??nh:\c!incrementnumber:\v!no }{\setfalse\structureheaddoincrement\setfalse\structureheadtolist} @@ -314,16 +376,41 @@ % use : \currentstructureheadincrement as spec \fi} +% \def\setstructureheadplacement +% {\setfalse\structureheadleaveempty +% \settrue \structureheaddoplace +% \setfalse\structureheadhidden +% \processaction +% [\structureheadparameter\c!placehead] +% [ \v!yes=>, +% \v!empty=>\settrue\structureheadleaveempty, +% \v!no=>\settrue\structureheadleaveempty\setfalse\structureheaddoplace, +% \v!hidden=>\settrue\structureheadleaveempty\setfalse\structureheaddoplace\settrue\structureheadhidden]} + +\setvalue{\??nh:\c!placehead:\v!yes}% + {\setfalse\structureheadleaveempty + \settrue \structureheaddoplace + \setfalse\structureheadhidden} + +\setvalue{\??nh:\c!placehead:\v!empty}% + {\settrue \structureheadleaveempty + \settrue \structureheaddoplace + \setfalse\structureheadhidden} + +\setvalue{\??nh:\c!placehead:\v!no}% + {\settrue \structureheadleaveempty + \setfalse\structureheaddoplace + \setfalse\structureheadhidden} + +\setvalue{\??nh:\c!placehead:\v!hidden}% + {\settrue \structureheadleaveempty + \setfalse\structureheaddoplace + \settrue \structureheadhidden} + \def\setstructureheadplacement - {\settrue\structureheaddoplace - \setfalse\structureheadleaveempty - \setfalse\structureheadhidden - \processaction - [\structureheadparameter\c!placehead] - [ \v!yes=>, - \v!empty=>\settrue\structureheadleaveempty, - \v!no=>\settrue\structureheadleaveempty\setfalse\structureheaddoplace, - \v!hidden=>\settrue\structureheadhidden\settrue\structureheadleaveempty\setfalse\structureheaddoplace]} + {\executeifdefined + {\??nh:\c!placehead:\structureheadparameter\c!placehead} + {\getvalue{\??nh:\c!placehead:\v!yes}}} \def\setstructureheaddisplay {\doifelsevalue{\??nh:\structureheadparameter\c!alternative}\v!horizontal @@ -351,15 +438,38 @@ \unexpanded\def\thestructureheadsynchonization {\pagetype[\currentstructureheadcoupling]% hm also number - \normalexpanded{\noexpand\setmarking[\currentstructureheadcoupling]{\currentstructurelistnumber}}% \currentstructuresynchronize} -\unexpanded\def\fullstructureheadnumber{\labeltexts{\structureheadparameter\c!label}{\structurenumber}} % todo +\unexpanded\def\setstructureheadmarking + {\normalexpanded{\noexpand\setmarking[\currentstructurehead]{\currentstructurelistnumber}}} +% \unexpanded\def\fullstructureheadnumber{\labeltexts{\structureheadparameter\c!label}{\structurenumber}} % todo % \def\fullstructureheadtitle {\structurevariable{titledata.title}} % no catcode! % \unexpanded\def\fullstructureheadtitle{\structureautocatcodedget{titledata.title}{\structureheadparameter\s!catcodes}} -\unexpanded\def\fullstructureheadtitle{\ctxlua{structure.sections.title()}} +\let\deepstructurenumbercommand\relax +\let\deepstructuretitlecommand \relax + +\unexpanded\def\fullstructureheadnumber + {\edef\currentstructureheadlabeltag{\currentstructureblock\c!label}% + \dostarttagged\t!sectionnumber\empty + \labeltexts + {\structureheadparameter\currentstructureheadlabeltag} + {\ifx\deepstructurenumbercommand\relax + \structurenumber + \else + \normalexpanded{\noexpand\deepstructurenumbercommand{\structurenumber}}% + \fi}% + \dostoptagged} + +\unexpanded\def\fullstructureheadtitle + {\dostarttagged\t!sectiontitle\empty + \ifx\deepstructuretitlecommand\relax + \structuretitle + \else + \normalexpanded{\noexpand\deepstructuretitlecommand{\structuretitle}}% + \fi + \dostoptagged} \let\currentstructurehead \empty \let\currentstructureheadcoupling\empty @@ -367,9 +477,12 @@ \let\currentstructureheadlevel \!!zerocount \let\currentstructureheadcounter \!!zerocount +% here we could inherit as well but it's a bit complex + \def\doregisterstructurehead#1#2#3% name data userdata {\structurecomponent - [\c!label={\structureheadparameter\c!label}, + %[\c!label={\structureheadparameter\c!label}, % why { } + [\c!label={\structureheadparameter{\currentstructureblock\c!label}}, \c!incrementnumber=\ifconditional\structureheaddoincrement\v!yes\else\v!no\fi, % not that needed \c!saveinlist=\ifconditional\structureheadtolist\v!yes\else\v!no\fi, \c!level=\currentstructureheadlevel, @@ -391,10 +504,11 @@ \c!sectionsegments=\structureheadparameter\c!sectionsegments, \c!reference=\structureheadreference, \c!referenceprefix=\structureheadreferenceprefix, + \c!backreference=, \c!command=, #2]% [#3]% - \reportcurrentstructure} + \reportcurrentstructure} \unexpanded\def\placeheadtext {\dosingleempty\doplaceheadtext } % use with care \unexpanded\def\placeheadnumber{\dosingleempty\doplaceheadnumber} % use with care @@ -402,9 +516,9 @@ \ifdefined\setupheadcomponentfont \else \unexpanded\def\setupheadcomponentfont#1#2% - {\dosetstructureheadattributes\c!style\c!color + {\dontconvertfont + \dosetstructureheadattributes\c!style\c!color \dosetstructureheadattributes#1#2% - \dontconvertfont \setupinterlinespace} \fi @@ -431,14 +545,14 @@ \ifdefined \else \let\presetnumberheadalternative\relax \fi -\def\dohandlestructurehead#1#2#3% name data userdata +\def\dohandlestructurehead#1#2#3% name data userdata (we can move #1 to the caller) {\xdef\currentstructurehead {#1}% \xdef\currentstructureheadcoupling{\structuresectionheadcoupling\currentstructurehead}% \xdef\currentstructureheadsection {\structuresectionheadsection \currentstructureheadcoupling}% \xdef\currentstructureheadlevel {\structuresectionlevel \currentstructureheadsection}% - %writestatus\m!systems{setup: \currentstructurehead,\currentstructureheadcoupling,\currentstructureheadsection,\currentstructureheadlevel}% + %writestatus\m!system{setup: \currentstructurehead,\currentstructureheadcoupling,\currentstructureheadsection,\currentstructureheadlevel}% % - \setstructureheadreference{#3}% will change + \setstructureheadreference % does not do much currently \setstructureheadincrement \setstructureheadplacement \setstructureheaddisplay @@ -451,7 +565,7 @@ % % we might remove the lower level % - % not here, after optional \page: \doregisterstructurehead{#1}{#2}{#3}% + % not here, after optional \page: \doregisterstructurehead\currentstructurehead{#2}{#3}% % % \xdef\currentstructureheadcounter{\currentstructurecounter}% lua call % @@ -467,7 +581,7 @@ \ifconditional\structureheaddoincrement \ifconditional\structureheaddoplace \dostructureheadspacingbeforeyes - \doregisterstructurehead{#1}{#2}{#3}% after optional \page + \doregisterstructurehead\currentstructurehead{#2}{#3}% after optional \page \let\getstructureheadsyncs\thestructureheadsynchonization \let\getstructureheadtitle\fullstructureheadtitle \ifconditional\structureheadshownumber @@ -478,12 +592,12 @@ \fi \dostructureheadspacingafteryes \else\ifconditional\structureheadhidden - \doregisterstructurehead{#1}{#2}{#3}% after optional \page + \doregisterstructurehead\currentstructurehead{#2}{#3}% after optional \page \let\getstructureheadsyncs\thestructureheadsynchonization \placestructureheadhidden % only something when tracing \else \dostructureheadspacingbeforenop % toegevoegd ivm subpaginanr / tug sheets - \doregisterstructurehead{#1}{#2}{#3}% after optional \page + \doregisterstructurehead\currentstructurehead{#2}{#3}% after optional \page \let\getstructureheadsyncs\thestructureheadsynchonization \placestructureheadempty % just flush 'm \dostructureheadspacingafternop @@ -491,19 +605,19 @@ \else \ifconditional\structureheaddoplace \dostructureheadspacingbeforeyes - \doregisterstructurehead{#1}{#2}{#3}% after optional \page + \doregisterstructurehead\currentstructurehead{#2}{#3}% after optional \page \let\getstructureheadsyncs\thestructureheadsynchonization \let\getstructureheadtitle\fullstructureheadtitle \placestructureheadtext \dostructureheadspacingafteryes \else\ifconditional\structureheadhidden - \doregisterstructurehead{#1}{#2}{#3}% after optional \page + \doregisterstructurehead\currentstructurehead{#2}{#3}% after optional \page \let\getstructureheadsyncs\thestructureheadsynchonization \placestructureheadhidden % only something when tracing \else % do nothing / should be vbox to 0pt \dostructureheadspacingbeforenop - \doregisterstructurehead{#1}{#2}{#3}% after optional \page + \doregisterstructurehead\currentstructurehead{#2}{#3}% after optional \page \let\getstructureheadsyncs\thestructureheadsynchonization \placestructureheadempty % just flush 'm \dostructureheadspacingafternop @@ -512,6 +626,7 @@ \flushingcolumnfloatstrue \setfalse\ignorehandlepagebreak % ignorespaces prevents spaces creeping in when after=\dontleavehmode + \dostarttagged\t!sectioncontent\empty \ifconditional\structureheadisdisplay % \ifdisplaysectionhead \ignorespaces \else @@ -521,19 +636,23 @@ % typesetting \unexpanded\def\placestructureheadnumbertext % dummy, will be overloaded - {\getstructureheadnumber/\getstructureheadtitle + {\setstructureheadmarking + \getstructureheadnumber/\getstructureheadtitle \getstructureheadsyncs} \unexpanded\def\placestructureheadtext % dummy, will be overloaded - {\getstructureheadtitle + {\setstructureheadmarking + \getstructureheadtitle \getstructureheadsyncs} \unexpanded\def\placestructureheadempty % dummy, will be overloaded - {\getstructureheadsyncs} + {\setstructureheadmarking + \getstructureheadsyncs} \unexpanded\def\placestructureheadhidden {\setxvalue{\currentstructurehead:sync}% - {\noexpand\pagetype[\currentstructureheadcoupling]% hm also number + {\noexpand\setgvalue{\currentstructurehead:sync}{}% + \noexpand\pagetype[\currentstructureheadcoupling]% hm also number \noexpand\setmarking[\currentstructureheadcoupling]{\currentstructurelistnumber}% \currentstructuresynchronize}} @@ -562,13 +681,15 @@ \def\dostructureheadspacingbeforeyes {\docheckstructureheadbefore - \dohandlestructureheadpagebreak - \structureheadparameter\c!inbetween} + \dohandlestructureheadpagebreakyes + \structureheadparameter\c!inbetween + \dostarttagged\t!section\currentstructurehead} \def\dostructureheadspacingbeforenop {\docheckstructureheadbefore - \docheckstructureheadlayout - \structureheadparameter\c!inbetween} + \dohandlestructureheadpagebreaknop + \structureheadparameter\c!inbetween + \dostarttagged\currentstructurehead\empty} % \def\emptystructureheadcorrection % {\ifconditional\structureheadleaveempty % inlined \emptyheadcorrection (with after=\blank) @@ -625,17 +746,33 @@ {\doifsomething{\structureheadparameter#2}{\expanded{\setuplayouttext[#1][\c!state=\structureheadparameter#2]}}} \donothing} +\setvalue{\??nh:\??mk:n:\v!page }{} +\setvalue{\??nh:\??mk:n:\v!reset}{\resetcurrentstructuremarks} +\setvalue{\??nh:\??mk:y:\v!page }{} % to be checked: {\resetcurrentstructuremarks} +\setvalue{\??nh:\??mk:y:\v!reset}{\resetcurrentstructuremarks} + \def\docheckstructureheadlayout - {\doifsomething{\structureheadparameter\c!page} + {\doifelsenothing{\structureheadparameter\c!page} + {\getvalue{\??nh:\??mk:n:\structureheadparameter\c!marking}} {\page[\structureheadparameter\c!page]% + \getvalue{\??nh:\??mk:y:\structureheadparameter\c!marking}% \dodocheckstructureheadlayout\v!header\c!header \dodocheckstructureheadlayout\v!text \c!text \dodocheckstructureheadlayout\v!footer\c!footer}} -\def\currentstructurecounter {\ctxlua{structure.sections.depthnumber(\thenamedstructureheadlevel\currentstructurehead)}} -\def\previousstructurecounter{\ctxlua{structure.sections.depthnumber(\thenamedstructureheadlevel\currentstructurehead-1)}} +\def\currentstructurecounter {\ctxlua{structures.sections.depthnumber(\thenamedstructureheadlevel\currentstructurehead)}} +\def\previousstructurecounter{\ctxlua{structures.sections.depthnumber(\thenamedstructureheadlevel\currentstructurehead-1)}} -\def\dohandlestructureheadpagebreak +\def\dohandlestructureheadpagebreaknop + {\doifelse{\structureheadparameter\c!continue}\v!yes + {\ifnum\previousstructurecounter=\zerocount + \docheckstructureheadlayout + \else\ifnum\currentstructurecounter>\zerocount + \docheckstructureheadlayout + \fi\fi}% + {\docheckstructureheadlayout}} + +\def\dohandlestructureheadpagebreakyes {%[[\currentstructurehead @\thenamedstructureheadlevel\currentstructurehead/prev:\previousstructurecounter/curr:\currentstructurecounter]] \ifconditional\ignorehandlepagebreak \setfalse\ignorehandlepagebreak @@ -657,7 +794,7 @@ % \ifpagebreakdisabled % \global\pagebreakdisabledfalse % \else - \dopreventbreakafterstructureheadauto +% \dopreventbreakafterstructureheadauto % not ok as it binds the prev par % \fi \doif{\structureheadparameter\c!aligntitle}\v!float\indent \global\precedingstructurelevel\currentstructureheadlevel @@ -665,8 +802,10 @@ % the next one was: \somebreakmethod -% \chardef\somestructureheadbreakmethod\plusone % 0=nothing, 1=weighted, 2=strict, 3=vspacing -\chardef\somestructureheadbreakmethod\plusthree + +% 0 = nothing, 1 = weighted, 2 = strict, 3 = vspacing + +\setnewconstant\somestructureheadbreakmethod\plusthree % \def\dopreventbreakafterstructureheadauto % used after \c!before % {\ifcase\somestructureheadbreakmethod diff --git a/Master/texmf-dist/tex/context/base/strc-syn.lua b/Master/texmf-dist/tex/context/base/strc-syn.lua index d6f38c2c7f6..f3ba97ffca2 100644 --- a/Master/texmf-dist/tex/context/base/strc-syn.lua +++ b/Master/texmf-dist/tex/context/base/strc-syn.lua @@ -7,20 +7,24 @@ if not modules then modules = { } end modules ['str-syn'] = { } local next, type = next, type -local texwrite, texsprint, format = tex.write, tex.sprint, string.format - -local ctxcatcodes = tex.ctxcatcodes +local texwrite, format = tex.write, string.format +local allocate = utilities.storage.allocate -- interface to tex end -joblists = joblists or { } -joblists.collected = joblists.collected or { } -joblists.tobesaved = joblists.tobesaved or { } +local structures = structures +local synonyms = structures.synonyms +local tags = structures.tags + +local collected = allocate() +local tobesaved = allocate() -local collected, tobesaved = joblists.collected, joblists.tobesaved +synonyms.collected = collected +synonyms.tobesaved = tobesaved local function initializer() - collected, tobesaved = joblists.collected, joblists.tobesaved + collected = synonyms.collected + tobesaved = synonyms.tobesaved end local function finalizer() @@ -29,7 +33,9 @@ local function finalizer() end end -job.register('joblists.collected', joblists.tobesaved, initializer, finalizer) +job.register('structures.synonyms.collected', tobesaved, initializer, finalizer) + +-- todo: allocate becomes metatable local function allocate(class) local d = tobesaved[class] @@ -50,12 +56,12 @@ local function allocate(class) return d end -function joblists.define(class,kind) +function synonyms.define(class,kind) local data = allocate(class) data.metadata.kind = kind end -function joblists.register(class,kind,spec) +function synonyms.register(class,kind,spec) local data = allocate(class) data.metadata.kind = kind -- runtime, not saved in format (yet) if not data.hash[spec.definition.tag or ""] then @@ -64,7 +70,7 @@ function joblists.register(class,kind,spec) end end -function joblists.registerused(class,tag) +function synonyms.registerused(class,tag) local data = allocate(class) local dht = data.hash[tag] if dht then @@ -72,29 +78,29 @@ function joblists.registerused(class,tag) end end -function joblists.synonym(class,tag) +function synonyms.synonym(class,tag) local data = allocate(class).hash local d = data[tag] if d then local de = d.definition de.used = true - texsprint(ctxcatcodes,de.synonym) + context(de.synonym) end end -function joblists.meaning(class,tag) +function synonyms.meaning(class,tag) local data = allocate(class).hash local d = data[tag] if d then local de = d.definition de.used = true - texsprint(ctxcatcodes,de.meaning) + context(de.meaning) end end -joblists.compare = sorters.comparers.basic -- (a,b) +synonyms.compare = sorters.comparers.basic -- (a,b) -function joblists.filter(data,options) +function synonyms.filter(data,options) local result = { } local entries = data.entries local all = options and options.criterium == interfaces.variables.all @@ -107,7 +113,7 @@ function joblists.filter(data,options) data.result = result end -function joblists.prepare(data) +function synonyms.prepare(data) local strip = sorters.strip local splitter = sorters.splitters.utf local result = data.result @@ -124,11 +130,11 @@ function joblists.prepare(data) end end -function joblists.sort(data,options) - sorters.sort(data.result,joblists.compare) +function synonyms.sort(data,options) + sorters.sort(data.result,synonyms.compare) end -function joblists.finalize(data,options) +function synonyms.finalize(data,options) local result = data.result data.metadata.nofsorted = #result local split = { } @@ -145,45 +151,48 @@ function joblists.finalize(data,options) data.result = split end -function joblists.flush(data,options) -- maybe pass the settings differently - local kind = data.metadata.kind -- hack, will be done better ---~ texsprint(ctxcatcodes,format("\\start%soutput",kind)) +-- for now, maybe at some point we will do a multipass or so +-- maybe pass the settings differently + +function synonyms.flush(data,options) + local kind = data.metadata.kind -- hack, will be done better + -- context[format("\\start%soutput",kind)]() local result = data.result local sorted = table.sortedkeys(result) for k=1,#sorted do local letter = sorted[k] local sublist = result[letter] local data = sublist.data ---~ texsprint(ctxcatcodes,format("\\start%ssection{%s}",kind,sublist.tag)) + -- context[format("\\start%ssection",kind)](sublist.tag) for d=1,#data do local entry = data[d].definition - texsprint(ctxcatcodes,format("\\%sentry{%s}{%s}{%s}{%s}",kind,d,entry.tag,entry.synonym,entry.meaning or "")) + -- context[format("\\%sentry",kind)](d,entry.tag,entry.synonym,entry.meaning or "") + context("\\%sentry{%s}{%s}{%s}{%s}",kind,d,entry.tag,entry.synonym,entry.meaning or "") end ---~ texsprint(ctxcatcodes,format("\\stop%ssection",kind)) + -- context[format("\\stop%ssection",kind)]() end ---~ texsprint(ctxcatcodes,format("\\stop%soutput",kind)) - -- for now, maybe at some point we will do a multipass or so + -- context[format("\\stop%soutput",kind)]() data.result = nil data.metadata.sorted = false end -function joblists.analysed(class,options) - local data = joblists.collected[class] +function synonyms.analyzed(class,options) + local data = synonyms.collected[class] if data and data.entries then options = options or { } sorters.setlanguage(options.language) - joblists.filter(data,options) -- filters entries to result - joblists.prepare(data,options) -- adds split table parallel to list table - joblists.sort(data,options) -- sorts entries in result - joblists.finalize(data,options) -- do things with data.entries + synonyms.filter(data,options) -- filters entries to result + synonyms.prepare(data,options) -- adds split table parallel to list table + synonyms.sort(data,options) -- sorts entries in result + synonyms.finalize(data,options) -- do things with data.entries data.metadata.sorted = true end return data and data.metadata.sorted and data.result and next(data.result) end -function joblists.process(class,options) - if joblists.analysed(class,options) then - joblists.flush(joblists.collected[class],options) +function synonyms.process(class,options) + if synonyms.analyzed(class,options) then + synonyms.flush(synonyms.collected[class],options) end end diff --git a/Master/texmf-dist/tex/context/base/strc-syn.mkiv b/Master/texmf-dist/tex/context/base/strc-syn.mkiv index 65f5174372a..f063ef087d6 100644 --- a/Master/texmf-dist/tex/context/base/strc-syn.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-syn.mkiv @@ -20,6 +20,9 @@ \unprotect +\let\dotagsynonym\relax +\let\dotagsorting\relax + % general help, can be shared % simplifiedcommands -> flag in lua @@ -96,6 +99,7 @@ %\c!after=, \c!indentnext=\v!no, %\c!expansion=, + \c!method=, \s!language=\currentmainlanguage] \unexpanded\def\definesynonyms @@ -114,9 +118,9 @@ \fi \setuvalue{#1}{\definesynonym[\v!yes][#1]}% \name \fi - \getparameters[\??sm#1][\s!parent=\??sm,\s!multi={#2}]% + \getparameters[\??sm#1][\s!parent=\??sm,\s!single={#1},\s!multi={#2}]% \presetheadtext[#2=\Word{#2}]% changes the \if...argument - %\ctxlua{joblists.define('#1')}% + %\ctxlua{structures.synonyms.define('#1')}% \setvalue{\e!setup #2\e!endsetup}{\dodoubleargument\getparameters[\??sm#1]}% to be obsolete \setvalue{\e!place \e!listof#2}{\placelistofsynonyms[#1]}% accepts extra argument \setvalue{\e!complete\e!listof#2}{\completelistofsynonyms[#1]}} @@ -137,7 +141,7 @@ \edef\currentsynonymexpansion{\synonymparameter\c!expansion}% \preprocessexpansion\currentsynonymexpansion\currentsynonymtext \currentsynonymcoding{#4}% \preprocessexpansion\currentsynonymexpansion\currentsynonymmeaning\currentsynonymcoding{#5}% - \ctxlua{joblists.register("\currentsynonym", "synonym", { + \ctxlua{structures.synonyms.register("\currentsynonym", "synonym", { metadata = { catcodes = \the\catcodetable, coding = "\currentsynonymcoding", @@ -158,20 +162,24 @@ {\dodoubleargument\doregistersynonym} \def\registersynonym[#1][#2]% - {\ctxlua{joblists.registerused("#1","#2")}} + {\ctxlua{structures.synonyms.registerused("#1","#2")}} \unexpanded\def\doinsertsynonymmeaning#1#2% name tag {\begingroup \def\currentsynonym{#1}% \dosetsynonymattributes\c!textstyle\c!textcolor - \synonymparameter\c!textcommand{\ctxlua{joblists.meaning("#1","#2")}}% + \synonymparameter\c!textcommand{\ctxlua{structures.synonyms.meaning("#1","#2")}}% \endgroup} \unexpanded\def\doinsertsynonym#1#2% name tag {\begingroup \def\currentsynonym{#1}% + \def\currentsynonymtag{#2}% + \dotagsynonym + \dostarttagged\t!synonym\currentsynonym \dosetsynonymattributes\c!synonymstyle\c!synonymcolor - \synonymparameter\c!synonymcommand{\ctxlua{joblists.synonym("#1","#2")}}% + \synonymparameter\c!synonymcommand{\ctxlua{structures.synonyms.synonym("#1","#2")}}% + \dostoptagged \normalexpanded{\endgroup\synonymparameter\c!next}} \unexpanded\def\placelistofsynonyms @@ -200,15 +208,20 @@ \c!color=. #2]% \startpacked - \ctxlua{joblists.process('#1',{ criterium = "\synonymparameter\c!criterium" })}% + \ctxlua{structures.synonyms.process('#1',{ + criterium = "\synonymparameter\c!criterium", + language = "\synonymparameter\s!language", + method = "\synonymparameter\c!method", + })}% \stoppacked \endgroup} \def\completelistofsynonyms {\dodoubleempty\docompletelistofsynonyms} -\def\docompletelistofsynonyms[#1][#2]% expansion needed to avoid v! (due to french active !) - {\normalexpanded{\systemsuppliedchapter[#1]{\noexpand\headtext{\synonymparameter\s!single}}}% +\def\docompletelistofsynonyms[#1][#2]% + {\edef\currentsynonym{#1}% + \normalexpanded{\systemsuppliedchapter[#1]{\noexpand\headtext{\synonymparameter\s!multi}}}% \doplacelistofsynonyms[#1][#2]% \page[\v!yes]} @@ -262,6 +275,7 @@ %\c!before=, \c!after=\endgraf, %\c!expansion=, + \c!method=, \s!language=\currentmainlanguage] \unexpanded\def\definesorting @@ -281,7 +295,7 @@ \fi \getparameters[\??so#1][\s!parent=\??so,\s!multi={#2}]% \presetheadtext[#2=\Word{#2}]% after \ifthirdargument -) - %\ctxlua{joblists.define('#1')}% + %\ctxlua{structures.synonyms.define('#1')}% \setvalue{\e!setup #2\e!endsetup}{\dodoubleargument\getparameters[\??so#1]}% to be obsolete \setvalue{\e!place \e!listof#2}{\placelistofsorts[#1]}% \setvalue{\e!complete\e!listof#2}{\completelistofsorts[#1]}} @@ -301,7 +315,7 @@ \else \edef\currentsortingexpansion{\sortingparameter\c!expansion}% \preprocessexpansion\currentsortingexpansion\currentsortingtext\currentsortingcoding{#4}% - \ctxlua{joblists.register("\currentsorting", "sorting", { + \ctxlua{structures.synonyms.register("\currentsorting", "sorting", { metadata = { catcodes = \the\catcodetable, coding = "\currentsortingcoding", @@ -321,34 +335,42 @@ {\begingroup % no kap currently, of .. we need to map cap onto WORD \edef\currentsorting{#1}% - \dosetsynonymattributes\c!style\c!color - \ctxlua{joblists.synonym("#1","#2")}% + \def\currentsortingtag{#2}% + \dotagsorting + \dostarttagged\t!sorting\currentsorting + \dosetsortingattributes\c!style\c!color + \ctxlua{structures.synonyms.synonym("#1","#2")}% + \dostoptagged \normalexpanded{\endgroup\sortingparameter\c!next}} \def\registersort {\dodoubleargument\doregistersort} \def\registersort[#1][#2]% - {\ctxlua{joblists.registerused("#1","#2")}} + {\ctxlua{structures.synonyms.registerused("#1","#2")}} % before after % % maybe just 'commandset' and then combine \unexpanded\def\placelistofsorts - {\dodoubleempty\placelistofsorts} + {\dodoubleempty\doplacelistofsorts} -\unexpanded\def\placelistofsorts[#1][#2]% NOG EEN RUWE VERSIE MAKEN ZONDER WITRUIMTE ETC ETC +\def\doplacelistofsorts[#1][#2]% NOG EEN RUWE VERSIE MAKEN ZONDER WITRUIMTE ETC ETC {\begingroup \def\currentsorting{#1}% \getparameters[\??so#1][#2]% \startpacked - \ctxlua{joblists.process('#1',{ criterium = "\sortingparameter\c!criterium" })}% + \ctxlua{structures.synonyms.process('#1',{ + criterium = "\sortingparameter\c!criterium", + language = "\sortingparameter\s!language", + method = "\sortingparameter\c!method", + })}% \stoppacked \endgroup} -\def\completelistofsorts - {\dodoubleemptydocompletelistofsorts} +\unexpanded\def\completelistofsorts + {\dodoubleempty\docompletelistofsorts} \def\docompletelistofsorts[#1][#2]% {\normalexpanded{\systemsuppliedchapter[#1]{\noexpand\headtext{#2}}}% @@ -372,7 +394,7 @@ % \def\mkloadsortedlist#1% class % {\bgroup % \getvalue{\s!set#1}% -% \ctxlua{joblists.process('#1')}% +% \ctxlua{structures.synonyms.process('#1')}% % \getvalue{\s!reset#1}% % \egroup} diff --git a/Master/texmf-dist/tex/context/base/strc-tag.lua b/Master/texmf-dist/tex/context/base/strc-tag.lua new file mode 100644 index 00000000000..f1381dad5f0 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/strc-tag.lua @@ -0,0 +1,251 @@ +if not modules then modules = { } end modules ['strc-tag'] = { + version = 1.001, + comment = "companion to strc-tag.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- This is rather experimental code. + +local insert, remove, unpack, concat = table.insert, table.remove, table.unpack, table.concat +local gsub, find, topattern, format = string.gsub, string.find, string.topattern, string.format +local lpegmatch = lpeg.match +local texattribute = tex.attribute +local allocate = utilities.storage.allocate +local settings_to_hash = utilities.parsers.settings_to_hash + +local trace_tags = false trackers.register("structures.tags", function(v) trace_tags = v end) + +local report_tags = logs.reporter("structure","tags") + +local attributes, structures = attributes, structures + +local a_tagged = attributes.private('tagged') + +local unsetvalue = attributes.unsetvalue +local codeinjections = backends.codeinjections + +local taglist = allocate() +local properties = allocate() +local labels = allocate() +local stack = { } +local chain = { } +local ids = { } +local enabled = false +local tagdata = { } -- used in export + +local tags = structures.tags +tags.taglist = taglist -- can best be hidden +tags.labels = labels +tags.data = tagdata + +local properties = allocate { + + document = { pdf = "Div", nature = "display" }, + + division = { pdf = "Div", nature = "display" }, + paragraph = { pdf = "P", nature = "mixed" }, + construct = { pdf = "Span", nature = "inline" }, + + section = { pdf = "Sect", nature = "display" }, + sectiontitle = { pdf = "H", nature = "mixed" }, + sectionnumber = { pdf = "H", nature = "mixed" }, + sectioncontent = { pdf = "Div", nature = "display" }, + + itemgroup = { pdf = "L", nature = "display" }, + item = { pdf = "Li", nature = "display" }, + itemtag = { pdf = "Lbl", nature = "mixed" }, + itemcontent = { pdf = "LBody", nature = "mixed" }, + + description = { pdf = "Div", nature = "display" }, + descriptiontag = { pdf = "Div", nature = "mixed" }, + descriptioncontent = { pdf = "Div", nature = "mixed" }, + descriptionsymbol = { pdf = "Span", nature = "inline" }, -- note reference + + verbatimblock = { pdf = "Code", nature = "display" }, + verbatimlines = { pdf = "Code", nature = "display" }, + verbatimline = { pdf = "Code", nature = "mixed" }, + verbatim = { pdf = "Code", nature = "inline" }, + + synonym = { pdf = "Span", nature = "inline" }, + sort = { pdf = "Span", nature = "inline" }, + + register = { pdf = "Div", nature = "display" }, + registersection = { pdf = "Div", nature = "display" }, + registertag = { pdf = "Span", nature = "mixed" }, + registerentries = { pdf = "Div", nature = "display" }, + registerentry = { pdf = "Span", nature = "mixed" }, + registersee = { pdf = "Span", nature = "mixed" }, + registerpages = { pdf = "Span", nature = "mixed" }, + registerpage = { pdf = "Span", nature = "inline" }, + registerpagerange = { pdf = "Span", nature = "mixed" }, + + table = { pdf = "Table", nature = "display" }, + tablerow = { pdf = "TR", nature = "display" }, + tablecell = { pdf = "TD", nature = "mixed" }, + tabulate = { pdf = "Table", nature = "display" }, + tabulaterow = { pdf = "TR", nature = "display" }, + tabulatecell = { pdf = "TD", nature = "mixed" }, + + list = { pdf = "TOC", nature = "display" }, + listitem = { pdf = "TOCI", nature = "display" }, + listtag = { pdf = "Lbl", nature = "mixed" }, + listcontent = { pdf = "P", nature = "mixed" }, + listdata = { pdf = "P", nature = "mixed" }, + listpage = { pdf = "Reference", nature = "mixed" }, + + delimitedblock = { pdf = "BlockQuote", nature = "display" }, + delimited = { pdf = "Quote", nature = "inline" }, + subsentence = { pdf = "Span", nature = "inline" }, + + float = { pdf = "Div", nature = "display" }, -- Figure + floatcaption = { pdf = "Caption", nature = "display" }, + floattag = { pdf = "Span", nature = "mixed" }, + floattext = { pdf = "Span", nature = "mixed" }, + floatcontent = { pdf = "P", nature = "mixed" }, + + image = { pdf = "P", nature = "mixed" }, + mpgraphic = { pdf = "P", nature = "mixed" }, + + formulaset = { pdf = "Div", nature = "display" }, + formula = { pdf = "Div", nature = "display" }, -- Formula + formulatag = { pdf = "Span", nature = "mixed" }, + formulacontent = { pdf = "P", nature = "display" }, + subformula = { pdf = "Div", nature = "display" }, + + link = { pdf = "Link", nature = "inline" }, + + margintextblock = { pdf = "Span", nature = "inline" }, + margintext = { pdf = "Span", nature = "inline" }, + + math = { pdf = "Div", nature = "display" }, + mn = { pdf = "Span", nature = "mixed" }, + mi = { pdf = "Span", nature = "mixed" }, + mo = { pdf = "Span", nature = "mixed" }, + ms = { pdf = "Span", nature = "mixed" }, + mrow = { pdf = "Span", nature = "display" }, + msubsup = { pdf = "Span", nature = "display" }, + msub = { pdf = "Span", nature = "display" }, + msup = { pdf = "Span", nature = "display" }, + merror = { pdf = "Span", nature = "mixed" }, + munderover = { pdf = "Span", nature = "display" }, + munder = { pdf = "Span", nature = "display" }, + mover = { pdf = "Span", nature = "display" }, + mtext = { pdf = "Span", nature = "mixed" }, + mfrac = { pdf = "Span", nature = "display" }, + mroot = { pdf = "Span", nature = "display" }, + msqrt = { pdf = "Span", nature = "display" }, + +} + +tags.properties = properties + +function tags.settagproperty(tag,key,value) + local p = properties[tag] + if p then + p[key] = value + else + properties[tag] = { [key] = value } + end +end + +local lasttags = { } +local userdata = { } + +tags.userdata = userdata + +function tags.start(tag,specification) + local label, detail, user + if specification then + label, detail, user = specification.label, specification.detail, specification.userdata + end + if not enabled then + codeinjections.enabletags() + enabled = true + end + labels[tag] = label ~= "" and label or tag + local fulltag + if detail and detail ~= "" then + fulltag = tag .. ":" .. detail + else + fulltag = tag + end + local t = #taglist + 1 + local n = (ids[fulltag] or 0) + 1 + ids[fulltag] = n + lasttags[tag] = n +--~ print("SETTING",tag,n) + local completetag = fulltag .. "-" .. n + chain[#chain+1] = completetag -- insert(chain,tag .. ":" .. n) + stack[#stack+1] = t -- insert(stack,t) + taglist[t] = { unpack(chain) } -- we can add key values for alt and actualtext if needed + if user and user ~= "" then + -- maybe we should merge this into taglist or whatever ... anyway there is room to optimize + -- taglist.userdata = settings_to_hash(user) + userdata[completetag] = settings_to_hash(user) + end + texattribute[a_tagged] = t + return t +end + +function tags.stop() + local t = stack[#stack] stack[#stack] = nil -- local t = remove(stack) + if not t then + if trace_tags then + report_tags("ignoring end tag, previous chain: %s",#chain > 0 and concat(chain[#chain]) or "none") + end + t = unsetvalue + else + chain[#chain] = nil -- remove(chain) + end + texattribute[a_tagged] = t + return t +end + +function tags.getid(tag,detail) + if detail and detail ~= "" then + return ids[tag .. ":" .. detail] or "?" + else + return ids[tag] or "?" + end +end + +function tags.last(tag) + return lasttags[tag] -- or false +end + +function tags.lastinchain() + return chain[#chain] +end + +function tags.registerdata(data) + local fulltag = chain[#chain] + if fulltag then + tagdata[fulltag] = data + end +end + +function structures.atlocation(str) + local location = gsub(concat(taglist[texattribute[a_tagged]],"-"),"%-%d+","") + return find(location,topattern(str)) ~= nil +end + +function tags.handler(head) -- we need a dummy + return head, false +end + +statistics.register("structure elements", function() + if enabled then + return format("%s element chains identified",#taglist) + else + return nil + end +end) + +directives.register("backend.addtags", function(v) + if not enabled then + codeinjections.enabletags() + enabled = true + end +end) diff --git a/Master/texmf-dist/tex/context/base/strc-tag.mkiv b/Master/texmf-dist/tex/context/base/strc-tag.mkiv new file mode 100644 index 00000000000..8bc8d9f6979 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/strc-tag.mkiv @@ -0,0 +1,220 @@ +%D \module +%D [ file=strc-tag, +%D version=2010.07.16, +%D title=\CONTEXT\ Structure Macros, +%D subtitle=Tags, +%D author=Hans Hagen, +%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. + +% key/values and other names might change (and probably will) + +\writestatus{loading}{ConTeXt Structure Macros / Tags} + +\registerctxluafile{strc-tag}{1.001} + +\unprotect + +% labels: temporary here + +\def\t!document {document} % Div + +\def\t!division {division} % Div +\def\t!paragraph {paragraph} % P +\def\t!construct {construct} % Span + +\def\t!section {section} % Sect +\def\t!sectiontitle {sectiontitle} % H +\def\t!sectionnumber {sectionnumber} % H +\def\t!sectioncontent {sectioncontent} % Div + +\def\t!itemgroup {itemgroup} % L +\def\t!item {item} % Li +\def\t!itemtag {itemtag} % Lbl +\def\t!itemcontent {itemcontent} % LBody + +\def\t!description {description} % Li +\def\t!descriptiontag {descriptiontag} % Lbl +\def\t!descriptioncontent{descriptioncontent} % LBody +\def\t!descriptionsymbol {descriptionsymbol} % Span + +\def\t!verbatimblock {verbatimblock} % Code +\def\t!verbatimlines {verbatimlines} % Code +\def\t!verbatimline {verbatimline} % Code +\def\t!verbatim {verbatim} % Code + +\def\t!sorting {sorting} % Span +\def\t!synonym {synonym} % Span + +\def\t!register {register} % Div +\def\t!registersection {registersection} % Div +\def\t!registertag {registertag} % Span +\def\t!registerentries {registerentries} % Div +\def\t!registerentry {registerentry} % Span +\def\t!registersee {registersee} % Span +\def\t!registerpages {registerpages} % Span +\def\t!registerpage {registerpage} % Span +\def\t!registerpagerange {registerpagerange} % Span + +\def\t!table {table} % Table +\def\t!tablerow {tablerow} % TR +\def\t!tablecell {tablecell} % TD +\def\t!tabulate {tabulate} % Table +\def\t!tabulaterow {tabulaterow} % TR +\def\t!tabulatecell {tabulatecell} % TD + +\def\t!list {list} % TOC +\def\t!listitem {listitem} % TOCI +\def\t!listtag {listtag} % Lbl +\def\t!listcontent {listcontent} % P +\def\t!listdata {listdata} % P +\def\t!listpage {listpage} % Reference + +\def\t!delimitedblock {delimited} % BlockQuote +\def\t!delimited {delimited} % Quote +\def\t!subsentence {subsentence} % Span + +\def\t!float {float} % Div +\def\t!floatcaption {floatcaption} % Caption +\def\t!floattag {floattag} % Span +\def\t!floattext {floattext} % Span +\def\t!floatcontent {floatcontent} % P + +\def\t!image {image} % P + +\def\t!mpgraphic {mpgraphic} % P + +\def\t!formulaset {formulaset} % Div +\def\t!formula {formula} % Div +\def\t!formulatag {formulatag} % Span +\def\t!formulacontent {formulacontent} % P +\def\t!subformula {subformula} % Div + +\def\t!link {link} % Link + +\def\t!margintext {margintext} % Span +\def\t!margintextblock {margintextblock} % Div + +% \setuptaglabeltext +% [en] +% [\t!document=document] + +% the real code + +\definesystemattribute[tagged][public] +\definesystemattribute[image] [public] + +\def\setelementbackendtag{\dodoubleargument\dosetelementbackendtag} +\def\setelementnature {\dodoubleargument\dosetelementnature} + +\def\dosetelementbackendtag[#1][#2]{\ctxlua{structures.tags.settagproperty("#1","backend","#2")}} +\def\dosetelementnature [#1][#2]{\ctxlua{structures.tags.settagproperty("#1","nature", "#2")}} + +% todo: indirect macro for trialtypesetting + +\unexpanded\def\dostartelement{\iftrialtypesetting\expandafter\renostartelement\else\expandafter\redostartelement\fi} +\unexpanded\def\dostopelement {\iftrialtypesetting\expandafter\nonostopelement \else\expandafter\dodostopelement \fi} + +\unexpanded\def\redostartelement{\dodoubleempty\dodostartelement} +\unexpanded\def\renostartelement{\dodoubleempty\nonostartelement} + +\unexpanded\def\dodostartelement[#1][#2]% + {\ctxlua{structures.tags.start("#1",{ + label = "\dogetupsometaglabeltext{#1}", + userdata = \!!bs#2\!!es, + })}} + +\unexpanded\def\dodostopelement + {\ctxlua{structures.tags.stop()}} + +\unexpanded\def\nonostartelement[#1][#2]{} +\unexpanded\def\nonostopelement {} + +% beware: making this one unexpanded spoils tables (noalign problem) + +\def\dodostarttagged{\iftrialtypesetting\expandafter\nododostarttagged\else\expandafter\dododostarttagged\fi} +\def\dodostoptagged {\iftrialtypesetting\expandafter\nododostoptagged \else\expandafter\dododostoptagged \fi} + +\def\dododostarttagged#1#2% + {\ctxlua{structures.tags.start("#1",{ + label = "\dogetupsometaglabeltext{#1}", + detail = "#2", + })}} + +\def\dododostoptagged + {\ctxlua{structures.tags.stop()}} + +\def\nododostarttagged#1#2{} +\def\nododostoptagged {} + +\newtoks\everysetupstructure + +\def\setupstructure[#1]% + {\getparameters[\??el][#1]% + \the\everysetupstructure} + +\def\doenableelements + {\setuplanguage[\s!default][\s!righthyphenchar="AD]% for the moment here + \let\startelement\dostartelement + \let\stopelement \dostopelement} + +\def\dodisableelements + {\let\startelement\renostartelement + \let\stopelement \nonostopelement} + +\def\doenabletagged + {\let\dostarttagged\dodostarttagged + \let\dostoptagged \dodostoptagged } + +\def\dodisabletagged + {\let\dostarttagged\nododostarttagged + \let\dostoptagged \nododostoptagged } + +\newtoks\everyenableelements +\newtoks\everydisableelements + +\appendtoks + \doenableelements + \doifelse\@@elmethod\v!auto\doenabletagged\dodisabletagged +\to \everyenableelements + +\appendtoks + \dodisableelements + \dodisabletagged +\to \everydisableelements + +\appendtoks + \doifelse\@@elstate\v!start{\the\everyenableelements}{\the\everydisableelements}% +\to \everysetupstructure + +\setupstructure + [\c!state=\v!stop, + \c!method=\v!auto] + +\unexpanded\def\startparagraph + {\dostarttagged\t!paragraph\empty} + +\unexpanded\def\stopparagraph + {\dostoptagged + \par} + +\appendtoks + \dostarttagged\t!document\empty +\to \everystarttext + +\appendtoks + \dostoptagged +\to \everystoptext + +% \doifinelementelse{structure:section} {yes} {no} +% \doifinelementelse{structure:chapter} {yes} {no} +% \doifinelementelse{division:*-structure:chapter} {yes} {no} + +\def\doifinelementelse#1% + {\ctxcommand{testcase(structures.atlocation("#1"))}} + +\protect diff --git a/Master/texmf-dist/tex/context/base/strc-xml.mkiv b/Master/texmf-dist/tex/context/base/strc-xml.mkiv index 7a009958597..9696c2e06c2 100644 --- a/Master/texmf-dist/tex/context/base/strc-xml.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-xml.mkiv @@ -13,12 +13,14 @@ \writestatus{loading}{ConTeXt Structure Macros / XML Processing} +% This might disappear. + \unprotect \startxmlsetups xml:ctx:internal:setup - \xmlsetsetup{\xmldocument}{ctx:genericentry} {xml:ctx:genericentry} - \xmlsetsetup{\xmldocument}{ctx:sectionentry} {xml:ctx:sectionentry} - \xmlsetsetup{\xmldocument}{ctx:registerentry}{xml:ctx:registerentry} + \xmlsetsetup{#1}{ctx:genericentry} {xml:ctx:genericentry} + \xmlsetsetup{#1}{ctx:sectionentry} {xml:ctx:sectionentry} + \xmlsetsetup{#1}{ctx:registerentry}{xml:ctx:registerentry} \stopxmlsetups \xmlregistersetup{xml:ctx:internal:setup} diff --git a/Master/texmf-dist/tex/context/base/supp-ali.mkii b/Master/texmf-dist/tex/context/base/supp-ali.mkii new file mode 100644 index 00000000000..8727efbb271 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/supp-ali.mkii @@ -0,0 +1,173 @@ +%D \module +%D [ file=supp-ali, +%D version=2000.04.17, +%D title=\CONTEXT\ Support Macros, +%D subtitle=Alignment, +%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 Yet undocumented. + +% 0 = centered +% 1 = left in before +% 2 = right in before +% 3 = left in after +% 4 = right in after + +\unprotect + +% \starttabulate[|cg{.}|cg{,}|cg{,}|] +% \NC period \NC comma \NC comma \NC\NR +% \NG 100.000,00 \NG 100.000,00 \NG 100,00 \NC\NR +% \NG 10.000,00 \NG 10.000,00 \NG 1000,00 \NC\NR +% \NG 100,00 \NG 100,00 \NG 10,00 \NC\NR +% \NG 100,00 \NG 100,00 \NG 10,00 \NC\NR +% \NG 10\\ \NG 10\\ \NG 0,00 \NC\NR +% \NG 10 \NG 10 \NG 0,00 \NC\NR +% \NG 10 \NG 10 \NG 0,00 \NC\NR +% \stoptabulate + +\chardef\characteralignmentmode=4 +\chardef\characteralignmentslot=1 + +\newtoks\@@characteralignlst + +\let\afterassignwidth \!!zeropoint +\let\beforeassignwidth\!!zeropoint + +\def\alignmentcharacter{.} + +\let\alignmentclass\s!default % can be used to handle multiple mixed ones + +\def\setfirstpasscharacteralign + {\popcharacteralign + \expanded{\dosetfirstpasscharacteralign{\alignmentcharacter}}} + +\def\dosetfirstpasscharacteralign#1% + {\def\checkalignment##1% + {\popcharacteralign + \let\\\empty + \setbox\scratchbox\hbox{#1}% + \edef\characterassignwidth{\the\wd\scratchbox}% + \setbox\scratchbox\null + \docheckalignment##1#1\relax\relax + \scratchdimen-\wd\scratchbox + \setbox\scratchbox\hbox{\ignorespaces##1\unskip}% + \advance\scratchdimen \wd\scratchbox + \ifdim\scratchdimen>\beforeassignwidth\relax + \edef\beforeassignwidth{\the\scratchdimen}% + \fi + \ifdim\scratchdimen=\zeropoint + \setbox\scratchbox\hbox{\ignorespaces##1\unskip}% + \scratchdimen\wd\scratchbox + \ifcase\characteralignmentmode + % do nothing + \else\ifnum\characteralignmentmode<\plusthree + \advance\scratchdimen \characterassignwidth + \ifdim\scratchdimen>\beforeassignwidth\relax + \edef\beforeassignwidth{\the\scratchdimen}% + \fi + \else + \ifdim\scratchdimen>\afterassignwidth\relax + \edef\afterassignwidth{\the\scratchdimen}% + \fi + \fi\fi + \fi + \pushcharacteralign}% + \def\docheckalignment##1#1##2##3\relax + {\ifx##2\relax + \setbox\scratchbox\hbox{\ignorespaces##1\unskip}% + \ifdim\wd\scratchbox>\afterassignwidth + \edef\afterassignwidth{\the\wd\scratchbox}% + \fi + \else + \docheckalignment##2##3\relax\relax + \fi}} + +\def\setsecondpasscharacteralign + {\popcharacteralign + \expanded{\dosetsecondpasscharacteralign{\alignmentcharacter}}} + +\def\dosetsecondpasscharacteralign#1% + {\def\checkalignment##1% + {\popcharacteralign + \let\\\empty % beware, no grouping + \setbox\scratchbox\hbox{#1}% + \edef\characterassignwidth{\the\wd\scratchbox}% + \setbox\scratchbox\null + % new 12,34 vs 10\\ where 10 aligns on 12 if #1 = , + \ifcase\characteralignmentslot + \docheckalignment##1#1\relax\relax + \scratchdimen\wd\scratchbox + \setbox\scratchbox\hbox{\ignorespaces##1\unskip}% + \else + \def\\{#1}% + \expanded{\docheckalignment##1#1\relax\relax}% + \scratchdimen\wd\scratchbox + \setbox\scratchbox\hbox{\def\\{\hphantom{#1}}\ignorespaces##1\unskip}% + \fi + \noindent + \ifdim\scratchdimen=\wd\scratchbox + \ifcase\characteralignmentmode + \box\scratchbox + \else + \hbox + {\dontcomplain + \hbox to \beforeassignwidth + {\ifcase\characteralignmentmode\or + \box\scratchbox\hss + \or + \hss\box\scratchbox\hskip\characterassignwidth + \or + \hss\rlap{\box\scratchbox}% + \or + \hss\rlap{\hbox to \afterassignwidth{\hss\box\scratchbox}}% + \fi}% + \hskip\afterassignwidth}% + \fi + \else + \hbox + {\hbox to \beforeassignwidth + {\hss\box\scratchbox\hskip-\scratchdimen}% + \hskip\afterassignwidth}% + \fi}% + \def\docheckalignment##1#1##2##3\relax + {\ifx##2\relax + \setbox\scratchbox\hbox{\ignorespaces##1\unskip}% + \else + \docheckalignment##2##3\relax\relax + \fi}} + +% provide a means to use multiple alignments mixed + +\def\pushcharacteralign + {\ifundefined{@cac@\alignmentclass}% + \doglobal\appendetoks\noexpand\do{\alignmentclass}\to\@@characteralignlst + \fi + \setxvalue{@cac@\alignmentclass}{\noexpand\do + {\afterassignwidth}{\beforeassignwidth}{\alignmentcharacter}}} + +\def\popcharacteralign + {\def\do##1##2##3% + {\def\afterassignwidth {##1}% + \def\beforeassignwidth {##2}% + \def\alignmentcharacter{##3}}% + \executeifdefined{@cac@\alignmentclass}\donothing} + +\def\resetcharacteralign % does not work well nested + {\def\do##1{\global\letbeundefined{@cac@##1}}% global ! + \the\@@characteralignlst + \global\@@characteralignlst\emptytoks} + +\long\def\startcharacteralign#1\stopcharacteralign + {\bgroup + \setfirstpasscharacteralign #1% + \setsecondpasscharacteralign#1% + \egroup} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/supp-ali.mkiv b/Master/texmf-dist/tex/context/base/supp-ali.mkiv new file mode 100644 index 00000000000..1bd31eb78a2 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/supp-ali.mkiv @@ -0,0 +1,173 @@ +%D \module +%D [ file=supp-ali, +%D version=2000.04.17, +%D title=\CONTEXT\ Support Macros, +%D subtitle=Alignment, +%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 Yet undocumented. + +% 0 = centered +% 1 = left in before +% 2 = right in before +% 3 = left in after +% 4 = right in after + +\unprotect + +% \starttabulate[|cg{.}|cg{,}|cg{,}|] +% \NC period \NC comma \NC comma \NC\NR +% \NG 100.000,00 \NG 100.000,00 \NG 100,00 \NC\NR +% \NG 10.000,00 \NG 10.000,00 \NG 1000,00 \NC\NR +% \NG 100,00 \NG 100,00 \NG 10,00 \NC\NR +% \NG 100,00 \NG 100,00 \NG 10,00 \NC\NR +% \NG 10\\ \NG 10\\ \NG 0,00 \NC\NR +% \NG 10 \NG 10 \NG 0,00 \NC\NR +% \NG 10 \NG 10 \NG 0,00 \NC\NR +% \stoptabulate + +\chardef\characteralignmentmode=4 +\chardef\characteralignmentslot=1 + +\newtoks\@@characteralignlst + +\let\afterassignwidth \!!zeropoint +\let\beforeassignwidth\!!zeropoint + +\def\alignmentcharacter{.} + +\let\alignmentclass\s!default % can be used to handle multiple mixed ones + +\def\setfirstpasscharacteralign + {\popcharacteralign + \expanded{\dosetfirstpasscharacteralign{\alignmentcharacter}}} + +\def\dosetfirstpasscharacteralign#1% + {\def\checkalignment##1% + {\popcharacteralign + \let\\\empty + \setbox\scratchbox\hbox{#1}% + \edef\characterassignwidth{\the\wd\scratchbox}% + \setbox\scratchbox\emptyhbox + \docheckalignment##1#1\relax\relax + \scratchdimen-\wd\scratchbox + \setbox\scratchbox\hbox{\ignorespaces##1\unskip}% + \advance\scratchdimen \wd\scratchbox + \ifdim\scratchdimen>\beforeassignwidth\relax + \edef\beforeassignwidth{\the\scratchdimen}% + \fi + \ifdim\scratchdimen=\zeropoint + \setbox\scratchbox\hbox{\ignorespaces##1\unskip}% + \scratchdimen\wd\scratchbox + \ifcase\characteralignmentmode + % do nothing + \else\ifnum\characteralignmentmode<\plusthree + \advance\scratchdimen \characterassignwidth + \ifdim\scratchdimen>\beforeassignwidth\relax + \edef\beforeassignwidth{\the\scratchdimen}% + \fi + \else + \ifdim\scratchdimen>\afterassignwidth\relax + \edef\afterassignwidth{\the\scratchdimen}% + \fi + \fi\fi + \fi + \pushcharacteralign}% + \def\docheckalignment##1#1##2##3\relax + {\ifx##2\relax + \setbox\scratchbox\hbox{\ignorespaces##1\unskip}% + \ifdim\wd\scratchbox>\afterassignwidth + \edef\afterassignwidth{\the\wd\scratchbox}% + \fi + \else + \docheckalignment##2##3\relax\relax + \fi}} + +\def\setsecondpasscharacteralign + {\popcharacteralign + \expanded{\dosetsecondpasscharacteralign{\alignmentcharacter}}} + +\def\dosetsecondpasscharacteralign#1% + {\def\checkalignment##1% + {\popcharacteralign + \let\\\empty % beware, no grouping + \setbox\scratchbox\hbox{#1}% + \edef\characterassignwidth{\the\wd\scratchbox}% + \setbox\scratchbox\emptyhbox + % new 12,34 vs 10\\ where 10 aligns on 12 if #1 = , + \ifcase\characteralignmentslot + \docheckalignment##1#1\relax\relax + \scratchdimen\wd\scratchbox + \setbox\scratchbox\hbox{\ignorespaces##1\unskip}% + \else + \def\\{#1}% + \expanded{\docheckalignment##1#1\relax\relax}% + \scratchdimen\wd\scratchbox + \setbox\scratchbox\hbox{\def\\{\hphantom{#1}}\ignorespaces##1\unskip}% + \fi + \noindent + \ifdim\scratchdimen=\wd\scratchbox + \ifcase\characteralignmentmode + \box\scratchbox + \else + \hbox + {\dontcomplain + \hbox to \beforeassignwidth + {\ifcase\characteralignmentmode\or + \box\scratchbox\hss + \or + \hss\box\scratchbox\hskip\characterassignwidth + \or + \hss\rlap{\box\scratchbox}% + \or + \hss\rlap{\hbox to \afterassignwidth{\hss\box\scratchbox}}% + \fi}% + \hskip\afterassignwidth}% + \fi + \else + \hbox + {\hbox to \beforeassignwidth + {\hss\box\scratchbox\hskip-\scratchdimen}% + \hskip\afterassignwidth}% + \fi}% + \def\docheckalignment##1#1##2##3\relax + {\ifx##2\relax + \setbox\scratchbox\hbox{\ignorespaces##1\unskip}% + \else + \docheckalignment##2##3\relax\relax + \fi}} + +% provide a means to use multiple alignments mixed + +\def\pushcharacteralign + {\ifcsname @cac@\alignmentclass\endcsname\else + \doglobal\appendetoks\noexpand\do{\alignmentclass}\to\@@characteralignlst + \fi + \setxvalue{@cac@\alignmentclass}{\noexpand\do + {\afterassignwidth}{\beforeassignwidth}{\alignmentcharacter}}} + +\def\popcharacteralign + {\def\do##1##2##3% + {\def\afterassignwidth {##1}% + \def\beforeassignwidth {##2}% + \def\alignmentcharacter{##3}}% + \executeifdefined{@cac@\alignmentclass}\donothing} + +\def\resetcharacteralign % does not work well nested + {\def\do##1{\global\letbeundefined{@cac@##1}}% global ! + \the\@@characteralignlst + \global\@@characteralignlst\emptytoks} + +\long\def\startcharacteralign#1\stopcharacteralign + {\bgroup + \setfirstpasscharacteralign #1% + \setsecondpasscharacteralign#1% + \egroup} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/supp-ali.tex b/Master/texmf-dist/tex/context/base/supp-ali.tex deleted file mode 100644 index 8727efbb271..00000000000 --- a/Master/texmf-dist/tex/context/base/supp-ali.tex +++ /dev/null @@ -1,173 +0,0 @@ -%D \module -%D [ file=supp-ali, -%D version=2000.04.17, -%D title=\CONTEXT\ Support Macros, -%D subtitle=Alignment, -%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 Yet undocumented. - -% 0 = centered -% 1 = left in before -% 2 = right in before -% 3 = left in after -% 4 = right in after - -\unprotect - -% \starttabulate[|cg{.}|cg{,}|cg{,}|] -% \NC period \NC comma \NC comma \NC\NR -% \NG 100.000,00 \NG 100.000,00 \NG 100,00 \NC\NR -% \NG 10.000,00 \NG 10.000,00 \NG 1000,00 \NC\NR -% \NG 100,00 \NG 100,00 \NG 10,00 \NC\NR -% \NG 100,00 \NG 100,00 \NG 10,00 \NC\NR -% \NG 10\\ \NG 10\\ \NG 0,00 \NC\NR -% \NG 10 \NG 10 \NG 0,00 \NC\NR -% \NG 10 \NG 10 \NG 0,00 \NC\NR -% \stoptabulate - -\chardef\characteralignmentmode=4 -\chardef\characteralignmentslot=1 - -\newtoks\@@characteralignlst - -\let\afterassignwidth \!!zeropoint -\let\beforeassignwidth\!!zeropoint - -\def\alignmentcharacter{.} - -\let\alignmentclass\s!default % can be used to handle multiple mixed ones - -\def\setfirstpasscharacteralign - {\popcharacteralign - \expanded{\dosetfirstpasscharacteralign{\alignmentcharacter}}} - -\def\dosetfirstpasscharacteralign#1% - {\def\checkalignment##1% - {\popcharacteralign - \let\\\empty - \setbox\scratchbox\hbox{#1}% - \edef\characterassignwidth{\the\wd\scratchbox}% - \setbox\scratchbox\null - \docheckalignment##1#1\relax\relax - \scratchdimen-\wd\scratchbox - \setbox\scratchbox\hbox{\ignorespaces##1\unskip}% - \advance\scratchdimen \wd\scratchbox - \ifdim\scratchdimen>\beforeassignwidth\relax - \edef\beforeassignwidth{\the\scratchdimen}% - \fi - \ifdim\scratchdimen=\zeropoint - \setbox\scratchbox\hbox{\ignorespaces##1\unskip}% - \scratchdimen\wd\scratchbox - \ifcase\characteralignmentmode - % do nothing - \else\ifnum\characteralignmentmode<\plusthree - \advance\scratchdimen \characterassignwidth - \ifdim\scratchdimen>\beforeassignwidth\relax - \edef\beforeassignwidth{\the\scratchdimen}% - \fi - \else - \ifdim\scratchdimen>\afterassignwidth\relax - \edef\afterassignwidth{\the\scratchdimen}% - \fi - \fi\fi - \fi - \pushcharacteralign}% - \def\docheckalignment##1#1##2##3\relax - {\ifx##2\relax - \setbox\scratchbox\hbox{\ignorespaces##1\unskip}% - \ifdim\wd\scratchbox>\afterassignwidth - \edef\afterassignwidth{\the\wd\scratchbox}% - \fi - \else - \docheckalignment##2##3\relax\relax - \fi}} - -\def\setsecondpasscharacteralign - {\popcharacteralign - \expanded{\dosetsecondpasscharacteralign{\alignmentcharacter}}} - -\def\dosetsecondpasscharacteralign#1% - {\def\checkalignment##1% - {\popcharacteralign - \let\\\empty % beware, no grouping - \setbox\scratchbox\hbox{#1}% - \edef\characterassignwidth{\the\wd\scratchbox}% - \setbox\scratchbox\null - % new 12,34 vs 10\\ where 10 aligns on 12 if #1 = , - \ifcase\characteralignmentslot - \docheckalignment##1#1\relax\relax - \scratchdimen\wd\scratchbox - \setbox\scratchbox\hbox{\ignorespaces##1\unskip}% - \else - \def\\{#1}% - \expanded{\docheckalignment##1#1\relax\relax}% - \scratchdimen\wd\scratchbox - \setbox\scratchbox\hbox{\def\\{\hphantom{#1}}\ignorespaces##1\unskip}% - \fi - \noindent - \ifdim\scratchdimen=\wd\scratchbox - \ifcase\characteralignmentmode - \box\scratchbox - \else - \hbox - {\dontcomplain - \hbox to \beforeassignwidth - {\ifcase\characteralignmentmode\or - \box\scratchbox\hss - \or - \hss\box\scratchbox\hskip\characterassignwidth - \or - \hss\rlap{\box\scratchbox}% - \or - \hss\rlap{\hbox to \afterassignwidth{\hss\box\scratchbox}}% - \fi}% - \hskip\afterassignwidth}% - \fi - \else - \hbox - {\hbox to \beforeassignwidth - {\hss\box\scratchbox\hskip-\scratchdimen}% - \hskip\afterassignwidth}% - \fi}% - \def\docheckalignment##1#1##2##3\relax - {\ifx##2\relax - \setbox\scratchbox\hbox{\ignorespaces##1\unskip}% - \else - \docheckalignment##2##3\relax\relax - \fi}} - -% provide a means to use multiple alignments mixed - -\def\pushcharacteralign - {\ifundefined{@cac@\alignmentclass}% - \doglobal\appendetoks\noexpand\do{\alignmentclass}\to\@@characteralignlst - \fi - \setxvalue{@cac@\alignmentclass}{\noexpand\do - {\afterassignwidth}{\beforeassignwidth}{\alignmentcharacter}}} - -\def\popcharacteralign - {\def\do##1##2##3% - {\def\afterassignwidth {##1}% - \def\beforeassignwidth {##2}% - \def\alignmentcharacter{##3}}% - \executeifdefined{@cac@\alignmentclass}\donothing} - -\def\resetcharacteralign % does not work well nested - {\def\do##1{\global\letbeundefined{@cac@##1}}% global ! - \the\@@characteralignlst - \global\@@characteralignlst\emptytoks} - -\long\def\startcharacteralign#1\stopcharacteralign - {\bgroup - \setfirstpasscharacteralign #1% - \setsecondpasscharacteralign#1% - \egroup} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/supp-box.lua b/Master/texmf-dist/tex/context/base/supp-box.lua new file mode 100644 index 00000000000..48baecf6fc2 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/supp-box.lua @@ -0,0 +1,110 @@ +if not modules then modules = { } end modules ['supp-box'] = { + version = 1.001, + comment = "companion to supp-box.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- this is preliminary code + +local report_hyphenation = logs.reporter("languages","hyphenation") + +local nodecodes = nodes.nodecodes + +local disc_code = nodecodes.disc +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist +local glue_code = nodecodes.glue +local glyph_code = nodecodes.glyph + +local new_penalty = nodes.pool.penalty +local free_node = node.free +local copynodelist = node.copy_list +local copynode = node.copy +local texbox = tex.box + +local function hyphenatedlist(list) + while list do + local id, next, prev = list.id, list.next, list.prev + if id == disc_code then + local hyphen = list.pre + if hyphen then + local penalty = new_penalty(-500) + hyphen.next, penalty.prev = penalty, hyphen + prev.next, next.prev = hyphen, penalty + penalty.next, hyphen.prev = next, prev + list.pre = nil + free_node(list) + end + elseif id == vlist_code or id == hlist_code then + hyphenatedlist(list.list) + end + list = next + end +end + +commands.hyphenatedlist = hyphenatedlist + +function commands.showhyphenatedinlist(list) + report_hyphenation("show: %s",nodes.listtoutf(list)) +end + +local function checkedlist(list) + if type(list) == "number" then + return texbox[list].list + else + return list + end +end + +local function applytochars(list,what,nested) + local doaction = context[what or "ruledhbox"] + local noaction = context + local current = checkedlist(list) + while current do + local id = current.id + if nested and (id == hlist_code or id == vlist_code) then + context.hbox() + context.bgroup() + applytochars(current.list,what,nested) + context.egroup() + elseif id ~= glyph_code then + noaction(copynode(current)) + else + doaction(copynode(current)) + end + current = current.next + end +end + +local function applytowords(list,what,nested) + local doaction = context[what or "ruledhbox"] + local noaction = context + local current = checkedlist(list) + local start + while current do + local id = current.id + if id == glue_code then + if start then + doaction(copynodelist(start,current)) + start = nil + end + noaction(copynode(current)) + elseif nested and (id == hlist_code or id == vlist_code) then + context.hbox() + context.bgroup() + applytowords(current.list,what,nested) + context.egroup() + elseif not start then + start = current + end + current = current.next + end + if start then + doaction(copynodelist(start)) + end +end + +commands.applytochars = applytochars +commands.applytowords = applytowords diff --git a/Master/texmf-dist/tex/context/base/supp-box.mkii b/Master/texmf-dist/tex/context/base/supp-box.mkii new file mode 100644 index 00000000000..8cdea862090 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/supp-box.mkii @@ -0,0 +1,3126 @@ +%D \module +%D [ file=supp-box, +%D version=1995.10.10, +%D title=\CONTEXT\ Support Macros, +%D subtitle=Boxes, +%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 some box manipulation macros. Some +%D are quite simple, some are more advanced and when understood +%D well, all can be of use. + +%D No longer generic, why bother. + +\writestatus{loading}{ConTeXt Support Macros / Boxes} + +\unprotect + +%D \macros +%D {strutdp,strutht,strutwd} +%D +%D The next shortcuts save memory and keying. The width is +%D normally zero points (if not, you're in trouble). These +%D shortcuts can be used like a dimension, opposite to the +%D core macros \type {\strutdepth} and alike, which are +%D values. + +\def\strutdp{\dp\strutbox} +\def\strutht{\ht\strutbox} +\def\strutwd{\wd\strutbox} + +%D \macros +%D {resetbox, emptybox} +%D +%D Let's start with an easy one. The next macro hides the +%D ugly \type {@} in \type {\voidb@x}. + +\ifx\voidbox\undefined \newbox\voidbox \fi +\ifx\voidb@x\undefined \let\voidb@x\voidbox \fi + +\def\emptybox {\box \voidbox} +\def\unvoidbox {\unhbox\voidbox} +\def\resetbox#1{\setbox#1\box\voidbox} + +%D \macros +%D {nextdepth} +%D +%D Let's start with a rather simple declaration. Sometimes we +%D need to save the \TEX\ \DIMENSION\ \type{\prevdepth} and +%D append it later on. The name \type{\nextdepth} suits +%D this purpose well. + +\newdimen\nextdepth + +%D \macros +%D {smashbox, smashedbox} +%D +%D Smashing is introduced in \PLAIN\ \TEX, and stands for +%D reducing the dimensions of a box to zero. The most resolute +%D one is presented first. + +\def\smashbox#1% + {\wd#1\zeropoint + \ht#1\zeropoint + \dp#1\zeropoint} + +\def\smashboxed#1% + {\smashbox{#1}% + \box#1\relax} + +%D \macros +%D {hsmashbox,vsmashbox} +%D +%D Smashing can be used for overlaying boxes. Depending on +%D the mode, horizontal or vertical, one can use: + +\def\hsmashbox#1% + {\wd#1\zeropoint} + +\def\vsmashbox#1% + {\ht#1\zeropoint + \dp#1\zeropoint} + +%D The next implementation is less sensitive for spurious +%D spaces. + +\newcount\registercount + +\def\smashbox + {\afterassignment\dosmashbox\registercount} + +\def\dosmashbox + {\wd\registercount\zeropoint + \ht\registercount\zeropoint + \dp\registercount\zeropoint} + +\def\smashedbox + {\afterassignment\thesmashedbox\registercount} + +\def\thesmashedbox + {\dosmashbox + \box\registercount} + +\def\hsmashbox + {\afterassignment\dohsmashbox\registercount} + +\def\dohsmashbox + {\wd\registercount\zeropoint} + +\def\vsmashbox + {\afterassignment\dovsmashbox\registercount} + +\def\dovsmashbox + {\ht\registercount\zeropoint + \dp\registercount\zeropoint} + +%D \macros +%D {hsmash,vsmash, +%D hsmashed,vsmashed} +%D +%D While the previous macros expected a \BOX, the next act on a +%D content. They are some subtle differences betreen the smash +%D and smashed alternatives. The later ones reduce all +%D dimensions to zero. + +% Ok, but inefficient and/or catcode unsafe: +% +% \def\hsmash #1{\bgroup\setbox0=\normalhbox{#1}\hsmashbox0\box0\egroup} +% \def\vsmash #1{\bgroup\setbox0=\normalvbox{#1}\vsmashbox0\box0\egroup} +% \def\hsmashed#1{\bgroup\setbox0=\normalhbox{#1}\smashbox 0\box0\egroup} +% \def\vsmashed#1{\bgroup\setbox0=\normalvbox{#1}\smashbox 0\box0\egroup} +% +% Better, but a waste of tokens: +% +% \def\hsmash {\bgroup\dowithnextbox{\hsmashbox\nextbox\flushnextbox\egroup}\normalhbox} +% \def\vsmash {\bgroup\dowithnextbox{\vsmashbox\nextbox\flushnextbox\nextbox\egroup}\normalvbox} +% \def\hsmashed{\bgroup\dowithnextbox{\smashbox \nextbox\flushnextbox\nextbox\egroup}\normalhbox} +% \def\vsmashed{\bgroup\dowithnextbox{\smashbox \nextbox\flushnextbox\nextbox\egroup}\normalvbox} +% +% The best: + +\def\dosomesmash#1% (begin|end)group ipv (b|e)group ? + {\bgroup\dowithnextbox{#1\nextbox\flushnextbox\egroup}} + +\def\hsmash {\dosomesmash\hsmashbox\normalhbox} +\def\vsmash {\dosomesmash\vsmashbox\normalvbox} +\def\hsmashed{\dosomesmash\smashbox \normalhbox} +\def\vsmashed{\dosomesmash\smashbox \normalvbox} + +%D \macros +%D {smashedhbox,smashedvbox} +%D +%D Also handy (all dimensions zeroed): +%D +%D \starttyping +%D \smashedhbox to ... {...} +%D \smashedvbox to ... {...} +%D \stoptyping + +\def\dosmashedbox#1% + %{#1\bgroup\dowithnextbox{\smashbox\nextbox\flushnextbox\egroup}#1} + {#1\bgroup\dowithnextbox{\smashedbox\nextbox\egroup}#1} + +\def\smashedhbox{\dosmashedbox\hbox} +\def\smashedvbox{\dosmashedbox\vbox} + +%D \macros +%D {smash} +%D +%D This smash alternative takes an optional arg [whdtb] as +%D well as is potentially catcode safer. It is needed by the +%D math module (although the \type {\leavevmode} is not added +%D here). + +\def\smash + {\futurelet\nexttoken\dosmash} + +\def\dosmash + {\ifx\nexttoken[\@EA\dodosmash\else\@EA\donosmash\fi} + +\def\donosmash + {\dodosmash[hd]} + +\def\dodosmash[#1]% + {\edef\@@smash{#1}\futurelet\nexttoken\dododosmash} + +\def\dododosmash % if needed we can avoid the \next + {\ifmmode + \def\next##1{\mathpalette\mathsm@sh{##1}}% + \else\ifx\nexttoken\bgroup + \let\next\finsm@sh + \else + \def\next##1{\finsm@sh{##1}}% + \fi\fi + \next} + +\def\mathsm@sh#1#2% redefined plain macro + {\finsm@sh{$\mathsurround\zeropoint#1{#2}$}} + +\def\makesm@sh#1% redefined plain macro (handles t b h d w) + {\if#1w\nextboxwd\zeropoint\else + \if#1h\nextboxht\zeropoint\else + \if#1d\nextboxdp\zeropoint\else + \if#1t\nextboxht\zeropoint\else + \if#1b\nextboxdp\zeropoint\fi\fi\fi\fi\fi} + +\def\finsm@sh % redefined plain macro + {\dowithnextbox{\@EA\handletokens\@@smash\with\makesm@sh\flushnextbox}\normalhbox} + +%D \starttabulate[|l|l|] +%D \NC w \NC \ruledhbox{\smash [w]{This is some great smashing, isn't it?}} \NC \NR +%D \NC h \NC \ruledhbox{\smash [h]{This is some great smashing, isn't it?}} \NC \NR +%D \NC d \NC \ruledhbox{\smash [d]{This is some great smashing, isn't it?}} \NC \NR +%D \NC tb \NC \ruledhbox{\smash [tb]{This is some great smashing, isn't it?}} \NC \NR +%D \NC whd \NC \ruledhbox{\smash[whd]{This is some great smashing, isn't it?}} \NC \NR +%D \stoptabulate + +%D \macros +%D {phantom, hphantom, vphantom, mathstrut} +%D +%D The next implementation of \type {\phantom} cum suis does +%D not grab an argument in the non||math case, which is better. + +\unexpanded\def\phantom {\ph@nt\nextbox\nextbox\nextbox} +\unexpanded\def\vphantom{\ph@nt\nextbox\nextbox\voidbox} +\unexpanded\def\hphantom{\ph@nt\voidbox\voidbox\nextbox} + +%D Due to a complicated call to \type {\mathpallete} and +%D thereby \type {\mathchoice}, the next macro looks ugly. +%D We also take care of non||braced arguments. + +\def\ph@nt#1#2#3% + {\def\doph@nt + {\ifmmode + \def\mathph@nt####1####2{\makeph@nt#1#2#3{$\mathsurround\zeropoint####1{####2}$}}% + \def\nextph@nt{\mathpalette\mathph@nt}% + \else\ifx\nextph@nt\bgroup + \def\nextph@nt{\makeph@nt#1#2#3}% + \else + \def\nextph@nt####1{\makeph@nt#1#2#3{####1}}% + \fi\fi + \nextph@nt}% + \futurelet\nextph@nt\doph@nt} + +\def\makeph@nt#1#2#3% + {\begingroup + \dowithnextbox + {\setbox\scratchbox\null + \ht\scratchbox\ht#1% + \dp\scratchbox\dp#2% + \wd\scratchbox\wd#3% + \box\scratchbox + \endgroup} + \normalhbox} + +\let\finph@nt\undefined + +%D We also define plain's \type {\mathstrut}. + +\unexpanded\def\mathstrut{\vphantom{(}} + +%D \macros +%D {getboxheight} +%D +%D Although often needed, \TEX\ does not support arithmics +%D like: +%D +%D \starttyping +%D \dimen0 = \ht0 + \dp0 +%D \stoptyping +%D +%D so we implemented: +%D +%D \starttyping +%D \getboxheight ... \of \box... +%D \stoptyping +%D +%D For instance, +%D +%D \starttyping +%D \getboxheight \dimen0 \of \box0 +%D \getboxheight \someheight \of \box \tempbox +%D \stoptyping +%D +%D The implementation is rather stupid: +%D +%D \starttyping +%D \def\getboxheight#1\of#2\box#3% +%D {#1\ht#3\advance#1\dp#3\relax} +%D \stoptyping +%D +%D The next alternative is slightly more clever, since +%D it accepts \type {{12}} as well as \type {12} as box +%D number. + +\def\getboxheight#1\of#2\box#3% + {\def\next{#1\dimexpr\ht\registercount+\dp\registercount\relax}% + \afterassignment\next\registercount=#3} + +%D For a long time the following three macros were part of +%D the grid snapping core module, but it makes more sense to +%D have them here so that users can see them. +%D +%D \macros +%D {getnoflines, getroundednoflines, getrawnoflines} +%D +%D Het commando \type{\getnoflines} converteert een hoogte +%D (dimensie) in een aantal regels en kent dit toe aan +%D \type{\noflines}. +%D +%D \starttyping +%D \getnoflines{dimensie} +%D \stoptyping +%D +%D Er wordt gedeeld door \type{\openlineheight} en een hoogte +%D van~0pt komt overeen met 0~regels. The raw alternative +%D does not round. + +%D For a long time we had: +%D +%D \starttyping +%D \newcount\noflines +%D \newdimen\noflinesheight +%D +%D \def\dogetnoflines#1#2% +%D {\noflinesheight#2\relax +%D \ifzeropt\noflinesheight % \ifdim\noflinesheight=\zeropoint +%D \noflines\zerocount +%D \else +%D \divide\noflinesheight \openlineheight +%D \noflines\noflinesheight +%D #1\ifdim\noflines\openlineheight=#2\relax \else +%D \advance\noflines\ifdim#2>\zeropoint\plusone\else\minusone\fi +%D \fi\fi +%D \fi} +%D +%D \def\getnoflines {\dogetnoflines\iftrue } % compensated +%D \def\getrawnoflines{\dogetnoflines\iffalse} % no compensation +%D \stoptyping +%D +%D A more recent variant is: + +\ifx\roundingeps\undefined \newdimen\roundingeps \roundingeps=10sp \fi + +\newcount\noflines +\newdimen\noflinesheight + +% \def\getnoflines {\xdogetnoflines\plusone } % compensated +% \def\getroundednoflines{\xdogetnoflines\plustwo } % rounded +% \def\getrawnoflines {\xdogetnoflines\plusthree} % truncated +% +% \def\xdogetnoflines#1#2% +% {\noflinesheight#2\relax +% \ifzeropt\noflinesheight +% \noflines\zerocount +% \else\ifdim\noflinesheight>\zeropoint +% \ifcase#1\or +% \advance\noflinesheight-\roundingeps +% \divide\noflinesheight\openlineheight +% \noflines\noflinesheight +% \advance\noflines\plusone +% \or +% \advance\noflinesheight\roundingeps +% \divide\noflinesheight\openlineheight +% \noflines\noflinesheight +% \or +% \advance\noflinesheight\roundingeps +% \advance\noflinesheight.5\openlineheight +% \divide\noflinesheight\openlineheight +% \noflines\noflinesheight +% \fi +% \else +% \ifcase#1\or +% \advance\noflinesheight\roundingeps +% \divide\noflinesheight\openlineheight +% \noflines\noflinesheight +% \advance\noflines\minusone +% \or +% \advance\noflinesheight-\roundingeps +% \divide\noflinesheight\openlineheight +% \noflines\noflinesheight +% \or +% \advance\noflinesheight-\roundingeps +% \advance\noflinesheight-.5\openlineheight +% \divide\noflinesheight\openlineheight +% \noflines\noflinesheight +% \fi +% \fi\fi} + +\def\getnoflines#1% + {\noflinesheight#1\relax + \ifzeropt\noflinesheight + \noflines\zerocount + \else\ifdim\noflinesheight>\zeropoint + \advance\noflinesheight-\roundingeps + \divide\noflinesheight\openlineheight + \noflines\noflinesheight + \advance\noflines\plusone + \else + \advance\noflinesheight\roundingeps + \divide\noflinesheight\openlineheight + \noflines\noflinesheight + \advance\noflines\minusone + \fi\fi} + +\def\getroundednoflines#1% + {\noflinesheight#1\relax + \ifzeropt\noflinesheight + \noflines\zerocount + \else\ifdim\noflinesheight>\zeropoint + \advance\noflinesheight\roundingeps + \divide\noflinesheight\openlineheight + \noflines\noflinesheight + \else + \advance\noflinesheight-\roundingeps + \divide\noflinesheight\openlineheight + \noflines\noflinesheight + \fi\fi} + +\def\getrawnoflines#1% + {\noflinesheight#1\relax + \ifzeropt\noflinesheight + \noflines\zerocount + \else\ifdim\noflinesheight>\zeropoint + \advance\noflinesheight\roundingeps + \advance\noflinesheight.5\openlineheight + \divide\noflinesheight\openlineheight + \noflines\noflinesheight + \else + \advance\noflinesheight-\roundingeps + \advance\noflinesheight-.5\openlineheight + \divide\noflinesheight\openlineheight + \noflines\noflinesheight + \fi\fi} + +%D Let's proof that it works: +%D +%D \startbuffer +%D \scratchdimen\dimexpr(3pt) \getnoflines\scratchdimen 1=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10\lineheight) \getnoflines\scratchdimen 10=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10.1\lineheight) \getnoflines\scratchdimen 11=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10.5\lineheight) \getnoflines\scratchdimen 11=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10.9\lineheight) \getnoflines\scratchdimen 11=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10\lineheight+3pt) \getnoflines\scratchdimen 11=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10\lineheight+3sp) \getnoflines\scratchdimen 10=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10\lineheight-3sp) \getnoflines\scratchdimen 10=\the\noflines \endgraf +%D +%D \scratchdimen\dimexpr(3pt) \getrawnoflines\scratchdimen 0=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10\lineheight) \getrawnoflines\scratchdimen 10=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10.1\lineheight) \getrawnoflines\scratchdimen 10=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10.5\lineheight) \getrawnoflines\scratchdimen 11=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10.9\lineheight) \getrawnoflines\scratchdimen 11=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10\lineheight+3pt) \getrawnoflines\scratchdimen 10=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10\lineheight+3sp) \getrawnoflines\scratchdimen 10=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10\lineheight-3sp) \getrawnoflines\scratchdimen 10=\the\noflines \endgraf +%D \stopbuffer +%D +%D \typebuffer \getbuffer + +%D \macros +%D {determinenoflines} +%D +%D The next macro determines the number of lines and +%D returns it it \type {\noflines}. The macro works +%D reasonable well as long as the content can be unboxed. +%D +%D \starttyping +%D \determinenoflines{test\\test} +%D \determinenoflines{\bfd test\\test} +%D \determinenoflines{\definedfont[Sans at 40pt]test\\test} +%D \stoptyping + +\def\determinenoflines % can be mkiv'd + {\bgroup + \forgetall + \let\crlf\endgraf + \let\\\endgraf + \dowithnextbox + {\beginofshapebox + \unvbox\nextbox + \endofshapebox + % \global\count1\zerocount + % \reshapebox{\global\advance\count1\plusone}% + % \egroup\noflines\count1 }% + \scratchcounter\zerocount + \reshapebox{\global\advance\scratchcounter\plusone}% + \expandafter\egroup\expandafter\noflines\the\scratchcounter\relax + }\vbox} + +%D \macros +%D {doiftextelse, doiftext} +%D +%D When \type {\doifelse} cum suis hopelessly fail, for +%D instance because we pass data, we can fall back on the next +%D macro: +%D +%D \starttyping +%D \doiftextelse {data} {then branch} {else branch} +%D \doiftext {data} {then branch} +%D \stoptyping + +\newif\iftrialtypesetting + +\def\doiftextelse#1% + {\bgroup + \setbox\scratchbox\normalhbox + {\trialtypesettingtrue + \ignorespaces#1\removeunwantedspaces}% + \ifzeropt\wd\scratchbox + \egroup\@EA\secondoftwoarguments + \else + \egroup\@EA\firstoftwoarguments + \fi} + +\def\doiftext#1#2% + {\doiftextelse{#1}{#2}\donothing} + +%D \macros +%D {dowithnextbox,nextbox} +%D +%D Sometimes we want a macro to grab a box and do something +%D on the content. One could pass an argument to a box, but +%D this can violate the specific \CATCODES\ of its content and +%D leads to unexpected results. The next macro treats the +%D following braced text as the content of a box and +%D manipulates it afterwards in a predefined way. +%D +%D The first argument specifies what to do with the content. +%D This content is available in \type{\nextbox}. The second +%D argument is one of \type{\hbox}, \type{\vbox} or +%D \type{\vtop}. The third argument must be grouped with +%D \type{\bgroup} and \type{\egroup}, \type{{...}} or can be +%D a \type{\box} specification. +%D +%D In \CONTEXT\ this macro is used for picking up a box and +%D treating it according to earlier specifications. We use for +%D instance something like: +%D +%D \starttyping +%D \def\getfloat% +%D {\def\handlefloat{...\flushnextbox...} +%D \dowithnextbox\handlefloat\normalvbox} +%D \stoptyping +%D +%D instead of: +%D +%D \starttyping +%D \def\getfloat#1% +%D {...#1...} +%D \stoptyping +%D +%D In this implementation the \type{\aftergroup} construction +%D is needed because \type{\afterassignment} is executed inside +%D the box. + +\ifx\nextbox\undefined \newbox\nextbox \fi + +\long\def\dowithnextbox#1% + {\long\def\dodowithnextbox{#1}% + \afterassignment\dododowithnextbox + \setbox\nextbox} + +\def\dododowithnextbox + {\aftergroup\dodowithnextbox} + +\long\def\dowithnextboxcs#1% + {\let\dodowithnextbox#1% + \afterassignment\dododowithnextbox + \setbox\nextbox} + +\def\dododowithnextbox + {\aftergroup\dodowithnextbox} + +%D So in fact we get: +%D +%D \starttyping +%D \setbox\nextbox { \aftergroup\dodowithnextbox ... } +%D \stoptyping +%D +%D or +%D +%D \starttyping +%D \setbox\nextbox { ... } \dodowithnextbox +%D \stoptyping +%D +%D A slower but more versatile implementation is: +%D +%D \starttyping +%D \long\def\dowithnextbox#1#2% +%D {\long\def\dodowithnextbox{#1}% +%D \ifx#2\normalhbox +%D \afterassignment\dododowithnextbox +%D \else\ifx#2\normalvbox +%D \afterassignment\dododowithnextbox +%D \else\ifx#2\normalvtop +%D \afterassignment\dododowithnextbox +%D \else\ifx#2\normalvcenter +%D \afterassignment\dododowithnextbox +%D \else +%D \afterassignment\dodowithnextbox +%D \fi\fi\fi\fi +%D \setbox\nextbox#2} +%D \stoptyping +%D +%D This alternative also accepts \type{\box0} and alike, but +%D we don't really need this functionality now. + +%D \macros +%D {nextboxht,nextboxwd,nextboxdp,flushnextbox} +%D +%D The next couple of shortcuts saves us memory as well as +%D \type {{}}'s in passing parameters. + +\def\nextboxht{\ht\nextbox} +\def\nextboxwd{\wd\nextbox} +\def\nextboxdp{\dp\nextbox} + +\def\flushnextbox{\box\nextbox} + +%D \macros +%D {dowithnextboxcontent} +%D +%D But, occasionally we do need to pass some local settings +%D without wanting to use additional grouping. Therefore we +%D provide: +%D +%D \starttyping +%D \dowithnextboxcontent{inside}{after}{box content} +%D \stoptyping +%D +%D {\em todo: Search source for potential usage!} + +\long\def\dowithnextboxcontent#1#2% inside, after + {\long\def\dodowithnextbox{#2}% + \def\dododowithnextbox{#1\aftergroup\dodowithnextbox}% + \afterassignment\dododowithnextbox + \setbox\nextbox} + +%D Now we can redefine \type {\dowithnextbox} as follows: +%D +%D \starttyping +%D \def\dowithnextbox{\dowithnextboxcontent\empty} +%D \stoptyping +%D +%D But since this macro is used often and since this implementation +%D is slower, we will not use that definition. + +% maybe: +% +% depending on the size of the action, about 10% faster +% +% \newtoks\nextboxtoks +% +% \def\dowithnextbox {\afterassignment\redowithnextbox\nextboxtoks} +% \def\redowithnextbox {\afterassignment\dododowithnextbox\setbox\nextbox} +% \def\dododowithnextbox{\aftergroup\dodowithnextbox} +% \def\dodowithnextbox {\the\nextboxtoks} +% +% \long\def\dowithnextboxcontent#1% #2% inside, after +% {\def\dododowithnextbox{#1\aftergroup\dodowithnextbox}% +% \afterassignment\redowithnextboxcontent\nextboxtoks} +% +% \def\redowithnextboxcontent +% {\afterassignment\dododowithnextbox\setbox\nextbox} + +%D \macros +%D {llap, rlap, tlap, blap, clap} +%D +%D Some well known friends, but we implement them our own +%D way. We want the macros to work in both math and text mode. + +\def\dodorlap{\normalhbox to \zeropoint{\flushnextbox\normalhss}\endgroup} +\def\dodollap{\normalhbox to \zeropoint{\normalhss\flushnextbox}\endgroup} +\def\dodoclap{\normalhbox to \zeropoint{\normalhss\flushnextbox\normalhss}\endgroup} + +\def\dorlap{\begingroup\dowithnextboxcs\dodorlap\normalhbox} +\def\dollap{\begingroup\dowithnextboxcs\dodollap\normalhbox} +\def\doclap{\begingroup\dowithnextboxcs\dodoclap\normalhbox} + +\def\domathclap{\mathpalette\dodomathclap} \def\dodomathclap#1#2{\doclap{$\mathsurround\zeropoint#1#2$}} +\def\domathllap{\mathpalette\dodomathllap} \def\dodomathllap#1#2{\dollap{$\mathsurround\zeropoint#1#2$}} +\def\domathrlap{\mathpalette\dodomathrlap} \def\dodomathrlap#1#2{\dorlap{$\mathsurround\zeropoint#1#2$}} + +\unexpanded\def\rlap{\mathortext\domathrlap\dorlap} +\unexpanded\def\llap{\mathortext\domathllap\dollap} +\unexpanded\def\clap{\mathortext\domathclap\doclap} + +\def\dodotlap{\normalvbox to \zeropoint{\normalvss\flushnextbox}\endgroup} +\def\dodoblap{\normalvbox to \zeropoint{\flushnextbox\normalvss}\endgroup} + +\def\tlap{\begingroup\dowithnextboxcs\dodotlap\normalvbox} +\def\blap{\begingroup\dowithnextboxcs\dodoblap\normalvbox} + +%D \macros +%D {beginofshapebox, +%D reshapebox, doreshapebox, +%D flushshapebox, +%D innerflushshapebox, +%D shapebox, +%D ifreshapingbox} +%D +%D The next utility macro originates from some linenumbering +%D mechanism. Due to \TEX's advanced way of typesetting +%D paragraphs, it's not easy to do things on a line||by||line +%D basis. This macro is able to reprocess a given box and can +%D act upon its vertical boxed components, such as lines. The +%D unwinding sequence in this macro is inspired by a \NTG\ +%D workshop of David Salomon in June 1992. +%D +%D First we have to grab the piece of text we want to act +%D upon. This is done by means of the duo macros: +%D +%D \starttyping +%D \beginofshapebox +%D a piece of text +%D \endofshapebox +%D \stoptyping +%D +%D When all texts is collected, we can call \type{\reshapebox} +%D and do something with it's vertical components. We can make +%D as much passes as needed. When we're done, the box can be +%D unloaded with \type{\flushshapebox}. The only condition in +%D this scheme is that \type{\reshapebox} must somehow unload +%D the \BOX\ \type{\shapebox}. +%D +%D An important aspect is that the content is unrolled +%D bottom||up. The next example illustrates this maybe +%D unexpected characteristic. +%D +%D \startbuffer +%D \beginofshapebox +%D \em \input tufte +%D \endofshapebox +%D +%D \newcounter\LineNumber +%D +%D \reshapebox +%D {\doglobal\increment\LineNumber +%D \normalhbox{\llap{\LineNumber\hskip2em}\box\shapebox}} +%D +%D \flushshapebox +%D \stopbuffer +%D +%D \typebuffer +%D +%D \getbuffer +%D +%D As we can see, when some kind of numbering is done, we have +%D to add a second pass. +%D +%D \startbuffer +%D \newcounter\LineNumber +%D \newcounter\NumberOfLines +%D +%D \reshapebox +%D {\doglobal\increment\NumberOfLines +%D \box\shapebox} +%D +%D \reshapebox +%D {\doglobal\increment\LineNumber +%D \normalhbox +%D {\llap{\LineNumber\ (\NumberOfLines)\hskip2em}% +%D \box\shapebox}% +%D \doglobal\decrement\NumberOfLines} +%D +%D \flushshapebox +%D \stopbuffer +%D +%D \typebuffer +%D +%D \getbuffer +%D +%D This example shows that the content of the box is still +%D available after flushing. Another feature is that only the +%D last reshaping counts. Multiple reshaping can be done by: +%D +%D \startbuffer +%D \beginofshapebox +%D \flushshapebox +%D \endofshapebox +%D +%D \reshapebox +%D {\doglobal\increment\LineNumber +%D \normalhbox{\llap{$\star$\hskip1em}\box\shapebox}% +%D \doglobal\decrement\NumberOfLines} +%D +%D \flushshapebox +%D \stopbuffer +%D +%D \typebuffer +%D +%D \getbuffer +%D +%D The macros are surprisingly easy to follow and in fact +%D introduce no new concepts. Nearly all books on \TEX\ show +%D similar solutions for unwinding \BOXES. +%D +%D Some macros, like footnote ones, can be sensitive for +%D reshaping, which can result in an endless loop. We +%D therefore offer: +%D +%D \starttyping +%D \ifreshapingbox +%D \stoptyping +%D +%D Some \CONTEXT\ commands are protected this way. Anyhow, +%D reshaping is aborted after 100 dead cycles. +%D +%D By the way, changing the height and depth of \BOX\ +%D \type{\shapebox} results in bad spacing. This means that +%D for instance linenumbers etc. should be given zero height +%D and depth before being lapped into the margin. The +%D previous examples ignore this side effect, but beware! + +\newif \ifsomeshapeleft +\newif \ifreshapingbox + +\newbox \shapebox +\newcount \shapepenalty +\newdimen \shapekern +\newskip \shapeskip + +\newbox \newshapebox +\newbox \oldshapebox + +\newcount \shapecounter + +\newevery \everyshapebox \relax + +\def\shapesignal{.12345678pt} % or 12345sp + +% todo: in etex lastnode + +\def\reshapebox#1% + {\doreshapebox + {#1}% + {\penalty\shapepenalty}% + {\kern \shapekern }% + {\vskip \shapeskip }} + +\newbox\tmpshapebox + +\newif\ifreshapingfailed % may save redundant runs + +\def\doreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip + {\global\reshapingfailedfalse + \ifzeropt\ht\oldshapebox % \ifdim\ht\oldshapebox=\zeropoint + \setbox\newshapebox\normalvbox{}% + \else + \setbox\newshapebox\normalvbox + {\unvcopy\oldshapebox + \resetbox\newshapebox + \shapecounter\zerocount + \doloop{\dodoreshapebox{#1}{#2}{#3}{#4}}}% + \setbox\newshapebox\box\tmpshapebox + \fi} + +\ifx\originalshapebox\undefined \let\originalshapebox\oldshapebox \fi + +% %D The old traditional tex variant: +% +% \def\insertshapesignal +% {\normalhbox to \shapesignal{\strut\hss}% plus \strut +% \prevdepth\strutdp} % never \nointerlineskip +% +% \def\restoreshapebox % compensates for the signal +% {\global\setbox\tmpshapebox\vbox{\vskip-\lineheight\unvcopy\oldshapebox}} +% +% \def\shapeboxstrut % put this in front if needed ! +% {\vrule\!!width\zeropoint\!!height\ht\shapebox\!!depth\dp\shapebox} +% +% \def\dodoreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip +% {\ifzeropt\lastskip % \ifdim\lastskip=\zeropoint\relax +% \ifzeropt\lastkern % \ifdim\lastkern=\zeropoint\relax +% \ifcase\lastpenalty % \ifnum\lastpenalty=\zerocount +% \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 +% \else +% \shapepenalty\lastpenalty +% \global\setbox\tmpshapebox\normalvbox{#2\unvbox\tmpshapebox}% +% \unpenalty +% \fi +% \else +% \shapekern\lastkern +% \global\setbox\tmpshapebox\normalvbox{#3\unvbox\tmpshapebox}% +% \unkern +% \fi +% \else +% \shapeskip\lastskip +% \global\setbox\tmpshapebox\normalvbox{#4\unvbox\tmpshapebox}% +% \unskip +% \fi +% \ifnum\shapecounter>100 % can be less +% \global\reshapingfailedtrue +% \message{!!forced exit from shapebox!!}% +% \restoreshapebox +% \exitloop +% \else +% \advance\shapecounter \plusone +% \fi} +% +% But now that the lastnode bugfixes are wide spread we can use: +% +% We will turn this into a \MKIV\ variant. + +\def\insertshapesignal + {\normalhbox to \shapesignal{\strut\hss}% plus \strut + \prevdepth\strutdp} % never \nointerlineskip + +\def\restoreshapebox % compensates for the signal + {\global\setbox\tmpshapebox\vbox{\vskip-\lineheight\unvcopy\oldshapebox}} + +\def\dodoreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip + {\ifnum\lastnodetype=\@@gluenode + \shapeskip\lastskip + \global\setbox\tmpshapebox\normalvbox{#4\unvbox\tmpshapebox}% + \unskip + \else\ifnum\lastnodetype=\@@kernnode + \shapekern\lastkern + \global\setbox\tmpshapebox\normalvbox{#3\unvbox\tmpshapebox}% + \unkern + \else\ifnum\lastnodetype=\@@penaltynode + \shapepenalty\lastpenalty + \global\setbox\tmpshapebox\normalvbox{#2\unvbox\tmpshapebox}% + \unpenalty + \else\ifnum\lastnodetype<\zeropoint + \exitloop + \else + \setbox\shapebox\lastbox + \ifvoid\shapebox + \else\ifdim\wd\shapebox=\shapesignal\relax + \exitloop + \else + \shapecounter\zerocount + \global\setbox\tmpshapebox\normalvbox{#1\unvbox\tmpshapebox}% + \fi\fi + \fi\fi\fi\fi + \ifnum\shapecounter>100 % can be less + \global\reshapingfailedtrue + \message{!!forced exit from shapebox \the\lastnodetype !!}% + \restoreshapebox + \exitloop + \else + \advance\shapecounter \plusone + \fi} + +\def\beginofshapebox + {\setbox\oldshapebox\normalvbox + \bgroup + \reshapingboxtrue + \the\everyshapebox + \insertshapesignal} + +\def\endofshapebox + {\endgraf + \egroup} + +\let\beginshapebox\beginofshapebox +\let\endshapebox \endofshapebox + +\def\flushshapebox + {\bgroup + \ifzeropt\ht\newshapebox % \ifdim\ht\newshapebox=\zeropoint + \else + % make \prevdepth legal + % \par before the next \vskip gives far worse results + \ifdim\parskip>\zeropoint\vskip\parskip\else\par\fi + % and take a look + \ifdim\prevdepth=-\thousandpoint + \prevdepth\zeropoint + \fi + \ifdim\prevdepth<\zeropoint\relax + % something like a line or a signal or ... + \donetrue + \else\ifinner + % not watertight and not ok + \donefalse + \else\ifdim\pagegoal=\maxdimen + \donetrue + \else + % give the previous line a normal depth + \donetrue + {\forgeteverypar\verticalstrut}\nobreak + \kern-\struttotal % geen \vskip + \kern-\parskip + % \vskip-\strutdp + \fi\fi\fi + \scratchdimen\dp\newshapebox + \unvbox\newshapebox + % \prevdepth=0pt and \dp\newshapebox depend on last line + \kern-\scratchdimen % ?? + % now \prevdepth=0pt + \ifdone + \kern\strutdp + \prevdepth\strutdp + \fi + \fi + \egroup} + +%D In real inner situations we can use: +%D +%D \starttyping +%D \flushinnershapebox +%D \stoptyping +%D +%D This one is used in \type{\framed}. + +% The kern fails on for instance: +% +% \omlijnd[offset=0pt,hoogte=8mm,uitlijnen={rechts,laho}]{\bfa test} + +\def\innerflushshapebox + {\ifzeropt\ht\newshapebox \else + \unvcopy\newshapebox\relax % unvcopy ! else spacing problem + % \kern-\dp\newshapebox\relax + \fi} + +%D For absolute control, one can use \type{\doreshapebox} +%D directly. This macro takes four arguments, that take care +%D of: +%D +%D \startitemize[n,packed] +%D \item \type{\shapebox} +%D \item \type{\shapepenalty} +%D \item \type{\shapekern} +%D \item \type{\shapeskip} +%D \stopitemize + +%D \macros +%D {shapedhbox} +%D +%D When constructing a new box, using the content of \type +%D {\shapebox}, one can best use \type {\shapedhbox} instead +%D of \type {\normalhbox}, since it manages the height and depth of +%D the line. + +% \def\shapedhbox +% {\dowithnextbox +% {\nextboxht\zeropoint +% \nextboxdp\zeropoint +% \flushnextbox} +% \normalhbox} + +\def\shapedhbox % lines with non strutted dimensions have + {\expanded{\dowithnextbox % interlineskip so if we want the original + {\nextboxht\the\ht\shapebox % spacing, we need to preserve the original + \nextboxdp\the\dp\shapebox % height and depth which is definitely + \noexpand\flushnextbox}} % needed if we apply struts to the 'new' + \normalhbox} % box or do something that changed ist size + +%D \macros +%D {hyphenatedword, +%D hyphenatedpar, +%D hyphenatedfile, +%D dohyphenateword} +%D +%D The next one is a tricky one. \PLAIN\ \TEX\ provides +%D \type{\showhyphens} for showing macros on the terminal. When +%D preparing a long list of words we decided to show the +%D hyphens, but had to find out that the \PLAIN\ alternative +%D can hardly be used and|/|or adapted to typesetting. The next +%D two macros do the job and a little more. First we define the +%D (slightly adapted) plain variant: + +\def\showhyphens#1% + {\begingroup + \setbox\scratchbox\vbox + {\parfillskip\zerocount + \hsize\maxdimen + %\tenrm + \pretolerance\minusone + \tolerance\minusone + \hbadness\zerocount + \showboxdepth\zerocount + \ #1}% + \endgroup} + +%D The simple command \type{\hyphenatedword} accepts one +%D argument and gives the hyphenated word. This macro calls for +%D +%D \starttyping +%D \dohyphenateword {n} {pre} {word} +%D \stoptyping +%D +%D The next examples tell more than lots of words: +%D +%D \startbuffer +%D \dohyphenateword{0} {} {dohyphenatedword} +%D \dohyphenateword{1} {...} {dohyphenatedword} +%D \dohyphenateword{2} {...} {dohyphenatedword} +%D \stopbuffer +%D +%D \typebuffer +%D +%D Here, \type{\hyphenatedword{dohyphenatedword}} is the +%D shorter alternative for the first line. +%D +%D \startvoorbeeld +%D \getbuffer +%D \stopvoorbeeld +%D +%D These macros are slow but effective and not that hard to +%D program at all. + +\ifx\scantokens\undefined \let\scantokens\firstofoneargument \fi + +\def\dohyphenateword#1#2#3% + {\bgroup + \setbox\scratchbox\normalhbox + {\dontcomplain + \nopenalties % \widowpenalty \clubpenalty \brokenpenalty \doublehyphendemerits \finalhyphendemerits \adjdemerits + \hyphenpenalty \zerocount + \exhyphenpenalty\zerocount + \setbox0\normalvbox + {\hsize\zeropoint + \hskip\zeropoint\relax % really needed + \ifnum#1<\zeropoint + \obeyspaces + \obeylines + \def\obeyedspace{\hskip\zeropoint\hbox to \onepoint{}\hskip\zeropoint}% + \let\obeyedline \obeyedspace + \ifcase-#1\or + \def\next{#3\relax}\scantokens\expandafter{\next}% relax catches lookahead problem + % also ok: \scantokens{#3}% % as in \hyphenatedword{spanish|?|} + \or + \readfile{#3}\donothing\donothing + \else + #3% + \fi + \else + #3% + \fi}% + \ifnum#1>\zerocount + \dorecurse{#1} + {\setbox2\normalhbox + {\splittopskip\openstrutheight + \vsplit0 to \baselineskip}}% + #2% + \fi + \doloop + {\setbox2\normalhbox + {\splittopskip\openstrutheight + \vsplit0 to \baselineskip}% + \setbox2\normalhbox + {\unhbox2 + \setbox2\lastbox + \normalvbox + {\unvbox2 + \setbox2\lastbox + \normalhbox{\unhbox2}}}% + \ifnum#1<\zeropoint\ifdim\wd2=\onepoint\space\else\box2\allowbreak\fi\else\box2\fi + \ifzeropt\ht0 \exitloop\fi}% % \ifdim\ht0=\zeropoint\exitloop\fi}% + \removeunwantedspaces}% + \ifnum#1>\zerocount + \ht\scratchbox\strutht + \dp\scratchbox\strutdp + \box\scratchbox + \else + \unhbox\scratchbox + \fi + \egroup} + +\def\hyphenatedword{\dohyphenateword\zerocount\empty} +\def\hyphenatedpar {\dohyphenateword\minusone \empty} +\def\hyphenatedfile{\dohyphenateword{-2}\empty} + +%D You may want to give the following call a try: +%D +%D \starttyping +%D \hyphenatedpar{\readfile{zapf}{}{}}\endgraf +%D \stoptyping + +%D \macros +%D {processtokens} +%D +%D We fully agree with (most) typographers that inter||letter +%D spacing is only permitted in fancy titles, we provide a +%D macro that can be used to do so. Because this is +%D (definitely and fortunately) no feature of \TEX, we have to +%D step through the token list ourselves. +%D +%D \starttyping +%D \processtokens {before} {between} {after} {space} {tokens} +%D \stoptyping +%D +%D An example of a call is: +%D +%D \startbuffer +%D \processtokens {[} {+} {]} {\space} {hello world} +%D \stopbuffer +%D +%D \typebuffer +%D +%D This results in: +%D +%D \getbuffer +%D +%D The list of tokens may contain spaces, while \type{\\}, +%D \type{{}} and \type{\ } are handled as space too. + +\def\dodoprocesstokens + {\ifx\nextprocessedtoken\lastcharacter + \after + \let\nextprocessedtoken\relax + \else\ifx\nextprocessedtoken\bgroup + \def\nextprocessedtoken + {\dowithnextbox + {\before{\copy\nextbox}% \before can use nextbox several times + \let\before\between + \doprocesstokens} + \hbox\bgroup}% + \else + \expandafter\if\space\nextprocessedtoken + \after\white + \let\before\savedbefore + \else + \before\nextprocessedtoken + \let\before\between + \fi + \let\nextprocessedtoken\doprocesstokens + \fi\fi + \nextprocessedtoken} + +\def\doprocesstokens% the space after = is essential + {\afterassignment\dodoprocesstokens\let\nextprocessedtoken= } + +\def\processtokens#1#2#3#4#5% + {\begingroup + \def\lastcharacter{\lastcharacter}% + \def\space{ }% + \let\\=\space + \def\before {#1}% + \def\between{#2}% + \def\after {#3}% + \def\white {#4}% + \let\savedbefore\before + \doprocesstokens#5\lastcharacter + \endgroup} + +%D \macros +%D {doboundtext} +%D +%D Sometimes there is not enough room to show the complete +%D (line of) text. In such a situation we can strip of some +%D characters by using \type{\doboundtext}. When the text is +%D wider than the given width, it's split and the third +%D argument is appended. When the text to be checked is packed +%D in a command, we'll have to use \type{\expandafter}. +%D +%D \starttyping +%D \doboundtext{a very, probably to long, text}{3cm}{...} +%D \stoptyping +%D +%D When calculating the room needed, we take the width of the +%D third argument into account, which leads to a bit more +%D complex macro than needed at first sight. + +% \def\dodoboundtext#1% +% {\setbox0=\normalhbox{\unhcopy0 #1}% +% \ifdim\wd0>\dimen0 +% \let\dodoboundtext=\gobbleoneargument +% \else +% #1\relax +% \fi} +% +% \def\doboundtext#1#2#3% +% {\normalhbox +% {\setbox0=\normalhbox{#1}% +% \dimen0=#2\relax +% \ifdim\wd0>\dimen0 +% \setbox2=\normalhbox{#3}% +% \advance\dimen0 by -\wd2 +% \setbox0=\normalhbox{}% +% \processtokens +% {\dodoboundtext} +% {\dodoboundtext} +% {} +% {\space} +% {#1}% +% \box2 +% \else +% \box0 +% \fi}} + +\def\dodoboundtext#1% + {\setbox0\normalhbox{#1}% + \advance\scratchdimen -\wd0 + \ifdim\scratchdimen>\zeropoint\relax#1\fi}% + +\def\doboundtext#1#2#3% + {\normalhbox + {\setbox\scratchbox\normalhbox{#1}% + \scratchdimen#2\relax + \ifdim\wd\scratchbox>\scratchdimen + \setbox\scratchbox\normalhbox{#3}% + \advance\scratchdimen -\wd\scratchbox + \handletokens#1\with\dodoboundtext + \fi + \box\scratchbox}} + +%D \macros +%D {limitatetext} +%D +%D A bit more beautiful alternative for the previous command is +%D the next one. This command is more robust because we let +%D \TEX\ do most of the job. The previous command works better +%D on text that cannot be hyphenated. +%D +%D \starttyping +%D \limitatetext {text} {width} {sentinel} +%D \limitatetext {text} {-width} {prelude} +%D \stoptyping +%D +%D When no width is given, the whole text comes available. The +%D sentinel is optional. This is about the third version. + +\ifx\fakecompoundhyphen\undefined \let\fakecompoundhyphen\relax \fi +\ifx\veryraggedright \undefined \def\veryraggedright{\raggedright} \fi + +%D The simple alternative is as follows: +%D +%D \starttyping +%D \unexpanded\def\limitatetext% +%D {\bgroup % evt \setstrut +%D \forgetall +%D \fakecompoundhyphen % dangerous ! ! ! ! ! ! ! ! ! +%D \dowithnextbox\dolimitatetext\normalhbox} +%D +%D \def\dolimitatetext#1#2% +%D {\doifelsenothing{#1} +%D {\unhbox\nextbox} +%D {\widowpenalty=0 +%D \clubpenalty=0 +%D \scratchdimen=#1\relax +%D \ifdim\nextboxwd>\scratchdimen +%D \setbox\scratchbox=\normalhbox{ #2}% +%D \advance\scratchdimen by -\wd\scratchbox +%D \setbox\nextbox=\normalvbox +%D {\hsize=\scratchdimen +%D \hfuzz\maxdimen +%D \veryraggedright +%D \strut\unhcopy\nextbox}% +%D \ifdim\nextboxht>\strutht \else +%D \setbox\scratchbox\null % overfull and not split +%D \fi +%D \setbox\nextbox=\normalvbox % if omitted: missing brace reported +%D {\splittopskip=\openstrutheight +%D \setbox\nextbox=\vsplit\nextbox to \strutht +%D \unvbox\nextbox +%D \setbox\nextbox=\lastbox +%D \global\setbox1=\normalhbox +%D {\unhbox\nextbox\unskip\kern\zeropoint\box\scratchbox\unskip}}% +%D \unhbox1 +%D \else +%D \unhbox\nextbox +%D \fi}% +%D \egroup} +%D \stoptyping +%D +%D The next alternative accepts a negative width. A negative +%D value crops the beginning. The macro thereby becomes less +%D readable, which is why we kept the original here too. + +\unexpanded\def\limitatetext + {\bgroup % evt \setstrut + \forgetall % otherwise indentation and so + %\def\limitatetext##1##2##3{##1}% \def ! + \let\limitatetext\firstofthreearguments + \fakecompoundhyphen % dangerous ! ! ! ! ! ! ! ! ! + \dowithnextboxcs\dolimitatetext\normalhbox} + +\def\dolimitatetext#1#2% + {\doifelsenothing{#1} + {\unhbox\nextbox} + {\nopenalties + \scratchdimen#1\relax + \ifdim\scratchdimen<\zeropoint\relax % we'll take the last line + \donefalse + \scratchdimen-\scratchdimen + \else + \donetrue + \fi + \ifdim\nextboxwd>\scratchdimen + \setbox\scratchbox\normalhbox{\ifdone\space#2\else#2\space\fi}% + \advance\scratchdimen -\wd\scratchbox + \setbox0\flushnextbox + \setbox\nextbox\normalvbox + {\hsize\scratchdimen + \hfuzz\maxdimen + \veryraggedright + \strut + \ifdone \else + \parfillskip\zeropoint + \rightskip\zeropoint + \hskip\zeropoint \!!plus 1\!!fill % \hsize + \fi + \unhcopy0}% + \ifdim\nextboxht>\strutht + \setbox\nextbox\normalvbox % if omitted: missing brace reported + {\splittopskip\openstrutheight + \ifdone + \setbox\nextbox\vsplit\nextbox to \strutht + \else + \doloop + {\setbox0\vsplit\nextbox to \strutht + \ifdim\nextboxht>\strutht \else \exitloop \fi}% + \fi + \unvbox\nextbox + \setbox\nextbox\lastbox + \global\setbox1\normalhbox + {\ifdone + \unhbox\nextbox\unskip\kern\zeropoint\box\scratchbox + \else + \box\scratchbox\unhbox\nextbox + \fi + \unskip}}% + \unhbox1 + \else + \unhbox0 + \fi + \else + \unhbox\nextbox + \fi}% + \egroup} + +%D We can also limit a text with more control: +%D +%D \startbuffer +%D \limitatetext {\input tufte } {2cm,5mm} {\unknown} +%D \limitatetext {ton en hans} {2cm,5mm} {\unknown} +%D \limitatetext {ton en hans zijn eikels} {2cm,5mm} {\unknown} +%D \limitatetext {ton} {2cm,5mm} {\unknown} +%D \stopbuffer +%D +%D \typebuffer \getbuffer +%D +%D We build this feature on top of the previous macro. + +\let\normallimitatetext\limitatetext + +\def\speciallimitatetext#1#2#3#4% text left right placeholder + {%\dontleavehmode + \bgroup + %\def\speciallimitatetext##1##2##3##4{##1}% \def ! + \let\speciallimitatetext\firstoffourarguments + \setbox0\normalhbox + {\nohyphens + \normallimitatetext{#1}{+#2}{}#4% + \normallimitatetext{#1}{-#3}{}}% + \setbox2\normalhbox + {#1}% + \ifdim\wd2<\wd0 #1\else\unhbox0\fi + \egroup} + +\def\limitatetext#1#2#3% \expanded added 2003/01/16 + {\expanded{\beforesplitstring#2}\at,\to\leftlimit + \expanded{\aftersplitstring #2}\at,\to\rightlimit + \ifx\rightlimit\empty + \normallimitatetext {#1}\leftlimit {#3}% + \else + \speciallimitatetext{#1}\leftlimit\rightlimit{#3}% + \fi} + +%D Undocumented bonus (see wiki): +%D +%D \starttyping +%D \limitatefirstline{\input tufte\relax}{10cm}{\unknown} +%D \stoptyping + +\def\limitatefirstline#1#2#3% + {\hbox\bgroup\strut + \setbox\scratchbox\hbox{\begstrut#1\endstrut}% + \ifdim\wd\scratchbox>#2\relax + \setbox\scratchbox\hbox{#3}% + \hsize#2\relax + \advance\hsize-\wd\scratchbox + \setbox\scratchbox\vbox{\forgetall\veryraggedright#1}% + \setbox\scratchbox\vsplit\scratchbox to \lineheight + \vbox + {\unvbox\scratchbox + \global\setbox\plusone\lastbox + \global\setbox\plusone\hbox{\strut\unhbox\plusone}% + \hbox % to #2 + {\ifx\clip\undefined + \box\plusone + \else\ifdim\wd\plusone>\hsize + \lower\strutdepth\hbox{\clip[\c!width=\hsize,\c!height=\lineheight]{\hbox{\raise\strutdepth\box\plusone}}}% + \else + \box\plusone + \fi\fi + \removeunwantedspaces#3}}% \removeunwantedspaces\hss#3}}% + \else + #1% + \fi + \egroup} + +%D \macros +%D {processisolatedwords, +%D betweenisolatedwords,nothingbetweenisolatedwords} +%D +%D References are often made up of one word or a combination +%D of tightly connected words. The typeset text {\bf +%D chapter~5} is for instance the results of the character +%D sequence: +%D +%D \starttyping +%D The typeset text \in{chapter}[texniques] is for instance +%D \stoptyping +%D +%D When such words are made active in interactive texts, the +%D combination cannot longer be hyphenated. Normally this is no +%D problem, because \TEX\ tries to prevent hyphenation as best +%D as can. +%D +%D Sometimes however we need a few more words to make things +%D clear, like when we want to refer to {\bf \TEX\ by Topic}. +%D The macros that are responsible for typesetting hyperlinks, +%D take care of such sub||sentences by breaking them up in +%D words. Long ago we processed words using the space as a +%D separator, but the more advanced our interactive text became, +%D the more we needed a robust solution. Well, here it is and +%D it called as: +%D +%D \starttyping +%D \processisolatedwords{some words}\someaction +%D \stoptyping +%D +%D The second argument \type{someactions} handles the +%D individual words, like in: +%D +%D \startbuffer +%D \processisolatedwords{some more words} \ruledhbox \par +%D \processisolatedwords{and some $x + y = z$ math} \ruledhbox \par +%D \processisolatedwords{and a \normalhbox{$x + y = z$}} \ruledhbox \par +%D \stopbuffer +%D +%D \typebuffer +%D +%D which let the words turn up as: +%D +%D \startvoorbeeld +%D \getbuffer +%D \stopvoorbeeld +%D +%D The macro has been made a bit more clever than needed at +%D first sight. This is due to the fact that we don't want to +%D generate more overhead in terms of interactive commands than +%D needed. +%D +%D \startbuffer +%D \processisolatedwords{see this \ruledhskip1em} \ruledhbox +%D \processisolatedwords{and \ruledhskip1em this one} \ruledhbox +%D \stopbuffer +%D +%D \typebuffer +%D +%D becomes: +%D +%D \startvoorbeeld +%D \startlines +%D \getbuffer +%D \stoplines +%D \stopvoorbeeld +%D +%D Single word arguments are treated without further +%D processing. This was needed because this command is used in +%D the \type{\goto} command, to which we sometimes pass very +%D strange and|/|or complicated arguments or simply boxes +%D whose dimensions are to be left intact. +%D +%D First we build a \type{\normalhbox}. This enables us to save the +%D last skip. Next we fill a \type{\normalvbox} without hyphenating +%D words. After we've tested if there is more than one word, we +%D start processing the individual lines (words). We need some +%D splitting, packing and unpacking to get the spacing and +%D dimensions right. +%D +%D Normally the isolated words are separated by space, but +%D one can overrule this separator by changing the next macros. +%D +%D When needed, spacing can be suppressed by \type +%D {\nothingbetweenisolatedwords}. + +\newif\ifisolatedwords % public, e.g. used in core-ref + +\def\betweenisolatedwords + {\hskip\currentspaceskip} + +%D In order to prevent problems with nested isolated words, we +%D do process them, but only split at the outermost level. + +\newskip\isolatedlastskip + +\chardef\isolatedwordsmode=0 % no nesting + +\def\processisolatedwords#1#2% todo: vbox ipv hbox ivm afbreken! + {\bgroup % todo: doloop + \fakecompoundhyphen + \dontcomplain + \forgetall + \nopenalties + \ifcase\isolatedwordsmode + \def\processisolatedwords##1##2{##2{##1}}% we split only once + \fi + \global\let\localbetweenisolatedwords\betweenisolatedwords + \setbox0\normalhbox % we default to spaces, but from inside out + {\normallanguage\minusone % needed for mkiv + \ignorespaces#1% \localbetweenisolatedwords can be overruled + \global\isolatedlastskip\lastskip}% + \setbox2\normalvbox + {%\hyphenpenalty10000 % this one fails in \url breaking, + \lefthyphenmin\maxcard % but this trick works ok, due to them + \righthyphenmin\maxcard % total>63, when no hyphenation is done + \hsize\zeropoint + \unhcopy0}% == #1 + \ifdim\ht0=\ht2 + \isolatedwordsfalse + #2{\unhbox0}% == #2{#1} % was \unhcopy0 + \else + \isolatedwordstrue + \setbox0\normalhbox + {\ignorespaces + \loop + \setbox4\normalhbox + {\splittopskip\openstrutheight + \vsplit2 to \baselineskip}% + \normalhbox + {\unhbox4\unskip % recently added + \setbox4\lastbox + \normalvbox % outer \normalhbox needed + {\unvbox4 % for nested use + \setbox4\lastbox + \normalhbox{#2{\normalhbox + {\unhbox4 + \unskip\unpenalty % remove end of line stuff + \global\dimen1\lastkern}}}}}% + \ifdim\ht2>\zeropoint\relax + \ifdim\dimen1=\compoundbreakpoint + \allowbreak + \else + \localbetweenisolatedwords + \fi + \repeat + \unskip}% + \unhbox0\unskip + \ifzeropt\isolatedlastskip\else % added % \ifdim\isolatedlastskip=\zeropoint\else % added + \hskip\isolatedlastskip + \fi + \fi + \egroup} + +%D One can use the next macro to change the intersplit +%D material. An example can be found in the \type {\url} +%D macro. The innermost setting is used. In the url case, it +%D means that either very small spaces are used or no spaces +%D at all. So, the innermost settings are used, while the +%D outermost split takes place. + +\def\setbetweenisolatedwords#1% + {\gdef\localbetweenisolatedwords{#1}} + +%D \macros +%D {sbox} +%D +%D This is a rather strange command. It grabs some box content +%D and and limits the size to the height and depth of a +%D \type{\strut}. The resulting bottom||alligned box can be used +%D aside other ones, without disturbing the normal baseline +%D distance. +%D +%D \startbuffer +%D \ruledhbox to .5\hsize{\sbox{eerste\par tweede \par derde}} +%D \stopbuffer +%D +%D \typebuffer +%D +%D Shows up as: +%D +%D \startvoorbeeld +%D \vskip3\baselineskip +%D \getbuffer +%D \stopvoorbeeld +%D +%D Before displaying the result we added some skip, otherwise +%D the first two lines would have ended up in the text. This +%D macro can be useful when building complicated menus, headers +%D and footers and|/|or margin material. + +\def\sbox% in handleiding, voorbeeld \inleft{xx} \extern.. + {\normalvbox\bgroup % new ! ! ! + \dowithnextbox + {\setbox\scratchbox\normalhbox + {\strut + \nextboxdp\zeropoint + \lower\strutdepth\flushnextbox}% + \dp\scratchbox\strutdepth + \ht\scratchbox\strutheight + \box\scratchbox + \egroup}% + \normalvbox} + +%D \macros +%D {struttedbox} +%D +%D This boxing macro limits the height and depth to those of +%D a strut. + +\def\struttedbox + {\normalhbox\bgroup % new ! ! ! + \dowithnextbox + {\nextboxdp\strutdepth + \nextboxht\strutheight + \flushnextbox + \egroup}% + \normalhbox} + +%D \macros +%D {topskippedbox} +%D +%D This macro compensates the difference between the topskip +%D and strutheight. Watch how we preserve the depth when it +%D equals strutdepth. + +\def\topskippedbox + {\normalhbox\bgroup + \dowithnextbox + {\edef\next + {\ifdim\strutdepth=\nextboxdp\nextboxdp\the\nextboxdp\fi}% + \lower\topskip\normalhbox{\raise\strutheight\flushnextbox}% + \next + \egroup}% + \normalhbox} + +%D \macros +%D {centeredbox, centerednextbox} +%D +%D Here is another strange one. This one offers a sort of overlay +%D with positive or negative offsets. This command can be used +%D in well defined areas where no offset options are available. +%D We first used it when building a button inside the margin +%D footer, where the button should have a horizontal offset and +%D should be centered with respect to the surrounding box. The +%D last of the three examples we show below says: +%D +%D \starttyping +%D \vsize=3cm +%D \hsize=3cm +%D \ruledvbox to \vsize +%D {\centeredbox height .5cm width -1cm +%D {\vrule width \hsize height \vsize}}} +%D \stoptyping +%D +%D Here the \type{\ruledvbox} just shows the surrounding box +%D and \type{\vrule} is used to show the centered box. +%D +%D \def\AnExample#1#2% +%D {\vsize=3cm +%D \hsize=3cm +%D \ruledvbox to \vsize +%D {\centeredbox height #1 width #2 +%D {\color[green]{\vrule width \hsize height \vsize}}}} +%D +%D \startlinecorrection +%D \startcombination[3*1] +%D {\AnExample {-1cm} {.5cm}} {} +%D {\AnExample {.5cm} {-1cm}} {} +%D {\AnExample {-1cm} {-.5cm}} {} +%D \stopcombination +%D \stoplinecorrection +%D +%D This command takes two optional arguments: \type{width} and +%D \type{height}. Observing readers can see that we use \TEX's +%D own scanner for grabbing these arguments: \type{#1#} reads +%D everyting till the next brace and passes it to both rules. +%D The setting of the box dimensions at the end is needed for +%D special cases. The dimensions of the surrounding box are kept +%D intact. This commands handles positive and negative +%D dimensions (which is why we need two boxes with rules). + +\def\centeredbox#1#% height +/-dimen width +/-dimen + {\bgroup + \setbox0\normalvbox to \vsize + \bgroup + \dontcomplain + \forgetall + \setbox0\normalhbox{\vrule\!!width \zeropoint#1}% + \setbox2\normalvbox{\hrule\!!height\zeropoint#1}% + \advance\vsize \ht2 + \advance\hsize \wd0 + \normalvbox to \vsize + \bgroup + \vskip-\ht2 + \vss + \normalhbox to \hsize + \bgroup + \dowithnextbox + {\hskip-\wd0 + \hss + \flushnextbox + \hss + \egroup + \vss + \egroup + \egroup + \wd0\hsize + \ht0\vsize + \box0 + \egroup} + \normalhbox} + +%D For those who don't want to deal with \type {\hsize} +%D and \type {\vsize}, we have: +%D +%D \starttyping +%D \centerednextbox width 2bp height 2bp +%D {\framed[width=100bp,height=100bp]{}} +%D \stoptyping +%D +%D Do you see what we call this one \type {next}? + +\def\centerednextbox#1#% + {\bgroup + \dowithnextbox + {\hsize\nextboxwd + \vsize\nextboxht + \centeredbox#1{\flushnextbox}% + \egroup} + \normalhbox} + +%D \macros +%D {centerbox} +%D +%D Centering on the available space is done by: +%D +%D \starttyping +%D \centerbox {content} +%D \stoptyping +%D +%D When omitted, the current \type {\hsize} and \type +%D {\vsize} are used. Local dimensions are supported. + +\long\def\centerbox#1#% optional height +/-dimen width +/-dimen + {\bgroup + \dowithnextbox + {\setlocalhsize + \setbox0\normalhbox{\vrule\!!width \zeropoint#1}% + \setbox2\normalvbox{\hrule\!!height\zeropoint#1}% + \ifzeropt\wd0\else\hsize\wd0\fi % \hsize\ifdim\wd0=\zeropoint\hsize\else\wd0\fi + \ifzeropt\ht2\else\vsize\ht2\fi % \vsize\ifdim\ht2=\zeropoint\vsize\else\ht2\fi + \normalvbox to \vsize{\vss\normalhbox to \hsize{\hss\flushnextbox\hss}\vss}% + \egroup}% + \normalhbox} + +%D \macros +%D {setrigidcolumnhsize,rigidcolumnbalance,rigidcolumnlines} +%D +%D These macros are copied from the \TEX book, page~397, and +%D extended by a macro that sets the \type{\hsize}. +%D +%D \starttyping +%D \setrigidcolumnhsize {total width} {distance} {n} +%D \rigidcolumnbalance {box} +%D \stoptyping +%D +%D Both these macros are for instance used in typesetting +%D footnotes. +%D +%D Men kan het proces van breken enigzins beinvloeden met de +%D volgende twee switches: + +\newif\ifalignrigidcolumns +\newif\ifstretchrigidcolumns +\newif\iftightrigidcolumns % if true: just a vbox, no depth/noflines/gridsnap corrrections + +%D De eerste switch bepaald het uitlijnen, de tweede rekt de +%D individuele kolommen op naar \type{\vsize}. + +\def\setrigidcolumnhsize#1#2#3% todo: \dimexpr + {\xdef\savedrigidhsize{\the\hsize}% + \hsize#1\relax + \global\chardef\rigidcolumns#3\relax + \scratchdimen -#2\relax + \multiply\scratchdimen #3\relax + \advance\scratchdimen #2\relax + \advance\hsize \scratchdimen + \divide\hsize #3\relax} + +% == +% +% \def\setrigidcolumnhsize#1#2#3% +% {\xdef\savedrigidhsize{\the\hsize}% +% \global\chardef\rigidcolumns#3\relax +% \hsize=\dimexpr(#1-\numexpr#3-1\relax\dimexpr#2\relax)/#3\relax} + +\newbox\rigidcolumnbox + +\let\rigidcolumnlines\!!zerocount + +\def\rigidcolumnbalance#1% + {\ifnum\rigidcolumns=1 % tzt ook h/d correctie + \ifinner\ifhmode\box\else\unvbox\fi\else\unvbox\fi#1\relax + \else + \normalvbox + {\forgetall + \nopenalties + \dontcomplain + \setbox\rigidcolumnbox\normalvbox + {\line{}\goodbreak\unvbox#1\removebottomthings}% + \splittopskip\openstrutheight + \setbox\scratchbox\vsplit\rigidcolumnbox to \zeropoint + \ifcase\rigidcolumnlines\relax + % \iffalse + % % maybe some day an option + % \scratchskip\ht\rigidcolumnbox + % \advance\scratchskip\dp\rigidcolumnbox + % \getnoflines\scratchskip + % \ifodd\noflines + % \advance\noflines\plusone + % \fi + % \divide\noflines\rigidcolumns + %\else + \scratchdimen\ht\rigidcolumnbox + \divide\scratchdimen \rigidcolumns + \getnoflines\scratchdimen + %\fi + \else + \noflines\rigidcolumnlines % to be sure + \fi + \scratchdimen\noflines\lineheight + % new: we now loop so that we don't loose content + % since in practice we also use this macro for + % funny lineheights and border cases + \setbox0=\box\rigidcolumnbox + \doloop + {\setbox\rigidcolumnbox=\copy0 + \setbox\scratchbox\normalhbox to \savedrigidhsize + {\dorecurse\rigidcolumns + {\setbox\scratchbox\vsplit\rigidcolumnbox to \scratchdimen + \dp\scratchbox\openstrutdepth + \setbox\scratchbox\normalvtop + \ifalignrigidcolumns to + \ifstretchrigidcolumns\vsize\else\scratchdimen\fi + \fi + {\unvbox\scratchbox}% + \wd\scratchbox\hsize + \box\scratchbox + \hfill}% + \hfillneg}% + \ifvoid\rigidcolumnbox\exitloop\else\advance\scratchdimen\lineheight\fi}% + \iftightrigidcolumns + \setbox\scratchbox\normalhbox{\raise\dp\scratchbox\box\scratchbox}% + \else + \advance\scratchdimen -\openstrutdepth + \setbox\scratchbox\normalhbox{\raise\scratchdimen\box\scratchbox}% + \dp\scratchbox\openstrutdepth + \ht\scratchbox\scratchdimen + \fi + \box\scratchbox}% + \fi} + +%D \macros +%D {startvboxtohbox,stopvboxtohbox,convertvboxtohbox} +%D +%D Here is another of Knuth's dirty tricks, as presented on +%D pages 398 and 399 of the \TEX book. These macros can be used +%D like: +%D +%D \starttyping +%D \normalvbox +%D \bgroup +%D \startvboxtohbox ... \stopvboxtohbox +%D \startvboxtohbox ... \stopvboxtohbox +%D \startvboxtohbox ... \stopvboxtohbox +%D \egroup +%D +%D \normalvbox +%D \bgroup +%D \convertvboxtohbox +%D \egroup +%D \stoptyping +%D +%D These macros are used in reformatting footnotes, so they do +%D what they're meant for. + +\def\setvboxtohbox + {\bgroup + \ifdim\baselineskip<16pt \relax + \scratchdimen\baselineskip + \multiply\scratchdimen 1024 + \else + \message{cropping \baselineskip to 16pt}% + \scratchdimen\maxdimen + \fi + \divide\scratchdimen \hsize + \multiply\scratchdimen 64 + \xdef\normalvboxtohboxfactor{\withoutpt\the\scratchdimen}% + \egroup} + +\def\startvboxtohbox + {\bgroup + \setvboxtohbox + \setbox\scratchbox\normalhbox\bgroup} + +\def\stopvboxtohbox + {\egroup + \dp\scratchbox\zeropoint + \ht\scratchbox\normalvboxtohboxfactor\wd\scratchbox + \box\scratchbox + \egroup} + +% % to be done: start halfway a line combined with one line +% % extra to start with (skip) and one line less than counted. +% +% \def\stopvboxtohbox% +% {\egroup +% \setbox2=\normalvbox +% {\forgetall\unhcopy0\par\xdef\globalvhlines{\the\prevgraf}}% +% \setbox2=\normalvbox +% {\unvbox2 +% \setbox2=\lastbox +% \setbox2=\normalhbox{\unhbox2}% +% \xdef\globalvhwidth{\the\wd2}}% +% \decrement\globalvhlines +% \dimen0=\globalvhwidth +% \dimen0=\normalvboxtohboxfactor\dimen0 +% \advance\dimen0 by \globalvhlines\lineheight +% \dp0=\zeropoint +% \ht0=\dimen0 +% %\writestatus{guessed size} +% % {w:\the\wd0\space\space +% % b:\the\baselineskip\space +% % l:\globalvhlines\space +% % e:\globalvhwidth\space +% % h:\the\dimen0}% +% \box0 +% \egroup} + +% todo: \scratchbox + +\def\convertvboxtohbox + {\setvboxtohbox + \makehboxofhboxes + \setbox0\normalhbox{\unhbox0 \removehboxes}% + \noindent\unhbox0\par} + +\def\makehboxofhboxes + {\setbox0\normalhbox{}% + \loop % \doloop { .. \exitloop .. } + \setbox2\lastbox + \ifhbox2 + \setbox0\normalhbox{\box2\unhbox0}% + \repeat} + +% \def\makehboxofhboxes +% {\setbox0\normalhbox{}% +% \doloop % \doloop { .. \exitloop .. } +% {% \dorecurse{3}{\unskip\unpenalty}% get rid of ... (better do this in a shapeloop) +% \setbox2\lastbox +% \ifhbox2 +% \setbox0\normalhbox{\box2\unhbox0}% +% \else +% \exitloop +% \fi}} + +% \def\flushboxesonly % feed this into \makehboxofhboxes +% {\dowithnextbox +% {\beginofshapebox +% \unvbox\nextbox +% \endofshapebox +% \doreshapebox{\box\shapebox}{}{}{}% get rid of penalties etc +% \innerflushshapebox} +% \vbox} + +\def\removehboxes + {\setbox0\lastbox + \ifhbox0 + {\removehboxes}\unhbox0 + \fi} + +%D \macros +%D {unhhbox} +%D +%D The next macro is used in typesetting inline headings. +%D Let's first look at the macro and then show an example. + +\newbox \unhhedbox +\newbox \hhbox +\newdimen \lasthhboxwidth +\newskip \hhboxindent + +\def\unhhbox#1\with#2% + {\bgroup + \nopenalties + \dontcomplain + \forgetall + \setbox\unhhedbox\normalvbox{\hskip\hhboxindent\strut\unhbox#1}% => \hsize + \doloop + {\setbox\hhbox\vsplit\unhhedbox to \lineheight + \ifvoid\unhhedbox + \setbox\hhbox\normalhbox{\strut\normalhboxofvbox\hhbox}% + \fi + \ht\hhbox\strutht + \dp\hhbox\strutdp + \ifzeropt\hhboxindent\else % \ifdim\hhboxindent=\zeropoint\else + \setbox\hhbox\normalhbox{\hskip-\hhboxindent\box\hhbox}% + \hhboxindent\zeropoint + \fi + \global\lasthhboxwidth\wd\hhbox + #2\relax + \ifvoid\unhhedbox + \exitloop + \else + \hskip\zeropoint \!!plus \zeropoint + \fi}% + \egroup} + +\def\dohboxofvbox + {\setbox0\normalvbox{\unvbox\scratchcounter\global\setbox1\lastbox}% + \unhbox1 + \egroup} + +\def\normalhboxofvbox + {\bgroup + \afterassignment\dohboxofvbox + \scratchcounter=} + +%D This macro can be used to break a paragraph apart and treat +%D each line seperately, for instance, making it clickable. The +%D main complication is that we want to be able to continue the +%D paragraph, something that's needed in the in line section +%D headers. +%D +%D \startbuffer +%D \setbox0=\normalhbox{\input tufte \relax} +%D \setbox2=\normalhbox{\input knuth \relax} +%D \unhhbox0\with{\ruledhbox{\box\hhbox}} +%D \hskip1em plus 1em minus 1em +%D \hhboxindent=\lasthhboxwidth +%D \advance\hhboxindent by \lastskip +%D \unhhbox2\with{\ruledhbox{\box\hhbox}} +%D \stopbuffer +%D +%D \getbuffer +%D +%D This piece of text was typeset by saying: +%D +%D \typebuffer +%D +%D Not that nice a definition, but effective. Note the stretch +%D we've build in the line that connects the two paragraphs. + +%D \macros +%D {doifcontent} +%D +%D When processing depends on the availability of content, one +%D can give the next macro a try. +%D +%D \starttyping +%D \doifcontent{pre content}{post content}{no content}\somebox +%D \stoptyping +%D +%D Where \type{\somebox} is either a \type{\normalhbox} or +%D \type{\normalvbox}. If the dimension of this box suggest some +%D content, the resulting box is unboxed and surrounded by the +%D first two arguments, else the third arguments is executed. + +\unexpanded\def\doifcontent#1#2#3% + {\dowithnextbox + {\ifhbox\nextbox + \ifdim\nextboxwd>\zeropoint + #1\unhbox\nextbox#2\relax + \else + #3\relax + \fi + \else + \ifdim\nextboxht>\zeropoint + #1\unvbox\nextbox#2\relax + \else + #3\relax + \fi + \fi}} + +%D So when we say: +%D +%D \startbuffer +%D \doifcontent{[}{]}{}\normalhbox{content sensitive typesetting} +%D +%D \doifcontent{}{\page}{}\normalvbox{content sensitive typesetting} +%D +%D \doifcontent{}{}{\message{Didn't you forget something?}}\normalhbox{} +%D \stopbuffer +%D +%D \typebuffer +%D +%D We get: +%D +%D \getbuffer +%D +%D Where the last call of course does not show up in this +%D document, but definitely generates a confusing message. + +%D \macros +%D {processboxes} +%D +%D The next macro gobble boxes and is for instance used for +%D overlays. First we show the general handler. + +\newbox\processbox + +\def\processboxes#1% + {\bgroup + \def\doprocessbox{#1}% #1 can be redefined halfway + \resetbox\processbox + \afterassignment\dogetprocessbox\let\next=} + +\def\endprocessboxes + {\ifhmode\unskip\fi + \box\processbox + \next + \egroup} + +\def\dogetprocessbox + {\ifx\next\bgroup + \expandafter\dodogetprocessbox + \else + \expandafter\endprocessboxes + \fi} + +\def\dodogetprocessbox + {\dowithnextbox + {\ifhmode\unskip\fi\doprocessbox % takes \nextbox makes \processbox + \afterassignment\dogetprocessbox\let\next=} + \normalhbox\bgroup} + +%D \macros +%D {startoverlay} +%D +%D We can overlay boxes by saying: +%D +%D \startbuffer +%D \startoverlay +%D {\framed{hans}} +%D {\framed[width=3cm]{ton}} +%D {\framed[height=2cm]{oeps}} +%D \stopoverlay +%D \stopbuffer +%D +%D \typebuffer +%D +%D shows up as: +%D +%D \leavevmode\getbuffer + +% \def\dooverlaybox% +% {\ifhmode\unskip\fi +% \ifdim\nextboxht>\ht\processbox +% \setbox\processbox\normalvbox to \nextboxht +% {\vss\box\processbox\vss}% +% \else +% \setbox\nextbox\normalvbox to \ht\processbox +% {\vss\flushnextbox\vss}% +% \fi +% \scratchdimen=\wd +% \ifdim\nextboxwd>\wd\processbox +% \nextbox +% \else +% \processbox +% \fi +% \setbox\processbox=\normalhbox to \scratchdimen +% {\normalhbox to \scratchdimen{\hss\box\processbox\hss}% +% \hskip-\scratchdimen +% \normalhbox to \scratchdimen{\hss\flushnextbox\hss}}} +% +% \def\startoverlay% +% {\bgroup +% \let\stopoverlay\egroup +% \processboxes\dooverlaybox} + +\def\dooverlaybox + {\ifhmode\unskip\fi + \scratchdimen\dp + \ifdim\nextboxdp>\dp\processbox + \nextbox + \else + \processbox + \fi + \ifdim\nextboxht>\ht\processbox + \setbox\processbox\normalvbox to \nextboxht + {\dp\processbox\zeropoint\vss\box\processbox\vss}% + \else + \setbox\nextbox\normalvbox to \ht\processbox + {\nextboxdp\zeropoint\vss\flushnextbox\vss}% + \fi + \nextboxdp\scratchdimen + \dp\processbox\scratchdimen + \scratchdimen\wd + \ifdim\nextboxwd>\wd\processbox + \nextbox + \else + \processbox + \fi + \setbox\processbox\normalhbox to \scratchdimen + {\normalhbox to \scratchdimen{\hss\box\processbox\hss}% + \hskip-\scratchdimen + \normalhbox to \scratchdimen{\hss\flushnextbox\hss}}} + +\unexpanded\def\startoverlay + {\bgroup + \let\stopoverlay\egroup + \processboxes\dooverlaybox} + +\let\stopoverlay\relax + +% %D \macros +% %D {starthspread} +% %D +% %D In a similar way we can build a horizontal box, spread +% %D over the available width. +% %D +% %D \startbuffer +% %D \starthspread +% %D {hans} +% %D {ton} +% %D {oeps} +% %D \stophspread +% %D +% %D \stopbuffer +% %D +% %D \typebuffer +% %D +% %D shows up as: +% %D +% %D \leavevmode\getbuffer +% +% \def\dohspread +% {\flushnextbox +% \def\dohspread{\hfil\flushnextbox}} +% +% \def\starthspread +% {\normalhbox to \hsize \bgroup +% \let\stophspread\egroup +% \processboxes\dohspread} + +%D \macros +%D {fakebox} +%D +%D The next macro is a rather silly one, but saves space. +%D +%D \starttyping +%D \normalhbox{\fakebox0} +%D \stoptyping +%D +%D returns an empty box with the dimensions of the box +%D specified, here being zero. + +\def\dofakebox + {\setbox\scratchbox\null + \wd\scratchbox\wd\scratchcounter + \ht\scratchbox\ht\scratchcounter + \dp\scratchbox\dp\scratchcounter + \ifhbox\scratchcounter\normalhbox\else\normalvbox\fi{\box\scratchbox}% + \egroup} + +\def\fakebox + {\bgroup + \afterassignment\dofakebox\scratchcounter} + +%D \macros +%D {lbox,rbox,cbox,tbox,bbox} +%D +%D Here are some convenient alternative box types: +%D +%D \starttyping +%D \lbox{text ...} +%D \cbox{text ...} +%D \rbox{text ...} +%D \stoptyping +%D +%D Are similar to \type {\normalvbox}, which means that they also +%D accept something like \type{to 3cm}, but align to the left, +%D middle and right. These box types can be used to typeset +%D paragraphs. + +\def\lbox{\makelrcbox\normalvbox\raggedleft} +\def\cbox{\makelrcbox\normalvbox\raggedcenter} +\def\rbox{\makelrcbox\normalvbox\raggedright} + +\def\ltop{\makelrcbox\normalvtop\raggedleft} +\def\ctop{\makelrcbox\normalvtop\raggedcenter} +\def\rtop{\makelrcbox\normalvtop\raggedright} + +\def\makelrcbox#1#2#3#% + {#1#3\bgroup \forgetall \let\\=\endgraf #2\let\next=} + +%D The alternatives \type {\tbox} and \type {\bbox} can be used +%D to properly align boxes, like in: +%D +%D \setupexternalfigures[directory={../sample}] +%D \startbuffer +%D \starttable[|||] +%D \HL +%D \VL \tbox{\externalfigure[cow][height=3cm,frame=on]} \VL top aligned \VL\SR +%D \HL +%D \VL \bbox{\externalfigure[cow][height=3cm,frame=on]} \VL bottom aligned \VL\SR +%D \HL +%D \stoptable +%D \stopbuffer +%D +%D \typebuffer +%D +%D The positioning depends on the strut settings: +%D +%D \getbuffer + +\def\tbox{\tbbox\ht\dp} +\def\bbox{\tbbox\dp\ht} + +\def\tbbox#1#2% + {\normalhbox\bgroup + \dowithnextbox + {\scratchdimen\nextboxht + \advance\scratchdimen\nextboxdp + \advance\scratchdimen-#1\strutbox + #1\nextbox#1\strutbox + #2\nextbox\scratchdimen + \setbox\nextbox\normalhbox + {\lower\nextboxdp\flushnextbox}% + #1\nextbox#1\strutbox + #2\nextbox\scratchdimen + \flushnextbox + \egroup} + \normalhbox} + +%D \macros +%D {lhbox,mhbox,rhbox} +%D +%D A few more boxes. + +\def\dodolhbox{\normalhbox to \hsize{\flushnextbox\hss }} +\def\dodomhbox{\normalhbox to \hsize{\hss\flushnextbox\hss}} +\def\dodorhbox{\normalhbox to \hsize{\hss\flushnextbox }} + +\def\lhbox{\dowithnextboxcs\dodolhbox\normalhbox} +\def\mhbox{\dowithnextboxcs\dodomhbox\normalhbox} +\def\rhbox{\dowithnextboxcs\dodorhbox\normalhbox} + +\let\lefthbox \lhbox +\let\midhbox \mhbox +\let\righthbox\rhbox + +%D \macros +%D {boxofsize} +%D +%D Sometimes we need to construct a box with a height or +%D width made up of several dimensions. Instead of cumbersome +%D additions, we can use: +%D +%D \starttyping +%D \boxofsize \normalvbox 10cm 3cm -5cm {the text to be typeset} +%D \stoptyping +%D +%D This example demonstrates that one can use positive and +%D negative values. Dimension registers are also accepted. + +\newdimen\sizeofbox + +\def\boxofsize#1% + {\bgroup + \sizeofbox\zeropoint + \scratchdimen\zeropoint + \def\docommand + {\advance\sizeofbox\scratchdimen + \futurelet\next\dodocommand}% + \def\dodocommand + {\ifx\next\bgroup + \expanded{\egroup#1 to \the\sizeofbox}% + \else + \@EA\afterassignment\@EA\docommand\@EA\scratchdimen + \fi}% + \docommand} + +%D Some new, still undocumented features: + +% limitatetext -> beter {text} als laatste !! +% +% \limitvbox +% \limithbox + +\def\limitatelines#1#2% size sentinel + {\dowithnextbox + {\dimen0=#1\hsize + \ifdim\nextboxwd>\dimen0 + \setbox\nextbox\normalhbox + {\advance\dimen0 -.1\hsize + \limitatetext{\unhbox\nextbox}{\dimen0}{\nobreak#2}}% + \fi + \unhbox\nextbox} + \normalhbox} + +\def\fittoptobaselinegrid % weg hier + {\dowithnextbox + {\bgroup + \par + \dimen0\nextboxht + \nextboxht\strutht + \nextboxdp\strutdp + \normalhbox{\flushnextbox} + \prevdepth\strutdp + \doloop + {\advance\dimen0 -\lineheight + \ifdim\dimen0<\zeropoint + \exitloop + \else + \nobreak + \normalhbox{\strut} + \fi} + \egroup} + \normalvbox} + +%D Some more undocumented macros (used in m-chart). + +\newif\iftraceboxplacement % \traceboxplacementtrue + +\newbox\fakedboxcursor + +\setbox\fakedboxcursor\normalhbox + {\vrule\!!width\zeropoint\!!height\zeropoint\!!depth\zeropoint} + +\def\boxcursor % overloaded in core-vis + {\iftraceboxplacement + \bgroup + \scratchdimen2pt + \setbox\scratchbox\normalhbox to \zeropoint + {\hss + \vrule + \!!width \scratchdimen + \!!height\scratchdimen + \!!depth \scratchdimen + \hss}% + \smashedbox\scratchbox + \egroup + \else + \copy\fakedboxcursor + \fi} + +\def\placedbox + {\iftraceboxplacement\ruledhbox\else\normalhbox\fi} + +\newdimen\boxoffset +\newdimen\boxhdisplacement +\newdimen\boxvdisplacement + +%\def\rightbox#1% +% {\normalhbox +% {\setbox0=\placedbox{#1}% +% \dimen0=.5\ht0\advance\dimen0 -.5\dp0 +% \boxcursor\hskip\boxoffset\lower\dimen0\box0}} + +\def\rightbox#1% + {\normalhbox + {\setbox0\placedbox{#1}% + \global\boxhdisplacement\boxoffset + \global\boxvdisplacement.5\ht0 + \global\advance\boxvdisplacement-.5\dp0 + \boxcursor\hskip\boxhdisplacement\lower\boxvdisplacement\box0}} + +%\def\leftbox#1% +% {\normalhbox +% {\setbox0=\placedbox{#1}% +% \dimen0=.5\ht0\advance\dimen0 -.5\dp0 +% \boxcursor\hskip-\wd0\hskip-\boxoffset\lower\dimen0\box0}} + +\def\leftbox#1% + {\normalhbox + {\setbox0\placedbox{#1}% + \global\boxhdisplacement-\wd0 + \global\advance\boxhdisplacement-\boxoffset + \global\boxvdisplacement.5\ht0 + \global\advance\boxvdisplacement-.5\dp0 + \boxcursor\hskip\boxhdisplacement\lower\boxvdisplacement\box0}} + +%\def\topbox#1% +% {\normalhbox +% {\setbox0=\placedbox{#1}% +% \dimen0=\boxoffset\advance\dimen0 \dp0 +% \boxcursor\hskip-.5\wd0\raise\dimen0\box0}} + +\def\topbox#1% + {\normalhbox + {\setbox0\placedbox{#1}% + \global\boxhdisplacement-.5\wd0 + \global\boxvdisplacement-\dp0 + \global\advance\boxvdisplacement-\boxoffset + \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}} + +%\def\bottombox#1% +% {\normalhbox +% {\setbox0=\placedbox{#1}% +% \dimen0=\boxoffset\advance\dimen0 \ht0 +% \boxcursor\hskip-.5\wd0\lower\dimen0\box0}} + +\def\bottombox#1% + {\normalhbox + {\setbox0\placedbox{#1}% + \global\boxhdisplacement-.5\wd0 + \global\boxvdisplacement\ht0 + \global\advance\boxvdisplacement\boxoffset + \boxcursor\hskip\boxhdisplacement\lower\boxvdisplacement\box0}} + +%\def\lefttopbox#1% +% {\normalhbox +% {\setbox0=\placedbox{#1}% +% \dimen0=\boxoffset\advance\dimen0 \dp0 +% \advance\boxoffset\wd0 +% \boxcursor\hskip-\boxoffset\raise\dimen0\box0}} + +\def\lefttopbox#1% + {\normalhbox + {\setbox0\placedbox{#1}% + \global\boxhdisplacement-\wd0 + \global\advance\boxhdisplacement-\boxoffset + \global\boxvdisplacement-\dp0 + \global\advance\boxvdisplacement-\boxoffset + \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}} + +%\def\righttopbox#1% +% {\normalhbox +% {\setbox0=\placedbox{#1}% +% \dimen0=\boxoffset\advance\dimen0 \dp0 +% \boxcursor\hskip\boxoffset\raise\dimen0\box0}} + +\def\righttopbox#1% + {\normalhbox + {\setbox0\placedbox{#1}% + \global\boxhdisplacement\boxoffset + \global\boxvdisplacement-\dp0 + \global\advance\boxvdisplacement-\boxoffset + \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}} + +%\def\leftbottombox#1% +% {\normalhbox +% {\setbox0=\placedbox{#1}% +% \dimen0=\boxoffset\advance\dimen0 \ht0 +% \advance\boxoffset\wd0 +% \boxcursor\hskip-\boxoffset\lower\dimen0\box0}} + +\def\leftbottombox#1% + {\normalhbox + {\setbox0\placedbox{#1}% + \global\boxhdisplacement-\wd0 + \global\advance\boxhdisplacement-\boxoffset + \global\boxvdisplacement\ht0 + \global\advance\boxvdisplacement\boxoffset + \boxcursor\hskip\boxhdisplacement\lower\boxvdisplacement\box0}} + +%\def\rightbottombox#1% +% {\normalhbox +% {\setbox0=\placedbox{#1}% +% \dimen0=\boxoffset\advance\dimen0 \ht0 +% \boxcursor\hskip\boxoffset\lower\dimen0\box0}} + +\def\rightbottombox#1% + {\normalhbox + {\setbox0\placedbox{#1}% + \global\boxhdisplacement\boxoffset + \global\boxvdisplacement\ht0 + \global\advance\boxvdisplacement\boxoffset + \boxcursor\hskip\boxhdisplacement\lower\boxvdisplacement\box0}} + +\let\topleftbox \lefttopbox +\let\toprightbox \righttopbox +\let\bottomleftbox \leftbottombox +\let\bottomrightbox\rightbottombox + +\def\middlebox#1% + {\normalhbox{\setbox0\placedbox{#1}\boxoffset=-.5\wd0\rightbox{\box0}}} + +\def\baselinemiddlebox#1% + {\normalhbox + {\setbox0\placedbox{#1}% + \global\boxhdisplacement-.5\wd0 + \global\advance\boxhdisplacement-\boxoffset + \global\boxvdisplacement-\boxoffset + \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}} + +\def\baselineleftbox#1% + {\normalhbox + {\setbox0\placedbox{#1}% + \global\boxhdisplacement-\wd0 + \global\advance\boxhdisplacement-\boxoffset + \global\boxvdisplacement-\boxoffset + \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}} + +\def\baselinerightbox#1% + {\normalhbox + {\setbox0\placedbox{#1}% + \global\boxhdisplacement\boxoffset + \global\boxvdisplacement-\boxoffset + \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}} + +%D \macros +%D {obox} +%D +%D Experimental, not yet frozen: + +\def\lrtbbox#1#2#3#4% l r t b + {\bgroup + \dowithnextboxcontent + {\advance\hsize-#1\advance\hsize-#2\advance\vsize-#3\advance\vsize-#4\relax} + {\forgetall\vbox to \vsize{\vskip#3\hbox to \hsize{\hskip#1\box\nextbox\hss}\vss}\egroup} + \vbox} + +%D \macros +%D {toplinebox} +%D +%D See core-tbl.tex for an example of its usage: + +\def\toplinebox + {\dowithnextbox + {\ifdim\nextboxdp>\strutdepth + \scratchdimen\nextboxdp + \advance\scratchdimen-\strutdepth + \getnoflines\scratchdimen + \struttedbox{\flushnextbox}% + \dorecurse\noflines\verticalstrut + \else + \flushnextbox + \fi}% + \tbox} + +%D \macros +%D {initializeboxstack,savebox,foundbox} +%D +%D At the cost of some memory, but saving box registers, we +%D have implemented a box repository. +%D +%D \starttyping +%D \initializeboxstack{one} +%D +%D \savebox{one}{a}{test a} +%D \savebox{one}{p}{test p} +%D \savebox{one}{q}{test q} +%D +%D \normalhbox{a:\foundbox{one}{a}} \par +%D \normalhbox{q:\foundbox{one}{q}} \par +%D \normalhbox{p:\foundbox{one}{p}} \par +%D \normalhbox{x:\foundbox{one}{x}} \par +%D \normalhbox{y:\foundbox{two}{a}} \par +%D \stoptyping + +% we keep it around as a demonstration of good old tex code: +% +% \def\@@stackbox{boxstack:b:} +% \def\@@stackmax{boxstack:m:} +% \def\@@stacktag{boxstack:t:} +% \def\@@stacklst{boxstack:l:} +% +% \def\initializeboxstack#1% +% {\ifundefined{\@@stackbox#1}% +% \@EA\newbox\csname\@@stackbox#1\endcsname +% \else +% \global\setbox\csname\@@stackbox#1\endcsname\normalvbox{}% +% \def\docommand##1{\global\letbeundefined{\@@stacktag#1:##1}}% +% \processcommacommand[\getvalue{\@@stacklst#1}]\docommand +% \fi +% \global\letvalue{\@@stacklst#1}\empty +% \global\letvalue{\@@stackmax#1}\!!zeropoint} +% +% \def\savebox#1#2% stack name +% {\dowithnextbox +% {\doifdefined{\@@stackbox#1} +% {\@EA\doglobal\@EA\increment\csname\@@stackmax#1\endcsname +% \setxvalue{\@@stacktag#1:#2}{\csname\@@stackmax#1\endcsname}% +% \setxvalue{\@@stacklst#1}{\getvalue{\@@stacklst#1},#2}% +% \global\setbox\csname\@@stackbox#1\endcsname\normalvbox +% {\forgetall +% \setbox\scratchbox\normalvbox{\flushnextbox} +% \ht\scratchbox\onepoint +% \dp\scratchbox\zeropoint +% \unvbox\csname\@@stackbox#1\endcsname +% \offinterlineskip +% \allowbreak +% \box\scratchbox}}}% +% \normalvbox} +% +% \def\foundbox#1#2% +% {\normalvbox +% {\doifdefined{\@@stackbox#1} +% {\doifdefined{\@@stacktag#1:#2} +% {\setbox\scratchbox\normalvbox +% {\splittopskip\zeropoint +% \setbox0\copy\csname\@@stackbox#1\endcsname +% \dimen0=\getvalue{\@@stacktag#1:#2}\points +% \advance\dimen0 -\onepoint +% \setbox2\vsplit0 to \dimen0 +% \ifdim\ht0>\onepoint +% \setbox0\vsplit0 to \onepoint +% \fi +% \unvbox0\setbox0\lastbox\unvbox0}% +% \unvbox\scratchbox}}}} +% +% \def\doifboxelse#1#2% +% {\doifdefinedelse{\@@stacktag#1:#2}} + +\def\@@stackbox{@box@} +\def\@@stacklst{@xob@} + +\def\setstackbox#1#2% + {\ifcsname\@@stackbox:#1:#2\endcsname\else + \expandafter\newbox\csname\@@stackbox:#1:#2\endcsname + \fi + \global\setbox\csname\@@stackbox:#1:#2\endcsname\normalvbox} + +\def\initializeboxstack#1% + {\def\docommand##1{\setstackbox{#1}{##1}{}}% + \ifcsname\@@stacklst#1\endcsname + \processcommacommand[\getvalue{\@@stacklst#1}]\docommand + \fi + \global\letvalue{\@@stacklst#1}\empty} + +\def\savebox#1#2% stack name + {% beware, \setxvalue defines the cs beforehand so we cannot use the + % test inside the { } + \ifcsname\@@stacklst#1\endcsname + \setxvalue{\@@stacklst#1}{\csname\@@stacklst#1\endcsname,#2}% + \else + \setxvalue{\@@stacklst#1}{#2}% + \fi + \setstackbox{#1}{#2}} + +\def\foundbox#1#2% + {\normalvbox + {\ifcsname\@@stackbox:#1:#2\endcsname + \copy\csname\@@stackbox:#1:#2\endcsname + \fi}} + +\long\def\doifboxelse#1#2#3#4% + {\ifcsname\@@stackbox:#1:#2\endcsname + \ifvoid\csname\@@stackbox:#1:#2\endcsname#4\else#3\fi + \else + #4% + \fi} + +%D \macros +%D {removedepth, obeydepth} +%D +%D While \type {\removedepth} removes the preceding depth, +%D \type {\obeydepth} makes sure we have depth. Both macros +%D leave the \type {\prevdepth} untouched. + +\def\removedepth + {\ifvmode \ifdim\prevdepth>\zeropoint \kern-\prevdepth \fi \fi} + +\def\obeydepth + {\par \removedepth \ifvmode \kern\strutdp \fi} + +\def\undepthed + {\dowithnextbox{\nextboxdp\zeropoint\flushnextbox}\hbox} + +%D \macros +%D {removebottomthings, removelastskip} +%D +%D A funny (but rather stupid) one, plus a redefinition. + +\def\removebottomthings + {\dorecurse5{\unskip\unkern\unpenalty}} + +\def\removelastskip % \ifvmode the plain tex one \fi +% {\ifvmode\ifdim\lastskip=\zeropoint\else\vskip-\lastskip\fi\fi} + {\ifvmode\ifzeropt\lastskip\else\vskip-\lastskip\fi\fi} + +%D \macros +%D {makestrutofbox} +%D +%D This macro sets the dimensions of a box to those of a +%D strut. + +\def\domakestrutofbox + {\ht\registercount\strutht + \dp\registercount\strutdp + \wd\registercount\zeropoint} + +\def\makestrutofbox + {\afterassignment\domakestrutofbox\registercount} + +%D \macros +%D {raisebox,lowerbox} +%D +%D Some more box stuff, related to positioning (under +%D construction). Nice stuff for a tips and tricks maps +%D article. +%D +%D \starttyping +%D \raisebox{100pt}\normalhbox{test} +%D \raisebox50pt\normalhbox{test} +%D \hsmash{\raisebox{100pt}\normalhbox{test}} +%D \stoptyping + +\def\doraiselowerbox#1#2% a nice trick us used to accept + {\def\next % both direct and {} dimensions + {\dowithnextbox + {\setbox\nextbox\normalhbox{#1\scratchdimen\flushnextbox}% + \nextboxht\strutht + \nextboxdp\strutdp + \flushnextbox}}% + \afterassignment\next\scratchdimen=#2} + +\def\raisebox{\doraiselowerbox\raise} +\def\lowerbox{\doraiselowerbox\lower} + +% maybe some day we need this +% +% \def\appendvbox#1% % uses \box8 +% {\bgroup +% \ifdim\prevdepth<\zeropoint +% \ifdim\pagetotal=\zeropoint +% \setbox8=\normalvtop{\unvcopy#1}% +% \hrule\c!!height\zeropoint +% \kern-\ht8 +% \box#1\relax +% \else +% \box#1\relax +% \fi +% \else +% \dimen0=\prevdepth +% \hrule\c!!height\zeropoint +% \setbox8=\normalvtop{\unvcopy#1}% +% \dimen2=\baselineskip +% \advance\dimen2 by -\dimen0 +% \advance\dimen2 by -\ht8 +% \kern\dimen2 +% \box#1\relax +% \fi +% \egroup} + +% %D Also new: +% %D +% %D \startbuffer +% %D \normbox[1cm][bba]{m} % b(efore) a(fter) v(box) s(trut) f(rame) +% %D \normbox[1cm][bba]{m} +% %D \normbox[1cm][bba]{m} +% %D \stopbuffer +% %D +% %D \typebuffer +% %D \getbuffer +% +% \def\dodonormbox#1#2#3#4#5#6#7% +% {\doifnumberelse{#1} +% {\dimen0=#1}{\setbox0=#3{#1}\dimen0=#50}% +% \doifinstringelse{f}{#2} +% {\let\next#4}{\let\next#3}% +% \next to \dimen0 +% {\counttoken b\in#2\to\!!counta\dorecurse{\!!counta}{#6}#6% +% #7\nextbox +% \counttoken a\in#2\to\!!counta\dorecurse{\!!counta}{#6}#6}} +% +% \def\donormbox[#1][#2]% +% {\bgroup +% \doifinstringelse{v}{#2} +% {\let\next\normalvbox} +% {\let\next\normalhbox}% +% \dowithnextbox +% {\ifvbox\nextbox +% \let\\=\par +% \dodonormbox{#1}{#2}\normalvbox\ruledvbox\ht\vfil\unvbox +% \else +% \let\\=\space +% \dodonormbox{#1}{#2}\normalhbox\ruledhbox\wd\hfil\unhbox +% \fi +% \egroup}% +% \next} +% +% \def\normbox +% {\dodoubleempty\donormbox} + +% vcenter in text, we kunnen vcenter overloaden + +\def\halfwaybox + {\dowithnextbox + {\nextboxdp\zeropoint + \setbox\nextbox\normalhbox{\lower.5\nextboxht\flushnextbox}% + \flushnextbox} + \normalhbox} + +%D New: + +\def\setdimentoatleast#1#2% + {\ifdim#1>\zeropoint\else#1=#2\fi} + +%D And even rawer: + +\let\naturalhbox \normalhbox +\let\naturalvbox \normalvbox +\let\naturalvtop \normalvtop +\let\naturalvcenter \normalvtop + +\ifdefined\textdir + + \def\naturalhbox{\normalhbox dir TLT} + \def\naturalvbox{\normalvbox dir TLT} + %def\naturalvtop{\normalvtop dir TLT} + +\fi + +%D \macros +%D {vcenter} +%D +%D Also new: tex mode \type {\vcenter}. + +\let\verynormalvcenter \vcenter % since \vcenter can be visualized + +\def\vcenter + {\normalvbox\bgroup + \dowithnextbox{\normalhbox{$\verynormalvcenter{\flushnextbox}$}\egroup} + \normalvbox} + +% could be \everymathematics + +\prependtoks \let\vcenter\normalvcenter \to \everymath +\prependtoks \let\vcenter\normalvcenter \to \everydisplay + +%D \macros +%D {frozenhbox} +%D +%D A not so well unhboxable bxo can be made with: + +\def\frozenhbox + {\hbox\bgroup\dowithnextbox{\hbox{\hbox{\flushnextbox}}\egroup}\hbox} + +%D \macros +%D {setboxllx,setboxlly,gsetboxllx,gsetboxlly,getboxllx,getboxlly} +%D +%D A prelude to an extended \TEX: + +% \def\setboxllx #1#2{\bgroup\scratchdimen#2\expanded{\egroup\noexpand\setevalue{b@@x\number#1}{\the\scratchdimen}}} +% \def\setboxlly #1#2{\bgroup\scratchdimen#2\expanded{\egroup\noexpand\setevalue{b@@y\number#1}{\the\scratchdimen}}} +% +% \def\gsetboxllx#1#2{\bgroup\scratchdimen#2\setxvalue{b@@x\number#1}{\the\scratchdimen}\egroup} +% \def\gsetboxlly#1#2{\bgroup\scratchdimen#2\setxvalue{b@@y\number#1}{\the\scratchdimen}\egroup} + +\def\setboxllx#1#2{\setevalue{b@@x\number#1}{\the\dimexpr#2\relax}} +\def\setboxlly#1#2{\setevalue{b@@y\number#1}{\the\dimexpr#2\relax}} + +\def\gsetboxllx{\global\setboxllx} +\def\gsetboxlly{\global\setboxlly} + +\def\getboxllx#1{\executeifdefined{b@@x\number#1}\zeropoint} +\def\getboxlly#1{\executeifdefined{b@@y\number#1}\zeropoint} + +%D \macros +%D {shownextbox} +%D +%D Handy for tracing +%D +%D \starttyping +%D \shownextbox\vbox{test} +%D \shownextbox\vbox{test\endgraf} +%D \shownextbox\vbox{test\endgraf\strut\endgraf} +%D \shownextbox\vbox{test\endgraf\thinrule} +%D \shownextbox\vbox{\setupwhitespace[big]test\endgraf\thinrule} +%D \stoptyping + +\def\shownextbox + {\dowithnextbox + {\bgroup + \showboxbreadth\maxdimen + \showboxdepth \maxdimen + \scratchcounter\interactionmode + \batchmode + \showbox\nextbox + \box\nextbox + \interactionmode\scratchcounter + \egroup}} + +\def\spreadhbox#1% rebuilds \hbox{} + {\bgroup + \ifhbox#1\relax + \setbox2\emptybox + \unhbox#1% + \doloop + {\unpenalty\unskip\unpenalty\unskip\unpenalty\unskip + \setbox0\lastbox + \ifvoid0 + \exitloop + \else + \setbox2\hbox + {\ifhbox0 \spreadhbox0\else\box0\fi + \ifvoid2 \else\hss\unhbox2\fi}% + \fi}% + \ifvoid2\else\unhbox2\fi + \else + \box#1% + \fi + \egroup} + +% makes sense but too much log for overfull boxes: +% +% \showboxbreadth\maxdimen +% \showboxdepth \maxdimen + +\protect \endinput + +% a bit of test code: + +\hbox \bgroup + \ruledvbox {\hbox{\strut gans}} + \ruledvbox to \lineheight {\hbox{\strut gans}} + \ruledvbox to \lineheight {\hbox {gans}} + \ruledvbox to \strutheight{\hbox {gans}} + \ruledvbox to \strutheight{\hbox{\strut gans}} + \ruledvbox to \strutheight{\vss\hbox{gans}} +\egroup diff --git a/Master/texmf-dist/tex/context/base/supp-box.mkiv b/Master/texmf-dist/tex/context/base/supp-box.mkiv new file mode 100644 index 00000000000..f449e1d76b4 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/supp-box.mkiv @@ -0,0 +1,2501 @@ +%D \module +%D [ file=supp-box, +%D version=1995.10.10, +%D title=\CONTEXT\ Support Macros, +%D subtitle=Boxes, +%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 Support Macros / Boxes} + +\unprotect + +\registerctxluafile{supp-box}{1.001} + +%D This module implements some box manipulation macros. Some +%D are quite simple, some are more advanced and when understood +%D well, all can be of use. +%D +%D \macros +%D {strutdp,strutht,strutwd} +%D +%D The next shortcuts save memory and keying. The width is +%D normally zero points (if not, you're in trouble). These +%D shortcuts can be used like a dimension, opposite to the +%D core macros \type {\strutdepth} and alike, which are +%D values. + +\def\strutdp{\dp\strutbox} +\def\strutht{\ht\strutbox} +\def\strutwd{\wd\strutbox} + +%D \macros +%D {resetbox, emptybox} +%D +%D Let's start with an easy one. The next macro hides the +%D ugly \type {@} in \type {\voidb@x}. + +\ifx\voidbox\undefined \newbox\voidbox \fi + +%D \macros +%D {nextdepth} +%D +%D Let's start with a rather simple declaration. Sometimes we +%D need to save the \TEX\ \DIMENSION\ \type{\prevdepth} and +%D append it later on. The name \type{\nextdepth} suits +%D this purpose well. + +\newdimen\nextdepth + +%D \macros +%D {smashbox, smashedbox} +%D +%D Smashing is introduced in \PLAIN\ \TEX, and stands for +%D reducing the dimensions of a box to zero. The most resolute +%D one is presented first. + +\def\smashbox#1% + {\wd#1\zeropoint + \ht#1\zeropoint + \dp#1\zeropoint} + +\def\smashboxed#1% + {\smashbox{#1}% + \box#1\relax} + +%D \macros +%D {hsmashbox,vsmashbox} +%D +%D Smashing can be used for overlaying boxes. Depending on +%D the mode, horizontal or vertical, one can use: + +\def\hsmashbox#1% + {\wd#1\zeropoint} + +\def\vsmashbox#1% + {\ht#1\zeropoint + \dp#1\zeropoint} + +%D The next implementation is less sensitive for spurious +%D spaces. + +\newcount\registercount + +\def\smashbox + {\afterassignment\dosmashbox\registercount} + +\def\dosmashbox + {\wd\registercount\zeropoint + \ht\registercount\zeropoint + \dp\registercount\zeropoint} + +\def\smashedbox + {\afterassignment\thesmashedbox\registercount} + +\def\thesmashedbox + {\dosmashbox + \box\registercount} + +\def\hsmashbox + {\afterassignment\dohsmashbox\registercount} + +\def\dohsmashbox + {\wd\registercount\zeropoint} + +\def\vsmashbox + {\afterassignment\dovsmashbox\registercount} + +\def\dovsmashbox + {\ht\registercount\zeropoint + \dp\registercount\zeropoint} + +%D \macros +%D {hsmash,vsmash, +%D hsmashed,vsmashed} +%D +%D While the previous macros expected a \BOX, the next act on a +%D content. They are some subtle differences betreen the smash +%D and smashed alternatives. The later ones reduce all +%D dimensions to zero. + +% Ok, but inefficient and/or catcode unsafe: +% +% \def\hsmash #1{\bgroup\setbox0=\normalhbox{#1}\hsmashbox0\box0\egroup} +% \def\vsmash #1{\bgroup\setbox0=\normalvbox{#1}\vsmashbox0\box0\egroup} +% \def\hsmashed#1{\bgroup\setbox0=\normalhbox{#1}\smashbox 0\box0\egroup} +% \def\vsmashed#1{\bgroup\setbox0=\normalvbox{#1}\smashbox 0\box0\egroup} +% +% Better, but a waste of tokens: +% +% \def\hsmash {\bgroup\dowithnextbox{\hsmashbox\nextbox\flushnextbox\egroup}\normalhbox} +% \def\vsmash {\bgroup\dowithnextbox{\vsmashbox\nextbox\flushnextbox\nextbox\egroup}\normalvbox} +% \def\hsmashed{\bgroup\dowithnextbox{\smashbox \nextbox\flushnextbox\nextbox\egroup}\normalhbox} +% \def\vsmashed{\bgroup\dowithnextbox{\smashbox \nextbox\flushnextbox\nextbox\egroup}\normalvbox} +% +% The best: + +\def\dosomesmash#1% (begin|end)group ipv (b|e)group ? + {\bgroup\dowithnextbox{#1\nextbox\flushnextbox\egroup}} + +\def\hsmash {\dosomesmash\hsmashbox\normalhbox} +\def\vsmash {\dosomesmash\vsmashbox\normalvbox} +\def\hsmashed{\dosomesmash\smashbox \normalhbox} +\def\vsmashed{\dosomesmash\smashbox \normalvbox} + +%D \macros +%D {smashedhbox,smashedvbox} +%D +%D Also handy (all dimensions zeroed): +%D +%D \starttyping +%D \smashedhbox to ... {...} +%D \smashedvbox to ... {...} +%D \stoptyping + +\def\dosmashedbox#1% + %{#1\bgroup\dowithnextbox{\smashbox\nextbox\flushnextbox\egroup}#1} + {#1\bgroup\dowithnextbox{\smashedbox\nextbox\egroup}#1} + +\def\smashedhbox{\dosmashedbox\hbox} +\def\smashedvbox{\dosmashedbox\vbox} + +%D \macros +%D {smash} +%D +%D This smash alternative takes an optional arg [whdtb] as +%D well as is potentially catcode safer. It is needed by the +%D math module (although the \type {\leavevmode} is not added +%D here). + +\def\smash + {\futurelet\nexttoken\dosmash} + +\def\dosmash + {\ifx\nexttoken[\@EA\dodosmash\else\@EA\donosmash\fi} + +\def\donosmash + {\dodosmash[hd]} + +\def\dodosmash[#1]% + {\edef\@@smash{#1}\futurelet\nexttoken\dododosmash} + +\def\dododosmash % if needed we can avoid the \next + {\ifmmode + \def\next##1{\mathpalette\mathsm@sh{##1}}% + \else\ifx\nexttoken\bgroup + \let\next\finsm@sh + \else + \def\next##1{\finsm@sh{##1}}% + \fi\fi + \next} + +\def\mathsm@sh#1#2% redefined plain macro + {\finsm@sh{$\mathsurround\zeropoint#1{#2}$}} + +\def\makesm@sh#1% redefined plain macro (handles t b h d w) + {\if#1w\nextboxwd\zeropoint\else + \if#1h\nextboxht\zeropoint\else + \if#1d\nextboxdp\zeropoint\else + \if#1t\nextboxht\zeropoint\else + \if#1b\nextboxdp\zeropoint\fi\fi\fi\fi\fi} + +\def\finsm@sh % redefined plain macro + {\dowithnextbox{\@EA\handletokens\@@smash\with\makesm@sh\flushnextbox}\normalhbox} + +%D \starttabulate[|l|l|] +%D \NC w \NC \ruledhbox{\smash [w]{This is some great smashing, isn't it?}} \NC \NR +%D \NC h \NC \ruledhbox{\smash [h]{This is some great smashing, isn't it?}} \NC \NR +%D \NC d \NC \ruledhbox{\smash [d]{This is some great smashing, isn't it?}} \NC \NR +%D \NC tb \NC \ruledhbox{\smash [tb]{This is some great smashing, isn't it?}} \NC \NR +%D \NC whd \NC \ruledhbox{\smash[whd]{This is some great smashing, isn't it?}} \NC \NR +%D \stoptabulate + +%D \macros +%D {phantom, hphantom, vphantom, mathstrut} +%D +%D The next implementation of \type {\phantom} cum suis does +%D not grab an argument in the non||math case, which is better. + +\unexpanded\def\phantom {\ph@nt\nextbox\nextbox\nextbox} +\unexpanded\def\vphantom{\ph@nt\nextbox\nextbox\voidbox} +\unexpanded\def\hphantom{\ph@nt\voidbox\voidbox\nextbox} + +%D Due to a complicated call to \type {\mathpallete} and +%D thereby \type {\mathchoice}, the next macro looks ugly. +%D We also take care of non||braced arguments. + +\def\ph@nt#1#2#3% + {\def\doph@nt + {\ifmmode + \def\mathph@nt####1####2{\makeph@nt#1#2#3{$\mathsurround\zeropoint####1{####2}$}}% + \def\nextph@nt{\mathpalette\mathph@nt}% + \else\ifx\nextph@nt\bgroup + \def\nextph@nt{\makeph@nt#1#2#3}% + \else + \def\nextph@nt####1{\makeph@nt#1#2#3{####1}}% + \fi\fi + \nextph@nt}% + \futurelet\nextph@nt\doph@nt} + +\def\makeph@nt#1#2#3% + {\begingroup + \dowithnextbox + {\setbox\scratchbox\emptyhbox + \ht\scratchbox\ht#1% + \dp\scratchbox\dp#2% + \wd\scratchbox\wd#3% + \box\scratchbox + \endgroup} + \normalhbox} + +\let\finph@nt\undefined + +%D We also define plain's \type {\mathstrut}. + +\unexpanded\def\mathstrut{\vphantom{(}} + +%D \macros +%D {getboxheight} +%D +%D Although often needed, \TEX\ does not support arithmics +%D like: +%D +%D \starttyping +%D \dimen0 = \ht0 + \dp0 +%D \stoptyping +%D +%D so we implemented: +%D +%D \starttyping +%D \getboxheight ... \of \box... +%D \stoptyping +%D +%D For instance, +%D +%D \starttyping +%D \getboxheight \dimen0 \of \box0 +%D \getboxheight \someheight \of \box \tempbox +%D \stoptyping +%D +%D The implementation is rather stupid: +%D +%D \starttyping +%D \def\getboxheight#1\of#2\box#3% +%D {#1\ht#3\advance#1\dp#3\relax} +%D \stoptyping +%D +%D The next alternative is slightly more clever, since +%D it accepts \type {{12}} as well as \type {12} as box +%D number. + +\def\getboxheight#1\of#2\box#3% + {\def\next{#1\dimexpr\ht\registercount+\dp\registercount\relax}% + \afterassignment\next\registercount=#3} + +%D For a long time the following three macros were part of +%D the grid snapping core module, but it makes more sense to +%D have them here so that users can see them. +%D +%D \macros +%D {getnoflines, getroundednoflines, getrawnoflines} +%D +%D Het commando \type{\getnoflines} converteert een hoogte +%D (dimensie) in een aantal regels en kent dit toe aan +%D \type{\noflines}. +%D +%D \starttyping +%D \getnoflines{dimensie} +%D \stoptyping +%D +%D Er wordt gedeeld door \type{\openlineheight} en een hoogte +%D van~0pt komt overeen met 0~regels. The raw alternative +%D does not round. + +%D For a long time we had: +%D +%D \starttyping +%D \newcount\noflines +%D \newdimen\noflinesheight +%D +%D \def\dogetnoflines#1#2% +%D {\noflinesheight#2\relax +%D \ifzeropt\noflinesheight % \ifdim\noflinesheight=\zeropoint +%D \noflines\zerocount +%D \else +%D \divide\noflinesheight \openlineheight +%D \noflines\noflinesheight +%D #1\ifdim\noflines\openlineheight=#2\relax \else +%D \advance\noflines\ifdim#2>\zeropoint\plusone\else\minusone\fi +%D \fi\fi +%D \fi} +%D +%D \def\getnoflines {\dogetnoflines\iftrue } % compensated +%D \def\getrawnoflines{\dogetnoflines\iffalse} % no compensation +%D \stoptyping +%D +%D A more recent variant is: + +\ifx\roundingeps\undefined \newdimen\roundingeps \roundingeps=10sp \fi + +\newcount\noflines +\newdimen\noflinesheight + +\def\getnoflines#1% + {\noflinesheight#1\relax + \ifzeropt\noflinesheight + \noflines\zerocount + \else\ifdim\noflinesheight>\zeropoint + \advance\noflinesheight-\roundingeps + \divide\noflinesheight\openlineheight + \noflines\noflinesheight + \advance\noflines\plusone + \else + \advance\noflinesheight\roundingeps + \divide\noflinesheight\openlineheight + \noflines\noflinesheight + \advance\noflines\minusone + \fi\fi} + +\def\getroundednoflines#1% + {\noflinesheight#1\relax + \ifzeropt\noflinesheight + \noflines\zerocount + \else\ifdim\noflinesheight>\zeropoint + \advance\noflinesheight\roundingeps + \divide\noflinesheight\openlineheight + \noflines\noflinesheight + \else + \advance\noflinesheight-\roundingeps + \divide\noflinesheight\openlineheight + \noflines\noflinesheight + \fi\fi} + +\def\getrawnoflines#1% + {\noflinesheight#1\relax + \ifzeropt\noflinesheight + \noflines\zerocount + \else\ifdim\noflinesheight>\zeropoint + \advance\noflinesheight\roundingeps + \advance\noflinesheight.5\openlineheight + \divide\noflinesheight\openlineheight + \noflines\noflinesheight + \else + \advance\noflinesheight-\roundingeps + \advance\noflinesheight-.5\openlineheight + \divide\noflinesheight\openlineheight + \noflines\noflinesheight + \fi\fi} + +%D Let's proof that it works: +%D +%D \startbuffer +%D \scratchdimen\dimexpr(3pt) \getnoflines\scratchdimen 1=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10\lineheight) \getnoflines\scratchdimen 10=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10.1\lineheight) \getnoflines\scratchdimen 11=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10.5\lineheight) \getnoflines\scratchdimen 11=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10.9\lineheight) \getnoflines\scratchdimen 11=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10\lineheight+3pt) \getnoflines\scratchdimen 11=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10\lineheight+3sp) \getnoflines\scratchdimen 10=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10\lineheight-3sp) \getnoflines\scratchdimen 10=\the\noflines \endgraf +%D +%D \scratchdimen\dimexpr(3pt) \getrawnoflines\scratchdimen 0=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10\lineheight) \getrawnoflines\scratchdimen 10=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10.1\lineheight) \getrawnoflines\scratchdimen 10=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10.5\lineheight) \getrawnoflines\scratchdimen 11=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10.9\lineheight) \getrawnoflines\scratchdimen 11=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10\lineheight+3pt) \getrawnoflines\scratchdimen 10=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10\lineheight+3sp) \getrawnoflines\scratchdimen 10=\the\noflines \endgraf +%D \scratchdimen\dimexpr(10\lineheight-3sp) \getrawnoflines\scratchdimen 10=\the\noflines \endgraf +%D \stopbuffer +%D +%D \typebuffer \getbuffer + +%D \macros +%D {determinenoflines} +%D +%D The next macro determines the number of lines and +%D returns it it \type {\noflines}. The macro works +%D reasonable well as long as the content can be unboxed. +%D +%D \starttyping +%D \determinenoflines{test\\test} +%D \determinenoflines{\bfd test\\test} +%D \determinenoflines{\definedfont[Sans at 40pt]test\\test} +%D \stoptyping + +\def\dodeterminenoflines % can be mkiv'd + {\beginofshapebox + \unvbox\nextbox + \endofshapebox + % \global\count1\zerocount + % \reshapebox{\global\advance\count1\plusone}% + % \egroup\noflines\count1 }% + \scratchcounter\zerocount + \reshapebox{\global\advance\scratchcounter\plusone}% + \expandafter\egroup\expandafter\noflines\the\scratchcounter\relax} + +\def\determinenoflines + {\bgroup + \forgetall + \let\crlf\endgraf + \let\\\endgraf + \dowithnextbox{\dodeterminenoflines}\vbox} + +%D \macros +%D {doiftextelse, doiftext} +%D +%D When \type {\doifelse} cum suis hopelessly fail, for +%D instance because we pass data, we can fall back on the next +%D macro: +%D +%D \starttyping +%D \doiftextelse {data} {then branch} {else branch} +%D \doiftext {data} {then branch} +%D \stoptyping + +\def\doiftextelse#1% + {\bgroup + \setbox\scratchbox\normalhbox + {\settrialtypesetting + \ignorespaces#1\removeunwantedspaces}% + \ifzeropt\wd\scratchbox + \egroup\@EA\secondoftwoarguments + \else + \egroup\@EA\firstoftwoarguments + \fi} + +\def\doiftext#1#2% + {\doiftextelse{#1}{#2}\donothing} + +%D \macros +%D {dowithnextbox,nextbox} +%D +%D Sometimes we want a macro to grab a box and do something +%D on the content. One could pass an argument to a box, but +%D this can violate the specific \CATCODES\ of its content and +%D leads to unexpected results. The next macro treats the +%D following braced text as the content of a box and +%D manipulates it afterwards in a predefined way. +%D +%D The first argument specifies what to do with the content. +%D This content is available in \type{\nextbox}. The second +%D argument is one of \type{\hbox}, \type{\vbox} or +%D \type{\vtop}. The third argument must be grouped with +%D \type{\bgroup} and \type{\egroup}, \type{{...}} or can be +%D a \type{\box} specification. +%D +%D In \CONTEXT\ this macro is used for picking up a box and +%D treating it according to earlier specifications. We use for +%D instance something like: +%D +%D \starttyping +%D \def\getfloat% +%D {\def\handlefloat{...\flushnextbox...} +%D \dowithnextbox\handlefloat\normalvbox} +%D \stoptyping +%D +%D instead of: +%D +%D \starttyping +%D \def\getfloat#1% +%D {...#1...} +%D \stoptyping +%D +%D In this implementation the \type{\aftergroup} construction +%D is needed because \type{\afterassignment} is executed inside +%D the box. + +\ifx\nextbox\undefined \newbox\nextbox \fi + +\long\def\dowithnextbox#1% + {\long\def\dodowithnextbox{#1}% + \afterassignment\dododowithnextbox + \setbox\nextbox} + +\def\dododowithnextbox + {\aftergroup\dodowithnextbox} + +\long\def\dowithnextboxcs#1% + {\let\dodowithnextbox#1% + \afterassignment\dododowithnextbox + \setbox\nextbox} + +\def\dododowithnextbox + {\aftergroup\dodowithnextbox} + +%D So in fact we get: +%D +%D \starttyping +%D \setbox\nextbox { \aftergroup\dodowithnextbox ... } +%D \stoptyping +%D +%D or +%D +%D \starttyping +%D \setbox\nextbox { ... } \dodowithnextbox +%D \stoptyping +%D +%D A slower but more versatile implementation is: +%D +%D \starttyping +%D \long\def\dowithnextbox#1#2% +%D {\long\def\dodowithnextbox{#1}% +%D \ifx#2\normalhbox +%D \afterassignment\dododowithnextbox +%D \else\ifx#2\normalvbox +%D \afterassignment\dododowithnextbox +%D \else\ifx#2\normalvtop +%D \afterassignment\dododowithnextbox +%D \else\ifx#2\normalvcenter +%D \afterassignment\dododowithnextbox +%D \else +%D \afterassignment\dodowithnextbox +%D \fi\fi\fi\fi +%D \setbox\nextbox#2} +%D \stoptyping +%D +%D This alternative also accepts \type{\box0} and alike, but +%D we don't really need this functionality now. + +%D \macros +%D {nextboxht,nextboxwd,nextboxdp,flushnextbox} +%D +%D The next couple of shortcuts saves us memory as well as +%D \type {{}}'s in passing parameters. + +\def\nextboxht {\ht\nextbox} +\def\nextboxwd {\wd\nextbox} +\def\nextboxdp {\dp\nextbox} +\def\nextboxhtdp {\dimexpr\ht\nextbox+\dp\nextbox\relax} + +\def\flushnextbox{\box\nextbox} + +%D \macros +%D {dowithnextboxcontent} +%D +%D But, occasionally we do need to pass some local settings +%D without wanting to use additional grouping. Therefore we +%D provide: +%D +%D \starttyping +%D \dowithnextboxcontent{inside}{after}{box content} +%D \stoptyping +%D +%D {\em todo: Search source for potential usage!} + +\long\def\dowithnextboxcontent#1#2% inside, after + {\long\def\dodowithnextbox{#2}% + \def\dododowithnextbox{#1\aftergroup\dodowithnextbox}% + \afterassignment\dododowithnextbox + \setbox\nextbox} + +%D Now we can redefine \type {\dowithnextbox} as follows: +%D +%D \starttyping +%D \def\dowithnextbox{\dowithnextboxcontent\empty} +%D \stoptyping +%D +%D But since this macro is used often and since this implementation +%D is slower, we will not use that definition. + +% maybe: +% +% depending on the size of the action, about 10% faster +% +% \newtoks\nextboxtoks +% +% \def\dowithnextbox {\afterassignment\redowithnextbox\nextboxtoks} +% \def\redowithnextbox {\afterassignment\dododowithnextbox\setbox\nextbox} +% \def\dododowithnextbox{\aftergroup\dodowithnextbox} +% \def\dodowithnextbox {\the\nextboxtoks} +% +% \long\def\dowithnextboxcontent#1% #2% inside, after +% {\def\dododowithnextbox{#1\aftergroup\dodowithnextbox}% +% \afterassignment\redowithnextboxcontent\nextboxtoks} +% +% \def\redowithnextboxcontent +% {\afterassignment\dododowithnextbox\setbox\nextbox} + +%D \macros +%D {llap, rlap, tlap, blap, clap} +%D +%D Some well known friends, but we implement them our own +%D way. We want the macros to work in both math and text mode. + +\def\dodorlap{\normalhbox to \zeropoint{\flushnextbox\normalhss}\endgroup} +\def\dodollap{\normalhbox to \zeropoint{\normalhss\flushnextbox}\endgroup} +\def\dodoclap{\normalhbox to \zeropoint{\normalhss\flushnextbox\normalhss}\endgroup} + +\def\dorlap{\begingroup\dowithnextboxcs\dodorlap\normalhbox} +\def\dollap{\begingroup\dowithnextboxcs\dodollap\normalhbox} +\def\doclap{\begingroup\dowithnextboxcs\dodoclap\normalhbox} + +\def\domathclap{\mathpalette\dodomathclap} \def\dodomathclap#1#2{\doclap{$\mathsurround\zeropoint#1#2$}} +\def\domathllap{\mathpalette\dodomathllap} \def\dodomathllap#1#2{\dollap{$\mathsurround\zeropoint#1#2$}} +\def\domathrlap{\mathpalette\dodomathrlap} \def\dodomathrlap#1#2{\dorlap{$\mathsurround\zeropoint#1#2$}} + +\unexpanded\def\rlap{\mathortext\domathrlap\dorlap} +\unexpanded\def\llap{\mathortext\domathllap\dollap} +\unexpanded\def\clap{\mathortext\domathclap\doclap} + +\def\dodotlap{\normalvbox to \zeropoint{\normalvss\flushnextbox}\endgroup} +\def\dodoblap{\normalvbox to \zeropoint{\flushnextbox\normalvss}\endgroup} + +\def\tlap{\begingroup\dowithnextboxcs\dodotlap\normalvbox} +\def\blap{\begingroup\dowithnextboxcs\dodoblap\normalvbox} + +%D \macros +%D {beginofshapebox, +%D reshapebox, doreshapebox, +%D flushshapebox, +%D innerflushshapebox, +%D shapebox, +%D ifreshapingbox} +%D +%D The next utility macro originates from some linenumbering +%D mechanism. Due to \TEX's advanced way of typesetting +%D paragraphs, it's not easy to do things on a line||by||line +%D basis. This macro is able to reprocess a given box and can +%D act upon its vertical boxed components, such as lines. The +%D unwinding sequence in this macro is inspired by a \NTG\ +%D workshop of David Salomon in June 1992. +%D +%D First we have to grab the piece of text we want to act +%D upon. This is done by means of the duo macros: +%D +%D \starttyping +%D \beginofshapebox +%D a piece of text +%D \endofshapebox +%D \stoptyping +%D +%D When all texts is collected, we can call \type{\reshapebox} +%D and do something with it's vertical components. We can make +%D as much passes as needed. When we're done, the box can be +%D unloaded with \type{\flushshapebox}. The only condition in +%D this scheme is that \type{\reshapebox} must somehow unload +%D the \BOX\ \type{\shapebox}. +%D +%D An important aspect is that the content is unrolled +%D bottom||up. The next example illustrates this maybe +%D unexpected characteristic. +%D +%D \startbuffer +%D \beginofshapebox +%D \em \input tufte +%D \endofshapebox +%D +%D \newcounter\LineNumber +%D +%D \reshapebox +%D {\doglobal\increment\LineNumber +%D \normalhbox{\llap{\LineNumber\hskip2em}\box\shapebox}} +%D +%D \flushshapebox +%D \stopbuffer +%D +%D \typebuffer +%D +%D \getbuffer +%D +%D As we can see, when some kind of numbering is done, we have +%D to add a second pass. +%D +%D \startbuffer +%D \newcounter\LineNumber +%D \newcounter\NumberOfLines +%D +%D \reshapebox +%D {\doglobal\increment\NumberOfLines +%D \box\shapebox} +%D +%D \reshapebox +%D {\doglobal\increment\LineNumber +%D \normalhbox +%D {\llap{\LineNumber\ (\NumberOfLines)\hskip2em}% +%D \box\shapebox}% +%D \doglobal\decrement\NumberOfLines} +%D +%D \flushshapebox +%D \stopbuffer +%D +%D \typebuffer +%D +%D \getbuffer +%D +%D This example shows that the content of the box is still +%D available after flushing. Another feature is that only the +%D last reshaping counts. Multiple reshaping can be done by: +%D +%D \startbuffer +%D \beginofshapebox +%D \flushshapebox +%D \endofshapebox +%D +%D \reshapebox +%D {\doglobal\increment\LineNumber +%D \normalhbox{\llap{$\star$\hskip1em}\box\shapebox}% +%D \doglobal\decrement\NumberOfLines} +%D +%D \flushshapebox +%D \stopbuffer +%D +%D \typebuffer +%D +%D \getbuffer +%D +%D The macros are surprisingly easy to follow and in fact +%D introduce no new concepts. Nearly all books on \TEX\ show +%D similar solutions for unwinding \BOXES. +%D +%D Some macros, like footnote ones, can be sensitive for +%D reshaping, which can result in an endless loop. We +%D therefore offer: +%D +%D \starttyping +%D \ifreshapingbox +%D \stoptyping +%D +%D Some \CONTEXT\ commands are protected this way. Anyhow, +%D reshaping is aborted after 100 dead cycles. +%D +%D By the way, changing the height and depth of \BOX\ +%D \type{\shapebox} results in bad spacing. This means that +%D for instance linenumbers etc. should be given zero height +%D and depth before being lapped into the margin. The +%D previous examples ignore this side effect, but beware! + +\newif \ifsomeshapeleft +\newif \ifreshapingbox + +\newbox \shapebox +\newcount \shapepenalty +\newdimen \shapekern +\newskip \shapeskip + +\newbox \newshapebox +\newbox \oldshapebox + +\newcount \shapecounter + +\newevery \everyshapebox \relax + +\def\shapesignal{.12345678pt} % or 12345sp + +\def\reshapebox#1% + {\doreshapebox + {#1}% + {\penalty\shapepenalty}% + {\kern \shapekern }% + {\vskip \shapeskip }} + +\newbox\tmpshapebox + +\newif\ifreshapingfailed % may save redundant runs + +\def\doreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip + {\global\reshapingfailedfalse + \ifzeropt\ht\oldshapebox % \ifdim\ht\oldshapebox=\zeropoint + \setbox\newshapebox\emptyvbox + \else + \setbox\newshapebox\normalvbox + {\unvcopy\oldshapebox + \setbox\newshapebox\emptybox + \shapecounter\zerocount + \doloop{\dodoreshapebox{#1}{#2}{#3}{#4}}}% + \setbox\newshapebox\box\tmpshapebox + \fi} + +\ifx\originalshapebox\undefined \let\originalshapebox\oldshapebox \fi + +% We will turn this into a \MKIV\ variant. + +\def\insertshapesignal + {\normalhbox to \shapesignal{\strut\hss}% plus \strut + \prevdepth\strutdp} % never \nointerlineskip + +\def\restoreshapebox % compensates for the signal + {\global\setbox\tmpshapebox\vbox{\vskip-\lineheight\unvcopy\oldshapebox}} + +\def\dodoreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip + {\ifnum\lastnodetype=\@@gluenode + \shapeskip\lastskip + \global\setbox\tmpshapebox\normalvbox{#4\unvbox\tmpshapebox}% + \unskip + \else\ifnum\lastnodetype=\@@kernnode + \shapekern\lastkern + \global\setbox\tmpshapebox\normalvbox{#3\unvbox\tmpshapebox}% + \unkern + \else\ifnum\lastnodetype=\@@penaltynode + \shapepenalty\lastpenalty + \global\setbox\tmpshapebox\normalvbox{#2\unvbox\tmpshapebox}% + \unpenalty + \else\ifnum\lastnodetype<\zeropoint + \exitloop + \else + \setbox\shapebox\lastbox + \ifvoid\shapebox + \else\ifdim\wd\shapebox=\shapesignal\relax + \exitloop + \else + \shapecounter\zerocount + \global\setbox\tmpshapebox\normalvbox{#1\unvbox\tmpshapebox}% + \fi\fi + \fi\fi\fi\fi + \ifnum\shapecounter>100 % can be less + \global\reshapingfailedtrue + \message{!!forced exit from shapebox \the\lastnodetype !!}% + \restoreshapebox + \exitloop + \else + \advance\shapecounter \plusone + \fi} + +\def\beginofshapebox + {\setbox\oldshapebox\normalvbox + \bgroup + \reshapingboxtrue + \the\everyshapebox + \insertshapesignal} + +\def\endofshapebox + {\endgraf + \egroup} + +\let\beginshapebox\beginofshapebox +\let\endshapebox \endofshapebox + +\def\flushshapebox + {\bgroup + \ifzeropt\ht\newshapebox % \ifdim\ht\newshapebox=\zeropoint + \else + % make \prevdepth legal + % \par before the next \vskip gives far worse results + \ifdim\parskip>\zeropoint\vskip\parskip\else\par\fi + % and take a look + \ifdim\prevdepth=-\thousandpoint + \prevdepth\zeropoint + \fi + \ifdim\prevdepth<\zeropoint\relax + % something like a line or a signal or ... + \donetrue + \else\ifinner + % not watertight and not ok + \donefalse + \else\ifdim\pagegoal=\maxdimen + \donetrue + \else + % give the previous line a normal depth + \donetrue + {\forgeteverypar\verticalstrut}\nobreak + \kern-\struttotal % geen \vskip + \kern-\parskip + % \vskip-\strutdp + \fi\fi\fi + \scratchdimen\dp\newshapebox + \unvbox\newshapebox + % \prevdepth=0pt and \dp\newshapebox depend on last line + \kern-\scratchdimen % ?? + % now \prevdepth=0pt + \ifdone + \kern\strutdp + \prevdepth\strutdp + \fi + \fi + \egroup} + +%D In real inner situations we can use: +%D +%D \starttyping +%D \flushinnershapebox +%D \stoptyping +%D +%D This one is used in \type{\framed}. + +% The kern fails on for instance: +% +% \omlijnd[offset=0pt,hoogte=8mm,uitlijnen={rechts,laho}]{\bfa test} + +\def\innerflushshapebox + {\ifzeropt\ht\newshapebox \else + \unvcopy\newshapebox\relax % unvcopy ! else spacing problem + % \kern-\dp\newshapebox\relax + \fi} + +%D For absolute control, one can use \type{\doreshapebox} +%D directly. This macro takes four arguments, that take care +%D of: +%D +%D \startitemize[n,packed] +%D \item \type{\shapebox} +%D \item \type{\shapepenalty} +%D \item \type{\shapekern} +%D \item \type{\shapeskip} +%D \stopitemize + +%D \macros +%D {shapedhbox} +%D +%D When constructing a new box, using the content of \type +%D {\shapebox}, one can best use \type {\shapedhbox} instead +%D of \type {\normalhbox}, since it manages the height and depth of +%D the line. + +\def\shapedhbox % lines with non strutted dimensions have + {\expanded{\dowithnextbox % interlineskip so if we want the original + {\nextboxht\the\ht\shapebox % spacing, we need to preserve the original + \nextboxdp\the\dp\shapebox % height and depth which is definitely + \noexpand\flushnextbox}} % needed if we apply struts to the 'new' + \normalhbox} % box or do something that changed ist size + +%D \macros +%D {hyphenatedword, +%D hyphenatedpar, +%D hyphenatedfile, +%D dohyphenateword} +%D +%D We no longer use the pure \TEX\ variant. In due time we will +%D report some more advanced statistics. +%D +%D \starttyping +%D \showhyphens{dohyphenatedword} +%D \stoptyping + +\def\doshowhyphenatednextbox + {\ctxcommand{showhyphenatedinlist(tex.box[\number\nextbox].list)}} + +\def\showhyphens{\dowithnextbox\doshowhyphenatednextbox\hbox} + +%D The following macros are seldom used but handy for tracing. +%D +%D \starttyping +%D \hyphenatedword{dohyphenatedword} +%D \hyphenatedpar {\dorecurse{10}{dohyphenatedword }} +%D \hyphenatedfile{tufte} +%D \stoptyping + +\def\dohyphenatednextbox + {\ctxcommand{hyphenatedlist(tex.box[\number\nextbox])}% + \unhbox\nextbox} + +\def\hyphenatedword {\dowithnextbox\dohyphenatednextbox \hbox} +\def\hyphenatedpar {\dowithnextbox\dohyphenatednextbox \hbox} +\def\hyphenatedfile#1{\dowithnextbox\dohyphenatednextbox \hbox{\readfile{#1}\donothing\donothing}} + +%D \macros +%D {processtokens} +%D +%D We fully agree with (most) typographers that inter||letter +%D spacing is only permitted in fancy titles, we provide a +%D macro that can be used to do so. Because this is +%D (definitely and fortunately) no feature of \TEX, we have to +%D step through the token list ourselves. +%D +%D \starttyping +%D \processtokens {before} {between} {after} {space} {tokens} +%D \stoptyping +%D +%D An example of a call is: +%D +%D \startbuffer +%D \processtokens {[} {+} {]} {\space} {hello world} +%D \stopbuffer +%D +%D \typebuffer +%D +%D This results in: +%D +%D \getbuffer +%D +%D The list of tokens may contain spaces, while \type{\\}, +%D \type{{}} and \type{\ } are handled as space too. + +\def\dodoprocesstokens + {\ifx\nextprocessedtoken\lastcharacter + \after + \let\nextprocessedtoken\relax + \else\ifx\nextprocessedtoken\bgroup + \def\nextprocessedtoken + {\dowithnextbox + {\before{\copy\nextbox}% \before can use nextbox several times + \let\before\between + \doprocesstokens} + \hbox\bgroup}% + \else + \expandafter\if\space\nextprocessedtoken + \after\white + \let\before\savedbefore + \else + \before\nextprocessedtoken + \let\before\between + \fi + \let\nextprocessedtoken\doprocesstokens + \fi\fi + \nextprocessedtoken} + +\def\doprocesstokens% the space after = is essential + {\afterassignment\dodoprocesstokens\let\nextprocessedtoken= } + +\def\processtokens#1#2#3#4#5% + {\begingroup + \def\lastcharacter{\lastcharacter}% + \def\space{ }% + \let\\=\space + \def\before {#1}% + \def\between{#2}% + \def\after {#3}% + \def\white {#4}% + \let\savedbefore\before + \doprocesstokens#5\lastcharacter + \endgroup} + +%D \macros +%D {doboundtext} +%D +%D Sometimes there is not enough room to show the complete +%D (line of) text. In such a situation we can strip of some +%D characters by using \type{\doboundtext}. When the text is +%D wider than the given width, it's split and the third +%D argument is appended. When the text to be checked is packed +%D in a command, we'll have to use \type{\expandafter}. +%D +%D \starttyping +%D \doboundtext{a very, probably to long, text}{3cm}{...} +%D \stoptyping +%D +%D When calculating the room needed, we take the width of the +%D third argument into account, which leads to a bit more +%D complex macro than needed at first sight. + +\def\dodoboundtext#1% + {\setbox0\normalhbox{#1}% + \advance\scratchdimen -\wd0 + \ifdim\scratchdimen>\zeropoint\relax#1\fi}% + +\def\doboundtext#1#2#3% still used? + {\normalhbox + {\setbox\scratchbox\normalhbox{#1}% + \scratchdimen#2\relax + \ifdim\wd\scratchbox>\scratchdimen + \setbox\scratchbox\normalhbox{#3}% + \advance\scratchdimen -\wd\scratchbox + \handletokens#1\with\dodoboundtext + \fi + \box\scratchbox}} + +%D \macros +%D {limitatetext} +%D +%D A bit more beautiful alternative for the previous command is +%D the next one. This command is more robust because we let +%D \TEX\ do most of the job. The previous command works better +%D on text that cannot be hyphenated. +%D +%D \starttyping +%D \limitatetext {text} {width} {sentinel} +%D \limitatetext {text} {-width} {prelude} +%D \stoptyping +%D +%D When no width is given, the whole text comes available. The +%D sentinel is optional. This is about the third version. + +\ifx\fakecompoundhyphen\undefined \let\fakecompoundhyphen\relax \fi +\ifx\veryraggedright \undefined \def\veryraggedright{\raggedright} \fi + +%D The simple alternative is as follows: +%D +%D \starttyping +%D \unexpanded\def\limitatetext% +%D {\bgroup % evt \setstrut +%D \forgetall +%D \fakecompoundhyphen % dangerous ! ! ! ! ! ! ! ! ! +%D \dowithnextbox\dolimitatetext\normalhbox} +%D +%D \def\dolimitatetext#1#2% +%D {\doifelsenothing{#1} +%D {\unhbox\nextbox} +%D {\widowpenalty=0 +%D \clubpenalty=0 +%D \scratchdimen=#1\relax +%D \ifdim\nextboxwd>\scratchdimen +%D \setbox\scratchbox=\normalhbox{ #2}% +%D \advance\scratchdimen by -\wd\scratchbox +%D \setbox\nextbox=\normalvbox +%D {\hsize=\scratchdimen +%D \hfuzz\maxdimen +%D \veryraggedright +%D \strut\unhcopy\nextbox}% +%D \ifdim\nextboxht>\strutht \else +%D \setbox\scratchbox\emptyhbox % overfull and not split +%D \fi +%D \setbox\nextbox=\normalvbox % if omitted: missing brace reported +%D {\splittopskip=\openstrutheight +%D \setbox\nextbox=\vsplit\nextbox to \strutht +%D \unvbox\nextbox +%D \setbox\nextbox=\lastbox +%D \global\setbox1=\normalhbox +%D {\unhbox\nextbox\unskip\kern\zeropoint\box\scratchbox\unskip}}% +%D \unhbox1 +%D \else +%D \unhbox\nextbox +%D \fi}% +%D \egroup} +%D \stoptyping +%D +%D The next alternative accepts a negative width. A negative +%D value crops the beginning. The macro thereby becomes less +%D readable, which is why we kept the original here too. + +\unexpanded\def\limitatetext + {\bgroup % evt \setstrut + \forgetall % otherwise indentation and so + %\def\limitatetext##1##2##3{##1}% \def ! + \let\limitatetext\firstofthreearguments + \fakecompoundhyphen % dangerous ! ! ! ! ! ! ! ! ! + \dowithnextboxcs\dolimitatetext\normalhbox} + +\def\dolimitatetext#1#2% + {\doifelsenothing{#1} + {\unhbox\nextbox} + {\nopenalties + \scratchdimen#1\relax + \ifdim\scratchdimen<\zeropoint\relax % we'll take the last line + \donefalse + \scratchdimen-\scratchdimen + \else + \donetrue + \fi + \ifdim\nextboxwd>\scratchdimen + \setbox\scratchbox\normalhbox{\ifdone\space#2\else#2\space\fi}% + \advance\scratchdimen -\wd\scratchbox + \setbox0\flushnextbox + \setbox\nextbox\normalvbox + {\hsize\scratchdimen + \hfuzz\maxdimen + \veryraggedright + \strut + \ifdone \else + \parfillskip\zeropoint + \rightskip\zeropoint + \hskip\zeropoint \!!plus 1\!!fill % \hsize + \fi + \unhcopy0}% + \ifdim\nextboxht>\strutht + \setbox\nextbox\normalvbox % if omitted: missing brace reported + {\splittopskip\openstrutheight + \ifdone + \setbox\nextbox\vsplit\nextbox to \strutht + \else + \doloop + {\setbox0\vsplit\nextbox to \strutht + \ifdim\nextboxht>\strutht \else \exitloop \fi}% + \fi + \unvbox\nextbox + \setbox\nextbox\lastbox + \global\setbox1\normalhbox + {\ifdone + \unhbox\nextbox\unskip\kern\zeropoint\box\scratchbox + \else + \box\scratchbox\unhbox\nextbox + \fi + \unskip}}% + \unhbox1 + \else + \unhbox0 + \fi + \else + \unhbox\nextbox + \fi}% + \egroup} + +%D We can also limit a text with more control: +%D +%D \startbuffer +%D \limitatetext {\input tufte } {2cm,5mm} {\unknown} +%D \limitatetext {ton en hans} {2cm,5mm} {\unknown} +%D \limitatetext {ton en hans zijn eikels} {2cm,5mm} {\unknown} +%D \limitatetext {ton} {2cm,5mm} {\unknown} +%D \stopbuffer +%D +%D \typebuffer \getbuffer +%D +%D We build this feature on top of the previous macro. + +\let\normallimitatetext\limitatetext + +\def\speciallimitatetext#1#2#3#4% text left right placeholder + {%\dontleavehmode + \bgroup + %\def\speciallimitatetext##1##2##3##4{##1}% \def ! + \let\speciallimitatetext\firstoffourarguments + \setbox0\normalhbox + {\nohyphens + \normallimitatetext{#1}{+#2}{}#4% + \normallimitatetext{#1}{-#3}{}}% + \setbox2\normalhbox + {#1}% + \ifdim\wd2<\wd0 #1\else\unhbox0\fi + \egroup} + +\def\limitatetext#1#2#3% \expanded added 2003/01/16 + {\expanded{\beforesplitstring#2}\at,\to\leftlimit + \expanded{\aftersplitstring #2}\at,\to\rightlimit + \ifx\rightlimit\empty + \normallimitatetext {#1}\leftlimit {#3}% + \else + \speciallimitatetext{#1}\leftlimit\rightlimit{#3}% + \fi} + +%D Undocumented bonus (see wiki): +%D +%D \starttyping +%D \limitatefirstline{\input tufte\relax}{10cm}{\unknown} +%D \stoptyping + +\def\limitatefirstline#1#2#3% + {\hbox\bgroup\strut + \setbox\scratchbox\hbox{\begstrut#1\endstrut}% + \ifdim\wd\scratchbox>#2\relax + \setbox\scratchbox\hbox{#3}% + \hsize#2\relax + \advance\hsize-\wd\scratchbox + \setbox\scratchbox\vbox{\forgetall\veryraggedright#1}% + \setbox\scratchbox\vsplit\scratchbox to \lineheight + \vbox + {\unvbox\scratchbox + \global\setbox\plusone\lastbox + \global\setbox\plusone\hbox{\strut\unhbox\plusone}% + \hbox % to #2 + {\ifx\clip\undefined + \box\plusone + \else\ifdim\wd\plusone>\hsize + \lower\strutdepth\hbox{\clip[\c!width=\hsize,\c!height=\lineheight]{\hbox{\raise\strutdepth\box\plusone}}}% + \else + \box\plusone + \fi\fi + \removeunwantedspaces#3}}% \removeunwantedspaces\hss#3}}% + \else + #1% + \fi + \egroup} + +%D \macros +%D {processisolatedwords,processisolatedchars} +%D +%D \startbuffer +%D \processisolatedchars{some more words} \ruledhbox \par +%D \processisolatedchars{and some $x + y = z$ math} \ruledhbox \par +%D \processisolatedchars{and a \normalhbox{$x + y = z$}} \ruledhbox \par +%D \processisolatedwords{some more words} \ruledhbox \par +%D \processisolatedwords{and some $x + y = z$ math} \ruledhbox \par +%D \processisolatedwords{and a \normalhbox{$x + y = z$}} \ruledhbox \par +%D \stopbuffer +%D +%D \typebuffer \blank \getbuffer \blank + +% todo: provide variant with #1 picked up as box + +\def\processisolatedchars#1#2% + {\dontleavehmode + \begingroup + \setbox\scratchbox\normalhbox{#1}% + \ctxcommand{applytochars(\number\scratchbox,"\strippedcsname#2",true)}% + \endgroup} + +\def\processisolatedwords#1#2% + {\dontleavehmode + \begingroup + \setbox\scratchbox\normalhbox{#1}% + \ctxcommand{applytowords(\number\scratchbox,"\strippedcsname#2",true)}% + \endgroup} + +\unexpanded\def\processwords#1% + {\processisolatedwords{#1}\processword} + +\let\processword\relax + +%D The better variant: + +\def\applytocharacters#1% + {\dontleavehmode + \dowithnextbox{\ctxcommand{applytochars(\number\nextbox,"\strippedcsname#1",true)}}% + \normalhbox} + +\def\applytowords#1% + {\dontleavehmode + \dowithnextbox{\ctxcommand{applytowords(\number\nextbox,"\strippedcsname#1",true)}}% + \normalhbox} + +%D \macros +%D {sbox} +%D +%D This is a rather strange command. It grabs some box content +%D and and limits the size to the height and depth of a +%D \type{\strut}. The resulting bottom||alligned box can be used +%D aside other ones, without disturbing the normal baseline +%D distance. +%D +%D \startbuffer +%D \ruledhbox to .5\hsize{\sbox{eerste\par tweede \par derde}} +%D \stopbuffer +%D +%D \typebuffer +%D +%D Shows up as: +%D +%D \startvoorbeeld +%D \vskip3\baselineskip +%D \getbuffer +%D \stopvoorbeeld +%D +%D Before displaying the result we added some skip, otherwise +%D the first two lines would have ended up in the text. This +%D macro can be useful when building complicated menus, headers +%D and footers and|/|or margin material. + +\def\sbox% in handleiding, voorbeeld \inleft{xx} \extern.. + {\normalvbox\bgroup % new ! ! ! + \dowithnextbox + {\setbox\scratchbox\normalhbox + {\strut + \nextboxdp\zeropoint + \lower\strutdepth\flushnextbox}% + \dp\scratchbox\strutdepth + \ht\scratchbox\strutheight + \box\scratchbox + \egroup}% + \normalvbox} + +%D \macros +%D {struttedbox} +%D +%D This boxing macro limits the height and depth to those of +%D a strut. + +\def\struttedbox + {\normalhbox\bgroup % new ! ! ! + \dowithnextbox + {\nextboxdp\strutdepth + \nextboxht\strutheight + \flushnextbox + \egroup}% + \normalhbox} + +%D \macros +%D {topskippedbox} +%D +%D This macro compensates the difference between the topskip +%D and strutheight. Watch how we preserve the depth when it +%D equals strutdepth. + +\def\topskippedbox + {\normalhbox\bgroup + \dowithnextbox + {\edef\next{\ifdim\strutdepth=\nextboxdp\nextboxdp\the\nextboxdp\fi}% + \lower\topskip\normalhbox{\raise\strutheight\flushnextbox}% + \next + \egroup}% + \normalhbox} + +%D \macros +%D {centeredbox, centerednextbox} +%D +%D Here is another strange one. This one offers a sort of overlay +%D with positive or negative offsets. This command can be used +%D in well defined areas where no offset options are available. +%D We first used it when building a button inside the margin +%D footer, where the button should have a horizontal offset and +%D should be centered with respect to the surrounding box. The +%D last of the three examples we show below says: +%D +%D \starttyping +%D \vsize=3cm +%D \hsize=3cm +%D \ruledvbox to \vsize +%D {\centeredbox height .5cm width -1cm +%D {\vrule width \hsize height \vsize}}} +%D \stoptyping +%D +%D Here the \type{\ruledvbox} just shows the surrounding box +%D and \type{\vrule} is used to show the centered box. +%D +%D \def\AnExample#1#2% +%D {\vsize=3cm +%D \hsize=3cm +%D \ruledvbox to \vsize +%D {\centeredbox height #1 width #2 +%D {\color[green]{\vrule width \hsize height \vsize}}}} +%D +%D \startlinecorrection +%D \startcombination[3*1] +%D {\AnExample {-1cm} {.5cm}} {} +%D {\AnExample {.5cm} {-1cm}} {} +%D {\AnExample {-1cm} {-.5cm}} {} +%D \stopcombination +%D \stoplinecorrection +%D +%D This command takes two optional arguments: \type{width} and +%D \type{height}. Observing readers can see that we use \TEX's +%D own scanner for grabbing these arguments: \type{#1#} reads +%D everyting till the next brace and passes it to both rules. +%D The setting of the box dimensions at the end is needed for +%D special cases. The dimensions of the surrounding box are kept +%D intact. This commands handles positive and negative +%D dimensions (which is why we need two boxes with rules). + +\def\centeredbox#1#% height +/-dimen width +/-dimen + {\bgroup + \setbox0\normalvbox to \vsize + \bgroup + \dontcomplain + \forgetall + \setbox0\normalhbox{\vrule\!!width \zeropoint#1}% + \setbox2\normalvbox{\hrule\!!height\zeropoint#1}% + \advance\vsize \ht2 + \advance\hsize \wd0 + \normalvbox to \vsize + \bgroup + \vskip-\ht2 + \vss + \normalhbox to \hsize + \bgroup + \dowithnextbox + {\hskip-\wd0 + \hss + \flushnextbox + \hss + \egroup + \vss + \egroup + \egroup + \wd0\hsize + \ht0\vsize + \box0 + \egroup} + \normalhbox} + +%D For those who don't want to deal with \type {\hsize} +%D and \type {\vsize}, we have: +%D +%D \starttyping +%D \centerednextbox width 2bp height 2bp +%D {\framed[width=100bp,height=100bp]{}} +%D \stoptyping +%D +%D Do you see what we call this one \type {next}? + +\def\centerednextbox#1#% + {\bgroup + \dowithnextbox + {\hsize\nextboxwd + \vsize\nextboxht + \centeredbox#1{\flushnextbox}% + \egroup} + \normalhbox} + +%D \macros +%D {centerbox} +%D +%D Centering on the available space is done by: +%D +%D \starttyping +%D \centerbox {content} +%D \stoptyping +%D +%D When omitted, the current \type {\hsize} and \type +%D {\vsize} are used. Local dimensions are supported. + +\long\def\centerbox#1#% optional height +/-dimen width +/-dimen + {\bgroup + \dowithnextbox + {\setlocalhsize + \setbox\scratchbox\normalhbox{\vrule\!!width \zeropoint#1}% + \ifzeropt\wd\scratchbox\else\hsize\wd\scratchbox\fi + \setbox\scratchbox\normalvbox{\hrule\!!height\zeropoint#1}% + \ifzeropt\ht\scratchbox\else\vsize\ht\scratchbox\fi + \normalvbox to \vsize{\vss\normalhbox to \hsize{\hss\flushnextbox\hss}\vss}% + \egroup}% + \normalhbox} + +%D \macros +%D {setrigidcolumnhsize,rigidcolumnbalance,rigidcolumnlines} +%D +%D These macros are copied from the \TEX book, page~397, and +%D extended by a macro that sets the \type{\hsize}. +%D +%D \starttyping +%D \setrigidcolumnhsize {total width} {distance} {n} +%D \rigidcolumnbalance {box} +%D \stoptyping +%D +%D Both these macros are for instance used in typesetting +%D footnotes. +%D +%D Men kan het proces van breken enigzins beinvloeden met de +%D volgende twee switches: + +\newif\ifalignrigidcolumns +\newif\ifstretchrigidcolumns +\newif\iftightrigidcolumns % if true: just a vbox, no depth/noflines/gridsnap corrrections + +%D De eerste switch bepaald het uitlijnen, de tweede rekt de +%D individuele kolommen op naar \type{\vsize}. + +\def\setrigidcolumnhsize#1#2#3% todo: \dimexpr + {\xdef\savedrigidhsize{\the\hsize}% + \hsize#1\relax + \global\chardef\rigidcolumns#3\relax + \scratchdimen -#2\relax + \multiply\scratchdimen #3\relax + \advance\scratchdimen #2\relax + \advance\hsize \scratchdimen + \divide\hsize #3\relax} + +% == +% +% \def\setrigidcolumnhsize#1#2#3% +% {\xdef\savedrigidhsize{\the\hsize}% +% \global\chardef\rigidcolumns#3\relax +% \hsize=\dimexpr(#1-\numexpr#3-1\relax\dimexpr#2\relax)/#3\relax} + +\newbox\rigidcolumnbox + +\let\rigidcolumnlines\!!zerocount + +\def\rigidcolumnbalance#1% + {\ifnum\rigidcolumns=1 % tzt ook h/d correctie + \ifinner\ifhmode\box\else\unvbox\fi\else\unvbox\fi#1\relax + \else + \normalvbox + {\forgetall + \nopenalties + \dontcomplain + \setbox\rigidcolumnbox\normalvbox + {\line{}\goodbreak\unvbox#1\removebottomthings}% + \splittopskip\openstrutheight + \setbox\scratchbox\vsplit\rigidcolumnbox to \zeropoint + \ifcase\rigidcolumnlines\relax + % \iffalse + % % maybe some day an option + % \scratchskip\ht\rigidcolumnbox + % \advance\scratchskip\dp\rigidcolumnbox + % \getnoflines\scratchskip + % \ifodd\noflines + % \advance\noflines\plusone + % \fi + % \divide\noflines\rigidcolumns + %\else + \scratchdimen\ht\rigidcolumnbox + \divide\scratchdimen \rigidcolumns + \getnoflines\scratchdimen + %\fi + \else + \noflines\rigidcolumnlines % to be sure + \fi + \scratchdimen\noflines\lineheight + % new: we now loop so that we don't loose content + % since in practice we also use this macro for + % funny lineheights and border cases + \setbox0=\box\rigidcolumnbox + \doloop + {\setbox\rigidcolumnbox=\copy0 + \setbox\scratchbox\normalhbox to \savedrigidhsize + {\dorecurse\rigidcolumns + {\setbox\scratchbox\vsplit\rigidcolumnbox to \scratchdimen + \dp\scratchbox\openstrutdepth + \setbox\scratchbox\normalvtop + \ifalignrigidcolumns to + \ifstretchrigidcolumns\vsize\else\scratchdimen\fi + \fi + {\unvbox\scratchbox}% + \wd\scratchbox\hsize + \box\scratchbox + \hfill}% + \hfillneg}% + \ifvoid\rigidcolumnbox\exitloop\else\advance\scratchdimen\lineheight\fi}% + \iftightrigidcolumns + \setbox\scratchbox\normalhbox{\raise\dp\scratchbox\box\scratchbox}% + \else + \advance\scratchdimen -\openstrutdepth + \setbox\scratchbox\normalhbox{\raise\scratchdimen\box\scratchbox}% + \dp\scratchbox\openstrutdepth + \ht\scratchbox\scratchdimen + \fi + \box\scratchbox}% + \fi} + +%D \macros +%D {startvboxtohbox,stopvboxtohbox,convertvboxtohbox} +%D +%D Here is another of Knuth's dirty tricks, as presented on +%D pages 398 and 399 of the \TEX book. These macros can be used +%D like: +%D +%D \starttyping +%D \normalvbox +%D \bgroup +%D \startvboxtohbox ... \stopvboxtohbox +%D \startvboxtohbox ... \stopvboxtohbox +%D \startvboxtohbox ... \stopvboxtohbox +%D \egroup +%D +%D \normalvbox +%D \bgroup +%D \convertvboxtohbox +%D \egroup +%D \stoptyping +%D +%D These macros are used in reformatting footnotes, so they do +%D what they're meant for. + +\def\setvboxtohbox + {\bgroup + \ifdim\baselineskip<16pt \relax + \scratchdimen\baselineskip + \multiply\scratchdimen 1024 + \else + \message{cropping \baselineskip to 16pt}% + \scratchdimen\maxdimen + \fi + \divide\scratchdimen \hsize + \multiply\scratchdimen 64 + \xdef\normalvboxtohboxfactor{\withoutpt\the\scratchdimen}% + \egroup} + +\def\startvboxtohbox + {\bgroup + \setvboxtohbox + \setbox\scratchbox\normalhbox\bgroup} + +\def\stopvboxtohbox + {\egroup + \dp\scratchbox\zeropoint + \ht\scratchbox\normalvboxtohboxfactor\wd\scratchbox + \box\scratchbox + \egroup} + +\def\convertvboxtohbox + {\setvboxtohbox + \makehboxofhboxes + \setbox0\normalhbox{\unhbox0 \removehboxes}% + \noindent\unhbox0\par} + +\def\makehboxofhboxes + {\setbox0\emptyhbox + \loop % \doloop { .. \exitloop .. } + \setbox2\lastbox + \ifhbox2 + \setbox0\normalhbox{\box2\unhbox0}% + \repeat} + +\def\removehboxes + {\setbox0\lastbox + \ifhbox0 + {\removehboxes}\unhbox0 + \fi} + +%D \macros +%D {unhhbox} +%D +%D The next macro is used in typesetting inline headings. +%D Let's first look at the macro and then show an example. + +\newbox \unhhedbox +\newbox \hhbox +\newdimen \lasthhboxwidth +\newskip \hhboxindent + +\def\unhhbox#1\with#2% + {\bgroup + \nopenalties + \dontcomplain + \forgetall + \setbox\unhhedbox\normalvbox{\hskip\hhboxindent\strut\unhbox#1}% => \hsize + \doloop + {\setbox\hhbox\vsplit\unhhedbox to \lineheight + \ifvoid\unhhedbox + \setbox\hhbox\normalhbox{\strut\normalhboxofvbox\hhbox}% + \fi + \ht\hhbox\strutht + \dp\hhbox\strutdp + \ifzeropt\hhboxindent\else % \ifdim\hhboxindent=\zeropoint\else + \setbox\hhbox\normalhbox{\hskip-\hhboxindent\box\hhbox}% + \hhboxindent\zeropoint + \fi + \global\lasthhboxwidth\wd\hhbox + #2\relax + \ifvoid\unhhedbox + \exitloop + \else + \hskip\zeropoint \!!plus \zeropoint + \fi}% + \egroup} + +\def\dohboxofvbox + {\setbox0\normalvbox{\unvbox\scratchcounter\global\setbox1\lastbox}% + \unhbox1 + \egroup} + +\def\normalhboxofvbox + {\bgroup + \afterassignment\dohboxofvbox + \scratchcounter=} + +%D This macro can be used to break a paragraph apart and treat +%D each line seperately, for instance, making it clickable. The +%D main complication is that we want to be able to continue the +%D paragraph, something that's needed in the in line section +%D headers. +%D +%D \startbuffer +%D \setbox0=\normalhbox{\input tufte \relax} +%D \setbox2=\normalhbox{\input knuth \relax} +%D \unhhbox0\with{\ruledhbox{\box\hhbox}} +%D \hskip1em plus 1em minus 1em +%D \hhboxindent=\lasthhboxwidth +%D \advance\hhboxindent by \lastskip +%D \unhhbox2\with{\ruledhbox{\box\hhbox}} +%D \stopbuffer +%D +%D \getbuffer +%D +%D This piece of text was typeset by saying: +%D +%D \typebuffer +%D +%D Not that nice a definition, but effective. Note the stretch +%D we've build in the line that connects the two paragraphs. + +%D \macros +%D {doifcontent} +%D +%D When processing depends on the availability of content, one +%D can give the next macro a try. +%D +%D \starttyping +%D \doifcontent{pre content}{post content}{no content}\somebox +%D \stoptyping +%D +%D Where \type{\somebox} is either a \type{\normalhbox} or +%D \type{\normalvbox}. If the dimension of this box suggest some +%D content, the resulting box is unboxed and surrounded by the +%D first two arguments, else the third arguments is executed. + +\unexpanded\def\doifcontent#1#2#3% + {\dowithnextbox + {\ifhbox\nextbox + \ifdim\nextboxwd>\zeropoint + #1\unhbox\nextbox#2\relax + \else + #3\relax + \fi + \else + \ifdim\nextboxht>\zeropoint + #1\unvbox\nextbox#2\relax + \else + #3\relax + \fi + \fi}} + +%D So when we say: +%D +%D \startbuffer +%D \doifcontent{[}{]}{}\normalhbox{content sensitive typesetting} +%D +%D \doifcontent{}{\page}{}\normalvbox{content sensitive typesetting} +%D +%D \doifcontent{}{}{\message{Didn't you forget something?}}\normalhbox{} +%D \stopbuffer +%D +%D \typebuffer +%D +%D We get: +%D +%D \getbuffer +%D +%D Where the last call of course does not show up in this +%D document, but definitely generates a confusing message. + +%D \macros +%D {processboxes} +%D +%D The next macro gobble boxes and is for instance used for +%D overlays. First we show the general handler. + +\newbox\processbox + +\def\processboxes#1% + {\bgroup + \def\doprocessbox{#1}% #1 can be redefined halfway + \setbox\processbox\emptybox + \afterassignment\dogetprocessbox\let\next=} + +\def\endprocessboxes + {\ifhmode\unskip\fi + \box\processbox + \next + \egroup} + +\def\dogetprocessbox + {\ifx\next\bgroup + \expandafter\dodogetprocessbox + \else + \expandafter\endprocessboxes + \fi} + +\def\dodogetprocessbox + {\dowithnextbox + {\ifhmode\unskip\fi\doprocessbox % takes \nextbox makes \processbox + \afterassignment\dogetprocessbox\let\next=} + \normalhbox\bgroup} + +%D \macros +%D {startoverlay} +%D +%D We can overlay boxes by saying: +%D +%D \startbuffer +%D \startoverlay +%D {\framed{hans}} +%D {\framed[width=3cm]{ton}} +%D {\framed[height=2cm]{oeps}} +%D \stopoverlay +%D \stopbuffer +%D +%D \typebuffer +%D +%D shows up as: +%D +%D \leavevmode\getbuffer + +\def\dooverlaybox + {\ifhmode\unskip\fi + \scratchdimen\dp + \ifdim\nextboxdp>\dp\processbox + \nextbox + \else + \processbox + \fi + \ifdim\nextboxht>\ht\processbox + \setbox\processbox\normalvbox to \nextboxht + {\dp\processbox\zeropoint\vss\box\processbox\vss}% + \else + \setbox\nextbox\normalvbox to \ht\processbox + {\nextboxdp\zeropoint\vss\flushnextbox\vss}% + \fi + \nextboxdp\scratchdimen + \dp\processbox\scratchdimen + \scratchdimen\wd + \ifdim\nextboxwd>\wd\processbox + \nextbox + \else + \processbox + \fi + \setbox\processbox\normalhbox to \scratchdimen + {\normalhbox to \scratchdimen{\hss\box\processbox\hss}% + \hskip-\scratchdimen + \normalhbox to \scratchdimen{\hss\flushnextbox\hss}}} + +\unexpanded\def\startoverlay + {\bgroup + \let\stopoverlay\egroup + \processboxes\dooverlaybox} + +\let\stopoverlay\relax + +%D \macros +%D {fakebox} +%D +%D The next macro is a rather silly one, but saves space. +%D +%D \starttyping +%D \normalhbox{\fakebox0} +%D \stoptyping +%D +%D returns an empty box with the dimensions of the box +%D specified, here being zero. + +\def\dofakebox + {\setbox\scratchbox\emptyhbox + \wd\scratchbox\wd\scratchcounter + \ht\scratchbox\ht\scratchcounter + \dp\scratchbox\dp\scratchcounter + \ifhbox\scratchcounter\normalhbox\else\normalvbox\fi{\box\scratchbox}% + \egroup} + +\def\fakebox + {\bgroup + \afterassignment\dofakebox\scratchcounter} + +%D \macros +%D {lbox,rbox,cbox,tbox,bbox} +%D +%D Here are some convenient alternative box types: +%D +%D \starttyping +%D \lbox{text ...} +%D \cbox{text ...} +%D \rbox{text ...} +%D \stoptyping +%D +%D Are similar to \type {\normalvbox}, which means that they also +%D accept something like \type{to 3cm}, but align to the left, +%D middle and right. These box types can be used to typeset +%D paragraphs. + +\def\lbox{\makelrcbox\normalvbox\raggedleft} +\def\cbox{\makelrcbox\normalvbox\raggedcenter} +\def\rbox{\makelrcbox\normalvbox\raggedright} + +\def\ltop{\makelrcbox\normalvtop\raggedleft} +\def\ctop{\makelrcbox\normalvtop\raggedcenter} +\def\rtop{\makelrcbox\normalvtop\raggedright} + +\def\makelrcbox#1#2#3#% + {#1#3\bgroup \forgetall \let\\=\endgraf #2\let\next=} + +%D The alternatives \type {\tbox} and \type {\bbox} can be used +%D to properly align boxes, like in: +%D +%D \setupexternalfigures[directory={../sample}] +%D \startbuffer +%D \starttable[|||] +%D \HL +%D \VL \tbox{\externalfigure[cow][height=3cm,frame=on]} \VL top aligned \VL\SR +%D \HL +%D \VL \bbox{\externalfigure[cow][height=3cm,frame=on]} \VL bottom aligned \VL\SR +%D \HL +%D \stoptable +%D \stopbuffer +%D +%D \typebuffer +%D +%D The positioning depends on the strut settings: +%D +%D \getbuffer + +\def\tbox{\tbbox\ht\dp} +\def\bbox{\tbbox\dp\ht} + +\def\tbbox#1#2% + {\normalhbox\bgroup + \dowithnextbox + {\scratchdimen\dimexpr\nextboxht+\nextboxdp-#1\strutbox\relax + #1\nextbox#1\strutbox + #2\nextbox\scratchdimen + \setbox\nextbox\normalhbox{\lower\nextboxdp\flushnextbox}% + #1\nextbox#1\strutbox + #2\nextbox\scratchdimen + \flushnextbox + \egroup} + \normalhbox} + +%D \macros +%D {lhbox,mhbox,rhbox} +%D +%D A few more boxes. + +\def\dodolhbox{\normalhbox to \hsize{\flushnextbox\hss }} +\def\dodomhbox{\normalhbox to \hsize{\hss\flushnextbox\hss}} +\def\dodorhbox{\normalhbox to \hsize{\hss\flushnextbox }} + +\def\lhbox{\dowithnextboxcs\dodolhbox\normalhbox} +\def\mhbox{\dowithnextboxcs\dodomhbox\normalhbox} +\def\rhbox{\dowithnextboxcs\dodorhbox\normalhbox} + +\let\lefthbox \lhbox +\let\midhbox \mhbox +\let\righthbox\rhbox + +%D \macros +%D {boxofsize} +%D +%D Sometimes we need to construct a box with a height or +%D width made up of several dimensions. Instead of cumbersome +%D additions, we can use: +%D +%D \starttyping +%D \boxofsize \normalvbox 10cm 3cm -5cm {the text to be typeset} +%D \stoptyping +%D +%D This example demonstrates that one can use positive and +%D negative values. Dimension registers are also accepted. + +\newdimen\sizeofbox + +\def\boxofsize#1% + {\bgroup + \sizeofbox\zeropoint + \scratchdimen\zeropoint + \def\docommand + {\advance\sizeofbox\scratchdimen + \futurelet\next\dodocommand}% + \def\dodocommand + {\ifx\next\bgroup + \expanded{\egroup#1 to \the\sizeofbox}% + \else + \@EA\afterassignment\@EA\docommand\@EA\scratchdimen + \fi}% + \docommand} + +%D Some new, still undocumented features: + +% limitatetext -> beter {text} als laatste !! +% +% \limitvbox +% \limithbox + +\def\limitatelines#1#2% size sentinel + {\dowithnextbox + {\dimen0=#1\hsize + \ifdim\nextboxwd>\dimen0 + \setbox\nextbox\normalhbox + {\advance\dimen0 -.1\hsize + \limitatetext{\unhbox\nextbox}{\dimen0}{\nobreak#2}}% + \fi + \unhbox\nextbox} + \normalhbox} + +\def\fittoptobaselinegrid % weg hier + {\dowithnextbox + {\bgroup + \par + \dimen0\nextboxht + \nextboxht\strutht + \nextboxdp\strutdp + \normalhbox{\flushnextbox} + \prevdepth\strutdp + \doloop + {\advance\dimen0 -\lineheight + \ifdim\dimen0<\zeropoint + \exitloop + \else + \nobreak + \normalhbox{\strut} + \fi} + \egroup} + \normalvbox} + +%D Some more undocumented macros (used in m-chart). + +\newif\iftraceboxplacement % \traceboxplacementtrue + +\newbox\fakedboxcursor + +\setbox\fakedboxcursor\normalhbox + {\vrule\!!width\zeropoint\!!height\zeropoint\!!depth\zeropoint} + +\def\boxcursor % overloaded in core-vis + {\iftraceboxplacement + \bgroup + \scratchdimen2pt + \setbox\scratchbox\normalhbox to \zeropoint + {\hss + \vrule + \!!width \scratchdimen + \!!height\scratchdimen + \!!depth \scratchdimen + \hss}% + \smashedbox\scratchbox + \egroup + \else + \copy\fakedboxcursor + \fi} + +\def\placedbox + {\iftraceboxplacement\ruledhbox\else\normalhbox\fi} + +\newdimen\boxoffset +\newdimen\boxhdisplacement +\newdimen\boxvdisplacement + +\def\rightbox#1% + {\normalhbox + {\setbox\scratchbox\placedbox{#1}% + \global\boxhdisplacement\boxoffset + \global\boxvdisplacement.5\ht\scratchbox + \global\advance\boxvdisplacement-.5\dp\scratchbox + \boxcursor\hskip\boxhdisplacement\lower\boxvdisplacement\box\scratchbox}} + +\def\leftbox#1% + {\normalhbox + {\setbox\scratchbox\placedbox{#1}% + \global\boxhdisplacement-\wd\scratchbox + \global\advance\boxhdisplacement-\boxoffset + \global\boxvdisplacement.5\ht\scratchbox + \global\advance\boxvdisplacement-.5\dp\scratchbox + \boxcursor\hskip\boxhdisplacement\lower\boxvdisplacement\box\scratchbox}} + +\def\topbox#1% + {\normalhbox + {\setbox\scratchbox\placedbox{#1}% + \global\boxhdisplacement-.5\wd\scratchbox + \global\boxvdisplacement-\dp\scratchbox + \global\advance\boxvdisplacement-\boxoffset + \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box\scratchbox}} + +\def\bottombox#1% + {\normalhbox + {\setbox\scratchbox\placedbox{#1}% + \global\boxhdisplacement-.5\wd\scratchbox + \global\boxvdisplacement\ht\scratchbox + \global\advance\boxvdisplacement\boxoffset + \boxcursor\hskip\boxhdisplacement\lower\boxvdisplacement\box\scratchbox}} + +\def\lefttopbox#1% + {\normalhbox + {\setbox\scratchbox\placedbox{#1}% + \global\boxhdisplacement-\wd\scratchbox + \global\advance\boxhdisplacement-\boxoffset + \global\boxvdisplacement-\dp\scratchbox + \global\advance\boxvdisplacement-\boxoffset + \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box\scratchbox}} + +\def\righttopbox#1% + {\normalhbox + {\setbox\scratchbox\placedbox{#1}% + \global\boxhdisplacement\boxoffset + \global\boxvdisplacement-\dp\scratchbox + \global\advance\boxvdisplacement-\boxoffset + \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box\scratchbox}} + +\def\leftbottombox#1% + {\normalhbox + {\setbox\scratchbox\placedbox{#1}% + \global\boxhdisplacement-\wd\scratchbox + \global\advance\boxhdisplacement-\boxoffset + \global\boxvdisplacement\ht\scratchbox + \global\advance\boxvdisplacement\boxoffset + \boxcursor\hskip\boxhdisplacement\lower\boxvdisplacement\box\scratchbox}} + +\def\rightbottombox#1% + {\normalhbox + {\setbox\scratchbox\placedbox{#1}% + \global\boxhdisplacement\boxoffset + \global\boxvdisplacement\ht\scratchbox + \global\advance\boxvdisplacement\boxoffset + \boxcursor\hskip\boxhdisplacement\lower\boxvdisplacement\box\scratchbox}} + +\let\topleftbox \lefttopbox +\let\toprightbox \righttopbox +\let\bottomleftbox \leftbottombox +\let\bottomrightbox\rightbottombox + +\def\middlebox#1% + {\normalhbox{\setbox\scratchbox\placedbox{#1}\boxoffset=-.5\wd\scratchbox\rightbox{\box\scratchbox}}} + +\def\baselinemiddlebox#1% + {\normalhbox + {\setbox\scratchbox\placedbox{#1}% + \global\boxhdisplacement-.5\wd\scratchbox + \global\advance\boxhdisplacement-\boxoffset + \global\boxvdisplacement-\boxoffset + \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box\scratchbox}} + +\def\baselineleftbox#1% + {\normalhbox + {\setbox\scratchbox\placedbox{#1}% + \global\boxhdisplacement-\wd\scratchbox + \global\advance\boxhdisplacement-\boxoffset + \global\boxvdisplacement-\boxoffset + \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box\scratchbox}} + +\def\baselinerightbox#1% + {\normalhbox + {\setbox\scratchbox\placedbox{#1}% + \global\boxhdisplacement\boxoffset + \global\boxvdisplacement-\boxoffset + \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box\scratchbox}} + +%D \macros +%D {obox} +%D +%D Experimental, not yet frozen: + +\def\lrtbbox#1#2#3#4% l r t b + {\bgroup + \dowithnextboxcontent + {\advance\hsize-#1\advance\hsize-#2\advance\vsize-#3\advance\vsize-#4\relax} + {\forgetall\vbox to \vsize{\vskip#3\hbox to \hsize{\hskip#1\box\nextbox\hss}\vss}\egroup} + \vbox} + +%D \macros +%D {toplinebox} +%D +%D See core-tbl.tex for an example of its usage: + +\def\toplinebox + {\dowithnextbox + {\ifdim\nextboxdp>\strutdepth + \scratchdimen\nextboxdp + \advance\scratchdimen-\strutdepth + \getnoflines\scratchdimen + \struttedbox{\flushnextbox}% + \dorecurse\noflines\verticalstrut + \else + \flushnextbox + \fi}% + \tbox} + +%D \macros +%D {initializeboxstack,savebox,foundbox} +%D +%D At the cost of some memory, but saving box registers, we +%D have implemented a box repository. +%D +%D \starttyping +%D \initializeboxstack{one} +%D +%D \savebox{one}{a}{test a} +%D \savebox{one}{p}{test p} +%D \savebox{one}{q}{test q} +%D +%D \normalhbox{a:\foundbox{one}{a}} \par +%D \normalhbox{q:\foundbox{one}{q}} \par +%D \normalhbox{p:\foundbox{one}{p}} \par +%D \normalhbox{x:\foundbox{one}{x}} \par +%D \normalhbox{y:\foundbox{two}{a}} \par +%D \stoptyping + +\def\@@stackbox{@box@} +\def\@@stacklst{@xob@} + +\def\setstackbox#1#2% + {\ifcsname\@@stackbox:#1:#2\endcsname\else + \expandafter\newbox\csname\@@stackbox:#1:#2\endcsname + \fi + \global\setbox\csname\@@stackbox:#1:#2\endcsname\normalvbox} + +\def\initializeboxstack#1% + {\def\docommand##1{\setstackbox{#1}{##1}{}}% + \ifcsname\@@stacklst#1\endcsname + \processcommacommand[\getvalue{\@@stacklst#1}]\docommand + \fi + \letgvalueempty{\@@stacklst#1}} + +\def\savebox#1#2% stack name + {% beware, \setxvalue defines the cs beforehand so we cannot use the + % test inside the { } + \ifcsname\@@stacklst#1\endcsname + \setxvalue{\@@stacklst#1}{\csname\@@stacklst#1\endcsname,#2}% + \else + \setxvalue{\@@stacklst#1}{#2}% + \fi + \setstackbox{#1}{#2}} + +\def\foundbox#1#2% + {\normalvbox + {\ifcsname\@@stackbox:#1:#2\endcsname + \copy\csname\@@stackbox:#1:#2\endcsname + \fi}} + +\long\def\doifboxelse#1#2#3#4% + {\ifcsname\@@stackbox:#1:#2\endcsname + \ifvoid\csname\@@stackbox:#1:#2\endcsname#4\else#3\fi + \else + #4% + \fi} + +%D \macros +%D {removedepth, obeydepth} +%D +%D While \type {\removedepth} removes the preceding depth, +%D \type {\obeydepth} makes sure we have depth. Both macros +%D leave the \type {\prevdepth} untouched. + +\def\removedepth + {\ifvmode \ifdim\prevdepth>\zeropoint \kern-\prevdepth \fi \fi} + +\def\obeydepth + {\par \removedepth \ifvmode \kern\strutdp \fi} + +\def\undepthed + {\dowithnextbox{\nextboxdp\zeropoint\flushnextbox}\hbox} + +%D \macros +%D {removebottomthings, removelastskip} +%D +%D A funny (but rather stupid) one, plus a redefinition. + +\def\removebottomthings + {\dorecurse5{\unskip\unkern\unpenalty}} + +\def\removelastskip % \ifvmode the plain tex one \fi +% {\ifvmode\ifdim\lastskip=\zeropoint\else\vskip-\lastskip\fi\fi} + {\ifvmode\ifzeropt\lastskip\else\vskip-\lastskip\fi\fi} + +%D \macros +%D {makestrutofbox} +%D +%D This macro sets the dimensions of a box to those of a +%D strut. + +\def\domakestrutofbox + {\ht\registercount\strutht + \dp\registercount\strutdp + \wd\registercount\zeropoint} + +\def\makestrutofbox + {\afterassignment\domakestrutofbox\registercount} + +%D \macros +%D {raisebox,lowerbox} +%D +%D Some more box stuff, related to positioning (under +%D construction). Nice stuff for a tips and tricks maps +%D article. +%D +%D \starttyping +%D \raisebox{100pt}\normalhbox{test} +%D \raisebox50pt\normalhbox{test} +%D \hsmash{\raisebox{100pt}\normalhbox{test}} +%D \stoptyping + +\def\doraiselowerbox#1#2% a nice trick us used to accept + {\def\next % both direct and {} dimensions + {\dowithnextbox + {\setbox\nextbox\normalhbox{#1\scratchdimen\flushnextbox}% + \nextboxht\strutht + \nextboxdp\strutdp + \flushnextbox}}% + \afterassignment\next\scratchdimen=#2} + +\def\raisebox{\doraiselowerbox\raise} +\def\lowerbox{\doraiselowerbox\lower} + +% vcenter in text, we kunnen vcenter overloaden + +\def\halfwaybox + {\dowithnextbox + {\nextboxdp\zeropoint + \setbox\nextbox\normalhbox{\lower.5\nextboxht\flushnextbox}% + \flushnextbox} + \normalhbox} + +%D New: + +\def\setdimentoatleast#1#2% + {\ifdim#1>\zeropoint\else#1=#2\fi} + +%D And even rawer: + +\let\naturalhbox \normalhbox +\let\naturalvbox \normalvbox +\let\naturalvtop \normalvtop +\let\naturalvcenter \normalvtop + +\ifdefined\textdir + + \def\naturalhbox{\normalhbox dir TLT} + \def\naturalvbox{\normalvbox dir TLT} + %def\naturalvtop{\normalvtop dir TLT} + +\fi + +%D \macros +%D {vcenter} +%D +%D Also new: tex mode \type {\vcenter}. + +\let\verynormalvcenter \vcenter % since \vcenter can be visualized + +\def\vcenter + {\normalvbox\bgroup + \dowithnextbox{\normalhbox{$\verynormalvcenter{\flushnextbox}$}\egroup} + \normalvbox} + +% could be \everymathematics + +\prependtoks \let\vcenter\normalvcenter \to \everymath +\prependtoks \let\vcenter\normalvcenter \to \everydisplay + +%D \macros +%D {frozenhbox} +%D +%D A not so well unhboxable bxo can be made with: + +\def\frozenhbox + {\hbox\bgroup\dowithnextbox{\hbox{\hbox{\flushnextbox}}\egroup}\hbox} + +%D \macros +%D {setboxllx,setboxlly,gsetboxllx,gsetboxlly,getboxllx,getboxlly} +%D +%D A prelude to an extended \TEX: + +\def\setboxllx#1#2{\setevalue{b@@x\number#1}{\the\dimexpr#2\relax}} +\def\setboxlly#1#2{\setevalue{b@@y\number#1}{\the\dimexpr#2\relax}} + +\def\gsetboxllx{\global\setboxllx} +\def\gsetboxlly{\global\setboxlly} + +\def\getboxllx#1{\executeifdefined{b@@x\number#1}\zeropoint} +\def\getboxlly#1{\executeifdefined{b@@y\number#1}\zeropoint} + +%D \macros +%D {shownextbox} +%D +%D Handy for tracing +%D +%D \starttyping +%D \shownextbox\vbox{test} +%D \shownextbox\vbox{test\endgraf} +%D \shownextbox\vbox{test\endgraf\strut\endgraf} +%D \shownextbox\vbox{test\endgraf\thinrule} +%D \shownextbox\vbox{\setupwhitespace[big]test\endgraf\thinrule} +%D \stoptyping + +\def\shownextbox + {\dowithnextbox + {\bgroup + \showboxbreadth\maxdimen + \showboxdepth \maxdimen + \scratchcounter\interactionmode + \batchmode + \showbox\nextbox + \box\nextbox + \interactionmode\scratchcounter + \egroup}} + +\def\spreadhbox#1% rebuilds \hbox{} + {\bgroup + \ifhbox#1\relax + \setbox2\emptybox + \unhbox#1% + \doloop + {\unpenalty\unskip\unpenalty\unskip\unpenalty\unskip + \setbox0\lastbox + \ifvoid0 + \exitloop + \else + \setbox2\hbox + {\ifhbox0 \spreadhbox0\else\box0\fi + \ifvoid2 \else\hss\unhbox2\fi}% + \fi}% + \ifvoid2\else\unhbox2\fi + \else + \box#1% + \fi + \egroup} + +% makes sense but too much log for overfull boxes: +% +% \showboxbreadth\maxdimen +% \showboxdepth \maxdimen + +\protect \endinput + +% a bit of test code: + +\hbox \bgroup + \ruledvbox {\hbox{\strut gans}} + \ruledvbox to \lineheight {\hbox{\strut gans}} + \ruledvbox to \lineheight {\hbox {gans}} + \ruledvbox to \strutheight{\hbox {gans}} + \ruledvbox to \strutheight{\hbox{\strut gans}} + \ruledvbox to \strutheight{\vss\hbox{gans}} +\egroup diff --git a/Master/texmf-dist/tex/context/base/supp-box.tex b/Master/texmf-dist/tex/context/base/supp-box.tex deleted file mode 100644 index 4c398973ee3..00000000000 --- a/Master/texmf-dist/tex/context/base/supp-box.tex +++ /dev/null @@ -1,3126 +0,0 @@ -%D \module -%D [ file=supp-box, -%D version=1995.10.10, -%D title=\CONTEXT\ Support Macros, -%D subtitle=Boxes, -%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 some box manipulation macros. Some -%D are quite simple, some are more advanced and when understood -%D well, all can be of use. - -%D No longer generic, why bother. - -\writestatus{loading}{ConTeXt Support Macros / Boxes} - -\unprotect - -%D \macros -%D {strutdp,strutht,strutwd} -%D -%D The next shortcuts save memory and keying. The width is -%D normally zero points (if not, you're in trouble). These -%D shortcuts can be used like a dimension, opposite to the -%D core macros \type {\strutdepth} and alike, which are -%D values. - -\def\strutdp{\dp\strutbox} -\def\strutht{\ht\strutbox} -\def\strutwd{\wd\strutbox} - -%D \macros -%D {resetbox, emptybox} -%D -%D Let's start with an easy one. The next macro hides the -%D ugly \type {@} in \type {\voidb@x}. - -\ifx\voidbox\undefined \newbox\voidbox \fi -\ifx\voidb@x\undefined \let\voidb@x\voidbox \fi - -\def\emptybox {\box \voidbox} -\def\unvoidbox {\unhbox\voidbox} -\def\resetbox#1{\setbox#1\box\voidbox} - -%D \macros -%D {nextdepth} -%D -%D Let's start with a rather simple declaration. Sometimes we -%D need to save the \TEX\ \DIMENSION\ \type{\prevdepth} and -%D append it later on. The name \type{\nextdepth} suits -%D this purpose well. - -\newdimen\nextdepth - -%D \macros -%D {smashbox, smashedbox} -%D -%D Smashing is introduced in \PLAIN\ \TEX, and stands for -%D reducing the dimensions of a box to zero. The most resolute -%D one is presented first. - -\def\smashbox#1% - {\wd#1\zeropoint - \ht#1\zeropoint - \dp#1\zeropoint} - -\def\smashboxed#1% - {\smashbox{#1}% - \box#1\relax} - -%D \macros -%D {hsmashbox,vsmashbox} -%D -%D Smashing can be used for overlaying boxes. Depending on -%D the mode, horizontal or vertical, one can use: - -\def\hsmashbox#1% - {\wd#1\zeropoint} - -\def\vsmashbox#1% - {\ht#1\zeropoint - \dp#1\zeropoint} - -%D The next implementation is less sensitive for spurious -%D spaces. - -\newcount\registercount - -\def\smashbox - {\afterassignment\dosmashbox\registercount} - -\def\dosmashbox - {\wd\registercount\zeropoint - \ht\registercount\zeropoint - \dp\registercount\zeropoint} - -\def\smashedbox - {\afterassignment\thesmashedbox\registercount} - -\def\thesmashedbox - {\dosmashbox - \box\registercount} - -\def\hsmashbox - {\afterassignment\dohsmashbox\registercount} - -\def\dohsmashbox - {\wd\registercount\zeropoint} - -\def\vsmashbox - {\afterassignment\dovsmashbox\registercount} - -\def\dovsmashbox - {\ht\registercount\zeropoint - \dp\registercount\zeropoint} - -%D \macros -%D {hsmash,vsmash, -%D hsmashed,vsmashed} -%D -%D While the previous macros expected a \BOX, the next act on a -%D content. They are some subtle differences betreen the smash -%D and smashed alternatives. The later ones reduce all -%D dimensions to zero. - -% Ok, but inefficient and/or catcode unsafe: -% -% \def\hsmash #1{\bgroup\setbox0=\normalhbox{#1}\hsmashbox0\box0\egroup} -% \def\vsmash #1{\bgroup\setbox0=\normalvbox{#1}\vsmashbox0\box0\egroup} -% \def\hsmashed#1{\bgroup\setbox0=\normalhbox{#1}\smashbox 0\box0\egroup} -% \def\vsmashed#1{\bgroup\setbox0=\normalvbox{#1}\smashbox 0\box0\egroup} -% -% Better, but a waste of tokens: -% -% \def\hsmash {\bgroup\dowithnextbox{\hsmashbox\nextbox\flushnextbox\egroup}\normalhbox} -% \def\vsmash {\bgroup\dowithnextbox{\vsmashbox\nextbox\flushnextbox\nextbox\egroup}\normalvbox} -% \def\hsmashed{\bgroup\dowithnextbox{\smashbox \nextbox\flushnextbox\nextbox\egroup}\normalhbox} -% \def\vsmashed{\bgroup\dowithnextbox{\smashbox \nextbox\flushnextbox\nextbox\egroup}\normalvbox} -% -% The best: - -\def\dosomesmash#1% (begin|end)group ipv (b|e)group ? - {\bgroup\dowithnextbox{#1\nextbox\flushnextbox\egroup}} - -\def\hsmash {\dosomesmash\hsmashbox\normalhbox} -\def\vsmash {\dosomesmash\vsmashbox\normalvbox} -\def\hsmashed{\dosomesmash\smashbox \normalhbox} -\def\vsmashed{\dosomesmash\smashbox \normalvbox} - -%D \macros -%D {smashedhbox,smashedvbox} -%D -%D Also handy (all dimensions zeroed): -%D -%D \starttyping -%D \smashedhbox to ... {...} -%D \smashedvbox to ... {...} -%D \stoptyping - -\def\dosmashedbox#1% - %{#1\bgroup\dowithnextbox{\smashbox\nextbox\flushnextbox\egroup}#1} - {#1\bgroup\dowithnextbox{\smashedbox\nextbox\egroup}#1} - -\def\smashedhbox{\dosmashedbox\hbox} -\def\smashedvbox{\dosmashedbox\vbox} - -%D \macros -%D {smash} -%D -%D This smash alternative takes an optional arg [whdtb] as -%D well as is potentially catcode safer. It is needed by the -%D math module (although the \type {\leavevmode} is not added -%D here). - -\def\smash - {\futurelet\nexttoken\dosmash} - -\def\dosmash - {\ifx\nexttoken[\@EA\dodosmash\else\@EA\donosmash\fi} - -\def\donosmash - {\dodosmash[hd]} - -\def\dodosmash[#1]% - {\edef\@@smash{#1}\futurelet\nexttoken\dododosmash} - -\def\dododosmash % if needed we can avoid the \next - {\ifmmode - \def\next##1{\mathpalette\mathsm@sh{##1}}% - \else\ifx\nexttoken\bgroup - \let\next\finsm@sh - \else - \def\next##1{\finsm@sh{##1}}% - \fi\fi - \next} - -\def\mathsm@sh#1#2% redefined plain macro - {\finsm@sh{$\mathsurround\zeropoint#1{#2}$}} - -\def\makesm@sh#1% redefined plain macro (handles t b h d w) - {\if#1w\nextboxwd\zeropoint\else - \if#1h\nextboxht\zeropoint\else - \if#1d\nextboxdp\zeropoint\else - \if#1t\nextboxht\zeropoint\else - \if#1b\nextboxdp\zeropoint\fi\fi\fi\fi\fi} - -\def\finsm@sh % redefined plain macro - {\dowithnextbox{\@EA\handletokens\@@smash\with\makesm@sh\flushnextbox}\normalhbox} - -%D \starttabulate[|l|l|] -%D \NC w \NC \ruledhbox{\smash [w]{This is some great smashing, isn't it?}} \NC \NR -%D \NC h \NC \ruledhbox{\smash [h]{This is some great smashing, isn't it?}} \NC \NR -%D \NC d \NC \ruledhbox{\smash [d]{This is some great smashing, isn't it?}} \NC \NR -%D \NC tb \NC \ruledhbox{\smash [tb]{This is some great smashing, isn't it?}} \NC \NR -%D \NC whd \NC \ruledhbox{\smash[whd]{This is some great smashing, isn't it?}} \NC \NR -%D \stoptabulate - -%D \macros -%D {phantom, hphantom, vphantom, mathstrut} -%D -%D The next implementation of \type {\phantom} cum suis does -%D not grab an argument in the non||math case, which is better. - -\unexpanded\def\phantom {\ph@nt\nextbox\nextbox\nextbox} -\unexpanded\def\vphantom{\ph@nt\nextbox\nextbox\voidbox} -\unexpanded\def\hphantom{\ph@nt\voidbox\voidbox\nextbox} - -%D Due to a complicated call to \type {\mathpallete} and -%D thereby \type {\mathchoice}, the next macro looks ugly. -%D We also take care of non||braced arguments. - -\def\ph@nt#1#2#3% - {\def\doph@nt - {\ifmmode - \def\mathph@nt####1####2{\makeph@nt#1#2#3{$\mathsurround\zeropoint####1{####2}$}}% - \def\nextph@nt{\mathpalette\mathph@nt}% - \else\ifx\nextph@nt\bgroup - \def\nextph@nt{\makeph@nt#1#2#3}% - \else - \def\nextph@nt####1{\makeph@nt#1#2#3{####1}}% - \fi\fi - \nextph@nt}% - \futurelet\nextph@nt\doph@nt} - -\def\makeph@nt#1#2#3% - {\begingroup - \dowithnextbox - {\setbox\scratchbox\null - \ht\scratchbox\ht#1% - \dp\scratchbox\dp#2% - \wd\scratchbox\wd#3% - \box\scratchbox - \endgroup} - \normalhbox} - -\let\finph@nt\undefined - -%D We also define plain's \type {\mathstrut}. - -\unexpanded\def\mathstrut{\vphantom{(}} - -%D \macros -%D {getboxheight} -%D -%D Although often needed, \TEX\ does not support arithmics -%D like: -%D -%D \starttyping -%D \dimen0 = \ht0 + \dp0 -%D \stoptyping -%D -%D so we implemented: -%D -%D \starttyping -%D \getboxheight ... \of \box... -%D \stoptyping -%D -%D For instance, -%D -%D \starttyping -%D \getboxheight \dimen0 \of \box0 -%D \getboxheight \someheight \of \box \tempbox -%D \stoptyping -%D -%D The implementation is rather stupid: -%D -%D \starttyping -%D \def\getboxheight#1\of#2\box#3% -%D {#1\ht#3\advance#1\dp#3\relax} -%D \stoptyping -%D -%D The next alternative is slightly more clever, since -%D it accepts \type {{12}} as well as \type {12} as box -%D number. - -\def\getboxheight#1\of#2\box#3% - {\def\next{#1\dimexpr\ht\registercount+\dp\registercount\relax}% - \afterassignment\next\registercount=#3} - -%D For a long time the following three macros were part of -%D the grid snapping core module, but it makes more sense to -%D have them here so that users can see them. -%D -%D \macros -%D {getnoflines, getroundednoflines, getrawnoflines} -%D -%D Het commando \type{\getnoflines} converteert een hoogte -%D (dimensie) in een aantal regels en kent dit toe aan -%D \type{\noflines}. -%D -%D \starttyping -%D \getnoflines{dimensie} -%D \stoptyping -%D -%D Er wordt gedeeld door \type{\openlineheight} en een hoogte -%D van~0pt komt overeen met 0~regels. The raw alternative -%D does not round. - -%D For a long time we had: -%D -%D \starttyping -%D \newcount\noflines -%D \newdimen\noflinesheight -%D -%D \def\dogetnoflines#1#2% -%D {\noflinesheight#2\relax -%D \ifzeropt\noflinesheight % \ifdim\noflinesheight=\zeropoint -%D \noflines\zerocount -%D \else -%D \divide\noflinesheight \openlineheight -%D \noflines\noflinesheight -%D #1\ifdim\noflines\openlineheight=#2\relax \else -%D \advance\noflines\ifdim#2>\zeropoint\plusone\else\minusone\fi -%D \fi\fi -%D \fi} -%D -%D \def\getnoflines {\dogetnoflines\iftrue } % compensated -%D \def\getrawnoflines{\dogetnoflines\iffalse} % no compensation -%D \stoptyping -%D -%D A more recent variant is: - -\ifx\roundingeps\undefined \newdimen\roundingeps \roundingeps=10sp \fi - -\newcount\noflines -\newdimen\noflinesheight - -% \def\getnoflines {\xdogetnoflines\plusone } % compensated -% \def\getroundednoflines{\xdogetnoflines\plustwo } % rounded -% \def\getrawnoflines {\xdogetnoflines\plusthree} % truncated -% -% \def\xdogetnoflines#1#2% -% {\noflinesheight#2\relax -% \ifzeropt\noflinesheight -% \noflines\zerocount -% \else\ifdim\noflinesheight>\zeropoint -% \ifcase#1\or -% \advance\noflinesheight-\roundingeps -% \divide\noflinesheight\openlineheight -% \noflines\noflinesheight -% \advance\noflines\plusone -% \or -% \advance\noflinesheight\roundingeps -% \divide\noflinesheight\openlineheight -% \noflines\noflinesheight -% \or -% \advance\noflinesheight\roundingeps -% \advance\noflinesheight.5\openlineheight -% \divide\noflinesheight\openlineheight -% \noflines\noflinesheight -% \fi -% \else -% \ifcase#1\or -% \advance\noflinesheight\roundingeps -% \divide\noflinesheight\openlineheight -% \noflines\noflinesheight -% \advance\noflines\minusone -% \or -% \advance\noflinesheight-\roundingeps -% \divide\noflinesheight\openlineheight -% \noflines\noflinesheight -% \or -% \advance\noflinesheight-\roundingeps -% \advance\noflinesheight-.5\openlineheight -% \divide\noflinesheight\openlineheight -% \noflines\noflinesheight -% \fi -% \fi\fi} - -\def\getnoflines#1% - {\noflinesheight#1\relax - \ifzeropt\noflinesheight - \noflines\zerocount - \else\ifdim\noflinesheight>\zeropoint - \advance\noflinesheight-\roundingeps - \divide\noflinesheight\openlineheight - \noflines\noflinesheight - \advance\noflines\plusone - \else - \advance\noflinesheight\roundingeps - \divide\noflinesheight\openlineheight - \noflines\noflinesheight - \advance\noflines\minusone - \fi\fi} - -\def\getroundednoflines#1% - {\noflinesheight#1\relax - \ifzeropt\noflinesheight - \noflines\zerocount - \else\ifdim\noflinesheight>\zeropoint - \advance\noflinesheight\roundingeps - \divide\noflinesheight\openlineheight - \noflines\noflinesheight - \else - \advance\noflinesheight-\roundingeps - \divide\noflinesheight\openlineheight - \noflines\noflinesheight - \fi\fi} - -\def\getrawnoflines#1% - {\noflinesheight#1\relax - \ifzeropt\noflinesheight - \noflines\zerocount - \else\ifdim\noflinesheight>\zeropoint - \advance\noflinesheight\roundingeps - \advance\noflinesheight.5\openlineheight - \divide\noflinesheight\openlineheight - \noflines\noflinesheight - \else - \advance\noflinesheight-\roundingeps - \advance\noflinesheight-.5\openlineheight - \divide\noflinesheight\openlineheight - \noflines\noflinesheight - \fi\fi} - -%D Let's proof that it works: -%D -%D \startbuffer -%D \scratchdimen\dimexpr(3pt) \getnoflines\scratchdimen 1=\the\noflines \endgraf -%D \scratchdimen\dimexpr(10\lineheight) \getnoflines\scratchdimen 10=\the\noflines \endgraf -%D \scratchdimen\dimexpr(10.1\lineheight) \getnoflines\scratchdimen 11=\the\noflines \endgraf -%D \scratchdimen\dimexpr(10.5\lineheight) \getnoflines\scratchdimen 11=\the\noflines \endgraf -%D \scratchdimen\dimexpr(10.9\lineheight) \getnoflines\scratchdimen 11=\the\noflines \endgraf -%D \scratchdimen\dimexpr(10\lineheight+3pt) \getnoflines\scratchdimen 11=\the\noflines \endgraf -%D \scratchdimen\dimexpr(10\lineheight+3sp) \getnoflines\scratchdimen 10=\the\noflines \endgraf -%D \scratchdimen\dimexpr(10\lineheight-3sp) \getnoflines\scratchdimen 10=\the\noflines \endgraf -%D -%D \scratchdimen\dimexpr(3pt) \getrawnoflines\scratchdimen 0=\the\noflines \endgraf -%D \scratchdimen\dimexpr(10\lineheight) \getrawnoflines\scratchdimen 10=\the\noflines \endgraf -%D \scratchdimen\dimexpr(10.1\lineheight) \getrawnoflines\scratchdimen 10=\the\noflines \endgraf -%D \scratchdimen\dimexpr(10.5\lineheight) \getrawnoflines\scratchdimen 11=\the\noflines \endgraf -%D \scratchdimen\dimexpr(10.9\lineheight) \getrawnoflines\scratchdimen 11=\the\noflines \endgraf -%D \scratchdimen\dimexpr(10\lineheight+3pt) \getrawnoflines\scratchdimen 10=\the\noflines \endgraf -%D \scratchdimen\dimexpr(10\lineheight+3sp) \getrawnoflines\scratchdimen 10=\the\noflines \endgraf -%D \scratchdimen\dimexpr(10\lineheight-3sp) \getrawnoflines\scratchdimen 10=\the\noflines \endgraf -%D \stopbuffer -%D -%D \typebuffer \getbuffer - -%D \macros -%D {determinenoflines} -%D -%D The next macro determines the number of lines and -%D returns it it \type {\noflines}. The macro works -%D reasonable well as long as the content can be unboxed. -%D -%D \starttyping -%D \determinenoflines{test\\test} -%D \determinenoflines{\bfd test\\test} -%D \determinenoflines{\definedfont[Sans at 40pt]test\\test} -%D \stoptyping - -\def\determinenoflines % can be mkiv'd - {\bgroup - \forgetall - \let\crlf\endgraf - \let\\\endgraf - \dowithnextbox - {\beginofshapebox - \unvbox\nextbox - \endofshapebox - % \global\count1\zerocount - % \reshapebox{\global\advance\count1\plusone}% - % \egroup\noflines\count1 }% - \scratchcounter\zerocount - \reshapebox{\global\advance\scratchcounter\plusone}% - \expandafter\egroup\expandafter\noflines\the\scratchcounter\relax - }\vbox} - -%D \macros -%D {doiftextelse, doiftext} -%D -%D When \type {\doifelse} cum suis hopelessly fail, for -%D instance because we pass data, we can fall back on the next -%D macro: -%D -%D \starttyping -%D \doiftextelse {data} {then branch} {else branch} -%D \doiftext {data} {then branch} -%D \stoptyping - -\newif\iftrialtypesetting - -\def\doiftextelse#1% - {\bgroup - \setbox\scratchbox\normalhbox{\trialtypesettingtrue\ignorespaces#1\removeunwantedspaces}% - \ifzeropt\wd\scratchbox - \egroup\@EA\secondoftwoarguments - \else - \egroup\@EA\firstoftwoarguments - \fi} - -\def\doiftext#1#2% - {\doiftextelse{#1}{#2}\donothing} - -%D \macros -%D {dowithnextbox,nextbox} -%D -%D Sometimes we want a macro to grab a box and do something -%D on the content. One could pass an argument to a box, but -%D this can violate the specific \CATCODES\ of its content and -%D leads to unexpected results. The next macro treats the -%D following braced text as the content of a box and -%D manipulates it afterwards in a predefined way. -%D -%D The first argument specifies what to do with the content. -%D This content is available in \type{\nextbox}. The second -%D argument is one of \type{\hbox}, \type{\vbox} or -%D \type{\vtop}. The third argument must be grouped with -%D \type{\bgroup} and \type{\egroup}, \type{{...}} or can be -%D a \type{\box} specification. -%D -%D In \CONTEXT\ this macro is used for picking up a box and -%D treating it according to earlier specifications. We use for -%D instance something like: -%D -%D \starttyping -%D \def\getfloat% -%D {\def\handlefloat{...\flushnextbox...} -%D \dowithnextbox\handlefloat\normalvbox} -%D \stoptyping -%D -%D instead of: -%D -%D \starttyping -%D \def\getfloat#1% -%D {...#1...} -%D \stoptyping -%D -%D In this implementation the \type{\aftergroup} construction -%D is needed because \type{\afterassignment} is executed inside -%D the box. - -\ifx\nextbox\undefined \newbox\nextbox \fi - -\long\def\dowithnextbox#1% - {\long\def\dodowithnextbox{#1}% - \afterassignment\dododowithnextbox - \setbox\nextbox} - -\def\dododowithnextbox - {\aftergroup\dodowithnextbox} - -\long\def\dowithnextboxcs#1% - {\let\dodowithnextbox#1% - \afterassignment\dododowithnextbox - \setbox\nextbox} - -\def\dododowithnextbox - {\aftergroup\dodowithnextbox} - -%D So in fact we get: -%D -%D \starttyping -%D \setbox\nextbox { \aftergroup\dodowithnextbox ... } -%D \stoptyping -%D -%D or -%D -%D \starttyping -%D \setbox\nextbox { ... } \dodowithnextbox -%D \stoptyping -%D -%D A slower but more versatile implementation is: -%D -%D \starttyping -%D \long\def\dowithnextbox#1#2% -%D {\long\def\dodowithnextbox{#1}% -%D \ifx#2\normalhbox -%D \afterassignment\dododowithnextbox -%D \else\ifx#2\normalvbox -%D \afterassignment\dododowithnextbox -%D \else\ifx#2\normalvtop -%D \afterassignment\dododowithnextbox -%D \else\ifx#2\normalvcenter -%D \afterassignment\dododowithnextbox -%D \else -%D \afterassignment\dodowithnextbox -%D \fi\fi\fi\fi -%D \setbox\nextbox#2} -%D \stoptyping -%D -%D This alternative also accepts \type{\box0} and alike, but -%D we don't really need this functionality now. - -%D \macros -%D {nextboxht,nextboxwd,nextboxdp,flushnextbox} -%D -%D The next couple of shortcuts saves us memory as well as -%D \type {{}}'s in passing parameters. - -\def\nextboxht{\ht\nextbox} -\def\nextboxwd{\wd\nextbox} -\def\nextboxdp{\dp\nextbox} - -\def\flushnextbox{\box\nextbox} - -%D \macros -%D {dowithnextboxcontent} -%D -%D But, occasionally we do need to pass some local settings -%D without wanting to use additional grouping. Therefore we -%D provide: -%D -%D \starttyping -%D \dowithnextboxcontent{inside}{after}{box content} -%D \stoptyping -%D -%D {\em todo: Search source for potential usage!} - -\long\def\dowithnextboxcontent#1#2% inside, after - {\long\def\dodowithnextbox{#2}% - \def\dododowithnextbox{#1\aftergroup\dodowithnextbox}% - \afterassignment\dododowithnextbox - \setbox\nextbox} - -%D Now we can redefine \type {\dowithnextbox} as follows: -%D -%D \starttyping -%D \def\dowithnextbox{\dowithnextboxcontent\empty} -%D \stoptyping -%D -%D But since this macro is used often and since this implementation -%D is slower, we will not use that definition. - -% maybe: -% -% depending on the size of the action, about 10% faster -% -% \newtoks\nextboxtoks -% -% \def\dowithnextbox {\afterassignment\redowithnextbox\nextboxtoks} -% \def\redowithnextbox {\afterassignment\dododowithnextbox\setbox\nextbox} -% \def\dododowithnextbox{\aftergroup\dodowithnextbox} -% \def\dodowithnextbox {\the\nextboxtoks} -% -% \long\def\dowithnextboxcontent#1% #2% inside, after -% {\def\dododowithnextbox{#1\aftergroup\dodowithnextbox}% -% \afterassignment\redowithnextboxcontent\nextboxtoks} -% -% \def\redowithnextboxcontent -% {\afterassignment\dododowithnextbox\setbox\nextbox} - -%D \macros -%D {llap, rlap, tlap, blap, clap} -%D -%D Some well known friends, but we implement them our own -%D way. We want the macros to work in both math and text mode. - -\def\dodorlap{\normalhbox to \zeropoint{\flushnextbox\normalhss}\endgroup} -\def\dodollap{\normalhbox to \zeropoint{\normalhss\flushnextbox}\endgroup} -\def\dodoclap{\normalhbox to \zeropoint{\normalhss\flushnextbox\normalhss}\endgroup} - -\def\dorlap{\begingroup\dowithnextboxcs\dodorlap\normalhbox} -\def\dollap{\begingroup\dowithnextboxcs\dodollap\normalhbox} -\def\doclap{\begingroup\dowithnextboxcs\dodoclap\normalhbox} - -\def\domathclap{\mathpalette\dodomathclap} \def\dodomathclap#1#2{\doclap{$\mathsurround\zeropoint#1#2$}} -\def\domathllap{\mathpalette\dodomathllap} \def\dodomathllap#1#2{\dollap{$\mathsurround\zeropoint#1#2$}} -\def\domathrlap{\mathpalette\dodomathrlap} \def\dodomathrlap#1#2{\dorlap{$\mathsurround\zeropoint#1#2$}} - -\unexpanded\def\rlap{\mathortext\domathrlap\dorlap} -\unexpanded\def\llap{\mathortext\domathllap\dollap} -\unexpanded\def\clap{\mathortext\domathclap\doclap} - -\def\dodotlap{\normalvbox to \zeropoint{\normalvss\flushnextbox}\endgroup} -\def\dodoblap{\normalvbox to \zeropoint{\flushnextbox\normalvss}\endgroup} - -\def\tlap{\begingroup\dowithnextboxcs\dodotlap\normalvbox} -\def\blap{\begingroup\dowithnextboxcs\dodoblap\normalvbox} - -%D \macros -%D {beginofshapebox, -%D reshapebox, doreshapebox, -%D flushshapebox, -%D innerflushshapebox, -%D shapebox, -%D ifreshapingbox} -%D -%D The next utility macro originates from some linenumbering -%D mechanism. Due to \TEX's advanced way of typesetting -%D paragraphs, it's not easy to do things on a line||by||line -%D basis. This macro is able to reprocess a given box and can -%D act upon its vertical boxed components, such as lines. The -%D unwinding sequence in this macro is inspired by a \NTG\ -%D workshop of David Salomon in June 1992. -%D -%D First we have to grab the piece of text we want to act -%D upon. This is done by means of the duo macros: -%D -%D \starttyping -%D \beginofshapebox -%D a piece of text -%D \endofshapebox -%D \stoptyping -%D -%D When all texts is collected, we can call \type{\reshapebox} -%D and do something with it's vertical components. We can make -%D as much passes as needed. When we're done, the box can be -%D unloaded with \type{\flushshapebox}. The only condition in -%D this scheme is that \type{\reshapebox} must somehow unload -%D the \BOX\ \type{\shapebox}. -%D -%D An important aspect is that the content is unrolled -%D bottom||up. The next example illustrates this maybe -%D unexpected characteristic. -%D -%D \startbuffer -%D \beginofshapebox -%D \em \input tufte -%D \endofshapebox -%D -%D \newcounter\LineNumber -%D -%D \reshapebox -%D {\doglobal\increment\LineNumber -%D \normalhbox{\llap{\LineNumber\hskip2em}\box\shapebox}} -%D -%D \flushshapebox -%D \stopbuffer -%D -%D \typebuffer -%D -%D \getbuffer -%D -%D As we can see, when some kind of numbering is done, we have -%D to add a second pass. -%D -%D \startbuffer -%D \newcounter\LineNumber -%D \newcounter\NumberOfLines -%D -%D \reshapebox -%D {\doglobal\increment\NumberOfLines -%D \box\shapebox} -%D -%D \reshapebox -%D {\doglobal\increment\LineNumber -%D \normalhbox -%D {\llap{\LineNumber\ (\NumberOfLines)\hskip2em}% -%D \box\shapebox}% -%D \doglobal\decrement\NumberOfLines} -%D -%D \flushshapebox -%D \stopbuffer -%D -%D \typebuffer -%D -%D \getbuffer -%D -%D This example shows that the content of the box is still -%D available after flushing. Another feature is that only the -%D last reshaping counts. Multiple reshaping can be done by: -%D -%D \startbuffer -%D \beginofshapebox -%D \flushshapebox -%D \endofshapebox -%D -%D \reshapebox -%D {\doglobal\increment\LineNumber -%D \normalhbox{\llap{$\star$\hskip1em}\box\shapebox}% -%D \doglobal\decrement\NumberOfLines} -%D -%D \flushshapebox -%D \stopbuffer -%D -%D \typebuffer -%D -%D \getbuffer -%D -%D The macros are surprisingly easy to follow and in fact -%D introduce no new concepts. Nearly all books on \TEX\ show -%D similar solutions for unwinding \BOXES. -%D -%D Some macros, like footnote ones, can be sensitive for -%D reshaping, which can result in an endless loop. We -%D therefore offer: -%D -%D \starttyping -%D \ifreshapingbox -%D \stoptyping -%D -%D Some \CONTEXT\ commands are protected this way. Anyhow, -%D reshaping is aborted after 100 dead cycles. -%D -%D By the way, changing the height and depth of \BOX\ -%D \type{\shapebox} results in bad spacing. This means that -%D for instance linenumbers etc. should be given zero height -%D and depth before being lapped into the margin. The -%D previous examples ignore this side effect, but beware! - -\newif \ifsomeshapeleft -\newif \ifreshapingbox - -\newbox \shapebox -\newcount \shapepenalty -\newdimen \shapekern -\newskip \shapeskip - -\newbox \newshapebox -\newbox \oldshapebox - -\newcount \shapecounter - -\newevery \everyshapebox \relax - -\def\shapesignal{.12345678pt} % or 12345sp - -% todo: in etex lastnode - -\def\reshapebox#1% - {\doreshapebox - {#1}% - {\penalty\shapepenalty}% - {\kern \shapekern }% - {\vskip \shapeskip }} - -\newbox\tmpshapebox - -\newif\ifreshapingfailed % may save redundant runs - -\def\doreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip - {\global\reshapingfailedfalse - \ifzeropt\ht\oldshapebox % \ifdim\ht\oldshapebox=\zeropoint - \setbox\newshapebox\normalvbox{}% - \else - \setbox\newshapebox\normalvbox - {\unvcopy\oldshapebox - \resetbox\newshapebox - \shapecounter\zerocount - \doloop{\dodoreshapebox{#1}{#2}{#3}{#4}}}% - \setbox\newshapebox\box\tmpshapebox - \fi} - -\ifx\originalshapebox\undefined \let\originalshapebox\oldshapebox \fi - -% %D The old traditional tex variant: -% -% \def\insertshapesignal -% {\normalhbox to \shapesignal{\strut\hss}% plus \strut -% \prevdepth\strutdp} % never \nointerlineskip -% -% \def\restoreshapebox % compensates for the signal -% {\global\setbox\tmpshapebox\vbox{\vskip-\lineheight\unvcopy\oldshapebox}} -% -% \def\shapeboxstrut % put this in front if needed ! -% {\vrule\!!width\zeropoint\!!height\ht\shapebox\!!depth\dp\shapebox} -% -% \def\dodoreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip -% {\ifzeropt\lastskip % \ifdim\lastskip=\zeropoint\relax -% \ifzeropt\lastkern % \ifdim\lastkern=\zeropoint\relax -% \ifcase\lastpenalty % \ifnum\lastpenalty=\zerocount -% \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 -% \else -% \shapepenalty\lastpenalty -% \global\setbox\tmpshapebox\normalvbox{#2\unvbox\tmpshapebox}% -% \unpenalty -% \fi -% \else -% \shapekern\lastkern -% \global\setbox\tmpshapebox\normalvbox{#3\unvbox\tmpshapebox}% -% \unkern -% \fi -% \else -% \shapeskip\lastskip -% \global\setbox\tmpshapebox\normalvbox{#4\unvbox\tmpshapebox}% -% \unskip -% \fi -% \ifnum\shapecounter>100 % can be less -% \global\reshapingfailedtrue -% \message{!!forced exit from shapebox!!}% -% \restoreshapebox -% \exitloop -% \else -% \advance\shapecounter \plusone -% \fi} -% -% But now that the lastnode bugfixes are wide spread we can use: -% -% We will turn this into a \MKIV\ variant. - -\def\insertshapesignal - {\normalhbox to \shapesignal{\strut\hss}% plus \strut - \prevdepth\strutdp} % never \nointerlineskip - -\def\restoreshapebox % compensates for the signal - {\global\setbox\tmpshapebox\vbox{\vskip-\lineheight\unvcopy\oldshapebox}} - -\def\dodoreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip - {\ifnum\lastnodetype=\@@gluenode - \shapeskip\lastskip - \global\setbox\tmpshapebox\normalvbox{#4\unvbox\tmpshapebox}% - \unskip - \else\ifnum\lastnodetype=\@@kernnode - \shapekern\lastkern - \global\setbox\tmpshapebox\normalvbox{#3\unvbox\tmpshapebox}% - \unkern - \else\ifnum\lastnodetype=\@@penaltynode - \shapepenalty\lastpenalty - \global\setbox\tmpshapebox\normalvbox{#2\unvbox\tmpshapebox}% - \unpenalty - \else\ifnum\lastnodetype<\zeropoint - \exitloop - \else - \setbox\shapebox\lastbox - \ifvoid\shapebox - \else\ifdim\wd\shapebox=\shapesignal\relax - \exitloop - \else - \shapecounter\zerocount - \global\setbox\tmpshapebox\normalvbox{#1\unvbox\tmpshapebox}% - \fi\fi - \fi\fi\fi\fi - \ifnum\shapecounter>100 % can be less - \global\reshapingfailedtrue - \message{!!forced exit from shapebox \the\lastnodetype !!}% - \restoreshapebox - \exitloop - \else - \advance\shapecounter \plusone - \fi} - -\def\beginofshapebox - {\setbox\oldshapebox\normalvbox - \bgroup - \reshapingboxtrue - \the\everyshapebox - \insertshapesignal} - -\def\endofshapebox - {\endgraf - \egroup} - -\let\beginshapebox\beginofshapebox -\let\endshapebox \endofshapebox - -\def\flushshapebox - {\bgroup - \ifzeropt\ht\newshapebox % \ifdim\ht\newshapebox=\zeropoint - \else - % make \prevdepth legal - % \par before the next \vskip gives far worse results - \ifdim\parskip>\zeropoint\vskip\parskip\else\par\fi - % and take a look - \ifdim\prevdepth=-\thousandpoint - \prevdepth\zeropoint - \fi - \ifdim\prevdepth<\zeropoint\relax - % something like a line or a signal or ... - \donetrue - \else\ifinner - % not watertight and not ok - \donefalse - \else\ifdim\pagegoal=\maxdimen - \donetrue - \else - % give the previous line a normal depth - \donetrue - {\forgeteverypar\verticalstrut}\nobreak - \kern-\struttotal % geen \vskip - \kern-\parskip - % \vskip-\strutdp - \fi\fi\fi - \scratchdimen\dp\newshapebox - \unvbox\newshapebox - % \prevdepth=0pt and \dp\newshapebox depend on last line - \kern-\scratchdimen % ?? - % now \prevdepth=0pt - \ifdone - \kern\strutdp - \prevdepth\strutdp - \fi - \fi - \egroup} - -%D In real inner situations we can use: -%D -%D \starttyping -%D \flushinnershapebox -%D \stoptyping -%D -%D This one is used in \type{\framed}. - -% The kern fails on for instance: -% -% \omlijnd[offset=0pt,hoogte=8mm,uitlijnen={rechts,laho}]{\bfa test} - -\def\innerflushshapebox - {\ifzeropt\ht\newshapebox \else - \unvcopy\newshapebox\relax % unvcopy ! else spacing problem - % \kern-\dp\newshapebox\relax - \fi} - -%D For absolute control, one can use \type{\doreshapebox} -%D directly. This macro takes four arguments, that take care -%D of: -%D -%D \startitemize[n,packed] -%D \item \type{\shapebox} -%D \item \type{\shapepenalty} -%D \item \type{\shapekern} -%D \item \type{\shapeskip} -%D \stopitemize - -%D \macros -%D {shapedhbox} -%D -%D When constructing a new box, using the content of \type -%D {\shapebox}, one can best use \type {\shapedhbox} instead -%D of \type {\normalhbox}, since it manages the height and depth of -%D the line. - -% \def\shapedhbox -% {\dowithnextbox -% {\nextboxht\zeropoint -% \nextboxdp\zeropoint -% \flushnextbox} -% \normalhbox} - -\def\shapedhbox % lines with non strutted dimensions have - {\expanded{\dowithnextbox % interlineskip so if we want the original - {\nextboxht\the\ht\shapebox % spacing, we need to preserve the original - \nextboxdp\the\dp\shapebox % height and depth which is definitely - \noexpand\flushnextbox}} % needed if we apply struts to the 'new' - \normalhbox} % box or do something that changed ist size - -%D \macros -%D {hyphenatedword, -%D hyphenatedpar, -%D hyphenatedfile, -%D dohyphenateword} -%D -%D The next one is a tricky one. \PLAIN\ \TEX\ provides -%D \type{\showhyphens} for showing macros on the terminal. When -%D preparing a long list of words we decided to show the -%D hyphens, but had to find out that the \PLAIN\ alternative -%D can hardly be used and|/|or adapted to typesetting. The next -%D two macros do the job and a little more. First we define the -%D (slightly adapted) plain variant: - -\def\showhyphens#1% - {\begingroup - \setbox\scratchbox\vbox - {\parfillskip\zerocount - \hsize\maxdimen - %\tenrm - \pretolerance\minusone - \tolerance\minusone - \hbadness\zerocount - \showboxdepth\zerocount - \ #1}% - \endgroup} - -%D The simple command \type{\hyphenatedword} accepts one -%D argument and gives the hyphenated word. This macro calls for -%D -%D \starttyping -%D \dohyphenateword {n} {pre} {word} -%D \stoptyping -%D -%D The next examples tell more than lots of words: -%D -%D \startbuffer -%D \dohyphenateword{0} {} {dohyphenatedword} -%D \dohyphenateword{1} {...} {dohyphenatedword} -%D \dohyphenateword{2} {...} {dohyphenatedword} -%D \stopbuffer -%D -%D \typebuffer -%D -%D Here, \type{\hyphenatedword{dohyphenatedword}} is the -%D shorter alternative for the first line. -%D -%D \startvoorbeeld -%D \getbuffer -%D \stopvoorbeeld -%D -%D These macros are slow but effective and not that hard to -%D program at all. - -\ifx\scantokens\undefined \let\scantokens\firstofoneargument \fi - -\def\dohyphenateword#1#2#3% - {\bgroup - \setbox\scratchbox\normalhbox - {\dontcomplain - \nopenalties % \widowpenalty \clubpenalty \brokenpenalty \doublehyphendemerits \finalhyphendemerits \adjdemerits - \hyphenpenalty \zerocount - \exhyphenpenalty\zerocount - \setbox0\normalvbox - {\hsize\zeropoint - \hskip\zeropoint\relax % really needed - \ifnum#1<\zeropoint - \obeyspaces - \obeylines - \def\obeyedspace{\hskip\zeropoint\hbox to \onepoint{}\hskip\zeropoint}% - \let\obeyedline \obeyedspace - \ifcase-#1\or - \def\next{#3\relax}\scantokens\expandafter{\next}% relax catches lookahead problem - % also ok: \scantokens{#3}% % as in \hyphenatedword{spanish|?|} - \or - \readfile{#3}\donothing\donothing - \else - #3% - \fi - \else - #3% - \fi}% - \ifnum#1>\zerocount - \dorecurse{#1} - {\setbox2\normalhbox - {\splittopskip\openstrutheight - \vsplit0 to \baselineskip}}% - #2% - \fi - \doloop - {\setbox2\normalhbox - {\splittopskip\openstrutheight - \vsplit0 to \baselineskip}% - \setbox2\normalhbox - {\unhbox2 - \setbox2\lastbox - \normalvbox - {\unvbox2 - \setbox2\lastbox - \normalhbox{\unhbox2}}}% - \ifnum#1<\zeropoint\ifdim\wd2=\onepoint\space\else\box2\allowbreak\fi\else\box2\fi - \ifzeropt\ht0 \exitloop\fi}% % \ifdim\ht0=\zeropoint\exitloop\fi}% - \removeunwantedspaces}% - \ifnum#1>\zerocount - \ht\scratchbox\strutht - \dp\scratchbox\strutdp - \box\scratchbox - \else - \unhbox\scratchbox - \fi - \egroup} - -\def\hyphenatedword{\dohyphenateword\zerocount\empty} -\def\hyphenatedpar {\dohyphenateword\minusone \empty} -\def\hyphenatedfile{\dohyphenateword{-2}\empty} - -%D You may want to give the following call a try: -%D -%D \starttyping -%D \hyphenatedpar{\readfile{zapf}{}{}}\endgraf -%D \stoptyping - -%D \macros -%D {processtokens} -%D -%D We fully agree with (most) typographers that inter||letter -%D spacing is only permitted in fancy titles, we provide a -%D macro that can be used to do so. Because this is -%D (definitely and fortunately) no feature of \TEX, we have to -%D step through the token list ourselves. -%D -%D \starttyping -%D \processtokens {before} {between} {after} {space} {tokens} -%D \stoptyping -%D -%D An example of a call is: -%D -%D \startbuffer -%D \processtokens {[} {+} {]} {\space} {hello world} -%D \stopbuffer -%D -%D \typebuffer -%D -%D This results in: -%D -%D \getbuffer -%D -%D The list of tokens may contain spaces, while \type{\\}, -%D \type{{}} and \type{\ } are handled as space too. - -\def\dodoprocesstokens - {\ifx\nextprocessedtoken\lastcharacter - \after - \let\nextprocessedtoken\relax - \else\ifx\nextprocessedtoken\bgroup - \def\nextprocessedtoken - {\dowithnextbox - {\before{\copy\nextbox}% \before can use nextbox several times - \let\before\between - \doprocesstokens} - \hbox\bgroup}% - \else - \expandafter\if\space\nextprocessedtoken - \after\white - \let\before\savedbefore - \else - \before\nextprocessedtoken - \let\before\between - \fi - \let\nextprocessedtoken\doprocesstokens - \fi\fi - \nextprocessedtoken} - -\def\doprocesstokens% the space after = is essential - {\afterassignment\dodoprocesstokens\let\nextprocessedtoken= } - -\def\processtokens#1#2#3#4#5% - {\begingroup - \def\lastcharacter{\lastcharacter}% - \def\space{ }% - \let\\=\space - \def\before {#1}% - \def\between{#2}% - \def\after {#3}% - \def\white {#4}% - \let\savedbefore\before - \doprocesstokens#5\lastcharacter - \endgroup} - -%D \macros -%D {doboundtext} -%D -%D Sometimes there is not enough room to show the complete -%D (line of) text. In such a situation we can strip of some -%D characters by using \type{\doboundtext}. When the text is -%D wider than the given width, it's split and the third -%D argument is appended. When the text to be checked is packed -%D in a command, we'll have to use \type{\expandafter}. -%D -%D \starttyping -%D \doboundtext{a very, probably to long, text}{3cm}{...} -%D \stoptyping -%D -%D When calculating the room needed, we take the width of the -%D third argument into account, which leads to a bit more -%D complex macro than needed at first sight. - -% \def\dodoboundtext#1% -% {\setbox0=\normalhbox{\unhcopy0 #1}% -% \ifdim\wd0>\dimen0 -% \let\dodoboundtext=\gobbleoneargument -% \else -% #1\relax -% \fi} -% -% \def\doboundtext#1#2#3% -% {\normalhbox -% {\setbox0=\normalhbox{#1}% -% \dimen0=#2\relax -% \ifdim\wd0>\dimen0 -% \setbox2=\normalhbox{#3}% -% \advance\dimen0 by -\wd2 -% \setbox0=\normalhbox{}% -% \processtokens -% {\dodoboundtext} -% {\dodoboundtext} -% {} -% {\space} -% {#1}% -% \box2 -% \else -% \box0 -% \fi}} - -\def\dodoboundtext#1% - {\setbox0\normalhbox{#1}% - \advance\scratchdimen -\wd0 - \ifdim\scratchdimen>\zeropoint\relax#1\fi}% - -\def\doboundtext#1#2#3% - {\normalhbox - {\setbox\scratchbox\normalhbox{#1}% - \scratchdimen#2\relax - \ifdim\wd\scratchbox>\scratchdimen - \setbox\scratchbox\normalhbox{#3}% - \advance\scratchdimen -\wd\scratchbox - \handletokens#1\with\dodoboundtext - \fi - \box\scratchbox}} - -%D \macros -%D {limitatetext} -%D -%D A bit more beautiful alternative for the previous command is -%D the next one. This command is more robust because we let -%D \TEX\ do most of the job. The previous command works better -%D on text that cannot be hyphenated. -%D -%D \starttyping -%D \limitatetext {text} {width} {sentinel} -%D \limitatetext {text} {-width} {prelude} -%D \stoptyping -%D -%D When no width is given, the whole text comes available. The -%D sentinel is optional. This is about the third version. - -\ifx\fakecompoundhyphen\undefined \let\fakecompoundhyphen\relax \fi -\ifx\veryraggedright \undefined \def\veryraggedright{\raggedright} \fi - -%D The simple alternative is as follows: -%D -%D \starttyping -%D \unexpanded\def\limitatetext% -%D {\bgroup % evt \setstrut -%D \forgetall -%D \fakecompoundhyphen % dangerous ! ! ! ! ! ! ! ! ! -%D \dowithnextbox\dolimitatetext\normalhbox} -%D -%D \def\dolimitatetext#1#2% -%D {\doifelsenothing{#1} -%D {\unhbox\nextbox} -%D {\widowpenalty=0 -%D \clubpenalty=0 -%D \scratchdimen=#1\relax -%D \ifdim\nextboxwd>\scratchdimen -%D \setbox\scratchbox=\normalhbox{ #2}% -%D \advance\scratchdimen by -\wd\scratchbox -%D \setbox\nextbox=\normalvbox -%D {\hsize=\scratchdimen -%D \hfuzz\maxdimen -%D \veryraggedright -%D \strut\unhcopy\nextbox}% -%D \ifdim\nextboxht>\strutht \else -%D \setbox\scratchbox\null % overfull and not split -%D \fi -%D \setbox\nextbox=\normalvbox % if omitted: missing brace reported -%D {\splittopskip=\openstrutheight -%D \setbox\nextbox=\vsplit\nextbox to \strutht -%D \unvbox\nextbox -%D \setbox\nextbox=\lastbox -%D \global\setbox1=\normalhbox -%D {\unhbox\nextbox\unskip\kern\zeropoint\box\scratchbox\unskip}}% -%D \unhbox1 -%D \else -%D \unhbox\nextbox -%D \fi}% -%D \egroup} -%D \stoptyping -%D -%D The next alternative accepts a negative width. A negative -%D value crops the beginning. The macro thereby becomes less -%D readable, which is why we kept the original here too. - -\unexpanded\def\limitatetext - {\bgroup % evt \setstrut - \forgetall % otherwise indentation and so - %\def\limitatetext##1##2##3{##1}% \def ! - \let\limitatetext\firstofthreearguments - \fakecompoundhyphen % dangerous ! ! ! ! ! ! ! ! ! - \dowithnextboxcs\dolimitatetext\normalhbox} - -\def\dolimitatetext#1#2% - {\doifelsenothing{#1} - {\unhbox\nextbox} - {\nopenalties - \scratchdimen#1\relax - \ifdim\scratchdimen<\zeropoint\relax % we'll take the last line - \donefalse - \scratchdimen-\scratchdimen - \else - \donetrue - \fi - \ifdim\nextboxwd>\scratchdimen - \setbox\scratchbox\normalhbox{\ifdone\space#2\else#2\space\fi}% - \advance\scratchdimen -\wd\scratchbox - \setbox0\flushnextbox - \setbox\nextbox\normalvbox - {\hsize\scratchdimen - \hfuzz\maxdimen - \veryraggedright - \strut - \ifdone \else - \parfillskip\zeropoint - \rightskip\zeropoint - \hskip\zeropoint \!!plus 1\!!fill % \hsize - \fi - \unhcopy0}% - \ifdim\nextboxht>\strutht - \setbox\nextbox\normalvbox % if omitted: missing brace reported - {\splittopskip\openstrutheight - \ifdone - \setbox\nextbox\vsplit\nextbox to \strutht - \else - \doloop - {\setbox0\vsplit\nextbox to \strutht - \ifdim\nextboxht>\strutht \else \exitloop \fi}% - \fi - \unvbox\nextbox - \setbox\nextbox\lastbox - \global\setbox1\normalhbox - {\ifdone - \unhbox\nextbox\unskip\kern\zeropoint\box\scratchbox - \else - \box\scratchbox\unhbox\nextbox - \fi - \unskip}}% - \unhbox1 - \else - \unhbox0 - \fi - \else - \unhbox\nextbox - \fi}% - \egroup} - -%D We can also limit a text with more control: -%D -%D \startbuffer -%D \limitatetext {\input tufte } {2cm,5mm} {\unknown} -%D \limitatetext {ton en hans} {2cm,5mm} {\unknown} -%D \limitatetext {ton en hans zijn eikels} {2cm,5mm} {\unknown} -%D \limitatetext {ton} {2cm,5mm} {\unknown} -%D \stopbuffer -%D -%D \typebuffer \getbuffer -%D -%D We build this feature on top of the previous macro. - -\let\normallimitatetext\limitatetext - -\def\speciallimitatetext#1#2#3#4% text left right placeholder - {%\dontleavehmode - \bgroup - %\def\speciallimitatetext##1##2##3##4{##1}% \def ! - \let\speciallimitatetext\firstoffourarguments - \setbox0\normalhbox - {\nohyphens - \normallimitatetext{#1}{+#2}{}#4% - \normallimitatetext{#1}{-#3}{}}% - \setbox2\normalhbox - {#1}% - \ifdim\wd2<\wd0 #1\else\unhbox0\fi - \egroup} - -\def\limitatetext#1#2#3% \expanded added 2003/01/16 - {\expanded{\beforesplitstring#2}\at,\to\leftlimit - \expanded{\aftersplitstring #2}\at,\to\rightlimit - \ifx\rightlimit\empty - \normallimitatetext {#1}\leftlimit {#3}% - \else - \speciallimitatetext{#1}\leftlimit\rightlimit{#3}% - \fi} - -%D Undocumented bonus (see wiki): -%D -%D \starttyping -%D \limitatefirstline{\input tufte\relax}{10cm}{\unknown} -%D \stoptyping - -\def\limitatefirstline#1#2#3% - {\hbox\bgroup\strut - \setbox\scratchbox\hbox{\begstrut#1\endstrut}% - \ifdim\wd\scratchbox>#2\relax - \setbox\scratchbox\hbox{#3}% - \hsize#2\relax - \advance\hsize-\wd\scratchbox - \setbox\scratchbox\vbox{\forgetall\veryraggedright#1}% - \setbox\scratchbox\vsplit\scratchbox to \lineheight - \vbox - {\unvbox\scratchbox - \global\setbox\plusone\lastbox - \global\setbox\plusone\hbox{\strut\unhbox\plusone}% - \hbox % to #2 - {\ifx\clip\undefined - \box\plusone - \else\ifdim\wd\plusone>\hsize - \lower\strutdepth\hbox{\clip[\c!width=\hsize,\c!height=\lineheight]{\hbox{\raise\strutdepth\box\plusone}}}% - \else - \box\plusone - \fi\fi - \removeunwantedspaces#3}}% \removeunwantedspaces\hss#3}}% - \else - #1% - \fi - \egroup} - -%D \macros -%D {processisolatedwords, -%D betweenisolatedwords,nothingbetweenisolatedwords} -%D -%D References are often made up of one word or a combination -%D of tightly connected words. The typeset text {\bf -%D chapter~5} is for instance the results of the character -%D sequence: -%D -%D \starttyping -%D The typeset text \in{chapter}[texniques] is for instance -%D \stoptyping -%D -%D When such words are made active in interactive texts, the -%D combination cannot longer be hyphenated. Normally this is no -%D problem, because \TEX\ tries to prevent hyphenation as best -%D as can. -%D -%D Sometimes however we need a few more words to make things -%D clear, like when we want to refer to {\bf \TEX\ by Topic}. -%D The macros that are responsible for typesetting hyperlinks, -%D take care of such sub||sentences by breaking them up in -%D words. Long ago we processed words using the space as a -%D separator, but the more advanced our interactive text became, -%D the more we needed a robust solution. Well, here it is and -%D it called as: -%D -%D \starttyping -%D \processisolatedwords{some words}\someaction -%D \stoptyping -%D -%D The second argument \type{someactions} handles the -%D individual words, like in: -%D -%D \startbuffer -%D \processisolatedwords{some more words} \ruledhbox \par -%D \processisolatedwords{and some $x + y = z$ math} \ruledhbox \par -%D \processisolatedwords{and a \normalhbox{$x + y = z$}} \ruledhbox \par -%D \stopbuffer -%D -%D \typebuffer -%D -%D which let the words turn up as: -%D -%D \startvoorbeeld -%D \getbuffer -%D \stopvoorbeeld -%D -%D The macro has been made a bit more clever than needed at -%D first sight. This is due to the fact that we don't want to -%D generate more overhead in terms of interactive commands than -%D needed. -%D -%D \startbuffer -%D \processisolatedwords{see this \ruledhskip1em} \ruledhbox -%D \processisolatedwords{and \ruledhskip1em this one} \ruledhbox -%D \stopbuffer -%D -%D \typebuffer -%D -%D becomes: -%D -%D \startvoorbeeld -%D \startlines -%D \getbuffer -%D \stoplines -%D \stopvoorbeeld -%D -%D Single word arguments are treated without further -%D processing. This was needed because this command is used in -%D the \type{\goto} command, to which we sometimes pass very -%D strange and|/|or complicated arguments or simply boxes -%D whose dimensions are to be left intact. -%D -%D First we build a \type{\normalhbox}. This enables us to save the -%D last skip. Next we fill a \type{\normalvbox} without hyphenating -%D words. After we've tested if there is more than one word, we -%D start processing the individual lines (words). We need some -%D splitting, packing and unpacking to get the spacing and -%D dimensions right. -%D -%D Normally the isolated words are separated by space, but -%D one can overrule this separator by changing the next macros. -%D -%D When needed, spacing can be suppressed by \type -%D {\nothingbetweenisolatedwords}. - -\newif\ifisolatedwords % public, e.g. used in core-ref - -\def\betweenisolatedwords - {\hskip\currentspaceskip} - -%D In order to prevent problems with nested isolated words, we -%D do process them, but only split at the outermost level. - -\newskip\isolatedlastskip - -\chardef\isolatedwordsmode=0 % no nesting - -\def\processisolatedwords#1#2% todo: vbox ipv hbox ivm afbreken! - {\bgroup % todo: doloop - \fakecompoundhyphen - \dontcomplain - \forgetall - \nopenalties - \ifcase\isolatedwordsmode - \def\processisolatedwords##1##2{##2{##1}}% we split only once - \fi - \global\let\localbetweenisolatedwords\betweenisolatedwords - \setbox0\normalhbox % we default to spaces, but from inside out - {\normallanguage\minusone % needed for mkiv - \ignorespaces#1% \localbetweenisolatedwords can be overruled - \global\isolatedlastskip\lastskip}% - \setbox2\normalvbox - {%\hyphenpenalty10000 % this one fails in \url breaking, - \lefthyphenmin\maxcard % but this trick works ok, due to them - \righthyphenmin\maxcard % total>63, when no hyphenation is done - \hsize\zeropoint - \unhcopy0}% == #1 - \ifdim\ht0=\ht2 - \isolatedwordsfalse - #2{\unhbox0}% == #2{#1} % was \unhcopy0 - \else - \isolatedwordstrue - \setbox0\normalhbox - {\ignorespaces - \loop - \setbox4\normalhbox - {\splittopskip\openstrutheight - \vsplit2 to \baselineskip}% - \normalhbox - {\unhbox4\unskip % recently added - \setbox4\lastbox - \normalvbox % outer \normalhbox needed - {\unvbox4 % for nested use - \setbox4\lastbox - \normalhbox{#2{\normalhbox - {\unhbox4 - \unskip\unpenalty % remove end of line stuff - \global\dimen1\lastkern}}}}}% - \ifdim\ht2>\zeropoint\relax - \ifdim\dimen1=\compoundbreakpoint - \allowbreak - \else - \localbetweenisolatedwords - \fi - \repeat - \unskip}% - \unhbox0\unskip - \ifzeropt\isolatedlastskip\else % added % \ifdim\isolatedlastskip=\zeropoint\else % added - \hskip\isolatedlastskip - \fi - \fi - \egroup} - -%D One can use the next macro to change the intersplit -%D material. An example can be found in the \type {\url} -%D macro. The innermost setting is used. In the url case, it -%D means that either very small spaces are used or no spaces -%D at all. So, the innermost settings are used, while the -%D outermost split takes place. - -\def\setbetweenisolatedwords#1% - {\gdef\localbetweenisolatedwords{#1}} - -%D \macros -%D {sbox} -%D -%D This is a rather strange command. It grabs some box content -%D and and limits the size to the height and depth of a -%D \type{\strut}. The resulting bottom||alligned box can be used -%D aside other ones, without disturbing the normal baseline -%D distance. -%D -%D \startbuffer -%D \ruledhbox to .5\hsize{\sbox{eerste\par tweede \par derde}} -%D \stopbuffer -%D -%D \typebuffer -%D -%D Shows up as: -%D -%D \startvoorbeeld -%D \vskip3\baselineskip -%D \getbuffer -%D \stopvoorbeeld -%D -%D Before displaying the result we added some skip, otherwise -%D the first two lines would have ended up in the text. This -%D macro can be useful when building complicated menus, headers -%D and footers and|/|or margin material. - -\def\sbox% in handleiding, voorbeeld \inleft{xx} \extern.. - {\normalvbox\bgroup % new ! ! ! - \dowithnextbox - {\setbox\scratchbox\normalhbox - {\strut - \nextboxdp\zeropoint - \lower\strutdepth\flushnextbox}% - \dp\scratchbox\strutdepth - \ht\scratchbox\strutheight - \box\scratchbox - \egroup}% - \normalvbox} - -%D \macros -%D {struttedbox} -%D -%D This boxing macro limits the height and depth to those of -%D a strut. - -\def\struttedbox - {\normalhbox\bgroup % new ! ! ! - \dowithnextbox - {\nextboxdp\strutdepth - \nextboxht\strutheight - \flushnextbox - \egroup}% - \normalhbox} - -%D \macros -%D {topskippedbox} -%D -%D This macro compensates the difference between the topskip -%D and strutheight. Watch how we preserve the depth when it -%D equals strutdepth. - -\def\topskippedbox - {\normalhbox\bgroup - \dowithnextbox - {\edef\next - {\ifdim\strutdepth=\nextboxdp\nextboxdp\the\nextboxdp\fi}% - \lower\topskip\normalhbox{\raise\strutheight\flushnextbox}% - \next - \egroup}% - \normalhbox} - -%D \macros -%D {centeredbox, centerednextbox} -%D -%D Here is another strange one. This one offers a sort of overlay -%D with positive or negative offsets. This command can be used -%D in well defined areas where no offset options are available. -%D We first used it when building a button inside the margin -%D footer, where the button should have a horizontal offset and -%D should be centered with respect to the surrounding box. The -%D last of the three examples we show below says: -%D -%D \starttyping -%D \vsize=3cm -%D \hsize=3cm -%D \ruledvbox to \vsize -%D {\centeredbox height .5cm width -1cm -%D {\vrule width \hsize height \vsize}}} -%D \stoptyping -%D -%D Here the \type{\ruledvbox} just shows the surrounding box -%D and \type{\vrule} is used to show the centered box. -%D -%D \def\AnExample#1#2% -%D {\vsize=3cm -%D \hsize=3cm -%D \ruledvbox to \vsize -%D {\centeredbox height #1 width #2 -%D {\color[green]{\vrule width \hsize height \vsize}}}} -%D -%D \startlinecorrection -%D \startcombination[3*1] -%D {\AnExample {-1cm} {.5cm}} {} -%D {\AnExample {.5cm} {-1cm}} {} -%D {\AnExample {-1cm} {-.5cm}} {} -%D \stopcombination -%D \stoplinecorrection -%D -%D This command takes two optional arguments: \type{width} and -%D \type{height}. Observing readers can see that we use \TEX's -%D own scanner for grabbing these arguments: \type{#1#} reads -%D everyting till the next brace and passes it to both rules. -%D The setting of the box dimensions at the end is needed for -%D special cases. The dimensions of the surrounding box are kept -%D intact. This commands handles positive and negative -%D dimensions (which is why we need two boxes with rules). - -\def\centeredbox#1#% height +/-dimen width +/-dimen - {\bgroup - \setbox0\normalvbox to \vsize - \bgroup - \dontcomplain - \forgetall - \setbox0\normalhbox{\vrule\!!width \zeropoint#1}% - \setbox2\normalvbox{\hrule\!!height\zeropoint#1}% - \advance\vsize \ht2 - \advance\hsize \wd0 - \normalvbox to \vsize - \bgroup - \vskip-\ht2 - \vss - \normalhbox to \hsize - \bgroup - \dowithnextbox - {\hskip-\wd0 - \hss - \flushnextbox - \hss - \egroup - \vss - \egroup - \egroup - \wd0\hsize - \ht0\vsize - \box0 - \egroup} - \normalhbox} - -%D For those who don't want to deal with \type {\hsize} -%D and \type {\vsize}, we have: -%D -%D \starttyping -%D \centerednextbox width 2bp height 2bp -%D {\framed[width=100bp,height=100bp]{}} -%D \stoptyping -%D -%D Do you see what we call this one \type {next}? - -\def\centerednextbox#1#% - {\bgroup - \dowithnextbox - {\hsize\nextboxwd - \vsize\nextboxht - \centeredbox#1{\flushnextbox}% - \egroup} - \normalhbox} - -%D \macros -%D {centerbox} -%D -%D Centering on the available space is done by: -%D -%D \starttyping -%D \centerbox {content} -%D \stoptyping -%D -%D When omitted, the current \type {\hsize} and \type -%D {\vsize} are used. Local dimensions are supported. - -\long\def\centerbox#1#% optional height +/-dimen width +/-dimen - {\bgroup - \dowithnextbox - {\setlocalhsize - \setbox0\normalhbox{\vrule\!!width \zeropoint#1}% - \setbox2\normalvbox{\hrule\!!height\zeropoint#1}% - \ifzeropt\wd0\else\hsize\wd0\fi % \hsize\ifdim\wd0=\zeropoint\hsize\else\wd0\fi - \ifzeropt\ht2\else\vsize\ht2\fi % \vsize\ifdim\ht2=\zeropoint\vsize\else\ht2\fi - \normalvbox to \vsize{\vss\normalhbox to \hsize{\hss\flushnextbox\hss}\vss}% - \egroup}% - \normalhbox} - -%D \macros -%D {setrigidcolumnhsize,rigidcolumnbalance,rigidcolumnlines} -%D -%D These macros are copied from the \TEX book, page~397, and -%D extended by a macro that sets the \type{\hsize}. -%D -%D \starttyping -%D \setrigidcolumnhsize {total width} {distance} {n} -%D \rigidcolumnbalance {box} -%D \stoptyping -%D -%D Both these macros are for instance used in typesetting -%D footnotes. -%D -%D Men kan het proces van breken enigzins beinvloeden met de -%D volgende twee switches: - -\newif\ifalignrigidcolumns -\newif\ifstretchrigidcolumns -\newif\iftightrigidcolumns % if true: just a vbox, no depth/noflines/gridsnap corrrections - -%D De eerste switch bepaald het uitlijnen, de tweede rekt de -%D individuele kolommen op naar \type{\vsize}. - -\def\setrigidcolumnhsize#1#2#3% todo: \dimexpr - {\xdef\savedrigidhsize{\the\hsize}% - \hsize#1\relax - \global\chardef\rigidcolumns#3\relax - \scratchdimen -#2\relax - \multiply\scratchdimen #3\relax - \advance\scratchdimen #2\relax - \advance\hsize \scratchdimen - \divide\hsize #3\relax} - -% == -% -% \def\setrigidcolumnhsize#1#2#3% -% {\xdef\savedrigidhsize{\the\hsize}% -% \global\chardef\rigidcolumns#3\relax -% \hsize=\dimexpr(#1-\numexpr#3-1\relax\dimexpr#2\relax)/#3\relax} - -\newbox\rigidcolumnbox - -\let\rigidcolumnlines\!!zerocount - -\def\rigidcolumnbalance#1% - {\ifnum\rigidcolumns=1 % tzt ook h/d correctie - \ifinner\ifhmode\box\else\unvbox\fi\else\unvbox\fi#1\relax - \else - \normalvbox - {\forgetall - \nopenalties - \dontcomplain - \setbox\rigidcolumnbox\normalvbox - {\line{}\goodbreak\unvbox#1\removebottomthings}% - \splittopskip\openstrutheight - \setbox\scratchbox\vsplit\rigidcolumnbox to \zeropoint - \ifcase\rigidcolumnlines\relax - % \iffalse - % % maybe some day an option - % \scratchskip\ht\rigidcolumnbox - % \advance\scratchskip\dp\rigidcolumnbox - % \getnoflines\scratchskip - % \ifodd\noflines - % \advance\noflines\plusone - % \fi - % \divide\noflines\rigidcolumns - %\else - \scratchdimen\ht\rigidcolumnbox - \divide\scratchdimen \rigidcolumns - \getnoflines\scratchdimen - %\fi - \else - \noflines\rigidcolumnlines % to be sure - \fi - \scratchdimen\noflines\lineheight - % new: we now loop so that we don't loose content - % since in practice we also use this macro for - % funny lineheights and border cases - \setbox0=\box\rigidcolumnbox - \doloop - {\setbox\rigidcolumnbox=\copy0 - \setbox\scratchbox\normalhbox to \savedrigidhsize - {\dorecurse\rigidcolumns - {\setbox\scratchbox\vsplit\rigidcolumnbox to \scratchdimen - \dp\scratchbox\openstrutdepth - \setbox\scratchbox\normalvtop - \ifalignrigidcolumns to - \ifstretchrigidcolumns\vsize\else\scratchdimen\fi - \fi - {\unvbox\scratchbox}% - \wd\scratchbox\hsize - \box\scratchbox - \hfill}% - \hfillneg}% - \ifvoid\rigidcolumnbox\exitloop\else\advance\scratchdimen\lineheight\fi}% - \iftightrigidcolumns - \setbox\scratchbox\normalhbox{\raise\dp\scratchbox\box\scratchbox}% - \else - \advance\scratchdimen -\openstrutdepth - \setbox\scratchbox\normalhbox{\raise\scratchdimen\box\scratchbox}% - \dp\scratchbox\openstrutdepth - \ht\scratchbox\scratchdimen - \fi - \box\scratchbox}% - \fi} - -%D \macros -%D {startvboxtohbox,stopvboxtohbox,convertvboxtohbox} -%D -%D Here is another of Knuth's dirty tricks, as presented on -%D pages 398 and 399 of the \TEX book. These macros can be used -%D like: -%D -%D \starttyping -%D \normalvbox -%D \bgroup -%D \startvboxtohbox ... \stopvboxtohbox -%D \startvboxtohbox ... \stopvboxtohbox -%D \startvboxtohbox ... \stopvboxtohbox -%D \egroup -%D -%D \normalvbox -%D \bgroup -%D \convertvboxtohbox -%D \egroup -%D \stoptyping -%D -%D These macros are used in reformatting footnotes, so they do -%D what they're meant for. - -\def\setvboxtohbox - {\bgroup - \ifdim\baselineskip<16pt \relax - \scratchdimen\baselineskip - \multiply\scratchdimen 1024 - \else - \message{cropping \baselineskip to 16pt}% - \scratchdimen\maxdimen - \fi - \divide\scratchdimen \hsize - \multiply\scratchdimen 64 - \xdef\normalvboxtohboxfactor{\withoutpt\the\scratchdimen}% - \egroup} - -\def\startvboxtohbox - {\bgroup - \setvboxtohbox - \setbox\scratchbox\normalhbox\bgroup} - -\def\stopvboxtohbox - {\egroup - \dp\scratchbox\zeropoint - \ht\scratchbox\normalvboxtohboxfactor\wd\scratchbox - \box\scratchbox - \egroup} - -% % to be done: start halfway a line combined with one line -% % extra to start with (skip) and one line less than counted. -% -% \def\stopvboxtohbox% -% {\egroup -% \setbox2=\normalvbox -% {\forgetall\unhcopy0\par\xdef\globalvhlines{\the\prevgraf}}% -% \setbox2=\normalvbox -% {\unvbox2 -% \setbox2=\lastbox -% \setbox2=\normalhbox{\unhbox2}% -% \xdef\globalvhwidth{\the\wd2}}% -% \decrement\globalvhlines -% \dimen0=\globalvhwidth -% \dimen0=\normalvboxtohboxfactor\dimen0 -% \advance\dimen0 by \globalvhlines\lineheight -% \dp0=\zeropoint -% \ht0=\dimen0 -% %\writestatus{guessed size} -% % {w:\the\wd0\space\space -% % b:\the\baselineskip\space -% % l:\globalvhlines\space -% % e:\globalvhwidth\space -% % h:\the\dimen0}% -% \box0 -% \egroup} - -% todo: \scratchbox - -\def\convertvboxtohbox - {\setvboxtohbox - \makehboxofhboxes - \setbox0\normalhbox{\unhbox0 \removehboxes}% - \noindent\unhbox0\par} - -\def\makehboxofhboxes - {\setbox0\normalhbox{}% - \loop % \doloop { .. \exitloop .. } - \setbox2\lastbox - \ifhbox2 - \setbox0\normalhbox{\box2\unhbox0}% - \repeat} - -% \def\makehboxofhboxes -% {\setbox0\normalhbox{}% -% \doloop % \doloop { .. \exitloop .. } -% {% \dorecurse{3}{\unskip\unpenalty}% get rid of ... (better do this in a shapeloop) -% \setbox2\lastbox -% \ifhbox2 -% \setbox0\normalhbox{\box2\unhbox0}% -% \else -% \exitloop -% \fi}} - -% \def\flushboxesonly % feed this into \makehboxofhboxes -% {\dowithnextbox -% {\beginofshapebox -% \unvbox\nextbox -% \endofshapebox -% \doreshapebox{\box\shapebox}{}{}{}% get rid of penalties etc -% \innerflushshapebox} -% \vbox} - -\def\removehboxes - {\setbox0\lastbox - \ifhbox0 - {\removehboxes}\unhbox0 - \fi} - -%D \macros -%D {unhhbox} -%D -%D The next macro is used in typesetting inline headings. -%D Let's first look at the macro and then show an example. - -\newbox \unhhedbox -\newbox \hhbox -\newdimen \lasthhboxwidth -\newskip \hhboxindent - -\def\unhhbox#1\with#2% - {\bgroup - \nopenalties - \dontcomplain - \forgetall - \setbox\unhhedbox\normalvbox{\hskip\hhboxindent\strut\unhbox#1}% => \hsize - \doloop - {\setbox\hhbox\vsplit\unhhedbox to \lineheight - \ifvoid\unhhedbox - \setbox\hhbox\normalhbox{\strut\normalhboxofvbox\hhbox}% - \fi - \ht\hhbox\strutht - \dp\hhbox\strutdp - \ifzeropt\hhboxindent\else % \ifdim\hhboxindent=\zeropoint\else - \setbox\hhbox\normalhbox{\hskip-\hhboxindent\box\hhbox}% - \hhboxindent\zeropoint - \fi - \global\lasthhboxwidth\wd\hhbox - #2\relax - \ifvoid\unhhedbox - \exitloop - \else - \hskip\zeropoint \!!plus \zeropoint - \fi}% - \egroup} - -\def\dohboxofvbox - {\setbox0\normalvbox{\unvbox\scratchcounter\global\setbox1\lastbox}% - \unhbox1 - \egroup} - -\def\normalhboxofvbox - {\bgroup - \afterassignment\dohboxofvbox - \scratchcounter=} - -%D This macro can be used to break a paragraph apart and treat -%D each line seperately, for instance, making it clickable. The -%D main complication is that we want to be able to continue the -%D paragraph, something that's needed in the in line section -%D headers. -%D -%D \startbuffer -%D \setbox0=\normalhbox{\input tufte \relax} -%D \setbox2=\normalhbox{\input knuth \relax} -%D \unhhbox0\with{\ruledhbox{\box\hhbox}} -%D \hskip1em plus 1em minus 1em -%D \hhboxindent=\lasthhboxwidth -%D \advance\hhboxindent by \lastskip -%D \unhhbox2\with{\ruledhbox{\box\hhbox}} -%D \stopbuffer -%D -%D \getbuffer -%D -%D This piece of text was typeset by saying: -%D -%D \typebuffer -%D -%D Not that nice a definition, but effective. Note the stretch -%D we've build in the line that connects the two paragraphs. - -%D \macros -%D {doifcontent} -%D -%D When processing depends on the availability of content, one -%D can give the next macro a try. -%D -%D \starttyping -%D \doifcontent{pre content}{post content}{no content}\somebox -%D \stoptyping -%D -%D Where \type{\somebox} is either a \type{\normalhbox} or -%D \type{\normalvbox}. If the dimension of this box suggest some -%D content, the resulting box is unboxed and surrounded by the -%D first two arguments, else the third arguments is executed. - -\unexpanded\def\doifcontent#1#2#3% - {\dowithnextbox - {\ifhbox\nextbox - \ifdim\nextboxwd>\zeropoint - #1\unhbox\nextbox#2\relax - \else - #3\relax - \fi - \else - \ifdim\nextboxht>\zeropoint - #1\unvbox\nextbox#2\relax - \else - #3\relax - \fi - \fi}} - -%D So when we say: -%D -%D \startbuffer -%D \doifcontent{[}{]}{}\normalhbox{content sensitive typesetting} -%D -%D \doifcontent{}{\page}{}\normalvbox{content sensitive typesetting} -%D -%D \doifcontent{}{}{\message{Didn't you forget something?}}\normalhbox{} -%D \stopbuffer -%D -%D \typebuffer -%D -%D We get: -%D -%D \getbuffer -%D -%D Where the last call of course does not show up in this -%D document, but definitely generates a confusing message. - -%D \macros -%D {processboxes} -%D -%D The next macro gobble boxes and is for instance used for -%D overlays. First we show the general handler. - -\newbox\processbox - -\def\processboxes#1% - {\bgroup - \def\doprocessbox{#1}% #1 can be redefined halfway - \resetbox\processbox - \afterassignment\dogetprocessbox\let\next=} - -\def\endprocessboxes - {\ifhmode\unskip\fi - \box\processbox - \next - \egroup} - -\def\dogetprocessbox - {\ifx\next\bgroup - \expandafter\dodogetprocessbox - \else - \expandafter\endprocessboxes - \fi} - -\def\dodogetprocessbox - {\dowithnextbox - {\ifhmode\unskip\fi\doprocessbox % takes \nextbox makes \processbox - \afterassignment\dogetprocessbox\let\next=} - \normalhbox\bgroup} - -%D \macros -%D {startoverlay} -%D -%D We can overlay boxes by saying: -%D -%D \startbuffer -%D \startoverlay -%D {\framed{hans}} -%D {\framed[width=3cm]{ton}} -%D {\framed[height=2cm]{oeps}} -%D \stopoverlay -%D \stopbuffer -%D -%D \typebuffer -%D -%D shows up as: -%D -%D \leavevmode\getbuffer - -% \def\dooverlaybox% -% {\ifhmode\unskip\fi -% \ifdim\nextboxht>\ht\processbox -% \setbox\processbox\normalvbox to \nextboxht -% {\vss\box\processbox\vss}% -% \else -% \setbox\nextbox\normalvbox to \ht\processbox -% {\vss\flushnextbox\vss}% -% \fi -% \scratchdimen=\wd -% \ifdim\nextboxwd>\wd\processbox -% \nextbox -% \else -% \processbox -% \fi -% \setbox\processbox=\normalhbox to \scratchdimen -% {\normalhbox to \scratchdimen{\hss\box\processbox\hss}% -% \hskip-\scratchdimen -% \normalhbox to \scratchdimen{\hss\flushnextbox\hss}}} -% -% \def\startoverlay% -% {\bgroup -% \let\stopoverlay\egroup -% \processboxes\dooverlaybox} - -\def\dooverlaybox - {\ifhmode\unskip\fi - \scratchdimen\dp - \ifdim\nextboxdp>\dp\processbox - \nextbox - \else - \processbox - \fi - \ifdim\nextboxht>\ht\processbox - \setbox\processbox\normalvbox to \nextboxht - {\dp\processbox\zeropoint\vss\box\processbox\vss}% - \else - \setbox\nextbox\normalvbox to \ht\processbox - {\nextboxdp\zeropoint\vss\flushnextbox\vss}% - \fi - \nextboxdp\scratchdimen - \dp\processbox\scratchdimen - \scratchdimen\wd - \ifdim\nextboxwd>\wd\processbox - \nextbox - \else - \processbox - \fi - \setbox\processbox\normalhbox to \scratchdimen - {\normalhbox to \scratchdimen{\hss\box\processbox\hss}% - \hskip-\scratchdimen - \normalhbox to \scratchdimen{\hss\flushnextbox\hss}}} - -\unexpanded\def\startoverlay - {\bgroup - \let\stopoverlay\egroup - \processboxes\dooverlaybox} - -\let\stopoverlay\relax - -% %D \macros -% %D {starthspread} -% %D -% %D In a similar way we can build a horizontal box, spread -% %D over the available width. -% %D -% %D \startbuffer -% %D \starthspread -% %D {hans} -% %D {ton} -% %D {oeps} -% %D \stophspread -% %D -% %D \stopbuffer -% %D -% %D \typebuffer -% %D -% %D shows up as: -% %D -% %D \leavevmode\getbuffer -% -% \def\dohspread -% {\flushnextbox -% \def\dohspread{\hfil\flushnextbox}} -% -% \def\starthspread -% {\normalhbox to \hsize \bgroup -% \let\stophspread\egroup -% \processboxes\dohspread} - -%D \macros -%D {fakebox} -%D -%D The next macro is a rather silly one, but saves space. -%D -%D \starttyping -%D \normalhbox{\fakebox0} -%D \stoptyping -%D -%D returns an empty box with the dimensions of the box -%D specified, here being zero. - -\def\dofakebox - {\setbox\scratchbox\null - \wd\scratchbox\wd\scratchcounter - \ht\scratchbox\ht\scratchcounter - \dp\scratchbox\dp\scratchcounter - \ifhbox\scratchcounter\normalhbox\else\normalvbox\fi{\box\scratchbox}% - \egroup} - -\def\fakebox - {\bgroup - \afterassignment\dofakebox\scratchcounter} - -%D \macros -%D {lbox,rbox,cbox,tbox,bbox} -%D -%D Here are some convenient alternative box types: -%D -%D \starttyping -%D \lbox{text ...} -%D \cbox{text ...} -%D \rbox{text ...} -%D \stoptyping -%D -%D Are similar to \type {\normalvbox}, which means that they also -%D accept something like \type{to 3cm}, but align to the left, -%D middle and right. These box types can be used to typeset -%D paragraphs. - -\def\lbox{\makelrcbox\normalvbox\raggedleft} -\def\cbox{\makelrcbox\normalvbox\raggedcenter} -\def\rbox{\makelrcbox\normalvbox\raggedright} - -\def\ltop{\makelrcbox\normalvtop\raggedleft} -\def\ctop{\makelrcbox\normalvtop\raggedcenter} -\def\rtop{\makelrcbox\normalvtop\raggedright} - -\def\makelrcbox#1#2#3#% - {#1#3\bgroup \forgetall \let\\=\endgraf #2\let\next=} - -%D The alternatives \type {\tbox} and \type {\bbox} can be used -%D to properly align boxes, like in: -%D -%D \setupexternalfigures[directory={../sample}] -%D \startbuffer -%D \starttable[|||] -%D \HL -%D \VL \tbox{\externalfigure[cow][height=3cm,frame=on]} \VL top aligned \VL\SR -%D \HL -%D \VL \bbox{\externalfigure[cow][height=3cm,frame=on]} \VL bottom aligned \VL\SR -%D \HL -%D \stoptable -%D \stopbuffer -%D -%D \typebuffer -%D -%D The positioning depends on the strut settings: -%D -%D \getbuffer - -\def\tbox{\tbbox\ht\dp} -\def\bbox{\tbbox\dp\ht} - -\def\tbbox#1#2% - {\normalhbox\bgroup - \dowithnextbox - {\scratchdimen\nextboxht - \advance\scratchdimen\nextboxdp - \advance\scratchdimen-#1\strutbox - #1\nextbox#1\strutbox - #2\nextbox\scratchdimen - \setbox\nextbox\normalhbox - {\lower\nextboxdp\flushnextbox}% - #1\nextbox#1\strutbox - #2\nextbox\scratchdimen - \flushnextbox - \egroup} - \normalhbox} - -%D \macros -%D {lhbox,mhbox,rhbox} -%D -%D A few more boxes. - -\def\dodolhbox{\normalhbox to \hsize{\flushnextbox\hss }} -\def\dodomhbox{\normalhbox to \hsize{\hss\flushnextbox\hss}} -\def\dodorhbox{\normalhbox to \hsize{\hss\flushnextbox }} - -\def\lhbox{\dowithnextboxcs\dodolhbox\normalhbox} -\def\mhbox{\dowithnextboxcs\dodomhbox\normalhbox} -\def\rhbox{\dowithnextboxcs\dodorhbox\normalhbox} - -\let\lefthbox \lhbox -\let\midhbox \mhbox -\let\righthbox\rhbox - -%D \macros -%D {boxofsize} -%D -%D Sometimes we need to construct a box with a height or -%D width made up of several dimensions. Instead of cumbersome -%D additions, we can use: -%D -%D \starttyping -%D \boxofsize \normalvbox 10cm 3cm -5cm {the text to be typeset} -%D \stoptyping -%D -%D This example demonstrates that one can use positive and -%D negative values. Dimension registers are also accepted. - -\newdimen\sizeofbox - -\def\boxofsize#1% - {\bgroup - \sizeofbox\zeropoint - \scratchdimen\zeropoint - \def\docommand - {\advance\sizeofbox\scratchdimen - \futurelet\next\dodocommand}% - \def\dodocommand - {\ifx\next\bgroup - \expanded{\egroup#1 to \the\sizeofbox}% - \else - \@EA\afterassignment\@EA\docommand\@EA\scratchdimen - \fi}% - \docommand} - -%D Some new, still undocumented features: - -% limitatetext -> beter {text} als laatste !! -% -% \limitvbox -% \limithbox - -\def\limitatelines#1#2% size sentinel - {\dowithnextbox - {\dimen0=#1\hsize - \ifdim\nextboxwd>\dimen0 - \setbox\nextbox\normalhbox - {\advance\dimen0 -.1\hsize - \limitatetext{\unhbox\nextbox}{\dimen0}{\nobreak#2}}% - \fi - \unhbox\nextbox} - \normalhbox} - -\def\fittoptobaselinegrid % weg hier - {\dowithnextbox - {\bgroup - \par - \dimen0\nextboxht - \nextboxht\strutht - \nextboxdp\strutdp - \normalhbox{\flushnextbox} - \prevdepth\strutdp - \doloop - {\advance\dimen0 -\lineheight - \ifdim\dimen0<\zeropoint - \exitloop - \else - \nobreak - \normalhbox{\strut} - \fi} - \egroup} - \normalvbox} - -%D Some more undocumented macros (used in m-chart). - -\newif\iftraceboxplacement % \traceboxplacementtrue - -\newbox\fakedboxcursor - -\setbox\fakedboxcursor\normalhbox - {\vrule\!!width\zeropoint\!!height\zeropoint\!!depth\zeropoint} - -\def\boxcursor % overloaded in core-vis - {\iftraceboxplacement - \bgroup - \scratchdimen2pt - \setbox\scratchbox\normalhbox to \zeropoint - {\hss - \vrule - \!!width \scratchdimen - \!!height\scratchdimen - \!!depth \scratchdimen - \hss}% - \smashedbox\scratchbox - \egroup - \else - \copy\fakedboxcursor - \fi} - -\def\placedbox - {\iftraceboxplacement\ruledhbox\else\normalhbox\fi} - -\newdimen\boxoffset -\newdimen\boxhdisplacement -\newdimen\boxvdisplacement - -%\def\rightbox#1% -% {\normalhbox -% {\setbox0=\placedbox{#1}% -% \dimen0=.5\ht0\advance\dimen0 -.5\dp0 -% \boxcursor\hskip\boxoffset\lower\dimen0\box0}} - -\def\rightbox#1% - {\normalhbox - {\setbox0\placedbox{#1}% - \global\boxhdisplacement\boxoffset - \global\boxvdisplacement.5\ht0 - \global\advance\boxvdisplacement-.5\dp0 - \boxcursor\hskip\boxhdisplacement\lower\boxvdisplacement\box0}} - -%\def\leftbox#1% -% {\normalhbox -% {\setbox0=\placedbox{#1}% -% \dimen0=.5\ht0\advance\dimen0 -.5\dp0 -% \boxcursor\hskip-\wd0\hskip-\boxoffset\lower\dimen0\box0}} - -\def\leftbox#1% - {\normalhbox - {\setbox0\placedbox{#1}% - \global\boxhdisplacement-\wd0 - \global\advance\boxhdisplacement-\boxoffset - \global\boxvdisplacement.5\ht0 - \global\advance\boxvdisplacement-.5\dp0 - \boxcursor\hskip\boxhdisplacement\lower\boxvdisplacement\box0}} - -%\def\topbox#1% -% {\normalhbox -% {\setbox0=\placedbox{#1}% -% \dimen0=\boxoffset\advance\dimen0 \dp0 -% \boxcursor\hskip-.5\wd0\raise\dimen0\box0}} - -\def\topbox#1% - {\normalhbox - {\setbox0\placedbox{#1}% - \global\boxhdisplacement-.5\wd0 - \global\boxvdisplacement-\dp0 - \global\advance\boxvdisplacement-\boxoffset - \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}} - -%\def\bottombox#1% -% {\normalhbox -% {\setbox0=\placedbox{#1}% -% \dimen0=\boxoffset\advance\dimen0 \ht0 -% \boxcursor\hskip-.5\wd0\lower\dimen0\box0}} - -\def\bottombox#1% - {\normalhbox - {\setbox0\placedbox{#1}% - \global\boxhdisplacement-.5\wd0 - \global\boxvdisplacement\ht0 - \global\advance\boxvdisplacement\boxoffset - \boxcursor\hskip\boxhdisplacement\lower\boxvdisplacement\box0}} - -%\def\lefttopbox#1% -% {\normalhbox -% {\setbox0=\placedbox{#1}% -% \dimen0=\boxoffset\advance\dimen0 \dp0 -% \advance\boxoffset\wd0 -% \boxcursor\hskip-\boxoffset\raise\dimen0\box0}} - -\def\lefttopbox#1% - {\normalhbox - {\setbox0\placedbox{#1}% - \global\boxhdisplacement-\wd0 - \global\advance\boxhdisplacement-\boxoffset - \global\boxvdisplacement-\dp0 - \global\advance\boxvdisplacement-\boxoffset - \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}} - -%\def\righttopbox#1% -% {\normalhbox -% {\setbox0=\placedbox{#1}% -% \dimen0=\boxoffset\advance\dimen0 \dp0 -% \boxcursor\hskip\boxoffset\raise\dimen0\box0}} - -\def\righttopbox#1% - {\normalhbox - {\setbox0\placedbox{#1}% - \global\boxhdisplacement\boxoffset - \global\boxvdisplacement-\dp0 - \global\advance\boxvdisplacement-\boxoffset - \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}} - -%\def\leftbottombox#1% -% {\normalhbox -% {\setbox0=\placedbox{#1}% -% \dimen0=\boxoffset\advance\dimen0 \ht0 -% \advance\boxoffset\wd0 -% \boxcursor\hskip-\boxoffset\lower\dimen0\box0}} - -\def\leftbottombox#1% - {\normalhbox - {\setbox0\placedbox{#1}% - \global\boxhdisplacement-\wd0 - \global\advance\boxhdisplacement-\boxoffset - \global\boxvdisplacement\ht0 - \global\advance\boxvdisplacement\boxoffset - \boxcursor\hskip\boxhdisplacement\lower\boxvdisplacement\box0}} - -%\def\rightbottombox#1% -% {\normalhbox -% {\setbox0=\placedbox{#1}% -% \dimen0=\boxoffset\advance\dimen0 \ht0 -% \boxcursor\hskip\boxoffset\lower\dimen0\box0}} - -\def\rightbottombox#1% - {\normalhbox - {\setbox0\placedbox{#1}% - \global\boxhdisplacement\boxoffset - \global\boxvdisplacement\ht0 - \global\advance\boxvdisplacement\boxoffset - \boxcursor\hskip\boxhdisplacement\lower\boxvdisplacement\box0}} - -\let\topleftbox \lefttopbox -\let\toprightbox \righttopbox -\let\bottomleftbox \leftbottombox -\let\bottomrightbox\rightbottombox - -\def\middlebox#1% - {\normalhbox{\setbox0\placedbox{#1}\boxoffset=-.5\wd0\rightbox{\box0}}} - -\def\baselinemiddlebox#1% - {\normalhbox - {\setbox0\placedbox{#1}% - \global\boxhdisplacement-.5\wd0 - \global\advance\boxhdisplacement-\boxoffset - \global\boxvdisplacement-\boxoffset - \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}} - -\def\baselineleftbox#1% - {\normalhbox - {\setbox0\placedbox{#1}% - \global\boxhdisplacement-\wd0 - \global\advance\boxhdisplacement-\boxoffset - \global\boxvdisplacement-\boxoffset - \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}} - -\def\baselinerightbox#1% - {\normalhbox - {\setbox0\placedbox{#1}% - \global\boxhdisplacement\boxoffset - \global\boxvdisplacement-\boxoffset - \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}} - -%D \macros -%D {obox} -%D -%D Experimental, not yet frozen: - -\def\lrtbbox#1#2#3#4% l r t b - {\bgroup - \dowithnextboxcontent - {\advance\hsize-#1\advance\hsize-#2\advance\vsize-#3\advance\vsize-#4\relax} - {\forgetall\vbox to \vsize{\vskip#3\hbox to \hsize{\hskip#1\box\nextbox\hss}\vss}\egroup} - \vbox} - -%D \macros -%D {toplinebox} -%D -%D See core-tbl.tex for an example of its usage: - -\def\toplinebox - {\dowithnextbox - {\ifdim\nextboxdp>\strutdepth - \scratchdimen\nextboxdp - \advance\scratchdimen-\strutdepth - \getnoflines\scratchdimen - \struttedbox{\flushnextbox}% - \dorecurse\noflines\verticalstrut - \else - \flushnextbox - \fi}% - \tbox} - -%D \macros -%D {initializeboxstack,savebox,foundbox} -%D -%D At the cost of some memory, but saving box registers, we -%D have implemented a box repository. -%D -%D \starttyping -%D \initializeboxstack{one} -%D -%D \savebox{one}{a}{test a} -%D \savebox{one}{p}{test p} -%D \savebox{one}{q}{test q} -%D -%D \normalhbox{a:\foundbox{one}{a}} \par -%D \normalhbox{q:\foundbox{one}{q}} \par -%D \normalhbox{p:\foundbox{one}{p}} \par -%D \normalhbox{x:\foundbox{one}{x}} \par -%D \normalhbox{y:\foundbox{two}{a}} \par -%D \stoptyping - -% we keep it around as a demonstration of good old tex code: -% -% \def\@@stackbox{boxstack:b:} -% \def\@@stackmax{boxstack:m:} -% \def\@@stacktag{boxstack:t:} -% \def\@@stacklst{boxstack:l:} -% -% \def\initializeboxstack#1% -% {\ifundefined{\@@stackbox#1}% -% \@EA\newbox\csname\@@stackbox#1\endcsname -% \else -% \global\setbox\csname\@@stackbox#1\endcsname\normalvbox{}% -% \def\docommand##1{\global\letbeundefined{\@@stacktag#1:##1}}% -% \processcommacommand[\getvalue{\@@stacklst#1}]\docommand -% \fi -% \global\letvalue{\@@stacklst#1}\empty -% \global\letvalue{\@@stackmax#1}\!!zeropoint} -% -% \def\savebox#1#2% stack name -% {\dowithnextbox -% {\doifdefined{\@@stackbox#1} -% {\@EA\doglobal\@EA\increment\csname\@@stackmax#1\endcsname -% \setxvalue{\@@stacktag#1:#2}{\csname\@@stackmax#1\endcsname}% -% \setxvalue{\@@stacklst#1}{\getvalue{\@@stacklst#1},#2}% -% \global\setbox\csname\@@stackbox#1\endcsname\normalvbox -% {\forgetall -% \setbox\scratchbox\normalvbox{\flushnextbox} -% \ht\scratchbox\onepoint -% \dp\scratchbox\zeropoint -% \unvbox\csname\@@stackbox#1\endcsname -% \offinterlineskip -% \allowbreak -% \box\scratchbox}}}% -% \normalvbox} -% -% \def\foundbox#1#2% -% {\normalvbox -% {\doifdefined{\@@stackbox#1} -% {\doifdefined{\@@stacktag#1:#2} -% {\setbox\scratchbox\normalvbox -% {\splittopskip\zeropoint -% \setbox0\copy\csname\@@stackbox#1\endcsname -% \dimen0=\getvalue{\@@stacktag#1:#2}\points -% \advance\dimen0 -\onepoint -% \setbox2\vsplit0 to \dimen0 -% \ifdim\ht0>\onepoint -% \setbox0\vsplit0 to \onepoint -% \fi -% \unvbox0\setbox0\lastbox\unvbox0}% -% \unvbox\scratchbox}}}} -% -% \def\doifboxelse#1#2% -% {\doifdefinedelse{\@@stacktag#1:#2}} - -\def\@@stackbox{@box@} -\def\@@stacklst{@xob@} - -\def\setstackbox#1#2% - {\ifcsname\@@stackbox:#1:#2\endcsname\else - \expandafter\newbox\csname\@@stackbox:#1:#2\endcsname - \fi - \global\setbox\csname\@@stackbox:#1:#2\endcsname\normalvbox} - -\def\initializeboxstack#1% - {\def\docommand##1{\setstackbox{#1}{##1}{}}% - \ifcsname\@@stacklst#1\endcsname - \processcommacommand[\getvalue{\@@stacklst#1}]\docommand - \fi - \global\letvalue{\@@stacklst#1}\empty} - -\def\savebox#1#2% stack name - {% beware, \setxvalue defines the cs beforehand so we cannot use the - % test inside the { } - \ifcsname\@@stacklst#1\endcsname - \setxvalue{\@@stacklst#1}{\csname\@@stacklst#1\endcsname,#2}% - \else - \setxvalue{\@@stacklst#1}{#2}% - \fi - \setstackbox{#1}{#2}} - -\def\foundbox#1#2% - {\normalvbox - {\ifcsname\@@stackbox:#1:#2\endcsname - \copy\csname\@@stackbox:#1:#2\endcsname - \fi}} - -\long\def\doifboxelse#1#2#3#4% - {\ifcsname\@@stackbox:#1:#2\endcsname - \ifvoid\csname\@@stackbox:#1:#2\endcsname#4\else#3\fi - \else - #4% - \fi} - -\endETEX - -%D \macros -%D {removedepth, obeydepth} -%D -%D While \type {\removedepth} removes the preceding depth, -%D \type {\obeydepth} makes sure we have depth. Both macros -%D leave the \type {\prevdepth} untouched. - -\def\removedepth - {\ifvmode \ifdim\prevdepth>\zeropoint \kern-\prevdepth \fi \fi} - -\def\obeydepth - {\par \removedepth \ifvmode \kern\strutdp \fi} - -\def\undepthed - {\dowithnextbox{\nextboxdp\zeropoint\flushnextbox}\hbox} - -%D \macros -%D {removebottomthings, removelastskip} -%D -%D A funny (but rather stupid) one, plus a redefinition. - -\def\removebottomthings - {\dorecurse5{\unskip\unkern\unpenalty}} - -\def\removelastskip % \ifvmode the plain tex one \fi -% {\ifvmode\ifdim\lastskip=\zeropoint\else\vskip-\lastskip\fi\fi} - {\ifvmode\ifzeropt\lastskip\else\vskip-\lastskip\fi\fi} - -%D \macros -%D {makestrutofbox} -%D -%D This macro sets the dimensions of a box to those of a -%D strut. - -\def\domakestrutofbox - {\ht\registercount\strutht - \dp\registercount\strutdp - \wd\registercount\zeropoint} - -\def\makestrutofbox - {\afterassignment\domakestrutofbox\registercount} - -%D \macros -%D {raisebox,lowerbox} -%D -%D Some more box stuff, related to positioning (under -%D construction). Nice stuff for a tips and tricks maps -%D article. -%D -%D \starttyping -%D \raisebox{100pt}\normalhbox{test} -%D \raisebox50pt\normalhbox{test} -%D \hsmash{\raisebox{100pt}\normalhbox{test}} -%D \stoptyping - -\def\doraiselowerbox#1#2% a nice trick us used to accept - {\def\next % both direct and {} dimensions - {\dowithnextbox - {\setbox\nextbox\normalhbox{#1\scratchdimen\flushnextbox}% - \nextboxht\strutht - \nextboxdp\strutdp - \flushnextbox}}% - \afterassignment\next\scratchdimen=#2} - -\def\raisebox{\doraiselowerbox\raise} -\def\lowerbox{\doraiselowerbox\raise} - -% maybe some day we need this -% -% \def\appendvbox#1% % uses \box8 -% {\bgroup -% \ifdim\prevdepth<\zeropoint -% \ifdim\pagetotal=\zeropoint -% \setbox8=\normalvtop{\unvcopy#1}% -% \hrule\c!!height\zeropoint -% \kern-\ht8 -% \box#1\relax -% \else -% \box#1\relax -% \fi -% \else -% \dimen0=\prevdepth -% \hrule\c!!height\zeropoint -% \setbox8=\normalvtop{\unvcopy#1}% -% \dimen2=\baselineskip -% \advance\dimen2 by -\dimen0 -% \advance\dimen2 by -\ht8 -% \kern\dimen2 -% \box#1\relax -% \fi -% \egroup} - -% %D Also new: -% %D -% %D \startbuffer -% %D \normbox[1cm][bba]{m} % b(efore) a(fter) v(box) s(trut) f(rame) -% %D \normbox[1cm][bba]{m} -% %D \normbox[1cm][bba]{m} -% %D \stopbuffer -% %D -% %D \typebuffer -% %D \getbuffer -% -% \def\dodonormbox#1#2#3#4#5#6#7% -% {\doifnumberelse{#1} -% {\dimen0=#1}{\setbox0=#3{#1}\dimen0=#50}% -% \doifinstringelse{f}{#2} -% {\let\next#4}{\let\next#3}% -% \next to \dimen0 -% {\counttoken b\in#2\to\!!counta\dorecurse{\!!counta}{#6}#6% -% #7\nextbox -% \counttoken a\in#2\to\!!counta\dorecurse{\!!counta}{#6}#6}} -% -% \def\donormbox[#1][#2]% -% {\bgroup -% \doifinstringelse{v}{#2} -% {\let\next\normalvbox} -% {\let\next\normalhbox}% -% \dowithnextbox -% {\ifvbox\nextbox -% \let\\=\par -% \dodonormbox{#1}{#2}\normalvbox\ruledvbox\ht\vfil\unvbox -% \else -% \let\\=\space -% \dodonormbox{#1}{#2}\normalhbox\ruledhbox\wd\hfil\unhbox -% \fi -% \egroup}% -% \next} -% -% \def\normbox -% {\dodoubleempty\donormbox} - -% vcenter in text, we kunnen vcenter overloaden - -\def\halfwaybox - {\dowithnextbox - {\nextboxdp\zeropoint - \setbox\nextbox\normalhbox{\lower.5\nextboxht\flushnextbox}% - \flushnextbox} - \normalhbox} - -%D New: - -\def\setdimentoatleast#1#2% - {\ifdim#1>\zeropoint\else#1=#2\fi} - -%D And even rawer: - -\let\naturalhbox \normalhbox -\let\naturalvbox \normalvbox -\let\naturalvtop \normalvtop -\let\naturalvcenter \normalvtop - -\ifdefined\textdir - - \def\naturalhbox{\normalhbox dir TLT} - \def\naturalvbox{\normalvbox dir TLT} - %def\naturalvtop{\normalvtop dir TLT} - -\fi - -%D \macros -%D {vcenter} -%D -%D Also new: tex mode \type {\vcenter}. - -\let\verynormalvcenter \vcenter % since \vcenter can be visualized - -\def\vcenter - {\normalvbox\bgroup - \dowithnextbox{\normalhbox{$\verynormalvcenter{\flushnextbox}$}\egroup} - \normalvbox} - -% could be \everymathematics - -\prependtoks \let\vcenter\normalvcenter \to \everymath -\prependtoks \let\vcenter\normalvcenter \to \everydisplay - -%D \macros -%D {frozenhbox} -%D -%D A not so well unhboxable bxo can be made with: - -\def\frozenhbox - {\hbox\bgroup\dowithnextbox{\hbox{\hbox{\flushnextbox}}\egroup}\hbox} - -%D \macros -%D {setboxllx,setboxlly,gsetboxllx,gsetboxlly,getboxllx,getboxlly} -%D -%D A prelude to an extended \TEX: - -% \def\setboxllx #1#2{\bgroup\scratchdimen#2\expanded{\egroup\noexpand\setevalue{b@@x\number#1}{\the\scratchdimen}}} -% \def\setboxlly #1#2{\bgroup\scratchdimen#2\expanded{\egroup\noexpand\setevalue{b@@y\number#1}{\the\scratchdimen}}} -% -% \def\gsetboxllx#1#2{\bgroup\scratchdimen#2\setxvalue{b@@x\number#1}{\the\scratchdimen}\egroup} -% \def\gsetboxlly#1#2{\bgroup\scratchdimen#2\setxvalue{b@@y\number#1}{\the\scratchdimen}\egroup} - -\def\setboxllx#1#2{\setevalue{b@@x\number#1}{\the\dimexpr#2\relax}} -\def\setboxlly#1#2{\setevalue{b@@y\number#1}{\the\dimexpr#2\relax}} - -\def\gsetboxllx{\global\setboxllx} -\def\gsetboxlly{\global\setboxlly} - -\def\getboxllx#1{\executeifdefined{b@@x\number#1}\zeropoint} -\def\getboxlly#1{\executeifdefined{b@@y\number#1}\zeropoint} - -%D \macros -%D {shownextbox} -%D -%D Handy for tracing -%D -%D \starttyping -%D \shownextbox\vbox{test} -%D \shownextbox\vbox{test\endgraf} -%D \shownextbox\vbox{test\endgraf\strut\endgraf} -%D \shownextbox\vbox{test\endgraf\thinrule} -%D \shownextbox\vbox{\setupwhitespace[big]test\endgraf\thinrule} -%D \stoptyping - -\def\shownextbox - {\dowithnextbox - {\bgroup - \showboxbreadth\maxdimen - \showboxdepth \maxdimen - \scratchcounter\interactionmode - \batchmode - \showbox\nextbox - \box\nextbox - \interactionmode\scratchcounter - \egroup}} - -\def\spreadhbox#1% rebuilds \hbox{} - {\bgroup - \ifhbox#1\relax - \setbox2\emptybox - \unhbox#1% - \doloop - {\unpenalty\unskip\unpenalty\unskip\unpenalty\unskip - \setbox0\lastbox - \ifvoid0 - \exitloop - \else - \setbox2\hbox - {\ifhbox0 \spreadhbox0\else\box0\fi - \ifvoid2 \else\hss\unhbox2\fi}% - \fi}% - \ifvoid2\else\unhbox2\fi - \else - \box#1% - \fi - \egroup} - -% makes sense but too much log for overfull boxes: -% -% \showboxbreadth\maxdimen -% \showboxdepth \maxdimen - -\protect \endinput - -% a bit of test code: - -\hbox \bgroup - \ruledvbox {\hbox{\strut gans}} - \ruledvbox to \lineheight {\hbox{\strut gans}} - \ruledvbox to \lineheight {\hbox {gans}} - \ruledvbox to \strutheight{\hbox {gans}} - \ruledvbox to \strutheight{\hbox{\strut gans}} - \ruledvbox to \strutheight{\vss\hbox{gans}} -\egroup diff --git a/Master/texmf-dist/tex/context/base/supp-dir.mkiv b/Master/texmf-dist/tex/context/base/supp-dir.mkiv index 0634bd36f34..dce47a1784d 100644 --- a/Master/texmf-dist/tex/context/base/supp-dir.mkiv +++ b/Master/texmf-dist/tex/context/base/supp-dir.mkiv @@ -18,6 +18,17 @@ % \expanded{\defineactivecharacter \number"2000E} {\textdir TRT\relax} % \expanded{\defineactivecharacter \number"2000F} {\textdir TLT\relax} +%D As we have less directions now we can use something + +% \chardef\@@D@@TLT0 +% \chardef\@@D@@TRT1 +% \chardef\@@D@@RTT0 +% \chardef\@@D@@LRL1 +% +% \def\thetextdir{\csname @@D@@\the\textdir\endcsname} +% +% \ifnum\thetextdir=0 L\else R\fi \textdir TRT \ifnum\thetextdir=0 L\else R\fi + \unexpanded\def\showdirsinmargin {\doifelse{\the\pardir}\!!TLT {\inleft{\normalexpanded{\noexpand\hbox dir TLT{\ttxx[\the\pardir,\the\textdir]}}}} diff --git a/Master/texmf-dist/tex/context/base/supp-fil.lua b/Master/texmf-dist/tex/context/base/supp-fil.lua index 8d69f64a72c..a2c0b5d7daa 100644 --- a/Master/texmf-dist/tex/context/base/supp-fil.lua +++ b/Master/texmf-dist/tex/context/base/supp-fil.lua @@ -6,6 +6,11 @@ if not modules then modules = { } end modules ['supp-fil'] = { license = "see context related readme files" } +-- This module will be redone ! + +-- context is not defined yet! todo! (we need to load tupp-fil after cld) +-- todo: move startreadingfile to lua and push regime there + --[[ldx--

It's more convenient to manipulate filenames (paths) in than in . These methods have counterparts @@ -13,25 +18,34 @@ at the side.

--ldx]]-- local find, gsub, match, format, concat = string.find, string.gsub, string.match, string.format, table.concat -local texsprint, texwrite, ctxcatcodes = tex.sprint, tex.write, tex.ctxcatcodes +local texcount = tex.count +local isfile = lfs.isfile -local trace_modules = false trackers.register("modules.loading", function(v) trace_modules = v end) +local trace_modules = false trackers.register("modules.loading", function(v) trace_modules = v end) +local trace_files = false trackers.register("resolvers.readfile", function(v) trace_files = v end) -support = support or { } -environment = environment or { } +local report_modules = logs.reporter("resolvers","modules") +local report_files = logs.reporter("files","readfile") -environment.outputfilename = environment.outputfilename or environment.jobname +commands = commands or { } +local commands = commands +environment = environment or { } +local environment = environment -function support.checkfilename(str) -- "/whatever..." "c:..." "http://..." - commands.chardef("kindoffile",boolean.tonumber(find(str,"^/") or find(str,"[%a]:"))) +local findbyscheme = resolvers.finders.byscheme + +function commands.checkfilename(str) -- "/whatever..." "c:..." "http://..." + texcount.kindoffile = (find(str,"^/") or find(str,"[%a]:") and 1) or 0 end -function support.thesanitizedfilename(str) - texwrite((gsub(str,"\\","/"))) +function commands.thesanitizedfilename(str) + context((gsub(str,"\\","/"))) end -function support.splitfilename(fullname) - local path, name, base, suffix, kind = '', fullname, fullname, '', 0 +local testcase = commands.testcase + +function commands.splitfilename(fullname) + local path, name, base, suffix = '', fullname, fullname, '' local p, n = match(fullname,"^(.+)/(.-)$") if p and n then path, name, base = p, n, n @@ -40,52 +54,47 @@ function support.splitfilename(fullname) if b and s then name, suffix = b, s end - if path == "" then - kind = 0 - elseif path == '.' then - kind = 1 - else - kind = 2 - end - commands.def("splitofffull", fullname) - commands.def("splitoffpath", path) - commands.def("splitoffbase", base) - commands.def("splitoffname", name) - commands.def("splitofftype", suffix) - commands.chardef("splitoffkind", kind) + texcount.splitoffkind = (path == "" and 0) or (path == '.' and 1) or 2 + local setvalue = context.setvalue + setvalue("splitofffull", fullname) + setvalue("splitoffpath", path) + setvalue("splitoffbase", base) + setvalue("splitoffname", name) + setvalue("splitofftype", suffix) end -function support.splitfiletype(fullname) +function commands.splitfiletype(fullname) local name, suffix = fullname, '' local n, s = match(fullname,"^(.+)%.(.-)$") if n and s then name, suffix = n, s end - commands.def("splitofffull", fullname) - commands.def("splitoffpath", "") - commands.def("splitoffname", name) - commands.def("splitofftype", suffix) + local setvalue = context.setvalue + setvalue("splitofffull", fullname) + setvalue("splitoffpath", "") + setvalue("splitoffname", name) + setvalue("splitofftype", suffix) end -function support.doifparentfileelse(n) - commands.testcase(n==environment.jobname or n==environment.jobname..'.tex' or n==environment.outputfilename) +function commands.doifparentfileelse(n) + testcase(n == environment.jobname or n == environment.jobname .. '.tex' or n == environment.outputfilename) end -- saves some .15 sec on 12 sec format generation local lastexistingfile = "" -function support.doiffileexistelse(name) +function commands.doiffileexistelse(name) if not name or name == "" then lastexistingfile = "" else lastexistingfile = resolvers.findtexfile(name) or "" end - return commands.testcase(lastexistingfile ~= "") + return testcase(lastexistingfile ~= "") end -function support.lastexistingfile() - texsprint(ctxcatcodes,lastexistingfile) +function commands.lastexistingfile() + context(lastexistingfile) end -- more, we can cache matches @@ -97,86 +106,111 @@ local found = { } -- can best be done in the resolver itself -- todo: tracing local function readfilename(specification,backtrack,treetoo) - local fnd = found[specification] + local name = specification.filename + local fnd = found[name] if not fnd then - local splitspec = resolvers.splitmethod(specification) - local filename = splitspec.path or "" - if lfs.isfile(filename) then - fnd = filename + if isfile(name) then + if trace_files then + report_files("found local: %s",name) + end + fnd = name end if not fnd and backtrack then - local fname = filename + local fname = name for i=1,backtrack,1 do fname = "../" .. fname - if lfs.isfile(fname) then + if isfile(fname) then + if trace_files then + report_files("found by backtracking: %s",fname) + end fnd = fname break + elseif trace_files then + report_files("not found by backtracking: %s",fname) end end end if not fnd and treetoo then ---~ fnd = resolvers.find_file(filename) - fnd = resolvers.findtexfile(filename) + fnd = resolvers.findtexfile(name) or "" + if trace_files then + if fnd ~= "" then + report_files("found by tree lookup: %s",fnd) + else + report_files("not found by tree lookup: %s",name) + end + end + end + found[name] = fnd + elseif trace_files then + if fnd ~= "" then + report_files("already found: %s",fnd) + else + report_files("already not found: %s",name) end - found[specification] = fnd end return fnd or "" end -support.readfilename = readfilename +function commands.readfilename(filename) + return findbyscheme("any",filename) +end -function finders.job(filename) return readfilename(filename,nil,false) end -- current path, no backtracking -function finders.loc(filename) return readfilename(filename,2, false) end -- current path, backtracking -function finders.sys(filename) return readfilename(filename,nil,true ) end -- current path, obeys tex search -function finders.fix(filename) return readfilename(filename,2, false) end -- specified path, backtracking -function finders.set(filename) return readfilename(filename,nil,false) end -- specified path, no backtracking -function finders.any(filename) return readfilename(filename,2, true ) end -- loc job sys +function finders.job(specification) return readfilename(specification,false,false) end -- current path, no backtracking +function finders.loc(specification) return readfilename(specification,2, false) end -- current path, backtracking +function finders.sys(specification) return readfilename(specification,false,true ) end -- current path, obeys tex search +function finders.fix(specification) return readfilename(specification,2, false) end -- specified path, backtracking +function finders.set(specification) return readfilename(specification,false,false) end -- specified path, no backtracking +function finders.any(specification) return readfilename(specification,2, true ) end -- loc job sys -openers.job = openers.generic loaders.job = loaders.generic -openers.loc = openers.generic loaders.loc = loaders.generic -openers.sys = openers.generic loaders.sys = loaders.generic -openers.fix = openers.generic loaders.fix = loaders.generic -openers.set = openers.generic loaders.set = loaders.generic -openers.any = openers.generic loaders.any = loaders.generic +openers.job = openers.file loaders.job = loaders.file -- default anyway +openers.loc = openers.file loaders.loc = loaders.file +openers.sys = openers.file loaders.sys = loaders.file +openers.fix = openers.file loaders.fix = loaders.file +openers.set = openers.file loaders.set = loaders.file +openers.any = openers.file loaders.any = loaders.file -function support.doreadfile(protocol,path,name) -- better do a split and then pass table - local specification +function finders.doreadfile(scheme,path,name) -- better do a split and then pass table + local fullname if url.hasscheme(name) then - specification = name + fullname = name else - specification = ((path == "") and format("%s:///%s",protocol,name)) or format("%s:///%s/%s",protocol,path,name) + fullname = ((path == "") and format("%s:///%s",scheme,name)) or format("%s:///%s/%s",scheme,path,name) end - texsprint(ctxcatcodes,resolvers.findtexfile(specification)) + return resolvers.findtexfile(fullname) or "" -- can be more direct end --- modules can only have a tex or mkiv suffix or can have a specified one +function commands.doreadfile(scheme,path,name) + context(finders.doreadfile(scheme,path,name)) +end + +-- modules can have a specific suffix or can specify one -local prefixes = { "m", "p", "s", "x", "t" } -local suffixes = { "tex", "mkiv" } +local prefixes = { "m", "p", "s", "x", "v", "t" } +local suffixes = { "mkiv", "tex", "mkvi" } -- order might change and how about cld local modstatus = { } -local function usemodule(name,hassheme) +local function usemodule(name,hasscheme) local foundname if hasscheme then -- no auto suffix as http will return a home page or error page -- so we only add one if missing local fullname = file.addsuffix(name,"tex") if trace_modules then - logs.report("modules","checking scheme driven file '%s'",fullname) + report_modules("checking url: '%s'",fullname) end foundname = resolvers.findtexfile(fullname) or "" elseif file.extname(name) ~= "" then if trace_modules then - logs.report("modules","checking suffix driven file '%s'",name) + report_modules("checking file: '%s'",name) end - foundname = support.readfilename(name,false,true) or "" + foundname = findbyscheme("any",name) or "" else for i=1,#suffixes do local fullname = file.addsuffix(name,suffixes[i]) if trace_modules then - logs.report("modules","checking suffix driven file '%s'",fullname) + report_modules("checking file: '%s'",fullname) end - foundname = support.readfilename(fullname,false,true) or "" + foundname = findbyscheme("any",fullname) or "" if foundname ~= "" then break end @@ -184,7 +218,7 @@ local function usemodule(name,hassheme) end if foundname ~= "" then if trace_modules then - logs.report("modules","loading '%s'",foundname) + report_modules("loading: '%s'",foundname) end context.startreadingfile() context.input(foundname) @@ -195,7 +229,7 @@ local function usemodule(name,hassheme) end end -function support.usemodules(prefix,askedname,truename) +function commands.usemodules(prefix,askedname,truename) local hasprefix = prefix and prefix ~= "" local hashname = ((hasprefix and prefix) or "*") .. "-" .. truename local status = modstatus[hashname] @@ -205,7 +239,7 @@ function support.usemodules(prefix,askedname,truename) status = status + 1 else if trace_modules then - logs.report("modules","locating '%s'",truename) + report_modules("locating: '%s'",truename) end local hasscheme = url.hasscheme(truename) if hasscheme then @@ -240,39 +274,60 @@ function support.usemodules(prefix,askedname,truename) end end if status == 0 then - if trace_modules then - logs.report("modules","skipping '%s' (not found)",truename) - else - interfaces.showmessage("systems",6,askedname) - end + report_modules("not found: '%s'",askedname) elseif status == 1 then - if not trace_modules then - interfaces.showmessage("systems",5,askedname) - end + report_modules("loaded: '%s'",trace_modules and truename or askedname) else - if trace_modules then - logs.report("modules","skipping '%s' (already loaded)",truename) - else - interfaces.showmessage("systems",7,askedname) - end + report_modules("already loaded: '%s'",trace_modules and truename or askedname) end modstatus[hashname] = status end +local loaded = { } + +function commands.uselibrary(name,patterns,action,failure) + local files = utilities.parsers.settings_to_array(name) + local done = false + for i=1,#files do + local filename = files[i] + if not loaded[filename] then + loaded[filename] = true + for i=1,#patterns do + local filename = format(patterns[i],filename) + -- local foundname = resolvers.findfile(filename) or "" + local foundname = finders.doreadfile("any",".",filename) + if foundname ~= "" then + action(name,foundname) + done = true + break + end + end + if done then + break + end + end + end + if failure and not done then + failure(name) + end +end + statistics.register("loaded tex modules", function() if next(modstatus) then - local t, f = { }, { } + local t, f, nt, nf = { }, { }, 0, 0 for k, v in table.sortedhash(modstatus) do k = file.basename(k) if v == 0 then - f[#f+1] = k + nf = nf + 1 + f[nf] = k else - t[#t+1] = k + nt = nt + 1 + t[nt] = k end end - local ts = (#t>0 and format(" (%s)",concat(t," "))) or "" - local fs = (#f>0 and format(" (%s)",concat(f," "))) or "" - return format("%s requested, %s found%s, %s missing%s",#t+#f,#t,ts,#f,fs) + local ts = (nt>0 and format(" (%s)",concat(t," "))) or "" + local fs = (nf>0 and format(" (%s)",concat(f," "))) or "" + return format("%s requested, %s found%s, %s missing%s",nt+nf,nt,ts,nf,fs) else return nil end diff --git a/Master/texmf-dist/tex/context/base/supp-fil.mkiv b/Master/texmf-dist/tex/context/base/supp-fil.mkiv index 872612eab0b..6b9af21cee2 100644 --- a/Master/texmf-dist/tex/context/base/supp-fil.mkiv +++ b/Master/texmf-dist/tex/context/base/supp-fil.mkiv @@ -12,7 +12,7 @@ %C details. %D \TEX\ operates on files, so one wouldn't wonder that there -%D is a separate module for file support. In \CONTEXT\ files +%D is a separate module for file commands. In \CONTEXT\ files %D are used for several purposes: %D %D \startitemize[packed] @@ -39,11 +39,8 @@ \def\f!parentpath {..} \fi -% \def\openinputfile #1#2{\immediate\openin #1="#2"\relax} \def\closeinputfile #1{\immediate\closein #1} -% \def\openoutputfile#1#2{\immediate\openout#1="#2"\relax} \def\closeoutputfile#1{\immediate\closeout#1} - -\def\openinputfile #1#2{\immediate\openin #1=#2\relax} \def\closeinputfile #1{\immediate\closein #1} -\def\openoutputfile#1#2{\immediate\openout#1=#2\relax} \def\closeoutputfile#1{\immediate\closeout#1} +\def\openinputfile #1#2{\immediate\openin #1={#2}} \def\closeinputfile #1{\immediate\closein #1} +\def\openoutputfile#1#2{\immediate\openout#1={#2}} \def\closeoutputfile#1{\immediate\closeout#1} %D \macros %D {pushendofline,popendofline} @@ -60,25 +57,20 @@ %D ... reading ... %D \popendofline %D \stoptyping -%D -%D Just to be sure, we save the current meaning of \type{^^M} -%D in \type{\poppedendofline}. \newcount \endoflinelevel -\ifx\newlinecode\undefined \chardef\newlinecode=`\^^M \fi - \def\pushendofline {\advance\endoflinelevel\plusone - \expandafter\chardef\csname :eol:\number\endoflinelevel\endcsname\catcode\newlinecode - \catcode\newlinecode\@@comment\relax} + \expandafter\chardef\csname :eol:\number\endoflinelevel\endcsname\catcode\endoflineasciicode + \catcode\endoflineasciicode\commentcatcode\relax} \def\popendofline - {\catcode\newlinecode\csname :eol:\number\endoflinelevel\endcsname + {\catcode\endoflineasciicode\csname :eol:\number\endoflinelevel\endcsname \advance\endoflinelevel\minusone} \def\restoreendofline - {\catcode\newlinecode\@@endofline} + {\catcode\endoflineasciicode\endoflinecatcode} %D \macros %D {scratchread, scratchwrite} @@ -106,8 +98,8 @@ \def\writeln#1{\write#1{}} -\def\doiffileexistselse #1{\ctxlua{support.doiffileexistelse([[#1]])}} -\def\lastfoundexistingfile {\ctxlua{support.lastexistingfile()}} +\def\doiffileexistselse #1{\ctxcommand{doiffileexistelse([[#1]])}} +\def\lastfoundexistingfile {\ctxcommand{lastexistingfile()}} %D \macros %D {doprocessfile,fileline,fileprocessedtrue,dofinishfile} @@ -172,13 +164,13 @@ {\edef#3{#2}} {\edef#3{#1\f!pathseparator#2}}} -\def\sanitizefilename#1\to#2{\edef#2{\ctxlua{support.thesanitizedfilename([[#1]])}}} +\def\sanitizefilename#1\to#2{\edef#2{\ctxcommand{thesanitizedfilename([[#1]])}}} %D NEW: -\chardef\kindoffile=0 % 0=normal 1=full path spec (or http) / set at the lua end +\newconstant\kindoffile % 0=normal 1=full path spec (or http) / set at the lua end -\def\checkfilename#1{\ctxlua{support.checkfilename([[#1]])}} +\def\checkfilename#1{\ctxcommand{checkfilename([[#1]])}} %D \macros %D {input, normalinput} @@ -191,7 +183,7 @@ \unexpanded\def\input{\normalinput} -\def\inputgivenfile#1{\normalinput"#1"\relax} +\def\inputgivenfile#1{\normalinput{#1}} %D \macros %D {readfile,ReadFile} @@ -248,13 +240,13 @@ \let \everyreadfile \everybeforereadfile -\def\maxreadlevel{\ctxlua{commands.maxreadlevel()}} +\def\maxreadlevel{\ctxcommand{maxreadlevel()}} % We need to postpone loading, else we got frozen type-* files and so when % a format is generated on a source path. \def\doreadfile#1#2#3% protocol path filename true false - {\edef\readfilename{\ctxlua{support.doreadfile("#1","#2","#3")}}% + {\edef\readfilename{\ctxcommand{doreadfile("#1","#2","#3")}}% \ifx\readfilename\empty \expandafter\doreadfilenop \else @@ -318,10 +310,14 @@ \readfile{#1}{#2}{#3}% \popcatcodetable} -\def\readxmlfile#1#2#3% - {\pushcatcodetable \catcodetable \xmlcatcodes - \readfile{#1}{#2}{#3}% - \popcatcodetable} +\ifdefined \xmlcatcodes + + \def\readxmlfile#1#2#3% + {\pushcatcodetable \catcodetable \xmlcatcodes + \readfile{#1}{#2}{#3}% + \popcatcodetable} + +\fi %D \macros %D {doiffileelse,doiflocfileelse} @@ -403,7 +399,7 @@ \ifx\outputfilename\undefined \def\outputfilename{\jobname} \fi -\def\doifparentfileelse#1{\ctxlua{support.doifparentfileelse([[#1]])}} +\def\doifparentfileelse#1{\ctxcommand{doifparentfileelse([[#1]])}} \newcount\readingfilelevel @@ -415,11 +411,13 @@ \unexpanded\def\startreadingfile% beter een every en \setnormalcatcodes {\global\advance\readingfilelevel\plusone \the\everystartreadingfile - \beginrestorecatcodes - \setcatcodetable\prtcatcodes} + \pushcatcodetable % saveguard + \ctxlua{regimes.push()}% temporarily this way + }% \setcatcodetable\prtcatcodes % no longer in mkiv, has to be done explictly \unexpanded\def\stopreadingfile - {\endrestorecatcodes + {\popcatcodetable % saveguard + \ctxlua{regimes.pop()}% temporarily this way \the\everystopreadingfile \global\advance\readingfilelevel\minusone} @@ -450,7 +448,7 @@ %D %D \start \typebuffer \getbuffer \stop -\def\splitoffroot{.} \chardef\splitoffkind\zerocount +\def\splitoffroot{.} \newconstant\splitoffkind \let\splitofffull\empty \let\splitoffpath\empty @@ -458,7 +456,7 @@ \let\splitoffname\empty \let\splitofftype\empty -\def\splitfilename#1{\ctxlua{support.splitfilename([[#1]])}} -\def\splitfiletype#1{\ctxlua{support.splitfiletype([[#1]])}} +\def\splitfilename#1{\ctxcommand{splitfilename([[#1]])}} +\def\splitfiletype#1{\ctxcommand{splitfiletype([[#1]])}} \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/supp-fun.mkii b/Master/texmf-dist/tex/context/base/supp-fun.mkii new file mode 100644 index 00000000000..6b26437038e --- /dev/null +++ b/Master/texmf-dist/tex/context/base/supp-fun.mkii @@ -0,0 +1,746 @@ +%D \module +%D [ file=supp-fun, +%D version=1995.10.10, +%D title=\CONTEXT\ Support Macros, +%D subtitle=Fun Stuff, +%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 This module implements some typographics tricks that can +%D be fun when designing document layouts. The examples use +%D macros that are typical to \CONTEXT, but non \CONTEXT\ +%D users can use the drop caps and first line treatment +%D macros without problems. This module will be extended +%D when the need for more of such tricks arises. + +\ifx \undefined \writestatus \input supp-mis.tex \relax \fi + +\writestatus{loading}{ConTeXt Support Macros / Fun Stuff} + +\ifx\definefont\undefined + \def\definedfont[#1]{\font\temp#1\relax\temp} +\fi + +%D \macros +%D {DroppedCaps, DroppedString, DroppedIndent, DroppedLines} +%D +%D \startbuffer +%D \DroppedCaps +%D {\color[green]} {cmbx12} +%D {2.2\baselineskip} {2pt} {\baselineskip} {2} +%D Let's start +%D \stopbuffer +%D +%D \getbuffer with dropped caps, those blown up first +%D characters of a paragraph. It's hard to implement a general +%D mechanism that suits all situations, but dropped caps are so +%D seldomly used that we can permit ourselves a rather user +%D unfriendly implementation. +%D +%D \typebuffer +%D +%D As we will see, there are 7 different settings involved. The +%D first argument takes a command that is used to do whatever +%D fancy things we want to do, but normally this one will be +%D empty. The second argument takes the font. Because we're +%D dealing with something very typographic, there is no real +%D reason to adopt complicated font switching schemes, a mere +%D name will do. Font encodings can bring no harm, because the +%D alphanumeric characters are nearly always located at their +%D natural position in the encoding vector. +%D +%D \startbuffer +%D \DroppedCaps +%D {\color[red]} {cmbx12} +%D {\baselineskip} {0pt} {0pt} {1} +%D This simple +%D \stopbuffer +%D +%D \getbuffer case shows us what happens when we apply minimal +%D values. Here we used: +%D +%D \typebuffer +%D +%D \startbuffer +%D \DroppedCaps +%D {\color[red]} {cmbx12} +%D {2\baselineskip} {0pt} {\baselineskip} {2} +%D Is this ugly +%D \stopbuffer +%D +%D \getbuffer example the third argument tells +%D this macro that we want a dropped capital scaled to the +%D baseline distance. The two zero point arguments are the +%D horizontal and vertical offsets and the last arguments +%D determines the hanging indentation. In this paragraph we +%D set the height to two times the baselinedistance and use +%D two hanging lines: +%D +%D \typebuffer +%D +%D Here, the first character is moved down one baseline. Here +%D we also see why the horizontal offset is important. The +%D first example (showing the~L) sets this to a few points and +%D also used a slightly larger height. +%D +%D Of course common users (typist) are not supposed to see this +%D kind of fuzzy definitions, but fortunately \TEX\ permits us +%D to hide them in macros. Using a macro also enables us to +%D garantee consistency throughout the document: +%D +%D \startbuffer +%D \def\MyDroppedCaps% +%D {\DroppedCaps +%D {\color[green]} {cmbx12} +%D {5\baselineskip} {3pt} {3\baselineskip} {4}} +%D +%D \MyDroppedCaps The implementation +%D \stopbuffer +%D +%D \typebuffer +%D +%D \getbuffer of the general macro is rather simple and only +%D depends on the arguments given and the dimensions of the +%D strut box. We explicitly load the font, which is no problem +%D because \TEX\ does not load a font twice. We could have +%D combined some arguments, like the height, vertical offset +%D and the number of lines, but the current implementation +%D proved to be the most flexible. One should be aware of the +%D fact that the offsets depend on the design of the glyphs +%D used. + +\let\DroppedIndent\!!zeropoint \def\DroppedLines{0} + +\def\DroppedString{ABCDEFGHIJKLMNOPQRSTUVWXYZ} + +\let\globaldropcaps\global % will be an option, but on by default + +\def\localdropcaps{\let\globaldropcaps\relax} + +\chardef\DroppedStatus = 0 % 0=done 1=starting 2=doing 3=error +\chardef\DropMode = 0 % 1 == marginhang + +\ifx\keeplinestogether\undefined + \let\keeplinestogether\gobbleoneargument +\fi + +\def\DroppedCaps#1#2#3#4#5#6#7% does not yet handle accented chars + {\defconvertedargument\asciia{#7}% + \defconvertedcommand \asciib{\DroppedString}% + \ExpandBothAfter\doifinstringelse\asciia\asciib + {\noindentation + \dontleavehmode + \checkindentation % redo this one + %\ifhmode\hskip-\parindent\fi % sensitive for context mechanism + \keeplinestogether{#6}% + \setbox0\hbox{\definedfont[#2 at #3]#1{#7}\hskip#4}% + \ifdim\dp0>\strutdp % one of those Q's , will be option + \setbox2\hbox{\raise\dp0\hbox{\lower\strutdp\copy0}}% + \ht2\ht0 + \dp0\strutdp + \setbox0\box2 + \fi + \setbox0\hbox + {\ifnum\DropMode=\plusone + \hskip-\wd0\wd0\zeropoint + \fi + \lower#5\box0}% + \ht0\strutht + \dp0\strutdp + \ifnum\DropMode=\plusone + \globaldropcaps\let\DroppedIndent\!!zeropoint + \globaldropcaps\edef\DroppedLines{\number\maxdimen}% + \globaldropcaps\chardef\DroppedStatus\plusthree + \else + \globaldropcaps\edef\DroppedIndent{\the\wd0}% + \globaldropcaps\edef\DroppedLines {\number#6}% + \globaldropcaps\chardef\DroppedStatus\plustwo + \globaldropcaps\hangindent\DroppedIndent + \globaldropcaps\hangafter-\DroppedLines +% \noindent + \noindentation + \checkindentation % redo this one + \hskip-\DroppedIndent + \fi + \vbox{\forgetall\box0}% + \nobreak + \let\next\ignorespaces} % Could be a one character word ! + {\globaldropcaps\let\DroppedIndent\!!zeropoint + \globaldropcaps\edef\DroppedLines{\number\maxdimen}% + \globaldropcaps\chardef\DroppedStatus\plusthree + \def\next{#7}}% + \let\globaldropcaps\global + \next} + +%D Before we go to the next topic, we summarize this command: +%D +%D \starttyping +%D \DroppedCaps +%D {command} {font} +%D {height} {hoffset} {voffset} {lines} +%D \stoptyping +%D +%D Sometimes you need to make sure that the global settings are +%D kept local, as in: +%D +% %D \startbuffer +% %D \defineparagraphs[SomePar][n=2,rule=on] +% %D \setupparagraphs [SomePar][1][width=.5\textwidth] +% %D \setupparagraphs [SomePar][2][width=.5\textwidth] +%D \startbuffer +%D \defineparagraphs[SomePar][n=2,rule=on] +%D \setupparagraphs [SomePar][1][width=.5\textwidth] +%D \setupparagraphs [SomePar][2][width=.5\textwidth] +%D +%D \startSomePar +%D \localdropcaps\NiceDroppedCaps{}{cmr12}{0pt}{2}Here we need +%D to explicitly keep the hanging indentation local, like it or +%D not. +%D \SomePar +%D \localdropcaps\NiceDroppedCaps{}{cmr12}{0pt}{2}Here we need +%D to explicitly keep the hanging indentation local, like it or +%D not. +%D \stopSomePar +%D \stopbuffer +%D +%D \typebuffer \getbuffer + +%D \macros +%D {AutoDroppedCaps, CheckDroppedCaps} +%D +%D {\em To be documented.} + +% example usage +% +% \def\bpar{\ifvmode\CheckDroppedCaps\fi} +% \def\epar{\ifhmode\par\fi\CheckDroppedCaps} + +\newcount\lastprevgraf +\newcount\droppedlines + +\def\CheckDroppedCaps + {\global\lastprevgraf\prevgraf} + +\def\AutoDroppedCaps % will be proper core stuff since it + {\globaldropcaps\chardef\DroppedStatus\plusone + \global\lastprevgraf\zerocount + \global\droppedlines\zerocount + \EveryPar{\doAutoDroppedCaps}} + +\let\AutoDroppedNext\relax + +\ifx\AutoDroppedCapsCommand\undefined + \def\AutoDroppedCapsCommand{\NiceDroppedCaps{}{SerifBold}{.125em}{3}} +\fi + +\def\doAutoDroppedCaps + {\ifcase\DroppedStatus % done + \let\next\relax + \or % starting + % \ifnum\lastprevgraf>0 % tricky, probably a wrong par + % \globaldropcaps\chardef\DroppedStatus=3 % and inhibits dropped + % \let\next\relax % caps after titles and more than once + % \else % so let's nill this rubishly code fragment + \let\next\AutoDroppedCapsCommand + % \fi % and hope for the best + \or % doing + \global\advance\droppedlines \lastprevgraf + \ifnum\droppedlines=\zerocount + \globaldropcaps\chardef\DroppedStatus\zerocount + \let\next\relax + \else\ifnum\droppedlines>\zerocount + \ifnum\droppedlines<\DroppedLines\relax + \globaldropcaps\hangindent\DroppedIndent + \globaldropcaps\hangafter-\DroppedLines + \globaldropcaps\advance\hangafter \droppedlines + \hskip-\parindent % brrr + \let\next\AutoDroppedNext + \else + \globaldropcaps\chardef\DroppedStatus\zerocount + \let\next\relax + \fi + \else + \globaldropcaps\chardef\DroppedStatus\zerocount + \let\next\relax + \fi\fi + \or % error + \globaldropcaps\chardef\DroppedStatus\zerocount + \let\next\relax + \fi + \next} + +%D \macros +%D {LineDroppedCaps, NiceDroppedCaps} +%D +%D To save definitions, we also provide: +%D +%D \starttyping +%D \LineDroppedCaps {command} {font} {hoffset} {lines} +%D \NiceDroppedCaps {command} {font} {hoffset} {lines} +%D \stoptyping +%D +%D The first command scales the font to the exact height, while +%D the second command scales the font to a nice 2.5 times the +%D line height, a value that gives a pleasant grayness. + +\def\DoLineDroppedCaps#1#2#3#4#5% compensation command font offset lines + {\scratchcounter#5% + \advance\scratchcounter \minusone + \scratchdimen\scratchcounter\baselineskip + \advance\scratchdimen #1% + \NormalizeFontHeight\DummyFont{W}\scratchdimen{#3}% + \DroppedCaps{#2}{#3}\TheNormalizedFontSize{#4} + {\scratchcounter\baselineskip}{#5}} + +\def\LineDroppedCaps% command font offset lines + {\DoLineDroppedCaps{\strutht}} + +\def\NiceDroppedCaps% command font offset lines + {\DoLineDroppedCaps{.5\baselineskip}} + +%D \macros +%D {TreatFirstLine} +%D +%D \startbuffer +%D \TreatFirstLine {\sc} {} {} {} +%D Instead of limiting its action to one token, the next macro +%D treats the whole first line. This paragraph was typeset by +%D saying: +%D \stopbuffer +%D +%D \getbuffer +%D +%D \typebuffer +%D +%D \startbuffer +%D \TreatFirstLine {\startcolor[red]\bf} {\stopcolor} {} {} +%D The combined color and font effect is also possible, +%D although one must be careful in using macros that accumulate +%D grouping, but the commands used here are pretty save in that +%D respect. +%D \stopbuffer +%D +%D \getbuffer +%D +%D \typebuffer +%D +%D Before we explain the third and fourth argument, we show the +%D implementation. Those who know a bit about the way \TEX\ +%D treats tokens, will probably see in one glance that this +%D alternative works all right for most text||only situations +%D in which there is enough text available for the first line, +%D but that more complicated things will blow. One has to live +%D with that. A workaround is rather trivial but obscures the +%D principles used. + +\def\TreatFirstLine#1#2#3#4% before, after, first, next + {\leavevmode + \bgroup + \forgetall + \bgroup + #1% + \setbox0\emptybox + \setbox2\emptybox + \def\grabfirstline##1 % + {\setbox2\hbox + {\ifvoid0 + {#3{\ignorespaces##1}}% + \else + \unhcopy0\ {#4{##1}}% + \fi}% + \ifdim\wd2=\zeropoint + \setbox0\emptybox + \setbox2\emptybox + \@EA\grabfirstline + \else\ifdim\wd2>\hsize + \hbox to \hsize{\strut\unhbox0}#2\egroup + \break##1\ + \egroup + \else + \setbox0\box2 + \@EAEAEA\grabfirstline + \fi\fi}% + \grabfirstline} + +%D \startbuffer +%D \gdef\FunnyCommand +%D {\getrandomfloat\FunnyR{0}{1}% +%D \getrandomfloat\FunnyG{0}{1}% +%D \getrandomfloat\FunnyB{0}{1}% +%D \definecolor[FunnyColor][r=\FunnyR,g=\FunnyG,b=\FunnyB]% +%D \color[FunnyColor]} +%D +%D %\TreatFirstLine {\bf} {} {\FunnyCommand} {\FunnyCommand} +%D The third and fourth argument can be used to gain special +%D effects on the individual words. Of course one needs ... +%D \stopbuffer +%D +%D \getbuffer +%D to know a bit more about the macro package used to get real +%D nice effects, but this example probably demonstrates the +%D principles well. +%D +%D \typebuffer +%D +%D Like in dropped caps case, one can hide such treatments in a +%D macro, like: +%D +%D \starttyping +%D \def\MyTreatFirstLine% +%D {\TreatFirstLine{\bf}{}{\FunnyCommand}{\FunnyCommand}} +%D \stoptyping + +%D \macros +%D {reshapebox} +%D +%D \startbuffer +%D \beginofshapebox +%D When using \CONTEXT, one can also apply this funny command +%D to whole lines by using the reshape mechanism. Describing +%D this interesting mechanism falls outside the scope of this +%D module, so we only show the trick. This is an example of +%D low level \CONTEXT\ functionality: it's all there, and it's +%D stable, but not entirely meant for novice users. +%D \endofshapebox +%D +%D \reshapebox{\FunnyCommand{\box\shapebox}} \flushshapebox +%D \stopbuffer +%D +%D \getbuffer +%D +%D \typebuffer +%D +%D This mechanism permits hyphenation and therefore gives +%D better results than the previously discussed macro +%D \type{\TreatFirstLine}. + +%D \macros +%D {TreatFirstCharacter} +%D +%D \startbuffer +%D \TreatFirstCharacter{\bf\color[green]} Just to be +%D \stopbuffer +%D +%D \getbuffer complete we also offer a very simple one +%D character alternative, that is not that hard to understand: + +\def\TreatFirstCharacter#1#2% command, character + {{#1{#2}}} + +%D A previous paragraph started with: +%D +%D \typebuffer + +%D \macros +%D {StackCharacters} +%D +%D The next hack deals with vertical stacking. + +\def\StackCharacters#1#2#3#4% sequence vsize vskip command + {\vbox #2 + {\forgetall + \baselineskip\zeropoint + \def\StackCharacter##1{#4{##1}\cr\noalign{#3}}% + \halign + {\hss##\hss&##\cr + \handletokens#1\with\StackCharacter\cr}}} + +%D \startbuffer +%D \StackCharacters{CONTEXT}{}{\vskip.2ex}{\FunnyCommand} +%D \stopbuffer +%D +%D Such a stack looks like: +%D +%D \startlinecorrection +%D \hbox to \hsize +%D {$\hss\bfd +%D \vcenter{\StackCharacters{TEX} {}{\vskip.2ex}{\FunnyCommand}}% +%D \hss +%D \vcenter{\StackCharacters{CON} {}{\vskip.2ex}{\FunnyCommand}} +%D \hss +%D \vcenter{\StackCharacters{TEXT} {}{\vskip.2ex}{\FunnyCommand}} +%D \hss +%D \vcenter{\StackCharacters{CONTEXT}{}{\vskip.2ex}{\FunnyCommand}} +%D \hss$} +%D \stoplinecorrection +%D +%D and is typeset by saying: +%D +%D \typebuffer +%D +%D An alternative would have been +%D +%D \starttyping +%D \StackCharacters {CONTEXT} {to 5cm} {\vfill} {\FunnyCommand} +%D \stoptyping + +%D \macros +%D {processtokens} +%D +%D At a lower level horizontal and vertical manipulations are +%D already supported by: +%D +%D \starttyping +%D \processtokens {begin} {between} {end} {space} {text} +%D \stoptyping +%D +%D \startbuffer[a] +%D \processtokens +%D {\hbox to .5\hsize\bgroup} {\hfill} +%D {\egroup} {\space} {LET'S HAVE} +%D \stopbuffer +%D +%D \startbuffer[b] +%D \processtokens +%D {\vbox\bgroup\raggedcenter\hsize1em} +%D {\vskip.25ex} {\egroup} {\strut} {FUN} +%D \stopbuffer +%D +%D This macro is able to typeset: +%D +%D \leavevmode\hbox to \hsize +%D {$\hfil\hfil +%D \vcenter{\bf\getbuffer[a]}% +%D \hfil +%D \vcenter{\bfd\getbuffer[b]}% +%D \hfil\hfil$} +%D +%D which was specified as: +%D +%D \typebuffer[a] +%D \typebuffer[b] + +%D \macros +%D {NormalizeFontHeight, NormalizeFontWidth, +%D TheNormalizedFontSize} +%D +%D Next we introduce some font manipulation macros. When we +%D want to typeset some text spread in a well defined area, it +%D can be considered bad practice to manipulate character and +%D word spacing. In such situations the next few macros can be +%D of help: +%D +%D \starttyping +%D \NormalizeFontHeight \name {sample text} {height} {font} +%D \NormalizeFontWidth \name {sample text} {width} {font} +%D \stoptyping +%D +%D These are implemented using an auxilliary macro: + +\def\NormalizeFontHeight{\NormalizeFontSize\ht} +\def\NormalizeFontWidth {\NormalizeFontSize\wd} + +% \def\NormalizeFontSize#1#2#3#4#5% +% {\bgroup +% \dimen0=#4% #4 can be \ht0 or so +% \setbox0\hbox{\definedfont[#5 at 10pt]#3}% +% \ifdim\wd0>\zeropoint +% \dimen2=#10 % #1 is \wd or \ht +% \dimen4=10000pt +% \divide\dimen4 \dimen2 +% \divide\dimen0 \plusthousand +% \dimen0=\number\dimen4\dimen0 +% \xdef\TheNormalizedFontSize{\the\dimen0}% +% \else +% \dimen0\bodyfontsize +% \fi +% \definedfont[#5 at \the\dimen0]% +% \expandafter +% \egroup +% \expandafter\font\expandafter#2\fontname\font\relax} +% +% the familiar struggle with accuracy forces us to use: + +\def\NormalizeFontSize#1#2#3#4#5% + {\bgroup + \dimen0=#4% #4 can be \ht0 or so + \setbox0\hbox{\definedfont[#5 at 5pt]#3}% 10pt + \ifdim\wd0>\zeropoint + \dimen2=#10 % #1 is \wd or \ht + \dimen4=\maxdimen % 10000pt + \divide\dimen4 \dimen2 + \divide\dimen0 1638 % 1000 + \dimen0=\number\dimen4\dimen0 + \divide \dimen0 \plustwo % ... + \xdef\TheNormalizedFontSize{\the\dimen0}% + \else + \dimen0\bodyfontsize + \fi + % mkii + % \definedfont[#5 at \the\dimen0]% + % \expandafter + % \egroup + % \expandafter\font\expandafter#2\fontname\font\relax} + % mkiv safe (file: prefix etc) + \expanded{\egroup\def\noexpand#2{\definedfont[#5 at \the\dimen0]}}} + +%D Afterwards, we have access to the calculated size by: + +\let\TheNormalizedFontSize\!!zeropoint + +%D Extra: + +\def\WidthSpanningText#1#2#3% text width font + {\hbox{\NormalizeFontWidth\temp{#1}{#2}{#3}\temp\the\everydefinedfont#1}} + +%D Consider for instance: +%D +%D \startbuffer +%D \NormalizeFontHeight \tmp {X} {2\baselineskip} {cmr10} +%D +%D {\tmp To Be Or Not To Be} +%D \stopbuffer +%D +%D \typebuffer +%D +%D This shows up as (we also show the baselines): +%D +%D {\showbaselines\getbuffer} +%D +%D The horizontal counterpart is: +%D +%D \startbuffer +%D \NormalizeFontWidth \tmp {This Line Fits} {\hsize} {cmr10} +%D +%D \hbox{\tmp This Line Fits} +%D \stopbuffer +%D +%D \typebuffer +%D +%D The calculated font scale is avaliable in the macro +%D \type{\NormalizedFontSize}. +%D +%D \startlinecorrection +%D \ruledhbox{\getbuffer} +%D \stoplinecorrection +%D +%D One can of course combine these macros with the ones +%D described earlier, like in: +%D +%D \starttyping +%D \NormalizeFontHeight {text} \DroppedFont {2\baselineskip} {cmbx12} +%D +%D \def\NicelyDroppedCaps +%D {\DroppedCaps +%D {\color[green]} +%D {\DroppedFont} +%D {2pt} +%D {\baselineskip} +%D {2}} +%D \stoptyping +%D +%D It's up to the reader to test this one. + +\unexpanded\def\FirstNCharacters#1#2% \FirstNCharacters{3}{fr{\"o}beln} + {\bgroup + \scratchcounter\zerocount + \def\docommand##1% + {\ifnum\scratchcounter=#1\else + ##1\relax % catches ##1 = \"e and alike + \advance\scratchcounter\plusone + \fi} + \handletokens#2\with\docommand + \egroup} + +%D \macros +%D {FittingText} +%D +%D First used in Pascal (demo-bbv): +%D +%D \startbuffer +%D \ruledvbox{\FittingText{3cm}{1cm}{Serif}{24pt}{1pt}{1} +%D {\veryraggedright +%D \hangindent1em\hangafter1\relax +%D \begstrut \dorecurse{8}{Bram Marta }\unskip \endstrut}} +%D +%D \ruledvbox{\FittingText{3cm}{1cm}{Serif}{24pt}{1pt}{1} +%D {\raggedleft\begstrut Bram\\Marta \unskip\endstrut}} +%D \stopbuffer +%D +%D \typebuffer +%D +%D \startlinecorrection +%D \getbuffer +%D \stoplinecorrection + +% #1 width #2 height #3 font #4 size #5 step #6 interlinie #7 text + +\long\def\FittingText#1#2#3#4#5#6#7% + {\bgroup + \forgetall + \dontcomplain + \setuptolerance[\v!verytolerant]% == \tolerance4500 + \hsize#1% + \def\\{\softbreak}% + \!!heighta#4% + \!!heightb#2% + \doloop + {\ifdim\!!heighta>\onepoint + \expanded{\definefont[\s!dummy][#3 at \the\!!heighta][\c!interlinespace=#6]}% + \getvalue\s!dummy + \setbox\scratchbox\vbox{#7\endgraf}% + \ifdim\ht\scratchbox>\!!heightb + \advance\!!heighta-#5% + \else + \beginshapebox + \unvcopy\scratchbox + \endshapebox + \global\dimen1\hsize + \reshapebox + {\setbox\shapebox\hbox{\unhbox\shapebox}% + \ifdim\wd\shapebox>\dimen1 + \global\dimen1\wd\shapebox + \fi}% + \ifdim\dimen1>\hsize + \advance\!!heighta-#5% + \else + \exitloop + \fi + \fi + \else + \exitloop + \fi}% + %\writestatus{\strippedcsname\FittingText}{height: \the\!!heighta}% + \unvbox\scratchbox + \egroup} + +%D New: + +% \font width gap font spec text + +\def\NormalizeFontWidthSpread#1#2#3#4#5#6% + {\global\setfalse\NFSpread + \scratchdimen#3% + \scratchdimen-.5\scratchdimen + \advance\scratchdimen#2\relax + \NormalizeFontWidth + #1% + {\def\+{\global\settrue\NFSpread\gobbleuntil\relax}% + \def\\{\gobbleuntil\relax}% newline + \setupspacing + #6\relax}% + {\scratchdimen}% + {#4}% + \ifconditional\NFSpread + % de gap valt in de binding + \else + \definefont[\strippedcsname#1][#4 #5]% + \fi} + +\def\SpreadGapText#1#2% + {{\def\+{\kern#1}#2}} + +\def\GapText#1#2#3#4#5% width distance font spec title + {\bgroup + \NormalizeFontWidthSpread\DummyFont{#1}{#2}{#3}{#4}{#5}% + \DummyFont\setupspacing\SpreadGapText{#2}{#5}\endgraf + \egroup} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/supp-fun.mkiv b/Master/texmf-dist/tex/context/base/supp-fun.mkiv new file mode 100644 index 00000000000..a8db3b6343d --- /dev/null +++ b/Master/texmf-dist/tex/context/base/supp-fun.mkiv @@ -0,0 +1,746 @@ +%D \module +%D [ file=supp-fun, +%D version=1995.10.10, +%D title=\CONTEXT\ Support Macros, +%D subtitle=Fun Stuff, +%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 This module implements some typographics tricks that can +%D be fun when designing document layouts. The examples use +%D macros that are typical to \CONTEXT, but non \CONTEXT\ +%D users can use the drop caps and first line treatment +%D macros without problems. This module will be extended +%D when the need for more of such tricks arises. + +\ifx \undefined \writestatus \input supp-mis.tex \relax \fi + +\writestatus{loading}{ConTeXt Support Macros / Fun Stuff} + +\ifx\definefont\undefined + \def\definedfont[#1]{\font\temp#1\relax\temp} +\fi + +%D \macros +%D {DroppedCaps, DroppedString, DroppedIndent, DroppedLines} +%D +%D \startbuffer +%D \DroppedCaps +%D {\color[green]} {cmbx12} +%D {2.2\baselineskip} {2pt} {\baselineskip} {2} +%D Let's start +%D \stopbuffer +%D +%D \getbuffer with dropped caps, those blown up first +%D characters of a paragraph. It's hard to implement a general +%D mechanism that suits all situations, but dropped caps are so +%D seldomly used that we can permit ourselves a rather user +%D unfriendly implementation. +%D +%D \typebuffer +%D +%D As we will see, there are 7 different settings involved. The +%D first argument takes a command that is used to do whatever +%D fancy things we want to do, but normally this one will be +%D empty. The second argument takes the font. Because we're +%D dealing with something very typographic, there is no real +%D reason to adopt complicated font switching schemes, a mere +%D name will do. Font encodings can bring no harm, because the +%D alphanumeric characters are nearly always located at their +%D natural position in the encoding vector. +%D +%D \startbuffer +%D \DroppedCaps +%D {\color[red]} {cmbx12} +%D {\baselineskip} {0pt} {0pt} {1} +%D This simple +%D \stopbuffer +%D +%D \getbuffer case shows us what happens when we apply minimal +%D values. Here we used: +%D +%D \typebuffer +%D +%D \startbuffer +%D \DroppedCaps +%D {\color[red]} {cmbx12} +%D {2\baselineskip} {0pt} {\baselineskip} {2} +%D Is this ugly +%D \stopbuffer +%D +%D \getbuffer example the third argument tells +%D this macro that we want a dropped capital scaled to the +%D baseline distance. The two zero point arguments are the +%D horizontal and vertical offsets and the last arguments +%D determines the hanging indentation. In this paragraph we +%D set the height to two times the baselinedistance and use +%D two hanging lines: +%D +%D \typebuffer +%D +%D Here, the first character is moved down one baseline. Here +%D we also see why the horizontal offset is important. The +%D first example (showing the~L) sets this to a few points and +%D also used a slightly larger height. +%D +%D Of course common users (typist) are not supposed to see this +%D kind of fuzzy definitions, but fortunately \TEX\ permits us +%D to hide them in macros. Using a macro also enables us to +%D garantee consistency throughout the document: +%D +%D \startbuffer +%D \def\MyDroppedCaps% +%D {\DroppedCaps +%D {\color[green]} {cmbx12} +%D {5\baselineskip} {3pt} {3\baselineskip} {4}} +%D +%D \MyDroppedCaps The implementation +%D \stopbuffer +%D +%D \typebuffer +%D +%D \getbuffer of the general macro is rather simple and only +%D depends on the arguments given and the dimensions of the +%D strut box. We explicitly load the font, which is no problem +%D because \TEX\ does not load a font twice. We could have +%D combined some arguments, like the height, vertical offset +%D and the number of lines, but the current implementation +%D proved to be the most flexible. One should be aware of the +%D fact that the offsets depend on the design of the glyphs +%D used. + +\let\DroppedIndent\!!zeropoint \def\DroppedLines{0} + +\def\DroppedString{ABCDEFGHIJKLMNOPQRSTUVWXYZ} + +\let\globaldropcaps\global % will be an option, but on by default + +\def\localdropcaps{\let\globaldropcaps\relax} + +\chardef\DroppedStatus = 0 % 0=done 1=starting 2=doing 3=error +\chardef\DropMode = 0 % 1 == marginhang + +\ifx\keeplinestogether\undefined + \let\keeplinestogether\gobbleoneargument +\fi + +\def\DroppedCaps#1#2#3#4#5#6#7% does not yet handle accented chars + {\defconvertedargument\asciia{#7}% + \defconvertedcommand \asciib{\DroppedString}% + \doifinstringelse\asciia\asciib + {\noindentation + \dontleavehmode + \checkindentation % redo this one + %\ifhmode\hskip-\parindent\fi % sensitive for context mechanism + \keeplinestogether{#6}% + \setbox0\hbox{\definedfont[#2 at #3]#1{#7}\hskip#4}% + \ifdim\dp0>\strutdp % one of those Q's , will be option + \setbox2\hbox{\raise\dp0\hbox{\lower\strutdp\copy0}}% + \ht2\ht0 + \dp0\strutdp + \setbox0\box2 + \fi + \setbox0\hbox + {\ifnum\DropMode=\plusone + \hskip-\wd0\wd0\zeropoint + \fi + \lower#5\box0}% + \ht0\strutht + \dp0\strutdp + \ifnum\DropMode=\plusone + \globaldropcaps\let\DroppedIndent\!!zeropoint + \globaldropcaps\edef\DroppedLines{\number\maxdimen}% + \globaldropcaps\chardef\DroppedStatus\plusthree + \else + \globaldropcaps\edef\DroppedIndent{\the\wd0}% + \globaldropcaps\edef\DroppedLines {\number#6}% + \globaldropcaps\chardef\DroppedStatus\plustwo + \globaldropcaps\hangindent\DroppedIndent + \globaldropcaps\hangafter-\DroppedLines +% \noindent + \noindentation + \checkindentation % redo this one + \hskip-\DroppedIndent + \fi + \vbox{\forgetall\box0}% + \nobreak + \let\next\ignorespaces} % Could be a one character word ! + {\globaldropcaps\let\DroppedIndent\!!zeropoint + \globaldropcaps\edef\DroppedLines{\number\maxdimen}% + \globaldropcaps\chardef\DroppedStatus\plusthree + \def\next{#7}}% + \let\globaldropcaps\global + \next} + +%D Before we go to the next topic, we summarize this command: +%D +%D \starttyping +%D \DroppedCaps +%D {command} {font} +%D {height} {hoffset} {voffset} {lines} +%D \stoptyping +%D +%D Sometimes you need to make sure that the global settings are +%D kept local, as in: +%D +% %D \startbuffer +% %D \defineparagraphs[SomePar][n=2,rule=on] +% %D \setupparagraphs [SomePar][1][width=.5\textwidth] +% %D \setupparagraphs [SomePar][2][width=.5\textwidth] +%D \startbuffer +%D \defineparagraphs[SomePar][n=2,rule=on] +%D \setupparagraphs [SomePar][1][width=.5\textwidth] +%D \setupparagraphs [SomePar][2][width=.5\textwidth] +%D +%D \startSomePar +%D \localdropcaps\NiceDroppedCaps{}{cmr12}{0pt}{2}Here we need +%D to explicitly keep the hanging indentation local, like it or +%D not. +%D \SomePar +%D \localdropcaps\NiceDroppedCaps{}{cmr12}{0pt}{2}Here we need +%D to explicitly keep the hanging indentation local, like it or +%D not. +%D \stopSomePar +%D \stopbuffer +%D +%D \typebuffer \getbuffer + +%D \macros +%D {AutoDroppedCaps, CheckDroppedCaps} +%D +%D {\em To be documented.} + +% example usage +% +% \def\bpar{\ifvmode\CheckDroppedCaps\fi} +% \def\epar{\ifhmode\par\fi\CheckDroppedCaps} + +\newcount\lastprevgraf +\newcount\droppedlines + +\def\CheckDroppedCaps + {\global\lastprevgraf\prevgraf} + +\def\AutoDroppedCaps % will be proper core stuff since it + {\globaldropcaps\chardef\DroppedStatus\plusone + \global\lastprevgraf\zerocount + \global\droppedlines\zerocount + \EveryPar{\doAutoDroppedCaps}} + +\let\AutoDroppedNext\relax + +\ifx\AutoDroppedCapsCommand\undefined + \def\AutoDroppedCapsCommand{\NiceDroppedCaps{}{SerifBold}{.125em}{3}} +\fi + +\def\doAutoDroppedCaps + {\ifcase\DroppedStatus % done + \let\next\relax + \or % starting + % \ifnum\lastprevgraf>0 % tricky, probably a wrong par + % \globaldropcaps\chardef\DroppedStatus=3 % and inhibits dropped + % \let\next\relax % caps after titles and more than once + % \else % so let's nill this rubishly code fragment + \let\next\AutoDroppedCapsCommand + % \fi % and hope for the best + \or % doing + \global\advance\droppedlines \lastprevgraf + \ifnum\droppedlines=\zerocount + \globaldropcaps\chardef\DroppedStatus\zerocount + \let\next\relax + \else\ifnum\droppedlines>\zerocount + \ifnum\droppedlines<\DroppedLines\relax + \globaldropcaps\hangindent\DroppedIndent + \globaldropcaps\hangafter-\DroppedLines + \globaldropcaps\advance\hangafter \droppedlines + \hskip-\parindent % brrr + \let\next\AutoDroppedNext + \else + \globaldropcaps\chardef\DroppedStatus\zerocount + \let\next\relax + \fi + \else + \globaldropcaps\chardef\DroppedStatus\zerocount + \let\next\relax + \fi\fi + \or % error + \globaldropcaps\chardef\DroppedStatus\zerocount + \let\next\relax + \fi + \next} + +%D \macros +%D {LineDroppedCaps, NiceDroppedCaps} +%D +%D To save definitions, we also provide: +%D +%D \starttyping +%D \LineDroppedCaps {command} {font} {hoffset} {lines} +%D \NiceDroppedCaps {command} {font} {hoffset} {lines} +%D \stoptyping +%D +%D The first command scales the font to the exact height, while +%D the second command scales the font to a nice 2.5 times the +%D line height, a value that gives a pleasant grayness. + +\def\DoLineDroppedCaps#1#2#3#4#5% compensation command font offset lines + {\scratchcounter#5% + \advance\scratchcounter \minusone + \scratchdimen\scratchcounter\baselineskip + \advance\scratchdimen #1% + \NormalizeFontHeight\DummyFont{W}\scratchdimen{#3}% + \DroppedCaps{#2}{#3}\TheNormalizedFontSize{#4} + {\scratchcounter\baselineskip}{#5}} + +\def\LineDroppedCaps% command font offset lines + {\DoLineDroppedCaps{\strutht}} + +\def\NiceDroppedCaps% command font offset lines + {\DoLineDroppedCaps{.5\baselineskip}} + +%D \macros +%D {TreatFirstLine} +%D +%D \startbuffer +%D \TreatFirstLine {\sc} {} {} {} +%D Instead of limiting its action to one token, the next macro +%D treats the whole first line. This paragraph was typeset by +%D saying: +%D \stopbuffer +%D +%D \getbuffer +%D +%D \typebuffer +%D +%D \startbuffer +%D \TreatFirstLine {\startcolor[red]\bf} {\stopcolor} {} {} +%D The combined color and font effect is also possible, +%D although one must be careful in using macros that accumulate +%D grouping, but the commands used here are pretty save in that +%D respect. +%D \stopbuffer +%D +%D \getbuffer +%D +%D \typebuffer +%D +%D Before we explain the third and fourth argument, we show the +%D implementation. Those who know a bit about the way \TEX\ +%D treats tokens, will probably see in one glance that this +%D alternative works all right for most text||only situations +%D in which there is enough text available for the first line, +%D but that more complicated things will blow. One has to live +%D with that. A workaround is rather trivial but obscures the +%D principles used. + +\def\TreatFirstLine#1#2#3#4% before, after, first, next + {\leavevmode + \bgroup + \forgetall + \bgroup + #1% + \setbox0\emptybox + \setbox2\emptybox + \def\grabfirstline##1 % + {\setbox2\hbox + {\ifvoid0 + {#3{\ignorespaces##1}}% + \else + \unhcopy0\ {#4{##1}}% + \fi}% + \ifdim\wd2=\zeropoint + \setbox0\emptybox + \setbox2\emptybox + \@EA\grabfirstline + \else\ifdim\wd2>\hsize + \hbox to \hsize{\strut\unhbox0}#2\egroup + \break##1\ + \egroup + \else + \setbox0\box2 + \@EAEAEA\grabfirstline + \fi\fi}% + \grabfirstline} + +%D \startbuffer +%D \gdef\FunnyCommand +%D {\getrandomfloat\FunnyR{0}{1}% +%D \getrandomfloat\FunnyG{0}{1}% +%D \getrandomfloat\FunnyB{0}{1}% +%D \definecolor[FunnyColor][r=\FunnyR,g=\FunnyG,b=\FunnyB]% +%D \color[FunnyColor]} +%D +%D %\TreatFirstLine {\bf} {} {\FunnyCommand} {\FunnyCommand} +%D The third and fourth argument can be used to gain special +%D effects on the individual words. Of course one needs ... +%D \stopbuffer +%D +%D \getbuffer +%D to know a bit more about the macro package used to get real +%D nice effects, but this example probably demonstrates the +%D principles well. +%D +%D \typebuffer +%D +%D Like in dropped caps case, one can hide such treatments in a +%D macro, like: +%D +%D \starttyping +%D \def\MyTreatFirstLine% +%D {\TreatFirstLine{\bf}{}{\FunnyCommand}{\FunnyCommand}} +%D \stoptyping + +%D \macros +%D {reshapebox} +%D +%D \startbuffer +%D \beginofshapebox +%D When using \CONTEXT, one can also apply this funny command +%D to whole lines by using the reshape mechanism. Describing +%D this interesting mechanism falls outside the scope of this +%D module, so we only show the trick. This is an example of +%D low level \CONTEXT\ functionality: it's all there, and it's +%D stable, but not entirely meant for novice users. +%D \endofshapebox +%D +%D \reshapebox{\FunnyCommand{\box\shapebox}} \flushshapebox +%D \stopbuffer +%D +%D \getbuffer +%D +%D \typebuffer +%D +%D This mechanism permits hyphenation and therefore gives +%D better results than the previously discussed macro +%D \type{\TreatFirstLine}. + +%D \macros +%D {TreatFirstCharacter} +%D +%D \startbuffer +%D \TreatFirstCharacter{\bf\color[green]} Just to be +%D \stopbuffer +%D +%D \getbuffer complete we also offer a very simple one +%D character alternative, that is not that hard to understand: + +\def\TreatFirstCharacter#1#2% command, character + {{#1{#2}}} + +%D A previous paragraph started with: +%D +%D \typebuffer + +%D \macros +%D {StackCharacters} +%D +%D The next hack deals with vertical stacking. + +\def\StackCharacters#1#2#3#4% sequence vsize vskip command + {\vbox #2 + {\forgetall + \baselineskip\zeropoint + \def\StackCharacter##1{#4{##1}\cr\noalign{#3}}% + \halign + {\hss##\hss&##\cr + \handletokens#1\with\StackCharacter\cr}}} + +%D \startbuffer +%D \StackCharacters{CONTEXT}{}{\vskip.2ex}{\FunnyCommand} +%D \stopbuffer +%D +%D Such a stack looks like: +%D +%D \startlinecorrection +%D \hbox to \hsize +%D {$\hss\bfd +%D \vcenter{\StackCharacters{TEX} {}{\vskip.2ex}{\FunnyCommand}}% +%D \hss +%D \vcenter{\StackCharacters{CON} {}{\vskip.2ex}{\FunnyCommand}} +%D \hss +%D \vcenter{\StackCharacters{TEXT} {}{\vskip.2ex}{\FunnyCommand}} +%D \hss +%D \vcenter{\StackCharacters{CONTEXT}{}{\vskip.2ex}{\FunnyCommand}} +%D \hss$} +%D \stoplinecorrection +%D +%D and is typeset by saying: +%D +%D \typebuffer +%D +%D An alternative would have been +%D +%D \starttyping +%D \StackCharacters {CONTEXT} {to 5cm} {\vfill} {\FunnyCommand} +%D \stoptyping + +%D \macros +%D {processtokens} +%D +%D At a lower level horizontal and vertical manipulations are +%D already supported by: +%D +%D \starttyping +%D \processtokens {begin} {between} {end} {space} {text} +%D \stoptyping +%D +%D \startbuffer[a] +%D \processtokens +%D {\hbox to .5\hsize\bgroup} {\hfill} +%D {\egroup} {\space} {LET'S HAVE} +%D \stopbuffer +%D +%D \startbuffer[b] +%D \processtokens +%D {\vbox\bgroup\raggedcenter\hsize1em} +%D {\vskip.25ex} {\egroup} {\strut} {FUN} +%D \stopbuffer +%D +%D This macro is able to typeset: +%D +%D \leavevmode\hbox to \hsize +%D {$\hfil\hfil +%D \vcenter{\bf\getbuffer[a]}% +%D \hfil +%D \vcenter{\bfd\getbuffer[b]}% +%D \hfil\hfil$} +%D +%D which was specified as: +%D +%D \typebuffer[a] +%D \typebuffer[b] + +%D \macros +%D {NormalizeFontHeight, NormalizeFontWidth, +%D TheNormalizedFontSize} +%D +%D Next we introduce some font manipulation macros. When we +%D want to typeset some text spread in a well defined area, it +%D can be considered bad practice to manipulate character and +%D word spacing. In such situations the next few macros can be +%D of help: +%D +%D \starttyping +%D \NormalizeFontHeight \name {sample text} {height} {font} +%D \NormalizeFontWidth \name {sample text} {width} {font} +%D \stoptyping +%D +%D These are implemented using an auxilliary macro: + +\def\NormalizeFontHeight{\NormalizeFontSize\ht} +\def\NormalizeFontWidth {\NormalizeFontSize\wd} + +% \def\NormalizeFontSize#1#2#3#4#5% +% {\bgroup +% \dimen0=#4% #4 can be \ht0 or so +% \setbox0\hbox{\definedfont[#5 at 10pt]#3}% +% \ifdim\wd0>\zeropoint +% \dimen2=#10 % #1 is \wd or \ht +% \dimen4=10000pt +% \divide\dimen4 \dimen2 +% \divide\dimen0 \plusthousand +% \dimen0=\number\dimen4\dimen0 +% \xdef\TheNormalizedFontSize{\the\dimen0}% +% \else +% \dimen0\bodyfontsize +% \fi +% \definedfont[#5 at \the\dimen0]% +% \expandafter +% \egroup +% \expandafter\font\expandafter#2\fontname\font\relax} +% +% the familiar struggle with accuracy forces us to use: + +\def\NormalizeFontSize#1#2#3#4#5% + {\bgroup + \dimen0=#4% #4 can be \ht0 or so + \setbox0\hbox{\definedfont[#5 at 5pt]#3}% 10pt + \ifdim\wd0>\zeropoint + \dimen2=#10 % #1 is \wd or \ht + \dimen4=\maxdimen % 10000pt + \divide\dimen4 \dimen2 + \divide\dimen0 1638 % 1000 + \dimen0=\number\dimen4\dimen0 + \divide \dimen0 \plustwo % ... + \xdef\TheNormalizedFontSize{\the\dimen0}% + \else + \dimen0\bodyfontsize + \fi + % mkii + % \definedfont[#5 at \the\dimen0]% + % \expandafter + % \egroup + % \expandafter\font\expandafter#2\fontname\font\relax} + % mkiv safe (file: prefix etc) + \expanded{\egroup\def\noexpand#2{\definedfont[#5 at \the\dimen0]}}} + +%D Afterwards, we have access to the calculated size by: + +\let\TheNormalizedFontSize\!!zeropoint + +%D Extra: + +\def\WidthSpanningText#1#2#3% text width font + {\hbox{\NormalizeFontWidth\temp{#1}{#2}{#3}\temp\the\everydefinedfont#1}} + +%D Consider for instance: +%D +%D \startbuffer +%D \NormalizeFontHeight \tmp {X} {2\baselineskip} {cmr10} +%D +%D {\tmp To Be Or Not To Be} +%D \stopbuffer +%D +%D \typebuffer +%D +%D This shows up as (we also show the baselines): +%D +%D {\showbaselines\getbuffer} +%D +%D The horizontal counterpart is: +%D +%D \startbuffer +%D \NormalizeFontWidth \tmp {This Line Fits} {\hsize} {cmr10} +%D +%D \hbox{\tmp This Line Fits} +%D \stopbuffer +%D +%D \typebuffer +%D +%D The calculated font scale is avaliable in the macro +%D \type{\NormalizedFontSize}. +%D +%D \startlinecorrection +%D \ruledhbox{\getbuffer} +%D \stoplinecorrection +%D +%D One can of course combine these macros with the ones +%D described earlier, like in: +%D +%D \starttyping +%D \NormalizeFontHeight {text} \DroppedFont {2\baselineskip} {cmbx12} +%D +%D \def\NicelyDroppedCaps +%D {\DroppedCaps +%D {\color[green]} +%D {\DroppedFont} +%D {2pt} +%D {\baselineskip} +%D {2}} +%D \stoptyping +%D +%D It's up to the reader to test this one. + +\unexpanded\def\FirstNCharacters#1#2% \FirstNCharacters{3}{fr{\"o}beln} + {\bgroup + \scratchcounter\zerocount + \def\docommand##1% + {\ifnum\scratchcounter=#1\else + ##1\relax % catches ##1 = \"e and alike + \advance\scratchcounter\plusone + \fi} + \handletokens#2\with\docommand + \egroup} + +%D \macros +%D {FittingText} +%D +%D First used in Pascal (demo-bbv): +%D +%D \startbuffer +%D \ruledvbox{\FittingText{3cm}{1cm}{Serif}{24pt}{1pt}{1} +%D {\veryraggedright +%D \hangindent1em\hangafter1\relax +%D \begstrut \dorecurse{8}{Bram Marta }\unskip \endstrut}} +%D +%D \ruledvbox{\FittingText{3cm}{1cm}{Serif}{24pt}{1pt}{1} +%D {\raggedleft\begstrut Bram\\Marta \unskip\endstrut}} +%D \stopbuffer +%D +%D \typebuffer +%D +%D \startlinecorrection +%D \getbuffer +%D \stoplinecorrection + +% #1 width #2 height #3 font #4 size #5 step #6 interlinie #7 text + +\long\def\FittingText#1#2#3#4#5#6#7% + {\bgroup + \forgetall + \dontcomplain + \setuptolerance[\v!verytolerant]% == \tolerance4500 + \hsize#1% + \def\\{\softbreak}% + \!!heighta#4% + \!!heightb#2% + \doloop + {\ifdim\!!heighta>\onepoint + \expanded{\definefont[\s!dummy][#3 at \the\!!heighta][\c!interlinespace=#6]}% + \getvalue\s!dummy + \setbox\scratchbox\vbox{#7\endgraf}% + \ifdim\ht\scratchbox>\!!heightb + \advance\!!heighta-#5% + \else + \beginshapebox + \unvcopy\scratchbox + \endshapebox + \global\dimen1\hsize + \reshapebox + {\setbox\shapebox\hbox{\unhbox\shapebox}% + \ifdim\wd\shapebox>\dimen1 + \global\dimen1\wd\shapebox + \fi}% + \ifdim\dimen1>\hsize + \advance\!!heighta-#5% + \else + \exitloop + \fi + \fi + \else + \exitloop + \fi}% + %\writestatus{\strippedcsname\FittingText}{height: \the\!!heighta}% + \unvbox\scratchbox + \egroup} + +%D New: + +% \font width gap font spec text + +\def\NormalizeFontWidthSpread#1#2#3#4#5#6% + {\global\setfalse\NFSpread + \scratchdimen#3% + \scratchdimen-.5\scratchdimen + \advance\scratchdimen#2\relax + \NormalizeFontWidth + #1% + {\def\+{\global\settrue\NFSpread\gobbleuntil\relax}% + \def\\{\gobbleuntil\relax}% newline + \setupspacing + #6\relax}% + {\scratchdimen}% + {#4}% + \ifconditional\NFSpread + % de gap valt in de binding + \else + \definefont[\strippedcsname#1][#4 #5]% + \fi} + +\def\SpreadGapText#1#2% + {{\def\+{\kern#1}#2}} + +\def\GapText#1#2#3#4#5% width distance font spec title + {\bgroup + \NormalizeFontWidthSpread\DummyFont{#1}{#2}{#3}{#4}{#5}% + \DummyFont\setupspacing\SpreadGapText{#2}{#5}\endgraf + \egroup} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/supp-fun.tex b/Master/texmf-dist/tex/context/base/supp-fun.tex deleted file mode 100644 index 6b26437038e..00000000000 --- a/Master/texmf-dist/tex/context/base/supp-fun.tex +++ /dev/null @@ -1,746 +0,0 @@ -%D \module -%D [ file=supp-fun, -%D version=1995.10.10, -%D title=\CONTEXT\ Support Macros, -%D subtitle=Fun Stuff, -%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 This module implements some typographics tricks that can -%D be fun when designing document layouts. The examples use -%D macros that are typical to \CONTEXT, but non \CONTEXT\ -%D users can use the drop caps and first line treatment -%D macros without problems. This module will be extended -%D when the need for more of such tricks arises. - -\ifx \undefined \writestatus \input supp-mis.tex \relax \fi - -\writestatus{loading}{ConTeXt Support Macros / Fun Stuff} - -\ifx\definefont\undefined - \def\definedfont[#1]{\font\temp#1\relax\temp} -\fi - -%D \macros -%D {DroppedCaps, DroppedString, DroppedIndent, DroppedLines} -%D -%D \startbuffer -%D \DroppedCaps -%D {\color[green]} {cmbx12} -%D {2.2\baselineskip} {2pt} {\baselineskip} {2} -%D Let's start -%D \stopbuffer -%D -%D \getbuffer with dropped caps, those blown up first -%D characters of a paragraph. It's hard to implement a general -%D mechanism that suits all situations, but dropped caps are so -%D seldomly used that we can permit ourselves a rather user -%D unfriendly implementation. -%D -%D \typebuffer -%D -%D As we will see, there are 7 different settings involved. The -%D first argument takes a command that is used to do whatever -%D fancy things we want to do, but normally this one will be -%D empty. The second argument takes the font. Because we're -%D dealing with something very typographic, there is no real -%D reason to adopt complicated font switching schemes, a mere -%D name will do. Font encodings can bring no harm, because the -%D alphanumeric characters are nearly always located at their -%D natural position in the encoding vector. -%D -%D \startbuffer -%D \DroppedCaps -%D {\color[red]} {cmbx12} -%D {\baselineskip} {0pt} {0pt} {1} -%D This simple -%D \stopbuffer -%D -%D \getbuffer case shows us what happens when we apply minimal -%D values. Here we used: -%D -%D \typebuffer -%D -%D \startbuffer -%D \DroppedCaps -%D {\color[red]} {cmbx12} -%D {2\baselineskip} {0pt} {\baselineskip} {2} -%D Is this ugly -%D \stopbuffer -%D -%D \getbuffer example the third argument tells -%D this macro that we want a dropped capital scaled to the -%D baseline distance. The two zero point arguments are the -%D horizontal and vertical offsets and the last arguments -%D determines the hanging indentation. In this paragraph we -%D set the height to two times the baselinedistance and use -%D two hanging lines: -%D -%D \typebuffer -%D -%D Here, the first character is moved down one baseline. Here -%D we also see why the horizontal offset is important. The -%D first example (showing the~L) sets this to a few points and -%D also used a slightly larger height. -%D -%D Of course common users (typist) are not supposed to see this -%D kind of fuzzy definitions, but fortunately \TEX\ permits us -%D to hide them in macros. Using a macro also enables us to -%D garantee consistency throughout the document: -%D -%D \startbuffer -%D \def\MyDroppedCaps% -%D {\DroppedCaps -%D {\color[green]} {cmbx12} -%D {5\baselineskip} {3pt} {3\baselineskip} {4}} -%D -%D \MyDroppedCaps The implementation -%D \stopbuffer -%D -%D \typebuffer -%D -%D \getbuffer of the general macro is rather simple and only -%D depends on the arguments given and the dimensions of the -%D strut box. We explicitly load the font, which is no problem -%D because \TEX\ does not load a font twice. We could have -%D combined some arguments, like the height, vertical offset -%D and the number of lines, but the current implementation -%D proved to be the most flexible. One should be aware of the -%D fact that the offsets depend on the design of the glyphs -%D used. - -\let\DroppedIndent\!!zeropoint \def\DroppedLines{0} - -\def\DroppedString{ABCDEFGHIJKLMNOPQRSTUVWXYZ} - -\let\globaldropcaps\global % will be an option, but on by default - -\def\localdropcaps{\let\globaldropcaps\relax} - -\chardef\DroppedStatus = 0 % 0=done 1=starting 2=doing 3=error -\chardef\DropMode = 0 % 1 == marginhang - -\ifx\keeplinestogether\undefined - \let\keeplinestogether\gobbleoneargument -\fi - -\def\DroppedCaps#1#2#3#4#5#6#7% does not yet handle accented chars - {\defconvertedargument\asciia{#7}% - \defconvertedcommand \asciib{\DroppedString}% - \ExpandBothAfter\doifinstringelse\asciia\asciib - {\noindentation - \dontleavehmode - \checkindentation % redo this one - %\ifhmode\hskip-\parindent\fi % sensitive for context mechanism - \keeplinestogether{#6}% - \setbox0\hbox{\definedfont[#2 at #3]#1{#7}\hskip#4}% - \ifdim\dp0>\strutdp % one of those Q's , will be option - \setbox2\hbox{\raise\dp0\hbox{\lower\strutdp\copy0}}% - \ht2\ht0 - \dp0\strutdp - \setbox0\box2 - \fi - \setbox0\hbox - {\ifnum\DropMode=\plusone - \hskip-\wd0\wd0\zeropoint - \fi - \lower#5\box0}% - \ht0\strutht - \dp0\strutdp - \ifnum\DropMode=\plusone - \globaldropcaps\let\DroppedIndent\!!zeropoint - \globaldropcaps\edef\DroppedLines{\number\maxdimen}% - \globaldropcaps\chardef\DroppedStatus\plusthree - \else - \globaldropcaps\edef\DroppedIndent{\the\wd0}% - \globaldropcaps\edef\DroppedLines {\number#6}% - \globaldropcaps\chardef\DroppedStatus\plustwo - \globaldropcaps\hangindent\DroppedIndent - \globaldropcaps\hangafter-\DroppedLines -% \noindent - \noindentation - \checkindentation % redo this one - \hskip-\DroppedIndent - \fi - \vbox{\forgetall\box0}% - \nobreak - \let\next\ignorespaces} % Could be a one character word ! - {\globaldropcaps\let\DroppedIndent\!!zeropoint - \globaldropcaps\edef\DroppedLines{\number\maxdimen}% - \globaldropcaps\chardef\DroppedStatus\plusthree - \def\next{#7}}% - \let\globaldropcaps\global - \next} - -%D Before we go to the next topic, we summarize this command: -%D -%D \starttyping -%D \DroppedCaps -%D {command} {font} -%D {height} {hoffset} {voffset} {lines} -%D \stoptyping -%D -%D Sometimes you need to make sure that the global settings are -%D kept local, as in: -%D -% %D \startbuffer -% %D \defineparagraphs[SomePar][n=2,rule=on] -% %D \setupparagraphs [SomePar][1][width=.5\textwidth] -% %D \setupparagraphs [SomePar][2][width=.5\textwidth] -%D \startbuffer -%D \defineparagraphs[SomePar][n=2,rule=on] -%D \setupparagraphs [SomePar][1][width=.5\textwidth] -%D \setupparagraphs [SomePar][2][width=.5\textwidth] -%D -%D \startSomePar -%D \localdropcaps\NiceDroppedCaps{}{cmr12}{0pt}{2}Here we need -%D to explicitly keep the hanging indentation local, like it or -%D not. -%D \SomePar -%D \localdropcaps\NiceDroppedCaps{}{cmr12}{0pt}{2}Here we need -%D to explicitly keep the hanging indentation local, like it or -%D not. -%D \stopSomePar -%D \stopbuffer -%D -%D \typebuffer \getbuffer - -%D \macros -%D {AutoDroppedCaps, CheckDroppedCaps} -%D -%D {\em To be documented.} - -% example usage -% -% \def\bpar{\ifvmode\CheckDroppedCaps\fi} -% \def\epar{\ifhmode\par\fi\CheckDroppedCaps} - -\newcount\lastprevgraf -\newcount\droppedlines - -\def\CheckDroppedCaps - {\global\lastprevgraf\prevgraf} - -\def\AutoDroppedCaps % will be proper core stuff since it - {\globaldropcaps\chardef\DroppedStatus\plusone - \global\lastprevgraf\zerocount - \global\droppedlines\zerocount - \EveryPar{\doAutoDroppedCaps}} - -\let\AutoDroppedNext\relax - -\ifx\AutoDroppedCapsCommand\undefined - \def\AutoDroppedCapsCommand{\NiceDroppedCaps{}{SerifBold}{.125em}{3}} -\fi - -\def\doAutoDroppedCaps - {\ifcase\DroppedStatus % done - \let\next\relax - \or % starting - % \ifnum\lastprevgraf>0 % tricky, probably a wrong par - % \globaldropcaps\chardef\DroppedStatus=3 % and inhibits dropped - % \let\next\relax % caps after titles and more than once - % \else % so let's nill this rubishly code fragment - \let\next\AutoDroppedCapsCommand - % \fi % and hope for the best - \or % doing - \global\advance\droppedlines \lastprevgraf - \ifnum\droppedlines=\zerocount - \globaldropcaps\chardef\DroppedStatus\zerocount - \let\next\relax - \else\ifnum\droppedlines>\zerocount - \ifnum\droppedlines<\DroppedLines\relax - \globaldropcaps\hangindent\DroppedIndent - \globaldropcaps\hangafter-\DroppedLines - \globaldropcaps\advance\hangafter \droppedlines - \hskip-\parindent % brrr - \let\next\AutoDroppedNext - \else - \globaldropcaps\chardef\DroppedStatus\zerocount - \let\next\relax - \fi - \else - \globaldropcaps\chardef\DroppedStatus\zerocount - \let\next\relax - \fi\fi - \or % error - \globaldropcaps\chardef\DroppedStatus\zerocount - \let\next\relax - \fi - \next} - -%D \macros -%D {LineDroppedCaps, NiceDroppedCaps} -%D -%D To save definitions, we also provide: -%D -%D \starttyping -%D \LineDroppedCaps {command} {font} {hoffset} {lines} -%D \NiceDroppedCaps {command} {font} {hoffset} {lines} -%D \stoptyping -%D -%D The first command scales the font to the exact height, while -%D the second command scales the font to a nice 2.5 times the -%D line height, a value that gives a pleasant grayness. - -\def\DoLineDroppedCaps#1#2#3#4#5% compensation command font offset lines - {\scratchcounter#5% - \advance\scratchcounter \minusone - \scratchdimen\scratchcounter\baselineskip - \advance\scratchdimen #1% - \NormalizeFontHeight\DummyFont{W}\scratchdimen{#3}% - \DroppedCaps{#2}{#3}\TheNormalizedFontSize{#4} - {\scratchcounter\baselineskip}{#5}} - -\def\LineDroppedCaps% command font offset lines - {\DoLineDroppedCaps{\strutht}} - -\def\NiceDroppedCaps% command font offset lines - {\DoLineDroppedCaps{.5\baselineskip}} - -%D \macros -%D {TreatFirstLine} -%D -%D \startbuffer -%D \TreatFirstLine {\sc} {} {} {} -%D Instead of limiting its action to one token, the next macro -%D treats the whole first line. This paragraph was typeset by -%D saying: -%D \stopbuffer -%D -%D \getbuffer -%D -%D \typebuffer -%D -%D \startbuffer -%D \TreatFirstLine {\startcolor[red]\bf} {\stopcolor} {} {} -%D The combined color and font effect is also possible, -%D although one must be careful in using macros that accumulate -%D grouping, but the commands used here are pretty save in that -%D respect. -%D \stopbuffer -%D -%D \getbuffer -%D -%D \typebuffer -%D -%D Before we explain the third and fourth argument, we show the -%D implementation. Those who know a bit about the way \TEX\ -%D treats tokens, will probably see in one glance that this -%D alternative works all right for most text||only situations -%D in which there is enough text available for the first line, -%D but that more complicated things will blow. One has to live -%D with that. A workaround is rather trivial but obscures the -%D principles used. - -\def\TreatFirstLine#1#2#3#4% before, after, first, next - {\leavevmode - \bgroup - \forgetall - \bgroup - #1% - \setbox0\emptybox - \setbox2\emptybox - \def\grabfirstline##1 % - {\setbox2\hbox - {\ifvoid0 - {#3{\ignorespaces##1}}% - \else - \unhcopy0\ {#4{##1}}% - \fi}% - \ifdim\wd2=\zeropoint - \setbox0\emptybox - \setbox2\emptybox - \@EA\grabfirstline - \else\ifdim\wd2>\hsize - \hbox to \hsize{\strut\unhbox0}#2\egroup - \break##1\ - \egroup - \else - \setbox0\box2 - \@EAEAEA\grabfirstline - \fi\fi}% - \grabfirstline} - -%D \startbuffer -%D \gdef\FunnyCommand -%D {\getrandomfloat\FunnyR{0}{1}% -%D \getrandomfloat\FunnyG{0}{1}% -%D \getrandomfloat\FunnyB{0}{1}% -%D \definecolor[FunnyColor][r=\FunnyR,g=\FunnyG,b=\FunnyB]% -%D \color[FunnyColor]} -%D -%D %\TreatFirstLine {\bf} {} {\FunnyCommand} {\FunnyCommand} -%D The third and fourth argument can be used to gain special -%D effects on the individual words. Of course one needs ... -%D \stopbuffer -%D -%D \getbuffer -%D to know a bit more about the macro package used to get real -%D nice effects, but this example probably demonstrates the -%D principles well. -%D -%D \typebuffer -%D -%D Like in dropped caps case, one can hide such treatments in a -%D macro, like: -%D -%D \starttyping -%D \def\MyTreatFirstLine% -%D {\TreatFirstLine{\bf}{}{\FunnyCommand}{\FunnyCommand}} -%D \stoptyping - -%D \macros -%D {reshapebox} -%D -%D \startbuffer -%D \beginofshapebox -%D When using \CONTEXT, one can also apply this funny command -%D to whole lines by using the reshape mechanism. Describing -%D this interesting mechanism falls outside the scope of this -%D module, so we only show the trick. This is an example of -%D low level \CONTEXT\ functionality: it's all there, and it's -%D stable, but not entirely meant for novice users. -%D \endofshapebox -%D -%D \reshapebox{\FunnyCommand{\box\shapebox}} \flushshapebox -%D \stopbuffer -%D -%D \getbuffer -%D -%D \typebuffer -%D -%D This mechanism permits hyphenation and therefore gives -%D better results than the previously discussed macro -%D \type{\TreatFirstLine}. - -%D \macros -%D {TreatFirstCharacter} -%D -%D \startbuffer -%D \TreatFirstCharacter{\bf\color[green]} Just to be -%D \stopbuffer -%D -%D \getbuffer complete we also offer a very simple one -%D character alternative, that is not that hard to understand: - -\def\TreatFirstCharacter#1#2% command, character - {{#1{#2}}} - -%D A previous paragraph started with: -%D -%D \typebuffer - -%D \macros -%D {StackCharacters} -%D -%D The next hack deals with vertical stacking. - -\def\StackCharacters#1#2#3#4% sequence vsize vskip command - {\vbox #2 - {\forgetall - \baselineskip\zeropoint - \def\StackCharacter##1{#4{##1}\cr\noalign{#3}}% - \halign - {\hss##\hss&##\cr - \handletokens#1\with\StackCharacter\cr}}} - -%D \startbuffer -%D \StackCharacters{CONTEXT}{}{\vskip.2ex}{\FunnyCommand} -%D \stopbuffer -%D -%D Such a stack looks like: -%D -%D \startlinecorrection -%D \hbox to \hsize -%D {$\hss\bfd -%D \vcenter{\StackCharacters{TEX} {}{\vskip.2ex}{\FunnyCommand}}% -%D \hss -%D \vcenter{\StackCharacters{CON} {}{\vskip.2ex}{\FunnyCommand}} -%D \hss -%D \vcenter{\StackCharacters{TEXT} {}{\vskip.2ex}{\FunnyCommand}} -%D \hss -%D \vcenter{\StackCharacters{CONTEXT}{}{\vskip.2ex}{\FunnyCommand}} -%D \hss$} -%D \stoplinecorrection -%D -%D and is typeset by saying: -%D -%D \typebuffer -%D -%D An alternative would have been -%D -%D \starttyping -%D \StackCharacters {CONTEXT} {to 5cm} {\vfill} {\FunnyCommand} -%D \stoptyping - -%D \macros -%D {processtokens} -%D -%D At a lower level horizontal and vertical manipulations are -%D already supported by: -%D -%D \starttyping -%D \processtokens {begin} {between} {end} {space} {text} -%D \stoptyping -%D -%D \startbuffer[a] -%D \processtokens -%D {\hbox to .5\hsize\bgroup} {\hfill} -%D {\egroup} {\space} {LET'S HAVE} -%D \stopbuffer -%D -%D \startbuffer[b] -%D \processtokens -%D {\vbox\bgroup\raggedcenter\hsize1em} -%D {\vskip.25ex} {\egroup} {\strut} {FUN} -%D \stopbuffer -%D -%D This macro is able to typeset: -%D -%D \leavevmode\hbox to \hsize -%D {$\hfil\hfil -%D \vcenter{\bf\getbuffer[a]}% -%D \hfil -%D \vcenter{\bfd\getbuffer[b]}% -%D \hfil\hfil$} -%D -%D which was specified as: -%D -%D \typebuffer[a] -%D \typebuffer[b] - -%D \macros -%D {NormalizeFontHeight, NormalizeFontWidth, -%D TheNormalizedFontSize} -%D -%D Next we introduce some font manipulation macros. When we -%D want to typeset some text spread in a well defined area, it -%D can be considered bad practice to manipulate character and -%D word spacing. In such situations the next few macros can be -%D of help: -%D -%D \starttyping -%D \NormalizeFontHeight \name {sample text} {height} {font} -%D \NormalizeFontWidth \name {sample text} {width} {font} -%D \stoptyping -%D -%D These are implemented using an auxilliary macro: - -\def\NormalizeFontHeight{\NormalizeFontSize\ht} -\def\NormalizeFontWidth {\NormalizeFontSize\wd} - -% \def\NormalizeFontSize#1#2#3#4#5% -% {\bgroup -% \dimen0=#4% #4 can be \ht0 or so -% \setbox0\hbox{\definedfont[#5 at 10pt]#3}% -% \ifdim\wd0>\zeropoint -% \dimen2=#10 % #1 is \wd or \ht -% \dimen4=10000pt -% \divide\dimen4 \dimen2 -% \divide\dimen0 \plusthousand -% \dimen0=\number\dimen4\dimen0 -% \xdef\TheNormalizedFontSize{\the\dimen0}% -% \else -% \dimen0\bodyfontsize -% \fi -% \definedfont[#5 at \the\dimen0]% -% \expandafter -% \egroup -% \expandafter\font\expandafter#2\fontname\font\relax} -% -% the familiar struggle with accuracy forces us to use: - -\def\NormalizeFontSize#1#2#3#4#5% - {\bgroup - \dimen0=#4% #4 can be \ht0 or so - \setbox0\hbox{\definedfont[#5 at 5pt]#3}% 10pt - \ifdim\wd0>\zeropoint - \dimen2=#10 % #1 is \wd or \ht - \dimen4=\maxdimen % 10000pt - \divide\dimen4 \dimen2 - \divide\dimen0 1638 % 1000 - \dimen0=\number\dimen4\dimen0 - \divide \dimen0 \plustwo % ... - \xdef\TheNormalizedFontSize{\the\dimen0}% - \else - \dimen0\bodyfontsize - \fi - % mkii - % \definedfont[#5 at \the\dimen0]% - % \expandafter - % \egroup - % \expandafter\font\expandafter#2\fontname\font\relax} - % mkiv safe (file: prefix etc) - \expanded{\egroup\def\noexpand#2{\definedfont[#5 at \the\dimen0]}}} - -%D Afterwards, we have access to the calculated size by: - -\let\TheNormalizedFontSize\!!zeropoint - -%D Extra: - -\def\WidthSpanningText#1#2#3% text width font - {\hbox{\NormalizeFontWidth\temp{#1}{#2}{#3}\temp\the\everydefinedfont#1}} - -%D Consider for instance: -%D -%D \startbuffer -%D \NormalizeFontHeight \tmp {X} {2\baselineskip} {cmr10} -%D -%D {\tmp To Be Or Not To Be} -%D \stopbuffer -%D -%D \typebuffer -%D -%D This shows up as (we also show the baselines): -%D -%D {\showbaselines\getbuffer} -%D -%D The horizontal counterpart is: -%D -%D \startbuffer -%D \NormalizeFontWidth \tmp {This Line Fits} {\hsize} {cmr10} -%D -%D \hbox{\tmp This Line Fits} -%D \stopbuffer -%D -%D \typebuffer -%D -%D The calculated font scale is avaliable in the macro -%D \type{\NormalizedFontSize}. -%D -%D \startlinecorrection -%D \ruledhbox{\getbuffer} -%D \stoplinecorrection -%D -%D One can of course combine these macros with the ones -%D described earlier, like in: -%D -%D \starttyping -%D \NormalizeFontHeight {text} \DroppedFont {2\baselineskip} {cmbx12} -%D -%D \def\NicelyDroppedCaps -%D {\DroppedCaps -%D {\color[green]} -%D {\DroppedFont} -%D {2pt} -%D {\baselineskip} -%D {2}} -%D \stoptyping -%D -%D It's up to the reader to test this one. - -\unexpanded\def\FirstNCharacters#1#2% \FirstNCharacters{3}{fr{\"o}beln} - {\bgroup - \scratchcounter\zerocount - \def\docommand##1% - {\ifnum\scratchcounter=#1\else - ##1\relax % catches ##1 = \"e and alike - \advance\scratchcounter\plusone - \fi} - \handletokens#2\with\docommand - \egroup} - -%D \macros -%D {FittingText} -%D -%D First used in Pascal (demo-bbv): -%D -%D \startbuffer -%D \ruledvbox{\FittingText{3cm}{1cm}{Serif}{24pt}{1pt}{1} -%D {\veryraggedright -%D \hangindent1em\hangafter1\relax -%D \begstrut \dorecurse{8}{Bram Marta }\unskip \endstrut}} -%D -%D \ruledvbox{\FittingText{3cm}{1cm}{Serif}{24pt}{1pt}{1} -%D {\raggedleft\begstrut Bram\\Marta \unskip\endstrut}} -%D \stopbuffer -%D -%D \typebuffer -%D -%D \startlinecorrection -%D \getbuffer -%D \stoplinecorrection - -% #1 width #2 height #3 font #4 size #5 step #6 interlinie #7 text - -\long\def\FittingText#1#2#3#4#5#6#7% - {\bgroup - \forgetall - \dontcomplain - \setuptolerance[\v!verytolerant]% == \tolerance4500 - \hsize#1% - \def\\{\softbreak}% - \!!heighta#4% - \!!heightb#2% - \doloop - {\ifdim\!!heighta>\onepoint - \expanded{\definefont[\s!dummy][#3 at \the\!!heighta][\c!interlinespace=#6]}% - \getvalue\s!dummy - \setbox\scratchbox\vbox{#7\endgraf}% - \ifdim\ht\scratchbox>\!!heightb - \advance\!!heighta-#5% - \else - \beginshapebox - \unvcopy\scratchbox - \endshapebox - \global\dimen1\hsize - \reshapebox - {\setbox\shapebox\hbox{\unhbox\shapebox}% - \ifdim\wd\shapebox>\dimen1 - \global\dimen1\wd\shapebox - \fi}% - \ifdim\dimen1>\hsize - \advance\!!heighta-#5% - \else - \exitloop - \fi - \fi - \else - \exitloop - \fi}% - %\writestatus{\strippedcsname\FittingText}{height: \the\!!heighta}% - \unvbox\scratchbox - \egroup} - -%D New: - -% \font width gap font spec text - -\def\NormalizeFontWidthSpread#1#2#3#4#5#6% - {\global\setfalse\NFSpread - \scratchdimen#3% - \scratchdimen-.5\scratchdimen - \advance\scratchdimen#2\relax - \NormalizeFontWidth - #1% - {\def\+{\global\settrue\NFSpread\gobbleuntil\relax}% - \def\\{\gobbleuntil\relax}% newline - \setupspacing - #6\relax}% - {\scratchdimen}% - {#4}% - \ifconditional\NFSpread - % de gap valt in de binding - \else - \definefont[\strippedcsname#1][#4 #5]% - \fi} - -\def\SpreadGapText#1#2% - {{\def\+{\kern#1}#2}} - -\def\GapText#1#2#3#4#5% width distance font spec title - {\bgroup - \NormalizeFontWidthSpread\DummyFont{#1}{#2}{#3}{#4}{#5}% - \DummyFont\setupspacing\SpreadGapText{#2}{#5}\endgraf - \egroup} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/supp-lat.mkii b/Master/texmf-dist/tex/context/base/supp-lat.mkii new file mode 100644 index 00000000000..576121327cb --- /dev/null +++ b/Master/texmf-dist/tex/context/base/supp-lat.mkii @@ -0,0 +1,59 @@ +%D \module +%D [ file=syst-ltx, +%D version=2009.10.13, +%D title=\CONTEXT\ System Macros, +%D subtitle=General, +%D author=Hans Hagen, +%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 The bib module assumes that sometimes this command is used but +%D in \MKIV\ we no longer assume that. +%D +%D \macros +%D {newcommand} +%D +%D This module replaces \type {t-bibltx} and implements the +%D \LATEX\ newcommand (sort of). This command is not to be +%D used directly but only is there for the occasional +%D \BIBTEX\ file that uses it. +%D +%D \starttyping +%D \newcommand\oeps {oeps} +%D \newcommand\oeps[6] {oeps[#1]#6} +%D \newcommand\oeps[6][whatever]{oeps[#1]#6} +%D \stoptyping + +\unprotect + +\def\newcommand#1% + {\dotripleempty\donewcommand[#1]} + +\def\donewcommand + {\ifthirdargument + \expandafter\donewcommandtwo + \else\ifsecondargument + \expandafter\expandafter\expandafter\donewcommandone + \else + \expandafter\expandafter\expandafter\donewcommandzero + \fi\fi} + +\def\donewcommandzero[#1][#2][#3]% + {\long\def#1} + +\def\donewcommandone[#1][#2][#3]% + {\scratchtoks{\long\def#1}% + \dorecurse{#2}{\scratchtoks\expandafter{\the\scratchtoks######1}}% + \the\scratchtoks} + +\def\donewcommandtwo[#1][#2][#3]% + {\long\def#1{\doifnextcharelse[{\getvalue{>>\string#1>>}}{\getvalue{>>\string#1>>}[#3]}}% + \scratchtoks{\long\setvalue{>>\string#1>>}[##1]}% + \dostepwiserecurse{2}{#2}{1}{\scratchtoks\expandafter{\the\scratchtoks######1}}% + \the\scratchtoks} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/supp-mat.mkiv b/Master/texmf-dist/tex/context/base/supp-mat.mkiv index 4aebddda91d..e441cbc2824 100644 --- a/Master/texmf-dist/tex/context/base/supp-mat.mkiv +++ b/Master/texmf-dist/tex/context/base/supp-mat.mkiv @@ -46,9 +46,26 @@ %D %D Which is implemented as: -\long\def\mathematics#1{\relax \ifmmode#1\else\Ustartmath #1\Ustopmath \fi} -\long\def\displaymath#1{\noindent \ifmmode#1\else\Ustartdisplaymath#1\Ustopdisplaymath\fi} -\long\def\inlinemath #1{\dontleavehmode\ifmmode#1\else\Ustartmath #1\Ustopmath \fi} +\let\normalsuperscript \Usuperscript +\let\normalsubscript \Usubscript +\let\normalstartimath \Ustartmath +\let\normalstopimath \Ustopmath +\let\normalstartdmath \Ustartdisplaymath +\let\normalstopdmath \Ustopmath +\def\normalmathaligntab{&} % \let\normalmathaligntab\aligntab does to work well in a let to & (a def works ok) + +\let\normalsuper \Usuperscript % obsolete +\let\normalsuber \Usubscript % obsolete +\let\startimath \Ustartmath % obsolete, less safe +\let\stopimath \Ustopmath % obsolete, less safe +\let\startdmath \Ustartdisplaymath % obsolete, less safe +\let\stopdmath \Ustopmath % obsolete, less safe + +\long\def\mathematics#1{\relax \ifmmode#1\else\normalstartimath#1\normalstopimath\fi} +\long\def\displaymath#1{\noindent \ifmmode#1\else\normalstartdmath#1\normalstopdmath\fi} +\long\def\inlinemath #1{\dontleavehmode\ifmmode#1\else\normalstartimath#1\normalstopimath\fi} + +\let\m\mathematics % unexpanded? \let\stopmathmode\relax @@ -56,14 +73,14 @@ {\relax\ifmmode \let\stopmathmode\relax \else - \Ustartmath\let\stopmathmode\Ustopmath + \normalstartimath\let\stopmathmode\normalstopimath \fi} \unexpanded\def\startmathmode % nested variant {\relax\ifmmode \begingroup\let\stopmathmode\endgroup \else - \Ustartmath\let\stopmathmode\Ustopmath + \normalstartimath\let\stopmathmode\normalstopimath \fi} \def\nomathematics#1% @@ -127,67 +144,58 @@ \unexpanded\def\nodimension#1% {\unskip#1\global\let\dodimensionsignal\relax} -%D \macros -%D {super, suber} -%D -%D \TEX\ uses \type{^} and \type{_} for entering super- and -%D subscript mode. We want however a bit more control than -%D normally provided, and therefore provide \type {\super} -%D and \type{\suber} (\type {\sub} is already taken). - -\global\let\normalsuper=^ -\global\let\normalsuber=_ - -\newcount\supersubmode - -\newevery\everysupersub \EverySuperSub - -\appendtoks \advance\supersubmode 1\relax \to \everysupersub - -% \def\dodosuper#1{\normalsuper{\the\everysupersub#1}} -% \def\dodosuber#1{\normalsuber{\the\everysupersub#1}} +% %D \macros +% %D {super, suber} +% %D +% %D \TEX\ uses \type{^} and \type{_} for entering super- and +% %D subscript mode. We want however a bit more control than +% %D normally provided, and therefore provide \type {\super} +% %D and \type{\suber} (\type {\sub} is already taken). % -% \def\dosuper{\ifx\next\bgroup\expandafter\dodosuper\else\normalsuper\fi} -% \def\dosuber{\ifx\next\bgroup\expandafter\dodosuber\else\normalsuber\fi} +% \global\let\normalsuper=\normalsuperscript % will become obsolete +% \global\let\normalsuber=\normalsubscript % will become obsolete % -% \def\super{\futurelet\next\dosuper} -% \def\suber{\futurelet\next\dosuber} - -\def\super#1{\normalsuper{\the\everysupersub#1}} -\def\suber#1{\normalsuber{\the\everysupersub#1}} - -%D \macros -%D {enablesupsub} -%D -%D We can let \type {^} and \type {_} act like \type {\super} -%D and \type {\suber} by saying \type {\enablesupsub}. - -\bgroup -\catcode`\^=\@@active -\catcode`\_=\@@active -\gdef\enablesupsub - {\catcode`\^=\@@active - \def^{\ifmmode\expandafter\super\else\expandafter\normalsuper\fi}% - \catcode`\_=\@@active - \def_{\ifmmode\expandafter\suber\else\expandafter\normalsuber\fi}} -\egroup - -%D \macros -%D {restoremathstyle} -%D -%D We can pick up the current math style by calling \type -%D {\restoremathstyle}. - -\def\restoremathstyle - {\ifmmode - \ifcase\supsubmode - \textstyle - \or - \scriptstyle - \else - \scriptscriptstyle - \fi - \fi} +% \newcount\supersubmode +% +% \newevery\everysupersub \EverySuperSub +% +% \appendtoks \advance\supersubmode\plusone \to \everysupersub +% +% \def\super#1{\normalsuperscript{\the\everysupersub#1}} +% \def\suber#1{\normalsubscript {\the\everysupersub#1}} +% +% %D \macros +% %D {enablesupsub} +% %D +% %D We can let \type {^} and \type {_} act like \type {\super} +% %D and \type {\suber} by saying \type {\enablesupsub}. +% +% \bgroup +% \catcode\circumflexasciicode\activecatcode +% \catcode\underscoreasciicode\activecatcode +% \gdef\enablesupsub +% {\catcode\circumflexasciicode\activecatcode +% \catcode\underscoreasciicode\activecatcode +% \def^{\ifmmode\expandafter\super\else\expandafter\normalsuper\fi}% +% \def_{\ifmmode\expandafter\suber\else\expandafter\normalsuber\fi}} +% \egroup +% +% %D \macros +% %D {restoremathstyle} +% %D +% %D We can pick up the current math style by calling \type +% %D {\restoremathstyle}. +% +% \def\restoremathstyle +% {\ifmmode +% \ifcase\supsubmode +% \textstyle +% \or +% \scriptstyle +% \else +% \scriptscriptstyle +% \fi +% \fi} %D \macros %D {cramped} @@ -236,7 +244,7 @@ {\begingroup % added HH, made even more cramped \setbox\scratchbox\hbox {\nulldelimiterspace\zeropoint - \Ustartmath\mathsurround\zeropoint#1\radical\zerocount{#2}\Ustopmath}% + \normalstartimath\mathsurround\zeropoint#1\radical\zerocount{#2}\normalstopimath}% \ht\scratchbox-\dimexpr \ifx#1\displaystyle \fontdimen8\textfont3 @@ -290,4 +298,16 @@ \def\crampedrlap{\mathpalette\docrampedrlap} \def\crampedclap{\mathpalette\docrampedclap} +% experiment, not yet to be used + +% \def\displaybreak +% {\ifhmode +% \removeunwantedspaces +% \ifcase\raggedstatus\hfill\fi +% \strut\penalty-9999 % \break fails on case (3) +% \fi} +% +% \def\startdisplay{\displaybreak\ignorespaces\startpacked} +% \def\stopdisplay {\stoppacked\displaybreak\ignorespaces} + \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/supp-mpe.mkii b/Master/texmf-dist/tex/context/base/supp-mpe.mkii index 67b27919c06..f28176292d6 100644 --- a/Master/texmf-dist/tex/context/base/supp-mpe.mkii +++ b/Master/texmf-dist/tex/context/base/supp-mpe.mkii @@ -35,7 +35,7 @@ %D %D \MPcmykcolorstrue %D \MPspotcolorstrue -%D \chardef\makeMPintoPDFobject\plusone +%D \makeMPintoPDFobject\plusone %D \stoptyping \ifx\writestatus\undefined diff --git a/Master/texmf-dist/tex/context/base/supp-num.mkii b/Master/texmf-dist/tex/context/base/supp-num.mkii new file mode 100644 index 00000000000..74234975374 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/supp-num.mkii @@ -0,0 +1,422 @@ +%D \module +%D [ file=supp-num, +%D version=1998.05.15, +%D title=\CONTEXT\ Support Macros, +%D subtitle=Numbers, +%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 Support Macros / Numbers} + +\unprotect + +%D \macros +%D {digits, setdigitmode, setdigitsign} +%D +%D Depending on the digit mode the command \type {\digits} +%D normalizes number patterns depending on the language set. +%D +%D \starttyping +%D This will never be a \digits{1.000.000} seller. +%D \stoptyping +%D +%D or +%D +%D \starttyping +%D I will never grow longer than \digits 1.86 \Meter. +%D \stoptyping +%D +%D The different modes are shown in: +%D +%D \startbuffer +%D \setdigitmode 1 \digits 12.345,90 \digits 12.345.000 \digits 1,23 +%D \setdigitmode 2 \digits 12.345,90 \digits 12.345.000 \digits 1,23 +%D \setdigitmode 3 \digits 12.345,90 \digits 12.345.000 \digits 1,23 +%D \setdigitmode 4 \digits 12.345,90 \digits 12.345.000 \digits 1,23 +%D \setdigitmode 5 \digits 12.345,90 \digits 12.345.000 \digits 1,23 +%D \setdigitmode 6 \digits 12.345,90 \digits 12.345.000 \digits 1,23 +%D \stopbuffer +%D +%D \typebuffer +%D +%D This is typset as: +%D +%D \startlines +%D \getbuffer +%D \stoplines +%D +%D The sign can be typeset as is or within the space of a +%D digit. +%D +%D \startbuffer +%D \setdigitsign 0 \digits +12.345,90 +%D \setdigitmode 1 \digits +12.345,90 +%D \setdigitmode 2 \digits +12.345,90 +%D \setdigitmode 3 \digits +12.345,90 +%D \stopbuffer +%D +%D \typebuffer +%D +%D This is typset as: +%D +%D \startlines +%D \getbuffer +%D \stoplines + +\chardef\digitoutputmode=1 % 0..6 +\chardef\digitsignmode =0 % 0..3 + +\def\setdigitmode{\chardef\digitoutputmode} +\def\setdigitsign{\chardef\digitsignmode} + +%D The digit modes are: +%D +%D \startitemize[packed] +%D \item periods \& comma +%D \item commas \& period +%D \item thinmuskips \& comma +%D \item thinmuskips \& period +%D \item thickmuskips \& comma +%D \item thickmuskips \& period +%D \stopitemize + +\let\collecteddigits \empty \chardef\digitinputmode =1 +\let\saveddigits \empty \chardef\skipdigit =0 +\let\savedpowerdigits\empty \chardef\powerdigits =0 + +%D The first stage of the \type {\digit} macro takes care of +%D the grouped call, the other branch handles the fuzzy +%D delimited calls. + +\ifx\mbox\undefined \let\mbox\normalhbox \fi + +% \unexpanded\def\digits +% {\bgroup\let~@\doifnextbgroupelse\dodigits\grabdigit} + +\unexpanded\def\digits + {\bgroup + \let~@% + \doifnextbgroupelse\dodigits{\doifnextcharelse\normalmathshift\domathdigits\grabdigit}} + +\def\dodigits#1% + {\grabdigit#1\relax} + +\def\domathdigits$#1$% + {\mbox{\grabdigit#1\relax}} % adding $ $ goes wrong in tabulate + +\def\grabdigit + {\futurelet\next\scandigit} + +%D Watch the test for \type {\nextobeyedline}, because the +%D endofline token can be \type {\def'd}, not \type {\let}'d, +%D we need to do an indirect test (see \type {verb-ini.tex}) +%D for details. +%D +%D \starttyping +%D \def ^^M{\obeyedline} +%D \def\nextbeyedline{\obeyedline} +%D \stoptyping + +\ifx\normalmathshift\undefined \let\normalmathshift=$ \fi + +\def\scandigit + {\ifx\next\blankspace + \let\next\handledigits + \else\ifx\next\nextobeyedline % the indirect one + \let\next\handledigits + \else\ifx\next\bgroup + \let\next\handledigits + \else\ifx\next\egroup + \let\next\handledigits + \else\ifx\next\normalmathshift + \let\next\handledigits + \else + \let\next\collectdigit + \fi\fi\fi\fi\fi + \next} + +%D We store the power||of||ten (to be signaled by \type {^}, +%D \type {e} or~\type {E}) in a seperate macro so that we can +%D typeset it in superscript. The space placeholders are +%D replaced by a \type {@}. + +\def\savedigit#1#2% + {\edef#1{#1\saveddigits#2}\let\saveddigits\empty} + +\long\def\collectdigit#1% + {\ifx#1~% + \savedigit\collecteddigits @% + \else\if#1_% + \savedigit\collecteddigits @% + \else\if\noexpand#1\relax + \let\grabdigit\handledigits + \else\ifcase\powerdigits + \if#1E% + \chardef\powerdigits\plusone + \else\if#1e% + \chardef\powerdigits\plusone + \else\if#1^% + \chardef\powerdigits\plusone + \else + \savedigit\collecteddigits#1% + %\doifnumberelse{#1} + % {\savedigit\collecteddigits#1} + % {\def\saveddigits{#1}}% + \fi\fi\fi + \else + \savedigit\savedpowerdigits#1% + %\doifnumberelse{#1} + % {\savedigit\savedpowerdigits#1} + % {\def\saveddigits{#1}}% + \fi\fi\fi\fi + \grabdigit} + +\let\handlemathdigits\firstofoneargument +\let\handletextdigits\mathematics + +\def\handledigits + {%\ifcase\powerdigits + % \edef\collecteddigits{\collecteddigits\saveddigits}% + %\else + % \edef\savedpowerdigits{\savedpowerdigits\saveddigits}% + %\fi + \ifmmode + \handlemathdigits{\dohandledigits}% + \else + \dontleavehmode\hbox{\handletextdigits{\dohandledigits}}% + \fi + \egroup} + +%D Although we could do with one pass, a second pass for +%D handling the stored sequence is more readable. + +\ifnum\texengine=\luatexengine + + \def\dohandledigits + {\mathcode`\,="002C \mathcode`\.="002E % pretty hard coded + \expandafter\handletokens\collecteddigits\with\scandigits + \ifcase\powerdigits\else\digitpowerseparator^{\savedpowerdigits}\fi} + + \chardef\mathaxisfontid\zerocount + +\else + + \def\dohandledigits + {\mathcode`\,="013B \mathcode`\.="013A % pretty hard coded + \expandafter\handletokens\collecteddigits\with\scandigits + \ifcase\powerdigits\else\digitpowerseparator^{\savedpowerdigits}\fi} + + \chardef\mathaxisfontid\plustwo + +\fi + +\def\doscandigit#1% + {\ifcase\skipdigit\@EA\hbox\else\@EA\hphantom\fi\bgroup + \mathematics % brr, needed because of stored punctuation + {\ifnum\digitinputmode=#1\relax + \ifcase\digitoutputmode + \or .% + \or ,% + \or \mskip\thinmuskip + \or \mskip\thinmuskip + \or \mskip\thickmuskip + \or \mskip\thickmuskip + \fi + \else + \ifodd\digitoutputmode,\else.\fi + \fi}% + \egroup} + +%D The signs can be made smaller and sqeezed into the width +%D of a digit. Watch the \type {\mathaxisheight} trickery (this +%D font related register stored the math axis). + +% 0,= +% 0,== second = results in delta(00,=) +% 0,- is invalid, should be = +% 0,-- is invalid, should be == + +\def\digitzeroamount + {\digitsgn\zeroamount + \def\digitzeroamount + {\hphantom + {00\setbox\scratchbox\hbox{$\zeroamount$}% + \hskip-\wd\scratchbox}% + \let\digitzeroamount\empty}} + +\def\scandigits#1% + {\if#1.\digitsep1\else + \if#1,\digitsep2\else + \if#1@\digitnop \else + \if#1_\digitnop \else + \if#1/\digitsgn{\hphantom{+}}\chardef\skipdigit0\else + \if#1-\ifcase\skipdigit\digitsgn-\else + \box\digitsepbox\digitzeroamount \fi\chardef\skipdigit0\else + \if#1+\digitsgn+\chardef\skipdigit0\else + \if#1=\box\digitsepbox\digitzeroamount \chardef\skipdigit0\else + \if#1s\digitsgn{\hphantom{\positive}}\chardef\skipdigit0\else + \if#1p\digitsgn\positive\chardef\skipdigit0\else + \if#1m\digitsgn\negative\chardef\skipdigit0\else + \if#1n\digitsgn\negative\chardef\skipdigit0\else + \box\digitsepbox #1\chardef\skipdigit0\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} + +\newbox\digitsepbox \chardef\autodigitmode=1 + +\def\digitsep#1% + {\ifcase\autodigitmode + \doscandigit#1% + \else + \setbox\digitsepbox\hbox{\doscandigit#1}% + \fi + \chardef\skipdigit0\relax} + +% strange, does not work +% +% \def\digitnop +% {\hphantom{\box\digitsepbox}% +% \hphantom{0}\chardef\skipdigit1\relax} +% +% while this works + +\def\digitnop + {\hbox{\hphantom{\box\digitsepbox}}% + \hphantom{0}\chardef\skipdigit1\relax} + +% but this doesn't +% +% \def\digitnop +% {\hphantom{\box\digitsepbox0}% +% \chardef\skipdigit1\relax} + +\def\digitsgn#1% + {\ifcase\digitsignmode#1\else + \hbox + {\setbox\scratchbox\hbox{0}% + \scratchdimen\mathaxisheight\textfont\mathaxisfontid + \def\digitsgn##1##2% + {\advance\scratchdimen-\mathaxisheight##1\mathaxisfontid + \raise\scratchdimen + \hbox to \wd\scratchbox{\hss$##2#1$\hss}}% + \ifcase\digitsignmode\or + \digitsgn\textfont \textstyle \or + \digitsgn\scriptfont \scriptstyle \or + \digitsgn\scriptscriptfont\scriptscriptstyle\fi}% + \fi} + +\ifx\undefined\zeroamount \def\zeroamount{-} \fi +\ifx\undefined\positive \def\positive {+} \fi +\ifx\undefined\negative \def\negative {-} \fi + +%D The digit parser handles a bunch of special characters as +%D well as different formats. We strongly suggest you to use +%D the grouped call. +%D +%D \starttabulate[|l|l|l|] +%D \NC \type{.} \NC , . \NC comma or period \NC \NR +%D \NC \type{,} \NC , . \NC comma or period \NC \NR +%D \NC \type{@} \NC \NC invisible space \NC \NR +%D \NC \type{_} \NC \NC invisible space \NC \NR +%D \NC \type{/} \NC \NC invisible sign \NC \NR +%D \NC \type{-} \NC $-$ \NC minus sign \NC \NR +%D \NC \type{+} \NC $+$ \NC plus sign \NC \NR +%D \NC \type{s} \NC \NC invisible high sign \NC \NR +%D \NC \type{p} \NC $\positive$ \NC high plus sign \NC \NR +%D \NC \type{m} \NC $\negative$ \NC high minus sign \NC \NR +%D \NC \type{n} \NC $\negative$ \NC high minus (negative) sign \NC \NR +%D \NC \type{=} \NC $\zeroamount$ \NC zero padding \NC \NR +%D \stoptabulate +%D +%D These triggers are used in the following examples. +%D +%D \startbuffer +%D \digits 12 +%D \digits{~~~.~~~.~~~.68.712,34} +%D \digits ~~~.~~~.~~~.68.712,34 +%D \digits ___.___.111.68.712,34 +%D \digits 111.111.111.68.712,34 +%D \digits 12.345,90 +%D \digits 12.345.000 +%D \digits 12,34 +%D \digits{392.857.230.68.712,34} +%D {\digits1234} +%D \digits{1234} +%D \digits 1234\relax +%D $\digits 123.222,00$ +%D \digits 123.222,00 +%D \digits 123.222,== +%D \digits 123.222,00^10 +%D \digits 123.222,00e10 +%D \digits /123.222,00e-12 +%D \digits -123.222,00e-12 +%D \digits +123.222,00e-12 +%D \digits n123.222,00e-12 +%D \digits s123.222,00e-12 +%D \digits p123.222,00e-12 +%D \stopbuffer +%D +%D \typebuffer +%D +%D \startlines +%D \getbuffer +%D \stoplines + +%D \macros +%D {Digits} +%D +%D We also permit: + +\let\Digits\digits + +%D These macros are complicated by the fact that we also +%D have to support cases like: +%D +%D \starttyping +%D {\digits1234} +%D \digits{1234} +%D \digits 1234\whatever +%D $\digits 123.222,00$ +%D \digits 123.222,00. +%D \stoptyping +%D +%D The latter case shows us that trailing non digits are to +%D be passed untreated. +%D +%D Another interesting case is: +%D +%D \starttyping +%D \digits 123.222,00^10 +%D \stoptyping +%D +%D The separator is defined as: + +% \def\digitpowerseparator% +% {\cdot10} % {\times10} + +\def\digitpowerseparator + {\ifx\collecteddigits\empty\else\cdot\fi10} + +%D \macros +%D {digittemplate} +%D +%D Users can specify the way they enter those digits by saying +%D something like: +%D +%D \starttyping +%D \digittemplate 12.000.000,00 % \digittemplate ., +%D \stoptyping + +\def\digittemplate #1 % + {\chardef\digitinputmode\zerocount + \handletokens#1\with\scandigittemplate} + +\def\scandigittemplate#1% + {\if #1.\ifcase\digitinputmode\chardef\digitinputmode\plusone \fi% period + \else\if#1,\ifcase\digitinputmode\chardef\digitinputmode\plustwo \fi% comma + \fi\fi} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/supp-num.mkiv b/Master/texmf-dist/tex/context/base/supp-num.mkiv new file mode 100644 index 00000000000..68b775403e3 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/supp-num.mkiv @@ -0,0 +1,504 @@ +%D \module +%D [ file=supp-num, +%D version=1998.05.15, +%D title=\CONTEXT\ Support Macros, +%D subtitle=Numbers, +%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. + +% See end for transition to mkiv. + +\writestatus{loading}{ConTeXt Support Macros / Numbers} + +\unprotect + +%D \macros +%D {digits, setdigitmode, setdigitsign} +%D +%D Depending on the digit mode the command \type {\digits} +%D normalizes number patterns depending on the language set. +%D +%D \starttyping +%D This will never be a \digits{1.000.000} seller. +%D \stoptyping +%D +%D or +%D +%D \starttyping +%D I will never grow longer than \digits 1.86 \Meter. +%D \stoptyping +%D +%D The different modes are shown in: +%D +%D \startbuffer +%D \setdigitmode 1 \digits 12.345,90 \digits 12.345.000 \digits 1,23 +%D \setdigitmode 2 \digits 12.345,90 \digits 12.345.000 \digits 1,23 +%D \setdigitmode 3 \digits 12.345,90 \digits 12.345.000 \digits 1,23 +%D \setdigitmode 4 \digits 12.345,90 \digits 12.345.000 \digits 1,23 +%D \setdigitmode 5 \digits 12.345,90 \digits 12.345.000 \digits 1,23 +%D \setdigitmode 6 \digits 12.345,90 \digits 12.345.000 \digits 1,23 +%D \stopbuffer +%D +%D \typebuffer +%D +%D This is typset as: +%D +%D \startlines +%D \getbuffer +%D \stoplines +%D +%D The sign can be typeset as is or within the space of a +%D digit. +%D +%D \startbuffer +%D \setdigitsign 0 \digits +12.345,90 +%D \setdigitmode 1 \digits +12.345,90 +%D \setdigitmode 2 \digits +12.345,90 +%D \setdigitmode 3 \digits +12.345,90 +%D \stopbuffer +%D +%D \typebuffer +%D +%D This is typset as: +%D +%D \startlines +%D \getbuffer +%D \stoplines + +\chardef\digitoutputmode=1 % 0..6 +\chardef\digitsignmode =0 % 0..3 + +\def\setdigitmode{\chardef\digitoutputmode} +\def\setdigitsign{\chardef\digitsignmode} + +%D The digit modes are: +%D +%D \startitemize[packed] +%D \item periods \& comma +%D \item commas \& period +%D \item thinmuskips \& comma +%D \item thinmuskips \& period +%D \item thickmuskips \& comma +%D \item thickmuskips \& period +%D \stopitemize + +\let\collecteddigits \empty \chardef\digitinputmode =1 +\let\saveddigits \empty \chardef\skipdigit =0 +\let\savedpowerdigits\empty \chardef\powerdigits =0 + +%D The first stage of the \type {\digit} macro takes care of +%D the grouped call, the other branch handles the fuzzy +%D delimited calls. + +\ifx\mbox\undefined \let\mbox\normalhbox \fi + +% \unexpanded\def\digits +% {\bgroup\let~@\doifnextbgroupelse\dodigits\grabdigit} + +\unexpanded\def\digits + {\bgroup + \let~@% + \doifnextbgroupelse\dodigits{\doifnextcharelse\normalmathshift\domathdigits\grabdigit}} + +\def\dodigits#1% + {\grabdigit#1\relax} + +\def\domathdigits$#1$% + {\mbox{\grabdigit#1\relax}} % adding $ $ goes wrong in tabulate + +\def\grabdigit + {\futurelet\next\scandigit} + +%D Watch the test for \type {\nextobeyedline}, because the +%D endofline token can be \type {\def'd}, not \type {\let}'d, +%D we need to do an indirect test (see \type {verb-ini.tex}) +%D for details. (This probably needs an update.) + +\ifx\normalmathshift\undefined \let\normalmathshift=$ \fi + +\def\scandigit + {\ifx\next\blankspace + \let\next\handledigits + \else\ifx\next\nextobeyedline % the indirect one + \let\next\handledigits + \else\ifx\next\bgroup + \let\next\handledigits + \else\ifx\next\egroup + \let\next\handledigits + \else\ifx\next\normalmathshift + \let\next\handledigits + \else + \let\next\collectdigit + \fi\fi\fi\fi\fi + \next} + +%D We store the power||of||ten (to be signaled by \type {^}, +%D \type {e} or~\type {E}) in a seperate macro so that we can +%D typeset it in superscript. The space placeholders are +%D replaced by a \type {@}. + +\def\savedigit#1#2% + {\edef#1{#1\saveddigits#2}\let\saveddigits\empty} + +\long\def\collectdigit#1% + {\ifx#1~% + \savedigit\collecteddigits @% + \else\if#1_% tricky as can be several catcodes ... will become lua code anyway + \savedigit\collecteddigits @% + \else\if\noexpand#1\relax + \let\grabdigit\handledigits + \else\ifcase\powerdigits + \if#1E% + \chardef\powerdigits\plusone + \else\if#1e% + \chardef\powerdigits\plusone + \else\if#1^% + \chardef\powerdigits\plusone + \else + \savedigit\collecteddigits#1% + %\doifnumberelse{#1} + % {\savedigit\collecteddigits#1} + % {\def\saveddigits{#1}}% + \fi\fi\fi + \else + \savedigit\savedpowerdigits#1% + %\doifnumberelse{#1} + % {\savedigit\savedpowerdigits#1} + % {\def\saveddigits{#1}}% + \fi\fi\fi\fi + \grabdigit} + +\let\handlemathdigits\firstofoneargument +\let\handletextdigits\mathematics + +\def\handledigits + {%\ifcase\powerdigits + % \edef\collecteddigits{\collecteddigits\saveddigits}% + %\else + % \edef\savedpowerdigits{\savedpowerdigits\saveddigits}% + %\fi + \ifmmode + \handlemathdigits{\dohandledigits}% + \else + \dontleavehmode\hbox{\handletextdigits{\dohandledigits}}% + \fi + \egroup} + +%D Although we could do with one pass, a second pass for +%D handling the stored sequence is more readable. + +\ifnum\texengine=\luatexengine + + \def\dohandledigits + {\mathcode`\,="002C \mathcode`\.="002E % pretty hard coded + \expandafter\handletokens\collecteddigits\with\scandigits + \ifcase\powerdigits\else\digitpowerseparator^{\savedpowerdigits}\fi} + + \chardef\mathaxisfontid\zerocount + +\else + + \def\dohandledigits + {\mathcode`\,="013B \mathcode`\.="013A % pretty hard coded + \expandafter\handletokens\collecteddigits\with\scandigits + \ifcase\powerdigits\else\digitpowerseparator^{\savedpowerdigits}\fi} + + \chardef\mathaxisfontid\plustwo + +\fi + +\def\doscandigit#1% + {\ifcase\skipdigit\@EA\hbox\else\@EA\hphantom\fi\bgroup + \mathematics % brr, needed because of stored punctuation + {\ifnum\digitinputmode=#1\relax + \ifcase\digitoutputmode + \or .% + \or ,% + \or \mskip\thinmuskip + \or \mskip\thinmuskip + \or \mskip\thickmuskip + \or \mskip\thickmuskip + \fi + \else + \ifodd\digitoutputmode,\else.\fi + \fi}% + \egroup} + +%D The signs can be made smaller and sqeezed into the width +%D of a digit. Watch the \type {\mathaxisheight} trickery (this +%D font related register stored the math axis). + +% 0,= +% 0,== second = results in delta(00,=) +% 0,- is invalid, should be = +% 0,-- is invalid, should be == + +\def\digitzeroamount + {\digitsgn\zeroamount + \def\digitzeroamount + {\hphantom + {00\setbox\scratchbox\hbox{$\zeroamount$}% + \hskip-\wd\scratchbox}% + \let\digitzeroamount\empty}} + +\def\scandigits#1% + {\if#1.\digitsep1\else + \if#1,\digitsep2\else + \if#1@\digitnop \else + \if#1_\digitnop \else + \if#1/\digitsgn{\hphantom{+}}\chardef\skipdigit0\else + \if#1-\ifcase\skipdigit\digitsgn-\else + \box\digitsepbox\digitzeroamount \fi\chardef\skipdigit0\else + \if#1+\digitsgn+\chardef\skipdigit0\else + \if#1=\box\digitsepbox\digitzeroamount \chardef\skipdigit0\else + \if#1s\digitsgn{\hphantom{\positive}}\chardef\skipdigit0\else + \if#1p\digitsgn\positive\chardef\skipdigit0\else + \if#1m\digitsgn\negative\chardef\skipdigit0\else + \if#1n\digitsgn\negative\chardef\skipdigit0\else + \box\digitsepbox #1\chardef\skipdigit0\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} + +\newbox\digitsepbox \chardef\autodigitmode=1 + +\def\digitsep#1% + {\ifcase\autodigitmode + \doscandigit#1% + \else + \setbox\digitsepbox\hbox{\doscandigit#1}% + \fi + \chardef\skipdigit0\relax} + +% strange, does not work +% +% \def\digitnop +% {\hphantom{\box\digitsepbox}% +% \hphantom{0}\chardef\skipdigit1\relax} +% +% while this works + +\def\digitnop + {\hbox{\hphantom{\box\digitsepbox}}% + \hphantom{0}\chardef\skipdigit1\relax} + +% but this doesn't +% +% \def\digitnop +% {\hphantom{\box\digitsepbox0}% +% \chardef\skipdigit1\relax} + +\def\digitsgn#1% + {\ifcase\digitsignmode#1\else + \hbox + {\setbox\scratchbox\hbox{0}% + \scratchdimen\mathaxisheight\textfont\mathaxisfontid + \def\digitsgn##1##2% + {\advance\scratchdimen-\mathaxisheight##1\mathaxisfontid + \raise\scratchdimen + \hbox to \wd\scratchbox{\hss$##2#1$\hss}}% + \ifcase\digitsignmode\or + \digitsgn\textfont \textstyle \or + \digitsgn\scriptfont \scriptstyle \or + \digitsgn\scriptscriptfont\scriptscriptstyle\fi}% + \fi} + +\ifx\undefined\zeroamount \def\zeroamount{-} \fi +\ifx\undefined\positive \def\positive {+} \fi +\ifx\undefined\negative \def\negative {-} \fi + +%D The digit parser handles a bunch of special characters as +%D well as different formats. We strongly suggest you to use +%D the grouped call. +%D +%D \starttabulate[|l|l|l|] +%D \NC \type{.} \NC , . \NC comma or period \NC \NR +%D \NC \type{,} \NC , . \NC comma or period \NC \NR +%D \NC \type{@} \NC \NC invisible space \NC \NR +%D \NC \type{_} \NC \NC invisible space \NC \NR +%D \NC \type{/} \NC \NC invisible sign \NC \NR +%D \NC \type{-} \NC $-$ \NC minus sign \NC \NR +%D \NC \type{+} \NC $+$ \NC plus sign \NC \NR +%D \NC \type{s} \NC \NC invisible high sign \NC \NR +%D \NC \type{p} \NC $\positive$ \NC high plus sign \NC \NR +%D \NC \type{m} \NC $\negative$ \NC high minus sign \NC \NR +%D \NC \type{n} \NC $\negative$ \NC high minus (negative) sign \NC \NR +%D \NC \type{=} \NC $\zeroamount$ \NC zero padding \NC \NR +%D \stoptabulate +%D +%D These triggers are used in the following examples. +%D +%D \startbuffer +%D \digits 12 +%D \digits{~~~.~~~.~~~.68.712,34} +%D \digits ~~~.~~~.~~~.68.712,34 +%D \digits ___.___.111.68.712,34 +%D \digits 111.111.111.68.712,34 +%D \digits 12.345,90 +%D \digits 12.345.000 +%D \digits 12,34 +%D \digits{392.857.230.68.712,34} +%D {\digits1234} +%D \digits{1234} +%D \digits 1234\relax +%D $\digits 123.222,00$ +%D \digits 123.222,00 +%D \digits 123.222,== +%D \digits 123.222,00^10 +%D \digits 123.222,00e10 +%D \digits /123.222,00e-12 +%D \digits -123.222,00e-12 +%D \digits +123.222,00e-12 +%D \digits n123.222,00e-12 +%D \digits s123.222,00e-12 +%D \digits p123.222,00e-12 +%D \stopbuffer +%D +%D \typebuffer +%D +%D \startlines +%D \getbuffer +%D \stoplines + +%D \macros +%D {Digits} +%D +%D We also permit: + +\let\Digits\digits + +%D These macros are complicated by the fact that we also +%D have to support cases like: +%D +%D \starttyping +%D {\digits1234} +%D \digits{1234} +%D \digits 1234\whatever +%D $\digits 123.222,00$ +%D \digits 123.222,00. +%D \stoptyping +%D +%D The latter case shows us that trailing non digits are to +%D be passed untreated. +%D +%D Another interesting case is: +%D +%D \starttyping +%D \digits 123.222,00^10 +%D \stoptyping +%D +%D The separator is defined as: + +% \def\digitpowerseparator% +% {\cdot10} % {\times10} + +\def\digitpowerseparator + {\ifx\collecteddigits\empty\else\cdot\fi10} + +%D \macros +%D {digittemplate} +%D +%D Users can specify the way they enter those digits by saying +%D something like: +%D +%D \starttyping +%D \digittemplate 12.000.000,00 % \digittemplate ., +%D \stoptyping + +\def\digittemplate #1 % + {\chardef\digitinputmode\zerocount + \handletokens#1\with\scandigittemplate} + +\def\scandigittemplate#1% + {\if #1.\ifcase\digitinputmode\chardef\digitinputmode\plusone \fi% period + \else\if#1,\ifcase\digitinputmode\chardef\digitinputmode\plustwo \fi% comma + \fi\fi} + +\protect \endinput + + +\endinput + +\def\digitszeropadding {\zeroamount} +\def\digitsnegative {\mathematics\negative} +\def\digitspositive {\mathematics\positive} +\def\digitsspace {\hphantom{0}} +\def\digitsseparatorspace{\hphantom{.}} +\def\digitssignspace {\hphantom{+}} +\def\digitshighspace {\hphantom{\mathematics\positive}} +\def\digitspower {\high} + +\starttext + +% print(table.serialize(table.keys(jobs))) + +local P, S, R, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.Cs + +local done = false +local swap = false +local digit = R("09") +local sign = S("+-") +local power = S("^e") +local space = S(" ~@_") +local comma = P(",") +local period = P(".") +local signspace = P("/") +local positive = P("p") +local negative = P("n") +local highspace = P("s") +local padding = P("=") + +local space = space / "\\digitsspace" +local digit = digit / function(s) done = true return s end +local separator = comma / function(s) if not done then return "\\digitsseparatorspace" elseif swap then return "." else return "," end end + + period / function(s) if not done then return "\\digitsseparatorspace" elseif swap then return "," else return "." end end +local signspace = signspace / "\\digitssignspace" +local positive = positive / "\\digitspositive" +local negative = negative / "\\digitsnegative" +local highspace = highspace / "\\digitshighspace" +local power = power/"" * (Cs((sign + signspace)^0 * digit^1) / function(s) return "\\digitspower{" .. s .. "}" end) +local padding = padding / "\\digitszeropadding" + +local replace = lpeg.Cs ( + (sign + signspace + positive + negative + highspace)^0 + * (separator^0 * (space + digit)^1)^1 + * power^0 +) + +local function digits(str) + done = false +--~ swap = true + local str = lpeg.match(replace,str) +-- print(str) + tex.sprint(tex.ctxcatcodes,"\\dontleavehmode",str,"\\par") +end +-- namespaces.register("digits") + +digits("12") +digits("~~~.~~~.~~~.68.712,34") +digits("~~~.~~~.~~~.68.712,34") +digits("___.___.111.68.712,34") +digits("111.111.111.68.712,34") +digits("12.345,90") +digits("12.345.000") +digits("12,34") +digits("392.857.230.68.712,34") +digits("1234") +digits("123.222,00") +digits("123.222,==") +digits("123.222,00^10") +digits("123.222,00e10") +digits("/123.222,00e-12") +digits("-123.222,00e-12") +-- digits("+123.222,00e-12") +digits("n123.222,00e-12") +digits("s123.222,00e-12") +digits("p123.222,00e/12") + +\stopluacode +[[\digitsseparatorspace]] +\stoptext + + diff --git a/Master/texmf-dist/tex/context/base/supp-num.tex b/Master/texmf-dist/tex/context/base/supp-num.tex deleted file mode 100644 index d192ab54836..00000000000 --- a/Master/texmf-dist/tex/context/base/supp-num.tex +++ /dev/null @@ -1,443 +0,0 @@ -%D \module -%D [ file=supp-num, -%D version=1998.05.15, -%D title=\CONTEXT\ Support Macros, -%D subtitle=Numbers, -%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 Support Macros / Numbers} - -\unprotect - -%D \macros -%D {digits, setdigitmode, setdigitsign} -%D -%D Depending on the digit mode the command \type {\digits} -%D normalizes number patterns depending on the language set. -%D -%D \starttyping -%D This will never be a \digits{1.000.000} seller. -%D \stoptyping -%D -%D or -%D -%D \starttyping -%D I will never grow longer than \digits 1.86 \Meter. -%D \stoptyping -%D -%D The different modes are shown in: -%D -%D \startbuffer -%D \setdigitmode 1 \digits 12.345,90 \digits 12.345.000 \digits 1,23 -%D \setdigitmode 2 \digits 12.345,90 \digits 12.345.000 \digits 1,23 -%D \setdigitmode 3 \digits 12.345,90 \digits 12.345.000 \digits 1,23 -%D \setdigitmode 4 \digits 12.345,90 \digits 12.345.000 \digits 1,23 -%D \setdigitmode 5 \digits 12.345,90 \digits 12.345.000 \digits 1,23 -%D \setdigitmode 6 \digits 12.345,90 \digits 12.345.000 \digits 1,23 -%D \stopbuffer -%D -%D \typebuffer -%D -%D This is typset as: -%D -%D \startlines -%D \getbuffer -%D \stoplines -%D -%D The sign can be typeset as is or within the space of a -%D digit. -%D -%D \startbuffer -%D \setdigitsign 0 \digits +12.345,90 -%D \setdigitmode 1 \digits +12.345,90 -%D \setdigitmode 2 \digits +12.345,90 -%D \setdigitmode 3 \digits +12.345,90 -%D \stopbuffer -%D -%D \typebuffer -%D -%D This is typset as: -%D -%D \startlines -%D \getbuffer -%D \stoplines - -\chardef\digitoutputmode=1 % 0..6 -\chardef\digitsignmode =0 % 0..3 - -\def\setdigitmode{\chardef\digitoutputmode} -\def\setdigitsign{\chardef\digitsignmode} - -%D The digit modes are: -%D -%D \startitemize[packed] -%D \item periods \& comma -%D \item commas \& period -%D \item thinmuskips \& comma -%D \item thinmuskips \& period -%D \item thickmuskips \& comma -%D \item thickmuskips \& period -%D \stopitemize - -\let\collecteddigits \empty \chardef\digitinputmode =1 -\let\saveddigits \empty \chardef\skipdigit =0 -\let\savedpowerdigits\empty \chardef\powerdigits =0 - -%D The first stage of the \type {\digit} macro takes care of -%D the grouped call, the other branch handles the fuzzy -%D delimited calls. - -\ifx\mbox\undefined \let\mbox\normalhbox \fi - -% \unexpanded\def\digits -% {\bgroup\let~@\doifnextbgroupelse\dodigits\grabdigit} - -\unexpanded\def\digits - {\bgroup - \let~@% - \doifnextbgroupelse\dodigits{\doifnextcharelse\normalmathshift\domathdigits\grabdigit}} - -\def\dodigits#1% - {\grabdigit#1\relax} - -\def\domathdigits$#1$% - {\mbox{\grabdigit#1\relax}} % adding $ $ goes wrong in tabulate - -\def\grabdigit - {\futurelet\next\scandigit} - -%D Watch the test for \type {\nextobeyedline}, because the -%D endofline token can be \type {\def'd}, not \type {\let}'d, -%D we need to do an indirect test (see \type {verb-ini.tex}) -%D for details. -%D -%D \starttyping -%D \def ^^M{\obeyedline} -%D \def\nextbeyedline{\obeyedline} -%D \stoptyping - -\ifx\normalmathshift\undefined \let\normalmathshift=$ \fi - -\def\scandigit - {\ifx\next\blankspace - \let\next\handledigits - \else\ifx\next\nextobeyedline % the indirect one - \let\next\handledigits - \else\ifx\next\bgroup - \let\next\handledigits - \else\ifx\next\egroup - \let\next\handledigits - \else\ifx\next\normalmathshift - \let\next\handledigits - \else - \let\next\collectdigit - \fi\fi\fi\fi\fi - \next} - -%D We store the power||of||ten (to be signaled by \type {^}, -%D \type {e} or~\type {E}) in a seperate macro so that we can -%D typeset it in superscript. The space placeholders are -%D replaced by a \type {@}. - -\def\savedigit#1#2% - {\edef#1{#1\saveddigits#2}\let\saveddigits\empty} - -\long\def\collectdigit#1% - {\ifx#1~% - \savedigit\collecteddigits @% - \else\if#1_% - \savedigit\collecteddigits @% - \else\if\noexpand#1\relax - \let\grabdigit\handledigits - \else\ifcase\powerdigits - \if#1E% - \chardef\powerdigits\plusone - \else\if#1e% - \chardef\powerdigits\plusone - \else\if#1^% - \chardef\powerdigits\plusone - \else - \savedigit\collecteddigits#1% - %\doifnumberelse{#1} - % {\savedigit\collecteddigits#1} - % {\def\saveddigits{#1}}% - \fi\fi\fi - \else - \savedigit\savedpowerdigits#1% - %\doifnumberelse{#1} - % {\savedigit\savedpowerdigits#1} - % {\def\saveddigits{#1}}% - \fi\fi\fi\fi - \grabdigit} - -\let\handlemathdigits\firstofoneargument -\let\handletextdigits\mathematics - -\def\handledigits - {%\ifcase\powerdigits - % \edef\collecteddigits{\collecteddigits\saveddigits}% - %\else - % \edef\savedpowerdigits{\savedpowerdigits\saveddigits}% - %\fi - \ifmmode - \handlemathdigits{\dohandledigits}% - \else - \dontleavehmode\hbox{\handletextdigits{\dohandledigits}}% - \fi - \egroup} - -%D Although we could do with one pass, a second pass for -%D handling the stored sequence is more readable. - -\ifnum\texengine=\luatexengine - - \def\dohandledigits - {\mathcode`\,="002C \mathcode`\.="002E % pretty hard coded - \expandafter\handletokens\collecteddigits\with\scandigits - \ifcase\powerdigits\else\digitpowerseparator^{\savedpowerdigits}\fi} - - \chardef\mathaxisfontid\zerocount - -\else - - \def\dohandledigits - {\mathcode`\,="013B \mathcode`\.="013A % pretty hard coded - \expandafter\handletokens\collecteddigits\with\scandigits - \ifcase\powerdigits\else\digitpowerseparator^{\savedpowerdigits}\fi} - - \chardef\mathaxisfontid\plustwo - -\fi - -\def\doscandigit#1% - {\ifcase\skipdigit\@EA\hbox\else\@EA\hphantom\fi\bgroup - \mathematics % brr, needed because of stored punctuation - {\ifnum\digitinputmode=#1\relax - \ifcase\digitoutputmode - \or .% - \or ,% - \or \mskip\thinmuskip - \or \mskip\thinmuskip - \or \mskip\thickmuskip - \or \mskip\thickmuskip - \fi - \else - \ifodd\digitoutputmode,\else.\fi - \fi}% - \egroup} - -%D The signs can be made smaller and sqeezed into the width -%D of a digit. Watch the \type {\mathaxisheight} trickery (this -%D font related register stored the math axis). - -% \def\scandigits#1% -% {\if#1.\doscandigit1\chardef\skipdigit0\else -% \if#1,\doscandigit2\chardef\skipdigit0\else -% \if#1@\hphantom{0}\chardef\skipdigit1\else -% \if#1_\hphantom{0}\chardef\skipdigit1\else -% \if#1/\digitsgn{\hphantom{+}}\chardef\skipdigit0\else -% \if#1-\digitsgn-\chardef\skipdigit0\else -% \if#1+\digitsgn+\chardef\skipdigit0\else -% \if#1=\digitsgn\zeroamount\chardef\skipdigit0\else -% \if#1s\digitsgn{\hphantom{\positive}}\chardef\skipdigit0\else -% \if#1p\digitsgn\positive\chardef\skipdigit0\else -% \if#1m\digitsgn\negative\chardef\skipdigit0\else -% \if#1n\digitsgn\negative\chardef\skipdigit0\else -% #1\chardef\skipdigit0\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} - -% \def\digitsep#1% -% {\doscandigit#1\chardef\skipdigit0} -% -% \def\digitnop -% {\hphantom{0}\chardef\skipdigit1} - -% 0,= -% 0,== second = results in delta(00,=) -% 0,- is invalid, should be = -% 0,-- is invalid, should be == - -\def\digitzeroamount - {\digitsgn\zeroamount - \def\digitzeroamount - {\hphantom - {00\setbox\scratchbox\hbox{$\zeroamount$}% - \hskip-\wd\scratchbox}% - \let\digitzeroamount\empty}} - -\def\scandigits#1% - {\if#1.\digitsep1\else - \if#1,\digitsep2\else - \if#1@\digitnop \else - \if#1_\digitnop \else - \if#1/\digitsgn{\hphantom{+}}\chardef\skipdigit0\else - \if#1-\ifcase\skipdigit\digitsgn-\else - \box\digitsepbox\digitzeroamount \fi\chardef\skipdigit0\else - \if#1+\digitsgn+\chardef\skipdigit0\else - \if#1=\box\digitsepbox\digitzeroamount \chardef\skipdigit0\else - \if#1s\digitsgn{\hphantom{\positive}}\chardef\skipdigit0\else - \if#1p\digitsgn\positive\chardef\skipdigit0\else - \if#1m\digitsgn\negative\chardef\skipdigit0\else - \if#1n\digitsgn\negative\chardef\skipdigit0\else - \box\digitsepbox #1\chardef\skipdigit0\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} - -\newbox\digitsepbox \chardef\autodigitmode=1 - -\def\digitsep#1% - {\ifcase\autodigitmode - \doscandigit#1% - \else - \setbox\digitsepbox\hbox{\doscandigit#1}% - \fi - \chardef\skipdigit0\relax} - -% strange, does not work -% -% \def\digitnop -% {\hphantom{\box\digitsepbox}% -% \hphantom{0}\chardef\skipdigit1\relax} -% -% while this works - -\def\digitnop - {\hbox{\hphantom{\box\digitsepbox}}% - \hphantom{0}\chardef\skipdigit1\relax} - -% but this doesn't -% -% \def\digitnop -% {\hphantom{\box\digitsepbox0}% -% \chardef\skipdigit1\relax} - -\def\digitsgn#1% - {\ifcase\digitsignmode#1\else - \hbox - {\setbox\scratchbox\hbox{0}% - \scratchdimen\mathaxisheight\textfont\mathaxisfontid - \def\digitsgn##1##2% - {\advance\scratchdimen-\mathaxisheight##1\mathaxisfontid - \raise\scratchdimen - \hbox to \wd\scratchbox{\hss$##2#1$\hss}}% - \ifcase\digitsignmode\or - \digitsgn\textfont \textstyle \or - \digitsgn\scriptfont \scriptstyle \or - \digitsgn\scriptscriptfont\scriptscriptstyle\fi}% - \fi} - -\ifx\undefined\zeroamount \def\zeroamount{-} \fi -\ifx\undefined\positive \def\positive {+} \fi -\ifx\undefined\negative \def\negative {-} \fi - -%D The digit parser handles a bunch of special characters as -%D well as different formats. We strongly suggest you to use -%D the grouped call. -%D -%D \starttabulate[|l|l|l|] -%D \NC \type{.} \NC , . \NC comma or period \NC \NR -%D \NC \type{,} \NC , . \NC comma or period \NC \NR -%D \NC \type{@} \NC \NC invisible space \NC \NR -%D \NC \type{_} \NC \NC invisible space \NC \NR -%D \NC \type{/} \NC \NC invisible sign \NC \NR -%D \NC \type{-} \NC $-$ \NC minus sign \NC \NR -%D \NC \type{+} \NC $+$ \NC plus sign \NC \NR -%D \NC \type{s} \NC \NC invisible high sign \NC \NR -%D \NC \type{p} \NC $\positive$ \NC high plus sign \NC \NR -%D \NC \type{m} \NC $\negative$ \NC high minus sign \NC \NR -%D \NC \type{n} \NC $\negative$ \NC high minus (negative) sign \NC \NR -%D \NC \type{=} \NC $\zeroamount$ \NC zero padding \NC \NR -%D \stoptabulate -%D -%D These triggers are used in the following examples. -%D -%D \startbuffer -%D \digits 12 -%D \digits{~~~.~~~.~~~.68.712,34} -%D \digits ~~~.~~~.~~~.68.712,34 -%D \digits ___.___.111.68.712,34 -%D \digits 111.111.111.68.712,34 -%D \digits 12.345,90 -%D \digits 12.345.000 -%D \digits 12,34 -%D \digits{392.857.230.68.712,34} -%D {\digits1234} -%D \digits{1234} -%D \digits 1234\relax -%D $\digits 123.222,00$ -%D \digits 123.222,00 -%D \digits 123.222,== -%D \digits 123.222,00^10 -%D \digits 123.222,00e10 -%D \digits /123.222,00e-12 -%D \digits -123.222,00e-12 -%D \digits +123.222,00e-12 -%D \digits n123.222,00e-12 -%D \digits s123.222,00e-12 -%D \digits p123.222,00e-12 -%D \stopbuffer -%D -%D \typebuffer -%D -%D \startlines -%D \getbuffer -%D \stoplines - -%D \macros -%D {Digits} -%D -%D We also permit: - -\let\Digits\digits - -%D These macros are complicated by the fact that we also -%D have to support cases like: -%D -%D \starttyping -%D {\digits1234} -%D \digits{1234} -%D \digits 1234\whatever -%D $\digits 123.222,00$ -%D \digits 123.222,00. -%D \stoptyping -%D -%D The latter case shows us that trailing non digits are to -%D be passed untreated. -%D -%D Another interesting case is: -%D -%D \starttyping -%D \digits 123.222,00^10 -%D \stoptyping -%D -%D The separator is defined as: - -% \def\digitpowerseparator% -% {\cdot10} % {\times10} - -\def\digitpowerseparator - {\ifx\collecteddigits\empty\else\cdot\fi10} - -%D \macros -%D {digittemplate} -%D -%D Users can specify the way they enter those digits by saying -%D something like: -%D -%D \starttyping -%D \digittemplate 12.000.000,00 % \digittemplate ., -%D \stoptyping - -\def\digittemplate #1 % - {\chardef\digitinputmode\zerocount - \handletokens#1\with\scandigittemplate} - -\def\scandigittemplate#1% - {\if #1.\ifcase\digitinputmode\chardef\digitinputmode\plusone \fi% period - \else\if#1,\ifcase\digitinputmode\chardef\digitinputmode\plustwo \fi% comma - \fi\fi} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/supp-pat.mkii b/Master/texmf-dist/tex/context/base/supp-pat.mkii index d910830766b..8cd4dd072d8 100644 --- a/Master/texmf-dist/tex/context/base/supp-pat.mkii +++ b/Master/texmf-dist/tex/context/base/supp-pat.mkii @@ -31,17 +31,13 @@ %D is meant as an experiment. \ifx\writestatus\undefined \else - \writestatus{loading}{ConTeXt Support Macros / Patterns} - \fi %D \CONTEXT: \ifx\startmapping\undefined \else \ifx\startencoding\undefined \else - \def\fetchpatterntoken#1{\csname#1\endcsname} - \fi \fi %D First we define the \ETEX\ variant. We cannot do that inside diff --git a/Master/texmf-dist/tex/context/base/supp-pdf.mkii b/Master/texmf-dist/tex/context/base/supp-pdf.mkii index c54b0c6bc25..4d3619d4b8b 100644 --- a/Master/texmf-dist/tex/context/base/supp-pdf.mkii +++ b/Master/texmf-dist/tex/context/base/supp-pdf.mkii @@ -2020,7 +2020,7 @@ %D The last object number used is avaliable in the macro %D \type {\lastPDFMPobject}. -\ifx\makeMPintoPDFobject\undefined \chardef\makeMPintoPDFobject=0 \fi +\ifx\makeMPintoPDFobject\undefined \newcount\makeMPintoPDFobject \fi \def\lastPDFMPobject{0} @@ -2096,17 +2096,17 @@ \def\dopackageMPgraphic#1% #1 = boxregister {%\ifx\pdfxform\undefined - % \chardef\makeMPintoPDFobject0 % no pdftex at all + % \makeMPintoPDFobject0 % no pdftex at all %\else\ifx\pdftexversion\undefined - % \chardef\makeMPintoPDFobject0 % no pdftex at all + % \makeMPintoPDFobject0 % no pdftex at all %\else\ifnum\pdftexversion<14 - % \chardef\makeMPintoPDFobject0 % no resource support + % \makeMPintoPDFobject0 % no resource support %\else % % keep the default value %\fi\fi\fi \ifcase\makeMPintoPDFobject\or\or\ifx\currentPDFresources\empty\else % an existing value of 2 signals object support (set elsewhere) - \chardef\makeMPintoPDFobject1 + \makeMPintoPDFobject1 \fi\fi \ifcase\makeMPintoPDFobject \box#1% diff --git a/Master/texmf-dist/tex/context/base/supp-ran.lua b/Master/texmf-dist/tex/context/base/supp-ran.lua index fe635fc7f9e..accd5c94c15 100644 --- a/Master/texmf-dist/tex/context/base/supp-ran.lua +++ b/Master/texmf-dist/tex/context/base/supp-ran.lua @@ -9,18 +9,25 @@ if not modules then modules = { } end modules ['supp-ran'] = { -- We cannot ask for the current seed, so we need some messy hack -- here. +local report_system = logs.reporter("system","randomizer") + commands = commands or { } +local commands = commands +local math = math local random, randomseed, round, seed, last = math.random, math.randomseed, math.round, false, 1 local texwrite = tex.write function math.setrandomseedi(n,comment) + if not n then +--~ n = 0.5 -- hack + end if n <= 1 then n = n*1073741823 -- maxcount end n = round(n) if false then - logs.report("system","setting random seed to %s (%s)",n,comment or "normal") + report_system("setting seed to %s (%s)",n,comment or "normal") end randomseed(n) last = random(0,1073741823) -- we need an initial value diff --git a/Master/texmf-dist/tex/context/base/supp-ran.mkiv b/Master/texmf-dist/tex/context/base/supp-ran.mkiv index 9d429598f15..500170ab0f9 100644 --- a/Master/texmf-dist/tex/context/base/supp-ran.mkiv +++ b/Master/texmf-dist/tex/context/base/supp-ran.mkiv @@ -18,13 +18,13 @@ \registerctxluafile{supp-ran}{1.001} -\def\getrandomcount #1#2#3{#1=\ctxlua{commands.getrandomcounta(\number#2,\number#3)}} -\def\getrandomdimen #1#2#3{#1=\ctxlua{commands.getrandomcounta(\number\dimexpr#2,\number\dimexpr#3)}\scaledpoint} -\def\getrandomnumber#1#2#3{\edef#1{\ctxlua{commands.getrandomcounta(\number#2,\number#3)}}} -\def\getrandomfloat #1#2#3{\edef#1{\ctxlua{commands.getrandomcountb(\number\dimexpr#2\points,\number\dimexpr#3\points)}}} -\def\setrandomseed #1{\ctxlua{commands.setrandomseed(\number#1)}} -\def\getrandomseed {\ctxlua{commands.getrandomseed()}} -\def\freezerandomseed {\ctxlua{commands.freezerandomseed()}} -\def\defrostrandomseed {\ctxlua{commands.defrostrandomseed()}} +\def\getrandomcount #1#2#3{#1=\ctxcommand{getrandomcounta(\number#2,\number#3)}} +\def\getrandomdimen #1#2#3{#1=\ctxcommand{getrandomcounta(\number\dimexpr#2,\number\dimexpr#3)}\scaledpoint} +\def\getrandomnumber#1#2#3{\edef#1{\ctxcommand{getrandomcounta(\number#2,\number#3)}}} +\def\getrandomfloat #1#2#3{\edef#1{\ctxcommand{getrandomcountb(\number\dimexpr#2\points,\number\dimexpr#3\points)}}} +\def\setrandomseed #1{\ctxcommand{setrandomseed(\number#1)}} +\def\getrandomseed #1{\edef#1{\ctxcommand{getrandomseed()}}} +\def\freezerandomseed {\ctxcommand{freezerandomseed()}} +\def\defrostrandomseed {\ctxcommand{defrostrandomseed()}} \endinput diff --git a/Master/texmf-dist/tex/context/base/supp-vis.mkii b/Master/texmf-dist/tex/context/base/supp-vis.mkii new file mode 100644 index 00000000000..f38c8e1e353 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/supp-vis.mkii @@ -0,0 +1,1907 @@ +%D \module +%D [ file=supp-vis, +%D version=1996.10.21, +%D title=\CONTEXT\ Support Macros, +%D subtitle=Visualization, +%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. + +% no longer generic, who cares ... + +%D \gdef\ShowBufferedExample% private typeseting macro +%D {\startlinecorrection +%D \bgroup +%D \setuptyping[margin=0pt,option=color] +%D \showmakeup +%D \centeredvcuetrue +%D \dontinterfere +%D \baselinerulefalse +%D \normalvbox +%D {\normalhbox to \hsize +%D {$\hsize=.5\hsize +%D \advance\hsize by -.5em +%D \normalvcenter{\vbox{\getbuffer}}\normalhss +%D \normalvcenter{\vbox{\dontshowcomposition\typebuffer}}$}} +%D \egroup +%D \stoplinecorrection} +%D +%D \gdef\ShowBufferedExampleBox% private typeseting macro +%D {\startlinecorrection +%D \bgroup +%D \setuptyping[margin=0pt,option=color] +%D \showmakeup +%D \centeredvcuetrue +%D \dontinterfere +%D \baselinerulefalse +%D \normalvbox +%D {\normalhbox to \hsize +%D {$\hsize=.5\hsize +%D \advance\hsize by -.5em +%D \normalvcenter{\baselineruletrue\vbox{\getbuffer}}\normalhss +%D \normalvcenter{\vbox{\dontshowcomposition\typebuffer}}$}} +%D \egroup +%D \stoplinecorrection} + +%D Although an integral part of \CONTEXT, this module is one +%D of the support modules. Its stand alone character permits +%D use in \PLAIN\ \TEX\ or \TEX\ based macropackages. +%D \ifCONTEXT \else If in some examples the verbatim listings +%D don't show up nice, this is due to processing by a system +%D that does not support buffering. In \CONTEXT\ we show the +%D commands in the margin, use bit more advanced way of +%D numbering, and typeset the source in \TEX nicolored +%D verbatim. Sorry for this inconvenience.\fi +%D +%D Depending on my personal needs and those of whoever uses it, +%D the macros will be improved in terms of visualization, +%D efficiency and compatibility. These rather low level +%D visualization macros are supplemented by ones that can +%D visualize baselines, the page layout and whatever deserves +%D attention. Most of those macros can be found in \type +%D {core-vis} and other core modules. Their integration in +%D \CONTEXT\ prohibits generic applications. + +\ifx \undefined \writestatus \input supp-mis.tex \fi + +%D One of the strong points of \TEX\ is abstraction of textual +%D input. When macros are defined well and do what we +%D want them to do, we will seldom need the tools present in +%D What You See Is What You Get systems. For instance, when +%D entering text we don't need rulers, because no manual +%D shifting and/or alignment of text is needed. On the other +%D hand, when we are designing macros or specifying layout +%D elements, some insight in \TEX's advanced spacing, kerning, +%D filling, boxing and punishment abilities will be handy. +%D That's why we've implemented a mechanism that shows some of +%D the inner secrets of \TEX. + +\writestatus{loading}{ConTeXt Support Macros / Visualization} + +%D In this module we are going to redefine some \TEX\ +%D primitives and \PLAIN\ macro's. Their original meaning is +%D saved in macros with corresponding names, preceded by +%D \type{normal}. These original macros are (1)~used to +%D temporary restore the old values when needed and +%D (2)~used to prevent recursive calls in the macros that +%D replace them. + +\unprotect + +\let\visualvrule\vrule +\let\visualhrule\hrule + +%D \macros +%D {dontinterfere} +%D +%D Indentation, left and/or right skips, redefinition of +%D \type{\par} and assignments to \type{\everypar} can lead to +%D unwanted results. We can therefore turn all those things +%D off with \type{\dontinterfere}. + +\def\dontinterfere + {\everypar \emptytoks + \let\par \endgraf + \parindent\zeropoint + \parskip \zeropoint + \leftskip \zeropoint + \rightskip\zeropoint + \relax} + +%D \macros +%D {dontcomplain} +%D +%D In this module we do a lot of box manipulations. Because we +%D don't want to be confronted with to many over- and underfull +%D messages we introduce \type{\dontcomplain}. + +\def\dontcomplain + {\hbadness\!!tenthousand \vbadness\hbadness + \hfuzz \maxdimen \vfuzz \hfuzz} + +% This obsolete dutch name is sometimes uses in manual styles; when +% cleaning up the codebase I decided to move this definition here. + +\let\mindermeldingen\dontcomplain + +%D \macros +%D {normaloffinterlineskip} +%D +%D The next hack is needed because in \CONTEXT\ we redefine +%D \type{\offinterlineskip}. + +\ifx\undefined\normaloffinterlineskip + \let\normaloffinterlineskip\offinterlineskip +\fi + +%D \macros +%D {normalhbox, +%D normalvbox,normalvtop} +%D +%D There are three types of boxes, one horizontal and two +%D vertical in nature. As we will see later on, all three types +%D are to be handled according to their orientation and +%D baseline behavior. Especially \type{\vtop}'s need our +%D special attention. + +% already saved + +%D \macros +%D {normalhskip, +%D normalvskip} +%D +%D Next come the flexible skips, which come in two flavors +%D too. Like boxes these are handled with \TEX\ primitives. + +% already saved + +%D \macros +%D {normalpenalty, +%D normalkern} +%D +%D Both penalties and kerns are taken care of by mode sensitive +%D primitives. This means that when making them visible, we +%D have to take the current mode into account. + +% already saved + +%D \macros +%D {normalhglue, +%D normalvglue} +%D +%D Glues on the other hand are macro's defined in \PLAIN\ \TEX. +%D As we will see, their definitions make the implementation of +%D their visible counterparts a bit more \TeX{}nical. + +\let\normalhglue = \hglue +\let\normalvglue = \vglue + +%D \macros +%D {normalmkern, +%D normalmskip} +%D +%D Math mode has its own spacing primitives, preceded by +%D \type{m}. Due to the relation with the current font and the +%D way math is typeset, their unit \type{mu} is not compatible +%D with other dimensions. As a result, the visual appearance +%D of these primitives is kept primitive too. + +% already saved + +%D \macros +%D {hfilneg, +%D vfilneg} +%D +%D Fills can be made visible quite easy. We only need some +%D additional negation macros. Because \PLAIN\ \TEX\ only +%D offers \type{\hfilneg} and \type{\vfilneg}, we define our +%D own alternative double \type{ll}'ed ones. + +\def\hfilneg {\normalhskip\zeropoint \!!plus-1fil\relax} +\def\vfilneg {\normalvskip\zeropoint \!!plus-1fil\relax} +\def\hfillneg {\normalhskip\zeropoint \!!plus-1fill\relax} +\def\vfillneg {\normalvskip\zeropoint \!!plus-1fill\relax} +\def\hfilllneg{\normalhskip\zeropoint \!!plus-1filll\relax} +\def\vfilllneg{\normalvskip\zeropoint \!!plus-1filll\relax} + +%D \macros +%D {normalhss,normalhfil,normalhfill, +%D normalvss,normalvfil,normalvfill} +%D +%D The positive stretch primitives are used independant and in +%D combination with \type{\leaders}. + +% already saved + +%D \macros +%D {normalhfilneg,normalhfillneg, +%D normalvfilneg,normalvfillneg} +%D +%D Keep in mind that both \type{\hfillneg} and \type{\vfillneg} +%D are not part of \PLAIN\ \TEX\ and therefore not documented +%D in standard \TEX\ documentation. They can nevertheless be +%D used at will. + +\let\normalhfillneg = \hfillneg +\let\normalvfillneg = \vfillneg + +%D Visualization is not always wanted. Instead of turning this +%D option off in those (unpredictable) situations, we just +%D redefine a few \PLAIN\ macros. + +\ifx\tlap\undefined + + \def\rlap#1{\normalhbox to \zeropoint{#1\normalhss}} + \def\llap#1{\normalhbox to \zeropoint{\normalhss#1}} + \def\blap#1{\normalvbox to \zeropoint{#1\normalvss}} + \def\tlap#1{\normalvbox to \zeropoint{\normalvss#1}} + +\fi + +\ifx\contextversion\undefined \def~{\normalpenalty\!!tenthousand\ } \fi + +%D \macros +%D {makeruledbox} +%D +%D Ruled boxes can be typeset is many ways. Here we present +%D just one alternative. This implementation may be a little +%D complicated, but it supports all three kind of boxes. The +%D next command expects a \BOX\ specification, like: +%D +%D \starttyping +%D \makeruledbox0 +%D \stoptyping + +%D \macros +%D {baselinerule,baselinefill} +%D +%D We can make the baseline of a box visible, both dashed and +%D as a rule. The line is drawn on top of the baseline. All +%D we have to say is: +%D +%D \starttyping +%D \baselineruletrue +%D \baselinefilltrue +%D \stoptyping +%D +%D At the cost of some overhead these alternatives are +%D implemented using \type{\if}'s: + +\newif\ifbaselinerule \baselineruletrue +\newif\ifbaselinefill \baselinefillfalse + +%D \macros +%D {iftoprule,ifbottomrule,ifleftrule,ifrightrule} +%D +%D Rules can be turned on and off, but by default we have: +%D +%D \starttyping +%D \topruletrue +%D \bottomruletrue +%D \leftruletrue +%D \rightruletrue +%D \stoptyping +%D +%D As we see below: + +\newif\iftoprule \topruletrue +\newif\ifbottomrule \bottomruletrue +\newif\ifleftrule \leftruletrue +\newif\ifrightrule \rightruletrue + +%D \macros +%D {boxrulewidth} +%D +%D The width in the surrounding rules can be specified by +%D assigning an apropriate value to the dimension used. This +%D module defaults the width to: +%D +%D \starttyping +%D \boxrulewidth=.2pt +%D \stoptyping +%D +%D Although we are already low on \DIMENSIONS\ it's best to +%D spend one here, mainly because it enables easy manipulation, +%D like multiplication by a given factor. + +\newdimen\boxrulewidth \boxrulewidth=.2pt + +%D The core macro \type{\makeruledbox} looks a bit hefty. The +%D manipulation at the end is needed because we want to +%D preserve both the mode and the baseline. This means that +%D \type{\vtop}'s and \type{\vbox}'es behave the way we expect +%D them to do. +%D +%D \startlinecorrection +%D \hbox +%D {\ruledhbox to 5em{\strut test\normalhss}\hskip1em +%D \ruledvbox{\hsize 5em\strut test \par test\strut}\hskip1em +%D \ruledvtop{\hsize 5em\strut test \par test\strut}} +%D \stoplinecorrection +%D +%D The \type{\cleaders} part of the macro is responsible for +%D the visual baseline. The \type{\normalhfill} belongs to this +%D primitive too. By storing and restoring the height and depth +%D of box \type{#1}, we preserve the mode. + +\let\dowithruledbox\relax + +\let\ruledheight\!!zeropoint +\let\ruleddepth \!!zeropoint +\let\ruledwidth \!!zeropoint + +\def\makeruledbox#1% + {\edef\ruledheight{\the\ht#1}% + \edef\ruleddepth {\the\dp#1}% + \edef\ruledwidth {\the\wd#1}% + \setbox\scratchbox\normalvbox + {\dontcomplain + \normaloffinterlineskip + \visualhrule + \!!height\boxrulewidth + \iftoprule\else\!!width\zeropoint\fi + \normalvskip-\boxrulewidth + \normalhbox to \ruledwidth + {\visualvrule + \!!height\ruledheight + \!!depth\ruleddepth + \!!width\ifleftrule\else0\fi\boxrulewidth + \ifdim\ruledheight>\zeropoint \else \baselinerulefalse \fi + \ifdim\ruleddepth>\zeropoint \else \baselinerulefalse \fi + \ifbaselinerule + \ifdim\ruledwidth<20\boxrulewidth + \baselinefilltrue + \fi + \cleaders + \ifbaselinefill + \visualhrule + \!!height\boxrulewidth + \else + \normalhbox + {\normalhskip2.5\boxrulewidth + \visualvrule + \!!height\boxrulewidth + \!!width5\boxrulewidth + \normalhskip2.5\boxrulewidth}% + \fi + \fi + \normalhfill + \visualvrule + \!!width\ifrightrule\else0\fi\boxrulewidth}% + \normalvskip-\boxrulewidth + \visualhrule + \!!height\boxrulewidth + \ifbottomrule\else\!!width\zeropoint\fi}% + \wd#1\zeropoint + \setbox#1=\ifhbox#1\normalhbox\else\normalvbox\fi + {\normalhbox + {\box#1% + \lower\ruleddepth\normalhbox{\dowithruledbox{\box\scratchbox}}}}% + \ht#1=\ruledheight + \wd#1=\ruledwidth + \dp#1=\ruleddepth} + +%D Just in case one didn't notice: the rules are in fact layed +%D over the box. This way the contents of a box cannot +%D visually interfere with the rules around (upon) it. A more +%D advanced version of ruled boxes can be found in one of the +%D core modules of \CONTEXT. There we take offsets, color, +%D rounded corners, backgrounds and alignment into account too. + +%D \macros +%D {ruledhbox, +%D ruledvbox,ruledvtop, +%D ruledvcenter} +%D +%D These macro's can be used instead of \type{\hbox}, +%D \type{\vbox}, \type{\vtop} and, when in math mode, +%D \type{\vcenter}. They just do what their names state. Using +%D an auxiliary macro would save us a few words of memory, but +%D it would make their appearance even more obscure. +%D +%D \startbuffer +%D \hbox +%D {\strut +%D one +%D two +%D \hbox{three} +%D four +%D five} +%D \stopbuffer +%D +%D \ShowBufferedExampleBox + +\unexpanded\def\ruledhbox + {\normalhbox\bgroup + \dowithnextbox{\makeruledbox\nextbox\box\nextbox\egroup}% + \normalhbox} + +%D \startbuffer +%D \vbox +%D {\strut +%D first line \par +%D second line \par +%D third line \par +%D fourth line \par +%D fifth line +%D \strut } +%D \stopbuffer +%D +%D \ShowBufferedExampleBox + +\unexpanded\def\ruledvbox + {\normalvbox\bgroup + \dowithnextbox{\makeruledbox\nextbox\box\nextbox\egroup}% + \normalvbox} + +%D \startbuffer +%D \vtop +%D {\strut +%D first line \par +%D second line \par +%D third line \par +%D fourth line \par +%D fifth line +%D \strut } +%D \stopbuffer +%D +%D \ShowBufferedExampleBox + +\unexpanded\def\ruledvtop + {\normalvtop\bgroup + \dowithnextbox{\makeruledbox\nextbox\box\nextbox\egroup}% + \normalvtop} + +%D \startbuffer +%D \hbox +%D {$\vcenter{\hsize.2\hsize +%D alfa \par beta}$ +%D $\vcenter to 3cm{\hsize.2\hsize +%D alfa \par beta \par gamma}$ +%D $\vcenter{\hsize.2\hsize +%D alfa \par beta}$} +%D \stopbuffer +%D +%D \ShowBufferedExampleBox + +\unexpanded\def\ruledvcenter + {\normalvbox\bgroup + \dontinterfere + \dowithnextbox + {\scratchdimen.5\ht\nextbox + \advance\scratchdimen .5\dp\nextbox + \ht\nextbox\scratchdimen + \dp\nextbox\scratchdimen + \ruledhbox{\box\nextbox}% + \egroup}% + \normalvbox} + +%D \macros +%D {ruledbox, +%D setruledbox} +%D +%D Of the next two macros the first can be used to precede a +%D box of ones own choice. One can for instance prefix boxes +%D with \type{\ruledbox} and afterwards --- when the macro +%D satisfy the needs --- let it to \type{\relax}. +%D +%D \starttyping +%D \ruledbox\hbox{What rules do you mean?} +%D \stoptyping +%D +%D The macro \type{\setruledbox} can be used to directly +%D rule a box. +%D +%D \starttyping +%D \setruledbox12=\hbox{Who's talking about rules here?} +%D \stoptyping +%D +%D At the cost of some extra macros we can implement a +%D variant that does not need the~\type{=}, but we stick to: + +\unexpanded\def\ruledbox + {\dowithnextbox{\makeruledbox\nextbox\box\nextbox}} + +\def\setruledbox#1=% + {\dowithnextbox{\makeruledbox\nextbox\setbox#1\nextbox}} + +%D \macros +%D {investigateskip, +%D investigatecount, +%D investigatemuskip} +%D +%D Before we meet the visualizing macro's, we first implement +%D ourselves some handy utility ones. Just for the sake of +%D efficiency and readability, we introduce some status +%D variables, that tell us a bit more about the registers we +%D use: +%D +%D \starttyping +%D \ifflexible +%D \ifzero +%D \ifnegative +%D \ifpositive +%D \stoptyping +%D +%D These status variables are set when we call for one of the +%D investigation macros, e.g. +%D +%D \starttyping +%D \investigateskip\scratchskip +%D \stoptyping +%D +%D We use some dirty trick to check stretchability of \SKIPS. +%D Users of these macros are invited to study their exact +%D behavior first. The positive and negative states both +%D include zero and are in fact non-negative ($\geq0$) and +%D non-positive ($\leq0$) . + +\newif\ifflexible +\newif\ifzero +\newif\ifnegative +\newif\ifpositive + +\def\investigateskip#1% + {\relax + \scratchdimen#1\relax + \edef\!!stringa{\the\scratchdimen}% + \edef\!!stringb{\the#1}% + \ifx\!!stringa\!!stringb \flexiblefalse \else \flexibletrue \fi + \ifdim#1=\zeropoint\relax + \zerotrue \else + \zerofalse \fi + \ifdim#1<\zeropoint\relax + \positivefalse \else + \positivetrue \fi + \ifdim#1>\zeropoint\relax + \negativefalse \else + \negativetrue \fi} + +% etex +% +% \def\investigateskip#1% +% {\relax +% \ifdim\scratchskip=\zeropoint +% \ifdim\gluestretch\scratchskip=\zeropoint +% \ifdim\glueshrink\scratchskip=\zeropoint +% \flexiblefalse +% \else +% \flexibletrue +% \fi +% \else +% \flexibletrue +% \fi +% \else +% \flexibletrue +% \fi +% \ifdim#1=\zeropoint\relax +% \zerotrue \else +% \zerofalse \fi +% \ifdim#1<\zeropoint\relax +% \positivefalse \else +% \positivetrue \fi +% \ifdim#1>\zeropoint\relax +% \negativefalse \else +% \negativetrue \fi} + +\def\investigatecount#1% + {\relax + \flexiblefalse + \ifnum#1=\zerocount + \zerotrue \else + \zerofalse \fi + \ifnum#1<\zerocount + \positivefalse \else + \positivetrue \fi + \ifnum#1>\zerocount + \negativefalse \else + \negativetrue \fi} + +\def\investigatemuskip#1% + {\relax + \edef\!!stringa{\the\scratchmuskip}% + \edef\!!stringb{0mu}% + \def\!!stringc##1##2\\{##1}% + \expandafter\edef\expandafter\!!stringc\expandafter + {\expandafter\!!stringc\!!stringa\\}% + \edef\!!stringd{-}% + \flexiblefalse + \ifx\!!stringa\!!stringb + \zerotrue + \negativefalse + \positivefalse + \else + \zerofalse + \ifx\!!stringc\!!stringd + \positivefalse + \negativetrue + \else + \positivetrue + \negativefalse + \fi + \fi} + +%D Now the neccessary utility macros are defined, we can make a +%D start with the visualizing ones. The implementation of these +%D macros is a compromise between readability, efficiency of +%D coding and processing speed. Sometimes we do in steps what +%D could have been done in combination, sometimes we use a few +%D boxes more or less then actually needed, and more than once +%D one can find the same piece of rule drawing code twice. + +%D \macros +%D {ifcenteredvcue,normalvcue} +%D +%D Depending on the context, one can force visual vertical cues +%D being centered along \type{\hsize} or being put at the +%D current position. Although centering often looks better, +%D we've chosen the second alternative as default. The main +%D reason for doing so is that often when we don't set the +%D \type{\hsize} ourselves, \TEX\ takes the value of the +%D surrounding box. As a result the visual cues can migrate +%D outside the current context. +%D +%D This behavior is accomplished by a small but effective +%D auxiliary macro, which behavior can be influenced by the +%D boolean \type{\centeredvcue}. By saying +%D +%D \starttyping +%D \centeredvcuetrue +%D \stoptyping +%D +%D one turns centering on. As said, we turn it off. + +\newif\ifcenteredvcue \centeredvcuefalse + +\def\normalvcue#1% + {\normalhbox \ifcenteredvcue to \hsize \fi {\normalhss#1\normalhss}} + +%D We could have used the more robust version +%D +%D \starttyping +%D \def\normalvcue% +%D {\normalhbox \ifcenteredvcue to \hsize \fi +%D \bgroup\bgroup\normalhss +%D \aftergroup\normalhss\aftergroup\egroup +%D \let\next=} +%D \stoptyping +%D +%D or the probably best one: +%D +%D \starttyping +%D \def\normalvcue% +%D {\hbox \ifcenteredvcue to \hsize +%D \bgroup\bgroup\normalhss +%D \aftergroup\normalhss\aftergroup\egroup +%D \else +%D \bgroup +%D \fi +%D \let\next=} +%D \stoptyping +%D +%D Because we don't have to preserve \CATCODES\ and only use +%D small arguments, we stick to the first alternative. + +%D \macros +%D {testrulewidth} +%D +%D We build our visual cues out of rules. At the cost of a much +%D bigger \DVI\ file, this is to be prefered over using +%D characters (1)~because we cannot be sure of their +%D availability and (2)~because their dimensions are fixed. +%D +%D As with ruled boxes, we use a \DIMENSION\ to specify the +%D width of the ruled elements. This dimension defaults to: +%D +%D \starttyping +%D \testrulewidth=\boxrulewidth +%D \stoptyping +%D +%D Because we prefer whole numbers for specifying the +%D dimensions, we often use even multiples of +%D \type{\testrulewidth}. + +%D \macros +%D {visiblestretch} +%D +%D A second variable is introduced because of the stretch +%D components of \SKIPS. At the cost of some accuracy we can +%D make this stretch visible. +%D +%D \starttyping +%D \visiblestretchtrue +%D \stoptyping + +\newdimen\testrulewidth \testrulewidth=\boxrulewidth +\newif\ifvisiblestretch \visiblestretchfalse + +%D \macros +%D {ruledhss, +%D ruledhfil,ruledhfilneg, +%D ruledhfill,ruledhfillneg} +%D +%D We start with the easiest part, the fills. The scheme we +%D follow is {\em visual filling -- going back -- normal +%D filling}. Visualizing is implemented using \type{\cleaders}. +%D Because the \BOX\ that follows this command is constructed +%D only once, the \type{\copy} is not really a prerequisite. We +%D prefer using a \type{\normalhbox} here instead of a +%D \type{\hbox}. + +\def\setvisiblehfilbox#1\to#2#3#4% + {\setbox#1\normalhbox + {\visualvrule + \!!width #2\testrulewidth + \!!height#3\testrulewidth + \!!depth #4\testrulewidth}% + \smashbox#1} + +\def\doruledhfiller#1#2#3#4% + {#1#2% + \bgroup + \dontinterfere + \dontcomplain + \setvisiblehfilbox0\to{4}{#3}{#4}% + \setvisiblehfilbox2\to422% + \copy0\copy2 + \bgroup + \setvisiblehfilbox0\to422% + \cleaders + \normalhbox to 12\testrulewidth + {\normalhss\copy0\normalhss}% + #1% + \egroup + \setbox0\normalhbox + {\normalhskip-4\testrulewidth\copy0\copy2}% + \smashbox0% + \box0 + \egroup} + +%D The horizontal fillers differ in their boundary +%D visualization. Watch the small dots. Fillers can be +%D combined within reasonable margins. +%D +%D \startlinecorrection +%D \baselinerulefalse +%D \ruledhbox to \hsize +%D {\strut\type{\hss}\ruledhss test} +%D \stoplinecorrection +%D +%D \startlinecorrection +%D \baselinerulefalse +%D \ruledhbox to \hsize +%D {\strut\type{\hfil}\ruledhfil test} +%D \stoplinecorrection +%D +%D \startlinecorrection +%D \baselinerulefalse +%D \ruledhbox to \hsize +%D {\strut\type{\hfill}\ruledhfill test} +%D \stoplinecorrection +%D +%D \startlinecorrection +%D \baselinerulefalse +%D \ruledhbox to \hsize +%D {\strut +%D \type{\hfil}\type{\hfil}\ruledhfil\ruledhfil +%D test% +%D \ruledhfil\type{\hfil}} +%D \stoplinecorrection +%D +%D The negative counterparts are visualizes, but seldom +%D become visible, apart from their boundaries. +%D +%D \startlinecorrection +%D \baselinerulefalse +%D \ruledhbox to \hsize +%D {\strut\type{\hfilneg}\ruledhfilneg test} +%D \stoplinecorrection +%D +%D \startlinecorrection +%D \baselinerulefalse +%D \ruledhbox to \hsize +%D {\strut\type{\hfillneg}\ruledhfillneg test} +%D \stoplinecorrection +%D +%D Although leaders are used for visualizing, they are +%D visualized themselves correctly as the next example shows. +%D +%D \startlinecorrection +%D \baselinerulefalse +%D \ruledhbox to \hsize +%D {\strut\cleaders\normalhbox to 2em{\normalhss$\circ$\normalhss}\ruledhfill} +%D \stoplinecorrection +%D +%D All five substitutions use the same auxiliary macro. Watch +%D the positive first -- negative next approach. + +\unexpanded\def\ruledhss + {\doruledhfiller\normalhss\normalhfilneg{0}{0}} + +\unexpanded\def\ruledhfil + {\doruledhfiller\normalhfil\normalhfilneg{10}{-6}} + +\unexpanded\def\ruledhfill + {\doruledhfiller\normalhfill\normalhfillneg{18}{-14}} + +\unexpanded\def\ruledhfilneg + {\doruledhfiller\normalhfilneg\normalhfil{-6}{10}} + +\unexpanded\def\ruledhfillneg + {\doruledhfiller\normalhfillneg\normalhfill{-14}{18}} + +%D \macros +%D {ruledvss, +%D ruledvfil,ruledvfilneg, +%D ruledvfill,ruledvfillneg} +%D +%D The vertical mode commands adopt the same visualization +%D scheme, but are implemented in a slightly different way. + +\def\setvisiblevfilbox#1\to#2#3#4% + {\setbox#1\normalhbox + {\visualvrule + \!!width #2\testrulewidth + \!!height#3\testrulewidth + \!!depth #4\testrulewidth}% + \smashbox#1}% + +\def\doruledvfiller#1#2#3% + {#1#2% + \bgroup + \dontinterfere + \dontcomplain + \normaloffinterlineskip + \setvisiblevfilbox0\to422% + \setbox2\normalvcue + {\normalhskip -#3\testrulewidth\copy0}% + \smashbox2% + \copy2 + \bgroup + \setbox2\normalvcue + {\normalhskip -2\testrulewidth\copy0}% + \smashbox2% + \copy2 + \cleaders + \normalvbox to 12\testrulewidth + {\normalvss\copy2\normalvss}% + #1% + \setbox2\normalvbox + {\normalvskip-2\testrulewidth\copy2}% + \smashbox2% + \box2 + \egroup + \box2 + \egroup} + +%D Because they act the same as their horizontal counterparts +%D we only show a few examples. +%D +%D \startlinecorrection +%D \hbox to \hsize +%D {\dontinterfere +%D \baselinerulefalse +%D \centeredvcuetrue +%D \ruledvbox to 10ex +%D {\hsize.18\hsize +%D \type{\vss}\ruledvss last line}\normalhss +%D \ruledvbox to 10ex +%D {\hsize.18\hsize +%D \type{\vfil}\ruledvfil last line}\normalhss +%D \ruledvbox to 10ex +%D {\hsize.18\hsize +%D \type{\vfill}\ruledvfill last line}\normalhss +%D \ruledvbox to 10ex +%D {\hsize.18\hsize +%D \type{\vfilneg}\ruledvfilneg last line}\normalhss +%D \ruledvbox to 10ex +%D {\hsize.18\hsize +%D \type{\vfillneg}\ruledvfillneg last line}} +%D \stoplinecorrection +%D +%D Keep in mind that \type{\vfillneg} is not part of \PLAIN\ +%D \TEX, but are mimmicked by a macro. + +\unexpanded\def\ruledvss {\doruledvfiller\normalvss \normalvfilneg {2}} +\unexpanded\def\ruledvfil {\doruledvfiller\normalvfil \normalvfilneg {-4}} +\unexpanded\def\ruledvfill {\doruledvfiller\normalvfill \normalvfillneg{-12}} +\unexpanded\def\ruledvfilneg {\doruledvfiller\normalvfilneg \normalvfil {8}} +\unexpanded\def\ruledvfillneg{\doruledvfiller\normalvfillneg\normalvfill {16}} + +%D \macros +%D {ruledhskip} +%D +%D Skips differ from kerns in two important aspects: +%D +%D \startitemize[packed] +%D \item line and pagebreaks are allowed at a skip +%D \item skips can have a positive and/or negative +%D stretchcomponent +%D \stopitemize +%D +%D Stated a bit different: kerns are fixed skips at which no +%D line or pagebreak can occur. Because skips have a more open +%D character, they are visualized in a open way. +%D +%D \startbuffer +%D one +%D \hskip +30pt plus 5pt +%D two +%D \hskip +30pt +%D \hskip -10pt plus 5pt +%D three +%D \hskip 0pt +%D four +%D \hskip +30pt +%D five +%D \stopbuffer +%D +%D \ShowBufferedExample +%D +%D When skips have a stretch component, this is visualized by +%D means of a dashed line. Positive skips are on top of the +%D baseline, negative ones are below it. This way we can show +%D the combined results. An alternative visualization of +%D stretch could be drawing the mid line over a length of the +%D stretch, in positive or negative direction. + +\def\doruledhskip + {\relax + \dontinterfere + \dontcomplain + \investigateskip\scratchskip + \ifzero + \setbox0\normalhbox + {\normalhskip-\testrulewidth + \visualvrule + \!!width4\testrulewidth + \!!height16\testrulewidth + \!!depth16\testrulewidth}% + \else + \setbox0\normalhbox to \ifnegative-\fi\scratchskip + {\visualvrule + \!!width2\testrulewidth + \ifnegative\!!depth\else\!!height\fi16\testrulewidth + \cleaders + \visualhrule + \ifnegative + \!!depth2\testrulewidth + \!!height\zeropoint + \else + \!!height2\testrulewidth + \!!depth\zeropoint + \fi + \normalhfill + \ifflexible + \normalhskip\ifnegative\else-\fi\scratchskip + \normalhskip2\testrulewidth + \cleaders + \normalhbox + {\normalhskip 2\testrulewidth + \visualvrule + \!!width2\testrulewidth + \!!height\ifnegative-7\else9\fi\testrulewidth + \!!depth\ifnegative9\else-7\fi\testrulewidth + \normalhskip 2\testrulewidth}% + \normalhfill + \fi + \visualvrule + \!!width2\testrulewidth + \ifnegative\!!depth\else\!!height\fi16\testrulewidth}% + \setbox0\normalhbox + {\ifnegative\else\normalhskip-\scratchskip\fi + \box0}% + \fi + \smashbox0% + \ifvisiblestretch \else + \flexiblefalse + \fi + \ifflexible + % breaks ok but small displacements can occur + \skip2\scratchskip + \advance\skip2 -1\scratchskip + \divide\skip2 2 + \advance\scratchskip -\skip2 + \normalhskip\scratchskip + \normalpenalty\!!tenthousand + \box0 + \normalhskip\skip2 + \else + \normalhskip\scratchskip + \box0 + \fi + \egroup} + +\unexpanded\def\ruledhskip + {\bgroup + \afterassignment\doruledhskip + \scratchskip=} + +%D The visual skip is located at a feasible point. Normally +%D this does not interfere with the normaltypesetting process. +%D The next examples show (1)~the default behavior, (2)~the +%D (not entirely correct) distributed stretch and (3)~the way +%D the text is typeset without cues. +%D +%D \startbuffer +%D \dorecurse +%D {15} +%D {test\hskip1em plus .5em minus .5em +%D test\hskip2em +%D test} +%D \stopbuffer +%D +%D \startlinecorrection +%D \showmakeup +%D \getbuffer +%D \stoplinecorrection +%D +%D \startlinecorrection +%D \showmakeup +%D \visiblestretchtrue +%D \getbuffer +%D \stoplinecorrection +%D +%D \startlinecorrection +%D \getbuffer +%D \stoplinecorrection + +%D \macros +%D {ruledvskip} +%D +%D We are less fortunate when implementing the vertical skips. +%D This is a direct result of interference between the boxes that +%D visualize the skip and skip removal at a pagebreak. Normally +%D skips disappear at the top of a page, but not of course when +%D visualized in a \type{\vbox}. A quite perfect simulation +%D could have been built if we would have had available two +%D more primitives: \type{\hnop} and \type{\vnop}. These new +%D primitives could stand for boxes that are visible but are +%D not taken into account in any way. They are there for us, +%D but not for \TEX. +%D +%D \startbuffer +%D first line +%D \vskip +30pt plus 5pt +%D second line +%D \vskip +30pt +%D \vskip -10pt plus 5pt +%D third line +%D \par +%D fourth line +%D \vskip +30pt +%D fifth line +%D \vskip 0pt +%D sixth line +%D \stopbuffer +%D +%D \ShowBufferedExample +%D +%D We have to postpone \type{\prevdepth}. Although this +%D precaution probably is not completely waterproof, it works +%D quite well. + +\def\dodoruledvskip + {\nextdepth\prevdepth + \dontinterfere + \dontcomplain + \normaloffinterlineskip + \investigateskip\scratchskip + \ifzero + \setbox0\normalvcue + {\visualvrule + \!!width32\testrulewidth + \!!height2\testrulewidth + \!!depth2\testrulewidth}% + \else + \setbox0\normalvbox to \ifnegative-\fi\scratchskip + {\visualhrule + \!!width16\testrulewidth + \!!height2\testrulewidth + \ifflexible + \cleaders + \normalhbox to 16\testrulewidth + {\normalhss + \normalvbox + {\normalvskip 2\testrulewidth + \visualhrule + \!!width2\testrulewidth + \!!height2\testrulewidth + \normalvskip 2\testrulewidth}% + \normalhss}% + \normalvfill + \else + \normalvfill + \fi + \visualhrule + \!!width16\testrulewidth + \!!height2\testrulewidth}% + \setbox2\normalvbox to \ht0 + {\visualhrule + \!!width2\testrulewidth + \!!height\ht0}% + \ifnegative + \ht0\zeropoint + \setbox0\normalhbox + {\normalhskip2\testrulewidth % will be improved + \normalhskip-\wd0\box0}% + \fi + \smashbox0% + \smashbox2% + \setbox0\normalvcue + {\box2\box0}% + \setbox0\normalvbox + {\ifnegative\normalvskip\scratchskip\fi\box0}% + \smashbox0% + \fi + \ifvisiblestretch + \ifflexible + \skip2\scratchskip + \advance\skip2 -1\scratchskip + \divide\skip2 2 + \advance\scratchskip -\skip2 + \normalvskip\skip2 + \fi + \fi + \normalpenalty\!!tenthousand + \box0 + \prevdepth\nextdepth % not \dp0=\nextdepth + \normalvskip\scratchskip} + +%D We try to avoid interfering at the top of a page. Of course +%D we only do so when we are in the main vertical list. + +\def\doruledvskip + {\endgraf % \par + \ifdim\pagegoal=\maxdimen + \ifinner + \dodoruledvskip + \fi + \else + \dodoruledvskip + \fi + \egroup} + +\unexpanded\def\ruledvskip + {\bgroup + \afterassignment\doruledvskip + \scratchskip=} + +%D \macros +%D {ruledkern} +%D +%D The macros that implement the kerns are a bit more +%D complicated than needed, because they also serve the +%D visualization of glue, our \PLAIN\ defined kerns with +%D stretch or shrink. We've implemented both horizontal and +%D vertical kerns as ruled boxes. +%D +%D \startbuffer +%D one +%D \kern +30pt +%D two +%D \kern +30pt +%D \kern -10pt +%D three +%D \kern 0pt +%D four +%D \kern +30pt +%D five +%D \stopbuffer +%D +%D \ShowBufferedExample +%D +%D Positive and negative kerns are placed on top or below the +%D baseline, so we are able to track their added result. We +%D didn't mention spacings of 0~pt yet. Zero values are +%D visualized a bit different, because we want to see them +%D anyhow. + +\def\doruledhkern + {\dontinterfere + \dontcomplain + \baselinerulefalse + \investigateskip\scratchskip + \boxrulewidth2\testrulewidth + \ifzero + \setbox0\ruledhbox to 8\testrulewidth + {\visualvrule + \!!width\zeropoint + \!!height16\testrulewidth + \!!depth16\testrulewidth}% + \setbox0\normalhbox + {\normalhskip-4\testrulewidth\box0}% + \else + \setbox0\ruledhbox to \ifnegative-\fi\scratchskip + {\visualvrule + \!!width\zeropoint + \ifnegative\!!depth\else\!!height\fi16\testrulewidth + \ifflexible + \normalhskip2\testrulewidth + \cleaders + \normalhbox + {\normalhskip 2\testrulewidth + \visualvrule + \!!width2\testrulewidth + \!!height\ifnegative-7\else9\fi\testrulewidth + \!!depth\ifnegative9\else-7\fi\testrulewidth + \normalhskip 2\testrulewidth}% + \normalhfill + \else + \normalhfill + \fi}% + \testrulewidth2\testrulewidth + \setbox0\ruledhbox{\box0}% \make... + \fi + \smashbox0% + \normalpenalty\!!tenthousand + \normalhbox to \zeropoint + {\ifnegative\normalhskip1\scratchskip\fi + \box0}% + \afterwards\scratchskip + \egroup} + +\unexpanded\def\ruledhkern#1% + {\bgroup + \let\afterwards#1% + \afterassignment\doruledhkern + \scratchskip=} + +%D After having seen the horizontal ones, the vertical kerns +%D will not surprise us. In this example we use \type{\par} to +%D switch to vertical mode. +%D +%D \startbuffer +%D first line +%D \par \kern +30pt +%D second line +%D \par \kern +30pt +%D \par \kern -10pt +%D third line +%D \par +%D fourth line +%D \par \kern +30pt +%D fifth line +%D \par \kern 0pt +%D sixth line +%D \stopbuffer +%D +%D \ShowBufferedExample +%D +%D Like before, we have to postpone \type{\prevdepth}. If we +%D leave out this trick, we got ourselves some wrong spacing. + +\def\dodoruledvkern + {\nextdepth\prevdepth + \dontinterfere + \dontcomplain + \baselinerulefalse + \normaloffinterlineskip + \investigateskip\scratchskip + \boxrulewidth2\testrulewidth + \ifzero + \setbox0\ruledhbox to 32\testrulewidth + {\visualvrule + \!!width\zeropoint + \!!height4\testrulewidth + \!!depth4\testrulewidth}% + \else + \setbox0\ruledvbox to \ifnegative-\fi\scratchskip + {\hsize16\testrulewidth + \ifflexible + \cleaders + \normalhbox to 16\testrulewidth + {\normalhss + \normalvbox + {\normalvskip 2\testrulewidth + \visualhrule + \!!width2\testrulewidth + \!!height2\testrulewidth + \normalvskip 2\testrulewidth}% + \normalhss}% + \normalvfill + \else + \visualvrule + \!!width\zeropoint + \!!height\ifnegative-\fi\scratchskip + \normalhfill + \fi} + \fi + \testrulewidth2\testrulewidth + \setbox0\ruledvbox{\box0}% \make... + \smashbox0% + \setbox0\normalvbox + {\ifnegative\normalvskip\scratchskip\fi + \normalvcue + {\ifnegative\normalhskip-16\testrulewidth\fi\box0}}% + \smashbox0% + \normalpenalty\!!tenthousand + \box0 + \prevdepth\nextdepth} % not \dp0=\nextdepth + +\def\doruledvkern + {\ifdim\pagegoal=\maxdimen + \ifinner + \dodoruledvkern + \fi + \else + \dodoruledvkern + \fi + \afterwards\scratchskip + \egroup} + +\unexpanded\def\ruledvkern#1% + {\bgroup + \let\afterwards#1\relax + \afterassignment\doruledvkern + \scratchskip=} + +\unexpanded\def\ruledkern + {\ifvmode + \expandafter\ruledvkern + \else + \expandafter\ruledhkern + \fi + \normalkern} + +%D A a bit more \TEX nice solution is: +%D +%D \starttyping +%D \unexpanded\def\ruledkern% +%D {\csname ruled\ifvmode v\else h\fi kern\endcsname\normalkern} +%D \stoptyping + +%D \macros +%D {ruledhglue,ruledvglue} +%D +%D The non-primitive glue commands are treated as kerns with +%D stretch. This stretch is presented as a dashed line. I +%D have to admit that until now, I've never used these glue +%D commands. +%D +%D \startbuffer +%D one +%D \hglue +30pt plus 5pt +%D two +%D \hglue +30pt +%D \hglue -10pt plus 5pt +%D three +%D \hglue 0pt +%D four +%D \hglue +30pt +%D five +%D \stopbuffer +%D +%D \ShowBufferedExample + +\def\doruledhglue + {\leavevmode + \scratchcounter\spacefactor + \visualvrule\!!width\zeropoint + \normalpenalty\!!tenthousand + \ruledhkern\normalhskip\scratchskip + \spacefactor\scratchcounter + \egroup} + +\unexpanded\def\ruledhglue + {\bgroup + \afterassignment\doruledhglue\scratchskip=} + +%D \startbuffer +%D first line +%D \vglue +30pt plus 5pt +%D second line +%D \vglue +30pt +%D \vglue -10pt plus 5pt +%D third line +%D \par +%D fourth line +%D \vglue +30pt +%D fifth line +%D \vglue 0pt +%D sixth line +%D \stopbuffer +%D +%D \ShowBufferedExample + +\def\doruledvglue + {\endgraf % \par + \nextdepth\prevdepth + \visualhrule\!!height\zeropoint + \normalpenalty\!!tenthousand + \ruledvkern\normalvskip\scratchskip + \prevdepth\nextdepth + \egroup} + +\unexpanded\def\ruledvglue + {\bgroup + \afterassignment\doruledvglue\scratchskip=} + +%D \macros +%D {ruledmkern,ruledmskip} +%D +%D Mathematical kerns and skips are specified in mu. This +%D font related unit is incompatible with those of \DIMENSIONS\ +%D and \SKIPS. Because in math mode spacing is often a very +%D subtle matter, we've used a very simple, not overloaded way +%D to show them. + +\def\dodoruledmkern#1% + {\dontinterfere + \dontcomplain + \setbox0\normalhbox + {$\normalmkern\ifnegative-\fi\scratchmuskip$}% + \setbox0\normalhbox to \wd0 + {\visualvrule + \!!height16\testrulewidth + \!!depth16\testrulewidth + \!!width\testrulewidth + \leaders + \visualhrule + \!!height\ifpositive16\else-14\fi\testrulewidth + \!!depth\ifpositive-14\else16\fi\testrulewidth + \normalhfill + \ifflexible + \normalhskip-\wd0 + \leaders + \visualhrule + \!!height\testrulewidth + \!!depth\testrulewidth + \normalhfill + \fi + \visualvrule + \!!height16\testrulewidth + \!!depth16\testrulewidth + \!!width\testrulewidth}% + \smashbox0% + \ifnegative + #1\scratchmuskip + \box0 + \else + \box0 + #1\scratchmuskip + \fi + \egroup} + +%D \startbuffer +%D $a \mkern3mu = \mkern3mu +%D b \quad +%D \mkern-2mu + \mkern-2mu +%D \quad c$ +%D \stopbuffer +%D +%D \ShowBufferedExample + +\def\doruledmkern + {\investigatemuskip\scratchmuskip + \flexiblefalse + \dodoruledmkern\normalmkern} + +\unexpanded\def\ruledmkern + {\bgroup + \afterassignment\doruledmkern\scratchmuskip=} + +%D \startbuffer +%D $a \mskip3mu = \mskip3mu +%D b \quad +%D \mskip-2mu + \mskip-2mu +%D \quad c$ +%D \stopbuffer +%D +%D \ShowBufferedExample + +\def\doruledmskip + {\investigatemuskip\scratchmuskip + \flexibletrue + \dodoruledmkern\normalmskip} + +\unexpanded\def\ruledmskip + {\bgroup + \afterassignment\doruledmskip\scratchmuskip=} + +%D \macros +%D {penalty} +%D +%D After presenting fills, skip, kerns and glue we've come to +%D see penalties. In the first implementation --- most of the +%D time needed to develop this set of macros went into testing +%D different types of visualization --- penalties were mere +%D small blocks with one black half, depending on the sign. +%D This most recent version also gives an indication of the +%D amount of penalty. Penalties can go from less than $-10000$ +%D to over $+10000$, and their behavior is somewhat +%D non-lineair, with some values having special meanings. We +%D therefore decided not to use its value for a lineair +%D indicator. +%D +%D \startbuffer +%D one +%D \penalty +100 +%D two +%D \penalty +100 +%D \penalty -100 +%D three +%D \penalty 0 +%D four +%D \penalty +100 +%D five +%D \stopbuffer +%D +%D \ShowBufferedExample +%D +%D The small sticks at the side of the penalty indicate it +%D size. The next example shows the positive and negative +%D penalties of 0, 1, 10, 100, 1000 and 10000. +%D +%D \startlinecorrection +%D \hbox +%D {test \ruledhpenalty0 +%D test \ruledhpenalty1 +%D test \ruledhpenalty10 +%D test \ruledhpenalty100 +%D test \ruledhpenalty1000 +%D test \ruledhpenalty10000 +%D test} +%D \stoplinecorrection +%D +%D \blank +%D +%D \startlinecorrection +%D \hbox +%D {test \ruledhpenalty0 +%D test \ruledhpenalty-1 +%D test \ruledhpenalty-10 +%D test \ruledhpenalty-100 +%D test \ruledhpenalty-1000 +%D test \ruledhpenalty-10000 +%D test} +%D \stoplinecorrection +%D +%D \blank +%D +%D This way stacked penalties of different severance can be +%D shown in combination. +%D +%D test \ruledhpenalty10 \ruledhpenalty100 +%D test +%D test \ruledhpenalty1000 \ruledhpenalty-1000 +%D test + +\def\setruledpenaltybox#1#2#3#4#5#6% + {\setbox#1\normalhbox + {\ifnum#2=0 \else + \edef\sign + {\ifnum#2>0 +\else-\fi}% + \dimen0=\ifnum\sign#2>9999 + 28\else + \ifnum\sign#2>999 + 22\else + \ifnum\sign#2>99 + 16\else + \ifnum\sign#2>9 + 10\else + 4 + \fi\fi\fi\fi \testrulewidth + \ifnum#2<0 + \normalhskip-\dimen0 + \normalhskip-2\testrulewidth + \visualvrule + \!!width2\testrulewidth + \!!height#3\testrulewidth + \!!depth#4\testrulewidth + \fi + \visualvrule + \!!width\dimen0 + \!!height#5\testrulewidth + \!!depth#6\testrulewidth + \ifnum#2>0 + \visualvrule + \!!width2\testrulewidth + \!!height#3\testrulewidth + \!!depth#4\testrulewidth + \fi + \fi}% + \smashbox#1} + +\def\doruledhpenalty + {\dontinterfere + \dontcomplain + \investigatecount\scratchcounter + \testrulewidth2\testrulewidth + \boxrulewidth\testrulewidth + \setbox0\ruledhbox to 8\testrulewidth + {\ifnegative\else\normalhss\fi + \visualvrule + \!!depth8\testrulewidth + \!!width\ifzero0\else4\fi\testrulewidth + \ifpositive\else\normalhss\fi}% + \setruledpenaltybox{2}{\scratchcounter}{0}{8}{-3.5}{4.5}% + \normalpenalty\!!tenthousand + \setbox0\normalhbox + {\normalhskip-4\testrulewidth + \ifnegative + \box2\box0 + \else + \box0\box2 + \fi}% + \smashbox0% + \box0 + \normalpenalty\scratchcounter + \egroup} + +\unexpanded\def\ruledhpenalty + {\bgroup + \afterassignment\doruledhpenalty + \scratchcounter=} + +%D The size of a vertical penalty is also shown on the +%D horizontal axis. This way there is less interference with +%D the often preceding or following skips and kerns. +%D +%D \startbuffer +%D first line +%D \par \penalty +100 +%D second line +%D \par \penalty +100 +%D \par \penalty -100 +%D third line +%D \par \penalty 0 +%D fourth line +%D \par \penalty +100 +%D fifth line +%D \stopbuffer +%D +%D \ShowBufferedExample + +\def\doruledvpenalty + {\ifdim\pagegoal=\maxdimen + \else + \nextdepth\prevdepth + \dontinterfere + \dontcomplain + \investigatecount\scratchcounter + \testrulewidth2\testrulewidth + \boxrulewidth\testrulewidth + \setbox0\ruledhbox + {\visualvrule + \!!height4\testrulewidth + \!!depth4\testrulewidth + \!!width\zeropoint + \visualvrule + \!!height\ifnegative.5\else4\fi\testrulewidth + \!!depth\ifpositive.5\else4\fi\testrulewidth + \!!width8\testrulewidth}% + \setruledpenaltybox{2}{\scratchcounter}{4}{4}{.5}{.5}% + \setbox0\normalhbox + {\normalhskip-4\testrulewidth + \ifnegative + \box2\box0 + \else + \box0\box2 + \fi + \normalhss}% + \smashbox0% + \normalpenalty\!!tenthousand + \nointerlineskip + \dp0\nextdepth % not \prevdepth=\nextdepth + \normalvbox + {\normalvcue{\box0}}% + \fi + \normalpenalty\scratchcounter + \egroup} + +\unexpanded\def\ruledvpenalty + {\bgroup + \afterassignment\doruledvpenalty + \scratchcounter=} + +\unexpanded\def\ruledpenalty + {\ifvmode + \expandafter\ruledvpenalty + \else + \expandafter\ruledhpenalty + \fi} + +%D At the cost of some more tokens, a bit more clever +%D implementation would be: +%D +%D \starttyping +%D \unexpanded\def\ruledpenalty% +%D {\csname ruled\ifvmode v\else h\fi penalty\endcsname} +%D \stoptyping + +%D \macros +%D {showfils,dontshowfils, +%D showboxes,dontshowboxes, +%D showskips,dontshowskips, +%D showpenalties,dontshowpenalties} +%D +%D For those who want to manipulate the visual cues in detail, +%D we have grouped them. + +\newif\ifshowingcomposition % see later why we need this + +\def\showfils + {\showingcompositiontrue + \let\hss \ruledhss + \let\hfil \ruledhfil + \let\hfill \ruledhfill + \let\hfilneg \ruledhfilneg + \let\hfillneg \ruledhfillneg + \let\vss \ruledvss + \let\vfil \ruledvfil + \let\vfill \ruledvfill + \let\vfilneg \ruledvfilneg + \let\vfillneg \ruledvfillneg} + +\def\dontshowfils + {\let\hss \normalhss + \let\hfil \normalhfil + \let\hfill \normalhfill + \let\hfilneg \normalhfilneg + \let\hfillneg \normalhfillneg + \let\vss \normalvss + \let\vfil \normalvfil + \let\vfill \normalvfill + \let\vfilneg \normalvfilneg + \let\vfillneg \normalvfillneg} + +\def\showboxes + {\showingcompositiontrue + \baselineruletrue + \let\hbox \ruledhbox + \let\vbox \ruledvbox + \let\vtop \ruledvtop + \let\vcenter \ruledvcenter} + +\def\dontshowboxes + {\let\hbox \normalhbox + \let\vbox \normalvbox + \let\vtop \normalvtop + \let\vcenter \normalvcenter} + +\def\showskips + {\showingcompositiontrue + \let\hskip \ruledhskip + \let\vskip \ruledvskip + \let\kern \ruledkern + \let\mskip \ruledmskip + \let\mkern \ruledmkern + \let\hglue \ruledhglue + \let\vglue \ruledvglue} + +\def\dontshowskips + {\let\hskip \normalhskip + \let\vskip \normalvskip + \let\kern \normalkern + \let\mskip \normalmskip + \let\mkern \normalmkern + \let\hglue \normalhglue + \let\vglue \normalvglue} + +\def\showpenalties + {\showingcompositiontrue + \let\penalty \ruledpenalty} + +\def\dontshowpenalties + {\let\penalty \normalpenalty} + +%D \macros +%D {showcomposition,dontshowcomposition, +%D showingcomposition} +%D +%D All these nice options come together in three macros. One +%D for turning the options on, one for turning them off, and a +%D boolean for enabling the mechanism outside the scope of the +%D user. The first two macros only do their job when we are +%D actually showing the composition. +%D +%D \starttyping +%D \showingcompositiontrue +%D \showcomposition +%D \stoptyping +%D +%D Because the output routine can do tricky things, like +%D multiple column typesetting and manipulation of the +%D pagebody, shifting things around and so on, the macro +%D \type{\dontshowcomposition} best can be called when we enter +%D this routine. Too much visual cues just don't make sense. In +%D \CONTEXT\ this has been taken care of. + +\newif\ifshowingcomposition + +\def\showcomposition + {\ifshowingcomposition + \showfils + \showboxes + \showskips + \showpenalties + \fi} + +\def\dontshowcomposition + {\ifshowingcomposition + \dontshowfils + \dontshowboxes + \dontshowskips + \dontshowpenalties + \fi} + +%D \macros +%D {showmakeup, +%D defaulttestrulewidth} +%D +%D Just to make things even more easy, we have defined: +%D +%D \starttyping +%D \showmakeup +%D \stoptyping +%D +%D For the sake of those who don't (yet) use \CONTEXT\ we +%D preset \type{\defaulttestrulewidth} to the already set +%D value. Otherwise we default to a bodyfontsize related value. +%D +%D \starttyping +%D \def\defaulttestrulewidth{.2pt} +%D \stoptyping +%D +%D Beware, it's a macro not a \DIMENSION. + +\ifx\bodyfontsize\undefined + \edef\defaulttestrulewidth{\the\testrulewidth} +\else + \def\defaulttestrulewidth{.02\bodyfontsize} +\fi + +\def\showmakeup + {\testrulewidth\defaulttestrulewidth + \showingcompositiontrue + \showcomposition} + +\protect + +%D \ifCONTEXT \let\next=\relax \else \let\next=\endinput +%D The documented source you have been reading was processed +%D using some surrogate makeup. When this file is processed +%D in \CONTEXT, a few more examples show up here, like a local +%D table of contents and a local register. +%D \fi \next + +%D Lets end with some more advanced examples. +%D Definitions and enumerations come in many flavors. The +%D next one for instance is defined as: +%D +%D \starttyping +%D \definedescription[test][place=left,hang=3,width=6em] +%D \stoptyping +%D +%D When applied to some text, this would look like: +%D +%D \bgroup +%D \showmakeup +%D \definedescription[test][location=left,hang=3,width=6em] +%D +%D \test{visual\\debugger} I would be very pleased if \TEX\ +%D had two more primitives: \type{\vnop} and \type{\hnop}. Both +%D should act and show up as normal boxes, but stay invisible +%D for \TEX\ when it's doing calculations. The \type{\vnop} +%D for instance should not interact with the internal mechanism +%D responsible for the disappearing skips, kerns and penalties +%D at a pagebreak. As long as we don't have these two boxtypes, +%D visual debugging will never be perfect. +%D +%D \egroup +%D +%D The index to this section looks like: +%D +%D {\setupreferencing[prefixprefix=dummy]\showmakeup\placeindex[criterium=local]} +%D +%D Although not impressive examples or typesetting, both +%D show us how and where things happen. When somehow the last +%D lines in this two column index don't allign, then this is +%D due to some still unknown interference. + +\endinput diff --git a/Master/texmf-dist/tex/context/base/supp-vis.mkiv b/Master/texmf-dist/tex/context/base/supp-vis.mkiv new file mode 100644 index 00000000000..f38c8e1e353 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/supp-vis.mkiv @@ -0,0 +1,1907 @@ +%D \module +%D [ file=supp-vis, +%D version=1996.10.21, +%D title=\CONTEXT\ Support Macros, +%D subtitle=Visualization, +%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. + +% no longer generic, who cares ... + +%D \gdef\ShowBufferedExample% private typeseting macro +%D {\startlinecorrection +%D \bgroup +%D \setuptyping[margin=0pt,option=color] +%D \showmakeup +%D \centeredvcuetrue +%D \dontinterfere +%D \baselinerulefalse +%D \normalvbox +%D {\normalhbox to \hsize +%D {$\hsize=.5\hsize +%D \advance\hsize by -.5em +%D \normalvcenter{\vbox{\getbuffer}}\normalhss +%D \normalvcenter{\vbox{\dontshowcomposition\typebuffer}}$}} +%D \egroup +%D \stoplinecorrection} +%D +%D \gdef\ShowBufferedExampleBox% private typeseting macro +%D {\startlinecorrection +%D \bgroup +%D \setuptyping[margin=0pt,option=color] +%D \showmakeup +%D \centeredvcuetrue +%D \dontinterfere +%D \baselinerulefalse +%D \normalvbox +%D {\normalhbox to \hsize +%D {$\hsize=.5\hsize +%D \advance\hsize by -.5em +%D \normalvcenter{\baselineruletrue\vbox{\getbuffer}}\normalhss +%D \normalvcenter{\vbox{\dontshowcomposition\typebuffer}}$}} +%D \egroup +%D \stoplinecorrection} + +%D Although an integral part of \CONTEXT, this module is one +%D of the support modules. Its stand alone character permits +%D use in \PLAIN\ \TEX\ or \TEX\ based macropackages. +%D \ifCONTEXT \else If in some examples the verbatim listings +%D don't show up nice, this is due to processing by a system +%D that does not support buffering. In \CONTEXT\ we show the +%D commands in the margin, use bit more advanced way of +%D numbering, and typeset the source in \TEX nicolored +%D verbatim. Sorry for this inconvenience.\fi +%D +%D Depending on my personal needs and those of whoever uses it, +%D the macros will be improved in terms of visualization, +%D efficiency and compatibility. These rather low level +%D visualization macros are supplemented by ones that can +%D visualize baselines, the page layout and whatever deserves +%D attention. Most of those macros can be found in \type +%D {core-vis} and other core modules. Their integration in +%D \CONTEXT\ prohibits generic applications. + +\ifx \undefined \writestatus \input supp-mis.tex \fi + +%D One of the strong points of \TEX\ is abstraction of textual +%D input. When macros are defined well and do what we +%D want them to do, we will seldom need the tools present in +%D What You See Is What You Get systems. For instance, when +%D entering text we don't need rulers, because no manual +%D shifting and/or alignment of text is needed. On the other +%D hand, when we are designing macros or specifying layout +%D elements, some insight in \TEX's advanced spacing, kerning, +%D filling, boxing and punishment abilities will be handy. +%D That's why we've implemented a mechanism that shows some of +%D the inner secrets of \TEX. + +\writestatus{loading}{ConTeXt Support Macros / Visualization} + +%D In this module we are going to redefine some \TEX\ +%D primitives and \PLAIN\ macro's. Their original meaning is +%D saved in macros with corresponding names, preceded by +%D \type{normal}. These original macros are (1)~used to +%D temporary restore the old values when needed and +%D (2)~used to prevent recursive calls in the macros that +%D replace them. + +\unprotect + +\let\visualvrule\vrule +\let\visualhrule\hrule + +%D \macros +%D {dontinterfere} +%D +%D Indentation, left and/or right skips, redefinition of +%D \type{\par} and assignments to \type{\everypar} can lead to +%D unwanted results. We can therefore turn all those things +%D off with \type{\dontinterfere}. + +\def\dontinterfere + {\everypar \emptytoks + \let\par \endgraf + \parindent\zeropoint + \parskip \zeropoint + \leftskip \zeropoint + \rightskip\zeropoint + \relax} + +%D \macros +%D {dontcomplain} +%D +%D In this module we do a lot of box manipulations. Because we +%D don't want to be confronted with to many over- and underfull +%D messages we introduce \type{\dontcomplain}. + +\def\dontcomplain + {\hbadness\!!tenthousand \vbadness\hbadness + \hfuzz \maxdimen \vfuzz \hfuzz} + +% This obsolete dutch name is sometimes uses in manual styles; when +% cleaning up the codebase I decided to move this definition here. + +\let\mindermeldingen\dontcomplain + +%D \macros +%D {normaloffinterlineskip} +%D +%D The next hack is needed because in \CONTEXT\ we redefine +%D \type{\offinterlineskip}. + +\ifx\undefined\normaloffinterlineskip + \let\normaloffinterlineskip\offinterlineskip +\fi + +%D \macros +%D {normalhbox, +%D normalvbox,normalvtop} +%D +%D There are three types of boxes, one horizontal and two +%D vertical in nature. As we will see later on, all three types +%D are to be handled according to their orientation and +%D baseline behavior. Especially \type{\vtop}'s need our +%D special attention. + +% already saved + +%D \macros +%D {normalhskip, +%D normalvskip} +%D +%D Next come the flexible skips, which come in two flavors +%D too. Like boxes these are handled with \TEX\ primitives. + +% already saved + +%D \macros +%D {normalpenalty, +%D normalkern} +%D +%D Both penalties and kerns are taken care of by mode sensitive +%D primitives. This means that when making them visible, we +%D have to take the current mode into account. + +% already saved + +%D \macros +%D {normalhglue, +%D normalvglue} +%D +%D Glues on the other hand are macro's defined in \PLAIN\ \TEX. +%D As we will see, their definitions make the implementation of +%D their visible counterparts a bit more \TeX{}nical. + +\let\normalhglue = \hglue +\let\normalvglue = \vglue + +%D \macros +%D {normalmkern, +%D normalmskip} +%D +%D Math mode has its own spacing primitives, preceded by +%D \type{m}. Due to the relation with the current font and the +%D way math is typeset, their unit \type{mu} is not compatible +%D with other dimensions. As a result, the visual appearance +%D of these primitives is kept primitive too. + +% already saved + +%D \macros +%D {hfilneg, +%D vfilneg} +%D +%D Fills can be made visible quite easy. We only need some +%D additional negation macros. Because \PLAIN\ \TEX\ only +%D offers \type{\hfilneg} and \type{\vfilneg}, we define our +%D own alternative double \type{ll}'ed ones. + +\def\hfilneg {\normalhskip\zeropoint \!!plus-1fil\relax} +\def\vfilneg {\normalvskip\zeropoint \!!plus-1fil\relax} +\def\hfillneg {\normalhskip\zeropoint \!!plus-1fill\relax} +\def\vfillneg {\normalvskip\zeropoint \!!plus-1fill\relax} +\def\hfilllneg{\normalhskip\zeropoint \!!plus-1filll\relax} +\def\vfilllneg{\normalvskip\zeropoint \!!plus-1filll\relax} + +%D \macros +%D {normalhss,normalhfil,normalhfill, +%D normalvss,normalvfil,normalvfill} +%D +%D The positive stretch primitives are used independant and in +%D combination with \type{\leaders}. + +% already saved + +%D \macros +%D {normalhfilneg,normalhfillneg, +%D normalvfilneg,normalvfillneg} +%D +%D Keep in mind that both \type{\hfillneg} and \type{\vfillneg} +%D are not part of \PLAIN\ \TEX\ and therefore not documented +%D in standard \TEX\ documentation. They can nevertheless be +%D used at will. + +\let\normalhfillneg = \hfillneg +\let\normalvfillneg = \vfillneg + +%D Visualization is not always wanted. Instead of turning this +%D option off in those (unpredictable) situations, we just +%D redefine a few \PLAIN\ macros. + +\ifx\tlap\undefined + + \def\rlap#1{\normalhbox to \zeropoint{#1\normalhss}} + \def\llap#1{\normalhbox to \zeropoint{\normalhss#1}} + \def\blap#1{\normalvbox to \zeropoint{#1\normalvss}} + \def\tlap#1{\normalvbox to \zeropoint{\normalvss#1}} + +\fi + +\ifx\contextversion\undefined \def~{\normalpenalty\!!tenthousand\ } \fi + +%D \macros +%D {makeruledbox} +%D +%D Ruled boxes can be typeset is many ways. Here we present +%D just one alternative. This implementation may be a little +%D complicated, but it supports all three kind of boxes. The +%D next command expects a \BOX\ specification, like: +%D +%D \starttyping +%D \makeruledbox0 +%D \stoptyping + +%D \macros +%D {baselinerule,baselinefill} +%D +%D We can make the baseline of a box visible, both dashed and +%D as a rule. The line is drawn on top of the baseline. All +%D we have to say is: +%D +%D \starttyping +%D \baselineruletrue +%D \baselinefilltrue +%D \stoptyping +%D +%D At the cost of some overhead these alternatives are +%D implemented using \type{\if}'s: + +\newif\ifbaselinerule \baselineruletrue +\newif\ifbaselinefill \baselinefillfalse + +%D \macros +%D {iftoprule,ifbottomrule,ifleftrule,ifrightrule} +%D +%D Rules can be turned on and off, but by default we have: +%D +%D \starttyping +%D \topruletrue +%D \bottomruletrue +%D \leftruletrue +%D \rightruletrue +%D \stoptyping +%D +%D As we see below: + +\newif\iftoprule \topruletrue +\newif\ifbottomrule \bottomruletrue +\newif\ifleftrule \leftruletrue +\newif\ifrightrule \rightruletrue + +%D \macros +%D {boxrulewidth} +%D +%D The width in the surrounding rules can be specified by +%D assigning an apropriate value to the dimension used. This +%D module defaults the width to: +%D +%D \starttyping +%D \boxrulewidth=.2pt +%D \stoptyping +%D +%D Although we are already low on \DIMENSIONS\ it's best to +%D spend one here, mainly because it enables easy manipulation, +%D like multiplication by a given factor. + +\newdimen\boxrulewidth \boxrulewidth=.2pt + +%D The core macro \type{\makeruledbox} looks a bit hefty. The +%D manipulation at the end is needed because we want to +%D preserve both the mode and the baseline. This means that +%D \type{\vtop}'s and \type{\vbox}'es behave the way we expect +%D them to do. +%D +%D \startlinecorrection +%D \hbox +%D {\ruledhbox to 5em{\strut test\normalhss}\hskip1em +%D \ruledvbox{\hsize 5em\strut test \par test\strut}\hskip1em +%D \ruledvtop{\hsize 5em\strut test \par test\strut}} +%D \stoplinecorrection +%D +%D The \type{\cleaders} part of the macro is responsible for +%D the visual baseline. The \type{\normalhfill} belongs to this +%D primitive too. By storing and restoring the height and depth +%D of box \type{#1}, we preserve the mode. + +\let\dowithruledbox\relax + +\let\ruledheight\!!zeropoint +\let\ruleddepth \!!zeropoint +\let\ruledwidth \!!zeropoint + +\def\makeruledbox#1% + {\edef\ruledheight{\the\ht#1}% + \edef\ruleddepth {\the\dp#1}% + \edef\ruledwidth {\the\wd#1}% + \setbox\scratchbox\normalvbox + {\dontcomplain + \normaloffinterlineskip + \visualhrule + \!!height\boxrulewidth + \iftoprule\else\!!width\zeropoint\fi + \normalvskip-\boxrulewidth + \normalhbox to \ruledwidth + {\visualvrule + \!!height\ruledheight + \!!depth\ruleddepth + \!!width\ifleftrule\else0\fi\boxrulewidth + \ifdim\ruledheight>\zeropoint \else \baselinerulefalse \fi + \ifdim\ruleddepth>\zeropoint \else \baselinerulefalse \fi + \ifbaselinerule + \ifdim\ruledwidth<20\boxrulewidth + \baselinefilltrue + \fi + \cleaders + \ifbaselinefill + \visualhrule + \!!height\boxrulewidth + \else + \normalhbox + {\normalhskip2.5\boxrulewidth + \visualvrule + \!!height\boxrulewidth + \!!width5\boxrulewidth + \normalhskip2.5\boxrulewidth}% + \fi + \fi + \normalhfill + \visualvrule + \!!width\ifrightrule\else0\fi\boxrulewidth}% + \normalvskip-\boxrulewidth + \visualhrule + \!!height\boxrulewidth + \ifbottomrule\else\!!width\zeropoint\fi}% + \wd#1\zeropoint + \setbox#1=\ifhbox#1\normalhbox\else\normalvbox\fi + {\normalhbox + {\box#1% + \lower\ruleddepth\normalhbox{\dowithruledbox{\box\scratchbox}}}}% + \ht#1=\ruledheight + \wd#1=\ruledwidth + \dp#1=\ruleddepth} + +%D Just in case one didn't notice: the rules are in fact layed +%D over the box. This way the contents of a box cannot +%D visually interfere with the rules around (upon) it. A more +%D advanced version of ruled boxes can be found in one of the +%D core modules of \CONTEXT. There we take offsets, color, +%D rounded corners, backgrounds and alignment into account too. + +%D \macros +%D {ruledhbox, +%D ruledvbox,ruledvtop, +%D ruledvcenter} +%D +%D These macro's can be used instead of \type{\hbox}, +%D \type{\vbox}, \type{\vtop} and, when in math mode, +%D \type{\vcenter}. They just do what their names state. Using +%D an auxiliary macro would save us a few words of memory, but +%D it would make their appearance even more obscure. +%D +%D \startbuffer +%D \hbox +%D {\strut +%D one +%D two +%D \hbox{three} +%D four +%D five} +%D \stopbuffer +%D +%D \ShowBufferedExampleBox + +\unexpanded\def\ruledhbox + {\normalhbox\bgroup + \dowithnextbox{\makeruledbox\nextbox\box\nextbox\egroup}% + \normalhbox} + +%D \startbuffer +%D \vbox +%D {\strut +%D first line \par +%D second line \par +%D third line \par +%D fourth line \par +%D fifth line +%D \strut } +%D \stopbuffer +%D +%D \ShowBufferedExampleBox + +\unexpanded\def\ruledvbox + {\normalvbox\bgroup + \dowithnextbox{\makeruledbox\nextbox\box\nextbox\egroup}% + \normalvbox} + +%D \startbuffer +%D \vtop +%D {\strut +%D first line \par +%D second line \par +%D third line \par +%D fourth line \par +%D fifth line +%D \strut } +%D \stopbuffer +%D +%D \ShowBufferedExampleBox + +\unexpanded\def\ruledvtop + {\normalvtop\bgroup + \dowithnextbox{\makeruledbox\nextbox\box\nextbox\egroup}% + \normalvtop} + +%D \startbuffer +%D \hbox +%D {$\vcenter{\hsize.2\hsize +%D alfa \par beta}$ +%D $\vcenter to 3cm{\hsize.2\hsize +%D alfa \par beta \par gamma}$ +%D $\vcenter{\hsize.2\hsize +%D alfa \par beta}$} +%D \stopbuffer +%D +%D \ShowBufferedExampleBox + +\unexpanded\def\ruledvcenter + {\normalvbox\bgroup + \dontinterfere + \dowithnextbox + {\scratchdimen.5\ht\nextbox + \advance\scratchdimen .5\dp\nextbox + \ht\nextbox\scratchdimen + \dp\nextbox\scratchdimen + \ruledhbox{\box\nextbox}% + \egroup}% + \normalvbox} + +%D \macros +%D {ruledbox, +%D setruledbox} +%D +%D Of the next two macros the first can be used to precede a +%D box of ones own choice. One can for instance prefix boxes +%D with \type{\ruledbox} and afterwards --- when the macro +%D satisfy the needs --- let it to \type{\relax}. +%D +%D \starttyping +%D \ruledbox\hbox{What rules do you mean?} +%D \stoptyping +%D +%D The macro \type{\setruledbox} can be used to directly +%D rule a box. +%D +%D \starttyping +%D \setruledbox12=\hbox{Who's talking about rules here?} +%D \stoptyping +%D +%D At the cost of some extra macros we can implement a +%D variant that does not need the~\type{=}, but we stick to: + +\unexpanded\def\ruledbox + {\dowithnextbox{\makeruledbox\nextbox\box\nextbox}} + +\def\setruledbox#1=% + {\dowithnextbox{\makeruledbox\nextbox\setbox#1\nextbox}} + +%D \macros +%D {investigateskip, +%D investigatecount, +%D investigatemuskip} +%D +%D Before we meet the visualizing macro's, we first implement +%D ourselves some handy utility ones. Just for the sake of +%D efficiency and readability, we introduce some status +%D variables, that tell us a bit more about the registers we +%D use: +%D +%D \starttyping +%D \ifflexible +%D \ifzero +%D \ifnegative +%D \ifpositive +%D \stoptyping +%D +%D These status variables are set when we call for one of the +%D investigation macros, e.g. +%D +%D \starttyping +%D \investigateskip\scratchskip +%D \stoptyping +%D +%D We use some dirty trick to check stretchability of \SKIPS. +%D Users of these macros are invited to study their exact +%D behavior first. The positive and negative states both +%D include zero and are in fact non-negative ($\geq0$) and +%D non-positive ($\leq0$) . + +\newif\ifflexible +\newif\ifzero +\newif\ifnegative +\newif\ifpositive + +\def\investigateskip#1% + {\relax + \scratchdimen#1\relax + \edef\!!stringa{\the\scratchdimen}% + \edef\!!stringb{\the#1}% + \ifx\!!stringa\!!stringb \flexiblefalse \else \flexibletrue \fi + \ifdim#1=\zeropoint\relax + \zerotrue \else + \zerofalse \fi + \ifdim#1<\zeropoint\relax + \positivefalse \else + \positivetrue \fi + \ifdim#1>\zeropoint\relax + \negativefalse \else + \negativetrue \fi} + +% etex +% +% \def\investigateskip#1% +% {\relax +% \ifdim\scratchskip=\zeropoint +% \ifdim\gluestretch\scratchskip=\zeropoint +% \ifdim\glueshrink\scratchskip=\zeropoint +% \flexiblefalse +% \else +% \flexibletrue +% \fi +% \else +% \flexibletrue +% \fi +% \else +% \flexibletrue +% \fi +% \ifdim#1=\zeropoint\relax +% \zerotrue \else +% \zerofalse \fi +% \ifdim#1<\zeropoint\relax +% \positivefalse \else +% \positivetrue \fi +% \ifdim#1>\zeropoint\relax +% \negativefalse \else +% \negativetrue \fi} + +\def\investigatecount#1% + {\relax + \flexiblefalse + \ifnum#1=\zerocount + \zerotrue \else + \zerofalse \fi + \ifnum#1<\zerocount + \positivefalse \else + \positivetrue \fi + \ifnum#1>\zerocount + \negativefalse \else + \negativetrue \fi} + +\def\investigatemuskip#1% + {\relax + \edef\!!stringa{\the\scratchmuskip}% + \edef\!!stringb{0mu}% + \def\!!stringc##1##2\\{##1}% + \expandafter\edef\expandafter\!!stringc\expandafter + {\expandafter\!!stringc\!!stringa\\}% + \edef\!!stringd{-}% + \flexiblefalse + \ifx\!!stringa\!!stringb + \zerotrue + \negativefalse + \positivefalse + \else + \zerofalse + \ifx\!!stringc\!!stringd + \positivefalse + \negativetrue + \else + \positivetrue + \negativefalse + \fi + \fi} + +%D Now the neccessary utility macros are defined, we can make a +%D start with the visualizing ones. The implementation of these +%D macros is a compromise between readability, efficiency of +%D coding and processing speed. Sometimes we do in steps what +%D could have been done in combination, sometimes we use a few +%D boxes more or less then actually needed, and more than once +%D one can find the same piece of rule drawing code twice. + +%D \macros +%D {ifcenteredvcue,normalvcue} +%D +%D Depending on the context, one can force visual vertical cues +%D being centered along \type{\hsize} or being put at the +%D current position. Although centering often looks better, +%D we've chosen the second alternative as default. The main +%D reason for doing so is that often when we don't set the +%D \type{\hsize} ourselves, \TEX\ takes the value of the +%D surrounding box. As a result the visual cues can migrate +%D outside the current context. +%D +%D This behavior is accomplished by a small but effective +%D auxiliary macro, which behavior can be influenced by the +%D boolean \type{\centeredvcue}. By saying +%D +%D \starttyping +%D \centeredvcuetrue +%D \stoptyping +%D +%D one turns centering on. As said, we turn it off. + +\newif\ifcenteredvcue \centeredvcuefalse + +\def\normalvcue#1% + {\normalhbox \ifcenteredvcue to \hsize \fi {\normalhss#1\normalhss}} + +%D We could have used the more robust version +%D +%D \starttyping +%D \def\normalvcue% +%D {\normalhbox \ifcenteredvcue to \hsize \fi +%D \bgroup\bgroup\normalhss +%D \aftergroup\normalhss\aftergroup\egroup +%D \let\next=} +%D \stoptyping +%D +%D or the probably best one: +%D +%D \starttyping +%D \def\normalvcue% +%D {\hbox \ifcenteredvcue to \hsize +%D \bgroup\bgroup\normalhss +%D \aftergroup\normalhss\aftergroup\egroup +%D \else +%D \bgroup +%D \fi +%D \let\next=} +%D \stoptyping +%D +%D Because we don't have to preserve \CATCODES\ and only use +%D small arguments, we stick to the first alternative. + +%D \macros +%D {testrulewidth} +%D +%D We build our visual cues out of rules. At the cost of a much +%D bigger \DVI\ file, this is to be prefered over using +%D characters (1)~because we cannot be sure of their +%D availability and (2)~because their dimensions are fixed. +%D +%D As with ruled boxes, we use a \DIMENSION\ to specify the +%D width of the ruled elements. This dimension defaults to: +%D +%D \starttyping +%D \testrulewidth=\boxrulewidth +%D \stoptyping +%D +%D Because we prefer whole numbers for specifying the +%D dimensions, we often use even multiples of +%D \type{\testrulewidth}. + +%D \macros +%D {visiblestretch} +%D +%D A second variable is introduced because of the stretch +%D components of \SKIPS. At the cost of some accuracy we can +%D make this stretch visible. +%D +%D \starttyping +%D \visiblestretchtrue +%D \stoptyping + +\newdimen\testrulewidth \testrulewidth=\boxrulewidth +\newif\ifvisiblestretch \visiblestretchfalse + +%D \macros +%D {ruledhss, +%D ruledhfil,ruledhfilneg, +%D ruledhfill,ruledhfillneg} +%D +%D We start with the easiest part, the fills. The scheme we +%D follow is {\em visual filling -- going back -- normal +%D filling}. Visualizing is implemented using \type{\cleaders}. +%D Because the \BOX\ that follows this command is constructed +%D only once, the \type{\copy} is not really a prerequisite. We +%D prefer using a \type{\normalhbox} here instead of a +%D \type{\hbox}. + +\def\setvisiblehfilbox#1\to#2#3#4% + {\setbox#1\normalhbox + {\visualvrule + \!!width #2\testrulewidth + \!!height#3\testrulewidth + \!!depth #4\testrulewidth}% + \smashbox#1} + +\def\doruledhfiller#1#2#3#4% + {#1#2% + \bgroup + \dontinterfere + \dontcomplain + \setvisiblehfilbox0\to{4}{#3}{#4}% + \setvisiblehfilbox2\to422% + \copy0\copy2 + \bgroup + \setvisiblehfilbox0\to422% + \cleaders + \normalhbox to 12\testrulewidth + {\normalhss\copy0\normalhss}% + #1% + \egroup + \setbox0\normalhbox + {\normalhskip-4\testrulewidth\copy0\copy2}% + \smashbox0% + \box0 + \egroup} + +%D The horizontal fillers differ in their boundary +%D visualization. Watch the small dots. Fillers can be +%D combined within reasonable margins. +%D +%D \startlinecorrection +%D \baselinerulefalse +%D \ruledhbox to \hsize +%D {\strut\type{\hss}\ruledhss test} +%D \stoplinecorrection +%D +%D \startlinecorrection +%D \baselinerulefalse +%D \ruledhbox to \hsize +%D {\strut\type{\hfil}\ruledhfil test} +%D \stoplinecorrection +%D +%D \startlinecorrection +%D \baselinerulefalse +%D \ruledhbox to \hsize +%D {\strut\type{\hfill}\ruledhfill test} +%D \stoplinecorrection +%D +%D \startlinecorrection +%D \baselinerulefalse +%D \ruledhbox to \hsize +%D {\strut +%D \type{\hfil}\type{\hfil}\ruledhfil\ruledhfil +%D test% +%D \ruledhfil\type{\hfil}} +%D \stoplinecorrection +%D +%D The negative counterparts are visualizes, but seldom +%D become visible, apart from their boundaries. +%D +%D \startlinecorrection +%D \baselinerulefalse +%D \ruledhbox to \hsize +%D {\strut\type{\hfilneg}\ruledhfilneg test} +%D \stoplinecorrection +%D +%D \startlinecorrection +%D \baselinerulefalse +%D \ruledhbox to \hsize +%D {\strut\type{\hfillneg}\ruledhfillneg test} +%D \stoplinecorrection +%D +%D Although leaders are used for visualizing, they are +%D visualized themselves correctly as the next example shows. +%D +%D \startlinecorrection +%D \baselinerulefalse +%D \ruledhbox to \hsize +%D {\strut\cleaders\normalhbox to 2em{\normalhss$\circ$\normalhss}\ruledhfill} +%D \stoplinecorrection +%D +%D All five substitutions use the same auxiliary macro. Watch +%D the positive first -- negative next approach. + +\unexpanded\def\ruledhss + {\doruledhfiller\normalhss\normalhfilneg{0}{0}} + +\unexpanded\def\ruledhfil + {\doruledhfiller\normalhfil\normalhfilneg{10}{-6}} + +\unexpanded\def\ruledhfill + {\doruledhfiller\normalhfill\normalhfillneg{18}{-14}} + +\unexpanded\def\ruledhfilneg + {\doruledhfiller\normalhfilneg\normalhfil{-6}{10}} + +\unexpanded\def\ruledhfillneg + {\doruledhfiller\normalhfillneg\normalhfill{-14}{18}} + +%D \macros +%D {ruledvss, +%D ruledvfil,ruledvfilneg, +%D ruledvfill,ruledvfillneg} +%D +%D The vertical mode commands adopt the same visualization +%D scheme, but are implemented in a slightly different way. + +\def\setvisiblevfilbox#1\to#2#3#4% + {\setbox#1\normalhbox + {\visualvrule + \!!width #2\testrulewidth + \!!height#3\testrulewidth + \!!depth #4\testrulewidth}% + \smashbox#1}% + +\def\doruledvfiller#1#2#3% + {#1#2% + \bgroup + \dontinterfere + \dontcomplain + \normaloffinterlineskip + \setvisiblevfilbox0\to422% + \setbox2\normalvcue + {\normalhskip -#3\testrulewidth\copy0}% + \smashbox2% + \copy2 + \bgroup + \setbox2\normalvcue + {\normalhskip -2\testrulewidth\copy0}% + \smashbox2% + \copy2 + \cleaders + \normalvbox to 12\testrulewidth + {\normalvss\copy2\normalvss}% + #1% + \setbox2\normalvbox + {\normalvskip-2\testrulewidth\copy2}% + \smashbox2% + \box2 + \egroup + \box2 + \egroup} + +%D Because they act the same as their horizontal counterparts +%D we only show a few examples. +%D +%D \startlinecorrection +%D \hbox to \hsize +%D {\dontinterfere +%D \baselinerulefalse +%D \centeredvcuetrue +%D \ruledvbox to 10ex +%D {\hsize.18\hsize +%D \type{\vss}\ruledvss last line}\normalhss +%D \ruledvbox to 10ex +%D {\hsize.18\hsize +%D \type{\vfil}\ruledvfil last line}\normalhss +%D \ruledvbox to 10ex +%D {\hsize.18\hsize +%D \type{\vfill}\ruledvfill last line}\normalhss +%D \ruledvbox to 10ex +%D {\hsize.18\hsize +%D \type{\vfilneg}\ruledvfilneg last line}\normalhss +%D \ruledvbox to 10ex +%D {\hsize.18\hsize +%D \type{\vfillneg}\ruledvfillneg last line}} +%D \stoplinecorrection +%D +%D Keep in mind that \type{\vfillneg} is not part of \PLAIN\ +%D \TEX, but are mimmicked by a macro. + +\unexpanded\def\ruledvss {\doruledvfiller\normalvss \normalvfilneg {2}} +\unexpanded\def\ruledvfil {\doruledvfiller\normalvfil \normalvfilneg {-4}} +\unexpanded\def\ruledvfill {\doruledvfiller\normalvfill \normalvfillneg{-12}} +\unexpanded\def\ruledvfilneg {\doruledvfiller\normalvfilneg \normalvfil {8}} +\unexpanded\def\ruledvfillneg{\doruledvfiller\normalvfillneg\normalvfill {16}} + +%D \macros +%D {ruledhskip} +%D +%D Skips differ from kerns in two important aspects: +%D +%D \startitemize[packed] +%D \item line and pagebreaks are allowed at a skip +%D \item skips can have a positive and/or negative +%D stretchcomponent +%D \stopitemize +%D +%D Stated a bit different: kerns are fixed skips at which no +%D line or pagebreak can occur. Because skips have a more open +%D character, they are visualized in a open way. +%D +%D \startbuffer +%D one +%D \hskip +30pt plus 5pt +%D two +%D \hskip +30pt +%D \hskip -10pt plus 5pt +%D three +%D \hskip 0pt +%D four +%D \hskip +30pt +%D five +%D \stopbuffer +%D +%D \ShowBufferedExample +%D +%D When skips have a stretch component, this is visualized by +%D means of a dashed line. Positive skips are on top of the +%D baseline, negative ones are below it. This way we can show +%D the combined results. An alternative visualization of +%D stretch could be drawing the mid line over a length of the +%D stretch, in positive or negative direction. + +\def\doruledhskip + {\relax + \dontinterfere + \dontcomplain + \investigateskip\scratchskip + \ifzero + \setbox0\normalhbox + {\normalhskip-\testrulewidth + \visualvrule + \!!width4\testrulewidth + \!!height16\testrulewidth + \!!depth16\testrulewidth}% + \else + \setbox0\normalhbox to \ifnegative-\fi\scratchskip + {\visualvrule + \!!width2\testrulewidth + \ifnegative\!!depth\else\!!height\fi16\testrulewidth + \cleaders + \visualhrule + \ifnegative + \!!depth2\testrulewidth + \!!height\zeropoint + \else + \!!height2\testrulewidth + \!!depth\zeropoint + \fi + \normalhfill + \ifflexible + \normalhskip\ifnegative\else-\fi\scratchskip + \normalhskip2\testrulewidth + \cleaders + \normalhbox + {\normalhskip 2\testrulewidth + \visualvrule + \!!width2\testrulewidth + \!!height\ifnegative-7\else9\fi\testrulewidth + \!!depth\ifnegative9\else-7\fi\testrulewidth + \normalhskip 2\testrulewidth}% + \normalhfill + \fi + \visualvrule + \!!width2\testrulewidth + \ifnegative\!!depth\else\!!height\fi16\testrulewidth}% + \setbox0\normalhbox + {\ifnegative\else\normalhskip-\scratchskip\fi + \box0}% + \fi + \smashbox0% + \ifvisiblestretch \else + \flexiblefalse + \fi + \ifflexible + % breaks ok but small displacements can occur + \skip2\scratchskip + \advance\skip2 -1\scratchskip + \divide\skip2 2 + \advance\scratchskip -\skip2 + \normalhskip\scratchskip + \normalpenalty\!!tenthousand + \box0 + \normalhskip\skip2 + \else + \normalhskip\scratchskip + \box0 + \fi + \egroup} + +\unexpanded\def\ruledhskip + {\bgroup + \afterassignment\doruledhskip + \scratchskip=} + +%D The visual skip is located at a feasible point. Normally +%D this does not interfere with the normaltypesetting process. +%D The next examples show (1)~the default behavior, (2)~the +%D (not entirely correct) distributed stretch and (3)~the way +%D the text is typeset without cues. +%D +%D \startbuffer +%D \dorecurse +%D {15} +%D {test\hskip1em plus .5em minus .5em +%D test\hskip2em +%D test} +%D \stopbuffer +%D +%D \startlinecorrection +%D \showmakeup +%D \getbuffer +%D \stoplinecorrection +%D +%D \startlinecorrection +%D \showmakeup +%D \visiblestretchtrue +%D \getbuffer +%D \stoplinecorrection +%D +%D \startlinecorrection +%D \getbuffer +%D \stoplinecorrection + +%D \macros +%D {ruledvskip} +%D +%D We are less fortunate when implementing the vertical skips. +%D This is a direct result of interference between the boxes that +%D visualize the skip and skip removal at a pagebreak. Normally +%D skips disappear at the top of a page, but not of course when +%D visualized in a \type{\vbox}. A quite perfect simulation +%D could have been built if we would have had available two +%D more primitives: \type{\hnop} and \type{\vnop}. These new +%D primitives could stand for boxes that are visible but are +%D not taken into account in any way. They are there for us, +%D but not for \TEX. +%D +%D \startbuffer +%D first line +%D \vskip +30pt plus 5pt +%D second line +%D \vskip +30pt +%D \vskip -10pt plus 5pt +%D third line +%D \par +%D fourth line +%D \vskip +30pt +%D fifth line +%D \vskip 0pt +%D sixth line +%D \stopbuffer +%D +%D \ShowBufferedExample +%D +%D We have to postpone \type{\prevdepth}. Although this +%D precaution probably is not completely waterproof, it works +%D quite well. + +\def\dodoruledvskip + {\nextdepth\prevdepth + \dontinterfere + \dontcomplain + \normaloffinterlineskip + \investigateskip\scratchskip + \ifzero + \setbox0\normalvcue + {\visualvrule + \!!width32\testrulewidth + \!!height2\testrulewidth + \!!depth2\testrulewidth}% + \else + \setbox0\normalvbox to \ifnegative-\fi\scratchskip + {\visualhrule + \!!width16\testrulewidth + \!!height2\testrulewidth + \ifflexible + \cleaders + \normalhbox to 16\testrulewidth + {\normalhss + \normalvbox + {\normalvskip 2\testrulewidth + \visualhrule + \!!width2\testrulewidth + \!!height2\testrulewidth + \normalvskip 2\testrulewidth}% + \normalhss}% + \normalvfill + \else + \normalvfill + \fi + \visualhrule + \!!width16\testrulewidth + \!!height2\testrulewidth}% + \setbox2\normalvbox to \ht0 + {\visualhrule + \!!width2\testrulewidth + \!!height\ht0}% + \ifnegative + \ht0\zeropoint + \setbox0\normalhbox + {\normalhskip2\testrulewidth % will be improved + \normalhskip-\wd0\box0}% + \fi + \smashbox0% + \smashbox2% + \setbox0\normalvcue + {\box2\box0}% + \setbox0\normalvbox + {\ifnegative\normalvskip\scratchskip\fi\box0}% + \smashbox0% + \fi + \ifvisiblestretch + \ifflexible + \skip2\scratchskip + \advance\skip2 -1\scratchskip + \divide\skip2 2 + \advance\scratchskip -\skip2 + \normalvskip\skip2 + \fi + \fi + \normalpenalty\!!tenthousand + \box0 + \prevdepth\nextdepth % not \dp0=\nextdepth + \normalvskip\scratchskip} + +%D We try to avoid interfering at the top of a page. Of course +%D we only do so when we are in the main vertical list. + +\def\doruledvskip + {\endgraf % \par + \ifdim\pagegoal=\maxdimen + \ifinner + \dodoruledvskip + \fi + \else + \dodoruledvskip + \fi + \egroup} + +\unexpanded\def\ruledvskip + {\bgroup + \afterassignment\doruledvskip + \scratchskip=} + +%D \macros +%D {ruledkern} +%D +%D The macros that implement the kerns are a bit more +%D complicated than needed, because they also serve the +%D visualization of glue, our \PLAIN\ defined kerns with +%D stretch or shrink. We've implemented both horizontal and +%D vertical kerns as ruled boxes. +%D +%D \startbuffer +%D one +%D \kern +30pt +%D two +%D \kern +30pt +%D \kern -10pt +%D three +%D \kern 0pt +%D four +%D \kern +30pt +%D five +%D \stopbuffer +%D +%D \ShowBufferedExample +%D +%D Positive and negative kerns are placed on top or below the +%D baseline, so we are able to track their added result. We +%D didn't mention spacings of 0~pt yet. Zero values are +%D visualized a bit different, because we want to see them +%D anyhow. + +\def\doruledhkern + {\dontinterfere + \dontcomplain + \baselinerulefalse + \investigateskip\scratchskip + \boxrulewidth2\testrulewidth + \ifzero + \setbox0\ruledhbox to 8\testrulewidth + {\visualvrule + \!!width\zeropoint + \!!height16\testrulewidth + \!!depth16\testrulewidth}% + \setbox0\normalhbox + {\normalhskip-4\testrulewidth\box0}% + \else + \setbox0\ruledhbox to \ifnegative-\fi\scratchskip + {\visualvrule + \!!width\zeropoint + \ifnegative\!!depth\else\!!height\fi16\testrulewidth + \ifflexible + \normalhskip2\testrulewidth + \cleaders + \normalhbox + {\normalhskip 2\testrulewidth + \visualvrule + \!!width2\testrulewidth + \!!height\ifnegative-7\else9\fi\testrulewidth + \!!depth\ifnegative9\else-7\fi\testrulewidth + \normalhskip 2\testrulewidth}% + \normalhfill + \else + \normalhfill + \fi}% + \testrulewidth2\testrulewidth + \setbox0\ruledhbox{\box0}% \make... + \fi + \smashbox0% + \normalpenalty\!!tenthousand + \normalhbox to \zeropoint + {\ifnegative\normalhskip1\scratchskip\fi + \box0}% + \afterwards\scratchskip + \egroup} + +\unexpanded\def\ruledhkern#1% + {\bgroup + \let\afterwards#1% + \afterassignment\doruledhkern + \scratchskip=} + +%D After having seen the horizontal ones, the vertical kerns +%D will not surprise us. In this example we use \type{\par} to +%D switch to vertical mode. +%D +%D \startbuffer +%D first line +%D \par \kern +30pt +%D second line +%D \par \kern +30pt +%D \par \kern -10pt +%D third line +%D \par +%D fourth line +%D \par \kern +30pt +%D fifth line +%D \par \kern 0pt +%D sixth line +%D \stopbuffer +%D +%D \ShowBufferedExample +%D +%D Like before, we have to postpone \type{\prevdepth}. If we +%D leave out this trick, we got ourselves some wrong spacing. + +\def\dodoruledvkern + {\nextdepth\prevdepth + \dontinterfere + \dontcomplain + \baselinerulefalse + \normaloffinterlineskip + \investigateskip\scratchskip + \boxrulewidth2\testrulewidth + \ifzero + \setbox0\ruledhbox to 32\testrulewidth + {\visualvrule + \!!width\zeropoint + \!!height4\testrulewidth + \!!depth4\testrulewidth}% + \else + \setbox0\ruledvbox to \ifnegative-\fi\scratchskip + {\hsize16\testrulewidth + \ifflexible + \cleaders + \normalhbox to 16\testrulewidth + {\normalhss + \normalvbox + {\normalvskip 2\testrulewidth + \visualhrule + \!!width2\testrulewidth + \!!height2\testrulewidth + \normalvskip 2\testrulewidth}% + \normalhss}% + \normalvfill + \else + \visualvrule + \!!width\zeropoint + \!!height\ifnegative-\fi\scratchskip + \normalhfill + \fi} + \fi + \testrulewidth2\testrulewidth + \setbox0\ruledvbox{\box0}% \make... + \smashbox0% + \setbox0\normalvbox + {\ifnegative\normalvskip\scratchskip\fi + \normalvcue + {\ifnegative\normalhskip-16\testrulewidth\fi\box0}}% + \smashbox0% + \normalpenalty\!!tenthousand + \box0 + \prevdepth\nextdepth} % not \dp0=\nextdepth + +\def\doruledvkern + {\ifdim\pagegoal=\maxdimen + \ifinner + \dodoruledvkern + \fi + \else + \dodoruledvkern + \fi + \afterwards\scratchskip + \egroup} + +\unexpanded\def\ruledvkern#1% + {\bgroup + \let\afterwards#1\relax + \afterassignment\doruledvkern + \scratchskip=} + +\unexpanded\def\ruledkern + {\ifvmode + \expandafter\ruledvkern + \else + \expandafter\ruledhkern + \fi + \normalkern} + +%D A a bit more \TEX nice solution is: +%D +%D \starttyping +%D \unexpanded\def\ruledkern% +%D {\csname ruled\ifvmode v\else h\fi kern\endcsname\normalkern} +%D \stoptyping + +%D \macros +%D {ruledhglue,ruledvglue} +%D +%D The non-primitive glue commands are treated as kerns with +%D stretch. This stretch is presented as a dashed line. I +%D have to admit that until now, I've never used these glue +%D commands. +%D +%D \startbuffer +%D one +%D \hglue +30pt plus 5pt +%D two +%D \hglue +30pt +%D \hglue -10pt plus 5pt +%D three +%D \hglue 0pt +%D four +%D \hglue +30pt +%D five +%D \stopbuffer +%D +%D \ShowBufferedExample + +\def\doruledhglue + {\leavevmode + \scratchcounter\spacefactor + \visualvrule\!!width\zeropoint + \normalpenalty\!!tenthousand + \ruledhkern\normalhskip\scratchskip + \spacefactor\scratchcounter + \egroup} + +\unexpanded\def\ruledhglue + {\bgroup + \afterassignment\doruledhglue\scratchskip=} + +%D \startbuffer +%D first line +%D \vglue +30pt plus 5pt +%D second line +%D \vglue +30pt +%D \vglue -10pt plus 5pt +%D third line +%D \par +%D fourth line +%D \vglue +30pt +%D fifth line +%D \vglue 0pt +%D sixth line +%D \stopbuffer +%D +%D \ShowBufferedExample + +\def\doruledvglue + {\endgraf % \par + \nextdepth\prevdepth + \visualhrule\!!height\zeropoint + \normalpenalty\!!tenthousand + \ruledvkern\normalvskip\scratchskip + \prevdepth\nextdepth + \egroup} + +\unexpanded\def\ruledvglue + {\bgroup + \afterassignment\doruledvglue\scratchskip=} + +%D \macros +%D {ruledmkern,ruledmskip} +%D +%D Mathematical kerns and skips are specified in mu. This +%D font related unit is incompatible with those of \DIMENSIONS\ +%D and \SKIPS. Because in math mode spacing is often a very +%D subtle matter, we've used a very simple, not overloaded way +%D to show them. + +\def\dodoruledmkern#1% + {\dontinterfere + \dontcomplain + \setbox0\normalhbox + {$\normalmkern\ifnegative-\fi\scratchmuskip$}% + \setbox0\normalhbox to \wd0 + {\visualvrule + \!!height16\testrulewidth + \!!depth16\testrulewidth + \!!width\testrulewidth + \leaders + \visualhrule + \!!height\ifpositive16\else-14\fi\testrulewidth + \!!depth\ifpositive-14\else16\fi\testrulewidth + \normalhfill + \ifflexible + \normalhskip-\wd0 + \leaders + \visualhrule + \!!height\testrulewidth + \!!depth\testrulewidth + \normalhfill + \fi + \visualvrule + \!!height16\testrulewidth + \!!depth16\testrulewidth + \!!width\testrulewidth}% + \smashbox0% + \ifnegative + #1\scratchmuskip + \box0 + \else + \box0 + #1\scratchmuskip + \fi + \egroup} + +%D \startbuffer +%D $a \mkern3mu = \mkern3mu +%D b \quad +%D \mkern-2mu + \mkern-2mu +%D \quad c$ +%D \stopbuffer +%D +%D \ShowBufferedExample + +\def\doruledmkern + {\investigatemuskip\scratchmuskip + \flexiblefalse + \dodoruledmkern\normalmkern} + +\unexpanded\def\ruledmkern + {\bgroup + \afterassignment\doruledmkern\scratchmuskip=} + +%D \startbuffer +%D $a \mskip3mu = \mskip3mu +%D b \quad +%D \mskip-2mu + \mskip-2mu +%D \quad c$ +%D \stopbuffer +%D +%D \ShowBufferedExample + +\def\doruledmskip + {\investigatemuskip\scratchmuskip + \flexibletrue + \dodoruledmkern\normalmskip} + +\unexpanded\def\ruledmskip + {\bgroup + \afterassignment\doruledmskip\scratchmuskip=} + +%D \macros +%D {penalty} +%D +%D After presenting fills, skip, kerns and glue we've come to +%D see penalties. In the first implementation --- most of the +%D time needed to develop this set of macros went into testing +%D different types of visualization --- penalties were mere +%D small blocks with one black half, depending on the sign. +%D This most recent version also gives an indication of the +%D amount of penalty. Penalties can go from less than $-10000$ +%D to over $+10000$, and their behavior is somewhat +%D non-lineair, with some values having special meanings. We +%D therefore decided not to use its value for a lineair +%D indicator. +%D +%D \startbuffer +%D one +%D \penalty +100 +%D two +%D \penalty +100 +%D \penalty -100 +%D three +%D \penalty 0 +%D four +%D \penalty +100 +%D five +%D \stopbuffer +%D +%D \ShowBufferedExample +%D +%D The small sticks at the side of the penalty indicate it +%D size. The next example shows the positive and negative +%D penalties of 0, 1, 10, 100, 1000 and 10000. +%D +%D \startlinecorrection +%D \hbox +%D {test \ruledhpenalty0 +%D test \ruledhpenalty1 +%D test \ruledhpenalty10 +%D test \ruledhpenalty100 +%D test \ruledhpenalty1000 +%D test \ruledhpenalty10000 +%D test} +%D \stoplinecorrection +%D +%D \blank +%D +%D \startlinecorrection +%D \hbox +%D {test \ruledhpenalty0 +%D test \ruledhpenalty-1 +%D test \ruledhpenalty-10 +%D test \ruledhpenalty-100 +%D test \ruledhpenalty-1000 +%D test \ruledhpenalty-10000 +%D test} +%D \stoplinecorrection +%D +%D \blank +%D +%D This way stacked penalties of different severance can be +%D shown in combination. +%D +%D test \ruledhpenalty10 \ruledhpenalty100 +%D test +%D test \ruledhpenalty1000 \ruledhpenalty-1000 +%D test + +\def\setruledpenaltybox#1#2#3#4#5#6% + {\setbox#1\normalhbox + {\ifnum#2=0 \else + \edef\sign + {\ifnum#2>0 +\else-\fi}% + \dimen0=\ifnum\sign#2>9999 + 28\else + \ifnum\sign#2>999 + 22\else + \ifnum\sign#2>99 + 16\else + \ifnum\sign#2>9 + 10\else + 4 + \fi\fi\fi\fi \testrulewidth + \ifnum#2<0 + \normalhskip-\dimen0 + \normalhskip-2\testrulewidth + \visualvrule + \!!width2\testrulewidth + \!!height#3\testrulewidth + \!!depth#4\testrulewidth + \fi + \visualvrule + \!!width\dimen0 + \!!height#5\testrulewidth + \!!depth#6\testrulewidth + \ifnum#2>0 + \visualvrule + \!!width2\testrulewidth + \!!height#3\testrulewidth + \!!depth#4\testrulewidth + \fi + \fi}% + \smashbox#1} + +\def\doruledhpenalty + {\dontinterfere + \dontcomplain + \investigatecount\scratchcounter + \testrulewidth2\testrulewidth + \boxrulewidth\testrulewidth + \setbox0\ruledhbox to 8\testrulewidth + {\ifnegative\else\normalhss\fi + \visualvrule + \!!depth8\testrulewidth + \!!width\ifzero0\else4\fi\testrulewidth + \ifpositive\else\normalhss\fi}% + \setruledpenaltybox{2}{\scratchcounter}{0}{8}{-3.5}{4.5}% + \normalpenalty\!!tenthousand + \setbox0\normalhbox + {\normalhskip-4\testrulewidth + \ifnegative + \box2\box0 + \else + \box0\box2 + \fi}% + \smashbox0% + \box0 + \normalpenalty\scratchcounter + \egroup} + +\unexpanded\def\ruledhpenalty + {\bgroup + \afterassignment\doruledhpenalty + \scratchcounter=} + +%D The size of a vertical penalty is also shown on the +%D horizontal axis. This way there is less interference with +%D the often preceding or following skips and kerns. +%D +%D \startbuffer +%D first line +%D \par \penalty +100 +%D second line +%D \par \penalty +100 +%D \par \penalty -100 +%D third line +%D \par \penalty 0 +%D fourth line +%D \par \penalty +100 +%D fifth line +%D \stopbuffer +%D +%D \ShowBufferedExample + +\def\doruledvpenalty + {\ifdim\pagegoal=\maxdimen + \else + \nextdepth\prevdepth + \dontinterfere + \dontcomplain + \investigatecount\scratchcounter + \testrulewidth2\testrulewidth + \boxrulewidth\testrulewidth + \setbox0\ruledhbox + {\visualvrule + \!!height4\testrulewidth + \!!depth4\testrulewidth + \!!width\zeropoint + \visualvrule + \!!height\ifnegative.5\else4\fi\testrulewidth + \!!depth\ifpositive.5\else4\fi\testrulewidth + \!!width8\testrulewidth}% + \setruledpenaltybox{2}{\scratchcounter}{4}{4}{.5}{.5}% + \setbox0\normalhbox + {\normalhskip-4\testrulewidth + \ifnegative + \box2\box0 + \else + \box0\box2 + \fi + \normalhss}% + \smashbox0% + \normalpenalty\!!tenthousand + \nointerlineskip + \dp0\nextdepth % not \prevdepth=\nextdepth + \normalvbox + {\normalvcue{\box0}}% + \fi + \normalpenalty\scratchcounter + \egroup} + +\unexpanded\def\ruledvpenalty + {\bgroup + \afterassignment\doruledvpenalty + \scratchcounter=} + +\unexpanded\def\ruledpenalty + {\ifvmode + \expandafter\ruledvpenalty + \else + \expandafter\ruledhpenalty + \fi} + +%D At the cost of some more tokens, a bit more clever +%D implementation would be: +%D +%D \starttyping +%D \unexpanded\def\ruledpenalty% +%D {\csname ruled\ifvmode v\else h\fi penalty\endcsname} +%D \stoptyping + +%D \macros +%D {showfils,dontshowfils, +%D showboxes,dontshowboxes, +%D showskips,dontshowskips, +%D showpenalties,dontshowpenalties} +%D +%D For those who want to manipulate the visual cues in detail, +%D we have grouped them. + +\newif\ifshowingcomposition % see later why we need this + +\def\showfils + {\showingcompositiontrue + \let\hss \ruledhss + \let\hfil \ruledhfil + \let\hfill \ruledhfill + \let\hfilneg \ruledhfilneg + \let\hfillneg \ruledhfillneg + \let\vss \ruledvss + \let\vfil \ruledvfil + \let\vfill \ruledvfill + \let\vfilneg \ruledvfilneg + \let\vfillneg \ruledvfillneg} + +\def\dontshowfils + {\let\hss \normalhss + \let\hfil \normalhfil + \let\hfill \normalhfill + \let\hfilneg \normalhfilneg + \let\hfillneg \normalhfillneg + \let\vss \normalvss + \let\vfil \normalvfil + \let\vfill \normalvfill + \let\vfilneg \normalvfilneg + \let\vfillneg \normalvfillneg} + +\def\showboxes + {\showingcompositiontrue + \baselineruletrue + \let\hbox \ruledhbox + \let\vbox \ruledvbox + \let\vtop \ruledvtop + \let\vcenter \ruledvcenter} + +\def\dontshowboxes + {\let\hbox \normalhbox + \let\vbox \normalvbox + \let\vtop \normalvtop + \let\vcenter \normalvcenter} + +\def\showskips + {\showingcompositiontrue + \let\hskip \ruledhskip + \let\vskip \ruledvskip + \let\kern \ruledkern + \let\mskip \ruledmskip + \let\mkern \ruledmkern + \let\hglue \ruledhglue + \let\vglue \ruledvglue} + +\def\dontshowskips + {\let\hskip \normalhskip + \let\vskip \normalvskip + \let\kern \normalkern + \let\mskip \normalmskip + \let\mkern \normalmkern + \let\hglue \normalhglue + \let\vglue \normalvglue} + +\def\showpenalties + {\showingcompositiontrue + \let\penalty \ruledpenalty} + +\def\dontshowpenalties + {\let\penalty \normalpenalty} + +%D \macros +%D {showcomposition,dontshowcomposition, +%D showingcomposition} +%D +%D All these nice options come together in three macros. One +%D for turning the options on, one for turning them off, and a +%D boolean for enabling the mechanism outside the scope of the +%D user. The first two macros only do their job when we are +%D actually showing the composition. +%D +%D \starttyping +%D \showingcompositiontrue +%D \showcomposition +%D \stoptyping +%D +%D Because the output routine can do tricky things, like +%D multiple column typesetting and manipulation of the +%D pagebody, shifting things around and so on, the macro +%D \type{\dontshowcomposition} best can be called when we enter +%D this routine. Too much visual cues just don't make sense. In +%D \CONTEXT\ this has been taken care of. + +\newif\ifshowingcomposition + +\def\showcomposition + {\ifshowingcomposition + \showfils + \showboxes + \showskips + \showpenalties + \fi} + +\def\dontshowcomposition + {\ifshowingcomposition + \dontshowfils + \dontshowboxes + \dontshowskips + \dontshowpenalties + \fi} + +%D \macros +%D {showmakeup, +%D defaulttestrulewidth} +%D +%D Just to make things even more easy, we have defined: +%D +%D \starttyping +%D \showmakeup +%D \stoptyping +%D +%D For the sake of those who don't (yet) use \CONTEXT\ we +%D preset \type{\defaulttestrulewidth} to the already set +%D value. Otherwise we default to a bodyfontsize related value. +%D +%D \starttyping +%D \def\defaulttestrulewidth{.2pt} +%D \stoptyping +%D +%D Beware, it's a macro not a \DIMENSION. + +\ifx\bodyfontsize\undefined + \edef\defaulttestrulewidth{\the\testrulewidth} +\else + \def\defaulttestrulewidth{.02\bodyfontsize} +\fi + +\def\showmakeup + {\testrulewidth\defaulttestrulewidth + \showingcompositiontrue + \showcomposition} + +\protect + +%D \ifCONTEXT \let\next=\relax \else \let\next=\endinput +%D The documented source you have been reading was processed +%D using some surrogate makeup. When this file is processed +%D in \CONTEXT, a few more examples show up here, like a local +%D table of contents and a local register. +%D \fi \next + +%D Lets end with some more advanced examples. +%D Definitions and enumerations come in many flavors. The +%D next one for instance is defined as: +%D +%D \starttyping +%D \definedescription[test][place=left,hang=3,width=6em] +%D \stoptyping +%D +%D When applied to some text, this would look like: +%D +%D \bgroup +%D \showmakeup +%D \definedescription[test][location=left,hang=3,width=6em] +%D +%D \test{visual\\debugger} I would be very pleased if \TEX\ +%D had two more primitives: \type{\vnop} and \type{\hnop}. Both +%D should act and show up as normal boxes, but stay invisible +%D for \TEX\ when it's doing calculations. The \type{\vnop} +%D for instance should not interact with the internal mechanism +%D responsible for the disappearing skips, kerns and penalties +%D at a pagebreak. As long as we don't have these two boxtypes, +%D visual debugging will never be perfect. +%D +%D \egroup +%D +%D The index to this section looks like: +%D +%D {\setupreferencing[prefixprefix=dummy]\showmakeup\placeindex[criterium=local]} +%D +%D Although not impressive examples or typesetting, both +%D show us how and where things happen. When somehow the last +%D lines in this two column index don't allign, then this is +%D due to some still unknown interference. + +\endinput diff --git a/Master/texmf-dist/tex/context/base/supp-vis.tex b/Master/texmf-dist/tex/context/base/supp-vis.tex deleted file mode 100644 index f38c8e1e353..00000000000 --- a/Master/texmf-dist/tex/context/base/supp-vis.tex +++ /dev/null @@ -1,1907 +0,0 @@ -%D \module -%D [ file=supp-vis, -%D version=1996.10.21, -%D title=\CONTEXT\ Support Macros, -%D subtitle=Visualization, -%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. - -% no longer generic, who cares ... - -%D \gdef\ShowBufferedExample% private typeseting macro -%D {\startlinecorrection -%D \bgroup -%D \setuptyping[margin=0pt,option=color] -%D \showmakeup -%D \centeredvcuetrue -%D \dontinterfere -%D \baselinerulefalse -%D \normalvbox -%D {\normalhbox to \hsize -%D {$\hsize=.5\hsize -%D \advance\hsize by -.5em -%D \normalvcenter{\vbox{\getbuffer}}\normalhss -%D \normalvcenter{\vbox{\dontshowcomposition\typebuffer}}$}} -%D \egroup -%D \stoplinecorrection} -%D -%D \gdef\ShowBufferedExampleBox% private typeseting macro -%D {\startlinecorrection -%D \bgroup -%D \setuptyping[margin=0pt,option=color] -%D \showmakeup -%D \centeredvcuetrue -%D \dontinterfere -%D \baselinerulefalse -%D \normalvbox -%D {\normalhbox to \hsize -%D {$\hsize=.5\hsize -%D \advance\hsize by -.5em -%D \normalvcenter{\baselineruletrue\vbox{\getbuffer}}\normalhss -%D \normalvcenter{\vbox{\dontshowcomposition\typebuffer}}$}} -%D \egroup -%D \stoplinecorrection} - -%D Although an integral part of \CONTEXT, this module is one -%D of the support modules. Its stand alone character permits -%D use in \PLAIN\ \TEX\ or \TEX\ based macropackages. -%D \ifCONTEXT \else If in some examples the verbatim listings -%D don't show up nice, this is due to processing by a system -%D that does not support buffering. In \CONTEXT\ we show the -%D commands in the margin, use bit more advanced way of -%D numbering, and typeset the source in \TEX nicolored -%D verbatim. Sorry for this inconvenience.\fi -%D -%D Depending on my personal needs and those of whoever uses it, -%D the macros will be improved in terms of visualization, -%D efficiency and compatibility. These rather low level -%D visualization macros are supplemented by ones that can -%D visualize baselines, the page layout and whatever deserves -%D attention. Most of those macros can be found in \type -%D {core-vis} and other core modules. Their integration in -%D \CONTEXT\ prohibits generic applications. - -\ifx \undefined \writestatus \input supp-mis.tex \fi - -%D One of the strong points of \TEX\ is abstraction of textual -%D input. When macros are defined well and do what we -%D want them to do, we will seldom need the tools present in -%D What You See Is What You Get systems. For instance, when -%D entering text we don't need rulers, because no manual -%D shifting and/or alignment of text is needed. On the other -%D hand, when we are designing macros or specifying layout -%D elements, some insight in \TEX's advanced spacing, kerning, -%D filling, boxing and punishment abilities will be handy. -%D That's why we've implemented a mechanism that shows some of -%D the inner secrets of \TEX. - -\writestatus{loading}{ConTeXt Support Macros / Visualization} - -%D In this module we are going to redefine some \TEX\ -%D primitives and \PLAIN\ macro's. Their original meaning is -%D saved in macros with corresponding names, preceded by -%D \type{normal}. These original macros are (1)~used to -%D temporary restore the old values when needed and -%D (2)~used to prevent recursive calls in the macros that -%D replace them. - -\unprotect - -\let\visualvrule\vrule -\let\visualhrule\hrule - -%D \macros -%D {dontinterfere} -%D -%D Indentation, left and/or right skips, redefinition of -%D \type{\par} and assignments to \type{\everypar} can lead to -%D unwanted results. We can therefore turn all those things -%D off with \type{\dontinterfere}. - -\def\dontinterfere - {\everypar \emptytoks - \let\par \endgraf - \parindent\zeropoint - \parskip \zeropoint - \leftskip \zeropoint - \rightskip\zeropoint - \relax} - -%D \macros -%D {dontcomplain} -%D -%D In this module we do a lot of box manipulations. Because we -%D don't want to be confronted with to many over- and underfull -%D messages we introduce \type{\dontcomplain}. - -\def\dontcomplain - {\hbadness\!!tenthousand \vbadness\hbadness - \hfuzz \maxdimen \vfuzz \hfuzz} - -% This obsolete dutch name is sometimes uses in manual styles; when -% cleaning up the codebase I decided to move this definition here. - -\let\mindermeldingen\dontcomplain - -%D \macros -%D {normaloffinterlineskip} -%D -%D The next hack is needed because in \CONTEXT\ we redefine -%D \type{\offinterlineskip}. - -\ifx\undefined\normaloffinterlineskip - \let\normaloffinterlineskip\offinterlineskip -\fi - -%D \macros -%D {normalhbox, -%D normalvbox,normalvtop} -%D -%D There are three types of boxes, one horizontal and two -%D vertical in nature. As we will see later on, all three types -%D are to be handled according to their orientation and -%D baseline behavior. Especially \type{\vtop}'s need our -%D special attention. - -% already saved - -%D \macros -%D {normalhskip, -%D normalvskip} -%D -%D Next come the flexible skips, which come in two flavors -%D too. Like boxes these are handled with \TEX\ primitives. - -% already saved - -%D \macros -%D {normalpenalty, -%D normalkern} -%D -%D Both penalties and kerns are taken care of by mode sensitive -%D primitives. This means that when making them visible, we -%D have to take the current mode into account. - -% already saved - -%D \macros -%D {normalhglue, -%D normalvglue} -%D -%D Glues on the other hand are macro's defined in \PLAIN\ \TEX. -%D As we will see, their definitions make the implementation of -%D their visible counterparts a bit more \TeX{}nical. - -\let\normalhglue = \hglue -\let\normalvglue = \vglue - -%D \macros -%D {normalmkern, -%D normalmskip} -%D -%D Math mode has its own spacing primitives, preceded by -%D \type{m}. Due to the relation with the current font and the -%D way math is typeset, their unit \type{mu} is not compatible -%D with other dimensions. As a result, the visual appearance -%D of these primitives is kept primitive too. - -% already saved - -%D \macros -%D {hfilneg, -%D vfilneg} -%D -%D Fills can be made visible quite easy. We only need some -%D additional negation macros. Because \PLAIN\ \TEX\ only -%D offers \type{\hfilneg} and \type{\vfilneg}, we define our -%D own alternative double \type{ll}'ed ones. - -\def\hfilneg {\normalhskip\zeropoint \!!plus-1fil\relax} -\def\vfilneg {\normalvskip\zeropoint \!!plus-1fil\relax} -\def\hfillneg {\normalhskip\zeropoint \!!plus-1fill\relax} -\def\vfillneg {\normalvskip\zeropoint \!!plus-1fill\relax} -\def\hfilllneg{\normalhskip\zeropoint \!!plus-1filll\relax} -\def\vfilllneg{\normalvskip\zeropoint \!!plus-1filll\relax} - -%D \macros -%D {normalhss,normalhfil,normalhfill, -%D normalvss,normalvfil,normalvfill} -%D -%D The positive stretch primitives are used independant and in -%D combination with \type{\leaders}. - -% already saved - -%D \macros -%D {normalhfilneg,normalhfillneg, -%D normalvfilneg,normalvfillneg} -%D -%D Keep in mind that both \type{\hfillneg} and \type{\vfillneg} -%D are not part of \PLAIN\ \TEX\ and therefore not documented -%D in standard \TEX\ documentation. They can nevertheless be -%D used at will. - -\let\normalhfillneg = \hfillneg -\let\normalvfillneg = \vfillneg - -%D Visualization is not always wanted. Instead of turning this -%D option off in those (unpredictable) situations, we just -%D redefine a few \PLAIN\ macros. - -\ifx\tlap\undefined - - \def\rlap#1{\normalhbox to \zeropoint{#1\normalhss}} - \def\llap#1{\normalhbox to \zeropoint{\normalhss#1}} - \def\blap#1{\normalvbox to \zeropoint{#1\normalvss}} - \def\tlap#1{\normalvbox to \zeropoint{\normalvss#1}} - -\fi - -\ifx\contextversion\undefined \def~{\normalpenalty\!!tenthousand\ } \fi - -%D \macros -%D {makeruledbox} -%D -%D Ruled boxes can be typeset is many ways. Here we present -%D just one alternative. This implementation may be a little -%D complicated, but it supports all three kind of boxes. The -%D next command expects a \BOX\ specification, like: -%D -%D \starttyping -%D \makeruledbox0 -%D \stoptyping - -%D \macros -%D {baselinerule,baselinefill} -%D -%D We can make the baseline of a box visible, both dashed and -%D as a rule. The line is drawn on top of the baseline. All -%D we have to say is: -%D -%D \starttyping -%D \baselineruletrue -%D \baselinefilltrue -%D \stoptyping -%D -%D At the cost of some overhead these alternatives are -%D implemented using \type{\if}'s: - -\newif\ifbaselinerule \baselineruletrue -\newif\ifbaselinefill \baselinefillfalse - -%D \macros -%D {iftoprule,ifbottomrule,ifleftrule,ifrightrule} -%D -%D Rules can be turned on and off, but by default we have: -%D -%D \starttyping -%D \topruletrue -%D \bottomruletrue -%D \leftruletrue -%D \rightruletrue -%D \stoptyping -%D -%D As we see below: - -\newif\iftoprule \topruletrue -\newif\ifbottomrule \bottomruletrue -\newif\ifleftrule \leftruletrue -\newif\ifrightrule \rightruletrue - -%D \macros -%D {boxrulewidth} -%D -%D The width in the surrounding rules can be specified by -%D assigning an apropriate value to the dimension used. This -%D module defaults the width to: -%D -%D \starttyping -%D \boxrulewidth=.2pt -%D \stoptyping -%D -%D Although we are already low on \DIMENSIONS\ it's best to -%D spend one here, mainly because it enables easy manipulation, -%D like multiplication by a given factor. - -\newdimen\boxrulewidth \boxrulewidth=.2pt - -%D The core macro \type{\makeruledbox} looks a bit hefty. The -%D manipulation at the end is needed because we want to -%D preserve both the mode and the baseline. This means that -%D \type{\vtop}'s and \type{\vbox}'es behave the way we expect -%D them to do. -%D -%D \startlinecorrection -%D \hbox -%D {\ruledhbox to 5em{\strut test\normalhss}\hskip1em -%D \ruledvbox{\hsize 5em\strut test \par test\strut}\hskip1em -%D \ruledvtop{\hsize 5em\strut test \par test\strut}} -%D \stoplinecorrection -%D -%D The \type{\cleaders} part of the macro is responsible for -%D the visual baseline. The \type{\normalhfill} belongs to this -%D primitive too. By storing and restoring the height and depth -%D of box \type{#1}, we preserve the mode. - -\let\dowithruledbox\relax - -\let\ruledheight\!!zeropoint -\let\ruleddepth \!!zeropoint -\let\ruledwidth \!!zeropoint - -\def\makeruledbox#1% - {\edef\ruledheight{\the\ht#1}% - \edef\ruleddepth {\the\dp#1}% - \edef\ruledwidth {\the\wd#1}% - \setbox\scratchbox\normalvbox - {\dontcomplain - \normaloffinterlineskip - \visualhrule - \!!height\boxrulewidth - \iftoprule\else\!!width\zeropoint\fi - \normalvskip-\boxrulewidth - \normalhbox to \ruledwidth - {\visualvrule - \!!height\ruledheight - \!!depth\ruleddepth - \!!width\ifleftrule\else0\fi\boxrulewidth - \ifdim\ruledheight>\zeropoint \else \baselinerulefalse \fi - \ifdim\ruleddepth>\zeropoint \else \baselinerulefalse \fi - \ifbaselinerule - \ifdim\ruledwidth<20\boxrulewidth - \baselinefilltrue - \fi - \cleaders - \ifbaselinefill - \visualhrule - \!!height\boxrulewidth - \else - \normalhbox - {\normalhskip2.5\boxrulewidth - \visualvrule - \!!height\boxrulewidth - \!!width5\boxrulewidth - \normalhskip2.5\boxrulewidth}% - \fi - \fi - \normalhfill - \visualvrule - \!!width\ifrightrule\else0\fi\boxrulewidth}% - \normalvskip-\boxrulewidth - \visualhrule - \!!height\boxrulewidth - \ifbottomrule\else\!!width\zeropoint\fi}% - \wd#1\zeropoint - \setbox#1=\ifhbox#1\normalhbox\else\normalvbox\fi - {\normalhbox - {\box#1% - \lower\ruleddepth\normalhbox{\dowithruledbox{\box\scratchbox}}}}% - \ht#1=\ruledheight - \wd#1=\ruledwidth - \dp#1=\ruleddepth} - -%D Just in case one didn't notice: the rules are in fact layed -%D over the box. This way the contents of a box cannot -%D visually interfere with the rules around (upon) it. A more -%D advanced version of ruled boxes can be found in one of the -%D core modules of \CONTEXT. There we take offsets, color, -%D rounded corners, backgrounds and alignment into account too. - -%D \macros -%D {ruledhbox, -%D ruledvbox,ruledvtop, -%D ruledvcenter} -%D -%D These macro's can be used instead of \type{\hbox}, -%D \type{\vbox}, \type{\vtop} and, when in math mode, -%D \type{\vcenter}. They just do what their names state. Using -%D an auxiliary macro would save us a few words of memory, but -%D it would make their appearance even more obscure. -%D -%D \startbuffer -%D \hbox -%D {\strut -%D one -%D two -%D \hbox{three} -%D four -%D five} -%D \stopbuffer -%D -%D \ShowBufferedExampleBox - -\unexpanded\def\ruledhbox - {\normalhbox\bgroup - \dowithnextbox{\makeruledbox\nextbox\box\nextbox\egroup}% - \normalhbox} - -%D \startbuffer -%D \vbox -%D {\strut -%D first line \par -%D second line \par -%D third line \par -%D fourth line \par -%D fifth line -%D \strut } -%D \stopbuffer -%D -%D \ShowBufferedExampleBox - -\unexpanded\def\ruledvbox - {\normalvbox\bgroup - \dowithnextbox{\makeruledbox\nextbox\box\nextbox\egroup}% - \normalvbox} - -%D \startbuffer -%D \vtop -%D {\strut -%D first line \par -%D second line \par -%D third line \par -%D fourth line \par -%D fifth line -%D \strut } -%D \stopbuffer -%D -%D \ShowBufferedExampleBox - -\unexpanded\def\ruledvtop - {\normalvtop\bgroup - \dowithnextbox{\makeruledbox\nextbox\box\nextbox\egroup}% - \normalvtop} - -%D \startbuffer -%D \hbox -%D {$\vcenter{\hsize.2\hsize -%D alfa \par beta}$ -%D $\vcenter to 3cm{\hsize.2\hsize -%D alfa \par beta \par gamma}$ -%D $\vcenter{\hsize.2\hsize -%D alfa \par beta}$} -%D \stopbuffer -%D -%D \ShowBufferedExampleBox - -\unexpanded\def\ruledvcenter - {\normalvbox\bgroup - \dontinterfere - \dowithnextbox - {\scratchdimen.5\ht\nextbox - \advance\scratchdimen .5\dp\nextbox - \ht\nextbox\scratchdimen - \dp\nextbox\scratchdimen - \ruledhbox{\box\nextbox}% - \egroup}% - \normalvbox} - -%D \macros -%D {ruledbox, -%D setruledbox} -%D -%D Of the next two macros the first can be used to precede a -%D box of ones own choice. One can for instance prefix boxes -%D with \type{\ruledbox} and afterwards --- when the macro -%D satisfy the needs --- let it to \type{\relax}. -%D -%D \starttyping -%D \ruledbox\hbox{What rules do you mean?} -%D \stoptyping -%D -%D The macro \type{\setruledbox} can be used to directly -%D rule a box. -%D -%D \starttyping -%D \setruledbox12=\hbox{Who's talking about rules here?} -%D \stoptyping -%D -%D At the cost of some extra macros we can implement a -%D variant that does not need the~\type{=}, but we stick to: - -\unexpanded\def\ruledbox - {\dowithnextbox{\makeruledbox\nextbox\box\nextbox}} - -\def\setruledbox#1=% - {\dowithnextbox{\makeruledbox\nextbox\setbox#1\nextbox}} - -%D \macros -%D {investigateskip, -%D investigatecount, -%D investigatemuskip} -%D -%D Before we meet the visualizing macro's, we first implement -%D ourselves some handy utility ones. Just for the sake of -%D efficiency and readability, we introduce some status -%D variables, that tell us a bit more about the registers we -%D use: -%D -%D \starttyping -%D \ifflexible -%D \ifzero -%D \ifnegative -%D \ifpositive -%D \stoptyping -%D -%D These status variables are set when we call for one of the -%D investigation macros, e.g. -%D -%D \starttyping -%D \investigateskip\scratchskip -%D \stoptyping -%D -%D We use some dirty trick to check stretchability of \SKIPS. -%D Users of these macros are invited to study their exact -%D behavior first. The positive and negative states both -%D include zero and are in fact non-negative ($\geq0$) and -%D non-positive ($\leq0$) . - -\newif\ifflexible -\newif\ifzero -\newif\ifnegative -\newif\ifpositive - -\def\investigateskip#1% - {\relax - \scratchdimen#1\relax - \edef\!!stringa{\the\scratchdimen}% - \edef\!!stringb{\the#1}% - \ifx\!!stringa\!!stringb \flexiblefalse \else \flexibletrue \fi - \ifdim#1=\zeropoint\relax - \zerotrue \else - \zerofalse \fi - \ifdim#1<\zeropoint\relax - \positivefalse \else - \positivetrue \fi - \ifdim#1>\zeropoint\relax - \negativefalse \else - \negativetrue \fi} - -% etex -% -% \def\investigateskip#1% -% {\relax -% \ifdim\scratchskip=\zeropoint -% \ifdim\gluestretch\scratchskip=\zeropoint -% \ifdim\glueshrink\scratchskip=\zeropoint -% \flexiblefalse -% \else -% \flexibletrue -% \fi -% \else -% \flexibletrue -% \fi -% \else -% \flexibletrue -% \fi -% \ifdim#1=\zeropoint\relax -% \zerotrue \else -% \zerofalse \fi -% \ifdim#1<\zeropoint\relax -% \positivefalse \else -% \positivetrue \fi -% \ifdim#1>\zeropoint\relax -% \negativefalse \else -% \negativetrue \fi} - -\def\investigatecount#1% - {\relax - \flexiblefalse - \ifnum#1=\zerocount - \zerotrue \else - \zerofalse \fi - \ifnum#1<\zerocount - \positivefalse \else - \positivetrue \fi - \ifnum#1>\zerocount - \negativefalse \else - \negativetrue \fi} - -\def\investigatemuskip#1% - {\relax - \edef\!!stringa{\the\scratchmuskip}% - \edef\!!stringb{0mu}% - \def\!!stringc##1##2\\{##1}% - \expandafter\edef\expandafter\!!stringc\expandafter - {\expandafter\!!stringc\!!stringa\\}% - \edef\!!stringd{-}% - \flexiblefalse - \ifx\!!stringa\!!stringb - \zerotrue - \negativefalse - \positivefalse - \else - \zerofalse - \ifx\!!stringc\!!stringd - \positivefalse - \negativetrue - \else - \positivetrue - \negativefalse - \fi - \fi} - -%D Now the neccessary utility macros are defined, we can make a -%D start with the visualizing ones. The implementation of these -%D macros is a compromise between readability, efficiency of -%D coding and processing speed. Sometimes we do in steps what -%D could have been done in combination, sometimes we use a few -%D boxes more or less then actually needed, and more than once -%D one can find the same piece of rule drawing code twice. - -%D \macros -%D {ifcenteredvcue,normalvcue} -%D -%D Depending on the context, one can force visual vertical cues -%D being centered along \type{\hsize} or being put at the -%D current position. Although centering often looks better, -%D we've chosen the second alternative as default. The main -%D reason for doing so is that often when we don't set the -%D \type{\hsize} ourselves, \TEX\ takes the value of the -%D surrounding box. As a result the visual cues can migrate -%D outside the current context. -%D -%D This behavior is accomplished by a small but effective -%D auxiliary macro, which behavior can be influenced by the -%D boolean \type{\centeredvcue}. By saying -%D -%D \starttyping -%D \centeredvcuetrue -%D \stoptyping -%D -%D one turns centering on. As said, we turn it off. - -\newif\ifcenteredvcue \centeredvcuefalse - -\def\normalvcue#1% - {\normalhbox \ifcenteredvcue to \hsize \fi {\normalhss#1\normalhss}} - -%D We could have used the more robust version -%D -%D \starttyping -%D \def\normalvcue% -%D {\normalhbox \ifcenteredvcue to \hsize \fi -%D \bgroup\bgroup\normalhss -%D \aftergroup\normalhss\aftergroup\egroup -%D \let\next=} -%D \stoptyping -%D -%D or the probably best one: -%D -%D \starttyping -%D \def\normalvcue% -%D {\hbox \ifcenteredvcue to \hsize -%D \bgroup\bgroup\normalhss -%D \aftergroup\normalhss\aftergroup\egroup -%D \else -%D \bgroup -%D \fi -%D \let\next=} -%D \stoptyping -%D -%D Because we don't have to preserve \CATCODES\ and only use -%D small arguments, we stick to the first alternative. - -%D \macros -%D {testrulewidth} -%D -%D We build our visual cues out of rules. At the cost of a much -%D bigger \DVI\ file, this is to be prefered over using -%D characters (1)~because we cannot be sure of their -%D availability and (2)~because their dimensions are fixed. -%D -%D As with ruled boxes, we use a \DIMENSION\ to specify the -%D width of the ruled elements. This dimension defaults to: -%D -%D \starttyping -%D \testrulewidth=\boxrulewidth -%D \stoptyping -%D -%D Because we prefer whole numbers for specifying the -%D dimensions, we often use even multiples of -%D \type{\testrulewidth}. - -%D \macros -%D {visiblestretch} -%D -%D A second variable is introduced because of the stretch -%D components of \SKIPS. At the cost of some accuracy we can -%D make this stretch visible. -%D -%D \starttyping -%D \visiblestretchtrue -%D \stoptyping - -\newdimen\testrulewidth \testrulewidth=\boxrulewidth -\newif\ifvisiblestretch \visiblestretchfalse - -%D \macros -%D {ruledhss, -%D ruledhfil,ruledhfilneg, -%D ruledhfill,ruledhfillneg} -%D -%D We start with the easiest part, the fills. The scheme we -%D follow is {\em visual filling -- going back -- normal -%D filling}. Visualizing is implemented using \type{\cleaders}. -%D Because the \BOX\ that follows this command is constructed -%D only once, the \type{\copy} is not really a prerequisite. We -%D prefer using a \type{\normalhbox} here instead of a -%D \type{\hbox}. - -\def\setvisiblehfilbox#1\to#2#3#4% - {\setbox#1\normalhbox - {\visualvrule - \!!width #2\testrulewidth - \!!height#3\testrulewidth - \!!depth #4\testrulewidth}% - \smashbox#1} - -\def\doruledhfiller#1#2#3#4% - {#1#2% - \bgroup - \dontinterfere - \dontcomplain - \setvisiblehfilbox0\to{4}{#3}{#4}% - \setvisiblehfilbox2\to422% - \copy0\copy2 - \bgroup - \setvisiblehfilbox0\to422% - \cleaders - \normalhbox to 12\testrulewidth - {\normalhss\copy0\normalhss}% - #1% - \egroup - \setbox0\normalhbox - {\normalhskip-4\testrulewidth\copy0\copy2}% - \smashbox0% - \box0 - \egroup} - -%D The horizontal fillers differ in their boundary -%D visualization. Watch the small dots. Fillers can be -%D combined within reasonable margins. -%D -%D \startlinecorrection -%D \baselinerulefalse -%D \ruledhbox to \hsize -%D {\strut\type{\hss}\ruledhss test} -%D \stoplinecorrection -%D -%D \startlinecorrection -%D \baselinerulefalse -%D \ruledhbox to \hsize -%D {\strut\type{\hfil}\ruledhfil test} -%D \stoplinecorrection -%D -%D \startlinecorrection -%D \baselinerulefalse -%D \ruledhbox to \hsize -%D {\strut\type{\hfill}\ruledhfill test} -%D \stoplinecorrection -%D -%D \startlinecorrection -%D \baselinerulefalse -%D \ruledhbox to \hsize -%D {\strut -%D \type{\hfil}\type{\hfil}\ruledhfil\ruledhfil -%D test% -%D \ruledhfil\type{\hfil}} -%D \stoplinecorrection -%D -%D The negative counterparts are visualizes, but seldom -%D become visible, apart from their boundaries. -%D -%D \startlinecorrection -%D \baselinerulefalse -%D \ruledhbox to \hsize -%D {\strut\type{\hfilneg}\ruledhfilneg test} -%D \stoplinecorrection -%D -%D \startlinecorrection -%D \baselinerulefalse -%D \ruledhbox to \hsize -%D {\strut\type{\hfillneg}\ruledhfillneg test} -%D \stoplinecorrection -%D -%D Although leaders are used for visualizing, they are -%D visualized themselves correctly as the next example shows. -%D -%D \startlinecorrection -%D \baselinerulefalse -%D \ruledhbox to \hsize -%D {\strut\cleaders\normalhbox to 2em{\normalhss$\circ$\normalhss}\ruledhfill} -%D \stoplinecorrection -%D -%D All five substitutions use the same auxiliary macro. Watch -%D the positive first -- negative next approach. - -\unexpanded\def\ruledhss - {\doruledhfiller\normalhss\normalhfilneg{0}{0}} - -\unexpanded\def\ruledhfil - {\doruledhfiller\normalhfil\normalhfilneg{10}{-6}} - -\unexpanded\def\ruledhfill - {\doruledhfiller\normalhfill\normalhfillneg{18}{-14}} - -\unexpanded\def\ruledhfilneg - {\doruledhfiller\normalhfilneg\normalhfil{-6}{10}} - -\unexpanded\def\ruledhfillneg - {\doruledhfiller\normalhfillneg\normalhfill{-14}{18}} - -%D \macros -%D {ruledvss, -%D ruledvfil,ruledvfilneg, -%D ruledvfill,ruledvfillneg} -%D -%D The vertical mode commands adopt the same visualization -%D scheme, but are implemented in a slightly different way. - -\def\setvisiblevfilbox#1\to#2#3#4% - {\setbox#1\normalhbox - {\visualvrule - \!!width #2\testrulewidth - \!!height#3\testrulewidth - \!!depth #4\testrulewidth}% - \smashbox#1}% - -\def\doruledvfiller#1#2#3% - {#1#2% - \bgroup - \dontinterfere - \dontcomplain - \normaloffinterlineskip - \setvisiblevfilbox0\to422% - \setbox2\normalvcue - {\normalhskip -#3\testrulewidth\copy0}% - \smashbox2% - \copy2 - \bgroup - \setbox2\normalvcue - {\normalhskip -2\testrulewidth\copy0}% - \smashbox2% - \copy2 - \cleaders - \normalvbox to 12\testrulewidth - {\normalvss\copy2\normalvss}% - #1% - \setbox2\normalvbox - {\normalvskip-2\testrulewidth\copy2}% - \smashbox2% - \box2 - \egroup - \box2 - \egroup} - -%D Because they act the same as their horizontal counterparts -%D we only show a few examples. -%D -%D \startlinecorrection -%D \hbox to \hsize -%D {\dontinterfere -%D \baselinerulefalse -%D \centeredvcuetrue -%D \ruledvbox to 10ex -%D {\hsize.18\hsize -%D \type{\vss}\ruledvss last line}\normalhss -%D \ruledvbox to 10ex -%D {\hsize.18\hsize -%D \type{\vfil}\ruledvfil last line}\normalhss -%D \ruledvbox to 10ex -%D {\hsize.18\hsize -%D \type{\vfill}\ruledvfill last line}\normalhss -%D \ruledvbox to 10ex -%D {\hsize.18\hsize -%D \type{\vfilneg}\ruledvfilneg last line}\normalhss -%D \ruledvbox to 10ex -%D {\hsize.18\hsize -%D \type{\vfillneg}\ruledvfillneg last line}} -%D \stoplinecorrection -%D -%D Keep in mind that \type{\vfillneg} is not part of \PLAIN\ -%D \TEX, but are mimmicked by a macro. - -\unexpanded\def\ruledvss {\doruledvfiller\normalvss \normalvfilneg {2}} -\unexpanded\def\ruledvfil {\doruledvfiller\normalvfil \normalvfilneg {-4}} -\unexpanded\def\ruledvfill {\doruledvfiller\normalvfill \normalvfillneg{-12}} -\unexpanded\def\ruledvfilneg {\doruledvfiller\normalvfilneg \normalvfil {8}} -\unexpanded\def\ruledvfillneg{\doruledvfiller\normalvfillneg\normalvfill {16}} - -%D \macros -%D {ruledhskip} -%D -%D Skips differ from kerns in two important aspects: -%D -%D \startitemize[packed] -%D \item line and pagebreaks are allowed at a skip -%D \item skips can have a positive and/or negative -%D stretchcomponent -%D \stopitemize -%D -%D Stated a bit different: kerns are fixed skips at which no -%D line or pagebreak can occur. Because skips have a more open -%D character, they are visualized in a open way. -%D -%D \startbuffer -%D one -%D \hskip +30pt plus 5pt -%D two -%D \hskip +30pt -%D \hskip -10pt plus 5pt -%D three -%D \hskip 0pt -%D four -%D \hskip +30pt -%D five -%D \stopbuffer -%D -%D \ShowBufferedExample -%D -%D When skips have a stretch component, this is visualized by -%D means of a dashed line. Positive skips are on top of the -%D baseline, negative ones are below it. This way we can show -%D the combined results. An alternative visualization of -%D stretch could be drawing the mid line over a length of the -%D stretch, in positive or negative direction. - -\def\doruledhskip - {\relax - \dontinterfere - \dontcomplain - \investigateskip\scratchskip - \ifzero - \setbox0\normalhbox - {\normalhskip-\testrulewidth - \visualvrule - \!!width4\testrulewidth - \!!height16\testrulewidth - \!!depth16\testrulewidth}% - \else - \setbox0\normalhbox to \ifnegative-\fi\scratchskip - {\visualvrule - \!!width2\testrulewidth - \ifnegative\!!depth\else\!!height\fi16\testrulewidth - \cleaders - \visualhrule - \ifnegative - \!!depth2\testrulewidth - \!!height\zeropoint - \else - \!!height2\testrulewidth - \!!depth\zeropoint - \fi - \normalhfill - \ifflexible - \normalhskip\ifnegative\else-\fi\scratchskip - \normalhskip2\testrulewidth - \cleaders - \normalhbox - {\normalhskip 2\testrulewidth - \visualvrule - \!!width2\testrulewidth - \!!height\ifnegative-7\else9\fi\testrulewidth - \!!depth\ifnegative9\else-7\fi\testrulewidth - \normalhskip 2\testrulewidth}% - \normalhfill - \fi - \visualvrule - \!!width2\testrulewidth - \ifnegative\!!depth\else\!!height\fi16\testrulewidth}% - \setbox0\normalhbox - {\ifnegative\else\normalhskip-\scratchskip\fi - \box0}% - \fi - \smashbox0% - \ifvisiblestretch \else - \flexiblefalse - \fi - \ifflexible - % breaks ok but small displacements can occur - \skip2\scratchskip - \advance\skip2 -1\scratchskip - \divide\skip2 2 - \advance\scratchskip -\skip2 - \normalhskip\scratchskip - \normalpenalty\!!tenthousand - \box0 - \normalhskip\skip2 - \else - \normalhskip\scratchskip - \box0 - \fi - \egroup} - -\unexpanded\def\ruledhskip - {\bgroup - \afterassignment\doruledhskip - \scratchskip=} - -%D The visual skip is located at a feasible point. Normally -%D this does not interfere with the normaltypesetting process. -%D The next examples show (1)~the default behavior, (2)~the -%D (not entirely correct) distributed stretch and (3)~the way -%D the text is typeset without cues. -%D -%D \startbuffer -%D \dorecurse -%D {15} -%D {test\hskip1em plus .5em minus .5em -%D test\hskip2em -%D test} -%D \stopbuffer -%D -%D \startlinecorrection -%D \showmakeup -%D \getbuffer -%D \stoplinecorrection -%D -%D \startlinecorrection -%D \showmakeup -%D \visiblestretchtrue -%D \getbuffer -%D \stoplinecorrection -%D -%D \startlinecorrection -%D \getbuffer -%D \stoplinecorrection - -%D \macros -%D {ruledvskip} -%D -%D We are less fortunate when implementing the vertical skips. -%D This is a direct result of interference between the boxes that -%D visualize the skip and skip removal at a pagebreak. Normally -%D skips disappear at the top of a page, but not of course when -%D visualized in a \type{\vbox}. A quite perfect simulation -%D could have been built if we would have had available two -%D more primitives: \type{\hnop} and \type{\vnop}. These new -%D primitives could stand for boxes that are visible but are -%D not taken into account in any way. They are there for us, -%D but not for \TEX. -%D -%D \startbuffer -%D first line -%D \vskip +30pt plus 5pt -%D second line -%D \vskip +30pt -%D \vskip -10pt plus 5pt -%D third line -%D \par -%D fourth line -%D \vskip +30pt -%D fifth line -%D \vskip 0pt -%D sixth line -%D \stopbuffer -%D -%D \ShowBufferedExample -%D -%D We have to postpone \type{\prevdepth}. Although this -%D precaution probably is not completely waterproof, it works -%D quite well. - -\def\dodoruledvskip - {\nextdepth\prevdepth - \dontinterfere - \dontcomplain - \normaloffinterlineskip - \investigateskip\scratchskip - \ifzero - \setbox0\normalvcue - {\visualvrule - \!!width32\testrulewidth - \!!height2\testrulewidth - \!!depth2\testrulewidth}% - \else - \setbox0\normalvbox to \ifnegative-\fi\scratchskip - {\visualhrule - \!!width16\testrulewidth - \!!height2\testrulewidth - \ifflexible - \cleaders - \normalhbox to 16\testrulewidth - {\normalhss - \normalvbox - {\normalvskip 2\testrulewidth - \visualhrule - \!!width2\testrulewidth - \!!height2\testrulewidth - \normalvskip 2\testrulewidth}% - \normalhss}% - \normalvfill - \else - \normalvfill - \fi - \visualhrule - \!!width16\testrulewidth - \!!height2\testrulewidth}% - \setbox2\normalvbox to \ht0 - {\visualhrule - \!!width2\testrulewidth - \!!height\ht0}% - \ifnegative - \ht0\zeropoint - \setbox0\normalhbox - {\normalhskip2\testrulewidth % will be improved - \normalhskip-\wd0\box0}% - \fi - \smashbox0% - \smashbox2% - \setbox0\normalvcue - {\box2\box0}% - \setbox0\normalvbox - {\ifnegative\normalvskip\scratchskip\fi\box0}% - \smashbox0% - \fi - \ifvisiblestretch - \ifflexible - \skip2\scratchskip - \advance\skip2 -1\scratchskip - \divide\skip2 2 - \advance\scratchskip -\skip2 - \normalvskip\skip2 - \fi - \fi - \normalpenalty\!!tenthousand - \box0 - \prevdepth\nextdepth % not \dp0=\nextdepth - \normalvskip\scratchskip} - -%D We try to avoid interfering at the top of a page. Of course -%D we only do so when we are in the main vertical list. - -\def\doruledvskip - {\endgraf % \par - \ifdim\pagegoal=\maxdimen - \ifinner - \dodoruledvskip - \fi - \else - \dodoruledvskip - \fi - \egroup} - -\unexpanded\def\ruledvskip - {\bgroup - \afterassignment\doruledvskip - \scratchskip=} - -%D \macros -%D {ruledkern} -%D -%D The macros that implement the kerns are a bit more -%D complicated than needed, because they also serve the -%D visualization of glue, our \PLAIN\ defined kerns with -%D stretch or shrink. We've implemented both horizontal and -%D vertical kerns as ruled boxes. -%D -%D \startbuffer -%D one -%D \kern +30pt -%D two -%D \kern +30pt -%D \kern -10pt -%D three -%D \kern 0pt -%D four -%D \kern +30pt -%D five -%D \stopbuffer -%D -%D \ShowBufferedExample -%D -%D Positive and negative kerns are placed on top or below the -%D baseline, so we are able to track their added result. We -%D didn't mention spacings of 0~pt yet. Zero values are -%D visualized a bit different, because we want to see them -%D anyhow. - -\def\doruledhkern - {\dontinterfere - \dontcomplain - \baselinerulefalse - \investigateskip\scratchskip - \boxrulewidth2\testrulewidth - \ifzero - \setbox0\ruledhbox to 8\testrulewidth - {\visualvrule - \!!width\zeropoint - \!!height16\testrulewidth - \!!depth16\testrulewidth}% - \setbox0\normalhbox - {\normalhskip-4\testrulewidth\box0}% - \else - \setbox0\ruledhbox to \ifnegative-\fi\scratchskip - {\visualvrule - \!!width\zeropoint - \ifnegative\!!depth\else\!!height\fi16\testrulewidth - \ifflexible - \normalhskip2\testrulewidth - \cleaders - \normalhbox - {\normalhskip 2\testrulewidth - \visualvrule - \!!width2\testrulewidth - \!!height\ifnegative-7\else9\fi\testrulewidth - \!!depth\ifnegative9\else-7\fi\testrulewidth - \normalhskip 2\testrulewidth}% - \normalhfill - \else - \normalhfill - \fi}% - \testrulewidth2\testrulewidth - \setbox0\ruledhbox{\box0}% \make... - \fi - \smashbox0% - \normalpenalty\!!tenthousand - \normalhbox to \zeropoint - {\ifnegative\normalhskip1\scratchskip\fi - \box0}% - \afterwards\scratchskip - \egroup} - -\unexpanded\def\ruledhkern#1% - {\bgroup - \let\afterwards#1% - \afterassignment\doruledhkern - \scratchskip=} - -%D After having seen the horizontal ones, the vertical kerns -%D will not surprise us. In this example we use \type{\par} to -%D switch to vertical mode. -%D -%D \startbuffer -%D first line -%D \par \kern +30pt -%D second line -%D \par \kern +30pt -%D \par \kern -10pt -%D third line -%D \par -%D fourth line -%D \par \kern +30pt -%D fifth line -%D \par \kern 0pt -%D sixth line -%D \stopbuffer -%D -%D \ShowBufferedExample -%D -%D Like before, we have to postpone \type{\prevdepth}. If we -%D leave out this trick, we got ourselves some wrong spacing. - -\def\dodoruledvkern - {\nextdepth\prevdepth - \dontinterfere - \dontcomplain - \baselinerulefalse - \normaloffinterlineskip - \investigateskip\scratchskip - \boxrulewidth2\testrulewidth - \ifzero - \setbox0\ruledhbox to 32\testrulewidth - {\visualvrule - \!!width\zeropoint - \!!height4\testrulewidth - \!!depth4\testrulewidth}% - \else - \setbox0\ruledvbox to \ifnegative-\fi\scratchskip - {\hsize16\testrulewidth - \ifflexible - \cleaders - \normalhbox to 16\testrulewidth - {\normalhss - \normalvbox - {\normalvskip 2\testrulewidth - \visualhrule - \!!width2\testrulewidth - \!!height2\testrulewidth - \normalvskip 2\testrulewidth}% - \normalhss}% - \normalvfill - \else - \visualvrule - \!!width\zeropoint - \!!height\ifnegative-\fi\scratchskip - \normalhfill - \fi} - \fi - \testrulewidth2\testrulewidth - \setbox0\ruledvbox{\box0}% \make... - \smashbox0% - \setbox0\normalvbox - {\ifnegative\normalvskip\scratchskip\fi - \normalvcue - {\ifnegative\normalhskip-16\testrulewidth\fi\box0}}% - \smashbox0% - \normalpenalty\!!tenthousand - \box0 - \prevdepth\nextdepth} % not \dp0=\nextdepth - -\def\doruledvkern - {\ifdim\pagegoal=\maxdimen - \ifinner - \dodoruledvkern - \fi - \else - \dodoruledvkern - \fi - \afterwards\scratchskip - \egroup} - -\unexpanded\def\ruledvkern#1% - {\bgroup - \let\afterwards#1\relax - \afterassignment\doruledvkern - \scratchskip=} - -\unexpanded\def\ruledkern - {\ifvmode - \expandafter\ruledvkern - \else - \expandafter\ruledhkern - \fi - \normalkern} - -%D A a bit more \TEX nice solution is: -%D -%D \starttyping -%D \unexpanded\def\ruledkern% -%D {\csname ruled\ifvmode v\else h\fi kern\endcsname\normalkern} -%D \stoptyping - -%D \macros -%D {ruledhglue,ruledvglue} -%D -%D The non-primitive glue commands are treated as kerns with -%D stretch. This stretch is presented as a dashed line. I -%D have to admit that until now, I've never used these glue -%D commands. -%D -%D \startbuffer -%D one -%D \hglue +30pt plus 5pt -%D two -%D \hglue +30pt -%D \hglue -10pt plus 5pt -%D three -%D \hglue 0pt -%D four -%D \hglue +30pt -%D five -%D \stopbuffer -%D -%D \ShowBufferedExample - -\def\doruledhglue - {\leavevmode - \scratchcounter\spacefactor - \visualvrule\!!width\zeropoint - \normalpenalty\!!tenthousand - \ruledhkern\normalhskip\scratchskip - \spacefactor\scratchcounter - \egroup} - -\unexpanded\def\ruledhglue - {\bgroup - \afterassignment\doruledhglue\scratchskip=} - -%D \startbuffer -%D first line -%D \vglue +30pt plus 5pt -%D second line -%D \vglue +30pt -%D \vglue -10pt plus 5pt -%D third line -%D \par -%D fourth line -%D \vglue +30pt -%D fifth line -%D \vglue 0pt -%D sixth line -%D \stopbuffer -%D -%D \ShowBufferedExample - -\def\doruledvglue - {\endgraf % \par - \nextdepth\prevdepth - \visualhrule\!!height\zeropoint - \normalpenalty\!!tenthousand - \ruledvkern\normalvskip\scratchskip - \prevdepth\nextdepth - \egroup} - -\unexpanded\def\ruledvglue - {\bgroup - \afterassignment\doruledvglue\scratchskip=} - -%D \macros -%D {ruledmkern,ruledmskip} -%D -%D Mathematical kerns and skips are specified in mu. This -%D font related unit is incompatible with those of \DIMENSIONS\ -%D and \SKIPS. Because in math mode spacing is often a very -%D subtle matter, we've used a very simple, not overloaded way -%D to show them. - -\def\dodoruledmkern#1% - {\dontinterfere - \dontcomplain - \setbox0\normalhbox - {$\normalmkern\ifnegative-\fi\scratchmuskip$}% - \setbox0\normalhbox to \wd0 - {\visualvrule - \!!height16\testrulewidth - \!!depth16\testrulewidth - \!!width\testrulewidth - \leaders - \visualhrule - \!!height\ifpositive16\else-14\fi\testrulewidth - \!!depth\ifpositive-14\else16\fi\testrulewidth - \normalhfill - \ifflexible - \normalhskip-\wd0 - \leaders - \visualhrule - \!!height\testrulewidth - \!!depth\testrulewidth - \normalhfill - \fi - \visualvrule - \!!height16\testrulewidth - \!!depth16\testrulewidth - \!!width\testrulewidth}% - \smashbox0% - \ifnegative - #1\scratchmuskip - \box0 - \else - \box0 - #1\scratchmuskip - \fi - \egroup} - -%D \startbuffer -%D $a \mkern3mu = \mkern3mu -%D b \quad -%D \mkern-2mu + \mkern-2mu -%D \quad c$ -%D \stopbuffer -%D -%D \ShowBufferedExample - -\def\doruledmkern - {\investigatemuskip\scratchmuskip - \flexiblefalse - \dodoruledmkern\normalmkern} - -\unexpanded\def\ruledmkern - {\bgroup - \afterassignment\doruledmkern\scratchmuskip=} - -%D \startbuffer -%D $a \mskip3mu = \mskip3mu -%D b \quad -%D \mskip-2mu + \mskip-2mu -%D \quad c$ -%D \stopbuffer -%D -%D \ShowBufferedExample - -\def\doruledmskip - {\investigatemuskip\scratchmuskip - \flexibletrue - \dodoruledmkern\normalmskip} - -\unexpanded\def\ruledmskip - {\bgroup - \afterassignment\doruledmskip\scratchmuskip=} - -%D \macros -%D {penalty} -%D -%D After presenting fills, skip, kerns and glue we've come to -%D see penalties. In the first implementation --- most of the -%D time needed to develop this set of macros went into testing -%D different types of visualization --- penalties were mere -%D small blocks with one black half, depending on the sign. -%D This most recent version also gives an indication of the -%D amount of penalty. Penalties can go from less than $-10000$ -%D to over $+10000$, and their behavior is somewhat -%D non-lineair, with some values having special meanings. We -%D therefore decided not to use its value for a lineair -%D indicator. -%D -%D \startbuffer -%D one -%D \penalty +100 -%D two -%D \penalty +100 -%D \penalty -100 -%D three -%D \penalty 0 -%D four -%D \penalty +100 -%D five -%D \stopbuffer -%D -%D \ShowBufferedExample -%D -%D The small sticks at the side of the penalty indicate it -%D size. The next example shows the positive and negative -%D penalties of 0, 1, 10, 100, 1000 and 10000. -%D -%D \startlinecorrection -%D \hbox -%D {test \ruledhpenalty0 -%D test \ruledhpenalty1 -%D test \ruledhpenalty10 -%D test \ruledhpenalty100 -%D test \ruledhpenalty1000 -%D test \ruledhpenalty10000 -%D test} -%D \stoplinecorrection -%D -%D \blank -%D -%D \startlinecorrection -%D \hbox -%D {test \ruledhpenalty0 -%D test \ruledhpenalty-1 -%D test \ruledhpenalty-10 -%D test \ruledhpenalty-100 -%D test \ruledhpenalty-1000 -%D test \ruledhpenalty-10000 -%D test} -%D \stoplinecorrection -%D -%D \blank -%D -%D This way stacked penalties of different severance can be -%D shown in combination. -%D -%D test \ruledhpenalty10 \ruledhpenalty100 -%D test -%D test \ruledhpenalty1000 \ruledhpenalty-1000 -%D test - -\def\setruledpenaltybox#1#2#3#4#5#6% - {\setbox#1\normalhbox - {\ifnum#2=0 \else - \edef\sign - {\ifnum#2>0 +\else-\fi}% - \dimen0=\ifnum\sign#2>9999 - 28\else - \ifnum\sign#2>999 - 22\else - \ifnum\sign#2>99 - 16\else - \ifnum\sign#2>9 - 10\else - 4 - \fi\fi\fi\fi \testrulewidth - \ifnum#2<0 - \normalhskip-\dimen0 - \normalhskip-2\testrulewidth - \visualvrule - \!!width2\testrulewidth - \!!height#3\testrulewidth - \!!depth#4\testrulewidth - \fi - \visualvrule - \!!width\dimen0 - \!!height#5\testrulewidth - \!!depth#6\testrulewidth - \ifnum#2>0 - \visualvrule - \!!width2\testrulewidth - \!!height#3\testrulewidth - \!!depth#4\testrulewidth - \fi - \fi}% - \smashbox#1} - -\def\doruledhpenalty - {\dontinterfere - \dontcomplain - \investigatecount\scratchcounter - \testrulewidth2\testrulewidth - \boxrulewidth\testrulewidth - \setbox0\ruledhbox to 8\testrulewidth - {\ifnegative\else\normalhss\fi - \visualvrule - \!!depth8\testrulewidth - \!!width\ifzero0\else4\fi\testrulewidth - \ifpositive\else\normalhss\fi}% - \setruledpenaltybox{2}{\scratchcounter}{0}{8}{-3.5}{4.5}% - \normalpenalty\!!tenthousand - \setbox0\normalhbox - {\normalhskip-4\testrulewidth - \ifnegative - \box2\box0 - \else - \box0\box2 - \fi}% - \smashbox0% - \box0 - \normalpenalty\scratchcounter - \egroup} - -\unexpanded\def\ruledhpenalty - {\bgroup - \afterassignment\doruledhpenalty - \scratchcounter=} - -%D The size of a vertical penalty is also shown on the -%D horizontal axis. This way there is less interference with -%D the often preceding or following skips and kerns. -%D -%D \startbuffer -%D first line -%D \par \penalty +100 -%D second line -%D \par \penalty +100 -%D \par \penalty -100 -%D third line -%D \par \penalty 0 -%D fourth line -%D \par \penalty +100 -%D fifth line -%D \stopbuffer -%D -%D \ShowBufferedExample - -\def\doruledvpenalty - {\ifdim\pagegoal=\maxdimen - \else - \nextdepth\prevdepth - \dontinterfere - \dontcomplain - \investigatecount\scratchcounter - \testrulewidth2\testrulewidth - \boxrulewidth\testrulewidth - \setbox0\ruledhbox - {\visualvrule - \!!height4\testrulewidth - \!!depth4\testrulewidth - \!!width\zeropoint - \visualvrule - \!!height\ifnegative.5\else4\fi\testrulewidth - \!!depth\ifpositive.5\else4\fi\testrulewidth - \!!width8\testrulewidth}% - \setruledpenaltybox{2}{\scratchcounter}{4}{4}{.5}{.5}% - \setbox0\normalhbox - {\normalhskip-4\testrulewidth - \ifnegative - \box2\box0 - \else - \box0\box2 - \fi - \normalhss}% - \smashbox0% - \normalpenalty\!!tenthousand - \nointerlineskip - \dp0\nextdepth % not \prevdepth=\nextdepth - \normalvbox - {\normalvcue{\box0}}% - \fi - \normalpenalty\scratchcounter - \egroup} - -\unexpanded\def\ruledvpenalty - {\bgroup - \afterassignment\doruledvpenalty - \scratchcounter=} - -\unexpanded\def\ruledpenalty - {\ifvmode - \expandafter\ruledvpenalty - \else - \expandafter\ruledhpenalty - \fi} - -%D At the cost of some more tokens, a bit more clever -%D implementation would be: -%D -%D \starttyping -%D \unexpanded\def\ruledpenalty% -%D {\csname ruled\ifvmode v\else h\fi penalty\endcsname} -%D \stoptyping - -%D \macros -%D {showfils,dontshowfils, -%D showboxes,dontshowboxes, -%D showskips,dontshowskips, -%D showpenalties,dontshowpenalties} -%D -%D For those who want to manipulate the visual cues in detail, -%D we have grouped them. - -\newif\ifshowingcomposition % see later why we need this - -\def\showfils - {\showingcompositiontrue - \let\hss \ruledhss - \let\hfil \ruledhfil - \let\hfill \ruledhfill - \let\hfilneg \ruledhfilneg - \let\hfillneg \ruledhfillneg - \let\vss \ruledvss - \let\vfil \ruledvfil - \let\vfill \ruledvfill - \let\vfilneg \ruledvfilneg - \let\vfillneg \ruledvfillneg} - -\def\dontshowfils - {\let\hss \normalhss - \let\hfil \normalhfil - \let\hfill \normalhfill - \let\hfilneg \normalhfilneg - \let\hfillneg \normalhfillneg - \let\vss \normalvss - \let\vfil \normalvfil - \let\vfill \normalvfill - \let\vfilneg \normalvfilneg - \let\vfillneg \normalvfillneg} - -\def\showboxes - {\showingcompositiontrue - \baselineruletrue - \let\hbox \ruledhbox - \let\vbox \ruledvbox - \let\vtop \ruledvtop - \let\vcenter \ruledvcenter} - -\def\dontshowboxes - {\let\hbox \normalhbox - \let\vbox \normalvbox - \let\vtop \normalvtop - \let\vcenter \normalvcenter} - -\def\showskips - {\showingcompositiontrue - \let\hskip \ruledhskip - \let\vskip \ruledvskip - \let\kern \ruledkern - \let\mskip \ruledmskip - \let\mkern \ruledmkern - \let\hglue \ruledhglue - \let\vglue \ruledvglue} - -\def\dontshowskips - {\let\hskip \normalhskip - \let\vskip \normalvskip - \let\kern \normalkern - \let\mskip \normalmskip - \let\mkern \normalmkern - \let\hglue \normalhglue - \let\vglue \normalvglue} - -\def\showpenalties - {\showingcompositiontrue - \let\penalty \ruledpenalty} - -\def\dontshowpenalties - {\let\penalty \normalpenalty} - -%D \macros -%D {showcomposition,dontshowcomposition, -%D showingcomposition} -%D -%D All these nice options come together in three macros. One -%D for turning the options on, one for turning them off, and a -%D boolean for enabling the mechanism outside the scope of the -%D user. The first two macros only do their job when we are -%D actually showing the composition. -%D -%D \starttyping -%D \showingcompositiontrue -%D \showcomposition -%D \stoptyping -%D -%D Because the output routine can do tricky things, like -%D multiple column typesetting and manipulation of the -%D pagebody, shifting things around and so on, the macro -%D \type{\dontshowcomposition} best can be called when we enter -%D this routine. Too much visual cues just don't make sense. In -%D \CONTEXT\ this has been taken care of. - -\newif\ifshowingcomposition - -\def\showcomposition - {\ifshowingcomposition - \showfils - \showboxes - \showskips - \showpenalties - \fi} - -\def\dontshowcomposition - {\ifshowingcomposition - \dontshowfils - \dontshowboxes - \dontshowskips - \dontshowpenalties - \fi} - -%D \macros -%D {showmakeup, -%D defaulttestrulewidth} -%D -%D Just to make things even more easy, we have defined: -%D -%D \starttyping -%D \showmakeup -%D \stoptyping -%D -%D For the sake of those who don't (yet) use \CONTEXT\ we -%D preset \type{\defaulttestrulewidth} to the already set -%D value. Otherwise we default to a bodyfontsize related value. -%D -%D \starttyping -%D \def\defaulttestrulewidth{.2pt} -%D \stoptyping -%D -%D Beware, it's a macro not a \DIMENSION. - -\ifx\bodyfontsize\undefined - \edef\defaulttestrulewidth{\the\testrulewidth} -\else - \def\defaulttestrulewidth{.02\bodyfontsize} -\fi - -\def\showmakeup - {\testrulewidth\defaulttestrulewidth - \showingcompositiontrue - \showcomposition} - -\protect - -%D \ifCONTEXT \let\next=\relax \else \let\next=\endinput -%D The documented source you have been reading was processed -%D using some surrogate makeup. When this file is processed -%D in \CONTEXT, a few more examples show up here, like a local -%D table of contents and a local register. -%D \fi \next - -%D Lets end with some more advanced examples. -%D Definitions and enumerations come in many flavors. The -%D next one for instance is defined as: -%D -%D \starttyping -%D \definedescription[test][place=left,hang=3,width=6em] -%D \stoptyping -%D -%D When applied to some text, this would look like: -%D -%D \bgroup -%D \showmakeup -%D \definedescription[test][location=left,hang=3,width=6em] -%D -%D \test{visual\\debugger} I would be very pleased if \TEX\ -%D had two more primitives: \type{\vnop} and \type{\hnop}. Both -%D should act and show up as normal boxes, but stay invisible -%D for \TEX\ when it's doing calculations. The \type{\vnop} -%D for instance should not interact with the internal mechanism -%D responsible for the disappearing skips, kerns and penalties -%D at a pagebreak. As long as we don't have these two boxtypes, -%D visual debugging will never be perfect. -%D -%D \egroup -%D -%D The index to this section looks like: -%D -%D {\setupreferencing[prefixprefix=dummy]\showmakeup\placeindex[criterium=local]} -%D -%D Although not impressive examples or typesetting, both -%D show us how and where things happen. When somehow the last -%D lines in this two column index don't allign, then this is -%D due to some still unknown interference. - -\endinput diff --git a/Master/texmf-dist/tex/context/base/symb-cow.mkii b/Master/texmf-dist/tex/context/base/symb-cow.mkii new file mode 100644 index 00000000000..fac6ca485bd --- /dev/null +++ b/Master/texmf-dist/tex/context/base/symb-cow.mkii @@ -0,0 +1,132 @@ +%D \module +%D [ file=symb-cow, +%D version=2006.06.23, +%D title=\CONTEXT\ Symbol Libraries, +%D subtitle=Cow Symbols, +%D author=Hans Hagen, +%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. + +\loadmapfile[koeieletters.map] + +\definefontsynonym [Cows] [koeielett] +\definefontsynonym [CowsContour] [koeielett-contour] +\definefontsynonym [CowsLogo] [koeielogos] +\definefontsynonym [CowsLogoContour] [koeielogos-contour] + +\definecolor [lsky] [r=.6,g=.6,b=1] +\definecolor [dsky] [r=.1,g=.1,b=1] +\definecolor [lground] [r=.3,g=.9,b=.3] +\definecolor [dground] [r=0,g=.5,b=0] +\definecolor [cspots] [r=.33,g=.1,b=0] + +\definecolor [tlsky] [t=.5,a=1,r=.6,g=.6,b=1] +\definecolor [tdsky] [t=.5,a=1,r=.1,g=.1,b=1] +\definecolor [tlground] [t=.5,a=1,r=.3,g=.9,b=.3] +\definecolor [tdground] [t=.5,a=1,r=0,g=.5,b=0] +\definecolor [tcspots] [t=.5,a=1,r=.33,g=.1,b=0] + +\definepalet + [cow] + [normal=lground, + contour=dground, + sky=lsky] + +\def\CowNormal#1% + {\dontleavehmode\hbox{\color[cow:normal]{\getglyph{Cows}{#1}}}} + +\def\ScaledCowNormal#1#2% + {\dontleavehmode\hbox{\color[cow:normal]{\definedfont[Cows sa #1]#2}}} + +\def\ScaledCowOverlay#1#2% + {\dontleavehmode\hbox + {\color[cow:contour]{\hsmash{\definedfont[CowsContour sa #1]#2}}% + \color[cow:normal] {\definedfont[Cows sa #1]#2}}} + +\def\CowOverlay#1% + {\dontleavehmode\hbox + {\color[cow:contour]{\hsmash{\getglyph{CowsContour}{#1}}}% + \color[cow:normal] {\getglyph{Cows} {#1}}}} + +\def\CowContour#1% + {\dontleavehmode\hbox + {\color[cow:contour]{\hsmash{\getglyph{CowsLogoContour}{#1}}}% + \color[cow:normal] {\getglyph{CowsLogo} {#1}}}} + +\def\CowLogo #1{\getglyph{CowsLogo} {\char#1\relax}} +\def\CowContourLogo#1{\getglyph{CowsLogoContour}{\char#1\relax}} + +\chardef\CowPragmaNormal= 1 +\chardef\CowPragmaShaded=20 + +\startsymbolset[cownormal] + + \definesymbol[CowPragmaADE] [\CowLogo{0}] + \definesymbol[CowPragma] [\CowLogo{1}] + \definesymbol[CowConTeXt] [\CowLogo{2}] + \definesymbol[CowConTeXtComplete] [\CowLogo{3}] + \definesymbol[CowConTeXtShadow] [\CowLogo{4}] + \definesymbol[CowConTeXtContour] [\CowLogo{5}] + \definesymbol[CowConTeXtOutline] [\CowLogo{6}] + \definesymbol[CowConTeXtDots] [\CowLogo{7}] + \definesymbol[CowMP] [\CowLogo{8}] + \definesymbol[CowMPComplete] [\CowLogo{9}] + \definesymbol[CowTeX] [\CowLogo{10}] + \definesymbol[CowTeXComplete] [\CowLogo{11}] + \definesymbol[CowBoo] [\CowLogo{12}] + \definesymbol[CowCow] [\CowLogo{13}] + \definesymbol[CowExampleComplete] [\CowLogo{14}] + \definesymbol[CowFoxetComplete] [\CowLogo{15}] + \definesymbol[CowMetafun] [\CowLogo{16}] + \definesymbol[CowMetafunComplete] [\CowLogo{17}] + \definesymbol[CowTEXComplete] [\CowLogo{18}] + \definesymbol[CowWikiComplete] [\CowLogo{19}] + \definesymbol[CowPragmaADEComplete][\CowLogo{20}] + \definesymbol[CowPragmaComplete] [\CowLogo{21}] + \definesymbol[CowExample] [\CowLogo{22}] + \definesymbol[CowFoxet] [\CowLogo{23}] + \definesymbol[CowTEX] [\CowLogo{24}] + \definesymbol[CowWiki] [\CowLogo{25}] + \definesymbol[CowCowTeXtComplete] [\CowLogo{26}] + \definesymbol[CowCowTeXt] [\CowLogo{27}] + +\stopsymbolset + +\startsymbolset[cowcontour] + + \definesymbol[CowPragmaADE] [\CowContourLogo{0}] + \definesymbol[CowPragma] [\CowContourLogo{1}] + \definesymbol[CowConTeXt] [\CowContourLogo{2}] + \definesymbol[CowConTeXtComplete] [\CowContourLogo{3}] + \definesymbol[CowConTeXtShadow] [\CowContourLogo{4}] + \definesymbol[CowConTeXtContour] [\CowContourLogo{5}] + \definesymbol[CowConTeXtOutline] [\CowContourLogo{6}] + \definesymbol[CowConTeXtDots] [\CowContourLogo{7}] + \definesymbol[CowMP] [\CowContourLogo{8}] + \definesymbol[CowMPComplete] [\CowContourLogo{9}] + \definesymbol[CowTeX] [\CowContourLogo{10}] + \definesymbol[CowTeXComplete] [\CowContourLogo{11}] + \definesymbol[CowBoo] [\CowContourLogo{12}] + \definesymbol[CowCow] [\CowContourLogo{13}] + \definesymbol[CowExampleComplete] [\CowContourLogo{14}] + \definesymbol[CowFoxetComplete] [\CowContourLogo{15}] + \definesymbol[CowMetafun] [\CowContourLogo{16}] + \definesymbol[CowMetafunComplete] [\CowContourLogo{17}] + \definesymbol[CowTEXComplete] [\CowContourLogo{18}] + \definesymbol[CowWikiComplete] [\CowContourLogo{19}] + \definesymbol[CowPragmaADEComplete][\CowContourLogo{20}] + \definesymbol[CowPragmaComplete] [\CowContourLogo{21}] + \definesymbol[CowExample] [\CowContourLogo{22}] + \definesymbol[CowFoxet] [\CowContourLogo{23}] + \definesymbol[CowTEX] [\CowContourLogo{24}] + \definesymbol[CowWiki] [\CowContourLogo{25}] + \definesymbol[CowCowTeXtComplete] [\CowContourLogo{26}] + \definesymbol[CowCowTeXt] [\CowContourLogo{27}] + +\stopsymbolset + +\endinput diff --git a/Master/texmf-dist/tex/context/base/symb-cow.mkiv b/Master/texmf-dist/tex/context/base/symb-cow.mkiv new file mode 100644 index 00000000000..adfd484d868 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/symb-cow.mkiv @@ -0,0 +1,130 @@ +%D \module +%D [ file=symb-cow, +%D version=2006.06.23, +%D title=\CONTEXT\ Symbol Libraries, +%D subtitle=Cow Symbols, +%D author=Hans Hagen, +%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. + +\definefontsynonym [Cows] [koeielett] +\definefontsynonym [CowsContour] [koeielett-contour] +\definefontsynonym [CowsLogo] [koeielogos] +\definefontsynonym [CowsLogoContour] [koeielogos-contour] + +\definecolor [lsky] [r=.6,g=.6,b=1] +\definecolor [dsky] [r=.1,g=.1,b=1] +\definecolor [lground] [r=.3,g=.9,b=.3] +\definecolor [dground] [r=0,g=.5,b=0] +\definecolor [cspots] [r=.33,g=.1,b=0] + +\definecolor [tlsky] [t=.5,a=1,r=.6,g=.6,b=1] +\definecolor [tdsky] [t=.5,a=1,r=.1,g=.1,b=1] +\definecolor [tlground] [t=.5,a=1,r=.3,g=.9,b=.3] +\definecolor [tdground] [t=.5,a=1,r=0,g=.5,b=0] +\definecolor [tcspots] [t=.5,a=1,r=.33,g=.1,b=0] + +\definepalet + [cow] + [normal=lground, + contour=dground, + sky=lsky] + +\def\CowNormal#1% + {\dontleavehmode\hbox{\color[cow:normal]{\getnamedglyphdirect{Cows}{#1}}}} + +\def\ScaledCowNormal#1#2% + {\dontleavehmode\hbox{\color[cow:normal]{\definedfont[Cows sa #1]#2}}} + +\def\ScaledCowOverlay#1#2% + {\dontleavehmode\hbox + {\color[cow:contour]{\hsmash{\definedfont[CowsContour sa #1]#2}}% + \color[cow:normal] {\definedfont[Cows sa #1]#2}}} + +\def\CowOverlay#1% + {\dontleavehmode\hbox + {\color[cow:contour]{\hsmash{\getnamedglyphdirect{CowsContour}{#1}}}% + \color[cow:normal] {\getnamedglyphdirect{Cows} {#1}}}} + +\def\CowContour#1% + {\dontleavehmode\hbox + {\color[cow:contour]{\hsmash{\getnamedglyphdirect{CowsLogoContour}{#1}}}% + \color[cow:normal] {\getnamedglyphdirect{CowsLogo} {#1}}}} + +\def\CowLogo {\getnamedglyphdirect{CowsLogo}} % #1 +\def\CowContourLogo{\getnamedglyphdirect{CowsLogoContour}} % #1 + +\chardef\CowPragmaNormal= 1 +\chardef\CowPragmaShaded=20 + +\startsymbolset[cownormal] + + \definesymbol[CowPragmaADE] [\CowLogo{P_r_a_g_m_a_A_d_e}] + \definesymbol[CowPragma] [\CowLogo{p_r_a_g_m_a_a_d_e}] + \definesymbol[CowConTeXt] [\CowLogo{c_o_n_t_e_x_t}] + \definesymbol[CowConTeXtComplete] [\CowLogo{contextlogo}] + \definesymbol[CowConTeXtShadow] [\CowLogo{contextlogo.shadow}] + \definesymbol[CowConTeXtContour] [\CowLogo{contextlogo.contour}] + \definesymbol[CowConTeXtOutline] [\CowLogo{contextlogo.skeleton}] + \definesymbol[CowConTeXtDots] [\CowLogo{contextlogo.dots}] + \definesymbol[CowMP] [\CowLogo{M_P}] + \definesymbol[CowMPComplete] [\CowLogo{mplogo}] + \definesymbol[CowTeX] [\CowLogo{T_e_X}] + \definesymbol[CowTeXComplete] [\CowLogo{texlogo.alt}] + \definesymbol[CowBoo] [\CowLogo{boo}] + \definesymbol[CowCow] [\CowLogo{cow}] + \definesymbol[CowExampleComplete] [\CowLogo{E_x_a_m_p_l_e}] + \definesymbol[CowFoxetComplete] [\CowLogo{F_o_X_e_t}] + \definesymbol[CowMetafun] [\CowLogo{m_e_t_a_f_u_n}] + \definesymbol[CowMetafunComplete] [\CowLogo{metafunlogo}] + \definesymbol[CowTEXComplete] [\CowLogo{texlogo}] + \definesymbol[CowWikiComplete] [\CowLogo{wikilogo}] + \definesymbol[CowPragmaADEComplete][\CowLogo{PragmaADElogo}] + \definesymbol[CowPragmaComplete] [\CowLogo{pragmaadelogo}] + \definesymbol[CowExample] [\CowLogo{examplelogo}] + \definesymbol[CowFoxet] [\CowLogo{foxetlogo}] + \definesymbol[CowTEX] [\CowLogo{T_E_X}] + \definesymbol[CowWiki] [\CowLogo{W_i_k_i}] + \definesymbol[CowCowTeXtComplete] [\CowLogo{cowtextlogo}] + \definesymbol[CowCowTeXt] [\CowLogo{C_o_w_t_e_x_t}] + +\stopsymbolset + +\startsymbolset[cowcontour] + + \definesymbol[CowPragmaADE] [\CowLogo{P_r_a_g_m_a_A_d_e}] + \definesymbol[CowPragma] [\CowLogo{p_r_a_g_m_a_a_d_e}] + \definesymbol[CowConTeXt] [\CowLogo{c_o_n_t_e_x_t}] + \definesymbol[CowConTeXtComplete] [\CowLogo{contextlogo}] + \definesymbol[CowConTeXtShadow] [\CowLogo{contextlogo.shadow}] + \definesymbol[CowConTeXtContour] [\CowLogo{contextlogo.contour}] + \definesymbol[CowConTeXtOutline] [\CowLogo{contextlogo.skeleton}] + \definesymbol[CowConTeXtDots] [\CowLogo{contextlogo.dots}] + \definesymbol[CowMP] [\CowLogo{M_P}] + \definesymbol[CowMPComplete] [\CowLogo{mplogo}] + \definesymbol[CowTeX] [\CowLogo{T_e_X}] + \definesymbol[CowTeXComplete] [\CowLogo{texlogo.alt}] + \definesymbol[CowBoo] [\CowLogo{boo}] + \definesymbol[CowCow] [\CowLogo{cow}] + \definesymbol[CowExampleComplete] [\CowLogo{E_x_a_m_p_l_e}] + \definesymbol[CowFoxetComplete] [\CowLogo{F_o_X_e_t}] + \definesymbol[CowMetafun] [\CowLogo{m_e_t_a_f_u_n}] + \definesymbol[CowMetafunComplete] [\CowLogo{metafunlogo}] + \definesymbol[CowTEXComplete] [\CowLogo{texlogo}] + \definesymbol[CowWikiComplete] [\CowLogo{wikilogo}] + \definesymbol[CowPragmaADEComplete][\CowLogo{PragmaADElogo}] + \definesymbol[CowPragmaComplete] [\CowLogo{pragmaadelogo}] + \definesymbol[CowExample] [\CowLogo{examplelogo}] + \definesymbol[CowFoxet] [\CowLogo{foxetlogo}] + \definesymbol[CowTEX] [\CowLogo{T_E_X}] + \definesymbol[CowWiki] [\CowLogo{W_i_k_i}] + \definesymbol[CowCowTeXtComplete] [\CowLogo{cowtextlogo}] + \definesymbol[CowCowTeXt] [\CowLogo{C_o_w_t_e_x_t}] + +\stopsymbolset + +\endinput diff --git a/Master/texmf-dist/tex/context/base/symb-cow.tex b/Master/texmf-dist/tex/context/base/symb-cow.tex deleted file mode 100644 index c04ca0108f7..00000000000 --- a/Master/texmf-dist/tex/context/base/symb-cow.tex +++ /dev/null @@ -1,132 +0,0 @@ -%D \module -%D [ file=symb-cow, -%D version=2006.06.23, -%D title=\CONTEXT\ Symbol Libraries, -%D subtitle=Cow Symbols, -%D author=Hans Hagen, -%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. - -\loadmapfile[koeieletters.map] - -\definefontsynonym [Cows] [koeielett] -\definefontsynonym [CowsContour] [koeielett-contour] -\definefontsynonym [CowsLogo] [koeielogos] -\definefontsynonym [CowsLogoContour] [koeielogos-contour] - -\definecolor [lsky] [r=.6,g=.6,b=1] -\definecolor [dsky] [r=.1,g=.1,b=1] -\definecolor [lground] [r=.3,g=.9,b=.3] -\definecolor [dground] [r=0,g=.5,b=0] -\definecolor [cspots] [r=.33,g=.1,b=0] - -\definecolor [tlsky] [t=.5,a=1,r=.6,g=.6,b=1] -\definecolor [tdsky] [t=.5,a=1,r=.1,g=.1,b=1] -\definecolor [tlground] [t=.5,a=1,r=.3,g=.9,b=.3] -\definecolor [tdground] [t=.5,a=1,r=0,g=.5,b=0] -\definecolor [tcspots] [t=.5,a=1,r=.33,g=.1,b=0] - -\definepalet - [cow] - [normal=lground, - contour=dground, - sky=lsky] - -\def\CowNormal#1% - {\dontleavehmode\hbox{\color[cow:normal]{\getglyph{Cows}{#1}}}} - -\def\ScaledCowNormal#1#2% - {\dontleavehmode\hbox{\color[cow:normal]{\definedfont[Cows sa #1]#2}}} - -\def\ScaledCowOverlay#1#2% - {\dontleavehmode\hbox - {\color[cow:contour]{\hsmash{\definedfont[CowsContour sa #1]#2}}% - \color[cow:normal] {\definedfont[Cows sa #1]#2}}} - -\def\CowOverlay#1% - {\dontleavehmode\hbox - {\color[cow:contour]{\hsmash{\getglyph{CowsContour}{#1}}}% - \color[cow:normal] {\getglyph{Cows} {#1}}}} - -\def\CowContour#1% - {\dontleavehmode\hbox - {\color[cow:contour]{\hsmash{\getglyph{CowsLogoContour}{#1}}}% - \color[cow:normal] {\getglyph{CowsLogo} {#1}}}} - -\def\CowLogo #1{\getglyph{CowsLogo} {\char#1\relax}} -\def\CowContourLogo#1{\getglyph{CowsLogoContour}{\char#1\relax}} - -\chardef\CowPragmaNormal= 1 -\chardef\CowPragmaShaded=20 - -\startsymbolset[cownormal] - -\definesymbol[CowPragmaADE] [\CowLogo{0}] -\definesymbol[CowPragma] [\CowLogo{1}] -\definesymbol[CowConTeXt] [\CowLogo{2}] -\definesymbol[CowConTeXtComplete] [\CowLogo{3}] -\definesymbol[CowConTeXtShadow] [\CowLogo{4}] -\definesymbol[CowConTeXtContour] [\CowLogo{5}] -\definesymbol[CowConTeXtOutline] [\CowLogo{6}] -\definesymbol[CowConTeXtDots] [\CowLogo{7}] -\definesymbol[CowMP] [\CowLogo{8}] -\definesymbol[CowMPComplete] [\CowLogo{9}] -\definesymbol[CowTeX] [\CowLogo{10}] -\definesymbol[CowTeXComplete] [\CowLogo{11}] -\definesymbol[CowBoo] [\CowLogo{12}] -\definesymbol[CowCow] [\CowLogo{13}] -\definesymbol[CowExampleComplete] [\CowLogo{14}] -\definesymbol[CowFoxetComplete] [\CowLogo{15}] -\definesymbol[CowMetafun] [\CowLogo{16}] -\definesymbol[CowMetafunComplete] [\CowLogo{17}] -\definesymbol[CowTEXComplete] [\CowLogo{18}] -\definesymbol[CowWikiComplete] [\CowLogo{19}] -\definesymbol[CowPragmaADEComplete][\CowLogo{20}] -\definesymbol[CowPragmaComplete] [\CowLogo{21}] -\definesymbol[CowExample] [\CowLogo{22}] -\definesymbol[CowFoxet] [\CowLogo{23}] -\definesymbol[CowTEX] [\CowLogo{24}] -\definesymbol[CowWiki] [\CowLogo{25}] -\definesymbol[CowCowTeXtComplete] [\CowLogo{26}] -\definesymbol[CowCowTeXt] [\CowLogo{27}] - -\stopsymbolset - -\startsymbolset[cowcontour] - -\definesymbol[CowPragmaADE] [\CowContourLogo{0}] -\definesymbol[CowPragma] [\CowContourLogo{1}] -\definesymbol[CowConTeXt] [\CowContourLogo{2}] -\definesymbol[CowConTeXtComplete] [\CowContourLogo{3}] -\definesymbol[CowConTeXtShadow] [\CowContourLogo{4}] -\definesymbol[CowConTeXtContour] [\CowContourLogo{5}] -\definesymbol[CowConTeXtOutline] [\CowContourLogo{6}] -\definesymbol[CowConTeXtDots] [\CowContourLogo{7}] -\definesymbol[CowMP] [\CowContourLogo{8}] -\definesymbol[CowMPComplete] [\CowContourLogo{9}] -\definesymbol[CowTeX] [\CowContourLogo{10}] -\definesymbol[CowTeXComplete] [\CowContourLogo{11}] -\definesymbol[CowBoo] [\CowContourLogo{12}] -\definesymbol[CowCow] [\CowContourLogo{13}] -\definesymbol[CowExampleComplete] [\CowContourLogo{14}] -\definesymbol[CowFoxetComplete] [\CowContourLogo{15}] -\definesymbol[CowMetafun] [\CowContourLogo{16}] -\definesymbol[CowMetafunComplete] [\CowContourLogo{17}] -\definesymbol[CowTEXComplete] [\CowContourLogo{18}] -\definesymbol[CowWikiComplete] [\CowContourLogo{19}] -\definesymbol[CowPragmaADEComplete][\CowContourLogo{20}] -\definesymbol[CowPragmaComplete] [\CowContourLogo{21}] -\definesymbol[CowExample] [\CowContourLogo{22}] -\definesymbol[CowFoxet] [\CowContourLogo{23}] -\definesymbol[CowTEX] [\CowContourLogo{24}] -\definesymbol[CowWiki] [\CowContourLogo{25}] -\definesymbol[CowCowTeXtComplete] [\CowContourLogo{26}] -\definesymbol[CowCowTeXt] [\CowContourLogo{27}] - -\stopsymbolset - -\endinput diff --git a/Master/texmf-dist/tex/context/base/symb-eur.mkii b/Master/texmf-dist/tex/context/base/symb-eur.mkii new file mode 100644 index 00000000000..400e88ac5cd --- /dev/null +++ b/Master/texmf-dist/tex/context/base/symb-eur.mkii @@ -0,0 +1,64 @@ +%D \module +%D [ file=symb-eur, +%D version=2000.06.22, +%D title=\CONTEXT\ Symbol Libraries, +%D subtitle=Adobe Euro Symbols, +%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. + +\loadmapfile [original-adobe-euro.map] + +\definefontsynonym [EuroSerif] [eurose] +\definefontsynonym [EuroSerifBold] [euroseb] +\definefontsynonym [EuroSerifItalic] [eurosei] +\definefontsynonym [EuroSerifSlanted] [eurosei] +\definefontsynonym [EuroSerifBoldItalic] [eurosebi] +\definefontsynonym [EuroSerifBoldSlanted] [eurosebi] + +\definefontsynonym [EuroSans] [eurosa] +\definefontsynonym [EuroSansBold] [eurosab] +\definefontsynonym [EuroSansItalic] [eurosai] +\definefontsynonym [EuroSansSlanted] [eurosai] +\definefontsynonym [EuroSansBoldItalic] [eurosabi] +\definefontsynonym [EuroSansBoldSlanted] [eurosabi] + +\definefontsynonym [EuroMono] [euromo] +\definefontsynonym [EuroMonoBold] [euromob] +\definefontsynonym [EuroMonoSlanted] [euromoi] +\definefontsynonym [EuroMonoItalic] [euromoi] +\definefontsynonym [EuroMonoBoldItalic] [euromobi] +\definefontsynonym [EuroMonoBoldSlanted] [euromobi] + +\definesymbol [euro] [\getglyph{Euro}{\char160}] + +\startencoding[default] + \definecharacter texteuro {\symbol[euro]} +\stopencoding + +\unexpanded\def\euro{\doiftextelse\texteuro\texteuro{\symbol[euro]}} + +% ok for one font series, but not for mixed sets +% +% \unexpanded\def\euro +% {\doiftextelse \texteuro \texteuro +% {\unexpanded\def\euro{\symbol[euro]}\euro} + +%D The next table shows the complete set of symbols: +%D +%D \starttabulate[|l|c|c|c|c|c|c|] +%D \NC \NC \tex{tf} \NC \tex{bf} \NC \tex{sl} +%D \NC \tex{it} \NC \tex{bs} \NC \tex{bi} \NC\NR +%D \NC \rm Serif \NC \rm\tf\euro \NC \rm\bf\euro \NC \rm\sl\euro +%D \NC \rm\it\euro \NC \rm\bs\euro \NC \rm\bi\euro \NC\NR +%D \NC \ss Sans \NC \ss\tf\euro \NC \ss\bf\euro \NC \ss\sl\euro +%D \NC \ss\it\euro \NC \ss\bs\euro \NC \ss\bi\euro \NC\NR +%D \NC \tt Mono \NC \tt\tf\euro \NC \tt\bf\euro \NC \tt\sl\euro +%D \NC \tt\it\euro \NC \tt\bs\euro \NC \tt\bi\euro \NC\NR +%D \stoptabulate + +\endinput diff --git a/Master/texmf-dist/tex/context/base/symb-eur.mkiv b/Master/texmf-dist/tex/context/base/symb-eur.mkiv new file mode 100644 index 00000000000..4ec5a8931cc --- /dev/null +++ b/Master/texmf-dist/tex/context/base/symb-eur.mkiv @@ -0,0 +1,52 @@ +%D \module +%D [ file=symb-eur, +%D version=2000.06.22, +%D title=\CONTEXT\ Symbol Libraries, +%D subtitle=Adobe Euro Symbols, +%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. + +\definefontsynonym [EuroSerif] [eurose] +\definefontsynonym [EuroSerifBold] [euroseb] +\definefontsynonym [EuroSerifItalic] [eurosei] +\definefontsynonym [EuroSerifSlanted] [eurosei] +\definefontsynonym [EuroSerifBoldItalic] [eurosebi] +\definefontsynonym [EuroSerifBoldSlanted] [eurosebi] + +\definefontsynonym [EuroSans] [eurosa] +\definefontsynonym [EuroSansBold] [eurosab] +\definefontsynonym [EuroSansItalic] [eurosai] +\definefontsynonym [EuroSansSlanted] [eurosai] +\definefontsynonym [EuroSansBoldItalic] [eurosabi] +\definefontsynonym [EuroSansBoldSlanted] [eurosabi] + +\definefontsynonym [EuroMono] [euromo] +\definefontsynonym [EuroMonoBold] [euromob] +\definefontsynonym [EuroMonoSlanted] [euromoi] +\definefontsynonym [EuroMonoItalic] [euromoi] +\definefontsynonym [EuroMonoBoldItalic] [euromobi] +\definefontsynonym [EuroMonoBoldSlanted] [euromobi] + +\definesymbol [euro] [\getglyph{Euro}{\fontchar{Euro.127}}] + +% \unexpanded\def\euro{\doiftextelse\texteuro\texteuro{\symbol[euro]}} + +%D The next table shows the complete set of symbols: +%D +%D \starttabulate[|l|c|c|c|c|c|c|] +%D \NC \NC \tex{tf} \NC \tex{bf} \NC \tex{sl} +%D \NC \tex{it} \NC \tex{bs} \NC \tex{bi} \NC\NR +%D \NC \rm Serif \NC \rm\tf\euro \NC \rm\bf\euro \NC \rm\sl\euro +%D \NC \rm\it\euro \NC \rm\bs\euro \NC \rm\bi\euro \NC\NR +%D \NC \ss Sans \NC \ss\tf\euro \NC \ss\bf\euro \NC \ss\sl\euro +%D \NC \ss\it\euro \NC \ss\bs\euro \NC \ss\bi\euro \NC\NR +%D \NC \tt Mono \NC \tt\tf\euro \NC \tt\bf\euro \NC \tt\sl\euro +%D \NC \tt\it\euro \NC \tt\bs\euro \NC \tt\bi\euro \NC\NR +%D \stoptabulate + +\endinput diff --git a/Master/texmf-dist/tex/context/base/symb-eur.tex b/Master/texmf-dist/tex/context/base/symb-eur.tex deleted file mode 100644 index 400e88ac5cd..00000000000 --- a/Master/texmf-dist/tex/context/base/symb-eur.tex +++ /dev/null @@ -1,64 +0,0 @@ -%D \module -%D [ file=symb-eur, -%D version=2000.06.22, -%D title=\CONTEXT\ Symbol Libraries, -%D subtitle=Adobe Euro Symbols, -%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. - -\loadmapfile [original-adobe-euro.map] - -\definefontsynonym [EuroSerif] [eurose] -\definefontsynonym [EuroSerifBold] [euroseb] -\definefontsynonym [EuroSerifItalic] [eurosei] -\definefontsynonym [EuroSerifSlanted] [eurosei] -\definefontsynonym [EuroSerifBoldItalic] [eurosebi] -\definefontsynonym [EuroSerifBoldSlanted] [eurosebi] - -\definefontsynonym [EuroSans] [eurosa] -\definefontsynonym [EuroSansBold] [eurosab] -\definefontsynonym [EuroSansItalic] [eurosai] -\definefontsynonym [EuroSansSlanted] [eurosai] -\definefontsynonym [EuroSansBoldItalic] [eurosabi] -\definefontsynonym [EuroSansBoldSlanted] [eurosabi] - -\definefontsynonym [EuroMono] [euromo] -\definefontsynonym [EuroMonoBold] [euromob] -\definefontsynonym [EuroMonoSlanted] [euromoi] -\definefontsynonym [EuroMonoItalic] [euromoi] -\definefontsynonym [EuroMonoBoldItalic] [euromobi] -\definefontsynonym [EuroMonoBoldSlanted] [euromobi] - -\definesymbol [euro] [\getglyph{Euro}{\char160}] - -\startencoding[default] - \definecharacter texteuro {\symbol[euro]} -\stopencoding - -\unexpanded\def\euro{\doiftextelse\texteuro\texteuro{\symbol[euro]}} - -% ok for one font series, but not for mixed sets -% -% \unexpanded\def\euro -% {\doiftextelse \texteuro \texteuro -% {\unexpanded\def\euro{\symbol[euro]}\euro} - -%D The next table shows the complete set of symbols: -%D -%D \starttabulate[|l|c|c|c|c|c|c|] -%D \NC \NC \tex{tf} \NC \tex{bf} \NC \tex{sl} -%D \NC \tex{it} \NC \tex{bs} \NC \tex{bi} \NC\NR -%D \NC \rm Serif \NC \rm\tf\euro \NC \rm\bf\euro \NC \rm\sl\euro -%D \NC \rm\it\euro \NC \rm\bs\euro \NC \rm\bi\euro \NC\NR -%D \NC \ss Sans \NC \ss\tf\euro \NC \ss\bf\euro \NC \ss\sl\euro -%D \NC \ss\it\euro \NC \ss\bs\euro \NC \ss\bi\euro \NC\NR -%D \NC \tt Mono \NC \tt\tf\euro \NC \tt\bf\euro \NC \tt\sl\euro -%D \NC \tt\it\euro \NC \tt\bs\euro \NC \tt\bi\euro \NC\NR -%D \stoptabulate - -\endinput diff --git a/Master/texmf-dist/tex/context/base/symb-glm.mkii b/Master/texmf-dist/tex/context/base/symb-glm.mkii new file mode 100644 index 00000000000..0b01ca7dfdb --- /dev/null +++ b/Master/texmf-dist/tex/context/base/symb-glm.mkii @@ -0,0 +1,79 @@ +%D \module +%D [ file=symb-glm, +%D version=2002.05.07, +%D title=\CONTEXT\ Symbol Libraries, +%D subtitle=Guillemots, +%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 Watch the \type {x} before the local symbols. + +% \loadmapfile [ec-public-lm.map] +% \loadmapfile [ec-lm.map] +\loadmapfile [lm-ec.map] + +% this used to be: +% +% \definefontsynonym [GuilSerif] [plr10] [encoding=ec] +% \definefontsynonym [GuilSerifBold] [plbx10] [encoding=ec] +% \definefontsynonym [GuilSerifItalic] [plti10] [encoding=ec] +% \definefontsynonym [GuilSerifSlanted] [plsl10] [encoding=ec] +% \definefontsynonym [GuilSerifBoldItalic] [plbxti10] [encoding=ec] +% \definefontsynonym [GuilSerifBoldSlanted] [plbxsl10] [encoding=ec] +% +% \definefontsynonym [GuilSans] [plss10] [encoding=ec] +% \definefontsynonym [GuilSansBold] [plssbx10] [encoding=ec] +% \definefontsynonym [GuilSansItalic] [plssi10] [encoding=ec] +% \definefontsynonym [GuilSansSlanted] [plssi10] [encoding=ec] +% \definefontsynonym [GuilSansBoldItalic] [plssbi10] [encoding=ec] +% \definefontsynonym [GuilSansBoldSlanted] [plssbi10] [encoding=ec] +% +% \definefontsynonym [GuilMono] [pltt10] [encoding=ec] +% +% but was also one of the reasons for triggering the lm project, so: + +\definefontsynonym [GuilSerif] [ec-lmr10] [encoding=ec] +\definefontsynonym [GuilSerifBold] [ec-lmbx10] [encoding=ec] +\definefontsynonym [GuilSerifItalic] [ec-lmti10] [encoding=ec] +\definefontsynonym [GuilSerifSlanted] [ec-lmsl10] [encoding=ec] +\definefontsynonym [GuilSerifBoldItalic] [ec-lmbxti10] [encoding=ec] +\definefontsynonym [GuilSerifBoldSlanted] [ec-lmbxsl10] [encoding=ec] + +\definefontsynonym [GuilSans] [ec-lmss10] [encoding=ec] +\definefontsynonym [GuilSansBold] [ec-lmssbx10] [encoding=ec] +\definefontsynonym [GuilSansItalic] [ec-lmssi10] [encoding=ec] +\definefontsynonym [GuilSansSlanted] [ec-lmssi10] [encoding=ec] +\definefontsynonym [GuilSansBoldItalic] [ec-lmssbi10] [encoding=ec] +\definefontsynonym [GuilSansBoldSlanted] [ec-lmssbi10] [encoding=ec] + +\definefontsynonym [GuilMono] [ec-lmtt10] [encoding=ec] +%definefontsynonym [GuilMonoBold] [ec-lmtt10] [encoding=ec] +%definefontsynonym [GuilMonoSlanted] [ec-lmtt10] [encoding=ec] +%definefontsynonym [GuilMonoItalic] [ec-lmtt10] [encoding=ec] +%definefontsynonym [GuilMonoBoldItalic] [ec-lmtt10] [encoding=ec] +%definefontsynonym [GuilMonoBoldSlanted] [ec-lmtt10] [encoding=ec] + +\definesymbol [xleftguillemot] [\getglyph{Guil}{\char19}] +\definesymbol [xrightguillemot] [\getglyph{Guil}{\char20}] + +\definesymbol [xguilsingleleft] [\getglyph{Guil}{\char14}] +\definesymbol [xguilsingleright] [\getglyph{Guil}{\char15}] + +%D A strange place, but okay (the \type {\relax} prevents space gobbling) + +\startencoding [default] + + \definecharacter leftguillemot {\symbol[xleftguillemot]\relax} + \definecharacter rightguillemot {\symbol[xrightguillemot]\relax} + + \definecharacter guilsingleleft {\symbol[xguilsingleleft]\relax} + \definecharacter guilsingleright {\symbol[xguilsingleright]\relax} + +\stopencoding + +\endinput diff --git a/Master/texmf-dist/tex/context/base/symb-glm.tex b/Master/texmf-dist/tex/context/base/symb-glm.tex deleted file mode 100644 index 0b01ca7dfdb..00000000000 --- a/Master/texmf-dist/tex/context/base/symb-glm.tex +++ /dev/null @@ -1,79 +0,0 @@ -%D \module -%D [ file=symb-glm, -%D version=2002.05.07, -%D title=\CONTEXT\ Symbol Libraries, -%D subtitle=Guillemots, -%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 Watch the \type {x} before the local symbols. - -% \loadmapfile [ec-public-lm.map] -% \loadmapfile [ec-lm.map] -\loadmapfile [lm-ec.map] - -% this used to be: -% -% \definefontsynonym [GuilSerif] [plr10] [encoding=ec] -% \definefontsynonym [GuilSerifBold] [plbx10] [encoding=ec] -% \definefontsynonym [GuilSerifItalic] [plti10] [encoding=ec] -% \definefontsynonym [GuilSerifSlanted] [plsl10] [encoding=ec] -% \definefontsynonym [GuilSerifBoldItalic] [plbxti10] [encoding=ec] -% \definefontsynonym [GuilSerifBoldSlanted] [plbxsl10] [encoding=ec] -% -% \definefontsynonym [GuilSans] [plss10] [encoding=ec] -% \definefontsynonym [GuilSansBold] [plssbx10] [encoding=ec] -% \definefontsynonym [GuilSansItalic] [plssi10] [encoding=ec] -% \definefontsynonym [GuilSansSlanted] [plssi10] [encoding=ec] -% \definefontsynonym [GuilSansBoldItalic] [plssbi10] [encoding=ec] -% \definefontsynonym [GuilSansBoldSlanted] [plssbi10] [encoding=ec] -% -% \definefontsynonym [GuilMono] [pltt10] [encoding=ec] -% -% but was also one of the reasons for triggering the lm project, so: - -\definefontsynonym [GuilSerif] [ec-lmr10] [encoding=ec] -\definefontsynonym [GuilSerifBold] [ec-lmbx10] [encoding=ec] -\definefontsynonym [GuilSerifItalic] [ec-lmti10] [encoding=ec] -\definefontsynonym [GuilSerifSlanted] [ec-lmsl10] [encoding=ec] -\definefontsynonym [GuilSerifBoldItalic] [ec-lmbxti10] [encoding=ec] -\definefontsynonym [GuilSerifBoldSlanted] [ec-lmbxsl10] [encoding=ec] - -\definefontsynonym [GuilSans] [ec-lmss10] [encoding=ec] -\definefontsynonym [GuilSansBold] [ec-lmssbx10] [encoding=ec] -\definefontsynonym [GuilSansItalic] [ec-lmssi10] [encoding=ec] -\definefontsynonym [GuilSansSlanted] [ec-lmssi10] [encoding=ec] -\definefontsynonym [GuilSansBoldItalic] [ec-lmssbi10] [encoding=ec] -\definefontsynonym [GuilSansBoldSlanted] [ec-lmssbi10] [encoding=ec] - -\definefontsynonym [GuilMono] [ec-lmtt10] [encoding=ec] -%definefontsynonym [GuilMonoBold] [ec-lmtt10] [encoding=ec] -%definefontsynonym [GuilMonoSlanted] [ec-lmtt10] [encoding=ec] -%definefontsynonym [GuilMonoItalic] [ec-lmtt10] [encoding=ec] -%definefontsynonym [GuilMonoBoldItalic] [ec-lmtt10] [encoding=ec] -%definefontsynonym [GuilMonoBoldSlanted] [ec-lmtt10] [encoding=ec] - -\definesymbol [xleftguillemot] [\getglyph{Guil}{\char19}] -\definesymbol [xrightguillemot] [\getglyph{Guil}{\char20}] - -\definesymbol [xguilsingleleft] [\getglyph{Guil}{\char14}] -\definesymbol [xguilsingleright] [\getglyph{Guil}{\char15}] - -%D A strange place, but okay (the \type {\relax} prevents space gobbling) - -\startencoding [default] - - \definecharacter leftguillemot {\symbol[xleftguillemot]\relax} - \definecharacter rightguillemot {\symbol[xrightguillemot]\relax} - - \definecharacter guilsingleleft {\symbol[xguilsingleleft]\relax} - \definecharacter guilsingleright {\symbol[xguilsingleright]\relax} - -\stopencoding - -\endinput diff --git a/Master/texmf-dist/tex/context/base/symb-ini.lua b/Master/texmf-dist/tex/context/base/symb-ini.lua new file mode 100644 index 00000000000..1bc8ee2aaaf --- /dev/null +++ b/Master/texmf-dist/tex/context/base/symb-ini.lua @@ -0,0 +1,38 @@ +if not modules then modules = { } end modules ['symb-ini'] = { + version = 1.001, + comment = "companion to symb-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + + +local variables = interfaces.variables + +fonts.symbols = fonts.symbols or { } +local symbols = fonts.symbols + +local report_symbols = logs.reporter ("fonts","symbols") +local status_symbols = logs.messenger("fonts","symbols") + +local patterns = { "symb-imp-%s.mkiv", "symb-imp-%s.tex", "symb-%s.mkiv", "symb-%s.tex" } +local listitem = utilities.parsers.listitem + +function symbols.uselibrary(name) + if name ~= variables.reset then + for name in listitem(name) do + commands.uselibrary(name,patterns,function(name,foundname) + -- context.startnointerference() + context.startreadingfile() + context.input(foundname) + status_symbols("loaded: library '%s'",name) + context.stopreadingfile() + -- context.stopnointerference() + end, function(name) + report_symbols("unknown: library '%s'",name) + end) + end + end +end + +commands.usesymbols = symbols.uselibrary diff --git a/Master/texmf-dist/tex/context/base/symb-ini.mkii b/Master/texmf-dist/tex/context/base/symb-ini.mkii index f7bffd240f8..1df1fe68822 100644 --- a/Master/texmf-dist/tex/context/base/symb-ini.mkii +++ b/Master/texmf-dist/tex/context/base/symb-ini.mkii @@ -233,7 +233,7 @@ \let\currentsymboldef\empty -\def\startsymbolset[#1] +\def\startsymbolset[#1]% {\def\currentsymboldef{#1}} \def\stopsymbolset @@ -255,7 +255,7 @@ %D %D \showsetup{showsymbolset} -\fetchruntimecommand \showsymbolset {\f!symbolprefix\s!run.mkii} +\fetchruntimecommand \showsymbolset {\f!symbolprefix\s!run} %D \macros %D {usesymbols} @@ -263,11 +263,12 @@ %D \showsetup{usesymbols} \def\dousesymbols#1% - {\makeshortfilename[\truefilename{\f!symbolprefix#1}]% - \startreadingfile - \readsysfile\shortfilename + {\startreadingfile + \readsysfile{\truefilename{\f!symbolprefix#1}.\mksuffix} {\showmessage\m!symbols1{#1}} - \donothing + {\readsysfile{\truefilename{\f!symbolprefix#1}} + {\showmessage\m!symbols1{#1}} + \donothing}% \stopreadingfile} \def\usesymbols[#1]% diff --git a/Master/texmf-dist/tex/context/base/symb-ini.mkiv b/Master/texmf-dist/tex/context/base/symb-ini.mkiv index f4f6bdd7965..8282649b033 100644 --- a/Master/texmf-dist/tex/context/base/symb-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/symb-ini.mkiv @@ -17,6 +17,8 @@ \writestatus{loading}{ConTeXt Symbol Libraries / Initialization} +\registerctxluafile{symb-ini}{1.001} + \unprotect %D \macros @@ -48,14 +50,6 @@ \unexpanded\def\definesymbol {\dotripleempty\dodefinesymbol} -% \def\dodefinesymbol[#1][#2][#3]% class name meaning -% {\ifthirdargument -% \setvalue{\??ss:#1:#2}{#3}% -% \doifsomething{#1}{\addvalue{\??ss*#1}{#2}}% -% \else -% \setvalue{\??ss:\currentsymboldef:#1}{#2}% -% \fi} - \def\dodefinesymbol[#1][#2][#3]% class name meaning {\ifthirdargument \setvalue{\??ss:#1:#2}{#3}% @@ -65,11 +59,19 @@ \addvalue{\??ss*\currentsymboldef}{#1}% \fi} -\def\doifinsymbolsetelse#1#2{\doifdefinedelse{\??ss:#1:#2}} -\def\doifinsymbolset #1#2{\doifdefined {\??ss:#1:#2}} -\def\doifsymbolsetelse #1{\doifdefinedelse{\??ss*#1}} +% \def\doifinsymbolsetelse#1#2{\doifdefinedelse{\??ss:#1:#2}} +% \def\doifinsymbolset #1#2{\doifdefined {\??ss:#1:#2}} +% \def\doifsymbolsetelse #1{\doifdefinedelse{\??ss*#1}} +% +% \def\symbolset#1{\executeifdefined{\??ss*#1}\empty} % no [#1], to be used in commalists etc + +\def\doifinsymbolsetelse#1#2{\ifcsname\??ss:#1:#2\endcsname\@EA\firstoftwoarguments\else\@EA\secondoftwoarguments\fi} +\def\doifinsymbolset #1#2{\ifcsname\??ss:#1:#2\endcsname\@EA\firstofoneargument \else\@EA\gobbleoneargument \fi} +\def\doifsymbolsetelse #1{\ifcsname\??ss*#1\endcsname \@EA\firstoftwoarguments\else\@EA\secondoftwoarguments\fi} + +\letvalue{\??ss*}\empty -\def\symbolset#1{\executeifdefined{\??ss*#1}\empty} % no [#1], to be used in commalists etc +\def\symbolset#1{\csname\??ss*\ifcsname\??ss*#1\endcsname#1\fi\endcsname} % no [#1], to be used in commalists etc %D Since symbols are used frequently in interactive %D documents, we speed up this one. Well, that was history, @@ -84,8 +86,11 @@ \def\dodosymbol#1#2% \relax's prevent lookahead problems {\nosymbolfalse{\the\everysymbol\csname\??ss:#1:#2\endcsname\relax}\relax} +\letvalue{\??ss:}\firstofoneargument + \def\directsymbol#1#2% no \relax, there can be an argument, see lists - {\executeifdefined{\??ss:#1:#2}\firstofoneargument} + {%\executeifdefined{\??ss:#1:#2}\firstofoneargument} + \csname\??ss:\ifcsname\??ss:#1:#2\endcsname#1:#2\fi\endcsname} % We support both: % @@ -125,12 +130,8 @@ \fi} \def\redosymbol#1% -% {\doifinsymbolsetelse\empty{#1}{\dodosymbol\empty{#1}}{#1}} % more efficient: {\doifinsymbolsetelse\empty{#1}{\dodosymbol\empty}\firstofoneargument{#1}} -% % % % % -% this should go in symb-fig, to be loaded after core-fig - %D \macros %D {definefiguresymbol} %D @@ -163,12 +164,6 @@ \definesymbol[#1][{\dofiguresymbol[#2][#3]}]% \fi} -% but for the moment we keep it here -% % % % % % - -%\def\objectsymbol[#1]% -% {\dopresetfieldsymbol{#1}\dogetfieldsymbol{#1}} - %D \macros %D {doifsymboldefinedelse} %D @@ -233,7 +228,7 @@ \let\currentsymboldef\empty -\unexpanded\def\startsymbolset[#1] +\unexpanded\def\startsymbolset[#1]% {\def\currentsymboldef{#1}} \unexpanded\def\stopsymbolset @@ -255,23 +250,14 @@ %D %D \showsetup{showsymbolset} -\fetchruntimecommand \showsymbolset {\f!symbolprefix\s!run.mkiv} +\fetchruntimecommand \showsymbolset {\f!symbolprefix\s!run} %D \macros %D {usesymbols} %D %D \showsetup{usesymbols} -\def\dousesymbols#1% - {\makeshortfilename[\truefilename{\f!symbolprefix#1}]% - \startreadingfile - \readsysfile\shortfilename - {\showmessage\m!symbols1{#1}} - \donothing - \stopreadingfile} - -\def\usesymbols[#1]% - {\processcommalist[#1]\dousesymbols} +\def\usesymbols[#1]{\ctxcommand{usesymbols("#1")}} %D As longs as symbols are linked to levels or numbers, we can %D also use the conversion mechanism, but in for instance the diff --git a/Master/texmf-dist/tex/context/base/symb-jmn.mkii b/Master/texmf-dist/tex/context/base/symb-jmn.mkii new file mode 100644 index 00000000000..392cac55260 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/symb-jmn.mkii @@ -0,0 +1,199 @@ +%D \module +%D [ file=symb-jmn, +%D version=2004.08.02, +%D title=\CONTEXT\ Symbol Libraries, +%D subtitle=Special Navigational Symbols, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This file defines a few navigational symbol vectors. The font used +%D here is designed by Janusz M.~Nowacki, one of the Polish Font +%D Gurus who made this font specially for me, hence the name. If you +%D you want to meet its designer, come to Bachotek! In case you're +%D not familiar with his work, take a look at the Antikwa, Iwona and +%D Kurier fonts! +%D +%D \usesymbols[jmn] +%D +%D \showsymbolset[navigation 1] +%D \showsymbolset[navigation 3] +%D \showsymbolset[navigation 2] +%D \showsymbolset[navigation 4] +%D +%D \page +%D \showfont[NavigationNormal] +%D \page +%D \showfont[NavigationShadowed] +%D \page + +% needed: +% +% - inverted crossed +% - curved diamond + +\unprotect + +\loadmapfile[original-base.map] % \loadmapfile [original-context-symbol.map] + +\definefontsynonym[NavigationNormal] [hans] +\definefontsynonym[NavigationShadowed] [hans-sh] + +\definefontsynonym[NavigationFont] [NavigationNormal] +%definefontsynonym[NavigationFont] [NavigationShadowed] + +\def\NavigationGlyph#1{\getglyph{NavigationFont}{\char#1}} + +\unprotect + +\startsymbolset [navigation 1] + + \definesymbol [\v!previouspage] [\NavigationGlyph {65}] + \definesymbol [\v!PreviousJump] [\NavigationGlyph{128}] + \definesymbol [\v!firstpage] [\NavigationGlyph{129}] + + \definesymbol [\v!nextpage] [\NavigationGlyph {66}] + \definesymbol [\v!NextJump] [\NavigationGlyph{130}] + \definesymbol [\v!lastpage] [\NavigationGlyph{131}] + + \definesymbol [\v!CloseDocument] [\NavigationGlyph{160}] + + \definesymbol [\v!firstsubpage] [\NavigationGlyph{178}] + \definesymbol [\v!previoussubpage] [\NavigationGlyph{208}] + \definesymbol [\v!nextsubpage] [\NavigationGlyph{209}] + \definesymbol [\v!lastsubpage] [\NavigationGlyph{178}] + + \definesymbol [\v!StartSound] [\NavigationGlyph {66}] + \definesymbol [\v!PauseSound] [\NavigationGlyph{168}] + \definesymbol [\v!StopSound] [\NavigationGlyph{170}] + + \definesymbol [\v!StartMovie] [\NavigationGlyph {66}] + \definesymbol [\v!PauseMovie] [\NavigationGlyph{168}] + \definesymbol [\v!StopMovie] [\NavigationGlyph{170}] + + \definesymbol [\v!StartRendering] [\NavigationGlyph {66}] + \definesymbol [\v!PauseRendering] [\NavigationGlyph{168}] + \definesymbol [\v!StopRendering] [\NavigationGlyph{170}] + \definesymbol [\v!ResumeRendering] [\NavigationGlyph {66}] + +\stopsymbolset + +\startsymbolset [navigation 2] + + \definesymbol [\v!previouspage] [\NavigationGlyph {67}] + \definesymbol [\v!PreviousJump] [\NavigationGlyph{132}] + \definesymbol [\v!firstpage] [\NavigationGlyph{133}] + + \definesymbol [\v!nextpage] [\NavigationGlyph {68}] + \definesymbol [\v!NextJump] [\NavigationGlyph{134}] + \definesymbol [\v!lastpage] [\NavigationGlyph{135}] + + \definesymbol [\v!CloseDocument] [\NavigationGlyph{160}] + + \definesymbol [\v!firstsubpage] [\NavigationGlyph{176}] + \definesymbol [\v!previoussubpage] [\NavigationGlyph{210}] + \definesymbol [\v!nextsubpage] [\NavigationGlyph{211}] + \definesymbol [\v!lastsubpage] [\NavigationGlyph{176}] + + \definesymbol [\v!StartSound] [\NavigationGlyph {68}] + \definesymbol [\v!PauseSound] [\NavigationGlyph{170}] + \definesymbol [\v!StopSound] [\NavigationGlyph{168}] + + \definesymbol [\v!StartMovie] [\NavigationGlyph {68}] + \definesymbol [\v!PauseMovie] [\NavigationGlyph{170}] + \definesymbol [\v!StopMovie] [\NavigationGlyph{168}] + + \definesymbol [\v!StartRendering] [\NavigationGlyph {68}] + \definesymbol [\v!PauseRendering] [\NavigationGlyph{170}] + \definesymbol [\v!StopRendering] [\NavigationGlyph{168}] + \definesymbol [\v!ResumeRendering] [\NavigationGlyph {68}] + +\stopsymbolset + +\startsymbolset [navigation 3] + + \definesymbol [\v!previouspage] [\NavigationGlyph {73}] + \definesymbol [\v!PreviousJump] [\NavigationGlyph{144}] + \definesymbol [\v!firstpage] [\NavigationGlyph{145}] + + \definesymbol [\v!nextpage] [\NavigationGlyph {74}] + \definesymbol [\v!NextJump] [\NavigationGlyph{146}] + \definesymbol [\v!lastpage] [\NavigationGlyph{147}] + + \definesymbol [\v!CloseDocument] [\NavigationGlyph{160}] + + \definesymbol [\v!firstsubpage] [\NavigationGlyph{178}] + \definesymbol [\v!previoussubpage] [\NavigationGlyph{212}] + \definesymbol [\v!nextsubpage] [\NavigationGlyph{213}] + \definesymbol [\v!lastsubpage] [\NavigationGlyph{178}] + + \definesymbol [\v!StartSound] [\NavigationGlyph {73}] + \definesymbol [\v!PauseSound] [\NavigationGlyph{168}] + \definesymbol [\v!StopSound] [\NavigationGlyph{170}] + + \definesymbol [\v!StartMovie] [\NavigationGlyph {73}] + \definesymbol [\v!PauseMovie] [\NavigationGlyph{168}] + \definesymbol [\v!StopMovie] [\NavigationGlyph{170}] + + \definesymbol [\v!StartRendering] [\NavigationGlyph {73}] + \definesymbol [\v!PauseRendering] [\NavigationGlyph{168}] + \definesymbol [\v!StopRendering] [\NavigationGlyph{170}] + \definesymbol [\v!ResumeRendering] [\NavigationGlyph {73}] + +\stopsymbolset + +% 1 left : 065 067 073 075 +% 2 left : 128 132 144 148 +% 3 left : 129 133 145 149 + +% 1 right : 066 068 074 076 +% 2 right : 130 134 146 150 +% 3 right : 131 135 147 151 + +% crossed : 160 160 160 160 +% opened : 152 152 156 156 +% closed : 154 154 158 158 + +% larrow : 208 210 212 214 +% rarrow : 209 211 213 215 +% barrow : 178 178 178 178 +% ocircle : 168 168 168 168 +% ccircle : 170 170 170 170 + +\startsymbolset [navigation 4] + + \definesymbol [\v!previouspage] [\NavigationGlyph {75}] + \definesymbol [\v!PreviousJump] [\NavigationGlyph{148}] + \definesymbol [\v!firstpage] [\NavigationGlyph{149}] + + \definesymbol [\v!nextpage] [\NavigationGlyph {76}] + \definesymbol [\v!NextJump] [\NavigationGlyph{150}] + \definesymbol [\v!lastpage] [\NavigationGlyph{151}] + + \definesymbol [\v!CloseDocument] [\NavigationGlyph{160}] + + \definesymbol [\v!firstsubpage] [\NavigationGlyph{176}] + \definesymbol [\v!previoussubpage] [\NavigationGlyph{214}] + \definesymbol [\v!nextsubpage] [\NavigationGlyph{215}] + \definesymbol [\v!lastsubpage] [\NavigationGlyph{176}] + + \definesymbol [\v!StartSound] [\NavigationGlyph {75}] + \definesymbol [\v!PauseSound] [\NavigationGlyph{170}] + \definesymbol [\v!StopSound] [\NavigationGlyph{168}] + + \definesymbol [\v!StartMovie] [\NavigationGlyph {75}] + \definesymbol [\v!PauseMovie] [\NavigationGlyph{170}] + \definesymbol [\v!StopMovie] [\NavigationGlyph{168}] + + \definesymbol [\v!StartRendering] [\NavigationGlyph {75}] + \definesymbol [\v!PauseRendering] [\NavigationGlyph{170}] + \definesymbol [\v!StopRendering] [\NavigationGlyph{168}] + \definesymbol [\v!ResumeRendering] [\NavigationGlyph {75}] + +\stopsymbolset + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/symb-jmn.mkiv b/Master/texmf-dist/tex/context/base/symb-jmn.mkiv new file mode 100644 index 00000000000..593e3e375bf --- /dev/null +++ b/Master/texmf-dist/tex/context/base/symb-jmn.mkiv @@ -0,0 +1,196 @@ +%D \module +%D [ file=symb-jmn, +%D version=2004.08.02, +%D title=\CONTEXT\ Symbol Libraries, +%D subtitle=Special Navigational Symbols, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This file defines a few navigational symbol vectors. The font used +%D here is designed by Janusz M.~Nowacki, one of the Polish Font +%D Gurus who made this font specially for me, hence the name. If you +%D you want to meet its designer, come to Bachotek! In case you're +%D not familiar with his work, take a look at the Antikwa, Iwona and +%D Kurier fonts! +%D +%D \usesymbols[jmn] +%D +%D \showsymbolset[navigation 1] +%D \showsymbolset[navigation 3] +%D \showsymbolset[navigation 2] +%D \showsymbolset[navigation 4] +%D +%D \page +%D \showfont[NavigationNormal] +%D \page +%D \showfont[NavigationShadowed] +%D \page + +% needed: +% +% - inverted crossed +% - curved diamond +% - begin/end bars + +\unprotect + +\definefontsynonym[NavigationNormal] [hans] +\definefontsynonym[NavigationShadowed] [hans-sh] + +\definefontsynonym[NavigationFont] [NavigationNormal] +%definefontsynonym[NavigationFont] [NavigationShadowed] + +\def\NavigationGlyph{\getnamedglyphdirect{NavigationFont}} % #1 + +\unprotect + +% lowercase up/down + +\startsymbolset [navigation 1] + + \definesymbol [\v!PreviousJump] [\NavigationGlyph{CC}] + \definesymbol [\v!NextJump] [\NavigationGlyph{DD}] + \definesymbol [\v!CloseDocument] [\NavigationGlyph{M}] + + \definesymbol [\v!firstpage] [\NavigationGlyph{CCC}] + \definesymbol [\v!previouspage] [\NavigationGlyph{C}] + \definesymbol [\v!nextpage] [\NavigationGlyph{D}] + \definesymbol [\v!lastpage] [\NavigationGlyph{DDD}] + + \definesymbol [\v!firstsubpage] [\NavigationGlyph{ccc}] + \definesymbol [\v!previoussubpage] [\NavigationGlyph{c}] + \definesymbol [\v!nextsubpage] [\NavigationGlyph{d}] + \definesymbol [\v!lastsubpage] [\NavigationGlyph{ddd}] + + \definesymbol [\v!StartSound] [\NavigationGlyph{D}] + \definesymbol [\v!PauseSound] [\NavigationGlyph{YY}] + \definesymbol [\v!StopSound] [\NavigationGlyph{M}] + + \definesymbol [\v!StartMovie] [\NavigationGlyph{D}] + \definesymbol [\v!PauseMovie] [\NavigationGlyph{YY}] + \definesymbol [\v!StopMovie] [\NavigationGlyph{M}] + + \definesymbol [\v!StartRendering] [\NavigationGlyph{D}] + \definesymbol [\v!PauseRendering] [\NavigationGlyph{YY}] + \definesymbol [\v!StopRendering] [\NavigationGlyph{M}] + \definesymbol [\v!ResumeRendering] [\NavigationGlyph{D}] + +\stopsymbolset + +\startsymbolset [navigation 2] + + \definesymbol [\v!PreviousJump] [\NavigationGlyph{AA}] + \definesymbol [\v!NextJump] [\NavigationGlyph{BB}] + \definesymbol [\v!CloseDocument] [\NavigationGlyph{N}] + + \definesymbol [\v!firstpage] [\NavigationGlyph{AAA}] + \definesymbol [\v!previouspage] [\NavigationGlyph{A}] + \definesymbol [\v!nextpage] [\NavigationGlyph{B}] + \definesymbol [\v!lastpage] [\NavigationGlyph{BBB}] + + \definesymbol [\v!firstsubpage] [\NavigationGlyph{aaa}] + \definesymbol [\v!previoussubpage] [\NavigationGlyph{a}] + \definesymbol [\v!nextsubpage] [\NavigationGlyph{b}] + \definesymbol [\v!lastsubpage] [\NavigationGlyph{bbb}] + + \definesymbol [\v!StartSound] [\NavigationGlyph{B}] + \definesymbol [\v!PauseSound] [\NavigationGlyph{XX}] + \definesymbol [\v!StopSound] [\NavigationGlyph{N}] + + \definesymbol [\v!StartMovie] [\NavigationGlyph{B}] + \definesymbol [\v!PauseMovie] [\NavigationGlyph{XX}] + \definesymbol [\v!StopMovie] [\NavigationGlyph{N}] + + \definesymbol [\v!StartRendering] [\NavigationGlyph{B}] + \definesymbol [\v!PauseRendering] [\NavigationGlyph{XX}] + \definesymbol [\v!StopRendering] [\NavigationGlyph{N}] + \definesymbol [\v!ResumeRendering] [\NavigationGlyph{B}] + +\stopsymbolset + +\startsymbolset [navigation 3] + + \definesymbol [\v!PreviousJump] [\NavigationGlyph{KK}] + \definesymbol [\v!NextJump] [\NavigationGlyph{LL}] + \definesymbol [\v!CloseDocument] [\NavigationGlyph{M}] + + \definesymbol [\v!firstpage] [\NavigationGlyph{KKK}] + \definesymbol [\v!previouspage] [\NavigationGlyph{K}] + \definesymbol [\v!nextpage] [\NavigationGlyph{L}] + \definesymbol [\v!lastpage] [\NavigationGlyph{LLL}] + + \definesymbol [\v!firstsubpage] [\NavigationGlyph{kkk}] + \definesymbol [\v!previoussubpage] [\NavigationGlyph{k}] + \definesymbol [\v!nextsubpage] [\NavigationGlyph{l}] + \definesymbol [\v!lastsubpage] [\NavigationGlyph{lll}] + + \definesymbol [\v!StartSound] [\NavigationGlyph{L}] + \definesymbol [\v!PauseSound] [\NavigationGlyph{YY}] + \definesymbol [\v!StopSound] [\NavigationGlyph{M}] + + \definesymbol [\v!StartMovie] [\NavigationGlyph{L}] + \definesymbol [\v!PauseMovie] [\NavigationGlyph{YY}] + \definesymbol [\v!StopMovie] [\NavigationGlyph{M}] + + \definesymbol [\v!StartRendering] [\NavigationGlyph{L}] + \definesymbol [\v!PauseRendering] [\NavigationGlyph{YY}] + \definesymbol [\v!StopRendering] [\NavigationGlyph{M}] + \definesymbol [\v!ResumeRendering] [\NavigationGlyph{L}] + +\stopsymbolset + +\startsymbolset [navigation 4] + + \definesymbol [\v!PreviousJump] [\NavigationGlyph{II}] + \definesymbol [\v!NextJump] [\NavigationGlyph{JJ}] + \definesymbol [\v!CloseDocument] [\NavigationGlyph{N}] + + \definesymbol [\v!firstpage] [\NavigationGlyph{III}] + \definesymbol [\v!previouspage] [\NavigationGlyph{I}] + \definesymbol [\v!nextpage] [\NavigationGlyph{J}] + \definesymbol [\v!lastpage] [\NavigationGlyph{JJJ}] + + \definesymbol [\v!firstsubpage] [\NavigationGlyph{iii}] + \definesymbol [\v!previoussubpage] [\NavigationGlyph{i}] + \definesymbol [\v!nextsubpage] [\NavigationGlyph{j}] + \definesymbol [\v!lastsubpage] [\NavigationGlyph{jjj}] + + \definesymbol [\v!StartSound] [\NavigationGlyph{J}] + \definesymbol [\v!PauseSound] [\NavigationGlyph{XX}] + \definesymbol [\v!StopSound] [\NavigationGlyph{N}] + + \definesymbol [\v!StartMovie] [\NavigationGlyph{J}] + \definesymbol [\v!PauseMovie] [\NavigationGlyph{XX}] + \definesymbol [\v!StopMovie] [\NavigationGlyph{N}] + + \definesymbol [\v!StartRendering] [\NavigationGlyph{J}] + \definesymbol [\v!PauseRendering] [\NavigationGlyph{XX}] + \definesymbol [\v!StopRendering] [\NavigationGlyph{N}] + \definesymbol [\v!ResumeRendering] [\NavigationGlyph{J}] + +\stopsymbolset + +% 1 left : 065 067 073 075 +% 2 left : 128 132 144 148 +% 3 left : 129 133 145 149 + +% 1 right : 066 068 074 076 +% 2 right : 130 134 146 150 +% 3 right : 131 135 147 151 + +% crossed : 160 160 160 160 +% opened : 152 152 156 156 +% closed : 154 154 158 158 + +% larrow : 208 210 212 214 +% rarrow : 209 211 213 215 +% barrow : 178 178 178 178 +% ocircle : 168 168 168 168 +% ccircle : 170 170 170 170 + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/symb-jmn.tex b/Master/texmf-dist/tex/context/base/symb-jmn.tex deleted file mode 100644 index 1ed65d16e60..00000000000 --- a/Master/texmf-dist/tex/context/base/symb-jmn.tex +++ /dev/null @@ -1,204 +0,0 @@ -%D \module -%D [ file=symb-jmn, -%D version=2004.08.02, -%D title=\CONTEXT\ Symbol Libraries, -%D subtitle=Special Navigational Symbols, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright=PRAGMA ADE] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -%D This file defines a few navigational symbol vectors. The font used -%D here is designed by Janusz M.~Nowacki, one of the Polish Font -%D Gurus who made this font specially for me, hence the name. If you -%D you want to meet its designer, come to Bachotek! In case you're -%D not familiar with his work, take a look at the Antikwa, Iwona and -%D Kurier fonts! -%D -%D \usesymbols[jmn] -%D -%D \showsymbolset[navigation 1] -%D \showsymbolset[navigation 3] -%D \showsymbolset[navigation 2] -%D \showsymbolset[navigation 4] -%D -%D \page -%D \showfont[NavigationNormal] -%D \page -%D \showfont[NavigationShadowed] -%D \page - -% needed: -% -% - inverted crossed -% - curved diamond - -\unprotect - -\loadmapfile[original-base.map] % \loadmapfile [original-context-symbol.map] - -\ifnum\texengine=\luatexengine - \definefontsynonym[NavigationNormal] [hans.tfm] - \definefontsynonym[NavigationShadowed] [hans-sh.tfm] -\else - \definefontsynonym[NavigationNormal] [hans] - \definefontsynonym[NavigationShadowed] [hans-sh] -\fi - -\definefontsynonym[NavigationFont] [NavigationNormal] -%definefontsynonym[NavigationFont] [NavigationShadowed] - -\def\NavigationGlyph#1{\getglyph{NavigationFont}{\char#1}} - -\unprotect - -\startsymbolset [navigation 1] - - \definesymbol [\v!previouspage] [\NavigationGlyph {65}] - \definesymbol [\v!PreviousJump] [\NavigationGlyph{128}] - \definesymbol [\v!firstpage] [\NavigationGlyph{129}] - - \definesymbol [\v!nextpage] [\NavigationGlyph {66}] - \definesymbol [\v!NextJump] [\NavigationGlyph{130}] - \definesymbol [\v!lastpage] [\NavigationGlyph{131}] - - \definesymbol [\v!CloseDocument] [\NavigationGlyph{160}] - - \definesymbol [\v!firstsubpage] [\NavigationGlyph{178}] - \definesymbol [\v!previoussubpage] [\NavigationGlyph{208}] - \definesymbol [\v!nextsubpage] [\NavigationGlyph{209}] - \definesymbol [\v!lastsubpage] [\NavigationGlyph{178}] - - \definesymbol [\v!StartSound] [\NavigationGlyph {66}] - \definesymbol [\v!PauseSound] [\NavigationGlyph{168}] - \definesymbol [\v!StopSound] [\NavigationGlyph{170}] - - \definesymbol [\v!StartMovie] [\NavigationGlyph {66}] - \definesymbol [\v!PauseMovie] [\NavigationGlyph{168}] - \definesymbol [\v!StopMovie] [\NavigationGlyph{170}] - - \definesymbol [\v!StartRendering] [\NavigationGlyph {66}] - \definesymbol [\v!PauseRendering] [\NavigationGlyph{168}] - \definesymbol [\v!StopRendering] [\NavigationGlyph{170}] - \definesymbol [\v!ResumeRendering] [\NavigationGlyph {66}] - -\stopsymbolset - -\startsymbolset [navigation 2] - - \definesymbol [\v!previouspage] [\NavigationGlyph {67}] - \definesymbol [\v!PreviousJump] [\NavigationGlyph{132}] - \definesymbol [\v!firstpage] [\NavigationGlyph{133}] - - \definesymbol [\v!nextpage] [\NavigationGlyph {68}] - \definesymbol [\v!NextJump] [\NavigationGlyph{134}] - \definesymbol [\v!lastpage] [\NavigationGlyph{135}] - - \definesymbol [\v!CloseDocument] [\NavigationGlyph{160}] - - \definesymbol [\v!firstsubpage] [\NavigationGlyph{176}] - \definesymbol [\v!previoussubpage] [\NavigationGlyph{210}] - \definesymbol [\v!nextsubpage] [\NavigationGlyph{211}] - \definesymbol [\v!lastsubpage] [\NavigationGlyph{176}] - - \definesymbol [\v!StartSound] [\NavigationGlyph {68}] - \definesymbol [\v!PauseSound] [\NavigationGlyph{170}] - \definesymbol [\v!StopSound] [\NavigationGlyph{168}] - - \definesymbol [\v!StartMovie] [\NavigationGlyph {68}] - \definesymbol [\v!PauseMovie] [\NavigationGlyph{170}] - \definesymbol [\v!StopMovie] [\NavigationGlyph{168}] - - \definesymbol [\v!StartRendering] [\NavigationGlyph {68}] - \definesymbol [\v!PauseRendering] [\NavigationGlyph{170}] - \definesymbol [\v!StopRendering] [\NavigationGlyph{168}] - \definesymbol [\v!ResumeRendering] [\NavigationGlyph {68}] - -\stopsymbolset - -\startsymbolset [navigation 3] - - \definesymbol [\v!previouspage] [\NavigationGlyph {73}] - \definesymbol [\v!PreviousJump] [\NavigationGlyph{144}] - \definesymbol [\v!firstpage] [\NavigationGlyph{145}] - - \definesymbol [\v!nextpage] [\NavigationGlyph {74}] - \definesymbol [\v!NextJump] [\NavigationGlyph{146}] - \definesymbol [\v!lastpage] [\NavigationGlyph{147}] - - \definesymbol [\v!CloseDocument] [\NavigationGlyph{160}] - - \definesymbol [\v!firstsubpage] [\NavigationGlyph{178}] - \definesymbol [\v!previoussubpage] [\NavigationGlyph{212}] - \definesymbol [\v!nextsubpage] [\NavigationGlyph{213}] - \definesymbol [\v!lastsubpage] [\NavigationGlyph{178}] - - \definesymbol [\v!StartSound] [\NavigationGlyph {73}] - \definesymbol [\v!PauseSound] [\NavigationGlyph{168}] - \definesymbol [\v!StopSound] [\NavigationGlyph{170}] - - \definesymbol [\v!StartMovie] [\NavigationGlyph {73}] - \definesymbol [\v!PauseMovie] [\NavigationGlyph{168}] - \definesymbol [\v!StopMovie] [\NavigationGlyph{170}] - - \definesymbol [\v!StartRendering] [\NavigationGlyph {73}] - \definesymbol [\v!PauseRendering] [\NavigationGlyph{168}] - \definesymbol [\v!StopRendering] [\NavigationGlyph{170}] - \definesymbol [\v!ResumeRendering] [\NavigationGlyph {73}] - -\stopsymbolset - -% 1 left : 065 067 073 075 -% 2 left : 128 132 144 148 -% 3 left : 129 133 145 149 - -% 1 right : 066 068 074 076 -% 2 right : 130 134 146 150 -% 3 right : 131 135 147 151 - -% crossed : 160 160 160 160 -% opened : 152 152 156 156 -% closed : 154 154 158 158 - -% larrow : 208 210 212 214 -% rarrow : 209 211 213 215 -% barrow : 178 178 178 178 -% ocircle : 168 168 168 168 -% ccircle : 170 170 170 170 - -\startsymbolset [navigation 4] - - \definesymbol [\v!previouspage] [\NavigationGlyph {75}] - \definesymbol [\v!PreviousJump] [\NavigationGlyph{148}] - \definesymbol [\v!firstpage] [\NavigationGlyph{149}] - - \definesymbol [\v!nextpage] [\NavigationGlyph {76}] - \definesymbol [\v!NextJump] [\NavigationGlyph{150}] - \definesymbol [\v!lastpage] [\NavigationGlyph{151}] - - \definesymbol [\v!CloseDocument] [\NavigationGlyph{160}] - - \definesymbol [\v!firstsubpage] [\NavigationGlyph{176}] - \definesymbol [\v!previoussubpage] [\NavigationGlyph{214}] - \definesymbol [\v!nextsubpage] [\NavigationGlyph{215}] - \definesymbol [\v!lastsubpage] [\NavigationGlyph{176}] - - \definesymbol [\v!StartSound] [\NavigationGlyph {75}] - \definesymbol [\v!PauseSound] [\NavigationGlyph{170}] - \definesymbol [\v!StopSound] [\NavigationGlyph{168}] - - \definesymbol [\v!StartMovie] [\NavigationGlyph {75}] - \definesymbol [\v!PauseMovie] [\NavigationGlyph{170}] - \definesymbol [\v!StopMovie] [\NavigationGlyph{168}] - - \definesymbol [\v!StartRendering] [\NavigationGlyph {75}] - \definesymbol [\v!PauseRendering] [\NavigationGlyph{170}] - \definesymbol [\v!StopRendering] [\NavigationGlyph{168}] - \definesymbol [\v!ResumeRendering] [\NavigationGlyph {75}] - -\stopsymbolset - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/symb-mis.mkii b/Master/texmf-dist/tex/context/base/symb-mis.mkii new file mode 100644 index 00000000000..9921fa94fb1 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/symb-mis.mkii @@ -0,0 +1,139 @@ +%D \module +%D [ file=symb-mis, +%D version=2002.05.07, +%D title=\CONTEXT\ Symbol Libraries, +%D subtitle=Miscelaneous, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +%D We predefine some common symbols and conversions that will +%D be understood by many commands. + +% \mathematics no longer needed, although only math fonts might have these + +\definesymbol [\v!none] [] +\definesymbol [bullet] [\mathematics{\bullet}] +\definesymbol [dash] [\mathematics{-}] +\definesymbol [star] [\mathematics{\star}] +\definesymbol [triangle] [\mathematics{\triangleright}] +\definesymbol [circle] [\mathematics{\circ}] +\definesymbol [square] [\mathematics{\square}] +\definesymbol [diamond] [\mathematics{\diamond}] + +\definesymbol [smallcircle] [\hbox{\raise.1ex\hbox{\mathematics{\scriptscriptstyle\bigcirc}}}] +\definesymbol [medcircle] [\hbox{\raise.1ex\hbox{\mathematics{\scriptstyle \bigcirc}}}] +\definesymbol [bigcircle] [\mathematics{\bigcirc}] + +\definesymbol [1] [\symbol{bullet}] +\definesymbol [2] [\symbol{dash}] +\definesymbol [3] [\symbol{star}] +\definesymbol [4] [\symbol{triangle}] +\definesymbol [5] [\symbol{circle}] +\definesymbol [6] [\symbol{medcircle}] +\definesymbol [7] [\symbol{bigcircle}] +\definesymbol [8] [\symbol{square}] + +%D Special hyperlinks, namely those to pages or navigational +%D properties, are associated with symbols. + +\definesymbol [\v!firstpage] [\gotobegincharacter] +\definesymbol [\v!previouspage] [\gobackwardcharacter] +\definesymbol [\v!nextpage] [\goforwardcharacter] +\definesymbol [\v!lastpage] [\gotoendcharacter] +\definesymbol [\v!firstsubpage] [\gotobegincharacter] +\definesymbol [\v!previoussubpage] [\gobackwardcharacter] +\definesymbol [\v!nextsubpage] [\goforwardcharacter] +\definesymbol [\v!lastsubpage] [\gotoendcharacter] +\definesymbol [\v!PreviousJump] [\gobackjumpcharacter] +\definesymbol [\v!NextJump] [\goforjumpcharacter] +\definesymbol [\v!CloseDocument] [\closecharacter] + +\definesymbol [\v!first] [\symbol{\v!firstpage}] +\definesymbol [\v!previous] [\symbol{\v!previouspage}] +\definesymbol [\v!next] [\symbol{\v!nextpage}] +\definesymbol [\v!last] [\symbol{\v!lastpage}] +\definesymbol [\v!somewhere] [\gotosomewherecharacter] +\definesymbol [\v!nowhere] [\gonowherecharacter] + +\definesymbol [\v!backward] [\symbol{\v!previouspage}] +\definesymbol [\v!forward] [\symbol{\v!nextpage}] + +%D The next two symbols (\symbol[P] and \symbol[S]) are +%D variations in their math counterparts. The following ones +%D {\em do} scale. + +% todo : hook this into \textsection + +\definesymbol [S] [\getglyph{MathSymbol}{\char"78}] +\definesymbol [P] [\getglyph{MathSymbol}{\char"7B}] + +%D These symbols are taken from the Computer Moders Roman +%D symbol set or, when present, from the additional symbols of +%D the American Mathematical Society. Of course one can use +%D his or her own symbols by redefining them. + +\def\dogotocharacter#1#2#3% + {\ifx#1\undefined#2\else#3\fi} + +\def\gotobegincharacter + {\hbox + {\dogotocharacter\blacktriangleleft + {\setbox0\hbox{\mathematics{\triangleleft}}% + \vrule\!!width.085ex\!!height1.075\ht0\!!depth\dp0 + \kern-.11ex\box0} + {\setbox0\hbox{\mathematics{\blacktriangleleft}}% + \setbox2\hbox{\vrule\!!height\ht0\!!depth\dp0\!!width.25ex}% + \hbox{\lower.03ex\box2\kern-.35ex\box0}}}} + +\def\gotoendcharacter + {\hbox + {\dogotocharacter\blacktriangleright + {\setbox0\hbox{\mathematics{\triangleright}}% + \copy0\kern-.11ex + \vrule\!!width.085ex\!!height1.075\ht0\!!depth\dp0} + {\setbox0\hbox{\mathematics{\blacktriangleright}}% + \setbox2\hbox{\vrule\!!height\ht0\!!depth\dp0\!!width.25ex}% + \hbox{\box0\kern-.35ex\lower.03ex\box2}}}} + +\def\gobackwardcharacter + {\mathematics{\dogotocharacter\blacktriangleright\triangleleft\blacktriangleleft}} + +\def\goforwardcharacter + {\mathematics{\dogotocharacter\blacktriangleright\triangleright\blacktriangleright}} + +\def\gonowherecharacter + {\mathematics{\bullet}} + +\def\gotosomewherecharacter + {{\hbox{\hsmash{\symbol[\v!previous]}\symbol[\v!next]}}} + +\unexpanded\def\closecharacter + {\dogotocharacter\boxtimes + {\ruledhbox{\mathematics{\times}}} + {\mathematics{\boxtimes}}} + +\def\goforjumpcharacter + {\hbox{\goforwardcharacter \kern-.5em\goforwardcharacter}} + +\def\gobackjumpcharacter + {\hbox{\gobackwardcharacter\kern-.5em\gobackwardcharacter}} + +%D The next two symbols are for Daniel Flipo: + +\ifx\high \undefined \let\high \firstofoneargument \fi % todo +\ifx\notsmallcapped\undefined \let\notsmallcapped\firstofoneargument \fi % todo + +\definesymbol [Numero] [N\high{\notsmallcapped{o}\kern.2em}] +\definesymbol [numero] [n\high{\notsmallcapped{o}\kern.2em}] + +\def\Numero{\symbol[Numero]} +\def\numero{\symbol[numero]} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/symb-mis.mkiv b/Master/texmf-dist/tex/context/base/symb-mis.mkiv new file mode 100644 index 00000000000..612886daa37 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/symb-mis.mkiv @@ -0,0 +1,76 @@ +%D \module +%D [ file=symb-mis, +%D version=2002.05.07, +%D title=\CONTEXT\ Symbol Libraries, +%D subtitle=Miscelaneous, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +%D We predefine some common symbols and conversions that will +%D be understood by many commands. The \type {\mathematics} +%D is no longer needed, although only math fonts might have +%D these symbols. + +\definesymbol [\v!none] [] + +\definesymbol [bullet] [\mathematics{\bullet}] +\definesymbol [dash] [\mathematics{-}] +\definesymbol [star] [\mathematics{\star}] +\definesymbol [triangle] [\mathematics{\triangleright}] +\definesymbol [circle] [\mathematics{\circ}] +\definesymbol [square] [\mathematics{\square}] +\definesymbol [diamond] [\mathematics{\diamond}] + +% I'm not sure about this ... I dislike the small bullet. So we provide +% it as variant: \type {\setupsymbolset[text]}. Also, we want to be +% backward compatible. + +\startsymbolset[text] + + \definesymbol [bullet] [\textormathchar{"2022}] % • \bullet + \definesymbol [dash] [\textormathchar{"2013}] % – + \definesymbol [star] [\textormathchar{"22C6}] % ✴ \star + \definesymbol [triangle] [\textormathchar{"22B3}] % ⊳ \triangleright + \definesymbol [circle] [\textormathchar{"2218}] % ∘ \circ + \definesymbol [square] [\textormathchar{"25A1}] % □ \square + \definesymbol [diamond] [\textormathchar{"22C4}] % ⋄ \diamond + \definesymbol [checkmark] [\textormathchar{"2713}] % ✓ \checkmark + + \definesymbol [blacktriangle] [\textormathchar{"25B6}] % ▶ + \definesymbol [blacksquare] [\textormathchar{"25A0}] % ■ + \definesymbol [blackdiamond] [\textormathchar{"25C6}] % ◆ + +\stopsymbolset + +\definesymbol [smallcircle] [\hbox{\raise.1ex\hbox{\mathematics{\scriptscriptstyle\bigcirc}}}] +\definesymbol [medcircle] [\hbox{\raise.1ex\hbox{\mathematics{\scriptstyle \bigcirc}}}] +\definesymbol [bigcircle] [\mathematics{\bigcirc}] + +\definesymbol [1] [\symbol{bullet}] +\definesymbol [2] [\symbol{dash}] +\definesymbol [3] [\symbol{star}] +\definesymbol [4] [\symbol{triangle}] +\definesymbol [5] [\symbol{circle}] +\definesymbol [6] [\symbol{medcircle}] +\definesymbol [7] [\symbol{bigcircle}] +\definesymbol [8] [\symbol{square}] + +\definesymbol [S] [\sectionmark] +\definesymbol [P] [\paragraphmark] +\definesymbol [Numero] [\textnumero] +\definesymbol [numero] [\textnumero] +\definesymbol [euro] [\texteuro] + +\let\euro\texteuro + +\def\Numero{\symbol[Numero]} % obsolete +\def\numero{\symbol[numero]} % obsolete + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/symb-mis.tex b/Master/texmf-dist/tex/context/base/symb-mis.tex deleted file mode 100644 index d108b89028e..00000000000 --- a/Master/texmf-dist/tex/context/base/symb-mis.tex +++ /dev/null @@ -1,139 +0,0 @@ -%D \module -%D [ file=symb-mis, -%D version=2002.05.07, -%D title=\CONTEXT\ Symbol Libraries, -%D subtitle=Miscelaneous, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright=PRAGMA-ADE] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\unprotect - -%D We predefine some common symbols and conversions that will -%D be understood by many commands. - -% \mathematics no longer needed, although only math fonts might have these - -\definesymbol [\v!none] [] -\definesymbol [bullet] [\mathematics{\bullet}] -\definesymbol [dash] [\mathematics{-}] -\definesymbol [star] [\mathematics{\star}] -\definesymbol [triangle] [\mathematics{\triangleright}] -\definesymbol [circle] [\mathematics{\circ}] -\definesymbol [square] [\mathematics{\square}] -\definesymbol [diamond] [\mathematics{\diamond}] - -\definesymbol [smallcircle] [\hbox{\raise.1ex\hbox{\mathematics{\scriptscriptstyle\bigcirc}}}] -\definesymbol [medcircle] [\hbox{\raise.1ex\hbox{\mathematics{\scriptstyle \bigcirc}}}] -\definesymbol [bigcircle] [\mathematics{\bigcirc}] - -\definesymbol [1] [{\symbol[bullet]}] -\definesymbol [2] [{\symbol[dash]}] -\definesymbol [3] [{\symbol[star]}] -\definesymbol [4] [{\symbol[triangle]}] -\definesymbol [5] [{\symbol[circle]}] -\definesymbol [6] [{\symbol[medcircle]}] -\definesymbol [7] [{\symbol[bigcircle]}] -\definesymbol [8] [{\symbol[square]}] - -%D Special hyperlinks, namely those to pages or navigational -%D properties, are associated with symbols. - -\definesymbol [\v!firstpage] [\gotobegincharacter] -\definesymbol [\v!previouspage] [\gobackwardcharacter] -\definesymbol [\v!nextpage] [\goforwardcharacter] -\definesymbol [\v!lastpage] [\gotoendcharacter] -\definesymbol [\v!firstsubpage] [\gotobegincharacter] -\definesymbol [\v!previoussubpage] [\gobackwardcharacter] -\definesymbol [\v!nextsubpage] [\goforwardcharacter] -\definesymbol [\v!lastsubpage] [\gotoendcharacter] -\definesymbol [\v!PreviousJump] [\gobackjumpcharacter] -\definesymbol [\v!NextJump] [\goforjumpcharacter] -\definesymbol [\v!CloseDocument] [\closecharacter] - -\definesymbol [\v!first] [{\symbol[\v!firstpage]}] -\definesymbol [\v!previous] [{\symbol[\v!previouspage]}] -\definesymbol [\v!next] [{\symbol[\v!nextpage]}] -\definesymbol [\v!last] [{\symbol[\v!lastpage]}] -\definesymbol [\v!somewhere] [\gotosomewherecharacter] -\definesymbol [\v!nowhere] [\gonowherecharacter] - -\definesymbol [\v!backward] [{\symbol[\v!previouspage]}] -\definesymbol [\v!forward] [{\symbol[\v!nextpage]}] - -%D The next two symbols (\symbol[P] and \symbol[S]) are -%D variations in their math counterparts. The following ones -%D {\em do} scale. - -% todo : hook this into \textsection - -\definesymbol [S] [\getglyph{MathSymbol}{\char"78}] -\definesymbol [P] [\getglyph{MathSymbol}{\char"7B}] - -%D These symbols are taken from the Computer Moders Roman -%D symbol set or, when present, from the additional symbols of -%D the American Mathematical Society. Of course one can use -%D his or her own symbols by redefining them. - -\def\dogotocharacter#1#2#3% - {\ifx#1\undefined#2\else#3\fi} - -\def\gotobegincharacter - {\hbox - {\dogotocharacter\blacktriangleleft - {\setbox0\hbox{\mathematics{\triangleleft}}% - \vrule\!!width.085ex\!!height1.075\ht0\!!depth\dp0 - \kern-.11ex\box0} - {\setbox0\hbox{\mathematics{\blacktriangleleft}}% - \setbox2\hbox{\vrule\!!height\ht0\!!depth\dp0\!!width.25ex}% - \hbox{\lower.03ex\box2\kern-.35ex\box0}}}} - -\def\gotoendcharacter - {\hbox - {\dogotocharacter\blacktriangleright - {\setbox0\hbox{\mathematics{\triangleright}}% - \copy0\kern-.11ex - \vrule\!!width.085ex\!!height1.075\ht0\!!depth\dp0} - {\setbox0\hbox{\mathematics{\blacktriangleright}}% - \setbox2\hbox{\vrule\!!height\ht0\!!depth\dp0\!!width.25ex}% - \hbox{\box0\kern-.35ex\lower.03ex\box2}}}} - -\def\gobackwardcharacter - {\mathematics{\dogotocharacter\blacktriangleright\triangleleft\blacktriangleleft}} - -\def\goforwardcharacter - {\mathematics{\dogotocharacter\blacktriangleright\triangleright\blacktriangleright}} - -\def\gonowherecharacter - {\mathematics{\bullet}} - -\def\gotosomewherecharacter - {{\hbox{\hsmash{\symbol[\v!previous]}\symbol[\v!next]}}} - -\unexpanded\def\closecharacter - {\dogotocharacter\boxtimes - {\ruledhbox{\mathematics{\times}}} - {\mathematics{\boxtimes}}} - -\def\goforjumpcharacter - {\hbox{\goforwardcharacter \kern-.5em\goforwardcharacter}} - -\def\gobackjumpcharacter - {\hbox{\gobackwardcharacter\kern-.5em\gobackwardcharacter}} - -%D The next two symbols are for Daniel Flipo: - -\ifx\high \undefined \let\high \firstofoneargument \fi % todo -\ifx\notsmallcapped\undefined \let\notsmallcapped\firstofoneargument \fi % todo - -\definesymbol [Numero] [N\high{\notsmallcapped{o}\kern.2em}] -\definesymbol [numero] [n\high{\notsmallcapped{o}\kern.2em}] - -\def\Numero{\symbol[Numero]} -\def\numero{\symbol[numero]} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/symb-mvs.mkii b/Master/texmf-dist/tex/context/base/symb-mvs.mkii new file mode 100644 index 00000000000..1dd3da0a00c --- /dev/null +++ b/Master/texmf-dist/tex/context/base/symb-mvs.mkii @@ -0,0 +1,217 @@ +%D \module +%D [ file=symb-mvs, +%D version=2000.03.30, +%D title=\CONTEXT\ Symbol Libraries, +%D subtitle=Martin Vogels Symbole, +%D author=Tobias Burnus \& Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This module implements the Martin Vogel Symbole font +%D (marvosym). The names are derived from the \LATEX\ package +%D \type {marvosym} of Thomas Henlich. The symbols are +%D available as Type~1 font and are included in \TETEX\ and +%D \FPTEX\ distributions. +%D +%D This symbol font offers the signs of the zodiac, four +%D alternative the euro signs, some general office signs and +%D some more. +%D +%D The font was designed by Martin Vogel who can be reached at +%D \hyphenatedurl {martin.vogel@fh-bochum.de}. More information +%D can be found at \hyphenatedurl +%D {http://www.fh-bochum.de/fb1/vogel/marvosym.html}. The +%D conversion to Type~1 font was done by Thomas Henlich, who +%D can be reached at \hyphenatedurl +%D {thenlich@rcs.urz.tu-dresden.de}. +%D +%D This module is based on the current \CTAN\ version (as of +%D March 30, 2000) and is older than the TrueType version at +%D Martin Vogel's Homepage. The definitions in this module +%D reflect the \CTAN\ version. The font conversion was done by +%D Thomas Henlich using \type {ttf2pt1}, a program that can be +%D found at \hyphenatedurl +%D {http://www.netspace.net.au/~mheath/ttf2pt1/}. +%D +%D Using the new version of \type {marvosymb}, the MVzero will +%D has a slash and the FHBOLOGO, (wo)manface, and (wo)manfront +%D are replaced by other symbols. + +\loadmapfile[original-base.map] % \loadmapfile[original-vogel-symbol] + +\definefontsynonym [MartinVogel] [fmvr8x] + +\def\MartinVogelSymbol#1{\getglyph{MartinVogel}{\char#1}} + +% Astro signs and signs of the zodiac + +\startsymbolset [astronomic] + + \definesymbol [Sun] [\MartinVogelSymbol{192}] + \definesymbol [Moon] [\MartinVogelSymbol{193}] + \definesymbol [Mercury] [\MartinVogelSymbol{194}] + \definesymbol [Venus] [\MartinVogelSymbol{195}] + \definesymbol [Mars] [\MartinVogelSymbol{196}] + \definesymbol [Jupiter] [\MartinVogelSymbol{197}] + \definesymbol [Saturn] [\MartinVogelSymbol{198}] + \definesymbol [Uranus] [\MartinVogelSymbol{199}] + \definesymbol [Neptune] [\MartinVogelSymbol{200}] + \definesymbol [Pluto] [\MartinVogelSymbol{201}] + +\stopsymbolset + +\startsymbolset [zodiac] + + \definesymbol [Aries] [\MartinVogelSymbol{224}] + \definesymbol [Taurus] [\MartinVogelSymbol{225}] + \definesymbol [Gemini] [\MartinVogelSymbol{226}] + \definesymbol [Cancer] [\MartinVogelSymbol{227}] + \definesymbol [Leo] [\MartinVogelSymbol{228}] + \definesymbol [Virgo] [\MartinVogelSymbol{229}] + \definesymbol [Libra] [\MartinVogelSymbol{230}] + \definesymbol [Scorpio] [\MartinVogelSymbol{231}] + \definesymbol [Sagittarius] [\MartinVogelSymbol{232}] + \definesymbol [Capricorn] [\MartinVogelSymbol{233}] + \definesymbol [Aquarius] [\MartinVogelSymbol{234}] + \definesymbol [Pisces] [\MartinVogelSymbol{235}] + +\stopsymbolset + +% Euro signs and CE + +\startsymbolset [europe] + + \definesymbol [EUR] [\MartinVogelSymbol{164}] + \definesymbol [EURhv] [\MartinVogelSymbol {99}] + \definesymbol [EURcr] [\MartinVogelSymbol{100}] + \definesymbol [EURtm] [\MartinVogelSymbol{101}] + \definesymbol [CEsign] [\MartinVogelSymbol {67}] + +\stopsymbolset + +\startencoding[default] + + \definecharacter texteuro {\symbol[europe][EUR]} + +\stopencoding + +\unexpanded\def\euro{\doiftextelse{\texteuro}{\texteuro}{\symbol[europe][EUR]}} + +% Numbers 0 to 9, @, A and p + +% taco: are these more general, like also in zapf dingbats? + +\startsymbolset [martinvogel 1] + + \definesymbol [MVZero] [\MartinVogelSymbol {48}] + \definesymbol [MVOne] [\MartinVogelSymbol {49}] + \definesymbol [MVTwo] [\MartinVogelSymbol {50}] + \definesymbol [MVThree] [\MartinVogelSymbol {51}] + \definesymbol [MVFour] [\MartinVogelSymbol {52}] + \definesymbol [MVFive] [\MartinVogelSymbol {53}] + \definesymbol [MVSix] [\MartinVogelSymbol {54}] + \definesymbol [MVSeven] [\MartinVogelSymbol {55}] + \definesymbol [MVEight] [\MartinVogelSymbol {56}] + \definesymbol [MVNine] [\MartinVogelSymbol {57}] + \definesymbol [MVAt] [\MartinVogelSymbol {64}] + \definesymbol [MVA] [\MartinVogelSymbol{240}] + \definesymbol [MVp] [\MartinVogelSymbol{241}] + +\stopsymbolset + +% Office signs, crosses, circles, arrows + +\startsymbolset [martinvogel 2] + + \definesymbol [CheckedBox] [\MartinVogelSymbol {86}] + \definesymbol [CrossedBox] [\MartinVogelSymbol {88}] + \definesymbol [PointingHand] [\MartinVogelSymbol {90}] + \definesymbol [WritingHand] [\MartinVogelSymbol {98}] + \definesymbol [Heart] [\MartinVogelSymbol{140}] + \definesymbol [FlatSteel] [\MartinVogelSymbol{150}] + \definesymbol [Squarepipe] [\MartinVogelSymbol{151}] + \definesymbol [Rectpipe] [\MartinVogelSymbol{152}] + \definesymbol [Lsteel] [\MartinVogelSymbol{153}] + \definesymbol [TTsteel] [\MartinVogelSymbol{154}] + \definesymbol [Circpipe] [\MartinVogelSymbol{155}] + \definesymbol [Tsteel] [\MartinVogelSymbol{156}] + + \definesymbol [Stopsign] [\MartinVogelSymbol {33}] + \definesymbol [Beam] [\MartinVogelSymbol {34}] + \definesymbol [Bearing] [\MartinVogelSymbol {35}] + \definesymbol [Loosebearing] [\MartinVogelSymbol {36}] + \definesymbol [Fixedbearing] [\MartinVogelSymbol {37}] + \definesymbol [Lefttorque] [\MartinVogelSymbol {38}] + \definesymbol [Righttorque] [\MartinVogelSymbol {39}] + \definesymbol [Force] [\MartinVogelSymbol {40}] + \definesymbol [Lineload] [\MartinVogelSymbol {41}] + \definesymbol [Circles] [\MartinVogelSymbol {46}] + \definesymbol [Squaredot] [\MartinVogelSymbol{247}] + + \definesymbol [Correspondes] [\MartinVogelSymbol {61}] + \definesymbol [Vectorarrowhigh] [\MartinVogelSymbol {80}] + \definesymbol [Vectorarrow] [\MartinVogelSymbol{112}] + \definesymbol [Rightarrow] [\MartinVogelSymbol {62}] + \definesymbol [Lightning] [\MartinVogelSymbol {69}] + + \definesymbol [Snowflake] [\MartinVogelSymbol {42}] + \definesymbol [Kross] [\MartinVogelSymbol {43}] + \definesymbol [Cross] [\MartinVogelSymbol{134}] + \definesymbol [Celtcross] [\MartinVogelSymbol{135}] + \definesymbol [Ankh] [\MartinVogelSymbol{136}] + \definesymbol [Yingyang] [\MartinVogelSymbol {77}] + + \definesymbol [Pickup] [\MartinVogelSymbol {0}] % ? + \definesymbol [Letter] [\MartinVogelSymbol {66}] % ? + \definesymbol [Mobilephone] [\MartinVogelSymbol {72}] + \definesymbol [Telephone] [\MartinVogelSymbol {84}] + \definesymbol [fax] [\MartinVogelSymbol{116}] + \definesymbol [FAX] [\MartinVogelSymbol{117}] + \definesymbol [Faxmachine] [\MartinVogelSymbol{118}] + + \definesymbol [Clocklogo] [\MartinVogelSymbol {85}] + \definesymbol [Industry] [\MartinVogelSymbol {73}] + \definesymbol [Coffeecup] [\MartinVogelSymbol {75}] + \definesymbol [Info] [\MartinVogelSymbol{105}] + \definesymbol [Football] [\MartinVogelSymbol{111}] + \definesymbol [Frowny] [\MartinVogelSymbol{167}] + \definesymbol [Smiley] [\MartinVogelSymbol{169}] + \definesymbol [Bicycle] [\MartinVogelSymbol{174}] + + \definesymbol [Rightscissors] [\MartinVogelSymbol {81}] + \definesymbol [Leftscissors] [\MartinVogelSymbol {83}] + \definesymbol [Cutright] [\MartinVogelSymbol{113}] + \definesymbol [Cutleft] [\MartinVogelSymbol{115}] + \definesymbol [Kutline] [\MartinVogelSymbol {82}] % K ? + \definesymbol [Cutline] [\MartinVogelSymbol{114}] + +\stopsymbolset + +% FHBO (Fachhochschule Bochum), face, humans, bat + +\startsymbolset [martinvogel 3] + + \definesymbol [FHBOlogo] [\MartinVogelSymbol {70}] + \definesymbol [FHBOLOGO] [\MartinVogelSymbol{102}] + \definesymbol [Womanside] [\MartinVogelSymbol{204}] + \definesymbol [Manside] [\MartinVogelSymbol{205}] + \definesymbol [Womanfront] [\MartinVogelSymbol{206}] + \definesymbol [Manfront] [\MartinVogelSymbol{207}] + \definesymbol [Bat] [\MartinVogelSymbol{253}] + \definesymbol [Womanface] [\MartinVogelSymbol{254}] + \definesymbol [MartinVogel] [\MartinVogelSymbol{255}] + +\stopsymbolset + +%D \showsymbolset[astronomic] +%D \showsymbolset[zodiac] +%D \showsymbolset[europe] +%D \showsymbolset[martinvogel 1] +%D \showsymbolset[martinvogel 2] +%D \showsymbolset[martinvogel 3] + +\endinput diff --git a/Master/texmf-dist/tex/context/base/symb-mvs.mkiv b/Master/texmf-dist/tex/context/base/symb-mvs.mkiv new file mode 100644 index 00000000000..312a50a8898 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/symb-mvs.mkiv @@ -0,0 +1,263 @@ +%D \module +%D [ file=symb-mvs, +%D version=2010.12.08, % 2000.03.30, +%D title=\CONTEXT\ Symbol Libraries, +%D subtitle=Martin Vogels Symbole, +%D author=Hans Hagen, +%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. + +\definefontsynonym [MartinVogel] [marvosym.ttf] + +\def\MartinVogelSymbol{\getnamedglyphdirect{MartinVogel}} % #1 + +\startsymbolset [astronomic] + + \definesymbol [Sun] [\MartinVogelSymbol{Sun}] + \definesymbol [Moon] [\MartinVogelSymbol{Moon}] + \definesymbol [Mercury] [\MartinVogelSymbol{Mercury}] + \definesymbol [Venus] [\MartinVogelSymbol{Venus}] + \definesymbol [Mars] [\MartinVogelSymbol{Mars}] + \definesymbol [Jupiter] [\MartinVogelSymbol{Jupiter}] + \definesymbol [Saturn] [\MartinVogelSymbol{Saturn}] + \definesymbol [Uranus] [\MartinVogelSymbol{Uranus}] + \definesymbol [Neptune] [\MartinVogelSymbol{Neptune}] + \definesymbol [Pluto] [\MartinVogelSymbol{Pluto}] + +\stopsymbolset + +\startsymbolset [zodiac] + + \definesymbol [Aries] [\MartinVogelSymbol{Aries}] + \definesymbol [Taurus] [\MartinVogelSymbol{Taurus}] + \definesymbol [Gemini] [\MartinVogelSymbol{Gemini}] + \definesymbol [Cancer] [\MartinVogelSymbol{Cancer}] + \definesymbol [Leo] [\MartinVogelSymbol{Leo}] + \definesymbol [Virgo] [\MartinVogelSymbol{Virgo}] + \definesymbol [Libra] [\MartinVogelSymbol{Libra}] + \definesymbol [Scorpio] [\MartinVogelSymbol{Scorpio}] + \definesymbol [Sagittarius] [\MartinVogelSymbol{Sagittarius}] + \definesymbol [Capricorn] [\MartinVogelSymbol{Capricorn}] + \definesymbol [Aquarius] [\MartinVogelSymbol{Aquarius}] + \definesymbol [Pisces] [\MartinVogelSymbol{Pisces}] + +\stopsymbolset + +\startsymbolset [europe] + + \definesymbol [EUR] [\MartinVogelSymbol{EUR}] + \definesymbol [EURhv] [\MartinVogelSymbol{EurHv}] + \definesymbol [EURcr] [\MartinVogelSymbol{EurCr}] + \definesymbol [EURtm] [\MartinVogelSymbol{EurTm}] + \definesymbol [EURdig] [\MartinVogelSymbol{EurDig}] + \definesymbol [CEsign] [\MartinVogelSymbol{CESign}] + +\stopsymbolset + +\startsymbolset [martinvogel 1] + + \definesymbol [MVZero] [\MartinVogelSymbol{MVZero}] + \definesymbol [MVOne] [\MartinVogelSymbol{MVOne}] + \definesymbol [MVTwo] [\MartinVogelSymbol{MVTwo}] + \definesymbol [MVThree] [\MartinVogelSymbol{MVThree}] + \definesymbol [MVFour] [\MartinVogelSymbol{MVFour}] + \definesymbol [MVFive] [\MartinVogelSymbol{MVFive}] + \definesymbol [MVSix] [\MartinVogelSymbol{MVSix}] + \definesymbol [MVSeven] [\MartinVogelSymbol{MVSeven}] + \definesymbol [MVEight] [\MartinVogelSymbol{MVEight}] + \definesymbol [MVNine] [\MartinVogelSymbol{MVNine}] + + \definesymbol [MVAt] [\MartinVogelSymbol{MVAt}] + \definesymbol [MVArrowDown] [\MartinVogelSymbol{MVArrowDown}] + \definesymbol [MVComma] [\MartinVogelSymbol{MVComma}] + \definesymbol [MVDivision] [\MartinVogelSymbol{MVDivision}] + \definesymbol [MVLeftBracket] [\MartinVogelSymbol{MVLeftBracket}] + \definesymbol [MVMinus] [\MartinVogelSymbol{MVMinus}] + \definesymbol [MVMultiplication] [\MartinVogelSymbol{MVMultiplication}] + \definesymbol [MVPeriod] [\MartinVogelSymbol{MVPeriod}] + \definesymbol [MVPlus] [\MartinVogelSymbol{MVPlus}] + \definesymbol [MVRightArrow] [\MartinVogelSymbol{MVRightArrow}] + \definesymbol [MVRightBracket] [\MartinVogelSymbol{MVRightBracket}] + \definesymbol [MVspace] [\MartinVogelSymbol{MVspace}] + +\stopsymbolset + +% Office signs, crosses, circles, arrows (names as in file) + +\startsymbolset [martinvogel 2] + + \definesymbol [AngleSign] [\MartinVogelSymbol{AngleSign}] + \definesymbol [Ankh] [\MartinVogelSymbol{Ankh}] + \definesymbol [ArrowOver] [\MartinVogelSymbol{ArrowOver}] + \definesymbol [AtForty] [\MartinVogelSymbol{AtForty}] + \definesymbol [AtNinetyFive] [\MartinVogelSymbol{AtNinetyFive}] + \definesymbol [AtSixty] [\MartinVogelSymbol{AtSixty}] + %definesymbol [BOLogo] [\MartinVogelSymbol{BOLogo}] + %definesymbol [BOLogoL] [\MartinVogelSymbol{BOLogoL}] + %definesymbol [BOLogoP] [\MartinVogelSymbol{BOLogoP}] + \definesymbol [BSEFree] [\MartinVogelSymbol{BSEFree}] + \definesymbol [BarOver] [\MartinVogelSymbol{BarOver}] + \definesymbol [Bat] [\MartinVogelSymbol{Bat}] + \definesymbol [Beam] [\MartinVogelSymbol{Beam}] + \definesymbol [Bearing] [\MartinVogelSymbol{Bearing}] + \definesymbol [Bicycle] [\MartinVogelSymbol{Bicycle}] + \definesymbol [Biohazard] [\MartinVogelSymbol{Biohazard}] + \definesymbol [Bleech] [\MartinVogelSymbol{Bleech}] + \definesymbol [Bouquet] [\MartinVogelSymbol{Bouquet}] + \definesymbol [CeltCross] [\MartinVogelSymbol{CeltCross}] + \definesymbol [CheckedBox] [\MartinVogelSymbol{CheckedBox}] + \definesymbol [CircPipe] [\MartinVogelSymbol{CircPipe}] + \definesymbol [CircSteel] [\MartinVogelSymbol{CircSteel}] + \definesymbol [CircledA] [\MartinVogelSymbol{CircledA}] + \definesymbol [CleaningA] [\MartinVogelSymbol{CleaningA}] + \definesymbol [CleaningF] [\MartinVogelSymbol{CleaningF}] + \definesymbol [CleaningFF] [\MartinVogelSymbol{CleaningFF}] + \definesymbol [CleaningP] [\MartinVogelSymbol{CleaningP}] + \definesymbol [CleaningPP] [\MartinVogelSymbol{CleaningPP}] + \definesymbol [ClockLogo] [\MartinVogelSymbol{ClockLogo}] + \definesymbol [Coffeecup] [\MartinVogelSymbol{Coffeecup}] + \definesymbol [ComputerMouse] [\MartinVogelSymbol{ComputerMouse}] + \definesymbol [Conclusion] [\MartinVogelSymbol{Conclusion}] + \definesymbol [Congruent] [\MartinVogelSymbol{Congruent}] + \definesymbol [Corresponds] [\MartinVogelSymbol{Corresponds}] + \definesymbol [Cross] [\MartinVogelSymbol{Cross}] + \definesymbol [CrossedBox] [\MartinVogelSymbol{CrossedBox}] + \definesymbol [CutLeft] [\MartinVogelSymbol{CutLeft}] + \definesymbol [CutLine] [\MartinVogelSymbol{CutLine}] + \definesymbol [CutRight] [\MartinVogelSymbol{CutRight}] + \definesymbol [CuttingLine] [\MartinVogelSymbol{CuttingLine}] + \definesymbol [Deleatur] [\MartinVogelSymbol{Deleatur}] + \definesymbol [Divides] [\MartinVogelSymbol{Divides}] + \definesymbol [DividesNot] [\MartinVogelSymbol{DividesNot}] + \definesymbol [EMail] [\MartinVogelSymbol{EMail}] + \definesymbol [Earth] [\MartinVogelSymbol{Earth}] + \definesymbol [EmailCT] [\MartinVogelSymbol{EmailCT}] + \definesymbol [Equivalence] [\MartinVogelSymbol{Equivalence}] + \definesymbol [Estatically] [\MartinVogelSymbol{Estatically}] + \definesymbol [EstimatedSign] [\MartinVogelSymbol{EstimatedSign}] + \definesymbol [Explosionsafe] [\MartinVogelSymbol{Explosionsafe}] + \definesymbol [EyesDollar] [\MartinVogelSymbol{EyesDollar}] + \definesymbol [FAX] [\MartinVogelSymbol{FAX}] + \definesymbol [FEMALE] [\MartinVogelSymbol{FEMALE}] + \definesymbol [Fax] [\MartinVogelSymbol{Fax}] + \definesymbol [Female] [\MartinVogelSymbol{Female}] + \definesymbol [FemaleFemale] [\MartinVogelSymbol{FemaleFemale}] + \definesymbol [FemaleMale] [\MartinVogelSymbol{FemaleMale}] + \definesymbol [FixedBearing] [\MartinVogelSymbol{FixedBearing}] + \definesymbol [FlatSteel] [\MartinVogelSymbol{FlatSteel}] + \definesymbol [Florin] [\MartinVogelSymbol{Florin}] + \definesymbol [Football] [\MartinVogelSymbol{Football}] + \definesymbol [Forward] [\MartinVogelSymbol{Forward}] + \definesymbol [ForwardToEnd] [\MartinVogelSymbol{ForwardToEnd}] + \definesymbol [ForwardToIndex] [\MartinVogelSymbol{ForwardToIndex}] + \definesymbol [Frowny] [\MartinVogelSymbol{Frowny}] + \definesymbol [Gentsroom] [\MartinVogelSymbol{Gentsroom}] + \definesymbol [HERMAPHRODITE] [\MartinVogelSymbol{HERMAPHRODITE}] + \definesymbol [HandWash] [\MartinVogelSymbol{HandWash}] + \definesymbol [Heart] [\MartinVogelSymbol{Heart}] + \definesymbol [Hermaphrodite] [\MartinVogelSymbol{Hermaphrodite}] + \definesymbol [HexaSteel] [\MartinVogelSymbol{HexaSteel}] + \definesymbol [HollowBox] [\MartinVogelSymbol{HollowBox}] + \definesymbol [IRONING] [\MartinVogelSymbol{IRONING}] + \definesymbol [Industry] [\MartinVogelSymbol{Industry}] + \definesymbol [Info] [\MartinVogelSymbol{Info}] + \definesymbol [Ironing] [\MartinVogelSymbol{Ironing}] + \definesymbol [Keyboard] [\MartinVogelSymbol{Keyboard}] + \definesymbol [LSteel] [\MartinVogelSymbol{LSteel}] + \definesymbol [Ladiesroom] [\MartinVogelSymbol{Ladiesroom}] + \definesymbol [LargerOrEqual] [\MartinVogelSymbol{LargerOrEqual}] + \definesymbol [Laserbeam] [\MartinVogelSymbol{Laserbeam}] + \definesymbol [LeftScissors] [\MartinVogelSymbol{LeftScissors}] + \definesymbol [LeftTorque] [\MartinVogelSymbol{LeftTorque}] + \definesymbol [LessOrEqual] [\MartinVogelSymbol{LessOrEqual}] + \definesymbol [Letter] [\MartinVogelSymbol{Letter}] + \definesymbol [Lightning] [\MartinVogelSymbol{Lightning}] + \definesymbol [Lineload] [\MartinVogelSymbol{Lineload}] + \definesymbol [LooseBearing] [\MartinVogelSymbol{LooseBearing}] + \definesymbol [MALE] [\MartinVogelSymbol{MALE}] + \definesymbol [Male] [\MartinVogelSymbol{Male}] + \definesymbol [MaleMale] [\MartinVogelSymbol{MaleMale}] + \definesymbol [ManFace] [\MartinVogelSymbol{ManFace}] + \definesymbol [MineSign] [\MartinVogelSymbol{MineSign}] + \definesymbol [Mobilefone] [\MartinVogelSymbol{Mobilefone}] + \definesymbol [MoveDown] [\MartinVogelSymbol{MoveDown}] + \definesymbol [MoveUp] [\MartinVogelSymbol{MoveUp}] + \definesymbol [MultiplicationDot] [\MartinVogelSymbol{MultiplicationDot}] + \definesymbol [Mundus] [\MartinVogelSymbol{Mundus}] + \definesymbol [Neutral] [\MartinVogelSymbol{Neutral}] + \definesymbol [NoBleech] [\MartinVogelSymbol{NoBleech}] + \definesymbol [NoBreakSpace] [\MartinVogelSymbol{NoBreakSpace}] + \definesymbol [NoChemicalCleaning] [\MartinVogelSymbol{NoChemicalCleaning}] + \definesymbol [NoIroning] [\MartinVogelSymbol{NoIroning}] + \definesymbol [NoTumbler] [\MartinVogelSymbol{NoTumbler}] + \definesymbol [NoWash] [\MartinVogelSymbol{NoWash}] + \definesymbol [NotCongruent] [\MartinVogelSymbol{NotCongruent}] + \definesymbol [OktoSteel] [\MartinVogelSymbol{OktoSteel}] + \definesymbol [PackingWaste] [\MartinVogelSymbol{PackingWaste}] + \definesymbol [ParallelPort] [\MartinVogelSymbol{ParallelPort}] + \definesymbol [PeaceDove] [\MartinVogelSymbol{PeaceDove}] + \definesymbol [Pfund] [\MartinVogelSymbol{Pfund}] + \definesymbol [Pickup] [\MartinVogelSymbol{Pickup}] + \definesymbol [PointingHand] [\MartinVogelSymbol{PointingHand}] + \definesymbol [Printer] [\MartinVogelSymbol{Printer}] + \definesymbol [Radioactivity] [\MartinVogelSymbol{Radioactivity}] + \definesymbol [RectPipe] [\MartinVogelSymbol{RectPipe}] + \definesymbol [RectSteel] [\MartinVogelSymbol{RectSteel}] + \definesymbol [Recycling] [\MartinVogelSymbol{Recycling}] + \definesymbol [Rewind] [\MartinVogelSymbol{Rewind}] + \definesymbol [RewindToIndex] [\MartinVogelSymbol{RewindToIndex}] + \definesymbol [RewindToStart] [\MartinVogelSymbol{RewindToStart}] + \definesymbol [RightScissors] [\MartinVogelSymbol{RightScissors}] + \definesymbol [RightTorque] [\MartinVogelSymbol{RightTorque}] + \definesymbol [RoundedLSteel] [\MartinVogelSymbol{RoundedLSteel}] + \definesymbol [RoundedTSteel] [\MartinVogelSymbol{RoundedTSteel}] + \definesymbol [RoundedTTSteel] [\MartinVogelSymbol{RoundedTTSteel}] + \definesymbol [SerialInterface] [\MartinVogelSymbol{SerialInterface}] + \definesymbol [SerialPort] [\MartinVogelSymbol{SerialPort}] + \definesymbol [Shilling] [\MartinVogelSymbol{Shilling}] + \definesymbol [ShortFifty] [\MartinVogelSymbol{ShortFifty}] + \definesymbol [ShortForty] [\MartinVogelSymbol{ShortForty}] + \definesymbol [ShortNinetyfive] [\MartinVogelSymbol{ShortNinetyfive}] + \definesymbol [ShortSixty] [\MartinVogelSymbol{ShortSixty}] + \definesymbol [ShortThirty] [\MartinVogelSymbol{ShortThirty}] + \definesymbol [Smiley] [\MartinVogelSymbol{Smiley}] + \definesymbol [SoftHyphen] [\MartinVogelSymbol{SoftHyphen}] + \definesymbol [SpecialForty] [\MartinVogelSymbol{SpecialForty}] + \definesymbol [SquarePipe] [\MartinVogelSymbol{SquarePipe}] + \definesymbol [SquareSteel] [\MartinVogelSymbol{SquareSteel}] + \definesymbol [Stopsign] [\MartinVogelSymbol{Stopsign}] + \definesymbol [StrikingThrough] [\MartinVogelSymbol{StrikingThrough}] + \definesymbol [TSteel] [\MartinVogelSymbol{TSteel}] + \definesymbol [TTSteel] [\MartinVogelSymbol{TTSteel}] + \definesymbol [Telephone] [\MartinVogelSymbol{Telefon}] + \definesymbol [ToBottom] [\MartinVogelSymbol{ToBottom}] + \definesymbol [ToTop] [\MartinVogelSymbol{ToTop}] + \definesymbol [Tumbler] [\MartinVogelSymbol{Tumbler}] + \definesymbol [Valve] [\MartinVogelSymbol{Valve}] + \definesymbol [WashCotton] [\MartinVogelSymbol{WashCotton}] + \definesymbol [WashSynthetics] [\MartinVogelSymbol{WashSynthetics}] + \definesymbol [WashWool] [\MartinVogelSymbol{WashWool}] + \definesymbol [Wheelchair] [\MartinVogelSymbol{Wheelchair}] + \definesymbol [WomanFace] [\MartinVogelSymbol{WomanFace}] + \definesymbol [WritingHand] [\MartinVogelSymbol{WritingHand}] + \definesymbol [YinYang] [\MartinVogelSymbol{YinYang}] + \definesymbol [arrowOver] [\MartinVogelSymbol{arrowOver}] + \definesymbol [barOver] [\MartinVogelSymbol{barOver}] + \definesymbol [fax] [\MartinVogelSymbol{fax}] + %definesymbol [hyphen] [\MartinVogelSymbol{hyphen}] + \definesymbol [ironing] [\MartinVogelSymbol{ironing}] + %definesymbol [nonmarkingreturn] [\MartinVogelSymbol{nonmarkingreturn}] + +\stopsymbolset + +%D \showsymbolset[astronomic] +%D \showsymbolset[zodiac] +%D \showsymbolset[europe] +%D \showsymbolset[martinvogel 1] +%D \showsymbolset[martinvogel 2] + +\endinput diff --git a/Master/texmf-dist/tex/context/base/symb-mvs.tex b/Master/texmf-dist/tex/context/base/symb-mvs.tex deleted file mode 100644 index 1dd3da0a00c..00000000000 --- a/Master/texmf-dist/tex/context/base/symb-mvs.tex +++ /dev/null @@ -1,217 +0,0 @@ -%D \module -%D [ file=symb-mvs, -%D version=2000.03.30, -%D title=\CONTEXT\ Symbol Libraries, -%D subtitle=Martin Vogels Symbole, -%D author=Tobias Burnus \& Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -%D This module implements the Martin Vogel Symbole font -%D (marvosym). The names are derived from the \LATEX\ package -%D \type {marvosym} of Thomas Henlich. The symbols are -%D available as Type~1 font and are included in \TETEX\ and -%D \FPTEX\ distributions. -%D -%D This symbol font offers the signs of the zodiac, four -%D alternative the euro signs, some general office signs and -%D some more. -%D -%D The font was designed by Martin Vogel who can be reached at -%D \hyphenatedurl {martin.vogel@fh-bochum.de}. More information -%D can be found at \hyphenatedurl -%D {http://www.fh-bochum.de/fb1/vogel/marvosym.html}. The -%D conversion to Type~1 font was done by Thomas Henlich, who -%D can be reached at \hyphenatedurl -%D {thenlich@rcs.urz.tu-dresden.de}. -%D -%D This module is based on the current \CTAN\ version (as of -%D March 30, 2000) and is older than the TrueType version at -%D Martin Vogel's Homepage. The definitions in this module -%D reflect the \CTAN\ version. The font conversion was done by -%D Thomas Henlich using \type {ttf2pt1}, a program that can be -%D found at \hyphenatedurl -%D {http://www.netspace.net.au/~mheath/ttf2pt1/}. -%D -%D Using the new version of \type {marvosymb}, the MVzero will -%D has a slash and the FHBOLOGO, (wo)manface, and (wo)manfront -%D are replaced by other symbols. - -\loadmapfile[original-base.map] % \loadmapfile[original-vogel-symbol] - -\definefontsynonym [MartinVogel] [fmvr8x] - -\def\MartinVogelSymbol#1{\getglyph{MartinVogel}{\char#1}} - -% Astro signs and signs of the zodiac - -\startsymbolset [astronomic] - - \definesymbol [Sun] [\MartinVogelSymbol{192}] - \definesymbol [Moon] [\MartinVogelSymbol{193}] - \definesymbol [Mercury] [\MartinVogelSymbol{194}] - \definesymbol [Venus] [\MartinVogelSymbol{195}] - \definesymbol [Mars] [\MartinVogelSymbol{196}] - \definesymbol [Jupiter] [\MartinVogelSymbol{197}] - \definesymbol [Saturn] [\MartinVogelSymbol{198}] - \definesymbol [Uranus] [\MartinVogelSymbol{199}] - \definesymbol [Neptune] [\MartinVogelSymbol{200}] - \definesymbol [Pluto] [\MartinVogelSymbol{201}] - -\stopsymbolset - -\startsymbolset [zodiac] - - \definesymbol [Aries] [\MartinVogelSymbol{224}] - \definesymbol [Taurus] [\MartinVogelSymbol{225}] - \definesymbol [Gemini] [\MartinVogelSymbol{226}] - \definesymbol [Cancer] [\MartinVogelSymbol{227}] - \definesymbol [Leo] [\MartinVogelSymbol{228}] - \definesymbol [Virgo] [\MartinVogelSymbol{229}] - \definesymbol [Libra] [\MartinVogelSymbol{230}] - \definesymbol [Scorpio] [\MartinVogelSymbol{231}] - \definesymbol [Sagittarius] [\MartinVogelSymbol{232}] - \definesymbol [Capricorn] [\MartinVogelSymbol{233}] - \definesymbol [Aquarius] [\MartinVogelSymbol{234}] - \definesymbol [Pisces] [\MartinVogelSymbol{235}] - -\stopsymbolset - -% Euro signs and CE - -\startsymbolset [europe] - - \definesymbol [EUR] [\MartinVogelSymbol{164}] - \definesymbol [EURhv] [\MartinVogelSymbol {99}] - \definesymbol [EURcr] [\MartinVogelSymbol{100}] - \definesymbol [EURtm] [\MartinVogelSymbol{101}] - \definesymbol [CEsign] [\MartinVogelSymbol {67}] - -\stopsymbolset - -\startencoding[default] - - \definecharacter texteuro {\symbol[europe][EUR]} - -\stopencoding - -\unexpanded\def\euro{\doiftextelse{\texteuro}{\texteuro}{\symbol[europe][EUR]}} - -% Numbers 0 to 9, @, A and p - -% taco: are these more general, like also in zapf dingbats? - -\startsymbolset [martinvogel 1] - - \definesymbol [MVZero] [\MartinVogelSymbol {48}] - \definesymbol [MVOne] [\MartinVogelSymbol {49}] - \definesymbol [MVTwo] [\MartinVogelSymbol {50}] - \definesymbol [MVThree] [\MartinVogelSymbol {51}] - \definesymbol [MVFour] [\MartinVogelSymbol {52}] - \definesymbol [MVFive] [\MartinVogelSymbol {53}] - \definesymbol [MVSix] [\MartinVogelSymbol {54}] - \definesymbol [MVSeven] [\MartinVogelSymbol {55}] - \definesymbol [MVEight] [\MartinVogelSymbol {56}] - \definesymbol [MVNine] [\MartinVogelSymbol {57}] - \definesymbol [MVAt] [\MartinVogelSymbol {64}] - \definesymbol [MVA] [\MartinVogelSymbol{240}] - \definesymbol [MVp] [\MartinVogelSymbol{241}] - -\stopsymbolset - -% Office signs, crosses, circles, arrows - -\startsymbolset [martinvogel 2] - - \definesymbol [CheckedBox] [\MartinVogelSymbol {86}] - \definesymbol [CrossedBox] [\MartinVogelSymbol {88}] - \definesymbol [PointingHand] [\MartinVogelSymbol {90}] - \definesymbol [WritingHand] [\MartinVogelSymbol {98}] - \definesymbol [Heart] [\MartinVogelSymbol{140}] - \definesymbol [FlatSteel] [\MartinVogelSymbol{150}] - \definesymbol [Squarepipe] [\MartinVogelSymbol{151}] - \definesymbol [Rectpipe] [\MartinVogelSymbol{152}] - \definesymbol [Lsteel] [\MartinVogelSymbol{153}] - \definesymbol [TTsteel] [\MartinVogelSymbol{154}] - \definesymbol [Circpipe] [\MartinVogelSymbol{155}] - \definesymbol [Tsteel] [\MartinVogelSymbol{156}] - - \definesymbol [Stopsign] [\MartinVogelSymbol {33}] - \definesymbol [Beam] [\MartinVogelSymbol {34}] - \definesymbol [Bearing] [\MartinVogelSymbol {35}] - \definesymbol [Loosebearing] [\MartinVogelSymbol {36}] - \definesymbol [Fixedbearing] [\MartinVogelSymbol {37}] - \definesymbol [Lefttorque] [\MartinVogelSymbol {38}] - \definesymbol [Righttorque] [\MartinVogelSymbol {39}] - \definesymbol [Force] [\MartinVogelSymbol {40}] - \definesymbol [Lineload] [\MartinVogelSymbol {41}] - \definesymbol [Circles] [\MartinVogelSymbol {46}] - \definesymbol [Squaredot] [\MartinVogelSymbol{247}] - - \definesymbol [Correspondes] [\MartinVogelSymbol {61}] - \definesymbol [Vectorarrowhigh] [\MartinVogelSymbol {80}] - \definesymbol [Vectorarrow] [\MartinVogelSymbol{112}] - \definesymbol [Rightarrow] [\MartinVogelSymbol {62}] - \definesymbol [Lightning] [\MartinVogelSymbol {69}] - - \definesymbol [Snowflake] [\MartinVogelSymbol {42}] - \definesymbol [Kross] [\MartinVogelSymbol {43}] - \definesymbol [Cross] [\MartinVogelSymbol{134}] - \definesymbol [Celtcross] [\MartinVogelSymbol{135}] - \definesymbol [Ankh] [\MartinVogelSymbol{136}] - \definesymbol [Yingyang] [\MartinVogelSymbol {77}] - - \definesymbol [Pickup] [\MartinVogelSymbol {0}] % ? - \definesymbol [Letter] [\MartinVogelSymbol {66}] % ? - \definesymbol [Mobilephone] [\MartinVogelSymbol {72}] - \definesymbol [Telephone] [\MartinVogelSymbol {84}] - \definesymbol [fax] [\MartinVogelSymbol{116}] - \definesymbol [FAX] [\MartinVogelSymbol{117}] - \definesymbol [Faxmachine] [\MartinVogelSymbol{118}] - - \definesymbol [Clocklogo] [\MartinVogelSymbol {85}] - \definesymbol [Industry] [\MartinVogelSymbol {73}] - \definesymbol [Coffeecup] [\MartinVogelSymbol {75}] - \definesymbol [Info] [\MartinVogelSymbol{105}] - \definesymbol [Football] [\MartinVogelSymbol{111}] - \definesymbol [Frowny] [\MartinVogelSymbol{167}] - \definesymbol [Smiley] [\MartinVogelSymbol{169}] - \definesymbol [Bicycle] [\MartinVogelSymbol{174}] - - \definesymbol [Rightscissors] [\MartinVogelSymbol {81}] - \definesymbol [Leftscissors] [\MartinVogelSymbol {83}] - \definesymbol [Cutright] [\MartinVogelSymbol{113}] - \definesymbol [Cutleft] [\MartinVogelSymbol{115}] - \definesymbol [Kutline] [\MartinVogelSymbol {82}] % K ? - \definesymbol [Cutline] [\MartinVogelSymbol{114}] - -\stopsymbolset - -% FHBO (Fachhochschule Bochum), face, humans, bat - -\startsymbolset [martinvogel 3] - - \definesymbol [FHBOlogo] [\MartinVogelSymbol {70}] - \definesymbol [FHBOLOGO] [\MartinVogelSymbol{102}] - \definesymbol [Womanside] [\MartinVogelSymbol{204}] - \definesymbol [Manside] [\MartinVogelSymbol{205}] - \definesymbol [Womanfront] [\MartinVogelSymbol{206}] - \definesymbol [Manfront] [\MartinVogelSymbol{207}] - \definesymbol [Bat] [\MartinVogelSymbol{253}] - \definesymbol [Womanface] [\MartinVogelSymbol{254}] - \definesymbol [MartinVogel] [\MartinVogelSymbol{255}] - -\stopsymbolset - -%D \showsymbolset[astronomic] -%D \showsymbolset[zodiac] -%D \showsymbolset[europe] -%D \showsymbolset[martinvogel 1] -%D \showsymbolset[martinvogel 2] -%D \showsymbolset[martinvogel 3] - -\endinput diff --git a/Master/texmf-dist/tex/context/base/symb-nav.mkii b/Master/texmf-dist/tex/context/base/symb-nav.mkii new file mode 100644 index 00000000000..93badbc4d12 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/symb-nav.mkii @@ -0,0 +1,122 @@ +%D \module +%D [ file=symb-nav, +%D version=1998.07.20, +%D title=\CONTEXT\ Symbol Libraries, +%D subtitle=Navigational Symbols, +%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 + +\loadmapfile[original-base.map] % \loadmapfile [original-context-symbol.map] + +\definefontsynonym [ContextNavigation] [contnav] + +\def\ContextNavigationGlyph#1{\getglyph{ContextNavigation}{\char#1}} + +\startsymbolset [navigation 1] + + \definesymbol [\v!firstpage] [\ContextNavigationGlyph{3}] + \definesymbol [\v!previouspage] [\ContextNavigationGlyph{1}] + \definesymbol [\v!nextpage] [\ContextNavigationGlyph{2}] + \definesymbol [\v!lastpage] [\ContextNavigationGlyph{4}] + + \definesymbol [\v!PreviousJump] [\ContextNavigationGlyph{5}] + \definesymbol [\v!NextJump] [\ContextNavigationGlyph{6}] + + \definesymbol [\v!CloseDocument] [\ContextNavigationGlyph{7}] + + \definesymbol [\v!firstsubpage] [\ContextNavigationGlyph{3}] + \definesymbol [\v!previoussubpage] [\ContextNavigationGlyph{1}] + \definesymbol [\v!nextsubpage] [\ContextNavigationGlyph{2}] + \definesymbol [\v!lastsubpage] [\ContextNavigationGlyph{4}] + + \definesymbol [\v!StartSound] [\ContextNavigationGlyph{2}] + \definesymbol [\v!PauseSound] [\ContextNavigationGlyph{8}] + \definesymbol [\v!StopSound] [\ContextNavigationGlyph{7}] + + \definesymbol [\v!StartMovie] [\ContextNavigationGlyph{2}] + \definesymbol [\v!PauseMovie] [\ContextNavigationGlyph{8}] + \definesymbol [\v!StopMovie] [\ContextNavigationGlyph{7}] + + \definesymbol [\v!StartRendering] [\ContextNavigationGlyph{2}] + \definesymbol [\v!PauseRendering] [\ContextNavigationGlyph{8}] + \definesymbol [\v!StopRendering] [\ContextNavigationGlyph{7}] + \definesymbol [\v!ResumeRendering] [\ContextNavigationGlyph{2}] + +\stopsymbolset + +\startsymbolset [navigation 2] + + \definesymbol [\v!firstpage] [\ContextNavigationGlyph{103}] + \definesymbol [\v!previouspage] [\ContextNavigationGlyph{101}] + \definesymbol [\v!nextpage] [\ContextNavigationGlyph{102}] + \definesymbol [\v!lastpage] [\ContextNavigationGlyph{104}] + + \definesymbol [\v!PreviousJump] [\ContextNavigationGlyph{105}] + \definesymbol [\v!NextJump] [\ContextNavigationGlyph{106}] + + \definesymbol [\v!CloseDocument] [\ContextNavigationGlyph{107}] + + \definesymbol [\v!firstsubpage] [\ContextNavigationGlyph{103}] + \definesymbol [\v!previoussubpage] [\ContextNavigationGlyph{101}] + \definesymbol [\v!nextsubpage] [\ContextNavigationGlyph{102}] + \definesymbol [\v!lastsubpage] [\ContextNavigationGlyph{104}] + + \definesymbol [\v!StartSound] [\ContextNavigationGlyph{102}] + \definesymbol [\v!PauseSound] [\ContextNavigationGlyph{108}] + \definesymbol [\v!StopSound] [\ContextNavigationGlyph{107}] + + \definesymbol [\v!StartMovie] [\ContextNavigationGlyph{102}] + \definesymbol [\v!PauseMovie] [\ContextNavigationGlyph{108}] + \definesymbol [\v!StopMovie] [\ContextNavigationGlyph{107}] + + \definesymbol [\v!StartRendering] [\ContextNavigationGlyph{102}] + \definesymbol [\v!PauseRendering] [\ContextNavigationGlyph{108}] + \definesymbol [\v!StopRendering] [\ContextNavigationGlyph{107}] + \definesymbol [\v!ResumeRendering] [\ContextNavigationGlyph{102}] + +\stopsymbolset + +\startsymbolset [navigation 3] + + \definesymbol [\v!firstpage] [\ContextNavigationGlyph{203}] + \definesymbol [\v!previouspage] [\ContextNavigationGlyph{201}] + \definesymbol [\v!nextpage] [\ContextNavigationGlyph{202}] + \definesymbol [\v!lastpage] [\ContextNavigationGlyph{204}] + + \definesymbol [\v!PreviousJump] [\ContextNavigationGlyph{205}] + \definesymbol [\v!NextJump] [\ContextNavigationGlyph{206}] + + \definesymbol [\v!CloseDocument] [\ContextNavigationGlyph{207}] + + \definesymbol [\v!firstsubpage] [\ContextNavigationGlyph{203}] + \definesymbol [\v!previoussubpage] [\ContextNavigationGlyph{201}] + \definesymbol [\v!nextsubpage] [\ContextNavigationGlyph{202}] + \definesymbol [\v!lastsubpage] [\ContextNavigationGlyph{204}] + + \definesymbol [\v!StartSound] [\ContextNavigationGlyph{202}] + \definesymbol [\v!PauseSound] [\ContextNavigationGlyph{208}] + \definesymbol [\v!StopSound] [\ContextNavigationGlyph{207}] + + \definesymbol [\v!StartMovie] [\ContextNavigationGlyph{202}] + \definesymbol [\v!PauseMovie] [\ContextNavigationGlyph{208}] + \definesymbol [\v!StopMovie] [\ContextNavigationGlyph{207}] + + \definesymbol [\v!StartRendering] [\ContextNavigationGlyph{202}] + \definesymbol [\v!PauseRendering] [\ContextNavigationGlyph{208}] + \definesymbol [\v!StopRendering] [\ContextNavigationGlyph{207}] + \definesymbol [\v!ResumeRendering] [\ContextNavigationGlyph{202}] + +\stopsymbolset + +%D \showsymbolset[navigation 1] +%D \showsymbolset[navigation 2] +%D \showsymbolset[navigation 3] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/symb-nav.mkiv b/Master/texmf-dist/tex/context/base/symb-nav.mkiv new file mode 100644 index 00000000000..0f5fd289fea --- /dev/null +++ b/Master/texmf-dist/tex/context/base/symb-nav.mkiv @@ -0,0 +1,129 @@ +%D \module +%D [ file=symb-nav, +%D version=1998.07.20, +%D title=\CONTEXT\ Symbol Libraries, +%D subtitle=Navigational Symbols, +%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 + +\definesymbol [\v!first] [\symbol{\v!firstpage}] +\definesymbol [\v!previous] [\symbol{\v!previouspage}] +\definesymbol [\v!next] [\symbol{\v!nextpage}] +\definesymbol [\v!last] [\symbol{\v!lastpage}] +\definesymbol [\v!backward] [\symbol{\v!previouspage}] +\definesymbol [\v!forward] [\symbol{\v!nextpage}] +\definesymbol [\v!nowhere] [\symbol{bullet}] +\definesymbol [\v!somewhere] [\startoverlay{\symbol\v!previouspage}{\symbol\v!nextpage}\stopoverlay] + +\definefontsynonym [ContextNavigation] [contnav] + +\def\ContextNavigationGlyph{\getnamedglyphdirect{ContextNavigation}} % #1 + +\startsymbolset [navigation 1] + + \definesymbol [\v!firstpage] [\ContextNavigationGlyph{char03}] + \definesymbol [\v!previouspage] [\ContextNavigationGlyph{char01}] + \definesymbol [\v!nextpage] [\ContextNavigationGlyph{char02}] + \definesymbol [\v!lastpage] [\ContextNavigationGlyph{char04}] + + \definesymbol [\v!PreviousJump] [\ContextNavigationGlyph{char05}] + \definesymbol [\v!NextJump] [\ContextNavigationGlyph{char06}] + + \definesymbol [\v!CloseDocument] [\ContextNavigationGlyph{char07}] + + \definesymbol [\v!firstsubpage] [\ContextNavigationGlyph{char03}] + \definesymbol [\v!previoussubpage] [\ContextNavigationGlyph{char01}] + \definesymbol [\v!nextsubpage] [\ContextNavigationGlyph{char02}] + \definesymbol [\v!lastsubpage] [\ContextNavigationGlyph{char04}] + + \definesymbol [\v!StartSound] [\ContextNavigationGlyph{char02}] + \definesymbol [\v!PauseSound] [\ContextNavigationGlyph{char08}] + \definesymbol [\v!StopSound] [\ContextNavigationGlyph{char07}] + + \definesymbol [\v!StartMovie] [\ContextNavigationGlyph{char02}] + \definesymbol [\v!PauseMovie] [\ContextNavigationGlyph{char08}] + \definesymbol [\v!StopMovie] [\ContextNavigationGlyph{char07}] + + \definesymbol [\v!StartRendering] [\ContextNavigationGlyph{char02}] + \definesymbol [\v!PauseRendering] [\ContextNavigationGlyph{char08}] + \definesymbol [\v!StopRendering] [\ContextNavigationGlyph{char07}] + \definesymbol [\v!ResumeRendering] [\ContextNavigationGlyph{char02}] + +\stopsymbolset + +\startsymbolset [navigation 2] + + \definesymbol [\v!firstpage] [\ContextNavigationGlyph{char67}] + \definesymbol [\v!previouspage] [\ContextNavigationGlyph{char65}] + \definesymbol [\v!nextpage] [\ContextNavigationGlyph{char66}] + \definesymbol [\v!lastpage] [\ContextNavigationGlyph{char68}] + + \definesymbol [\v!PreviousJump] [\ContextNavigationGlyph{char69}] + \definesymbol [\v!NextJump] [\ContextNavigationGlyph{char6a}] + + \definesymbol [\v!CloseDocument] [\ContextNavigationGlyph{char6b}] + + \definesymbol [\v!firstsubpage] [\ContextNavigationGlyph{char67}] + \definesymbol [\v!previoussubpage] [\ContextNavigationGlyph{char65}] + \definesymbol [\v!nextsubpage] [\ContextNavigationGlyph{char66}] + \definesymbol [\v!lastsubpage] [\ContextNavigationGlyph{char68}] + + \definesymbol [\v!StartSound] [\ContextNavigationGlyph{char66}] + \definesymbol [\v!PauseSound] [\ContextNavigationGlyph{char6c}] + \definesymbol [\v!StopSound] [\ContextNavigationGlyph{char6b}] + + \definesymbol [\v!StartMovie] [\ContextNavigationGlyph{char66}] + \definesymbol [\v!PauseMovie] [\ContextNavigationGlyph{char6c}] + \definesymbol [\v!StopMovie] [\ContextNavigationGlyph{char6b}] + + \definesymbol [\v!StartRendering] [\ContextNavigationGlyph{char66}] + \definesymbol [\v!PauseRendering] [\ContextNavigationGlyph{char6c}] + \definesymbol [\v!StopRendering] [\ContextNavigationGlyph{char6b}] + \definesymbol [\v!ResumeRendering] [\ContextNavigationGlyph{char66}] + +\stopsymbolset + +\startsymbolset [navigation 3] + + \definesymbol [\v!firstpage] [\ContextNavigationGlyph{charcb}] + \definesymbol [\v!previouspage] [\ContextNavigationGlyph{charc9}] + \definesymbol [\v!nextpage] [\ContextNavigationGlyph{charca}] + \definesymbol [\v!lastpage] [\ContextNavigationGlyph{charcc}] + + \definesymbol [\v!PreviousJump] [\ContextNavigationGlyph{charcd}] + \definesymbol [\v!NextJump] [\ContextNavigationGlyph{charce}] + + \definesymbol [\v!CloseDocument] [\ContextNavigationGlyph{charcf}] + + \definesymbol [\v!firstsubpage] [\ContextNavigationGlyph{charcb}] + \definesymbol [\v!previoussubpage] [\ContextNavigationGlyph{charc9}] + \definesymbol [\v!nextsubpage] [\ContextNavigationGlyph{charca}] + \definesymbol [\v!lastsubpage] [\ContextNavigationGlyph{charcc}] + + \definesymbol [\v!StartSound] [\ContextNavigationGlyph{charca}] + \definesymbol [\v!PauseSound] [\ContextNavigationGlyph{chard0}] + \definesymbol [\v!StopSound] [\ContextNavigationGlyph{charcf}] + + \definesymbol [\v!StartMovie] [\ContextNavigationGlyph{charca}] + \definesymbol [\v!PauseMovie] [\ContextNavigationGlyph{chard0}] + \definesymbol [\v!StopMovie] [\ContextNavigationGlyph{charcf}] + + \definesymbol [\v!StartRendering] [\ContextNavigationGlyph{charca}] + \definesymbol [\v!PauseRendering] [\ContextNavigationGlyph{chard0}] + \definesymbol [\v!StopRendering] [\ContextNavigationGlyph{charcf}] + \definesymbol [\v!ResumeRendering] [\ContextNavigationGlyph{charca}] + +\stopsymbolset + +%D \showsymbolset[navigation 1] +%D \showsymbolset[navigation 2] +%D \showsymbolset[navigation 3] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/symb-nav.tex b/Master/texmf-dist/tex/context/base/symb-nav.tex deleted file mode 100644 index 90a798e01bf..00000000000 --- a/Master/texmf-dist/tex/context/base/symb-nav.tex +++ /dev/null @@ -1,126 +0,0 @@ -%D \module -%D [ file=symb-nav, -%D version=1998.07.20, -%D title=\CONTEXT\ Symbol Libraries, -%D subtitle=Navigational Symbols, -%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 - -\loadmapfile[original-base.map] % \loadmapfile [original-context-symbol.map] - -\ifnum\texengine=\luatexengine - \definefontsynonym [ContextNavigation] [contnav.tfm] -\else - \definefontsynonym [ContextNavigation] [contnav] -\fi - -\def\ContextNavigationGlyph#1{\getglyph{ContextNavigation}{\char#1}} - -\startsymbolset [navigation 1] - - \definesymbol [\v!firstpage] [\ContextNavigationGlyph{3}] - \definesymbol [\v!previouspage] [\ContextNavigationGlyph{1}] - \definesymbol [\v!nextpage] [\ContextNavigationGlyph{2}] - \definesymbol [\v!lastpage] [\ContextNavigationGlyph{4}] - - \definesymbol [\v!PreviousJump] [\ContextNavigationGlyph{5}] - \definesymbol [\v!NextJump] [\ContextNavigationGlyph{6}] - - \definesymbol [\v!CloseDocument] [\ContextNavigationGlyph{7}] - - \definesymbol [\v!firstsubpage] [\ContextNavigationGlyph{3}] - \definesymbol [\v!previoussubpage] [\ContextNavigationGlyph{1}] - \definesymbol [\v!nextsubpage] [\ContextNavigationGlyph{2}] - \definesymbol [\v!lastsubpage] [\ContextNavigationGlyph{4}] - - \definesymbol [\v!StartSound] [\ContextNavigationGlyph{2}] - \definesymbol [\v!PauseSound] [\ContextNavigationGlyph{8}] - \definesymbol [\v!StopSound] [\ContextNavigationGlyph{7}] - - \definesymbol [\v!StartMovie] [\ContextNavigationGlyph{2}] - \definesymbol [\v!PauseMovie] [\ContextNavigationGlyph{8}] - \definesymbol [\v!StopMovie] [\ContextNavigationGlyph{7}] - - \definesymbol [\v!StartRendering] [\ContextNavigationGlyph{2}] - \definesymbol [\v!PauseRendering] [\ContextNavigationGlyph{8}] - \definesymbol [\v!StopRendering] [\ContextNavigationGlyph{7}] - \definesymbol [\v!ResumeRendering] [\ContextNavigationGlyph{2}] - -\stopsymbolset - -\startsymbolset [navigation 2] - - \definesymbol [\v!firstpage] [\ContextNavigationGlyph{103}] - \definesymbol [\v!previouspage] [\ContextNavigationGlyph{101}] - \definesymbol [\v!nextpage] [\ContextNavigationGlyph{102}] - \definesymbol [\v!lastpage] [\ContextNavigationGlyph{104}] - - \definesymbol [\v!PreviousJump] [\ContextNavigationGlyph{105}] - \definesymbol [\v!NextJump] [\ContextNavigationGlyph{106}] - - \definesymbol [\v!CloseDocument] [\ContextNavigationGlyph{107}] - - \definesymbol [\v!firstsubpage] [\ContextNavigationGlyph{103}] - \definesymbol [\v!previoussubpage] [\ContextNavigationGlyph{101}] - \definesymbol [\v!nextsubpage] [\ContextNavigationGlyph{102}] - \definesymbol [\v!lastsubpage] [\ContextNavigationGlyph{104}] - - \definesymbol [\v!StartSound] [\ContextNavigationGlyph{102}] - \definesymbol [\v!PauseSound] [\ContextNavigationGlyph{108}] - \definesymbol [\v!StopSound] [\ContextNavigationGlyph{107}] - - \definesymbol [\v!StartMovie] [\ContextNavigationGlyph{102}] - \definesymbol [\v!PauseMovie] [\ContextNavigationGlyph{108}] - \definesymbol [\v!StopMovie] [\ContextNavigationGlyph{107}] - - \definesymbol [\v!StartRendering] [\ContextNavigationGlyph{102}] - \definesymbol [\v!PauseRendering] [\ContextNavigationGlyph{108}] - \definesymbol [\v!StopRendering] [\ContextNavigationGlyph{107}] - \definesymbol [\v!ResumeRendering] [\ContextNavigationGlyph{102}] - -\stopsymbolset - -\startsymbolset [navigation 3] - - \definesymbol [\v!firstpage] [\ContextNavigationGlyph{203}] - \definesymbol [\v!previouspage] [\ContextNavigationGlyph{201}] - \definesymbol [\v!nextpage] [\ContextNavigationGlyph{202}] - \definesymbol [\v!lastpage] [\ContextNavigationGlyph{204}] - - \definesymbol [\v!PreviousJump] [\ContextNavigationGlyph{205}] - \definesymbol [\v!NextJump] [\ContextNavigationGlyph{206}] - - \definesymbol [\v!CloseDocument] [\ContextNavigationGlyph{207}] - - \definesymbol [\v!firstsubpage] [\ContextNavigationGlyph{203}] - \definesymbol [\v!previoussubpage] [\ContextNavigationGlyph{201}] - \definesymbol [\v!nextsubpage] [\ContextNavigationGlyph{202}] - \definesymbol [\v!lastsubpage] [\ContextNavigationGlyph{204}] - - \definesymbol [\v!StartSound] [\ContextNavigationGlyph{202}] - \definesymbol [\v!PauseSound] [\ContextNavigationGlyph{208}] - \definesymbol [\v!StopSound] [\ContextNavigationGlyph{207}] - - \definesymbol [\v!StartMovie] [\ContextNavigationGlyph{202}] - \definesymbol [\v!PauseMovie] [\ContextNavigationGlyph{208}] - \definesymbol [\v!StopMovie] [\ContextNavigationGlyph{207}] - - \definesymbol [\v!StartRendering] [\ContextNavigationGlyph{202}] - \definesymbol [\v!PauseRendering] [\ContextNavigationGlyph{208}] - \definesymbol [\v!StopRendering] [\ContextNavigationGlyph{207}] - \definesymbol [\v!ResumeRendering] [\ContextNavigationGlyph{202}] - -\stopsymbolset - -%D \showsymbolset[navigation 1] -%D \showsymbolset[navigation 2] -%D \showsymbolset[navigation 3] - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/symb-run.mkiv b/Master/texmf-dist/tex/context/base/symb-run.mkiv index 4e714832c52..33bbb7927c5 100644 --- a/Master/texmf-dist/tex/context/base/symb-run.mkiv +++ b/Master/texmf-dist/tex/context/base/symb-run.mkiv @@ -1,54 +1,53 @@ %D \module -%D [ file=symb-run, % code moved from symb-ini -%D version=1998.07.20, +%D [ file=symb-run, +%D version=2010.12.08, % 1998.07.20, %D title=\CONTEXT\ Symbol Libraries, %D subtitle=Runtime Macros, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%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. +\startluacode + function commands.showsymbolset(collection,symbols) + if type(symbols) == "string" then + symbols = utilities.parsers.settings_to_array(symbols) + end + context.start() + context.forcesymbolset { collection } + context.starttabulate { "|lT|l|l|" } + for i=1,#symbols do + local symbol = symbols[i] + context.NC() + context(symbol) + context.NC() + context.symbol(symbol) + context.NC() + context.color ( + { "red" }, + context.nested.ruledhbox( + context.nested.color ( + { "black" }, + context.nested.symbol(symbol) + ) + ) + ) + context.NR() + end + context.stoptabulate() + context.stop() + end +\stopluacode + \unprotect -\gdef\doshowsymbolset[#1][#2]% todo: make nicer, use legend or so - {\vbox\bgroup - \blank - \getparameters[\??ss][\c!n=5,#2]% - \forcesymbolset[#1]% - \doifsymbolsetelse{#1} - {\global\let\allfigures\empty - \doglobal\newcounter\figurecounter - \setupcolors[\c!state=\v!start]% to prevent mps color conversion - \dontcomplain - \def\doshowsymbols% global needed due to grouping in alignment - {\expanded{\globalprocesscommalist[\symbolset{#1}]}\docommand}% - \def\docommand##1% - {\vbox - {\forgetall - \tttf - \halign - {\hss\quad####\strut\quad\hss\cr - \symbol[##1]\quad{\red\ruledhbox{\black\symbol[##1]}}\cr - \tfx##1\cr}}% - \doglobal\increment\figurecounter - \ifnum\figurecounter=\@@ssn - \doglobal\newcounter\figurecounter - \def\next{\crcr\noalign{\vskip1ex}}% - \else - \def\next{&}% - \fi - \next}% - \tabskip\zeropoint \!!plus 1fill - \halign to \hsize - {&\hss##\hss\cr\doshowsymbols\crcr}}% - {}% - \blank - \egroup} +\gdef\doshowsymbolset[#1]% + {\ctxcommand{showsymbolset("#1","\symbolset{#1}")}} \gdef\showsymbolset - {\dodoubleempty\doshowsymbolset} + {\dosingleargument\doshowsymbolset} \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/symb-uni.mkii b/Master/texmf-dist/tex/context/base/symb-uni.mkii new file mode 100644 index 00000000000..fcd613e7f0a --- /dev/null +++ b/Master/texmf-dist/tex/context/base/symb-uni.mkii @@ -0,0 +1,1123 @@ +%D \module +%D [ file=symb-uni, +%D version=2004.11.15, +%D title=\CONTEXT\ Symbol Libraries, +%D subtitle=Unicode Symbols, +%D author=Adam T. Lindsay, +%D date=\currentdate, +%D copyright={Adam T. Lindsay / PRAGMA}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C prepared by Adam T. Lindsay. + +%D The content of this file originates from the Unicode standard, via some +%D original XSLT scripts and some hand-editing. This file is open for use +%D with the ConTeXt typesetting system. +%D +%D Adam considers the symbol names and categories to be stable, as they're +%D directly derived from the Unicode standard. +%D +%D \startitemize[packed] +%D \item Originated 2004-01-05 by Adam T. Lindsay +%D \item Updated 2004-01-16 with Unicode vector 0x27xx and some in +%D 215x and 246x +%D \item Updated 2004-11-15 to include default fonts for MacOSX and +%D \XETEX. +%D \stopitemize +%D +%D The following macros adapt to default fonts (that contain the characters) +%D in MacOSX. The font selection mechanism is likely to change once \XETEX\ +%D correctly supports \type{\doiffontcharelse}. + +\doifundefinedelse{XeTeXversion} + {\let\USymbChar \uchar + \let\USymbCharTwo \uchar + \let\USymbCharZapf\uchar} + {\def\USymbChar #1#2{\bgroup\UnicodeSymbolFont \uchar{#1}{#2}\relax\egroup} + \def\USymbCharTwo #1#2{\bgroup\UnicodeSymbolFontTwo \uchar{#1}{#2}\relax\egroup} + \def\USymbCharZapf#1#2{\bgroup\UnicodeSymbolFontZapf\uchar{#1}{#2}\relax\egroup} + \doifundefined{UnicodeSymbolFont} {\definefont[UnicodeSymbolFont] ["Apple Symbols" sa *]} + \doifundefined{UnicodeSymbolFontTwo} {\definefont[UnicodeSymbolFontTwo] ["Lucida Grande" sa *]} + \doifundefined{UnicodeSymbolFontZapf}{\definefont[UnicodeSymbolFontZapf]["Zapf Dingbats" sa *]}} + +\startsymbolset[Unicode Additional Punctuation] % 0x2000: Requires UnicodeRegular20 + + \definesymbol[Caret][\USymbChar{32}{56}] % CARET + \definesymbol[ReferenceMark][\USymbChar{32}{59}] % REFERENCE MARK + \definesymbol[DoubleExclamationMark][\USymbChar{32}{60}] % DOUBLE EXCLAMATION MARK + \definesymbol[Interrobang][\USymbChar{32}{61}] % INTERROBANG + \definesymbol[Overline][\USymbChar{32}{62}] % OVERLINE + \definesymbol[Undertie][\USymbChar{32}{63}] % UNDERTIE + \definesymbol[CharacterTie][\USymbChar{32}{64}] % CHARACTER TIE + \definesymbol[CaretInsertionPoint][\USymbChar{32}{65}] % CARET INSERTION POINT + \definesymbol[Asterism][\USymbChar{32}{66}] % ASTERISM + \definesymbol[HyphenBullet][\USymbChar{32}{67}] % HYPHEN BULLET + \definesymbol[FractionSlash][\USymbChar{32}{68}] % FRACTION SLASH + \definesymbol[LeftSquareBracketWithQuill][\USymbChar{32}{69}] % LEFT SQUARE BRACKET WITH QUILL + \definesymbol[RightSquareBracketWithQuill][\USymbChar{32}{70}] % RIGHT SQUARE BRACKET WITH QUILL + \definesymbol[QuestionExclamationMark][\USymbChar{32}{72}] % QUESTION EXCLAMATION MARK + \definesymbol[ExclamationQuestionMark][\USymbChar{32}{73}] % EXCLAMATION QUESTION MARK + \definesymbol[TironianSignEt][\USymbChar{32}{74}] % TIRONIAN SIGN ET + \definesymbol[ReversedPilcrowSign][\USymbChar{32}{75}] % REVERSED PILCROW SIGN + \definesymbol[BlackLeftwardsBullet][\USymbChar{32}{76}] % BLACK LEFTWARDS BULLET + \definesymbol[BlackRightwardsBullet][\USymbChar{32}{77}] % BLACK RIGHTWARDS BULLET + +\stopsymbolset + +\startsymbolset[Unicode Currency] % 0x20A0: Requires UnicodeRegular20 + + \definesymbol[Euro-currencySign][\USymbChar{32}{160}] % EURO-CURRENCY SIGN + \definesymbol[ColonSign][\USymbChar{32}{161}] % COLON SIGN + \definesymbol[CruzeiroSign][\USymbChar{32}{162}] % CRUZEIRO SIGN + \definesymbol[FrenchFrancSign][\USymbChar{32}{163}] % FRENCH FRANC SIGN + \definesymbol[LiraSign][\USymbChar{32}{164}] % LIRA SIGN + \definesymbol[MillSign][\USymbChar{32}{165}] % MILL SIGN + \definesymbol[NairaSign][\USymbChar{32}{166}] % NAIRA SIGN + \definesymbol[PesetaSign][\USymbChar{32}{167}] % PESETA SIGN + \definesymbol[RupeeSign][\USymbChar{32}{168}] % RUPEE SIGN + \definesymbol[WonSign][\USymbChar{32}{169}] % WON SIGN + \definesymbol[NewSheqelSign][\USymbChar{32}{170}] % NEW SHEQEL SIGN + \definesymbol[DongSign][\USymbChar{32}{171}] % DONG SIGN + \definesymbol[EuroSign][\USymbChar{32}{172}] % EURO SIGN + \definesymbol[KipSign][\USymbChar{32}{173}] % KIP SIGN + \definesymbol[TugrikSign][\USymbChar{32}{174}] % TUGRIK SIGN + \definesymbol[DrachmaSign][\USymbChar{32}{175}] % DRACHMA SIGN + \definesymbol[GermanPennySign][\USymbChar{32}{176}] % [Unassigned U+20B0] + \definesymbol[PfennigSign][\USymbChar{32}{176}] % Unofficial duplicate + \definesymbol[PesoSign][\USymbChar{32}{177}] % [Unassigned U+20B1] + +\stopsymbolset + + +\startsymbolset[Unicode Letterlike] % 0x2100: Requires UnicodeRegular21 + + \definesymbol[DegreeCelsius][\USymbChar{33}{3}] % DEGREE CELSIUS + \definesymbol[EulerConstant][\USymbChar{33}{7}] % EULER CONSTANT + \definesymbol[Scruple][\USymbChar{33}{8}] % SCRUPLE + \definesymbol[DegreeFahrenheit][\USymbChar{33}{9}] % DEGREE FAHRENHEIT + \definesymbol[PlanckConstant][\USymbChar{33}{14}] % PLANCK CONSTANT + \definesymbol[PlanckConstantOverTwoPi][\USymbChar{33}{15}] % PLANCK CONSTANT OVER TWO PI + \definesymbol[LBBarSymbol][\USymbChar{33}{20}] % L B BAR SYMBOL + \definesymbol[Versicle][\USymbChar{33}{35}] % VERSICLE + \definesymbol[OunceSign][\USymbChar{33}{37}] % OUNCE SIGN + \definesymbol[OhmSign][\USymbChar{33}{38}] % OHM SIGN + \definesymbol[InvertedOhmSign][\USymbChar{33}{39}] % INVERTED OHM SIGN + \definesymbol[KelvinSign][\USymbChar{33}{42}] % KELVIN SIGN + \definesymbol[AngstromSign][\USymbChar{33}{43}] % ANGSTROM SIGN + \definesymbol[EstimatedSymbol][\USymbChar{33}{46}] % ESTIMATED SYMBOL + +\stopsymbolset + +\startsymbolset[Unicode Letterlike Additional] % 0x2100: Requires UnicodeRegular21 + + \definesymbol[AccountOf][\USymbChar{33}{0}] % ACCOUNT OF + \definesymbol[AddressedToTheSubject][\USymbChar{33}{1}] % ADDRESSED TO THE SUBJECT + \definesymbol[CareOf][\USymbChar{33}{5}] % CARE OF + \definesymbol[CadaUna][\USymbChar{33}{6}] % CADA UNA + \definesymbol[CentreLineSymbol][\USymbChar{33}{4}] % CENTRE LINE SYMBOL + \definesymbol[NumeroSign][\USymbChar{33}{22}] % NUMERO SIGN + \definesymbol[SoundRecordingCopyright][\USymbChar{33}{23}] % SOUND RECORDING COPYRIGHT + \definesymbol[PrescriptionTake][\USymbChar{33}{30}] % PRESCRIPTION TAKE + \definesymbol[Response][\USymbChar{33}{31}] % RESPONSE + \definesymbol[ServiceMark][\USymbChar{33}{32}] % SERVICE MARK + \definesymbol[TelephoneSign][\USymbChar{33}{33}] % TELEPHONE SIGN + \definesymbol[TradeMarkSign][\USymbChar{33}{34}] % TRADE MARK SIGN + \definesymbol[InformationSource][\USymbChar{33}{57}] % INFORMATION SOURCE + \definesymbol[PropertyLine][\USymbChar{33}{74}] % [Unassigned U+214A] + +\stopsymbolset + +\startsymbolset[Unicode Script Letterlike] % 0x2100: Requires UnicodeRegular21 + + \definesymbol[ScriptSmallG][\USymbChar{33}{10}] % SCRIPT SMALL G + \definesymbol[ScriptCapitalH][\USymbChar{33}{11}] % SCRIPT CAPITAL H + \definesymbol[ScriptCapitalI][\USymbChar{33}{16}] % SCRIPT CAPITAL I + \definesymbol[ScriptCapitalL][\USymbChar{33}{18}] % SCRIPT CAPITAL L + \definesymbol[ScriptSmallL][\USymbChar{33}{19}] % SCRIPT SMALL L + \definesymbol[ScriptCapitalP][\USymbChar{33}{24}] % SCRIPT CAPITAL P + \definesymbol[ScriptCapitalR][\USymbChar{33}{27}] % SCRIPT CAPITAL R + \definesymbol[ScriptSmallE][\USymbChar{33}{47}] % SCRIPT SMALL E + \definesymbol[ScriptCapitalE][\USymbChar{33}{48}] % SCRIPT CAPITAL E + \definesymbol[ScriptCapitalF][\USymbChar{33}{49}] % SCRIPT CAPITAL F + \definesymbol[ScriptCapitalB][\USymbChar{33}{44}] % SCRIPT CAPITAL B + \definesymbol[ScriptCapitalM][\USymbChar{33}{51}] % SCRIPT CAPITAL M + \definesymbol[ScriptSmallO][\USymbChar{33}{52}] % SCRIPT SMALL O + +\stopsymbolset + +\startsymbolset[Unicode Hebrew Letterlike] % 0x2100: Requires UnicodeRegular21 + + \definesymbol[AlefSymbol][\USymbChar{33}{53}] % ALEF SYMBOL + \definesymbol[BetSymbol][\USymbChar{33}{54}] % BET SYMBOL + \definesymbol[GimelSymbol][\USymbChar{33}{55}] % GIMEL SYMBOL + \definesymbol[DaletSymbol][\USymbChar{33}{56}] % DALET SYMBOL + +\stopsymbolset + +\startsymbolset[Unicode Turned Letterlike] % 0x2100: Requires UnicodeRegular21 + + \definesymbol[RotatedCapitalQ][\USymbChar{33}{58}] % ROTATED CAPITAL Q + \definesymbol[TurnedSansSerifCapitalG][\USymbChar{33}{65}] % [Unassigned U+2141] + \definesymbol[TurnedSansSerifCapitalL][\USymbChar{33}{66}] % [Unassigned U+2142] + \definesymbol[ReversedSansSerifCapitalL][\USymbChar{33}{67}] % [Unassigned U+2143] + \definesymbol[TurnedSansSerifCapitalY][\USymbChar{33}{68}] % [Unassigned U+2144] + \definesymbol[TurnedAmpersand][\USymbChar{33}{75}] % [Unassigned U+214B] + \definesymbol[TurnedGreekSmallLetterIota][\USymbChar{33}{41}] % TURNED GREEK SMALL LETTER IOTA + \definesymbol[TurnedCapitalF][\USymbChar{33}{50}] % TURNED CAPITAL F + +\stopsymbolset + +\startsymbolset[Unicode Black-letter Letterlike] % 0x2100: Requires UnicodeRegular21 + + \definesymbol[BlackLetterCapitalH][\USymbChar{33}{12}] % BLACK-LETTER CAPITAL H + \definesymbol[BlackLetterCapitalI][\USymbChar{33}{17}] % BLACK-LETTER CAPITAL I + \definesymbol[BlackLetterCapitalR][\USymbChar{33}{28}] % BLACK-LETTER CAPITAL R + \definesymbol[BlackLetterCapitalZ][\USymbChar{33}{40}] % BLACK-LETTER CAPITAL Z + \definesymbol[BlackLetterCapitalC][\USymbChar{33}{45}] % BLACK-LETTER CAPITAL C + +\stopsymbolset + +\startsymbolset[Unicode Double-struck Letterlike Math] % 0x2100: Requires UnicodeRegular21 + + \definesymbol[DoubleStruckCapitalC][\USymbChar{33}{2}] % DOUBLE-STRUCK CAPITAL C + \definesymbol[DoubleStruckCapitalH][\USymbChar{33}{13}] % DOUBLE-STRUCK CAPITAL H + \definesymbol[DoubleStruckCapitalN][\USymbChar{33}{21}] % DOUBLE-STRUCK CAPITAL N + \definesymbol[DoubleStruckCapitalP][\USymbChar{33}{25}] % DOUBLE-STRUCK CAPITAL P + \definesymbol[DoubleStruckCapitalQ][\USymbChar{33}{26}] % DOUBLE-STRUCK CAPITAL Q + \definesymbol[DoubleStruckCapitalR][\USymbChar{33}{29}] % DOUBLE-STRUCK CAPITAL R + \definesymbol[DoubleStruckCapitalZ][\USymbChar{33}{36}] % DOUBLE-STRUCK CAPITAL Z + \definesymbol[DoubleStruckSmallGamma][\USymbChar{33}{61}] % [Unassigned U+213D] + \definesymbol[DoubleStruckCapitalGamma][\USymbChar{33}{62}] % [Unassigned U+213E] + \definesymbol[DoubleStruckCapitalPi][\USymbChar{33}{63}] % [Unassigned U+213F] + \definesymbol[DoubleStruckNArySummation][\USymbChar{33}{64}] % [Unassigned U+2140] + \definesymbol[DoubleStruckItalicCapitalD][\USymbChar{33}{69}] % [Unassigned U+2145] + \definesymbol[DoubleStruckItalicSmallD][\USymbChar{33}{70}] % [Unassigned U+2146] + \definesymbol[DoubleStruckItalicSmallE][\USymbChar{33}{71}] % [Unassigned U+2147] + \definesymbol[DoubleStruckItalicSmallI][\USymbChar{33}{72}] % [Unassigned U+2148] + \definesymbol[DoubleStruckItalicSmallJ][\USymbChar{33}{73}] % [Unassigned U+2149] + +\stopsymbolset + +\startsymbolset[Unicode Roman Numerals] % 0x2150: Requires UnicodeRegular21 + + \definesymbol[RomanNumeralOne][\USymbCharTwo{33}{96}] % ROMAN NUMERAL ONE + \definesymbol[RomanNumeralTwo][\USymbCharTwo{33}{97}] % ROMAN NUMERAL TWO + \definesymbol[RomanNumeralThree][\USymbCharTwo{33}{98}] % ROMAN NUMERAL THREE + \definesymbol[RomanNumeralFour][\USymbCharTwo{33}{99}] % ROMAN NUMERAL FOUR + \definesymbol[RomanNumeralFive][\USymbCharTwo{33}{100}] % ROMAN NUMERAL FIVE + \definesymbol[RomanNumeralSix][\USymbCharTwo{33}{101}] % ROMAN NUMERAL SIX + \definesymbol[RomanNumeralSeven][\USymbCharTwo{33}{102}] % ROMAN NUMERAL SEVEN + \definesymbol[RomanNumeralEight][\USymbCharTwo{33}{103}] % ROMAN NUMERAL EIGHT + \definesymbol[RomanNumeralNine][\USymbCharTwo{33}{104}] % ROMAN NUMERAL NINE + \definesymbol[RomanNumeralTen][\USymbCharTwo{33}{105}] % ROMAN NUMERAL TEN + \definesymbol[RomanNumeralEleven][\USymbCharTwo{33}{106}] % ROMAN NUMERAL ELEVEN + \definesymbol[RomanNumeralTwelve][\USymbCharTwo{33}{107}] % ROMAN NUMERAL TWELVE + \definesymbol[RomanNumeralFifty][\USymbCharTwo{33}{108}] % ROMAN NUMERAL FIFTY + \definesymbol[RomanNumeralOneHundred][\USymbCharTwo{33}{109}] % ROMAN NUMERAL ONE HUNDRED + \definesymbol[RomanNumeralFiveHundred][\USymbCharTwo{33}{110}] % ROMAN NUMERAL FIVE HUNDRED + \definesymbol[RomanNumeralOneThousand][\USymbCharTwo{33}{111}] % ROMAN NUMERAL ONE THOUSAND + \definesymbol[RomanNumeralOneThousandCD][\USymbCharTwo{33}{128}] % ROMAN NUMERAL ONE THOUSAND C D + \definesymbol[RomanNumeralFiveThousand][\USymbCharTwo{33}{129}] % ROMAN NUMERAL FIVE THOUSAND + \definesymbol[RomanNumeralTenThousand][\USymbCharTwo{33}{130}] % ROMAN NUMERAL TEN THOUSAND + \definesymbol[RomanNumeralReversedOneHundred][\USymbCharTwo{33}{131}] % ROMAN NUMERAL REVERSED ONE HUNDRED + +\stopsymbolset + +\startsymbolset[Unicode Small Roman Numerals] % 0x2150: Requires UnicodeRegular21 + + \definesymbol[SmallRomanNumeralOne][\USymbCharTwo{33}{112}] % SMALL ROMAN NUMERAL ONE + \definesymbol[SmallRomanNumeralTwo][\USymbCharTwo{33}{113}] % SMALL ROMAN NUMERAL TWO + \definesymbol[SmallRomanNumeralThree][\USymbCharTwo{33}{114}] % SMALL ROMAN NUMERAL THREE + \definesymbol[SmallRomanNumeralFour][\USymbCharTwo{33}{115}] % SMALL ROMAN NUMERAL FOUR + \definesymbol[SmallRomanNumeralFive][\USymbCharTwo{33}{116}] % SMALL ROMAN NUMERAL FIVE + \definesymbol[SmallRomanNumeralSix][\USymbCharTwo{33}{117}] % SMALL ROMAN NUMERAL SIX + \definesymbol[SmallRomanNumeralSeven][\USymbCharTwo{33}{118}] % SMALL ROMAN NUMERAL SEVEN + \definesymbol[SmallRomanNumeralEight][\USymbCharTwo{33}{119}] % SMALL ROMAN NUMERAL EIGHT + \definesymbol[SmallRomanNumeralNine][\USymbCharTwo{33}{120}] % SMALL ROMAN NUMERAL NINE + \definesymbol[SmallRomanNumeralTen][\USymbCharTwo{33}{121}] % SMALL ROMAN NUMERAL TEN + \definesymbol[SmallRomanNumeralEleven][\USymbCharTwo{33}{122}] % SMALL ROMAN NUMERAL ELEVEN + \definesymbol[SmallRomanNumeralTwelve][\USymbCharTwo{33}{123}] % SMALL ROMAN NUMERAL TWELVE + \definesymbol[SmallRomanNumeralFifty][\USymbCharTwo{33}{124}] % SMALL ROMAN NUMERAL FIFTY + \definesymbol[SmallRomanNumeralOneHundred][\USymbCharTwo{33}{125}] % SMALL ROMAN NUMERAL ONE HUNDRED + \definesymbol[SmallRomanNumeralFiveHundred][\USymbCharTwo{33}{126}] % SMALL ROMAN NUMERAL FIVE HUNDRED + \definesymbol[SmallRomanNumeralOneThousand][\USymbCharTwo{33}{127}] % SMALL ROMAN NUMERAL ONE THOUSAND + +\stopsymbolset + +\startsymbolset[Unicode Arrows] % 0x2190: Requires UnicodeRegular21 + + \definesymbol[LeftwardsArrow][\USymbChar{33}{144}] % LEFTWARDS ARROW + \definesymbol[UpwardsArrow][\USymbChar{33}{145}] % UPWARDS ARROW + \definesymbol[RightwardsArrow][\USymbChar{33}{146}] % RIGHTWARDS ARROW + \definesymbol[DownwardsArrow][\USymbChar{33}{147}] % DOWNWARDS ARROW + \definesymbol[LeftRightArrow][\USymbChar{33}{148}] % LEFT RIGHT ARROW + \definesymbol[UpDownArrow][\USymbChar{33}{149}] % UP DOWN ARROW + \definesymbol[NorthWestArrow][\USymbChar{33}{150}] % NORTH WEST ARROW + \definesymbol[NorthEastArrow][\USymbChar{33}{151}] % NORTH EAST ARROW + \definesymbol[SouthEastArrow][\USymbChar{33}{152}] % SOUTH EAST ARROW + \definesymbol[SouthWestArrow][\USymbChar{33}{153}] % SOUTH WEST ARROW + \definesymbol[LeftwardsArrowWithStroke][\USymbChar{33}{154}] % LEFTWARDS ARROW WITH STROKE + \definesymbol[RightwardsArrowWithStroke][\USymbChar{33}{155}] % RIGHTWARDS ARROW WITH STROKE + \definesymbol[LeftwardsWaveArrow][\USymbChar{33}{156}] % LEFTWARDS WAVE ARROW + \definesymbol[RightwardsWaveArrow][\USymbChar{33}{157}] % RIGHTWARDS WAVE ARROW + \definesymbol[LeftwardsTwoHeadedArrow][\USymbChar{33}{158}] % LEFTWARDS TWO HEADED ARROW + \definesymbol[UpwardsTwoHeadedArrow][\USymbChar{33}{159}] % UPWARDS TWO HEADED ARROW + \definesymbol[RightwardsTwoHeadedArrow][\USymbChar{33}{160}] % RIGHTWARDS TWO HEADED ARROW + \definesymbol[DownwardsTwoHeadedArrow][\USymbChar{33}{161}] % DOWNWARDS TWO HEADED ARROW + \definesymbol[LeftwardsArrowWithTail][\USymbChar{33}{162}] % LEFTWARDS ARROW WITH TAIL + \definesymbol[RightwardsArrowWithTail][\USymbChar{33}{163}] % RIGHTWARDS ARROW WITH TAIL + \definesymbol[LeftwardsArrowFromBar][\USymbChar{33}{164}] % LEFTWARDS ARROW FROM BAR + \definesymbol[UpwardsArrowFromBar][\USymbChar{33}{165}] % UPWARDS ARROW FROM BAR + \definesymbol[RightwardsArrowFromBar][\USymbChar{33}{166}] % RIGHTWARDS ARROW FROM BAR + \definesymbol[DownwardsArrowFromBar][\USymbChar{33}{167}] % DOWNWARDS ARROW FROM BAR + \definesymbol[UpDownArrowWithBase][\USymbChar{33}{168}] % UP DOWN ARROW WITH BASE + \definesymbol[LeftwardsArrowWithHook][\USymbChar{33}{169}] % LEFTWARDS ARROW WITH HOOK + \definesymbol[RightwardsArrowWithHook][\USymbChar{33}{170}] % RIGHTWARDS ARROW WITH HOOK + \definesymbol[LeftwardsArrowWithLoop][\USymbChar{33}{171}] % LEFTWARDS ARROW WITH LOOP + \definesymbol[RightwardsArrowWithLoop][\USymbChar{33}{172}] % RIGHTWARDS ARROW WITH LOOP + \definesymbol[LeftRightWaveArrow][\USymbChar{33}{173}] % LEFT RIGHT WAVE ARROW + \definesymbol[LeftRightArrowWithStroke][\USymbChar{33}{174}] % LEFT RIGHT ARROW WITH STROKE + \definesymbol[DownwardsZigzagArrow][\USymbChar{33}{175}] % DOWNWARDS ZIGZAG ARROW + \definesymbol[UpwardsArrowWithTipLeftwards][\USymbChar{33}{176}] % UPWARDS ARROW WITH TIP LEFTWARDS + \definesymbol[UpwardsArrowWithTipRightwards][\USymbChar{33}{177}] % UPWARDS ARROW WITH TIP RIGHTWARDS + \definesymbol[DownwardsArrowWithTipLeftwards][\USymbChar{33}{178}] % DOWNWARDS ARROW WITH TIP LEFTWARDS + \definesymbol[DownwardsArrowWithTipRightwards][\USymbChar{33}{179}] % DOWNWARDS ARROW WITH TIP RIGHTWARDS + \definesymbol[RightwardsArrowWithCornerDownwards][\USymbChar{33}{180}] % RIGHTWARDS ARROW WITH CORNER DOWNWARDS + \definesymbol[DownwardsArrowWithCornerLeftwards][\USymbChar{33}{181}] % DOWNWARDS ARROW WITH CORNER LEFTWARDS + \definesymbol[AnticlockwiseTopSemicircleArrow][\USymbChar{33}{182}] % ANTICLOCKWISE TOP SEMICIRCLE ARROW + \definesymbol[ClockwiseTopSemicircleArrow][\USymbChar{33}{183}] % CLOCKWISE TOP SEMICIRCLE ARROW + \definesymbol[NorthWestArrowToLongBar][\USymbChar{33}{184}] % NORTH WEST ARROW TO LONG BAR + \definesymbol[AnticlockwiseOpenCircleArrow][\USymbChar{33}{186}] % ANTICLOCKWISE OPEN CIRCLE ARROW + \definesymbol[ClockwiseOpenCircleArrow][\USymbChar{33}{187}] % CLOCKWISE OPEN CIRCLE ARROW + \definesymbol[LeftwardsHarpoonWithBarbUpwards][\USymbChar{33}{188}] % LEFTWARDS HARPOON WITH BARB UPWARDS + \definesymbol[LeftwardsHarpoonWithBarbDownwards][\USymbChar{33}{189}] % LEFTWARDS HARPOON WITH BARB DOWNWARDS + \definesymbol[UpwardsHarpoonWithBarbRightwards][\USymbChar{33}{190}] % UPWARDS HARPOON WITH BARB RIGHTWARDS + \definesymbol[UpwardsHarpoonWithBarbLeftwards][\USymbChar{33}{191}] % UPWARDS HARPOON WITH BARB LEFTWARDS + \definesymbol[RightwardsHarpoonWithBarbUpwards][\USymbChar{33}{192}] % RIGHTWARDS HARPOON WITH BARB UPWARDS + \definesymbol[RightwardsHarpoonWithBarbDownwards][\USymbChar{33}{193}] % RIGHTWARDS HARPOON WITH BARB DOWNWARDS + \definesymbol[DownwardsHarpoonWithBarbRightwards][\USymbChar{33}{194}] % DOWNWARDS HARPOON WITH BARB RIGHTWARDS + \definesymbol[DownwardsHarpoonWithBarbLeftwards][\USymbChar{33}{195}] % DOWNWARDS HARPOON WITH BARB LEFTWARDS + \definesymbol[LeftwardsSquiggleArrow][\USymbChar{33}{220}] % LEFTWARDS SQUIGGLE ARROW + \definesymbol[RightwardsSquiggleArrow][\USymbChar{33}{221}] % RIGHTWARDS SQUIGGLE ARROW + \definesymbol[UpwardsArrowWithDoubleStroke][\USymbChar{33}{222}] % UPWARDS ARROW WITH DOUBLE STROKE + \definesymbol[DownwardsArrowWithDoubleStroke][\USymbChar{33}{223}] % DOWNWARDS ARROW WITH DOUBLE STROKE + \definesymbol[LeftwardsDashedArrow][\USymbChar{33}{224}] % LEFTWARDS DASHED ARROW + \definesymbol[UpwardsDashedArrow][\USymbChar{33}{225}] % UPWARDS DASHED ARROW + \definesymbol[RightwardsDashedArrow][\USymbChar{33}{226}] % RIGHTWARDS DASHED ARROW + \definesymbol[DownwardsDashedArrow][\USymbChar{33}{227}] % DOWNWARDS DASHED ARROW + \definesymbol[LeftwardsArrowToBar][\USymbChar{33}{228}] % LEFTWARDS ARROW TO BAR + \definesymbol[RightwardsArrowToBar][\USymbChar{33}{229}] % RIGHTWARDS ARROW TO BAR + \definesymbol[LeftwardsWhiteArrow][\USymbChar{33}{230}] % LEFTWARDS WHITE ARROW + \definesymbol[UpwardsWhiteArrow][\USymbChar{33}{231}] % UPWARDS WHITE ARROW + \definesymbol[RightwardsWhiteArrow][\USymbChar{33}{232}] % RIGHTWARDS WHITE ARROW + \definesymbol[DownwardsWhiteArrow][\USymbChar{33}{233}] % DOWNWARDS WHITE ARROW + \definesymbol[UpwardsWhiteArrowFromBar][\USymbChar{33}{234}] % UPWARDS WHITE ARROW FROM BAR + \definesymbol[UpwardsWhiteArrowOnPedestal][\USymbChar{33}{235}] % UPWARDS WHITE ARROW ON PEDESTAL + \definesymbol[UpwardsWhiteArrowOnPedestalWithHorizontalBar][\USymbChar{33}{236}] % UPWARDS WHITE ARROW ON PEDESTAL WITH HORIZONTAL BAR + \definesymbol[UpwardsWhiteArrowOnPedestalWithVerticalBar][\USymbChar{33}{237}] % UPWARDS WHITE ARROW ON PEDESTAL WITH VERTICAL BAR + \definesymbol[RightwardsWhiteArrowFromWall][\USymbChar{33}{240}] % RIGHTWARDS WHITE ARROW FROM WALL + \definesymbol[NorthWestArrowToCorner][\USymbChar{33}{241}] % NORTH WEST ARROW TO CORNER + \definesymbol[SouthEastArrowToCorner][\USymbChar{33}{242}] % SOUTH EAST ARROW TO CORNER + \definesymbol[UpDownWhiteArrow][\USymbChar{33}{243}] % UP DOWN WHITE ARROW + +\stopsymbolset + +\startsymbolset[Unicode Multi Arrows] % 0x2190: Requires UnicodeRegular21 + + \definesymbol[LeftwardsArrowToBarOverRightwardsArrowToBar][\USymbChar{33}{185}] % LEFTWARDS ARROW TO BAR OVER RIGHTWARDS ARROW TO BAR + \definesymbol[RightwardsArrowOverLeftwardsArrow][\USymbChar{33}{196}] % RIGHTWARDS ARROW OVER LEFTWARDS ARROW + \definesymbol[UpwardsArrowLeftwardsOfDownwardsArrow][\USymbChar{33}{197}] % UPWARDS ARROW LEFTWARDS OF DOWNWARDS ARROW + \definesymbol[LeftwardsArrowOverRightwardsArrow][\USymbChar{33}{198}] % LEFTWARDS ARROW OVER RIGHTWARDS ARROW + \definesymbol[LeftwardsPairedArrows][\USymbChar{33}{199}] % LEFTWARDS PAIRED ARROWS + \definesymbol[UpwardsPairedArrows][\USymbChar{33}{200}] % UPWARDS PAIRED ARROWS + \definesymbol[RightwardsPairedArrows][\USymbChar{33}{201}] % RIGHTWARDS PAIRED ARROWS + \definesymbol[DownwardsPairedArrows][\USymbChar{33}{202}] % DOWNWARDS PAIRED ARROWS + \definesymbol[LeftwardsHarpoonOverRightwardsHarpoon][\USymbChar{33}{203}] % LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON + \definesymbol[RightwardsHarpoonOverLeftwardsHarpoon][\USymbChar{33}{204}] % RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON + \definesymbol[LeftwardsDoubleArrowWithStroke][\USymbChar{33}{205}] % LEFTWARDS DOUBLE ARROW WITH STROKE + \definesymbol[LeftRightDoubleArrowWithStroke][\USymbChar{33}{206}] % LEFT RIGHT DOUBLE ARROW WITH STROKE + \definesymbol[RightwardsDoubleArrowWithStroke][\USymbChar{33}{207}] % RIGHTWARDS DOUBLE ARROW WITH STROKE + \definesymbol[LeftwardsDoubleArrow][\USymbChar{33}{208}] % LEFTWARDS DOUBLE ARROW + \definesymbol[UpwardsDoubleArrow][\USymbChar{33}{209}] % UPWARDS DOUBLE ARROW + \definesymbol[RightwardsDoubleArrow][\USymbChar{33}{210}] % RIGHTWARDS DOUBLE ARROW + \definesymbol[DownwardsDoubleArrow][\USymbChar{33}{211}] % DOWNWARDS DOUBLE ARROW + \definesymbol[LeftRightDoubleArrow][\USymbChar{33}{212}] % LEFT RIGHT DOUBLE ARROW + \definesymbol[UpDownDoubleArrow][\USymbChar{33}{213}] % UP DOWN DOUBLE ARROW + \definesymbol[NorthWestDoubleArrow][\USymbChar{33}{214}] % NORTH WEST DOUBLE ARROW + \definesymbol[NorthEastDoubleArrow][\USymbChar{33}{215}] % NORTH EAST DOUBLE ARROW + \definesymbol[SouthEastDoubleArrow][\USymbChar{33}{216}] % SOUTH EAST DOUBLE ARROW + \definesymbol[SouthWestDoubleArrow][\USymbChar{33}{217}] % SOUTH WEST DOUBLE ARROW + \definesymbol[LeftwardsTripleArrow][\USymbChar{33}{218}] % LEFTWARDS TRIPLE ARROW + \definesymbol[RightwardsTripleArrow][\USymbChar{33}{219}] % RIGHTWARDS TRIPLE ARROW + \definesymbol[UpwardsWhiteDoubleArrow][\USymbChar{33}{238}] % UPWARDS WHITE DOUBLE ARROW + \definesymbol[UpwardsWhiteDoubleArrowOnPedestal][\USymbChar{33}{239}] % UPWARDS WHITE DOUBLE ARROW ON PEDESTAL + +\stopsymbolset + + +\startsymbolset[Unicode Optical Character Recognition] % 0x2440: Requires UnicodeRegular24 + + \definesymbol[OcrHook][\USymbChar{36}{64}] % OCR HOOK + \definesymbol[OcrChair][\USymbChar{36}{65}] % OCR CHAIR + \definesymbol[OcrFork][\USymbChar{36}{66}] % OCR FORK + \definesymbol[OcrInvertedFork][\USymbChar{36}{67}] % OCR INVERTED FORK + \definesymbol[OcrBeltBuckle][\USymbChar{36}{68}] % OCR BELT BUCKLE + \definesymbol[OcrBowTie][\USymbChar{36}{69}] % OCR BOW TIE + \definesymbol[OcrBranchBankIdentification][\USymbChar{36}{70}] % OCR BRANCH BANK IDENTIFICATION + \definesymbol[OcrAmountOfCheck][\USymbChar{36}{71}] % OCR AMOUNT OF CHECK + \definesymbol[OcrDash][\USymbChar{36}{72}] % OCR DASH + \definesymbol[OcrCustomerAccountNumber][\USymbChar{36}{73}] % OCR CUSTOMER ACCOUNT NUMBER + \definesymbol[OcrDoubleBackslash][\USymbChar{36}{74}] % OCR DOUBLE BACKSLASH + +\stopsymbolset + + +\startsymbolset[Unicode Box Drawing] % 0x2500: Requires UnicodeRegular25 + + \definesymbol[LightHorizontal][\USymbChar{37}{0}] % BOX DRAWINGS LIGHT HORIZONTAL + \definesymbol[HeavyHorizontal][\USymbChar{37}{1}] % BOX DRAWINGS HEAVY HORIZONTAL + \definesymbol[LightVertical][\USymbChar{37}{2}] % BOX DRAWINGS LIGHT VERTICAL + \definesymbol[HeavyVertical][\USymbChar{37}{3}] % BOX DRAWINGS HEAVY VERTICAL + \definesymbol[LightTripleDashHorizontal][\USymbChar{37}{4}] % BOX DRAWINGS LIGHT TRIPLE DASH HORIZONTAL + \definesymbol[HeavyTripleDashHorizontal][\USymbChar{37}{5}] % BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL + \definesymbol[LightTripleDashVertical][\USymbChar{37}{6}] % BOX DRAWINGS LIGHT TRIPLE DASH VERTICAL + \definesymbol[HeavyTripleDashVertical][\USymbChar{37}{7}] % BOX DRAWINGS HEAVY TRIPLE DASH VERTICAL + \definesymbol[LightQuadrupleDashHorizontal][\USymbChar{37}{8}] % BOX DRAWINGS LIGHT QUADRUPLE DASH HORIZONTAL + \definesymbol[HeavyQuadrupleDashHorizontal][\USymbChar{37}{9}] % BOX DRAWINGS HEAVY QUADRUPLE DASH HORIZONTAL + \definesymbol[LightQuadrupleDashVertical][\USymbChar{37}{10}] % BOX DRAWINGS LIGHT QUADRUPLE DASH VERTICAL + \definesymbol[HeavyQuadrupleDashVertical][\USymbChar{37}{11}] % BOX DRAWINGS HEAVY QUADRUPLE DASH VERTICAL + \definesymbol[LightDownAndRight][\USymbChar{37}{12}] % BOX DRAWINGS LIGHT DOWN AND RIGHT + \definesymbol[DownLightAndRightHeavy][\USymbChar{37}{13}] % BOX DRAWINGS DOWN LIGHT AND RIGHT HEAVY + \definesymbol[DownHeavyAndRightLight][\USymbChar{37}{14}] % BOX DRAWINGS DOWN HEAVY AND RIGHT LIGHT + \definesymbol[HeavyDownAndRight][\USymbChar{37}{15}] % BOX DRAWINGS HEAVY DOWN AND RIGHT + \definesymbol[LightDownAndLeft][\USymbChar{37}{16}] % BOX DRAWINGS LIGHT DOWN AND LEFT + \definesymbol[DownLightAndLeftHeavy][\USymbChar{37}{17}] % BOX DRAWINGS DOWN LIGHT AND LEFT HEAVY + \definesymbol[DownHeavyAndLeftLight][\USymbChar{37}{18}] % BOX DRAWINGS DOWN HEAVY AND LEFT LIGHT + \definesymbol[HeavyDownAndLeft][\USymbChar{37}{19}] % BOX DRAWINGS HEAVY DOWN AND LEFT + \definesymbol[LightUpAndRight][\USymbChar{37}{20}] % BOX DRAWINGS LIGHT UP AND RIGHT + \definesymbol[UpLightAndRightHeavy][\USymbChar{37}{21}] % BOX DRAWINGS UP LIGHT AND RIGHT HEAVY + \definesymbol[UpHeavyAndRightLight][\USymbChar{37}{22}] % BOX DRAWINGS UP HEAVY AND RIGHT LIGHT + \definesymbol[HeavyUpAndRight][\USymbChar{37}{23}] % BOX DRAWINGS HEAVY UP AND RIGHT + \definesymbol[LightUpAndLeft][\USymbChar{37}{24}] % BOX DRAWINGS LIGHT UP AND LEFT + \definesymbol[UpLightAndLeftHeavy][\USymbChar{37}{25}] % BOX DRAWINGS UP LIGHT AND LEFT HEAVY + \definesymbol[UpHeavyAndLeftLight][\USymbChar{37}{26}] % BOX DRAWINGS UP HEAVY AND LEFT LIGHT + \definesymbol[HeavyUpAndLeft][\USymbChar{37}{27}] % BOX DRAWINGS HEAVY UP AND LEFT + \definesymbol[LightVerticalAndRight][\USymbChar{37}{28}] % BOX DRAWINGS LIGHT VERTICAL AND RIGHT + \definesymbol[VerticalLightAndRightHeavy][\USymbChar{37}{29}] % BOX DRAWINGS VERTICAL LIGHT AND RIGHT HEAVY + \definesymbol[UpHeavyAndRightDownLight][\USymbChar{37}{30}] % BOX DRAWINGS UP HEAVY AND RIGHT DOWN LIGHT + \definesymbol[DownHeavyAndRightUpLight][\USymbChar{37}{31}] % BOX DRAWINGS DOWN HEAVY AND RIGHT UP LIGHT + \definesymbol[VerticalHeavyAndRightLight][\USymbChar{37}{32}] % BOX DRAWINGS VERTICAL HEAVY AND RIGHT LIGHT + \definesymbol[DownLightAndRightUpHeavy][\USymbChar{37}{33}] % BOX DRAWINGS DOWN LIGHT AND RIGHT UP HEAVY + \definesymbol[UpLightAndRightDownHeavy][\USymbChar{37}{34}] % BOX DRAWINGS UP LIGHT AND RIGHT DOWN HEAVY + \definesymbol[HeavyVerticalAndRight][\USymbChar{37}{35}] % BOX DRAWINGS HEAVY VERTICAL AND RIGHT + \definesymbol[LightVerticalAndLeft][\USymbChar{37}{36}] % BOX DRAWINGS LIGHT VERTICAL AND LEFT + \definesymbol[VerticalLightAndLeftHeavy][\USymbChar{37}{37}] % BOX DRAWINGS VERTICAL LIGHT AND LEFT HEAVY + \definesymbol[UpHeavyAndLeftDownLight][\USymbChar{37}{38}] % BOX DRAWINGS UP HEAVY AND LEFT DOWN LIGHT + \definesymbol[DownHeavyAndLeftUpLight][\USymbChar{37}{39}] % BOX DRAWINGS DOWN HEAVY AND LEFT UP LIGHT + \definesymbol[VerticalHeavyAndLeftLight][\USymbChar{37}{40}] % BOX DRAWINGS VERTICAL HEAVY AND LEFT LIGHT + \definesymbol[DownLightAndLeftUpHeavy][\USymbChar{37}{41}] % BOX DRAWINGS DOWN LIGHT AND LEFT UP HEAVY + \definesymbol[UpLightAndLeftDownHeavy][\USymbChar{37}{42}] % BOX DRAWINGS UP LIGHT AND LEFT DOWN HEAVY + \definesymbol[HeavyVerticalAndLeft][\USymbChar{37}{43}] % BOX DRAWINGS HEAVY VERTICAL AND LEFT + \definesymbol[LightDownAndHorizontal][\USymbChar{37}{44}] % BOX DRAWINGS LIGHT DOWN AND HORIZONTAL + \definesymbol[LeftHeavyAndRightDownLight][\USymbChar{37}{45}] % BOX DRAWINGS LEFT HEAVY AND RIGHT DOWN LIGHT + \definesymbol[RightHeavyAndLeftDownLight][\USymbChar{37}{46}] % BOX DRAWINGS RIGHT HEAVY AND LEFT DOWN LIGHT + \definesymbol[DownLightAndHorizontalHeavy][\USymbChar{37}{47}] % BOX DRAWINGS DOWN LIGHT AND HORIZONTAL HEAVY + \definesymbol[DownHeavyAndHorizontalLight][\USymbChar{37}{48}] % BOX DRAWINGS DOWN HEAVY AND HORIZONTAL LIGHT + \definesymbol[RightLightAndLeftDownHeavy][\USymbChar{37}{49}] % BOX DRAWINGS RIGHT LIGHT AND LEFT DOWN HEAVY + \definesymbol[LeftLightAndRightDownHeavy][\USymbChar{37}{50}] % BOX DRAWINGS LEFT LIGHT AND RIGHT DOWN HEAVY + \definesymbol[HeavyDownAndHorizontal][\USymbChar{37}{51}] % BOX DRAWINGS HEAVY DOWN AND HORIZONTAL + \definesymbol[LightUpAndHorizontal][\USymbChar{37}{52}] % BOX DRAWINGS LIGHT UP AND HORIZONTAL + \definesymbol[LeftHeavyAndRightUpLight][\USymbChar{37}{53}] % BOX DRAWINGS LEFT HEAVY AND RIGHT UP LIGHT + \definesymbol[RightHeavyAndLeftUpLight][\USymbChar{37}{54}] % BOX DRAWINGS RIGHT HEAVY AND LEFT UP LIGHT + \definesymbol[UpLightAndHorizontalHeavy][\USymbChar{37}{55}] % BOX DRAWINGS UP LIGHT AND HORIZONTAL HEAVY + \definesymbol[UpHeavyAndHorizontalLight][\USymbChar{37}{56}] % BOX DRAWINGS UP HEAVY AND HORIZONTAL LIGHT + \definesymbol[RightLightAndLeftUpHeavy][\USymbChar{37}{57}] % BOX DRAWINGS RIGHT LIGHT AND LEFT UP HEAVY + \definesymbol[LeftLightAndRightUpHeavy][\USymbChar{37}{58}] % BOX DRAWINGS LEFT LIGHT AND RIGHT UP HEAVY + \definesymbol[HeavyUpAndHorizontal][\USymbChar{37}{59}] % BOX DRAWINGS HEAVY UP AND HORIZONTAL + \definesymbol[LightVerticalAndHorizontal][\USymbChar{37}{60}] % BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL + \definesymbol[LeftHeavyAndRightVerticalLight][\USymbChar{37}{61}] % BOX DRAWINGS LEFT HEAVY AND RIGHT VERTICAL LIGHT + \definesymbol[RightHeavyAndLeftVerticalLight][\USymbChar{37}{62}] % BOX DRAWINGS RIGHT HEAVY AND LEFT VERTICAL LIGHT + \definesymbol[VerticalLightAndHorizontalHeavy][\USymbChar{37}{63}] % BOX DRAWINGS VERTICAL LIGHT AND HORIZONTAL HEAVY + \definesymbol[UpHeavyAndDownHorizontalLight][\USymbChar{37}{64}] % BOX DRAWINGS UP HEAVY AND DOWN HORIZONTAL LIGHT + \definesymbol[DownHeavyAndUpHorizontalLight][\USymbChar{37}{65}] % BOX DRAWINGS DOWN HEAVY AND UP HORIZONTAL LIGHT + \definesymbol[VerticalHeavyAndHorizontalLight][\USymbChar{37}{66}] % BOX DRAWINGS VERTICAL HEAVY AND HORIZONTAL LIGHT + \definesymbol[LeftUpHeavyAndRightDownLight][\USymbChar{37}{67}] % BOX DRAWINGS LEFT UP HEAVY AND RIGHT DOWN LIGHT + \definesymbol[RightUpHeavyAndLeftDownLight][\USymbChar{37}{68}] % BOX DRAWINGS RIGHT UP HEAVY AND LEFT DOWN LIGHT + \definesymbol[LeftDownHeavyAndRightUpLight][\USymbChar{37}{69}] % BOX DRAWINGS LEFT DOWN HEAVY AND RIGHT UP LIGHT + \definesymbol[RightDownHeavyAndLeftUpLight][\USymbChar{37}{70}] % BOX DRAWINGS RIGHT DOWN HEAVY AND LEFT UP LIGHT + \definesymbol[DownLightAndUpHorizontalHeavy][\USymbChar{37}{71}] % BOX DRAWINGS DOWN LIGHT AND UP HORIZONTAL HEAVY + \definesymbol[UpLightAndDownHorizontalHeavy][\USymbChar{37}{72}] % BOX DRAWINGS UP LIGHT AND DOWN HORIZONTAL HEAVY + \definesymbol[RightLightAndLeftVerticalHeavy][\USymbChar{37}{73}] % BOX DRAWINGS RIGHT LIGHT AND LEFT VERTICAL HEAVY + \definesymbol[LeftLightAndRightVerticalHeavy][\USymbChar{37}{74}] % BOX DRAWINGS LEFT LIGHT AND RIGHT VERTICAL HEAVY + \definesymbol[HeavyVerticalAndHorizontal][\USymbChar{37}{75}] % BOX DRAWINGS HEAVY VERTICAL AND HORIZONTAL + \definesymbol[LightArcDownAndRight][\USymbChar{37}{109}] % BOX DRAWINGS LIGHT ARC DOWN AND RIGHT + \definesymbol[LightArcDownAndLeft][\USymbChar{37}{110}] % BOX DRAWINGS LIGHT ARC DOWN AND LEFT + \definesymbol[LightArcUpAndLeft][\USymbChar{37}{111}] % BOX DRAWINGS LIGHT ARC UP AND LEFT + \definesymbol[LightArcUpAndRight][\USymbChar{37}{112}] % BOX DRAWINGS LIGHT ARC UP AND RIGHT + \definesymbol[LightDiagonalUpperRightToLowerLeft][\USymbChar{37}{113}] % BOX DRAWINGS LIGHT DIAGONAL UPPER RIGHT TO LOWER LEFT + \definesymbol[LightDiagonalUpperLeftToLowerRight][\USymbChar{37}{114}] % BOX DRAWINGS LIGHT DIAGONAL UPPER LEFT TO LOWER RIGHT + \definesymbol[LightDiagonalCross][\USymbChar{37}{115}] % BOX DRAWINGS LIGHT DIAGONAL CROSS + \definesymbol[LightLeft][\USymbChar{37}{116}] % BOX DRAWINGS LIGHT LEFT + \definesymbol[LightUp][\USymbChar{37}{117}] % BOX DRAWINGS LIGHT UP + \definesymbol[LightRight][\USymbChar{37}{118}] % BOX DRAWINGS LIGHT RIGHT + \definesymbol[LightDown][\USymbChar{37}{119}] % BOX DRAWINGS LIGHT DOWN + \definesymbol[HeavyLeft][\USymbChar{37}{120}] % BOX DRAWINGS HEAVY LEFT + \definesymbol[HeavyUp][\USymbChar{37}{121}] % BOX DRAWINGS HEAVY UP + \definesymbol[HeavyRight][\USymbChar{37}{122}] % BOX DRAWINGS HEAVY RIGHT + \definesymbol[HeavyDown][\USymbChar{37}{123}] % BOX DRAWINGS HEAVY DOWN + \definesymbol[LightLeftAndHeavyRight][\USymbChar{37}{124}] % BOX DRAWINGS LIGHT LEFT AND HEAVY RIGHT + \definesymbol[LightUpAndHeavyDown][\USymbChar{37}{125}] % BOX DRAWINGS LIGHT UP AND HEAVY DOWN + \definesymbol[HeavyLeftAndLightRight][\USymbChar{37}{126}] % BOX DRAWINGS HEAVY LEFT AND LIGHT RIGHT + \definesymbol[HeavyUpAndLightDown][\USymbChar{37}{127}] % BOX DRAWINGS HEAVY UP AND LIGHT DOWN + +\stopsymbolset + +\startsymbolset[Unicode Circled Digits] % 0x2460: Requires UnicodeRegular24 + + \definesymbol[CircledOne][\USymbCharZapf{36}{96}] % CIRCLED DIGIT ONE + \definesymbol[CircledTwo][\USymbCharZapf{36}{97}] % CIRCLED DIGIT TWO + \definesymbol[CircledThree][\USymbCharZapf{36}{98}] % CIRCLED DIGIT THREE + \definesymbol[CircledFour][\USymbCharZapf{36}{99}] % CIRCLED DIGIT FOUR + \definesymbol[CircledFive][\USymbCharZapf{36}{100}] % CIRCLED DIGIT FIVE + \definesymbol[CircledSix][\USymbCharZapf{36}{101}] % CIRCLED DIGIT SIX + \definesymbol[CircledSeven][\USymbCharZapf{36}{102}] % CIRCLED DIGIT SEVEN + \definesymbol[CircledEight][\USymbCharZapf{36}{103}] % CIRCLED DIGIT EIGHT + \definesymbol[CircledNine][\USymbCharZapf{36}{104}] % CIRCLED DIGIT NINE + \definesymbol[CircledTen][\USymbCharZapf{36}{105}] % CIRCLED NUMBER TEN + +\stopsymbolset + +\startsymbolset[Unicode Double Box Drawing] % 0x2500: Requires UnicodeRegular25 + + \definesymbol[LightDoubleDashHorizontal][\USymbChar{37}{76}] % BOX DRAWINGS LIGHT DOUBLE DASH HORIZONTAL + \definesymbol[HeavyDoubleDashHorizontal][\USymbChar{37}{77}] % BOX DRAWINGS HEAVY DOUBLE DASH HORIZONTAL + \definesymbol[LightDoubleDashVertical][\USymbChar{37}{78}] % BOX DRAWINGS LIGHT DOUBLE DASH VERTICAL + \definesymbol[HeavyDoubleDashVertical][\USymbChar{37}{79}] % BOX DRAWINGS HEAVY DOUBLE DASH VERTICAL + \definesymbol[DoubleHorizontal][\USymbChar{37}{80}] % BOX DRAWINGS DOUBLE HORIZONTAL + \definesymbol[DoubleVertical][\USymbChar{37}{81}] % BOX DRAWINGS DOUBLE VERTICAL + \definesymbol[DownSingleAndRightDouble][\USymbChar{37}{82}] % BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE + \definesymbol[DownDoubleAndRightSingle][\USymbChar{37}{83}] % BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE + \definesymbol[DoubleDownAndRight][\USymbChar{37}{84}] % BOX DRAWINGS DOUBLE DOWN AND RIGHT + \definesymbol[DownSingleAndLeftDouble][\USymbChar{37}{85}] % BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE + \definesymbol[DownDoubleAndLeftSingle][\USymbChar{37}{86}] % BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE + \definesymbol[DoubleDownAndLeft][\USymbChar{37}{87}] % BOX DRAWINGS DOUBLE DOWN AND LEFT + \definesymbol[UpSingleAndRightDouble][\USymbChar{37}{88}] % BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE + \definesymbol[UpDoubleAndRightSingle][\USymbChar{37}{89}] % BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE + \definesymbol[DoubleUpAndRight][\USymbChar{37}{90}] % BOX DRAWINGS DOUBLE UP AND RIGHT + \definesymbol[UpSingleAndLeftDouble][\USymbChar{37}{91}] % BOX DRAWINGS UP SINGLE AND LEFT DOUBLE + \definesymbol[UpDoubleAndLeftSingle][\USymbChar{37}{92}] % BOX DRAWINGS UP DOUBLE AND LEFT SINGLE + \definesymbol[DoubleUpAndLeft][\USymbChar{37}{93}] % BOX DRAWINGS DOUBLE UP AND LEFT + \definesymbol[VerticalSingleAndRightDouble][\USymbChar{37}{94}] % BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE + \definesymbol[VerticalDoubleAndRightSingle][\USymbChar{37}{95}] % BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE + \definesymbol[DoubleVerticalAndRight][\USymbChar{37}{96}] % BOX DRAWINGS DOUBLE VERTICAL AND RIGHT + \definesymbol[VerticalSingleAndLeftDouble][\USymbChar{37}{97}] % BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE + \definesymbol[VerticalDoubleAndLeftSingle][\USymbChar{37}{98}] % BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE + \definesymbol[DoubleVerticalAndLeft][\USymbChar{37}{99}] % BOX DRAWINGS DOUBLE VERTICAL AND LEFT + \definesymbol[DownSingleAndHorizontalDouble][\USymbChar{37}{100}] % BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE + \definesymbol[DownDoubleAndHorizontalSingle][\USymbChar{37}{101}] % BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE + \definesymbol[DoubleDownAndHorizontal][\USymbChar{37}{102}] % BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL + \definesymbol[UpSingleAndHorizontalDouble][\USymbChar{37}{103}] % BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE + \definesymbol[UpDoubleAndHorizontalSingle][\USymbChar{37}{104}] % BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE + \definesymbol[DoubleUpAndHorizontal][\USymbChar{37}{105}] % BOX DRAWINGS DOUBLE UP AND HORIZONTAL + \definesymbol[VerticalSingleAndHorizontalDouble][\USymbChar{37}{106}] % BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE + \definesymbol[VerticalDoubleAndHorizontalSingle][\USymbChar{37}{107}] % BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE + \definesymbol[DoubleVerticalAndHorizontal][\USymbChar{37}{108}] % BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL + +\stopsymbolset + +\startsymbolset[Unicode Block Elements] % 0x2580: Requires UnicodeRegular25 + + \definesymbol[UpperHalfBlock][\USymbChar{37}{128}] % UPPER HALF BLOCK + \definesymbol[LowerOneEighthBlock][\USymbChar{37}{129}] % LOWER ONE EIGHTH BLOCK + \definesymbol[LowerOneQuarterBlock][\USymbChar{37}{130}] % LOWER ONE QUARTER BLOCK + \definesymbol[LowerThreeEighthsBlock][\USymbChar{37}{131}] % LOWER THREE EIGHTHS BLOCK + \definesymbol[LowerHalfBlock][\USymbChar{37}{132}] % LOWER HALF BLOCK + \definesymbol[LowerFiveEighthsBlock][\USymbChar{37}{133}] % LOWER FIVE EIGHTHS BLOCK + \definesymbol[LowerThreeQuartersBlock][\USymbChar{37}{134}] % LOWER THREE QUARTERS BLOCK + \definesymbol[LowerSevenEighthsBlock][\USymbChar{37}{135}] % LOWER SEVEN EIGHTHS BLOCK + \definesymbol[FullBlock][\USymbChar{37}{136}] % FULL BLOCK + \definesymbol[LeftSevenEighthsBlock][\USymbChar{37}{137}] % LEFT SEVEN EIGHTHS BLOCK + \definesymbol[LeftThreeQuartersBlock][\USymbChar{37}{138}] % LEFT THREE QUARTERS BLOCK + \definesymbol[LeftFiveEighthsBlock][\USymbChar{37}{139}] % LEFT FIVE EIGHTHS BLOCK + \definesymbol[LeftHalfBlock][\USymbChar{37}{140}] % LEFT HALF BLOCK + \definesymbol[LeftThreeEighthsBlock][\USymbChar{37}{141}] % LEFT THREE EIGHTHS BLOCK + \definesymbol[LeftOneQuarterBlock][\USymbChar{37}{142}] % LEFT ONE QUARTER BLOCK + \definesymbol[LeftOneEighthBlock][\USymbChar{37}{143}] % LEFT ONE EIGHTH BLOCK + \definesymbol[RightHalfBlock][\USymbChar{37}{144}] % RIGHT HALF BLOCK + \definesymbol[UpperOneEighthBlock][\USymbChar{37}{148}] % UPPER ONE EIGHTH BLOCK + \definesymbol[RightOneEighthBlock][\USymbChar{37}{149}] % RIGHT ONE EIGHTH BLOCK + +\stopsymbolset + +\startsymbolset[Unicode Shade Characters] % 0x2580: Requires UnicodeRegular25 + + \definesymbol[LightShade][\USymbChar{37}{145}] % LIGHT SHADE + \definesymbol[MediumShade][\USymbChar{37}{146}] % MEDIUM SHADE + \definesymbol[DarkShade][\USymbChar{37}{147}] % DARK SHADE + +\stopsymbolset + +\startsymbolset[Unicode Terminal Graphics] % 0x2580: Requires UnicodeRegular25 + + \definesymbol[QuadrantLowerLeft][\USymbChar{37}{150}] % [Unassigned U+2596] + \definesymbol[QuadrantLowerRight][\USymbChar{37}{151}] % [Unassigned U+2597] + \definesymbol[QuadrantUpperLeft][\USymbChar{37}{152}] % [Unassigned U+2598] + \definesymbol[QuadrantUpperLeftAndLowerLeftAndLowerRight][\USymbChar{37}{153}] % [Unassigned U+2599] + \definesymbol[QuadrantUpperLeftAndLowerRight][\USymbChar{37}{154}] % [Unassigned U+259A] + \definesymbol[QuadrantUpperLeftAndUpperRightandLowerLeft][\USymbChar{37}{155}] % [Unassigned U+259B] + \definesymbol[QuadrantUpperLeftAndUpperRightAndLowerRight][\USymbChar{37}{156}] % [Unassigned U+259C] + \definesymbol[QuadrantUpperRight][\USymbChar{37}{157}] % [Unassigned U+259D] + \definesymbol[QuadrantUpperRightAndLowerLeft][\USymbChar{37}{158}] % [Unassigned U+259E] + \definesymbol[QuadrantUpperRightAndLowerLeftAndLowerRight][\USymbChar{37}{159}] % [Unassigned U+259F] + +\stopsymbolset + +\startsymbolset[Unicode Geometric Shapes] % 0x25A0: Requires UnicodeRegular25 + + \definesymbol[BlackSquare][\USymbChar{37}{160}] % BLACK SQUARE + \definesymbol[WhiteSquare][\USymbChar{37}{161}] % WHITE SQUARE + \definesymbol[WhiteSquareWithRoundedCorners][\USymbChar{37}{162}] % WHITE SQUARE WITH ROUNDED CORNERS + \definesymbol[WhiteSquareContainingBlackSmallSquare][\USymbChar{37}{163}] % WHITE SQUARE CONTAINING BLACK SMALL SQUARE + \definesymbol[SquareWithHorizontalFill][\USymbChar{37}{164}] % SQUARE WITH HORIZONTAL FILL + \definesymbol[SquareWithVerticalFill][\USymbChar{37}{165}] % SQUARE WITH VERTICAL FILL + \definesymbol[SquareWithOrthogonalCrosshatchFill][\USymbChar{37}{166}] % SQUARE WITH ORTHOGONAL CROSSHATCH FILL + \definesymbol[SquareWithUpperLeftToLowerRightFill][\USymbChar{37}{167}] % SQUARE WITH UPPER LEFT TO LOWER RIGHT FILL + \definesymbol[SquareWithUpperRightToLowerLeftFill][\USymbChar{37}{168}] % SQUARE WITH UPPER RIGHT TO LOWER LEFT FILL + \definesymbol[SquareWithDiagonalCrosshatchFill][\USymbChar{37}{169}] % SQUARE WITH DIAGONAL CROSSHATCH FILL + \definesymbol[BlackSmallSquare][\USymbChar{37}{170}] % BLACK SMALL SQUARE + \definesymbol[WhiteSmallSquare][\USymbChar{37}{171}] % WHITE SMALL SQUARE + \definesymbol[BlackRectangle][\USymbChar{37}{172}] % BLACK RECTANGLE + \definesymbol[WhiteRectangle][\USymbChar{37}{173}] % WHITE RECTANGLE + \definesymbol[BlackVerticalRectangle][\USymbChar{37}{174}] % BLACK VERTICAL RECTANGLE + \definesymbol[WhiteVerticalRectangle][\USymbChar{37}{175}] % WHITE VERTICAL RECTANGLE + \definesymbol[BlackParallelogram][\USymbChar{37}{176}] % BLACK PARALLELOGRAM + \definesymbol[WhiteParallelogram][\USymbChar{37}{177}] % WHITE PARALLELOGRAM + \definesymbol[BlackUpPointingTriangle][\USymbChar{37}{178}] % BLACK UP-POINTING TRIANGLE + \definesymbol[WhiteUpPointingTriangle][\USymbChar{37}{179}] % WHITE UP-POINTING TRIANGLE + \definesymbol[BlackUpPointingSmallTriangle][\USymbChar{37}{180}] % BLACK UP-POINTING SMALL TRIANGLE + \definesymbol[WhiteUpPointingSmallTriangle][\USymbChar{37}{181}] % WHITE UP-POINTING SMALL TRIANGLE + \definesymbol[BlackRightPointingTriangle][\USymbChar{37}{182}] % BLACK RIGHT-POINTING TRIANGLE + \definesymbol[WhiteRightPointingTriangle][\USymbChar{37}{183}] % WHITE RIGHT-POINTING TRIANGLE + \definesymbol[BlackRightPointingSmallTriangle][\USymbChar{37}{184}] % BLACK RIGHT-POINTING SMALL TRIANGLE + \definesymbol[WhiteRightPointingSmallTriangle][\USymbChar{37}{185}] % WHITE RIGHT-POINTING SMALL TRIANGLE + \definesymbol[BlackRightPointingPointer][\USymbChar{37}{186}] % BLACK RIGHT-POINTING POINTER + \definesymbol[WhiteRightPointingPointer][\USymbChar{37}{187}] % WHITE RIGHT-POINTING POINTER + \definesymbol[BlackDownPointingTriangle][\USymbChar{37}{188}] % BLACK DOWN-POINTING TRIANGLE + \definesymbol[WhiteDownPointingTriangle][\USymbChar{37}{189}] % WHITE DOWN-POINTING TRIANGLE + \definesymbol[BlackDownPointingSmallTriangle][\USymbChar{37}{190}] % BLACK DOWN-POINTING SMALL TRIANGLE + \definesymbol[WhiteDownPointingSmallTriangle][\USymbChar{37}{191}] % WHITE DOWN-POINTING SMALL TRIANGLE + \definesymbol[BlackLeftPointingTriangle][\USymbChar{37}{192}] % BLACK LEFT-POINTING TRIANGLE + \definesymbol[WhiteLeftPointingTriangle][\USymbChar{37}{193}] % WHITE LEFT-POINTING TRIANGLE + \definesymbol[BlackLeftPointingSmallTriangle][\USymbChar{37}{194}] % BLACK LEFT-POINTING SMALL TRIANGLE + \definesymbol[WhiteLeftPointingSmallTriangle][\USymbChar{37}{195}] % WHITE LEFT-POINTING SMALL TRIANGLE + \definesymbol[BlackLeftPointingPointer][\USymbChar{37}{196}] % BLACK LEFT-POINTING POINTER + \definesymbol[WhiteLeftPointingPointer][\USymbChar{37}{197}] % WHITE LEFT-POINTING POINTER + \definesymbol[BlackDiamond][\USymbChar{37}{198}] % BLACK DIAMOND + \definesymbol[WhiteDiamond][\USymbChar{37}{199}] % WHITE DIAMOND + \definesymbol[WhiteDiamondContainingBlackSmallDiamond][\USymbChar{37}{200}] % WHITE DIAMOND CONTAINING BLACK SMALL DIAMOND + \definesymbol[Fisheye][\USymbChar{37}{201}] % FISHEYE + \definesymbol[Lozenge][\USymbChar{37}{202}] % LOZENGE + \definesymbol[WhiteCircle][\USymbChar{37}{203}] % WHITE CIRCLE + \definesymbol[DottedCircle][\USymbChar{37}{204}] % DOTTED CIRCLE + \definesymbol[CircleWithVerticalFill][\USymbChar{37}{205}] % CIRCLE WITH VERTICAL FILL + \definesymbol[Bullseye][\USymbChar{37}{206}] % BULLSEYE + \definesymbol[BlackCircle][\USymbChar{37}{207}] % BLACK CIRCLE + \definesymbol[CircleWithLeftHalfBlack][\USymbChar{37}{208}] % CIRCLE WITH LEFT HALF BLACK + \definesymbol[CircleWithRightHalfBlack][\USymbChar{37}{209}] % CIRCLE WITH RIGHT HALF BLACK + \definesymbol[CircleWithLowerHalfBlack][\USymbChar{37}{210}] % CIRCLE WITH LOWER HALF BLACK + \definesymbol[CircleWithUpperHalfBlack][\USymbChar{37}{211}] % CIRCLE WITH UPPER HALF BLACK + \definesymbol[CircleWithUpperRightQuadrantBlack][\USymbChar{37}{212}] % CIRCLE WITH UPPER RIGHT QUADRANT BLACK + \definesymbol[CircleWithAllButUpperLeftQuadrantBlack][\USymbChar{37}{213}] % CIRCLE WITH ALL BUT UPPER LEFT QUADRANT BLACK + \definesymbol[LeftHalfBlackCircle][\USymbChar{37}{214}] % LEFT HALF BLACK CIRCLE + \definesymbol[RightHalfBlackCircle][\USymbChar{37}{215}] % RIGHT HALF BLACK CIRCLE + \definesymbol[InverseBullet][\USymbChar{37}{216}] % INVERSE BULLET + \definesymbol[InverseWhiteCircle][\USymbChar{37}{217}] % INVERSE WHITE CIRCLE + \definesymbol[UpperHalfInverseWhiteCircle][\USymbChar{37}{218}] % UPPER HALF INVERSE WHITE CIRCLE + \definesymbol[LowerHalfInverseWhiteCircle][\USymbChar{37}{219}] % LOWER HALF INVERSE WHITE CIRCLE + \definesymbol[UpperLeftQuadrantCircularArc][\USymbChar{37}{220}] % UPPER LEFT QUADRANT CIRCULAR ARC + \definesymbol[UpperRightQuadrantCircularArc][\USymbChar{37}{221}] % UPPER RIGHT QUADRANT CIRCULAR ARC + \definesymbol[LowerRightQuadrantCircularArc][\USymbChar{37}{222}] % LOWER RIGHT QUADRANT CIRCULAR ARC + \definesymbol[LowerLeftQuadrantCircularArc][\USymbChar{37}{223}] % LOWER LEFT QUADRANT CIRCULAR ARC + \definesymbol[LowerHalfCircle][\USymbChar{37}{225}] % LOWER HALF CIRCLE + \definesymbol[BlackLowerRightTriangle][\USymbChar{37}{226}] % BLACK LOWER RIGHT TRIANGLE + \definesymbol[BlackLowerLeftTriangle][\USymbChar{37}{227}] % BLACK LOWER LEFT TRIANGLE + \definesymbol[BlackUpperLeftTriangle][\USymbChar{37}{228}] % BLACK UPPER LEFT TRIANGLE + \definesymbol[BlackUpperRightTriangle][\USymbChar{37}{229}] % BLACK UPPER RIGHT TRIANGLE + \definesymbol[WhiteBullet][\USymbChar{37}{230}] % WHITE BULLET + \definesymbol[SquareWithLeftHalfBlack][\USymbChar{37}{231}] % SQUARE WITH LEFT HALF BLACK + \definesymbol[SquareWithRightHalfBlack][\USymbChar{37}{232}] % SQUARE WITH RIGHT HALF BLACK + \definesymbol[SquareWithUpperLeftDiagonalHalfBlack][\USymbChar{37}{233}] % SQUARE WITH UPPER LEFT DIAGONAL HALF BLACK + \definesymbol[SquareWithLowerRightDiagonalHalfBlack][\USymbChar{37}{234}] % SQUARE WITH LOWER RIGHT DIAGONAL HALF BLACK + \definesymbol[WhiteSquareWithVerticalBisectingLine][\USymbChar{37}{235}] % WHITE SQUARE WITH VERTICAL BISECTING LINE + \definesymbol[WhiteUpPointingTriangleWithDot][\USymbChar{37}{236}] % WHITE UP-POINTING TRIANGLE WITH DOT + \definesymbol[UpPointingTriangleWithLeftHalfBlack][\USymbChar{37}{237}] % UP-POINTING TRIANGLE WITH LEFT HALF BLACK + \definesymbol[UpPointingTriangleWithRightHalfBlack][\USymbChar{37}{238}] % UP-POINTING TRIANGLE WITH RIGHT HALF BLACK + \definesymbol[LargeCircle][\USymbChar{37}{239}] % LARGE CIRCLE + \definesymbol[UpperLeftTriangle][\USymbChar{37}{248}] % [Unassigned U+25F8] + \definesymbol[UpperRightTriangle][\USymbChar{37}{249}] % [Unassigned U+25F9] + \definesymbol[LowerLeftTriangle][\USymbChar{37}{250}] % [Unassigned U+25FA] + \definesymbol[WhiteMediumSquare][\USymbChar{37}{251}] % [Unassigned U+25FB] + \definesymbol[BlackMediumSquare][\USymbChar{37}{252}] % [Unassigned U+25FC] + \definesymbol[WhiteMediumSmallSquare][\USymbChar{37}{253}] % [Unassigned U+25FD] + \definesymbol[BlackMediumSmallSquare][\USymbChar{37}{254}] % [Unassigned U+25FE] + \definesymbol[LowerRightTriangle][\USymbChar{37}{255}] % [Unassigned U+25FF] + +\stopsymbolset + +\startsymbolset[Unicode Control Code Graphics] % 0x25A0: Requires UnicodeRegular25 + + \definesymbol[WhiteSquareWithUpperLeftQuadrant][\USymbChar{37}{240}] % WHITE SQUARE WITH UPPER LEFT QUADRANT + \definesymbol[WhiteSquareWithLowerLeftQuadrant][\USymbChar{37}{241}] % WHITE SQUARE WITH LOWER LEFT QUADRANT + \definesymbol[WhiteSquareWithLowerRightQuadrant][\USymbChar{37}{242}] % WHITE SQUARE WITH LOWER RIGHT QUADRANT + \definesymbol[WhiteSquareWithUpperRightQuadrant][\USymbChar{37}{243}] % WHITE SQUARE WITH UPPER RIGHT QUADRANT + \definesymbol[WhiteCircleWithUpperLeftQuadrant][\USymbChar{37}{244}] % WHITE CIRCLE WITH UPPER LEFT QUADRANT + \definesymbol[WhiteCircleWithLowerLeftQuadrant][\USymbChar{37}{245}] % WHITE CIRCLE WITH LOWER LEFT QUADRANT + \definesymbol[WhiteCircleWithLowerRightQuadrant][\USymbChar{37}{246}] % WHITE CIRCLE WITH LOWER RIGHT QUADRANT + \definesymbol[WhiteCircleWithUpperRightQuadrant][\USymbChar{37}{247}] % WHITE CIRCLE WITH UPPER RIGHT QUADRANT + +\stopsymbolset + +\startsymbolset[Unicode Weather and Astrological] % 0x2600: Requires UnicodeRegular26 + + \definesymbol[BlackSunWithRays][\USymbChar{38}{0}] % BLACK SUN WITH RAYS + \definesymbol[Cloud][\USymbChar{38}{1}] % CLOUD + \definesymbol[Umbrella][\USymbChar{38}{2}] % UMBRELLA + \definesymbol[Snowman][\USymbChar{38}{3}] % SNOWMAN + \definesymbol[Comet][\USymbChar{38}{4}] % COMET + \definesymbol[BlackStar][\USymbChar{38}{5}] % BLACK STAR + \definesymbol[WhiteStar][\USymbChar{38}{6}] % WHITE STAR + \definesymbol[Lightning][\USymbChar{38}{7}] % LIGHTNING + \definesymbol[Thunderstorm][\USymbChar{38}{8}] % THUNDERSTORM + \definesymbol[Sun][\USymbChar{38}{9}] % SUN + \definesymbol[AscendingNode][\USymbChar{38}{10}] % ASCENDING NODE + \definesymbol[DescendingNode][\USymbChar{38}{11}] % DESCENDING NODE + \definesymbol[Conjunction][\USymbChar{38}{12}] % CONJUNCTION + \definesymbol[Opposition][\USymbChar{38}{13}] % OPPOSITION + \definesymbol[FirstQuarterMoon][\USymbChar{38}{61}] % FIRST QUARTER MOON + \definesymbol[LastQuarterMoon][\USymbChar{38}{62}] % LAST QUARTER MOON + \definesymbol[Mercury][\USymbChar{38}{63}] % MERCURY + \definesymbol[FemaleSign][\USymbChar{38}{64}] % FEMALE SIGN + \definesymbol[Earth][\USymbChar{38}{65}] % EARTH + \definesymbol[MaleSign][\USymbChar{38}{66}] % MALE SIGN + \definesymbol[Jupiter][\USymbChar{38}{67}] % JUPITER + \definesymbol[Saturn][\USymbChar{38}{68}] % SATURN + \definesymbol[Uranus][\USymbChar{38}{69}] % URANUS + \definesymbol[Neptune][\USymbChar{38}{70}] % NEPTUNE + \definesymbol[Pluto][\USymbChar{38}{71}] % PLUTO + +\stopsymbolset + +\startsymbolset[Unicode Miscellaneous] % 0x2600: Requires UnicodeRegular26 + + \definesymbol[BlackTelephone][\USymbChar{38}{14}] % BLACK TELEPHONE + \definesymbol[WhiteTelephone][\USymbChar{38}{15}] % WHITE TELEPHONE + \definesymbol[BallotBox][\USymbChar{38}{16}] % BALLOT BOX + \definesymbol[BallotBoxWithCheck][\USymbChar{38}{17}] % BALLOT BOX WITH CHECK + \definesymbol[BallotBoxWithX][\USymbChar{38}{18}] % BALLOT BOX WITH X + \definesymbol[Saltire][\USymbChar{38}{19}] % SALTIRE + \definesymbol[ReversedRotatedFloralHeartBullet][\USymbChar{38}{25}] % REVERSED ROTATED FLORAL HEART BULLET + \definesymbol[WheelOfDharma][\USymbChar{38}{56}] % WHEEL OF DHARMA + \definesymbol[WhiteFrowningFace][\USymbChar{38}{57}] % WHITE FROWNING FACE + \definesymbol[WhiteSmilingFace][\USymbChar{38}{58}] % WHITE SMILING FACE + \definesymbol[BlackSmilingFace][\USymbChar{38}{59}] % BLACK SMILING FACE + \definesymbol[WhiteSunWithRays][\USymbChar{38}{60}] % WHITE SUN WITH RAYS + \definesymbol[HotSprings][\USymbChar{38}{104}] % HOT SPRINGS + +\stopsymbolset + +\startsymbolset[Unicode Japanese Chess] % 0x2600: Requires UnicodeRegular26 + + \definesymbol[WhiteShogiPiece][\USymbChar{38}{22}] % [Unassigned U+2616] + \definesymbol[BlackShogiPiece][\USymbChar{38}{23}] % [Unassigned U+2617] + +\stopsymbolset + +\startsymbolset[Unicode Pointing Hand] % 0x2600: Requires UnicodeRegular26 + + \definesymbol[BlackLeftPointingIndex][\USymbChar{38}{26}] % BLACK LEFT POINTING INDEX + \definesymbol[BlackRightPointingIndex][\USymbChar{38}{27}] % BLACK RIGHT POINTING INDEX + \definesymbol[WhiteLeftPointingIndex][\USymbChar{38}{28}] % WHITE LEFT POINTING INDEX + \definesymbol[WhiteUpPointingIndex][\USymbChar{38}{29}] % WHITE UP POINTING INDEX + \definesymbol[WhiteRightPointingIndex][\USymbChar{38}{30}] % WHITE RIGHT POINTING INDEX + \definesymbol[WhiteDownPointingIndex][\USymbChar{38}{31}] % WHITE DOWN POINTING INDEX + +\stopsymbolset + +\startsymbolset[Unicode Warning Signs] % 0x2600: Requires UnicodeRegular26 + + \definesymbol[SkullAndCrossbones][\USymbChar{38}{32}] % SKULL AND CROSSBONES + \definesymbol[CautionSign][\USymbChar{38}{33}] % CAUTION SIGN + \definesymbol[RadioactiveSign][\USymbChar{38}{34}] % RADIOACTIVE SIGN + \definesymbol[BiohazardSign][\USymbChar{38}{35}] % BIOHAZARD SIGN + +\stopsymbolset + +\startsymbolset[Unicode Healing Signs] % 0x2600: Requires UnicodeRegular26 + \definesymbol[Caduceus][\USymbChar{38}{36}] % CADUCEUS + \definesymbol[Ankh][\USymbChar{38}{37}] % ANKH +\stopsymbolset + +\startsymbolset[Unicode Religious and Political] % 0x2600: Requires UnicodeRegular26 and 27 + + \definesymbol[OrthodoxCross][\USymbChar{38}{38}] % ORTHODOX CROSS + \definesymbol[ChiRho][\USymbChar{38}{39}] % CHI RHO + \definesymbol[CrossOfLorraine][\USymbChar{38}{40}] % CROSS OF LORRAINE + \definesymbol[CrossOfJerusalem][\USymbChar{38}{41}] % CROSS OF JERUSALEM + \definesymbol[StarAndCrescent][\USymbChar{38}{42}] % STAR AND CRESCENT + \definesymbol[FarsiSymbol][\USymbChar{38}{43}] % FARSI SYMBOL + \definesymbol[AdiShakti][\USymbChar{38}{44}] % ADI SHAKTI + \definesymbol[HammerAndSickle][\USymbChar{38}{45}] % HAMMER AND SICKLE + \definesymbol[PeaceSymbol][\USymbChar{38}{46}] % PEACE SYMBOL + \definesymbol[YinYang][\USymbChar{38}{47}] % YIN YANG + \definesymbol[WestSyriacCross][\USymbChar{38}{112}] % WEST SYRIAC CROSS + \definesymbol[EastSyriacCross][\USymbChar{38}{113}] % EAST SYRIAC CROSS +% 27xx starts here + \definesymbol[OutlinedGreekCross][\USymbCharZapf{39}{25}] % OUTLINED GREEK CROSS + \definesymbol[HeavyGreekCross][\USymbCharZapf{39}{26}] % HEAVY GREEK CROSS + \definesymbol[OpenCentreCross][\USymbCharZapf{39}{27}] % OPEN CENTRE CROSS + \definesymbol[HeavyOpenCentreCross][\USymbCharZapf{39}{28}] % HEAVY OPEN CENTRE CROSS + \definesymbol[LatinCross][\USymbCharZapf{39}{29}] % LATIN CROSS + \definesymbol[ShadowedWhiteLatinCross][\USymbCharZapf{39}{30}] % SHADOWED WHITE LATIN CROSS + \definesymbol[OutlinedLatinCross][\USymbCharZapf{39}{31}] % OUTLINED LATIN CROSS + \definesymbol[MalteseCross][\USymbCharZapf{39}{32}] % MALTESE CROSS + \definesymbol[StarOfDavid][\USymbCharZapf{39}{33}] % STAR OF DAVID + + +\stopsymbolset + +\startsymbolset[Unicode Trigram] % 0x2600: Requires UnicodeRegular26 + + \definesymbol[TrigramForHeaven][\USymbChar{38}{48}] % TRIGRAM FOR HEAVEN + \definesymbol[TrigramForLake][\USymbChar{38}{49}] % TRIGRAM FOR LAKE + \definesymbol[TrigramForFire][\USymbChar{38}{50}] % TRIGRAM FOR FIRE + \definesymbol[TrigramForThunder][\USymbChar{38}{51}] % TRIGRAM FOR THUNDER + \definesymbol[TrigramForWind][\USymbChar{38}{52}] % TRIGRAM FOR WIND + \definesymbol[TrigramForWater][\USymbChar{38}{53}] % TRIGRAM FOR WATER + \definesymbol[TrigramForMountain][\USymbChar{38}{54}] % TRIGRAM FOR MOUNTAIN + \definesymbol[TrigramForEarth][\USymbChar{38}{55}] % TRIGRAM FOR EARTH + +\stopsymbolset + +\startsymbolset[Unicode Zodiac] % 0x2600: Requires UnicodeRegular26 + + \definesymbol[Aries][\USymbChar{38}{72}] % ARIES + \definesymbol[Taurus][\USymbChar{38}{73}] % TAURUS + \definesymbol[Gemini][\USymbChar{38}{74}] % GEMINI + \definesymbol[Cancer][\USymbChar{38}{75}] % CANCER + \definesymbol[Leo][\USymbChar{38}{76}] % LEO + \definesymbol[Virgo][\USymbChar{38}{77}] % VIRGO + \definesymbol[Libra][\USymbChar{38}{78}] % LIBRA + \definesymbol[Scorpius][\USymbChar{38}{79}] % SCORPIUS + \definesymbol[Sagittarius][\USymbChar{38}{80}] % SAGITTARIUS + \definesymbol[Capricorn][\USymbChar{38}{81}] % CAPRICORN + \definesymbol[Aquarius][\USymbChar{38}{82}] % AQUARIUS + \definesymbol[Pisces][\USymbChar{38}{83}] % PISCES + +\stopsymbolset + +\startsymbolset[Unicode Chess] % 0x2600: Requires UnicodeRegular26 + + \definesymbol[WhiteChessKing][\USymbChar{38}{84}] % WHITE CHESS KING + \definesymbol[WhiteChessQueen][\USymbChar{38}{85}] % WHITE CHESS QUEEN + \definesymbol[WhiteChessRook][\USymbChar{38}{86}] % WHITE CHESS ROOK + \definesymbol[WhiteChessBishop][\USymbChar{38}{87}] % WHITE CHESS BISHOP + \definesymbol[WhiteChessKnight][\USymbChar{38}{88}] % WHITE CHESS KNIGHT + \definesymbol[WhiteChessPawn][\USymbChar{38}{89}] % WHITE CHESS PAWN + \definesymbol[BlackChessKing][\USymbChar{38}{90}] % BLACK CHESS KING + \definesymbol[BlackChessQueen][\USymbChar{38}{91}] % BLACK CHESS QUEEN + \definesymbol[BlackChessRook][\USymbChar{38}{92}] % BLACK CHESS ROOK + \definesymbol[BlackChessBishop][\USymbChar{38}{93}] % BLACK CHESS BISHOP + \definesymbol[BlackChessKnight][\USymbChar{38}{94}] % BLACK CHESS KNIGHT + \definesymbol[BlackChessPawn][\USymbChar{38}{95}] % BLACK CHESS PAWN + +\stopsymbolset + +\startsymbolset[Unicode Playing Card] % 0x2600: Requires UnicodeRegular26 + + \definesymbol[BlackSpadeSuit][\USymbChar{38}{96}] % BLACK SPADE SUIT + \definesymbol[WhiteHeartSuit][\USymbChar{38}{97}] % WHITE HEART SUIT + \definesymbol[WhiteDiamondSuit][\USymbChar{38}{98}] % WHITE DIAMOND SUIT + \definesymbol[BlackClubSuit][\USymbChar{38}{99}] % BLACK CLUB SUIT + \definesymbol[WhiteSpadeSuit][\USymbChar{38}{100}] % WHITE SPADE SUIT + \definesymbol[BlackHeartSuit][\USymbChar{38}{101}] % BLACK HEART SUIT + \definesymbol[BlackDiamondSuit][\USymbChar{38}{102}] % BLACK DIAMOND SUIT + \definesymbol[WhiteClubSuit][\USymbChar{38}{103}] % WHITE CLUB SUIT + +\stopsymbolset + +\startsymbolset[Unicode Musical] % 0x2600: Requires UnicodeRegular26 + + \definesymbol[QuarterNote][\USymbChar{38}{105}] % QUARTER NOTE + \definesymbol[EighthNote][\USymbChar{38}{106}] % EIGHTH NOTE + \definesymbol[BeamedEighthNotes][\USymbChar{38}{107}] % BEAMED EIGHTH NOTES + \definesymbol[BeamedSixteenthNotes][\USymbChar{38}{108}] % BEAMED SIXTEENTH NOTES + \definesymbol[MusicFlatSign][\USymbChar{38}{109}] % MUSIC FLAT SIGN + \definesymbol[MusicNaturalSign][\USymbChar{38}{110}] % MUSIC NATURAL SIGN + \definesymbol[MusicSharpSign][\USymbChar{38}{111}] % MUSIC SHARP SIGN + +\stopsymbolset + +\startsymbolset[Unicode Recycling] % 0x2600: Requires UnicodeRegular26 + + \definesymbol[UniversalRecycling][\USymbChar{38}{114}] % [Unassigned U+2672] + \definesymbol[Type1Plastics][\USymbChar{38}{115}] % [Unassigned U+2673] + \definesymbol[Type2Plastics][\USymbChar{38}{116}] % [Unassigned U+2674] + \definesymbol[Type3Plastics][\USymbChar{38}{117}] % [Unassigned U+2675] + \definesymbol[Type4Plastics][\USymbChar{38}{118}] % [Unassigned U+2676] + \definesymbol[Type5Plastics][\USymbChar{38}{119}] % [Unassigned U+2677] + \definesymbol[Type6Plastics][\USymbChar{38}{120}] % [Unassigned U+2678] + \definesymbol[Type7Plastics][\USymbChar{38}{121}] % [Unassigned U+2679] + \definesymbol[GenericMaterials][\USymbChar{38}{122}] % [Unassigned U+267A] + \definesymbol[BlackUniversalRecycling][\USymbChar{38}{123}] % [Unassigned U+267B] + \definesymbol[RecycledPaper][\USymbChar{38}{124}] % [Unassigned U+267C] + \definesymbol[PartiallyRecycledPaper][\USymbChar{38}{125}] % [Unassigned U+267D] + +\stopsymbolset + +\startsymbolset[Unicode Dice] % 0x2600: Requires UnicodeRegular26 + + \definesymbol[DieFace1][\USymbChar{38}{128}] % [Unassigned U+2680] + \definesymbol[DieFace2][\USymbChar{38}{129}] % [Unassigned U+2681] + \definesymbol[DieFace3][\USymbChar{38}{130}] % [Unassigned U+2682] + \definesymbol[DieFace4][\USymbChar{38}{131}] % [Unassigned U+2683] + \definesymbol[DieFace5][\USymbChar{38}{132}] % [Unassigned U+2684] + \definesymbol[DieFace6][\USymbChar{38}{133}] % [Unassigned U+2685] + +\stopsymbolset + +\startsymbolset[Unicode Go Markers] % 0x2600: Requires UnicodeRegular26 + + \definesymbol[WhiteCircleWithDotRight][\USymbChar{38}{134}] % [Unassigned U+2686] + \definesymbol[WhiteCircleWithTwoDots][\USymbChar{38}{135}] % [Unassigned U+2687] + \definesymbol[BlackCircleWithWhiteDotRight][\USymbChar{38}{136}] % [Unassigned U+2688] + \definesymbol[BlackCircleWithTwoWhiteDots][\USymbChar{38}{137}] % [Unassigned U+2689] + +\stopsymbolset + +\startsymbolset[Unicode Scissors] % 0x2700: Requires UnicodeRegular27 + + \definesymbol[UpperBladeScissors][\USymbCharZapf{39}{1}] % UPPER BLADE SCISSORS + \definesymbol[BlackScissors][\USymbCharZapf{39}{2}] % BLACK SCISSORS + \definesymbol[LowerBladeScissors][\USymbCharZapf{39}{3}] % LOWER BLADE SCISSORS + \definesymbol[WhiteScissors][\USymbCharZapf{39}{4}] % WHITE SCISSORS + +\stopsymbolset + +\startsymbolset[Unicode Dingbats] % 0x2700: Requires UnicodeRegular27 + + \definesymbol[TelephoneLocationSign][\USymbCharZapf{39}{6}] % TELEPHONE LOCATION SIGN + \definesymbol[TapeDrive][\USymbCharZapf{39}{7}] % TAPE DRIVE + \definesymbol[Airplane][\USymbCharZapf{39}{8}] % AIRPLANE + \definesymbol[Envelope][\USymbCharZapf{39}{9}] % ENVELOPE + \definesymbol[VictoryHand][\USymbCharZapf{39}{12}] % VICTORY HAND + \definesymbol[WritingHand][\USymbCharZapf{39}{13}] % WRITING HAND + \definesymbol[LowerRightPencil][\USymbCharZapf{39}{14}] % LOWER RIGHT PENCIL + \definesymbol[Pencil][\USymbCharZapf{39}{15}] % PENCIL + \definesymbol[UpperRightPencil][\USymbCharZapf{39}{16}] % UPPER RIGHT PENCIL + \definesymbol[WhiteNib][\USymbCharZapf{39}{17}] % WHITE NIB + \definesymbol[BlackNib][\USymbCharZapf{39}{18}] % BLACK NIB + \definesymbol[BlackDiamondMinusWhiteX][\USymbCharZapf{39}{86}] % BLACK DIAMOND MINUS WHITE X + +\stopsymbolset + +\startsymbolset[Unicode Checks and Xs] % 0x2700: Requires UnicodeRegular27 + + \definesymbol[CheckMark][\USymbCharZapf{39}{19}] % CHECK MARK + \definesymbol[HeavyCheckMark][\USymbCharZapf{39}{20}] % HEAVY CHECK MARK + \definesymbol[MultiplicationX][\USymbCharZapf{39}{21}] % MULTIPLICATION X + \definesymbol[HeavyMultiplicationX][\USymbCharZapf{39}{22}] % HEAVY MULTIPLICATION X + \definesymbol[BallotX][\USymbCharZapf{39}{23}] % BALLOT X + \definesymbol[HeavyBallotX][\USymbCharZapf{39}{24}] % HEAVY BALLOT X + +\stopsymbolset + +\startsymbolset[Unicode Stars] % 0x2700: Requires UnicodeRegular27 + + \definesymbol[FourTeardropSpokedAsterisk][\USymbCharZapf{39}{34}] % FOUR TEARDROP-SPOKED ASTERISK + \definesymbol[FourBalloonSpokedAsterisk][\USymbCharZapf{39}{35}] % FOUR BALLOON-SPOKED ASTERISK + \definesymbol[HeavyFourBalloonSpokedAsterisk][\USymbCharZapf{39}{36}] % HEAVY FOUR BALLOON-SPOKED ASTERISK + \definesymbol[FourClubSpokedAsterisk][\USymbCharZapf{39}{37}] % FOUR CLUB-SPOKED ASTERISK + \definesymbol[BlackFourPointedStar][\USymbCharZapf{39}{38}] % BLACK FOUR POINTED STAR + \definesymbol[WhiteFourPointedStar][\USymbCharZapf{39}{39}] % WHITE FOUR POINTED STAR + \definesymbol[StressOutlinedWhiteStar][\USymbCharZapf{39}{41}] % STRESS OUTLINED WHITE STAR + \definesymbol[CircledWhiteStar][\USymbCharZapf{39}{42}] % CIRCLED WHITE STAR + \definesymbol[OpenCentreBlackStar][\USymbCharZapf{39}{43}] % OPEN CENTRE BLACK STAR + \definesymbol[BlackCentreWhiteStar][\USymbCharZapf{39}{44}] % BLACK CENTRE WHITE STAR + \definesymbol[OutlinedBlackStar][\USymbCharZapf{39}{45}] % OUTLINED BLACK STAR + \definesymbol[HeavyOutlinedBlackStar][\USymbCharZapf{39}{46}] % HEAVY OUTLINED BLACK STAR + \definesymbol[PinwheelStar][\USymbCharZapf{39}{47}] % PINWHEEL STAR + \definesymbol[ShadowedWhiteStar][\USymbCharZapf{39}{48}] % SHADOWED WHITE STAR + \definesymbol[HeavyAsterisk][\USymbCharZapf{39}{49}] % HEAVY ASTERISK + \definesymbol[OpenCentreAsterisk][\USymbCharZapf{39}{50}] % OPEN CENTRE ASTERISK + \definesymbol[EightSpokedAsterisk][\USymbCharZapf{39}{51}] % EIGHT SPOKED ASTERISK + \definesymbol[EightPointedBlackStar][\USymbCharZapf{39}{52}] % EIGHT POINTED BLACK STAR + \definesymbol[EightPointedPinwheelStar][\USymbCharZapf{39}{53}] % EIGHT POINTED PINWHEEL STAR + \definesymbol[SixPointedBlackStar][\USymbCharZapf{39}{54}] % SIX POINTED BLACK STAR + \definesymbol[EightPointedRectilinearBlackStar][\USymbCharZapf{39}{55}] % EIGHT POINTED RECTILINEAR BLACK STAR + \definesymbol[HeavyEightPointedRectilinearBlackStar][\USymbCharZapf{39}{56}] % HEAVY EIGHT POINTED RECTILINEAR BLACK STAR + \definesymbol[TwelvePointedBlackStar][\USymbCharZapf{39}{57}] % TWELVE POINTED BLACK STAR + \definesymbol[SixteenPointedAsterisk][\USymbCharZapf{39}{58}] % SIXTEEN POINTED ASTERISK + \definesymbol[TeardropSpokedAsterisk][\USymbCharZapf{39}{59}] % TEARDROP-SPOKED ASTERISK + \definesymbol[OpenCentreTeardropSpokedAsterisk][\USymbCharZapf{39}{60}] % OPEN CENTRE TEARDROP-SPOKED ASTERISK + \definesymbol[HeavyTeardropSpokedAsterisk][\USymbCharZapf{39}{61}] % HEAVY TEARDROP-SPOKED ASTERISK + \definesymbol[SixPetalledBlackAndWhiteFlorette][\USymbCharZapf{39}{62}] % SIX PETALLED BLACK AND WHITE FLORETTE + \definesymbol[BlackFlorette][\USymbCharZapf{39}{63}] % BLACK FLORETTE + \definesymbol[WhiteFlorette][\USymbCharZapf{39}{64}] % WHITE FLORETTE + \definesymbol[EightPetalledOutlinedBlackFlorette][\USymbCharZapf{39}{65}] % EIGHT PETALLED OUTLINED BLACK FLORETTE + \definesymbol[CircledOpenCentreEightPointedStar][\USymbCharZapf{39}{66}] % CIRCLED OPEN CENTRE EIGHT POINTED STAR + \definesymbol[HeavyTeardropSpokedPinwheelAsterisk][\USymbCharZapf{39}{67}] % HEAVY TEARDROP-SPOKED PINWHEEL ASTERISK + \definesymbol[Sparkle][\USymbCharZapf{39}{71}] % SPARKLE + \definesymbol[HeavySparkle][\USymbCharZapf{39}{72}] % HEAVY SPARKLE + \definesymbol[Balloon-spokedAsterisk][\USymbCharZapf{39}{73}] % BALLOON-SPOKED ASTERISK + \definesymbol[EightTeardrop-spokedPropellerAsterisk][\USymbCharZapf{39}{74}] % EIGHT TEARDROP-SPOKED PROPELLER ASTERISK + \definesymbol[HeavyEightTeardrop-spokedPropellerAsterisk][\USymbCharZapf{39}{75}] % HEAVY EIGHT TEARDROP-SPOKED PROPELLER ASTERISK + +\stopsymbolset + +\startsymbolset[Unicode Snowflakes] % 0x2700: Requires UnicodeRegular27 + + \definesymbol[Snowflake][\USymbCharZapf{39}{68}] % SNOWFLAKE + \definesymbol[TightTrifoliateSnowflake][\USymbCharZapf{39}{69}] % TIGHT TRIFOLIATE SNOWFLAKE + \definesymbol[HeavyChevronSnowflake][\USymbCharZapf{39}{70}] % HEAVY CHEVRON SNOWFLAKE + +\stopsymbolset + +\startsymbolset[Unicode Shadowed Shapes] % 0x2700: Requires UnicodeRegular27 + + \definesymbol[ShadowedWhiteCircle][\USymbCharZapf{39}{77}] % SHADOWED WHITE CIRCLE + \definesymbol[LowerRightDrop-shadowedWhiteSquare][\USymbCharZapf{39}{79}] % LOWER RIGHT DROP-SHADOWED WHITE SQUARE + \definesymbol[UpperRightDrop-shadowedWhiteSquare][\USymbCharZapf{39}{80}] % UPPER RIGHT DROP-SHADOWED WHITE SQUARE + \definesymbol[LowerRightShadowedWhiteSquare][\USymbCharZapf{39}{81}] % LOWER RIGHT SHADOWED WHITE SQUARE + \definesymbol[UpperRightShadowedWhiteSquare][\USymbCharZapf{39}{82}] % UPPER RIGHT SHADOWED WHITE SQUARE + +\stopsymbolset + +\startsymbolset[Unicode Bars] % 0x2700: Requires UnicodeRegular27 + + \definesymbol[LightVerticalBar][\USymbCharZapf{39}{88}] % LIGHT VERTICAL BAR + \definesymbol[MediumVerticalBar][\USymbCharZapf{39}{89}] % MEDIUM VERTICAL BAR + \definesymbol[HeavyVerticalBar][\USymbCharZapf{39}{90}] % HEAVY VERTICAL BAR + +\stopsymbolset + +\startsymbolset[Unicode Dingbat Punctuation] % 0x2700: Requires UnicodeRegular27 + + \definesymbol[HeavySingleTurnedCommaQuotationMark][\USymbCharZapf{39}{91}] % HEAVY SINGLE TURNED COMMA QUOTATION MARK ORNAMENT + \definesymbol[HeavySingleCommaQuotationMark][\USymbCharZapf{39}{92}] % HEAVY SINGLE COMMA QUOTATION MARK ORNAMENT + \definesymbol[HeavyDoubleTurnedCommaQuotationMark][\USymbCharZapf{39}{93}] % HEAVY DOUBLE TURNED COMMA QUOTATION MARK ORNAMENT + \definesymbol[HeavyDoubleCommaQuotationMark][\USymbCharZapf{39}{94}] % HEAVY DOUBLE COMMA QUOTATION MARK ORNAMENT + \definesymbol[CurvedStemParagraphSign][\USymbCharZapf{39}{97}] % CURVED STEM PARAGRAPH SIGN ORNAMENT + \definesymbol[HeavyExclamationMark][\USymbCharZapf{39}{98}] % HEAVY EXCLAMATION MARK ORNAMENT + \definesymbol[HeavyHeartExclamationMark][\USymbCharZapf{39}{99}] % HEAVY HEART EXCLAMATION MARK ORNAMENT + +\stopsymbolset + +\startsymbolset[Unicode Hearts] % 0x2700: Requires UnicodeRegular27 + + \definesymbol[HeavyBlackHeart][\USymbCharZapf{39}{100}] % HEAVY BLACK HEART + \definesymbol[RotatedHeavyBlackHeartBullet][\USymbCharZapf{39}{101}] % ROTATED HEAVY BLACK HEART BULLET + \definesymbol[FloralHeart][\USymbCharZapf{39}{102}] % FLORAL HEART + \definesymbol[RotatedFloralHeartBullet][\USymbCharZapf{39}{103}] % ROTATED FLORAL HEART BULLET + +\stopsymbolset + +\startsymbolset[Unicode Negative Circled Digits] % 0x2700: Requires UnicodeRegular27 + + \definesymbol[CircledOne][\USymbCharZapf{39}{118}] % DINGBAT NEGATIVE CIRCLED DIGIT ONE + \definesymbol[CircledTwo][\USymbCharZapf{39}{119}] % DINGBAT NEGATIVE CIRCLED DIGIT TWO + \definesymbol[CircledThree][\USymbCharZapf{39}{120}] % DINGBAT NEGATIVE CIRCLED DIGIT THREE + \definesymbol[CircledFour][\USymbCharZapf{39}{121}] % DINGBAT NEGATIVE CIRCLED DIGIT FOUR + \definesymbol[CircledFive][\USymbCharZapf{39}{122}] % DINGBAT NEGATIVE CIRCLED DIGIT FIVE + \definesymbol[CircledSix][\USymbCharZapf{39}{123}] % DINGBAT NEGATIVE CIRCLED DIGIT SIX + \definesymbol[CircledSeven][\USymbCharZapf{39}{124}] % DINGBAT NEGATIVE CIRCLED DIGIT SEVEN + \definesymbol[CircledEight][\USymbCharZapf{39}{125}] % DINGBAT NEGATIVE CIRCLED DIGIT EIGHT + \definesymbol[CircledNine][\USymbCharZapf{39}{126}] % DINGBAT NEGATIVE CIRCLED DIGIT NINE + \definesymbol[CircledTen][\USymbCharZapf{39}{127}] % DINGBAT NEGATIVE CIRCLED NUMBER TEN + +\stopsymbolset + +\startsymbolset[Unicode Circled Sans-serif Digits] % 0x2700: Requires UnicodeRegular27 + + \definesymbol[CircledOne][\USymbCharZapf{39}{128}] % DINGBAT CIRCLED SANS-SERIF DIGIT ONE + \definesymbol[CircledTwo][\USymbCharZapf{39}{129}] % DINGBAT CIRCLED SANS-SERIF DIGIT TWO + \definesymbol[CircledThree][\USymbCharZapf{39}{130}] % DINGBAT CIRCLED SANS-SERIF DIGIT THREE + \definesymbol[CircledFour][\USymbCharZapf{39}{131}] % DINGBAT CIRCLED SANS-SERIF DIGIT FOUR + \definesymbol[CircledFive][\USymbCharZapf{39}{132}] % DINGBAT CIRCLED SANS-SERIF DIGIT FIVE + \definesymbol[CircledSix][\USymbCharZapf{39}{133}] % DINGBAT CIRCLED SANS-SERIF DIGIT SIX + \definesymbol[CircledSeven][\USymbCharZapf{39}{134}] % DINGBAT CIRCLED SANS-SERIF DIGIT SEVEN + \definesymbol[CircledEight][\USymbCharZapf{39}{135}] % DINGBAT CIRCLED SANS-SERIF DIGIT EIGHT + \definesymbol[CircledNine][\USymbCharZapf{39}{136}] % DINGBAT CIRCLED SANS-SERIF DIGIT NINE + \definesymbol[CircledTen][\USymbCharZapf{39}{137}] % DINGBAT CIRCLED SANS-SERIF NUMBER TEN + +\stopsymbolset + +\startsymbolset[Unicode Negative Circled Sans-serif Digits] % 0x2700: Requires UnicodeRegular27 + + \definesymbol[CircledOne][\USymbCharZapf{39}{138}] % DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE + \definesymbol[CircledTwo][\USymbCharZapf{39}{139}] % DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT TWO + \definesymbol[CircledThree][\USymbCharZapf{39}{140}] % DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT THREE + \definesymbol[CircledFour][\USymbCharZapf{39}{141}] % DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT FOUR + \definesymbol[CircledFive][\USymbCharZapf{39}{142}] % DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT FIVE + \definesymbol[CircledSix][\USymbCharZapf{39}{143}] % DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT SIX + \definesymbol[CircledSeven][\USymbCharZapf{39}{144}] % DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT SEVEN + \definesymbol[CircledEight][\USymbCharZapf{39}{145}] % DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT EIGHT + \definesymbol[CircledNine][\USymbCharZapf{39}{146}] % DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT NINE + \definesymbol[CircledTen][\USymbCharZapf{39}{147}] % DINGBAT NEGATIVE CIRCLED SANS-SERIF NUMBER TEN + +\stopsymbolset + +\startsymbolset[Unicode Dingbat Arrows] % 0x2700: Requires UnicodeRegular27 + + \definesymbol[HeavyWideHeadedRightwardsArrow][\USymbCharZapf{39}{148}] % HEAVY WIDE-HEADED RIGHTWARDS ARROW + \definesymbol[HeavySouthEastArrow][\USymbCharZapf{39}{152}] % HEAVY SOUTH EAST ARROW + \definesymbol[HeavyRightwardsArrow][\USymbCharZapf{39}{153}] % HEAVY RIGHTWARDS ARROW + \definesymbol[HeavyNorthEastArrow][\USymbCharZapf{39}{154}] % HEAVY NORTH EAST ARROW + \definesymbol[DraftingPointRightwardsArrow][\USymbCharZapf{39}{155}] % DRAFTING POINT RIGHTWARDS ARROW + \definesymbol[HeavyRoundTippedRightwardsArrow][\USymbCharZapf{39}{156}] % HEAVY ROUND-TIPPED RIGHTWARDS ARROW + \definesymbol[TriangleHeadedRightwardsArrow][\USymbCharZapf{39}{157}] % TRIANGLE-HEADED RIGHTWARDS ARROW + \definesymbol[HeavyTriangleHeadedRightwardsArrow][\USymbCharZapf{39}{158}] % HEAVY TRIANGLE-HEADED RIGHTWARDS ARROW + \definesymbol[DashedTriangleHeadedRightwardsArrow][\USymbCharZapf{39}{159}] % DASHED TRIANGLE-HEADED RIGHTWARDS ARROW + \definesymbol[HeavyDashedTriangleHeadedRightwardsArrow][\USymbCharZapf{39}{160}] % HEAVY DASHED TRIANGLE-HEADED RIGHTWARDS ARROW + \definesymbol[BlackRightwardsArrow][\USymbCharZapf{39}{161}] % BLACK RIGHTWARDS ARROW + \definesymbol[3DTopLightedRightwardsArrowhead][\USymbCharZapf{39}{162}] % THREE-D TOP-LIGHTED RIGHTWARDS ARROWHEAD + \definesymbol[3DBottomLightedRightwardsArrowhead][\USymbCharZapf{39}{163}] % THREE-D BOTTOM-LIGHTED RIGHTWARDS ARROWHEAD + \definesymbol[BlackRightwardsArrowhead][\USymbCharZapf{39}{164}] % BLACK RIGHTWARDS ARROWHEAD + \definesymbol[HeavyBlackCurvedDownwardsAndRightwardsArrow][\USymbCharZapf{39}{165}] % HEAVY BLACK CURVED DOWNWARDS AND RIGHTWARDS ARROW + \definesymbol[HeavyBlackCurvedUpwardsAndRightwardsArrow][\USymbCharZapf{39}{166}] % HEAVY BLACK CURVED UPWARDS AND RIGHTWARDS ARROW + \definesymbol[SquatBlackRightwardsArrow][\USymbCharZapf{39}{167}] % SQUAT BLACK RIGHTWARDS ARROW + \definesymbol[HeavyConcavePointedBlackRightwardsArrow][\USymbCharZapf{39}{168}] % HEAVY CONCAVE-POINTED BLACK RIGHTWARDS ARROW + \definesymbol[CircledHeavyWhiteRightwardsArrow][\USymbCharZapf{39}{178}] % CIRCLED HEAVY WHITE RIGHTWARDS ARROW + \definesymbol[OpenOutlinedRightwardsArrow][\USymbCharZapf{39}{190}] % OPEN-OUTLINED RIGHTWARDS ARROW + +\stopsymbolset + +\startsymbolset[Unicode Shadowed Arrows] % 0x2700: Requires UnicodeRegular27 + + \definesymbol[RightShadedWhiteRightwardsArrow][\USymbCharZapf{39}{169}] % RIGHT-SHADED WHITE RIGHTWARDS ARROW + \definesymbol[LeftShadedWhiteRightwardsArrow][\USymbCharZapf{39}{170}] % LEFT-SHADED WHITE RIGHTWARDS ARROW + \definesymbol[BackTiltedShadowedWhiteRightwardsArrow][\USymbCharZapf{39}{171}] % BACK-TILTED SHADOWED WHITE RIGHTWARDS ARROW + \definesymbol[FrontTiltedShadowedWhiteRightwardsArrow][\USymbCharZapf{39}{172}] % FRONT-TILTED SHADOWED WHITE RIGHTWARDS ARROW + \definesymbol[HeavyLowerRightShadowedWhiteRightwardsArrow][\USymbCharZapf{39}{173}] % HEAVY LOWER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW + \definesymbol[HeavyUpperRightShadowedWhiteRightwardsArrow][\USymbCharZapf{39}{174}] % HEAVY UPPER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW + \definesymbol[NotchedLowerRightShadowedWhiteRightwardsArrow][\USymbCharZapf{39}{175}] % NOTCHED LOWER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW + \definesymbol[NotchedUpperRightShadowedWhiteRightwardsArrow][\USymbCharZapf{39}{177}] % NOTCHED UPPER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW + +\stopsymbolset + +\startsymbolset[Unicode Tailed Arrows] % 0x2700: Requires UnicodeRegular27 + + \definesymbol[WhiteFeatheredRightwardsArrow][\USymbCharZapf{39}{179}] % WHITE-FEATHERED RIGHTWARDS ARROW + \definesymbol[BlackFeatheredSouthEastArrow][\USymbCharZapf{39}{180}] % BLACK-FEATHERED SOUTH EAST ARROW + \definesymbol[BlackFeatheredRightwardsArrow][\USymbCharZapf{39}{181}] % BLACK-FEATHERED RIGHTWARDS ARROW + \definesymbol[BlackFeatheredNorthEastArrow][\USymbCharZapf{39}{182}] % BLACK-FEATHERED NORTH EAST ARROW + \definesymbol[HeavyBlack-featheredSouthEastArrow][\USymbCharZapf{39}{183}] % HEAVY BLACK-FEATHERED SOUTH EAST ARROW + \definesymbol[HeavyBlackFeatheredRightwardsArrow][\USymbCharZapf{39}{184}] % HEAVY BLACK-FEATHERED RIGHTWARDS ARROW + \definesymbol[HeavyBlackFeatheredNorthEastArrow][\USymbCharZapf{39}{185}] % HEAVY BLACK-FEATHERED NORTH EAST ARROW + \definesymbol[TeardropBarbedRightwardsArrow][\USymbCharZapf{39}{186}] % TEARDROP-BARBED RIGHTWARDS ARROW + \definesymbol[HeavyTeardropShankedRightwardsArrow][\USymbCharZapf{39}{187}] % HEAVY TEARDROP-SHANKED RIGHTWARDS ARROW + \definesymbol[WedgeTailedRightwardsArrow][\USymbCharZapf{39}{188}] % WEDGE-TAILED RIGHTWARDS ARROW + \definesymbol[HeavyWedgeTailedRightwardsArrow][\USymbCharZapf{39}{189}] % HEAVY WEDGE-TAILED RIGHTWARDS ARROW + +\stopsymbolset + +\endinput diff --git a/Master/texmf-dist/tex/context/base/symb-uni.tex b/Master/texmf-dist/tex/context/base/symb-uni.tex deleted file mode 100644 index fcd613e7f0a..00000000000 --- a/Master/texmf-dist/tex/context/base/symb-uni.tex +++ /dev/null @@ -1,1123 +0,0 @@ -%D \module -%D [ file=symb-uni, -%D version=2004.11.15, -%D title=\CONTEXT\ Symbol Libraries, -%D subtitle=Unicode Symbols, -%D author=Adam T. Lindsay, -%D date=\currentdate, -%D copyright={Adam T. Lindsay / PRAGMA}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C prepared by Adam T. Lindsay. - -%D The content of this file originates from the Unicode standard, via some -%D original XSLT scripts and some hand-editing. This file is open for use -%D with the ConTeXt typesetting system. -%D -%D Adam considers the symbol names and categories to be stable, as they're -%D directly derived from the Unicode standard. -%D -%D \startitemize[packed] -%D \item Originated 2004-01-05 by Adam T. Lindsay -%D \item Updated 2004-01-16 with Unicode vector 0x27xx and some in -%D 215x and 246x -%D \item Updated 2004-11-15 to include default fonts for MacOSX and -%D \XETEX. -%D \stopitemize -%D -%D The following macros adapt to default fonts (that contain the characters) -%D in MacOSX. The font selection mechanism is likely to change once \XETEX\ -%D correctly supports \type{\doiffontcharelse}. - -\doifundefinedelse{XeTeXversion} - {\let\USymbChar \uchar - \let\USymbCharTwo \uchar - \let\USymbCharZapf\uchar} - {\def\USymbChar #1#2{\bgroup\UnicodeSymbolFont \uchar{#1}{#2}\relax\egroup} - \def\USymbCharTwo #1#2{\bgroup\UnicodeSymbolFontTwo \uchar{#1}{#2}\relax\egroup} - \def\USymbCharZapf#1#2{\bgroup\UnicodeSymbolFontZapf\uchar{#1}{#2}\relax\egroup} - \doifundefined{UnicodeSymbolFont} {\definefont[UnicodeSymbolFont] ["Apple Symbols" sa *]} - \doifundefined{UnicodeSymbolFontTwo} {\definefont[UnicodeSymbolFontTwo] ["Lucida Grande" sa *]} - \doifundefined{UnicodeSymbolFontZapf}{\definefont[UnicodeSymbolFontZapf]["Zapf Dingbats" sa *]}} - -\startsymbolset[Unicode Additional Punctuation] % 0x2000: Requires UnicodeRegular20 - - \definesymbol[Caret][\USymbChar{32}{56}] % CARET - \definesymbol[ReferenceMark][\USymbChar{32}{59}] % REFERENCE MARK - \definesymbol[DoubleExclamationMark][\USymbChar{32}{60}] % DOUBLE EXCLAMATION MARK - \definesymbol[Interrobang][\USymbChar{32}{61}] % INTERROBANG - \definesymbol[Overline][\USymbChar{32}{62}] % OVERLINE - \definesymbol[Undertie][\USymbChar{32}{63}] % UNDERTIE - \definesymbol[CharacterTie][\USymbChar{32}{64}] % CHARACTER TIE - \definesymbol[CaretInsertionPoint][\USymbChar{32}{65}] % CARET INSERTION POINT - \definesymbol[Asterism][\USymbChar{32}{66}] % ASTERISM - \definesymbol[HyphenBullet][\USymbChar{32}{67}] % HYPHEN BULLET - \definesymbol[FractionSlash][\USymbChar{32}{68}] % FRACTION SLASH - \definesymbol[LeftSquareBracketWithQuill][\USymbChar{32}{69}] % LEFT SQUARE BRACKET WITH QUILL - \definesymbol[RightSquareBracketWithQuill][\USymbChar{32}{70}] % RIGHT SQUARE BRACKET WITH QUILL - \definesymbol[QuestionExclamationMark][\USymbChar{32}{72}] % QUESTION EXCLAMATION MARK - \definesymbol[ExclamationQuestionMark][\USymbChar{32}{73}] % EXCLAMATION QUESTION MARK - \definesymbol[TironianSignEt][\USymbChar{32}{74}] % TIRONIAN SIGN ET - \definesymbol[ReversedPilcrowSign][\USymbChar{32}{75}] % REVERSED PILCROW SIGN - \definesymbol[BlackLeftwardsBullet][\USymbChar{32}{76}] % BLACK LEFTWARDS BULLET - \definesymbol[BlackRightwardsBullet][\USymbChar{32}{77}] % BLACK RIGHTWARDS BULLET - -\stopsymbolset - -\startsymbolset[Unicode Currency] % 0x20A0: Requires UnicodeRegular20 - - \definesymbol[Euro-currencySign][\USymbChar{32}{160}] % EURO-CURRENCY SIGN - \definesymbol[ColonSign][\USymbChar{32}{161}] % COLON SIGN - \definesymbol[CruzeiroSign][\USymbChar{32}{162}] % CRUZEIRO SIGN - \definesymbol[FrenchFrancSign][\USymbChar{32}{163}] % FRENCH FRANC SIGN - \definesymbol[LiraSign][\USymbChar{32}{164}] % LIRA SIGN - \definesymbol[MillSign][\USymbChar{32}{165}] % MILL SIGN - \definesymbol[NairaSign][\USymbChar{32}{166}] % NAIRA SIGN - \definesymbol[PesetaSign][\USymbChar{32}{167}] % PESETA SIGN - \definesymbol[RupeeSign][\USymbChar{32}{168}] % RUPEE SIGN - \definesymbol[WonSign][\USymbChar{32}{169}] % WON SIGN - \definesymbol[NewSheqelSign][\USymbChar{32}{170}] % NEW SHEQEL SIGN - \definesymbol[DongSign][\USymbChar{32}{171}] % DONG SIGN - \definesymbol[EuroSign][\USymbChar{32}{172}] % EURO SIGN - \definesymbol[KipSign][\USymbChar{32}{173}] % KIP SIGN - \definesymbol[TugrikSign][\USymbChar{32}{174}] % TUGRIK SIGN - \definesymbol[DrachmaSign][\USymbChar{32}{175}] % DRACHMA SIGN - \definesymbol[GermanPennySign][\USymbChar{32}{176}] % [Unassigned U+20B0] - \definesymbol[PfennigSign][\USymbChar{32}{176}] % Unofficial duplicate - \definesymbol[PesoSign][\USymbChar{32}{177}] % [Unassigned U+20B1] - -\stopsymbolset - - -\startsymbolset[Unicode Letterlike] % 0x2100: Requires UnicodeRegular21 - - \definesymbol[DegreeCelsius][\USymbChar{33}{3}] % DEGREE CELSIUS - \definesymbol[EulerConstant][\USymbChar{33}{7}] % EULER CONSTANT - \definesymbol[Scruple][\USymbChar{33}{8}] % SCRUPLE - \definesymbol[DegreeFahrenheit][\USymbChar{33}{9}] % DEGREE FAHRENHEIT - \definesymbol[PlanckConstant][\USymbChar{33}{14}] % PLANCK CONSTANT - \definesymbol[PlanckConstantOverTwoPi][\USymbChar{33}{15}] % PLANCK CONSTANT OVER TWO PI - \definesymbol[LBBarSymbol][\USymbChar{33}{20}] % L B BAR SYMBOL - \definesymbol[Versicle][\USymbChar{33}{35}] % VERSICLE - \definesymbol[OunceSign][\USymbChar{33}{37}] % OUNCE SIGN - \definesymbol[OhmSign][\USymbChar{33}{38}] % OHM SIGN - \definesymbol[InvertedOhmSign][\USymbChar{33}{39}] % INVERTED OHM SIGN - \definesymbol[KelvinSign][\USymbChar{33}{42}] % KELVIN SIGN - \definesymbol[AngstromSign][\USymbChar{33}{43}] % ANGSTROM SIGN - \definesymbol[EstimatedSymbol][\USymbChar{33}{46}] % ESTIMATED SYMBOL - -\stopsymbolset - -\startsymbolset[Unicode Letterlike Additional] % 0x2100: Requires UnicodeRegular21 - - \definesymbol[AccountOf][\USymbChar{33}{0}] % ACCOUNT OF - \definesymbol[AddressedToTheSubject][\USymbChar{33}{1}] % ADDRESSED TO THE SUBJECT - \definesymbol[CareOf][\USymbChar{33}{5}] % CARE OF - \definesymbol[CadaUna][\USymbChar{33}{6}] % CADA UNA - \definesymbol[CentreLineSymbol][\USymbChar{33}{4}] % CENTRE LINE SYMBOL - \definesymbol[NumeroSign][\USymbChar{33}{22}] % NUMERO SIGN - \definesymbol[SoundRecordingCopyright][\USymbChar{33}{23}] % SOUND RECORDING COPYRIGHT - \definesymbol[PrescriptionTake][\USymbChar{33}{30}] % PRESCRIPTION TAKE - \definesymbol[Response][\USymbChar{33}{31}] % RESPONSE - \definesymbol[ServiceMark][\USymbChar{33}{32}] % SERVICE MARK - \definesymbol[TelephoneSign][\USymbChar{33}{33}] % TELEPHONE SIGN - \definesymbol[TradeMarkSign][\USymbChar{33}{34}] % TRADE MARK SIGN - \definesymbol[InformationSource][\USymbChar{33}{57}] % INFORMATION SOURCE - \definesymbol[PropertyLine][\USymbChar{33}{74}] % [Unassigned U+214A] - -\stopsymbolset - -\startsymbolset[Unicode Script Letterlike] % 0x2100: Requires UnicodeRegular21 - - \definesymbol[ScriptSmallG][\USymbChar{33}{10}] % SCRIPT SMALL G - \definesymbol[ScriptCapitalH][\USymbChar{33}{11}] % SCRIPT CAPITAL H - \definesymbol[ScriptCapitalI][\USymbChar{33}{16}] % SCRIPT CAPITAL I - \definesymbol[ScriptCapitalL][\USymbChar{33}{18}] % SCRIPT CAPITAL L - \definesymbol[ScriptSmallL][\USymbChar{33}{19}] % SCRIPT SMALL L - \definesymbol[ScriptCapitalP][\USymbChar{33}{24}] % SCRIPT CAPITAL P - \definesymbol[ScriptCapitalR][\USymbChar{33}{27}] % SCRIPT CAPITAL R - \definesymbol[ScriptSmallE][\USymbChar{33}{47}] % SCRIPT SMALL E - \definesymbol[ScriptCapitalE][\USymbChar{33}{48}] % SCRIPT CAPITAL E - \definesymbol[ScriptCapitalF][\USymbChar{33}{49}] % SCRIPT CAPITAL F - \definesymbol[ScriptCapitalB][\USymbChar{33}{44}] % SCRIPT CAPITAL B - \definesymbol[ScriptCapitalM][\USymbChar{33}{51}] % SCRIPT CAPITAL M - \definesymbol[ScriptSmallO][\USymbChar{33}{52}] % SCRIPT SMALL O - -\stopsymbolset - -\startsymbolset[Unicode Hebrew Letterlike] % 0x2100: Requires UnicodeRegular21 - - \definesymbol[AlefSymbol][\USymbChar{33}{53}] % ALEF SYMBOL - \definesymbol[BetSymbol][\USymbChar{33}{54}] % BET SYMBOL - \definesymbol[GimelSymbol][\USymbChar{33}{55}] % GIMEL SYMBOL - \definesymbol[DaletSymbol][\USymbChar{33}{56}] % DALET SYMBOL - -\stopsymbolset - -\startsymbolset[Unicode Turned Letterlike] % 0x2100: Requires UnicodeRegular21 - - \definesymbol[RotatedCapitalQ][\USymbChar{33}{58}] % ROTATED CAPITAL Q - \definesymbol[TurnedSansSerifCapitalG][\USymbChar{33}{65}] % [Unassigned U+2141] - \definesymbol[TurnedSansSerifCapitalL][\USymbChar{33}{66}] % [Unassigned U+2142] - \definesymbol[ReversedSansSerifCapitalL][\USymbChar{33}{67}] % [Unassigned U+2143] - \definesymbol[TurnedSansSerifCapitalY][\USymbChar{33}{68}] % [Unassigned U+2144] - \definesymbol[TurnedAmpersand][\USymbChar{33}{75}] % [Unassigned U+214B] - \definesymbol[TurnedGreekSmallLetterIota][\USymbChar{33}{41}] % TURNED GREEK SMALL LETTER IOTA - \definesymbol[TurnedCapitalF][\USymbChar{33}{50}] % TURNED CAPITAL F - -\stopsymbolset - -\startsymbolset[Unicode Black-letter Letterlike] % 0x2100: Requires UnicodeRegular21 - - \definesymbol[BlackLetterCapitalH][\USymbChar{33}{12}] % BLACK-LETTER CAPITAL H - \definesymbol[BlackLetterCapitalI][\USymbChar{33}{17}] % BLACK-LETTER CAPITAL I - \definesymbol[BlackLetterCapitalR][\USymbChar{33}{28}] % BLACK-LETTER CAPITAL R - \definesymbol[BlackLetterCapitalZ][\USymbChar{33}{40}] % BLACK-LETTER CAPITAL Z - \definesymbol[BlackLetterCapitalC][\USymbChar{33}{45}] % BLACK-LETTER CAPITAL C - -\stopsymbolset - -\startsymbolset[Unicode Double-struck Letterlike Math] % 0x2100: Requires UnicodeRegular21 - - \definesymbol[DoubleStruckCapitalC][\USymbChar{33}{2}] % DOUBLE-STRUCK CAPITAL C - \definesymbol[DoubleStruckCapitalH][\USymbChar{33}{13}] % DOUBLE-STRUCK CAPITAL H - \definesymbol[DoubleStruckCapitalN][\USymbChar{33}{21}] % DOUBLE-STRUCK CAPITAL N - \definesymbol[DoubleStruckCapitalP][\USymbChar{33}{25}] % DOUBLE-STRUCK CAPITAL P - \definesymbol[DoubleStruckCapitalQ][\USymbChar{33}{26}] % DOUBLE-STRUCK CAPITAL Q - \definesymbol[DoubleStruckCapitalR][\USymbChar{33}{29}] % DOUBLE-STRUCK CAPITAL R - \definesymbol[DoubleStruckCapitalZ][\USymbChar{33}{36}] % DOUBLE-STRUCK CAPITAL Z - \definesymbol[DoubleStruckSmallGamma][\USymbChar{33}{61}] % [Unassigned U+213D] - \definesymbol[DoubleStruckCapitalGamma][\USymbChar{33}{62}] % [Unassigned U+213E] - \definesymbol[DoubleStruckCapitalPi][\USymbChar{33}{63}] % [Unassigned U+213F] - \definesymbol[DoubleStruckNArySummation][\USymbChar{33}{64}] % [Unassigned U+2140] - \definesymbol[DoubleStruckItalicCapitalD][\USymbChar{33}{69}] % [Unassigned U+2145] - \definesymbol[DoubleStruckItalicSmallD][\USymbChar{33}{70}] % [Unassigned U+2146] - \definesymbol[DoubleStruckItalicSmallE][\USymbChar{33}{71}] % [Unassigned U+2147] - \definesymbol[DoubleStruckItalicSmallI][\USymbChar{33}{72}] % [Unassigned U+2148] - \definesymbol[DoubleStruckItalicSmallJ][\USymbChar{33}{73}] % [Unassigned U+2149] - -\stopsymbolset - -\startsymbolset[Unicode Roman Numerals] % 0x2150: Requires UnicodeRegular21 - - \definesymbol[RomanNumeralOne][\USymbCharTwo{33}{96}] % ROMAN NUMERAL ONE - \definesymbol[RomanNumeralTwo][\USymbCharTwo{33}{97}] % ROMAN NUMERAL TWO - \definesymbol[RomanNumeralThree][\USymbCharTwo{33}{98}] % ROMAN NUMERAL THREE - \definesymbol[RomanNumeralFour][\USymbCharTwo{33}{99}] % ROMAN NUMERAL FOUR - \definesymbol[RomanNumeralFive][\USymbCharTwo{33}{100}] % ROMAN NUMERAL FIVE - \definesymbol[RomanNumeralSix][\USymbCharTwo{33}{101}] % ROMAN NUMERAL SIX - \definesymbol[RomanNumeralSeven][\USymbCharTwo{33}{102}] % ROMAN NUMERAL SEVEN - \definesymbol[RomanNumeralEight][\USymbCharTwo{33}{103}] % ROMAN NUMERAL EIGHT - \definesymbol[RomanNumeralNine][\USymbCharTwo{33}{104}] % ROMAN NUMERAL NINE - \definesymbol[RomanNumeralTen][\USymbCharTwo{33}{105}] % ROMAN NUMERAL TEN - \definesymbol[RomanNumeralEleven][\USymbCharTwo{33}{106}] % ROMAN NUMERAL ELEVEN - \definesymbol[RomanNumeralTwelve][\USymbCharTwo{33}{107}] % ROMAN NUMERAL TWELVE - \definesymbol[RomanNumeralFifty][\USymbCharTwo{33}{108}] % ROMAN NUMERAL FIFTY - \definesymbol[RomanNumeralOneHundred][\USymbCharTwo{33}{109}] % ROMAN NUMERAL ONE HUNDRED - \definesymbol[RomanNumeralFiveHundred][\USymbCharTwo{33}{110}] % ROMAN NUMERAL FIVE HUNDRED - \definesymbol[RomanNumeralOneThousand][\USymbCharTwo{33}{111}] % ROMAN NUMERAL ONE THOUSAND - \definesymbol[RomanNumeralOneThousandCD][\USymbCharTwo{33}{128}] % ROMAN NUMERAL ONE THOUSAND C D - \definesymbol[RomanNumeralFiveThousand][\USymbCharTwo{33}{129}] % ROMAN NUMERAL FIVE THOUSAND - \definesymbol[RomanNumeralTenThousand][\USymbCharTwo{33}{130}] % ROMAN NUMERAL TEN THOUSAND - \definesymbol[RomanNumeralReversedOneHundred][\USymbCharTwo{33}{131}] % ROMAN NUMERAL REVERSED ONE HUNDRED - -\stopsymbolset - -\startsymbolset[Unicode Small Roman Numerals] % 0x2150: Requires UnicodeRegular21 - - \definesymbol[SmallRomanNumeralOne][\USymbCharTwo{33}{112}] % SMALL ROMAN NUMERAL ONE - \definesymbol[SmallRomanNumeralTwo][\USymbCharTwo{33}{113}] % SMALL ROMAN NUMERAL TWO - \definesymbol[SmallRomanNumeralThree][\USymbCharTwo{33}{114}] % SMALL ROMAN NUMERAL THREE - \definesymbol[SmallRomanNumeralFour][\USymbCharTwo{33}{115}] % SMALL ROMAN NUMERAL FOUR - \definesymbol[SmallRomanNumeralFive][\USymbCharTwo{33}{116}] % SMALL ROMAN NUMERAL FIVE - \definesymbol[SmallRomanNumeralSix][\USymbCharTwo{33}{117}] % SMALL ROMAN NUMERAL SIX - \definesymbol[SmallRomanNumeralSeven][\USymbCharTwo{33}{118}] % SMALL ROMAN NUMERAL SEVEN - \definesymbol[SmallRomanNumeralEight][\USymbCharTwo{33}{119}] % SMALL ROMAN NUMERAL EIGHT - \definesymbol[SmallRomanNumeralNine][\USymbCharTwo{33}{120}] % SMALL ROMAN NUMERAL NINE - \definesymbol[SmallRomanNumeralTen][\USymbCharTwo{33}{121}] % SMALL ROMAN NUMERAL TEN - \definesymbol[SmallRomanNumeralEleven][\USymbCharTwo{33}{122}] % SMALL ROMAN NUMERAL ELEVEN - \definesymbol[SmallRomanNumeralTwelve][\USymbCharTwo{33}{123}] % SMALL ROMAN NUMERAL TWELVE - \definesymbol[SmallRomanNumeralFifty][\USymbCharTwo{33}{124}] % SMALL ROMAN NUMERAL FIFTY - \definesymbol[SmallRomanNumeralOneHundred][\USymbCharTwo{33}{125}] % SMALL ROMAN NUMERAL ONE HUNDRED - \definesymbol[SmallRomanNumeralFiveHundred][\USymbCharTwo{33}{126}] % SMALL ROMAN NUMERAL FIVE HUNDRED - \definesymbol[SmallRomanNumeralOneThousand][\USymbCharTwo{33}{127}] % SMALL ROMAN NUMERAL ONE THOUSAND - -\stopsymbolset - -\startsymbolset[Unicode Arrows] % 0x2190: Requires UnicodeRegular21 - - \definesymbol[LeftwardsArrow][\USymbChar{33}{144}] % LEFTWARDS ARROW - \definesymbol[UpwardsArrow][\USymbChar{33}{145}] % UPWARDS ARROW - \definesymbol[RightwardsArrow][\USymbChar{33}{146}] % RIGHTWARDS ARROW - \definesymbol[DownwardsArrow][\USymbChar{33}{147}] % DOWNWARDS ARROW - \definesymbol[LeftRightArrow][\USymbChar{33}{148}] % LEFT RIGHT ARROW - \definesymbol[UpDownArrow][\USymbChar{33}{149}] % UP DOWN ARROW - \definesymbol[NorthWestArrow][\USymbChar{33}{150}] % NORTH WEST ARROW - \definesymbol[NorthEastArrow][\USymbChar{33}{151}] % NORTH EAST ARROW - \definesymbol[SouthEastArrow][\USymbChar{33}{152}] % SOUTH EAST ARROW - \definesymbol[SouthWestArrow][\USymbChar{33}{153}] % SOUTH WEST ARROW - \definesymbol[LeftwardsArrowWithStroke][\USymbChar{33}{154}] % LEFTWARDS ARROW WITH STROKE - \definesymbol[RightwardsArrowWithStroke][\USymbChar{33}{155}] % RIGHTWARDS ARROW WITH STROKE - \definesymbol[LeftwardsWaveArrow][\USymbChar{33}{156}] % LEFTWARDS WAVE ARROW - \definesymbol[RightwardsWaveArrow][\USymbChar{33}{157}] % RIGHTWARDS WAVE ARROW - \definesymbol[LeftwardsTwoHeadedArrow][\USymbChar{33}{158}] % LEFTWARDS TWO HEADED ARROW - \definesymbol[UpwardsTwoHeadedArrow][\USymbChar{33}{159}] % UPWARDS TWO HEADED ARROW - \definesymbol[RightwardsTwoHeadedArrow][\USymbChar{33}{160}] % RIGHTWARDS TWO HEADED ARROW - \definesymbol[DownwardsTwoHeadedArrow][\USymbChar{33}{161}] % DOWNWARDS TWO HEADED ARROW - \definesymbol[LeftwardsArrowWithTail][\USymbChar{33}{162}] % LEFTWARDS ARROW WITH TAIL - \definesymbol[RightwardsArrowWithTail][\USymbChar{33}{163}] % RIGHTWARDS ARROW WITH TAIL - \definesymbol[LeftwardsArrowFromBar][\USymbChar{33}{164}] % LEFTWARDS ARROW FROM BAR - \definesymbol[UpwardsArrowFromBar][\USymbChar{33}{165}] % UPWARDS ARROW FROM BAR - \definesymbol[RightwardsArrowFromBar][\USymbChar{33}{166}] % RIGHTWARDS ARROW FROM BAR - \definesymbol[DownwardsArrowFromBar][\USymbChar{33}{167}] % DOWNWARDS ARROW FROM BAR - \definesymbol[UpDownArrowWithBase][\USymbChar{33}{168}] % UP DOWN ARROW WITH BASE - \definesymbol[LeftwardsArrowWithHook][\USymbChar{33}{169}] % LEFTWARDS ARROW WITH HOOK - \definesymbol[RightwardsArrowWithHook][\USymbChar{33}{170}] % RIGHTWARDS ARROW WITH HOOK - \definesymbol[LeftwardsArrowWithLoop][\USymbChar{33}{171}] % LEFTWARDS ARROW WITH LOOP - \definesymbol[RightwardsArrowWithLoop][\USymbChar{33}{172}] % RIGHTWARDS ARROW WITH LOOP - \definesymbol[LeftRightWaveArrow][\USymbChar{33}{173}] % LEFT RIGHT WAVE ARROW - \definesymbol[LeftRightArrowWithStroke][\USymbChar{33}{174}] % LEFT RIGHT ARROW WITH STROKE - \definesymbol[DownwardsZigzagArrow][\USymbChar{33}{175}] % DOWNWARDS ZIGZAG ARROW - \definesymbol[UpwardsArrowWithTipLeftwards][\USymbChar{33}{176}] % UPWARDS ARROW WITH TIP LEFTWARDS - \definesymbol[UpwardsArrowWithTipRightwards][\USymbChar{33}{177}] % UPWARDS ARROW WITH TIP RIGHTWARDS - \definesymbol[DownwardsArrowWithTipLeftwards][\USymbChar{33}{178}] % DOWNWARDS ARROW WITH TIP LEFTWARDS - \definesymbol[DownwardsArrowWithTipRightwards][\USymbChar{33}{179}] % DOWNWARDS ARROW WITH TIP RIGHTWARDS - \definesymbol[RightwardsArrowWithCornerDownwards][\USymbChar{33}{180}] % RIGHTWARDS ARROW WITH CORNER DOWNWARDS - \definesymbol[DownwardsArrowWithCornerLeftwards][\USymbChar{33}{181}] % DOWNWARDS ARROW WITH CORNER LEFTWARDS - \definesymbol[AnticlockwiseTopSemicircleArrow][\USymbChar{33}{182}] % ANTICLOCKWISE TOP SEMICIRCLE ARROW - \definesymbol[ClockwiseTopSemicircleArrow][\USymbChar{33}{183}] % CLOCKWISE TOP SEMICIRCLE ARROW - \definesymbol[NorthWestArrowToLongBar][\USymbChar{33}{184}] % NORTH WEST ARROW TO LONG BAR - \definesymbol[AnticlockwiseOpenCircleArrow][\USymbChar{33}{186}] % ANTICLOCKWISE OPEN CIRCLE ARROW - \definesymbol[ClockwiseOpenCircleArrow][\USymbChar{33}{187}] % CLOCKWISE OPEN CIRCLE ARROW - \definesymbol[LeftwardsHarpoonWithBarbUpwards][\USymbChar{33}{188}] % LEFTWARDS HARPOON WITH BARB UPWARDS - \definesymbol[LeftwardsHarpoonWithBarbDownwards][\USymbChar{33}{189}] % LEFTWARDS HARPOON WITH BARB DOWNWARDS - \definesymbol[UpwardsHarpoonWithBarbRightwards][\USymbChar{33}{190}] % UPWARDS HARPOON WITH BARB RIGHTWARDS - \definesymbol[UpwardsHarpoonWithBarbLeftwards][\USymbChar{33}{191}] % UPWARDS HARPOON WITH BARB LEFTWARDS - \definesymbol[RightwardsHarpoonWithBarbUpwards][\USymbChar{33}{192}] % RIGHTWARDS HARPOON WITH BARB UPWARDS - \definesymbol[RightwardsHarpoonWithBarbDownwards][\USymbChar{33}{193}] % RIGHTWARDS HARPOON WITH BARB DOWNWARDS - \definesymbol[DownwardsHarpoonWithBarbRightwards][\USymbChar{33}{194}] % DOWNWARDS HARPOON WITH BARB RIGHTWARDS - \definesymbol[DownwardsHarpoonWithBarbLeftwards][\USymbChar{33}{195}] % DOWNWARDS HARPOON WITH BARB LEFTWARDS - \definesymbol[LeftwardsSquiggleArrow][\USymbChar{33}{220}] % LEFTWARDS SQUIGGLE ARROW - \definesymbol[RightwardsSquiggleArrow][\USymbChar{33}{221}] % RIGHTWARDS SQUIGGLE ARROW - \definesymbol[UpwardsArrowWithDoubleStroke][\USymbChar{33}{222}] % UPWARDS ARROW WITH DOUBLE STROKE - \definesymbol[DownwardsArrowWithDoubleStroke][\USymbChar{33}{223}] % DOWNWARDS ARROW WITH DOUBLE STROKE - \definesymbol[LeftwardsDashedArrow][\USymbChar{33}{224}] % LEFTWARDS DASHED ARROW - \definesymbol[UpwardsDashedArrow][\USymbChar{33}{225}] % UPWARDS DASHED ARROW - \definesymbol[RightwardsDashedArrow][\USymbChar{33}{226}] % RIGHTWARDS DASHED ARROW - \definesymbol[DownwardsDashedArrow][\USymbChar{33}{227}] % DOWNWARDS DASHED ARROW - \definesymbol[LeftwardsArrowToBar][\USymbChar{33}{228}] % LEFTWARDS ARROW TO BAR - \definesymbol[RightwardsArrowToBar][\USymbChar{33}{229}] % RIGHTWARDS ARROW TO BAR - \definesymbol[LeftwardsWhiteArrow][\USymbChar{33}{230}] % LEFTWARDS WHITE ARROW - \definesymbol[UpwardsWhiteArrow][\USymbChar{33}{231}] % UPWARDS WHITE ARROW - \definesymbol[RightwardsWhiteArrow][\USymbChar{33}{232}] % RIGHTWARDS WHITE ARROW - \definesymbol[DownwardsWhiteArrow][\USymbChar{33}{233}] % DOWNWARDS WHITE ARROW - \definesymbol[UpwardsWhiteArrowFromBar][\USymbChar{33}{234}] % UPWARDS WHITE ARROW FROM BAR - \definesymbol[UpwardsWhiteArrowOnPedestal][\USymbChar{33}{235}] % UPWARDS WHITE ARROW ON PEDESTAL - \definesymbol[UpwardsWhiteArrowOnPedestalWithHorizontalBar][\USymbChar{33}{236}] % UPWARDS WHITE ARROW ON PEDESTAL WITH HORIZONTAL BAR - \definesymbol[UpwardsWhiteArrowOnPedestalWithVerticalBar][\USymbChar{33}{237}] % UPWARDS WHITE ARROW ON PEDESTAL WITH VERTICAL BAR - \definesymbol[RightwardsWhiteArrowFromWall][\USymbChar{33}{240}] % RIGHTWARDS WHITE ARROW FROM WALL - \definesymbol[NorthWestArrowToCorner][\USymbChar{33}{241}] % NORTH WEST ARROW TO CORNER - \definesymbol[SouthEastArrowToCorner][\USymbChar{33}{242}] % SOUTH EAST ARROW TO CORNER - \definesymbol[UpDownWhiteArrow][\USymbChar{33}{243}] % UP DOWN WHITE ARROW - -\stopsymbolset - -\startsymbolset[Unicode Multi Arrows] % 0x2190: Requires UnicodeRegular21 - - \definesymbol[LeftwardsArrowToBarOverRightwardsArrowToBar][\USymbChar{33}{185}] % LEFTWARDS ARROW TO BAR OVER RIGHTWARDS ARROW TO BAR - \definesymbol[RightwardsArrowOverLeftwardsArrow][\USymbChar{33}{196}] % RIGHTWARDS ARROW OVER LEFTWARDS ARROW - \definesymbol[UpwardsArrowLeftwardsOfDownwardsArrow][\USymbChar{33}{197}] % UPWARDS ARROW LEFTWARDS OF DOWNWARDS ARROW - \definesymbol[LeftwardsArrowOverRightwardsArrow][\USymbChar{33}{198}] % LEFTWARDS ARROW OVER RIGHTWARDS ARROW - \definesymbol[LeftwardsPairedArrows][\USymbChar{33}{199}] % LEFTWARDS PAIRED ARROWS - \definesymbol[UpwardsPairedArrows][\USymbChar{33}{200}] % UPWARDS PAIRED ARROWS - \definesymbol[RightwardsPairedArrows][\USymbChar{33}{201}] % RIGHTWARDS PAIRED ARROWS - \definesymbol[DownwardsPairedArrows][\USymbChar{33}{202}] % DOWNWARDS PAIRED ARROWS - \definesymbol[LeftwardsHarpoonOverRightwardsHarpoon][\USymbChar{33}{203}] % LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON - \definesymbol[RightwardsHarpoonOverLeftwardsHarpoon][\USymbChar{33}{204}] % RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON - \definesymbol[LeftwardsDoubleArrowWithStroke][\USymbChar{33}{205}] % LEFTWARDS DOUBLE ARROW WITH STROKE - \definesymbol[LeftRightDoubleArrowWithStroke][\USymbChar{33}{206}] % LEFT RIGHT DOUBLE ARROW WITH STROKE - \definesymbol[RightwardsDoubleArrowWithStroke][\USymbChar{33}{207}] % RIGHTWARDS DOUBLE ARROW WITH STROKE - \definesymbol[LeftwardsDoubleArrow][\USymbChar{33}{208}] % LEFTWARDS DOUBLE ARROW - \definesymbol[UpwardsDoubleArrow][\USymbChar{33}{209}] % UPWARDS DOUBLE ARROW - \definesymbol[RightwardsDoubleArrow][\USymbChar{33}{210}] % RIGHTWARDS DOUBLE ARROW - \definesymbol[DownwardsDoubleArrow][\USymbChar{33}{211}] % DOWNWARDS DOUBLE ARROW - \definesymbol[LeftRightDoubleArrow][\USymbChar{33}{212}] % LEFT RIGHT DOUBLE ARROW - \definesymbol[UpDownDoubleArrow][\USymbChar{33}{213}] % UP DOWN DOUBLE ARROW - \definesymbol[NorthWestDoubleArrow][\USymbChar{33}{214}] % NORTH WEST DOUBLE ARROW - \definesymbol[NorthEastDoubleArrow][\USymbChar{33}{215}] % NORTH EAST DOUBLE ARROW - \definesymbol[SouthEastDoubleArrow][\USymbChar{33}{216}] % SOUTH EAST DOUBLE ARROW - \definesymbol[SouthWestDoubleArrow][\USymbChar{33}{217}] % SOUTH WEST DOUBLE ARROW - \definesymbol[LeftwardsTripleArrow][\USymbChar{33}{218}] % LEFTWARDS TRIPLE ARROW - \definesymbol[RightwardsTripleArrow][\USymbChar{33}{219}] % RIGHTWARDS TRIPLE ARROW - \definesymbol[UpwardsWhiteDoubleArrow][\USymbChar{33}{238}] % UPWARDS WHITE DOUBLE ARROW - \definesymbol[UpwardsWhiteDoubleArrowOnPedestal][\USymbChar{33}{239}] % UPWARDS WHITE DOUBLE ARROW ON PEDESTAL - -\stopsymbolset - - -\startsymbolset[Unicode Optical Character Recognition] % 0x2440: Requires UnicodeRegular24 - - \definesymbol[OcrHook][\USymbChar{36}{64}] % OCR HOOK - \definesymbol[OcrChair][\USymbChar{36}{65}] % OCR CHAIR - \definesymbol[OcrFork][\USymbChar{36}{66}] % OCR FORK - \definesymbol[OcrInvertedFork][\USymbChar{36}{67}] % OCR INVERTED FORK - \definesymbol[OcrBeltBuckle][\USymbChar{36}{68}] % OCR BELT BUCKLE - \definesymbol[OcrBowTie][\USymbChar{36}{69}] % OCR BOW TIE - \definesymbol[OcrBranchBankIdentification][\USymbChar{36}{70}] % OCR BRANCH BANK IDENTIFICATION - \definesymbol[OcrAmountOfCheck][\USymbChar{36}{71}] % OCR AMOUNT OF CHECK - \definesymbol[OcrDash][\USymbChar{36}{72}] % OCR DASH - \definesymbol[OcrCustomerAccountNumber][\USymbChar{36}{73}] % OCR CUSTOMER ACCOUNT NUMBER - \definesymbol[OcrDoubleBackslash][\USymbChar{36}{74}] % OCR DOUBLE BACKSLASH - -\stopsymbolset - - -\startsymbolset[Unicode Box Drawing] % 0x2500: Requires UnicodeRegular25 - - \definesymbol[LightHorizontal][\USymbChar{37}{0}] % BOX DRAWINGS LIGHT HORIZONTAL - \definesymbol[HeavyHorizontal][\USymbChar{37}{1}] % BOX DRAWINGS HEAVY HORIZONTAL - \definesymbol[LightVertical][\USymbChar{37}{2}] % BOX DRAWINGS LIGHT VERTICAL - \definesymbol[HeavyVertical][\USymbChar{37}{3}] % BOX DRAWINGS HEAVY VERTICAL - \definesymbol[LightTripleDashHorizontal][\USymbChar{37}{4}] % BOX DRAWINGS LIGHT TRIPLE DASH HORIZONTAL - \definesymbol[HeavyTripleDashHorizontal][\USymbChar{37}{5}] % BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL - \definesymbol[LightTripleDashVertical][\USymbChar{37}{6}] % BOX DRAWINGS LIGHT TRIPLE DASH VERTICAL - \definesymbol[HeavyTripleDashVertical][\USymbChar{37}{7}] % BOX DRAWINGS HEAVY TRIPLE DASH VERTICAL - \definesymbol[LightQuadrupleDashHorizontal][\USymbChar{37}{8}] % BOX DRAWINGS LIGHT QUADRUPLE DASH HORIZONTAL - \definesymbol[HeavyQuadrupleDashHorizontal][\USymbChar{37}{9}] % BOX DRAWINGS HEAVY QUADRUPLE DASH HORIZONTAL - \definesymbol[LightQuadrupleDashVertical][\USymbChar{37}{10}] % BOX DRAWINGS LIGHT QUADRUPLE DASH VERTICAL - \definesymbol[HeavyQuadrupleDashVertical][\USymbChar{37}{11}] % BOX DRAWINGS HEAVY QUADRUPLE DASH VERTICAL - \definesymbol[LightDownAndRight][\USymbChar{37}{12}] % BOX DRAWINGS LIGHT DOWN AND RIGHT - \definesymbol[DownLightAndRightHeavy][\USymbChar{37}{13}] % BOX DRAWINGS DOWN LIGHT AND RIGHT HEAVY - \definesymbol[DownHeavyAndRightLight][\USymbChar{37}{14}] % BOX DRAWINGS DOWN HEAVY AND RIGHT LIGHT - \definesymbol[HeavyDownAndRight][\USymbChar{37}{15}] % BOX DRAWINGS HEAVY DOWN AND RIGHT - \definesymbol[LightDownAndLeft][\USymbChar{37}{16}] % BOX DRAWINGS LIGHT DOWN AND LEFT - \definesymbol[DownLightAndLeftHeavy][\USymbChar{37}{17}] % BOX DRAWINGS DOWN LIGHT AND LEFT HEAVY - \definesymbol[DownHeavyAndLeftLight][\USymbChar{37}{18}] % BOX DRAWINGS DOWN HEAVY AND LEFT LIGHT - \definesymbol[HeavyDownAndLeft][\USymbChar{37}{19}] % BOX DRAWINGS HEAVY DOWN AND LEFT - \definesymbol[LightUpAndRight][\USymbChar{37}{20}] % BOX DRAWINGS LIGHT UP AND RIGHT - \definesymbol[UpLightAndRightHeavy][\USymbChar{37}{21}] % BOX DRAWINGS UP LIGHT AND RIGHT HEAVY - \definesymbol[UpHeavyAndRightLight][\USymbChar{37}{22}] % BOX DRAWINGS UP HEAVY AND RIGHT LIGHT - \definesymbol[HeavyUpAndRight][\USymbChar{37}{23}] % BOX DRAWINGS HEAVY UP AND RIGHT - \definesymbol[LightUpAndLeft][\USymbChar{37}{24}] % BOX DRAWINGS LIGHT UP AND LEFT - \definesymbol[UpLightAndLeftHeavy][\USymbChar{37}{25}] % BOX DRAWINGS UP LIGHT AND LEFT HEAVY - \definesymbol[UpHeavyAndLeftLight][\USymbChar{37}{26}] % BOX DRAWINGS UP HEAVY AND LEFT LIGHT - \definesymbol[HeavyUpAndLeft][\USymbChar{37}{27}] % BOX DRAWINGS HEAVY UP AND LEFT - \definesymbol[LightVerticalAndRight][\USymbChar{37}{28}] % BOX DRAWINGS LIGHT VERTICAL AND RIGHT - \definesymbol[VerticalLightAndRightHeavy][\USymbChar{37}{29}] % BOX DRAWINGS VERTICAL LIGHT AND RIGHT HEAVY - \definesymbol[UpHeavyAndRightDownLight][\USymbChar{37}{30}] % BOX DRAWINGS UP HEAVY AND RIGHT DOWN LIGHT - \definesymbol[DownHeavyAndRightUpLight][\USymbChar{37}{31}] % BOX DRAWINGS DOWN HEAVY AND RIGHT UP LIGHT - \definesymbol[VerticalHeavyAndRightLight][\USymbChar{37}{32}] % BOX DRAWINGS VERTICAL HEAVY AND RIGHT LIGHT - \definesymbol[DownLightAndRightUpHeavy][\USymbChar{37}{33}] % BOX DRAWINGS DOWN LIGHT AND RIGHT UP HEAVY - \definesymbol[UpLightAndRightDownHeavy][\USymbChar{37}{34}] % BOX DRAWINGS UP LIGHT AND RIGHT DOWN HEAVY - \definesymbol[HeavyVerticalAndRight][\USymbChar{37}{35}] % BOX DRAWINGS HEAVY VERTICAL AND RIGHT - \definesymbol[LightVerticalAndLeft][\USymbChar{37}{36}] % BOX DRAWINGS LIGHT VERTICAL AND LEFT - \definesymbol[VerticalLightAndLeftHeavy][\USymbChar{37}{37}] % BOX DRAWINGS VERTICAL LIGHT AND LEFT HEAVY - \definesymbol[UpHeavyAndLeftDownLight][\USymbChar{37}{38}] % BOX DRAWINGS UP HEAVY AND LEFT DOWN LIGHT - \definesymbol[DownHeavyAndLeftUpLight][\USymbChar{37}{39}] % BOX DRAWINGS DOWN HEAVY AND LEFT UP LIGHT - \definesymbol[VerticalHeavyAndLeftLight][\USymbChar{37}{40}] % BOX DRAWINGS VERTICAL HEAVY AND LEFT LIGHT - \definesymbol[DownLightAndLeftUpHeavy][\USymbChar{37}{41}] % BOX DRAWINGS DOWN LIGHT AND LEFT UP HEAVY - \definesymbol[UpLightAndLeftDownHeavy][\USymbChar{37}{42}] % BOX DRAWINGS UP LIGHT AND LEFT DOWN HEAVY - \definesymbol[HeavyVerticalAndLeft][\USymbChar{37}{43}] % BOX DRAWINGS HEAVY VERTICAL AND LEFT - \definesymbol[LightDownAndHorizontal][\USymbChar{37}{44}] % BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - \definesymbol[LeftHeavyAndRightDownLight][\USymbChar{37}{45}] % BOX DRAWINGS LEFT HEAVY AND RIGHT DOWN LIGHT - \definesymbol[RightHeavyAndLeftDownLight][\USymbChar{37}{46}] % BOX DRAWINGS RIGHT HEAVY AND LEFT DOWN LIGHT - \definesymbol[DownLightAndHorizontalHeavy][\USymbChar{37}{47}] % BOX DRAWINGS DOWN LIGHT AND HORIZONTAL HEAVY - \definesymbol[DownHeavyAndHorizontalLight][\USymbChar{37}{48}] % BOX DRAWINGS DOWN HEAVY AND HORIZONTAL LIGHT - \definesymbol[RightLightAndLeftDownHeavy][\USymbChar{37}{49}] % BOX DRAWINGS RIGHT LIGHT AND LEFT DOWN HEAVY - \definesymbol[LeftLightAndRightDownHeavy][\USymbChar{37}{50}] % BOX DRAWINGS LEFT LIGHT AND RIGHT DOWN HEAVY - \definesymbol[HeavyDownAndHorizontal][\USymbChar{37}{51}] % BOX DRAWINGS HEAVY DOWN AND HORIZONTAL - \definesymbol[LightUpAndHorizontal][\USymbChar{37}{52}] % BOX DRAWINGS LIGHT UP AND HORIZONTAL - \definesymbol[LeftHeavyAndRightUpLight][\USymbChar{37}{53}] % BOX DRAWINGS LEFT HEAVY AND RIGHT UP LIGHT - \definesymbol[RightHeavyAndLeftUpLight][\USymbChar{37}{54}] % BOX DRAWINGS RIGHT HEAVY AND LEFT UP LIGHT - \definesymbol[UpLightAndHorizontalHeavy][\USymbChar{37}{55}] % BOX DRAWINGS UP LIGHT AND HORIZONTAL HEAVY - \definesymbol[UpHeavyAndHorizontalLight][\USymbChar{37}{56}] % BOX DRAWINGS UP HEAVY AND HORIZONTAL LIGHT - \definesymbol[RightLightAndLeftUpHeavy][\USymbChar{37}{57}] % BOX DRAWINGS RIGHT LIGHT AND LEFT UP HEAVY - \definesymbol[LeftLightAndRightUpHeavy][\USymbChar{37}{58}] % BOX DRAWINGS LEFT LIGHT AND RIGHT UP HEAVY - \definesymbol[HeavyUpAndHorizontal][\USymbChar{37}{59}] % BOX DRAWINGS HEAVY UP AND HORIZONTAL - \definesymbol[LightVerticalAndHorizontal][\USymbChar{37}{60}] % BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - \definesymbol[LeftHeavyAndRightVerticalLight][\USymbChar{37}{61}] % BOX DRAWINGS LEFT HEAVY AND RIGHT VERTICAL LIGHT - \definesymbol[RightHeavyAndLeftVerticalLight][\USymbChar{37}{62}] % BOX DRAWINGS RIGHT HEAVY AND LEFT VERTICAL LIGHT - \definesymbol[VerticalLightAndHorizontalHeavy][\USymbChar{37}{63}] % BOX DRAWINGS VERTICAL LIGHT AND HORIZONTAL HEAVY - \definesymbol[UpHeavyAndDownHorizontalLight][\USymbChar{37}{64}] % BOX DRAWINGS UP HEAVY AND DOWN HORIZONTAL LIGHT - \definesymbol[DownHeavyAndUpHorizontalLight][\USymbChar{37}{65}] % BOX DRAWINGS DOWN HEAVY AND UP HORIZONTAL LIGHT - \definesymbol[VerticalHeavyAndHorizontalLight][\USymbChar{37}{66}] % BOX DRAWINGS VERTICAL HEAVY AND HORIZONTAL LIGHT - \definesymbol[LeftUpHeavyAndRightDownLight][\USymbChar{37}{67}] % BOX DRAWINGS LEFT UP HEAVY AND RIGHT DOWN LIGHT - \definesymbol[RightUpHeavyAndLeftDownLight][\USymbChar{37}{68}] % BOX DRAWINGS RIGHT UP HEAVY AND LEFT DOWN LIGHT - \definesymbol[LeftDownHeavyAndRightUpLight][\USymbChar{37}{69}] % BOX DRAWINGS LEFT DOWN HEAVY AND RIGHT UP LIGHT - \definesymbol[RightDownHeavyAndLeftUpLight][\USymbChar{37}{70}] % BOX DRAWINGS RIGHT DOWN HEAVY AND LEFT UP LIGHT - \definesymbol[DownLightAndUpHorizontalHeavy][\USymbChar{37}{71}] % BOX DRAWINGS DOWN LIGHT AND UP HORIZONTAL HEAVY - \definesymbol[UpLightAndDownHorizontalHeavy][\USymbChar{37}{72}] % BOX DRAWINGS UP LIGHT AND DOWN HORIZONTAL HEAVY - \definesymbol[RightLightAndLeftVerticalHeavy][\USymbChar{37}{73}] % BOX DRAWINGS RIGHT LIGHT AND LEFT VERTICAL HEAVY - \definesymbol[LeftLightAndRightVerticalHeavy][\USymbChar{37}{74}] % BOX DRAWINGS LEFT LIGHT AND RIGHT VERTICAL HEAVY - \definesymbol[HeavyVerticalAndHorizontal][\USymbChar{37}{75}] % BOX DRAWINGS HEAVY VERTICAL AND HORIZONTAL - \definesymbol[LightArcDownAndRight][\USymbChar{37}{109}] % BOX DRAWINGS LIGHT ARC DOWN AND RIGHT - \definesymbol[LightArcDownAndLeft][\USymbChar{37}{110}] % BOX DRAWINGS LIGHT ARC DOWN AND LEFT - \definesymbol[LightArcUpAndLeft][\USymbChar{37}{111}] % BOX DRAWINGS LIGHT ARC UP AND LEFT - \definesymbol[LightArcUpAndRight][\USymbChar{37}{112}] % BOX DRAWINGS LIGHT ARC UP AND RIGHT - \definesymbol[LightDiagonalUpperRightToLowerLeft][\USymbChar{37}{113}] % BOX DRAWINGS LIGHT DIAGONAL UPPER RIGHT TO LOWER LEFT - \definesymbol[LightDiagonalUpperLeftToLowerRight][\USymbChar{37}{114}] % BOX DRAWINGS LIGHT DIAGONAL UPPER LEFT TO LOWER RIGHT - \definesymbol[LightDiagonalCross][\USymbChar{37}{115}] % BOX DRAWINGS LIGHT DIAGONAL CROSS - \definesymbol[LightLeft][\USymbChar{37}{116}] % BOX DRAWINGS LIGHT LEFT - \definesymbol[LightUp][\USymbChar{37}{117}] % BOX DRAWINGS LIGHT UP - \definesymbol[LightRight][\USymbChar{37}{118}] % BOX DRAWINGS LIGHT RIGHT - \definesymbol[LightDown][\USymbChar{37}{119}] % BOX DRAWINGS LIGHT DOWN - \definesymbol[HeavyLeft][\USymbChar{37}{120}] % BOX DRAWINGS HEAVY LEFT - \definesymbol[HeavyUp][\USymbChar{37}{121}] % BOX DRAWINGS HEAVY UP - \definesymbol[HeavyRight][\USymbChar{37}{122}] % BOX DRAWINGS HEAVY RIGHT - \definesymbol[HeavyDown][\USymbChar{37}{123}] % BOX DRAWINGS HEAVY DOWN - \definesymbol[LightLeftAndHeavyRight][\USymbChar{37}{124}] % BOX DRAWINGS LIGHT LEFT AND HEAVY RIGHT - \definesymbol[LightUpAndHeavyDown][\USymbChar{37}{125}] % BOX DRAWINGS LIGHT UP AND HEAVY DOWN - \definesymbol[HeavyLeftAndLightRight][\USymbChar{37}{126}] % BOX DRAWINGS HEAVY LEFT AND LIGHT RIGHT - \definesymbol[HeavyUpAndLightDown][\USymbChar{37}{127}] % BOX DRAWINGS HEAVY UP AND LIGHT DOWN - -\stopsymbolset - -\startsymbolset[Unicode Circled Digits] % 0x2460: Requires UnicodeRegular24 - - \definesymbol[CircledOne][\USymbCharZapf{36}{96}] % CIRCLED DIGIT ONE - \definesymbol[CircledTwo][\USymbCharZapf{36}{97}] % CIRCLED DIGIT TWO - \definesymbol[CircledThree][\USymbCharZapf{36}{98}] % CIRCLED DIGIT THREE - \definesymbol[CircledFour][\USymbCharZapf{36}{99}] % CIRCLED DIGIT FOUR - \definesymbol[CircledFive][\USymbCharZapf{36}{100}] % CIRCLED DIGIT FIVE - \definesymbol[CircledSix][\USymbCharZapf{36}{101}] % CIRCLED DIGIT SIX - \definesymbol[CircledSeven][\USymbCharZapf{36}{102}] % CIRCLED DIGIT SEVEN - \definesymbol[CircledEight][\USymbCharZapf{36}{103}] % CIRCLED DIGIT EIGHT - \definesymbol[CircledNine][\USymbCharZapf{36}{104}] % CIRCLED DIGIT NINE - \definesymbol[CircledTen][\USymbCharZapf{36}{105}] % CIRCLED NUMBER TEN - -\stopsymbolset - -\startsymbolset[Unicode Double Box Drawing] % 0x2500: Requires UnicodeRegular25 - - \definesymbol[LightDoubleDashHorizontal][\USymbChar{37}{76}] % BOX DRAWINGS LIGHT DOUBLE DASH HORIZONTAL - \definesymbol[HeavyDoubleDashHorizontal][\USymbChar{37}{77}] % BOX DRAWINGS HEAVY DOUBLE DASH HORIZONTAL - \definesymbol[LightDoubleDashVertical][\USymbChar{37}{78}] % BOX DRAWINGS LIGHT DOUBLE DASH VERTICAL - \definesymbol[HeavyDoubleDashVertical][\USymbChar{37}{79}] % BOX DRAWINGS HEAVY DOUBLE DASH VERTICAL - \definesymbol[DoubleHorizontal][\USymbChar{37}{80}] % BOX DRAWINGS DOUBLE HORIZONTAL - \definesymbol[DoubleVertical][\USymbChar{37}{81}] % BOX DRAWINGS DOUBLE VERTICAL - \definesymbol[DownSingleAndRightDouble][\USymbChar{37}{82}] % BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - \definesymbol[DownDoubleAndRightSingle][\USymbChar{37}{83}] % BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - \definesymbol[DoubleDownAndRight][\USymbChar{37}{84}] % BOX DRAWINGS DOUBLE DOWN AND RIGHT - \definesymbol[DownSingleAndLeftDouble][\USymbChar{37}{85}] % BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - \definesymbol[DownDoubleAndLeftSingle][\USymbChar{37}{86}] % BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - \definesymbol[DoubleDownAndLeft][\USymbChar{37}{87}] % BOX DRAWINGS DOUBLE DOWN AND LEFT - \definesymbol[UpSingleAndRightDouble][\USymbChar{37}{88}] % BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - \definesymbol[UpDoubleAndRightSingle][\USymbChar{37}{89}] % BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - \definesymbol[DoubleUpAndRight][\USymbChar{37}{90}] % BOX DRAWINGS DOUBLE UP AND RIGHT - \definesymbol[UpSingleAndLeftDouble][\USymbChar{37}{91}] % BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - \definesymbol[UpDoubleAndLeftSingle][\USymbChar{37}{92}] % BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - \definesymbol[DoubleUpAndLeft][\USymbChar{37}{93}] % BOX DRAWINGS DOUBLE UP AND LEFT - \definesymbol[VerticalSingleAndRightDouble][\USymbChar{37}{94}] % BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - \definesymbol[VerticalDoubleAndRightSingle][\USymbChar{37}{95}] % BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - \definesymbol[DoubleVerticalAndRight][\USymbChar{37}{96}] % BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - \definesymbol[VerticalSingleAndLeftDouble][\USymbChar{37}{97}] % BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - \definesymbol[VerticalDoubleAndLeftSingle][\USymbChar{37}{98}] % BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - \definesymbol[DoubleVerticalAndLeft][\USymbChar{37}{99}] % BOX DRAWINGS DOUBLE VERTICAL AND LEFT - \definesymbol[DownSingleAndHorizontalDouble][\USymbChar{37}{100}] % BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - \definesymbol[DownDoubleAndHorizontalSingle][\USymbChar{37}{101}] % BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - \definesymbol[DoubleDownAndHorizontal][\USymbChar{37}{102}] % BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - \definesymbol[UpSingleAndHorizontalDouble][\USymbChar{37}{103}] % BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - \definesymbol[UpDoubleAndHorizontalSingle][\USymbChar{37}{104}] % BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - \definesymbol[DoubleUpAndHorizontal][\USymbChar{37}{105}] % BOX DRAWINGS DOUBLE UP AND HORIZONTAL - \definesymbol[VerticalSingleAndHorizontalDouble][\USymbChar{37}{106}] % BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - \definesymbol[VerticalDoubleAndHorizontalSingle][\USymbChar{37}{107}] % BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - \definesymbol[DoubleVerticalAndHorizontal][\USymbChar{37}{108}] % BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - -\stopsymbolset - -\startsymbolset[Unicode Block Elements] % 0x2580: Requires UnicodeRegular25 - - \definesymbol[UpperHalfBlock][\USymbChar{37}{128}] % UPPER HALF BLOCK - \definesymbol[LowerOneEighthBlock][\USymbChar{37}{129}] % LOWER ONE EIGHTH BLOCK - \definesymbol[LowerOneQuarterBlock][\USymbChar{37}{130}] % LOWER ONE QUARTER BLOCK - \definesymbol[LowerThreeEighthsBlock][\USymbChar{37}{131}] % LOWER THREE EIGHTHS BLOCK - \definesymbol[LowerHalfBlock][\USymbChar{37}{132}] % LOWER HALF BLOCK - \definesymbol[LowerFiveEighthsBlock][\USymbChar{37}{133}] % LOWER FIVE EIGHTHS BLOCK - \definesymbol[LowerThreeQuartersBlock][\USymbChar{37}{134}] % LOWER THREE QUARTERS BLOCK - \definesymbol[LowerSevenEighthsBlock][\USymbChar{37}{135}] % LOWER SEVEN EIGHTHS BLOCK - \definesymbol[FullBlock][\USymbChar{37}{136}] % FULL BLOCK - \definesymbol[LeftSevenEighthsBlock][\USymbChar{37}{137}] % LEFT SEVEN EIGHTHS BLOCK - \definesymbol[LeftThreeQuartersBlock][\USymbChar{37}{138}] % LEFT THREE QUARTERS BLOCK - \definesymbol[LeftFiveEighthsBlock][\USymbChar{37}{139}] % LEFT FIVE EIGHTHS BLOCK - \definesymbol[LeftHalfBlock][\USymbChar{37}{140}] % LEFT HALF BLOCK - \definesymbol[LeftThreeEighthsBlock][\USymbChar{37}{141}] % LEFT THREE EIGHTHS BLOCK - \definesymbol[LeftOneQuarterBlock][\USymbChar{37}{142}] % LEFT ONE QUARTER BLOCK - \definesymbol[LeftOneEighthBlock][\USymbChar{37}{143}] % LEFT ONE EIGHTH BLOCK - \definesymbol[RightHalfBlock][\USymbChar{37}{144}] % RIGHT HALF BLOCK - \definesymbol[UpperOneEighthBlock][\USymbChar{37}{148}] % UPPER ONE EIGHTH BLOCK - \definesymbol[RightOneEighthBlock][\USymbChar{37}{149}] % RIGHT ONE EIGHTH BLOCK - -\stopsymbolset - -\startsymbolset[Unicode Shade Characters] % 0x2580: Requires UnicodeRegular25 - - \definesymbol[LightShade][\USymbChar{37}{145}] % LIGHT SHADE - \definesymbol[MediumShade][\USymbChar{37}{146}] % MEDIUM SHADE - \definesymbol[DarkShade][\USymbChar{37}{147}] % DARK SHADE - -\stopsymbolset - -\startsymbolset[Unicode Terminal Graphics] % 0x2580: Requires UnicodeRegular25 - - \definesymbol[QuadrantLowerLeft][\USymbChar{37}{150}] % [Unassigned U+2596] - \definesymbol[QuadrantLowerRight][\USymbChar{37}{151}] % [Unassigned U+2597] - \definesymbol[QuadrantUpperLeft][\USymbChar{37}{152}] % [Unassigned U+2598] - \definesymbol[QuadrantUpperLeftAndLowerLeftAndLowerRight][\USymbChar{37}{153}] % [Unassigned U+2599] - \definesymbol[QuadrantUpperLeftAndLowerRight][\USymbChar{37}{154}] % [Unassigned U+259A] - \definesymbol[QuadrantUpperLeftAndUpperRightandLowerLeft][\USymbChar{37}{155}] % [Unassigned U+259B] - \definesymbol[QuadrantUpperLeftAndUpperRightAndLowerRight][\USymbChar{37}{156}] % [Unassigned U+259C] - \definesymbol[QuadrantUpperRight][\USymbChar{37}{157}] % [Unassigned U+259D] - \definesymbol[QuadrantUpperRightAndLowerLeft][\USymbChar{37}{158}] % [Unassigned U+259E] - \definesymbol[QuadrantUpperRightAndLowerLeftAndLowerRight][\USymbChar{37}{159}] % [Unassigned U+259F] - -\stopsymbolset - -\startsymbolset[Unicode Geometric Shapes] % 0x25A0: Requires UnicodeRegular25 - - \definesymbol[BlackSquare][\USymbChar{37}{160}] % BLACK SQUARE - \definesymbol[WhiteSquare][\USymbChar{37}{161}] % WHITE SQUARE - \definesymbol[WhiteSquareWithRoundedCorners][\USymbChar{37}{162}] % WHITE SQUARE WITH ROUNDED CORNERS - \definesymbol[WhiteSquareContainingBlackSmallSquare][\USymbChar{37}{163}] % WHITE SQUARE CONTAINING BLACK SMALL SQUARE - \definesymbol[SquareWithHorizontalFill][\USymbChar{37}{164}] % SQUARE WITH HORIZONTAL FILL - \definesymbol[SquareWithVerticalFill][\USymbChar{37}{165}] % SQUARE WITH VERTICAL FILL - \definesymbol[SquareWithOrthogonalCrosshatchFill][\USymbChar{37}{166}] % SQUARE WITH ORTHOGONAL CROSSHATCH FILL - \definesymbol[SquareWithUpperLeftToLowerRightFill][\USymbChar{37}{167}] % SQUARE WITH UPPER LEFT TO LOWER RIGHT FILL - \definesymbol[SquareWithUpperRightToLowerLeftFill][\USymbChar{37}{168}] % SQUARE WITH UPPER RIGHT TO LOWER LEFT FILL - \definesymbol[SquareWithDiagonalCrosshatchFill][\USymbChar{37}{169}] % SQUARE WITH DIAGONAL CROSSHATCH FILL - \definesymbol[BlackSmallSquare][\USymbChar{37}{170}] % BLACK SMALL SQUARE - \definesymbol[WhiteSmallSquare][\USymbChar{37}{171}] % WHITE SMALL SQUARE - \definesymbol[BlackRectangle][\USymbChar{37}{172}] % BLACK RECTANGLE - \definesymbol[WhiteRectangle][\USymbChar{37}{173}] % WHITE RECTANGLE - \definesymbol[BlackVerticalRectangle][\USymbChar{37}{174}] % BLACK VERTICAL RECTANGLE - \definesymbol[WhiteVerticalRectangle][\USymbChar{37}{175}] % WHITE VERTICAL RECTANGLE - \definesymbol[BlackParallelogram][\USymbChar{37}{176}] % BLACK PARALLELOGRAM - \definesymbol[WhiteParallelogram][\USymbChar{37}{177}] % WHITE PARALLELOGRAM - \definesymbol[BlackUpPointingTriangle][\USymbChar{37}{178}] % BLACK UP-POINTING TRIANGLE - \definesymbol[WhiteUpPointingTriangle][\USymbChar{37}{179}] % WHITE UP-POINTING TRIANGLE - \definesymbol[BlackUpPointingSmallTriangle][\USymbChar{37}{180}] % BLACK UP-POINTING SMALL TRIANGLE - \definesymbol[WhiteUpPointingSmallTriangle][\USymbChar{37}{181}] % WHITE UP-POINTING SMALL TRIANGLE - \definesymbol[BlackRightPointingTriangle][\USymbChar{37}{182}] % BLACK RIGHT-POINTING TRIANGLE - \definesymbol[WhiteRightPointingTriangle][\USymbChar{37}{183}] % WHITE RIGHT-POINTING TRIANGLE - \definesymbol[BlackRightPointingSmallTriangle][\USymbChar{37}{184}] % BLACK RIGHT-POINTING SMALL TRIANGLE - \definesymbol[WhiteRightPointingSmallTriangle][\USymbChar{37}{185}] % WHITE RIGHT-POINTING SMALL TRIANGLE - \definesymbol[BlackRightPointingPointer][\USymbChar{37}{186}] % BLACK RIGHT-POINTING POINTER - \definesymbol[WhiteRightPointingPointer][\USymbChar{37}{187}] % WHITE RIGHT-POINTING POINTER - \definesymbol[BlackDownPointingTriangle][\USymbChar{37}{188}] % BLACK DOWN-POINTING TRIANGLE - \definesymbol[WhiteDownPointingTriangle][\USymbChar{37}{189}] % WHITE DOWN-POINTING TRIANGLE - \definesymbol[BlackDownPointingSmallTriangle][\USymbChar{37}{190}] % BLACK DOWN-POINTING SMALL TRIANGLE - \definesymbol[WhiteDownPointingSmallTriangle][\USymbChar{37}{191}] % WHITE DOWN-POINTING SMALL TRIANGLE - \definesymbol[BlackLeftPointingTriangle][\USymbChar{37}{192}] % BLACK LEFT-POINTING TRIANGLE - \definesymbol[WhiteLeftPointingTriangle][\USymbChar{37}{193}] % WHITE LEFT-POINTING TRIANGLE - \definesymbol[BlackLeftPointingSmallTriangle][\USymbChar{37}{194}] % BLACK LEFT-POINTING SMALL TRIANGLE - \definesymbol[WhiteLeftPointingSmallTriangle][\USymbChar{37}{195}] % WHITE LEFT-POINTING SMALL TRIANGLE - \definesymbol[BlackLeftPointingPointer][\USymbChar{37}{196}] % BLACK LEFT-POINTING POINTER - \definesymbol[WhiteLeftPointingPointer][\USymbChar{37}{197}] % WHITE LEFT-POINTING POINTER - \definesymbol[BlackDiamond][\USymbChar{37}{198}] % BLACK DIAMOND - \definesymbol[WhiteDiamond][\USymbChar{37}{199}] % WHITE DIAMOND - \definesymbol[WhiteDiamondContainingBlackSmallDiamond][\USymbChar{37}{200}] % WHITE DIAMOND CONTAINING BLACK SMALL DIAMOND - \definesymbol[Fisheye][\USymbChar{37}{201}] % FISHEYE - \definesymbol[Lozenge][\USymbChar{37}{202}] % LOZENGE - \definesymbol[WhiteCircle][\USymbChar{37}{203}] % WHITE CIRCLE - \definesymbol[DottedCircle][\USymbChar{37}{204}] % DOTTED CIRCLE - \definesymbol[CircleWithVerticalFill][\USymbChar{37}{205}] % CIRCLE WITH VERTICAL FILL - \definesymbol[Bullseye][\USymbChar{37}{206}] % BULLSEYE - \definesymbol[BlackCircle][\USymbChar{37}{207}] % BLACK CIRCLE - \definesymbol[CircleWithLeftHalfBlack][\USymbChar{37}{208}] % CIRCLE WITH LEFT HALF BLACK - \definesymbol[CircleWithRightHalfBlack][\USymbChar{37}{209}] % CIRCLE WITH RIGHT HALF BLACK - \definesymbol[CircleWithLowerHalfBlack][\USymbChar{37}{210}] % CIRCLE WITH LOWER HALF BLACK - \definesymbol[CircleWithUpperHalfBlack][\USymbChar{37}{211}] % CIRCLE WITH UPPER HALF BLACK - \definesymbol[CircleWithUpperRightQuadrantBlack][\USymbChar{37}{212}] % CIRCLE WITH UPPER RIGHT QUADRANT BLACK - \definesymbol[CircleWithAllButUpperLeftQuadrantBlack][\USymbChar{37}{213}] % CIRCLE WITH ALL BUT UPPER LEFT QUADRANT BLACK - \definesymbol[LeftHalfBlackCircle][\USymbChar{37}{214}] % LEFT HALF BLACK CIRCLE - \definesymbol[RightHalfBlackCircle][\USymbChar{37}{215}] % RIGHT HALF BLACK CIRCLE - \definesymbol[InverseBullet][\USymbChar{37}{216}] % INVERSE BULLET - \definesymbol[InverseWhiteCircle][\USymbChar{37}{217}] % INVERSE WHITE CIRCLE - \definesymbol[UpperHalfInverseWhiteCircle][\USymbChar{37}{218}] % UPPER HALF INVERSE WHITE CIRCLE - \definesymbol[LowerHalfInverseWhiteCircle][\USymbChar{37}{219}] % LOWER HALF INVERSE WHITE CIRCLE - \definesymbol[UpperLeftQuadrantCircularArc][\USymbChar{37}{220}] % UPPER LEFT QUADRANT CIRCULAR ARC - \definesymbol[UpperRightQuadrantCircularArc][\USymbChar{37}{221}] % UPPER RIGHT QUADRANT CIRCULAR ARC - \definesymbol[LowerRightQuadrantCircularArc][\USymbChar{37}{222}] % LOWER RIGHT QUADRANT CIRCULAR ARC - \definesymbol[LowerLeftQuadrantCircularArc][\USymbChar{37}{223}] % LOWER LEFT QUADRANT CIRCULAR ARC - \definesymbol[LowerHalfCircle][\USymbChar{37}{225}] % LOWER HALF CIRCLE - \definesymbol[BlackLowerRightTriangle][\USymbChar{37}{226}] % BLACK LOWER RIGHT TRIANGLE - \definesymbol[BlackLowerLeftTriangle][\USymbChar{37}{227}] % BLACK LOWER LEFT TRIANGLE - \definesymbol[BlackUpperLeftTriangle][\USymbChar{37}{228}] % BLACK UPPER LEFT TRIANGLE - \definesymbol[BlackUpperRightTriangle][\USymbChar{37}{229}] % BLACK UPPER RIGHT TRIANGLE - \definesymbol[WhiteBullet][\USymbChar{37}{230}] % WHITE BULLET - \definesymbol[SquareWithLeftHalfBlack][\USymbChar{37}{231}] % SQUARE WITH LEFT HALF BLACK - \definesymbol[SquareWithRightHalfBlack][\USymbChar{37}{232}] % SQUARE WITH RIGHT HALF BLACK - \definesymbol[SquareWithUpperLeftDiagonalHalfBlack][\USymbChar{37}{233}] % SQUARE WITH UPPER LEFT DIAGONAL HALF BLACK - \definesymbol[SquareWithLowerRightDiagonalHalfBlack][\USymbChar{37}{234}] % SQUARE WITH LOWER RIGHT DIAGONAL HALF BLACK - \definesymbol[WhiteSquareWithVerticalBisectingLine][\USymbChar{37}{235}] % WHITE SQUARE WITH VERTICAL BISECTING LINE - \definesymbol[WhiteUpPointingTriangleWithDot][\USymbChar{37}{236}] % WHITE UP-POINTING TRIANGLE WITH DOT - \definesymbol[UpPointingTriangleWithLeftHalfBlack][\USymbChar{37}{237}] % UP-POINTING TRIANGLE WITH LEFT HALF BLACK - \definesymbol[UpPointingTriangleWithRightHalfBlack][\USymbChar{37}{238}] % UP-POINTING TRIANGLE WITH RIGHT HALF BLACK - \definesymbol[LargeCircle][\USymbChar{37}{239}] % LARGE CIRCLE - \definesymbol[UpperLeftTriangle][\USymbChar{37}{248}] % [Unassigned U+25F8] - \definesymbol[UpperRightTriangle][\USymbChar{37}{249}] % [Unassigned U+25F9] - \definesymbol[LowerLeftTriangle][\USymbChar{37}{250}] % [Unassigned U+25FA] - \definesymbol[WhiteMediumSquare][\USymbChar{37}{251}] % [Unassigned U+25FB] - \definesymbol[BlackMediumSquare][\USymbChar{37}{252}] % [Unassigned U+25FC] - \definesymbol[WhiteMediumSmallSquare][\USymbChar{37}{253}] % [Unassigned U+25FD] - \definesymbol[BlackMediumSmallSquare][\USymbChar{37}{254}] % [Unassigned U+25FE] - \definesymbol[LowerRightTriangle][\USymbChar{37}{255}] % [Unassigned U+25FF] - -\stopsymbolset - -\startsymbolset[Unicode Control Code Graphics] % 0x25A0: Requires UnicodeRegular25 - - \definesymbol[WhiteSquareWithUpperLeftQuadrant][\USymbChar{37}{240}] % WHITE SQUARE WITH UPPER LEFT QUADRANT - \definesymbol[WhiteSquareWithLowerLeftQuadrant][\USymbChar{37}{241}] % WHITE SQUARE WITH LOWER LEFT QUADRANT - \definesymbol[WhiteSquareWithLowerRightQuadrant][\USymbChar{37}{242}] % WHITE SQUARE WITH LOWER RIGHT QUADRANT - \definesymbol[WhiteSquareWithUpperRightQuadrant][\USymbChar{37}{243}] % WHITE SQUARE WITH UPPER RIGHT QUADRANT - \definesymbol[WhiteCircleWithUpperLeftQuadrant][\USymbChar{37}{244}] % WHITE CIRCLE WITH UPPER LEFT QUADRANT - \definesymbol[WhiteCircleWithLowerLeftQuadrant][\USymbChar{37}{245}] % WHITE CIRCLE WITH LOWER LEFT QUADRANT - \definesymbol[WhiteCircleWithLowerRightQuadrant][\USymbChar{37}{246}] % WHITE CIRCLE WITH LOWER RIGHT QUADRANT - \definesymbol[WhiteCircleWithUpperRightQuadrant][\USymbChar{37}{247}] % WHITE CIRCLE WITH UPPER RIGHT QUADRANT - -\stopsymbolset - -\startsymbolset[Unicode Weather and Astrological] % 0x2600: Requires UnicodeRegular26 - - \definesymbol[BlackSunWithRays][\USymbChar{38}{0}] % BLACK SUN WITH RAYS - \definesymbol[Cloud][\USymbChar{38}{1}] % CLOUD - \definesymbol[Umbrella][\USymbChar{38}{2}] % UMBRELLA - \definesymbol[Snowman][\USymbChar{38}{3}] % SNOWMAN - \definesymbol[Comet][\USymbChar{38}{4}] % COMET - \definesymbol[BlackStar][\USymbChar{38}{5}] % BLACK STAR - \definesymbol[WhiteStar][\USymbChar{38}{6}] % WHITE STAR - \definesymbol[Lightning][\USymbChar{38}{7}] % LIGHTNING - \definesymbol[Thunderstorm][\USymbChar{38}{8}] % THUNDERSTORM - \definesymbol[Sun][\USymbChar{38}{9}] % SUN - \definesymbol[AscendingNode][\USymbChar{38}{10}] % ASCENDING NODE - \definesymbol[DescendingNode][\USymbChar{38}{11}] % DESCENDING NODE - \definesymbol[Conjunction][\USymbChar{38}{12}] % CONJUNCTION - \definesymbol[Opposition][\USymbChar{38}{13}] % OPPOSITION - \definesymbol[FirstQuarterMoon][\USymbChar{38}{61}] % FIRST QUARTER MOON - \definesymbol[LastQuarterMoon][\USymbChar{38}{62}] % LAST QUARTER MOON - \definesymbol[Mercury][\USymbChar{38}{63}] % MERCURY - \definesymbol[FemaleSign][\USymbChar{38}{64}] % FEMALE SIGN - \definesymbol[Earth][\USymbChar{38}{65}] % EARTH - \definesymbol[MaleSign][\USymbChar{38}{66}] % MALE SIGN - \definesymbol[Jupiter][\USymbChar{38}{67}] % JUPITER - \definesymbol[Saturn][\USymbChar{38}{68}] % SATURN - \definesymbol[Uranus][\USymbChar{38}{69}] % URANUS - \definesymbol[Neptune][\USymbChar{38}{70}] % NEPTUNE - \definesymbol[Pluto][\USymbChar{38}{71}] % PLUTO - -\stopsymbolset - -\startsymbolset[Unicode Miscellaneous] % 0x2600: Requires UnicodeRegular26 - - \definesymbol[BlackTelephone][\USymbChar{38}{14}] % BLACK TELEPHONE - \definesymbol[WhiteTelephone][\USymbChar{38}{15}] % WHITE TELEPHONE - \definesymbol[BallotBox][\USymbChar{38}{16}] % BALLOT BOX - \definesymbol[BallotBoxWithCheck][\USymbChar{38}{17}] % BALLOT BOX WITH CHECK - \definesymbol[BallotBoxWithX][\USymbChar{38}{18}] % BALLOT BOX WITH X - \definesymbol[Saltire][\USymbChar{38}{19}] % SALTIRE - \definesymbol[ReversedRotatedFloralHeartBullet][\USymbChar{38}{25}] % REVERSED ROTATED FLORAL HEART BULLET - \definesymbol[WheelOfDharma][\USymbChar{38}{56}] % WHEEL OF DHARMA - \definesymbol[WhiteFrowningFace][\USymbChar{38}{57}] % WHITE FROWNING FACE - \definesymbol[WhiteSmilingFace][\USymbChar{38}{58}] % WHITE SMILING FACE - \definesymbol[BlackSmilingFace][\USymbChar{38}{59}] % BLACK SMILING FACE - \definesymbol[WhiteSunWithRays][\USymbChar{38}{60}] % WHITE SUN WITH RAYS - \definesymbol[HotSprings][\USymbChar{38}{104}] % HOT SPRINGS - -\stopsymbolset - -\startsymbolset[Unicode Japanese Chess] % 0x2600: Requires UnicodeRegular26 - - \definesymbol[WhiteShogiPiece][\USymbChar{38}{22}] % [Unassigned U+2616] - \definesymbol[BlackShogiPiece][\USymbChar{38}{23}] % [Unassigned U+2617] - -\stopsymbolset - -\startsymbolset[Unicode Pointing Hand] % 0x2600: Requires UnicodeRegular26 - - \definesymbol[BlackLeftPointingIndex][\USymbChar{38}{26}] % BLACK LEFT POINTING INDEX - \definesymbol[BlackRightPointingIndex][\USymbChar{38}{27}] % BLACK RIGHT POINTING INDEX - \definesymbol[WhiteLeftPointingIndex][\USymbChar{38}{28}] % WHITE LEFT POINTING INDEX - \definesymbol[WhiteUpPointingIndex][\USymbChar{38}{29}] % WHITE UP POINTING INDEX - \definesymbol[WhiteRightPointingIndex][\USymbChar{38}{30}] % WHITE RIGHT POINTING INDEX - \definesymbol[WhiteDownPointingIndex][\USymbChar{38}{31}] % WHITE DOWN POINTING INDEX - -\stopsymbolset - -\startsymbolset[Unicode Warning Signs] % 0x2600: Requires UnicodeRegular26 - - \definesymbol[SkullAndCrossbones][\USymbChar{38}{32}] % SKULL AND CROSSBONES - \definesymbol[CautionSign][\USymbChar{38}{33}] % CAUTION SIGN - \definesymbol[RadioactiveSign][\USymbChar{38}{34}] % RADIOACTIVE SIGN - \definesymbol[BiohazardSign][\USymbChar{38}{35}] % BIOHAZARD SIGN - -\stopsymbolset - -\startsymbolset[Unicode Healing Signs] % 0x2600: Requires UnicodeRegular26 - \definesymbol[Caduceus][\USymbChar{38}{36}] % CADUCEUS - \definesymbol[Ankh][\USymbChar{38}{37}] % ANKH -\stopsymbolset - -\startsymbolset[Unicode Religious and Political] % 0x2600: Requires UnicodeRegular26 and 27 - - \definesymbol[OrthodoxCross][\USymbChar{38}{38}] % ORTHODOX CROSS - \definesymbol[ChiRho][\USymbChar{38}{39}] % CHI RHO - \definesymbol[CrossOfLorraine][\USymbChar{38}{40}] % CROSS OF LORRAINE - \definesymbol[CrossOfJerusalem][\USymbChar{38}{41}] % CROSS OF JERUSALEM - \definesymbol[StarAndCrescent][\USymbChar{38}{42}] % STAR AND CRESCENT - \definesymbol[FarsiSymbol][\USymbChar{38}{43}] % FARSI SYMBOL - \definesymbol[AdiShakti][\USymbChar{38}{44}] % ADI SHAKTI - \definesymbol[HammerAndSickle][\USymbChar{38}{45}] % HAMMER AND SICKLE - \definesymbol[PeaceSymbol][\USymbChar{38}{46}] % PEACE SYMBOL - \definesymbol[YinYang][\USymbChar{38}{47}] % YIN YANG - \definesymbol[WestSyriacCross][\USymbChar{38}{112}] % WEST SYRIAC CROSS - \definesymbol[EastSyriacCross][\USymbChar{38}{113}] % EAST SYRIAC CROSS -% 27xx starts here - \definesymbol[OutlinedGreekCross][\USymbCharZapf{39}{25}] % OUTLINED GREEK CROSS - \definesymbol[HeavyGreekCross][\USymbCharZapf{39}{26}] % HEAVY GREEK CROSS - \definesymbol[OpenCentreCross][\USymbCharZapf{39}{27}] % OPEN CENTRE CROSS - \definesymbol[HeavyOpenCentreCross][\USymbCharZapf{39}{28}] % HEAVY OPEN CENTRE CROSS - \definesymbol[LatinCross][\USymbCharZapf{39}{29}] % LATIN CROSS - \definesymbol[ShadowedWhiteLatinCross][\USymbCharZapf{39}{30}] % SHADOWED WHITE LATIN CROSS - \definesymbol[OutlinedLatinCross][\USymbCharZapf{39}{31}] % OUTLINED LATIN CROSS - \definesymbol[MalteseCross][\USymbCharZapf{39}{32}] % MALTESE CROSS - \definesymbol[StarOfDavid][\USymbCharZapf{39}{33}] % STAR OF DAVID - - -\stopsymbolset - -\startsymbolset[Unicode Trigram] % 0x2600: Requires UnicodeRegular26 - - \definesymbol[TrigramForHeaven][\USymbChar{38}{48}] % TRIGRAM FOR HEAVEN - \definesymbol[TrigramForLake][\USymbChar{38}{49}] % TRIGRAM FOR LAKE - \definesymbol[TrigramForFire][\USymbChar{38}{50}] % TRIGRAM FOR FIRE - \definesymbol[TrigramForThunder][\USymbChar{38}{51}] % TRIGRAM FOR THUNDER - \definesymbol[TrigramForWind][\USymbChar{38}{52}] % TRIGRAM FOR WIND - \definesymbol[TrigramForWater][\USymbChar{38}{53}] % TRIGRAM FOR WATER - \definesymbol[TrigramForMountain][\USymbChar{38}{54}] % TRIGRAM FOR MOUNTAIN - \definesymbol[TrigramForEarth][\USymbChar{38}{55}] % TRIGRAM FOR EARTH - -\stopsymbolset - -\startsymbolset[Unicode Zodiac] % 0x2600: Requires UnicodeRegular26 - - \definesymbol[Aries][\USymbChar{38}{72}] % ARIES - \definesymbol[Taurus][\USymbChar{38}{73}] % TAURUS - \definesymbol[Gemini][\USymbChar{38}{74}] % GEMINI - \definesymbol[Cancer][\USymbChar{38}{75}] % CANCER - \definesymbol[Leo][\USymbChar{38}{76}] % LEO - \definesymbol[Virgo][\USymbChar{38}{77}] % VIRGO - \definesymbol[Libra][\USymbChar{38}{78}] % LIBRA - \definesymbol[Scorpius][\USymbChar{38}{79}] % SCORPIUS - \definesymbol[Sagittarius][\USymbChar{38}{80}] % SAGITTARIUS - \definesymbol[Capricorn][\USymbChar{38}{81}] % CAPRICORN - \definesymbol[Aquarius][\USymbChar{38}{82}] % AQUARIUS - \definesymbol[Pisces][\USymbChar{38}{83}] % PISCES - -\stopsymbolset - -\startsymbolset[Unicode Chess] % 0x2600: Requires UnicodeRegular26 - - \definesymbol[WhiteChessKing][\USymbChar{38}{84}] % WHITE CHESS KING - \definesymbol[WhiteChessQueen][\USymbChar{38}{85}] % WHITE CHESS QUEEN - \definesymbol[WhiteChessRook][\USymbChar{38}{86}] % WHITE CHESS ROOK - \definesymbol[WhiteChessBishop][\USymbChar{38}{87}] % WHITE CHESS BISHOP - \definesymbol[WhiteChessKnight][\USymbChar{38}{88}] % WHITE CHESS KNIGHT - \definesymbol[WhiteChessPawn][\USymbChar{38}{89}] % WHITE CHESS PAWN - \definesymbol[BlackChessKing][\USymbChar{38}{90}] % BLACK CHESS KING - \definesymbol[BlackChessQueen][\USymbChar{38}{91}] % BLACK CHESS QUEEN - \definesymbol[BlackChessRook][\USymbChar{38}{92}] % BLACK CHESS ROOK - \definesymbol[BlackChessBishop][\USymbChar{38}{93}] % BLACK CHESS BISHOP - \definesymbol[BlackChessKnight][\USymbChar{38}{94}] % BLACK CHESS KNIGHT - \definesymbol[BlackChessPawn][\USymbChar{38}{95}] % BLACK CHESS PAWN - -\stopsymbolset - -\startsymbolset[Unicode Playing Card] % 0x2600: Requires UnicodeRegular26 - - \definesymbol[BlackSpadeSuit][\USymbChar{38}{96}] % BLACK SPADE SUIT - \definesymbol[WhiteHeartSuit][\USymbChar{38}{97}] % WHITE HEART SUIT - \definesymbol[WhiteDiamondSuit][\USymbChar{38}{98}] % WHITE DIAMOND SUIT - \definesymbol[BlackClubSuit][\USymbChar{38}{99}] % BLACK CLUB SUIT - \definesymbol[WhiteSpadeSuit][\USymbChar{38}{100}] % WHITE SPADE SUIT - \definesymbol[BlackHeartSuit][\USymbChar{38}{101}] % BLACK HEART SUIT - \definesymbol[BlackDiamondSuit][\USymbChar{38}{102}] % BLACK DIAMOND SUIT - \definesymbol[WhiteClubSuit][\USymbChar{38}{103}] % WHITE CLUB SUIT - -\stopsymbolset - -\startsymbolset[Unicode Musical] % 0x2600: Requires UnicodeRegular26 - - \definesymbol[QuarterNote][\USymbChar{38}{105}] % QUARTER NOTE - \definesymbol[EighthNote][\USymbChar{38}{106}] % EIGHTH NOTE - \definesymbol[BeamedEighthNotes][\USymbChar{38}{107}] % BEAMED EIGHTH NOTES - \definesymbol[BeamedSixteenthNotes][\USymbChar{38}{108}] % BEAMED SIXTEENTH NOTES - \definesymbol[MusicFlatSign][\USymbChar{38}{109}] % MUSIC FLAT SIGN - \definesymbol[MusicNaturalSign][\USymbChar{38}{110}] % MUSIC NATURAL SIGN - \definesymbol[MusicSharpSign][\USymbChar{38}{111}] % MUSIC SHARP SIGN - -\stopsymbolset - -\startsymbolset[Unicode Recycling] % 0x2600: Requires UnicodeRegular26 - - \definesymbol[UniversalRecycling][\USymbChar{38}{114}] % [Unassigned U+2672] - \definesymbol[Type1Plastics][\USymbChar{38}{115}] % [Unassigned U+2673] - \definesymbol[Type2Plastics][\USymbChar{38}{116}] % [Unassigned U+2674] - \definesymbol[Type3Plastics][\USymbChar{38}{117}] % [Unassigned U+2675] - \definesymbol[Type4Plastics][\USymbChar{38}{118}] % [Unassigned U+2676] - \definesymbol[Type5Plastics][\USymbChar{38}{119}] % [Unassigned U+2677] - \definesymbol[Type6Plastics][\USymbChar{38}{120}] % [Unassigned U+2678] - \definesymbol[Type7Plastics][\USymbChar{38}{121}] % [Unassigned U+2679] - \definesymbol[GenericMaterials][\USymbChar{38}{122}] % [Unassigned U+267A] - \definesymbol[BlackUniversalRecycling][\USymbChar{38}{123}] % [Unassigned U+267B] - \definesymbol[RecycledPaper][\USymbChar{38}{124}] % [Unassigned U+267C] - \definesymbol[PartiallyRecycledPaper][\USymbChar{38}{125}] % [Unassigned U+267D] - -\stopsymbolset - -\startsymbolset[Unicode Dice] % 0x2600: Requires UnicodeRegular26 - - \definesymbol[DieFace1][\USymbChar{38}{128}] % [Unassigned U+2680] - \definesymbol[DieFace2][\USymbChar{38}{129}] % [Unassigned U+2681] - \definesymbol[DieFace3][\USymbChar{38}{130}] % [Unassigned U+2682] - \definesymbol[DieFace4][\USymbChar{38}{131}] % [Unassigned U+2683] - \definesymbol[DieFace5][\USymbChar{38}{132}] % [Unassigned U+2684] - \definesymbol[DieFace6][\USymbChar{38}{133}] % [Unassigned U+2685] - -\stopsymbolset - -\startsymbolset[Unicode Go Markers] % 0x2600: Requires UnicodeRegular26 - - \definesymbol[WhiteCircleWithDotRight][\USymbChar{38}{134}] % [Unassigned U+2686] - \definesymbol[WhiteCircleWithTwoDots][\USymbChar{38}{135}] % [Unassigned U+2687] - \definesymbol[BlackCircleWithWhiteDotRight][\USymbChar{38}{136}] % [Unassigned U+2688] - \definesymbol[BlackCircleWithTwoWhiteDots][\USymbChar{38}{137}] % [Unassigned U+2689] - -\stopsymbolset - -\startsymbolset[Unicode Scissors] % 0x2700: Requires UnicodeRegular27 - - \definesymbol[UpperBladeScissors][\USymbCharZapf{39}{1}] % UPPER BLADE SCISSORS - \definesymbol[BlackScissors][\USymbCharZapf{39}{2}] % BLACK SCISSORS - \definesymbol[LowerBladeScissors][\USymbCharZapf{39}{3}] % LOWER BLADE SCISSORS - \definesymbol[WhiteScissors][\USymbCharZapf{39}{4}] % WHITE SCISSORS - -\stopsymbolset - -\startsymbolset[Unicode Dingbats] % 0x2700: Requires UnicodeRegular27 - - \definesymbol[TelephoneLocationSign][\USymbCharZapf{39}{6}] % TELEPHONE LOCATION SIGN - \definesymbol[TapeDrive][\USymbCharZapf{39}{7}] % TAPE DRIVE - \definesymbol[Airplane][\USymbCharZapf{39}{8}] % AIRPLANE - \definesymbol[Envelope][\USymbCharZapf{39}{9}] % ENVELOPE - \definesymbol[VictoryHand][\USymbCharZapf{39}{12}] % VICTORY HAND - \definesymbol[WritingHand][\USymbCharZapf{39}{13}] % WRITING HAND - \definesymbol[LowerRightPencil][\USymbCharZapf{39}{14}] % LOWER RIGHT PENCIL - \definesymbol[Pencil][\USymbCharZapf{39}{15}] % PENCIL - \definesymbol[UpperRightPencil][\USymbCharZapf{39}{16}] % UPPER RIGHT PENCIL - \definesymbol[WhiteNib][\USymbCharZapf{39}{17}] % WHITE NIB - \definesymbol[BlackNib][\USymbCharZapf{39}{18}] % BLACK NIB - \definesymbol[BlackDiamondMinusWhiteX][\USymbCharZapf{39}{86}] % BLACK DIAMOND MINUS WHITE X - -\stopsymbolset - -\startsymbolset[Unicode Checks and Xs] % 0x2700: Requires UnicodeRegular27 - - \definesymbol[CheckMark][\USymbCharZapf{39}{19}] % CHECK MARK - \definesymbol[HeavyCheckMark][\USymbCharZapf{39}{20}] % HEAVY CHECK MARK - \definesymbol[MultiplicationX][\USymbCharZapf{39}{21}] % MULTIPLICATION X - \definesymbol[HeavyMultiplicationX][\USymbCharZapf{39}{22}] % HEAVY MULTIPLICATION X - \definesymbol[BallotX][\USymbCharZapf{39}{23}] % BALLOT X - \definesymbol[HeavyBallotX][\USymbCharZapf{39}{24}] % HEAVY BALLOT X - -\stopsymbolset - -\startsymbolset[Unicode Stars] % 0x2700: Requires UnicodeRegular27 - - \definesymbol[FourTeardropSpokedAsterisk][\USymbCharZapf{39}{34}] % FOUR TEARDROP-SPOKED ASTERISK - \definesymbol[FourBalloonSpokedAsterisk][\USymbCharZapf{39}{35}] % FOUR BALLOON-SPOKED ASTERISK - \definesymbol[HeavyFourBalloonSpokedAsterisk][\USymbCharZapf{39}{36}] % HEAVY FOUR BALLOON-SPOKED ASTERISK - \definesymbol[FourClubSpokedAsterisk][\USymbCharZapf{39}{37}] % FOUR CLUB-SPOKED ASTERISK - \definesymbol[BlackFourPointedStar][\USymbCharZapf{39}{38}] % BLACK FOUR POINTED STAR - \definesymbol[WhiteFourPointedStar][\USymbCharZapf{39}{39}] % WHITE FOUR POINTED STAR - \definesymbol[StressOutlinedWhiteStar][\USymbCharZapf{39}{41}] % STRESS OUTLINED WHITE STAR - \definesymbol[CircledWhiteStar][\USymbCharZapf{39}{42}] % CIRCLED WHITE STAR - \definesymbol[OpenCentreBlackStar][\USymbCharZapf{39}{43}] % OPEN CENTRE BLACK STAR - \definesymbol[BlackCentreWhiteStar][\USymbCharZapf{39}{44}] % BLACK CENTRE WHITE STAR - \definesymbol[OutlinedBlackStar][\USymbCharZapf{39}{45}] % OUTLINED BLACK STAR - \definesymbol[HeavyOutlinedBlackStar][\USymbCharZapf{39}{46}] % HEAVY OUTLINED BLACK STAR - \definesymbol[PinwheelStar][\USymbCharZapf{39}{47}] % PINWHEEL STAR - \definesymbol[ShadowedWhiteStar][\USymbCharZapf{39}{48}] % SHADOWED WHITE STAR - \definesymbol[HeavyAsterisk][\USymbCharZapf{39}{49}] % HEAVY ASTERISK - \definesymbol[OpenCentreAsterisk][\USymbCharZapf{39}{50}] % OPEN CENTRE ASTERISK - \definesymbol[EightSpokedAsterisk][\USymbCharZapf{39}{51}] % EIGHT SPOKED ASTERISK - \definesymbol[EightPointedBlackStar][\USymbCharZapf{39}{52}] % EIGHT POINTED BLACK STAR - \definesymbol[EightPointedPinwheelStar][\USymbCharZapf{39}{53}] % EIGHT POINTED PINWHEEL STAR - \definesymbol[SixPointedBlackStar][\USymbCharZapf{39}{54}] % SIX POINTED BLACK STAR - \definesymbol[EightPointedRectilinearBlackStar][\USymbCharZapf{39}{55}] % EIGHT POINTED RECTILINEAR BLACK STAR - \definesymbol[HeavyEightPointedRectilinearBlackStar][\USymbCharZapf{39}{56}] % HEAVY EIGHT POINTED RECTILINEAR BLACK STAR - \definesymbol[TwelvePointedBlackStar][\USymbCharZapf{39}{57}] % TWELVE POINTED BLACK STAR - \definesymbol[SixteenPointedAsterisk][\USymbCharZapf{39}{58}] % SIXTEEN POINTED ASTERISK - \definesymbol[TeardropSpokedAsterisk][\USymbCharZapf{39}{59}] % TEARDROP-SPOKED ASTERISK - \definesymbol[OpenCentreTeardropSpokedAsterisk][\USymbCharZapf{39}{60}] % OPEN CENTRE TEARDROP-SPOKED ASTERISK - \definesymbol[HeavyTeardropSpokedAsterisk][\USymbCharZapf{39}{61}] % HEAVY TEARDROP-SPOKED ASTERISK - \definesymbol[SixPetalledBlackAndWhiteFlorette][\USymbCharZapf{39}{62}] % SIX PETALLED BLACK AND WHITE FLORETTE - \definesymbol[BlackFlorette][\USymbCharZapf{39}{63}] % BLACK FLORETTE - \definesymbol[WhiteFlorette][\USymbCharZapf{39}{64}] % WHITE FLORETTE - \definesymbol[EightPetalledOutlinedBlackFlorette][\USymbCharZapf{39}{65}] % EIGHT PETALLED OUTLINED BLACK FLORETTE - \definesymbol[CircledOpenCentreEightPointedStar][\USymbCharZapf{39}{66}] % CIRCLED OPEN CENTRE EIGHT POINTED STAR - \definesymbol[HeavyTeardropSpokedPinwheelAsterisk][\USymbCharZapf{39}{67}] % HEAVY TEARDROP-SPOKED PINWHEEL ASTERISK - \definesymbol[Sparkle][\USymbCharZapf{39}{71}] % SPARKLE - \definesymbol[HeavySparkle][\USymbCharZapf{39}{72}] % HEAVY SPARKLE - \definesymbol[Balloon-spokedAsterisk][\USymbCharZapf{39}{73}] % BALLOON-SPOKED ASTERISK - \definesymbol[EightTeardrop-spokedPropellerAsterisk][\USymbCharZapf{39}{74}] % EIGHT TEARDROP-SPOKED PROPELLER ASTERISK - \definesymbol[HeavyEightTeardrop-spokedPropellerAsterisk][\USymbCharZapf{39}{75}] % HEAVY EIGHT TEARDROP-SPOKED PROPELLER ASTERISK - -\stopsymbolset - -\startsymbolset[Unicode Snowflakes] % 0x2700: Requires UnicodeRegular27 - - \definesymbol[Snowflake][\USymbCharZapf{39}{68}] % SNOWFLAKE - \definesymbol[TightTrifoliateSnowflake][\USymbCharZapf{39}{69}] % TIGHT TRIFOLIATE SNOWFLAKE - \definesymbol[HeavyChevronSnowflake][\USymbCharZapf{39}{70}] % HEAVY CHEVRON SNOWFLAKE - -\stopsymbolset - -\startsymbolset[Unicode Shadowed Shapes] % 0x2700: Requires UnicodeRegular27 - - \definesymbol[ShadowedWhiteCircle][\USymbCharZapf{39}{77}] % SHADOWED WHITE CIRCLE - \definesymbol[LowerRightDrop-shadowedWhiteSquare][\USymbCharZapf{39}{79}] % LOWER RIGHT DROP-SHADOWED WHITE SQUARE - \definesymbol[UpperRightDrop-shadowedWhiteSquare][\USymbCharZapf{39}{80}] % UPPER RIGHT DROP-SHADOWED WHITE SQUARE - \definesymbol[LowerRightShadowedWhiteSquare][\USymbCharZapf{39}{81}] % LOWER RIGHT SHADOWED WHITE SQUARE - \definesymbol[UpperRightShadowedWhiteSquare][\USymbCharZapf{39}{82}] % UPPER RIGHT SHADOWED WHITE SQUARE - -\stopsymbolset - -\startsymbolset[Unicode Bars] % 0x2700: Requires UnicodeRegular27 - - \definesymbol[LightVerticalBar][\USymbCharZapf{39}{88}] % LIGHT VERTICAL BAR - \definesymbol[MediumVerticalBar][\USymbCharZapf{39}{89}] % MEDIUM VERTICAL BAR - \definesymbol[HeavyVerticalBar][\USymbCharZapf{39}{90}] % HEAVY VERTICAL BAR - -\stopsymbolset - -\startsymbolset[Unicode Dingbat Punctuation] % 0x2700: Requires UnicodeRegular27 - - \definesymbol[HeavySingleTurnedCommaQuotationMark][\USymbCharZapf{39}{91}] % HEAVY SINGLE TURNED COMMA QUOTATION MARK ORNAMENT - \definesymbol[HeavySingleCommaQuotationMark][\USymbCharZapf{39}{92}] % HEAVY SINGLE COMMA QUOTATION MARK ORNAMENT - \definesymbol[HeavyDoubleTurnedCommaQuotationMark][\USymbCharZapf{39}{93}] % HEAVY DOUBLE TURNED COMMA QUOTATION MARK ORNAMENT - \definesymbol[HeavyDoubleCommaQuotationMark][\USymbCharZapf{39}{94}] % HEAVY DOUBLE COMMA QUOTATION MARK ORNAMENT - \definesymbol[CurvedStemParagraphSign][\USymbCharZapf{39}{97}] % CURVED STEM PARAGRAPH SIGN ORNAMENT - \definesymbol[HeavyExclamationMark][\USymbCharZapf{39}{98}] % HEAVY EXCLAMATION MARK ORNAMENT - \definesymbol[HeavyHeartExclamationMark][\USymbCharZapf{39}{99}] % HEAVY HEART EXCLAMATION MARK ORNAMENT - -\stopsymbolset - -\startsymbolset[Unicode Hearts] % 0x2700: Requires UnicodeRegular27 - - \definesymbol[HeavyBlackHeart][\USymbCharZapf{39}{100}] % HEAVY BLACK HEART - \definesymbol[RotatedHeavyBlackHeartBullet][\USymbCharZapf{39}{101}] % ROTATED HEAVY BLACK HEART BULLET - \definesymbol[FloralHeart][\USymbCharZapf{39}{102}] % FLORAL HEART - \definesymbol[RotatedFloralHeartBullet][\USymbCharZapf{39}{103}] % ROTATED FLORAL HEART BULLET - -\stopsymbolset - -\startsymbolset[Unicode Negative Circled Digits] % 0x2700: Requires UnicodeRegular27 - - \definesymbol[CircledOne][\USymbCharZapf{39}{118}] % DINGBAT NEGATIVE CIRCLED DIGIT ONE - \definesymbol[CircledTwo][\USymbCharZapf{39}{119}] % DINGBAT NEGATIVE CIRCLED DIGIT TWO - \definesymbol[CircledThree][\USymbCharZapf{39}{120}] % DINGBAT NEGATIVE CIRCLED DIGIT THREE - \definesymbol[CircledFour][\USymbCharZapf{39}{121}] % DINGBAT NEGATIVE CIRCLED DIGIT FOUR - \definesymbol[CircledFive][\USymbCharZapf{39}{122}] % DINGBAT NEGATIVE CIRCLED DIGIT FIVE - \definesymbol[CircledSix][\USymbCharZapf{39}{123}] % DINGBAT NEGATIVE CIRCLED DIGIT SIX - \definesymbol[CircledSeven][\USymbCharZapf{39}{124}] % DINGBAT NEGATIVE CIRCLED DIGIT SEVEN - \definesymbol[CircledEight][\USymbCharZapf{39}{125}] % DINGBAT NEGATIVE CIRCLED DIGIT EIGHT - \definesymbol[CircledNine][\USymbCharZapf{39}{126}] % DINGBAT NEGATIVE CIRCLED DIGIT NINE - \definesymbol[CircledTen][\USymbCharZapf{39}{127}] % DINGBAT NEGATIVE CIRCLED NUMBER TEN - -\stopsymbolset - -\startsymbolset[Unicode Circled Sans-serif Digits] % 0x2700: Requires UnicodeRegular27 - - \definesymbol[CircledOne][\USymbCharZapf{39}{128}] % DINGBAT CIRCLED SANS-SERIF DIGIT ONE - \definesymbol[CircledTwo][\USymbCharZapf{39}{129}] % DINGBAT CIRCLED SANS-SERIF DIGIT TWO - \definesymbol[CircledThree][\USymbCharZapf{39}{130}] % DINGBAT CIRCLED SANS-SERIF DIGIT THREE - \definesymbol[CircledFour][\USymbCharZapf{39}{131}] % DINGBAT CIRCLED SANS-SERIF DIGIT FOUR - \definesymbol[CircledFive][\USymbCharZapf{39}{132}] % DINGBAT CIRCLED SANS-SERIF DIGIT FIVE - \definesymbol[CircledSix][\USymbCharZapf{39}{133}] % DINGBAT CIRCLED SANS-SERIF DIGIT SIX - \definesymbol[CircledSeven][\USymbCharZapf{39}{134}] % DINGBAT CIRCLED SANS-SERIF DIGIT SEVEN - \definesymbol[CircledEight][\USymbCharZapf{39}{135}] % DINGBAT CIRCLED SANS-SERIF DIGIT EIGHT - \definesymbol[CircledNine][\USymbCharZapf{39}{136}] % DINGBAT CIRCLED SANS-SERIF DIGIT NINE - \definesymbol[CircledTen][\USymbCharZapf{39}{137}] % DINGBAT CIRCLED SANS-SERIF NUMBER TEN - -\stopsymbolset - -\startsymbolset[Unicode Negative Circled Sans-serif Digits] % 0x2700: Requires UnicodeRegular27 - - \definesymbol[CircledOne][\USymbCharZapf{39}{138}] % DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE - \definesymbol[CircledTwo][\USymbCharZapf{39}{139}] % DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT TWO - \definesymbol[CircledThree][\USymbCharZapf{39}{140}] % DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT THREE - \definesymbol[CircledFour][\USymbCharZapf{39}{141}] % DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT FOUR - \definesymbol[CircledFive][\USymbCharZapf{39}{142}] % DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT FIVE - \definesymbol[CircledSix][\USymbCharZapf{39}{143}] % DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT SIX - \definesymbol[CircledSeven][\USymbCharZapf{39}{144}] % DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT SEVEN - \definesymbol[CircledEight][\USymbCharZapf{39}{145}] % DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT EIGHT - \definesymbol[CircledNine][\USymbCharZapf{39}{146}] % DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT NINE - \definesymbol[CircledTen][\USymbCharZapf{39}{147}] % DINGBAT NEGATIVE CIRCLED SANS-SERIF NUMBER TEN - -\stopsymbolset - -\startsymbolset[Unicode Dingbat Arrows] % 0x2700: Requires UnicodeRegular27 - - \definesymbol[HeavyWideHeadedRightwardsArrow][\USymbCharZapf{39}{148}] % HEAVY WIDE-HEADED RIGHTWARDS ARROW - \definesymbol[HeavySouthEastArrow][\USymbCharZapf{39}{152}] % HEAVY SOUTH EAST ARROW - \definesymbol[HeavyRightwardsArrow][\USymbCharZapf{39}{153}] % HEAVY RIGHTWARDS ARROW - \definesymbol[HeavyNorthEastArrow][\USymbCharZapf{39}{154}] % HEAVY NORTH EAST ARROW - \definesymbol[DraftingPointRightwardsArrow][\USymbCharZapf{39}{155}] % DRAFTING POINT RIGHTWARDS ARROW - \definesymbol[HeavyRoundTippedRightwardsArrow][\USymbCharZapf{39}{156}] % HEAVY ROUND-TIPPED RIGHTWARDS ARROW - \definesymbol[TriangleHeadedRightwardsArrow][\USymbCharZapf{39}{157}] % TRIANGLE-HEADED RIGHTWARDS ARROW - \definesymbol[HeavyTriangleHeadedRightwardsArrow][\USymbCharZapf{39}{158}] % HEAVY TRIANGLE-HEADED RIGHTWARDS ARROW - \definesymbol[DashedTriangleHeadedRightwardsArrow][\USymbCharZapf{39}{159}] % DASHED TRIANGLE-HEADED RIGHTWARDS ARROW - \definesymbol[HeavyDashedTriangleHeadedRightwardsArrow][\USymbCharZapf{39}{160}] % HEAVY DASHED TRIANGLE-HEADED RIGHTWARDS ARROW - \definesymbol[BlackRightwardsArrow][\USymbCharZapf{39}{161}] % BLACK RIGHTWARDS ARROW - \definesymbol[3DTopLightedRightwardsArrowhead][\USymbCharZapf{39}{162}] % THREE-D TOP-LIGHTED RIGHTWARDS ARROWHEAD - \definesymbol[3DBottomLightedRightwardsArrowhead][\USymbCharZapf{39}{163}] % THREE-D BOTTOM-LIGHTED RIGHTWARDS ARROWHEAD - \definesymbol[BlackRightwardsArrowhead][\USymbCharZapf{39}{164}] % BLACK RIGHTWARDS ARROWHEAD - \definesymbol[HeavyBlackCurvedDownwardsAndRightwardsArrow][\USymbCharZapf{39}{165}] % HEAVY BLACK CURVED DOWNWARDS AND RIGHTWARDS ARROW - \definesymbol[HeavyBlackCurvedUpwardsAndRightwardsArrow][\USymbCharZapf{39}{166}] % HEAVY BLACK CURVED UPWARDS AND RIGHTWARDS ARROW - \definesymbol[SquatBlackRightwardsArrow][\USymbCharZapf{39}{167}] % SQUAT BLACK RIGHTWARDS ARROW - \definesymbol[HeavyConcavePointedBlackRightwardsArrow][\USymbCharZapf{39}{168}] % HEAVY CONCAVE-POINTED BLACK RIGHTWARDS ARROW - \definesymbol[CircledHeavyWhiteRightwardsArrow][\USymbCharZapf{39}{178}] % CIRCLED HEAVY WHITE RIGHTWARDS ARROW - \definesymbol[OpenOutlinedRightwardsArrow][\USymbCharZapf{39}{190}] % OPEN-OUTLINED RIGHTWARDS ARROW - -\stopsymbolset - -\startsymbolset[Unicode Shadowed Arrows] % 0x2700: Requires UnicodeRegular27 - - \definesymbol[RightShadedWhiteRightwardsArrow][\USymbCharZapf{39}{169}] % RIGHT-SHADED WHITE RIGHTWARDS ARROW - \definesymbol[LeftShadedWhiteRightwardsArrow][\USymbCharZapf{39}{170}] % LEFT-SHADED WHITE RIGHTWARDS ARROW - \definesymbol[BackTiltedShadowedWhiteRightwardsArrow][\USymbCharZapf{39}{171}] % BACK-TILTED SHADOWED WHITE RIGHTWARDS ARROW - \definesymbol[FrontTiltedShadowedWhiteRightwardsArrow][\USymbCharZapf{39}{172}] % FRONT-TILTED SHADOWED WHITE RIGHTWARDS ARROW - \definesymbol[HeavyLowerRightShadowedWhiteRightwardsArrow][\USymbCharZapf{39}{173}] % HEAVY LOWER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW - \definesymbol[HeavyUpperRightShadowedWhiteRightwardsArrow][\USymbCharZapf{39}{174}] % HEAVY UPPER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW - \definesymbol[NotchedLowerRightShadowedWhiteRightwardsArrow][\USymbCharZapf{39}{175}] % NOTCHED LOWER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW - \definesymbol[NotchedUpperRightShadowedWhiteRightwardsArrow][\USymbCharZapf{39}{177}] % NOTCHED UPPER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW - -\stopsymbolset - -\startsymbolset[Unicode Tailed Arrows] % 0x2700: Requires UnicodeRegular27 - - \definesymbol[WhiteFeatheredRightwardsArrow][\USymbCharZapf{39}{179}] % WHITE-FEATHERED RIGHTWARDS ARROW - \definesymbol[BlackFeatheredSouthEastArrow][\USymbCharZapf{39}{180}] % BLACK-FEATHERED SOUTH EAST ARROW - \definesymbol[BlackFeatheredRightwardsArrow][\USymbCharZapf{39}{181}] % BLACK-FEATHERED RIGHTWARDS ARROW - \definesymbol[BlackFeatheredNorthEastArrow][\USymbCharZapf{39}{182}] % BLACK-FEATHERED NORTH EAST ARROW - \definesymbol[HeavyBlack-featheredSouthEastArrow][\USymbCharZapf{39}{183}] % HEAVY BLACK-FEATHERED SOUTH EAST ARROW - \definesymbol[HeavyBlackFeatheredRightwardsArrow][\USymbCharZapf{39}{184}] % HEAVY BLACK-FEATHERED RIGHTWARDS ARROW - \definesymbol[HeavyBlackFeatheredNorthEastArrow][\USymbCharZapf{39}{185}] % HEAVY BLACK-FEATHERED NORTH EAST ARROW - \definesymbol[TeardropBarbedRightwardsArrow][\USymbCharZapf{39}{186}] % TEARDROP-BARBED RIGHTWARDS ARROW - \definesymbol[HeavyTeardropShankedRightwardsArrow][\USymbCharZapf{39}{187}] % HEAVY TEARDROP-SHANKED RIGHTWARDS ARROW - \definesymbol[WedgeTailedRightwardsArrow][\USymbCharZapf{39}{188}] % WEDGE-TAILED RIGHTWARDS ARROW - \definesymbol[HeavyWedgeTailedRightwardsArrow][\USymbCharZapf{39}{189}] % HEAVY WEDGE-TAILED RIGHTWARDS ARROW - -\stopsymbolset - -\endinput diff --git a/Master/texmf-dist/tex/context/base/symb-was.mkii b/Master/texmf-dist/tex/context/base/symb-was.mkii new file mode 100644 index 00000000000..53132cd23ff --- /dev/null +++ b/Master/texmf-dist/tex/context/base/symb-was.mkii @@ -0,0 +1,207 @@ +%D \module +%D [ file=symb-was, +%D version=2005.10.15, +%D title=\CONTEXT\ Symbol Libraries, +%D subtitle=Roland Waldi's Symbols (wasy-2), +%D author=Henning Hraban Ramm, +%D date=\currentdate, +%D copyright={public domain}] +%C +%C This module is in the public domain. + +%D This module implements the Roland Waldi Symbole font +%D (wasy). The names are derived from the \LATEX\ package +%D \type {wasysym} by Axel Kielhorn. The symbols are +%D available as Type~1 font and are included in \TEX\ distributions. +%D +%D This symbol font offers basic sets of astronomical, astrological, +%D geometrical, musical and general symbols, plus those needed +%D for the APL programming language and some more. +%D This module leaves out most of the math stuff, such as operators +%D and integrals. +%D +%D The font was designed by Robert Waldi and is in the public domain. +%D The PS Type 1 fonts are by Taco Hoekwater, \hyphenatedurl +%D {taco.hoekwater@wkap.nl}, and also in the public domain. +%D The wasysym \LATEX\ package is (c) Axel Kielhorn, \hyphenatedurl +%D {A.Kielhorn@web.de}, under the LaTeX Project Public License. +%D This stuff lives in \hyphenatedurl {http://dante.ctan.org/CTAN/fonts/wasy2/}. +%D +%D This \CONTEXT\ module is by Henning Hraban Ramm, \hyphenatedurl +%D {hraban@fiee.net}, given to the public domain as far as allowed +%D (some parts are copied from the \LATEX\ package). + +%D Slightly patched by HH. + +\loadmapfile[original-wasy.map] + +\unprotect + +% there are also fonts for 6, 7, 8, 9 pt; how can we access these automatically? +% how about the bold wasy font? + +\definefontsynonym [WaldiSymbol] [wasy10] +\definefontsynonym [WaldiSymbolBold] [wasyb10] + +\def\WaldiSymbol#1{\getglyph{WaldiSymbol}{\char#1}} + +\def\wasy@over#1#2{{\setbox0\hbox{$#2$}\hbox to \wd0{\hss$#1$\hss}\kern-\wd0\box0}} + +% general symbols + +\startsymbolset [wasy general] + \definesymbol [male] [\WaldiSymbol {26}] + \definesymbol [female] [\WaldiSymbol {25}] + \definesymbol [currency] [\WaldiSymbol {27}] + \definesymbol [cent] [\WaldiSymbol{103}] + \definesymbol [lozenge] [\WaldiSymbol {53}] + \definesymbol [kreuz] [\WaldiSymbol {54}] + \definesymbol [smiley] [\WaldiSymbol {44}] + \definesymbol [blacksmiley] [\WaldiSymbol {45}] + \definesymbol [frownie] [\WaldiSymbol {47}] + \definesymbol [sun] [\WaldiSymbol {46}] + \definesymbol [checked] [\WaldiSymbol {8}] + \definesymbol [brokenvert] [\WaldiSymbol{124}] + \definesymbol [diameter] [\WaldiSymbol {31}] + \definesymbol [invdiameter] [\WaldiSymbol {21}] + \definesymbol [phone] [\WaldiSymbol {7}] + \definesymbol [recorder] [\WaldiSymbol {6}] + \definesymbol [clock] [\WaldiSymbol {28}] + \definesymbol [permil] [\WaldiSymbol{104}] + \definesymbol [bell] [\WaldiSymbol {10}] + \definesymbol [ataribox] [\WaldiSymbol{109}] + \definesymbol [pointer] [\WaldiSymbol {9}] + \definesymbol [lightning] [\WaldiSymbol {18}] + \definesymbol [agemO] [\WaldiSymbol {48}] +\stopsymbolset + +\startsymbolset [wasy music] + \definesymbol [eighthnote] [\WaldiSymbol{11}] + \definesymbol [quarternote] [\WaldiSymbol{12}] + \definesymbol [halfnote] [\WaldiSymbol{13}] + \definesymbol [fullnote] [\WaldiSymbol{14}] + \definesymbol [twonotes] [\WaldiSymbol{15}] +\stopsymbolset + +\startsymbolset [wasy astronomy] + \definesymbol [ascnode] [\WaldiSymbol{19}] + \definesymbol [descnode] [\WaldiSymbol{20}] + \definesymbol [astrosun] [\mathematics{\odot}] + \definesymbol [sun] [\WaldiSymbol{46}] % additional + \definesymbol [newmoon] [\WaldiSymbol{32}] + \definesymbol [fullmoon] [\WaldiSymbol{35}] + \definesymbol [rightmoon] [\WaldiSymbol{37}] + \definesymbol [leftmoon] [\WaldiSymbol{36}] + \definesymbol [vernal] [\WaldiSymbol{23}] + \definesymbol [mercury] [\WaldiSymbol{39}] + \definesymbol [mars] [\dontleavehmode\lower.2ex\hbox{\WaldiSymbol{26}}] + \definesymbol [saturn] [\WaldiSymbol{89}] + \definesymbol [neptune] [\WaldiSymbol{91}] + \definesymbol [earth] [\dontleavehmode\lower.3ex\hbox{\WaldiSymbol{38}}] + \definesymbol [venus] [\dontleavehmode\raise.2ex\hbox{\WaldiSymbol{25}}] + \definesymbol [jupiter] [\WaldiSymbol{88}] + \definesymbol [uranus] [\WaldiSymbol{90}] + \definesymbol [pluto] [\WaldiSymbol{92}] +\stopsymbolset + +\startsymbolset [wasy astrology] + \definesymbol [conjunction] [\WaldiSymbol {86}] + \definesymbol [opposition] [\WaldiSymbol {87}] + \definesymbol [aries] [\WaldiSymbol {23}] + \definesymbol [libra] [\WaldiSymbol {97}] + \definesymbol [taurus] [\WaldiSymbol {93}] + \definesymbol [scorpio] [\WaldiSymbol {98}] + \definesymbol [gemini] [\WaldiSymbol {94}] + \definesymbol [sagittarius] [\WaldiSymbol {99}] + \definesymbol [cancer] [\WaldiSymbol {95}] + \definesymbol [capricornus] [\WaldiSymbol{100}] + \definesymbol [leo] [\WaldiSymbol {19}] + \definesymbol [aquarius] [\WaldiSymbol{101}] + \definesymbol [virgo] [\WaldiSymbol {96}] + \definesymbol [pisces] [\WaldiSymbol{102}] +\stopsymbolset + +\startsymbolset [wasy geometry] + \definesymbol [fivestar] [\WaldiSymbol {69}] % HHR additional + \definesymbol [hexstar] [\WaldiSymbol {65}] + \definesymbol [varhexstar] [\WaldiSymbol {66}] + \definesymbol [davidsstar] [\WaldiSymbol {67}] + \definesymbol [Circle] [\WaldiSymbol {35}] + \definesymbol [CIRCLE] [\WaldiSymbol {32}] + \definesymbol [Leftcircle] [\WaldiSymbol {73}] + \definesymbol [LEFTCIRCLE] [\WaldiSymbol {71}] + \definesymbol [Rightcircle] [\WaldiSymbol {74}] + \definesymbol [RIGHTCIRCLE] [\WaldiSymbol {72}] + \definesymbol [LEFTcircle] [\dontleavehmode\hbox to \zeropoint{\WaldiSymbol{71}\hss}\WaldiSymbol{35}] + \definesymbol [RIGHTcircle] [\dontleavehmode\hbox to \zeropoint{\WaldiSymbol{72}\hss}\WaldiSymbol{35}] + \definesymbol [LEFTarrow] [\WaldiSymbol {16}] + \definesymbol [RIGHTarrow] [\WaldiSymbol {17}] + \definesymbol [UParrow] [\WaldiSymbol {75}] + \definesymbol [DOWNarrow] [\WaldiSymbol {76}] + \definesymbol [Box] [\WaldiSymbol {50}] + \definesymbol [APLbox] [\WaldiSymbol{126}] + \definesymbol [XBox] [\WaldiSymbol {52}] + \definesymbol [Bowtie] [\WaldiSymbol {49}] + \definesymbol [Diamond] [\WaldiSymbol {51}] + \definesymbol [octagon] [\WaldiSymbol {56}] + \definesymbol [hexagon] [\WaldiSymbol {55}] + \definesymbol [varhexagon] [\WaldiSymbol {57}] + \definesymbol [pentagon] [\WaldiSymbol {68}] + \definesymbol [pentastar] [\dontleavehmode\hbox to \zeropoint{\WaldiSymbol{68}\hss}\lower.04em\hbox{\WaldiSymbol{69}}] % HHR additional +\stopsymbolset + +\startsymbolset [wasy physics] + \definesymbol [varangle] [\WaldiSymbol{30}] + \definesymbol [invneg] [\WaldiSymbol{24}] + \definesymbol [leftturn] [\WaldiSymbol{34}] + \definesymbol [rightturn] [\WaldiSymbol{33}] + \definesymbol [diameter] [\WaldiSymbol{31}] + \definesymbol [invdiameter] [\WaldiSymbol{21}] % additional + \definesymbol [therefore] [\WaldiSymbol {5}] + \definesymbol [AC] [\mbox{\kern.05em\WaldiSymbol{58}\kern.05em}] + \definesymbol [HF] [\dontleavehmode + \lower.09em\hbox to \zeropoint{\kern.05em\WaldiSymbol{58}\hss}% + \raise.09em\hbox{\kern.05em\WaldiSymbol{58}\kern.05em}] + \definesymbol [VHF] [\WaldiSymbol{64}] + \definesymbol [photon] [\hbox{\WaldiSymbol{58}\WaldiSymbol{58}\WaldiSymbol{58}\WaldiSymbol{58}}] + \definesymbol [gluon] [\hbox{\WaldiSymbol{80}\WaldiSymbol{80}\WaldiSymbol{80}\WaldiSymbol{80}\WaldiSymbol{80}\WaldiSymbol{80}}] +\stopsymbolset + +\startsymbolset [wasy apl] + \definesymbol [APLup] [\WaldiSymbol{0}] + \definesymbol [APLdown] [\WaldiSymbol{70}] + \definesymbol [APLbox] [\WaldiSymbol{126}] + \definesymbol [APLinv] [\dontleavehmode\hbox to \zeropoint{$\div$\hss}\WaldiSymbol{126}] + \definesymbol [APLleftarrowbox] [\WaldiSymbol{112}] + \definesymbol [APLrightarrowbox][\WaldiSymbol{113}] + \definesymbol [APLuparrowbox] [\WaldiSymbol{110}] + \definesymbol [APLdownarrowbox] [\WaldiSymbol{111}] + \definesymbol [APLinput] [\WaldiSymbol{125}] + \definesymbol [APLminus] [\dontleavehmode\raise.7ex\hbox{$-$}] + \definesymbol [APLlog] [\WaldiSymbol{22}] + \definesymbol [APLstar] [\WaldiSymbol{69}] + \definesymbol [APLcomment] [\WaldiSymbol{127}] + \definesymbol [notslash] [\wasy@over{/}{-}] + \definesymbol [notbackslash] [\wasy@over{\backslash}{-}] + % + %definesymbol [APLvert] [\WaldiSymbol{}] + %definesymbol [APLnot] [\WaldiSymbol{}] + %definesymbol [APLcirc] [\WaldiSymbol{}] + % + % HH: messy, best define all combinations (todo) + % + \def\APLnot #1{\wasy@over{\sim }{#1}} + \def\APLcirc#1{\wasy@over{\circ}{#1}} + \def\APLvert#1{\wasy@over{\vert}{#1}} + % +\stopsymbolset + +%D \showsymbolset[wasy general] +%D \showsymbolset[wasy music] +%D \showsymbolset[wasy astronomy] +%D \showsymbolset[wasy astrology] +%D \showsymbolset[wasy geometry] +%D \showsymbolset[wasy physics] +%D \showsymbolset[wasy apl] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/symb-was.tex b/Master/texmf-dist/tex/context/base/symb-was.tex deleted file mode 100644 index d6c32486408..00000000000 --- a/Master/texmf-dist/tex/context/base/symb-was.tex +++ /dev/null @@ -1,205 +0,0 @@ -%D \module -%D [ file=symb-was, -%D version=2005.10.15, -%D title=\CONTEXT\ Symbol Libraries, -%D subtitle=Roland Waldi's Symbols (wasy-2), -%D author=Henning Hraban Ramm, -%D date=\currentdate, -%D copyright={public domain}] -%C -%C This module is in the public domain. - -%D This module implements the Roland Waldi Symbole font -%D (wasy). The names are derived from the \LATEX\ package -%D \type {wasysym} by Axel Kielhorn. The symbols are -%D available as Type~1 font and are included in \TEX\ distributions. -%D -%D This symbol font offers basic sets of astronomical, astrological, -%D geometrical, musical and general symbols, plus those needed -%D for the APL programming language and some more. -%D This module leaves out most of the math stuff, such as operators -%D and integrals. -%D -%D The font was designed by Robert Waldi and is in the public domain. -%D The PS Type 1 fonts are by Taco Hoekwater, \hyphenatedurl -%D {taco.hoekwater@wkap.nl}, and also in the public domain. -%D The wasysym \LATEX\ package is (c) Axel Kielhorn, \hyphenatedurl -%D {A.Kielhorn@web.de}, under the LaTeX Project Public License. -%D This stuff lives in \hyphenatedurl {http://dante.ctan.org/CTAN/fonts/wasy2/}. -%D -%D This \CONTEXT\ module is by Henning Hraban Ramm, \hyphenatedurl -%D {hraban@fiee.net}, given to the public domain as far as allowed -%D (some parts are copied from the \LATEX\ package). - -%D Slightly patched by HH. - -\loadmapfile[original-wasy.map] - -% there are also fonts for 6, 7, 8, 9 pt; how can we access these automatically? -% how about the bold wasy font? - -\definefontsynonym [WaldiSymbol] [wasy10] -\definefontsynonym [WaldiSymbolBold] [wasyb10] - -\def\WaldiSymbol#1{\getglyph{WaldiSymbol}{\char#1}} - -\def\wasy@over#1#2{{\setbox0\hbox{$#2$}\hbox to \wd0{\hss$#1$\hss}\kern-\wd0\box0}} - -% general symbols - -\startsymbolset [wasy general] - \definesymbol [male] [\WaldiSymbol {26}] - \definesymbol [female] [\WaldiSymbol {25}] - \definesymbol [currency] [\WaldiSymbol {27}] - \definesymbol [cent] [\WaldiSymbol{103}] - \definesymbol [lozenge] [\WaldiSymbol {53}] - \definesymbol [kreuz] [\WaldiSymbol {54}] - \definesymbol [smiley] [\WaldiSymbol {44}] - \definesymbol [blacksmiley] [\WaldiSymbol {45}] - \definesymbol [frownie] [\WaldiSymbol {47}] - \definesymbol [sun] [\WaldiSymbol {46}] - \definesymbol [checked] [\WaldiSymbol {8}] - \definesymbol [brokenvert] [\WaldiSymbol{124}] - \definesymbol [diameter] [\WaldiSymbol {31}] - \definesymbol [invdiameter] [\WaldiSymbol {21}] - \definesymbol [phone] [\WaldiSymbol {7}] - \definesymbol [recorder] [\WaldiSymbol {6}] - \definesymbol [clock] [\WaldiSymbol {28}] - \definesymbol [permil] [\WaldiSymbol{104}] - \definesymbol [bell] [\WaldiSymbol {10}] - \definesymbol [ataribox] [\WaldiSymbol{109}] - \definesymbol [pointer] [\WaldiSymbol {9}] - \definesymbol [lightning] [\WaldiSymbol {18}] - \definesymbol [agemO] [\WaldiSymbol {48}] -\stopsymbolset - -\startsymbolset [wasy music] - \definesymbol [eighthnote] [\WaldiSymbol{11}] - \definesymbol [quarternote] [\WaldiSymbol{12}] - \definesymbol [halfnote] [\WaldiSymbol{13}] - \definesymbol [fullnote] [\WaldiSymbol{14}] - \definesymbol [twonotes] [\WaldiSymbol{15}] -\stopsymbolset - -\startsymbolset [wasy astronomy] - \definesymbol [ascnode] [\WaldiSymbol{19}] - \definesymbol [descnode] [\WaldiSymbol{20}] - \definesymbol [astrosun] [\mathematics{\odot}] - \definesymbol [sun] [\WaldiSymbol{46}] % additional - \definesymbol [newmoon] [\WaldiSymbol{32}] - \definesymbol [fullmoon] [\WaldiSymbol{35}] - \definesymbol [rightmoon] [\WaldiSymbol{37}] - \definesymbol [leftmoon] [\WaldiSymbol{36}] - \definesymbol [vernal] [\WaldiSymbol{23}] - \definesymbol [mercury] [\WaldiSymbol{39}] - \definesymbol [mars] [\dontleavehmode\lower.2ex\hbox{\WaldiSymbol{26}}] - \definesymbol [saturn] [\WaldiSymbol{89}] - \definesymbol [neptune] [\WaldiSymbol{91}] - \definesymbol [earth] [\dontleavehmode\lower.3ex\hbox{\WaldiSymbol{38}}] - \definesymbol [venus] [\dontleavehmode\raise.2ex\hbox{\WaldiSymbol{25}}] - \definesymbol [jupiter] [\WaldiSymbol{88}] - \definesymbol [uranus] [\WaldiSymbol{90}] - \definesymbol [pluto] [\WaldiSymbol{92}] -\stopsymbolset - -\startsymbolset [wasy astrology] - \definesymbol [conjunction] [\WaldiSymbol {86}] - \definesymbol [opposition] [\WaldiSymbol {87}] - \definesymbol [aries] [\WaldiSymbol {23}] - \definesymbol [libra] [\WaldiSymbol {97}] - \definesymbol [taurus] [\WaldiSymbol {93}] - \definesymbol [scorpio] [\WaldiSymbol {98}] - \definesymbol [gemini] [\WaldiSymbol {94}] - \definesymbol [sagittarius] [\WaldiSymbol {99}] - \definesymbol [cancer] [\WaldiSymbol {95}] - \definesymbol [capricornus] [\WaldiSymbol{100}] - \definesymbol [leo] [\WaldiSymbol {19}] - \definesymbol [aquarius] [\WaldiSymbol{101}] - \definesymbol [virgo] [\WaldiSymbol {96}] - \definesymbol [pisces] [\WaldiSymbol{102}] -\stopsymbolset - -\startsymbolset [wasy geometry] - \definesymbol [fivestar] [\WaldiSymbol {69}] % HHR additional - \definesymbol [hexstar] [\WaldiSymbol {65}] - \definesymbol [varhexstar] [\WaldiSymbol {66}] - \definesymbol [davidsstar] [\WaldiSymbol {67}] - \definesymbol [Circle] [\WaldiSymbol {35}] - \definesymbol [CIRCLE] [\WaldiSymbol {32}] - \definesymbol [Leftcircle] [\WaldiSymbol {73}] - \definesymbol [LEFTCIRCLE] [\WaldiSymbol {71}] - \definesymbol [Rightcircle] [\WaldiSymbol {74}] - \definesymbol [RIGHTCIRCLE] [\WaldiSymbol {72}] - \definesymbol [LEFTcircle] [\dontleavehmode\hbox to \zeropoint{\WaldiSymbol{71}\hss}\WaldiSymbol{35}] - \definesymbol [RIGHTcircle] [\dontleavehmode\hbox to \zeropoint{\WaldiSymbol{72}\hss}\WaldiSymbol{35}] - \definesymbol [LEFTarrow] [\WaldiSymbol {16}] - \definesymbol [RIGHTarrow] [\WaldiSymbol {17}] - \definesymbol [UParrow] [\WaldiSymbol {75}] - \definesymbol [DOWNarrow] [\WaldiSymbol {76}] - \definesymbol [Box] [\WaldiSymbol {50}] - \definesymbol [APLbox] [\WaldiSymbol{126}] - \definesymbol [XBox] [\WaldiSymbol {52}] - \definesymbol [Bowtie] [\WaldiSymbol {49}] - \definesymbol [Diamond] [\WaldiSymbol {51}] - \definesymbol [octagon] [\WaldiSymbol {56}] - \definesymbol [hexagon] [\WaldiSymbol {55}] - \definesymbol [varhexagon] [\WaldiSymbol {57}] - \definesymbol [pentagon] [\WaldiSymbol {68}] - \definesymbol [pentastar] [\dontleavehmode\hbox to \zeropoint{\WaldiSymbol{68}\hss}\lower.04em\hbox{\WaldiSymbol{69}}] % HHR additional -\stopsymbolset - -\startsymbolset [wasy physics] - \definesymbol [varangle] [\WaldiSymbol{30}] - \definesymbol [invneg] [\WaldiSymbol{24}] - \definesymbol [leftturn] [\WaldiSymbol{34}] - \definesymbol [rightturn] [\WaldiSymbol{33}] - \definesymbol [diameter] [\WaldiSymbol{31}] - \definesymbol [invdiameter] [\WaldiSymbol{21}] % additional - \definesymbol [therefore] [\WaldiSymbol {5}] - \definesymbol [AC] [\mbox{\kern.05em\WaldiSymbol{58}\kern.05em}] - \definesymbol [HF] [\dontleavehmode - \lower.09em\hbox to \zeropoint{\kern.05em\WaldiSymbol{58}\hss}% - \raise.09em\hbox{\kern.05em\WaldiSymbol{58}\kern.05em}] - \definesymbol [VHF] [\WaldiSymbol{64}] - \definesymbol [photon] [\hbox{\WaldiSymbol{58}\WaldiSymbol{58}\WaldiSymbol{58}\WaldiSymbol{58}}] - \definesymbol [gluon] [\hbox{\WaldiSymbol{80}\WaldiSymbol{80}\WaldiSymbol{80}\WaldiSymbol{80}\WaldiSymbol{80}\WaldiSymbol{80}}] -\stopsymbolset - -\startsymbolset [wasy apl] - \definesymbol [APLup] [\WaldiSymbol{0}] - \definesymbol [APLdown] [\WaldiSymbol{70}] - \definesymbol [APLbox] [\WaldiSymbol{126}] - \definesymbol [APLinv] [\dontleavehmode\hbox to \zeropoint{$\div$\hss}\WaldiSymbol{126}] - \definesymbol [APLleftarrowbox] [\WaldiSymbol{112}] - \definesymbol [APLrightarrowbox][\WaldiSymbol{113}] - \definesymbol [APLuparrowbox] [\WaldiSymbol{110}] - \definesymbol [APLdownarrowbox] [\WaldiSymbol{111}] - \definesymbol [APLinput] [\WaldiSymbol{125}] - \definesymbol [APLminus] [\dontleavehmode\raise.7ex\hbox{$-$}] - \definesymbol [APLlog] [\WaldiSymbol{22}] - \definesymbol [APLstar] [\WaldiSymbol{69}] - \definesymbol [APLcomment] [\WaldiSymbol{127}] - \definesymbol [notslash] [\wasy@over{/}{-}] - \definesymbol [notbackslash] [\wasy@over{\backslash}{-}] - % - %definesymbol [APLvert] [\WaldiSymbol{}] - %definesymbol [APLnot] [\WaldiSymbol{}] - %definesymbol [APLcirc] [\WaldiSymbol{}] - % - % HH: messy, best define all combinations (todo) - % - \def\APLnot #1{\wasy@over{\sim }{#1}} - \def\APLcirc#1{\wasy@over{\circ}{#1}} - \def\APLvert#1{\wasy@over{\vert}{#1}} - % -\stopsymbolset - -%D \showsymbolset[wasy general] -%D \showsymbolset[wasy music] -%D \showsymbolset[wasy astronomy] -%D \showsymbolset[wasy astrology] -%D \showsymbolset[wasy geometry] -%D \showsymbolset[wasy physics] -%D \showsymbolset[wasy apl] - -\endinput diff --git a/Master/texmf-dist/tex/context/base/syst-aux.mkiv b/Master/texmf-dist/tex/context/base/syst-aux.mkiv index fcc1ee88f1e..d2bc84ae8bc 100644 --- a/Master/texmf-dist/tex/context/base/syst-aux.mkiv +++ b/Master/texmf-dist/tex/context/base/syst-aux.mkiv @@ -1,5 +1,5 @@ %D \module -%D [ file=syst-gen, +%D [ file=syst-aux, % merge of syst-gen cum suis %D version=1996.03.20, %D title=\CONTEXT\ System Macros, %D subtitle=General, @@ -37,7 +37,20 @@ \unprotect -\let\reportprotectionstate\relax +%D \macros +%D {unexpanded} +%D +%D Because we use this module only in \MKIV, we have removed the +%D old protection code. +%D +%D \starttyping +%D \unexpanded\def\somecommand{... ... ...} +%D \stoptyping +%D +%D This overloads the \ETEX\ primitive but as we already had an \MKII\ +%D solution we keep the same name for a similar mechanism. + +\let\unexpanded\normalprotected %D \macros %D {doifolderversionelse} @@ -46,21 +59,15 @@ %D to use development versions of \MKIV\ for real documents. %D %D \starttyping -%D \doifolderversionelse\contextversion{2001.02.03}{yes}{no} -%D \doifolderversionelse\contextversion{3001.02.03}{yes}{no} +%D \doifolderversionelse\contextversion{1010.10.10} {OLDER} {OKAY} => OLDER +%D \doifolderversionelse\contextversion{2020.20.20} {OLDER} {OKAY} => OKAY +%D \doifolderversionelse\contextversion{2020} {OLDER} {OKAY} => OKAY %D \stoptyping %D -%D The \type {yyyy.mm.dd} syntax is rather strict. +%D The version pattern is \type {yyyy.mm.dd} (with mm and dd being optional). -\def\@@versiontonumber#1.#2.#3#4#5\relax - {\numexpr#1*\plustenthousand+#2*\plushundred+#3#4\relax} - -\def\doifolderversionelse#1#2% - {\normalexpanded{\noexpand\ifnum\noexpand\@@versiontonumber#1\relax<\noexpand\@@versiontonumber#2\relax}\relax - \expandafter\firstoftwoarguments - \else - \expandafter\secondoftwoarguments - \fi} +\def\doifolderversionelse#1#2{\ctxcommand{doifolderversionelse("#1","#2")}} +\def\doifoldercontextelse #1{\ctxcommand{doifolderversionelse("#1")}} %D \macros %D {normalspace} @@ -107,6 +114,11 @@ \def\!!plustwo {2} % alongside \plustwo \def\!!plusthree {3} % alongside \plusthree +\setnewconstant\uprotationangle 0 +\setnewconstant\rightrotatioangle 90 +\setnewconstant\downrotatioangle 180 +\setnewconstant\leftrotatioangle 270 + \ifdefined\data \else \let\data \relax \fi % dep checker %D \macros @@ -156,73 +168,26 @@ %D commalist or when data stored in macros is fed to index of %D list commands. If needed, one should use \type{\noexpand} %D inside the argument. Later on we will meet some more clever -%D alternatives to this command. +%D alternatives to this command. Beware, only the simple one +%D has \type {\noexpand} before its argument. -\long\def\@@expanded{} % always long; global (less restores) + \long\def\@@expanded{} % always long; global (less restores) \long\def\expanded#1% {\long\xdef\@@expanded{\noexpand#1}\@@expanded} -%D Beware, the next one has no \type {\noexpand} before its -%D argument. - \long\def\startexpanded#1\stopexpanded % see x-fo for example {\long\xdef\@@expanded{#1}\@@expanded} %D Recent \TEX's have a primitive \expanded -% \long\def\expanded -% {\normalexpanded\bgroup\noexpand\gobblenexttoken} - -%D \macros -%D {safeexpanded,everysafeexpanded} -%D -%D In addition we provide: - -\newtoks\everysafeexpanded - -\long\def\safeexpanded#1% why the \noexpand - {\begingroup - \the\everysafeexpanded\long\xdef\@@expanded{\noexpand#1}% - \endgroup - \@@expanded} - -\def\safeedef#1#2% - {\begingroup - \the\everysafeexpanded\long\xdef\@@expanded{\noexpand#2}% - \endgroup - \let#1\@@expanded} - -\def\safexdef#1#2% - {\begingroup - \the\everysafeexpanded\long\xdef\@@expanded{\noexpand#2}% - \endgroup - \global\let#1\@@expanded} - -%D You can append protective measures to the token register if -%D needed, as we will do later. - -%D \macros -%D {expandoneargafter,expandtwoargsafter} -%D -%D These two commands make macros more readable by hiding a -%D lot of \type {\expandafter}'s. They expand the arguments -%D after the first command. -%D -%D \starttyping -%D \expandoneargafter \command{\abc} -%D \expandtwoargsafter\command{\abc}{\def} -%D \stoptyping -%D -%D These commands expect the arguments to be macros. - -\def\expandoneargafter #1{\@EA#1\@EA} -\def\expandtwoargsafter#1#2{\@EA\@EA\@EA#1\@EA\@EA\@EA{\@EA#2\@EA}\@EA} - -%D These two do a full expansion: - -\def\fullexpandoneargafter #1#2{\long\xdef\@@expanded{\noexpand#1{#2}}\@@expanded} -\def\fullexpandtwoargsafter#1#2#3{\long\xdef\@@expanded{\noexpand#1{#2}{#3}}\@@expanded} +% not yet as we need to adapt ##'s in calls +% +% \long\def\expanded#1% +% {\normalexpanded{\noexpand#1}} +% +% \long\def\startexpanded#1\stopexpanded +% {\normalexpanded{#1}} %D \macros %D {gobbleoneargument,gobble...arguments} @@ -230,16 +195,22 @@ %D The next set of macros just do nothing, except that they %D get rid of a number of arguments. -\long\def\gobbleoneargument #1{} -\long\def\gobbletwoarguments #1#2{} -\long\def\gobblethreearguments #1#2#3{} -\long\def\gobblefourarguments #1#2#3#4{} -\long\def\gobblefivearguments #1#2#3#4#5{} -\long\def\gobblesixarguments #1#2#3#4#5#6{} -\long\def\gobblesevenarguments #1#2#3#4#5#6#7{} -\long\def\gobbleeightarguments #1#2#3#4#5#6#7#8{} -\long\def\gobbleninearguments #1#2#3#4#5#6#7#8#9{} -\long\def\gobbletenarguments #1{\gobbleninearguments} +\long\def\gobbleoneargument #1{} +\long\def\gobbletwoarguments #1#2{} +\long\def\gobblethreearguments#1#2#3{} +\long\def\gobblefourarguments #1#2#3#4{} +\long\def\gobblefivearguments #1#2#3#4#5{} +\long\def\gobblesixarguments #1#2#3#4#5#6{} +\long\def\gobblesevenarguments#1#2#3#4#5#6#7{} +\long\def\gobbleeightarguments#1#2#3#4#5#6#7#8{} +\long\def\gobbleninearguments #1#2#3#4#5#6#7#8#9{} +\long\def\gobbletenarguments #1{\gobbleninearguments} + +\def\gobbleoneoptional [#1]{} +\def\gobbletwooptionals [#1][#2]{} +\def\gobblethreeoptionals[#1][#2][#3]{} +\def\gobblefouroptionals [#1][#2][#3][#4]{} +\def\gobblefiveoptionals [#1][#2][#3][#4][#5]{} %D \macros %D {doifnextcharelse} @@ -278,6 +249,7 @@ \else \@EA\inspectnextcharacterindeed \fi} + \def\inspectnextcharacterindeed {\ifx\nexttoken\charactertoken \@EA\!!stringa @@ -291,18 +263,23 @@ %D test in a run. Of course it also is more convenient to read a %D trace then. +\newif\ifnextblankspacetoken + \let\nextoptionalcharactertoken=[ \long\def\doifnextoptionalelse#1#2% {\def\nextoptionalcommandyes{#1}% \def\nextoptionalcommandnop{#2}% + \let\ifnextblankspacetoken\iffalse \futurelet\nexttoken\inspectnextoptionalcharacter} + \def\inspectnextoptionalcharacter {\ifx\nexttoken\blankspace \@EA\reinspectnextoptionalcharacter \else \@EA\inspectnextoptionalcharacterindeed \fi} + \def\inspectnextoptionalcharacterindeed {\ifx\nexttoken\nextoptionalcharactertoken \@EA\nextoptionalcommandyes @@ -315,13 +292,16 @@ \long\def\doifnextbgroupelse#1#2% {\def\nextbgroupcommandyes{#1}% \def\nextbgroupcommandnop{#2}% + \let\ifnextblankspacetoken\iffalse \futurelet\nexttoken\inspectnextbgroupcharacter} + \def\inspectnextbgroupcharacter {\ifx\nexttoken\blankspace \@EA\reinspectnextbgroupcharacter \else \@EA\inspectnextbgroupcharacterindeed \fi} + \def\inspectnextbgroupcharacterindeed {\ifx\nexttoken\nextbgroupcharactertoken \@EA\nextbgroupcommandyes @@ -334,13 +314,16 @@ \long\def\doifnextparenthesiselse#1#2% {\def\nextparenthesiscommandyes{#1}% \def\nextparenthesiscommandnop{#2}% + \let\ifnextblankspacetoken\iffalse \futurelet\nexttoken\inspectnextparenthesischaracter} + \def\inspectnextparenthesischaracter {\ifx\nexttoken\blankspace \@EA\reinspectnextparenthesischaracter \else \@EA\inspectnextparenthesischaracterindeed \fi} + \def\inspectnextparenthesischaracterindeed {\ifx\nexttoken\nextparenthesischaractertoken \@EA\nextparenthesiscommandyes @@ -353,6 +336,7 @@ \long\def\doiffastoptionalcheckelse#1#2% {\def\nextoptionalcommandyes{#1}% \def\nextoptionalcommandnop{#2}% + \let\ifnextblankspacetoken\iffalse % not needed \futurelet\nexttoken\dodoiffastoptionalcheckelse} \def\dodoiffastoptionalcheckelse @@ -382,13 +366,13 @@ \def\:{\let\blankspace= } \: \def\:{\reinspectnextcharacter} -\expandafter\def\: {\futurelet\nexttoken\inspectnextcharacter} +\expandafter\def\: {\let\ifnextblankspacetoken\iftrue\futurelet\nexttoken\inspectnextcharacter} \def\:{\reinspectnextoptionalcharacter} -\expandafter\def\: {\futurelet\nexttoken\inspectnextoptionalcharacter} +\expandafter\def\: {\let\ifnextblankspacetoken\iftrue\futurelet\nexttoken\inspectnextoptionalcharacter} \def\:{\reinspectnextbgroupcharacter} -\expandafter\def\: {\futurelet\nexttoken\inspectnextbgroupcharacter} +\expandafter\def\: {\let\ifnextblankspacetoken\iftrue\futurelet\nexttoken\inspectnextbgroupcharacter} \let\:\next @@ -443,21 +427,6 @@ \def\globallet{\global\let} \let\glet\globallet -%D \macros -%D {unexpanded} -%D -%D Because we use this module only in \MKIV, we have removed the -%D old protection code. -%D -%D \starttyping -%D \unexpanded\def\somecommand{... ... ...} -%D \stoptyping -%D -%D This overloads the \ETEX\ primitive but as we already had an \MKII\ -%D solution we keep the same name for a similar mechanism. - -\let\unexpanded\normalprotected - %D \macros %D {doifundefined,doifdefined, %D doifundefinedelse,doifdefinedelse, @@ -491,44 +460,10 @@ %D \ifundefined\NameB ... \else ... \fi %D \stoptyping -\def\ifundefined#1% ongelukkige naam .. obsolete - {\unless\ifcsname#1\endcsname} - -% \def\p!doifundefined#1% -% {\edef\p!defined{#1}% -% \unless\ifcsname\detokenize\@EA{\p!defined}\endcsname} - -% \def\doifundefinedelse#1% -% {\edef\p!defined{#1}% -% \ifcsname\detokenize\@EA{\p!defined}\endcsname -% \expandafter\secondoftwoarguments -% \else -% \expandafter\firstoftwoarguments -% \fi} - -% \def\doifdefinedelse#1% -% {\edef\p!defined{#1}% -% \ifcsname\detokenize\@EA{\p!defined}\endcsname -% \expandafter\firstoftwoarguments -% \else -% \expandafter\secondoftwoarguments -% \fi} - -% \def\doifundefined#1% -% {\edef\p!defined{#1}% -% \ifcsname\detokenize\@EA{\p!defined}\endcsname -% \expandafter\gobbleoneargument -% \else -% \expandafter\firstofoneargument -% \fi} - -% \def\doifdefined#1% -% {\edef\p!defined{#1}% -% \ifcsname\detokenize\@EA{\p!defined}\endcsname -% \expandafter\firstofoneargument -% \else -% \expandafter\gobbleoneargument -% \fi} +% \def\ifundefined#1% obsolete +% {\unless\ifcsname#1\endcsname} +% +% use a real if like \ifcsname#1\endcsname\else instead \ifdefined\suppressifcsnameerror @@ -757,6 +692,7 @@ \else \expandafter\dodoifinsetelse \fi} + \long\def\dodoifinsetelse#1% {\edef\!!stringb{#1}% \ifx\!!stringb\empty @@ -772,6 +708,7 @@ \else \expandafter\dodoifinset \fi} + \long\def\dodoifinset#1% {\edef\!!stringb{#1}% \ifx\!!stringb\empty @@ -787,6 +724,7 @@ \else \expandafter\dodoifnotinset \fi} + \long\def\dodoifnotinset#1% {\edef\!!stringb{#1}% \ifx\!!stringb\empty @@ -802,12 +740,14 @@ \else \expandafter\dodocheckifiteminsetelse \fi#2} + \def\dodocheckifiteminsetelse {\ifx\!!stringb\rightoptionalbracket \expandafter\thirdofthreearguments \else \expandafter\dododocheckifiteminsetelse \fi} + \def\dododocheckifiteminsetelse {\ifx\!!stringa\!!stringb \expandafter\doquitifiteminsetelse @@ -822,12 +762,14 @@ \else \expandafter\dodocheckifiteminset \fi#2} + \def\dodocheckifiteminset {\ifx\!!stringb\rightoptionalbracket \expandafter\gobbletwoarguments \else \expandafter\dododocheckifiteminset \fi} + \def\dododocheckifiteminset {\ifx\!!stringa\!!stringb \expandafter\doquitifiteminset @@ -842,12 +784,14 @@ \else \expandafter\dodocheckifitemnotinset \fi#2} + \def\dodocheckifitemnotinset {\ifx\!!stringb\rightoptionalbracket \expandafter\secondoftwoarguments \else \expandafter\dododocheckifitemnotinset \fi} + \def\dododocheckifitemnotinset {\ifx\!!stringa\!!stringb \expandafter\doquitifitemnotinset @@ -883,21 +827,6 @@ % !9yes=\doifcommonelse{,a,}{,,,a,}{yes}{nop} % !9yes=\doifcommonelse{,,a,}{,,,a,}{yes}{nop} -% \def\p!doifcommonelse#1#2#3#4% -% {\donefalse -% \def\p!docommoncheck##1{\doifinset{##1}{#4}\donetrue\ifdone\quitcommalist\fi}% -% \processcommalist[#3]\p!docommoncheck -% \ifdone\expandafter#1\else\expandafter#2\fi} -% -% \def\doifcommonelse -% {\p!doifcommonelse\firstoftwoarguments\secondoftwoarguments} -% -% \def\doifcommon -% {\p!doifcommonelse\firstofoneargument \gobbleoneargument} -% -% \def\doifnotcommon -% {\p!doifcommonelse\gobbleoneargument \firstofoneargument} - \long\def\doquitifcommonelse#1],\relax#2],\relax{\firstoftwoarguments} \long\def\doquitifcommonelsenop{\secondoftwoarguments} @@ -946,23 +875,6 @@ \fi\fi #1#2} -% \def\p!doifcommonelse#1#2#3% -% {\edef\!!stringa{#3}% -% \ifx\!!stringa\empty -% \expandafter\secondofthreearguments -% \else -% \expandafter\p!dodoifcommonelse -% \fi -% #1#2} % #4 - -% \def\p!dodoifcommonelse#1#2#3% -% {\edef\!!stringb{#3}% -% \ifx\!!stringb\empty -% \expandafter\secondoftwoarguments -% \else -% \expandafter\pp!doifcommonelse -% \fi#1#2} - \def\pp!doifcommonelse {\def\p!docommoncheck{\expandafter\docheckifcommonelsetwo\!!stringb,],\relax}% \expandafter\docheckifcommonelseone\!!stringa,],\relax} @@ -1008,21 +920,13 @@ \def\dododoprocesscommaitem {\csname\s!next\the\commalevel\endcsname} -% \def\dodoprocesscommaitem -% {\ifx\nexttoken\blankspace -% \@EA\redoprocesscommaitem -% \else\ifx\nexttoken]% -% \@EAEAEA\gobbleoneargument -% \else -% \@EAEAEA\dododoprocesscommaitem -% \fi\fi} - \def\dodoprocesscommaitem {\ifx\nexttoken\blankspace \@EA\redoprocesscommaitem \else \@EA\dodoprocesscommaitemindeed \fi} + \def\dodoprocesscommaitemindeed {\ifx\nexttoken]% \@EA\gobbleoneargument @@ -1037,7 +941,7 @@ %D however are treated. We have to check for the special case %D \type{[{a,b,c}]}. -\def\processcommalist[% +\unexpanded\def\processcommalist[% {\futurelet\nexttoken\docheckcommaitem} \def\docheckcommaitem @@ -1108,20 +1012,8 @@ %D Commands that are part of the list are expanded, so the %D use of this macro has its limits. -% \def\processcommacommand[#1]% -% {\expanded{\processcommalist[#1]}} - -\def\processcommacommand[#1]% - {\expandafter\processcommalist\expandafter[\normalexpanded{#1}]} - -% \def\processcommacommand[#1]% -% {\edef\expandedcommacommand{#1% -% \ifx\expandedcommacommand\empty\else -% \doprocesscommacommand -% \fi} -% -% \def\doprocesscommacommand -% {\expandafter\processcommalist\expandafter[\expandedcommacommand]} +\unexpanded\def\processcommacommand[#1]% + {\normalexpanded{\processcommalist[#1]}} %D The argument to \type{\command} is not delimited. Because %D we often use \type{[]} as delimiters, we also have: @@ -1151,7 +1043,7 @@ \long\unexpanded\def\startprocesscommacommand[#1]#2\stopprocesscommacommand {\long\def\currentcommalistcommand##1{\def\currentcommalistitem{##1}#2}% - \normalexpanded{\noexpand\processcommacommand[#1]}\currentcommalistcommand} + \normalexpanded{\processcommalist[#1]}\currentcommalistcommand} %D \macros %D {processaction, @@ -1244,7 +1136,7 @@ \fi \fi} -\def\processfirstactioninset[#1]% +\unexpanded\def\processfirstactioninset[#1]% {\expandedaction\!!stringa{#1}% \ifx\!!stringa\empty \expandafter\processaction @@ -1253,7 +1145,7 @@ \fi [#1]} -\def\processfirstactionsinsetindeed[#1]#2[#3]% +\unexpanded\def\processfirstactionsinsetindeed[#1]#2[#3]% {\def\p!doprocessaction##1% {\def\p!dodoprocessaction####1% {\p!compareprocessactionC[####1][##1]}% @@ -1279,7 +1171,7 @@ \def\doprocessallactionsinset {\csname\s!do\the\processlevel\endcsname} -\def\processallactionsinset[#1]% +\unexpanded\def\processallactionsinset[#1]% {\expandedaction\!!stringa{#1}% \ifx\!!stringa\empty \expandafter\processaction @@ -1288,7 +1180,7 @@ \fi [#1]} -\def\processallactionsinsetindeed[#1]#2[#3]% +\unexpanded\def\processallactionsinsetindeed[#1]#2[#3]% {\advance\processlevel \plusone \expandafter\def\csname\s!do\the\processlevel\endcsname##1% {\def\p!dodoprocessaction####1% @@ -1434,25 +1326,10 @@ % replaces prev -% \long\def\p!doifinstringelse#1#2% ##2 can be {abc} -% {\long\@EA\def\@EA\pp!doifinstringelse\@EA##\@EA1#1##2##3\war{\unless\if##2@}% expand #1 here -% \expanded{\pp!doifinstringelse#2#1}@@\war} % expand #2 here - \long\def\p!doifinstringelse#1#2% ##2 can be {abc} {\long\@EA\def\@EA\pp!doifinstringelse\@EA##\@EA1#1##2##3\war{\unless\if##2@}% expand #1 here \expandafter\pp!doifinstringelse\normalexpanded{#2#1}@@\war} % expand #2 here -% faster but at some costs -% -% \def\setp!doifinstringelse#1#2% ##2 can be {abc} -% {\long\expandafter\gdef\csname @diie:#1\@EA\endcsname\@EA##\@EA1#1##2##3\war{\unless\if##2@}}% expand #1 here -% -% \long\def\p!doifinstringelse#1#2% ##2 can be {abc} -% {\ifcsname @diie:#1\endcsname \else -% \setp!doifinstringelse{#1}{#2}% -% \fi -% \csname @diie:#1\expandafter\endcsname\normalexpanded{#2#1}@@\war} % expand #2 here - %D The next alternative proved to be upto twice as fast on %D tasks like checking reserved words in pretty verbatim %D typesetting! This is mainly due to the fact that passing @@ -1552,7 +1429,7 @@ \expandafter\rawprocesscommaitem#1,],% \relax \global\advance\commalevel \minusone } -\def\rawprocesscommacommand[#1]% not really needed +\unexpanded\def\rawprocesscommacommand[#1]% not really needed {\normalexpanded{\rawprocesscommalist[#1]}} % \def\rawdoifinsetelse#1#2{\doifinstringelse{,#1,}{,#2,}} @@ -1839,10 +1716,6 @@ \let\p!doassign\p!n!doassign -% \def\doassign [#1][#2]{\p!doassign\dosetvalue #1\@relax@#2==\empty\@relax@} -% \def\doeassign [#1][#2]{\p!doassign\dosetevalue #1\@relax@#2==\empty\@relax@} -% \def\undoassign[#1][#2]{\p!doassign\doresetvalue#1\@relax@#2==\empty\@relax@} - \def\doassign [#1][#2]{\let\setsomevalue\dosetvalue \p!doassign#1\@relax@#2==\empty\@relax@} \def\doeassign [#1][#2]{\let\setsomevalue\dosetevalue \p!doassign#1\@relax@#2==\empty\@relax@} \def\undoassign[#1][#2]{\let\setsomevalue\doresetvalue\p!doassign#1\@relax@#2==\empty\@relax@} @@ -1861,12 +1734,12 @@ %D We can optimize this one if needed but it's not a core macro so hardly %D worth the trouble and tokens. -\def\processassignmentlist[#1]#2% #2 == \command{key}{value] +\unexpanded\def\processassignmentlist[#1]#2% #2 == \command{key}{value] {\def\doprocessassignmententry##1{#2}% {##2}{##3} % namespace is ignored \dogetparameters\doprocessassignmententry[][#1]} -\def\processassignmentcommand[#1]% - {\normalexpanded{\noexpand\processassignmentlist[#1]}} +\unexpanded\def\processassignmentcommand[#1]% + {\normalexpanded{\processassignmentlist[#1]}} \long\unexpanded\def\startprocessassignmentlist[#1]#2\stopprocessassignmentlist {\long\def\currentassignmentlistcommand##1##2{\def\currentassignmentlistkey{##1}\def\currentassignmentlistvalue{##2}#2}% @@ -1874,7 +1747,7 @@ \long\unexpanded\def\startprocessassignmentcommand[#1]#2\stopprocessassignmentcommand {\long\def\currentassignmentlistcommand##1##2{\def\currentassignmentlistkey{##1}\def\currentassignmentlistvalue{##2}#2}% - \normalexpanded{\noexpand\processassignmentlist[#1]}\currentassignmentlistcommand} + \normalexpanded{\processassignmentlist[#1]}\currentassignmentlistcommand} %D \macros{currentvalue} %D @@ -1913,16 +1786,6 @@ \def\xdoget@n@parameters#1]% {\xprocesscommaitem#1,],\@relax@} -% \def\xdoget@e@parameters#1]% -% {\let\dosetnvalue\dosetvalue -% \let\dosetvalue\dosetevalue -% \let\p!doassign\p!e!doassign -% \xprocesscommaitem#1,],\@relax@ -% \let\p!doassign\p!n!doassign -% \let\dosetvalue\dosetnvalue -% \let\xdogetparameters\xdoget@n@parameters -% \let\currentvalue\empty} - \def\xdoget@e@parameters#1]% {\let\dosetnvalue\setsomevalue \let\setsomevalue\dosetevalue @@ -2055,18 +1918,6 @@ \scratchtoks\expandafter{\expandafter[\commacommand]}% \expandafter\getcommalistsize\the\scratchtoks } -% to be tested first -% -% \def\getcommacommandsize[#1]% -% {\expanded{\getcommalistsize[#1]}} - -% \def\p!dogetfromcommalist#1% -% {\advance\commalistcounter \minusone -% \ifcase\commalistcounter -% \def\commalistelement{#1}% -% \begingroup\def\doprocesscommaitem##1]{\endgroup}% -% \fi} - \def\p!dogetfromcommalist#1% {\advance\commalistcounter \minusone \ifcase\commalistcounter @@ -2234,13 +2085,11 @@ %D use the \type{\if...argument} boolean. For novice: watch %D the stepwise doubling of \type{#}'s -% idea: \ignorespaces afterwards - -\chardef\noexpectedarguments=0 -\chardef\expectedarguments =0 +\setnewconstant\noexpectedarguments\zerocount +\setnewconstant\expectedarguments \zerocount \def\showargumenterror#1#2% - {\writestatus{systems}{\number#1 argument(s) expected in line #2}} + {\writestatus{system}{\number#1 argument(s) expected in line #2}} \def\doshowargumenterror {\ifnum\expectedarguments>\noexpectedarguments @@ -2251,163 +2100,668 @@ \def\noshowargumenterror {\let\expectedarguments\noexpectedarguments} -\long\def\dogetargument#1#2#3#4% - {\let\charactertoken=#1% - \def\!!stringa{\noshowargumenterror#3\dodogetargument}% - \def\!!stringb{\doshowargumenterror#4\dodogetargument#1#2}% - \futurelet\nexttoken\inspectnextcharacter} - -\def\getsingleempty#1#2#3% - {\def\dodogetargument% - {#3}% - \dogetargument#1#2\firstargumenttrue\firstargumentfalse} - -\def\getdoubleempty#1#2#3% - {\def\dodogetargument#1##1#2% - {\def\dodogetargument% - {#3#1{##1}#2}% - \dogetargument#1#2\secondargumenttrue\secondargumentfalse}% - \dogetargument#1#2\firstargumenttrue\firstargumentfalse} - -\def\gettripleempty#1#2#3% - {\def\dodogetargument#1##1#2% - {\def\dodogetargument#1####1#2% - {\def\dodogetargument% - {#3#1{##1}#2% - #1{####1}#2}% - \dogetargument#1#2\thirdargumenttrue\thirdargumentfalse}% - \dogetargument#1#2\secondargumenttrue\secondargumentfalse}% - \dogetargument#1#2\firstargumenttrue\firstargumentfalse} - -\def\getquadrupleempty#1#2#3% - {\def\dodogetargument#1##1#2% - {\def\dodogetargument#1####1#2% - {\def\dodogetargument#1########1#2% - {\def\dodogetargument% - {#3#1{##1}#2% - #1{####1}#2% - #1{########1}#2}% - \dogetargument#1#2\fourthargumenttrue\fourthargumentfalse}% - \dogetargument#1#2\thirdargumenttrue\thirdargumentfalse}% - \dogetargument#1#2\secondargumenttrue\secondargumentfalse}% - \dogetargument#1#2\firstargumenttrue\firstargumentfalse} - -\def\getquintupleempty#1#2#3% - {\def\dodogetargument#1##1#2% - {\def\dodogetargument#1####1#2% - {\def\dodogetargument#1########1#2% - {\def\dodogetargument#1################1#2% - {\def\dodogetargument% - {#3#1{##1}#2% - #1{####1}#2% - #1{########1}#2% - #1{################1}#2}% - \dogetargument#1#2\fifthargumenttrue\fifthargumentfalse}% - \dogetargument#1#2\fourthargumenttrue\fourthargumentfalse}% - \dogetargument#1#2\thirdargumenttrue\thirdargumentfalse}% - \dogetargument#1#2\secondargumenttrue\secondargumentfalse}% - \dogetargument#1#2\firstargumenttrue\firstargumentfalse} - -\def\getsixtupleempty#1#2#3% - {\def\dodogetargument#1##1#2% - {\def\dodogetargument#1####1#2% - {\def\dodogetargument#1########1#2% - {\def\dodogetargument#1################1#2% - {\def\dodogetargument#1################################1#2% - {\def\dodogetargument% - {#3#1{##1}#2% - #1{####1}#2% - #1{########1}#2% - #1{################1}#2% - #1{################################1}#2}% - \dogetargument#1#2\sixthargumenttrue\sixthargumentfalse}% - \dogetargument#1#2\fifthargumenttrue\fifthargumentfalse}% - \dogetargument#1#2\fourthargumenttrue\fourthargumentfalse}% - \dogetargument#1#2\thirdargumenttrue\thirdargumentfalse}% - \dogetargument#1#2\secondargumenttrue\secondargumentfalse}% - \dogetargument#1#2\firstargumenttrue\firstargumentfalse} - -\def\getseventupleempty#1#2#3% - {\def\dodogetargument#1##1#2% - {\def\dodogetargument#1####1#2% - {\def\dodogetargument#1########1#2% - {\def\dodogetargument#1################1#2% - {\def\dodogetargument#1################################1#2% - {\def\dodogetargument#1################################% - ################################1#2% - {\def\dodogetargument% - {#3#1{##1}#2% - #1{####1}#2% - #1{########1}#2% - #1{################1}#2% - #1{################################1}#2% - #1{################################% - ################################1}#2}% - \dogetargument#1#2\seventhargumenttrue\seventhargumentfalse}% - \dogetargument#1#2\sixthargumenttrue\sixthargumentfalse}% - \dogetargument#1#2\fifthargumenttrue\fifthargumentfalse}% - \dogetargument#1#2\fourthargumenttrue\fourthargumentfalse}% - \dogetargument#1#2\thirdargumenttrue\thirdargumentfalse}% - \dogetargument#1#2\secondargumenttrue\secondargumentfalse}% - \dogetargument#1#2\firstargumenttrue\firstargumentfalse} - -\def\dosingleempty {\getsingleempty []} -\def\dodoubleempty {\getdoubleempty []} -\def\dotripleempty {\gettripleempty []} -\def\doquadrupleempty {\getquadrupleempty []} -\def\doquintupleempty {\getquintupleempty []} -\def\dosixtupleempty {\getsixtupleempty []} -\def\doseventupleempty{\getseventupleempty[]} +% \long\def\dogetargument#1#2#3#4% +% {\let\charactertoken=#1% +% \def\!!stringa{\noshowargumenterror#3\dodogetargument}% +% \def\!!stringb{\doshowargumenterror#4\dodogetargument#1#2}% +% \futurelet\nexttoken\inspectnextcharacter} + +% \def\getsingleempty#1#2#3% +% {\def\dodogetargument% +% {#3}% +% \dogetargument#1#2\firstargumenttrue\firstargumentfalse} + +% \def\getdoubleempty#1#2#3% +% {\def\dodogetargument#1##1#2% +% {\def\dodogetargument% +% {#3#1{##1}#2}% +% \dogetargument#1#2\secondargumenttrue\secondargumentfalse}% +% \dogetargument#1#2\firstargumenttrue\firstargumentfalse} + +% \def\gettripleempty#1#2#3% +% {\def\dodogetargument#1##1#2% +% {\def\dodogetargument#1####1#2% +% {\def\dodogetargument% +% {#3#1{##1}#2% +% #1{####1}#2}% +% \dogetargument#1#2\thirdargumenttrue\thirdargumentfalse}% +% \dogetargument#1#2\secondargumenttrue\secondargumentfalse}% +% \dogetargument#1#2\firstargumenttrue\firstargumentfalse} + +% \def\getquadrupleempty#1#2#3% +% {\def\dodogetargument#1##1#2% +% {\def\dodogetargument#1####1#2% +% {\def\dodogetargument#1########1#2% +% {\def\dodogetargument% +% {#3#1{##1}#2% +% #1{####1}#2% +% #1{########1}#2}% +% \dogetargument#1#2\fourthargumenttrue\fourthargumentfalse}% +% \dogetargument#1#2\thirdargumenttrue\thirdargumentfalse}% +% \dogetargument#1#2\secondargumenttrue\secondargumentfalse}% +% \dogetargument#1#2\firstargumenttrue\firstargumentfalse} + +% \def\getquintupleempty#1#2#3% +% {\def\dodogetargument#1##1#2% +% {\def\dodogetargument#1####1#2% +% {\def\dodogetargument#1########1#2% +% {\def\dodogetargument#1################1#2% +% {\def\dodogetargument% +% {#3#1{##1}#2% +% #1{####1}#2% +% #1{########1}#2% +% #1{################1}#2}% +% \dogetargument#1#2\fifthargumenttrue\fifthargumentfalse}% +% \dogetargument#1#2\fourthargumenttrue\fourthargumentfalse}% +% \dogetargument#1#2\thirdargumenttrue\thirdargumentfalse}% +% \dogetargument#1#2\secondargumenttrue\secondargumentfalse}% +% \dogetargument#1#2\firstargumenttrue\firstargumentfalse} + +% \def\getsixtupleempty#1#2#3% +% {\def\dodogetargument#1##1#2% +% {\def\dodogetargument#1####1#2% +% {\def\dodogetargument#1########1#2% +% {\def\dodogetargument#1################1#2% +% {\def\dodogetargument#1################################1#2% +% {\def\dodogetargument% +% {#3#1{##1}#2% +% #1{####1}#2% +% #1{########1}#2% +% #1{################1}#2% +% #1{################################1}#2}% +% \dogetargument#1#2\sixthargumenttrue\sixthargumentfalse}% +% \dogetargument#1#2\fifthargumenttrue\fifthargumentfalse}% +% \dogetargument#1#2\fourthargumenttrue\fourthargumentfalse}% +% \dogetargument#1#2\thirdargumenttrue\thirdargumentfalse}% +% \dogetargument#1#2\secondargumenttrue\secondargumentfalse}% +% \dogetargument#1#2\firstargumenttrue\firstargumentfalse} + +% \def\getseventupleempty#1#2#3% +% {\def\dodogetargument#1##1#2% +% {\def\dodogetargument#1####1#2% +% {\def\dodogetargument#1########1#2% +% {\def\dodogetargument#1################1#2% +% {\def\dodogetargument#1################################1#2% +% {\def\dodogetargument#1################################% +% ################################1#2% +% {\def\dodogetargument% +% {#3#1{##1}#2% +% #1{####1}#2% +% #1{########1}#2% +% #1{################1}#2% +% #1{################################1}#2% +% #1{################################% +% ################################1}#2}% +% \dogetargument#1#2\seventhargumenttrue\seventhargumentfalse}% +% \dogetargument#1#2\sixthargumenttrue\sixthargumentfalse}% +% \dogetargument#1#2\fifthargumenttrue\fifthargumentfalse}% +% \dogetargument#1#2\fourthargumenttrue\fourthargumentfalse}% +% \dogetargument#1#2\thirdargumenttrue\thirdargumentfalse}% +% \dogetargument#1#2\secondargumenttrue\secondargumentfalse}% +% \dogetargument#1#2\firstargumenttrue\firstargumentfalse} + +% \def\dosingleempty {\getsingleempty []} +% \def\dodoubleempty {\getdoubleempty []} +% \def\dotripleempty {\gettripleempty []} +% \def\doquadrupleempty {\getquadrupleempty []} +% \def\doquintupleempty {\getquintupleempty []} +% \def\dosixtupleempty {\getsixtupleempty []} +% \def\doseventupleempty{\getseventupleempty[]} %D Because some of these are called quite often, we will now %D replace the more general version by alternatives tuned for %D speed. -\def\dosingleempty#1% we can make dedicated doifnextoptional's - {\noshowargumenterror % \relax % prevents lookahead, brr +% \def\dosingleempty#1% we can make dedicated doifnextoptional's +% {\noshowargumenterror % \relax % prevents lookahead, brr +% \doifnextoptionalelse +% {\firstargumenttrue#1}% +% {\dosinglefakeempty#1}} +% +% \def\dosinglefakeempty#1% +% {\firstargumentfalse#1[]} +% +% \def\dodoubleempty#1% +% {\noshowargumenterror % \relax % prevents lookahead, brr +% \doifnextoptionalelse +% {\dodoubletestempty#1}% +% {\dodoublefakeempty#1}} +% +% \def\dodoublefakeempty#1% +% {\firstargumentfalse\secondargumentfalse#1[][]} +% +% \long\def\dodoubletestempty#1[#2]% +% {\firstargumenttrue +% \doifnextoptionalelse +% {\secondargumenttrue #1[{#2}]}% +% {\secondargumentfalse#1[{#2}][]}} +% +% \def\dotripleempty#1% +% {\noshowargumenterror % \relax % prevents lookahead, brr +% \doifnextoptionalelse +% {\dotripletestempty#1}% +% {\dotriplefakeempty#1}} +% +% \def\dotriplefakeempty#1% +% {\firstargumentfalse\secondargumentfalse\thirdargumentfalse#1[][][]} +% +% \long\def\dotripletestempty#1[#2]% +% {\firstargumenttrue +% \doifnextoptionalelse +% {\dotripletestemptyx #1[{#2}]}% +% {\secondargumentfalse +% \thirdargumentfalse #1[{#2}][][]}} +% +% \long\def\dotripletestemptyx#1[#2][#3]% +% {\secondargumenttrue +% \doifnextoptionalelse +% {\thirdargumenttrue #1[{#2}][{#3}]}% +% {\thirdargumentfalse#1[{#2}][{#3}][]}} + +%D We can obey following spaces with a bit more code. + +% 0.172 0.187 new (per 10000) +% 0.156 0.140 old (per 10000) +% +% \def\test[#1]{(#1)} +% +% \dosingleempty\test[] xxx\par +% \dosingleempty\test xxx\par +% +% \def\test[#1][#2]{(#1,#2)} +% +% \dodoubleempty\test[][] xxx\par +% \dodoubleempty\test[] xxx\par +% \dodoubleempty\test xxx\par +% +% \def\test[#1][#2][#3]{(#1,#2,#3)} +% +% \dotripleempty\test[][][] xxx\par +% \dotripleempty\test[][] xxx\par +% \dotripleempty\test[] xxx\par +% \dotripleempty\test xxx\par + +%D Single: + +\def\dosingleempty#1% + {\noshowargumenterror \doifnextoptionalelse {\firstargumenttrue#1}% - {\dosinglefakeempty#1}} + {\dosingleemptyNOPone#1}} + +\def\dosingleemptyNOPone#1% + {\firstargumentfalse + #1[]} + +%D Double \def\dodoubleempty#1% - {\noshowargumenterror % \relax % prevents lookahead, brr + {\noshowargumenterror \doifnextoptionalelse - {\dodoubletestempty#1}% - {\dodoublefakeempty#1}} + {\dodoubleemptyYESone#1}% + {\dodoubleemptyNOPone#1}} + +\long\def\dodoubleemptyYESone#1[#2]% + {\firstargumenttrue + \doifnextoptionalelse + {\secondargumenttrue#1[{#2}]}% + {\dodoubleemptyNOPtwo#1{#2}}} + +\def\dodoubleemptyNOPone#1% + {\firstargumentfalse + \secondargumentfalse + #1[][]} + +\def\dodoubleemptyNOPtwo + {\secondargumentfalse + \ifnextblankspacetoken + \expandafter\dodoubleemptyonespaced + \else + \expandafter\dodoubleemptyonenormal + \fi} + +\def\dodoubleemptyonespaced#1#2{#1[{#2}][] } +\def\dodoubleemptyonenormal#1#2{#1[{#2}][]} + +% Three \def\dotripleempty#1% - {\noshowargumenterror % \relax % prevents lookahead, brr + {\noshowargumenterror + \doifnextoptionalelse + {\dotripleemptyYESone#1}% + {\dotripleemptyNOPone#1}} + +\long\def\dotripleemptyYESone#1[#2]% + {\firstargumenttrue \doifnextoptionalelse - {\dotripletestempty#1}% - {\dotriplefakeempty#1}} + {\dotripleemptyYEStwo#1{#2}}% + {\dotripleemptyNOPtwo#1{#2}}} + +\long\def\dotripleemptyYEStwo#1#2[#3]% + {\secondargumenttrue + \doifnextoptionalelse + {\thirdargumenttrue#1[{#2}][{#3}]}% + {\dotripleemptyNOPthree#1{#2}{#3}}} + +\def\dotripleemptyNOPone#1% + {\firstargumentfalse + \secondargumentfalse + \thirdargumentfalse + #1[][][]} + +\def\dotripleemptyNOPtwo + {\secondargumentfalse + \thirdargumentfalse + \ifnextblankspacetoken + \expandafter\dotripleemptytwospaced + \else + \expandafter\dotripleemptytwonormal + \fi} + +\def\dotripleemptyNOPthree + {\thirdargumentfalse + \ifnextblankspacetoken + \expandafter\dotripleemptythreespaced + \else + \expandafter\dotripleemptythreenormal + \fi} -\def\dosinglefakeempty#1% - {\firstargumentfalse#1[]} +\def\dotripleemptytwospaced #1#2{#1[{#2}][][] } +\def\dotripleemptytwonormal #1#2{#1[{#2}][][]} +\def\dotripleemptythreespaced#1#2#3{#1[{#2}][{#3}][] } +\def\dotripleemptythreenormal#1#2#3{#1[{#2}][{#3}][]} -\def\dodoublefakeempty#1% - {\firstargumentfalse\secondargumentfalse#1[][]} +%D Four: -\def\dotriplefakeempty#1% - {\firstargumentfalse\secondargumentfalse\thirdargumentfalse#1[][][]} +\def\doquadrupleempty#1% + {\noshowargumenterror + \doifnextoptionalelse + {\doquadrupleemptyYESone#1}% + {\doquadrupleemptyNOPone#1}} -\long\def\dodoubletestempty#1[#2]% +\long\def\doquadrupleemptyYESone#1[#2]% {\firstargumenttrue \doifnextoptionalelse - {\secondargumenttrue #1[{#2}]}% - {\secondargumentfalse#1[{#2}][]}} + {\doquadrupleemptyYEStwo#1{#2}}% + {\doquadrupleemptyNOPtwo#1{#2}}} + +\long\def\doquadrupleemptyYEStwo#1#2[#3]% + {\secondargumenttrue + \doifnextoptionalelse + {\doquadrupleemptyYESthree#1{#2}{#3}}% + {\doquadrupleemptyNOPthree#1{#2}{#3}}} -\long\def\dotripletestempty#1[#2]% +\long\def\doquadrupleemptyYESthree#1#2#3[#4]% + {\thirdargumenttrue + \doifnextoptionalelse + {\fourthargumenttrue#1[{#2}][{#3}][{#4}]}% + {\doquadrupleemptyNOPfour#1{#2}{#3}{#4}}} + +\def\doquadrupleemptyNOPone#1% + {\firstargumentfalse + \secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + #1[][][][]} + +\def\doquadrupleemptyNOPtwo + {\secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \ifnextblankspacetoken + \expandafter\doquadrupleemptytwospaced + \else + \expandafter\doquadrupleemptytwonormal + \fi} + +\def\doquadrupleemptyNOPthree + {\thirdargumentfalse + \fourthargumentfalse + \ifnextblankspacetoken + \expandafter\doquadrupleemptythreespaced + \else + \expandafter\doquadrupleemptythreenormal + \fi} + +\def\doquadrupleemptyNOPfour + {\fourthargumentfalse + \ifnextblankspacetoken + \expandafter\doquadrupleemptyfourspaced + \else + \expandafter\doquadrupleemptyfournormal + \fi} + +\def\doquadrupleemptytwospaced #1#2{#1[{#2}][][][] } +\def\doquadrupleemptytwonormal #1#2{#1[{#2}][][][]} +\def\doquadrupleemptythreespaced #1#2#3{#1[{#2}][{#3}][][] } +\def\doquadrupleemptythreenormal #1#2#3{#1[{#2}][{#3}][][]} +\def\doquadrupleemptyfourspaced #1#2#3#4{#1[{#2}][{#3}][{#4}][] } +\def\doquadrupleemptyfournormal #1#2#3#4{#1[{#2}][{#3}][{#4}][]} + +%D Five: + +\def\doquintupleempty#1% + {\noshowargumenterror + \doifnextoptionalelse + {\doquintupleemptyYESone#1}% + {\doquintupleemptyNOPone#1}} + +\long\def\doquintupleemptyYESone#1[#2]% {\firstargumenttrue \doifnextoptionalelse - {\dotripletestemptyx #1[{#2}]}% - {\secondargumentfalse - \thirdargumentfalse #1[{#2}][][]}} + {\doquintupleemptyYEStwo#1{#2}}% + {\doquintupleemptyNOPtwo#1{#2}}} -\long\def\dotripletestemptyx#1[#2][#3]% +\long\def\doquintupleemptyYEStwo#1#2[#3]% {\secondargumenttrue \doifnextoptionalelse - {\thirdargumenttrue #1[{#2}][{#3}]}% - {\thirdargumentfalse#1[{#2}][{#3}][]}} + {\doquintupleemptyYESthree#1{#2}{#3}}% + {\doquintupleemptyNOPthree#1{#2}{#3}}} + +\long\def\doquintupleemptyYESthree#1#2#3[#4]% + {\thirdargumenttrue + \doifnextoptionalelse + {\doquintupleemptyYESfour#1{#2}{#3}{#4}}% + {\doquintupleemptyNOPfour#1{#2}{#3}{#4}}} + +\long\def\doquintupleemptyYESfour#1#2#3#4[#5]% + {\fourthargumenttrue + \doifnextoptionalelse + {\fifthargumenttrue#1[{#2}][{#3}][{#4}][{#5}]}% + {\doquintupleemptyNOPfive#1{#2}{#3}{#4}{#5}}} + +\def\doquintupleemptyNOPone#1% + {\firstargumentfalse + \secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + #1[][][][][]} + +\def\doquintupleemptyNOPtwo + {\secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \ifnextblankspacetoken + \expandafter\doquintupleemptytwospaced + \else + \expandafter\doquintupleemptytwonormal + \fi} + +\def\doquintupleemptyNOPthree + {\thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \ifnextblankspacetoken + \expandafter\doquintupleemptythreespaced + \else + \expandafter\doquintupleemptythreenormal + \fi} + +\def\doquintupleemptyNOPfour + {\fourthargumentfalse + \fifthargumentfalse + \ifnextblankspacetoken + \expandafter\doquintupleemptyfourspaced + \else + \expandafter\doquintupleemptyfournormal + \fi} + +\def\doquintupleemptyNOPfive + {\fifthargumentfalse + \ifnextblankspacetoken + \expandafter\doquintupleemptyfivespaced + \else + \expandafter\doquintupleemptyfivenormal + \fi} + +\def\doquintupleemptytwospaced #1#2{#1[{#2}][][][][] } +\def\doquintupleemptytwonormal #1#2{#1[{#2}][][][][]} +\def\doquintupleemptythreespaced #1#2#3{#1[{#2}][{#3}][][][] } +\def\doquintupleemptythreenormal #1#2#3{#1[{#2}][{#3}][][][]} +\def\doquintupleemptyfourspaced #1#2#3#4{#1[{#2}][{#3}][{#4}][][] } +\def\doquintupleemptyfournormal #1#2#3#4{#1[{#2}][{#3}][{#4}][][]} +\def\doquintupleemptyfivespaced #1#2#3#4#5{#1[{#2}][{#3}][{#4}][{#5}][] } +\def\doquintupleemptyfivenormal #1#2#3#4#5{#1[{#2}][{#3}][{#4}][{#5}][]} + +%D Six + +\def\dosixtupleempty#1% + {\noshowargumenterror + \doifnextoptionalelse + {\dosixtupleemptyYESone#1} + {\dosixtupleemptyNOPone#1}} + +\long\def\dosixtupleemptyYESone#1[#2]% + {\firstargumenttrue + \doifnextoptionalelse + {\dosixtupleemptyYEStwo#1{#2}}% + {\dosixtupleemptyNOPtwo#1{#2}}} + +\long\def\dosixtupleemptyYEStwo#1#2[#3]% + {\secondargumenttrue + \doifnextoptionalelse + {\dosixtupleemptyYESthree#1{#2}{#3}}% + {\dosixtupleemptyNOPthree#1{#2}{#3}}} + +\long\def\dosixtupleemptyYESthree#1#2#3[#4]% + {\thirdargumenttrue + \doifnextoptionalelse + {\dosixtupleemptyYESfour#1{#2}{#3}{#4}}% + {\dosixtupleemptyNOPfour#1{#2}{#3}{#4}}} + +\long\def\dosixtupleemptyYESfour#1#2#3#4[#5]% + {\fourthargumenttrue + \doifnextoptionalelse + {\dosixtupleemptyYESfive#1{#2}{#3}{#4}{#5}}% + {\dosixtupleemptyNOPfive#1{#2}{#3}{#4}{#5}}} + +\long\def\dosixtupleemptyYESfive#1#2#3#4#5[#6]% + {\fifthargumenttrue + \doifnextoptionalelse + {\sixthargumenttrue#1[{#2}][{#3}][{#4}][{#5}][{#6}]}% + {\dosixtupleemptyNOPsix#1{#2}{#3}{#4}{#5}{#6}}} + +\def\dosixemptyNOPone#1% + {\firstargumentfalse + \secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + #1[][][][][][]} + +\def\dosixtupleemptyNOPtwo + {\secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \ifnextblankspacetoken + \expandafter\dosixemptytwospaced + \else + \expandafter\dosixemptytwonormal + \fi} + +\def\dosixtupleemptyNOPthree + {\thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \ifnextblankspacetoken + \expandafter\dosixemptythreespaced + \else + \expandafter\dosixemptythreenormal + \fi} + +\def\dosixtupleemptyNOPfour + {\fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \ifnextblankspacetoken + \expandafter\dosixemptyfourspaced + \else + \expandafter\dosixemptyfournormal + \fi} + +\def\dosixtupleemptyNOPfive + {\fifthargumentfalse + \sixthargumentfalse + \ifnextblankspacetoken + \expandafter\dosixemptyfivespaced + \else + \expandafter\dosixemptyfivenormal + \fi} + +\def\dosixtupleemptyNOPsix + {\sixthargumentfalse + \ifnextblankspacetoken + \expandafter\dosixemptysixspaced + \else + \expandafter\dosixemptysixnormal + \fi} + +\def\dosixemptytwospaced #1#2{#1[{#2}][][][][][] } +\def\dosixemptytwonormal #1#2{#1[{#2}][][][][][]} +\def\dosixemptythreespaced #1#2#3{#1[{#2}][{#3}][][][][] } +\def\dosixemptythreenormal #1#2#3{#1[{#2}][{#3}][][][][]} +\def\dosixemptyfourspaced #1#2#3#4{#1[{#2}][{#3}][{#4}][][][] } +\def\dosixemptyfournormal #1#2#3#4{#1[{#2}][{#3}][{#4}][][][]} +\def\dosixemptyfivespaced #1#2#3#4#5{#1[{#2}][{#3}][{#4}][{#5}][][] } +\def\dosixemptyfivenormal #1#2#3#4#5{#1[{#2}][{#3}][{#4}][{#5}][][]} +\def\dosixemptysixspaced #1#2#3#4#5#6{#1[{#2}][{#3}][{#4}][{#5}][{#6}][] } +\def\dosixemptysixnormal #1#2#3#4#5#6{#1[{#2}][{#3}][{#4}][{#5}][{#6}][]} + +%D Seven: + +\def\doseventupleempty#1% + {\noshowargumenterror + \doifnextoptionalelse + {\doseventupleemptyYESone#1}% + {\doseventupleemptyNOPone#1}} + +\long\def\doseventupleemptyYESone#1[#2]% + {\firstargumenttrue + \doifnextoptionalelse + {\doseventupleemptyYEStwo#1{#2}}% + {\doseventupleemptyNOPtwo#1{#2}}} + +\long\def\doseventupleemptyYEStwo#1#2[#3]% + {\secondargumenttrue + \doifnextoptionalelse + {\doseventupleemptyYESthree#1{#2}{#3}}% + {\doseventupleemptyNOPthree#1{#2}{#3}}} + +\long\def\doseventupleemptyYESthree#1#2#3[#4]% + {\thirdargumenttrue + \doifnextoptionalelse + {\doseventupleemptyYESfour#1{#2}{#3}{#4}}% + {\doseventupleemptyNOPfour#1{#2}{#3}{#4}}} + +\long\def\doseventupleemptyYESfour#1#2#3#4[#5]% + {\fourthargumenttrue + \doifnextoptionalelse + {\doseventupleemptyYESfive#1{#2}{#3}{#4}{#5}}% + {\doseventupleemptyNOPfive#1{#2}{#3}{#4}{#5}}} + +\long\def\doseventupleemptyYESfive#1#2#3#4#5[#6]% + {\fifthargumenttrue + \doifnextoptionalelse + {\doseventupleemptyYESsix#1{#2}{#3}{#4}{#5}{#6}}% + {\doseventupleemptyNOPsix#1{#2}{#3}{#4}{#5}{#6}}} + +\long\def\doseventupleemptyYESsix#1#2#3#4#5#6[#7]% + {\sixthargumenttrue + \doifnextoptionalelse + {\seventhargumenttrue#1[{#2}][{#3}][{#4}][{#5}][{#6}][{#7}]}% + {\doseventupleemptyNOPseven#1{#2}{#3}{#4}{#5}{#6}{#7}}} + +\def\dosevenemptyNOPone#1% + {\firstargumentfalse + \secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \seventhargumentfalse + #1[][][][][][][]} + +\def\doseventupleemptyNOPtwo + {\secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \seventhargumentfalse + \ifnextblankspacetoken + \expandafter\dosevenemptytwospaced + \else + \expandafter\dosevenemptytwonormal + \fi} + +\def\doseventupleemptyNOPthree + {\thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \seventhargumentfalse + \ifnextblankspacetoken + \expandafter\dosevenemptythreespaced + \else + \expandafter\dosevenemptythreenormal + \fi} + +\def\doseventupleemptyNOPfour + {\fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \seventhargumentfalse + \ifnextblankspacetoken + \expandafter\dosevenemptyfourspaced + \else + \expandafter\dosevenemptyfournormal + \fi} + +\def\doseventupleemptyNOPfive + {\fifthargumentfalse + \sixthargumentfalse + \seventhargumentfalse + \ifnextblankspacetoken + \expandafter\dosevenemptyfivespaced + \else + \expandafter\dosevenemptyfivenormal + \fi} + +\def\doseventupleemptyNOPsix + {\sixthargumentfalse + \seventhargumentfalse + \ifnextblankspacetoken + \expandafter\dosevenemptysixspaced + \else + \expandafter\dosevenemptysixnormal + \fi} + +\def\doseventupleemptyNOPseven + {\seventhargumentfalse + \ifnextblankspacetoken + \expandafter\dosevenemptysevenspaced + \else + \expandafter\dosevenemptysevennormal + \fi} + +\def\dosevenemptytwospaced #1#2{#1[{#2}][][][][][][] } +\def\dosevenemptytwonormal #1#2{#1[{#2}][][][][][][]} +\def\dosevenemptythreespaced #1#2#3{#1[{#2}][{#3}][][][][][] } +\def\dosevenemptythreenormal #1#2#3{#1[{#2}][{#3}][][][][][]} +\def\dosevenemptyfourspaced #1#2#3#4{#1[{#2}][{#3}][{#4}][][][][] } +\def\dosevenemptyfournormal #1#2#3#4{#1[{#2}][{#3}][{#4}][][][][]} +\def\dosevenemptyfivespaced #1#2#3#4#5{#1[{#2}][{#3}][{#4}][{#5}][][][] } +\def\dosevenemptyfivenormal #1#2#3#4#5{#1[{#2}][{#3}][{#4}][{#5}][][][]} +\def\dosevenemptysixspaced #1#2#3#4#5#6{#1[{#2}][{#3}][{#4}][{#5}][{#6}][][] } +\def\dosevenemptysixnormal #1#2#3#4#5#6{#1[{#2}][{#3}][{#4}][{#5}][{#6}][][]} +\def\dosevenemptysevenspaced#1#2#3#4#5#6#7{#1[{#2}][{#3}][{#4}][{#5}][{#6}][{#7}][] } +\def\dosevenemptysevennormal#1#2#3#4#5#6#7{#1[{#2}][{#3}][{#4}][{#5}][{#6}][{#7}][]} %D \macros %D {strippedcsname} @@ -2545,11 +2899,6 @@ %D potentially being an \type {conditional} token. Okay, these macros %D are not called that often but it saves crap when tracing. -% \def\dogetgroupargument#1#2% -% {\let\dogroupargumentyes#1% -% \let\dogroupargumentnop#2% -% \futurelet\nextargument\dodogetgroupargument} - \def\dodogetgroupargument {\ifx\nextargument\bgroup \expandafter\dodogetgroupargumentA @@ -2561,20 +2910,6 @@ {\noshowargumenterror \dogroupargumentyes\dodogetargument} -% \def\dodogetgroupargumentB -% {\ifcase\@@permitspacesbetweengroups -% \expandafter\dodogetgroupargumentC -% \else -% \expandafter\dodogetgroupargumentD -% \fi} - -% \def\dodogetgroupargumentC -% {\ifx\nextargument\lineending -% \expandafter\dodogetgroupargumentE -% \else -% \expandafter\dodogetgroupargumentF -% \fi} - \def\dodogetgroupargumentB {\ifcase\@@permitspacesbetweengroups \expandafter\dodogetgroupargumentF @@ -2586,9 +2921,6 @@ {\doshowargumenterror \dogroupargumentnop\dodogetargument{}} -% \def\dodogetgroupargumentE -% {\begingroup\def\\ {\endgroup\dogetgroupargument\dogroupargumentyes\dogroupargumentnop}\\} - \begingroup \def\\ {\dogetgroupargument\dogroupargumentyes\dogroupargumentnop} \global\let\dodogetgroupargumentE\\ @@ -2712,7 +3044,9 @@ \long\def\sixthofsixarguments #1#2#3#4#5#6{#6} %D \macros -%D {globalletempty,letempty,letvalueempty,letgvalueempty} +%D {globalletempty,letempty, +%D letvalueempty,letgvalueempty, +%D letvaluerelax,letgvaluerelax} %D %D Trivial: @@ -2721,6 +3055,8 @@ \def\letvalueempty #1{\expandafter\let\csname#1\endcsname\empty} \def\letgvalueempty#1{\global\expandafter\let\csname#1\endcsname\empty} +\def\letvaluerelax #1{\expandafter\let\csname#1\endcsname\relax} +\def\letgvalurelax #1{\global\expandafter\let\csname#1\endcsname\relax} %D \macros %D {wait} @@ -2753,8 +3089,8 @@ %D of the identification string with the macro \type %D {\statuswidth}. -\chardef\statuswidth=15 -\chardef\statuswrite=16 +\setnewconstant\statuswidth 15 +\setnewconstant\statuswrite 16 \ifdefined\writestring \else @@ -2780,6 +3116,13 @@ \def\nosplitstatus#1\end {} +%D \macros +%D {immediatemessage} +%D +%D A fully expandable message: + +\def\immediatemessage#1{\ctxlua{logs.status("message","#1")}} + %D \macros %D {debuggerinfo} %D @@ -2935,7 +3278,7 @@ \dostarttexdefinition} \gdef\dostarttexdefinition #1 - {\catcode13=\@@ignore% + {\catcode\endoflineasciicode\ignorecatcode% \doifinstringelse\letterhash{\detokenize{#1}}\dodostarttexdefinition\nonostarttexdefinition#1 } @@ -2944,17 +3287,22 @@ \long\gdef\dododostarttexdefinition#1#2#3\stoptexdefinition% {\egroup% - \long\setvalue{#1}#2{#3}} + \expandafter\def\csname#1\endcsname#2{#3}} \long\gdef\nonostarttexdefinition#1 {\nononostarttexdefinition{#1}{}} \long\gdef\nononostarttexdefinition#1#2#3\stoptexdefinition% {\egroup% - \long\setvalue{#1}{#3}} + \expandafter\def\csname#1\endcsname{#3}} \egroup +% This is a first variant, more might be added: + +\def\starttexcode{\unprotect} +\def\stoptexcode {\protect} + %D \macros %D {newcounter, %D increment,decrement} @@ -3068,8 +3416,6 @@ \edef#1{\the\maximumsignal}% \fi} -\let\newskimen\newdimen % it's all etex or later now - %D \macros %D {strippedcsname} %D @@ -3080,10 +3426,6 @@ %D \csname if\strippedcsname\something\endcsname %D \stoptyping -\ifdefined\letterbackslash \else - {\catcode`.=0 .catcode`.\ 12 .xdef.letterbackslash{.string\}} % hack -\fi - \def\checkedstrippedcsname#1% this permits \strippedcsname{\xxx} and \strippedcsname{xxx} {\expandafter\docheckedstrippedcsname\string#1} @@ -3139,8 +3481,7 @@ %D conditionals. The next implementation is abaou as fast %D and just as straightforward: -% \def\settrue #1{\chardef#1\zerocount} -% \def\setfalse#1{\chardef#1\plusone} +% maybe reserve special zero and plusone \def\settrue #1{\let#1\zerocount} \def\setfalse#1{\let#1\plusone} @@ -3150,6 +3491,15 @@ \let\then\relax % so that we can say: \ifnum1>2\then -) +% demands that each conditional is defined .. it would be handy to have +% a primitive \unless\ifcase .. then we could use better values +% +% \def\settrue #1{#1\zerocount} +% \def\setfalse#1{#1\plusone} +% +% \def\newconditional#1{\ifdefined#1\else\newcount#1\fi\setfalse#1} +% \let\ifconditional \ifcase + %D \macros %D {ifzeropt} %D @@ -3237,7 +3587,7 @@ \else \let\nextrecurse\exitstepwiserecurse \fi - \fi\normalexpanded{\noexpand\nextrecurse{\number#1}{\number#2}{\number#3}}} + \fi\normalexpanded{\nextrecurse{\number#1}{\number#2}{\number#3}}} \long\def\dodostepwiserecurse#1#2#3% from to step {\ifnum#1>#2\relax @@ -3247,21 +3597,13 @@ \@EAEAEA\redostepwiserecurse\@EA \fi\@EA{\the\numexpr\recurselevel+#3\relax}{#2}{#3}} -\def\expandrecursecontent +\unexpanded\def\expandrecursecontent {\csname\@@arecurse\recursedepth\endcsname} -\def\redostepwiserecurse +\unexpanded\def\redostepwiserecurse {\expandrecursecontent\dodostepwiserecurse} -\long\def\dodostepwisereverse#1#2#3% from to step - {\ifnum#1<#2\relax - \@EA\nodostepwiserecurse - \else - \def\recurselevel{#1}% - \@EAEAEA\redostepwisereverse\@EA - \fi\@EA{\the\numexpr\recurselevel#3\relax}{#2}{#3}} - -\long\def\dodostepwisereverse#1#2#3% from to step +\long\unexpanded\def\dodostepwisereverse#1#2#3% from to step {\ifnum#1<#2\relax \@EA\nodostepwiserecurse \else @@ -3271,21 +3613,21 @@ \@EAEAEA\redostepwisereverse\@EA \fi\@EA{\the\innerrecurse}{#2}{#3}} -\def\redostepwisereverse +\unexpanded\def\redostepwisereverse {\expandrecursecontent\dodostepwisereverse} -\def\exitstepwiserecurse +\unexpanded\def\exitstepwiserecurse {\nodostepwiserecurse\relax} -\def\nodostepwiserecurse#1#2#3#4% +\unexpanded\def\nodostepwiserecurse#1#2#3#4% {\@EA\let\@EA\recurselevel\csname\@@irecurse\recursedepth\endcsname \global\advance\outerrecurse \minusone} -\def\nonostepwiserecurse#1#2#3% +\unexpanded\def\nonostepwiserecurse#1#2#3% {\@EA\let\@EA\recurselevel\csname\@@irecurse\recursedepth\endcsname \global\advance\outerrecurse \minusone} -\def\dorecurse#1% +\unexpanded\def\dorecurse#1% {\dostepwiserecurse1{#1}1} %D As we can see here, the simple command \type{\dorecurse} is @@ -3307,7 +3649,7 @@ %D Because the simple case is used often, we implement it %D more efficiently: -\long\def\dorecurse#1% +\long\unexpanded\def\dorecurse#1% {\ifcase#1\relax \expandafter\gobbletwoarguments \or @@ -3316,13 +3658,13 @@ \expandafter\xdorecurse \fi{#1}} -\long\def\xdorecurse#1#2% +\long\unexpanded\def\xdorecurse#1#2% {\global\advance\outerrecurse \plusone \long\global\@EA\def\csname\@@arecurse\recursedepth\endcsname{#2}% \global\@EA\let\csname\@@irecurse\recursedepth\endcsname\recurselevel \@EA\dodorecurse\@EA1\@EA{\number#1}} -\long\def\ydorecurse#1#2% +\long\unexpanded\def\ydorecurse#1#2% {\global\advance\outerrecurse \plusone \global\@EA\let\csname\@@irecurse\recursedepth\endcsname\recurselevel \let\recurselevel\!!plusone @@ -3330,7 +3672,7 @@ \@EA\let\@EA\recurselevel\csname\@@irecurse\recursedepth\endcsname \global\advance\outerrecurse \minusone} -\long\def\dodorecurse#1#2% from to +\long\unexpanded\def\dodorecurse#1#2% from to {\ifnum#1>#2\relax \@EA\nodorecurse \else @@ -3338,7 +3680,7 @@ \@EAEAEA\redorecurse \fi\@EA{\the\numexpr\recurselevel+\plusone\relax}{#2}} -\long\def\dodorecurse#1#2% from to +\long\unexpanded\def\dodorecurse#1#2% from to {\ifnum#1>#2\relax \@EA\nodorecurse \else @@ -3347,10 +3689,10 @@ \@EAEAEA\redorecurse \fi\@EA{\the\innerrecurse}{#2}} -\def\redorecurse +\unexpanded\def\redorecurse {\expandrecursecontent\dodorecurse} -\def\nodorecurse#1#2#3% +\unexpanded\def\nodorecurse#1#2#3% {\@EA\let\@EA\recurselevel\csname\@@irecurse\recursedepth\endcsname \global\advance\outerrecurse \minusone } @@ -3374,29 +3716,29 @@ \let\endofloop\donothing -\long\def\doloop#1% +\unexpanded\long\def\doloop#1% {\global\advance\outerrecurse \plusone \long\global\@EA\def\csname\@@arecurse\recursedepth\endcsname{#1}% \global\@EA\let\csname\@@irecurse\recursedepth\endcsname\recurselevel \let\endofloop\dodoloop \dodoloop1} % no \plusone else \recurselevel wrong -\long\def\dodoloop#1% +\unexpanded\long\def\dodoloop#1% {\def\recurselevel{#1}% \@EA\redoloop\@EA{\the\numexpr\recurselevel+\plusone\relax}} -\def\redoloop +\unexpanded\def\redoloop {\expandrecursecontent\endofloop} -\def\nodoloop#1% +\unexpanded\def\nodoloop#1% {\let\endofloop\dodoloop % new, permits nested \doloop's \@EA\let\@EA\recurselevel\csname\@@irecurse\recursedepth\endcsname \global\advance\outerrecurse\minusone} -\def\exitloop % \exitloop quits at end +\unexpanded\def\exitloop % \exitloop quits at end {\let\endofloop\nodoloop} -\long\def\exitloopnow#1\endofloop % \exitloopnow quits directly +\long\unexpanded\def\exitloopnow#1\endofloop % \exitloopnow quits directly {\nodoloop} %D The loop is executed at least once, so beware of situations @@ -3440,13 +3782,13 @@ \def\expandrecursecontent {\csname\@@arecurse\recursedepth\@EA\@EA\@EA\endcsname\@EA\@EA\@EA{\@EA\recurselevel\@EA}\@EA{\recursedepth}} -\long\def\xdorecurse#1#2% +\long\unexpanded\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\ydorecurse#1#2% +\long\unexpanded\def\ydorecurse#1#2% {\global\advance\outerrecurse \plusone \global\@EA\let\csname\@@irecurse\recursedepth\endcsname\recurselevel \let\recurselevel\!!plusone @@ -3455,7 +3797,7 @@ \@EA\let\@EA\recurselevel\csname\@@irecurse\recursedepth\endcsname \global\advance\outerrecurse \minusone} -\long\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 +\long\unexpanded\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 @@ -3475,9 +3817,9 @@ \else \let\nextrecurse\exitstepwiserecurse \fi - \fi\normalexpanded{\noexpand\nextrecurse{\number#1}{\number#2}{\number#3}}} + \fi\normalexpanded{\nextrecurse{\number#1}{\number#2}{\number#3}}} -\long\def\doloop#1% +\long\unexpanded\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 @@ -3488,7 +3830,7 @@ % faster -\long\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 +\long\unexpanded\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 @@ -3509,11 +3851,11 @@ \let\nextrecurse\exitstepwiserecurse \fi \fi - \expandafter\nextrecurse\normalexpanded{{\number#1}{\number#2}{\number#3}}} + \normalexpanded{\nextrecurse{\number#1}{\number#2}{\number#3}}} % slightly faster -\long\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 +\long\unexpanded\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 @@ -3529,13 +3871,38 @@ \let\@swrd\dodostepwiserecurse \let\@swrr\dodostepwisereverse +% quite okay too, but untested +% +% \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 +% \normalexpanded +% {\ifnum#3>\zerocount +% \ifnum#2<#1 +% \exitstepwiserecurse +% \else +% \dodostepwiserecurse +% \fi +% \else +% \ifnum#3<\zerocount +% \ifnum#1<#2 +% \exitstepwiserecurse +% \else +% \dodostepwisereverse +% \fi +% \else +% \exitstepwiserecurse +% \fi +% \fi{\number#1}{\number#2}{\number#3}}} + %D For special purposes: \newcount\fastrecursecounter \newcount\lastrecursecounter \newcount\steprecursecounter -\def\dofastrecurse#1#2#3#4% +\unexpanded\def\dofastrecurse#1#2#3#4% {\def\fastrecursebody{#4}% \fastrecursecounter#1\relax \lastrecursecounter#2\relax @@ -3543,9 +3910,9 @@ \def\recurselevel{\number\fastrecursecounter}% \dodofastrecurse} -\def\resetrecurselevel{\let\recurselevel\!!zerocount} +\unexpanded\def\resetrecurselevel{\let\recurselevel\!!zerocount} -\def\dodofastrecurse +\unexpanded\def\dodofastrecurse {\ifnum\fastrecursecounter>\lastrecursecounter % \resetrecurselevel % slows down \else @@ -3576,11 +3943,11 @@ %D The use of \type{\od} as a dilimiter would have made nested %D use more problematic. -%D Don't use this one, it's kind of obsolete. - -\def\for#1=#2\to#3\step#4\do#5% - {\dostepwiserecurse{#2}{#3}{#4} - {\let#1\recurselevel#5\let#1\recurselevel}} +% obsolete: +% +% \def\for#1=#2\to#3\step#4\do#5% +% {\dostepwiserecurse{#2}{#3}{#4} +% {\let#1\recurselevel#5\let#1\recurselevel}} %D \macros %D {newevery,everyline,EveryLine,EveryPar} @@ -3836,70 +4203,14 @@ %D \doifsamestringelse{\jobname}{oeps}{YES}{NO} %D \stoptyping -% \def\@@doifsamestringelse#1#2#3#4% -% {\edef\!!stringa{#3}\convertcommand\!!stringa\to\!!stringa -% \edef\!!stringb{#4}\convertcommand\!!stringb\to\!!stringb -% \ifx\!!stringa\!!stringb\expandafter#1\else\expandafter#2\fi} - \def\@@doifsamestringelse#1#2#3#4% {\edef\!!stringa{\detokenize\expandafter{\normalexpanded{#3}}}% \edef\!!stringb{\detokenize\expandafter{\normalexpanded{#4}}}% \ifx\!!stringa\!!stringb\expandafter#1\else\expandafter#2\fi} \def\doifsamestringelse{\@@doifsamestringelse\firstoftwoarguments\secondoftwoarguments} -\def\doifsamestring {\@@doifsamestringelse\firstofoneargument\gobbleoneargument} -\def\doifnotsamestring {\@@doifsamestringelse\gobbleoneargument\firstofoneargument} - -%D \macros -%D {ExpandFirstAfter,ExpandSecondAfter,ExpandBothAfter} -%D -%D These three commands support expansion of arguments before -%D executing the commands that uses them. We can best -%D illustrate this with an example. -%D -%D \starttyping -%D \def\first {alfa,beta,gamma} -%D \def\second {alfa,epsilon,zeta} -%D -%D \ExpandFirstAfter \doifcommon {\first} {alfa} {\message{OK}} -%D \ExpandSecondAfter \doifcommon {alfa} {\second} {\message{OK}} -%D \ExpandBothAfter \doifcommon {\first} {\second} {\message{OK}} -%D -%D \ExpandFirstAfter\processcommalist[\first]\message -%D -%D \ExpandAfter \doifcommon {\first} {alfa} {\message{OK}} -%D \stoptyping -%D -%D The first three calls result in the threefold message -%D \type{OK}, the fourth one shows the three elements of -%D \type{\first}. The command \type{\ExpandFirstAfter} takes -%D care of (first) arguments that are delimited by \type{[ ]}, -%D but the faster \type{\ExpandAfter} does not. - -\def\simpleExpandFirstAfter#1% - {\long\xdef\@@expanded{\noexpand\ExpandCommand{#1}}\@@expanded} - -\def\complexExpandFirstAfter[#1]% - {\long\xdef\@@expanded{\noexpand\ExpandCommand[#1]}\@@expanded} - -\def\ExpandFirstAfter#1% - {\let\ExpandCommand#1% - \doifnextoptionalelse\complexExpandFirstAfter\simpleExpandFirstAfter} - -\def\ExpandSecondAfter#1#2#3% - {\scratchtoks{#2}% - \long\xdef\@@expanded{\noexpand#1{\the\scratchtoks}{#3}}\@@expanded} - -\def\ExpandBothAfter#1#2#3% - {\long\xdef\@@expanded{\noexpand#1{#2}{#3}}\@@expanded} - -\def\ExpandAfter#1#2% - {\long\xdef\@@expanded{\noexpand#1{#2}}\@@expanded} - -%D Now we can for instance define \type{\ifinstringelse} as: - -\def\ifinstringelse - {\ExpandBothAfter\p!doifinstringelse} +\def\doifsamestring {\@@doifsamestringelse\firstofoneargument \gobbleoneargument } +\def\doifnotsamestring {\@@doifsamestringelse\gobbleoneargument \firstofoneargument } %D \macros %D {ConvertToConstant,ConvertConstantAfter} @@ -4221,7 +4532,7 @@ %D \CONTEXT only defines lowcased macros. \def\showdefinederror#1#2% - {\writestatus\m!systems{#1 #2 replaces a macro, use CAPITALS!}} + {\writestatus\m!system{#1 #2 replaces a macro, use CAPITALS!}} \def\checkdefined#1#2#3% {\doifdefined{#3}{\showdefinederror{#2}{#3}}} @@ -4283,8 +4594,6 @@ \newtoks\BeforePar \newtoks\AfterPar -\let\endoflinetoken=^^M - \def\redowithpar\par {\doifnextcharelse\par\redowithpar\dodowithpar}% @@ -4419,7 +4728,7 @@ {\ifx#2\empty % redundant but gives cleaner extensions #4{#1}% \else\ifnum#1<\zerocount - \normalexpanded{\noexpand\dorecurse{\number-\number#1}}{#4{-#2#3}}% + \normalexpanded{\dorecurse{\number-\number#1}}{#4{-#2#3}}% \else\ifx#2+% \dorecurse{#1}{#4{#3}}% \else @@ -4434,7 +4743,7 @@ %D \starttyping %D \bgroup %D -%D \catcode`\*=\@@superscript +%D \catcode`\*=\superscriptcatcode %D %D \gdef\redorepeatwithcommand[#1]% %D {\redodorepeatwithcommand#1*\empty*\relax} @@ -4941,9 +5250,9 @@ %D \PtToCm{dimension} %D \stoptyping -{\catcode`\.=\@@other - \catcode`\p=\@@other - \catcode`\t=\@@other +{\catcode`\.=\othercatcode + \catcode`\p=\othercatcode + \catcode`\t=\othercatcode \gdef\WITHOUTPT#1pt{#1}} \def\withoutpt#1% @@ -4976,18 +5285,16 @@ \def\numberofpoints #1{\the\numexpr\dimexpr#1\relax/\maxcard\relax} %D \macros -%D {swapdimens,swapmacros} +%D {swapdimens,swapcounts,swapmacros} %D %D Simple but effective are the next two macros. There name %D exactly states their purpose. The \type{\scratchdimen} and %D \type{\!!stringa} can only be swapped when being the first %D argument. -\def\swapdimens#1#2% - {\scratchdimen #1\redoglobal #1#2\dodoglobal #2\scratchdimen} - -\def\swapmacros#1#2% - {\let\!!stringa#1\redoglobal\let#1#2\dodoglobal\let#2\!!stringa} +\def\swapdimens#1#2{\scratchdimen #1\redoglobal #1#2\dodoglobal #2\scratchdimen} +\def\swapcounts#1#2{\scratchcounter#1\redoglobal #1#2\dodoglobal #2\scratchcounter} +\def\swapmacros#1#2{\let\!!stringa #1\redoglobal\let#1#2\dodoglobal\let#2\!!stringa} %D \macros %D {pushmacro,popmacro} @@ -5259,38 +5566,38 @@ %D We have to use a two||step implementation, because the %D expansion has to take place outside \type{\uppercase}. -\def\p!DOIF#1#2% - {\uppercase{\ifinstringelse{$#1$}{$#2$}}% +\unexpanded\def\DOIF#1#2% + {\uppercase{{$#1$}{$#2$}}% \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} -\def\p!DOIFNOT#1#2% - {\uppercase{\ifinstringelse{$#1$}{$#2$}}% +\unexpanded\def\DOIFNOT#1#2% + {\uppercase{{$#1$}{$#2$}}% \expandafter\gobbleoneargument \else \expandafter\firstofoneargument \fi} -\def\p!DOIFELSE#1#2% - {\uppercase{\ifinstringelse{$#1$}{$#2$}}% +\unexpanded\def\DOIFELSE#1#2% + {\uppercase{{$#1$}{$#2$}}% \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} -\def\p!DOIFINSTRINGELSE#1#2% - {\uppercase{\ifinstringelse{#1}{#2}}% +\unexpanded\def\DOIFINSTRINGELSE#1#2% + {\uppercase{{$#1$}{$#2$}}% \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} -\def\DOIF {\ExpandBothAfter\p!DOIF} -\def\DOIFNOT {\ExpandBothAfter\p!DOIFNOT} -\def\DOIFELSE {\ExpandBothAfter\p!DOIFELSE} -\def\DOIFINSTRINGELSE {\ExpandBothAfter\p!DOIFINSTRINGELSE} +\def\DOIF #1#2{\normalexpanded{\p!DOIF {#1}{#2}}} +\def\DOIFNOT #1#2{\normalexpanded{\p!DOIFNOT {#1}{#2}}} +\def\DOIFELSE #1#2{\normalexpanded{\p!DOIFELSE {#1}{#2}}} +\def\DOIFINSTRINGELSE #1#2{\normalexpanded{\p!DOIFINSTRINGELSE{#1}{#2}}} %D \macros %D {dosingleargumentwithset, @@ -5619,8 +5926,8 @@ \def\untexsomething {\begingroup - \catcode`\{=\@@ignore - \catcode`\}=\@@ignore + \catcode\leftbraceasciicode \ignorecatcode + \catcode\rightbraceasciicode\ignorecatcode \escapechar\minusone \dountexsomething} @@ -5896,8 +6203,18 @@ %D helps a lot. The second boolena can be used to inhibit %D processing completely. -\newif\iftrialtypesetting \trialtypesettingfalse -\newif\ifvisible \visibletrue +\newif\ifvisible \visibletrue + +\newtoks\everysettrialtypesetting +\newtoks\everyresettrialtypesetting + +\unexpanded\def\settrialtypesetting {\the\everysettrialtypesetting } % obeys grouping so +\unexpanded\def\resettrialtypesetting{\the\everyresettrialtypesetting} % this one is seldom needed + +\let\iftrialtypesetting\iffalse % so we have no \trialtypesettingtrue|false in mkiv ! + +\appendtoks \let\iftrialtypesetting\iftrue \to \everysettrialtypesetting +\appendtoks \let\iftrialtypesetting\iffalse \to \everyresettrialtypesetting %D \macros %D {startlocal, startglobal} @@ -6403,10 +6720,11 @@ %D %D This is a dirty one: we simply append a unit and discard it when needed. -\newdimen\roundingeps \roundingeps=10sp +\newdimen \roundingeps \roundingeps=10sp +\newconstant\compresult \def\comparedimension#1#2% - {\chardef\compresult + {\compresult \ifdim#1<#2% \zerocount \else\ifdim#1<#2% @@ -6416,7 +6734,7 @@ \fi\fi} \def\comparedimensioneps#1#2% todo: use eps feature - {\chardef\compresult + {\compresult \ifdim\dimexpr#1-#2\relax<\roudingeps \zerocount \else\ifdim\dimexpr#2-#1\relax<\roudingeps @@ -6461,9 +6779,10 @@ \dounspaced} \def\unspaceargument#1\to#2% - {\scratchcounter\catcode32\relax - \catcode32\@@ignore\scantextokens{\edef#2{#1}}% - \catcode32\scratchcounter} + {\scratchcounter\catcode\spaceasciicode + \catcode\spaceasciicode\ignorecatcode + \scantextokens{\edef#2{#1}}% + \catcode\spaceasciicode\scratchcounter} \def\unspaceafter#1#2% {\unspaceargument#2\to\ascii @@ -6609,8 +6928,8 @@ % \fi % \def\elapsedseconds{\expandafter\withoutpt\the\dimexpr\elapsedtime sp\relax} -\def\resettimer {\ctxlua{commands.resettimer()}} -\def\elapsedtime {\ctxlua{commands.elapsedtime()}} +\def\resettimer {\ctxcommand{resettimer()}} +\def\elapsedtime {\ctxcommand{elapsedtime()}} \let\elapsedseconds \elapsedtime \newcount\featuretest @@ -6624,10 +6943,10 @@ \def\retestfeature % timer support is new per 10/5/2005 {\bgroup \ifcase\interactionmode\let\wait\relax\fi - \writestatus\m!systems{starting feature test}\wait + \writestatus\m!system{starting feature test}\wait \resettimer \featuretest\zerocount \dotestfeature - \writestatus\m!systems{feature test done (\elapsedseconds s)}% + \writestatus\m!system{feature test done (\elapsedseconds s)}% \wait \egroup} @@ -6659,32 +6978,6 @@ \def\negated#1{\if-#1\else-#1\fi} % does only work in macros or text -% This permits things like ^\index{hans}^, where hans is -% duplicated in the text. - -\newif\ifduplicate - -\bgroup - -\gdef\checkduplication % in line with Knuth - {\ifmmode\expandafter^\else\expandafter\startduplication\fi} - -\gdef\insideduplication - {\ifmmode\expandafter^\else\expandafter\egroup\fi} - -\catcode`\^=\@@active - -\gdef\enableduplication - {\catcode`\^=\@@active \let^\checkduplication} - -\gdef\disableduplication - {\catcode`\^=\@@superscript} - -\gdef\startduplication - {\bgroup \duplicatetrue \let^\insideduplication} - -\egroup - \def\gobbleassigndimen#1\\{} \def\assigndimen#1#2% @@ -6744,14 +7037,6 @@ \long\def\@@if@@equal@@true #1\@@then#2#3{#2} \long\def\@@if@@equal@@false#1\@@then#2#3{#3} -%D new stuff : - -\def\partialexpanded#1% - {\let\@@notexpanded\noexpand - \long\xdef\@@expanded{\noexpand#1}% - \let\@@notexpanded\empty - \@@expanded} - \def\appended#1#2#3{\@EA#1\@EA#2\@EA{#2#3}} \def\appendvalue #1{\@EA\appended\@EA \def\csname#1\endcsname} \def\appendgvalue#1{\@EA\appended\@EA\gdef\csname#1\endcsname} @@ -6769,6 +7054,8 @@ %D bibliography module. The numbers compressor converts the %D list in a list of ranges. The normal compressor remove duplicate %D and empty entries. +%D +%D This is now obsolete (and more a \LUA\ thing anyway). \def\compresscommalistnrs[#1]% {\let\compressedlist\empty @@ -6877,18 +7164,6 @@ %D \stoplines %D \macros -%D {stripstring} -%D -%D Needed in bookmarks: -%D -%D \starttyping -%D {\sanitizePDFdocencoding test \CONTEXT\ test \to\oeps\stripstring\oeps\tttf[\oeps]} -%D \stoptyping - -\def\stripstring#1% #1 is \cs - {\edef\cs{\ctxlua{tex.sprint(tex.vrbcatcodes,string.strip(\!!bs\detokenize\expandafter{#1}\!!es))}}} - -%D \macros %D {dowithrange} %D %D This one is for Mojca Miklavec, who made me aware of the fact that @@ -6954,6 +7229,7 @@ \def\doprocesswords#1 #2\od {\doifsomething{#1}{\processword{#1} \doprocesswords#2 \od}} +% {\doifsomething{\detokenize{#1}}{\processword{#1} \doprocesswords#2 \od}} % to be tested \def\processwords#1% {\doprocesswords#1 \od}% no \unskip @@ -7012,7 +7288,18 @@ %D A variant for \type {\executeifdefined}: -\def\expandcheckedcsname#1#2#3% +% \def\expandcheckedcsname#1#2#3% +% {\csname#1\ifcsname#1#2\endcsname#2\else#3\fi\endcsname} + +\def\expandcheckedcsname#1#2% #2 is often a \xxxparameter so let's expand it once + {\normalexpanded{\noexpand\doexpandcheckedcsname{#1}{#2}}} + +\def\doexpandcheckedcsname#1#2#3% {\csname#1\ifcsname#1#2\endcsname#2\else#3\fi\endcsname} +%D Signal. Some fonts have a char0 rendering so we need to make sure that it +%D is not set in the font! + +\unexpanded\def\signalcharacter{\char\zerocount} % \zwj + \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/syst-con.lua b/Master/texmf-dist/tex/context/base/syst-con.lua index 638f3c797bf..bcc0205286e 100644 --- a/Master/texmf-dist/tex/context/base/syst-con.lua +++ b/Master/texmf-dist/tex/context/base/syst-con.lua @@ -13,13 +13,23 @@ converters = converters or { } the top of 's char range but outside the unicode range.

--ldx]]-- +local tonumber = tonumber local char, texsprint, format = unicode.utf8.char, tex.sprint, string.format -function converters.hexstringtonumber(n) texsprint(tonumber(n,16)) end -function converters.octstringtonumber(n) texsprint(tonumber(n, 8)) end -function converters.rawcharacter (n) texsprint(char(0x110000+n)) end -function converters.lchexnumber (n) texsprint(format("%x" ,n)) end -function converters.uchexnumber (n) texsprint(format("%X" ,n)) end -function converters.lchexnumbers (n) texsprint(format("%02x",n)) end -function converters.uchexnumbers (n) texsprint(format("%02X",n)) end -function converters.octnumber (n) texsprint(format("%03o",n)) end +function converters.hexstringtonumber(n) tonumber(n,16) end +function converters.octstringtonumber(n) tonumber(n, 8) end +function converters.rawcharacter (n) char(0x110000+n) end +function converters.lchexnumber (n) format("%x" ,n) end +function converters.uchexnumber (n) format("%X" ,n) end +function converters.lchexnumbers (n) format("%02x",n) end +function converters.uchexnumbers (n) format("%02X",n) end +function converters.octnumber (n) format("%03o",n) end + +function commands.hexstringtonumber(n) context(tonumber(n,16)) end +function commands.octstringtonumber(n) context(tonumber(n, 8)) end +function commands.rawcharacter (n) context(char(0x110000+n)) end +function commands.lchexnumber (n) context(format("%x" ,n)) end +function commands.uchexnumber (n) context(format("%X" ,n)) end +function commands.lchexnumbers (n) context(format("%02x",n)) end +function commands.uchexnumbers (n) context(format("%02X",n)) end +function commands.octnumber (n) context(format("%03o",n)) end diff --git a/Master/texmf-dist/tex/context/base/syst-con.mkiv b/Master/texmf-dist/tex/context/base/syst-con.mkiv index f7d4150a6e2..1091be85970 100644 --- a/Master/texmf-dist/tex/context/base/syst-con.mkiv +++ b/Master/texmf-dist/tex/context/base/syst-con.mkiv @@ -46,10 +46,10 @@ %D [\expandafter\uchexnumber\expandafter{\the\zerocount}] %D \stoptyping -\def\lchexnumber #1{\ctxlua{converters.lchexnumber(\number#1)}} -\def\uchexnumber #1{\ctxlua{converters.uchexnumber(\number#1)}} -\def\lchexnumbers#1{\ctxlua{converters.lchexnumbers(\number#1)}} -\def\uchexnumbers#1{\ctxlua{converters.uchexnumbers(\number#1)}} +\def\lchexnumber #1{\ctxcommand{lchexnumber(\number#1)}} +\def\uchexnumber #1{\ctxcommand{uchexnumber(\number#1)}} +\def\lchexnumbers#1{\ctxcommand{lchexnumbers(\number#1)}} +\def\uchexnumbers#1{\ctxcommand{uchexnumbers(\number#1)}} \let\hexnumber\uchexnumber @@ -58,7 +58,7 @@ %D %D For unicode remapping purposes, we need octal numbers. -\def\octnumber#1{\ctxlua{converters.octnumber(\number#1)}} +\def\octnumber#1{\ctxcommand{octnumber(\number#1)}} %D \macros %D {hexstringtonumber,octstringtonumber} @@ -67,8 +67,8 @@ %D a decimal number, thereby taking care of lowercase characters %D as well. -\def\hexstringtonumber#1{\ctxlua{converters.hexstringtonumber("#1")}} -\def\octstringtonumber#1{\ctxlua{converters.octstringtonumber("#1")}} +\def\hexstringtonumber#1{\ctxcommand{hexstringtonumber("#1")}} +\def\octstringtonumber#1{\ctxcommand{octstringtonumber("#1")}} %D \macros %D {rawcharacter} @@ -76,7 +76,7 @@ %D This macro can be used to produce proper 8 bit characters %D that we sometimes need in backends and round||trips. -\def\rawcharacter#1{\ctxlua{converters.rawcharacter(\number#1)}} +\def\rawcharacter#1{\ctxcommand{rawcharacter(\number#1)}} %D \macros %D {twodigits, threedigits} @@ -134,12 +134,18 @@ % \let\calculatecos\gobbleoneargument % \let\calculatetan\gobbleoneargument -% \def\calculatedsin#1{\ctxlua{tex.sprint(tex.ctxcatcodes,math.sin(#1))}} -% \def\calculatedcos#1{\ctxlua{tex.sprint(tex.ctxcatcodes,math.cos(#1))}} -% \def\calculatedtan#1{\ctxlua{tex.sprint(tex.ctxcatcodes,math.tan(#1))}} +% \def\calculatedsin#1{\ctxsprint{math.sin(#1)}} +% \def\calculatedcos#1{\ctxsprint{math.cos(#1)}} +% \def\calculatedtan#1{\ctxsprint{math.tan(#1)}} -\def\setcalculatedsin#1#2{\edef#1{\ctxlua{tex.sprint(tex.ctxcatcodes,math.sind(#2))}}} -\def\setcalculatedcos#1#2{\edef#1{\ctxlua{tex.sprint(tex.ctxcatcodes,math.cosd(#2))}}} -\def\setcalculatedtan#1#2{\edef#1{\ctxlua{tex.sprint(tex.ctxcatcodes,math.tand(#2))}}} +% \def\setcalculatedsin#1#2{\edef#1{\ctxsprint{math.sind(#2)}}} +% \def\setcalculatedcos#1#2{\edef#1{\ctxsprint{math.cosd(#2)}}} +% \def\setcalculatedtan#1#2{\edef#1{\ctxsprint{math.tand(#2)}}} + +% this is actually 20% faster: some overhead in functions but less tokenization + +\def\setcalculatedsin#1#2{\edef#1{\cldcontext{math.sind(#2)}}} +\def\setcalculatedcos#1#2{\edef#1{\cldcontext{math.cosd(#2)}}} +\def\setcalculatedtan#1#2{\edef#1{\cldcontext{math.tand(#2)}}} \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/syst-ext.mkii b/Master/texmf-dist/tex/context/base/syst-ext.mkii index 73fb98b728f..2357e81f1b1 100644 --- a/Master/texmf-dist/tex/context/base/syst-ext.mkii +++ b/Master/texmf-dist/tex/context/base/syst-ext.mkii @@ -121,21 +121,21 @@ \dodoglobal\@if#1{false}% \escapechar\scratchcounter} -%D Also new: +%D Also: \def\define#1% {\ifx#1\undefined - \expandafter\def + \expandafter\long\expandafter\def \else \message{[\noexpand#1is already defined]}% - \expandafter\def\expandafter\gobbleddefinition + \expandafter\long\expandafter\def\expandafter\gobbleddefinition \fi#1} \def\redefine#1% {\ifx#1\undefined\else \message{[\noexpand#1is redefined]}% \fi - \def#1} + \long\def#1} % \define\hans{hans} % \redefine\hans{hans} @@ -4991,9 +4991,9 @@ \def\comparedimensioneps#1#2% {\chardef\compresult - \ifdim\dimexpr(#1-#2)<\roudingeps + \ifdim\dimexpr#1-#2\relax<\roudingeps \zerocount - \else\ifdim\dimexpr(#2-#1)<\roudingeps + \else\ifdim\dimexpr#2-#1\relax<\roudingeps \zerocount \else\ifdim#1<#2% \plusone diff --git a/Master/texmf-dist/tex/context/base/syst-ini.mkii b/Master/texmf-dist/tex/context/base/syst-ini.mkii new file mode 100644 index 00000000000..c2c3e1947d2 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/syst-ini.mkii @@ -0,0 +1,923 @@ +%D \module +%D [ file=syst-ini, +%D version=2008.11.04, % 2001.11.16, % 1999.03.17, % an oldie: 1995.10.10 +%D title=\CONTEXT\ System Macros, +%D subtitle=Bootstrapping \TEX, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D We used to load plain \TEX\ in a special way, but redefining +%D a couple of primitives so that for instance font loading was +%D ignored. For those interested, this loader is found in +%D \type {syst-tex.tex}. Some of the comment's are Don Knuth's +%D and more of it can be found in the plain \TEX\ format. + +%D Characters can have special states, that can be triggered +%D by setting their category coded. Some are preset, others +%D are to be set as soon as possible, otherwise we cannot +%D define any useful macros. + +%catcode`\^^@ = 9 % ascii null is ignored +%catcode`\\ = 0 % backslash is TeX escape character + +\catcode`\{ = 1 % left brace is begin-group character +\catcode`\} = 2 % right brace is end-group character +\catcode`\$ = 3 % dollar sign is math shift +\catcode`\& = 4 % ampersand is alignment tab +\catcode`\# = 6 % hash mark is macro parameter character +\catcode`\^ = 7 % circumflex and uparrow are for superscripts +\catcode`\_ = 8 % underline and downarrow are for subscripts +\catcode`\^^I = 10 % ascii tab is a blank space + +%catcode`\^^M = 5 % ascii return is end-line +%catcode`\% = 14 % percent sign is comment character +%catcode`\ = 10 % ascii space is blank space +%catcode`\^^? = 15 % ascii delete is invalid + +\catcode`\~ = 13 % tilde is active +\catcode`\^^L = 13 % ascii form-feed + +%catcode`\A = 11 +%....... +%catcode`\Z = 11 + +%catcode`\a = 11 +%....... +%catcode`\z = 11 + +\chardef\activecatcode = 13 % later this will become a counter + +\def ^^L{\par} +\def\^^M{\ } % control = control +\def\^^I{\ } % same for + +%D In \CONTEXT, we simply ignore end||of||file tokens: + +\catcode`\^^Z=9 + +%D It makes sense to know what engine we're running so let's +%D try to deduce it. + +\chardef\unknownengine = 0 +\chardef\pdftexengine = 1 +\chardef\xetexengine = 2 +\chardef\luatexengine = 3 + +\ifx\directlua\undefined + \ifx\XeTeXversion\undefined + \ifx\pdftexversion\undefined + \let\texengine\unknownengine + \else + \let\texengine\pdftexengine + \fi + \else + \let\texengine\xetexengine + \fi +\else + \let\texengine\luatexengine +\fi + +\ifnum\texengine=\unknownengine + \immediate\write16{>>>} + \immediate\write16{>>> only pdftex, xetex and luatex are supported} + \immediate\write16{>>>} + \let\dump\relax + \expandafter\end +\fi + +% todo: pdfsave pdfrestore pdfcolor... don't initialize them + +\ifnum\texengine=\luatexengine + \directlua 0 { % this info is stored in the format + lua.name[0] = "main ctx instance" + local extraprimitives = tex.extraprimitives + local enableprimitives = tex.enableprimitives + local core = extraprimitives('core') + local btex = extraprimitives('tex') + local etex = extraprimitives('etex') + local pdftex = extraprimitives('pdftex') + local luatex = extraprimitives('luatex') + local omega = { + "textdir", "pagedir", "mathdir", "pardir", "bodydir", + "leftghost", "rightghost", "localleftbox", "localrightbox", + "localinterlinepenalty", "localbrokenpenalty", + } + local aleph = { + "boxdir", "pagebottomoffset", "pagerightoffset", + } + for _, subset in next, { etex, pdftex, luatex, omega, aleph } do + enableprimitives('',subset) + end + for _, subset in next, { core, btex, etex, pdftex, luatex, omega, aleph } do + enableprimitives('normal',subset) + end + } +\fi + +%D \ETEX\ has a not so handy way of telling you the version number, +%D i.e. the revision number has a period in it: + +\long\def\gobbleoneargument#1{} % will be defined later on anyway + +\mathchardef\etexversion = + \numexpr\eTeXversion*100+\expandafter\gobbleoneargument\eTeXrevision\relax + +%D First we define a simplified version of the \CONTEXT\ +%D protection mechanism. + +\def\unprotect{\catcode`@=11 } +\def\protect {\catcode`@=12 } + +\unprotect + +%D Some pretty important definitions: + +\let\bgroup={ +\let\egroup=} + +%D Allocation of registers is done slightly different than in plain +%D \TEX. First of all we use different reserved counters. We also +%D don't implement a family handler because users are not supposed +%D to implement their own math. We reserve the lowest 31 registers +%D for scratch purposes. Keep in mind that in the core engine +%D some registers are reserved: counters 0 upto 9, and counter 255. +%D +%D As with plain \TEX\ we recommend that macro designers always use +%D \type {\global} assignments with respect to registers numbered 1, +%D 3, 5 \unknown\ 31, and always non||\type {\global} assignments +%D with respect to registers 0, 2, 4, \unknown\ 30. This will prevent +%D \quote {save stack buildup} that might otherwise occur. +%D +%D We reserve some registers for special (management) purposes: + +% 0 - 20 : scratch +% 21 - 127 : internal +% 128 - 254 : inserts +% 255 : page +% 256 - : user + +\countdef \minallocatedregister = 52 \minallocatedregister = 256 +\countdef \maxallocatedregister = 53 \maxallocatedregister = 32767 +\countdef \minallocatediochannel = 54 \minallocatediochannel = -1 +\countdef \maxallocatediochannel = 55 \maxallocatediochannel = 16 +\countdef \minallocatedlanguage = 56 \minallocatedlanguage = 0 +\countdef \maxallocatedlanguage = 57 \maxallocatedlanguage = 255 +\countdef \maxallocatedinsert = 58 \maxallocatedinsert = 254 +\countdef \minallocatedinsert = 59 \minallocatedinsert = 128 +\countdef \minallocatedfamily = 60 \minallocatedfamily = 128 +\countdef \maxallocatedfamily = 61 \maxallocatedfamily = 255 + +\countdef \lastallocatedcount = 32 \lastallocatedcount = \minallocatedregister +\countdef \lastallocateddimen = 33 \lastallocateddimen = \minallocatedregister +\countdef \lastallocatedskip = 34 \lastallocatedskip = \minallocatedregister +\countdef \lastallocatedmuskip = 35 \lastallocatedmuskip = \minallocatedregister +\countdef \lastallocatedbox = 36 \lastallocatedbox = \minallocatedregister +\countdef \lastallocatedtoks = 37 \lastallocatedtoks = \minallocatedregister +\countdef \lastallocatedread = 38 \lastallocatedread = \minallocatediochannel +\countdef \lastallocatedwrite = 39 \lastallocatedwrite = \minallocatediochannel +\countdef \lastallocatedmarks = 40 \lastallocatedmarks = \minallocatedregister +\countdef \lastallocatedlanguage = 41 \lastallocatedlanguage = \minallocatedlanguage % not used in context +\countdef \lastallocatedinsertion = 42 \lastallocatedinsertion = \minallocatedinsert +\countdef \lastallocatedfamily = 43 \lastallocatedfamily = \minallocatedfamily % not used in context +\countdef \lastallocatedattribute = 44 \lastallocatedattribute = \minallocatedregister + +\countdef \mincountervalue = 125 \mincountervalue = -"7FFFFFFF % beware, we use index 125 at the lua end +\countdef \maxcountervalue = 126 \maxcountervalue = "7FFFFFFF % beware, we use index 126 at the lua end + +%countdef \minusone = 127 \minusone = -1 +%chardef \zerocount = 0 +%chardef \plusone = 1 + +\countdef \zerocount = 120 \zerocount = 0 +\countdef \plusone = 121 \plusone = 1 +\countdef \minusone = 122 \minusone = -1 + +%chardef \normalpagebox = 255 +\countdef \normalpagebox = 127 \normalpagebox = 255 % hardcoded in pdftex/xetex + +% A few traditional allocations: + +\countdef \count@ = 255 % hm, used in \newif .. todo: replace it there +\dimendef \dimen@ = 0 +\dimendef \dimen@i = 1 % global only +\dimendef \dimen@ii = 2 + +%D So, effectively we start allocating from 256 and upwards. The +%D inserts sit in the range 128 upto 254. Page numbers use the +%D counters 0 upto 9 and the pagebox is 255. Users can use the +%D scratch registers upto 31 without problem but all others are +%D reserved. + +\def\wlog#1{} % \def\wlog{\immediate\write\minusone} % write on log file (only) + +%D The allocators share a common helper macro. + +\def\newcount {\allocateregister\lastallocatedcount \count \countdef \maxallocatedregister} +\def\newdimen {\allocateregister\lastallocateddimen \dimen \dimendef \maxallocatedregister} +\def\newskip {\allocateregister\lastallocatedskip \skip \skipdef \maxallocatedregister} +\def\newmuskip {\allocateregister\lastallocatedmuskip \muskip \muskipdef \maxallocatedregister} +\def\newbox {\allocateregister\lastallocatedbox \box \mathchardef\maxallocatedregister} +\def\newtoks {\allocateregister\lastallocatedtoks \toks \toksdef \maxallocatedregister} +\def\newread {\allocateregister\lastallocatedread \read \chardef \maxallocatediochannel} +\def\newwrite {\allocateregister\lastallocatedwrite \write \chardef \maxallocatediochannel} +\def\newmarks {\allocateregister\lastallocatedmarks \marks \mathchardef\maxallocatedregister} +\def\newinsert {\allocateregister\lastallocatedinsertion\insert \chardef \maxallocatedinsert} + +%D We don't need these in \CONTEXT: + +\def\newlanguage{\allocateregister\lastallocatedlanguage \language\chardef \maxallocatedlanguage} +\def\newfamily {\allocateregister\lastallocatedfamily \fam \chardef \maxallocatedfamily} + +\let\newfam\newfamily + +% Watch out, for the moment we disable the check for already being defined +% later we will revert this but first all chardefs must be replaced. + +\def\newconstant #1{\ifdefined#1\let#1\undefined\fi\newcount#1} +\def\setnewconstant#1{\ifdefined#1\let#1\undefined\fi\newcount#1#1} % just a number + +% maybe setconstant with check + +% %D The next definitions are really needed (in \CONTEXT): + +%newlinechar=10 \def\outputnewlinechar{\rawcharacter{10}} +\newlinechar=10 \edef\outputnewlinechar{^^J} + +%D One reason to start high with allocation is that it permits us to +%D allocate consecutive ranges more easily, for instance in \MPLIB\ +%D we want to allocate a continuous range of boxes. It also permits us +%D to do a proper upward allocation for inserts. The current code +%D evolved from code that dealt with older engines but as all engines +%D now provide many registers we removed all traces. + +\def\writestatus#1#2{\immediate\write16{#1: #2}} \def\space { } + +\def\allocateregisteryes#1#2#3#4#5% last class method max name + {\ifnum#1<#4\relax + \global\advance#1\plusone + \global#3#5=#1\relax + \else + \writestatus{warning}{no room for \string#2\space \string#5\space (max: \number#4)}% + \fi} + +\def\allocateregisternop#1#2#3#4#5% last class method max name + {\writestatus{warning}{\string#2 \string#5 is already defined (\string\relax\space it first)}} + +\def\allocateregister#1#2#3#4#5% last class method max name + {\ifx#5\undefined + \expandafter\allocateregisteryes + \else\ifx#5\relax + \expandafter\expandafter\expandafter\allocateregisteryes + \else + \expandafter\expandafter\expandafter\allocateregisternop + \fi\fi + #1#2#3#4#5} + +%D Since the number of chars exceed 256 now, we can use \type +%D {\chardef} instead of the more limited \type {\mathchardef}. + +\ifnum\texengine>\pdftexengine + \def\newbox {\allocateregister\lastallocatedbox \box \chardef\maxallocatedregister} + \def\newmarks{\allocateregister\lastallocatedmarks\marks\chardef\maxallocatedregister} +\fi + +%D Attributes are something very \LUATEX. In \CONTEXT\ you are not +%D supposed to use the attributes directly but always allocate then +%D first. For instance attribute~0 is reserved for special purposes +%D (this might change). + +\ifnum\texengine=\luatexengine + \let\attributeunsetvalue\mincountervalue % used to be \minusone + \def\newattribute{\allocateregister\lastallocatedattribute\attribute\attributedef\maxallocatedregister} +\fi + +%D Not used by \CONTEXT\ but for instance \PICTEX\ needs it. It's a +%D trick to force strings instead of tokens that take more memory. +%D It's a trick to trick to force strings. + +\def\newhelp#1#2{\newtoks#1#1\expandafter{\csname#2\endcsname}} + +%D \macros +%D {scratchcounter, +%D scratchdimen,scratchskip,scratchmuskip, +%D scratchbox, +%D scratchtoks} +%D +%D We now define a few scratch registers, so that successive +%D loads at least have some available. + +\newcount \scratchcounter \newcount \globalscratchcounter +\newdimen \scratchdimen \newdimen \globalscratchdimen +\newskip \scratchskip \newskip \globalscratchskip +\newmuskip \scratchmuskip \newmuskip \globalscratchmuskip +\newtoks \scratchtoks \newtoks \globalscratchtoks +\newbox \scratchbox \newbox \globalscratchbox + +\newcount\scratchcounterone \newcount\scratchcountertwo \newcount\scratchcounterthree +\newdimen \scratchdimenone \newdimen \scratchdimentwo \newdimen \scratchdimenthree +\newdimen \scratchskipone \newdimen \scratchskiptwo \newdimen \scratchskipthree +\newbox \scratchmuskipone \newbox \scratchmuskiptwo \newbox \scratchmuskipthree +\newtoks \scratchtoksone \newtoks \scratchtokstwo \newtoks \scratchtoksthree +\newbox \scratchboxone \newbox \scratchboxtwo \newbox \scratchboxthree + +%D More allocations: + +\newskip \zeroskip \zeroskip = 0pt plus 0pt minus 0pt +\newdimen\zeropoint \zeropoint = 0pt +\newdimen\onepoint \onepoint = 1pt +\newdimen\maxdimen \maxdimen = 16383.99999pt +\newdimen\onebasepoint \onebasepoint = 1bp +\newdimen\scaledpoint \scaledpoint = 1sp +\newdimen\thousandpoint\thousandpoint= 1000pt + +\let\points\onepoint + +\newtoks \emptytoks + +%D And even more: (todo: countdefs 60+) + +%newcount \minusone \minusone = -1 +\newcount \minustwo \minustwo = -2 +%chardef \zerocount = 0 +%chardef \plusone = 1 +\chardef \plustwo = 2 +\chardef \plusthree = 3 +\chardef \plusfour = 4 +\chardef \plusfive = 5 +\chardef \plussix = 6 +\chardef \plusseven = 7 +\chardef \pluseight = 8 +\chardef \plusnine = 9 +\chardef \plusten = 10 +\chardef \plussixteen = 16 +\chardef \plushundred = 100 +\chardef \pluscxxvii = 127 +\chardef \pluscxxviii = 128 +\chardef \pluscclv = 255 + +\ifnum\texengine=\luatexengine + \chardef \pluscclvi = 256 + \chardef \plusthousand = 1000 + \chardef \plustenthousand = 10000 + \chardef \plustwentythousand = 20000 + \chardef \medcard = 32768 + \chardef \maxcard = 65536 % pdftex has less mathchars +\else + \mathchardef\pluscclvi = 256 + \mathchardef\plusthousand = 1000 + \mathchardef\plustenthousand = 10000 + \mathchardef\plustwentythousand = 20000 + \newcount \medcard \medcard = 32768 % pdftex has less mathchars + \newcount \maxcard \maxcard = 65536 % pdftex has less mathchars +\fi + +%D We prefer the more readable variant than in plain +%D \TEX. User should only use \type {\emptybox}: + +\newbox\voidbox % public + +\let\normalhbox\hbox +\let\normalvbox\vbox + +\def\unvoidbox{\unhbox\voidbox} +\def\emptybox {\box \voidbox} % used in initializations so no attributes +\def\emptyvbox{\normalvbox{}} % no copy as we need to set attributes +\def\emptyhbox{\normalhbox{}} % no copy as we need to set attributes + +\let\leavevmode\unvoidbox % we prefer to use \dontleavehmode + +%D Some expected plain variants follow. We don't reuse registers +%D because we don't want clashes. + +\newdimen\p@ \p@ \onepoint +\newcount\m@ne \m@ne \minusone +\newdimen\z@ \z@ \zeropoint +\let \@ne \plusone +\let \tw@ \plustwo +\let \thr@@ \plusthree +\let \sixt@@n \sixteen +\let \@cclv \pluscclv +\let \@cclvi \pluscclvi +\newbox \voidb@x +\newtoks \toks@ + +%D We define \type {\newif} a la plain \TEX, but will +%D redefine it later. As Knuth says: +%D +%D \startnarrower +%D And here's a different sort of allocation: for example, +%D +%D \starttyping +%D \newif\iffoo +%D \stoptyping +%D +%D creates \type {\footrue}, \type {\foofalse} to go +%D with \type {\iffoo}. +%D \stopnarrower + +\def\newif#1% + {\count@\escapechar + \escapechar\minusone + \expandafter\expandafter\expandafter\def\@if #1{true}{\let#1\iftrue }% + \expandafter\expandafter\expandafter\def\@if#1{false}{\let#1\iffalse}% + \@if#1{false}% the condition starts out false + \escapechar\count@} + +\def\@if#1#2% + {\csname\expandafter\if@\string#1#2\endcsname} + +\bgroup % `if' is required + + \uccode`1=`i \uccode`2=`f \uppercase{\gdef\if@12{}} + +\egroup + +%D Let's test this one: + +\newif\ifdone + +%D Potential primitive in \LUATEX: + +\ifdefined\htdp \else \def\htdp#1{\dimexpr\ht#1+\dp#1\relax} \fi + +%D \macros +%D {@@escape,@@begingroup,@@endgroup,@@mathshift,@@alignment, +%D @@endofline,@@parameter,@@superscript,@@subscript, +%D @@ignore,@@space,@@letter,@@other,@@active,@@comment} +%D +%D In \CONTEXT\ we sometimes manipulate the \CATCODES\ of certain +%D characters. Because we are not that good at remembering numbers, +%D we introduce some symbolic names. + +%D As we now have catc-* files, we also have more readable names but +%D We will keep the following around for a while. + +\chardef\@@escape = 0 +\chardef\@@begingroup = 1 +\chardef\@@endgroup = 2 +\chardef\@@mathshift = 3 +\chardef\@@alignment = 4 +\chardef\@@endofline = 5 +\chardef\@@parameter = 6 +\chardef\@@superscript = 7 +\chardef\@@subscript = 8 +\chardef\@@ignore = 9 +\chardef\@@space = 10 +\chardef\@@letter = 11 +\chardef\@@other = 12 +\chardef\@@active = 13 +\chardef\@@comment = 14 + +%D Constants to be used with \type {\currentgrouptype}. + +\chardef\@@bottomlevelgroup = 0 +\chardef\@@simplegroup = 1 +\chardef\@@hboxgroup = 2 +\chardef\@@adjustedhboxgroup = 3 +\chardef\@@vboxgroup = 4 +\chardef\@@vtopgroup = 5 +\chardef\@@aligngroup = 6 +\chardef\@@noaligngroup = 7 +\chardef\@@outputgroup = 8 +\chardef\@@mathgroup = 9 +\chardef\@@discretionarygroup = 10 +\chardef\@@insertgroup = 11 +\chardef\@@vcentergroup = 12 +\chardef\@@mathchoicegroup = 13 +\chardef\@@semisimplegroup = 14 +\chardef\@@mathshiftgroup = 15 +\chardef\@@mathleftgroup = 16 + +\chardef\@@vadjustgroup = \@@insertgroup + +%D Constants to be used with \type {\interactionmode}. + +\chardef\@@batchmode = 0 +\chardef\@@nonstopmode = 1 +\chardef\@@scrollmode = 2 +\chardef\@@errorstopmode = 3 + +%D Constants to be used with \type {\lastnodetype}. The \type +%D {\lastnodetype} primitive is \ETEX\ compliant. The valid range is +%D still -1 .. 15 and glyph nodes have number 0 (used to be char +%D node) and ligature nodes are mapped to 7. That way macro packages +%D can use the same symbolic names as in traditional \ETEX. Keep in +%D mind that the internal node numbers are different and that there +%D are more node types that 15. + +\chardef\@@charnode = 0 +\chardef\@@hlistnode = 1 +\chardef\@@vlistnode = 2 +\chardef\@@rulenode = 3 +\chardef\@@insertnode = 4 +\chardef\@@marknode = 5 +\chardef\@@adjustnode = 6 +\chardef\@@ligaturenode = 7 +\chardef\@@discretionarynode = 8 +\chardef\@@whatsitnode = 9 +\chardef\@@mathnode = 10 +\chardef\@@gluenode = 11 +\chardef\@@kernnode = 12 +\chardef\@@penaltynode = 13 +\chardef\@@unsetnode = 14 +\chardef\@@mathsnode = 15 + +%D Constants to be used with \type {\currentiftype}. + +\chardef\@@charif = 1 +\chardef\@@catif = 2 +\chardef\@@numif = 3 +\chardef\@@dimif = 4 +\chardef\@@oddif = 5 +\chardef\@@vmodeif = 6 +\chardef\@@hmodeif = 7 +\chardef\@@mmodeif = 8 +\chardef\@@innerif = 9 +\chardef\@@voidif = 10 +\chardef\@@hboxif = 11 +\chardef\@@vboxif = 12 +\chardef\@@xif = 13 +\chardef\@@eofif = 14 +\chardef\@@trueif = 15 +\chardef\@@falseif = 16 +\chardef\@@caseif = 17 +\chardef\@@definedif = 18 +\chardef\@@csnameif = 19 +\chardef\@@fontcharif = 20 + +%D Of course we want even bigger log files, so we copied this +%D from the \ETEX\ source files. +%D +%D When watching such logs, beware of nasty side effects of +%D \type {\scantokens}, as in: +%D +%D \starttyping +%D \bgroup +%D \lccode`a=12\lowercase{\xdef\whatever{a}}\egroup +%D \def\whatever{test \whatever test} +%D \scantokens\expandafter{\whatever} +%D \egroup +%D \stoptyping +%D +%D In \LUATEX\ we have ways around this. + +\def\tracingall + {\tracingonline \plusone + \tracingcommands \plusthree + \tracingstats \plustwo + \tracingpages \plusone + \tracingoutput \plusone + \tracinglostchars \plustwo + \tracingmacros \plustwo + \tracingparagraphs\plusone + \tracingrestores \plusone + \showboxbreadth \maxdimen + \showboxdepth \maxdimen + \tracinggroups \plusone + \tracingifs \plusone + \tracingscantokens\plusone + \tracingnesting \plusone + \tracingassigns \plustwo + \errorstopmode} + +\def\loggingall + {\tracingall + \tracingonline \zerocount} + +\def\tracingnone + {\tracingassigns \zerocount + \tracingnesting \zerocount + \tracingscantokens\zerocount + \tracingifs \zerocount + \tracinggroups \zerocount + \showboxdepth \plusthree + \showboxbreadth \plusfive + \tracingrestores \zerocount + \tracingparagraphs\zerocount + \tracingmacros \zerocount + \tracinglostchars \plusone + \tracingoutput \zerocount + \tracingpages \zerocount + \tracingstats \zerocount + \tracingcommands \zerocount + \tracingonline \zerocount} + +%D Just for tracing purposes we set: + +\tracingstats\plusone + +%D Here we also save \type {\input}, more will be saved later. + +\ifdefined\normalinput \else \let\normalinput\input \fi + +%D We don't like outer commands, and we always want access +%D to the original \type {\input} primitive. + +\let\normalouter\outer \def\outer{} % no longer \relax + +%D To circumvent dependencies, we can postpone certain +%D initializations to dumping time, by appending them to the +%D \type {\everydump} token register. + +\ifdefined\normaldump \else \let\normaldump\dump \fi + +\newtoks\everydump + +\def\dump{\the\everydump\normaldump} + +%D The same applies for the startup actions. + +\ifdefined\normaleveryjob \else \let\normaleveryjob\everyjob \fi + +\let\everyjob\relax \newtoks\everyjob + +\normaleveryjob{\the\everyjob} + +\def\appendtotoks #1{\def\temp{#1}\afterassignment\doappendtotoks \scratchtoks=} +\def\prependtotoks#1{\def\temp{#1}\afterassignment\doprependtotoks\scratchtoks=} + +\def\doappendtotoks {\expandafter\expandafter\expandafter{\expandafter\the\expandafter\temp\the\scratchtoks}} +\def\doprependtotoks{\expandafter\expandafter\expandafter{\expandafter\the\expandafter\scratchtoks\the\temp}} + +%D \macros +%D {begcsname} +%D +%D Handy for \ETEX-only usage (avoids making \type {\relax}'s: + +\def\begcsname#1\endcsname{\ifcsname#1\endcsname\csname#1\endcsname\fi} + +%D Now come a few macros that might be needed in successive loading: + +\let\endgraf\par +\let\endline\cr + +\def\space{ } +\def\empty{} +\def\null {\hbox{}} + +%D The following two might be overloaded later on but some modules need +%D then earlier. These functionality is reflected in the name and will not +%D change. + +\bgroup + \catcode`\^^M=\activecatcode% + \gdef\obeylines{\catcode`\^^M\activecatcode \let^^M\par}% + \global\let^^M\par% +\egroup + +\bgroup + \gdef\obeyspaces{\catcode`\ \activecatcode}% + \obeyspaces\global\let =\space% +\egroup + +%D A constant: + +\let\endoflinetoken=^^M + +%D Also needed might be a simple loop structure and we borrow +%D plain \TEX's one as it is often expected to be present and +%D it is about the fastest you can get. Beware: this macro +%D does not support nested loops. We use a namespace prefix +%D \type {@@pln}. + +\long\def\loop#1\repeat{\long\def\@@plnbody{#1}\@@plniterate} + +%D The following makes \type {\loop} \unknown\ \type {\if} +%D \unknown\ \type {\repeat} skippable (clever trick): + +\let\repeat\fi % so both \loop and \repeat are reserved words! + +%D The original (no \type {@@pln} there): +%D +%D \starttyping +%D \def\@@plniterate{\@@plnbody\let\next\@@plniterate\else\let\next\relax\fi\next} +%D \stoptyping +%D +%D A more efficient alternative: +%D +%D \starttyping +%D \def\@@plniterate{\@@plnbody\expandafter\@@plniterate\else\expandafter\relax\fi} +%D \stoptyping +%D +%D An even more efficient one: + +\def\@@plniterate{\@@plnbody\expandafter\@@plniterate\else\fi} + +%D We don't define a real output routine yet but at least get rid +%D of pages: + +\output{\shipout\box\normalpagebox} + +%D Although we don't add pagenumbers yet we alias the default +%D register used for counting pages: + +\countdef\pageno=0 \pageno=1 % first page is number 1 + +%D Beside the raw counter \type {\pageno} the \type {\folio} +%D macro provides the value. + +\def\folio{\the\pageno} % kind of expected and therefore reserved + +%D The following registers are kind of standard and (for the moment) +%D we define them here. This might change. + +\newskip \bigskipamount \bigskipamount = 12pt plus 4pt minus 4pt +\newskip \medskipamount \medskipamount = 6pt plus 2pt minus 2pt +\newskip \smallskipamount \smallskipamount = 3pt plus 1pt minus 1pt + +\baselineskip = 12pt +\lineskip = 1pt +\lineskiplimit = 0pt + +%D Again a few kind-of-extensions the core: + +\newskip \hideskip \hideskip = -1000pt plus 1fill +\newskip \centering \centering = 0pt plus 1000pt minus 1000pt + +\def\hidewidth % for alignment entries that can stick out + {\hskip\hideskip} + +\def\ialign % initialized \halign + {\everycr{}% + \tabskip\zeroskip + \halign} + +\newcount \mscount + +\def\spanomit{\span\omit} % bypass error message + +\def\multispan#1% + {\omit + \mscount#1\relax + \loop + \ifnum\mscount>\plusone + \spanomit \advance\mscount\minusone + \repeat} + +%D The next section deals with selective definitions in +%D later modules. One can of course use the \type {\texengine} +%D number that we defined earlier instead. + +\bgroup \obeylines + \gdef\pickupSOMETEX#1% + {\expandafter\gdef\csname begin#1\endcsname{\bgroup\obeylines\dopickupSOMETEX{#1}}} + \gdef\dopickupSOMETEX#1#2 + % {\egroup\immediate\write16{special code for #1 -> [line \the\inputlineno] \detokenize{#2}}} + {\egroup} +\egroup + +\let\endTEX \relax \long\def\beginTEX #1\endTEX {} +\let\endETEX \relax \long\def\beginETEX #1\endETEX {} +\let\endXETEX \relax \long\def\beginXETEX #1\endXETEX {} +\let\endLUATEX\relax \long\def\beginLUATEX#1\endLUATEX{} +\let\endOLDTEX\relax \long\def\beginOLDTEX#1\endOLDTEX{} +\let\endNEWTEX\relax \long\def\beginNEWTEX#1\endNEWTEX{} + +\pickupSOMETEX{ETEX} + +\ifnum\texengine=\xetexengine + \pickupSOMETEX{XETEX} +\fi +\ifnum\texengine=\luatexengine + \pickupSOMETEX{LUATEX} +\fi +\ifnum\texengine<\xetexengine + \pickupSOMETEX{OLDTEX} +\else + \pickupSOMETEX{NEWTEX} +\fi + +%D \macros +%D {bindprimitive} +%D +%D We can remap primitives (which is needed because of changes in +%D for instance \PDFTEX). + +\def\bindprimitive#1 #2 % new old + {\ifcsname#1\endcsname \else \ifcsname#2\endcsname + \expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname + \fi \fi} + +%D Because \XETEX\ also implements some \PDFTEX\ functionality, we take +%D care of this here instead of a dedicated module. Later modules need +%D to handle the undefined cases. + +%D These messy checks will disappear. + +% new after 1.10, watch the change in prefix + +\bindprimitive quitvmode ptexquitvmode +\bindprimitive noligatures ptexnoligatures +\bindprimitive setrandomseed ptexsetrandomseed +\bindprimitive uniformdeviate ptexuniformdeviate + +\bindprimitive quitvmode pdfquitvmode +\bindprimitive noligatures pdfnoligatures +\bindprimitive setrandomseed pdfsetrandomseed +\bindprimitive uniformdeviate pdfuniformdeviate + +\bindprimitive resettimer pdfresettimer +\bindprimitive elapsedtime pdfelapsedtime + +% new per 1.40 + +\bindprimitive ifprimitive ifpdfprimitive +\bindprimitive primitive pdfprimitive +\bindprimitive ifabsdim ifpdfabsdim +\bindprimitive ifabsnum ifpdfabsnum + +\ifnum\texengine=\xetexengine \else % this test might disappear some day + + \pdfminorversion \plusfive + + \ifdefined\pdfcompresslevel \else \newcount\pdfcompresslevel \fi + \ifdefined\pdfobjcompresslevel \else \newcount\pdfobjcompresslevel \fi + \ifdefined\pdfgentounicode \else \newcount\pdfgentounicode \fi \pdfgentounicode \plusone + \ifdefined\pdfinclusioncopyfonts\else \newcount\pdfinclusioncopyfonts \fi \pdfinclusioncopyfonts\plusone + + \def\nopdfcompression {\pdfobjcompresslevel\zerocount \pdfcompresslevel\zerocount} + \def\maximumpdfcompression{\pdfobjcompresslevel\plusnine \pdfcompresslevel\plusnine } + \def\normalpdfcompression {\pdfobjcompresslevel\plusthree \pdfcompresslevel\plusthree} + + \normalpdfcompression + + \let\normalsetrandomseed \setrandomseed + \let\normaluniformdeviate\uniformdeviate + +\fi + +%D Handy. + +\ifnum\texengine=\luatexengine + \ifdefined\suppresslongerror % for the moment test + \suppresslongerror\plusone + \fi +\fi + +%D Basic status stuff. + +\newif\ifproductionrun + +%D We need to make sure that we start up in \DVI\ mode, so, +%D after testing for running \PDFTEX, we default to \DVI. + +\ifx\pdftexversion\undefined \newcount\pdfoutput \fi \pdfoutput=0 + +%D For those who expect this \unknown + +\ifx\fmtname \undefined \def\fmtname {ConTeXt Minimized Plain TeX} \fi +\ifx\fmtversion\undefined \def\fmtversion{3.1415926} \fi + +\let\normalfmtversion\fmtversion + +%D A few bonus macros: + +\def\modulonumber#1#2{\the\numexpr#2-((((#2+(#1/2))/#1)-1)*#1)\relax} +\def\dividonumber#1#2{\the\numexpr(#2-(#1/2))/#1\relax} + +\ifnum\texengine=\xetexengine + \edef\xetexversion {\numexpr\XeTeXversion*100+(\expandafter\gobbleoneargument\XeTeXrevision-5)/10\relax} + \edef\xetexrevision {\the\numexpr(\expandafter\gobbleoneargument\XeTeXrevision-50)/100\relax} +\fi + +\ifcase\texengine + \def\texenginename {impossible} + \edef\texengineversion{0} +\or + \def\texenginename {pdfTeX} + \edef\texengineversion{\dividonumber{100}\pdftexversion.\modulonumber{100}\pdftexversion.\pdftexrevision} +\or + \def\texenginename {XeTeX} + \edef\texengineversion{\dividonumber{100}\xetexversion .\modulonumber{100}\xetexversion .\xetexrevision} +\or + \def\texenginename {LuaTeX} + \edef\texengineversion{\dividonumber{100}\luatexversion.\modulonumber{100}\luatexversion.\luatexrevision} +\else + \def\texenginename {impossible} + \edef\texengineversion{0} +\fi + +%D While cleaning this code up a bit I was listening to Heather +%D Nova's \CD\ Redbird. The first song on that \CD\ ends with +%D a few lines suitable for ending this initialization module: +%D +%D \startlines +%D And there's so much I can do for you +%D Given time I know that I can prove +%D Now my world is opened up to you +%D Come inside +%D +%D Welcome to my life +%D Welcome to my world +%D Come inside +%D \stoplines +%D +%D So let's see what \TEX\ can do now that we've opened up +%D the basic machinery. + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/syst-ini.mkiv b/Master/texmf-dist/tex/context/base/syst-ini.mkiv new file mode 100644 index 00000000000..18388fa2100 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/syst-ini.mkiv @@ -0,0 +1,933 @@ +%D \module +%D [ file=syst-ini, +%D version=2008.11.04, % 2001.11.16, % 1999.03.17, % an oldie: 1995.10.10 +%D title=\CONTEXT\ System Macros, +%D subtitle=Bootstrapping \TEX, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D We used to load plain \TEX\ in a special way, but redefining +%D a couple of primitives so that for instance font loading was +%D ignored. For those interested, this loader is found in +%D \type {syst-tex.tex}. Some of the comment's are Don Knuth's +%D and more of it can be found in the plain \TEX\ format. + +%D Characters can have special states, that can be triggered +%D by setting their category coded. Some are preset, others +%D are to be set as soon as possible, otherwise we cannot +%D define any useful macros. + +%catcode`\^^@ = 9 % ascii null is ignored +%catcode`\\ = 0 % backslash is TeX escape character + +\catcode`\{ = 1 % left brace is begin-group character +\catcode`\} = 2 % right brace is end-group character +\catcode`\$ = 3 % dollar sign is math shift +\catcode`\& = 4 % ampersand is alignment tab +\catcode`\# = 6 % hash mark is macro parameter character +\catcode`\^ = 7 % circumflex and uparrow are for superscripts +\catcode`\_ = 8 % underline and downarrow are for subscripts +\catcode`\^^I = 10 % ascii tab is a blank space + +%catcode`\^^M = 5 % ascii return is end-line +%catcode`\% = 14 % percent sign is comment character +%catcode`\ = 10 % ascii space is blank space +%catcode`\^^? = 15 % ascii delete is invalid + +\catcode`\~ = 13 % tilde is active +\catcode`\^^L = 13 % ascii form-feed + +%catcode`\A = 11 +%....... +%catcode`\Z = 11 + +%catcode`\a = 11 +%....... +%catcode`\z = 11 + +\chardef\activecatcode = 13 % later this will become a counter + +\def ^^L{\par} +\def\^^M{\ } % control = control +\def\^^I{\ } % same for + +%D In \CONTEXT, we simply ignore end||of||file tokens: + +\catcode`\^^Z=9 + +%D It makes sense to know what engine we're running so let's +%D try to deduce it. + +\chardef\unknownengine = 0 +\chardef\pdftexengine = 1 +\chardef\xetexengine = 2 +\chardef\luatexengine = 3 + +\ifx\directlua\undefined + \ifx\XeTeXversion\undefined + \ifx\pdftexversion\undefined + \let\texengine\unknownengine + \else + \let\texengine\pdftexengine + \fi + \else + \let\texengine\xetexengine + \fi +\else + \let\texengine\luatexengine +\fi + +\ifnum\texengine=\luatexengine + % for historic reasons we keep some mkii code around +\else + \immediate\write16{>>>} + \immediate\write16{>>> only luatex is supported} + \immediate\write16{>>>} + \let\dump\relax + \expandafter\end +\fi + +% todo: pdfsave pdfrestore pdfcolor... don't initialize them + +\ifnum\texengine=\luatexengine + \directlua 0 { % this info is stored in the format + lua.name[0] = "main ctx instance" + local extraprimitives = tex.extraprimitives + local enableprimitives = tex.enableprimitives + local core = extraprimitives('core') + local btex = extraprimitives('tex') + local etex = extraprimitives('etex') + local pdftex = extraprimitives('pdftex') + local luatex = extraprimitives('luatex') + local omega = { + "textdir", "pagedir", "mathdir", "pardir", "bodydir", + "leftghost", "rightghost", "localleftbox", "localrightbox", + "localinterlinepenalty", "localbrokenpenalty", + } + local aleph = { + "boxdir", "pagebottomoffset", "pagerightoffset", + } + for _, subset in next, { etex, pdftex, luatex, omega, aleph } do + enableprimitives('',subset) + end + for _, subset in next, { core, btex, etex, pdftex, luatex, omega, aleph } do + enableprimitives('normal',subset) + end + } +\fi + +%D \ETEX\ has a not so handy way of telling you the version number, +%D i.e. the revision number has a period in it: + +\long\def\gobbleoneargument#1{} % will be defined later on anyway + +\mathchardef\etexversion = + \numexpr\eTeXversion*100+\expandafter\gobbleoneargument\eTeXrevision\relax + +%D First we define a simplified version of the \CONTEXT\ +%D protection mechanism. + +\def\unprotect{\catcode`@=11 } +\def\protect {\catcode`@=12 } + +\unprotect + +%D Some pretty important definitions: + +\let\bgroup={ +\let\egroup=} + +%D Allocation of registers is done slightly different than in plain +%D \TEX. First of all we use different reserved counters. We also +%D don't implement a family handler because users are not supposed +%D to implement their own math. We reserve the lowest 31 registers +%D for scratch purposes. Keep in mind that in the core engine +%D some registers are reserved: counters 0 upto 9, and counter 255. +%D +%D As with plain \TEX\ we recommend that macro designers always use +%D \type {\global} assignments with respect to registers numbered 1, +%D 3, 5 \unknown\ 31, and always non||\type {\global} assignments +%D with respect to registers 0, 2, 4, \unknown\ 30. This will prevent +%D \quote {save stack buildup} that might otherwise occur. +%D +%D We reserve some registers for special (management) purposes: + +% 0 - 20 : scratch +% 21 - 127 : internal +% 128 - 254 : inserts +% 255 : page +% 256 - : user + +\countdef \minallocatedregister = 52 \minallocatedregister = 256 % can change +\countdef \maxallocatedregister = 53 \maxallocatedregister = 32767 +\countdef \minallocatediochannel = 54 \minallocatediochannel = -1 +\countdef \maxallocatediochannel = 55 \maxallocatediochannel = 16 +\countdef \minallocatedlanguage = 56 \minallocatedlanguage = 0 +\countdef \maxallocatedlanguage = 57 \maxallocatedlanguage = 255 +\countdef \maxallocatedinsert = 58 \maxallocatedinsert = 254 +\countdef \minallocatedinsert = 59 \minallocatedinsert = 128 +\countdef \minallocatedfamily = 60 \minallocatedfamily = 128 +\countdef \maxallocatedfamily = 61 \maxallocatedfamily = 255 +\countdef \minallocatedattribute = 62 \minallocatedattribute = 1024 % 127-1023 : private + +\countdef \lastallocatedcount = 32 \lastallocatedcount = \minallocatedregister +\countdef \lastallocateddimen = 33 \lastallocateddimen = \minallocatedregister +\countdef \lastallocatedskip = 34 \lastallocatedskip = \minallocatedregister +\countdef \lastallocatedmuskip = 35 \lastallocatedmuskip = \minallocatedregister +\countdef \lastallocatedbox = 36 \lastallocatedbox = \minallocatedregister +\countdef \lastallocatedtoks = 37 \lastallocatedtoks = \minallocatedregister +\countdef \lastallocatedread = 38 \lastallocatedread = \minallocatediochannel +\countdef \lastallocatedwrite = 39 \lastallocatedwrite = \minallocatediochannel +\countdef \lastallocatedmarks = 40 \lastallocatedmarks = \minallocatedregister +\countdef \lastallocatedlanguage = 41 \lastallocatedlanguage = \minallocatedlanguage % not used in context +\countdef \lastallocatedinsertion = 42 \lastallocatedinsertion = \minallocatedinsert +\countdef \lastallocatedfamily = 43 \lastallocatedfamily = \minallocatedfamily % not used in context +\countdef \lastallocatedattribute = 44 \lastallocatedattribute = \minallocatedattribute + +\countdef \mincountervalue = 125 \mincountervalue = -"7FFFFFFF % beware, we use index 125 at the lua end +\countdef \maxcountervalue = 126 \maxcountervalue = "7FFFFFFF % beware, we use index 126 at the lua end + +%countdef \minusone = 127 \minusone = -1 +%chardef \zerocount = 0 +%chardef \plusone = 1 + +\countdef \zerocount = 120 \zerocount = 0 +\countdef \plusone = 121 \plusone = 1 +\countdef \minusone = 122 \minusone = -1 + +%chardef \normalpagebox = 255 +\countdef \normalpagebox = 127 \normalpagebox = 255 % hardcoded in pdftex/xetex + +% A few traditional allocations: + +\countdef \count@ = 255 % hm, used in \newif .. todo: replace it there +\dimendef \dimen@ = 0 +\dimendef \dimen@i = 1 % global only +\dimendef \dimen@ii = 2 + +%D So, effectively we start allocating from 256 and upwards. The +%D inserts sit in the range 128 upto 254. Page numbers use the +%D counters 0 upto 9 and the pagebox is 255. Users can use the +%D scratch registers upto 31 without problem but all others are +%D reserved. + +\def\wlog#1{} % \def\wlog{\immediate\write\minusone} % write on log file (only) + +%D The allocators share a common helper macro. + +\def\newcount {\allocateregister\lastallocatedcount \count \countdef \maxallocatedregister} +\def\newdimen {\allocateregister\lastallocateddimen \dimen \dimendef \maxallocatedregister} +\def\newskip {\allocateregister\lastallocatedskip \skip \skipdef \maxallocatedregister} +\def\newmuskip {\allocateregister\lastallocatedmuskip \muskip \muskipdef \maxallocatedregister} +\def\newbox {\allocateregister\lastallocatedbox \box \mathchardef\maxallocatedregister} +\def\newtoks {\allocateregister\lastallocatedtoks \toks \toksdef \maxallocatedregister} +\def\newread {\allocateregister\lastallocatedread \read \chardef \maxallocatediochannel} +\def\newwrite {\allocateregister\lastallocatedwrite \write \chardef \maxallocatediochannel} +\def\newmarks {\allocateregister\lastallocatedmarks \marks \mathchardef\maxallocatedregister} +\def\newinsert {\allocateregister\lastallocatedinsertion\insert \chardef \maxallocatedinsert} + +%D We don't need these in \CONTEXT: + +\def\newlanguage{\allocateregister\lastallocatedlanguage \language\chardef \maxallocatedlanguage} +\def\newfamily {\allocateregister\lastallocatedfamily \fam \chardef \maxallocatedfamily} + +\let\newfam\newfamily + +% Watch out, for the moment we disable the check for already being defined +% later we will revert this but first all chardefs must be replaced. + +\def\newconstant #1{\ifdefined#1\let#1\undefined\fi\newcount#1} +\def\setnewconstant#1{\ifdefined#1\let#1\undefined\fi\newcount#1#1} % just a number + +% maybe setconstant with check + +% %D The next definitions are really needed (in \CONTEXT): + +%newlinechar=10 \def\outputnewlinechar{\rawcharacter{10}} +\newlinechar=10 \edef\outputnewlinechar{^^J} + +%D One reason to start high with allocation is that it permits us to +%D allocate consecutive ranges more easily, for instance if for \MPLIB\ +%D we want to allocate a continuous range of boxes. It also permits us +%D to do a proper upward allocation for inserts. The current code +%D evolved from code that dealt with older engines but as all engines +%D now provide many registers we removed all traces. + +\ifdefined\writestatus \else + \def\writestatus#1#2{\immediate\write16{#1: #2}} +\fi + +\def\allocateregisteryes#1#2#3#4#5% last class method max name + {\ifnum#1<#4\relax + \global\advance#1\plusone + \global#3#5=#1\relax + \else + \writestatus{warning}{no room for \string#2\space \string#5\space (max: \number#4)}% + \fi} + +\def\allocateregisternop#1#2#3#4#5% last class method max name + {\writestatus{warning}{\string#2 \string#5 is already defined (\string\relax\space it first)}} + +\def\allocateregister#1#2#3#4#5% last class method max name + {\ifx#5\undefined + \expandafter\allocateregisteryes + \else\ifx#5\relax + \expandafter\expandafter\expandafter\allocateregisteryes + \else + \expandafter\expandafter\expandafter\allocateregisternop + \fi\fi + #1#2#3#4#5} + +%D Since the number of chars exceed 256 now, we can use \type +%D {\chardef} instead of the more limited \type {\mathchardef}. + +\ifnum\texengine>\pdftexengine + \def\newbox {\allocateregister\lastallocatedbox \box \chardef\maxallocatedregister} + \def\newmarks{\allocateregister\lastallocatedmarks\marks\chardef\maxallocatedregister} +\fi + +%D Attributes are something very \LUATEX. In \CONTEXT\ you are not +%D supposed to use the attributes directly but always allocate then +%D first. For instance attribute~0 is reserved for special purposes +%D (this might change). Attributes in the range 128-1023 are private +%D and should not be touched. + +\ifnum\texengine=\luatexengine + \let\attributeunsetvalue\mincountervalue % used to be \minusone + \def\newattribute{\allocateregister\minallocatedattribute\attribute\attributedef\maxallocatedregister} +\fi + +%D Not used by \CONTEXT\ but for instance \PICTEX\ needs it. It's a +%D trick to force strings instead of tokens that take more memory. +%D It's a trick to trick to force strings. + +\def\newhelp#1#2{\newtoks#1#1\expandafter{\csname#2\endcsname}} + +%D \macros +%D {scratchcounter, +%D scratchdimen,scratchskip,scratchmuskip, +%D scratchbox, +%D scratchtoks} +%D +%D We now define a few scratch registers, so that successive +%D loads at least have some available. + +\newcount \scratchcounter \newcount \globalscratchcounter +\newdimen \scratchdimen \newdimen \globalscratchdimen +\newskip \scratchskip \newskip \globalscratchskip +\newmuskip \scratchmuskip \newmuskip \globalscratchmuskip +\newtoks \scratchtoks \newtoks \globalscratchtoks +\newbox \scratchbox \newbox \globalscratchbox + +\newcount\scratchcounterone \newcount\scratchcountertwo \newcount\scratchcounterthree +\newdimen \scratchdimenone \newdimen \scratchdimentwo \newdimen \scratchdimenthree +\newdimen \scratchskipone \newdimen \scratchskiptwo \newdimen \scratchskipthree +\newbox \scratchmuskipone \newbox \scratchmuskiptwo \newbox \scratchmuskipthree +\newtoks \scratchtoksone \newtoks \scratchtokstwo \newtoks \scratchtoksthree +\newbox \scratchboxone \newbox \scratchboxtwo \newbox \scratchboxthree + +%D More allocations: + +\newskip \zeroskip \zeroskip = 0pt plus 0pt minus 0pt +\newdimen\zeropoint \zeropoint = 0pt +\newdimen\onepoint \onepoint = 1pt +\newdimen\maxdimen \maxdimen = 16383.99999pt +\newdimen\onebasepoint \onebasepoint = 1bp +\newdimen\scaledpoint \scaledpoint = 1sp +\newdimen\thousandpoint\thousandpoint= 1000pt + +\let\points\onepoint + +\newtoks \emptytoks + +%D And even more: (todo: countdefs 60+) + +%newcount \minusone \minusone = -1 +\newcount \minustwo \minustwo = -2 +%chardef \zerocount = 0 +%chardef \plusone = 1 +\chardef \plustwo = 2 +\chardef \plusthree = 3 +\chardef \plusfour = 4 +\chardef \plusfive = 5 +\chardef \plussix = 6 +\chardef \plusseven = 7 +\chardef \pluseight = 8 +\chardef \plusnine = 9 +\chardef \plusten = 10 +\chardef \plussixteen = 16 +\chardef \plushundred = 100 +\chardef \pluscxxvii = 127 +\chardef \pluscxxviii = 128 +\chardef \pluscclv = 255 + +\ifnum\texengine=\luatexengine + \chardef \pluscclvi = 256 + \chardef \plusthousand = 1000 + \chardef \plustenthousand = 10000 + \chardef \plustwentythousand = 20000 + \chardef \medcard = 32768 + \chardef \maxcard = 65536 % pdftex has less mathchars +\else + \mathchardef\pluscclvi = 256 + \mathchardef\plusthousand = 1000 + \mathchardef\plustenthousand = 10000 + \mathchardef\plustwentythousand = 20000 + \newcount \medcard \medcard = 32768 % pdftex has less mathchars + \newcount \maxcard \maxcard = 65536 % pdftex has less mathchars +\fi + +%D We prefer the more readable variant than in plain +%D \TEX. User should only use \type {\emptybox}: + +\newbox\voidbox % public + +\let\normalhbox\hbox +\let\normalvbox\vbox + +\def\unvoidbox{\unhbox\voidbox} +\def\emptybox {\box \voidbox} % used in initializations so no attributes +\def\emptyvbox{\normalvbox{}} % no copy as we need to set attributes +\def\emptyhbox{\normalhbox{}} % no copy as we need to set attributes + +\let\leavevmode\unvoidbox % we prefer to use \dontleavehmode + +%D Some expected plain variants follow. We don't reuse registers +%D because we don't want clashes. + +\newdimen\p@ \p@ \onepoint +\newcount\m@ne \m@ne \minusone +\newdimen\z@ \z@ \zeropoint +\let \@ne \plusone +\let \tw@ \plustwo +\let \thr@@ \plusthree +\let \sixt@@n \sixteen +\let \@cclv \pluscclv +\let \@cclvi \pluscclvi +\newbox \voidb@x +\newtoks \toks@ + +%D We define \type {\newif} a la plain \TEX, but will +%D redefine it later. As Knuth says: +%D +%D \startnarrower +%D And here's a different sort of allocation: for example, +%D +%D \starttyping +%D \newif\iffoo +%D \stoptyping +%D +%D creates \type {\footrue}, \type {\foofalse} to go +%D with \type {\iffoo}. +%D \stopnarrower + +\def\newif#1% + {\count@\escapechar + \escapechar\minusone + \expandafter\expandafter\expandafter\def\@if #1{true}{\let#1\iftrue }% + \expandafter\expandafter\expandafter\def\@if#1{false}{\let#1\iffalse}% + \@if#1{false}% the condition starts out false + \escapechar\count@} + +\def\@if#1#2% + {\csname\expandafter\if@\string#1#2\endcsname} + +\bgroup % `if' is required + + \uccode`1=`i \uccode`2=`f \uppercase{\gdef\if@12{}} + +\egroup + +%D Let's test this one: + +\newif\ifdone + +%D Potential primitive in \LUATEX: + +\ifdefined\htdp \else \def\htdp#1{\dimexpr\ht#1+\dp#1\relax} \fi + +%D \macros +%D {@@escape,@@begingroup,@@endgroup,@@mathshift,@@alignment, +%D @@endofline,@@parameter,@@superscript,@@subscript, +%D @@ignore,@@space,@@letter,@@other,@@active,@@comment} +%D +%D In \CONTEXT\ we sometimes manipulate the \CATCODES\ of certain +%D characters. Because we are not that good at remembering numbers, +%D we introduce some symbolic names. + +%D As we now have catc-* files, we also have more readable names but +%D We will keep the following around for a while. + +\chardef\@@escape = 0 +\chardef\@@begingroup = 1 +\chardef\@@endgroup = 2 +\chardef\@@mathshift = 3 +\chardef\@@alignment = 4 +\chardef\@@endofline = 5 +\chardef\@@parameter = 6 +\chardef\@@superscript = 7 +\chardef\@@subscript = 8 +\chardef\@@ignore = 9 +\chardef\@@space = 10 +\chardef\@@letter = 11 +\chardef\@@other = 12 +\chardef\@@active = 13 +\chardef\@@comment = 14 + +%D Constants to be used with \type {\currentgrouptype}. + +\chardef\@@bottomlevelgroup = 0 +\chardef\@@simplegroup = 1 +\chardef\@@hboxgroup = 2 +\chardef\@@adjustedhboxgroup = 3 +\chardef\@@vboxgroup = 4 +\chardef\@@vtopgroup = 5 +\chardef\@@aligngroup = 6 +\chardef\@@noaligngroup = 7 +\chardef\@@outputgroup = 8 +\chardef\@@mathgroup = 9 +\chardef\@@discretionarygroup = 10 +\chardef\@@insertgroup = 11 +\chardef\@@vcentergroup = 12 +\chardef\@@mathchoicegroup = 13 +\chardef\@@semisimplegroup = 14 +\chardef\@@mathshiftgroup = 15 +\chardef\@@mathleftgroup = 16 + +\chardef\@@vadjustgroup = \@@insertgroup + +%D Constants to be used with \type {\interactionmode}. + +\chardef\@@batchmode = 0 +\chardef\@@nonstopmode = 1 +\chardef\@@scrollmode = 2 +\chardef\@@errorstopmode = 3 + +%D Constants to be used with \type {\lastnodetype}. The \type +%D {\lastnodetype} primitive is \ETEX\ compliant. The valid range is +%D still -1 .. 15 and glyph nodes have number 0 (used to be char +%D node) and ligature nodes are mapped to 7. That way macro packages +%D can use the same symbolic names as in traditional \ETEX. Keep in +%D mind that the internal node numbers are different and that there +%D are more node types that 15. + +\chardef\@@charnode = 0 +\chardef\@@hlistnode = 1 +\chardef\@@vlistnode = 2 +\chardef\@@rulenode = 3 +\chardef\@@insertnode = 4 +\chardef\@@marknode = 5 +\chardef\@@adjustnode = 6 +\chardef\@@ligaturenode = 7 +\chardef\@@discretionarynode = 8 +\chardef\@@whatsitnode = 9 +\chardef\@@mathnode = 10 +\chardef\@@gluenode = 11 +\chardef\@@kernnode = 12 +\chardef\@@penaltynode = 13 +\chardef\@@unsetnode = 14 +\chardef\@@mathsnode = 15 + +%D Constants to be used with \type {\currentiftype}. + +\chardef\@@charif = 1 +\chardef\@@catif = 2 +\chardef\@@numif = 3 +\chardef\@@dimif = 4 +\chardef\@@oddif = 5 +\chardef\@@vmodeif = 6 +\chardef\@@hmodeif = 7 +\chardef\@@mmodeif = 8 +\chardef\@@innerif = 9 +\chardef\@@voidif = 10 +\chardef\@@hboxif = 11 +\chardef\@@vboxif = 12 +\chardef\@@xif = 13 +\chardef\@@eofif = 14 +\chardef\@@trueif = 15 +\chardef\@@falseif = 16 +\chardef\@@caseif = 17 +\chardef\@@definedif = 18 +\chardef\@@csnameif = 19 +\chardef\@@fontcharif = 20 + +%D Of course we want even bigger log files, so we copied this +%D from the \ETEX\ source files. +%D +%D When watching such logs, beware of nasty side effects of +%D \type {\scantokens}, as in: +%D +%D \starttyping +%D \bgroup +%D \lccode`a=12\lowercase{\xdef\whatever{a}}\egroup +%D \def\whatever{test \whatever test} +%D \scantokens\expandafter{\whatever} +%D \egroup +%D \stoptyping +%D +%D In \LUATEX\ we have ways around this. + +\def\tracingall + {\tracingonline \plusone + \tracingcommands \plusthree + \tracingstats \plustwo + \tracingpages \plusone + \tracingoutput \plusone + \tracinglostchars \plustwo + \tracingmacros \plustwo + \tracingparagraphs\plusone + \tracingrestores \plusone + \showboxbreadth \maxdimen + \showboxdepth \maxdimen + \tracinggroups \plusone + \tracingifs \plusone + \tracingscantokens\plusone + \tracingnesting \plusone + \tracingassigns \plustwo + \errorstopmode} + +\def\loggingall + {\tracingall + \tracingonline \zerocount} + +\def\tracingnone + {\tracingassigns \zerocount + \tracingnesting \zerocount + \tracingscantokens\zerocount + \tracingifs \zerocount + \tracinggroups \zerocount + \showboxdepth \plusthree + \showboxbreadth \plusfive + \tracingrestores \zerocount + \tracingparagraphs\zerocount + \tracingmacros \zerocount + \tracinglostchars \plusone + \tracingoutput \zerocount + \tracingpages \zerocount + \tracingstats \zerocount + \tracingcommands \zerocount + \tracingonline \zerocount} + +%D Just for tracing purposes we set: + +\tracingstats\plusone + +%D Here we also save \type {\input}, more will be saved later. + +\ifdefined\normalinput \else \let\normalinput\input \fi + +%D We don't like outer commands, and we always want access +%D to the original \type {\input} primitive. + +\let\normalouter\outer \def\outer{} % no longer \relax + +%D To circumvent dependencies, we can postpone certain +%D initializations to dumping time, by appending them to the +%D \type {\everydump} token register. + +\ifdefined\normaldump \else \let\normaldump\dump \fi + +\newtoks\everydump + +\def\dump{\the\everydump\normaldump} + +%D The same applies for the startup actions. + +\ifdefined\normaleveryjob \else \let\normaleveryjob\everyjob \fi + +\let\everyjob\relax \newtoks\everyjob + +\normaleveryjob{\the\everyjob} + +\def\appendtotoks #1{\def\temp{#1}\afterassignment\doappendtotoks \scratchtoks=} +\def\prependtotoks#1{\def\temp{#1}\afterassignment\doprependtotoks\scratchtoks=} + +\def\doappendtotoks {\expandafter\expandafter\expandafter{\expandafter\the\expandafter\temp\the\scratchtoks}} +\def\doprependtotoks{\expandafter\expandafter\expandafter{\expandafter\the\expandafter\scratchtoks\the\temp}} + +%D \macros +%D {begcsname} +%D +%D Handy for \ETEX-only usage (avoids making \type {\relax}'s: + +\def\begcsname#1\endcsname{\ifcsname#1\endcsname\csname#1\endcsname\fi} + +%D Now come a few macros that might be needed in successive loading: + +\let\endgraf\par +\let\endline\cr + +\def\space{ } +\def\empty{} +\def\null {\hbox{}} + +%D The following two might be overloaded later on but some modules need +%D then earlier. These functionality is reflected in the name and will not +%D change. + +\bgroup + \catcode`\^^M=\activecatcode% + \gdef\obeylines{\catcode`\^^M\activecatcode \let^^M\par}% + \global\let^^M\par% +\egroup + +\bgroup + \gdef\obeyspaces{\catcode`\ \activecatcode}% + \obeyspaces\global\let =\space% +\egroup + +%D A constant: + +\let\endoflinetoken=^^M + +%D Also needed might be a simple loop structure and we borrow +%D plain \TEX's one as it is often expected to be present and +%D it is about the fastest you can get. Beware: this macro +%D does not support nested loops. We use a namespace prefix +%D \type {@@pln}. + +\long\def\loop#1\repeat{\long\def\@@plnbody{#1}\@@plniterate} + +%D The following makes \type {\loop} \unknown\ \type {\if} +%D \unknown\ \type {\repeat} skippable (clever trick): + +\let\repeat\fi % so both \loop and \repeat are reserved words! + +%D The original (no \type {@@pln} there): +%D +%D \starttyping +%D \def\@@plniterate{\@@plnbody\let\next\@@plniterate\else\let\next\relax\fi\next} +%D \stoptyping +%D +%D A more efficient alternative: +%D +%D \starttyping +%D \def\@@plniterate{\@@plnbody\expandafter\@@plniterate\else\expandafter\relax\fi} +%D \stoptyping +%D +%D An even more efficient one: + +\def\@@plniterate{\@@plnbody\expandafter\@@plniterate\else\fi} + +%D We don't define a real output routine yet but at least get rid +%D of pages: + +\output{\shipout\box\normalpagebox} + +%D Although we don't add pagenumbers yet we alias the default +%D register used for counting pages: + +\countdef\pageno=0 \pageno=1 % first page is number 1 + +%D Beside the raw counter \type {\pageno} the \type {\folio} +%D macro provides the value. + +\def\folio{\the\pageno} % kind of expected and therefore reserved + +%D The following registers are kind of standard and (for the moment) +%D we define them here. This might change. + +\newskip \bigskipamount \bigskipamount = 12pt plus 4pt minus 4pt +\newskip \medskipamount \medskipamount = 6pt plus 2pt minus 2pt +\newskip \smallskipamount \smallskipamount = 3pt plus 1pt minus 1pt + +\baselineskip = 12pt +\lineskip = 1pt +\lineskiplimit = 0pt + +%D Again a few kind-of-extensions the core: + +\newskip \hideskip \hideskip = -1000pt plus 1fill +\newskip \centering \centering = 0pt plus 1000pt minus 1000pt + +\def\hidewidth % for alignment entries that can stick out + {\hskip\hideskip} + +\def\ialign % initialized \halign + {\everycr{}% + \tabskip\zeroskip + \halign} + +\newcount \mscount + +\def\spanomit{\span\omit} % bypass error message + +\def\multispan#1% + {\omit + \mscount#1\relax + \loop + \ifnum\mscount>\plusone + \spanomit \advance\mscount\minusone + \repeat} + +%D The next section deals with selective definitions in +%D later modules. One can of course use the \type {\texengine} +%D number that we defined earlier instead. + +\bgroup \obeylines + \gdef\pickupSOMETEX#1% + {\expandafter\gdef\csname begin#1\endcsname{\bgroup\obeylines\dopickupSOMETEX{#1}}} + \gdef\dopickupSOMETEX#1#2 + % {\egroup\immediate\write16{special code for #1 -> [line \the\inputlineno] \detokenize{#2}}} + {\egroup} +\egroup + +\let\endTEX \relax \long\def\beginTEX #1\endTEX {} +\let\endETEX \relax \long\def\beginETEX #1\endETEX {} +\let\endXETEX \relax \long\def\beginXETEX #1\endXETEX {} +\let\endLUATEX\relax \long\def\beginLUATEX#1\endLUATEX{} +\let\endOLDTEX\relax \long\def\beginOLDTEX#1\endOLDTEX{} +\let\endNEWTEX\relax \long\def\beginNEWTEX#1\endNEWTEX{} + +\pickupSOMETEX{ETEX} + +\ifnum\texengine=\xetexengine + \pickupSOMETEX{XETEX} +\fi +\ifnum\texengine=\luatexengine + \pickupSOMETEX{LUATEX} +\fi +\ifnum\texengine<\xetexengine + \pickupSOMETEX{OLDTEX} +\else + \pickupSOMETEX{NEWTEX} +\fi + +%D \macros +%D {bindprimitive} +%D +%D We can remap primitives (which is needed because of changes in +%D for instance \PDFTEX). + +\def\bindprimitive#1 #2 % new old + {\ifcsname#1\endcsname \else \ifcsname#2\endcsname + \expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname + \fi \fi} + +%D Because \XETEX\ also implements some \PDFTEX\ functionality, we take +%D care of this here instead of a dedicated module. Later modules need +%D to handle the undefined cases. + +%D These messy checks will disappear. + +% new after 1.10, watch the change in prefix + +\bindprimitive quitvmode ptexquitvmode +\bindprimitive noligatures ptexnoligatures +\bindprimitive setrandomseed ptexsetrandomseed +\bindprimitive uniformdeviate ptexuniformdeviate + +\bindprimitive quitvmode pdfquitvmode +\bindprimitive noligatures pdfnoligatures +\bindprimitive setrandomseed pdfsetrandomseed +\bindprimitive uniformdeviate pdfuniformdeviate + +\bindprimitive resettimer pdfresettimer +\bindprimitive elapsedtime pdfelapsedtime + +% new per 1.40 + +\bindprimitive ifprimitive ifpdfprimitive +\bindprimitive primitive pdfprimitive +\bindprimitive ifabsdim ifpdfabsdim +\bindprimitive ifabsnum ifpdfabsnum + +\ifnum\texengine=\xetexengine \else % this test might disappear some day + + \pdfminorversion \plusfive + + \ifdefined\pdfcompresslevel \else \newcount\pdfcompresslevel \fi + \ifdefined\pdfobjcompresslevel \else \newcount\pdfobjcompresslevel \fi + \ifdefined\pdfgentounicode \else \newcount\pdfgentounicode \fi \pdfgentounicode \plusone + \ifdefined\pdfinclusioncopyfonts\else \newcount\pdfinclusioncopyfonts \fi \pdfinclusioncopyfonts\plusone + + \def\nopdfcompression {\pdfobjcompresslevel\zerocount \pdfcompresslevel\zerocount} + \def\maximumpdfcompression{\pdfobjcompresslevel\plusnine \pdfcompresslevel\plusnine } + \def\normalpdfcompression {\pdfobjcompresslevel\plusthree \pdfcompresslevel\plusthree} + + \normalpdfcompression + + \let\normalsetrandomseed \setrandomseed + \let\normaluniformdeviate\uniformdeviate + +\fi + +%D Handy. + +\ifnum\texengine=\luatexengine + \ifdefined\suppresslongerror % for the moment test + \suppresslongerror\plusone + \fi +\fi + +%D Basic status stuff. + +\newif\ifproductionrun + +%D We need to make sure that we start up in \DVI\ mode, so, +%D after testing for running \PDFTEX, we default to \DVI. + +\ifx\pdftexversion\undefined \newcount\pdfoutput \fi \pdfoutput=0 + +%D For those who expect this \unknown + +\ifx\fmtname \undefined \def\fmtname {ConTeXt Minimized Plain TeX} \fi +\ifx\fmtversion\undefined \def\fmtversion{3.1415926} \fi + +\let\normalfmtversion\fmtversion + +%D A few bonus macros: + +\def\modulonumber#1#2{\the\numexpr#2-((((#2+(#1/2))/#1)-1)*#1)\relax} +\def\dividonumber#1#2{\the\numexpr(#2-(#1/2))/#1\relax} + +\ifnum\texengine=\xetexengine + \edef\xetexversion {\numexpr\XeTeXversion*100+(\expandafter\gobbleoneargument\XeTeXrevision-5)/10\relax} + \edef\xetexrevision {\the\numexpr(\expandafter\gobbleoneargument\XeTeXrevision-50)/100\relax} +\fi + +\ifcase\texengine + \def\texenginename {impossible} + \edef\texengineversion{0} +\or + \def\texenginename {pdfTeX} + \edef\texengineversion{\dividonumber{100}\pdftexversion.\modulonumber{100}\pdftexversion.\pdftexrevision} +\or + \def\texenginename {XeTeX} + \edef\texengineversion{\dividonumber{100}\xetexversion .\modulonumber{100}\xetexversion .\xetexrevision} +\or + \def\texenginename {LuaTeX} + \edef\texengineversion{\dividonumber{100}\luatexversion.\modulonumber{100}\luatexversion.\luatexrevision} +\else + \def\texenginename {impossible} + \edef\texengineversion{0} +\fi + +%D We only can set this one via directives (system.synctex). + +\let\synctex\undefined \newcount\synctex + +%D While cleaning this code up a bit I was listening to Heather +%D Nova's \CD\ Redbird. The first song on that \CD\ ends with +%D a few lines suitable for ending this initialization module: +%D +%D \startlines +%D And there's so much I can do for you +%D Given time I know that I can prove +%D Now my world is opened up to you +%D Come inside +%D +%D Welcome to my life +%D Welcome to my world +%D Come inside +%D \stoplines +%D +%D So let's see what \TEX\ can do now that we've opened up +%D the basic machinery. + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/syst-ini.tex b/Master/texmf-dist/tex/context/base/syst-ini.tex deleted file mode 100644 index 7c9d72127a7..00000000000 --- a/Master/texmf-dist/tex/context/base/syst-ini.tex +++ /dev/null @@ -1,888 +0,0 @@ -%D \module -%D [ file=syst-ini, -%D version=2008.11.04, % 2001.11.16, % 1999.03.17, % an oldie: 1995.10.10 -%D title=\CONTEXT\ System Macros, -%D subtitle=Bootstrapping \TEX, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -%D We used to load plain \TEX\ in a special way, but redefining -%D a couple of primitives so that for instance font loading was -%D ignored. For those interested, this loader is found in -%D \type {syst-tex.tex}. Some of the comment's are Don Knuth's -%D and more of it can be found in the plain \TEX\ format. - -%D Characters can have special states, that can be triggered -%D by setting their category coded. Some are preset, others -%D are to be set as soon as possible, otherwise we cannot -%D define any useful macros. - -%catcode`\^^@ = 9 % ascii null is ignored -%catcode`\\ = 0 % backslash is TeX escape character - -\catcode`\{ = 1 % left brace is begin-group character -\catcode`\} = 2 % right brace is end-group character -\catcode`\$ = 3 % dollar sign is math shift -\catcode`\& = 4 % ampersand is alignment tab -\catcode`\# = 6 % hash mark is macro parameter character -\catcode`\^ = 7 % circumflex and uparrow are for superscripts -\catcode`\_ = 8 % underline and downarrow are for subscripts -\catcode`\^^I = 10 % ascii tab is a blank space - -%catcode`\^^M = 5 % ascii return is end-line -%catcode`\% = 14 % percent sign is comment character -%catcode`\ = 10 % ascii space is blank space -%catcode`\^^? = 15 % ascii delete is invalid - -\catcode`\~ = 13 % tilde is active -\catcode`\^^L = 13 % ascii form-feed - -%catcode`\A = 11 -%....... -%catcode`\Z = 11 - -%catcode`\a = 11 -%....... -%catcode`\z = 11 - -\chardef\active = 13 - -\def ^^L{\par} -\def\^^M{\ } % control = control -\def\^^I{\ } % same for - -%D In \CONTEXT, we simply ignore end||of||file tokens: - -\catcode`\^^Z=9 - -%D It makes sense to know what engine we're running so let's -%D try to deduce it. - -\chardef\unknownengine = 0 -\chardef\pdftexengine = 1 -\chardef\xetexengine = 2 -\chardef\luatexengine = 3 - -\ifx\directlua\undefined - \ifx\XeTeXversion\undefined - \ifx\pdftexversion\undefined - \let\texengine\unknownengine - \else - \let\texengine\pdftexengine - \fi - \else - \let\texengine\xetexengine - \fi -\else - \let\texengine\luatexengine -\fi - -\ifnum\texengine=\unknownengine - \immediate\write16{>>>} - \immediate\write16{>>> only pdftex, xetex and luatex are supported} - \immediate\write16{>>>} - \let\dump\relax - \expandafter\end -\fi - -% todo: pdfsave pdfrestore pdfcolor... don't initialize them - -\ifnum\texengine=\luatexengine - \directlua 0 { % this info is stored in the format - if lua.name then - lua.name[0] = "main ctx instance" - end - if tex.extraprimitives then - local core = tex.extraprimitives('core') - local btex = tex.extraprimitives('tex') - local etex = tex.extraprimitives('etex') - local pdftex = tex.extraprimitives('pdftex') - local luatex = tex.extraprimitives('luatex') - local omega = { - "textdir", "pagedir", "mathdir", "pardir", "bodydir", - "leftghost", "rightghost", "localleftbox", "localrightbox", - "localinterlinepenalty", "localbrokenpenalty", - } - local aleph = { - "boxdir", "pagebottomoffset", "pagerightoffset", - } - for _, subset in pairs { etex, pdftex, luatex, omega, aleph } do - tex.enableprimitives('',subset) - end - for _, subset in pairs { core, btex, etex, pdftex, luatex, omega, aleph } do - tex.enableprimitives('normal',subset) - end - end - } -\fi - -%D \ETEX\ has a not so handy way of telling you the version number, -%D i.e. the revision number has a period in it: - -\long\def\gobbleoneargument#1{} % will be defined later on anyway - -\mathchardef\etexversion = - \numexpr\eTeXversion*100+\expandafter\gobbleoneargument\eTeXrevision\relax - -%D First we define a simplified version of the \CONTEXT\ -%D protection mechanism. - -\def\unprotect{\catcode`@=11 } -\def\protect {\catcode`@=12 } - -\unprotect - -%D Some pretty important definitions: - -\let\bgroup={ -\let\egroup=} - -%D Allocation of registers is done slightly different than in plain -%D \TEX. First of all we use different reserved counters. We also -%D don't implement a family handler because users are not supposed -%D to implement their own math. We reserve the lowest 31 registers -%D for scratch purposes. Keep in mind that in the core engine -%D some registers are reserved: counters 0 upto 9, and counter 255. -%D -%D As with plain \TEX\ we recommend that macro designers always use -%D \type {\global} assignments with respect to registers numbered 1, -%D 3, 5 \unknown\ 31, and always non||\type {\global} assignments -%D with respect to registers 0, 2, 4, \unknown\ 30. This will prevent -%D \quote {save stack buildup} that might otherwise occur. -%D -%D We reserve some registers for special (management) purposes: - -\countdef \minallocatedregister = 52 \minallocatedregister = 256 -\countdef \maxallocatedregister = 53 \maxallocatedregister = 32767 -\countdef \minallocatediochannel = 54 \minallocatediochannel = -1 -\countdef \maxallocatediochannel = 55 \maxallocatediochannel = 16 -\countdef \minallocatedlanguage = 56 \minallocatedlanguage = 0 -\countdef \maxallocatedlanguage = 57 \maxallocatedlanguage = 255 -\countdef \maxallocatedinsert = 58 \maxallocatedinsert = 254 -\countdef \minallocatedinsert = 59 \minallocatedinsert = 128 -\countdef \minallocatedfamily = 60 \minallocatedfamily = 128 -\countdef \maxallocatedfamily = 61 \maxallocatedfamily = 255 - -\countdef \lastallocatedcount = 32 \lastallocatedcount = \minallocatedregister -\countdef \lastallocateddimen = 33 \lastallocateddimen = \minallocatedregister -\countdef \lastallocatedskip = 34 \lastallocatedskip = \minallocatedregister -\countdef \lastallocatedmuskip = 35 \lastallocatedmuskip = \minallocatedregister -\countdef \lastallocatedbox = 36 \lastallocatedbox = \minallocatedregister -\countdef \lastallocatedtoks = 37 \lastallocatedtoks = \minallocatedregister -\countdef \lastallocatedread = 38 \lastallocatedread = \minallocatediochannel -\countdef \lastallocatedwrite = 39 \lastallocatedwrite = \minallocatediochannel -\countdef \lastallocatedmarks = 40 \lastallocatedmarks = \minallocatedregister -\countdef \lastallocatedlanguage = 41 \lastallocatedlanguage = \minallocatedlanguage -\countdef \lastallocatedinsertion = 42 \lastallocatedinsertion = \minallocatedinsert -\countdef \lastallocatedfamily = 43 \lastallocatedfamily = \minallocatedfamily -\countdef \lastallocatedattribute = 44 \lastallocatedattribute = \minallocatedregister - -\countdef \mincountervalue = 125 \mincountervalue = -"7FFFFFFF % beware, we use index 125 at the lua end -\countdef \maxcountervalue = 126 \maxcountervalue = "7FFFFFFF % beware, we use index 126 at the lua end -\countdef \minusone = 127 \minusone = -1 -\chardef \zerocount = 0 -\chardef \plusone = 1 - -\chardef \normalpagebox = 255 % hardcoded in the engine - -% A few traditional allocations: - -\countdef \count@ = 255 % hm, used in \newif -\dimendef \dimen@ = 0 -\dimendef \dimen@i = 1 % global only -\dimendef \dimen@ii = 2 - -%D So, effectively we start allocating from 256 and upwards. The -%D inserts sit in the range 128 upto 254. Page numbers use the -%D counters 0 upto 9 and the pagebox is 255. Users can use the -%D scratch registers upto 31 without problem but all others are -%D reserved. - -\def\wlog#1{} % \def\wlog{\immediate\write\minusone} % write on log file (only) - -%D The allocators share a common helper macro. - -\def\newcount {\allocateregister\lastallocatedcount \count \countdef \maxallocatedregister} -\def\newdimen {\allocateregister\lastallocateddimen \dimen \dimendef \maxallocatedregister} -\def\newskip {\allocateregister\lastallocatedskip \skip \skipdef \maxallocatedregister} -\def\newmuskip {\allocateregister\lastallocatedmuskip \muskip \muskipdef \maxallocatedregister} -\def\newbox {\allocateregister\lastallocatedbox \box \mathchardef\maxallocatedregister} -\def\newtoks {\allocateregister\lastallocatedtoks \toks \toksdef \maxallocatedregister} -\def\newread {\allocateregister\lastallocatedread \read \chardef \maxallocatediochannel} -\def\newwrite {\allocateregister\lastallocatedwrite \write \chardef \maxallocatediochannel} -\def\newmarks {\allocateregister\lastallocatedmarks \marks \mathchardef\maxallocatedregister} -\def\newlanguage{\allocateregister\lastallocatedlanguage \language\chardef \maxallocatedlanguage} -\def\newinsert {\allocateregister\lastallocatedinsertion\insert \chardef \maxallocatedinsert} -\def\newfamily {\allocateregister\lastallocatedfamily \fam \chardef \maxallocatedfamily} - -\let\newfam\newfamily - -% %D The next definitions are really needed (in \CONTEXT): - -%newlinechar=10 \def\outputnewlinechar{\rawcharacter{10}} -\newlinechar=10 \edef\outputnewlinechar{^^J} - -%D One reason to start high with allocation is that it permits us to -%D allocate consecutive ranges more easily, for instance in \MPLIB\ -%D we want to allocate a continuous range of boxes. It also permits us -%D to do a proper upward allocation for inserts. The current code -%D evolved from code that dealt with older engines but as all engines -%D now provide many registers we removed all traces. - -\def\writestatus#1#2{\immediate\write16{#1: #2}} \def\space { } - -\def\allocateregisteryes#1#2#3#4#5% last class method max name - {\ifnum#1<#4\relax - \global\advance#1\plusone - \global#3#5=#1\relax - \else - \writestatus{warning}{no room for \string#2\space \string#5\space (max: \number#4)}% - \fi} - -\def\allocateregisternop#1#2#3#4#5% last class method max name - {\writestatus{warning}{\string#2 \string#5 is already defined (\string\relax\space it first)}} - -\def\allocateregister#1#2#3#4#5% last class method max name - {\ifx#5\undefined - \expandafter\allocateregisteryes - \else\ifx#5\relax - \expandafter\expandafter\expandafter\allocateregisteryes - \else - \expandafter\expandafter\expandafter\allocateregisternop - \fi\fi - #1#2#3#4#5} - -%D Since the number of chars exceed 256 now, we can use \type -%D {\chardef} instead of the more limited \type {\mathchardef}. - -\ifnum\texengine>\pdftexengine - \def\newbox {\allocateregister\lastallocatedbox \box \chardef\maxallocatedregister} - \def\newmarks{\allocateregister\lastallocatedmarks\marks\chardef\maxallocatedregister} -\fi - -%D Attributes are something very \LUATEX. In \CONTEXT\ you are not -%D supposed to use the attributes directly but always allocate then -%D first. For instance attribute~0 is reserved for special purposes -%D (this might change). - -\ifnum\texengine=\luatexengine - \let\attributeunsetvalue\mincountervalue % used to be \minusone - \def\newattribute{\allocateregister\lastallocatedattribute\attribute\attributedef\maxallocatedregister} -\fi - -%D Not used by \CONTEXT\ but for instance \PICTEX\ needs it. It's a -%D trick to force strings instead of tokens that take more memory. -%D It's a trick to trick to force strings. - -\def\newhelp#1#2{\newtoks#1#1\expandafter{\csname#2\endcsname}} - -%D \macros -%D {scratchcounter, -%D scratchdimen,scratchskip,scratchmuskip, -%D scratchbox, -%D scratchtoks} -%D -%D We now define a few scratch registers, so that successive -%D loads at least have some available. - -\newcount \scratchcounter \newcount \globalscratchcounter -\newdimen \scratchdimen \newdimen \globalscratchdimen -\newskip \scratchskip \newskip \globalscratchskip -\newmuskip \scratchmuskip \newmuskip \globalscratchmuskip -\newtoks \scratchtoks \newtoks \globalscratchtoks -\newbox \scratchbox \newbox \globalscratchbox - -\newcount\scratchcounterone \newcount\scratchcountertwo \newcount\scratchcounterthree -\newdimen \scratchdimenone \newdimen \scratchdimentwo \newdimen \scratchdimenthree -\newdimen \scratchskipone \newdimen \scratchskiptwo \newdimen \scratchskipthree -\newbox \scratchmuskipone \newbox \scratchmuskiptwo \newbox \scratchmuskipthree -\newtoks \scratchtoksone \newtoks \scratchtokstwo \newtoks \scratchtoksthree -\newbox \scratchboxone \newbox \scratchboxtwo \newbox \scratchboxthree - -%D More allocations: - -\newskip \zeroskip \zeroskip = 0pt plus 0pt minus 0pt -\newdimen\zeropoint \zeropoint = 0pt -\newdimen\onepoint \onepoint = 1pt -\newdimen\maxdimen \maxdimen = 16383.99999pt -\newdimen\onebasepoint \onebasepoint = 1bp -\newdimen\scaledpoint \scaledpoint = 1sp -\newdimen\thousandpoint\thousandpoint= 1000pt - -\let\points\onepoint - -\newtoks \emptytoks - -%D And even more: - -%newcount \minusone \minusone = -1 -\newcount \minustwo \minustwo = -2 -%chardef \zerocount = 0 -%chardef \plusone = 1 -\chardef \plustwo = 2 -\chardef \plusthree = 3 -\chardef \plusfour = 4 -\chardef \plusfive = 5 -\chardef \plussix = 6 -\chardef \plusseven = 7 -\chardef \pluseight = 8 -\chardef \plusnine = 9 -\chardef \plusten = 10 -\chardef \plussixteen = 16 -\chardef \plushundred = 100 -\chardef \pluscxxvii = 127 -\chardef \pluscxxviii = 128 -\chardef \pluscclv = 255 - -\ifnum\texengine=\luatexengine - \chardef \pluscclvi = 256 - \chardef \plusthousand = 1000 - \chardef \plustenthousand = 10000 - \chardef \plustwentythousand = 20000 - \chardef \medcard = 32768 - \chardef \maxcard = 65536 % pdftex has less mathchars -\else - \mathchardef\pluscclvi = 256 - \mathchardef\plusthousand = 1000 - \mathchardef\plustenthousand = 10000 - \mathchardef\plustwentythousand = 20000 - \newcount \medcard \medcard = 32768 % pdftex has less mathchars - \newcount \maxcard \maxcard = 65536 % pdftex has less mathchars -\fi - -%D We prefer the more readable variant than in plain -%D \TEX. User should only use \type {\emptybox}: - -\newbox\voidbox - -\def\emptybox {\box \voidbox} -\def\unvoidbox{\unhbox\voidbox} - -\let\leavevmode\unvoidbox % we prefer to use \dontleavehmode - -%D Some expected plain variants follow. We don't reuse registers -%D because we don't want clashes. - -\newdimen\p@ \p@ \onepoint -\newcount\m@ne \m@ne \minusone -\newdimen\z@ \z@ \zeropoint -\let \@ne \plusone -\let \tw@ \plustwo -\let \thr@@ \plusthree -\let \sixt@@n \sixteen -\let \@cclv \pluscclv -\let \@cclvi \pluscclvi -\newbox \voidb@x -\newtoks \toks@ - -%D We define \type {\newif} a la plain \TEX, but will -%D redefine it later. As Knuth says: -%D -%D \startnarrower -%D And here's a different sort of allocation: for example, -%D -%D \starttyping -%D \newif\iffoo -%D \stoptyping -%D -%D creates \type {\footrue}, \type {\foofalse} to go -%D with \type {\iffoo}. -%D \stopnarrower - -\def\newif#1% - {\count@\escapechar - \escapechar\minusone - \expandafter\expandafter\expandafter\def\@if #1{true}{\let#1\iftrue }% - \expandafter\expandafter\expandafter\def\@if#1{false}{\let#1\iffalse}% - \@if#1{false}% the condition starts out false - \escapechar\count@} - -\def\@if#1#2% - {\csname\expandafter\if@\string#1#2\endcsname} - -\bgroup % `if' is required - - \uccode`1=`i \uccode`2=`f \uppercase{\gdef\if@12{}} - -\egroup - -%D Let's test this one: - -\newif\ifdone - -%D \macros -%D {@@escape,@@begingroup,@@endgroup,@@mathshift,@@alignment, -%D @@endofline,@@parameter,@@superscript,@@subscript, -%D @@ignore,@@space,@@letter,@@other,@@active,@@comment} -%D -%D In \CONTEXT\ we sometimes manipulate the \CATCODES\ of certain -%D characters. Because we are not that good at remembering numbers, -%D we introduce some symbolic names. - -%D As we now have catc-* files, we also have more readable names - -\chardef\@@escape = 0 -\chardef\@@begingroup = 1 -\chardef\@@endgroup = 2 -\chardef\@@mathshift = 3 -\chardef\@@alignment = 4 -\chardef\@@endofline = 5 -\chardef\@@parameter = 6 -\chardef\@@superscript = 7 -\chardef\@@subscript = 8 -\chardef\@@ignore = 9 -\chardef\@@space = 10 -\chardef\@@letter = 11 -\chardef\@@other = 12 \chardef\other = 12 -\chardef\@@active = 13 \chardef\active = 13 -\chardef\@@comment = 14 - -%D Constants to be used with \type {\currentgrouptype}. - -\chardef\@@bottomlevelgroup = 0 -\chardef\@@simplegroup = 1 -\chardef\@@hboxgroup = 2 -\chardef\@@adjustedhboxgroup = 3 -\chardef\@@vboxgroup = 4 -\chardef\@@vtopgroup = 5 -\chardef\@@aligngroup = 6 -\chardef\@@noaligngroup = 7 -\chardef\@@outputgroup = 8 -\chardef\@@mathgroup = 9 -\chardef\@@discretionarygroup = 10 -\chardef\@@insertgroup = 11 -\chardef\@@vcentergroup = 12 -\chardef\@@mathchoicegroup = 13 -\chardef\@@semisimplegroup = 14 -\chardef\@@mathshiftgroup = 15 -\chardef\@@mathleftgroup = 16 - -\chardef\@@vadjustgroup = \@@insertgroup - -%D Constants to be used with \type {\interactionmode}. - -\chardef\@@batchmode = 0 -\chardef\@@nonstopmode = 1 -\chardef\@@scrollmode = 2 -\chardef\@@errorstopmode = 3 - -%D Constants to be used with \type {\lastnodetype}. The \type -%D {\lastnodetype} primitive is \ETEX\ compliant. The valid range is -%D still -1 .. 15 and glyph nodes have number 0 (used to be char -%D node) and ligature nodes are mapped to 7. That way macro packages -%D can use the same symbolic names as in traditional \ETEX. Keep in -%D mind that the internal node numbers are different and that there -%D are more node types that 15. - -\chardef\@@charnode = 0 -\chardef\@@hlistnode = 1 -\chardef\@@vlistnode = 2 -\chardef\@@rulenode = 3 -\chardef\@@insertnode = 4 -\chardef\@@marknode = 5 -\chardef\@@adjustnode = 6 -\chardef\@@ligaturenode = 7 -\chardef\@@discretionarynode = 8 -\chardef\@@whatsitnode = 9 -\chardef\@@mathnode = 10 -\chardef\@@gluenode = 11 -\chardef\@@kernnode = 12 -\chardef\@@penaltynode = 13 -\chardef\@@unsetnode = 14 -\chardef\@@mathsnode = 15 - -%D Constants to be used with \type {\currentiftype}. - -\chardef\@@charif = 1 -\chardef\@@catif = 2 -\chardef\@@numif = 3 -\chardef\@@dimif = 4 -\chardef\@@oddif = 5 -\chardef\@@vmodeif = 6 -\chardef\@@hmodeif = 7 -\chardef\@@mmodeif = 8 -\chardef\@@innerif = 9 -\chardef\@@voidif = 10 -\chardef\@@hboxif = 11 -\chardef\@@vboxif = 12 -\chardef\@@xif = 13 -\chardef\@@eofif = 14 -\chardef\@@trueif = 15 -\chardef\@@falseif = 16 -\chardef\@@caseif = 17 -\chardef\@@definedif = 18 -\chardef\@@csnameif = 19 -\chardef\@@fontcharif = 20 - -%D Of course we want even bigger log files, so we copied this -%D from the \ETEX\ source files. -%D -%D When watching such logs, beware of nasty side effects of -%D \type {\scantokens}, as in: -%D -%D \starttyping -%D \bgroup -%D \lccode`a=12\lowercase{\xdef\whatever{a}}\egroup -%D \def\whatever{test \whatever test} -%D \scantokens\expandafter{\whatever} -%D \egroup -%D \stoptyping -%D -%D In \LUATEX\ we have ways around this. - -\def\tracingall - {\tracingonline \plusone - \tracingcommands \plusthree - \tracingstats \plustwo - \tracingpages \plusone - \tracingoutput \plusone - \tracinglostchars \plustwo - \tracingmacros \plustwo - \tracingparagraphs\plusone - \tracingrestores \plusone - \showboxbreadth \maxdimen - \showboxdepth \maxdimen - \tracinggroups \plusone - \tracingifs \plusone - \tracingscantokens\plusone - \tracingnesting \plusone - \tracingassigns \plustwo - \errorstopmode} - -\def\loggingall - {\tracingall - \tracingonline \zerocount} - -\def\tracingnone - {\tracingassigns \zerocount - \tracingnesting \zerocount - \tracingscantokens\zerocount - \tracingifs \zerocount - \tracinggroups \zerocount - \showboxdepth \plusthree - \showboxbreadth \plusfive - \tracingrestores \zerocount - \tracingparagraphs\zerocount - \tracingmacros \zerocount - \tracinglostchars \plusone - \tracingoutput \zerocount - \tracingpages \zerocount - \tracingstats \zerocount - \tracingcommands \zerocount - \tracingonline \zerocount} - -%D Just for tracing purposes we set: - -\tracingstats\plusone - -%D Here we also save \type {\input}, more will be saved later. - -\ifdefined\normalinput \else \let\normalinput\input \fi - -%D We don't like outer commands, and we always want access -%D to the original \type {\input} primitive. - -\let\normalouter\outer \def\outer{} % no longer \relax - -%D To circumvent dependencies, we can postpone certain -%D initializations to dumping time, by appending them to the -%D \type {\everydump} token register. - -\ifdefined\normaldump \else \let\normaldump\dump \fi - -\newtoks\everydump - -\def\dump{\the\everydump\normaldump} - -%D The same applies for the startup actions. - -\ifdefined\normaleveryjob \else \let\normaleveryjob\everyjob \fi - -\let\everyjob\relax \newtoks\everyjob - -\normaleveryjob{\the\everyjob} - -\def\appendtotoks #1{\def\temp{#1}\afterassignment\doappendtotoks \scratchtoks=} -\def\prependtotoks#1{\def\temp{#1}\afterassignment\doprependtotoks\scratchtoks=} - -\def\doappendtotoks {\expandafter\expandafter\expandafter{\expandafter\the\expandafter\temp\the\scratchtoks}} -\def\doprependtotoks{\expandafter\expandafter\expandafter{\expandafter\the\expandafter\scratchtoks\the\temp}} - -%D \macros -%D {begcsname} -%D -%D Handy for \ETEX-only usage (avoids making \type {\relax}'s: - -\def\begcsname#1\endcsname{\ifcsname#1\endcsname\csname#1\endcsname\fi} - -%D Now come a few macros that might be needed in successive loading: - -\let\endgraf\par -\let\endline\cr - -\def\space{ } -\def\empty{} -\def\null {\hbox{}} - -%D The following two might be overloaded later on but some modules need -%D then earlier. These functionality is reflected in the name and will not -%D change. - -\bgroup - \catcode`\^^M=\active% - \gdef\obeylines{\catcode`\^^M\active \let^^M\par}% - \global\let^^M\par% -\egroup - -\bgroup - \gdef\obeyspaces{\catcode`\ \active}% - \obeyspaces\global\let =\space% -\egroup - -%D Also needed might be a simple loop structure and we borrow -%D plain \TEX's one as it is often expected to be present and -%D it is about the fastest you can get. Beware: this macro -%D does not support nested loops. We use a namespace prefix -%D \type {@@pln}. - -\long\def\loop#1\repeat{\long\def\@@plnbody{#1}\@@plniterate} - -%D The following makes \type {\loop} \unknown\ \type {\if} -%D \unknown\ \type {\repeat} skippable (clever trick): - -\let\repeat\fi % so both \loop and \repeat are reserved words! - -%D The original (no \type {@@pln} there): -%D -%D \starttyping -%D \def\@@plniterate{\@@plnbody\let\next\@@plniterate\else\let\next\relax\fi\next} -%D \stoptyping -%D -%D A more efficient alternative: -%D -%D \starttyping -%D \def\@@plniterate{\@@plnbody\expandafter\@@plniterate\else\expandafter\relax\fi} -%D \stoptyping -%D -%D An even more efficient one: - -\def\@@plniterate{\@@plnbody\expandafter\@@plniterate\else\fi} - -%D We don't define a real output routine yet but at least get rid -%D of pages: - -\output{\shipout\box\normalpagebox} - -%D Although we don't add pagenumbers yet we alias the default -%D register used for counting pages: - -\countdef\pageno=0 \pageno=1 % first page is number 1 - -%D Beside the raw counter \type {\pageno} the \type {\folio} -%D macro provides the value. - -\def\folio{\the\pageno} % kind of expected and therefore reserved - -%D The following registers are kind of standard and (for the moment) -%D we define them here. This might change. - -\newskip \bigskipamount \bigskipamount = 12pt plus 4pt minus 4pt -\newskip \medskipamount \medskipamount = 6pt plus 2pt minus 2pt -\newskip \smallskipamount \smallskipamount = 3pt plus 1pt minus 1pt - -\baselineskip = 12pt -\lineskip = 1pt -\lineskiplimit = 0pt - -%D Again a few kind-of-extensions the core: - -\newskip \hideskip \hideskip = -1000pt plus 1fill -\newskip \centering \centering = 0pt plus 1000pt minus 1000pt - -\def\hidewidth % for alignment entries that can stick out - {\hskip\hideskip} - -\def\ialign % initialized \halign - {\everycr{}% - \tabskip\zeroskip - \halign} - -\newcount \mscount - -\def\spanomit{\span\omit} % bypass error message - -\def\multispan#1% - {\omit - \mscount#1\relax - \loop - \ifnum\mscount>\plusone - \spanomit \advance\mscount\minusone - \repeat} - -%D The next section deals with selective definitions in -%D later modules. One can of course use the \type {\texengine} -%D number that we defined earlier instead. - -\bgroup \obeylines - \gdef\pickupSOMETEX#1% - {\expandafter\gdef\csname begin#1\endcsname{\bgroup\obeylines\dopickupSOMETEX{#1}}} - \gdef\dopickupSOMETEX#1#2 - % {\egroup\immediate\write16{special code for #1 -> [line \the\inputlineno] \detokenize{#2}}} - {\egroup} -\egroup - -\let\endTEX \relax \long\def\beginTEX #1\endTEX {} -\let\endETEX \relax \long\def\beginETEX #1\endETEX {} -\let\endXETEX \relax \long\def\beginXETEX #1\endXETEX {} -\let\endLUATEX\relax \long\def\beginLUATEX#1\endLUATEX{} -\let\endOLDTEX\relax \long\def\beginOLDTEX#1\endOLDTEX{} -\let\endNEWTEX\relax \long\def\beginNEWTEX#1\endNEWTEX{} - -\pickupSOMETEX{ETEX} - -\ifnum\texengine=\xetexengine - \pickupSOMETEX{XETEX} -\fi -\ifnum\texengine=\luatexengine - \pickupSOMETEX{LUATEX} -\fi -\ifnum\texengine<\xetexengine - \pickupSOMETEX{OLDTEX} -\else - \pickupSOMETEX{NEWTEX} -\fi - -%D \macros -%D {bindprimitive} -%D -%D We can remap primitives (which is needed because of changes in -%D for instance \PDFTEX). - -\def\bindprimitive#1 #2 % new old - {\ifcsname#1\endcsname \else \ifcsname#2\endcsname - \expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname - \fi \fi} - -%D Because \XETEX\ also implements some \PDFTEX\ functionality, we take -%D care of this here instead of a dedicated module. Later modules need -%D to handle the undefined cases. - -%D These messy checks will disappear. - -% new after 1.10, watch the change in prefix - -\bindprimitive quitvmode ptexquitvmode -\bindprimitive noligatures ptexnoligatures -\bindprimitive setrandomseed ptexsetrandomseed -\bindprimitive uniformdeviate ptexuniformdeviate - -\bindprimitive quitvmode pdfquitvmode -\bindprimitive noligatures pdfnoligatures -\bindprimitive setrandomseed pdfsetrandomseed -\bindprimitive uniformdeviate pdfuniformdeviate - -\bindprimitive resettimer pdfresettimer -\bindprimitive elapsedtime pdfelapsedtime - -% new per 1.40 - -\bindprimitive ifprimitive ifpdfprimitive -\bindprimitive primitive pdfprimitive -\bindprimitive ifabsdim ifpdfabsdim -\bindprimitive ifabsnum ifpdfabsnum - -\ifnum\texengine=\xetexengine \else % this test might disappear some day - - \pdfminorversion \plusfive - - \ifdefined\pdfcompresslevel \else \newcount\pdfcompresslevel \fi - \ifdefined\pdfobjcompresslevel \else \newcount\pdfobjcompresslevel \fi - \ifdefined\pdfgentounicode \else \newcount\pdfgentounicode \fi \pdfgentounicode \plusone - \ifdefined\pdfinclusioncopyfonts\else \newcount\pdfinclusioncopyfonts \fi \pdfinclusioncopyfonts\plusone - - \def\nopdfcompression {\pdfobjcompresslevel\zerocount \pdfcompresslevel\zerocount} - \def\maximumpdfcompression{\pdfobjcompresslevel\plusnine \pdfcompresslevel\plusnine } - \def\normalpdfcompression {\pdfobjcompresslevel\plusthree \pdfcompresslevel\plusthree} - - \normalpdfcompression - - \let\normalsetrandomseed \setrandomseed - \let\normaluniformdeviate\uniformdeviate - -\fi - -%D Handy. - -\ifnum\texengine=\luatexengine - \ifdefined\suppresslongerror % for the moment test - \suppresslongerror\plusone - \fi -\fi - -%D Basic status stuff. - -\newif\ifproductionrun - -%D We need to make sure that we start up in \DVI\ mode, so, -%D after testing for running \PDFTEX, we default to \DVI. - -\ifx\pdftexversion\undefined \newcount\pdfoutput \fi \pdfoutput=0 - -%D For those who expect this \unknown - -\ifx\fmtname \undefined \def\fmtname {ConTeXt Minimized Plain TeX} \fi -\ifx\fmtversion\undefined \def\fmtversion{3.1415926} \fi - -\let\normalfmtversion\fmtversion - -%D A few bonus macros: - -\def\modulonumber#1#2{\the\numexpr#2-((((#2+(#1/2))/#1)-1)*#1)\relax} -\def\dividonumber#1#2{\the\numexpr(#2-(#1/2))/#1\relax} - -\ifnum\texengine=\xetexengine - \edef\xetexversion {\numexpr\XeTeXversion*100+(\expandafter\gobbleoneargument\XeTeXrevision-5)/10\relax} - \edef\xetexrevision {\the\numexpr(\expandafter\gobbleoneargument\XeTeXrevision-50)/100\relax} -\fi - -\ifcase\texengine - \def\texenginename {impossible} - \edef\texengineversion{0} -\or - \def\texenginename {pdfTeX} - \edef\texengineversion{\dividonumber{100}\pdftexversion.\modulonumber{100}\pdftexversion.\pdftexrevision} -\or - \def\texenginename {XeTeX} - \edef\texengineversion{\dividonumber{100}\xetexversion .\modulonumber{100}\xetexversion .\xetexrevision} -\or - \def\texenginename {LuaTeX} - \edef\texengineversion{\dividonumber{100}\luatexversion.\modulonumber{100}\luatexversion.\luatexrevision} -\else - \def\texenginename {impossible} - \edef\texengineversion{0} -\fi - -%D While cleaning this code up a bit I was listening to Heather -%D Nova's \CD\ Redbird. The first song on that \CD\ ends with -%D a few lines suitable for ending this initialization module: -%D -%D \startlines -%D And there's so much I can do for you -%D Given time I know that I can prove -%D Now my world is opened up to you -%D Come inside -%D -%D Welcome to my life -%D Welcome to my world -%D Come inside -%D \stoplines -%D -%D So let's see what \TEX\ can do now that we've opened up -%D the basic machinery. - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/syst-ltx.tex b/Master/texmf-dist/tex/context/base/syst-ltx.tex deleted file mode 100644 index ae89ff25b81..00000000000 --- a/Master/texmf-dist/tex/context/base/syst-ltx.tex +++ /dev/null @@ -1,56 +0,0 @@ -%D \module -%D [ file=syst-ltx, -%D version=2009.10.13, -%D title=\CONTEXT\ System Macros, -%D subtitle=General, -%D author=Hans Hagen, -%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 \macros -%D {newcommand} -%D -%D This module replaces \type {t-bibltx} and implements the -%D \LATEX\ newcommand (sort of). This command is not to be -%D used directly but only is there for the occasional -%D \BIBTEX\ file that uses it. -%D -%D \starttyping -%D \newcommand\oeps {oeps} -%D \newcommand\oeps[6] {oeps[#1]#6} -%D \newcommand\oeps[6][whatever]{oeps[#1]#6} -%D \stoptyping - -\unprotect - -\def\newcommand#1% - {\dotripleempty\donewcommand[#1]} - -\def\donewcommand - {\ifthirdargument - \expandafter\donewcommandtwo - \else\ifsecondargument - \expandafter\expandafter\expandafter\donewcommandone - \else - \expandafter\expandafter\expandafter\donewcommandzero - \fi\fi} - -\def\donewcommandzero[#1][#2][#3]% - {\long\def#1} - -\def\donewcommandone[#1][#2][#3]% - {\scratchtoks{\long\def#1}% - \dorecurse{#2}{\scratchtoks\expandafter{\the\scratchtoks######1}}% - \the\scratchtoks} - -\def\donewcommandtwo[#1][#2][#3]% - {\long\def#1{\doifnextcharelse[{\getvalue{>>\string#1>>}}{\getvalue{>>\string#1>>}[#3]}}% - \scratchtoks{\long\setvalue{>>\string#1>>}[##1]}% - \dostepwiserecurse{2}{#2}{1}{\scratchtoks\expandafter{\the\scratchtoks######1}}% - \the\scratchtoks} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/syst-lua.lua b/Master/texmf-dist/tex/context/base/syst-lua.lua index 64028295350..8a5a9531c1b 100644 --- a/Master/texmf-dist/tex/context/base/syst-lua.lua +++ b/Master/texmf-dist/tex/context/base/syst-lua.lua @@ -8,33 +8,19 @@ if not modules then modules = { } end modules ['syst-lua'] = { local texsprint, texprint, texwrite, texiowrite_nl = tex.sprint, tex.print, tex.write, texio.write_nl local format, find = string.format, string.find -local lpegmatch = lpeg.match +local tonumber = tonumber +local S, Ct, lpegmatch, lpegsplitat = lpeg.S, lpeg.Ct, lpeg.match, lpeg.splitat local ctxcatcodes = tex.ctxcatcodes -commands = commands or { } cs = commands -- shorter +commands = commands or { } -- cs = commands -- shorter, maybe some day, not used now -function commands.writestatus(a,b,c,...) - if c then - texiowrite_nl(format("%-16s: %s\n",a,format(b,c,...))) - else - texiowrite_nl(format("%-16s: %s\n",a,b)) -- b can have %'s - end -end -function commands.writedebug(a,b,c,...) - if c then - texiowrite_nl(format("%-16s| %s\n",a,format(b,c,...))) - else - texiowrite_nl(format("%-16s| %s\n",a,b)) -- b can have %'s - end -end +function commands.writestatus(...) logs.status(...) end -- overloaded later -function commands.report(s,t,...) - commands.writestatus("!"..s,format(t,...)) -end +-- todo: use shorter names i.e. less tokenization local function testcase(b) - if b then -- faster with if than with expression + if b then -- looks faster with if than with expression texsprint(ctxcatcodes,"\\firstoftwoarguments") else texsprint(ctxcatcodes,"\\secondoftwoarguments") @@ -51,6 +37,7 @@ function commands.doif(b) texsprint(ctxcatcodes,"\\gobbleoneargument") end end + function commands.doifnot(b) if b then texsprint(ctxcatcodes,"\\gobbleoneargument") @@ -67,7 +54,7 @@ function commands.doifelsespaces(str) return commands.doifelse(find(str,"^ +$")) end -local s = lpeg.Ct(lpeg.splitat(",")) +local s = Ct(lpegsplitat(",")) local h = { } function commands.doifcommonelse(a,b) @@ -96,14 +83,25 @@ function commands.doifinsetelse(a,b) return testcase(false) end -function commands. def (cs,value) texsprint(ctxcatcodes,format( "\\def\\%s{%s}",cs,value)) end -function commands.edef (cs,value) texsprint(ctxcatcodes,format("\\edef\\%s{%s}",cs,value)) end -function commands.gdef (cs,value) texsprint(ctxcatcodes,format("\\gdef\\%s{%s}",cs,value)) end -function commands.xdef (cs,value) texsprint(ctxcatcodes,format("\\xdef\\%s{%s}",cs,value)) end -function commands.chardef(cs,value) texsprint(ctxcatcodes,format("\\chardef\\%s=%s\\relax",cs,value)) end - local pattern = lpeg.patterns.validdimen function commands.doifdimenstringelse(str) testcase(lpegmatch(pattern,str)) end + +local splitter = lpegsplitat(S(". ")) + +function commands.doifolderversionelse(one,two) -- one >= two + if not two then + one, two = environment.version, one + elseif one == "" then + one = environment.version + end + local y_1, m_1, d_1 = lpegmatch(splitter,one) + local y_2, m_2, d_2 = lpegmatch(splitter,two) + commands.testcase ( + (tonumber(y_1) or 0) >= (tonumber(y_2) or 0) and + (tonumber(m_1) or 0) >= (tonumber(m_2) or 0) and + (tonumber(d_1) or 0) >= (tonumber(d_1) or 0) + ) +end diff --git a/Master/texmf-dist/tex/context/base/syst-lua.mkiv b/Master/texmf-dist/tex/context/base/syst-lua.mkiv index 40cd9f75685..3ed70cc0b77 100644 --- a/Master/texmf-dist/tex/context/base/syst-lua.mkiv +++ b/Master/texmf-dist/tex/context/base/syst-lua.mkiv @@ -15,15 +15,15 @@ \unprotect -\def\expdoifelse#1#2{\ctxlua{commands.doifelse(\!!bs#1\!!es==\!!bs#2\!!es)}} -\def\expdoif #1#2{\ctxlua{commands.doif (\!!bs#1\!!es==\!!bs#2\!!es)}} -\def\expdoifnot #1#2{\ctxlua{commands.doifnot (\!!bs#1\!!es==\!!bs#2\!!es)}} +\def\expdoifelse#1#2{\ctxcommand{doifelse(\!!bs#1\!!es==\!!bs#2\!!es)}} +\def\expdoif #1#2{\ctxcommand{doif (\!!bs#1\!!es==\!!bs#2\!!es)}} +\def\expdoifnot #1#2{\ctxcommand{doifnot (\!!bs#1\!!es==\!!bs#2\!!es)}} % \testfeatureonce{100000}{\doifelse{hello world}{here i am}{}} % 0.3 % \testfeatureonce{100000}{\expandabledoifelse{hello world}{here i am}{}} % 1.5 -\def\expdoifcommonelse#1#2{\ctxlua{commands.doifcommonelse("#1","#2")}} -\def\expdoifinsetelse #1#2{\ctxlua{commands.doifinsetelse("#1","#2")}} +\def\expdoifcommonelse#1#2{\ctxcommand{doifcommonelse("#1","#2")}} +\def\expdoifinsetelse #1#2{\ctxcommand{doifinsetelse("#1","#2")}} % we define these here, just in case ... @@ -32,6 +32,12 @@ \edef\!!bs{[\luastringsep[} \edef\!!es{]\luastringsep]} -\def\writestatus#1#2{\ctxlua{commands.writestatus(\!!bs#1\!!es,\!!bs#2\!!es)}} +\def\writestatus#1#2{\ctxcommand{writestatus(\!!bs#1\!!es,\!!bs#2\!!es)}} + +% a handy helper (we can probably omit the tex.ctxcatcodes here as nowadays we seldom +% change the regime at the tex end + +%def\luaexpr#1{\ctxlua {tex.sprint(tex.ctxcatcodes,tostring(#1))}} +\def\luaexpr#1{\directlua\zerocount{tex.sprint(tex.ctxcatcodes,tostring(#1))}} % wrap in global function ? \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/syst-mes.mkiv b/Master/texmf-dist/tex/context/base/syst-mes.mkiv new file mode 100644 index 00000000000..070c7af72f9 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/syst-mes.mkiv @@ -0,0 +1,22 @@ +%D \module +%D [ file=syst-mes, +%D version=2010.06.03, +%D title=\CONTEXT\ System Macros, +%D subtitle=Messages, +%D author=Hans Hagen, +%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. + +\newtoks\everywritestring + +\def\writedirect {\immediate\write\statuswrite} +\def\writeline {\writedirect{}} +\def\writestring#1{\begingroup\the\everywritestring\writedirect{#1}\endgroup} +\let\writebanner \writestring +\let\message \normalmessage + +\endinput diff --git a/Master/texmf-dist/tex/context/base/syst-pln.mkii b/Master/texmf-dist/tex/context/base/syst-pln.mkii new file mode 100644 index 00000000000..f2b6129ff99 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/syst-pln.mkii @@ -0,0 +1,118 @@ +%D \module +%D [ file=syst-pln, +%D version=2001.11.16, % 1999.03.17, % an oldie: 1995.10.10 +%D title=\CONTEXT\ System Macros, +%D subtitle=Efficient \PLAIN\ \TEX\ loading, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +%D This module set a couple of variables to the plain \TEX\ +%D values. Later they might be overloaded. + +%D Build||in numeric variables. + +\adjdemerits = 10000 +\binoppenalty = 700 +\brokenpenalty = 100 +\clubpenalty = 150 +%day = 0 +\defaulthyphenchar = `\- +\defaultskewchar = -1 +\delimiterfactor = 901 +\displaywidowpenalty = 50 +\doublehyphendemerits = 10000 +%endlinechar = `\^^M +\errorcontextlines = 5 +%escapechar = `\\ +\exhyphenpenalty = 50 +%fam = 0 +\finalhyphendemerits = 5000 +%floatingpenalty = 0 +%globaldefs = 0 +%hangafter = 1 +\hbadness = 1000 +%holdinginserts = 0 +\hyphenpenalty = 50 +%interlinepenalty = 0 +%language = 0 +\lefthyphenmin = 2 +\linepenalty = 10 +%looseness = 0 +%mag = 1000 +%maxdeadcycles = 25 +%month = 0 +%newlinechar = -1 % commented i.e. no plain value +%outputpenalty = 0 +%pausing = 0 +%postdisplaypenalty = 0 +\predisplaypenalty = 10000 +\pretolerance = 100 +\relpenalty = 500 +\righthyphenmin = 3 +\showboxbreadth = 5 +\showboxdepth = 3 +%time = 0 +\tolerance = 200 +%tracingcommands = 0 +\tracinglostchars = 1 +%tracingmacros = 0 +%tracingonline = 0 +%tracingoutput = 0 +%tracingpages = 0 +%tracingparagraphs = 0 +%tracingrestores = 0 +%tracingstats = 0 +\uchyph = 1 +\vbadness = 1000 +\widowpenalty = 150 +%year = 0 + +%D Build in dimension variables. + +\abovedisplayshortskip = 0pt plus 3pt +\abovedisplayskip = 12pt plus 3pt minus 9pt +%baselineskip = 0pt +\belowdisplayshortskip = 7pt plus 3pt minus 4pt +\belowdisplayskip = 12pt plus 3pt minus 9pt +\boxmaxdepth = \maxdimen +\delimitershortfall = 5pt +%displayindent = 0pt +%displaywidth = 0pt +%hangindent = 0pt +\hfuzz = 0.1pt +%hoffset = 0pt +\hsize = 6.5in +%leftskip = 0pt +%lineskip = 0pt +%lineskiplimit = 0pt +%mathsurround = 0pt +\maxdepth = 4pt +\medmuskip = 4mu plus 2mu minus 4mu +\nulldelimiterspace = 1.2pt +\overfullrule = 5pt +\parfillskip = 0pt plus 1fil +\parindent = 20pt +\parskip = 0pt plus 1pt +%predisplaysize = 0pt +%rightskip = 0pt +\scriptspace = 0.5pt +%spaceskip = 0pt +\splitmaxdepth = \maxdimen +\splittopskip = 10pt +%tabskip = 0pt +\thickmuskip = 5mu plus 5mu +\thinmuskip = 3mu +\topskip = 10pt +\vfuzz = 0.1pt +%voffset = 0pt +\vsize = 8.9in +%xspaceskip = 0pt + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/syst-pln.mkiv b/Master/texmf-dist/tex/context/base/syst-pln.mkiv new file mode 100644 index 00000000000..7fa91b73d40 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/syst-pln.mkiv @@ -0,0 +1,120 @@ +%D \module +%D [ file=syst-pln, +%D version=2001.11.16, % 1999.03.17, % an oldie: 1995.10.10 +%D title=\CONTEXT\ System Macros, +%D subtitle=Efficient \PLAIN\ \TEX\ loading, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +%D This module set a couple of variables to the plain \TEX\ +%D values. Later they might be overloaded. There is not much +%D difference between \MKII\ and \MKIV\ but at some point they +%D might diverge. + +%D Build||in numeric variables. + +\adjdemerits = 10000 +\binoppenalty = 700 +\brokenpenalty = 100 +\clubpenalty = 150 +%day = 0 +\defaulthyphenchar = `\- +\defaultskewchar = -1 +\delimiterfactor = 901 +\displaywidowpenalty = 50 +\doublehyphendemerits = 10000 +%endlinechar = `\^^M +\errorcontextlines = 5 +%escapechar = `\\ +\exhyphenpenalty = 50 +%fam = 0 +\finalhyphendemerits = 5000 +%floatingpenalty = 0 +%globaldefs = 0 +%hangafter = 1 +\hbadness = 1000 +%holdinginserts = 0 +\hyphenpenalty = 50 +%interlinepenalty = 0 +%language = 0 +\lefthyphenmin = 2 +\linepenalty = 10 +%looseness = 0 +%mag = 1000 +%maxdeadcycles = 25 +%month = 0 +%newlinechar = -1 % commented i.e. no plain value +%outputpenalty = 0 +%pausing = 0 +%postdisplaypenalty = 0 +\predisplaypenalty = 10000 +\pretolerance = 100 +\relpenalty = 500 +\righthyphenmin = 3 +\showboxbreadth = 5 +\showboxdepth = 3 +%time = 0 +\tolerance = 200 +%tracingcommands = 0 +\tracinglostchars = 1 +%tracingmacros = 0 +%tracingonline = 0 +%tracingoutput = 0 +%tracingpages = 0 +%tracingparagraphs = 0 +%tracingrestores = 0 +%tracingstats = 0 +\uchyph = 1 +\vbadness = 1000 +\widowpenalty = 150 +%year = 0 + +%D Build in dimension variables. + +\abovedisplayshortskip = 0pt plus 3pt +\abovedisplayskip = 12pt plus 3pt minus 9pt +%baselineskip = 0pt +\belowdisplayshortskip = 7pt plus 3pt minus 4pt +\belowdisplayskip = 12pt plus 3pt minus 9pt +\boxmaxdepth = \maxdimen +\delimitershortfall = 5pt +%displayindent = 0pt +%displaywidth = 0pt +%hangindent = 0pt +\hfuzz = 0.1pt +%hoffset = 0pt +\hsize = 6.5in +%leftskip = 0pt +%lineskip = 0pt +%lineskiplimit = 0pt +%mathsurround = 0pt +\maxdepth = 4pt +\medmuskip = 4mu plus 2mu minus 4mu +\nulldelimiterspace = 1.2pt +\overfullrule = 5pt +\parfillskip = 0pt plus 1fil +\parindent = 20pt +\parskip = 0pt plus 1pt +%predisplaysize = 0pt +%rightskip = 0pt +\scriptspace = 0.5pt +%spaceskip = 0pt +\splitmaxdepth = \maxdimen +\splittopskip = 10pt +%tabskip = 0pt +\thickmuskip = 5mu plus 5mu +\thinmuskip = 3mu +\topskip = 10pt +\vfuzz = 0.1pt +%voffset = 0pt +\vsize = 8.9in +%xspaceskip = 0pt + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/syst-pln.tex b/Master/texmf-dist/tex/context/base/syst-pln.tex deleted file mode 100644 index f2b6129ff99..00000000000 --- a/Master/texmf-dist/tex/context/base/syst-pln.tex +++ /dev/null @@ -1,118 +0,0 @@ -%D \module -%D [ file=syst-pln, -%D version=2001.11.16, % 1999.03.17, % an oldie: 1995.10.10 -%D title=\CONTEXT\ System Macros, -%D subtitle=Efficient \PLAIN\ \TEX\ loading, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\unprotect - -%D This module set a couple of variables to the plain \TEX\ -%D values. Later they might be overloaded. - -%D Build||in numeric variables. - -\adjdemerits = 10000 -\binoppenalty = 700 -\brokenpenalty = 100 -\clubpenalty = 150 -%day = 0 -\defaulthyphenchar = `\- -\defaultskewchar = -1 -\delimiterfactor = 901 -\displaywidowpenalty = 50 -\doublehyphendemerits = 10000 -%endlinechar = `\^^M -\errorcontextlines = 5 -%escapechar = `\\ -\exhyphenpenalty = 50 -%fam = 0 -\finalhyphendemerits = 5000 -%floatingpenalty = 0 -%globaldefs = 0 -%hangafter = 1 -\hbadness = 1000 -%holdinginserts = 0 -\hyphenpenalty = 50 -%interlinepenalty = 0 -%language = 0 -\lefthyphenmin = 2 -\linepenalty = 10 -%looseness = 0 -%mag = 1000 -%maxdeadcycles = 25 -%month = 0 -%newlinechar = -1 % commented i.e. no plain value -%outputpenalty = 0 -%pausing = 0 -%postdisplaypenalty = 0 -\predisplaypenalty = 10000 -\pretolerance = 100 -\relpenalty = 500 -\righthyphenmin = 3 -\showboxbreadth = 5 -\showboxdepth = 3 -%time = 0 -\tolerance = 200 -%tracingcommands = 0 -\tracinglostchars = 1 -%tracingmacros = 0 -%tracingonline = 0 -%tracingoutput = 0 -%tracingpages = 0 -%tracingparagraphs = 0 -%tracingrestores = 0 -%tracingstats = 0 -\uchyph = 1 -\vbadness = 1000 -\widowpenalty = 150 -%year = 0 - -%D Build in dimension variables. - -\abovedisplayshortskip = 0pt plus 3pt -\abovedisplayskip = 12pt plus 3pt minus 9pt -%baselineskip = 0pt -\belowdisplayshortskip = 7pt plus 3pt minus 4pt -\belowdisplayskip = 12pt plus 3pt minus 9pt -\boxmaxdepth = \maxdimen -\delimitershortfall = 5pt -%displayindent = 0pt -%displaywidth = 0pt -%hangindent = 0pt -\hfuzz = 0.1pt -%hoffset = 0pt -\hsize = 6.5in -%leftskip = 0pt -%lineskip = 0pt -%lineskiplimit = 0pt -%mathsurround = 0pt -\maxdepth = 4pt -\medmuskip = 4mu plus 2mu minus 4mu -\nulldelimiterspace = 1.2pt -\overfullrule = 5pt -\parfillskip = 0pt plus 1fil -\parindent = 20pt -\parskip = 0pt plus 1pt -%predisplaysize = 0pt -%rightskip = 0pt -\scriptspace = 0.5pt -%spaceskip = 0pt -\splitmaxdepth = \maxdimen -\splittopskip = 10pt -%tabskip = 0pt -\thickmuskip = 5mu plus 5mu -\thinmuskip = 3mu -\topskip = 10pt -\vfuzz = 0.1pt -%voffset = 0pt -\vsize = 8.9in -%xspaceskip = 0pt - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/syst-str.mkiv b/Master/texmf-dist/tex/context/base/syst-str.mkiv deleted file mode 100644 index 57d76dc0375..00000000000 --- a/Master/texmf-dist/tex/context/base/syst-str.mkiv +++ /dev/null @@ -1,36 +0,0 @@ -%D \module -%D [ file=syst-str, -%D version=2006.09.18, -%D title=\CONTEXT\ System Macros, -%D subtitle=String Processing, -%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 - -% nb: these macros might go away ! -% -% todo: escape special chars in expr (\luaescapeexpression) - -%D 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 - {\dodoglobal\edef#1{\ctxlua{tex.sprint((string.gsub(\!!bs#1\!!es,\!!bs#2\!!es,"#3")))}}} - -\def\separatestring#1\to#2% - {\dodoglobal\def#2{\ctxlua{tex.sprint((string.gsub(\!!bs#1\!!es,"\letterpercent s+",",")))}}} - -\def\unspacefilename#1\to#2% - {\dodoglobal\def#2{\ctxlua{tex.sprint((string.gsub(\!!bs#1\!!es,"\letterpercent s+","-")))}}} - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/tabl-ltb.mkiv b/Master/texmf-dist/tex/context/base/tabl-ltb.mkiv index 7d3fab0df37..06e3eca2943 100644 --- a/Master/texmf-dist/tex/context/base/tabl-ltb.mkiv +++ b/Master/texmf-dist/tex/context/base/tabl-ltb.mkiv @@ -59,8 +59,9 @@ \unprotect -\chardef\linetablesplitstate\zerocount -\chardef\linetableheadstate \zerocount +\newconstant\linetablesplitstate +\newconstant\linetableheadstate +\newconstant\linetablemode \edef\??ler{\??le:r:} \edef\??lec{\??le:c:} @@ -89,9 +90,9 @@ \initializetablebox \zerocount % holds repeater -\chardef\linetablehmode \zerocount -\chardef\linetablepage \zerocount -\chardef\linetablerepeat\zerocount +\newconstant\linetablehmode +\newconstant\linetablepage +\newconstant\linetablerepeat \unexpanded\def\setuplinetable {\dotripleempty\dosetuplinetable} @@ -206,7 +207,7 @@ }% \global\linetablecolumn\scratchcounter \fi - \chardef\linetablemode + \linetablemode \iflinetablepreroll \ifdim\scratchdimen>\zeropoint \zerocount \else \plustwo \fi \else @@ -218,7 +219,7 @@ \or % fit, keep it simple \or - \chardef\linetablemode\plusone % line + \linetablemode\plusone % line \else % some already calculated height \fi @@ -375,14 +376,14 @@ \else % after, later \fi - \chardef\linetableheadstate\plusthree + \linetableheadstate\plusthree \global\setbox\tablebox\zerocount\emptybox % here \fi % reset \linetablerow will be an option, currently % starts at zero after split \globallet\linetablerow\!!zerocount \globallet\linetableline\!!zerocount - \global\chardef\linetablepage\zerocount + \global\linetablepage\zerocount \global\linetablewidth\zeropoint \setnoftableslines \fi} @@ -448,9 +449,9 @@ \savelinetablepart \fi \ifcase\linetablepage \or - \global\chardef\linetablepage \plustwo + \global\linetablepage \plustwo \else - \global\chardef\linetablepage \plusone + \global\linetablepage \plusone \fi \doglobal\increment\linetablepart \global\linetablewidth\wd\tablebox\zerocount @@ -482,9 +483,9 @@ \stoplinetablepart \savelinetablepart \ifcase\linetablepage \or - \global\chardef\linetablepage \plustwo + \global\linetablepage \plustwo \else - \global\chardef\linetablepage \plusone + \global\linetablepage \plusone \fi \doglobal\increment\linetablepart \ifnum\linetablepart>\noflinetableparts @@ -524,8 +525,8 @@ [\linetableparameter\c!stretch] [ \v!no=>{\setuplinetable[\c!stretch=\maxdimen]},% no stretch \v!yes=>{\setuplinetable[\c!stretch=\zeropoint]}]% max stretch - \chardef\linetablerepeat\linetableparameter\c!nleft - \chardef\linetablesplitstate % = + \linetablerepeat\linetableparameter\c!nleft + \linetablesplitstate % = \ifdim\linetableparameter\c!maxwidth>\zeropoint \zerocount \else \plusone \fi @@ -573,7 +574,7 @@ \unexpanded\def\stoplinetablerun {\globallet\linetableline\!!maxcard - \chardef\linetableheadstate\zerocount % blocked + \linetableheadstate\zerocount % blocked \flushlinetableparts \iflinetablepreroll \else \linetableparameter\c!after @@ -582,42 +583,6 @@ \globallet\noflinetableparts\!!zerocount \egroup} -% \def\checklinecolumnwidth -% {\ifundefined{\??lew\number\linetablecolumn}% -% \donetrue -% \else\ifdim\getvalue{\??lew\number\linetablecolumn}<\wd\linetablecell -% \donetrue -% \else -% \donefalse -% \fi\fi -% \ifdone -% \setxvalue{\??lew\number\linetablecolumn}{\the\wd\linetablecell}% -% \fi} -% -% \def\checklinecolumnwidth -% {\ifcsname\??lew\number\linetablecolumn\endcsname -% \ifdim\csname\??lew\number\linetablecolumn\endcsname<\wd\linetablecell -% \donetrue -% \else -% \donefalse -% \fi -% \else -% \donetrue -% \fi -% \ifdone -% \setxvalue{\??lew\number\linetablecolumn}{\the\wd\linetablecell}% -% \fi} - -% \def\checklinecolumnwidth -% {\expandafter\xdef\csname\??lew\number\linetablecolumn\endcsname -% {\expandafter\ifx\csname\??lew\number\linetablecolumn\endcsname\relax -% \the\wd\linetablecell -% \else\ifdim\csname\??lew\number\linetablecolumn\endcsname<\wd\linetablecell -% \the\wd\linetablecell -% \else -% \csname\??lew\number\linetablecolumn\endcsname -% \fi\fi}} - \def\checklinecolumndimension#1#2#3% {\expandafter\xdef\csname#1\number#3\endcsname {\expandafter\ifx\csname#1\number#3\endcsname\relax @@ -649,7 +614,7 @@ % \else\ifx\linetableheight\v!fit % % keep it simple % \else\ifx\linetableheight\v!line -% \chardef\linetablemode\plusone +% \linetablemode\plusone % \else % \!!heighta\linetableheight % \advance\!!heighta-\strutdepth @@ -658,11 +623,11 @@ \linetableheight\zeropoint \edef\!!stringa{\linetablerparameter\c!height}% \ifx\!!stringa\empty - \chardef\linetablehmode\zerocount + \linetablehmode\zerocount \else\ifx\!!stringa\v!fit - \chardef\linetablehmode\plusone + \linetablehmode\plusone \else\ifx\!!stringa\v!line - \chardef\linetablehmode\plustwo + \linetablehmode\plustwo \else \linetableheight\!!stringa \advance\linetableheight-\strutdepth @@ -703,10 +668,10 @@ \flushlinetablehead} \def\checklinetablepage - {\global\chardef\linetablepage\zerocount + {\global\linetablepage\zerocount \ifcase\linetablerepeat \else \ifcase\linetablepage \doif{\linetableparameter\c!repeat}\v!no - {\global\chardef\linetablepage\doifoddpageelse\plusone\plustwo}% + {\global\linetablepage\doifoddpageelse\plusone\plustwo}% \fi \fi} \def\flushlinetablehead @@ -718,9 +683,9 @@ % 2 head done \or % 3 trigger flush - \chardef\linetableheadstate\plusone + \linetableheadstate\plusone \the\@@linetablehead\relax - \chardef\linetableheadstate\plustwo + \linetableheadstate\plustwo \fi} \def\linetableNC % first time special treatment @@ -745,7 +710,7 @@ \unexpanded\def\startlinetableanalysis {\bgroup \linetableprerolltrue - \trialtypesettingtrue + \settrialtypesetting \startlinetablerun} \unexpanded\def\stoplinetableanalysis @@ -771,7 +736,7 @@ {\ifinlinetable \@@linetablehead\emptytoks \fi - \chardef\linetableheadstate3 % full + \linetableheadstate\plusthree % full \@@linetablehead{#1}% \ifinlinetable \flushlinetablehead @@ -814,17 +779,6 @@ \startlinetableanalysis\readfile{#1}\donothing\donothing\stoplinetableanalysis \startlinetablerun \readfile{#1}\donothing\donothing\stoplinetablerun \egroup} - -% will go away: - -\def\processlinetableXMLfile#1% - {\bgroup - \let\startlinetable\donothing - \let\stoplinetable \donothing - \startlinetableanalysis\processXMLfile{#1}\stoplinetableanalysis - \startlinetablerun \processXMLfile{#1}\stoplinetablerun - \egroup} - \protect \endinput \doifnotmode{demo}{\endinput} diff --git a/Master/texmf-dist/tex/context/base/tabl-ntb.mkii b/Master/texmf-dist/tex/context/base/tabl-ntb.mkii index 0bfcc20c68f..e243a55c21e 100644 --- a/Master/texmf-dist/tex/context/base/tabl-ntb.mkii +++ b/Master/texmf-dist/tex/context/base/tabl-ntb.mkii @@ -860,8 +860,12 @@ \crcr \noalign {\nointerlineskip - \ifnum\gettblnob\tblrow=\zerocount - \allowbreak + \ifnum\tblrow>\noftblheadlines + \ifnum\gettblnob\tblrow=\zerocount + \allowbreak + \fi + \else + \allowbreak % else no proper head split off \fi \bgroup % protect local vars \@@tblsplitafter diff --git a/Master/texmf-dist/tex/context/base/tabl-ntb.mkiv b/Master/texmf-dist/tex/context/base/tabl-ntb.mkiv index b24eaa85d3c..96b1aabed82 100644 --- a/Master/texmf-dist/tex/context/base/tabl-ntb.mkiv +++ b/Master/texmf-dist/tex/context/base/tabl-ntb.mkiv @@ -14,6 +14,7 @@ %D This is an unfinished, preliminary module. At least two %D runs are needed to get the table fixed. Ugly code. +% todo: TABLE TBL -> ntb % todo: special parsetb for argless variant % todo: protect \tbl... % todo: tblnx also count @@ -21,6 +22,22 @@ % todo: fast if % todo: avoid halign (just do it manual) and thereby globals +% \unexpanded\def\startrow {\bTR} +% \unexpanded\def\stoprow {\eTR} +% \unexpanded\def\startcell#1\stopcell{\bTD#1\eTD} +% \let\stopcell \relax +% \let\startcelltable \bTABLE +% \let\stopcelltable \eTABLE + +% \starttext +% \startcelltable +% \startrow \startcell a \stopcell \stoprow +% \startrow \startcell a \stopcell \stoprow +% \startrow \startcell a \stopcell \stoprow +% \startrow \startcell a \stopcell \stoprow +% \stopcelltable +% \stoptext + % optie=rek beschrijven \writestatus{loading}{ConTeXt Table Macros / Natural Tables} @@ -99,8 +116,11 @@ %D %D \typebuffer \getbuffer +\let\dotagTABLEalign\relax + \def\bTBLCELL % why not \doinhibitblank {\inhibitblank + \dotagTABLEalign \doconvertfont\tbltblstyle\empty \everypar{\tbltblleft\delayedbegstrut}} @@ -273,7 +293,7 @@ \processcommalist[#1]\dodosetupTABLE} \def\nopTABLEparameters[#1][#2]% - {\letvalue{\@@tblprefix#1}\empty} + {\letvalueempty{\@@tblprefix#1}} % can be made faster \def\setTABLEparameters[#1][#2]% {\pushTBLparameters @@ -466,17 +486,17 @@ \newcount\currentcol \newcount\tblspn -\def\parseTR[#1][#2]% [#2] is dummy that kills spaces / no #3 argument +\def\settblref#1#2{\expandafter\xdef\csname\@@tblprefix\number#1:\number#2:x\endcsname} +\def\gettblref#1#2{\ifcsname\@@tblprefix\number#1:\number#2:x\endcsname\csname\@@tblprefix\number#1:\number#2:x\endcsname\fi} + +\def\parseTR[#1]% {\currentcol\zerocount \advance\maximumrow\plusone \iffirstargument \setvalue{\@@tblprefix\c!y++\number\maximumrow}{\getparameters[\@@tbl\@@tbl][#1]}% maybe also in mkii \fi} -\def\settblref#1#2{\expandafter\xdef\csname\@@tblprefix\number#1:\number#2:x\endcsname} -\def\gettblref#1#2{\ifcsname\@@tblprefix\number#1:\number#2:x\endcsname\csname\@@tblprefix\number#1:\number#2:x\endcsname\fi} - -\long\def\parseTD[#1][#2]#3\eTD % [#2] is dummy that kills spaces +\long\def\parseTD[#1]#2\eTD {\def\tblny{\tblnr}% \def\tblnx{\tblnc}% \let\tblnc\plusone @@ -493,7 +513,7 @@ \else\ifnum\@@tblnindeed=\currentcol\else \scratchcounter\numexpr\@@tblnindeed-\currentcol+\minusone-\tblspn\relax \ifnum\scratchcounter>\zerocount - \normalexpanded{\noexpand\parseTD[\c!nx=\the\scratchcounter,\c!n=,\c!m=,*sq=\v!no][]}\eTD + \normalexpanded{\noexpand\parseTD[\c!nx=\the\scratchcounter,\c!n=,\c!m=,*sq=\v!no]}\eTD \fi % can also be made faster \getparameters[\@@tbl][\c!ny=\tblnr,\c!nx=\tblnc,nc=1,nr=1,#1,\c!n=,\c!m=]% @@ -502,7 +522,7 @@ \ifx\@@tblmindeed\empty \else \ifnum\@@tblmindeed=\currentcol \else \scratchcounter\numexpr\@@tblmindeed-\currentcol+\minusone-\tblspn\relax - \dorecurse\scratchcounter{\normalexpanded{\noexpand\parseTD[\c!n=,\c!m=][]}\eTD}% + \dorecurse\scratchcounter{\normalexpanded{\noexpand\parseTD[\c!n=,\c!m=]}\eTD}% % can be sped up \getparameters[\@@tbl][\c!ny=\tblnr,\c!nx=\tblnc,nc=1,nr=1,#1,\c!n=,\c!m=]% kind of double, see prev \fi @@ -527,10 +547,11 @@ \lettbltag\maximumrow\currentcol\tblcell \settblcol\maximumrow\currentcol{\number\tblnx}% \settblrow\maximumrow\currentcol{\number\tblny}% + % the action key will change! \settblref\maximumrow\currentcol{\ifcsname\@@tbl\c!action\endcsname\csname\@@tbl\c!action\endcsname\fi}% % save text \edef\celltag{{\number\maximumrow}{\number\currentcol}}% - \@EA\settbltxt\@EA\maximumrow\@EA\currentcol\@EA{\@EA\handleTBLcell\celltag[#1]{#3}}} + \@EA\settbltxt\@EA\maximumrow\@EA\currentcol\@EA{\@EA\handleTBLcell\celltag[#1]{#2}}} \def\presetTBLcell {\row\maximumrow @@ -588,8 +609,6 @@ \long\def\parseTH[#1]#2\eTH {\parseTD[#1,\c!color=\tbltblheadcolor,\c!style=\tbltblheadstyle,\c!aligncharacter=\v!no]#2\eTD} - -%D new \long\def\parseTN[#1]#2\eTN {\parseTD[#1]\digits#2\relax\eTD} @@ -664,14 +683,14 @@ \let\pushTBL\relax \let\popTBL \relax -\chardef\tblpass=0 +\newconstant\tblpass \def\presetallTABLEparameters% each odd|even level / can be sped up but only once per table {\executeifdefined{\@@rawtblprefix\v!start\v!each}\relax \executeifdefined{\@@rawtblprefix\v!start\v!oddeven\TBLlevel}\relax \executeifdefined{\@@rawtblprefix\v!start\number\TBLlevel}\relax} -\def\bTABLE +\unexpanded\def\bTABLE {\dosingleempty\dobTABLE} \def\dobTABLE[#1]% @@ -700,7 +719,7 @@ [\tbltblheader] [\v!repeat=>\multipleTBLheadstrue]% \presetallTABLEparameters - \ExpandFirstAfter\processallactionsinset + \processallactionsinset [\tbltbloption] [\v!stretch=>\autoTBLspreadtrue]% \linewidth\tbltblrulethickness % needs to be frozen @@ -714,19 +733,19 @@ \let\bTH\dobTH \let\bTN\dobTN} -\unexpanded\def\dobTR{\dodoubleempty\parseTR} -\unexpanded\def\dobTD{\dodoubleempty\parseTD} -\unexpanded\def\dobTH{\dodoubleempty\parseTH} -\unexpanded\def\dobTN{\dodoubleempty\parseTN} +\unexpanded\def\dobTR{\dosingleempty\parseTR} +\unexpanded\def\dobTD{\dosingleempty\parseTD} +\unexpanded\def\dobTH{\dosingleempty\parseTH} +\unexpanded\def\dobTN{\dosingleempty\parseTN} % permits \expanded{\bTD ... \eTD} -\unexpanded\def\eTR{\ignorespaces} % handy in case we use a macro to generate rows -\unexpanded\def\eTD{\ignorespaces} -\unexpanded\def\eTH{\ignorespaces} -\unexpanded\def\eTN{\ignorespaces} +\let\bTR\relax \unexpanded\def\eTR{\ignorespaces} % handy in case we use a macro to generate rows +\let\bTD\relax \unexpanded\def\eTD{\ignorespaces} +\let\bTH\relax \unexpanded\def\eTH{\ignorespaces} +\let\bTN\relax \unexpanded\def\eTN{\ignorespaces} -\def\eTABLE % beware, we need to get rid of spurious spaces when in hmode +\unexpanded\def\eTABLE % beware, we need to get rid of spurious spaces when in hmode {% tricky and dirty order -) \doifsometokselse\TBLhead % slow, better a flag {\the\TBLhead @@ -833,7 +852,7 @@ \def\eTBL{\tbltoks\@EA\@EA\@EA{\@EA\the\@EA\tbltoks\@EA\begintblrow\the\tblrowtoks\endtblrow}}% \def\prelocateTBLerror - {\writestatus\m!systems{fatal error: use \string\prelocateTBLrows\space to increase table memory (now: \number\prelocatedTBLrows)}} + {\writestatus\m!system{fatal error: use \string\prelocateTBLrows\space to increase table memory (now: \number\prelocatedTBLrows)}} \def\prelocateTBLrows#1% we start at zero so we have one to much, better play safe anyway {\dostepwiserecurse\prelocatedTBLrows{#1}\plusone{\expandafter\newtoks\csname tbl:\recurselevel\endcsname}% @@ -885,8 +904,12 @@ \crcr \noalign {\nointerlineskip - \ifnum\gettblnob\tblrow=\zerocount - \allowbreak + \ifnum\tblrow>\noftblheadlines + \ifnum\gettblnob\tblrow=\zerocount + \allowbreak + \fi + \else + \allowbreak % else no proper head split off \fi \bgroup % protect local vars \@@tblsplitafter @@ -900,18 +923,38 @@ \fi \egroup}} +% \def\begintbl +% {\global\tblspn\zerocount +% \global\tblcol\zerocount +% \global\tblrow\zerocount +% \global\advance\tblrow\minusone +% \tabskip\zeropoint +% \halign\bgroup +% \registerparoptions % new +% \ignorespaces##\unskip&&\ignorespaces##\unskip\cr} + +% \def\endtbl +% {\egroup} + +\let\dotagTABLEcell\relax + \def\begintbl {\global\tblspn\zerocount \global\tblcol\zerocount \global\tblrow\zerocount \global\advance\tblrow\minusone \tabskip\zeropoint + \dostarttagged\t!table\empty + \dostarttagged\t!tablerow\empty + \appendtoks\dostoptagged\dostarttagged\t!tablerow\empty\to\everycr \halign\bgroup - \registerparoptions % new - \ignorespaces##\unskip&&\ignorespaces##\unskip\cr} + \registerparoptions + % watch out: tagging the cell happens at the outer level (faster) + \ignorespaces##\unskip&&\dostarttagged\t!tablecell\empty\ignorespaces##\unskip\dostoptagged\cr} % one too many \def\endtbl - {\egroup} + {\dostoptagged\egroup + \dostoptagged} \setvalue{\tblnone TBL}#1#2% {\spanTBL{#1}{#2}} @@ -936,10 +979,16 @@ {\global\tblspn\zerocount \global\tblrow\zerocount \global\tblcol\zerocount - \chardef\tblpass\zerocount + \tblpass\zerocount \tbltoks\emptytoks} -\def\flushtbltoks{\begintbl\the\tbltoks\endtbl} +\newtoks\everyTABLEpass + +\def\flushtbltoks + {\the\everyTABLEpass + \begintbl + \the\tbltoks + \endtbl} \def\domakeTBLone#1 #2 % {\gettbltxt{#1}{#2}}% @@ -960,11 +1009,16 @@ \settblhei{#1}{\the\ht\scratchbox}% \fi}% +\let\dotagnoftablecolumns\relax +\let\dotagnoftablerows \relax + \def\domakeTBLthree#1 #2 % {% height \!!counta \gettblcol{#1}{#2}\relax \!!countb \gettblrow{#1}{#2}\relax \!!heighta\gettblht {#1}{#2}\relax +\dotagnoftablecolumns +\dotagnoftablerows \scratchdimen\zeropoint \ifnum\!!counta=\maximumcol\relax % case: nc=maxcolumns @@ -1003,11 +1057,10 @@ \else \normalexpanded{\noexpand\directgotobox{\box\scratchbox}[\!!stringa]}% to be checked \fi - \box\scratchbox} + \dotagTABLEcell} % right spot \def\inTBLcell#1#2% hm, do we need #1 #2 ? we use tblcol anyway - {\ExpandBothAfter\doifinsetelse\localwidth{\v!fit,\v!broad} % user set - {} + {\doifnotinset\localwidth{\v!fit,\v!broad}% user set {\scratchdimen\gettblaut\tblcol\relax \ifdim\localwidth>\scratchdimen \settblaut\tblcol{\the\dimexpr\localwidth\relax}% @@ -1032,11 +1085,11 @@ \lettbldis\recurselevel\zeropoint}% \dorecurse\maximumrow {\lettblhei\recurselevel\maxdimen}% - \chardef\tblpass\plusone + \tblpass\plusone \let\makeTBL\domakeTBLone \let\handleTBLcell\dohandleTBLcellA - \setbox0\vbox{\trialtypesettingtrue \flushtbltoks}% -% \setbox\scratchbox\vbox{\trialtypesettingtrue \flushtbltoks}% + \setbox0\vbox{\settrialtypesetting \flushtbltoks}% +% \setbox\scratchbox\vbox{\settrialtypesetting \flushtbltoks}% \lettbldis\maximumcol\zeropoint \ifautoTBLspread % experimental, stretch non fixed cells to \hsize @@ -1044,13 +1097,13 @@ \checktblwidthstwo % real run \stretchtblwidths \let\handleTBLcell\dohandleTBLcellB - \setbox\scratchbox\vbox{\trialtypesettingtrue \flushtbltoks}% + \setbox\scratchbox\vbox{\settrialtypesetting \flushtbltoks}% \else\ifdim\wd0>\hsize \ifautoTBLhsize \checktblwidthsone % trial run \checktblwidthstwo % real run \let\handleTBLcell\dohandleTBLcellB - \setbox\scratchbox\vbox{\trialtypesettingtrue \flushtbltoks}% + \setbox\scratchbox\vbox{\settrialtypesetting \flushtbltoks}% \fi \else\ifautoTBLrowspan\ifnum\maximumrowspan>1 % max ? % added jan 2002 because nx=* did no longer work @@ -1061,16 +1114,16 @@ \hsize\savedhsize % \let\handleTBLcell\dohandleTBLcellC - \setbox\scratchbox\vbox{\trialtypesettingtrue \flushtbltoks}% + \setbox\scratchbox\vbox{\settrialtypesetting \flushtbltoks}% \fi\fi\fi\fi \let\handleTBLcell\dohandleTBLcellD - \chardef\tblpass\plustwo + \tblpass\plustwo \let\makeTBL\domakeTBLtwo - \setbox\scratchbox\vbox{\trialtypesettingtrue \flushtbltoks}% + \setbox\scratchbox\vbox{\settrialtypesetting \flushtbltoks}% \checktblheightsone \checktblheightstwo \let\handleTBLcell\dohandleTBLcellE - \chardef\tblpass\plusthree + \tblpass\plusthree \let\makeTBL\domakeTBLthree \ifnum\TBLlevel>\plusone \@EA\notsplittblbox @@ -1348,7 +1401,7 @@ \fi \fi \fi - \setbox2\null + \setbox2\emptyhbox \wd2\wd\scratchbox \ht2\ht\scratchbox \dp2\dp\scratchbox \box2 \egroup} @@ -1360,7 +1413,7 @@ [\@@tbl\@@tbl] [#4,#1,\c!frame=\v!off,\c!background=] {\bTBLCELL#5\eTBLCELL}}% - \setbox2\null + \setbox2\emptyhbox \wd2\wd\scratchbox \ht2\ht\scratchbox \dp2\dp\scratchbox \ifautoTBLrowspan \scratchcounter\numexpr\tblrow+\plusone\relax @@ -1546,51 +1599,6 @@ \fi \fi} -%D Spacing: -% -% \starttabulate -% \NC text \NC text \NC \NR -% \TB[small] -% \NC text \NC text \NC \NR -% \TB[4*big] -% \NC text \NC text \NC \NR -% \stoptabulate -% -% \starttable[|||] -% \VL text \VL text \VL \AR -% \TB[small] -% \VL text \VL text \VL \AR -% \TB[4*big] -% \VL text \VL text \VL \AR -% \stoptable - -\def\complexTableTB[#1]{\TABLEnoalign{\blank[#1]}} -\def\simpleTableTB {\TABLEnoalign{\blank}} - -\def\TabulateTB - {\complexorsimpleTable{TB}} - -\def\doTableinterline% #1 - {\ifnum\currentTABLEcolumn>\maxTABLEcolumn - \chuckTABLEautorow - \else\ifnum\currentTABLEcolumn=\zerocount - \TABLEnoalign - {\globalletempty\checkTABLEautorow - \globalletempty\chuckTABLEautorow}% - \else - \setTABLEerror\TABLEmissingcolumn - \handleTABLEerror - \fi\fi - \complexorsimpleTable} % {#1} - -\def\TableHL{\doTableinterline{HL}} -\def\TableTB{\doTableinterline{TB}} - -\appendtoks\let\TB\TableTB \to\everytable -\appendtoks\let\TB\TabulateTB\to\everytabulate % strange place - -\appendtoks \chardef\recodeverbatimmode\plustwo \to \everytable - % new (for Olivier Turlier) % % \defineTABLEsetup [xx] [foregroundcolor=red] diff --git a/Master/texmf-dist/tex/context/base/tabl-nte.mkiv b/Master/texmf-dist/tex/context/base/tabl-nte.mkiv index cde64a033d5..2a9e147038c 100644 --- a/Master/texmf-dist/tex/context/base/tabl-nte.mkiv +++ b/Master/texmf-dist/tex/context/base/tabl-nte.mkiv @@ -84,13 +84,9 @@ \expandafter\dododoTABLENC \fi} -% \long\def\dododoTABLENC#1\NC -% {\ifconditional\inTABLEnc\else\settrue\inTABLEnc\parseTR[][]\fi -% \parseTD[][]#1\eTD\NC} - \long\def\dododoTABLENC#1\NC - {\ifconditional\inTABLEnc\else\settrue\inTABLEnc\parseTR[][]\fi - \dodoubleempty\parseTD#1\eTD\NC} + {\ifconditional\inTABLEnc\else\settrue\inTABLEnc\dobTR[]\fi + \dobTD#1\eTD\NC} %D The related structure commands are also available: diff --git a/Master/texmf-dist/tex/context/base/tabl-pln.mkiv b/Master/texmf-dist/tex/context/base/tabl-pln.mkiv index 39bb50f2329..9e65f7e40d8 100644 --- a/Master/texmf-dist/tex/context/base/tabl-pln.mkiv +++ b/Master/texmf-dist/tex/context/base/tabl-pln.mkiv @@ -19,11 +19,11 @@ \newdimen \@@plntabdimen \def\cleartabs % visible - {\global\setbox\@@plntabsyet\null - \setbox\@@plntabs\null} + {\global\setbox\@@plntabsyet\emptyhbox + \setbox\@@plntabs\emptyhbox} \def\settabs % visible - {\setbox\@@plntabs\null + {\setbox\@@plntabs\emptyhbox \futurelet\next\@@plnsettabs} \def\tabalign % visible @@ -61,7 +61,7 @@ \def\@@plnmaketabbox {\begingroup \global\setbox\@@plntabsyet\copy\@@plntabs - \global\setbox\@@plntabsdone\null + \global\setbox\@@plntabsdone\emptyhbox \def\cr {\@@plncrtrue\crcr\egroup\egroup \if@@plnusetab\unvbox\zerocount\lastbox\fi\endgroup diff --git a/Master/texmf-dist/tex/context/base/tabl-tab.mkiv b/Master/texmf-dist/tex/context/base/tabl-tab.mkiv index d926dab989a..24bbb4dd607 100644 --- a/Master/texmf-dist/tex/context/base/tabl-tab.mkiv +++ b/Master/texmf-dist/tex/context/base/tabl-tab.mkiv @@ -3,9 +3,9 @@ %D version=1997.10.10, %D title=\CONTEXT\ Table Macros, %D subtitle=\TABLE\ Embedding, -%D author=Hans Hagen, +%D author=Hans Hagen with copied and patched code from MJ Wichura, %D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%D copyright=PRAGMA-ADE (patched and extensions)] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for @@ -13,642 +13,685 @@ \writestatus{loading}{ConTeXt Table Macros / TaBlE Embedding} -% By now it makes more sense to merge the patches into the original -% and clean that one up too. +% Todo: consistent namespace and get rid of not used code -% \starttable[|||] -% \HL -% \VL test \VS test \VL \FR -% \VL test \VD test \VL \MR -% \VL test \VT test \VL \LR -% \HL -% \stoptable - -% Don't change the splitter: +% In \MKIV\ the old table macros are sort of obsolete. The +% color extensions have been removed and some code is stripped. +% For practical reasons the \TABLE\ macros that are used are +% embedded in this file. % -% ... \NR -% \TABLEnoalign{\page}\TABLEhead -% \NC ... - -% e-tex: reverse rows or vadjust or ... in tables -% \ifalign -% \xhrule : calls for 'special' with width -% BUG: +% The following code is based on TABLE 1.0 by Michael J. Wichura +% (August 1988. We used a patched version with many overloads +% and extensions. The documented (and larger) source can be found +% in \type {thrd-tab.tex}. % -% \starttable[|l|l|] -% \HL -% \RL\FR \VL Head 1 \VL Head 2 \VL\FR -% \RL\LR \VL Head A \VL Head B \VL\LR % niet grijs ?? -% \HL -% \VL 1 \VL 2 \VL\FR -% \VL a \VL b \VL\LR -% \HL -% \stoptable +% Some code has been stripped. Some color has been added. Some macros +% have been renamed. Registers have been replaces. And probably much +% more can be cleaned up. -% melden als in kleur conflict, uitgestelde test op \SR\SR +\unprotect -% verengelsen -% interface +\newconditional\tablehasleftspacing +\newconditional\tablehasrightspacing -% footnotes flushen -% \......TABLE........ namen -% kolommen testen -% unbreakable kop definieren -% voetnoten -% meldingen -% als direct \use{max} dan fout -% \BREAKPOINT -% breedte lijn telt -% errors: ook gray in handle +\newdimen\tablelinethicknessunit +\newdimen\tablestrutunit +\newskip \tableintercolumnspaceunit +\newdimen\tablecolumnwidthunit +\newdimen\tablekernunit -% \AR -> als in DL dan \DR +\def\tablestrutheightfactor {8} +\def\tablestrutdepthfactor {3} +\def\tableintercolumnspacefactor {3} +\def\tablecolumnwidthfactor {10} +\def\tablevspacefactor {2} +\def\tablekernfactor {1} +\def\tablelinethicknessfactor {4} -% nieuw: -% -% \NL / \NL[blanko] is skip, nog default? -% geen \HL in a row -% \HL[n] -% \VL[n] + remembers -% c{colorspec} key -% \HC[color][width] -% \VC[color] -% meldingen row, column, use, advise -% \AR: UITSTELLEN / EXPERIMENTEEL - -% WAARDELOZE ERROR HANDLER -% THIS RENEWED MODULE WORKS OK BUT STILL LOOKS BAD - -%D We felt no need to write our own table building macros, -%D simply because Michael Wichura made a terrific one. This -%D package is quite complete and well documented. In \CONTEXT\ -%D we provide a shell for consistent spacing as well as color -%D support. Implementing these features without adapting the -%D original macros is not trivial. One easilly gets conflicts -%D with \type{\omit}, \type{\span} and \type{\noalign}, which -%D means that we end up postponing and overloading macros, -%D mostly global. Now, let's start with loading the main -%D macros: - -\doifundefined{BeginTable}{\doinputonce{table.tex}} +\newtoks\everytable +\newtoks\everytableparbox -\unprotect +\unexpanded\def\dotablebeginparbox#1% + {\setbox\scratchbox\vtop\bgroup % \setbox added + \hsize#1\relax + \dontcomplain + \dorestoretablelineskips + \normalbaselines + \let~\fixedspace + \blank[\v!disable]% % added + \the\everytableparbox} -%D \macros -%D {inintable, ifsplittables} -%D -%D First we declare some variables. These show a bit what we -%D are dealing with. First we introdoce some booleans that -%D enable us, inside as well as outside this module, to -%D determine in what mode we are. +\unexpanded\def\dotableendparbox + {\removelastskip % itemize or so + \endgraf + \ifnum\prevgraf>\zerocount % we want at least + \verticalstrut \nowhitespace \vskip-\struttotal % one line of text + \egroup + \ifdim\dp\scratchbox>\lineheight % see (*) for an + \getnoflines{\dp\scratchbox}% % example of where + \dp\scratchbox\zeropoint % saving can go + \setbox\scratchbox % terrible wrong + \vtop to \noflines\lineheight{\box\scratchbox}% + \fi % esp between rows + \else % of paragraphs + \egroup + \fi + \box\scratchbox} -\newif\ifintable -\newif\ifsplittables +\appendtoks + \parindent\zeropoint + \raggedright + \rightskip\zeropoint \!!plus 4em \relax +\to \everytableparbox + +\newskip \tablelefttabskip +\newskip \tablerighttabskip + +\newcount\!taColumnNumber +\newcount\!taRecursionLevel % (Initially 0) + +\newdimen\!taDimenA % used by \Enlarge +\newdimen\!taDimenB % used by \Enlarge +\newdimen\!taDimenC % used by numeric.tex +\newdimen\!taMinimumColumnWidth + +\newtoks \!taTableSpread +\newtoks \!taPreamble +\newtoks \!taDataColumnTemplate +\newtoks \!taRuleColumnTemplate +\newtoks \!taOldRuleColumnTemplate +\newtoks \!taLeftGlue +\newtoks \!taRightGlue + +\newskip \!taLastRegularTabskip + +\newif \if!taBeginFormat +\newif \if!taOnceOnlyTabskip + +\def\!thToksEdef#1#2% + {\edef\!ttemp{#2}% + #1\expandafter{\!ttemp}% + \ignorespaces} -%D \macros -%D {tracetablestrue} -%D -%D When I documented this module, I felt the need for tracing -%D options. After implementing this feature, I also added -%D warnings, error recovery and automatic spacing. +\def\!thLoop#1\repeat + {\def\!thIterate{#1\expandafter \!thIterate\fi}% + \!thIterate + \let\!thIterate\relax} + +\def\dobegintableformat + {\!taPreamble\emptytoks + \!taColumnNumber\zerocount + \scratchskip\tableintercolumnspaceunit + \multiply\scratchskip\tableintercolumnspacefactor + \divide\scratchskip\plustwo + \!taRuleColumnTemplate\expandafter{\expandafter\tabskip\the\scratchskip}% + \!taLastRegularTabskip\scratchskip + \!taOnceOnlyTabskipfalse + \!taBeginFormattrue + \let\!tfRowOfWidths\empty + \doreadtableformatkeys} + +\def\!tfSetWidth + {\ifx\!tfRowOfWidths\empty % true if no prior "w" keys + \ifnum\!taColumnNumber>\zerocount % true if "w" key is to right of first "|" + \begingroup % RowOfWidths={&\omit || n copies of &\omit&\omit}, where n = number of column to the left of this one + \scratchcounter\plusone + \aftergroup \edef \aftergroup \!tfRowOfWidths \aftergroup {% + \aftergroup &\aftergroup \omit + \!thLoop + \ifnum \scratchcounter<\!taColumnNumber + \advance\scratchcounter\plusone + \aftergroup \!tfAOAO + \repeat + \aftergroup}% + \endgroup + \fi + \fi + \ifx[\!ttemp % \!tgGetValue sets \!ttemp = token after w + \expandafter\!tfSetWidthText + \else + \expandafter\!tfSetWidthValue + \fi} -\newif\iftracetables +\def\!tfAOAO{&\omit&\omit} -%D We show this feature in an eample that also shows some of -%D the basic table typesetting commands. -%D -%D \startbuffer -%D \starttable[|||] -%D \HL -%D \VL first \VL second \VL\AR -%D \HL -%D \VL alfa \VL 1 \VL\AR -%D \VL beta \VL 2 \VL\AR -%D \VL gamma \VL 3 \VL\AR -%D \HL -%D \stoptable -%D \stopbuffer -%D -%D \startcombination -%D {\tracetablesfalse\getbuffer} {\type{\tracetablesfalse}} -%D {\tracetablestrue\getbuffer} {\type{\tracetablestrue}} -%D \stopcombination -%D -%D This table is specified as: -%D -%D \typebuffer -%D -%D This examples shows about the minimum of commands needed to -%D typeset such a table. In this table, the \type {\AR} is -%D automatically translated into the more primitive (but more -%D verbose) commands \type {\SR}, \type {\FR}, \type {\MR} and -%D \type {\LR} commands. -%D -%D \startbuffer -%D \starttables[|||] -%D \HL -%D \VL first \VL second \VL\AR -%D \HL -%D \VL alfa \VL 1 \VL\AR -%D \VL beta \VL 2 \VL\AR -%D \VL gamma \VL 3 \VL\AR -%D \HL -%D \stoptable -%D \stopbuffer -%D -%D When we use the split table feature, we get a bit more -%D information. -%D -%D {\tracetablesfalse\getbuffer} -%D -%D Sometimes in tables information shows up that is not typed -%D in by the user. These messages give a cue in what aspect a -%D table definition is wrong. -%D -%D \startbuffer -%D \starttable[||||] -%D \HL -%D \VL first second \VL third \VL\AR -%D \HL -%D \VL alfa \VL 1 \VL a \VL\AR -%D \VL beta \VL 2 \VL b \VL -%D \VL gamma \VL \THREE{3} c \VL\AR -%D \HL -%D \stoptable -%D \stopbuffer -%D -%D \typebuffer -%D -%D Those terrible table has three errors, which all show up in -%D typeset messages. Errors cannot always recovered 100\% and -%D therefore can result in two or more succesive messages, like -%D in the last row. -%D -%D \getbuffer +\def\!tfSetWidthText[#1]% + {\def\!tfWidthText{#1}% + \doreadtableformatkeys} -%D Bringing color into tables is complicated by the mere fact -%D that color is not part of \TEX. The main complication is -%D that we don't know in advance how wide a column will be. I -%D implemented color support in tables in the early 90's -%D because I needed it for some articles on color. I have to -%D admit that I seldom use the mechanism. -%D -%D Most color support in \CONTEXT\ makes use of colored rules. -%D At first sight, one is tempted to implement colors in tables -%D in a similar way, but as said, we don't know the dimensions -%D in advance. It turns out however that we don't have to, -%D simply because alignments take care of stretching rules to -%D the appropritate dimensions. This means that we can provide -%D backgrounds by coloring rules with the height of a row, -%D skipping upwards and finally drawing the content, like in: -%D -%D \gdef\ShowExample -%D {\startfiguretext -%D {none} -%D {\getbuffer} -%D \typebuffer -%D \stopfiguretext} -%D -%D \startbuffer -%D \starttable[|c|c|] -%D \HL -%D \BL[2] \SR -%D \VL test \VL test \VL\SR -%D \HL -%D \VL test \VL test \VL\FR -%D \VL test \VL test \VL\MR -%D \VL test \VL test \VL\LR -%D \HL -%D \stoptable -%D \stopbuffer -%D -%D \ShowExample -%D -%D Just to be complete we show how the other columns can be -%D given a background. Later we will provide more details over -%D the commands used. -%D -%D \startbuffer -%D \starttable[|c|c|c|] -%D \HL -%D \BL[3] \SR -%D \VL test \VL test \VL test \VL\SR -%D \HL -%D \stoptable -%D \stopbuffer -%D -%D \ShowExample -%D -%D \startbuffer -%D \starttable[|c|c|c|] -%D \HL -%D \BC \BL[2] \SR -%D \VL test \VL test \VL test \VL\SR -%D \HL -%D \stoptable -%D \stopbuffer -%D -%D \ShowExample -%D -%D \startbuffer -%D \starttable[|c|c|c|] -%D \HL -%D \BC \BC \BL \SR -%D \VL test \VL test \VL test \VL\SR -%D \HL -%D \stoptable -%D \stopbuffer -%D -%D \ShowExample -%D -%D \startbuffer -%D \starttable[|c|c|c|] -%D \HL -%D \BC \BL \SR -%D \VL test \VL test \VL test \VL\SR -%D \HL -%D \stoptable -%D \stopbuffer -%D -%D \ShowExample -%D -%D \startbuffer -%D \starttable[|c|c|c|] -%D \BL \BL \SR -%D \HL -%D \VL test \VL test \VL test \VL\SR -%D \HL -%D \stoptable -%D \stopbuffer -%D -%D \ShowExample +\def\!tfSetWidthValue + {\!taMinimumColumnWidth= + \ifnum\!tgCode=\plusone + \ifx\!tgValue\empty \tablecolumnwidthfactor \else \!tgValue \fi \tablecolumnwidthunit + \else + \!tgValue + \fi + \let\!tfWidthText\empty % Override possible prior `w[sample entry]' + \doreadtableformatkeys} -%D In these examples we can clearly see that for being a real -%D background, the color or gray specification has to precede -%D the content. Just to keep things simple, we can recall this -%D specification later on: -%D -%D \startbuffer -%D \starttable[|c|c|c|] -%D \BC \BL \SR -%D \HL -%D \VL test \VL test \VL test \VL\SR -%D \HL -%D \BR\FR -%D \VL test \VL test \VL test \VL\FR -%D \BR\MR -%D \VL test \VL test \VL test \VL\MR -%D \BR\LR -%D \VL test \VL test \VL test \VL\LR -%D \HL -%D \stoptable -%D \stopbuffer -%D -%D \ShowExample -%D -%D Close study learns that we can put the specification -%D before or after the \type{\HL}, whatever suits best. Keeping -%D track of these specifications is taken care of by the next -%D variables: +\def\!tfSetTabskip + {\ifnum\!tgCode=\plusone + \scratchskip\tableintercolumnspaceunit + \multiply\scratchskip \ifx\!tgValue\empty\tableintercolumnspacefactor\else\!tgValue\fi + \else + \scratchskip\!tgValue + \fi + \divide\scratchskip\plustwo + \ifnum\!taColumnNumber=\zerocount + %\!thToksEdef\!taRuleColumnTemplate{\the\!taRuleColumnTemplate\tabskip\the\scratchskip}% + \normalexpanded{\!taRuleColumnTemplate{\the\!taRuleColumnTemplate\tabskip\the\scratchskip}}% + \else + %\!thToksEdef\!taDataColumnTemplate{\the\!taDataColumnTemplate\tabskip\the\scratchskip}% + \normalexpanded{\!taDataColumnTemplate{\the\!taDataColumnTemplate\tabskip\the\scratchskip}}% + \fi + \if!taOnceOnlyTabskip\else + \!taLastRegularTabskip\scratchskip % Remember this Tabskip, for possible + \fi % restoration after a subsequent"OnceOnly" + \doreadtableformatkeys} -\newif \ifTABLEgrayline % executing gray line -\newif \ifTABLEgraydone % gray line executed -\newtoks \TABLEgraytoks % gray line specification +\def\!tfSetVrule + {\!thToksEdef\!taRuleColumnTemplate + {\hfil + \vrule + \noexpand\!!width + \ifnum\!tgCode=\plusone + \ifx\!tgValue\empty + \tablevrulethicknessfactor + \else + \!tgValue + \fi + \tablelinethicknessunit + \else + \!tgValue + \fi + ####% + \hfil + \the\!taRuleColumnTemplate}% + \!tfAdjoinPriorColumn} -\newif\ifTABLEinbreak +\def\!tfSetAlternateVrule + {\afterassignment\!tfSetAlternateA + \scratchtoks} -%D Nog vervangen: +\def\!tfSetAlternateA + {\!thToksEdef\!taRuleColumnTemplate{\the\scratchtoks\the\!taRuleColumnTemplate}% + \!tfAdjoinPriorColumn} -\def\c!Table{Table} -\def\m!TABLE{TABLE} - -%D We already saw that the table macros report errors and -%D provide automatic spacing. These features can only be -%D implemented by keeping track of the state, often the last -%D command on a row. +\def\!tfAdjoinPriorColumn + {\ifnum \!taColumnNumber=0 + \!taPreamble=\!taRuleColumnTemplate % New \tabskip may have been added + \else + \ifx\!tfRowOfWidths\empty % no "w" keys specified yet, not even this col + \else + \!tfUpdateRowOfWidths + \fi + \!thToksEdef\!taDataColumnTemplate{\the\!taLeftGlue\the\!taDataColumnTemplate\the\!taRightGlue}% + \!thToksEdef\!taPreamble{\the\!taPreamble&\the\!taDataColumnTemplate&\the\!taRuleColumnTemplate}% + \fi + \advance \!taColumnNumber \plusone + \if!taOnceOnlyTabskip + \!thToksEdef\!taDataColumnTemplate{####\tabskip \the\!taLastRegularTabskip}% + \else + \!taDataColumnTemplate{##}% + \fi + \!taRuleColumnTemplate\emptytoks + \!taLeftGlue{\hfil}% + \!taRightGlue{\hfil}% + \!taMinimumColumnWidth\zeropoint + \let\!tfWidthText\empty + \!taOnceOnlyTabskipfalse + \doreadtableformatkeys} + +\def\!tfUpdateRowOfWidths + {\ifx\!tfWidthText\empty \else + \!tfComputeMinColWidth + \fi + \edef\!tfRowOfWidths + {\!tfRowOfWidths + &% + \omit + \ifdim \!taMinimumColumnWidth>\zeropoint + \hskip \the\!taMinimumColumnWidth + \fi + & + \omit}} + +\def\!tfComputeMinColWidth + {\setbox0\vbox + {\ialign{% Plain's initialized \halign; \tabskip=0pt \everycr={} + \span\the\!taDataColumnTemplate\cr + \!tfWidthText\cr}}% + \!taMinimumColumnWidth=\wd0 } + +\def\!tfFinishFormat + {\!thToksEdef\!taPreamble{####\tabskip\tablelefttabskip&\the\!taPreamble \tabskip\tablerighttabskip&####\tabskip\zeropoint\cr} + \!taBeginFormatfalse + \!ttDoHalign} + +\def\dotablereformat[#1]% will become local + {\omit + \!taDataColumnTemplate{##}% + \!taLeftGlue\emptytoks + \!taRightGlue\emptytoks + \begingroup + \@@useotherbar + \expanded{\endgroup\noexpand\doreadtableformatkeys#1]}}% appear in a \dotablereformat cmd; this is here as a safeguard. -\chardef\TABLEunknown = 0 +\appendtoks + \let\ReFormat\dotablereformat +\to \everytable -\chardef\TABLEseparaterow = 1 -\chardef\TABLEfirstrow = 2 -\chardef\TABLEmidrow = 3 -\chardef\TABLElastrow = 4 -\chardef\TABLErule = 5 -\chardef\TABLEskip = 6 -\chardef\TABLEautorow = 7 +\def\!tfEndReFormat + {\!tfReFormat} -\chardef\TABLEforcefirstrow = 1 -\chardef\TABLEforcelastrow = 2 +\appendtoks \dotableparalignment \to \everytableparbox -\chardef\TABLEmissingrow = 1 -\chardef\TABLEmissingcolumn = 2 -\chardef\TABLEspanoverflow = 3 -\chardef\TABLEdivisionoverflow = 4 +\def\!tfReFormat#1% + {\the \!taLeftGlue + \vbox{\forgetall\ialign{\span\the\!taDataColumnTemplate\cr#1\cr}}% + \the \!taRightGlue + \kern\zeropoint} % prevents \unskip / really needed -%D We store these states using efficient \type {\chardef}'s. -%D Like most variables, these are global ones. When needed, -%D especially when we flush the backgrounds, we can temporary -%D disable the assignment. +\def\!tgGetValue#1% + {\def\!tgReturn{#1}% + \futurelet\!ttemp\!tgCheckForParen} -\newif\ifsetTABLEaction +\def\!tgCheckForParen% + {\ifx\!ttemp (% + \expandafter \!tgDoParen + \else + \expandafter \!tgCheckForSpace + \fi} -\def\setTABLEaction#1% - {\ifsetTABLEaction\global\chardef\TABLEaction#1\fi} +\def\!tgDoParen(#1)% + {\def\!tgCode{2}% will be expanded + \def\!tgValue{#1}% + \!tgReturn} -\def\setTABLEforce#1% - {\ifsetTABLEaction\global\chardef\TABLEforce#1\fi} +\def\!tgCheckForSpace + {\def\!tgCode{1}% + \let\!tgValue\empty + \ifx\!ttemp\!thSpaceToken + \expandafter \!tgReturn + \else + \expandafter \!tgCheckForDigit + \fi} -\def\setTABLEerror#1% - {\global\chardef\TABLEerror#1} +% \def\!tgCheckForDigit +% {\donefalse +% \ifx 0\!ttemp \donetrue +% \else\ifx 1\!ttemp \donetrue +% \else\ifx 2\!ttemp \donetrue +% \else\ifx 3\!ttemp \donetrue +% \else\ifx 4\!ttemp \donetrue +% \else\ifx 5\!ttemp \donetrue +% \else\ifx 6\!ttemp \donetrue +% \else\ifx 7\!ttemp \donetrue +% \else\ifx 8\!ttemp \donetrue +% \else\ifx 9\!ttemp \donetrue +% \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi +% \ifdone +% \expandafter \!tgGetNumber +% \else +% \expandafter \!tgReturn +% \fi} -%D Before we come to using these variables, we redefine and/or -%D adapt some \TABLE\ macros. Within \TABLE's the \type{|} and -%D \type{"} have special meanings in templates and are active -%D during. Their meaning can therefore conflict with those -%D elsewhere defined. To be compatible with traditional \TABLE\ -%D as well as \CONTEXT's \type{||} and the active \type{"} -%D extensions for my german friends, we do some catcode magic. +\def\!tgCheckForDigit % less tokens: + {\donetrue + \ifx 0\!ttemp \else \ifx 1\!ttemp \else + \ifx 2\!ttemp \else \ifx 3\!ttemp \else + \ifx 4\!ttemp \else \ifx 5\!ttemp \else + \ifx 6\!ttemp \else \ifx 7\!ttemp \else + \ifx 8\!ttemp \else \ifx 9\!ttemp \else + \donefalse + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \ifdone + \expandafter \!tgGetNumber + \else + \expandafter \!tgReturn + \fi} -\newif\ifForgetTableBarAndQuote \ForgetTableBarAndQuotetrue +% \def\!tgCheckForDigit % does not work +% {\relax\doifnumberelse\!ttemp\!tgGetNumber\!tgReturn} + +\def\!tgGetNumber {\afterassignment\!tgGetNumberA\scratchcounter=} +\def\!tgGetNumberA{\edef\!tgValue{\the\scratchcounter}\!tgReturn} + +\def\!tgSetUpParBox + {\normalexpanded + {\noexpand \doreadtableformatkeys + b{\dotablebeginparbox + {\ifnum\!tgCode=\plusone + \ifx\!tgValue\empty + \tablecolumnwidthfactor + \else + \!tgValue + \fi + \tablecolumnwidthunit + \else + \!tgValue + \fi}}% + a{\dotableendparbox}}} + +\def\!tgInsertKern + {\edef\!ttemp + {\kern + \ifnum \!tgCode=\plusone + \ifx \!tgValue\empty + \tablekernfactor + \else + \!tgValue + \fi + \tablekernunit + \else + \!tgValue + \fi}% + \edef\!ttemp + {\noexpand\doreadtableformatkeys + \ifconditional\tablehasleftspacing + b{\!ttemp} + \fi + \ifconditional\tablehasrightspacing + a{\!ttemp} + \fi}% + \!ttemp} -% \bgroup +\def\newtableformatkey #1{\setvalue{!tk<\string#1>}} +\def\doreadtableformatkeys#1{\getvalue{!tk<\string#1>}} -% \catcode`\|=\@@active -% \catcode`\"=\@@active -% -% \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 -% \fi} -% -% \gdef\popouterbarandquote -% {\ifForgetTableBarAndQuote -% \ifx\outertablebar \relax\else\let|\outertablebar \fi -% \ifx\outertablequote\relax\else\let"\outertablequote\fi -% \else -% \redefinetablebarandquote -% \fi} -% -% \egroup -% -% \def\ObeyTableBarAndQuote -% {\ForgetTableBarAndQuotefalse -% \ifintable -% \redefinetablebarandquote -% \fi} +% Key "b": b{TOKENS} adds TOKENS to the left of (before) the template -\let\ActivateBarAndQuote \relax -\let\ObeyTableBarAndQuote\relax -\let\pushouterbarandquote\relax -\let\popouterbarandquote \relax +\newtableformatkey b#1% + {\expandafter\!tkJoin\expandafter{\the\!taDataColumnTemplate}{#1}% + \doreadtableformatkeys} -%D \macros -%D {ObeyTableBarAndQuote} -%D -%D As said, the \type{|} and \type{"} active characters are -%D often used for other purposes. By default, the outside -%D meanings are therefore preserved and available inside -%D tables. If for some reason one wants to use the \TABLE\ -%D primitives, one can say: -%D -%D \starttyping -%D \ObeyTableBarAndQuote -%D \stoptyping -%D -%D To keep things verbose, as well as to show what \TABLE\ -%D commands we affect, we show some meanings. - -\def\normalTABLEshortrule {\!ttShortHrule} % \- -\def\normalTABLElongrule {\!ttLongHrule} % \= -\def\normalTABLEfullrule {\!ttFullHrule} % \_ -\def\normalTABLEendofrow {\!ttEndOfRow} % \\ -\def\normalTABLEsimplebar {\unskip\!ttRightGlue&&} % | -\def\normalTABLEcomplexbar {\unskip\!ttRightGlue&\omit\!ttAlternateVrule} % \| -\def\normalTABLEquote {\unskip\!ttRightGlue&\omit&} % " -\def\normalTABLElineformat {\normalTABLEendofrow+} -\def\normalTABLElineending {\normalTABLEendofrow0 } -\def\normalTABLEsinglerule {&\normalTABLElongrule&} -\def\normalTABLEmultirule#1{&\use{#1}\normalTABLElongrule&} - -%D The next hack is dedicated to Tobias, who found out that -%D paragraph entries don't break well. - -\def\TABLEhack{\hskip\zeropoint} - -%D The first attemp to solve this problem was: -%D -%D \starttyping -%D \def\normalTABLEquote% -%D {\unskip\TABLEhack\!ttRightGlue&\omit&\TABLEhack} -%D \stoptyping -%D -%D But, as usual, this interfered with \type {\omit}. -%D -%D The next attempt is redefining some core \TABLE\ macro:. -%D This works ok, but breaks for instance the~\type{b} -%D key handling. -%D -%D \starttyping -%D \def\!tfAdjoinPriorColumn% -%D {\ifnum\!taColumnNumber=0 -%D \!taPreamble=\!taRuleColumnTemplate -%D ... -%D \if!taOnceOnlyTabskip -%D \!thToksEdef\!taDataColumnTemplate= -%D {\TABLEhack####\TABLEhack\tabskip\the\!taLastRegularTabskip} -%D \else -%D \!taDataColumnTemplate{\TABLEhack##\TABLEhack}% -%D \fi -%D ... -%D \ReadFormatKeys} -%D \stoptyping +\def\!tkJoin#1#2% + {\!taDataColumnTemplate{#2#1}}% -% \newdimen\TABLEparheight +% Key "a": a{TOKENS} adds TOKENS to the right of (after) the template -\def\BeginTableParBox#1% - {\setbox\scratchbox\vtop\bgroup % \setbox added - \hsize#1\relax - \dontcomplain - \restoretablelineskips - \normalbaselines - \let~\!ttTie - \let\-\!ttDH - \blank[\v!disable]% % added - \the\EveryTableParBox} +\newtableformatkey a#1% + {\!taDataColumnTemplate\expandafter{\the\!taDataColumnTemplate #1}% + \doreadtableformatkeys} -\def\EndTableParBox - {\removelastskip % itemize or so - \endgraf - \ifnum\prevgraf>\zerocount % we want at least - \verticalstrut \nowhitespace \vskip-\struttotal % one line of text - \egroup - \ifdim\dp\scratchbox>\lineheight % see (*) for an - \getnoflines{\dp\scratchbox}% % example of where - \dp\scratchbox\zeropoint % saving can go - \setbox\scratchbox % terrible wrong - \vtop to \noflines\lineheight{\box\scratchbox}% - \fi % esp between rows - \else % of paragraphs - \egroup - \fi -% \getboxheight\scratchdimen\of\box\scratchbox\relax% compensate for -% \ifdim\scratchdimen>\TABLEparheight % funny depth of -% \global\TABLEparheight\scratchdimen % multi-line box -% \fi % i.e. vtop - \box\scratchbox} +% Key "\{": Enclose template in braces. -% We also need to patch away the interfering math switch: +\newtableformatkey \{% + {\!taDataColumnTemplate=\expandafter{\expandafter{\the\!taDataColumnTemplate}}% + \doreadtableformatkeys} -% \mathpunctuationtrue +% Key "*": "*{N}{KEY LETTERS}" is equivalent to specifying +% N times. +% KEY LETTERS may contain further * specifications -% test, test -% \starttable[|c|] -% \NC1,,10\NC\AR -% \stoptable -% test, test - -\def\!ttBeginTableA[#1]{% - \if #1u% % "unboxed" table - \ifmmode - \def\!ttEndTable{% % user had better be in display math mode - \relax}% % and have only one table at the outer level - \else % user had better be in vertical mode - \bgroup - \def\!ttEndTable{% - \egroup}% - \fi - \else - %\hbox\bgroup $ - %\def\!ttEndTable{% - % \egroup % for the \vtop, \vbox, or \vcenter, yet to come - % $% for math mode - % \egroup}% for the \hbox - %\if #1t% - % \vtop - %\else - % \if #1b% - % \vbox - % \else - % \vcenter % math mode was essential for this - % \fi - %\fi - % - \hbox\bgroup - \def\!ttEndTable{\egroup\egroup}% - \if#1t% - \vtop - \else\if#1b% - \vbox - \else - \def\!ttEndTable{\egroup$\egroup}% - %$\vcenter - \scratchtoks\everymath\everymath\emptytoks$\everymath\scratchtoks\vcenter - \fi\fi - % - \bgroup % for the \vtop, \vbox, or \vcenter - \fi - \advance\!taRecursionLevel 1 % RecursionLevel governs initialization - \let\!ttRightGlue=\relax % This may be changed by \JustCenter, etc - \everycr\emptytoks % ={} - \ifnum \!taRecursionLevel=1 - \!ttInitializeTable - \fi} +\newtableformatkey *#1#2% + {\scratchcounter=#1\relax + \scratchtoks\emptytoks + \!thLoop + \ifnum\scratchcounter>\zerocount + \scratchtoks\expandafter{\the\scratchtoks#2}% + \advance\scratchcounter\minusone + \repeat + \expandafter\doreadtableformatkeys\the\scratchtoks} -%D The next redefinition is more robust than the original: +% Key "\LeftGlue": Specifies the glue (usually \hfil, or nothing) to be +% added to extreme left of the template to position a column -\def\SetTableToWidth#1% - {\doifelsenothing{#1}{\!taTableSpread\emptytoks}{\!taTableSpread{to #1}}} +\newtableformatkey \LeftGlue#1% + {\!taLeftGlue{#1}% + \doreadtableformatkeys} -% (*) Try this one with \type {direction} and {girection}; -% the \PPCHTEX\ manual is a nice testcase. -% -% \startoverlay -% {\starttable[ | l w(2cm) | w(8cm) | ] -% \HL -% \VL direction \VL \showbaselines \dorecurse{3}{direction }\VL \FR -% \VL direction \VL \showbaselines \dorecurse{3}{direction }\VL \MR -% \VL direction \VL \showbaselines \dorecurse{3}{direction }\VL \LR -% \HL -% \stoptable} -% {\starttable[ | l w(2cm) | p(8cm) | ] -% \HL -% \VL direction \VL \showbaselines \dorecurse{3}{direction }\VL \FR -% \VL direction \VL \showbaselines \dorecurse{3}{direction }\VL \MR -% \VL direction \VL \showbaselines \dorecurse{3}{direction }\VL \LR -% \HL -% \stoptable} -% \stopoverlay -% \vskip2cm -% \starttable[ | l w(2cm) | p(8cm) | ] -% \HL -% \VL direction \VL \showbaselines \dorecurse{3}{direction }\VL \FR -% \VL direction \VL \showbaselines \dorecurse{8}{direction }\VL \LR -% \HL -% \stoptable -% \vskip2cm -% \starttable[ | l w(2cm) | p(8cm) | ] -% \HL -% \VL direction \VL \showbaselines \dorecurse{8}{direction }\VL \FR -% \VL direction \VL \showbaselines \dorecurse{8}{direction }\VL \LR -% \HL -% \stoptable +\newtableformatkey \RightGlue#1% + {\!taRightGlue{#1}% + \doreadtableformatkeys} -%D To give an impression of what the (well documented) source -%D of \TABLE\ looks like, we first implement an alternative for -%D the numeric keys. The quantity keys (\type{q} and \type{Q}) -%D support the more european way of writing numbers: -%D -%D \startnarrower -%D 100.000.000,00 instead of 100,000,000.00 -%D \stopnarrower -%D -%D The next table shows how to use these keys. We use braces -%D instead of brackets because we need brackets to specify the -%D format. -%D -%D \startbuffer -%D \starttable{|q[00,000]|Q[00,00]|} -%D \HL -%D \VL -1,2 \VL 12,35 \VL\FR -%D \VL 11,203 \VL 2,4 \VL\LR -%D \HL -%D \stoptable -%D \stopbuffer -%D -%D \ShowExample -%D -%D Although a more efficient implementation is possible |<|we -%D can for instance share common macros|>| we just adapt a copy -%D of the numeric ones. To permit double loading of this -%D module, we check for the existence of one of the macros. +\newtableformatkey c% + {\prependtoks\raggedcenter\to\!taDataColumnTemplate + \doreadtableformatkeys \LeftGlue\hfil \RightGlue\hfil} + +\newtableformatkey l% + {\prependtoks\raggedright\to\!taDataColumnTemplate + \doreadtableformatkeys \LeftGlue\empty \RightGlue\hfil} + +\newtableformatkey r% + {\prependtoks\raggedleft\to\!taDataColumnTemplate + \doreadtableformatkeys \LeftGlue\hfil \RightGlue\empty} + +\newtableformatkey x% + {\prependtoks\notragged\to\!taDataColumnTemplate + \doreadtableformatkeys \LeftGlue\hfil \RightGlue\empty} + +% Key "k": Adds kerns to left and right of "#" +% This key and the two below use Plain TeX's \if@h as if it were \if@left, +% and \if@v as if it were \if@right. Table making goes on in a group, +% so even in the unlikely circumstance that a \phantom is currently under +% construction, there's no problem. + +\newtableformatkey k% + {\settrue\tablehasleftspacing + \settrue\tablehasrightspacing + \!tgGetValue{\!tgInsertKern}} + +% Key "i": Adds a kern to the left of "#" + +\newtableformatkey i% + {\settrue\tablehasleftspacing + \setfalse\tablehasrightspacing + \!tgGetValue{\!tgInsertKern}} + +% Key "j": Adds a kern to the right of "#" + +\newtableformatkey j% + {\setfalse\tablehasleftspacing + \settrue\tablehasrightspacing + \!tgGetValue{\!tgInsertKern}} + +% Key "n": numeric item , non-math mode. + +\newtableformatkey n% + {\def\!tnStyle{}% + \futurelet\!tnext\!tnTestForBracket} + +% Key "N": numeric item, math mode. + +\newtableformatkey N% + {\def\!tnStyle{$}% + \futurelet\!tnext\!tnTestForBracket} + +% Key "m": Math mode. + +\newtableformatkey m% + {\doreadtableformatkeys b$ a$} + +% Key "M": Displaymath mode. + +\newtableformatkey M% + {\doreadtableformatkeys \{ b{$\displaystyle} a$} + +% Key "\m": Template ${}#\hfil$ +\newtableformatkey \m% + {\doreadtableformatkeys l b{{}} m} + +% Key "\M": Template $\displaystyle{{}#\hfil}$ + +\newtableformatkey \M% + {\doreadtableformatkeys l b{{}} M} + +% Key "f": Set font (E.g., f\it sets up italic font (assuming \it +% has its usual meaning) + +\newtableformatkey f#1% + {\doreadtableformatkeys b{#1}} + +\newtableformatkey B{\doreadtableformatkeys f\bf} % Key "B": abbreviation for f\bf +\newtableformatkey I{\doreadtableformatkeys f\it} % Key "I": abbreviation for f\it +\newtableformatkey S{\doreadtableformatkeys f\sl} % Key "S": abbreviation for f\sl +\newtableformatkey R{\doreadtableformatkeys f\rm} % Key "R": abbreviation for f\rm +\newtableformatkey T{\doreadtableformatkeys f\tt} % Key "T": abbreviation for f\tt + +% Key "p": ParBox + +\newtableformatkey p% + {\!tgGetValue{\!tgSetUpParBox}} + +% Key "w": minimum column width + +\newtableformatkey w% + {\!tkTestForBeginFormat w{\!tgGetValue{\!tfSetWidth}}} + +% Key "s": Set tabskip for the inter-column space to the right +% of the current column, and all subsequent spaces, until overriden +% by a new "s" or "o" key. + +\newtableformatkey s% + {\!taOnceOnlyTabskipfalse % in case same column has a prior "o" key + \!tkTestForBeginFormat t{\!tgGetValue{\!tfSetTabskip}}} + +% Key "o": Apply the \tabskip stated for this column ONLY to the +% inter-column space just to the right of this column; restore the +% the previous \tabskip for subsequent columns. + +\newtableformatkey o% + {\!taOnceOnlyTabskiptrue + \!tkTestForBeginFormat o{\!tgGetValue{\!tfSetTabskip}}} + +% Key "|": Standard rule column designator + +\newtableformatkey |% + {\!tkTestForBeginFormat |{\!tgGetValue{\!tfSetVrule}}} + +% Key "\|": Non-standard rule column designator + +\newtableformatkey \|% + {\!tkTestForBeginFormat \|{\!tfSetAlternateVrule}} + +% Key ".": PERIOD -- end of \dobegintableformat section. + +\newtableformatkey .% + {\!tkTestForBeginFormat.{\!tfFinishFormat}} + +% Key "\doendtableformat": Equivalent to "." + +\newtableformatkey \doendtableformat + {\!tkTestForBeginFormat\doendtableformat{\!tfFinishFormat}} + +% Key "]": End of \dotablereformat section + +\newtableformatkey ]% + {\!tkTestForReFormat ] \!tfEndReFormat} + +% TEST FOR BEGIN FORMAT{}{Intended Action}: This test is run +% on keys that can only be used by \dobegintableformat --- "s", "o", +% "|", "\|", "w", ".", and "\doendtableformat". + +\def\!tkTestForBeginFormat#1#2% + {\if!taBeginFormat + \def\!ttemp{#2}% + \expandafter\!ttemp + \else + \toks0={#1}% + \toks2=\expandafter{\string\dotablereformat}% + \expandafter\!tkImproperUse + \fi} + +% TEST FOR RE FORMAT{}{Intended Action}: This test is run +% on the key "]", which can only be used by \dotablereformat. + +\def\!tkTestForReFormat#1#2% + {\if!taBeginFormat + \toks0={#1}% + \toks2=\expandafter{\string\dobegintableformat}% + \expandafter\!tkImproperUse + \else + \def\!ttemp{#2}% + \expandafter\!ttemp + \fi} + +% NOTE: THE SPACE BETWEEN A NUMERIC ENTRY AND THE FOLLOWING '|', '"', +% OR '\|' IS MANDATORY. +% EMPTY NUMERIC ENTRIES ARE NOT ALLOWED: USE '{}' OR '\omit' INSTEAD. + +\def\!tnTestForBracket + {\ifx[\!tnext + \expandafter\!tnGetArgument + \else + \expandafter\!tnGetCode + \fi} + +% GET CODE: E.g. "4", or "4.0", "0.4", or "10.2" + +\def\!tnGetCode#1 % + {\!tnConvertCode #1..!} + +% CONVERT CODE: E.g. converts above to [0000], [0000.], [.0000], +% [0000000000.00] + +\def\!tnConvertCode #1.#2.#3!% + {\begingroup + \aftergroup\edef \aftergroup\!ttemp \aftergroup{% + \aftergroup[% + \scratchcounter#1\relax + \!thLoop + \ifnum \scratchcounter>\zerocount + \advance\scratchcounter\minusone + \aftergroup0 + \repeat + \def\!ttemp{#3}% + \ifx\!ttemp \empty + \else + \aftergroup. + \scratchcounter#2\relax + \!thLoop + \ifnum \scratchcounter>\zerocount + \advance\scratchcounter\minusone + \aftergroup0 + \repeat + \fi + \aftergroup]\aftergroup}% + \endgroup\relax + \expandafter\!tnGetArgument\!ttemp} -\letvalue{!tk<\string q>}=\undefined -\letvalue{!tk<\string Q>}=\undefined +% GET ARGUMENT: [ > -%D We just copy the original {\em comments}. -%D -%D \em Key \type{q}: quantity item, non||math mode. +\def\!tnGetArgument[#1]% + {\!tnMakeNumericTemplate\!tnStyle#1..!} + +% MAKE NUMERIC TEMPLATE + +\def\!tnMakeNumericTemplate#1#2.#3.#4!% #1= or $ + {\def\!ttemp{#4}% + \ifx\!ttemp\empty + \!taDimenC\zeropoint + \else + \setbox\scratchbox=\hbox{\mathsurround\zeropoint #1.#3#1}% + \!taDimenC\wd\scratchbox + \fi + \setbox\scratchbox\hbox{\mathsurround\zeropoint #1#2#1}% + \!thToksEdef\!taDataColumnTemplate + {\noexpand\!tnSetNumericItem{\the\wd\scratchbox}{\the\!taDimenC}{#1}% + \the\!taDataColumnTemplate}% Might have tabskip glue in here + \doreadtableformatkeys} + +% SET NUMERIC ITEM + +\def\!tnSetNumericItem #1#2#3#4 % + {\!tnSetNumericItemA {#1}{#2}{#3}#4..!} -\NewFormatKey q% +\def\!tnSetNumericItemA #1#2#3#4.#5.#6!% + {\def\!ttemp{#6}% + \hbox to #1{\hss \mathsurround\zeropoint #3#4#3}% + \hbox to #2{\ifx\!ttemp\empty\else\mathsurround\zeropoint #3.#5#3\fi\hss}} + +% extensions + +\newtableformatkey q% {\letempty\!tqStyle \futurelet\!tnext\!tqTestForBracket} -%D \em Key \type{Q}: quantity item, math mode. - -\NewFormatKey Q% +\newtableformatkey Q% {\def\!tqStyle{$}% \futurelet\!tnext\!tqTestForBracket} -%D \em Note: the space between a quantity entry and the -%D following \type{|}, \type{"}, or \type{\|} is mandatory. -%D empty quantity entries are not allowed: use \type{{}} or -%D \type{\omit} instead. -%D -%D \em Test for bracket: invoked by the keys \type{q} and -%D \type{Q}. - \def\!tqTestForBracket {\ifx[\!tnext \!thx\!tqGetArgument @@ -656,35 +699,29 @@ \!thx\!tqGetCode \fi} -%D \em Get code: e.g. \type{4}, or \type{4,0}, \type{0,4}, or -%D \type{10,2}. - \def\!tqGetCode#1 % note the blank {\!tqConvertCode #1,,!} -%D \em Convert code: e.g. converts above to \type{[0000]}, -%D \type{[0000,]}, \type{[,0000]}, \type{[0000000000,00]}. - \def\!tqConvertCode #1,#2,#3!% {\begingroup \aftergroup\edef \aftergroup\!ttemp \aftergroup{% \aftergroup[% - \!taCountA #1 + \scratchcounter#1\relax \!thLoop - \ifnum \!taCountA>\zerocount - \advance\!taCountA \minusone + \ifnum \scratchcounter>\zerocount + \advance\scratchcounter\minusone \aftergroup0 \repeat \def\!ttemp{#3}% \ifx\!ttemp\empty \else \aftergroup, - \!taCountA #2 + \scratchcounter#2\relax \!thLoop - \ifnum\!taCountA>\zerocount - \advance\!taCountA \minusone + \ifnum\scratchcounter>\zerocount + \advance\scratchcounter\minusone \aftergroup0 \repeat \fi @@ -692,32 +729,22 @@ \endgroup\relax \!thx\!tqGetArgument\!ttemp} -%D \em Get argument: -%D -%D \starttyping -%D -%D \stoptyping - \def\!tqGetArgument[#1]% {\!tqMakeQuantityTemplate\!tqStyle#1,,!} -%D \em Make quantity template. - \def\!tqMakeQuantityTemplate#1#2,#3,#4!% #1= or $ {\def\!ttemp{#4}% \ifx\!ttemp\empty \!taDimenC\zeropoint \else - \setbox0\hbox{\mathsurround\zeropoint #1,#3#1}% - \!taDimenC\wd0 + \setbox\scratchbox\hbox{\mathsurround\zeropoint #1,#3#1}% + \!taDimenC\wd\scratchbox \fi - \setbox0\hbox{\mathsurround\zeropoint #1#2#1}% + \setbox\scratchbox\hbox{\mathsurround\zeropoint #1#2#1}% \!thToksEdef\!taDataColumnTemplate - ={\noexpand\!tqSetQuantityItem{\the\wd0 }{\the\!taDimenC}{#1}% + {\noexpand\!tqSetQuantityItem{\the\wd\scratchbox}{\the\!taDimenC}{#1}% \the\!taDataColumnTemplate}% - \ReadFormatKeys} - -%D \em Set numeric item. + \doreadtableformatkeys} \def\!tqSetQuantityItem #1#2#3#4 % {\!tqSetQuantityItemA{#1}{#2}{#3}#4,,!} @@ -727,223 +754,565 @@ \hbox to #1{\hss\mathsurround\zeropoint#3#4#3}% \hbox to #2{\ifx\!ttemp\empty\else\mathsurround\zeropoint#3,#5#3\fi\hss}} -%D Here ends the Q||extension. Did you watch the clever use -%D of aftergroup in \type{\!tqConvertCode}. +% \Enlarge +% \enlarge + +\def\dotableEnlarge#1#2% + {% 3rd argument is picked up later + % #1=extra height + % #2=extra depth + \!taDimenA=#1\relax + \!taDimenB=#2\relax + \let\!TsSpaceFactor\empty + \ifmmode + \expandafter\mathpalette + \expandafter\!TsEnlargeMath + \else + \expandafter\!TsEnlargeOther + \fi} -% %D We also (have to) define a key for \type{\cap}: -% -% \letvalue{!tk<\string K>}=\undefined -% -% \NewFormatKey K% -% {\ReadFormatKeys b\smallcapped} - -%D A few pages back we saw backgrounds, further on we will see -%D colored rules, and here we provide a means to color the -%D entries in a column. (We can of course always use the normal -%D color commands for individual entries.) We could not use the -%D lowercase~\type{c}, because that one is used to force {\em -%D centering}. -%D -%D \startbuffer -%D \starttable[|C{red}|C{green}|C{blue}|] -%D \VL R(ed) \VL G(reen) \VL B(lue) \VL\SR -%D \stoptable -%D \stopbuffer -%D -%D \ShowExample +\def\!TsEnlargeOther#1% + {\ifhmode + \setbox\scratchbox\hbox{#1\xdef\!TsSpaceFactor{\spacefactor\the\spacefactor}}% + \else + \setbox\scratchbox\hbox{#1}% + \fi + \!TsFinishEnlarge} -\letvalue{!tk<\string C>}=\undefined +\def\!TsEnlargeMath#1#2% + {\setbox\scratchbox\hbox{$\mathsurround\zeropoint#1{#2}$}% + \!TsFinishEnlarge} -\NewFormatKey C#1% - {\ReadFormatKeys b{\startcolor[#1]} a{\stopcolor}} +\def\!TsFinishEnlarge + {\ht\scratchbox\dimexpr\ht\scratchbox+\!taDimenA\relax + \dp\scratchbox\dimexpr\dp\scratchbox+\!taDimenB\relax + \box\scratchbox + \!TsSpaceFactor\relax} -%D So now we have three new keys: -%D -%D \starttable[|||] -%D \HL -%D \NC \bf key \NC \bf meaning \NC\AR -%D \HL -%D \NC Q[x,y] \NC math mode formatted numbers \NC\AR -%D \NC q[x,y] \NC text mode formatted numbers \NC\AR -%D \NC C{identifier} \NC column entry color \NC\AR -%D \HL -%D \stoptable +\def\dotableenlarge#1#2% 3rd argument is picked up later + {\dotableEnlarge{#1\tablestrutunit}{#2\tablestrutunit}} -%D To be compatible with the tabulate environment, we also -%D support the \type {l}, \type {c} and \type {r} keys for -%D paragraph entries. +\appendtoks + \let\enlarge\dotableenlarge + \let\Enlarge\dotableEnlarge +\to \everytable -\letvalue{!tk<\string l>}=\undefined -\letvalue{!tk<\string c>}=\undefined -\letvalue{!tk<\string r>}=\undefined -\letvalue{!tk<\string x>}=\undefined % not that needed +% BEGIN TABLE -\NewFormatKey c% - {\prependtoks\raggedcenter\to\!taDataColumnTemplate - \ReadFormatKeys \LeftGlue\hfil \RightGlue\hfil} +\let\dotablestandardend\relax -\NewFormatKey l% - {\prependtoks\raggedright\to\!taDataColumnTemplate - \ReadFormatKeys \LeftGlue\empty \RightGlue\hfil} +\def\dotablestandardbegin[#1]% \!ttBeginTable (always argument) + {\if#1u% unboxed table + \ifmmode + \let\dotablestandardend\relax % user had better be in display math mode and have only one table at the outer level + \else % user had better be in vertical mode + \bgroup + \let\dotablestandardend\egroup + \fi + \else + \hbox\bgroup + \def\dotablestandardend{\egroup\egroup}% + \if#1t% + \vtop + \else\if#1b% + \vbox + \else + \def\dotablestandardend{\egroup$\egroup}% + %$\vcenter + \scratchtoks\everymath\everymath\emptytoks$\everymath\scratchtoks\vcenter + \fi\fi + \bgroup % for the \vtop, \vbox, or \vcenter + \fi + \advance\!taRecursionLevel\plusone + \let\!ttRightGlue\relax + \everycr\emptytoks + \ifnum\!taRecursionLevel=\plusone + \the\everytable + \fi} -\NewFormatKey r% - {\prependtoks\raggedleft\to\!taDataColumnTemplate - \ReadFormatKeys \LeftGlue\hfil \RightGlue\empty} +\bgroup \catcode\tildeasciicode\activecatcode -\NewFormatKey x% - {\prependtoks\notragged\to\!taDataColumnTemplate - \ReadFormatKeys \LeftGlue\hfil \RightGlue\empty} + \appendtoks + \catcode\barasciicode\activecatcode + \def~{\kern.5em}% + \def\\{\ifhmode\space\else\par\fi}% + \to \everytable -\appendtoks \TABLEparalignment \to \EveryTableParBox +\egroup -\def\!tfReFormat#1% - {\the \!taLeftGlue - \vbox{\forgetall\ialign{\span\the\!taDataColumnTemplate\cr#1\cr}}% - \the \!taRightGlue - \kern\zeropoint} % prevents \unskip / really needed - -%D Later on, we're going to implement multiple page table -%D support, therefore the next \TABLE\ macro needs to be -%D slightly adapted, i.c. the penalty is removed. We also -%D add basic color support. - -\def\!ttFullHruleA - {\!ttGetHalfRuleThickness - \startglobalTABLEcolor % added - \hrule\!thHeight\dimen0\!thDepth\dimen0 - \stopglobalTABLEcolor % added - %\penalty0 % removed - \egroup} +\let\!ttRightGlue\relax % This may be changed, in a group, by \JustCenter, etc + +% DO HALIGN: Invoked by END FORMAT (or the key ".") + +\def\!ttDoHalign + {\edef\dorestoretablelineskips + {\baselineskip \the\baselineskip + \lineskiplimit\the\lineskiplimit + \lineskip \the\lineskip + \tabskip \the\tabskip + \relax}% + \baselineskip \zeropoint + \lineskiplimit\zeropoint + \lineskip \zeropoint + \tabskip \zeropoint + \doifelsenothing\@@titextwidth + {\halign} + {\doifelse\@@titextwidth\v!max + {\halign to \hsize} + {\halign to \@@titextwidth}}% +% \the\!taTableSpread + \bgroup + \span + \the\!taPreamble + \ifx\!tfRowOfWidths\empty\else + \!tfRowOfWidths\cr + \fi} + +% END TABLE + +\def\dotablenormalend + {\egroup % finishes the \halign + \dotablestandardend} % closes off the table envirnoment set up by \tablestandardbegin + +\def\donormaltablelineending + {\cr} + +\def\donormaltablelineformat#1#2% + {\vrule + \!!width \zeropoint + \!!height\dimexpr\tablestrutheightfactor\tablestrutunit+#1\tablestrutunit\relax + \!!depth \dimexpr\tablestrutdepthfactor \tablestrutunit+#2\tablestrutunit\relax + \relax + \cr} + +% INSERT VRULE + +\newcount\noftablevrules \noftablevrules\plusone + +\let\tablecurrentvrulecolor\empty +\let\tablecurrenthrulecolor\empty + +\def\@VLd{.125em} + +\def\do!ttInsertVrule % will be merged in 2005 + {\vrule\!!width + \ifnum\!tgCode=\plusone + \ifx\!tgValue\empty + \tablevrulethicknessfactor + \else + \!tgValue + \fi + \tablelinethicknessunit + \else + \!tgValue + \fi + \hskip\@VLd} + +\def\donormaltablesimplebar + {\unskip\!ttRightGlue&&} + +\def\donormaltablecomplexbar + {\unskip\!ttRightGlue&\omit + \hfil + \ifx\tablecurrentvrulecolor\empty\else + \switchtocolor[\tablecurrentvrulecolor]% + \fi + \ifcase\noftablevrules\or + \do!ttInsertVrule + \unskip + \else + \dorecurse\noftablevrules\do!ttInsertVrule + \global\noftablevrules\plusone + \unskip + \fi + \global\let\tablecurrentvrulecolor\empty + \hfil + &} + +\def\donormaltablenobar + {\unskip\!ttRightGlue&\omit&} + +\def\donormaltablesinglerule + {&\donormaltablelongrule&} + +\def\donormaltablemultirule + {&\!ttuse\tabledrulespan\donormaltablelongrule&} + +% USE + +\def\!ttuse#1% + {\ifnum#1>\plusone + \omit + \global\setfalse\istabledivision % added + \scratchcounter\currenttablecolumn % added + \advance\scratchcounter #1% % added + \advance\scratchcounter \minusone % added + \def\next % added + {\global\advance\currenttablecolumn #1% % added + \global\advance\currenttablecolumn \minusone % added + \scratchcounter#1% + \advance\scratchcounter \minusone + \advance\scratchcounter \scratchcounter + \!thLoop + \ifnum\scratchcounter>\plusone + \spanomit \advance\scratchcounter\minusone + \repeat + \span}% + \else % added + \def\next % conflicts with possible next \omit % added + {\global\advance\currenttablecolumn \plusone}%% added + \fi + \next} % added + +\def\!ttUse#1[% + {\!ttuse{#1}% + \dotablereformat[} + +\appendtoks + \let\use\!ttuse + \let\Use\!ttUse +\to \everytable + +% rules + +\def\donormaltablefullrule + {\starttablenoalign + \!ttGetHalfRuleThickness + \hrule\!!height\scratchdimen\!!depth\scratchdimen + \stoptablenoalign} + +\def\donormaltableshortrule % was: \!ttShortHrule + {\omit + \!ttGetHalfRuleThickness + \leaders\hrule\!!height\scratchdimen\!!depth\scratchdimen\hfill + \emptyhbox + \ignorespaces} + +\def\donormaltablelongrule % was: \!ttLongHrule + {\omit\span + \omit\span + \donormaltableshortrule} + +\def\!ttGetHalfRuleThickness + {\scratchdimen\dimexpr + \ifnum\!tgCode=\plusone + \ifx\!tgValue\empty + \tablehrulethicknessfactor + \else + \!tgValue % user-specified integer + \fi + \tablelinethicknessunit + \else + \!tgValue % user-specified dimension + \fi + \divide\scratchdimen\plustwo} + +% \emptyhbox prevents \unskip + +\def\dotableLeft #1{#1\hfill\emptyhbox} +\def\dotableCenter#1{\hfill#1\hfill\emptyhbox} +\def\dotableRight #1{\hfill#1} + +\def\dotableOpenUp#1#2% + {\edef\tablestrutheightfactor{\withoutpt\the\dimexpr\tablestrutheightfactor\points+#1\points}% + \edef\tablestrutdepthfactor {\withoutpt\the\dimexpr\tablestrutdepthfactor \points+#2\points}} + +% SetTableToWidth -> textwidth=dimension [to dimension] +% Expand -> textwidth=max [to \hsize] +% WidenTableBy -> [spread #1] +% \tablelefttabskip\zeropoint\!!plus1fill +% \tablerighttabskip\tablelefttabskip +% LongLines -> [spread \hsize] + +\def\dotableJustLeft {\omit\let\!ttRightGlue\hfill} +\def\dotableJustCenter{\omit\hfill\emptyhbox\let\!ttRightGlue\hfill} +\def\dotableJustRight {\omit\hfill\emptyhbox} + +\def\dotableSmash + {\relax + \ifmmode + \expandafter\mathpalette + \expandafter\!thDoMathVCS + \else + \expandafter\!thDoVCS + \fi} + +\def\!thDoVCS#1% + {\setbox\zerocount\hbox{#1}% + \!thFinishVCS} + +\def\!thDoMathVCS#1#2% + {\setbox\zerocount\hbox{$\mathsurround\zeropoint#1{#2}$}% + \!thFinishVCS} + +\def\!thFinishVCS + {\vbox to\zeropoint{\vss\box\zerocount\vss}} + +\def\dotableRaise + {\def\!thSign{+}% + \!tgGetValue\!thSetDimen} + +\def\dotableLower + {\def\!thSign{-}% + \!tgGetValue\!thSetDimen} + +\def\!thSetDimen + {\ifnum\!tgCode=\plusone + \ifx\!tgValue\empty + \!taDimenA\tablestrutheightfactor\tablestrutunit + \advance\!taDimenA\tablestrutdepthfactor\tablestrutunit + \divide\!taDimenA\plustwo + \else + \!taDimenA\!tgValue\tablestrutunit + \fi + \else + \!taDimenA\!tgValue + \fi + \!taDimenA\!thSign\!taDimenA\relax + \ifmmode + \expandafter\mathpalette + \expandafter\!thDoMathRaise + \else + \expandafter\!thDoSimpleRaise + \fi} + +\def\!thDoSimpleRaise#1% + {\setbox\zerocount\hbox{\raise \!taDimenA\hbox{#1}}% + \!thFinishRaise} % From Plain TeX: \ht0=0pt \dp0=0pt \box0 + +\def\!thDoMathRaise#1#2% + {\setbox\zerocount\hbox{\raise \!taDimenA\hbox{$\mathsurround\zeropoint#1{#2}$}}% + \!thFinishRaise} + +\def\!thFinishRaise + {\ht\zerocount\zeropoint + \dp\zerocount\zeropoint + \box\zerocount} + +\def\dotableBackSpace + {\!tgGetValue\!thKernBack} + +\def\!thKernBack + {\kern - + \ifnum\!tgCode=\plusone + \ifx\!tgValue\empty + \tablekernfactor + \else + \!tgValue % user-specified integer + \fi + \tablekernunit + \else + \!tgValue % user-specified dimension + \fi + \ignorespaces} + +\def\dotableVspace + {\noalign + \bgroup + \!tgGetValue\!thVspace} + +\def\!thVspace + {\vskip + \ifnum\!tgCode=\plusone + \ifx\!tgValue\empty + \tablevspacefactor + \else + \!tgValue % user-specified integer + \fi + \tablestrutunit + \else + \!tgValue % user-specified skip + \fi + \egroup} % Ends the \noalign + +\appendtoks + \let\JustLeft \dotableJustLeft + \let\JustCenter \dotableJustCenter + \let\JustRight \dotableJustRight + \let\Smash \dotableSmash + \let\Raise \dotableRaise + \let\Lower \dotableLower + \let\BackSpace \dotableBackSpace + \let\Vspace \dotableVspace + \let\OpenUp \dotableOpenUp + \let\TableLeft \dotableLeft + \let\TableCenter \dotableCenter + \let\TableRight \dotableRight +\to \everytable + +%D \macros +%D {inintable, ifsplittables} +%D +%D First we declare some variables. These show a bit what we +%D are dealing with. First we introdoce some booleans that +%D enable us, inside as well as outside this module, to +%D determine in what mode we are. + +\newif\ifintable +\newif\ifsplittables -%D We'll see that when we want to give a vertical rule a color, -%D we have to set and reset states. After heavy testing it -%D proved most useful to extend a \TABLE\ primitive with some -%D hooks. One thing to keep in mind is that \type{&} keeps -%D assignments local. Again, we add basic color support. +%D We show this feature in an example that also shows some of +%D the basic table typesetting commands. +%D +%D \startbuffer +%D \starttable[|||] +%D \HL +%D \VL first \VL second \VL\AR +%D \HL +%D \VL alfa \VL 1 \VL\AR +%D \VL beta \VL 2 \VL\AR +%D \VL gamma \VL 3 \VL\AR +%D \HL +%D \stoptable +%D \stopbuffer +%D +%D \startcombination +%D {\tracetablesfalse\getbuffer} {\type{\tracetablesfalse}} +%D {\tracetablestrue\getbuffer} {\type{\tracetablestrue}} +%D \stopcombination +%D +%D This table is specified as: +%D +%D \typebuffer +%D +%D This examples shows about the minimum of commands needed to +%D typeset such a table. In this table, the \type {\AR} is +%D automatically translated into the more primitive (but more +%D verbose) commands \type {\SR}, \type {\FR}, \type {\MR} and +%D \type {\LR} commands. +%D +%D \startbuffer +%D \starttables[|||] +%D \HL +%D \VL first \VL second \VL\AR +%D \HL +%D \VL alfa \VL 1 \VL\AR +%D \VL beta \VL 2 \VL\AR +%D \VL gamma \VL 3 \VL\AR +%D \HL +%D \stoptable +%D \stopbuffer +%D +%D When we use the split table feature, we get a bit more +%D information. +%D +%D {\tracetablesfalse\getbuffer} +%D +%D Sometimes in tables information shows up that is not typed +%D in by the user. These messages give a cue in what aspect a +%D table definition is wrong. +%D +%D \startbuffer +%D \starttable[||||] +%D \HL +%D \VL first second \VL third \VL\AR +%D \HL +%D \VL alfa \VL 1 \VL a \VL\AR +%D \VL beta \VL 2 \VL b \VL +%D \VL gamma \VL \THREE{3} c \VL\AR +%D \HL +%D \stoptable +%D \stopbuffer +%D +%D \typebuffer +%D +%D Those terrible table has three errors, which all show up in +%D typeset messages. Errors cannot always recovered 100\% and +%D therefore can result in two or more succesive messages, like +%D in the last row. +%D +%D \getbuffer +%D +%D Some simple color support is provided: +%D +%D \startbuffer +%D \starttable[|c|c|] +%D \HL +%D \VL test \VL test \VL \SR +%D \HL[green,5] +%D \VL[red] test \VL test \VL \FR +%D \VL test \VL[10,red] test \VL \MR +%D \VL test \VL test \VL[10] \LR +%D \HL +%D \stoptable +%D \stopbuffer +%D +%D \typebuffer \getbuffer -\let\TABLEbeforebar\empty -\let\TABLEafterbar \empty +\def\s!TaBlE{TaBlE} +\def\m!TABLE{TABLE} -\def\@VLn{1} -\def\@VLd{.125em} +%D We already saw that the table macros report errors and +%D provide automatic spacing. These features can only be +%D implemented by keeping track of the state, often the last +%D command on a row. -\def\do!ttInsertVrule % will be merged in 2005 - {\vrule \!thWidth - \ifnum\!tgCode=\plusone - \ifx\!tgValue\empty - \LineThicknessFactor - \else - \!tgValue - \fi - \LineThicknessUnit - \else - \!tgValue - \fi - \hskip\@VLd} +\newconstant\tableforcestate +\newconstant\tableactionstate -\def\!ttInsertVrule - {\hfil - \TABLEbeforebar % added - \startglobalTABLEcolor % added - % we could do without this speedup, some day merge 'm - \ifcase\@VLn\or - \do!ttInsertVrule - \unskip - \else - \dorecurse\@VLn\do!ttInsertVrule - \gdef\@VLn{1}% - \unskip - \fi - \stopglobalTABLEcolor % added - \TABLEafterbar % added - \hfil - &} +\setnewconstant\tableunknownstate 0 -%D The next two macros are only adapted to basis rule -%D color support. +\setnewconstant\tableseparaterowstate 1 +\setnewconstant\tablefirstrowstate 2 +\setnewconstant\tablemidrowstate 3 +\setnewconstant\tablelastrowstate 4 +\setnewconstant\tablerulestate 5 +%setnewconstant\tableskipstate 6 +%setnewconstant\tableautorowstate 7 -\def\!tfSetVrule - {\!thToksEdef\!taRuleColumnTemplate= - {\noexpand\hfil - \noexpand\startglobalTABLEcolor % added - \noexpand\vrule - \noexpand\!thWidth - \ifnum\!tgCode=\plusone - \ifx\!tgValue\empty - \the\LineThicknessFactor - \else - \!tgValue - \fi - \!taLTU - \else - \!tgValue - \fi - ####% - \noexpand\hfil - \noexpand\stopglobalTABLEcolor % added - \the\!taRuleColumnTemplate}% - \!tfAdjoinPriorColumn} +\setnewconstant\tableforcefirstrowstate 1 +\setnewconstant\tableforcelastrowstate 2 -\def\!ttShortHruleA - {\!ttGetHalfRuleThickness - \startglobalTABLEcolor % added - \leaders\hrule\!thHeight\dimen0\!thDepth\dimen0\hfill - \stopglobalTABLEcolor % added - \null - \ignorespaces} +\newconstant\tablerowfactor +\newconstant\TABLEendofrowdepth +\newconstant\TABLEendofrowheight +\newconstant\TABLEcr +\newconstant\tablerowzero +\newconstant\TABLEn -%D We already showed the next one, but here we slightly adapt -%D the macro by adding an \type{\expandafter}. The space after -%D \type{#1} is crucial! +%D We store these states using \type {constants}'s and +%D like most variables, these are global ones. When needed, +%D especially when we flush the backgrounds, we can temporary +%D disable the assignment. -\def\normalTABLEcomplexbar#1% - {\unskip\!ttRightGlue&\omit\expandafter\!ttAlternateVrule#1 } +\newconditional\tableactionstatepermitted -%D To get rid of interfering \type{\omit}'s when we are -%D checking the number of columns and reporting problems. The -%D extensions concern the second level check, the first -%D subbranch and advancing the column. +\def\dosettableaction#1{\ifconditional\tableactionstatepermitted\global\tableactionstate#1\fi} +\def\dosettableforce #1{\ifconditional\tableactionstatepermitted\global\tableforcestate #1\fi} -\ifx\mscount\undefined \newcount\mscount \fi +%D To give an impression of what the (well documented) source +%D of \TABLE\ looks like, we first implement an alternative for +%D the numeric keys. The quantity keys (\type{q} and \type{Q}) +%D support the more european way of writing numbers: +%D +%D \startnarrower +%D 100.000.000,00 instead of 100,000,000.00 +%D \stopnarrower +%D +%D The next table shows how to use these keys. We use braces +%D instead of brackets because we need brackets to specify the +%D format. +%D +%D \startbuffer +%D \starttable{|q[00,000]|Q[00,00]|} +%D \HL +%D \VL -1,2 \VL 12,35 \VL\FR +%D \VL 11,203 \VL 2,4 \VL\LR +%D \HL +%D \stoptable +%D \stopbuffer +%D +%D \ShowExample +%D +%D Although a more efficient implementation is possible |<|we +%D can for instance share common macros|>| we just adapt a copy +%D of the numeric ones. To permit double loading of this +%D module, we check for the existence of one of the macros. -\def\!ttuse#1% - {\ifnum#1>\plusone - \omit - \global\TABLEdivisionfalse - \scratchcounter\currentTABLEcolumn % added - \advance\scratchcounter #1% % added - \advance\scratchcounter \minusone % added - \ifnum\scratchcounter>\maxTABLEcolumn % added - \def\next % added - {\setTABLEerror\TABLEspanoverflow % added - \handleTABLEerror}% % added - \else % added - \def\next % added - {\global\advance\currentTABLEcolumn #1% % added - \global\advance\currentTABLEcolumn \minusone % added - \mscount#1% \mscount is in Plain - \advance\mscount \minusone - \advance\mscount \mscount - \!thLoop - \ifnum\mscount>\plusone - \spanomit \advance\mscount\minusone - \repeat - \span}% - \fi % added - \else % added - \def\next % conflicts with possible next \omit % added - {\global\advance\currentTABLEcolumn \plusone}% % added - \fi - \next} % added +%D To be compatible with the tabulate environment, we also +%D support the \type {l}, \type {c} and \type {r} keys for +%D paragraph entries. -% \starttable[|c|c|c|c|] -% \HL -% \VL {test} \VL \TWO{} \VL test \VL\FR -% \DL \DC \DL\DR -% \VL {test} \VL \TWO{} \VL test \VL\LR -% \HL -% \stoptable - %D All commands that are executed between rows are to be put in %D \type {\noalign}. We can however not verify if we (that is %D \TABLE) does or did not enter this mode. A moderate dirty @@ -952,9 +1321,18 @@ %D such hacks become a second nature. However, redefining \type %D {\omit} and \type{\span} is not that easy.} -\def\TABLEnoalign - {\noalign\bgroup\let\noalign\relax\let\next=} - +\def\tablenoalign + {\noalign + \bgroup + \let\noalign\relax + \let\tablenoalign\relax + \let\next=} + +\def\starttablenoalign + {\tablenoalign\bgroup} + +\let\stoptablenoalign\egroup + %D \macros %D {starttable} %D @@ -980,8 +1358,15 @@ \newconditional\tablerepeathead \newconditional\tablerepeattail + \unexpanded\def\starttable {\bgroup + \dodoubleempty\dostarttable} + +\unexpanded\def\dostarttable[#1][#2]% preamble optional-settings + {\ifsecondargument + \getparameters[\??ti][#2]% + \fi \let\stoptable\dostoptable \doif\@@tisplit\v!auto {\ifinsidesplitfloat\let\@@tisplit\v!yes\fi}% @@ -992,7 +1377,8 @@ {\ifinsidefloat\else\startbaselinecorrection\fi} {\startframedcontent[\@@tiframe]}% \postponenotes - \firststagestartTABLE}} + \firststagestarttable}% + [#1]} % We cannot define \unexpanded\def\dostoptable a ssomehow lookahead % in alignments fail then, so we relax it and define it locally. @@ -1000,11 +1386,13 @@ \let\stoptabel\relax \def\dostoptable - {\chuckTABLEautorow % before the tail, else noalign problem - \insertTABLEtail - \TABLEnoalign{\globalletempty\@@TABLEhead}% - \TABLEnoalign{\globalletempty\@@TABLEtail}% - \finishTABLE + {\dochucktableautorow % before the tail, else noalign problem + \doinserttabletail + \starttablenoalign + \globalletempty\dotablehead + \globalletempty\dotabletail + \stoptablenoalign + \dofinishtable \doifelsenothing\@@tiframe {\ifinsidefloat\else \stopbaselinecorrection @@ -1016,15 +1404,10 @@ %D Before we can grab the argument, we have to make sure that %D the \CATCODES\ are set. The first stage takes care of that. -\def\firststagestartTABLE - {\bgroup % kan-ie weg? +\def\firststagestarttable% + {\bgroup \global\intabletrue - \pushouterbarandquote - %catcode`\|=\@@other - \complexorsimple\secondstagestartTABLE} - -\def\simplesecondstagestartTABLE#1% - {\complexsecondstagestartTABLE[{#1}]} + \secondstagestarttable} %D \macros %D {definetabletemplate} @@ -1047,19 +1430,19 @@ \unexpanded\def\definetabletemplate % to be redone {\bgroup - \catcode`\|=\@@other + \catcode\barasciicode\othercatcode \doquadrupleempty\dodefinetabletemplate} \def\dodefinetabletemplate[#1][#2][#3][#4]% {\ifsecondargument - \setgvalue{\c!Table#1}{\douseTABLEtemplate{#2}{#3}{#4}}% + \setgvalue{\s!TaBlE#1}{\dousetabletemplate{#2}{#3}{#4}}% \fi \egroup} -\def\douseTABLEtemplate#1#2#3% - {\gdef\TABLEhead{\getvalue{@@TABLEhead#2}}% - \gdef\TABLEtail{\getvalue{@@TABLEtail#3}}% - \complexsecondstagestartTABLE[#1]} +\def\dousetabletemplate#1#2#3% + {\gdef\dotablehead{\getvalue{@@tablehead#2}}% + \gdef\dotabletail{\getvalue{@@tabletail#3}}% + \secondstagestarttable[#1]} %D The optional third and fourth arguments define which table %D head and tail to use. @@ -1085,69 +1468,70 @@ %D The second half of the next macro prepares table %D splitting. -\def\insertTABLEhead - {\TABLEnoalign{\global\settrue \preventTABLEbreak \global\setfalse\someTABLEhead}% - \TABLEhead - \TABLEnoalign{\global\setfalse\preventTABLEbreak}} - -\def\insertTABLEtail - {\TABLEnoalign{\global\settrue \preventTABLEbreak \global\setfalse\someTABLEtail}% - \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 +\def\doinserttablehead + {\starttablenoalign + \global\settrue\preventtablebreak + \global\setfalse\hassometablehead + \stoptablenoalign + \dotablehead + \starttablenoalign + \global\setfalse\preventtablebreak + \stoptablenoalign} + +\def\doinserttabletail + {\starttablenoalign + \global\settrue\preventtablebreak + \global\setfalse\hassometabletail + \stoptablenoalign + \dotabletail + \starttablenoalign + \global\setfalse\preventtablebreak + \stoptablenoalign} + +% \def\doverysimpletableHL % todo +% {\starttablenoalign +% \expandafter\donormaltablefullrule\@@tiHLheight +% \stoptablenoalign} + +\def\dorestarttable#1% + {\gdef\restarttable{#1}% + \restarttable +% \starttablenoalign +% \globalpushmacro\simpletableHL +% \global\let\simpletableHL\doverysimpletableHL +% \stoptablenoalign + \doinserttablehead \ifsplittables \ifconditional \tablerepeattail - \TABLEnoalign{\goodbreak}% - \insertTABLEtail - \TABLEnoalign{\goodbreak}% + \tablenoalign{\goodbreak}% + \doinserttabletail + \tablenoalign{\goodbreak}% \fi \fi - \TABLEnoalign{\globalpopmacro\simpleTableHL}} +% \starttablenoalign +% \globalpopmacro\simpletableHL +% \stoptablenoalign + } -\bgroup \catcode`|=\@@other \catcode`"=\@@other +\bgroup \catcode\barasciicode\othercatcode -\gdef\complexsecondstagestartTABLE#1[#2]% brr nested mess +\gdef\secondstagestarttable[#1]% brr nested mess {\bgroup \@@useotherbar - \@@useotherquote - \global\setfalse\someTABLEhead - \global\setfalse\someTABLEtail - \expanded{\doifinstringelse{|}{#2}} - {\xdef\restartTABLE{\noexpand\dorestartTABLE{\noexpand\thirdstagestartTABLE{#2}}}} - {\doifdefinedelse{\c!Table#2} - {\gdef\restartTABLE{\getvalue{\c!Table#2}}} - {\gdef\restartTABLE{\dorestartTABLE{\getvalue{#2}}}}}% + \global\setfalse\tableactionstatepermitted + \global\setfalse\hassometablehead + \global\setfalse\hassometabletail + \expanded{\doifinstringelse{|}{#1}} + {\xdef\restarttable{\noexpand\dorestarttable{\noexpand\thirdstagestarttable{#1}}}} + {\doifdefinedelse{\s!TaBlE#1} + {\gdef\restarttable{\getvalue{\s!TaBlE#1}}} + {\gdef\restarttable{\dorestartable{\getvalue{#1}}}}}% \egroup - \restartTABLE} + \restarttable} \egroup %D The third stage involves a lot of (re)sets, which we will %D explain later. -%D The next definition is convenient and more in tune with -%D \CONTEXT. - -\let \everytable \EveryTable - -%D We immediately use this register: - \appendtoks \fixedspaces \let\_\normalunderscore @@ -1155,39 +1539,27 @@ %D Now we can start the table. -\def\thirdstagestartTABLE#1% - {\global\setTABLEactiontrue - \setTABLEaction\TABLEunknown - \setTABLEforce\TABLEunknown - \setTABLEerror\TABLEunknown - \global\TABLEgraylinefalse - \global\TABLEgraydonefalse - \globalletempty\TABLEgrayline - \globalletempty\nextTABLEgrayline - \globalletempty\TABLEgraylineerror - \globalletempty\TABLEgraylinestatus - \resetVLvalues - \appendtoks\popouterbarandquote\to\EveryTable - \appendtoks\localTABLEsetup\to\EveryTable - \BeginTable[\ifsplittables u\else b\fi]% - \defineTABLEunits - \defineTABLEsteps - \defineTABLErules - \defineTABLEdivisions - \defineTABLEshorthands - \defineTABLEbackgrounds - \defineTABLEendings +\newtoks \localtabledefinitions + +\def\thirdstagestarttable#1% + {\global\settrue\tableactionstatepermitted + \dosettableaction\tableunknownstate + \dosettableforce\tableunknownstate + \dotableresetVLvalues + \appendtoks\dolocaltablesetup\to\everytable + \dotablestandardbegin[\ifsplittables u\else b\fi]% + \the\localtabledefinitions \forgetall % added - \doifsomething{#1} - {\def\TABLEformat{#1}% - \getTABLEnofcolumns\TABLEformat + \edef\currenttableformat{#1}% + \doifsomething\currenttableformat + {\dogettablenofcolumns\currenttableformat % more modern is to use catcode tables - \expandafter\BeginFormat\TABLEformat\EndFormat}} + \expandafter\dobegintableformat\currenttableformat\doendtableformat}} -\def\finishTABLE - {\chuckTABLEautorow +\def\dofinishtable + {\dochucktableautorow \unskip\crcr - \EndTable + \dotablenormalend \global\intablefalse \egroup} @@ -1224,33 +1596,30 @@ \flushnotes \setbox\tablecontentbox\vbox\bgroup \forgetall - \global\TABLEinbreakfalse - \firststagestartTABLE} + \firststagestarttable} \let\stoptables\relax % needed for \noalign \def\dostoptables - {\chuckTABLEautorow % AM: before the tail, else noalign problem - \ifconditional\tablerepeattail\else\insertTABLEtail\fi - \finishTABLE + {\dochucktableautorow % AM: before the tail, else noalign problem + \ifconditional\tablerepeattail\else\doinserttabletail\fi + \dofinishtable \egroup \dontcomplain \dosplittablebox\tablecontentbox \flushnotes \egroup} -\newdimen\TABLEcaptionheight % obsolete - \def\dosplittablebox#1% {\resettsplit \def\tsplitminimumfreelines{2}% - \def\tsplitminimumfreespace{\TABLEcaptionheight}% + \def\tsplitminimumfreespace{\zeropoint}% \setbox\tsplitcontent\box#1% - \ifconditional\tablerepeathead \ifconditional\someTABLEhead + \ifconditional\tablerepeathead \ifconditional\hassometablehead \setbox\tsplithead\vsplit\tsplitcontent to \lineheight \setbox\tsplithead\vbox{\unvbox\tsplithead}% \fi \fi - \ifconditional\tablerepeattail \ifconditional\someTABLEtail + \ifconditional\tablerepeattail \ifconditional\hassometabletail \setbox\tsplittail\vsplit\tsplitcontent to \lineheight \setbox\tsplittail\vbox{\unvbox\tsplittail}% \fi \fi @@ -1265,15 +1634,15 @@ %D something like: %D %D \starttyping -%D \starttablekop +%D \starttablehead %D \HL %D \VL element \VL atom weight \VL\AR %D \HL -%D \stoptablekop +%D \stoptablehead %D -%D \starttablestaart +%D \starttabletail %D \HL -%D \stoptablestaart +%D \stoptabletail %D %D \starttables[|||] %D \VL ....... \VL ........... \VL\AR @@ -1288,113 +1657,52 @@ %D the fact that the stopcondition is interface language %D dependant. -\let\@@TABLEhead\empty \def\TABLEhead{\@@TABLEhead} -\let\@@TABLEtail\empty \def\TABLEtail{\@@TABLEtail} +\let\dotablehead\empty % needs checking +\let\dotabletail\empty % needs checking -\letvalue{\e!start\v!tablehead}=\undefined -\letvalue{\e!stop \v!tablehead}=\undefined -\letvalue{\e!start\v!tabletail}=\undefined -\letvalue{\e!stop \v!tabletail}=\undefined +\letbeundefined{\e!start\v!tablehead} +\letbeundefined{\e!stop \v!tablehead} +\letbeundefined{\e!start\v!tabletail} +\letbeundefined{\e!stop \v!tabletail} \expanded {\long\def\csname\e!start\v!tablehead\endcsname##1\csname\e!stop\v!tablehead\endcsname% - {\noexpand\setTABLEhead##1\noexpand\end}} + {\noexpand\settablehead##1\noexpand\end}} \expanded {\long\def\csname\e!start\v!tabletail\endcsname##1\csname\e!stop\v!tabletail\endcsname% - {\noexpand\setTABLEtail##1\noexpand\end}} + {\noexpand\settabletail##1\noexpand\end}} %D The second argument is a dummy one, by scanning for it, we %D get rid of interfering spaces. -\def\setTABLEhead{\dodoubleempty\dosetTABLEhead} -\def\setTABLEtail{\dodoubleempty\dosetTABLEtail} +\newconditional\preventtablebreak +\newconditional\hassometablehead +\newconditional\hassometabletail -\newconditional\preventTABLEbreak -\newconditional\someTABLEhead +\def\settablehead{\dodoubleempty\dosettablehead} +\def\settabletail{\dodoubleempty\dosettabletail} -\long\def\dosetTABLEhead[#1][#2]#3\end{\setvalue{@@TABLEhead#1}{\TABLEnoalign{\global\settrue\someTABLEhead}#3}} -\long\def\dosetTABLEtail[#1][#2]#3\end{\setvalue{@@TABLEtail#1}{\TABLEnoalign{\global\settrue\someTABLEtail}#3}} +\long\def\dosettablehead[#1][#2]#3\end{\setvalue{@@tablehead#1}{\tablenoalign{\global\settrue\hassometablehead}#3}} +\long\def\dosettabletail[#1][#2]#3\end{\setvalue{@@tabletail#1}{\tablenoalign{\global\settrue\hassometabletail}#3}} %D Redudant \type{\HL}'s are removed automatically, so %D mid||lines can be used without problems. -%D We need an alternative for the normal complex or simple -%D commands, because assignments in these system commands -%D conflict with \type{\noalign}. This alternative is about -%D as efficient as possible. - -\def\complexorsimpleTable#1#2% - {\csname\if[\noexpand#2\s!complex\else\s!simple\fi\c!Table#1\endcsname#2} - -%D The next one is used in \type{\VL} cum suis and honours -%D the next grouping. - -\def\docomplexorsimpleTable#1#2% - {\ifx\next\bgroup\@EA#2\else\@EA\dodocomplexorsimpleTable\@EA#1\@EA#2\fi} - -\def\dodocomplexorsimpleTable#1#2#3% - {\if[\noexpand#3\@EA#1\else\@EA#2\fi#3} - %D The order of the next macros is more or less random. First %D we implement error recovery. Errors are reported to the %D screen and log file as well as visualized in the table in %D teletype. -\def\handleTABLEerror - {\ifTABLEgrayline \else - \ifnum\TABLEerror=\TABLEunknown \else - \setTABLEaction\TABLEunknown - \globalletempty\checkTABLEautorow - \globalletempty\chuckTABLEautorow - \fi - \ifcase\TABLEerror - % no error - \or - % \TABLEmissingrow - \tttf [missing row]% - \writestatus\m!TABLE{missing row}% - \SR - \or - % \TABLEmissingcolumn - \fillTABLEcolumns - \tttf [missing column]% - \writestatus\m!TABLE{missing column}% - \SR - \or - % \TABLEspanoverflow - \fillTABLEcolumns - \tttf [columnspan too large]% - \writestatus\m!TABLE{columnspan too large}% - \SR - \or - % \TABLEdivisionoverflow - \fillTABLEcolumns - \tttf [division line too long]% - \writestatus\m!TABLE{division line too long}% - \SR - \fi - \fi - \ifnum\TABLEerror=\TABLEunknown \else - \finishTABLErow - \fi} - -\def\finishTABLErow +\def\dofinishtablerow {\crcr - \TABLEnoalign - {\nobreak - \setTABLEaction\TABLEunknown - \setTABLEerror\TABLEunknown - \globalletempty\checkTABLEautorow - \globalletempty\chuckTABLEautorow - \global\currentTABLEcolumn\zerocount}} - -\def\fillTABLEcolumns - {\ifnum\currentTABLEcolumn>\maxTABLEcolumn \else - \global\advance\currentTABLEcolumn \plusone - \normalTABLEquote - \expandafter\fillTABLEcolumns - \fi} + \starttablenoalign + \nobreak + \dosettableaction\tableunknownstate + \globalletempty\dochecktableautorow + \globalletempty\dochucktableautorow + \global\currenttablecolumn\zerocount + \stoptablenoalign} %D Next we enter the more complicated area of column and row %D switching. I won't go into much detail from now on, but just @@ -1439,72 +1747,47 @@ %D handles alignments, we cannot automate spacing for colored %D rows and columns. -\chardef\TABLErowzero=0 - -\def\checkTABLErow#1% pure for message purposes - {\unskip % added - \ifTABLEgraydone - \defconvertedargument\asciia{#1}% - \defconvertedcommand \asciib\TABLEendBCL - \ifx\asciia\asciib \else - \writestatus\m!TABLE{confusing \asciia\space and \asciib}% - \gdef\TABLEgraylineerror% - {\globalletempty\TABLEgraylineerror - [\asciia\unskip<->\asciib\unskip]}% - \fi - \global\TABLEgraydonefalse - \fi} +\setnewconstant\tablerowzero\zerocount -\unexpanded\def\defineTABLEendings - {\let\SR\TableSR - \let\FR\TableFR - \let\MR\TableMR - \let\LR\TableLR - \let\AR\TableAR} - -\def\TableSR - {\ifTABLEgrayline \else - \ifnum\TABLEaction=\TABLEfirstrow - \writestatus\m!TABLE{change \string\SR\space into \string\MR/\string\LR}% - \else\ifnum\TABLEaction=\TABLEmidrow - \writestatus\m!TABLE{change \string\SR\space into \string\MR/\string\LR}% - \else\ifnum\TABLEaction=\TABLEmidrow - \writestatus\m!TABLE{change \string\SR\space into \string\MR/\string\LR}% - \fi\fi\fi - \fi - \checkTABLErow\SR - \endTABLErow\TABLEseparaterow\TABLErowfactor\TABLErowfactor} - -\def\TableFR - {\ifTABLEgrayline \else - \ifnum\TABLEaction=\TABLEmidrow - \writestatus\m!TABLE{change \string\FR\space into \string\MR/\string\LR}% - \else\ifnum\TABLEaction=\TABLElastrow - \writestatus\m!TABLE{change \string\FR\space into \string\MR/\string\LR}% - \fi\fi - \fi - \checkTABLErow\FR - \endTABLErow\TABLEfirstrow\TABLErowfactor\TABLErowzero} - -\def\TableMR - {\ifTABLEgrayline \else - \ifnum\TABLEaction=\TABLErule - \writestatus\m!TABLE{change \string\MR\space into \string\FR/\string\SR}% - \else\ifnum\TABLEaction=\TABLElastrow - \writestatus\m!TABLE{change \string\MR\space into \string\FR}% - \fi\fi - \fi - \checkTABLErow\MR - \endTABLErow\TABLEmidrow00} +\appendtoks + \let\SR\dotableSR + \let\FR\dotableFR + \let\MR\dotableMR + \let\LR\dotableLR + \let\AR\dotableAR +\to \localtabledefinitions + +\unexpanded\def\dotableSR + {\ifnum\tableactionstate=\tablefirstrowstate + \writestatus\m!TABLE{change \string\SR\space into \string\MR/\string\LR}% + \else\ifnum\tableactionstate=\tablemidrowstate + \writestatus\m!TABLE{change \string\SR\space into \string\MR/\string\LR}% + \else\ifnum\tableactionstate=\tablemidrowstate + \writestatus\m!TABLE{change \string\SR\space into \string\MR/\string\LR}% + \fi\fi\fi + \doendtablerow\tableseparaterowstate\tablerowfactor\tablerowfactor} + +\unexpanded\def\dotableFR + {\ifnum\tableactionstate=\tablemidrowstate + \writestatus\m!TABLE{change \string\FR\space into \string\MR/\string\LR}% + \else\ifnum\tableactionstate=\tablelastrowstate + \writestatus\m!TABLE{change \string\FR\space into \string\MR/\string\LR}% + \fi\fi + \doendtablerow\tablefirstrowstate\tablerowfactor\tablerowzero} -\def\TableLR - {\ifTABLEgrayline \else - \ifnum\TABLEaction=\TABLErule - \writestatus\m!TABLE{change \string\LR\space into \string\FR/\string\SR}% - \fi +\unexpanded\def\dotableMR + {\ifnum\tableactionstate=\tablerulestate + \writestatus\m!TABLE{change \string\MR\space into \string\FR/\string\SR}% + \else\ifnum\tableactionstate=\tablelastrowstate + \writestatus\m!TABLE{change \string\MR\space into \string\FR}% + \fi\fi + \doendtablerow\tablemidrowstate00} + +\unexpanded\def\dotableLR + {\ifnum\tableactionstate=\tablerulestate + \writestatus\m!TABLE{change \string\LR\space into \string\FR/\string\SR}% \fi - \checkTABLErow\LR - \endTABLErow\TABLElastrow\TABLErowzero\TABLErowfactor} + \doendtablerow\tablelastrowstate\tablerowzero\tablerowfactor} %D \macros %D {ifcheckTABLEcolums} @@ -1517,122 +1800,69 @@ %D determine the available space are shown (in color). By default %D checking is off. -\newif\ifcheckTABLEcolumns - -\let\beforeTABLEline\empty -\let\afterTABLEline \empty - -\def\doendTABLErow#1#2#3% - {\handleTABLEbreak#2#3% - \beforeTABLEline +\def\doendtablerow#1#2#3% + {\dosettableaction#1% \ifcase#1\relax % unknown \or - \endofTABLEline[blue][\SR->\SR]\TABLErowfactor\TABLErowfactor - \or - \endofTABLEline[red][\FR->\FR]\TABLErowfactor\TABLErowzero + \doendoftableline\SR\SR\tablerowfactor\tablerowfactor \or - \ifnum\TABLEforce=\TABLEforcelastrow - \endofTABLEline[red][\MR->\LR]\TABLErowzero\TABLErowfactor - \else\ifnum\TABLEforce=\TABLEforcefirstrow - \endofTABLEline[red][\MR->\FR]\TABLErowfactor\TABLErowzero - \else - \endofTABLEline[green][\MR->\MR]\TABLErowzero\TABLErowzero - \fi\fi - \or - \endofTABLEline[red][\LR->\LR]\TABLErowzero\TABLErowfactor - \fi - \TABLEnoalign - {\setTABLEforce\TABLEunknown - \global\currentTABLEcolumn\zerocount}% - \afterTABLEline} - -\def\endTABLErow#1#2#3% - {\setTABLEaction#1% - \ifTABLEgrayline - \finishTABLErow + \doendoftableline\FR\FR\tablerowfactor\tablerowzero + \or\ifnum\tableforcestate=\tableforcelastrowstate + \doendoftableline\MR\LR\tablerowzero\tablerowfactor + \else\ifnum\tableforcestate=\tableforcefirstrowstate + \doendoftableline\MR\FR\tablerowfactor\tablerowzero \else - \ifnum\currentTABLEcolumn>\maxTABLEcolumn - \doendTABLErow{#1}{#2}{#3}% - \else\ifcheckTABLEcolumns - \setTABLEerror\TABLEmissingcolumn - \handleTABLEerror + \doendoftableline\MR\MR\tablerowzero\tablerowzero + \fi\fi\or + \doendoftableline\LR\LR\tablerowzero\tablerowfactor + \fi + \starttablenoalign + \dosettableforce\tableunknownstate + \global\currenttablecolumn\zerocount + \ifconditional\preventtablebreak + \nobreak \else - \doendTABLErow{#1}{#2}{#3}% - \fi\fi - \fi} + \goodbreak + \fi + \stoptablenoalign} %D Handling \type{\AR} is postponed till the next row. The %D check takes care of the first and mid rows, the chuck macro %D |<|how about that name|>| handles the last row. -\def\TableAR - {\ifTABLEgraydone - \globalletempty\checkTABLEautorow - \globalletempty\chuckTABLEautorow - \global\TABLEgraydonefalse - \TABLEendBCL - \else - \globallet\checkTABLEautorow\docheckTABLEautorow - \globallet\chuckTABLEautorow\dochuckTABLEautorow - \fi} +\unexpanded\def\dotableAR + {\globallet\dochecktableautorow\dodochecktableautorow + \globallet\dochucktableautorow\dodochucktableautorow} -\let\checkTABLEautorow\empty -\let\chuckTABLEautorow\empty +\let\dochecktableautorow\empty +\let\dochucktableautorow\empty -\def\docheckTABLEautorow - {\globallet\checkTABLEautorow\empty - \ifnum\TABLEaction=\TABLErule \FR - \else\ifnum\TABLEaction=\TABLEunknown \FR - \else \MR - \fi\fi} +\def\dodochecktableautorow + {\globallet\dochecktableautorow\empty + \ifnum\tableactionstate=\tablerulestate \FR\else + \ifnum\tableactionstate=\tableunknownstate\FR\else + \MR\fi\fi} + +\def\dodochucktableautorow + {\globalletempty\dochecktableautorow + \globalletempty\dochucktableautorow + \ifnum\tableactionstate=\tablerulestate \SR\else + \ifnum\tableactionstate=\tableunknownstate\SR\else + \LR\fi\fi} -\def\dochuckTABLEautorow - {\globalletempty\checkTABLEautorow - \globalletempty\chuckTABLEautorow - \ifnum\TABLEaction=\TABLErule \SR - \else\ifnum\TABLEaction=\TABLEunknown \SR - \else \LR - \fi\fi} - %D When a table is split, we also add a tail and when present %D we repeat the table head. -\def\handleTABLEbreak#1#2% - {\globalletempty\beforeTABLEline - \gdef\afterTABLEline{\TABLEnoalign{\ifconditional\preventTABLEbreak\nobreak\else\goodbreak\fi}}} - %D When tables are split, the spacing before and after a %D horizontal rule is corrected according to what we expect. -\def\endofTABLEline[#1][#2->#3]#4#5% - {\ifx#2#3\else - \writestatus\m!TABLE{\string#2\space changed into \string#3}% +\def\doendoftableline#1#2#3#4% + {\ifx#1#2\else + \writestatus\m!TABLE{\string#1\space changed into \string#2}% \fi - \iftracetables - \bgroup - \tttf\space - \ifnum\TABLEerror=\TABLEunknown - \ifx#2#3\else\string#2->\fi - \else - ->% - \fi - \color[#1]{\string#3}% - \ifx\TABLEgraylineerror\empty - \space\TABLEgraylinestatus - \else - \space\TABLEgraylineerror - \fi - \egroup - \else\ifx\TABLEgraylineerror\empty \else - % \bgroup - % \tttf\space\TABLEgraylineerror - % \egroup - \fi\fi - \globalletempty\TABLEgraylinestatus - \globalletempty\TABLEgraylineerror - \expandafter\normalTABLElineformat#4#5\crcr % \crcr nodig ? - \TABLEnoalign{\nobreak\global\setTABLEactiontrue}} + \expandafter\donormaltablelineformat#3#4\crcr % \crcr nodig ? + \tablenoalign{\nobreak\global\settrue\tableactionstatepermitted}} %D In order to prevent (as good as possible) alignment overflow %D and therefore \TEX\ error messages, we check the maximum @@ -1641,8 +1871,7 @@ %D the number of \type{|}'s and \type{\VL}'s or alike is always %D one more than the number of columns. -\newcount\currentTABLEcolumn -\newcount\maxTABLEcolumn +\newcount\currenttablecolumn %D While defining this macro we change the \CATCODE\ of %D \type{|}. When counting the bars, we use a non active @@ -1651,43 +1880,20 @@ %D \TABLE\ changes the catcode when needed.} \bgroup - \catcode`\|=\@@other \gdef\@@otherbar {|} - \catcode`\"=\@@other \gdef\@@otherquote {"} - \catcode`\|=\@@active \gdef\@@useotherbar {\let|\@@otherbar} - \catcode`\"=\@@active \gdef\@@useotherquote{\let"\@@otherquote} + \catcode\barasciicode\othercatcode \gdef\@@otherbar {|} + \catcode\barasciicode\activecatcode \gdef\@@useotherbar {\let|\@@otherbar} \egroup -\bgroup \catcode`\|=\@@other +\bgroup \catcode\barasciicode\othercatcode -\gdef\getTABLEnofcolumns#1% +\gdef\dogettablenofcolumns#1% todo: also divert this to lua as with tabulate {\bgroup \cleanupfeatures % needed ! \@@useotherbar - \@@useotherquote - \expanded{\defconvertedargument\noexpand\ascii{#1}}% - \@EA\doglobal\@EA\counttoken\@EA|\@EA\in\ascii\to\maxTABLEcolumn - \global\advance\maxTABLEcolumn \minusone - % in case of & counting, divide by 2 \egroup} \egroup -\def\!ttDoHalign - {\edef\restoretablelineskips - {\baselineskip \the\baselineskip - \lineskiplimit\the\lineskiplimit - \lineskip \the\lineskip - \tabskip \the\tabskip}% - \baselineskip \zeropoint - \lineskiplimit\zeropoint - \lineskip \zeropoint - \tabskip \zeropoint - % does not work in normal tex - % \expanded{\getTABLEnofcolumns{\the\!taPreamble}}% added - \halign \the\!taTableSpread \bgroup - \span\the\!taPreamble - \ifx \!tfRowOfWidths \empty \else \!tfRowOfWidths \cr \fi} - %D \startitemize[3*ruim] %D \sym{\type{\VL}} a vertical line %D \sym{\type{\VC}} a vertical colored line @@ -1695,56 +1901,46 @@ %D \sym{\type{\HC}} a horizontal colored line %D \stopitemize -% \unexpanded\def\defineTABLErules -% {\let\VL\TableVL -% \let\VC\TableVC -% \let\HL\TableHL -% \let\HC\TableHC} - -\unexpanded\def\defineTABLErules - {\let\VL\TableVL - \let\VC\TableVC - \let\HL\TableHL - \let\HC\TableHC - \let\VS\TableVS - \let\VD\TableVD - \let\VT\TableVT - \let\VN\TableVN} - -\def\TableVL - {\checkTABLEautorow - \nextTABLEgrayline - \ifnum\currentTABLEcolumn>\maxTABLEcolumn - \setTABLEerror\TABLEmissingrow - \handleTABLEerror - \else - \global\advance\currentTABLEcolumn \plusone - \expandafter\doTableVL - \fi} +\newcount\tablevrulethicknessfactor +\newcount\tablehrulethicknessfactor +\newcount\tabledrulespan +\let \tablecurrentvrulecolor \empty +\let \tablecurrenthrulecolor \empty + +\appendtoks + \let\VL\dotableVL + \let\VC\dotableVC + \let\HL\dotableHL + \let\HC\dotableHC + \let\VS\dotableVS + \let\VD\dotableVD + \let\VT\dotableVT + \let\VN\dotableVN +\to \localtabledefinitions + +\def\dotableresetVLvalues + {\global\currenttablecolumn\zerocount} + +\def\dotablevrulecommand#1% global assignments + {\doifnumberelse{#1} + {\global\tablevrulethicknessfactor#1\relax + \global\multiply\tablevrulethicknessfactor\@@tiVLwidth\relax} + {\xdef\tablecurrentvrulecolor{#1}}} + +\unexpanded\def\dotableVL + {\dochecktableautorow + \global\advance\currenttablecolumn\plusone + \dosingleempty\dodotableVL} + +\def\dodotableVL[#1]% + {\global\let\tablecurrentvrulecolor\empty + \global\tablevrulethicknessfactor\@@tiVLwidth\relax + \iffirstargument + \rawprocesscommalist[#1]\dotablevrulecommand + \fi + \donormaltablecomplexbar}% \relax breaks \use -\def\doTableVL - {\futurelet\next\dodoTableVL} - -\def\dodoTableVL - {\docomplexorsimpleTable\complexTableVL\simpleTableVL} - -\def\complexTableVL[#1]% - {\scratchcounter=0#1% - \multiply\scratchcounter \@@tiVLwidth - \setxvalue{wVL\the\currentTABLEcolumn}{\the\scratchcounter}% - \simpleTableVL} - -\def\simpleTableVL - {\doifundefined{wVL\the\currentTABLEcolumn}% - {\setgvalue{wVL\the\currentTABLEcolumn}{\@@tiVLwidth}}% - \gdef\TABLEbeforebar - {\getvalue{bVL\the\currentTABLEcolumn}% - \letgvalueempty{bVL\the\currentTABLEcolumn}}% - \gdef\TABLEafterbar - {\getvalue{eVL\the\currentTABLEcolumn}% - \letgvalueempty{eVL\the\currentTABLEcolumn}}% - \edef\@@tiVLwidth{\getvalue{wVL\the\currentTABLEcolumn}}% - \expanded{\normalTABLEcomplexbar\@@tiVLwidth\space}}% \relax breaks \use +\let\dotableVC\dotableVL % for mojca % \starttable[|||] % \HL @@ -1754,106 +1950,51 @@ % \HL % \stoptable -\def\TableVS {\VN1} -\def\TableVD {\VN2} -\def\TableVT {\VN3} -\def\TableVN#1{\gdef\@VLn{#1}\VL} - -\def\resetVLvalues - {\dostepwiserecurse\zerocount\maxTABLEcolumn\plusone - {\setgvalue{wVL\recurselevel}{\@@tiVLwidth}% - \letgvalueempty{bVL\recurselevel}% - \letgvalueempty{eVL\recurselevel}}% - \global\currentTABLEcolumn\zerocount} - -\def\TableVC - {\checkTABLEautorow - \nextTABLEgrayline - \ifnum\currentTABLEcolumn>\maxTABLEcolumn - \setTABLEerror\TABLEmissingrow - \handleTABLEerror - \else - \global\advance\currentTABLEcolumn \plusone - \expandafter\doTableVC - \fi} - -\def\doTableVC - {\futurelet\next\dodoTableVC} - -\def\dodoTableVC - {\docomplexorsimpleTable\complexTableVC\simpleTableVC} - -\def\complexTableVC[#1]% - {\global\setvalue{bVC\the\currentTABLEcolumn}{\startcolor[#1]}% - \global\setvalue{eVC\the\currentTABLEcolumn}{\stopcolor}% - \simpleTableVC} - -\def\simpleTableVC - {\global\setvalue{bVL\the\currentTABLEcolumn}% - {\getvalue{bVC\the\currentTABLEcolumn}}% - \global\setvalue{eVL\the\currentTABLEcolumn}% - {\getvalue{eVC\the\currentTABLEcolumn}}% - \doTableVL} - -\def\TableHL - {\ifnum\currentTABLEcolumn>\maxTABLEcolumn - \chuckTABLEautorow - \else\ifnum\currentTABLEcolumn=\zerocount - %\chuckTABLEautorow - \TABLEnoalign - {\globalletempty\checkTABLEautorow - \globalletempty\chuckTABLEautorow}% +\unexpanded\def\dotableVS {\VN1} +\unexpanded\def\dotableVD {\VN2} +\unexpanded\def\dotableVT {\VN3} +\unexpanded\def\dotableVN#1{\global\noftablevrules#1\relax\VL} + +\def\dotablehrulecommand#1% global assignments + {\doifnumberelse{#1} + {\global\tablehrulethicknessfactor#1\relax + \global\multiply\tablehrulethicknessfactor\@@tiHLheight\relax} + {\xdef\tablecurrenthrulecolor{#1}}} + +\unexpanded\def\dotableHL + {\dochucktableautorow + \dofinishtablerow + \starttablenoalign + \dosingleempty\dodotableHL} + +\def\dodotableHL[#1]% + {\nobreak + \ifnum\tableactionstate=\tablerulestate + \writestatus\m!TABLE{skipping \string\HL}% \statusmessage \else - \setTABLEerror\TABLEmissingcolumn - \handleTABLEerror - \fi\fi - \complexorsimpleTable{HL}} - -\def\complexTableHL[#1]% - {\TABLEnoalign - {\scratchcounter0#1% - \multiply\scratchcounter \@@tiHLheight - \edef\@@tiHLheight{\the\scratchcounter}% - \simpleTableHL}} - -\def\simpleTableHL - {\TABLEnoalign - {\nobreak - \ifnum\TABLEaction=\TABLErule - \writestatus\m!TABLE{skipping \string\HL}% \statusmessage - \else - \ifnum\TABLEaction=\TABLEmidrow - \writestatus\m!TABLE{change \string\MR\space into \string\LR/\string\SR}% - \else\ifnum\TABLEaction=\TABLEfirstrow - \writestatus\m!TABLE{change \string\MR\space into \string\SR}% - \fi\fi - \startHLcommand - \expandafter\normalTABLEfullrule\@@tiHLheight - \stopHLcommand - \globalletempty\startHLcommand - \globalletempty\stopHLcommand - \accountTABLElinewidth - \fi - \setTABLEaction\TABLErule - \nobreak}} - -\let\startHLcommand\empty -\let\stopHLcommand \empty - -\def\TableHC - {\complexorsimpleTable{HC}} - -\def\complexTableHC[#1]% - {\TABLEnoalign - {\gdef\startHCcommand{\startcolor[#1]}% - \gdef\stopHCcommand {\stopcolor}}% - \simpleTableHC} + \ifnum\tableactionstate=\tablemidrowstate + \writestatus\m!TABLE{change \string\MR\space into \string\LR/\string\SR}% + \else\ifnum\tableactionstate=\tablefirstrowstate + \writestatus\m!TABLE{change \string\MR\space into \string\SR}% + \fi\fi + \bgroup + \global\tablehrulethicknessfactor\@@tiHLheight\relax + \iffirstargument + \global\let\tablecurrenthrulecolor\empty + \rawprocesscommalist[#1]\dotablehrulecommand + \ifx\tablecurrenthrulecolor\empty\else + \switchtocolor[\tablecurrenthrulecolor]% + \fi + \fi + \donormaltablefullrule + \egroup + \doaccounttablelinewidth + \fi + \dosettableaction\tablerulestate + \nobreak + \stoptablenoalign} -\def\simpleTableHC - {\TABLEnoalign - {\globallet\startHLcommand\startHCcommand - \globallet\stopHLcommand \stopHCcommand}% - \HL} +\let\dotableHC\dotableHL % for mojca %D \startitemize[3*ruim] %D \sym{\type{\NL}} a vertical skip @@ -1864,508 +2005,177 @@ %D \sym{\type{\LC}} a last column %D \stopitemize -% n+1 uitleggen - -\unexpanded\def\defineTABLEsteps - {\let\NL\TableNL - \let\NR\TableNR - \let\NC\TableNC - \let\FC\TableNC - \let\MC\TableNC - \let\LC\TableNC} - -\def\TableNL - {\complexorsimpleTable{NL}} - -\def\complexTableNL[#1]% - {\TABLEnoalign - {\edef\@@tiNL{#1}% - \simpleTableNL}}% - -\def\simpleTableNL - {\TABLEnoalign - {\nobreak - \setbox0\vbox{\blank[\@@tiNL]}% - \vskip\ht0 - \nobreak}} - -\def\TableNR - {\ifnum\currentTABLEcolumn>\maxTABLEcolumn - \global\currentTABLEcolumn\zerocount - \normalTABLElineending - \else - \setTABLEerror\TABLEmissingcolumn - \handleTABLEerror - \fi - \TABLEnoalign - {\nobreak - \setTABLEaction\TABLEunknown}} - -\def\TableNC - {\checkTABLEautorow - \nextTABLEgrayline - \ifnum\currentTABLEcolumn>\maxTABLEcolumn - \setTABLEerror\TABLEmissingrow - \handleTABLEerror - \else - \global\advance\currentTABLEcolumn \plusone - \normalTABLEquote - \fi} +% \starttable[|||] +% \VL text \VL text \VL \AR +% \TB[small] +% \VL text \VL text \VL \AR +% \TB[4*big] +% \VL text \VL text \VL \AR +% \stoptable -% \bgroup -% \catcode`\|=\@@active -% \catcode`\"=\@@active -% \gdef\redefinetablebarandquote -% {\def|{\VL}% % \normalTABLEsimplebar -% \def\|##1{\VL[##1]}% % \normalTABLEcomplexbar -% \def"{\NC}} % \normalTABLEquote -% \egroup +% n+1 uitleggen -\let\redefinetablebarandquote\relax +\appendtoks + \let\TB\dotableTB + \let\NL\dotableNL % old + \let\NR\dotableNR + \let\NC\dotableNC + \let\FC\dotableNC + \let\MC\dotableNC + \let\LC\dotableNC +\to \localtabledefinitions + +\unexpanded\def\dotableTB + {\dochucktableautorow + \dofinishtablerow + \starttablenoalign + \dosingleempty\dotableTB} + +\def\dotableTB[#1]% + {\blank[\iffirstargument#1\else\@@tiNL\fi]% + \nobreak + \stoptablenoalign} + +\let\dotableNL\dotableTB + +\unexpanded\def\dotableNR + {\global\currenttablecolumn\zerocount + \donormaltablelineending + \starttablenoalign + \nobreak + \dosettableaction\tableunknownstate + \stoptablenoalign} + +\unexpanded\def\dotableNC + {\dochecktableautorow + \global\advance\currenttablecolumn \plusone + \donormaltablenobar} -%D \startitemize[3*ruim] +%D \startitemize[3*broad] %D \sym{\type{\DL}} %D \sym{\type{\DV}} (\type{\VD}) %D \sym{\type{\DC}} %D \sym{\type{\DR}} %D \stopitemize -\newif\ifTABLEdivision - -% \unexpanded\def\defineTABLEdivisions -% {\global\TABLEdivisionfalse % in start -% \let\DL\TableDL -% \let\DC\TableDC -% \let\DV\TableDV -% \let\VD\TableDV -% \let\DR\TableDR} - -\unexpanded\def\defineTABLEdivisions - {\global\TABLEdivisionfalse % in start - \let\DL\TableDL - \let\DC\TableDC - \let\DV\TableDV - \let\DR\TableDR} - -\def\checkTABLEdivision - {\ifTABLEdivision \else - \chuckTABLEautorow - \global\currentTABLEcolumn\zerocount - \global\TABLEdivisiontrue +\newconditional\istabledivision + +\appendtoks + \global\setfalse\istabledivision + \let\DL\dotableDL + \let\DC\dotableDC + \let\DV\dotableDV + \let\DR\dotableDR +\to \localtabledefinitions + +\def\dochecktabledivision + {\ifconditional\istabledivision\else + \dochucktableautorow + \global\currenttablecolumn\zerocount + \global\settrue\istabledivision \fi} -\def\TableDL - {\checkTABLEdivision - \complexorsimpleTable{DL}} +\def\dotabledrulecommand#1% global assignments + {\doifnumberelse{#1} + {\ifcase\tabledrulespan + \global\tabledrulespan#1\relax + \else + \global\tablehrulethicknessfactor#1\relax + \global\multiply\tablehrulethicknessfactor\@@tiVLwidth\relax + \fi} + {\xdef\tablecurrenthrulecolor{#1}}} -\def\simpleTableDL - {\complexTableDL[1]} +\unexpanded\def\dotableDL + {\dochecktabledivision + \dosingleempty\dotableDL} -\def\complexTableDL[#1]% - {\ifnum\TABLEaction=\TABLErule +\def\dotableDL[#1]% + {\ifnum\tableactionstate=\tablerulestate \writestatus\m!TABLE{skipping \string\DL}% \else - \ifnum\TABLEaction=\TABLEmidrow + \ifnum\tableactionstate=\tablemidrowstate \writestatus\m!TABLE{change \string\MR\space into \string\LR/\string\SR}% - \else\ifnum\TABLEaction=\TABLEfirstrow + \else\ifnum\tableactionstate=\tablefirstrowstate \writestatus\m!TABLE{change \string\MR\space into \string\SR}% \fi\fi - \setTABLEaction=\TABLEunknown - \ifnum\currentTABLEcolumn>\maxTABLEcolumn - \setTABLEerror\TABLEmissingrow - \handleTABLEerror - \fi - %\startHLcommand - \ifnum#1=\plusone - \global\advance\currentTABLEcolumn \plustwo - \let\next\normalTABLEsinglerule - \else - \ifnum#1<\maxTABLEcolumn - \global\advance\currentTABLEcolumn \plusone - \def\next{\normalTABLEmultirule{#1}}% - \else - \setTABLEerror\TABLEdivisionoverflow - \let\next\handleTABLEerror + \dosettableaction\tableunknownstate + \global\tablehrulethicknessfactor\@@tiHLheight\relax + \global\tabledrulespan\zerocount + \iffirstargument + \global\let\tablecurrenthrulecolor\empty + \rawprocesscommalist[#1]\dotabledrulecommand + \ifx\tablecurrenthrulecolor\empty\else + \switchtocolor[\tablecurrenthrulecolor]% \fi \fi - \next - %\stopHLcommand - %\globalletempty\startHLcommand - %\globalletempty\stopHLcommand - \fi} - -\def\TableDV - {\TableDCV\normalTABLEsimplebar} - -\def\TableDC - {\TableDCV\normalTABLEquote} - -\def\TableDCV#1% - {\checkTABLEdivision - \checkTABLEautorow - \ifnum\currentTABLEcolumn>\maxTABLEcolumn - \setTABLEerror\TABLEmissingrow - \handleTABLEerror - \else - \global\advance\currentTABLEcolumn \plusone - #1% - \fi} - -\def\TableDR - {\ifnum\currentTABLEcolumn<\maxTABLEcolumn % silent recovery - %\setTABLEerror\TABLEmissingcolumn % some day warning - %\handleTABLEerror - \finishTABLErow - \else - \global\currentTABLEcolumn\zerocount % nog check - \normalTABLElineending - \fi - \TABLEnoalign - {\nobreak - \global\TABLEdivisionfalse - \accountTABLElinewidth % temporary solution - \setTABLEaction\TABLErule}} - -\def\accountTABLElinewidth - {\scratchdimen\LineThicknessUnit} - -%D \startitemize[3*ruim] -%D \sym{\type{\BC}} -%D \sym{\type{\BR}} -%D \sym{\type{\BACKGROUND}} -%D \sym{\type{\CL}} -%D \sym{\type{\RL}} -%D \sym{\type{\BL}} -%D \sym{\type{\RASTER}} -%D \sym{\type{\COLOR}} -%D \stopitemize - -% definieer: \BC \BL -% herhaal: \BR -% definieer: \CL \RL (eerste \CL[green] = hele row! / \CL[1,green]) -% dus: \CL en \RL mix tussen \HL en \BL - -\unexpanded\def\defineTABLEbackgrounds - {\let\BC \TableBC - \let\BL \TableBL - \let\BR \TableBR - \let\BACKGROUND\TableBR - \let\CL \TableCL - \let\RL \TableRL - \let\COLOR \TableCOLOR - \let\RASTER \TableRASTER - \globallet\lastTABLEc\@@tibackgroundcolor - \globallet\lastTABLEr\@@tibackgroundscreen - \doifinsetelse\@@tibackground{c,color} % \v!color - {\global\chardef\TABLEcr\plusone} - {\global\chardef\TABLEcr\plustwo}} - -\def\TableBC - {\ifTABLEgrayline - \normalTABLEquote - \else - \TABLEnoalign\bgroup - \globallet\nextTABLEgrayline\executeTABLEgrayline - \globalletempty\TABLEgrayline % new - \let\BL\doTableBL - \let\BC\doTableBC - \expandafter\doTableBC - \fi} - -\def\doTableBC - {\addtoTABLEgrayline{\BC}% - \gobbleTableBCL} - -\def\TableBL - {\TABLEnoalign\bgroup - \globallet\nextTABLEgrayline\executeTABLEgrayline - \globalletempty\TABLEgrayline % new - \let\BL\doTableBL - \let\CL\doTableCL - \let\RL\doTableRL - \let\BC\doTableBC - \doTableBL} - -\def\doTableBL - {\complexorsimpleTable{BL}} - -\def\simpleTableBL - {\complexTableBL[,]} - -\def\complexTableBL[#1]% - {\analyzeTABLEcr[#1]% - \handleTABLEcr} - -\def\TableBR#1% - {\TABLEnoalign - {\globallet\nextTABLEgrayline\executeTABLEgrayline - \checkTABLEgrayline#1\BR - \global\TABLEgraylinetrue}} - -\def\analyzeTABLEcr[#1]% - {\doanalyzeTABLEcr[#1,,]} - -\def\doanalyzeTABLEcr[#1,#2,#3]% - {\doifnumberelse{#1x} % Is the x still needed here? - {\dodoanalyzeTABLEcr[#1,#2,#3]} - {\dodoanalyzeTABLEcr[1,#1,#2]}} - -\def\dodoanalyzeTABLEcr[#1,#2,#3]% - {\global\chardef\TABLEn#1\relax - \processaction - [#2] - [ c=>\global\chardef\TABLEcr1,% - color=>\global\chardef\TABLEcr1,% - r=>\global\chardef\TABLEcr2,% - raster=>\global\chardef\TABLEcr2]% - \ifcase\TABLEcr \or - \doifsomething{#3}{\xdef\lastTABLEc{#3}}% - \or - \doifsomething{#3}{\xdef\lastTABLEr{#3}}% - \fi} - -\def\handleTABLEcr - {\relax % else funny side effect - \ifcase\TABLEcr - % Can't happen! - \or - \addtoTABLEgrayline{\complexTableCOLOR[\the\TABLEn,\lastTABLEc]}% - \else - \addtoTABLEgrayline{\complexTableRASTER[\the\TABLEn,\lastTABLEr]}% - \fi - \gobbleTableBCL} - -\def\analyzeTABLEcrl#1[#2]% - {\doanalyzeTABLEcrl#1[#2,,]} - -\def\doanalyzeTABLEcrl#1[#2,#3,#4]% - {\doifnumberelse{#2x} % x ???????????????????? - {\dodoanalyzeTABLEcr[#2,#1,#3]} - {\dodoanalyzeTABLEcr[\ifTABLEgrayline1\else\maxTABLEcolumn\fi,#1,#2]}} - -\def\TableCL - {\TABLEnoalign\bgroup - \globallet\nextTABLEgrayline\executeTABLEgrayline - \globalletempty\TABLEgrayline % new - \let\BL\doTableBL - \let\CL\doTableCL - \let\RL\doTableRL - \let\BC\doTableBC - \doTableCL} - -\def\doTableCL - {\complexorsimpleTable{CL}} - -\def\simpleTableCL% nog eens \'e\'en lijn van maken - {\BL[\the\maxTABLEcolumn,c,\lastTABLEc]} - -\def\complexTableCL[#1]% - {\analyzeTABLEcrl{c}[#1]% - \handleTABLEcr} - -\def\TableRL - {\TABLEnoalign\bgroup - \globallet\nextTABLEgrayline\executeTABLEgrayline - \globalletempty\TABLEgrayline % new - \let\BL\doTableBL - \let\CL\doTableCL - \let\RL\doTableRL - \let\BC\doTableBC - \doTableRL} - -\def\doTableRL - {\complexorsimpleTable{RL}} - -\def\simpleTableRL - {\BL[\the\maxTABLEcolumn,r,\lastTABLEr]} - -\def\complexTableRL[#1]% - {\analyzeTABLEcrl{r}[#1]% - \handleTABLEcr} - -\def\checkTABLEgrayline#1#2% - {\!!doneatrue - \ifx#1\AR - \!!doneafalse - \else\ifx#1\SR\else\ifx#1\FR\else\ifx#1\MR\else\ifx#1\LR\else - \!!doneafalse - \fi\fi\fi\fi\fi - \if!!donea - \gdef\TABLEgraylinestatus - {[\string#1]}% - \gdef\TABLEendBCL - {#1}% - \else - \gdef\TABLEgraylineerror - {[\string#2\string#1->\string#2\string\SR]}% - \gdef\TABLEendBCL - {\SR}% - \fi} - -\def\endTABLErowGL#1#2#3% - {\ifcase#1\relax - % unknown - \or - \doPreTableGL\TABLErowfactor\TABLErowfactor - \or - \doPreTableGL\TABLErowfactor\TABLErowzero - \or - \ifnum\TABLEforce=\TABLEforcelastrow - \doPreTableGL\TABLErowzero\TABLErowfactor - \else\ifnum\TABLEforce=\TABLEforcefirstrow - \doPreTableGL\TABLErowfactor\TABLErowzero + \ifcase\tabledrulespan + \global\advance\currenttablecolumn \plusone + \donormaltablesinglerule + \or + \global\advance\currenttablecolumn \plustwo + \donormaltablesinglerule \else - \doPreTableGL\TABLErowzero\TABLErowzero - \fi\fi - \or - \doPreTableGL\TABLErowzero\TABLErowfactor + \global\advance\currenttablecolumn \plusone + \donormaltablemultirule + \fi \fi} -\def\doPreTableGL#1#2% betere namen - {\xdef\OldLineThicknessFactor{\the\LineThicknessFactor}% - \xdef\OldLineThicknessUnit{\the\LineThicknessUnit}% - \global\LineThicknessFactor\plusone - \setbox0\hbox{\AugmentedTableStrut{#1}{#2}}% - \getboxheight\dimen0\of\box0\relax - \xdef\TABLEgraylineHeight{\the\dimen0}% - \global\LineThicknessUnit\TABLEgraylineHeight} - -\def\doPostTableGL - {\global\LineThicknessFactor\OldLineThicknessFactor - \global\LineThicknessUnit \OldLineThicknessUnit} - -% kan simpeler - -\def\docomplexTableCOLOR[#1]% - {\dodocomplexTableGL\startcolor \stopcolor [#1,\lastTABLEc,,]} - -\gdef\docomplexTableRASTER[#1]% - {\dodocomplexTableGL\startraster\stopraster[#1,\lastTABLEr,,]} - -\def\dodocomplexTableGL#1#2[#3,#4,#5,#6]% - {\doifelsenothing{#4}{#1[#5]}{#1[#4]}% - \doPreTableGL\TABLEendofrowheight\TABLEendofrowdepth - \ifnum#3=\plusone % else conflict with \omit in \= - \let\next\normalTABLEsinglerule - \else - \def\next{\normalTABLEmultirule{#3}}% - \fi - \next - \doPostTableGL - #2} +\unexpanded\def\dotableDV + {\dotableDCV\donormaltablesimplebar} + +\unexpanded\def\dotableDC + {\dotableDCV\donormaltablenobar} + +\unexpanded\def\dotableDCV#1% + {\dochecktabledivision + \dochecktableautorow + \global\advance\currenttablecolumn \plusone + #1} + +\unexpanded\def\dotableDR + {\global\currenttablecolumn\zerocount % nog check + \donormaltablelineending + \starttablenoalign + \nobreak + \global\setfalse\istabledivision + \doaccounttablelinewidth % temporary solution + \dosettableaction\tablerulestate + \stoptablenoalign} + +\def\doaccounttablelinewidth + {\scratchdimen\tablelinethicknessunit} -\def\TableBACKGROUND - {\TableBR} +\def\dotableTWO {\use\plustwo} +\def\dotableTHREE {\use\plusthree} +\def\dotableFOUR {\use\plusfour} +\def\dotableFIVE {\use\plusfive} +\def\dotableSIX {\use\plussix} -\def\simpleTableRASTER #1{\docomplexTableRASTER[1]#1} -\def\complexTableRASTER[#1]{\docomplexTableRASTER[#1]} -\def\simpleTableCOLOR {\docomplexTableCOLOR [1]} -\def\complexTableCOLOR [#1]{\docomplexTableCOLOR [#1]} +\appendtoks + \let\TWO \dotableTWO + \let\THREE\dotableTHREE + \let\FOUR \dotableFOUR + \let\FIVE \dotableFIVE + \let\SIX \dotableSIX + \let\SPAN \use + \let\REF \dotablereformat +\to \localtabledefinitions + +\setvalue{\??ti:\c!distance:\v!none }{\dotableOpenUp00\def\LOW{\Lower6 }} +\setvalue{\??ti:\c!distance:\v!small }{\dotableOpenUp00\def\LOW{\Lower6 }} % == baseline +\setvalue{\??ti:\c!distance:\v!medium}{\dotableOpenUp11\def\LOW{\Lower7 }} +\setvalue{\??ti:\c!distance:\v!big }{\dotableOpenUp22\def\LOW{\Lower8 }} -\def\TableRASTER{\complexorsimpleTable{RASTER}} -\def\TableCOLOR {\complexorsimpleTable{COLOR}} +\appendtoks + \getvalue{\??ti:\c!distance:\@@tidistance}% +\to \localtabledefinitions -\def\addtoTABLEgrayline#1% - {\TABLEgraytoks\expandafter{\TABLEgrayline}% - \xdef\TABLEgrayline{\the\TABLEgraytoks\noexpand#1}} - -\def\setTableBCL#1#2% - {\ifx#1#2% - \gdef\TABLEgraylinestatus{[\string#1]}% - \gdef\TABLEendBCL{#1}% - \addtoTABLEgrayline{#1}% - \else - \gdef\TABLEgraylineerror{[\string#1->\string#2]}% - \gdef\TABLEendBCL{#2}% - \addtoTABLEgrayline{#2}% - \fi} +\appendtoks + \doifelse\@@tidistance\v!none + {\tablerowfactor\zerocount} + {\tablerowfactor\plustwo }% +\to \localtabledefinitions -\def\gobbleTableBCL#1% - {\ifx#1\BC \let\next\doTableBC \else - \ifx#1\BL \let\next\doTableBL \else - \ifx#1\SR \setTableBCL\SR\SR \let\next\egroup \else - \ifx#1\FR \setTableBCL\FR\FR \let\next\egroup \else - \ifx#1\MR \setTableBCL\MR\MR \let\next\egroup \else - \ifx#1\LR \setTableBCL\LR\LR \let\next\egroup \else - \setTableBCL #1\SR \let\next\egroup - \fi\fi\fi\fi\fi\fi - \next} - -\def\executeTABLEgrayline - {\TABLEnoalign - {\def\BC - {\advance\currentTABLEcolumn \plusone}% - \def\dodocomplexTableGL##1##2[##3,##4,##5,##6]% - {\BC\advance\currentTABLEcolumn ##3 }% - \let\endTABLErow\endTABLEgrayrow - \currentTABLEcolumn\zerocount - \TABLEgrayline\TABLEendBCL % determine n of columns and height - \advance\currentTABLEcolumn \minusone - \ifnum\currentTABLEcolumn>\maxTABLEcolumn - % error message too long line - \globalletempty\TABLEgrayline - \else - % \message{n of color columns: \the\currentTABLEcolumn}\wait - \global\TABLEgraylinetrue % vanaf hier nog checken - \fi - \global\currentTABLEcolumn\zerocount}% - \unskip\TABLEgrayline\TABLEendBCL - \TABLEnoalign - {\nobreak - \vskip-\TABLEgraylineHeight - \nobreak - \global\setTABLEactiontrue - \global\currentTABLEcolumn\zerocount - \globalletempty\nextTABLEgrayline - \global\TABLEgraydonetrue - \global\TABLEgraylinefalse}} - -\def\endTABLEgrayrow#1#2#3% - {\ifcase#1\relax - \global\chardef\TABLEendofrowheight\TABLErowfactor - \global\chardef\TABLEendofrowdepth \TABLErowfactor - \or - \global\chardef\TABLEendofrowheight\TABLErowfactor - \global\chardef\TABLEendofrowdepth \TABLErowfactor - \or - \global\chardef\TABLEendofrowheight\TABLErowfactor - \global\chardef\TABLEendofrowdepth \TABLErowzero - \or - \ifnum\TABLEforce=\TABLEforcelastrow - \global\chardef\TABLEendofrowheight\TABLErowzero - \global\chardef\TABLEendofrowdepth \TABLErowfactor - \else\ifnum\TABLEforce=\TABLEforcefirstrow - \global\chardef\TABLEendofrowheight\TABLErowfactor - \global\chardef\TABLEendofrowdepth \TABLErowzero - \else - \global\chardef\TABLEendofrowheight\TABLErowzero - \global\chardef\TABLEendofrowdepth \TABLErowzero - \fi\fi - \or - \global\chardef\TABLEendofrowheight\TABLErowzero - \global\chardef\TABLEendofrowdepth \TABLErowfactor - \fi} - -\unexpanded\def\defineTABLEshorthands% - {\def\SPAN##1{\use{##1}}% - \def\TWO {\use2}% - \def\THREE {\use3}% - \def\FOUR {\use4}% - \def\FIVE {\use5}% - \def\SIX {\use6}% - \def\REF {\ReFormat}} - -\unexpanded\def\defineTABLEunits - {\processaction - [\@@tidistance] - [ \v!none=>\OpenUp00\def\LOW{\Lower6 }, - \v!small=>\OpenUp00\def\LOW{\Lower6 }, % == baseline - \v!medium=>\OpenUp11\def\LOW{\Lower7 }, - \v!big=>\OpenUp22\def\LOW{\Lower8 }]% - \doifelse\@@tidistance\v!none - {\chardef\TABLErowfactor\zerocount} - {\chardef\TABLErowfactor\plustwo }} - \def\dohandlebar % here ? {\ifmmode \@EA\domathmodebar @@ -2374,74 +2184,38 @@ \else \@EAEAEA\dotextmodebar \fi\fi} - -% De macro's t.b.v. instellingen. \unexpanded\def\setuptables {\dosingleargument\dosetuptables} \def\dosetuptables[#1]% {\getparameters[\??ti][#1]% - \processaction + \processaction % we have a command for this [\@@tialign] - [ \v!right=>\def\TABLEparalignment{\raggedright}, - \v!left=>\def\TABLEparalignment{\raggedleft}, - \v!middle=>\def\TABLEparalignment{\raggedcenter}, - \s!default=>\def\TABLEparalignment{\notragged}, - \s!unknown=>\def\TABLEparalignment{\notragged}]% + [ \v!right=>\def\dotableparalignment{\raggedright}, + \v!left=>\def\dotableparalignment{\raggedleft}, + \v!middle=>\def\dotableparalignment{\raggedcenter}, + \s!default=>\def\dotableparalignment{\notragged}, + \s!unknown=>\def\dotableparalignment{\notragged}]% \assignalfadimension\@@tiVL\@@tiVLwidth 246% \assignalfadimension\@@tiHL\@@tiHLheight246} -\def\localTABLEsetup +\def\dolocaltablesetup {\@@ticommands\relax - \expanded{\switchtobodyfont[\@@tibodyfont]}% - \StrutHeightFactor 8 - \StrutDepthFactor 4 - \LineThicknessFactor4 - \NormalTLTU {.1pt}% - \NormalTSU {\normalbaselineskip\divide\StrutUnit 12 }% - \NormalTableUnits} - -%D And then I wrote the tabulate environment. That -%D alternative supports setting the rule thickness and color, -%D so here is the table alternative. - -\let\startglobalTABLEcolor\empty -\let\stopglobalTABLEcolor \empty - -\def\localTABLEsetup - {\@@ticommands\relax - % bodyfont - \expanded{\switchtobodyfont[\@@tibodyfont]}% - % linecolor - \doifsomething\@@tirulecolor - {\unexpanded\def\startglobalTABLEcolor{\startcolor[\@@tirulecolor]}% - \unexpanded\def\stopglobalTABLEcolor {\stopcolor}}% - % linethickness - \LineThicknessFactor4 - \scratchdimen\@@tirulethickness - \divide\scratchdimen \LineThicknessFactor - \expanded{\NormalTLTU{\the\scratchdimen}}% - % spacing, was depth=4 height=8 (counters, sigh, now macros) + \expanded{\switchtobodyfont[\@@tibodyfont]}% expanded ? + \tablelinethicknessunit\dimexpr\@@tirulethickness/\tablelinethicknessfactor\relax \doifelse\@@tiheight\v!strut - {\let\StrutHeightFactor\strutheightfactor} - {\let\StrutHeightFactor\@@tiheight}% + {\let\tablestrutheightfactor\tablestrutheightfactor} + {\let\tablestrutheightfactor\@@tiheight}% \doifelse\@@tidepth\v!strut - {\let\StrutDepthFactor\strutdepthfactor} - {\let\StrutDepthFactor\@@tidepth}% - \scratchdimen\StrutHeightFactor\points \multiply\scratchdimen 10% - \edef\StrutHeightFactor{\withoutpt\the\scratchdimen}% - \scratchdimen\StrutDepthFactor \points \multiply\scratchdimen 10% - \edef\StrutDepthFactor{\withoutpt\the\scratchdimen}% - % units - \NormalTSU{\normalbaselineskip\divide\StrutUnit 12 }% - \NormalTableUnits} - -\def\OpenUp#1#2% - {\scratchdimen\StrutHeightFactor \points \advance\scratchdimen #1\points - \edef\StrutHeightFactor{\withoutpt\the\scratchdimen}% - \scratchdimen\StrutDepthFactor \points \advance\scratchdimen #2\points - \edef\StrutDepthFactor{\withoutpt\the\scratchdimen}} + {\let\tablestrutdepthfactor\tablestrutdepthfactor} + {\let\tablestrutdepthfactor\@@tidepth}% + \edef\tablestrutheightfactor{\withoutpt\the\dimexpr10\dimexpr\tablestrutheightfactor\points}% + \edef\tablestrutdepthfactor {\withoutpt\the\dimexpr10\dimexpr\tablestrutdepthfactor \points}% + \tablestrutunit\dimexpr\normalbaselineskip/12\relax % 12 is default bodyfont + \tableintercolumnspaceunit.5em plus 1fil minus .25em\relax + \tablecolumnwidthunit .5em\relax + \tablekernunit .5em\relax} %D As one can see, we didn't only add color, but also more %D control over spacing. @@ -2492,7 +2266,7 @@ %D {$\vcenter{\getbuffer[b]}$} %D {\hbox{tabulate}} %D \stopcombination - + \setuptables [HL=\v!medium, VL=\v!medium, @@ -2501,6 +2275,7 @@ \c!align=\v!right, \c!depth=.40, % \v!strut \c!height=.80, % \v!strut + \c!textwidth=, \c!rulethickness=\linewidth, \c!rulecolor=, \c!distance=\v!medium, @@ -2511,6 +2286,4 @@ \c!backgroundcolor=, \c!split=\v!auto] -\def\ifintabel{\ifintable} % upward compatible - \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/tabl-tbl.lua b/Master/texmf-dist/tex/context/base/tabl-tbl.lua new file mode 100644 index 00000000000..86968721b86 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/tabl-tbl.lua @@ -0,0 +1,37 @@ +if not modules then modules = { } end modules ['tabl-tbl'] = { + version = 1.001, + comment = "companion to tabl-tbl.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- A couple of hacks ... easier to do in Lua than in regular +-- TeX. More will follow. + +local tonumber = tonumber +local gsub, rep, sub = string.gsub, string.rep, string.sub + +local P, C, Cc, Ct, lpegmatch = lpeg.P, lpeg.C, lpeg.Cc, lpeg.Ct, lpeg.match + +local settexcount = tex.setcount + +local separator = P("|") +local nested = lpeg.patterns.nested +local pattern = Ct((separator * (C(nested) + Cc("")) * C((1-separator)^0))^0) + +function commands.presettabulate(preamble) + -- todo: lpeg but not now + preamble = gsub(preamble, "%*(%b{})(%b{})", function(n,p) + return rep(sub(p,2,-2),tonumber(sub(n,2,-2)) or 1) + end) + local t = lpegmatch(pattern,preamble) + local m = #t - 2 + settexcount("global","noftabulatecolumns", m/2) + settexcount("global","tabulatehasfirstrulespec", t[1] == "" and 0 or 1) + settexcount("global","tabulatehaslastrulespec", t[m+1] == "" and 0 or 1) + for i=1,m,2 do + context.settabulateentry(t[i],t[i+1]) + end + context.setlasttabulateentry(t[m+1]) +end diff --git a/Master/texmf-dist/tex/context/base/tabl-tbl.mkiv b/Master/texmf-dist/tex/context/base/tabl-tbl.mkiv index 400d8a659de..b8ebb5ee7c9 100644 --- a/Master/texmf-dist/tex/context/base/tabl-tbl.mkiv +++ b/Master/texmf-dist/tex/context/base/tabl-tbl.mkiv @@ -13,34 +13,35 @@ \writestatus{loading}{ConTeXt Table Macros / Tabulation} -% \processbetween gebruiken in head/tail macros - -% todo: \aligntab \alignmark (after 0.60 is out) - \unprotect -%D I can probably reimplement this using a \LUA||\TEX\ combination +\registerctxluafile{tabl-tbl.lua}{1.001} % experiment + +%D I can probably reimplement this using a \LUATEX\ combination %D but it does not pay of in development time. If I need something %D else I will write it from scratch anyway. +%D +%D I never really looked at the preamble code of TaBlE (at that time +%D I simply didn't look into alignments too much) but there seem to +%D be some similarities with the following code. So, maybe it's not +%D too much work to rewrite that package in a more contexty style. If +%D it makes sense to do that remains to be seen. We might as well +%D drop it. +%D +%D Be careful with changing the hsize calculation in p mode; +%D the following code works quite well: +%D +%D \starttyping +%D \setupfield [line][location=low,height=1.2\lineheight,width=\hsize] +%D \definefield [test] [line] [line] [] +%D +%D \starttabulate[|l|p|] +%D \NC test \NC \field [test] \NC \NR +%D \stoptabulate +%D \stoptyping -% watch out: don't change this model else trialtypesetting -% compatibility problems - -% watch out, cells expand pretty late on a per row basis - -% |p2|p3| 2:3 -% spanning - -% Be careful with changing the hsize calculation in p mode; -% the following code works quite well: -% -% \setupfield [line][location=low,height=1.2\lineheight,width=\hsize] -% \definefield [test] [line] [line] [] +% |p2|p3| 2:3 -> spanning % -% \starttabulate[|l|p|] -% \NC test \NC \field [test] \NC \NR -% \stoptabulate - % In-text tabbing environment % % \starttabulate[| separated template] % eg [|l|p|] or [|l|p|p|] @@ -49,7 +50,7 @@ % % with: two pass auto width calculation when no p-width % specified, even with multiple p's, see examples. - +% % TaBlE compatible specifications: % % l align column/paragraph left @@ -71,51 +72,58 @@ % i i skip left of column % j i skip right of column % k i skip around column - +% +% C [C\L\M\R] {color} +% +% | {color,n} +% % s setups - +% % g g{char} align at char % . align at . % , align at , - +% % Still to be done - +% % N math numbers (best hook into existing digits mechanism) % n numbers (best hook into existing digits mechanism) % Q math numbers (best hook into existing digits mechanism) % q numbers (best hook into existing digits mechanism) % ~ \hskip.5em % | check - +% % nesting - +% % 10 evt auto stack; dan wel andere signal dan void nodig - +% % present but not yet 100% ok % -% \FL top hrule -% \ML mid hrule (with auto split) -% \LL bottom hrule -% \HL - -% \VL as soon as needed -% color as soon as needed - -% \EQ \RQ \HQ equal (raw, hook) -% \NC \RC \HC normal (raw, hook) +% \TL [width,color] bottom hrule +% \FL [width,color] first hrule +% \ML [width,color] mid hrule (with auto split) +% \LL [width,color] bottom hrule +% \BL [width,color] last hrule +% +% \HL [width,color] top rule +% \VL [width,color] +% +% \CC \CL \CM \CR color +% +% \EQ \RQ \HQ equal (raw, hook) +% \NC \RC \HC normal (raw, hook) % % \NR - +% % \HR : rule with lineheight - +% % \autotabulaterule : with lineheight, not first/last % \autotabulateline : spaced, not first/last % \tabulaterule : with lineheight % \tabulateline : spaced - +% % tricky: align scans ahead, over # and expands ones before % while doing - +% % new: % % \starttabulate[|cg{.}|cg{,}|cg{,}|] @@ -148,43 +156,107 @@ % \NC 500 \NC \NC 20 \NC \NC 100 \NC \NR % \stoptabulate -\newtoks \tabulatepreamble -\newtoks \tabulatebefore -\newtoks \tabulateafter -\newtoks \tabulatebmath -\newtoks \tabulateemath -\newtoks \tabulatefont -\newtoks \tabulatesettings -\newtoks \tabulatedummy +\newtoks \tabulatepreamble +\newtoks \tabulatebefore +\newtoks \tabulateafter +\newtoks \tabulatebmath +\newtoks \tabulateemath +\newtoks \tabulatefont +\newtoks \tabulatesettings +\newtoks \tabulatedummy + +\newcount \nofautotabulate +\newcount \tabulatecolumns +\newcount \tabulatecolumn + +\newcount \noftabulatecolumns % set by parser + +\newcount \tabulateminplines +\newcount \tabulatemaxplines + +\newif \iftracetabulate + +\newconditional \tabulatenopbreak +\newconditional \tabulatefirstflushed +\newconditional \tabulateequal +\newconditional \tabulatesplit \settrue\tabulatesplit +\newconditional \tabulateautomode +\newconditional \tabulatehandlepbreak \settrue\tabulatehandlepbreak + +\newdimen \tabulatepwidth +\newdimen \tabulatexwidth +\newdimen \tabulatewidth +\newdimen \tabulateunit +\newdimen \tabulatemaxpheight + +\newskip \tabulatepreskip +\newskip \tabulateposskip +\newskip \firstpretabskip +\newskip \lastposttabskip + +\newbox \tabulatebox + +\newtoks \everytabulaterow +\newtoks \everytabulatepar +\newtoks \everyaftertabulaterow +\newtoks \everytabulate + +\newconditional \tabulateautorulespacing \settrue\tabulateautorulespacing +\newcount \tabulatehasfirstrulespec % for the moment a count +\newcount \tabulatehaslastrulespec % for the moment a count +\newconditional \tabulatesomeamble +\newconstant \tabulatepass + +\setnewconstant \tabulatesplitlinemode \plusone + +\newconstant \tabulatecolorspan +\newconstant \tabulatelocalcolorspan + +\newdimen \defaulttabulatevrulethickness +\newdimen \defaulttabulatehrulethickness +\newdimen \tabulatevrulethickness +\newdimen \tabulatehrulethickness +\newdimen \tabulatelocalvrulethickness +\newdimen \tabulatelocalhrulethickness + +\newskip \tabulateseparatorskip + +\newcount \maxtabularcolorcolumn + +\newif \iftolerantTABLEbreak % used in styles ! + +\newcount \tabulaterepeathead +\newcount \noftabulatelines +\newcount \totalnoftabulatelines +\newcount \minusnoftabulatelines -\newcount \nofautotabulate -\newcount \tabulatecolumns -\newcount \tabulatecolumn +\newconstant \tabulatetype -\newcount \tabulateminplines -\newcount \tabulatemaxplines +% 0 = NC column next EQ equal column +% 1 = RC column raw RQ equal column raw +% 2 = HC column hook HQ equal column hook + +% for old times sake: -\newif \ifautotabulate -\newif \ifsplittabulate \splittabulatetrue +\def\handletabulatepbreakfalse{\setfalse\tabulatehandlepbreak} % depricated -\newif \ifhandletabulatepbreak \handletabulatepbreaktrue -\newif \iftabulatenopbreak \tabulatenopbreakfalse +% handy helper -\newif \iftabulateequal -\newif \iftracetabulate -\newif \ifframedtabulate +\def\tabulatenoalign + {\noalign + \bgroup + \let\noalign\relax + \let\tabulatenoalign\relax + \let\next=} -\newdimen \tabulatepwidth -\newdimen \tabulatexwidth -\newdimen \tabulatewidth -\newdimen \tabulateunit -\newdimen \tabulatemaxpheight +\def\starttabulatenoalign + {\tabulatenoalign\bgroup} -\newbox \tabulatebox +\let\stoptabulatenoalign\egroup % [|lg{.}|] => \NG 12.34 \NC -\gdef\handletabulatecharalign#1 % space delimited ! +\gdef\handletabulatecharalign#1 % space delimited ! (will be redone in lua) {\edef\alignmentclass{\the\tabulatecolumn}% \edef\alignmentcharacter{\csname\??tt:a:\the\tabulatecolumn\endcsname}% \ifcase\tabulatepass\or @@ -227,10 +299,10 @@ \fi} \def\dotabulatenobreak - {\noalign{\dodotabulatenobreak}} + {\tabulatenoalign{\dodotabulatenobreak}} \unexpanded\def\notabulatehook - {} + {} \unexpanded\def\checktabulatehook {\ifnum\tabulatetype<\plustwo @@ -242,100 +314,89 @@ \unexpanded\def\checktabulatesetups {\csname\??tt:s:\the\tabulatecolumn\endcsname} -\let\pretabrule \donothing -\let\posttabrule\donothing - -% 0 = NC column next EQ equal column -% 1 = RC column raw RQ equal column raw -% 2 = HC column hook HQ equal column hook -% some entries can be left out if we test for them being set - -% \def\dodosettabulatepreamble#1#2% -% {\ifzeropt\tabulatewidth -% \ifcase\tabulatemodus\relax -% \let\preamblebox\empty -% \else -% \def\preamblebox{\autotabulatetrue}% -% \fi -% \else -% \ifcase\tabulatemodus\relax -% \edef\preamblebox{\hbox to \the\tabulatewidth}% -% \else -% \edef\preamblebox{\hsize\the\tabulatewidth}% -% \fi -% \fi -% % -% % less bytes -% % -% %\edef\preamblebox% -% % {\ifcase\tabulatewidth -% % \ifcase\tabulatemodus\relax\else\noexpand\autotabulatetrue\fi -% % \els -% % \ifcase\tabulatemodus\relax\hbox to\else\hsize\fi\the\tabulatewidth -% % \fi}% -% % -% \@EA\appendtoks \@EA&\@EA\hskip\pretabskip\pretabrule##&\to\!!toksa -% \appendtoks \ignorespaces\to\!!toksa -% \@EA\appendtoks\@EA\global\@EA\tabulatecolumn\the\tabulatecolumns\relax\to\!!toksa -% \appendtoks \checktabulatesetups\to\!!toksa -% \appendtoks \checktabulatehook\to\!!toksa -% \@EA\appendtoks \preamblebox\to\!!toksa -% \appendtoks \bgroup\bbskip\bgroup#1\to\!!toksa -% \appendtoks\ifnum\tabulatetype=\plusone \else \to\!!toksa -% \@EA\appendtoks \the\tabulatebmath\to\!!toksa -% \@EA\appendtoks \the\tabulatefont\to\!!toksa -% \@EA\appendtoks \the\tabulatesettings\to\!!toksa -% \@EA\appendtoks \the\tabulatebefore\to\!!toksa -% \appendtoks\fi \to\!!toksa -% \appendtoks \bgroup\ignorespaces\to\!!toksa -% % -% \appendtoks \tabulatehook##\to\!!toksa -% % -% %%\doifdefinedelse{\??tt:a:\tabulatecolumns} -% %\doifdefinedelse{\??tt:a:\the\tabulatecolumns} -% % {\appendtoks\handletabulatecharalign## \to\!!toksa} -% % {\appendtoks\tabulatehook ##\to \!!toksa}% -% % waarom kan ik hier geen \xx{##} geven, om een of -% % andere reden passeert dan tex de hele regel (incl \NC's) -% % als argument; elke delimiter <> space gaat trouwens fout -% \appendtoks \unskip\unskip\ifmmode\else\endgraf\fi\egroup\to\!!toksa -% \appendtoks\ifnum\tabulatetype=1 \else \to\!!toksa -% \@EA\appendtoks \the\tabulateafter\to\!!toksa -% \@EA\appendtoks \the\tabulateemath\to\!!toksa -% \appendtoks\fi \to\!!toksa -% \appendtoks #2\egroup\egroup\to\!!toksa -% \@EA\appendtoks \@EA&\@EA\posttabrule\@EA\hskip\postabskip##\to\!!toksa -% \appendtoks\NC\to\tabulatedummy -% \let\bbskip\empty -% \def\pretabskip{.5\tabulateunit}% -% \let\postabskip\pretabskip -% \let\gettabulateexit\dogettabulateexit -% \tabulatewidth\zeropoint} -% -% speedup: - -% is grouping really needed here? - \unexpanded\def\beforetabulateentry{\ignorespaces\tabulatehook} \unexpanded\def\aftertabulateentry {\unskip\unskip\ifmmode\else\endgraf\fi} \unexpanded\def\beginreshapedtabulatepar {\dowithnextbox - {\ctxlua{commands.doreshapeframedbox(\number\nextbox)}\ifvmode\unvbox\else\box\fi\nextbox} + {\ctxcommand{doreshapeframedbox(\number\nextbox)}\ifvmode\unvbox\else\box\fi\nextbox} \vbox\bgroup} \let\endreshapedtabulatepar\egroup +\let\dotagtabulatealign\relax + +\unexpanded\def\dochecklocaltabulatecolor#1#2% + {\relax + \ifx\currenttabulatelocalcolor\empty + \gdef\currenttabulatecolor{#1}% + \else + \global\let\currenttabulatecolor\currenttabulatelocalcolor + \global\let\currenttabulatelocalcolor\empty + \fi + \ifcase\tabulatelocalcolorspan + \global\tabulatecolorspan#2\relax + \else + \global\tabulatecolorspan\tabulatelocalcolorspan + \global\tabulatelocalcolorspan\zerocount + \fi} + +\unexpanded\def\dochecklocaltabulatevrulecolor#1#2% + {\relax + \ifx\currenttabulatelocalvrulecolor\empty + \gdef\currenttabulatevrulecolor{#1}% + \else + \global\let\currenttabulatevrulecolor\currenttabulatelocalvrulecolor + \global\let\currenttabulatelocalvrulecolor\empty + \fi + \ifcase\tabulatelocalvrulethickness + \global\tabulatevrulethickness#2\relax + \else + \global\tabulatevrulethickness\tabulatelocalvrulethickness + \global\tabulatelocalvrulethickness\zeropoint + \fi} + +\unexpanded\def\dotabulatepreskip#1% + {\ifdim#1>\zeropoint + \hskip#1\relax + \else\ifnum\tabulatecolumn=\zerocount + \ifconditional\tabulateautorulespacing + \ifcase\tabulatehasfirstrulespec\else + \hskip\firstpretabskip\relax + \fi + \fi + \fi\fi} + +\unexpanded\def\dotabulatepostskip#1% + {\ifdim#1>\zeropoint + \hskip#1\relax + \else\ifnum\tabulatecolumns=\noftabulatecolumns + \ifconditional\tabulateautorulespacing + \ifcase\tabulatehaslastrulespec\else + \hskip\lastposttabskip\relax + \fi + \fi + \fi\fi} + \def\dodosettabulatepreamble#1#2% only makes sense for many tabulates - {\normalexpanded{\!!toksa{\the\!!toksa - &\hskip\pretabskip\noexpand\pretabrule##&% - % \ignorespaces + {\normalexpanded{\tabulatepreamble{\the\tabulatepreamble + \dochecklocaltabulatevrulecolor{\currenttabulatevrulecolor}{\the\tabulatevrulethickness}% + \dochecklocaltabulatecolor{\currenttabulatecolor}{\number\tabulatecolorspan}% + \dorightsidetabulatecolor + \aligntab + \dotabulatevrule + \doleftsidetabulatecolor + \dotabulatepreskip{\the\tabulatepreskip}% + \alignmark\alignmark + \aligntab + \dobothsidetabulatecolor + \global\tabulatecolorspan\zerocount \global\tabulatecolumn\the\tabulatecolumns\relax \checktabulatesetups % unexpandable \checktabulatehook % unexpandable \ifzeropt\tabulatewidth \ifcase\tabulatemodus\else - \noexpand\autotabulatetrue + \noexpand\settrue\noexpand\tabulateautomode \fi \else \ifnum\tabulatemodus=\zerocount @@ -348,6 +409,8 @@ \bgroup \noexpand\bbskip \bgroup % we cannot combine the if because a cell may have only one ## + \noexpand\dostarttagged\noexpand\t!tabulatecell\noexpand\empty + \dotagtabulatealign \noexpand#1% \ifcase\tabulatereshape\else \beginreshapedtabulatepar @@ -359,10 +422,10 @@ \the\tabulatebefore \noexpand\fi % grouping needs to be outside macros (or expandable), nice test - % example \NC \string & \NC which will fail otherwise (mk) + % example \NC \string \aligntab \NC which will fail otherwise (mk) \bgroup \beforetabulateentry - ##% + \alignmark\alignmark \aftertabulateentry \egroup \noexpand\ifnum\noexpand\tabulatetype=\plusone\noexpand\else @@ -373,76 +436,73 @@ \endreshapedtabulatepar \fi \noexpand#2% + \noexpand\dostoptagged \egroup \egroup - &\noexpand\posttabrule\hskip\postabskip##% + \aligntab + \dotabulatepostskip{\the\tabulateposskip}% + \alignmark\alignmark }}% \appendtoks\NC\to\tabulatedummy - \let\bbskip\empty % ? - \def\pretabskip{.5\tabulateunit}% - \let\postabskip\pretabskip - \let\gettabulateexit\dogettabulateexit + \tabulatepreskip.5\tabulateunit\relax + \ifnum\tabulatecolumns<\numexpr\noftabulatecolumns-\plusone\relax + \tabulateposskip\tabulatepreskip + \else + \tabulateposskip\zeropoint + \fi + %\let\gettabulateexit\dogettabulateexit % still needed ? \tabulatewidth\zeropoint} -\setvalue{\??tt>\meaning x}{\let\tabulatealign\zerocount\settabulatepreamble} % internal -\setvalue{\??tt>\meaning l}{\let\tabulatealign\plusone\settabulatepreamble} -\setvalue{\??tt>\meaning r}{\let\tabulatealign\plustwo\settabulatepreamble} -\setvalue{\??tt>\meaning c}{\let\tabulatealign\plusthree\settabulatepreamble} -\setvalue{\??tt>\meaning p}{\gettabulateparagraph} -\setvalue{\??tt>\meaning s}{\gettabulatesetups} -\setvalue{\??tt>\meaning w}{\gettabulatewidth} -\setvalue{\??tt>\meaning f}{\gettabulatefont} -\setvalue{\??tt>\meaning B}{\tabulatefont{\bf}\settabulatepreamble} -\setvalue{\??tt>\meaning I}{\tabulatefont{\it}\settabulatepreamble} -\setvalue{\??tt>\meaning S}{\tabulatefont{\sl}\settabulatepreamble} -\setvalue{\??tt>\meaning T}{\tabulatefont{\tt}\settabulatepreamble} -\setvalue{\??tt>\meaning R}{\tabulatefont{\rm}\settabulatepreamble} -\setvalue{\??tt>\meaning m}{\tabulatebmath{$}\tabulateemath{$}\settabulatepreamble} -\setvalue{\??tt>\meaning M}{\tabulatebmath{$\displaystyle}\tabulateemath{$}\settabulatepreamble} -\setvalue{\??tt>\meaning h}{\gettabulatehook} -\setvalue{\??tt>\meaning b}{\gettabulatebefore} -\setvalue{\??tt>\meaning a}{\gettabulateafter} -\setvalue{\??tt>\meaning i}{\gettabulatepreskip} -\setvalue{\??tt>\meaning j}{\gettabulateposskip} -\setvalue{\??tt>\meaning k}{\gettabulatepreposskip} -\setvalue{\??tt>\meaning X}{\gettabulateexit} % internal -\setvalue{\??tt>\meaning e}{\appendtoks\global\tabulateequaltrue\to\tabulatesettings\settabulatepreamble} -\setvalue{\??tt>\meaning ~}{\appendtoks\fixedspaces\to\tabulatesettings\settabulatepreamble} -\setvalue{\??tt>\meaning g}{\gettabulatealign} -\setvalue{\??tt>\meaning .}{\gettabulatealign.} -\setvalue{\??tt>\meaning ,}{\gettabulatealign,} - -\setvalue{\??tt>\s!unknown}{\message{unknown preamble key [\meaning\next]}\settabulatepreamble} -\letvalue{\??tt>\meaning\relax}\donothing +\setvalue{\??tt>\meaning x}{\let\tabulatealign\zerocount\settabulatepreamble} % internal +\setvalue{\??tt>\meaning l}{\let\tabulatealign\plusone\settabulatepreamble} +\setvalue{\??tt>\meaning r}{\let\tabulatealign\plustwo\settabulatepreamble} +\setvalue{\??tt>\meaning c}{\let\tabulatealign\plusthree\settabulatepreamble} +\setvalue{\??tt>\meaning p}{\gettabulateparagraph} +\setvalue{\??tt>\meaning s}{\gettabulatesetups} +\setvalue{\??tt>\meaning w}{\gettabulatewidth} +\setvalue{\??tt>\meaning f}{\gettabulatefont} +\setvalue{\??tt>\meaning B}{\tabulatefont{\bf}\settabulatepreamble} +\setvalue{\??tt>\meaning I}{\tabulatefont{\it}\settabulatepreamble} +\setvalue{\??tt>\meaning S}{\tabulatefont{\sl}\settabulatepreamble} +\setvalue{\??tt>\meaning T}{\tabulatefont{\tt}\settabulatepreamble} +\setvalue{\??tt>\meaning R}{\tabulatefont{\rm}\settabulatepreamble} +\setvalue{\??tt>\meaning m}{\tabulatebmath{$}\tabulateemath{$}\settabulatepreamble} +\setvalue{\??tt>\meaning M}{\tabulatebmath{$\displaystyle}\tabulateemath{$}\settabulatepreamble} +\setvalue{\??tt>\meaning h}{\gettabulatehook} +\setvalue{\??tt>\meaning b}{\gettabulatebefore} +\setvalue{\??tt>\meaning a}{\gettabulateafter} +\setvalue{\??tt>\meaning i}{\gettabulatepreskip} +\setvalue{\??tt>\meaning j}{\gettabulateposskip} +\setvalue{\??tt>\meaning k}{\gettabulatepreposskip} +\setvalue{\??tt>\meaning e}{\appendtoks\global\settrue\tabulateequal\to\tabulatesettings\settabulatepreamble} +\setvalue{\??tt>\meaning ~}{\appendtoks\fixedspaces\to\tabulatesettings\settabulatepreamble} +\setvalue{\??tt>\meaning g}{\gettabulatealign} +\setvalue{\??tt>\meaning .}{\gettabulatealign.} +\setvalue{\??tt>\meaning ,}{\gettabulatealign,} +\setvalue{\??tt>\meaning C}{\doparsecolortabulate} +\setvalue{\??tt>\s!unknown }{\message{unknown preamble key [\meaning\next]}\settabulatepreamble} +\setvalue{\??tt>\meaning\relax}{} \def\dosettabulatepreamble {\csname\??tt>\ifcsname\??tt>\meaning\next\endcsname\meaning\next\else\s!unknown\fi\endcsname} -\def\dogettabulateexit - {\let\postabskip\!!zeropoint - \settabulatepreamble} - -\let\gettabulateexit\dogettabulateexit - \def\gettabulatepreskip#1% {\doifnumberelse{#1} - {\edef\pretabskip{\the\dimexpr#1\tabulateunit}\let\next\empty} - {\edef\pretabskip{\the\dimexpr.5\tabulateunit}\def\next{#1}}% + {\tabulatepreskip#1\tabulateunit\let\next\empty} + {\tabulatepreskip.5\tabulateunit\def\next{#1}}% \@EA\settabulatepreamble\next} \def\gettabulateposskip#1% {\doifnumberelse{#1} - {\edef\postabskip{\the\dimexpr#1\tabulateunit}\let\next\empty} - {\edef\postabskip{\the\dimexpr.5\tabulateunit}\def\next{#1}}% - \let\gettabulateexit\settabulatepreamble + {\tabulateposskip#1\tabulateunit\let\next\empty} + {\tabulateposskip.5\tabulateunit\def\next{#1}}% \@EA\settabulatepreamble\next} \def\gettabulatepreposskip#1% {\doifnumberelse{#1} - {\edef\pretabskip{\the\dimexpr#1\tabulateunit}\let\next\empty} - {\edef\pretabskip{\the\dimexpr.5\tabulateunit}\def\next{#1}}% - \let\postabskip\pretabskip - \let\gettabulateexit\settabulatepreamble + {\tabulatepreskip#1\tabulateunit\let\next\empty} + {\tabulatepreskip.5\tabulateunit\def\next{#1}}% + \tabulateposskip\tabulatepreskip \@EA\settabulatepreamble\next} \def\gettabulatesetups#1% @@ -498,12 +558,12 @@ [#1]% [ \v!fit=>\let\tabulatemodus\plusthree, \v!fixed=>\let\tabulatemodus\plusthree - \tabulatenopbreaktrue, + \settrue\tabulatenopbreak, \v!auto=>\let\tabulatemodus\plusthree \let\tabulatereshape\plusone, \s!unknown=>\tabulatewidth#1\relax]% \ifnum\tabulatedimen=\plusone - \global\advance\tabulatepwidth\tabulatewidth + \global\advance\tabulatepwidth\tabulatewidth % accumulated parwidth \fi \settabulatepreamble} @@ -545,9 +605,17 @@ \def\tabulatesetpreamblewidthsimple {\dodosettabulatepreamble\xbskip\xeskip} -\bgroup \catcode`\|=\@@other +\def\doparsecolortabulate#1#2% + {\gdef\currenttabulatecolor{#2}% + \global\tabulatecolorspan\if#1L\plusone\else\if#1M\plustwo\else\if#1R\plusthree\else\zerocount\fi\fi\fi\relax + \settabulatepreamble} + +\def\dotabulatevrulecommand#1% + {\doifnumberelse{#1} + {\global\tabulatevrulethickness#1\defaulttabulatevrulethickness} + {\xdef\currenttabulatevrulecolor{#1}}} -\gdef\nexttabulate#1|% +\def\settabulateentry#1#2% rulespec template {\let\tabulatealign\@@tabulatealign \let\tabulatemodus\zerocount \let\tabulatedimen\zerocount @@ -558,9 +626,19 @@ \tabulateemath\emptytoks \tabulatefont\emptytoks \tabulatesettings\emptytoks - \global\advance\tabulatecolumns\plusone + \global\let\currenttabulatecolor\empty + \global\let\currenttabulatevrulecolor\empty + \global\tabulatecolorspan\zerocount + \global\advance\tabulatecolumns\plusone % == #1 \expandafter\let\csname\??tt:s:\the\tabulatecolumns\endcsname\donothing - \settabulatepreamble#1\relax\relax % permits i without n + \edef\currenttabulatetrulespec{#1}% + \ifx\currenttabulatetrulespec\empty + \global\tabulatevrulethickness\zeropoint + \else + \global\tabulatevrulethickness\defaulttabulatevrulethickness + \rawprocesscommalist[#1]\dotabulatevrulecommand + \fi + \settabulatepreamble#2\relax\relax % permits i without n \ifcase\tabulatemodus\relax \tabulatesetpreamblewidthnormal \or % fixed width @@ -569,27 +647,50 @@ \tabulatesetpreamblewidthauto \or % simple \tabulatesetpreamblewidthsimple - \fi - \futurelet\next\donexttabulate} + \fi} -\egroup +\def\setlasttabulateentry#1% rulespec + {\global\let\currenttabulatevrulecolor\empty + \rawprocesscommalist[#1]\dotabulatevrulecommand + \ifx\currenttabulatetrulespec\empty + \global\tabulatevrulethickness\zeropoint + \else + \global\tabulatevrulethickness\defaulttabulatevrulethickness + \rawprocesscommalist[#1]\dotabulatevrulecommand + \fi + \normalexpanded{\tabulatepreamble{\the\tabulatepreamble + \dochecklocaltabulatevrulecolor{\currenttabulatevrulecolor}{\the\tabulatevrulethickness}% + \dotabulatevrule}}} -\def\donexttabulate - {\ifx\next\relax\else - \expandafter\nexttabulate +\def\donormalizetabulatesplitline + {\ifcase\tabulatesplitlinemode + % nothing + \or + \ht\tabulatebox\strutht + \dp\tabulatebox\strutdp + \or + \ifdim\ht\tabulatebox<\strutht + \ht\tabulatebox\strutht + \fi + \ifdim\dp\tabulatebox<\strutdp + \dp\tabulatebox\strutdp + \fi \fi} -\def\splitofftabulatebox % overloaded in anch-pgr +\def\flushtabulatesplitbox + {\box\tabulatebox} + +\def\splitofftabulatebox % overloads in anch-pgr {\dontcomplain \global\setbox\tabulatebox % % % global ? % % % \vsplit\tablebox\tabulatecolumn to \lineheight \setbox\tabulatebox\normalvbox {\unvbox\tabulatebox}% \setbox\tabulatebox\hbox to \wd\tabulatebox - {\hss\dotabulatehook{\box\tabulatebox}\hss}% - \ht\tabulatebox\strutht - \dp\tabulatebox\strutdp - \box\tabulatebox} + {\iftrialtypesetting\else\ifconditional\tabulatehascolors\repeatsettabulatecolor\fi\fi + \hss\dotabulatehook{\box\tabulatebox}\hss}% + \donormalizetabulatesplitline + \flushtabulatesplitbox} \def\dotabulatehook {\csname\??tt:h:\the\tabulatecolumn\endcsname} \def\dotabulatealign{\csname\??tt:a:\the\tabulatecolumn\endcsname} @@ -610,25 +711,9 @@ \global\tabulatemaxpheight\scratchdimen \fi} -% \def\handletabulatepbreak -% {\TABLEnoalign -% {\ifhandletabulatepbreak -% \iftabulatenopbreak -% \dotabulatenobreak -% \else\ifnum\tabulatemaxplines>\plusone -% \ifnum\tabulateminplines=\plusone -% \dotabulatenobreak -% \fi -% \global\advance\tabulateminplines\plusone -% \ifnum\tabulateminplines=\tabulatemaxplines\relax -% \dotabulatenobreak -% \fi -% \fi \fi -% \fi}} - \def\dohandletabulatepbreak - {\ifhandletabulatepbreak - \iftabulatenopbreak + {\ifconditional\tabulatehandlepbreak + \ifconditional\tabulatenopbreak \dotabulatenobreak \else\ifnum\tabulatemaxplines>\plusone \ifnum\tabulateminplines=\plusone @@ -642,7 +727,7 @@ \fi} \def\handletabulatepbreak - {\TABLEnoalign{\dohandletabulatepbreak}} + {\tabulatenoalign{\dohandletabulatepbreak}} %D \startbuffer %D \starttabulate[|c|p|p|] @@ -675,12 +760,10 @@ % \starttabulate[preamble] % \starttabulate -> \starttabulate[|l|p|] -\bgroup \catcode`\|=\@@other - -\gdef\definetabulate +\def\definetabulate {\dotripleempty\dodefinetabulate} -\gdef\dodefinetabulate[#1][#2][#3]% +\def\dodefinetabulate[#1][#2][#3]% {\ifthirdargument \ifcsname\??tt#1::\c!unit\endcsname \else \copyparameters @@ -691,35 +774,31 @@ \fi \copyparameters [\??tt#1::#2][\??tt#1::]% - [\c!unit,\c!distance,\c!before,\c!bodyfont,\c!after, - \c!inner,\c!indenting,\c!frame,\c!split,\c!header,\c!title, - \c!margin,\c!align,\c!rulecolor,\c!rulethickness,EQ]% - \setvalue{\e!start#1::#2}{\dofinalstarttabulate[#1][#2][#3]}% - \setvalue{\e!start#1}{\bgroup\dosubstarttabulate[#1]}% - \letvalue{\??tt#1-\v!header}\empty - \letvalue{\??tt#1-\v!footer }\empty + [\c!frame,\c!distance,\c!unit,\c!before,\c!bodyfont,\c!after, + \c!inner,\c!indenting,\c!margin,\c!align,\c!header,\c!title, + \c!rulecolor,\c!rulethickness,\c!split,EQ]% + \setuvalue{\e!start#1::#2}{\dofinalstarttabulate[#1][#2][#3]}% + \setuvalue{\e!start#1}{\bgroup\dosubstarttabulate[#1]}% + \letvalueempty{\??tt#1-\v!header}% + \letvalueempty{\??tt#1-\v!footer}% \else\ifsecondargument \definetabulate[#1][][#2]% \else \definetabulate[#1][][|l|p|]% \fi\fi} -\egroup - \let\tabulateheadcontent\empty \let\tabulatetailcontent\empty -\newconditional\tabulatesomeamble - \def\processtabulateheadcontent - {\TABLEnoalign{\global\settrue\tabulatesomeamble}% + {\tabulatenoalign{\global\settrue\tabulatesomeamble}% \csname\??tt\currenttabulate-\v!header\endcsname - \TABLEnoalign{\global\setfalse\tabulatesomeamble}}% + \tabulatenoalign{\global\setfalse\tabulatesomeamble}}% \def\processtabulatetailcontent - {\TABLEnoalign{\global\settrue\tabulatesomeamble}% + {\tabulatenoalign{\global\settrue\tabulatesomeamble}% \csname\??tt\currenttabulate-\v!footer\endcsname - \TABLEnoalign{\global\setfalse\tabulatesomeamble}}% + \tabulatenoalign{\global\setfalse\tabulatesomeamble}}% \def\checkfulltabulatecontent % - needed, else confusion with \c!header {\ifcsname\??tt\currenttabulate-\v!header\endcsname @@ -733,11 +812,6 @@ \let\tabulatetailcontent\empty \fi} -% \def\fulltabulatecontent -% {\tabulateheadcontent -% \tabulatecontent -% \tabulatetailcontent} - \def\fulltabulatecontent {\tabulateheadcontent \tabulatecontent @@ -747,17 +821,17 @@ \def\removefunnytabulateline {\ifhmode \strut\crcr - \TABLEnoalign{\kern-\lineheight}% + \tabulatenoalign{\kern-\lineheight}% \fi} -\setvalue{\e!start\v!tabulatehead}% +\setuvalue{\e!start\v!tabulatehead}% {\dosingleempty\dostartstarttabulatehead} \def\dostartstarttabulatehead[#1]% {\processcontent{\e!stop\v!tabulatehead}\next {\letvalue{\??tt\iffirstargument#1\else\v!tabulate\fi::-\v!header}\next}} -\setvalue{\e!start\v!tabulatetail}% +\setuvalue{\e!start\v!tabulatetail}% {\dosingleempty\dostartstarttabulatetail} \def\dostartstarttabulatetail[#1]% @@ -770,10 +844,21 @@ \def\dodosubstarttabulate[#1][#2]% {\csname\e!start#1::\ifcsname\e!start#1::#2\endcsname#2\fi\endcsname} -\setvalue{\e!start\v!tabulate}% +\setuvalue{\e!start\v!tabulate}% {\bgroup\dodoubleempty\donormalstarttabulate} -\bgroup +\def\doinhibitnestedtabulate + {\setuvalue{\e!start\v!tabulate}% + {\em Nested tabulate is not (yet) supported.\relax + \expandafter\gobbleuntil\csname\e!stop\v!tabulate\endcsname}} + +\appendtoks + \doinhibitnestedtabulate +\to \everytabulate + +\setuvalue{\e!stop\v!tabulate }{} +\setuvalue{\e!stop\v!tabulatehead}{} +\setuvalue{\e!stop\v!tabulatetail}{} \gdef\donormalstarttabulate[#1][#2]% {\ifsecondargument @@ -786,67 +871,18 @@ \fi \next} -\egroup - -% The much neede hook: - -\newtoks\everytabulate - -% An example of its usage: - -\appendtoks \optimizeverbatimfalse \to \everytabulate -\appendtoks \let\recodeverbatimmode\plustwo \to \everytabulate +% The much needed hook: -% A status variable: +% \appendtoks \optimizeverbatimfalse \to \everytabulate -\chardef\tabulatepass=0 +% Todo: proper inheritance \def\tabulateparameter#1{\csname\??tt\currenttabulate#1\endcsname} -\bgroup - \catcode`\|=\@@other \gdef\@@otherbar{|} - \catcode`\|=\@@active \gdef\@@useotherbar{\let|\@@otherbar} -\egroup - -\def\doparsetabulate - {\futurelet\next\dodoparsetabulate} - -% \def\dodoparsetabulate % \@EAEAEA gebruiken -% {\ifx\next\relax -% % exit -% \else\ifx*\next -% \let\next\dorepeatparsetabulate -% \else\ifx\bgroup\next -% \let\next\dododoparsetabulate -% \else -% \let\next\dodododoparsetabulate -% \fi\fi\fi -% \next}% - -\def\dorepeatparsetabulate*#1#2% - {\dorecurse{#1}{\!!toksb\expandafter{\the\!!toksb#2}}% \dorecurse{#1}{\appendtoks#2\to\!!toksb}% - \doparsetabulate} - -\def\dododoparsetabulate#1% - {\!!toksb\expandafter{\the\!!toksb{#1}}% \appendtoks{#1}\to\!!toksb - \doparsetabulate} - -\def\dodododoparsetabulate#1% - {\!!toksb\expandafter{\the\!!toksb#1}% \appendtoks#1\to\!!toksb - \doparsetabulate} - -\letvalue{\??tt<\meaning *}\dorepeatparsetabulate -\letvalue{\??tt<\meaning \bgroup}\dododoparsetabulate -\letvalue{\??tt<\meaning \relax}\donothing -\letvalue{\??tt<\s!unknown }\dodododoparsetabulate - -\def\dodoparsetabulate - {\csname\??tt<\ifcsname\??tt<\meaning\next\endcsname\meaning\next\else\s!unknown\fi\endcsname} - -\setvalue{\??tt:\c!split:\v!yes }{\splittabulatetrue} -\setvalue{\??tt:\c!split:\v!repeat}{\splittabulatetrue} -\setvalue{\??tt:\c!split:\v!no }{\splittabulatefalse} -\setvalue{\??tt:\c!split:\v!auto }{\ifinsidefloat\ifinsidesplitfloat\else\splittabulatefalse\fi\fi} +\setvalue{\??tt:\c!split:\v!yes }{\settrue\tabulatesplit} +\setvalue{\??tt:\c!split:\v!repeat}{\settrue\tabulatesplit} +\setvalue{\??tt:\c!split:\v!no }{\setfalse\tabulatesplit} +\setvalue{\??tt:\c!split:\v!auto }{\ifinsidefloat\ifinsidesplitfloat\else\setfalse\tabulatesplit\fi\fi} \def\dofinalstarttabulate[#1][#2][#3]% identifier sub preamble {\edef\currenttabulate{#1::#2}% @@ -858,12 +894,12 @@ \resetcharacteralign % todo: spacing around tabulate when bodyfont is set % expansion en test needed ? - \splittabulatetrue + \settrue\tabulatesplit \csname\??tt:\c!split:\tabulateparameter\c!split\endcsname \doifvaluesomething{\??tt\currenttabulate\c!bodyfont} {\expanded{\switchtobodyfont[\tabulateparameter\c!bodyfont]}}% \postponenotes % new, to be tested / will be configurable - \let\tabulatepass\plusone + \tabulatepass\plusone \widowpenalty\zerocount % otherwise lines are not broken \clubpenalty \zerocount % but overlap in funny ways \the\everytabulate @@ -872,42 +908,146 @@ {\edef\tabulateindent{\the\dimexpr\leftskip+\hangindent+\parindent}}% \ctxparindent {\edef\tabulateindent{\the\dimexpr\leftskip+\hangindent }}% \global\tabulatecolumn\zerocount - \!!toksb\emptytoks - \bgroup - \@@useotherbar - \normalexpanded{\egroup\noexpand\doparsetabulate#3\relax}% - \processcontent - {\e!stop#1}% \currenttabulate} - \tabulatecontent - {\@EA\processtabulate\@EA[\the\!!toksb]}} + \processcontent{\e!stop#1}\tabulatecontent{\processtabulate[#3]}} % \currenttabulate -\chardef\tabulatetype=0 +\def\tabulateEQ + {\ifconditional\tabulatefirstflushed\else\tabulateparameter{EQ}\fi + \global\setfalse\tabulateequal} -% 0 = NC column next EQ equal column -% 1 = RC column raw RQ equal column raw -% 2 = HC column hook HQ equal column hook +% The next ones will be token registers -\newif\iftabulatefirstflushed +\let\tabulatenormalpos\relax +\let\tabulateequalpos \relax -\def\tabulateEQ - {\iftabulatefirstflushed\else\tabulateparameter{EQ}\fi - \global\tabulateequalfalse} +% color columns -% \def\tabulatenormalcolumn#1% -% {&\iftabulateequal\tabulateEQ\fi&\global\chardef\tabulatetype#1&} -% -% \def\tabulateequalcolumn#1% -% {&\tabulateEQ&\global\chardef\tabulatetype#1&} -% -% however, \unskip en \ignorespaces permit usage in complex XML/\starttabulate +\glet\previoustabulatecolor \empty +\glet\currenttabulatecolor \empty +\glet\currenttabulatelocalcolor \empty +\glet\currenttabulatevrulecolor \empty +\glet\currenttabulatelocalvrulecolor\empty + +\appendtoks + \glet\previoustabulatecolor \empty + \glet\currenttabulatecolor \empty + \glet\currenttabulatelocalcolor \empty + \glet\currenttabulatevrulecolor \empty + \glet\currenttabulatelocalvrulecolor\empty + \global\tabulatelocalvrulethickness \zeropoint +\to \everytabulaterow + +\unexpanded\def\dorightsidetabulatecolor + {\iftrialtypesetting\else + \ifx\previoustabulatecolor\empty \else + \settabulatecolor\previoustabulatecolor + \glet\previoustabulatecolor\empty + \fi + \fi} + +\unexpanded\def\doleftsidetabulatecolor + {\iftrialtypesetting\else + \ifx\currenttabulatecolor\empty \else + \ifcase\tabulatecolorspan + \or + \settabulatecolor\currenttabulatecolor + \or + \settabulatecolor\currenttabulatecolor + \fi + \fi + \fi} + +\unexpanded\def\dobothsidetabulatecolor + {\iftrialtypesetting\else + \ifx\currenttabulatecolor\empty \else + \settabulatecolor\currenttabulatecolor + \ifcase\tabulatecolorspan + %\glet\previoustabulatecolor\empty + \or + \glet\previoustabulatecolor\empty + \or + \glet\previoustabulatecolor\currenttabulatecolor + \or + \glet\previoustabulatecolor\currenttabulatecolor + \fi + \fi + \fi} + +\def\tabulatecolorcolumn#1% overloaded + {\unskip + \doiffastoptionalcheckelse{\tabulatecolorcolumnyes#1}{\tabulatecolorcolumnnop#1}} + +\def\tabulatecolorcolumnnop + {\tabulatenormalcolumn} + +\def\tabulatecolorcolumnyes#1[#2]% + {\xdef\currenttabulatelocalcolor{#2}% + \tabulatenormalcolumn#1} + +% normal columns: \def\tabulatenormalcolumn#1% - {\unskip&\iftabulateequal\tabulateEQ\fi&\global\chardef\tabulatetype#1&% - \ignorespaces} + {\unskip + \aligntab + \ifconditional\tabulateequal\tabulateequalpos\else\tabulatenormalpos\fi + \aligntab + \global\tabulatetype#1% + \aligntab} + +% equal columns + +\def\tabulateequalcolumn#1% overloaded + {\unskip + \aligntab + \tabulateequalpos + \aligntab\global\tabulatetype#1% + \aligntab} + +% ruled columns + +\def\tabulatevruledcolumn#1% + {\unskip % 0-n + \ifnum\tabulatecolumn=\plusone + \global\tabulatehasfirstrulespec\plusone + \else\ifnum\tabulatecolumn=\noftabulatecolumns + \global\tabulatehaslastrulespec\plusone + \fi\fi + \global\let\currenttabulatelocalvrulecolor\defaulttabulatevrulecolor + \global\tabulatelocalvrulethickness\defaulttabulatevrulethickness + \doiffastoptionalcheckelse{\tabulatevruledcolumnyes#1}{\tabulatevruledcolumnnop#1}} + +\def\tabulatevruledcolumnnop + {\tabulatenormalcolumn} + +\def\dotabulatevrulelocalcommand#1% + {\doifnumberelse{#1} + {\global\tabulatelocalvrulethickness#1\defaulttabulatevrulethickness} + {\xdef\currenttabulatelocalvrulecolor{#1}}} + +\def\tabulatevruledcolumnyes#1[#2]% + {\rawprocesscommalist[#2]\dotabulatevrulelocalcommand + \tabulatenormalcolumn#1} + +\def\donormaltabulatevrule + {\vrule\!!width\tabulatevrulethickness\relax} + +\def\docoloredtabulatevrule + {\faststartcolor[\currenttabulatevrulecolor]% + \vrule\!!width\tabulatevrulethickness\relax + \faststopcolor} + +\unexpanded\def\dotabulatevrule + {\ifcase\tabulatevrulethickness\else + \iftrialtypesetting + \donormaltabulatevrule + \else\ifx\currenttabulatevrulecolor\empty + \donormaltabulatevrule + \else + \docoloredtabulatevrule + \fi\fi + \fi + \global\tabulatevrulethickness\zeropoint} % nils second one -\def\tabulateequalcolumn#1% - {\unskip&\tabulateEQ&\global\chardef\tabulatetype#1&% - \ignorespaces} +% auto columns \def\tabulateautocolumn {\tabulatenormalcolumn\zerocount @@ -921,52 +1061,164 @@ {\let#1\tabulateautocolumn \let\\\tabulateautocolumn} -\def\dotabulateruleseperator % can be sped up (will do when used frequently) +\setvalue{\??tt:rs:\v!blank }{\tabulateseparatorskip\bigskipamount} +\setvalue{\??tt:rs:\v!depth }{\tabulateseparatorskip\strutdp} +\setvalue{\??tt:rs:\v!small }{\def\factor{.25}} +\setvalue{\??tt:rs:\v!medium}{\def\factor{.5}} +\setvalue{\??tt:rs:\v!big }{} +\setvalue{\??tt:rs:\v!none }{\tabulateseparatorskip\zeropoint\def\factor{0}} +\setvalue{\??tt:rs:\v!grid }{\tabulateseparatorskip\zeropoint\def\factor{0}} + +\def\dodotabulateruleseparator#1% + {\ifcsname\??tt:rs:#1\endcsname + \csname\??tt:rs:#1\endcsname + \else + \tabulateseparatorskip#1\relax + \fi} + +\def\dotabulateruleseparator % can be sped up (will do when used frequently) {\bgroup - \let\factor\!!plusone - \scratchskip\strutdp - \ExpandFirstAfter\processallactionsinset - [\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]% - \scratchdimen\factor\scratchskip - \ifconditional\tabulatesomeamble\kern\else\vskip\fi\scratchdimen % new + \edef\tabulateseparatordistance{\tabulateparameter\c!distance}% + \tabulateseparatorskip\strutdp + \ifx\tabulateseparatordistance\empty\else + \let\factor\!!plusone + \normalexpanded{\processcommalist[\tabulateparameter\c!distance]}\dodotabulateruleseparator + \tabulateseparatorskip\factor\tabulateseparatorskip + \fi + \ifconditional\tabulatesomeamble\kern\else\vskip\fi\tabulateseparatorskip % new \egroup} -\def\dodotabulaterule#1% - {\color - [\tabulateparameter\c!rulecolor] - {\scratchdimen\tabulateparameter\c!rulethickness#1}} +\def\tabulateignorehrulespec#1% + {%\global\let\currenttabulatelocalhrulecolor\empty + %\global\tabulatelocalhrulethickness\defaulttabulatehrulethickness + \doiffastoptionalcheckelse#1#1} + +\def\tabulatepickuphrulespec#1% + {\global\let\currenttabulatelocalhrulecolor\defaulttabulatehrulecolor + \global\tabulatelocalhrulethickness\defaulttabulatehrulethickness + \doiffastoptionalcheckelse{\tabulatepresethrule#1}#1} + +\def\dotabulatehrulelocalcommand#1% + {\doifnumberelse{#1} + {\global\tabulatelocalhrulethickness#1\defaulttabulatehrulethickness} + {\xdef\currenttabulatelocalhrulecolor{#1}}} + +\def\tabulatepresethrule#1[#2]% + {\rawprocesscommalist[#2]\dotabulatehrulelocalcommand + #1} + +\def\donormaltabulatehrule + {\hrule + \!!height.5\tabulatelocalhrulethickness + \!!depth .5\tabulatelocalhrulethickness + \relax} + +\def\docoloredtabulatehrule + {\faststartcolor[\currenttabulatelocalhrulecolor]% + \donormaltabulatehrule + \faststopcolor} + +\unexpanded\def\dotabulatehrule + {\ifcase\tabulatelocalhrulethickness\else + \iftrialtypesetting % does not happen as we nil the caller + \donormaltabulatehrule + \else\ifx\currenttabulatelocalhrulecolor\empty + \donormaltabulatehrule + \else + \docoloredtabulatehrule + \fi\fi + \fi} + +\def\donormaltabulatehlinerule + {\leaders \hrule + \!!height\dimexpr.5\lineheight-\strutdepth + \!!depth-\dimexpr.5\lineheight-\strutdepth+\tabulatelocalhrulethickness + \hfill} -\def\dotabulaterule - {\dodotabulaterule - {\hrule\!!height.5\scratchdimen\!!depth.5\scratchdimen\relax - \doifvalue{\??tt\currenttabulate\c!distance}\v!grid - {\kern-\scratchdimen}}} % experimental tm-prikkels +\def\docoloredtabulatehlinerule + {\faststartcolor[\currenttabulatelocalhrulecolor]% + \donormaltabulatehlinerule + \faststopcolor} \def\dotabulatelinerule {\multispan\totaltabulatecolumns % \multispan is a plain macro % for the moment this one \strut\hskip\tabulateparameter\c!margin % neg values are ok ! - \hskip\tabulateindent % new august 2003 - \dodotabulaterule - {\!!heighta.5\lineheight - \advance\!!heighta-\strutdepth - \!!deptha-\!!heighta - \advance\!!deptha\scratchdimen - \leaders\hrule\!!height\!!heighta\!!depth\!!deptha\hfill}% + \hskip\tabulateindent\relax % new august 2003 + \ifcase\tabulatelocalhrulethickness\else + \iftrialtypesetting % does not happen as we nil the caller + \donormaltabulatehlinerule + \else\ifx\currenttabulatelocalhrulecolor\empty + \donormaltabulatehlinerule + \else + \docoloredtabulatehlinerule + \fi\fi + \fi \cr} -%D When set to true, no (less) break optimization is done. +%D Color: + +% \starttabulate[||p||] +% \NC test \NC test \NC test \NC \NR +% \NC test \NC[green] \input tufte \NC[yellow] test \NC \NR +% \NC test \NC test \NC test \NC \NR +% \NC test \NC test \NC test \NC \NR +% \NC test \NC test \NC test \NC \NR +% \NC test \NC test \NC test \NC \NR +% \NC[blue] test \NC[red] test \NC test \NC \NR +% \NC test \NC test \NC test \NC \NR +% \NC test \NC test \NC test \NC \NR +% \NC test \NC test \NC test \NC \NR +% \NC test \NC test \NC[gray] test \NC \NR +% \NC test \NC test \NC test \NC \NR +% \NC test \NC test \NC test \NC \NR +% \NC[blue] test \NC test \NC test \NC \NR +% \NC test \NC test \NC test \NC \NR +% \NC test \NC test \NC[magenta] test \NC \NR +% \NC test \NC test \NC test \NC \NR +% \NC test \NC[cyan] \dorecurse{10}{\input ward }\NC test \NC \NR +% \NC test \NC test \NC test \NC \NR +% \NC test \NC[yellow] test \NC test \NC \NR +% \stoptabulate + +\unexpanded\def\settabulatecolor#1% we could store the attributes at the cost of a lua call + {\begingroup + \doinitializeboxbackgrounds + \global\settrue\tabulatehascolors + \ifnum\tabulatecolumn>\maxtabularcolorcolumn + \global\maxtabularcolorcolumn\tabulatecolumn + \fi + \setxvalue{\??tt:c:\the\tabulatecolumn}{#1}% + \attribute\backgroundattribute\plusone + \faststartcolor[#1]\strut\char0\faststopcolor + \endgroup} + +\def\repeatsettabulatecolor + {\begingroup + \ifcsname\??tt:c:\the\tabulatecolumn\endcsname + \attribute\backgroundattribute\plusone + \faststartcolor[\csname\??tt:c:\the\tabulatecolumn\endcsname]\strut\char0\faststopcolor + \fi + \endgroup} + +\def\resettabulatecolors + {\ifcase\maxtabularcolorcolumn\else + \doresettabulatecolors + \fi} + +\def\doresettabulatecolors + {\dorecurse\maxtabularcolorcolumn{\letgvalue{\??tt:c:\recurselevel}\undefined}} % slow + +\appendtoks + \resettabulatecolors +\to \everyaftertabulaterow + +\appendtoks + \global\setfalse\tabulatehascolors +\to \everytabulate -\newif\iftolerantTABLEbreak % used in styles ! +%D When set to true, no (less) break optimization is done. %D The main processing macro is large but splitting it up %D would make things less clear. @@ -987,8 +1239,6 @@ \glet\registertabulateparoptions\doregistertabulateparoptions \to \everytabulate -\newtoks\everytabulaterow - \appendtoks \registertabulateparoptions \to \everytabulaterow @@ -1014,12 +1264,6 @@ %D cum suis, since \TEX's hard coded noalign lookahead fails %D on it! I mistakenly added this for a while. -\chardef\tabulaterepeathead\zerocount - -\newcount\noftabulatelines -\newcount\totalnoftabulatelines -\newcount\minusnoftabulatelines - \setvalue{\??tt:\c!align:\v!normal}{0} \setvalue{\??tt:\c!align:\v!right }{1} \setvalue{\??tt:\c!align:\v!left }{2} @@ -1028,8 +1272,6 @@ \setvalue{\??tt:\c!header:\v!repeat}{\plusone} \setvalue{\??tt:\c!header:\v!text }{\plustwo} -\newtoks\everyaftertabulaterow - \def\tabulatebskipone {\setbox\tabulatebox\vbox\bgroup\glet\tabulatehook\notabulatehook} \def\tabulateeskipone {\par\egroup\glet\tabulatehook\dotabulatehook} \def\tabulatexbskipone{\hbox\bgroup\vbox\bgroup\glet\tabulatehook\notabulatehook} @@ -1037,32 +1279,38 @@ \def\tabulatebaselinecorrection {\def\dobaselinecorrection % todo: mkiv - {\vskip-\prevdepth - \vskip\strutdp - \vskip\strutdp}% + {\vskip-\prevdepth+\strutdp+\strutdp\relax}% \baselinecorrection} -\unexpanded\def\tabulateNCone{\tabulatenormalcolumn0} -\unexpanded\def\tabulateRCone{\tabulatenormalcolumn1} -\unexpanded\def\tabulateHCone{\tabulatenormalcolumn2} -\unexpanded\def\tabulateEQone{\tabulateequalcolumn 0} -\unexpanded\def\tabulateRQone{\tabulateequalcolumn 1} -\unexpanded\def\tabulateHQone{\tabulateequalcolumn 2} +\unexpanded\def\tabulateVLone{\tabulatevruledcolumn\zerocount} +\unexpanded\def\tabulateNCone{\tabulatenormalcolumn\zerocount} +\unexpanded\def\tabulateRCone{\tabulatenormalcolumn\plusone} +\unexpanded\def\tabulateHCone{\tabulatenormalcolumn\plustwo} +\unexpanded\def\tabulateEQone{\tabulateequalcolumn \zerocount} +\unexpanded\def\tabulateRQone{\tabulateequalcolumn \plusone} +\unexpanded\def\tabulateHQone{\tabulateequalcolumn \plustwo} \unexpanded\def\tabulateNGone{\NC\handletabulatecharalign} \unexpanded\def\tabulateNNone{\NC\handletabulatedigits} % new, undocumented, test first \unexpanded\def\tabulateNDone{\NC\handletabulatedigits} % same, for old times sake + \unexpanded\def\tabulateHRone{\doHR\zerocount} -\unexpanded\def\tabulateHLone{\doHL\zerocount} + +\unexpanded\def\tabulateCCone{\global\tabulatelocalcolorspan\zerocount\tabulatecolorcolumn\zerocount} +\unexpanded\def\tabulateCLone{\global\tabulatelocalcolorspan\plusone \tabulatecolorcolumn\zerocount} +\unexpanded\def\tabulateCMone{\global\tabulatelocalcolorspan\plustwo \tabulatecolorcolumn\zerocount} +\unexpanded\def\tabulateCRone{\global\tabulatelocalcolorspan\plusthree\tabulatecolorcolumn\zerocount} \unexpanded\def\tabulateNRone % next row {\global\advance\noftabulatelines\plusone - \global\tabulatefirstflushedfalse - \global\tabulateequalfalse + \global\setfalse\tabulatefirstflushed + \global\setfalse\tabulateequal \global\tabulatecolumn\zerocount \resettabulatepheight \unskip\unskip\crcr\flushtabulated - \TABLEnoalign{\the\everyaftertabulaterow}% - \TABLEnoalign{\checktabulatepenaltiesa}} + \starttabulatenoalign + \the\everyaftertabulaterow + \checktabulatepenaltiesa + \stoptabulatenoalign} \def\checktabulatepenaltiesa {\iftolerantTABLEbreak\else @@ -1085,7 +1333,7 @@ \fi\fi \fi \fi - \global\tabulatefirstflushedfalse} + \global\setfalse\tabulatefirstflushed} \def\tabulatebbskiptwo {\ifvoid\tablebox\tabulatecolumn @@ -1102,15 +1350,17 @@ \def\tabulatebskiptwo {\ifvoid\tablebox\tabulatecolumn + % first line \global\setbox\tablebox\tabulatecolumn\vbox \bgroup \glet\tabulatehook\notabulatehook - \ifautotabulate\hsize\tabulatewidth\fi + \ifconditional\tabulateautomode\hsize\tabulatewidth\fi % \begstrut % interferes with pre-\pars % evt: \appendtoks\begstrut\to\everypar \ignorespaces \let\eskip\tabulatebskiptwoeskip \else + % successive lines \let\eskip\empty \dontcomplain \glet\tabulatehook\dotabulatehook @@ -1120,18 +1370,6 @@ \def\tabulatexbskiptwo{\bskip} \def\tabulatexeskiptwo{\eskip} -% \def\tabulateflushtabulatedtwo -% {\TABLEnoalign % noalign % no interference ! -% {\glet\flushtabulatedindeed\empty -% \global\tabulatecolumn\zerocount -% \handletabulatepbreak -% \dorecurse\tabulatecolumns % was: \noftabcolumns -% {\ifvoid\tablebox\recurselevel\else -% \gdef\flushtabulatedindeed{\the\tabulatedummy}% -% \fi}% -% \global\tabulatefirstflushedtrue}% -% \flushtabulatedindeed} - \def\dotabulateflushtabulatedtwo {\glet\flushtabulatedindeed\empty \global\tabulatecolumn\zerocount @@ -1140,15 +1378,15 @@ {\ifvoid\tablebox\recurselevel\else \gdef\flushtabulatedindeed{\the\tabulatedummy}% \fi}% - \global\tabulatefirstflushedtrue} + \global\settrue\tabulatefirstflushed} \def\tabulateflushtabulatedtwo - {\TABLEnoalign{\dotabulateflushtabulatedtwo}% + {\tabulatenoalign{\dotabulateflushtabulatedtwo}% \flushtabulatedindeed} \def\tabulatebskipthree {\vtop\bgroup - \ifautotabulate\hsize\tabulatewidth\fi + \ifconditional\tabulateautomode\hsize\tabulatewidth\fi % \begstrut % interferes with pre-\pars % evt: \appendtoks\begstrut\to\everypar \ignorespaces} @@ -1156,49 +1394,6 @@ \def\tabulateeskipthree % vertical strut added august 2003 {\par\verticalstrut\vskip-\struttotal\egroup} -\def\tabulatedoHLfour#1% #1 ignored - {\TABLEnoalign - {\csname - \ifnum\noftabulatelines=\zerocount F\else - \ifnum\noftabulatelines=\totalnoftabulatelines L\else - M\fi\fi - L\endcsname}}% - -\def\tabulatedoHRfour#1% horizontal rule line (break untested) - {\TABLEnoalign - {\globallet\TABLEautoline\dotabulatelinerule - \ifcase#1\or - \ifnum\noftabulatelines=\zerocount - \gdef\TABLEautoline{\TABLEnoalign{}}% - \else\ifnum\noftabulatelines=\totalnoftabulatelines - \gdef\TABLEautoline{\TABLEnoalign{}}% - \fi\fi - \fi - \dotabulatenobreak}% - \TABLEautoline - \TABLEnoalign - {\nobreak - \ifx\TABLEautoline\dotabulatelinerule\kern-\lineheight\fi - \ifnum\noftabulatelines=\totalnoftabulatelines - \@EA\dotabulatenobreak - \else - \@EA\allowbreak - \fi}% - \TABLEautoline - \TABLEnoalign - {\dotabulatenobreak}} - -\def\tabulateFLfive{\TABLEnoalign - {\ifinsidefloat\else - \doifemptyvalue{\??tt\currenttabulate\c!before} % no expansion - {\tabulatebaselinecorrection}% - \fi - \dotabulaterule - \dotabulatenobreak - \dotabulateruleseperator - \prevdepth\strutdp - \dotabulatenobreak}} - % see *** % % \enabletrackers[nodes.page_vspacing] @@ -1206,52 +1401,163 @@ % \starttabulate[||] \dorecurse{100}{\NC Eins \NC \NR \HL} \stoptabulate % \stoptext -\def\tabulateMLfive{\TABLEnoalign - {\dotabulateruleseperator - \dotabulaterule - \ifnum\noftabulatelines>\plusone - \ifnum\noftabulatelines<\minusnoftabulatelines - % *** somehow topskip messes up as it's intercepted - % \vskip \topskip\allowbreak\vskip- \topskip - % messy anyhow so this needs to be improved, so for - % the momenet we keep this bugged variant - \vskip1\topskip\allowbreak\vskip-1\topskip - \vskip-\tabulateparameter\c!rulethickness - \dotabulaterule - \fi - \fi - \dotabulateruleseperator}} +% old crap: +% +% \ifnum\noftabulatelines>\plusone +% \ifnum\noftabulatelines<\minusnoftabulatelines +% % *** somehow topskip messes up as it's intercepted +% % \vskip \topskip\allowbreak\vskip- \topskip +% % messy anyhow so this needs to be improved, so for +% % the moment we keep this bugged variant +% \vskip1\topskip +% \allowbreak +% \vskip-1\topskip + +\def\tabulateXXnone{\starttabulatenoalign\tabulateignorehrulespec\stoptabulatenoalign} + +\def\tabulateFLfive{\starttabulatenoalign\tabulatepickuphrulespec\dotabulateFLfive} +\def\tabulateMLfive{\starttabulatenoalign\tabulatepickuphrulespec\dotabulateMLfive} +\def\tabulateLLfive{\starttabulatenoalign\tabulatepickuphrulespec\dotabulateLLfive} +\def\tabulateTLfive{\starttabulatenoalign\tabulatepickuphrulespec\dotabulateTLfive} +\def\tabulateBLfive{\starttabulatenoalign\tabulatepickuphrulespec\dotabulateBLfive} +%def\tabulateHLfive{\starttabulatenoalign\tabulatepickuphrulespec\dotabulateHLfive} + +% we can use one common spec: (saves 4 macros) +% +% \def\dotabulatecheckhrulespec#1% +% {\iftrialtypesetting +% \expandafter\tabulateignorehrulespec\expandafter\stoptabulatenoalign +% \else +% \expandafter\tabulatepickuphrulespec\expandafter\dotabulateFLfive +% \fi} -\def\tabulateLLfive{\TABLEnoalign +\unexpanded\def\dotabulateFLfive + {\ifinsidefloat\else + \doifemptyvalue{\??tt\currenttabulate\c!before} % no expansion + {\tabulatebaselinecorrection}% + \fi + \dotabulatehrule + \dotabulatenobreak + \dotabulateruleseparator + \prevdepth\strutdp + \dotabulatenobreak + \stoptabulatenoalign} + +\unexpanded\def\dotabulateMLfive + {\dotabulateruleseparator + \dotabulatehrule + \vskip-\tabulateparameter\c!rulethickness + \dotabulatehrule + \nobreak + \dotabulateruleseparator + \stoptabulatenoalign} + +\unexpanded\def\dotabulateLLfive {\dotabulatenobreak - \dotabulateruleseperator + \dotabulateruleseparator \dotabulatenobreak - \dotabulaterule + \dotabulatehrule \ifinsidefloat\else \doifemptyvalue{\??tt\currenttabulate\c!after} % no expansion {\vskip\strutdp \verticalstrut \vskip-\struttotal}% - \fi}} - -\def\tabulateHLfive - {\doHL\zerocount} + \fi + \stoptabulatenoalign} -\def\tabulaterule {\HR}% a rule with lineheight -\def\tabulateline {\HL}% just a spaced rule -\def\tabulateautorule{\doHR\plusone}% -\def\tabulateautoline{\doHL\plusone}% +\unexpanded\def\dotabulateTLfive + {\dotabulatenobreak + \dotabulateruleseparator + \dotabulatenobreak + \dotabulatehrule + \dotabulatenobreak + \dotabulateruleseparator + %\prevdepth\strutdp % todo, might differ between TL and BL + \dotabulatenobreak + \stoptabulatenoalign} -\bgroup \catcode`\|=\@@other +\let\dotabulateBLfive\dotabulateTLfive -\gdef\processtabulate[|#1|]% in the process of optimizing +\def\tabulateHLfive + {\csname + \ifnum\noftabulatelines=\zerocount F\else + \ifnum\noftabulatelines=\totalnoftabulatelines L\else + M\fi\fi + L\endcsname} + +\def\tabulatedoHRfive % horizontal rule line (break untested) + {\starttabulatenoalign + \globallet\dotabulateautoline\dotabulatelinerule + %\ifcase#1\or % todo: check what this does + \ifnum\noftabulatelines=\zerocount + \glet\dotabulateautoline\donothing + \else\ifnum\noftabulatelines=\totalnoftabulatelines + \glet\dotabulateautoline\donothing + \fi\fi + %\fi + \dotabulatenobreak + \stoptabulatenoalign + \dotabulateautoline + \starttabulatenoalign + \nobreak + \ifx\dotabulateautoline\dotabulatelinerule\kern-\lineheight\fi + \ifnum\noftabulatelines=\totalnoftabulatelines + \@EA\dotabulatenobreak + \else + \@EA\allowbreak + \fi + \stoptabulatenoalign + \dotabulateautoline + \starttabulatenoalign + \dotabulatenobreak + \stoptabulatenoalign} + +% \dorecurse{10}{ +% \starttabulate[|l|] +% \FL +% \NC first line, bound to next rule \NC \NR +% \TL +% \NC bound to previous rule \NC \NR +% \NC some line \NC \NR +% \NC some line \NC \NR +% \NC some line \NC \NR +% \NC bound to next rule \NC \NR +% \ML +% \NC bound to previous rule \NC \NR +% \NC bound to next rule \NC \NR +% \BL +% \NC last line, bound to previous rule \NC \NR +% \LL +% \stoptabulate +% } + +% to be redone + +\def\tabulaterule {\HR} % a rule with lineheight +\def\tabulateline {\HL} % just a spaced rule +\def\tabulateautorule{\HR}% +\def\tabulateautoline{\HL} % no longer different (to be looked into) + +% When support for vertical rules we needed a way to pick up the +% specification for the final rule and a \type {|{}} interface was +% chosen. As a result parsing had to become more complex and I was +% not in the mood for messing up the code too much. Therefore from +% now on the preamble is split by \LUA. There are definitely more +% places where we can use \LUA\ code (for instance in alignment of +% numbers. The repeat parser is replace at the \LUA\ end as well. + +\gdef\processtabulate[#1]% in the process of optimizing {\tabulateunit\tabulateparameter\c!unit \checkfulltabulatecontent - \globallet\tabulateruledepth \!!zeropoint - \globallet\tabulateruleheight\!!zeropoint + \defaulttabulatevrulethickness\tabulateparameter\c!rulethickness + \defaulttabulatehrulethickness\tabulateparameter\c!rulethickness + \edef\defaulttabulatevrulecolor{\tabulateparameter\c!rulecolor}% + \edef\defaulttabulatehrulecolor{\tabulateparameter\c!rulecolor}% \edef\@@tabulatealign{\executeifdefined{\??tt:\c!align:\tabulateparameter\c!align}0}% - \let\pretabskip\!!zeropoint - \def\postabskip{.5\tabulateunit}% + \tabulateposskip.5\tabulateunit + \tabulatepreskip\zeropoint + \firstpretabskip\tabulateposskip + \lastposttabskip\tabulateposskip \global\tabulatecolumns\zerocount \global\nofautotabulate\zerocount \global\noftabulatelines\zerocount @@ -1259,7 +1565,7 @@ \minusnoftabulatelines\noftabulatelines \global\tabulatepwidth\zeropoint \global\tabulatexwidth\zeropoint - \global\tabulateequalfalse + \global\setfalse\tabulateequal \resettabulatepheight \ifinsidesplitfloat \donetrue @@ -1269,8 +1575,9 @@ \donetrue \fi\fi \ifdone - \chardef\tabulaterepeathead\executeifdefined{\??tt:\c!header:\tabulateparameter\c!header}\zerocount + \tabulaterepeathead\executeifdefined{\??tt:\c!header:\tabulateparameter\c!header}\zerocount \fi + \let\VL\tabulateVLone \let\NC\tabulateNCone \let\RC\tabulateRCone \let\HC\tabulateHCone @@ -1280,32 +1587,41 @@ \let\NG\tabulateNGone \let\NN\tabulateNNone \let\ND\tabulateNDone - \let\HR\tabulateHRone - \let\HL\tabulateHLone \let\NR\tabulateNRone - \let\HL\empty % not needed ? ? ? - \let\SR\NR \let\AR\NR - \let\FL\empty \let\FR\NR - \let\ML\empty \let\MR\NR - \let\LL\empty \let\LR\NR - \let\doHR\gobbleoneargument - \let\doHL\gobbleoneargument + \let\CC\tabulateCCone + \let\CL\tabulateCLone + \let\CM\tabulateCMone + \let\CR\tabulateCRone + \let\SR\NR + \let\FR\NR + \let\MR\NR + \let\LR\NR + \let\AR\NR + \let\FL\tabulateXXnone + \let\ML\tabulateXXnone + \let\LL\tabulateXXnone + \let\TL\tabulateXXnone + \let\BL\tabulateXXnone + \let\HL\tabulateXXnone + \let\HR\tabulateXXnone \glet\flushtabulated\empty \tabskip\zeropoint \ifdim\tabulateparameter\c!margin>\zeropoint - \!!toksa{&\flushtabulateindent\strut##\tabskip\tabulateparameter\c!margin\strut&##\tabskip\zeropoint}% + \tabulatepreamble{\aligntab\flushtabulateindent\strut\alignmark\alignmark\tabskip\tabulateparameter\c!margin\strut\aligntab\alignmark\alignmark\tabskip\zeropoint}% \else - \!!toksa{&\flushtabulateindent\strut##&##\tabskip\zeropoint}% + \tabulatepreamble{\aligntab\flushtabulateindent\strut\alignmark\alignmark\aligntab\alignmark\alignmark\tabskip\zeropoint}% \fi \tabulatewidth\zeropoint - \nexttabulate #1X|\relax + \ctxcommand{presettabulate(\!!bs\detokenize{#1}\!!es)}% \edef\totaltabulatecolumns{\the\numexpr3*\tabulatecolumns+4}% \tabulatewidth\zeropoint \initializetableboxes\tabulatecolumns - \appendtoks&##\global\advance\tabulatecolumn\plusone\to\!!toksa + \appendtoks\aligntab\alignmark\alignmark\global\advance\tabulatecolumn\plusone\to\tabulatepreamble \appendtoks\NC\unskip\unskip\crcr\flushtabulated\to\tabulatedummy % no count \global\tabulatecolumn\zerocount \resettabulatepheight + \let\bbskip\empty + %\let\eeskip\empty \let\bskip \tabulatebskipone \let\eskip \tabulateeskipone \let\xbskip\tabulatexbskipone @@ -1318,12 +1634,13 @@ \setlocalhsize \hsize\localhsize \fi \dontcomplain - \forgetall % hm, interference with \forgetparindent ^^^ probably bug, to be solved + \forgetall % hm, interference with preceding \forgetparindent probably bug, to be solved + \everypar\everytabulatepar \setbox0\vbox % outside \if because of line counting {\notesenabledfalse \let\tabulateindent\!!zeropoint - \trialtypesettingtrue % very important - \@EA\halign\@EA{\the\!!toksa\crcr\fulltabulatecontent\crcr}}% + \settrialtypesetting % very important + \@EA\halign\@EA{\the\tabulatepreamble\crcr\fulltabulatecontent\crcr}}% \ifnum\nofautotabulate>\zerocount % so, even if the natural size is larger, in the final % run, we force the calculated width @@ -1334,7 +1651,7 @@ \fi \let\xbskip\tabulatexbskiptwo \let\xeskip\tabulatexeskiptwo - \ifsplittabulate + \ifconditional\tabulatesplit \splittopskip\strutht \glet\flushtabulatedindeed\empty \let\bbskip\tabulatebbskiptwo @@ -1348,17 +1665,18 @@ \totalnoftabulatelines\noftabulatelines \minusnoftabulatelines\numexpr\noftabulatelines+\minusone\relax \global\noftabulatelines\zerocount - \let\doHL\tabulatedoHLfour - \let\doHR\tabulatedoHRfour - \doifelsevalue{\??tt\currenttabulate\c!rule}\v!line - {\let\HL\HR - \let\tabulateautoline\tabulateautorule - \let\tabulateline\tabulaterule}% - {\let\HL\tabulateHLfive}% \let\FL\tabulateFLfive \let\ML\tabulateMLfive \let\LL\tabulateLLfive - \let\tabulatepass\plustwo + \let\TL\tabulateTLfive + \let\BL\tabulateBLfive + \let\HL\tabulateHLfive + \let\HR\tabulateHRfive + \doifvalue{\??tt\currenttabulate\c!rule}\v!line + {\let\HL\HR + \let\tabulateautoline\tabulateautorule + \let\tabulateline\tabulaterule}% + \tabulatepass\plustwo % \ifcase\tabulaterepeathead \ifinsidesplitfloat @@ -1370,8 +1688,13 @@ \setbox\tabulatebox\vbox \bgroup \fi % - \@EA\halign\@EA{\the\!!toksa\crcr\fulltabulatecontent\crcr}% - \prevdepth\strutdp % nog eens beter, temporary hack + \dostarttagged\t!tabulate\empty + \dostarttagged\t!tabulaterow\empty + \appendtoks\dostoptagged\dostarttagged\t!tabulaterow\empty\to\everycr + \@EA\halign\@EA{\the\tabulatepreamble\crcr\fulltabulatecontent\crcr}% + \dostoptagged + \dostoptagged + \ifhmode\par\prevdepth\strutdp\fi % nog eens beter, temporary hack \doifvalue{\??tt\currenttabulate\c!distance}\v!grid{\vskip-\strutdp}% experimental tm-prikkels % \ifcase\tabulaterepeathead @@ -1390,7 +1713,7 @@ \fi \egroup} -\egroup +% \egroup % \setuptabulate[split=yes,header=text,title=Vervolg van Tabel] % @@ -1441,7 +1764,45 @@ %D \NC tufte \NC \input tufte \NC \NR \tabulateautorule %D \stoptabulate %D \stoptyping - + +%D Spacing: +% +% \starttabulate +% \NC text \NC text \NC \NR +% \TB[small] +% \NC text \NC text \NC \NR +% \TB[4*big] +% \NC text \NC text \NC \NR +% \stoptabulate + +\def\TabulateTB + {\starttabulatenoalign + \dosingleempty\doTabulateTB} + +\def\doTabulateTB[#1]% + {\iffirstargument + \blank[#1] + \else + \blank + \fi + \stoptabulatenoalign} + +% to be tested: +% +% \def\TabulateTB +% {\starttabulatenoalign +% \doiffastoptionalcheckelse\doTabulateTByes\doTabulateTBnop} +% +% \def\doTabulateTByes[#1]% +% {\blank[#1] +% \stoptabulatenoalign} +% +% \def\doTabulateTBnop[#1]% +% {\blank +% \stoptabulatenoalign} + +\appendtoks\let\TB\TabulateTB\to\everytabulate + % \starttabulatie[|mc|] % \NC \digits{100.000,00} \NC\NR % \NC \digits{@10.000,00} \NC\NR @@ -1481,7 +1842,7 @@ % \NC \digits $@@@.@10,@@$ \NC\NR % \NC \digits $@@@.@@1,@@$ \NC\NR % \stoptabulatie - + \unexpanded\def\setuptabulate {\dotripleempty\dosetuptabulate} diff --git a/Master/texmf-dist/tex/context/base/tabl-tsp.mkiv b/Master/texmf-dist/tex/context/base/tabl-tsp.mkiv index 9ceb3af6e89..d274df6cb4a 100644 --- a/Master/texmf-dist/tex/context/base/tabl-tsp.mkiv +++ b/Master/texmf-dist/tex/context/base/tabl-tsp.mkiv @@ -13,14 +13,11 @@ \writestatus{loading}{ConTeXt Table Macros / Splitting} -%D The code in this file is move here from other places. +%D The code in this file is move here from other places and needs +%D a mkiv cleanup. \unprotect -% only to be used with single tokens (will be prim) - -\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 %D table code depends on it. Othrwise there would be too much @@ -29,12 +26,9 @@ % \splitfloat [settings] {\placetable[optional args]{test}} {content} -% \def\s!noftablesplits{nofsplittables} +% there is no need for a tracked structure number here -\definenumber % we need a nicer name like nofsplittables, we then also need to set \s!parent - [\??si] - [\c!way=\v!by\v!text, - \c!conversion=\@@siconversion] +\newcount\noffloatssplits \unexpanded\def\setupfloatsplitting {\dodoubleargument\getparameters[\??si]} @@ -59,8 +53,8 @@ \insidefloattrue \insidesplitfloattrue \getparameters[\??si][#1]% - \resetnumber[\??si]% - \def\floatcaptionsuffix{\convertednumber[\??si]}% + \global\noffloatssplits\zerocount + \def\floatcaptionsuffix{\convertnumber\@@siconversion\noffloatssplits}% \let\extrasplitfloatlines\@@silines \the\everysplitfloatsetup \def\splitfloatcommand{#2}% @@ -113,15 +107,20 @@ {\forgetall \dontcomplain \global\settrue\splitfloatdone - \chardef\nodelocationmode\zerocount % bypass auto-renumbering - \incrementnumber[\??si]% - \ifcase\rawnumber[\??si]\or \ifconditional\onlyonesplitofffloat - \let\floatcaptionsuffix\empty - \fi \fi + \nodelocationmode\zerocount % bypass auto-renumbering + \global\advance\noffloatssplits\plusone + \ifcase\noffloatssplits\relax + \or + \ifconditional\onlyonesplitofffloat + \let\floatcaptionsuffix\empty + \fi + \else + \global\settrue\usesamefloatnumber % one shot + \fi \bgroup \ifconditional\somenextplitofffloat \settrue\retainfloatnumber -\notesenabledfalse % best here, experimental, brrr; test with note in caption + \notesenabledfalse % best here, experimental, brrr; test with note in caption \else \setfalse\retainfloatnumber \fi @@ -161,7 +160,7 @@ {\doif\extrasplitfloatlines\v!auto {\bgroup \settrue\retainfloatnumber - \chardef\nodelocationmode\zerocount + \nodelocationmode\zerocount \forcelocalfloats \setuplocalfloats[\c!before=,\c!after=,\c!inbetween=]% \splitfloatcommand{\hbox to \wd#1{\strut}}% dummy line @@ -201,21 +200,25 @@ \newbox\tsplitnext \newbox\tsplittail -\def\resettsplit{% only \def's starting a a new line are seen by the dep checker +\newtoks\everyresettsplit + +\def\resettsplit{\the\everyresettsplit} + +\appendtoks \def\tsplitminimumfreelines{0}% \def\tsplitminimumfreespace{0pt}% - \setbox\tsplitcontent \vbox{}% - \setbox\tsplitresult \vbox{}% - \setbox\tsplithead \vbox{}% - \setbox\tsplitnext \vbox{}% - \setbox\tsplittail \vbox{}% + \setbox\tsplitcontent\emptyvbox + \setbox\tsplitresult \emptyvbox + \setbox\tsplithead \emptyvbox + \setbox\tsplitnext \emptyvbox + \setbox\tsplittail \emptyvbox \let\tsplitbeforeresult\donothing \let\tsplitafterresult \donothing \let\tsplitinbetween \donothing \let\tsplitbefore \donothing \let\tsplitafter \donothing \let\postprocesstsplit \donothing -} +\to \everyresettsplit \resettsplit diff --git a/Master/texmf-dist/tex/context/base/task-ini.lua b/Master/texmf-dist/tex/context/base/task-ini.lua index aaa97ec4910..c1c22e8ccd9 100644 --- a/Master/texmf-dist/tex/context/base/task-ini.lua +++ b/Master/texmf-dist/tex/context/base/task-ini.lua @@ -11,84 +11,139 @@ if not modules then modules = { } end modules ['task-ini'] = { -- -- we can disable more handlers and enable then when really used (*) -tasks.appendaction("processors", "normalizers", "fonts.collections.process") -- todo -tasks.appendaction("processors", "normalizers", "fonts.checkers.missing") -- disabled - -tasks.appendaction("processors", "characters", "chars.handle_mirroring") -- disabled -tasks.appendaction("processors", "characters", "chars.handle_casing") -- disabled -tasks.appendaction("processors", "characters", "chars.handle_digits") -- disabled -tasks.appendaction("processors", "characters", "chars.handle_breakpoints") -- disabled -tasks.appendaction("processors", "characters", "scripts.preprocess") - -tasks.appendaction("processors", "words", "kernel.hyphenation") -- always on -tasks.appendaction("processors", "words", "languages.words.check") -- disabled - -tasks.appendaction("processors", "fonts", "nodes.process_characters") -- maybe todo -tasks.appendaction("processors", "fonts", "nodes.inject_kerns") -- maybe todo -tasks.appendaction("processors", "fonts", "nodes.protect_glyphs", nil, "nohead") -- maybe todo -tasks.appendaction("processors", "fonts", "kernel.ligaturing") -- always on -tasks.appendaction("processors", "fonts", "kernel.kerning") -- always on -tasks.appendaction("processors", "fonts", "nodes.stripping.process") -- disabled (might move) - -tasks.appendaction("processors", "lists", "lists.handle_spacing") -- disabled -tasks.appendaction("processors", "lists", "lists.handle_kerning") -- disabled - -tasks.appendaction("shipouts", "normalizers", "nodes.cleanup_page") -- maybe todo -tasks.appendaction("shipouts", "normalizers", "nodes.add_references") -- disabled -tasks.appendaction("shipouts", "normalizers", "nodes.add_destinations") -- disabled -tasks.appendaction("shipouts", "normalizers", "nodes.rules.process") -- disabled -tasks.appendaction("shipouts", "normalizers", "nodes.shifts.process") -- disabled - -tasks.appendaction("shipouts", "finishers", "shipouts.handle_color") -- disabled -tasks.appendaction("shipouts", "finishers", "shipouts.handle_transparency") -- disabled -tasks.appendaction("shipouts", "finishers", "shipouts.handle_colorintent") -- disabled -tasks.appendaction("shipouts", "finishers", "shipouts.handle_negative") -- disabled -tasks.appendaction("shipouts", "finishers", "shipouts.handle_effect") -- disabled -tasks.appendaction("shipouts", "finishers", "shipouts.handle_viewerlayer") -- disabled - -tasks.appendaction("math", "normalizers", "noads.relocate_characters", nil, "nohead") -- always on -tasks.appendaction("math", "normalizers", "noads.resize_characters", nil, "nohead") -- always on -tasks.appendaction("math", "normalizers", "noads.respace_characters", nil, "nohead") -- always on - -tasks.appendaction("math", "builders", "noads.mlist_to_hlist") -- always on - --- quite experimental - -tasks.appendaction("finalizers", "lists", "nodes.repackage_graphicvadjust") -- todo - --- rather new - -tasks.appendaction("mvlbuilders", "normalizers", "nodes.migrate_outwards") -tasks.appendaction("mvlbuilders", "normalizers", "nodes.handle_page_spacing") -- last ! - -tasks.appendaction("vboxbuilders", "normalizers", "nodes.handle_vbox_spacing") +local tasks = nodes.tasks +local appendaction = tasks.appendaction +local disableaction = tasks.disableaction +local freezegroup = tasks.freezegroup +local freezecallbacks = callbacks.freeze + +appendaction("processors", "normalizers", "fonts.collections.process") -- todo +appendaction("processors", "normalizers", "fonts.checkers.missing") -- disabled + +appendaction("processors", "characters", "typesetters.cleaners.handler") -- disabled +appendaction("processors", "characters", "typesetters.directions.handler") -- disabled +appendaction("processors", "characters", "typesetters.cases.handler") -- disabled +appendaction("processors", "characters", "typesetters.breakpoints.handler") -- disabled +appendaction("processors", "characters", "scripts.preprocess") + +appendaction("processors", "words", "builders.kernel.hyphenation") -- always on +appendaction("processors", "words", "languages.words.check") -- disabled + +appendaction("processors", "fonts", "builders.paragraphs.solutions.splitters.split") -- experimental +appendaction("processors", "fonts", "nodes.handlers.characters") -- maybe todo +appendaction("processors", "fonts", "nodes.injections.handler") -- maybe todo +appendaction("processors", "fonts", "nodes.handlers.protectglyphs", nil, "nohead") -- maybe todo +appendaction("processors", "fonts", "builders.kernel.ligaturing") -- always on +appendaction("processors", "fonts", "builders.kernel.kerning") -- always on +appendaction("processors", "fonts", "nodes.handlers.stripping") -- disabled (might move) + +appendaction("processors", "lists", "typesetters.spacings.handler") -- disabled +appendaction("processors", "lists", "typesetters.kerns.handler") -- disabled +appendaction("processors", "lists", "typesetters.digits.handler") -- disabled (after otf handling) + +appendaction("shipouts", "normalizers", "nodes.handlers.cleanuppage") -- disabled +appendaction("shipouts", "normalizers", "typesetters.alignments.handler") +appendaction("shipouts", "normalizers", "nodes.references.handler") -- disabled +appendaction("shipouts", "normalizers", "nodes.destinations.handler") -- disabled +appendaction("shipouts", "normalizers", "nodes.rules.handler") -- disabled +appendaction("shipouts", "normalizers", "nodes.shifts.handler") -- disabled +appendaction("shipouts", "normalizers", "structures.tags.handler") -- disabled +appendaction("shipouts", "normalizers", "nodes.handlers.accessibility") -- disabled +appendaction("shipouts", "normalizers", "nodes.handlers.backgrounds") -- disabled + +appendaction("shipouts", "finishers", "attributes.colors.handler") -- disabled +appendaction("shipouts", "finishers", "attributes.transparencies.handler") -- disabled +appendaction("shipouts", "finishers", "attributes.colorintents.handler") -- disabled +appendaction("shipouts", "finishers", "attributes.negatives.handler") -- disabled +appendaction("shipouts", "finishers", "attributes.effects.handler") -- disabled +appendaction("shipouts", "finishers", "attributes.viewerlayers.handler") -- disabled + +appendaction("math", "normalizers", "noads.handlers.unscript", nil, "nohead") -- always on (maybe disabled) +appendaction("math", "normalizers", "noads.handlers.relocate", nil, "nohead") -- always on +appendaction("math", "normalizers", "noads.handlers.collapse", nil, "nohead") -- always on +appendaction("math", "normalizers", "noads.handlers.resize", nil, "nohead") -- always on +appendaction("math", "normalizers", "noads.handlers.respace", nil, "nohead") -- always on +appendaction("math", "normalizers", "noads.handlers.check", nil, "nohead") -- always on +appendaction("math", "normalizers", "noads.handlers.tags", nil, "nohead") -- disabled + +appendaction("math", "builders", "builders.kernel.mlist_to_hlist") -- always on + +-- quite experimental (nodes.handlers.graphicvadjust might go away) + +appendaction("finalizers", "lists", "nodes.handlers.graphicvadjust") -- todo +appendaction("finalizers", "fonts", "builders.paragraphs.solutions.splitters.optimize") -- experimental + +-- still experimental + +appendaction("mvlbuilders", "normalizers", "nodes.handlers.migrate") -- +appendaction("mvlbuilders", "normalizers", "builders.vspacing.pagehandler") -- last ! + +appendaction("vboxbuilders", "normalizers", "builders.vspacing.vboxhandler") -- -- speedup: only kick in when used -tasks.disableaction("processors", "fonts.checkers.missing") -tasks.disableaction("processors", "chars.handle_breakpoints") -tasks.disableaction("processors", "chars.handle_casing") -tasks.disableaction("processors", "chars.handle_digits") -tasks.disableaction("processors", "chars.handle_mirroring") -tasks.disableaction("processors", "languages.words.check") -tasks.disableaction("processors", "lists.handle_spacing") -tasks.disableaction("processors", "lists.handle_kerning") -tasks.disableaction("processors", "nodes.stripping.process") - -tasks.disableaction("shipouts", "nodes.rules.process") -tasks.disableaction("shipouts", "nodes.shifts.process") -tasks.disableaction("shipouts", "shipouts.handle_color") -tasks.disableaction("shipouts", "shipouts.handle_transparency") -tasks.disableaction("shipouts", "shipouts.handle_colorintent") -tasks.disableaction("shipouts", "shipouts.handle_effect") -tasks.disableaction("shipouts", "shipouts.handle_negative") -tasks.disableaction("shipouts", "shipouts.handle_viewerlayer") - -tasks.disableaction("shipouts", "nodes.add_references") -tasks.disableaction("shipouts", "nodes.add_destinations") - -tasks.disableaction("mvlbuilders", "nodes.migrate_outwards") - -callbacks.freeze("find_.*_file", "find file using resolver") -callbacks.freeze("read_.*_file", "read file at once") -callbacks.freeze("open_.*_file", "open file for reading") +disableaction("processors", "fonts.checkers.missing") +disableaction("processors", "chars.handle_breakpoints") +disableaction("processors", "typesetters.cleaners.handler") +disableaction("processors", "typesetters.cases.handler") +disableaction("processors", "typesetters.digits.handler") +disableaction("processors", "typesetters.breakpoints.handler") +disableaction("processors", "typesetters.directions.handler") +disableaction("processors", "languages.words.check") +disableaction("processors", "typesetters.spacings.handler") +disableaction("processors", "typesetters.kerns.handler") +disableaction("processors", "nodes.handlers.stripping") + +disableaction("shipouts", "typesetters.alignments.handler") +disableaction("shipouts", "nodes.rules.handler") +disableaction("shipouts", "nodes.shifts.handler") +disableaction("shipouts", "attributes.colors.handler") +disableaction("shipouts", "attributes.transparencies.handler") +disableaction("shipouts", "attributes.colorintents.handler") +disableaction("shipouts", "attributes.effects.handler") +disableaction("shipouts", "attributes.negatives.handler") +disableaction("shipouts", "attributes.viewerlayers.handler") +disableaction("shipouts", "structures.tags.handler") +disableaction("shipouts", "nodes.handlers.accessibility") +disableaction("shipouts", "nodes.handlers.backgrounds") +disableaction("shipouts", "nodes.handlers.cleanuppage") + +disableaction("shipouts", "nodes.references.handler") +disableaction("shipouts", "nodes.destinations.handler") + +disableaction("mvlbuilders", "nodes.handlers.migrate") + +disableaction("processors", "builders.paragraphs.solutions.splitters.split") + +disableaction("finalizers", "builders.paragraphs.solutions.splitters.optimize") +disableaction("finalizers", "nodes.handlers.graphicvadjust") -- sort of obsolete + +disableaction("math", "noads.handlers.tags") + +freezecallbacks("find_.*_file", "find file using resolver") +freezecallbacks("read_.*_file", "read file at once") +freezecallbacks("open_.*_file", "open file for reading") + +-- experimental: + +freezegroup("processors", "normalizers") +freezegroup("processors", "characters") +freezegroup("processors", "words") +freezegroup("processors", "fonts") +freezegroup("processors", "lists") + +freezegroup("finalizers", "normalizers") +freezegroup("finalizers", "fonts") +freezegroup("finalizers", "lists") + +freezegroup("shipouts", "normalizers") +freezegroup("shipouts", "finishers") + +freezegroup("mvlbuilders", "normalizers") +freezegroup("vboxbuilders", "normalizers") + +--~ freezegroup("parbuilders", "lists") +--~ freezegroup("pagebuilders", "lists") + +freezegroup("math", "normalizers") +freezegroup("math", "builders") diff --git a/Master/texmf-dist/tex/context/base/thrd-pic.mkii b/Master/texmf-dist/tex/context/base/thrd-pic.mkii new file mode 100644 index 00000000000..3c25d8a81d1 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/thrd-pic.mkii @@ -0,0 +1,3694 @@ +% Since this file is not available in every distribution, we +% have copied the original in this file. The manuals to +% Wichura's PiCTeX and TaBlE packages are not available on +% line and are distributed by respectively the TeX Users Group +% and Personal TeX Inc. + +% We've patched this file for catcode ! because in luatex we use +% catcode tables and using unprotect/protect is cleaner. + +% This is PiCTeX, Version 1.1 9/21/87 + +% CAVEAT: The PiCTeX manual often has a more lucid explanation +% of any given topic than you will find in the internal documentation +% of the macros. + +% PiCTeX's commands can be classified into two groups: (1) public (or +% external), and (2) private (or internal). The public macros are +% discussed at length in the manual. The only discussion of the private +% macros is the internal documentation. The private macros all have +% names beginning with an exclamation point (!) of category code 11. +% Since in normal usage "!" has category code 12, these macros can't +% be accessed or modified by the general user. + +% The macros are organized into thematically related groups. For example, +% the macros dealing with dots & dashes are all in the DASHPATTERN group. +% The table below shows which macros are in which groups. The table +% covers all public macros, and many (but not all) of PiCTeX's upper level +% private macros. Following the table, the various groups are listed +% in the order in which they appear in the table. + +% *********************** TABLE OF GROUPS OF MACROS ********************** + +% HACKS: Utility macros +% \PiC +% \PiCTeX +% \placevalueinpts +% \!!loop +% \!cfor +% \!copylist +% \!ecfor +% \!etfor +% \!getnext +% \!getnextvalueof +% \!ifempty +% \!ifnextchar +% \!leftappend +% \!listaddon +% \!loop +% \!lop +% \!mlap +% \!not +% \!removept +% \!rightappend +% \!tfor +% \!vmlap +% \!wlet + +% ALLOCATION: Allocates registers + +% AREAS: Deals with plot areas +% \axis +% \grid +% \invisibleaxes +% \normalgraphs +% \plotheading +% \setplotarea +% \visibleaxes + +% ARROWS: Draws arrows +% \arrow +% \betweenarrows + +% BARS: Draws bars +% \putbar +% \setbars + +% BOXES: Draws rectangles +% \frame +% \putrectangle +% \rectangle +% \shaderectangleson +% \shaderectanglesoff + +% CURVES: Upper level plot commands +% \hshade +% \plot +% \sethistograms +% \setlinear +% \setquadratic +% \vshade + +% DASHPATTERNS: Sets up dash patterns +% \findlength +% \setdashes +% \setdashesnear +% \setdashpattern +% \setdots +% \setdotsnear +% \setsolid +% \!dashingoff +% \!dashingon + +% DIVISION: Does long division of dimension registers +% \Divide +% \!divide + +% ELLIPSES: Draws ellipses and circles +% \circulararc +% \ellipticalarc + +% RULES: Draws rules, i.e., horizontal & vertical lines +% \putrule +% \!putdashedhline +% \!putdashedvline +% \!puthline +% \!putsolidhline +% \!putsolidvline +% \!putvline + +% LINEAR ARC: Draws straight lines -- solid and dashed +% \inboundscheckoff +% \inboundscheckon +% \!advancedashing +% \!drawlinearsegment +% \!initinboundscheck +% \!linearsolid +% \!lineardashed +% \!ljoin +% \!plotifinbounds +% \!start + +% LOGTEN: Log_10 function +% \!logten + +% PICTURES: Basic setups for PiCtures; \put commands +% \accountingoff +% \accountingon +% \beginpicture +% \endpicture +% \endpicturesave +% \lines +% \multiput +% \put +% \setcoordinatemode +% \setcoordinatesystem +% \setdimensionmode +% \stack +% \Lines +% \Xdistance +% \Ydistance +% \!dimenput +% \!ifcoordmode +% \!ifdimenmode +% \!setcoordmode +% \!setdimenmode +% \!setputobject + +% PLOTTING: Things to do with plotting +% \dontsavelinesandcurves +% \replot +% \savelinesandcurves +% \setplotsymbol +% \writesavefile +% \!plot + +% PYTHAGORAS: Euclidean distance function +% \placehypotenuse +% \!Pythag + +% QUADRATIC ARC: Draws a quadratic arc +% \!qjoin + +% ROTATIONS: Handles rotations +% \startrotation +% \stoprotation +% \!rotateaboutpivot +% \!rotateonly + +% SHADING: Handles shading +% \setshadegrid +% \setshadesymbol +% \!lshade +% \!qshade +% \!starthshade +% \!startvshade + +% TICKS: Draws ticks on graphs +% \gridlines +% \loggedticks +% \nogridlines +% \ticksin +% \ticksout +% \unloggesticks + +% ***************** END OF TABLE OF GROUPS OF MACROS ******************** + + +% \catcode`!=11 % ***** THIS MUST NEVER BE OMITTED + +\unprotect + +% ******************************* +% *** HACKS (Utility macros) *** +% ******************************* + +% ** User commands +% ** \PiC{P\kern-.12em\lower.5ex\hbox{I}\kern-.075emC} +% ** \PiCTeX{\PiC\kern-.11em\TeX} +% ** \placevalueinpts of in {CONTROL SEQUENCE} + +% ** Internal commands +% ** \!ifnextchar{CHARACTER}{TRUE ACTION}{FALSE ACTION} +% ** \!tfor NAME := LIST \do {BODY} +% ** \!etfor NAME:= LIST \do {BODY} +% ** \!cfor NAME := LIST \do {BODY} +% ** \!ecfor NAME:= LIST \do {BODY} +% ** \!ifempty{MACRO}{TRUE ACTION}{FALSE ACTION} +% ** \!getnext\\ITEMfrom\LIST +% ** \!getnextvalueof\DIMEN\from\LIST +% ** \!copylist\LISTMACRO_A\to\LISTMACRO_B +% ** \!wlet\CONTROL_SEQUENCE_A=\CONTROL_SEQUENCE_B +% ** \!listaddon ITEM LIST +% ** \!rightappendITEM\withCS\to\LISTMACRO +% ** \!leftappendITEM\withCS\to\LISTMACRO +% ** \!lop\LISTMACRO\to\ITEM +% ** \!loop ... repeat +% ** \!!loop ... repeat +% ** \!removept{DIMENSION REGISTER}{CONTROL SEQUENCE} +% ** \!mlap{...} +% ** \!vmlap{...} +% ** \!not{TEK if-CONDITION} + +% ** First, here are the the PiCTeX logo, and the syllable PiC: +\def\PiC{P\kern-.12em\lower.5ex\hbox{I}\kern-.075emC} +\def\PiCTeX{\PiC\kern-.11em\TeX} + +% ** The following macro expands to parameter #2 or parameter #3 according to +% ** whether the next non-blank character following the macro is or is not #1. +% ** Blanks following the macro are gobbled. +\def\!ifnextchar#1#2#3{% + \let\!testchar=#1% + \def\!first{#2}% + \def\!second{#3}% + \futurelet\!nextchar\!testnext} +\def\!testnext{% + \ifx \!nextchar \!spacetoken + \let\!next=\!skipspacetestagain + \else + \ifx \!nextchar \!testchar + \let\!next=\!first + \else + \let\!next=\!second + \fi + \fi + \!next} +\def\\{\!skipspacetestagain} + \expandafter\def\\ {\futurelet\!nextchar\!testnext} +\def\\{\let\!spacetoken= } \\ % ** set \spacetoken to a space token + + +% ** Borrow the "tfor" macro from Latex: +% ** \!tfor NAME := LIST \do {BODY} +% ** if, before expansion, LIST = T1 ... Tn, where each Ti is a token +% ** or {...}, then executes BODY n times, with NAME = Ti on the +% ** i-th iteration. Works for n=0. +\def\!tfor#1:=#2\do#3{% + \edef\!fortemp{#2}% + \ifx\!fortemp\!empty + \else + \!tforloop#2\!nil\!nil\!!#1{#3}% + \fi} +\def\!tforloop#1#2\!!#3#4{% + \def#3{#1}% + \ifx #3\!nnil + \let\!nextwhile=\!fornoop + \else + #4\relax + \let\!nextwhile=\!tforloop + \fi + \!nextwhile#2\!!#3{#4}} + + +% ** \!etfor NAME:= LIST\do {BODY} +% ** This is like \!cfor, but LIST is any balanced token list whose complete +% ** expansion has the form T1 ... Tn +\def\!etfor#1:=#2\do#3{% + \def\!!tfor{\!tfor#1:=}% + \edef\!!!tfor{#2}% + \expandafter\!!tfor\!!!tfor\do{#3}} + + +% ** modify the Latex \tfor (token-for) loop to a \cfor (comma-for) loop. +% ** \!cfor NAME := LIST \do {BODY} +% ** if, before expansion, LIST = a1,a2,...an, then executes BODY n times, +% ** with NAME = ai on the i-th iteration. Works for n=0. +\def\!cfor#1:=#2\do#3{% + \edef\!fortemp{#2}% + \ifx\!fortemp\!empty + \else + \!cforloop#2,\!nil,\!nil\!!#1{#3}% + \fi} +\def\!cforloop#1,#2\!!#3#4{% + \def#3{#1}% + \ifx #3\!nnil + \let\!nextwhile=\!fornoop + \else + #4\relax + \let\!nextwhile=\!cforloop + \fi + \!nextwhile#2\!!#3{#4}} + + +% ** \!ecfor NAME:= LIST\do {BODY} +% ** This is like \!cfor, but LIST is any balanced token list whose complete +% ** expansion has the form a1,a2,...,an. +\def\!ecfor#1:=#2\do#3{% + \def\!!cfor{\!cfor#1:=}% + \edef\!!!cfor{#2}% + \expandafter\!!cfor\!!!cfor\do{#3}} + + +\def\!empty{} +\def\!nnil{\!nil} +\def\!fornoop#1\!!#2#3{} + + +% ** \!ifempty{ARG}{TRUE ACTION}{FALSE ACTION} +\def\!ifempty#1#2#3{% + \edef\!emptyarg{#1}% + \ifx\!emptyarg\!empty + #2% + \else + #3% + \fi} + +% ** \!getnext\\ITEMfrom\LIST +% ** \LIST has the form \\{item1}\\{item2}\\{item3}...\\{itemk} +% ** This routine sets \ITEM to item1, and cycles \LIST to +% ** \\{item2}\\{item3}...\\{itemk}\\{item1} +\def\!getnext#1\from#2{% + \expandafter\!gnext#2\!#1#2}% +\def\!gnext\\#1#2\!#3#4{% + \def#3{#1}% + \def#4{#2\\{#1}}% + \ignorespaces} + + +% ** \!getnextvalueof\DIMEN\from\LIST +% ** Similar to !getnext. +% ** \LIST has the form \\{dimen1}\\{dimen2}\\{dimen3} ... +% ** \DIMEN is a dimension register +% ** Works also for counts +% +\def\!getnextvalueof#1\from#2{% + \expandafter\!gnextv#2\!#1#2}% +\def\!gnextv\\#1#2\!#3#4{% + #3=#1% + \def#4{#2\\{#1}}% + \ignorespaces} + + +% ** \!copylist\LISTMACROA\to\LISTMACROB +% ** makes the replacement text of LISTMACRO B identical to that of +% ** list macro A. +\def\!copylist#1\to#2{% + \expandafter\!!copylist#1\!#2} +\def\!!copylist#1\!#2{% + \def#2{#1}\ignorespaces} + + +% ** \!wlet\CSA=\CSB +% ** lets control sequence \CSB = control sequence \CSA, and writes a +% ** message to that effect in the log file using plain TEK's \wlog +\def\!wlet#1=#2{% + \let#1=#2 + \wlog{\string#1=\string#2}} + +% ** \!listaddon ITEM LIST +% ** LIST <-- LIST \\ ITEM +\def\!listaddon#1#2{% + \expandafter\!!listaddon#2\!{#1}#2} +\def\!!listaddon#1\!#2#3{% + \def#3{#1\\#2}} + +% ** \!rightappendITEM\to\LISTMACRO +% ** \LISTMACRO --> \LISTMACRO\\{ITEM} +%\def\!rightappend#1\to#2{\expandafter\!!rightappend#2\!{#1}#2} +%\def\!!rightappend#1\!#2#3{\def#3{#1\\{#2}}} + + +% ** \!rightappendITEM\withCS\to\LISTMACRO +% ** \LISTMACRO --> \LISTMACRO||CS||{ITEM} +\def\!rightappend#1\withCS#2\to#3{\expandafter\!!rightappend#3\!#2{#1}#3} +\def\!!rightappend#1\!#2#3#4{\def#4{#1#2{#3}}} + + +% ** \!leftappendITEM\withCS\to\LISTMACRO +% ** \LISTMACRO --> CS||{ITEM}||\LISTMACRO +\def\!leftappend#1\withCS#2\to#3{\expandafter\!!leftappend#3\!#2{#1}#3} +\def\!!leftappend#1\!#2#3#4{\def#4{#2{#3}#1}} + + +% ** \!lop\LISTMACRO\to\ITEM +% ** \\{item1}\\{item2}\\{item3} ... --> \\{item2}\\{item3} ... +% ** item1 --> \ITEM +\def\!lop#1\to#2{\expandafter\!!lop#1\!#1#2} +\def\!!lop\\#1#2\!#3#4{\def#4{#1}\def#3{#2}} + + +% ** \!placeNUMBER\of\LISTMACRO\in\ITEM +% ** the NUMBERth item of \LISTMACRO --> replacement text of \ITEM +%\def\!place#1\of#2\in#3{\def#3{\outofrange}% +%{\count0=#1\def\\##1{\advance\count0-1 \ifnum\count0=0 \gdef#3{##1}\fi}#2}} + + +% ** Following code converts a commalist to a list macro, with all items +% ** fully expanded. +%\!ecfor\item:=\commalist\do{\expandafter\!rightappend\item\to\list} + + +% ** \!loop ... repeat +% ** This is exactly like TEX's \loop ... repeat. It can be used in nesting +% ** two loops, without puting the inner one inside a group. +\def\!loop#1\repeat{\def\!body{#1}\!iterate} +\def\!iterate{\!body\let\!next=\!iterate\else\let\!next=\relax\fi\!next} + +% ** \!!loop ... repeat +% ** This is exactly like TEX's \loop ... repeat. It can be used in nesting +% ** two loops, without puting the inner one inside a group. +\def\!!loop#1\repeat{\def\!!body{#1}\!!iterate} +\def\!!iterate{\!!body\let\!!next=\!!iterate\else\let\!!next=\relax\fi\!!next} +% (\multiput uses \!!loop) + +% ** \!removept{DIMENREG}{\CS} +% ** Defines the control sequence CS to be the value (in points) in the +% ** dimension register DIMENREG (but without the "pt" TEK usually adds) +% ** E.g., after \dimen0=12.3pt \!removept\dimen0\A, \A expands to 12.3 +\def\!removept#1#2{\edef#2{\expandafter\!!removePT\the#1}} +{\catcode`p=12 \catcode`t=12 \gdef\!!removePT#1pt{#1}} + +% ** \pladevalueinpts of in {CONTROL SEQUENCE} +\def\placevalueinpts of <#1> in #2 {% + \!removept{#1}{#2}} + +% ** \!mlap{...} \!vmlap{...} +% ** Center ... in a box of width 0. +\def\!mlap#1{\hbox to 0pt{\hss#1\hss}} +\def\!vmlap#1{\vbox to 0pt{\vss#1\vss}} + +% ** \!not{TEK if-CONDITION} +% ** By a TEK if-CONDITION is meant something like +% ** \ifnum\N<0, or \ifdim\A>\B +% ** \!not produces an if-condition which is false if the original condition +% ** is true, and true if the original condition is false. +\def\!not#1{% + #1\relax + \!switchfalse + \else + \!switchtrue + \fi + \if!switch + \ignorespaces} + + +% ******************* +% *** ALLOCATIONS *** +% ******************* + +% This section allocates all the registers PiCTeX uses. Following +% each allocation is a string of the form ....N.D...L......... ; +% the various letters show which sections of PiCTeX make explicit +% reference to that register, according to the following code: + +% H Hacks +% A Areas +% W arroWs +% B Bars +% X boXes +% C Curves +% D Dashpattterns +% V diVision +% E Ellipses +% U rUles +% L Linear arc +% G loGten +% P Pictures +% O plOtting +% Y pYthagoras +% Q Quadratic arc +% R Rotations +% S Shading +% T Ticks + +% Turn off messages from TeX's allocation macros +\let\!!!wlog=\wlog % "\wlog" is defined in plain TeX +\def\wlog#1{} + +\newdimen\headingtoplotskip %.A................. +\newdimen\linethickness %.A..X....U........T +\newdimen\longticklength %.A................T +\newdimen\plotsymbolspacing %......D...L....Q... +\newdimen\shortticklength %.A................T +\newdimen\stackleading %.A..........P...... +\newdimen\tickstovaluesleading %.A................T +\newdimen\totalarclength %......D...L....Q... +\newdimen\valuestolabelleading %.A................. + +\newbox\!boxA %.AW...............T +\newbox\!boxB %..W................ +\newbox\!picbox %............P...... +\newbox\!plotsymbol %..........L..O..... +\newbox\!putobject %............PO...S. +\newbox\!shadesymbol %.................S. + +\newcount\!countA %.A....D..UL....Q.ST +\newcount\!countB %......D..U.....Q.ST +\newcount\!countC %...............Q..T +\newcount\!countD %................... +\newcount\!countE %.............O....T +\newcount\!countF %.............O....T +\newcount\!countG %..................T +\newcount\!fiftypt %.........U......... +\newcount\!intervalno %..........L....Q... +\newcount\!npoints %..........L........ +\newcount\!nsegments %.........U......... +\newcount\!ntemp %............P...... +\newcount\!parity %.................S. +\newcount\!scalefactor %..................T +\newcount\!tfs %.......V........... +\newcount\!tickcase %..................T + +\newdimen\!Xleft %............P...... +\newdimen\!Xright %............P...... +\newdimen\!Xsave %.A................T +\newdimen\!Ybot %............P...... +\newdimen\!Ysave %.A................T +\newdimen\!Ytop %............P...... +\newdimen\!angle %........E.......... +\newdimen\!arclength %..W......UL....Q... +\newdimen\!areabloc %.A........L........ +\newdimen\!arealloc %.A........L........ +\newdimen\!arearloc %.A........L........ +\newdimen\!areatloc %.A........L........ +\newdimen\!bshrinkage %.................S. +\newdimen\!checkbot %..........L........ +\newdimen\!checkleft %..........L........ +\newdimen\!checkright %..........L........ +\newdimen\!checktop %..........L........ +\newdimen\!dimenA %.AW.X.DVEUL..OYQRST +\newdimen\!dimenB %....X.DVEU...O.QRS. +\newdimen\!dimenC %..W.X.DVEU......RS. +\newdimen\!dimenD %..W.X.DVEU....Y.RS. +\newdimen\!dimenE %..W........G..YQ.S. +\newdimen\!dimenF %...........G..YQ.S. +\newdimen\!dimenG %...........G..YQ.S. +\newdimen\!dimenH %...........G..Y..S. +\newdimen\!dimenI %...BX.........Y.... +\newdimen\!distacross %..........L....Q... +\newdimen\!downlength %..........L........ +\newdimen\!dp %.A..X.......P....S. +\newdimen\!dshade %.................S. +\newdimen\!dxpos %..W......U..P....S. +\newdimen\!dxprime %...............Q... +\newdimen\!dypos %..WB.....U..P...... +\newdimen\!dyprime %...............Q... +\newdimen\!ht %.A..X.......P....S. +\newdimen\!leaderlength %......D..U......... +\newdimen\!lshrinkage %.................S. +\newdimen\!midarclength %...............Q... +\newdimen\!offset %.A................T +\newdimen\!plotheadingoffset %.A................. +\newdimen\!plotsymbolxshift %..........L..O..... +\newdimen\!plotsymbolyshift %..........L..O..... +\newdimen\!plotxorigin %..........L..O..... +\newdimen\!plotyorigin %..........L..O..... +\newdimen\!rootten %...........G....... +\newdimen\!rshrinkage %.................S. +\newdimen\!shadesymbolxshift %.................S. +\newdimen\!shadesymbolyshift %.................S. +\newdimen\!tenAa %...........G....... +\newdimen\!tenAc %...........G....... +\newdimen\!tenAe %...........G....... +\newdimen\!tshrinkage %.................S. +\newdimen\!uplength %..........L........ +\newdimen\!wd %....X.......P....S. +\newdimen\!wmax %...............Q... +\newdimen\!wmin %...............Q... +\newdimen\!xB %...............Q... +\newdimen\!xC %...............Q... +\newdimen\!xE %..W.....E.L....Q.S. +\newdimen\!xM %..W.....E......Q.S. +\newdimen\!xS %..W.....E.L....Q.S. +\newdimen\!xaxislength %.A................T +\newdimen\!xdiff %..........L........ +\newdimen\!xleft %............P...... +\newdimen\!xloc %..WB.....U.......S. +\newdimen\!xorigin %.A........L.P....S. +\newdimen\!xpivot %................R.. +\newdimen\!xpos %..........L.P..Q.ST +\newdimen\!xprime %...............Q... +\newdimen\!xright %............P...... +\newdimen\!xshade %.................S. +\newdimen\!xshift %..W.........PO...S. +\newdimen\!xtemp %............P...... +\newdimen\!xunit %.AWBX...EUL.P..QRS. +\newdimen\!xxE %........E.......... +\newdimen\!xxM %........E.......... +\newdimen\!xxS %........E.......... +\newdimen\!xxloc %..WB....EU......... +\newdimen\!yB %...............Q... +\newdimen\!yC %...............Q... +\newdimen\!yE %..W.....E.L....Q... +\newdimen\!yM %..W.....E......Q... +\newdimen\!yS %..W.....E.L....Q... +\newdimen\!yaxislength %.A................T +\newdimen\!ybot %............P...... +\newdimen\!ydiff %..........L........ +\newdimen\!yloc %..WB.....U.......S. +\newdimen\!yorigin %.A........L.P....S. +\newdimen\!ypivot %................R.. +\newdimen\!ypos %..........L.P..Q.ST +\newdimen\!yprime %...............Q... +\newdimen\!yshade %.................S. +\newdimen\!yshift %..W.........PO...S. +\newdimen\!ytemp %............P...... +\newdimen\!ytop %............P...... +\newdimen\!yunit %.AWBX...EUL.P..QRS. +\newdimen\!yyE %........E.......... +\newdimen\!yyM %........E.......... +\newdimen\!yyS %........E.......... +\newdimen\!yyloc %..WB....EU......... +\newdimen\!zpt %.AWBX.DVEULGP.YQ.ST + +\newif\if!axisvisible %.A................. +\newif\if!gridlinestoo %..................T +\newif\if!keepPO %................... +\newif\if!placeaxislabel %.A................. +\newif\if!switch %H.................. +\newif\if!xswitch %.A................T + +\newtoks\!axisLaBeL %.A................. +\newtoks\!keywordtoks %.A................. + +\newwrite\!replotfile %.............O..... + +\newhelp\!keywordhelp{The keyword mentioned in the error message in unknown. +Replace NEW KEYWORD in the indicated response by the keyword that +should have been specified.} %.A................. + +% The following commands assign alternate names to some of the +% above registers. "\!wlet" is defined in Hacks. +\!wlet\!!origin=\!xM %.A................T +\!wlet\!!unit=\!uplength %.A................T +\!wlet\!Lresiduallength=\!dimenG %.........U......... +\!wlet\!Rresiduallength=\!dimenF %.........U......... +\!wlet\!axisLength=\!distacross %.A................T +\!wlet\!axisend=\!ydiff %.A................T +\!wlet\!axisstart=\!xdiff %.A................T +\!wlet\!axisxlevel=\!arclength %.A................T +\!wlet\!axisylevel=\!downlength %.A................T +\!wlet\!beta=\!dimenE %...............Q... +\!wlet\!gamma=\!dimenF %...............Q... +\!wlet\!shadexorigin=\!plotxorigin %.................S. +\!wlet\!shadeyorigin=\!plotyorigin %.................S. +\!wlet\!ticklength=\!xS %..................T +\!wlet\!ticklocation=\!xE %..................T +\!wlet\!ticklocationincr=\!yE %..................T +\!wlet\!tickwidth=\!yS %..................T +\!wlet\!totalleaderlength=\!dimenE %.........U......... +\!wlet\!xone=\!xprime %....X.............. +\!wlet\!xtwo=\!dxprime %....X.............. +\!wlet\!ySsave=\!yM %................... +\!wlet\!ybB=\!yB %.................S. +\!wlet\!ybC=\!yC %.................S. +\!wlet\!ybE=\!yE %.................S. +\!wlet\!ybM=\!yM %.................S. +\!wlet\!ybS=\!yS %.................S. +\!wlet\!ybpos=\!yyloc %.................S. +\!wlet\!yone=\!yprime %....X.............. +\!wlet\!ytB=\!xB %.................S. +\!wlet\!ytC=\!xC %.................S. +\!wlet\!ytE=\!downlength %.................S. +\!wlet\!ytM=\!arclength %.................S. +\!wlet\!ytS=\!distacross %.................S. +\!wlet\!ytpos=\!xxloc %.................S. +\!wlet\!ytwo=\!dyprime %....X.............. + + +% Initial values for registers +\!zpt=0pt % static +\!xunit=1pt +\!yunit=1pt +\!arearloc=\!xunit +\!areatloc=\!yunit +\!dshade=5pt +\!leaderlength=24in +\!tfs=256 % static +\!wmax=5.3pt % static +\!wmin=2.7pt % static +\!xaxislength=\!xunit +\!xpivot=\!zpt +\!yaxislength=\!yunit +\!ypivot=\!zpt +\plotsymbolspacing=.4pt + \!dimenA=50pt \!fiftypt=\!dimenA % static + +\!rootten=3.162278pt % static +\!tenAa=8.690286pt % static (A5) +\!tenAc=2.773839pt % static (A3) +\!tenAe=2.543275pt % static (A1) + +% Initial values for control sequences +\def\!cosrotationangle{1} %................R.. +\def\!sinrotationangle{0} %................R.. +\def\!xpivotcoord{0} %................R.. +\def\!xref{0} %............P...... +\def\!xshadesave{0} %.................S. +\def\!ypivotcoord{0} %................R.. +\def\!yref{0} %............P...... +\def\!yshadesave{0} %.................S. +\def\!zero{0} %..................T + +% Reset TeX to report allocations +\let\wlog=\!!!wlog +% ************************************* +% *** AREAS: Deals with plot areas *** +% ************************************* +% +% ** User commands +% ** \setplotarea x from LEFT XCOORD to RIGTH XCOORD, y from BOTTOM YCOORD +% ** to TOP YCOORD +% ** \axis BOTTOM-LEFT-TOP-RIGHT [SHIFTEDTO xy=COORD] [VISIBLE-INVISIBLE] +% ** [LABEL {label}] [TICKS] / +% ** \visibleaxes +% ** \invisibleaxes +% ** \plotheading {HEADING} +% ** \grid {# of columns} {# of rows} +% ** \normalgraphs + +% ** \normalgraphs +% ** Sets defaults for graph setup. See Subsection 3.4 of manual. +\def\normalgraphs{% + \longticklength=.4\baselineskip + \shortticklength=.25\baselineskip + \tickstovaluesleading=.25\baselineskip + \valuestolabelleading=.8\baselineskip + \linethickness=.4pt + \stackleading=.17\baselineskip + \headingtoplotskip=1.5\baselineskip + \visibleaxes + \ticksout + \nogridlines + \unloggedticks} +% +% ** \setplotarea x from LEFT XCOORD to RIGTH XCOORD, y from BOTTOM YCOORD +% ** to TOP YCOORD +% ** Reserves space in PICBOX for a rectangular box with the indicated +% ** coordinates. Must be specified before calls to \axis, +% ** \grid, \plotheading. +% ** See Subsection 3.1 of the manual. +\def\setplotarea x from #1 to #2, y from #3 to #4 {% + \!arealloc=\!M{#1}\!xunit \advance \!arealloc -\!xorigin + \!areabloc=\!M{#3}\!yunit \advance \!areabloc -\!yorigin + \!arearloc=\!M{#2}\!xunit \advance \!arearloc -\!xorigin + \!areatloc=\!M{#4}\!yunit \advance \!areatloc -\!yorigin + \!initinboundscheck + \!xaxislength=\!arearloc \advance\!xaxislength -\!arealloc + \!yaxislength=\!areatloc \advance\!yaxislength -\!areabloc + \!plotheadingoffset=\!zpt + \!dimenput {{\setbox0=\hbox{}\wd0=\!xaxislength\ht0=\!yaxislength\box0}} + [bl] (\!arealloc,\!areabloc)} +% +% ** \visibleaxes, \invisibleaxes +% ** Switches for setting visibility of subsequent axes. +% ** See Subsection 3.2 of the manual. +\def\visibleaxes{% + \def\!axisvisibility{\!axisvisibletrue}} +\def\invisibleaxes{% + \def\!axisvisibility{\!axisvisiblefalse}} +% +% ** The next few macros enable the user to fix up an erroneous keyword +% ** in the \axis command. +% \newhelp is in ALLOCATIONS +% \newhelp\!keywordhelp{The keyword mentioned in the error message in unknown. +% Replace NEW KEYWORD in the indicated response by the keyword that +% should have been specified.} + +\def\!fixkeyword#1{% + \errhelp=\!keywordhelp + \errmessage{Unrecognized keyword `#1': \the\!keywordtoks{NEW KEYWORD}'}} + +% \newtoks\!keywordtoks In ALLOCATIONS. +\!keywordtoks={enter `i\fixkeyword} + +\def\fixkeyword#1{% + \!nextkeyword#1 } + +% ** \axis BOTTOM-LEFT-TOP-RIGHT [SHIFTEDTO xy=COORD] [VISIBLE-INVISIBLE] +% ** [LABEL {label}] [TICKS] / +% ** Exactly one of the keywords BOTTOM, LEFT, TOP, RIGHT must be +% ** specified. Axis is drawn along the indicated edge of the current +% ** plot area, shifted if the SHIFTEDTO option is used, visible or +% ** invisible according the selected option, with an optional LABEL, +% ** and optional TICKS (see ticks.tex for the options avialabel with +% ** TICKS). The TICKS option must be the last one specified. The \axis +% ** MUST be terminated with a / followed by a space. +% ** See Subsection 3.2 of the manual for more information. + +% ** The various options of the \axis command are processed by the +% ** \!nextkeyword macro defined below. For example, +% ** `\!nextkeyword shiftedto ' expands to `\!axisshiftedto'. +\def\axis {% + \def\!nextkeyword##1 {% + \expandafter\ifx\csname !axis##1\endcsname \relax + \def\!next{\!fixkeyword{##1}}% + \else + \def\!next{\csname !axis##1\endcsname}% + \fi + \!next}% + \!offset=\!zpt + \!axisvisibility + \!placeaxislabelfalse + \!nextkeyword} + +% ** This and the various macros that follow handle the keyword +% ** specifications on the \axis command +% ** See Subsection 3.2 of the manual. +\def\!axisbottom{% + \!axisylevel=\!areabloc + \def\!tickxsign{0}% + \def\!tickysign{-}% + \def\!axissetup{\!axisxsetup}% + \def\!axislabeltbrl{t}% + \!nextkeyword} + +\def\!axistop{% + \!axisylevel=\!areatloc + \def\!tickxsign{0}% + \def\!tickysign{+}% + \def\!axissetup{\!axisxsetup}% + \def\!axislabeltbrl{b}% + \!nextkeyword} + +\def\!axisleft{% + \!axisxlevel=\!arealloc + \def\!tickxsign{-}% + \def\!tickysign{0}% + \def\!axissetup{\!axisysetup}% + \def\!axislabeltbrl{r}% + \!nextkeyword} + +\def\!axisright{% + \!axisxlevel=\!arearloc + \def\!tickxsign{+}% + \def\!tickysign{0}% + \def\!axissetup{\!axisysetup}% + \def\!axislabeltbrl{l}% + \!nextkeyword} + +\def\!axisshiftedto#1=#2 {% + \if 0\!tickxsign + \!axisylevel=\!M{#2}\!yunit + \advance\!axisylevel -\!yorigin + \else + \!axisxlevel=\!M{#2}\!xunit + \advance\!axisxlevel -\!xorigin + \fi + \!nextkeyword} + +\def\!axisvisible{% + \!axisvisibletrue + \!nextkeyword} + +\def\!axisinvisible{% + \!axisvisiblefalse + \!nextkeyword} + +\def\!axislabel#1 {% + \!axisLaBeL={#1}% + \!placeaxislabeltrue + \!nextkeyword} + +\expandafter\def\csname !axis/\endcsname{% + \!axissetup % This could done already by "ticks"; if so, now \relax + \if!placeaxislabel + \!placeaxislabel + \fi + \if +\!tickysign % ** (A "top" axis) + \!dimenA=\!axisylevel + \advance\!dimenA \!offset % ** dimA = top of the axis structure + \advance\!dimenA -\!areatloc % ** dimA = excess over the plot area + \ifdim \!dimenA>\!plotheadingoffset + \!plotheadingoffset=\!dimenA % ** Greatest excess over the plot area + \fi + \fi} + +% ** \grid {c} {r} +% ** Partitions the plot area into c columns and r rows; see Subsection 3.3 +% ** of the manual. +% ** (Other grid patterns can be drawn with the TICKS option of the \axis +% ** command. +\def\grid #1 #2 {% + \!countA=#1\advance\!countA 1 + \axis bottom invisible ticks length <\!zpt> andacross quantity {\!countA} / + \!countA=#2\advance\!countA 1 + \axis left invisible ticks length <\!zpt> andacross quantity {\!countA} / } + +% ** \plotheading{HEADING} +% ** Places HEADING centered above the top of the plotarea (and above +% ** any top axis ticks marks, tick labels, and axis label); see +% ** Subsection 3.3 of the manual. +\def\plotheading#1 {% + \advance\!plotheadingoffset \headingtoplotskip + \!dimenput {#1} [B] <.5\!xaxislength,\!plotheadingoffset> + (\!arealloc,\!areatloc)} + +% ** From here on, the routines are internal. +\def\!axisxsetup{% + \!axisxlevel=\!arealloc + \!axisstart=\!arealloc + \!axisend=\!arearloc + \!axisLength=\!xaxislength + \!!origin=\!xorigin + \!!unit=\!xunit + \!xswitchtrue + \if!axisvisible + \!makeaxis + \fi} + +\def\!axisysetup{% + \!axisylevel=\!areabloc + \!axisstart=\!areabloc + \!axisend=\!areatloc + \!axisLength=\!yaxislength + \!!origin=\!yorigin + \!!unit=\!yunit + \!xswitchfalse + \if!axisvisible + \!makeaxis + \fi} + +\def\!makeaxis{% + \setbox\!boxA=\hbox{% (Make a pseudo-y[x] tick for an x[y]-axis) + \beginpicture + \!setdimenmode + \setcoordinatesystem point at {\!zpt} {\!zpt} + \putrule from {\!zpt} {\!zpt} to + {\!tickysign\!tickysign\!axisLength} + {\!tickxsign\!tickxsign\!axisLength} + \endpicturesave <\!Xsave,\!Ysave>}% + \wd\!boxA=\!zpt + \!placetick\!axisstart} + +\def\!placeaxislabel{% + \advance\!offset \valuestolabelleading + \if!xswitch + \!dimenput {\the\!axisLaBeL} [\!axislabeltbrl] + <.5\!axisLength,\!tickysign\!offset> (\!axisxlevel,\!axisylevel) + \advance\!offset \!dp % ** advance offset by the "tallness" + \advance\!offset \!ht % ** of the label + \else + \!dimenput {\the\!axisLaBeL} [\!axislabeltbrl] + <\!tickxsign\!offset,.5\!axisLength> (\!axisxlevel,\!axisylevel) + \fi + \!axisLaBeL={}} + + +% ******************************* +% *** ARROWS (Draws arrows) *** +% ******************************* +% +% ** User commands +% ** \arrow [MID FRACTION, BASE FRACTION] +% ** [] from XFROM YFROM to XTO YTO +% ** \betweenarrows {TEXT} [orientation & shift] from XFROM YFROM to XTO YTO + +% ** \arrow [MID FRACTION, BASE FRACTION] +% ** [] from XFROM YFROM to XTO YTO +% ** Draws an arrow from (XFROM,YFROM) to (XTO,YTO). The arrow head +% ** is constructed two quadratic arcs, which extend back a distance +% ** ARROW HEAD LENGTH (a dimension) on both sides of the arrow shaft. +% ** All the way back the arcs are a distance BASE FRACTION*ARROW HEAD +% ** LENGTH apart, while half-way back they are a distance MID FRACTION* +% ** ARROW HEAD LENGTH apart. is optional, and has +% ** its usual interpreation. See Subsection 5.4 of the manual. + +\def\arrow <#1> [#2,#3]{% + \!ifnextchar<{\!arrow{#1}{#2}{#3}}{\!arrow{#1}{#2}{#3}<\!zpt,\!zpt> }} + +\def\!arrow#1#2#3<#4,#5> from #6 #7 to #8 #9 {% +% +% ** convert to dimensions + \!xloc=\!M{#8}\!xunit + \!yloc=\!M{#9}\!yunit + \!dxpos=\!xloc \!dimenA=\!M{#6}\!xunit \advance \!dxpos -\!dimenA + \!dypos=\!yloc \!dimenA=\!M{#7}\!yunit \advance \!dypos -\!dimenA + \let\!MAH=\!M% ** save current c/d mode + \!setdimenmode% ** go into dimension mode +% + \!xshift=#4\relax \!yshift=#5\relax% ** pick up shift + \!reverserotateonly\!xshift\!yshift% ** back rotate shift + \advance\!xshift\!xloc \advance\!yshift\!yloc +% +% ** draw shaft of arrow + \!xS=-\!dxpos \advance\!xS\!xshift + \!yS=-\!dypos \advance\!yS\!yshift + \!start (\!xS,\!yS) + \!ljoin (\!xshift,\!yshift) +% +% ** find 32*cosine and 32*sine of angle of rotation + \!Pythag\!dxpos\!dypos\!arclength + \!divide\!dxpos\!arclength\!dxpos + \!dxpos=32\!dxpos \!removept\!dxpos\!!cos + \!divide\!dypos\!arclength\!dypos + \!dypos=32\!dypos \!removept\!dypos\!!sin +% +% ** construct arrowhead + \!halfhead{#1}{#2}{#3}% ** draw half of arrow head + \!halfhead{#1}{-#2}{-#3}% ** draw other half +% + \let\!M=\!MAH% ** restore old c/d mode + \ignorespaces} +% +% ** draw half of arrow head + \def\!halfhead#1#2#3{% + \!dimenC=-#1% + \divide \!dimenC 2 % ** half way back + \!dimenD=#2\!dimenC% ** half the mid width + \!rotate(\!dimenC,\!dimenD)by(\!!cos,\!!sin)to(\!xM,\!yM) + \!dimenC=-#1% ** all the way back + \!dimenD=#3\!dimenC + \!dimenD=.5\!dimenD% ** half the full width + \!rotate(\!dimenC,\!dimenD)by(\!!cos,\!!sin)to(\!xE,\!yE) + \!start (\!xshift,\!yshift) + \advance\!xM\!xshift \advance\!yM\!yshift + \advance\!xE\!xshift \advance\!yE\!yshift + \!qjoin (\!xM,\!yM) (\!xE,\!yE) + \ignorespaces} + + +% ** \betweenarrows {TEXT} [orientation & shift] from XFROM YFROM to XTO YTO +% ** Makes things like <--- text --->, using arrow heads from TeX's fonts. +% ** See Subsection 5.4 of the manual. +\def\betweenarrows #1#2 from #3 #4 to #5 #6 {% + \!xloc=\!M{#3}\!xunit \!xxloc=\!M{#5}\!xunit% + \!yloc=\!M{#4}\!yunit \!yyloc=\!M{#6}\!yunit% + \!dxpos=\!xxloc \advance\!dxpos by -\!xloc + \!dypos=\!yyloc \advance\!dypos by -\!yloc + \advance\!xloc .5\!dxpos + \advance\!yloc .5\!dypos +% + \let\!MBA=\!M% ** save current coord\dimen mode + \!setdimenmode% ** express locations in dimens + \ifdim\!dypos=\!zpt + \ifdim\!dxpos<\!zpt \!dxpos=-\!dxpos \fi + \put {\!lrarrows{\!dxpos}{#1}}#2{} at {\!xloc} {\!yloc} + \else + \ifdim\!dxpos=\!zpt + \ifdim\!dypos<\!zpt \!dypos=-\!zpt \fi + \put {\!udarrows{\!dypos}{#1}}#2{} at {\!xloc} {\!yloc} + \fi + \fi + \let\!M=\!MBA% ** restore previous c/d mode + \ignorespaces} + +% ** Subroutine for left-right between arrows +\def\!lrarrows#1#2{% #1=width, #2=text + {\setbox\!boxA=\hbox{$\mkern-2mu\mathord-\mkern-2mu$}% + \setbox\!boxB=\hbox{$\leftarrow$}\!dimenE=\ht\!boxB + \setbox\!boxB=\hbox{}\ht\!boxB=2\!dimenE + \hbox to #1{$\mathord\leftarrow\mkern-6mu + \cleaders\copy\!boxA\hfil + \mkern-6mu\mathord-$% + \kern.4em $\vcenter{\box\!boxB}$$\vcenter{\hbox{#2}}$\kern.4em + $\mathord-\mkern-6mu + \cleaders\copy\!boxA\hfil + \mkern-6mu\mathord\rightarrow$}}} + +% ** Subroutine for up-down between arrows +\def\!udarrows#1#2{% #1=width, #2=text + {\setbox\!boxB=\hbox{#2}% + \setbox\!boxA=\hbox to \wd\!boxB{\hss$\vert$\hss}% + \!dimenE=\ht\!boxA \advance\!dimenE \dp\!boxA \divide\!dimenE 2 + \vbox to #1{\offinterlineskip + \vskip .05556\!dimenE + \hbox to \wd\!boxB{\hss$\mkern.4mu\uparrow$\hss}\vskip-\!dimenE + \cleaders\copy\!boxA\vfil + \vskip-\!dimenE\copy\!boxA + \vskip\!dimenE\copy\!boxB\vskip.4em + \copy\!boxA\vskip-\!dimenE + \cleaders\copy\!boxA\vfil + \vskip-\!dimenE \hbox to \wd\!boxB{\hss$\mkern.4mu\downarrow$\hss} + \vskip .05556\!dimenE}}} + + +% *************************** +% *** BARS (Draws bars) *** +% *************************** +% +% ** User commands: +% ** \putbar [] breadth from XSTART YSTART +% ** to XEND YEND +% ** \setbars [] breadth baseline at XY = COORD +% ** [baselabels ([B_ORIENTATION_x,B_ORIENTATION_y] )] +% ** [endlabels ([E_ORIENTATION_x,E_ORIENTATION_y] )] + + +% ** \putbar [] breadth from XSTART YSTART +% ** to XEND YEND +% ** Either XSTART=XEND or YSTART=YEND. Draws a rectangle between +% ** (XSTART,YSTART) & (XEND,YEND). The "depth" of the rectangle +% ** is determined by those two plot positions; its other +% ** dimension "breadth" is specified by the dimension BREADTH. +% ** See Subsection 4.2 of the manual. +\def\putbar#1breadth <#2> from #3 #4 to #5 #6 {% + \!xloc=\!M{#3}\!xunit \!xxloc=\!M{#5}\!xunit% + \!yloc=\!M{#4}\!yunit \!yyloc=\!M{#6}\!yunit% + \!dypos=\!yyloc \advance\!dypos by -\!yloc + \!dimenI=#2 +% + \ifdim \!dimenI=\!zpt % ** If 0 breadth + \putrule#1from {#3} {#4} to {#5} {#6} % ** Then draw line + \else % ** Else, put in a rectangle + \let\!MBar=\!M% ** save current c/d mode + \!setdimenmode % ** go into dimension mode + \divide\!dimenI 2 + \ifdim \!dypos=\!zpt + \advance \!yloc -\!dimenI % ** Equal y coordinates + \advance \!yyloc \!dimenI + \else + \advance \!xloc -\!dimenI % ** Equal x coordinates + \advance \!xxloc \!dimenI + \fi + \putrectangle#1corners at {\!xloc} {\!yloc} and {\!xxloc} {\!yyloc} + \let\!M=\!MBar % ** restore c/d mode + \fi + \ignorespaces} + + +% ** \setbars [] breadth baseline at XY = COORD +% ** [baselabels ([B_ORIENTATION_x,B_ORIENTATION_y] )] +% ** [endlabels ([E_ORIENTATION_x,E_ORIENTATION_y] )] +% ** This command puts PiCTeX into the bar graph drawing mode described +% ** in Subsection 4.4 of the manual. +\def\setbars#1breadth <#2> baseline at #3 = #4 {% + \edef\!barshift{#1}% + \edef\!barbreadth{#2}% + \edef\!barorientation{#3}% + \edef\!barbaseline{#4}% + \def\!bardobaselabel{\!bardoendlabel}% + \def\!bardoendlabel{\!barfinish}% + \let\!drawcurve=\!barcurve + \!setbars} +\def\!setbars{% + \futurelet\!nextchar\!!setbars} +\def\!!setbars{% + \if b\!nextchar + \def\!!!setbars{\!setbarsbget}% + \else + \if e\!nextchar + \def\!!!setbars{\!setbarseget}% + \else + \def\!!!setbars{\relax}% + \fi + \fi + \!!!setbars} +\def\!setbarsbget baselabels (#1) {% + \def\!barbaselabelorientation{#1}% + \def\!bardobaselabel{\!!bardobaselabel}% + \!setbars} +\def\!setbarseget endlabels (#1) {% + \edef\!barendlabelorientation{#1}% + \def\!bardoendlabel{\!!bardoendlabel}% + \!setbars} + +% ** \!barcurve +% ** Draws a bargraph with preset values of barshift, barbreadth, +% ** barorientation (x or y) and barbaseline (coordinate) +\def\!barcurve #1 #2 {% + \if y\!barorientation + \def\!basexarg{#1}% + \def\!baseyarg{\!barbaseline}% + \else + \def\!basexarg{\!barbaseline}% + \def\!baseyarg{#2}% + \fi + \expandafter\putbar\!barshift breadth <\!barbreadth> from {\!basexarg} + {\!baseyarg} to {#1} {#2} + \def\!endxarg{#1}% + \def\!endyarg{#2}% + \!bardobaselabel} + +\def\!!bardobaselabel "#1" {% + \put {#1}\!barbaselabelorientation{} at {\!basexarg} {\!baseyarg} + \!bardoendlabel} + +\def\!!bardoendlabel "#1" {% + \put {#1}\!barendlabelorientation{} at {\!endxarg} {\!endyarg} + \!barfinish} + +\def\!barfinish{% + \!ifnextchar/{\!finish}{\!barcurve}} + + +% ******************************** +% *** BOXES (Draws rectangles) *** +% ******************************** +% +% ** User commands: +% ** \putrectangle [] corners at XCOORD1 YCOORD1 +% ** and XCOORD2 YCOORD2 +% ** \shaderectangleson +% ** \shaderectanglesoff +% ** \frame [] {TEXT} +% ** \rectangle +% +% +% ** \putrectangle [] corners at XCOORD1 YCOORD1 +% ** and XCOORD2 YCOORD2 +% ** Draws a rectangle with corners at (X1,Y1), (X2,Y1), (X1,Y2), (X2,Y2) +% ** Lines have thickness \linethickness, and overlap at the corners. +% ** The optional field functions as with a \put command. +% ** See Subsection 4.2 of the manual. +\def\putrectangle{% + \!ifnextchar<{\!putrectangle}{\!putrectangle<\!zpt,\!zpt> }} +\def\!putrectangle<#1,#2> corners at #3 #4 and #5 #6 {% +% +% ** get locations + \!xone=\!M{#3}\!xunit \!xtwo=\!M{#5}\!xunit% + \!yone=\!M{#4}\!yunit \!ytwo=\!M{#6}\!yunit% + \ifdim \!xtwo<\!xone + \!dimenI=\!xone \!xone=\!xtwo \!xtwo=\!dimenI + \fi + \ifdim \!ytwo<\!yone + \!dimenI=\!yone \!yone=\!ytwo \!ytwo=\!dimenI + \fi + \!dimenI=#1\relax \advance\!xone\!dimenI \advance\!xtwo\!dimenI + \!dimenI=#2\relax \advance\!yone\!dimenI \advance\!ytwo\!dimenI + \let\!MRect=\!M% ** save current coord/dimen mode + \!setdimenmode +% +% ** shade rectangle if appropriate + \!shaderectangle +% +% ** draw horizontal edges + \!dimenI=.5\linethickness + \advance \!xone -\!dimenI% ** adjust x-location to overlap corners + \advance \!xtwo \!dimenI% ** ditto + \putrule from {\!xone} {\!yone} to {\!xtwo} {\!yone} + \putrule from {\!xone} {\!ytwo} to {\!xtwo} {\!ytwo} +% +% ** draw vertical edges + \advance \!xone \!dimenI% ** restore original x-values + \advance \!xtwo -\!dimenI% + \advance \!yone -\!dimenI% ** adjust y-location to overlap corners + \advance \!ytwo \!dimenI% ** ditto + \putrule from {\!xone} {\!yone} to {\!xone} {\!ytwo} + \putrule from {\!xtwo} {\!yone} to {\!xtwo} {\!ytwo} +% + \let\!M=\!MRect% ** restore coord/dimen mode + \ignorespaces} + +% ** \shaderectangleson +% ** Subsequent rectangles will be shaded according to +% ** the current shading pattern. Affects \putrectangle, \putbar, +% ** \frame, \sethistograms, and \setbars. See Subsection 7.5 of the manual. +\def\shaderectangleson{% + \def\!shaderectangle{\!!shaderectangle}% + \ignorespaces} +% ** \shaderectanglesoff +% ** Suppresses \shaderectangleson. The default. +\def\shaderectanglesoff{% + \def\!shaderectangle{}% + \ignorespaces} + +\shaderectanglesoff + +% ** The following internal routine shades the current rectangle, when +% ** \!shaderectangle = \!!shaderectangle . +\def\!!shaderectangle{% + \!dimenA=\!xtwo \advance \!dimenA -\!xone + \!dimenB=\!ytwo \advance \!dimenB -\!yone + \ifdim \!dimenA<\!dimenB + \!startvshade (\!xone,\!yone,\!ytwo) + \!lshade (\!xtwo,\!yone,\!ytwo) + \else + \!starthshade (\!yone,\!xone,\!xtwo) + \!lshade (\!ytwo,\!xone,\!xtwo) + \fi + \ignorespaces} + +% ** \frame [] {TEXT} +% ** Draws a frame of thickness linethickness about the box enclosing +% ** TEXT; the frame is separated from the box by a distance of +% ** SEPARATION. The result is an hbox with the same baseline as TEXT. +% ** If is omitted, you get the effect of <0pt>. +% ** See Subsection 4.2 of the manual. +\def\frame{% + \!ifnextchar<{\!frame}{\!frame<\!zpt> }} +\long\def\!frame<#1> #2{% + \beginpicture + \setcoordinatesystem units <1pt,1pt> point at 0 0 + \put {#2} [Bl] at 0 0 + \!dimenA=#1\relax + \!dimenB=\!wd \advance \!dimenB \!dimenA + \!dimenC=\!ht \advance \!dimenC \!dimenA + \!dimenD=\!dp \advance \!dimenD \!dimenA + \let\!MFr=\!M + \!setdimenmode + \putrectangle corners at {-\!dimenA} {-\!dimenD} and {\!dimenB} {\!dimenC} + \!setcoordmode + \let\!M=\!MFr + \endpicture + \ignorespaces} + +% ** \rectangle +% ** Constructs a rectangle of width WIDTH and heigth HEIGHT. +% ** See Subsection 4.2 of the manual. +\def\rectangle <#1> <#2> {% + \setbox0=\hbox{}\wd0=#1\ht0=#2\frame {\box0}} + + +% ********************************************* +% *** CURVES (Upper level \plot commands) *** +% ********************************************* +% +% ** User commands +% ** \plot DATA / +% ** \plot "FILE NAME" +% ** \setquadratic +% ** \setlinear +% ** \sethistograms +% ** \vshade ... +% ** \hshade ... + +% \plot: multi-purpose command. Draws histograms, bar graphs, piecewise-linear +% or piecewise quadratic curves, depending on the setting of \!drawcurve. +% See Subsections 4.3-4.5, 5.1, 5.2 of the manual. +\def\plot{% + \!ifnextchar"{\!plotfromfile}{\!drawcurve}} +\def\!plotfromfile"#1"{% + \expandafter\!drawcurve \normalinput #1 /} + +% Command to set piecewise quadratic mode +% See Subsections 5.1, 7.3, and 7.4 of the manual. +\def\setquadratic{% + \let\!drawcurve=\!qcurve + \let\!!Shade=\!!qShade + \let\!!!Shade=\!!!qShade} + +% Command to set piecewise linear mode +% See Subsections 5.1, 7.3, and 7.4 of the manual. +\def\setlinear{% + \let\!drawcurve=\!lcurve + \let\!!Shade=\!!lShade + \let\!!!Shade=\!!!lShade} + +% Command to set histogram mode +% See Subsection 4.3 of the manual. +\def\sethistograms{% + \let\!drawcurve=\!hcurve} + +% Commands to cycle through list of coordinates in piecewise quadratic +% interpolation mode +\def\!qcurve #1 #2 {% + \!start (#1,#2) + \!Qjoin} +\def\!Qjoin#1 #2 #3 #4 {% + \!qjoin (#1,#2) (#3,#4) % \!qjoin is defined in QUADRATIC + \!ifnextchar/{\!finish}{\!Qjoin}} + +% Commands to cycle through list of coordinates in piecewise linear +% interpolation mode +\def\!lcurve #1 #2 {% + \!start (#1,#2) + \!Ljoin} +\def\!Ljoin#1 #2 {% + \!ljoin (#1,#2) % \!ljoin is defined in LINEAR + \!ifnextchar/{\!finish}{\!Ljoin}} + +\def\!finish/{\ignorespaces} + +% Command to cycle through list of coordinates in histogram mode +\def\!hcurve #1 #2 {% + \edef\!hxS{#1}% + \edef\!hyS{#2}% + \!hjoin} +\def\!hjoin#1 #2 {% + \putrectangle corners at {\!hxS} {\!hyS} and {#1} {#2} + \edef\!hxS{#1}% + \!ifnextchar/{\!finish}{\!hjoin}} + + +% \vshade: See Subsection 7.3 of the manual. +\def\vshade #1 #2 #3 {% + \!startvshade (#1,#2,#3) + \!Shadewhat} + +% \hshade: See Subsection 7.4 of the manual. +\def\hshade #1 #2 #3 {% + \!starthshade (#1,#2,#3) + \!Shadewhat} + +% Commands to cycle through coordinates and optional "edge effect" +% fields while shading. +\def\!Shadewhat{% + \futurelet\!nextchar\!Shade} +\def\!Shade{% + \if <\!nextchar + \def\!nextShade{\!!Shade}% + \else + \if /\!nextchar + \def\!nextShade{\!finish}% + \else + \def\!nextShade{\!!!Shade}% + \fi + \fi + \!nextShade} +\def\!!lShade<#1> #2 #3 #4 {% + \!lshade <#1> (#2,#3,#4) % \!lshade is defined in SHADING + \!Shadewhat} +\def\!!!lShade#1 #2 #3 {% + \!lshade (#1,#2,#3) + \!Shadewhat} +\def\!!qShade<#1> #2 #3 #4 #5 #6 #7 {% + \!qshade <#1> (#2,#3,#4) (#5,#6,#7) % \!qshade is defined in SHADING + \!Shadewhat} +\def\!!!qShade#1 #2 #3 #4 #5 #6 {% + \!qshade (#1,#2,#3) (#4,#5,#6) + \!Shadewhat} + +% ** Set default interpolation mode +\setlinear + + +% ******************************************** +% *** DASHPATTERNS (Sets up dash patterns) *** +% ******************************************** + +% ** User commands: +% ** \setdashpattern +% ** \setdots +% ** \setdotsnear for +% ** \setdashes +% ** \setdashesnear for +% ** \setsolid +% ** \findlength {CURVE CMDS} + +% ** Internal commands: +% ** \!dashingon +% ** \!dashingoff + +% ** Dash patterns are specified by a balanced token list whose complete +% ** expansion has the form: DIMEN1,DIMEN2,DIMEN3,DIMEN4,... ; this produces +% ** an arc of length DIMEN1, a skip of length DIMEN2, an arc of length +% ** DIMEN3, a skip of length DIMEN4, ... . Any number of DIMEN values may +% ** be given. The pattern is repeated as many times (perhaps fractional) +% ** as necessary to draw the curve. +% ** A dash pattern remains in effect until it is overridden by a call to +% ** \setdashpattern, or to \setdots, \setdotsnear ... , \setdashes, +% ** \setdashesnear ... , or \setsolid. +% ** Solid lines are the default. + + +% ** \def\setdashpattern +% ** The following routine converts a balanced list of tokens whose +% ** complete expansion has the form DIMEN1,DIMEN2, ... , DIMENk into +% ** three list macros that are used in drawing dashed rules and curves: +% ** !Flist: \!Rule{DIMEN1}\!Skip{DIMEN2}\!Rule{DIMEN3}\!Skip{DIMEN4} ... +% ** !Blist: ...\!Skip{DIMEN4}\!Rule{DIMEN3}\!Skip{DIMEN2}\!Rule{DIMEN1} +% ** !UDlist: \\{DIMEN1}\\{DIMEN2}\\{DIMEN3}\\{DIMEN4} ...; +% ** calculates \!leaderlength := DIMEN1 + ... + DIMENk; and +% ** sets the curve drawing routines to dash mode. +% ** Those lists are used by the curve drawing routines. +% ** Dimenj ... may be given as an explicit dimension (e.g., 5pt), or +% ** as an expression involving a dimension register (e.g., -2.5\dimen0). +% ** See Subsection 6.2 of the manual +\def\setdashpattern <#1>{% + \def\!Flist{}\def\!Blist{}\def\!UDlist{}% + \!countA=0 + \!ecfor\!item:=#1\do{% + \!dimenA=\!item\relax + \expandafter\!rightappend\the\!dimenA\withCS{\\}\to\!UDlist% + \advance\!countA 1 + \ifodd\!countA + \expandafter\!rightappend\the\!dimenA\withCS{\!Rule}\to\!Flist% + \expandafter\!leftappend\the\!dimenA\withCS{\!Rule}\to\!Blist% + \else + \expandafter\!rightappend\the\!dimenA\withCS{\!Skip}\to\!Flist% + \expandafter\!leftappend\the\!dimenA\withCS{\!Skip}\to\!Blist% + \fi}% + \!leaderlength=\!zpt + \def\!Rule##1{\advance\!leaderlength ##1}% + \def\!Skip##1{\advance\!leaderlength ##1}% + \!Flist% + \ifdim\!leaderlength>\!zpt + \else + \def\!Flist{\!Skip{24in}}\def\!Blist{\!Skip{24in}}\ignorespaces + \def\!UDlist{\\{\!zpt}\\{24in}}\ignorespaces + \!leaderlength=24in + \fi + \!dashingon} + + +% ** \!dashingon -- puts the curve drawing routines into dash mode +% ** \!dashingoff -- puts the curve drawing routines into solid mode +% ** These are internal commands, invoked by \setdashpattern and \setsolid +\def\!dashingon{% + \def\!advancedashing{\!!advancedashing}% + \def\!drawlinearsegment{\!lineardashed}% + \def\!puthline{\!putdashedhline}% + \def\!putvline{\!putdashedvline}% +% \def\!putsline{\!putdashedsline}% + \ignorespaces}% +\def\!dashingoff{% + \def\!advancedashing{\relax}% + \def\!drawlinearsegment{\!linearsolid}% + \def\!puthline{\!putsolidhline}% + \def\!putvline{\!putsolidvline}% +% \def\!putsline{\!putsolidsline}% + \ignorespaces} + + +% ** \setdots -- sets up a dot/skip pattern where dot (actually +% ** the current plotsymbol) is plunked down once for every LENGTH +% ** traveled along the curve. LENGTH defaults to 5pt. +% ** See Subsection 6.1 of the manual. +\def\setdots{% + \!ifnextchar<{\!setdots}{\!setdots<5pt>}} +\def\!setdots<#1>{% + \!dimenB=#1\advance\!dimenB -\plotsymbolspacing + \ifdim\!dimenB<\!zpt + \!dimenB=\!zpt + \fi +\setdashpattern <\plotsymbolspacing,\!dimenB>} + +% ** \setdotsnear for +% ** sets up a dot pattern where the dots are approximately LENGTH apart, +% ** the total length of the pattern is ARC LENGTH, and the pattern +% ** begins and ends with a dot. See Subsection 6.3 of the manual. +\def\setdotsnear <#1> for <#2>{% + \!dimenB=#2\relax \advance\!dimenB -.05pt + \!dimenC=#1\relax \!countA=\!dimenC + \!dimenD=\!dimenB \advance\!dimenD .5\!dimenC \!countB=\!dimenD + \divide \!countB \!countA + \ifnum 1>\!countB + \!countB=1 + \fi + \divide\!dimenB \!countB + \setdots <\!dimenB>} + +% ** \setdashes -- sets up a dash/skip pattern where the dash +% ** and the skip are each of length LENGTH (the dash is formed by +% ** plunking down the current plotsymbol over an arc of length LENGTH +% ** and so may actually be longer than LENGTH. LENGTH defaults to 5pt. +% ** See Subsection 6.1 of the manual. +\def\setdashes{% + \!ifnextchar<{\!setdashes}{\!setdashes<5pt>}} +\def\!setdashes<#1>{\setdashpattern <#1,#1>} + +% ** \setdashesnear ... +% ** Like \setdotsnear; the pattern begins and ends with a dash. +% ** See Subsection 6.3 of the manual. +\def\setdashesnear <#1> for <#2>{% + \!dimenB=#2\relax + \!dimenC=#1\relax \!countA=\!dimenC + \!dimenD=\!dimenB \advance\!dimenD .5\!dimenC \!countB=\!dimenD + \divide \!countB \!countA + \ifodd \!countB + \else + \advance \!countB 1 + \fi + \divide\!dimenB \!countB + \setdashes <\!dimenB>} + +% ** \setsolid -- puts the curve drawing routines in "solid line" mode, +% ** the default mode. See Subsection 6.1 of the manual. +\def\setsolid{% + \def\!Flist{\!Rule{24in}}\def\!Blist{\!Rule{24in}}% + \def\!UDlist{\\{24in}\\{\!zpt}}% + \!dashingoff} +\setsolid + +% ** \findlength {CURVE CMDS} +% ** PiCTeX executes the \start, \ljoin, and \qjoin cmds comprising +% ** CURVE CMDS without plotting anything, but stashes the length +% ** of the phantom curve away in \totalarclength. +% ** See Subsection 6.3 of the manual. +\def\findlength#1{% + \begingroup + \setdashpattern <0pt, \maxdimen> + \setplotsymbol ({}) + \dontsavelinesandcurves + #1% + \endgroup + \ignorespaces} + + +% ************************************************************* +% *** DIVISION (Does long division of dimension registers) *** +% ************************************************************* + +% ** User command: +% ** \Divide {DIVIDEND} by {DIVISOR} forming {RESULT} + +% ** Internal command +% ** \!divide{DIVIDEND}{DIVISOR}{RESULT} + +% ** \!divide DIVIDEND [by] DIVISOR [to get] ANSWER +% ** Divides the dimension DIVIDEND by the dimension DIVISOR, placing the +% ** quotient in the dimension register ANSWER. Values are understood to +% ** be in points. E.g. 12.5pt/1.4pt=8.92857pt. +% ** Quotient is accurate to 1/65536pt=2**[-16]pt +% ** |DIVISOR| should be < 2048pt (about 28 inches). +\def\!divide#1#2#3{% + \!dimenB=#1% ** dimB holds current remainder (r) + \!dimenC=#2% ** dimC holds divisor (d) + \!dimenD=\!dimenB% ** dimD holds quotient q=r/d for this + \divide \!dimenD \!dimenC% ** step, in units of scaled pts + \!dimenA=\!dimenD% ** dimA eventually holds answer (a) + \multiply\!dimenD \!dimenC% ** r <-- r - dq + \advance\!dimenB -\!dimenD% ** First step complete. Have integer part +% ** of a, and corresponding remainder. + \!dimenD=\!dimenC% ** Temporarily use dimD to hold |d| + \ifdim\!dimenD<\!zpt \!dimenD=-\!dimenD + \fi + \ifdim\!dimenD<64pt% ** Branch on the magnitude of |d| + \!divstep[\!tfs]\!divstep[\!tfs]% + \else + \!!divide + \fi + #3=\!dimenA\ignorespaces} + +% ** The following code handles divisors d with +% ** (1) .88in = 64pt <= d < 256pt = 3.54in +% ** (2) 3.54in = 256pt <= d < 2048pt = 28.34in +% ** Anything bigger than that may result in an overflow condition. +% ** For our purposes, we should never even see case (2). +\def\!!divide{% + \ifdim\!dimenD<256pt + \!divstep[64]\!divstep[32]\!divstep[32]% + \else + \!divstep[8]\!divstep[8]\!divstep[8]\!divstep[8]\!divstep[8]% + \!dimenA=2\!dimenA + \fi} + + +% ** The following macro does the real long division work. +\def\!divstep[#1]{% ** #1 = "B" + \!dimenB=#1\!dimenB% ** r <-- B*r + \!dimenD=\!dimenB% ** dimD holds quotient q=r/d for this + \divide \!dimenD by \!dimenC% ** step, in units of scaled pts + \!dimenA=#1\!dimenA% ** a <-- B*a + q + \advance\!dimenA by \!dimenD% + \multiply\!dimenD by \!dimenC% ** r <-- r - dq + \advance\!dimenB by -\!dimenD} + +% ** \Divide: See Subsection 9.3 of the manual. +\def\Divide <#1> by <#2> forming <#3> {% + \!divide{#1}{#2}{#3}} + + +% ********************************************* +% *** ELLIPSES (Draws ellipses and circles) *** +% ********************************************* + +% ** User commands +% ** \ellipticalarc axes ratio A:B DEGREES degrees from XSTART YSTART +% ** center at XCENTER YCENTER +% ** \circulararc DEGREES degrees from XSTART YSTART +% ** center at XCENTER YCENTER + +% ** Internal command +% ** \!sinandcos{32*ANGLE in radians}{32*SIN}{32*COS} + + +% ** \ellipticalarc axes ratio A:B DEGREES degrees from XSTART YSTART +% ** center at XCENTER YCENTER +% ** Draws a elliptical arc starting at the coordinate point (XSTART,YSTART). +% ** The center of the ellipse of which the arc is a segment is at +% ** (XCENTER,YCENTER). +% ** The arc extends through an angle of DEGREES degrees (may be + or -). +% ** A:B is the ratio of the length of the xaxis to the length of +% ** the yaxis of the ellipse +% ** Sqrt{[(XSTART-XCENTER)/A]**2 + [(YSTART-YCENTER)/B]**2} +% ** must be < 512pt (about 7in). +% ** Doesn't modify the dimensions (ht, dp, wd) of the PiCture under +% ** construction. + +% ** \circulararc -- See Subsection 5.3 of the manual. +\def\circulararc{% + \ellipticalarc axes ratio 1:1 } + +% ** \ellipticalarc -- See Subsection 5.3 of the manual. +\def\ellipticalarc axes ratio #1:#2 #3 degrees from #4 #5 center at #6 #7 {% + \!angle=#3pt\relax% ** get angle + \ifdim\!angle>\!zpt + \def\!sign{}% ** counterclockwise + \else + \def\!sign{-}\!angle=-\!angle% ** clockwise + \fi + \!xxloc=\!M{#6}\!xunit% ** convert CENTER to dimension + \!yyloc=\!M{#7}\!yunit + \!xxS=\!M{#4}\!xunit% ** get STARTing point on rim of ellipse + \!yyS=\!M{#5}\!yunit + \advance\!xxS -\!xxloc% ** make center of ellipse (0,0) + \advance\!yyS -\!yyloc + \!divide\!xxS{#1pt}\!xxS % ** scale point on ellipse to point on + \!divide\!yyS{#2pt}\!yyS % corresponding circle +% + \let\!MC=\!M% ** save current c/d mode + \!setdimenmode% ** go into dimension mode +% + \!xS=#1\!xxS \advance\!xS\!xxloc + \!yS=#2\!yyS \advance\!yS\!yyloc + \!start (\!xS,\!yS)% + \!loop\ifdim\!angle>14.9999pt% ** draw in major portion of ellipse + \!rotate(\!xxS,\!yyS)by(\!cos,\!sign\!sin)to(\!xxM,\!yyM) + \!rotate(\!xxM,\!yyM)by(\!cos,\!sign\!sin)to(\!xxE,\!yyE) + \!xM=#1\!xxM \advance\!xM\!xxloc \!yM=#2\!yyM \advance\!yM\!yyloc + \!xE=#1\!xxE \advance\!xE\!xxloc \!yE=#2\!yyE \advance\!yE\!yyloc + \!qjoin (\!xM,\!yM) (\!xE,\!yE) + \!xxS=\!xxE \!yyS=\!yyE + \advance \!angle -15pt + \repeat + \ifdim\!angle>\!zpt% ** complete remaining arc, if any + \!angle=100.53096\!angle% ** convert angle to radians, divide + \divide \!angle 360 % ** by 2, and multiply by 32 + \!sinandcos\!angle\!!sin\!!cos% ** get 32*sin & 32*cos + \!rotate(\!xxS,\!yyS)by(\!!cos,\!sign\!!sin)to(\!xxM,\!yyM) + \!rotate(\!xxM,\!yyM)by(\!!cos,\!sign\!!sin)to(\!xxE,\!yyE) + \!xM=#1\!xxM \advance\!xM\!xxloc \!yM=#2\!yyM \advance\!yM\!yyloc + \!xE=#1\!xxE \advance\!xE\!xxloc \!yE=#2\!yyE \advance\!yE\!yyloc + \!qjoin (\!xM,\!yM) (\!xE,\!yE) + \fi +% + \let\!M=\!MC% ** restore c/d mode + \ignorespaces}% ** if appropriate + + +% ** \!rotate(XREG,YREG)by(32cos,32sin)to(XXREG,YYREG) +% ** rotates (XREG,YREG) by angle with specfied scaled cos & sin to +% ** (XXREG,YYREG). Uses \!dimenA & \!dimenB as scratch registers. +\def\!rotate(#1,#2)by(#3,#4)to(#5,#6){% + \!dimenA=#3#1\advance \!dimenA -#4#2% ** Rcos(x+t)=Rcosx*cost - Rsinx*sint + \!dimenB=#3#2\advance \!dimenB #4#1% ** Rsin(x+t)=Rsinx*cost + Rcosx*sint + \divide \!dimenA 32 \divide \!dimenB 32 + #5=\!dimenA #6=\!dimenB + \ignorespaces} +\def\!sin{4.17684}% ** 32*sin(pi/24) (pi/24=7.5deg) +\def\!cos{31.72624}% ** 32*cos(pi/24) + + +% ** \!sinandcos{32*ANGLE in radians}{\SINCS}{\COSCS} +% ** Computes the 32*sine and 32*cosine of a small ANGLE expressed in +% ** radians/32 and puts these values in the replacement texts of +% ** \SINCS and \COSCS +\def\!sinandcos#1#2#3{% + \!dimenD=#1% ** angle is expressed in radians/32: 1pt = 1/32rad + \!dimenA=\!dimenD% ** dimA will eventually contain 32sin(angle)in pts + \!dimenB=32pt% ** dimB will eventually contain 32cos(angle)in pts + \!removept\!dimenD\!value% ** get value of 32*angle, without "pt" + \!dimenC=\!dimenD% ** holds 32*angle**i/i! in pts + \!dimenC=\!value\!dimenC \divide\!dimenC by 64 % ** now 32*angle**2/2 + \advance\!dimenB by -\!dimenC% ** 32-32*angle**2/2 + \!dimenC=\!value\!dimenC \divide\!dimenC by 96 % ** now 32*angle**3/3! + \advance\!dimenA by -\!dimenC% ** now 32*(angle-angle**3/6) + \!dimenC=\!value\!dimenC \divide\!dimenC by 128 % ** now 32*angle**4/4! + \advance\!dimenB by \!dimenC% + \!removept\!dimenA#2% ** set 32*sin(angle) + \!removept\!dimenB#3% ** set 32*cos(angle) + \ignorespaces} + + +% ***************************************************************** +% *** RULES (Draws rules, i.e., horizontal & vertical lines) *** +% ***************************************************************** + +% ** User command: +% ** \putrule [] from XCOORD1 YCOORD1 +% ** to XCOORD2 YCOORD2 + +% ** Internal commands: +% ** \!puthline [] (h = horizontal) +% ** Set by dashpat to either: \!putsolidhline or \!putdashedhline +% ** \!putvline [] (v = vertical) +% ** Either: \!putsolidvline or \!putdashedvline + + +% ** \putrule [] from XCOORD1 YCOORD1 +% ** to XCOORD2 YCOORD2 +% ** Draws a rule -- dashed or solid depending on the current dash pattern -- +% ** from (X1,Y1) to (X2,Y2). Uses TEK's \hrule & \vrule & \leaders +% ** constructions to handle horizontal & vertical lines efficiently both +% ** in terms of execution time and space in the DVI file. +% ** See Subsection 4.1 of the manual. +\def\putrule#1from #2 #3 to #4 #5 {% + \!xloc=\!M{#2}\!xunit \!xxloc=\!M{#4}\!xunit% + \!yloc=\!M{#3}\!yunit \!yyloc=\!M{#5}\!yunit% + \!dxpos=\!xxloc \advance\!dxpos by -\!xloc + \!dypos=\!yyloc \advance\!dypos by -\!yloc +% + \ifdim\!dypos=\!zpt + \def\!!Line{\!puthline{#1}}\ignorespaces + \else + \ifdim\!dxpos=\!zpt + \def\!!Line{\!putvline{#1}}\ignorespaces + \else + \def\!!Line{} + \fi + \fi + \let\!ML=\!M% ** save current coord\dimen mode + \!setdimenmode% ** express locations in dimens + \!!Line% + \let\!M=\!ML% ** restore previous c/d mode + \ignorespaces} + + +% ** \!putsolidhline [] +% ** Place horizontal solid line +\def\!putsolidhline#1{% + \ifdim\!dxpos>\!zpt + \put{\!hline\!dxpos}#1[l] at {\!xloc} {\!yloc} + \else + \put{\!hline{-\!dxpos}}#1[l] at {\!xxloc} {\!yyloc} + \fi + \ignorespaces} + +% ** \!putsolidvline [shifted ] +% ** Place vertical solid line +\def\!putsolidvline#1{% + \ifdim\!dypos>\!zpt + \put{\!vline\!dypos}#1[b] at {\!xloc} {\!yloc} + \else + \put{\!vline{-\!dypos}}#1[b] at {\!xxloc} {\!yyloc} + \fi + \ignorespaces} + +\def\!hline#1{\hbox to #1{\leaders \hrule height\linethickness\hfill}} +\def\!vline#1{\vbox to #1{\leaders \vrule width\linethickness\vfill}} + + +% ** \!putdashedhline [] +% ** Place dashed horizontal line +\def\!putdashedhline#1{% + \ifdim\!dxpos>\!zpt + \!DLsetup\!Flist\!dxpos + \put{\hbox to \!totalleaderlength{\!hleaders}\!hpartialpattern\!Rtrunc} + #1[l] at {\!xloc} {\!yloc} + \else + \!DLsetup\!Blist{-\!dxpos} + \put{\!hpartialpattern\!Ltrunc\hbox to \!totalleaderlength{\!hleaders}} + #1[r] at {\!xloc} {\!yloc} + \fi + \ignorespaces} + +% ** \!putdashedhline [] +% ** Place dashed vertical line +\def\!putdashedvline#1{% + \!dypos=-\!dypos% ** vertical leaders go from top to bottom + \ifdim\!dypos>\!zpt + \!DLsetup\!Flist\!dypos + \put{\vbox{\vbox to \!totalleaderlength{\!vleaders} + \!vpartialpattern\!Rtrunc}}#1[t] at {\!xloc} {\!yloc} + \else + \!DLsetup\!Blist{-\!dypos} + \put{\vbox{\!vpartialpattern\!Ltrunc + \vbox to \!totalleaderlength{\!vleaders}}}#1[b] at {\!xloc} {\!yloc} + \fi + \ignorespaces} + + +% ** The rest of the macros in this section are subroutines used by +% ** \!putdashedhline and \!putdashedvline. +\def\!DLsetup#1#2{% ** Dashed-Line set up + \let\!RSlist=#1% ** set !Rule-Skip list + \!countB=#2% ** convert rule length to integer (number of sps) + \!countA=\!leaderlength% ** ditto, leaderlength + \divide\!countB by \!countA% ** number of complete leader units + \!totalleaderlength=\!countB\!leaderlength + \!Rresiduallength=#2% + \advance \!Rresiduallength by -\!totalleaderlength% \** excess length + \!Lresiduallength=\!leaderlength + \advance \!Lresiduallength by -\!Rresiduallength + \ignorespaces} + +\def\!hleaders{% + \def\!Rule##1{\vrule height\linethickness width##1}% + \def\!Skip##1{\hskip##1}% + \leaders\hbox{\!RSlist}\hfill} + +\def\!hpartialpattern#1{% + \!dimenA=\!zpt \!dimenB=\!zpt + \def\!Rule##1{#1{##1}\vrule height\linethickness width\!dimenD}% + \def\!Skip##1{#1{##1}\hskip\!dimenD}% + \!RSlist} + +\def\!vleaders{% + \def\!Rule##1{\hrule width\linethickness height##1}% + \def\!Skip##1{\vskip##1}% + \leaders\vbox{\!RSlist}\vfill} + +\def\!vpartialpattern#1{% + \!dimenA=\!zpt \!dimenB=\!zpt + \def\!Rule##1{#1{##1}\hrule width\linethickness height\!dimenD}% + \def\!Skip##1{#1{##1}\vskip\!dimenD}% + \!RSlist} + +\def\!Rtrunc#1{\!trunc{#1}>\!Rresiduallength} +\def\!Ltrunc#1{\!trunc{#1}<\!Lresiduallength} + +\def\!trunc#1#2#3{% + \!dimenA=\!dimenB + \advance\!dimenB by #1% + \!dimenD=\!dimenB \ifdim\!dimenD#2#3\!dimenD=#3\fi + \!dimenC=\!dimenA \ifdim\!dimenC#2#3\!dimenC=#3\fi + \advance \!dimenD by -\!dimenC} + + +% **************************************************************** +% *** LINEAR ARC (Draws straight lines -- solid and dashed) *** +% **************************************************************** + +% ** User commands +% ** \inboundscheckoff +% ** \inboundscheckon + +% ** Internal commands +% ** \!start (XCOORD,YCOORD) +% ** \!ljoin (XCOORD,YCOORD) +% ** \!drawlinearsegment -- set by \dashpat to either +% ** \!linearsolid or \!lineardashed +% ** \!advancedashing -- set by \dashpat to either +% ** \relax or \!!advancedashing +% ** \!plotifinbounds -- set by \inboundscheck off/on to either +% ** \!plot or \!!plotifinbounds +% ** \!initinboundscheck -- set by \inboundscheck off/on to either +% ** \relax or \!!initinboundscheck + + +% \plotsymbolspacing ** distance between consecutive plot positions +% \!xS ** starting x +% \!yS ** starting y +% \!xE ** ending x +% \!yE ** ending y +% \!xdiff ** x_end - x_start +% \!ydiff ** y_end - y_start +% \!distacross ** how far along curve next point to be plotted is +% \!arclength ** approximate length of arc for current interval +% \!downlength ** remaining length for "pen" to be down +% \!uplength ** length for "pen" to be down +% \!intervalno ** counts segments to curve +% \totalarclength ** cumulative distance along curve +% \!npoints ** approximately (arc length / plotsymbolspacing) + +% ** Calls -- \!Pythag, \!divide, \!plot + + +% ** \!start (XCOORD,YCOORD) +% ** Sets initial point for linearly (or quadratically) interpolated curve +\def\!start (#1,#2){% + \!plotxorigin=\!xorigin \advance \!plotxorigin by \!plotsymbolxshift + \!plotyorigin=\!yorigin \advance \!plotyorigin by \!plotsymbolyshift + \!xS=\!M{#1}\!xunit \!yS=\!M{#2}\!yunit + \!rotateaboutpivot\!xS\!yS + \!copylist\!UDlist\to\!!UDlist% **\!UDlist has the form \\{dimen1}\\{dimen2}.. +% ** Routine will draw dashed line with pen +% ** down for dimen1, up for dimen2, ... + \!getnextvalueof\!downlength\from\!!UDlist + \!distacross=\!zpt% ** 1st point goes at start of curve + \!intervalno=0 % ** initialize interval counter + \global\totalarclength=\!zpt% ** initialize distance traveled along curve + \ignorespaces} + + +% ** \!ljoin (XCOORD,YCOORD) +% ** Draws a straight line starting at the last point specified +% ** by the most recent \!start, \!ljoin, or \!qjoin, and +% ** ending at (XCOORD,YCOORD). +\def\!ljoin (#1,#2){% + \advance\!intervalno by 1 + \!xE=\!M{#1}\!xunit \!yE=\!M{#2}\!yunit + \!rotateaboutpivot\!xE\!yE + \!xdiff=\!xE \advance \!xdiff by -\!xS%** xdiff = xE - xS + \!ydiff=\!yE \advance \!ydiff by -\!yS%** ydiff = yE - yS + \!Pythag\!xdiff\!ydiff\!arclength% ** arclength = sqrt(xdiff**2+ydiff**2) + \global\advance \totalarclength by \!arclength% + \!drawlinearsegment% ** set by dashpat to \!linearsolid or \!lineardashed + \!xS=\!xE \!yS=\!yE% ** shift ending points to starting points + \ignorespaces} + + +% ** The following routine is used to draw a "solid" line between (xS,yS) +% ** and (xE,yE). Points are spaced nearly every \plotsymbolspacing length +% ** along the line. +\def\!linearsolid{% + \!npoints=\!arclength + \!countA=\plotsymbolspacing + \divide\!npoints by \!countA% ** now #pts =. arclength/plotsymbolspacing + \ifnum \!npoints<1 + \!npoints=1 + \fi + \divide\!xdiff by \!npoints + \divide\!ydiff by \!npoints + \!xpos=\!xS \!ypos=\!yS +% + \loop\ifnum\!npoints>-1 + \!plotifinbounds + \advance \!xpos by \!xdiff + \advance \!ypos by \!ydiff + \advance \!npoints by -1 + \repeat + \ignorespaces} + + +% ** The following routine is used to draw a dashed line between (xS,yS) +% ** and (xE,yE). The dash pattern continues from the previous segment. +\def\!lineardashed{% +% ** + \ifdim\!distacross>\!arclength + \advance \!distacross by -\!arclength %nothing to plot in this interval +% + \else +% + \loop\ifdim\!distacross<\!arclength +% ** plot point, interpolating linearly in x and y + \!divide\!distacross\!arclength\!dimenA% ** dimA = across/arclength + \!removept\!dimenA\!t% ** \!t holds value in dimA, without the "pt" + \!xpos=\!t\!xdiff \advance \!xpos by \!xS + \!ypos=\!t\!ydiff \advance \!ypos by \!yS + \!plotifinbounds + \advance\!distacross by \plotsymbolspacing + \!advancedashing + \repeat +% + \advance \!distacross by -\!arclength% ** prepare for next interval + \fi + \ignorespaces} + + +\def\!!advancedashing{% + \advance\!downlength by -\plotsymbolspacing + \ifdim \!downlength>\!zpt + \else + \advance\!distacross by \!downlength + \!getnextvalueof\!uplength\from\!!UDlist + \advance\!distacross by \!uplength + \!getnextvalueof\!downlength\from\!!UDlist + \fi} + + +% ** \inboundscheckoff & \inboundscheckon: See Subsection 5.5 of the manual. +\def\inboundscheckoff{% + \def\!plotifinbounds{\!plot(\!xpos,\!ypos)}% + \def\!initinboundscheck{\relax}\ignorespaces} +\def\inboundscheckon{% + \def\!plotifinbounds{\!!plotifinbounds}% + \def\!initinboundscheck{\!!initinboundscheck}% + \!initinboundscheck\ignorespaces} +\inboundscheckoff + +% ** The following code plots the current point only if it falls in the +% ** current plotarea. It doesn't matter if the coordinate system has +% ** changed since the plotarea was set up. However, shifts of the plot +% ** are ignored (how the plotsymbol stands relative to its plot position is +% ** unknown anyway). +\def\!!plotifinbounds{% + \ifdim \!xpos<\!checkleft + \else + \ifdim \!xpos>\!checkright + \else + \ifdim \!ypos<\!checkbot + \else + \ifdim \!ypos>\!checktop + \else + \!plot(\!xpos,\!ypos) + \fi + \fi + \fi + \fi} + + +\def\!!initinboundscheck{% + \!checkleft=\!arealloc \advance\!checkleft by \!xorigin + \!checkright=\!arearloc \advance\!checkright by \!xorigin + \!checkbot=\!areabloc \advance\!checkbot by \!yorigin + \!checktop=\!areatloc \advance\!checktop by \!yorigin} + + +% ********************************* +% *** LOGTEN (Log_10 function) *** +% ********************************* +% +% ** \!logten{X} +% ** Calculates log_10 of X. X and LOG10(X) are in fixed point notation. +% ** X must be positive; it may have an optional `+' sign; any number +% ** of digits may be specified for X. The absolute error in LOG10(X) is +% ** less than .0001 (probably < .00006). That's about as good as you +% ** hope for, since TEX only operates to 5 figures after the decimal +% ** point anyway. + +% \!rootten=3.162278pt **** These are values are set in ALLOCATIONS +% \!tenAe=2.543275pt (=A5) +% \!tenAc=2.773839pt (=A3) +% \!tenAa=8.690286pt (=A1) + +\def\!logten#1#2{% + \expandafter\!!logten#1\!nil + \!removept\!dimenF#2% + \ignorespaces} + +\def\!!logten#1#2\!nil{% + \if -#1% + \!dimenF=\!zpt + \def\!next{\ignorespaces}% + \else + \if +#1% + \def\!next{\!!logten#2\!nil}% + \else + \if .#1% + \def\!next{\!!logten0.#2\!nil}% + \else + \def\!next{\!!!logten#1#2..\!nil}% + \fi + \fi + \fi + \!next} + +\def\!!!logten#1#2.#3.#4\!nil{% + \!dimenF=1pt % ** DimF holds log10 original argument + \if 0#1% + \!!logshift#3pt % ** Argument < 1 + \else % ** Argument >= 1 + \!logshift#2/% ** Shift decimal pt as many places + \!dimenE=#1.#2#3pt % ** as there are figures in #2 + \fi % ** Now dimE holds revised X want log10 of + \ifdim \!dimenE<\!rootten% ** Transform X to XX between sqrt(10) + \multiply \!dimenE 10 % ** and 10*sqrt(10) + \advance \!dimenF -1pt + \fi + \!dimenG=\!dimenE% ** dimG <- (XX + 10) + \advance\!dimenG 10pt + \advance\!dimenE -10pt % ** dimE <- (XX - 10) + \multiply\!dimenE 10 % ** dimE = 10*(XX-10) + \!divide\!dimenE\!dimenG\!dimenE% ** Now dimE=10t==10*(XX-10)/(XX+10) + \!removept\!dimenE\!t% ** !t=10t, with "pt" removed + \!dimenG=\!t\!dimenE% ** dimG=100t**2 + \!removept\!dimenG\!tt% ** !tt=100t**2, with "pt" removed + \!dimenH=\!tt\!tenAe% ** dimH=10*a5*(10t)**2 /100 + \divide\!dimenH 100 + \advance\!dimenH \!tenAc% ** ditto + 10*a3 + \!dimenH=\!tt\!dimenH% ** ditto * (10t)**2 /100 + \divide\!dimenH 100 + \advance\!dimenH \!tenAa% ** ditto + 10*a1 + \!dimenH=\!t\!dimenH% ** ditto * 10t / 100 + \divide\!dimenH 100 % ** Now dimH = log10(XX) - 1 + \advance\!dimenF \!dimenH}% ** dimF = log10(X) + +\def\!logshift#1{% + \if #1/% + \def\!next{\ignorespaces}% + \else + \advance\!dimenF 1pt + \def\!next{\!logshift}% + \fi + \!next} + + \def\!!logshift#1{% + \advance\!dimenF -1pt + \if 0#1% + \def\!next{\!!logshift}% + \else + \if p#1% + \!dimenF=1pt + \def\!next{\!dimenE=1p}% + \else + \def\!next{\!dimenE=#1.}% + \fi + \fi + \!next} + + +% *********************************************************** +% *** PICTURES (Basic setups for PiCtures; \put commands) *** +% *********************************************************** + +% ** User Commands: +% ** \beginpicture +% ** \endpicture +% ** \endpicturesave +% ** \setcoordinatesystem units point at XREF YREF +% ** \put {OBJECT} [ORIENTATION] at XCOORD YCOORD +% ** \multiput {OJBECT} [ORIENTATION] ) at +% ** XCOORD YCOORD +% ** *NUMBER_OF_TIMES DXCOORD DYCOORD / +% ** \accountingon +% ** \accountingoff +% ** \stack [ORIENTATION] {LIST OF ITEMS} +% ** \lines [ORIENTATION] {LINES} +% ** \Lines [ORIENTATION] {LINES} +% ** \setdimensionmode +% ** \setcoordinatemode +% ** \Xdistance +% ** \Ydistance + +% ** Internal commands: +% ** \!setputobject{OBJECT}{[ORIENTATION]} +% ** \!dimenput{OBJECT}[ORIENTATION](XDIMEN,YDIMEN) +% ** \!setdimenmode +% ** \!setcoordmode +% ** \!ifdimenmode +% ** \!ifcoordmode + + +% ** \beginpicture +% ** \endpicture +% ** \endpicturesave +% ** \beginpicture ... \endpicture creates an hbox. Objects are +% ** placed in this box using the \put command and the like (see below). +% ** The location of an object is specified in terms of coordinate system(s) +% ** established by \setcoordinatesystem. Each coordinate system (there +% ** might be just one) specifies the length of 1 horizontal unit, the length +% ** of 1 vertical unit, and the coordinates of a "reference point". The +% ** reference points of various coordinate systems will be in the same +% ** physical location. The macros keep track of the size of the objects +% ** and their locations. The resulting hbox is the smallest hbox which +% ** encloses all the objects, and whose TEK reference point is the point +% ** on the left edge of the box closest vertically to the PICTEX reference +% ** point. Using \endpicturesave, you can (globally) save the distance TEK's +% ** reference point is to the right (respectively, up from) PICTEX's +% ** reference point in the dimension register \XREG (respectively \YREG). +% ** You can then \put the picture OBJECT into a larger picture so that its +% ** reference point is at (XCOORD,YCOORD) with the command +% ** \put {picture OBJECT} [Bl] <\XREG, \YREG> at XCOORD YCOORD + +% ** \beginpicture : See Subsection 1.1 of the manual. +\def\beginpicture{% + \setbox\!picbox=\hbox\bgroup% + \!xleft=\maxdimen + \!xright=-\maxdimen + \!ybot=\maxdimen + \!ytop=-\maxdimen} + +% ** \endpicture : See Subsection 1.1 of the manual. +\def\endpicture{% + \ifdim\!xleft=\maxdimen% ** check if nothing was put in picbox + \!xleft=\!zpt \!xright=\!zpt \!ybot=\!zpt \!ytop=\!zpt + \fi + \global\!Xleft=\!xleft \global\!Xright=\!xright + \global\!Ybot=\!ybot \global\!Ytop=\!ytop + \egroup% + \ht\!picbox=\!Ytop \dp\!picbox=-\!Ybot + \ifdim\!Ybot>\!zpt + \else + \ifdim\!Ytop<\!zpt + \!Ybot=\!Ytop + \else + \!Ybot=\!zpt + \fi + \fi + \hbox{\kern-\!Xleft\lower\!Ybot\box\!picbox\kern\!Xright}} + +% ** \endpicturesave : See Subsection 8.4 of the manual. +\def\endpicturesave <#1,#2>{% + \endpicture \global #1=\!Xleft \global #2=\!Ybot \ignorespaces} + + +% ** \setcoordinatesystem units +% ** point at XREF YREF +% ** Each of `units ' and `point at XREF YREF' +% ** are optional. +% ** Unit lengths must be given in dimensions (e.g., <10pt,1in>). +% ** Default unit lengths are 1pt, 1pt, or previous unit lengths. +% ** Reference point is specified in current units (e.g., 3 5 ). +% ** Default reference point is 0 0 , or previous reference point. +% ** Unit lengths and reference points obey TEX's scoping rules. +% ** See Subsection 1.2 of the manual. +\def\setcoordinatesystem{% + \!ifnextchar{u}{\!getlengths } + {\!getlengths units <\!xunit,\!yunit>}} +\def\!getlengths units <#1,#2>{% + \!xunit=#1\relax + \!yunit=#2\relax + \!ifcoordmode + \let\!SCnext=\!SCccheckforRP + \else + \let\!SCnext=\!SCdcheckforRP + \fi + \!SCnext} +\def\!SCccheckforRP{% + \!ifnextchar{p}{\!cgetreference } + {\!cgetreference point at {\!xref} {\!yref} }} +\def\!cgetreference point at #1 #2 {% + \edef\!xref{#1}\edef\!yref{#2}% + \!xorigin=\!xref\!xunit \!yorigin=\!yref\!yunit + \!initinboundscheck % ** See linear.tex + \ignorespaces} +\def\!SCdcheckforRP{% + \!ifnextchar{p}{\!dgetreference}% + {\ignorespaces}} +\def\!dgetreference point at #1 #2 {% + \!xorigin=#1\relax \!yorigin=#2\relax + \ignorespaces} + + +% ** \put {OBJECT} [XY] at (XCOORD,YCOORD) +% ** `[XY]' and `' are optional. +% ** First OBJECT is placed in an hbox (the "objectbox") and then a +% ** "reference point" is assigned to the objectbox as follows: +% ** [1] first, the reference point is taken to be the center of the box; +% ** [2] next, centering is overridden by the specifications +% ** X=l -- reference point along the left edge of the objectbox +% ** X=r -- reference point along the right edge of the objectbox +% ** Y=b -- reference point along the bottom edge of the objectbox +% ** Y=B -- reference point along the Baseline of the objectbox +% ** Y=t -- reference point along the top edge of the objectbox; +% ** [3] finally the reference point is shifted left by XDIMEN, down +% ** by YDIMEN (both default to 0pt). +% ** The objectbox is placed within PICBOX with its reference point at +% ** (XCOORD,YCOORD). +% ** If OBJECT is a saved box, say box0, you have to write +% ** \put{\box0}... or \put{\copy0}... +% ** The objectbox is void after the put. +% ** See Subsection 2.1 of the manual. +\long\def\put#1#2 at #3 #4 {% + \!setputobject{#1}{#2}% + \!xpos=\!M{#3}\!xunit \!ypos=\!M{#4}\!yunit + \!rotateaboutpivot\!xpos\!ypos% + \advance\!xpos -\!xorigin \advance\!xpos -\!xshift + \advance\!ypos -\!yorigin \advance\!ypos -\!yshift + \kern\!xpos\raise\!ypos\box\!putobject\kern-\!xpos% + \!doaccounting\ignorespaces} + +% ** \multiput etc. Like \put. The objectbox is not voided until the +% ** termininating /, and is placed repeatedly with: +% ** XCOORD YCOORD -- the objectbox is put down with its reference point +% ** at (XCOORD,YCOORD); +% ** *N DXCOORD DYCOORD -- each of N times the current +% ** (xcoord,ycoord) is incremented by (DXCOORD,DYCOORD), and the +% ** objectbox is put down with its reference point at (xcoord,ycoord) +% ** (This specification has to follow an XCOORD YCOORD pair) +% ** See Subsection 2.2 of the manual. +\long\def\multiput #1#2 at {% + \!setputobject{#1}{#2}% + \!ifnextchar"{\!putfromfile}{\!multiput}} +\def\!putfromfile"#1"{% + \expandafter\!multiput \normalinput #1 /} +\def\!multiput{% + \futurelet\!nextchar\!!multiput} +\def\!!multiput{% + \if *\!nextchar + \def\!nextput{\!alsoby}% + \else + \if /\!nextchar + \def\!nextput{\!finishmultiput}% + \else + \def\!nextput{\!alsoat}% + \fi + \fi + \!nextput} +\def\!finishmultiput/{% + \setbox\!putobject=\hbox{}% + \ignorespaces} + +% ** \!alsoat XCOORD YCOORD +% ** The objectbox is put down with reference point at XCOORD,YCOORD +\def\!alsoat#1 #2 {% + \!xpos=\!M{#1}\!xunit \!ypos=\!M{#2}\!yunit + \!rotateaboutpivot\!xpos\!ypos% + \advance\!xpos -\!xorigin \advance\!xpos -\!xshift + \advance\!ypos -\!yorigin \advance\!ypos -\!yshift + \kern\!xpos\raise\!ypos\copy\!putobject\kern-\!xpos% + \!doaccounting + \!multiput} + +% ** \!alsoby*N DXCOORD DYCOORD +% ** N times, the current (XCOORD,YCOORD) is advanced by (DXCOORD,DYCOORD), +% ** and the current (shifted, oriented) OBJECT is put down. +\def\!alsoby*#1 #2 #3 {% + \!dxpos=\!M{#2}\!xunit \!dypos=\!M{#3}\!yunit + \!rotateonly\!dxpos\!dypos + \!ntemp=#1% + \!!loop\ifnum\!ntemp>0 + \advance\!xpos by \!dxpos \advance\!ypos by \!dypos + \kern\!xpos\raise\!ypos\copy\!putobject\kern-\!xpos% + \advance\!ntemp by -1 + \repeat + \!doaccounting + \!multiput} + +% ** \accountingoff : Suspends PiCTeX's accounting of the aggregate +% ** size of the picture box. +% ** \accounting on : Reinstates accounting. +% ** See Subsection 8.2 of the manual. +\def\accountingon{\def\!doaccounting{\!!doaccounting}\ignorespaces} +\def\accountingoff{\def\!doaccounting{}\ignorespaces} +\accountingon +\def\!!doaccounting{% + \!xtemp=\!xpos + \!ytemp=\!ypos + \ifdim\!xtemp<\!xleft + \!xleft=\!xtemp + \fi + \advance\!xtemp by \!wd + \ifdim\!xright<\!xtemp + \!xright=\!xtemp + \fi + \advance\!ytemp by -\!dp + \ifdim\!ytemp<\!ybot + \!ybot=\!ytemp + \fi + \advance\!ytemp by \!dp + \advance\!ytemp by \!ht + \ifdim\!ytemp>\!ytop + \!ytop=\!ytemp + \fi} + +\long\def\!setputobject#1#2{% + \setbox\!putobject=\hbox{#1}% + \!ht=\ht\!putobject \!dp=\dp\!putobject \!wd=\wd\!putobject + \wd\!putobject=\!zpt + \!xshift=.5\!wd \!yshift=.5\!ht \advance\!yshift by -.5\!dp + \edef\!putorientation{#2}% + \expandafter\!SPOreadA\!putorientation[]\!nil% + \expandafter\!SPOreadB\!putorientation<\!zpt,\!zpt>\!nil\ignorespaces} + +\def\!SPOreadA#1[#2]#3\!nil{\!etfor\!orientation:=#2\do\!SPOreviseshift} + +\def\!SPOreadB#1<#2,#3>#4\!nil{\advance\!xshift by -#2\advance\!yshift by -#3} + +\def\!SPOreviseshift{% + \if l\!orientation + \!xshift=\!zpt + \else + \if r\!orientation + \!xshift=\!wd + \else + \if b\!orientation + \!yshift=-\!dp + \else + \if B\!orientation + \!yshift=\!zpt + \else + \if t\!orientation + \!yshift=\!ht + \fi + \fi + \fi + \fi + \fi} + + +% ** \!dimenput{OBJECT} [XY] (XLOC,YLOC) +% ** This is an internal put routine, similar to \put, except that +% ** XLOC=distance right from reference point, YLOC=distance up from +% ** reference point. XLOC and YLOC are dimensions, so this routine +% ** is completely independent of the current coordinate system. +% ** This routine does NOT do ROTATIONS. +\long\def\!dimenput#1#2(#3,#4){% + \!setputobject{#1}{#2}% + \!xpos=#3\advance\!xpos by -\!xshift + \!ypos=#4\advance\!ypos by -\!yshift + \kern\!xpos\raise\!ypos\box\!putobject\kern-\!xpos% + \!doaccounting\ignorespaces} + + +% ** The following macros permit the picture drawing routines to be used +% ** either in the default "coordinate mode", or in "dimension mode". +% ** In coordinate mode \!M(1.5,\!xunit) expands to 1.5\!xunit +% ** In dimension mode \!M(1.5pt,\!xunit) expands to 1.5pt +% ** Dimension mode is useful in coding macros. +% ** Any special purpose picture macro that sets dimension mode should +% ** reset coordinate mode before completion. +% ** See Subsection 9.2 of the manual. +\def\!setdimenmode{% + \let\!M=\!M!!\ignorespaces} +\def\!setcoordmode{% + \let\!M=\!M!\ignorespaces} +\def\!ifcoordmode{% + \ifx \!M \!M!} +\def\!ifdimenmode{% + \ifx \!M \!M!!} +\def\!M!#1#2{#1#2} +\def\!M!!#1#2{#1} +\!setcoordmode +\let\setdimensionmode=\!setdimenmode +\let\setcoordinatemode=\!setcoordmode + +% ** \Xdistance{XCOORD}, \Ydistance{YCOORD} are the horizontal and +% ** vertical distances from the origin (0,0) to the point +% ** (XCOORD,YCOORD) in the current coordinate system. +% ** See Subsection 9.2 of the manual. +\def\Xdistance#1{% + \!M{#1}\!xunit + \ignorespaces} +\def\Ydistance#1{% + \!M{#1}\!yunit + \ignorespaces} + +% ** The following macros -- \stack, \line, and \Lines -- are useful for +% ** annotating PiCtures. They can be used outside the \beginpicture ... +% ** \endpicture environment. + +% ** \stack [POSITIONING] {VALUESLIST} +% ** Builds a vertical stack of the values in VALUESLIST. Values in +% ** VALUESLIST are separated by commas. In the resulting stack, values are +% ** centered by default, and positioned flush left (right) if +% ** POSITIONING = l (r). Values are separated vertically by LEADING, +% ** which defaults to \stackleading. +% ** See Subsection 2.3 of the manual. +\def\stack{% + \!ifnextchar[{\!stack}{\!stack[c]}} +\def\!stack[#1]{% + \let\!lglue=\hfill \let\!rglue=\hfill + \expandafter\let\csname !#1glue\endcsname=\relax + \!ifnextchar<{\!!stack}{\!!stack<\stackleading>}} +\def\!!stack<#1>#2{% + \vbox{\def\!valueslist{}\!ecfor\!value:=#2\do{% + \expandafter\!rightappend\!value\withCS{\\}\to\!valueslist}% + \!lop\!valueslist\to\!value + \let\\=\cr\lineskiplimit=\maxdimen\lineskip=#1% + \baselineskip=-1000pt\halign{\!lglue##\!rglue\cr \!value\!valueslist\cr}}% + \ignorespaces} + +% ** \lines [POSITIONING] {LINES} +% ** Builds a vertical array of the lines in LINES. Each line in LINES +% ** is terminated by a \cr. In the resulting array, lines are +% ** centered by default, and positioned flush left (right) if +% ** POSITIONING = l (r). The lines in the array are subject to TeX's +% ** usual spacing rules: in particular the baselines are ordinarily an equal +% ** distance apart. The baseline of the array is the baseline of the +% ** the bottom line. +% ** See Subsection 2.3 of the manual. +\def\lines{% + \!ifnextchar[{\!lines}{\!lines[c]}} +\def\!lines[#1]#2{% + \let\!lglue=\hfill \let\!rglue=\hfill + \expandafter\let\csname !#1glue\endcsname=\relax + \vbox{\halign{\!lglue##\!rglue\cr #2\crcr}}% + \ignorespaces} + +% ** \Lines [POSITIONING] {LINES} +% ** Like \lines, but the baseline of the array is the baseline of the +% ** top line. See Subsection 2.3 of the manual. +\def\Lines{% + \!ifnextchar[{\!Lines}{\!Lines[c]}} +\def\!Lines[#1]#2{% + \let\!lglue=\hfill \let\!rglue=\hfill + \expandafter\let\csname !#1glue\endcsname=\relax + \vtop{\halign{\!lglue##\!rglue\cr #2\crcr}}% + \ignorespaces} + + +% ********************************************* +% *** PLOTTING (Things to do with plotting) *** +% ********************************************* + +% ** User commands +% ** \setplotsymbol ({PLOTSYMBOL} [ORIENTATION] ) +% ** \savelinesandcurves on "FILE_NAME" +% ** \dontsavelinesandcurves +% ** \writesavefile {MESSAGE} +% ** \replot {FILE_NAME} + +% ** Internal command +% ** \!plot(XDIMEN,YDIMEN) + +% ** \setplotsymbol ({PLOTSYMBOL} [ ] < , >) +% ** Save PLOTSYMBOL away in an hbox for use with curve plotting routines +% ** See Subsection 5.2 of the manual. +\def\setplotsymbol(#1#2){% + \!setputobject{#1}{#2} + \setbox\!plotsymbol=\box\!putobject% + \!plotsymbolxshift=\!xshift + \!plotsymbolyshift=\!yshift + \ignorespaces} + +\setplotsymbol({\fiverm .})% ** initialize plotsymbol + + +% ** \!plot is either \!!plot (when no lines and curves are being saved) or +% ** \!!!plot (when lines and curves are being saved) + +% ** \!!plot(XDIMEN,YDIMEN) +% ** Places the current plotsymbol a horizontal distance=XDIMEN-xorigin +% ** and a vertical distance=YDIMEN-yorigin from the current +% ** reference point. +\def\!!plot(#1,#2){% + \!dimenA=-\!plotxorigin \advance \!dimenA by #1% ** over + \!dimenB=-\!plotyorigin \advance \!dimenB by #2% ** up + \kern\!dimenA\raise\!dimenB\copy\!plotsymbol\kern-\!dimenA% + \ignorespaces} + +% ** \!!!plot(XDIMEN,YDIMEN) +% ** Like \!!plot, but also saves the plot location in units of +% ** scaled point, on file `replotfile' +\def\!!!plot(#1,#2){% + \!dimenA=-\!plotxorigin \advance \!dimenA by #1% ** over + \!dimenB=-\!plotyorigin \advance \!dimenB by #2% ** up + \kern\!dimenA\raise\!dimenB\copy\!plotsymbol\kern-\!dimenA% + \!countE=\!dimenA + \!countF=\!dimenB + \immediate\write\!replotfile{\the\!countE,\the\!countF.}% + \ignorespaces} + + +% ** \savelinesandcurves on "FILE_NAME" +% ** Switch to save locations used for plotting lines and curves +% ** (No advantage in saving locations for solid lines; however +% ** replotting curve locations speeds things up by a factor of about 4. +% ** \dontsavelinesandcurves +% ** Terminates \savelinesandcurves. The default. +% ** See Subsection 5.6 of the manual. +\def\savelinesandcurves on "#1" {% + \immediate\closeout\!replotfile + \immediate\openout\!replotfile=#1% + \let\!plot=\!!!plot} + +\def\dontsavelinesandcurves {% + \let\!plot=\!!plot} +\dontsavelinesandcurves + +% ** \writesavefile {MESSAGE} +% ** The message is preceded by a "%", so that it won't interfere +% ** with replotting. +% ** See Subsection 5.6 of the manual. +{\catcode`\%=11\xdef\!Commentsignal{%}} +\def\writesavefile#1 {% + \immediate\write\!replotfile{\!Commentsignal #1}% + \ignorespaces} + +% ** \replot "FILE_NAME" +% ** Replots the locations saved earlier under \savelinesandcurves +% ** on "FILE_NAME" +% ** See Subsection 5.6 of the manual. +\def\replot"#1" {% + \expandafter\!replot\normalinput #1 /} +\def\!replot#1,#2. {% + \!dimenA=#1sp + \kern\!dimenA\raise#2sp\copy\!plotsymbol\kern-\!dimenA + \futurelet\!nextchar\!!replot} +\def\!!replot{% + \if /\!nextchar + \def\!next{\!finish}% + \else + \def\!next{\!replot}% + \fi + \!next} +% ************************************************** +% *** PYTHAGORAS (Euclidean distance function) *** +% ************************************************** + +% ** User command: +% ** \placehypotenuse for and in + +% ** Internal command: +% ** \!Pythag{X}{Y}{Z} +% ** Input X,Y are dimensions, or dimension registers. +% ** Output Z == sqrt(X**2+Y**2) must be a dimension register. +% ** Assumes that |X|+|Y| < 2048pt (about 28in). + +% ** Without loss of generality, suppose x>0, y>0. Put s = x+y, +% ** z = sqrt(x**2+y**2). Then z = s*f, where f = sqrt(t**2 + (1-t)**2) +% ** = sqrt((1+tau**2)/2), where t = x/s and tau = 2(t-1/2) . + +% ** Uses the \!divide macro (which uses registers \!dimenA--\!dimenD. +% ** Uses the \!removept macro (e.g., 123.45pt --> 123.45) +% ** Uses registers \!dimenE--\!dimenI. +\def\!Pythag#1#2#3{% + \!dimenE=#1\relax + \ifdim\!dimenE<\!zpt + \!dimenE=-\!dimenE + \fi% ** dimE = |x| + \!dimenF=#2\relax + \ifdim\!dimenF<\!zpt + \!dimenF=-\!dimenF + \fi% ** dimF = |y| + \advance \!dimenF by \!dimenE% ** dimF = s = |x|+|y| + \ifdim\!dimenF=\!zpt + \!dimenG=\!zpt% ** dimG = z = sqrt(x**2+y**2) + \else + \!divide{8\!dimenE}\!dimenF\!dimenE% ** now dimE = 8t = (8|x|)/s + \advance\!dimenE by -4pt% ** 8tau = (8t-4)*2 + \!dimenE=2\!dimenE% ** (tau = 2*t - 1) + \!removept\!dimenE\!!t% ** 8tau, without "pt" + \!dimenE=\!!t\!dimenE% ** (8tau)**2, in pts + \advance\!dimenE by 64pt% ** u = [64 + (8tau)**2]/2 + \divide \!dimenE by 2% ** [u = (8f)**2] + \!dimenH=7pt% ** initial guess g at sqrt(u) + \!!Pythag\!!Pythag\!!Pythag% ** 3 iterations give sqrt(u) + \!removept\!dimenH\!!t% ** 8f=sqrt(u), without "pt" + \!dimenG=\!!t\!dimenF% ** z = (8f)*s/8 + \divide\!dimenG by 8 + \fi + #3=\!dimenG + \ignorespaces} + +\def\!!Pythag{% ** Newton-Raphson for sqrt + \!divide\!dimenE\!dimenH\!dimenI% ** v = u/g + \advance\!dimenH by \!dimenI% ** g <-- (g + u/g)/2 + \divide\!dimenH by 2} + +% ** \placehypotenuse for and in +% ** See Subsection 9.3 of the manual. +\def\placehypotenuse for <#1> and <#2> in <#3> {% + \!Pythag{#1}{#2}{#3}} + + +% ********************************************** +% *** QUADRATIC ARC (Draws a quadratic arc) *** +% ********************************************** + +% ** Internal command +% ** \!qjoin (XCOORD1,YCOORD1) (XCOORD2,YCOORD2) + +% ** \!qjoin (XCOORD1,YCOORD1) (XCOORD2,YCOORD2) +% ** Draws an arc starting at the (last) point specified by the most recent +% ** \!qjoin, or \!ljoin, or \!start and passing through (X_1,Y_1), (X_2,Y_2). +% ** Uses quadratic interpolation in both x and y: +% ** x(t), 0 <= t <= 1, interpolates x_0, x_1, x_2 at t=0, .5, 1 +% ** y(t), 0 <= t <= 1, interpolates y_0, y_1, y_2 at t=0, .5, 1 + +\def\!qjoin (#1,#2) (#3,#4){% + \advance\!intervalno by 1 + \!ifcoordmode + \edef\!xmidpt{#1}\edef\!ymidpt{#2}% + \else + \!dimenA=#1\relax \edef\!xmidpt{\the\!dimenA}% + \!dimenA=#2\relax \edef\!xmidpt{\the\!dimenA}% + \fi + \!xM=\!M{#1}\!xunit \!yM=\!M{#2}\!yunit \!rotateaboutpivot\!xM\!yM + \!xE=\!M{#3}\!xunit \!yE=\!M{#4}\!yunit \!rotateaboutpivot\!xE\!yE +% +% ** Find coefficients for x(t)=a_x + b_x*t + c_x*t**2 + \!dimenA=\!xM \advance \!dimenA by -\!xS% ** dimA = I = xM - xS + \!dimenB=\!xE \advance \!dimenB by -\!xM% ** dimB = II = xE-xM + \!xB=3\!dimenA \advance \!xB by -\!dimenB% ** b=3I-II + \!xC=2\!dimenB \advance \!xC by -2\!dimenA% ** c=2(II-I) +% +% ** Find coefficients for y(t)=y_x + b_y*t + c_y*t**2 + \!dimenA=\!yM \advance \!dimenA by -\!yS% + \!dimenB=\!yE \advance \!dimenB by -\!yM% + \!yB=3\!dimenA \advance \!yB by -\!dimenB% + \!yC=2\!dimenB \advance \!yC by -2\!dimenA% +% +% ** Use Simpson's rule to calculate arc length over [0,1/2]: +% ** arc length = 1/2[1/6 f(0) + 4/6 f(1/4) + 1/6 f(1/2)] +% ** with f(t) = sqrt(x'(t)**2 + y'(t)**2). + \!xprime=\!xB \!yprime=\!yB% ** x'(t) = b + 2ct + \!dxprime=.5\!xC \!dyprime=.5\!yC% ** dt=1/4 ==> dx'(t) = c/2 + \!getf \!midarclength=\!dimenA + \!getf \advance \!midarclength by 4\!dimenA + \!getf \advance \!midarclength by \!dimenA + \divide \!midarclength by 12 +% +% ** Get arc length over [0,1]. + \!arclength=\!dimenA + \!getf \advance \!arclength by 4\!dimenA + \!getf \advance \!arclength by \!dimenA + \divide \!arclength by 12% ** Now have arc length over [1/2,1] + \advance \!arclength by \!midarclength + \global\advance \totalarclength by \!arclength +% +% +% ** Check to see if there's anything to plot in this interval + \ifdim\!distacross>\!arclength + \advance \!distacross by -\!arclength% ** nothing +% + \else + \!initinverseinterp% ** initialize for inverse interpolation on arc length + \loop\ifdim\!distacross<\!arclength% ** loop over points on arc + \!inverseinterp% ** find t such that arc length[0,t] = distacross, +% ** using inverse quadratic interpolation +% ** now evaluate x(t)=(c*t + b)*t + a + \!xpos=\!t\!xC \advance\!xpos by \!xB + \!xpos=\!t\!xpos \advance \!xpos by \!xS +% ** evaluate y(t) + \!ypos=\!t\!yC \advance\!ypos by \!yB + \!ypos=\!t\!ypos \advance \!ypos by \!yS + \!plotifinbounds% ** plot point if in bounds + \advance\!distacross \plotsymbolspacing%** advance arc length for next pt + \!advancedashing% ** see "linear" + \repeat +% + \advance \!distacross by -\!arclength% ** prepare for next interval + \fi +% + \!xS=\!xE% ** shift ending points to starting points + \!yS=\!yE + \ignorespaces} + + +% ** \!getf -- Calculates sqrt(x'(t)**2 + y'(t)**2) and advances +% ** x'(t) and y'(t) +\def\!getf{\!Pythag\!xprime\!yprime\!dimenA% + \advance\!xprime by \!dxprime + \advance\!yprime by \!dyprime} + + +% ** \!initinverseinterp -- initializes for inverse quadratic interpolation +% ** of arc length provided 1/3 < midarclength/arclength < 2/3; otherwise +% ** initializes for inverse linear interpolation. +\def\!initinverseinterp{% + \ifdim\!arclength>\!zpt + \!divide{8\!midarclength}\!arclength\!dimenE% ** dimE=8w=8r/s, where r +% ** = midarclength, s=arclength +% ** Test for w out of range: w<1/3 or w>2/3 + \ifdim\!dimenE<\!wmin \!setinverselinear + \else + \ifdim\!dimenE>\!wmax \!setinverselinear + \else% ** w in range: initialize + \def\!inverseinterp{\!inversequad}\ignorespaces +% +% ** Calculate the coefficients \!beta and \!gamma of the quadratic +% ** t = \!beta*v + \!gamma*v**2 +% ** taking the values t=0, 1/2, 1 at v=0, w==r/s, 1 respectively: +% ** \!beta = (1/2 - w**2)/[w(1-w)] +% ** \!gamma = 1 - beta. +% + \!removept\!dimenE\!Ew% ** 8w, without "pt" + \!dimenF=-\!Ew\!dimenE% ** -(8w)**2 + \advance\!dimenF by 32pt% ** 32 - (8w)**2 + \!dimenG=8pt + \advance\!dimenG by -\!dimenE% ** 8 - 8w + \!dimenG=\!Ew\!dimenG% ** (8w)*(8-8w) + \!divide\!dimenF\!dimenG\!beta% ** beta = (32-(8w)**2)/(8w(8-8w)) +% ** = (1/2 - w**2)/(w(1-w)) + \!gamma=1pt + \advance \!gamma by -\!beta% ** gamma = 1-beta + \fi% ** end of the \ifdim\!dimenE>\!wmax + \fi% ** end of the \ifdim\!dimenE<\!wmin + \fi% ** end of the \ifdim\!arclength>\!zpt + \ignorespaces} + + +% ** For 0 <= t <= 1, let AL(t) = arclength[0,t]/arclength[0,1]; note +% ** AL(0)=0, AL(1/2)=midarclength/arclength, AL(1)=1. This routine +% ** calculates an approximation to AL^{-1}(distance across/arclength), +% ** using the assumption that AL^{-1} is quadratic. Specifically, +% ** it finds t such that +% ** AL^{-1}(v) =. t = v*(\!beta + \!gamma*v) +% ** where \!beta and \!gamma are set by \!initinv, and where +% ** v=distance across/arclength +\def\!inversequad{% + \!divide\!distacross\!arclength\!dimenG% ** dimG = v = distacross/arclength + \!removept\!dimenG\!v% ** v, without "pt" + \!dimenG=\!v\!gamma% ** gamma*v + \advance\!dimenG by \!beta% ** beta + gamma*v + \!dimenG=\!v\!dimenG% ** t = v*(beta + gamma*v) + \!removept\!dimenG\!t}% ** t, without "pt" + + +% ** When w <= 1/3 or w >= 2/3, the following routine writes (using +% ** plain TEK's \wlog command) a warning message on the user's log file, +% ** and initializes for inverse linear interpolation on arc length. +\def\!setinverselinear{% + \def\!inverseinterp{\!inverselinear}% + \divide\!dimenE by 8 \!removept\!dimenE\!t + \!countC=\!intervalno \multiply \!countC 2 + \!countB=\!countC \advance \!countB -1 + \!countA=\!countB \advance \!countA -1 + \wlog{\the\!countB th point (\!xmidpt,\!ymidpt) being plotted + doesn't lie in the}% + \wlog{ middle third of the arc between the \the\!countA th + and \the\!countC th points:}% + \wlog{ [arc length \the\!countA\space to \the\!countB]/[arc length + \the \!countA\space to \the\!countC]=\!t.}% + \ignorespaces} + +% ** Inverse linear interpolation +\def\!inverselinear{% + \!divide\!distacross\!arclength\!dimenG + \!removept\!dimenG\!t} + + +% ************************************** +% ** ROTATIONS (Handles rotations) *** +% ************************************** + +% ** User commands +% ** \startrotation [by COS_OF_ANGLE SIN_OF_ANGLE] [about XPIVOT YPIVOT] +% ** \stoprotation + +% ** \startrotation [by COS_OF_ANGLE SIN_OF_ANGLE] [about XPIVOT YPIVOT] +% ** Future (XCOORD,YCOORD)'s will be rotated about (XPIVOT,YPIVOT) +% ** by the angle with the give COS and SIN. Both fields are optional. +% ** [COS,SIN] defaults to previous value, or (1,0). +% ** (XPIVOT,YPIVOT) defaults to previous value, or (0,0) +% ** You can't change the coordinate system in the scope of a rotation. +% ** See Subsection 9.1 of the manual. +\def\startrotation{% + \let\!rotateaboutpivot=\!!rotateaboutpivot + \let\!rotateonly=\!!rotateonly + \!ifnextchar{b}{\!getsincos }% + {\!getsincos by {\!cosrotationangle} {\!sinrotationangle} }} +\def\!getsincos by #1 #2 {% + \edef\!cosrotationangle{#1}% + \edef\!sinrotationangle{#2}% + \!ifcoordmode + \let\!ROnext=\!ccheckforpivot + \else + \let\!ROnext=\!dcheckforpivot + \fi + \!ROnext} +\def\!ccheckforpivot{% + \!ifnextchar{a}{\!cgetpivot}% + {\!cgetpivot about {\!xpivotcoord} {\!ypivotcoord} }} +\def\!cgetpivot about #1 #2 {% + \edef\!xpivotcoord{#1}% + \edef\!ypivotcoord{#2}% + \!xpivot=#1\!xunit \!ypivot=#2\!yunit + \ignorespaces} +\def\!dcheckforpivot{% + \!ifnextchar{a}{\!dgetpivot}{\ignorespaces}} +\def\!dgetpivot about #1 #2 {% + \!xpivot=#1\relax \!ypivot=#2\relax + \ignorespaces} + + +% ** Following terminates rotation. +% ** See Subsection 9.1 of the manual. +\def\stoprotation{% + \let\!rotateaboutpivot=\!!!rotateaboutpivot + \let\!rotateonly=\!!!rotateonly + \ignorespaces} + +% ** !!rotateaboutpivot{XREG}{YREG} +% ** XREG <-- xpvt + cos(angle)*(XREG-xpvt) - sin(angle)*(YREG-ypvt) +% ** YREG <-- ypvt + cos(angle)*(YREG-ypvt) + sin(angle)*(XREG-xpvt) +% ** XREG,YREG are dimension registers. Can't be \!dimenA to \!dimenD +\def\!!rotateaboutpivot#1#2{% + \!dimenA=#1\relax \advance\!dimenA -\!xpivot + \!dimenB=#2\relax \advance\!dimenB -\!ypivot + \!dimenC=\!cosrotationangle\!dimenA + \advance \!dimenC -\!sinrotationangle\!dimenB + \!dimenD=\!cosrotationangle\!dimenB + \advance \!dimenD \!sinrotationangle\!dimenA + \advance\!dimenC \!xpivot \advance\!dimenD \!ypivot + #1=\!dimenC #2=\!dimenD + \ignorespaces} + +% ** \!!rotateonly{XREG}{YREG} +% ** Like \!!rotateaboutpivot, but with a pivot of (0,0) +\def\!!rotateonly#1#2{% + \!dimenA=#1\relax \!dimenB=#2\relax + \!dimenC=\!cosrotationangle\!dimenA + \advance \!dimenC -\!rotsign\!sinrotationangle\!dimenB + \!dimenD=\!cosrotationangle\!dimenB + \advance \!dimenD \!rotsign\!sinrotationangle\!dimenA + #1=\!dimenC #2=\!dimenD + \ignorespaces} +\def\!rotsign{} +\def\!!!rotateaboutpivot#1#2{\relax} +\def\!!!rotateonly#1#2{\relax} +\stoprotation + +\def\!reverserotateonly#1#2{% + \def\!rotsign{-}% + \!rotateonly{#1}{#2}% + \def\!rotsign{}% + \ignorespaces} + + +% ********************************** +% *** SHADING (Handles shading) *** +% ********************************** + +% ** User commands +% ** \setshadegrid [span ] [point at XSHADE YSHADE] +% ** \setshadesymbol [] ({SHADESYMBOL} +% ** [ORIENTATION]) + +% ** Internal commands: +% ** \!startvshade (xS,ybS,ytS) +% ** \!starthshade (yS,xlS,xrS) +% ** \!lshade [] +% ** ** when shading vertically: +% ** [the region from (xS,ybS,ytS) to] (xE,ybE,ytE) +% ** ** when shading horizontally: +% ** [the region from (yS,xlS,xrS) to] (yE,xlE,xrE) +% ** \!qshade [] +% ** ** when shading vertically: +% ** [the region from (xS,ybS,ytS) to] (xM,ybM,ytM) (xE,ybE,ytE) +% ** ** when shading horizontally: +% ** [the region from (yS,xlS,xrS) to] (yM,xlM,xrM) (yE,xlE,xrE) +% ** \!lattice{ANCHOR}{SPAN}{LOCATION}{INDEX}{LATTICE LOCATION} +% ** \!override{NOMINAL DIMEN}{REPLACEMENT DIMEN}{DIMEN} + + +% ** The shading routine can operate either in a "vertical mode" or a +% ** "horizontal mode". In vertical mode, the region to be shaded is specified +% ** in the form +% ** {(x,y): xl <= x <= xr & yb(x) <= y <= yt(x)} +% ** where yb and yt are functions of x. In horizontal mode, the region +% ** is specified in the form +% ** {(x,y): yb <= y <= yt & xl(y) <= x <= xr(y)}. +% ** The functions yb and yt may be either both linear or both quadratic; +% ** similarly for xl and xr. A region with say, piecewise quadratic bottom +% ** and top boundaries, can be shaded by consecutive (vertical) \!qshades, +% ** proceeding from left to right. Similarly, a region with piecewise +% ** quadratic left and right boundaries can be shaded by consecutive +% ** (horizontal) \!qshades, proceeding from bottom to top. More complex +% ** regions can be shaded by partitioning them into appropriate subregions, +% ** and shading those. + +% ** Shading is accomplished by placing a user-selected shading symbol at +% ** those points of a regular grid which fall within the region to be +% ** shaded. This region can be "shrunk" so that a largish shading symbol +% ** will not extend outside it. Shrinking is accomplished by specifying +% ** shrinkages for the left, right, bottom, and top boundaries, in a manner +% ** discussed further below. + +% ** \shades and \!joins MUST NOT be intermingled. Finish drawing a curve +% ** before starting to shade a region, and finish shading a region before +% ** starting to draw a curve. + + +% ** \setshadegrid [span ] [point at XSHADE YSHADE] +% ** The shading symbol is placed down on the points of a grid centered +% ** at the coordinate point (XSHADE,YSHADE). The grid points are of the +% ** form (j*SPAN,k*SPAN), with j+k even. SPAN is specified +% ** as a dimension. +% ** (XSHADE,YSHADE) defaults to previous (XSHADE,YSHADE) (or (0,0) if none) +% ** SPAN defaults to previous span (or 5pt if none) +% ** See Subsection 7.2 of the manual. +\def\setshadegrid{% + \!ifnextchar{s}{\!getspan } + {\!getspan span <\!dshade>}} +\def\!getspan span <#1>{% + \!dshade=#1\relax + \!ifcoordmode + \let\!GRnext=\!GRccheckforAP + \else + \let\!GRnext=\!GRdcheckforAP + \fi + \!GRnext} +\def\!GRccheckforAP{% + \!ifnextchar{p}{\!cgetanchor } + {\!cgetanchor point at {\!xshadesave} {\!yshadesave} }} +\def\!cgetanchor point at #1 #2 {% + \edef\!xshadesave{#1}\edef\!yshadesave{#2}% + \!xshade=\!xshadesave\!xunit \!yshade=\!yshadesave\!yunit + \ignorespaces} +\def\!GRdcheckforAP{% + \!ifnextchar{p}{\!dgetanchor}% + {\ignorespaces}} +\def\!dgetanchor point at #1 #2 {% + \!xshade=#1\relax \!yshade=#2\relax + \ignorespaces} + +% ** \setshadesymbol [] ({SHADESYMBOL} +% ** [ORIENTATION]) +% ** Saves SHADESYMBOL away in an hbox for use with shading routines. +% ** A shade symbol will not be plotted if its plot position comes within +% ** distance LS of the left boundary, RS of the right boundary, TS of the +% ** top boundary, BS of the bottom boundary. These parameters have +% ** default values that should work in most cases (see below). +% ** To override a default value, specify the replacement value +% ** in the appropriate subfield of the shrinkages field. +% ** 0pt may be coded as "z" (without the quotes). To accept a +% ** default value, leave the field empty. Thus +% ** [,z,,5pt] sets LS=default, RS=0pt, BS=default, TS=5pt . +% ** Skipping the shrinkages field accepts all the defaults. +% ** See Subsection 7.1 of the manual. +\def\setshadesymbol{% + \!ifnextchar<{\!setshadesymbol}{\!setshadesymbol<,,,> }} + +\def\!setshadesymbol <#1,#2,#3,#4> (#5#6){% +% ** set the shadesymbol + \!setputobject{#5}{#6}% + \setbox\!shadesymbol=\box\!putobject% + \!shadesymbolxshift=\!xshift \!shadesymbolyshift=\!yshift +% +% ** set the shrinkages + \!dimenA=\!xshift \advance\!dimenA \!smidge% ** default LS = xshift - smidge + \!override\!dimenA{#1}\!lshrinkage% + \!dimenA=\!wd \advance \!dimenA -\!xshift% ** default RS = width - xshift + \advance\!dimenA \!smidge% - smidge + \!override\!dimenA{#2}\!rshrinkage + \!dimenA=\!dp \advance \!dimenA \!yshift% ** default BS = depth + yshift + \advance\!dimenA \!smidge% - smidge + \!override\!dimenA{#3}\!bshrinkage + \!dimenA=\!ht \advance \!dimenA -\!yshift% ** default TS = height - yshift + \advance\!dimenA \!smidge% - smidge + \!override\!dimenA{#4}\!tshrinkage + \ignorespaces} +\def\!smidge{-.2pt}% + +% ** \!override{NOMINAL DIMEN}{REPLACEMENT DIMEN}{DIMEN} +% ** Overrides the NOMINAL DIMEN by the REPLACEMENT DIMEN to produce DIMEN, +% ** according to the following rules: +% ** REPLACEMENT DIMEN empty: DIMEN <-- NOMINAL DIMEN +% ** REPLACEMENT DIMEN z: DIMEN <-- 0pt +% ** otherwise: DIMEN <-- REPLACEMENT DIMEN +% ** DIMEN must be a dimension register +\def\!override#1#2#3{% + \edef\!!override{#2}% + \ifx \!!override\empty + #3=#1\relax + \else + \if z\!!override + #3=\!zpt + \else + \ifx \!!override\!blankz + #3=\!zpt + \else + #3=#2\relax + \fi + \fi + \fi + \ignorespaces} +\def\!blankz{ z} + +\setshadesymbol ({\fiverm .})% ** initialize plotsymbol +% ** \fivesy ^^B is a small cross + + +% ** \!startvshade [at] (xS,ybS,ytS) +% ** Initiates vertical shading mode +\def\!startvshade#1(#2,#3,#4){% + \let\!!xunit=\!xunit% + \let\!!yunit=\!yunit% + \let\!!xshade=\!xshade% + \let\!!yshade=\!yshade% + \def\!getshrinkages{\!vgetshrinkages}% + \let\!setshadelocation=\!vsetshadelocation% + \!xS=\!M{#2}\!!xunit + \!ybS=\!M{#3}\!!yunit + \!ytS=\!M{#4}\!!yunit + \!shadexorigin=\!xorigin \advance \!shadexorigin \!shadesymbolxshift + \!shadeyorigin=\!yorigin \advance \!shadeyorigin \!shadesymbolyshift + \ignorespaces} + +% ** \!starthshade [at] (yS,xlS,xrS) +% ** Initiates horizontal shading mode +\def\!starthshade#1(#2,#3,#4){% + \let\!!xunit=\!yunit% + \let\!!yunit=\!xunit% + \let\!!xshade=\!yshade% + \let\!!yshade=\!xshade% + \def\!getshrinkages{\!hgetshrinkages}% + \let\!setshadelocation=\!hsetshadelocation% + \!xS=\!M{#2}\!!xunit + \!ybS=\!M{#3}\!!yunit + \!ytS=\!M{#4}\!!yunit + \!shadexorigin=\!xorigin \advance \!shadexorigin \!shadesymbolxshift + \!shadeyorigin=\!yorigin \advance \!shadeyorigin \!shadesymbolyshift + \ignorespaces} + + +% ** \!lattice{ANCHOR}{SPAN}{LOCATION}{INDEX}{LATTICE LOCATION} +% ** Consider the lattice with points ANCHOR + j*SPAN. This routine determines +% ** the index k of the smallest lattice point >= LOCATION, and sets +% ** LATTICE LOCATION = ANCHOR + k*SPAN. +% ** INDEX is assumed to be a count register, LATTICE LOCATION a dimen reg. +\def\!lattice#1#2#3#4#5{% + \!dimenA=#1% ** dimA = ANCHOR + \!dimenB=#2% ** dimB = SPAN (assumed > 0pt) + \!countB=\!dimenB% ** ctB = SPAN, as a count +% +% ** Determine index of smallest lattice point >= LOCATION + \!dimenC=#3% ** dimC = LOCATION + \advance\!dimenC -\!dimenA% ** now dimC = LOCATION-ANCHOR + \!countA=\!dimenC% ** ctA = above, as a count + \divide\!countA \!countB% ** now ctA = desired index, if dimC <= 0 + \ifdim\!dimenC>\!zpt + \!dimenD=\!countA\!dimenB% ** (tentative k)*span + \ifdim\!dimenD<\!dimenC% ** if this is false, ctA = desired index + \advance\!countA 1 % ** if true, have to add 1 + \fi + \fi +% + \!dimenC=\!countA\!dimenB% ** lattice location = anchor + ctA*span + \advance\!dimenC \!dimenA + #4=\!countA% ** the desired index + #5=\!dimenC% ** corresponding lattice location + \ignorespaces} + + +% ** \!qshade [with shrinkages] [[LS,RS,BS,TS]] +% ***** during vertical shading: +% ** [the region from (xS,ybS,ytS) to] (xM,ybM,ytM) [and] (xE,ybE,ytE) +% ** Shades the region {(x,y): xS <= x <= xE, yb(x) <= y <= yt(x)}, where +% ** yb is the quadratic thru (xS,ybS) & (xM,ybM) & (xE,ybE) +% ** yt is the quadratic thru (xS,ytS) & (xM,ybM) & (xE,ytE) +% ** xS,ybS,ytS are either given by \!startvshade or carried over +% ** as the ending values of the immediately preceding \!qshade. +% ** For the interpretation of LS, RS, BS, & TS, see \setshadesymbol. The +% ** values set there can be overridden, for the course of this \!qshade +% ** only, in the same manner as overrides are specified for +% ** \setshadesymbol. +% ***** during horizontal shading: +% ** [the region from (yS,xlS,xrS) to] (yM,xlM,xrM) [and] (yE,xlE,xrE) +\def\!qshade#1(#2,#3,#4)#5(#6,#7,#8){% + \!xM=\!M{#2}\!!xunit + \!ybM=\!M{#3}\!!yunit + \!ytM=\!M{#4}\!!yunit + \!xE=\!M{#6}\!!xunit + \!ybE=\!M{#7}\!!yunit + \!ytE=\!M{#8}\!!yunit + \!getcoeffs\!xS\!ybS\!xM\!ybM\!xE\!ybE\!ybB\!ybC%**Get coefficients B & C for + \!getcoeffs\!xS\!ytS\!xM\!ytM\!xE\!ytE\!ytB\!ytC%**y=y0 + B(x-X0) + C(x-X0)**2 + \def\!getylimits{\!qgetylimits}% + \!shade{#1}\ignorespaces} + +% ** \!lshade ... (xE,ybE,ytE) +% ** This is like \!qshade, but the top and bottom boundaries are linear, +% ** rather than quadratic. +\def\!lshade#1(#2,#3,#4){% + \!xE=\!M{#2}\!!xunit + \!ybE=\!M{#3}\!!yunit + \!ytE=\!M{#4}\!!yunit + \!dimenE=\!xE \advance \!dimenE -\!xS% ** xE-xS + \!dimenC=\!ytE \advance \!dimenC -\!ytS% ** ytE-ytS + \!divide\!dimenC\!dimenE\!ytB% ** ytB = (ytE-ytS)/(xE-xS) + \!dimenC=\!ybE \advance \!dimenC -\!ybS% ** ybE-ybS + \!divide\!dimenC\!dimenE\!ybB% ** ybB = (ybE-ybS)/(xE-xS) + \def\!getylimits{\!lgetylimits}% + \!shade{#1}\ignorespaces} + +% ** \!getcoeffs{X0}{Y0}{X1}{Y1}{X2}{Y2}{B}{C} +% ** Finds B and C such that the quadratic y = Y0 + B(x-X0) + C(x-X0)**2 +% ** passes through (X1,Y1) and (X2,Y2): when X0=0=Y0, the formulas are: +% ** B = S1 - X1*C, C = (S2-S1)/X2 +% ** with +% ** S1 = Y1/X1, S2 = (Y2-Y1)/(X2-X1). +\def\!getcoeffs#1#2#3#4#5#6#7#8{% + \!dimenC=#4\advance \!dimenC -#2% ** dimC=Y1-Y0 + \!dimenE=#3\advance \!dimenE -#1% ** dimE=X1-X0 + \!divide\!dimenC\!dimenE\!dimenF% ** dimF=S1 + \!dimenC=#6\advance \!dimenC -#4% ** dimC=Y2-Y1 + \!dimenH=#5\advance \!dimenH -#3% ** dimH=X2-X1 + \!divide\!dimenC\!dimenH\!dimenG% ** dimG=S2 + \advance\!dimenG -\!dimenF% ** dimG=S2-S1 + \advance \!dimenH \!dimenE% ** dimH=X2-X0 + \!divide\!dimenG\!dimenH#8% ** C=(S2-S1)/(X2-X0) + \!removept#8\!t% ** C, without "pt" + #7=-\!t\!dimenE% ** -C*(X1-X0) + \advance #7\!dimenF% ** B=S1-C*(X1-X0) + \ignorespaces} + + +\def\!shade#1{% +% ** Get LS,RS,BS,TS for this panel + \!getshrinkages#1<,,,>\!nil% % ** now effective LS=dimE, RS=dimF, +% ** BS=dimG, TS=dimH + \advance \!dimenE \!xS% ** now dimE=xS+LS + \!lattice\!!xshade\!dshade\!dimenE% ** set parity=index of left-mst x-lattice + \!parity\!xpos% ** point >= xS+LS, xpos=its location + \!dimenF=-\!dimenF% ** set dimF=xE-RS + \advance\!dimenF \!xE +% + \!loop\!not{\ifdim\!xpos>\!dimenF}% ** loop over x-lattice points <= xE-RS + \!shadecolumn% + \advance\!xpos \!dshade% ** move over to next column + \advance\!parity 1% ** increase index of x-point + \repeat +% + \!xS=\!xE% ** shift ending values to starting values + \!ybS=\!ybE + \!ytS=\!ytE + \ignorespaces} + + +\def\!vgetshrinkages#1<#2,#3,#4,#5>#6\!nil{% + \!override\!lshrinkage{#2}\!dimenE + \!override\!rshrinkage{#3}\!dimenF + \!override\!bshrinkage{#4}\!dimenG + \!override\!tshrinkage{#5}\!dimenH + \ignorespaces} +\def\!hgetshrinkages#1<#2,#3,#4,#5>#6\!nil{% + \!override\!lshrinkage{#2}\!dimenG + \!override\!rshrinkage{#3}\!dimenH + \!override\!bshrinkage{#4}\!dimenE + \!override\!tshrinkage{#5}\!dimenF + \ignorespaces} + + +\def\!shadecolumn{% + \!dxpos=\!xpos + \advance\!dxpos -\!xS% ** dx = x - xS + \!removept\!dxpos\!dx% ** ditto, without "pt" + \!getylimits% ** get top and bottom y-values + \advance\!ytpos -\!dimenH% ** less TS + \advance\!ybpos \!dimenG% ** plus BS + \!yloc=\!!yshade% ** get anchor point for this column + \ifodd\!parity + \advance\!yloc \!dshade + \fi + \!lattice\!yloc{2\!dshade}\!ybpos% + \!countA\!ypos% ** ypos=smallest y point for this column + \!dimenA=-\!shadexorigin \advance \!dimenA \!xpos% ** over + \loop\!not{\ifdim\!ypos>\!ytpos}% ** loop over ypos <= yt(t) + \!setshadelocation% ** vmode: xloc=xpos, yloc=ypos +% ** hmode: xloc=ypos, yloc=xpos + \!rotateaboutpivot\!xloc\!yloc% + \!dimenA=-\!shadexorigin \advance \!dimenA \!xloc% ** over + \!dimenB=-\!shadeyorigin \advance \!dimenB \!yloc% ** up + \kern\!dimenA \raise\!dimenB\copy\!shadesymbol \kern-\!dimenA + \advance\!ypos 2\!dshade + \repeat + \ignorespaces} + +\def\!qgetylimits{% + \!dimenA=\!dx\!ytC + \advance\!dimenA \!ytB% ** yt(t)=ytS + dx*(Bt + dx*Ct) + \!ytpos=\!dx\!dimenA + \advance\!ytpos \!ytS + \!dimenA=\!dx\!ybC + \advance\!dimenA \!ybB% ** yb(t)=ybS + dx*(Bb + dx*Cb) + \!ybpos=\!dx\!dimenA + \advance\!ybpos \!ybS} + +\def\!lgetylimits{% + \!ytpos=\!dx\!ytB% ** yt(t)=ytS + dx*Bt + \advance\!ytpos \!ytS + \!ybpos=\!dx\!ybB% ** yb(t)=ybS + dx*Bb + \advance\!ybpos \!ybS} + +\def\!vsetshadelocation{% ** vmode: xloc=xpos, yloc=ypos + \!xloc=\!xpos + \!yloc=\!ypos} +\def\!hsetshadelocation{% ** hmode: xloc=ypos, yloc=xpos + \!xloc=\!ypos + \!yloc=\!xpos} + + +% ************************************** +% *** TICKS (Draws ticks on graphs) *** +% ************************************** + +% ** User commands +% ** \ticksout +% ** \ticksin +% ** \gridlines +% ** \nogridlines +% ** \loggedticks +% ** \unloggesticks +% ** See Subsection 3.4 of the manual + +% ** The following is an option of the \axis command +% ** ticks +% ** [in] [out] +% ** [long] [short] [length ] +% ** [width ] +% ** [andacross] [butnotacross] +% ** [logged] [unlogged] +% ** [unlabeled] [numbered] [withvalues VALUE1 VALUE2 ... VALUEk / ] +% ** [quantity Q] [at LOC1 LOC2 ... LOCk / ] [from LOC1 to LOC2 by +% ** LOC_INCREMENT] +% ** See Subsection 3.2 of the manual for the rules. + +% ** The various options of the tick field are processed by the +% ** \!nextkeyword command defined below. +% ** For example, `\!nextkeyword short ' expands to `\!ticksshort', +% ** while `\!nextkeyword withvalues' expands to `\!tickswithvalues'. + +\def\!axisticks {% + \def\!nextkeyword##1 {% + \expandafter\ifx\csname !ticks##1\endcsname \relax + \def\!next{\!fixkeyword{##1}}% + \else + \def\!next{\csname !ticks##1\endcsname}% + \fi + \!next}% + \!axissetup + \def\!axissetup{\relax}% + \edef\!ticksinoutsign{\!ticksinoutSign}% + \!ticklength=\longticklength + \!tickwidth=\linethickness + \!gridlinestatus + \!setticktransform + \!maketick + \!tickcase=0 + \def\!LTlist{}% + \!nextkeyword} + +\def\ticksout{% + \def\!ticksinoutSign{+}} +\def\ticksin{% + \def\!ticksinoutSign{-}} +\ticksout + +\def\gridlines{% + \def\!gridlinestatus{\!gridlinestootrue}} +\def\nogridlines{% + \def\!gridlinestatus{\!gridlinestoofalse}} +\nogridlines + +\def\loggedticks{% + \def\!setticktransform{\let\!ticktransform=\!logten}} +\def\unloggedticks{% + \def\!setticktransform{\let\!ticktransform=\!donothing}} +\def\!donothing#1#2{\def#2{#1}} +\unloggedticks + +% ** \!ticks/ : terminates read of tick options +\expandafter\def\csname !ticks/\endcsname{% + \!not {\ifx \!LTlist\empty} + \!placetickvalues + \fi + \def\!tickvalueslist{}% + \def\!LTlist{}% + \expandafter\csname !axis/\endcsname} + +\def\!maketick{% + \setbox\!boxA=\hbox{% + \beginpicture + \!setdimenmode + \setcoordinatesystem point at {\!zpt} {\!zpt} + \linethickness=\!tickwidth + \ifdim\!ticklength>\!zpt + \putrule from {\!zpt} {\!zpt} to + {\!ticksinoutsign\!tickxsign\!ticklength} + {\!ticksinoutsign\!tickysign\!ticklength} + \fi + \if!gridlinestoo + \putrule from {\!zpt} {\!zpt} to + {-\!tickxsign\!xaxislength} {-\!tickysign\!yaxislength} + \fi + \endpicturesave <\!Xsave,\!Ysave>}% + \wd\!boxA=\!zpt} + +\def\!ticksin{% + \def\!ticksinoutsign{-}% + \!maketick + \!nextkeyword} + +\def\!ticksout{% + \def\!ticksinoutsign{+}% + \!maketick + \!nextkeyword} + +\def\!tickslength<#1> {% + \!ticklength=#1\relax + \!maketick + \!nextkeyword} + +\def\!tickslong{% + \!tickslength<\longticklength> } + +\def\!ticksshort{% + \!tickslength<\shortticklength> } + +\def\!tickswidth<#1> {% + \!tickwidth=#1\relax + \!maketick + \!nextkeyword} + +\def\!ticksandacross{% + \!gridlinestootrue + \!maketick + \!nextkeyword} + +\def\!ticksbutnotacross{% + \!gridlinestoofalse + \!maketick + \!nextkeyword} + +\def\!tickslogged{% + \let\!ticktransform=\!logten + \!nextkeyword} + +\def\!ticksunlogged{% + \let\!ticktransform=\!donothing + \!nextkeyword} + +\def\!ticksunlabeled{% + \!tickcase=0 + \!nextkeyword} + +\def\!ticksnumbered{% + \!tickcase=1 + \!nextkeyword} + +\def\!tickswithvalues#1/ {% + \edef\!tickvalueslist{#1! /}% + \!tickcase=2 + \!nextkeyword} + +\def\!ticksquantity#1 {% + \ifnum #1>1 + \!updatetickoffset + \!countA=#1\relax + \advance \!countA -1 + \!ticklocationincr=\!axisLength + \divide \!ticklocationincr \!countA + \!ticklocation=\!axisstart + \loop \!not{\ifdim \!ticklocation>\!axisend} + \!placetick\!ticklocation + \ifcase\!tickcase + \relax % Case 0: no labels + \or + \relax % Case 1: numbered -- not available here + \or + \expandafter\!gettickvaluefrom\!tickvalueslist + \edef\!tickfield{{\the\!ticklocation}{\!value}}% + \expandafter\!listaddon\expandafter{\!tickfield}\!LTlist% + \fi + \advance \!ticklocation \!ticklocationincr + \repeat + \fi + \!nextkeyword} + +\def\!ticksat#1 {% + \!updatetickoffset + \edef\!Loc{#1}% + \if /\!Loc + \def\next{\!nextkeyword}% + \else + \!ticksincommon + \def\next{\!ticksat}% + \fi + \next} + +\def\!ticksfrom#1 to #2 by #3 {% + \!updatetickoffset + \edef\!arg{#3}% + \expandafter\!separate\!arg\!nil + \!scalefactor=1 + \expandafter\!countfigures\!arg/ + \edef\!arg{#1}% + \!scaleup\!arg by\!scalefactor to\!countE + \edef\!arg{#2}% + \!scaleup\!arg by\!scalefactor to\!countF + \edef\!arg{#3}% + \!scaleup\!arg by\!scalefactor to\!countG + \loop \!not{\ifnum\!countE>\!countF} + \ifnum\!scalefactor=1 + \edef\!Loc{\the\!countE}% + \else + \!scaledown\!countE by\!scalefactor to\!Loc + \fi + \!ticksincommon + \advance \!countE \!countG + \repeat + \!nextkeyword} + +\def\!updatetickoffset{% + \!dimenA=\!ticksinoutsign\!ticklength + \ifdim \!dimenA>\!offset + \!offset=\!dimenA + \fi} + +\def\!placetick#1{% + \if!xswitch + \!xpos=#1\relax + \!ypos=\!axisylevel + \else + \!xpos=\!axisxlevel + \!ypos=#1\relax + \fi + \advance\!xpos \!Xsave + \advance\!ypos \!Ysave + \kern\!xpos\raise\!ypos\copy\!boxA\kern-\!xpos + \ignorespaces} + +\def\!gettickvaluefrom#1 #2 /{% + \edef\!value{#1}% + \edef\!tickvalueslist{#2 /}% + \ifx \!tickvalueslist\!endtickvaluelist + \!tickcase=0 + \fi} +\def\!endtickvaluelist{! /} + +\def\!ticksincommon{% + \!ticktransform\!Loc\!t + \!ticklocation=\!t\!!unit + \advance\!ticklocation -\!!origin + \!placetick\!ticklocation + \ifcase\!tickcase + \relax % Case 0: no labels + \or % Case 1: numbered + \ifdim\!ticklocation<-\!!origin + \edef\!Loc{$\!Loc$}% + \fi + \edef\!tickfield{{\the\!ticklocation}{\!Loc}}% + \expandafter\!listaddon\expandafter{\!tickfield}\!LTlist% + \or % Case 2: labeled + \expandafter\!gettickvaluefrom\!tickvalueslist + \edef\!tickfield{{\the\!ticklocation}{\!value}}% + \expandafter\!listaddon\expandafter{\!tickfield}\!LTlist% + \fi} + +\def\!separate#1\!nil{% + \!ifnextchar{-}{\!!separate}{\!!!separate}#1\!nil} +\def\!!separate-#1\!nil{% + \def\!sign{-}% + \!!!!separate#1..\!nil} +\def\!!!separate#1\!nil{% + \def\!sign{+}% + \!!!!separate#1..\!nil} +\def\!!!!separate#1.#2.#3\!nil{% + \def\!arg{#1}% + \ifx\!arg\!empty + \!countA=0 + \else + \!countA=\!arg + \fi + \def\!arg{#2}% + \ifx\!arg\!empty + \!countB=0 + \else + \!countB=\!arg + \fi} + +\def\!countfigures#1{% + \if #1/% + \def\!next{\ignorespaces}% + \else + \multiply\!scalefactor 10 + \def\!next{\!countfigures}% + \fi + \!next} + +\def\!scaleup#1by#2to#3{% + \expandafter\!separate#1\!nil + \multiply\!countA #2\relax + \advance\!countA \!countB + \if -\!sign + \!countA=-\!countA + \fi + #3=\!countA + \ignorespaces} + +\def\!scaledown#1by#2to#3{% + \!countA=#1\relax% ** get original # + \ifnum \!countA<0 % ** take abs value, + \def\!sign{-}% ** remember sign + \!countA=-\!countA + \else + \def\!sign{}% + \fi + \!countB=\!countA% ** copy |#| + \divide\!countB #2\relax% ** integer part (|#|/sf) + \!countC=\!countB% ** get sf * (|#|/sf) + \multiply\!countC #2\relax + \advance \!countA -\!countC% ** ctA is now remainder + \edef#3{\!sign\the\!countB.}% ** +- integerpart. + \!countC=\!countA % ** Tack on proper number + \ifnum\!countC=0 % ** of zeros after . + \!countC=1 + \fi + \multiply\!countC 10 + \!loop \ifnum #2>\!countC + \edef#3{#3\!zero}% + \multiply\!countC 10 + \repeat + \edef#3{#3\the\!countA}% ** Add on rest of remainder + \ignorespaces} + +\def\!placetickvalues{% + \advance\!offset \tickstovaluesleading + \if!xswitch + \setbox\!boxA=\hbox{% + \def\\##1##2{% + \!dimenput {##2} [B] (##1,\!axisylevel)}% + \beginpicture + \!LTlist + \endpicturesave <\!Xsave,\!Ysave>}% + \!dimenA=\!axisylevel + \advance\!dimenA -\!Ysave + \advance\!dimenA \!tickysign\!offset + \if -\!tickysign + \advance\!dimenA -\ht\!boxA + \else + \advance\!dimenA \dp\!boxA + \fi + \advance\!offset \ht\!boxA + \advance\!offset \dp\!boxA + \!dimenput {\box\!boxA} [Bl] <\!Xsave,\!Ysave> (\!zpt,\!dimenA) + \else + \setbox\!boxA=\hbox{% + \def\\##1##2{% + \!dimenput {##2} [r] (\!axisxlevel,##1)}% + \beginpicture + \!LTlist + \endpicturesave <\!Xsave,\!Ysave>}% + \!dimenA=\!axisxlevel + \advance\!dimenA -\!Xsave + \advance\!dimenA \!tickxsign\!offset + \if -\!tickxsign + \advance\!dimenA -\wd\!boxA + \fi + \advance\!offset \wd\!boxA + \!dimenput {\box\!boxA} [Bl] <\!Xsave,\!Ysave> (\!dimenA,\!zpt) + \fi} + + +\normalgraphs + +% \catcode`!=12 % ***** THIS MUST NEVER BE OMITTED + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/thrd-pic.tex b/Master/texmf-dist/tex/context/base/thrd-pic.tex deleted file mode 100644 index 3c25d8a81d1..00000000000 --- a/Master/texmf-dist/tex/context/base/thrd-pic.tex +++ /dev/null @@ -1,3694 +0,0 @@ -% Since this file is not available in every distribution, we -% have copied the original in this file. The manuals to -% Wichura's PiCTeX and TaBlE packages are not available on -% line and are distributed by respectively the TeX Users Group -% and Personal TeX Inc. - -% We've patched this file for catcode ! because in luatex we use -% catcode tables and using unprotect/protect is cleaner. - -% This is PiCTeX, Version 1.1 9/21/87 - -% CAVEAT: The PiCTeX manual often has a more lucid explanation -% of any given topic than you will find in the internal documentation -% of the macros. - -% PiCTeX's commands can be classified into two groups: (1) public (or -% external), and (2) private (or internal). The public macros are -% discussed at length in the manual. The only discussion of the private -% macros is the internal documentation. The private macros all have -% names beginning with an exclamation point (!) of category code 11. -% Since in normal usage "!" has category code 12, these macros can't -% be accessed or modified by the general user. - -% The macros are organized into thematically related groups. For example, -% the macros dealing with dots & dashes are all in the DASHPATTERN group. -% The table below shows which macros are in which groups. The table -% covers all public macros, and many (but not all) of PiCTeX's upper level -% private macros. Following the table, the various groups are listed -% in the order in which they appear in the table. - -% *********************** TABLE OF GROUPS OF MACROS ********************** - -% HACKS: Utility macros -% \PiC -% \PiCTeX -% \placevalueinpts -% \!!loop -% \!cfor -% \!copylist -% \!ecfor -% \!etfor -% \!getnext -% \!getnextvalueof -% \!ifempty -% \!ifnextchar -% \!leftappend -% \!listaddon -% \!loop -% \!lop -% \!mlap -% \!not -% \!removept -% \!rightappend -% \!tfor -% \!vmlap -% \!wlet - -% ALLOCATION: Allocates registers - -% AREAS: Deals with plot areas -% \axis -% \grid -% \invisibleaxes -% \normalgraphs -% \plotheading -% \setplotarea -% \visibleaxes - -% ARROWS: Draws arrows -% \arrow -% \betweenarrows - -% BARS: Draws bars -% \putbar -% \setbars - -% BOXES: Draws rectangles -% \frame -% \putrectangle -% \rectangle -% \shaderectangleson -% \shaderectanglesoff - -% CURVES: Upper level plot commands -% \hshade -% \plot -% \sethistograms -% \setlinear -% \setquadratic -% \vshade - -% DASHPATTERNS: Sets up dash patterns -% \findlength -% \setdashes -% \setdashesnear -% \setdashpattern -% \setdots -% \setdotsnear -% \setsolid -% \!dashingoff -% \!dashingon - -% DIVISION: Does long division of dimension registers -% \Divide -% \!divide - -% ELLIPSES: Draws ellipses and circles -% \circulararc -% \ellipticalarc - -% RULES: Draws rules, i.e., horizontal & vertical lines -% \putrule -% \!putdashedhline -% \!putdashedvline -% \!puthline -% \!putsolidhline -% \!putsolidvline -% \!putvline - -% LINEAR ARC: Draws straight lines -- solid and dashed -% \inboundscheckoff -% \inboundscheckon -% \!advancedashing -% \!drawlinearsegment -% \!initinboundscheck -% \!linearsolid -% \!lineardashed -% \!ljoin -% \!plotifinbounds -% \!start - -% LOGTEN: Log_10 function -% \!logten - -% PICTURES: Basic setups for PiCtures; \put commands -% \accountingoff -% \accountingon -% \beginpicture -% \endpicture -% \endpicturesave -% \lines -% \multiput -% \put -% \setcoordinatemode -% \setcoordinatesystem -% \setdimensionmode -% \stack -% \Lines -% \Xdistance -% \Ydistance -% \!dimenput -% \!ifcoordmode -% \!ifdimenmode -% \!setcoordmode -% \!setdimenmode -% \!setputobject - -% PLOTTING: Things to do with plotting -% \dontsavelinesandcurves -% \replot -% \savelinesandcurves -% \setplotsymbol -% \writesavefile -% \!plot - -% PYTHAGORAS: Euclidean distance function -% \placehypotenuse -% \!Pythag - -% QUADRATIC ARC: Draws a quadratic arc -% \!qjoin - -% ROTATIONS: Handles rotations -% \startrotation -% \stoprotation -% \!rotateaboutpivot -% \!rotateonly - -% SHADING: Handles shading -% \setshadegrid -% \setshadesymbol -% \!lshade -% \!qshade -% \!starthshade -% \!startvshade - -% TICKS: Draws ticks on graphs -% \gridlines -% \loggedticks -% \nogridlines -% \ticksin -% \ticksout -% \unloggesticks - -% ***************** END OF TABLE OF GROUPS OF MACROS ******************** - - -% \catcode`!=11 % ***** THIS MUST NEVER BE OMITTED - -\unprotect - -% ******************************* -% *** HACKS (Utility macros) *** -% ******************************* - -% ** User commands -% ** \PiC{P\kern-.12em\lower.5ex\hbox{I}\kern-.075emC} -% ** \PiCTeX{\PiC\kern-.11em\TeX} -% ** \placevalueinpts of in {CONTROL SEQUENCE} - -% ** Internal commands -% ** \!ifnextchar{CHARACTER}{TRUE ACTION}{FALSE ACTION} -% ** \!tfor NAME := LIST \do {BODY} -% ** \!etfor NAME:= LIST \do {BODY} -% ** \!cfor NAME := LIST \do {BODY} -% ** \!ecfor NAME:= LIST \do {BODY} -% ** \!ifempty{MACRO}{TRUE ACTION}{FALSE ACTION} -% ** \!getnext\\ITEMfrom\LIST -% ** \!getnextvalueof\DIMEN\from\LIST -% ** \!copylist\LISTMACRO_A\to\LISTMACRO_B -% ** \!wlet\CONTROL_SEQUENCE_A=\CONTROL_SEQUENCE_B -% ** \!listaddon ITEM LIST -% ** \!rightappendITEM\withCS\to\LISTMACRO -% ** \!leftappendITEM\withCS\to\LISTMACRO -% ** \!lop\LISTMACRO\to\ITEM -% ** \!loop ... repeat -% ** \!!loop ... repeat -% ** \!removept{DIMENSION REGISTER}{CONTROL SEQUENCE} -% ** \!mlap{...} -% ** \!vmlap{...} -% ** \!not{TEK if-CONDITION} - -% ** First, here are the the PiCTeX logo, and the syllable PiC: -\def\PiC{P\kern-.12em\lower.5ex\hbox{I}\kern-.075emC} -\def\PiCTeX{\PiC\kern-.11em\TeX} - -% ** The following macro expands to parameter #2 or parameter #3 according to -% ** whether the next non-blank character following the macro is or is not #1. -% ** Blanks following the macro are gobbled. -\def\!ifnextchar#1#2#3{% - \let\!testchar=#1% - \def\!first{#2}% - \def\!second{#3}% - \futurelet\!nextchar\!testnext} -\def\!testnext{% - \ifx \!nextchar \!spacetoken - \let\!next=\!skipspacetestagain - \else - \ifx \!nextchar \!testchar - \let\!next=\!first - \else - \let\!next=\!second - \fi - \fi - \!next} -\def\\{\!skipspacetestagain} - \expandafter\def\\ {\futurelet\!nextchar\!testnext} -\def\\{\let\!spacetoken= } \\ % ** set \spacetoken to a space token - - -% ** Borrow the "tfor" macro from Latex: -% ** \!tfor NAME := LIST \do {BODY} -% ** if, before expansion, LIST = T1 ... Tn, where each Ti is a token -% ** or {...}, then executes BODY n times, with NAME = Ti on the -% ** i-th iteration. Works for n=0. -\def\!tfor#1:=#2\do#3{% - \edef\!fortemp{#2}% - \ifx\!fortemp\!empty - \else - \!tforloop#2\!nil\!nil\!!#1{#3}% - \fi} -\def\!tforloop#1#2\!!#3#4{% - \def#3{#1}% - \ifx #3\!nnil - \let\!nextwhile=\!fornoop - \else - #4\relax - \let\!nextwhile=\!tforloop - \fi - \!nextwhile#2\!!#3{#4}} - - -% ** \!etfor NAME:= LIST\do {BODY} -% ** This is like \!cfor, but LIST is any balanced token list whose complete -% ** expansion has the form T1 ... Tn -\def\!etfor#1:=#2\do#3{% - \def\!!tfor{\!tfor#1:=}% - \edef\!!!tfor{#2}% - \expandafter\!!tfor\!!!tfor\do{#3}} - - -% ** modify the Latex \tfor (token-for) loop to a \cfor (comma-for) loop. -% ** \!cfor NAME := LIST \do {BODY} -% ** if, before expansion, LIST = a1,a2,...an, then executes BODY n times, -% ** with NAME = ai on the i-th iteration. Works for n=0. -\def\!cfor#1:=#2\do#3{% - \edef\!fortemp{#2}% - \ifx\!fortemp\!empty - \else - \!cforloop#2,\!nil,\!nil\!!#1{#3}% - \fi} -\def\!cforloop#1,#2\!!#3#4{% - \def#3{#1}% - \ifx #3\!nnil - \let\!nextwhile=\!fornoop - \else - #4\relax - \let\!nextwhile=\!cforloop - \fi - \!nextwhile#2\!!#3{#4}} - - -% ** \!ecfor NAME:= LIST\do {BODY} -% ** This is like \!cfor, but LIST is any balanced token list whose complete -% ** expansion has the form a1,a2,...,an. -\def\!ecfor#1:=#2\do#3{% - \def\!!cfor{\!cfor#1:=}% - \edef\!!!cfor{#2}% - \expandafter\!!cfor\!!!cfor\do{#3}} - - -\def\!empty{} -\def\!nnil{\!nil} -\def\!fornoop#1\!!#2#3{} - - -% ** \!ifempty{ARG}{TRUE ACTION}{FALSE ACTION} -\def\!ifempty#1#2#3{% - \edef\!emptyarg{#1}% - \ifx\!emptyarg\!empty - #2% - \else - #3% - \fi} - -% ** \!getnext\\ITEMfrom\LIST -% ** \LIST has the form \\{item1}\\{item2}\\{item3}...\\{itemk} -% ** This routine sets \ITEM to item1, and cycles \LIST to -% ** \\{item2}\\{item3}...\\{itemk}\\{item1} -\def\!getnext#1\from#2{% - \expandafter\!gnext#2\!#1#2}% -\def\!gnext\\#1#2\!#3#4{% - \def#3{#1}% - \def#4{#2\\{#1}}% - \ignorespaces} - - -% ** \!getnextvalueof\DIMEN\from\LIST -% ** Similar to !getnext. -% ** \LIST has the form \\{dimen1}\\{dimen2}\\{dimen3} ... -% ** \DIMEN is a dimension register -% ** Works also for counts -% -\def\!getnextvalueof#1\from#2{% - \expandafter\!gnextv#2\!#1#2}% -\def\!gnextv\\#1#2\!#3#4{% - #3=#1% - \def#4{#2\\{#1}}% - \ignorespaces} - - -% ** \!copylist\LISTMACROA\to\LISTMACROB -% ** makes the replacement text of LISTMACRO B identical to that of -% ** list macro A. -\def\!copylist#1\to#2{% - \expandafter\!!copylist#1\!#2} -\def\!!copylist#1\!#2{% - \def#2{#1}\ignorespaces} - - -% ** \!wlet\CSA=\CSB -% ** lets control sequence \CSB = control sequence \CSA, and writes a -% ** message to that effect in the log file using plain TEK's \wlog -\def\!wlet#1=#2{% - \let#1=#2 - \wlog{\string#1=\string#2}} - -% ** \!listaddon ITEM LIST -% ** LIST <-- LIST \\ ITEM -\def\!listaddon#1#2{% - \expandafter\!!listaddon#2\!{#1}#2} -\def\!!listaddon#1\!#2#3{% - \def#3{#1\\#2}} - -% ** \!rightappendITEM\to\LISTMACRO -% ** \LISTMACRO --> \LISTMACRO\\{ITEM} -%\def\!rightappend#1\to#2{\expandafter\!!rightappend#2\!{#1}#2} -%\def\!!rightappend#1\!#2#3{\def#3{#1\\{#2}}} - - -% ** \!rightappendITEM\withCS\to\LISTMACRO -% ** \LISTMACRO --> \LISTMACRO||CS||{ITEM} -\def\!rightappend#1\withCS#2\to#3{\expandafter\!!rightappend#3\!#2{#1}#3} -\def\!!rightappend#1\!#2#3#4{\def#4{#1#2{#3}}} - - -% ** \!leftappendITEM\withCS\to\LISTMACRO -% ** \LISTMACRO --> CS||{ITEM}||\LISTMACRO -\def\!leftappend#1\withCS#2\to#3{\expandafter\!!leftappend#3\!#2{#1}#3} -\def\!!leftappend#1\!#2#3#4{\def#4{#2{#3}#1}} - - -% ** \!lop\LISTMACRO\to\ITEM -% ** \\{item1}\\{item2}\\{item3} ... --> \\{item2}\\{item3} ... -% ** item1 --> \ITEM -\def\!lop#1\to#2{\expandafter\!!lop#1\!#1#2} -\def\!!lop\\#1#2\!#3#4{\def#4{#1}\def#3{#2}} - - -% ** \!placeNUMBER\of\LISTMACRO\in\ITEM -% ** the NUMBERth item of \LISTMACRO --> replacement text of \ITEM -%\def\!place#1\of#2\in#3{\def#3{\outofrange}% -%{\count0=#1\def\\##1{\advance\count0-1 \ifnum\count0=0 \gdef#3{##1}\fi}#2}} - - -% ** Following code converts a commalist to a list macro, with all items -% ** fully expanded. -%\!ecfor\item:=\commalist\do{\expandafter\!rightappend\item\to\list} - - -% ** \!loop ... repeat -% ** This is exactly like TEX's \loop ... repeat. It can be used in nesting -% ** two loops, without puting the inner one inside a group. -\def\!loop#1\repeat{\def\!body{#1}\!iterate} -\def\!iterate{\!body\let\!next=\!iterate\else\let\!next=\relax\fi\!next} - -% ** \!!loop ... repeat -% ** This is exactly like TEX's \loop ... repeat. It can be used in nesting -% ** two loops, without puting the inner one inside a group. -\def\!!loop#1\repeat{\def\!!body{#1}\!!iterate} -\def\!!iterate{\!!body\let\!!next=\!!iterate\else\let\!!next=\relax\fi\!!next} -% (\multiput uses \!!loop) - -% ** \!removept{DIMENREG}{\CS} -% ** Defines the control sequence CS to be the value (in points) in the -% ** dimension register DIMENREG (but without the "pt" TEK usually adds) -% ** E.g., after \dimen0=12.3pt \!removept\dimen0\A, \A expands to 12.3 -\def\!removept#1#2{\edef#2{\expandafter\!!removePT\the#1}} -{\catcode`p=12 \catcode`t=12 \gdef\!!removePT#1pt{#1}} - -% ** \pladevalueinpts of in {CONTROL SEQUENCE} -\def\placevalueinpts of <#1> in #2 {% - \!removept{#1}{#2}} - -% ** \!mlap{...} \!vmlap{...} -% ** Center ... in a box of width 0. -\def\!mlap#1{\hbox to 0pt{\hss#1\hss}} -\def\!vmlap#1{\vbox to 0pt{\vss#1\vss}} - -% ** \!not{TEK if-CONDITION} -% ** By a TEK if-CONDITION is meant something like -% ** \ifnum\N<0, or \ifdim\A>\B -% ** \!not produces an if-condition which is false if the original condition -% ** is true, and true if the original condition is false. -\def\!not#1{% - #1\relax - \!switchfalse - \else - \!switchtrue - \fi - \if!switch - \ignorespaces} - - -% ******************* -% *** ALLOCATIONS *** -% ******************* - -% This section allocates all the registers PiCTeX uses. Following -% each allocation is a string of the form ....N.D...L......... ; -% the various letters show which sections of PiCTeX make explicit -% reference to that register, according to the following code: - -% H Hacks -% A Areas -% W arroWs -% B Bars -% X boXes -% C Curves -% D Dashpattterns -% V diVision -% E Ellipses -% U rUles -% L Linear arc -% G loGten -% P Pictures -% O plOtting -% Y pYthagoras -% Q Quadratic arc -% R Rotations -% S Shading -% T Ticks - -% Turn off messages from TeX's allocation macros -\let\!!!wlog=\wlog % "\wlog" is defined in plain TeX -\def\wlog#1{} - -\newdimen\headingtoplotskip %.A................. -\newdimen\linethickness %.A..X....U........T -\newdimen\longticklength %.A................T -\newdimen\plotsymbolspacing %......D...L....Q... -\newdimen\shortticklength %.A................T -\newdimen\stackleading %.A..........P...... -\newdimen\tickstovaluesleading %.A................T -\newdimen\totalarclength %......D...L....Q... -\newdimen\valuestolabelleading %.A................. - -\newbox\!boxA %.AW...............T -\newbox\!boxB %..W................ -\newbox\!picbox %............P...... -\newbox\!plotsymbol %..........L..O..... -\newbox\!putobject %............PO...S. -\newbox\!shadesymbol %.................S. - -\newcount\!countA %.A....D..UL....Q.ST -\newcount\!countB %......D..U.....Q.ST -\newcount\!countC %...............Q..T -\newcount\!countD %................... -\newcount\!countE %.............O....T -\newcount\!countF %.............O....T -\newcount\!countG %..................T -\newcount\!fiftypt %.........U......... -\newcount\!intervalno %..........L....Q... -\newcount\!npoints %..........L........ -\newcount\!nsegments %.........U......... -\newcount\!ntemp %............P...... -\newcount\!parity %.................S. -\newcount\!scalefactor %..................T -\newcount\!tfs %.......V........... -\newcount\!tickcase %..................T - -\newdimen\!Xleft %............P...... -\newdimen\!Xright %............P...... -\newdimen\!Xsave %.A................T -\newdimen\!Ybot %............P...... -\newdimen\!Ysave %.A................T -\newdimen\!Ytop %............P...... -\newdimen\!angle %........E.......... -\newdimen\!arclength %..W......UL....Q... -\newdimen\!areabloc %.A........L........ -\newdimen\!arealloc %.A........L........ -\newdimen\!arearloc %.A........L........ -\newdimen\!areatloc %.A........L........ -\newdimen\!bshrinkage %.................S. -\newdimen\!checkbot %..........L........ -\newdimen\!checkleft %..........L........ -\newdimen\!checkright %..........L........ -\newdimen\!checktop %..........L........ -\newdimen\!dimenA %.AW.X.DVEUL..OYQRST -\newdimen\!dimenB %....X.DVEU...O.QRS. -\newdimen\!dimenC %..W.X.DVEU......RS. -\newdimen\!dimenD %..W.X.DVEU....Y.RS. -\newdimen\!dimenE %..W........G..YQ.S. -\newdimen\!dimenF %...........G..YQ.S. -\newdimen\!dimenG %...........G..YQ.S. -\newdimen\!dimenH %...........G..Y..S. -\newdimen\!dimenI %...BX.........Y.... -\newdimen\!distacross %..........L....Q... -\newdimen\!downlength %..........L........ -\newdimen\!dp %.A..X.......P....S. -\newdimen\!dshade %.................S. -\newdimen\!dxpos %..W......U..P....S. -\newdimen\!dxprime %...............Q... -\newdimen\!dypos %..WB.....U..P...... -\newdimen\!dyprime %...............Q... -\newdimen\!ht %.A..X.......P....S. -\newdimen\!leaderlength %......D..U......... -\newdimen\!lshrinkage %.................S. -\newdimen\!midarclength %...............Q... -\newdimen\!offset %.A................T -\newdimen\!plotheadingoffset %.A................. -\newdimen\!plotsymbolxshift %..........L..O..... -\newdimen\!plotsymbolyshift %..........L..O..... -\newdimen\!plotxorigin %..........L..O..... -\newdimen\!plotyorigin %..........L..O..... -\newdimen\!rootten %...........G....... -\newdimen\!rshrinkage %.................S. -\newdimen\!shadesymbolxshift %.................S. -\newdimen\!shadesymbolyshift %.................S. -\newdimen\!tenAa %...........G....... -\newdimen\!tenAc %...........G....... -\newdimen\!tenAe %...........G....... -\newdimen\!tshrinkage %.................S. -\newdimen\!uplength %..........L........ -\newdimen\!wd %....X.......P....S. -\newdimen\!wmax %...............Q... -\newdimen\!wmin %...............Q... -\newdimen\!xB %...............Q... -\newdimen\!xC %...............Q... -\newdimen\!xE %..W.....E.L....Q.S. -\newdimen\!xM %..W.....E......Q.S. -\newdimen\!xS %..W.....E.L....Q.S. -\newdimen\!xaxislength %.A................T -\newdimen\!xdiff %..........L........ -\newdimen\!xleft %............P...... -\newdimen\!xloc %..WB.....U.......S. -\newdimen\!xorigin %.A........L.P....S. -\newdimen\!xpivot %................R.. -\newdimen\!xpos %..........L.P..Q.ST -\newdimen\!xprime %...............Q... -\newdimen\!xright %............P...... -\newdimen\!xshade %.................S. -\newdimen\!xshift %..W.........PO...S. -\newdimen\!xtemp %............P...... -\newdimen\!xunit %.AWBX...EUL.P..QRS. -\newdimen\!xxE %........E.......... -\newdimen\!xxM %........E.......... -\newdimen\!xxS %........E.......... -\newdimen\!xxloc %..WB....EU......... -\newdimen\!yB %...............Q... -\newdimen\!yC %...............Q... -\newdimen\!yE %..W.....E.L....Q... -\newdimen\!yM %..W.....E......Q... -\newdimen\!yS %..W.....E.L....Q... -\newdimen\!yaxislength %.A................T -\newdimen\!ybot %............P...... -\newdimen\!ydiff %..........L........ -\newdimen\!yloc %..WB.....U.......S. -\newdimen\!yorigin %.A........L.P....S. -\newdimen\!ypivot %................R.. -\newdimen\!ypos %..........L.P..Q.ST -\newdimen\!yprime %...............Q... -\newdimen\!yshade %.................S. -\newdimen\!yshift %..W.........PO...S. -\newdimen\!ytemp %............P...... -\newdimen\!ytop %............P...... -\newdimen\!yunit %.AWBX...EUL.P..QRS. -\newdimen\!yyE %........E.......... -\newdimen\!yyM %........E.......... -\newdimen\!yyS %........E.......... -\newdimen\!yyloc %..WB....EU......... -\newdimen\!zpt %.AWBX.DVEULGP.YQ.ST - -\newif\if!axisvisible %.A................. -\newif\if!gridlinestoo %..................T -\newif\if!keepPO %................... -\newif\if!placeaxislabel %.A................. -\newif\if!switch %H.................. -\newif\if!xswitch %.A................T - -\newtoks\!axisLaBeL %.A................. -\newtoks\!keywordtoks %.A................. - -\newwrite\!replotfile %.............O..... - -\newhelp\!keywordhelp{The keyword mentioned in the error message in unknown. -Replace NEW KEYWORD in the indicated response by the keyword that -should have been specified.} %.A................. - -% The following commands assign alternate names to some of the -% above registers. "\!wlet" is defined in Hacks. -\!wlet\!!origin=\!xM %.A................T -\!wlet\!!unit=\!uplength %.A................T -\!wlet\!Lresiduallength=\!dimenG %.........U......... -\!wlet\!Rresiduallength=\!dimenF %.........U......... -\!wlet\!axisLength=\!distacross %.A................T -\!wlet\!axisend=\!ydiff %.A................T -\!wlet\!axisstart=\!xdiff %.A................T -\!wlet\!axisxlevel=\!arclength %.A................T -\!wlet\!axisylevel=\!downlength %.A................T -\!wlet\!beta=\!dimenE %...............Q... -\!wlet\!gamma=\!dimenF %...............Q... -\!wlet\!shadexorigin=\!plotxorigin %.................S. -\!wlet\!shadeyorigin=\!plotyorigin %.................S. -\!wlet\!ticklength=\!xS %..................T -\!wlet\!ticklocation=\!xE %..................T -\!wlet\!ticklocationincr=\!yE %..................T -\!wlet\!tickwidth=\!yS %..................T -\!wlet\!totalleaderlength=\!dimenE %.........U......... -\!wlet\!xone=\!xprime %....X.............. -\!wlet\!xtwo=\!dxprime %....X.............. -\!wlet\!ySsave=\!yM %................... -\!wlet\!ybB=\!yB %.................S. -\!wlet\!ybC=\!yC %.................S. -\!wlet\!ybE=\!yE %.................S. -\!wlet\!ybM=\!yM %.................S. -\!wlet\!ybS=\!yS %.................S. -\!wlet\!ybpos=\!yyloc %.................S. -\!wlet\!yone=\!yprime %....X.............. -\!wlet\!ytB=\!xB %.................S. -\!wlet\!ytC=\!xC %.................S. -\!wlet\!ytE=\!downlength %.................S. -\!wlet\!ytM=\!arclength %.................S. -\!wlet\!ytS=\!distacross %.................S. -\!wlet\!ytpos=\!xxloc %.................S. -\!wlet\!ytwo=\!dyprime %....X.............. - - -% Initial values for registers -\!zpt=0pt % static -\!xunit=1pt -\!yunit=1pt -\!arearloc=\!xunit -\!areatloc=\!yunit -\!dshade=5pt -\!leaderlength=24in -\!tfs=256 % static -\!wmax=5.3pt % static -\!wmin=2.7pt % static -\!xaxislength=\!xunit -\!xpivot=\!zpt -\!yaxislength=\!yunit -\!ypivot=\!zpt -\plotsymbolspacing=.4pt - \!dimenA=50pt \!fiftypt=\!dimenA % static - -\!rootten=3.162278pt % static -\!tenAa=8.690286pt % static (A5) -\!tenAc=2.773839pt % static (A3) -\!tenAe=2.543275pt % static (A1) - -% Initial values for control sequences -\def\!cosrotationangle{1} %................R.. -\def\!sinrotationangle{0} %................R.. -\def\!xpivotcoord{0} %................R.. -\def\!xref{0} %............P...... -\def\!xshadesave{0} %.................S. -\def\!ypivotcoord{0} %................R.. -\def\!yref{0} %............P...... -\def\!yshadesave{0} %.................S. -\def\!zero{0} %..................T - -% Reset TeX to report allocations -\let\wlog=\!!!wlog -% ************************************* -% *** AREAS: Deals with plot areas *** -% ************************************* -% -% ** User commands -% ** \setplotarea x from LEFT XCOORD to RIGTH XCOORD, y from BOTTOM YCOORD -% ** to TOP YCOORD -% ** \axis BOTTOM-LEFT-TOP-RIGHT [SHIFTEDTO xy=COORD] [VISIBLE-INVISIBLE] -% ** [LABEL {label}] [TICKS] / -% ** \visibleaxes -% ** \invisibleaxes -% ** \plotheading {HEADING} -% ** \grid {# of columns} {# of rows} -% ** \normalgraphs - -% ** \normalgraphs -% ** Sets defaults for graph setup. See Subsection 3.4 of manual. -\def\normalgraphs{% - \longticklength=.4\baselineskip - \shortticklength=.25\baselineskip - \tickstovaluesleading=.25\baselineskip - \valuestolabelleading=.8\baselineskip - \linethickness=.4pt - \stackleading=.17\baselineskip - \headingtoplotskip=1.5\baselineskip - \visibleaxes - \ticksout - \nogridlines - \unloggedticks} -% -% ** \setplotarea x from LEFT XCOORD to RIGTH XCOORD, y from BOTTOM YCOORD -% ** to TOP YCOORD -% ** Reserves space in PICBOX for a rectangular box with the indicated -% ** coordinates. Must be specified before calls to \axis, -% ** \grid, \plotheading. -% ** See Subsection 3.1 of the manual. -\def\setplotarea x from #1 to #2, y from #3 to #4 {% - \!arealloc=\!M{#1}\!xunit \advance \!arealloc -\!xorigin - \!areabloc=\!M{#3}\!yunit \advance \!areabloc -\!yorigin - \!arearloc=\!M{#2}\!xunit \advance \!arearloc -\!xorigin - \!areatloc=\!M{#4}\!yunit \advance \!areatloc -\!yorigin - \!initinboundscheck - \!xaxislength=\!arearloc \advance\!xaxislength -\!arealloc - \!yaxislength=\!areatloc \advance\!yaxislength -\!areabloc - \!plotheadingoffset=\!zpt - \!dimenput {{\setbox0=\hbox{}\wd0=\!xaxislength\ht0=\!yaxislength\box0}} - [bl] (\!arealloc,\!areabloc)} -% -% ** \visibleaxes, \invisibleaxes -% ** Switches for setting visibility of subsequent axes. -% ** See Subsection 3.2 of the manual. -\def\visibleaxes{% - \def\!axisvisibility{\!axisvisibletrue}} -\def\invisibleaxes{% - \def\!axisvisibility{\!axisvisiblefalse}} -% -% ** The next few macros enable the user to fix up an erroneous keyword -% ** in the \axis command. -% \newhelp is in ALLOCATIONS -% \newhelp\!keywordhelp{The keyword mentioned in the error message in unknown. -% Replace NEW KEYWORD in the indicated response by the keyword that -% should have been specified.} - -\def\!fixkeyword#1{% - \errhelp=\!keywordhelp - \errmessage{Unrecognized keyword `#1': \the\!keywordtoks{NEW KEYWORD}'}} - -% \newtoks\!keywordtoks In ALLOCATIONS. -\!keywordtoks={enter `i\fixkeyword} - -\def\fixkeyword#1{% - \!nextkeyword#1 } - -% ** \axis BOTTOM-LEFT-TOP-RIGHT [SHIFTEDTO xy=COORD] [VISIBLE-INVISIBLE] -% ** [LABEL {label}] [TICKS] / -% ** Exactly one of the keywords BOTTOM, LEFT, TOP, RIGHT must be -% ** specified. Axis is drawn along the indicated edge of the current -% ** plot area, shifted if the SHIFTEDTO option is used, visible or -% ** invisible according the selected option, with an optional LABEL, -% ** and optional TICKS (see ticks.tex for the options avialabel with -% ** TICKS). The TICKS option must be the last one specified. The \axis -% ** MUST be terminated with a / followed by a space. -% ** See Subsection 3.2 of the manual for more information. - -% ** The various options of the \axis command are processed by the -% ** \!nextkeyword macro defined below. For example, -% ** `\!nextkeyword shiftedto ' expands to `\!axisshiftedto'. -\def\axis {% - \def\!nextkeyword##1 {% - \expandafter\ifx\csname !axis##1\endcsname \relax - \def\!next{\!fixkeyword{##1}}% - \else - \def\!next{\csname !axis##1\endcsname}% - \fi - \!next}% - \!offset=\!zpt - \!axisvisibility - \!placeaxislabelfalse - \!nextkeyword} - -% ** This and the various macros that follow handle the keyword -% ** specifications on the \axis command -% ** See Subsection 3.2 of the manual. -\def\!axisbottom{% - \!axisylevel=\!areabloc - \def\!tickxsign{0}% - \def\!tickysign{-}% - \def\!axissetup{\!axisxsetup}% - \def\!axislabeltbrl{t}% - \!nextkeyword} - -\def\!axistop{% - \!axisylevel=\!areatloc - \def\!tickxsign{0}% - \def\!tickysign{+}% - \def\!axissetup{\!axisxsetup}% - \def\!axislabeltbrl{b}% - \!nextkeyword} - -\def\!axisleft{% - \!axisxlevel=\!arealloc - \def\!tickxsign{-}% - \def\!tickysign{0}% - \def\!axissetup{\!axisysetup}% - \def\!axislabeltbrl{r}% - \!nextkeyword} - -\def\!axisright{% - \!axisxlevel=\!arearloc - \def\!tickxsign{+}% - \def\!tickysign{0}% - \def\!axissetup{\!axisysetup}% - \def\!axislabeltbrl{l}% - \!nextkeyword} - -\def\!axisshiftedto#1=#2 {% - \if 0\!tickxsign - \!axisylevel=\!M{#2}\!yunit - \advance\!axisylevel -\!yorigin - \else - \!axisxlevel=\!M{#2}\!xunit - \advance\!axisxlevel -\!xorigin - \fi - \!nextkeyword} - -\def\!axisvisible{% - \!axisvisibletrue - \!nextkeyword} - -\def\!axisinvisible{% - \!axisvisiblefalse - \!nextkeyword} - -\def\!axislabel#1 {% - \!axisLaBeL={#1}% - \!placeaxislabeltrue - \!nextkeyword} - -\expandafter\def\csname !axis/\endcsname{% - \!axissetup % This could done already by "ticks"; if so, now \relax - \if!placeaxislabel - \!placeaxislabel - \fi - \if +\!tickysign % ** (A "top" axis) - \!dimenA=\!axisylevel - \advance\!dimenA \!offset % ** dimA = top of the axis structure - \advance\!dimenA -\!areatloc % ** dimA = excess over the plot area - \ifdim \!dimenA>\!plotheadingoffset - \!plotheadingoffset=\!dimenA % ** Greatest excess over the plot area - \fi - \fi} - -% ** \grid {c} {r} -% ** Partitions the plot area into c columns and r rows; see Subsection 3.3 -% ** of the manual. -% ** (Other grid patterns can be drawn with the TICKS option of the \axis -% ** command. -\def\grid #1 #2 {% - \!countA=#1\advance\!countA 1 - \axis bottom invisible ticks length <\!zpt> andacross quantity {\!countA} / - \!countA=#2\advance\!countA 1 - \axis left invisible ticks length <\!zpt> andacross quantity {\!countA} / } - -% ** \plotheading{HEADING} -% ** Places HEADING centered above the top of the plotarea (and above -% ** any top axis ticks marks, tick labels, and axis label); see -% ** Subsection 3.3 of the manual. -\def\plotheading#1 {% - \advance\!plotheadingoffset \headingtoplotskip - \!dimenput {#1} [B] <.5\!xaxislength,\!plotheadingoffset> - (\!arealloc,\!areatloc)} - -% ** From here on, the routines are internal. -\def\!axisxsetup{% - \!axisxlevel=\!arealloc - \!axisstart=\!arealloc - \!axisend=\!arearloc - \!axisLength=\!xaxislength - \!!origin=\!xorigin - \!!unit=\!xunit - \!xswitchtrue - \if!axisvisible - \!makeaxis - \fi} - -\def\!axisysetup{% - \!axisylevel=\!areabloc - \!axisstart=\!areabloc - \!axisend=\!areatloc - \!axisLength=\!yaxislength - \!!origin=\!yorigin - \!!unit=\!yunit - \!xswitchfalse - \if!axisvisible - \!makeaxis - \fi} - -\def\!makeaxis{% - \setbox\!boxA=\hbox{% (Make a pseudo-y[x] tick for an x[y]-axis) - \beginpicture - \!setdimenmode - \setcoordinatesystem point at {\!zpt} {\!zpt} - \putrule from {\!zpt} {\!zpt} to - {\!tickysign\!tickysign\!axisLength} - {\!tickxsign\!tickxsign\!axisLength} - \endpicturesave <\!Xsave,\!Ysave>}% - \wd\!boxA=\!zpt - \!placetick\!axisstart} - -\def\!placeaxislabel{% - \advance\!offset \valuestolabelleading - \if!xswitch - \!dimenput {\the\!axisLaBeL} [\!axislabeltbrl] - <.5\!axisLength,\!tickysign\!offset> (\!axisxlevel,\!axisylevel) - \advance\!offset \!dp % ** advance offset by the "tallness" - \advance\!offset \!ht % ** of the label - \else - \!dimenput {\the\!axisLaBeL} [\!axislabeltbrl] - <\!tickxsign\!offset,.5\!axisLength> (\!axisxlevel,\!axisylevel) - \fi - \!axisLaBeL={}} - - -% ******************************* -% *** ARROWS (Draws arrows) *** -% ******************************* -% -% ** User commands -% ** \arrow [MID FRACTION, BASE FRACTION] -% ** [] from XFROM YFROM to XTO YTO -% ** \betweenarrows {TEXT} [orientation & shift] from XFROM YFROM to XTO YTO - -% ** \arrow [MID FRACTION, BASE FRACTION] -% ** [] from XFROM YFROM to XTO YTO -% ** Draws an arrow from (XFROM,YFROM) to (XTO,YTO). The arrow head -% ** is constructed two quadratic arcs, which extend back a distance -% ** ARROW HEAD LENGTH (a dimension) on both sides of the arrow shaft. -% ** All the way back the arcs are a distance BASE FRACTION*ARROW HEAD -% ** LENGTH apart, while half-way back they are a distance MID FRACTION* -% ** ARROW HEAD LENGTH apart. is optional, and has -% ** its usual interpreation. See Subsection 5.4 of the manual. - -\def\arrow <#1> [#2,#3]{% - \!ifnextchar<{\!arrow{#1}{#2}{#3}}{\!arrow{#1}{#2}{#3}<\!zpt,\!zpt> }} - -\def\!arrow#1#2#3<#4,#5> from #6 #7 to #8 #9 {% -% -% ** convert to dimensions - \!xloc=\!M{#8}\!xunit - \!yloc=\!M{#9}\!yunit - \!dxpos=\!xloc \!dimenA=\!M{#6}\!xunit \advance \!dxpos -\!dimenA - \!dypos=\!yloc \!dimenA=\!M{#7}\!yunit \advance \!dypos -\!dimenA - \let\!MAH=\!M% ** save current c/d mode - \!setdimenmode% ** go into dimension mode -% - \!xshift=#4\relax \!yshift=#5\relax% ** pick up shift - \!reverserotateonly\!xshift\!yshift% ** back rotate shift - \advance\!xshift\!xloc \advance\!yshift\!yloc -% -% ** draw shaft of arrow - \!xS=-\!dxpos \advance\!xS\!xshift - \!yS=-\!dypos \advance\!yS\!yshift - \!start (\!xS,\!yS) - \!ljoin (\!xshift,\!yshift) -% -% ** find 32*cosine and 32*sine of angle of rotation - \!Pythag\!dxpos\!dypos\!arclength - \!divide\!dxpos\!arclength\!dxpos - \!dxpos=32\!dxpos \!removept\!dxpos\!!cos - \!divide\!dypos\!arclength\!dypos - \!dypos=32\!dypos \!removept\!dypos\!!sin -% -% ** construct arrowhead - \!halfhead{#1}{#2}{#3}% ** draw half of arrow head - \!halfhead{#1}{-#2}{-#3}% ** draw other half -% - \let\!M=\!MAH% ** restore old c/d mode - \ignorespaces} -% -% ** draw half of arrow head - \def\!halfhead#1#2#3{% - \!dimenC=-#1% - \divide \!dimenC 2 % ** half way back - \!dimenD=#2\!dimenC% ** half the mid width - \!rotate(\!dimenC,\!dimenD)by(\!!cos,\!!sin)to(\!xM,\!yM) - \!dimenC=-#1% ** all the way back - \!dimenD=#3\!dimenC - \!dimenD=.5\!dimenD% ** half the full width - \!rotate(\!dimenC,\!dimenD)by(\!!cos,\!!sin)to(\!xE,\!yE) - \!start (\!xshift,\!yshift) - \advance\!xM\!xshift \advance\!yM\!yshift - \advance\!xE\!xshift \advance\!yE\!yshift - \!qjoin (\!xM,\!yM) (\!xE,\!yE) - \ignorespaces} - - -% ** \betweenarrows {TEXT} [orientation & shift] from XFROM YFROM to XTO YTO -% ** Makes things like <--- text --->, using arrow heads from TeX's fonts. -% ** See Subsection 5.4 of the manual. -\def\betweenarrows #1#2 from #3 #4 to #5 #6 {% - \!xloc=\!M{#3}\!xunit \!xxloc=\!M{#5}\!xunit% - \!yloc=\!M{#4}\!yunit \!yyloc=\!M{#6}\!yunit% - \!dxpos=\!xxloc \advance\!dxpos by -\!xloc - \!dypos=\!yyloc \advance\!dypos by -\!yloc - \advance\!xloc .5\!dxpos - \advance\!yloc .5\!dypos -% - \let\!MBA=\!M% ** save current coord\dimen mode - \!setdimenmode% ** express locations in dimens - \ifdim\!dypos=\!zpt - \ifdim\!dxpos<\!zpt \!dxpos=-\!dxpos \fi - \put {\!lrarrows{\!dxpos}{#1}}#2{} at {\!xloc} {\!yloc} - \else - \ifdim\!dxpos=\!zpt - \ifdim\!dypos<\!zpt \!dypos=-\!zpt \fi - \put {\!udarrows{\!dypos}{#1}}#2{} at {\!xloc} {\!yloc} - \fi - \fi - \let\!M=\!MBA% ** restore previous c/d mode - \ignorespaces} - -% ** Subroutine for left-right between arrows -\def\!lrarrows#1#2{% #1=width, #2=text - {\setbox\!boxA=\hbox{$\mkern-2mu\mathord-\mkern-2mu$}% - \setbox\!boxB=\hbox{$\leftarrow$}\!dimenE=\ht\!boxB - \setbox\!boxB=\hbox{}\ht\!boxB=2\!dimenE - \hbox to #1{$\mathord\leftarrow\mkern-6mu - \cleaders\copy\!boxA\hfil - \mkern-6mu\mathord-$% - \kern.4em $\vcenter{\box\!boxB}$$\vcenter{\hbox{#2}}$\kern.4em - $\mathord-\mkern-6mu - \cleaders\copy\!boxA\hfil - \mkern-6mu\mathord\rightarrow$}}} - -% ** Subroutine for up-down between arrows -\def\!udarrows#1#2{% #1=width, #2=text - {\setbox\!boxB=\hbox{#2}% - \setbox\!boxA=\hbox to \wd\!boxB{\hss$\vert$\hss}% - \!dimenE=\ht\!boxA \advance\!dimenE \dp\!boxA \divide\!dimenE 2 - \vbox to #1{\offinterlineskip - \vskip .05556\!dimenE - \hbox to \wd\!boxB{\hss$\mkern.4mu\uparrow$\hss}\vskip-\!dimenE - \cleaders\copy\!boxA\vfil - \vskip-\!dimenE\copy\!boxA - \vskip\!dimenE\copy\!boxB\vskip.4em - \copy\!boxA\vskip-\!dimenE - \cleaders\copy\!boxA\vfil - \vskip-\!dimenE \hbox to \wd\!boxB{\hss$\mkern.4mu\downarrow$\hss} - \vskip .05556\!dimenE}}} - - -% *************************** -% *** BARS (Draws bars) *** -% *************************** -% -% ** User commands: -% ** \putbar [] breadth from XSTART YSTART -% ** to XEND YEND -% ** \setbars [] breadth baseline at XY = COORD -% ** [baselabels ([B_ORIENTATION_x,B_ORIENTATION_y] )] -% ** [endlabels ([E_ORIENTATION_x,E_ORIENTATION_y] )] - - -% ** \putbar [] breadth from XSTART YSTART -% ** to XEND YEND -% ** Either XSTART=XEND or YSTART=YEND. Draws a rectangle between -% ** (XSTART,YSTART) & (XEND,YEND). The "depth" of the rectangle -% ** is determined by those two plot positions; its other -% ** dimension "breadth" is specified by the dimension BREADTH. -% ** See Subsection 4.2 of the manual. -\def\putbar#1breadth <#2> from #3 #4 to #5 #6 {% - \!xloc=\!M{#3}\!xunit \!xxloc=\!M{#5}\!xunit% - \!yloc=\!M{#4}\!yunit \!yyloc=\!M{#6}\!yunit% - \!dypos=\!yyloc \advance\!dypos by -\!yloc - \!dimenI=#2 -% - \ifdim \!dimenI=\!zpt % ** If 0 breadth - \putrule#1from {#3} {#4} to {#5} {#6} % ** Then draw line - \else % ** Else, put in a rectangle - \let\!MBar=\!M% ** save current c/d mode - \!setdimenmode % ** go into dimension mode - \divide\!dimenI 2 - \ifdim \!dypos=\!zpt - \advance \!yloc -\!dimenI % ** Equal y coordinates - \advance \!yyloc \!dimenI - \else - \advance \!xloc -\!dimenI % ** Equal x coordinates - \advance \!xxloc \!dimenI - \fi - \putrectangle#1corners at {\!xloc} {\!yloc} and {\!xxloc} {\!yyloc} - \let\!M=\!MBar % ** restore c/d mode - \fi - \ignorespaces} - - -% ** \setbars [] breadth baseline at XY = COORD -% ** [baselabels ([B_ORIENTATION_x,B_ORIENTATION_y] )] -% ** [endlabels ([E_ORIENTATION_x,E_ORIENTATION_y] )] -% ** This command puts PiCTeX into the bar graph drawing mode described -% ** in Subsection 4.4 of the manual. -\def\setbars#1breadth <#2> baseline at #3 = #4 {% - \edef\!barshift{#1}% - \edef\!barbreadth{#2}% - \edef\!barorientation{#3}% - \edef\!barbaseline{#4}% - \def\!bardobaselabel{\!bardoendlabel}% - \def\!bardoendlabel{\!barfinish}% - \let\!drawcurve=\!barcurve - \!setbars} -\def\!setbars{% - \futurelet\!nextchar\!!setbars} -\def\!!setbars{% - \if b\!nextchar - \def\!!!setbars{\!setbarsbget}% - \else - \if e\!nextchar - \def\!!!setbars{\!setbarseget}% - \else - \def\!!!setbars{\relax}% - \fi - \fi - \!!!setbars} -\def\!setbarsbget baselabels (#1) {% - \def\!barbaselabelorientation{#1}% - \def\!bardobaselabel{\!!bardobaselabel}% - \!setbars} -\def\!setbarseget endlabels (#1) {% - \edef\!barendlabelorientation{#1}% - \def\!bardoendlabel{\!!bardoendlabel}% - \!setbars} - -% ** \!barcurve -% ** Draws a bargraph with preset values of barshift, barbreadth, -% ** barorientation (x or y) and barbaseline (coordinate) -\def\!barcurve #1 #2 {% - \if y\!barorientation - \def\!basexarg{#1}% - \def\!baseyarg{\!barbaseline}% - \else - \def\!basexarg{\!barbaseline}% - \def\!baseyarg{#2}% - \fi - \expandafter\putbar\!barshift breadth <\!barbreadth> from {\!basexarg} - {\!baseyarg} to {#1} {#2} - \def\!endxarg{#1}% - \def\!endyarg{#2}% - \!bardobaselabel} - -\def\!!bardobaselabel "#1" {% - \put {#1}\!barbaselabelorientation{} at {\!basexarg} {\!baseyarg} - \!bardoendlabel} - -\def\!!bardoendlabel "#1" {% - \put {#1}\!barendlabelorientation{} at {\!endxarg} {\!endyarg} - \!barfinish} - -\def\!barfinish{% - \!ifnextchar/{\!finish}{\!barcurve}} - - -% ******************************** -% *** BOXES (Draws rectangles) *** -% ******************************** -% -% ** User commands: -% ** \putrectangle [] corners at XCOORD1 YCOORD1 -% ** and XCOORD2 YCOORD2 -% ** \shaderectangleson -% ** \shaderectanglesoff -% ** \frame [] {TEXT} -% ** \rectangle -% -% -% ** \putrectangle [] corners at XCOORD1 YCOORD1 -% ** and XCOORD2 YCOORD2 -% ** Draws a rectangle with corners at (X1,Y1), (X2,Y1), (X1,Y2), (X2,Y2) -% ** Lines have thickness \linethickness, and overlap at the corners. -% ** The optional field functions as with a \put command. -% ** See Subsection 4.2 of the manual. -\def\putrectangle{% - \!ifnextchar<{\!putrectangle}{\!putrectangle<\!zpt,\!zpt> }} -\def\!putrectangle<#1,#2> corners at #3 #4 and #5 #6 {% -% -% ** get locations - \!xone=\!M{#3}\!xunit \!xtwo=\!M{#5}\!xunit% - \!yone=\!M{#4}\!yunit \!ytwo=\!M{#6}\!yunit% - \ifdim \!xtwo<\!xone - \!dimenI=\!xone \!xone=\!xtwo \!xtwo=\!dimenI - \fi - \ifdim \!ytwo<\!yone - \!dimenI=\!yone \!yone=\!ytwo \!ytwo=\!dimenI - \fi - \!dimenI=#1\relax \advance\!xone\!dimenI \advance\!xtwo\!dimenI - \!dimenI=#2\relax \advance\!yone\!dimenI \advance\!ytwo\!dimenI - \let\!MRect=\!M% ** save current coord/dimen mode - \!setdimenmode -% -% ** shade rectangle if appropriate - \!shaderectangle -% -% ** draw horizontal edges - \!dimenI=.5\linethickness - \advance \!xone -\!dimenI% ** adjust x-location to overlap corners - \advance \!xtwo \!dimenI% ** ditto - \putrule from {\!xone} {\!yone} to {\!xtwo} {\!yone} - \putrule from {\!xone} {\!ytwo} to {\!xtwo} {\!ytwo} -% -% ** draw vertical edges - \advance \!xone \!dimenI% ** restore original x-values - \advance \!xtwo -\!dimenI% - \advance \!yone -\!dimenI% ** adjust y-location to overlap corners - \advance \!ytwo \!dimenI% ** ditto - \putrule from {\!xone} {\!yone} to {\!xone} {\!ytwo} - \putrule from {\!xtwo} {\!yone} to {\!xtwo} {\!ytwo} -% - \let\!M=\!MRect% ** restore coord/dimen mode - \ignorespaces} - -% ** \shaderectangleson -% ** Subsequent rectangles will be shaded according to -% ** the current shading pattern. Affects \putrectangle, \putbar, -% ** \frame, \sethistograms, and \setbars. See Subsection 7.5 of the manual. -\def\shaderectangleson{% - \def\!shaderectangle{\!!shaderectangle}% - \ignorespaces} -% ** \shaderectanglesoff -% ** Suppresses \shaderectangleson. The default. -\def\shaderectanglesoff{% - \def\!shaderectangle{}% - \ignorespaces} - -\shaderectanglesoff - -% ** The following internal routine shades the current rectangle, when -% ** \!shaderectangle = \!!shaderectangle . -\def\!!shaderectangle{% - \!dimenA=\!xtwo \advance \!dimenA -\!xone - \!dimenB=\!ytwo \advance \!dimenB -\!yone - \ifdim \!dimenA<\!dimenB - \!startvshade (\!xone,\!yone,\!ytwo) - \!lshade (\!xtwo,\!yone,\!ytwo) - \else - \!starthshade (\!yone,\!xone,\!xtwo) - \!lshade (\!ytwo,\!xone,\!xtwo) - \fi - \ignorespaces} - -% ** \frame [] {TEXT} -% ** Draws a frame of thickness linethickness about the box enclosing -% ** TEXT; the frame is separated from the box by a distance of -% ** SEPARATION. The result is an hbox with the same baseline as TEXT. -% ** If is omitted, you get the effect of <0pt>. -% ** See Subsection 4.2 of the manual. -\def\frame{% - \!ifnextchar<{\!frame}{\!frame<\!zpt> }} -\long\def\!frame<#1> #2{% - \beginpicture - \setcoordinatesystem units <1pt,1pt> point at 0 0 - \put {#2} [Bl] at 0 0 - \!dimenA=#1\relax - \!dimenB=\!wd \advance \!dimenB \!dimenA - \!dimenC=\!ht \advance \!dimenC \!dimenA - \!dimenD=\!dp \advance \!dimenD \!dimenA - \let\!MFr=\!M - \!setdimenmode - \putrectangle corners at {-\!dimenA} {-\!dimenD} and {\!dimenB} {\!dimenC} - \!setcoordmode - \let\!M=\!MFr - \endpicture - \ignorespaces} - -% ** \rectangle -% ** Constructs a rectangle of width WIDTH and heigth HEIGHT. -% ** See Subsection 4.2 of the manual. -\def\rectangle <#1> <#2> {% - \setbox0=\hbox{}\wd0=#1\ht0=#2\frame {\box0}} - - -% ********************************************* -% *** CURVES (Upper level \plot commands) *** -% ********************************************* -% -% ** User commands -% ** \plot DATA / -% ** \plot "FILE NAME" -% ** \setquadratic -% ** \setlinear -% ** \sethistograms -% ** \vshade ... -% ** \hshade ... - -% \plot: multi-purpose command. Draws histograms, bar graphs, piecewise-linear -% or piecewise quadratic curves, depending on the setting of \!drawcurve. -% See Subsections 4.3-4.5, 5.1, 5.2 of the manual. -\def\plot{% - \!ifnextchar"{\!plotfromfile}{\!drawcurve}} -\def\!plotfromfile"#1"{% - \expandafter\!drawcurve \normalinput #1 /} - -% Command to set piecewise quadratic mode -% See Subsections 5.1, 7.3, and 7.4 of the manual. -\def\setquadratic{% - \let\!drawcurve=\!qcurve - \let\!!Shade=\!!qShade - \let\!!!Shade=\!!!qShade} - -% Command to set piecewise linear mode -% See Subsections 5.1, 7.3, and 7.4 of the manual. -\def\setlinear{% - \let\!drawcurve=\!lcurve - \let\!!Shade=\!!lShade - \let\!!!Shade=\!!!lShade} - -% Command to set histogram mode -% See Subsection 4.3 of the manual. -\def\sethistograms{% - \let\!drawcurve=\!hcurve} - -% Commands to cycle through list of coordinates in piecewise quadratic -% interpolation mode -\def\!qcurve #1 #2 {% - \!start (#1,#2) - \!Qjoin} -\def\!Qjoin#1 #2 #3 #4 {% - \!qjoin (#1,#2) (#3,#4) % \!qjoin is defined in QUADRATIC - \!ifnextchar/{\!finish}{\!Qjoin}} - -% Commands to cycle through list of coordinates in piecewise linear -% interpolation mode -\def\!lcurve #1 #2 {% - \!start (#1,#2) - \!Ljoin} -\def\!Ljoin#1 #2 {% - \!ljoin (#1,#2) % \!ljoin is defined in LINEAR - \!ifnextchar/{\!finish}{\!Ljoin}} - -\def\!finish/{\ignorespaces} - -% Command to cycle through list of coordinates in histogram mode -\def\!hcurve #1 #2 {% - \edef\!hxS{#1}% - \edef\!hyS{#2}% - \!hjoin} -\def\!hjoin#1 #2 {% - \putrectangle corners at {\!hxS} {\!hyS} and {#1} {#2} - \edef\!hxS{#1}% - \!ifnextchar/{\!finish}{\!hjoin}} - - -% \vshade: See Subsection 7.3 of the manual. -\def\vshade #1 #2 #3 {% - \!startvshade (#1,#2,#3) - \!Shadewhat} - -% \hshade: See Subsection 7.4 of the manual. -\def\hshade #1 #2 #3 {% - \!starthshade (#1,#2,#3) - \!Shadewhat} - -% Commands to cycle through coordinates and optional "edge effect" -% fields while shading. -\def\!Shadewhat{% - \futurelet\!nextchar\!Shade} -\def\!Shade{% - \if <\!nextchar - \def\!nextShade{\!!Shade}% - \else - \if /\!nextchar - \def\!nextShade{\!finish}% - \else - \def\!nextShade{\!!!Shade}% - \fi - \fi - \!nextShade} -\def\!!lShade<#1> #2 #3 #4 {% - \!lshade <#1> (#2,#3,#4) % \!lshade is defined in SHADING - \!Shadewhat} -\def\!!!lShade#1 #2 #3 {% - \!lshade (#1,#2,#3) - \!Shadewhat} -\def\!!qShade<#1> #2 #3 #4 #5 #6 #7 {% - \!qshade <#1> (#2,#3,#4) (#5,#6,#7) % \!qshade is defined in SHADING - \!Shadewhat} -\def\!!!qShade#1 #2 #3 #4 #5 #6 {% - \!qshade (#1,#2,#3) (#4,#5,#6) - \!Shadewhat} - -% ** Set default interpolation mode -\setlinear - - -% ******************************************** -% *** DASHPATTERNS (Sets up dash patterns) *** -% ******************************************** - -% ** User commands: -% ** \setdashpattern -% ** \setdots -% ** \setdotsnear for -% ** \setdashes -% ** \setdashesnear for -% ** \setsolid -% ** \findlength {CURVE CMDS} - -% ** Internal commands: -% ** \!dashingon -% ** \!dashingoff - -% ** Dash patterns are specified by a balanced token list whose complete -% ** expansion has the form: DIMEN1,DIMEN2,DIMEN3,DIMEN4,... ; this produces -% ** an arc of length DIMEN1, a skip of length DIMEN2, an arc of length -% ** DIMEN3, a skip of length DIMEN4, ... . Any number of DIMEN values may -% ** be given. The pattern is repeated as many times (perhaps fractional) -% ** as necessary to draw the curve. -% ** A dash pattern remains in effect until it is overridden by a call to -% ** \setdashpattern, or to \setdots, \setdotsnear ... , \setdashes, -% ** \setdashesnear ... , or \setsolid. -% ** Solid lines are the default. - - -% ** \def\setdashpattern -% ** The following routine converts a balanced list of tokens whose -% ** complete expansion has the form DIMEN1,DIMEN2, ... , DIMENk into -% ** three list macros that are used in drawing dashed rules and curves: -% ** !Flist: \!Rule{DIMEN1}\!Skip{DIMEN2}\!Rule{DIMEN3}\!Skip{DIMEN4} ... -% ** !Blist: ...\!Skip{DIMEN4}\!Rule{DIMEN3}\!Skip{DIMEN2}\!Rule{DIMEN1} -% ** !UDlist: \\{DIMEN1}\\{DIMEN2}\\{DIMEN3}\\{DIMEN4} ...; -% ** calculates \!leaderlength := DIMEN1 + ... + DIMENk; and -% ** sets the curve drawing routines to dash mode. -% ** Those lists are used by the curve drawing routines. -% ** Dimenj ... may be given as an explicit dimension (e.g., 5pt), or -% ** as an expression involving a dimension register (e.g., -2.5\dimen0). -% ** See Subsection 6.2 of the manual -\def\setdashpattern <#1>{% - \def\!Flist{}\def\!Blist{}\def\!UDlist{}% - \!countA=0 - \!ecfor\!item:=#1\do{% - \!dimenA=\!item\relax - \expandafter\!rightappend\the\!dimenA\withCS{\\}\to\!UDlist% - \advance\!countA 1 - \ifodd\!countA - \expandafter\!rightappend\the\!dimenA\withCS{\!Rule}\to\!Flist% - \expandafter\!leftappend\the\!dimenA\withCS{\!Rule}\to\!Blist% - \else - \expandafter\!rightappend\the\!dimenA\withCS{\!Skip}\to\!Flist% - \expandafter\!leftappend\the\!dimenA\withCS{\!Skip}\to\!Blist% - \fi}% - \!leaderlength=\!zpt - \def\!Rule##1{\advance\!leaderlength ##1}% - \def\!Skip##1{\advance\!leaderlength ##1}% - \!Flist% - \ifdim\!leaderlength>\!zpt - \else - \def\!Flist{\!Skip{24in}}\def\!Blist{\!Skip{24in}}\ignorespaces - \def\!UDlist{\\{\!zpt}\\{24in}}\ignorespaces - \!leaderlength=24in - \fi - \!dashingon} - - -% ** \!dashingon -- puts the curve drawing routines into dash mode -% ** \!dashingoff -- puts the curve drawing routines into solid mode -% ** These are internal commands, invoked by \setdashpattern and \setsolid -\def\!dashingon{% - \def\!advancedashing{\!!advancedashing}% - \def\!drawlinearsegment{\!lineardashed}% - \def\!puthline{\!putdashedhline}% - \def\!putvline{\!putdashedvline}% -% \def\!putsline{\!putdashedsline}% - \ignorespaces}% -\def\!dashingoff{% - \def\!advancedashing{\relax}% - \def\!drawlinearsegment{\!linearsolid}% - \def\!puthline{\!putsolidhline}% - \def\!putvline{\!putsolidvline}% -% \def\!putsline{\!putsolidsline}% - \ignorespaces} - - -% ** \setdots -- sets up a dot/skip pattern where dot (actually -% ** the current plotsymbol) is plunked down once for every LENGTH -% ** traveled along the curve. LENGTH defaults to 5pt. -% ** See Subsection 6.1 of the manual. -\def\setdots{% - \!ifnextchar<{\!setdots}{\!setdots<5pt>}} -\def\!setdots<#1>{% - \!dimenB=#1\advance\!dimenB -\plotsymbolspacing - \ifdim\!dimenB<\!zpt - \!dimenB=\!zpt - \fi -\setdashpattern <\plotsymbolspacing,\!dimenB>} - -% ** \setdotsnear for -% ** sets up a dot pattern where the dots are approximately LENGTH apart, -% ** the total length of the pattern is ARC LENGTH, and the pattern -% ** begins and ends with a dot. See Subsection 6.3 of the manual. -\def\setdotsnear <#1> for <#2>{% - \!dimenB=#2\relax \advance\!dimenB -.05pt - \!dimenC=#1\relax \!countA=\!dimenC - \!dimenD=\!dimenB \advance\!dimenD .5\!dimenC \!countB=\!dimenD - \divide \!countB \!countA - \ifnum 1>\!countB - \!countB=1 - \fi - \divide\!dimenB \!countB - \setdots <\!dimenB>} - -% ** \setdashes -- sets up a dash/skip pattern where the dash -% ** and the skip are each of length LENGTH (the dash is formed by -% ** plunking down the current plotsymbol over an arc of length LENGTH -% ** and so may actually be longer than LENGTH. LENGTH defaults to 5pt. -% ** See Subsection 6.1 of the manual. -\def\setdashes{% - \!ifnextchar<{\!setdashes}{\!setdashes<5pt>}} -\def\!setdashes<#1>{\setdashpattern <#1,#1>} - -% ** \setdashesnear ... -% ** Like \setdotsnear; the pattern begins and ends with a dash. -% ** See Subsection 6.3 of the manual. -\def\setdashesnear <#1> for <#2>{% - \!dimenB=#2\relax - \!dimenC=#1\relax \!countA=\!dimenC - \!dimenD=\!dimenB \advance\!dimenD .5\!dimenC \!countB=\!dimenD - \divide \!countB \!countA - \ifodd \!countB - \else - \advance \!countB 1 - \fi - \divide\!dimenB \!countB - \setdashes <\!dimenB>} - -% ** \setsolid -- puts the curve drawing routines in "solid line" mode, -% ** the default mode. See Subsection 6.1 of the manual. -\def\setsolid{% - \def\!Flist{\!Rule{24in}}\def\!Blist{\!Rule{24in}}% - \def\!UDlist{\\{24in}\\{\!zpt}}% - \!dashingoff} -\setsolid - -% ** \findlength {CURVE CMDS} -% ** PiCTeX executes the \start, \ljoin, and \qjoin cmds comprising -% ** CURVE CMDS without plotting anything, but stashes the length -% ** of the phantom curve away in \totalarclength. -% ** See Subsection 6.3 of the manual. -\def\findlength#1{% - \begingroup - \setdashpattern <0pt, \maxdimen> - \setplotsymbol ({}) - \dontsavelinesandcurves - #1% - \endgroup - \ignorespaces} - - -% ************************************************************* -% *** DIVISION (Does long division of dimension registers) *** -% ************************************************************* - -% ** User command: -% ** \Divide {DIVIDEND} by {DIVISOR} forming {RESULT} - -% ** Internal command -% ** \!divide{DIVIDEND}{DIVISOR}{RESULT} - -% ** \!divide DIVIDEND [by] DIVISOR [to get] ANSWER -% ** Divides the dimension DIVIDEND by the dimension DIVISOR, placing the -% ** quotient in the dimension register ANSWER. Values are understood to -% ** be in points. E.g. 12.5pt/1.4pt=8.92857pt. -% ** Quotient is accurate to 1/65536pt=2**[-16]pt -% ** |DIVISOR| should be < 2048pt (about 28 inches). -\def\!divide#1#2#3{% - \!dimenB=#1% ** dimB holds current remainder (r) - \!dimenC=#2% ** dimC holds divisor (d) - \!dimenD=\!dimenB% ** dimD holds quotient q=r/d for this - \divide \!dimenD \!dimenC% ** step, in units of scaled pts - \!dimenA=\!dimenD% ** dimA eventually holds answer (a) - \multiply\!dimenD \!dimenC% ** r <-- r - dq - \advance\!dimenB -\!dimenD% ** First step complete. Have integer part -% ** of a, and corresponding remainder. - \!dimenD=\!dimenC% ** Temporarily use dimD to hold |d| - \ifdim\!dimenD<\!zpt \!dimenD=-\!dimenD - \fi - \ifdim\!dimenD<64pt% ** Branch on the magnitude of |d| - \!divstep[\!tfs]\!divstep[\!tfs]% - \else - \!!divide - \fi - #3=\!dimenA\ignorespaces} - -% ** The following code handles divisors d with -% ** (1) .88in = 64pt <= d < 256pt = 3.54in -% ** (2) 3.54in = 256pt <= d < 2048pt = 28.34in -% ** Anything bigger than that may result in an overflow condition. -% ** For our purposes, we should never even see case (2). -\def\!!divide{% - \ifdim\!dimenD<256pt - \!divstep[64]\!divstep[32]\!divstep[32]% - \else - \!divstep[8]\!divstep[8]\!divstep[8]\!divstep[8]\!divstep[8]% - \!dimenA=2\!dimenA - \fi} - - -% ** The following macro does the real long division work. -\def\!divstep[#1]{% ** #1 = "B" - \!dimenB=#1\!dimenB% ** r <-- B*r - \!dimenD=\!dimenB% ** dimD holds quotient q=r/d for this - \divide \!dimenD by \!dimenC% ** step, in units of scaled pts - \!dimenA=#1\!dimenA% ** a <-- B*a + q - \advance\!dimenA by \!dimenD% - \multiply\!dimenD by \!dimenC% ** r <-- r - dq - \advance\!dimenB by -\!dimenD} - -% ** \Divide: See Subsection 9.3 of the manual. -\def\Divide <#1> by <#2> forming <#3> {% - \!divide{#1}{#2}{#3}} - - -% ********************************************* -% *** ELLIPSES (Draws ellipses and circles) *** -% ********************************************* - -% ** User commands -% ** \ellipticalarc axes ratio A:B DEGREES degrees from XSTART YSTART -% ** center at XCENTER YCENTER -% ** \circulararc DEGREES degrees from XSTART YSTART -% ** center at XCENTER YCENTER - -% ** Internal command -% ** \!sinandcos{32*ANGLE in radians}{32*SIN}{32*COS} - - -% ** \ellipticalarc axes ratio A:B DEGREES degrees from XSTART YSTART -% ** center at XCENTER YCENTER -% ** Draws a elliptical arc starting at the coordinate point (XSTART,YSTART). -% ** The center of the ellipse of which the arc is a segment is at -% ** (XCENTER,YCENTER). -% ** The arc extends through an angle of DEGREES degrees (may be + or -). -% ** A:B is the ratio of the length of the xaxis to the length of -% ** the yaxis of the ellipse -% ** Sqrt{[(XSTART-XCENTER)/A]**2 + [(YSTART-YCENTER)/B]**2} -% ** must be < 512pt (about 7in). -% ** Doesn't modify the dimensions (ht, dp, wd) of the PiCture under -% ** construction. - -% ** \circulararc -- See Subsection 5.3 of the manual. -\def\circulararc{% - \ellipticalarc axes ratio 1:1 } - -% ** \ellipticalarc -- See Subsection 5.3 of the manual. -\def\ellipticalarc axes ratio #1:#2 #3 degrees from #4 #5 center at #6 #7 {% - \!angle=#3pt\relax% ** get angle - \ifdim\!angle>\!zpt - \def\!sign{}% ** counterclockwise - \else - \def\!sign{-}\!angle=-\!angle% ** clockwise - \fi - \!xxloc=\!M{#6}\!xunit% ** convert CENTER to dimension - \!yyloc=\!M{#7}\!yunit - \!xxS=\!M{#4}\!xunit% ** get STARTing point on rim of ellipse - \!yyS=\!M{#5}\!yunit - \advance\!xxS -\!xxloc% ** make center of ellipse (0,0) - \advance\!yyS -\!yyloc - \!divide\!xxS{#1pt}\!xxS % ** scale point on ellipse to point on - \!divide\!yyS{#2pt}\!yyS % corresponding circle -% - \let\!MC=\!M% ** save current c/d mode - \!setdimenmode% ** go into dimension mode -% - \!xS=#1\!xxS \advance\!xS\!xxloc - \!yS=#2\!yyS \advance\!yS\!yyloc - \!start (\!xS,\!yS)% - \!loop\ifdim\!angle>14.9999pt% ** draw in major portion of ellipse - \!rotate(\!xxS,\!yyS)by(\!cos,\!sign\!sin)to(\!xxM,\!yyM) - \!rotate(\!xxM,\!yyM)by(\!cos,\!sign\!sin)to(\!xxE,\!yyE) - \!xM=#1\!xxM \advance\!xM\!xxloc \!yM=#2\!yyM \advance\!yM\!yyloc - \!xE=#1\!xxE \advance\!xE\!xxloc \!yE=#2\!yyE \advance\!yE\!yyloc - \!qjoin (\!xM,\!yM) (\!xE,\!yE) - \!xxS=\!xxE \!yyS=\!yyE - \advance \!angle -15pt - \repeat - \ifdim\!angle>\!zpt% ** complete remaining arc, if any - \!angle=100.53096\!angle% ** convert angle to radians, divide - \divide \!angle 360 % ** by 2, and multiply by 32 - \!sinandcos\!angle\!!sin\!!cos% ** get 32*sin & 32*cos - \!rotate(\!xxS,\!yyS)by(\!!cos,\!sign\!!sin)to(\!xxM,\!yyM) - \!rotate(\!xxM,\!yyM)by(\!!cos,\!sign\!!sin)to(\!xxE,\!yyE) - \!xM=#1\!xxM \advance\!xM\!xxloc \!yM=#2\!yyM \advance\!yM\!yyloc - \!xE=#1\!xxE \advance\!xE\!xxloc \!yE=#2\!yyE \advance\!yE\!yyloc - \!qjoin (\!xM,\!yM) (\!xE,\!yE) - \fi -% - \let\!M=\!MC% ** restore c/d mode - \ignorespaces}% ** if appropriate - - -% ** \!rotate(XREG,YREG)by(32cos,32sin)to(XXREG,YYREG) -% ** rotates (XREG,YREG) by angle with specfied scaled cos & sin to -% ** (XXREG,YYREG). Uses \!dimenA & \!dimenB as scratch registers. -\def\!rotate(#1,#2)by(#3,#4)to(#5,#6){% - \!dimenA=#3#1\advance \!dimenA -#4#2% ** Rcos(x+t)=Rcosx*cost - Rsinx*sint - \!dimenB=#3#2\advance \!dimenB #4#1% ** Rsin(x+t)=Rsinx*cost + Rcosx*sint - \divide \!dimenA 32 \divide \!dimenB 32 - #5=\!dimenA #6=\!dimenB - \ignorespaces} -\def\!sin{4.17684}% ** 32*sin(pi/24) (pi/24=7.5deg) -\def\!cos{31.72624}% ** 32*cos(pi/24) - - -% ** \!sinandcos{32*ANGLE in radians}{\SINCS}{\COSCS} -% ** Computes the 32*sine and 32*cosine of a small ANGLE expressed in -% ** radians/32 and puts these values in the replacement texts of -% ** \SINCS and \COSCS -\def\!sinandcos#1#2#3{% - \!dimenD=#1% ** angle is expressed in radians/32: 1pt = 1/32rad - \!dimenA=\!dimenD% ** dimA will eventually contain 32sin(angle)in pts - \!dimenB=32pt% ** dimB will eventually contain 32cos(angle)in pts - \!removept\!dimenD\!value% ** get value of 32*angle, without "pt" - \!dimenC=\!dimenD% ** holds 32*angle**i/i! in pts - \!dimenC=\!value\!dimenC \divide\!dimenC by 64 % ** now 32*angle**2/2 - \advance\!dimenB by -\!dimenC% ** 32-32*angle**2/2 - \!dimenC=\!value\!dimenC \divide\!dimenC by 96 % ** now 32*angle**3/3! - \advance\!dimenA by -\!dimenC% ** now 32*(angle-angle**3/6) - \!dimenC=\!value\!dimenC \divide\!dimenC by 128 % ** now 32*angle**4/4! - \advance\!dimenB by \!dimenC% - \!removept\!dimenA#2% ** set 32*sin(angle) - \!removept\!dimenB#3% ** set 32*cos(angle) - \ignorespaces} - - -% ***************************************************************** -% *** RULES (Draws rules, i.e., horizontal & vertical lines) *** -% ***************************************************************** - -% ** User command: -% ** \putrule [] from XCOORD1 YCOORD1 -% ** to XCOORD2 YCOORD2 - -% ** Internal commands: -% ** \!puthline [] (h = horizontal) -% ** Set by dashpat to either: \!putsolidhline or \!putdashedhline -% ** \!putvline [] (v = vertical) -% ** Either: \!putsolidvline or \!putdashedvline - - -% ** \putrule [] from XCOORD1 YCOORD1 -% ** to XCOORD2 YCOORD2 -% ** Draws a rule -- dashed or solid depending on the current dash pattern -- -% ** from (X1,Y1) to (X2,Y2). Uses TEK's \hrule & \vrule & \leaders -% ** constructions to handle horizontal & vertical lines efficiently both -% ** in terms of execution time and space in the DVI file. -% ** See Subsection 4.1 of the manual. -\def\putrule#1from #2 #3 to #4 #5 {% - \!xloc=\!M{#2}\!xunit \!xxloc=\!M{#4}\!xunit% - \!yloc=\!M{#3}\!yunit \!yyloc=\!M{#5}\!yunit% - \!dxpos=\!xxloc \advance\!dxpos by -\!xloc - \!dypos=\!yyloc \advance\!dypos by -\!yloc -% - \ifdim\!dypos=\!zpt - \def\!!Line{\!puthline{#1}}\ignorespaces - \else - \ifdim\!dxpos=\!zpt - \def\!!Line{\!putvline{#1}}\ignorespaces - \else - \def\!!Line{} - \fi - \fi - \let\!ML=\!M% ** save current coord\dimen mode - \!setdimenmode% ** express locations in dimens - \!!Line% - \let\!M=\!ML% ** restore previous c/d mode - \ignorespaces} - - -% ** \!putsolidhline [] -% ** Place horizontal solid line -\def\!putsolidhline#1{% - \ifdim\!dxpos>\!zpt - \put{\!hline\!dxpos}#1[l] at {\!xloc} {\!yloc} - \else - \put{\!hline{-\!dxpos}}#1[l] at {\!xxloc} {\!yyloc} - \fi - \ignorespaces} - -% ** \!putsolidvline [shifted ] -% ** Place vertical solid line -\def\!putsolidvline#1{% - \ifdim\!dypos>\!zpt - \put{\!vline\!dypos}#1[b] at {\!xloc} {\!yloc} - \else - \put{\!vline{-\!dypos}}#1[b] at {\!xxloc} {\!yyloc} - \fi - \ignorespaces} - -\def\!hline#1{\hbox to #1{\leaders \hrule height\linethickness\hfill}} -\def\!vline#1{\vbox to #1{\leaders \vrule width\linethickness\vfill}} - - -% ** \!putdashedhline [] -% ** Place dashed horizontal line -\def\!putdashedhline#1{% - \ifdim\!dxpos>\!zpt - \!DLsetup\!Flist\!dxpos - \put{\hbox to \!totalleaderlength{\!hleaders}\!hpartialpattern\!Rtrunc} - #1[l] at {\!xloc} {\!yloc} - \else - \!DLsetup\!Blist{-\!dxpos} - \put{\!hpartialpattern\!Ltrunc\hbox to \!totalleaderlength{\!hleaders}} - #1[r] at {\!xloc} {\!yloc} - \fi - \ignorespaces} - -% ** \!putdashedhline [] -% ** Place dashed vertical line -\def\!putdashedvline#1{% - \!dypos=-\!dypos% ** vertical leaders go from top to bottom - \ifdim\!dypos>\!zpt - \!DLsetup\!Flist\!dypos - \put{\vbox{\vbox to \!totalleaderlength{\!vleaders} - \!vpartialpattern\!Rtrunc}}#1[t] at {\!xloc} {\!yloc} - \else - \!DLsetup\!Blist{-\!dypos} - \put{\vbox{\!vpartialpattern\!Ltrunc - \vbox to \!totalleaderlength{\!vleaders}}}#1[b] at {\!xloc} {\!yloc} - \fi - \ignorespaces} - - -% ** The rest of the macros in this section are subroutines used by -% ** \!putdashedhline and \!putdashedvline. -\def\!DLsetup#1#2{% ** Dashed-Line set up - \let\!RSlist=#1% ** set !Rule-Skip list - \!countB=#2% ** convert rule length to integer (number of sps) - \!countA=\!leaderlength% ** ditto, leaderlength - \divide\!countB by \!countA% ** number of complete leader units - \!totalleaderlength=\!countB\!leaderlength - \!Rresiduallength=#2% - \advance \!Rresiduallength by -\!totalleaderlength% \** excess length - \!Lresiduallength=\!leaderlength - \advance \!Lresiduallength by -\!Rresiduallength - \ignorespaces} - -\def\!hleaders{% - \def\!Rule##1{\vrule height\linethickness width##1}% - \def\!Skip##1{\hskip##1}% - \leaders\hbox{\!RSlist}\hfill} - -\def\!hpartialpattern#1{% - \!dimenA=\!zpt \!dimenB=\!zpt - \def\!Rule##1{#1{##1}\vrule height\linethickness width\!dimenD}% - \def\!Skip##1{#1{##1}\hskip\!dimenD}% - \!RSlist} - -\def\!vleaders{% - \def\!Rule##1{\hrule width\linethickness height##1}% - \def\!Skip##1{\vskip##1}% - \leaders\vbox{\!RSlist}\vfill} - -\def\!vpartialpattern#1{% - \!dimenA=\!zpt \!dimenB=\!zpt - \def\!Rule##1{#1{##1}\hrule width\linethickness height\!dimenD}% - \def\!Skip##1{#1{##1}\vskip\!dimenD}% - \!RSlist} - -\def\!Rtrunc#1{\!trunc{#1}>\!Rresiduallength} -\def\!Ltrunc#1{\!trunc{#1}<\!Lresiduallength} - -\def\!trunc#1#2#3{% - \!dimenA=\!dimenB - \advance\!dimenB by #1% - \!dimenD=\!dimenB \ifdim\!dimenD#2#3\!dimenD=#3\fi - \!dimenC=\!dimenA \ifdim\!dimenC#2#3\!dimenC=#3\fi - \advance \!dimenD by -\!dimenC} - - -% **************************************************************** -% *** LINEAR ARC (Draws straight lines -- solid and dashed) *** -% **************************************************************** - -% ** User commands -% ** \inboundscheckoff -% ** \inboundscheckon - -% ** Internal commands -% ** \!start (XCOORD,YCOORD) -% ** \!ljoin (XCOORD,YCOORD) -% ** \!drawlinearsegment -- set by \dashpat to either -% ** \!linearsolid or \!lineardashed -% ** \!advancedashing -- set by \dashpat to either -% ** \relax or \!!advancedashing -% ** \!plotifinbounds -- set by \inboundscheck off/on to either -% ** \!plot or \!!plotifinbounds -% ** \!initinboundscheck -- set by \inboundscheck off/on to either -% ** \relax or \!!initinboundscheck - - -% \plotsymbolspacing ** distance between consecutive plot positions -% \!xS ** starting x -% \!yS ** starting y -% \!xE ** ending x -% \!yE ** ending y -% \!xdiff ** x_end - x_start -% \!ydiff ** y_end - y_start -% \!distacross ** how far along curve next point to be plotted is -% \!arclength ** approximate length of arc for current interval -% \!downlength ** remaining length for "pen" to be down -% \!uplength ** length for "pen" to be down -% \!intervalno ** counts segments to curve -% \totalarclength ** cumulative distance along curve -% \!npoints ** approximately (arc length / plotsymbolspacing) - -% ** Calls -- \!Pythag, \!divide, \!plot - - -% ** \!start (XCOORD,YCOORD) -% ** Sets initial point for linearly (or quadratically) interpolated curve -\def\!start (#1,#2){% - \!plotxorigin=\!xorigin \advance \!plotxorigin by \!plotsymbolxshift - \!plotyorigin=\!yorigin \advance \!plotyorigin by \!plotsymbolyshift - \!xS=\!M{#1}\!xunit \!yS=\!M{#2}\!yunit - \!rotateaboutpivot\!xS\!yS - \!copylist\!UDlist\to\!!UDlist% **\!UDlist has the form \\{dimen1}\\{dimen2}.. -% ** Routine will draw dashed line with pen -% ** down for dimen1, up for dimen2, ... - \!getnextvalueof\!downlength\from\!!UDlist - \!distacross=\!zpt% ** 1st point goes at start of curve - \!intervalno=0 % ** initialize interval counter - \global\totalarclength=\!zpt% ** initialize distance traveled along curve - \ignorespaces} - - -% ** \!ljoin (XCOORD,YCOORD) -% ** Draws a straight line starting at the last point specified -% ** by the most recent \!start, \!ljoin, or \!qjoin, and -% ** ending at (XCOORD,YCOORD). -\def\!ljoin (#1,#2){% - \advance\!intervalno by 1 - \!xE=\!M{#1}\!xunit \!yE=\!M{#2}\!yunit - \!rotateaboutpivot\!xE\!yE - \!xdiff=\!xE \advance \!xdiff by -\!xS%** xdiff = xE - xS - \!ydiff=\!yE \advance \!ydiff by -\!yS%** ydiff = yE - yS - \!Pythag\!xdiff\!ydiff\!arclength% ** arclength = sqrt(xdiff**2+ydiff**2) - \global\advance \totalarclength by \!arclength% - \!drawlinearsegment% ** set by dashpat to \!linearsolid or \!lineardashed - \!xS=\!xE \!yS=\!yE% ** shift ending points to starting points - \ignorespaces} - - -% ** The following routine is used to draw a "solid" line between (xS,yS) -% ** and (xE,yE). Points are spaced nearly every \plotsymbolspacing length -% ** along the line. -\def\!linearsolid{% - \!npoints=\!arclength - \!countA=\plotsymbolspacing - \divide\!npoints by \!countA% ** now #pts =. arclength/plotsymbolspacing - \ifnum \!npoints<1 - \!npoints=1 - \fi - \divide\!xdiff by \!npoints - \divide\!ydiff by \!npoints - \!xpos=\!xS \!ypos=\!yS -% - \loop\ifnum\!npoints>-1 - \!plotifinbounds - \advance \!xpos by \!xdiff - \advance \!ypos by \!ydiff - \advance \!npoints by -1 - \repeat - \ignorespaces} - - -% ** The following routine is used to draw a dashed line between (xS,yS) -% ** and (xE,yE). The dash pattern continues from the previous segment. -\def\!lineardashed{% -% ** - \ifdim\!distacross>\!arclength - \advance \!distacross by -\!arclength %nothing to plot in this interval -% - \else -% - \loop\ifdim\!distacross<\!arclength -% ** plot point, interpolating linearly in x and y - \!divide\!distacross\!arclength\!dimenA% ** dimA = across/arclength - \!removept\!dimenA\!t% ** \!t holds value in dimA, without the "pt" - \!xpos=\!t\!xdiff \advance \!xpos by \!xS - \!ypos=\!t\!ydiff \advance \!ypos by \!yS - \!plotifinbounds - \advance\!distacross by \plotsymbolspacing - \!advancedashing - \repeat -% - \advance \!distacross by -\!arclength% ** prepare for next interval - \fi - \ignorespaces} - - -\def\!!advancedashing{% - \advance\!downlength by -\plotsymbolspacing - \ifdim \!downlength>\!zpt - \else - \advance\!distacross by \!downlength - \!getnextvalueof\!uplength\from\!!UDlist - \advance\!distacross by \!uplength - \!getnextvalueof\!downlength\from\!!UDlist - \fi} - - -% ** \inboundscheckoff & \inboundscheckon: See Subsection 5.5 of the manual. -\def\inboundscheckoff{% - \def\!plotifinbounds{\!plot(\!xpos,\!ypos)}% - \def\!initinboundscheck{\relax}\ignorespaces} -\def\inboundscheckon{% - \def\!plotifinbounds{\!!plotifinbounds}% - \def\!initinboundscheck{\!!initinboundscheck}% - \!initinboundscheck\ignorespaces} -\inboundscheckoff - -% ** The following code plots the current point only if it falls in the -% ** current plotarea. It doesn't matter if the coordinate system has -% ** changed since the plotarea was set up. However, shifts of the plot -% ** are ignored (how the plotsymbol stands relative to its plot position is -% ** unknown anyway). -\def\!!plotifinbounds{% - \ifdim \!xpos<\!checkleft - \else - \ifdim \!xpos>\!checkright - \else - \ifdim \!ypos<\!checkbot - \else - \ifdim \!ypos>\!checktop - \else - \!plot(\!xpos,\!ypos) - \fi - \fi - \fi - \fi} - - -\def\!!initinboundscheck{% - \!checkleft=\!arealloc \advance\!checkleft by \!xorigin - \!checkright=\!arearloc \advance\!checkright by \!xorigin - \!checkbot=\!areabloc \advance\!checkbot by \!yorigin - \!checktop=\!areatloc \advance\!checktop by \!yorigin} - - -% ********************************* -% *** LOGTEN (Log_10 function) *** -% ********************************* -% -% ** \!logten{X} -% ** Calculates log_10 of X. X and LOG10(X) are in fixed point notation. -% ** X must be positive; it may have an optional `+' sign; any number -% ** of digits may be specified for X. The absolute error in LOG10(X) is -% ** less than .0001 (probably < .00006). That's about as good as you -% ** hope for, since TEX only operates to 5 figures after the decimal -% ** point anyway. - -% \!rootten=3.162278pt **** These are values are set in ALLOCATIONS -% \!tenAe=2.543275pt (=A5) -% \!tenAc=2.773839pt (=A3) -% \!tenAa=8.690286pt (=A1) - -\def\!logten#1#2{% - \expandafter\!!logten#1\!nil - \!removept\!dimenF#2% - \ignorespaces} - -\def\!!logten#1#2\!nil{% - \if -#1% - \!dimenF=\!zpt - \def\!next{\ignorespaces}% - \else - \if +#1% - \def\!next{\!!logten#2\!nil}% - \else - \if .#1% - \def\!next{\!!logten0.#2\!nil}% - \else - \def\!next{\!!!logten#1#2..\!nil}% - \fi - \fi - \fi - \!next} - -\def\!!!logten#1#2.#3.#4\!nil{% - \!dimenF=1pt % ** DimF holds log10 original argument - \if 0#1% - \!!logshift#3pt % ** Argument < 1 - \else % ** Argument >= 1 - \!logshift#2/% ** Shift decimal pt as many places - \!dimenE=#1.#2#3pt % ** as there are figures in #2 - \fi % ** Now dimE holds revised X want log10 of - \ifdim \!dimenE<\!rootten% ** Transform X to XX between sqrt(10) - \multiply \!dimenE 10 % ** and 10*sqrt(10) - \advance \!dimenF -1pt - \fi - \!dimenG=\!dimenE% ** dimG <- (XX + 10) - \advance\!dimenG 10pt - \advance\!dimenE -10pt % ** dimE <- (XX - 10) - \multiply\!dimenE 10 % ** dimE = 10*(XX-10) - \!divide\!dimenE\!dimenG\!dimenE% ** Now dimE=10t==10*(XX-10)/(XX+10) - \!removept\!dimenE\!t% ** !t=10t, with "pt" removed - \!dimenG=\!t\!dimenE% ** dimG=100t**2 - \!removept\!dimenG\!tt% ** !tt=100t**2, with "pt" removed - \!dimenH=\!tt\!tenAe% ** dimH=10*a5*(10t)**2 /100 - \divide\!dimenH 100 - \advance\!dimenH \!tenAc% ** ditto + 10*a3 - \!dimenH=\!tt\!dimenH% ** ditto * (10t)**2 /100 - \divide\!dimenH 100 - \advance\!dimenH \!tenAa% ** ditto + 10*a1 - \!dimenH=\!t\!dimenH% ** ditto * 10t / 100 - \divide\!dimenH 100 % ** Now dimH = log10(XX) - 1 - \advance\!dimenF \!dimenH}% ** dimF = log10(X) - -\def\!logshift#1{% - \if #1/% - \def\!next{\ignorespaces}% - \else - \advance\!dimenF 1pt - \def\!next{\!logshift}% - \fi - \!next} - - \def\!!logshift#1{% - \advance\!dimenF -1pt - \if 0#1% - \def\!next{\!!logshift}% - \else - \if p#1% - \!dimenF=1pt - \def\!next{\!dimenE=1p}% - \else - \def\!next{\!dimenE=#1.}% - \fi - \fi - \!next} - - -% *********************************************************** -% *** PICTURES (Basic setups for PiCtures; \put commands) *** -% *********************************************************** - -% ** User Commands: -% ** \beginpicture -% ** \endpicture -% ** \endpicturesave -% ** \setcoordinatesystem units point at XREF YREF -% ** \put {OBJECT} [ORIENTATION] at XCOORD YCOORD -% ** \multiput {OJBECT} [ORIENTATION] ) at -% ** XCOORD YCOORD -% ** *NUMBER_OF_TIMES DXCOORD DYCOORD / -% ** \accountingon -% ** \accountingoff -% ** \stack [ORIENTATION] {LIST OF ITEMS} -% ** \lines [ORIENTATION] {LINES} -% ** \Lines [ORIENTATION] {LINES} -% ** \setdimensionmode -% ** \setcoordinatemode -% ** \Xdistance -% ** \Ydistance - -% ** Internal commands: -% ** \!setputobject{OBJECT}{[ORIENTATION]} -% ** \!dimenput{OBJECT}[ORIENTATION](XDIMEN,YDIMEN) -% ** \!setdimenmode -% ** \!setcoordmode -% ** \!ifdimenmode -% ** \!ifcoordmode - - -% ** \beginpicture -% ** \endpicture -% ** \endpicturesave -% ** \beginpicture ... \endpicture creates an hbox. Objects are -% ** placed in this box using the \put command and the like (see below). -% ** The location of an object is specified in terms of coordinate system(s) -% ** established by \setcoordinatesystem. Each coordinate system (there -% ** might be just one) specifies the length of 1 horizontal unit, the length -% ** of 1 vertical unit, and the coordinates of a "reference point". The -% ** reference points of various coordinate systems will be in the same -% ** physical location. The macros keep track of the size of the objects -% ** and their locations. The resulting hbox is the smallest hbox which -% ** encloses all the objects, and whose TEK reference point is the point -% ** on the left edge of the box closest vertically to the PICTEX reference -% ** point. Using \endpicturesave, you can (globally) save the distance TEK's -% ** reference point is to the right (respectively, up from) PICTEX's -% ** reference point in the dimension register \XREG (respectively \YREG). -% ** You can then \put the picture OBJECT into a larger picture so that its -% ** reference point is at (XCOORD,YCOORD) with the command -% ** \put {picture OBJECT} [Bl] <\XREG, \YREG> at XCOORD YCOORD - -% ** \beginpicture : See Subsection 1.1 of the manual. -\def\beginpicture{% - \setbox\!picbox=\hbox\bgroup% - \!xleft=\maxdimen - \!xright=-\maxdimen - \!ybot=\maxdimen - \!ytop=-\maxdimen} - -% ** \endpicture : See Subsection 1.1 of the manual. -\def\endpicture{% - \ifdim\!xleft=\maxdimen% ** check if nothing was put in picbox - \!xleft=\!zpt \!xright=\!zpt \!ybot=\!zpt \!ytop=\!zpt - \fi - \global\!Xleft=\!xleft \global\!Xright=\!xright - \global\!Ybot=\!ybot \global\!Ytop=\!ytop - \egroup% - \ht\!picbox=\!Ytop \dp\!picbox=-\!Ybot - \ifdim\!Ybot>\!zpt - \else - \ifdim\!Ytop<\!zpt - \!Ybot=\!Ytop - \else - \!Ybot=\!zpt - \fi - \fi - \hbox{\kern-\!Xleft\lower\!Ybot\box\!picbox\kern\!Xright}} - -% ** \endpicturesave : See Subsection 8.4 of the manual. -\def\endpicturesave <#1,#2>{% - \endpicture \global #1=\!Xleft \global #2=\!Ybot \ignorespaces} - - -% ** \setcoordinatesystem units -% ** point at XREF YREF -% ** Each of `units ' and `point at XREF YREF' -% ** are optional. -% ** Unit lengths must be given in dimensions (e.g., <10pt,1in>). -% ** Default unit lengths are 1pt, 1pt, or previous unit lengths. -% ** Reference point is specified in current units (e.g., 3 5 ). -% ** Default reference point is 0 0 , or previous reference point. -% ** Unit lengths and reference points obey TEX's scoping rules. -% ** See Subsection 1.2 of the manual. -\def\setcoordinatesystem{% - \!ifnextchar{u}{\!getlengths } - {\!getlengths units <\!xunit,\!yunit>}} -\def\!getlengths units <#1,#2>{% - \!xunit=#1\relax - \!yunit=#2\relax - \!ifcoordmode - \let\!SCnext=\!SCccheckforRP - \else - \let\!SCnext=\!SCdcheckforRP - \fi - \!SCnext} -\def\!SCccheckforRP{% - \!ifnextchar{p}{\!cgetreference } - {\!cgetreference point at {\!xref} {\!yref} }} -\def\!cgetreference point at #1 #2 {% - \edef\!xref{#1}\edef\!yref{#2}% - \!xorigin=\!xref\!xunit \!yorigin=\!yref\!yunit - \!initinboundscheck % ** See linear.tex - \ignorespaces} -\def\!SCdcheckforRP{% - \!ifnextchar{p}{\!dgetreference}% - {\ignorespaces}} -\def\!dgetreference point at #1 #2 {% - \!xorigin=#1\relax \!yorigin=#2\relax - \ignorespaces} - - -% ** \put {OBJECT} [XY] at (XCOORD,YCOORD) -% ** `[XY]' and `' are optional. -% ** First OBJECT is placed in an hbox (the "objectbox") and then a -% ** "reference point" is assigned to the objectbox as follows: -% ** [1] first, the reference point is taken to be the center of the box; -% ** [2] next, centering is overridden by the specifications -% ** X=l -- reference point along the left edge of the objectbox -% ** X=r -- reference point along the right edge of the objectbox -% ** Y=b -- reference point along the bottom edge of the objectbox -% ** Y=B -- reference point along the Baseline of the objectbox -% ** Y=t -- reference point along the top edge of the objectbox; -% ** [3] finally the reference point is shifted left by XDIMEN, down -% ** by YDIMEN (both default to 0pt). -% ** The objectbox is placed within PICBOX with its reference point at -% ** (XCOORD,YCOORD). -% ** If OBJECT is a saved box, say box0, you have to write -% ** \put{\box0}... or \put{\copy0}... -% ** The objectbox is void after the put. -% ** See Subsection 2.1 of the manual. -\long\def\put#1#2 at #3 #4 {% - \!setputobject{#1}{#2}% - \!xpos=\!M{#3}\!xunit \!ypos=\!M{#4}\!yunit - \!rotateaboutpivot\!xpos\!ypos% - \advance\!xpos -\!xorigin \advance\!xpos -\!xshift - \advance\!ypos -\!yorigin \advance\!ypos -\!yshift - \kern\!xpos\raise\!ypos\box\!putobject\kern-\!xpos% - \!doaccounting\ignorespaces} - -% ** \multiput etc. Like \put. The objectbox is not voided until the -% ** termininating /, and is placed repeatedly with: -% ** XCOORD YCOORD -- the objectbox is put down with its reference point -% ** at (XCOORD,YCOORD); -% ** *N DXCOORD DYCOORD -- each of N times the current -% ** (xcoord,ycoord) is incremented by (DXCOORD,DYCOORD), and the -% ** objectbox is put down with its reference point at (xcoord,ycoord) -% ** (This specification has to follow an XCOORD YCOORD pair) -% ** See Subsection 2.2 of the manual. -\long\def\multiput #1#2 at {% - \!setputobject{#1}{#2}% - \!ifnextchar"{\!putfromfile}{\!multiput}} -\def\!putfromfile"#1"{% - \expandafter\!multiput \normalinput #1 /} -\def\!multiput{% - \futurelet\!nextchar\!!multiput} -\def\!!multiput{% - \if *\!nextchar - \def\!nextput{\!alsoby}% - \else - \if /\!nextchar - \def\!nextput{\!finishmultiput}% - \else - \def\!nextput{\!alsoat}% - \fi - \fi - \!nextput} -\def\!finishmultiput/{% - \setbox\!putobject=\hbox{}% - \ignorespaces} - -% ** \!alsoat XCOORD YCOORD -% ** The objectbox is put down with reference point at XCOORD,YCOORD -\def\!alsoat#1 #2 {% - \!xpos=\!M{#1}\!xunit \!ypos=\!M{#2}\!yunit - \!rotateaboutpivot\!xpos\!ypos% - \advance\!xpos -\!xorigin \advance\!xpos -\!xshift - \advance\!ypos -\!yorigin \advance\!ypos -\!yshift - \kern\!xpos\raise\!ypos\copy\!putobject\kern-\!xpos% - \!doaccounting - \!multiput} - -% ** \!alsoby*N DXCOORD DYCOORD -% ** N times, the current (XCOORD,YCOORD) is advanced by (DXCOORD,DYCOORD), -% ** and the current (shifted, oriented) OBJECT is put down. -\def\!alsoby*#1 #2 #3 {% - \!dxpos=\!M{#2}\!xunit \!dypos=\!M{#3}\!yunit - \!rotateonly\!dxpos\!dypos - \!ntemp=#1% - \!!loop\ifnum\!ntemp>0 - \advance\!xpos by \!dxpos \advance\!ypos by \!dypos - \kern\!xpos\raise\!ypos\copy\!putobject\kern-\!xpos% - \advance\!ntemp by -1 - \repeat - \!doaccounting - \!multiput} - -% ** \accountingoff : Suspends PiCTeX's accounting of the aggregate -% ** size of the picture box. -% ** \accounting on : Reinstates accounting. -% ** See Subsection 8.2 of the manual. -\def\accountingon{\def\!doaccounting{\!!doaccounting}\ignorespaces} -\def\accountingoff{\def\!doaccounting{}\ignorespaces} -\accountingon -\def\!!doaccounting{% - \!xtemp=\!xpos - \!ytemp=\!ypos - \ifdim\!xtemp<\!xleft - \!xleft=\!xtemp - \fi - \advance\!xtemp by \!wd - \ifdim\!xright<\!xtemp - \!xright=\!xtemp - \fi - \advance\!ytemp by -\!dp - \ifdim\!ytemp<\!ybot - \!ybot=\!ytemp - \fi - \advance\!ytemp by \!dp - \advance\!ytemp by \!ht - \ifdim\!ytemp>\!ytop - \!ytop=\!ytemp - \fi} - -\long\def\!setputobject#1#2{% - \setbox\!putobject=\hbox{#1}% - \!ht=\ht\!putobject \!dp=\dp\!putobject \!wd=\wd\!putobject - \wd\!putobject=\!zpt - \!xshift=.5\!wd \!yshift=.5\!ht \advance\!yshift by -.5\!dp - \edef\!putorientation{#2}% - \expandafter\!SPOreadA\!putorientation[]\!nil% - \expandafter\!SPOreadB\!putorientation<\!zpt,\!zpt>\!nil\ignorespaces} - -\def\!SPOreadA#1[#2]#3\!nil{\!etfor\!orientation:=#2\do\!SPOreviseshift} - -\def\!SPOreadB#1<#2,#3>#4\!nil{\advance\!xshift by -#2\advance\!yshift by -#3} - -\def\!SPOreviseshift{% - \if l\!orientation - \!xshift=\!zpt - \else - \if r\!orientation - \!xshift=\!wd - \else - \if b\!orientation - \!yshift=-\!dp - \else - \if B\!orientation - \!yshift=\!zpt - \else - \if t\!orientation - \!yshift=\!ht - \fi - \fi - \fi - \fi - \fi} - - -% ** \!dimenput{OBJECT} [XY] (XLOC,YLOC) -% ** This is an internal put routine, similar to \put, except that -% ** XLOC=distance right from reference point, YLOC=distance up from -% ** reference point. XLOC and YLOC are dimensions, so this routine -% ** is completely independent of the current coordinate system. -% ** This routine does NOT do ROTATIONS. -\long\def\!dimenput#1#2(#3,#4){% - \!setputobject{#1}{#2}% - \!xpos=#3\advance\!xpos by -\!xshift - \!ypos=#4\advance\!ypos by -\!yshift - \kern\!xpos\raise\!ypos\box\!putobject\kern-\!xpos% - \!doaccounting\ignorespaces} - - -% ** The following macros permit the picture drawing routines to be used -% ** either in the default "coordinate mode", or in "dimension mode". -% ** In coordinate mode \!M(1.5,\!xunit) expands to 1.5\!xunit -% ** In dimension mode \!M(1.5pt,\!xunit) expands to 1.5pt -% ** Dimension mode is useful in coding macros. -% ** Any special purpose picture macro that sets dimension mode should -% ** reset coordinate mode before completion. -% ** See Subsection 9.2 of the manual. -\def\!setdimenmode{% - \let\!M=\!M!!\ignorespaces} -\def\!setcoordmode{% - \let\!M=\!M!\ignorespaces} -\def\!ifcoordmode{% - \ifx \!M \!M!} -\def\!ifdimenmode{% - \ifx \!M \!M!!} -\def\!M!#1#2{#1#2} -\def\!M!!#1#2{#1} -\!setcoordmode -\let\setdimensionmode=\!setdimenmode -\let\setcoordinatemode=\!setcoordmode - -% ** \Xdistance{XCOORD}, \Ydistance{YCOORD} are the horizontal and -% ** vertical distances from the origin (0,0) to the point -% ** (XCOORD,YCOORD) in the current coordinate system. -% ** See Subsection 9.2 of the manual. -\def\Xdistance#1{% - \!M{#1}\!xunit - \ignorespaces} -\def\Ydistance#1{% - \!M{#1}\!yunit - \ignorespaces} - -% ** The following macros -- \stack, \line, and \Lines -- are useful for -% ** annotating PiCtures. They can be used outside the \beginpicture ... -% ** \endpicture environment. - -% ** \stack [POSITIONING] {VALUESLIST} -% ** Builds a vertical stack of the values in VALUESLIST. Values in -% ** VALUESLIST are separated by commas. In the resulting stack, values are -% ** centered by default, and positioned flush left (right) if -% ** POSITIONING = l (r). Values are separated vertically by LEADING, -% ** which defaults to \stackleading. -% ** See Subsection 2.3 of the manual. -\def\stack{% - \!ifnextchar[{\!stack}{\!stack[c]}} -\def\!stack[#1]{% - \let\!lglue=\hfill \let\!rglue=\hfill - \expandafter\let\csname !#1glue\endcsname=\relax - \!ifnextchar<{\!!stack}{\!!stack<\stackleading>}} -\def\!!stack<#1>#2{% - \vbox{\def\!valueslist{}\!ecfor\!value:=#2\do{% - \expandafter\!rightappend\!value\withCS{\\}\to\!valueslist}% - \!lop\!valueslist\to\!value - \let\\=\cr\lineskiplimit=\maxdimen\lineskip=#1% - \baselineskip=-1000pt\halign{\!lglue##\!rglue\cr \!value\!valueslist\cr}}% - \ignorespaces} - -% ** \lines [POSITIONING] {LINES} -% ** Builds a vertical array of the lines in LINES. Each line in LINES -% ** is terminated by a \cr. In the resulting array, lines are -% ** centered by default, and positioned flush left (right) if -% ** POSITIONING = l (r). The lines in the array are subject to TeX's -% ** usual spacing rules: in particular the baselines are ordinarily an equal -% ** distance apart. The baseline of the array is the baseline of the -% ** the bottom line. -% ** See Subsection 2.3 of the manual. -\def\lines{% - \!ifnextchar[{\!lines}{\!lines[c]}} -\def\!lines[#1]#2{% - \let\!lglue=\hfill \let\!rglue=\hfill - \expandafter\let\csname !#1glue\endcsname=\relax - \vbox{\halign{\!lglue##\!rglue\cr #2\crcr}}% - \ignorespaces} - -% ** \Lines [POSITIONING] {LINES} -% ** Like \lines, but the baseline of the array is the baseline of the -% ** top line. See Subsection 2.3 of the manual. -\def\Lines{% - \!ifnextchar[{\!Lines}{\!Lines[c]}} -\def\!Lines[#1]#2{% - \let\!lglue=\hfill \let\!rglue=\hfill - \expandafter\let\csname !#1glue\endcsname=\relax - \vtop{\halign{\!lglue##\!rglue\cr #2\crcr}}% - \ignorespaces} - - -% ********************************************* -% *** PLOTTING (Things to do with plotting) *** -% ********************************************* - -% ** User commands -% ** \setplotsymbol ({PLOTSYMBOL} [ORIENTATION] ) -% ** \savelinesandcurves on "FILE_NAME" -% ** \dontsavelinesandcurves -% ** \writesavefile {MESSAGE} -% ** \replot {FILE_NAME} - -% ** Internal command -% ** \!plot(XDIMEN,YDIMEN) - -% ** \setplotsymbol ({PLOTSYMBOL} [ ] < , >) -% ** Save PLOTSYMBOL away in an hbox for use with curve plotting routines -% ** See Subsection 5.2 of the manual. -\def\setplotsymbol(#1#2){% - \!setputobject{#1}{#2} - \setbox\!plotsymbol=\box\!putobject% - \!plotsymbolxshift=\!xshift - \!plotsymbolyshift=\!yshift - \ignorespaces} - -\setplotsymbol({\fiverm .})% ** initialize plotsymbol - - -% ** \!plot is either \!!plot (when no lines and curves are being saved) or -% ** \!!!plot (when lines and curves are being saved) - -% ** \!!plot(XDIMEN,YDIMEN) -% ** Places the current plotsymbol a horizontal distance=XDIMEN-xorigin -% ** and a vertical distance=YDIMEN-yorigin from the current -% ** reference point. -\def\!!plot(#1,#2){% - \!dimenA=-\!plotxorigin \advance \!dimenA by #1% ** over - \!dimenB=-\!plotyorigin \advance \!dimenB by #2% ** up - \kern\!dimenA\raise\!dimenB\copy\!plotsymbol\kern-\!dimenA% - \ignorespaces} - -% ** \!!!plot(XDIMEN,YDIMEN) -% ** Like \!!plot, but also saves the plot location in units of -% ** scaled point, on file `replotfile' -\def\!!!plot(#1,#2){% - \!dimenA=-\!plotxorigin \advance \!dimenA by #1% ** over - \!dimenB=-\!plotyorigin \advance \!dimenB by #2% ** up - \kern\!dimenA\raise\!dimenB\copy\!plotsymbol\kern-\!dimenA% - \!countE=\!dimenA - \!countF=\!dimenB - \immediate\write\!replotfile{\the\!countE,\the\!countF.}% - \ignorespaces} - - -% ** \savelinesandcurves on "FILE_NAME" -% ** Switch to save locations used for plotting lines and curves -% ** (No advantage in saving locations for solid lines; however -% ** replotting curve locations speeds things up by a factor of about 4. -% ** \dontsavelinesandcurves -% ** Terminates \savelinesandcurves. The default. -% ** See Subsection 5.6 of the manual. -\def\savelinesandcurves on "#1" {% - \immediate\closeout\!replotfile - \immediate\openout\!replotfile=#1% - \let\!plot=\!!!plot} - -\def\dontsavelinesandcurves {% - \let\!plot=\!!plot} -\dontsavelinesandcurves - -% ** \writesavefile {MESSAGE} -% ** The message is preceded by a "%", so that it won't interfere -% ** with replotting. -% ** See Subsection 5.6 of the manual. -{\catcode`\%=11\xdef\!Commentsignal{%}} -\def\writesavefile#1 {% - \immediate\write\!replotfile{\!Commentsignal #1}% - \ignorespaces} - -% ** \replot "FILE_NAME" -% ** Replots the locations saved earlier under \savelinesandcurves -% ** on "FILE_NAME" -% ** See Subsection 5.6 of the manual. -\def\replot"#1" {% - \expandafter\!replot\normalinput #1 /} -\def\!replot#1,#2. {% - \!dimenA=#1sp - \kern\!dimenA\raise#2sp\copy\!plotsymbol\kern-\!dimenA - \futurelet\!nextchar\!!replot} -\def\!!replot{% - \if /\!nextchar - \def\!next{\!finish}% - \else - \def\!next{\!replot}% - \fi - \!next} -% ************************************************** -% *** PYTHAGORAS (Euclidean distance function) *** -% ************************************************** - -% ** User command: -% ** \placehypotenuse for and in - -% ** Internal command: -% ** \!Pythag{X}{Y}{Z} -% ** Input X,Y are dimensions, or dimension registers. -% ** Output Z == sqrt(X**2+Y**2) must be a dimension register. -% ** Assumes that |X|+|Y| < 2048pt (about 28in). - -% ** Without loss of generality, suppose x>0, y>0. Put s = x+y, -% ** z = sqrt(x**2+y**2). Then z = s*f, where f = sqrt(t**2 + (1-t)**2) -% ** = sqrt((1+tau**2)/2), where t = x/s and tau = 2(t-1/2) . - -% ** Uses the \!divide macro (which uses registers \!dimenA--\!dimenD. -% ** Uses the \!removept macro (e.g., 123.45pt --> 123.45) -% ** Uses registers \!dimenE--\!dimenI. -\def\!Pythag#1#2#3{% - \!dimenE=#1\relax - \ifdim\!dimenE<\!zpt - \!dimenE=-\!dimenE - \fi% ** dimE = |x| - \!dimenF=#2\relax - \ifdim\!dimenF<\!zpt - \!dimenF=-\!dimenF - \fi% ** dimF = |y| - \advance \!dimenF by \!dimenE% ** dimF = s = |x|+|y| - \ifdim\!dimenF=\!zpt - \!dimenG=\!zpt% ** dimG = z = sqrt(x**2+y**2) - \else - \!divide{8\!dimenE}\!dimenF\!dimenE% ** now dimE = 8t = (8|x|)/s - \advance\!dimenE by -4pt% ** 8tau = (8t-4)*2 - \!dimenE=2\!dimenE% ** (tau = 2*t - 1) - \!removept\!dimenE\!!t% ** 8tau, without "pt" - \!dimenE=\!!t\!dimenE% ** (8tau)**2, in pts - \advance\!dimenE by 64pt% ** u = [64 + (8tau)**2]/2 - \divide \!dimenE by 2% ** [u = (8f)**2] - \!dimenH=7pt% ** initial guess g at sqrt(u) - \!!Pythag\!!Pythag\!!Pythag% ** 3 iterations give sqrt(u) - \!removept\!dimenH\!!t% ** 8f=sqrt(u), without "pt" - \!dimenG=\!!t\!dimenF% ** z = (8f)*s/8 - \divide\!dimenG by 8 - \fi - #3=\!dimenG - \ignorespaces} - -\def\!!Pythag{% ** Newton-Raphson for sqrt - \!divide\!dimenE\!dimenH\!dimenI% ** v = u/g - \advance\!dimenH by \!dimenI% ** g <-- (g + u/g)/2 - \divide\!dimenH by 2} - -% ** \placehypotenuse for and in -% ** See Subsection 9.3 of the manual. -\def\placehypotenuse for <#1> and <#2> in <#3> {% - \!Pythag{#1}{#2}{#3}} - - -% ********************************************** -% *** QUADRATIC ARC (Draws a quadratic arc) *** -% ********************************************** - -% ** Internal command -% ** \!qjoin (XCOORD1,YCOORD1) (XCOORD2,YCOORD2) - -% ** \!qjoin (XCOORD1,YCOORD1) (XCOORD2,YCOORD2) -% ** Draws an arc starting at the (last) point specified by the most recent -% ** \!qjoin, or \!ljoin, or \!start and passing through (X_1,Y_1), (X_2,Y_2). -% ** Uses quadratic interpolation in both x and y: -% ** x(t), 0 <= t <= 1, interpolates x_0, x_1, x_2 at t=0, .5, 1 -% ** y(t), 0 <= t <= 1, interpolates y_0, y_1, y_2 at t=0, .5, 1 - -\def\!qjoin (#1,#2) (#3,#4){% - \advance\!intervalno by 1 - \!ifcoordmode - \edef\!xmidpt{#1}\edef\!ymidpt{#2}% - \else - \!dimenA=#1\relax \edef\!xmidpt{\the\!dimenA}% - \!dimenA=#2\relax \edef\!xmidpt{\the\!dimenA}% - \fi - \!xM=\!M{#1}\!xunit \!yM=\!M{#2}\!yunit \!rotateaboutpivot\!xM\!yM - \!xE=\!M{#3}\!xunit \!yE=\!M{#4}\!yunit \!rotateaboutpivot\!xE\!yE -% -% ** Find coefficients for x(t)=a_x + b_x*t + c_x*t**2 - \!dimenA=\!xM \advance \!dimenA by -\!xS% ** dimA = I = xM - xS - \!dimenB=\!xE \advance \!dimenB by -\!xM% ** dimB = II = xE-xM - \!xB=3\!dimenA \advance \!xB by -\!dimenB% ** b=3I-II - \!xC=2\!dimenB \advance \!xC by -2\!dimenA% ** c=2(II-I) -% -% ** Find coefficients for y(t)=y_x + b_y*t + c_y*t**2 - \!dimenA=\!yM \advance \!dimenA by -\!yS% - \!dimenB=\!yE \advance \!dimenB by -\!yM% - \!yB=3\!dimenA \advance \!yB by -\!dimenB% - \!yC=2\!dimenB \advance \!yC by -2\!dimenA% -% -% ** Use Simpson's rule to calculate arc length over [0,1/2]: -% ** arc length = 1/2[1/6 f(0) + 4/6 f(1/4) + 1/6 f(1/2)] -% ** with f(t) = sqrt(x'(t)**2 + y'(t)**2). - \!xprime=\!xB \!yprime=\!yB% ** x'(t) = b + 2ct - \!dxprime=.5\!xC \!dyprime=.5\!yC% ** dt=1/4 ==> dx'(t) = c/2 - \!getf \!midarclength=\!dimenA - \!getf \advance \!midarclength by 4\!dimenA - \!getf \advance \!midarclength by \!dimenA - \divide \!midarclength by 12 -% -% ** Get arc length over [0,1]. - \!arclength=\!dimenA - \!getf \advance \!arclength by 4\!dimenA - \!getf \advance \!arclength by \!dimenA - \divide \!arclength by 12% ** Now have arc length over [1/2,1] - \advance \!arclength by \!midarclength - \global\advance \totalarclength by \!arclength -% -% -% ** Check to see if there's anything to plot in this interval - \ifdim\!distacross>\!arclength - \advance \!distacross by -\!arclength% ** nothing -% - \else - \!initinverseinterp% ** initialize for inverse interpolation on arc length - \loop\ifdim\!distacross<\!arclength% ** loop over points on arc - \!inverseinterp% ** find t such that arc length[0,t] = distacross, -% ** using inverse quadratic interpolation -% ** now evaluate x(t)=(c*t + b)*t + a - \!xpos=\!t\!xC \advance\!xpos by \!xB - \!xpos=\!t\!xpos \advance \!xpos by \!xS -% ** evaluate y(t) - \!ypos=\!t\!yC \advance\!ypos by \!yB - \!ypos=\!t\!ypos \advance \!ypos by \!yS - \!plotifinbounds% ** plot point if in bounds - \advance\!distacross \plotsymbolspacing%** advance arc length for next pt - \!advancedashing% ** see "linear" - \repeat -% - \advance \!distacross by -\!arclength% ** prepare for next interval - \fi -% - \!xS=\!xE% ** shift ending points to starting points - \!yS=\!yE - \ignorespaces} - - -% ** \!getf -- Calculates sqrt(x'(t)**2 + y'(t)**2) and advances -% ** x'(t) and y'(t) -\def\!getf{\!Pythag\!xprime\!yprime\!dimenA% - \advance\!xprime by \!dxprime - \advance\!yprime by \!dyprime} - - -% ** \!initinverseinterp -- initializes for inverse quadratic interpolation -% ** of arc length provided 1/3 < midarclength/arclength < 2/3; otherwise -% ** initializes for inverse linear interpolation. -\def\!initinverseinterp{% - \ifdim\!arclength>\!zpt - \!divide{8\!midarclength}\!arclength\!dimenE% ** dimE=8w=8r/s, where r -% ** = midarclength, s=arclength -% ** Test for w out of range: w<1/3 or w>2/3 - \ifdim\!dimenE<\!wmin \!setinverselinear - \else - \ifdim\!dimenE>\!wmax \!setinverselinear - \else% ** w in range: initialize - \def\!inverseinterp{\!inversequad}\ignorespaces -% -% ** Calculate the coefficients \!beta and \!gamma of the quadratic -% ** t = \!beta*v + \!gamma*v**2 -% ** taking the values t=0, 1/2, 1 at v=0, w==r/s, 1 respectively: -% ** \!beta = (1/2 - w**2)/[w(1-w)] -% ** \!gamma = 1 - beta. -% - \!removept\!dimenE\!Ew% ** 8w, without "pt" - \!dimenF=-\!Ew\!dimenE% ** -(8w)**2 - \advance\!dimenF by 32pt% ** 32 - (8w)**2 - \!dimenG=8pt - \advance\!dimenG by -\!dimenE% ** 8 - 8w - \!dimenG=\!Ew\!dimenG% ** (8w)*(8-8w) - \!divide\!dimenF\!dimenG\!beta% ** beta = (32-(8w)**2)/(8w(8-8w)) -% ** = (1/2 - w**2)/(w(1-w)) - \!gamma=1pt - \advance \!gamma by -\!beta% ** gamma = 1-beta - \fi% ** end of the \ifdim\!dimenE>\!wmax - \fi% ** end of the \ifdim\!dimenE<\!wmin - \fi% ** end of the \ifdim\!arclength>\!zpt - \ignorespaces} - - -% ** For 0 <= t <= 1, let AL(t) = arclength[0,t]/arclength[0,1]; note -% ** AL(0)=0, AL(1/2)=midarclength/arclength, AL(1)=1. This routine -% ** calculates an approximation to AL^{-1}(distance across/arclength), -% ** using the assumption that AL^{-1} is quadratic. Specifically, -% ** it finds t such that -% ** AL^{-1}(v) =. t = v*(\!beta + \!gamma*v) -% ** where \!beta and \!gamma are set by \!initinv, and where -% ** v=distance across/arclength -\def\!inversequad{% - \!divide\!distacross\!arclength\!dimenG% ** dimG = v = distacross/arclength - \!removept\!dimenG\!v% ** v, without "pt" - \!dimenG=\!v\!gamma% ** gamma*v - \advance\!dimenG by \!beta% ** beta + gamma*v - \!dimenG=\!v\!dimenG% ** t = v*(beta + gamma*v) - \!removept\!dimenG\!t}% ** t, without "pt" - - -% ** When w <= 1/3 or w >= 2/3, the following routine writes (using -% ** plain TEK's \wlog command) a warning message on the user's log file, -% ** and initializes for inverse linear interpolation on arc length. -\def\!setinverselinear{% - \def\!inverseinterp{\!inverselinear}% - \divide\!dimenE by 8 \!removept\!dimenE\!t - \!countC=\!intervalno \multiply \!countC 2 - \!countB=\!countC \advance \!countB -1 - \!countA=\!countB \advance \!countA -1 - \wlog{\the\!countB th point (\!xmidpt,\!ymidpt) being plotted - doesn't lie in the}% - \wlog{ middle third of the arc between the \the\!countA th - and \the\!countC th points:}% - \wlog{ [arc length \the\!countA\space to \the\!countB]/[arc length - \the \!countA\space to \the\!countC]=\!t.}% - \ignorespaces} - -% ** Inverse linear interpolation -\def\!inverselinear{% - \!divide\!distacross\!arclength\!dimenG - \!removept\!dimenG\!t} - - -% ************************************** -% ** ROTATIONS (Handles rotations) *** -% ************************************** - -% ** User commands -% ** \startrotation [by COS_OF_ANGLE SIN_OF_ANGLE] [about XPIVOT YPIVOT] -% ** \stoprotation - -% ** \startrotation [by COS_OF_ANGLE SIN_OF_ANGLE] [about XPIVOT YPIVOT] -% ** Future (XCOORD,YCOORD)'s will be rotated about (XPIVOT,YPIVOT) -% ** by the angle with the give COS and SIN. Both fields are optional. -% ** [COS,SIN] defaults to previous value, or (1,0). -% ** (XPIVOT,YPIVOT) defaults to previous value, or (0,0) -% ** You can't change the coordinate system in the scope of a rotation. -% ** See Subsection 9.1 of the manual. -\def\startrotation{% - \let\!rotateaboutpivot=\!!rotateaboutpivot - \let\!rotateonly=\!!rotateonly - \!ifnextchar{b}{\!getsincos }% - {\!getsincos by {\!cosrotationangle} {\!sinrotationangle} }} -\def\!getsincos by #1 #2 {% - \edef\!cosrotationangle{#1}% - \edef\!sinrotationangle{#2}% - \!ifcoordmode - \let\!ROnext=\!ccheckforpivot - \else - \let\!ROnext=\!dcheckforpivot - \fi - \!ROnext} -\def\!ccheckforpivot{% - \!ifnextchar{a}{\!cgetpivot}% - {\!cgetpivot about {\!xpivotcoord} {\!ypivotcoord} }} -\def\!cgetpivot about #1 #2 {% - \edef\!xpivotcoord{#1}% - \edef\!ypivotcoord{#2}% - \!xpivot=#1\!xunit \!ypivot=#2\!yunit - \ignorespaces} -\def\!dcheckforpivot{% - \!ifnextchar{a}{\!dgetpivot}{\ignorespaces}} -\def\!dgetpivot about #1 #2 {% - \!xpivot=#1\relax \!ypivot=#2\relax - \ignorespaces} - - -% ** Following terminates rotation. -% ** See Subsection 9.1 of the manual. -\def\stoprotation{% - \let\!rotateaboutpivot=\!!!rotateaboutpivot - \let\!rotateonly=\!!!rotateonly - \ignorespaces} - -% ** !!rotateaboutpivot{XREG}{YREG} -% ** XREG <-- xpvt + cos(angle)*(XREG-xpvt) - sin(angle)*(YREG-ypvt) -% ** YREG <-- ypvt + cos(angle)*(YREG-ypvt) + sin(angle)*(XREG-xpvt) -% ** XREG,YREG are dimension registers. Can't be \!dimenA to \!dimenD -\def\!!rotateaboutpivot#1#2{% - \!dimenA=#1\relax \advance\!dimenA -\!xpivot - \!dimenB=#2\relax \advance\!dimenB -\!ypivot - \!dimenC=\!cosrotationangle\!dimenA - \advance \!dimenC -\!sinrotationangle\!dimenB - \!dimenD=\!cosrotationangle\!dimenB - \advance \!dimenD \!sinrotationangle\!dimenA - \advance\!dimenC \!xpivot \advance\!dimenD \!ypivot - #1=\!dimenC #2=\!dimenD - \ignorespaces} - -% ** \!!rotateonly{XREG}{YREG} -% ** Like \!!rotateaboutpivot, but with a pivot of (0,0) -\def\!!rotateonly#1#2{% - \!dimenA=#1\relax \!dimenB=#2\relax - \!dimenC=\!cosrotationangle\!dimenA - \advance \!dimenC -\!rotsign\!sinrotationangle\!dimenB - \!dimenD=\!cosrotationangle\!dimenB - \advance \!dimenD \!rotsign\!sinrotationangle\!dimenA - #1=\!dimenC #2=\!dimenD - \ignorespaces} -\def\!rotsign{} -\def\!!!rotateaboutpivot#1#2{\relax} -\def\!!!rotateonly#1#2{\relax} -\stoprotation - -\def\!reverserotateonly#1#2{% - \def\!rotsign{-}% - \!rotateonly{#1}{#2}% - \def\!rotsign{}% - \ignorespaces} - - -% ********************************** -% *** SHADING (Handles shading) *** -% ********************************** - -% ** User commands -% ** \setshadegrid [span ] [point at XSHADE YSHADE] -% ** \setshadesymbol [] ({SHADESYMBOL} -% ** [ORIENTATION]) - -% ** Internal commands: -% ** \!startvshade (xS,ybS,ytS) -% ** \!starthshade (yS,xlS,xrS) -% ** \!lshade [] -% ** ** when shading vertically: -% ** [the region from (xS,ybS,ytS) to] (xE,ybE,ytE) -% ** ** when shading horizontally: -% ** [the region from (yS,xlS,xrS) to] (yE,xlE,xrE) -% ** \!qshade [] -% ** ** when shading vertically: -% ** [the region from (xS,ybS,ytS) to] (xM,ybM,ytM) (xE,ybE,ytE) -% ** ** when shading horizontally: -% ** [the region from (yS,xlS,xrS) to] (yM,xlM,xrM) (yE,xlE,xrE) -% ** \!lattice{ANCHOR}{SPAN}{LOCATION}{INDEX}{LATTICE LOCATION} -% ** \!override{NOMINAL DIMEN}{REPLACEMENT DIMEN}{DIMEN} - - -% ** The shading routine can operate either in a "vertical mode" or a -% ** "horizontal mode". In vertical mode, the region to be shaded is specified -% ** in the form -% ** {(x,y): xl <= x <= xr & yb(x) <= y <= yt(x)} -% ** where yb and yt are functions of x. In horizontal mode, the region -% ** is specified in the form -% ** {(x,y): yb <= y <= yt & xl(y) <= x <= xr(y)}. -% ** The functions yb and yt may be either both linear or both quadratic; -% ** similarly for xl and xr. A region with say, piecewise quadratic bottom -% ** and top boundaries, can be shaded by consecutive (vertical) \!qshades, -% ** proceeding from left to right. Similarly, a region with piecewise -% ** quadratic left and right boundaries can be shaded by consecutive -% ** (horizontal) \!qshades, proceeding from bottom to top. More complex -% ** regions can be shaded by partitioning them into appropriate subregions, -% ** and shading those. - -% ** Shading is accomplished by placing a user-selected shading symbol at -% ** those points of a regular grid which fall within the region to be -% ** shaded. This region can be "shrunk" so that a largish shading symbol -% ** will not extend outside it. Shrinking is accomplished by specifying -% ** shrinkages for the left, right, bottom, and top boundaries, in a manner -% ** discussed further below. - -% ** \shades and \!joins MUST NOT be intermingled. Finish drawing a curve -% ** before starting to shade a region, and finish shading a region before -% ** starting to draw a curve. - - -% ** \setshadegrid [span ] [point at XSHADE YSHADE] -% ** The shading symbol is placed down on the points of a grid centered -% ** at the coordinate point (XSHADE,YSHADE). The grid points are of the -% ** form (j*SPAN,k*SPAN), with j+k even. SPAN is specified -% ** as a dimension. -% ** (XSHADE,YSHADE) defaults to previous (XSHADE,YSHADE) (or (0,0) if none) -% ** SPAN defaults to previous span (or 5pt if none) -% ** See Subsection 7.2 of the manual. -\def\setshadegrid{% - \!ifnextchar{s}{\!getspan } - {\!getspan span <\!dshade>}} -\def\!getspan span <#1>{% - \!dshade=#1\relax - \!ifcoordmode - \let\!GRnext=\!GRccheckforAP - \else - \let\!GRnext=\!GRdcheckforAP - \fi - \!GRnext} -\def\!GRccheckforAP{% - \!ifnextchar{p}{\!cgetanchor } - {\!cgetanchor point at {\!xshadesave} {\!yshadesave} }} -\def\!cgetanchor point at #1 #2 {% - \edef\!xshadesave{#1}\edef\!yshadesave{#2}% - \!xshade=\!xshadesave\!xunit \!yshade=\!yshadesave\!yunit - \ignorespaces} -\def\!GRdcheckforAP{% - \!ifnextchar{p}{\!dgetanchor}% - {\ignorespaces}} -\def\!dgetanchor point at #1 #2 {% - \!xshade=#1\relax \!yshade=#2\relax - \ignorespaces} - -% ** \setshadesymbol [] ({SHADESYMBOL} -% ** [ORIENTATION]) -% ** Saves SHADESYMBOL away in an hbox for use with shading routines. -% ** A shade symbol will not be plotted if its plot position comes within -% ** distance LS of the left boundary, RS of the right boundary, TS of the -% ** top boundary, BS of the bottom boundary. These parameters have -% ** default values that should work in most cases (see below). -% ** To override a default value, specify the replacement value -% ** in the appropriate subfield of the shrinkages field. -% ** 0pt may be coded as "z" (without the quotes). To accept a -% ** default value, leave the field empty. Thus -% ** [,z,,5pt] sets LS=default, RS=0pt, BS=default, TS=5pt . -% ** Skipping the shrinkages field accepts all the defaults. -% ** See Subsection 7.1 of the manual. -\def\setshadesymbol{% - \!ifnextchar<{\!setshadesymbol}{\!setshadesymbol<,,,> }} - -\def\!setshadesymbol <#1,#2,#3,#4> (#5#6){% -% ** set the shadesymbol - \!setputobject{#5}{#6}% - \setbox\!shadesymbol=\box\!putobject% - \!shadesymbolxshift=\!xshift \!shadesymbolyshift=\!yshift -% -% ** set the shrinkages - \!dimenA=\!xshift \advance\!dimenA \!smidge% ** default LS = xshift - smidge - \!override\!dimenA{#1}\!lshrinkage% - \!dimenA=\!wd \advance \!dimenA -\!xshift% ** default RS = width - xshift - \advance\!dimenA \!smidge% - smidge - \!override\!dimenA{#2}\!rshrinkage - \!dimenA=\!dp \advance \!dimenA \!yshift% ** default BS = depth + yshift - \advance\!dimenA \!smidge% - smidge - \!override\!dimenA{#3}\!bshrinkage - \!dimenA=\!ht \advance \!dimenA -\!yshift% ** default TS = height - yshift - \advance\!dimenA \!smidge% - smidge - \!override\!dimenA{#4}\!tshrinkage - \ignorespaces} -\def\!smidge{-.2pt}% - -% ** \!override{NOMINAL DIMEN}{REPLACEMENT DIMEN}{DIMEN} -% ** Overrides the NOMINAL DIMEN by the REPLACEMENT DIMEN to produce DIMEN, -% ** according to the following rules: -% ** REPLACEMENT DIMEN empty: DIMEN <-- NOMINAL DIMEN -% ** REPLACEMENT DIMEN z: DIMEN <-- 0pt -% ** otherwise: DIMEN <-- REPLACEMENT DIMEN -% ** DIMEN must be a dimension register -\def\!override#1#2#3{% - \edef\!!override{#2}% - \ifx \!!override\empty - #3=#1\relax - \else - \if z\!!override - #3=\!zpt - \else - \ifx \!!override\!blankz - #3=\!zpt - \else - #3=#2\relax - \fi - \fi - \fi - \ignorespaces} -\def\!blankz{ z} - -\setshadesymbol ({\fiverm .})% ** initialize plotsymbol -% ** \fivesy ^^B is a small cross - - -% ** \!startvshade [at] (xS,ybS,ytS) -% ** Initiates vertical shading mode -\def\!startvshade#1(#2,#3,#4){% - \let\!!xunit=\!xunit% - \let\!!yunit=\!yunit% - \let\!!xshade=\!xshade% - \let\!!yshade=\!yshade% - \def\!getshrinkages{\!vgetshrinkages}% - \let\!setshadelocation=\!vsetshadelocation% - \!xS=\!M{#2}\!!xunit - \!ybS=\!M{#3}\!!yunit - \!ytS=\!M{#4}\!!yunit - \!shadexorigin=\!xorigin \advance \!shadexorigin \!shadesymbolxshift - \!shadeyorigin=\!yorigin \advance \!shadeyorigin \!shadesymbolyshift - \ignorespaces} - -% ** \!starthshade [at] (yS,xlS,xrS) -% ** Initiates horizontal shading mode -\def\!starthshade#1(#2,#3,#4){% - \let\!!xunit=\!yunit% - \let\!!yunit=\!xunit% - \let\!!xshade=\!yshade% - \let\!!yshade=\!xshade% - \def\!getshrinkages{\!hgetshrinkages}% - \let\!setshadelocation=\!hsetshadelocation% - \!xS=\!M{#2}\!!xunit - \!ybS=\!M{#3}\!!yunit - \!ytS=\!M{#4}\!!yunit - \!shadexorigin=\!xorigin \advance \!shadexorigin \!shadesymbolxshift - \!shadeyorigin=\!yorigin \advance \!shadeyorigin \!shadesymbolyshift - \ignorespaces} - - -% ** \!lattice{ANCHOR}{SPAN}{LOCATION}{INDEX}{LATTICE LOCATION} -% ** Consider the lattice with points ANCHOR + j*SPAN. This routine determines -% ** the index k of the smallest lattice point >= LOCATION, and sets -% ** LATTICE LOCATION = ANCHOR + k*SPAN. -% ** INDEX is assumed to be a count register, LATTICE LOCATION a dimen reg. -\def\!lattice#1#2#3#4#5{% - \!dimenA=#1% ** dimA = ANCHOR - \!dimenB=#2% ** dimB = SPAN (assumed > 0pt) - \!countB=\!dimenB% ** ctB = SPAN, as a count -% -% ** Determine index of smallest lattice point >= LOCATION - \!dimenC=#3% ** dimC = LOCATION - \advance\!dimenC -\!dimenA% ** now dimC = LOCATION-ANCHOR - \!countA=\!dimenC% ** ctA = above, as a count - \divide\!countA \!countB% ** now ctA = desired index, if dimC <= 0 - \ifdim\!dimenC>\!zpt - \!dimenD=\!countA\!dimenB% ** (tentative k)*span - \ifdim\!dimenD<\!dimenC% ** if this is false, ctA = desired index - \advance\!countA 1 % ** if true, have to add 1 - \fi - \fi -% - \!dimenC=\!countA\!dimenB% ** lattice location = anchor + ctA*span - \advance\!dimenC \!dimenA - #4=\!countA% ** the desired index - #5=\!dimenC% ** corresponding lattice location - \ignorespaces} - - -% ** \!qshade [with shrinkages] [[LS,RS,BS,TS]] -% ***** during vertical shading: -% ** [the region from (xS,ybS,ytS) to] (xM,ybM,ytM) [and] (xE,ybE,ytE) -% ** Shades the region {(x,y): xS <= x <= xE, yb(x) <= y <= yt(x)}, where -% ** yb is the quadratic thru (xS,ybS) & (xM,ybM) & (xE,ybE) -% ** yt is the quadratic thru (xS,ytS) & (xM,ybM) & (xE,ytE) -% ** xS,ybS,ytS are either given by \!startvshade or carried over -% ** as the ending values of the immediately preceding \!qshade. -% ** For the interpretation of LS, RS, BS, & TS, see \setshadesymbol. The -% ** values set there can be overridden, for the course of this \!qshade -% ** only, in the same manner as overrides are specified for -% ** \setshadesymbol. -% ***** during horizontal shading: -% ** [the region from (yS,xlS,xrS) to] (yM,xlM,xrM) [and] (yE,xlE,xrE) -\def\!qshade#1(#2,#3,#4)#5(#6,#7,#8){% - \!xM=\!M{#2}\!!xunit - \!ybM=\!M{#3}\!!yunit - \!ytM=\!M{#4}\!!yunit - \!xE=\!M{#6}\!!xunit - \!ybE=\!M{#7}\!!yunit - \!ytE=\!M{#8}\!!yunit - \!getcoeffs\!xS\!ybS\!xM\!ybM\!xE\!ybE\!ybB\!ybC%**Get coefficients B & C for - \!getcoeffs\!xS\!ytS\!xM\!ytM\!xE\!ytE\!ytB\!ytC%**y=y0 + B(x-X0) + C(x-X0)**2 - \def\!getylimits{\!qgetylimits}% - \!shade{#1}\ignorespaces} - -% ** \!lshade ... (xE,ybE,ytE) -% ** This is like \!qshade, but the top and bottom boundaries are linear, -% ** rather than quadratic. -\def\!lshade#1(#2,#3,#4){% - \!xE=\!M{#2}\!!xunit - \!ybE=\!M{#3}\!!yunit - \!ytE=\!M{#4}\!!yunit - \!dimenE=\!xE \advance \!dimenE -\!xS% ** xE-xS - \!dimenC=\!ytE \advance \!dimenC -\!ytS% ** ytE-ytS - \!divide\!dimenC\!dimenE\!ytB% ** ytB = (ytE-ytS)/(xE-xS) - \!dimenC=\!ybE \advance \!dimenC -\!ybS% ** ybE-ybS - \!divide\!dimenC\!dimenE\!ybB% ** ybB = (ybE-ybS)/(xE-xS) - \def\!getylimits{\!lgetylimits}% - \!shade{#1}\ignorespaces} - -% ** \!getcoeffs{X0}{Y0}{X1}{Y1}{X2}{Y2}{B}{C} -% ** Finds B and C such that the quadratic y = Y0 + B(x-X0) + C(x-X0)**2 -% ** passes through (X1,Y1) and (X2,Y2): when X0=0=Y0, the formulas are: -% ** B = S1 - X1*C, C = (S2-S1)/X2 -% ** with -% ** S1 = Y1/X1, S2 = (Y2-Y1)/(X2-X1). -\def\!getcoeffs#1#2#3#4#5#6#7#8{% - \!dimenC=#4\advance \!dimenC -#2% ** dimC=Y1-Y0 - \!dimenE=#3\advance \!dimenE -#1% ** dimE=X1-X0 - \!divide\!dimenC\!dimenE\!dimenF% ** dimF=S1 - \!dimenC=#6\advance \!dimenC -#4% ** dimC=Y2-Y1 - \!dimenH=#5\advance \!dimenH -#3% ** dimH=X2-X1 - \!divide\!dimenC\!dimenH\!dimenG% ** dimG=S2 - \advance\!dimenG -\!dimenF% ** dimG=S2-S1 - \advance \!dimenH \!dimenE% ** dimH=X2-X0 - \!divide\!dimenG\!dimenH#8% ** C=(S2-S1)/(X2-X0) - \!removept#8\!t% ** C, without "pt" - #7=-\!t\!dimenE% ** -C*(X1-X0) - \advance #7\!dimenF% ** B=S1-C*(X1-X0) - \ignorespaces} - - -\def\!shade#1{% -% ** Get LS,RS,BS,TS for this panel - \!getshrinkages#1<,,,>\!nil% % ** now effective LS=dimE, RS=dimF, -% ** BS=dimG, TS=dimH - \advance \!dimenE \!xS% ** now dimE=xS+LS - \!lattice\!!xshade\!dshade\!dimenE% ** set parity=index of left-mst x-lattice - \!parity\!xpos% ** point >= xS+LS, xpos=its location - \!dimenF=-\!dimenF% ** set dimF=xE-RS - \advance\!dimenF \!xE -% - \!loop\!not{\ifdim\!xpos>\!dimenF}% ** loop over x-lattice points <= xE-RS - \!shadecolumn% - \advance\!xpos \!dshade% ** move over to next column - \advance\!parity 1% ** increase index of x-point - \repeat -% - \!xS=\!xE% ** shift ending values to starting values - \!ybS=\!ybE - \!ytS=\!ytE - \ignorespaces} - - -\def\!vgetshrinkages#1<#2,#3,#4,#5>#6\!nil{% - \!override\!lshrinkage{#2}\!dimenE - \!override\!rshrinkage{#3}\!dimenF - \!override\!bshrinkage{#4}\!dimenG - \!override\!tshrinkage{#5}\!dimenH - \ignorespaces} -\def\!hgetshrinkages#1<#2,#3,#4,#5>#6\!nil{% - \!override\!lshrinkage{#2}\!dimenG - \!override\!rshrinkage{#3}\!dimenH - \!override\!bshrinkage{#4}\!dimenE - \!override\!tshrinkage{#5}\!dimenF - \ignorespaces} - - -\def\!shadecolumn{% - \!dxpos=\!xpos - \advance\!dxpos -\!xS% ** dx = x - xS - \!removept\!dxpos\!dx% ** ditto, without "pt" - \!getylimits% ** get top and bottom y-values - \advance\!ytpos -\!dimenH% ** less TS - \advance\!ybpos \!dimenG% ** plus BS - \!yloc=\!!yshade% ** get anchor point for this column - \ifodd\!parity - \advance\!yloc \!dshade - \fi - \!lattice\!yloc{2\!dshade}\!ybpos% - \!countA\!ypos% ** ypos=smallest y point for this column - \!dimenA=-\!shadexorigin \advance \!dimenA \!xpos% ** over - \loop\!not{\ifdim\!ypos>\!ytpos}% ** loop over ypos <= yt(t) - \!setshadelocation% ** vmode: xloc=xpos, yloc=ypos -% ** hmode: xloc=ypos, yloc=xpos - \!rotateaboutpivot\!xloc\!yloc% - \!dimenA=-\!shadexorigin \advance \!dimenA \!xloc% ** over - \!dimenB=-\!shadeyorigin \advance \!dimenB \!yloc% ** up - \kern\!dimenA \raise\!dimenB\copy\!shadesymbol \kern-\!dimenA - \advance\!ypos 2\!dshade - \repeat - \ignorespaces} - -\def\!qgetylimits{% - \!dimenA=\!dx\!ytC - \advance\!dimenA \!ytB% ** yt(t)=ytS + dx*(Bt + dx*Ct) - \!ytpos=\!dx\!dimenA - \advance\!ytpos \!ytS - \!dimenA=\!dx\!ybC - \advance\!dimenA \!ybB% ** yb(t)=ybS + dx*(Bb + dx*Cb) - \!ybpos=\!dx\!dimenA - \advance\!ybpos \!ybS} - -\def\!lgetylimits{% - \!ytpos=\!dx\!ytB% ** yt(t)=ytS + dx*Bt - \advance\!ytpos \!ytS - \!ybpos=\!dx\!ybB% ** yb(t)=ybS + dx*Bb - \advance\!ybpos \!ybS} - -\def\!vsetshadelocation{% ** vmode: xloc=xpos, yloc=ypos - \!xloc=\!xpos - \!yloc=\!ypos} -\def\!hsetshadelocation{% ** hmode: xloc=ypos, yloc=xpos - \!xloc=\!ypos - \!yloc=\!xpos} - - -% ************************************** -% *** TICKS (Draws ticks on graphs) *** -% ************************************** - -% ** User commands -% ** \ticksout -% ** \ticksin -% ** \gridlines -% ** \nogridlines -% ** \loggedticks -% ** \unloggesticks -% ** See Subsection 3.4 of the manual - -% ** The following is an option of the \axis command -% ** ticks -% ** [in] [out] -% ** [long] [short] [length ] -% ** [width ] -% ** [andacross] [butnotacross] -% ** [logged] [unlogged] -% ** [unlabeled] [numbered] [withvalues VALUE1 VALUE2 ... VALUEk / ] -% ** [quantity Q] [at LOC1 LOC2 ... LOCk / ] [from LOC1 to LOC2 by -% ** LOC_INCREMENT] -% ** See Subsection 3.2 of the manual for the rules. - -% ** The various options of the tick field are processed by the -% ** \!nextkeyword command defined below. -% ** For example, `\!nextkeyword short ' expands to `\!ticksshort', -% ** while `\!nextkeyword withvalues' expands to `\!tickswithvalues'. - -\def\!axisticks {% - \def\!nextkeyword##1 {% - \expandafter\ifx\csname !ticks##1\endcsname \relax - \def\!next{\!fixkeyword{##1}}% - \else - \def\!next{\csname !ticks##1\endcsname}% - \fi - \!next}% - \!axissetup - \def\!axissetup{\relax}% - \edef\!ticksinoutsign{\!ticksinoutSign}% - \!ticklength=\longticklength - \!tickwidth=\linethickness - \!gridlinestatus - \!setticktransform - \!maketick - \!tickcase=0 - \def\!LTlist{}% - \!nextkeyword} - -\def\ticksout{% - \def\!ticksinoutSign{+}} -\def\ticksin{% - \def\!ticksinoutSign{-}} -\ticksout - -\def\gridlines{% - \def\!gridlinestatus{\!gridlinestootrue}} -\def\nogridlines{% - \def\!gridlinestatus{\!gridlinestoofalse}} -\nogridlines - -\def\loggedticks{% - \def\!setticktransform{\let\!ticktransform=\!logten}} -\def\unloggedticks{% - \def\!setticktransform{\let\!ticktransform=\!donothing}} -\def\!donothing#1#2{\def#2{#1}} -\unloggedticks - -% ** \!ticks/ : terminates read of tick options -\expandafter\def\csname !ticks/\endcsname{% - \!not {\ifx \!LTlist\empty} - \!placetickvalues - \fi - \def\!tickvalueslist{}% - \def\!LTlist{}% - \expandafter\csname !axis/\endcsname} - -\def\!maketick{% - \setbox\!boxA=\hbox{% - \beginpicture - \!setdimenmode - \setcoordinatesystem point at {\!zpt} {\!zpt} - \linethickness=\!tickwidth - \ifdim\!ticklength>\!zpt - \putrule from {\!zpt} {\!zpt} to - {\!ticksinoutsign\!tickxsign\!ticklength} - {\!ticksinoutsign\!tickysign\!ticklength} - \fi - \if!gridlinestoo - \putrule from {\!zpt} {\!zpt} to - {-\!tickxsign\!xaxislength} {-\!tickysign\!yaxislength} - \fi - \endpicturesave <\!Xsave,\!Ysave>}% - \wd\!boxA=\!zpt} - -\def\!ticksin{% - \def\!ticksinoutsign{-}% - \!maketick - \!nextkeyword} - -\def\!ticksout{% - \def\!ticksinoutsign{+}% - \!maketick - \!nextkeyword} - -\def\!tickslength<#1> {% - \!ticklength=#1\relax - \!maketick - \!nextkeyword} - -\def\!tickslong{% - \!tickslength<\longticklength> } - -\def\!ticksshort{% - \!tickslength<\shortticklength> } - -\def\!tickswidth<#1> {% - \!tickwidth=#1\relax - \!maketick - \!nextkeyword} - -\def\!ticksandacross{% - \!gridlinestootrue - \!maketick - \!nextkeyword} - -\def\!ticksbutnotacross{% - \!gridlinestoofalse - \!maketick - \!nextkeyword} - -\def\!tickslogged{% - \let\!ticktransform=\!logten - \!nextkeyword} - -\def\!ticksunlogged{% - \let\!ticktransform=\!donothing - \!nextkeyword} - -\def\!ticksunlabeled{% - \!tickcase=0 - \!nextkeyword} - -\def\!ticksnumbered{% - \!tickcase=1 - \!nextkeyword} - -\def\!tickswithvalues#1/ {% - \edef\!tickvalueslist{#1! /}% - \!tickcase=2 - \!nextkeyword} - -\def\!ticksquantity#1 {% - \ifnum #1>1 - \!updatetickoffset - \!countA=#1\relax - \advance \!countA -1 - \!ticklocationincr=\!axisLength - \divide \!ticklocationincr \!countA - \!ticklocation=\!axisstart - \loop \!not{\ifdim \!ticklocation>\!axisend} - \!placetick\!ticklocation - \ifcase\!tickcase - \relax % Case 0: no labels - \or - \relax % Case 1: numbered -- not available here - \or - \expandafter\!gettickvaluefrom\!tickvalueslist - \edef\!tickfield{{\the\!ticklocation}{\!value}}% - \expandafter\!listaddon\expandafter{\!tickfield}\!LTlist% - \fi - \advance \!ticklocation \!ticklocationincr - \repeat - \fi - \!nextkeyword} - -\def\!ticksat#1 {% - \!updatetickoffset - \edef\!Loc{#1}% - \if /\!Loc - \def\next{\!nextkeyword}% - \else - \!ticksincommon - \def\next{\!ticksat}% - \fi - \next} - -\def\!ticksfrom#1 to #2 by #3 {% - \!updatetickoffset - \edef\!arg{#3}% - \expandafter\!separate\!arg\!nil - \!scalefactor=1 - \expandafter\!countfigures\!arg/ - \edef\!arg{#1}% - \!scaleup\!arg by\!scalefactor to\!countE - \edef\!arg{#2}% - \!scaleup\!arg by\!scalefactor to\!countF - \edef\!arg{#3}% - \!scaleup\!arg by\!scalefactor to\!countG - \loop \!not{\ifnum\!countE>\!countF} - \ifnum\!scalefactor=1 - \edef\!Loc{\the\!countE}% - \else - \!scaledown\!countE by\!scalefactor to\!Loc - \fi - \!ticksincommon - \advance \!countE \!countG - \repeat - \!nextkeyword} - -\def\!updatetickoffset{% - \!dimenA=\!ticksinoutsign\!ticklength - \ifdim \!dimenA>\!offset - \!offset=\!dimenA - \fi} - -\def\!placetick#1{% - \if!xswitch - \!xpos=#1\relax - \!ypos=\!axisylevel - \else - \!xpos=\!axisxlevel - \!ypos=#1\relax - \fi - \advance\!xpos \!Xsave - \advance\!ypos \!Ysave - \kern\!xpos\raise\!ypos\copy\!boxA\kern-\!xpos - \ignorespaces} - -\def\!gettickvaluefrom#1 #2 /{% - \edef\!value{#1}% - \edef\!tickvalueslist{#2 /}% - \ifx \!tickvalueslist\!endtickvaluelist - \!tickcase=0 - \fi} -\def\!endtickvaluelist{! /} - -\def\!ticksincommon{% - \!ticktransform\!Loc\!t - \!ticklocation=\!t\!!unit - \advance\!ticklocation -\!!origin - \!placetick\!ticklocation - \ifcase\!tickcase - \relax % Case 0: no labels - \or % Case 1: numbered - \ifdim\!ticklocation<-\!!origin - \edef\!Loc{$\!Loc$}% - \fi - \edef\!tickfield{{\the\!ticklocation}{\!Loc}}% - \expandafter\!listaddon\expandafter{\!tickfield}\!LTlist% - \or % Case 2: labeled - \expandafter\!gettickvaluefrom\!tickvalueslist - \edef\!tickfield{{\the\!ticklocation}{\!value}}% - \expandafter\!listaddon\expandafter{\!tickfield}\!LTlist% - \fi} - -\def\!separate#1\!nil{% - \!ifnextchar{-}{\!!separate}{\!!!separate}#1\!nil} -\def\!!separate-#1\!nil{% - \def\!sign{-}% - \!!!!separate#1..\!nil} -\def\!!!separate#1\!nil{% - \def\!sign{+}% - \!!!!separate#1..\!nil} -\def\!!!!separate#1.#2.#3\!nil{% - \def\!arg{#1}% - \ifx\!arg\!empty - \!countA=0 - \else - \!countA=\!arg - \fi - \def\!arg{#2}% - \ifx\!arg\!empty - \!countB=0 - \else - \!countB=\!arg - \fi} - -\def\!countfigures#1{% - \if #1/% - \def\!next{\ignorespaces}% - \else - \multiply\!scalefactor 10 - \def\!next{\!countfigures}% - \fi - \!next} - -\def\!scaleup#1by#2to#3{% - \expandafter\!separate#1\!nil - \multiply\!countA #2\relax - \advance\!countA \!countB - \if -\!sign - \!countA=-\!countA - \fi - #3=\!countA - \ignorespaces} - -\def\!scaledown#1by#2to#3{% - \!countA=#1\relax% ** get original # - \ifnum \!countA<0 % ** take abs value, - \def\!sign{-}% ** remember sign - \!countA=-\!countA - \else - \def\!sign{}% - \fi - \!countB=\!countA% ** copy |#| - \divide\!countB #2\relax% ** integer part (|#|/sf) - \!countC=\!countB% ** get sf * (|#|/sf) - \multiply\!countC #2\relax - \advance \!countA -\!countC% ** ctA is now remainder - \edef#3{\!sign\the\!countB.}% ** +- integerpart. - \!countC=\!countA % ** Tack on proper number - \ifnum\!countC=0 % ** of zeros after . - \!countC=1 - \fi - \multiply\!countC 10 - \!loop \ifnum #2>\!countC - \edef#3{#3\!zero}% - \multiply\!countC 10 - \repeat - \edef#3{#3\the\!countA}% ** Add on rest of remainder - \ignorespaces} - -\def\!placetickvalues{% - \advance\!offset \tickstovaluesleading - \if!xswitch - \setbox\!boxA=\hbox{% - \def\\##1##2{% - \!dimenput {##2} [B] (##1,\!axisylevel)}% - \beginpicture - \!LTlist - \endpicturesave <\!Xsave,\!Ysave>}% - \!dimenA=\!axisylevel - \advance\!dimenA -\!Ysave - \advance\!dimenA \!tickysign\!offset - \if -\!tickysign - \advance\!dimenA -\ht\!boxA - \else - \advance\!dimenA \dp\!boxA - \fi - \advance\!offset \ht\!boxA - \advance\!offset \dp\!boxA - \!dimenput {\box\!boxA} [Bl] <\!Xsave,\!Ysave> (\!zpt,\!dimenA) - \else - \setbox\!boxA=\hbox{% - \def\\##1##2{% - \!dimenput {##2} [r] (\!axisxlevel,##1)}% - \beginpicture - \!LTlist - \endpicturesave <\!Xsave,\!Ysave>}% - \!dimenA=\!axisxlevel - \advance\!dimenA -\!Xsave - \advance\!dimenA \!tickxsign\!offset - \if -\!tickxsign - \advance\!dimenA -\wd\!boxA - \fi - \advance\!offset \wd\!boxA - \!dimenput {\box\!boxA} [Bl] <\!Xsave,\!Ysave> (\!dimenA,\!zpt) - \fi} - - -\normalgraphs - -% \catcode`!=12 % ***** THIS MUST NEVER BE OMITTED - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/base/thrd-tab.mkii b/Master/texmf-dist/tex/context/base/thrd-tab.mkii new file mode 100644 index 00000000000..dd3838ce2d4 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/thrd-tab.mkii @@ -0,0 +1,2006 @@ +% Since this file is not available in every distribution, we +% have copied the original in this file. The manuals to +% Wichura's PiCTeX and TaBlE packages are not available on +% line and are distributed by respectively the TeX Users Group +% and Personal TeX Inc. Many macros of TaBlE are overloaded +% and/or extended in core-tab.tex. The extensions concern +% splitting over pages, color and consistent spacing. + +% We've patched this file for catcode ! because in luatex we use +% catcode tables and using unprotect/protect is cleaner. Late +% 2007 we also decided no longer to treat quotes and bars the +% TaBLe way and instead of messy pushing and popping of catcodes +% we commented a couple of lines here. We just assume that the +% template has no active bar and quote. Inside tables we now +% have the regular meaning of active bars in ConTeXt. More +% drastic extensions and patched can be found in core-tab.tex. + +% TABLE 1.0 +% Copyright Michael J. Wichura August 1988 (patched by Hans Hagen) + +% The TABLE macros are divided into sections, roughly according to +% function: + +% Section Name Function +% a Allocation Allocates storage registers for parameters. +% f Format Reads format section; builds preamble for \halign; +% processes \ReFormat command. +% g Get Value Converts "spec"'s (as in spec_{LT}) to +% corresponding "values"'s (as in value_{LT}). +% h Hacks Utility macros; error messages; miscellaneous commands. +% k Keys Definition and scanning of format keys. +% n Numeric Macros for TABLE's numeric format. +% s Struts Macros for struts. +% t Tables Sets up \halign for table; end-of-row processing; +% alternate vertical rules; spanning; horizontal +% lines; stretching and shrinking; repositioning +% commands. + +% The name of each internal macro begins with the prefix "\!t", the +% "!" having category code 11, followed by the letter of the section +% in which the macro is defined. For example, a macro beginning "\!th" +% is defined in Section h (Hacks). There a few exceptions: +% the general purpose macros "\!ttemp", "\!ttempa", "\!ttempb", and +% "\!tnext" are repeatedly defined on the spot as the need arises. + +% External macros (and active characters) are defined in the following +% sections: +% Macro Section +% " t +% \- t +% \= t +% \ActivateBarAndQuote h +% \AugmentedTableStrut s +% \BackSpace h +% \BeginFormat f +% \BeginTable t +% \BeginTableParBox a +% \Center t +% \ColumnWidthFactor a +% \ColumnWidthUnit a +% \DQuote h +% \EndFormat k (\EndFormat is actually a key) +% \EndTable t +% \EndTableParBox a +% \Enlarge s +% \enlarge s +% \EveryTable a +% \EveryTableParBox a +% \Expand t +% \InterColumnSpaceFactor a +% \InterColumnSpaceUnit a +% \JustCenter t +% \JustLeft t +% \JustRight t +% \KernFactor a +% \KernUnit a +% \Left t +% \LeftTabskip a +% \LineThicknessFactor a +% \LineThicknessUnit a +% \LongLines t +% \Lower h +% \MakeStrut s +% \NewFormatKey k +% \NormalCWU a +% \NormalICSU a +% \NormalKU a +% \NormalLTU a +% \NormalSU a +% \NormalTableUnits a +% \OpenUp s +% \PseudoVrule t +% \Raise h +% \ReadFormatKeys k +% \ReFormat f +% \Right t +% \RightTabskip a +% \SetTableToWidth t +% \Smash h +% \StandardTableStrut s +% \StrutDepthFactor a +% \StrutHeightFactor a +% \StrutUnit a +% \TaBlE h +% \TracingFormats a +% \TracingKeys a +% \Use t +% \use t +% \VBar h +% \Vspace h +% \VspaceFactor a +% \WidenTableBy t +% \\ t +% \_ t +% \| t +% | t +% ~ t + +\unprotect + +% \catcode `\!=11 +% \catcode `\@=11 + +\newif\ifh@ % normally in plain tex +\newif\ifv@ % normally in plain tex + +% Don't try to read the TABLE macros until after you've read the +% TABLE manual. The internal documentation of the macros is +% sketchy; you need the manual to understand what's going on. +% You should also review the material on \halign s in the TeXbook, +% since TABLE uses an \halign to perform its alignments. + +% In studying the TABLE macros, you should start by skimming the +% macros in the "miscellaneous hacks", "error messages", and "loops" +% subsections of Section h, as well as the "\GetValue" macro in +% Section g; these macros are called many times by the other macros. +% To continue with a "bottom-up" approach, read next Sections k, +% f, and t. (Top-downers should reverse the order.) The other +% Sections can be looked at as the need arises. + +% ********************************************************************* +% SECTION A: ALLOCATION +% ********************************************************************* + +\let\!tacr=\\ % Save meaning of \\ (Needed if TABLE is used with LaTeX + +% ********************************************************************* +% TABLE PARAMETERS: Units +% ********************************************************************* + +\newdimen\LineThicknessUnit +\newdimen\StrutUnit +\newskip \InterColumnSpaceUnit +\newdimen\ColumnWidthUnit +\newdimen\KernUnit + +\let\!taLTU=\LineThicknessUnit % Used in preamble +\let\!taCWU=\ColumnWidthUnit % Used in preamble +\let\!taKU =\KernUnit % Used in preamble + +\newtoks\NormalTLTU +\newtoks\NormalTSU +\newtoks\NormalTICSU +\newtoks\NormalTCWU +\newtoks\NormalTKU + +% NOTE: The user should modify the following DEFAULTS to suit his/her +% taste, and output device: +%\def\PixelsPerInch{300} +\NormalTLTU={1in \divide \LineThicknessUnit by 300 } +\NormalTSU ={\normalbaselineskip + \divide \StrutUnit by 11 } % 11 = 8+3 = NormalT Height+Depth Factors +\NormalTICSU={.5em plus 1fil minus .25em} % .5em = width of a digit +\NormalTCWU ={.5em} +\NormalTKU ={.5em} + +\def\NormalTableUnits{% + \LineThicknessUnit =\the\NormalTLTU + \StrutUnit =\the\NormalTSU + \InterColumnSpaceUnit=\the\NormalTICSU + \ColumnWidthUnit =\the\NormalTCWU + \KernUnit =\the\NormalTKU} + +\NormalTableUnits + +% The user should issue \NormalTableUnits when setting a table +% in a different point size, since the Table...Units themselves +% are static while the Normal...Units vary with the point size. + + +% ********************************************************************* +% TABLE PARAMETERS: Factors +% ********************************************************************* + +\newcount\LineThicknessFactor +\newcount\StrutHeightFactor +\newcount\StrutDepthFactor +\newcount\InterColumnSpaceFactor +\newcount\ColumnWidthFactor +\newcount\KernFactor +\newcount\VspaceFactor + +% DEFAULTS: +\LineThicknessFactor =2 +\StrutHeightFactor =8 +\StrutDepthFactor =3 +\InterColumnSpaceFactor =3 +\ColumnWidthFactor =10 +\KernFactor =1 +\VspaceFactor =2 + + +% ********************************************************************* +% DIAGNOSTIC PARAMETERS +% ********************************************************************* + +\newcount\TracingKeys % >=1 reports new keys, >=2 reports key usage +\newcount\TracingFormats % >=1 reports templates for columns + % >=2 reports \halign preamble + + +% ********************************************************************* +% PARBLOCK PARAMETERS +% ********************************************************************* + +\def\BeginTableParBox#1{% + \vtop\bgroup + \hsize=#1 + \normalbaselines + \let~=\!ttTie + \let\-=\!ttDH + \the\EveryTableParBox} + +\def\EndTableParBox{% + \MakeStrut{0pt}{\StrutDepthFactor\StrutUnit} + \egroup} % finishes the \vtop begun by \BeginTableParbox + +\newtoks\EveryTableParBox +\EveryTableParBox={% + \parindent=0pt + \raggedright + \rightskip=0pt plus 4em % Provide more stretch + \relax} + + +% ********************************************************************* +% EVERY TABLE TOKENS +% ********************************************************************* + +\newtoks\EveryTable +\newtoks\!taTableSpread + + +% ********************************************************************* +% Extreme left- and right- tabskips +% ********************************************************************* + +\newskip\LeftTabskip +\newskip\RightTabskip + + +% ********************************************************************* +% INTERNAL VARIABLES +% ********************************************************************* + +\newcount\!taCountA +\newcount\!taColumnNumber +\newcount\!taRecursionLevel % (Initially 0) + +\newdimen\!taDimenA % used by \Enlarge +\newdimen\!taDimenB % used by \Enlarge +\newdimen\!taDimenC % used by numeric.tex +\newdimen\!taMinimumColumnWidth + +\newtoks\!taToksA + +\newtoks\!taPreamble +\newtoks\!taDataColumnTemplate +\newtoks\!taRuleColumnTemplate +\newtoks\!taOldRuleColumnTemplate +\newtoks\!taLeftGlue +\newtoks\!taRightGlue + +\newskip\!taLastRegularTabskip + +\newif\if!taDigit +\newif\if!taBeginFormat +\newif\if!taOnceOnlyTabskip + + + +% ********************************************************************* +% SECTION H: HACKS +% ********************************************************************* + +% **************************************************************** +% TABLE LOGO +% **************************************************************** +\def\TaBlE{% + T\kern-.27em\lower.5ex\hbox{A}\kern-.18em B\kern-.1em + \lower.5ex\hbox{L}\kern-.075em E} + + +% **************************************************************** +% ACTIVE CHARACTERS +% **************************************************************** + +% ACTIVATE BAR AND QUOTE: Makes | and " active if they aren't +% already active (in which case the user will probably have given +% them special meanings); definitions are provided which effectively +% undoes the activeness outside a Table. + +{\catcode`\|=13 \catcode`\"=13 + \gdef\ActivateBarAndQuote{% + \ifnum \catcode`\|=13 + \else + \catcode`\|=13 + \def|{% + \ifmmode + \vert + \else + \char`\| + \fi}% + \fi + \ifnum \catcode`\"=13 + \else + \catcode`\"=13 + \def"{\char`\"}% + \fi}} + +% **************************************************************** +% Macros for | and " having category code 12. +% **************************************************************** +{\catcode `\|=12 \catcode `\"=12 +\gdef\VBar{|} +\gdef\DQuote{"}} + + +% **************************************************************** +% MISCELANEOUS HACKS +% **************************************************************** + +% MESSAGE : Writes out to terminal and log file. +\def\!thMessage#1{\immediate\write16{#1}\ignorespaces} + +% X: Abbreviation for expandafter +\let\!thx=\expandafter + +% GOBBLE: Eats next token +\def\!thGobble#1{} + +% SPACE TOKEN +\def\\{\let\!thSpaceToken= }\\ + +% HEIGHT, DEPTH, AND WIDTH +\def\!thHeight{height} +\def\!thDepth{depth} +\def\!thWidth{width} + +% TOKSEDEF =: Places , fully expanded a la \edef, in the specified . +\def\!thToksEdef#1=#2{% + \edef\!ttemp{#2}% + #1\!thx{\!ttemp}% + \ignorespaces} + + +% **************************************************************** +% ERROR MESSAGES +% **************************************************************** + +% STORE ERROR MSG +% Replacement text of is a macro with Message +% as its name. E.g., after \StoreErrorMsg\Help{Type }, +% \Help expands to "\Type " +\def\!thStoreErrorMsg#1#2{% + \toks0 =\!thx{\csname #2\endcsname}% + \edef#1{\the\toks0 }} + +% READ ERROR MSG +% Continuing the above example, \ReadErrorMsg\Help produces "Type " +\def\!thReadErrorMsg#1{% + \!thx\!thx\!thx\!thGobble\!thx\string #1} + +% ERROR +\def\!thError#1#2{% + \begingroup + \newlinechar=`\^^J% + \edef\!ttemp{#2}% + \errhelp=\!thx{\!ttemp}% + \!thMessage{% + ^^J\!thReadErrorMsg\!thErrorMsgA + ^^J\!thReadErrorMsg\!thErrorMsgB}% + \errmessage{#1}% + \endgroup} + +% TEXT FOR ERROR MESSAGE +\!thStoreErrorMsg\!thErrorMsgA{% + TABLE error; see manual for explanation.} +\!thStoreErrorMsg\!thErrorMsgB{% + Type \space H \space for immediate help.} + +% GET REPLACEMENT +% must be a control sequence +\def\!thGetReplacement#1#2{% + \begingroup + \!thMessage{#1} + \endlinechar=-1 + \global\read16 to#2% + \endgroup} + + +% **************************************************************** +% LOOP MACRO +% **************************************************************** + +% LOOP ... REPEAT macro from TUGboat Vol 8 #2: 1987 +% Syntax is like that of plain TeX's \loop ... \repeat macro +\def\!thLoop#1\repeat{% + \def\!thIterate{% + #1% + \!thx \!thIterate + \fi}% + \!thIterate + \let\!thIterate\relax} + + +% *************************************************************** +% VERTICALLY-CENTERED SMASH +% *************************************************************** + +% SMASH: Like TeX's \smash, only the argument +% is centered vertically before its height and depth are smashed to 0pt. +\def\Smash{% + \relax + \ifmmode + \expandafter\mathpalette + \expandafter\!thDoMathVCS + \else + \expandafter\!thDoVCS + \fi} + +% DO VCS +\def\!thDoVCS#1{% + \setbox\zerocount\hbox{#1}% + \!thFinishVCS} + +% DO MATH VCS +\def\!thDoMathVCS#1#2{% + \setbox\zerocount\hbox{$\mathsurround\zeropoint#1{#2}$}% + \!thFinishVCS} + +% FINISH VCS +\def\!thFinishVCS{% + \vbox to\zeropoint{\vss\box\zerocount\vss}} + + +% *************************************************************** +% RAISE AND LOWER +% *************************************************************** + +% Like TeX's \raise and \lower, except: (1) The first argument +% to these commands is a dimension expressed in TABLE's usual conventions; +% the default is (StrutHeightFactor+StrutDepthFactor)*StrutUnit/2 +% (2) like \smash, these commands function in math mode as well +% as horizontal mode; (3) again like \smash, the result is declared +% to have height and depth 0pt + +% Examples \Raise2{Stuff}: "Stuff" is raised 2*StrutUnit +% \Raise {Stuff}: "Stuff" is raised a half-line +% $\Lower(10pt){\alpha}$: "$\alpha$" is lowered 10 points + +% RAISE +\def\Raise{% + \def\!thSign{+}% + \!tgGetValue\!thSetDimen} + +% LOWER +\def\Lower{% + \def\!thSign{-}% + \!tgGetValue\!thSetDimen} + +% SET DIMEN +\def\!thSetDimen{% + \ifnum \!tgCode=1 + \ifx \!tgValue\empty + \!taDimenA \StrutHeightFactor\StrutUnit + \advance \!taDimenA \StrutDepthFactor\StrutUnit + \divide \!taDimenA 2 + \else + \!taDimenA \!tgValue\StrutUnit + \fi + \else + \!taDimenA \!tgValue + \fi + \!taDimenA=\!thSign\!taDimenA\relax + % + % BRANCH ON MODE + \ifmmode + \expandafter\mathpalette + \expandafter\!thDoMathRaise + \else + \expandafter\!thDoSimpleRaise + \fi} + +% DO SIMPLE RAISE +\def\!thDoSimpleRaise#1{% + \setbox\zerocount\hbox{\raise \!taDimenA\hbox{#1}}% + \!thFinishRaise} % From Plain TeX: \ht0=0pt \dp0=0pt \box0 + +% DO MATH RAISE +\def\!thDoMathRaise#1#2{% + \setbox\zerocount\hbox{\raise \!taDimenA\hbox{$\mathsurround\zeropoint#1{#2}$}}% + \!thFinishRaise} + +% FINISH RAISE. This is the same as Plain's \finsm@sh; some macro +% packages redefine \finsm@sh. +\def\!thFinishRaise{% + \ht\zerocount\zeropoint + \dp\zerocount\zeropoint + \box\zerocount} + + +% *************************************************************** +% BACK SPACE +% *************************************************************** +\def\BackSpace{% + \!tgGetValue\!thKernBack} + +\def\!thKernBack{% + \kern - + \ifnum \!tgCode=1 + \ifx \!tgValue\empty + \the\KernFactor + \else + \!tgValue % user-specified integer + \fi + \KernUnit + \else + \!tgValue % user-specified dimension + \fi + \ignorespaces}% + + +% *************************************************************** +% Vspace +% *************************************************************** +\def\Vspace{% + \noalign + \bgroup + \!tgGetValue\!thVspace} + +\def\!thVspace{% + \vskip + \ifnum \!tgCode=1 + \ifx \!tgValue\empty + \the\VspaceFactor + \else + \!tgValue % user-specified integer + \fi + \StrutUnit + \else + \!tgValue % user-specified skip + \fi + \egroup} % Ends the \noalign + +% ********************************************************************* +% SECTION F: FORMAT +% ********************************************************************* + +% As explained in Section 3.3 of the manual, TABLE alternates each +% of the user's "data" columns with a "rule" column; moreover, TABLE +% places a "dummy data" column at the left and right of a table. +% A table with n nominal data columns therefore actually has a +% total of +% n (nominal data columns) +% +(n+1) (rule columns) +% + 2 (dummy data columns) +% ____ +% 2n+3 +% columns. + +% FORMATs job is to create an \halign preamble for the alignment +% of these (2n+3) columns. The preamble consists of templates +% for the various columns, strung together with &'s and interlaced +% with \tabskip glue specifications. + +% FORMAT constructs the template for a nomimal data column according +% to the user-specified format keys. As the keys are read from left +% to right, the template is built up "from the inside out" (as +% illustrated in Section 3.1.9 of the manual), the inner-most part +% being the "#" sign. A "|" in the format terminates template +% building; the completed template is adjoined to preamble along +% with the template for the following rule column. + +% Minimum column widths, if specified, are implemented by creating +% an "artificial row" with data entries of the form +% \hskip . +% This row has zero height and depth and is completely invisible. + + +% BEGIN FORMAT +\def\BeginFormat{% + %catcode`\|=12 % Inhibit expansion if | immediately follows a + %catcode`\"=12 % read by \getvalue. + \!taPreamble={}% + \!taColumnNumber=0 + \skip0 =\InterColumnSpaceUnit + \multiply\skip0 \InterColumnSpaceFactor + \divide\skip0 2 + \!taRuleColumnTemplate=\!thx{% + \!thx\tabskip\the\skip0 }% + \!taLastRegularTabskip=\skip0 + \!taOnceOnlyTabskipfalse + \!taBeginFormattrue % Used to intercept key "]" + \def\!tfRowOfWidths{}% Artificial Table Row with horizontal struts + % to enforce specified minimum column widths + \ReadFormatKeys} + +% SET (MINIMUM COLUMN) WIDTH: Invoked by the key "w". +\def\!tfSetWidth{% + \ifx \!tfRowOfWidths \empty % true if no prior "w" keys + \ifnum \!taColumnNumber>0 % true if "w" key is to right of first "|" + \begingroup % RowOfWidths={&\omit || n copies of + % &\omit&\omit}, where n = number of columns + \!taCountA=1 % to the left of this one + \aftergroup \edef \aftergroup \!tfRowOfWidths \aftergroup {% + \aftergroup &\aftergroup \omit + \!thLoop + \ifnum \!taCountA<\!taColumnNumber + \advance\!taCountA 1 + \aftergroup \!tfAOAO + \repeat + \aftergroup }% + \endgroup + \fi + \fi + \ifx [\!ttemp % \!tgGetValue sets \!ttemp = token after w + \!thx\!tfSetWidthText + \else + \!thx\!tfSetWidthValue + \fi} + +% AOAO = (Apersand Omit Ampersand Omit) +\def\!tfAOAO{% + &\omit&\omit} + +% SET WIDTH TEXT +\def\!tfSetWidthText [#1]{% #1 = specified text + \def\!tfWidthText{#1}% + \ReadFormatKeys} + +% SET WIDTH VALUE +\def\!tfSetWidthValue{% + \!taMinimumColumnWidth = + \ifnum \!tgCode=1 + \ifx\!tgValue\empty % Use default multiplier if user didn't specify one + \ColumnWidthFactor + \else + \!tgValue + \fi + \ColumnWidthUnit + \else + \!tgValue + \fi + \def\!tfWidthText{}% Override possible prior `w[sample entry]' + \ReadFormatKeys} + + +% SET TABSKIP: Invoked by the tabskip keys "t" and "o" +\def\!tfSetTabskip{% + \ifnum \!tgCode=1 + \skip0 =\InterColumnSpaceUnit + \multiply\skip0 + \ifx \!tgValue\empty + \InterColumnSpaceFactor % Default integer + \else + \!tgValue % User-specified integer + \fi + \else + \skip0 =\!tgValue % User-specified + \fi + \divide\skip0 by 2 + \ifnum\!taColumnNumber=0 + \!thToksEdef\!taRuleColumnTemplate={% + \the\!taRuleColumnTemplate + \tabskip \the\skip0 } + \else + \!thToksEdef\!taDataColumnTemplate={% + \the\!taDataColumnTemplate + \tabskip \the\skip0 } + \fi + \if!taOnceOnlyTabskip + % % Tabskip used at right of this col only + \else + \!taLastRegularTabskip=\skip0 % Remember this Tabskip, for possible + \fi % restoration after a subsequent"OnceOnly" + \ReadFormatKeys} + + +% SET VRULE: Invoked by the key "|" +\def\!tfSetVrule{% + \!thToksEdef\!taRuleColumnTemplate={% + \noexpand\hfil + \noexpand\vrule + \noexpand\!thWidth + \ifnum \!tgCode=1 + \ifx \!tgValue\empty + \the\LineThicknessFactor % Default integer + \else + \!tgValue % User-specified integer + \fi + \!taLTU % \LineThicknessUnit + \else + \!tgValue % User-specified dimension + \fi + ####% + \noexpand\hfil + \the\!taRuleColumnTemplate} % has \tabskips, when column number=0 + \!tfAdjoinPriorColumn} + +% SET ALTERNATE VRULE: Invoked by the key "\|", in the form +% \|{
%s  %s  %s  %s